From: support Date: Tue, 14 Feb 2023 09:34:43 +0000 (+0000) Subject: Built motion from commit 74d9782e.|2.6.30 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22%7B%7Blicense.messaging?a=commitdiff_plain;h=73d2caa507a0279b0a0de1143122f429df16311d;p=motion2.git Built motion from commit 74d9782e.|2.6.30 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index a900386..72f5452 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-02-14T08:27:09.575Z", + "time": "2023-02-14T09:25:44.676Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index bffab35..6004fb7 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-02-14T08:27:09.575Z", + "time": "2023-02-14T09:25:44.676Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 15a80f4..8e5fd28 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 _0x62fb=['action','STRING','contactManager','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)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','sequelize','VIRTUAL','getDataValue'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x62fb,0x1cd));var _0xb62f=function(_0x4846a7,_0x10fe39){_0x4846a7=_0x4846a7-0x0;var _0x10634e=_0x62fb[_0x4846a7];return _0x10634e;};'use strict';var Sequelize=require(_0xb62f('0x0'));module['exports']={'name':{'type':Sequelize[_0xb62f('0x1')],'get':function(_0x42c7b4){return this[_0xb62f('0x2')](_0xb62f('0x3'));}},'action':{'type':Sequelize[_0xb62f('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xb62f('0x5'),_0xb62f('0x6'),_0xb62f('0x7'),_0xb62f('0x8'),'urlForward',_0xb62f('0x9'),_0xb62f('0xa'),_0xb62f('0xb')]],'msg':_0xb62f('0xc')}},'comment':_0xb62f('0xc')},'data1':{'type':Sequelize[_0xb62f('0x4')](0x1000),'comment':_0xb62f('0xd')},'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[_0xb62f('0x4')](0x1000),'comment':_0xb62f('0xe')},'data4':{'type':Sequelize[_0xb62f('0x4')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0xb62f('0xf')},'data6':{'type':Sequelize['STRING'],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize['TEXT'],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0xa318=['contactManager','motionbar','urlForward','bot','script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','STRING'];(function(_0x53c9f7,_0x5a709f){var _0x4ab248=function(_0x3eee34){while(--_0x3eee34){_0x53c9f7['push'](_0x53c9f7['shift']());}};_0x4ab248(++_0x5a709f);}(_0xa318,0x9c));var _0x8a31=function(_0x3635f7,_0x143c27){_0x3635f7=_0x3635f7-0x0;var _0x5a7f42=_0xa318[_0x3635f7];return _0x5a7f42;};'use strict';var Sequelize=require(_0x8a31('0x0'));module[_0x8a31('0x1')]={'name':{'type':Sequelize[_0x8a31('0x2')],'get':function(_0x581675){return this[_0x8a31('0x3')](_0x8a31('0x4'));}},'action':{'type':Sequelize[_0x8a31('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x8a31('0x6'),'integration',_0x8a31('0x7'),'jscripty',_0x8a31('0x8'),'browser',_0x8a31('0x9'),_0x8a31('0xa')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x8a31('0x5')](0x1000),'comment':_0x8a31('0xb')},'data2':{'type':Sequelize[_0x8a31('0x5')](0x1000),'comment':_0x8a31('0xc')},'data3':{'type':Sequelize[_0x8a31('0x5')](0x1000),'comment':_0x8a31('0xd')},'data4':{'type':Sequelize[_0x8a31('0x5')](0x1000),'comments':_0x8a31('0xe')},'data5':{'type':Sequelize[_0x8a31('0x5')](0x1000),'comments':_0x8a31('0xf')},'data6':{'type':Sequelize['STRING'],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x8a31('0x10')],'comments':_0x8a31('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 64321d2..28a373c 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 _0x7090=['end','status','json','undefined','count','offset','set','Content-Range','apply','reject','save','then','error','name','send','update','body','Action','find','catch','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x143ce6,_0x46e089){var _0x33ed64=function(_0x5a6856){while(--_0x5a6856){_0x143ce6['push'](_0x143ce6['shift']());}};_0x33ed64(++_0x46e089);}(_0x7090,0x69));var _0x0709=function(_0x20845e,_0x211e78){_0x20845e=_0x20845e-0x0;var _0x28cf2b=_0x7090[_0x20845e];return _0x28cf2b;};'use strict';var emlformat=require(_0x0709('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0709('0x1'));var rp=require(_0x0709('0x2'));var moment=require(_0x0709('0x3'));var BPromise=require(_0x0709('0x4'));var Mustache=require(_0x0709('0x5'));var util=require('util');var path=require(_0x0709('0x6'));var sox=require('sox');var csv=require(_0x0709('0x7'));var ejs=require(_0x0709('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0709('0x9'));var crypto=require(_0x0709('0xa'));var jsforce=require(_0x0709('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0709('0x7'));var querystring=require(_0x0709('0xc'));var Papa=require('papaparse');var Redis=require(_0x0709('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x0709('0xe'));var as=require(_0x0709('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0709('0x10'))(_0x0709('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0709('0x12'));var db=require(_0x0709('0x13'))['db'];function respondWithStatusCode(_0x55e18e,_0x4c6a52){_0x4c6a52=_0x4c6a52||0xcc;return function(_0x3af667){if(_0x3af667){return _0x55e18e[_0x0709('0x14')](_0x4c6a52);}return _0x55e18e['status'](_0x4c6a52)[_0x0709('0x15')]();};}function respondWithResult(_0x44a0f8,_0x217c03){_0x217c03=_0x217c03||0xc8;return function(_0x34b35a){if(_0x34b35a){return _0x44a0f8[_0x0709('0x16')](_0x217c03)[_0x0709('0x17')](_0x34b35a);}};}function respondWithFilteredResult(_0x31e6e6,_0x36deb5){return function(_0x43b9b3){if(_0x43b9b3){var _0x437755=typeof _0x36deb5['offset']===_0x0709('0x18')&&typeof _0x36deb5['limit']===_0x0709('0x18');var _0xefc44c=_0x43b9b3[_0x0709('0x19')];var _0x34b847=_0x437755?0x0:_0x36deb5[_0x0709('0x1a')];var _0x254870=_0x437755?_0x43b9b3[_0x0709('0x19')]:_0x36deb5['offset']+_0x36deb5['limit'];var _0x409566;if(_0x254870>=_0xefc44c){_0x254870=_0xefc44c;_0x409566=0xc8;}else{_0x409566=0xce;}_0x31e6e6[_0x0709('0x16')](_0x409566);return _0x31e6e6[_0x0709('0x1b')](_0x0709('0x1c'),_0x34b847+'-'+_0x254870+'/'+_0xefc44c)[_0x0709('0x17')](_0x43b9b3);}return null;};}function patchUpdates(_0x2bdbae){return function(_0x3626ef){try{jsonpatch[_0x0709('0x1d')](_0x3626ef,_0x2bdbae,!![]);}catch(_0x4b22f3){return BPromise[_0x0709('0x1e')](_0x4b22f3);}return _0x3626ef[_0x0709('0x1f')]();};}function saveUpdates(_0x1a50ab,_0x53eb57){return function(_0x2ac90b){if(_0x2ac90b){return _0x2ac90b['update'](_0x1a50ab)[_0x0709('0x20')](function(_0x10e4fd){return _0x10e4fd;});}return null;};}function removeEntity(_0x37a13a,_0x537bbb){return function(_0x4a8a45){if(_0x4a8a45){return _0x4a8a45['destroy']()[_0x0709('0x20')](function(){_0x37a13a[_0x0709('0x16')](0xcc)[_0x0709('0x15')]();});}};}function handleEntityNotFound(_0x4cbdf3,_0x1ffa65){return function(_0x5b9b81){if(!_0x5b9b81){_0x4cbdf3[_0x0709('0x14')](0x194);}return _0x5b9b81;};}function handleError(_0x1ac7fe,_0x32daeb){_0x32daeb=_0x32daeb||0x1f4;return function(_0x2e680c){logger[_0x0709('0x21')](_0x2e680c['stack']);if(_0x2e680c['name']){delete _0x2e680c[_0x0709('0x22')];}_0x1ac7fe['status'](_0x32daeb)[_0x0709('0x23')](_0x2e680c);};}exports[_0x0709('0x24')]=function(_0x27dd67,_0x15c3b9){if(_0x27dd67['body']['id']){delete _0x27dd67[_0x0709('0x25')]['id'];}return db[_0x0709('0x26')][_0x0709('0x27')]({'where':{'id':_0x27dd67['params']['id']}})['then'](handleEntityNotFound(_0x15c3b9,null))[_0x0709('0x20')](saveUpdates(_0x27dd67['body'],null))[_0x0709('0x20')](respondWithResult(_0x15c3b9,null))[_0x0709('0x28')](handleError(_0x15c3b9,null));};exports[_0x0709('0x29')]=function(_0x5aa065,_0x3b80b7){return db['Action'][_0x0709('0x27')]({'where':{'id':_0x5aa065['params']['id']}})['then'](handleEntityNotFound(_0x3b80b7,null))['then'](removeEntity(_0x3b80b7,null))[_0x0709('0x28')](handleError(_0x3b80b7,null));}; \ No newline at end of file +var _0xf1f8=['crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','update','then','destroy','error','stack','name','send','body','Action','params','catch','find','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x56b546,_0x4d5f71){var _0x245a8e=function(_0x3c3060){while(--_0x3c3060){_0x56b546['push'](_0x56b546['shift']());}};_0x245a8e(++_0x4d5f71);}(_0xf1f8,0xd0));var _0x8f1f=function(_0x12d366,_0x737b0){_0x12d366=_0x12d366-0x0;var _0x143aca=_0xf1f8[_0x12d366];return _0x143aca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8f1f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8f1f('0x1'));var rp=require(_0x8f1f('0x2'));var moment=require(_0x8f1f('0x3'));var BPromise=require(_0x8f1f('0x4'));var Mustache=require(_0x8f1f('0x5'));var util=require(_0x8f1f('0x6'));var path=require(_0x8f1f('0x7'));var sox=require(_0x8f1f('0x8'));var csv=require(_0x8f1f('0x9'));var ejs=require(_0x8f1f('0xa'));var fs=require('fs');var fs_extra=require(_0x8f1f('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8f1f('0xc'));var jsforce=require(_0x8f1f('0xd'));var deskjs=require(_0x8f1f('0xe'));var toCsv=require(_0x8f1f('0x9'));var querystring=require(_0x8f1f('0xf'));var Papa=require('papaparse');var Redis=require(_0x8f1f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8f1f('0x11'));var hardwareService=require(_0x8f1f('0x12'));var logger=require(_0x8f1f('0x13'))('api');var utils=require(_0x8f1f('0x14'));var config=require(_0x8f1f('0x15'));var licenseUtil=require(_0x8f1f('0x16'));var db=require(_0x8f1f('0x17'))['db'];function respondWithStatusCode(_0x46fa9e,_0x571bfe){_0x571bfe=_0x571bfe||0xcc;return function(_0x4aa5ab){if(_0x4aa5ab){return _0x46fa9e['sendStatus'](_0x571bfe);}return _0x46fa9e[_0x8f1f('0x18')](_0x571bfe)[_0x8f1f('0x19')]();};}function respondWithResult(_0xb7b42d,_0xf75ad3){_0xf75ad3=_0xf75ad3||0xc8;return function(_0x3c1ac0){if(_0x3c1ac0){return _0xb7b42d[_0x8f1f('0x18')](_0xf75ad3)[_0x8f1f('0x1a')](_0x3c1ac0);}};}function respondWithFilteredResult(_0x4d2b3f,_0x1c7660){return function(_0x4ed6f5){if(_0x4ed6f5){var _0xba3b46=typeof _0x1c7660[_0x8f1f('0x1b')]==='undefined'&&typeof _0x1c7660[_0x8f1f('0x1c')]===_0x8f1f('0x1d');var _0x1ee918=_0x4ed6f5['count'];var _0x2eb2fb=_0xba3b46?0x0:_0x1c7660[_0x8f1f('0x1b')];var _0x2b0971=_0xba3b46?_0x4ed6f5[_0x8f1f('0x1e')]:_0x1c7660[_0x8f1f('0x1b')]+_0x1c7660[_0x8f1f('0x1c')];var _0x34aa32;if(_0x2b0971>=_0x1ee918){_0x2b0971=_0x1ee918;_0x34aa32=0xc8;}else{_0x34aa32=0xce;}_0x4d2b3f[_0x8f1f('0x18')](_0x34aa32);return _0x4d2b3f[_0x8f1f('0x1f')]('Content-Range',_0x2eb2fb+'-'+_0x2b0971+'/'+_0x1ee918)[_0x8f1f('0x1a')](_0x4ed6f5);}return null;};}function patchUpdates(_0x2b8f14){return function(_0x40429d){try{jsonpatch['apply'](_0x40429d,_0x2b8f14,!![]);}catch(_0x1eda2a){return BPromise['reject'](_0x1eda2a);}return _0x40429d['save']();};}function saveUpdates(_0x8ab211,_0x762946){return function(_0x160e6b){if(_0x160e6b){return _0x160e6b[_0x8f1f('0x20')](_0x8ab211)[_0x8f1f('0x21')](function(_0x48b860){return _0x48b860;});}return null;};}function removeEntity(_0x33d9ea,_0x4619d8){return function(_0x4de9c2){if(_0x4de9c2){return _0x4de9c2[_0x8f1f('0x22')]()[_0x8f1f('0x21')](function(){_0x33d9ea[_0x8f1f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d0be3,_0x501630){return function(_0x5b1b9f){if(!_0x5b1b9f){_0x2d0be3['sendStatus'](0x194);}return _0x5b1b9f;};}function handleError(_0x449225,_0x508b59){_0x508b59=_0x508b59||0x1f4;return function(_0x5b134b){logger[_0x8f1f('0x23')](_0x5b134b[_0x8f1f('0x24')]);if(_0x5b134b[_0x8f1f('0x25')]){delete _0x5b134b[_0x8f1f('0x25')];}_0x449225[_0x8f1f('0x18')](_0x508b59)[_0x8f1f('0x26')](_0x5b134b);};}exports[_0x8f1f('0x20')]=function(_0x535015,_0x5a36b8){if(_0x535015[_0x8f1f('0x27')]['id']){delete _0x535015[_0x8f1f('0x27')]['id'];}return db[_0x8f1f('0x28')]['find']({'where':{'id':_0x535015[_0x8f1f('0x29')]['id']}})['then'](handleEntityNotFound(_0x5a36b8,null))[_0x8f1f('0x21')](saveUpdates(_0x535015['body'],null))[_0x8f1f('0x21')](respondWithResult(_0x5a36b8,null))[_0x8f1f('0x2a')](handleError(_0x5a36b8,null));};exports[_0x8f1f('0x22')]=function(_0x4bd915,_0x4ee2b3){return db['Action'][_0x8f1f('0x2b')]({'where':{'id':_0x4bd915[_0x8f1f('0x29')]['id']}})[_0x8f1f('0x21')](handleEntityNotFound(_0x4ee2b3,null))[_0x8f1f('0x21')](removeEntity(_0x4ee2b3,null))[_0x8f1f('0x2a')](handleError(_0x4ee2b3,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 8a5f01f..7893d30 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 _0xdfaa=['../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x229d5a,_0x6d3d74){var _0x3d0574=function(_0x1ced06){while(--_0x1ced06){_0x229d5a['push'](_0x229d5a['shift']());}};_0x3d0574(++_0x6d3d74);}(_0xdfaa,0x1c6));var _0xadfa=function(_0xd2b9e,_0x410a4d){_0xd2b9e=_0xd2b9e-0x0;var _0x496ed6=_0xdfaa[_0xd2b9e];return _0x496ed6;};'use strict';var _=require(_0xadfa('0x0'));var util=require(_0xadfa('0x1'));var logger=require(_0xadfa('0x2'))('api');var moment=require(_0xadfa('0x3'));var BPromise=require(_0xadfa('0x4'));var rp=require(_0xadfa('0x5'));var fs=require('fs');var path=require(_0xadfa('0x6'));var rimraf=require(_0xadfa('0x7'));var config=require(_0xadfa('0x8'));var attributes=require(_0xadfa('0x9'));module[_0xadfa('0xa')]=function(_0x1c639a,_0x6d86f){return _0x1c639a[_0xadfa('0xb')](_0xadfa('0xc'),attributes,{'tableName':_0xadfa('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c1a=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','define','tools_actions','lodash','util','../../config/logger'];(function(_0x2649d9,_0x513732){var _0x55c610=function(_0x274f07){while(--_0x274f07){_0x2649d9['push'](_0x2649d9['shift']());}};_0x55c610(++_0x513732);}(_0x0c1a,0x169));var _0xa0c1=function(_0x43af1f,_0x21d836){_0x43af1f=_0x43af1f-0x0;var _0x113ec2=_0x0c1a[_0x43af1f];return _0x113ec2;};'use strict';var _=require(_0xa0c1('0x0'));var util=require(_0xa0c1('0x1'));var logger=require(_0xa0c1('0x2'))(_0xa0c1('0x3'));var moment=require(_0xa0c1('0x4'));var BPromise=require(_0xa0c1('0x5'));var rp=require(_0xa0c1('0x6'));var fs=require('fs');var path=require(_0xa0c1('0x7'));var rimraf=require(_0xa0c1('0x8'));var config=require(_0xa0c1('0x9'));var attributes=require(_0xa0c1('0xa'));module['exports']=function(_0x3be00e,_0x3f194b){return _0x3be00e[_0xa0c1('0xb')]('Action',attributes,{'tableName':_0xa0c1('0xc'),'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 cbcc9ee..42b8eb1 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(_0x1b1730,_0x220ccc){var _0x1fad11=function(_0x52a28e){while(--_0x52a28e){_0x1b1730['push'](_0x1b1730['shift']());}};_0x1fad11(++_0x220ccc);}(_0x5fc3,0xa8));var _0x35fc=function(_0x389832,_0x10a4a9){_0x389832=_0x389832-0x0;var _0x59429e=_0x5fc3[_0x389832];return _0x59429e;};'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 _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x275803,_0x148216){var _0x33a595=function(_0x16fed9){while(--_0x16fed9){_0x275803['push'](_0x275803['shift']());}};_0x33a595(++_0x148216);}(_0xabce,0x103));var _0xeabc=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xabce[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Action,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 7f784f8..412af97 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 _0x2cc7=['/:id','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','isAuthenticated','update','delete'];(function(_0x210f26,_0x1455da){var _0x5a368c=function(_0x8c6c02){while(--_0x8c6c02){_0x210f26['push'](_0x210f26['shift']());}};_0x5a368c(++_0x1455da);}(_0x2cc7,0xa8));var _0x72cc=function(_0x30b40c,_0x1e6324){_0x30b40c=_0x30b40c-0x0;var _0xd6f652=_0x2cc7[_0x30b40c];return _0xd6f652;};'use strict';var multer=require(_0x72cc('0x0'));var util=require('util');var path=require(_0x72cc('0x1'));var timeout=require(_0x72cc('0x2'));var express=require('express');var router=express[_0x72cc('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x72cc('0x4'));var interaction=require(_0x72cc('0x5'));var config=require(_0x72cc('0x6'));var controller=require(_0x72cc('0x7'));router[_0x72cc('0x8')]('/:id',auth[_0x72cc('0x9')](),controller[_0x72cc('0xa')]);router[_0x72cc('0xb')](_0x72cc('0xc'),auth[_0x72cc('0x9')](),controller[_0x72cc('0xd')]);module[_0x72cc('0xe')]=router; \ No newline at end of file +var _0x0c9a=['destroy','exports','util','path','connect-timeout','Router','../../config/environment','put','/:id','delete','isAuthenticated'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0c9a,0x136));var _0xa0c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c9a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xa0c9('0x0'));var path=require(_0xa0c9('0x1'));var timeout=require(_0xa0c9('0x2'));var express=require('express');var router=express[_0xa0c9('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa0c9('0x4'));var controller=require('./action.controller');router[_0xa0c9('0x5')](_0xa0c9('0x6'),auth['isAuthenticated'](),controller['update']);router[_0xa0c9('0x7')](_0xa0c9('0x6'),auth[_0xa0c9('0x8')](),controller[_0xa0c9('0x9')]);module[_0xa0c9('0xa')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index a865871..72ee61f 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 _0xeff8=['STRING','TEXT','sequelize','exports'];(function(_0x5c37e8,_0x4abedf){var _0x26024d=function(_0x41e396){while(--_0x41e396){_0x5c37e8['push'](_0x5c37e8['shift']());}};_0x26024d(++_0x4abedf);}(_0xeff8,0x186));var _0x8eff=function(_0x365be9,_0x3c88b9){_0x365be9=_0x365be9-0x0;var _0x185c12=_0xeff8[_0x365be9];return _0x185c12;};'use strict';var Sequelize=require(_0x8eff('0x0'));module[_0x8eff('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8eff('0x2')]},'parent':{'type':Sequelize[_0x8eff('0x2')]},'table':{'type':Sequelize[_0x8eff('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x8eff('0x3')]}}; \ No newline at end of file +var _0xee14=['STRING','TEXT'];(function(_0x2135bd,_0x42ad02){var _0x394fec=function(_0x201817){while(--_0x201817){_0x2135bd['push'](_0x2135bd['shift']());}};_0x394fec(++_0x42ad02);}(_0xee14,0x13a));var _0x4ee1=function(_0x284692,_0x2c8094){_0x284692=_0x284692-0x0;var _0x63a287=_0xee14[_0x284692];return _0x63a287;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4ee1('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x4ee1('0x0')]},'parent':{'type':Sequelize[_0x4ee1('0x0')]},'table':{'type':Sequelize[_0x4ee1('0x0')]},'conditions':{'type':Sequelize[_0x4ee1('0x1')]},'joins':{'type':Sequelize[_0x4ee1('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 7844ba2..5c0e64c 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 _0xbce4=['key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','AnalyticCustomReport','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','metric','field','function','format','replace','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(%s)','ROUND(%s)','ValidationErrorItem','table','output','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','IS\x20NOT\x20NULL','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','fieldName','type'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0xbce4,0x76));var _0x4bce=function(_0x21d83c,_0x2901d4){_0x21d83c=_0x21d83c-0x0;var _0x414b48=_0xbce4[_0x21d83c];return _0x414b48;};'use strict';var emlformat=require(_0x4bce('0x0'));var rimraf=require(_0x4bce('0x1'));var zipdir=require(_0x4bce('0x2'));var jsonpatch=require(_0x4bce('0x3'));var rp=require(_0x4bce('0x4'));var moment=require('moment');var BPromise=require(_0x4bce('0x5'));var Mustache=require(_0x4bce('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4bce('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4bce('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4bce('0x9'));var deskjs=require(_0x4bce('0xa'));var toCsv=require(_0x4bce('0xb'));var querystring=require('querystring');var Papa=require(_0x4bce('0xc'));var Redis=require(_0x4bce('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4bce('0xe'));var as=require(_0x4bce('0xf'));var hardwareService=require(_0x4bce('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x4bce('0x11'));var config=require(_0x4bce('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x4bce('0x13')];function respondWithStatusCode(_0x910d5c,_0x50e16c){_0x50e16c=_0x50e16c||0xcc;return function(_0xc448c2){if(_0xc448c2){return _0x910d5c[_0x4bce('0x14')](_0x50e16c);}return _0x910d5c[_0x4bce('0x15')](_0x50e16c)[_0x4bce('0x16')]();};}function respondWithResult(_0x526614,_0x281266){_0x281266=_0x281266||0xc8;return function(_0x2afeb9){if(_0x2afeb9){return _0x526614[_0x4bce('0x15')](_0x281266)[_0x4bce('0x17')](_0x2afeb9);}};}function respondWithFilteredResult(_0x25d0dd,_0x55efa8){return function(_0x4bf792){if(_0x4bf792){var _0x482518=typeof _0x55efa8[_0x4bce('0x18')]===_0x4bce('0x19')&&typeof _0x55efa8[_0x4bce('0x1a')]===_0x4bce('0x19');var _0x7627ef=_0x4bf792[_0x4bce('0x1b')];var _0x332cca=_0x482518?0x0:_0x55efa8[_0x4bce('0x18')];var _0xc04bbd=_0x482518?_0x4bf792['count']:_0x55efa8[_0x4bce('0x18')]+_0x55efa8['limit'];var _0x1a853a;if(_0xc04bbd>=_0x7627ef){_0xc04bbd=_0x7627ef;_0x1a853a=0xc8;}else{_0x1a853a=0xce;}_0x25d0dd['status'](_0x1a853a);return _0x25d0dd[_0x4bce('0x1c')]('Content-Range',_0x332cca+'-'+_0xc04bbd+'/'+_0x7627ef)[_0x4bce('0x17')](_0x4bf792);}return null;};}function patchUpdates(_0x1b72ac){return function(_0x5101d9){try{jsonpatch[_0x4bce('0x1d')](_0x5101d9,_0x1b72ac,!![]);}catch(_0x521eb5){return BPromise[_0x4bce('0x1e')](_0x521eb5);}return _0x5101d9[_0x4bce('0x1f')]();};}function saveUpdates(_0x493386,_0x1b1e63){return function(_0x59a644){if(_0x59a644){return _0x59a644[_0x4bce('0x20')](_0x493386)[_0x4bce('0x21')](function(_0x21675a){return _0x21675a;});}return null;};}function removeEntity(_0x13aab1,_0x50c4cf){return function(_0x294c29){if(_0x294c29){return _0x294c29[_0x4bce('0x22')]()['then'](function(){var _0x3dab68=_0x294c29[_0x4bce('0x23')]({'plain':!![]});var _0x14468f='CustomReports';return db[_0x4bce('0x24')][_0x4bce('0x22')]({'where':{'type':_0x14468f,'resourceId':_0x3dab68['id']}})[_0x4bce('0x21')](function(){return _0x294c29;});})[_0x4bce('0x21')](function(){_0x13aab1[_0x4bce('0x15')](0xcc)[_0x4bce('0x16')]();});}};}function handleEntityNotFound(_0x11c2eb,_0x3b70bf){return function(_0x28b030){if(!_0x28b030){_0x11c2eb[_0x4bce('0x14')](0x194);}return _0x28b030;};}function handleError(_0x1102e0,_0x3a8e18){_0x3a8e18=_0x3a8e18||0x1f4;return function(_0x193e2d){logger[_0x4bce('0x25')](_0x193e2d[_0x4bce('0x26')]);if(_0x193e2d[_0x4bce('0x27')]){delete _0x193e2d['name'];}_0x1102e0[_0x4bce('0x15')](_0x3a8e18)[_0x4bce('0x28')](_0x193e2d);};}exports['index']=function(_0x1c843b,_0x5047ef){var _0x127197={},_0x2e249f={},_0x21b3f={'count':0x0,'rows':[]};var _0x26d2ee=_[_0x4bce('0x29')](db['AnalyticCustomReport']['rawAttributes'],function(_0x3f29f2){return{'name':_0x3f29f2[_0x4bce('0x2a')],'type':_0x3f29f2[_0x4bce('0x2b')][_0x4bce('0x2c')]};});_0x2e249f[_0x4bce('0x2d')]=_[_0x4bce('0x29')](_0x26d2ee,_0x4bce('0x27'));_0x2e249f[_0x4bce('0x2e')]=_[_0x4bce('0x2f')](_0x1c843b[_0x4bce('0x2e')]);_0x2e249f[_0x4bce('0x30')]=_[_0x4bce('0x31')](_0x2e249f[_0x4bce('0x2d')],_0x2e249f[_0x4bce('0x2e')]);_0x127197[_0x4bce('0x32')]=_[_0x4bce('0x31')](_0x2e249f['model'],qs[_0x4bce('0x33')](_0x1c843b[_0x4bce('0x2e')][_0x4bce('0x33')]));_0x127197[_0x4bce('0x32')]=_0x127197[_0x4bce('0x32')][_0x4bce('0x34')]?_0x127197[_0x4bce('0x32')]:_0x2e249f['model'];if(!_0x1c843b[_0x4bce('0x2e')]['hasOwnProperty']('nolimit')){_0x127197['limit']=qs[_0x4bce('0x1a')](_0x1c843b[_0x4bce('0x2e')][_0x4bce('0x1a')]);_0x127197[_0x4bce('0x18')]=qs[_0x4bce('0x18')](_0x1c843b[_0x4bce('0x2e')][_0x4bce('0x18')]);}_0x127197[_0x4bce('0x35')]=qs[_0x4bce('0x36')](_0x1c843b[_0x4bce('0x2e')][_0x4bce('0x36')]);_0x127197[_0x4bce('0x37')]=qs[_0x4bce('0x30')](_[_0x4bce('0x38')](_0x1c843b[_0x4bce('0x2e')],_0x2e249f['filters']),_0x26d2ee);if(_0x1c843b['query']['filter']){_0x127197['where']=_[_0x4bce('0x39')](_0x127197[_0x4bce('0x37')],{'$or':_[_0x4bce('0x29')](_0x26d2ee,function(_0x28b83d){if(_0x28b83d[_0x4bce('0x2b')]!==_0x4bce('0x3a')){var _0x4061cf={};_0x4061cf[_0x28b83d[_0x4bce('0x27')]]={'$like':'%'+_0x1c843b[_0x4bce('0x2e')][_0x4bce('0x3b')]+'%'};return _0x4061cf;}})});}_0x127197=_[_0x4bce('0x39')]({},_0x127197,_0x1c843b[_0x4bce('0x3c')]);var _0x2e0446={'where':_0x127197[_0x4bce('0x37')]};return db[_0x4bce('0x3d')][_0x4bce('0x1b')](_0x2e0446)[_0x4bce('0x21')](function(_0x3bd8dd){_0x21b3f[_0x4bce('0x1b')]=_0x3bd8dd;if(_0x1c843b[_0x4bce('0x2e')][_0x4bce('0x3e')]){_0x127197[_0x4bce('0x3f')]=[{'all':!![]}];}return db[_0x4bce('0x3d')][_0x4bce('0x40')](_0x127197);})[_0x4bce('0x21')](function(_0x37f958){_0x21b3f['rows']=_0x37f958;return _0x21b3f;})['then'](respondWithFilteredResult(_0x5047ef,_0x127197))[_0x4bce('0x41')](handleError(_0x5047ef,null));};exports[_0x4bce('0x42')]=function(_0x570049,_0x2fa25c){var _0x4ec547={'raw':![],'where':{'id':_0x570049[_0x4bce('0x43')]['id']}},_0x2dbe3f={};_0x2dbe3f[_0x4bce('0x2d')]=_[_0x4bce('0x2f')](db[_0x4bce('0x3d')][_0x4bce('0x44')]);_0x2dbe3f['query']=_[_0x4bce('0x2f')](_0x570049[_0x4bce('0x2e')]);_0x2dbe3f[_0x4bce('0x30')]=_[_0x4bce('0x31')](_0x2dbe3f[_0x4bce('0x2d')],_0x2dbe3f[_0x4bce('0x2e')]);_0x4ec547[_0x4bce('0x32')]=_[_0x4bce('0x31')](_0x2dbe3f[_0x4bce('0x2d')],qs[_0x4bce('0x33')](_0x570049[_0x4bce('0x2e')][_0x4bce('0x33')]));_0x4ec547[_0x4bce('0x32')]=_0x4ec547['attributes'][_0x4bce('0x34')]?_0x4ec547[_0x4bce('0x32')]:_0x2dbe3f[_0x4bce('0x2d')];if(_0x570049[_0x4bce('0x2e')][_0x4bce('0x3e')]){_0x4ec547[_0x4bce('0x3f')]=[{'all':!![]}];}_0x4ec547=_['merge']({},_0x4ec547,_0x570049[_0x4bce('0x3c')]);return db['AnalyticCustomReport']['find'](_0x4ec547)[_0x4bce('0x21')](handleEntityNotFound(_0x2fa25c,null))[_0x4bce('0x21')](respondWithResult(_0x2fa25c,null))[_0x4bce('0x41')](handleError(_0x2fa25c,null));};exports[_0x4bce('0x45')]=function(_0x20f25b,_0x40ffcc){return db[_0x4bce('0x3d')][_0x4bce('0x45')](_0x20f25b[_0x4bce('0x46')],{})[_0x4bce('0x21')](function(_0x19075c){var _0x1d4993=_0x20f25b[_0x4bce('0x47')]['get']({'plain':!![]});if(!_0x1d4993)throw new Error(_0x4bce('0x48'));if(_0x1d4993[_0x4bce('0x49')]===_0x4bce('0x47')){var _0x44e206=_0x19075c[_0x4bce('0x23')]({'plain':!![]});var _0x509947=_0x4bce('0x4a');return db[_0x4bce('0x4b')][_0x4bce('0x4c')]({'where':{'name':_0x509947,'userProfileId':_0x1d4993[_0x4bce('0x4d')]},'raw':!![]})[_0x4bce('0x21')](function(_0x8c373f){if(_0x8c373f&&_0x8c373f[_0x4bce('0x4e')]===0x0){return db[_0x4bce('0x24')][_0x4bce('0x45')]({'name':_0x44e206[_0x4bce('0x27')],'resourceId':_0x44e206['id'],'type':_0x4bce('0x4f'),'sectionId':_0x8c373f['id']},{})[_0x4bce('0x21')](function(){return _0x19075c;});}else{return _0x19075c;}})[_0x4bce('0x41')](function(_0x41a05b){logger[_0x4bce('0x25')](_0x4bce('0x50'),_0x41a05b);throw _0x41a05b;});}return _0x19075c;})[_0x4bce('0x21')](respondWithResult(_0x40ffcc,0xc9))[_0x4bce('0x41')](handleError(_0x40ffcc,null));};exports['update']=function(_0x8baed6,_0x1644e9){if(_0x8baed6[_0x4bce('0x46')]['id']){delete _0x8baed6[_0x4bce('0x46')]['id'];}return db[_0x4bce('0x3d')][_0x4bce('0x4c')]({'where':{'id':_0x8baed6[_0x4bce('0x43')]['id']}})[_0x4bce('0x21')](handleEntityNotFound(_0x1644e9,null))[_0x4bce('0x21')](saveUpdates(_0x8baed6[_0x4bce('0x46')],null))[_0x4bce('0x21')](respondWithResult(_0x1644e9,null))['catch'](handleError(_0x1644e9,null));};exports[_0x4bce('0x22')]=function(_0x3ca74d,_0x2a8bb7){return db[_0x4bce('0x3d')][_0x4bce('0x4c')]({'where':{'id':_0x3ca74d[_0x4bce('0x43')]['id']}})[_0x4bce('0x21')](handleEntityNotFound(_0x2a8bb7,null))[_0x4bce('0x21')](removeEntity(_0x2a8bb7,null))[_0x4bce('0x41')](handleError(_0x2a8bb7,null));};exports['preview']=function(_0x5d5e20,_0x5c3cbf){var _0x19a3b3=0xa;var _0x5335af=[_0x4bce('0x51'),_0x4bce('0x52'),_0x4bce('0x53'),_0x4bce('0x54')];var _0x5f336f={'SUM':_0x4bce('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4bce('0x56'),'MAX':_0x4bce('0x57'),'MIN':_0x4bce('0x58'),'AVG':_0x4bce('0x59'),'GROUP_CONCAT':_0x4bce('0x5a'),'GROUP_CONCAT ASC':_0x4bce('0x5b'),'GROUP_CONCAT DESC':_0x4bce('0x5c')};var _0x2e9e3d={'SEC_TO_TIME':_0x4bce('0x5d'),'DATE':_0x4bce('0x5e'),'HOUR':_0x4bce('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4bce('0x60')};var _0x17fb99=function(_0x200113){return!_[_0x4bce('0x61')]([_0x4bce('0x62'),'IS\x20NOT\x20NULL',_0x4bce('0x63'),_0x4bce('0x64')],_0x200113);};var _0xe51977=function(_0x4ac33b){if(!_0x4ac33b||!_0x4ac33b[_0x4bce('0x65')][_0x4bce('0x34')]){return'';}for(var _0x2323ba='(',_0x5e62ae=0x0;_0x5e62ae<_0x4ac33b['rules'][_0x4bce('0x34')];_0x5e62ae+=0x1){_0x5e62ae>0x0&&(_0x2323ba+='\x20'+_0x4ac33b[_0x4bce('0x66')]+'\x20');_0x2323ba+=_0x4ac33b[_0x4bce('0x65')][_0x5e62ae][_0x4bce('0x67')]?_0xe51977(_0x4ac33b[_0x4bce('0x65')][_0x5e62ae]['group']):_0x4ac33b[_0x4bce('0x65')][_0x5e62ae]['field']+'\x20'+_0x4ac33b[_0x4bce('0x65')][_0x5e62ae][_0x4bce('0x68')]+(_0x17fb99(_0x4ac33b['rules'][_0x5e62ae]['condition'])?'\x20'+_0x4ac33b[_0x4bce('0x65')][_0x5e62ae][_0x4bce('0x69')]:'');}return _0x2323ba+')';};var _0x43f496={'where':{'id':_0x5d5e20[_0x4bce('0x43')]['id']}},_0xce4518,_0x1ce19a,_0x1546c5,_0x106920,_0x32f626;_0x43f496=_[_0x4bce('0x39')]({},_0x43f496,_0x5d5e20[_0x4bce('0x3c')]);return db[_0x4bce('0x3d')][_0x4bce('0x4c')](_0x43f496)[_0x4bce('0x21')](function(_0xb8cbcf){if(_0xb8cbcf){_0xce4518=_0xb8cbcf;return _0xb8cbcf[_0x4bce('0x6a')]();}return null;})[_0x4bce('0x21')](function(_0x1dc282){if(_0x1dc282){if(!_0x1dc282['length']){throw new db[(_0x4bce('0x6b'))]['ValidationErrorItem'](_0x4bce('0x6c'),0x193);}_0x1ce19a=_0x1dc282;return db[_0x4bce('0x6d')]['findAll']({'raw':!![]});}return null;})[_0x4bce('0x21')](function(_0x75c1c5){if(_0x75c1c5){_0x1546c5=_[_0x4bce('0x6e')](_0x75c1c5,'id');var _0x5990c9;var _0x2b829d=squel[_0x4bce('0x6f')]();_0x2b829d[_0x4bce('0x70')](_0xce4518['table']);for(var _0x2fd96b=0x0;_0x2fd96b<_0x1ce19a[_0x4bce('0x34')];_0x2fd96b+=0x1){_0x5990c9=_0x1ce19a[_0x2fd96b][_0x4bce('0x71')]?_0x1546c5[_0x1ce19a[_0x2fd96b]['MetricId']][_0x4bce('0x72')]:_0x1ce19a[_0x2fd96b][_0x4bce('0x73')];_0x5990c9=_0x1ce19a[_0x2fd96b]['function']?_['replace'](_0x5f336f[_0x1ce19a[_0x2fd96b][_0x4bce('0x74')]],'%s',_0x5990c9):_0x5990c9;_0x5990c9=_0x1ce19a[_0x2fd96b][_0x4bce('0x75')]?_[_0x4bce('0x76')](_0x2e9e3d[_0x1ce19a[_0x2fd96b]['format']],'%s',_0x5990c9):_0x5990c9;if(_0x1ce19a[_0x2fd96b][_0x4bce('0x77')]){_0x2b829d[_0x4bce('0x67')](_0x5990c9);}_0x1ce19a[_0x2fd96b][_0x4bce('0x78')]&&_0x2b829d[_0x4bce('0x35')](_0x5990c9,_0x1ce19a[_0x2fd96b][_0x4bce('0x78')]===_0x4bce('0x79')?![]:!![]);_0x2b829d['field'](_0x5990c9,_0x1ce19a[_0x2fd96b][_0x4bce('0x7a')]||_0x5990c9);}if(_0xce4518[_0x4bce('0x7b')]){_0xce4518[_0x4bce('0x7b')]=JSON[_0x4bce('0x7c')](_0xce4518['joins']);for(var _0xdb9bff=0x0;_0xdb9bff<_0xce4518[_0x4bce('0x7b')][_0x4bce('0x34')];_0xdb9bff+=0x1){if(_0xce4518[_0x4bce('0x7b')][_0xdb9bff][_0x4bce('0x2b')]&&_['includes'](_0x5335af,_0xce4518[_0x4bce('0x7b')][_0xdb9bff]['type'])&&_0xce4518[_0x4bce('0x7b')][_0xdb9bff][_0x4bce('0x7d')]&&_0xce4518[_0x4bce('0x7b')][_0xdb9bff][_0x4bce('0x7e')]&&_0xce4518[_0x4bce('0x7b')][_0xdb9bff]['foreignKey']){_0x2b829d[_0xce4518[_0x4bce('0x7b')][_0xdb9bff][_0x4bce('0x2b')]](_0xce4518[_0x4bce('0x7b')][_0xdb9bff][_0x4bce('0x7e')],null,util[_0x4bce('0x75')](_0x4bce('0x7f'),_0xce4518['table'],_0xce4518[_0x4bce('0x7b')][_0xdb9bff][_0x4bce('0x7d')],_0xce4518[_0x4bce('0x7b')][_0xdb9bff]['foreignTable'],_0xce4518[_0x4bce('0x7b')][_0xdb9bff][_0x4bce('0x80')]));}}}if(_0xce4518[_0x4bce('0x81')]){_0xce4518['conditions']=JSON[_0x4bce('0x7c')](_0xce4518[_0x4bce('0x81')]);_0x2b829d[_0x4bce('0x37')](_0xe51977(_0xce4518['conditions'][_0x4bce('0x67')]));}_0x32f626=_0x2b829d[_0x4bce('0x82')]();_0x2b829d[_0x4bce('0x1a')](_0x19a3b3);_0x2b829d[_0x4bce('0x18')](0x0);logger['debug'](_0x4bce('0x83'),_0x2b829d[_0x4bce('0x84')]());return dbH[_0x4bce('0x85')][_0x4bce('0x2e')](_0x2b829d['toString'](),{'type':dbH[_0x4bce('0x85')][_0x4bce('0x86')][_0x4bce('0x87')]});}})[_0x4bce('0x21')](respondWithResult(_0x5c3cbf,null))[_0x4bce('0x41')](handleError(_0x5c3cbf,null));};function runReport(_0x5b6985,_0x69f29d,_0x40d8bd){var _0x52c5d3=_0x69f29d['name'];var _0x4a069e=0xa;var _0x57c436=['join',_0x4bce('0x52'),_0x4bce('0x53'),_0x4bce('0x54')];var _0x57fc4c={'SUM':_0x4bce('0x55'),'COUNT':_0x4bce('0x88'),'COUNT DISTINCT':_0x4bce('0x56'),'MAX':_0x4bce('0x57'),'MIN':_0x4bce('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4bce('0x5a'),'GROUP_CONCAT ASC':_0x4bce('0x5b'),'GROUP_CONCAT DESC':_0x4bce('0x5c')};var _0x57db78={'SEC_TO_TIME':_0x4bce('0x5d'),'DATE':_0x4bce('0x5e'),'HOUR':_0x4bce('0x5f'),'ROUND':_0x4bce('0x89'),'UNIX_TIMESTAMP':_0x4bce('0x60')};var _0xaeb4cd=function(_0x3a488f){return!_[_0x4bce('0x61')]([_0x4bce('0x62'),'IS\x20NOT\x20NULL',_0x4bce('0x63'),'IS\x20NOT\x20EMPTY'],_0x3a488f);};var _0x677047=function(_0x3be4a6){if(!_0x3be4a6||!_0x3be4a6['rules'][_0x4bce('0x34')]){return'';}for(var _0x1351cb='(',_0x517ef4=0x0;_0x517ef4<_0x3be4a6[_0x4bce('0x65')][_0x4bce('0x34')];_0x517ef4+=0x1){_0x517ef4>0x0&&(_0x1351cb+='\x20'+_0x3be4a6[_0x4bce('0x66')]+'\x20');_0x1351cb+=_0x3be4a6['rules'][_0x517ef4][_0x4bce('0x67')]?_0x677047(_0x3be4a6[_0x4bce('0x65')][_0x517ef4][_0x4bce('0x67')]):_0x3be4a6[_0x4bce('0x65')][_0x517ef4][_0x4bce('0x73')]+'\x20'+_0x3be4a6[_0x4bce('0x65')][_0x517ef4][_0x4bce('0x68')]+(_0xaeb4cd(_0x3be4a6['rules'][_0x517ef4][_0x4bce('0x68')])?'\x20'+_0x3be4a6['rules'][_0x517ef4][_0x4bce('0x69')]:'');}return _0x1351cb+')';};var _0x2cf8a0={'where':{'id':_0x5b6985['id']}},_0x3bdbd5,_0x3eb645,_0x262525,_0xec6b3a,_0x448a71;_0x2cf8a0=_['merge']({},_0x2cf8a0,_0x40d8bd);return db[_0x4bce('0x3d')][_0x4bce('0x4c')](_0x2cf8a0)[_0x4bce('0x21')](function(_0x67631e){if(_0x67631e){_0x3bdbd5=_0x67631e;return _0x67631e[_0x4bce('0x6a')]();}return null;})['then'](function(_0x379f9e){if(_0x379f9e){if(!_0x379f9e['length']){throw new db['Sequelize'][(_0x4bce('0x8a'))](_0x4bce('0x6c'),0x193);}_0x3eb645=_0x379f9e;return db['AnalyticMetric'][_0x4bce('0x40')]({'raw':!![]});}return null;})[_0x4bce('0x21')](function(_0x17953a){if(_0x17953a){_0x262525=_[_0x4bce('0x6e')](_0x17953a,'id');var _0x5eb332;var _0x2acb14=squel[_0x4bce('0x6f')]();_0x2acb14['from'](_0x3bdbd5[_0x4bce('0x8b')]);for(var _0x14998a=0x0;_0x14998a<_0x3eb645['length'];_0x14998a+=0x1){_0x5eb332=_0x3eb645[_0x14998a][_0x4bce('0x71')]?_0x262525[_0x3eb645[_0x14998a]['MetricId']]['metric']:_0x3eb645[_0x14998a][_0x4bce('0x73')];_0x5eb332=_0x3eb645[_0x14998a][_0x4bce('0x74')]?_['replace'](_0x57fc4c[_0x3eb645[_0x14998a][_0x4bce('0x74')]],'%s',_0x5eb332):_0x5eb332;_0x5eb332=_0x3eb645[_0x14998a][_0x4bce('0x75')]?_[_0x4bce('0x76')](_0x57db78[_0x3eb645[_0x14998a]['format']],'%s',_0x5eb332):_0x5eb332;if(_0x3eb645[_0x14998a][_0x4bce('0x77')]){_0x2acb14[_0x4bce('0x67')](_0x5eb332);}_0x3eb645[_0x14998a][_0x4bce('0x78')]&&_0x2acb14[_0x4bce('0x35')](_0x5eb332,_0x3eb645[_0x14998a][_0x4bce('0x78')]==='DESC'?![]:!![]);_0x2acb14[_0x4bce('0x73')](_0x5eb332,_0x3eb645[_0x14998a]['alias']||_0x5eb332);}if(_0x3bdbd5[_0x4bce('0x7b')]){_0x3bdbd5[_0x4bce('0x7b')]=JSON[_0x4bce('0x7c')](_0x3bdbd5[_0x4bce('0x7b')]);for(var _0x57eab3=0x0;_0x57eab3<_0x3bdbd5[_0x4bce('0x7b')]['length'];_0x57eab3+=0x1){if(_0x3bdbd5[_0x4bce('0x7b')][_0x57eab3][_0x4bce('0x2b')]&&_[_0x4bce('0x61')](_0x57c436,_0x3bdbd5[_0x4bce('0x7b')][_0x57eab3]['type'])&&_0x3bdbd5['joins'][_0x57eab3][_0x4bce('0x7d')]&&_0x3bdbd5['joins'][_0x57eab3]['foreignTable']&&_0x3bdbd5[_0x4bce('0x7b')][_0x57eab3][_0x4bce('0x80')]){_0x2acb14[_0x3bdbd5['joins'][_0x57eab3][_0x4bce('0x2b')]](_0x3bdbd5[_0x4bce('0x7b')][_0x57eab3][_0x4bce('0x7e')],null,util[_0x4bce('0x75')]('%s.%s\x20=\x20%s.%s',_0x3bdbd5['table'],_0x3bdbd5[_0x4bce('0x7b')][_0x57eab3][_0x4bce('0x7d')],_0x3bdbd5[_0x4bce('0x7b')][_0x57eab3][_0x4bce('0x7e')],_0x3bdbd5['joins'][_0x57eab3]['foreignKey']));}}}if(_0x3bdbd5['conditions']){_0x3bdbd5[_0x4bce('0x81')]=JSON[_0x4bce('0x7c')](_0x3bdbd5[_0x4bce('0x81')]);_0x2acb14[_0x4bce('0x37')](_0x677047(_0x3bdbd5['conditions'][_0x4bce('0x67')]));}_0x448a71=_0x2acb14['clone']();_0x2acb14[_0x4bce('0x1a')](_0x4a069e);_0x2acb14[_0x4bce('0x18')](0x0);return;}})[_0x4bce('0x21')](function(){if(_0x69f29d[_0x4bce('0x8c')]==='web'){return null;}var _0x3a275a=_['merge'](_0x69f29d,{'name':_0x69f29d[_0x4bce('0x8d')]||_0x69f29d[_0x4bce('0x27')]||_0x3bdbd5['name'],'basename':_0x52c5d3,'savename':util['format'](_0x4bce('0x8e'),_0x69f29d[_0x4bce('0x27')]||_0x3bdbd5[_0x4bce('0x27')],require(_0x4bce('0x8f'))[_0x4bce('0x90')](0x4),_0x69f29d[_0x4bce('0x8c')]||_0x4bce('0x91')),'reportId':_0x3bdbd5['id'],'reportType':_0x4bce('0x92')});return db[_0x4bce('0x93')]['create'](_0x3a275a,{'raw':!![]});})['then'](function(_0x2f0af8){if(_0x3bdbd5[_0x4bce('0x8b')]===_0x4bce('0x94')){_0x448a71[_0x4bce('0x37')](_0x3bdbd5[_0x4bce('0x8b')]+_0x4bce('0x95'),_0x69f29d[_0x4bce('0x96')],_0x69f29d[_0x4bce('0x97')]);}else{_0x448a71[_0x4bce('0x37')](_0x3bdbd5[_0x4bce('0x8b')]+_0x4bce('0x98'),_0x69f29d[_0x4bce('0x96')],_0x69f29d[_0x4bce('0x97')]);}if(_0x2f0af8){logger[_0x4bce('0x99')]('Run\x20Query:',_0x448a71['toString']());require(_0x4bce('0x9a'))['fork'](path[_0x4bce('0x51')](__dirname,_0x4bce('0x9b'),_0x2f0af8[_0x4bce('0x8c')]),[_0x2f0af8['id'],_0x448a71[_0x4bce('0x84')](),path[_0x4bce('0x51')](__dirname,_0x4bce('0x9c'),_0x2f0af8[_0x4bce('0x9d')]),_0x52c5d3]);return _0x2f0af8;}else{var _0x308979=squel[_0x4bce('0x6f')]();_0x308979[_0x4bce('0x70')]('('+_0x448a71[_0x4bce('0x84')]()+')',_0x4bce('0x9e'));_0x308979[_0x4bce('0x73')](_0x4bce('0x9f'),'count');_0x448a71[_0x4bce('0x1a')](_0x69f29d[_0x4bce('0x1a')]||_0x4a069e);_0x448a71[_0x4bce('0x18')](_0x69f29d[_0x4bce('0x18')]||0x0);return dbH[_0x4bce('0x85')][_0x4bce('0x2e')](_0x308979['toString'](),{'type':dbH[_0x4bce('0x85')][_0x4bce('0x86')]['SELECT']})[_0x4bce('0x21')](function(_0x168b67){if(!_0x168b67[_0x4bce('0x34')]){_0xec6b3a=0x0;}else{_0xec6b3a=_0x168b67[0x0][_0x4bce('0x1b')]||0x0;}return dbH['sequelize'][_0x4bce('0x2e')](_0x448a71[_0x4bce('0x84')](),{'type':dbH['sequelize'][_0x4bce('0x86')][_0x4bce('0x87')]});})[_0x4bce('0x21')](function(_0x589613){return{'rows':_0x589613||[],'count':_0xec6b3a};});}});}exports['run']=function(_0xf590b1,_0x2d94f7){return runReport(_0xf590b1[_0x4bce('0x43')],_0xf590b1['query'],_0xf590b1[_0x4bce('0x3c')])[_0x4bce('0x21')](respondWithResult(_0x2d94f7,null))['catch'](handleError(_0x2d94f7,null));};exports[_0x4bce('0xa0')]=runReport;exports[_0x4bce('0x2e')]=function(_0x43b334,_0x177167){var _0x2f346c=0xa;var _0x3dc540=[_0x4bce('0x51'),'left_join',_0x4bce('0x53'),'cross_join'];var _0x44a957={'SUM':_0x4bce('0x55'),'COUNT':_0x4bce('0x88'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x4bce('0x58'),'AVG':_0x4bce('0x59'),'GROUP_CONCAT':_0x4bce('0x5a'),'GROUP_CONCAT ASC':_0x4bce('0x5b'),'GROUP_CONCAT DESC':_0x4bce('0x5c')};var _0x327c64={'SEC_TO_TIME':_0x4bce('0x5d'),'DATE':_0x4bce('0x5e'),'HOUR':_0x4bce('0x5f'),'ROUND':_0x4bce('0x89'),'UNIX_TIMESTAMP':_0x4bce('0x60')};var _0x64f6de=function(_0x3cfd89){return!_[_0x4bce('0x61')]([_0x4bce('0x62'),_0x4bce('0xa1'),_0x4bce('0x63'),'IS\x20NOT\x20EMPTY'],_0x3cfd89);};var _0x30a83a=function(_0xd3f16){if(!_0xd3f16||!_0xd3f16[_0x4bce('0x65')][_0x4bce('0x34')]){return'';}for(var _0x50d18f='(',_0x290bb9=0x0;_0x290bb9<_0xd3f16['rules'][_0x4bce('0x34')];_0x290bb9+=0x1){_0x290bb9>0x0&&(_0x50d18f+='\x20'+_0xd3f16[_0x4bce('0x66')]+'\x20');_0x50d18f+=_0xd3f16[_0x4bce('0x65')][_0x290bb9]['group']?_0x30a83a(_0xd3f16[_0x4bce('0x65')][_0x290bb9][_0x4bce('0x67')]):_0xd3f16[_0x4bce('0x65')][_0x290bb9]['field']+'\x20'+_0xd3f16[_0x4bce('0x65')][_0x290bb9][_0x4bce('0x68')]+(_0x64f6de(_0xd3f16[_0x4bce('0x65')][_0x290bb9][_0x4bce('0x68')])?'\x20'+_0xd3f16[_0x4bce('0x65')][_0x290bb9]['value']:'');}return _0x50d18f+')';};var _0x4f6211={'where':{'id':_0x43b334['params']['id']}},_0x5ea2a5,_0x30889b,_0x1eb78c,_0x3b9172,_0x3846d1;_0x4f6211=_[_0x4bce('0x39')]({},_0x4f6211,_0x43b334['options']);return db[_0x4bce('0x3d')]['find'](_0x4f6211)[_0x4bce('0x21')](function(_0x84daaf){if(_0x84daaf){_0x5ea2a5=_0x84daaf;return _0x84daaf[_0x4bce('0x6a')]();}return null;})['then'](function(_0x59f827){if(_0x59f827){if(!_0x59f827[_0x4bce('0x34')]){throw new db['Sequelize'][(_0x4bce('0x8a'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x30889b=_0x59f827;return db[_0x4bce('0x6d')][_0x4bce('0x40')]({'raw':!![]});}return null;})['then'](function(_0x9f396a){if(_0x9f396a){_0x1eb78c=_[_0x4bce('0x6e')](_0x9f396a,'id');var _0x3a3cd6;var _0x3916a3=squel[_0x4bce('0x6f')]();_0x3916a3['from'](_0x5ea2a5['table']);for(var _0x153dc8=0x0;_0x153dc8<_0x30889b['length'];_0x153dc8+=0x1){_0x3a3cd6=_0x30889b[_0x153dc8][_0x4bce('0x71')]?_0x1eb78c[_0x30889b[_0x153dc8][_0x4bce('0x71')]][_0x4bce('0x72')]:_0x30889b[_0x153dc8][_0x4bce('0x73')];_0x3a3cd6=_0x30889b[_0x153dc8][_0x4bce('0x74')]?_[_0x4bce('0x76')](_0x44a957[_0x30889b[_0x153dc8]['function']],'%s',_0x3a3cd6):_0x3a3cd6;_0x3a3cd6=_0x30889b[_0x153dc8][_0x4bce('0x75')]?_[_0x4bce('0x76')](_0x327c64[_0x30889b[_0x153dc8][_0x4bce('0x75')]],'%s',_0x3a3cd6):_0x3a3cd6;if(_0x30889b[_0x153dc8][_0x4bce('0x77')]){_0x3916a3['group'](_0x3a3cd6);}_0x30889b[_0x153dc8][_0x4bce('0x78')]&&_0x3916a3['order'](_0x3a3cd6,_0x30889b[_0x153dc8]['orderBy']===_0x4bce('0x79')?![]:!![]);_0x3916a3[_0x4bce('0x73')](_0x3a3cd6,_0x30889b[_0x153dc8]['alias']||_0x3a3cd6);}if(_0x5ea2a5['joins']){_0x5ea2a5[_0x4bce('0x7b')]=JSON['parse'](_0x5ea2a5['joins']);for(var _0x5e606b=0x0;_0x5e606b<_0x5ea2a5[_0x4bce('0x7b')]['length'];_0x5e606b+=0x1){if(_0x5ea2a5[_0x4bce('0x7b')][_0x5e606b]['type']&&_[_0x4bce('0x61')](_0x3dc540,_0x5ea2a5[_0x4bce('0x7b')][_0x5e606b][_0x4bce('0x2b')])&&_0x5ea2a5[_0x4bce('0x7b')][_0x5e606b]['parentKey']&&_0x5ea2a5[_0x4bce('0x7b')][_0x5e606b][_0x4bce('0x7e')]&&_0x5ea2a5[_0x4bce('0x7b')][_0x5e606b][_0x4bce('0x80')]){_0x3916a3[_0x5ea2a5[_0x4bce('0x7b')][_0x5e606b][_0x4bce('0x2b')]](_0x5ea2a5[_0x4bce('0x7b')][_0x5e606b][_0x4bce('0x7e')],null,util[_0x4bce('0x75')](_0x4bce('0x7f'),_0x5ea2a5[_0x4bce('0x8b')],_0x5ea2a5[_0x4bce('0x7b')][_0x5e606b][_0x4bce('0x7d')],_0x5ea2a5['joins'][_0x5e606b][_0x4bce('0x7e')],_0x5ea2a5[_0x4bce('0x7b')][_0x5e606b][_0x4bce('0x80')]));}}}if(_0x5ea2a5[_0x4bce('0x81')]){_0x5ea2a5['conditions']=JSON[_0x4bce('0x7c')](_0x5ea2a5[_0x4bce('0x81')]);_0x3916a3[_0x4bce('0x37')](_0x30a83a(_0x5ea2a5[_0x4bce('0x81')][_0x4bce('0x67')]));}_0x3846d1=_0x3916a3[_0x4bce('0x82')]();_0x3916a3[_0x4bce('0x1a')](_0x2f346c);_0x3916a3['offset'](0x0);logger['debug'](_0x4bce('0x83'),_0x3916a3['toString']());return dbH['sequelize']['query'](_0x3916a3[_0x4bce('0x84')](),{'type':dbH[_0x4bce('0x85')][_0x4bce('0x86')][_0x4bce('0x87')]});}})[_0x4bce('0x21')](function(){return{'sql':_0x3846d1[_0x4bce('0x84')]()};})[_0x4bce('0x21')](respondWithResult(_0x177167,null))[_0x4bce('0x41')](handleError(_0x177167,null));}; \ No newline at end of file +var _0x97e4=['fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','CustomReports','UserProfileResource','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','sort','where','pick','filters','VIRTUAL','filter','options','AnalyticCustomReport','includeAll','include','findAll','rows','merge','create','body','get','role','user','Reports','UserProfileSection','find','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','preview','join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','function','replace','format','orderBy','alias','joins','parse','includes','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','toString','sequelize','QueryTypes','SELECT','left_join','cross_join','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','UNIX_TIMESTAMP(%s)','from','groupBy','order','DESC','parentKey','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','fork','../../components/export/','COUNT(*)','run','Limited\x20Query:','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x2cadbd,_0x504b02){var _0x56df1a=function(_0x8a225d){while(--_0x8a225d){_0x2cadbd['push'](_0x2cadbd['shift']());}};_0x56df1a(++_0x504b02);}(_0x97e4,0x98));var _0x497e=function(_0x5786f9,_0x59a148){_0x5786f9=_0x5786f9-0x0;var _0x22c3cf=_0x97e4[_0x5786f9];return _0x22c3cf;};'use strict';var emlformat=require(_0x497e('0x0'));var rimraf=require(_0x497e('0x1'));var zipdir=require(_0x497e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x497e('0x3'));var moment=require(_0x497e('0x4'));var BPromise=require(_0x497e('0x5'));var Mustache=require(_0x497e('0x6'));var util=require(_0x497e('0x7'));var path=require(_0x497e('0x8'));var sox=require('sox');var csv=require(_0x497e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x497e('0xa'));var _=require(_0x497e('0xb'));var squel=require(_0x497e('0xc'));var crypto=require('crypto');var jsforce=require(_0x497e('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x497e('0xe'));var Papa=require(_0x497e('0xf'));var Redis=require(_0x497e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x497e('0x11'));var as=require(_0x497e('0x12'));var hardwareService=require(_0x497e('0x13'));var logger=require(_0x497e('0x14'))(_0x497e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x497e('0x16'));var db=require(_0x497e('0x17'))['db'];var dbH=require(_0x497e('0x17'))['dbH'];function respondWithStatusCode(_0x1fa252,_0x2a2687){_0x2a2687=_0x2a2687||0xcc;return function(_0x4fb4d8){if(_0x4fb4d8){return _0x1fa252['sendStatus'](_0x2a2687);}return _0x1fa252[_0x497e('0x18')](_0x2a2687)[_0x497e('0x19')]();};}function respondWithResult(_0x781267,_0x3e779a){_0x3e779a=_0x3e779a||0xc8;return function(_0x18a2e7){if(_0x18a2e7){return _0x781267['status'](_0x3e779a)[_0x497e('0x1a')](_0x18a2e7);}};}function respondWithFilteredResult(_0x5727da,_0x324f6c){return function(_0x447d11){if(_0x447d11){var _0x10c3e9=typeof _0x324f6c[_0x497e('0x1b')]===_0x497e('0x1c')&&typeof _0x324f6c['limit']===_0x497e('0x1c');var _0xb5b0cb=_0x447d11[_0x497e('0x1d')];var _0x2ac36c=_0x10c3e9?0x0:_0x324f6c[_0x497e('0x1b')];var _0x2eac53=_0x10c3e9?_0x447d11[_0x497e('0x1d')]:_0x324f6c[_0x497e('0x1b')]+_0x324f6c[_0x497e('0x1e')];var _0x1ca114;if(_0x2eac53>=_0xb5b0cb){_0x2eac53=_0xb5b0cb;_0x1ca114=0xc8;}else{_0x1ca114=0xce;}_0x5727da['status'](_0x1ca114);return _0x5727da[_0x497e('0x1f')](_0x497e('0x20'),_0x2ac36c+'-'+_0x2eac53+'/'+_0xb5b0cb)[_0x497e('0x1a')](_0x447d11);}return null;};}function patchUpdates(_0x22bea3){return function(_0x387e6e){try{jsonpatch[_0x497e('0x21')](_0x387e6e,_0x22bea3,!![]);}catch(_0x9fca86){return BPromise['reject'](_0x9fca86);}return _0x387e6e[_0x497e('0x22')]();};}function saveUpdates(_0x39a19e,_0x1501a2){return function(_0x1e5ca9){if(_0x1e5ca9){return _0x1e5ca9['update'](_0x39a19e)['then'](function(_0x4408e7){return _0x4408e7;});}return null;};}function removeEntity(_0x5d26a9,_0x4162d7){return function(_0xede98e){if(_0xede98e){return _0xede98e['destroy']()[_0x497e('0x23')](function(){var _0x5b763a=_0xede98e['get']({'plain':!![]});var _0x4a954a=_0x497e('0x24');return db[_0x497e('0x25')][_0x497e('0x26')]({'where':{'type':_0x4a954a,'resourceId':_0x5b763a['id']}})[_0x497e('0x23')](function(){return _0xede98e;});})[_0x497e('0x23')](function(){_0x5d26a9[_0x497e('0x18')](0xcc)[_0x497e('0x19')]();});}};}function handleEntityNotFound(_0x42cbaa,_0x31b075){return function(_0x485d46){if(!_0x485d46){_0x42cbaa[_0x497e('0x27')](0x194);}return _0x485d46;};}function handleError(_0x37f398,_0x54844f){_0x54844f=_0x54844f||0x1f4;return function(_0x391acb){logger['error'](_0x391acb[_0x497e('0x28')]);if(_0x391acb[_0x497e('0x29')]){delete _0x391acb[_0x497e('0x29')];}_0x37f398['status'](_0x54844f)[_0x497e('0x2a')](_0x391acb);};}exports[_0x497e('0x2b')]=function(_0x1c2887,_0x81ffc){var _0x6fb532={},_0xb5eb52={},_0x4656ae={'count':0x0,'rows':[]};var _0x2d8b88=_[_0x497e('0x2c')](db['AnalyticCustomReport'][_0x497e('0x2d')],function(_0x2781cc){return{'name':_0x2781cc[_0x497e('0x2e')],'type':_0x2781cc[_0x497e('0x2f')][_0x497e('0x30')]};});_0xb5eb52[_0x497e('0x31')]=_['map'](_0x2d8b88,_0x497e('0x29'));_0xb5eb52[_0x497e('0x32')]=_[_0x497e('0x33')](_0x1c2887['query']);_0xb5eb52['filters']=_['intersection'](_0xb5eb52[_0x497e('0x31')],_0xb5eb52[_0x497e('0x32')]);_0x6fb532[_0x497e('0x34')]=_[_0x497e('0x35')](_0xb5eb52[_0x497e('0x31')],qs[_0x497e('0x36')](_0x1c2887[_0x497e('0x32')]['fields']));_0x6fb532[_0x497e('0x34')]=_0x6fb532[_0x497e('0x34')][_0x497e('0x37')]?_0x6fb532[_0x497e('0x34')]:_0xb5eb52[_0x497e('0x31')];if(!_0x1c2887[_0x497e('0x32')]['hasOwnProperty'](_0x497e('0x38'))){_0x6fb532[_0x497e('0x1e')]=qs[_0x497e('0x1e')](_0x1c2887[_0x497e('0x32')]['limit']);_0x6fb532['offset']=qs[_0x497e('0x1b')](_0x1c2887[_0x497e('0x32')][_0x497e('0x1b')]);}_0x6fb532['order']=qs['sort'](_0x1c2887[_0x497e('0x32')][_0x497e('0x39')]);_0x6fb532[_0x497e('0x3a')]=qs['filters'](_[_0x497e('0x3b')](_0x1c2887[_0x497e('0x32')],_0xb5eb52[_0x497e('0x3c')]),_0x2d8b88);if(_0x1c2887['query']['filter']){_0x6fb532[_0x497e('0x3a')]=_['merge'](_0x6fb532[_0x497e('0x3a')],{'$or':_[_0x497e('0x2c')](_0x2d8b88,function(_0x1dc903){if(_0x1dc903[_0x497e('0x2f')]!==_0x497e('0x3d')){var _0x2ffef6={};_0x2ffef6[_0x1dc903[_0x497e('0x29')]]={'$like':'%'+_0x1c2887[_0x497e('0x32')][_0x497e('0x3e')]+'%'};return _0x2ffef6;}})});}_0x6fb532=_['merge']({},_0x6fb532,_0x1c2887[_0x497e('0x3f')]);var _0x4d1a99={'where':_0x6fb532['where']};return db[_0x497e('0x40')]['count'](_0x4d1a99)[_0x497e('0x23')](function(_0x4213a1){_0x4656ae[_0x497e('0x1d')]=_0x4213a1;if(_0x1c2887[_0x497e('0x32')][_0x497e('0x41')]){_0x6fb532[_0x497e('0x42')]=[{'all':!![]}];}return db[_0x497e('0x40')][_0x497e('0x43')](_0x6fb532);})['then'](function(_0x46ad99){_0x4656ae[_0x497e('0x44')]=_0x46ad99;return _0x4656ae;})[_0x497e('0x23')](respondWithFilteredResult(_0x81ffc,_0x6fb532))['catch'](handleError(_0x81ffc,null));};exports['show']=function(_0x2900e9,_0x3dc4b9){var _0x517a14={'raw':![],'where':{'id':_0x2900e9['params']['id']}},_0x330ebf={};_0x330ebf[_0x497e('0x31')]=_[_0x497e('0x33')](db[_0x497e('0x40')][_0x497e('0x2d')]);_0x330ebf[_0x497e('0x32')]=_[_0x497e('0x33')](_0x2900e9[_0x497e('0x32')]);_0x330ebf['filters']=_[_0x497e('0x35')](_0x330ebf[_0x497e('0x31')],_0x330ebf['query']);_0x517a14['attributes']=_[_0x497e('0x35')](_0x330ebf[_0x497e('0x31')],qs[_0x497e('0x36')](_0x2900e9[_0x497e('0x32')][_0x497e('0x36')]));_0x517a14['attributes']=_0x517a14[_0x497e('0x34')][_0x497e('0x37')]?_0x517a14[_0x497e('0x34')]:_0x330ebf[_0x497e('0x31')];if(_0x2900e9[_0x497e('0x32')]['includeAll']){_0x517a14['include']=[{'all':!![]}];}_0x517a14=_[_0x497e('0x45')]({},_0x517a14,_0x2900e9[_0x497e('0x3f')]);return db[_0x497e('0x40')]['find'](_0x517a14)[_0x497e('0x23')](handleEntityNotFound(_0x3dc4b9,null))[_0x497e('0x23')](respondWithResult(_0x3dc4b9,null))['catch'](handleError(_0x3dc4b9,null));};exports[_0x497e('0x46')]=function(_0xc81a13,_0x5813b0){return db[_0x497e('0x40')][_0x497e('0x46')](_0xc81a13[_0x497e('0x47')],{})['then'](function(_0x4b574d){var _0x1bd07b=_0xc81a13['user'][_0x497e('0x48')]({'plain':!![]});if(!_0x1bd07b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1bd07b[_0x497e('0x49')]===_0x497e('0x4a')){var _0x21b45d=_0x4b574d[_0x497e('0x48')]({'plain':!![]});var _0x402769=_0x497e('0x4b');return db[_0x497e('0x4c')][_0x497e('0x4d')]({'where':{'name':_0x402769,'userProfileId':_0x1bd07b['userProfileId']},'raw':!![]})[_0x497e('0x23')](function(_0xa467ff){if(_0xa467ff&&_0xa467ff['autoAssociation']===0x0){return db[_0x497e('0x25')]['create']({'name':_0x21b45d[_0x497e('0x29')],'resourceId':_0x21b45d['id'],'type':_0x497e('0x24'),'sectionId':_0xa467ff['id']},{})[_0x497e('0x23')](function(){return _0x4b574d;});}else{return _0x4b574d;}})[_0x497e('0x4e')](function(_0x312643){logger[_0x497e('0x4f')](_0x497e('0x50'),_0x312643);throw _0x312643;});}return _0x4b574d;})[_0x497e('0x23')](respondWithResult(_0x5813b0,0xc9))['catch'](handleError(_0x5813b0,null));};exports[_0x497e('0x51')]=function(_0x3d11d9,_0x557ead){if(_0x3d11d9['body']['id']){delete _0x3d11d9[_0x497e('0x47')]['id'];}return db['AnalyticCustomReport']['find']({'where':{'id':_0x3d11d9[_0x497e('0x52')]['id']}})[_0x497e('0x23')](handleEntityNotFound(_0x557ead,null))[_0x497e('0x23')](saveUpdates(_0x3d11d9[_0x497e('0x47')],null))[_0x497e('0x23')](respondWithResult(_0x557ead,null))['catch'](handleError(_0x557ead,null));};exports[_0x497e('0x26')]=function(_0x1ca283,_0x221249){return db['AnalyticCustomReport'][_0x497e('0x4d')]({'where':{'id':_0x1ca283['params']['id']}})[_0x497e('0x23')](handleEntityNotFound(_0x221249,null))[_0x497e('0x23')](removeEntity(_0x221249,null))[_0x497e('0x4e')](handleError(_0x221249,null));};exports[_0x497e('0x53')]=function(_0x5b88d4,_0x3665a5){var _0x4e5396=0xa;var _0x2944c0=[_0x497e('0x54'),'left_join',_0x497e('0x55'),'cross_join'];var _0x47ed1d={'SUM':_0x497e('0x56'),'COUNT':_0x497e('0x57'),'COUNT DISTINCT':_0x497e('0x58'),'MAX':'MAX(%s)','MIN':_0x497e('0x59'),'AVG':_0x497e('0x5a'),'GROUP_CONCAT':_0x497e('0x5b'),'GROUP_CONCAT ASC':_0x497e('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x37657e={'SEC_TO_TIME':_0x497e('0x5d'),'DATE':_0x497e('0x5e'),'HOUR':_0x497e('0x5f'),'ROUND':_0x497e('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1ae513=function(_0x1a3ae4){return!_['includes']([_0x497e('0x61'),_0x497e('0x62'),_0x497e('0x63'),_0x497e('0x64')],_0x1a3ae4);};var _0x3661c6=function(_0x266818){if(!_0x266818||!_0x266818['rules']['length']){return'';}for(var _0x6e9444='(',_0x42f7f7=0x0;_0x42f7f7<_0x266818[_0x497e('0x65')][_0x497e('0x37')];_0x42f7f7+=0x1){_0x42f7f7>0x0&&(_0x6e9444+='\x20'+_0x266818[_0x497e('0x66')]+'\x20');_0x6e9444+=_0x266818[_0x497e('0x65')][_0x42f7f7][_0x497e('0x67')]?_0x3661c6(_0x266818[_0x497e('0x65')][_0x42f7f7][_0x497e('0x67')]):_0x266818[_0x497e('0x65')][_0x42f7f7][_0x497e('0x68')]+'\x20'+_0x266818[_0x497e('0x65')][_0x42f7f7]['condition']+(_0x1ae513(_0x266818[_0x497e('0x65')][_0x42f7f7]['condition'])?'\x20'+_0x266818['rules'][_0x42f7f7][_0x497e('0x69')]:'');}return _0x6e9444+')';};var _0x149ae5={'where':{'id':_0x5b88d4['params']['id']}},_0x26868f,_0x263cf7,_0x89fb89,_0x1ef917,_0x1f5150;_0x149ae5=_['merge']({},_0x149ae5,_0x5b88d4['options']);return db[_0x497e('0x40')][_0x497e('0x4d')](_0x149ae5)[_0x497e('0x23')](function(_0x223bcf){if(_0x223bcf){_0x26868f=_0x223bcf;return _0x223bcf[_0x497e('0x6a')]();}return null;})[_0x497e('0x23')](function(_0x376831){if(_0x376831){if(!_0x376831['length']){throw new db[(_0x497e('0x6b'))][(_0x497e('0x6c'))](_0x497e('0x6d'),0x193);}_0x263cf7=_0x376831;return db[_0x497e('0x6e')]['findAll']({'raw':!![]});}return null;})[_0x497e('0x23')](function(_0x45bbf4){if(_0x45bbf4){_0x89fb89=_[_0x497e('0x6f')](_0x45bbf4,'id');var _0x5a3b38;var _0x93f34f=squel[_0x497e('0x70')]();_0x93f34f['from'](_0x26868f[_0x497e('0x71')]);for(var _0x2e3d1a=0x0;_0x2e3d1a<_0x263cf7[_0x497e('0x37')];_0x2e3d1a+=0x1){_0x5a3b38=_0x263cf7[_0x2e3d1a][_0x497e('0x72')]?_0x89fb89[_0x263cf7[_0x2e3d1a][_0x497e('0x72')]][_0x497e('0x73')]:_0x263cf7[_0x2e3d1a][_0x497e('0x68')];_0x5a3b38=_0x263cf7[_0x2e3d1a][_0x497e('0x74')]?_[_0x497e('0x75')](_0x47ed1d[_0x263cf7[_0x2e3d1a][_0x497e('0x74')]],'%s',_0x5a3b38):_0x5a3b38;_0x5a3b38=_0x263cf7[_0x2e3d1a][_0x497e('0x76')]?_[_0x497e('0x75')](_0x37657e[_0x263cf7[_0x2e3d1a][_0x497e('0x76')]],'%s',_0x5a3b38):_0x5a3b38;if(_0x263cf7[_0x2e3d1a]['groupBy']){_0x93f34f[_0x497e('0x67')](_0x5a3b38);}_0x263cf7[_0x2e3d1a][_0x497e('0x77')]&&_0x93f34f['order'](_0x5a3b38,_0x263cf7[_0x2e3d1a][_0x497e('0x77')]==='DESC'?![]:!![]);_0x93f34f['field'](_0x5a3b38,_0x263cf7[_0x2e3d1a][_0x497e('0x78')]||_0x5a3b38);}if(_0x26868f[_0x497e('0x79')]){_0x26868f[_0x497e('0x79')]=JSON[_0x497e('0x7a')](_0x26868f[_0x497e('0x79')]);for(var _0x39b964=0x0;_0x39b964<_0x26868f[_0x497e('0x79')][_0x497e('0x37')];_0x39b964+=0x1){if(_0x26868f[_0x497e('0x79')][_0x39b964]['type']&&_[_0x497e('0x7b')](_0x2944c0,_0x26868f[_0x497e('0x79')][_0x39b964][_0x497e('0x2f')])&&_0x26868f[_0x497e('0x79')][_0x39b964]['parentKey']&&_0x26868f[_0x497e('0x79')][_0x39b964][_0x497e('0x7c')]&&_0x26868f[_0x497e('0x79')][_0x39b964][_0x497e('0x7d')]){_0x93f34f[_0x26868f[_0x497e('0x79')][_0x39b964][_0x497e('0x2f')]](_0x26868f[_0x497e('0x79')][_0x39b964][_0x497e('0x7c')],null,util[_0x497e('0x76')](_0x497e('0x7e'),_0x26868f['table'],_0x26868f[_0x497e('0x79')][_0x39b964]['parentKey'],_0x26868f['joins'][_0x39b964][_0x497e('0x7c')],_0x26868f[_0x497e('0x79')][_0x39b964][_0x497e('0x7d')]));}}}if(_0x26868f[_0x497e('0x7f')]){_0x26868f[_0x497e('0x7f')]=JSON[_0x497e('0x7a')](_0x26868f['conditions']);_0x93f34f['where'](_0x3661c6(_0x26868f[_0x497e('0x7f')][_0x497e('0x67')]));}_0x1f5150=_0x93f34f[_0x497e('0x80')]();_0x93f34f[_0x497e('0x1e')](_0x4e5396);_0x93f34f[_0x497e('0x1b')](0x0);logger[_0x497e('0x81')]('Limited\x20Query:',_0x93f34f[_0x497e('0x82')]());return dbH[_0x497e('0x83')][_0x497e('0x32')](_0x93f34f[_0x497e('0x82')](),{'type':dbH[_0x497e('0x83')][_0x497e('0x84')][_0x497e('0x85')]});}})[_0x497e('0x23')](respondWithResult(_0x3665a5,null))[_0x497e('0x4e')](handleError(_0x3665a5,null));};function runReport(_0x3f7563,_0x4c2cfa,_0x4e7a8d){var _0x8af9a8=_0x4c2cfa['name'];var _0x1093d9=0xa;var _0x329e86=[_0x497e('0x54'),_0x497e('0x86'),_0x497e('0x55'),_0x497e('0x87')];var _0x3f7c5c={'SUM':_0x497e('0x56'),'COUNT':_0x497e('0x57'),'COUNT DISTINCT':_0x497e('0x58'),'MAX':_0x497e('0x88'),'MIN':'MIN(%s)','AVG':_0x497e('0x5a'),'GROUP_CONCAT':_0x497e('0x5b'),'GROUP_CONCAT ASC':_0x497e('0x5c'),'GROUP_CONCAT DESC':_0x497e('0x89')};var _0x570572={'SEC_TO_TIME':_0x497e('0x5d'),'DATE':_0x497e('0x5e'),'HOUR':'HOUR(%s)','ROUND':_0x497e('0x60'),'UNIX_TIMESTAMP':_0x497e('0x8a')};var _0x20a7d1=function(_0x378d58){return!_[_0x497e('0x7b')]([_0x497e('0x61'),_0x497e('0x62'),_0x497e('0x63'),_0x497e('0x64')],_0x378d58);};var _0x11e63d=function(_0x5aa1a1){if(!_0x5aa1a1||!_0x5aa1a1['rules'][_0x497e('0x37')]){return'';}for(var _0x5a5df5='(',_0x35951c=0x0;_0x35951c<_0x5aa1a1[_0x497e('0x65')][_0x497e('0x37')];_0x35951c+=0x1){_0x35951c>0x0&&(_0x5a5df5+='\x20'+_0x5aa1a1[_0x497e('0x66')]+'\x20');_0x5a5df5+=_0x5aa1a1[_0x497e('0x65')][_0x35951c][_0x497e('0x67')]?_0x11e63d(_0x5aa1a1[_0x497e('0x65')][_0x35951c][_0x497e('0x67')]):_0x5aa1a1[_0x497e('0x65')][_0x35951c][_0x497e('0x68')]+'\x20'+_0x5aa1a1[_0x497e('0x65')][_0x35951c]['condition']+(_0x20a7d1(_0x5aa1a1[_0x497e('0x65')][_0x35951c]['condition'])?'\x20'+_0x5aa1a1[_0x497e('0x65')][_0x35951c][_0x497e('0x69')]:'');}return _0x5a5df5+')';};var _0x55c08c={'where':{'id':_0x3f7563['id']}},_0x24dbc4,_0x5c7066,_0x59ebaf,_0x286912,_0x11dca0;_0x55c08c=_[_0x497e('0x45')]({},_0x55c08c,_0x4e7a8d);return db[_0x497e('0x40')][_0x497e('0x4d')](_0x55c08c)[_0x497e('0x23')](function(_0x459c04){if(_0x459c04){_0x24dbc4=_0x459c04;return _0x459c04[_0x497e('0x6a')]();}return null;})[_0x497e('0x23')](function(_0x2868f0){if(_0x2868f0){if(!_0x2868f0[_0x497e('0x37')]){throw new db[(_0x497e('0x6b'))][(_0x497e('0x6c'))](_0x497e('0x6d'),0x193);}_0x5c7066=_0x2868f0;return db[_0x497e('0x6e')][_0x497e('0x43')]({'raw':!![]});}return null;})['then'](function(_0x1d3fef){if(_0x1d3fef){_0x59ebaf=_[_0x497e('0x6f')](_0x1d3fef,'id');var _0x5f3bd8;var _0x191af6=squel[_0x497e('0x70')]();_0x191af6[_0x497e('0x8b')](_0x24dbc4[_0x497e('0x71')]);for(var _0x527310=0x0;_0x527310<_0x5c7066[_0x497e('0x37')];_0x527310+=0x1){_0x5f3bd8=_0x5c7066[_0x527310][_0x497e('0x72')]?_0x59ebaf[_0x5c7066[_0x527310][_0x497e('0x72')]][_0x497e('0x73')]:_0x5c7066[_0x527310]['field'];_0x5f3bd8=_0x5c7066[_0x527310][_0x497e('0x74')]?_[_0x497e('0x75')](_0x3f7c5c[_0x5c7066[_0x527310][_0x497e('0x74')]],'%s',_0x5f3bd8):_0x5f3bd8;_0x5f3bd8=_0x5c7066[_0x527310][_0x497e('0x76')]?_[_0x497e('0x75')](_0x570572[_0x5c7066[_0x527310][_0x497e('0x76')]],'%s',_0x5f3bd8):_0x5f3bd8;if(_0x5c7066[_0x527310][_0x497e('0x8c')]){_0x191af6[_0x497e('0x67')](_0x5f3bd8);}_0x5c7066[_0x527310][_0x497e('0x77')]&&_0x191af6[_0x497e('0x8d')](_0x5f3bd8,_0x5c7066[_0x527310][_0x497e('0x77')]===_0x497e('0x8e')?![]:!![]);_0x191af6[_0x497e('0x68')](_0x5f3bd8,_0x5c7066[_0x527310][_0x497e('0x78')]||_0x5f3bd8);}if(_0x24dbc4[_0x497e('0x79')]){_0x24dbc4[_0x497e('0x79')]=JSON[_0x497e('0x7a')](_0x24dbc4[_0x497e('0x79')]);for(var _0x554fb4=0x0;_0x554fb4<_0x24dbc4[_0x497e('0x79')][_0x497e('0x37')];_0x554fb4+=0x1){if(_0x24dbc4[_0x497e('0x79')][_0x554fb4][_0x497e('0x2f')]&&_[_0x497e('0x7b')](_0x329e86,_0x24dbc4[_0x497e('0x79')][_0x554fb4][_0x497e('0x2f')])&&_0x24dbc4[_0x497e('0x79')][_0x554fb4][_0x497e('0x8f')]&&_0x24dbc4[_0x497e('0x79')][_0x554fb4][_0x497e('0x7c')]&&_0x24dbc4[_0x497e('0x79')][_0x554fb4][_0x497e('0x7d')]){_0x191af6[_0x24dbc4['joins'][_0x554fb4][_0x497e('0x2f')]](_0x24dbc4[_0x497e('0x79')][_0x554fb4][_0x497e('0x7c')],null,util[_0x497e('0x76')]('%s.%s\x20=\x20%s.%s',_0x24dbc4[_0x497e('0x71')],_0x24dbc4['joins'][_0x554fb4][_0x497e('0x8f')],_0x24dbc4[_0x497e('0x79')][_0x554fb4][_0x497e('0x7c')],_0x24dbc4[_0x497e('0x79')][_0x554fb4]['foreignKey']));}}}if(_0x24dbc4[_0x497e('0x7f')]){_0x24dbc4[_0x497e('0x7f')]=JSON['parse'](_0x24dbc4['conditions']);_0x191af6['where'](_0x11e63d(_0x24dbc4[_0x497e('0x7f')][_0x497e('0x67')]));}_0x11dca0=_0x191af6[_0x497e('0x80')]();_0x191af6[_0x497e('0x1e')](_0x1093d9);_0x191af6[_0x497e('0x1b')](0x0);return;}})[_0x497e('0x23')](function(){if(_0x4c2cfa[_0x497e('0x90')]===_0x497e('0x91')){return null;}var _0x52ca94=_[_0x497e('0x45')](_0x4c2cfa,{'name':_0x4c2cfa[_0x497e('0x92')]||_0x4c2cfa[_0x497e('0x29')]||_0x24dbc4['name'],'basename':_0x8af9a8,'savename':util[_0x497e('0x76')](_0x497e('0x93'),_0x4c2cfa[_0x497e('0x29')]||_0x24dbc4[_0x497e('0x29')],require(_0x497e('0x94'))[_0x497e('0x95')](0x4),_0x4c2cfa['output']||_0x497e('0x96')),'reportId':_0x24dbc4['id'],'reportType':'custom'});return db[_0x497e('0x97')][_0x497e('0x46')](_0x52ca94,{'raw':!![]});})[_0x497e('0x23')](function(_0x2d6181){if(_0x24dbc4[_0x497e('0x71')]==='cdr'){_0x11dca0[_0x497e('0x3a')](_0x24dbc4[_0x497e('0x71')]+_0x497e('0x98'),_0x4c2cfa[_0x497e('0x99')],_0x4c2cfa[_0x497e('0x9a')]);}else{_0x11dca0[_0x497e('0x3a')](_0x24dbc4[_0x497e('0x71')]+_0x497e('0x9b'),_0x4c2cfa[_0x497e('0x99')],_0x4c2cfa[_0x497e('0x9a')]);}if(_0x2d6181){logger['info'](_0x497e('0x9c'),_0x11dca0[_0x497e('0x82')]());require('child_process')[_0x497e('0x9d')](path[_0x497e('0x54')](__dirname,_0x497e('0x9e'),_0x2d6181[_0x497e('0x90')]),[_0x2d6181['id'],_0x11dca0[_0x497e('0x82')](),path[_0x497e('0x54')](__dirname,'../../files/reports',_0x2d6181['savename']),_0x8af9a8]);return _0x2d6181;}else{var _0x32b198=squel[_0x497e('0x70')]();_0x32b198['from']('('+_0x11dca0[_0x497e('0x82')]()+')','countTable');_0x32b198[_0x497e('0x68')](_0x497e('0x9f'),_0x497e('0x1d'));_0x11dca0[_0x497e('0x1e')](_0x4c2cfa[_0x497e('0x1e')]||_0x1093d9);_0x11dca0[_0x497e('0x1b')](_0x4c2cfa[_0x497e('0x1b')]||0x0);return dbH[_0x497e('0x83')]['query'](_0x32b198['toString'](),{'type':dbH[_0x497e('0x83')][_0x497e('0x84')][_0x497e('0x85')]})['then'](function(_0x53b586){if(!_0x53b586[_0x497e('0x37')]){_0x286912=0x0;}else{_0x286912=_0x53b586[0x0][_0x497e('0x1d')]||0x0;}return dbH[_0x497e('0x83')][_0x497e('0x32')](_0x11dca0[_0x497e('0x82')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})[_0x497e('0x23')](function(_0x3d3397){return{'rows':_0x3d3397||[],'count':_0x286912};});}});}exports[_0x497e('0xa0')]=function(_0x79079a,_0x5d23c1){return runReport(_0x79079a['params'],_0x79079a[_0x497e('0x32')],_0x79079a[_0x497e('0x3f')])[_0x497e('0x23')](respondWithResult(_0x5d23c1,null))['catch'](handleError(_0x5d23c1,null));};exports['runReport']=runReport;exports[_0x497e('0x32')]=function(_0xe9a92,_0x3a3b81){var _0x258291=0xa;var _0x207796=['join',_0x497e('0x86'),'right_join',_0x497e('0x87')];var _0x240723={'SUM':_0x497e('0x56'),'COUNT':_0x497e('0x57'),'COUNT DISTINCT':_0x497e('0x58'),'MAX':_0x497e('0x88'),'MIN':_0x497e('0x59'),'AVG':_0x497e('0x5a'),'GROUP_CONCAT':_0x497e('0x5b'),'GROUP_CONCAT ASC':_0x497e('0x5c'),'GROUP_CONCAT DESC':_0x497e('0x89')};var _0x268673={'SEC_TO_TIME':_0x497e('0x5d'),'DATE':_0x497e('0x5e'),'HOUR':_0x497e('0x5f'),'ROUND':_0x497e('0x60'),'UNIX_TIMESTAMP':_0x497e('0x8a')};var _0x3daecd=function(_0x2173f8){return!_[_0x497e('0x7b')]([_0x497e('0x61'),_0x497e('0x62'),_0x497e('0x63'),_0x497e('0x64')],_0x2173f8);};var _0x50b3ca=function(_0x877883){if(!_0x877883||!_0x877883[_0x497e('0x65')][_0x497e('0x37')]){return'';}for(var _0x177b3d='(',_0x1979aa=0x0;_0x1979aa<_0x877883['rules'][_0x497e('0x37')];_0x1979aa+=0x1){_0x1979aa>0x0&&(_0x177b3d+='\x20'+_0x877883[_0x497e('0x66')]+'\x20');_0x177b3d+=_0x877883[_0x497e('0x65')][_0x1979aa]['group']?_0x50b3ca(_0x877883[_0x497e('0x65')][_0x1979aa]['group']):_0x877883['rules'][_0x1979aa][_0x497e('0x68')]+'\x20'+_0x877883[_0x497e('0x65')][_0x1979aa]['condition']+(_0x3daecd(_0x877883[_0x497e('0x65')][_0x1979aa]['condition'])?'\x20'+_0x877883['rules'][_0x1979aa]['value']:'');}return _0x177b3d+')';};var _0x488a30={'where':{'id':_0xe9a92['params']['id']}},_0x4f9181,_0x2fc5cf,_0x5c3051,_0x33536d,_0x512a20;_0x488a30=_['merge']({},_0x488a30,_0xe9a92['options']);return db[_0x497e('0x40')]['find'](_0x488a30)[_0x497e('0x23')](function(_0x4bfe25){if(_0x4bfe25){_0x4f9181=_0x4bfe25;return _0x4bfe25[_0x497e('0x6a')]();}return null;})['then'](function(_0x2ea56c){if(_0x2ea56c){if(!_0x2ea56c['length']){throw new db[(_0x497e('0x6b'))][(_0x497e('0x6c'))](_0x497e('0x6d'),0x193);}_0x2fc5cf=_0x2ea56c;return db[_0x497e('0x6e')][_0x497e('0x43')]({'raw':!![]});}return null;})['then'](function(_0x335447){if(_0x335447){_0x5c3051=_[_0x497e('0x6f')](_0x335447,'id');var _0x45c8bd;var _0x3acc9f=squel['select']();_0x3acc9f[_0x497e('0x8b')](_0x4f9181[_0x497e('0x71')]);for(var _0x3f9e84=0x0;_0x3f9e84<_0x2fc5cf['length'];_0x3f9e84+=0x1){_0x45c8bd=_0x2fc5cf[_0x3f9e84][_0x497e('0x72')]?_0x5c3051[_0x2fc5cf[_0x3f9e84]['MetricId']][_0x497e('0x73')]:_0x2fc5cf[_0x3f9e84][_0x497e('0x68')];_0x45c8bd=_0x2fc5cf[_0x3f9e84][_0x497e('0x74')]?_[_0x497e('0x75')](_0x240723[_0x2fc5cf[_0x3f9e84][_0x497e('0x74')]],'%s',_0x45c8bd):_0x45c8bd;_0x45c8bd=_0x2fc5cf[_0x3f9e84][_0x497e('0x76')]?_['replace'](_0x268673[_0x2fc5cf[_0x3f9e84][_0x497e('0x76')]],'%s',_0x45c8bd):_0x45c8bd;if(_0x2fc5cf[_0x3f9e84][_0x497e('0x8c')]){_0x3acc9f['group'](_0x45c8bd);}_0x2fc5cf[_0x3f9e84][_0x497e('0x77')]&&_0x3acc9f[_0x497e('0x8d')](_0x45c8bd,_0x2fc5cf[_0x3f9e84]['orderBy']==='DESC'?![]:!![]);_0x3acc9f[_0x497e('0x68')](_0x45c8bd,_0x2fc5cf[_0x3f9e84][_0x497e('0x78')]||_0x45c8bd);}if(_0x4f9181[_0x497e('0x79')]){_0x4f9181[_0x497e('0x79')]=JSON['parse'](_0x4f9181[_0x497e('0x79')]);for(var _0x2bf8be=0x0;_0x2bf8be<_0x4f9181[_0x497e('0x79')][_0x497e('0x37')];_0x2bf8be+=0x1){if(_0x4f9181[_0x497e('0x79')][_0x2bf8be][_0x497e('0x2f')]&&_[_0x497e('0x7b')](_0x207796,_0x4f9181[_0x497e('0x79')][_0x2bf8be][_0x497e('0x2f')])&&_0x4f9181[_0x497e('0x79')][_0x2bf8be]['parentKey']&&_0x4f9181[_0x497e('0x79')][_0x2bf8be][_0x497e('0x7c')]&&_0x4f9181[_0x497e('0x79')][_0x2bf8be]['foreignKey']){_0x3acc9f[_0x4f9181[_0x497e('0x79')][_0x2bf8be][_0x497e('0x2f')]](_0x4f9181['joins'][_0x2bf8be][_0x497e('0x7c')],null,util[_0x497e('0x76')](_0x497e('0x7e'),_0x4f9181['table'],_0x4f9181[_0x497e('0x79')][_0x2bf8be][_0x497e('0x8f')],_0x4f9181['joins'][_0x2bf8be]['foreignTable'],_0x4f9181['joins'][_0x2bf8be]['foreignKey']));}}}if(_0x4f9181['conditions']){_0x4f9181[_0x497e('0x7f')]=JSON[_0x497e('0x7a')](_0x4f9181['conditions']);_0x3acc9f[_0x497e('0x3a')](_0x50b3ca(_0x4f9181['conditions'][_0x497e('0x67')]));}_0x512a20=_0x3acc9f[_0x497e('0x80')]();_0x3acc9f[_0x497e('0x1e')](_0x258291);_0x3acc9f[_0x497e('0x1b')](0x0);logger['debug'](_0x497e('0xa1'),_0x3acc9f[_0x497e('0x82')]());return dbH[_0x497e('0x83')][_0x497e('0x32')](_0x3acc9f['toString'](),{'type':dbH[_0x497e('0x83')][_0x497e('0x84')][_0x497e('0x85')]});}})['then'](function(){return{'sql':_0x512a20[_0x497e('0x82')]()};})['then'](respondWithResult(_0x3a3b81,null))[_0x497e('0x4e')](handleError(_0x3a3b81,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index ec7a78b..e7abd33 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 _0x54e4=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util'];(function(_0x3c73ad,_0x464b2c){var _0x54cdae=function(_0x22828a){while(--_0x22828a){_0x3c73ad['push'](_0x3c73ad['shift']());}};_0x54cdae(++_0x464b2c);}(_0x54e4,0x148));var _0x454e=function(_0x380f48,_0x141b3d){_0x380f48=_0x380f48-0x0;var _0x5f1056=_0x54e4[_0x380f48];return _0x5f1056;};'use strict';var _=require(_0x454e('0x0'));var util=require(_0x454e('0x1'));var logger=require(_0x454e('0x2'))(_0x454e('0x3'));var moment=require(_0x454e('0x4'));var BPromise=require(_0x454e('0x5'));var rp=require(_0x454e('0x6'));var fs=require('fs');var path=require(_0x454e('0x7'));var rimraf=require(_0x454e('0x8'));var config=require(_0x454e('0x9'));var attributes=require(_0x454e('0xa'));module[_0x454e('0xb')]=function(_0x138a6b,_0x307ef1){return _0x138a6b[_0x454e('0xc')](_0x454e('0xd'),attributes,{'tableName':_0x454e('0xe'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3bf4=['rimraf','../../config/environment','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0xd81b5b,_0x15f6a7){var _0x52ffd9=function(_0x5571ea){while(--_0x5571ea){_0xd81b5b['push'](_0xd81b5b['shift']());}};_0x52ffd9(++_0x15f6a7);}(_0x3bf4,0xd6));var _0x43bf=function(_0x164331,_0x14b8ec){_0x164331=_0x164331-0x0;var _0x2d6c1f=_0x3bf4[_0x164331];return _0x2d6c1f;};'use strict';var _=require(_0x43bf('0x0'));var util=require(_0x43bf('0x1'));var logger=require(_0x43bf('0x2'))(_0x43bf('0x3'));var moment=require(_0x43bf('0x4'));var BPromise=require('bluebird');var rp=require(_0x43bf('0x5'));var fs=require('fs');var path=require(_0x43bf('0x6'));var rimraf=require(_0x43bf('0x7'));var config=require(_0x43bf('0x8'));var attributes=require('./analyticCustomReport.attributes');module[_0x43bf('0x9')]=function(_0x51c582,_0x4c9852){return _0x51c582[_0x43bf('0xa')](_0x43bf('0xb'),attributes,{'tableName':_0x43bf('0xc'),'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 7f55b39..53502c5 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 _0x18f2=['jayson/promise','client','http','request','then','info','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','AnalyticCustomReport,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x18f2,0x10d));var _0x218f=function(_0x3b72c3,_0x5194dc){_0x3b72c3=_0x3b72c3-0x0;var _0x103b68=_0x18f2[_0x3b72c3];return _0x103b68;};'use strict';var _=require(_0x218f('0x0'));var util=require(_0x218f('0x1'));var moment=require(_0x218f('0x2'));var BPromise=require('bluebird');var rs=require(_0x218f('0x3'));var fs=require('fs');var Redis=require(_0x218f('0x4'));var db=require(_0x218f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x218f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x218f('0x7'));var client=jayson[_0x218f('0x8')][_0x218f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x572755,_0x1658a4,_0x57119b){return new BPromise(function(_0x5d33e8,_0x2f4ff3){return client[_0x218f('0xa')](_0x572755,_0x57119b)[_0x218f('0xb')](function(_0x59b514){logger[_0x218f('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1658a4,'request\x20sent');logger[_0x218f('0xd')](_0x218f('0xe'),_0x1658a4,_0x218f('0xf'),JSON[_0x218f('0x10')](_0x59b514));if(_0x59b514[_0x218f('0x11')]){if(_0x59b514[_0x218f('0x11')][_0x218f('0x12')]===0x1f4){logger[_0x218f('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1658a4,_0x59b514[_0x218f('0x11')][_0x218f('0x13')]);return _0x2f4ff3(_0x59b514[_0x218f('0x11')]['message']);}logger[_0x218f('0x11')](_0x218f('0x14'),_0x1658a4,_0x59b514[_0x218f('0x11')][_0x218f('0x13')]);return _0x5d33e8(_0x59b514[_0x218f('0x11')][_0x218f('0x13')]);}else{logger[_0x218f('0xc')](_0x218f('0x14'),_0x1658a4,'request\x20sent');_0x5d33e8(_0x59b514[_0x218f('0x15')][_0x218f('0x13')]);}})[_0x218f('0x16')](function(_0x3be502){logger[_0x218f('0x11')](_0x218f('0x14'),_0x1658a4,_0x3be502);_0x2f4ff3(_0x3be502);});});} \ No newline at end of file +var _0x9558=['debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0x4d1e0f,_0x1509bc){var _0x5a72f9=function(_0x5486c6){while(--_0x5486c6){_0x4d1e0f['push'](_0x4d1e0f['shift']());}};_0x5a72f9(++_0x1509bc);}(_0x9558,0x134));var _0x8955=function(_0x48cb7d,_0x3135a1){_0x48cb7d=_0x48cb7d-0x0;var _0x417b09=_0x9558[_0x48cb7d];return _0x417b09;};'use strict';var _=require(_0x8955('0x0'));var util=require(_0x8955('0x1'));var moment=require(_0x8955('0x2'));var BPromise=require(_0x8955('0x3'));var rs=require(_0x8955('0x4'));var fs=require('fs');var Redis=require(_0x8955('0x5'));var db=require(_0x8955('0x6'))['db'];var utils=require(_0x8955('0x7'));var logger=require(_0x8955('0x8'))(_0x8955('0x9'));var config=require(_0x8955('0xa'));var jayson=require(_0x8955('0xb'));var client=jayson[_0x8955('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fd501,_0x1ec03f,_0x5ae3d0){return new BPromise(function(_0x5420c5,_0x455baf){return client[_0x8955('0xd')](_0x1fd501,_0x5ae3d0)[_0x8955('0xe')](function(_0x23b9b7){logger[_0x8955('0xf')](_0x8955('0x10'),_0x1ec03f,'request\x20sent');logger[_0x8955('0x11')](_0x8955('0x12'),_0x1ec03f,_0x8955('0x13'),JSON['stringify'](_0x23b9b7));if(_0x23b9b7[_0x8955('0x14')]){if(_0x23b9b7[_0x8955('0x14')][_0x8955('0x15')]===0x1f4){logger[_0x8955('0x14')](_0x8955('0x10'),_0x1ec03f,_0x23b9b7[_0x8955('0x14')][_0x8955('0x16')]);return _0x455baf(_0x23b9b7[_0x8955('0x14')]['message']);}logger[_0x8955('0x14')](_0x8955('0x10'),_0x1ec03f,_0x23b9b7[_0x8955('0x14')][_0x8955('0x16')]);return _0x5420c5(_0x23b9b7['error'][_0x8955('0x16')]);}else{logger[_0x8955('0xf')](_0x8955('0x10'),_0x1ec03f,'request\x20sent');_0x5420c5(_0x23b9b7[_0x8955('0x17')][_0x8955('0x16')]);}})[_0x8955('0x18')](function(_0x2c0d81){logger[_0x8955('0x14')](_0x8955('0x10'),_0x1ec03f,_0x2c0d81);_0x455baf(_0x2c0d81);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 6d02f4c..8e36bc8 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 _0x73ec=['show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id'];(function(_0x4e69d1,_0x437faf){var _0x357689=function(_0xf778a7){while(--_0xf778a7){_0x4e69d1['push'](_0x4e69d1['shift']());}};_0x357689(++_0x437faf);}(_0x73ec,0x1a2));var _0xc73e=function(_0x5af94a,_0x204822){_0x5af94a=_0x5af94a-0x0;var _0x4a5254=_0x73ec[_0x5af94a];return _0x4a5254;};'use strict';var multer=require(_0xc73e('0x0'));var util=require(_0xc73e('0x1'));var path=require(_0xc73e('0x2'));var timeout=require(_0xc73e('0x3'));var express=require(_0xc73e('0x4'));var router=express[_0xc73e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc73e('0x6'));var interaction=require(_0xc73e('0x7'));var config=require(_0xc73e('0x8'));var controller=require(_0xc73e('0x9'));router[_0xc73e('0xa')]('/',auth[_0xc73e('0xb')](),controller[_0xc73e('0xc')]);router['get'](_0xc73e('0xd'),auth['isAuthenticated'](),controller[_0xc73e('0xe')]);router[_0xc73e('0xa')](_0xc73e('0xf'),auth[_0xc73e('0xb')](),controller[_0xc73e('0x10')]);router['get'](_0xc73e('0x11'),auth[_0xc73e('0xb')](),controller[_0xc73e('0x12')]);router[_0xc73e('0xa')](_0xc73e('0x13'),auth[_0xc73e('0xb')](),controller[_0xc73e('0x14')]);router[_0xc73e('0x15')]('/',auth['isAuthenticated'](),controller[_0xc73e('0x16')]);router['put'](_0xc73e('0xd'),auth['isAuthenticated'](),controller[_0xc73e('0x17')]);router[_0xc73e('0x18')](_0xc73e('0xd'),auth[_0xc73e('0xb')](),controller[_0xc73e('0x19')]);module[_0xc73e('0x1a')]=router; \ No newline at end of file +var _0x7aa6=['query','post','create','put','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run'];(function(_0x1c2560,_0x1d9304){var _0x2be4de=function(_0x3d6984){while(--_0x3d6984){_0x1c2560['push'](_0x1c2560['shift']());}};_0x2be4de(++_0x1d9304);}(_0x7aa6,0xcc));var _0x67aa=function(_0x10df58,_0x1ae2a4){_0x10df58=_0x10df58-0x0;var _0x4321ec=_0x7aa6[_0x10df58];return _0x4321ec;};'use strict';var multer=require('multer');var util=require(_0x67aa('0x0'));var path=require(_0x67aa('0x1'));var timeout=require(_0x67aa('0x2'));var express=require(_0x67aa('0x3'));var router=express[_0x67aa('0x4')]();var fs_extra=require(_0x67aa('0x5'));var auth=require(_0x67aa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x67aa('0x7'));var controller=require(_0x67aa('0x8'));router[_0x67aa('0x9')]('/',auth[_0x67aa('0xa')](),controller[_0x67aa('0xb')]);router['get'](_0x67aa('0xc'),auth[_0x67aa('0xa')](),controller['show']);router['get'](_0x67aa('0xd'),auth[_0x67aa('0xa')](),controller[_0x67aa('0xe')]);router[_0x67aa('0x9')](_0x67aa('0xf'),auth[_0x67aa('0xa')](),controller['run']);router[_0x67aa('0x9')]('/:id/query',auth[_0x67aa('0xa')](),controller[_0x67aa('0x10')]);router[_0x67aa('0x11')]('/',auth[_0x67aa('0xa')](),controller[_0x67aa('0x12')]);router[_0x67aa('0x13')](_0x67aa('0xc'),auth[_0x67aa('0xa')](),controller['update']);router[_0x67aa('0x14')]('/:id',auth[_0x67aa('0xa')](),controller[_0x67aa('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 7ac020b..4de01b4 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 _0xe14b=['exports','STRING','TEXT','sequelize'];(function(_0x13af96,_0x229847){var _0x2627b8=function(_0x349826){while(--_0x349826){_0x13af96['push'](_0x13af96['shift']());}};_0x2627b8(++_0x229847);}(_0xe14b,0x93));var _0xbe14=function(_0x4b2d14,_0x198792){_0x4b2d14=_0x4b2d14-0x0;var _0xabf1bf=_0xe14b[_0x4b2d14];return _0xabf1bf;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xbe14('0x2')]},'table':{'type':Sequelize[_0xbe14('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbe14('0x3')]}}; \ No newline at end of file +var _0x2675=['sequelize','STRING','TEXT'];(function(_0x1602ef,_0x447aba){var _0x5870ee=function(_0x4d94e7){while(--_0x4d94e7){_0x1602ef['push'](_0x1602ef['shift']());}};_0x5870ee(++_0x447aba);}(_0x2675,0x75));var _0x5267=function(_0x414bee,_0x1b19a4){_0x414bee=_0x414bee-0x0;var _0x3ab4df=_0x2675[_0x414bee];return _0x3ab4df;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x5267('0x1')]},'table':{'type':Sequelize[_0x5267('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x5267('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index fe43649..016f5ba 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 _0x5fab=['debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','from','function','order','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','run','params','runReport','AVG(%s)','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','limit','undefined','count','offset','Content-Range','apply','save','update','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','query','where','pick','filters','filter','VIRTUAL','merge','options','include','findAll','rows','catch','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%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)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone'];(function(_0x45ba0c,_0x58f598){var _0x4db9b1=function(_0x72c1b3){while(--_0x72c1b3){_0x45ba0c['push'](_0x45ba0c['shift']());}};_0x4db9b1(++_0x58f598);}(_0x5fab,0x177));var _0xb5fa=function(_0x56c70f,_0x4e4493){_0x56c70f=_0x56c70f-0x0;var _0x3812ed=_0x5fab[_0x56c70f];return _0x3812ed;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];var dbH=require('../../mysqldb')[_0xb5fa('0x1a')];function respondWithStatusCode(_0x3dad4d,_0x56e8b0){_0x56e8b0=_0x56e8b0||0xcc;return function(_0x116849){if(_0x116849){return _0x3dad4d['sendStatus'](_0x56e8b0);}return _0x3dad4d[_0xb5fa('0x1b')](_0x56e8b0)[_0xb5fa('0x1c')]();};}function respondWithResult(_0x40c914,_0xca8d82){_0xca8d82=_0xca8d82||0xc8;return function(_0x8e9d1c){if(_0x8e9d1c){return _0x40c914['status'](_0xca8d82)['json'](_0x8e9d1c);}};}function respondWithFilteredResult(_0x38e964,_0x587043){return function(_0x31f252){if(_0x31f252){var _0x27c8f7=typeof _0x587043['offset']==='undefined'&&typeof _0x587043[_0xb5fa('0x1d')]===_0xb5fa('0x1e');var _0x32e9e5=_0x31f252[_0xb5fa('0x1f')];var _0x324ba5=_0x27c8f7?0x0:_0x587043[_0xb5fa('0x20')];var _0x3b0f69=_0x27c8f7?_0x31f252[_0xb5fa('0x1f')]:_0x587043[_0xb5fa('0x20')]+_0x587043[_0xb5fa('0x1d')];var _0x3c8d53;if(_0x3b0f69>=_0x32e9e5){_0x3b0f69=_0x32e9e5;_0x3c8d53=0xc8;}else{_0x3c8d53=0xce;}_0x38e964[_0xb5fa('0x1b')](_0x3c8d53);return _0x38e964['set'](_0xb5fa('0x21'),_0x324ba5+'-'+_0x3b0f69+'/'+_0x32e9e5)['json'](_0x31f252);}return null;};}function patchUpdates(_0x37ae06){return function(_0x4a6c04){try{jsonpatch[_0xb5fa('0x22')](_0x4a6c04,_0x37ae06,!![]);}catch(_0x43c09f){return BPromise['reject'](_0x43c09f);}return _0x4a6c04[_0xb5fa('0x23')]();};}function saveUpdates(_0x3a2ab9,_0x283a56){return function(_0x47f71a){if(_0x47f71a){return _0x47f71a[_0xb5fa('0x24')](_0x3a2ab9)[_0xb5fa('0x25')](function(_0x444237){return _0x444237;});}return null;};}function removeEntity(_0x542348,_0x224ec8){return function(_0x5d55f7){if(_0x5d55f7){return _0x5d55f7[_0xb5fa('0x26')]()[_0xb5fa('0x25')](function(){var _0x11053a=_0x5d55f7[_0xb5fa('0x27')]({'plain':!![]});var _0x2dbd22=_0xb5fa('0x28');return db[_0xb5fa('0x29')][_0xb5fa('0x26')]({'where':{'type':_0x2dbd22,'resourceId':_0x11053a['id']}})['then'](function(){return _0x5d55f7;});})['then'](function(){_0x542348['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28a350,_0x460b54){return function(_0x12c0d4){if(!_0x12c0d4){_0x28a350[_0xb5fa('0x2a')](0x194);}return _0x12c0d4;};}function handleError(_0x534884,_0x3506a4){_0x3506a4=_0x3506a4||0x1f4;return function(_0x358549){logger[_0xb5fa('0x2b')](_0x358549[_0xb5fa('0x2c')]);if(_0x358549[_0xb5fa('0x2d')]){delete _0x358549[_0xb5fa('0x2d')];}_0x534884[_0xb5fa('0x1b')](_0x3506a4)[_0xb5fa('0x2e')](_0x358549);};}exports[_0xb5fa('0x2f')]=function(_0xed02e,_0x116773){var _0x5a0152={},_0x3fd1fb={},_0x21fc7e={'count':0x0,'rows':[]};var _0x319c48=_[_0xb5fa('0x30')](db[_0xb5fa('0x31')][_0xb5fa('0x32')],function(_0x25fc7c){return{'name':_0x25fc7c['fieldName'],'type':_0x25fc7c[_0xb5fa('0x33')]['key']};});_0x3fd1fb['model']=_['map'](_0x319c48,_0xb5fa('0x2d'));_0x3fd1fb['query']=_[_0xb5fa('0x34')](_0xed02e['query']);_0x3fd1fb['filters']=_[_0xb5fa('0x35')](_0x3fd1fb[_0xb5fa('0x36')],_0x3fd1fb['query']);_0x5a0152['attributes']=_[_0xb5fa('0x35')](_0x3fd1fb[_0xb5fa('0x36')],qs[_0xb5fa('0x37')](_0xed02e['query'][_0xb5fa('0x37')]));_0x5a0152[_0xb5fa('0x38')]=_0x5a0152['attributes'][_0xb5fa('0x39')]?_0x5a0152[_0xb5fa('0x38')]:_0x3fd1fb[_0xb5fa('0x36')];if(!_0xed02e['query'][_0xb5fa('0x3a')](_0xb5fa('0x3b'))){_0x5a0152[_0xb5fa('0x1d')]=qs['limit'](_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x1d')]);_0x5a0152[_0xb5fa('0x20')]=qs[_0xb5fa('0x20')](_0xed02e['query']['offset']);}_0x5a0152['order']=qs['sort'](_0xed02e['query']['sort']);_0x5a0152[_0xb5fa('0x3d')]=qs['filters'](_[_0xb5fa('0x3e')](_0xed02e[_0xb5fa('0x3c')],_0x3fd1fb[_0xb5fa('0x3f')]),_0x319c48);if(_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x40')]){_0x5a0152[_0xb5fa('0x3d')]=_['merge'](_0x5a0152['where'],{'$or':_['map'](_0x319c48,function(_0x534b38){if(_0x534b38['type']!==_0xb5fa('0x41')){var _0x5addd5={};_0x5addd5[_0x534b38['name']]={'$like':'%'+_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x40')]+'%'};return _0x5addd5;}})});}_0x5a0152=_[_0xb5fa('0x42')]({},_0x5a0152,_0xed02e[_0xb5fa('0x43')]);var _0x5bc93f={'where':_0x5a0152[_0xb5fa('0x3d')]};return db[_0xb5fa('0x31')][_0xb5fa('0x1f')](_0x5bc93f)[_0xb5fa('0x25')](function(_0x402a68){_0x21fc7e['count']=_0x402a68;if(_0xed02e[_0xb5fa('0x3c')]['includeAll']){_0x5a0152[_0xb5fa('0x44')]=[{'all':!![]}];}return db[_0xb5fa('0x31')][_0xb5fa('0x45')](_0x5a0152);})[_0xb5fa('0x25')](function(_0x1c706b){_0x21fc7e[_0xb5fa('0x46')]=_0x1c706b;return _0x21fc7e;})[_0xb5fa('0x25')](respondWithFilteredResult(_0x116773,_0x5a0152))[_0xb5fa('0x47')](handleError(_0x116773,null));};exports['show']=function(_0x1c3c2c,_0xc03e44){var _0x59ae64={'raw':!![],'where':{'id':_0x1c3c2c['params']['id']}},_0x293c19={};_0x293c19[_0xb5fa('0x36')]=_[_0xb5fa('0x34')](db['AnalyticDefaultReport']['rawAttributes']);_0x293c19[_0xb5fa('0x3c')]=_[_0xb5fa('0x34')](_0x1c3c2c[_0xb5fa('0x3c')]);_0x293c19[_0xb5fa('0x3f')]=_[_0xb5fa('0x35')](_0x293c19[_0xb5fa('0x36')],_0x293c19[_0xb5fa('0x3c')]);_0x59ae64[_0xb5fa('0x38')]=_['intersection'](_0x293c19[_0xb5fa('0x36')],qs[_0xb5fa('0x37')](_0x1c3c2c['query'][_0xb5fa('0x37')]));_0x59ae64[_0xb5fa('0x38')]=_0x59ae64[_0xb5fa('0x38')][_0xb5fa('0x39')]?_0x59ae64[_0xb5fa('0x38')]:_0x293c19[_0xb5fa('0x36')];if(_0x1c3c2c[_0xb5fa('0x3c')][_0xb5fa('0x48')]){_0x59ae64[_0xb5fa('0x44')]=[{'all':!![]}];}_0x59ae64=_[_0xb5fa('0x42')]({},_0x59ae64,_0x1c3c2c[_0xb5fa('0x43')]);return db[_0xb5fa('0x31')][_0xb5fa('0x49')](_0x59ae64)[_0xb5fa('0x25')](handleEntityNotFound(_0xc03e44,null))[_0xb5fa('0x25')](respondWithResult(_0xc03e44,null))[_0xb5fa('0x47')](handleError(_0xc03e44,null));};exports['create']=function(_0x56dceb,_0x46194d){return db['AnalyticDefaultReport'][_0xb5fa('0x4a')](_0x56dceb[_0xb5fa('0x4b')],{})['then'](function(_0x4ef1d0){var _0x2931a7=_0x56dceb[_0xb5fa('0x4c')][_0xb5fa('0x27')]({'plain':!![]});if(!_0x2931a7)throw new Error(_0xb5fa('0x4d'));if(_0x2931a7[_0xb5fa('0x4e')]==='user'){var _0x27a651=_0x4ef1d0['get']({'plain':!![]});var _0x251d36=_0xb5fa('0x4f');return db[_0xb5fa('0x50')]['find']({'where':{'name':_0x251d36,'userProfileId':_0x2931a7[_0xb5fa('0x51')]},'raw':!![]})[_0xb5fa('0x25')](function(_0x4dea87){if(_0x4dea87&&_0x4dea87['autoAssociation']===0x0){return db[_0xb5fa('0x29')][_0xb5fa('0x4a')]({'name':_0x27a651[_0xb5fa('0x2d')],'resourceId':_0x27a651['id'],'type':_0xb5fa('0x28'),'sectionId':_0x4dea87['id']},{})[_0xb5fa('0x25')](function(){return _0x4ef1d0;});}else{return _0x4ef1d0;}})[_0xb5fa('0x47')](function(_0x31c91f){logger[_0xb5fa('0x2b')](_0xb5fa('0x52'),_0x31c91f);throw _0x31c91f;});}return _0x4ef1d0;})[_0xb5fa('0x25')](respondWithResult(_0x46194d,0xc9))[_0xb5fa('0x47')](handleError(_0x46194d,null));};exports[_0xb5fa('0x24')]=function(_0x3ccfd1,_0x2799e7){if(_0x3ccfd1[_0xb5fa('0x4b')]['id']){delete _0x3ccfd1[_0xb5fa('0x4b')]['id'];}return db[_0xb5fa('0x31')][_0xb5fa('0x49')]({'where':{'id':_0x3ccfd1['params']['id']}})[_0xb5fa('0x25')](handleEntityNotFound(_0x2799e7,null))[_0xb5fa('0x25')](saveUpdates(_0x3ccfd1[_0xb5fa('0x4b')],null))[_0xb5fa('0x25')](respondWithResult(_0x2799e7,null))[_0xb5fa('0x47')](handleError(_0x2799e7,null));};exports[_0xb5fa('0x26')]=function(_0x4224cf,_0x24117e){return db[_0xb5fa('0x31')][_0xb5fa('0x49')]({'where':{'id':_0x4224cf['params']['id']}})['then'](handleEntityNotFound(_0x24117e,null))[_0xb5fa('0x25')](removeEntity(_0x24117e,null))[_0xb5fa('0x47')](handleError(_0x24117e,null));};exports[_0xb5fa('0x53')]=function(_0x5caf84,_0x441c41){var _0x367f7a=0xa;var _0x1572fb=[_0xb5fa('0x54'),_0xb5fa('0x55'),_0xb5fa('0x56'),_0xb5fa('0x57')];var _0x4f82f0={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xb5fa('0x5a'),'MIN':_0xb5fa('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':_0xb5fa('0x5e')};var _0x2b9a45={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':_0xb5fa('0x60'),'HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':_0xb5fa('0x63')};var _0x1c24e3=function(_0xfb88cc){return!_[_0xb5fa('0x64')]([_0xb5fa('0x65'),_0xb5fa('0x66'),_0xb5fa('0x67'),_0xb5fa('0x68')],_0xfb88cc);};var _0x41cce9=function(_0x23fb01){if(!_0x23fb01||!_0x23fb01[_0xb5fa('0x69')][_0xb5fa('0x39')]){return'';}for(var _0x421a93='(',_0x36fc0f=0x0;_0x36fc0f<_0x23fb01['rules'][_0xb5fa('0x39')];_0x36fc0f+=0x1){_0x36fc0f>0x0&&(_0x421a93+='\x20'+_0x23fb01[_0xb5fa('0x6a')]+'\x20');_0x421a93+=_0x23fb01[_0xb5fa('0x69')][_0x36fc0f]['group']?_0x41cce9(_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6b')]):_0x23fb01['rules'][_0x36fc0f][_0xb5fa('0x6c')]+'\x20'+_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6d')]+(_0x1c24e3(_0x23fb01['rules'][_0x36fc0f]['condition'])?'\x20'+_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6e')]:'');}return _0x421a93+')';};var _0x432f04={'where':{'id':_0x5caf84['params']['id']}},_0x57d8b7,_0x597206,_0x30d53b,_0x199555,_0x12b0a2;_0x432f04=_['merge']({},_0x432f04,_0x5caf84['options']);return db[_0xb5fa('0x31')][_0xb5fa('0x49')](_0x432f04)[_0xb5fa('0x25')](function(_0x4ce1bd){if(_0x4ce1bd){_0x57d8b7=_0x4ce1bd;return _0x4ce1bd[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x13ef3a){if(_0x13ef3a){if(!_0x13ef3a[_0xb5fa('0x39')]){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x597206=_0x13ef3a;return db[_0xb5fa('0x73')][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x3a1db9){if(_0x3a1db9){_0x30d53b=_[_0xb5fa('0x74')](_0x3a1db9,'id');var _0xecdff3;var _0x38faa6=squel[_0xb5fa('0x75')]();_0x38faa6['from'](_0x57d8b7[_0xb5fa('0x76')]);for(var _0x5a6f74=0x0;_0x5a6f74<_0x597206[_0xb5fa('0x39')];_0x5a6f74+=0x1){_0xecdff3=_0x597206[_0x5a6f74][_0xb5fa('0x77')]?_0x30d53b[_0x597206[_0x5a6f74][_0xb5fa('0x77')]][_0xb5fa('0x78')]:_0x597206[_0x5a6f74][_0xb5fa('0x6c')];_0xecdff3=_0x597206[_0x5a6f74]['function']?_[_0xb5fa('0x79')](_0x4f82f0[_0x597206[_0x5a6f74]['function']],'%s',_0xecdff3):_0xecdff3;_0xecdff3=_0x597206[_0x5a6f74][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x2b9a45[_0x597206[_0x5a6f74][_0xb5fa('0x7a')]],'%s',_0xecdff3):_0xecdff3;if(_0x597206[_0x5a6f74][_0xb5fa('0x7b')]){_0x38faa6['group'](_0xecdff3);}_0x597206[_0x5a6f74]['orderBy']&&_0x38faa6['order'](_0xecdff3,_0x597206[_0x5a6f74][_0xb5fa('0x7c')]===_0xb5fa('0x7d')?![]:!![]);_0x38faa6[_0xb5fa('0x6c')](_0xecdff3,_0x597206[_0x5a6f74][_0xb5fa('0x7e')]||_0xecdff3);}if(_0x57d8b7[_0xb5fa('0x7f')]){_0x57d8b7[_0xb5fa('0x7f')]=JSON['parse'](_0x57d8b7[_0xb5fa('0x7f')]);for(var _0x5c08e1=0x0;_0x5c08e1<_0x57d8b7['joins'][_0xb5fa('0x39')];_0x5c08e1+=0x1){if(_0x57d8b7['joins'][_0x5c08e1]['type']&&_['includes'](_0x1572fb,_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['type'])&&_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x80')]&&_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['foreignTable']&&_0x57d8b7['joins'][_0x5c08e1][_0xb5fa('0x81')]){_0x38faa6[_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['type']](_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')](_0xb5fa('0x83'),_0x57d8b7['table'],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x80')],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x82')],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x81')]));}}}if(_0x57d8b7[_0xb5fa('0x84')]){_0x57d8b7['conditions']=JSON[_0xb5fa('0x85')](_0x57d8b7['conditions']);_0x38faa6[_0xb5fa('0x3d')](_0x41cce9(_0x57d8b7[_0xb5fa('0x84')]['group']));}_0x12b0a2=_0x38faa6[_0xb5fa('0x86')]();_0x38faa6[_0xb5fa('0x1d')](_0x367f7a);_0x38faa6[_0xb5fa('0x20')](0x0);logger[_0xb5fa('0x87')](_0xb5fa('0x88'),_0x38faa6[_0xb5fa('0x89')]());return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x38faa6['toString'](),{'type':dbH[_0xb5fa('0x8a')][_0xb5fa('0x8b')][_0xb5fa('0x8c')]});}})[_0xb5fa('0x25')](respondWithResult(_0x441c41,null))['catch'](handleError(_0x441c41,null));};function runReport(_0x593386,_0x47d72b,_0x5557a3){var _0x1c60bd=_0x47d72b[_0xb5fa('0x2d')];var _0xff504d=0xa;var _0x188e66=['join','left_join',_0xb5fa('0x56'),'cross_join'];var _0x32eebd={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':_0xb5fa('0x8d'),'MAX':'MAX(%s)','MIN':_0xb5fa('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5e6852={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':_0xb5fa('0x60'),'HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':_0xb5fa('0x63')};var _0xa7fd3b=function(_0x42e210){return!_[_0xb5fa('0x64')]([_0xb5fa('0x65'),_0xb5fa('0x66'),_0xb5fa('0x67'),_0xb5fa('0x68')],_0x42e210);};var _0x86dfe9=function(_0x53c7b5){if(!_0x53c7b5||!_0x53c7b5['rules'][_0xb5fa('0x39')]){return'';}for(var _0x52384b='(',_0x1cb113=0x0;_0x1cb113<_0x53c7b5[_0xb5fa('0x69')]['length'];_0x1cb113+=0x1){_0x1cb113>0x0&&(_0x52384b+='\x20'+_0x53c7b5[_0xb5fa('0x6a')]+'\x20');_0x52384b+=_0x53c7b5[_0xb5fa('0x69')][_0x1cb113]['group']?_0x86dfe9(_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6b')]):_0x53c7b5['rules'][_0x1cb113][_0xb5fa('0x6c')]+'\x20'+_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6d')]+(_0xa7fd3b(_0x53c7b5['rules'][_0x1cb113]['condition'])?'\x20'+_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6e')]:'');}return _0x52384b+')';};var _0x3b5e1d={'where':{'id':_0x593386['id']}},_0x3d18a9,_0x397830,_0x234d9d,_0x10222c,_0x1eec65;_0x3b5e1d=_[_0xb5fa('0x42')]({},_0x3b5e1d,_0x5557a3);return db[_0xb5fa('0x31')]['find'](_0x3b5e1d)['then'](function(_0x3c5563){if(_0x3c5563){_0x3d18a9=_0x3c5563;return _0x3c5563[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x18498d){if(_0x18498d){if(!_0x18498d['length']){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x397830=_0x18498d;return db['AnalyticMetric'][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x109dd9){if(_0x109dd9){_0x234d9d=_[_0xb5fa('0x74')](_0x109dd9,'id');var _0x5ba2e7;var _0x1175da=squel[_0xb5fa('0x75')]();_0x1175da[_0xb5fa('0x8e')](_0x3d18a9[_0xb5fa('0x76')]);for(var _0x19717a=0x0;_0x19717a<_0x397830[_0xb5fa('0x39')];_0x19717a+=0x1){_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x77')]?_0x234d9d[_0x397830[_0x19717a][_0xb5fa('0x77')]][_0xb5fa('0x78')]:_0x397830[_0x19717a][_0xb5fa('0x6c')];_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x8f')]?_[_0xb5fa('0x79')](_0x32eebd[_0x397830[_0x19717a][_0xb5fa('0x8f')]],'%s',_0x5ba2e7):_0x5ba2e7;_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x5e6852[_0x397830[_0x19717a]['format']],'%s',_0x5ba2e7):_0x5ba2e7;if(_0x397830[_0x19717a][_0xb5fa('0x7b')]){_0x1175da[_0xb5fa('0x6b')](_0x5ba2e7);}_0x397830[_0x19717a][_0xb5fa('0x7c')]&&_0x1175da[_0xb5fa('0x90')](_0x5ba2e7,_0x397830[_0x19717a][_0xb5fa('0x7c')]===_0xb5fa('0x7d')?![]:!![]);_0x1175da[_0xb5fa('0x6c')](_0x5ba2e7,_0x397830[_0x19717a][_0xb5fa('0x7e')]||_0x5ba2e7);}if(_0x3d18a9['joins']){_0x3d18a9['joins']=JSON[_0xb5fa('0x85')](_0x3d18a9['joins']);for(var _0x5d0ca8=0x0;_0x5d0ca8<_0x3d18a9[_0xb5fa('0x7f')][_0xb5fa('0x39')];_0x5d0ca8+=0x1){if(_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['type']&&_[_0xb5fa('0x64')](_0x188e66,_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x33')])&&_0x3d18a9['joins'][_0x5d0ca8][_0xb5fa('0x80')]&&_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['foreignTable']&&_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x81')]){_0x1175da[_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x33')]](_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')]('%s.%s\x20=\x20%s.%s',_0x3d18a9[_0xb5fa('0x76')],_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x80')],_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['foreignTable'],_0x3d18a9['joins'][_0x5d0ca8][_0xb5fa('0x81')]));}}}if(_0x3d18a9[_0xb5fa('0x84')]){_0x3d18a9[_0xb5fa('0x84')]=JSON[_0xb5fa('0x85')](_0x3d18a9['conditions']);_0x1175da['where'](_0x86dfe9(_0x3d18a9['conditions']['group']));}_0x1eec65=_0x1175da[_0xb5fa('0x86')]();_0x1175da[_0xb5fa('0x1d')](_0xff504d);_0x1175da[_0xb5fa('0x20')](0x0);return;}})[_0xb5fa('0x25')](function(){if(_0x47d72b[_0xb5fa('0x91')]===_0xb5fa('0x92')){return null;}var _0x3c36a8=_[_0xb5fa('0x42')](_0x47d72b,{'name':_0x47d72b[_0xb5fa('0x93')]||_0x47d72b[_0xb5fa('0x2d')]||_0x3d18a9[_0xb5fa('0x2d')],'basename':_0x1c60bd,'savename':util['format'](_0xb5fa('0x94'),_0x47d72b[_0xb5fa('0x2d')]||_0x3d18a9['name'],require(_0xb5fa('0x95'))[_0xb5fa('0x96')](0x4),_0x47d72b['output']||_0xb5fa('0x97')),'reportId':_0x3d18a9['id'],'reportType':_0xb5fa('0x98')});return db[_0xb5fa('0x99')][_0xb5fa('0x4a')](_0x3c36a8,{'raw':!![]});})[_0xb5fa('0x25')](function(_0x2b449a){if(_0x3d18a9[_0xb5fa('0x76')]===_0xb5fa('0x9a')){_0x1eec65[_0xb5fa('0x3d')](_0x3d18a9['table']+_0xb5fa('0x9b'),_0x47d72b[_0xb5fa('0x9c')],_0x47d72b[_0xb5fa('0x9d')]);}else{_0x1eec65[_0xb5fa('0x3d')](_0x3d18a9[_0xb5fa('0x76')]+_0xb5fa('0x9e'),_0x47d72b[_0xb5fa('0x9c')],_0x47d72b[_0xb5fa('0x9d')]);}if(_0x2b449a){logger['info'](_0xb5fa('0x9f'),_0x1eec65['toString']());require(_0xb5fa('0xa0'))[_0xb5fa('0xa1')](path[_0xb5fa('0x54')](__dirname,_0xb5fa('0xa2'),_0x2b449a[_0xb5fa('0x91')]),[_0x2b449a['id'],_0x1eec65[_0xb5fa('0x89')](),path[_0xb5fa('0x54')](__dirname,_0xb5fa('0xa3'),_0x2b449a[_0xb5fa('0xa4')]),_0x1c60bd]);return _0x2b449a;}else{var _0x4bb9b4=squel['select']();_0x4bb9b4[_0xb5fa('0x8e')]('('+_0x1eec65[_0xb5fa('0x89')]()+')',_0xb5fa('0xa5'));_0x4bb9b4[_0xb5fa('0x6c')]('COUNT(*)',_0xb5fa('0x1f'));_0x1eec65['limit'](_0x47d72b[_0xb5fa('0x1d')]||_0xff504d);_0x1eec65[_0xb5fa('0x20')](_0x47d72b['offset']||0x0);return dbH[_0xb5fa('0x8a')]['query'](_0x4bb9b4[_0xb5fa('0x89')](),{'type':dbH['sequelize'][_0xb5fa('0x8b')][_0xb5fa('0x8c')]})[_0xb5fa('0x25')](function(_0x70e4ae){if(!_0x70e4ae[_0xb5fa('0x39')]){_0x10222c=0x0;}else{_0x10222c=_0x70e4ae[0x0][_0xb5fa('0x1f')]||0x0;}return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x1eec65[_0xb5fa('0x89')](),{'type':dbH[_0xb5fa('0x8a')][_0xb5fa('0x8b')]['SELECT']});})[_0xb5fa('0x25')](function(_0x284b34){return{'rows':_0x284b34||[],'count':_0x10222c};});}});}exports[_0xb5fa('0xa6')]=function(_0x497931,_0x2145d8){return runReport(_0x497931[_0xb5fa('0xa7')],_0x497931[_0xb5fa('0x3c')],_0x497931[_0xb5fa('0x43')])[_0xb5fa('0x25')](respondWithResult(_0x2145d8,null))[_0xb5fa('0x47')](handleError(_0x2145d8,null));};exports[_0xb5fa('0xa8')]=runReport;exports[_0xb5fa('0x3c')]=function(_0x59fd75,_0x245ee1){var _0x5c1e1f=0xa;var _0x3ba723=[_0xb5fa('0x54'),_0xb5fa('0x55'),_0xb5fa('0x56'),_0xb5fa('0x57')];var _0x105c0f={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':_0xb5fa('0x8d'),'MAX':_0xb5fa('0x5a'),'MIN':_0xb5fa('0x5b'),'AVG':_0xb5fa('0xa9'),'GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':_0xb5fa('0x5e')};var _0x41e086={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':'DATE(%s)','HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xd34c31=function(_0x2e614e){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0xb5fa('0x67'),_0xb5fa('0x68')],_0x2e614e);};var _0x1aae82=function(_0x474bb){if(!_0x474bb||!_0x474bb[_0xb5fa('0x69')][_0xb5fa('0x39')]){return'';}for(var _0x17ae50='(',_0x51c9ba=0x0;_0x51c9ba<_0x474bb['rules']['length'];_0x51c9ba+=0x1){_0x51c9ba>0x0&&(_0x17ae50+='\x20'+_0x474bb[_0xb5fa('0x6a')]+'\x20');_0x17ae50+=_0x474bb['rules'][_0x51c9ba]['group']?_0x1aae82(_0x474bb[_0xb5fa('0x69')][_0x51c9ba]['group']):_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6c')]+'\x20'+_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6d')]+(_0xd34c31(_0x474bb[_0xb5fa('0x69')][_0x51c9ba]['condition'])?'\x20'+_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6e')]:'');}return _0x17ae50+')';};var _0x2fe715={'where':{'id':_0x59fd75[_0xb5fa('0xa7')]['id']}},_0x3c5ac4,_0x23b70f,_0x488818,_0x15b228,_0x42fd84;_0x2fe715=_[_0xb5fa('0x42')]({},_0x2fe715,_0x59fd75[_0xb5fa('0x43')]);return db[_0xb5fa('0x31')]['find'](_0x2fe715)[_0xb5fa('0x25')](function(_0x390043){if(_0x390043){_0x3c5ac4=_0x390043;return _0x390043[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x32c191){if(_0x32c191){if(!_0x32c191[_0xb5fa('0x39')]){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x23b70f=_0x32c191;return db[_0xb5fa('0x73')][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x1d307c){if(_0x1d307c){_0x488818=_[_0xb5fa('0x74')](_0x1d307c,'id');var _0x3347eb;var _0x349e0b=squel[_0xb5fa('0x75')]();_0x349e0b[_0xb5fa('0x8e')](_0x3c5ac4[_0xb5fa('0x76')]);for(var _0x2b1c3f=0x0;_0x2b1c3f<_0x23b70f[_0xb5fa('0x39')];_0x2b1c3f+=0x1){_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x77')]?_0x488818[_0x23b70f[_0x2b1c3f]['MetricId']]['metric']:_0x23b70f[_0x2b1c3f][_0xb5fa('0x6c')];_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x8f')]?_[_0xb5fa('0x79')](_0x105c0f[_0x23b70f[_0x2b1c3f][_0xb5fa('0x8f')]],'%s',_0x3347eb):_0x3347eb;_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x41e086[_0x23b70f[_0x2b1c3f]['format']],'%s',_0x3347eb):_0x3347eb;if(_0x23b70f[_0x2b1c3f]['groupBy']){_0x349e0b['group'](_0x3347eb);}_0x23b70f[_0x2b1c3f][_0xb5fa('0x7c')]&&_0x349e0b[_0xb5fa('0x90')](_0x3347eb,_0x23b70f[_0x2b1c3f]['orderBy']===_0xb5fa('0x7d')?![]:!![]);_0x349e0b[_0xb5fa('0x6c')](_0x3347eb,_0x23b70f[_0x2b1c3f]['alias']||_0x3347eb);}if(_0x3c5ac4[_0xb5fa('0x7f')]){_0x3c5ac4[_0xb5fa('0x7f')]=JSON[_0xb5fa('0x85')](_0x3c5ac4[_0xb5fa('0x7f')]);for(var _0x10dbdf=0x0;_0x10dbdf<_0x3c5ac4[_0xb5fa('0x7f')][_0xb5fa('0x39')];_0x10dbdf+=0x1){if(_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['type']&&_[_0xb5fa('0x64')](_0x3ba723,_0x3c5ac4['joins'][_0x10dbdf][_0xb5fa('0x33')])&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x80')]&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignTable']&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x81')]){_0x349e0b[_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x33')]](_0x3c5ac4['joins'][_0x10dbdf][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')](_0xb5fa('0x83'),_0x3c5ac4[_0xb5fa('0x76')],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x80')],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignTable'],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignKey']));}}}if(_0x3c5ac4[_0xb5fa('0x84')]){_0x3c5ac4[_0xb5fa('0x84')]=JSON[_0xb5fa('0x85')](_0x3c5ac4[_0xb5fa('0x84')]);_0x349e0b[_0xb5fa('0x3d')](_0x1aae82(_0x3c5ac4[_0xb5fa('0x84')][_0xb5fa('0x6b')]));}_0x42fd84=_0x349e0b['clone']();_0x349e0b['limit'](_0x5c1e1f);_0x349e0b[_0xb5fa('0x20')](0x0);logger[_0xb5fa('0x87')](_0xb5fa('0x88'),_0x349e0b[_0xb5fa('0x89')]());return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x349e0b[_0xb5fa('0x89')](),{'type':dbH[_0xb5fa('0x8a')]['QueryTypes'][_0xb5fa('0x8c')]});}})[_0xb5fa('0x25')](function(){return{'sql':_0x42fd84[_0xb5fa('0x89')]()};})[_0xb5fa('0x25')](respondWithResult(_0x245ee1,null))[_0xb5fa('0x47')](handleError(_0x245ee1,null));}; \ No newline at end of file +var _0x31f0=['fullPath','%s-%s.%s','randomstring','generate','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','../../components/export/','../../files/reports','countTable','COUNT(*)','run','runReport','DATE(%s)','keyBy','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','get','DefaultReports','destroy','error','name','send','index','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','include','findAll','rows','catch','params','length','find','create','user','role','Reports','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','function','replace','format','orderBy','DESC','field','alias','parse','joins','parentKey','foreignKey','%s.%s\x20=\x20%s.%s','foreignTable','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','COUNT(DISTINCT\x20%s)','AVG(%s)','HOUR(%s)','ROUND(%s)','IS\x20NOT\x20NULL','getFields','MetricId','metric','groupBy','output','web'];(function(_0x250853,_0x44ae5c){var _0x23732f=function(_0x3b5dca){while(--_0x3b5dca){_0x250853['push'](_0x250853['shift']());}};_0x23732f(++_0x44ae5c);}(_0x31f0,0xb7));var _0x031f=function(_0x5d6f4c,_0x1326b4){_0x5d6f4c=_0x5d6f4c-0x0;var _0x5961ab=_0x31f0[_0x5d6f4c];return _0x5961ab;};'use strict';var emlformat=require(_0x031f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x031f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x031f('0x2'));var moment=require(_0x031f('0x3'));var BPromise=require(_0x031f('0x4'));var Mustache=require(_0x031f('0x5'));var util=require('util');var path=require(_0x031f('0x6'));var sox=require(_0x031f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x031f('0x8'));var squel=require('squel');var crypto=require(_0x031f('0x9'));var jsforce=require(_0x031f('0xa'));var deskjs=require(_0x031f('0xb'));var toCsv=require(_0x031f('0xc'));var querystring=require('querystring');var Papa=require(_0x031f('0xd'));var Redis=require(_0x031f('0xe'));var authService=require(_0x031f('0xf'));var qs=require(_0x031f('0x10'));var as=require(_0x031f('0x11'));var hardwareService=require(_0x031f('0x12'));var logger=require(_0x031f('0x13'))(_0x031f('0x14'));var utils=require('../../config/utils');var config=require(_0x031f('0x15'));var licenseUtil=require(_0x031f('0x16'));var db=require(_0x031f('0x17'))['db'];var dbH=require(_0x031f('0x17'))[_0x031f('0x18')];function respondWithStatusCode(_0x405896,_0x1c230d){_0x1c230d=_0x1c230d||0xcc;return function(_0x5d0457){if(_0x5d0457){return _0x405896[_0x031f('0x19')](_0x1c230d);}return _0x405896[_0x031f('0x1a')](_0x1c230d)[_0x031f('0x1b')]();};}function respondWithResult(_0x2e3dfe,_0x2ea549){_0x2ea549=_0x2ea549||0xc8;return function(_0x57f9c0){if(_0x57f9c0){return _0x2e3dfe['status'](_0x2ea549)[_0x031f('0x1c')](_0x57f9c0);}};}function respondWithFilteredResult(_0x3a10aa,_0xe4fc1d){return function(_0x286177){if(_0x286177){var _0x5196b1=typeof _0xe4fc1d[_0x031f('0x1d')]===_0x031f('0x1e')&&typeof _0xe4fc1d['limit']===_0x031f('0x1e');var _0x535e70=_0x286177[_0x031f('0x1f')];var _0x5f2199=_0x5196b1?0x0:_0xe4fc1d[_0x031f('0x1d')];var _0xaa155=_0x5196b1?_0x286177[_0x031f('0x1f')]:_0xe4fc1d[_0x031f('0x1d')]+_0xe4fc1d[_0x031f('0x20')];var _0x2825ef;if(_0xaa155>=_0x535e70){_0xaa155=_0x535e70;_0x2825ef=0xc8;}else{_0x2825ef=0xce;}_0x3a10aa[_0x031f('0x1a')](_0x2825ef);return _0x3a10aa[_0x031f('0x21')](_0x031f('0x22'),_0x5f2199+'-'+_0xaa155+'/'+_0x535e70)['json'](_0x286177);}return null;};}function patchUpdates(_0xf72793){return function(_0x33926c){try{jsonpatch[_0x031f('0x23')](_0x33926c,_0xf72793,!![]);}catch(_0x4d6706){return BPromise['reject'](_0x4d6706);}return _0x33926c[_0x031f('0x24')]();};}function saveUpdates(_0x4d0f92,_0x3472a2){return function(_0x57f6c4){if(_0x57f6c4){return _0x57f6c4['update'](_0x4d0f92)['then'](function(_0x971691){return _0x971691;});}return null;};}function removeEntity(_0x12c406,_0x2920cd){return function(_0x4c8126){if(_0x4c8126){return _0x4c8126['destroy']()[_0x031f('0x25')](function(){var _0x5a64c0=_0x4c8126[_0x031f('0x26')]({'plain':!![]});var _0x1f5a14=_0x031f('0x27');return db['UserProfileResource'][_0x031f('0x28')]({'where':{'type':_0x1f5a14,'resourceId':_0x5a64c0['id']}})[_0x031f('0x25')](function(){return _0x4c8126;});})['then'](function(){_0x12c406[_0x031f('0x1a')](0xcc)[_0x031f('0x1b')]();});}};}function handleEntityNotFound(_0x2403e9,_0x5395ea){return function(_0xa308b){if(!_0xa308b){_0x2403e9[_0x031f('0x19')](0x194);}return _0xa308b;};}function handleError(_0xb6ed6c,_0xaf5bea){_0xaf5bea=_0xaf5bea||0x1f4;return function(_0xfaa36){logger[_0x031f('0x29')](_0xfaa36['stack']);if(_0xfaa36[_0x031f('0x2a')]){delete _0xfaa36[_0x031f('0x2a')];}_0xb6ed6c[_0x031f('0x1a')](_0xaf5bea)[_0x031f('0x2b')](_0xfaa36);};}exports[_0x031f('0x2c')]=function(_0x2d24f0,_0x378692){var _0x87dc07={},_0x2034ac={},_0xfc4a89={'count':0x0,'rows':[]};var _0x2cf3a8=_['map'](db[_0x031f('0x2d')][_0x031f('0x2e')],function(_0xb3a6bd){return{'name':_0xb3a6bd[_0x031f('0x2f')],'type':_0xb3a6bd[_0x031f('0x30')][_0x031f('0x31')]};});_0x2034ac[_0x031f('0x32')]=_[_0x031f('0x33')](_0x2cf3a8,_0x031f('0x2a'));_0x2034ac[_0x031f('0x34')]=_[_0x031f('0x35')](_0x2d24f0[_0x031f('0x34')]);_0x2034ac[_0x031f('0x36')]=_['intersection'](_0x2034ac[_0x031f('0x32')],_0x2034ac[_0x031f('0x34')]);_0x87dc07['attributes']=_[_0x031f('0x37')](_0x2034ac[_0x031f('0x32')],qs['fields'](_0x2d24f0[_0x031f('0x34')][_0x031f('0x38')]));_0x87dc07[_0x031f('0x39')]=_0x87dc07[_0x031f('0x39')]['length']?_0x87dc07['attributes']:_0x2034ac[_0x031f('0x32')];if(!_0x2d24f0['query'][_0x031f('0x3a')](_0x031f('0x3b'))){_0x87dc07[_0x031f('0x20')]=qs['limit'](_0x2d24f0['query'][_0x031f('0x20')]);_0x87dc07['offset']=qs['offset'](_0x2d24f0[_0x031f('0x34')][_0x031f('0x1d')]);}_0x87dc07[_0x031f('0x3c')]=qs[_0x031f('0x3d')](_0x2d24f0[_0x031f('0x34')][_0x031f('0x3d')]);_0x87dc07[_0x031f('0x3e')]=qs['filters'](_[_0x031f('0x3f')](_0x2d24f0[_0x031f('0x34')],_0x2034ac[_0x031f('0x36')]),_0x2cf3a8);if(_0x2d24f0[_0x031f('0x34')]['filter']){_0x87dc07[_0x031f('0x3e')]=_[_0x031f('0x40')](_0x87dc07[_0x031f('0x3e')],{'$or':_['map'](_0x2cf3a8,function(_0x24ec95){if(_0x24ec95[_0x031f('0x30')]!=='VIRTUAL'){var _0x36bafa={};_0x36bafa[_0x24ec95[_0x031f('0x2a')]]={'$like':'%'+_0x2d24f0['query']['filter']+'%'};return _0x36bafa;}})});}_0x87dc07=_[_0x031f('0x40')]({},_0x87dc07,_0x2d24f0[_0x031f('0x41')]);var _0x9efbc4={'where':_0x87dc07[_0x031f('0x3e')]};return db[_0x031f('0x2d')][_0x031f('0x1f')](_0x9efbc4)[_0x031f('0x25')](function(_0x5a212c){_0xfc4a89[_0x031f('0x1f')]=_0x5a212c;if(_0x2d24f0[_0x031f('0x34')]['includeAll']){_0x87dc07[_0x031f('0x42')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x031f('0x43')](_0x87dc07);})[_0x031f('0x25')](function(_0x56dd24){_0xfc4a89[_0x031f('0x44')]=_0x56dd24;return _0xfc4a89;})[_0x031f('0x25')](respondWithFilteredResult(_0x378692,_0x87dc07))[_0x031f('0x45')](handleError(_0x378692,null));};exports['show']=function(_0x98747f,_0x213e1c){var _0x1d3324={'raw':!![],'where':{'id':_0x98747f[_0x031f('0x46')]['id']}},_0x2a6cba={};_0x2a6cba[_0x031f('0x32')]=_[_0x031f('0x35')](db[_0x031f('0x2d')][_0x031f('0x2e')]);_0x2a6cba['query']=_[_0x031f('0x35')](_0x98747f[_0x031f('0x34')]);_0x2a6cba[_0x031f('0x36')]=_[_0x031f('0x37')](_0x2a6cba[_0x031f('0x32')],_0x2a6cba[_0x031f('0x34')]);_0x1d3324[_0x031f('0x39')]=_[_0x031f('0x37')](_0x2a6cba[_0x031f('0x32')],qs['fields'](_0x98747f[_0x031f('0x34')]['fields']));_0x1d3324['attributes']=_0x1d3324[_0x031f('0x39')][_0x031f('0x47')]?_0x1d3324[_0x031f('0x39')]:_0x2a6cba[_0x031f('0x32')];if(_0x98747f[_0x031f('0x34')]['includeAll']){_0x1d3324[_0x031f('0x42')]=[{'all':!![]}];}_0x1d3324=_[_0x031f('0x40')]({},_0x1d3324,_0x98747f[_0x031f('0x41')]);return db['AnalyticDefaultReport'][_0x031f('0x48')](_0x1d3324)[_0x031f('0x25')](handleEntityNotFound(_0x213e1c,null))[_0x031f('0x25')](respondWithResult(_0x213e1c,null))[_0x031f('0x45')](handleError(_0x213e1c,null));};exports[_0x031f('0x49')]=function(_0x12d28e,_0x5caeb5){return db['AnalyticDefaultReport'][_0x031f('0x49')](_0x12d28e['body'],{})[_0x031f('0x25')](function(_0x3bba44){var _0x5a29e0=_0x12d28e[_0x031f('0x4a')]['get']({'plain':!![]});if(!_0x5a29e0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a29e0[_0x031f('0x4b')]==='user'){var _0x16bade=_0x3bba44['get']({'plain':!![]});var _0x11bf43=_0x031f('0x4c');return db['UserProfileSection'][_0x031f('0x48')]({'where':{'name':_0x11bf43,'userProfileId':_0x5a29e0[_0x031f('0x4d')]},'raw':!![]})['then'](function(_0x46471a){if(_0x46471a&&_0x46471a['autoAssociation']===0x0){return db[_0x031f('0x4e')]['create']({'name':_0x16bade[_0x031f('0x2a')],'resourceId':_0x16bade['id'],'type':_0x031f('0x27'),'sectionId':_0x46471a['id']},{})[_0x031f('0x25')](function(){return _0x3bba44;});}else{return _0x3bba44;}})[_0x031f('0x45')](function(_0x691a68){logger['error'](_0x031f('0x4f'),_0x691a68);throw _0x691a68;});}return _0x3bba44;})['then'](respondWithResult(_0x5caeb5,0xc9))[_0x031f('0x45')](handleError(_0x5caeb5,null));};exports[_0x031f('0x50')]=function(_0x4d49f8,_0x1f9c55){if(_0x4d49f8[_0x031f('0x51')]['id']){delete _0x4d49f8['body']['id'];}return db[_0x031f('0x2d')][_0x031f('0x48')]({'where':{'id':_0x4d49f8[_0x031f('0x46')]['id']}})['then'](handleEntityNotFound(_0x1f9c55,null))[_0x031f('0x25')](saveUpdates(_0x4d49f8['body'],null))[_0x031f('0x25')](respondWithResult(_0x1f9c55,null))['catch'](handleError(_0x1f9c55,null));};exports[_0x031f('0x28')]=function(_0x561a2b,_0xa52a54){return db[_0x031f('0x2d')]['find']({'where':{'id':_0x561a2b['params']['id']}})[_0x031f('0x25')](handleEntityNotFound(_0xa52a54,null))[_0x031f('0x25')](removeEntity(_0xa52a54,null))['catch'](handleError(_0xa52a54,null));};exports[_0x031f('0x52')]=function(_0xb44c73,_0x255003){var _0x286d4e=0xa;var _0x21a89d=[_0x031f('0x53'),_0x031f('0x54'),_0x031f('0x55'),'cross_join'];var _0xe452c2={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x031f('0x58'),'MIN':_0x031f('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':_0x031f('0x5c')};var _0x198e2e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x031f('0x5d')};var _0xcf8b7=function(_0x4a7fbb){return!_[_0x031f('0x5e')]([_0x031f('0x5f'),'IS\x20NOT\x20NULL',_0x031f('0x60'),_0x031f('0x61')],_0x4a7fbb);};var _0x451c71=function(_0x22d211){if(!_0x22d211||!_0x22d211[_0x031f('0x62')][_0x031f('0x47')]){return'';}for(var _0x2ddf15='(',_0x4527e5=0x0;_0x4527e5<_0x22d211[_0x031f('0x62')]['length'];_0x4527e5+=0x1){_0x4527e5>0x0&&(_0x2ddf15+='\x20'+_0x22d211[_0x031f('0x63')]+'\x20');_0x2ddf15+=_0x22d211['rules'][_0x4527e5][_0x031f('0x64')]?_0x451c71(_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x64')]):_0x22d211['rules'][_0x4527e5]['field']+'\x20'+_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x65')]+(_0xcf8b7(_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x65')])?'\x20'+_0x22d211['rules'][_0x4527e5][_0x031f('0x66')]:'');}return _0x2ddf15+')';};var _0x5a181c={'where':{'id':_0xb44c73[_0x031f('0x46')]['id']}},_0x478982,_0x2179ee,_0x534bae,_0x50d618,_0x71e67;_0x5a181c=_[_0x031f('0x40')]({},_0x5a181c,_0xb44c73[_0x031f('0x41')]);return db[_0x031f('0x2d')]['find'](_0x5a181c)['then'](function(_0x214eec){if(_0x214eec){_0x478982=_0x214eec;return _0x214eec['getFields']();}return null;})[_0x031f('0x25')](function(_0xa921b2){if(_0xa921b2){if(!_0xa921b2['length']){throw new db[(_0x031f('0x67'))][(_0x031f('0x68'))](_0x031f('0x69'),0x193);}_0x2179ee=_0xa921b2;return db[_0x031f('0x6a')][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x5bea08){if(_0x5bea08){_0x534bae=_['keyBy'](_0x5bea08,'id');var _0x3bcc7e;var _0x232b62=squel[_0x031f('0x6b')]();_0x232b62[_0x031f('0x6c')](_0x478982[_0x031f('0x6d')]);for(var _0x26fa57=0x0;_0x26fa57<_0x2179ee[_0x031f('0x47')];_0x26fa57+=0x1){_0x3bcc7e=_0x2179ee[_0x26fa57]['MetricId']?_0x534bae[_0x2179ee[_0x26fa57]['MetricId']]['metric']:_0x2179ee[_0x26fa57]['field'];_0x3bcc7e=_0x2179ee[_0x26fa57][_0x031f('0x6e')]?_[_0x031f('0x6f')](_0xe452c2[_0x2179ee[_0x26fa57][_0x031f('0x6e')]],'%s',_0x3bcc7e):_0x3bcc7e;_0x3bcc7e=_0x2179ee[_0x26fa57]['format']?_[_0x031f('0x6f')](_0x198e2e[_0x2179ee[_0x26fa57][_0x031f('0x70')]],'%s',_0x3bcc7e):_0x3bcc7e;if(_0x2179ee[_0x26fa57]['groupBy']){_0x232b62[_0x031f('0x64')](_0x3bcc7e);}_0x2179ee[_0x26fa57][_0x031f('0x71')]&&_0x232b62[_0x031f('0x3c')](_0x3bcc7e,_0x2179ee[_0x26fa57][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x232b62[_0x031f('0x73')](_0x3bcc7e,_0x2179ee[_0x26fa57][_0x031f('0x74')]||_0x3bcc7e);}if(_0x478982['joins']){_0x478982['joins']=JSON[_0x031f('0x75')](_0x478982['joins']);for(var _0x2ed9c1=0x0;_0x2ed9c1<_0x478982['joins'][_0x031f('0x47')];_0x2ed9c1+=0x1){if(_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x30')]&&_['includes'](_0x21a89d,_0x478982[_0x031f('0x76')][_0x2ed9c1]['type'])&&_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x77')]&&_0x478982[_0x031f('0x76')][_0x2ed9c1]['foreignTable']&&_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x78')]){_0x232b62[_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x30')]](_0x478982[_0x031f('0x76')][_0x2ed9c1]['foreignTable'],null,util['format'](_0x031f('0x79'),_0x478982[_0x031f('0x6d')],_0x478982['joins'][_0x2ed9c1][_0x031f('0x77')],_0x478982['joins'][_0x2ed9c1][_0x031f('0x7a')],_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x78')]));}}}if(_0x478982[_0x031f('0x7b')]){_0x478982['conditions']=JSON[_0x031f('0x75')](_0x478982[_0x031f('0x7b')]);_0x232b62[_0x031f('0x3e')](_0x451c71(_0x478982['conditions'][_0x031f('0x64')]));}_0x71e67=_0x232b62[_0x031f('0x7c')]();_0x232b62['limit'](_0x286d4e);_0x232b62[_0x031f('0x1d')](0x0);logger[_0x031f('0x7d')](_0x031f('0x7e'),_0x232b62[_0x031f('0x7f')]());return dbH[_0x031f('0x80')][_0x031f('0x34')](_0x232b62[_0x031f('0x7f')](),{'type':dbH['sequelize'][_0x031f('0x81')][_0x031f('0x82')]});}})[_0x031f('0x25')](respondWithResult(_0x255003,null))['catch'](handleError(_0x255003,null));};function runReport(_0x4f4aff,_0x26de7c,_0x5bd344){var _0x54f02d=_0x26de7c[_0x031f('0x2a')];var _0x184bbd=0xa;var _0x1c8055=[_0x031f('0x53'),_0x031f('0x54'),_0x031f('0x55'),_0x031f('0x83')];var _0x32c626={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':_0x031f('0x84'),'MAX':'MAX(%s)','MIN':_0x031f('0x59'),'AVG':_0x031f('0x85'),'GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x6970f5={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x031f('0x86'),'ROUND':_0x031f('0x87'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x510bb6=function(_0x3cfaa4){return!_[_0x031f('0x5e')]([_0x031f('0x5f'),_0x031f('0x88'),_0x031f('0x60'),_0x031f('0x61')],_0x3cfaa4);};var _0x5e0853=function(_0x263658){if(!_0x263658||!_0x263658[_0x031f('0x62')]['length']){return'';}for(var _0x25ea89='(',_0x2f2e96=0x0;_0x2f2e96<_0x263658[_0x031f('0x62')][_0x031f('0x47')];_0x2f2e96+=0x1){_0x2f2e96>0x0&&(_0x25ea89+='\x20'+_0x263658[_0x031f('0x63')]+'\x20');_0x25ea89+=_0x263658[_0x031f('0x62')][_0x2f2e96][_0x031f('0x64')]?_0x5e0853(_0x263658['rules'][_0x2f2e96][_0x031f('0x64')]):_0x263658['rules'][_0x2f2e96][_0x031f('0x73')]+'\x20'+_0x263658[_0x031f('0x62')][_0x2f2e96][_0x031f('0x65')]+(_0x510bb6(_0x263658['rules'][_0x2f2e96]['condition'])?'\x20'+_0x263658['rules'][_0x2f2e96][_0x031f('0x66')]:'');}return _0x25ea89+')';};var _0xee744={'where':{'id':_0x4f4aff['id']}},_0x8f0afd,_0x2985fe,_0x290f82,_0x307246,_0x232aa0;_0xee744=_['merge']({},_0xee744,_0x5bd344);return db['AnalyticDefaultReport'][_0x031f('0x48')](_0xee744)[_0x031f('0x25')](function(_0x54d86e){if(_0x54d86e){_0x8f0afd=_0x54d86e;return _0x54d86e[_0x031f('0x89')]();}return null;})['then'](function(_0x1c31d5){if(_0x1c31d5){if(!_0x1c31d5[_0x031f('0x47')]){throw new db['Sequelize'][(_0x031f('0x68'))](_0x031f('0x69'),0x193);}_0x2985fe=_0x1c31d5;return db['AnalyticMetric'][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x1b588e){if(_0x1b588e){_0x290f82=_['keyBy'](_0x1b588e,'id');var _0xa9b5e2;var _0x31504b=squel[_0x031f('0x6b')]();_0x31504b[_0x031f('0x6c')](_0x8f0afd[_0x031f('0x6d')]);for(var _0x2b3326=0x0;_0x2b3326<_0x2985fe['length'];_0x2b3326+=0x1){_0xa9b5e2=_0x2985fe[_0x2b3326][_0x031f('0x8a')]?_0x290f82[_0x2985fe[_0x2b3326][_0x031f('0x8a')]][_0x031f('0x8b')]:_0x2985fe[_0x2b3326][_0x031f('0x73')];_0xa9b5e2=_0x2985fe[_0x2b3326]['function']?_[_0x031f('0x6f')](_0x32c626[_0x2985fe[_0x2b3326][_0x031f('0x6e')]],'%s',_0xa9b5e2):_0xa9b5e2;_0xa9b5e2=_0x2985fe[_0x2b3326]['format']?_[_0x031f('0x6f')](_0x6970f5[_0x2985fe[_0x2b3326][_0x031f('0x70')]],'%s',_0xa9b5e2):_0xa9b5e2;if(_0x2985fe[_0x2b3326][_0x031f('0x8c')]){_0x31504b[_0x031f('0x64')](_0xa9b5e2);}_0x2985fe[_0x2b3326][_0x031f('0x71')]&&_0x31504b[_0x031f('0x3c')](_0xa9b5e2,_0x2985fe[_0x2b3326][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x31504b[_0x031f('0x73')](_0xa9b5e2,_0x2985fe[_0x2b3326][_0x031f('0x74')]||_0xa9b5e2);}if(_0x8f0afd[_0x031f('0x76')]){_0x8f0afd[_0x031f('0x76')]=JSON[_0x031f('0x75')](_0x8f0afd[_0x031f('0x76')]);for(var _0x2433ce=0x0;_0x2433ce<_0x8f0afd['joins'][_0x031f('0x47')];_0x2433ce+=0x1){if(_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')]&&_[_0x031f('0x5e')](_0x1c8055,_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')])&&_0x8f0afd['joins'][_0x2433ce]['parentKey']&&_0x8f0afd['joins'][_0x2433ce][_0x031f('0x7a')]&&_0x8f0afd[_0x031f('0x76')][_0x2433ce]['foreignKey']){_0x31504b[_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')]](_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x7a')],null,util['format'](_0x031f('0x79'),_0x8f0afd[_0x031f('0x6d')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x77')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x7a')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x78')]));}}}if(_0x8f0afd[_0x031f('0x7b')]){_0x8f0afd[_0x031f('0x7b')]=JSON[_0x031f('0x75')](_0x8f0afd[_0x031f('0x7b')]);_0x31504b['where'](_0x5e0853(_0x8f0afd[_0x031f('0x7b')][_0x031f('0x64')]));}_0x232aa0=_0x31504b['clone']();_0x31504b[_0x031f('0x20')](_0x184bbd);_0x31504b[_0x031f('0x1d')](0x0);return;}})['then'](function(){if(_0x26de7c[_0x031f('0x8d')]===_0x031f('0x8e')){return null;}var _0x1ade73=_[_0x031f('0x40')](_0x26de7c,{'name':_0x26de7c[_0x031f('0x8f')]||_0x26de7c[_0x031f('0x2a')]||_0x8f0afd[_0x031f('0x2a')],'basename':_0x54f02d,'savename':util[_0x031f('0x70')](_0x031f('0x90'),_0x26de7c['name']||_0x8f0afd[_0x031f('0x2a')],require(_0x031f('0x91'))[_0x031f('0x92')](0x4),_0x26de7c['output']||'csv'),'reportId':_0x8f0afd['id'],'reportType':_0x031f('0x93')});return db['AnalyticExtractedReport'][_0x031f('0x49')](_0x1ade73,{'raw':!![]});})[_0x031f('0x25')](function(_0x4a96f2){if(_0x8f0afd[_0x031f('0x6d')]===_0x031f('0x94')){_0x232aa0[_0x031f('0x3e')](_0x8f0afd[_0x031f('0x6d')]+_0x031f('0x95'),_0x26de7c[_0x031f('0x96')],_0x26de7c[_0x031f('0x97')]);}else{_0x232aa0[_0x031f('0x3e')](_0x8f0afd[_0x031f('0x6d')]+_0x031f('0x98'),_0x26de7c[_0x031f('0x96')],_0x26de7c[_0x031f('0x97')]);}if(_0x4a96f2){logger[_0x031f('0x99')]('Run\x20Query:',_0x232aa0['toString']());require(_0x031f('0x9a'))['fork'](path[_0x031f('0x53')](__dirname,_0x031f('0x9b'),_0x4a96f2[_0x031f('0x8d')]),[_0x4a96f2['id'],_0x232aa0['toString'](),path[_0x031f('0x53')](__dirname,_0x031f('0x9c'),_0x4a96f2['savename']),_0x54f02d]);return _0x4a96f2;}else{var _0x185085=squel[_0x031f('0x6b')]();_0x185085[_0x031f('0x6c')]('('+_0x232aa0[_0x031f('0x7f')]()+')',_0x031f('0x9d'));_0x185085[_0x031f('0x73')](_0x031f('0x9e'),'count');_0x232aa0[_0x031f('0x20')](_0x26de7c[_0x031f('0x20')]||_0x184bbd);_0x232aa0[_0x031f('0x1d')](_0x26de7c[_0x031f('0x1d')]||0x0);return dbH['sequelize']['query'](_0x185085[_0x031f('0x7f')](),{'type':dbH['sequelize']['QueryTypes'][_0x031f('0x82')]})['then'](function(_0x579ade){if(!_0x579ade[_0x031f('0x47')]){_0x307246=0x0;}else{_0x307246=_0x579ade[0x0][_0x031f('0x1f')]||0x0;}return dbH[_0x031f('0x80')][_0x031f('0x34')](_0x232aa0[_0x031f('0x7f')](),{'type':dbH[_0x031f('0x80')]['QueryTypes'][_0x031f('0x82')]});})[_0x031f('0x25')](function(_0x52a3f0){return{'rows':_0x52a3f0||[],'count':_0x307246};});}});}exports[_0x031f('0x9f')]=function(_0x355e1a,_0x30c32f){return runReport(_0x355e1a[_0x031f('0x46')],_0x355e1a['query'],_0x355e1a['options'])['then'](respondWithResult(_0x30c32f,null))[_0x031f('0x45')](handleError(_0x30c32f,null));};exports[_0x031f('0xa0')]=runReport;exports[_0x031f('0x34')]=function(_0x3ec98a,_0x3ed663){var _0xac324f=0xa;var _0xcf0af9=[_0x031f('0x53'),_0x031f('0x54'),'right_join',_0x031f('0x83')];var _0xde544e={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':_0x031f('0x84'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':_0x031f('0x5c')};var _0x84cd0c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x031f('0xa1'),'HOUR':'HOUR(%s)','ROUND':_0x031f('0x87'),'UNIX_TIMESTAMP':_0x031f('0x5d')};var _0x24aff3=function(_0x35a1f1){return!_[_0x031f('0x5e')](['IS\x20NULL',_0x031f('0x88'),_0x031f('0x60'),_0x031f('0x61')],_0x35a1f1);};var _0x3cb099=function(_0x4a4d8f){if(!_0x4a4d8f||!_0x4a4d8f[_0x031f('0x62')][_0x031f('0x47')]){return'';}for(var _0x578201='(',_0xdbf09f=0x0;_0xdbf09f<_0x4a4d8f['rules'][_0x031f('0x47')];_0xdbf09f+=0x1){_0xdbf09f>0x0&&(_0x578201+='\x20'+_0x4a4d8f[_0x031f('0x63')]+'\x20');_0x578201+=_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x64')]?_0x3cb099(_0x4a4d8f[_0x031f('0x62')][_0xdbf09f]['group']):_0x4a4d8f[_0x031f('0x62')][_0xdbf09f]['field']+'\x20'+_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x65')]+(_0x24aff3(_0x4a4d8f['rules'][_0xdbf09f][_0x031f('0x65')])?'\x20'+_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x66')]:'');}return _0x578201+')';};var _0x123b4d={'where':{'id':_0x3ec98a['params']['id']}},_0x3f80b5,_0x53cd67,_0x516f11,_0x50cdb2,_0x2e9a3b;_0x123b4d=_[_0x031f('0x40')]({},_0x123b4d,_0x3ec98a[_0x031f('0x41')]);return db[_0x031f('0x2d')][_0x031f('0x48')](_0x123b4d)[_0x031f('0x25')](function(_0x53911d){if(_0x53911d){_0x3f80b5=_0x53911d;return _0x53911d[_0x031f('0x89')]();}return null;})['then'](function(_0x30fa18){if(_0x30fa18){if(!_0x30fa18[_0x031f('0x47')]){throw new db[(_0x031f('0x67'))]['ValidationErrorItem'](_0x031f('0x69'),0x193);}_0x53cd67=_0x30fa18;return db[_0x031f('0x6a')][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x5b092c){if(_0x5b092c){_0x516f11=_[_0x031f('0xa2')](_0x5b092c,'id');var _0x7b8699;var _0x14a497=squel[_0x031f('0x6b')]();_0x14a497[_0x031f('0x6c')](_0x3f80b5[_0x031f('0x6d')]);for(var _0x59fd9a=0x0;_0x59fd9a<_0x53cd67[_0x031f('0x47')];_0x59fd9a+=0x1){_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x8a')]?_0x516f11[_0x53cd67[_0x59fd9a][_0x031f('0x8a')]][_0x031f('0x8b')]:_0x53cd67[_0x59fd9a][_0x031f('0x73')];_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x6e')]?_[_0x031f('0x6f')](_0xde544e[_0x53cd67[_0x59fd9a]['function']],'%s',_0x7b8699):_0x7b8699;_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x70')]?_[_0x031f('0x6f')](_0x84cd0c[_0x53cd67[_0x59fd9a][_0x031f('0x70')]],'%s',_0x7b8699):_0x7b8699;if(_0x53cd67[_0x59fd9a][_0x031f('0x8c')]){_0x14a497[_0x031f('0x64')](_0x7b8699);}_0x53cd67[_0x59fd9a]['orderBy']&&_0x14a497[_0x031f('0x3c')](_0x7b8699,_0x53cd67[_0x59fd9a][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x14a497[_0x031f('0x73')](_0x7b8699,_0x53cd67[_0x59fd9a][_0x031f('0x74')]||_0x7b8699);}if(_0x3f80b5['joins']){_0x3f80b5[_0x031f('0x76')]=JSON[_0x031f('0x75')](_0x3f80b5[_0x031f('0x76')]);for(var _0x110747=0x0;_0x110747<_0x3f80b5[_0x031f('0x76')]['length'];_0x110747+=0x1){if(_0x3f80b5['joins'][_0x110747][_0x031f('0x30')]&&_[_0x031f('0x5e')](_0xcf0af9,_0x3f80b5['joins'][_0x110747][_0x031f('0x30')])&&_0x3f80b5['joins'][_0x110747][_0x031f('0x77')]&&_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x7a')]&&_0x3f80b5[_0x031f('0x76')][_0x110747]['foreignKey']){_0x14a497[_0x3f80b5['joins'][_0x110747][_0x031f('0x30')]](_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x7a')],null,util[_0x031f('0x70')]('%s.%s\x20=\x20%s.%s',_0x3f80b5[_0x031f('0x6d')],_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x77')],_0x3f80b5['joins'][_0x110747][_0x031f('0x7a')],_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x78')]));}}}if(_0x3f80b5['conditions']){_0x3f80b5[_0x031f('0x7b')]=JSON[_0x031f('0x75')](_0x3f80b5[_0x031f('0x7b')]);_0x14a497[_0x031f('0x3e')](_0x3cb099(_0x3f80b5[_0x031f('0x7b')]['group']));}_0x2e9a3b=_0x14a497[_0x031f('0x7c')]();_0x14a497[_0x031f('0x20')](_0xac324f);_0x14a497[_0x031f('0x1d')](0x0);logger[_0x031f('0x7d')](_0x031f('0x7e'),_0x14a497[_0x031f('0x7f')]());return dbH['sequelize']['query'](_0x14a497[_0x031f('0x7f')](),{'type':dbH[_0x031f('0x80')][_0x031f('0x81')][_0x031f('0x82')]});}})[_0x031f('0x25')](function(){return{'sql':_0x2e9a3b[_0x031f('0x7f')]()};})[_0x031f('0x25')](respondWithResult(_0x3ed663,null))['catch'](handleError(_0x3ed663,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index d83d146..cb46fb6 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 _0xce3e=['request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports','lodash','util','api','bluebird'];(function(_0x19d24c,_0x62bc50){var _0x2fae8d=function(_0x419856){while(--_0x419856){_0x19d24c['push'](_0x19d24c['shift']());}};_0x2fae8d(++_0x62bc50);}(_0xce3e,0xc8));var _0xece3=function(_0x3f1cf2,_0x389edd){_0x3f1cf2=_0x3f1cf2-0x0;var _0x3533d4=_0xce3e[_0x3f1cf2];return _0x3533d4;};'use strict';var _=require(_0xece3('0x0'));var util=require(_0xece3('0x1'));var logger=require('../../config/logger')(_0xece3('0x2'));var moment=require('moment');var BPromise=require(_0xece3('0x3'));var rp=require(_0xece3('0x4'));var fs=require('fs');var path=require(_0xece3('0x5'));var rimraf=require(_0xece3('0x6'));var config=require(_0xece3('0x7'));var attributes=require(_0xece3('0x8'));module[_0xece3('0x9')]=function(_0x10a3fd,_0x3f69d8){return _0x10a3fd['define'](_0xece3('0xa'),attributes,{'tableName':_0xece3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7eab=['request-promise','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','lodash','util','../../config/logger','api','bluebird'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x7eab,0x13f));var _0xb7ea=function(_0x33c315,_0x1fb576){_0x33c315=_0x33c315-0x0;var _0x3bdbc6=_0x7eab[_0x33c315];return _0x3bdbc6;};'use strict';var _=require(_0xb7ea('0x0'));var util=require(_0xb7ea('0x1'));var logger=require(_0xb7ea('0x2'))(_0xb7ea('0x3'));var moment=require('moment');var BPromise=require(_0xb7ea('0x4'));var rp=require(_0xb7ea('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb7ea('0x6'));var config=require(_0xb7ea('0x7'));var attributes=require(_0xb7ea('0x8'));module[_0xb7ea('0x9')]=function(_0x1d902a,_0x51fd85){return _0x1d902a[_0xb7ea('0xa')](_0xb7ea('0xb'),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 a83f532..ad0faa2 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 _0x3b69=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x2c59f4,_0x56ea84){var _0x11a482=function(_0x3560c8){while(--_0x3560c8){_0x2c59f4['push'](_0x2c59f4['shift']());}};_0x11a482(++_0x56ea84);}(_0x3b69,0x94));var _0x93b6=function(_0x5f4cff,_0x3ca7d2){_0x5f4cff=_0x5f4cff-0x0;var _0x55d323=_0x3b69[_0x5f4cff];return _0x55d323;};'use strict';var _=require(_0x93b6('0x0'));var util=require('util');var moment=require(_0x93b6('0x1'));var BPromise=require(_0x93b6('0x2'));var rs=require(_0x93b6('0x3'));var fs=require('fs');var Redis=require(_0x93b6('0x4'));var db=require(_0x93b6('0x5'))['db'];var utils=require(_0x93b6('0x6'));var logger=require(_0x93b6('0x7'))(_0x93b6('0x8'));var config=require(_0x93b6('0x9'));var jayson=require(_0x93b6('0xa'));var client=jayson[_0x93b6('0xb')][_0x93b6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1a81a4,_0x260df1,_0x30c188){return new BPromise(function(_0x1368d1,_0x67e7df){return client['request'](_0x1a81a4,_0x30c188)[_0x93b6('0xd')](function(_0x482de3){logger[_0x93b6('0xe')](_0x93b6('0xf'),_0x260df1,_0x93b6('0x10'));logger[_0x93b6('0x11')](_0x93b6('0x12'),_0x260df1,'request\x20sent',JSON[_0x93b6('0x13')](_0x482de3));if(_0x482de3[_0x93b6('0x14')]){if(_0x482de3[_0x93b6('0x14')][_0x93b6('0x15')]===0x1f4){logger[_0x93b6('0x14')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x260df1,_0x482de3['error'][_0x93b6('0x16')]);return _0x67e7df(_0x482de3[_0x93b6('0x14')][_0x93b6('0x16')]);}logger[_0x93b6('0x14')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x260df1,_0x482de3[_0x93b6('0x14')][_0x93b6('0x16')]);return _0x1368d1(_0x482de3[_0x93b6('0x14')][_0x93b6('0x16')]);}else{logger['info'](_0x93b6('0xf'),_0x260df1,'request\x20sent');_0x1368d1(_0x482de3[_0x93b6('0x17')][_0x93b6('0x16')]);}})[_0x93b6('0x18')](function(_0x5f78a2){logger['error'](_0x93b6('0xf'),_0x260df1,_0x5f78a2);_0x67e7df(_0x5f78a2);});});} \ No newline at end of file +var _0xce51=['then','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xce51,0x172));var _0x1ce5=function(_0x5dc03e,_0x54e60c){_0x5dc03e=_0x5dc03e-0x0;var _0x466a07=_0xce51[_0x5dc03e];return _0x466a07;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1ce5('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ce5('0x1'));var db=require(_0x1ce5('0x2'))['db'];var utils=require(_0x1ce5('0x3'));var logger=require(_0x1ce5('0x4'))(_0x1ce5('0x5'));var config=require(_0x1ce5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1ce5('0x7')][_0x1ce5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x538e65,_0x12375b,_0x914eaa){return new BPromise(function(_0x49e44a,_0xc9f8d7){return client[_0x1ce5('0x9')](_0x538e65,_0x914eaa)[_0x1ce5('0xa')](function(_0x50d8b2){logger['info'](_0x1ce5('0xb'),_0x12375b,'request\x20sent');logger[_0x1ce5('0xc')](_0x1ce5('0xd'),_0x12375b,'request\x20sent',JSON[_0x1ce5('0xe')](_0x50d8b2));if(_0x50d8b2[_0x1ce5('0xf')]){if(_0x50d8b2[_0x1ce5('0xf')][_0x1ce5('0x10')]===0x1f4){logger[_0x1ce5('0xf')](_0x1ce5('0xb'),_0x12375b,_0x50d8b2['error']['message']);return _0xc9f8d7(_0x50d8b2[_0x1ce5('0xf')][_0x1ce5('0x11')]);}logger[_0x1ce5('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x12375b,_0x50d8b2[_0x1ce5('0xf')][_0x1ce5('0x11')]);return _0x49e44a(_0x50d8b2[_0x1ce5('0xf')]['message']);}else{logger[_0x1ce5('0x12')](_0x1ce5('0xb'),_0x12375b,_0x1ce5('0x13'));_0x49e44a(_0x50d8b2['result'][_0x1ce5('0x11')]);}})['catch'](function(_0x34d2c4){logger[_0x1ce5('0xf')](_0x1ce5('0xb'),_0x12375b,_0x34d2c4);_0xc9f8d7(_0x34d2c4);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 9c6b013..1c7344d 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 _0x8fbd=['show','/:id/preview','preview','get','/:id/run','run','/:id/query','query','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','index','isAuthenticated'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x8fbd,0x13b));var _0xd8fb=function(_0x47cbab,_0x27590e){_0x47cbab=_0x47cbab-0x0;var _0x1c7f79=_0x8fbd[_0x47cbab];return _0x1c7f79;};'use strict';var multer=require('multer');var util=require(_0xd8fb('0x0'));var path=require(_0xd8fb('0x1'));var timeout=require(_0xd8fb('0x2'));var express=require(_0xd8fb('0x3'));var router=express[_0xd8fb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd8fb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd8fb('0x6'));var controller=require(_0xd8fb('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xd8fb('0x8')]);router['get']('/:id',auth[_0xd8fb('0x9')](),controller[_0xd8fb('0xa')]);router['get'](_0xd8fb('0xb'),auth[_0xd8fb('0x9')](),controller[_0xd8fb('0xc')]);router[_0xd8fb('0xd')](_0xd8fb('0xe'),auth['isAuthenticated'](),controller[_0xd8fb('0xf')]);router['get'](_0xd8fb('0x10'),auth['isAuthenticated'](),controller[_0xd8fb('0x11')]);router['post']('/',auth[_0xd8fb('0x9')](),controller[_0xd8fb('0x12')]);router[_0xd8fb('0x13')](_0xd8fb('0x14'),auth[_0xd8fb('0x9')](),controller[_0xd8fb('0x15')]);router[_0xd8fb('0x16')](_0xd8fb('0x14'),auth['isAuthenticated'](),controller[_0xd8fb('0x17')]);module[_0xd8fb('0x18')]=router; \ No newline at end of file +var _0x91c5=['get','isAuthenticated','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','/:id','update','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','index'];(function(_0x267900,_0x117fa7){var _0x2f95df=function(_0xac178c){while(--_0xac178c){_0x267900['push'](_0x267900['shift']());}};_0x2f95df(++_0x117fa7);}(_0x91c5,0x1c1));var _0x591c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x91c5[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x591c('0x0'));var express=require(_0x591c('0x1'));var router=express[_0x591c('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x591c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x591c('0x4'));var controller=require(_0x591c('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x591c('0x6')]);router[_0x591c('0x7')]('/:id',auth[_0x591c('0x8')](),controller[_0x591c('0x9')]);router[_0x591c('0x7')](_0x591c('0xa'),auth[_0x591c('0x8')](),controller[_0x591c('0xb')]);router[_0x591c('0x7')](_0x591c('0xc'),auth['isAuthenticated'](),controller[_0x591c('0xd')]);router[_0x591c('0x7')](_0x591c('0xe'),auth['isAuthenticated'](),controller[_0x591c('0xf')]);router[_0x591c('0x10')]('/',auth[_0x591c('0x8')](),controller[_0x591c('0x11')]);router[_0x591c('0x12')](_0x591c('0x13'),auth['isAuthenticated'](),controller[_0x591c('0x14')]);router[_0x591c('0x15')](_0x591c('0x13'),auth[_0x591c('0x8')](),controller[_0x591c('0x16')]);module[_0x591c('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 ebfba58..66d5209 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 _0x126b=['DATE','manual','UNSIGNED','moment','exports','STRING','ENUM','csv','pdf','xlsx'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x126b,0x14d));var _0xb126=function(_0x20b997,_0x3bf796){_0x20b997=_0x20b997-0x0;var _0x5772d1=_0x126b[_0x20b997];return _0x5772d1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb126('0x0'));module[_0xb126('0x1')]={'name':{'type':Sequelize[_0xb126('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xb126('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xb126('0x3')](_0xb126('0x4'),_0xb126('0x5'),_0xb126('0x6')),'allowNull':![],'defaultValue':_0xb126('0x4')},'savename':{'type':Sequelize[_0xb126('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xb126('0x7')]},'endDate':{'type':Sequelize[_0xb126('0x7')]},'status':{'type':Sequelize[_0xb126('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xb126('0x3')](_0xb126('0x8'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xb126('0x9')]},'reportType':{'type':Sequelize[_0xb126('0x2')]}}; \ No newline at end of file +var _0xe8eb=['pdf','xlsx','DATE','ENUM','manual','scheduled','UNSIGNED','sequelize','moment','exports','STRING','csv'];(function(_0x374521,_0x4703fb){var _0x2120b9=function(_0x3f57b0){while(--_0x3f57b0){_0x374521['push'](_0x374521['shift']());}};_0x2120b9(++_0x4703fb);}(_0xe8eb,0x8b));var _0xbe8e=function(_0x5e9491,_0x129e18){_0x5e9491=_0x5e9491-0x0;var _0x2f6d97=_0xe8eb[_0x5e9491];return _0x2f6d97;};'use strict';var Sequelize=require(_0xbe8e('0x0'));var moment=require(_0xbe8e('0x1'));module[_0xbe8e('0x2')]={'name':{'type':Sequelize[_0xbe8e('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xbe8e('0x4'),_0xbe8e('0x5'),_0xbe8e('0x6')),'allowNull':![],'defaultValue':_0xbe8e('0x4')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xbe8e('0x7')]},'status':{'type':Sequelize[_0xbe8e('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xbe8e('0x8')](_0xbe8e('0x9'),_0xbe8e('0xa')),'allowNull':![],'defaultValue':_0xbe8e('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xbe8e('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 8ce1bcf..7fa4d2b 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 _0x163b=['download','savename','output','join','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','toLowerCase','eml-format','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','then','get','ExtractedReports','destroy','error','send','index','map','AnalyticExtractedReport','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','findAll','show','params','rawAttributes','include','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x163b,0xc3));var _0xb163=function(_0x40d995,_0x32d2ea){_0x40d995=_0x40d995-0x0;var _0x5bff95=_0x163b[_0x40d995];return _0x5bff95;};'use strict';var emlformat=require(_0xb163('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb163('0x1'));var rp=require(_0xb163('0x2'));var moment=require(_0xb163('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb163('0x4'));var path=require(_0xb163('0x5'));var sox=require(_0xb163('0x6'));var csv=require(_0xb163('0x7'));var ejs=require(_0xb163('0x8'));var fs=require('fs');var fs_extra=require(_0xb163('0x9'));var _=require(_0xb163('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb163('0xb'));var deskjs=require(_0xb163('0xc'));var toCsv=require(_0xb163('0x7'));var querystring=require(_0xb163('0xd'));var Papa=require(_0xb163('0xe'));var Redis=require(_0xb163('0xf'));var authService=require(_0xb163('0x10'));var qs=require(_0xb163('0x11'));var as=require(_0xb163('0x12'));var hardwareService=require(_0xb163('0x13'));var logger=require(_0xb163('0x14'))(_0xb163('0x15'));var utils=require(_0xb163('0x16'));var config=require(_0xb163('0x17'));var licenseUtil=require(_0xb163('0x18'));var db=require(_0xb163('0x19'))['db'];function respondWithStatusCode(_0x4e1637,_0x4a25a7){_0x4a25a7=_0x4a25a7||0xcc;return function(_0x5a91e5){if(_0x5a91e5){return _0x4e1637[_0xb163('0x1a')](_0x4a25a7);}return _0x4e1637[_0xb163('0x1b')](_0x4a25a7)[_0xb163('0x1c')]();};}function respondWithResult(_0x46af40,_0x1b3e3f){_0x1b3e3f=_0x1b3e3f||0xc8;return function(_0x354566){if(_0x354566){return _0x46af40['status'](_0x1b3e3f)['json'](_0x354566);}};}function respondWithFilteredResult(_0x1f6e91,_0x25aa3d){return function(_0x46b062){if(_0x46b062){var _0x1a487f=typeof _0x25aa3d['offset']===_0xb163('0x1d')&&typeof _0x25aa3d[_0xb163('0x1e')]===_0xb163('0x1d');var _0x156424=_0x46b062[_0xb163('0x1f')];var _0x3be265=_0x1a487f?0x0:_0x25aa3d[_0xb163('0x20')];var _0x54dc8b=_0x1a487f?_0x46b062['count']:_0x25aa3d[_0xb163('0x20')]+_0x25aa3d[_0xb163('0x1e')];var _0x48de28;if(_0x54dc8b>=_0x156424){_0x54dc8b=_0x156424;_0x48de28=0xc8;}else{_0x48de28=0xce;}_0x1f6e91[_0xb163('0x1b')](_0x48de28);return _0x1f6e91['set'](_0xb163('0x21'),_0x3be265+'-'+_0x54dc8b+'/'+_0x156424)[_0xb163('0x22')](_0x46b062);}return null;};}function patchUpdates(_0x3503c6){return function(_0xea413f){try{jsonpatch['apply'](_0xea413f,_0x3503c6,!![]);}catch(_0x473b47){return BPromise[_0xb163('0x23')](_0x473b47);}return _0xea413f[_0xb163('0x24')]();};}function saveUpdates(_0x2d3572,_0x10f179){return function(_0x3ce51a){if(_0x3ce51a){return _0x3ce51a['update'](_0x2d3572)[_0xb163('0x25')](function(_0x15462d){return _0x15462d;});}return null;};}function removeEntity(_0x5148d9,_0x847112){return function(_0x5e505d){if(_0x5e505d){return _0x5e505d['destroy']()['then'](function(){var _0x3f4e55=_0x5e505d[_0xb163('0x26')]({'plain':!![]});var _0x59464a=_0xb163('0x27');return db['UserProfileResource'][_0xb163('0x28')]({'where':{'type':_0x59464a,'resourceId':_0x3f4e55['id']}})[_0xb163('0x25')](function(){return _0x5e505d;});})[_0xb163('0x25')](function(){_0x5148d9[_0xb163('0x1b')](0xcc)[_0xb163('0x1c')]();});}};}function handleEntityNotFound(_0x17a88c,_0x466f6d){return function(_0x220bb2){if(!_0x220bb2){_0x17a88c[_0xb163('0x1a')](0x194);}return _0x220bb2;};}function handleError(_0x40a96f,_0x37c63f){_0x37c63f=_0x37c63f||0x1f4;return function(_0x1d552f){logger[_0xb163('0x29')](_0x1d552f['stack']);if(_0x1d552f['name']){delete _0x1d552f['name'];}_0x40a96f[_0xb163('0x1b')](_0x37c63f)[_0xb163('0x2a')](_0x1d552f);};}exports[_0xb163('0x2b')]=function(_0x17bfe,_0x3eb442){var _0x1fc517={},_0x545768={},_0x147d3c={'count':0x0,'rows':[]};var _0x4c1a40=_[_0xb163('0x2c')](db[_0xb163('0x2d')]['rawAttributes'],function(_0x1fcaad){return{'name':_0x1fcaad['fieldName'],'type':_0x1fcaad[_0xb163('0x2e')][_0xb163('0x2f')]};});_0x545768[_0xb163('0x30')]=_['map'](_0x4c1a40,_0xb163('0x31'));_0x545768[_0xb163('0x32')]=_[_0xb163('0x33')](_0x17bfe[_0xb163('0x32')]);_0x545768[_0xb163('0x34')]=_[_0xb163('0x35')](_0x545768[_0xb163('0x30')],_0x545768[_0xb163('0x32')]);_0x1fc517[_0xb163('0x36')]=_[_0xb163('0x35')](_0x545768[_0xb163('0x30')],qs[_0xb163('0x37')](_0x17bfe['query'][_0xb163('0x37')]));_0x1fc517[_0xb163('0x36')]=_0x1fc517[_0xb163('0x36')][_0xb163('0x38')]?_0x1fc517[_0xb163('0x36')]:_0x545768[_0xb163('0x30')];if(!_0x17bfe[_0xb163('0x32')][_0xb163('0x39')]('nolimit')){_0x1fc517[_0xb163('0x1e')]=qs[_0xb163('0x1e')](_0x17bfe['query']['limit']);_0x1fc517[_0xb163('0x20')]=qs[_0xb163('0x20')](_0x17bfe[_0xb163('0x32')][_0xb163('0x20')]);}_0x1fc517[_0xb163('0x3a')]=qs[_0xb163('0x3b')](_0x17bfe[_0xb163('0x32')]['sort']);_0x1fc517[_0xb163('0x3c')]=qs[_0xb163('0x34')](_['pick'](_0x17bfe[_0xb163('0x32')],_0x545768[_0xb163('0x34')]),_0x4c1a40);if(_0x17bfe[_0xb163('0x32')][_0xb163('0x3d')]){_0x1fc517['where']=_['merge'](_0x1fc517[_0xb163('0x3c')],{'$or':_['map'](_0x4c1a40,function(_0x9fbe00){if(_0x9fbe00[_0xb163('0x2e')]!==_0xb163('0x3e')){var _0xacc259={};_0xacc259[_0x9fbe00['name']]={'$like':'%'+_0x17bfe[_0xb163('0x32')][_0xb163('0x3d')]+'%'};return _0xacc259;}})});}_0x1fc517=_[_0xb163('0x3f')]({},_0x1fc517,_0x17bfe['options']);var _0x57b861={'where':_0x1fc517[_0xb163('0x3c')]};return db[_0xb163('0x2d')][_0xb163('0x1f')](_0x57b861)[_0xb163('0x25')](function(_0x5dea70){_0x147d3c[_0xb163('0x1f')]=_0x5dea70;if(_0x17bfe[_0xb163('0x32')][_0xb163('0x40')]){_0x1fc517['include']=[{'all':!![]}];}return db[_0xb163('0x2d')][_0xb163('0x41')](_0x1fc517);})[_0xb163('0x25')](function(_0x1e3301){_0x147d3c['rows']=_0x1e3301;return _0x147d3c;})[_0xb163('0x25')](respondWithFilteredResult(_0x3eb442,_0x1fc517))['catch'](handleError(_0x3eb442,null));};exports[_0xb163('0x42')]=function(_0x1409c0,_0x389604){var _0x464234={'raw':!![],'where':{'id':_0x1409c0[_0xb163('0x43')]['id']}},_0x2f2552={};_0x2f2552[_0xb163('0x30')]=_[_0xb163('0x33')](db[_0xb163('0x2d')][_0xb163('0x44')]);_0x2f2552['query']=_[_0xb163('0x33')](_0x1409c0[_0xb163('0x32')]);_0x2f2552[_0xb163('0x34')]=_['intersection'](_0x2f2552['model'],_0x2f2552['query']);_0x464234['attributes']=_[_0xb163('0x35')](_0x2f2552[_0xb163('0x30')],qs[_0xb163('0x37')](_0x1409c0[_0xb163('0x32')][_0xb163('0x37')]));_0x464234[_0xb163('0x36')]=_0x464234[_0xb163('0x36')][_0xb163('0x38')]?_0x464234[_0xb163('0x36')]:_0x2f2552[_0xb163('0x30')];if(_0x1409c0['query'][_0xb163('0x40')]){_0x464234[_0xb163('0x45')]=[{'all':!![]}];}_0x464234=_['merge']({},_0x464234,_0x1409c0['options']);return db['AnalyticExtractedReport'][_0xb163('0x46')](_0x464234)[_0xb163('0x25')](handleEntityNotFound(_0x389604,null))[_0xb163('0x25')](respondWithResult(_0x389604,null))[_0xb163('0x47')](handleError(_0x389604,null));};exports[_0xb163('0x48')]=function(_0x33a20c,_0x186ee1){return db[_0xb163('0x2d')]['create'](_0x33a20c['body'],{})[_0xb163('0x25')](function(_0x44a7da){var _0x2288ea=_0x33a20c[_0xb163('0x49')][_0xb163('0x26')]({'plain':!![]});if(!_0x2288ea)throw new Error(_0xb163('0x4a'));if(_0x2288ea['role']==='user'){var _0x11209e=_0x44a7da['get']({'plain':!![]});var _0x964727=_0xb163('0x27');return db['UserProfileSection'][_0xb163('0x46')]({'where':{'name':_0x964727,'userProfileId':_0x2288ea[_0xb163('0x4b')]},'raw':!![]})['then'](function(_0x94d7e2){if(_0x94d7e2&&_0x94d7e2[_0xb163('0x4c')]===0x0){return db[_0xb163('0x4d')][_0xb163('0x48')]({'name':_0x11209e[_0xb163('0x31')],'resourceId':_0x11209e['id'],'type':_0x94d7e2['name'],'sectionId':_0x94d7e2['id']},{})['then'](function(){return _0x44a7da;});}else{return _0x44a7da;}})['catch'](function(_0x42cdb8){logger[_0xb163('0x29')](_0xb163('0x4e'),_0x42cdb8);throw _0x42cdb8;});}return _0x44a7da;})['then'](respondWithResult(_0x186ee1,0xc9))[_0xb163('0x47')](handleError(_0x186ee1,null));};exports[_0xb163('0x4f')]=function(_0x52750b,_0x23779e){if(_0x52750b[_0xb163('0x50')]['id']){delete _0x52750b[_0xb163('0x50')]['id'];}return db[_0xb163('0x2d')][_0xb163('0x46')]({'where':{'id':_0x52750b[_0xb163('0x43')]['id']}})['then'](handleEntityNotFound(_0x23779e,null))[_0xb163('0x25')](saveUpdates(_0x52750b[_0xb163('0x50')],null))[_0xb163('0x25')](respondWithResult(_0x23779e,null))[_0xb163('0x47')](handleError(_0x23779e,null));};exports['destroy']=function(_0x17e821,_0x45ca23){return db['AnalyticExtractedReport'][_0xb163('0x46')]({'where':{'id':_0x17e821['params']['id']}})[_0xb163('0x25')](handleEntityNotFound(_0x45ca23,null))[_0xb163('0x25')](removeEntity(_0x45ca23,null))[_0xb163('0x47')](handleError(_0x45ca23,null));};exports[_0xb163('0x51')]=function(_0x4526f3,_0x530f69,_0x223660){return db[_0xb163('0x2d')][_0xb163('0x46')]({'where':{'id':_0x4526f3['params']['id']},'attributes':[_0xb163('0x31'),'basename',_0xb163('0x52'),_0xb163('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x530f69,null))['then'](function(_0x3fc51d){if(_0x3fc51d){if(!fs['existsSync'](path[_0xb163('0x54')](config[_0xb163('0x55')],_0xb163('0x56'),_0x3fc51d[_0xb163('0x52')]))){throw new db[(_0xb163('0x57'))]['ValidationError'](_0xb163('0x58'));}if(_0x4526f3[_0xb163('0x32')][_0xb163('0x59')]){return _0x530f69[_0xb163('0x1a')](0xc8);}return _0x530f69[_0xb163('0x51')](path[_0xb163('0x54')](config[_0xb163('0x55')],_0xb163('0x56'),_0x3fc51d['savename']),util['format'](_0xb163('0x5a'),_0x3fc51d['basename']||_0x3fc51d[_0xb163('0x31')],_0x3fc51d[_0xb163('0x53')][_0xb163('0x5b')]()));}})['catch'](handleError(_0x530f69,null));}; \ No newline at end of file +var _0x36d5=['find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','basename','output','existsSync','root','server/files/reports','savename','Sequelize','ValidationError','download','join','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','reject','save','then','destroy','get','ExtractedReports','error','stack','name','send','index','map','AnalyticExtractedReport','type','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x36d5,0x187));var _0x536d=function(_0x297dcf,_0x448cf5){_0x297dcf=_0x297dcf-0x0;var _0xe1699b=_0x36d5[_0x297dcf];return _0xe1699b;};'use strict';var emlformat=require(_0x536d('0x0'));var rimraf=require(_0x536d('0x1'));var zipdir=require(_0x536d('0x2'));var jsonpatch=require(_0x536d('0x3'));var rp=require('request-promise');var moment=require(_0x536d('0x4'));var BPromise=require(_0x536d('0x5'));var Mustache=require(_0x536d('0x6'));var util=require(_0x536d('0x7'));var path=require(_0x536d('0x8'));var sox=require(_0x536d('0x9'));var csv=require(_0x536d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x536d('0xb'));var _=require(_0x536d('0xc'));var squel=require(_0x536d('0xd'));var crypto=require(_0x536d('0xe'));var jsforce=require(_0x536d('0xf'));var deskjs=require(_0x536d('0x10'));var toCsv=require('to-csv');var querystring=require(_0x536d('0x11'));var Papa=require('papaparse');var Redis=require(_0x536d('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x536d('0x13'));var hardwareService=require(_0x536d('0x14'));var logger=require(_0x536d('0x15'))(_0x536d('0x16'));var utils=require(_0x536d('0x17'));var config=require(_0x536d('0x18'));var licenseUtil=require(_0x536d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x252b8f,_0x50c62e){_0x50c62e=_0x50c62e||0xcc;return function(_0x3a4bef){if(_0x3a4bef){return _0x252b8f[_0x536d('0x1a')](_0x50c62e);}return _0x252b8f[_0x536d('0x1b')](_0x50c62e)['end']();};}function respondWithResult(_0x3d6b57,_0x138c60){_0x138c60=_0x138c60||0xc8;return function(_0x19df46){if(_0x19df46){return _0x3d6b57['status'](_0x138c60)[_0x536d('0x1c')](_0x19df46);}};}function respondWithFilteredResult(_0x253c8d,_0x48657d){return function(_0x5e2dad){if(_0x5e2dad){var _0x5df25c=typeof _0x48657d['offset']==='undefined'&&typeof _0x48657d['limit']==='undefined';var _0x2d8f57=_0x5e2dad[_0x536d('0x1d')];var _0xa45dde=_0x5df25c?0x0:_0x48657d[_0x536d('0x1e')];var _0x1d5620=_0x5df25c?_0x5e2dad[_0x536d('0x1d')]:_0x48657d[_0x536d('0x1e')]+_0x48657d[_0x536d('0x1f')];var _0x2302f7;if(_0x1d5620>=_0x2d8f57){_0x1d5620=_0x2d8f57;_0x2302f7=0xc8;}else{_0x2302f7=0xce;}_0x253c8d[_0x536d('0x1b')](_0x2302f7);return _0x253c8d[_0x536d('0x20')]('Content-Range',_0xa45dde+'-'+_0x1d5620+'/'+_0x2d8f57)[_0x536d('0x1c')](_0x5e2dad);}return null;};}function patchUpdates(_0x6c0317){return function(_0x1bd090){try{jsonpatch['apply'](_0x1bd090,_0x6c0317,!![]);}catch(_0x330465){return BPromise[_0x536d('0x21')](_0x330465);}return _0x1bd090[_0x536d('0x22')]();};}function saveUpdates(_0x115fab,_0x33570b){return function(_0x477a50){if(_0x477a50){return _0x477a50['update'](_0x115fab)[_0x536d('0x23')](function(_0x191490){return _0x191490;});}return null;};}function removeEntity(_0x32a859,_0x713a60){return function(_0x4a9b32){if(_0x4a9b32){return _0x4a9b32[_0x536d('0x24')]()[_0x536d('0x23')](function(){var _0x1241b0=_0x4a9b32[_0x536d('0x25')]({'plain':!![]});var _0x447d7d=_0x536d('0x26');return db['UserProfileResource'][_0x536d('0x24')]({'where':{'type':_0x447d7d,'resourceId':_0x1241b0['id']}})[_0x536d('0x23')](function(){return _0x4a9b32;});})[_0x536d('0x23')](function(){_0x32a859[_0x536d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x689dc2,_0x3ae27d){return function(_0x1ddebc){if(!_0x1ddebc){_0x689dc2['sendStatus'](0x194);}return _0x1ddebc;};}function handleError(_0x22df44,_0x139e97){_0x139e97=_0x139e97||0x1f4;return function(_0x5575ec){logger[_0x536d('0x27')](_0x5575ec[_0x536d('0x28')]);if(_0x5575ec[_0x536d('0x29')]){delete _0x5575ec[_0x536d('0x29')];}_0x22df44[_0x536d('0x1b')](_0x139e97)[_0x536d('0x2a')](_0x5575ec);};}exports[_0x536d('0x2b')]=function(_0x252079,_0x14c3b6){var _0x5877c4={},_0x1c7b1d={},_0x255bf0={'count':0x0,'rows':[]};var _0x39ad94=_[_0x536d('0x2c')](db[_0x536d('0x2d')]['rawAttributes'],function(_0x22c132){return{'name':_0x22c132['fieldName'],'type':_0x22c132[_0x536d('0x2e')]['key']};});_0x1c7b1d[_0x536d('0x2f')]=_['map'](_0x39ad94,_0x536d('0x29'));_0x1c7b1d[_0x536d('0x30')]=_[_0x536d('0x31')](_0x252079[_0x536d('0x30')]);_0x1c7b1d[_0x536d('0x32')]=_['intersection'](_0x1c7b1d['model'],_0x1c7b1d[_0x536d('0x30')]);_0x5877c4[_0x536d('0x33')]=_[_0x536d('0x34')](_0x1c7b1d[_0x536d('0x2f')],qs[_0x536d('0x35')](_0x252079[_0x536d('0x30')][_0x536d('0x35')]));_0x5877c4['attributes']=_0x5877c4[_0x536d('0x33')][_0x536d('0x36')]?_0x5877c4[_0x536d('0x33')]:_0x1c7b1d[_0x536d('0x2f')];if(!_0x252079[_0x536d('0x30')]['hasOwnProperty']('nolimit')){_0x5877c4['limit']=qs[_0x536d('0x1f')](_0x252079[_0x536d('0x30')][_0x536d('0x1f')]);_0x5877c4['offset']=qs[_0x536d('0x1e')](_0x252079['query']['offset']);}_0x5877c4[_0x536d('0x37')]=qs[_0x536d('0x38')](_0x252079[_0x536d('0x30')][_0x536d('0x38')]);_0x5877c4[_0x536d('0x39')]=qs[_0x536d('0x32')](_[_0x536d('0x3a')](_0x252079[_0x536d('0x30')],_0x1c7b1d[_0x536d('0x32')]),_0x39ad94);if(_0x252079[_0x536d('0x30')][_0x536d('0x3b')]){_0x5877c4[_0x536d('0x39')]=_[_0x536d('0x3c')](_0x5877c4[_0x536d('0x39')],{'$or':_[_0x536d('0x2c')](_0x39ad94,function(_0x1f255){if(_0x1f255[_0x536d('0x2e')]!==_0x536d('0x3d')){var _0x47e866={};_0x47e866[_0x1f255[_0x536d('0x29')]]={'$like':'%'+_0x252079[_0x536d('0x30')][_0x536d('0x3b')]+'%'};return _0x47e866;}})});}_0x5877c4=_[_0x536d('0x3c')]({},_0x5877c4,_0x252079[_0x536d('0x3e')]);var _0x1177c5={'where':_0x5877c4[_0x536d('0x39')]};return db[_0x536d('0x2d')][_0x536d('0x1d')](_0x1177c5)[_0x536d('0x23')](function(_0x529f71){_0x255bf0[_0x536d('0x1d')]=_0x529f71;if(_0x252079[_0x536d('0x30')][_0x536d('0x3f')]){_0x5877c4[_0x536d('0x40')]=[{'all':!![]}];}return db[_0x536d('0x2d')][_0x536d('0x41')](_0x5877c4);})[_0x536d('0x23')](function(_0x554ee6){_0x255bf0['rows']=_0x554ee6;return _0x255bf0;})[_0x536d('0x23')](respondWithFilteredResult(_0x14c3b6,_0x5877c4))[_0x536d('0x42')](handleError(_0x14c3b6,null));};exports[_0x536d('0x43')]=function(_0x277a78,_0x4d920b){var _0x2db727={'raw':!![],'where':{'id':_0x277a78[_0x536d('0x44')]['id']}},_0x37a47f={};_0x37a47f['model']=_[_0x536d('0x31')](db[_0x536d('0x2d')]['rawAttributes']);_0x37a47f[_0x536d('0x30')]=_[_0x536d('0x31')](_0x277a78[_0x536d('0x30')]);_0x37a47f[_0x536d('0x32')]=_[_0x536d('0x34')](_0x37a47f['model'],_0x37a47f['query']);_0x2db727[_0x536d('0x33')]=_[_0x536d('0x34')](_0x37a47f[_0x536d('0x2f')],qs[_0x536d('0x35')](_0x277a78[_0x536d('0x30')][_0x536d('0x35')]));_0x2db727[_0x536d('0x33')]=_0x2db727[_0x536d('0x33')][_0x536d('0x36')]?_0x2db727[_0x536d('0x33')]:_0x37a47f[_0x536d('0x2f')];if(_0x277a78[_0x536d('0x30')][_0x536d('0x3f')]){_0x2db727[_0x536d('0x40')]=[{'all':!![]}];}_0x2db727=_[_0x536d('0x3c')]({},_0x2db727,_0x277a78['options']);return db['AnalyticExtractedReport'][_0x536d('0x45')](_0x2db727)[_0x536d('0x23')](handleEntityNotFound(_0x4d920b,null))[_0x536d('0x23')](respondWithResult(_0x4d920b,null))[_0x536d('0x42')](handleError(_0x4d920b,null));};exports[_0x536d('0x46')]=function(_0x5579f4,_0x38535c){return db[_0x536d('0x2d')]['create'](_0x5579f4[_0x536d('0x47')],{})[_0x536d('0x23')](function(_0x54ab7d){var _0x3ee93d=_0x5579f4['user'][_0x536d('0x25')]({'plain':!![]});if(!_0x3ee93d)throw new Error(_0x536d('0x48'));if(_0x3ee93d[_0x536d('0x49')]===_0x536d('0x4a')){var _0x481961=_0x54ab7d[_0x536d('0x25')]({'plain':!![]});var _0x2567d3=_0x536d('0x26');return db['UserProfileSection'][_0x536d('0x45')]({'where':{'name':_0x2567d3,'userProfileId':_0x3ee93d[_0x536d('0x4b')]},'raw':!![]})[_0x536d('0x23')](function(_0x2daae1){if(_0x2daae1&&_0x2daae1[_0x536d('0x4c')]===0x0){return db['UserProfileResource'][_0x536d('0x46')]({'name':_0x481961[_0x536d('0x29')],'resourceId':_0x481961['id'],'type':_0x2daae1[_0x536d('0x29')],'sectionId':_0x2daae1['id']},{})[_0x536d('0x23')](function(){return _0x54ab7d;});}else{return _0x54ab7d;}})['catch'](function(_0x2dc587){logger['error'](_0x536d('0x4d'),_0x2dc587);throw _0x2dc587;});}return _0x54ab7d;})['then'](respondWithResult(_0x38535c,0xc9))[_0x536d('0x42')](handleError(_0x38535c,null));};exports[_0x536d('0x4e')]=function(_0x508abd,_0x3a476d){if(_0x508abd['body']['id']){delete _0x508abd[_0x536d('0x47')]['id'];}return db['AnalyticExtractedReport'][_0x536d('0x45')]({'where':{'id':_0x508abd[_0x536d('0x44')]['id']}})[_0x536d('0x23')](handleEntityNotFound(_0x3a476d,null))[_0x536d('0x23')](saveUpdates(_0x508abd[_0x536d('0x47')],null))['then'](respondWithResult(_0x3a476d,null))[_0x536d('0x42')](handleError(_0x3a476d,null));};exports[_0x536d('0x24')]=function(_0x404064,_0x5b2048){return db[_0x536d('0x2d')][_0x536d('0x45')]({'where':{'id':_0x404064[_0x536d('0x44')]['id']}})[_0x536d('0x23')](handleEntityNotFound(_0x5b2048,null))[_0x536d('0x23')](removeEntity(_0x5b2048,null))['catch'](handleError(_0x5b2048,null));};exports['download']=function(_0x41ad04,_0x1a33ac,_0x3a7c0d){return db[_0x536d('0x2d')][_0x536d('0x45')]({'where':{'id':_0x41ad04['params']['id']},'attributes':[_0x536d('0x29'),_0x536d('0x4f'),'savename',_0x536d('0x50')],'raw':!![]})[_0x536d('0x23')](handleEntityNotFound(_0x1a33ac,null))[_0x536d('0x23')](function(_0x446bb6){if(_0x446bb6){if(!fs[_0x536d('0x51')](path['join'](config[_0x536d('0x52')],_0x536d('0x53'),_0x446bb6[_0x536d('0x54')]))){throw new db[(_0x536d('0x55'))][(_0x536d('0x56'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x41ad04[_0x536d('0x30')]['exists']){return _0x1a33ac[_0x536d('0x1a')](0xc8);}return _0x1a33ac[_0x536d('0x57')](path[_0x536d('0x58')](config[_0x536d('0x52')],'server/files/reports',_0x446bb6[_0x536d('0x54')]),util[_0x536d('0x59')](_0x536d('0x5a'),_0x446bb6[_0x536d('0x4f')]||_0x446bb6[_0x536d('0x29')],_0x446bb6['output'][_0x536d('0x5b')]()));}})[_0x536d('0x42')](handleError(_0x1a33ac,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 00cb0ce..567917c 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 _0x8279=['request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment'];(function(_0x4bd882,_0x350341){var _0x2f0513=function(_0x1da504){while(--_0x1da504){_0x4bd882['push'](_0x4bd882['shift']());}};_0x2f0513(++_0x350341);}(_0x8279,0x1a8));var _0x9827=function(_0x3e7851,_0x1ae1c1){_0x3e7851=_0x3e7851-0x0;var _0x2266bf=_0x8279[_0x3e7851];return _0x2266bf;};'use strict';var _=require(_0x9827('0x0'));var util=require(_0x9827('0x1'));var logger=require(_0x9827('0x2'))(_0x9827('0x3'));var moment=require(_0x9827('0x4'));var BPromise=require('bluebird');var rp=require(_0x9827('0x5'));var fs=require('fs');var path=require(_0x9827('0x6'));var rimraf=require(_0x9827('0x7'));var config=require(_0x9827('0x8'));var attributes=require(_0x9827('0x9'));module[_0x9827('0xa')]=function(_0x387267,_0x1e4df8){return _0x387267['define'](_0x9827('0xb'),attributes,{'tableName':_0x9827('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f21=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','lodash'];(function(_0x35e327,_0x3cda24){var _0x4f2310=function(_0x2cf292){while(--_0x2cf292){_0x35e327['push'](_0x35e327['shift']());}};_0x4f2310(++_0x3cda24);}(_0x6f21,0xfb));var _0x16f2=function(_0x4faabc,_0x349a1e){_0x4faabc=_0x4faabc-0x0;var _0x42fc45=_0x6f21[_0x4faabc];return _0x42fc45;};'use strict';var _=require(_0x16f2('0x0'));var util=require(_0x16f2('0x1'));var logger=require(_0x16f2('0x2'))(_0x16f2('0x3'));var moment=require(_0x16f2('0x4'));var BPromise=require(_0x16f2('0x5'));var rp=require(_0x16f2('0x6'));var fs=require('fs');var path=require(_0x16f2('0x7'));var rimraf=require(_0x16f2('0x8'));var config=require(_0x16f2('0x9'));var attributes=require(_0x16f2('0xa'));module[_0x16f2('0xb')]=function(_0x193481,_0x120653){return _0x193481[_0x16f2('0xc')](_0x16f2('0xd'),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 f919075..0cb52ef 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 _0x4bf4=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring'];(function(_0x539a0a,_0x379a9e){var _0x181e7c=function(_0x33e594){while(--_0x33e594){_0x539a0a['push'](_0x539a0a['shift']());}};_0x181e7c(++_0x379a9e);}(_0x4bf4,0x187));var _0x44bf=function(_0x504108,_0x51ae00){_0x504108=_0x504108-0x0;var _0x1b779d=_0x4bf4[_0x504108];return _0x1b779d;};'use strict';var _=require(_0x44bf('0x0'));var util=require(_0x44bf('0x1'));var moment=require(_0x44bf('0x2'));var BPromise=require(_0x44bf('0x3'));var rs=require(_0x44bf('0x4'));var fs=require('fs');var Redis=require(_0x44bf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x44bf('0x6'));var logger=require(_0x44bf('0x7'))(_0x44bf('0x8'));var config=require('../../config/environment');var jayson=require(_0x44bf('0x9'));var client=jayson[_0x44bf('0xa')][_0x44bf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x294b60,_0x5c91cf,_0x517306){return new BPromise(function(_0x243241,_0x41598e){return client[_0x44bf('0xc')](_0x294b60,_0x517306)['then'](function(_0x440fa3){logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x5c91cf,_0x44bf('0xd'));logger[_0x44bf('0xe')](_0x44bf('0xf'),_0x5c91cf,_0x44bf('0xd'),JSON['stringify'](_0x440fa3));if(_0x440fa3['error']){if(_0x440fa3[_0x44bf('0x10')][_0x44bf('0x11')]===0x1f4){logger[_0x44bf('0x10')](_0x44bf('0x12'),_0x5c91cf,_0x440fa3[_0x44bf('0x10')][_0x44bf('0x13')]);return _0x41598e(_0x440fa3[_0x44bf('0x10')][_0x44bf('0x13')]);}logger[_0x44bf('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5c91cf,_0x440fa3['error']['message']);return _0x243241(_0x440fa3['error'][_0x44bf('0x13')]);}else{logger[_0x44bf('0x14')](_0x44bf('0x12'),_0x5c91cf,_0x44bf('0xd'));_0x243241(_0x440fa3[_0x44bf('0x15')][_0x44bf('0x13')]);}})['catch'](function(_0x1d2742){logger[_0x44bf('0x10')](_0x44bf('0x12'),_0x5c91cf,_0x1d2742);_0x41598e(_0x1d2742);});});} \ No newline at end of file +var _0x10d0=['catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x1ab0e6,_0x17ba8d){var _0x248815=function(_0x5d2b40){while(--_0x5d2b40){_0x1ab0e6['push'](_0x1ab0e6['shift']());}};_0x248815(++_0x17ba8d);}(_0x10d0,0x13c));var _0x010d=function(_0xfcf442,_0x374291){_0xfcf442=_0xfcf442-0x0;var _0x5de656=_0x10d0[_0xfcf442];return _0x5de656;};'use strict';var _=require(_0x010d('0x0'));var util=require(_0x010d('0x1'));var moment=require('moment');var BPromise=require(_0x010d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x010d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x010d('0x4'));var logger=require(_0x010d('0x5'))(_0x010d('0x6'));var config=require('../../config/environment');var jayson=require(_0x010d('0x7'));var client=jayson[_0x010d('0x8')][_0x010d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48c7cd,_0x293e9c,_0x19a106){return new BPromise(function(_0x2f9013,_0x2483ca){return client[_0x010d('0xa')](_0x48c7cd,_0x19a106)[_0x010d('0xb')](function(_0x282aad){logger['info'](_0x010d('0xc'),_0x293e9c,'request\x20sent');logger[_0x010d('0xd')](_0x010d('0xe'),_0x293e9c,_0x010d('0xf'),JSON[_0x010d('0x10')](_0x282aad));if(_0x282aad[_0x010d('0x11')]){if(_0x282aad[_0x010d('0x11')][_0x010d('0x12')]===0x1f4){logger['error'](_0x010d('0xc'),_0x293e9c,_0x282aad['error'][_0x010d('0x13')]);return _0x2483ca(_0x282aad[_0x010d('0x11')][_0x010d('0x13')]);}logger[_0x010d('0x11')](_0x010d('0xc'),_0x293e9c,_0x282aad[_0x010d('0x11')]['message']);return _0x2f9013(_0x282aad['error'][_0x010d('0x13')]);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x293e9c,'request\x20sent');_0x2f9013(_0x282aad['result'][_0x010d('0x13')]);}})[_0x010d('0x14')](function(_0x3faa6c){logger[_0x010d('0x11')](_0x010d('0xc'),_0x293e9c,_0x3faa6c);_0x2483ca(_0x3faa6c);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index c7a022e..0d9b333 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 _0x7348=['../../config/environment','./analyticExtractedReport.controller','get','/:id','isAuthenticated','show','download','post','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2ad068,_0x379abc){var _0x5babb6=function(_0x43ab8b){while(--_0x43ab8b){_0x2ad068['push'](_0x2ad068['shift']());}};_0x5babb6(++_0x379abc);}(_0x7348,0x64));var _0x8734=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x7348[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0x8734('0x0'));var util=require(_0x8734('0x1'));var path=require(_0x8734('0x2'));var timeout=require(_0x8734('0x3'));var express=require(_0x8734('0x4'));var router=express[_0x8734('0x5')]();var fs_extra=require(_0x8734('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8734('0x7'));var config=require(_0x8734('0x8'));var controller=require(_0x8734('0x9'));router[_0x8734('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8734('0xa')](_0x8734('0xb'),auth[_0x8734('0xc')](),controller[_0x8734('0xd')]);router[_0x8734('0xa')]('/:id/download',auth[_0x8734('0xc')](),controller[_0x8734('0xe')]);router[_0x8734('0xf')]('/',auth[_0x8734('0xc')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x8734('0x10')]);router['delete'](_0x8734('0xb'),auth[_0x8734('0xc')](),controller[_0x8734('0x11')]);module['exports']=router; \ No newline at end of file +var _0x8771=['delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','put'];(function(_0x10f2dc,_0x3bd93b){var _0x3bbbc6=function(_0x2770dc){while(--_0x2770dc){_0x10f2dc['push'](_0x10f2dc['shift']());}};_0x3bbbc6(++_0x3bd93b);}(_0x8771,0x193));var _0x1877=function(_0x104e21,_0x2ea86f){_0x104e21=_0x104e21-0x0;var _0x605b37=_0x8771[_0x104e21];return _0x605b37;};'use strict';var multer=require(_0x1877('0x0'));var util=require(_0x1877('0x1'));var path=require(_0x1877('0x2'));var timeout=require('connect-timeout');var express=require(_0x1877('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1877('0x4'));var interaction=require(_0x1877('0x5'));var config=require(_0x1877('0x6'));var controller=require('./analyticExtractedReport.controller');router[_0x1877('0x7')]('/',auth[_0x1877('0x8')](),controller['index']);router[_0x1877('0x7')](_0x1877('0x9'),auth[_0x1877('0x8')](),controller[_0x1877('0xa')]);router[_0x1877('0x7')](_0x1877('0xb'),auth[_0x1877('0x8')](),controller['download']);router['post']('/',auth[_0x1877('0x8')](),controller['create']);router[_0x1877('0xc')](_0x1877('0x9'),auth[_0x1877('0x8')](),controller['update']);router[_0x1877('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x1877('0xe')]);module[_0x1877('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 7ba81e6..bdb80f3 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 _0xecf0=['TEXT','STRING','BOOLEAN'];(function(_0x46085d,_0x20ee72){var _0x499629=function(_0x152721){while(--_0x152721){_0x46085d['push'](_0x46085d['shift']());}};_0x499629(++_0x20ee72);}(_0xecf0,0x96));var _0x0ecf=function(_0x1444c4,_0x1eeefd){_0x1444c4=_0x1444c4-0x0;var _0x33c549=_0xecf0[_0x1444c4];return _0x33c549;};'use strict';var Sequelize=require('sequelize');module['exports']={'field':{'type':Sequelize[_0x0ecf('0x0')]},'alias':{'type':Sequelize[_0x0ecf('0x1')]},'function':{'type':Sequelize[_0x0ecf('0x1')]},'format':{'type':Sequelize[_0x0ecf('0x1')]},'groupBy':{'type':Sequelize[_0x0ecf('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x0ecf('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xbc83=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0xf411cd,_0x2728a5){var _0xad4726=function(_0x124024){while(--_0x124024){_0xf411cd['push'](_0xf411cd['shift']());}};_0xad4726(++_0x2728a5);}(_0xbc83,0x17a));var _0x3bc8=function(_0x1c92a3,_0x4a196a){_0x1c92a3=_0x1c92a3-0x0;var _0xf30104=_0xbc83[_0x1c92a3];return _0xf30104;};'use strict';var Sequelize=require(_0x3bc8('0x0'));module['exports']={'field':{'type':Sequelize[_0x3bc8('0x1')]},'alias':{'type':Sequelize[_0x3bc8('0x2')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x3bc8('0x2')]},'groupBy':{'type':Sequelize[_0x3bc8('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x3bc8('0x2')]},'custom':{'type':Sequelize[_0x3bc8('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 ae433a3..4ad9a5c 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 _0xf8b9=['query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','merge','VIRTUAL','options','AnalyticFieldReport','include','rows','catch','show','params','length','includeAll','find','create','body','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','bulkCreate','findAll','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','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','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','rawAttributes','type','key','model','map'];(function(_0x123fa1,_0xdc2246){var _0x3cce9c=function(_0x19da16){while(--_0x19da16){_0x123fa1['push'](_0x123fa1['shift']());}};_0x3cce9c(++_0xdc2246);}(_0xf8b9,0x11a));var _0x9f8b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf8b9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9f8b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9f8b('0x1'));var BPromise=require(_0x9f8b('0x2'));var Mustache=require(_0x9f8b('0x3'));var util=require(_0x9f8b('0x4'));var path=require(_0x9f8b('0x5'));var sox=require(_0x9f8b('0x6'));var csv=require(_0x9f8b('0x7'));var ejs=require(_0x9f8b('0x8'));var fs=require('fs');var fs_extra=require(_0x9f8b('0x9'));var _=require(_0x9f8b('0xa'));var squel=require('squel');var crypto=require(_0x9f8b('0xb'));var jsforce=require(_0x9f8b('0xc'));var deskjs=require(_0x9f8b('0xd'));var toCsv=require(_0x9f8b('0x7'));var querystring=require('querystring');var Papa=require(_0x9f8b('0xe'));var Redis=require(_0x9f8b('0xf'));var authService=require(_0x9f8b('0x10'));var qs=require(_0x9f8b('0x11'));var as=require(_0x9f8b('0x12'));var hardwareService=require(_0x9f8b('0x13'));var logger=require(_0x9f8b('0x14'))(_0x9f8b('0x15'));var utils=require(_0x9f8b('0x16'));var config=require(_0x9f8b('0x17'));var licenseUtil=require(_0x9f8b('0x18'));var db=require(_0x9f8b('0x19'))['db'];function respondWithStatusCode(_0x508e14,_0x57dd09){_0x57dd09=_0x57dd09||0xcc;return function(_0x3d978f){if(_0x3d978f){return _0x508e14[_0x9f8b('0x1a')](_0x57dd09);}return _0x508e14[_0x9f8b('0x1b')](_0x57dd09)[_0x9f8b('0x1c')]();};}function respondWithResult(_0x41e8de,_0x266ed6){_0x266ed6=_0x266ed6||0xc8;return function(_0x310aa3){if(_0x310aa3){return _0x41e8de[_0x9f8b('0x1b')](_0x266ed6)[_0x9f8b('0x1d')](_0x310aa3);}};}function respondWithFilteredResult(_0x11fec6,_0x5c6660){return function(_0x502381){if(_0x502381){var _0x135526=typeof _0x5c6660[_0x9f8b('0x1e')]===_0x9f8b('0x1f')&&typeof _0x5c6660[_0x9f8b('0x20')]==='undefined';var _0x3e3bcf=_0x502381['count'];var _0x10a7d0=_0x135526?0x0:_0x5c6660[_0x9f8b('0x1e')];var _0x2a58eb=_0x135526?_0x502381[_0x9f8b('0x21')]:_0x5c6660[_0x9f8b('0x1e')]+_0x5c6660[_0x9f8b('0x20')];var _0x591cc9;if(_0x2a58eb>=_0x3e3bcf){_0x2a58eb=_0x3e3bcf;_0x591cc9=0xc8;}else{_0x591cc9=0xce;}_0x11fec6[_0x9f8b('0x1b')](_0x591cc9);return _0x11fec6[_0x9f8b('0x22')](_0x9f8b('0x23'),_0x10a7d0+'-'+_0x2a58eb+'/'+_0x3e3bcf)['json'](_0x502381);}return null;};}function patchUpdates(_0x382950){return function(_0x217b94){try{jsonpatch[_0x9f8b('0x24')](_0x217b94,_0x382950,!![]);}catch(_0x532c13){return BPromise['reject'](_0x532c13);}return _0x217b94[_0x9f8b('0x25')]();};}function saveUpdates(_0x3ad66e,_0x433418){return function(_0x4d3110){if(_0x4d3110){return _0x4d3110[_0x9f8b('0x26')](_0x3ad66e)[_0x9f8b('0x27')](function(_0x26565f){return _0x26565f;});}return null;};}function removeEntity(_0x54ea91,_0x103396){return function(_0x27c08e){if(_0x27c08e){return _0x27c08e[_0x9f8b('0x28')]()[_0x9f8b('0x27')](function(){_0x54ea91[_0x9f8b('0x1b')](0xcc)[_0x9f8b('0x1c')]();});}};}function handleEntityNotFound(_0x269bc0,_0x503a0d){return function(_0x1cac91){if(!_0x1cac91){_0x269bc0[_0x9f8b('0x1a')](0x194);}return _0x1cac91;};}function handleError(_0x3d959f,_0x503f64){_0x503f64=_0x503f64||0x1f4;return function(_0x4f53b3){logger[_0x9f8b('0x29')](_0x4f53b3['stack']);if(_0x4f53b3[_0x9f8b('0x2a')]){delete _0x4f53b3['name'];}_0x3d959f['status'](_0x503f64)[_0x9f8b('0x2b')](_0x4f53b3);};}exports[_0x9f8b('0x2c')]=function(_0x21be23,_0x94cd8e){var _0x29a8a5={},_0xd10922={},_0x34ad2b={'count':0x0,'rows':[]};var _0xa594f5=_['map'](db['AnalyticFieldReport'][_0x9f8b('0x2d')],function(_0x4c9cad){return{'name':_0x4c9cad['fieldName'],'type':_0x4c9cad[_0x9f8b('0x2e')][_0x9f8b('0x2f')]};});_0xd10922[_0x9f8b('0x30')]=_[_0x9f8b('0x31')](_0xa594f5,_0x9f8b('0x2a'));_0xd10922[_0x9f8b('0x32')]=_[_0x9f8b('0x33')](_0x21be23[_0x9f8b('0x32')]);_0xd10922[_0x9f8b('0x34')]=_[_0x9f8b('0x35')](_0xd10922[_0x9f8b('0x30')],_0xd10922[_0x9f8b('0x32')]);_0x29a8a5['attributes']=_[_0x9f8b('0x35')](_0xd10922[_0x9f8b('0x30')],qs[_0x9f8b('0x36')](_0x21be23[_0x9f8b('0x32')]['fields']));_0x29a8a5['attributes']=_0x29a8a5[_0x9f8b('0x37')]['length']?_0x29a8a5[_0x9f8b('0x37')]:_0xd10922[_0x9f8b('0x30')];if(!_0x21be23[_0x9f8b('0x32')]['hasOwnProperty'](_0x9f8b('0x38'))){_0x29a8a5['limit']=qs['limit'](_0x21be23[_0x9f8b('0x32')][_0x9f8b('0x20')]);_0x29a8a5[_0x9f8b('0x1e')]=qs[_0x9f8b('0x1e')](_0x21be23['query'][_0x9f8b('0x1e')]);}_0x29a8a5[_0x9f8b('0x39')]=qs[_0x9f8b('0x3a')](_0x21be23[_0x9f8b('0x32')][_0x9f8b('0x3a')]);_0x29a8a5[_0x9f8b('0x3b')]=qs[_0x9f8b('0x34')](_['pick'](_0x21be23[_0x9f8b('0x32')],_0xd10922['filters']),_0xa594f5);if(_0x21be23[_0x9f8b('0x32')][_0x9f8b('0x3c')]){_0x29a8a5['where']=_[_0x9f8b('0x3d')](_0x29a8a5[_0x9f8b('0x3b')],{'$or':_[_0x9f8b('0x31')](_0xa594f5,function(_0x74be4f){if(_0x74be4f[_0x9f8b('0x2e')]!==_0x9f8b('0x3e')){var _0x56205c={};_0x56205c[_0x74be4f[_0x9f8b('0x2a')]]={'$like':'%'+_0x21be23[_0x9f8b('0x32')][_0x9f8b('0x3c')]+'%'};return _0x56205c;}})});}_0x29a8a5=_[_0x9f8b('0x3d')]({},_0x29a8a5,_0x21be23[_0x9f8b('0x3f')]);var _0x137eb9={'where':_0x29a8a5['where']};return db[_0x9f8b('0x40')]['count'](_0x137eb9)[_0x9f8b('0x27')](function(_0x2410e5){_0x34ad2b['count']=_0x2410e5;if(_0x21be23[_0x9f8b('0x32')]['includeAll']){_0x29a8a5[_0x9f8b('0x41')]=[{'all':!![]}];}return db[_0x9f8b('0x40')]['findAll'](_0x29a8a5);})[_0x9f8b('0x27')](function(_0x2fed4c){_0x34ad2b[_0x9f8b('0x42')]=_0x2fed4c;return _0x34ad2b;})[_0x9f8b('0x27')](respondWithFilteredResult(_0x94cd8e,_0x29a8a5))[_0x9f8b('0x43')](handleError(_0x94cd8e,null));};exports[_0x9f8b('0x44')]=function(_0x37e0c0,_0x1211c6){var _0x347f22={'raw':![],'where':{'id':_0x37e0c0[_0x9f8b('0x45')]['id']}},_0x430d10={};_0x430d10['model']=_[_0x9f8b('0x33')](db['AnalyticFieldReport'][_0x9f8b('0x2d')]);_0x430d10[_0x9f8b('0x32')]=_[_0x9f8b('0x33')](_0x37e0c0[_0x9f8b('0x32')]);_0x430d10[_0x9f8b('0x34')]=_[_0x9f8b('0x35')](_0x430d10[_0x9f8b('0x30')],_0x430d10[_0x9f8b('0x32')]);_0x347f22[_0x9f8b('0x37')]=_['intersection'](_0x430d10[_0x9f8b('0x30')],qs[_0x9f8b('0x36')](_0x37e0c0[_0x9f8b('0x32')][_0x9f8b('0x36')]));_0x347f22[_0x9f8b('0x37')]=_0x347f22['attributes'][_0x9f8b('0x46')]?_0x347f22[_0x9f8b('0x37')]:_0x430d10[_0x9f8b('0x30')];if(_0x37e0c0[_0x9f8b('0x32')][_0x9f8b('0x47')]){_0x347f22[_0x9f8b('0x41')]=[{'all':!![]}];}_0x347f22=_[_0x9f8b('0x3d')]({},_0x347f22,_0x37e0c0[_0x9f8b('0x3f')]);return db['AnalyticFieldReport'][_0x9f8b('0x48')](_0x347f22)[_0x9f8b('0x27')](handleEntityNotFound(_0x1211c6,null))[_0x9f8b('0x27')](respondWithResult(_0x1211c6,null))[_0x9f8b('0x43')](handleError(_0x1211c6,null));};exports[_0x9f8b('0x49')]=function(_0x3029e3,_0x20c2fd){return db[_0x9f8b('0x40')][_0x9f8b('0x49')](_0x3029e3[_0x9f8b('0x4a')],{})[_0x9f8b('0x27')](respondWithResult(_0x20c2fd,0xc9))[_0x9f8b('0x43')](handleError(_0x20c2fd,null));};exports['bulkCreate']=function(_0x114c59,_0x27b687){return db[_0x9f8b('0x40')]['bulkCreate'](_0x114c59['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x27b687,0xc9))[_0x9f8b('0x43')](handleError(_0x27b687,null));};exports[_0x9f8b('0x26')]=function(_0x2c13cb,_0x385fc2){if(_0x2c13cb[_0x9f8b('0x4a')]['id']){delete _0x2c13cb[_0x9f8b('0x4a')]['id'];}return db[_0x9f8b('0x40')][_0x9f8b('0x48')]({'where':{'id':_0x2c13cb['params']['id']}})[_0x9f8b('0x27')](handleEntityNotFound(_0x385fc2,null))[_0x9f8b('0x27')](saveUpdates(_0x2c13cb['body'],null))[_0x9f8b('0x27')](respondWithResult(_0x385fc2,null))[_0x9f8b('0x43')](handleError(_0x385fc2,null));};exports[_0x9f8b('0x28')]=function(_0x4e1e6c,_0x32072d){return db[_0x9f8b('0x40')]['find']({'where':{'id':_0x4e1e6c[_0x9f8b('0x45')]['id']}})[_0x9f8b('0x27')](handleEntityNotFound(_0x32072d,null))[_0x9f8b('0x27')](removeEntity(_0x32072d,null))['catch'](handleError(_0x32072d,null));};exports[_0x9f8b('0x4b')]=function(_0x1e6603,_0x2d313b){return db[_0x9f8b('0x40')]['destroy']({'where':{'id':_0x1e6603['query'][_0x9f8b('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0x9f8b('0x27')](respondWithResult(_0x2d313b,0xcc))[_0x9f8b('0x43')](handleError(_0x2d313b,null));};exports[_0x9f8b('0x4d')]=function(_0x3dea1d,_0x1cbb59,_0x4587b9){return db[_0x9f8b('0x4e')]['findOne']({'where':{'id':_0x3dea1d[_0x9f8b('0x45')]['id']}})[_0x9f8b('0x27')](handleEntityNotFound(_0x1cbb59,null))[_0x9f8b('0x27')](function(_0x482cea){if(_0x482cea){return db[_0x9f8b('0x4f')][_0x9f8b('0x50')](function(_0x17f94e){return db[_0x9f8b('0x40')]['destroy']({'where':{'CustomReportId':_0x3dea1d[_0x9f8b('0x45')]['id']},'transaction':_0x17f94e})['then'](function(_0x325d1b){var _0x299c87=_[_0x9f8b('0x31')](_0x3dea1d[_0x9f8b('0x4a')],function(_0x153261){delete _0x153261['id'];_0x153261['CustomReportId']=_0x3dea1d['params']['id'];return _0x153261;});return db[_0x9f8b('0x40')][_0x9f8b('0x51')](_0x299c87,{'transaction':_0x17f94e});});})[_0x9f8b('0x27')](function(){return db[_0x9f8b('0x40')][_0x9f8b('0x52')]({'where':{'CustomReportId':_0x3dea1d['params']['id']}});});}})[_0x9f8b('0x27')](respondWithResult(_0x1cbb59,null))[_0x9f8b('0x43')](handleError(_0x1cbb59,null));}; \ No newline at end of file +var _0x8540=['squel','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','end','json','offset','undefined','count','Content-Range','save','update','then','error','stack','name','send','index','AnalyticFieldReport','rawAttributes','type','key','keys','query','intersection','model','attributes','fields','length','nolimit','limit','order','filters','pick','where','merge','map','VIRTUAL','filter','includeAll','include','findAll','rows','params','options','catch','create','body','bulkCreate','find','bulkDestroy','destroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra'];(function(_0x29bcab,_0x53a015){var _0x2cb492=function(_0x24ee16){while(--_0x24ee16){_0x29bcab['push'](_0x29bcab['shift']());}};_0x2cb492(++_0x53a015);}(_0x8540,0x148));var _0x0854=function(_0x221ba2,_0x79208){_0x221ba2=_0x221ba2-0x0;var _0x47d08e=_0x8540[_0x221ba2];return _0x47d08e;};'use strict';var emlformat=require(_0x0854('0x0'));var rimraf=require(_0x0854('0x1'));var zipdir=require(_0x0854('0x2'));var jsonpatch=require(_0x0854('0x3'));var rp=require(_0x0854('0x4'));var moment=require('moment');var BPromise=require(_0x0854('0x5'));var Mustache=require(_0x0854('0x6'));var util=require(_0x0854('0x7'));var path=require(_0x0854('0x8'));var sox=require(_0x0854('0x9'));var csv=require('to-csv');var ejs=require(_0x0854('0xa'));var fs=require('fs');var fs_extra=require(_0x0854('0xb'));var _=require('lodash');var squel=require(_0x0854('0xc'));var crypto=require('crypto');var jsforce=require(_0x0854('0xd'));var deskjs=require(_0x0854('0xe'));var toCsv=require(_0x0854('0xf'));var querystring=require(_0x0854('0x10'));var Papa=require(_0x0854('0x11'));var Redis=require('ioredis');var authService=require(_0x0854('0x12'));var qs=require(_0x0854('0x13'));var as=require(_0x0854('0x14'));var hardwareService=require(_0x0854('0x15'));var logger=require(_0x0854('0x16'))(_0x0854('0x17'));var utils=require(_0x0854('0x18'));var config=require(_0x0854('0x19'));var licenseUtil=require(_0x0854('0x1a'));var db=require(_0x0854('0x1b'))['db'];function respondWithStatusCode(_0x3a08ce,_0xca0485){_0xca0485=_0xca0485||0xcc;return function(_0x4e05d4){if(_0x4e05d4){return _0x3a08ce[_0x0854('0x1c')](_0xca0485);}return _0x3a08ce[_0x0854('0x1d')](_0xca0485)[_0x0854('0x1e')]();};}function respondWithResult(_0x3f4caf,_0xddea3f){_0xddea3f=_0xddea3f||0xc8;return function(_0x45fc41){if(_0x45fc41){return _0x3f4caf[_0x0854('0x1d')](_0xddea3f)[_0x0854('0x1f')](_0x45fc41);}};}function respondWithFilteredResult(_0x4d9fe6,_0x5d99ea){return function(_0x634fb3){if(_0x634fb3){var _0x24bd93=typeof _0x5d99ea[_0x0854('0x20')]===_0x0854('0x21')&&typeof _0x5d99ea['limit']===_0x0854('0x21');var _0x5d85cb=_0x634fb3['count'];var _0x3c1bd5=_0x24bd93?0x0:_0x5d99ea[_0x0854('0x20')];var _0x16354c=_0x24bd93?_0x634fb3[_0x0854('0x22')]:_0x5d99ea[_0x0854('0x20')]+_0x5d99ea['limit'];var _0x2dde3e;if(_0x16354c>=_0x5d85cb){_0x16354c=_0x5d85cb;_0x2dde3e=0xc8;}else{_0x2dde3e=0xce;}_0x4d9fe6['status'](_0x2dde3e);return _0x4d9fe6['set'](_0x0854('0x23'),_0x3c1bd5+'-'+_0x16354c+'/'+_0x5d85cb)[_0x0854('0x1f')](_0x634fb3);}return null;};}function patchUpdates(_0x4e3c96){return function(_0x26cb1e){try{jsonpatch['apply'](_0x26cb1e,_0x4e3c96,!![]);}catch(_0x3f2965){return BPromise['reject'](_0x3f2965);}return _0x26cb1e[_0x0854('0x24')]();};}function saveUpdates(_0x10d4ae,_0x4d65c9){return function(_0x4e1929){if(_0x4e1929){return _0x4e1929[_0x0854('0x25')](_0x10d4ae)[_0x0854('0x26')](function(_0x580d33){return _0x580d33;});}return null;};}function removeEntity(_0x46c267,_0x43d08c){return function(_0xf5fb95){if(_0xf5fb95){return _0xf5fb95['destroy']()[_0x0854('0x26')](function(){_0x46c267[_0x0854('0x1d')](0xcc)[_0x0854('0x1e')]();});}};}function handleEntityNotFound(_0x1c290e,_0x3b47c1){return function(_0x3f8fce){if(!_0x3f8fce){_0x1c290e['sendStatus'](0x194);}return _0x3f8fce;};}function handleError(_0x57878f,_0x216b90){_0x216b90=_0x216b90||0x1f4;return function(_0x16a363){logger[_0x0854('0x27')](_0x16a363[_0x0854('0x28')]);if(_0x16a363[_0x0854('0x29')]){delete _0x16a363[_0x0854('0x29')];}_0x57878f[_0x0854('0x1d')](_0x216b90)[_0x0854('0x2a')](_0x16a363);};}exports[_0x0854('0x2b')]=function(_0x456acd,_0x4a2798){var _0x3349c1={},_0x4c5629={},_0x28b399={'count':0x0,'rows':[]};var _0x157cee=_['map'](db[_0x0854('0x2c')][_0x0854('0x2d')],function(_0x540500){return{'name':_0x540500['fieldName'],'type':_0x540500[_0x0854('0x2e')][_0x0854('0x2f')]};});_0x4c5629['model']=_['map'](_0x157cee,_0x0854('0x29'));_0x4c5629['query']=_[_0x0854('0x30')](_0x456acd[_0x0854('0x31')]);_0x4c5629['filters']=_[_0x0854('0x32')](_0x4c5629[_0x0854('0x33')],_0x4c5629[_0x0854('0x31')]);_0x3349c1[_0x0854('0x34')]=_[_0x0854('0x32')](_0x4c5629[_0x0854('0x33')],qs[_0x0854('0x35')](_0x456acd[_0x0854('0x31')]['fields']));_0x3349c1['attributes']=_0x3349c1[_0x0854('0x34')][_0x0854('0x36')]?_0x3349c1[_0x0854('0x34')]:_0x4c5629['model'];if(!_0x456acd['query']['hasOwnProperty'](_0x0854('0x37'))){_0x3349c1[_0x0854('0x38')]=qs[_0x0854('0x38')](_0x456acd[_0x0854('0x31')][_0x0854('0x38')]);_0x3349c1[_0x0854('0x20')]=qs[_0x0854('0x20')](_0x456acd[_0x0854('0x31')][_0x0854('0x20')]);}_0x3349c1[_0x0854('0x39')]=qs['sort'](_0x456acd[_0x0854('0x31')]['sort']);_0x3349c1['where']=qs[_0x0854('0x3a')](_[_0x0854('0x3b')](_0x456acd[_0x0854('0x31')],_0x4c5629[_0x0854('0x3a')]),_0x157cee);if(_0x456acd['query']['filter']){_0x3349c1[_0x0854('0x3c')]=_[_0x0854('0x3d')](_0x3349c1[_0x0854('0x3c')],{'$or':_[_0x0854('0x3e')](_0x157cee,function(_0x47c662){if(_0x47c662[_0x0854('0x2e')]!==_0x0854('0x3f')){var _0x33668f={};_0x33668f[_0x47c662[_0x0854('0x29')]]={'$like':'%'+_0x456acd[_0x0854('0x31')][_0x0854('0x40')]+'%'};return _0x33668f;}})});}_0x3349c1=_['merge']({},_0x3349c1,_0x456acd['options']);var _0x2fb73b={'where':_0x3349c1[_0x0854('0x3c')]};return db[_0x0854('0x2c')]['count'](_0x2fb73b)[_0x0854('0x26')](function(_0x3751e0){_0x28b399[_0x0854('0x22')]=_0x3751e0;if(_0x456acd[_0x0854('0x31')][_0x0854('0x41')]){_0x3349c1[_0x0854('0x42')]=[{'all':!![]}];}return db[_0x0854('0x2c')][_0x0854('0x43')](_0x3349c1);})[_0x0854('0x26')](function(_0x1955ba){_0x28b399[_0x0854('0x44')]=_0x1955ba;return _0x28b399;})[_0x0854('0x26')](respondWithFilteredResult(_0x4a2798,_0x3349c1))['catch'](handleError(_0x4a2798,null));};exports['show']=function(_0x22e486,_0x1214a0){var _0x1f2824={'raw':![],'where':{'id':_0x22e486[_0x0854('0x45')]['id']}},_0x7163f={};_0x7163f[_0x0854('0x33')]=_[_0x0854('0x30')](db[_0x0854('0x2c')][_0x0854('0x2d')]);_0x7163f[_0x0854('0x31')]=_[_0x0854('0x30')](_0x22e486[_0x0854('0x31')]);_0x7163f['filters']=_[_0x0854('0x32')](_0x7163f[_0x0854('0x33')],_0x7163f['query']);_0x1f2824[_0x0854('0x34')]=_[_0x0854('0x32')](_0x7163f[_0x0854('0x33')],qs[_0x0854('0x35')](_0x22e486[_0x0854('0x31')][_0x0854('0x35')]));_0x1f2824[_0x0854('0x34')]=_0x1f2824[_0x0854('0x34')]['length']?_0x1f2824['attributes']:_0x7163f[_0x0854('0x33')];if(_0x22e486['query']['includeAll']){_0x1f2824[_0x0854('0x42')]=[{'all':!![]}];}_0x1f2824=_[_0x0854('0x3d')]({},_0x1f2824,_0x22e486[_0x0854('0x46')]);return db['AnalyticFieldReport']['find'](_0x1f2824)['then'](handleEntityNotFound(_0x1214a0,null))[_0x0854('0x26')](respondWithResult(_0x1214a0,null))[_0x0854('0x47')](handleError(_0x1214a0,null));};exports['create']=function(_0x513131,_0x21accf){return db[_0x0854('0x2c')][_0x0854('0x48')](_0x513131[_0x0854('0x49')],{})['then'](respondWithResult(_0x21accf,0xc9))[_0x0854('0x47')](handleError(_0x21accf,null));};exports['bulkCreate']=function(_0x18d65c,_0x53c150){return db[_0x0854('0x2c')][_0x0854('0x4a')](_0x18d65c[_0x0854('0x49')],{'raw':![],'individualHooks':!![]})[_0x0854('0x26')](respondWithResult(_0x53c150,0xc9))[_0x0854('0x47')](handleError(_0x53c150,null));};exports[_0x0854('0x25')]=function(_0x10d2ff,_0x3de010){if(_0x10d2ff[_0x0854('0x49')]['id']){delete _0x10d2ff[_0x0854('0x49')]['id'];}return db[_0x0854('0x2c')][_0x0854('0x4b')]({'where':{'id':_0x10d2ff[_0x0854('0x45')]['id']}})[_0x0854('0x26')](handleEntityNotFound(_0x3de010,null))[_0x0854('0x26')](saveUpdates(_0x10d2ff['body'],null))['then'](respondWithResult(_0x3de010,null))[_0x0854('0x47')](handleError(_0x3de010,null));};exports['destroy']=function(_0x169907,_0x3d193c){return db[_0x0854('0x2c')][_0x0854('0x4b')]({'where':{'id':_0x169907[_0x0854('0x45')]['id']}})['then'](handleEntityNotFound(_0x3d193c,null))[_0x0854('0x26')](removeEntity(_0x3d193c,null))[_0x0854('0x47')](handleError(_0x3d193c,null));};exports[_0x0854('0x4c')]=function(_0x32b0ed,_0x23091e){return db['AnalyticFieldReport'][_0x0854('0x4d')]({'where':{'id':_0x32b0ed['query'][_0x0854('0x4e')]||[]},'raw':![],'individualHooks':!![]})[_0x0854('0x26')](respondWithResult(_0x23091e,0xcc))['catch'](handleError(_0x23091e,null));};exports[_0x0854('0x4f')]=function(_0x2944dd,_0x4347f7,_0x194919){return db[_0x0854('0x50')][_0x0854('0x51')]({'where':{'id':_0x2944dd[_0x0854('0x45')]['id']}})[_0x0854('0x26')](handleEntityNotFound(_0x4347f7,null))['then'](function(_0x56a843){if(_0x56a843){return db[_0x0854('0x52')][_0x0854('0x53')](function(_0x266cb6){return db[_0x0854('0x2c')]['destroy']({'where':{'CustomReportId':_0x2944dd[_0x0854('0x45')]['id']},'transaction':_0x266cb6})[_0x0854('0x26')](function(_0x52ffb3){var _0x1e11f0=_[_0x0854('0x3e')](_0x2944dd[_0x0854('0x49')],function(_0x19977e){delete _0x19977e['id'];_0x19977e[_0x0854('0x54')]=_0x2944dd[_0x0854('0x45')]['id'];return _0x19977e;});return db[_0x0854('0x2c')][_0x0854('0x4a')](_0x1e11f0,{'transaction':_0x266cb6});});})[_0x0854('0x26')](function(){return db[_0x0854('0x2c')][_0x0854('0x43')]({'where':{'CustomReportId':_0x2944dd[_0x0854('0x45')]['id']}});});}})['then'](respondWithResult(_0x4347f7,null))[_0x0854('0x47')](handleError(_0x4347f7,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index da2a664..7f73850 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 _0xe800=['../../config/logger','moment','bluebird','rimraf','../../config/environment','exports','analytics_report_fields','lodash','util'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xe800,0x193));var _0x0e80=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0xe800[_0xa8883];return _0x479426;};'use strict';var _=require(_0x0e80('0x0'));var util=require(_0x0e80('0x1'));var logger=require(_0x0e80('0x2'))('api');var moment=require(_0x0e80('0x3'));var BPromise=require(_0x0e80('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0e80('0x5'));var config=require(_0x0e80('0x6'));var attributes=require('./analyticFieldReport.attributes');module[_0x0e80('0x7')]=function(_0x1a77b4,_0xb89f6f){return _0x1a77b4['define']('AnalyticFieldReport',attributes,{'tableName':_0x0e80('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb36=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticFieldReport','lodash','util','../../config/logger','moment'];(function(_0x16b32f,_0x758d48){var _0xc94c5b=function(_0x21858e){while(--_0x21858e){_0x16b32f['push'](_0x16b32f['shift']());}};_0xc94c5b(++_0x758d48);}(_0xeb36,0x188));var _0x6eb3=function(_0x22fded,_0x52eb9b){_0x22fded=_0x22fded-0x0;var _0x41fa12=_0xeb36[_0x22fded];return _0x41fa12;};'use strict';var _=require(_0x6eb3('0x0'));var util=require(_0x6eb3('0x1'));var logger=require(_0x6eb3('0x2'))('api');var moment=require(_0x6eb3('0x3'));var BPromise=require(_0x6eb3('0x4'));var rp=require(_0x6eb3('0x5'));var fs=require('fs');var path=require(_0x6eb3('0x6'));var rimraf=require(_0x6eb3('0x7'));var config=require(_0x6eb3('0x8'));var attributes=require('./analyticFieldReport.attributes');module[_0x6eb3('0x9')]=function(_0x56fcf4,_0x51f707){return _0x56fcf4[_0x6eb3('0xa')](_0x6eb3('0xb'),attributes,{'tableName':'analytics_report_fields','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 961a7cd..70162d8 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 _0x30eb=['request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','AnalyticFieldReport,\x20%s,\x20%s'];(function(_0x7334fc,_0x56beef){var _0x4c096c=function(_0x4940d1){while(--_0x4940d1){_0x7334fc['push'](_0x7334fc['shift']());}};_0x4c096c(++_0x56beef);}(_0x30eb,0xce));var _0xb30e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x30eb[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb30e('0x0'));var util=require(_0xb30e('0x1'));var moment=require(_0xb30e('0x2'));var BPromise=require(_0xb30e('0x3'));var rs=require(_0xb30e('0x4'));var fs=require('fs');var Redis=require(_0xb30e('0x5'));var db=require(_0xb30e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb30e('0x7'))(_0xb30e('0x8'));var config=require(_0xb30e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb30e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x342910,_0x158fa0,_0x49802f){return new BPromise(function(_0x1b769e,_0x1c6bba){return client[_0xb30e('0xb')](_0x342910,_0x49802f)[_0xb30e('0xc')](function(_0xf80c00){logger['info'](_0xb30e('0xd'),_0x158fa0,_0xb30e('0xe'));logger[_0xb30e('0xf')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x158fa0,_0xb30e('0xe'),JSON[_0xb30e('0x10')](_0xf80c00));if(_0xf80c00[_0xb30e('0x11')]){if(_0xf80c00[_0xb30e('0x11')][_0xb30e('0x12')]===0x1f4){logger[_0xb30e('0x11')](_0xb30e('0xd'),_0x158fa0,_0xf80c00['error'][_0xb30e('0x13')]);return _0x1c6bba(_0xf80c00[_0xb30e('0x11')][_0xb30e('0x13')]);}logger[_0xb30e('0x11')](_0xb30e('0xd'),_0x158fa0,_0xf80c00[_0xb30e('0x11')][_0xb30e('0x13')]);return _0x1b769e(_0xf80c00[_0xb30e('0x11')]['message']);}else{logger[_0xb30e('0x14')](_0xb30e('0xd'),_0x158fa0,_0xb30e('0xe'));_0x1b769e(_0xf80c00[_0xb30e('0x15')][_0xb30e('0x13')]);}})['catch'](function(_0xc5afe7){logger[_0xb30e('0x11')](_0xb30e('0xd'),_0x158fa0,_0xc5afe7);_0x1c6bba(_0xc5afe7);});});} \ No newline at end of file +var _0xb187=['debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s'];(function(_0x9978d7,_0x118396){var _0x325558=function(_0x1007af){while(--_0x1007af){_0x9978d7['push'](_0x9978d7['shift']());}};_0x325558(++_0x118396);}(_0xb187,0x161));var _0x7b18=function(_0x4b775b,_0x2aadc6){_0x4b775b=_0x4b775b-0x0;var _0xf84d39=_0xb187[_0x4b775b];return _0xf84d39;};'use strict';var _=require(_0x7b18('0x0'));var util=require(_0x7b18('0x1'));var moment=require(_0x7b18('0x2'));var BPromise=require('bluebird');var rs=require(_0x7b18('0x3'));var fs=require('fs');var Redis=require(_0x7b18('0x4'));var db=require(_0x7b18('0x5'))['db'];var utils=require(_0x7b18('0x6'));var logger=require(_0x7b18('0x7'))(_0x7b18('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7b18('0x9')][_0x7b18('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4017a6,_0x28f986,_0x3a11b4){return new BPromise(function(_0x49fce9,_0x2a5ecb){return client[_0x7b18('0xb')](_0x4017a6,_0x3a11b4)[_0x7b18('0xc')](function(_0x2e73c7){logger[_0x7b18('0xd')](_0x7b18('0xe'),_0x28f986,'request\x20sent');logger[_0x7b18('0xf')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x28f986,'request\x20sent',JSON[_0x7b18('0x10')](_0x2e73c7));if(_0x2e73c7[_0x7b18('0x11')]){if(_0x2e73c7[_0x7b18('0x11')][_0x7b18('0x12')]===0x1f4){logger['error'](_0x7b18('0xe'),_0x28f986,_0x2e73c7[_0x7b18('0x11')][_0x7b18('0x13')]);return _0x2a5ecb(_0x2e73c7['error'][_0x7b18('0x13')]);}logger['error'](_0x7b18('0xe'),_0x28f986,_0x2e73c7['error'][_0x7b18('0x13')]);return _0x49fce9(_0x2e73c7[_0x7b18('0x11')][_0x7b18('0x13')]);}else{logger[_0x7b18('0xd')](_0x7b18('0xe'),_0x28f986,_0x7b18('0x14'));_0x49fce9(_0x2e73c7[_0x7b18('0x15')][_0x7b18('0x13')]);}})[_0x7b18('0x16')](function(_0x20148e){logger['error'](_0x7b18('0xe'),_0x28f986,_0x20148e);_0x2a5ecb(_0x20148e);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index f7f494a..2d86350 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(_0x2e6840,_0x450b55){var _0x232853=function(_0x75383f){while(--_0x75383f){_0x2e6840['push'](_0x2e6840['shift']());}};_0x232853(++_0x450b55);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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(_0x51303b,_0x4f7b7e){var _0x5b255f=function(_0x37d89d){while(--_0x37d89d){_0x51303b['push'](_0x51303b['shift']());}};_0x5b255f(++_0x4f7b7e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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 303a5e9..5461101 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 _0xc3b7=['exports','STRING','name','TEXT'];(function(_0x2a5f59,_0x5172d1){var _0x31ffb2=function(_0x1a5d81){while(--_0x1a5d81){_0x2a5f59['push'](_0x2a5f59['shift']());}};_0x31ffb2(++_0x5172d1);}(_0xc3b7,0xb4));var _0x7c3b=function(_0x1d21a3,_0x419f71){_0x1d21a3=_0x1d21a3-0x0;var _0x2b6136=_0xc3b7[_0x1d21a3];return _0x2b6136;};'use strict';var Sequelize=require('sequelize');module[_0x7c3b('0x0')]={'name':{'type':Sequelize[_0x7c3b('0x1')],'allowNull':![],'unique':_0x7c3b('0x2')},'table':{'type':Sequelize[_0x7c3b('0x1')]},'metric':{'type':Sequelize[_0x7c3b('0x3')]},'description':{'type':Sequelize[_0x7c3b('0x1')]}}; \ No newline at end of file +var _0xc5c0=['sequelize','exports','STRING','TEXT'];(function(_0x4533a6,_0x4794c9){var _0x25bffa=function(_0x2cd4f3){while(--_0x2cd4f3){_0x4533a6['push'](_0x4533a6['shift']());}};_0x25bffa(++_0x4794c9);}(_0xc5c0,0x6c));var _0x0c5c=function(_0x4d0bd1,_0x2f6c78){_0x4d0bd1=_0x4d0bd1-0x0;var _0x45abb0=_0xc5c0[_0x4d0bd1];return _0x45abb0;};'use strict';var Sequelize=require(_0x0c5c('0x0'));module[_0x0c5c('0x1')]={'name':{'type':Sequelize[_0x0c5c('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x0c5c('0x3')]},'description':{'type':Sequelize[_0x0c5c('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 836b727..2b43bd9 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 _0x1cb9=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','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','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','show','params','keys','length','find','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x49f56f,_0x2bf8ec){_0x49f56f=_0x49f56f-0x0;var _0x155a01=_0x1cb9[_0x49f56f];return _0x155a01;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];function respondWithStatusCode(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xcc;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0x19')](_0x4ba2f2);}return _0x366f09[_0x91cb('0x1a')](_0x4ba2f2)[_0x91cb('0x1b')]();};}function respondWithResult(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0xc8;return function(_0x4aae25){if(_0x4aae25){return _0x4a7d45[_0x91cb('0x1a')](_0x4cc6ef)['json'](_0x4aae25);}};}function respondWithFilteredResult(_0x528f73,_0x576369){return function(_0xc3629e){if(_0xc3629e){var _0x347980=typeof _0x576369['offset']===_0x91cb('0x1c')&&typeof _0x576369[_0x91cb('0x1d')]==='undefined';var _0xc594e3=_0xc3629e[_0x91cb('0x1e')];var _0x1cd34b=_0x347980?0x0:_0x576369[_0x91cb('0x1f')];var _0x5cc1c3=_0x347980?_0xc3629e[_0x91cb('0x1e')]:_0x576369[_0x91cb('0x1f')]+_0x576369['limit'];var _0x123847;if(_0x5cc1c3>=_0xc594e3){_0x5cc1c3=_0xc594e3;_0x123847=0xc8;}else{_0x123847=0xce;}_0x528f73['status'](_0x123847);return _0x528f73['set'](_0x91cb('0x20'),_0x1cd34b+'-'+_0x5cc1c3+'/'+_0xc594e3)[_0x91cb('0x21')](_0xc3629e);}return null;};}function patchUpdates(_0x56e409){return function(_0x51a1d5){try{jsonpatch['apply'](_0x51a1d5,_0x56e409,!![]);}catch(_0x438162){return BPromise[_0x91cb('0x22')](_0x438162);}return _0x51a1d5[_0x91cb('0x23')]();};}function saveUpdates(_0x1dbee2,_0x5c6a15){return function(_0x45c4b3){if(_0x45c4b3){return _0x45c4b3[_0x91cb('0x24')](_0x1dbee2)[_0x91cb('0x25')](function(_0x55fa78){return _0x55fa78;});}return null;};}function removeEntity(_0x26f18f,_0x1a7a54){return function(_0x2447e7){if(_0x2447e7){return _0x2447e7[_0x91cb('0x26')]()[_0x91cb('0x25')](function(){var _0x7ad361=_0x2447e7[_0x91cb('0x27')]({'plain':!![]});var _0x423c4f=_0x91cb('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x423c4f,'resourceId':_0x7ad361['id']}})[_0x91cb('0x25')](function(){return _0x2447e7;});})['then'](function(){_0x26f18f[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();});}};}function handleEntityNotFound(_0x318031,_0x5595c5){return function(_0x9b26a6){if(!_0x9b26a6){_0x318031['sendStatus'](0x194);}return _0x9b26a6;};}function handleError(_0x4572f6,_0x308e8c){_0x308e8c=_0x308e8c||0x1f4;return function(_0x3b3ee6){logger[_0x91cb('0x29')](_0x3b3ee6[_0x91cb('0x2a')]);if(_0x3b3ee6['name']){delete _0x3b3ee6[_0x91cb('0x2b')];}_0x4572f6['status'](_0x308e8c)[_0x91cb('0x2c')](_0x3b3ee6);};}exports[_0x91cb('0x2d')]=function(_0x445fe1,_0x4944bd){var _0x775c25={},_0x146e1f={},_0x25bbf9={'count':0x0,'rows':[]};var _0x361e4c=_[_0x91cb('0x2e')](db[_0x91cb('0x2f')][_0x91cb('0x30')],function(_0x3bbde3){return{'name':_0x3bbde3[_0x91cb('0x31')],'type':_0x3bbde3['type'][_0x91cb('0x32')]};});_0x146e1f[_0x91cb('0x33')]=_[_0x91cb('0x2e')](_0x361e4c,_0x91cb('0x2b'));_0x146e1f[_0x91cb('0x34')]=_['keys'](_0x445fe1[_0x91cb('0x34')]);_0x146e1f[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x146e1f[_0x91cb('0x33')],_0x146e1f[_0x91cb('0x34')]);_0x775c25['attributes']=_[_0x91cb('0x36')](_0x146e1f['model'],qs['fields'](_0x445fe1['query'][_0x91cb('0x37')]));_0x775c25['attributes']=_0x775c25[_0x91cb('0x38')]['length']?_0x775c25['attributes']:_0x146e1f[_0x91cb('0x33')];if(!_0x445fe1[_0x91cb('0x34')][_0x91cb('0x39')](_0x91cb('0x3a'))){_0x775c25[_0x91cb('0x1d')]=qs['limit'](_0x445fe1[_0x91cb('0x34')][_0x91cb('0x1d')]);_0x775c25[_0x91cb('0x1f')]=qs[_0x91cb('0x1f')](_0x445fe1['query']['offset']);}_0x775c25[_0x91cb('0x3b')]=qs[_0x91cb('0x3c')](_0x445fe1['query'][_0x91cb('0x3c')]);_0x775c25[_0x91cb('0x3d')]=qs['filters'](_[_0x91cb('0x3e')](_0x445fe1[_0x91cb('0x34')],_0x146e1f['filters']),_0x361e4c);if(_0x445fe1[_0x91cb('0x34')]['filter']){_0x775c25[_0x91cb('0x3d')]=_[_0x91cb('0x3f')](_0x775c25[_0x91cb('0x3d')],{'$or':_[_0x91cb('0x2e')](_0x361e4c,function(_0x51d0ea){if(_0x51d0ea[_0x91cb('0x40')]!=='VIRTUAL'){var _0xa90111={};_0xa90111[_0x51d0ea[_0x91cb('0x2b')]]={'$like':'%'+_0x445fe1['query'][_0x91cb('0x41')]+'%'};return _0xa90111;}})});}_0x775c25=_['merge']({},_0x775c25,_0x445fe1[_0x91cb('0x42')]);var _0x2eac87={'where':_0x775c25[_0x91cb('0x3d')]};return db[_0x91cb('0x2f')]['count'](_0x2eac87)[_0x91cb('0x25')](function(_0x5af0e6){_0x25bbf9[_0x91cb('0x1e')]=_0x5af0e6;if(_0x445fe1[_0x91cb('0x34')][_0x91cb('0x43')]){_0x775c25[_0x91cb('0x44')]=[{'all':!![]}];}return db[_0x91cb('0x2f')][_0x91cb('0x45')](_0x775c25);})[_0x91cb('0x25')](function(_0x3cc4c1){_0x25bbf9['rows']=_0x3cc4c1;return _0x25bbf9;})[_0x91cb('0x25')](respondWithFilteredResult(_0x4944bd,_0x775c25))['catch'](handleError(_0x4944bd,null));};exports[_0x91cb('0x46')]=function(_0x5537a0,_0x335879){var _0x52e82c={'raw':!![],'where':{'id':_0x5537a0[_0x91cb('0x47')]['id']}},_0x138f48={};_0x138f48[_0x91cb('0x33')]=_[_0x91cb('0x48')](db['AnalyticMetric'][_0x91cb('0x30')]);_0x138f48[_0x91cb('0x34')]=_['keys'](_0x5537a0[_0x91cb('0x34')]);_0x138f48[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],_0x138f48[_0x91cb('0x34')]);_0x52e82c[_0x91cb('0x38')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],qs[_0x91cb('0x37')](_0x5537a0['query'][_0x91cb('0x37')]));_0x52e82c[_0x91cb('0x38')]=_0x52e82c[_0x91cb('0x38')][_0x91cb('0x49')]?_0x52e82c[_0x91cb('0x38')]:_0x138f48[_0x91cb('0x33')];if(_0x5537a0[_0x91cb('0x34')][_0x91cb('0x43')]){_0x52e82c['include']=[{'all':!![]}];}_0x52e82c=_[_0x91cb('0x3f')]({},_0x52e82c,_0x5537a0[_0x91cb('0x42')]);return db[_0x91cb('0x2f')][_0x91cb('0x4a')](_0x52e82c)['then'](handleEntityNotFound(_0x335879,null))[_0x91cb('0x25')](respondWithResult(_0x335879,null))[_0x91cb('0x4b')](handleError(_0x335879,null));};exports['create']=function(_0x212473,_0x47cdb7){return db[_0x91cb('0x2f')]['create'](_0x212473['body'],{})['then'](function(_0x98245b){var _0xff3d11=_0x212473[_0x91cb('0x4c')][_0x91cb('0x27')]({'plain':!![]});if(!_0xff3d11)throw new Error(_0x91cb('0x4d'));if(_0xff3d11['role']==='user'){var _0x1d26b8=_0x98245b[_0x91cb('0x27')]({'plain':!![]});var _0x140994=_0x91cb('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x140994,'userProfileId':_0xff3d11['userProfileId']},'raw':!![]})[_0x91cb('0x25')](function(_0x490417){if(_0x490417&&_0x490417[_0x91cb('0x4e')]===0x0){return db['UserProfileResource'][_0x91cb('0x4f')]({'name':_0x1d26b8[_0x91cb('0x2b')],'resourceId':_0x1d26b8['id'],'type':_0x490417[_0x91cb('0x2b')],'sectionId':_0x490417['id']},{})[_0x91cb('0x25')](function(){return _0x98245b;});}else{return _0x98245b;}})[_0x91cb('0x4b')](function(_0x362532){logger[_0x91cb('0x29')](_0x91cb('0x50'),_0x362532);throw _0x362532;});}return _0x98245b;})[_0x91cb('0x25')](respondWithResult(_0x47cdb7,0xc9))[_0x91cb('0x4b')](handleError(_0x47cdb7,null));};exports[_0x91cb('0x24')]=function(_0x5752ed,_0x1e445a){if(_0x5752ed[_0x91cb('0x51')]['id']){delete _0x5752ed['body']['id'];}return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x5752ed['params']['id']}})[_0x91cb('0x25')](handleEntityNotFound(_0x1e445a,null))[_0x91cb('0x25')](saveUpdates(_0x5752ed[_0x91cb('0x51')],null))[_0x91cb('0x25')](respondWithResult(_0x1e445a,null))[_0x91cb('0x4b')](handleError(_0x1e445a,null));};exports[_0x91cb('0x26')]=function(_0x1d4b96,_0x274fff){return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x1d4b96[_0x91cb('0x47')]['id']}})['then'](handleEntityNotFound(_0x274fff,null))[_0x91cb('0x25')](removeEntity(_0x274fff,null))['catch'](handleError(_0x274fff,null));}; \ No newline at end of file +var _0x7fbe=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','AnalyticMetric','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','rows','show','params','create','body','role','user','Metrics','find','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x2e6b16,_0x31c2fb){var _0x185c18=function(_0x52fd7d){while(--_0x52fd7d){_0x2e6b16['push'](_0x2e6b16['shift']());}};_0x185c18(++_0x31c2fb);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x369829,_0x5149ad){_0x369829=_0x369829-0x0;var _0xb9c603=_0x7fbe[_0x369829];return _0xb9c603;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7fb('0x0'));var jsonpatch=require(_0xe7fb('0x1'));var rp=require(_0xe7fb('0x2'));var moment=require(_0xe7fb('0x3'));var BPromise=require(_0xe7fb('0x4'));var Mustache=require(_0xe7fb('0x5'));var util=require(_0xe7fb('0x6'));var path=require(_0xe7fb('0x7'));var sox=require(_0xe7fb('0x8'));var csv=require(_0xe7fb('0x9'));var ejs=require(_0xe7fb('0xa'));var fs=require('fs');var fs_extra=require(_0xe7fb('0xb'));var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0x9'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];function respondWithStatusCode(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xcc;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0x1b')](_0x188e1d);}return _0x2437d4[_0xe7fb('0x1c')](_0x188e1d)['end']();};}function respondWithResult(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0xc8;return function(_0x5573ab){if(_0x5573ab){return _0x278b75[_0xe7fb('0x1c')](_0x2225e5)[_0xe7fb('0x1d')](_0x5573ab);}};}function respondWithFilteredResult(_0x482f7d,_0xa76acf){return function(_0x559129){if(_0x559129){var _0x12fff6=typeof _0xa76acf[_0xe7fb('0x1e')]===_0xe7fb('0x1f')&&typeof _0xa76acf[_0xe7fb('0x20')]==='undefined';var _0x892b0f=_0x559129['count'];var _0x293a47=_0x12fff6?0x0:_0xa76acf['offset'];var _0x1e77fd=_0x12fff6?_0x559129[_0xe7fb('0x21')]:_0xa76acf[_0xe7fb('0x1e')]+_0xa76acf[_0xe7fb('0x20')];var _0x5df1a1;if(_0x1e77fd>=_0x892b0f){_0x1e77fd=_0x892b0f;_0x5df1a1=0xc8;}else{_0x5df1a1=0xce;}_0x482f7d[_0xe7fb('0x1c')](_0x5df1a1);return _0x482f7d['set'](_0xe7fb('0x22'),_0x293a47+'-'+_0x1e77fd+'/'+_0x892b0f)['json'](_0x559129);}return null;};}function patchUpdates(_0x15f7a4){return function(_0x4ea664){try{jsonpatch[_0xe7fb('0x23')](_0x4ea664,_0x15f7a4,!![]);}catch(_0x135624){return BPromise['reject'](_0x135624);}return _0x4ea664[_0xe7fb('0x24')]();};}function saveUpdates(_0x4742bd,_0x3ae8f1){return function(_0x4dcb4b){if(_0x4dcb4b){return _0x4dcb4b[_0xe7fb('0x25')](_0x4742bd)[_0xe7fb('0x26')](function(_0x5da3d9){return _0x5da3d9;});}return null;};}function removeEntity(_0x5bea27,_0x52f08b){return function(_0x35e4db){if(_0x35e4db){return _0x35e4db['destroy']()['then'](function(){var _0x4026b1=_0x35e4db[_0xe7fb('0x27')]({'plain':!![]});var _0x2996ae='Metrics';return db[_0xe7fb('0x28')][_0xe7fb('0x29')]({'where':{'type':_0x2996ae,'resourceId':_0x4026b1['id']}})[_0xe7fb('0x26')](function(){return _0x35e4db;});})[_0xe7fb('0x26')](function(){_0x5bea27[_0xe7fb('0x1c')](0xcc)[_0xe7fb('0x2a')]();});}};}function handleEntityNotFound(_0x380130,_0x59e015){return function(_0x5df9f2){if(!_0x5df9f2){_0x380130[_0xe7fb('0x1b')](0x194);}return _0x5df9f2;};}function handleError(_0x3bdee9,_0xead63){_0xead63=_0xead63||0x1f4;return function(_0x4fd290){logger[_0xe7fb('0x2b')](_0x4fd290[_0xe7fb('0x2c')]);if(_0x4fd290[_0xe7fb('0x2d')]){delete _0x4fd290[_0xe7fb('0x2d')];}_0x3bdee9[_0xe7fb('0x1c')](_0xead63)[_0xe7fb('0x2e')](_0x4fd290);};}exports[_0xe7fb('0x2f')]=function(_0x3dd0be,_0x4ce993){var _0x3d1fb5={},_0x1742f3={},_0x29d1ca={'count':0x0,'rows':[]};var _0x547a04=_['map'](db[_0xe7fb('0x30')]['rawAttributes'],function(_0xac56b4){return{'name':_0xac56b4[_0xe7fb('0x31')],'type':_0xac56b4[_0xe7fb('0x32')][_0xe7fb('0x33')]};});_0x1742f3['model']=_[_0xe7fb('0x34')](_0x547a04,_0xe7fb('0x2d'));_0x1742f3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x3dd0be[_0xe7fb('0x35')]);_0x1742f3['filters']=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],_0x1742f3[_0xe7fb('0x35')]);_0x3d1fb5[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],qs[_0xe7fb('0x3a')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3a')]));_0x3d1fb5['attributes']=_0x3d1fb5[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x3d1fb5[_0xe7fb('0x39')]:_0x1742f3['model'];if(!_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3c')](_0xe7fb('0x3d'))){_0x3d1fb5[_0xe7fb('0x20')]=qs[_0xe7fb('0x20')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x20')]);_0x3d1fb5[_0xe7fb('0x1e')]=qs[_0xe7fb('0x1e')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x1e')]);}_0x3d1fb5[_0xe7fb('0x3e')]=qs[_0xe7fb('0x3f')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3f')]);_0x3d1fb5[_0xe7fb('0x40')]=qs[_0xe7fb('0x41')](_[_0xe7fb('0x42')](_0x3dd0be[_0xe7fb('0x35')],_0x1742f3['filters']),_0x547a04);if(_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]){_0x3d1fb5[_0xe7fb('0x40')]=_[_0xe7fb('0x44')](_0x3d1fb5['where'],{'$or':_[_0xe7fb('0x34')](_0x547a04,function(_0x186418){if(_0x186418[_0xe7fb('0x32')]!==_0xe7fb('0x45')){var _0x49fe9d={};_0x49fe9d[_0x186418[_0xe7fb('0x2d')]]={'$like':'%'+_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]+'%'};return _0x49fe9d;}})});}_0x3d1fb5=_[_0xe7fb('0x44')]({},_0x3d1fb5,_0x3dd0be[_0xe7fb('0x46')]);var _0xb729fc={'where':_0x3d1fb5['where']};return db[_0xe7fb('0x30')][_0xe7fb('0x21')](_0xb729fc)[_0xe7fb('0x26')](function(_0x4b263d){_0x29d1ca[_0xe7fb('0x21')]=_0x4b263d;if(_0x3dd0be[_0xe7fb('0x35')]['includeAll']){_0x3d1fb5['include']=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x3d1fb5);})['then'](function(_0x900d67){_0x29d1ca[_0xe7fb('0x47')]=_0x900d67;return _0x29d1ca;})[_0xe7fb('0x26')](respondWithFilteredResult(_0x4ce993,_0x3d1fb5))['catch'](handleError(_0x4ce993,null));};exports[_0xe7fb('0x48')]=function(_0x58d743,_0x19277f){var _0x32cfa4={'raw':!![],'where':{'id':_0x58d743[_0xe7fb('0x49')]['id']}},_0x4d29d3={};_0x4d29d3[_0xe7fb('0x38')]=_[_0xe7fb('0x36')](db[_0xe7fb('0x30')]['rawAttributes']);_0x4d29d3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x58d743[_0xe7fb('0x35')]);_0x4d29d3['filters']=_[_0xe7fb('0x37')](_0x4d29d3[_0xe7fb('0x38')],_0x4d29d3[_0xe7fb('0x35')]);_0x32cfa4[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x4d29d3['model'],qs[_0xe7fb('0x3a')](_0x58d743['query'][_0xe7fb('0x3a')]));_0x32cfa4[_0xe7fb('0x39')]=_0x32cfa4[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x32cfa4[_0xe7fb('0x39')]:_0x4d29d3['model'];if(_0x58d743[_0xe7fb('0x35')]['includeAll']){_0x32cfa4['include']=[{'all':!![]}];}_0x32cfa4=_[_0xe7fb('0x44')]({},_0x32cfa4,_0x58d743[_0xe7fb('0x46')]);return db[_0xe7fb('0x30')]['find'](_0x32cfa4)[_0xe7fb('0x26')](handleEntityNotFound(_0x19277f,null))[_0xe7fb('0x26')](respondWithResult(_0x19277f,null))['catch'](handleError(_0x19277f,null));};exports['create']=function(_0x284bcb,_0x42270b){return db[_0xe7fb('0x30')][_0xe7fb('0x4a')](_0x284bcb[_0xe7fb('0x4b')],{})[_0xe7fb('0x26')](function(_0x18a590){var _0x347177=_0x284bcb['user'][_0xe7fb('0x27')]({'plain':!![]});if(!_0x347177)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x347177[_0xe7fb('0x4c')]===_0xe7fb('0x4d')){var _0x5cedfb=_0x18a590[_0xe7fb('0x27')]({'plain':!![]});var _0x5efd24=_0xe7fb('0x4e');return db['UserProfileSection'][_0xe7fb('0x4f')]({'where':{'name':_0x5efd24,'userProfileId':_0x347177['userProfileId']},'raw':!![]})[_0xe7fb('0x26')](function(_0x59158c){if(_0x59158c&&_0x59158c[_0xe7fb('0x50')]===0x0){return db[_0xe7fb('0x28')][_0xe7fb('0x4a')]({'name':_0x5cedfb[_0xe7fb('0x2d')],'resourceId':_0x5cedfb['id'],'type':_0x59158c[_0xe7fb('0x2d')],'sectionId':_0x59158c['id']},{})[_0xe7fb('0x26')](function(){return _0x18a590;});}else{return _0x18a590;}})[_0xe7fb('0x51')](function(_0x582a4a){logger['error'](_0xe7fb('0x52'),_0x582a4a);throw _0x582a4a;});}return _0x18a590;})['then'](respondWithResult(_0x42270b,0xc9))['catch'](handleError(_0x42270b,null));};exports['update']=function(_0x50b8df,_0x539252){if(_0x50b8df[_0xe7fb('0x4b')]['id']){delete _0x50b8df[_0xe7fb('0x4b')]['id'];}return db[_0xe7fb('0x30')][_0xe7fb('0x4f')]({'where':{'id':_0x50b8df['params']['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x539252,null))[_0xe7fb('0x26')](saveUpdates(_0x50b8df[_0xe7fb('0x4b')],null))['then'](respondWithResult(_0x539252,null))['catch'](handleError(_0x539252,null));};exports[_0xe7fb('0x29')]=function(_0x377e5f,_0x300b8e){return db['AnalyticMetric'][_0xe7fb('0x4f')]({'where':{'id':_0x377e5f[_0xe7fb('0x49')]['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x300b8e,null))[_0xe7fb('0x26')](removeEntity(_0x300b8e,null))['catch'](handleError(_0x300b8e,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 2237544..6d794ff 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 _0x0272=['request-promise','path','rimraf','exports','lodash','util','api','moment','bluebird'];(function(_0x1ac77b,_0x10ee7a){var _0x161584=function(_0x5a810d){while(--_0x5a810d){_0x1ac77b['push'](_0x1ac77b['shift']());}};_0x161584(++_0x10ee7a);}(_0x0272,0x15a));var _0x2027=function(_0x1b6ae2,_0x4f2f15){_0x1b6ae2=_0x1b6ae2-0x0;var _0xccb53f=_0x0272[_0x1b6ae2];return _0xccb53f;};'use strict';var _=require(_0x2027('0x0'));var util=require(_0x2027('0x1'));var logger=require('../../config/logger')(_0x2027('0x2'));var moment=require(_0x2027('0x3'));var BPromise=require(_0x2027('0x4'));var rp=require(_0x2027('0x5'));var fs=require('fs');var path=require(_0x2027('0x6'));var rimraf=require(_0x2027('0x7'));var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module[_0x2027('0x8')]=function(_0x1ea303,_0x2deefc){return _0x1ea303['define']('AnalyticMetric',attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9206=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','define','AnalyticMetric','analytics_metrics'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x9206,0x176));var _0x6920=function(_0x55efaf,_0x17d618){_0x55efaf=_0x55efaf-0x0;var _0x207bd2=_0x9206[_0x55efaf];return _0x207bd2;};'use strict';var _=require(_0x6920('0x0'));var util=require(_0x6920('0x1'));var logger=require(_0x6920('0x2'))(_0x6920('0x3'));var moment=require(_0x6920('0x4'));var BPromise=require(_0x6920('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6920('0x6'));var config=require(_0x6920('0x7'));var attributes=require('./analyticMetric.attributes');module['exports']=function(_0x41c8c4,_0x4d67d7){return _0x41c8c4[_0x6920('0x8')](_0x6920('0x9'),attributes,{'tableName':_0x6920('0xa'),'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 df33abc..046d429 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 _0xce84=['randomstring','ioredis','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3dc1d8,_0x47221a){var _0x33f5fb=function(_0x356b98){while(--_0x356b98){_0x3dc1d8['push'](_0x3dc1d8['shift']());}};_0x33f5fb(++_0x47221a);}(_0xce84,0x1e0));var _0x4ce8=function(_0x895a8,_0x543b1a){_0x895a8=_0x895a8-0x0;var _0x3e6c30=_0xce84[_0x895a8];return _0x3e6c30;};'use strict';var _=require(_0x4ce8('0x0'));var util=require(_0x4ce8('0x1'));var moment=require(_0x4ce8('0x2'));var BPromise=require(_0x4ce8('0x3'));var rs=require(_0x4ce8('0x4'));var fs=require('fs');var Redis=require(_0x4ce8('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4ce8('0x6'));var jayson=require(_0x4ce8('0x7'));var client=jayson[_0x4ce8('0x8')][_0x4ce8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ed3d9,_0x586a71,_0x4ff769){return new BPromise(function(_0x1491a1,_0x8c9d28){return client[_0x4ce8('0xa')](_0x3ed3d9,_0x4ff769)[_0x4ce8('0xb')](function(_0x1c7ec5){logger[_0x4ce8('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x586a71,_0x4ce8('0xd'));logger[_0x4ce8('0xe')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x586a71,_0x4ce8('0xd'),JSON[_0x4ce8('0xf')](_0x1c7ec5));if(_0x1c7ec5[_0x4ce8('0x10')]){if(_0x1c7ec5[_0x4ce8('0x10')][_0x4ce8('0x11')]===0x1f4){logger['error'](_0x4ce8('0x12'),_0x586a71,_0x1c7ec5[_0x4ce8('0x10')][_0x4ce8('0x13')]);return _0x8c9d28(_0x1c7ec5['error']['message']);}logger[_0x4ce8('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x586a71,_0x1c7ec5[_0x4ce8('0x10')][_0x4ce8('0x13')]);return _0x1491a1(_0x1c7ec5[_0x4ce8('0x10')][_0x4ce8('0x13')]);}else{logger[_0x4ce8('0xc')](_0x4ce8('0x12'),_0x586a71,_0x4ce8('0xd'));_0x1491a1(_0x1c7ec5[_0x4ce8('0x14')][_0x4ce8('0x13')]);}})[_0x4ce8('0x15')](function(_0x12aa0a){logger['error'](_0x4ce8('0x12'),_0x586a71,_0x12aa0a);_0x8c9d28(_0x12aa0a);});});} \ No newline at end of file +var _0x05a7=['../../config/logger','rpc','../../config/environment','http','request','info','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','AnalyticMetric,\x20%s,\x20%s','message','result','lodash','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x3a723e,_0x59d99a){var _0x3e9c03=function(_0x4a6947){while(--_0x4a6947){_0x3a723e['push'](_0x3a723e['shift']());}};_0x3e9c03(++_0x59d99a);}(_0x05a7,0x113));var _0x705a=function(_0x5cfb92,_0x5797e6){_0x5cfb92=_0x5cfb92-0x0;var _0x1cd7c2=_0x05a7[_0x5cfb92];return _0x1cd7c2;};'use strict';var _=require(_0x705a('0x0'));var util=require('util');var moment=require(_0x705a('0x1'));var BPromise=require(_0x705a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x705a('0x3'))['db'];var utils=require(_0x705a('0x4'));var logger=require(_0x705a('0x5'))(_0x705a('0x6'));var config=require(_0x705a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x705a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x398f75,_0x4a953e,_0x27eb98){return new BPromise(function(_0x5a9bd0,_0x57f622){return client[_0x705a('0x9')](_0x398f75,_0x27eb98)['then'](function(_0x101799){logger[_0x705a('0xa')]('AnalyticMetric,\x20%s,\x20%s',_0x4a953e,'request\x20sent');logger[_0x705a('0xb')](_0x705a('0xc'),_0x4a953e,_0x705a('0xd'),JSON[_0x705a('0xe')](_0x101799));if(_0x101799['error']){if(_0x101799['error'][_0x705a('0xf')]===0x1f4){logger[_0x705a('0x10')](_0x705a('0x11'),_0x4a953e,_0x101799[_0x705a('0x10')][_0x705a('0x12')]);return _0x57f622(_0x101799[_0x705a('0x10')][_0x705a('0x12')]);}logger[_0x705a('0x10')](_0x705a('0x11'),_0x4a953e,_0x101799['error'][_0x705a('0x12')]);return _0x5a9bd0(_0x101799[_0x705a('0x10')][_0x705a('0x12')]);}else{logger[_0x705a('0xa')]('AnalyticMetric,\x20%s,\x20%s',_0x4a953e,_0x705a('0xd'));_0x5a9bd0(_0x101799[_0x705a('0x13')][_0x705a('0x12')]);}})['catch'](function(_0xa3ec0b){logger[_0x705a('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x4a953e,_0xa3ec0b);_0x57f622(_0xa3ec0b);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index a6d3614..e403636 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 _0xea44=['put','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x37c9e,_0x5bb916){var _0x124e0b=function(_0x473869){while(--_0x473869){_0x37c9e['push'](_0x37c9e['shift']());}};_0x124e0b(++_0x5bb916);}(_0xea44,0x1a5));var _0x4ea4=function(_0x3c7b6c,_0x49ff86){_0x3c7b6c=_0x3c7b6c-0x0;var _0x128fe2=_0xea44[_0x3c7b6c];return _0x128fe2;};'use strict';var multer=require(_0x4ea4('0x0'));var util=require(_0x4ea4('0x1'));var path=require(_0x4ea4('0x2'));var timeout=require(_0x4ea4('0x3'));var express=require('express');var router=express[_0x4ea4('0x4')]();var fs_extra=require(_0x4ea4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4ea4('0x6'));var config=require(_0x4ea4('0x7'));var controller=require(_0x4ea4('0x8'));router[_0x4ea4('0x9')]('/',auth['isAuthenticated'](),controller[_0x4ea4('0xa')]);router[_0x4ea4('0x9')](_0x4ea4('0xb'),auth[_0x4ea4('0xc')](),controller[_0x4ea4('0xd')]);router[_0x4ea4('0xe')]('/',auth[_0x4ea4('0xc')](),controller[_0x4ea4('0xf')]);router[_0x4ea4('0x10')]('/:id',auth[_0x4ea4('0xc')](),controller['update']);router['delete'](_0x4ea4('0xb'),auth['isAuthenticated'](),controller[_0x4ea4('0x11')]);module[_0x4ea4('0x12')]=router; \ No newline at end of file +var _0x535d=['get','isAuthenticated','/:id','post','create','put','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller'];(function(_0x1c1815,_0x84870e){var _0x547581=function(_0x16acd9){while(--_0x16acd9){_0x1c1815['push'](_0x1c1815['shift']());}};_0x547581(++_0x84870e);}(_0x535d,0xe8));var _0xd535=function(_0x5da05a,_0x27fe46){_0x5da05a=_0x5da05a-0x0;var _0x1888ab=_0x535d[_0x5da05a];return _0x1888ab;};'use strict';var multer=require(_0xd535('0x0'));var util=require(_0xd535('0x1'));var path=require('path');var timeout=require(_0xd535('0x2'));var express=require(_0xd535('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd535('0x4'));var interaction=require(_0xd535('0x5'));var config=require(_0xd535('0x6'));var controller=require(_0xd535('0x7'));router[_0xd535('0x8')]('/',auth[_0xd535('0x9')](),controller['index']);router['get'](_0xd535('0xa'),auth[_0xd535('0x9')](),controller['show']);router[_0xd535('0xb')]('/',auth['isAuthenticated'](),controller[_0xd535('0xc')]);router[_0xd535('0xd')](_0xd535('0xa'),auth[_0xd535('0x9')](),controller['update']);router[_0xd535('0xe')](_0xd535('0xa'),auth[_0xd535('0x9')](),controller[_0xd535('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 842f1df..3c9b304 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 _0x0e6b=['sequelize','TEXT'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x0e6b,0xf0));var _0xb0e6=function(_0x1e2080,_0x53283b){_0x1e2080=_0x1e2080-0x0;var _0x260111=_0x0e6b[_0x1e2080];return _0x260111;};'use strict';var Sequelize=require(_0xb0e6('0x0'));module['exports']={'tree':{'type':Sequelize[_0xb0e6('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x79d5=['sequelize','TEXT'];(function(_0x2641b0,_0x36b5d0){var _0x54731f=function(_0x55e555){while(--_0x55e555){_0x2641b0['push'](_0x2641b0['shift']());}};_0x54731f(++_0x36b5d0);}(_0x79d5,0xa0));var _0x579d=function(_0x409fb8,_0x5ab3d3){_0x409fb8=_0x409fb8-0x0;var _0x278270=_0x79d5[_0x409fb8];return _0x278270;};'use strict';var Sequelize=require(_0x579d('0x0'));module['exports']={'tree':{'type':Sequelize[_0x579d('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 048449b..5aff35e 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 _0xf9cf=['params','keys','rawAttributes','length','options','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','end','offset','limit','count','Content-Range','json','apply','reject','save','then','error','stack','name','send','index','map','AnalyticTreeReport','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch'];(function(_0x3afb5c,_0x54e263){var _0x5c4e71=function(_0x40b6e5){while(--_0x40b6e5){_0x3afb5c['push'](_0x3afb5c['shift']());}};_0x5c4e71(++_0x54e263);}(_0xf9cf,0x97));var _0xff9c=function(_0x192877,_0x24e072){_0x192877=_0x192877-0x0;var _0x372899=_0xf9cf[_0x192877];return _0x372899;};'use strict';var emlformat=require(_0xff9c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xff9c('0x1'));var jsonpatch=require(_0xff9c('0x2'));var rp=require(_0xff9c('0x3'));var moment=require(_0xff9c('0x4'));var BPromise=require(_0xff9c('0x5'));var Mustache=require(_0xff9c('0x6'));var util=require('util');var path=require(_0xff9c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xff9c('0x8'));var _=require(_0xff9c('0x9'));var squel=require(_0xff9c('0xa'));var crypto=require(_0xff9c('0xb'));var jsforce=require(_0xff9c('0xc'));var deskjs=require(_0xff9c('0xd'));var toCsv=require(_0xff9c('0xe'));var querystring=require(_0xff9c('0xf'));var Papa=require('papaparse');var Redis=require(_0xff9c('0x10'));var authService=require(_0xff9c('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xff9c('0x12'));var logger=require(_0xff9c('0x13'))('api');var utils=require(_0xff9c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xff9c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x571096,_0x3ae66f){_0x3ae66f=_0x3ae66f||0xcc;return function(_0x42bddb){if(_0x42bddb){return _0x571096['sendStatus'](_0x3ae66f);}return _0x571096[_0xff9c('0x16')](_0x3ae66f)[_0xff9c('0x17')]();};}function respondWithResult(_0x58a1f9,_0x4663c8){_0x4663c8=_0x4663c8||0xc8;return function(_0x579145){if(_0x579145){return _0x58a1f9[_0xff9c('0x16')](_0x4663c8)['json'](_0x579145);}};}function respondWithFilteredResult(_0x4ecd40,_0x5e5c6d){return function(_0x3b6337){if(_0x3b6337){var _0x259f48=typeof _0x5e5c6d[_0xff9c('0x18')]==='undefined'&&typeof _0x5e5c6d[_0xff9c('0x19')]==='undefined';var _0x4b5e36=_0x3b6337['count'];var _0x22b6cf=_0x259f48?0x0:_0x5e5c6d[_0xff9c('0x18')];var _0x563a74=_0x259f48?_0x3b6337[_0xff9c('0x1a')]:_0x5e5c6d[_0xff9c('0x18')]+_0x5e5c6d[_0xff9c('0x19')];var _0x374b6c;if(_0x563a74>=_0x4b5e36){_0x563a74=_0x4b5e36;_0x374b6c=0xc8;}else{_0x374b6c=0xce;}_0x4ecd40['status'](_0x374b6c);return _0x4ecd40['set'](_0xff9c('0x1b'),_0x22b6cf+'-'+_0x563a74+'/'+_0x4b5e36)[_0xff9c('0x1c')](_0x3b6337);}return null;};}function patchUpdates(_0x45930c){return function(_0x243c40){try{jsonpatch[_0xff9c('0x1d')](_0x243c40,_0x45930c,!![]);}catch(_0x4e8d51){return BPromise[_0xff9c('0x1e')](_0x4e8d51);}return _0x243c40[_0xff9c('0x1f')]();};}function saveUpdates(_0x32e25c,_0x311552){return function(_0x1e3187){if(_0x1e3187){return _0x1e3187['update'](_0x32e25c)['then'](function(_0x2b621b){return _0x2b621b;});}return null;};}function removeEntity(_0x4b51f3,_0x1356c1){return function(_0x9495e8){if(_0x9495e8){return _0x9495e8['destroy']()[_0xff9c('0x20')](function(){_0x4b51f3[_0xff9c('0x16')](0xcc)[_0xff9c('0x17')]();});}};}function handleEntityNotFound(_0x43f2a4,_0x572b4b){return function(_0x129b63){if(!_0x129b63){_0x43f2a4['sendStatus'](0x194);}return _0x129b63;};}function handleError(_0x4b9ed2,_0x59fe96){_0x59fe96=_0x59fe96||0x1f4;return function(_0x46283e){logger[_0xff9c('0x21')](_0x46283e[_0xff9c('0x22')]);if(_0x46283e[_0xff9c('0x23')]){delete _0x46283e[_0xff9c('0x23')];}_0x4b9ed2['status'](_0x59fe96)[_0xff9c('0x24')](_0x46283e);};}exports[_0xff9c('0x25')]=function(_0x279344,_0x11627e){var _0x28c1d5={},_0x4a1b82={},_0x3a8d62={'count':0x0,'rows':[]};var _0x2eb674=_[_0xff9c('0x26')](db[_0xff9c('0x27')]['rawAttributes'],function(_0x1f2e48){return{'name':_0x1f2e48['fieldName'],'type':_0x1f2e48[_0xff9c('0x28')][_0xff9c('0x29')]};});_0x4a1b82[_0xff9c('0x2a')]=_[_0xff9c('0x26')](_0x2eb674,_0xff9c('0x23'));_0x4a1b82[_0xff9c('0x2b')]=_['keys'](_0x279344[_0xff9c('0x2b')]);_0x4a1b82[_0xff9c('0x2c')]=_[_0xff9c('0x2d')](_0x4a1b82[_0xff9c('0x2a')],_0x4a1b82['query']);_0x28c1d5[_0xff9c('0x2e')]=_[_0xff9c('0x2d')](_0x4a1b82[_0xff9c('0x2a')],qs[_0xff9c('0x2f')](_0x279344[_0xff9c('0x2b')][_0xff9c('0x2f')]));_0x28c1d5[_0xff9c('0x2e')]=_0x28c1d5[_0xff9c('0x2e')]['length']?_0x28c1d5[_0xff9c('0x2e')]:_0x4a1b82[_0xff9c('0x2a')];if(!_0x279344['query'][_0xff9c('0x30')](_0xff9c('0x31'))){_0x28c1d5[_0xff9c('0x19')]=qs[_0xff9c('0x19')](_0x279344[_0xff9c('0x2b')][_0xff9c('0x19')]);_0x28c1d5[_0xff9c('0x18')]=qs[_0xff9c('0x18')](_0x279344['query'][_0xff9c('0x18')]);}_0x28c1d5[_0xff9c('0x32')]=qs[_0xff9c('0x33')](_0x279344[_0xff9c('0x2b')][_0xff9c('0x33')]);_0x28c1d5['where']=qs[_0xff9c('0x2c')](_[_0xff9c('0x34')](_0x279344[_0xff9c('0x2b')],_0x4a1b82[_0xff9c('0x2c')]),_0x2eb674);if(_0x279344['query'][_0xff9c('0x35')]){_0x28c1d5[_0xff9c('0x36')]=_[_0xff9c('0x37')](_0x28c1d5[_0xff9c('0x36')],{'$or':_[_0xff9c('0x26')](_0x2eb674,function(_0x471ecd){if(_0x471ecd['type']!==_0xff9c('0x38')){var _0x54c0bf={};_0x54c0bf[_0x471ecd[_0xff9c('0x23')]]={'$like':'%'+_0x279344[_0xff9c('0x2b')][_0xff9c('0x35')]+'%'};return _0x54c0bf;}})});}_0x28c1d5=_['merge']({},_0x28c1d5,_0x279344['options']);var _0x5ac599={'where':_0x28c1d5['where']};return db[_0xff9c('0x27')]['count'](_0x5ac599)[_0xff9c('0x20')](function(_0x323c98){_0x3a8d62[_0xff9c('0x1a')]=_0x323c98;if(_0x279344[_0xff9c('0x2b')][_0xff9c('0x39')]){_0x28c1d5[_0xff9c('0x3a')]=[{'all':!![]}];}return db[_0xff9c('0x27')][_0xff9c('0x3b')](_0x28c1d5);})[_0xff9c('0x20')](function(_0x4ee004){_0x3a8d62[_0xff9c('0x3c')]=_0x4ee004;return _0x3a8d62;})['then'](respondWithFilteredResult(_0x11627e,_0x28c1d5))[_0xff9c('0x3d')](handleError(_0x11627e,null));};exports['show']=function(_0x32e1d7,_0x2a5312){var _0x51d1f6={'raw':!![],'where':{'id':_0x32e1d7[_0xff9c('0x3e')]['id']}},_0x1365e4={};_0x1365e4[_0xff9c('0x2a')]=_[_0xff9c('0x3f')](db[_0xff9c('0x27')][_0xff9c('0x40')]);_0x1365e4[_0xff9c('0x2b')]=_[_0xff9c('0x3f')](_0x32e1d7[_0xff9c('0x2b')]);_0x1365e4[_0xff9c('0x2c')]=_[_0xff9c('0x2d')](_0x1365e4[_0xff9c('0x2a')],_0x1365e4[_0xff9c('0x2b')]);_0x51d1f6[_0xff9c('0x2e')]=_[_0xff9c('0x2d')](_0x1365e4[_0xff9c('0x2a')],qs[_0xff9c('0x2f')](_0x32e1d7[_0xff9c('0x2b')][_0xff9c('0x2f')]));_0x51d1f6[_0xff9c('0x2e')]=_0x51d1f6[_0xff9c('0x2e')][_0xff9c('0x41')]?_0x51d1f6[_0xff9c('0x2e')]:_0x1365e4[_0xff9c('0x2a')];if(_0x32e1d7[_0xff9c('0x2b')]['includeAll']){_0x51d1f6['include']=[{'all':!![]}];}_0x51d1f6=_[_0xff9c('0x37')]({},_0x51d1f6,_0x32e1d7[_0xff9c('0x42')]);return db['AnalyticTreeReport'][_0xff9c('0x43')](_0x51d1f6)[_0xff9c('0x20')](handleEntityNotFound(_0x2a5312,null))[_0xff9c('0x20')](respondWithResult(_0x2a5312,null))[_0xff9c('0x3d')](handleError(_0x2a5312,null));};exports[_0xff9c('0x44')]=function(_0x375783,_0x726b59){return db[_0xff9c('0x27')]['create'](_0x375783[_0xff9c('0x45')],{})['then'](respondWithResult(_0x726b59,0xc9))[_0xff9c('0x3d')](handleError(_0x726b59,null));};exports['update']=function(_0x54713e,_0x276ea7){if(_0x54713e['body']['id']){delete _0x54713e['body']['id'];}return db[_0xff9c('0x27')]['find']({'where':{'id':_0x54713e[_0xff9c('0x3e')]['id']}})[_0xff9c('0x20')](handleEntityNotFound(_0x276ea7,null))[_0xff9c('0x20')](saveUpdates(_0x54713e[_0xff9c('0x45')],null))[_0xff9c('0x20')](respondWithResult(_0x276ea7,null))[_0xff9c('0x3d')](handleError(_0x276ea7,null));};exports[_0xff9c('0x46')]=function(_0x4dd80b,_0x39e8e6){return db['AnalyticTreeReport']['find']({'where':{'id':_0x4dd80b[_0xff9c('0x3e')]['id']}})['then'](handleEntityNotFound(_0x39e8e6,null))[_0xff9c('0x20')](removeEntity(_0x39e8e6,null))['catch'](handleError(_0x39e8e6,null));}; \ No newline at end of file +var _0x6d32=['fields','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','length','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','stack','name','index','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6d32,0xec));var _0x26d3=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x6d32[_0x16b9ed];return _0x66b1f8;};'use strict';var emlformat=require(_0x26d3('0x0'));var rimraf=require(_0x26d3('0x1'));var zipdir=require(_0x26d3('0x2'));var jsonpatch=require(_0x26d3('0x3'));var rp=require(_0x26d3('0x4'));var moment=require('moment');var BPromise=require(_0x26d3('0x5'));var Mustache=require(_0x26d3('0x6'));var util=require(_0x26d3('0x7'));var path=require(_0x26d3('0x8'));var sox=require(_0x26d3('0x9'));var csv=require(_0x26d3('0xa'));var ejs=require(_0x26d3('0xb'));var fs=require('fs');var fs_extra=require(_0x26d3('0xc'));var _=require(_0x26d3('0xd'));var squel=require(_0x26d3('0xe'));var crypto=require(_0x26d3('0xf'));var jsforce=require(_0x26d3('0x10'));var deskjs=require(_0x26d3('0x11'));var toCsv=require(_0x26d3('0xa'));var querystring=require(_0x26d3('0x12'));var Papa=require(_0x26d3('0x13'));var Redis=require(_0x26d3('0x14'));var authService=require(_0x26d3('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x26d3('0x16'));var hardwareService=require(_0x26d3('0x17'));var logger=require(_0x26d3('0x18'))(_0x26d3('0x19'));var utils=require(_0x26d3('0x1a'));var config=require(_0x26d3('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x26d3('0x1c'))['db'];function respondWithStatusCode(_0x499264,_0x3f37bf){_0x3f37bf=_0x3f37bf||0xcc;return function(_0x439723){if(_0x439723){return _0x499264[_0x26d3('0x1d')](_0x3f37bf);}return _0x499264['status'](_0x3f37bf)['end']();};}function respondWithResult(_0x2c0434,_0x95bab0){_0x95bab0=_0x95bab0||0xc8;return function(_0x581f47){if(_0x581f47){return _0x2c0434[_0x26d3('0x1e')](_0x95bab0)[_0x26d3('0x1f')](_0x581f47);}};}function respondWithFilteredResult(_0x52a224,_0x3de04f){return function(_0x47f935){if(_0x47f935){var _0x12e0be=typeof _0x3de04f[_0x26d3('0x20')]===_0x26d3('0x21')&&typeof _0x3de04f[_0x26d3('0x22')]===_0x26d3('0x21');var _0xc26b55=_0x47f935[_0x26d3('0x23')];var _0x5b0caa=_0x12e0be?0x0:_0x3de04f['offset'];var _0x5ec453=_0x12e0be?_0x47f935[_0x26d3('0x23')]:_0x3de04f['offset']+_0x3de04f[_0x26d3('0x22')];var _0x4b281a;if(_0x5ec453>=_0xc26b55){_0x5ec453=_0xc26b55;_0x4b281a=0xc8;}else{_0x4b281a=0xce;}_0x52a224[_0x26d3('0x1e')](_0x4b281a);return _0x52a224[_0x26d3('0x24')](_0x26d3('0x25'),_0x5b0caa+'-'+_0x5ec453+'/'+_0xc26b55)[_0x26d3('0x1f')](_0x47f935);}return null;};}function patchUpdates(_0x266436){return function(_0xb3051e){try{jsonpatch[_0x26d3('0x26')](_0xb3051e,_0x266436,!![]);}catch(_0x4ed25c){return BPromise[_0x26d3('0x27')](_0x4ed25c);}return _0xb3051e['save']();};}function saveUpdates(_0x31ea87,_0x502f41){return function(_0x187785){if(_0x187785){return _0x187785['update'](_0x31ea87)[_0x26d3('0x28')](function(_0x3d2a1a){return _0x3d2a1a;});}return null;};}function removeEntity(_0xe595a9,_0x1e4afd){return function(_0xac1829){if(_0xac1829){return _0xac1829['destroy']()[_0x26d3('0x28')](function(){_0xe595a9[_0x26d3('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x161a5c,_0x15625f){return function(_0x44d098){if(!_0x44d098){_0x161a5c[_0x26d3('0x1d')](0x194);}return _0x44d098;};}function handleError(_0x31fddd,_0x4e2e49){_0x4e2e49=_0x4e2e49||0x1f4;return function(_0x58cb70){logger['error'](_0x58cb70[_0x26d3('0x29')]);if(_0x58cb70['name']){delete _0x58cb70[_0x26d3('0x2a')];}_0x31fddd[_0x26d3('0x1e')](_0x4e2e49)['send'](_0x58cb70);};}exports[_0x26d3('0x2b')]=function(_0x3f0633,_0x317f19){var _0x24c3f8={},_0x332ca3={},_0x2e6d34={'count':0x0,'rows':[]};var _0x3163cf=_['map'](db[_0x26d3('0x2c')][_0x26d3('0x2d')],function(_0x10cc47){return{'name':_0x10cc47[_0x26d3('0x2e')],'type':_0x10cc47[_0x26d3('0x2f')][_0x26d3('0x30')]};});_0x332ca3[_0x26d3('0x31')]=_[_0x26d3('0x32')](_0x3163cf,_0x26d3('0x2a'));_0x332ca3[_0x26d3('0x33')]=_[_0x26d3('0x34')](_0x3f0633[_0x26d3('0x33')]);_0x332ca3[_0x26d3('0x35')]=_[_0x26d3('0x36')](_0x332ca3['model'],_0x332ca3[_0x26d3('0x33')]);_0x24c3f8[_0x26d3('0x37')]=_[_0x26d3('0x36')](_0x332ca3['model'],qs[_0x26d3('0x38')](_0x3f0633[_0x26d3('0x33')]['fields']));_0x24c3f8[_0x26d3('0x37')]=_0x24c3f8[_0x26d3('0x37')]['length']?_0x24c3f8[_0x26d3('0x37')]:_0x332ca3[_0x26d3('0x31')];if(!_0x3f0633['query']['hasOwnProperty']('nolimit')){_0x24c3f8[_0x26d3('0x22')]=qs[_0x26d3('0x22')](_0x3f0633[_0x26d3('0x33')][_0x26d3('0x22')]);_0x24c3f8[_0x26d3('0x20')]=qs[_0x26d3('0x20')](_0x3f0633[_0x26d3('0x33')][_0x26d3('0x20')]);}_0x24c3f8['order']=qs['sort'](_0x3f0633['query'][_0x26d3('0x39')]);_0x24c3f8[_0x26d3('0x3a')]=qs[_0x26d3('0x35')](_[_0x26d3('0x3b')](_0x3f0633['query'],_0x332ca3[_0x26d3('0x35')]),_0x3163cf);if(_0x3f0633[_0x26d3('0x33')][_0x26d3('0x3c')]){_0x24c3f8[_0x26d3('0x3a')]=_[_0x26d3('0x3d')](_0x24c3f8['where'],{'$or':_[_0x26d3('0x32')](_0x3163cf,function(_0x4ae517){if(_0x4ae517['type']!==_0x26d3('0x3e')){var _0xca54ae={};_0xca54ae[_0x4ae517[_0x26d3('0x2a')]]={'$like':'%'+_0x3f0633[_0x26d3('0x33')][_0x26d3('0x3c')]+'%'};return _0xca54ae;}})});}_0x24c3f8=_['merge']({},_0x24c3f8,_0x3f0633['options']);var _0x26f36a={'where':_0x24c3f8['where']};return db[_0x26d3('0x2c')]['count'](_0x26f36a)['then'](function(_0x3d2866){_0x2e6d34[_0x26d3('0x23')]=_0x3d2866;if(_0x3f0633[_0x26d3('0x33')][_0x26d3('0x3f')]){_0x24c3f8[_0x26d3('0x40')]=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x24c3f8);})[_0x26d3('0x28')](function(_0x2ecdc6){_0x2e6d34['rows']=_0x2ecdc6;return _0x2e6d34;})['then'](respondWithFilteredResult(_0x317f19,_0x24c3f8))[_0x26d3('0x41')](handleError(_0x317f19,null));};exports[_0x26d3('0x42')]=function(_0x5d0a9b,_0x27be24){var _0x129fe7={'raw':!![],'where':{'id':_0x5d0a9b['params']['id']}},_0x8aa682={};_0x8aa682[_0x26d3('0x31')]=_['keys'](db[_0x26d3('0x2c')]['rawAttributes']);_0x8aa682[_0x26d3('0x33')]=_[_0x26d3('0x34')](_0x5d0a9b[_0x26d3('0x33')]);_0x8aa682[_0x26d3('0x35')]=_[_0x26d3('0x36')](_0x8aa682[_0x26d3('0x31')],_0x8aa682[_0x26d3('0x33')]);_0x129fe7[_0x26d3('0x37')]=_[_0x26d3('0x36')](_0x8aa682[_0x26d3('0x31')],qs[_0x26d3('0x38')](_0x5d0a9b[_0x26d3('0x33')][_0x26d3('0x38')]));_0x129fe7[_0x26d3('0x37')]=_0x129fe7[_0x26d3('0x37')][_0x26d3('0x43')]?_0x129fe7[_0x26d3('0x37')]:_0x8aa682[_0x26d3('0x31')];if(_0x5d0a9b[_0x26d3('0x33')]['includeAll']){_0x129fe7[_0x26d3('0x40')]=[{'all':!![]}];}_0x129fe7=_[_0x26d3('0x3d')]({},_0x129fe7,_0x5d0a9b[_0x26d3('0x44')]);return db['AnalyticTreeReport'][_0x26d3('0x45')](_0x129fe7)[_0x26d3('0x28')](handleEntityNotFound(_0x27be24,null))['then'](respondWithResult(_0x27be24,null))['catch'](handleError(_0x27be24,null));};exports[_0x26d3('0x46')]=function(_0x4b951f,_0x44f0f7){return db[_0x26d3('0x2c')]['create'](_0x4b951f['body'],{})[_0x26d3('0x28')](respondWithResult(_0x44f0f7,0xc9))[_0x26d3('0x41')](handleError(_0x44f0f7,null));};exports['update']=function(_0x547fa4,_0x1e05f3){if(_0x547fa4[_0x26d3('0x47')]['id']){delete _0x547fa4[_0x26d3('0x47')]['id'];}return db[_0x26d3('0x2c')][_0x26d3('0x45')]({'where':{'id':_0x547fa4[_0x26d3('0x48')]['id']}})['then'](handleEntityNotFound(_0x1e05f3,null))[_0x26d3('0x28')](saveUpdates(_0x547fa4[_0x26d3('0x47')],null))['then'](respondWithResult(_0x1e05f3,null))[_0x26d3('0x41')](handleError(_0x1e05f3,null));};exports['destroy']=function(_0x3fcaf0,_0x4784ff){return db[_0x26d3('0x2c')]['find']({'where':{'id':_0x3fcaf0[_0x26d3('0x48')]['id']}})['then'](handleEntityNotFound(_0x4784ff,null))['then'](removeEntity(_0x4784ff,null))[_0x26d3('0x41')](handleError(_0x4784ff,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 676236f..b0cf79f 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 _0xdff9=['AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define'];(function(_0x4a6b64,_0xacb69e){var _0x86fbc2=function(_0x63fd46){while(--_0x63fd46){_0x4a6b64['push'](_0x4a6b64['shift']());}};_0x86fbc2(++_0xacb69e);}(_0xdff9,0x161));var _0x9dff=function(_0x2c50e5,_0x1ca730){_0x2c50e5=_0x2c50e5-0x0;var _0x4b03bd=_0xdff9[_0x2c50e5];return _0x4b03bd;};'use strict';var _=require(_0x9dff('0x0'));var util=require(_0x9dff('0x1'));var logger=require(_0x9dff('0x2'))(_0x9dff('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9dff('0x4'));var fs=require('fs');var path=require(_0x9dff('0x5'));var rimraf=require(_0x9dff('0x6'));var config=require(_0x9dff('0x7'));var attributes=require(_0x9dff('0x8'));module[_0x9dff('0x9')]=function(_0x190235,_0x40e14d){return _0x190235[_0x9dff('0xa')](_0x9dff('0xb'),attributes,{'tableName':_0x9dff('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5f5=['rimraf','../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','api','bluebird','path'];(function(_0x2aebb2,_0x21f452){var _0x17406c=function(_0x7ae2df){while(--_0x7ae2df){_0x2aebb2['push'](_0x2aebb2['shift']());}};_0x17406c(++_0x21f452);}(_0xa5f5,0xe2));var _0x5a5f=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xa5f5[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0x5a5f('0x0'));var util=require('util');var logger=require(_0x5a5f('0x1'))(_0x5a5f('0x2'));var moment=require('moment');var BPromise=require(_0x5a5f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5a5f('0x4'));var rimraf=require(_0x5a5f('0x5'));var config=require(_0x5a5f('0x6'));var attributes=require(_0x5a5f('0x7'));module[_0x5a5f('0x8')]=function(_0x2b6739,_0x457ab1){return _0x2b6739['define'](_0x5a5f('0x9'),attributes,{'tableName':_0x5a5f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 38cc2c0..c321bb0 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x877d14,_0x2a1398){var _0x4d7bfe=function(_0x46de1f){while(--_0x46de1f){_0x877d14['push'](_0x877d14['shift']());}};_0x4d7bfe(++_0x2a1398);}(_0x5f2f,0x73));var _0xf5f2=function(_0x37e92b,_0x3527c0){_0x37e92b=_0x37e92b-0x0;var _0x390677=_0x5f2f[_0x37e92b];return _0x390677;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +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(_0x3f0573,_0x4029da){var _0x14e625=function(_0x502f51){while(--_0x502f51){_0x3f0573['push'](_0x3f0573['shift']());}};_0x14e625(++_0x4029da);}(_0xdb28,0x106));var _0x8db2=function(_0x2ae3d0,_0x454037){_0x2ae3d0=_0x2ae3d0-0x0;var _0xbfe1d5=_0xdb28[_0x2ae3d0];return _0xbfe1d5;};'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 diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index bb418dc..52dee1f 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 _0xff1c=['isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get'];(function(_0xbc44f7,_0x49ce4b){var _0x1f42ca=function(_0x594267){while(--_0x594267){_0xbc44f7['push'](_0xbc44f7['shift']());}};_0x1f42ca(++_0x49ce4b);}(_0xff1c,0xa2));var _0xcff1=function(_0xed72a2,_0xdacfed){_0xed72a2=_0xed72a2-0x0;var _0x5b0bd6=_0xff1c[_0xed72a2];return _0x5b0bd6;};'use strict';var multer=require(_0xcff1('0x0'));var util=require(_0xcff1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcff1('0x2')]();var fs_extra=require(_0xcff1('0x3'));var auth=require(_0xcff1('0x4'));var interaction=require(_0xcff1('0x5'));var config=require(_0xcff1('0x6'));var controller=require(_0xcff1('0x7'));router[_0xcff1('0x8')]('/',auth[_0xcff1('0x9')](),controller['index']);router[_0xcff1('0x8')]('/:id',auth[_0xcff1('0x9')](),controller[_0xcff1('0xa')]);router[_0xcff1('0xb')]('/',auth[_0xcff1('0x9')](),controller[_0xcff1('0xc')]);router[_0xcff1('0xd')](_0xcff1('0xe'),auth[_0xcff1('0x9')](),controller[_0xcff1('0xf')]);router[_0xcff1('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xcff1('0x11')]);module[_0xcff1('0x12')]=router; \ No newline at end of file +var _0x8319=['put','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x1b7b53,_0x287249){var _0x3a440d=function(_0x23b4e3){while(--_0x23b4e3){_0x1b7b53['push'](_0x1b7b53['shift']());}};_0x3a440d(++_0x287249);}(_0x8319,0x113));var _0x9831=function(_0x21ad00,_0x4bb7ef){_0x21ad00=_0x21ad00-0x0;var _0x157ca2=_0x8319[_0x21ad00];return _0x157ca2;};'use strict';var multer=require('multer');var util=require(_0x9831('0x0'));var path=require(_0x9831('0x1'));var timeout=require(_0x9831('0x2'));var express=require('express');var router=express[_0x9831('0x3')]();var fs_extra=require(_0x9831('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9831('0x5'));var config=require('../../config/environment');var controller=require(_0x9831('0x6'));router[_0x9831('0x7')]('/',auth[_0x9831('0x8')](),controller[_0x9831('0x9')]);router['get'](_0x9831('0xa'),auth[_0x9831('0x8')](),controller[_0x9831('0xb')]);router[_0x9831('0xc')]('/',auth[_0x9831('0x8')](),controller[_0x9831('0xd')]);router[_0x9831('0xe')]('/:id',auth[_0x9831('0x8')](),controller['update']);router['delete'](_0x9831('0xa'),auth[_0x9831('0x8')](),controller[_0x9831('0xf')]);module[_0x9831('0x10')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index ccfda7a..c83c93e 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 _0x121d=['sequelize','exports','STRING'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x121d,0xea));var _0xd121=function(_0x1b5c68,_0x56d052){_0x1b5c68=_0x1b5c68-0x0;var _0x2bd7d1=_0x121d[_0x1b5c68];return _0x2bd7d1;};'use strict';var Sequelize=require(_0xd121('0x0'));module[_0xd121('0x1')]={'name':{'type':Sequelize[_0xd121('0x2')]},'basename':{'type':Sequelize[_0xd121('0x2')]},'type':{'type':Sequelize[_0xd121('0x2')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','sequelize'];(function(_0xe9abdb,_0x382970){var _0x56ec13=function(_0x2c1450){while(--_0x2c1450){_0xe9abdb['push'](_0xe9abdb['shift']());}};_0x56ec13(++_0x382970);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x230bb8,_0xa1718){_0x230bb8=_0x230bb8-0x0;var _0x16cb9a=_0xf3cd[_0x230bb8];return _0x16cb9a;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'name':{'type':Sequelize[_0xdf3c('0x2')]},'basename':{'type':Sequelize[_0xdf3c('0x2')]},'type':{'type':Sequelize[_0xdf3c('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index fea02ab..6105a36 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 _0x497b=['sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','clone','get','omit','createdAt','updatedAt','body','destroy','create','file','originalname','mimetype','findOne','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','update','then','name','send','map','Attachment','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order'];(function(_0xe585ca,_0x375ae0){var _0x1917ec=function(_0x45f32f){while(--_0x45f32f){_0xe585ca['push'](_0xe585ca['shift']());}};_0x1917ec(++_0x375ae0);}(_0x497b,0x124));var _0xb497=function(_0x1ccfd1,_0x4c2ff2){_0x1ccfd1=_0x1ccfd1-0x0;var _0x53474f=_0x497b[_0x1ccfd1];return _0x53474f;};'use strict';var emlformat=require(_0xb497('0x0'));var rimraf=require(_0xb497('0x1'));var zipdir=require(_0xb497('0x2'));var jsonpatch=require(_0xb497('0x3'));var rp=require(_0xb497('0x4'));var moment=require(_0xb497('0x5'));var BPromise=require(_0xb497('0x6'));var Mustache=require(_0xb497('0x7'));var util=require(_0xb497('0x8'));var path=require(_0xb497('0x9'));var sox=require(_0xb497('0xa'));var csv=require('to-csv');var ejs=require(_0xb497('0xb'));var fs=require('fs');var fs_extra=require(_0xb497('0xc'));var _=require('lodash');var squel=require(_0xb497('0xd'));var crypto=require(_0xb497('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb497('0xf'));var querystring=require('querystring');var Papa=require(_0xb497('0x10'));var Redis=require(_0xb497('0x11'));var authService=require(_0xb497('0x12'));var qs=require(_0xb497('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb497('0x14'));var logger=require(_0xb497('0x15'))(_0xb497('0x16'));var utils=require(_0xb497('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb497('0x18'));var db=require(_0xb497('0x19'))['db'];function respondWithStatusCode(_0x2a34c1,_0x30d788){_0x30d788=_0x30d788||0xcc;return function(_0x105fb1){if(_0x105fb1){return _0x2a34c1[_0xb497('0x1a')](_0x30d788);}return _0x2a34c1[_0xb497('0x1b')](_0x30d788)[_0xb497('0x1c')]();};}function respondWithResult(_0x2cf884,_0x40082e){_0x40082e=_0x40082e||0xc8;return function(_0x4bbb36){if(_0x4bbb36){return _0x2cf884[_0xb497('0x1b')](_0x40082e)[_0xb497('0x1d')](_0x4bbb36);}};}function respondWithFilteredResult(_0x2e9edf,_0x3b518e){return function(_0x49acde){if(_0x49acde){var _0x47c545=typeof _0x3b518e[_0xb497('0x1e')]==='undefined'&&typeof _0x3b518e[_0xb497('0x1f')]===_0xb497('0x20');var _0x216fb0=_0x49acde[_0xb497('0x21')];var _0x2ae301=_0x47c545?0x0:_0x3b518e[_0xb497('0x1e')];var _0x4d0e0c=_0x47c545?_0x49acde['count']:_0x3b518e['offset']+_0x3b518e[_0xb497('0x1f')];var _0x5a46a;if(_0x4d0e0c>=_0x216fb0){_0x4d0e0c=_0x216fb0;_0x5a46a=0xc8;}else{_0x5a46a=0xce;}_0x2e9edf['status'](_0x5a46a);return _0x2e9edf[_0xb497('0x22')](_0xb497('0x23'),_0x2ae301+'-'+_0x4d0e0c+'/'+_0x216fb0)[_0xb497('0x1d')](_0x49acde);}return null;};}function patchUpdates(_0x34e37a){return function(_0x301a0a){try{jsonpatch['apply'](_0x301a0a,_0x34e37a,!![]);}catch(_0x524bef){return BPromise['reject'](_0x524bef);}return _0x301a0a[_0xb497('0x24')]();};}function saveUpdates(_0x445008,_0x493665){return function(_0x280390){if(_0x280390){return _0x280390[_0xb497('0x25')](_0x445008)[_0xb497('0x26')](function(_0x350d8b){return _0x350d8b;});}return null;};}function removeEntity(_0x53fefb,_0x329bda){return function(_0x21f5cf){if(_0x21f5cf){return _0x21f5cf['destroy']()[_0xb497('0x26')](function(){_0x53fefb[_0xb497('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a85cb,_0x367840){return function(_0x23f525){if(!_0x23f525){_0x1a85cb['sendStatus'](0x194);}return _0x23f525;};}function handleError(_0x2029a7,_0x132736){_0x132736=_0x132736||0x1f4;return function(_0x27301f){logger['error'](_0x27301f['stack']);if(_0x27301f[_0xb497('0x27')]){delete _0x27301f[_0xb497('0x27')];}_0x2029a7[_0xb497('0x1b')](_0x132736)[_0xb497('0x28')](_0x27301f);};}exports['index']=function(_0x1859a1,_0x8883ee){var _0x3a97ba={},_0x288282={},_0x5d181f={'count':0x0,'rows':[]};var _0x1e48cb=_[_0xb497('0x29')](db[_0xb497('0x2a')]['rawAttributes'],function(_0x2b0584){return{'name':_0x2b0584[_0xb497('0x2b')],'type':_0x2b0584[_0xb497('0x2c')][_0xb497('0x2d')]};});_0x288282['model']=_['map'](_0x1e48cb,_0xb497('0x27'));_0x288282[_0xb497('0x2e')]=_[_0xb497('0x2f')](_0x1859a1[_0xb497('0x2e')]);_0x288282[_0xb497('0x30')]=_[_0xb497('0x31')](_0x288282[_0xb497('0x32')],_0x288282[_0xb497('0x2e')]);_0x3a97ba[_0xb497('0x33')]=_['intersection'](_0x288282['model'],qs[_0xb497('0x34')](_0x1859a1[_0xb497('0x2e')][_0xb497('0x34')]));_0x3a97ba[_0xb497('0x33')]=_0x3a97ba[_0xb497('0x33')][_0xb497('0x35')]?_0x3a97ba[_0xb497('0x33')]:_0x288282['model'];if(!_0x1859a1[_0xb497('0x2e')]['hasOwnProperty'](_0xb497('0x36'))){_0x3a97ba['limit']=qs[_0xb497('0x1f')](_0x1859a1['query'][_0xb497('0x1f')]);_0x3a97ba['offset']=qs[_0xb497('0x1e')](_0x1859a1[_0xb497('0x2e')]['offset']);}_0x3a97ba[_0xb497('0x37')]=qs[_0xb497('0x38')](_0x1859a1['query'][_0xb497('0x38')]);_0x3a97ba[_0xb497('0x39')]=qs['filters'](_[_0xb497('0x3a')](_0x1859a1[_0xb497('0x2e')],_0x288282[_0xb497('0x30')]),_0x1e48cb);if(_0x1859a1[_0xb497('0x2e')]['filter']){_0x3a97ba[_0xb497('0x39')]=_[_0xb497('0x3b')](_0x3a97ba[_0xb497('0x39')],{'$or':_[_0xb497('0x29')](_0x1e48cb,function(_0x33692c){if(_0x33692c['type']!=='VIRTUAL'){var _0x1ff649={};_0x1ff649[_0x33692c[_0xb497('0x27')]]={'$like':'%'+_0x1859a1['query'][_0xb497('0x3c')]+'%'};return _0x1ff649;}})});}_0x3a97ba=_[_0xb497('0x3b')]({},_0x3a97ba,_0x1859a1[_0xb497('0x3d')]);var _0x2ed72a={'where':_0x3a97ba['where']};return db[_0xb497('0x2a')][_0xb497('0x21')](_0x2ed72a)['then'](function(_0x4ee727){_0x5d181f[_0xb497('0x21')]=_0x4ee727;if(_0x1859a1['query'][_0xb497('0x3e')]){_0x3a97ba[_0xb497('0x3f')]=[{'all':!![]}];}return db[_0xb497('0x2a')][_0xb497('0x40')](_0x3a97ba);})['then'](function(_0x3f7f1c){_0x5d181f[_0xb497('0x41')]=_0x3f7f1c;return _0x5d181f;})['then'](respondWithFilteredResult(_0x8883ee,_0x3a97ba))[_0xb497('0x42')](handleError(_0x8883ee,null));};exports[_0xb497('0x43')]=function(_0x35b03b,_0x33db60){var _0x344e43={'raw':!![],'where':{'id':_0x35b03b[_0xb497('0x44')]['id']}},_0x1d68d3={};_0x1d68d3[_0xb497('0x32')]=_[_0xb497('0x2f')](db[_0xb497('0x2a')][_0xb497('0x45')]);_0x1d68d3['query']=_['keys'](_0x35b03b[_0xb497('0x2e')]);_0x1d68d3[_0xb497('0x30')]=_[_0xb497('0x31')](_0x1d68d3[_0xb497('0x32')],_0x1d68d3[_0xb497('0x2e')]);_0x344e43['attributes']=_[_0xb497('0x31')](_0x1d68d3[_0xb497('0x32')],qs[_0xb497('0x34')](_0x35b03b[_0xb497('0x2e')][_0xb497('0x34')]));_0x344e43[_0xb497('0x33')]=_0x344e43[_0xb497('0x33')][_0xb497('0x35')]?_0x344e43[_0xb497('0x33')]:_0x1d68d3[_0xb497('0x32')];if(_0x35b03b[_0xb497('0x2e')]['includeAll']){_0x344e43['include']=[{'all':!![]}];}_0x344e43=_['merge']({},_0x344e43,_0x35b03b['options']);return db[_0xb497('0x2a')]['find'](_0x344e43)[_0xb497('0x26')](handleEntityNotFound(_0x33db60,null))['then'](respondWithResult(_0x33db60,null))[_0xb497('0x42')](handleError(_0x33db60,null));};exports[_0xb497('0x46')]=function(_0x1b720f,_0x527f5e){var _0x1edf99={'where':{'id':_0x1b720f[_0xb497('0x44')]['id']}},_0xb4325b={};_0xb4325b[_0xb497('0x32')]=_[_0xb497('0x2f')](db['Attachment'][_0xb497('0x45')]);_0x1edf99[_0xb497('0x33')]=_[_0xb497('0x31')](_0xb4325b[_0xb497('0x32')],qs[_0xb497('0x34')](_0x1b720f[_0xb497('0x2e')][_0xb497('0x34')]));_0x1edf99[_0xb497('0x33')]=_0x1edf99[_0xb497('0x33')][_0xb497('0x35')]?_0x1edf99[_0xb497('0x33')]:_0xb4325b[_0xb497('0x32')];if(_0x1b720f['query']['includeAll']){_0x1edf99[_0xb497('0x3f')]=[{'all':!![]}];}_0x1edf99=_[_0xb497('0x3b')]({},_0x1edf99,_0x1b720f['options']);return db[_0xb497('0x2a')]['find'](_0x1edf99)['then'](handleEntityNotFound(_0x527f5e,null))[_0xb497('0x26')](function(_0x33dd45){if(_0x33dd45){var _0x590ab6=_0x33dd45[_0xb497('0x47')]({'plain':!![]});_0x590ab6=qs[_0xb497('0x48')](_0x590ab6,['id',_0xb497('0x49'),_0xb497('0x4a')]);_0x1b720f[_0xb497('0x4b')]=_[_0xb497('0x48')](_0x1b720f[_0xb497('0x4b')],['id','createdAt','updatedAt']);return db[_0xb497('0x2a')]['create'](_['merge'](_0x590ab6,_0x1b720f[_0xb497('0x4b')]),{'include':_0x1b720f[_0xb497('0x2e')][_0xb497('0x3e')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x527f5e,0xc9))[_0xb497('0x42')](handleError(_0x527f5e,null));};exports[_0xb497('0x25')]=function(_0x4bd5cb,_0x24f8b6){if(_0x4bd5cb[_0xb497('0x4b')]['id']){delete _0x4bd5cb[_0xb497('0x4b')]['id'];}return db[_0xb497('0x2a')]['find']({'where':{'id':_0x4bd5cb[_0xb497('0x44')]['id']}})['then'](handleEntityNotFound(_0x24f8b6,null))['then'](saveUpdates(_0x4bd5cb[_0xb497('0x4b')],null))[_0xb497('0x26')](respondWithResult(_0x24f8b6,null))[_0xb497('0x42')](handleError(_0x24f8b6,null));};exports[_0xb497('0x4c')]=function(_0x2c68e2,_0x49d0b2){return db[_0xb497('0x2a')]['find']({'where':{'id':_0x2c68e2[_0xb497('0x44')]['id']}})[_0xb497('0x26')](handleEntityNotFound(_0x49d0b2,null))[_0xb497('0x26')](removeEntity(_0x49d0b2,null))[_0xb497('0x42')](handleError(_0x49d0b2,null));};exports[_0xb497('0x4d')]=function(_0x3399c3,_0x2d245e,_0x101665){_0x3399c3['body'][_0xb497('0x27')]=_0x3399c3[_0xb497('0x4e')][_0xb497('0x4f')];_0x3399c3['body']['basename']=_0x3399c3[_0xb497('0x4e')]['filename'];_0x3399c3[_0xb497('0x4b')][_0xb497('0x2c')]=_0x3399c3['file'][_0xb497('0x50')];return db[_0xb497('0x2a')][_0xb497('0x4d')](_0x3399c3['body'])['then'](respondWithResult(_0x2d245e,0xc9))['catch'](handleError(_0x2d245e,null));};exports['download']=function(_0x5ef223,_0xf4a8d8,_0x5d2e32){return db[_0xb497('0x2a')][_0xb497('0x51')]({'where':{'id':_0x5ef223[_0xb497('0x44')]['id']},'raw':!![]})[_0xb497('0x26')](handleEntityNotFound(_0xf4a8d8,null))[_0xb497('0x26')](function(_0x5a22bd){if(_0x5a22bd){var _0x2afacb=_0x5a22bd[_0xb497('0x52')]!==null;var _0x20e4a8=path[_0xb497('0x53')](config['root'],_0xb497('0x54'));if(_0x2afacb){_0x20e4a8=path[_0xb497('0x53')](_0x20e4a8,_0xb497('0x55'));}var _0x4e4f96=path['join'](_0x20e4a8,_0x5a22bd[_0xb497('0x56')]);return _0xf4a8d8['download'](_0x4e4f96);}})['catch'](handleError(_0xf4a8d8,null));}; \ No newline at end of file +var _0xbf29=['count','offset','set','Content-Range','apply','reject','then','destroy','sendStatus','error','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','Attachment','include','rows','catch','show','params','length','includeAll','find','get','createdAt','updatedAt','body','omit','create','file','originalname','basename','filename','ChatOfflineMessageId','join','root','server/files/attachments/','download','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','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','status','end','json','undefined','limit'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xbf29,0x19d));var _0x9bf2=function(_0x3caa7c,_0x5eab01){_0x3caa7c=_0x3caa7c-0x0;var _0x5e90a3=_0xbf29[_0x3caa7c];return _0x5e90a3;};'use strict';var emlformat=require(_0x9bf2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9bf2('0x1'));var jsonpatch=require(_0x9bf2('0x2'));var rp=require(_0x9bf2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9bf2('0x4'));var util=require(_0x9bf2('0x5'));var path=require(_0x9bf2('0x6'));var sox=require(_0x9bf2('0x7'));var csv=require(_0x9bf2('0x8'));var ejs=require(_0x9bf2('0x9'));var fs=require('fs');var fs_extra=require(_0x9bf2('0xa'));var _=require(_0x9bf2('0xb'));var squel=require(_0x9bf2('0xc'));var crypto=require(_0x9bf2('0xd'));var jsforce=require(_0x9bf2('0xe'));var deskjs=require(_0x9bf2('0xf'));var toCsv=require(_0x9bf2('0x8'));var querystring=require('querystring');var Papa=require(_0x9bf2('0x10'));var Redis=require(_0x9bf2('0x11'));var authService=require(_0x9bf2('0x12'));var qs=require(_0x9bf2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9bf2('0x14'));var logger=require(_0x9bf2('0x15'))(_0x9bf2('0x16'));var utils=require(_0x9bf2('0x17'));var config=require(_0x9bf2('0x18'));var licenseUtil=require(_0x9bf2('0x19'));var db=require(_0x9bf2('0x1a'))['db'];function respondWithStatusCode(_0x839e7,_0x57a874){_0x57a874=_0x57a874||0xcc;return function(_0x98faeb){if(_0x98faeb){return _0x839e7['sendStatus'](_0x57a874);}return _0x839e7[_0x9bf2('0x1b')](_0x57a874)[_0x9bf2('0x1c')]();};}function respondWithResult(_0xd74f3b,_0x1b1c05){_0x1b1c05=_0x1b1c05||0xc8;return function(_0x165c49){if(_0x165c49){return _0xd74f3b[_0x9bf2('0x1b')](_0x1b1c05)[_0x9bf2('0x1d')](_0x165c49);}};}function respondWithFilteredResult(_0x2c0093,_0xdfc53f){return function(_0x430068){if(_0x430068){var _0x33c1f4=typeof _0xdfc53f['offset']===_0x9bf2('0x1e')&&typeof _0xdfc53f[_0x9bf2('0x1f')]===_0x9bf2('0x1e');var _0x2c5ee1=_0x430068[_0x9bf2('0x20')];var _0x172f92=_0x33c1f4?0x0:_0xdfc53f[_0x9bf2('0x21')];var _0x35c9a9=_0x33c1f4?_0x430068[_0x9bf2('0x20')]:_0xdfc53f['offset']+_0xdfc53f[_0x9bf2('0x1f')];var _0xd3ea3e;if(_0x35c9a9>=_0x2c5ee1){_0x35c9a9=_0x2c5ee1;_0xd3ea3e=0xc8;}else{_0xd3ea3e=0xce;}_0x2c0093['status'](_0xd3ea3e);return _0x2c0093[_0x9bf2('0x22')](_0x9bf2('0x23'),_0x172f92+'-'+_0x35c9a9+'/'+_0x2c5ee1)[_0x9bf2('0x1d')](_0x430068);}return null;};}function patchUpdates(_0x181bfc){return function(_0x257f36){try{jsonpatch[_0x9bf2('0x24')](_0x257f36,_0x181bfc,!![]);}catch(_0x17b5b6){return BPromise[_0x9bf2('0x25')](_0x17b5b6);}return _0x257f36['save']();};}function saveUpdates(_0x114e97,_0x5beaf5){return function(_0x29f397){if(_0x29f397){return _0x29f397['update'](_0x114e97)[_0x9bf2('0x26')](function(_0x316d6b){return _0x316d6b;});}return null;};}function removeEntity(_0x5be9ac,_0x3c003f){return function(_0x79a835){if(_0x79a835){return _0x79a835[_0x9bf2('0x27')]()['then'](function(){_0x5be9ac['status'](0xcc)[_0x9bf2('0x1c')]();});}};}function handleEntityNotFound(_0x489192,_0xe8d178){return function(_0x1671eb){if(!_0x1671eb){_0x489192[_0x9bf2('0x28')](0x194);}return _0x1671eb;};}function handleError(_0x227ecc,_0x286c8a){_0x286c8a=_0x286c8a||0x1f4;return function(_0x35974e){logger[_0x9bf2('0x29')](_0x35974e['stack']);if(_0x35974e[_0x9bf2('0x2a')]){delete _0x35974e['name'];}_0x227ecc[_0x9bf2('0x1b')](_0x286c8a)['send'](_0x35974e);};}exports[_0x9bf2('0x2b')]=function(_0xaba6c9,_0x5ee754){var _0x1ff510={},_0x7b434a={},_0x34f706={'count':0x0,'rows':[]};var _0x2bede6=_[_0x9bf2('0x2c')](db['Attachment'][_0x9bf2('0x2d')],function(_0x83ee5a){return{'name':_0x83ee5a[_0x9bf2('0x2e')],'type':_0x83ee5a['type'][_0x9bf2('0x2f')]};});_0x7b434a[_0x9bf2('0x30')]=_['map'](_0x2bede6,_0x9bf2('0x2a'));_0x7b434a[_0x9bf2('0x31')]=_[_0x9bf2('0x32')](_0xaba6c9['query']);_0x7b434a[_0x9bf2('0x33')]=_[_0x9bf2('0x34')](_0x7b434a['model'],_0x7b434a[_0x9bf2('0x31')]);_0x1ff510['attributes']=_[_0x9bf2('0x34')](_0x7b434a['model'],qs[_0x9bf2('0x35')](_0xaba6c9[_0x9bf2('0x31')][_0x9bf2('0x35')]));_0x1ff510[_0x9bf2('0x36')]=_0x1ff510[_0x9bf2('0x36')]['length']?_0x1ff510['attributes']:_0x7b434a[_0x9bf2('0x30')];if(!_0xaba6c9[_0x9bf2('0x31')][_0x9bf2('0x37')](_0x9bf2('0x38'))){_0x1ff510[_0x9bf2('0x1f')]=qs[_0x9bf2('0x1f')](_0xaba6c9[_0x9bf2('0x31')]['limit']);_0x1ff510['offset']=qs[_0x9bf2('0x21')](_0xaba6c9[_0x9bf2('0x31')][_0x9bf2('0x21')]);}_0x1ff510[_0x9bf2('0x39')]=qs[_0x9bf2('0x3a')](_0xaba6c9['query'][_0x9bf2('0x3a')]);_0x1ff510[_0x9bf2('0x3b')]=qs['filters'](_['pick'](_0xaba6c9['query'],_0x7b434a['filters']),_0x2bede6);if(_0xaba6c9[_0x9bf2('0x31')][_0x9bf2('0x3c')]){_0x1ff510[_0x9bf2('0x3b')]=_[_0x9bf2('0x3d')](_0x1ff510['where'],{'$or':_[_0x9bf2('0x2c')](_0x2bede6,function(_0x3ca6b3){if(_0x3ca6b3[_0x9bf2('0x3e')]!==_0x9bf2('0x3f')){var _0x16aa4e={};_0x16aa4e[_0x3ca6b3['name']]={'$like':'%'+_0xaba6c9[_0x9bf2('0x31')]['filter']+'%'};return _0x16aa4e;}})});}_0x1ff510=_['merge']({},_0x1ff510,_0xaba6c9[_0x9bf2('0x40')]);var _0x651cd7={'where':_0x1ff510[_0x9bf2('0x3b')]};return db[_0x9bf2('0x41')][_0x9bf2('0x20')](_0x651cd7)['then'](function(_0x4dc4a7){_0x34f706[_0x9bf2('0x20')]=_0x4dc4a7;if(_0xaba6c9[_0x9bf2('0x31')]['includeAll']){_0x1ff510[_0x9bf2('0x42')]=[{'all':!![]}];}return db[_0x9bf2('0x41')]['findAll'](_0x1ff510);})[_0x9bf2('0x26')](function(_0x282264){_0x34f706[_0x9bf2('0x43')]=_0x282264;return _0x34f706;})[_0x9bf2('0x26')](respondWithFilteredResult(_0x5ee754,_0x1ff510))[_0x9bf2('0x44')](handleError(_0x5ee754,null));};exports[_0x9bf2('0x45')]=function(_0x4c6d4b,_0x3d07b9){var _0x102e9c={'raw':!![],'where':{'id':_0x4c6d4b[_0x9bf2('0x46')]['id']}},_0x372014={};_0x372014[_0x9bf2('0x30')]=_[_0x9bf2('0x32')](db['Attachment'][_0x9bf2('0x2d')]);_0x372014['query']=_['keys'](_0x4c6d4b['query']);_0x372014[_0x9bf2('0x33')]=_['intersection'](_0x372014[_0x9bf2('0x30')],_0x372014[_0x9bf2('0x31')]);_0x102e9c[_0x9bf2('0x36')]=_[_0x9bf2('0x34')](_0x372014['model'],qs['fields'](_0x4c6d4b[_0x9bf2('0x31')][_0x9bf2('0x35')]));_0x102e9c[_0x9bf2('0x36')]=_0x102e9c[_0x9bf2('0x36')][_0x9bf2('0x47')]?_0x102e9c[_0x9bf2('0x36')]:_0x372014[_0x9bf2('0x30')];if(_0x4c6d4b[_0x9bf2('0x31')][_0x9bf2('0x48')]){_0x102e9c[_0x9bf2('0x42')]=[{'all':!![]}];}_0x102e9c=_['merge']({},_0x102e9c,_0x4c6d4b[_0x9bf2('0x40')]);return db[_0x9bf2('0x41')][_0x9bf2('0x49')](_0x102e9c)[_0x9bf2('0x26')](handleEntityNotFound(_0x3d07b9,null))[_0x9bf2('0x26')](respondWithResult(_0x3d07b9,null))[_0x9bf2('0x44')](handleError(_0x3d07b9,null));};exports['clone']=function(_0x51561e,_0x2d7cbd){var _0x4b2a8a={'where':{'id':_0x51561e['params']['id']}},_0x2d7d7d={};_0x2d7d7d[_0x9bf2('0x30')]=_[_0x9bf2('0x32')](db[_0x9bf2('0x41')][_0x9bf2('0x2d')]);_0x4b2a8a[_0x9bf2('0x36')]=_[_0x9bf2('0x34')](_0x2d7d7d[_0x9bf2('0x30')],qs[_0x9bf2('0x35')](_0x51561e[_0x9bf2('0x31')][_0x9bf2('0x35')]));_0x4b2a8a['attributes']=_0x4b2a8a[_0x9bf2('0x36')]['length']?_0x4b2a8a[_0x9bf2('0x36')]:_0x2d7d7d['model'];if(_0x51561e['query'][_0x9bf2('0x48')]){_0x4b2a8a['include']=[{'all':!![]}];}_0x4b2a8a=_['merge']({},_0x4b2a8a,_0x51561e[_0x9bf2('0x40')]);return db['Attachment'][_0x9bf2('0x49')](_0x4b2a8a)[_0x9bf2('0x26')](handleEntityNotFound(_0x2d7cbd,null))[_0x9bf2('0x26')](function(_0x4bfbe3){if(_0x4bfbe3){var _0x3715fe=_0x4bfbe3[_0x9bf2('0x4a')]({'plain':!![]});_0x3715fe=qs['omit'](_0x3715fe,['id',_0x9bf2('0x4b'),_0x9bf2('0x4c')]);_0x51561e[_0x9bf2('0x4d')]=_[_0x9bf2('0x4e')](_0x51561e[_0x9bf2('0x4d')],['id',_0x9bf2('0x4b'),_0x9bf2('0x4c')]);return db['Attachment'][_0x9bf2('0x4f')](_['merge'](_0x3715fe,_0x51561e[_0x9bf2('0x4d')]),{'include':_0x51561e['query'][_0x9bf2('0x48')]?[{'all':!![]}]:undefined});}})[_0x9bf2('0x26')](respondWithResult(_0x2d7cbd,0xc9))[_0x9bf2('0x44')](handleError(_0x2d7cbd,null));};exports['update']=function(_0x28d18c,_0x549eb3){if(_0x28d18c[_0x9bf2('0x4d')]['id']){delete _0x28d18c[_0x9bf2('0x4d')]['id'];}return db[_0x9bf2('0x41')][_0x9bf2('0x49')]({'where':{'id':_0x28d18c[_0x9bf2('0x46')]['id']}})['then'](handleEntityNotFound(_0x549eb3,null))[_0x9bf2('0x26')](saveUpdates(_0x28d18c['body'],null))[_0x9bf2('0x26')](respondWithResult(_0x549eb3,null))[_0x9bf2('0x44')](handleError(_0x549eb3,null));};exports[_0x9bf2('0x27')]=function(_0x9e48d7,_0x4098e7){return db[_0x9bf2('0x41')][_0x9bf2('0x49')]({'where':{'id':_0x9e48d7[_0x9bf2('0x46')]['id']}})[_0x9bf2('0x26')](handleEntityNotFound(_0x4098e7,null))[_0x9bf2('0x26')](removeEntity(_0x4098e7,null))['catch'](handleError(_0x4098e7,null));};exports[_0x9bf2('0x4f')]=function(_0x2c4f25,_0x3faf2f,_0x200b8f){_0x2c4f25['body'][_0x9bf2('0x2a')]=_0x2c4f25[_0x9bf2('0x50')][_0x9bf2('0x51')];_0x2c4f25[_0x9bf2('0x4d')][_0x9bf2('0x52')]=_0x2c4f25['file'][_0x9bf2('0x53')];_0x2c4f25[_0x9bf2('0x4d')][_0x9bf2('0x3e')]=_0x2c4f25[_0x9bf2('0x50')]['mimetype'];return db[_0x9bf2('0x41')][_0x9bf2('0x4f')](_0x2c4f25['body'])['then'](respondWithResult(_0x3faf2f,0xc9))[_0x9bf2('0x44')](handleError(_0x3faf2f,null));};exports['download']=function(_0x261f5a,_0x151302,_0x97b594){return db[_0x9bf2('0x41')]['findOne']({'where':{'id':_0x261f5a[_0x9bf2('0x46')]['id']},'raw':!![]})[_0x9bf2('0x26')](handleEntityNotFound(_0x151302,null))['then'](function(_0x3c7c4c){if(_0x3c7c4c){var _0x22ccf7=_0x3c7c4c[_0x9bf2('0x54')]!==null;var _0x540b55=path[_0x9bf2('0x55')](config[_0x9bf2('0x56')],_0x9bf2('0x57'));if(_0x22ccf7){_0x540b55=path[_0x9bf2('0x55')](_0x540b55,'offline-chat/');}var _0x58cd7f=path[_0x9bf2('0x55')](_0x540b55,_0x3c7c4c[_0x9bf2('0x52')]);return _0x151302[_0x9bf2('0x58')](_0x58cd7f);}})[_0x9bf2('0x44')](handleError(_0x151302,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 4ac053b..cb8bbc4 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 _0xe1c4=['path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','../../config/logger','api','moment','bluebird'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe1c4,0x1f4));var _0x4e1c=function(_0x1ccf6d,_0x1d7da6){_0x1ccf6d=_0x1ccf6d-0x0;var _0x23722d=_0xe1c4[_0x1ccf6d];return _0x23722d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4e1c('0x0'))(_0x4e1c('0x1'));var moment=require(_0x4e1c('0x2'));var BPromise=require(_0x4e1c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e1c('0x4'));var rimraf=require(_0x4e1c('0x5'));var config=require(_0x4e1c('0x6'));var attributes=require(_0x4e1c('0x7'));module[_0x4e1c('0x8')]=function(_0x45d7e7,_0x14e57c){return _0x45d7e7[_0x4e1c('0x9')](_0x4e1c('0xa'),attributes,{'tableName':_0x4e1c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdf9=['attachments','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./attachment.attributes','exports','Attachment'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xfdf9,0x1ae));var _0x9fdf=function(_0x2c4050,_0x1c56eb){_0x2c4050=_0x2c4050-0x0;var _0x536ef4=_0xfdf9[_0x2c4050];return _0x536ef4;};'use strict';var _=require(_0x9fdf('0x0'));var util=require(_0x9fdf('0x1'));var logger=require(_0x9fdf('0x2'))(_0x9fdf('0x3'));var moment=require('moment');var BPromise=require(_0x9fdf('0x4'));var rp=require(_0x9fdf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9fdf('0x6'));var attributes=require(_0x9fdf('0x7'));module[_0x9fdf('0x8')]=function(_0xdaf153,_0x51ec43){return _0xdaf153['define'](_0x9fdf('0x9'),attributes,{'tableName':_0x9fdf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index bf0edfd..26f079e 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 _0xa0bc=['options','raw','debug','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateAttachment','create','body'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xca0b('0x0'));var moment=require(_0xca0b('0x1'));var BPromise=require('bluebird');var rs=require(_0xca0b('0x2'));var fs=require('fs');var Redis=require(_0xca0b('0x3'));var db=require(_0xca0b('0x4'))['db'];var utils=require(_0xca0b('0x5'));var logger=require(_0xca0b('0x6'))(_0xca0b('0x7'));var config=require(_0xca0b('0x8'));var jayson=require(_0xca0b('0x9'));var client=jayson[_0xca0b('0xa')][_0xca0b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbe64c7,_0x30202d,_0xa506a4){return new BPromise(function(_0x19acc2,_0x55a1de){return client[_0xca0b('0xc')](_0xbe64c7,_0xa506a4)[_0xca0b('0xd')](function(_0x3e3909){logger[_0xca0b('0xe')](_0xca0b('0xf'),_0x30202d,_0xca0b('0x10'));logger['debug'](_0xca0b('0x11'),_0x30202d,_0xca0b('0x10'),JSON[_0xca0b('0x12')](_0x3e3909));if(_0x3e3909[_0xca0b('0x13')]){if(_0x3e3909[_0xca0b('0x13')][_0xca0b('0x14')]===0x1f4){logger[_0xca0b('0x13')](_0xca0b('0xf'),_0x30202d,_0x3e3909[_0xca0b('0x13')][_0xca0b('0x15')]);return _0x55a1de(_0x3e3909['error'][_0xca0b('0x15')]);}logger[_0xca0b('0x13')](_0xca0b('0xf'),_0x30202d,_0x3e3909['error'][_0xca0b('0x15')]);return _0x19acc2(_0x3e3909[_0xca0b('0x13')][_0xca0b('0x15')]);}else{logger[_0xca0b('0xe')](_0xca0b('0xf'),_0x30202d,_0xca0b('0x10'));_0x19acc2(_0x3e3909['result'][_0xca0b('0x15')]);}})[_0xca0b('0x16')](function(_0x4d9b16){logger[_0xca0b('0x13')]('Attachment,\x20%s,\x20%s',_0x30202d,_0x4d9b16);_0x55a1de(_0x4d9b16);});});}exports[_0xca0b('0x17')]=function(_0x5050b7){var _0x236503=this;return new Promise(function(_0x32eff7,_0x97be82){return db['Attachment'][_0xca0b('0x18')](_0x5050b7[_0xca0b('0x19')],{'raw':_0x5050b7['options']?_0x5050b7[_0xca0b('0x1a')][_0xca0b('0x1b')]===undefined?!![]:![]:!![]})[_0xca0b('0xd')](function(_0x59bda9){logger[_0xca0b('0xe')](_0xca0b('0x17'),_0x5050b7);logger[_0xca0b('0x1c')](_0xca0b('0x17'),_0x5050b7,JSON[_0xca0b('0x12')](_0x59bda9));_0x32eff7(_0x59bda9);})[_0xca0b('0x16')](function(_0x49e695){logger[_0xca0b('0x13')](_0xca0b('0x17'),_0x49e695[_0xca0b('0x15')],_0x5050b7);_0x97be82(_0x236503['error'](0x1f4,_0x49e695['message']));});});}; \ No newline at end of file +var _0xa1fd=['jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','CreateAttachment','create','body','options','raw','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x454165,_0x1f3e74){var _0x56db53=function(_0x23388c){while(--_0x23388c){_0x454165['push'](_0x454165['shift']());}};_0x56db53(++_0x1f3e74);}(_0xa1fd,0x1b9));var _0xda1f=function(_0x21cb7f,_0x48cd16){_0x21cb7f=_0x21cb7f-0x0;var _0x5a079a=_0xa1fd[_0x21cb7f];return _0x5a079a;};'use strict';var _=require(_0xda1f('0x0'));var util=require(_0xda1f('0x1'));var moment=require(_0xda1f('0x2'));var BPromise=require(_0xda1f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda1f('0x4'));var db=require(_0xda1f('0x5'))['db'];var utils=require(_0xda1f('0x6'));var logger=require(_0xda1f('0x7'))(_0xda1f('0x8'));var config=require('../../config/environment');var jayson=require(_0xda1f('0x9'));var client=jayson[_0xda1f('0xa')][_0xda1f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x552ba4,_0x33502e,_0x46a29e){return new BPromise(function(_0x199a8d,_0x338463){return client[_0xda1f('0xc')](_0x552ba4,_0x46a29e)[_0xda1f('0xd')](function(_0x1493f8){logger[_0xda1f('0xe')](_0xda1f('0xf'),_0x33502e,'request\x20sent');logger[_0xda1f('0x10')](_0xda1f('0x11'),_0x33502e,_0xda1f('0x12'),JSON[_0xda1f('0x13')](_0x1493f8));if(_0x1493f8['error']){if(_0x1493f8['error'][_0xda1f('0x14')]===0x1f4){logger[_0xda1f('0x15')](_0xda1f('0xf'),_0x33502e,_0x1493f8[_0xda1f('0x15')][_0xda1f('0x16')]);return _0x338463(_0x1493f8['error'][_0xda1f('0x16')]);}logger[_0xda1f('0x15')](_0xda1f('0xf'),_0x33502e,_0x1493f8[_0xda1f('0x15')][_0xda1f('0x16')]);return _0x199a8d(_0x1493f8[_0xda1f('0x15')]['message']);}else{logger[_0xda1f('0xe')](_0xda1f('0xf'),_0x33502e,_0xda1f('0x12'));_0x199a8d(_0x1493f8[_0xda1f('0x17')]['message']);}})['catch'](function(_0x3020ea){logger['error'](_0xda1f('0xf'),_0x33502e,_0x3020ea);_0x338463(_0x3020ea);});});}exports[_0xda1f('0x18')]=function(_0x1e10af){var _0x59b7bf=this;return new Promise(function(_0xe81fc2,_0xe18a0a){return db['Attachment'][_0xda1f('0x19')](_0x1e10af[_0xda1f('0x1a')],{'raw':_0x1e10af['options']?_0x1e10af[_0xda1f('0x1b')][_0xda1f('0x1c')]===undefined?!![]:![]:!![]})[_0xda1f('0xd')](function(_0xe85e94){logger[_0xda1f('0xe')](_0xda1f('0x18'),_0x1e10af);logger[_0xda1f('0x10')](_0xda1f('0x18'),_0x1e10af,JSON[_0xda1f('0x13')](_0xe85e94));_0xe81fc2(_0xe85e94);})[_0xda1f('0x1d')](function(_0x1d510b){logger[_0xda1f('0x15')]('CreateAttachment',_0x1d510b[_0xda1f('0x16')],_0x1e10af);_0xe18a0a(_0x59b7bf['error'](0x1f4,_0x1d510b[_0xda1f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index b5a867a..ecf0d64 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0xef81f1,_0x560ecf){var _0x55b993=function(_0x3f2d3f){while(--_0x3f2d3f){_0xef81f1['push'](_0xef81f1['shift']());}};_0x55b993(++_0x560ecf);}(_0xb10b,0x12a));var _0xbb10=function(_0x1cc2a9,_0x2c5885){_0x1cc2a9=_0x1cc2a9-0x0;var _0xdcc257=_0xb10b[_0x1cc2a9];return _0xdcc257;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file +var _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(_0x296b2a,_0x4e53b2){var _0x3c9ac0=function(_0x5c38fb){while(--_0x5c38fb){_0x296b2a['push'](_0x296b2a['shift']());}};_0x3c9ac0(++_0x4e53b2);}(_0xb10b,0x12a));var _0xbb10=function(_0x5235a6,_0x680b76){_0x5235a6=_0x5235a6-0x0;var _0x1cf37e=_0xb10b[_0x5235a6];return _0x1cf37e;};'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 8db2dbd..1496e77 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 _0x561d=['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','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','online','admin','agent','domain','add','minutes','getLicense','catch','status','send','message','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','ad-login','User','passport','passport-local','Strategy','moment','util','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN'];(function(_0x444be1,_0x3156e1){var _0x51732b=function(_0x2c37a8){while(--_0x2c37a8){_0x444be1['push'](_0x444be1['shift']());}};_0x51732b(++_0x3156e1);}(_0x561d,0x1f1));var _0xd561=function(_0x27aa68,_0x5dab72){_0x27aa68=_0x27aa68-0x0;var _0x413916=_0x561d[_0x27aa68];return _0x413916;};'use strict';var passport=require(_0xd561('0x0'));var LocalStrategy=require(_0xd561('0x1'))[_0xd561('0x2')];var moment=require(_0xd561('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require('bluebird');var util=require(_0xd561('0x4'));var db=require('../../mysqldb')['db'];var authService=require(_0xd561('0x5'));var utils=require(_0xd561('0x6'));var config=require(_0xd561('0x7'));var logger=require(_0xd561('0x8'))(_0xd561('0x9'));function isActiveDirectoryConfigured(_0x55ae30){var _0x416c2f=![];if(typeof _0x55ae30[_0xd561('0xa')]!==_0xd561('0xb')){_0x416c2f=_0x55ae30[_0xd561('0xa')][_0xd561('0xc')]&&_0x55ae30[_0xd561('0xa')][_0xd561('0xd')]&&_0x55ae30[_0xd561('0xa')]['domain'];}return _0x416c2f;}function adAuthenticate(_0x127fd5,_0x3be1c9,_0x344ddc){return new BPromise(function(_0x46ca60,_0x2de7d7){try{var _0x5efe80=new ActiveDirectory(_0x127fd5);_0x5efe80[_0xd561('0xe')](_0x3be1c9,_0x344ddc,function(_0x1e4c11,_0xba9c38){if(_0x1e4c11){logger[_0xd561('0xf')](_0xd561('0x10'),_0x3be1c9,util[_0xd561('0x11')](_0x1e4c11,{'showHidden':![],'depth':null}));_0x2de7d7(_0xd561('0x12'));}else if(!_0xba9c38){logger['error'](_0xd561('0x13'),_0x3be1c9);_0x2de7d7('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x46ca60(_0xba9c38);}});}catch(_0x5029ce){_0x2de7d7(_0x5029ce);}});}function ActiveDirectoryAuthenticate(_0x2f1e45,_0x590612,_0x3a6fab,_0xd1de65){var _0x3b84eb,_0x303ca1;if(!isActiveDirectoryConfigured(config)){logger['error'](_0xd561('0x14'),_0x590612);return _0xd1de65(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0xd561('0x15')][_0xd561('0x16')]({'where':{'id':0x1},'attributes':[_0xd561('0x17'),_0xd561('0x18')],'raw':!![]})[_0xd561('0x19')](function(_0x17a7d3){_0x3b84eb=_0x17a7d3;if(!_0x3b84eb['adSsoEnabled']){logger[_0xd561('0xf')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x590612);throw new Error(_0xd561('0x12'));}return _0x2f1e45[_0xd561('0x16')]({'attributes':['id',_0xd561('0x1a'),_0xd561('0x1b'),_0xd561('0x1c'),_0xd561('0x1d'),_0xd561('0x1e'),_0xd561('0x1f'),_0xd561('0x20'),_0xd561('0x21')],'where':{'name':_0x590612,'role':{'$or':[_0xd561('0x22'),'user',_0xd561('0x23')]},'adSsoEnabled':!![]}});})['then'](function(_0x4e6c53){if(!_0x4e6c53||_0x4e6c53&&_0x4e6c53[_0xd561('0x1a')]!==_0x590612){throw new Error(_0xd561('0x12'));}_0x303ca1=_0x4e6c53;var _0x19fc12=_0x303ca1[_0xd561('0x1a')]+'@'+config[_0xd561('0xa')][_0xd561('0x24')];return adAuthenticate(config['activedirectory'],_0x19fc12,_0x3a6fab);})[_0xd561('0x19')](function(_0x1ac6d9){if(_0x303ca1[_0xd561('0x1e')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x3b84eb['blockDuration']>0x0){if(_0x303ca1[_0xd561('0x1f')]){if(moment(_0x303ca1[_0xd561('0x20')])[_0xd561('0x25')](_0x3b84eb[_0xd561('0x18')],_0xd561('0x26'))>moment()){throw new Error(_0xd561('0x12'));}return utils['clearBlockUser'](_0x303ca1,0x0,![],null)[_0xd561('0x19')](function(){return utils[_0xd561('0x27')](_0x303ca1);})[_0xd561('0x19')](function(){return _0xd1de65(null,_0x303ca1);});}else{return utils['getLicense'](_0x303ca1)['then'](function(){return _0xd1de65(null,_0x303ca1);});}}else{return utils['getLicense'](_0x303ca1)[_0xd561('0x19')](function(){return _0xd1de65(null,_0x303ca1);});}})[_0xd561('0x28')](function(_0x450bec){return _0xd1de65(null,![],_0x450bec);});}function handleError(_0x22bc68,_0x4eab84,_0x1c6a2f){return _0x22bc68[_0xd561('0x29')](_0x4eab84||0x1f4)[_0xd561('0x2a')]({'message':_0x1c6a2f?_0x1c6a2f[_0xd561('0x2b')]||_0x1c6a2f:''});}exports[_0xd561('0x2c')]=function(_0x3384bf,_0x1d489c,_0x20212c){passport['authenticate']('ad-login',function(_0x30fc32,_0x71784c,_0x3605a0){var _0x433586=_0x30fc32||_0x3605a0;if(_0x433586){return handleError(_0x1d489c,0x191,_0x433586);}if(!_0x71784c){return handleError(_0x1d489c,0x194,{'message':_0xd561('0x2d')});}else{var _0x45de16={'payload':{'id':_0x71784c['id'],'role':_0x71784c[_0xd561('0x1d')]},'options':{'expiresIn':0x15180}};return authService[_0xd561('0x2e')](_0x45de16)['then'](function(_0x541310){_0x1d489c[_0xd561('0x2f')]({'id':_0x71784c['id'],'token':_0x541310,'statusCall':'','isAlreadyLogged':_0x71784c[_0xd561('0x21')]});});}})(_0x3384bf,_0x1d489c,_0x20212c);};passport[_0xd561('0x30')](_0xd561('0x31'),new LocalStrategy({'usernameField':_0xd561('0x1a'),'passwordField':_0xd561('0x1b')},function(_0x26722c,_0x2648e1,_0x16018b){return ActiveDirectoryAuthenticate(db[_0xd561('0x32')],_0x26722c,_0x2648e1,_0x16018b);})); \ No newline at end of file +var _0x7beb=['user','blockDuration','blocked','add','minutes','clearBlockUser','getLicense','catch','message','login','ad-login','signToken','json','Strategy','moment','activedirectory2','bluebird','util','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','undefined','activedirectory','baseDN','url','domain','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','findOne','adSsoEnabled','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','blockedAt','online','admin'];(function(_0x4ca9d2,_0x408f4b){var _0x1232eb=function(_0x3a0122){while(--_0x3a0122){_0x4ca9d2['push'](_0x4ca9d2['shift']());}};_0x1232eb(++_0x408f4b);}(_0x7beb,0xc5));var _0xb7be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7beb[_0x3dd15e];return _0x231fd0;};'use strict';var passport=require('passport');var LocalStrategy=require('passport-local')[_0xb7be('0x0')];var moment=require(_0xb7be('0x1'));var ActiveDirectory=require(_0xb7be('0x2'));var BPromise=require(_0xb7be('0x3'));var util=require(_0xb7be('0x4'));var db=require('../../mysqldb')['db'];var authService=require(_0xb7be('0x5'));var utils=require(_0xb7be('0x6'));var config=require(_0xb7be('0x7'));var logger=require(_0xb7be('0x8'))(_0xb7be('0x9'));function isActiveDirectoryConfigured(_0x3983ad){var _0x190537=![];if(typeof _0x3983ad['activedirectory']!==_0xb7be('0xa')){_0x190537=_0x3983ad[_0xb7be('0xb')][_0xb7be('0xc')]&&_0x3983ad[_0xb7be('0xb')][_0xb7be('0xd')]&&_0x3983ad[_0xb7be('0xb')][_0xb7be('0xe')];}return _0x190537;}function adAuthenticate(_0x5c6e5c,_0x7b15b0,_0x79a76f){return new BPromise(function(_0x4bfe1f,_0x3908ec){try{var _0xfbf51d=new ActiveDirectory(_0x5c6e5c);_0xfbf51d[_0xb7be('0xf')](_0x7b15b0,_0x79a76f,function(_0x427e87,_0xf967fe){if(_0x427e87){logger[_0xb7be('0x10')](_0xb7be('0x11'),_0x7b15b0,util[_0xb7be('0x12')](_0x427e87,{'showHidden':![],'depth':null}));_0x3908ec(_0xb7be('0x13'));}else if(!_0xf967fe){logger[_0xb7be('0x10')](_0xb7be('0x14'),_0x7b15b0);_0x3908ec('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x4bfe1f(_0xf967fe);}});}catch(_0x163045){_0x3908ec(_0x163045);}});}function ActiveDirectoryAuthenticate(_0x3e2472,_0x56ba65,_0xd47629,_0x11a1b3){var _0x56d0b1,_0x43a1fd;if(!isActiveDirectoryConfigured(config)){logger[_0xb7be('0x10')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x56ba65);return _0x11a1b3(null,![],{'message':_0xb7be('0x13')});}return db[_0xb7be('0x15')][_0xb7be('0x16')]({'where':{'id':0x1},'attributes':[_0xb7be('0x17'),'blockDuration'],'raw':!![]})[_0xb7be('0x18')](function(_0x3fa0dc){_0x56d0b1=_0x3fa0dc;if(!_0x56d0b1[_0xb7be('0x17')]){logger[_0xb7be('0x10')](_0xb7be('0x19'),_0x56ba65);throw new Error(_0xb7be('0x13'));}return _0x3e2472[_0xb7be('0x16')]({'attributes':['id',_0xb7be('0x1a'),_0xb7be('0x1b'),_0xb7be('0x1c'),_0xb7be('0x1d'),'disabled','blocked',_0xb7be('0x1e'),_0xb7be('0x1f')],'where':{'name':_0x56ba65,'role':{'$or':[_0xb7be('0x20'),_0xb7be('0x21'),'agent']},'adSsoEnabled':!![]}});})['then'](function(_0x39d22a){if(!_0x39d22a||_0x39d22a&&_0x39d22a[_0xb7be('0x1a')]!==_0x56ba65){throw new Error(_0xb7be('0x13'));}_0x43a1fd=_0x39d22a;var _0x29d3e0=_0x43a1fd['name']+'@'+config['activedirectory'][_0xb7be('0xe')];return adAuthenticate(config[_0xb7be('0xb')],_0x29d3e0,_0xd47629);})[_0xb7be('0x18')](function(_0x15f288){if(_0x43a1fd['disabled']){throw new Error(_0xb7be('0x13'));}if(_0x56d0b1[_0xb7be('0x22')]>0x0){if(_0x43a1fd[_0xb7be('0x23')]){if(moment(_0x43a1fd[_0xb7be('0x1e')])[_0xb7be('0x24')](_0x56d0b1[_0xb7be('0x22')],_0xb7be('0x25'))>moment()){throw new Error(_0xb7be('0x13'));}return utils[_0xb7be('0x26')](_0x43a1fd,0x0,![],null)[_0xb7be('0x18')](function(){return utils[_0xb7be('0x27')](_0x43a1fd);})[_0xb7be('0x18')](function(){return _0x11a1b3(null,_0x43a1fd);});}else{return utils[_0xb7be('0x27')](_0x43a1fd)['then'](function(){return _0x11a1b3(null,_0x43a1fd);});}}else{return utils[_0xb7be('0x27')](_0x43a1fd)[_0xb7be('0x18')](function(){return _0x11a1b3(null,_0x43a1fd);});}})[_0xb7be('0x28')](function(_0x2a7e91){return _0x11a1b3(null,![],_0x2a7e91);});}function handleError(_0x2bb12f,_0x196df7,_0x6e26e5){return _0x2bb12f['status'](_0x196df7||0x1f4)['send']({'message':_0x6e26e5?_0x6e26e5[_0xb7be('0x29')]||_0x6e26e5:''});}exports[_0xb7be('0x2a')]=function(_0x56aa67,_0x30099f,_0x52bb54){passport['authenticate'](_0xb7be('0x2b'),function(_0x5cef3f,_0x4257ab,_0x32a36a){var _0x4c52d9=_0x5cef3f||_0x32a36a;if(_0x4c52d9){return handleError(_0x30099f,0x191,_0x4c52d9);}if(!_0x4257ab){return handleError(_0x30099f,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x28c895={'payload':{'id':_0x4257ab['id'],'role':_0x4257ab[_0xb7be('0x1d')]},'options':{'expiresIn':0x15180}};return authService[_0xb7be('0x2c')](_0x28c895)[_0xb7be('0x18')](function(_0xbb43cf){_0x30099f[_0xb7be('0x2d')]({'id':_0x4257ab['id'],'token':_0xbb43cf,'statusCall':'','isAlreadyLogged':_0x4257ab['online']});});}})(_0x56aa67,_0x30099f,_0x52bb54);};passport['use'](_0xb7be('0x2b'),new LocalStrategy({'usernameField':_0xb7be('0x1a'),'passwordField':_0xb7be('0x1b')},function(_0x733749,_0x2a2b05,_0x1c30ea){return ActiveDirectoryAuthenticate(db['User'],_0x733749,_0x2a2b05,_0x1c30ea);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 3796de4..f7f31a1 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 _0x9368=['login','Router','./authActiveDirectory.controller','post'];(function(_0x8895d0,_0xbf13d2){var _0x3cf809=function(_0x38bc46){while(--_0x38bc46){_0x8895d0['push'](_0x8895d0['shift']());}};_0x3cf809(++_0xbf13d2);}(_0x9368,0x99));var _0x8936=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x9368[_0x476bf4];return _0x788ffe;};'use strict';var express=require('express');var router=express[_0x8936('0x0')]();var controller=require(_0x8936('0x1'));router[_0x8936('0x2')]('/',controller[_0x8936('0x3')]);module['exports']=router; \ No newline at end of file +var _0xb3d9=['post','exports','Router'];(function(_0x2cfb48,_0x24b83b){var _0xc4594f=function(_0x3bc089){while(--_0x3bc089){_0x2cfb48['push'](_0x2cfb48['shift']());}};_0xc4594f(++_0x24b83b);}(_0xb3d9,0x18b));var _0x9b3d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb3d9[_0x20a584];return _0x4b41a8;};'use strict';var express=require('express');var router=express[_0x9b3d('0x0')]();var controller=require('./authActiveDirectory.controller');router[_0x9b3d('0x1')]('/',controller['login']);module[_0x9b3d('0x2')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 01e9433..d8a1025 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(_0x36bb8b,_0x34ff2a){var _0x15aba9=function(_0x166e16){while(--_0x166e16){_0x36bb8b['push'](_0x36bb8b['shift']());}};_0x15aba9(++_0x34ff2a);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x7a54,0x106));var _0x47a5=function(_0x1c8301,_0xd9504c){_0x1c8301=_0x1c8301-0x0;var _0x4c4f05=_0x7a54[_0x1c8301];return _0x4c4f05;};'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 6f2a490..994837d 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 _0xb41e=['setTokenCookie','express','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','isMiddleware'];(function(_0x438efa,_0x5818ba){var _0x989dcb=function(_0x2ca6e7){while(--_0x2ca6e7){_0x438efa['push'](_0x438efa['shift']());}};_0x989dcb(++_0x5818ba);}(_0xb41e,0x1f0));var _0xeb41=function(_0x2acbb3,_0x29e1b4){_0x2acbb3=_0x2acbb3-0x0;var _0x5c0cc7=_0xb41e[_0x2acbb3];return _0x5c0cc7;};'use strict';var express=require(_0xeb41('0x0'));var passport=require('passport');var router=express[_0xeb41('0x1')]();var controller=require(_0xeb41('0x2'));var userController=require(_0xeb41('0x3'));var authService=require(_0xeb41('0x4'));router[_0xeb41('0x5')]('/',controller[_0xeb41('0x6')]);router['get'](_0xeb41('0x7'),controller[_0xeb41('0x8')],authService[_0xeb41('0x9')],userController[_0xeb41('0x6')],authService[_0xeb41('0xa')]);module['exports']=router; \ No newline at end of file +var _0x6068=['passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','isMiddleware','setTokenCookie','exports'];(function(_0x30f6c2,_0x4a187a){var _0x1a7f9d=function(_0x227f87){while(--_0x227f87){_0x30f6c2['push'](_0x30f6c2['shift']());}};_0x1a7f9d(++_0x4a187a);}(_0x6068,0x134));var _0x8606=function(_0x53f608,_0x256def){_0x53f608=_0x53f608-0x0;var _0x495b7d=_0x6068[_0x53f608];return _0x495b7d;};'use strict';var express=require('express');var passport=require(_0x8606('0x0'));var router=express[_0x8606('0x1')]();var controller=require(_0x8606('0x2'));var userController=require(_0x8606('0x3'));var authService=require(_0x8606('0x4'));router[_0x8606('0x5')]('/',controller[_0x8606('0x6')]);router[_0x8606('0x5')](_0x8606('0x7'),controller['callback'],authService[_0x8606('0x8')],userController[_0x8606('0x6')],authService[_0x8606('0x9')]);module[_0x8606('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 4e83f76..a15d3d0 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 _0xbe25=['MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','email','generate','body','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','add','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','password','validatePasswordHistory','previousPasswords','save','Password\x20reset!','util','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','then','findOne','name','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','minutes','clearBlockUser','getLicense','catch','MailAccount','find'];(function(_0x4687df,_0x12099c){var _0x32eaef=function(_0x2387db){while(--_0x2387db){_0x4687df['push'](_0x4687df['shift']());}};_0x32eaef(++_0x12099c);}(_0xbe25,0x79));var _0x5be2=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xbe25[_0x3070dc];return _0x431489;};'use strict';var util=require(_0x5be2('0x0'));var passport=require('passport');var LocalStrategy=require('passport-local')['Strategy'];var jayson=require('jayson/promise');var _=require(_0x5be2('0x1'));var rs=require(_0x5be2('0x2'));var moment=require('moment');var db=require(_0x5be2('0x3'))['db'];var authService=require(_0x5be2('0x4'));var utils=require(_0x5be2('0x5'));var client=jayson[_0x5be2('0x6')][_0x5be2('0x7')]({'port':0x232b});function localAuthenticate(_0x1ea416,_0x4b4a38,_0x497412,_0x4eeb7f){var _0x130171,_0x166558;return db[_0x5be2('0x8')]['findOne']({'where':{'id':0x1},'attributes':[_0x5be2('0x9'),_0x5be2('0xa')],'raw':!![]})[_0x5be2('0xb')](function(_0x2cbfeb){_0x130171=_0x2cbfeb;return _0x1ea416[_0x5be2('0xc')]({'attributes':['id',_0x5be2('0xd'),'password',_0x5be2('0xe'),_0x5be2('0xf'),_0x5be2('0x10'),_0x5be2('0x11'),_0x5be2('0x12'),_0x5be2('0x13')],'where':{'name':_0x4b4a38,'role':{'$or':[_0x5be2('0x14'),_0x5be2('0x15'),_0x5be2('0x16')]}}});})['then'](function(_0x3b43a6){if(!_0x3b43a6||_0x3b43a6&&_0x3b43a6[_0x5be2('0xd')]!==_0x4b4a38){throw new Error(_0x5be2('0x17'));}else{_0x166558=_0x3b43a6;return _0x166558;}})[_0x5be2('0xb')](function(){_0x166558[_0x5be2('0x18')](_0x497412,function(_0x34a7ca,_0x2aa90c){var _0x1a5f69=_0x166558[_0x5be2('0x13')]+0x1;if(_0x34a7ca){return _0x4eeb7f(_0x34a7ca);}else if(!_0x2aa90c){if(_0x166558[_0x5be2('0x10')]){return _0x4eeb7f(null,![],{'message':_0x5be2('0x17')});}else if(_0x130171[_0x5be2('0x9')]>0x0){if(_0x166558[_0x5be2('0x11')]){if(_0x130171[_0x5be2('0xa')]>0x0){if(moment(_0x166558[_0x5be2('0x12')])['add'](_0x130171[_0x5be2('0xa')],_0x5be2('0x19'))>moment()){return _0x4eeb7f(null,![],{'message':_0x5be2('0x17')});}else{return utils[_0x5be2('0x1a')](_0x166558,_0x1a5f69,![],null)[_0x5be2('0xb')](function(){return _0x4eeb7f(null,![],{'message':_0x5be2('0x17')});});}}else{return _0x4eeb7f(null,![],{'message':_0x5be2('0x17')});}}else{if(_0x1a5f69>=_0x130171[_0x5be2('0x9')]){return utils[_0x5be2('0x1a')](_0x166558,0x0,!![],moment())[_0x5be2('0xb')](function(){return _0x4eeb7f(null,![],{'message':_0x5be2('0x17')});});}else{return utils[_0x5be2('0x1a')](_0x166558,_0x1a5f69,![],null)[_0x5be2('0xb')](function(){return _0x4eeb7f(null,![],{'message':_0x5be2('0x17')});});}}}else{return _0x4eeb7f(null,![],{'message':_0x5be2('0x17')});}}else{if(_0x166558[_0x5be2('0x10')]){return _0x4eeb7f(null,![],{'message':_0x5be2('0x17')});}else if(_0x130171[_0x5be2('0x9')]>0x0){if(_0x166558[_0x5be2('0x11')]){if(_0x130171[_0x5be2('0xa')]>0x0){if(moment(_0x166558[_0x5be2('0x12')])['add'](_0x130171[_0x5be2('0xa')],_0x5be2('0x19'))>moment()){return _0x4eeb7f(null,![],{'message':_0x5be2('0x17')});}else{return utils[_0x5be2('0x1a')](_0x166558,0x0,![],null)[_0x5be2('0xb')](function(){return utils[_0x5be2('0x1b')](_0x166558);})['then'](function(){return _0x4eeb7f(null,_0x166558);});}}else{return _0x4eeb7f(null,![],{'message':_0x5be2('0x17')});}}else{return utils[_0x5be2('0x1a')](_0x166558,0x0,![],null)[_0x5be2('0xb')](function(){return utils[_0x5be2('0x1b')](_0x166558);})['then'](function(){return _0x4eeb7f(null,_0x166558);})[_0x5be2('0x1c')](function(_0x5da0d1){return _0x4eeb7f(null,![],_0x5da0d1);});}}else{if(_0x166558[_0x5be2('0x11')]){return _0x4eeb7f(null,![],{'message':_0x5be2('0x17')});}else{return utils[_0x5be2('0x1b')](_0x166558)[_0x5be2('0xb')](function(){return _0x4eeb7f(null,_0x166558);});}}}});})[_0x5be2('0x1c')](function(_0x2c9ae9){return _0x4eeb7f(null,![],_0x2c9ae9);});}function sendServiceMail(_0x2ebf6b){return db[_0x5be2('0x1d')][_0x5be2('0x1e')]({'where':{'service':!![]},'attributes':['id','name','email'],'include':[{'model':db[_0x5be2('0x1f')],'as':'Smtp','include':[{'model':db[_0x5be2('0x20')],'as':'CloudProvider'}]}]})[_0x5be2('0xb')](function(_0x40ccce){if(!_0x40ccce){throw new Error(_0x5be2('0x21'));}var _0x41b7e0=_0x40ccce[_0x5be2('0x22')]();var _0x23d1ca={'account':_0x41b7e0,'message':_['merge']({'from':util[_0x5be2('0x23')](_0x5be2('0x24'),_0x40ccce[_0x5be2('0xd')],_0x40ccce['email']||_0x40ccce['Smtp'][_0x5be2('0x15')])},_0x2ebf6b)};return client[_0x5be2('0x25')](_0x5be2('0x26'),_0x23d1ca);})['then'](function(_0x695d17){if(_0x695d17[_0x5be2('0x27')]){throw new Error(util[_0x5be2('0x23')](_0x5be2('0x28'),_0x695d17[_0x5be2('0x27')][_0x5be2('0x29')]||JSON[_0x5be2('0x2a')](_0x695d17[_0x5be2('0x27')])));}return!![];});}function handleError(_0x1207b5,_0x1fb51f,_0x26eb7f){return _0x1207b5[_0x5be2('0x2b')](_0x1fb51f||0x1f4)['send']({'message':_0x26eb7f?_0x26eb7f[_0x5be2('0x29')]||_0x26eb7f:''});}exports[_0x5be2('0x2c')]=function(_0x4e5c99,_0x2fa0d9,_0x4a004b){passport[_0x5be2('0x18')](_0x5be2('0x2d'),function(_0x1e483d,_0x121e73,_0x2b0efa){var _0x33c516=_0x1e483d||_0x2b0efa;if(_0x33c516){return handleError(_0x2fa0d9,0x191,_0x33c516);}if(!_0x121e73){return handleError(_0x2fa0d9,0x194,{'message':_0x5be2('0x2e')});}else{var _0x26f870={'payload':{'id':_0x121e73['id'],'role':_0x121e73[_0x5be2('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0x5be2('0x2f')](_0x26f870)[_0x5be2('0xb')](function(_0x4c667a){_0x2fa0d9[_0x5be2('0x30')]({'id':_0x121e73['id'],'token':_0x4c667a,'statusCall':'','isAlreadyLogged':_0x121e73[_0x5be2('0x31')]});});}})(_0x4e5c99,_0x2fa0d9,_0x4a004b);};exports['forgot']=function(_0x705605,_0xcf0ca){if(!_0x705605['body'][_0x5be2('0x32')]){return handleError(_0xcf0ca,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x21f7c2=rs[_0x5be2('0x33')]();_0x705605[_0x5be2('0x34')][_0x5be2('0x32')]=_0x705605['body'][_0x5be2('0x32')][_0x5be2('0x35')]()[_0x5be2('0x36')]();var _0x1b314e;return db[_0x5be2('0x8')]['findOne']({'where':{'id':0x1},'attributes':[_0x5be2('0x9'),_0x5be2('0xa')],'raw':!![]})[_0x5be2('0xb')](function(_0x3b742e){_0x1b314e=_0x3b742e;return db[_0x5be2('0x37')][_0x5be2('0x1e')]({'where':{'email':_0x705605[_0x5be2('0x34')][_0x5be2('0x32')]}});})[_0x5be2('0xb')](function(_0x388142){if(!_0x388142){throw new Error(_0x5be2('0x38'));}if(_0x388142['disabled']){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x388142[_0x5be2('0x11')]){if(moment(_0x388142[_0x5be2('0x12')])[_0x5be2('0x39')](_0x1b314e[_0x5be2('0xa')],_0x5be2('0x19'))>moment()){throw new Error(_0x5be2('0x3a'));}else{_0x388142[_0x5be2('0x11')]=![];_0x388142[_0x5be2('0x12')]=null;}}_0x388142[_0x5be2('0x3b')]=_0x21f7c2;_0x388142[_0x5be2('0x3c')]=Date[_0x5be2('0x3d')]()+0x36ee80;return _0x388142['save']();})[_0x5be2('0xb')](function(){return sendServiceMail({'to':_0x705605['body'][_0x5be2('0x32')],'subject':_0x5be2('0x3e'),'text':'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://'+_0x705605['headers']['host']+'/reset/'+_0x21f7c2+'\x0a\x0a'+_0x5be2('0x3f')});})[_0x5be2('0xb')](function(){_0xcf0ca[_0x5be2('0x2b')](0xc8)[_0x5be2('0x40')]({'message':'Reset\x20Email\x20sent!'});})[_0x5be2('0x1c')](function(_0x4d16a1){return handleError(_0xcf0ca,0x1f4,_0x4d16a1);});};exports[_0x5be2('0x41')]=function(_0x5b86d1,_0x3cf6fe){return db[_0x5be2('0x37')]['find']({'where':{'resetPasswordToken':_0x5b86d1[_0x5be2('0x42')]['token'],'resetPasswordExpires':{'$gt':Date[_0x5be2('0x3d')]()}}})[_0x5be2('0xb')](function(_0x109361){if(!_0x109361){throw new Error(_0x5be2('0x43'));}return db['Setting'][_0x5be2('0xc')]({'attributes':['id','securePassword',_0x5be2('0x44'),_0x5be2('0x45')]})[_0x5be2('0xb')](function(_0xd0a180){if(_0xd0a180['securePassword'])authService[_0x5be2('0x46')](_0x5b86d1[_0x5be2('0x34')][_0x5be2('0x47')]);if(!_0xd0a180['enforcePasswordHistory']||!_0x109361['previousPasswords'])return _0x109361;authService[_0x5be2('0x48')](_0x5b86d1[_0x5be2('0x34')][_0x5be2('0x47')],_0x109361[_0x5be2('0x49')],_0xd0a180['passwordHistoryLimit']);return _0x109361;})[_0x5be2('0xb')](function(){_0x109361[_0x5be2('0x47')]=_0x5b86d1[_0x5be2('0x34')]['password'];_0x109361[_0x5be2('0x3b')]=null;_0x109361[_0x5be2('0x3c')]=null;return _0x109361[_0x5be2('0x4a')]();});})[_0x5be2('0xb')](function(){_0x3cf6fe[_0x5be2('0x2b')](0xc8)['send']({'message':_0x5be2('0x4b')});})[_0x5be2('0x1c')](function(_0x14efdf){return handleError(_0x3cf6fe,0x1f4,_0x14efdf);});};passport['use'](_0x5be2('0x2d'),new LocalStrategy({'usernameField':_0x5be2('0xd'),'passwordField':_0x5be2('0x47')},function(_0x504b8b,_0x4e009c,_0x1a97e6){return localAuthenticate(db[_0x5be2('0x37')],_0x504b8b,_0x4e009c,_0x1a97e6);})); \ No newline at end of file +var _0x66de=['error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','status','send','message','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','toLowerCase','Setting','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','resetPasswordExpires','Password\x20reset!','use','passport','jayson/promise','lodash','../../components/auth/service','../../config/utils','client','http','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','blocked','blockedAt','admin','agent','authenticate','loginAttempts','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','getLicense','catch','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','user','SendMail'];(function(_0x1662a7,_0x38e198){var _0x2dab2a=function(_0x56288c){while(--_0x56288c){_0x1662a7['push'](_0x1662a7['shift']());}};_0x2dab2a(++_0x38e198);}(_0x66de,0x169));var _0xe66d=function(_0x47fb54,_0x28698c){_0x47fb54=_0x47fb54-0x0;var _0x1139a7=_0x66de[_0x47fb54];return _0x1139a7;};'use strict';var util=require('util');var passport=require(_0xe66d('0x0'));var LocalStrategy=require('passport-local')['Strategy'];var jayson=require(_0xe66d('0x1'));var _=require(_0xe66d('0x2'));var rs=require('randomstring');var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0xe66d('0x3'));var utils=require(_0xe66d('0x4'));var client=jayson[_0xe66d('0x5')][_0xe66d('0x6')]({'port':0x232b});function localAuthenticate(_0x44ca83,_0xba4e17,_0x36b23c,_0x24bd1d){var _0x251a27,_0x2719ba;return db['Setting'][_0xe66d('0x7')]({'where':{'id':0x1},'attributes':[_0xe66d('0x8'),_0xe66d('0x9')],'raw':!![]})[_0xe66d('0xa')](function(_0x1f68cf){_0x251a27=_0x1f68cf;return _0x44ca83[_0xe66d('0x7')]({'attributes':['id',_0xe66d('0xb'),_0xe66d('0xc'),_0xe66d('0xd'),_0xe66d('0xe'),'disabled',_0xe66d('0xf'),_0xe66d('0x10'),'loginAttempts'],'where':{'name':_0xba4e17,'role':{'$or':[_0xe66d('0x11'),'user',_0xe66d('0x12')]}}});})['then'](function(_0x460e5b){if(!_0x460e5b||_0x460e5b&&_0x460e5b[_0xe66d('0xb')]!==_0xba4e17){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x2719ba=_0x460e5b;return _0x2719ba;}})[_0xe66d('0xa')](function(){_0x2719ba[_0xe66d('0x13')](_0x36b23c,function(_0xc26068,_0x1afe92){var _0x2ac2f0=_0x2719ba[_0xe66d('0x14')]+0x1;if(_0xc26068){return _0x24bd1d(_0xc26068);}else if(!_0x1afe92){if(_0x2719ba[_0xe66d('0x15')]){return _0x24bd1d(null,![],{'message':_0xe66d('0x16')});}else if(_0x251a27[_0xe66d('0x8')]>0x0){if(_0x2719ba[_0xe66d('0xf')]){if(_0x251a27[_0xe66d('0x9')]>0x0){if(moment(_0x2719ba[_0xe66d('0x10')])[_0xe66d('0x17')](_0x251a27[_0xe66d('0x9')],_0xe66d('0x18'))>moment()){return _0x24bd1d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xe66d('0x19')](_0x2719ba,_0x2ac2f0,![],null)[_0xe66d('0xa')](function(){return _0x24bd1d(null,![],{'message':_0xe66d('0x16')});});}}else{return _0x24bd1d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x2ac2f0>=_0x251a27[_0xe66d('0x8')]){return utils[_0xe66d('0x19')](_0x2719ba,0x0,!![],moment())[_0xe66d('0xa')](function(){return _0x24bd1d(null,![],{'message':_0xe66d('0x16')});});}else{return utils[_0xe66d('0x19')](_0x2719ba,_0x2ac2f0,![],null)[_0xe66d('0xa')](function(){return _0x24bd1d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x24bd1d(null,![],{'message':_0xe66d('0x16')});}}else{if(_0x2719ba[_0xe66d('0x15')]){return _0x24bd1d(null,![],{'message':_0xe66d('0x16')});}else if(_0x251a27[_0xe66d('0x8')]>0x0){if(_0x2719ba[_0xe66d('0xf')]){if(_0x251a27[_0xe66d('0x9')]>0x0){if(moment(_0x2719ba['blockedAt'])[_0xe66d('0x17')](_0x251a27['blockDuration'],_0xe66d('0x18'))>moment()){return _0x24bd1d(null,![],{'message':_0xe66d('0x16')});}else{return utils[_0xe66d('0x19')](_0x2719ba,0x0,![],null)[_0xe66d('0xa')](function(){return utils['getLicense'](_0x2719ba);})[_0xe66d('0xa')](function(){return _0x24bd1d(null,_0x2719ba);});}}else{return _0x24bd1d(null,![],{'message':_0xe66d('0x16')});}}else{return utils['clearBlockUser'](_0x2719ba,0x0,![],null)[_0xe66d('0xa')](function(){return utils[_0xe66d('0x1a')](_0x2719ba);})[_0xe66d('0xa')](function(){return _0x24bd1d(null,_0x2719ba);})[_0xe66d('0x1b')](function(_0x291824){return _0x24bd1d(null,![],_0x291824);});}}else{if(_0x2719ba[_0xe66d('0xf')]){return _0x24bd1d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xe66d('0x1a')](_0x2719ba)[_0xe66d('0xa')](function(){return _0x24bd1d(null,_0x2719ba);});}}}});})[_0xe66d('0x1b')](function(_0x1eb2cc){return _0x24bd1d(null,![],_0x1eb2cc);});}function sendServiceMail(_0x5ecc75){return db['MailAccount'][_0xe66d('0x1c')]({'where':{'service':!![]},'attributes':['id',_0xe66d('0xb'),_0xe66d('0x1d')],'include':[{'model':db[_0xe66d('0x1e')],'as':_0xe66d('0x1f'),'include':[{'model':db[_0xe66d('0x20')],'as':_0xe66d('0x20')}]}]})[_0xe66d('0xa')](function(_0xda9181){if(!_0xda9181){throw new Error(_0xe66d('0x21'));}var _0x3b1603=_0xda9181['getSmtpOptions']();var _0x32a84d={'account':_0x3b1603,'message':_[_0xe66d('0x22')]({'from':util[_0xe66d('0x23')](_0xe66d('0x24'),_0xda9181['name'],_0xda9181[_0xe66d('0x1d')]||_0xda9181[_0xe66d('0x1f')][_0xe66d('0x25')])},_0x5ecc75)};return client['request'](_0xe66d('0x26'),_0x32a84d);})['then'](function(_0x53b47a){if(_0x53b47a[_0xe66d('0x27')]){throw new Error(util[_0xe66d('0x23')](_0xe66d('0x28'),_0x53b47a[_0xe66d('0x27')]['message']||JSON['stringify'](_0x53b47a['error'])));}return!![];});}function handleError(_0x2dbfca,_0x1b3223,_0x2e3fd2){return _0x2dbfca[_0xe66d('0x29')](_0x1b3223||0x1f4)[_0xe66d('0x2a')]({'message':_0x2e3fd2?_0x2e3fd2[_0xe66d('0x2b')]||_0x2e3fd2:''});}exports[_0xe66d('0x2c')]=function(_0x4bb9e7,_0x2bafd1,_0xa83e64){passport[_0xe66d('0x13')](_0xe66d('0x2d'),function(_0x5b8712,_0x39e3b7,_0x290329){var _0x2fbfd3=_0x5b8712||_0x290329;if(_0x2fbfd3){return handleError(_0x2bafd1,0x191,_0x2fbfd3);}if(!_0x39e3b7){return handleError(_0x2bafd1,0x194,{'message':_0xe66d('0x2e')});}else{var _0x5efe0e={'payload':{'id':_0x39e3b7['id'],'role':_0x39e3b7[_0xe66d('0xe')]},'options':{'expiresIn':0x15180}};return authService[_0xe66d('0x2f')](_0x5efe0e)[_0xe66d('0xa')](function(_0x337f1f){_0x2bafd1[_0xe66d('0x30')]({'id':_0x39e3b7['id'],'token':_0x337f1f,'statusCall':'','isAlreadyLogged':_0x39e3b7[_0xe66d('0x31')]});});}})(_0x4bb9e7,_0x2bafd1,_0xa83e64);};exports[_0xe66d('0x32')]=function(_0x4006b2,_0x6908cf){if(!_0x4006b2['body'][_0xe66d('0x1d')]){return handleError(_0x6908cf,0x1f4,{'message':_0xe66d('0x33')});}var _0x9ad157=rs[_0xe66d('0x34')]();_0x4006b2[_0xe66d('0x35')]['email']=_0x4006b2['body'][_0xe66d('0x1d')]['trim']()[_0xe66d('0x36')]();var _0x2fdc0c;return db[_0xe66d('0x37')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xe66d('0x9')],'raw':!![]})[_0xe66d('0xa')](function(_0xe9fb4a){_0x2fdc0c=_0xe9fb4a;return db['User'][_0xe66d('0x1c')]({'where':{'email':_0x4006b2[_0xe66d('0x35')][_0xe66d('0x1d')]}});})[_0xe66d('0xa')](function(_0x54f0b6){if(!_0x54f0b6){throw new Error(_0xe66d('0x38'));}if(_0x54f0b6[_0xe66d('0x15')]){throw new Error(_0xe66d('0x39'));}if(_0x54f0b6[_0xe66d('0xf')]){if(moment(_0x54f0b6[_0xe66d('0x10')])[_0xe66d('0x17')](_0x2fdc0c[_0xe66d('0x9')],_0xe66d('0x18'))>moment()){throw new Error(_0xe66d('0x3a'));}else{_0x54f0b6[_0xe66d('0xf')]=![];_0x54f0b6[_0xe66d('0x10')]=null;}}_0x54f0b6[_0xe66d('0x3b')]=_0x9ad157;_0x54f0b6['resetPasswordExpires']=Date[_0xe66d('0x3c')]()+0x36ee80;return _0x54f0b6[_0xe66d('0x3d')]();})[_0xe66d('0xa')](function(){return sendServiceMail({'to':_0x4006b2[_0xe66d('0x35')][_0xe66d('0x1d')],'subject':_0xe66d('0x3e'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xe66d('0x3f')+_0xe66d('0x40')+_0x4006b2['headers']['host']+_0xe66d('0x41')+_0x9ad157+'\x0a\x0a'+_0xe66d('0x42')});})['then'](function(){_0x6908cf[_0xe66d('0x29')](0xc8)['send']({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x2eb4cb){return handleError(_0x6908cf,0x1f4,_0x2eb4cb);});};exports[_0xe66d('0x43')]=function(_0xcfb1e4,_0x17338c){return db[_0xe66d('0x44')][_0xe66d('0x1c')]({'where':{'resetPasswordToken':_0xcfb1e4[_0xe66d('0x45')][_0xe66d('0x46')],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x478405){if(!_0x478405){throw new Error(_0xe66d('0x47'));}return db[_0xe66d('0x37')][_0xe66d('0x7')]({'attributes':['id',_0xe66d('0x48'),_0xe66d('0x49'),_0xe66d('0x4a')]})[_0xe66d('0xa')](function(_0x11b495){if(_0x11b495[_0xe66d('0x48')])authService['validatePasswordPattern'](_0xcfb1e4[_0xe66d('0x35')][_0xe66d('0xc')]);if(!_0x11b495['enforcePasswordHistory']||!_0x478405[_0xe66d('0x4b')])return _0x478405;authService[_0xe66d('0x4c')](_0xcfb1e4['body'][_0xe66d('0xc')],_0x478405[_0xe66d('0x4b')],_0x11b495[_0xe66d('0x4a')]);return _0x478405;})['then'](function(){_0x478405[_0xe66d('0xc')]=_0xcfb1e4[_0xe66d('0x35')][_0xe66d('0xc')];_0x478405['resetPasswordToken']=null;_0x478405[_0xe66d('0x4d')]=null;return _0x478405[_0xe66d('0x3d')]();});})['then'](function(){_0x17338c['status'](0xc8)['send']({'message':_0xe66d('0x4e')});})[_0xe66d('0x1b')](function(_0x1e8e8a){return handleError(_0x17338c,0x1f4,_0x1e8e8a);});};passport[_0xe66d('0x4f')](_0xe66d('0x2d'),new LocalStrategy({'usernameField':_0xe66d('0xb'),'passwordField':_0xe66d('0xc')},function(_0x272aff,_0x29d6a6,_0x3fc92a){return localAuthenticate(db[_0xe66d('0x44')],_0x272aff,_0x29d6a6,_0x3fc92a);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 1c889ef..e2f8114 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 _0xc52e=['/forgot','/reset/:token','reset','exports','express','Router','post'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xc52e,0x146));var _0xec52=function(_0x5d93a4,_0x10fca8){_0x5d93a4=_0x5d93a4-0x0;var _0x17b491=_0xc52e[_0x5d93a4];return _0x17b491;};'use strict';var express=require(_0xec52('0x0'));var router=express[_0xec52('0x1')]();var controller=require('./authLocal.controller');router['post']('/',controller['login']);router[_0xec52('0x2')](_0xec52('0x3'),controller['forgot']);router[_0xec52('0x2')](_0xec52('0x4'),controller[_0xec52('0x5')]);module[_0xec52('0x6')]=router; \ No newline at end of file +var _0xe29f=['express','Router','post','login','/forgot','forgot','/reset/:token','exports'];(function(_0x532c00,_0xd68e93){var _0x3ae4ed=function(_0x11ec62){while(--_0x11ec62){_0x532c00['push'](_0x532c00['shift']());}};_0x3ae4ed(++_0xd68e93);}(_0xe29f,0x1e8));var _0xfe29=function(_0x3fa78c,_0x18b0f2){_0x3fa78c=_0x3fa78c-0x0;var _0x4cbcc9=_0xe29f[_0x3fa78c];return _0x4cbcc9;};'use strict';var express=require(_0xfe29('0x0'));var router=express[_0xfe29('0x1')]();var controller=require('./authLocal.controller');router[_0xfe29('0x2')]('/',controller[_0xfe29('0x3')]);router[_0xfe29('0x2')](_0xfe29('0x4'),controller[_0xfe29('0x5')]);router[_0xfe29('0x2')](_0xfe29('0x6'),controller['reset']);module[_0xfe29('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 9f1b9ef..3496d51 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 _0x205e=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x211b3c,_0x183a2e){var _0x5effcb=function(_0x359802){while(--_0x359802){_0x211b3c['push'](_0x211b3c['shift']());}};_0x5effcb(++_0x183a2e);}(_0x205e,0x67));var _0xe205=function(_0x553cb2,_0x2e568){_0x553cb2=_0x553cb2-0x0;var _0x2b115d=_0x205e[_0x553cb2];return _0x2b115d;};'use strict';var Sequelize=require(_0xe205('0x0'));module[_0xe205('0x1')]={'name':{'type':Sequelize[_0xe205('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xe205('0x2')]},'description':{'type':Sequelize[_0xe205('0x2')]},'status':{'type':Sequelize[_0xe205('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xe205('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xe099=['BOOLEAN','INTEGER','STRING'];(function(_0x4fa438,_0x1f15a7){var _0x4e3958=function(_0x28f510){while(--_0x28f510){_0x4fa438['push'](_0x4fa438['shift']());}};_0x4e3958(++_0x1f15a7);}(_0xe099,0x1b2));var _0x9e09=function(_0x40be47,_0x45b591){_0x40be47=_0x40be47-0x0;var _0x468f9f=_0xe099[_0x40be47];return _0x468f9f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9e09('0x0')],'allowNull':![]},'channel':{'type':Sequelize[_0x9e09('0x0')]},'description':{'type':Sequelize[_0x9e09('0x0')]},'status':{'type':Sequelize[_0x9e09('0x1')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x9e09('0x2')],'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 3a12e91..ed5ca2a 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 _0x5b91=['ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','offset','count','json','apply','reject','save','update','destroy','then','end','name','send','index','map','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','Automation','includeAll','include','findAll','show','params','find','catch','create','body','addConditions','Condition','ids','getConditions','findOne','order','Action','addActions','omit','getActions','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x1be57b,_0x51c1bb){var _0x4a4360=function(_0x228eff){while(--_0x228eff){_0x1be57b['push'](_0x1be57b['shift']());}};_0x4a4360(++_0x51c1bb);}(_0x5b91,0x99));var _0x15b9=function(_0x31c19c,_0xbe4b70){_0x31c19c=_0x31c19c-0x0;var _0x1a87f7=_0x5b91[_0x31c19c];return _0x1a87f7;};'use strict';var emlformat=require(_0x15b9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x15b9('0x1'));var moment=require(_0x15b9('0x2'));var BPromise=require(_0x15b9('0x3'));var Mustache=require(_0x15b9('0x4'));var util=require(_0x15b9('0x5'));var path=require(_0x15b9('0x6'));var sox=require(_0x15b9('0x7'));var csv=require(_0x15b9('0x8'));var ejs=require(_0x15b9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x15b9('0xa'));var squel=require(_0x15b9('0xb'));var crypto=require(_0x15b9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x15b9('0xd'));var toCsv=require(_0x15b9('0x8'));var querystring=require('querystring');var Papa=require(_0x15b9('0xe'));var Redis=require('ioredis');var authService=require(_0x15b9('0xf'));var qs=require(_0x15b9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x15b9('0x11'));var logger=require(_0x15b9('0x12'))('api');var utils=require(_0x15b9('0x13'));var config=require(_0x15b9('0x14'));var licenseUtil=require(_0x15b9('0x15'));var db=require(_0x15b9('0x16'))['db'];function respondWithStatusCode(_0x4e2d4b,_0x53bb65){_0x53bb65=_0x53bb65||0xcc;return function(_0x429700){if(_0x429700){return _0x4e2d4b[_0x15b9('0x17')](_0x53bb65);}return _0x4e2d4b[_0x15b9('0x18')](_0x53bb65)['end']();};}function respondWithResult(_0x46bb61,_0x27ad78){_0x27ad78=_0x27ad78||0xc8;return function(_0x950df7){if(_0x950df7){return _0x46bb61[_0x15b9('0x18')](_0x27ad78)['json'](_0x950df7);}};}function respondWithFilteredResult(_0x720ac5,_0xab229d){return function(_0x239110){if(_0x239110){var _0x28b702=typeof _0xab229d['offset']===_0x15b9('0x19')&&typeof _0xab229d[_0x15b9('0x1a')]===_0x15b9('0x19');var _0x10bf78=_0x239110['count'];var _0x970abb=_0x28b702?0x0:_0xab229d[_0x15b9('0x1b')];var _0x34085c=_0x28b702?_0x239110[_0x15b9('0x1c')]:_0xab229d['offset']+_0xab229d[_0x15b9('0x1a')];var _0x474c6b;if(_0x34085c>=_0x10bf78){_0x34085c=_0x10bf78;_0x474c6b=0xc8;}else{_0x474c6b=0xce;}_0x720ac5['status'](_0x474c6b);return _0x720ac5['set']('Content-Range',_0x970abb+'-'+_0x34085c+'/'+_0x10bf78)[_0x15b9('0x1d')](_0x239110);}return null;};}function patchUpdates(_0x4422ee){return function(_0x577b42){try{jsonpatch[_0x15b9('0x1e')](_0x577b42,_0x4422ee,!![]);}catch(_0x2fa3ad){return BPromise[_0x15b9('0x1f')](_0x2fa3ad);}return _0x577b42[_0x15b9('0x20')]();};}function saveUpdates(_0x3807a4,_0x4d73a8){return function(_0xf08247){if(_0xf08247){return _0xf08247[_0x15b9('0x21')](_0x3807a4)['then'](function(_0x4d430f){return _0x4d430f;});}return null;};}function removeEntity(_0x541eaa,_0x51becc){return function(_0x7561ff){if(_0x7561ff){return _0x7561ff[_0x15b9('0x22')]()[_0x15b9('0x23')](function(){_0x541eaa['status'](0xcc)[_0x15b9('0x24')]();});}};}function handleEntityNotFound(_0x301320,_0x2dec4b){return function(_0x5928c1){if(!_0x5928c1){_0x301320[_0x15b9('0x17')](0x194);}return _0x5928c1;};}function handleError(_0x26face,_0x459be9){_0x459be9=_0x459be9||0x1f4;return function(_0x1bbf6b){logger['error'](_0x1bbf6b['stack']);if(_0x1bbf6b[_0x15b9('0x25')]){delete _0x1bbf6b[_0x15b9('0x25')];}_0x26face[_0x15b9('0x18')](_0x459be9)[_0x15b9('0x26')](_0x1bbf6b);};}exports[_0x15b9('0x27')]=function(_0x52cb0f,_0x4b0628){var _0x234da5={},_0x3411ee={},_0x5c90e3={'count':0x0,'rows':[]};var _0x3c18f2=_[_0x15b9('0x28')](db['Automation'][_0x15b9('0x29')],function(_0x40d88b){return{'name':_0x40d88b['fieldName'],'type':_0x40d88b[_0x15b9('0x2a')][_0x15b9('0x2b')]};});_0x3411ee[_0x15b9('0x2c')]=_['map'](_0x3c18f2,_0x15b9('0x25'));_0x3411ee['query']=_[_0x15b9('0x2d')](_0x52cb0f['query']);_0x3411ee[_0x15b9('0x2e')]=_[_0x15b9('0x2f')](_0x3411ee['model'],_0x3411ee[_0x15b9('0x30')]);_0x234da5[_0x15b9('0x31')]=_[_0x15b9('0x2f')](_0x3411ee[_0x15b9('0x2c')],qs[_0x15b9('0x32')](_0x52cb0f['query'][_0x15b9('0x32')]));_0x234da5['attributes']=_0x234da5[_0x15b9('0x31')][_0x15b9('0x33')]?_0x234da5['attributes']:_0x3411ee[_0x15b9('0x2c')];if(!_0x52cb0f['query'][_0x15b9('0x34')](_0x15b9('0x35'))){_0x234da5[_0x15b9('0x1a')]=qs['limit'](_0x52cb0f['query']['limit']);_0x234da5['offset']=qs[_0x15b9('0x1b')](_0x52cb0f[_0x15b9('0x30')][_0x15b9('0x1b')]);}_0x234da5['order']=qs[_0x15b9('0x36')](_0x52cb0f[_0x15b9('0x30')][_0x15b9('0x36')]);_0x234da5['where']=qs[_0x15b9('0x2e')](_[_0x15b9('0x37')](_0x52cb0f[_0x15b9('0x30')],_0x3411ee[_0x15b9('0x2e')]),_0x3c18f2);if(_0x52cb0f[_0x15b9('0x30')][_0x15b9('0x38')]){_0x234da5[_0x15b9('0x39')]=_[_0x15b9('0x3a')](_0x234da5[_0x15b9('0x39')],{'$or':_[_0x15b9('0x28')](_0x3c18f2,function(_0xd241c1){if(_0xd241c1[_0x15b9('0x2a')]!==_0x15b9('0x3b')){var _0x1f0bed={};_0x1f0bed[_0xd241c1['name']]={'$like':'%'+_0x52cb0f[_0x15b9('0x30')][_0x15b9('0x38')]+'%'};return _0x1f0bed;}})});}_0x234da5=_[_0x15b9('0x3a')]({},_0x234da5,_0x52cb0f[_0x15b9('0x3c')]);var _0x37ca66={'where':_0x234da5['where']};return db[_0x15b9('0x3d')]['count'](_0x37ca66)['then'](function(_0x4aedd7){_0x5c90e3[_0x15b9('0x1c')]=_0x4aedd7;if(_0x52cb0f[_0x15b9('0x30')][_0x15b9('0x3e')]){_0x234da5[_0x15b9('0x3f')]=[{'all':!![]}];}return db[_0x15b9('0x3d')][_0x15b9('0x40')](_0x234da5);})['then'](function(_0x47f84f){_0x5c90e3['rows']=_0x47f84f;return _0x5c90e3;})['then'](respondWithFilteredResult(_0x4b0628,_0x234da5))['catch'](handleError(_0x4b0628,null));};exports[_0x15b9('0x41')]=function(_0x12a434,_0x635bbb){var _0x668e8a={'raw':![],'where':{'id':_0x12a434[_0x15b9('0x42')]['id']}},_0x40e1e0={};_0x40e1e0[_0x15b9('0x2c')]=_[_0x15b9('0x2d')](db[_0x15b9('0x3d')][_0x15b9('0x29')]);_0x40e1e0['query']=_[_0x15b9('0x2d')](_0x12a434[_0x15b9('0x30')]);_0x40e1e0['filters']=_[_0x15b9('0x2f')](_0x40e1e0[_0x15b9('0x2c')],_0x40e1e0[_0x15b9('0x30')]);_0x668e8a[_0x15b9('0x31')]=_[_0x15b9('0x2f')](_0x40e1e0[_0x15b9('0x2c')],qs[_0x15b9('0x32')](_0x12a434[_0x15b9('0x30')]['fields']));_0x668e8a[_0x15b9('0x31')]=_0x668e8a[_0x15b9('0x31')][_0x15b9('0x33')]?_0x668e8a[_0x15b9('0x31')]:_0x40e1e0[_0x15b9('0x2c')];if(_0x12a434[_0x15b9('0x30')][_0x15b9('0x3e')]){_0x668e8a[_0x15b9('0x3f')]=[{'all':!![]}];}_0x668e8a=_[_0x15b9('0x3a')]({},_0x668e8a,_0x12a434[_0x15b9('0x3c')]);return db[_0x15b9('0x3d')][_0x15b9('0x43')](_0x668e8a)[_0x15b9('0x23')](handleEntityNotFound(_0x635bbb,null))['then'](respondWithResult(_0x635bbb,null))[_0x15b9('0x44')](handleError(_0x635bbb,null));};exports[_0x15b9('0x45')]=function(_0x2ca265,_0x5a271a){return db[_0x15b9('0x3d')][_0x15b9('0x45')](_0x2ca265[_0x15b9('0x46')],{})[_0x15b9('0x23')](respondWithResult(_0x5a271a,0xc9))[_0x15b9('0x44')](handleError(_0x5a271a,null));};exports[_0x15b9('0x21')]=function(_0x1d11c2,_0x56fe0f){if(_0x1d11c2[_0x15b9('0x46')]['id']){delete _0x1d11c2[_0x15b9('0x46')]['id'];}return db[_0x15b9('0x3d')][_0x15b9('0x43')]({'where':{'id':_0x1d11c2[_0x15b9('0x42')]['id']}})['then'](handleEntityNotFound(_0x56fe0f,null))['then'](saveUpdates(_0x1d11c2[_0x15b9('0x46')],null))[_0x15b9('0x23')](respondWithResult(_0x56fe0f,null))[_0x15b9('0x44')](handleError(_0x56fe0f,null));};exports['destroy']=function(_0x689f44,_0x3163a9){return db[_0x15b9('0x3d')]['find']({'where':{'id':_0x689f44['params']['id']}})[_0x15b9('0x23')](handleEntityNotFound(_0x3163a9,null))[_0x15b9('0x23')](removeEntity(_0x3163a9,null))[_0x15b9('0x44')](handleError(_0x3163a9,null));};exports[_0x15b9('0x47')]=function(_0x515dda,_0x59cfdc,_0x2a745e){return db[_0x15b9('0x48')]['find']({'where':{'id':_0x515dda[_0x15b9('0x42')]['id']}})['then'](handleEntityNotFound(_0x59cfdc,null))[_0x15b9('0x23')](function(_0x19b72d){if(_0x19b72d){return _0x19b72d[_0x15b9('0x47')](_0x515dda['body'][_0x15b9('0x49')],_['omit'](_0x515dda[_0x15b9('0x46')],[_0x15b9('0x49'),'id'])||{});}})[_0x15b9('0x23')](respondWithResult(_0x59cfdc,null))[_0x15b9('0x44')](handleError(_0x59cfdc,null));};exports[_0x15b9('0x4a')]=function(_0x58250d,_0x5d1f8d,_0x5a7a53){var _0x429d02={};var _0x3b4464={};var _0x2f3e3f;var _0x2707b7;return db[_0x15b9('0x3d')][_0x15b9('0x4b')]({'where':{'id':_0x58250d['params']['id']}})['then'](handleEntityNotFound(_0x5d1f8d,null))[_0x15b9('0x23')](function(_0x3b95f1){if(_0x3b95f1){_0x2f3e3f=_0x3b95f1;_0x3b4464[_0x15b9('0x2c')]=_['keys'](db[_0x15b9('0x48')]['rawAttributes']);_0x3b4464[_0x15b9('0x30')]=_[_0x15b9('0x2d')](_0x58250d['query']);_0x3b4464[_0x15b9('0x2e')]=_[_0x15b9('0x2f')](_0x3b4464[_0x15b9('0x2c')],_0x3b4464['query']);_0x429d02[_0x15b9('0x31')]=_['intersection'](_0x3b4464[_0x15b9('0x2c')],qs[_0x15b9('0x32')](_0x58250d[_0x15b9('0x30')][_0x15b9('0x32')]));_0x429d02['attributes']=_0x429d02['attributes']['length']?_0x429d02['attributes']:_0x3b4464['model'];_0x429d02[_0x15b9('0x4c')]=qs['sort'](_0x58250d[_0x15b9('0x30')][_0x15b9('0x36')]);_0x429d02[_0x15b9('0x39')]=qs[_0x15b9('0x2e')](_[_0x15b9('0x37')](_0x58250d[_0x15b9('0x30')],_0x3b4464['filters']));if(_0x58250d[_0x15b9('0x30')][_0x15b9('0x38')]){_0x429d02[_0x15b9('0x39')]=_[_0x15b9('0x3a')](_0x429d02['where'],{'$or':_['map'](_0x429d02[_0x15b9('0x31')],function(_0x228987){var _0x165352={};_0x165352[_0x228987]={'$like':'%'+_0x58250d[_0x15b9('0x30')][_0x15b9('0x38')]+'%'};return _0x165352;})});}_0x429d02=_[_0x15b9('0x3a')]({},_0x429d02,_0x58250d[_0x15b9('0x3c')]);return _0x2f3e3f[_0x15b9('0x4a')](_0x429d02);}})[_0x15b9('0x23')](function(_0x8a4b03){if(_0x8a4b03){_0x2707b7=_0x8a4b03[_0x15b9('0x33')];if(!_0x58250d[_0x15b9('0x30')][_0x15b9('0x34')]('nolimit')){_0x429d02[_0x15b9('0x1a')]=qs[_0x15b9('0x1a')](_0x58250d[_0x15b9('0x30')]['limit']);_0x429d02[_0x15b9('0x1b')]=qs[_0x15b9('0x1b')](_0x58250d[_0x15b9('0x30')][_0x15b9('0x1b')]);}return _0x2f3e3f[_0x15b9('0x4a')](_0x429d02);}})[_0x15b9('0x23')](function(_0x38dfeb){if(_0x38dfeb){return _0x38dfeb?{'count':_0x2707b7,'rows':_0x38dfeb}:null;}})[_0x15b9('0x23')](respondWithResult(_0x5d1f8d,null))[_0x15b9('0x44')](handleError(_0x5d1f8d,null));};exports['addActions']=function(_0x5843ba,_0x3e8cfc,_0x3a7b5a){return db[_0x15b9('0x4d')][_0x15b9('0x43')]({'where':{'id':_0x5843ba[_0x15b9('0x42')]['id']}})[_0x15b9('0x23')](handleEntityNotFound(_0x3e8cfc,null))[_0x15b9('0x23')](function(_0x2c89f5){if(_0x2c89f5){return _0x2c89f5[_0x15b9('0x4e')](_0x5843ba[_0x15b9('0x46')]['ids'],_[_0x15b9('0x4f')](_0x5843ba[_0x15b9('0x46')],[_0x15b9('0x49'),'id'])||{});}})[_0x15b9('0x23')](respondWithResult(_0x3e8cfc,null))[_0x15b9('0x44')](handleError(_0x3e8cfc,null));};exports[_0x15b9('0x50')]=function(_0x33fadb,_0x350d42,_0x2033e4){var _0x4a95df={};var _0x124622={};var _0x129872;var _0x247f03;return db[_0x15b9('0x3d')][_0x15b9('0x4b')]({'where':{'id':_0x33fadb[_0x15b9('0x42')]['id']}})[_0x15b9('0x23')](handleEntityNotFound(_0x350d42,null))[_0x15b9('0x23')](function(_0x365e60){if(_0x365e60){_0x129872=_0x365e60;_0x124622[_0x15b9('0x2c')]=_['keys'](db[_0x15b9('0x4d')][_0x15b9('0x29')]);_0x124622[_0x15b9('0x30')]=_[_0x15b9('0x2d')](_0x33fadb[_0x15b9('0x30')]);_0x124622['filters']=_['intersection'](_0x124622[_0x15b9('0x2c')],_0x124622['query']);_0x4a95df[_0x15b9('0x31')]=_[_0x15b9('0x2f')](_0x124622['model'],qs[_0x15b9('0x32')](_0x33fadb['query'][_0x15b9('0x32')]));_0x4a95df[_0x15b9('0x31')]=_0x4a95df[_0x15b9('0x31')][_0x15b9('0x33')]?_0x4a95df['attributes']:_0x124622[_0x15b9('0x2c')];_0x4a95df[_0x15b9('0x4c')]=qs['sort'](_0x33fadb[_0x15b9('0x30')][_0x15b9('0x36')]);_0x4a95df[_0x15b9('0x39')]=qs['filters'](_['pick'](_0x33fadb[_0x15b9('0x30')],_0x124622['filters']));if(_0x33fadb['query'][_0x15b9('0x38')]){_0x4a95df['where']=_[_0x15b9('0x3a')](_0x4a95df[_0x15b9('0x39')],{'$or':_[_0x15b9('0x28')](_0x4a95df[_0x15b9('0x31')],function(_0x59776c){var _0x1ae2b6={};_0x1ae2b6[_0x59776c]={'$like':'%'+_0x33fadb['query'][_0x15b9('0x38')]+'%'};return _0x1ae2b6;})});}_0x4a95df=_[_0x15b9('0x3a')]({},_0x4a95df,_0x33fadb[_0x15b9('0x3c')]);return _0x129872[_0x15b9('0x50')](_0x4a95df);}})[_0x15b9('0x23')](function(_0x17d4ee){if(_0x17d4ee){_0x247f03=_0x17d4ee[_0x15b9('0x33')];if(!_0x33fadb['query'][_0x15b9('0x34')]('nolimit')){_0x4a95df[_0x15b9('0x1a')]=qs[_0x15b9('0x1a')](_0x33fadb['query'][_0x15b9('0x1a')]);_0x4a95df[_0x15b9('0x1b')]=qs[_0x15b9('0x1b')](_0x33fadb['query'][_0x15b9('0x1b')]);}return _0x129872[_0x15b9('0x50')](_0x4a95df);}})[_0x15b9('0x23')](function(_0x43dd23){if(_0x43dd23){return _0x43dd23?{'count':_0x247f03,'rows':_0x43dd23}:null;}})[_0x15b9('0x23')](respondWithResult(_0x350d42,null))[_0x15b9('0x44')](handleError(_0x350d42,null));}; \ No newline at end of file +var _0x1952=['offset','limit','Content-Range','json','apply','reject','save','then','end','error','stack','name','send','index','Automation','rawAttributes','fieldName','type','key','map','query','keys','filters','attributes','fields','length','model','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','intersection','create','body','update','find','addConditions','ids','omit','getConditions','findOne','hasOwnProperty','addActions','Action','getActions','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','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','sendStatus','status','undefined','count'];(function(_0x224f65,_0x4750bf){var _0x3f921c=function(_0x1b5f64){while(--_0x1b5f64){_0x224f65['push'](_0x224f65['shift']());}};_0x3f921c(++_0x4750bf);}(_0x1952,0xdd));var _0x2195=function(_0x18ebd4,_0x318045){_0x18ebd4=_0x18ebd4-0x0;var _0x37960f=_0x1952[_0x18ebd4];return _0x37960f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2195('0x0'));var jsonpatch=require(_0x2195('0x1'));var rp=require(_0x2195('0x2'));var moment=require(_0x2195('0x3'));var BPromise=require(_0x2195('0x4'));var Mustache=require(_0x2195('0x5'));var util=require(_0x2195('0x6'));var path=require(_0x2195('0x7'));var sox=require(_0x2195('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2195('0x9'));var _=require(_0x2195('0xa'));var squel=require(_0x2195('0xb'));var crypto=require(_0x2195('0xc'));var jsforce=require(_0x2195('0xd'));var deskjs=require(_0x2195('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2195('0xf'));var Redis=require(_0x2195('0x10'));var authService=require(_0x2195('0x11'));var qs=require(_0x2195('0x12'));var as=require(_0x2195('0x13'));var hardwareService=require(_0x2195('0x14'));var logger=require(_0x2195('0x15'))(_0x2195('0x16'));var utils=require(_0x2195('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x318fa9,_0x40ccfa){_0x40ccfa=_0x40ccfa||0xcc;return function(_0x34e5ef){if(_0x34e5ef){return _0x318fa9[_0x2195('0x18')](_0x40ccfa);}return _0x318fa9[_0x2195('0x19')](_0x40ccfa)['end']();};}function respondWithResult(_0x5b504e,_0x580204){_0x580204=_0x580204||0xc8;return function(_0x230958){if(_0x230958){return _0x5b504e['status'](_0x580204)['json'](_0x230958);}};}function respondWithFilteredResult(_0x516617,_0x441790){return function(_0x4c1e2b){if(_0x4c1e2b){var _0x105a92=typeof _0x441790['offset']===_0x2195('0x1a')&&typeof _0x441790['limit']===_0x2195('0x1a');var _0x2d3e9b=_0x4c1e2b[_0x2195('0x1b')];var _0x390b36=_0x105a92?0x0:_0x441790[_0x2195('0x1c')];var _0x10a213=_0x105a92?_0x4c1e2b[_0x2195('0x1b')]:_0x441790[_0x2195('0x1c')]+_0x441790[_0x2195('0x1d')];var _0x903a0a;if(_0x10a213>=_0x2d3e9b){_0x10a213=_0x2d3e9b;_0x903a0a=0xc8;}else{_0x903a0a=0xce;}_0x516617[_0x2195('0x19')](_0x903a0a);return _0x516617['set'](_0x2195('0x1e'),_0x390b36+'-'+_0x10a213+'/'+_0x2d3e9b)[_0x2195('0x1f')](_0x4c1e2b);}return null;};}function patchUpdates(_0x52b35e){return function(_0x2477d3){try{jsonpatch[_0x2195('0x20')](_0x2477d3,_0x52b35e,!![]);}catch(_0xe99e90){return BPromise[_0x2195('0x21')](_0xe99e90);}return _0x2477d3[_0x2195('0x22')]();};}function saveUpdates(_0x22e39c,_0x2769fd){return function(_0x31be88){if(_0x31be88){return _0x31be88['update'](_0x22e39c)['then'](function(_0x2b1339){return _0x2b1339;});}return null;};}function removeEntity(_0x468c50,_0x1b86aa){return function(_0x321808){if(_0x321808){return _0x321808['destroy']()[_0x2195('0x23')](function(){_0x468c50[_0x2195('0x19')](0xcc)[_0x2195('0x24')]();});}};}function handleEntityNotFound(_0x626274,_0x59d1b3){return function(_0x668bf6){if(!_0x668bf6){_0x626274[_0x2195('0x18')](0x194);}return _0x668bf6;};}function handleError(_0x577647,_0x5d6701){_0x5d6701=_0x5d6701||0x1f4;return function(_0x2f9b4a){logger[_0x2195('0x25')](_0x2f9b4a[_0x2195('0x26')]);if(_0x2f9b4a['name']){delete _0x2f9b4a[_0x2195('0x27')];}_0x577647['status'](_0x5d6701)[_0x2195('0x28')](_0x2f9b4a);};}exports[_0x2195('0x29')]=function(_0x26c40b,_0x13c0e){var _0x4ec88f={},_0x299493={},_0x4e3ad9={'count':0x0,'rows':[]};var _0x14bad2=_['map'](db[_0x2195('0x2a')][_0x2195('0x2b')],function(_0x598990){return{'name':_0x598990[_0x2195('0x2c')],'type':_0x598990[_0x2195('0x2d')][_0x2195('0x2e')]};});_0x299493['model']=_[_0x2195('0x2f')](_0x14bad2,_0x2195('0x27'));_0x299493[_0x2195('0x30')]=_[_0x2195('0x31')](_0x26c40b[_0x2195('0x30')]);_0x299493[_0x2195('0x32')]=_['intersection'](_0x299493['model'],_0x299493[_0x2195('0x30')]);_0x4ec88f[_0x2195('0x33')]=_['intersection'](_0x299493['model'],qs[_0x2195('0x34')](_0x26c40b[_0x2195('0x30')][_0x2195('0x34')]));_0x4ec88f[_0x2195('0x33')]=_0x4ec88f[_0x2195('0x33')][_0x2195('0x35')]?_0x4ec88f['attributes']:_0x299493[_0x2195('0x36')];if(!_0x26c40b[_0x2195('0x30')]['hasOwnProperty'](_0x2195('0x37'))){_0x4ec88f[_0x2195('0x1d')]=qs[_0x2195('0x1d')](_0x26c40b[_0x2195('0x30')][_0x2195('0x1d')]);_0x4ec88f[_0x2195('0x1c')]=qs['offset'](_0x26c40b[_0x2195('0x30')][_0x2195('0x1c')]);}_0x4ec88f[_0x2195('0x38')]=qs[_0x2195('0x39')](_0x26c40b['query'][_0x2195('0x39')]);_0x4ec88f[_0x2195('0x3a')]=qs['filters'](_[_0x2195('0x3b')](_0x26c40b[_0x2195('0x30')],_0x299493['filters']),_0x14bad2);if(_0x26c40b[_0x2195('0x30')][_0x2195('0x3c')]){_0x4ec88f[_0x2195('0x3a')]=_['merge'](_0x4ec88f['where'],{'$or':_[_0x2195('0x2f')](_0x14bad2,function(_0x505a26){if(_0x505a26[_0x2195('0x2d')]!=='VIRTUAL'){var _0x538707={};_0x538707[_0x505a26[_0x2195('0x27')]]={'$like':'%'+_0x26c40b[_0x2195('0x30')][_0x2195('0x3c')]+'%'};return _0x538707;}})});}_0x4ec88f=_[_0x2195('0x3d')]({},_0x4ec88f,_0x26c40b[_0x2195('0x3e')]);var _0x3faaa5={'where':_0x4ec88f['where']};return db['Automation'][_0x2195('0x1b')](_0x3faaa5)['then'](function(_0x293044){_0x4e3ad9[_0x2195('0x1b')]=_0x293044;if(_0x26c40b[_0x2195('0x30')][_0x2195('0x3f')]){_0x4ec88f[_0x2195('0x40')]=[{'all':!![]}];}return db['Automation']['findAll'](_0x4ec88f);})[_0x2195('0x23')](function(_0x543dc8){_0x4e3ad9[_0x2195('0x41')]=_0x543dc8;return _0x4e3ad9;})[_0x2195('0x23')](respondWithFilteredResult(_0x13c0e,_0x4ec88f))[_0x2195('0x42')](handleError(_0x13c0e,null));};exports[_0x2195('0x43')]=function(_0x5f4566,_0x41c41b){var _0x23a7b5={'raw':![],'where':{'id':_0x5f4566[_0x2195('0x44')]['id']}},_0x3131ca={};_0x3131ca[_0x2195('0x36')]=_['keys'](db[_0x2195('0x2a')][_0x2195('0x2b')]);_0x3131ca[_0x2195('0x30')]=_[_0x2195('0x31')](_0x5f4566[_0x2195('0x30')]);_0x3131ca[_0x2195('0x32')]=_[_0x2195('0x45')](_0x3131ca[_0x2195('0x36')],_0x3131ca['query']);_0x23a7b5[_0x2195('0x33')]=_[_0x2195('0x45')](_0x3131ca[_0x2195('0x36')],qs[_0x2195('0x34')](_0x5f4566['query'][_0x2195('0x34')]));_0x23a7b5[_0x2195('0x33')]=_0x23a7b5['attributes'][_0x2195('0x35')]?_0x23a7b5['attributes']:_0x3131ca['model'];if(_0x5f4566[_0x2195('0x30')][_0x2195('0x3f')]){_0x23a7b5[_0x2195('0x40')]=[{'all':!![]}];}_0x23a7b5=_[_0x2195('0x3d')]({},_0x23a7b5,_0x5f4566[_0x2195('0x3e')]);return db[_0x2195('0x2a')]['find'](_0x23a7b5)[_0x2195('0x23')](handleEntityNotFound(_0x41c41b,null))[_0x2195('0x23')](respondWithResult(_0x41c41b,null))[_0x2195('0x42')](handleError(_0x41c41b,null));};exports[_0x2195('0x46')]=function(_0x4994f3,_0x47fc78){return db[_0x2195('0x2a')][_0x2195('0x46')](_0x4994f3[_0x2195('0x47')],{})[_0x2195('0x23')](respondWithResult(_0x47fc78,0xc9))['catch'](handleError(_0x47fc78,null));};exports[_0x2195('0x48')]=function(_0x312cdc,_0x5cacc0){if(_0x312cdc[_0x2195('0x47')]['id']){delete _0x312cdc[_0x2195('0x47')]['id'];}return db['Automation'][_0x2195('0x49')]({'where':{'id':_0x312cdc[_0x2195('0x44')]['id']}})[_0x2195('0x23')](handleEntityNotFound(_0x5cacc0,null))[_0x2195('0x23')](saveUpdates(_0x312cdc[_0x2195('0x47')],null))[_0x2195('0x23')](respondWithResult(_0x5cacc0,null))[_0x2195('0x42')](handleError(_0x5cacc0,null));};exports['destroy']=function(_0x3d1799,_0x17f0fa){return db[_0x2195('0x2a')][_0x2195('0x49')]({'where':{'id':_0x3d1799['params']['id']}})[_0x2195('0x23')](handleEntityNotFound(_0x17f0fa,null))['then'](removeEntity(_0x17f0fa,null))['catch'](handleError(_0x17f0fa,null));};exports['addConditions']=function(_0x31fc1,_0x413c47,_0x5cea91){return db['Condition'][_0x2195('0x49')]({'where':{'id':_0x31fc1['params']['id']}})[_0x2195('0x23')](handleEntityNotFound(_0x413c47,null))[_0x2195('0x23')](function(_0x17396f){if(_0x17396f){return _0x17396f[_0x2195('0x4a')](_0x31fc1[_0x2195('0x47')][_0x2195('0x4b')],_[_0x2195('0x4c')](_0x31fc1[_0x2195('0x47')],['ids','id'])||{});}})[_0x2195('0x23')](respondWithResult(_0x413c47,null))[_0x2195('0x42')](handleError(_0x413c47,null));};exports[_0x2195('0x4d')]=function(_0x5ebeb6,_0x421cd2,_0xe9eff2){var _0xd3d038={};var _0x2f7445={};var _0xd70647;var _0x4ccc38;return db[_0x2195('0x2a')][_0x2195('0x4e')]({'where':{'id':_0x5ebeb6[_0x2195('0x44')]['id']}})[_0x2195('0x23')](handleEntityNotFound(_0x421cd2,null))[_0x2195('0x23')](function(_0x486aa1){if(_0x486aa1){_0xd70647=_0x486aa1;_0x2f7445[_0x2195('0x36')]=_[_0x2195('0x31')](db['Condition']['rawAttributes']);_0x2f7445[_0x2195('0x30')]=_[_0x2195('0x31')](_0x5ebeb6[_0x2195('0x30')]);_0x2f7445[_0x2195('0x32')]=_[_0x2195('0x45')](_0x2f7445[_0x2195('0x36')],_0x2f7445[_0x2195('0x30')]);_0xd3d038['attributes']=_[_0x2195('0x45')](_0x2f7445[_0x2195('0x36')],qs[_0x2195('0x34')](_0x5ebeb6['query'][_0x2195('0x34')]));_0xd3d038[_0x2195('0x33')]=_0xd3d038['attributes'][_0x2195('0x35')]?_0xd3d038[_0x2195('0x33')]:_0x2f7445['model'];_0xd3d038[_0x2195('0x38')]=qs[_0x2195('0x39')](_0x5ebeb6['query'][_0x2195('0x39')]);_0xd3d038[_0x2195('0x3a')]=qs[_0x2195('0x32')](_['pick'](_0x5ebeb6[_0x2195('0x30')],_0x2f7445[_0x2195('0x32')]));if(_0x5ebeb6[_0x2195('0x30')]['filter']){_0xd3d038[_0x2195('0x3a')]=_['merge'](_0xd3d038[_0x2195('0x3a')],{'$or':_[_0x2195('0x2f')](_0xd3d038[_0x2195('0x33')],function(_0x390b89){var _0x571d4e={};_0x571d4e[_0x390b89]={'$like':'%'+_0x5ebeb6[_0x2195('0x30')][_0x2195('0x3c')]+'%'};return _0x571d4e;})});}_0xd3d038=_[_0x2195('0x3d')]({},_0xd3d038,_0x5ebeb6[_0x2195('0x3e')]);return _0xd70647['getConditions'](_0xd3d038);}})[_0x2195('0x23')](function(_0x36f18e){if(_0x36f18e){_0x4ccc38=_0x36f18e[_0x2195('0x35')];if(!_0x5ebeb6[_0x2195('0x30')][_0x2195('0x4f')](_0x2195('0x37'))){_0xd3d038[_0x2195('0x1d')]=qs[_0x2195('0x1d')](_0x5ebeb6[_0x2195('0x30')][_0x2195('0x1d')]);_0xd3d038[_0x2195('0x1c')]=qs['offset'](_0x5ebeb6[_0x2195('0x30')]['offset']);}return _0xd70647[_0x2195('0x4d')](_0xd3d038);}})[_0x2195('0x23')](function(_0x78e3ad){if(_0x78e3ad){return _0x78e3ad?{'count':_0x4ccc38,'rows':_0x78e3ad}:null;}})[_0x2195('0x23')](respondWithResult(_0x421cd2,null))[_0x2195('0x42')](handleError(_0x421cd2,null));};exports[_0x2195('0x50')]=function(_0x4ae862,_0x474a4e,_0x21bf10){return db[_0x2195('0x51')]['find']({'where':{'id':_0x4ae862[_0x2195('0x44')]['id']}})[_0x2195('0x23')](handleEntityNotFound(_0x474a4e,null))['then'](function(_0x381fdb){if(_0x381fdb){return _0x381fdb[_0x2195('0x50')](_0x4ae862[_0x2195('0x47')][_0x2195('0x4b')],_[_0x2195('0x4c')](_0x4ae862[_0x2195('0x47')],[_0x2195('0x4b'),'id'])||{});}})['then'](respondWithResult(_0x474a4e,null))[_0x2195('0x42')](handleError(_0x474a4e,null));};exports['getActions']=function(_0x4f8188,_0x25e5c0,_0x399706){var _0x4b6894={};var _0x1c2d1d={};var _0x3285d4;var _0x40f32d;return db[_0x2195('0x2a')]['findOne']({'where':{'id':_0x4f8188['params']['id']}})[_0x2195('0x23')](handleEntityNotFound(_0x25e5c0,null))[_0x2195('0x23')](function(_0x436a33){if(_0x436a33){_0x3285d4=_0x436a33;_0x1c2d1d[_0x2195('0x36')]=_[_0x2195('0x31')](db[_0x2195('0x51')][_0x2195('0x2b')]);_0x1c2d1d[_0x2195('0x30')]=_[_0x2195('0x31')](_0x4f8188['query']);_0x1c2d1d[_0x2195('0x32')]=_[_0x2195('0x45')](_0x1c2d1d[_0x2195('0x36')],_0x1c2d1d[_0x2195('0x30')]);_0x4b6894[_0x2195('0x33')]=_['intersection'](_0x1c2d1d[_0x2195('0x36')],qs['fields'](_0x4f8188['query'][_0x2195('0x34')]));_0x4b6894[_0x2195('0x33')]=_0x4b6894[_0x2195('0x33')]['length']?_0x4b6894[_0x2195('0x33')]:_0x1c2d1d[_0x2195('0x36')];_0x4b6894['order']=qs[_0x2195('0x39')](_0x4f8188[_0x2195('0x30')][_0x2195('0x39')]);_0x4b6894[_0x2195('0x3a')]=qs[_0x2195('0x32')](_['pick'](_0x4f8188[_0x2195('0x30')],_0x1c2d1d['filters']));if(_0x4f8188['query'][_0x2195('0x3c')]){_0x4b6894[_0x2195('0x3a')]=_[_0x2195('0x3d')](_0x4b6894['where'],{'$or':_[_0x2195('0x2f')](_0x4b6894[_0x2195('0x33')],function(_0x2fc49b){var _0x566c9b={};_0x566c9b[_0x2fc49b]={'$like':'%'+_0x4f8188[_0x2195('0x30')][_0x2195('0x3c')]+'%'};return _0x566c9b;})});}_0x4b6894=_['merge']({},_0x4b6894,_0x4f8188['options']);return _0x3285d4[_0x2195('0x52')](_0x4b6894);}})['then'](function(_0x4dcee9){if(_0x4dcee9){_0x40f32d=_0x4dcee9[_0x2195('0x35')];if(!_0x4f8188['query'][_0x2195('0x4f')](_0x2195('0x37'))){_0x4b6894[_0x2195('0x1d')]=qs[_0x2195('0x1d')](_0x4f8188['query'][_0x2195('0x1d')]);_0x4b6894[_0x2195('0x1c')]=qs[_0x2195('0x1c')](_0x4f8188[_0x2195('0x30')][_0x2195('0x1c')]);}return _0x3285d4[_0x2195('0x52')](_0x4b6894);}})[_0x2195('0x23')](function(_0x374038){if(_0x374038){return _0x374038?{'count':_0x40f32d,'rows':_0x374038}:null;}})['then'](respondWithResult(_0x25e5c0,null))['catch'](handleError(_0x25e5c0,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 2da1d5d..f282717 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 _0xf658=['api','bluebird','request-promise','path','rimraf','./automation.attributes','exports','define','Automation','util','../../config/logger'];(function(_0x11b2ca,_0x5257ab){var _0x4fbdb9=function(_0x21b3e0){while(--_0x21b3e0){_0x11b2ca['push'](_0x11b2ca['shift']());}};_0x4fbdb9(++_0x5257ab);}(_0xf658,0x1ab));var _0x8f65=function(_0x599d9b,_0x554e8c){_0x599d9b=_0x599d9b-0x0;var _0x1e9721=_0xf658[_0x599d9b];return _0x1e9721;};'use strict';var _=require('lodash');var util=require(_0x8f65('0x0'));var logger=require(_0x8f65('0x1'))(_0x8f65('0x2'));var moment=require('moment');var BPromise=require(_0x8f65('0x3'));var rp=require(_0x8f65('0x4'));var fs=require('fs');var path=require(_0x8f65('0x5'));var rimraf=require(_0x8f65('0x6'));var config=require('../../config/environment');var attributes=require(_0x8f65('0x7'));module[_0x8f65('0x8')]=function(_0x1db80e,_0x5074fa){return _0x1db80e[_0x8f65('0x9')](_0x8f65('0xa'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e4e=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','lodash'];(function(_0x5e38f9,_0x5db6c4){var _0x4a914f=function(_0x369d29){while(--_0x369d29){_0x5e38f9['push'](_0x5e38f9['shift']());}};_0x4a914f(++_0x5db6c4);}(_0x0e4e,0x15e));var _0xe0e4=function(_0x1b69aa,_0x5aa147){_0x1b69aa=_0x1b69aa-0x0;var _0x42647d=_0x0e4e[_0x1b69aa];return _0x42647d;};'use strict';var _=require(_0xe0e4('0x0'));var util=require(_0xe0e4('0x1'));var logger=require(_0xe0e4('0x2'))('api');var moment=require(_0xe0e4('0x3'));var BPromise=require('bluebird');var rp=require(_0xe0e4('0x4'));var fs=require('fs');var path=require(_0xe0e4('0x5'));var rimraf=require(_0xe0e4('0x6'));var config=require(_0xe0e4('0x7'));var attributes=require(_0xe0e4('0x8'));module[_0xe0e4('0x9')]=function(_0xcbf2cc,_0x454d2e){return _0xcbf2cc[_0xe0e4('0xa')](_0xe0e4('0xb'),attributes,{'tableName':_0xe0e4('0xc'),'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 9900503..953028a 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 _0x726f=['result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s,\x20%s','error','Automation,\x20%s,\x20%s','message'];(function(_0x391dd5,_0x34ebbc){var _0x4dbd93=function(_0x538b34){while(--_0x538b34){_0x391dd5['push'](_0x391dd5['shift']());}};_0x4dbd93(++_0x34ebbc);}(_0x726f,0xa2));var _0xf726=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x726f[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0xf726('0x0'));var util=require(_0xf726('0x1'));var moment=require('moment');var BPromise=require(_0xf726('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf726('0x3'))['db'];var utils=require(_0xf726('0x4'));var logger=require(_0xf726('0x5'))(_0xf726('0x6'));var config=require(_0xf726('0x7'));var jayson=require(_0xf726('0x8'));var client=jayson[_0xf726('0x9')][_0xf726('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2dd6b8,_0x2ed93b,_0x43449d){return new BPromise(function(_0x3ec084,_0xe56ebc){return client[_0xf726('0xb')](_0x2dd6b8,_0x43449d)[_0xf726('0xc')](function(_0x45c2a3){logger[_0xf726('0xd')]('Automation,\x20%s,\x20%s',_0x2ed93b,'request\x20sent');logger['debug'](_0xf726('0xe'),_0x2ed93b,'request\x20sent',JSON['stringify'](_0x45c2a3));if(_0x45c2a3[_0xf726('0xf')]){if(_0x45c2a3[_0xf726('0xf')]['code']===0x1f4){logger[_0xf726('0xf')](_0xf726('0x10'),_0x2ed93b,_0x45c2a3[_0xf726('0xf')][_0xf726('0x11')]);return _0xe56ebc(_0x45c2a3[_0xf726('0xf')][_0xf726('0x11')]);}logger[_0xf726('0xf')](_0xf726('0x10'),_0x2ed93b,_0x45c2a3['error'][_0xf726('0x11')]);return _0x3ec084(_0x45c2a3['error']['message']);}else{logger[_0xf726('0xd')](_0xf726('0x10'),_0x2ed93b,'request\x20sent');_0x3ec084(_0x45c2a3[_0xf726('0x12')][_0xf726('0x11')]);}})[_0xf726('0x13')](function(_0x545e84){logger[_0xf726('0xf')](_0xf726('0x10'),_0x2ed93b,_0x545e84);_0xe56ebc(_0x545e84);});});} \ No newline at end of file +var _0xf9ac=['info','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','Automation,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','then'];(function(_0x5dde65,_0x1eb6f7){var _0x1e9245=function(_0x5ce237){while(--_0x5ce237){_0x5dde65['push'](_0x5dde65['shift']());}};_0x1e9245(++_0x1eb6f7);}(_0xf9ac,0x87));var _0xcf9a=function(_0x4eb5a8,_0x35684b){_0x4eb5a8=_0x4eb5a8-0x0;var _0x29b9fb=_0xf9ac[_0x4eb5a8];return _0x29b9fb;};'use strict';var _=require(_0xcf9a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcf9a('0x1'));var rs=require(_0xcf9a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcf9a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcf9a('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcf9a('0x5'));var client=jayson[_0xcf9a('0x6')][_0xcf9a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x235e47,_0x54ebf6,_0x33a1a6){return new BPromise(function(_0x3d2f54,_0x4c0665){return client['request'](_0x235e47,_0x33a1a6)[_0xcf9a('0x8')](function(_0x579cf9){logger[_0xcf9a('0x9')]('Automation,\x20%s,\x20%s',_0x54ebf6,_0xcf9a('0xa'));logger['debug'](_0xcf9a('0xb'),_0x54ebf6,_0xcf9a('0xa'),JSON[_0xcf9a('0xc')](_0x579cf9));if(_0x579cf9['error']){if(_0x579cf9['error']['code']===0x1f4){logger[_0xcf9a('0xd')](_0xcf9a('0xe'),_0x54ebf6,_0x579cf9['error'][_0xcf9a('0xf')]);return _0x4c0665(_0x579cf9[_0xcf9a('0xd')][_0xcf9a('0xf')]);}logger['error'](_0xcf9a('0xe'),_0x54ebf6,_0x579cf9['error']['message']);return _0x3d2f54(_0x579cf9['error']['message']);}else{logger[_0xcf9a('0x9')](_0xcf9a('0xe'),_0x54ebf6,_0xcf9a('0xa'));_0x3d2f54(_0x579cf9[_0xcf9a('0x10')][_0xcf9a('0xf')]);}})[_0xcf9a('0x11')](function(_0x25dc10){logger['error'](_0xcf9a('0xe'),_0x54ebf6,_0x25dc10);_0x4c0665(_0x25dc10);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index d531e2f..0cf3021 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 _0x34ab=['exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','index','get','/:id','show','getConditions','/:id/actions','getActions','create','post','/:id/conditions','addConditions','put','update','delete'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x34ab,0xf1));var _0xb34a=function(_0x44afa4,_0x5be27b){_0x44afa4=_0x44afa4-0x0;var _0xcad289=_0x34ab[_0x44afa4];return _0xcad289;};'use strict';var multer=require(_0xb34a('0x0'));var util=require(_0xb34a('0x1'));var path=require(_0xb34a('0x2'));var timeout=require(_0xb34a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb34a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb34a('0x5'));var config=require(_0xb34a('0x6'));var controller=require(_0xb34a('0x7'));router['get']('/',auth[_0xb34a('0x8')](),controller[_0xb34a('0x9')]);router[_0xb34a('0xa')](_0xb34a('0xb'),auth[_0xb34a('0x8')](),controller[_0xb34a('0xc')]);router[_0xb34a('0xa')]('/:id/conditions',auth[_0xb34a('0x8')](),controller[_0xb34a('0xd')]);router['get'](_0xb34a('0xe'),auth[_0xb34a('0x8')](),controller[_0xb34a('0xf')]);router['post']('/',auth[_0xb34a('0x8')](),controller[_0xb34a('0x10')]);router[_0xb34a('0x11')](_0xb34a('0x12'),auth[_0xb34a('0x8')](),controller[_0xb34a('0x13')]);router[_0xb34a('0x11')](_0xb34a('0xe'),auth[_0xb34a('0x8')](),controller['addActions']);router[_0xb34a('0x14')]('/:id',auth[_0xb34a('0x8')](),controller[_0xb34a('0x15')]);router[_0xb34a('0x16')](_0xb34a('0xb'),auth[_0xb34a('0x8')](),controller['destroy']);module[_0xb34a('0x17')]=router; \ No newline at end of file +var _0x28aa=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','get','index','/:id','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','getActions','post','addConditions','put','update','delete','destroy','exports','util','path'];(function(_0x472ae7,_0x525a04){var _0x294c08=function(_0x1dc144){while(--_0x1dc144){_0x472ae7['push'](_0x472ae7['shift']());}};_0x294c08(++_0x525a04);}(_0x28aa,0xf8));var _0xa28a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x28aa[_0x17d9e3];return _0x14192d;};'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['post'](_0xa28a('0x10'),auth[_0xa28a('0xc')](),controller['addActions']);router[_0xa28a('0x14')](_0xa28a('0xb'),auth[_0xa28a('0xc')](),controller[_0xa28a('0x15')]);router[_0xa28a('0x16')](_0xa28a('0xb'),auth[_0xa28a('0xc')](),controller[_0xa28a('0x17')]);module[_0xa28a('0x18')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 4a4ea1a..e610e95 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 _0x0b4b=['#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','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\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)'];(function(_0x4d4677,_0x24cbb0){var _0x3bd054=function(_0x250deb){while(--_0x250deb){_0x4d4677['push'](_0x4d4677['shift']());}};_0x3bd054(++_0x24cbb0);}(_0x0b4b,0x16a));var _0xb0b4=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x0b4b[_0x363ef8];return _0x148822;};'use strict';var Sequelize=require(_0xb0b4('0x0'));module['exports']={'name':{'type':Sequelize[_0xb0b4('0x1')],'unique':_0xb0b4('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xb0b4('0x3')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xb0b4('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xb0b4('0x4')},'limitCalls':{'type':Sequelize[_0xb0b4('0x5')](0x4)[_0xb0b4('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xb0b4('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0xb0b4('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xb0b4('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xb0b4('0x5')](0x3)[_0xb0b4('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb0b4('0x8')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb0b4('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb0b4('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb0b4('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb0b4('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xb0b4('0x5')](0x3)[_0xb0b4('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xb0b4('0x5')](0x5)[_0xb0b4('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb0b4('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xb0b4('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xb0b4('0x5')](0x5)[_0xb0b4('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xb0b4('0x5')](0x3)[_0xb0b4('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xb0b4('0xd')},'dialTimezone':{'type':Sequelize[_0xb0b4('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xb0b4('0x1')],'defaultValue':_0xb0b4('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xb0b4('0xf')](_0xb0b4('0x10'),_0xb0b4('0x11'),_0xb0b4('0x12')),'defaultValue':_0xb0b4('0x10')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xb0b4('0x5')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xb0b4('0x13')},'dialAMDGreeting':{'type':Sequelize[_0xb0b4('0x5')](0x9)[_0xb0b4('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xb0b4('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xb0b4('0x5')](0x9)[_0xb0b4('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xb0b4('0x5')](0x9)[_0xb0b4('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb0b4('0x15')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xb0b4('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xb0b4('0x5')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xb0b4('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xb0b4('0x5')](0x5)[_0xb0b4('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xb0b4('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xb0b4('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xb0b4('0xf')](_0xb0b4('0x18'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xb0b4('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xb0b4('0x5')](0x3)[_0xb0b4('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb0b4('0x19')},'dialCutDigit':{'type':Sequelize[_0xb0b4('0x5')](0x3)[_0xb0b4('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb0b4('0x1a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xb0b4('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb0b4('0x1b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xb0b4('0x5')](0x5)[_0xb0b4('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb0b4('0x1c')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb0b4('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb0b4('0x1d')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb0b4('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb0b4('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xb0b4('0x5')](0x3)[_0xb0b4('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb0b4('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xb0b4('0x5')](0x5)[_0xb0b4('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb0b4('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0xb0b4('0x5')](0x3)[_0xb0b4('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xb0b4('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb0b4('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xb0b4('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb0b4('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xb0b4('0x5')](0x5)[_0xb0b4('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb0b4('0x23')}}; \ No newline at end of file +var _0x8251=['exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','always','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','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#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)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x8251,0x8f));var _0x1825=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x8251[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x1825('0x0'));module[_0x1825('0x1')]={'name':{'type':Sequelize[_0x1825('0x2')],'unique':_0x1825('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x1825('0x4')](_0x1825('0x5')),'allowNull':![],'defaultValue':_0x1825('0x5')},'description':{'type':Sequelize[_0x1825('0x2')]},'active':{'type':Sequelize[_0x1825('0x6')],'defaultValue':0x0,'comment':_0x1825('0x7')},'limitCalls':{'type':Sequelize[_0x1825('0x8')](0x4)[_0x1825('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1825('0xa')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1825('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1825('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x1825('0x8')](0x3)[_0x1825('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x1825('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1825('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1825('0x8')](0x5)[_0x1825('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x1825('0x8')](0x3)[_0x1825('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1825('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1825('0x8')](0x5)[_0x1825('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1825('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1825('0x9')],'defaultValue':0x3,'comment':_0x1825('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1825('0x8')](0x5)[_0x1825('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x1825('0x8')](0x3)[_0x1825('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x1825('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1825('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x1825('0xf'),'never',_0x1825('0x10')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x1825('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x1825('0x8')](0x9)[_0x1825('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1825('0x11')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x1825('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1825('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1825('0x8')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1825('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x1825('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x1825('0x8')](0x9)[_0x1825('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1825('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1825('0x8')](0x9)[_0x1825('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1825('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1825('0x8')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1825('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1825('0x8')](0x5)[_0x1825('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1825('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1825('0x8')](0x9)[_0x1825('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1825('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1825('0x4')](_0x1825('0x19'),_0x1825('0x1a')),'defaultValue':_0x1825('0x19')},'dialPrefix':{'type':Sequelize[_0x1825('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1825('0x8')](0x3)[_0x1825('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1825('0x1b')},'dialCutDigit':{'type':Sequelize[_0x1825('0x8')](0x3)[_0x1825('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1825('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1825('0x8')](0x3)[_0x1825('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1825('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1825('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1825('0x1d')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1825('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1825('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1825('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1825('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1825('0x8')](0x5)[_0x1825('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1825('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x1825('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1825('0x21')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1825('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1825('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1825('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1825('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1825('0x23')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 358d58f..0c6c455 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 _0x6623=['hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','catch','params','includeAll','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','omit','createdAt','updatedAt','role','UserProfileSection','destroy','getHoppers','findOne','CmHopper','nolimit','CampaignId','findAll','rows','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','ListId','select','field','phone','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','insert','scheduledAt','ContactId','NOW()','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','get','IvrCampaigns','UserProfileResource','error','stack','name','send','index','map','Campaign','rawAttributes','type','key','model','query','keys','intersection','attributes','fields'];(function(_0x5dbc62,_0x33dc1e){var _0x37f5f8=function(_0xde34d7){while(--_0xde34d7){_0x5dbc62['push'](_0x5dbc62['shift']());}};_0x37f5f8(++_0x33dc1e);}(_0x6623,0x189));var _0x3662=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x6623[_0x20c9b2];return _0x2c6030;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3662('0x0'));var zipdir=require(_0x3662('0x1'));var jsonpatch=require(_0x3662('0x2'));var rp=require(_0x3662('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3662('0x4'));var util=require(_0x3662('0x5'));var path=require(_0x3662('0x6'));var sox=require(_0x3662('0x7'));var csv=require(_0x3662('0x8'));var ejs=require(_0x3662('0x9'));var fs=require('fs');var fs_extra=require(_0x3662('0xa'));var _=require(_0x3662('0xb'));var squel=require(_0x3662('0xc'));var crypto=require('crypto');var jsforce=require(_0x3662('0xd'));var deskjs=require(_0x3662('0xe'));var toCsv=require(_0x3662('0x8'));var querystring=require(_0x3662('0xf'));var Papa=require('papaparse');var Redis=require(_0x3662('0x10'));var authService=require(_0x3662('0x11'));var qs=require(_0x3662('0x12'));var as=require(_0x3662('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3662('0x14'))(_0x3662('0x15'));var utils=require(_0x3662('0x16'));var config=require(_0x3662('0x17'));var licenseUtil=require(_0x3662('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x103af7,_0x1cb650){_0x1cb650=_0x1cb650||0xcc;return function(_0x175741){if(_0x175741){return _0x103af7[_0x3662('0x19')](_0x1cb650);}return _0x103af7[_0x3662('0x1a')](_0x1cb650)[_0x3662('0x1b')]();};}function respondWithResult(_0x37df24,_0x260a2f){_0x260a2f=_0x260a2f||0xc8;return function(_0x371002){if(_0x371002){return _0x37df24[_0x3662('0x1a')](_0x260a2f)[_0x3662('0x1c')](_0x371002);}};}function respondWithFilteredResult(_0x55e908,_0x5ee56e){return function(_0x21cf90){if(_0x21cf90){var _0x550f90=typeof _0x5ee56e[_0x3662('0x1d')]===_0x3662('0x1e')&&typeof _0x5ee56e[_0x3662('0x1f')]==='undefined';var _0x315176=_0x21cf90['count'];var _0x2b5cc1=_0x550f90?0x0:_0x5ee56e['offset'];var _0x276d72=_0x550f90?_0x21cf90[_0x3662('0x20')]:_0x5ee56e[_0x3662('0x1d')]+_0x5ee56e[_0x3662('0x1f')];var _0x117c71;if(_0x276d72>=_0x315176){_0x276d72=_0x315176;_0x117c71=0xc8;}else{_0x117c71=0xce;}_0x55e908[_0x3662('0x1a')](_0x117c71);return _0x55e908['set'](_0x3662('0x21'),_0x2b5cc1+'-'+_0x276d72+'/'+_0x315176)[_0x3662('0x1c')](_0x21cf90);}return null;};}function patchUpdates(_0x43eeb6){return function(_0x4e9daf){try{jsonpatch['apply'](_0x4e9daf,_0x43eeb6,!![]);}catch(_0x162e84){return BPromise[_0x3662('0x22')](_0x162e84);}return _0x4e9daf[_0x3662('0x23')]();};}function saveUpdates(_0x3ff917,_0x51dacc){return function(_0x8c8fe8){if(_0x8c8fe8){return _0x8c8fe8[_0x3662('0x24')](_0x3ff917)[_0x3662('0x25')](function(_0x391f85){return _0x391f85;});}return null;};}function removeEntity(_0x72fa0f,_0x5eb0b4){return function(_0x3a82e8){if(_0x3a82e8){return _0x3a82e8['destroy']()[_0x3662('0x25')](function(){var _0x49084a=_0x3a82e8[_0x3662('0x26')]({'plain':!![]});var _0x441cfc=_0x3662('0x27');return db[_0x3662('0x28')]['destroy']({'where':{'type':_0x441cfc,'resourceId':_0x49084a['id']}})[_0x3662('0x25')](function(){return _0x3a82e8;});})[_0x3662('0x25')](function(){_0x72fa0f[_0x3662('0x1a')](0xcc)[_0x3662('0x1b')]();});}};}function handleEntityNotFound(_0x1e690e,_0x37e6d0){return function(_0x866d1e){if(!_0x866d1e){_0x1e690e[_0x3662('0x19')](0x194);}return _0x866d1e;};}function handleError(_0x987f40,_0xd31735){_0xd31735=_0xd31735||0x1f4;return function(_0x5ed766){logger[_0x3662('0x29')](_0x5ed766[_0x3662('0x2a')]);if(_0x5ed766['name']){delete _0x5ed766[_0x3662('0x2b')];}_0x987f40['status'](_0xd31735)[_0x3662('0x2c')](_0x5ed766);};}exports[_0x3662('0x2d')]=function(_0x4e7715,_0x2b6e35){var _0x4b91aa={},_0x3c7fc7={},_0x2eaddb={'count':0x0,'rows':[]};var _0x1f955a=_[_0x3662('0x2e')](db[_0x3662('0x2f')][_0x3662('0x30')],function(_0x1ae64b){return{'name':_0x1ae64b['fieldName'],'type':_0x1ae64b[_0x3662('0x31')][_0x3662('0x32')]};});_0x3c7fc7[_0x3662('0x33')]=_[_0x3662('0x2e')](_0x1f955a,'name');_0x3c7fc7[_0x3662('0x34')]=_[_0x3662('0x35')](_0x4e7715['query']);_0x3c7fc7['filters']=_[_0x3662('0x36')](_0x3c7fc7[_0x3662('0x33')],_0x3c7fc7[_0x3662('0x34')]);_0x4b91aa[_0x3662('0x37')]=_['intersection'](_0x3c7fc7[_0x3662('0x33')],qs[_0x3662('0x38')](_0x4e7715[_0x3662('0x34')]['fields']));_0x4b91aa['attributes']=_0x4b91aa['attributes']['length']?_0x4b91aa['attributes']:_0x3c7fc7[_0x3662('0x33')];if(!_0x4e7715['query'][_0x3662('0x39')]('nolimit')){_0x4b91aa[_0x3662('0x1f')]=qs[_0x3662('0x1f')](_0x4e7715[_0x3662('0x34')][_0x3662('0x1f')]);_0x4b91aa[_0x3662('0x1d')]=qs[_0x3662('0x1d')](_0x4e7715[_0x3662('0x34')][_0x3662('0x1d')]);}_0x4b91aa[_0x3662('0x3a')]=qs[_0x3662('0x3b')](_0x4e7715[_0x3662('0x34')]['sort']);_0x4b91aa[_0x3662('0x3c')]=qs['filters'](_[_0x3662('0x3d')](_0x4e7715[_0x3662('0x34')],_0x3c7fc7[_0x3662('0x3e')]),_0x1f955a);if(_0x4e7715[_0x3662('0x34')][_0x3662('0x3f')]){_0x4b91aa[_0x3662('0x3c')]=_[_0x3662('0x40')](_0x4b91aa['where'],{'$or':_[_0x3662('0x2e')](_0x1f955a,function(_0x35601a){if(_0x35601a[_0x3662('0x31')]!==_0x3662('0x41')){var _0x2a1656={};_0x2a1656[_0x35601a[_0x3662('0x2b')]]={'$like':'%'+_0x4e7715[_0x3662('0x34')][_0x3662('0x3f')]+'%'};return _0x2a1656;}})});}_0x4b91aa=_[_0x3662('0x40')]({},_0x4b91aa,_0x4e7715[_0x3662('0x42')]);var _0x3448c8={'where':_0x4b91aa[_0x3662('0x3c')]};return db[_0x3662('0x2f')][_0x3662('0x20')](_0x3448c8)['then'](function(_0x525cd1){_0x2eaddb[_0x3662('0x20')]=_0x525cd1;if(_0x4e7715[_0x3662('0x34')]['includeAll']){_0x4b91aa[_0x3662('0x43')]=[{'all':!![]}];}return db[_0x3662('0x2f')]['findAll'](_0x4b91aa);})[_0x3662('0x25')](function(_0x3acfeb){_0x2eaddb['rows']=_0x3acfeb;return _0x2eaddb;})[_0x3662('0x25')](respondWithFilteredResult(_0x2b6e35,_0x4b91aa))[_0x3662('0x44')](handleError(_0x2b6e35,null));};exports['show']=function(_0x17cf2a,_0x3cfa42){var _0x4b7a16={'raw':![],'where':{'id':_0x17cf2a[_0x3662('0x45')]['id']}},_0x222b4c={};_0x222b4c['model']=_[_0x3662('0x35')](db['Campaign'][_0x3662('0x30')]);_0x222b4c[_0x3662('0x34')]=_[_0x3662('0x35')](_0x17cf2a[_0x3662('0x34')]);_0x222b4c[_0x3662('0x3e')]=_[_0x3662('0x36')](_0x222b4c[_0x3662('0x33')],_0x222b4c[_0x3662('0x34')]);_0x4b7a16[_0x3662('0x37')]=_['intersection'](_0x222b4c['model'],qs[_0x3662('0x38')](_0x17cf2a[_0x3662('0x34')][_0x3662('0x38')]));_0x4b7a16[_0x3662('0x37')]=_0x4b7a16[_0x3662('0x37')]['length']?_0x4b7a16[_0x3662('0x37')]:_0x222b4c[_0x3662('0x33')];if(_0x17cf2a['query'][_0x3662('0x46')]){_0x4b7a16[_0x3662('0x43')]=[{'all':!![]}];}_0x4b7a16=_[_0x3662('0x40')]({},_0x4b7a16,_0x17cf2a['options']);return db['Campaign'][_0x3662('0x47')](_0x4b7a16)['then'](handleEntityNotFound(_0x3cfa42,null))['then'](respondWithResult(_0x3cfa42,null))[_0x3662('0x44')](handleError(_0x3cfa42,null));};exports['create']=function(_0xd2691,_0x515355){return db[_0x3662('0x2f')]['create'](_0xd2691[_0x3662('0x48')],{})[_0x3662('0x25')](function(_0x2b70ec){var _0x3352ae=_0xd2691[_0x3662('0x49')][_0x3662('0x26')]({'plain':!![]});if(!_0x3352ae)throw new Error(_0x3662('0x4a'));if(_0x3352ae['role']==='user'){var _0x7bada1=_0x2b70ec[_0x3662('0x26')]({'plain':!![]});var _0x4202cc='IvrCampaigns';return db['UserProfileSection'][_0x3662('0x47')]({'where':{'name':_0x4202cc,'userProfileId':_0x3352ae[_0x3662('0x4b')]},'raw':!![]})[_0x3662('0x25')](function(_0x2760a8){if(_0x2760a8&&_0x2760a8[_0x3662('0x4c')]===0x0){return db[_0x3662('0x28')][_0x3662('0x4d')]({'name':_0x7bada1['name'],'resourceId':_0x7bada1['id'],'type':_0x2760a8[_0x3662('0x2b')],'sectionId':_0x2760a8['id']},{})[_0x3662('0x25')](function(){return _0x2b70ec;});}else{return _0x2b70ec;}})['catch'](function(_0x139de3){logger['error'](_0x3662('0x4e'),_0x139de3);throw _0x139de3;});}return _0x2b70ec;})[_0x3662('0x25')](respondWithResult(_0x515355,0xc9))['catch'](handleError(_0x515355,null));};exports[_0x3662('0x4f')]=function(_0x5a13b2,_0x4722ae){var _0x515350={'where':{'id':_0x5a13b2['params']['id']}},_0x1ea570={};_0x1ea570[_0x3662('0x33')]=_['keys'](db[_0x3662('0x2f')][_0x3662('0x30')]);_0x515350['attributes']=_['intersection'](_0x1ea570[_0x3662('0x33')],qs[_0x3662('0x38')](_0x5a13b2['query'][_0x3662('0x38')]));_0x515350[_0x3662('0x37')]=_0x515350[_0x3662('0x37')][_0x3662('0x50')]?_0x515350[_0x3662('0x37')]:_0x1ea570[_0x3662('0x33')];if(_0x5a13b2[_0x3662('0x34')]['includeAll']){_0x515350[_0x3662('0x43')]=[{'all':!![]}];}_0x515350=_[_0x3662('0x40')]({},_0x515350,_0x5a13b2['options']);return db[_0x3662('0x2f')][_0x3662('0x47')](_0x515350)[_0x3662('0x25')](handleEntityNotFound(_0x4722ae,null))[_0x3662('0x25')](function(_0x56f076){if(_0x56f076){var _0x3a60ee=_0x56f076[_0x3662('0x26')]({'plain':!![]});_0x3a60ee=qs[_0x3662('0x51')](_0x3a60ee,['id',_0x3662('0x52'),_0x3662('0x53')]);_0x5a13b2[_0x3662('0x48')]=_['omit'](_0x5a13b2['body'],['id','createdAt',_0x3662('0x53')]);return db[_0x3662('0x2f')]['create'](_[_0x3662('0x40')](_0x3a60ee,_0x5a13b2[_0x3662('0x48')]),{'include':_0x5a13b2[_0x3662('0x34')][_0x3662('0x46')]?[{'all':!![]}]:undefined})[_0x3662('0x25')](function(_0x566c3a){var _0x57a89e=_0x5a13b2['user']['get']({'plain':!![]});if(!_0x57a89e)throw new Error(_0x3662('0x4a'));if(_0x57a89e[_0x3662('0x54')]===_0x3662('0x49')){var _0x41c30a=_0x566c3a[_0x3662('0x26')]({'plain':!![]});var _0xce3f05=_0x3662('0x27');return db[_0x3662('0x55')][_0x3662('0x47')]({'where':{'name':_0xce3f05,'userProfileId':_0x57a89e[_0x3662('0x4b')]},'raw':!![]})[_0x3662('0x25')](function(_0xdff2cb){if(_0xdff2cb&&_0xdff2cb[_0x3662('0x4c')]===0x0){return db[_0x3662('0x28')][_0x3662('0x4d')]({'name':_0x41c30a[_0x3662('0x2b')],'resourceId':_0x41c30a['id'],'type':_0xdff2cb[_0x3662('0x2b')],'sectionId':_0xdff2cb['id']},{})[_0x3662('0x25')](function(){return _0x566c3a;});}else{return _0x566c3a;}})['catch'](function(_0xe1abe3){logger[_0x3662('0x29')](_0x3662('0x4e'),_0xe1abe3);throw _0xe1abe3;});}return _0x566c3a;});}})[_0x3662('0x25')](respondWithResult(_0x4722ae,0xc9))['catch'](handleError(_0x4722ae,null));};exports[_0x3662('0x24')]=function(_0x551c0a,_0x2472b3){if(_0x551c0a[_0x3662('0x48')]['id']){delete _0x551c0a[_0x3662('0x48')]['id'];}return db[_0x3662('0x2f')][_0x3662('0x47')]({'where':{'id':_0x551c0a[_0x3662('0x45')]['id']}})[_0x3662('0x25')](handleEntityNotFound(_0x2472b3,null))[_0x3662('0x25')](saveUpdates(_0x551c0a[_0x3662('0x48')],null))[_0x3662('0x25')](respondWithResult(_0x2472b3,null))[_0x3662('0x44')](handleError(_0x2472b3,null));};exports[_0x3662('0x56')]=function(_0x2e0006,_0x523f9d){return db[_0x3662('0x2f')][_0x3662('0x47')]({'where':{'id':_0x2e0006[_0x3662('0x45')]['id']}})[_0x3662('0x25')](handleEntityNotFound(_0x523f9d,null))[_0x3662('0x25')](removeEntity(_0x523f9d,null))['catch'](handleError(_0x523f9d,null));};exports[_0x3662('0x57')]=function(_0x1e0dcb,_0x5895e6,_0x3feb18){var _0x529842={'raw':!![],'where':{}};var _0x2ee32c={};var _0x10f080={'count':0x0,'rows':[]};return db[_0x3662('0x2f')][_0x3662('0x58')]({'where':{'id':_0x1e0dcb[_0x3662('0x45')]['id']}})['then'](handleEntityNotFound(_0x5895e6,null))[_0x3662('0x25')](function(_0x3101b5){if(_0x3101b5){_0x2ee32c[_0x3662('0x33')]=_['keys'](db[_0x3662('0x59')]['rawAttributes']);_0x2ee32c[_0x3662('0x34')]=_[_0x3662('0x35')](_0x1e0dcb['query']);_0x2ee32c[_0x3662('0x3e')]=_[_0x3662('0x36')](_0x2ee32c[_0x3662('0x33')],_0x2ee32c[_0x3662('0x34')]);_0x529842[_0x3662('0x37')]=_['intersection'](_0x2ee32c[_0x3662('0x33')],qs[_0x3662('0x38')](_0x1e0dcb[_0x3662('0x34')][_0x3662('0x38')]));_0x529842[_0x3662('0x37')]=_0x529842[_0x3662('0x37')][_0x3662('0x50')]?_0x529842[_0x3662('0x37')]:_0x2ee32c[_0x3662('0x33')];if(!_0x1e0dcb['query']['hasOwnProperty'](_0x3662('0x5a'))){_0x529842[_0x3662('0x1f')]=qs[_0x3662('0x1f')](_0x1e0dcb['query'][_0x3662('0x1f')]);_0x529842[_0x3662('0x1d')]=qs[_0x3662('0x1d')](_0x1e0dcb[_0x3662('0x34')][_0x3662('0x1d')]);}_0x529842[_0x3662('0x3a')]=qs['sort'](_0x1e0dcb[_0x3662('0x34')][_0x3662('0x3b')]);_0x529842[_0x3662('0x3c')]=qs[_0x3662('0x3e')](_[_0x3662('0x3d')](_0x1e0dcb[_0x3662('0x34')],_0x2ee32c['filters']));_0x529842['where'][_0x3662('0x5b')]=_0x3101b5['id'];if(_0x1e0dcb[_0x3662('0x34')]['filter']){_0x529842['where']=_[_0x3662('0x40')](_0x529842[_0x3662('0x3c')],{'$or':_[_0x3662('0x2e')](_0x529842['attributes'],function(_0x368c23){var _0x1e4582={};_0x1e4582[_0x368c23]={'$like':'%'+_0x1e0dcb['query'][_0x3662('0x3f')]+'%'};return _0x1e4582;})});}_0x529842=_[_0x3662('0x40')]({},_0x529842,_0x1e0dcb[_0x3662('0x42')]);return db[_0x3662('0x59')][_0x3662('0x20')]({'where':_0x529842[_0x3662('0x3c')]})[_0x3662('0x25')](function(_0x3fb3fe){_0x10f080[_0x3662('0x20')]=_0x3fb3fe;if(_0x1e0dcb[_0x3662('0x34')]['includeAll']){_0x529842[_0x3662('0x43')]=[{'all':!![]}];}return db[_0x3662('0x59')][_0x3662('0x5c')](_0x529842);})[_0x3662('0x25')](function(_0x508a2f){_0x10f080[_0x3662('0x5d')]=_0x508a2f;return _0x10f080;});}})['then'](respondWithFilteredResult(_0x5895e6,_0x529842))[_0x3662('0x44')](handleError(_0x5895e6,null));};exports[_0x3662('0x5e')]=function(_0x1bf6bd,_0x58bb88,_0x5a902f){var _0x2c5e27={'raw':!![],'where':{}};var _0x3e7d6a={};var _0x21a2e5={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x1bf6bd[_0x3662('0x45')]['id']}})[_0x3662('0x25')](handleEntityNotFound(_0x58bb88,null))['then'](function(_0x4b1108){if(_0x4b1108){_0x3e7d6a[_0x3662('0x33')]=_[_0x3662('0x35')](db[_0x3662('0x5f')][_0x3662('0x30')]);_0x3e7d6a[_0x3662('0x34')]=_[_0x3662('0x35')](_0x1bf6bd['query']);_0x3e7d6a[_0x3662('0x3e')]=_[_0x3662('0x36')](_0x3e7d6a['model'],_0x3e7d6a[_0x3662('0x34')]);_0x2c5e27[_0x3662('0x37')]=_[_0x3662('0x36')](_0x3e7d6a[_0x3662('0x33')],qs['fields'](_0x1bf6bd['query'][_0x3662('0x38')]));_0x2c5e27[_0x3662('0x37')]=_0x2c5e27[_0x3662('0x37')][_0x3662('0x50')]?_0x2c5e27[_0x3662('0x37')]:_0x3e7d6a[_0x3662('0x33')];if(!_0x1bf6bd['query'][_0x3662('0x39')](_0x3662('0x5a'))){_0x2c5e27[_0x3662('0x1f')]=qs[_0x3662('0x1f')](_0x1bf6bd[_0x3662('0x34')][_0x3662('0x1f')]);_0x2c5e27[_0x3662('0x1d')]=qs[_0x3662('0x1d')](_0x1bf6bd[_0x3662('0x34')][_0x3662('0x1d')]);}_0x2c5e27[_0x3662('0x3a')]=qs[_0x3662('0x3b')](_0x1bf6bd[_0x3662('0x34')][_0x3662('0x3b')]);_0x2c5e27['where']=qs['filters'](_[_0x3662('0x3d')](_0x1bf6bd['query'],_0x3e7d6a[_0x3662('0x3e')]));_0x2c5e27[_0x3662('0x3c')][_0x3662('0x5b')]=_0x4b1108['id'];if(_0x1bf6bd[_0x3662('0x34')][_0x3662('0x3f')]){_0x2c5e27[_0x3662('0x3c')]=_[_0x3662('0x40')](_0x2c5e27[_0x3662('0x3c')],{'$or':_[_0x3662('0x2e')](_0x2c5e27[_0x3662('0x37')],function(_0x325d04){var _0x13054c={};_0x13054c[_0x325d04]={'$like':'%'+_0x1bf6bd[_0x3662('0x34')][_0x3662('0x3f')]+'%'};return _0x13054c;})});}_0x2c5e27=_[_0x3662('0x40')]({},_0x2c5e27,_0x1bf6bd[_0x3662('0x42')]);return db[_0x3662('0x5f')]['count']({'where':_0x2c5e27[_0x3662('0x3c')]})[_0x3662('0x25')](function(_0x1c50a5){_0x21a2e5[_0x3662('0x20')]=_0x1c50a5;if(_0x1bf6bd[_0x3662('0x34')][_0x3662('0x46')]){_0x2c5e27[_0x3662('0x43')]=[{'all':!![]}];}return db[_0x3662('0x5f')]['findAll'](_0x2c5e27);})[_0x3662('0x25')](function(_0x1131f4){_0x21a2e5[_0x3662('0x5d')]=_0x1131f4;return _0x21a2e5;});}})['then'](respondWithFilteredResult(_0x58bb88,_0x2c5e27))[_0x3662('0x44')](handleError(_0x58bb88,null));};exports['getHopperFinals']=function(_0x29b418,_0x94aea3,_0xa98143){var _0x3bf90d={'raw':!![],'where':{}};var _0x3b5ed4={};var _0x5c1479={'count':0x0,'rows':[]};return db['Campaign'][_0x3662('0x58')]({'where':{'id':_0x29b418['params']['id']}})[_0x3662('0x25')](handleEntityNotFound(_0x94aea3,null))['then'](function(_0x1b32e0){if(_0x1b32e0){_0x3b5ed4[_0x3662('0x33')]=_[_0x3662('0x35')](db[_0x3662('0x60')][_0x3662('0x30')]);_0x3b5ed4[_0x3662('0x34')]=_[_0x3662('0x35')](_0x29b418[_0x3662('0x34')]);_0x3b5ed4[_0x3662('0x3e')]=_[_0x3662('0x36')](_0x3b5ed4[_0x3662('0x33')],_0x3b5ed4[_0x3662('0x34')]);_0x3bf90d[_0x3662('0x37')]=_[_0x3662('0x36')](_0x3b5ed4[_0x3662('0x33')],qs[_0x3662('0x38')](_0x29b418[_0x3662('0x34')]['fields']));_0x3bf90d[_0x3662('0x37')]=_0x3bf90d[_0x3662('0x37')]['length']?_0x3bf90d[_0x3662('0x37')]:_0x3b5ed4[_0x3662('0x33')];if(!_0x29b418[_0x3662('0x34')][_0x3662('0x39')]('nolimit')){_0x3bf90d[_0x3662('0x1f')]=qs[_0x3662('0x1f')](_0x29b418[_0x3662('0x34')][_0x3662('0x1f')]);_0x3bf90d[_0x3662('0x1d')]=qs[_0x3662('0x1d')](_0x29b418[_0x3662('0x34')][_0x3662('0x1d')]);}_0x3bf90d[_0x3662('0x3a')]=qs[_0x3662('0x3b')](_0x29b418[_0x3662('0x34')][_0x3662('0x3b')]);_0x3bf90d['where']=qs[_0x3662('0x3e')](_[_0x3662('0x3d')](_0x29b418['query'],_0x3b5ed4[_0x3662('0x3e')]));_0x3bf90d[_0x3662('0x3c')]['CampaignId']=_0x1b32e0['id'];if(_0x29b418['query'][_0x3662('0x3f')]){_0x3bf90d[_0x3662('0x3c')]=_[_0x3662('0x40')](_0x3bf90d[_0x3662('0x3c')],{'$or':_[_0x3662('0x2e')](_0x3bf90d[_0x3662('0x37')],function(_0x3d7b5a){var _0x4c76a0={};_0x4c76a0[_0x3d7b5a]={'$like':'%'+_0x29b418[_0x3662('0x34')][_0x3662('0x3f')]+'%'};return _0x4c76a0;})});}_0x3bf90d=_[_0x3662('0x40')]({},_0x3bf90d,_0x29b418[_0x3662('0x42')]);return db[_0x3662('0x60')][_0x3662('0x20')]({'where':_0x3bf90d['where']})[_0x3662('0x25')](function(_0x2708db){_0x5c1479[_0x3662('0x20')]=_0x2708db;if(_0x29b418[_0x3662('0x34')]['includeAll']){_0x3bf90d[_0x3662('0x43')]=[{'all':!![]}];}return db[_0x3662('0x60')][_0x3662('0x5c')](_0x3bf90d);})[_0x3662('0x25')](function(_0x2174d6){_0x5c1479['rows']=_0x2174d6;return _0x5c1479;});}})['then'](respondWithFilteredResult(_0x94aea3,_0x3bf90d))[_0x3662('0x44')](handleError(_0x94aea3,null));};exports[_0x3662('0x61')]=function(_0x302c74,_0x1556fb,_0x2ffc11){var _0x4aac66={'raw':!![],'where':{}};var _0xd2e92c={};var _0x1ac8c3={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x302c74[_0x3662('0x45')]['id']}})[_0x3662('0x25')](handleEntityNotFound(_0x1556fb,null))[_0x3662('0x25')](function(_0x25cf5b){if(_0x25cf5b){_0xd2e92c[_0x3662('0x33')]=_[_0x3662('0x35')](db[_0x3662('0x62')][_0x3662('0x30')]);_0xd2e92c['query']=_['keys'](_0x302c74[_0x3662('0x34')]);_0xd2e92c['filters']=_[_0x3662('0x36')](_0xd2e92c[_0x3662('0x33')],_0xd2e92c['query']);_0x4aac66[_0x3662('0x37')]=_[_0x3662('0x36')](_0xd2e92c['model'],qs[_0x3662('0x38')](_0x302c74[_0x3662('0x34')]['fields']));_0x4aac66[_0x3662('0x37')]=_0x4aac66[_0x3662('0x37')][_0x3662('0x50')]?_0x4aac66[_0x3662('0x37')]:_0xd2e92c[_0x3662('0x33')];if(!_0x302c74[_0x3662('0x34')]['hasOwnProperty'](_0x3662('0x5a'))){_0x4aac66[_0x3662('0x1f')]=qs[_0x3662('0x1f')](_0x302c74[_0x3662('0x34')][_0x3662('0x1f')]);_0x4aac66[_0x3662('0x1d')]=qs['offset'](_0x302c74['query'][_0x3662('0x1d')]);}_0x4aac66[_0x3662('0x3a')]=qs['sort'](_0x302c74[_0x3662('0x34')][_0x3662('0x3b')]);_0x4aac66[_0x3662('0x3c')]=qs['filters'](_[_0x3662('0x3d')](_0x302c74[_0x3662('0x34')],_0xd2e92c[_0x3662('0x3e')]));_0x4aac66['where'][_0x3662('0x5b')]=_0x25cf5b['id'];if(_0x302c74[_0x3662('0x34')]['filter']){_0x4aac66[_0x3662('0x3c')]=_[_0x3662('0x40')](_0x4aac66[_0x3662('0x3c')],{'$or':_[_0x3662('0x2e')](_0x4aac66['attributes'],function(_0xec6c7a){var _0x2ec337={};_0x2ec337[_0xec6c7a]={'$like':'%'+_0x302c74[_0x3662('0x34')]['filter']+'%'};return _0x2ec337;})});}_0x4aac66=_[_0x3662('0x40')]({},_0x4aac66,_0x302c74[_0x3662('0x42')]);return db[_0x3662('0x62')][_0x3662('0x20')]({'where':_0x4aac66[_0x3662('0x3c')]})[_0x3662('0x25')](function(_0x1ab78c){_0x1ac8c3[_0x3662('0x20')]=_0x1ab78c;if(_0x302c74[_0x3662('0x34')][_0x3662('0x46')]){_0x4aac66['include']=[{'all':!![]}];}return db[_0x3662('0x62')][_0x3662('0x5c')](_0x4aac66);})['then'](function(_0x1bd24d){_0x1ac8c3[_0x3662('0x5d')]=_0x1bd24d;return _0x1ac8c3;});}})['then'](respondWithFilteredResult(_0x1556fb,_0x4aac66))[_0x3662('0x44')](handleError(_0x1556fb,null));};exports[_0x3662('0x63')]=function(_0xed7bbc,_0x27bb17,_0x42a053){var _0x5e958c={};var _0x58492a={};var _0xc0489;var _0x238cc5;return db[_0x3662('0x2f')][_0x3662('0x58')]({'where':{'id':_0xed7bbc[_0x3662('0x45')]['id']}})[_0x3662('0x25')](handleEntityNotFound(_0x27bb17,null))[_0x3662('0x25')](function(_0x368d1f){if(_0x368d1f){_0xc0489=_0x368d1f;_0x58492a[_0x3662('0x33')]=_[_0x3662('0x35')](db[_0x3662('0x64')]['rawAttributes']);_0x58492a[_0x3662('0x34')]=_[_0x3662('0x35')](_0xed7bbc[_0x3662('0x34')]);_0x58492a[_0x3662('0x3e')]=_[_0x3662('0x36')](_0x58492a[_0x3662('0x33')],_0x58492a['query']);_0x5e958c[_0x3662('0x37')]=_[_0x3662('0x36')](_0x58492a[_0x3662('0x33')],qs[_0x3662('0x38')](_0xed7bbc[_0x3662('0x34')]['fields']));_0x5e958c[_0x3662('0x37')]=_0x5e958c[_0x3662('0x37')]['length']?_0x5e958c['attributes']:_0x58492a['model'];_0x5e958c[_0x3662('0x3a')]=qs[_0x3662('0x3b')](_0xed7bbc[_0x3662('0x34')][_0x3662('0x3b')]);_0x5e958c[_0x3662('0x3c')]=qs[_0x3662('0x3e')](_[_0x3662('0x3d')](_0xed7bbc['query'],_0x58492a[_0x3662('0x3e')]));if(_0xed7bbc['query'][_0x3662('0x3f')]){_0x5e958c['where']=_[_0x3662('0x40')](_0x5e958c[_0x3662('0x3c')],{'$or':_['map'](_0x5e958c[_0x3662('0x37')],function(_0x486e64){var _0x482d6e={};_0x482d6e[_0x486e64]={'$like':'%'+_0xed7bbc[_0x3662('0x34')][_0x3662('0x3f')]+'%'};return _0x482d6e;})});}_0x5e958c=_['merge']({},_0x5e958c,_0xed7bbc[_0x3662('0x42')]);return _0xc0489[_0x3662('0x63')](_0x5e958c);}})['then'](function(_0x1b32bd){if(_0x1b32bd){_0x238cc5=_0x1b32bd[_0x3662('0x50')];if(!_0xed7bbc['query'][_0x3662('0x39')](_0x3662('0x5a'))){_0x5e958c[_0x3662('0x1f')]=qs['limit'](_0xed7bbc[_0x3662('0x34')][_0x3662('0x1f')]);_0x5e958c['offset']=qs[_0x3662('0x1d')](_0xed7bbc[_0x3662('0x34')][_0x3662('0x1d')]);}return _0xc0489[_0x3662('0x63')](_0x5e958c);}})[_0x3662('0x25')](function(_0x268bc9){if(_0x268bc9){return _0x268bc9?{'count':_0x238cc5,'rows':_0x268bc9}:null;}})[_0x3662('0x25')](respondWithResult(_0x27bb17,null))['catch'](handleError(_0x27bb17,null));};exports[_0x3662('0x65')]=function(_0x41aec4,_0x4e1185,_0x278428){var _0x1423e9,_0x5bf91d;var _0x6ff429=[];var _0xa48eab=moment()[_0x3662('0x66')](_0x3662('0x67'));return db[_0x3662('0x2f')][_0x3662('0x47')]({'where':{'id':_0x41aec4['params']['id']}})['then'](handleEntityNotFound(_0x4e1185,null))[_0x3662('0x25')](function(_0x3dfa57){if(_0x3dfa57){_0x5bf91d=_0x3dfa57;return _0x3dfa57[_0x3662('0x65')](_0x41aec4[_0x3662('0x48')][_0x3662('0x68')],_[_0x3662('0x51')](_0x41aec4[_0x3662('0x48')],[_0x3662('0x68'),'id'])||{});}return null;})[_0x3662('0x69')](function(_0x2d9fca){var _0x58b950;var _0x2b3eac;_0x1423e9=_0x2d9fca||[];var _0x49a166=[];if(_0x2d9fca){for(var _0x4e2944=0x0;_0x4e2944<_0x2d9fca[_0x3662('0x50')];_0x4e2944+=0x1){var _0x297a02=_0x2d9fca[_0x4e2944]['get']({'plain':!![]});_0x5bf91d[_0x3662('0x6a')]=_0x41aec4[_0x3662('0x48')][_0x3662('0x6a')]?_0x41aec4[_0x3662('0x48')]['dialCheckDuplicateType']:_0x5bf91d['dialCheckDuplicateType'];switch(_0x5bf91d[_0x3662('0x6a')]){case _0x3662('0x6b'):_0x58b950=squel['insert']()[_0x3662('0x6c')](_0x3662('0x6d'))[_0x3662('0x6e')](['phone','scheduledAt','ContactId',_0x3662('0x6f'),_0x3662('0x5b'),_0x3662('0x52'),'updatedAt'],squel[_0x3662('0x70')]()[_0x3662('0x71')](_0x3662('0x72'),_0x3662('0x72'))[_0x3662('0x71')]('NOW()','scheduledAt')[_0x3662('0x71')]('id','ContactId')[_0x3662('0x71')](_0x297a02[_0x3662('0x73')][_0x3662('0x74')](),_0x3662('0x6f'))['field'](_0x41aec4[_0x3662('0x45')]['id']['toString'](),_0x3662('0x5b'))['field']('\x27'+_0xa48eab+'\x27',_0x3662('0x52'))[_0x3662('0x71')]('\x27'+_0xa48eab+'\x27',_0x3662('0x53'))[_0x3662('0x75')](_0x3662('0x76'))[_0x3662('0x3c')](_0x3662('0x77'))['where'](_0x3662('0x78'),_0x297a02[_0x3662('0x73')]['toString']())[_0x3662('0x3c')](_0x3662('0x79'))[_0x3662('0x3c')](_0x3662('0x7a'),squel[_0x3662('0x70')]()[_0x3662('0x71')](_0x3662('0x7b'))[_0x3662('0x75')](_0x3662('0x7c'))[_0x3662('0x3c')](_0x3662('0x7d'),_0x41aec4[_0x3662('0x45')]['id'][_0x3662('0x74')]()))[_0x3662('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3662('0x70')]()[_0x3662('0x71')]('COALESCE(phone,\x27\x27)')['from'](_0x3662('0x6d'))[_0x3662('0x3c')](_0x3662('0x7d'),_0x41aec4[_0x3662('0x45')]['id'][_0x3662('0x74')]())))['toString']();break;case _0x3662('0x7e'):_0x58b950=squel[_0x3662('0x7f')]()[_0x3662('0x6c')](_0x3662('0x6d'))[_0x3662('0x6e')]([_0x3662('0x72'),_0x3662('0x80'),_0x3662('0x81'),'ListId',_0x3662('0x5b'),'createdAt',_0x3662('0x53')],squel[_0x3662('0x70')]()[_0x3662('0x71')](_0x3662('0x72'),_0x3662('0x72'))[_0x3662('0x71')](_0x3662('0x82'),_0x3662('0x80'))[_0x3662('0x71')]('id',_0x3662('0x81'))[_0x3662('0x71')](_0x297a02['CmListId'][_0x3662('0x74')](),_0x3662('0x6f'))[_0x3662('0x71')](_0x41aec4['params']['id']['toString'](),_0x3662('0x5b'))[_0x3662('0x71')]('\x27'+_0xa48eab+'\x27',_0x3662('0x52'))[_0x3662('0x71')]('\x27'+_0xa48eab+'\x27','updatedAt')[_0x3662('0x75')]('cm_contacts')['where'](_0x3662('0x77'))['where']('ListId\x20=\x20?',_0x297a02[_0x3662('0x73')]['toString']())[_0x3662('0x3c')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x3662('0x70')]()['field']('COALESCE(phone,\x27\x27)')[_0x3662('0x75')](_0x3662('0x6d'))[_0x3662('0x3c')]('CampaignId\x20=\x20?',_0x41aec4['params']['id'][_0x3662('0x74')]())))[_0x3662('0x74')]();break;default:_0x58b950=squel[_0x3662('0x7f')]()['into'](_0x3662('0x6d'))[_0x3662('0x6e')]([_0x3662('0x72'),_0x3662('0x80'),_0x3662('0x81'),_0x3662('0x6f'),_0x3662('0x5b'),_0x3662('0x52'),_0x3662('0x53')],squel['select']()[_0x3662('0x71')](_0x3662('0x72'),'phone')[_0x3662('0x71')](_0x3662('0x82'),_0x3662('0x80'))[_0x3662('0x71')]('id',_0x3662('0x81'))[_0x3662('0x71')](_0x297a02[_0x3662('0x73')][_0x3662('0x74')](),_0x3662('0x6f'))[_0x3662('0x71')](_0x41aec4[_0x3662('0x45')]['id'][_0x3662('0x74')](),_0x3662('0x5b'))[_0x3662('0x71')]('\x27'+_0xa48eab+'\x27',_0x3662('0x52'))[_0x3662('0x71')]('\x27'+_0xa48eab+'\x27','updatedAt')['from'](_0x3662('0x76'))[_0x3662('0x3c')]('deletedAt\x20IS\x20NULL')[_0x3662('0x3c')]('ListId\x20=\x20?',_0x297a02['CmListId'][_0x3662('0x74')]())[_0x3662('0x3c')](_0x3662('0x79')))['toString']();}_0x2b3eac=squel[_0x3662('0x7f')]()[_0x3662('0x6c')](_0x3662('0x83'))[_0x3662('0x6e')]([_0x3662('0x84'),_0x3662('0x80'),_0x3662('0x72'),_0x3662('0x85'),'createdAt',_0x3662('0x53')],squel[_0x3662('0x70')]()[_0x3662('0x71')](_0x3662('0x86'),'id')[_0x3662('0x71')]('NOW()','scheduledAt')['field'](_0x3662('0x87'),_0x3662('0x72'))[_0x3662('0x71')]('ci.OrderBY',_0x3662('0x85'))[_0x3662('0x71')]('\x27'+_0xa48eab+'\x27','createdAt')['field']('\x27'+_0xa48eab+'\x27',_0x3662('0x53'))[_0x3662('0x75')](_0x3662('0x88'),'ci')[_0x3662('0x89')](_0x3662('0x6d'),'h',_0x3662('0x8a'))[_0x3662('0x3c')](_0x3662('0x8b'),_0x297a02[_0x3662('0x73')][_0x3662('0x74')]())['where'](_0x3662('0x8c'),_0x41aec4['params']['id'][_0x3662('0x74')]())[_0x3662('0x3c')](_0x3662('0x8d'),_0xa48eab))[_0x3662('0x74')]();_0x49a166['push'](db['sequelize']['query'](_0x58b950));_0x6ff429[_0x3662('0x8e')](db[_0x3662('0x8f')][_0x3662('0x34')](_0x2b3eac));}return BPromise[_0x3662('0x90')](_0x49a166);}})[_0x3662('0x25')](function(){return BPromise[_0x3662('0x90')](_0x6ff429);})['then'](function(){return _0x1423e9;})['then'](respondWithResult(_0x4e1185,null))[_0x3662('0x44')](handleError(_0x4e1185,null));};exports[_0x3662('0x91')]=function(_0x1b4863,_0x4c6952,_0xc948d8){return db[_0x3662('0x2f')][_0x3662('0x47')]({'where':{'id':_0x1b4863['params']['id']}})[_0x3662('0x25')](handleEntityNotFound(_0x4c6952,null))[_0x3662('0x25')](function(_0x520675){if(_0x520675){return _0x520675[_0x3662('0x91')](_0x1b4863[_0x3662('0x34')][_0x3662('0x68')]);}})[_0x3662('0x25')](function(_0x6fa251){if(_0x6fa251){return db[_0x3662('0x59')][_0x3662('0x56')]({'where':{'ListId':_0x1b4863[_0x3662('0x34')][_0x3662('0x68')],'CampaignId':_0x1b4863[_0x3662('0x45')]['id']}})[_0x3662('0x25')](function(){return _0x6fa251;});}})['then'](respondWithStatusCode(_0x4c6952,null))[_0x3662('0x44')](handleError(_0x4c6952,null));};exports[_0x3662('0x92')]=function(_0x22f444,_0x2109d6,_0x2d92f3){var _0x13fc6c={};var _0x57708a={};var _0x2e80ae;var _0x244193;return db[_0x3662('0x2f')]['findOne']({'where':{'id':_0x22f444[_0x3662('0x45')]['id']}})[_0x3662('0x25')](handleEntityNotFound(_0x2109d6,null))[_0x3662('0x25')](function(_0x1f985c){if(_0x1f985c){_0x2e80ae=_0x1f985c;_0x57708a[_0x3662('0x33')]=_[_0x3662('0x35')](db[_0x3662('0x64')][_0x3662('0x30')]);_0x57708a['query']=_['keys'](_0x22f444[_0x3662('0x34')]);_0x57708a[_0x3662('0x3e')]=_[_0x3662('0x36')](_0x57708a['model'],_0x57708a[_0x3662('0x34')]);_0x13fc6c['attributes']=_['intersection'](_0x57708a[_0x3662('0x33')],qs['fields'](_0x22f444[_0x3662('0x34')]['fields']));_0x13fc6c[_0x3662('0x37')]=_0x13fc6c[_0x3662('0x37')][_0x3662('0x50')]?_0x13fc6c[_0x3662('0x37')]:_0x57708a[_0x3662('0x33')];_0x13fc6c[_0x3662('0x3a')]=qs[_0x3662('0x3b')](_0x22f444[_0x3662('0x34')][_0x3662('0x3b')]);_0x13fc6c[_0x3662('0x3c')]=qs[_0x3662('0x3e')](_[_0x3662('0x3d')](_0x22f444['query'],_0x57708a['filters']));if(_0x22f444[_0x3662('0x34')]['filter']){_0x13fc6c['where']=_[_0x3662('0x40')](_0x13fc6c[_0x3662('0x3c')],{'$or':_[_0x3662('0x2e')](_0x13fc6c[_0x3662('0x37')],function(_0x4d1d23){var _0xc8d041={};_0xc8d041[_0x4d1d23]={'$like':'%'+_0x22f444[_0x3662('0x34')][_0x3662('0x3f')]+'%'};return _0xc8d041;})});}_0x13fc6c=_['merge']({},_0x13fc6c,_0x22f444[_0x3662('0x42')]);return _0x2e80ae['getBlackLists'](_0x13fc6c);}})[_0x3662('0x25')](function(_0x5751b5){if(_0x5751b5){_0x244193=_0x5751b5[_0x3662('0x50')];if(!_0x22f444[_0x3662('0x34')][_0x3662('0x39')](_0x3662('0x5a'))){_0x13fc6c['limit']=qs[_0x3662('0x1f')](_0x22f444[_0x3662('0x34')][_0x3662('0x1f')]);_0x13fc6c[_0x3662('0x1d')]=qs[_0x3662('0x1d')](_0x22f444[_0x3662('0x34')][_0x3662('0x1d')]);}return _0x2e80ae['getBlackLists'](_0x13fc6c);}})[_0x3662('0x25')](function(_0x493512){if(_0x493512){return _0x493512?{'count':_0x244193,'rows':_0x493512}:null;}})[_0x3662('0x25')](respondWithResult(_0x2109d6,null))[_0x3662('0x44')](handleError(_0x2109d6,null));};exports['addBlackLists']=function(_0x1c42b7,_0x3f5cee,_0x70280e){var _0x17c310,_0x14491f;var _0x7e3450=[];var _0x463747=moment()[_0x3662('0x66')](_0x3662('0x67'));return db['Campaign'][_0x3662('0x47')]({'where':{'id':_0x1c42b7['params']['id']}})[_0x3662('0x25')](handleEntityNotFound(_0x3f5cee,null))[_0x3662('0x25')](function(_0x550c78){if(_0x550c78){_0x14491f=_0x550c78;return _0x550c78[_0x3662('0x93')](_0x1c42b7['body']['ids'],_['omit'](_0x1c42b7[_0x3662('0x48')],[_0x3662('0x68'),'id'])||{});}return null;})[_0x3662('0x69')](function(_0x297800){var _0x4d2727;var _0x22151f;_0x17c310=_0x297800||[];var _0x244404=[];if(_0x297800){for(var _0x526ead=0x0;_0x526ead<_0x297800[_0x3662('0x50')];_0x526ead+=0x1){var _0x51fe2b=_0x297800[_0x526ead][_0x3662('0x26')]({'plain':!![]});_0x4d2727=squel[_0x3662('0x7f')]()[_0x3662('0x6c')](_0x3662('0x94'))[_0x3662('0x6e')]([_0x3662('0x72'),_0x3662('0x81'),_0x3662('0x6f'),_0x3662('0x5b'),'createdAt',_0x3662('0x53')],squel[_0x3662('0x70')]()[_0x3662('0x71')](_0x3662('0x72'),_0x3662('0x72'))[_0x3662('0x71')]('id',_0x3662('0x81'))['field'](_0x51fe2b[_0x3662('0x73')]['toString'](),'ListId')[_0x3662('0x71')](_0x1c42b7[_0x3662('0x45')]['id'][_0x3662('0x74')](),_0x3662('0x5b'))[_0x3662('0x71')](_0x3662('0x82'),_0x3662('0x52'))[_0x3662('0x71')](_0x3662('0x82'),'updatedAt')[_0x3662('0x75')](_0x3662('0x76'))['where'](_0x3662('0x77'))[_0x3662('0x3c')](_0x3662('0x78'),_0x51fe2b[_0x3662('0x73')][_0x3662('0x74')]())[_0x3662('0x3c')](_0x3662('0x79')))[_0x3662('0x74')]();_0x244404[_0x3662('0x8e')](db[_0x3662('0x8f')][_0x3662('0x34')](_0x4d2727));}return BPromise['all'](_0x244404);}})[_0x3662('0x25')](function(){return _0x17c310;})[_0x3662('0x25')](respondWithResult(_0x3f5cee,null))[_0x3662('0x44')](handleError(_0x3f5cee,null));};exports[_0x3662('0x95')]=function(_0x248f54,_0x5567a4,_0x1db37d){return db[_0x3662('0x2f')][_0x3662('0x47')]({'where':{'id':_0x248f54['params']['id']}})[_0x3662('0x25')](handleEntityNotFound(_0x5567a4,null))['then'](function(_0x5f5677){if(_0x5f5677){return _0x5f5677[_0x3662('0x95')](_0x248f54['query'][_0x3662('0x68')]);}})[_0x3662('0x25')](function(_0x2451b9){if(_0x2451b9){return db[_0x3662('0x62')][_0x3662('0x56')]({'where':{'ListId':_0x248f54[_0x3662('0x34')][_0x3662('0x68')],'CampaignId':_0x248f54[_0x3662('0x45')]['id']}})[_0x3662('0x25')](function(){return _0x2451b9;});}})['then'](respondWithStatusCode(_0x5567a4,null))[_0x3662('0x44')](handleError(_0x5567a4,null));}; \ No newline at end of file +var _0x7fce=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','userProfileId','autoAssociation','clone','includeAll','omit','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','CmHopper','CampaignId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','ContactId','select','field','NOW()','scheduledAt','CmListId','toString','ListId','createdAt','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','into','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','destroy','get','UserProfileResource','sendStatus','error','name','send','map','Campaign','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','rows','catch','show','params','rawAttributes','options','find'];(function(_0x16e906,_0x27f2f8){var _0x20d8ed=function(_0x5ac187){while(--_0x5ac187){_0x16e906['push'](_0x16e906['shift']());}};_0x20d8ed(++_0x27f2f8);}(_0x7fce,0xdc));var _0xe7fc=function(_0x1c2dba,_0x563270){_0x1c2dba=_0x1c2dba-0x0;var _0x300d47=_0x7fce[_0x1c2dba];return _0x300d47;};'use strict';var emlformat=require(_0xe7fc('0x0'));var rimraf=require(_0xe7fc('0x1'));var zipdir=require(_0xe7fc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe7fc('0x3'));var moment=require('moment');var BPromise=require(_0xe7fc('0x4'));var Mustache=require('mustache');var util=require(_0xe7fc('0x5'));var path=require(_0xe7fc('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe7fc('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe7fc('0x8'));var squel=require(_0xe7fc('0x9'));var crypto=require(_0xe7fc('0xa'));var jsforce=require(_0xe7fc('0xb'));var deskjs=require(_0xe7fc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe7fc('0xd'));var Papa=require('papaparse');var Redis=require(_0xe7fc('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe7fc('0xf'));var as=require(_0xe7fc('0x10'));var hardwareService=require(_0xe7fc('0x11'));var logger=require(_0xe7fc('0x12'))('api');var utils=require(_0xe7fc('0x13'));var config=require(_0xe7fc('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x243600,_0x59da2e){_0x59da2e=_0x59da2e||0xcc;return function(_0x38512a){if(_0x38512a){return _0x243600['sendStatus'](_0x59da2e);}return _0x243600['status'](_0x59da2e)[_0xe7fc('0x15')]();};}function respondWithResult(_0x14fcbf,_0x235692){_0x235692=_0x235692||0xc8;return function(_0x307f58){if(_0x307f58){return _0x14fcbf[_0xe7fc('0x16')](_0x235692)['json'](_0x307f58);}};}function respondWithFilteredResult(_0x272cd5,_0x5ce83f){return function(_0x4da73b){if(_0x4da73b){var _0x1302e5=typeof _0x5ce83f[_0xe7fc('0x17')]===_0xe7fc('0x18')&&typeof _0x5ce83f[_0xe7fc('0x19')]==='undefined';var _0x552429=_0x4da73b['count'];var _0x4aa4f0=_0x1302e5?0x0:_0x5ce83f['offset'];var _0x490a99=_0x1302e5?_0x4da73b[_0xe7fc('0x1a')]:_0x5ce83f['offset']+_0x5ce83f[_0xe7fc('0x19')];var _0xb43fde;if(_0x490a99>=_0x552429){_0x490a99=_0x552429;_0xb43fde=0xc8;}else{_0xb43fde=0xce;}_0x272cd5[_0xe7fc('0x16')](_0xb43fde);return _0x272cd5[_0xe7fc('0x1b')](_0xe7fc('0x1c'),_0x4aa4f0+'-'+_0x490a99+'/'+_0x552429)[_0xe7fc('0x1d')](_0x4da73b);}return null;};}function patchUpdates(_0x329051){return function(_0x763103){try{jsonpatch['apply'](_0x763103,_0x329051,!![]);}catch(_0x39c75a){return BPromise[_0xe7fc('0x1e')](_0x39c75a);}return _0x763103['save']();};}function saveUpdates(_0x587dee,_0x35bb53){return function(_0x3c31e7){if(_0x3c31e7){return _0x3c31e7[_0xe7fc('0x1f')](_0x587dee)[_0xe7fc('0x20')](function(_0x26977a){return _0x26977a;});}return null;};}function removeEntity(_0x11c5a3,_0x3f850f){return function(_0x1731b6){if(_0x1731b6){return _0x1731b6[_0xe7fc('0x21')]()[_0xe7fc('0x20')](function(){var _0x1d1348=_0x1731b6[_0xe7fc('0x22')]({'plain':!![]});var _0x12ebdd='IvrCampaigns';return db[_0xe7fc('0x23')][_0xe7fc('0x21')]({'where':{'type':_0x12ebdd,'resourceId':_0x1d1348['id']}})[_0xe7fc('0x20')](function(){return _0x1731b6;});})[_0xe7fc('0x20')](function(){_0x11c5a3[_0xe7fc('0x16')](0xcc)[_0xe7fc('0x15')]();});}};}function handleEntityNotFound(_0x553ac5,_0x1a82e8){return function(_0x1ceedc){if(!_0x1ceedc){_0x553ac5[_0xe7fc('0x24')](0x194);}return _0x1ceedc;};}function handleError(_0x3e3798,_0x2f1628){_0x2f1628=_0x2f1628||0x1f4;return function(_0x4416b5){logger[_0xe7fc('0x25')](_0x4416b5['stack']);if(_0x4416b5[_0xe7fc('0x26')]){delete _0x4416b5[_0xe7fc('0x26')];}_0x3e3798['status'](_0x2f1628)[_0xe7fc('0x27')](_0x4416b5);};}exports['index']=function(_0x39d908,_0x27255a){var _0x547219={},_0x2b3830={},_0x4fe326={'count':0x0,'rows':[]};var _0x245965=_[_0xe7fc('0x28')](db[_0xe7fc('0x29')]['rawAttributes'],function(_0x36a043){return{'name':_0x36a043['fieldName'],'type':_0x36a043[_0xe7fc('0x2a')][_0xe7fc('0x2b')]};});_0x2b3830['model']=_['map'](_0x245965,'name');_0x2b3830['query']=_[_0xe7fc('0x2c')](_0x39d908[_0xe7fc('0x2d')]);_0x2b3830[_0xe7fc('0x2e')]=_[_0xe7fc('0x2f')](_0x2b3830[_0xe7fc('0x30')],_0x2b3830[_0xe7fc('0x2d')]);_0x547219[_0xe7fc('0x31')]=_[_0xe7fc('0x2f')](_0x2b3830[_0xe7fc('0x30')],qs[_0xe7fc('0x32')](_0x39d908['query'][_0xe7fc('0x32')]));_0x547219[_0xe7fc('0x31')]=_0x547219[_0xe7fc('0x31')][_0xe7fc('0x33')]?_0x547219[_0xe7fc('0x31')]:_0x2b3830['model'];if(!_0x39d908[_0xe7fc('0x2d')][_0xe7fc('0x34')](_0xe7fc('0x35'))){_0x547219[_0xe7fc('0x19')]=qs[_0xe7fc('0x19')](_0x39d908[_0xe7fc('0x2d')][_0xe7fc('0x19')]);_0x547219[_0xe7fc('0x17')]=qs[_0xe7fc('0x17')](_0x39d908[_0xe7fc('0x2d')][_0xe7fc('0x17')]);}_0x547219[_0xe7fc('0x36')]=qs['sort'](_0x39d908[_0xe7fc('0x2d')][_0xe7fc('0x37')]);_0x547219[_0xe7fc('0x38')]=qs[_0xe7fc('0x2e')](_[_0xe7fc('0x39')](_0x39d908['query'],_0x2b3830[_0xe7fc('0x2e')]),_0x245965);if(_0x39d908[_0xe7fc('0x2d')][_0xe7fc('0x3a')]){_0x547219[_0xe7fc('0x38')]=_[_0xe7fc('0x3b')](_0x547219[_0xe7fc('0x38')],{'$or':_['map'](_0x245965,function(_0x5586d8){if(_0x5586d8['type']!=='VIRTUAL'){var _0x4fd29e={};_0x4fd29e[_0x5586d8[_0xe7fc('0x26')]]={'$like':'%'+_0x39d908[_0xe7fc('0x2d')]['filter']+'%'};return _0x4fd29e;}})});}_0x547219=_[_0xe7fc('0x3b')]({},_0x547219,_0x39d908['options']);var _0x280025={'where':_0x547219[_0xe7fc('0x38')]};return db[_0xe7fc('0x29')][_0xe7fc('0x1a')](_0x280025)[_0xe7fc('0x20')](function(_0x3e35c7){_0x4fe326['count']=_0x3e35c7;if(_0x39d908[_0xe7fc('0x2d')]['includeAll']){_0x547219[_0xe7fc('0x3c')]=[{'all':!![]}];}return db[_0xe7fc('0x29')]['findAll'](_0x547219);})[_0xe7fc('0x20')](function(_0x3ce7ad){_0x4fe326[_0xe7fc('0x3d')]=_0x3ce7ad;return _0x4fe326;})[_0xe7fc('0x20')](respondWithFilteredResult(_0x27255a,_0x547219))[_0xe7fc('0x3e')](handleError(_0x27255a,null));};exports[_0xe7fc('0x3f')]=function(_0x3f47aa,_0xab81b8){var _0x31473a={'raw':![],'where':{'id':_0x3f47aa[_0xe7fc('0x40')]['id']}},_0x118e94={};_0x118e94[_0xe7fc('0x30')]=_[_0xe7fc('0x2c')](db[_0xe7fc('0x29')][_0xe7fc('0x41')]);_0x118e94[_0xe7fc('0x2d')]=_[_0xe7fc('0x2c')](_0x3f47aa['query']);_0x118e94[_0xe7fc('0x2e')]=_[_0xe7fc('0x2f')](_0x118e94[_0xe7fc('0x30')],_0x118e94['query']);_0x31473a[_0xe7fc('0x31')]=_[_0xe7fc('0x2f')](_0x118e94[_0xe7fc('0x30')],qs[_0xe7fc('0x32')](_0x3f47aa[_0xe7fc('0x2d')]['fields']));_0x31473a['attributes']=_0x31473a[_0xe7fc('0x31')][_0xe7fc('0x33')]?_0x31473a[_0xe7fc('0x31')]:_0x118e94[_0xe7fc('0x30')];if(_0x3f47aa[_0xe7fc('0x2d')]['includeAll']){_0x31473a[_0xe7fc('0x3c')]=[{'all':!![]}];}_0x31473a=_[_0xe7fc('0x3b')]({},_0x31473a,_0x3f47aa[_0xe7fc('0x42')]);return db[_0xe7fc('0x29')][_0xe7fc('0x43')](_0x31473a)[_0xe7fc('0x20')](handleEntityNotFound(_0xab81b8,null))[_0xe7fc('0x20')](respondWithResult(_0xab81b8,null))[_0xe7fc('0x3e')](handleError(_0xab81b8,null));};exports[_0xe7fc('0x44')]=function(_0x45edbf,_0x533f31){return db[_0xe7fc('0x29')]['create'](_0x45edbf[_0xe7fc('0x45')],{})[_0xe7fc('0x20')](function(_0x1129dd){var _0xc204f7=_0x45edbf[_0xe7fc('0x46')][_0xe7fc('0x22')]({'plain':!![]});if(!_0xc204f7)throw new Error(_0xe7fc('0x47'));if(_0xc204f7[_0xe7fc('0x48')]===_0xe7fc('0x46')){var _0x535afb=_0x1129dd[_0xe7fc('0x22')]({'plain':!![]});var _0xf553c1=_0xe7fc('0x49');return db[_0xe7fc('0x4a')][_0xe7fc('0x43')]({'where':{'name':_0xf553c1,'userProfileId':_0xc204f7[_0xe7fc('0x4b')]},'raw':!![]})['then'](function(_0x1ecaf1){if(_0x1ecaf1&&_0x1ecaf1[_0xe7fc('0x4c')]===0x0){return db[_0xe7fc('0x23')][_0xe7fc('0x44')]({'name':_0x535afb[_0xe7fc('0x26')],'resourceId':_0x535afb['id'],'type':_0x1ecaf1[_0xe7fc('0x26')],'sectionId':_0x1ecaf1['id']},{})['then'](function(){return _0x1129dd;});}else{return _0x1129dd;}})['catch'](function(_0x3d5f19){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d5f19);throw _0x3d5f19;});}return _0x1129dd;})[_0xe7fc('0x20')](respondWithResult(_0x533f31,0xc9))[_0xe7fc('0x3e')](handleError(_0x533f31,null));};exports[_0xe7fc('0x4d')]=function(_0x2cf52f,_0x2246d8){var _0x1fbd9d={'where':{'id':_0x2cf52f[_0xe7fc('0x40')]['id']}},_0x3fab1f={};_0x3fab1f[_0xe7fc('0x30')]=_[_0xe7fc('0x2c')](db[_0xe7fc('0x29')]['rawAttributes']);_0x1fbd9d[_0xe7fc('0x31')]=_['intersection'](_0x3fab1f[_0xe7fc('0x30')],qs[_0xe7fc('0x32')](_0x2cf52f[_0xe7fc('0x2d')][_0xe7fc('0x32')]));_0x1fbd9d[_0xe7fc('0x31')]=_0x1fbd9d[_0xe7fc('0x31')][_0xe7fc('0x33')]?_0x1fbd9d[_0xe7fc('0x31')]:_0x3fab1f['model'];if(_0x2cf52f[_0xe7fc('0x2d')][_0xe7fc('0x4e')]){_0x1fbd9d['include']=[{'all':!![]}];}_0x1fbd9d=_[_0xe7fc('0x3b')]({},_0x1fbd9d,_0x2cf52f[_0xe7fc('0x42')]);return db[_0xe7fc('0x29')][_0xe7fc('0x43')](_0x1fbd9d)[_0xe7fc('0x20')](handleEntityNotFound(_0x2246d8,null))['then'](function(_0x1807b2){if(_0x1807b2){var _0x12c4ab=_0x1807b2[_0xe7fc('0x22')]({'plain':!![]});_0x12c4ab=qs[_0xe7fc('0x4f')](_0x12c4ab,['id','createdAt',_0xe7fc('0x50')]);_0x2cf52f[_0xe7fc('0x45')]=_[_0xe7fc('0x4f')](_0x2cf52f['body'],['id','createdAt',_0xe7fc('0x50')]);return db[_0xe7fc('0x29')][_0xe7fc('0x44')](_[_0xe7fc('0x3b')](_0x12c4ab,_0x2cf52f[_0xe7fc('0x45')]),{'include':_0x2cf52f[_0xe7fc('0x2d')]['includeAll']?[{'all':!![]}]:undefined})[_0xe7fc('0x20')](function(_0x4d9a11){var _0x31fbeb=_0x2cf52f[_0xe7fc('0x46')]['get']({'plain':!![]});if(!_0x31fbeb)throw new Error(_0xe7fc('0x47'));if(_0x31fbeb['role']==='user'){var _0x567ab9=_0x4d9a11[_0xe7fc('0x22')]({'plain':!![]});var _0x270505=_0xe7fc('0x49');return db['UserProfileSection']['find']({'where':{'name':_0x270505,'userProfileId':_0x31fbeb['userProfileId']},'raw':!![]})['then'](function(_0x3ea15b){if(_0x3ea15b&&_0x3ea15b[_0xe7fc('0x4c')]===0x0){return db[_0xe7fc('0x23')][_0xe7fc('0x44')]({'name':_0x567ab9[_0xe7fc('0x26')],'resourceId':_0x567ab9['id'],'type':_0x3ea15b[_0xe7fc('0x26')],'sectionId':_0x3ea15b['id']},{})[_0xe7fc('0x20')](function(){return _0x4d9a11;});}else{return _0x4d9a11;}})[_0xe7fc('0x3e')](function(_0x371a7f){logger['error'](_0xe7fc('0x51'),_0x371a7f);throw _0x371a7f;});}return _0x4d9a11;});}})['then'](respondWithResult(_0x2246d8,0xc9))[_0xe7fc('0x3e')](handleError(_0x2246d8,null));};exports[_0xe7fc('0x1f')]=function(_0x30c2e1,_0x561e5a){if(_0x30c2e1[_0xe7fc('0x45')]['id']){delete _0x30c2e1[_0xe7fc('0x45')]['id'];}return db['Campaign'][_0xe7fc('0x43')]({'where':{'id':_0x30c2e1[_0xe7fc('0x40')]['id']}})['then'](handleEntityNotFound(_0x561e5a,null))[_0xe7fc('0x20')](saveUpdates(_0x30c2e1[_0xe7fc('0x45')],null))[_0xe7fc('0x20')](respondWithResult(_0x561e5a,null))['catch'](handleError(_0x561e5a,null));};exports[_0xe7fc('0x21')]=function(_0x5cad9e,_0x51838f){return db[_0xe7fc('0x29')][_0xe7fc('0x43')]({'where':{'id':_0x5cad9e[_0xe7fc('0x40')]['id']}})[_0xe7fc('0x20')](handleEntityNotFound(_0x51838f,null))[_0xe7fc('0x20')](removeEntity(_0x51838f,null))[_0xe7fc('0x3e')](handleError(_0x51838f,null));};exports['getHoppers']=function(_0x3f4dea,_0x2dc3db,_0x390a6e){var _0x26a1a4={'raw':!![],'where':{}};var _0x58a981={};var _0x1b9dff={'count':0x0,'rows':[]};return db[_0xe7fc('0x29')][_0xe7fc('0x52')]({'where':{'id':_0x3f4dea['params']['id']}})[_0xe7fc('0x20')](handleEntityNotFound(_0x2dc3db,null))[_0xe7fc('0x20')](function(_0x59baff){if(_0x59baff){_0x58a981[_0xe7fc('0x30')]=_[_0xe7fc('0x2c')](db[_0xe7fc('0x53')][_0xe7fc('0x41')]);_0x58a981[_0xe7fc('0x2d')]=_[_0xe7fc('0x2c')](_0x3f4dea[_0xe7fc('0x2d')]);_0x58a981[_0xe7fc('0x2e')]=_[_0xe7fc('0x2f')](_0x58a981['model'],_0x58a981['query']);_0x26a1a4['attributes']=_[_0xe7fc('0x2f')](_0x58a981[_0xe7fc('0x30')],qs['fields'](_0x3f4dea[_0xe7fc('0x2d')]['fields']));_0x26a1a4[_0xe7fc('0x31')]=_0x26a1a4['attributes'][_0xe7fc('0x33')]?_0x26a1a4[_0xe7fc('0x31')]:_0x58a981[_0xe7fc('0x30')];if(!_0x3f4dea[_0xe7fc('0x2d')][_0xe7fc('0x34')](_0xe7fc('0x35'))){_0x26a1a4[_0xe7fc('0x19')]=qs[_0xe7fc('0x19')](_0x3f4dea[_0xe7fc('0x2d')][_0xe7fc('0x19')]);_0x26a1a4[_0xe7fc('0x17')]=qs['offset'](_0x3f4dea[_0xe7fc('0x2d')][_0xe7fc('0x17')]);}_0x26a1a4[_0xe7fc('0x36')]=qs[_0xe7fc('0x37')](_0x3f4dea['query'][_0xe7fc('0x37')]);_0x26a1a4[_0xe7fc('0x38')]=qs[_0xe7fc('0x2e')](_['pick'](_0x3f4dea[_0xe7fc('0x2d')],_0x58a981[_0xe7fc('0x2e')]));_0x26a1a4[_0xe7fc('0x38')][_0xe7fc('0x54')]=_0x59baff['id'];if(_0x3f4dea[_0xe7fc('0x2d')][_0xe7fc('0x3a')]){_0x26a1a4[_0xe7fc('0x38')]=_[_0xe7fc('0x3b')](_0x26a1a4['where'],{'$or':_[_0xe7fc('0x28')](_0x26a1a4['attributes'],function(_0x2cdd29){var _0xc5621f={};_0xc5621f[_0x2cdd29]={'$like':'%'+_0x3f4dea[_0xe7fc('0x2d')]['filter']+'%'};return _0xc5621f;})});}_0x26a1a4=_[_0xe7fc('0x3b')]({},_0x26a1a4,_0x3f4dea[_0xe7fc('0x42')]);return db[_0xe7fc('0x53')]['count']({'where':_0x26a1a4[_0xe7fc('0x38')]})['then'](function(_0x7cfe41){_0x1b9dff[_0xe7fc('0x1a')]=_0x7cfe41;if(_0x3f4dea[_0xe7fc('0x2d')][_0xe7fc('0x4e')]){_0x26a1a4[_0xe7fc('0x3c')]=[{'all':!![]}];}return db['CmHopper'][_0xe7fc('0x55')](_0x26a1a4);})[_0xe7fc('0x20')](function(_0x9e3d14){_0x1b9dff['rows']=_0x9e3d14;return _0x1b9dff;});}})[_0xe7fc('0x20')](respondWithFilteredResult(_0x2dc3db,_0x26a1a4))['catch'](handleError(_0x2dc3db,null));};exports[_0xe7fc('0x56')]=function(_0x5256ad,_0x55ca6f,_0x195b86){var _0x116702={'raw':!![],'where':{}};var _0x3ca583={};var _0x9445bb={'count':0x0,'rows':[]};return db[_0xe7fc('0x29')][_0xe7fc('0x52')]({'where':{'id':_0x5256ad[_0xe7fc('0x40')]['id']}})[_0xe7fc('0x20')](handleEntityNotFound(_0x55ca6f,null))[_0xe7fc('0x20')](function(_0x23a31b){if(_0x23a31b){_0x3ca583[_0xe7fc('0x30')]=_[_0xe7fc('0x2c')](db[_0xe7fc('0x57')]['rawAttributes']);_0x3ca583[_0xe7fc('0x2d')]=_['keys'](_0x5256ad[_0xe7fc('0x2d')]);_0x3ca583[_0xe7fc('0x2e')]=_['intersection'](_0x3ca583['model'],_0x3ca583[_0xe7fc('0x2d')]);_0x116702['attributes']=_[_0xe7fc('0x2f')](_0x3ca583[_0xe7fc('0x30')],qs[_0xe7fc('0x32')](_0x5256ad[_0xe7fc('0x2d')][_0xe7fc('0x32')]));_0x116702[_0xe7fc('0x31')]=_0x116702[_0xe7fc('0x31')][_0xe7fc('0x33')]?_0x116702[_0xe7fc('0x31')]:_0x3ca583[_0xe7fc('0x30')];if(!_0x5256ad['query'][_0xe7fc('0x34')](_0xe7fc('0x35'))){_0x116702['limit']=qs[_0xe7fc('0x19')](_0x5256ad[_0xe7fc('0x2d')][_0xe7fc('0x19')]);_0x116702[_0xe7fc('0x17')]=qs[_0xe7fc('0x17')](_0x5256ad[_0xe7fc('0x2d')][_0xe7fc('0x17')]);}_0x116702[_0xe7fc('0x36')]=qs[_0xe7fc('0x37')](_0x5256ad[_0xe7fc('0x2d')][_0xe7fc('0x37')]);_0x116702[_0xe7fc('0x38')]=qs['filters'](_[_0xe7fc('0x39')](_0x5256ad[_0xe7fc('0x2d')],_0x3ca583[_0xe7fc('0x2e')]));_0x116702['where']['CampaignId']=_0x23a31b['id'];if(_0x5256ad[_0xe7fc('0x2d')][_0xe7fc('0x3a')]){_0x116702[_0xe7fc('0x38')]=_['merge'](_0x116702[_0xe7fc('0x38')],{'$or':_[_0xe7fc('0x28')](_0x116702['attributes'],function(_0x9fd013){var _0x4ae3bf={};_0x4ae3bf[_0x9fd013]={'$like':'%'+_0x5256ad[_0xe7fc('0x2d')][_0xe7fc('0x3a')]+'%'};return _0x4ae3bf;})});}_0x116702=_[_0xe7fc('0x3b')]({},_0x116702,_0x5256ad[_0xe7fc('0x42')]);return db[_0xe7fc('0x57')][_0xe7fc('0x1a')]({'where':_0x116702[_0xe7fc('0x38')]})[_0xe7fc('0x20')](function(_0x466296){_0x9445bb[_0xe7fc('0x1a')]=_0x466296;if(_0x5256ad[_0xe7fc('0x2d')]['includeAll']){_0x116702['include']=[{'all':!![]}];}return db[_0xe7fc('0x57')][_0xe7fc('0x55')](_0x116702);})['then'](function(_0x2f501f){_0x9445bb[_0xe7fc('0x3d')]=_0x2f501f;return _0x9445bb;});}})[_0xe7fc('0x20')](respondWithFilteredResult(_0x55ca6f,_0x116702))[_0xe7fc('0x3e')](handleError(_0x55ca6f,null));};exports[_0xe7fc('0x58')]=function(_0x1034fe,_0x3416d6,_0x19b496){var _0x323580={'raw':!![],'where':{}};var _0x269675={};var _0x274a98={'count':0x0,'rows':[]};return db['Campaign'][_0xe7fc('0x52')]({'where':{'id':_0x1034fe[_0xe7fc('0x40')]['id']}})['then'](handleEntityNotFound(_0x3416d6,null))[_0xe7fc('0x20')](function(_0x598e79){if(_0x598e79){_0x269675[_0xe7fc('0x30')]=_['keys'](db['CmHopperFinal'][_0xe7fc('0x41')]);_0x269675[_0xe7fc('0x2d')]=_[_0xe7fc('0x2c')](_0x1034fe['query']);_0x269675['filters']=_[_0xe7fc('0x2f')](_0x269675['model'],_0x269675[_0xe7fc('0x2d')]);_0x323580[_0xe7fc('0x31')]=_[_0xe7fc('0x2f')](_0x269675[_0xe7fc('0x30')],qs[_0xe7fc('0x32')](_0x1034fe['query'][_0xe7fc('0x32')]));_0x323580[_0xe7fc('0x31')]=_0x323580[_0xe7fc('0x31')][_0xe7fc('0x33')]?_0x323580[_0xe7fc('0x31')]:_0x269675['model'];if(!_0x1034fe[_0xe7fc('0x2d')][_0xe7fc('0x34')](_0xe7fc('0x35'))){_0x323580[_0xe7fc('0x19')]=qs[_0xe7fc('0x19')](_0x1034fe[_0xe7fc('0x2d')][_0xe7fc('0x19')]);_0x323580[_0xe7fc('0x17')]=qs['offset'](_0x1034fe[_0xe7fc('0x2d')][_0xe7fc('0x17')]);}_0x323580[_0xe7fc('0x36')]=qs[_0xe7fc('0x37')](_0x1034fe[_0xe7fc('0x2d')][_0xe7fc('0x37')]);_0x323580[_0xe7fc('0x38')]=qs[_0xe7fc('0x2e')](_['pick'](_0x1034fe[_0xe7fc('0x2d')],_0x269675[_0xe7fc('0x2e')]));_0x323580[_0xe7fc('0x38')]['CampaignId']=_0x598e79['id'];if(_0x1034fe[_0xe7fc('0x2d')]['filter']){_0x323580[_0xe7fc('0x38')]=_['merge'](_0x323580[_0xe7fc('0x38')],{'$or':_[_0xe7fc('0x28')](_0x323580[_0xe7fc('0x31')],function(_0x3df140){var _0x1c6d19={};_0x1c6d19[_0x3df140]={'$like':'%'+_0x1034fe['query']['filter']+'%'};return _0x1c6d19;})});}_0x323580=_[_0xe7fc('0x3b')]({},_0x323580,_0x1034fe[_0xe7fc('0x42')]);return db[_0xe7fc('0x59')][_0xe7fc('0x1a')]({'where':_0x323580['where']})[_0xe7fc('0x20')](function(_0x445332){_0x274a98[_0xe7fc('0x1a')]=_0x445332;if(_0x1034fe[_0xe7fc('0x2d')]['includeAll']){_0x323580[_0xe7fc('0x3c')]=[{'all':!![]}];}return db[_0xe7fc('0x59')][_0xe7fc('0x55')](_0x323580);})[_0xe7fc('0x20')](function(_0x303ba8){_0x274a98[_0xe7fc('0x3d')]=_0x303ba8;return _0x274a98;});}})[_0xe7fc('0x20')](respondWithFilteredResult(_0x3416d6,_0x323580))[_0xe7fc('0x3e')](handleError(_0x3416d6,null));};exports[_0xe7fc('0x5a')]=function(_0x5e4652,_0x234629,_0x18ba9b){var _0x13d64b={'raw':!![],'where':{}};var _0x4a0432={};var _0x3a9f96={'count':0x0,'rows':[]};return db['Campaign'][_0xe7fc('0x52')]({'where':{'id':_0x5e4652['params']['id']}})['then'](handleEntityNotFound(_0x234629,null))[_0xe7fc('0x20')](function(_0x177f8f){if(_0x177f8f){_0x4a0432['model']=_[_0xe7fc('0x2c')](db['CmHopperBlack'][_0xe7fc('0x41')]);_0x4a0432[_0xe7fc('0x2d')]=_[_0xe7fc('0x2c')](_0x5e4652[_0xe7fc('0x2d')]);_0x4a0432['filters']=_[_0xe7fc('0x2f')](_0x4a0432['model'],_0x4a0432['query']);_0x13d64b[_0xe7fc('0x31')]=_[_0xe7fc('0x2f')](_0x4a0432[_0xe7fc('0x30')],qs[_0xe7fc('0x32')](_0x5e4652[_0xe7fc('0x2d')][_0xe7fc('0x32')]));_0x13d64b[_0xe7fc('0x31')]=_0x13d64b[_0xe7fc('0x31')][_0xe7fc('0x33')]?_0x13d64b[_0xe7fc('0x31')]:_0x4a0432[_0xe7fc('0x30')];if(!_0x5e4652[_0xe7fc('0x2d')][_0xe7fc('0x34')]('nolimit')){_0x13d64b[_0xe7fc('0x19')]=qs[_0xe7fc('0x19')](_0x5e4652['query']['limit']);_0x13d64b[_0xe7fc('0x17')]=qs[_0xe7fc('0x17')](_0x5e4652[_0xe7fc('0x2d')][_0xe7fc('0x17')]);}_0x13d64b[_0xe7fc('0x36')]=qs[_0xe7fc('0x37')](_0x5e4652['query'][_0xe7fc('0x37')]);_0x13d64b[_0xe7fc('0x38')]=qs[_0xe7fc('0x2e')](_[_0xe7fc('0x39')](_0x5e4652[_0xe7fc('0x2d')],_0x4a0432[_0xe7fc('0x2e')]));_0x13d64b[_0xe7fc('0x38')]['CampaignId']=_0x177f8f['id'];if(_0x5e4652['query'][_0xe7fc('0x3a')]){_0x13d64b[_0xe7fc('0x38')]=_[_0xe7fc('0x3b')](_0x13d64b[_0xe7fc('0x38')],{'$or':_[_0xe7fc('0x28')](_0x13d64b[_0xe7fc('0x31')],function(_0x12cb64){var _0x263504={};_0x263504[_0x12cb64]={'$like':'%'+_0x5e4652[_0xe7fc('0x2d')][_0xe7fc('0x3a')]+'%'};return _0x263504;})});}_0x13d64b=_['merge']({},_0x13d64b,_0x5e4652['options']);return db['CmHopperBlack'][_0xe7fc('0x1a')]({'where':_0x13d64b[_0xe7fc('0x38')]})[_0xe7fc('0x20')](function(_0x214c7c){_0x3a9f96[_0xe7fc('0x1a')]=_0x214c7c;if(_0x5e4652[_0xe7fc('0x2d')][_0xe7fc('0x4e')]){_0x13d64b[_0xe7fc('0x3c')]=[{'all':!![]}];}return db[_0xe7fc('0x5b')][_0xe7fc('0x55')](_0x13d64b);})[_0xe7fc('0x20')](function(_0x298849){_0x3a9f96[_0xe7fc('0x3d')]=_0x298849;return _0x3a9f96;});}})[_0xe7fc('0x20')](respondWithFilteredResult(_0x234629,_0x13d64b))[_0xe7fc('0x3e')](handleError(_0x234629,null));};exports[_0xe7fc('0x5c')]=function(_0x3b3017,_0x18f5a4,_0x5cf31b){var _0x415dbe={};var _0x454ec2={};var _0x243105;var _0x2eccd5;return db['Campaign'][_0xe7fc('0x52')]({'where':{'id':_0x3b3017[_0xe7fc('0x40')]['id']}})[_0xe7fc('0x20')](handleEntityNotFound(_0x18f5a4,null))[_0xe7fc('0x20')](function(_0x338afb){if(_0x338afb){_0x243105=_0x338afb;_0x454ec2[_0xe7fc('0x30')]=_['keys'](db['CmList'][_0xe7fc('0x41')]);_0x454ec2['query']=_['keys'](_0x3b3017['query']);_0x454ec2[_0xe7fc('0x2e')]=_[_0xe7fc('0x2f')](_0x454ec2[_0xe7fc('0x30')],_0x454ec2[_0xe7fc('0x2d')]);_0x415dbe['attributes']=_['intersection'](_0x454ec2[_0xe7fc('0x30')],qs[_0xe7fc('0x32')](_0x3b3017[_0xe7fc('0x2d')][_0xe7fc('0x32')]));_0x415dbe[_0xe7fc('0x31')]=_0x415dbe[_0xe7fc('0x31')][_0xe7fc('0x33')]?_0x415dbe[_0xe7fc('0x31')]:_0x454ec2[_0xe7fc('0x30')];_0x415dbe[_0xe7fc('0x36')]=qs[_0xe7fc('0x37')](_0x3b3017[_0xe7fc('0x2d')][_0xe7fc('0x37')]);_0x415dbe[_0xe7fc('0x38')]=qs['filters'](_[_0xe7fc('0x39')](_0x3b3017[_0xe7fc('0x2d')],_0x454ec2['filters']));if(_0x3b3017[_0xe7fc('0x2d')][_0xe7fc('0x3a')]){_0x415dbe[_0xe7fc('0x38')]=_['merge'](_0x415dbe[_0xe7fc('0x38')],{'$or':_[_0xe7fc('0x28')](_0x415dbe['attributes'],function(_0x4e22e0){var _0x21c42b={};_0x21c42b[_0x4e22e0]={'$like':'%'+_0x3b3017['query'][_0xe7fc('0x3a')]+'%'};return _0x21c42b;})});}_0x415dbe=_[_0xe7fc('0x3b')]({},_0x415dbe,_0x3b3017[_0xe7fc('0x42')]);return _0x243105[_0xe7fc('0x5c')](_0x415dbe);}})[_0xe7fc('0x20')](function(_0x5dae71){if(_0x5dae71){_0x2eccd5=_0x5dae71[_0xe7fc('0x33')];if(!_0x3b3017[_0xe7fc('0x2d')][_0xe7fc('0x34')](_0xe7fc('0x35'))){_0x415dbe[_0xe7fc('0x19')]=qs[_0xe7fc('0x19')](_0x3b3017['query'][_0xe7fc('0x19')]);_0x415dbe['offset']=qs[_0xe7fc('0x17')](_0x3b3017['query'][_0xe7fc('0x17')]);}return _0x243105['getLists'](_0x415dbe);}})['then'](function(_0x4521fa){if(_0x4521fa){return _0x4521fa?{'count':_0x2eccd5,'rows':_0x4521fa}:null;}})[_0xe7fc('0x20')](respondWithResult(_0x18f5a4,null))[_0xe7fc('0x3e')](handleError(_0x18f5a4,null));};exports[_0xe7fc('0x5d')]=function(_0x2bb619,_0x3ef536,_0x41206a){var _0x26e587,_0x215532;var _0x237160=[];var _0x2ee092=moment()[_0xe7fc('0x5e')](_0xe7fc('0x5f'));return db[_0xe7fc('0x29')][_0xe7fc('0x43')]({'where':{'id':_0x2bb619['params']['id']}})[_0xe7fc('0x20')](handleEntityNotFound(_0x3ef536,null))[_0xe7fc('0x20')](function(_0xd37ad){if(_0xd37ad){_0x215532=_0xd37ad;return _0xd37ad[_0xe7fc('0x5d')](_0x2bb619[_0xe7fc('0x45')][_0xe7fc('0x60')],_['omit'](_0x2bb619[_0xe7fc('0x45')],[_0xe7fc('0x60'),'id'])||{});}return null;})[_0xe7fc('0x61')](function(_0x2b120d){var _0xd8b989;var _0x1ea67b;_0x26e587=_0x2b120d||[];var _0x4849a0=[];if(_0x2b120d){for(var _0x2892cb=0x0;_0x2892cb<_0x2b120d[_0xe7fc('0x33')];_0x2892cb+=0x1){var _0x6cef1f=_0x2b120d[_0x2892cb][_0xe7fc('0x22')]({'plain':!![]});_0x215532['dialCheckDuplicateType']=_0x2bb619[_0xe7fc('0x45')][_0xe7fc('0x62')]?_0x2bb619[_0xe7fc('0x45')][_0xe7fc('0x62')]:_0x215532[_0xe7fc('0x62')];switch(_0x215532[_0xe7fc('0x62')]){case _0xe7fc('0x63'):_0xd8b989=squel[_0xe7fc('0x64')]()['into'](_0xe7fc('0x65'))[_0xe7fc('0x66')]([_0xe7fc('0x67'),'scheduledAt',_0xe7fc('0x68'),'ListId','CampaignId','createdAt','updatedAt'],squel[_0xe7fc('0x69')]()[_0xe7fc('0x6a')](_0xe7fc('0x67'),'phone')[_0xe7fc('0x6a')](_0xe7fc('0x6b'),_0xe7fc('0x6c'))[_0xe7fc('0x6a')]('id',_0xe7fc('0x68'))[_0xe7fc('0x6a')](_0x6cef1f[_0xe7fc('0x6d')][_0xe7fc('0x6e')](),_0xe7fc('0x6f'))['field'](_0x2bb619[_0xe7fc('0x40')]['id'][_0xe7fc('0x6e')](),_0xe7fc('0x54'))[_0xe7fc('0x6a')]('\x27'+_0x2ee092+'\x27',_0xe7fc('0x70'))[_0xe7fc('0x6a')]('\x27'+_0x2ee092+'\x27',_0xe7fc('0x50'))[_0xe7fc('0x71')](_0xe7fc('0x72'))[_0xe7fc('0x38')]('deletedAt\x20IS\x20NULL')[_0xe7fc('0x38')](_0xe7fc('0x73'),_0x6cef1f[_0xe7fc('0x6d')][_0xe7fc('0x6e')]())[_0xe7fc('0x38')](_0xe7fc('0x74'))[_0xe7fc('0x38')](_0xe7fc('0x75'),squel[_0xe7fc('0x69')]()['field']('COALESCE(calleridnum,\x27\x27)')[_0xe7fc('0x71')](_0xe7fc('0x76'))['where'](_0xe7fc('0x77'),_0x2bb619[_0xe7fc('0x40')]['id']['toString']()))[_0xe7fc('0x38')](_0xe7fc('0x75'),squel['select']()['field'](_0xe7fc('0x78'))['from'](_0xe7fc('0x65'))[_0xe7fc('0x38')](_0xe7fc('0x77'),_0x2bb619['params']['id'][_0xe7fc('0x6e')]())))['toString']();break;case _0xe7fc('0x79'):_0xd8b989=squel['insert']()[_0xe7fc('0x7a')]('cm_hopper')[_0xe7fc('0x66')]([_0xe7fc('0x67'),_0xe7fc('0x6c'),_0xe7fc('0x68'),_0xe7fc('0x6f'),_0xe7fc('0x54'),_0xe7fc('0x70'),_0xe7fc('0x50')],squel[_0xe7fc('0x69')]()[_0xe7fc('0x6a')](_0xe7fc('0x67'),_0xe7fc('0x67'))[_0xe7fc('0x6a')](_0xe7fc('0x6b'),_0xe7fc('0x6c'))[_0xe7fc('0x6a')]('id','ContactId')[_0xe7fc('0x6a')](_0x6cef1f[_0xe7fc('0x6d')][_0xe7fc('0x6e')](),_0xe7fc('0x6f'))['field'](_0x2bb619['params']['id'][_0xe7fc('0x6e')](),'CampaignId')[_0xe7fc('0x6a')]('\x27'+_0x2ee092+'\x27','createdAt')['field']('\x27'+_0x2ee092+'\x27',_0xe7fc('0x50'))['from'](_0xe7fc('0x72'))['where'](_0xe7fc('0x7b'))[_0xe7fc('0x38')]('ListId\x20=\x20?',_0x6cef1f[_0xe7fc('0x6d')][_0xe7fc('0x6e')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xe7fc('0x38')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe7fc('0x69')]()[_0xe7fc('0x6a')](_0xe7fc('0x78'))[_0xe7fc('0x71')]('cm_hopper')['where'](_0xe7fc('0x77'),_0x2bb619[_0xe7fc('0x40')]['id']['toString']())))['toString']();break;default:_0xd8b989=squel[_0xe7fc('0x64')]()[_0xe7fc('0x7a')]('cm_hopper')[_0xe7fc('0x66')](['phone','scheduledAt',_0xe7fc('0x68'),_0xe7fc('0x6f'),_0xe7fc('0x54'),_0xe7fc('0x70'),_0xe7fc('0x50')],squel[_0xe7fc('0x69')]()[_0xe7fc('0x6a')](_0xe7fc('0x67'),'phone')['field'](_0xe7fc('0x6b'),_0xe7fc('0x6c'))[_0xe7fc('0x6a')]('id',_0xe7fc('0x68'))[_0xe7fc('0x6a')](_0x6cef1f[_0xe7fc('0x6d')][_0xe7fc('0x6e')](),'ListId')[_0xe7fc('0x6a')](_0x2bb619[_0xe7fc('0x40')]['id'][_0xe7fc('0x6e')](),'CampaignId')[_0xe7fc('0x6a')]('\x27'+_0x2ee092+'\x27',_0xe7fc('0x70'))[_0xe7fc('0x6a')]('\x27'+_0x2ee092+'\x27','updatedAt')[_0xe7fc('0x71')](_0xe7fc('0x72'))[_0xe7fc('0x38')]('deletedAt\x20IS\x20NULL')[_0xe7fc('0x38')](_0xe7fc('0x73'),_0x6cef1f[_0xe7fc('0x6d')][_0xe7fc('0x6e')]())[_0xe7fc('0x38')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x1ea67b=squel['insert']()['into'](_0xe7fc('0x7c'))['fromQuery']([_0xe7fc('0x7d'),_0xe7fc('0x6c'),_0xe7fc('0x67'),_0xe7fc('0x7e'),_0xe7fc('0x70'),_0xe7fc('0x50')],squel[_0xe7fc('0x69')]()['field'](_0xe7fc('0x7f'),'id')[_0xe7fc('0x6a')](_0xe7fc('0x6b'),'scheduledAt')[_0xe7fc('0x6a')](_0xe7fc('0x80'),_0xe7fc('0x67'))[_0xe7fc('0x6a')](_0xe7fc('0x81'),_0xe7fc('0x7e'))[_0xe7fc('0x6a')]('\x27'+_0x2ee092+'\x27','createdAt')[_0xe7fc('0x6a')]('\x27'+_0x2ee092+'\x27','updatedAt')[_0xe7fc('0x71')](_0xe7fc('0x82'),'ci')[_0xe7fc('0x83')](_0xe7fc('0x65'),'h',_0xe7fc('0x84'))['where'](_0xe7fc('0x85'),_0x6cef1f['CmListId'][_0xe7fc('0x6e')]())[_0xe7fc('0x38')](_0xe7fc('0x86'),_0x2bb619['params']['id'][_0xe7fc('0x6e')]())[_0xe7fc('0x38')](_0xe7fc('0x87'),_0x2ee092))[_0xe7fc('0x6e')]();_0x4849a0[_0xe7fc('0x88')](db['sequelize'][_0xe7fc('0x2d')](_0xd8b989));_0x237160[_0xe7fc('0x88')](db[_0xe7fc('0x89')][_0xe7fc('0x2d')](_0x1ea67b));}return BPromise[_0xe7fc('0x8a')](_0x4849a0);}})[_0xe7fc('0x20')](function(){return BPromise[_0xe7fc('0x8a')](_0x237160);})[_0xe7fc('0x20')](function(){return _0x26e587;})[_0xe7fc('0x20')](respondWithResult(_0x3ef536,null))['catch'](handleError(_0x3ef536,null));};exports[_0xe7fc('0x8b')]=function(_0x2e8fd6,_0x30c72c,_0x394ca4){return db[_0xe7fc('0x29')][_0xe7fc('0x43')]({'where':{'id':_0x2e8fd6[_0xe7fc('0x40')]['id']}})[_0xe7fc('0x20')](handleEntityNotFound(_0x30c72c,null))[_0xe7fc('0x20')](function(_0x442408){if(_0x442408){return _0x442408[_0xe7fc('0x8b')](_0x2e8fd6[_0xe7fc('0x2d')][_0xe7fc('0x60')]);}})[_0xe7fc('0x20')](function(_0x332e1b){if(_0x332e1b){return db[_0xe7fc('0x53')][_0xe7fc('0x21')]({'where':{'ListId':_0x2e8fd6['query'][_0xe7fc('0x60')],'CampaignId':_0x2e8fd6['params']['id']}})['then'](function(){return _0x332e1b;});}})['then'](respondWithStatusCode(_0x30c72c,null))[_0xe7fc('0x3e')](handleError(_0x30c72c,null));};exports[_0xe7fc('0x8c')]=function(_0x3acdb5,_0x464702,_0x5ce4cd){var _0x3fb020={};var _0x41ea88={};var _0x66fa8e;var _0x268f6a;return db[_0xe7fc('0x29')][_0xe7fc('0x52')]({'where':{'id':_0x3acdb5['params']['id']}})['then'](handleEntityNotFound(_0x464702,null))['then'](function(_0x10d59e){if(_0x10d59e){_0x66fa8e=_0x10d59e;_0x41ea88['model']=_['keys'](db[_0xe7fc('0x8d')][_0xe7fc('0x41')]);_0x41ea88[_0xe7fc('0x2d')]=_[_0xe7fc('0x2c')](_0x3acdb5['query']);_0x41ea88[_0xe7fc('0x2e')]=_[_0xe7fc('0x2f')](_0x41ea88[_0xe7fc('0x30')],_0x41ea88[_0xe7fc('0x2d')]);_0x3fb020['attributes']=_['intersection'](_0x41ea88[_0xe7fc('0x30')],qs[_0xe7fc('0x32')](_0x3acdb5[_0xe7fc('0x2d')]['fields']));_0x3fb020[_0xe7fc('0x31')]=_0x3fb020[_0xe7fc('0x31')][_0xe7fc('0x33')]?_0x3fb020['attributes']:_0x41ea88['model'];_0x3fb020[_0xe7fc('0x36')]=qs[_0xe7fc('0x37')](_0x3acdb5[_0xe7fc('0x2d')][_0xe7fc('0x37')]);_0x3fb020['where']=qs[_0xe7fc('0x2e')](_[_0xe7fc('0x39')](_0x3acdb5[_0xe7fc('0x2d')],_0x41ea88['filters']));if(_0x3acdb5[_0xe7fc('0x2d')][_0xe7fc('0x3a')]){_0x3fb020[_0xe7fc('0x38')]=_['merge'](_0x3fb020[_0xe7fc('0x38')],{'$or':_[_0xe7fc('0x28')](_0x3fb020[_0xe7fc('0x31')],function(_0x5921bc){var _0x5024b6={};_0x5024b6[_0x5921bc]={'$like':'%'+_0x3acdb5['query'][_0xe7fc('0x3a')]+'%'};return _0x5024b6;})});}_0x3fb020=_[_0xe7fc('0x3b')]({},_0x3fb020,_0x3acdb5['options']);return _0x66fa8e['getBlackLists'](_0x3fb020);}})[_0xe7fc('0x20')](function(_0x375035){if(_0x375035){_0x268f6a=_0x375035[_0xe7fc('0x33')];if(!_0x3acdb5[_0xe7fc('0x2d')][_0xe7fc('0x34')](_0xe7fc('0x35'))){_0x3fb020[_0xe7fc('0x19')]=qs[_0xe7fc('0x19')](_0x3acdb5[_0xe7fc('0x2d')][_0xe7fc('0x19')]);_0x3fb020[_0xe7fc('0x17')]=qs[_0xe7fc('0x17')](_0x3acdb5[_0xe7fc('0x2d')][_0xe7fc('0x17')]);}return _0x66fa8e[_0xe7fc('0x8c')](_0x3fb020);}})[_0xe7fc('0x20')](function(_0x5d3b52){if(_0x5d3b52){return _0x5d3b52?{'count':_0x268f6a,'rows':_0x5d3b52}:null;}})[_0xe7fc('0x20')](respondWithResult(_0x464702,null))[_0xe7fc('0x3e')](handleError(_0x464702,null));};exports[_0xe7fc('0x8e')]=function(_0xfe96fd,_0x4380b1,_0x2ce23f){var _0x18abc3,_0xb0ffa6;var _0x81eabb=[];var _0x7cda06=moment()['format'](_0xe7fc('0x5f'));return db[_0xe7fc('0x29')][_0xe7fc('0x43')]({'where':{'id':_0xfe96fd[_0xe7fc('0x40')]['id']}})[_0xe7fc('0x20')](handleEntityNotFound(_0x4380b1,null))[_0xe7fc('0x20')](function(_0x521834){if(_0x521834){_0xb0ffa6=_0x521834;return _0x521834[_0xe7fc('0x8e')](_0xfe96fd[_0xe7fc('0x45')][_0xe7fc('0x60')],_[_0xe7fc('0x4f')](_0xfe96fd['body'],['ids','id'])||{});}return null;})['spread'](function(_0x14444f){var _0x5a0bdb;var _0x62f194;_0x18abc3=_0x14444f||[];var _0x524203=[];if(_0x14444f){for(var _0x129496=0x0;_0x129496<_0x14444f[_0xe7fc('0x33')];_0x129496+=0x1){var _0x1e2aae=_0x14444f[_0x129496]['get']({'plain':!![]});_0x5a0bdb=squel[_0xe7fc('0x64')]()['into']('cm_hopper_black')[_0xe7fc('0x66')](['phone',_0xe7fc('0x68'),_0xe7fc('0x6f'),_0xe7fc('0x54'),'createdAt',_0xe7fc('0x50')],squel[_0xe7fc('0x69')]()[_0xe7fc('0x6a')](_0xe7fc('0x67'),_0xe7fc('0x67'))[_0xe7fc('0x6a')]('id',_0xe7fc('0x68'))['field'](_0x1e2aae[_0xe7fc('0x6d')][_0xe7fc('0x6e')](),'ListId')[_0xe7fc('0x6a')](_0xfe96fd[_0xe7fc('0x40')]['id'][_0xe7fc('0x6e')](),_0xe7fc('0x54'))[_0xe7fc('0x6a')]('NOW()',_0xe7fc('0x70'))[_0xe7fc('0x6a')](_0xe7fc('0x6b'),_0xe7fc('0x50'))[_0xe7fc('0x71')](_0xe7fc('0x72'))['where'](_0xe7fc('0x7b'))[_0xe7fc('0x38')]('ListId\x20=\x20?',_0x1e2aae[_0xe7fc('0x6d')]['toString']())[_0xe7fc('0x38')](_0xe7fc('0x74')))[_0xe7fc('0x6e')]();_0x524203[_0xe7fc('0x88')](db[_0xe7fc('0x89')][_0xe7fc('0x2d')](_0x5a0bdb));}return BPromise[_0xe7fc('0x8a')](_0x524203);}})[_0xe7fc('0x20')](function(){return _0x18abc3;})[_0xe7fc('0x20')](respondWithResult(_0x4380b1,null))[_0xe7fc('0x3e')](handleError(_0x4380b1,null));};exports[_0xe7fc('0x8f')]=function(_0x44c20a,_0x47d3d5,_0x1f6e34){return db[_0xe7fc('0x29')][_0xe7fc('0x43')]({'where':{'id':_0x44c20a[_0xe7fc('0x40')]['id']}})[_0xe7fc('0x20')](handleEntityNotFound(_0x47d3d5,null))['then'](function(_0x39b319){if(_0x39b319){return _0x39b319['removeBlackLists'](_0x44c20a[_0xe7fc('0x2d')][_0xe7fc('0x60')]);}})[_0xe7fc('0x20')](function(_0x178888){if(_0x178888){return db[_0xe7fc('0x5b')]['destroy']({'where':{'ListId':_0x44c20a[_0xe7fc('0x2d')][_0xe7fc('0x60')],'CampaignId':_0x44c20a[_0xe7fc('0x40')]['id']}})['then'](function(){return _0x178888;});}})[_0xe7fc('0x20')](respondWithStatusCode(_0x47d3d5,null))[_0xe7fc('0x3e')](handleError(_0x47d3d5,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 35b882a..f022b86 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(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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 diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index ad78ae5..b6b4ea1 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 _0x8d97=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','map','include','model','util','moment'];(function(_0x1cc060,_0x1afbdc){var _0x5c7e10=function(_0x15e8d6){while(--_0x15e8d6){_0x1cc060['push'](_0x1cc060['shift']());}};_0x5c7e10(++_0x1afbdc);}(_0x8d97,0x82));var _0x78d9=function(_0x2e44d3,_0x570fed){_0x2e44d3=_0x2e44d3-0x0;var _0x123a84=_0x8d97[_0x2e44d3];return _0x123a84;};'use strict';var _=require('lodash');var util=require(_0x78d9('0x0'));var moment=require(_0x78d9('0x1'));var BPromise=require('bluebird');var rs=require(_0x78d9('0x2'));var fs=require('fs');var Redis=require(_0x78d9('0x3'));var db=require(_0x78d9('0x4'))['db'];var utils=require(_0x78d9('0x5'));var logger=require(_0x78d9('0x6'))('rpc');var config=require(_0x78d9('0x7'));var jayson=require(_0x78d9('0x8'));var client=jayson[_0x78d9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d1934,_0x5b9602,_0x2a2cdb){return new BPromise(function(_0x3b3709,_0x36b8f5){return client[_0x78d9('0xa')](_0x4d1934,_0x2a2cdb)[_0x78d9('0xb')](function(_0x14ca4e){logger['info'](_0x78d9('0xc'),_0x5b9602,_0x78d9('0xd'));logger[_0x78d9('0xe')]('Campaign,\x20%s,\x20%s,\x20%s',_0x5b9602,'request\x20sent',JSON[_0x78d9('0xf')](_0x14ca4e));if(_0x14ca4e[_0x78d9('0x10')]){if(_0x14ca4e[_0x78d9('0x10')][_0x78d9('0x11')]===0x1f4){logger[_0x78d9('0x10')](_0x78d9('0xc'),_0x5b9602,_0x14ca4e['error'][_0x78d9('0x12')]);return _0x36b8f5(_0x14ca4e[_0x78d9('0x10')][_0x78d9('0x12')]);}logger[_0x78d9('0x10')](_0x78d9('0xc'),_0x5b9602,_0x14ca4e[_0x78d9('0x10')][_0x78d9('0x12')]);return _0x3b3709(_0x14ca4e[_0x78d9('0x10')][_0x78d9('0x12')]);}else{logger[_0x78d9('0x13')](_0x78d9('0xc'),_0x5b9602,_0x78d9('0xd'));_0x3b3709(_0x14ca4e[_0x78d9('0x14')][_0x78d9('0x12')]);}})[_0x78d9('0x15')](function(_0x156981){logger[_0x78d9('0x10')]('Campaign,\x20%s,\x20%s',_0x5b9602,_0x156981);_0x36b8f5(_0x156981);});});}exports[_0x78d9('0x16')]=function(_0x3b4dde){var _0x36f1e4=this;return new Promise(function(_0x8d0153,_0x43ea59){return db[_0x78d9('0x17')][_0x78d9('0x18')]({'raw':_0x3b4dde[_0x78d9('0x19')]?_0x3b4dde[_0x78d9('0x19')][_0x78d9('0x1a')]===undefined?!![]:![]:!![],'where':_0x3b4dde[_0x78d9('0x19')]?_0x3b4dde[_0x78d9('0x19')][_0x78d9('0x1b')]||null:null,'attributes':_0x3b4dde[_0x78d9('0x19')]?_0x3b4dde[_0x78d9('0x19')][_0x78d9('0x1c')]||null:null,'limit':_0x3b4dde['options']?_0x3b4dde[_0x78d9('0x19')][_0x78d9('0x1d')]||null:null,'include':_0x3b4dde[_0x78d9('0x19')]?_0x3b4dde[_0x78d9('0x19')]['include']?_[_0x78d9('0x1e')](_0x3b4dde[_0x78d9('0x19')][_0x78d9('0x1f')],function(_0x51549d){return{'model':db[_0x51549d['model']],'as':_0x51549d['as'],'attributes':_0x51549d[_0x78d9('0x1c')],'include':_0x51549d['include']?_['map'](_0x51549d['include'],function(_0x28b7e1){return{'model':db[_0x28b7e1[_0x78d9('0x20')]],'as':_0x28b7e1['as'],'attributes':_0x28b7e1[_0x78d9('0x1c')],'include':_0x28b7e1[_0x78d9('0x1f')]?_[_0x78d9('0x1e')](_0x28b7e1[_0x78d9('0x1f')],function(_0x4e87cf){return{'model':db[_0x4e87cf[_0x78d9('0x20')]],'as':_0x4e87cf['as'],'attributes':_0x4e87cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x78d9('0xb')](function(_0x3d9a53){logger[_0x78d9('0x13')]('GetCampaign',_0x3b4dde);logger[_0x78d9('0xe')](_0x78d9('0x16'),_0x3b4dde,JSON['stringify'](_0x3d9a53));_0x8d0153(_0x3d9a53);})['catch'](function(_0x55617c){logger['error'](_0x78d9('0x16'),_0x55617c[_0x78d9('0x12')],_0x3b4dde);_0x43ea59(_0x36f1e4[_0x78d9('0x10')](0x1f4,_0x55617c[_0x78d9('0x12')]));});});}; \ No newline at end of file +var _0x2121=['request\x20sent','stringify','error','message','GetCampaign','Campaign','options','raw','where','limit','include','map','model','attributes','debug','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Campaign,\x20%s,\x20%s'];(function(_0x135d6d,_0x3fe57e){var _0x14ff9a=function(_0x2a6021){while(--_0x2a6021){_0x135d6d['push'](_0x135d6d['shift']());}};_0x14ff9a(++_0x3fe57e);}(_0x2121,0x1b4));var _0x1212=function(_0x20e21b,_0x456996){_0x20e21b=_0x20e21b-0x0;var _0x3c4627=_0x2121[_0x20e21b];return _0x3c4627;};'use strict';var _=require(_0x1212('0x0'));var util=require(_0x1212('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1212('0x2'));var fs=require('fs');var Redis=require(_0x1212('0x3'));var db=require(_0x1212('0x4'))['db'];var utils=require(_0x1212('0x5'));var logger=require(_0x1212('0x6'))('rpc');var config=require(_0x1212('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1212('0x8')][_0x1212('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20fadc,_0x1b1ef5,_0x233a53){return new BPromise(function(_0x642ed5,_0x4a3d2a){return client[_0x1212('0xa')](_0x20fadc,_0x233a53)[_0x1212('0xb')](function(_0x434d23){logger[_0x1212('0xc')](_0x1212('0xd'),_0x1b1ef5,_0x1212('0xe'));logger['debug']('Campaign,\x20%s,\x20%s,\x20%s',_0x1b1ef5,_0x1212('0xe'),JSON[_0x1212('0xf')](_0x434d23));if(_0x434d23[_0x1212('0x10')]){if(_0x434d23[_0x1212('0x10')]['code']===0x1f4){logger[_0x1212('0x10')](_0x1212('0xd'),_0x1b1ef5,_0x434d23[_0x1212('0x10')][_0x1212('0x11')]);return _0x4a3d2a(_0x434d23[_0x1212('0x10')][_0x1212('0x11')]);}logger[_0x1212('0x10')](_0x1212('0xd'),_0x1b1ef5,_0x434d23[_0x1212('0x10')][_0x1212('0x11')]);return _0x642ed5(_0x434d23[_0x1212('0x10')][_0x1212('0x11')]);}else{logger[_0x1212('0xc')](_0x1212('0xd'),_0x1b1ef5,_0x1212('0xe'));_0x642ed5(_0x434d23['result']['message']);}})['catch'](function(_0x3cfe21){logger[_0x1212('0x10')](_0x1212('0xd'),_0x1b1ef5,_0x3cfe21);_0x4a3d2a(_0x3cfe21);});});}exports[_0x1212('0x12')]=function(_0x3cf284){var _0x3face0=this;return new Promise(function(_0xb0dc88,_0x22eefb){return db[_0x1212('0x13')]['findAll']({'raw':_0x3cf284[_0x1212('0x14')]?_0x3cf284[_0x1212('0x14')][_0x1212('0x15')]===undefined?!![]:![]:!![],'where':_0x3cf284[_0x1212('0x14')]?_0x3cf284[_0x1212('0x14')][_0x1212('0x16')]||null:null,'attributes':_0x3cf284[_0x1212('0x14')]?_0x3cf284[_0x1212('0x14')]['attributes']||null:null,'limit':_0x3cf284[_0x1212('0x14')]?_0x3cf284[_0x1212('0x14')][_0x1212('0x17')]||null:null,'include':_0x3cf284[_0x1212('0x14')]?_0x3cf284[_0x1212('0x14')][_0x1212('0x18')]?_[_0x1212('0x19')](_0x3cf284[_0x1212('0x14')]['include'],function(_0x58ab5b){return{'model':db[_0x58ab5b['model']],'as':_0x58ab5b['as'],'attributes':_0x58ab5b['attributes'],'include':_0x58ab5b['include']?_[_0x1212('0x19')](_0x58ab5b[_0x1212('0x18')],function(_0x4c32a7){return{'model':db[_0x4c32a7[_0x1212('0x1a')]],'as':_0x4c32a7['as'],'attributes':_0x4c32a7[_0x1212('0x1b')],'include':_0x4c32a7['include']?_[_0x1212('0x19')](_0x4c32a7[_0x1212('0x18')],function(_0x4630b4){return{'model':db[_0x4630b4[_0x1212('0x1a')]],'as':_0x4630b4['as'],'attributes':_0x4630b4[_0x1212('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1212('0xb')](function(_0x2750b0){logger[_0x1212('0xc')]('GetCampaign',_0x3cf284);logger[_0x1212('0x1c')](_0x1212('0x12'),_0x3cf284,JSON[_0x1212('0xf')](_0x2750b0));_0xb0dc88(_0x2750b0);})[_0x1212('0x1d')](function(_0x17d0f6){logger[_0x1212('0x10')](_0x1212('0x12'),_0x17d0f6[_0x1212('0x11')],_0x3cf284);_0x22eefb(_0x3face0[_0x1212('0x10')](0x1f4,_0x17d0f6[_0x1212('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index f213c4c..5d5ce2c 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 _0x605e=['connect-timeout','express','../../components/interaction/service','../../config/environment','./campaign.controller','isAuthenticated','index','show','get','/:id/hoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','addBlackLists','put','/:id','update','delete','destroy','/:id/lists','removeLists','removeBlackLists','exports','multer','util'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0x605e,0x1b8));var _0xe605=function(_0x496166,_0x4ec1a0){_0x496166=_0x496166-0x0;var _0x36d05f=_0x605e[_0x496166];return _0x36d05f;};'use strict';var multer=require(_0xe605('0x0'));var util=require(_0xe605('0x1'));var path=require('path');var timeout=require(_0xe605('0x2'));var express=require(_0xe605('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe605('0x4'));var config=require(_0xe605('0x5'));var controller=require(_0xe605('0x6'));router['get']('/',auth[_0xe605('0x7')](),controller[_0xe605('0x8')]);router['get']('/:id',auth[_0xe605('0x7')](),controller[_0xe605('0x9')]);router[_0xe605('0xa')](_0xe605('0xb'),auth[_0xe605('0x7')](),controller['getHoppers']);router[_0xe605('0xa')](_0xe605('0xc'),auth[_0xe605('0x7')](),controller[_0xe605('0xd')]);router[_0xe605('0xa')]('/:id/hopper_finals',auth[_0xe605('0x7')](),controller[_0xe605('0xe')]);router[_0xe605('0xa')](_0xe605('0xf'),auth[_0xe605('0x7')](),controller[_0xe605('0x10')]);router[_0xe605('0xa')]('/:id/lists',auth[_0xe605('0x7')](),controller[_0xe605('0x11')]);router[_0xe605('0xa')](_0xe605('0x12'),auth[_0xe605('0x7')](),controller[_0xe605('0x13')]);router['post']('/',auth[_0xe605('0x7')](),controller[_0xe605('0x14')]);router[_0xe605('0x15')](_0xe605('0x16'),auth[_0xe605('0x7')](),controller[_0xe605('0x17')]);router[_0xe605('0x15')]('/:id/lists',auth[_0xe605('0x7')](),controller['addLists']);router['post']('/:id/blacklists',auth[_0xe605('0x7')](),controller[_0xe605('0x18')]);router[_0xe605('0x19')](_0xe605('0x1a'),auth[_0xe605('0x7')](),controller[_0xe605('0x1b')]);router[_0xe605('0x1c')]('/:id',auth[_0xe605('0x7')](),controller[_0xe605('0x1d')]);router[_0xe605('0x1c')](_0xe605('0x1e'),auth['isAuthenticated'](),controller[_0xe605('0x1f')]);router[_0xe605('0x1c')](_0xe605('0x12'),auth['isAuthenticated'](),controller[_0xe605('0x20')]);module[_0xe605('0x21')]=router; \ No newline at end of file +var _0x6e73=['addLists','addBlackLists','put','update','destroy','delete','/:id/blacklists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getBlackLists','post','create','/:id/clone','clone','/:id/lists'];(function(_0x5d2cf3,_0x16bfd2){var _0x45a3fc=function(_0x24e67f){while(--_0x24e67f){_0x5d2cf3['push'](_0x5d2cf3['shift']());}};_0x45a3fc(++_0x16bfd2);}(_0x6e73,0x110));var _0x36e7=function(_0xcf1602,_0x1da275){_0xcf1602=_0xcf1602-0x0;var _0x2bfa18=_0x6e73[_0xcf1602];return _0x2bfa18;};'use strict';var multer=require(_0x36e7('0x0'));var util=require(_0x36e7('0x1'));var path=require(_0x36e7('0x2'));var timeout=require(_0x36e7('0x3'));var express=require(_0x36e7('0x4'));var router=express[_0x36e7('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x36e7('0x6'));var interaction=require(_0x36e7('0x7'));var config=require(_0x36e7('0x8'));var controller=require(_0x36e7('0x9'));router[_0x36e7('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x36e7('0xa')](_0x36e7('0xb'),auth[_0x36e7('0xc')](),controller[_0x36e7('0xd')]);router[_0x36e7('0xa')](_0x36e7('0xe'),auth[_0x36e7('0xc')](),controller[_0x36e7('0xf')]);router[_0x36e7('0xa')](_0x36e7('0x10'),auth[_0x36e7('0xc')](),controller[_0x36e7('0x11')]);router[_0x36e7('0xa')](_0x36e7('0x12'),auth[_0x36e7('0xc')](),controller['getHopperFinals']);router['get']('/:id/hopper_black',auth[_0x36e7('0xc')](),controller['getHopperBlacks']);router[_0x36e7('0xa')]('/:id/lists',auth['isAuthenticated'](),controller['getLists']);router['get']('/:id/blacklists',auth[_0x36e7('0xc')](),controller[_0x36e7('0x13')]);router[_0x36e7('0x14')]('/',auth[_0x36e7('0xc')](),controller[_0x36e7('0x15')]);router['post'](_0x36e7('0x16'),auth['isAuthenticated'](),controller[_0x36e7('0x17')]);router['post'](_0x36e7('0x18'),auth[_0x36e7('0xc')](),controller[_0x36e7('0x19')]);router[_0x36e7('0x14')]('/:id/blacklists',auth[_0x36e7('0xc')](),controller[_0x36e7('0x1a')]);router[_0x36e7('0x1b')]('/:id',auth[_0x36e7('0xc')](),controller[_0x36e7('0x1c')]);router['delete'](_0x36e7('0xb'),auth[_0x36e7('0xc')](),controller[_0x36e7('0x1d')]);router[_0x36e7('0x1e')](_0x36e7('0x18'),auth[_0x36e7('0xc')](),controller['removeLists']);router[_0x36e7('0x1e')](_0x36e7('0x1f'),auth[_0x36e7('0xc')](),controller['removeBlackLists']);module[_0x36e7('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 ed3bf0c..55d79ae 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 _0x8cb6=['medium','VIRTUAL','getDataValue','sequelize','exports','TEXT'];(function(_0xb74c89,_0x246040){var _0xe4ccef=function(_0x12b652){while(--_0x12b652){_0xb74c89['push'](_0xb74c89['shift']());}};_0xe4ccef(++_0x246040);}(_0x8cb6,0xff));var _0x68cb=function(_0x32aa68,_0x102e89){_0x32aa68=_0x32aa68-0x0;var _0x292133=_0x8cb6[_0x32aa68];return _0x292133;};'use strict';var Sequelize=require(_0x68cb('0x0'));module[_0x68cb('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x68cb('0x2')],'length':_0x68cb('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x68cb('0x4')],'get':function(){return this[_0x68cb('0x5')]('key');}}}; \ No newline at end of file +var _0xfb09=['sequelize','exports','STRING','VIRTUAL','getDataValue','key'];(function(_0x3f9584,_0x5ab12c){var _0x9d54c=function(_0x2882df){while(--_0x2882df){_0x3f9584['push'](_0x3f9584['shift']());}};_0x9d54c(++_0x5ab12c);}(_0xfb09,0xa8));var _0x9fb0=function(_0x4138ac,_0x300097){_0x4138ac=_0x4138ac-0x0;var _0x66154=_0xfb09[_0x4138ac];return _0x66154;};'use strict';var Sequelize=require(_0x9fb0('0x0'));module[_0x9fb0('0x1')]={'key':{'type':Sequelize[_0x9fb0('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':'medium','allowNull':![]},'description':{'type':Sequelize[_0x9fb0('0x2')]},'name':{'type':Sequelize[_0x9fb0('0x3')],'get':function(){return this[_0x9fb0('0x4')](_0x9fb0('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 35116e7..18dc0eb 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 _0x5043=['util','path','sox','to-csv','ejs','lodash','squel','crypto','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','update','then','destroy','get','CannedAnswers','UserProfileResource','error','name','send','map','CannedAnswer','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','rawAttributes','options','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x43e2f6,_0x40d666){var _0x59b26d=function(_0x43360d){while(--_0x43360d){_0x43e2f6['push'](_0x43e2f6['shift']());}};_0x59b26d(++_0x40d666);}(_0x5043,0x108));var _0x3504=function(_0x5e9587,_0xac1c87){_0x5e9587=_0x5e9587-0x0;var _0x1c7d40=_0x5043[_0x5e9587];return _0x1c7d40;};'use strict';var emlformat=require(_0x3504('0x0'));var rimraf=require(_0x3504('0x1'));var zipdir=require(_0x3504('0x2'));var jsonpatch=require(_0x3504('0x3'));var rp=require('request-promise');var moment=require(_0x3504('0x4'));var BPromise=require(_0x3504('0x5'));var Mustache=require('mustache');var util=require(_0x3504('0x6'));var path=require(_0x3504('0x7'));var sox=require(_0x3504('0x8'));var csv=require(_0x3504('0x9'));var ejs=require(_0x3504('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3504('0xb'));var squel=require(_0x3504('0xc'));var crypto=require(_0x3504('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3504('0xe'));var Papa=require('papaparse');var Redis=require(_0x3504('0xf'));var authService=require(_0x3504('0x10'));var qs=require(_0x3504('0x11'));var as=require(_0x3504('0x12'));var hardwareService=require(_0x3504('0x13'));var logger=require(_0x3504('0x14'))(_0x3504('0x15'));var utils=require(_0x3504('0x16'));var config=require(_0x3504('0x17'));var licenseUtil=require(_0x3504('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x236eb7,_0x432730){_0x432730=_0x432730||0xcc;return function(_0xb757ff){if(_0xb757ff){return _0x236eb7[_0x3504('0x19')](_0x432730);}return _0x236eb7[_0x3504('0x1a')](_0x432730)[_0x3504('0x1b')]();};}function respondWithResult(_0x496368,_0x6472a2){_0x6472a2=_0x6472a2||0xc8;return function(_0x356d0e){if(_0x356d0e){return _0x496368['status'](_0x6472a2)[_0x3504('0x1c')](_0x356d0e);}};}function respondWithFilteredResult(_0x39a6eb,_0xc2a402){return function(_0x2b7241){if(_0x2b7241){var _0x15e147=typeof _0xc2a402[_0x3504('0x1d')]===_0x3504('0x1e')&&typeof _0xc2a402[_0x3504('0x1f')]===_0x3504('0x1e');var _0x5e84d8=_0x2b7241[_0x3504('0x20')];var _0x127602=_0x15e147?0x0:_0xc2a402[_0x3504('0x1d')];var _0x15cd0f=_0x15e147?_0x2b7241[_0x3504('0x20')]:_0xc2a402['offset']+_0xc2a402[_0x3504('0x1f')];var _0x1cc5d1;if(_0x15cd0f>=_0x5e84d8){_0x15cd0f=_0x5e84d8;_0x1cc5d1=0xc8;}else{_0x1cc5d1=0xce;}_0x39a6eb[_0x3504('0x1a')](_0x1cc5d1);return _0x39a6eb[_0x3504('0x21')](_0x3504('0x22'),_0x127602+'-'+_0x15cd0f+'/'+_0x5e84d8)['json'](_0x2b7241);}return null;};}function patchUpdates(_0x1d72e3){return function(_0x28dc9a){try{jsonpatch[_0x3504('0x23')](_0x28dc9a,_0x1d72e3,!![]);}catch(_0x51a27b){return BPromise[_0x3504('0x24')](_0x51a27b);}return _0x28dc9a[_0x3504('0x25')]();};}function saveUpdates(_0x153bb5,_0x18a501){return function(_0x19daf2){if(_0x19daf2){return _0x19daf2[_0x3504('0x26')](_0x153bb5)[_0x3504('0x27')](function(_0x5032b5){return _0x5032b5;});}return null;};}function removeEntity(_0x579dbd,_0x49f8a8){return function(_0xa1c06f){if(_0xa1c06f){return _0xa1c06f[_0x3504('0x28')]()[_0x3504('0x27')](function(){var _0x5dbf0b=_0xa1c06f[_0x3504('0x29')]({'plain':!![]});var _0x30f1fc=_0x3504('0x2a');return db[_0x3504('0x2b')]['destroy']({'where':{'type':_0x30f1fc,'resourceId':_0x5dbf0b['id']}})[_0x3504('0x27')](function(){return _0xa1c06f;});})[_0x3504('0x27')](function(){_0x579dbd[_0x3504('0x1a')](0xcc)[_0x3504('0x1b')]();});}};}function handleEntityNotFound(_0x39162e,_0x304790){return function(_0x3bad8e){if(!_0x3bad8e){_0x39162e[_0x3504('0x19')](0x194);}return _0x3bad8e;};}function handleError(_0x35823b,_0x402e02){_0x402e02=_0x402e02||0x1f4;return function(_0x5c058c){logger[_0x3504('0x2c')](_0x5c058c['stack']);if(_0x5c058c[_0x3504('0x2d')]){delete _0x5c058c[_0x3504('0x2d')];}_0x35823b[_0x3504('0x1a')](_0x402e02)[_0x3504('0x2e')](_0x5c058c);};}exports['index']=function(_0x282e0c,_0x58fa48){var _0x5b5119={},_0x279da9={},_0x10b746={'count':0x0,'rows':[]};var _0xe29ac2=_[_0x3504('0x2f')](db[_0x3504('0x30')]['rawAttributes'],function(_0x4d11fd){return{'name':_0x4d11fd['fieldName'],'type':_0x4d11fd[_0x3504('0x31')][_0x3504('0x32')]};});_0x279da9[_0x3504('0x33')]=_[_0x3504('0x2f')](_0xe29ac2,_0x3504('0x2d'));_0x279da9[_0x3504('0x34')]=_[_0x3504('0x35')](_0x282e0c[_0x3504('0x34')]);_0x279da9[_0x3504('0x36')]=_[_0x3504('0x37')](_0x279da9[_0x3504('0x33')],_0x279da9[_0x3504('0x34')]);_0x5b5119['attributes']=_[_0x3504('0x37')](_0x279da9[_0x3504('0x33')],qs['fields'](_0x282e0c['query'][_0x3504('0x38')]));_0x5b5119[_0x3504('0x39')]=_0x5b5119[_0x3504('0x39')][_0x3504('0x3a')]?_0x5b5119[_0x3504('0x39')]:_0x279da9[_0x3504('0x33')];if(!_0x282e0c['query'][_0x3504('0x3b')]('nolimit')){_0x5b5119['limit']=qs[_0x3504('0x1f')](_0x282e0c['query'][_0x3504('0x1f')]);_0x5b5119[_0x3504('0x1d')]=qs['offset'](_0x282e0c['query'][_0x3504('0x1d')]);}_0x5b5119[_0x3504('0x3c')]=qs[_0x3504('0x3d')](_0x282e0c['query'][_0x3504('0x3d')]);_0x5b5119[_0x3504('0x3e')]=qs[_0x3504('0x36')](_[_0x3504('0x3f')](_0x282e0c[_0x3504('0x34')],_0x279da9[_0x3504('0x36')]),_0xe29ac2);if(_0x282e0c[_0x3504('0x34')][_0x3504('0x40')]){_0x5b5119['where']=_[_0x3504('0x41')](_0x5b5119[_0x3504('0x3e')],{'$or':[{'key':{'$like':'%'+_0x282e0c[_0x3504('0x34')][_0x3504('0x40')]+'%'}},{'value':{'$like':'%'+_0x282e0c['query'][_0x3504('0x40')]+'%'}}]});}_0x5b5119=_[_0x3504('0x41')]({},_0x5b5119,_0x282e0c['options']);var _0x1f1bff={'where':_0x5b5119['where']};return db['CannedAnswer'][_0x3504('0x20')](_0x1f1bff)[_0x3504('0x27')](function(_0x3dab4c){_0x10b746['count']=_0x3dab4c;if(_0x282e0c['query'][_0x3504('0x42')]){_0x5b5119[_0x3504('0x43')]=[{'all':!![]}];}return db[_0x3504('0x30')]['findAll'](_0x5b5119);})[_0x3504('0x27')](function(_0x59f1fb){_0x10b746[_0x3504('0x44')]=_0x59f1fb;return _0x10b746;})[_0x3504('0x27')](respondWithFilteredResult(_0x58fa48,_0x5b5119))[_0x3504('0x45')](handleError(_0x58fa48,null));};exports[_0x3504('0x46')]=function(_0x13c04f,_0x53b0bf){var _0x5874fb={'raw':!![],'where':{'id':_0x13c04f['params']['id']}},_0x397cb1={};_0x397cb1[_0x3504('0x33')]=_[_0x3504('0x35')](db[_0x3504('0x30')][_0x3504('0x47')]);_0x397cb1['query']=_[_0x3504('0x35')](_0x13c04f['query']);_0x397cb1['filters']=_['intersection'](_0x397cb1['model'],_0x397cb1[_0x3504('0x34')]);_0x5874fb[_0x3504('0x39')]=_[_0x3504('0x37')](_0x397cb1[_0x3504('0x33')],qs[_0x3504('0x38')](_0x13c04f[_0x3504('0x34')][_0x3504('0x38')]));_0x5874fb[_0x3504('0x39')]=_0x5874fb['attributes'][_0x3504('0x3a')]?_0x5874fb[_0x3504('0x39')]:_0x397cb1[_0x3504('0x33')];if(_0x13c04f[_0x3504('0x34')][_0x3504('0x42')]){_0x5874fb['include']=[{'all':!![]}];}_0x5874fb=_[_0x3504('0x41')]({},_0x5874fb,_0x13c04f[_0x3504('0x48')]);return db[_0x3504('0x30')][_0x3504('0x49')](_0x5874fb)[_0x3504('0x27')](handleEntityNotFound(_0x53b0bf,null))[_0x3504('0x27')](respondWithResult(_0x53b0bf,null))[_0x3504('0x45')](handleError(_0x53b0bf,null));};exports['update']=function(_0x1242cb,_0x2bbfdc){if(_0x1242cb[_0x3504('0x4a')]['id']){delete _0x1242cb[_0x3504('0x4a')]['id'];}return db[_0x3504('0x30')][_0x3504('0x49')]({'where':{'id':_0x1242cb[_0x3504('0x4b')]['id']}})[_0x3504('0x27')](handleEntityNotFound(_0x2bbfdc,null))[_0x3504('0x27')](saveUpdates(_0x1242cb[_0x3504('0x4a')],null))[_0x3504('0x27')](respondWithResult(_0x2bbfdc,null))[_0x3504('0x45')](handleError(_0x2bbfdc,null));};exports[_0x3504('0x28')]=function(_0xdd9ffc,_0x5ef83d){return db[_0x3504('0x30')]['find']({'where':{'id':_0xdd9ffc[_0x3504('0x4b')]['id']}})[_0x3504('0x27')](handleEntityNotFound(_0x5ef83d,null))['then'](removeEntity(_0x5ef83d,null))[_0x3504('0x45')](handleError(_0x5ef83d,null));};exports[_0x3504('0x4c')]=function(_0x4433fc,_0x21cfb7){var _0x5aac1c={'key':_0x4433fc['body'][_0x3504('0x32')]};if(_0x4433fc['body'][_0x3504('0x4d')]){_0x5aac1c[_0x3504('0x4d')]=_0x4433fc[_0x3504('0x4a')][_0x3504('0x4d')];}else if(_0x4433fc[_0x3504('0x4a')][_0x3504('0x4e')]){_0x5aac1c[_0x3504('0x4e')]=_0x4433fc[_0x3504('0x4a')][_0x3504('0x4e')];}else if(_0x4433fc[_0x3504('0x4a')][_0x3504('0x4f')]){_0x5aac1c[_0x3504('0x4f')]=_0x4433fc[_0x3504('0x4a')][_0x3504('0x4f')];}else if(_0x4433fc[_0x3504('0x4a')][_0x3504('0x50')]){_0x5aac1c[_0x3504('0x50')]=_0x4433fc[_0x3504('0x4a')][_0x3504('0x50')];}return db['CannedAnswer']['find']({'where':_0x5aac1c})[_0x3504('0x27')](function(_0x48a8c4){if(_0x48a8c4){throw new db[(_0x3504('0x51'))][(_0x3504('0x52'))](_0x3504('0x53'));}return db[_0x3504('0x30')][_0x3504('0x4c')](_0x4433fc[_0x3504('0x4a')]);})[_0x3504('0x27')](function(_0x2e4fdd){var _0xcfc241=_0x4433fc[_0x3504('0x54')][_0x3504('0x29')]({'plain':!![]});if(!_0xcfc241)throw new Error(_0x3504('0x55'));if(_0xcfc241[_0x3504('0x56')]===_0x3504('0x54')){var _0x46bc47=_0x2e4fdd[_0x3504('0x29')]({'plain':!![]});return db[_0x3504('0x57')][_0x3504('0x49')]({'where':{'name':_0x3504('0x2a'),'userProfileId':_0xcfc241[_0x3504('0x58')]},'raw':!![]})[_0x3504('0x27')](function(_0x2744ec){if(_0x2744ec&&_0x2744ec[_0x3504('0x59')]===0x0){return db[_0x3504('0x2b')][_0x3504('0x4c')]({'name':_0x46bc47[_0x3504('0x2d')],'resourceId':_0x46bc47['id'],'type':_0x2744ec['name'],'sectionId':_0x2744ec['id']},{})[_0x3504('0x27')](function(){return _0x2e4fdd;});}else{return _0x2e4fdd;}})['catch'](function(_0x4cf9d5){logger[_0x3504('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4cf9d5);throw _0x4cf9d5;});}return _0x2e4fdd;})['then'](respondWithResult(_0x21cfb7,0xc9))[_0x3504('0x45')](handleError(_0x21cfb7,null));}; \ No newline at end of file +var _0xb097=['pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','role','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','bluebird','util','path','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','update','destroy','then','get','CannedAnswers','name','send','index','map','CannedAnswer','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb097,0xcc));var _0x7b09=function(_0x593e4c,_0x5b965b){_0x593e4c=_0x593e4c-0x0;var _0x15171a=_0xb097[_0x593e4c];return _0x15171a;};'use strict';var emlformat=require(_0x7b09('0x0'));var rimraf=require(_0x7b09('0x1'));var zipdir=require(_0x7b09('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7b09('0x3'));var BPromise=require(_0x7b09('0x4'));var Mustache=require('mustache');var util=require(_0x7b09('0x5'));var path=require(_0x7b09('0x6'));var sox=require('sox');var csv=require(_0x7b09('0x7'));var ejs=require(_0x7b09('0x8'));var fs=require('fs');var fs_extra=require(_0x7b09('0x9'));var _=require(_0x7b09('0xa'));var squel=require(_0x7b09('0xb'));var crypto=require(_0x7b09('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7b09('0xd'));var toCsv=require(_0x7b09('0x7'));var querystring=require(_0x7b09('0xe'));var Papa=require(_0x7b09('0xf'));var Redis=require(_0x7b09('0x10'));var authService=require(_0x7b09('0x11'));var qs=require(_0x7b09('0x12'));var as=require(_0x7b09('0x13'));var hardwareService=require(_0x7b09('0x14'));var logger=require(_0x7b09('0x15'))(_0x7b09('0x16'));var utils=require(_0x7b09('0x17'));var config=require(_0x7b09('0x18'));var licenseUtil=require(_0x7b09('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ebb8f,_0x3391d4){_0x3391d4=_0x3391d4||0xcc;return function(_0x251ad1){if(_0x251ad1){return _0x2ebb8f[_0x7b09('0x1a')](_0x3391d4);}return _0x2ebb8f['status'](_0x3391d4)[_0x7b09('0x1b')]();};}function respondWithResult(_0x52c32b,_0x4f3ec7){_0x4f3ec7=_0x4f3ec7||0xc8;return function(_0x429ddf){if(_0x429ddf){return _0x52c32b[_0x7b09('0x1c')](_0x4f3ec7)[_0x7b09('0x1d')](_0x429ddf);}};}function respondWithFilteredResult(_0x13b632,_0x139480){return function(_0x5eed78){if(_0x5eed78){var _0x3d1157=typeof _0x139480[_0x7b09('0x1e')]===_0x7b09('0x1f')&&typeof _0x139480[_0x7b09('0x20')]===_0x7b09('0x1f');var _0x4637dc=_0x5eed78[_0x7b09('0x21')];var _0x1f73d7=_0x3d1157?0x0:_0x139480[_0x7b09('0x1e')];var _0x420702=_0x3d1157?_0x5eed78['count']:_0x139480['offset']+_0x139480['limit'];var _0xfa03e8;if(_0x420702>=_0x4637dc){_0x420702=_0x4637dc;_0xfa03e8=0xc8;}else{_0xfa03e8=0xce;}_0x13b632[_0x7b09('0x1c')](_0xfa03e8);return _0x13b632[_0x7b09('0x22')]('Content-Range',_0x1f73d7+'-'+_0x420702+'/'+_0x4637dc)['json'](_0x5eed78);}return null;};}function patchUpdates(_0x17b191){return function(_0x1d2d73){try{jsonpatch[_0x7b09('0x23')](_0x1d2d73,_0x17b191,!![]);}catch(_0x5197bd){return BPromise['reject'](_0x5197bd);}return _0x1d2d73[_0x7b09('0x24')]();};}function saveUpdates(_0x26caf7,_0x4af089){return function(_0x2e4175){if(_0x2e4175){return _0x2e4175[_0x7b09('0x25')](_0x26caf7)['then'](function(_0x15ee35){return _0x15ee35;});}return null;};}function removeEntity(_0x38f356,_0x2e58a8){return function(_0x1e08c3){if(_0x1e08c3){return _0x1e08c3[_0x7b09('0x26')]()[_0x7b09('0x27')](function(){var _0xe267ac=_0x1e08c3[_0x7b09('0x28')]({'plain':!![]});var _0x5b0f63=_0x7b09('0x29');return db['UserProfileResource'][_0x7b09('0x26')]({'where':{'type':_0x5b0f63,'resourceId':_0xe267ac['id']}})[_0x7b09('0x27')](function(){return _0x1e08c3;});})[_0x7b09('0x27')](function(){_0x38f356['status'](0xcc)[_0x7b09('0x1b')]();});}};}function handleEntityNotFound(_0x37f319,_0x36faa5){return function(_0x8a849e){if(!_0x8a849e){_0x37f319[_0x7b09('0x1a')](0x194);}return _0x8a849e;};}function handleError(_0x1297c4,_0x24867c){_0x24867c=_0x24867c||0x1f4;return function(_0x4535dd){logger['error'](_0x4535dd['stack']);if(_0x4535dd[_0x7b09('0x2a')]){delete _0x4535dd[_0x7b09('0x2a')];}_0x1297c4['status'](_0x24867c)[_0x7b09('0x2b')](_0x4535dd);};}exports[_0x7b09('0x2c')]=function(_0x5551d6,_0x442c11){var _0x206343={},_0xa3e5ec={},_0x47c016={'count':0x0,'rows':[]};var _0x546bf7=_[_0x7b09('0x2d')](db[_0x7b09('0x2e')]['rawAttributes'],function(_0x225494){return{'name':_0x225494[_0x7b09('0x2f')],'type':_0x225494['type'][_0x7b09('0x30')]};});_0xa3e5ec[_0x7b09('0x31')]=_['map'](_0x546bf7,_0x7b09('0x2a'));_0xa3e5ec[_0x7b09('0x32')]=_[_0x7b09('0x33')](_0x5551d6[_0x7b09('0x32')]);_0xa3e5ec['filters']=_['intersection'](_0xa3e5ec[_0x7b09('0x31')],_0xa3e5ec[_0x7b09('0x32')]);_0x206343[_0x7b09('0x34')]=_[_0x7b09('0x35')](_0xa3e5ec[_0x7b09('0x31')],qs[_0x7b09('0x36')](_0x5551d6[_0x7b09('0x32')]['fields']));_0x206343[_0x7b09('0x34')]=_0x206343['attributes'][_0x7b09('0x37')]?_0x206343[_0x7b09('0x34')]:_0xa3e5ec[_0x7b09('0x31')];if(!_0x5551d6[_0x7b09('0x32')][_0x7b09('0x38')]('nolimit')){_0x206343['limit']=qs[_0x7b09('0x20')](_0x5551d6['query']['limit']);_0x206343[_0x7b09('0x1e')]=qs[_0x7b09('0x1e')](_0x5551d6[_0x7b09('0x32')]['offset']);}_0x206343['order']=qs[_0x7b09('0x39')](_0x5551d6[_0x7b09('0x32')][_0x7b09('0x39')]);_0x206343[_0x7b09('0x3a')]=qs[_0x7b09('0x3b')](_[_0x7b09('0x3c')](_0x5551d6[_0x7b09('0x32')],_0xa3e5ec['filters']),_0x546bf7);if(_0x5551d6[_0x7b09('0x32')][_0x7b09('0x3d')]){_0x206343[_0x7b09('0x3a')]=_[_0x7b09('0x3e')](_0x206343[_0x7b09('0x3a')],{'$or':[{'key':{'$like':'%'+_0x5551d6[_0x7b09('0x32')][_0x7b09('0x3d')]+'%'}},{'value':{'$like':'%'+_0x5551d6['query']['filter']+'%'}}]});}_0x206343=_[_0x7b09('0x3e')]({},_0x206343,_0x5551d6[_0x7b09('0x3f')]);var _0x6fb9a8={'where':_0x206343[_0x7b09('0x3a')]};return db[_0x7b09('0x2e')][_0x7b09('0x21')](_0x6fb9a8)[_0x7b09('0x27')](function(_0x39906d){_0x47c016[_0x7b09('0x21')]=_0x39906d;if(_0x5551d6[_0x7b09('0x32')][_0x7b09('0x40')]){_0x206343[_0x7b09('0x41')]=[{'all':!![]}];}return db[_0x7b09('0x2e')][_0x7b09('0x42')](_0x206343);})['then'](function(_0xcdd95b){_0x47c016[_0x7b09('0x43')]=_0xcdd95b;return _0x47c016;})[_0x7b09('0x27')](respondWithFilteredResult(_0x442c11,_0x206343))[_0x7b09('0x44')](handleError(_0x442c11,null));};exports[_0x7b09('0x45')]=function(_0x47fcb0,_0x108914){var _0x2ff7b6={'raw':!![],'where':{'id':_0x47fcb0[_0x7b09('0x46')]['id']}},_0x4bf86b={};_0x4bf86b[_0x7b09('0x31')]=_[_0x7b09('0x33')](db[_0x7b09('0x2e')]['rawAttributes']);_0x4bf86b[_0x7b09('0x32')]=_['keys'](_0x47fcb0['query']);_0x4bf86b[_0x7b09('0x3b')]=_[_0x7b09('0x35')](_0x4bf86b[_0x7b09('0x31')],_0x4bf86b[_0x7b09('0x32')]);_0x2ff7b6[_0x7b09('0x34')]=_[_0x7b09('0x35')](_0x4bf86b[_0x7b09('0x31')],qs['fields'](_0x47fcb0[_0x7b09('0x32')][_0x7b09('0x36')]));_0x2ff7b6[_0x7b09('0x34')]=_0x2ff7b6[_0x7b09('0x34')][_0x7b09('0x37')]?_0x2ff7b6[_0x7b09('0x34')]:_0x4bf86b[_0x7b09('0x31')];if(_0x47fcb0['query'][_0x7b09('0x40')]){_0x2ff7b6['include']=[{'all':!![]}];}_0x2ff7b6=_[_0x7b09('0x3e')]({},_0x2ff7b6,_0x47fcb0[_0x7b09('0x3f')]);return db[_0x7b09('0x2e')]['find'](_0x2ff7b6)[_0x7b09('0x27')](handleEntityNotFound(_0x108914,null))[_0x7b09('0x27')](respondWithResult(_0x108914,null))[_0x7b09('0x44')](handleError(_0x108914,null));};exports[_0x7b09('0x25')]=function(_0x9b0c8a,_0x4f4a68){if(_0x9b0c8a[_0x7b09('0x47')]['id']){delete _0x9b0c8a[_0x7b09('0x47')]['id'];}return db[_0x7b09('0x2e')][_0x7b09('0x48')]({'where':{'id':_0x9b0c8a[_0x7b09('0x46')]['id']}})[_0x7b09('0x27')](handleEntityNotFound(_0x4f4a68,null))['then'](saveUpdates(_0x9b0c8a[_0x7b09('0x47')],null))['then'](respondWithResult(_0x4f4a68,null))[_0x7b09('0x44')](handleError(_0x4f4a68,null));};exports[_0x7b09('0x26')]=function(_0x4500fd,_0x367536){return db[_0x7b09('0x2e')][_0x7b09('0x48')]({'where':{'id':_0x4500fd['params']['id']}})[_0x7b09('0x27')](handleEntityNotFound(_0x367536,null))[_0x7b09('0x27')](removeEntity(_0x367536,null))[_0x7b09('0x44')](handleError(_0x367536,null));};exports[_0x7b09('0x49')]=function(_0x2bae25,_0x29bb3c){var _0x53cd23={'key':_0x2bae25[_0x7b09('0x47')][_0x7b09('0x30')]};if(_0x2bae25[_0x7b09('0x47')][_0x7b09('0x4a')]){_0x53cd23[_0x7b09('0x4a')]=_0x2bae25['body'][_0x7b09('0x4a')];}else if(_0x2bae25['body'][_0x7b09('0x4b')]){_0x53cd23[_0x7b09('0x4b')]=_0x2bae25[_0x7b09('0x47')][_0x7b09('0x4b')];}else if(_0x2bae25[_0x7b09('0x47')][_0x7b09('0x4c')]){_0x53cd23['OpenchannelAccountId']=_0x2bae25[_0x7b09('0x47')][_0x7b09('0x4c')];}else if(_0x2bae25[_0x7b09('0x47')][_0x7b09('0x4d')]){_0x53cd23['ChatWebsiteId']=_0x2bae25['body'][_0x7b09('0x4d')];}return db['CannedAnswer'][_0x7b09('0x48')]({'where':_0x53cd23})[_0x7b09('0x27')](function(_0x52c1d4){if(_0x52c1d4){throw new db[(_0x7b09('0x4e'))][(_0x7b09('0x4f'))](_0x7b09('0x50'));}return db[_0x7b09('0x2e')][_0x7b09('0x49')](_0x2bae25[_0x7b09('0x47')]);})['then'](function(_0x144d52){var _0x26d41b=_0x2bae25[_0x7b09('0x51')]['get']({'plain':!![]});if(!_0x26d41b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26d41b[_0x7b09('0x52')]===_0x7b09('0x51')){var _0x1466fb=_0x144d52[_0x7b09('0x28')]({'plain':!![]});return db['UserProfileSection'][_0x7b09('0x48')]({'where':{'name':_0x7b09('0x29'),'userProfileId':_0x26d41b[_0x7b09('0x53')]},'raw':!![]})[_0x7b09('0x27')](function(_0x41d08f){if(_0x41d08f&&_0x41d08f[_0x7b09('0x54')]===0x0){return db[_0x7b09('0x55')]['create']({'name':_0x1466fb[_0x7b09('0x2a')],'resourceId':_0x1466fb['id'],'type':_0x41d08f[_0x7b09('0x2a')],'sectionId':_0x41d08f['id']},{})[_0x7b09('0x27')](function(){return _0x144d52;});}else{return _0x144d52;}})[_0x7b09('0x44')](function(_0xab3131){logger[_0x7b09('0x56')](_0x7b09('0x57'),_0xab3131);throw _0xab3131;});}return _0x144d52;})[_0x7b09('0x27')](respondWithResult(_0x29bb3c,0xc9))['catch'](handleError(_0x29bb3c,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 8eede87..f2a6140 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 _0x9058=['../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3948c3,_0x2299eb){var _0x34d877=function(_0x5028bd){while(--_0x5028bd){_0x3948c3['push'](_0x3948c3['shift']());}};_0x34d877(++_0x2299eb);}(_0x9058,0x17e));var _0x8905=function(_0x58a03e,_0x5b3f89){_0x58a03e=_0x58a03e-0x0;var _0x41e782=_0x9058[_0x58a03e];return _0x41e782;};'use strict';var _=require(_0x8905('0x0'));var util=require('util');var logger=require(_0x8905('0x1'))(_0x8905('0x2'));var moment=require(_0x8905('0x3'));var BPromise=require(_0x8905('0x4'));var rp=require(_0x8905('0x5'));var fs=require('fs');var path=require(_0x8905('0x6'));var rimraf=require(_0x8905('0x7'));var config=require(_0x8905('0x8'));var attributes=require(_0x8905('0x9'));module[_0x8905('0xa')]=function(_0x4f16b3,_0x136991){return _0x4f16b3[_0x8905('0xb')](_0x8905('0xc'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8905('0xd'),'collate':_0x8905('0xe')});}; \ No newline at end of file +var _0x59d0=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x5b6ba1,_0x49f578){var _0x417c60=function(_0x562ffb){while(--_0x562ffb){_0x5b6ba1['push'](_0x5b6ba1['shift']());}};_0x417c60(++_0x49f578);}(_0x59d0,0x129));var _0x059d=function(_0x1448d8,_0x51afba){_0x1448d8=_0x1448d8-0x0;var _0x108f1f=_0x59d0[_0x1448d8];return _0x108f1f;};'use strict';var _=require(_0x059d('0x0'));var util=require('util');var logger=require(_0x059d('0x1'))(_0x059d('0x2'));var moment=require('moment');var BPromise=require(_0x059d('0x3'));var rp=require(_0x059d('0x4'));var fs=require('fs');var path=require(_0x059d('0x5'));var rimraf=require(_0x059d('0x6'));var config=require(_0x059d('0x7'));var attributes=require('./cannedAnswer.attributes');module[_0x059d('0x8')]=function(_0x45943d,_0x364db8){return _0x45943d[_0x059d('0x9')]('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x059d('0xa'),'collate':_0x059d('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 1413831..b64c290 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(_0x2678f0,_0x444b62){var _0x5aec26=function(_0x19dbf7){while(--_0x19dbf7){_0x2678f0['push'](_0x2678f0['shift']());}};_0x5aec26(++_0x444b62);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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(_0x5bb0ed,_0x21ea31){var _0x541335=function(_0x29dce9){while(--_0x29dce9){_0x5bb0ed['push'](_0x5bb0ed['shift']());}};_0x541335(++_0x21ea31);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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 81565b7..6a913b8 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 _0x2157=['get','isAuthenticated','/:id','show','post','create','put','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller'];(function(_0x54f048,_0x474311){var _0x249fd8=function(_0x5bf786){while(--_0x5bf786){_0x54f048['push'](_0x54f048['shift']());}};_0x249fd8(++_0x474311);}(_0x2157,0x178));var _0x7215=function(_0x1bac98,_0x576397){_0x1bac98=_0x1bac98-0x0;var _0x2f6fff=_0x2157[_0x1bac98];return _0x2f6fff;};'use strict';var multer=require(_0x7215('0x0'));var util=require(_0x7215('0x1'));var path=require(_0x7215('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7215('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7215('0x4'));var interaction=require(_0x7215('0x5'));var config=require(_0x7215('0x6'));var controller=require(_0x7215('0x7'));router[_0x7215('0x8')]('/',auth[_0x7215('0x9')](),controller['index']);router[_0x7215('0x8')](_0x7215('0xa'),auth[_0x7215('0x9')](),controller[_0x7215('0xb')]);router[_0x7215('0xc')]('/',auth['isAuthenticated'](),controller[_0x7215('0xd')]);router[_0x7215('0xe')](_0x7215('0xa'),auth[_0x7215('0x9')](),controller['update']);router['delete'](_0x7215('0xa'),auth[_0x7215('0x9')](),controller['destroy']);module[_0x7215('0xf')]=router; \ No newline at end of file +var _0xb795=['./cannedAnswer.controller','get','index','isAuthenticated','show','put','/:id','update','destroy','multer','path','connect-timeout','express','fs-extra','../../config/environment'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xb795,0x180));var _0x5b79=function(_0x276c8d,_0x437fa6){_0x276c8d=_0x276c8d-0x0;var _0x51c99f=_0xb795[_0x276c8d];return _0x51c99f;};'use strict';var multer=require(_0x5b79('0x0'));var util=require('util');var path=require(_0x5b79('0x1'));var timeout=require(_0x5b79('0x2'));var express=require(_0x5b79('0x3'));var router=express['Router']();var fs_extra=require(_0x5b79('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5b79('0x5'));var controller=require(_0x5b79('0x6'));router[_0x5b79('0x7')]('/',auth['isAuthenticated'](),controller[_0x5b79('0x8')]);router['get']('/:id',auth[_0x5b79('0x9')](),controller[_0x5b79('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5b79('0xb')](_0x5b79('0xc'),auth[_0x5b79('0x9')](),controller[_0x5b79('0xd')]);router['delete'](_0x5b79('0xc'),auth[_0x5b79('0x9')](),controller[_0x5b79('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index e9bcb8e..7adc6be 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 _0xd6fd=['INTEGER','sequelize','exports','STRING'];(function(_0x5afe7b,_0x332fab){var _0x8253c7=function(_0x33bcd1){while(--_0x33bcd1){_0x5afe7b['push'](_0x5afe7b['shift']());}};_0x8253c7(++_0x332fab);}(_0xd6fd,0x7d));var _0xdd6f=function(_0x679fa1,_0x3614fa){_0x679fa1=_0x679fa1-0x0;var _0x3463b9=_0xd6fd[_0x679fa1];return _0x3463b9;};'use strict';var Sequelize=require(_0xdd6f('0x0'));module[_0xdd6f('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xdd6f('0x2')]},'dst':{'type':Sequelize[_0xdd6f('0x2')]},'dcontext':{'type':Sequelize[_0xdd6f('0x2')]},'channel':{'type':Sequelize[_0xdd6f('0x2')]},'dstchannel':{'type':Sequelize[_0xdd6f('0x2')]},'lastapp':{'type':Sequelize[_0xdd6f('0x2')]},'lastdata':{'type':Sequelize[_0xdd6f('0x2')]},'duration':{'type':Sequelize[_0xdd6f('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xdd6f('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xdd6f('0x2')]},'amaflags':{'type':Sequelize[_0xdd6f('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xdd6f('0x2')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xdd6f('0x2')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xdd6f('0x2')]},'type':{'type':Sequelize[_0xdd6f('0x2')]},'tag':{'type':Sequelize[_0xdd6f('0x2')]}}; \ No newline at end of file +var _0x1db3=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x58cc27,_0xc4c30b){var _0x40a3ec=function(_0xbb4c7c){while(--_0xbb4c7c){_0x58cc27['push'](_0x58cc27['shift']());}};_0x40a3ec(++_0xc4c30b);}(_0x1db3,0x1e5));var _0x31db=function(_0x163abc,_0x5ae42e){_0x163abc=_0x163abc-0x0;var _0x43ab13=_0x1db3[_0x163abc];return _0x43ab13;};'use strict';var Sequelize=require('sequelize');module[_0x31db('0x0')]={'calldate':{'type':Sequelize[_0x31db('0x1')],'allowNull':![],'defaultValue':_0x31db('0x2')},'clid':{'type':Sequelize[_0x31db('0x3')]},'src':{'type':Sequelize[_0x31db('0x3')]},'dst':{'type':Sequelize[_0x31db('0x3')]},'dcontext':{'type':Sequelize[_0x31db('0x3')]},'channel':{'type':Sequelize[_0x31db('0x3')]},'dstchannel':{'type':Sequelize[_0x31db('0x3')]},'lastapp':{'type':Sequelize[_0x31db('0x3')]},'lastdata':{'type':Sequelize[_0x31db('0x3')]},'duration':{'type':Sequelize[_0x31db('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x31db('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x31db('0x3')]},'amaflags':{'type':Sequelize[_0x31db('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x31db('0x3')]},'userfield':{'type':Sequelize[_0x31db('0x3')]},'uniqueid':{'type':Sequelize[_0x31db('0x3')]},'linkedid':{'type':Sequelize[_0x31db('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x31db('0x3')]},'type':{'type':Sequelize[_0x31db('0x3')]},'tag':{'type':Sequelize[_0x31db('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index ec8d3af..2538496 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 _0x0618=['catch','show','intersection','options','create','body','update','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','end','stack','name','send','map','Cdr','rawAttributes','fieldName','type','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','then','rows'];(function(_0x409d51,_0x1f0de6){var _0x13eb4b=function(_0x374388){while(--_0x374388){_0x409d51['push'](_0x409d51['shift']());}};_0x13eb4b(++_0x1f0de6);}(_0x0618,0x1c6));var _0x8061=function(_0x56c445,_0x3b5b87){_0x56c445=_0x56c445-0x0;var _0x5d729a=_0x0618[_0x56c445];return _0x5d729a;};'use strict';var emlformat=require(_0x8061('0x0'));var rimraf=require(_0x8061('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8061('0x2'));var rp=require(_0x8061('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8061('0x4'));var util=require(_0x8061('0x5'));var path=require(_0x8061('0x6'));var sox=require(_0x8061('0x7'));var csv=require(_0x8061('0x8'));var ejs=require(_0x8061('0x9'));var fs=require('fs');var fs_extra=require(_0x8061('0xa'));var _=require(_0x8061('0xb'));var squel=require(_0x8061('0xc'));var crypto=require(_0x8061('0xd'));var jsforce=require(_0x8061('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8061('0x8'));var querystring=require('querystring');var Papa=require(_0x8061('0xf'));var Redis=require(_0x8061('0x10'));var authService=require(_0x8061('0x11'));var qs=require(_0x8061('0x12'));var as=require(_0x8061('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_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(_0x141707,_0x724e64){_0x724e64=_0x724e64||0xcc;return function(_0x3537f0){if(_0x3537f0){return _0x141707[_0x8061('0x17')](_0x724e64);}return _0x141707[_0x8061('0x18')](_0x724e64)['end']();};}function respondWithResult(_0x4df59c,_0x19ea89){_0x19ea89=_0x19ea89||0xc8;return function(_0x4da339){if(_0x4da339){return _0x4df59c[_0x8061('0x18')](_0x19ea89)[_0x8061('0x19')](_0x4da339);}};}function respondWithFilteredResult(_0x567988,_0x483af8){return function(_0x460dfd){if(_0x460dfd){var _0x3264ff=typeof _0x483af8[_0x8061('0x1a')]===_0x8061('0x1b')&&typeof _0x483af8[_0x8061('0x1c')]===_0x8061('0x1b');var _0x280f9b=_0x460dfd[_0x8061('0x1d')];var _0x2b0eab=_0x3264ff?0x0:_0x483af8[_0x8061('0x1a')];var _0x14230e=_0x3264ff?_0x460dfd[_0x8061('0x1d')]:_0x483af8[_0x8061('0x1a')]+_0x483af8['limit'];var _0x4d254d;if(_0x14230e>=_0x280f9b){_0x14230e=_0x280f9b;_0x4d254d=0xc8;}else{_0x4d254d=0xce;}_0x567988[_0x8061('0x18')](_0x4d254d);return _0x567988[_0x8061('0x1e')](_0x8061('0x1f'),_0x2b0eab+'-'+_0x14230e+'/'+_0x280f9b)['json'](_0x460dfd);}return null;};}function patchUpdates(_0x53f869){return function(_0x36ccd5){try{jsonpatch[_0x8061('0x20')](_0x36ccd5,_0x53f869,!![]);}catch(_0x2bc509){return BPromise[_0x8061('0x21')](_0x2bc509);}return _0x36ccd5['save']();};}function saveUpdates(_0x49f708,_0x1cd5ed){return function(_0x12e73d){if(_0x12e73d){return _0x12e73d['update'](_0x49f708)['then'](function(_0x3dbaea){return _0x3dbaea;});}return null;};}function removeEntity(_0x554faa,_0x535cc9){return function(_0x37bff0){if(_0x37bff0){return _0x37bff0[_0x8061('0x22')]()['then'](function(){_0x554faa['status'](0xcc)[_0x8061('0x23')]();});}};}function handleEntityNotFound(_0x3f2765,_0x4e0860){return function(_0x1b0ec7){if(!_0x1b0ec7){_0x3f2765[_0x8061('0x17')](0x194);}return _0x1b0ec7;};}function handleError(_0x39fb5c,_0x2f7544){_0x2f7544=_0x2f7544||0x1f4;return function(_0x5f0822){logger['error'](_0x5f0822[_0x8061('0x24')]);if(_0x5f0822[_0x8061('0x25')]){delete _0x5f0822[_0x8061('0x25')];}_0x39fb5c[_0x8061('0x18')](_0x2f7544)[_0x8061('0x26')](_0x5f0822);};}exports['index']=function(_0x4c9202,_0x518700){var _0x59a65d={},_0xfb9138={},_0x38317c={'count':0x0,'rows':[]};var _0x36714f=_[_0x8061('0x27')](db[_0x8061('0x28')][_0x8061('0x29')],function(_0x2d1537){return{'name':_0x2d1537[_0x8061('0x2a')],'type':_0x2d1537[_0x8061('0x2b')][_0x8061('0x2c')]};});_0xfb9138['model']=_['map'](_0x36714f,_0x8061('0x25'));_0xfb9138[_0x8061('0x2d')]=_[_0x8061('0x2e')](_0x4c9202[_0x8061('0x2d')]);_0xfb9138[_0x8061('0x2f')]=_['intersection'](_0xfb9138[_0x8061('0x30')],_0xfb9138[_0x8061('0x2d')]);_0x59a65d['attributes']=_['intersection'](_0xfb9138[_0x8061('0x30')],qs[_0x8061('0x31')](_0x4c9202['query'][_0x8061('0x31')]));_0x59a65d[_0x8061('0x32')]=_0x59a65d[_0x8061('0x32')][_0x8061('0x33')]?_0x59a65d[_0x8061('0x32')]:_0xfb9138[_0x8061('0x30')];if(!_0x4c9202[_0x8061('0x2d')][_0x8061('0x34')](_0x8061('0x35'))){_0x59a65d['limit']=qs[_0x8061('0x1c')](_0x4c9202[_0x8061('0x2d')][_0x8061('0x1c')]);_0x59a65d[_0x8061('0x1a')]=qs['offset'](_0x4c9202['query']['offset']);}_0x59a65d['order']=qs['sort'](_0x4c9202[_0x8061('0x2d')]['sort']);_0x59a65d[_0x8061('0x36')]=qs[_0x8061('0x2f')](_[_0x8061('0x37')](_0x4c9202[_0x8061('0x2d')],_0xfb9138[_0x8061('0x2f')]),_0x36714f);if(_0x4c9202['query'][_0x8061('0x38')]){_0x59a65d[_0x8061('0x36')]=_[_0x8061('0x39')](_0x59a65d[_0x8061('0x36')],{'$or':_[_0x8061('0x27')](_0x36714f,function(_0x31ed9d){if(_0x31ed9d[_0x8061('0x2b')]!==_0x8061('0x3a')){var _0x714833={};_0x714833[_0x31ed9d[_0x8061('0x25')]]={'$like':'%'+_0x4c9202[_0x8061('0x2d')][_0x8061('0x38')]+'%'};return _0x714833;}})});}_0x59a65d=_['merge']({},_0x59a65d,_0x4c9202['options']);var _0xb72481={'where':_0x59a65d['where']};return db[_0x8061('0x28')]['count'](_0xb72481)['then'](function(_0x105747){_0x38317c[_0x8061('0x1d')]=_0x105747;if(_0x4c9202[_0x8061('0x2d')][_0x8061('0x3b')]){_0x59a65d[_0x8061('0x3c')]=[{'all':!![]}];}return db[_0x8061('0x28')][_0x8061('0x3d')](_0x59a65d);})[_0x8061('0x3e')](function(_0x1475b1){_0x38317c[_0x8061('0x3f')]=_0x1475b1;return _0x38317c;})['then'](respondWithFilteredResult(_0x518700,_0x59a65d))[_0x8061('0x40')](handleError(_0x518700,null));};exports[_0x8061('0x41')]=function(_0x177ab1,_0x2675e3){var _0x4435b8={'raw':!![],'where':{'id':_0x177ab1['params']['id']}},_0x4ea342={};_0x4ea342[_0x8061('0x30')]=_[_0x8061('0x2e')](db[_0x8061('0x28')][_0x8061('0x29')]);_0x4ea342[_0x8061('0x2d')]=_[_0x8061('0x2e')](_0x177ab1[_0x8061('0x2d')]);_0x4ea342['filters']=_[_0x8061('0x42')](_0x4ea342[_0x8061('0x30')],_0x4ea342[_0x8061('0x2d')]);_0x4435b8[_0x8061('0x32')]=_[_0x8061('0x42')](_0x4ea342[_0x8061('0x30')],qs[_0x8061('0x31')](_0x177ab1['query'][_0x8061('0x31')]));_0x4435b8['attributes']=_0x4435b8[_0x8061('0x32')][_0x8061('0x33')]?_0x4435b8[_0x8061('0x32')]:_0x4ea342['model'];if(_0x177ab1['query'][_0x8061('0x3b')]){_0x4435b8[_0x8061('0x3c')]=[{'all':!![]}];}_0x4435b8=_[_0x8061('0x39')]({},_0x4435b8,_0x177ab1[_0x8061('0x43')]);return db[_0x8061('0x28')]['find'](_0x4435b8)['then'](handleEntityNotFound(_0x2675e3,null))[_0x8061('0x3e')](respondWithResult(_0x2675e3,null))['catch'](handleError(_0x2675e3,null));};exports[_0x8061('0x44')]=function(_0x393bc9,_0x54546a){return db[_0x8061('0x28')][_0x8061('0x44')](_0x393bc9[_0x8061('0x45')],{})[_0x8061('0x3e')](respondWithResult(_0x54546a,0xc9))['catch'](handleError(_0x54546a,null));};exports[_0x8061('0x46')]=function(_0xb1cc9d,_0x2eaab6){if(_0xb1cc9d[_0x8061('0x45')]['id']){delete _0xb1cc9d[_0x8061('0x45')]['id'];}return db[_0x8061('0x28')][_0x8061('0x47')]({'where':{'id':_0xb1cc9d[_0x8061('0x48')]['id']}})[_0x8061('0x3e')](handleEntityNotFound(_0x2eaab6,null))[_0x8061('0x3e')](saveUpdates(_0xb1cc9d[_0x8061('0x45')],null))[_0x8061('0x3e')](respondWithResult(_0x2eaab6,null))[_0x8061('0x40')](handleError(_0x2eaab6,null));};exports[_0x8061('0x22')]=function(_0x291c8b,_0x30771f){return db[_0x8061('0x28')]['find']({'where':{'id':_0x291c8b[_0x8061('0x48')]['id']}})[_0x8061('0x3e')](handleEntityNotFound(_0x30771f,null))[_0x8061('0x3e')](removeEntity(_0x30771f,null))[_0x8061('0x40')](handleError(_0x30771f,null));};exports['describe']=function(_0x2be970,_0xd63f0e){return db[_0x8061('0x28')][_0x8061('0x49')]()[_0x8061('0x3e')](respondWithResult(_0xd63f0e,null))[_0x8061('0x40')](handleError(_0xd63f0e,null));}; \ No newline at end of file +var _0x7bae=['hasOwnProperty','order','sort','where','filter','type','merge','options','includeAll','include','catch','show','params','keys','find','create','body','destroy','describe','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','Cdr','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x7bae,0x13b));var _0xe7ba=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x7bae[_0x3de8a4];return _0x4635cf;};'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')]=_['map'](_0x587c7d,_0xe7ba('0x29'));_0x369451['query']=_['keys'](_0x48c869[_0xe7ba('0x31')]);_0x369451[_0xe7ba('0x32')]=_[_0xe7ba('0x33')](_0x369451['model'],_0x369451[_0xe7ba('0x31')]);_0x92fe7['attributes']=_[_0xe7ba('0x33')](_0x369451[_0xe7ba('0x30')],qs[_0xe7ba('0x34')](_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x34')]));_0x92fe7['attributes']=_0x92fe7[_0xe7ba('0x35')][_0xe7ba('0x36')]?_0x92fe7['attributes']:_0x369451[_0xe7ba('0x30')];if(!_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x37')]('nolimit')){_0x92fe7[_0xe7ba('0x1e')]=qs[_0xe7ba('0x1e')](_0x48c869['query'][_0xe7ba('0x1e')]);_0x92fe7[_0xe7ba('0x20')]=qs[_0xe7ba('0x20')](_0x48c869['query'][_0xe7ba('0x20')]);}_0x92fe7[_0xe7ba('0x38')]=qs['sort'](_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x39')]);_0x92fe7[_0xe7ba('0x3a')]=qs['filters'](_['pick'](_0x48c869[_0xe7ba('0x31')],_0x369451[_0xe7ba('0x32')]),_0x587c7d);if(_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x3b')]){_0x92fe7[_0xe7ba('0x3a')]=_['merge'](_0x92fe7[_0xe7ba('0x3a')],{'$or':_[_0xe7ba('0x2b')](_0x587c7d,function(_0x3139a6){if(_0x3139a6[_0xe7ba('0x3c')]!=='VIRTUAL'){var _0xe67917={};_0xe67917[_0x3139a6[_0xe7ba('0x29')]]={'$like':'%'+_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x3b')]+'%'};return _0xe67917;}})});}_0x92fe7=_[_0xe7ba('0x3d')]({},_0x92fe7,_0x48c869[_0xe7ba('0x3e')]);var _0x124cc4={'where':_0x92fe7['where']};return db[_0xe7ba('0x2c')][_0xe7ba('0x1f')](_0x124cc4)[_0xe7ba('0x26')](function(_0x401b0a){_0x4bf5f9[_0xe7ba('0x1f')]=_0x401b0a;if(_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x3f')]){_0x92fe7[_0xe7ba('0x40')]=[{'all':!![]}];}return db[_0xe7ba('0x2c')]['findAll'](_0x92fe7);})[_0xe7ba('0x26')](function(_0x417734){_0x4bf5f9['rows']=_0x417734;return _0x4bf5f9;})['then'](respondWithFilteredResult(_0x102925,_0x92fe7))[_0xe7ba('0x41')](handleError(_0x102925,null));};exports[_0xe7ba('0x42')]=function(_0x368af2,_0x5589c4){var _0x249e1d={'raw':!![],'where':{'id':_0x368af2[_0xe7ba('0x43')]['id']}},_0x82246e={};_0x82246e[_0xe7ba('0x30')]=_[_0xe7ba('0x44')](db['Cdr'][_0xe7ba('0x2d')]);_0x82246e['query']=_[_0xe7ba('0x44')](_0x368af2[_0xe7ba('0x31')]);_0x82246e[_0xe7ba('0x32')]=_[_0xe7ba('0x33')](_0x82246e[_0xe7ba('0x30')],_0x82246e[_0xe7ba('0x31')]);_0x249e1d[_0xe7ba('0x35')]=_[_0xe7ba('0x33')](_0x82246e['model'],qs[_0xe7ba('0x34')](_0x368af2[_0xe7ba('0x31')][_0xe7ba('0x34')]));_0x249e1d[_0xe7ba('0x35')]=_0x249e1d[_0xe7ba('0x35')][_0xe7ba('0x36')]?_0x249e1d[_0xe7ba('0x35')]:_0x82246e[_0xe7ba('0x30')];if(_0x368af2[_0xe7ba('0x31')][_0xe7ba('0x3f')]){_0x249e1d['include']=[{'all':!![]}];}_0x249e1d=_[_0xe7ba('0x3d')]({},_0x249e1d,_0x368af2['options']);return db[_0xe7ba('0x2c')][_0xe7ba('0x45')](_0x249e1d)[_0xe7ba('0x26')](handleEntityNotFound(_0x5589c4,null))[_0xe7ba('0x26')](respondWithResult(_0x5589c4,null))[_0xe7ba('0x41')](handleError(_0x5589c4,null));};exports[_0xe7ba('0x46')]=function(_0x48ae57,_0x271592){return db[_0xe7ba('0x2c')][_0xe7ba('0x46')](_0x48ae57[_0xe7ba('0x47')],{})[_0xe7ba('0x26')](respondWithResult(_0x271592,0xc9))[_0xe7ba('0x41')](handleError(_0x271592,null));};exports[_0xe7ba('0x25')]=function(_0x266ace,_0x272cb9){if(_0x266ace[_0xe7ba('0x47')]['id']){delete _0x266ace[_0xe7ba('0x47')]['id'];}return db['Cdr'][_0xe7ba('0x45')]({'where':{'id':_0x266ace[_0xe7ba('0x43')]['id']}})[_0xe7ba('0x26')](handleEntityNotFound(_0x272cb9,null))[_0xe7ba('0x26')](saveUpdates(_0x266ace[_0xe7ba('0x47')],null))[_0xe7ba('0x26')](respondWithResult(_0x272cb9,null))['catch'](handleError(_0x272cb9,null));};exports[_0xe7ba('0x48')]=function(_0x3ee828,_0x520477){return db[_0xe7ba('0x2c')][_0xe7ba('0x45')]({'where':{'id':_0x3ee828[_0xe7ba('0x43')]['id']}})[_0xe7ba('0x26')](handleEntityNotFound(_0x520477,null))['then'](removeEntity(_0x520477,null))['catch'](handleError(_0x520477,null));};exports[_0xe7ba('0x49')]=function(_0x2cfdc3,_0x285743){return db['Cdr'][_0xe7ba('0x49')]()[_0xe7ba('0x26')](respondWithResult(_0x285743,null))[_0xe7ba('0x41')](handleError(_0x285743,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 3be4d14..2c81da1 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x1635b5,_0x20dc22){var _0x485909=function(_0x527083){while(--_0x527083){_0x1635b5['push'](_0x1635b5['shift']());}};_0x485909(++_0x20dc22);}(_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 logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0xd9154f,_0xc8881d){var _0x865cd8=function(_0x296469){while(--_0x296469){_0xd9154f['push'](_0xd9154f['shift']());}};_0x865cd8(++_0xc8881d);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index b6b2935..cbf7b0e 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 _0x6fed=['error','code','message','info','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x46225a,_0x326973){var _0x2d2f1e=function(_0x3e95a9){while(--_0x3e95a9){_0x46225a['push'](_0x46225a['shift']());}};_0x2d2f1e(++_0x326973);}(_0x6fed,0xee));var _0xd6fe=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x6fed[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xd6fe('0x0'));var util=require(_0xd6fe('0x1'));var moment=require(_0xd6fe('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd6fe('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd6fe('0x4'));var logger=require(_0xd6fe('0x5'))(_0xd6fe('0x6'));var config=require(_0xd6fe('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd6fe('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f9d4b,_0x1cc761,_0x4a0bc8){return new BPromise(function(_0x2a62c3,_0x8d8fde){return client['request'](_0x1f9d4b,_0x4a0bc8)[_0xd6fe('0x9')](function(_0x48462f){logger['info'](_0xd6fe('0xa'),_0x1cc761,_0xd6fe('0xb'));logger['debug'](_0xd6fe('0xc'),_0x1cc761,'request\x20sent',JSON[_0xd6fe('0xd')](_0x48462f));if(_0x48462f[_0xd6fe('0xe')]){if(_0x48462f[_0xd6fe('0xe')][_0xd6fe('0xf')]===0x1f4){logger[_0xd6fe('0xe')]('Cdr,\x20%s,\x20%s',_0x1cc761,_0x48462f[_0xd6fe('0xe')][_0xd6fe('0x10')]);return _0x8d8fde(_0x48462f[_0xd6fe('0xe')][_0xd6fe('0x10')]);}logger['error'](_0xd6fe('0xa'),_0x1cc761,_0x48462f[_0xd6fe('0xe')][_0xd6fe('0x10')]);return _0x2a62c3(_0x48462f[_0xd6fe('0xe')][_0xd6fe('0x10')]);}else{logger[_0xd6fe('0x11')](_0xd6fe('0xa'),_0x1cc761,_0xd6fe('0xb'));_0x2a62c3(_0x48462f['result'][_0xd6fe('0x10')]);}})['catch'](function(_0x4e1d3a){logger[_0xd6fe('0xe')](_0xd6fe('0xa'),_0x1cc761,_0x4e1d3a);_0x8d8fde(_0x4e1d3a);});});} \ No newline at end of file +var _0x170b=['stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s'];(function(_0x54c33a,_0x17ad4e){var _0x2590fa=function(_0x8a1afb){while(--_0x8a1afb){_0x54c33a['push'](_0x54c33a['shift']());}};_0x2590fa(++_0x17ad4e);}(_0x170b,0x1e2));var _0xb170=function(_0x26ea61,_0x1b983c){_0x26ea61=_0x26ea61-0x0;var _0x1b89c4=_0x170b[_0x26ea61];return _0x1b89c4;};'use strict';var _=require(_0xb170('0x0'));var util=require(_0xb170('0x1'));var moment=require(_0xb170('0x2'));var BPromise=require(_0xb170('0x3'));var rs=require(_0xb170('0x4'));var fs=require('fs');var Redis=require(_0xb170('0x5'));var db=require(_0xb170('0x6'))['db'];var utils=require(_0xb170('0x7'));var logger=require(_0xb170('0x8'))(_0xb170('0x9'));var config=require(_0xb170('0xa'));var jayson=require(_0xb170('0xb'));var client=jayson[_0xb170('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f1f75,_0x2dc437,_0x1672fc){return new BPromise(function(_0x3e5362,_0x5a2573){return client['request'](_0x2f1f75,_0x1672fc)[_0xb170('0xd')](function(_0x196327){logger['info'](_0xb170('0xe'),_0x2dc437,_0xb170('0xf'));logger[_0xb170('0x10')](_0xb170('0x11'),_0x2dc437,_0xb170('0xf'),JSON[_0xb170('0x12')](_0x196327));if(_0x196327[_0xb170('0x13')]){if(_0x196327[_0xb170('0x13')][_0xb170('0x14')]===0x1f4){logger[_0xb170('0x13')](_0xb170('0xe'),_0x2dc437,_0x196327[_0xb170('0x13')][_0xb170('0x15')]);return _0x5a2573(_0x196327[_0xb170('0x13')]['message']);}logger['error'](_0xb170('0xe'),_0x2dc437,_0x196327[_0xb170('0x13')][_0xb170('0x15')]);return _0x3e5362(_0x196327['error'][_0xb170('0x15')]);}else{logger[_0xb170('0x16')](_0xb170('0xe'),_0x2dc437,_0xb170('0xf'));_0x3e5362(_0x196327[_0xb170('0x17')][_0xb170('0x15')]);}})[_0xb170('0x18')](function(_0x1041d4){logger[_0xb170('0x13')](_0xb170('0xe'),_0x2dc437,_0x1041d4);_0x5a2573(_0x1041d4);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 9e09fad..dc30edb 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x3776b4,_0x19a1e3){var _0x1636d9=function(_0x320ae3){while(--_0x320ae3){_0x3776b4['push'](_0x3776b4['shift']());}};_0x1636d9(++_0x19a1e3);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x4fde9a,_0x5d1eda){var _0x58f321=function(_0x278061){while(--_0x278061){_0x4fde9a['push'](_0x4fde9a['shift']());}};_0x58f321(++_0x5d1eda);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index a293f4d..0077574 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 _0x7b95=['INTEGER','STRING','noop','TEXT','sequelize','exports'];(function(_0xa3df8a,_0x537752){var _0x5b1996=function(_0x2e974d){while(--_0x2e974d){_0xa3df8a['push'](_0xa3df8a['shift']());}};_0x5b1996(++_0x537752);}(_0x7b95,0x112));var _0x57b9=function(_0x38e66c,_0x385b54){_0x38e66c=_0x38e66c-0x0;var _0x1efa7c=_0x7b95[_0x38e66c];return _0x1efa7c;};'use strict';var Sequelize=require(_0x57b9('0x0'));module[_0x57b9('0x1')]={'priority':{'type':Sequelize[_0x57b9('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x57b9('0x3')],'allowNull':![],'defaultValue':_0x57b9('0x4')},'appdata':{'type':Sequelize[_0x57b9('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x57b9('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xa7e0=['sequelize','STRING','noop'];(function(_0x27c8f3,_0x35f6e8){var _0x4b8d62=function(_0x2261ef){while(--_0x2261ef){_0x27c8f3['push'](_0x27c8f3['shift']());}};_0x4b8d62(++_0x35f6e8);}(_0xa7e0,0x1e0));var _0x0a7e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa7e0[_0x30ae5e];return _0x1f2e93;};'use strict';var Sequelize=require(_0x0a7e('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0a7e('0x1')],'allowNull':![],'defaultValue':_0x0a7e('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x0a7e('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 1089f38..56ca651 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 _0xfbac=['length','includeAll','include','merge','options','ChatApplication','find','then','body','catch','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','fs-extra','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','status','end','json','offset','undefined','count','limit','apply','reject','update','error','stack','name','send','show','model','rawAttributes','keys','filters','intersection','query','attributes','fields'];(function(_0x41f332,_0x1e0373){var _0x489bef=function(_0x1195e0){while(--_0x1195e0){_0x41f332['push'](_0x41f332['shift']());}};_0x489bef(++_0x1e0373);}(_0xfbac,0x167));var _0xcfba=function(_0x3835fa,_0x55a48e){_0x3835fa=_0x3835fa-0x0;var _0x41d64c=_0xfbac[_0x3835fa];return _0x41d64c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcfba('0x0'));var zipdir=require(_0xcfba('0x1'));var jsonpatch=require(_0xcfba('0x2'));var rp=require(_0xcfba('0x3'));var moment=require(_0xcfba('0x4'));var BPromise=require(_0xcfba('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xcfba('0x6'));var sox=require(_0xcfba('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcfba('0x8'));var _=require('lodash');var squel=require(_0xcfba('0x9'));var crypto=require('crypto');var jsforce=require(_0xcfba('0xa'));var deskjs=require(_0xcfba('0xb'));var toCsv=require('to-csv');var querystring=require(_0xcfba('0xc'));var Papa=require(_0xcfba('0xd'));var Redis=require(_0xcfba('0xe'));var authService=require(_0xcfba('0xf'));var qs=require(_0xcfba('0x10'));var as=require(_0xcfba('0x11'));var hardwareService=require(_0xcfba('0x12'));var logger=require(_0xcfba('0x13'))(_0xcfba('0x14'));var utils=require(_0xcfba('0x15'));var config=require(_0xcfba('0x16'));var licenseUtil=require(_0xcfba('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48d6f1,_0x1f590b){_0x1f590b=_0x1f590b||0xcc;return function(_0x24168c){if(_0x24168c){return _0x48d6f1['sendStatus'](_0x1f590b);}return _0x48d6f1[_0xcfba('0x18')](_0x1f590b)[_0xcfba('0x19')]();};}function respondWithResult(_0x335bfd,_0x226e89){_0x226e89=_0x226e89||0xc8;return function(_0x2333ee){if(_0x2333ee){return _0x335bfd[_0xcfba('0x18')](_0x226e89)[_0xcfba('0x1a')](_0x2333ee);}};}function respondWithFilteredResult(_0xa0508d,_0x2f497b){return function(_0x18d1d6){if(_0x18d1d6){var _0x231192=typeof _0x2f497b[_0xcfba('0x1b')]===_0xcfba('0x1c')&&typeof _0x2f497b['limit']===_0xcfba('0x1c');var _0x1d7be2=_0x18d1d6[_0xcfba('0x1d')];var _0x30c319=_0x231192?0x0:_0x2f497b[_0xcfba('0x1b')];var _0x778955=_0x231192?_0x18d1d6[_0xcfba('0x1d')]:_0x2f497b['offset']+_0x2f497b[_0xcfba('0x1e')];var _0x35c1e4;if(_0x778955>=_0x1d7be2){_0x778955=_0x1d7be2;_0x35c1e4=0xc8;}else{_0x35c1e4=0xce;}_0xa0508d[_0xcfba('0x18')](_0x35c1e4);return _0xa0508d['set']('Content-Range',_0x30c319+'-'+_0x778955+'/'+_0x1d7be2)[_0xcfba('0x1a')](_0x18d1d6);}return null;};}function patchUpdates(_0x43b745){return function(_0x40a0df){try{jsonpatch[_0xcfba('0x1f')](_0x40a0df,_0x43b745,!![]);}catch(_0x358610){return BPromise[_0xcfba('0x20')](_0x358610);}return _0x40a0df['save']();};}function saveUpdates(_0x1d4d83,_0x5d4c92){return function(_0x286d20){if(_0x286d20){return _0x286d20[_0xcfba('0x21')](_0x1d4d83)['then'](function(_0x25e9ea){return _0x25e9ea;});}return null;};}function removeEntity(_0x42cf58,_0x14850f){return function(_0x3fb061){if(_0x3fb061){return _0x3fb061['destroy']()['then'](function(){_0x42cf58[_0xcfba('0x18')](0xcc)[_0xcfba('0x19')]();});}};}function handleEntityNotFound(_0x200a77,_0x4c9098){return function(_0x1f01a7){if(!_0x1f01a7){_0x200a77['sendStatus'](0x194);}return _0x1f01a7;};}function handleError(_0x3eb614,_0x5e79c7){_0x5e79c7=_0x5e79c7||0x1f4;return function(_0x4ee825){logger[_0xcfba('0x22')](_0x4ee825[_0xcfba('0x23')]);if(_0x4ee825['name']){delete _0x4ee825[_0xcfba('0x24')];}_0x3eb614[_0xcfba('0x18')](_0x5e79c7)[_0xcfba('0x25')](_0x4ee825);};}exports[_0xcfba('0x26')]=function(_0xae6518,_0x1c3343){var _0x2ee85c={'raw':!![],'where':{'id':_0xae6518['params']['id']}},_0x4585ec={};_0x4585ec[_0xcfba('0x27')]=_['keys'](db['ChatApplication'][_0xcfba('0x28')]);_0x4585ec['query']=_[_0xcfba('0x29')](_0xae6518['query']);_0x4585ec[_0xcfba('0x2a')]=_[_0xcfba('0x2b')](_0x4585ec[_0xcfba('0x27')],_0x4585ec[_0xcfba('0x2c')]);_0x2ee85c[_0xcfba('0x2d')]=_[_0xcfba('0x2b')](_0x4585ec[_0xcfba('0x27')],qs[_0xcfba('0x2e')](_0xae6518['query']['fields']));_0x2ee85c['attributes']=_0x2ee85c[_0xcfba('0x2d')][_0xcfba('0x2f')]?_0x2ee85c['attributes']:_0x4585ec[_0xcfba('0x27')];if(_0xae6518['query'][_0xcfba('0x30')]){_0x2ee85c[_0xcfba('0x31')]=[{'all':!![]}];}_0x2ee85c=_[_0xcfba('0x32')]({},_0x2ee85c,_0xae6518[_0xcfba('0x33')]);return db[_0xcfba('0x34')][_0xcfba('0x35')](_0x2ee85c)[_0xcfba('0x36')](handleEntityNotFound(_0x1c3343,null))[_0xcfba('0x36')](respondWithResult(_0x1c3343,null))['catch'](handleError(_0x1c3343,null));};exports[_0xcfba('0x21')]=function(_0x1d23ea,_0x2d0085){if(_0x1d23ea[_0xcfba('0x37')]['id']){delete _0x1d23ea[_0xcfba('0x37')]['id'];}return db[_0xcfba('0x34')][_0xcfba('0x35')]({'where':{'id':_0x1d23ea['params']['id']}})[_0xcfba('0x36')](handleEntityNotFound(_0x2d0085,null))[_0xcfba('0x36')](saveUpdates(_0x1d23ea[_0xcfba('0x37')],null))[_0xcfba('0x36')](respondWithResult(_0x2d0085,null))[_0xcfba('0x38')](handleError(_0x2d0085,null));};exports['destroy']=function(_0x4d94df,_0x62fc63){return db[_0xcfba('0x34')][_0xcfba('0x35')]({'where':{'id':_0x4d94df[_0xcfba('0x39')]['id']}})['then'](handleEntityNotFound(_0x62fc63,null))[_0xcfba('0x36')](removeEntity(_0x62fc63,null))[_0xcfba('0x38')](handleError(_0x62fc63,null));}; \ No newline at end of file +var _0x0d74=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','save','update','then','destroy','error','stack','name','show','params','model','ChatApplication','rawAttributes','query','keys','intersection','attributes','fields','includeAll','include','merge','options','find','catch','body','eml-format','rimraf','request-promise','moment','util','path','sox','to-csv','squel','jsforce'];(function(_0x5bf79a,_0x2eaa1d){var _0x3ff10f=function(_0x48523){while(--_0x48523){_0x5bf79a['push'](_0x5bf79a['shift']());}};_0x3ff10f(++_0x2eaa1d);}(_0x0d74,0x146));var _0x40d7=function(_0x9f8eea,_0x4bcf8b){_0x9f8eea=_0x9f8eea-0x0;var _0x3b08b3=_0x0d74[_0x9f8eea];return _0x3b08b3;};'use strict';var emlformat=require(_0x40d7('0x0'));var rimraf=require(_0x40d7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x40d7('0x2'));var moment=require(_0x40d7('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x40d7('0x4'));var path=require(_0x40d7('0x5'));var sox=require(_0x40d7('0x6'));var csv=require(_0x40d7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x40d7('0x8'));var crypto=require('crypto');var jsforce=require(_0x40d7('0x9'));var deskjs=require(_0x40d7('0xa'));var toCsv=require('to-csv');var querystring=require(_0x40d7('0xb'));var Papa=require(_0x40d7('0xc'));var Redis=require(_0x40d7('0xd'));var authService=require(_0x40d7('0xe'));var qs=require(_0x40d7('0xf'));var as=require(_0x40d7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x40d7('0x11'))(_0x40d7('0x12'));var utils=require(_0x40d7('0x13'));var config=require(_0x40d7('0x14'));var licenseUtil=require(_0x40d7('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43f1d8,_0xa08fd6){_0xa08fd6=_0xa08fd6||0xcc;return function(_0x3723a4){if(_0x3723a4){return _0x43f1d8[_0x40d7('0x16')](_0xa08fd6);}return _0x43f1d8['status'](_0xa08fd6)[_0x40d7('0x17')]();};}function respondWithResult(_0x4cb402,_0x14c12b){_0x14c12b=_0x14c12b||0xc8;return function(_0x2acc5b){if(_0x2acc5b){return _0x4cb402[_0x40d7('0x18')](_0x14c12b)[_0x40d7('0x19')](_0x2acc5b);}};}function respondWithFilteredResult(_0x1acc2f,_0x67d691){return function(_0x473fea){if(_0x473fea){var _0x55a7e0=typeof _0x67d691['offset']==='undefined'&&typeof _0x67d691[_0x40d7('0x1a')]===_0x40d7('0x1b');var _0x486d75=_0x473fea['count'];var _0x120964=_0x55a7e0?0x0:_0x67d691['offset'];var _0x4ed97e=_0x55a7e0?_0x473fea[_0x40d7('0x1c')]:_0x67d691[_0x40d7('0x1d')]+_0x67d691[_0x40d7('0x1a')];var _0x44fa91;if(_0x4ed97e>=_0x486d75){_0x4ed97e=_0x486d75;_0x44fa91=0xc8;}else{_0x44fa91=0xce;}_0x1acc2f[_0x40d7('0x18')](_0x44fa91);return _0x1acc2f[_0x40d7('0x1e')](_0x40d7('0x1f'),_0x120964+'-'+_0x4ed97e+'/'+_0x486d75)[_0x40d7('0x19')](_0x473fea);}return null;};}function patchUpdates(_0x5eb3c1){return function(_0x4c47cf){try{jsonpatch['apply'](_0x4c47cf,_0x5eb3c1,!![]);}catch(_0x34ea1d){return BPromise['reject'](_0x34ea1d);}return _0x4c47cf[_0x40d7('0x20')]();};}function saveUpdates(_0x145422,_0x985914){return function(_0x1a441a){if(_0x1a441a){return _0x1a441a[_0x40d7('0x21')](_0x145422)[_0x40d7('0x22')](function(_0xfec685){return _0xfec685;});}return null;};}function removeEntity(_0x3ccae9,_0x51180d){return function(_0x1cb3b2){if(_0x1cb3b2){return _0x1cb3b2[_0x40d7('0x23')]()['then'](function(){_0x3ccae9[_0x40d7('0x18')](0xcc)[_0x40d7('0x17')]();});}};}function handleEntityNotFound(_0x38276c,_0x29c62b){return function(_0x528ab5){if(!_0x528ab5){_0x38276c['sendStatus'](0x194);}return _0x528ab5;};}function handleError(_0x4889df,_0x4e7d84){_0x4e7d84=_0x4e7d84||0x1f4;return function(_0x539985){logger[_0x40d7('0x24')](_0x539985[_0x40d7('0x25')]);if(_0x539985[_0x40d7('0x26')]){delete _0x539985[_0x40d7('0x26')];}_0x4889df['status'](_0x4e7d84)['send'](_0x539985);};}exports[_0x40d7('0x27')]=function(_0x2b5f11,_0x4503cc){var _0x532ed5={'raw':!![],'where':{'id':_0x2b5f11[_0x40d7('0x28')]['id']}},_0x4fdf53={};_0x4fdf53[_0x40d7('0x29')]=_['keys'](db[_0x40d7('0x2a')][_0x40d7('0x2b')]);_0x4fdf53[_0x40d7('0x2c')]=_[_0x40d7('0x2d')](_0x2b5f11['query']);_0x4fdf53['filters']=_[_0x40d7('0x2e')](_0x4fdf53[_0x40d7('0x29')],_0x4fdf53[_0x40d7('0x2c')]);_0x532ed5[_0x40d7('0x2f')]=_[_0x40d7('0x2e')](_0x4fdf53[_0x40d7('0x29')],qs[_0x40d7('0x30')](_0x2b5f11['query'][_0x40d7('0x30')]));_0x532ed5[_0x40d7('0x2f')]=_0x532ed5[_0x40d7('0x2f')]['length']?_0x532ed5[_0x40d7('0x2f')]:_0x4fdf53[_0x40d7('0x29')];if(_0x2b5f11[_0x40d7('0x2c')][_0x40d7('0x31')]){_0x532ed5[_0x40d7('0x32')]=[{'all':!![]}];}_0x532ed5=_[_0x40d7('0x33')]({},_0x532ed5,_0x2b5f11[_0x40d7('0x34')]);return db['ChatApplication'][_0x40d7('0x35')](_0x532ed5)[_0x40d7('0x22')](handleEntityNotFound(_0x4503cc,null))[_0x40d7('0x22')](respondWithResult(_0x4503cc,null))[_0x40d7('0x36')](handleError(_0x4503cc,null));};exports[_0x40d7('0x21')]=function(_0x2d1ee6,_0x1e6f08){if(_0x2d1ee6[_0x40d7('0x37')]['id']){delete _0x2d1ee6['body']['id'];}return db['ChatApplication'][_0x40d7('0x35')]({'where':{'id':_0x2d1ee6[_0x40d7('0x28')]['id']}})['then'](handleEntityNotFound(_0x1e6f08,null))['then'](saveUpdates(_0x2d1ee6['body'],null))[_0x40d7('0x22')](respondWithResult(_0x1e6f08,null))['catch'](handleError(_0x1e6f08,null));};exports[_0x40d7('0x23')]=function(_0x56b17c,_0x798ba7){return db[_0x40d7('0x2a')][_0x40d7('0x35')]({'where':{'id':_0x56b17c[_0x40d7('0x28')]['id']}})[_0x40d7('0x22')](handleEntityNotFound(_0x798ba7,null))['then'](removeEntity(_0x798ba7,null))[_0x40d7('0x36')](handleError(_0x798ba7,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index fbd184b..f0ae709 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 _0x9a0b=['./chatApplication.attributes','chat_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9a0b,0x7c));var _0xb9a0=function(_0x500cf0,_0x1ee8e5){_0x500cf0=_0x500cf0-0x0;var _0x1c55ba=_0x9a0b[_0x500cf0];return _0x1c55ba;};'use strict';var _=require('lodash');var util=require(_0xb9a0('0x0'));var logger=require(_0xb9a0('0x1'))(_0xb9a0('0x2'));var moment=require('moment');var BPromise=require(_0xb9a0('0x3'));var rp=require(_0xb9a0('0x4'));var fs=require('fs');var path=require(_0xb9a0('0x5'));var rimraf=require(_0xb9a0('0x6'));var config=require(_0xb9a0('0x7'));var attributes=require(_0xb9a0('0x8'));module['exports']=function(_0x519362,_0xa18963){return _0x519362['define']('ChatApplication',attributes,{'tableName':_0xb9a0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb9a0('0xa'),'collate':_0xb9a0('0xb')});}; \ No newline at end of file +var _0xf109=['../../config/logger','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4_unicode_ci','lodash','util'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf109,0xce));var _0x9f10=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xf109[_0x26f702];return _0x11417d;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var logger=require(_0x9f10('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9f10('0x3'));var fs=require('fs');var path=require(_0x9f10('0x4'));var rimraf=require(_0x9f10('0x5'));var config=require(_0x9f10('0x6'));var attributes=require(_0x9f10('0x7'));module[_0x9f10('0x8')]=function(_0x408fe8,_0xd3137b){return _0x408fe8[_0x9f10('0x9')](_0x9f10('0xa'),attributes,{'tableName':_0x9f10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9f10('0xc')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 0393365..fe66dda 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 _0x7d53=['jayson/promise','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatApplication,\x20%s,\x20%s','result','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1bc019,_0x3b33ec){var _0x4dc25f=function(_0x18168c){while(--_0x18168c){_0x1bc019['push'](_0x1bc019['shift']());}};_0x4dc25f(++_0x3b33ec);}(_0x7d53,0x134));var _0x37d5=function(_0xf6c23d,_0x2076d7){_0xf6c23d=_0xf6c23d-0x0;var _0x568084=_0x7d53[_0xf6c23d];return _0x568084;};'use strict';var _=require(_0x37d5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37d5('0x1'));var db=require(_0x37d5('0x2'))['db'];var utils=require(_0x37d5('0x3'));var logger=require(_0x37d5('0x4'))(_0x37d5('0x5'));var config=require(_0x37d5('0x6'));var jayson=require(_0x37d5('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5524b9,_0x45e187,_0xde65b9){return new BPromise(function(_0x3aa2e8,_0xe5e7a2){return client[_0x37d5('0x8')](_0x5524b9,_0xde65b9)[_0x37d5('0x9')](function(_0x2bb669){logger[_0x37d5('0xa')]('ChatApplication,\x20%s,\x20%s',_0x45e187,_0x37d5('0xb'));logger[_0x37d5('0xc')](_0x37d5('0xd'),_0x45e187,_0x37d5('0xb'),JSON[_0x37d5('0xe')](_0x2bb669));if(_0x2bb669[_0x37d5('0xf')]){if(_0x2bb669['error'][_0x37d5('0x10')]===0x1f4){logger[_0x37d5('0xf')]('ChatApplication,\x20%s,\x20%s',_0x45e187,_0x2bb669[_0x37d5('0xf')][_0x37d5('0x11')]);return _0xe5e7a2(_0x2bb669[_0x37d5('0xf')][_0x37d5('0x11')]);}logger['error'](_0x37d5('0x12'),_0x45e187,_0x2bb669[_0x37d5('0xf')][_0x37d5('0x11')]);return _0x3aa2e8(_0x2bb669[_0x37d5('0xf')][_0x37d5('0x11')]);}else{logger[_0x37d5('0xa')]('ChatApplication,\x20%s,\x20%s',_0x45e187,_0x37d5('0xb'));_0x3aa2e8(_0x2bb669[_0x37d5('0x13')][_0x37d5('0x11')]);}})[_0x37d5('0x14')](function(_0x3c3532){logger[_0x37d5('0xf')](_0x37d5('0x12'),_0x45e187,_0x3c3532);_0xe5e7a2(_0x3c3532);});});} \ No newline at end of file +var _0xd686=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','util'];(function(_0x4715d2,_0x3371b2){var _0x141811=function(_0x520bc6){while(--_0x520bc6){_0x4715d2['push'](_0x4715d2['shift']());}};_0x141811(++_0x3371b2);}(_0xd686,0x1cd));var _0x6d68=function(_0x31b5a5,_0x44376a){_0x31b5a5=_0x31b5a5-0x0;var _0x364cc9=_0xd686[_0x31b5a5];return _0x364cc9;};'use strict';var _=require('lodash');var util=require(_0x6d68('0x0'));var moment=require(_0x6d68('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d68('0x2'));var db=require(_0x6d68('0x3'))['db'];var utils=require(_0x6d68('0x4'));var logger=require(_0x6d68('0x5'))(_0x6d68('0x6'));var config=require(_0x6d68('0x7'));var jayson=require(_0x6d68('0x8'));var client=jayson[_0x6d68('0x9')][_0x6d68('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd86128,_0x2a453f,_0xb71e58){return new BPromise(function(_0x429455,_0x5ae778){return client[_0x6d68('0xb')](_0xd86128,_0xb71e58)[_0x6d68('0xc')](function(_0x5d4daf){logger[_0x6d68('0xd')](_0x6d68('0xe'),_0x2a453f,'request\x20sent');logger[_0x6d68('0xf')](_0x6d68('0x10'),_0x2a453f,'request\x20sent',JSON[_0x6d68('0x11')](_0x5d4daf));if(_0x5d4daf['error']){if(_0x5d4daf[_0x6d68('0x12')]['code']===0x1f4){logger[_0x6d68('0x12')](_0x6d68('0xe'),_0x2a453f,_0x5d4daf[_0x6d68('0x12')][_0x6d68('0x13')]);return _0x5ae778(_0x5d4daf[_0x6d68('0x12')][_0x6d68('0x13')]);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x2a453f,_0x5d4daf[_0x6d68('0x12')][_0x6d68('0x13')]);return _0x429455(_0x5d4daf[_0x6d68('0x12')][_0x6d68('0x13')]);}else{logger[_0x6d68('0xd')](_0x6d68('0xe'),_0x2a453f,_0x6d68('0x14'));_0x429455(_0x5d4daf[_0x6d68('0x15')][_0x6d68('0x13')]);}})['catch'](function(_0x32c3f0){logger[_0x6d68('0x12')](_0x6d68('0xe'),_0x2a453f,_0x32c3f0);_0x5ae778(_0x32c3f0);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index fda08bb..ef22fe8 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 _0x81d4=['destroy','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update'];(function(_0x413aac,_0x5e2430){var _0x569b11=function(_0x52e060){while(--_0x52e060){_0x413aac['push'](_0x413aac['shift']());}};_0x569b11(++_0x5e2430);}(_0x81d4,0xb7));var _0x481d=function(_0x846d94,_0xc08ef){_0x846d94=_0x846d94-0x0;var _0xb5f12d=_0x81d4[_0x846d94];return _0xb5f12d;};'use strict';var multer=require(_0x481d('0x0'));var util=require(_0x481d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x481d('0x2'));var auth=require(_0x481d('0x3'));var interaction=require(_0x481d('0x4'));var config=require('../../config/environment');var controller=require(_0x481d('0x5'));router[_0x481d('0x6')](_0x481d('0x7'),auth[_0x481d('0x8')](),controller[_0x481d('0x9')]);router[_0x481d('0xa')](_0x481d('0x7'),auth[_0x481d('0x8')](),controller[_0x481d('0xb')]);router['delete'](_0x481d('0x7'),auth['isAuthenticated'](),controller[_0x481d('0xc')]);module['exports']=router; \ No newline at end of file +var _0x8f5f=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','put'];(function(_0xe4fa3d,_0x405634){var _0x150d66=function(_0x439ae7){while(--_0x439ae7){_0xe4fa3d['push'](_0xe4fa3d['shift']());}};_0x150d66(++_0x405634);}(_0x8f5f,0xc5));var _0xf8f5=function(_0x46800d,_0x588500){_0x46800d=_0x46800d-0x0;var _0x3824cd=_0x8f5f[_0x46800d];return _0x3824cd;};'use strict';var multer=require(_0xf8f5('0x0'));var util=require(_0xf8f5('0x1'));var path=require(_0xf8f5('0x2'));var timeout=require(_0xf8f5('0x3'));var express=require(_0xf8f5('0x4'));var router=express[_0xf8f5('0x5')]();var fs_extra=require(_0xf8f5('0x6'));var auth=require(_0xf8f5('0x7'));var interaction=require(_0xf8f5('0x8'));var config=require('../../config/environment');var controller=require('./chatApplication.controller');router[_0xf8f5('0x9')](_0xf8f5('0xa'),auth[_0xf8f5('0xb')](),controller['show']);router[_0xf8f5('0xc')](_0xf8f5('0xa'),auth[_0xf8f5('0xb')](),controller['update']);router[_0xf8f5('0xd')](_0xf8f5('0xa'),auth[_0xf8f5('0xb')](),controller['destroy']);module[_0xf8f5('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 38a5a38..e7a7934 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 _0x8bf4=['BOOLEAN','sequelize','exports','STRING'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x8bf4,0x185));var _0x48bf=function(_0x9d9183,_0x4704df){_0x9d9183=_0x9d9183-0x0;var _0x3bec8e=_0x8bf4[_0x9d9183];return _0x3bec8e;};'use strict';var Sequelize=require(_0x48bf('0x0'));module[_0x48bf('0x1')]={'name':{'type':Sequelize[_0x48bf('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x48bf('0x2')]},'write':{'type':Sequelize[_0x48bf('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xdbce=['STRING','BOOLEAN','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdbce,0x1f1));var _0xedbc=function(_0xdd2bbd,_0xaf1161){_0xdd2bbd=_0xdd2bbd-0x0;var _0x449fc8=_0xdbce[_0xdd2bbd];return _0x449fc8;};'use strict';var Sequelize=require(_0xedbc('0x0'));module['exports']={'name':{'type':Sequelize[_0xedbc('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xedbc('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 211a7b7..e13caa6 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 _0xee89=['pick','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','ChatGroup','includeAll','include','catch','show','create','body','find','params','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','length','nolimit','removeMembers','addMessage','ChatGroupId','getMessages'];(function(_0x2b10b6,_0x3e54fa){var _0x28a925=function(_0x21fa59){while(--_0x21fa59){_0x2b10b6['push'](_0x2b10b6['shift']());}};_0x28a925(++_0x3e54fa);}(_0xee89,0x69));var _0x9ee8=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xee89[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x9ee8('0x0'));var rimraf=require(_0x9ee8('0x1'));var zipdir=require(_0x9ee8('0x2'));var jsonpatch=require(_0x9ee8('0x3'));var rp=require('request-promise');var moment=require(_0x9ee8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9ee8('0x5'));var util=require(_0x9ee8('0x6'));var path=require(_0x9ee8('0x7'));var sox=require(_0x9ee8('0x8'));var csv=require(_0x9ee8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9ee8('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9ee8('0xb'));var deskjs=require(_0x9ee8('0xc'));var toCsv=require(_0x9ee8('0x9'));var querystring=require(_0x9ee8('0xd'));var Papa=require(_0x9ee8('0xe'));var Redis=require(_0x9ee8('0xf'));var authService=require(_0x9ee8('0x10'));var qs=require(_0x9ee8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9ee8('0x12'));var logger=require(_0x9ee8('0x13'))(_0x9ee8('0x14'));var utils=require(_0x9ee8('0x15'));var config=require(_0x9ee8('0x16'));var licenseUtil=require(_0x9ee8('0x17'));var db=require(_0x9ee8('0x18'))['db'];config['redis']=_[_0x9ee8('0x19')](config[_0x9ee8('0x1a')],{'host':_0x9ee8('0x1b'),'port':0x18eb});var socket=require(_0x9ee8('0x1c'))(new Redis(config[_0x9ee8('0x1a')]));require(_0x9ee8('0x1d'))['register'](socket);function respondWithStatusCode(_0xc57834,_0x39c3c0){_0x39c3c0=_0x39c3c0||0xcc;return function(_0x3abba0){if(_0x3abba0){return _0xc57834[_0x9ee8('0x1e')](_0x39c3c0);}return _0xc57834[_0x9ee8('0x1f')](_0x39c3c0)['end']();};}function respondWithResult(_0x1d0a40,_0x443a4c){_0x443a4c=_0x443a4c||0xc8;return function(_0x43ba76){if(_0x43ba76){return _0x1d0a40[_0x9ee8('0x1f')](_0x443a4c)[_0x9ee8('0x20')](_0x43ba76);}};}function respondWithFilteredResult(_0x3d621a,_0x33beb3){return function(_0x226700){if(_0x226700){var _0x4cd089=typeof _0x33beb3[_0x9ee8('0x21')]===_0x9ee8('0x22')&&typeof _0x33beb3[_0x9ee8('0x23')]===_0x9ee8('0x22');var _0x1990dc=_0x226700[_0x9ee8('0x24')];var _0x57a20f=_0x4cd089?0x0:_0x33beb3[_0x9ee8('0x21')];var _0x240695=_0x4cd089?_0x226700['count']:_0x33beb3['offset']+_0x33beb3['limit'];var _0x3d5136;if(_0x240695>=_0x1990dc){_0x240695=_0x1990dc;_0x3d5136=0xc8;}else{_0x3d5136=0xce;}_0x3d621a[_0x9ee8('0x1f')](_0x3d5136);return _0x3d621a['set'](_0x9ee8('0x25'),_0x57a20f+'-'+_0x240695+'/'+_0x1990dc)[_0x9ee8('0x20')](_0x226700);}return null;};}function patchUpdates(_0x2b7fb0){return function(_0x2b7de9){try{jsonpatch[_0x9ee8('0x26')](_0x2b7de9,_0x2b7fb0,!![]);}catch(_0x515112){return BPromise[_0x9ee8('0x27')](_0x515112);}return _0x2b7de9[_0x9ee8('0x28')]();};}function saveUpdates(_0x4d55ab,_0x39b44f){return function(_0x6bfea5){if(_0x6bfea5){return _0x6bfea5[_0x9ee8('0x29')](_0x4d55ab)[_0x9ee8('0x2a')](function(_0x157d70){return _0x157d70;});}return null;};}function removeEntity(_0x3904e5,_0xecf2d0){return function(_0x4988d2){if(_0x4988d2){return _0x4988d2[_0x9ee8('0x2b')]()[_0x9ee8('0x2a')](function(){_0x3904e5[_0x9ee8('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x305f9d,_0x35ab9c){return function(_0x5887e6){if(!_0x5887e6){_0x305f9d[_0x9ee8('0x1e')](0x194);}return _0x5887e6;};}function handleError(_0x19b5d2,_0x11581c){_0x11581c=_0x11581c||0x1f4;return function(_0x442e61){logger[_0x9ee8('0x2c')](_0x442e61[_0x9ee8('0x2d')]);if(_0x442e61[_0x9ee8('0x2e')]){delete _0x442e61[_0x9ee8('0x2e')];}_0x19b5d2[_0x9ee8('0x1f')](_0x11581c)[_0x9ee8('0x2f')](_0x442e61);};}exports[_0x9ee8('0x30')]=function(_0xb08761,_0xdd817d){var _0x479e81={},_0x6c3c6a={},_0x1a393a={'count':0x0,'rows':[]};var _0x347b67=_[_0x9ee8('0x31')](db['ChatGroup'][_0x9ee8('0x32')],function(_0x2d609d){return{'name':_0x2d609d[_0x9ee8('0x33')],'type':_0x2d609d[_0x9ee8('0x34')][_0x9ee8('0x35')]};});_0x6c3c6a['model']=_[_0x9ee8('0x31')](_0x347b67,_0x9ee8('0x2e'));_0x6c3c6a[_0x9ee8('0x36')]=_[_0x9ee8('0x37')](_0xb08761[_0x9ee8('0x36')]);_0x6c3c6a[_0x9ee8('0x38')]=_[_0x9ee8('0x39')](_0x6c3c6a['model'],_0x6c3c6a[_0x9ee8('0x36')]);_0x479e81[_0x9ee8('0x3a')]=_['intersection'](_0x6c3c6a[_0x9ee8('0x3b')],qs[_0x9ee8('0x3c')](_0xb08761[_0x9ee8('0x36')]['fields']));_0x479e81[_0x9ee8('0x3a')]=_0x479e81['attributes']['length']?_0x479e81[_0x9ee8('0x3a')]:_0x6c3c6a['model'];if(!_0xb08761['query'][_0x9ee8('0x3d')]('nolimit')){_0x479e81[_0x9ee8('0x23')]=qs[_0x9ee8('0x23')](_0xb08761[_0x9ee8('0x36')][_0x9ee8('0x23')]);_0x479e81[_0x9ee8('0x21')]=qs['offset'](_0xb08761[_0x9ee8('0x36')][_0x9ee8('0x21')]);}_0x479e81[_0x9ee8('0x3e')]=qs['sort'](_0xb08761[_0x9ee8('0x36')][_0x9ee8('0x3f')]);_0x479e81[_0x9ee8('0x40')]=qs[_0x9ee8('0x38')](_['pick'](_0xb08761[_0x9ee8('0x36')],_0x6c3c6a[_0x9ee8('0x38')]),_0x347b67);if(_0xb08761['query']['filter']){_0x479e81['where']=_[_0x9ee8('0x41')](_0x479e81[_0x9ee8('0x40')],{'$or':_[_0x9ee8('0x31')](_0x347b67,function(_0xbd83e3){if(_0xbd83e3[_0x9ee8('0x34')]!==_0x9ee8('0x42')){var _0x219ac5={};_0x219ac5[_0xbd83e3[_0x9ee8('0x2e')]]={'$like':'%'+_0xb08761[_0x9ee8('0x36')][_0x9ee8('0x43')]+'%'};return _0x219ac5;}})});}_0x479e81=_[_0x9ee8('0x41')]({},_0x479e81,_0xb08761[_0x9ee8('0x44')]);var _0x39d648={'where':_0x479e81['where']};return db[_0x9ee8('0x45')][_0x9ee8('0x24')](_0x39d648)[_0x9ee8('0x2a')](function(_0x2fdf06){_0x1a393a[_0x9ee8('0x24')]=_0x2fdf06;if(_0xb08761[_0x9ee8('0x36')][_0x9ee8('0x46')]){_0x479e81[_0x9ee8('0x47')]=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x479e81);})[_0x9ee8('0x2a')](function(_0x58289b){_0x1a393a['rows']=_0x58289b;return _0x1a393a;})['then'](respondWithFilteredResult(_0xdd817d,_0x479e81))[_0x9ee8('0x48')](handleError(_0xdd817d,null));};exports[_0x9ee8('0x49')]=function(_0x23c334,_0x1c6936){var _0x1f4bbc={'raw':!![],'where':{'id':_0x23c334['params']['id']}},_0x17a285={};_0x17a285[_0x9ee8('0x3b')]=_[_0x9ee8('0x37')](db[_0x9ee8('0x45')][_0x9ee8('0x32')]);_0x17a285[_0x9ee8('0x36')]=_[_0x9ee8('0x37')](_0x23c334['query']);_0x17a285[_0x9ee8('0x38')]=_[_0x9ee8('0x39')](_0x17a285[_0x9ee8('0x3b')],_0x17a285[_0x9ee8('0x36')]);_0x1f4bbc['attributes']=_[_0x9ee8('0x39')](_0x17a285[_0x9ee8('0x3b')],qs[_0x9ee8('0x3c')](_0x23c334[_0x9ee8('0x36')]['fields']));_0x1f4bbc[_0x9ee8('0x3a')]=_0x1f4bbc[_0x9ee8('0x3a')]['length']?_0x1f4bbc[_0x9ee8('0x3a')]:_0x17a285[_0x9ee8('0x3b')];if(_0x23c334[_0x9ee8('0x36')][_0x9ee8('0x46')]){_0x1f4bbc['include']=[{'all':!![]}];}_0x1f4bbc=_[_0x9ee8('0x41')]({},_0x1f4bbc,_0x23c334[_0x9ee8('0x44')]);return db['ChatGroup']['find'](_0x1f4bbc)[_0x9ee8('0x2a')](handleEntityNotFound(_0x1c6936,null))[_0x9ee8('0x2a')](respondWithResult(_0x1c6936,null))[_0x9ee8('0x48')](handleError(_0x1c6936,null));};exports[_0x9ee8('0x4a')]=function(_0xcd46ab,_0x10870e){return db[_0x9ee8('0x45')][_0x9ee8('0x4a')](_0xcd46ab['body'],{})[_0x9ee8('0x2a')](respondWithResult(_0x10870e,0xc9))[_0x9ee8('0x48')](handleError(_0x10870e,null));};exports['update']=function(_0x1a6a02,_0x424937){if(_0x1a6a02[_0x9ee8('0x4b')]['id']){delete _0x1a6a02['body']['id'];}return db[_0x9ee8('0x45')][_0x9ee8('0x4c')]({'where':{'id':_0x1a6a02[_0x9ee8('0x4d')]['id']}})[_0x9ee8('0x2a')](handleEntityNotFound(_0x424937,null))['then'](saveUpdates(_0x1a6a02['body'],null))[_0x9ee8('0x2a')](respondWithResult(_0x424937,null))[_0x9ee8('0x48')](handleError(_0x424937,null));};exports[_0x9ee8('0x2b')]=function(_0x5958b4,_0x2b4b0f){return db[_0x9ee8('0x45')][_0x9ee8('0x4c')]({'where':{'id':_0x5958b4[_0x9ee8('0x4d')]['id']}})[_0x9ee8('0x2a')](handleEntityNotFound(_0x2b4b0f,null))[_0x9ee8('0x2a')](removeEntity(_0x2b4b0f,null))[_0x9ee8('0x48')](handleError(_0x2b4b0f,null));};exports['describe']=function(_0x3f86a4,_0x13b545){return db['ChatGroup'][_0x9ee8('0x4e')]()[_0x9ee8('0x2a')](respondWithResult(_0x13b545,null))[_0x9ee8('0x48')](handleError(_0x13b545,null));};exports[_0x9ee8('0x4f')]=function(_0x41015b,_0x1a128c,_0x3080cf){return db[_0x9ee8('0x50')][_0x9ee8('0x24')]({'where':{'ChatGroupId':_0x41015b[_0x9ee8('0x4d')]['id'],'ToId':_0x41015b[_0x9ee8('0x51')]['id'],'read':![]}})[_0x9ee8('0x2a')](function(_0x2fbccb){return{'id':_[_0x9ee8('0x52')](_0x41015b['params']['id']),'count':_0x2fbccb};})[_0x9ee8('0x2a')](respondWithResult(_0x1a128c,null))[_0x9ee8('0x48')](handleError(_0x1a128c,null));};exports[_0x9ee8('0x53')]=function(_0x3a5a7a,_0x59b8fd,_0x318f15){return db[_0x9ee8('0x45')][_0x9ee8('0x4c')]({'where':{'id':_0x3a5a7a['params']['id']}})['then'](handleEntityNotFound(_0x59b8fd,null))[_0x9ee8('0x2a')](function(_0x5518cd){if(_0x5518cd){return _0x5518cd['addMembers'](_0x3a5a7a[_0x9ee8('0x4b')][_0x9ee8('0x54')],_[_0x9ee8('0x55')](_0x3a5a7a[_0x9ee8('0x4b')],[_0x9ee8('0x54'),'id'])||{});}})['then'](respondWithResult(_0x59b8fd,null))[_0x9ee8('0x48')](handleError(_0x59b8fd,null));};exports[_0x9ee8('0x56')]=function(_0x9a8fa9,_0x56aa3b,_0x29a636){var _0x182e9f={};var _0x941e6={};var _0x21680c;var _0x5b759e;return db[_0x9ee8('0x45')][_0x9ee8('0x57')]({'where':{'id':_0x9a8fa9[_0x9ee8('0x4d')]['id']}})[_0x9ee8('0x2a')](handleEntityNotFound(_0x56aa3b,null))['then'](function(_0x48a92a){if(_0x48a92a){_0x21680c=_0x48a92a;_0x941e6[_0x9ee8('0x3b')]=_[_0x9ee8('0x37')](db[_0x9ee8('0x58')]['rawAttributes']);_0x941e6[_0x9ee8('0x36')]=_[_0x9ee8('0x37')](_0x9a8fa9[_0x9ee8('0x36')]);_0x941e6[_0x9ee8('0x38')]=_[_0x9ee8('0x39')](_0x941e6[_0x9ee8('0x3b')],_0x941e6[_0x9ee8('0x36')]);_0x182e9f['attributes']=_['intersection'](_0x941e6[_0x9ee8('0x3b')],qs[_0x9ee8('0x3c')](_0x9a8fa9['query'][_0x9ee8('0x3c')]));_0x182e9f[_0x9ee8('0x3a')]=_0x182e9f[_0x9ee8('0x3a')][_0x9ee8('0x59')]?_0x182e9f[_0x9ee8('0x3a')]:_0x941e6[_0x9ee8('0x3b')];_0x182e9f[_0x9ee8('0x3e')]=qs[_0x9ee8('0x3f')](_0x9a8fa9['query'][_0x9ee8('0x3f')]);_0x182e9f[_0x9ee8('0x40')]=qs[_0x9ee8('0x38')](_['pick'](_0x9a8fa9[_0x9ee8('0x36')],_0x941e6[_0x9ee8('0x38')]));if(_0x9a8fa9[_0x9ee8('0x36')][_0x9ee8('0x43')]){_0x182e9f[_0x9ee8('0x40')]=_[_0x9ee8('0x41')](_0x182e9f['where'],{'$or':_['map'](_0x182e9f[_0x9ee8('0x3a')],function(_0x83785c){var _0x4fd8f1={};_0x4fd8f1[_0x83785c]={'$like':'%'+_0x9a8fa9[_0x9ee8('0x36')][_0x9ee8('0x43')]+'%'};return _0x4fd8f1;})});}_0x182e9f=_['merge']({},_0x182e9f,_0x9a8fa9[_0x9ee8('0x44')]);return _0x21680c[_0x9ee8('0x56')](_0x182e9f);}})[_0x9ee8('0x2a')](function(_0x472c2e){if(_0x472c2e){_0x5b759e=_0x472c2e[_0x9ee8('0x59')];if(!_0x9a8fa9[_0x9ee8('0x36')]['hasOwnProperty'](_0x9ee8('0x5a'))){_0x182e9f[_0x9ee8('0x23')]=qs['limit'](_0x9a8fa9['query']['limit']);_0x182e9f[_0x9ee8('0x21')]=qs[_0x9ee8('0x21')](_0x9a8fa9[_0x9ee8('0x36')]['offset']);}return _0x21680c[_0x9ee8('0x56')](_0x182e9f);}})[_0x9ee8('0x2a')](function(_0x11df3c){if(_0x11df3c){return _0x11df3c?{'count':_0x5b759e,'rows':_0x11df3c}:null;}})[_0x9ee8('0x2a')](respondWithResult(_0x56aa3b,null))['catch'](handleError(_0x56aa3b,null));};exports[_0x9ee8('0x5b')]=function(_0x2f70d5,_0x1b82f4,_0x167c3c){return db[_0x9ee8('0x45')]['find']({'where':{'id':_0x2f70d5[_0x9ee8('0x4d')]['id']}})[_0x9ee8('0x2a')](handleEntityNotFound(_0x1b82f4,null))[_0x9ee8('0x2a')](function(_0x1f8846){if(_0x1f8846){return _0x1f8846[_0x9ee8('0x5b')](_0x2f70d5[_0x9ee8('0x36')]['ids']);}})[_0x9ee8('0x2a')](respondWithStatusCode(_0x1b82f4,null))['catch'](handleError(_0x1b82f4,null));};exports[_0x9ee8('0x5c')]=function(_0x12cf30,_0xe94f00,_0x183b20){if(_0x12cf30[_0x9ee8('0x4b')]['id']){delete _0x12cf30[_0x9ee8('0x4b')]['id'];}return db[_0x9ee8('0x45')]['find']({'where':{'id':_0x12cf30[_0x9ee8('0x4d')]['id']}})[_0x9ee8('0x2a')](handleEntityNotFound(_0xe94f00,null))[_0x9ee8('0x2a')](function(_0x48b0da){if(_0x48b0da){_0x12cf30['body'][_0x9ee8('0x5d')]=_0x48b0da['id'];return db[_0x9ee8('0x50')][_0x9ee8('0x4a')](_0x12cf30[_0x9ee8('0x4b')]);}})[_0x9ee8('0x2a')](respondWithResult(_0xe94f00,null))[_0x9ee8('0x48')](handleError(_0xe94f00,null));};exports[_0x9ee8('0x5e')]=function(_0x20c4f6,_0xdfe2fb,_0x109665){var _0x32a97a={};var _0x564429={};var _0x154477;var _0x52ce07;return db[_0x9ee8('0x45')][_0x9ee8('0x57')]({'where':{'id':_0x20c4f6[_0x9ee8('0x4d')]['id']}})['then'](handleEntityNotFound(_0xdfe2fb,null))[_0x9ee8('0x2a')](function(_0x475fcd){if(_0x475fcd){_0x154477=_0x475fcd;_0x564429[_0x9ee8('0x3b')]=_[_0x9ee8('0x37')](db[_0x9ee8('0x50')][_0x9ee8('0x32')]);_0x564429[_0x9ee8('0x36')]=_[_0x9ee8('0x37')](_0x20c4f6['query']);_0x564429[_0x9ee8('0x38')]=_[_0x9ee8('0x39')](_0x564429[_0x9ee8('0x3b')],_0x564429[_0x9ee8('0x36')]);_0x32a97a[_0x9ee8('0x3a')]=_['intersection'](_0x564429['model'],qs['fields'](_0x20c4f6[_0x9ee8('0x36')]['fields']));_0x32a97a['attributes']=_0x32a97a[_0x9ee8('0x3a')][_0x9ee8('0x59')]?_0x32a97a['attributes']:_0x564429[_0x9ee8('0x3b')];_0x32a97a['order']=qs['sort'](_0x20c4f6[_0x9ee8('0x36')][_0x9ee8('0x3f')]);_0x32a97a[_0x9ee8('0x40')]=qs[_0x9ee8('0x38')](_[_0x9ee8('0x5f')](_0x20c4f6[_0x9ee8('0x36')],_0x564429['filters']));if(_0x20c4f6[_0x9ee8('0x36')][_0x9ee8('0x43')]){_0x32a97a[_0x9ee8('0x40')]=_[_0x9ee8('0x41')](_0x32a97a[_0x9ee8('0x40')],{'$or':_[_0x9ee8('0x31')](_0x32a97a[_0x9ee8('0x3a')],function(_0x5ae071){var _0x5d908d={};_0x5d908d[_0x5ae071]={'$like':'%'+_0x20c4f6['query'][_0x9ee8('0x43')]+'%'};return _0x5d908d;})});}if(_0x20c4f6[_0x9ee8('0x36')][_0x9ee8('0x60')]){var _0x5f0492=_0x20c4f6[_0x9ee8('0x36')][_0x9ee8('0x60')][_0x9ee8('0x61')](',');var _0x39d1e7={};_0x39d1e7[_0x5f0492[0x0]]={'$gte':moment(_0x5f0492[0x1])[_0x9ee8('0x62')](_0x9ee8('0x63'))};_0x32a97a['where']=_[_0x9ee8('0x41')](_0x32a97a[_0x9ee8('0x40')],_0x39d1e7);}_0x32a97a=_[_0x9ee8('0x41')]({},_0x32a97a,_0x20c4f6[_0x9ee8('0x44')]);return _0x154477[_0x9ee8('0x5e')](_0x32a97a);}})[_0x9ee8('0x2a')](function(_0x1ed94b){if(_0x1ed94b){_0x52ce07=_0x1ed94b[_0x9ee8('0x59')];if(!_0x20c4f6['query'][_0x9ee8('0x3d')]('nolimit')){_0x32a97a[_0x9ee8('0x23')]=qs['limit'](_0x20c4f6[_0x9ee8('0x36')]['limit']);_0x32a97a['offset']=qs[_0x9ee8('0x21')](_0x20c4f6[_0x9ee8('0x36')][_0x9ee8('0x21')]);}return _0x154477[_0x9ee8('0x5e')](_0x32a97a);}})[_0x9ee8('0x2a')](function(_0x4b848b){if(_0x4b848b){return _0x4b848b?{'count':_0x52ce07,'rows':_0x4b848b}:null;}})[_0x9ee8('0x2a')](respondWithResult(_0xdfe2fb,null))['catch'](handleError(_0xdfe2fb,null));}; \ No newline at end of file +var _0x7363=['body','update','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','options','removeMembers','addMessage','ChatGroupId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','then','destroy','name','send','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ChatGroup','count','includeAll','include','findAll','catch','show','params','intersection','find','create'];(function(_0x34eb1d,_0x116a4d){var _0x53266b=function(_0x2c52aa){while(--_0x2c52aa){_0x34eb1d['push'](_0x34eb1d['shift']());}};_0x53266b(++_0x116a4d);}(_0x7363,0x131));var _0x3736=function(_0x3a8e15,_0x38e90d){_0x3a8e15=_0x3a8e15-0x0;var _0x4de790=_0x7363[_0x3a8e15];return _0x4de790;};'use strict';var emlformat=require(_0x3736('0x0'));var rimraf=require(_0x3736('0x1'));var zipdir=require(_0x3736('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3736('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3736('0x4'));var util=require(_0x3736('0x5'));var path=require(_0x3736('0x6'));var sox=require(_0x3736('0x7'));var csv=require(_0x3736('0x8'));var ejs=require(_0x3736('0x9'));var fs=require('fs');var fs_extra=require(_0x3736('0xa'));var _=require(_0x3736('0xb'));var squel=require(_0x3736('0xc'));var crypto=require(_0x3736('0xd'));var jsforce=require(_0x3736('0xe'));var deskjs=require(_0x3736('0xf'));var toCsv=require(_0x3736('0x8'));var querystring=require(_0x3736('0x10'));var Papa=require(_0x3736('0x11'));var Redis=require(_0x3736('0x12'));var authService=require(_0x3736('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3736('0x14'));var logger=require(_0x3736('0x15'))('api');var utils=require(_0x3736('0x16'));var config=require(_0x3736('0x17'));var licenseUtil=require(_0x3736('0x18'));var db=require(_0x3736('0x19'))['db'];config[_0x3736('0x1a')]=_['defaults'](config[_0x3736('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x3736('0x1b'))(new Redis(config[_0x3736('0x1a')]));require('./chatGroup.socket')[_0x3736('0x1c')](socket);function respondWithStatusCode(_0x7de163,_0x2c2b2b){_0x2c2b2b=_0x2c2b2b||0xcc;return function(_0x2982ef){if(_0x2982ef){return _0x7de163[_0x3736('0x1d')](_0x2c2b2b);}return _0x7de163[_0x3736('0x1e')](_0x2c2b2b)[_0x3736('0x1f')]();};}function respondWithResult(_0x59a0f3,_0x5b6dbf){_0x5b6dbf=_0x5b6dbf||0xc8;return function(_0x35f3c3){if(_0x35f3c3){return _0x59a0f3[_0x3736('0x1e')](_0x5b6dbf)[_0x3736('0x20')](_0x35f3c3);}};}function respondWithFilteredResult(_0x831bf6,_0x3c0403){return function(_0x41890b){if(_0x41890b){var _0x3fb742=typeof _0x3c0403[_0x3736('0x21')]===_0x3736('0x22')&&typeof _0x3c0403[_0x3736('0x23')]===_0x3736('0x22');var _0x3c6a48=_0x41890b['count'];var _0xadb50a=_0x3fb742?0x0:_0x3c0403[_0x3736('0x21')];var _0x3b80b0=_0x3fb742?_0x41890b['count']:_0x3c0403[_0x3736('0x21')]+_0x3c0403['limit'];var _0x48b690;if(_0x3b80b0>=_0x3c6a48){_0x3b80b0=_0x3c6a48;_0x48b690=0xc8;}else{_0x48b690=0xce;}_0x831bf6[_0x3736('0x1e')](_0x48b690);return _0x831bf6[_0x3736('0x24')](_0x3736('0x25'),_0xadb50a+'-'+_0x3b80b0+'/'+_0x3c6a48)[_0x3736('0x20')](_0x41890b);}return null;};}function patchUpdates(_0x19e1e6){return function(_0x8651e4){try{jsonpatch['apply'](_0x8651e4,_0x19e1e6,!![]);}catch(_0x79cb3a){return BPromise[_0x3736('0x26')](_0x79cb3a);}return _0x8651e4['save']();};}function saveUpdates(_0x765ac6,_0xe06804){return function(_0x17b09d){if(_0x17b09d){return _0x17b09d['update'](_0x765ac6)[_0x3736('0x27')](function(_0x541c6f){return _0x541c6f;});}return null;};}function removeEntity(_0x4a9fca,_0x280a6e){return function(_0x54675c){if(_0x54675c){return _0x54675c[_0x3736('0x28')]()[_0x3736('0x27')](function(){_0x4a9fca[_0x3736('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3620aa,_0x3ffea0){return function(_0x5a59cb){if(!_0x5a59cb){_0x3620aa[_0x3736('0x1d')](0x194);}return _0x5a59cb;};}function handleError(_0x3f7b52,_0x4a5be1){_0x4a5be1=_0x4a5be1||0x1f4;return function(_0x5bf4fb){logger['error'](_0x5bf4fb['stack']);if(_0x5bf4fb[_0x3736('0x29')]){delete _0x5bf4fb[_0x3736('0x29')];}_0x3f7b52[_0x3736('0x1e')](_0x4a5be1)[_0x3736('0x2a')](_0x5bf4fb);};}exports['index']=function(_0x3665e9,_0x995f3f){var _0x59c0c6={},_0x3fd5c0={},_0x7a0c7={'count':0x0,'rows':[]};var _0x4c8414=_['map'](db['ChatGroup'][_0x3736('0x2b')],function(_0x2ec704){return{'name':_0x2ec704[_0x3736('0x2c')],'type':_0x2ec704[_0x3736('0x2d')][_0x3736('0x2e')]};});_0x3fd5c0[_0x3736('0x2f')]=_[_0x3736('0x30')](_0x4c8414,'name');_0x3fd5c0['query']=_[_0x3736('0x31')](_0x3665e9[_0x3736('0x32')]);_0x3fd5c0[_0x3736('0x33')]=_['intersection'](_0x3fd5c0[_0x3736('0x2f')],_0x3fd5c0[_0x3736('0x32')]);_0x59c0c6[_0x3736('0x34')]=_['intersection'](_0x3fd5c0[_0x3736('0x2f')],qs[_0x3736('0x35')](_0x3665e9['query']['fields']));_0x59c0c6['attributes']=_0x59c0c6[_0x3736('0x34')][_0x3736('0x36')]?_0x59c0c6[_0x3736('0x34')]:_0x3fd5c0[_0x3736('0x2f')];if(!_0x3665e9[_0x3736('0x32')][_0x3736('0x37')](_0x3736('0x38'))){_0x59c0c6[_0x3736('0x23')]=qs['limit'](_0x3665e9['query'][_0x3736('0x23')]);_0x59c0c6[_0x3736('0x21')]=qs['offset'](_0x3665e9['query']['offset']);}_0x59c0c6[_0x3736('0x39')]=qs['sort'](_0x3665e9[_0x3736('0x32')][_0x3736('0x3a')]);_0x59c0c6[_0x3736('0x3b')]=qs[_0x3736('0x33')](_[_0x3736('0x3c')](_0x3665e9[_0x3736('0x32')],_0x3fd5c0[_0x3736('0x33')]),_0x4c8414);if(_0x3665e9['query'][_0x3736('0x3d')]){_0x59c0c6['where']=_[_0x3736('0x3e')](_0x59c0c6[_0x3736('0x3b')],{'$or':_[_0x3736('0x30')](_0x4c8414,function(_0x4db312){if(_0x4db312[_0x3736('0x2d')]!==_0x3736('0x3f')){var _0x6194da={};_0x6194da[_0x4db312[_0x3736('0x29')]]={'$like':'%'+_0x3665e9[_0x3736('0x32')][_0x3736('0x3d')]+'%'};return _0x6194da;}})});}_0x59c0c6=_[_0x3736('0x3e')]({},_0x59c0c6,_0x3665e9['options']);var _0x4c1053={'where':_0x59c0c6[_0x3736('0x3b')]};return db[_0x3736('0x40')]['count'](_0x4c1053)[_0x3736('0x27')](function(_0x22d192){_0x7a0c7[_0x3736('0x41')]=_0x22d192;if(_0x3665e9['query'][_0x3736('0x42')]){_0x59c0c6[_0x3736('0x43')]=[{'all':!![]}];}return db[_0x3736('0x40')][_0x3736('0x44')](_0x59c0c6);})[_0x3736('0x27')](function(_0x39fff7){_0x7a0c7['rows']=_0x39fff7;return _0x7a0c7;})[_0x3736('0x27')](respondWithFilteredResult(_0x995f3f,_0x59c0c6))[_0x3736('0x45')](handleError(_0x995f3f,null));};exports[_0x3736('0x46')]=function(_0x24bc77,_0x33dec4){var _0x4d031b={'raw':!![],'where':{'id':_0x24bc77[_0x3736('0x47')]['id']}},_0x206f00={};_0x206f00[_0x3736('0x2f')]=_[_0x3736('0x31')](db[_0x3736('0x40')][_0x3736('0x2b')]);_0x206f00[_0x3736('0x32')]=_[_0x3736('0x31')](_0x24bc77['query']);_0x206f00['filters']=_[_0x3736('0x48')](_0x206f00[_0x3736('0x2f')],_0x206f00['query']);_0x4d031b['attributes']=_[_0x3736('0x48')](_0x206f00[_0x3736('0x2f')],qs[_0x3736('0x35')](_0x24bc77['query'][_0x3736('0x35')]));_0x4d031b[_0x3736('0x34')]=_0x4d031b[_0x3736('0x34')][_0x3736('0x36')]?_0x4d031b[_0x3736('0x34')]:_0x206f00[_0x3736('0x2f')];if(_0x24bc77['query'][_0x3736('0x42')]){_0x4d031b[_0x3736('0x43')]=[{'all':!![]}];}_0x4d031b=_['merge']({},_0x4d031b,_0x24bc77['options']);return db[_0x3736('0x40')][_0x3736('0x49')](_0x4d031b)[_0x3736('0x27')](handleEntityNotFound(_0x33dec4,null))[_0x3736('0x27')](respondWithResult(_0x33dec4,null))[_0x3736('0x45')](handleError(_0x33dec4,null));};exports[_0x3736('0x4a')]=function(_0x4e68d2,_0x349239){return db[_0x3736('0x40')][_0x3736('0x4a')](_0x4e68d2[_0x3736('0x4b')],{})['then'](respondWithResult(_0x349239,0xc9))['catch'](handleError(_0x349239,null));};exports[_0x3736('0x4c')]=function(_0x53fc39,_0x85ee83){if(_0x53fc39[_0x3736('0x4b')]['id']){delete _0x53fc39[_0x3736('0x4b')]['id'];}return db[_0x3736('0x40')][_0x3736('0x49')]({'where':{'id':_0x53fc39[_0x3736('0x47')]['id']}})[_0x3736('0x27')](handleEntityNotFound(_0x85ee83,null))[_0x3736('0x27')](saveUpdates(_0x53fc39[_0x3736('0x4b')],null))[_0x3736('0x27')](respondWithResult(_0x85ee83,null))['catch'](handleError(_0x85ee83,null));};exports['destroy']=function(_0xb66f9d,_0x257053){return db['ChatGroup'][_0x3736('0x49')]({'where':{'id':_0xb66f9d['params']['id']}})[_0x3736('0x27')](handleEntityNotFound(_0x257053,null))[_0x3736('0x27')](removeEntity(_0x257053,null))[_0x3736('0x45')](handleError(_0x257053,null));};exports['describe']=function(_0x2f41cb,_0x4dd9e6){return db[_0x3736('0x40')]['describe']()[_0x3736('0x27')](respondWithResult(_0x4dd9e6,null))[_0x3736('0x45')](handleError(_0x4dd9e6,null));};exports[_0x3736('0x4d')]=function(_0x2d4640,_0x31f83f,_0x46cb38){return db[_0x3736('0x4e')][_0x3736('0x41')]({'where':{'ChatGroupId':_0x2d4640[_0x3736('0x47')]['id'],'ToId':_0x2d4640[_0x3736('0x4f')]['id'],'read':![]}})['then'](function(_0x54dcca){return{'id':_[_0x3736('0x50')](_0x2d4640[_0x3736('0x47')]['id']),'count':_0x54dcca};})[_0x3736('0x27')](respondWithResult(_0x31f83f,null))[_0x3736('0x45')](handleError(_0x31f83f,null));};exports[_0x3736('0x51')]=function(_0x2932a3,_0x5a31f7,_0xeeda29){return db[_0x3736('0x40')]['find']({'where':{'id':_0x2932a3[_0x3736('0x47')]['id']}})[_0x3736('0x27')](handleEntityNotFound(_0x5a31f7,null))['then'](function(_0x5de494){if(_0x5de494){return _0x5de494[_0x3736('0x51')](_0x2932a3['body'][_0x3736('0x52')],_[_0x3736('0x53')](_0x2932a3[_0x3736('0x4b')],[_0x3736('0x52'),'id'])||{});}})['then'](respondWithResult(_0x5a31f7,null))[_0x3736('0x45')](handleError(_0x5a31f7,null));};exports[_0x3736('0x54')]=function(_0x4207bb,_0x13de7c,_0x2fe073){var _0x580276={};var _0x45623b={};var _0x3919f6;var _0x55e72f;return db[_0x3736('0x40')][_0x3736('0x55')]({'where':{'id':_0x4207bb[_0x3736('0x47')]['id']}})[_0x3736('0x27')](handleEntityNotFound(_0x13de7c,null))[_0x3736('0x27')](function(_0x48b31a){if(_0x48b31a){_0x3919f6=_0x48b31a;_0x45623b[_0x3736('0x2f')]=_['keys'](db[_0x3736('0x56')]['rawAttributes']);_0x45623b['query']=_['keys'](_0x4207bb['query']);_0x45623b[_0x3736('0x33')]=_['intersection'](_0x45623b['model'],_0x45623b[_0x3736('0x32')]);_0x580276[_0x3736('0x34')]=_[_0x3736('0x48')](_0x45623b[_0x3736('0x2f')],qs['fields'](_0x4207bb[_0x3736('0x32')][_0x3736('0x35')]));_0x580276[_0x3736('0x34')]=_0x580276[_0x3736('0x34')][_0x3736('0x36')]?_0x580276['attributes']:_0x45623b[_0x3736('0x2f')];_0x580276[_0x3736('0x39')]=qs[_0x3736('0x3a')](_0x4207bb[_0x3736('0x32')][_0x3736('0x3a')]);_0x580276['where']=qs[_0x3736('0x33')](_[_0x3736('0x3c')](_0x4207bb[_0x3736('0x32')],_0x45623b[_0x3736('0x33')]));if(_0x4207bb[_0x3736('0x32')]['filter']){_0x580276[_0x3736('0x3b')]=_['merge'](_0x580276[_0x3736('0x3b')],{'$or':_[_0x3736('0x30')](_0x580276[_0x3736('0x34')],function(_0x68afad){var _0xa00949={};_0xa00949[_0x68afad]={'$like':'%'+_0x4207bb[_0x3736('0x32')]['filter']+'%'};return _0xa00949;})});}_0x580276=_[_0x3736('0x3e')]({},_0x580276,_0x4207bb[_0x3736('0x57')]);return _0x3919f6['getMembers'](_0x580276);}})[_0x3736('0x27')](function(_0x35a7f8){if(_0x35a7f8){_0x55e72f=_0x35a7f8[_0x3736('0x36')];if(!_0x4207bb[_0x3736('0x32')]['hasOwnProperty'](_0x3736('0x38'))){_0x580276[_0x3736('0x23')]=qs['limit'](_0x4207bb['query']['limit']);_0x580276[_0x3736('0x21')]=qs[_0x3736('0x21')](_0x4207bb[_0x3736('0x32')][_0x3736('0x21')]);}return _0x3919f6[_0x3736('0x54')](_0x580276);}})[_0x3736('0x27')](function(_0x57b3e7){if(_0x57b3e7){return _0x57b3e7?{'count':_0x55e72f,'rows':_0x57b3e7}:null;}})[_0x3736('0x27')](respondWithResult(_0x13de7c,null))[_0x3736('0x45')](handleError(_0x13de7c,null));};exports[_0x3736('0x58')]=function(_0x33653e,_0x9d8386,_0x3bd747){return db[_0x3736('0x40')][_0x3736('0x49')]({'where':{'id':_0x33653e[_0x3736('0x47')]['id']}})['then'](handleEntityNotFound(_0x9d8386,null))['then'](function(_0x5dc4ae){if(_0x5dc4ae){return _0x5dc4ae[_0x3736('0x58')](_0x33653e['query'][_0x3736('0x52')]);}})[_0x3736('0x27')](respondWithStatusCode(_0x9d8386,null))['catch'](handleError(_0x9d8386,null));};exports[_0x3736('0x59')]=function(_0x520bf9,_0x9d494d,_0x5d3aee){if(_0x520bf9[_0x3736('0x4b')]['id']){delete _0x520bf9['body']['id'];}return db[_0x3736('0x40')][_0x3736('0x49')]({'where':{'id':_0x520bf9[_0x3736('0x47')]['id']}})[_0x3736('0x27')](handleEntityNotFound(_0x9d494d,null))[_0x3736('0x27')](function(_0x1f19de){if(_0x1f19de){_0x520bf9[_0x3736('0x4b')][_0x3736('0x5a')]=_0x1f19de['id'];return db[_0x3736('0x4e')][_0x3736('0x4a')](_0x520bf9['body']);}})['then'](respondWithResult(_0x9d494d,null))['catch'](handleError(_0x9d494d,null));};exports['getMessages']=function(_0xe4d0bf,_0x537243,_0xb4dec){var _0xd1efdb={};var _0x3f833={};var _0x1cca39;var _0x2539a1;return db[_0x3736('0x40')][_0x3736('0x55')]({'where':{'id':_0xe4d0bf[_0x3736('0x47')]['id']}})['then'](handleEntityNotFound(_0x537243,null))[_0x3736('0x27')](function(_0x434815){if(_0x434815){_0x1cca39=_0x434815;_0x3f833[_0x3736('0x2f')]=_[_0x3736('0x31')](db[_0x3736('0x4e')]['rawAttributes']);_0x3f833[_0x3736('0x32')]=_[_0x3736('0x31')](_0xe4d0bf['query']);_0x3f833['filters']=_[_0x3736('0x48')](_0x3f833[_0x3736('0x2f')],_0x3f833['query']);_0xd1efdb['attributes']=_[_0x3736('0x48')](_0x3f833['model'],qs['fields'](_0xe4d0bf[_0x3736('0x32')][_0x3736('0x35')]));_0xd1efdb[_0x3736('0x34')]=_0xd1efdb['attributes'][_0x3736('0x36')]?_0xd1efdb[_0x3736('0x34')]:_0x3f833[_0x3736('0x2f')];_0xd1efdb[_0x3736('0x39')]=qs['sort'](_0xe4d0bf[_0x3736('0x32')]['sort']);_0xd1efdb[_0x3736('0x3b')]=qs[_0x3736('0x33')](_[_0x3736('0x3c')](_0xe4d0bf['query'],_0x3f833[_0x3736('0x33')]));if(_0xe4d0bf['query'][_0x3736('0x3d')]){_0xd1efdb[_0x3736('0x3b')]=_['merge'](_0xd1efdb[_0x3736('0x3b')],{'$or':_['map'](_0xd1efdb[_0x3736('0x34')],function(_0x9faa0b){var _0x1e730f={};_0x1e730f[_0x9faa0b]={'$like':'%'+_0xe4d0bf['query']['filter']+'%'};return _0x1e730f;})});}if(_0xe4d0bf[_0x3736('0x32')]['$gte']){var _0x3d6b77=_0xe4d0bf[_0x3736('0x32')][_0x3736('0x5b')][_0x3736('0x5c')](',');var _0x4bde31={};_0x4bde31[_0x3d6b77[0x0]]={'$gte':moment(_0x3d6b77[0x1])[_0x3736('0x5d')](_0x3736('0x5e'))};_0xd1efdb[_0x3736('0x3b')]=_[_0x3736('0x3e')](_0xd1efdb[_0x3736('0x3b')],_0x4bde31);}_0xd1efdb=_[_0x3736('0x3e')]({},_0xd1efdb,_0xe4d0bf[_0x3736('0x57')]);return _0x1cca39['getMessages'](_0xd1efdb);}})[_0x3736('0x27')](function(_0x1b2269){if(_0x1b2269){_0x2539a1=_0x1b2269[_0x3736('0x36')];if(!_0xe4d0bf[_0x3736('0x32')][_0x3736('0x37')](_0x3736('0x38'))){_0xd1efdb['limit']=qs[_0x3736('0x23')](_0xe4d0bf['query'][_0x3736('0x23')]);_0xd1efdb[_0x3736('0x21')]=qs[_0x3736('0x21')](_0xe4d0bf[_0x3736('0x32')]['offset']);}return _0x1cca39['getMessages'](_0xd1efdb);}})['then'](function(_0x4f6934){if(_0x4f6934){return _0x4f6934?{'count':_0x2539a1,'rows':_0x4f6934}:null;}})[_0x3736('0x27')](respondWithResult(_0x537243,null))[_0x3736('0x45')](handleError(_0x537243,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 80e0460..9f196f0 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 _0xe07e=['emit','hasOwnProperty','ChatGroup','setMaxListeners','save','update','remove'];(function(_0x4b13ce,_0x339cb0){var _0x427d4b=function(_0x26aaad){while(--_0x26aaad){_0x4b13ce['push'](_0x4b13ce['shift']());}};_0x427d4b(++_0x339cb0);}(_0xe07e,0xa3));var _0xee07=function(_0x5ba74f,_0x200bf4){_0x5ba74f=_0x5ba74f-0x0;var _0x534d79=_0xe07e[_0x5ba74f];return _0x534d79;};'use strict';var EventEmitter=require('events');var ChatGroup=require('../../mysqldb')['db'][_0xee07('0x0')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xee07('0x1')](0x0);var events={'afterCreate':_0xee07('0x2'),'afterUpdate':_0xee07('0x3'),'afterDestroy':_0xee07('0x4')};function emitEvent(_0x45b993){return function(_0x4cf4f5,_0xffcc84,_0xa0306b){ChatGroupEvents[_0xee07('0x5')](_0x45b993+':'+_0x4cf4f5['id'],_0x4cf4f5);ChatGroupEvents[_0xee07('0x5')](_0x45b993,_0x4cf4f5);_0xa0306b(null);};}for(var e in events){if(events[_0xee07('0x6')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x5e6e=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatGroup','setMaxListeners'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5e6e,0x74));var _0xe5e6=function(_0x220d56,_0x153929){_0x220d56=_0x220d56-0x0;var _0xd37143=_0x5e6e[_0x220d56];return _0xd37143;};'use strict';var EventEmitter=require(_0xe5e6('0x0'));var ChatGroup=require(_0xe5e6('0x1'))['db'][_0xe5e6('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xe5e6('0x3')](0x0);var events={'afterCreate':_0xe5e6('0x4'),'afterUpdate':_0xe5e6('0x5'),'afterDestroy':_0xe5e6('0x6')};function emitEvent(_0x2df215){return function(_0x5a09a3,_0x301b71,_0x1a8b1c){ChatGroupEvents[_0xe5e6('0x7')](_0x2df215+':'+_0x5a09a3['id'],_0x5a09a3);ChatGroupEvents[_0xe5e6('0x7')](_0x2df215,_0x5a09a3);_0x1a8b1c(null);};}for(var e in events){if(events[_0xe5e6('0x8')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0xe5e6('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 e7aa58a..259ab90 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 _0xb9f0=['../../config/logger','api','bluebird','request-promise','path','rimraf','./chatGroup.attributes','exports','define','ChatGroup','chat_groups'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb9f0,0x16b));var _0x0b9f=function(_0x45416d,_0x1f42bf){_0x45416d=_0x45416d-0x0;var _0x4d8666=_0xb9f0[_0x45416d];return _0x4d8666;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0b9f('0x0'))(_0x0b9f('0x1'));var moment=require('moment');var BPromise=require(_0x0b9f('0x2'));var rp=require(_0x0b9f('0x3'));var fs=require('fs');var path=require(_0x0b9f('0x4'));var rimraf=require(_0x0b9f('0x5'));var config=require('../../config/environment');var attributes=require(_0x0b9f('0x6'));module[_0x0b9f('0x7')]=function(_0x435dd3,_0x121156){return _0x435dd3[_0x0b9f('0x8')](_0x0b9f('0x9'),attributes,{'tableName':_0x0b9f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f2f=['../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','util','moment','bluebird','request-promise','rimraf'];(function(_0x5e4ca8,_0x3e156c){var _0x21ef16=function(_0x43ae45){while(--_0x43ae45){_0x5e4ca8['push'](_0x5e4ca8['shift']());}};_0x21ef16(++_0x3e156c);}(_0x6f2f,0x1ef));var _0xf6f2=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x6f2f[_0x8c43de];return _0xa6591b;};'use strict';var _=require('lodash');var util=require(_0xf6f2('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf6f2('0x1'));var BPromise=require(_0xf6f2('0x2'));var rp=require(_0xf6f2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf6f2('0x4'));var config=require(_0xf6f2('0x5'));var attributes=require(_0xf6f2('0x6'));module[_0xf6f2('0x7')]=function(_0x1a6a99,_0x209916){return _0x1a6a99[_0xf6f2('0x8')](_0xf6f2('0x9'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 6779f1d..c1932c5 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 _0x23fe=['ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','localhost','socket.io-emitter','redis','./chatGroup.socket','request','then'];(function(_0x2d65b3,_0x54b6c5){var _0x43589d=function(_0x1c255b){while(--_0x1c255b){_0x2d65b3['push'](_0x2d65b3['shift']());}};_0x43589d(++_0x54b6c5);}(_0x23fe,0x102));var _0xe23f=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x23fe[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0xe23f('0x0'));var util=require(_0xe23f('0x1'));var moment=require('moment');var BPromise=require(_0xe23f('0x2'));var rs=require(_0xe23f('0x3'));var fs=require('fs');var Redis=require(_0xe23f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe23f('0x5'));var logger=require(_0xe23f('0x6'))(_0xe23f('0x7'));var config=require(_0xe23f('0x8'));var jayson=require(_0xe23f('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xe23f('0xa')](config['redis'],{'host':_0xe23f('0xb'),'port':0x18eb});var socket=require(_0xe23f('0xc'))(new Redis(config[_0xe23f('0xd')]));require(_0xe23f('0xe'))['register'](socket);function respondWithRpcPromise(_0x8da3e5,_0x238a64,_0x40cc65){return new BPromise(function(_0x280c21,_0x879441){return client[_0xe23f('0xf')](_0x8da3e5,_0x40cc65)[_0xe23f('0x10')](function(_0x5caeea){logger['info'](_0xe23f('0x11'),_0x238a64,_0xe23f('0x12'));logger[_0xe23f('0x13')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x238a64,_0xe23f('0x12'),JSON[_0xe23f('0x14')](_0x5caeea));if(_0x5caeea[_0xe23f('0x15')]){if(_0x5caeea[_0xe23f('0x15')]['code']===0x1f4){logger[_0xe23f('0x15')](_0xe23f('0x11'),_0x238a64,_0x5caeea[_0xe23f('0x15')]['message']);return _0x879441(_0x5caeea[_0xe23f('0x15')]['message']);}logger[_0xe23f('0x15')](_0xe23f('0x11'),_0x238a64,_0x5caeea['error'][_0xe23f('0x16')]);return _0x280c21(_0x5caeea[_0xe23f('0x15')][_0xe23f('0x16')]);}else{logger[_0xe23f('0x17')](_0xe23f('0x11'),_0x238a64,'request\x20sent');_0x280c21(_0x5caeea['result'][_0xe23f('0x16')]);}})[_0xe23f('0x18')](function(_0x5b0c4d){logger[_0xe23f('0x15')](_0xe23f('0x11'),_0x238a64,_0x5b0c4d);_0x879441(_0x5b0c4d);});});} \ No newline at end of file +var _0x615a=['error','ChatGroup,\x20%s,\x20%s','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','request','then','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x32cd7f,_0x3c7b2a){var _0x197196=function(_0x3e0ebd){while(--_0x3e0ebd){_0x32cd7f['push'](_0x32cd7f['shift']());}};_0x197196(++_0x3c7b2a);}(_0x615a,0x119));var _0xa615=function(_0x2059df,_0x367401){_0x2059df=_0x2059df-0x0;var _0xdd848b=_0x615a[_0x2059df];return _0xdd848b;};'use strict';var _=require(_0xa615('0x0'));var util=require('util');var moment=require(_0xa615('0x1'));var BPromise=require('bluebird');var rs=require(_0xa615('0x2'));var fs=require('fs');var Redis=require(_0xa615('0x3'));var db=require(_0xa615('0x4'))['db'];var utils=require(_0xa615('0x5'));var logger=require('../../config/logger')(_0xa615('0x6'));var config=require(_0xa615('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa615('0x8')]['http']({'port':0x232a});config[_0xa615('0x9')]=_[_0xa615('0xa')](config[_0xa615('0x9')],{'host':_0xa615('0xb'),'port':0x18eb});var socket=require(_0xa615('0xc'))(new Redis(config['redis']));require(_0xa615('0xd'))['register'](socket);function respondWithRpcPromise(_0x2b952d,_0x3fbfe1,_0x5a6664){return new BPromise(function(_0x3b1698,_0xf1cbca){return client[_0xa615('0xe')](_0x2b952d,_0x5a6664)[_0xa615('0xf')](function(_0x2530ec){logger['info']('ChatGroup,\x20%s,\x20%s',_0x3fbfe1,_0xa615('0x10'));logger['debug'](_0xa615('0x11'),_0x3fbfe1,_0xa615('0x10'),JSON[_0xa615('0x12')](_0x2530ec));if(_0x2530ec[_0xa615('0x13')]){if(_0x2530ec['error']['code']===0x1f4){logger[_0xa615('0x13')](_0xa615('0x14'),_0x3fbfe1,_0x2530ec[_0xa615('0x13')][_0xa615('0x15')]);return _0xf1cbca(_0x2530ec[_0xa615('0x13')][_0xa615('0x15')]);}logger[_0xa615('0x13')](_0xa615('0x14'),_0x3fbfe1,_0x2530ec[_0xa615('0x13')][_0xa615('0x15')]);return _0x3b1698(_0x2530ec[_0xa615('0x13')][_0xa615('0x15')]);}else{logger[_0xa615('0x16')](_0xa615('0x14'),_0x3fbfe1,_0xa615('0x10'));_0x3b1698(_0x2530ec[_0xa615('0x17')][_0xa615('0x15')]);}})[_0xa615('0x18')](function(_0x1eb384){logger['error'](_0xa615('0x14'),_0x3fbfe1,_0x1eb384);_0xf1cbca(_0x1eb384);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index c3689b5..06c9a82 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 _0x0fc3=['remove','update','emit','removeListener','register','chatGroup:','./chatGroup.events','save'];(function(_0x58a9ad,_0x4429f2){var _0x52694d=function(_0x5b29bd){while(--_0x5b29bd){_0x58a9ad['push'](_0x58a9ad['shift']());}};_0x52694d(++_0x4429f2);}(_0x0fc3,0x1be));var _0x30fc=function(_0x2f3a2e,_0x40d83d){_0x2f3a2e=_0x2f3a2e-0x0;var _0x1d6975=_0x0fc3[_0x2f3a2e];return _0x1d6975;};'use strict';var ChatGroupEvents=require(_0x30fc('0x0'));var events=[_0x30fc('0x1'),_0x30fc('0x2'),_0x30fc('0x3')];function createListener(_0xc8c333,_0x44d5f9){return function(_0x3c0a19){_0x44d5f9[_0x30fc('0x4')](_0xc8c333,_0x3c0a19);};}function removeListener(_0x374799,_0x1eb147){return function(){ChatGroupEvents[_0x30fc('0x5')](_0x374799,_0x1eb147);};}exports[_0x30fc('0x6')]=function(_0x1a5435){for(var _0x27a92c=0x0,_0x2a6384=events['length'];_0x27a92c<_0x2a6384;_0x27a92c++){var _0x25e5f4=events[_0x27a92c];var _0x31aaf1=createListener(_0x30fc('0x7')+_0x25e5f4,_0x1a5435);ChatGroupEvents['on'](_0x25e5f4,_0x31aaf1);}}; \ No newline at end of file +var _0x6339=['length','chatGroup:','./chatGroup.events','remove','update','emit'];(function(_0x3ae1cc,_0x2ab3e6){var _0x51a273=function(_0x22761a){while(--_0x22761a){_0x3ae1cc['push'](_0x3ae1cc['shift']());}};_0x51a273(++_0x2ab3e6);}(_0x6339,0x98));var _0x9633=function(_0x5c3bce,_0x6a925c){_0x5c3bce=_0x5c3bce-0x0;var _0x38c996=_0x6339[_0x5c3bce];return _0x38c996;};'use strict';var ChatGroupEvents=require(_0x9633('0x0'));var events=['save',_0x9633('0x1'),_0x9633('0x2')];function createListener(_0x4fac89,_0x4b5440){return function(_0x40cc8c){_0x4b5440[_0x9633('0x3')](_0x4fac89,_0x40cc8c);};}function removeListener(_0x18e084,_0x59387d){return function(){ChatGroupEvents['removeListener'](_0x18e084,_0x59387d);};}exports['register']=function(_0x2faaff){for(var _0x344a8e=0x0,_0x4599e3=events[_0x9633('0x4')];_0x344a8e<_0x4599e3;_0x344a8e++){var _0xeca78d=events[_0x344a8e];var _0x2937d4=createListener(_0x9633('0x5')+_0xeca78d,_0x2faaff);ChatGroupEvents['on'](_0xeca78d,_0x2937d4);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 1882123..f03e11e 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 _0xa8b0=['index','describe','/:id','show','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated'];(function(_0x1f7dd8,_0xe3a542){var _0xda8840=function(_0x2999f6){while(--_0x2999f6){_0x1f7dd8['push'](_0x1f7dd8['shift']());}};_0xda8840(++_0xe3a542);}(_0xa8b0,0x150));var _0x0a8b=function(_0x42d1f8,_0x22e529){_0x42d1f8=_0x42d1f8-0x0;var _0x40d234=_0xa8b0[_0x42d1f8];return _0x40d234;};'use strict';var multer=require(_0x0a8b('0x0'));var util=require(_0x0a8b('0x1'));var path=require('path');var timeout=require(_0x0a8b('0x2'));var express=require(_0x0a8b('0x3'));var router=express[_0x0a8b('0x4')]();var fs_extra=require(_0x0a8b('0x5'));var auth=require(_0x0a8b('0x6'));var interaction=require(_0x0a8b('0x7'));var config=require(_0x0a8b('0x8'));var controller=require(_0x0a8b('0x9'));router[_0x0a8b('0xa')]('/',auth[_0x0a8b('0xb')](),controller[_0x0a8b('0xc')]);router[_0x0a8b('0xa')]('/describe',auth[_0x0a8b('0xb')](),controller[_0x0a8b('0xd')]);router[_0x0a8b('0xa')](_0x0a8b('0xe'),auth[_0x0a8b('0xb')](),controller[_0x0a8b('0xf')]);router[_0x0a8b('0xa')]('/:id/unread',auth[_0x0a8b('0xb')](),controller['getUnread']);router[_0x0a8b('0xa')](_0x0a8b('0x10'),auth[_0x0a8b('0xb')](),controller[_0x0a8b('0x11')]);router[_0x0a8b('0xa')](_0x0a8b('0x12'),auth['isAuthenticated'](),controller[_0x0a8b('0x13')]);router[_0x0a8b('0x14')]('/',auth[_0x0a8b('0xb')](),controller[_0x0a8b('0x15')]);router[_0x0a8b('0x14')](_0x0a8b('0x10'),auth['isAuthenticated'](),controller[_0x0a8b('0x16')]);router[_0x0a8b('0x14')](_0x0a8b('0x12'),auth[_0x0a8b('0xb')](),controller[_0x0a8b('0x17')]);router[_0x0a8b('0x18')]('/:id',auth[_0x0a8b('0xb')](),controller[_0x0a8b('0x19')]);router[_0x0a8b('0x1a')](_0x0a8b('0xe'),auth[_0x0a8b('0xb')](),controller[_0x0a8b('0x1b')]);router[_0x0a8b('0x1a')](_0x0a8b('0x10'),auth['isAuthenticated'](),controller['removeMembers']);module[_0x0a8b('0x1c')]=router; \ No newline at end of file +var _0x269d=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','getUnread','/:id/members','getMembers','/:id/messages','post','create','addMembers','addMessage','put','delete','removeMembers','exports','express','Router'];(function(_0x4fa489,_0x4cba6b){var _0x41d2ce=function(_0x364060){while(--_0x364060){_0x4fa489['push'](_0x4fa489['shift']());}};_0x41d2ce(++_0x4cba6b);}(_0x269d,0xbe));var _0xd269=function(_0x2f9922,_0x3eea19){_0x2f9922=_0x2f9922-0x0;var _0x963e1c=_0x269d[_0x2f9922];return _0x963e1c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd269('0x0'));var router=express[_0xd269('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xd269('0x2'));var interaction=require(_0xd269('0x3'));var config=require(_0xd269('0x4'));var controller=require('./chatGroup.controller');router['get']('/',auth[_0xd269('0x5')](),controller[_0xd269('0x6')]);router[_0xd269('0x7')](_0xd269('0x8'),auth['isAuthenticated'](),controller[_0xd269('0x9')]);router[_0xd269('0x7')](_0xd269('0xa'),auth[_0xd269('0x5')](),controller[_0xd269('0xb')]);router[_0xd269('0x7')]('/:id/unread',auth['isAuthenticated'](),controller[_0xd269('0xc')]);router[_0xd269('0x7')](_0xd269('0xd'),auth['isAuthenticated'](),controller[_0xd269('0xe')]);router[_0xd269('0x7')](_0xd269('0xf'),auth[_0xd269('0x5')](),controller['getMessages']);router[_0xd269('0x10')]('/',auth[_0xd269('0x5')](),controller[_0xd269('0x11')]);router[_0xd269('0x10')](_0xd269('0xd'),auth['isAuthenticated'](),controller[_0xd269('0x12')]);router[_0xd269('0x10')](_0xd269('0xf'),auth['isAuthenticated'](),controller[_0xd269('0x13')]);router[_0xd269('0x14')](_0xd269('0xa'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xd269('0x15')](_0xd269('0xd'),auth[_0xd269('0x5')](),controller[_0xd269('0x16')]);module[_0xd269('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index dd84904..7c19fad 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 _0x1228=['sequelize','exports','INTEGER','ENUM','star','TEXT','STRING','long','DATE','BOOLEAN'];(function(_0x2757f8,_0xb3ded1){var _0x36aab9=function(_0x439dbe){while(--_0x439dbe){_0x2757f8['push'](_0x2757f8['shift']());}};_0x36aab9(++_0xb3ded1);}(_0x1228,0x1a4));var _0x8122=function(_0x474cc5,_0x57be85){_0x474cc5=_0x474cc5-0x0;var _0x51e42e=_0x1228[_0x474cc5];return _0x51e42e;};'use strict';var Sequelize=require(_0x8122('0x0'));module[_0x8122('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x8122('0x2')]},'ratingType':{'type':Sequelize[_0x8122('0x3')](_0x8122('0x4'),'thumb'),'defaultValue':_0x8122('0x4')},'ratingMessage':{'type':Sequelize[_0x8122('0x5')]},'pathTranscript':{'type':Sequelize[_0x8122('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8122('0x6')]},'secondDisposition':{'type':Sequelize[_0x8122('0x6')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x8122('0x6')]},'browserVersion':{'type':Sequelize[_0x8122('0x6')]},'osName':{'type':Sequelize[_0x8122('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x8122('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x8122('0x6')]},'referer':{'type':Sequelize[_0x8122('0x5')]},'customerIp':{'type':Sequelize[_0x8122('0x6')]},'formData':{'type':Sequelize[_0x8122('0x5')](_0x8122('0x7'))},'read1stAt':{'type':Sequelize[_0x8122('0x8')]},'lastMsgAt':{'type':Sequelize[_0x8122('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x8122('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x8122('0x6')]},'customerPort':{'type':Sequelize[_0x8122('0x6')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x8122('0x9')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x8122('0x2')]}}; \ No newline at end of file +var _0x60d3=['STRING','DATE','TEXT','long','BOOLEAN','INTEGER','ENUM','star','thumb'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x60d3,0xc1));var _0x360d=function(_0x26b622,_0x237e9e){_0x26b622=_0x26b622-0x0;var _0x58a028=_0x60d3[_0x26b622];return _0x58a028;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x360d('0x0')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x360d('0x1')]},'ratingType':{'type':Sequelize[_0x360d('0x2')](_0x360d('0x3'),_0x360d('0x4')),'defaultValue':_0x360d('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x360d('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x360d('0x6')]},'disposition':{'type':Sequelize[_0x360d('0x5')]},'secondDisposition':{'type':Sequelize[_0x360d('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x360d('0x5')]},'browserName':{'type':Sequelize[_0x360d('0x5')]},'browserVersion':{'type':Sequelize[_0x360d('0x5')]},'osName':{'type':Sequelize[_0x360d('0x5')]},'osVersion':{'type':Sequelize[_0x360d('0x5')]},'deviceModel':{'type':Sequelize[_0x360d('0x5')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x360d('0x5')]},'referer':{'type':Sequelize[_0x360d('0x7')]},'customerIp':{'type':Sequelize[_0x360d('0x5')]},'formData':{'type':Sequelize[_0x360d('0x7')](_0x360d('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x360d('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x360d('0x2')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x360d('0x5')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x360d('0x0')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 23d0685..90c6e55 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 _0x0138=['attachments','transcript-%d-%s.zip','firstName','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','toString','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','read','value','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','moment','mustache','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatInteraction,\x20%s,\x20%s','result','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','update','destroy','then','stack','name','render','merge','body','contact','interaction','account','index','map','ChatInteraction','rawAttributes','type','key','getOptions','chat','query','show','params','model','keys','filters','attributes','intersection','fields','includeAll','include','options','find','create','describe','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooMetadata','user','fullname','email','POST','vidaooNote','follow','isNull','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','disposition','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','closed','Unauthorized','attachId','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','download','mailTranscript','root','format','transcript-%s.txt','pathTranscript','Messages','User','ContactId','%s%d','agentAlias','customer','Visitor','agentIdentifier','website_alias','System','agent_alias','alias','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailServerOut','Smtp','CloudProvider','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','length','hasOwnProperty','nolimit','sort','where','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','getMyMessages','order','pick','ChatInteractionId','includeAgent','push','addTags','omit','spread','color','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp'];(function(_0x3b48ab,_0x3982d1){var _0x36c993=function(_0x2d0046){while(--_0x2d0046){_0x3b48ab['push'](_0x3b48ab['shift']());}};_0x36c993(++_0x3982d1);}(_0x0138,0xf4));var _0x8013=function(_0x5a12d3,_0x1170aa){_0x5a12d3=_0x5a12d3-0x0;var _0xb282fc=_0x0138[_0x5a12d3];return _0xb282fc;};'use strict';var rimraf=require(_0x8013('0x0'));var zipdir=require(_0x8013('0x1'));var rp=require('request-promise');var moment=require(_0x8013('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8013('0x3'));var util=require(_0x8013('0x4'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8013('0x5'));var Redis=require(_0x8013('0x6'));var interaction=require(_0x8013('0x7'));var qs=require(_0x8013('0x8'));var pdf=require(_0x8013('0x9'));var logger=require('../../config/logger')(_0x8013('0xa'));var config=require(_0x8013('0xb'));var db=require('../../mysqldb')['db'];config[_0x8013('0xc')]=_[_0x8013('0xd')](config[_0x8013('0xc')],{'host':_0x8013('0xe'),'port':0x18eb});var socket=require(_0x8013('0xf'))(new Redis(config[_0x8013('0xc')]));require('./chatInteraction.socket')[_0x8013('0x10')](socket);var jayson=require(_0x8013('0x11'));var client=jayson[_0x8013('0x12')]['http']({'port':0x232b});var client9004=jayson[_0x8013('0x12')][_0x8013('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x27e9bd,_0x4172ab,_0x335154,_0x1471ef){return new BPromise(function(_0xa0593d,_0x30d513){var _0x907a73=_0x1471ef||client;return _0x907a73[_0x8013('0x14')](_0x27e9bd,_0x335154)['then'](function(_0x49455f){logger[_0x8013('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x4172ab,_0x8013('0x16'));logger[_0x8013('0x17')](_0x8013('0x18'),_0x4172ab,'request\x20sent',JSON[_0x8013('0x19')](_0x49455f));if(_0x49455f[_0x8013('0x1a')]){if(_0x49455f[_0x8013('0x1a')][_0x8013('0x1b')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x4172ab,_0x49455f[_0x8013('0x1a')][_0x8013('0x1c')]);return _0x30d513(_0x49455f[_0x8013('0x1a')]['message']);}logger[_0x8013('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x4172ab,_0x49455f[_0x8013('0x1a')]['message']);return _0xa0593d(_0x49455f[_0x8013('0x1a')][_0x8013('0x1c')]);}else{logger[_0x8013('0x15')](_0x8013('0x1d'),_0x4172ab,_0x8013('0x16'));_0xa0593d(_0x49455f[_0x8013('0x1e')][_0x8013('0x1c')]);}})[_0x8013('0x1f')](function(_0xd099c0){logger['error'](_0x8013('0x1d'),_0x4172ab,_0xd099c0);_0x30d513(_0xd099c0);});});}function respondWithStatusCode(_0x1c00bf,_0x2f6684){_0x2f6684=_0x2f6684||0xcc;return function(_0x318b7d){if(_0x318b7d){return _0x1c00bf[_0x8013('0x20')](_0x2f6684);}return _0x1c00bf[_0x8013('0x21')](_0x2f6684)[_0x8013('0x22')]();};}function respondWithResult(_0x4912d8,_0x1ef7eb){_0x1ef7eb=_0x1ef7eb||0xc8;return function(_0x44033d){if(_0x44033d){return _0x4912d8['status'](_0x1ef7eb)['json'](_0x44033d);}};}function respondWithFilteredResult(_0x54ef1f,_0x425170){return function(_0x3c7aed){if(_0x3c7aed){var _0x2d612f=typeof _0x425170[_0x8013('0x23')]===_0x8013('0x24')&&typeof _0x425170['limit']===_0x8013('0x24');var _0x497776=_0x3c7aed[_0x8013('0x25')];var _0x501492=_0x2d612f?0x0:_0x425170[_0x8013('0x23')];var _0x5b5e8e=_0x2d612f?_0x3c7aed[_0x8013('0x25')]:_0x425170[_0x8013('0x23')]+_0x425170[_0x8013('0x26')];var _0xbf6e61;if(_0x5b5e8e>=_0x497776){_0x5b5e8e=_0x497776;_0xbf6e61=0xc8;}else{_0xbf6e61=0xce;}_0x54ef1f[_0x8013('0x21')](_0xbf6e61);return _0x54ef1f[_0x8013('0x27')](_0x8013('0x28'),_0x501492+'-'+_0x5b5e8e+'/'+_0x497776)[_0x8013('0x29')](_0x3c7aed);}return null;};}function saveUpdates(_0x21530f){return function(_0x1cb2bc){if(_0x1cb2bc){return _0x1cb2bc[_0x8013('0x2a')](_0x21530f)['then'](function(_0x116b80){return _0x116b80;});}return null;};}function removeEntity(_0x53b9f){return function(_0x152b85){if(_0x152b85){return _0x152b85[_0x8013('0x2b')]()[_0x8013('0x2c')](function(){_0x53b9f[_0x8013('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cc5b9){return function(_0x5b8371){if(!_0x5b8371){_0x4cc5b9[_0x8013('0x20')](0x194);}return _0x5b8371;};}function handleError(_0x1ece5a,_0x45197f){_0x45197f=_0x45197f||0x1f4;return function(_0xda9521){logger[_0x8013('0x1a')](_0xda9521[_0x8013('0x2d')]);if(_0xda9521[_0x8013('0x2e')]){delete _0xda9521['name'];}_0x1ece5a[_0x8013('0x21')](_0x45197f)['send'](_0xda9521);};}function getMustacheRender(_0xb79fc8,_0x191fb2){return Mustache[_0x8013('0x2f')](_0xb79fc8,_[_0x8013('0x30')](_0x191fb2[_0x8013('0x31')],{'contact':_0x191fb2[_0x8013('0x32')],'message':_0x191fb2[_0x8013('0x1c')],'agent':_0x191fb2['agent'],'interaction':_0x191fb2[_0x8013('0x33')],'account':_0x191fb2[_0x8013('0x34')]}))||'';}exports[_0x8013('0x35')]=function(_0x37b4ba,_0x415b9a){var _0x2c1544={};var _0xb9cb2=_[_0x8013('0x36')](db[_0x8013('0x37')][_0x8013('0x38')],function(_0x4994e3){return{'name':_0x4994e3['fieldName'],'type':_0x4994e3[_0x8013('0x39')][_0x8013('0x3a')]};});_0x2c1544=qs[_0x8013('0x3b')](_0xb9cb2,_0x37b4ba);return interaction['findAll'](_0x8013('0x3c'),_0x37b4ba[_0x8013('0x3d')],_0x37b4ba['user'],_0x2c1544,_0xb9cb2)[_0x8013('0x2c')](respondWithFilteredResult(_0x415b9a,_0x2c1544))[_0x8013('0x1f')](handleError(_0x415b9a,null));};exports[_0x8013('0x3e')]=function(_0x2d7ede,_0x2e12a2){var _0x1d9583={'raw':![],'where':{'id':_0x2d7ede[_0x8013('0x3f')]['id']}},_0x556178={};_0x556178[_0x8013('0x40')]=_[_0x8013('0x41')](db[_0x8013('0x37')][_0x8013('0x38')]);_0x556178[_0x8013('0x3d')]=_[_0x8013('0x41')](_0x2d7ede['query']);_0x556178[_0x8013('0x42')]=_['intersection'](_0x556178[_0x8013('0x40')],_0x556178[_0x8013('0x3d')]);_0x1d9583[_0x8013('0x43')]=_[_0x8013('0x44')](_0x556178[_0x8013('0x40')],qs[_0x8013('0x45')](_0x2d7ede['query'][_0x8013('0x45')]));_0x1d9583[_0x8013('0x43')]=_0x1d9583['attributes']['length']?_0x1d9583[_0x8013('0x43')]:_0x556178[_0x8013('0x40')];if(_0x2d7ede[_0x8013('0x3d')][_0x8013('0x46')]){_0x1d9583[_0x8013('0x47')]=[{'all':!![]}];}_0x1d9583=_['merge']({},_0x1d9583,_0x2d7ede[_0x8013('0x48')]);return db[_0x8013('0x37')][_0x8013('0x49')](_0x1d9583)[_0x8013('0x2c')](handleEntityNotFound(_0x2e12a2,null))['then'](respondWithResult(_0x2e12a2,null))[_0x8013('0x1f')](handleError(_0x2e12a2,null));};exports[_0x8013('0x4a')]=function(_0x7b250c,_0x1aa9f6){return db[_0x8013('0x37')][_0x8013('0x4a')](_0x7b250c['body'],{})[_0x8013('0x2c')](respondWithResult(_0x1aa9f6,0xc9))[_0x8013('0x1f')](handleError(_0x1aa9f6,null));};exports[_0x8013('0x2a')]=function(_0x3ff5ca,_0x2cbd69){if(_0x3ff5ca[_0x8013('0x31')]['id']){delete _0x3ff5ca[_0x8013('0x31')]['id'];}return db['ChatInteraction'][_0x8013('0x49')]({'where':{'id':_0x3ff5ca['params']['id']}})[_0x8013('0x2c')](handleEntityNotFound(_0x2cbd69,null))[_0x8013('0x2c')](saveUpdates(_0x3ff5ca[_0x8013('0x31')],null))[_0x8013('0x2c')](respondWithResult(_0x2cbd69,null))[_0x8013('0x1f')](handleError(_0x2cbd69,null));};exports[_0x8013('0x2b')]=function(_0x2951a9,_0x1d7633){return db[_0x8013('0x37')][_0x8013('0x49')]({'where':{'id':_0x2951a9[_0x8013('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1d7633,null))[_0x8013('0x2c')](removeEntity(_0x1d7633,null))[_0x8013('0x1f')](handleError(_0x1d7633,null));};exports[_0x8013('0x4b')]=function(_0x1231e0,_0x201d67){return db[_0x8013('0x37')]['describe']()[_0x8013('0x2c')](respondWithResult(_0x201d67,null))['catch'](handleError(_0x201d67,null));};exports['createVidaooSession']=function(_0x8ec26b,_0x29cc43){var _0x72b21b=_0x8ec26b[_0x8013('0x3f')]['id'];var _0x164a99;var _0x3ba278;var _0x5662e9;return db[_0x8013('0x37')][_0x8013('0x4c')]({'where':{'id':_0x72b21b}})[_0x8013('0x2c')](function(_0x30a1fa){_0x164a99=_0x30a1fa;return db[_0x8013('0x4d')]['findOne']({'where':{'id':_0x30a1fa[_0x8013('0x4e')]},'attributes':['id',_0x8013('0x4f'),_0x8013('0x50'),'vidaooTopic','vidaooNote',_0x8013('0x51')],'raw':!![]});})[_0x8013('0x2c')](function(_0x194f29){if(_0x194f29&&_0x194f29[_0x8013('0x4f')]&&_0x194f29[_0x8013('0x50')]){_0x3ba278=_0x194f29;var _0x5bb899={'interaction':{'id':_0x72b21b},'agent':{'id':_0x8ec26b['user']['id'],'name':_0x8ec26b[_0x8013('0x52')]['name'],'fullname':_0x8ec26b[_0x8013('0x52')][_0x8013('0x53')],'email':_0x8ec26b[_0x8013('0x52')][_0x8013('0x54')]},'contact':_0x8ec26b[_0x8013('0x31')][_0x8013('0x32')],'account':_0x8ec26b[_0x8013('0x31')][_0x8013('0x34')]};var _0x8fb350={'rejectUnauthorized':![],'method':_0x8013('0x55'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x194f29[_0x8013('0x4f')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x8ec26b[_0x8013('0x52')]['email']],'buttons':null,'topic':_0x3ba278['vidaooTopic'],'note':_['isNull'](_0x3ba278['vidaooNote'])?null:getMustacheRender(_0x3ba278[_0x8013('0x56')],_0x5bb899),'metadata':null},'redirect':_0x8013('0x57'),'json':!![]};try{if(!_[_0x8013('0x58')](_0x3ba278[_0x8013('0x51')])){var _0x44621e=getMustacheRender(_0x3ba278[_0x8013('0x51')],_0x5bb899);var _0x13123e=JSON['parse'](_0x44621e);_0x8fb350[_0x8013('0x31')][_0x8013('0x59')]=_0x13123e;}}catch(_0x21bea5){throw new db[(_0x8013('0x5a'))]['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x8fb350);}else{throw new db[(_0x8013('0x5a'))][(_0x8013('0x5b'))](_0x8013('0x5c'));}})[_0x8013('0x2c')](function(_0x2f5f64){_0x5662e9=_0x2f5f64;if(_0x5662e9['id']){var _0x1e8c7b={'body':_0x5662e9[_0x8013('0x5d')],'ChatWebsiteId':_0x3ba278['id'],'ChatInteractionId':_0x164a99['id'],'direction':_0x8013('0x5e'),'UserId':_0x8ec26b[_0x8013('0x52')]['id']};return db[_0x8013('0x5f')][_0x8013('0x4a')](_0x1e8c7b,{});}else{throw new db['Sequelize']['ValidationError'](_0x8013('0x60'));}})[_0x8013('0x2c')](function(){return _0x164a99[_0x8013('0x61')]({'vidaooSessionId':_0x5662e9['id']});})[_0x8013('0x2c')](respondWithResult(_0x29cc43,null))[_0x8013('0x1f')](handleError(_0x29cc43,null));};exports[_0x8013('0x62')]=function(_0x3021fb,_0x3548bf){if(_0x3021fb[_0x8013('0x31')]['id']){delete _0x3021fb[_0x8013('0x31')]['id'];}return db[_0x8013('0x37')][_0x8013('0x49')]({'where':{'id':_0x3021fb['params']['id']},'include':[{'model':db[_0x8013('0x63')],'as':_0x8013('0x64')}]})[_0x8013('0x2c')](handleEntityNotFound(_0x3548bf,null))['then'](saveUpdates(_0x3021fb['body'],null))['then'](respondWithResult(_0x3548bf,null))[_0x8013('0x1f')](handleError(_0x3548bf,null));};exports[_0x8013('0x65')]=function(_0x422bc1,_0x48a10a){if(_0x422bc1[_0x8013('0x31')]['id']){delete _0x422bc1[_0x8013('0x31')]['id'];}return db['ChatInteraction'][_0x8013('0x49')]({'where':{'id':_0x422bc1[_0x8013('0x3f')]['id']}})[_0x8013('0x2c')](function(_0x1e5273){if(!_0x1e5273){logger[_0x8013('0x1a')](_0x8013('0x66'),'abandon',0x194,_0x8013('0x67'));_0x48a10a[_0x8013('0x20')](0x194);}else{if(_0x1e5273[_0x8013('0x68')]){throw new db[(_0x8013('0x5a'))][(_0x8013('0x5b'))](_0x8013('0x69'));}}return _0x1e5273;})[_0x8013('0x2c')](function(_0x14e634){if(_0x14e634){return _0x14e634[_0x8013('0x2a')]({'closed':_0x422bc1[_0x8013('0x31')]['closed'],'disposition':_0x422bc1['body'][_0x8013('0x6a')]})[_0x8013('0x2c')](function(_0x1f9890){return _0x1f9890;});}})['then'](function(){return respondWithRpcPromise('AbandonInteraction',_0x8013('0x65'),_0x422bc1[_0x8013('0x31')],client9004);})[_0x8013('0x2c')](respondWithResult(_0x48a10a,null))[_0x8013('0x1f')](handleError(_0x48a10a,null));};exports[_0x8013('0x6b')]=function(_0x2bed1b,_0x5d589a){_0x2bed1b[_0x8013('0x31')]['name']=_0x2bed1b[_0x8013('0x6c')][_0x8013('0x6d')];_0x2bed1b[_0x8013('0x31')][_0x8013('0x6e')]=_0x2bed1b['file'][_0x8013('0x6f')];_0x2bed1b['body'][_0x8013('0x39')]=_0x2bed1b['file'][_0x8013('0x70')];return db[_0x8013('0x71')][_0x8013('0x4a')](_0x2bed1b[_0x8013('0x31')])[_0x8013('0x2c')](respondWithResult(_0x5d589a,0xc9))[_0x8013('0x1f')](handleError(_0x5d589a,null));};exports[_0x8013('0x72')]=function(_0x49f1a5,_0x12d828){return db[_0x8013('0x37')]['findOne']({'where':{'id':_0x49f1a5[_0x8013('0x3f')]['id']},'raw':!![]})[_0x8013('0x2c')](handleEntityNotFound(_0x12d828,null))[_0x8013('0x2c')](function(_0x1a4d98){if(_0x1a4d98){if(_0x1a4d98[_0x8013('0x73')]){return _0x12d828['status'](0x193)['json']({'status':0x193,'message':_0x8013('0x74')});}return db[_0x8013('0x71')][_0x8013('0x4c')]({'where':{'id':_0x49f1a5[_0x8013('0x3d')][_0x8013('0x75')]},'raw':!![]})['then'](handleEntityNotFound(_0x12d828,null));}})[_0x8013('0x2c')](function(_0x58b01d){if(_0x58b01d){var _0x386df1=_0x58b01d[_0x8013('0x76')]!==null;var _0x165165=path[_0x8013('0x77')](config['root'],_0x8013('0x78'));if(_0x386df1){_0x165165=path[_0x8013('0x77')](_0x165165,_0x8013('0x79'));}var _0x2bfad3=path[_0x8013('0x77')](_0x165165,_0x58b01d[_0x8013('0x6e')]);return _0x12d828[_0x8013('0x7a')](_0x2bfad3);}})['catch'](handleError(_0x12d828,null));};exports['close']=function(_0x18ece3,_0x189edf){var _0x5c2adf=null;var _0x45ad1e=null;var _0x491403=null;if(_0x18ece3[_0x8013('0x31')]['id']){delete _0x18ece3[_0x8013('0x31')]['id'];}if(_0x18ece3[_0x8013('0x31')][_0x8013('0x7b')]){_0x491403=path[_0x8013('0x77')](config[_0x8013('0x7c')],'server/files/chat/upload/',util[_0x8013('0x7d')](_0x8013('0x7e'),Date['now']()));_0x18ece3['body'][_0x8013('0x7f')]=_0x491403;}return db['ChatInteraction'][_0x8013('0x49')]({'where':{'id':_0x18ece3['params']['id']},'include':[{'model':db[_0x8013('0x5f')],'as':_0x8013('0x80'),'include':[{'model':db[_0x8013('0x81')],'as':_0x8013('0x81')}]}]})[_0x8013('0x2c')](handleEntityNotFound(_0x189edf,null))[_0x8013('0x2c')](saveUpdates(_0x18ece3[_0x8013('0x31')],null))[_0x8013('0x2c')](function(_0x319083){if(_0x319083){_0x5c2adf=_0x319083;return db[_0x8013('0x4d')]['find']({'where':{'id':_0x5c2adf[_0x8013('0x4e')]}});}})[_0x8013('0x2c')](function(_0x4bbc3d){if(_0x4bbc3d){_0x45ad1e=_0x4bbc3d;return db[_0x8013('0x63')][_0x8013('0x49')]({'where':{'id':_0x5c2adf[_0x8013('0x82')]}});}})['then'](function(_0x268b70){if(_0x268b70){if(_0x491403){var _0x3159b4=null;for(var _0x8126cf=0x1;_0x8126cf<_0x5c2adf[_0x8013('0x80')]['length'];++_0x8126cf){_0x3159b4=_0x5c2adf[_0x8013('0x80')][_0x8126cf];var _0x182509=_0x3159b4[_0x8013('0x68')]?util[_0x8013('0x7d')](_0x8013('0x83'),_0x45ad1e[_0x8013('0x84')],_0x3159b4[_0x8013('0x68')]):'System';var _0x132751=_0x18ece3[_0x8013('0x31')][_0x8013('0x85')]||util['format'](_0x8013('0x83'),_0x8013('0x86'),_0x3159b4['ContactId']);switch(_0x45ad1e[_0x8013('0x87')]){case _0x8013('0x88'):_0x182509=_0x3159b4['UserId']?util['format'](_0x8013('0x83'),_0x45ad1e[_0x8013('0x84')],_0x3159b4['UserId']):_0x8013('0x89');break;case _0x8013('0x8a'):_0x182509=_0x3159b4[_0x8013('0x68')]?_0x3159b4[_0x8013('0x81')][_0x8013('0x8b')]||_0x3159b4[_0x8013('0x81')]['fullname']:_0x8013('0x89');break;case'agent_fullname':_0x182509=_0x3159b4[_0x8013('0x68')]?_0x3159b4['User'][_0x8013('0x53')]:_0x8013('0x89');break;default:_0x182509=_0x3159b4[_0x8013('0x68')]?util['format'](_0x8013('0x83'),_0x45ad1e[_0x8013('0x84')],_0x3159b4[_0x8013('0x68')]):_0x8013('0x89');}var _0x376097=util[_0x8013('0x7d')]('[%s]\x20%s:\x20%s\x0a',moment(_0x3159b4[_0x8013('0x8c')])['format'](_0x8013('0x8d')),_0x3159b4[_0x8013('0x8e')]==='in'?_0x132751:_0x182509,_0x3159b4['body']);if(!_0x3159b4[_0x8013('0x8f')]){fs['appendFileSync'](_0x491403,_0x376097);}}return db['MailAccount'][_0x8013('0x4c')]({'where':{'service':!![]},'include':[{'model':db[_0x8013('0x90')],'as':_0x8013('0x91'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x8013('0x92'),'raw':!![]}]}]});}}})[_0x8013('0x2c')](function(_0xdedef){if(!_0xdedef||!_0xdedef[_0x8013('0x91')]||!_0x18ece3[_0x8013('0x31')])return _0x5c2adf;var _0x47d10=_0xdedef[_0x8013('0x93')]();return respondWithRpcPromise('SendMail',_0x8013('0x94'),{'account':_0x47d10,'message':{'from':util[_0x8013('0x7d')](_0x8013('0x95'),_0xdedef[_0x8013('0x2e')],_0xdedef['email']||_0xdedef[_0x8013('0x91')][_0x8013('0x52')]),'to':_0x18ece3[_0x8013('0x31')]['mailTranscript'],'subject':_0x8013('0x96'),'text':util[_0x8013('0x7d')](_0x8013('0x97'),_0x18ece3[_0x8013('0x31')]['mailTranscript']),'attachments':[{'path':_0x491403}]}})[_0x8013('0x2c')](function(){return _0x5c2adf;})['catch'](function(_0x460dab){logger[_0x8013('0x1a')](_0x460dab);});})[_0x8013('0x2c')](respondWithStatusCode(_0x189edf,0xc8))[_0x8013('0x1f')](handleError(_0x189edf,null));};exports[_0x8013('0x98')]=function(_0x147c27,_0x68d845){return db[_0x8013('0x5f')][_0x8013('0x49')]({'where':{'id':_0x147c27['params']['id']}})[_0x8013('0x2c')](handleEntityNotFound(_0x68d845,null))[_0x8013('0x2c')](function(_0x3391ea){if(_0x3391ea){return _0x3391ea['addMessage'](_0x147c27[_0x8013('0x31')]['ids'],_['omit'](_0x147c27[_0x8013('0x31')],[_0x8013('0x99'),'id'])||{});}})[_0x8013('0x2c')](respondWithResult(_0x68d845,null))[_0x8013('0x1f')](handleError(_0x68d845,null));};exports[_0x8013('0x9a')]=function(_0x21c483,_0x2f9229){var _0x370f84={'raw':![],'where':{}};var _0x1e3fce={};var _0x4314d1={'count':0x0,'rows':[]};return db[_0x8013('0x37')][_0x8013('0x4c')]({'where':{'id':_0x21c483[_0x8013('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2f9229,null))[_0x8013('0x2c')](function(_0x351597){if(_0x351597){_0x1e3fce[_0x8013('0x40')]=_[_0x8013('0x41')](db['ChatMessage']['rawAttributes']);_0x1e3fce[_0x8013('0x3d')]=_[_0x8013('0x41')](_0x21c483['query']);_0x1e3fce[_0x8013('0x42')]=_['intersection'](_0x1e3fce['model'],_0x1e3fce[_0x8013('0x3d')]);_0x370f84['attributes']=_[_0x8013('0x44')](_0x1e3fce[_0x8013('0x40')],qs[_0x8013('0x45')](_0x21c483[_0x8013('0x3d')]['fields']));_0x370f84[_0x8013('0x43')]=_0x370f84[_0x8013('0x43')][_0x8013('0x9b')]?_0x370f84[_0x8013('0x43')]:_0x1e3fce[_0x8013('0x40')];if(!_0x21c483[_0x8013('0x3d')][_0x8013('0x9c')](_0x8013('0x9d'))){_0x370f84[_0x8013('0x26')]=qs['limit'](_0x21c483[_0x8013('0x3d')][_0x8013('0x26')]);_0x370f84[_0x8013('0x23')]=qs['offset'](_0x21c483[_0x8013('0x3d')][_0x8013('0x23')]);}_0x370f84['order']=qs[_0x8013('0x9e')](_0x21c483[_0x8013('0x3d')][_0x8013('0x9e')]);_0x370f84[_0x8013('0x9f')]=qs['filters'](_['pick'](_0x21c483[_0x8013('0x3d')],_0x1e3fce[_0x8013('0x42')]));_0x370f84[_0x8013('0x9f')]['ChatInteractionId']=_0x351597['id'];if(_0x21c483[_0x8013('0x3d')][_0x8013('0xa0')]){_0x370f84[_0x8013('0x9f')]=_[_0x8013('0x30')](_0x370f84[_0x8013('0x9f')],{'$or':_[_0x8013('0x36')](_0x370f84[_0x8013('0x43')],function(_0x1218b2){var _0x1c34f0={};_0x1c34f0[_0x1218b2]={'$like':'%'+_0x21c483[_0x8013('0x3d')]['filter']+'%'};return _0x1c34f0;})});}if(_0x21c483['query'][_0x8013('0xa1')]){var _0x5027c6=_0x21c483[_0x8013('0x3d')]['$gte']['split'](',');var _0x3a4878={};_0x3a4878[_0x5027c6[0x0]]={'$gte':moment(_0x5027c6[0x1])[_0x8013('0x7d')](_0x8013('0xa2'))};_0x370f84['where']=_[_0x8013('0x30')](_0x370f84[_0x8013('0x9f')],_0x3a4878);}_0x370f84=_[_0x8013('0x30')]({},_0x370f84,_0x21c483[_0x8013('0x48')]);return db[_0x8013('0x5f')][_0x8013('0x25')]({'where':_0x370f84[_0x8013('0x9f')]})[_0x8013('0x2c')](function(_0x17265d){_0x4314d1['count']=_0x17265d;if(_0x21c483[_0x8013('0x3d')][_0x8013('0x46')]){_0x370f84[_0x8013('0x47')]=[{'all':!![]}];}return db[_0x8013('0x5f')][_0x8013('0xa3')](_0x370f84);})[_0x8013('0x2c')](function(_0x546ddf){_0x4314d1[_0x8013('0xa4')]=_0x546ddf;return _0x4314d1;});}})[_0x8013('0x2c')](respondWithFilteredResult(_0x2f9229,_0x370f84))[_0x8013('0x1f')](handleError(_0x2f9229,null));};exports[_0x8013('0xa5')]=function(_0x1adc56,_0x3f8998){var _0x1b9822={'where':{}},_0x4c4e57={},_0xb99ed={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x8013('0x4c')]({'where':{'id':_0x1adc56[_0x8013('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3f8998,null))[_0x8013('0x2c')](function(_0x9c12af){if(_0x9c12af){_0x4c4e57[_0x8013('0x40')]=_[_0x8013('0x41')](db[_0x8013('0x5f')][_0x8013('0x38')]);_0x4c4e57[_0x8013('0x3d')]=_['keys'](_0x1adc56[_0x8013('0x3d')]);_0x4c4e57[_0x8013('0x42')]=_[_0x8013('0x44')](_0x4c4e57[_0x8013('0x40')],_0x4c4e57[_0x8013('0x3d')]);_0x1b9822['attributes']=_[_0x8013('0x44')](_0x4c4e57[_0x8013('0x40')],qs['fields'](_0x1adc56[_0x8013('0x3d')][_0x8013('0x45')]));_0x1b9822[_0x8013('0x43')]=_0x1b9822[_0x8013('0x43')][_0x8013('0x9b')]?_0x1b9822[_0x8013('0x43')]:_0x4c4e57['model'];if(!_0x1adc56[_0x8013('0x3d')]['hasOwnProperty']('nolimit')){_0x1b9822[_0x8013('0x26')]=qs[_0x8013('0x26')](_0x1adc56[_0x8013('0x3d')][_0x8013('0x26')]);_0x1b9822['offset']=qs[_0x8013('0x23')](_0x1adc56['query'][_0x8013('0x23')]);}_0x1b9822[_0x8013('0xa6')]=qs[_0x8013('0x9e')](_0x1adc56['query']['sort']);_0x1b9822[_0x8013('0x9f')]=qs[_0x8013('0x42')](_[_0x8013('0xa7')](_0x1adc56[_0x8013('0x3d')],_0x4c4e57[_0x8013('0x42')]));_0x1b9822['where'][_0x8013('0xa8')]=_0x9c12af['id'];if(_0x1adc56[_0x8013('0x3d')][_0x8013('0xa0')]){_0x1b9822[_0x8013('0x9f')]=_[_0x8013('0x30')](_0x1b9822[_0x8013('0x9f')],{'$or':_[_0x8013('0x36')](_0x1b9822['attributes'],function(_0xd0aacf){var _0x30a60d={};_0x30a60d[_0xd0aacf]={'$like':'%'+_0x1adc56[_0x8013('0x3d')][_0x8013('0xa0')]+'%'};return _0x30a60d;})});}_0x1b9822['where'][_0x8013('0x8f')]=![];if(_0x1adc56[_0x8013('0x3d')]['id']){_0x1b9822['where']['id']={'$gt':_0x1adc56[_0x8013('0x3d')]['id']};}_0x1b9822=_[_0x8013('0x30')]({},_0x1b9822,_0x1adc56['options']);return db[_0x8013('0x5f')][_0x8013('0x25')]({'where':_0x1b9822['where']})[_0x8013('0x2c')](function(_0xfdc0ec){_0xb99ed[_0x8013('0x25')]=_0xfdc0ec;_0x1b9822['include']=[];if(_0x1adc56[_0x8013('0x3d')][_0x8013('0xa9')]){_0x1b9822[_0x8013('0x47')][_0x8013('0xaa')]({'model':db['User'],'as':'User','attributes':['id',_0x8013('0x53'),'alias']});}if(_0x1adc56[_0x8013('0x3d')][_0x8013('0x46')]){_0x1b9822[_0x8013('0x47')]=[{'all':!![]}];}return db[_0x8013('0x5f')][_0x8013('0xa3')](_0x1b9822);})['then'](function(_0x36896b){_0xb99ed[_0x8013('0xa4')]=_0x36896b;return _0xb99ed;});}})[_0x8013('0x2c')](respondWithFilteredResult(_0x3f8998,_0x1b9822))[_0x8013('0x1f')](handleError(_0x3f8998,null));};exports[_0x8013('0xab')]=function(_0x3355fb,_0xf88343){return db['ChatInteraction'][_0x8013('0x49')]({'where':{'id':_0x3355fb['params']['id']}})[_0x8013('0x2c')](handleEntityNotFound(_0xf88343,null))[_0x8013('0x2c')](function(_0x35f36f){if(_0x35f36f){return _0x35f36f['setTags'](_0x3355fb[_0x8013('0x31')][_0x8013('0x99')],_[_0x8013('0xac')](_0x3355fb['body'],[_0x8013('0x99'),'id'])||{})[_0x8013('0xad')](function(){return db['Tag'][_0x8013('0xa3')]({'attributes':['id',_0x8013('0x2e'),_0x8013('0xae')],'where':{'id':_0x3355fb[_0x8013('0x31')]['ids']}});})['then'](function(_0xd1657d){socket[_0x8013('0xaf')](_0x8013('0xb0'),{'id':Number(_0x3355fb[_0x8013('0x3f')]['id']),'tags':_0xd1657d||[]});return{'id':Number(_0x3355fb['params']['id']),'tags':_0xd1657d||[]};});}})[_0x8013('0x2c')](respondWithResult(_0xf88343,null))['catch'](handleError(_0xf88343,null));};exports[_0x8013('0xb1')]=function(_0xec0146,_0x327c81){return db[_0x8013('0x37')][_0x8013('0x49')]({'where':{'id':_0xec0146[_0x8013('0x3f')]['id']}})[_0x8013('0x2c')](handleEntityNotFound(_0x327c81,null))['then'](function(_0x3b97f3){if(_0x3b97f3){return _0x3b97f3[_0x8013('0xb1')](_0xec0146['query'][_0x8013('0x99')]);}})[_0x8013('0x2c')](respondWithStatusCode(_0x327c81,null))[_0x8013('0x1f')](handleError(_0x327c81,null));};exports[_0x8013('0x7a')]=function(_0x8745a6,_0x21c0ef){var _0x142225=moment()[_0x8013('0xb2')]()['toString']();var _0x5b838b=path['join'](config[_0x8013('0x7c')],_0x8013('0xb3'),_0x8013('0xb4'),_0x8013('0xb5'));var _0x349c79=path[_0x8013('0x77')](config[_0x8013('0x7c')],_0x8013('0xb3'),_0x8013('0xb4'),_0x8013('0xb6'));var _0x152106=path[_0x8013('0x77')](_0x5b838b,_0x142225);var _0x150729=util['format'](_0x8013('0xb7'),_0x8745a6[_0x8013('0x3f')]['id'],_0x142225);var _0x5a6fa1=path[_0x8013('0x77')](_0x5b838b,_0x150729);var _0x398755=[];_0x398755[_0x8013('0xaa')]({'model':db[_0x8013('0x81')],'as':_0x8013('0x81'),'attributes':['id',_0x8013('0x53')],'raw':!![]});_0x398755[_0x8013('0xaa')]({'model':db[_0x8013('0x63')],'as':_0x8013('0x64'),'attributes':['id',_0x8013('0xb8'),_0x8013('0xb9')],'raw':!![]});if(_0x8745a6['query'][_0x8013('0xb6')]){_0x398755[_0x8013('0xaa')]({'model':db[_0x8013('0x71')],'as':_0x8013('0x71'),'raw':!![]});}var _0x32b8b0=[{'model':db[_0x8013('0x5f')],'as':_0x8013('0x80'),'attributes':['id',_0x8013('0x31'),_0x8013('0x8c'),'direction',_0x8013('0x8f'),'read'],'include':_0x398755}];_0x32b8b0['push']({'model':db['ChatWebsite'],'as':_0x8013('0xba'),'attributes':['id',_0x8013('0x2e')]});_0x32b8b0[_0x8013('0xaa')]({'model':db['User'],'as':_0x8013('0xbb'),'attributes':['id','fullname']});return db[_0x8013('0x37')]['find']({'where':{'id':_0x8745a6[_0x8013('0x3f')]['id']},'include':_0x32b8b0})[_0x8013('0x2c')](handleEntityNotFound(_0x21c0ef,null))[_0x8013('0x2c')](function(_0x1e87aa){if(_0x1e87aa){var _0x372acf=_0x1e87aa[_0x8013('0xbc')]({'plain':!![]});fs[_0x8013('0xbd')](_0x152106);var _0x28ea95={'channel':_0x8013('0xbe'),'account':_0x372acf[_0x8013('0xba')]['name'],'agent':_0x372acf[_0x8013('0xbb')]?_0x372acf[_0x8013('0xbb')][_0x8013('0x53')]:_0x8013('0xbf'),'createdAt':moment(_0x372acf[_0x8013('0x8c')])[_0x8013('0x7d')](_0x8013('0xa2'))[_0x8013('0xc0')](),'closedAt':_0x372acf[_0x8013('0x73')]?moment(_0x372acf[_0x8013('0xc1')])[_0x8013('0x7d')](_0x8013('0xa2'))[_0x8013('0xc0')]():'','disposition':_0x372acf[_0x8013('0x6a')],'chatInfo':{'browser':_0x372acf[_0x8013('0xc2')],'os':_0x372acf[_0x8013('0xc3')],'referer':_0x372acf[_0x8013('0xc4')],'customerIp':_0x372acf[_0x8013('0xc5')],'customerPort':_0x372acf[_0x8013('0xc6')]?_0x372acf[_0x8013('0xc6')]:_0x8013('0xbf')},'messages':_(_0x372acf[_0x8013('0x80')])[_0x8013('0xc7')]()[_0x8013('0xa0')]({'secret':![]})[_0x8013('0x36')](function(_0x395112){if(_0x395112[_0x8013('0x71')]){var _0x26c9f6=path[_0x8013('0x77')](_0x349c79,_0x395112[_0x8013('0x71')][_0x8013('0x6e')]);if(fs[_0x8013('0xc8')](_0x26c9f6)){fs[_0x8013('0xc9')](_0x26c9f6)[_0x8013('0xca')](fs[_0x8013('0xcb')](path['join'](_0x152106,_0x395112['Attachment'][_0x8013('0x6e')])));}}return{'date':moment(_0x395112[_0x8013('0x8c')])['format'](_0x8013('0xa2'))[_0x8013('0xc0')](),'sender':_0x395112[_0x8013('0x8e')]==='out'?_0x395112['User']?_0x395112['User'][_0x8013('0x53')]:_0x8013('0x89'):_0x395112['Contact'][_0x8013('0xb8')]+(_0x395112[_0x8013('0x64')]['lastName']?'\x20'+_0x395112[_0x8013('0x64')]['lastName']:''),'body':_0x395112[_0x8013('0x71')]?_0x395112['Attachment'][_0x8013('0x6e')]:_0x395112[_0x8013('0x31')],'direction':_0x395112[_0x8013('0x8e')]===_0x8013('0x5e')?'A':'C','secret':_0x395112[_0x8013('0x8f')],'read':_0x395112[_0x8013('0xcc')],'attachment':_0x395112[_0x8013('0x71')]};})[_0x8013('0xcd')]()};return ejs[_0x8013('0xce')](path['join'](config[_0x8013('0x7c')],_0x8013('0xb3'),_0x8013('0xcf'),_0x8013('0xd0')),{'interaction':_0x28ea95})[_0x8013('0x2c')](function(_0x5c4e7d){var _0x5ebbc4=path[_0x8013('0x77')](_0x152106,_0x8013('0xd1')+_0x372acf['id']+'-'+_0x142225+'.pdf');var _0x1a8635={'path':_0x5ebbc4,'channel':_0x8013('0xbe'),'interactionId':_0x372acf['id']};return pdf[_0x8013('0xd2')](_0x5c4e7d,_0x1a8635);})['then'](function(){return new Promise(function(_0x26a3af,_0x25317f){zipdir(_0x152106,{'saveTo':_0x5a6fa1},function(_0x42ea44,_0x49312e){if(_0x42ea44)return _0x25317f(_0x42ea44);return _0x26a3af(_0x49312e);});})[_0x8013('0x2c')](function(){return new BPromise(function(_0x42d8da,_0x28b611){rimraf(_0x152106,function(_0xd032ea){if(_0xd032ea)_0x28b611(_0xd032ea);return _0x42d8da();});});})[_0x8013('0x2c')](function(){return _0x21c0ef[_0x8013('0x7a')](_0x5a6fa1,_0x150729,function(_0x2091c4){if(_0x2091c4){logger[_0x8013('0x1a')](_0x8013('0xd3'),_0x2091c4);}else{fs[_0x8013('0xd4')](_0x5a6fa1);}});});});}else{return _0x21c0ef[_0x8013('0x20')](0xc8);}})['catch'](handleError(_0x21c0ef,null));}; \ No newline at end of file +var _0xc812=['downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','bluebird','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','./chatInteraction.socket','register','jayson/promise','http','request','then','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','sendStatus','end','json','offset','limit','undefined','count','status','destroy','stack','name','send','render','body','contact','agent','interaction','account','index','map','rawAttributes','fieldName','type','findAll','catch','show','params','model','keys','query','intersection','fields','attributes','length','includeAll','include','merge','options','ChatInteraction','find','create','update','describe','createVidaooSession','ChatWebsite','findOne','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooMetadata','user','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','parse','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','UserId','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','attachId','ChatOfflineMessageId','root','server/files/attachments/','offline-chat/','join','download','close','mailTranscript','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages','User','ChatWebsiteId','ContactId','agentAlias','System','customer','format','Visitor','agentIdentifier','agent_alias','alias','%s%d','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','MailServerOut','Smtp','CloudProvider','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','filters','hasOwnProperty','nolimit','order','sort','where','pick','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','ChatInteractionId','filter','push','addTags','spread','Tag','color','emit','removeTags','server','files','tmp','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','direction','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','toString','browserName','osName','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','value','renderFile','views'];(function(_0x5cac67,_0x1837d3){var _0x27ce41=function(_0x17910f){while(--_0x17910f){_0x5cac67['push'](_0x5cac67['shift']());}};_0x27ce41(++_0x1837d3);}(_0xc812,0x1b2));var _0x2c81=function(_0x13ddc6,_0x4d5530){_0x13ddc6=_0x13ddc6-0x0;var _0x4202fd=_0xc812[_0x13ddc6];return _0x4202fd;};'use strict';var rimraf=require(_0x2c81('0x0'));var zipdir=require(_0x2c81('0x1'));var rp=require(_0x2c81('0x2'));var moment=require('moment');var BPromise=require(_0x2c81('0x3'));var Mustache=require('mustache');var util=require(_0x2c81('0x4'));var path=require(_0x2c81('0x5'));var ejs=require(_0x2c81('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x2c81('0x7'));var interaction=require(_0x2c81('0x8'));var qs=require(_0x2c81('0x9'));var pdf=require(_0x2c81('0xa'));var logger=require(_0x2c81('0xb'))(_0x2c81('0xc'));var config=require(_0x2c81('0xd'));var db=require(_0x2c81('0xe'))['db'];config['redis']=_[_0x2c81('0xf')](config[_0x2c81('0x10')],{'host':_0x2c81('0x11'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2c81('0x10')]));require(_0x2c81('0x12'))[_0x2c81('0x13')](socket);var jayson=require(_0x2c81('0x14'));var client=jayson['client'][_0x2c81('0x15')]({'port':0x232b});var client9004=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x354fae,_0x50d103,_0x49704f,_0x1292d6){return new BPromise(function(_0x582c03,_0x4c6610){var _0x2909f4=_0x1292d6||client;return _0x2909f4[_0x2c81('0x16')](_0x354fae,_0x49704f)[_0x2c81('0x17')](function(_0x229249){logger[_0x2c81('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x50d103,_0x2c81('0x19'));logger['debug'](_0x2c81('0x1a'),_0x50d103,_0x2c81('0x19'),JSON[_0x2c81('0x1b')](_0x229249));if(_0x229249[_0x2c81('0x1c')]){if(_0x229249['error'][_0x2c81('0x1d')]===0x1f4){logger[_0x2c81('0x1c')](_0x2c81('0x1e'),_0x50d103,_0x229249[_0x2c81('0x1c')]['message']);return _0x4c6610(_0x229249[_0x2c81('0x1c')][_0x2c81('0x1f')]);}logger[_0x2c81('0x1c')](_0x2c81('0x1e'),_0x50d103,_0x229249['error'][_0x2c81('0x1f')]);return _0x582c03(_0x229249[_0x2c81('0x1c')]['message']);}else{logger[_0x2c81('0x18')](_0x2c81('0x1e'),_0x50d103,_0x2c81('0x19'));_0x582c03(_0x229249[_0x2c81('0x20')][_0x2c81('0x1f')]);}})['catch'](function(_0x17ee0c){logger['error'](_0x2c81('0x1e'),_0x50d103,_0x17ee0c);_0x4c6610(_0x17ee0c);});});}function respondWithStatusCode(_0x12f92d,_0x12f892){_0x12f892=_0x12f892||0xcc;return function(_0x5b2b76){if(_0x5b2b76){return _0x12f92d[_0x2c81('0x21')](_0x12f892);}return _0x12f92d['status'](_0x12f892)[_0x2c81('0x22')]();};}function respondWithResult(_0x1dcfff,_0x363562){_0x363562=_0x363562||0xc8;return function(_0xdf6d50){if(_0xdf6d50){return _0x1dcfff['status'](_0x363562)[_0x2c81('0x23')](_0xdf6d50);}};}function respondWithFilteredResult(_0x56bfb9,_0x25f8d0){return function(_0x2cdeb1){if(_0x2cdeb1){var _0x45865b=typeof _0x25f8d0[_0x2c81('0x24')]==='undefined'&&typeof _0x25f8d0[_0x2c81('0x25')]===_0x2c81('0x26');var _0x48d812=_0x2cdeb1[_0x2c81('0x27')];var _0x2e6825=_0x45865b?0x0:_0x25f8d0[_0x2c81('0x24')];var _0x2c98b1=_0x45865b?_0x2cdeb1[_0x2c81('0x27')]:_0x25f8d0[_0x2c81('0x24')]+_0x25f8d0[_0x2c81('0x25')];var _0x53b7d4;if(_0x2c98b1>=_0x48d812){_0x2c98b1=_0x48d812;_0x53b7d4=0xc8;}else{_0x53b7d4=0xce;}_0x56bfb9[_0x2c81('0x28')](_0x53b7d4);return _0x56bfb9['set']('Content-Range',_0x2e6825+'-'+_0x2c98b1+'/'+_0x48d812)[_0x2c81('0x23')](_0x2cdeb1);}return null;};}function saveUpdates(_0x191c8c){return function(_0x290594){if(_0x290594){return _0x290594['update'](_0x191c8c)[_0x2c81('0x17')](function(_0x5dfc53){return _0x5dfc53;});}return null;};}function removeEntity(_0x3a5a8f){return function(_0x402bee){if(_0x402bee){return _0x402bee[_0x2c81('0x29')]()['then'](function(){_0x3a5a8f[_0x2c81('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30d624){return function(_0x1e5f3d){if(!_0x1e5f3d){_0x30d624[_0x2c81('0x21')](0x194);}return _0x1e5f3d;};}function handleError(_0x3f8a38,_0x51cb52){_0x51cb52=_0x51cb52||0x1f4;return function(_0x5ac1ab){logger['error'](_0x5ac1ab[_0x2c81('0x2a')]);if(_0x5ac1ab[_0x2c81('0x2b')]){delete _0x5ac1ab[_0x2c81('0x2b')];}_0x3f8a38[_0x2c81('0x28')](_0x51cb52)[_0x2c81('0x2c')](_0x5ac1ab);};}function getMustacheRender(_0x4ce07e,_0x422f35){return Mustache[_0x2c81('0x2d')](_0x4ce07e,_['merge'](_0x422f35[_0x2c81('0x2e')],{'contact':_0x422f35[_0x2c81('0x2f')],'message':_0x422f35[_0x2c81('0x1f')],'agent':_0x422f35[_0x2c81('0x30')],'interaction':_0x422f35[_0x2c81('0x31')],'account':_0x422f35[_0x2c81('0x32')]}))||'';}exports[_0x2c81('0x33')]=function(_0x38816c,_0xd2f725){var _0x33149e={};var _0x5f302d=_[_0x2c81('0x34')](db['ChatInteraction'][_0x2c81('0x35')],function(_0x252403){return{'name':_0x252403[_0x2c81('0x36')],'type':_0x252403[_0x2c81('0x37')]['key']};});_0x33149e=qs['getOptions'](_0x5f302d,_0x38816c);return interaction[_0x2c81('0x38')]('chat',_0x38816c['query'],_0x38816c['user'],_0x33149e,_0x5f302d)[_0x2c81('0x17')](respondWithFilteredResult(_0xd2f725,_0x33149e))[_0x2c81('0x39')](handleError(_0xd2f725,null));};exports[_0x2c81('0x3a')]=function(_0x136a52,_0xf1af4b){var _0x358442={'raw':![],'where':{'id':_0x136a52[_0x2c81('0x3b')]['id']}},_0x290680={};_0x290680[_0x2c81('0x3c')]=_[_0x2c81('0x3d')](db['ChatInteraction'][_0x2c81('0x35')]);_0x290680[_0x2c81('0x3e')]=_['keys'](_0x136a52['query']);_0x290680['filters']=_['intersection'](_0x290680['model'],_0x290680[_0x2c81('0x3e')]);_0x358442['attributes']=_[_0x2c81('0x3f')](_0x290680['model'],qs[_0x2c81('0x40')](_0x136a52[_0x2c81('0x3e')][_0x2c81('0x40')]));_0x358442[_0x2c81('0x41')]=_0x358442['attributes'][_0x2c81('0x42')]?_0x358442[_0x2c81('0x41')]:_0x290680[_0x2c81('0x3c')];if(_0x136a52[_0x2c81('0x3e')][_0x2c81('0x43')]){_0x358442[_0x2c81('0x44')]=[{'all':!![]}];}_0x358442=_[_0x2c81('0x45')]({},_0x358442,_0x136a52[_0x2c81('0x46')]);return db[_0x2c81('0x47')][_0x2c81('0x48')](_0x358442)[_0x2c81('0x17')](handleEntityNotFound(_0xf1af4b,null))[_0x2c81('0x17')](respondWithResult(_0xf1af4b,null))[_0x2c81('0x39')](handleError(_0xf1af4b,null));};exports['create']=function(_0x23c689,_0x684d0e){return db[_0x2c81('0x47')][_0x2c81('0x49')](_0x23c689[_0x2c81('0x2e')],{})[_0x2c81('0x17')](respondWithResult(_0x684d0e,0xc9))[_0x2c81('0x39')](handleError(_0x684d0e,null));};exports[_0x2c81('0x4a')]=function(_0x44f5ae,_0xfa20a5){if(_0x44f5ae[_0x2c81('0x2e')]['id']){delete _0x44f5ae[_0x2c81('0x2e')]['id'];}return db[_0x2c81('0x47')][_0x2c81('0x48')]({'where':{'id':_0x44f5ae[_0x2c81('0x3b')]['id']}})[_0x2c81('0x17')](handleEntityNotFound(_0xfa20a5,null))[_0x2c81('0x17')](saveUpdates(_0x44f5ae[_0x2c81('0x2e')],null))[_0x2c81('0x17')](respondWithResult(_0xfa20a5,null))['catch'](handleError(_0xfa20a5,null));};exports[_0x2c81('0x29')]=function(_0x5a9de6,_0x497373){return db[_0x2c81('0x47')][_0x2c81('0x48')]({'where':{'id':_0x5a9de6[_0x2c81('0x3b')]['id']}})['then'](handleEntityNotFound(_0x497373,null))[_0x2c81('0x17')](removeEntity(_0x497373,null))['catch'](handleError(_0x497373,null));};exports[_0x2c81('0x4b')]=function(_0x11ab98,_0x3f91c3){return db['ChatInteraction']['describe']()[_0x2c81('0x17')](respondWithResult(_0x3f91c3,null))[_0x2c81('0x39')](handleError(_0x3f91c3,null));};exports[_0x2c81('0x4c')]=function(_0x481dda,_0x487505){var _0x371514=_0x481dda['params']['id'];var _0x2f5fbd;var _0x328d0b;var _0x2e3be8;return db[_0x2c81('0x47')]['findOne']({'where':{'id':_0x371514}})[_0x2c81('0x17')](function(_0x53fd80){_0x2f5fbd=_0x53fd80;return db[_0x2c81('0x4d')][_0x2c81('0x4e')]({'where':{'id':_0x53fd80['ChatWebsiteId']},'attributes':['id',_0x2c81('0x4f'),_0x2c81('0x50'),_0x2c81('0x51'),'vidaooNote',_0x2c81('0x52')],'raw':!![]});})['then'](function(_0x4e1302){if(_0x4e1302&&_0x4e1302[_0x2c81('0x4f')]&&_0x4e1302[_0x2c81('0x50')]){_0x328d0b=_0x4e1302;var _0x554b49={'interaction':{'id':_0x371514},'agent':{'id':_0x481dda[_0x2c81('0x53')]['id'],'name':_0x481dda['user'][_0x2c81('0x2b')],'fullname':_0x481dda[_0x2c81('0x53')][_0x2c81('0x54')],'email':_0x481dda[_0x2c81('0x53')][_0x2c81('0x55')]},'contact':_0x481dda[_0x2c81('0x2e')][_0x2c81('0x2f')],'account':_0x481dda[_0x2c81('0x2e')][_0x2c81('0x32')]};var _0x545151={'rejectUnauthorized':![],'method':_0x2c81('0x56'),'url':_0x2c81('0x57'),'headers':{'X-APIKEY':_0x4e1302[_0x2c81('0x4f')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x481dda[_0x2c81('0x53')]['email']],'buttons':null,'topic':_0x328d0b['vidaooTopic'],'note':_[_0x2c81('0x58')](_0x328d0b[_0x2c81('0x59')])?null:getMustacheRender(_0x328d0b[_0x2c81('0x59')],_0x554b49),'metadata':null},'redirect':_0x2c81('0x5a'),'json':!![]};try{if(!_['isNull'](_0x328d0b[_0x2c81('0x52')])){var _0x8898d2=getMustacheRender(_0x328d0b[_0x2c81('0x52')],_0x554b49);var _0x4c394b=JSON[_0x2c81('0x5b')](_0x8898d2);_0x545151[_0x2c81('0x2e')][_0x2c81('0x5c')]=_0x4c394b;}}catch(_0x4e405a){throw new db[(_0x2c81('0x5d'))]['ValidationError'](_0x2c81('0x5e'));}return rp(_0x545151);}else{throw new db[(_0x2c81('0x5d'))][(_0x2c81('0x5f'))](_0x2c81('0x60'));}})['then'](function(_0x5eb9d3){_0x2e3be8=_0x5eb9d3;if(_0x2e3be8['id']){var _0x166601={'body':_0x2e3be8['join_url'],'ChatWebsiteId':_0x328d0b['id'],'ChatInteractionId':_0x2f5fbd['id'],'direction':_0x2c81('0x61'),'UserId':_0x481dda[_0x2c81('0x53')]['id']};return db['ChatMessage'][_0x2c81('0x49')](_0x166601,{});}else{throw new db[(_0x2c81('0x5d'))]['ValidationError'](_0x2c81('0x62'));}})[_0x2c81('0x17')](function(){return _0x2f5fbd[_0x2c81('0x63')]({'vidaooSessionId':_0x2e3be8['id']});})[_0x2c81('0x17')](respondWithResult(_0x487505,null))[_0x2c81('0x39')](handleError(_0x487505,null));};exports[_0x2c81('0x64')]=function(_0x44024b,_0xe068ca){if(_0x44024b[_0x2c81('0x2e')]['id']){delete _0x44024b[_0x2c81('0x2e')]['id'];}return db[_0x2c81('0x47')][_0x2c81('0x48')]({'where':{'id':_0x44024b['params']['id']},'include':[{'model':db[_0x2c81('0x65')],'as':'Contact'}]})[_0x2c81('0x17')](handleEntityNotFound(_0xe068ca,null))[_0x2c81('0x17')](saveUpdates(_0x44024b['body'],null))[_0x2c81('0x17')](respondWithResult(_0xe068ca,null))[_0x2c81('0x39')](handleError(_0xe068ca,null));};exports[_0x2c81('0x66')]=function(_0x26cafa,_0x43c331){if(_0x26cafa['body']['id']){delete _0x26cafa[_0x2c81('0x2e')]['id'];}return db[_0x2c81('0x47')]['find']({'where':{'id':_0x26cafa[_0x2c81('0x3b')]['id']}})[_0x2c81('0x17')](function(_0x13ce38){if(!_0x13ce38){logger['error'](_0x2c81('0x67'),_0x2c81('0x66'),0x194,'entity\x20not\x20found');_0x43c331['sendStatus'](0x194);}else{if(_0x13ce38[_0x2c81('0x68')]){throw new db[(_0x2c81('0x5d'))]['ValidationError']('Interaction\x20already\x20assigned');}}return _0x13ce38;})[_0x2c81('0x17')](function(_0x2889bc){if(_0x2889bc){return _0x2889bc[_0x2c81('0x4a')]({'closed':_0x26cafa['body'][_0x2c81('0x69')],'disposition':_0x26cafa[_0x2c81('0x2e')][_0x2c81('0x6a')]})[_0x2c81('0x17')](function(_0x2d18d7){return _0x2d18d7;});}})[_0x2c81('0x17')](function(){return respondWithRpcPromise(_0x2c81('0x6b'),_0x2c81('0x66'),_0x26cafa[_0x2c81('0x2e')],client9004);})[_0x2c81('0x17')](respondWithResult(_0x43c331,null))[_0x2c81('0x39')](handleError(_0x43c331,null));};exports[_0x2c81('0x6c')]=function(_0x32b606,_0x445f9f){_0x32b606['body'][_0x2c81('0x2b')]=_0x32b606[_0x2c81('0x6d')][_0x2c81('0x6e')];_0x32b606[_0x2c81('0x2e')][_0x2c81('0x6f')]=_0x32b606[_0x2c81('0x6d')][_0x2c81('0x70')];_0x32b606[_0x2c81('0x2e')][_0x2c81('0x37')]=_0x32b606[_0x2c81('0x6d')][_0x2c81('0x71')];return db[_0x2c81('0x72')][_0x2c81('0x49')](_0x32b606[_0x2c81('0x2e')])[_0x2c81('0x17')](respondWithResult(_0x445f9f,0xc9))[_0x2c81('0x39')](handleError(_0x445f9f,null));};exports[_0x2c81('0x73')]=function(_0x1294bd,_0x3338de){return db['ChatInteraction'][_0x2c81('0x4e')]({'where':{'id':_0x1294bd[_0x2c81('0x3b')]['id']},'raw':!![]})[_0x2c81('0x17')](handleEntityNotFound(_0x3338de,null))['then'](function(_0x57544b){if(_0x57544b){if(_0x57544b[_0x2c81('0x69')]){return _0x3338de[_0x2c81('0x28')](0x193)[_0x2c81('0x23')]({'status':0x193,'message':'Unauthorized'});}return db['Attachment'][_0x2c81('0x4e')]({'where':{'id':_0x1294bd['query'][_0x2c81('0x74')]},'raw':!![]})[_0x2c81('0x17')](handleEntityNotFound(_0x3338de,null));}})[_0x2c81('0x17')](function(_0x1c2896){if(_0x1c2896){var _0x16423e=_0x1c2896[_0x2c81('0x75')]!==null;var _0x58b1f9=path['join'](config[_0x2c81('0x76')],_0x2c81('0x77'));if(_0x16423e){_0x58b1f9=path['join'](_0x58b1f9,_0x2c81('0x78'));}var _0x1446fe=path[_0x2c81('0x79')](_0x58b1f9,_0x1c2896[_0x2c81('0x6f')]);return _0x3338de[_0x2c81('0x7a')](_0x1446fe);}})['catch'](handleError(_0x3338de,null));};exports[_0x2c81('0x7b')]=function(_0xfa17b2,_0x3e9d65){var _0x29116a=null;var _0x829364=null;var _0xec56f7=null;if(_0xfa17b2[_0x2c81('0x2e')]['id']){delete _0xfa17b2[_0x2c81('0x2e')]['id'];}if(_0xfa17b2[_0x2c81('0x2e')][_0x2c81('0x7c')]){_0xec56f7=path[_0x2c81('0x79')](config[_0x2c81('0x76')],_0x2c81('0x7d'),util['format'](_0x2c81('0x7e'),Date[_0x2c81('0x7f')]()));_0xfa17b2['body'][_0x2c81('0x80')]=_0xec56f7;}return db['ChatInteraction']['find']({'where':{'id':_0xfa17b2[_0x2c81('0x3b')]['id']},'include':[{'model':db[_0x2c81('0x81')],'as':_0x2c81('0x82'),'include':[{'model':db[_0x2c81('0x83')],'as':_0x2c81('0x83')}]}]})[_0x2c81('0x17')](handleEntityNotFound(_0x3e9d65,null))[_0x2c81('0x17')](saveUpdates(_0xfa17b2['body'],null))[_0x2c81('0x17')](function(_0x31034e){if(_0x31034e){_0x29116a=_0x31034e;return db[_0x2c81('0x4d')][_0x2c81('0x48')]({'where':{'id':_0x29116a[_0x2c81('0x84')]}});}})[_0x2c81('0x17')](function(_0x3b98af){if(_0x3b98af){_0x829364=_0x3b98af;return db[_0x2c81('0x65')][_0x2c81('0x48')]({'where':{'id':_0x29116a[_0x2c81('0x85')]}});}})['then'](function(_0xb46680){if(_0xb46680){if(_0xec56f7){var _0x2b71a1=null;for(var _0xca4b1e=0x1;_0xca4b1e<_0x29116a[_0x2c81('0x82')][_0x2c81('0x42')];++_0xca4b1e){_0x2b71a1=_0x29116a[_0x2c81('0x82')][_0xca4b1e];var _0x5eed35=_0x2b71a1[_0x2c81('0x68')]?util['format']('%s%d',_0x829364[_0x2c81('0x86')],_0x2b71a1[_0x2c81('0x68')]):_0x2c81('0x87');var _0x9d8ec9=_0xfa17b2[_0x2c81('0x2e')][_0x2c81('0x88')]||util[_0x2c81('0x89')]('%s%d',_0x2c81('0x8a'),_0x2b71a1[_0x2c81('0x85')]);switch(_0x829364[_0x2c81('0x8b')]){case'website_alias':_0x5eed35=_0x2b71a1[_0x2c81('0x68')]?util[_0x2c81('0x89')]('%s%d',_0x829364[_0x2c81('0x86')],_0x2b71a1['UserId']):_0x2c81('0x87');break;case _0x2c81('0x8c'):_0x5eed35=_0x2b71a1[_0x2c81('0x68')]?_0x2b71a1[_0x2c81('0x83')][_0x2c81('0x8d')]||_0x2b71a1[_0x2c81('0x83')][_0x2c81('0x54')]:_0x2c81('0x87');break;case'agent_fullname':_0x5eed35=_0x2b71a1[_0x2c81('0x68')]?_0x2b71a1[_0x2c81('0x83')][_0x2c81('0x54')]:'System';break;default:_0x5eed35=_0x2b71a1[_0x2c81('0x68')]?util['format'](_0x2c81('0x8e'),_0x829364[_0x2c81('0x86')],_0x2b71a1[_0x2c81('0x68')]):_0x2c81('0x87');}var _0x14eb14=util[_0x2c81('0x89')](_0x2c81('0x8f'),moment(_0x2b71a1[_0x2c81('0x90')])[_0x2c81('0x89')](_0x2c81('0x91')),_0x2b71a1['direction']==='in'?_0x9d8ec9:_0x5eed35,_0x2b71a1['body']);if(!_0x2b71a1[_0x2c81('0x92')]){fs['appendFileSync'](_0xec56f7,_0x14eb14);}}return db['MailAccount'][_0x2c81('0x4e')]({'where':{'service':!![]},'include':[{'model':db[_0x2c81('0x93')],'as':_0x2c81('0x94'),'raw':!![],'include':[{'model':db[_0x2c81('0x95')],'as':_0x2c81('0x95'),'raw':!![]}]}]});}}})['then'](function(_0x27eb0f){if(!_0x27eb0f||!_0x27eb0f['Smtp']||!_0xfa17b2[_0x2c81('0x2e')])return _0x29116a;var _0x6ea3ae=_0x27eb0f[_0x2c81('0x96')]();return respondWithRpcPromise('SendMail',_0x2c81('0x97'),{'account':_0x6ea3ae,'message':{'from':util[_0x2c81('0x89')](_0x2c81('0x98'),_0x27eb0f['name'],_0x27eb0f[_0x2c81('0x55')]||_0x27eb0f[_0x2c81('0x94')][_0x2c81('0x53')]),'to':_0xfa17b2[_0x2c81('0x2e')][_0x2c81('0x7c')],'subject':_0x2c81('0x99'),'text':util[_0x2c81('0x89')](_0x2c81('0x9a'),_0xfa17b2[_0x2c81('0x2e')][_0x2c81('0x7c')]),'attachments':[{'path':_0xec56f7}]}})[_0x2c81('0x17')](function(){return _0x29116a;})['catch'](function(_0x5a5c62){logger[_0x2c81('0x1c')](_0x5a5c62);});})[_0x2c81('0x17')](respondWithStatusCode(_0x3e9d65,0xc8))[_0x2c81('0x39')](handleError(_0x3e9d65,null));};exports['addMessage']=function(_0x17aa03,_0x31debf){return db[_0x2c81('0x81')]['find']({'where':{'id':_0x17aa03[_0x2c81('0x3b')]['id']}})[_0x2c81('0x17')](handleEntityNotFound(_0x31debf,null))[_0x2c81('0x17')](function(_0x46e63a){if(_0x46e63a){return _0x46e63a[_0x2c81('0x9b')](_0x17aa03[_0x2c81('0x2e')][_0x2c81('0x9c')],_[_0x2c81('0x9d')](_0x17aa03[_0x2c81('0x2e')],[_0x2c81('0x9c'),'id'])||{});}})['then'](respondWithResult(_0x31debf,null))[_0x2c81('0x39')](handleError(_0x31debf,null));};exports[_0x2c81('0x9e')]=function(_0x449854,_0xbf2fba){var _0x59e407={'raw':![],'where':{}};var _0x4459ec={};var _0x43486b={'count':0x0,'rows':[]};return db[_0x2c81('0x47')]['findOne']({'where':{'id':_0x449854[_0x2c81('0x3b')]['id']}})[_0x2c81('0x17')](handleEntityNotFound(_0xbf2fba,null))[_0x2c81('0x17')](function(_0x3f7df9){if(_0x3f7df9){_0x4459ec['model']=_[_0x2c81('0x3d')](db[_0x2c81('0x81')]['rawAttributes']);_0x4459ec['query']=_[_0x2c81('0x3d')](_0x449854[_0x2c81('0x3e')]);_0x4459ec[_0x2c81('0x9f')]=_['intersection'](_0x4459ec[_0x2c81('0x3c')],_0x4459ec[_0x2c81('0x3e')]);_0x59e407['attributes']=_[_0x2c81('0x3f')](_0x4459ec[_0x2c81('0x3c')],qs[_0x2c81('0x40')](_0x449854[_0x2c81('0x3e')]['fields']));_0x59e407[_0x2c81('0x41')]=_0x59e407[_0x2c81('0x41')][_0x2c81('0x42')]?_0x59e407['attributes']:_0x4459ec[_0x2c81('0x3c')];if(!_0x449854[_0x2c81('0x3e')][_0x2c81('0xa0')](_0x2c81('0xa1'))){_0x59e407['limit']=qs[_0x2c81('0x25')](_0x449854[_0x2c81('0x3e')][_0x2c81('0x25')]);_0x59e407[_0x2c81('0x24')]=qs[_0x2c81('0x24')](_0x449854[_0x2c81('0x3e')][_0x2c81('0x24')]);}_0x59e407[_0x2c81('0xa2')]=qs['sort'](_0x449854[_0x2c81('0x3e')][_0x2c81('0xa3')]);_0x59e407[_0x2c81('0xa4')]=qs[_0x2c81('0x9f')](_[_0x2c81('0xa5')](_0x449854['query'],_0x4459ec['filters']));_0x59e407[_0x2c81('0xa4')]['ChatInteractionId']=_0x3f7df9['id'];if(_0x449854['query']['filter']){_0x59e407[_0x2c81('0xa4')]=_['merge'](_0x59e407[_0x2c81('0xa4')],{'$or':_[_0x2c81('0x34')](_0x59e407[_0x2c81('0x41')],function(_0x5a674a){var _0x150a9b={};_0x150a9b[_0x5a674a]={'$like':'%'+_0x449854['query']['filter']+'%'};return _0x150a9b;})});}if(_0x449854['query'][_0x2c81('0xa6')]){var _0x197530=_0x449854['query'][_0x2c81('0xa6')][_0x2c81('0xa7')](',');var _0x2ba35b={};_0x2ba35b[_0x197530[0x0]]={'$gte':moment(_0x197530[0x1])['format'](_0x2c81('0xa8'))};_0x59e407[_0x2c81('0xa4')]=_[_0x2c81('0x45')](_0x59e407[_0x2c81('0xa4')],_0x2ba35b);}_0x59e407=_[_0x2c81('0x45')]({},_0x59e407,_0x449854[_0x2c81('0x46')]);return db['ChatMessage'][_0x2c81('0x27')]({'where':_0x59e407[_0x2c81('0xa4')]})[_0x2c81('0x17')](function(_0x3bffcf){_0x43486b[_0x2c81('0x27')]=_0x3bffcf;if(_0x449854[_0x2c81('0x3e')]['includeAll']){_0x59e407['include']=[{'all':!![]}];}return db[_0x2c81('0x81')]['findAll'](_0x59e407);})[_0x2c81('0x17')](function(_0x22205a){_0x43486b[_0x2c81('0xa9')]=_0x22205a;return _0x43486b;});}})['then'](respondWithFilteredResult(_0xbf2fba,_0x59e407))[_0x2c81('0x39')](handleError(_0xbf2fba,null));};exports[_0x2c81('0xaa')]=function(_0xd884d8,_0x1edb89){var _0x4b5059={'where':{}},_0x2bbfb6={},_0x470780={'count':0x0,'rows':[]};return db[_0x2c81('0x47')]['findOne']({'where':{'id':_0xd884d8[_0x2c81('0x3b')]['id']}})['then'](handleEntityNotFound(_0x1edb89,null))[_0x2c81('0x17')](function(_0x2e24ca){if(_0x2e24ca){_0x2bbfb6['model']=_[_0x2c81('0x3d')](db['ChatMessage']['rawAttributes']);_0x2bbfb6[_0x2c81('0x3e')]=_[_0x2c81('0x3d')](_0xd884d8[_0x2c81('0x3e')]);_0x2bbfb6[_0x2c81('0x9f')]=_[_0x2c81('0x3f')](_0x2bbfb6[_0x2c81('0x3c')],_0x2bbfb6[_0x2c81('0x3e')]);_0x4b5059[_0x2c81('0x41')]=_[_0x2c81('0x3f')](_0x2bbfb6[_0x2c81('0x3c')],qs[_0x2c81('0x40')](_0xd884d8[_0x2c81('0x3e')][_0x2c81('0x40')]));_0x4b5059['attributes']=_0x4b5059[_0x2c81('0x41')][_0x2c81('0x42')]?_0x4b5059['attributes']:_0x2bbfb6[_0x2c81('0x3c')];if(!_0xd884d8[_0x2c81('0x3e')][_0x2c81('0xa0')]('nolimit')){_0x4b5059[_0x2c81('0x25')]=qs[_0x2c81('0x25')](_0xd884d8[_0x2c81('0x3e')][_0x2c81('0x25')]);_0x4b5059[_0x2c81('0x24')]=qs[_0x2c81('0x24')](_0xd884d8[_0x2c81('0x3e')][_0x2c81('0x24')]);}_0x4b5059[_0x2c81('0xa2')]=qs[_0x2c81('0xa3')](_0xd884d8[_0x2c81('0x3e')]['sort']);_0x4b5059['where']=qs[_0x2c81('0x9f')](_[_0x2c81('0xa5')](_0xd884d8[_0x2c81('0x3e')],_0x2bbfb6[_0x2c81('0x9f')]));_0x4b5059[_0x2c81('0xa4')][_0x2c81('0xab')]=_0x2e24ca['id'];if(_0xd884d8[_0x2c81('0x3e')][_0x2c81('0xac')]){_0x4b5059[_0x2c81('0xa4')]=_['merge'](_0x4b5059['where'],{'$or':_[_0x2c81('0x34')](_0x4b5059[_0x2c81('0x41')],function(_0x2c6e39){var _0x40c65b={};_0x40c65b[_0x2c6e39]={'$like':'%'+_0xd884d8[_0x2c81('0x3e')][_0x2c81('0xac')]+'%'};return _0x40c65b;})});}_0x4b5059[_0x2c81('0xa4')][_0x2c81('0x92')]=![];if(_0xd884d8[_0x2c81('0x3e')]['id']){_0x4b5059[_0x2c81('0xa4')]['id']={'$gt':_0xd884d8[_0x2c81('0x3e')]['id']};}_0x4b5059=_[_0x2c81('0x45')]({},_0x4b5059,_0xd884d8[_0x2c81('0x46')]);return db[_0x2c81('0x81')][_0x2c81('0x27')]({'where':_0x4b5059['where']})[_0x2c81('0x17')](function(_0x43a4f8){_0x470780[_0x2c81('0x27')]=_0x43a4f8;_0x4b5059[_0x2c81('0x44')]=[];if(_0xd884d8[_0x2c81('0x3e')]['includeAgent']){_0x4b5059[_0x2c81('0x44')][_0x2c81('0xad')]({'model':db['User'],'as':_0x2c81('0x83'),'attributes':['id',_0x2c81('0x54'),_0x2c81('0x8d')]});}if(_0xd884d8[_0x2c81('0x3e')]['includeAll']){_0x4b5059[_0x2c81('0x44')]=[{'all':!![]}];}return db[_0x2c81('0x81')][_0x2c81('0x38')](_0x4b5059);})['then'](function(_0x16eafb){_0x470780[_0x2c81('0xa9')]=_0x16eafb;return _0x470780;});}})['then'](respondWithFilteredResult(_0x1edb89,_0x4b5059))['catch'](handleError(_0x1edb89,null));};exports[_0x2c81('0xae')]=function(_0x536d8d,_0x337919){return db[_0x2c81('0x47')]['find']({'where':{'id':_0x536d8d[_0x2c81('0x3b')]['id']}})[_0x2c81('0x17')](handleEntityNotFound(_0x337919,null))['then'](function(_0x6e391){if(_0x6e391){return _0x6e391['setTags'](_0x536d8d[_0x2c81('0x2e')][_0x2c81('0x9c')],_['omit'](_0x536d8d[_0x2c81('0x2e')],[_0x2c81('0x9c'),'id'])||{})[_0x2c81('0xaf')](function(){return db[_0x2c81('0xb0')][_0x2c81('0x38')]({'attributes':['id',_0x2c81('0x2b'),_0x2c81('0xb1')],'where':{'id':_0x536d8d[_0x2c81('0x2e')][_0x2c81('0x9c')]}});})[_0x2c81('0x17')](function(_0x55b2a9){socket[_0x2c81('0xb2')]('chatInteractionTags:save',{'id':Number(_0x536d8d[_0x2c81('0x3b')]['id']),'tags':_0x55b2a9||[]});return{'id':Number(_0x536d8d[_0x2c81('0x3b')]['id']),'tags':_0x55b2a9||[]};});}})[_0x2c81('0x17')](respondWithResult(_0x337919,null))[_0x2c81('0x39')](handleError(_0x337919,null));};exports[_0x2c81('0xb3')]=function(_0x1a19ed,_0x16cf24){return db['ChatInteraction'][_0x2c81('0x48')]({'where':{'id':_0x1a19ed[_0x2c81('0x3b')]['id']}})[_0x2c81('0x17')](handleEntityNotFound(_0x16cf24,null))[_0x2c81('0x17')](function(_0x4fdfdd){if(_0x4fdfdd){return _0x4fdfdd['removeTags'](_0x1a19ed['query'][_0x2c81('0x9c')]);}})[_0x2c81('0x17')](respondWithStatusCode(_0x16cf24,null))[_0x2c81('0x39')](handleError(_0x16cf24,null));};exports[_0x2c81('0x7a')]=function(_0x2c22e7,_0xf23ba9){var _0x3d3418=moment()['unix']()['toString']();var _0x43ec1e=path[_0x2c81('0x79')](config['root'],_0x2c81('0xb4'),_0x2c81('0xb5'),_0x2c81('0xb6'));var _0x48f479=path[_0x2c81('0x79')](config[_0x2c81('0x76')],_0x2c81('0xb4'),_0x2c81('0xb5'),_0x2c81('0xb7'));var _0x75f8a7=path[_0x2c81('0x79')](_0x43ec1e,_0x3d3418);var _0x8a873b=util[_0x2c81('0x89')](_0x2c81('0xb8'),_0x2c22e7[_0x2c81('0x3b')]['id'],_0x3d3418);var _0x5b2dba=path[_0x2c81('0x79')](_0x43ec1e,_0x8a873b);var _0x5ed7bc=[];_0x5ed7bc[_0x2c81('0xad')]({'model':db['User'],'as':'User','attributes':['id',_0x2c81('0x54')],'raw':!![]});_0x5ed7bc['push']({'model':db[_0x2c81('0x65')],'as':_0x2c81('0xb9'),'attributes':['id',_0x2c81('0xba'),_0x2c81('0xbb')],'raw':!![]});if(_0x2c22e7[_0x2c81('0x3e')][_0x2c81('0xb7')]){_0x5ed7bc[_0x2c81('0xad')]({'model':db[_0x2c81('0x72')],'as':_0x2c81('0x72'),'raw':!![]});}var _0x3f1bda=[{'model':db['ChatMessage'],'as':_0x2c81('0x82'),'attributes':['id',_0x2c81('0x2e'),'createdAt',_0x2c81('0xbc'),'secret','read'],'include':_0x5ed7bc}];_0x3f1bda['push']({'model':db[_0x2c81('0x4d')],'as':_0x2c81('0xbd'),'attributes':['id',_0x2c81('0x2b')]});_0x3f1bda[_0x2c81('0xad')]({'model':db['User'],'as':_0x2c81('0xbe'),'attributes':['id','fullname']});return db[_0x2c81('0x47')][_0x2c81('0x48')]({'where':{'id':_0x2c22e7[_0x2c81('0x3b')]['id']},'include':_0x3f1bda})['then'](handleEntityNotFound(_0xf23ba9,null))[_0x2c81('0x17')](function(_0x336018){if(_0x336018){var _0x162646=_0x336018[_0x2c81('0xbf')]({'plain':!![]});fs[_0x2c81('0xc0')](_0x75f8a7);var _0x4ca785={'channel':_0x2c81('0xc1'),'account':_0x162646[_0x2c81('0xbd')]['name'],'agent':_0x162646['Owner']?_0x162646['Owner'][_0x2c81('0x54')]:_0x2c81('0xc2'),'createdAt':moment(_0x162646[_0x2c81('0x90')])[_0x2c81('0x89')](_0x2c81('0xa8'))['toString'](),'closedAt':_0x162646[_0x2c81('0x69')]?moment(_0x162646[_0x2c81('0xc3')])['format'](_0x2c81('0xa8'))[_0x2c81('0xc4')]():'','disposition':_0x162646[_0x2c81('0x6a')],'chatInfo':{'browser':_0x162646[_0x2c81('0xc5')],'os':_0x162646[_0x2c81('0xc6')],'referer':_0x162646['referer'],'customerIp':_0x162646['customerIp'],'customerPort':_0x162646[_0x2c81('0xc7')]?_0x162646[_0x2c81('0xc7')]:'N.A.'},'messages':_(_0x162646[_0x2c81('0x82')])[_0x2c81('0xc8')]()[_0x2c81('0xac')]({'secret':![]})[_0x2c81('0x34')](function(_0x5e1b23){if(_0x5e1b23[_0x2c81('0x72')]){var _0x7fdfe6=path['join'](_0x48f479,_0x5e1b23['Attachment'][_0x2c81('0x6f')]);if(fs[_0x2c81('0xc9')](_0x7fdfe6)){fs[_0x2c81('0xca')](_0x7fdfe6)[_0x2c81('0xcb')](fs[_0x2c81('0xcc')](path[_0x2c81('0x79')](_0x75f8a7,_0x5e1b23[_0x2c81('0x72')][_0x2c81('0x6f')])));}}return{'date':moment(_0x5e1b23['createdAt'])[_0x2c81('0x89')](_0x2c81('0xa8'))[_0x2c81('0xc4')](),'sender':_0x5e1b23[_0x2c81('0xbc')]===_0x2c81('0x61')?_0x5e1b23['User']?_0x5e1b23[_0x2c81('0x83')][_0x2c81('0x54')]:_0x2c81('0x87'):_0x5e1b23[_0x2c81('0xb9')][_0x2c81('0xba')]+(_0x5e1b23[_0x2c81('0xb9')]['lastName']?'\x20'+_0x5e1b23['Contact'][_0x2c81('0xbb')]:''),'body':_0x5e1b23[_0x2c81('0x72')]?_0x5e1b23['Attachment'][_0x2c81('0x6f')]:_0x5e1b23[_0x2c81('0x2e')],'direction':_0x5e1b23[_0x2c81('0xbc')]===_0x2c81('0x61')?'A':'C','secret':_0x5e1b23[_0x2c81('0x92')],'read':_0x5e1b23['read'],'attachment':_0x5e1b23['Attachment']};})[_0x2c81('0xcd')]()};return ejs[_0x2c81('0xce')](path['join'](config[_0x2c81('0x76')],_0x2c81('0xb4'),_0x2c81('0xcf'),_0x2c81('0xd0')),{'interaction':_0x4ca785})[_0x2c81('0x17')](function(_0x1c05b2){var _0x20d06d=path[_0x2c81('0x79')](_0x75f8a7,_0x2c81('0xd1')+_0x162646['id']+'-'+_0x3d3418+_0x2c81('0xd2'));var _0xd3637c={'path':_0x20d06d,'channel':_0x2c81('0xc1'),'interactionId':_0x162646['id']};return pdf[_0x2c81('0xd3')](_0x1c05b2,_0xd3637c);})[_0x2c81('0x17')](function(){return new Promise(function(_0x39d415,_0x1dbf95){zipdir(_0x75f8a7,{'saveTo':_0x5b2dba},function(_0x379c7a,_0x3e7be0){if(_0x379c7a)return _0x1dbf95(_0x379c7a);return _0x39d415(_0x3e7be0);});})['then'](function(){return new BPromise(function(_0x322aaa,_0x3ef971){rimraf(_0x75f8a7,function(_0x54af54){if(_0x54af54)_0x3ef971(_0x54af54);return _0x322aaa();});});})[_0x2c81('0x17')](function(){return _0xf23ba9['download'](_0x5b2dba,_0x8a873b,function(_0x4421a3){if(_0x4421a3){logger[_0x2c81('0x1c')](_0x2c81('0xd4'),_0x4421a3);}else{fs[_0x2c81('0xd5')](_0x5b2dba);}});});});}else{return _0xf23ba9['sendStatus'](0xc8);}})[_0x2c81('0x39')](handleError(_0xf23ba9,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index fc9e3c5..7d2a1e8 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 _0xc0d1=['getUsers','then','setDataValue','map','findAll','length','emit','catch','hook','exports','events','../../mysqldb','ChatInteraction','save','update','remove'];(function(_0x4804d7,_0x56ef10){var _0x532259=function(_0x5929e3){while(--_0x5929e3){_0x4804d7['push'](_0x4804d7['shift']());}};_0x532259(++_0x56ef10);}(_0xc0d1,0x15a));var _0x1c0d=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xc0d1[_0x4e676e];return _0x336a3c;};'use strict';var EventEmitter=require(_0x1c0d('0x0'));var ChatInteraction=require(_0x1c0d('0x1'))['db'][_0x1c0d('0x2')];var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1c0d('0x3'),'afterUpdate':_0x1c0d('0x4'),'afterDestroy':_0x1c0d('0x5')};function emitEvent(_0x500df2){return function(_0x3426b0,_0x48e3dc,_0x7431cc){_0x3426b0[_0x1c0d('0x6')]({'attributes':['id'],'raw':!![]})[_0x1c0d('0x7')](function(_0x250c10){_0x3426b0[_0x1c0d('0x8')]('Users',_0x250c10[_0x1c0d('0x9')](function(_0x2533d4){return{'id':_0x2533d4['id']};}));return ChatMessage[_0x1c0d('0xa')]({'where':{'ChatInteractionId':_0x3426b0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1c0d('0x7')](function(_0x2d148e){_0x3426b0[_0x1c0d('0x8')]('unreadMessages',_0x2d148e[_0x1c0d('0xb')]);ChatInteractionEvents[_0x1c0d('0xc')](_0x500df2+':'+_0x3426b0['id'],_0x3426b0);ChatInteractionEvents[_0x1c0d('0xc')](_0x500df2,_0x3426b0);_0x7431cc(null);})[_0x1c0d('0xd')](_0x7431cc(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x1c0d('0xe')](e,emitEvent(event));}}module[_0x1c0d('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0xa373=['remove','getUsers','then','setDataValue','Users','map','length','emit','catch','hasOwnProperty','hook','events','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','save','update'];(function(_0x10a131,_0x3dc92b){var _0x51c8e2=function(_0x4c60a9){while(--_0x4c60a9){_0x10a131['push'](_0x10a131['shift']());}};_0x51c8e2(++_0x3dc92b);}(_0xa373,0xbf));var _0x3a37=function(_0x689537,_0x5ce66b){_0x689537=_0x689537-0x0;var _0xb1b3f0=_0xa373[_0x689537];return _0xb1b3f0;};'use strict';var EventEmitter=require(_0x3a37('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x3a37('0x1')];var ChatMessage=require(_0x3a37('0x2'))['db'][_0x3a37('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x3a37('0x4')](0x0);var events={'afterCreate':_0x3a37('0x5'),'afterUpdate':_0x3a37('0x6'),'afterDestroy':_0x3a37('0x7')};function emitEvent(_0x31de69){return function(_0x3869a0,_0x29e23d,_0x4ee072){_0x3869a0[_0x3a37('0x8')]({'attributes':['id'],'raw':!![]})[_0x3a37('0x9')](function(_0x210e5b){_0x3869a0[_0x3a37('0xa')](_0x3a37('0xb'),_0x210e5b[_0x3a37('0xc')](function(_0x24109d){return{'id':_0x24109d['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x3869a0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3a37('0x9')](function(_0x950c92){_0x3869a0['setDataValue']('unreadMessages',_0x950c92[_0x3a37('0xd')]);ChatInteractionEvents[_0x3a37('0xe')](_0x31de69+':'+_0x3869a0['id'],_0x3869a0);ChatInteractionEvents[_0x3a37('0xe')](_0x31de69,_0x3869a0);_0x4ee072(null);})[_0x3a37('0xf')](_0x4ee072(null));};}for(var e in events){if(events[_0x3a37('0x10')](e)){var event=events[e];ChatInteraction[_0x3a37('0x11')](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 d2b24cd..4fcbac7 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 _0xb8e4=['moment','rimraf','../../config/environment','exports','define','chat_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger'];(function(_0x24d88c,_0x485c4d){var _0x49ac8c=function(_0x58f116){while(--_0x58f116){_0x24d88c['push'](_0x24d88c['shift']());}};_0x49ac8c(++_0x485c4d);}(_0xb8e4,0x1de));var _0x4b8e=function(_0x54fd96,_0xdd6498){_0x54fd96=_0x54fd96-0x0;var _0x501cbb=_0xb8e4[_0x54fd96];return _0x501cbb;};'use strict';var _=require('lodash');var util=require(_0x4b8e('0x0'));var logger=require(_0x4b8e('0x1'))('api');var moment=require(_0x4b8e('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4b8e('0x3'));var config=require(_0x4b8e('0x4'));var attributes=require('./chatInteraction.attributes');module[_0x4b8e('0x5')]=function(_0xf4a14,_0x15abdc){return _0xf4a14[_0x4b8e('0x6')]('ChatInteraction',attributes,{'tableName':_0x4b8e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x168eec,_0xf7a6e3,_0x1d5ff2){if(_0x168eec[_0x4b8e('0x8')]('closed')){_0x168eec[_0x4b8e('0x9')]=moment()[_0x4b8e('0xa')](_0x4b8e('0xb'));}_0x1d5ff2(null,_0x168eec);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7a8b=['../../config/logger','bluebird','request-promise','path','rimraf','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x4bebfa,_0x58b358){var _0xb8d6e5=function(_0x52a67d){while(--_0x52a67d){_0x4bebfa['push'](_0x4bebfa['shift']());}};_0xb8d6e5(++_0x58b358);}(_0x7a8b,0x1db));var _0xb7a8=function(_0xcc0214,_0x1a0248){_0xcc0214=_0xcc0214-0x0;var _0x28a82f=_0x7a8b[_0xcc0214];return _0x28a82f;};'use strict';var _=require('lodash');var util=require(_0xb7a8('0x0'));var logger=require(_0xb7a8('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb7a8('0x2'));var rp=require(_0xb7a8('0x3'));var fs=require('fs');var path=require(_0xb7a8('0x4'));var rimraf=require(_0xb7a8('0x5'));var config=require('../../config/environment');var attributes=require(_0xb7a8('0x6'));module[_0xb7a8('0x7')]=function(_0x23d7a2,_0x460fff){return _0x23d7a2[_0xb7a8('0x8')](_0xb7a8('0x9'),attributes,{'tableName':_0xb7a8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xf0dcb3,_0x1179d1,_0x13708e){if(_0xf0dcb3[_0xb7a8('0xb')](_0xb7a8('0xc'))){_0xf0dcb3[_0xb7a8('0xd')]=moment()['format'](_0xb7a8('0xe'));}_0x13708e(null,_0xf0dcb3);}},'charset':_0xb7a8('0xf'),'collate':_0xb7a8('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 2253d8c..6e5fa54 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 _0x2592=['then','catch','AddTagsToChatInteraction','find','addTags','ids','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./chatInteraction.socket','request','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit'];(function(_0x314b4b,_0x2706d9){var _0x3e857b=function(_0x39c7b0){while(--_0x39c7b0){_0x314b4b['push'](_0x314b4b['shift']());}};_0x3e857b(++_0x2706d9);}(_0x2592,0x1e0));var _0x2259=function(_0x21bef5,_0x27b94a){_0x21bef5=_0x21bef5-0x0;var _0x524300=_0x2592[_0x21bef5];return _0x524300;};'use strict';var _=require(_0x2259('0x0'));var util=require('util');var moment=require(_0x2259('0x1'));var BPromise=require(_0x2259('0x2'));var rs=require(_0x2259('0x3'));var fs=require('fs');var Redis=require(_0x2259('0x4'));var db=require(_0x2259('0x5'))['db'];var utils=require(_0x2259('0x6'));var logger=require(_0x2259('0x7'))(_0x2259('0x8'));var config=require('../../config/environment');var jayson=require(_0x2259('0x9'));var client=jayson[_0x2259('0xa')][_0x2259('0xb')]({'port':0x232a});config[_0x2259('0xc')]=_[_0x2259('0xd')](config[_0x2259('0xc')],{'host':_0x2259('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2259('0xc')]));require(_0x2259('0xf'))['register'](socket);function respondWithRpcPromise(_0x3a05cb,_0x441443,_0xdaf957){return new BPromise(function(_0x1a5ae0,_0x31fc64){return client[_0x2259('0x10')](_0x3a05cb,_0xdaf957)['then'](function(_0xfd12a4){logger['info'](_0x2259('0x11'),_0x441443,_0x2259('0x12'));logger[_0x2259('0x13')](_0x2259('0x14'),_0x441443,_0x2259('0x12'),JSON[_0x2259('0x15')](_0xfd12a4));if(_0xfd12a4[_0x2259('0x16')]){if(_0xfd12a4[_0x2259('0x16')][_0x2259('0x17')]===0x1f4){logger[_0x2259('0x16')](_0x2259('0x11'),_0x441443,_0xfd12a4['error'][_0x2259('0x18')]);return _0x31fc64(_0xfd12a4[_0x2259('0x16')][_0x2259('0x18')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x441443,_0xfd12a4['error'][_0x2259('0x18')]);return _0x1a5ae0(_0xfd12a4[_0x2259('0x16')][_0x2259('0x18')]);}else{logger[_0x2259('0x19')](_0x2259('0x11'),_0x441443,_0x2259('0x12'));_0x1a5ae0(_0xfd12a4[_0x2259('0x1a')][_0x2259('0x18')]);}})['catch'](function(_0x57e033){logger['error'](_0x2259('0x11'),_0x441443,_0x57e033);_0x31fc64(_0x57e033);});});}exports[_0x2259('0x1b')]=function(_0x1b117f){var _0x470d08=this;return new Promise(function(_0x5b4903,_0xfd69d5){return db[_0x2259('0x1c')][_0x2259('0x1d')](_0x1b117f[_0x2259('0x1e')],{'raw':_0x1b117f['options']?_0x1b117f[_0x2259('0x1f')][_0x2259('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b117f['options']?_0x1b117f['options'][_0x2259('0x21')]||null:null,'attributes':_0x1b117f['options']?_0x1b117f[_0x2259('0x1f')][_0x2259('0x22')]||null:null,'limit':_0x1b117f[_0x2259('0x1f')]?_0x1b117f['options'][_0x2259('0x23')]||null:null})[_0x2259('0x24')](function(_0xe585c1){logger[_0x2259('0x19')]('UpdateChatInteraction',_0x1b117f);logger[_0x2259('0x13')](_0x2259('0x1b'),_0x1b117f,JSON['stringify'](_0xe585c1));_0x5b4903(_0xe585c1);})[_0x2259('0x25')](function(_0x5b8829){logger[_0x2259('0x16')](_0x2259('0x1b'),_0x5b8829['message'],_0x1b117f);_0xfd69d5(_0x470d08[_0x2259('0x16')](0x1f4,_0x5b8829['message']));});});};exports[_0x2259('0x26')]=function(_0x2ecbe0){return new Promise(function(_0x16fe54,_0x119d6a){return db[_0x2259('0x1c')][_0x2259('0x27')]({'where':_0x2ecbe0[_0x2259('0x1f')]?_0x2ecbe0[_0x2259('0x1f')][_0x2259('0x21')]||null:null})[_0x2259('0x24')](function(_0x1be5d5){if(_0x1be5d5){return _0x1be5d5[_0x2259('0x28')](_0x2ecbe0[_0x2259('0x1e')][_0x2259('0x29')],_['omit'](_0x2ecbe0[_0x2259('0x1e')],[_0x2259('0x29'),'id'])||{});}})['spread'](function(_0x16a4ec){logger[_0x2259('0x19')](_0x2259('0x2a'),_0x2ecbe0);logger[_0x2259('0x13')](_0x2259('0x2a'),_0x2ecbe0,JSON[_0x2259('0x15')](_0x16a4ec));_0x16fe54(_0x16a4ec);})[_0x2259('0x25')](function(_0x4c48b7){logger[_0x2259('0x16')]('AddTags',_0x4c48b7['message'],_0x2ecbe0);_0x119d6a(_this[_0x2259('0x16')](0x1f4,_0x4c48b7[_0x2259('0x18')]));});});}; \ No newline at end of file +var _0x40d9=['info','ChatInteraction,\x20%s,\x20%s','result','catch','UpdateChatInteraction','update','body','options','raw','where','attributes','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x40e6e7,_0x187f3d){var _0x1bf123=function(_0x14f24e){while(--_0x14f24e){_0x40e6e7['push'](_0x40e6e7['shift']());}};_0x1bf123(++_0x187f3d);}(_0x40d9,0x1a1));var _0x940d=function(_0x1538d1,_0x3eab18){_0x1538d1=_0x1538d1-0x0;var _0xe84c01=_0x40d9[_0x1538d1];return _0xe84c01;};'use strict';var _=require(_0x940d('0x0'));var util=require(_0x940d('0x1'));var moment=require(_0x940d('0x2'));var BPromise=require(_0x940d('0x3'));var rs=require(_0x940d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x940d('0x5'));var logger=require(_0x940d('0x6'))(_0x940d('0x7'));var config=require('../../config/environment');var jayson=require(_0x940d('0x8'));var client=jayson['client'][_0x940d('0x9')]({'port':0x232a});config[_0x940d('0xa')]=_['defaults'](config['redis'],{'host':_0x940d('0xb'),'port':0x18eb});var socket=require(_0x940d('0xc'))(new Redis(config['redis']));require(_0x940d('0xd'))[_0x940d('0xe')](socket);function respondWithRpcPromise(_0x35b834,_0x3bd710,_0x3b08b6){return new BPromise(function(_0x11ced4,_0x46b3c7){return client[_0x940d('0xf')](_0x35b834,_0x3b08b6)[_0x940d('0x10')](function(_0x1731be){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x3bd710,_0x940d('0x11'));logger[_0x940d('0x12')](_0x940d('0x13'),_0x3bd710,_0x940d('0x11'),JSON[_0x940d('0x14')](_0x1731be));if(_0x1731be[_0x940d('0x15')]){if(_0x1731be[_0x940d('0x15')]['code']===0x1f4){logger[_0x940d('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x3bd710,_0x1731be['error'][_0x940d('0x16')]);return _0x46b3c7(_0x1731be[_0x940d('0x15')]['message']);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x3bd710,_0x1731be[_0x940d('0x15')][_0x940d('0x16')]);return _0x11ced4(_0x1731be[_0x940d('0x15')]['message']);}else{logger[_0x940d('0x17')](_0x940d('0x18'),_0x3bd710,'request\x20sent');_0x11ced4(_0x1731be[_0x940d('0x19')][_0x940d('0x16')]);}})[_0x940d('0x1a')](function(_0x1e5e19){logger[_0x940d('0x15')](_0x940d('0x18'),_0x3bd710,_0x1e5e19);_0x46b3c7(_0x1e5e19);});});}exports[_0x940d('0x1b')]=function(_0x3302af){var _0x5bed7d=this;return new Promise(function(_0x55c243,_0x561122){return db['ChatInteraction'][_0x940d('0x1c')](_0x3302af[_0x940d('0x1d')],{'raw':_0x3302af[_0x940d('0x1e')]?_0x3302af[_0x940d('0x1e')][_0x940d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3302af[_0x940d('0x1e')]?_0x3302af['options'][_0x940d('0x20')]||null:null,'attributes':_0x3302af[_0x940d('0x1e')]?_0x3302af['options'][_0x940d('0x21')]||null:null,'limit':_0x3302af[_0x940d('0x1e')]?_0x3302af[_0x940d('0x1e')]['limit']||null:null})['then'](function(_0x14141d){logger[_0x940d('0x17')](_0x940d('0x1b'),_0x3302af);logger[_0x940d('0x12')]('UpdateChatInteraction',_0x3302af,JSON['stringify'](_0x14141d));_0x55c243(_0x14141d);})[_0x940d('0x1a')](function(_0x220122){logger[_0x940d('0x15')](_0x940d('0x1b'),_0x220122['message'],_0x3302af);_0x561122(_0x5bed7d[_0x940d('0x15')](0x1f4,_0x220122[_0x940d('0x16')]));});});};exports['AddTagsToChatInteraction']=function(_0x735ca0){return new Promise(function(_0x24731c,_0x226358){return db['ChatInteraction'][_0x940d('0x22')]({'where':_0x735ca0[_0x940d('0x1e')]?_0x735ca0[_0x940d('0x1e')][_0x940d('0x20')]||null:null})[_0x940d('0x10')](function(_0x54ffa3){if(_0x54ffa3){return _0x54ffa3[_0x940d('0x23')](_0x735ca0[_0x940d('0x1d')][_0x940d('0x24')],_[_0x940d('0x25')](_0x735ca0[_0x940d('0x1d')],[_0x940d('0x24'),'id'])||{});}})[_0x940d('0x26')](function(_0x5be2a2){logger['info'](_0x940d('0x27'),_0x735ca0);logger[_0x940d('0x12')](_0x940d('0x27'),_0x735ca0,JSON[_0x940d('0x14')](_0x5be2a2));_0x24731c(_0x5be2a2);})[_0x940d('0x1a')](function(_0x59f68f){logger[_0x940d('0x15')](_0x940d('0x27'),_0x59f68f['message'],_0x735ca0);_0x226358(_this[_0x940d('0x15')](0x1f4,_0x59f68f[_0x940d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 6a7b36d..378dd16 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 _0x8e00=['removeListener','register','length','./chatInteraction.events','remove','emit'];(function(_0x4d3ef1,_0x5a6a7c){var _0xc229a9=function(_0x2f9c03){while(--_0x2f9c03){_0x4d3ef1['push'](_0x4d3ef1['shift']());}};_0xc229a9(++_0x5a6a7c);}(_0x8e00,0x159));var _0x08e0=function(_0x382ea9,_0x4019fa){_0x382ea9=_0x382ea9-0x0;var _0x282c0d=_0x8e00[_0x382ea9];return _0x282c0d;};'use strict';var ChatInteractionEvents=require(_0x08e0('0x0'));var events=['save',_0x08e0('0x1'),'update'];function createListener(_0x526a86,_0x598f62){return function(_0x27a07f){_0x598f62[_0x08e0('0x2')](_0x526a86,_0x27a07f);};}function removeListener(_0xa05c08,_0x4cc584){return function(){ChatInteractionEvents[_0x08e0('0x3')](_0xa05c08,_0x4cc584);};}exports[_0x08e0('0x4')]=function(_0x4e73c1){for(var _0x131223=0x0,_0x1b3f69=events[_0x08e0('0x5')];_0x131223<_0x1b3f69;_0x131223++){var _0x3a9bf9=events[_0x131223];var _0x5a253f=createListener('chatInteraction:'+_0x3a9bf9,_0x4e73c1);ChatInteractionEvents['on'](_0x3a9bf9,_0x5a253f);}}; \ No newline at end of file +var _0x3bef=['update','emit','register','length','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3bef,0x185));var _0xf3be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3bef[_0x3dd15e];return _0x231fd0;};'use strict';var ChatInteractionEvents=require(_0xf3be('0x0'));var events=[_0xf3be('0x1'),_0xf3be('0x2'),_0xf3be('0x3')];function createListener(_0x432a61,_0x2e37d1){return function(_0xdc837){_0x2e37d1[_0xf3be('0x4')](_0x432a61,_0xdc837);};}function removeListener(_0x34c0a3,_0x1098df){return function(){ChatInteractionEvents['removeListener'](_0x34c0a3,_0x1098df);};}exports[_0xf3be('0x5')]=function(_0x83a255){for(var _0x30494e=0x0,_0x1835bf=events[_0xf3be('0x6')];_0x30494e<_0x1835bf;_0x30494e++){var _0x48e92c=events[_0x30494e];var _0x363b33=createListener(_0xf3be('0x7')+_0x48e92c,_0x83a255);ChatInteractionEvents['on'](_0x48e92c,_0x363b33);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index bd06788..bea3f80 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 _0xe864=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','isChatInteractionAuthorized','show','/:id/messages','getMessages','getMyMessages','/:id/download','download','post','create','createVidaooSession','join','root','server/files/attachments/','format','now','originalname','replace','/:id/attachment_upload','addMessage','/:id/tags','tracked','chatinteraction:addtags','addTags','put','chat','update','/:id/custom_update','customUpdate','abandon','delete','chatinteraction:destroy','destroy','multer','util','path','connect-timeout','express'];(function(_0x5d4e2b,_0x417755){var _0x4520f9=function(_0x2840ed){while(--_0x2840ed){_0x5d4e2b['push'](_0x5d4e2b['shift']());}};_0x4520f9(++_0x417755);}(_0xe864,0x1db));var _0x4e86=function(_0x1e6cee,_0x2346ec){_0x1e6cee=_0x1e6cee-0x0;var _0x549528=_0xe864[_0x1e6cee];return _0x549528;};'use strict';var multer=require(_0x4e86('0x0'));var util=require(_0x4e86('0x1'));var path=require(_0x4e86('0x2'));var timeout=require(_0x4e86('0x3'));var express=require(_0x4e86('0x4'));var router=express[_0x4e86('0x5')]();var fs_extra=require(_0x4e86('0x6'));var auth=require(_0x4e86('0x7'));var interaction=require(_0x4e86('0x8'));var config=require(_0x4e86('0x9'));var controller=require(_0x4e86('0xa'));router[_0x4e86('0xb')]('/',auth[_0x4e86('0xc')](),controller[_0x4e86('0xd')]);router[_0x4e86('0xb')](_0x4e86('0xe'),auth[_0x4e86('0xc')](),controller[_0x4e86('0xf')]);router[_0x4e86('0xb')]('/:id',auth[_0x4e86('0x10')](),controller[_0x4e86('0x11')]);router['get']('/:id/attachment_download',auth[_0x4e86('0x10')](),controller['attachmentDownload']);router[_0x4e86('0xb')](_0x4e86('0x12'),auth[_0x4e86('0xc')](),controller[_0x4e86('0x13')]);router[_0x4e86('0xb')]('/:id/my_messages',auth[_0x4e86('0x10')](),controller[_0x4e86('0x14')]);router[_0x4e86('0xb')](_0x4e86('0x15'),auth['isAuthenticated'](),controller[_0x4e86('0x16')]);router[_0x4e86('0x17')]('/',auth[_0x4e86('0xc')](),controller[_0x4e86('0x18')]);router[_0x4e86('0x17')]('/:id/vidaoo',auth[_0x4e86('0xc')](),controller[_0x4e86('0x19')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2edc1f,_0x38f57d,_0x4e5845){_0x4e5845(null,path[_0x4e86('0x1a')](config[_0x4e86('0x1b')],_0x4e86('0x1c')));},'filename':function(_0x50c35f,_0x4d0a6e,_0x35af73){_0x35af73(null,util[_0x4e86('0x1d')]('%s-%s',Date[_0x4e86('0x1e')](),_0x4d0a6e[_0x4e86('0x1f')][_0x4e86('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x4e86('0x17')](_0x4e86('0x21'),upload['single']('file'),controller['attachmentUpload']);router[_0x4e86('0x17')](_0x4e86('0x12'),auth[_0x4e86('0x10')](),controller[_0x4e86('0x22')]);router[_0x4e86('0x17')](_0x4e86('0x23'),auth[_0x4e86('0xc')](),interaction[_0x4e86('0x24')]('chat',_0x4e86('0x25')),controller[_0x4e86('0x26')]);router[_0x4e86('0x27')]('/:id',auth[_0x4e86('0xc')](),interaction[_0x4e86('0x24')](_0x4e86('0x28'),'chatinteraction:update'),controller[_0x4e86('0x29')]);router[_0x4e86('0x27')](_0x4e86('0x2a'),controller[_0x4e86('0x2b')]);router[_0x4e86('0x27')]('/:id/abandon',auth[_0x4e86('0x10')](),controller[_0x4e86('0x2c')]);router['put']('/:id/close',controller['close']);router[_0x4e86('0x2d')]('/:id',auth[_0x4e86('0xc')](),interaction['tracked']('chat',_0x4e86('0x2e')),controller[_0x4e86('0x2f')]);router['delete'](_0x4e86('0x23'),auth[_0x4e86('0xc')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xa0ce=['fs-extra','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','getMyMessages','create','post','/:id/vidaoo','createVidaooSession','root','server/files/attachments/','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','/:id','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','path','express','Router'];(function(_0x24a82,_0x836580){var _0x37095d=function(_0x5bb2fc){while(--_0x5bb2fc){_0x24a82['push'](_0x24a82['shift']());}};_0x37095d(++_0x836580);}(_0xa0ce,0x128));var _0xea0c=function(_0xb97296,_0x12205e){_0xb97296=_0xb97296-0x0;var _0x22ab83=_0xa0ce[_0xb97296];return _0x22ab83;};'use strict';var multer=require(_0xea0c('0x0'));var util=require('util');var path=require(_0xea0c('0x1'));var timeout=require('connect-timeout');var express=require(_0xea0c('0x2'));var router=express[_0xea0c('0x3')]();var fs_extra=require(_0xea0c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xea0c('0x5'));var config=require(_0xea0c('0x6'));var controller=require(_0xea0c('0x7'));router[_0xea0c('0x8')]('/',auth[_0xea0c('0x9')](),controller[_0xea0c('0xa')]);router[_0xea0c('0x8')]('/describe',auth[_0xea0c('0x9')](),controller[_0xea0c('0xb')]);router['get']('/:id',auth[_0xea0c('0xc')](),controller[_0xea0c('0xd')]);router['get'](_0xea0c('0xe'),auth[_0xea0c('0xc')](),controller[_0xea0c('0xf')]);router['get'](_0xea0c('0x10'),auth[_0xea0c('0x9')](),controller[_0xea0c('0x11')]);router[_0xea0c('0x8')]('/:id/my_messages',auth[_0xea0c('0xc')](),controller[_0xea0c('0x12')]);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0xea0c('0x9')](),controller[_0xea0c('0x13')]);router[_0xea0c('0x14')](_0xea0c('0x15'),auth['isAuthenticated'](),controller[_0xea0c('0x16')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x36846e,_0x43f65b,_0x51573b){_0x51573b(null,path['join'](config[_0xea0c('0x17')],_0xea0c('0x18')));},'filename':function(_0x21c28f,_0x1fc0ac,_0xcedbd6){_0xcedbd6(null,util['format'](_0xea0c('0x19'),Date[_0xea0c('0x1a')](),_0x1fc0ac[_0xea0c('0x1b')][_0xea0c('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xea0c('0x14')](_0xea0c('0x1d'),upload[_0xea0c('0x1e')](_0xea0c('0x1f')),controller[_0xea0c('0x20')]);router[_0xea0c('0x14')](_0xea0c('0x10'),auth[_0xea0c('0xc')](),controller[_0xea0c('0x21')]);router[_0xea0c('0x14')](_0xea0c('0x22'),auth['isAuthenticated'](),interaction[_0xea0c('0x23')](_0xea0c('0x24'),_0xea0c('0x25')),controller[_0xea0c('0x26')]);router[_0xea0c('0x27')](_0xea0c('0x28'),auth[_0xea0c('0x9')](),interaction[_0xea0c('0x23')](_0xea0c('0x24'),'chatinteraction:update'),controller['update']);router[_0xea0c('0x27')]('/:id/custom_update',controller['customUpdate']);router[_0xea0c('0x27')](_0xea0c('0x29'),auth[_0xea0c('0xc')](),controller[_0xea0c('0x2a')]);router[_0xea0c('0x27')](_0xea0c('0x2b'),controller[_0xea0c('0x2c')]);router[_0xea0c('0x2d')](_0xea0c('0x28'),auth[_0xea0c('0x9')](),interaction[_0xea0c('0x23')](_0xea0c('0x24'),_0xea0c('0x2e')),controller[_0xea0c('0x2f')]);router[_0xea0c('0x2d')](_0xea0c('0x22'),auth[_0xea0c('0x9')](),controller[_0xea0c('0x30')]);module[_0xea0c('0x31')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 1d1a1fc..c5fddfa 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 _0x6fcf=['sequelize','exports','TEXT','BOOLEAN','INTEGER'];(function(_0xeefb3d,_0x51a865){var _0x4fd222=function(_0x11aa14){while(--_0x11aa14){_0xeefb3d['push'](_0xeefb3d['shift']());}};_0x4fd222(++_0x51a865);}(_0x6fcf,0x1f4));var _0xf6fc=function(_0x1055d3,_0x5dce87){_0x1055d3=_0x1055d3-0x0;var _0x55b24a=_0x6fcf[_0x1055d3];return _0x55b24a;};'use strict';var Sequelize=require(_0xf6fc('0x0'));module[_0xf6fc('0x1')]={'body':{'type':Sequelize[_0xf6fc('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xf6fc('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xf6fc('0x4')]}}; \ No newline at end of file +var _0xf151=['TEXT','medium','BOOLEAN','sequelize','exports'];(function(_0x27c63a,_0x443297){var _0x1018ca=function(_0x1902d0){while(--_0x1902d0){_0x27c63a['push'](_0x27c63a['shift']());}};_0x1018ca(++_0x443297);}(_0xf151,0x6c));var _0x1f15=function(_0x3faf6f,_0x389fde){_0x3faf6f=_0x3faf6f-0x0;var _0x402a53=_0xf151[_0x3faf6f];return _0x402a53;};'use strict';var Sequelize=require(_0x1f15('0x0'));module[_0x1f15('0x1')]={'body':{'type':Sequelize[_0x1f15('0x2')](_0x1f15('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x1f15('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 96842fa..9fc2bc2 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 _0x59b1=['filter','VIRTUAL','options','ChatInternalMessage','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','describe','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','userpic','internal','allowmessenger','showWebBar','-online','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','resourceId','push','FromId','ToId','read','-createdAt','all','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','sendStatus','end','status','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x4c2665,_0x5623e0){var _0x3a4fa5=function(_0x1785f8){while(--_0x1785f8){_0x4c2665['push'](_0x4c2665['shift']());}};_0x3a4fa5(++_0x5623e0);}(_0x59b1,0x10e));var _0x159b=function(_0x2ade90,_0xf704df){_0x2ade90=_0x2ade90-0x0;var _0x2cbfa6=_0x59b1[_0x2ade90];return _0x2cbfa6;};'use strict';var emlformat=require(_0x159b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x159b('0x1'));var jsonpatch=require(_0x159b('0x2'));var rp=require(_0x159b('0x3'));var moment=require(_0x159b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x159b('0x5'));var util=require(_0x159b('0x6'));var path=require('path');var sox=require(_0x159b('0x7'));var csv=require(_0x159b('0x8'));var ejs=require(_0x159b('0x9'));var fs=require('fs');var fs_extra=require(_0x159b('0xa'));var _=require(_0x159b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x159b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x159b('0x8'));var querystring=require(_0x159b('0xd'));var Papa=require(_0x159b('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x159b('0xf'));var as=require(_0x159b('0x10'));var hardwareService=require(_0x159b('0x11'));var logger=require(_0x159b('0x12'))(_0x159b('0x13'));var utils=require(_0x159b('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x159b('0x15'))['db'];config[_0x159b('0x16')]=_[_0x159b('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x159b('0x18'))(new Redis(config[_0x159b('0x16')]));require(_0x159b('0x19'))['register'](socket);function respondWithStatusCode(_0x1d0c46,_0x1ac06c){_0x1ac06c=_0x1ac06c||0xcc;return function(_0x172282){if(_0x172282){return _0x1d0c46[_0x159b('0x1a')](_0x1ac06c);}return _0x1d0c46['status'](_0x1ac06c)[_0x159b('0x1b')]();};}function respondWithResult(_0x3156d4,_0x516936){_0x516936=_0x516936||0xc8;return function(_0x248937){if(_0x248937){return _0x3156d4[_0x159b('0x1c')](_0x516936)[_0x159b('0x1d')](_0x248937);}};}function respondWithFilteredResult(_0x479418,_0x4d4e35){return function(_0x2d15c6){if(_0x2d15c6){var _0xde2f9e=typeof _0x4d4e35['offset']===_0x159b('0x1e')&&typeof _0x4d4e35['limit']===_0x159b('0x1e');var _0xf57353=_0x2d15c6['count'];var _0xb65eb5=_0xde2f9e?0x0:_0x4d4e35[_0x159b('0x1f')];var _0x3ac268=_0xde2f9e?_0x2d15c6[_0x159b('0x20')]:_0x4d4e35['offset']+_0x4d4e35[_0x159b('0x21')];var _0x491475;if(_0x3ac268>=_0xf57353){_0x3ac268=_0xf57353;_0x491475=0xc8;}else{_0x491475=0xce;}_0x479418['status'](_0x491475);return _0x479418[_0x159b('0x22')](_0x159b('0x23'),_0xb65eb5+'-'+_0x3ac268+'/'+_0xf57353)['json'](_0x2d15c6);}return null;};}function patchUpdates(_0x23775a){return function(_0x46e67f){try{jsonpatch[_0x159b('0x24')](_0x46e67f,_0x23775a,!![]);}catch(_0x4e4a56){return BPromise[_0x159b('0x25')](_0x4e4a56);}return _0x46e67f[_0x159b('0x26')]();};}function saveUpdates(_0xa36e62,_0x42b548){return function(_0x28cfe5){if(_0x28cfe5){return _0x28cfe5[_0x159b('0x27')](_0xa36e62)[_0x159b('0x28')](function(_0x14165b){return _0x14165b;});}return null;};}function removeEntity(_0x4d7cab,_0x10079a){return function(_0x36d687){if(_0x36d687){return _0x36d687['destroy']()[_0x159b('0x28')](function(){_0x4d7cab[_0x159b('0x1c')](0xcc)[_0x159b('0x1b')]();});}};}function handleEntityNotFound(_0x2f9ec9,_0x345ee2){return function(_0x235a8e){if(!_0x235a8e){_0x2f9ec9[_0x159b('0x1a')](0x194);}return _0x235a8e;};}function handleError(_0x1ab787,_0x502944){_0x502944=_0x502944||0x1f4;return function(_0x1c4c33){logger[_0x159b('0x29')](_0x1c4c33[_0x159b('0x2a')]);if(_0x1c4c33[_0x159b('0x2b')]){delete _0x1c4c33[_0x159b('0x2b')];}_0x1ab787[_0x159b('0x1c')](_0x502944)[_0x159b('0x2c')](_0x1c4c33);};}exports[_0x159b('0x2d')]=function(_0x3ce2d2,_0x53175c){var _0x3145cc={},_0x3005cb={},_0x2f5031={'count':0x0,'rows':[]};var _0x2139a6=_['map'](db['ChatInternalMessage'][_0x159b('0x2e')],function(_0x5aac4c){return{'name':_0x5aac4c['fieldName'],'type':_0x5aac4c[_0x159b('0x2f')][_0x159b('0x30')]};});_0x3005cb[_0x159b('0x31')]=_[_0x159b('0x32')](_0x2139a6,'name');_0x3005cb[_0x159b('0x33')]=_[_0x159b('0x34')](_0x3ce2d2['query']);_0x3005cb[_0x159b('0x35')]=_['intersection'](_0x3005cb[_0x159b('0x31')],_0x3005cb[_0x159b('0x33')]);_0x3145cc[_0x159b('0x36')]=_[_0x159b('0x37')](_0x3005cb[_0x159b('0x31')],qs[_0x159b('0x38')](_0x3ce2d2['query'][_0x159b('0x38')]));_0x3145cc[_0x159b('0x36')]=_0x3145cc[_0x159b('0x36')][_0x159b('0x39')]?_0x3145cc[_0x159b('0x36')]:_0x3005cb[_0x159b('0x31')];if(!_0x3ce2d2[_0x159b('0x33')][_0x159b('0x3a')](_0x159b('0x3b'))){_0x3145cc[_0x159b('0x21')]=qs['limit'](_0x3ce2d2[_0x159b('0x33')][_0x159b('0x21')]);_0x3145cc[_0x159b('0x1f')]=qs[_0x159b('0x1f')](_0x3ce2d2[_0x159b('0x33')]['offset']);}_0x3145cc['order']=qs[_0x159b('0x3c')](_0x3ce2d2[_0x159b('0x33')]['sort']);_0x3145cc[_0x159b('0x3d')]=qs[_0x159b('0x35')](_[_0x159b('0x3e')](_0x3ce2d2[_0x159b('0x33')],_0x3005cb[_0x159b('0x35')]),_0x2139a6);if(_0x3ce2d2[_0x159b('0x33')][_0x159b('0x3f')]){_0x3145cc[_0x159b('0x3d')]=_['merge'](_0x3145cc[_0x159b('0x3d')],{'$or':_[_0x159b('0x32')](_0x2139a6,function(_0x129fc9){if(_0x129fc9['type']!==_0x159b('0x40')){var _0x1a1e86={};_0x1a1e86[_0x129fc9[_0x159b('0x2b')]]={'$like':'%'+_0x3ce2d2[_0x159b('0x33')]['filter']+'%'};return _0x1a1e86;}})});}_0x3145cc=_['merge']({},_0x3145cc,_0x3ce2d2[_0x159b('0x41')]);var _0x4416f5={'where':_0x3145cc['where']};return db[_0x159b('0x42')][_0x159b('0x20')](_0x4416f5)['then'](function(_0x3cb0b0){_0x2f5031[_0x159b('0x20')]=_0x3cb0b0;if(_0x3ce2d2[_0x159b('0x33')][_0x159b('0x43')]){_0x3145cc[_0x159b('0x44')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x159b('0x45')](_0x3145cc);})['then'](function(_0x536a0d){_0x2f5031[_0x159b('0x46')]=_0x536a0d;return _0x2f5031;})['then'](respondWithFilteredResult(_0x53175c,_0x3145cc))[_0x159b('0x47')](handleError(_0x53175c,null));};exports[_0x159b('0x48')]=function(_0x17830f,_0x35872a){var _0x44f806={'raw':!![],'where':{'id':_0x17830f[_0x159b('0x49')]['id']}},_0x65920d={};_0x65920d[_0x159b('0x31')]=_[_0x159b('0x34')](db[_0x159b('0x42')][_0x159b('0x2e')]);_0x65920d['query']=_[_0x159b('0x34')](_0x17830f[_0x159b('0x33')]);_0x65920d['filters']=_['intersection'](_0x65920d[_0x159b('0x31')],_0x65920d[_0x159b('0x33')]);_0x44f806['attributes']=_[_0x159b('0x37')](_0x65920d['model'],qs['fields'](_0x17830f[_0x159b('0x33')][_0x159b('0x38')]));_0x44f806[_0x159b('0x36')]=_0x44f806[_0x159b('0x36')]['length']?_0x44f806[_0x159b('0x36')]:_0x65920d[_0x159b('0x31')];if(_0x17830f['query']['includeAll']){_0x44f806['include']=[{'all':!![]}];}_0x44f806=_['merge']({},_0x44f806,_0x17830f['options']);return db[_0x159b('0x42')]['find'](_0x44f806)[_0x159b('0x28')](handleEntityNotFound(_0x35872a,null))[_0x159b('0x28')](respondWithResult(_0x35872a,null))[_0x159b('0x47')](handleError(_0x35872a,null));};exports['create']=function(_0x2cb45f,_0x6cd8d8){return db[_0x159b('0x42')][_0x159b('0x4a')](_0x2cb45f['body'],{})['then'](respondWithResult(_0x6cd8d8,0xc9))['catch'](handleError(_0x6cd8d8,null));};exports['update']=function(_0x4bc879,_0x24cb69){if(_0x4bc879[_0x159b('0x4b')]['id']){delete _0x4bc879[_0x159b('0x4b')]['id'];}return db[_0x159b('0x42')][_0x159b('0x4c')]({'where':{'id':_0x4bc879['params']['id']}})[_0x159b('0x28')](handleEntityNotFound(_0x24cb69,null))[_0x159b('0x28')](saveUpdates(_0x4bc879[_0x159b('0x4b')],null))[_0x159b('0x28')](respondWithResult(_0x24cb69,null))[_0x159b('0x47')](handleError(_0x24cb69,null));};exports[_0x159b('0x4d')]=function(_0xcd62a5,_0x32f1e9){return db['ChatInternalMessage'][_0x159b('0x4c')]({'where':{'id':_0xcd62a5[_0x159b('0x49')]['id']}})[_0x159b('0x28')](handleEntityNotFound(_0x32f1e9,null))[_0x159b('0x28')](removeEntity(_0x32f1e9,null))[_0x159b('0x47')](handleError(_0x32f1e9,null));};exports[_0x159b('0x4e')]=function(_0x45f453,_0x557e00){return db[_0x159b('0x42')]['describe']()[_0x159b('0x28')](respondWithResult(_0x557e00,null))[_0x159b('0x47')](handleError(_0x557e00,null));};function wrapUser(_0x17c18e){return function(_0x440d91){var _0x484f87=_0x17c18e['get']({'plain':!![]});_0x484f87[_0x159b('0x4f')]=[];if(_0x440d91){_0x484f87[_0x159b('0x50')]=_0x440d91[_0x159b('0x51')];_0x484f87[_0x159b('0x52')]=_0x440d91;}else{_0x484f87[_0x159b('0x50')]=moment(0x0)[_0x159b('0x53')](_0x159b('0x54'));_0x484f87[_0x159b('0x52')]={};}return _0x484f87;};}exports[_0x159b('0x55')]=function(_0xe01a3c,_0x5f0740,_0x4a312d){var _0x46bd38=[];return db[_0x159b('0x56')][_0x159b('0x45')]({'where':{'role':[_0x159b('0x57'),_0x159b('0x58'),_0x159b('0x59')]},'attributes':['id',_0x159b('0x5a'),_0x159b('0x2b'),_0x159b('0x5b'),_0x159b('0x5c'),_0x159b('0x5d'),'online','lastLoginAt',_0x159b('0x5e'),_0x159b('0x5f')],'order':qs[_0x159b('0x3c')](_0x159b('0x60')),'include':[{'model':db['VoiceQueue'],'as':_0x159b('0x61'),'attributes':['id','name',_0x159b('0x2f')],'through':{'attributes':[]}}]})[_0x159b('0x28')](function(_0xf2974e){if(_0xf2974e){var _0x239cfa=_0xe01a3c['user']['get']({'plain':!![]});if(!_0x239cfa)throw new Error(_0x159b('0x62'));if(_0x239cfa[_0x159b('0x5b')]===_0x159b('0x59')){return db[_0x159b('0x63')][_0x159b('0x4c')]({'where':{'name':_0x159b('0x64'),'userProfileId':_0x239cfa[_0x159b('0x65')]},'raw':!![]})[_0x159b('0x28')](function(_0x18802d){if(_0x18802d){if(_0x18802d[_0x159b('0x66')]===0x0){return db[_0x159b('0x67')]['findAll']({'where':{'sectionId':_0x18802d['id']},'raw':!![]})[_0x159b('0x28')](function(_0x2fa9dc){var _0x393bcc=[];if(_['isEmpty'](_0x2fa9dc)){_0x393bcc=_['filter'](_0xf2974e,function(_0x353334){if(_0x353334[_0x159b('0x5b')]!==_0x159b('0x57')){return _0x353334;}});return _0x393bcc;}else{for(var _0xc2b290=0x0;_0xc2b290<_0xf2974e[_0x159b('0x39')];_0xc2b290++){var _0x2563b8=_0xf2974e[_0xc2b290];if(_0x2563b8[_0x159b('0x5b')]==='agent'){var _0x5ac5cd=_[_0x159b('0x4c')](_0x2fa9dc,function(_0x442a5a){return _0x442a5a[_0x159b('0x68')]===_0x2563b8['id'];});if(_0x5ac5cd)_0x393bcc[_0x159b('0x69')](_0x2563b8);}else{_0x393bcc[_0x159b('0x69')](_0x2563b8);}}return _0x393bcc;}});}else{return _0xf2974e;}}else{var _0x172e02=_[_0x159b('0x3f')](_0xf2974e,function(_0x176b7b){if(_0x176b7b[_0x159b('0x5b')]!==_0x159b('0x57')){return _0x176b7b;}});return _0x172e02;}});}else{return _0xf2974e;}}})[_0x159b('0x28')](function(_0x276329){var _0x1f9351=[];if(_0x276329){_0x46bd38=_0x276329;for(var _0x48efe1=0x0;_0x48efe1<_0x276329[_0x159b('0x39')];_0x48efe1+=0x1){_0x46bd38[_0x48efe1][_0x159b('0x4f')]=[];_0x1f9351['push'](db[_0x159b('0x42')][_0x159b('0x4c')]({'where':{'FromId':[_0xe01a3c[_0x159b('0x59')]['id'],_0x276329[_0x48efe1]['id']],'ToId':[_0xe01a3c['user']['id'],_0x276329[_0x48efe1]['id']],'ChatGroupId':null},'attributes':['id',_0x159b('0x51'),_0x159b('0x6a'),_0x159b('0x6b'),_0x159b('0x6c'),'body'],'order':qs['sort'](_0x159b('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x159b('0x28')](wrapUser(_0x276329[_0x48efe1])));}return BPromise[_0x159b('0x6e')](_0x1f9351);}return[];})[_0x159b('0x28')](function(_0x53f63d){return{'rows':_0x53f63d,'count':_0x53f63d['length']};})[_0x159b('0x28')](respondWithResult(_0x5f0740,null))[_0x159b('0x47')](handleError(_0x5f0740,null));}; \ No newline at end of file +var _0xeac0=['findAll','rows','catch','show','params','includeAll','create','body','find','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','admin','user','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','order','sort','filter','merge','type','VIRTUAL','options','ChatInternalMessage','include'];(function(_0x308e4f,_0x134e25){var _0x17ab35=function(_0x2cfcd9){while(--_0x2cfcd9){_0x308e4f['push'](_0x308e4f['shift']());}};_0x17ab35(++_0x134e25);}(_0xeac0,0x1db));var _0x0eac=function(_0x406ade,_0x1eccbd){_0x406ade=_0x406ade-0x0;var _0x13962e=_0xeac0[_0x406ade];return _0x13962e;};'use strict';var emlformat=require(_0x0eac('0x0'));var rimraf=require(_0x0eac('0x1'));var zipdir=require(_0x0eac('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0eac('0x3'));var moment=require(_0x0eac('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0eac('0x5'));var util=require(_0x0eac('0x6'));var path=require(_0x0eac('0x7'));var sox=require(_0x0eac('0x8'));var csv=require(_0x0eac('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0eac('0xa'));var crypto=require('crypto');var jsforce=require(_0x0eac('0xb'));var deskjs=require(_0x0eac('0xc'));var toCsv=require(_0x0eac('0x9'));var querystring=require(_0x0eac('0xd'));var Papa=require(_0x0eac('0xe'));var Redis=require(_0x0eac('0xf'));var authService=require(_0x0eac('0x10'));var qs=require(_0x0eac('0x11'));var as=require(_0x0eac('0x12'));var hardwareService=require(_0x0eac('0x13'));var logger=require(_0x0eac('0x14'))(_0x0eac('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0eac('0x16'))['db'];config[_0x0eac('0x17')]=_[_0x0eac('0x18')](config[_0x0eac('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x0eac('0x19'))(new Redis(config[_0x0eac('0x17')]));require('./chatInternalMessage.socket')[_0x0eac('0x1a')](socket);function respondWithStatusCode(_0x41d172,_0x1f4ffc){_0x1f4ffc=_0x1f4ffc||0xcc;return function(_0x11c9be){if(_0x11c9be){return _0x41d172[_0x0eac('0x1b')](_0x1f4ffc);}return _0x41d172[_0x0eac('0x1c')](_0x1f4ffc)[_0x0eac('0x1d')]();};}function respondWithResult(_0x4d2835,_0x1ce6a1){_0x1ce6a1=_0x1ce6a1||0xc8;return function(_0xdbf5f8){if(_0xdbf5f8){return _0x4d2835[_0x0eac('0x1c')](_0x1ce6a1)[_0x0eac('0x1e')](_0xdbf5f8);}};}function respondWithFilteredResult(_0x33be07,_0x5612b4){return function(_0x521ed1){if(_0x521ed1){var _0x2cc53e=typeof _0x5612b4['offset']===_0x0eac('0x1f')&&typeof _0x5612b4[_0x0eac('0x20')]===_0x0eac('0x1f');var _0x4f9f2d=_0x521ed1[_0x0eac('0x21')];var _0x15fce4=_0x2cc53e?0x0:_0x5612b4[_0x0eac('0x22')];var _0x3725db=_0x2cc53e?_0x521ed1['count']:_0x5612b4[_0x0eac('0x22')]+_0x5612b4[_0x0eac('0x20')];var _0x262536;if(_0x3725db>=_0x4f9f2d){_0x3725db=_0x4f9f2d;_0x262536=0xc8;}else{_0x262536=0xce;}_0x33be07['status'](_0x262536);return _0x33be07[_0x0eac('0x23')](_0x0eac('0x24'),_0x15fce4+'-'+_0x3725db+'/'+_0x4f9f2d)[_0x0eac('0x1e')](_0x521ed1);}return null;};}function patchUpdates(_0x5bcfbf){return function(_0xb7ea8c){try{jsonpatch['apply'](_0xb7ea8c,_0x5bcfbf,!![]);}catch(_0x106aff){return BPromise[_0x0eac('0x25')](_0x106aff);}return _0xb7ea8c[_0x0eac('0x26')]();};}function saveUpdates(_0xcc7764,_0x15ef0f){return function(_0x2bac22){if(_0x2bac22){return _0x2bac22[_0x0eac('0x27')](_0xcc7764)[_0x0eac('0x28')](function(_0x364e22){return _0x364e22;});}return null;};}function removeEntity(_0x43c5c7,_0x2dbf19){return function(_0x3139ff){if(_0x3139ff){return _0x3139ff[_0x0eac('0x29')]()['then'](function(){_0x43c5c7[_0x0eac('0x1c')](0xcc)[_0x0eac('0x1d')]();});}};}function handleEntityNotFound(_0x456d6f,_0x435bd3){return function(_0x5912e0){if(!_0x5912e0){_0x456d6f[_0x0eac('0x1b')](0x194);}return _0x5912e0;};}function handleError(_0x21b5ad,_0x2c4a55){_0x2c4a55=_0x2c4a55||0x1f4;return function(_0x2721b4){logger['error'](_0x2721b4['stack']);if(_0x2721b4[_0x0eac('0x2a')]){delete _0x2721b4[_0x0eac('0x2a')];}_0x21b5ad[_0x0eac('0x1c')](_0x2c4a55)[_0x0eac('0x2b')](_0x2721b4);};}exports[_0x0eac('0x2c')]=function(_0x275684,_0x5f5ba1){var _0x122080={},_0x1ec46e={},_0x5fc801={'count':0x0,'rows':[]};var _0x537a9a=_[_0x0eac('0x2d')](db['ChatInternalMessage'][_0x0eac('0x2e')],function(_0x1ac506){return{'name':_0x1ac506[_0x0eac('0x2f')],'type':_0x1ac506['type']['key']};});_0x1ec46e[_0x0eac('0x30')]=_[_0x0eac('0x2d')](_0x537a9a,_0x0eac('0x2a'));_0x1ec46e[_0x0eac('0x31')]=_[_0x0eac('0x32')](_0x275684[_0x0eac('0x31')]);_0x1ec46e[_0x0eac('0x33')]=_[_0x0eac('0x34')](_0x1ec46e[_0x0eac('0x30')],_0x1ec46e[_0x0eac('0x31')]);_0x122080[_0x0eac('0x35')]=_[_0x0eac('0x34')](_0x1ec46e[_0x0eac('0x30')],qs['fields'](_0x275684[_0x0eac('0x31')][_0x0eac('0x36')]));_0x122080[_0x0eac('0x35')]=_0x122080[_0x0eac('0x35')][_0x0eac('0x37')]?_0x122080[_0x0eac('0x35')]:_0x1ec46e['model'];if(!_0x275684[_0x0eac('0x31')]['hasOwnProperty']('nolimit')){_0x122080[_0x0eac('0x20')]=qs['limit'](_0x275684[_0x0eac('0x31')]['limit']);_0x122080[_0x0eac('0x22')]=qs[_0x0eac('0x22')](_0x275684[_0x0eac('0x31')][_0x0eac('0x22')]);}_0x122080[_0x0eac('0x38')]=qs[_0x0eac('0x39')](_0x275684[_0x0eac('0x31')]['sort']);_0x122080['where']=qs[_0x0eac('0x33')](_['pick'](_0x275684['query'],_0x1ec46e[_0x0eac('0x33')]),_0x537a9a);if(_0x275684[_0x0eac('0x31')][_0x0eac('0x3a')]){_0x122080['where']=_[_0x0eac('0x3b')](_0x122080['where'],{'$or':_[_0x0eac('0x2d')](_0x537a9a,function(_0x2c3d3e){if(_0x2c3d3e[_0x0eac('0x3c')]!==_0x0eac('0x3d')){var _0x21e6e0={};_0x21e6e0[_0x2c3d3e[_0x0eac('0x2a')]]={'$like':'%'+_0x275684[_0x0eac('0x31')]['filter']+'%'};return _0x21e6e0;}})});}_0x122080=_[_0x0eac('0x3b')]({},_0x122080,_0x275684[_0x0eac('0x3e')]);var _0x342945={'where':_0x122080['where']};return db[_0x0eac('0x3f')]['count'](_0x342945)[_0x0eac('0x28')](function(_0x30806b){_0x5fc801['count']=_0x30806b;if(_0x275684[_0x0eac('0x31')]['includeAll']){_0x122080[_0x0eac('0x40')]=[{'all':!![]}];}return db[_0x0eac('0x3f')][_0x0eac('0x41')](_0x122080);})[_0x0eac('0x28')](function(_0x2da445){_0x5fc801[_0x0eac('0x42')]=_0x2da445;return _0x5fc801;})['then'](respondWithFilteredResult(_0x5f5ba1,_0x122080))[_0x0eac('0x43')](handleError(_0x5f5ba1,null));};exports[_0x0eac('0x44')]=function(_0x24719f,_0x335cb1){var _0x37fec8={'raw':!![],'where':{'id':_0x24719f[_0x0eac('0x45')]['id']}},_0x1e8438={};_0x1e8438[_0x0eac('0x30')]=_[_0x0eac('0x32')](db['ChatInternalMessage'][_0x0eac('0x2e')]);_0x1e8438[_0x0eac('0x31')]=_[_0x0eac('0x32')](_0x24719f[_0x0eac('0x31')]);_0x1e8438['filters']=_[_0x0eac('0x34')](_0x1e8438[_0x0eac('0x30')],_0x1e8438['query']);_0x37fec8[_0x0eac('0x35')]=_[_0x0eac('0x34')](_0x1e8438[_0x0eac('0x30')],qs[_0x0eac('0x36')](_0x24719f[_0x0eac('0x31')][_0x0eac('0x36')]));_0x37fec8[_0x0eac('0x35')]=_0x37fec8[_0x0eac('0x35')][_0x0eac('0x37')]?_0x37fec8['attributes']:_0x1e8438[_0x0eac('0x30')];if(_0x24719f[_0x0eac('0x31')][_0x0eac('0x46')]){_0x37fec8[_0x0eac('0x40')]=[{'all':!![]}];}_0x37fec8=_['merge']({},_0x37fec8,_0x24719f[_0x0eac('0x3e')]);return db[_0x0eac('0x3f')]['find'](_0x37fec8)['then'](handleEntityNotFound(_0x335cb1,null))['then'](respondWithResult(_0x335cb1,null))[_0x0eac('0x43')](handleError(_0x335cb1,null));};exports['create']=function(_0x19adea,_0x34789e){return db[_0x0eac('0x3f')][_0x0eac('0x47')](_0x19adea['body'],{})[_0x0eac('0x28')](respondWithResult(_0x34789e,0xc9))[_0x0eac('0x43')](handleError(_0x34789e,null));};exports[_0x0eac('0x27')]=function(_0x493f5c,_0x4bff78){if(_0x493f5c[_0x0eac('0x48')]['id']){delete _0x493f5c[_0x0eac('0x48')]['id'];}return db['ChatInternalMessage'][_0x0eac('0x49')]({'where':{'id':_0x493f5c['params']['id']}})[_0x0eac('0x28')](handleEntityNotFound(_0x4bff78,null))[_0x0eac('0x28')](saveUpdates(_0x493f5c[_0x0eac('0x48')],null))[_0x0eac('0x28')](respondWithResult(_0x4bff78,null))['catch'](handleError(_0x4bff78,null));};exports['destroy']=function(_0x161cd7,_0x78b013){return db['ChatInternalMessage']['find']({'where':{'id':_0x161cd7['params']['id']}})[_0x0eac('0x28')](handleEntityNotFound(_0x78b013,null))[_0x0eac('0x28')](removeEntity(_0x78b013,null))[_0x0eac('0x43')](handleError(_0x78b013,null));};exports[_0x0eac('0x4a')]=function(_0x56a26d,_0x586f4e){return db[_0x0eac('0x3f')][_0x0eac('0x4a')]()[_0x0eac('0x28')](respondWithResult(_0x586f4e,null))[_0x0eac('0x43')](handleError(_0x586f4e,null));};function wrapUser(_0x22fc83){return function(_0x5b0fa3){var _0xa4101f=_0x22fc83[_0x0eac('0x4b')]({'plain':!![]});_0xa4101f[_0x0eac('0x4c')]=[];if(_0x5b0fa3){_0xa4101f[_0x0eac('0x4d')]=_0x5b0fa3[_0x0eac('0x4e')];_0xa4101f[_0x0eac('0x4f')]=_0x5b0fa3;}else{_0xa4101f[_0x0eac('0x4d')]=moment(0x0)[_0x0eac('0x50')](_0x0eac('0x51'));_0xa4101f[_0x0eac('0x4f')]={};}return _0xa4101f;};}exports[_0x0eac('0x52')]=function(_0x439c07,_0x510cbc,_0x1521d3){var _0x4939b4=[];return db['User'][_0x0eac('0x41')]({'where':{'role':[_0x0eac('0x53'),_0x0eac('0x54'),_0x0eac('0x55')]},'attributes':['id','fullname','name','role','userpic','internal',_0x0eac('0x56'),_0x0eac('0x57'),_0x0eac('0x58'),_0x0eac('0x59')],'order':qs[_0x0eac('0x39')](_0x0eac('0x5a')),'include':[{'model':db[_0x0eac('0x5b')],'as':_0x0eac('0x5c'),'attributes':['id',_0x0eac('0x2a'),'type'],'through':{'attributes':[]}}]})[_0x0eac('0x28')](function(_0x47ed43){if(_0x47ed43){var _0x49bde6=_0x439c07[_0x0eac('0x55')][_0x0eac('0x4b')]({'plain':!![]});if(!_0x49bde6)throw new Error(_0x0eac('0x5d'));if(_0x49bde6[_0x0eac('0x5e')]==='user'){return db[_0x0eac('0x5f')][_0x0eac('0x49')]({'where':{'name':_0x0eac('0x60'),'userProfileId':_0x49bde6[_0x0eac('0x61')]},'raw':!![]})[_0x0eac('0x28')](function(_0x50ce63){if(_0x50ce63){if(_0x50ce63[_0x0eac('0x62')]===0x0){return db[_0x0eac('0x63')][_0x0eac('0x41')]({'where':{'sectionId':_0x50ce63['id']},'raw':!![]})['then'](function(_0x469413){var _0x282d5c=[];if(_[_0x0eac('0x64')](_0x469413)){_0x282d5c=_['filter'](_0x47ed43,function(_0x42290c){if(_0x42290c[_0x0eac('0x5e')]!==_0x0eac('0x53')){return _0x42290c;}});return _0x282d5c;}else{for(var _0x37c4de=0x0;_0x37c4de<_0x47ed43['length'];_0x37c4de++){var _0x4f230e=_0x47ed43[_0x37c4de];if(_0x4f230e[_0x0eac('0x5e')]===_0x0eac('0x53')){var _0x475ccc=_[_0x0eac('0x49')](_0x469413,function(_0x27d709){return _0x27d709[_0x0eac('0x65')]===_0x4f230e['id'];});if(_0x475ccc)_0x282d5c[_0x0eac('0x66')](_0x4f230e);}else{_0x282d5c['push'](_0x4f230e);}}return _0x282d5c;}});}else{return _0x47ed43;}}else{var _0x28e61f=_[_0x0eac('0x3a')](_0x47ed43,function(_0x2b8a44){if(_0x2b8a44[_0x0eac('0x5e')]!==_0x0eac('0x53')){return _0x2b8a44;}});return _0x28e61f;}});}else{return _0x47ed43;}}})['then'](function(_0x4f2616){var _0x2fcb9d=[];if(_0x4f2616){_0x4939b4=_0x4f2616;for(var _0xea141=0x0;_0xea141<_0x4f2616[_0x0eac('0x37')];_0xea141+=0x1){_0x4939b4[_0xea141]['messages']=[];_0x2fcb9d[_0x0eac('0x66')](db[_0x0eac('0x3f')][_0x0eac('0x49')]({'where':{'FromId':[_0x439c07[_0x0eac('0x55')]['id'],_0x4f2616[_0xea141]['id']],'ToId':[_0x439c07[_0x0eac('0x55')]['id'],_0x4f2616[_0xea141]['id']],'ChatGroupId':null},'attributes':['id',_0x0eac('0x4e'),_0x0eac('0x67'),_0x0eac('0x68'),_0x0eac('0x69'),_0x0eac('0x48')],'order':qs['sort'](_0x0eac('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x0eac('0x28')](wrapUser(_0x4f2616[_0xea141])));}return BPromise[_0x0eac('0x6b')](_0x2fcb9d);}return[];})[_0x0eac('0x28')](function(_0x4c8133){return{'rows':_0x4c8133,'count':_0x4c8133[_0x0eac('0x37')]};})[_0x0eac('0x28')](respondWithResult(_0x510cbc,null))['catch'](handleError(_0x510cbc,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index ebdb855..f22d372 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 _0x2c64=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x3891ce,_0x312c49){var _0xdf2765=function(_0x5afd39){while(--_0x5afd39){_0x3891ce['push'](_0x3891ce['shift']());}};_0xdf2765(++_0x312c49);}(_0x2c64,0x181));var _0x42c6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x2c64[_0x173441];return _0x2423a8;};'use strict';var EventEmitter=require(_0x42c6('0x0'));var ChatInternalMessage=require(_0x42c6('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x42c6('0x2')](0x0);var events={'afterCreate':_0x42c6('0x3'),'afterUpdate':_0x42c6('0x4'),'afterDestroy':_0x42c6('0x5')};function emitEvent(_0x4c5b95){return function(_0x5a6d74,_0x427ee2,_0x41e211){ChatInternalMessageEvents[_0x42c6('0x6')](_0x4c5b95+':'+_0x5a6d74['id'],_0x5a6d74);ChatInternalMessageEvents['emit'](_0x4c5b95,_0x5a6d74);_0x41e211(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x42c6('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x8074=['save','update','remove','emit','exports','events','../../mysqldb','ChatInternalMessage'];(function(_0x5c6244,_0x112ab8){var _0x5800ce=function(_0x304e3d){while(--_0x304e3d){_0x5c6244['push'](_0x5c6244['shift']());}};_0x5800ce(++_0x112ab8);}(_0x8074,0x175));var _0x4807=function(_0x4dd37d,_0xfa992f){_0x4dd37d=_0x4dd37d-0x0;var _0x59e3e4=_0x8074[_0x4dd37d];return _0x59e3e4;};'use strict';var EventEmitter=require(_0x4807('0x0'));var ChatInternalMessage=require(_0x4807('0x1'))['db'][_0x4807('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4807('0x3'),'afterUpdate':_0x4807('0x4'),'afterDestroy':_0x4807('0x5')};function emitEvent(_0x52ee5e){return function(_0x53ce14,_0x1d05e7,_0x268da1){ChatInternalMessageEvents[_0x4807('0x6')](_0x52ee5e+':'+_0x53ce14['id'],_0x53ce14);ChatInternalMessageEvents[_0x4807('0x6')](_0x52ee5e,_0x53ce14);_0x268da1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x4807('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index cbd11c0..3b5a2a4 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 _0x9118=['utf8mb4','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','ChatInternalMessage'];(function(_0x48df88,_0xf92cd9){var _0x131496=function(_0x1b75fe){while(--_0x1b75fe){_0x48df88['push'](_0x48df88['shift']());}};_0x131496(++_0xf92cd9);}(_0x9118,0x114));var _0x8911=function(_0xcbd776,_0x302fe8){_0xcbd776=_0xcbd776-0x0;var _0x13d4b4=_0x9118[_0xcbd776];return _0x13d4b4;};'use strict';var _=require(_0x8911('0x0'));var util=require('util');var logger=require(_0x8911('0x1'))(_0x8911('0x2'));var moment=require('moment');var BPromise=require(_0x8911('0x3'));var rp=require(_0x8911('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8911('0x5'));var config=require(_0x8911('0x6'));var attributes=require(_0x8911('0x7'));module[_0x8911('0x8')]=function(_0x203e31,_0xa67e6c){return _0x203e31['define'](_0x8911('0x9'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8911('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8f77=['bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage','utf8mb4_unicode_ci','lodash','util','api','moment'];(function(_0x4c1e63,_0x296a91){var _0x45d095=function(_0x351b45){while(--_0x351b45){_0x4c1e63['push'](_0x4c1e63['shift']());}};_0x45d095(++_0x296a91);}(_0x8f77,0x168));var _0x78f7=function(_0x317894,_0x592674){_0x317894=_0x317894-0x0;var _0x3aacf7=_0x8f77[_0x317894];return _0x3aacf7;};'use strict';var _=require(_0x78f7('0x0'));var util=require(_0x78f7('0x1'));var logger=require('../../config/logger')(_0x78f7('0x2'));var moment=require(_0x78f7('0x3'));var BPromise=require(_0x78f7('0x4'));var rp=require(_0x78f7('0x5'));var fs=require('fs');var path=require(_0x78f7('0x6'));var rimraf=require(_0x78f7('0x7'));var config=require(_0x78f7('0x8'));var attributes=require(_0x78f7('0x9'));module['exports']=function(_0x5adb2c,_0x30ec96){return _0x5adb2c[_0x78f7('0xa')](_0x78f7('0xb'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x78f7('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 6c38fdc..1ac3c35 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 _0x6367=['ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then','info'];(function(_0x137078,_0x53da8b){var _0x713920=function(_0x57ddc8){while(--_0x57ddc8){_0x137078['push'](_0x137078['shift']());}};_0x713920(++_0x53da8b);}(_0x6367,0x1d5));var _0x7636=function(_0xd21fe7,_0x225a39){_0xd21fe7=_0xd21fe7-0x0;var _0x14d570=_0x6367[_0xd21fe7];return _0x14d570;};'use strict';var _=require('lodash');var util=require(_0x7636('0x0'));var moment=require('moment');var BPromise=require(_0x7636('0x1'));var rs=require(_0x7636('0x2'));var fs=require('fs');var Redis=require(_0x7636('0x3'));var db=require(_0x7636('0x4'))['db'];var utils=require(_0x7636('0x5'));var logger=require('../../config/logger')(_0x7636('0x6'));var config=require(_0x7636('0x7'));var jayson=require(_0x7636('0x8'));var client=jayson[_0x7636('0x9')]['http']({'port':0x232a});config[_0x7636('0xa')]=_['defaults'](config['redis'],{'host':_0x7636('0xb'),'port':0x18eb});var socket=require(_0x7636('0xc'))(new Redis(config[_0x7636('0xa')]));require('./chatInternalMessage.socket')[_0x7636('0xd')](socket);function respondWithRpcPromise(_0x4cc5a6,_0x140d97,_0x3f2e3b){return new BPromise(function(_0x51bb02,_0x20fc59){return client[_0x7636('0xe')](_0x4cc5a6,_0x3f2e3b)[_0x7636('0xf')](function(_0x2f7e28){logger[_0x7636('0x10')](_0x7636('0x11'),_0x140d97,_0x7636('0x12'));logger[_0x7636('0x13')](_0x7636('0x14'),_0x140d97,'request\x20sent',JSON[_0x7636('0x15')](_0x2f7e28));if(_0x2f7e28[_0x7636('0x16')]){if(_0x2f7e28['error'][_0x7636('0x17')]===0x1f4){logger[_0x7636('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x140d97,_0x2f7e28[_0x7636('0x16')][_0x7636('0x18')]);return _0x20fc59(_0x2f7e28[_0x7636('0x16')]['message']);}logger[_0x7636('0x16')](_0x7636('0x11'),_0x140d97,_0x2f7e28[_0x7636('0x16')][_0x7636('0x18')]);return _0x51bb02(_0x2f7e28['error'][_0x7636('0x18')]);}else{logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x140d97,_0x7636('0x12'));_0x51bb02(_0x2f7e28[_0x7636('0x19')][_0x7636('0x18')]);}})[_0x7636('0x1a')](function(_0x357a84){logger[_0x7636('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x140d97,_0x357a84);_0x20fc59(_0x357a84);});});} \ No newline at end of file +var _0xda7f=['redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x4529c2,_0x18370a){var _0x173e80=function(_0x4e7fa3){while(--_0x4e7fa3){_0x4529c2['push'](_0x4529c2['shift']());}};_0x173e80(++_0x18370a);}(_0xda7f,0xc6));var _0xfda7=function(_0x2d3ba8,_0x168519){_0x2d3ba8=_0x2d3ba8-0x0;var _0x41b210=_0xda7f[_0x2d3ba8];return _0x41b210;};'use strict';var _=require(_0xfda7('0x0'));var util=require('util');var moment=require(_0xfda7('0x1'));var BPromise=require(_0xfda7('0x2'));var rs=require(_0xfda7('0x3'));var fs=require('fs');var Redis=require(_0xfda7('0x4'));var db=require(_0xfda7('0x5'))['db'];var utils=require(_0xfda7('0x6'));var logger=require(_0xfda7('0x7'))(_0xfda7('0x8'));var config=require('../../config/environment');var jayson=require(_0xfda7('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xfda7('0xa')]=_[_0xfda7('0xb')](config[_0xfda7('0xa')],{'host':_0xfda7('0xc'),'port':0x18eb});var socket=require(_0xfda7('0xd'))(new Redis(config[_0xfda7('0xa')]));require(_0xfda7('0xe'))[_0xfda7('0xf')](socket);function respondWithRpcPromise(_0x20ffe4,_0x2c812c,_0x147837){return new BPromise(function(_0xddf6d8,_0x24f16e){return client['request'](_0x20ffe4,_0x147837)['then'](function(_0x24363e){logger[_0xfda7('0x10')](_0xfda7('0x11'),_0x2c812c,'request\x20sent');logger[_0xfda7('0x12')](_0xfda7('0x13'),_0x2c812c,_0xfda7('0x14'),JSON['stringify'](_0x24363e));if(_0x24363e[_0xfda7('0x15')]){if(_0x24363e[_0xfda7('0x15')][_0xfda7('0x16')]===0x1f4){logger[_0xfda7('0x15')](_0xfda7('0x11'),_0x2c812c,_0x24363e['error'][_0xfda7('0x17')]);return _0x24f16e(_0x24363e[_0xfda7('0x15')][_0xfda7('0x17')]);}logger[_0xfda7('0x15')](_0xfda7('0x11'),_0x2c812c,_0x24363e[_0xfda7('0x15')][_0xfda7('0x17')]);return _0xddf6d8(_0x24363e[_0xfda7('0x15')]['message']);}else{logger['info'](_0xfda7('0x11'),_0x2c812c,_0xfda7('0x14'));_0xddf6d8(_0x24363e[_0xfda7('0x18')][_0xfda7('0x17')]);}})[_0xfda7('0x19')](function(_0x337cd0){logger[_0xfda7('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x2c812c,_0x337cd0);_0x24f16e(_0x337cd0);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index a96b5a6..34cca02 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 _0x1035=['remove','update','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x10f34b,_0x2a1872){var _0x4a648f=function(_0x15edc2){while(--_0x15edc2){_0x10f34b['push'](_0x10f34b['shift']());}};_0x4a648f(++_0x2a1872);}(_0x1035,0x18a));var _0x5103=function(_0x586fa2,_0x1a45bc){_0x586fa2=_0x586fa2-0x0;var _0x515be9=_0x1035[_0x586fa2];return _0x515be9;};'use strict';var ChatInternalMessageEvents=require(_0x5103('0x0'));var events=[_0x5103('0x1'),_0x5103('0x2'),_0x5103('0x3')];function createListener(_0x1f68a0,_0x475423){return function(_0x2925c3){_0x475423[_0x5103('0x4')](_0x1f68a0,_0x2925c3);};}function removeListener(_0x592265,_0x2737b6){return function(){ChatInternalMessageEvents[_0x5103('0x5')](_0x592265,_0x2737b6);};}exports[_0x5103('0x6')]=function(_0x31f741){for(var _0x33a264=0x0,_0x58c7a6=events[_0x5103('0x7')];_0x33a264<_0x58c7a6;_0x33a264++){var _0x5f5dfd=events[_0x33a264];var _0x479d02=createListener(_0x5103('0x8')+_0x5f5dfd,_0x31f741);ChatInternalMessageEvents['on'](_0x5f5dfd,_0x479d02);}}; \ No newline at end of file +var _0xef6d=['./chatInternalMessage.events','remove','update','emit','removeListener','register','length'];(function(_0xa259f8,_0x328468){var _0x1c6122=function(_0x25a2d2){while(--_0x25a2d2){_0xa259f8['push'](_0xa259f8['shift']());}};_0x1c6122(++_0x328468);}(_0xef6d,0x9a));var _0xdef6=function(_0x563b83,_0x127542){_0x563b83=_0x563b83-0x0;var _0x327e62=_0xef6d[_0x563b83];return _0x327e62;};'use strict';var ChatInternalMessageEvents=require(_0xdef6('0x0'));var events=['save',_0xdef6('0x1'),_0xdef6('0x2')];function createListener(_0x3181ab,_0x45611e){return function(_0x21a1ae){_0x45611e[_0xdef6('0x3')](_0x3181ab,_0x21a1ae);};}function removeListener(_0x2333a2,_0x1a0fb1){return function(){ChatInternalMessageEvents[_0xdef6('0x4')](_0x2333a2,_0x1a0fb1);};}exports[_0xdef6('0x5')]=function(_0x102c3f){for(var _0x3cc298=0x0,_0x187faa=events[_0xdef6('0x6')];_0x3cc298<_0x187faa;_0x3cc298++){var _0x4b0e11=events[_0x3cc298];var _0x23af9f=createListener('chatInternalMessage:'+_0x4b0e11,_0x102c3f);ChatInternalMessageEvents['on'](_0x4b0e11,_0x23af9f);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 4c42568..97d5115 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 _0x1503=['index','/describe','describe','/users','getUsers','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated'];(function(_0x2b1ecb,_0x4c900f){var _0x45eced=function(_0x8f19e0){while(--_0x8f19e0){_0x2b1ecb['push'](_0x2b1ecb['shift']());}};_0x45eced(++_0x4c900f);}(_0x1503,0x1e2));var _0x3150=function(_0x23967c,_0x2e4a6e){_0x23967c=_0x23967c-0x0;var _0x151129=_0x1503[_0x23967c];return _0x151129;};'use strict';var multer=require(_0x3150('0x0'));var util=require(_0x3150('0x1'));var path=require(_0x3150('0x2'));var timeout=require(_0x3150('0x3'));var express=require(_0x3150('0x4'));var router=express[_0x3150('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3150('0x6'));var interaction=require(_0x3150('0x7'));var config=require(_0x3150('0x8'));var controller=require(_0x3150('0x9'));router[_0x3150('0xa')]('/',auth[_0x3150('0xb')](),controller[_0x3150('0xc')]);router['get'](_0x3150('0xd'),auth['isAuthenticated'](),controller[_0x3150('0xe')]);router[_0x3150('0xa')](_0x3150('0xf'),auth[_0x3150('0xb')](),controller[_0x3150('0x10')]);router[_0x3150('0xa')](_0x3150('0x11'),auth[_0x3150('0xb')](),controller[_0x3150('0x12')]);router[_0x3150('0x13')]('/',auth[_0x3150('0xb')](),controller[_0x3150('0x14')]);router[_0x3150('0x15')]('/:id',controller[_0x3150('0x16')]);router[_0x3150('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x3150('0x18')]);module[_0x3150('0x19')]=router; \ No newline at end of file +var _0xf2b9=['post','create','put','update','delete','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','describe','/users','getUsers','/:id','show'];(function(_0x385567,_0x40550f){var _0x49cf95=function(_0x4d3081){while(--_0x4d3081){_0x385567['push'](_0x385567['shift']());}};_0x49cf95(++_0x40550f);}(_0xf2b9,0x123));var _0x9f2b=function(_0x823d69,_0x2f7e02){_0x823d69=_0x823d69-0x0;var _0x2b2073=_0xf2b9[_0x823d69];return _0x2b2073;};'use strict';var multer=require(_0x9f2b('0x0'));var util=require(_0x9f2b('0x1'));var path=require(_0x9f2b('0x2'));var timeout=require('connect-timeout');var express=require(_0x9f2b('0x3'));var router=express[_0x9f2b('0x4')]();var fs_extra=require(_0x9f2b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9f2b('0x6'));var config=require(_0x9f2b('0x7'));var controller=require(_0x9f2b('0x8'));router[_0x9f2b('0x9')]('/',auth[_0x9f2b('0xa')](),controller[_0x9f2b('0xb')]);router[_0x9f2b('0x9')]('/describe',auth[_0x9f2b('0xa')](),controller[_0x9f2b('0xc')]);router['get'](_0x9f2b('0xd'),auth['isAuthenticated'](),controller[_0x9f2b('0xe')]);router['get'](_0x9f2b('0xf'),auth[_0x9f2b('0xa')](),controller[_0x9f2b('0x10')]);router[_0x9f2b('0x11')]('/',auth[_0x9f2b('0xa')](),controller[_0x9f2b('0x12')]);router[_0x9f2b('0x13')](_0x9f2b('0xf'),controller[_0x9f2b('0x14')]);router[_0x9f2b('0x15')]('/:id',auth[_0x9f2b('0xa')](),controller['destroy']);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 6f0d10b..6890532 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 _0x5c00=['BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT'];(function(_0x577f3d,_0x43ab79){var _0x3b11f6=function(_0x4f1a61){while(--_0x4f1a61){_0x577f3d['push'](_0x577f3d['shift']());}};_0x3b11f6(++_0x43ab79);}(_0x5c00,0x17e));var _0x05c0=function(_0x328b40,_0x370642){_0x328b40=_0x328b40-0x0;var _0x556a56=_0x5c00[_0x328b40];return _0x556a56;};'use strict';var Sequelize=require(_0x05c0('0x0'));module[_0x05c0('0x1')]={'body':{'type':Sequelize[_0x05c0('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x05c0('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x05c0('0x4')]('in',_0x05c0('0x5')),'defaultValue':_0x05c0('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x05c0('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x05c0('0x2')]}}; \ No newline at end of file +var _0x6ae2=['medium','BOOLEAN','ENUM','out','STRING','sequelize','exports','TEXT'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x6ae2,0x1ed));var _0x26ae=function(_0x266a1a,_0x28c25f){_0x266a1a=_0x266a1a-0x0;var _0x245e51=_0x6ae2[_0x266a1a];return _0x245e51;};'use strict';var Sequelize=require(_0x26ae('0x0'));module[_0x26ae('0x1')]={'body':{'type':Sequelize[_0x26ae('0x2')](_0x26ae('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x26ae('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x26ae('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x26ae('0x5')]('in',_0x26ae('0x6')),'defaultValue':_0x26ae('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x26ae('0x7')]},'providerResponse':{'type':Sequelize[_0x26ae('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index aaa7777..8434e8b 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 _0xd8c0=['set','reject','save','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','params','options','update','body','find','describe','chat-interactions','accept','chat','read','format','UserId','user','agent','get','ChatInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','fullname','interface','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./chatMessage.socket','client','http','request','then','info','debug','stringify','error','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','undefined','limit','count','offset'];(function(_0x1c72c2,_0x21a241){var _0x4b9c84=function(_0x302f07){while(--_0x302f07){_0x1c72c2['push'](_0x1c72c2['shift']());}};_0x4b9c84(++_0x21a241);}(_0xd8c0,0x147));var _0x0d8c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd8c0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0d8c('0x0'));var zipdir=require(_0x0d8c('0x1'));var jsonpatch=require(_0x0d8c('0x2'));var rp=require('request-promise');var moment=require(_0x0d8c('0x3'));var BPromise=require(_0x0d8c('0x4'));var Mustache=require('mustache');var util=require(_0x0d8c('0x5'));var path=require('path');var sox=require(_0x0d8c('0x6'));var csv=require(_0x0d8c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0d8c('0x8'));var _=require(_0x0d8c('0x9'));var squel=require('squel');var crypto=require(_0x0d8c('0xa'));var jsforce=require(_0x0d8c('0xb'));var deskjs=require(_0x0d8c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0d8c('0xd'));var Papa=require(_0x0d8c('0xe'));var Redis=require(_0x0d8c('0xf'));var authService=require(_0x0d8c('0x10'));var qs=require(_0x0d8c('0x11'));var as=require(_0x0d8c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d8c('0x13'))(_0x0d8c('0x14'));var utils=require(_0x0d8c('0x15'));var config=require(_0x0d8c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0d8c('0x17'))['db'];config['redis']=_[_0x0d8c('0x18')](config[_0x0d8c('0x19')],{'host':_0x0d8c('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0d8c('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x0d8c('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x0d8c('0x1c')][_0x0d8c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1b7b82,_0x5437ab,_0x5d7e32,_0x3ef7d8){return new BPromise(function(_0x574ee8,_0x4fd88e){var _0x16015a=_0x3ef7d8||client;return _0x16015a[_0x0d8c('0x1e')](_0x1b7b82,_0x5d7e32)[_0x0d8c('0x1f')](function(_0x2d339b){logger[_0x0d8c('0x20')]('ChatMessage,\x20%s,\x20%s',_0x5437ab,'request\x20sent');logger[_0x0d8c('0x21')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x5437ab,'request\x20sent',JSON[_0x0d8c('0x22')](_0x2d339b));if(_0x2d339b[_0x0d8c('0x23')]){if(_0x2d339b['error']['code']===0x1f4){logger[_0x0d8c('0x23')](_0x0d8c('0x24'),_0x5437ab,_0x2d339b[_0x0d8c('0x23')][_0x0d8c('0x25')]);return _0x4fd88e(_0x2d339b[_0x0d8c('0x23')][_0x0d8c('0x25')]);}logger[_0x0d8c('0x23')](_0x0d8c('0x24'),_0x5437ab,_0x2d339b[_0x0d8c('0x23')][_0x0d8c('0x25')]);return _0x574ee8(_0x2d339b[_0x0d8c('0x23')][_0x0d8c('0x25')]);}else{logger[_0x0d8c('0x20')]('ChatMessage,\x20%s,\x20%s',_0x5437ab,'request\x20sent');_0x574ee8(_0x2d339b[_0x0d8c('0x26')]['message']);}})[_0x0d8c('0x27')](function(_0x53c28e){logger[_0x0d8c('0x23')]('ChatMessage,\x20%s,\x20%s',_0x5437ab,_0x53c28e);_0x4fd88e(_0x53c28e);});});}function respondWithStatusCode(_0x490a92,_0xea352f){_0xea352f=_0xea352f||0xcc;return function(_0x53e50a){if(_0x53e50a){return _0x490a92[_0x0d8c('0x28')](_0xea352f);}return _0x490a92['status'](_0xea352f)[_0x0d8c('0x29')]();};}function respondWithResult(_0x573b79,_0xc08209){_0xc08209=_0xc08209||0xc8;return function(_0x361488){if(_0x361488){return _0x573b79[_0x0d8c('0x2a')](_0xc08209)[_0x0d8c('0x2b')](_0x361488);}};}function respondWithFilteredResult(_0x50d32f,_0x24e813){return function(_0x258559){if(_0x258559){var _0x4d39e2=typeof _0x24e813['offset']===_0x0d8c('0x2c')&&typeof _0x24e813[_0x0d8c('0x2d')]===_0x0d8c('0x2c');var _0x55e70a=_0x258559[_0x0d8c('0x2e')];var _0x235bd8=_0x4d39e2?0x0:_0x24e813[_0x0d8c('0x2f')];var _0x7cb51b=_0x4d39e2?_0x258559[_0x0d8c('0x2e')]:_0x24e813[_0x0d8c('0x2f')]+_0x24e813['limit'];var _0x301896;if(_0x7cb51b>=_0x55e70a){_0x7cb51b=_0x55e70a;_0x301896=0xc8;}else{_0x301896=0xce;}_0x50d32f[_0x0d8c('0x2a')](_0x301896);return _0x50d32f[_0x0d8c('0x30')]('Content-Range',_0x235bd8+'-'+_0x7cb51b+'/'+_0x55e70a)[_0x0d8c('0x2b')](_0x258559);}return null;};}function patchUpdates(_0x4f2e6f){return function(_0x3136cc){try{jsonpatch['apply'](_0x3136cc,_0x4f2e6f,!![]);}catch(_0x30742b){return BPromise[_0x0d8c('0x31')](_0x30742b);}return _0x3136cc[_0x0d8c('0x32')]();};}function saveUpdates(_0x3a60b5,_0x22c40e){return function(_0x2bcbda){if(_0x2bcbda){return _0x2bcbda['update'](_0x3a60b5)[_0x0d8c('0x1f')](function(_0x232617){return _0x232617;});}return null;};}function removeEntity(_0x5a9ced,_0x1beb36){return function(_0x1fdb02){if(_0x1fdb02){return _0x1fdb02[_0x0d8c('0x33')]()[_0x0d8c('0x1f')](function(){_0x5a9ced['status'](0xcc)[_0x0d8c('0x29')]();});}};}function handleEntityNotFound(_0x51db29,_0x563abc){return function(_0x82eba6){if(!_0x82eba6){_0x51db29[_0x0d8c('0x28')](0x194);}return _0x82eba6;};}function handleError(_0x34c1fe,_0x2cbb02){_0x2cbb02=_0x2cbb02||0x1f4;return function(_0x2d2d60){logger[_0x0d8c('0x23')](_0x2d2d60[_0x0d8c('0x34')]);if(_0x2d2d60['name']){delete _0x2d2d60[_0x0d8c('0x35')];}_0x34c1fe[_0x0d8c('0x2a')](_0x2cbb02)[_0x0d8c('0x36')](_0x2d2d60);};}exports[_0x0d8c('0x37')]=function(_0x273e59,_0x3ab99a){var _0xdb7f24={},_0x5c2577={},_0x5e7056={'count':0x0,'rows':[]};var _0x917c=_[_0x0d8c('0x38')](db[_0x0d8c('0x39')][_0x0d8c('0x3a')],function(_0x18e465){return{'name':_0x18e465[_0x0d8c('0x3b')],'type':_0x18e465[_0x0d8c('0x3c')]['key']};});_0x5c2577[_0x0d8c('0x3d')]=_[_0x0d8c('0x38')](_0x917c,_0x0d8c('0x35'));_0x5c2577[_0x0d8c('0x3e')]=_[_0x0d8c('0x3f')](_0x273e59[_0x0d8c('0x3e')]);_0x5c2577[_0x0d8c('0x40')]=_[_0x0d8c('0x41')](_0x5c2577[_0x0d8c('0x3d')],_0x5c2577[_0x0d8c('0x3e')]);_0xdb7f24[_0x0d8c('0x42')]=_[_0x0d8c('0x41')](_0x5c2577['model'],qs[_0x0d8c('0x43')](_0x273e59[_0x0d8c('0x3e')][_0x0d8c('0x43')]));_0xdb7f24[_0x0d8c('0x42')]=_0xdb7f24[_0x0d8c('0x42')][_0x0d8c('0x44')]?_0xdb7f24['attributes']:_0x5c2577[_0x0d8c('0x3d')];if(!_0x273e59[_0x0d8c('0x3e')]['hasOwnProperty'](_0x0d8c('0x45'))){_0xdb7f24[_0x0d8c('0x2d')]=qs['limit'](_0x273e59[_0x0d8c('0x3e')][_0x0d8c('0x2d')]);_0xdb7f24[_0x0d8c('0x2f')]=qs[_0x0d8c('0x2f')](_0x273e59[_0x0d8c('0x3e')][_0x0d8c('0x2f')]);}_0xdb7f24[_0x0d8c('0x46')]=qs[_0x0d8c('0x47')](_0x273e59['query'][_0x0d8c('0x47')]);_0xdb7f24['where']=qs[_0x0d8c('0x40')](_[_0x0d8c('0x48')](_0x273e59['query'],_0x5c2577[_0x0d8c('0x40')]),_0x917c);if(_0x273e59[_0x0d8c('0x3e')][_0x0d8c('0x49')]){_0xdb7f24[_0x0d8c('0x4a')]=_[_0x0d8c('0x4b')](_0xdb7f24['where'],{'$or':_['map'](_0x917c,function(_0xa21ea5){if(_0xa21ea5[_0x0d8c('0x3c')]!==_0x0d8c('0x4c')){var _0x39a84f={};_0x39a84f[_0xa21ea5[_0x0d8c('0x35')]]={'$like':'%'+_0x273e59[_0x0d8c('0x3e')][_0x0d8c('0x49')]+'%'};return _0x39a84f;}})});}_0xdb7f24=_[_0x0d8c('0x4b')]({},_0xdb7f24,_0x273e59['options']);var _0x577538={'where':_0xdb7f24[_0x0d8c('0x4a')]};return db[_0x0d8c('0x39')][_0x0d8c('0x2e')](_0x577538)[_0x0d8c('0x1f')](function(_0x27f798){_0x5e7056[_0x0d8c('0x2e')]=_0x27f798;if(_0x273e59[_0x0d8c('0x3e')][_0x0d8c('0x4d')]){_0xdb7f24['include']=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0xdb7f24);})['then'](function(_0x42ff26){_0x5e7056[_0x0d8c('0x4e')]=_0x42ff26;return _0x5e7056;})['then'](respondWithFilteredResult(_0x3ab99a,_0xdb7f24))[_0x0d8c('0x27')](handleError(_0x3ab99a,null));};exports['show']=function(_0x486008,_0x33f514){var _0x27699a={'raw':!![],'where':{'id':_0x486008[_0x0d8c('0x4f')]['id']}},_0x21e005={};_0x21e005['model']=_[_0x0d8c('0x3f')](db['ChatMessage']['rawAttributes']);_0x21e005[_0x0d8c('0x3e')]=_['keys'](_0x486008[_0x0d8c('0x3e')]);_0x21e005[_0x0d8c('0x40')]=_[_0x0d8c('0x41')](_0x21e005['model'],_0x21e005[_0x0d8c('0x3e')]);_0x27699a[_0x0d8c('0x42')]=_[_0x0d8c('0x41')](_0x21e005[_0x0d8c('0x3d')],qs['fields'](_0x486008[_0x0d8c('0x3e')][_0x0d8c('0x43')]));_0x27699a[_0x0d8c('0x42')]=_0x27699a[_0x0d8c('0x42')][_0x0d8c('0x44')]?_0x27699a[_0x0d8c('0x42')]:_0x21e005[_0x0d8c('0x3d')];if(_0x486008[_0x0d8c('0x3e')]['includeAll']){_0x27699a['include']=[{'all':!![]}];}_0x27699a=_[_0x0d8c('0x4b')]({},_0x27699a,_0x486008[_0x0d8c('0x50')]);return db[_0x0d8c('0x39')]['find'](_0x27699a)[_0x0d8c('0x1f')](handleEntityNotFound(_0x33f514,null))['then'](respondWithResult(_0x33f514,null))[_0x0d8c('0x27')](handleError(_0x33f514,null));};exports['create']=function(_0xf11721,_0x33f77c){return db['ChatMessage']['create'](_0xf11721['body'],{})[_0x0d8c('0x1f')](respondWithResult(_0x33f77c,0xc9))[_0x0d8c('0x27')](handleError(_0x33f77c,null));};exports[_0x0d8c('0x51')]=function(_0x3d1772,_0x218688){if(_0x3d1772['body']['id']){delete _0x3d1772[_0x0d8c('0x52')]['id'];}return db[_0x0d8c('0x39')]['find']({'where':{'id':_0x3d1772[_0x0d8c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x218688,null))['then'](saveUpdates(_0x3d1772['body'],null))[_0x0d8c('0x1f')](respondWithResult(_0x218688,null))['catch'](handleError(_0x218688,null));};exports[_0x0d8c('0x33')]=function(_0x3f99b6,_0x127f46){return db[_0x0d8c('0x39')][_0x0d8c('0x53')]({'where':{'id':_0x3f99b6[_0x0d8c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x127f46,null))[_0x0d8c('0x1f')](removeEntity(_0x127f46,null))[_0x0d8c('0x27')](handleError(_0x127f46,null));};exports[_0x0d8c('0x54')]=function(_0x2f5976,_0x5b31af){return db[_0x0d8c('0x39')][_0x0d8c('0x54')]()[_0x0d8c('0x1f')](respondWithResult(_0x5b31af,null))['catch'](handleError(_0x5b31af,null));};var interaction_log=require(_0x0d8c('0x13'))(_0x0d8c('0x55'));exports[_0x0d8c('0x56')]=function(_0x2146c1,_0x1ef570,_0x42fcbf){var _0x3e66be={'agent':{},'channel':_0x0d8c('0x57')};if(_0x2146c1[_0x0d8c('0x52')]['id']){delete _0x2146c1[_0x0d8c('0x52')]['id'];}_0x2146c1[_0x0d8c('0x52')][_0x0d8c('0x58')]=!![];_0x2146c1[_0x0d8c('0x52')]['readAt']=moment()[_0x0d8c('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0x2146c1[_0x0d8c('0x52')][_0x0d8c('0x5a')]=_0x2146c1['body'][_0x0d8c('0x5a')]||_0x2146c1[_0x0d8c('0x5b')]['id'];_0x3e66be[_0x0d8c('0x5c')]['id']=_0x2146c1[_0x0d8c('0x52')]['UserId'];return db[_0x0d8c('0x39')][_0x0d8c('0x53')]({'where':{'id':_0x2146c1['params']['id'],'UserId':null}})[_0x0d8c('0x1f')](handleEntityNotFound(_0x1ef570,null))[_0x0d8c('0x1f')](saveUpdates(_0x2146c1[_0x0d8c('0x52')],null))[_0x0d8c('0x1f')](function(_0x40db50){if(_0x40db50){_0x3e66be['message']=_0x40db50[_0x0d8c('0x5d')]({'plain':!![]});return db[_0x0d8c('0x5e')][_0x0d8c('0x53')]({'where':{'id':_0x40db50['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x1ef570,null))['then'](function(_0x422995){if(_0x422995){return _0x422995[_0x0d8c('0x51')]({'UserId':_0x2146c1[_0x0d8c('0x52')][_0x0d8c('0x5a')],'read1stAt':_[_0x0d8c('0x5f')](_0x422995[_0x0d8c('0x60')])?moment()[_0x0d8c('0x59')](_0x0d8c('0x61')):undefined});}return null;})['then'](function(_0x22fc29){if(_0x22fc29){_0x3e66be[_0x0d8c('0x62')]=_0x22fc29[_0x0d8c('0x5d')]({'plain':!![]});interaction_log[_0x0d8c('0x20')](_0x0d8c('0x63'),_0x2146c1[_0x0d8c('0x5b')]['id'],_0x2146c1['user'][_0x0d8c('0x35')],_0x2146c1[_0x0d8c('0x5b')][_0x0d8c('0x64')],_0x3e66be['interaction']['id'],_0x2146c1[_0x0d8c('0x52')]?JSON[_0x0d8c('0x22')](_0x2146c1['body']):_0x0d8c('0x65'));return respondWithRpcPromise('AcceptMessage',_0x0d8c('0x66'),_0x3e66be);}return null;})['then'](function(_0x4852ea){var _0x1f2196=_0x0d8c('0x67')+_0x4852ea[_0x0d8c('0x25')][_0x0d8c('0x68')];return db['sequelize']['query'](_0x1f2196,{'type':db[_0x0d8c('0x69')][_0x0d8c('0x6a')][_0x0d8c('0x6b')],'raw':!![]})[_0x0d8c('0x1f')](function(_0x3370ac){return _0x3370ac;});})[_0x0d8c('0x1f')](function(_0x308fcc){if(_0x308fcc){_0x3e66be['message'][_0x0d8c('0x6c')]=_0x308fcc[0x0];if(!_0x2146c1[_0x0d8c('0x52')][_0x0d8c('0x5a')])return;return db['User'][_0x0d8c('0x53')]({'where':{'id':_0x2146c1[_0x0d8c('0x52')][_0x0d8c('0x5a')],'role':'agent'},'attributes':['id','name','fullname',_0x0d8c('0x6d'),_0x0d8c('0x6e')],'raw':!![]});}return null;})[_0x0d8c('0x1f')](function(_0x388bcb){if(!_0x388bcb)return null;_0x3e66be[_0x0d8c('0x25')][_0x0d8c('0x5c')]=_0x388bcb;return _0x3e66be;})[_0x0d8c('0x1f')](function(_0x3c52c2){if(_0x3c52c2){if(_0x2146c1[_0x0d8c('0x52')][_0x0d8c('0x6f')]){_0x3e66be[_0x0d8c('0x25')]['interface']=util[_0x0d8c('0x59')](_0x0d8c('0x70'),_0x2146c1[_0x0d8c('0x5b')][_0x0d8c('0x35')]);_0x3e66be[_0x0d8c('0x25')][_0x0d8c('0x71')]=_0x3e66be['channel'];_0x3e66be[_0x0d8c('0x25')][_0x0d8c('0x72')]=_0x3e66be[_0x0d8c('0x71')];_0x3e66be[_0x0d8c('0x25')][_0x0d8c('0x73')]=_0x0d8c('0x56');return respondWithRpcPromise('EventManager',_0x0d8c('0x74'),{'event':_0x0d8c('0x75'),'message':_['merge'](_0x3e66be[_0x0d8c('0x25')],JSON[_0x0d8c('0x76')](_0x3e66be[_0x0d8c('0x62')]['formData']))},client9002)[_0x0d8c('0x1f')](function(){return _0x3e66be;});}return _0x3e66be;}return null;})[_0x0d8c('0x1f')](respondWithResult(_0x1ef570,null))['catch'](handleError(_0x1ef570,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x0d8c('0x31')]=function(_0x341872,_0x1e4833,_0x2a3c89){var _0x5da4ae={'agent':{},'channel':_0x0d8c('0x57')};if(_0x341872[_0x0d8c('0x52')]['id']){delete _0x341872[_0x0d8c('0x52')]['id'];}_0x341872[_0x0d8c('0x52')][_0x0d8c('0x5a')]=_0x341872['body'][_0x0d8c('0x5a')]||_0x341872['user']['id'];_0x5da4ae[_0x0d8c('0x5c')]['id']=_0x341872[_0x0d8c('0x52')][_0x0d8c('0x5a')];return db[_0x0d8c('0x39')][_0x0d8c('0x53')]({'where':{'id':_0x341872[_0x0d8c('0x4f')]['id'],'UserId':null}})[_0x0d8c('0x1f')](handleEntityNotFound(_0x1e4833,null))[_0x0d8c('0x1f')](function(_0x3cfd07){if(_0x3cfd07){_0x5da4ae[_0x0d8c('0x25')]=_0x3cfd07['get']({'plain':!![]});return db[_0x0d8c('0x5e')][_0x0d8c('0x53')]({'where':{'id':_0x3cfd07['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x1e4833,null))[_0x0d8c('0x1f')](function(_0x2564fe){if(_0x2564fe){_0x5da4ae[_0x0d8c('0x62')]=_0x2564fe['get']({'plain':!![]});interaction_log[_0x0d8c('0x20')](_0x0d8c('0x77'),_0x341872[_0x0d8c('0x5b')]['id'],_0x341872[_0x0d8c('0x5b')][_0x0d8c('0x35')],_0x341872['user'][_0x0d8c('0x64')],_0x5da4ae[_0x0d8c('0x62')]['id'],_0x341872['body']?JSON[_0x0d8c('0x22')](_0x341872['body']):_0x0d8c('0x65'));return respondWithRpcPromise(_0x0d8c('0x78'),_0x0d8c('0x79'),_0x5da4ae);}return null;})[_0x0d8c('0x1f')](function(_0x262893){var _0x4b9217=_0x0d8c('0x67')+_0x262893[_0x0d8c('0x25')]['ContactId'];return db[_0x0d8c('0x7a')]['query'](_0x4b9217,{'type':db[_0x0d8c('0x69')][_0x0d8c('0x6a')][_0x0d8c('0x6b')],'raw':!![]})['then'](function(_0x11fd72){return _0x11fd72;});})['then'](function(_0x3e4c97){if(_0x3e4c97){_0x5da4ae[_0x0d8c('0x25')][_0x0d8c('0x6c')]=_0x3e4c97[0x0];if(!_0x341872['body']['UserId'])return;return db['User'][_0x0d8c('0x53')]({'where':{'id':_0x341872['body']['UserId'],'role':_0x0d8c('0x5c')},'attributes':['id',_0x0d8c('0x35'),_0x0d8c('0x7b'),_0x0d8c('0x6d'),_0x0d8c('0x6e')],'raw':!![]});}return null;})[_0x0d8c('0x1f')](function(_0x40b4c5){if(!_0x40b4c5)return null;_0x5da4ae[_0x0d8c('0x25')][_0x0d8c('0x5c')]=_0x40b4c5;return _0x5da4ae;})[_0x0d8c('0x1f')](function(_0x36d79e){if(_0x36d79e){_0x36d79e[_0x0d8c('0x25')][_0x0d8c('0x7c')]=util['format'](_0x0d8c('0x70'),_0x341872[_0x0d8c('0x5b')][_0x0d8c('0x35')]);_0x36d79e[_0x0d8c('0x25')][_0x0d8c('0x71')]=_0x5da4ae[_0x0d8c('0x71')];_0x36d79e[_0x0d8c('0x25')][_0x0d8c('0x72')]=_0x5da4ae[_0x0d8c('0x71')];_0x36d79e[_0x0d8c('0x25')][_0x0d8c('0x73')]=_0x0d8c('0x31');respondWithRpcPromise(_0x0d8c('0x74'),_0x0d8c('0x74'),{'event':'rejectmessage','message':_['merge'](_0x5da4ae[_0x0d8c('0x25')],JSON[_0x0d8c('0x76')](_0x5da4ae['interaction']['formData']))},client9002);return _0x5da4ae;}return null;})[_0x0d8c('0x1f')](respondWithResult(_0x1e4833,null))[_0x0d8c('0x27')](handleError(_0x1e4833,null));}; \ No newline at end of file +var _0xf5cd=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','client','http','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','update','end','send','index','map','ChatMessage','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','length','options','find','body','destroy','describe','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','isNil','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','User','fullname','email','internal','interface','SIP/%s','name','channel','EventManager','acceptmessage','parse','formData','chat-interactions','ChatInteractionId','interaction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','motionChannel','rejectmessage','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x31c1af,_0x35051d){var _0x10b974=function(_0x3eaf34){while(--_0x3eaf34){_0x31c1af['push'](_0x31c1af['shift']());}};_0x10b974(++_0x35051d);}(_0xf5cd,0xf5));var _0xdf5c=function(_0x5ce5d6,_0x294bef){_0x5ce5d6=_0x5ce5d6-0x0;var _0x1ae010=_0xf5cd[_0x5ce5d6];return _0x1ae010;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdf5c('0x0'));var zipdir=require(_0xdf5c('0x1'));var jsonpatch=require(_0xdf5c('0x2'));var rp=require(_0xdf5c('0x3'));var moment=require(_0xdf5c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdf5c('0x5'));var util=require(_0xdf5c('0x6'));var path=require('path');var sox=require(_0xdf5c('0x7'));var csv=require('to-csv');var ejs=require(_0xdf5c('0x8'));var fs=require('fs');var fs_extra=require(_0xdf5c('0x9'));var _=require(_0xdf5c('0xa'));var squel=require('squel');var crypto=require(_0xdf5c('0xb'));var jsforce=require(_0xdf5c('0xc'));var deskjs=require(_0xdf5c('0xd'));var toCsv=require(_0xdf5c('0xe'));var querystring=require(_0xdf5c('0xf'));var Papa=require(_0xdf5c('0x10'));var Redis=require(_0xdf5c('0x11'));var authService=require(_0xdf5c('0x12'));var qs=require(_0xdf5c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdf5c('0x14'));var logger=require(_0xdf5c('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xdf5c('0x16'));var licenseUtil=require(_0xdf5c('0x17'));var db=require(_0xdf5c('0x18'))['db'];config[_0xdf5c('0x19')]=_['defaults'](config[_0xdf5c('0x19')],{'host':_0xdf5c('0x1a'),'port':0x18eb});var socket=require(_0xdf5c('0x1b'))(new Redis(config[_0xdf5c('0x19')]));require('./chatMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xdf5c('0x1c')][_0xdf5c('0x1d')]({'port':0x232c});var client9002=jayson[_0xdf5c('0x1c')][_0xdf5c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x58d52b,_0x2c6101,_0x2d5d79,_0x24247d){return new BPromise(function(_0x338818,_0x316a3f){var _0x2d9471=_0x24247d||client;return _0x2d9471[_0xdf5c('0x1e')](_0x58d52b,_0x2d5d79)[_0xdf5c('0x1f')](function(_0x2f58e1){logger['info'](_0xdf5c('0x20'),_0x2c6101,_0xdf5c('0x21'));logger[_0xdf5c('0x22')](_0xdf5c('0x23'),_0x2c6101,'request\x20sent',JSON[_0xdf5c('0x24')](_0x2f58e1));if(_0x2f58e1[_0xdf5c('0x25')]){if(_0x2f58e1[_0xdf5c('0x25')]['code']===0x1f4){logger[_0xdf5c('0x25')]('ChatMessage,\x20%s,\x20%s',_0x2c6101,_0x2f58e1[_0xdf5c('0x25')][_0xdf5c('0x26')]);return _0x316a3f(_0x2f58e1['error']['message']);}logger['error'](_0xdf5c('0x20'),_0x2c6101,_0x2f58e1[_0xdf5c('0x25')][_0xdf5c('0x26')]);return _0x338818(_0x2f58e1['error'][_0xdf5c('0x26')]);}else{logger[_0xdf5c('0x27')](_0xdf5c('0x20'),_0x2c6101,_0xdf5c('0x21'));_0x338818(_0x2f58e1[_0xdf5c('0x28')][_0xdf5c('0x26')]);}})['catch'](function(_0x5ef559){logger['error'](_0xdf5c('0x20'),_0x2c6101,_0x5ef559);_0x316a3f(_0x5ef559);});});}function respondWithStatusCode(_0x926e13,_0x4dd24b){_0x4dd24b=_0x4dd24b||0xcc;return function(_0xe7f220){if(_0xe7f220){return _0x926e13[_0xdf5c('0x29')](_0x4dd24b);}return _0x926e13[_0xdf5c('0x2a')](_0x4dd24b)['end']();};}function respondWithResult(_0x4672fb,_0x5424fa){_0x5424fa=_0x5424fa||0xc8;return function(_0x2ea18b){if(_0x2ea18b){return _0x4672fb[_0xdf5c('0x2a')](_0x5424fa)[_0xdf5c('0x2b')](_0x2ea18b);}};}function respondWithFilteredResult(_0x1de4b7,_0x3f0a98){return function(_0x413cbe){if(_0x413cbe){var _0x2781b7=typeof _0x3f0a98[_0xdf5c('0x2c')]==='undefined'&&typeof _0x3f0a98['limit']===_0xdf5c('0x2d');var _0x15ceef=_0x413cbe['count'];var _0x218b47=_0x2781b7?0x0:_0x3f0a98[_0xdf5c('0x2c')];var _0x2ddfbb=_0x2781b7?_0x413cbe[_0xdf5c('0x2e')]:_0x3f0a98[_0xdf5c('0x2c')]+_0x3f0a98[_0xdf5c('0x2f')];var _0x17c658;if(_0x2ddfbb>=_0x15ceef){_0x2ddfbb=_0x15ceef;_0x17c658=0xc8;}else{_0x17c658=0xce;}_0x1de4b7[_0xdf5c('0x2a')](_0x17c658);return _0x1de4b7[_0xdf5c('0x30')]('Content-Range',_0x218b47+'-'+_0x2ddfbb+'/'+_0x15ceef)[_0xdf5c('0x2b')](_0x413cbe);}return null;};}function patchUpdates(_0x32970f){return function(_0x591927){try{jsonpatch[_0xdf5c('0x31')](_0x591927,_0x32970f,!![]);}catch(_0x56d96c){return BPromise[_0xdf5c('0x32')](_0x56d96c);}return _0x591927['save']();};}function saveUpdates(_0x14bd03,_0xbde3d0){return function(_0x5e54f0){if(_0x5e54f0){return _0x5e54f0[_0xdf5c('0x33')](_0x14bd03)[_0xdf5c('0x1f')](function(_0x19b9a2){return _0x19b9a2;});}return null;};}function removeEntity(_0x5033c0,_0x1c5f46){return function(_0x3b6053){if(_0x3b6053){return _0x3b6053['destroy']()[_0xdf5c('0x1f')](function(){_0x5033c0[_0xdf5c('0x2a')](0xcc)[_0xdf5c('0x34')]();});}};}function handleEntityNotFound(_0x2c9c6a,_0x509d63){return function(_0x1de5c1){if(!_0x1de5c1){_0x2c9c6a[_0xdf5c('0x29')](0x194);}return _0x1de5c1;};}function handleError(_0x508654,_0xe7e9b9){_0xe7e9b9=_0xe7e9b9||0x1f4;return function(_0x2c6f54){logger['error'](_0x2c6f54['stack']);if(_0x2c6f54['name']){delete _0x2c6f54['name'];}_0x508654[_0xdf5c('0x2a')](_0xe7e9b9)[_0xdf5c('0x35')](_0x2c6f54);};}exports[_0xdf5c('0x36')]=function(_0x201cad,_0x18d6db){var _0x115c55={},_0x35f60d={},_0x399243={'count':0x0,'rows':[]};var _0x709921=_[_0xdf5c('0x37')](db[_0xdf5c('0x38')][_0xdf5c('0x39')],function(_0x45a427){return{'name':_0x45a427['fieldName'],'type':_0x45a427[_0xdf5c('0x3a')][_0xdf5c('0x3b')]};});_0x35f60d['model']=_[_0xdf5c('0x37')](_0x709921,'name');_0x35f60d[_0xdf5c('0x3c')]=_[_0xdf5c('0x3d')](_0x201cad[_0xdf5c('0x3c')]);_0x35f60d[_0xdf5c('0x3e')]=_[_0xdf5c('0x3f')](_0x35f60d[_0xdf5c('0x40')],_0x35f60d[_0xdf5c('0x3c')]);_0x115c55[_0xdf5c('0x41')]=_[_0xdf5c('0x3f')](_0x35f60d[_0xdf5c('0x40')],qs[_0xdf5c('0x42')](_0x201cad[_0xdf5c('0x3c')][_0xdf5c('0x42')]));_0x115c55[_0xdf5c('0x41')]=_0x115c55[_0xdf5c('0x41')]['length']?_0x115c55[_0xdf5c('0x41')]:_0x35f60d[_0xdf5c('0x40')];if(!_0x201cad['query']['hasOwnProperty'](_0xdf5c('0x43'))){_0x115c55[_0xdf5c('0x2f')]=qs[_0xdf5c('0x2f')](_0x201cad['query'][_0xdf5c('0x2f')]);_0x115c55[_0xdf5c('0x2c')]=qs['offset'](_0x201cad[_0xdf5c('0x3c')]['offset']);}_0x115c55[_0xdf5c('0x44')]=qs[_0xdf5c('0x45')](_0x201cad[_0xdf5c('0x3c')][_0xdf5c('0x45')]);_0x115c55[_0xdf5c('0x46')]=qs[_0xdf5c('0x3e')](_[_0xdf5c('0x47')](_0x201cad[_0xdf5c('0x3c')],_0x35f60d[_0xdf5c('0x3e')]),_0x709921);if(_0x201cad[_0xdf5c('0x3c')][_0xdf5c('0x48')]){_0x115c55[_0xdf5c('0x46')]=_[_0xdf5c('0x49')](_0x115c55[_0xdf5c('0x46')],{'$or':_[_0xdf5c('0x37')](_0x709921,function(_0x3a17f4){if(_0x3a17f4[_0xdf5c('0x3a')]!=='VIRTUAL'){var _0x56e970={};_0x56e970[_0x3a17f4['name']]={'$like':'%'+_0x201cad[_0xdf5c('0x3c')][_0xdf5c('0x48')]+'%'};return _0x56e970;}})});}_0x115c55=_['merge']({},_0x115c55,_0x201cad['options']);var _0x86211b={'where':_0x115c55[_0xdf5c('0x46')]};return db[_0xdf5c('0x38')][_0xdf5c('0x2e')](_0x86211b)['then'](function(_0x55e954){_0x399243['count']=_0x55e954;if(_0x201cad[_0xdf5c('0x3c')][_0xdf5c('0x4a')]){_0x115c55[_0xdf5c('0x4b')]=[{'all':!![]}];}return db[_0xdf5c('0x38')][_0xdf5c('0x4c')](_0x115c55);})[_0xdf5c('0x1f')](function(_0x2ad430){_0x399243[_0xdf5c('0x4d')]=_0x2ad430;return _0x399243;})['then'](respondWithFilteredResult(_0x18d6db,_0x115c55))[_0xdf5c('0x4e')](handleError(_0x18d6db,null));};exports[_0xdf5c('0x4f')]=function(_0x46034c,_0x5ad0f4){var _0x434e1f={'raw':!![],'where':{'id':_0x46034c[_0xdf5c('0x50')]['id']}},_0x1047c6={};_0x1047c6['model']=_[_0xdf5c('0x3d')](db[_0xdf5c('0x38')][_0xdf5c('0x39')]);_0x1047c6['query']=_[_0xdf5c('0x3d')](_0x46034c['query']);_0x1047c6[_0xdf5c('0x3e')]=_[_0xdf5c('0x3f')](_0x1047c6[_0xdf5c('0x40')],_0x1047c6[_0xdf5c('0x3c')]);_0x434e1f[_0xdf5c('0x41')]=_[_0xdf5c('0x3f')](_0x1047c6['model'],qs[_0xdf5c('0x42')](_0x46034c[_0xdf5c('0x3c')][_0xdf5c('0x42')]));_0x434e1f[_0xdf5c('0x41')]=_0x434e1f[_0xdf5c('0x41')][_0xdf5c('0x51')]?_0x434e1f[_0xdf5c('0x41')]:_0x1047c6[_0xdf5c('0x40')];if(_0x46034c[_0xdf5c('0x3c')][_0xdf5c('0x4a')]){_0x434e1f['include']=[{'all':!![]}];}_0x434e1f=_[_0xdf5c('0x49')]({},_0x434e1f,_0x46034c[_0xdf5c('0x52')]);return db['ChatMessage'][_0xdf5c('0x53')](_0x434e1f)[_0xdf5c('0x1f')](handleEntityNotFound(_0x5ad0f4,null))['then'](respondWithResult(_0x5ad0f4,null))[_0xdf5c('0x4e')](handleError(_0x5ad0f4,null));};exports['create']=function(_0x37ddb8,_0x2ec1b2){return db[_0xdf5c('0x38')]['create'](_0x37ddb8[_0xdf5c('0x54')],{})[_0xdf5c('0x1f')](respondWithResult(_0x2ec1b2,0xc9))[_0xdf5c('0x4e')](handleError(_0x2ec1b2,null));};exports[_0xdf5c('0x33')]=function(_0x34afe7,_0x59a10f){if(_0x34afe7[_0xdf5c('0x54')]['id']){delete _0x34afe7[_0xdf5c('0x54')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x34afe7[_0xdf5c('0x50')]['id']}})['then'](handleEntityNotFound(_0x59a10f,null))[_0xdf5c('0x1f')](saveUpdates(_0x34afe7[_0xdf5c('0x54')],null))[_0xdf5c('0x1f')](respondWithResult(_0x59a10f,null))[_0xdf5c('0x4e')](handleError(_0x59a10f,null));};exports[_0xdf5c('0x55')]=function(_0x5222b3,_0x59df16){return db[_0xdf5c('0x38')][_0xdf5c('0x53')]({'where':{'id':_0x5222b3['params']['id']}})[_0xdf5c('0x1f')](handleEntityNotFound(_0x59df16,null))[_0xdf5c('0x1f')](removeEntity(_0x59df16,null))['catch'](handleError(_0x59df16,null));};exports[_0xdf5c('0x56')]=function(_0x1c7e16,_0xd3b694){return db['ChatMessage'][_0xdf5c('0x56')]()[_0xdf5c('0x1f')](respondWithResult(_0xd3b694,null))[_0xdf5c('0x4e')](handleError(_0xd3b694,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0xdf5c('0x57')]=function(_0x41ad54,_0xbd1f43,_0x1f34a9){var _0xedc47e={'agent':{},'channel':_0xdf5c('0x58')};if(_0x41ad54[_0xdf5c('0x54')]['id']){delete _0x41ad54['body']['id'];}_0x41ad54[_0xdf5c('0x54')][_0xdf5c('0x59')]=!![];_0x41ad54[_0xdf5c('0x54')][_0xdf5c('0x5a')]=moment()[_0xdf5c('0x5b')](_0xdf5c('0x5c'));_0x41ad54[_0xdf5c('0x54')][_0xdf5c('0x5d')]=_0x41ad54['body']['UserId']||_0x41ad54[_0xdf5c('0x5e')]['id'];_0xedc47e[_0xdf5c('0x5f')]['id']=_0x41ad54['body'][_0xdf5c('0x5d')];return db[_0xdf5c('0x38')][_0xdf5c('0x53')]({'where':{'id':_0x41ad54[_0xdf5c('0x50')]['id'],'UserId':null}})[_0xdf5c('0x1f')](handleEntityNotFound(_0xbd1f43,null))[_0xdf5c('0x1f')](saveUpdates(_0x41ad54[_0xdf5c('0x54')],null))[_0xdf5c('0x1f')](function(_0x96c4b3){if(_0x96c4b3){_0xedc47e[_0xdf5c('0x26')]=_0x96c4b3[_0xdf5c('0x60')]({'plain':!![]});return db[_0xdf5c('0x61')][_0xdf5c('0x53')]({'where':{'id':_0x96c4b3['ChatInteractionId']}});}return null;})[_0xdf5c('0x1f')](handleEntityNotFound(_0xbd1f43,null))['then'](function(_0x4a3c8d){if(_0x4a3c8d){return _0x4a3c8d[_0xdf5c('0x33')]({'UserId':_0x41ad54[_0xdf5c('0x54')][_0xdf5c('0x5d')],'read1stAt':_[_0xdf5c('0x62')](_0x4a3c8d[_0xdf5c('0x63')])?moment()['format'](_0xdf5c('0x5c')):undefined});}return null;})[_0xdf5c('0x1f')](function(_0x265e8f){if(_0x265e8f){_0xedc47e['interaction']=_0x265e8f['get']({'plain':!![]});interaction_log[_0xdf5c('0x27')](_0xdf5c('0x64'),_0x41ad54['user']['id'],_0x41ad54[_0xdf5c('0x5e')]['name'],_0x41ad54[_0xdf5c('0x5e')][_0xdf5c('0x65')],_0xedc47e['interaction']['id'],_0x41ad54[_0xdf5c('0x54')]?JSON[_0xdf5c('0x24')](_0x41ad54['body']):'null');return respondWithRpcPromise(_0xdf5c('0x66'),'acceptMessage',_0xedc47e);}return null;})[_0xdf5c('0x1f')](function(_0x3f53a6){var _0x37dde2=_0xdf5c('0x67')+_0x3f53a6[_0xdf5c('0x26')][_0xdf5c('0x68')];return db['sequelize']['query'](_0x37dde2,{'type':db[_0xdf5c('0x69')][_0xdf5c('0x6a')]['SELECT'],'raw':!![]})[_0xdf5c('0x1f')](function(_0x149705){return _0x149705;});})['then'](function(_0x4b7bbd){if(_0x4b7bbd){_0xedc47e[_0xdf5c('0x26')][_0xdf5c('0x6b')]=_0x4b7bbd[0x0];if(!_0x41ad54[_0xdf5c('0x54')]['UserId'])return;return db[_0xdf5c('0x6c')]['find']({'where':{'id':_0x41ad54[_0xdf5c('0x54')][_0xdf5c('0x5d')],'role':_0xdf5c('0x5f')},'attributes':['id','name',_0xdf5c('0x6d'),_0xdf5c('0x6e'),_0xdf5c('0x6f')],'raw':!![]});}return null;})[_0xdf5c('0x1f')](function(_0x5b6bdf){if(!_0x5b6bdf)return null;_0xedc47e[_0xdf5c('0x26')][_0xdf5c('0x5f')]=_0x5b6bdf;return _0xedc47e;})[_0xdf5c('0x1f')](function(_0x3eb27a){if(_0x3eb27a){if(_0x41ad54[_0xdf5c('0x54')]['manual']){_0xedc47e[_0xdf5c('0x26')][_0xdf5c('0x70')]=util[_0xdf5c('0x5b')](_0xdf5c('0x71'),_0x41ad54[_0xdf5c('0x5e')][_0xdf5c('0x72')]);_0xedc47e[_0xdf5c('0x26')][_0xdf5c('0x73')]=_0xedc47e[_0xdf5c('0x73')];_0xedc47e['message']['motionChannel']=_0xedc47e[_0xdf5c('0x73')];_0xedc47e[_0xdf5c('0x26')]['event']=_0xdf5c('0x57');return respondWithRpcPromise(_0xdf5c('0x74'),_0xdf5c('0x74'),{'event':_0xdf5c('0x75'),'message':_['merge'](_0xedc47e[_0xdf5c('0x26')],JSON[_0xdf5c('0x76')](_0xedc47e['interaction'][_0xdf5c('0x77')]))},client9002)[_0xdf5c('0x1f')](function(){return _0xedc47e;});}return _0xedc47e;}return null;})['then'](respondWithResult(_0xbd1f43,null))[_0xdf5c('0x4e')](handleError(_0xbd1f43,null));};var interaction_log=require(_0xdf5c('0x15'))(_0xdf5c('0x78'));exports[_0xdf5c('0x32')]=function(_0x3bc0fb,_0x4c5f5e,_0x430631){var _0x5682d9={'agent':{},'channel':_0xdf5c('0x58')};if(_0x3bc0fb['body']['id']){delete _0x3bc0fb[_0xdf5c('0x54')]['id'];}_0x3bc0fb[_0xdf5c('0x54')][_0xdf5c('0x5d')]=_0x3bc0fb[_0xdf5c('0x54')][_0xdf5c('0x5d')]||_0x3bc0fb[_0xdf5c('0x5e')]['id'];_0x5682d9[_0xdf5c('0x5f')]['id']=_0x3bc0fb[_0xdf5c('0x54')][_0xdf5c('0x5d')];return db[_0xdf5c('0x38')][_0xdf5c('0x53')]({'where':{'id':_0x3bc0fb[_0xdf5c('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4c5f5e,null))[_0xdf5c('0x1f')](function(_0x2fd0a9){if(_0x2fd0a9){_0x5682d9[_0xdf5c('0x26')]=_0x2fd0a9[_0xdf5c('0x60')]({'plain':!![]});return db[_0xdf5c('0x61')]['find']({'where':{'id':_0x2fd0a9[_0xdf5c('0x79')]}});}return null;})[_0xdf5c('0x1f')](handleEntityNotFound(_0x4c5f5e,null))[_0xdf5c('0x1f')](function(_0x251049){if(_0x251049){_0x5682d9[_0xdf5c('0x7a')]=_0x251049[_0xdf5c('0x60')]({'plain':!![]});interaction_log[_0xdf5c('0x27')](_0xdf5c('0x7b'),_0x3bc0fb[_0xdf5c('0x5e')]['id'],_0x3bc0fb['user'][_0xdf5c('0x72')],_0x3bc0fb[_0xdf5c('0x5e')]['role'],_0x5682d9[_0xdf5c('0x7a')]['id'],_0x3bc0fb['body']?JSON['stringify'](_0x3bc0fb[_0xdf5c('0x54')]):'null');return respondWithRpcPromise(_0xdf5c('0x7c'),_0xdf5c('0x7d'),_0x5682d9);}return null;})['then'](function(_0x2630b4){var _0x19da34=_0xdf5c('0x67')+_0x2630b4[_0xdf5c('0x26')][_0xdf5c('0x68')];return db[_0xdf5c('0x7e')]['query'](_0x19da34,{'type':db[_0xdf5c('0x69')]['QueryTypes']['SELECT'],'raw':!![]})[_0xdf5c('0x1f')](function(_0x535f9e){return _0x535f9e;});})['then'](function(_0x22441a){if(_0x22441a){_0x5682d9[_0xdf5c('0x26')]['contact']=_0x22441a[0x0];if(!_0x3bc0fb[_0xdf5c('0x54')][_0xdf5c('0x5d')])return;return db[_0xdf5c('0x6c')][_0xdf5c('0x53')]({'where':{'id':_0x3bc0fb[_0xdf5c('0x54')]['UserId'],'role':_0xdf5c('0x5f')},'attributes':['id','name',_0xdf5c('0x6d'),_0xdf5c('0x6e'),_0xdf5c('0x6f')],'raw':!![]});}return null;})[_0xdf5c('0x1f')](function(_0x35b2f5){if(!_0x35b2f5)return null;_0x5682d9[_0xdf5c('0x26')][_0xdf5c('0x5f')]=_0x35b2f5;return _0x5682d9;})[_0xdf5c('0x1f')](function(_0x41260c){if(_0x41260c){_0x41260c[_0xdf5c('0x26')][_0xdf5c('0x70')]=util[_0xdf5c('0x5b')]('SIP/%s',_0x3bc0fb[_0xdf5c('0x5e')][_0xdf5c('0x72')]);_0x41260c[_0xdf5c('0x26')][_0xdf5c('0x73')]=_0x5682d9[_0xdf5c('0x73')];_0x41260c['message'][_0xdf5c('0x7f')]=_0x5682d9['channel'];_0x41260c[_0xdf5c('0x26')]['event']=_0xdf5c('0x32');respondWithRpcPromise(_0xdf5c('0x74'),_0xdf5c('0x74'),{'event':_0xdf5c('0x80'),'message':_['merge'](_0x5682d9[_0xdf5c('0x26')],JSON['parse'](_0x5682d9[_0xdf5c('0x7a')]['formData']))},client9002);return _0x5682d9;}return null;})[_0xdf5c('0x1f')](respondWithResult(_0x4c5f5e,null))[_0xdf5c('0x4e')](handleError(_0x4c5f5e,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index b8ad4f3..7f055da 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 _0x2c6a=['hook','exports','events','../../mysqldb','ChatMessage','save','update','remove','emit','hasOwnProperty'];(function(_0x4b6420,_0x126201){var _0x37076f=function(_0x3ee471){while(--_0x3ee471){_0x4b6420['push'](_0x4b6420['shift']());}};_0x37076f(++_0x126201);}(_0x2c6a,0x1a6));var _0xa2c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c6a[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xa2c6('0x0'));var ChatMessage=require(_0xa2c6('0x1'))['db'][_0xa2c6('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa2c6('0x3'),'afterUpdate':_0xa2c6('0x4'),'afterDestroy':_0xa2c6('0x5')};function emitEvent(_0x40f80a){return function(_0x1668bf,_0x25939c,_0x1b400f){ChatMessageEvents[_0xa2c6('0x6')](_0x40f80a+':'+_0x1668bf['id'],_0x1668bf);ChatMessageEvents['emit'](_0x40f80a,_0x1668bf);_0x1b400f(null);};}for(var e in events){if(events[_0xa2c6('0x7')](e)){var event=events[e];ChatMessage[_0xa2c6('0x8')](e,emitEvent(event));}}module[_0xa2c6('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0xcd23=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x1a3e23,_0xce45e){var _0x5ee0d8=function(_0x4b932f){while(--_0x4b932f){_0x1a3e23['push'](_0x1a3e23['shift']());}};_0x5ee0d8(++_0xce45e);}(_0xcd23,0xf4));var _0x3cd2=function(_0x545dd1,_0x5d6d32){_0x545dd1=_0x545dd1-0x0;var _0xb9692b=_0xcd23[_0x545dd1];return _0xb9692b;};'use strict';var EventEmitter=require(_0x3cd2('0x0'));var ChatMessage=require(_0x3cd2('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x3cd2('0x2')](0x0);var events={'afterCreate':_0x3cd2('0x3'),'afterUpdate':_0x3cd2('0x4'),'afterDestroy':_0x3cd2('0x5')};function emitEvent(_0x509114){return function(_0x363b40,_0x3a54a7,_0x4c6d2d){ChatMessageEvents[_0x3cd2('0x6')](_0x509114+':'+_0x363b40['id'],_0x363b40);ChatMessageEvents[_0x3cd2('0x6')](_0x509114,_0x363b40);_0x4c6d2d(null);};}for(var e in events){if(events[_0x3cd2('0x7')](e)){var event=events[e];ChatMessage[_0x3cd2('0x8')](e,emitEvent(event));}}module[_0x3cd2('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 9df1967..cff9f70 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 _0xc39c=['then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','direction','toLowerCase','out','secret','isNil','ChatInteraction','findOne','ChatInteractionId'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc39c,0x13a));var _0xcc39=function(_0x32c247,_0x41b343){_0x32c247=_0x32c247-0x0;var _0x1fae4a=_0xc39c[_0x32c247];return _0x1fae4a;};'use strict';var _=require('lodash');var util=require(_0xcc39('0x0'));var logger=require(_0xcc39('0x1'))('api');var moment=require(_0xcc39('0x2'));var BPromise=require(_0xcc39('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc39('0x4'));var rimraf=require(_0xcc39('0x5'));var config=require(_0xcc39('0x6'));var attributes=require(_0xcc39('0x7'));module['exports']=function(_0x1a4ef5,_0x56182e){return _0x1a4ef5[_0xcc39('0x8')](_0xcc39('0x9'),attributes,{'tableName':_0xcc39('0xa'),'paranoid':![],'indexes':[{'name':_0xcc39('0xb'),'fields':[_0xcc39('0xc')],'type':_0xcc39('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x172f86,_0x484d83,_0xc02a2d){var _0x10231e=_0x1a4ef5['models'];var _0x2fc0fc=_0x172f86['get']({'plain':!![]});if(_0x2fc0fc[_0xcc39('0xe')]['toLowerCase']()==='in'||_0x2fc0fc[_0xcc39('0xe')][_0xcc39('0xf')]()===_0xcc39('0x10')&&!_0x2fc0fc[_0xcc39('0x11')]&&!_[_0xcc39('0x12')](_0x2fc0fc['UserId'])){_0x10231e[_0xcc39('0x13')][_0xcc39('0x14')]({'where':{'id':_0x2fc0fc[_0xcc39('0x15')]}})[_0xcc39('0x16')](function(_0x3bdc9a){if(_0x3bdc9a){_0x3bdc9a[_0xcc39('0x17')]({'lastMsgAt':_0x2fc0fc[_0xcc39('0x18')],'lastMsgDirection':_0x2fc0fc[_0xcc39('0xe')][_0xcc39('0xf')]()});}})['catch'](function(_0x4cbb8f){console[_0xcc39('0x19')](_0x4cbb8f);});}_0xc02a2d();}},'charset':_0xcc39('0x1a'),'collate':_0xcc39('0x1b')});}; \ No newline at end of file +var _0x0dec=['update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','ChatInteraction','findOne','ChatInteractionId','then'];(function(_0x6b488c,_0x1c8ff4){var _0x15b819=function(_0x4d876a){while(--_0x4d876a){_0x6b488c['push'](_0x6b488c['shift']());}};_0x15b819(++_0x1c8ff4);}(_0x0dec,0x11c));var _0xc0de=function(_0x44bbc8,_0x1d350f){_0x44bbc8=_0x44bbc8-0x0;var _0x3d814a=_0x0dec[_0x44bbc8];return _0x3d814a;};'use strict';var _=require(_0xc0de('0x0'));var util=require(_0xc0de('0x1'));var logger=require(_0xc0de('0x2'))(_0xc0de('0x3'));var moment=require('moment');var BPromise=require(_0xc0de('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc0de('0x5'));var config=require(_0xc0de('0x6'));var attributes=require(_0xc0de('0x7'));module[_0xc0de('0x8')]=function(_0xae49db,_0x194937){return _0xae49db[_0xc0de('0x9')](_0xc0de('0xa'),attributes,{'tableName':_0xc0de('0xb'),'paranoid':![],'indexes':[{'name':_0xc0de('0xc'),'fields':[_0xc0de('0xd')],'type':_0xc0de('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x7fb69a,_0x46ed3f,_0x3a169a){var _0xd27e9f=_0xae49db[_0xc0de('0xf')];var _0x285146=_0x7fb69a[_0xc0de('0x10')]({'plain':!![]});if(_0x285146[_0xc0de('0x11')][_0xc0de('0x12')]()==='in'||_0x285146[_0xc0de('0x11')][_0xc0de('0x12')]()===_0xc0de('0x13')&&!_0x285146[_0xc0de('0x14')]&&!_['isNil'](_0x285146[_0xc0de('0x15')])){_0xd27e9f[_0xc0de('0x16')][_0xc0de('0x17')]({'where':{'id':_0x285146[_0xc0de('0x18')]}})[_0xc0de('0x19')](function(_0x7fae0c){if(_0x7fae0c){_0x7fae0c[_0xc0de('0x1a')]({'lastMsgAt':_0x285146[_0xc0de('0x1b')],'lastMsgDirection':_0x285146[_0xc0de('0x11')][_0xc0de('0x12')]()});}})[_0xc0de('0x1c')](function(_0x7f1e4d){console['error'](_0x7f1e4d);});}_0x3a169a();}},'charset':_0xc0de('0x1d'),'collate':_0xc0de('0x1e')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 35e7176..9eae1be 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 _0x8bcc=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','result','catch','CreateChatMessage','ChatMessage','create','options','raw','stringify','lodash','util','moment','bluebird','randomstring'];(function(_0x4cd690,_0x4797cc){var _0x4a74a9=function(_0x4cbbc5){while(--_0x4cbbc5){_0x4cd690['push'](_0x4cd690['shift']());}};_0x4a74a9(++_0x4797cc);}(_0x8bcc,0xaa));var _0xc8bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bcc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc8bc('0x0'));var util=require(_0xc8bc('0x1'));var moment=require(_0xc8bc('0x2'));var BPromise=require(_0xc8bc('0x3'));var rs=require(_0xc8bc('0x4'));var fs=require('fs');var Redis=require(_0xc8bc('0x5'));var db=require(_0xc8bc('0x6'))['db'];var utils=require(_0xc8bc('0x7'));var logger=require(_0xc8bc('0x8'))(_0xc8bc('0x9'));var config=require(_0xc8bc('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc8bc('0xb')][_0xc8bc('0xc')]({'port':0x232a});config[_0xc8bc('0xd')]=_[_0xc8bc('0xe')](config[_0xc8bc('0xd')],{'host':_0xc8bc('0xf'),'port':0x18eb});var socket=require(_0xc8bc('0x10'))(new Redis(config[_0xc8bc('0xd')]));require('./chatMessage.socket')[_0xc8bc('0x11')](socket);function respondWithRpcPromise(_0x1dec81,_0x5e1fbb,_0x380322){return new BPromise(function(_0x30b3b1,_0x5f29e8){return client[_0xc8bc('0x12')](_0x1dec81,_0x380322)[_0xc8bc('0x13')](function(_0x2317de){logger['info'](_0xc8bc('0x14'),_0x5e1fbb,'request\x20sent');logger[_0xc8bc('0x15')](_0xc8bc('0x16'),_0x5e1fbb,'request\x20sent',JSON['stringify'](_0x2317de));if(_0x2317de[_0xc8bc('0x17')]){if(_0x2317de['error']['code']===0x1f4){logger[_0xc8bc('0x17')]('ChatMessage,\x20%s,\x20%s',_0x5e1fbb,_0x2317de['error'][_0xc8bc('0x18')]);return _0x5f29e8(_0x2317de[_0xc8bc('0x17')]['message']);}logger[_0xc8bc('0x17')](_0xc8bc('0x14'),_0x5e1fbb,_0x2317de['error'][_0xc8bc('0x18')]);return _0x30b3b1(_0x2317de[_0xc8bc('0x17')][_0xc8bc('0x18')]);}else{logger[_0xc8bc('0x19')](_0xc8bc('0x14'),_0x5e1fbb,_0xc8bc('0x1a'));_0x30b3b1(_0x2317de[_0xc8bc('0x1b')][_0xc8bc('0x18')]);}})[_0xc8bc('0x1c')](function(_0x2435ff){logger[_0xc8bc('0x17')](_0xc8bc('0x14'),_0x5e1fbb,_0x2435ff);_0x5f29e8(_0x2435ff);});});}exports[_0xc8bc('0x1d')]=function(_0xf4a84c){var _0x3a34d4=this;return new Promise(function(_0x391f99,_0x223bff){return db[_0xc8bc('0x1e')][_0xc8bc('0x1f')](_0xf4a84c['body'],{'raw':_0xf4a84c[_0xc8bc('0x20')]?_0xf4a84c[_0xc8bc('0x20')][_0xc8bc('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x4be65f){logger[_0xc8bc('0x19')](_0xc8bc('0x1d'),_0xf4a84c);logger['debug'](_0xc8bc('0x1d'),_0xf4a84c,JSON[_0xc8bc('0x22')](_0x4be65f));_0x391f99(_0x4be65f);})[_0xc8bc('0x1c')](function(_0x468628){logger[_0xc8bc('0x17')](_0xc8bc('0x1d'),_0x468628[_0xc8bc('0x18')],_0xf4a84c);_0x223bff(_0x3a34d4[_0xc8bc('0x17')](0x1f4,_0x468628['message']));});});}; \ No newline at end of file +var _0x4371=['ChatMessage','create','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','./chatMessage.socket','register','request','then','info','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','CreateChatMessage'];(function(_0x2ef141,_0x3be740){var _0x47c2c0=function(_0x3f0a6a){while(--_0x3f0a6a){_0x2ef141['push'](_0x2ef141['shift']());}};_0x47c2c0(++_0x3be740);}(_0x4371,0x192));var _0x1437=function(_0x4dd4a1,_0x5ca922){_0x4dd4a1=_0x4dd4a1-0x0;var _0x168d0f=_0x4371[_0x4dd4a1];return _0x168d0f;};'use strict';var _=require(_0x1437('0x0'));var util=require(_0x1437('0x1'));var moment=require(_0x1437('0x2'));var BPromise=require(_0x1437('0x3'));var rs=require(_0x1437('0x4'));var fs=require('fs');var Redis=require(_0x1437('0x5'));var db=require(_0x1437('0x6'))['db'];var utils=require(_0x1437('0x7'));var logger=require(_0x1437('0x8'))(_0x1437('0x9'));var config=require('../../config/environment');var jayson=require(_0x1437('0xa'));var client=jayson['client'][_0x1437('0xb')]({'port':0x232a});config['redis']=_[_0x1437('0xc')](config[_0x1437('0xd')],{'host':_0x1437('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1437('0xd')]));require(_0x1437('0xf'))[_0x1437('0x10')](socket);function respondWithRpcPromise(_0x2d7aaf,_0x3d63a7,_0x112c80){return new BPromise(function(_0x1bf039,_0x500c90){return client[_0x1437('0x11')](_0x2d7aaf,_0x112c80)[_0x1437('0x12')](function(_0x144db4){logger[_0x1437('0x13')]('ChatMessage,\x20%s,\x20%s',_0x3d63a7,'request\x20sent');logger[_0x1437('0x14')](_0x1437('0x15'),_0x3d63a7,_0x1437('0x16'),JSON[_0x1437('0x17')](_0x144db4));if(_0x144db4[_0x1437('0x18')]){if(_0x144db4['error'][_0x1437('0x19')]===0x1f4){logger[_0x1437('0x18')](_0x1437('0x1a'),_0x3d63a7,_0x144db4[_0x1437('0x18')][_0x1437('0x1b')]);return _0x500c90(_0x144db4['error'][_0x1437('0x1b')]);}logger[_0x1437('0x18')](_0x1437('0x1a'),_0x3d63a7,_0x144db4['error'][_0x1437('0x1b')]);return _0x1bf039(_0x144db4[_0x1437('0x18')][_0x1437('0x1b')]);}else{logger['info'](_0x1437('0x1a'),_0x3d63a7,_0x1437('0x16'));_0x1bf039(_0x144db4[_0x1437('0x1c')][_0x1437('0x1b')]);}})['catch'](function(_0x1a1129){logger[_0x1437('0x18')]('ChatMessage,\x20%s,\x20%s',_0x3d63a7,_0x1a1129);_0x500c90(_0x1a1129);});});}exports[_0x1437('0x1d')]=function(_0x460681){var _0x629873=this;return new Promise(function(_0x3d0998,_0x31306c){return db[_0x1437('0x1e')][_0x1437('0x1f')](_0x460681[_0x1437('0x20')],{'raw':_0x460681[_0x1437('0x21')]?_0x460681[_0x1437('0x21')][_0x1437('0x22')]===undefined?!![]:![]:!![]})[_0x1437('0x12')](function(_0x18d14f){logger['info'](_0x1437('0x1d'),_0x460681);logger[_0x1437('0x14')](_0x1437('0x1d'),_0x460681,JSON[_0x1437('0x17')](_0x18d14f));_0x3d0998(_0x18d14f);})[_0x1437('0x23')](function(_0x940356){logger[_0x1437('0x18')](_0x1437('0x1d'),_0x940356['message'],_0x460681);_0x31306c(_0x629873['error'](0x1f4,_0x940356[_0x1437('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 9a1bfe4..7fede85 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 _0x4491=['remove','emit','register','length','chatMessage:','./chatMessage.events'];(function(_0x382719,_0x91d5cb){var _0x48cff9=function(_0xf539c3){while(--_0xf539c3){_0x382719['push'](_0x382719['shift']());}};_0x48cff9(++_0x91d5cb);}(_0x4491,0x1bb));var _0x1449=function(_0x506172,_0xbc3a3){_0x506172=_0x506172-0x0;var _0x2723c0=_0x4491[_0x506172];return _0x2723c0;};'use strict';var ChatMessageEvents=require(_0x1449('0x0'));var events=['save',_0x1449('0x1'),'update'];function createListener(_0x4273ee,_0x176880){return function(_0x45474c){_0x176880[_0x1449('0x2')](_0x4273ee,_0x45474c);};}function removeListener(_0x1ff47f,_0x1b2870){return function(){ChatMessageEvents['removeListener'](_0x1ff47f,_0x1b2870);};}exports[_0x1449('0x3')]=function(_0x557482){for(var _0x1d45eb=0x0,_0x5dfe4c=events[_0x1449('0x4')];_0x1d45eb<_0x5dfe4c;_0x1d45eb++){var _0x2f4189=events[_0x1d45eb];var _0x10e119=createListener(_0x1449('0x5')+_0x2f4189,_0x557482);ChatMessageEvents['on'](_0x2f4189,_0x10e119);}}; \ No newline at end of file +var _0x3baf=['save','remove','update','emit','removeListener','register','chatMessage:','./chatMessage.events'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x3baf,0xf7));var _0xf3ba=function(_0x5193cd,_0xcd459f){_0x5193cd=_0x5193cd-0x0;var _0x264954=_0x3baf[_0x5193cd];return _0x264954;};'use strict';var ChatMessageEvents=require(_0xf3ba('0x0'));var events=[_0xf3ba('0x1'),_0xf3ba('0x2'),_0xf3ba('0x3')];function createListener(_0x29bbc2,_0x22f9c0){return function(_0xfce22){_0x22f9c0[_0xf3ba('0x4')](_0x29bbc2,_0xfce22);};}function removeListener(_0x3e6058,_0x1ae6e6){return function(){ChatMessageEvents[_0xf3ba('0x5')](_0x3e6058,_0x1ae6e6);};}exports[_0xf3ba('0x6')]=function(_0x475268){for(var _0x2e6df2=0x0,_0x1284b7=events['length'];_0x2e6df2<_0x1284b7;_0x2e6df2++){var _0x579135=events[_0x2e6df2];var _0x5ab058=createListener(_0xf3ba('0x7')+_0x579135,_0x475268);ChatMessageEvents['on'](_0x579135,_0x5ab058);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 4248ceb..1e9658d 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 _0x3394=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','chat','chatmessage:create','create','put','accept','/:id/reject','reject','delete','destroy'];(function(_0x383494,_0x2070d2){var _0x2485e5=function(_0x37c52e){while(--_0x37c52e){_0x383494['push'](_0x383494['shift']());}};_0x2485e5(++_0x2070d2);}(_0x3394,0x1a1));var _0x4339=function(_0x5b3608,_0x1d1559){_0x5b3608=_0x5b3608-0x0;var _0xa7d861=_0x3394[_0x5b3608];return _0xa7d861;};'use strict';var multer=require(_0x4339('0x0'));var util=require(_0x4339('0x1'));var path=require('path');var timeout=require(_0x4339('0x2'));var express=require(_0x4339('0x3'));var router=express[_0x4339('0x4')]();var fs_extra=require(_0x4339('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4339('0x6'));var config=require(_0x4339('0x7'));var controller=require('./chatMessage.controller');router[_0x4339('0x8')]('/',auth['isAuthenticated'](),controller[_0x4339('0x9')]);router[_0x4339('0x8')](_0x4339('0xa'),auth[_0x4339('0xb')](),controller[_0x4339('0xc')]);router[_0x4339('0x8')](_0x4339('0xd'),auth[_0x4339('0xb')](),controller[_0x4339('0xe')]);router[_0x4339('0xf')]('/',auth[_0x4339('0xb')](),interaction['tracked'](_0x4339('0x10'),_0x4339('0x11')),controller[_0x4339('0x12')]);router[_0x4339('0x13')](_0x4339('0xd'),controller['update']);router[_0x4339('0x13')]('/:id/accept',auth[_0x4339('0xb')](),controller[_0x4339('0x14')]);router[_0x4339('0x13')](_0x4339('0x15'),auth[_0x4339('0xb')](),controller[_0x4339('0x16')]);router[_0x4339('0x17')](_0x4339('0xd'),auth[_0x4339('0xb')](),controller[_0x4339('0x18')]);module[_0x4339('0x19')]=router; \ No newline at end of file +var _0x078f=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','tracked','chatmessage:create','create','put','accept','/:id/reject','reject','delete','destroy','exports','util'];(function(_0x23d47a,_0x5550e8){var _0x22d3c0=function(_0x4a550f){while(--_0x4a550f){_0x23d47a['push'](_0x23d47a['shift']());}};_0x22d3c0(++_0x5550e8);}(_0x078f,0xb5));var _0xf078=function(_0x522ae8,_0x3b637e){_0x522ae8=_0x522ae8-0x0;var _0x3189b9=_0x078f[_0x522ae8];return _0x3189b9;};'use strict';var multer=require('multer');var util=require(_0xf078('0x0'));var path=require(_0xf078('0x1'));var timeout=require(_0xf078('0x2'));var express=require('express');var router=express[_0xf078('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf078('0x4'));var interaction=require(_0xf078('0x5'));var config=require(_0xf078('0x6'));var controller=require(_0xf078('0x7'));router[_0xf078('0x8')]('/',auth['isAuthenticated'](),controller[_0xf078('0x9')]);router['get'](_0xf078('0xa'),auth['isAuthenticated'](),controller[_0xf078('0xb')]);router[_0xf078('0x8')](_0xf078('0xc'),auth[_0xf078('0xd')](),controller[_0xf078('0xe')]);router[_0xf078('0xf')]('/',auth['isAuthenticated'](),interaction[_0xf078('0x10')]('chat',_0xf078('0x11')),controller[_0xf078('0x12')]);router[_0xf078('0x13')](_0xf078('0xc'),controller['update']);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0xf078('0x14')]);router[_0xf078('0x13')](_0xf078('0x15'),auth['isAuthenticated'](),controller[_0xf078('0x16')]);router[_0xf078('0x17')]('/:id',auth[_0xf078('0xd')](),controller[_0xf078('0x18')]);module[_0xf078('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 173b7fe..6f0ff8d 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 _0x0b0e=['medium','sequelize','TEXT'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x0b0e[_0x2235bf];return _0x4c3a64;};'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 +var _0x5f66=['medium','TEXT','exports'];(function(_0x1db288,_0x52f105){var _0x336800=function(_0x1cd1c2){while(--_0x1cd1c2){_0x1db288['push'](_0x1db288['shift']());}};_0x336800(++_0x52f105);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index f974a3e..656de18 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 _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x7a54,0x106));var _0x47a5=function(_0x1f097c,_0x48f58d){_0x1f097c=_0x1f097c-0x0;var _0x4c608a=_0x7a54[_0x1f097c];return _0x4c608a;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x7a54,0x106));var _0x47a5=function(_0x5eae06,_0x227bf2){_0x5eae06=_0x5eae06-0x0;var _0x34a70f=_0x7a54[_0x5eae06];return _0x34a70f;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 409557d..268d15d 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 _0x148c=['hook','events','../../mysqldb','ChatOfflineMessage','remove','emit','hasOwnProperty'];(function(_0x35f1de,_0x4dda19){var _0x4b66d6=function(_0x4ff6c5){while(--_0x4ff6c5){_0x35f1de['push'](_0x35f1de['shift']());}};_0x4b66d6(++_0x4dda19);}(_0x148c,0xd3));var _0xc148=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x148c[_0x16d10f];return _0x50c823;};'use strict';var EventEmitter=require(_0xc148('0x0'));var ChatOfflineMessage=require(_0xc148('0x1'))['db'][_0xc148('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc148('0x3')};function emitEvent(_0x16e00b){return function(_0x44e488,_0x3af8ce,_0xabe01a){ChatOfflineMessageEvents[_0xc148('0x4')](_0x16e00b+':'+_0x44e488['id'],_0x44e488);ChatOfflineMessageEvents['emit'](_0x16e00b,_0x44e488);_0xabe01a(null);};}for(var e in events){if(events[_0xc148('0x5')](e)){var event=events[e];ChatOfflineMessage[_0xc148('0x6')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0x2ad6=['exports','events','ChatOfflineMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x2b8286,_0xe3d644){var _0x14af6c=function(_0x51a015){while(--_0x51a015){_0x2b8286['push'](_0x2b8286['shift']());}};_0x14af6c(++_0xe3d644);}(_0x2ad6,0x1a1));var _0x62ad=function(_0xdeb232,_0x18eb34){_0xdeb232=_0xdeb232-0x0;var _0x2191b0=_0x2ad6[_0xdeb232];return _0x2191b0;};'use strict';var EventEmitter=require(_0x62ad('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0x62ad('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x62ad('0x2')](0x0);var events={'afterCreate':_0x62ad('0x3'),'afterUpdate':_0x62ad('0x4'),'afterDestroy':'remove'};function emitEvent(_0x989270){return function(_0x750cc9,_0xd24c4c,_0x1142ee){ChatOfflineMessageEvents[_0x62ad('0x5')](_0x989270+':'+_0x750cc9['id'],_0x750cc9);ChatOfflineMessageEvents['emit'](_0x989270,_0x750cc9);_0x1142ee(null);};}for(var e in events){if(events[_0x62ad('0x6')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x62ad('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 58fbc1e..9abad0d 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 _0x94d4=['chat_offline_messages','utf8mb4','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage'];(function(_0x55f49c,_0x3d85b1){var _0x29a4f7=function(_0x1fcb14){while(--_0x1fcb14){_0x55f49c['push'](_0x55f49c['shift']());}};_0x29a4f7(++_0x3d85b1);}(_0x94d4,0x104));var _0x494d=function(_0x242ef4,_0x4b3ba8){_0x242ef4=_0x242ef4-0x0;var _0x1c52bb=_0x94d4[_0x242ef4];return _0x1c52bb;};'use strict';var attributes=require(_0x494d('0x0'));module[_0x494d('0x1')]=function(_0xda94ec){return _0xda94ec[_0x494d('0x2')](_0x494d('0x3'),attributes,{'tableName':_0x494d('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x494d('0x5'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6b7a=['exports','define','ChatOfflineMessage','chat_offline_messages'];(function(_0x2967c1,_0x202a72){var _0x103397=function(_0x14b5cc){while(--_0x14b5cc){_0x2967c1['push'](_0x2967c1['shift']());}};_0x103397(++_0x202a72);}(_0x6b7a,0x108));var _0xa6b7=function(_0x1ab0e6,_0x17ba8d){_0x1ab0e6=_0x1ab0e6-0x0;var _0x248815=_0x6b7a[_0x1ab0e6];return _0x248815;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0xa6b7('0x0')]=function(_0x34d09c){return _0x34d09c[_0xa6b7('0x1')](_0xa6b7('0x2'),attributes,{'tableName':_0xa6b7('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 9dc96c9..51f1e9e 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 _0x16b4=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x16b4,0xa9));var _0x416b=function(_0x515bbd,_0x102ffe){_0x515bbd=_0x515bbd-0x0;var _0x472340=_0x16b4[_0x515bbd];return _0x472340;};'use strict';var _=require(_0x416b('0x0'));var util=require(_0x416b('0x1'));var moment=require(_0x416b('0x2'));var BPromise=require(_0x416b('0x3'));var rs=require(_0x416b('0x4'));var fs=require('fs');var Redis=require(_0x416b('0x5'));var db=require(_0x416b('0x6'))['db'];var utils=require(_0x416b('0x7'));var logger=require(_0x416b('0x8'))(_0x416b('0x9'));var config=require(_0x416b('0xa'));var jayson=require(_0x416b('0xb'));var client=jayson[_0x416b('0xc')][_0x416b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2da355,_0x185c7e,_0x458871){return new BPromise(function(_0x40d930,_0x33cdd3){return client[_0x416b('0xe')](_0x2da355,_0x458871)['then'](function(_0x2666a4){logger[_0x416b('0xf')](_0x416b('0x10'),_0x185c7e,_0x416b('0x11'));logger[_0x416b('0x12')](_0x416b('0x13'),_0x185c7e,_0x416b('0x11'),JSON[_0x416b('0x14')](_0x2666a4));if(_0x2666a4[_0x416b('0x15')]){if(_0x2666a4['error'][_0x416b('0x16')]===0x1f4){logger[_0x416b('0x15')](_0x416b('0x10'),_0x185c7e,_0x2666a4[_0x416b('0x15')]['message']);return _0x33cdd3(_0x2666a4[_0x416b('0x15')]['message']);}logger[_0x416b('0x15')](_0x416b('0x10'),_0x185c7e,_0x2666a4[_0x416b('0x15')][_0x416b('0x17')]);return _0x40d930(_0x2666a4[_0x416b('0x15')]['message']);}else{logger['info'](_0x416b('0x10'),_0x185c7e,_0x416b('0x11'));_0x40d930(_0x2666a4[_0x416b('0x18')][_0x416b('0x17')]);}})['catch'](function(_0xa7a3bb){logger[_0x416b('0x15')]('ChatOfflineMessage,\x20%s,\x20%s',_0x185c7e,_0xa7a3bb);_0x33cdd3(_0xa7a3bb);});});} \ No newline at end of file +var _0xa2f5=['http','request','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x32e90a,_0x317d6f){var _0x3ad167=function(_0x5ece84){while(--_0x5ece84){_0x32e90a['push'](_0x32e90a['shift']());}};_0x3ad167(++_0x317d6f);}(_0xa2f5,0xf2));var _0x5a2f=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa2f5[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x5a2f('0x0'));var util=require(_0x5a2f('0x1'));var moment=require(_0x5a2f('0x2'));var BPromise=require(_0x5a2f('0x3'));var rs=require(_0x5a2f('0x4'));var fs=require('fs');var Redis=require(_0x5a2f('0x5'));var db=require(_0x5a2f('0x6'))['db'];var utils=require(_0x5a2f('0x7'));var logger=require(_0x5a2f('0x8'))(_0x5a2f('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x5a2f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x417d87,_0x5da183,_0x2d6392){return new BPromise(function(_0x1033db,_0x214637){return client[_0x5a2f('0xb')](_0x417d87,_0x2d6392)['then'](function(_0x58e639){logger['info'](_0x5a2f('0xc'),_0x5da183,_0x5a2f('0xd'));logger[_0x5a2f('0xe')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x5da183,_0x5a2f('0xd'),JSON[_0x5a2f('0xf')](_0x58e639));if(_0x58e639['error']){if(_0x58e639[_0x5a2f('0x10')]['code']===0x1f4){logger['error'](_0x5a2f('0xc'),_0x5da183,_0x58e639[_0x5a2f('0x10')][_0x5a2f('0x11')]);return _0x214637(_0x58e639['error'][_0x5a2f('0x11')]);}logger[_0x5a2f('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5da183,_0x58e639['error'][_0x5a2f('0x11')]);return _0x1033db(_0x58e639[_0x5a2f('0x10')]['message']);}else{logger[_0x5a2f('0x12')](_0x5a2f('0xc'),_0x5da183,_0x5a2f('0xd'));_0x1033db(_0x58e639[_0x5a2f('0x13')][_0x5a2f('0x11')]);}})[_0x5a2f('0x14')](function(_0x566cd0){logger[_0x5a2f('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5da183,_0x566cd0);_0x214637(_0x566cd0);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index e5ce4ea..d6d3c04 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 _0xfade=['destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0xfade,0x14c));var _0xefad=function(_0x28f5ae,_0x3a0190){_0x28f5ae=_0x28f5ae-0x0;var _0x4acc8b=_0xfade[_0x28f5ae];return _0x4acc8b;};'use strict';var multer=require('multer');var util=require(_0xefad('0x0'));var path=require(_0xefad('0x1'));var timeout=require(_0xefad('0x2'));var express=require('express');var router=express[_0xefad('0x3')]();var fs_extra=require(_0xefad('0x4'));var auth=require(_0xefad('0x5'));var interaction=require(_0xefad('0x6'));var config=require('../../config/environment');var controller=require(_0xefad('0x7'));router['get']('/',auth[_0xefad('0x8')](),controller[_0xefad('0x9')]);router[_0xefad('0xa')](_0xefad('0xb'),auth['isAuthenticated'](),controller[_0xefad('0xc')]);router[_0xefad('0xa')](_0xefad('0xd'),auth[_0xefad('0x8')](),controller[_0xefad('0xe')]);router[_0xefad('0xf')]('/',auth[_0xefad('0x8')](),controller[_0xefad('0x10')]);router[_0xefad('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xefad('0x12')]);router[_0xefad('0x13')](_0xefad('0xd'),auth[_0xefad('0x8')](),controller[_0xefad('0x14')]);module[_0xefad('0x15')]=router; \ No newline at end of file +var _0xb9d6=['/describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index'];(function(_0x43026b,_0x928d8c){var _0x4a96cd=function(_0x362cbd){while(--_0x362cbd){_0x43026b['push'](_0x43026b['shift']());}};_0x4a96cd(++_0x928d8c);}(_0xb9d6,0x13d));var _0x6b9d=function(_0x1eebe4,_0x27f7b4){_0x1eebe4=_0x1eebe4-0x0;var _0x46f639=_0xb9d6[_0x1eebe4];return _0x46f639;};'use strict';var multer=require(_0x6b9d('0x0'));var util=require(_0x6b9d('0x1'));var path=require(_0x6b9d('0x2'));var timeout=require(_0x6b9d('0x3'));var express=require('express');var router=express[_0x6b9d('0x4')]();var fs_extra=require(_0x6b9d('0x5'));var auth=require(_0x6b9d('0x6'));var interaction=require(_0x6b9d('0x7'));var config=require(_0x6b9d('0x8'));var controller=require(_0x6b9d('0x9'));router[_0x6b9d('0xa')]('/',auth[_0x6b9d('0xb')](),controller[_0x6b9d('0xc')]);router[_0x6b9d('0xa')](_0x6b9d('0xd'),auth[_0x6b9d('0xb')](),controller['describe']);router[_0x6b9d('0xa')](_0x6b9d('0xe'),auth['isAuthenticated'](),controller[_0x6b9d('0xf')]);router[_0x6b9d('0x10')]('/',auth[_0x6b9d('0xb')](),controller['create']);router[_0x6b9d('0x11')](_0x6b9d('0xe'),auth[_0x6b9d('0xb')](),controller[_0x6b9d('0x12')]);router[_0x6b9d('0x13')](_0x6b9d('0xe'),auth[_0x6b9d('0xb')](),controller[_0x6b9d('0x14')]);module[_0x6b9d('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 630b0e5..9552440 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 _0x093e=['mouseOver','timeout','STRING','sequelize','exports','ENUM'];(function(_0x209302,_0x5826ac){var _0x1df8e9=function(_0x16ae49){while(--_0x16ae49){_0x209302['push'](_0x209302['shift']());}};_0x1df8e9(++_0x5826ac);}(_0x093e,0x1ad));var _0xe093=function(_0x23d122,_0x2e3249){_0x23d122=_0x23d122-0x0;var _0x355d6a=_0x093e[_0x23d122];return _0x355d6a;};'use strict';var Sequelize=require(_0xe093('0x0'));module[_0xe093('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xe093('0x2')](_0xe093('0x3'),_0xe093('0x4')),'defaultValue':_0xe093('0x3')},'selector':{'type':Sequelize[_0xe093('0x5')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xca8a=['timeout','INTEGER','sequelize','exports','STRING','ENUM','mouseOver'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xca8a,0xc6));var _0xaca8=function(_0x5bd922,_0x2a6c2b){_0x5bd922=_0x5bd922-0x0;var _0x90ef93=_0xca8a[_0x5bd922];return _0x90ef93;};'use strict';var Sequelize=require(_0xaca8('0x0'));module[_0xaca8('0x1')]={'name':{'type':Sequelize[_0xaca8('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xaca8('0x3')](_0xaca8('0x4'),_0xaca8('0x5')),'defaultValue':_0xaca8('0x4')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xaca8('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 0421512..f107bb9 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 _0x7579=['desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','error','name','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto'];(function(_0x2bbc07,_0x1e2168){var _0x6879e4=function(_0x290fa1){while(--_0x290fa1){_0x2bbc07['push'](_0x2bbc07['shift']());}};_0x6879e4(++_0x1e2168);}(_0x7579,0x1e2));var _0x9757=function(_0x35a6b3,_0x5c9114){_0x35a6b3=_0x35a6b3-0x0;var _0x1d95bb=_0x7579[_0x35a6b3];return _0x1d95bb;};'use strict';var emlformat=require(_0x9757('0x0'));var rimraf=require(_0x9757('0x1'));var zipdir=require(_0x9757('0x2'));var jsonpatch=require(_0x9757('0x3'));var rp=require(_0x9757('0x4'));var moment=require(_0x9757('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9757('0x6'));var util=require(_0x9757('0x7'));var path=require(_0x9757('0x8'));var sox=require(_0x9757('0x9'));var csv=require('to-csv');var ejs=require(_0x9757('0xa'));var fs=require('fs');var fs_extra=require(_0x9757('0xb'));var _=require(_0x9757('0xc'));var squel=require('squel');var crypto=require(_0x9757('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9757('0xe'));var toCsv=require(_0x9757('0xf'));var querystring=require(_0x9757('0x10'));var Papa=require('papaparse');var Redis=require(_0x9757('0x11'));var authService=require(_0x9757('0x12'));var qs=require(_0x9757('0x13'));var as=require(_0x9757('0x14'));var hardwareService=require(_0x9757('0x15'));var logger=require(_0x9757('0x16'))(_0x9757('0x17'));var utils=require(_0x9757('0x18'));var config=require(_0x9757('0x19'));var licenseUtil=require(_0x9757('0x1a'));var db=require(_0x9757('0x1b'))['db'];function respondWithStatusCode(_0x5c19c9,_0x2f2200){_0x2f2200=_0x2f2200||0xcc;return function(_0x1d32ee){if(_0x1d32ee){return _0x5c19c9[_0x9757('0x1c')](_0x2f2200);}return _0x5c19c9['status'](_0x2f2200)[_0x9757('0x1d')]();};}function respondWithResult(_0x39fa5c,_0x413d55){_0x413d55=_0x413d55||0xc8;return function(_0x14f67c){if(_0x14f67c){return _0x39fa5c[_0x9757('0x1e')](_0x413d55)[_0x9757('0x1f')](_0x14f67c);}};}function respondWithFilteredResult(_0x105e56,_0x4b994d){return function(_0x1fd6f6){if(_0x1fd6f6){var _0x55ded7=typeof _0x4b994d[_0x9757('0x20')]===_0x9757('0x21')&&typeof _0x4b994d[_0x9757('0x22')]===_0x9757('0x21');var _0x3f6be9=_0x1fd6f6[_0x9757('0x23')];var _0x57e309=_0x55ded7?0x0:_0x4b994d[_0x9757('0x20')];var _0x2aa360=_0x55ded7?_0x1fd6f6[_0x9757('0x23')]:_0x4b994d[_0x9757('0x20')]+_0x4b994d[_0x9757('0x22')];var _0xd2306b;if(_0x2aa360>=_0x3f6be9){_0x2aa360=_0x3f6be9;_0xd2306b=0xc8;}else{_0xd2306b=0xce;}_0x105e56[_0x9757('0x1e')](_0xd2306b);return _0x105e56['set'](_0x9757('0x24'),_0x57e309+'-'+_0x2aa360+'/'+_0x3f6be9)['json'](_0x1fd6f6);}return null;};}function patchUpdates(_0x517504){return function(_0x37c889){try{jsonpatch[_0x9757('0x25')](_0x37c889,_0x517504,!![]);}catch(_0x1443a9){return BPromise[_0x9757('0x26')](_0x1443a9);}return _0x37c889['save']();};}function saveUpdates(_0x4ef000,_0x53d21c){return function(_0x73dac4){if(_0x73dac4){return _0x73dac4[_0x9757('0x27')](_0x4ef000)[_0x9757('0x28')](function(_0x21435e){return _0x21435e;});}return null;};}function removeEntity(_0x5dc2fa,_0x11f5ac){return function(_0x160108){if(_0x160108){return _0x160108['destroy']()[_0x9757('0x28')](function(){_0x5dc2fa[_0x9757('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b6915,_0x1a7036){return function(_0x172e8c){if(!_0x172e8c){_0x2b6915[_0x9757('0x1c')](0x194);}return _0x172e8c;};}function handleError(_0x115e33,_0x19588f){_0x19588f=_0x19588f||0x1f4;return function(_0x4e6b86){logger[_0x9757('0x29')](_0x4e6b86['stack']);if(_0x4e6b86[_0x9757('0x2a')]){delete _0x4e6b86[_0x9757('0x2a')];}_0x115e33['status'](_0x19588f)['send'](_0x4e6b86);};}exports[_0x9757('0x2b')]=function(_0x21a4bd,_0xc81976){var _0x3aae8b={'raw':!![],'where':{'id':_0x21a4bd[_0x9757('0x2c')]['id']}},_0x4ebdb6={};_0x4ebdb6[_0x9757('0x2d')]=_[_0x9757('0x2e')](db[_0x9757('0x2f')][_0x9757('0x30')]);_0x4ebdb6[_0x9757('0x31')]=_['keys'](_0x21a4bd[_0x9757('0x31')]);_0x4ebdb6[_0x9757('0x32')]=_[_0x9757('0x33')](_0x4ebdb6[_0x9757('0x2d')],_0x4ebdb6[_0x9757('0x31')]);_0x3aae8b[_0x9757('0x34')]=_[_0x9757('0x33')](_0x4ebdb6['model'],qs[_0x9757('0x35')](_0x21a4bd[_0x9757('0x31')][_0x9757('0x35')]));_0x3aae8b[_0x9757('0x34')]=_0x3aae8b[_0x9757('0x34')][_0x9757('0x36')]?_0x3aae8b[_0x9757('0x34')]:_0x4ebdb6[_0x9757('0x2d')];if(_0x21a4bd['query'][_0x9757('0x37')]){_0x3aae8b['include']=[{'all':!![]}];}_0x3aae8b=_[_0x9757('0x38')]({},_0x3aae8b,_0x21a4bd[_0x9757('0x39')]);return db['ChatProactiveAction'][_0x9757('0x3a')](_0x3aae8b)[_0x9757('0x28')](handleEntityNotFound(_0xc81976,null))[_0x9757('0x28')](respondWithResult(_0xc81976,null))[_0x9757('0x3b')](handleError(_0xc81976,null));};exports[_0x9757('0x3c')]=function(_0x2f2688,_0x3c94b2){return db[_0x9757('0x2f')][_0x9757('0x3c')](_0x2f2688[_0x9757('0x3d')],{})['then'](respondWithResult(_0x3c94b2,0xc9))[_0x9757('0x3b')](handleError(_0x3c94b2,null));};exports[_0x9757('0x27')]=function(_0x457d6c,_0x4f2ea4){if(_0x457d6c[_0x9757('0x3d')]['id']){delete _0x457d6c[_0x9757('0x3d')]['id'];}return db[_0x9757('0x2f')][_0x9757('0x3a')]({'where':{'id':_0x457d6c[_0x9757('0x2c')]['id']}})[_0x9757('0x28')](handleEntityNotFound(_0x4f2ea4,null))[_0x9757('0x28')](saveUpdates(_0x457d6c[_0x9757('0x3d')],null))[_0x9757('0x28')](respondWithResult(_0x4f2ea4,null))['catch'](handleError(_0x4f2ea4,null));};exports['destroy']=function(_0x2cf830,_0x2d0a6e){return db[_0x9757('0x2f')][_0x9757('0x3a')]({'where':{'id':_0x2cf830['params']['id']}})[_0x9757('0x28')](handleEntityNotFound(_0x2d0a6e,null))['then'](removeEntity(_0x2d0a6e,null))[_0x9757('0x3b')](handleError(_0x2d0a6e,null));}; \ No newline at end of file +var _0xfdb3=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','save','then','destroy','stack','name','send','show','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','model','fields','length','merge','options','find','catch','create','body','params','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x1f0077,_0x328f99){var _0x353a1d=function(_0x5927fb){while(--_0x5927fb){_0x1f0077['push'](_0x1f0077['shift']());}};_0x353a1d(++_0x328f99);}(_0xfdb3,0x10c));var _0x3fdb=function(_0x5e185b,_0x853f33){_0x5e185b=_0x5e185b-0x0;var _0x19044d=_0xfdb3[_0x5e185b];return _0x19044d;};'use strict';var emlformat=require(_0x3fdb('0x0'));var rimraf=require(_0x3fdb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3fdb('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3fdb('0x3'));var Mustache=require('mustache');var util=require(_0x3fdb('0x4'));var path=require(_0x3fdb('0x5'));var sox=require(_0x3fdb('0x6'));var csv=require(_0x3fdb('0x7'));var ejs=require(_0x3fdb('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3fdb('0x9'));var squel=require(_0x3fdb('0xa'));var crypto=require(_0x3fdb('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3fdb('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3fdb('0xd'));var Papa=require(_0x3fdb('0xe'));var Redis=require(_0x3fdb('0xf'));var authService=require(_0x3fdb('0x10'));var qs=require(_0x3fdb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x3fdb('0x12'));var config=require(_0x3fdb('0x13'));var licenseUtil=require(_0x3fdb('0x14'));var db=require(_0x3fdb('0x15'))['db'];function respondWithStatusCode(_0x3cc79c,_0x41f371){_0x41f371=_0x41f371||0xcc;return function(_0x416962){if(_0x416962){return _0x3cc79c[_0x3fdb('0x16')](_0x41f371);}return _0x3cc79c[_0x3fdb('0x17')](_0x41f371)[_0x3fdb('0x18')]();};}function respondWithResult(_0x4eab69,_0x35a660){_0x35a660=_0x35a660||0xc8;return function(_0x1a5dd8){if(_0x1a5dd8){return _0x4eab69['status'](_0x35a660)[_0x3fdb('0x19')](_0x1a5dd8);}};}function respondWithFilteredResult(_0x31cd0e,_0x182635){return function(_0x39c573){if(_0x39c573){var _0x5a9b95=typeof _0x182635['offset']==='undefined'&&typeof _0x182635[_0x3fdb('0x1a')]===_0x3fdb('0x1b');var _0x11d57d=_0x39c573[_0x3fdb('0x1c')];var _0x212ab6=_0x5a9b95?0x0:_0x182635['offset'];var _0x224035=_0x5a9b95?_0x39c573[_0x3fdb('0x1c')]:_0x182635[_0x3fdb('0x1d')]+_0x182635[_0x3fdb('0x1a')];var _0x370f84;if(_0x224035>=_0x11d57d){_0x224035=_0x11d57d;_0x370f84=0xc8;}else{_0x370f84=0xce;}_0x31cd0e['status'](_0x370f84);return _0x31cd0e[_0x3fdb('0x1e')](_0x3fdb('0x1f'),_0x212ab6+'-'+_0x224035+'/'+_0x11d57d)[_0x3fdb('0x19')](_0x39c573);}return null;};}function patchUpdates(_0x1bbad7){return function(_0x403f48){try{jsonpatch['apply'](_0x403f48,_0x1bbad7,!![]);}catch(_0x76431d){return BPromise['reject'](_0x76431d);}return _0x403f48[_0x3fdb('0x20')]();};}function saveUpdates(_0x490744,_0x516440){return function(_0x48b674){if(_0x48b674){return _0x48b674['update'](_0x490744)[_0x3fdb('0x21')](function(_0x264913){return _0x264913;});}return null;};}function removeEntity(_0xaf7c32,_0xac9aac){return function(_0x111cb8){if(_0x111cb8){return _0x111cb8[_0x3fdb('0x22')]()['then'](function(){_0xaf7c32['status'](0xcc)[_0x3fdb('0x18')]();});}};}function handleEntityNotFound(_0xc0410d,_0x5c30b5){return function(_0xaf7f8f){if(!_0xaf7f8f){_0xc0410d['sendStatus'](0x194);}return _0xaf7f8f;};}function handleError(_0x47d667,_0x1b9c4b){_0x1b9c4b=_0x1b9c4b||0x1f4;return function(_0x24278c){logger['error'](_0x24278c[_0x3fdb('0x23')]);if(_0x24278c['name']){delete _0x24278c[_0x3fdb('0x24')];}_0x47d667[_0x3fdb('0x17')](_0x1b9c4b)[_0x3fdb('0x25')](_0x24278c);};}exports[_0x3fdb('0x26')]=function(_0x3d6fbe,_0x37f3d7){var _0x442dbc={'raw':!![],'where':{'id':_0x3d6fbe['params']['id']}},_0x29be8e={};_0x29be8e['model']=_[_0x3fdb('0x27')](db[_0x3fdb('0x28')][_0x3fdb('0x29')]);_0x29be8e[_0x3fdb('0x2a')]=_[_0x3fdb('0x27')](_0x3d6fbe[_0x3fdb('0x2a')]);_0x29be8e[_0x3fdb('0x2b')]=_[_0x3fdb('0x2c')](_0x29be8e['model'],_0x29be8e[_0x3fdb('0x2a')]);_0x442dbc[_0x3fdb('0x2d')]=_[_0x3fdb('0x2c')](_0x29be8e[_0x3fdb('0x2e')],qs[_0x3fdb('0x2f')](_0x3d6fbe[_0x3fdb('0x2a')][_0x3fdb('0x2f')]));_0x442dbc[_0x3fdb('0x2d')]=_0x442dbc[_0x3fdb('0x2d')][_0x3fdb('0x30')]?_0x442dbc[_0x3fdb('0x2d')]:_0x29be8e[_0x3fdb('0x2e')];if(_0x3d6fbe[_0x3fdb('0x2a')]['includeAll']){_0x442dbc['include']=[{'all':!![]}];}_0x442dbc=_[_0x3fdb('0x31')]({},_0x442dbc,_0x3d6fbe[_0x3fdb('0x32')]);return db[_0x3fdb('0x28')][_0x3fdb('0x33')](_0x442dbc)[_0x3fdb('0x21')](handleEntityNotFound(_0x37f3d7,null))[_0x3fdb('0x21')](respondWithResult(_0x37f3d7,null))[_0x3fdb('0x34')](handleError(_0x37f3d7,null));};exports[_0x3fdb('0x35')]=function(_0xba3e2,_0x530b2a){return db[_0x3fdb('0x28')]['create'](_0xba3e2[_0x3fdb('0x36')],{})[_0x3fdb('0x21')](respondWithResult(_0x530b2a,0xc9))[_0x3fdb('0x34')](handleError(_0x530b2a,null));};exports['update']=function(_0x29cdfa,_0x324037){if(_0x29cdfa['body']['id']){delete _0x29cdfa[_0x3fdb('0x36')]['id'];}return db[_0x3fdb('0x28')][_0x3fdb('0x33')]({'where':{'id':_0x29cdfa[_0x3fdb('0x37')]['id']}})['then'](handleEntityNotFound(_0x324037,null))[_0x3fdb('0x21')](saveUpdates(_0x29cdfa[_0x3fdb('0x36')],null))['then'](respondWithResult(_0x324037,null))[_0x3fdb('0x34')](handleError(_0x324037,null));};exports[_0x3fdb('0x22')]=function(_0x23e574,_0x183db1){return db[_0x3fdb('0x28')][_0x3fdb('0x33')]({'where':{'id':_0x23e574['params']['id']}})[_0x3fdb('0x21')](handleEntityNotFound(_0x183db1,null))['then'](removeEntity(_0x183db1,null))[_0x3fdb('0x34')](handleError(_0x183db1,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index ba9edea..2d03d58 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 _0x34f3=['chat_proactive_actions','lodash','api','bluebird','request-promise','path','../../config/environment','exports','define','ChatProactiveAction'];(function(_0x407ecd,_0x3b833a){var _0xf9bbbf=function(_0x215021){while(--_0x215021){_0x407ecd['push'](_0x407ecd['shift']());}};_0xf9bbbf(++_0x3b833a);}(_0x34f3,0x169));var _0x334f=function(_0x3e25ff,_0x42309d){_0x3e25ff=_0x3e25ff-0x0;var _0x397545=_0x34f3[_0x3e25ff];return _0x397545;};'use strict';var _=require(_0x334f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x334f('0x1'));var moment=require('moment');var BPromise=require(_0x334f('0x2'));var rp=require(_0x334f('0x3'));var fs=require('fs');var path=require(_0x334f('0x4'));var rimraf=require('rimraf');var config=require(_0x334f('0x5'));var attributes=require('./chatProactiveAction.attributes');module[_0x334f('0x6')]=function(_0x3c89f9,_0x17fe03){return _0x3c89f9[_0x334f('0x7')](_0x334f('0x8'),attributes,{'tableName':_0x334f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa15=['./chatProactiveAction.attributes','define','ChatProactiveAction','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4f48b2,_0x39af74){var _0x58f40f=function(_0x2d6934){while(--_0x2d6934){_0x4f48b2['push'](_0x4f48b2['shift']());}};_0x58f40f(++_0x39af74);}(_0xaa15,0x107));var _0x5aa1=function(_0x14a72c,_0x3484f0){_0x14a72c=_0x14a72c-0x0;var _0x5de299=_0xaa15[_0x14a72c];return _0x5de299;};'use strict';var _=require(_0x5aa1('0x0'));var util=require('util');var logger=require(_0x5aa1('0x1'))('api');var moment=require(_0x5aa1('0x2'));var BPromise=require(_0x5aa1('0x3'));var rp=require(_0x5aa1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5aa1('0x5'));var config=require(_0x5aa1('0x6'));var attributes=require(_0x5aa1('0x7'));module['exports']=function(_0x2edb8a,_0x2a88d3){return _0x2edb8a[_0x5aa1('0x8')](_0x5aa1('0x9'),attributes,{'tableName':'chat_proactive_actions','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 f915857..6603c6d 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 _0x00cf=['client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x16b396,_0x5dea08){var _0xff7f77=function(_0x3c9682){while(--_0x3c9682){_0x16b396['push'](_0x16b396['shift']());}};_0xff7f77(++_0x5dea08);}(_0x00cf,0xd3));var _0xf00c=function(_0x4e7307,_0x359bb4){_0x4e7307=_0x4e7307-0x0;var _0x44b9d7=_0x00cf[_0x4e7307];return _0x44b9d7;};'use strict';var _=require(_0xf00c('0x0'));var util=require(_0xf00c('0x1'));var moment=require(_0xf00c('0x2'));var BPromise=require(_0xf00c('0x3'));var rs=require(_0xf00c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf00c('0x5'));var logger=require(_0xf00c('0x6'))(_0xf00c('0x7'));var config=require('../../config/environment');var jayson=require(_0xf00c('0x8'));var client=jayson[_0xf00c('0x9')][_0xf00c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xce9b20,_0x3614f6,_0x50d9c8){return new BPromise(function(_0x279df2,_0x13c073){return client['request'](_0xce9b20,_0x50d9c8)[_0xf00c('0xb')](function(_0x1d3278){logger[_0xf00c('0xc')](_0xf00c('0xd'),_0x3614f6,_0xf00c('0xe'));logger[_0xf00c('0xf')](_0xf00c('0x10'),_0x3614f6,_0xf00c('0xe'),JSON['stringify'](_0x1d3278));if(_0x1d3278[_0xf00c('0x11')]){if(_0x1d3278[_0xf00c('0x11')][_0xf00c('0x12')]===0x1f4){logger['error'](_0xf00c('0xd'),_0x3614f6,_0x1d3278['error'][_0xf00c('0x13')]);return _0x13c073(_0x1d3278[_0xf00c('0x11')][_0xf00c('0x13')]);}logger[_0xf00c('0x11')](_0xf00c('0xd'),_0x3614f6,_0x1d3278['error'][_0xf00c('0x13')]);return _0x279df2(_0x1d3278[_0xf00c('0x11')][_0xf00c('0x13')]);}else{logger[_0xf00c('0xc')](_0xf00c('0xd'),_0x3614f6,_0xf00c('0xe'));_0x279df2(_0x1d3278[_0xf00c('0x14')][_0xf00c('0x13')]);}})[_0xf00c('0x15')](function(_0x3372b0){logger[_0xf00c('0x11')](_0xf00c('0xd'),_0x3614f6,_0x3372b0);_0x13c073(_0x3372b0);});});} \ No newline at end of file +var _0x8972=['../../config/logger','rpc','../../config/environment','jayson/promise','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x533ef3,_0x42fc7c){var _0x25ceac=function(_0x462932){while(--_0x462932){_0x533ef3['push'](_0x533ef3['shift']());}};_0x25ceac(++_0x42fc7c);}(_0x8972,0x1aa));var _0x2897=function(_0x4ea5eb,_0x31360f){_0x4ea5eb=_0x4ea5eb-0x0;var _0xaf3912=_0x8972[_0x4ea5eb];return _0xaf3912;};'use strict';var _=require(_0x2897('0x0'));var util=require(_0x2897('0x1'));var moment=require(_0x2897('0x2'));var BPromise=require(_0x2897('0x3'));var rs=require(_0x2897('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2897('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2897('0x6'))(_0x2897('0x7'));var config=require(_0x2897('0x8'));var jayson=require(_0x2897('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x560c6e,_0x58058a,_0x522254){return new BPromise(function(_0x26190d,_0x2e847c){return client['request'](_0x560c6e,_0x522254)['then'](function(_0x56fd9e){logger[_0x2897('0xa')](_0x2897('0xb'),_0x58058a,_0x2897('0xc'));logger[_0x2897('0xd')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x58058a,_0x2897('0xc'),JSON[_0x2897('0xe')](_0x56fd9e));if(_0x56fd9e[_0x2897('0xf')]){if(_0x56fd9e['error']['code']===0x1f4){logger[_0x2897('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x58058a,_0x56fd9e[_0x2897('0xf')]['message']);return _0x2e847c(_0x56fd9e[_0x2897('0xf')][_0x2897('0x10')]);}logger['error'](_0x2897('0xb'),_0x58058a,_0x56fd9e[_0x2897('0xf')][_0x2897('0x10')]);return _0x26190d(_0x56fd9e[_0x2897('0xf')][_0x2897('0x10')]);}else{logger[_0x2897('0xa')](_0x2897('0xb'),_0x58058a,_0x2897('0xc'));_0x26190d(_0x56fd9e['result'][_0x2897('0x10')]);}})[_0x2897('0x11')](function(_0x1a34da){logger[_0x2897('0xf')](_0x2897('0xb'),_0x58058a,_0x1a34da);_0x2e847c(_0x1a34da);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 9582649..937900c 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 _0xeda8=['get','/:id','isAuthenticated','show','create','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller'];(function(_0x1531d5,_0x1cfc23){var _0x124680=function(_0xc27d57){while(--_0xc27d57){_0x1531d5['push'](_0x1531d5['shift']());}};_0x124680(++_0x1cfc23);}(_0xeda8,0x104));var _0x8eda=function(_0x49dc19,_0x50f73f){_0x49dc19=_0x49dc19-0x0;var _0x4f05de=_0xeda8[_0x49dc19];return _0x4f05de;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var fs_extra=require(_0x8eda('0x5'));var auth=require(_0x8eda('0x6'));var interaction=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var controller=require(_0x8eda('0x9'));router[_0x8eda('0xa')](_0x8eda('0xb'),auth[_0x8eda('0xc')](),controller[_0x8eda('0xd')]);router['post']('/',auth[_0x8eda('0xc')](),controller[_0x8eda('0xe')]);router[_0x8eda('0xf')](_0x8eda('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x8eda('0xc')](),controller[_0x8eda('0x10')]);module[_0x8eda('0x11')]=router; \ No newline at end of file +var _0x6aa7=['/:id','show','post','isAuthenticated','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x9c4ce,_0x26dfad){var _0x550c42=function(_0x2f2bf5){while(--_0x2f2bf5){_0x9c4ce['push'](_0x9c4ce['shift']());}};_0x550c42(++_0x26dfad);}(_0x6aa7,0x178));var _0x76aa=function(_0x36a20d,_0x12281c){_0x36a20d=_0x36a20d-0x0;var _0x288a39=_0x6aa7[_0x36a20d];return _0x288a39;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./chatProactiveAction.controller');router['get'](_0x76aa('0x8'),auth['isAuthenticated'](),controller[_0x76aa('0x9')]);router[_0x76aa('0xa')]('/',auth[_0x76aa('0xb')](),controller['create']);router[_0x76aa('0xc')](_0x76aa('0x8'),auth[_0x76aa('0xb')](),controller['update']);router[_0x76aa('0xd')](_0x76aa('0x8'),auth[_0x76aa('0xb')](),controller[_0x76aa('0xe')]);module[_0x76aa('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 29becbb..e83f1ec 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 _0x5234=['beepall','sequelize','STRING','name','ENUM','rrmemory'];(function(_0x22dfb9,_0x2e231c){var _0x51cbb1=function(_0x7dac5a){while(--_0x7dac5a){_0x22dfb9['push'](_0x22dfb9['shift']());}};_0x51cbb1(++_0x2e231c);}(_0x5234,0x1cf));var _0x4523=function(_0x3ffe8a,_0x57de78){_0x3ffe8a=_0x3ffe8a-0x0;var _0x3ae039=_0x5234[_0x3ffe8a];return _0x3ae039;};'use strict';var Sequelize=require(_0x4523('0x0'));module['exports']={'name':{'type':Sequelize[_0x4523('0x1')],'unique':_0x4523('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4523('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4523('0x3')](_0x4523('0x4'),_0x4523('0x5'),'roundrobin')}}; \ No newline at end of file +var _0xcb7a=['INTEGER','rrmemory','exports','STRING','name'];(function(_0x3420e5,_0x67fec0){var _0x1e9141=function(_0x4babb2){while(--_0x4babb2){_0x3420e5['push'](_0x3420e5['shift']());}};_0x1e9141(++_0x67fec0);}(_0xcb7a,0xf2));var _0xacb7=function(_0x588fad,_0x424bb7){_0x588fad=_0x588fad-0x0;var _0x2ef8a8=_0xcb7a[_0x588fad];return _0x2ef8a8;};'use strict';var Sequelize=require('sequelize');module[_0xacb7('0x0')]={'name':{'type':Sequelize[_0xacb7('0x1')],'unique':_0xacb7('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xacb7('0x1')]},'timeout':{'type':Sequelize[_0xacb7('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xacb7('0x4'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 8691b40..4b6aa3f 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 _0x133c=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','order','sort','where','pick','ChatQueueId','merge','filter','findAll','findAndCountAll','chatPause','createdAt','format','%s/%s','getTeams','Team','nolimit','addTeams','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','ids','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','QueryTypes','SELECT','every','all','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','getAgents','bluebird','util','lodash','squel','ioredis','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','json','undefined','limit','count','offset','set','update','destroy','get','ChatQueues','UserProfileResource','then','sendStatus','stack','name','send','index','map','ChatQueue','fieldName','type','getOptions','include','rows','catch','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','options','find','create','body','user'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x133c,0x130));var _0xc133=function(_0x3778f4,_0x194462){_0x3778f4=_0x3778f4-0x0;var _0x5623df=_0x133c[_0x3778f4];return _0x5623df;};'use strict';var BPromise=require(_0xc133('0x0'));var util=require(_0xc133('0x1'));var _=require(_0xc133('0x2'));var squel=require(_0xc133('0x3'));var Redis=require(_0xc133('0x4'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xc133('0x5'));var config=require(_0xc133('0x6'));var db=require(_0xc133('0x7'))['db'];config[_0xc133('0x8')]=_['defaults'](config['redis'],{'host':_0xc133('0x9'),'port':0x18eb});var socket=require(_0xc133('0xa'))(new Redis(config[_0xc133('0x8')]));require('./chatQueue.socket')[_0xc133('0xb')](socket);function respondWithStatusCode(_0x117354,_0x49b56d){_0x49b56d=_0x49b56d||0xcc;return function(_0x1d4be8){if(_0x1d4be8){return _0x117354['sendStatus'](_0x49b56d);}return _0x117354[_0xc133('0xc')](_0x49b56d)[_0xc133('0xd')]();};}function respondWithResult(_0x2b20da,_0xbaf26d){_0xbaf26d=_0xbaf26d||0xc8;return function(_0x1a8214){if(_0x1a8214){return _0x2b20da[_0xc133('0xc')](_0xbaf26d)[_0xc133('0xe')](_0x1a8214);}};}function respondWithFilteredResult(_0xf8b6d9,_0x58fb4c){return function(_0x365a85){if(_0x365a85){var _0x639799=typeof _0x58fb4c['offset']===_0xc133('0xf')&&typeof _0x58fb4c[_0xc133('0x10')]==='undefined';var _0x436da0=_0x365a85[_0xc133('0x11')];var _0x48d5c2=_0x639799?0x0:_0x58fb4c[_0xc133('0x12')];var _0x465983=_0x639799?_0x365a85[_0xc133('0x11')]:_0x58fb4c['offset']+_0x58fb4c[_0xc133('0x10')];var _0x1d537a;if(_0x465983>=_0x436da0){_0x465983=_0x436da0;_0x1d537a=0xc8;}else{_0x1d537a=0xce;}_0xf8b6d9['status'](_0x1d537a);return _0xf8b6d9[_0xc133('0x13')]('Content-Range',_0x48d5c2+'-'+_0x465983+'/'+_0x436da0)[_0xc133('0xe')](_0x365a85);}return null;};}function saveUpdates(_0xa2d04b){return function(_0x2ac783){if(_0x2ac783){return _0x2ac783[_0xc133('0x14')](_0xa2d04b)['then'](function(_0x13fe6c){return _0x13fe6c;});}return null;};}function removeEntity(_0x11e91b){return function(_0x4e3c68){if(_0x4e3c68){return _0x4e3c68[_0xc133('0x15')]()['then'](function(){var _0x5bc11f=_0x4e3c68[_0xc133('0x16')]({'plain':!![]});var _0x3c5c77=_0xc133('0x17');return db[_0xc133('0x18')]['destroy']({'where':{'type':_0x3c5c77,'resourceId':_0x5bc11f['id']}})[_0xc133('0x19')](function(){return _0x4e3c68;});})[_0xc133('0x19')](function(){_0x11e91b[_0xc133('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ccba9){return function(_0x3949ca){if(!_0x3949ca){_0x3ccba9[_0xc133('0x1a')](0x194);}return _0x3949ca;};}function handleError(_0x2f52ae,_0x1bf182){_0x1bf182=_0x1bf182||0x1f4;return function(_0x4d8786){logger['error'](_0x4d8786[_0xc133('0x1b')]);if(_0x4d8786[_0xc133('0x1c')]){delete _0x4d8786['name'];}_0x2f52ae[_0xc133('0xc')](_0x1bf182)[_0xc133('0x1d')](_0x4d8786);};}exports[_0xc133('0x1e')]=function(_0x31a9b7,_0x4cd406){var _0x4bfe44={};var _0x3808f7={'count':0x0,'rows':[]};var _0x249009=_[_0xc133('0x1f')](db[_0xc133('0x20')]['rawAttributes'],function(_0x4d87d2){return{'name':_0x4d87d2[_0xc133('0x21')],'type':_0x4d87d2[_0xc133('0x22')]['key']};});_0x4bfe44=qs[_0xc133('0x23')](_0x249009,_0x31a9b7);var _0x2b2543={'where':_0x4bfe44['where']};return db[_0xc133('0x20')][_0xc133('0x11')](_0x2b2543)['then'](function(_0x2386a1){_0x3808f7[_0xc133('0x11')]=_0x2386a1;_0x4bfe44['include']=qs[_0xc133('0x24')](_0x31a9b7['query']);return db[_0xc133('0x20')]['findAll'](_0x4bfe44);})[_0xc133('0x19')](function(_0x115722){_0x3808f7[_0xc133('0x25')]=_0x115722;return _0x3808f7;})[_0xc133('0x19')](respondWithFilteredResult(_0x4cd406,_0x4bfe44))[_0xc133('0x26')](handleError(_0x4cd406,null));};exports[_0xc133('0x27')]=function(_0x305551,_0x4ab1b3){var _0x2017fe={'raw':!![],'where':{'id':_0x305551[_0xc133('0x28')]['id']}},_0x43ecd4={};_0x43ecd4[_0xc133('0x29')]=_[_0xc133('0x2a')](db[_0xc133('0x20')][_0xc133('0x2b')]);_0x43ecd4[_0xc133('0x2c')]=_[_0xc133('0x2a')](_0x305551[_0xc133('0x2c')]);_0x43ecd4[_0xc133('0x2d')]=_[_0xc133('0x2e')](_0x43ecd4[_0xc133('0x29')],_0x43ecd4['query']);_0x2017fe[_0xc133('0x2f')]=_[_0xc133('0x2e')](_0x43ecd4['model'],qs[_0xc133('0x30')](_0x305551['query'][_0xc133('0x30')]));_0x2017fe[_0xc133('0x2f')]=_0x2017fe[_0xc133('0x2f')][_0xc133('0x31')]?_0x2017fe['attributes']:_0x43ecd4['model'];if(_0x305551[_0xc133('0x2c')][_0xc133('0x32')]){_0x2017fe[_0xc133('0x24')]=[{'all':!![]}];}_0x2017fe=_['merge']({},_0x2017fe,_0x305551[_0xc133('0x33')]);return db[_0xc133('0x20')][_0xc133('0x34')](_0x2017fe)[_0xc133('0x19')](handleEntityNotFound(_0x4ab1b3,null))[_0xc133('0x19')](respondWithResult(_0x4ab1b3,null))[_0xc133('0x26')](handleError(_0x4ab1b3,null));};exports['create']=function(_0x4e63b2,_0x1288f3){return db[_0xc133('0x20')][_0xc133('0x35')](_0x4e63b2[_0xc133('0x36')],{})[_0xc133('0x19')](function(_0x402802){var _0x47ad47=_0x4e63b2[_0xc133('0x37')]['get']({'plain':!![]});if(!_0x47ad47)throw new Error(_0xc133('0x38'));if(_0x47ad47[_0xc133('0x39')]==='user'){var _0x3e4c9d=_0x402802[_0xc133('0x16')]({'plain':!![]});var _0xc425c7=_0xc133('0x17');return db['UserProfileSection'][_0xc133('0x34')]({'where':{'name':_0xc425c7,'userProfileId':_0x47ad47['userProfileId']},'raw':!![]})['then'](function(_0x154bd6){if(_0x154bd6&&_0x154bd6[_0xc133('0x3a')]===0x0){return db[_0xc133('0x18')][_0xc133('0x35')]({'name':_0x3e4c9d[_0xc133('0x1c')],'resourceId':_0x3e4c9d['id'],'type':_0x154bd6[_0xc133('0x1c')],'sectionId':_0x154bd6['id']},{})['then'](function(){return _0x402802;});}else{return _0x402802;}})['catch'](function(_0x4f81a6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f81a6);throw _0x4f81a6;});}return _0x402802;})[_0xc133('0x19')](respondWithResult(_0x1288f3,0xc9))['catch'](handleError(_0x1288f3,null));};exports['update']=function(_0x29b785,_0x30020e){if(_0x29b785[_0xc133('0x36')]['id']){delete _0x29b785[_0xc133('0x36')]['id'];}return db[_0xc133('0x20')]['find']({'where':{'id':_0x29b785[_0xc133('0x28')]['id']}})[_0xc133('0x19')](handleEntityNotFound(_0x30020e,null))['then'](saveUpdates(_0x29b785[_0xc133('0x36')],null))['then'](respondWithResult(_0x30020e,null))['catch'](handleError(_0x30020e,null));};exports[_0xc133('0x15')]=function(_0x3f0e8e,_0x5d663f){return db[_0xc133('0x20')]['find']({'where':{'id':_0x3f0e8e[_0xc133('0x28')]['id']}})['then'](handleEntityNotFound(_0x5d663f,null))[_0xc133('0x19')](removeEntity(_0x5d663f,null))[_0xc133('0x26')](handleError(_0x5d663f,null));};exports[_0xc133('0x3b')]=function(_0x1b6257,_0x13754b){return db[_0xc133('0x20')]['describe']()['then'](respondWithResult(_0x13754b,null))['catch'](handleError(_0x13754b,null));};exports[_0xc133('0x3c')]=function(_0x3b200a,_0x1e0e2d){var _0x5437e2={'raw':!![],'where':{}},_0x25b64c={},_0x1789c4;return db[_0xc133('0x20')][_0xc133('0x3d')]({'where':{'id':_0x3b200a[_0xc133('0x28')]['id']}})[_0xc133('0x19')](handleEntityNotFound(_0x1e0e2d,null))[_0xc133('0x19')](function(_0x47f59c){if(_0x47f59c){_0x1789c4=_0x47f59c[_0xc133('0x16')]({'plain':!![]});_0x25b64c[_0xc133('0x29')]=_[_0xc133('0x2a')](db[_0xc133('0x3e')][_0xc133('0x2b')]);_0x25b64c[_0xc133('0x2c')]=_[_0xc133('0x2a')](_0x3b200a[_0xc133('0x2c')]);_0x25b64c['filters']=_[_0xc133('0x2e')](_0x25b64c[_0xc133('0x29')],_0x25b64c[_0xc133('0x2c')]);_0x5437e2[_0xc133('0x2f')]=_[_0xc133('0x2e')](_0x25b64c[_0xc133('0x29')],qs[_0xc133('0x30')](_0x3b200a[_0xc133('0x2c')]['fields']));_0x5437e2[_0xc133('0x2f')]=_0x5437e2['attributes']['length']?_0x5437e2[_0xc133('0x2f')]:_0x25b64c[_0xc133('0x29')];if(!_0x3b200a[_0xc133('0x2c')][_0xc133('0x3f')]('nolimit')){_0x5437e2[_0xc133('0x10')]=qs[_0xc133('0x10')](_0x3b200a[_0xc133('0x2c')][_0xc133('0x10')]);_0x5437e2[_0xc133('0x12')]=qs[_0xc133('0x12')](_0x3b200a[_0xc133('0x2c')][_0xc133('0x12')]);}_0x5437e2[_0xc133('0x40')]=qs[_0xc133('0x41')](_0x3b200a[_0xc133('0x2c')][_0xc133('0x41')]);_0x5437e2[_0xc133('0x42')]=qs[_0xc133('0x2d')](_[_0xc133('0x43')](_0x3b200a['query'],_0x25b64c[_0xc133('0x2d')]));_0x5437e2[_0xc133('0x42')][_0xc133('0x44')]=_0x47f59c['id'];if(_0x3b200a[_0xc133('0x2c')]['filter']){_0x5437e2[_0xc133('0x42')]=_[_0xc133('0x45')](_0x5437e2[_0xc133('0x42')],{'$or':_[_0xc133('0x1f')](_0x5437e2[_0xc133('0x2f')],function(_0x4b8b3b){var _0x5749b4={};_0x5749b4[_0x4b8b3b]={'$like':'%'+_0x3b200a[_0xc133('0x2c')][_0xc133('0x46')]+'%'};return _0x5749b4;})});}_0x5437e2=_[_0xc133('0x45')]({},_0x5437e2,_0x3b200a[_0xc133('0x33')]);return db[_0xc133('0x3e')][_0xc133('0x47')](_0x5437e2);}})['then'](function(_0x2bcb54){if(_0x2bcb54){return db['User'][_0xc133('0x48')]({'where':{'id':_[_0xc133('0x1f')](_0x2bcb54,'UserId'),'role':'agent'},'attributes':['id','name',_0xc133('0x49'),'updatedAt',_0xc133('0x4a')]});}})[_0xc133('0x19')](function(_0x18241f){if(_0x18241f){return{'count':_0x18241f[_0xc133('0x11')],'rows':_[_0xc133('0x1f')](_0x18241f[_0xc133('0x25')],function(_0x905a42){return{'membername':_0x905a42['name'],'UserId':_0x905a42['id'],'queue_name':_0x1789c4[_0xc133('0x1c')],'ChatQueueId':_0x1789c4['id'],'interface':util[_0xc133('0x4b')](_0xc133('0x4c'),'SIP',_0x905a42[_0xc133('0x1c')]),'penalty':0x0,'paused':_0x905a42[_0xc133('0x49')],'createdAt':_0x905a42['createdAt'],'updatedAt':_0x905a42['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xc133('0x19')](respondWithFilteredResult(_0x1e0e2d,_0x5437e2))[_0xc133('0x26')](handleError(_0x1e0e2d,null));};exports[_0xc133('0x4d')]=function(_0x5107bc,_0x5a11e5){var _0x22b9ed={};var _0x49f9c4={};var _0x419b84;var _0x524142;return db[_0xc133('0x20')][_0xc133('0x3d')]({'where':{'id':_0x5107bc[_0xc133('0x28')]['id']}})['then'](handleEntityNotFound(_0x5a11e5,null))[_0xc133('0x19')](function(_0x38966a){if(_0x38966a){_0x419b84=_0x38966a;_0x49f9c4[_0xc133('0x29')]=_[_0xc133('0x2a')](db[_0xc133('0x4e')][_0xc133('0x2b')]);_0x49f9c4[_0xc133('0x2c')]=_['keys'](_0x5107bc['query']);_0x49f9c4[_0xc133('0x2d')]=_['intersection'](_0x49f9c4[_0xc133('0x29')],_0x49f9c4[_0xc133('0x2c')]);_0x22b9ed['attributes']=_[_0xc133('0x2e')](_0x49f9c4[_0xc133('0x29')],qs[_0xc133('0x30')](_0x5107bc[_0xc133('0x2c')][_0xc133('0x30')]));_0x22b9ed[_0xc133('0x2f')]=_0x22b9ed[_0xc133('0x2f')][_0xc133('0x31')]?_0x22b9ed[_0xc133('0x2f')]:_0x49f9c4[_0xc133('0x29')];_0x22b9ed[_0xc133('0x40')]=qs[_0xc133('0x41')](_0x5107bc[_0xc133('0x2c')][_0xc133('0x41')]);_0x22b9ed[_0xc133('0x42')]=qs['filters'](_[_0xc133('0x43')](_0x5107bc['query'],_0x49f9c4[_0xc133('0x2d')]));if(_0x5107bc[_0xc133('0x2c')][_0xc133('0x46')]){_0x22b9ed[_0xc133('0x42')]=_['merge'](_0x22b9ed[_0xc133('0x42')],{'$or':_[_0xc133('0x1f')](_0x22b9ed[_0xc133('0x2f')],function(_0x47588c){var _0x5f0681={};_0x5f0681[_0x47588c]={'$like':'%'+_0x5107bc[_0xc133('0x2c')]['filter']+'%'};return _0x5f0681;})});}_0x22b9ed=_[_0xc133('0x45')]({},_0x22b9ed,_0x5107bc[_0xc133('0x33')]);return _0x419b84[_0xc133('0x4d')](_0x22b9ed);}})[_0xc133('0x19')](function(_0x16d287){if(_0x16d287){_0x524142=_0x16d287[_0xc133('0x31')];if(!_0x5107bc[_0xc133('0x2c')][_0xc133('0x3f')](_0xc133('0x4f'))){_0x22b9ed['limit']=qs[_0xc133('0x10')](_0x5107bc[_0xc133('0x2c')][_0xc133('0x10')]);_0x22b9ed[_0xc133('0x12')]=qs[_0xc133('0x12')](_0x5107bc['query'][_0xc133('0x12')]);}return _0x419b84['getTeams'](_0x22b9ed);}})[_0xc133('0x19')](function(_0x4ef948){if(_0x4ef948){return _0x4ef948?{'count':_0x524142,'rows':_0x4ef948}:null;}})[_0xc133('0x19')](respondWithResult(_0x5a11e5,null))[_0xc133('0x26')](handleError(_0x5a11e5,null));};exports[_0xc133('0x50')]=function(_0x5144ef,_0x645759){var _0x414cd5=_0x5144ef[_0xc133('0x36')]['ids'];return db[_0xc133('0x4e')][_0xc133('0x47')]({'where':{'id':_0x414cd5},'attributes':['id'],'include':[{'model':db[_0xc133('0x51')],'as':_0xc133('0x52'),'attributes':['id',_0xc133('0x1c'),_0xc133('0x53'),_0xc133('0x54'),_0xc133('0x55')],'raw':!![]}]})[_0xc133('0x19')](function(_0x27e672){if(_0x27e672){var _0x4e485e=_[_0xc133('0x56')](_0x27e672,function(_0x14f3c4){var _0x31760b=_0x14f3c4[_0xc133('0x16')]({'plain':!![]});return _0x31760b[_0xc133('0x52')];});return db[_0xc133('0x20')][_0xc133('0x34')]({'where':{'id':_0x5144ef[_0xc133('0x28')]['id']}})['then'](function(_0x8e9b4a){return db[_0xc133('0x57')][_0xc133('0x58')](function(_0x49be0f){return _0x8e9b4a[_0xc133('0x50')](_0x414cd5,{'transaction':_0x49be0f})['then'](function(){return BPromise[_0xc133('0x59')](_0x4e485e,function(_0x3845b6){return db[_0xc133('0x3e')][_0xc133('0x5a')]({'where':{'UserId':_0x3845b6['id'],'ChatQueueId':_0x5144ef[_0xc133('0x28')]['id']},'transaction':_0x49be0f});});})[_0xc133('0x19')](function(){_0x4e485e[_0xc133('0x5b')](function(_0x176723){socket[_0xc133('0x5c')](_0xc133('0x5d'),{'UserId':_0x176723['id'],'ChatQueueId':_0x8e9b4a['id']});});});});});}})['then'](respondWithStatusCode(_0x645759,null))[_0xc133('0x26')](handleError(_0x645759,null));};exports[_0xc133('0x5e')]=function(_0x21c025,_0x322cf5){return db[_0xc133('0x4e')]['findAll']({'where':{'id':_0x21c025['query'][_0xc133('0x5f')]},'attributes':['id'],'include':[{'model':db[_0xc133('0x51')],'as':_0xc133('0x52'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x322cf5,null))[_0xc133('0x19')](function(_0x174ebf){var _0x31de45=_['map'](_0x174ebf,'id');var _0xba4fa9=[];var _0x4a07e4=[];var _0xa5af46=squel[_0xc133('0x60')]();_0xa5af46[_0xc133('0x61')](_0xc133('0x62'))[_0xc133('0x63')](_0xc133('0x64'),'tq')['join'](_0xc133('0x65'),'ut',_0xc133('0x66'))[_0xc133('0x42')](_0xc133('0x67'),_0x21c025[_0xc133('0x28')]['id']);for(var _0x52d9e9=0x0;_0x52d9e9<_0x174ebf[_0xc133('0x31')];_0x52d9e9+=0x1){let _0x24f988=_0x174ebf[_0x52d9e9];for(var _0x322275=0x0;_0x322275<_0x24f988['Agents']['length'];_0x322275+=0x1){let _0x1ed432=_0x24f988[_0xc133('0x52')][_0x322275];var _0x1d8ed6=_0xa5af46[_0xc133('0x68')]();_0x1d8ed6[_0xc133('0x42')](_0xc133('0x69'),_0x1ed432['id']);_0x4a07e4[_0xc133('0x6a')](db[_0xc133('0x57')][_0xc133('0x2c')](_0x1d8ed6['toString'](),{'type':db['sequelize'][_0xc133('0x6b')][_0xc133('0x6c')]})[_0xc133('0x19')](function(_0x2ab6f9){if(_0x2ab6f9[_0xc133('0x31')]===0x1){return _0x1ed432['id'];}else{var _0x2a5981=_[_0xc133('0x6d')](_[_0xc133('0x1f')](_0x2ab6f9,'TeamId'),function(_0x187a75){return _['includes'](_0x31de45,_0x187a75);});if(_0x2a5981){return _0x1ed432['id'];}}}));}}return BPromise[_0xc133('0x6e')](_0x4a07e4)[_0xc133('0x19')](function(_0x4ed619){_0xba4fa9=_(_0xba4fa9)[_0xc133('0x6f')](_0x4ed619)[_0xc133('0x70')]()[_0xc133('0x71')]();return db[_0xc133('0x20')][_0xc133('0x34')]({'where':{'id':_0x21c025[_0xc133('0x28')]['id']}})[_0xc133('0x19')](function(_0x53a27e){return db['sequelize'][_0xc133('0x58')](function(_0x2d0418){return _0x53a27e[_0xc133('0x5e')](_0x21c025['query'][_0xc133('0x5f')],{'transaction':_0x2d0418})[_0xc133('0x19')](function(){if(!_[_0xc133('0x72')](_0xba4fa9)){return _0x53a27e[_0xc133('0x73')](_0xba4fa9,{'transaction':_0x2d0418});}})[_0xc133('0x19')](function(){_0xba4fa9[_0xc133('0x5b')](function(_0xb6e213){socket[_0xc133('0x5c')](_0xc133('0x74'),{'UserId':_0xb6e213,'ChatQueueId':_0x53a27e['id']});});});});});});})[_0xc133('0x19')](respondWithStatusCode(_0x322cf5,null))[_0xc133('0x26')](handleError(_0x322cf5,null));};exports[_0xc133('0x75')]=function(_0x4d2d78,_0x3a1fb1){return db['ChatQueue'][_0xc133('0x34')]({'where':{'id':_0x4d2d78[_0xc133('0x28')]['id']}})['then'](handleEntityNotFound(_0x3a1fb1,null))[_0xc133('0x19')](function(_0x340522){if(_0x340522){return _0x340522['addAgents'](_0x4d2d78[_0xc133('0x36')]['ids'],_[_0xc133('0x76')](_0x4d2d78['body'],[_0xc133('0x5f'),'id'])||{})['spread'](function(_0x3b6f25){for(var _0x192f93=0x0;_0x192f93<_0x4d2d78[_0xc133('0x36')][_0xc133('0x5f')][_0xc133('0x31')];_0x192f93+=0x1){socket['emit'](_0xc133('0x5d'),{'UserId':Number(_0x4d2d78['body'][_0xc133('0x5f')][_0x192f93]),'ChatQueueId':Number(_0x4d2d78[_0xc133('0x28')]['id'])});}return _0x3b6f25;});}})[_0xc133('0x19')](respondWithResult(_0x3a1fb1,null))[_0xc133('0x26')](handleError(_0x3a1fb1,null));};exports[_0xc133('0x73')]=function(_0xca2572,_0x55abdb){return db[_0xc133('0x20')]['find']({'where':{'id':_0xca2572[_0xc133('0x28')]['id']}})[_0xc133('0x19')](handleEntityNotFound(_0x55abdb,null))[_0xc133('0x19')](function(_0xf57a16){if(_0xf57a16){return _0xf57a16[_0xc133('0x73')](_0xca2572['query'][_0xc133('0x5f')])[_0xc133('0x19')](function(){if(_['isArray'](_0xca2572[_0xc133('0x2c')]['ids'])){for(var _0x12ba59=0x0;_0x12ba59<_0xca2572['query'][_0xc133('0x5f')][_0xc133('0x31')];_0x12ba59+=0x1){socket[_0xc133('0x5c')](_0xc133('0x74'),{'UserId':Number(_0xca2572[_0xc133('0x2c')][_0xc133('0x5f')][_0x12ba59]),'ChatQueueId':Number(_0xca2572[_0xc133('0x28')]['id'])});}}else{socket[_0xc133('0x5c')](_0xc133('0x74'),{'UserId':Number(_0xca2572[_0xc133('0x2c')][_0xc133('0x5f')]),'ChatQueueId':Number(_0xca2572['params']['id'])});}});}})[_0xc133('0x19')](respondWithStatusCode(_0x55abdb,null))[_0xc133('0x26')](handleError(_0x55abdb,null));};exports['getAgents']=function(_0x169e33,_0x3bdf52){var _0x4dc4fd={};var _0x5e98ca={};var _0x47dc0d;var _0x35f865;return db[_0xc133('0x20')]['findOne']({'where':{'id':_0x169e33[_0xc133('0x28')]['id']}})[_0xc133('0x19')](handleEntityNotFound(_0x3bdf52,null))['then'](function(_0x9da301){if(_0x9da301){_0x47dc0d=_0x9da301;_0x5e98ca[_0xc133('0x29')]=_[_0xc133('0x2a')](db[_0xc133('0x51')][_0xc133('0x2b')]);_0x5e98ca[_0xc133('0x2c')]=_[_0xc133('0x2a')](_0x169e33[_0xc133('0x2c')]);_0x5e98ca[_0xc133('0x2d')]=_['intersection'](_0x5e98ca[_0xc133('0x29')],_0x5e98ca[_0xc133('0x2c')]);_0x4dc4fd[_0xc133('0x2f')]=_[_0xc133('0x2e')](_0x5e98ca[_0xc133('0x29')],qs[_0xc133('0x30')](_0x169e33[_0xc133('0x2c')][_0xc133('0x30')]));_0x4dc4fd[_0xc133('0x2f')]=_0x4dc4fd[_0xc133('0x2f')]['length']?_0x4dc4fd['attributes']:_0x5e98ca[_0xc133('0x29')];_0x4dc4fd[_0xc133('0x40')]=qs[_0xc133('0x41')](_0x169e33[_0xc133('0x2c')]['sort']);_0x4dc4fd[_0xc133('0x42')]=qs[_0xc133('0x2d')](_[_0xc133('0x43')](_0x169e33[_0xc133('0x2c')],_0x5e98ca[_0xc133('0x2d')]));if(_0x169e33[_0xc133('0x2c')]['filter']){_0x4dc4fd['where']=_[_0xc133('0x45')](_0x4dc4fd[_0xc133('0x42')],{'$or':_['map'](_0x4dc4fd[_0xc133('0x2f')],function(_0x310431){var _0x2a1d4c={};_0x2a1d4c[_0x310431]={'$like':'%'+_0x169e33[_0xc133('0x2c')][_0xc133('0x46')]+'%'};return _0x2a1d4c;})});}_0x4dc4fd=_[_0xc133('0x45')]({},_0x4dc4fd,_0x169e33[_0xc133('0x33')]);return _0x47dc0d[_0xc133('0x77')](_0x4dc4fd);}})[_0xc133('0x19')](function(_0x40d4b9){if(_0x40d4b9){_0x35f865=_0x40d4b9[_0xc133('0x31')];if(!_0x169e33['query'][_0xc133('0x3f')](_0xc133('0x4f'))){_0x4dc4fd[_0xc133('0x10')]=qs[_0xc133('0x10')](_0x169e33[_0xc133('0x2c')][_0xc133('0x10')]);_0x4dc4fd[_0xc133('0x12')]=qs[_0xc133('0x12')](_0x169e33[_0xc133('0x2c')][_0xc133('0x12')]);}return _0x47dc0d[_0xc133('0x77')](_0x4dc4fd);}})['then'](function(_0x2676b8){if(_0x2676b8){return _0x2676b8?{'count':_0x35f865,'rows':_0x2676b8}:null;}})[_0xc133('0x19')](respondWithResult(_0x3bdf52,null))['catch'](handleError(_0x3bdf52,null));}; \ No newline at end of file +var _0x6b3a=['push','sequelize','toString','QueryTypes','SELECT','every','includes','all','isEmpty','addAgents','omit','userChatQueue:save','removeAgents','userChatQueue:remove','order','getAgents','hasOwnProperty','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','destroy','ChatQueues','UserProfileResource','then','send','index','ChatQueue','rawAttributes','fieldName','type','getOptions','include','query','findAll','rows','model','keys','filters','attributes','intersection','fields','length','includeAll','merge','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','autoAssociation','name','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','getMembers','nolimit','sort','where','pick','ChatQueueId','filter','map','UserChatQueue','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','getTeams','findOne','Team','addTeams','ids','online','voicePause','flatMap','transaction','each','findOrCreate','forEach','emit','removeTeams','Agents','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?'];(function(_0xd6a1c9,_0x203324){var _0x51ea29=function(_0x165a30){while(--_0x165a30){_0xd6a1c9['push'](_0xd6a1c9['shift']());}};_0x51ea29(++_0x203324);}(_0x6b3a,0x17c));var _0xa6b3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b3a[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xa6b3('0x0'));var util=require(_0xa6b3('0x1'));var _=require(_0xa6b3('0x2'));var squel=require(_0xa6b3('0x3'));var Redis=require(_0xa6b3('0x4'));var qs=require(_0xa6b3('0x5'));var logger=require('../../config/logger')(_0xa6b3('0x6'));var config=require(_0xa6b3('0x7'));var db=require(_0xa6b3('0x8'))['db'];config['redis']=_[_0xa6b3('0x9')](config[_0xa6b3('0xa')],{'host':_0xa6b3('0xb'),'port':0x18eb});var socket=require(_0xa6b3('0xc'))(new Redis(config['redis']));require('./chatQueue.socket')[_0xa6b3('0xd')](socket);function respondWithStatusCode(_0x1d1ef8,_0x1d52a9){_0x1d52a9=_0x1d52a9||0xcc;return function(_0x43c67f){if(_0x43c67f){return _0x1d1ef8[_0xa6b3('0xe')](_0x1d52a9);}return _0x1d1ef8[_0xa6b3('0xf')](_0x1d52a9)[_0xa6b3('0x10')]();};}function respondWithResult(_0x4a6d8c,_0x498bd0){_0x498bd0=_0x498bd0||0xc8;return function(_0x1f8821){if(_0x1f8821){return _0x4a6d8c[_0xa6b3('0xf')](_0x498bd0)[_0xa6b3('0x11')](_0x1f8821);}};}function respondWithFilteredResult(_0x312b62,_0x4dd876){return function(_0x10da06){if(_0x10da06){var _0x20f073=typeof _0x4dd876[_0xa6b3('0x12')]==='undefined'&&typeof _0x4dd876[_0xa6b3('0x13')]===_0xa6b3('0x14');var _0x4413d2=_0x10da06[_0xa6b3('0x15')];var _0x1b37d1=_0x20f073?0x0:_0x4dd876['offset'];var _0x4067d9=_0x20f073?_0x10da06[_0xa6b3('0x15')]:_0x4dd876[_0xa6b3('0x12')]+_0x4dd876[_0xa6b3('0x13')];var _0x3efd35;if(_0x4067d9>=_0x4413d2){_0x4067d9=_0x4413d2;_0x3efd35=0xc8;}else{_0x3efd35=0xce;}_0x312b62[_0xa6b3('0xf')](_0x3efd35);return _0x312b62[_0xa6b3('0x16')](_0xa6b3('0x17'),_0x1b37d1+'-'+_0x4067d9+'/'+_0x4413d2)[_0xa6b3('0x11')](_0x10da06);}return null;};}function saveUpdates(_0x105d01){return function(_0x31bcfd){if(_0x31bcfd){return _0x31bcfd['update'](_0x105d01)['then'](function(_0x1f16cf){return _0x1f16cf;});}return null;};}function removeEntity(_0x42b933){return function(_0x42d924){if(_0x42d924){return _0x42d924[_0xa6b3('0x18')]()['then'](function(){var _0x57f680=_0x42d924['get']({'plain':!![]});var _0x3599eb=_0xa6b3('0x19');return db[_0xa6b3('0x1a')][_0xa6b3('0x18')]({'where':{'type':_0x3599eb,'resourceId':_0x57f680['id']}})[_0xa6b3('0x1b')](function(){return _0x42d924;});})[_0xa6b3('0x1b')](function(){_0x42b933[_0xa6b3('0xf')](0xcc)[_0xa6b3('0x10')]();});}};}function handleEntityNotFound(_0x5234b7){return function(_0x4ce018){if(!_0x4ce018){_0x5234b7[_0xa6b3('0xe')](0x194);}return _0x4ce018;};}function handleError(_0x2388eb,_0x22161b){_0x22161b=_0x22161b||0x1f4;return function(_0x158e02){logger['error'](_0x158e02['stack']);if(_0x158e02['name']){delete _0x158e02['name'];}_0x2388eb[_0xa6b3('0xf')](_0x22161b)[_0xa6b3('0x1c')](_0x158e02);};}exports[_0xa6b3('0x1d')]=function(_0x15e88f,_0xaa7f39){var _0x8e4f6c={};var _0x110565={'count':0x0,'rows':[]};var _0x56dfd3=_['map'](db[_0xa6b3('0x1e')][_0xa6b3('0x1f')],function(_0xca6802){return{'name':_0xca6802[_0xa6b3('0x20')],'type':_0xca6802[_0xa6b3('0x21')]['key']};});_0x8e4f6c=qs[_0xa6b3('0x22')](_0x56dfd3,_0x15e88f);var _0x109c28={'where':_0x8e4f6c['where']};return db[_0xa6b3('0x1e')][_0xa6b3('0x15')](_0x109c28)['then'](function(_0x2e4861){_0x110565[_0xa6b3('0x15')]=_0x2e4861;_0x8e4f6c[_0xa6b3('0x23')]=qs[_0xa6b3('0x23')](_0x15e88f[_0xa6b3('0x24')]);return db['ChatQueue'][_0xa6b3('0x25')](_0x8e4f6c);})[_0xa6b3('0x1b')](function(_0x1a8914){_0x110565[_0xa6b3('0x26')]=_0x1a8914;return _0x110565;})[_0xa6b3('0x1b')](respondWithFilteredResult(_0xaa7f39,_0x8e4f6c))['catch'](handleError(_0xaa7f39,null));};exports['show']=function(_0x4c001b,_0x5eee57){var _0x1762cc={'raw':!![],'where':{'id':_0x4c001b['params']['id']}},_0x60b1e6={};_0x60b1e6[_0xa6b3('0x27')]=_[_0xa6b3('0x28')](db['ChatQueue']['rawAttributes']);_0x60b1e6[_0xa6b3('0x24')]=_[_0xa6b3('0x28')](_0x4c001b[_0xa6b3('0x24')]);_0x60b1e6[_0xa6b3('0x29')]=_['intersection'](_0x60b1e6[_0xa6b3('0x27')],_0x60b1e6['query']);_0x1762cc[_0xa6b3('0x2a')]=_[_0xa6b3('0x2b')](_0x60b1e6[_0xa6b3('0x27')],qs[_0xa6b3('0x2c')](_0x4c001b[_0xa6b3('0x24')][_0xa6b3('0x2c')]));_0x1762cc[_0xa6b3('0x2a')]=_0x1762cc[_0xa6b3('0x2a')][_0xa6b3('0x2d')]?_0x1762cc[_0xa6b3('0x2a')]:_0x60b1e6[_0xa6b3('0x27')];if(_0x4c001b[_0xa6b3('0x24')][_0xa6b3('0x2e')]){_0x1762cc['include']=[{'all':!![]}];}_0x1762cc=_[_0xa6b3('0x2f')]({},_0x1762cc,_0x4c001b[_0xa6b3('0x30')]);return db[_0xa6b3('0x1e')][_0xa6b3('0x31')](_0x1762cc)[_0xa6b3('0x1b')](handleEntityNotFound(_0x5eee57,null))[_0xa6b3('0x1b')](respondWithResult(_0x5eee57,null))[_0xa6b3('0x32')](handleError(_0x5eee57,null));};exports['create']=function(_0x38dd49,_0x1a41d3){return db[_0xa6b3('0x1e')][_0xa6b3('0x33')](_0x38dd49['body'],{})[_0xa6b3('0x1b')](function(_0x169519){var _0x4a090a=_0x38dd49[_0xa6b3('0x34')]['get']({'plain':!![]});if(!_0x4a090a)throw new Error(_0xa6b3('0x35'));if(_0x4a090a['role']===_0xa6b3('0x34')){var _0x2265c1=_0x169519[_0xa6b3('0x36')]({'plain':!![]});var _0x4a9ce4=_0xa6b3('0x19');return db['UserProfileSection'][_0xa6b3('0x31')]({'where':{'name':_0x4a9ce4,'userProfileId':_0x4a090a['userProfileId']},'raw':!![]})['then'](function(_0x3d9c43){if(_0x3d9c43&&_0x3d9c43[_0xa6b3('0x37')]===0x0){return db[_0xa6b3('0x1a')][_0xa6b3('0x33')]({'name':_0x2265c1[_0xa6b3('0x38')],'resourceId':_0x2265c1['id'],'type':_0x3d9c43[_0xa6b3('0x38')],'sectionId':_0x3d9c43['id']},{})[_0xa6b3('0x1b')](function(){return _0x169519;});}else{return _0x169519;}})[_0xa6b3('0x32')](function(_0x12b01d){logger[_0xa6b3('0x39')](_0xa6b3('0x3a'),_0x12b01d);throw _0x12b01d;});}return _0x169519;})[_0xa6b3('0x1b')](respondWithResult(_0x1a41d3,0xc9))[_0xa6b3('0x32')](handleError(_0x1a41d3,null));};exports[_0xa6b3('0x3b')]=function(_0x4265e9,_0xe421a4){if(_0x4265e9[_0xa6b3('0x3c')]['id']){delete _0x4265e9['body']['id'];}return db[_0xa6b3('0x1e')][_0xa6b3('0x31')]({'where':{'id':_0x4265e9[_0xa6b3('0x3d')]['id']}})[_0xa6b3('0x1b')](handleEntityNotFound(_0xe421a4,null))[_0xa6b3('0x1b')](saveUpdates(_0x4265e9[_0xa6b3('0x3c')],null))[_0xa6b3('0x1b')](respondWithResult(_0xe421a4,null))['catch'](handleError(_0xe421a4,null));};exports['destroy']=function(_0x397b3d,_0x59b450){return db[_0xa6b3('0x1e')][_0xa6b3('0x31')]({'where':{'id':_0x397b3d[_0xa6b3('0x3d')]['id']}})[_0xa6b3('0x1b')](handleEntityNotFound(_0x59b450,null))[_0xa6b3('0x1b')](removeEntity(_0x59b450,null))[_0xa6b3('0x32')](handleError(_0x59b450,null));};exports[_0xa6b3('0x3e')]=function(_0xd0957a,_0xe71e15){return db['ChatQueue'][_0xa6b3('0x3e')]()['then'](respondWithResult(_0xe71e15,null))[_0xa6b3('0x32')](handleError(_0xe71e15,null));};exports[_0xa6b3('0x3f')]=function(_0x328207,_0x255886){var _0x2161ca={'raw':!![],'where':{}},_0x18df8e={},_0x5c7394;return db['ChatQueue']['findOne']({'where':{'id':_0x328207[_0xa6b3('0x3d')]['id']}})['then'](handleEntityNotFound(_0x255886,null))['then'](function(_0x37e28b){if(_0x37e28b){_0x5c7394=_0x37e28b['get']({'plain':!![]});_0x18df8e[_0xa6b3('0x27')]=_[_0xa6b3('0x28')](db['UserChatQueue'][_0xa6b3('0x1f')]);_0x18df8e[_0xa6b3('0x24')]=_[_0xa6b3('0x28')](_0x328207[_0xa6b3('0x24')]);_0x18df8e[_0xa6b3('0x29')]=_[_0xa6b3('0x2b')](_0x18df8e['model'],_0x18df8e['query']);_0x2161ca[_0xa6b3('0x2a')]=_[_0xa6b3('0x2b')](_0x18df8e[_0xa6b3('0x27')],qs[_0xa6b3('0x2c')](_0x328207['query']['fields']));_0x2161ca[_0xa6b3('0x2a')]=_0x2161ca['attributes'][_0xa6b3('0x2d')]?_0x2161ca[_0xa6b3('0x2a')]:_0x18df8e[_0xa6b3('0x27')];if(!_0x328207[_0xa6b3('0x24')]['hasOwnProperty'](_0xa6b3('0x40'))){_0x2161ca[_0xa6b3('0x13')]=qs[_0xa6b3('0x13')](_0x328207[_0xa6b3('0x24')]['limit']);_0x2161ca[_0xa6b3('0x12')]=qs[_0xa6b3('0x12')](_0x328207[_0xa6b3('0x24')][_0xa6b3('0x12')]);}_0x2161ca['order']=qs[_0xa6b3('0x41')](_0x328207['query'][_0xa6b3('0x41')]);_0x2161ca[_0xa6b3('0x42')]=qs[_0xa6b3('0x29')](_[_0xa6b3('0x43')](_0x328207[_0xa6b3('0x24')],_0x18df8e['filters']));_0x2161ca['where'][_0xa6b3('0x44')]=_0x37e28b['id'];if(_0x328207[_0xa6b3('0x24')][_0xa6b3('0x45')]){_0x2161ca[_0xa6b3('0x42')]=_[_0xa6b3('0x2f')](_0x2161ca[_0xa6b3('0x42')],{'$or':_[_0xa6b3('0x46')](_0x2161ca[_0xa6b3('0x2a')],function(_0x596647){var _0x3b213d={};_0x3b213d[_0x596647]={'$like':'%'+_0x328207['query'][_0xa6b3('0x45')]+'%'};return _0x3b213d;})});}_0x2161ca=_[_0xa6b3('0x2f')]({},_0x2161ca,_0x328207[_0xa6b3('0x30')]);return db[_0xa6b3('0x47')]['findAll'](_0x2161ca);}})[_0xa6b3('0x1b')](function(_0x5ae544){if(_0x5ae544){return db[_0xa6b3('0x48')][_0xa6b3('0x49')]({'where':{'id':_[_0xa6b3('0x46')](_0x5ae544,_0xa6b3('0x4a')),'role':_0xa6b3('0x4b')},'attributes':['id',_0xa6b3('0x38'),'chatPause',_0xa6b3('0x4c'),_0xa6b3('0x4d')]});}})[_0xa6b3('0x1b')](function(_0x379847){if(_0x379847){return{'count':_0x379847[_0xa6b3('0x15')],'rows':_[_0xa6b3('0x46')](_0x379847[_0xa6b3('0x26')],function(_0x379932){return{'membername':_0x379932[_0xa6b3('0x38')],'UserId':_0x379932['id'],'queue_name':_0x5c7394[_0xa6b3('0x38')],'ChatQueueId':_0x5c7394['id'],'interface':util[_0xa6b3('0x4e')](_0xa6b3('0x4f'),'SIP',_0x379932['name']),'penalty':0x0,'paused':_0x379932['chatPause'],'createdAt':_0x379932[_0xa6b3('0x4d')],'updatedAt':_0x379932['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xa6b3('0x1b')](respondWithFilteredResult(_0x255886,_0x2161ca))[_0xa6b3('0x32')](handleError(_0x255886,null));};exports[_0xa6b3('0x50')]=function(_0x183023,_0x5acf69){var _0xcb35e7={};var _0x5e8e5c={};var _0x419cac;var _0x99608;return db[_0xa6b3('0x1e')][_0xa6b3('0x51')]({'where':{'id':_0x183023['params']['id']}})[_0xa6b3('0x1b')](handleEntityNotFound(_0x5acf69,null))[_0xa6b3('0x1b')](function(_0x126ad1){if(_0x126ad1){_0x419cac=_0x126ad1;_0x5e8e5c[_0xa6b3('0x27')]=_['keys'](db[_0xa6b3('0x52')][_0xa6b3('0x1f')]);_0x5e8e5c[_0xa6b3('0x24')]=_['keys'](_0x183023[_0xa6b3('0x24')]);_0x5e8e5c[_0xa6b3('0x29')]=_[_0xa6b3('0x2b')](_0x5e8e5c[_0xa6b3('0x27')],_0x5e8e5c[_0xa6b3('0x24')]);_0xcb35e7[_0xa6b3('0x2a')]=_['intersection'](_0x5e8e5c[_0xa6b3('0x27')],qs[_0xa6b3('0x2c')](_0x183023[_0xa6b3('0x24')][_0xa6b3('0x2c')]));_0xcb35e7[_0xa6b3('0x2a')]=_0xcb35e7[_0xa6b3('0x2a')][_0xa6b3('0x2d')]?_0xcb35e7['attributes']:_0x5e8e5c[_0xa6b3('0x27')];_0xcb35e7['order']=qs[_0xa6b3('0x41')](_0x183023[_0xa6b3('0x24')][_0xa6b3('0x41')]);_0xcb35e7['where']=qs[_0xa6b3('0x29')](_['pick'](_0x183023['query'],_0x5e8e5c[_0xa6b3('0x29')]));if(_0x183023[_0xa6b3('0x24')]['filter']){_0xcb35e7[_0xa6b3('0x42')]=_[_0xa6b3('0x2f')](_0xcb35e7[_0xa6b3('0x42')],{'$or':_['map'](_0xcb35e7[_0xa6b3('0x2a')],function(_0x4fe33a){var _0x486234={};_0x486234[_0x4fe33a]={'$like':'%'+_0x183023[_0xa6b3('0x24')]['filter']+'%'};return _0x486234;})});}_0xcb35e7=_[_0xa6b3('0x2f')]({},_0xcb35e7,_0x183023[_0xa6b3('0x30')]);return _0x419cac[_0xa6b3('0x50')](_0xcb35e7);}})[_0xa6b3('0x1b')](function(_0x5fd978){if(_0x5fd978){_0x99608=_0x5fd978[_0xa6b3('0x2d')];if(!_0x183023[_0xa6b3('0x24')]['hasOwnProperty'](_0xa6b3('0x40'))){_0xcb35e7['limit']=qs['limit'](_0x183023[_0xa6b3('0x24')][_0xa6b3('0x13')]);_0xcb35e7[_0xa6b3('0x12')]=qs['offset'](_0x183023['query'][_0xa6b3('0x12')]);}return _0x419cac[_0xa6b3('0x50')](_0xcb35e7);}})[_0xa6b3('0x1b')](function(_0x4b0394){if(_0x4b0394){return _0x4b0394?{'count':_0x99608,'rows':_0x4b0394}:null;}})[_0xa6b3('0x1b')](respondWithResult(_0x5acf69,null))[_0xa6b3('0x32')](handleError(_0x5acf69,null));};exports[_0xa6b3('0x53')]=function(_0x20e4c5,_0x2a410b){var _0x2a89b9=_0x20e4c5[_0xa6b3('0x3c')][_0xa6b3('0x54')];return db[_0xa6b3('0x52')]['findAll']({'where':{'id':_0x2a89b9},'attributes':['id'],'include':[{'model':db[_0xa6b3('0x48')],'as':'Agents','attributes':['id','name',_0xa6b3('0x55'),_0xa6b3('0x56'),'interface'],'raw':!![]}]})['then'](function(_0x5520c1){if(_0x5520c1){var _0x344ea0=_[_0xa6b3('0x57')](_0x5520c1,function(_0x446542){var _0x5d7a03=_0x446542[_0xa6b3('0x36')]({'plain':!![]});return _0x5d7a03['Agents'];});return db[_0xa6b3('0x1e')][_0xa6b3('0x31')]({'where':{'id':_0x20e4c5[_0xa6b3('0x3d')]['id']}})[_0xa6b3('0x1b')](function(_0x36fdb4){return db['sequelize'][_0xa6b3('0x58')](function(_0x1db2d3){return _0x36fdb4['addTeams'](_0x2a89b9,{'transaction':_0x1db2d3})[_0xa6b3('0x1b')](function(){return BPromise[_0xa6b3('0x59')](_0x344ea0,function(_0x596b24){return db[_0xa6b3('0x47')][_0xa6b3('0x5a')]({'where':{'UserId':_0x596b24['id'],'ChatQueueId':_0x20e4c5[_0xa6b3('0x3d')]['id']},'transaction':_0x1db2d3});});})['then'](function(){_0x344ea0[_0xa6b3('0x5b')](function(_0x5c1ae4){socket[_0xa6b3('0x5c')]('userChatQueue:save',{'UserId':_0x5c1ae4['id'],'ChatQueueId':_0x36fdb4['id']});});});});});}})[_0xa6b3('0x1b')](respondWithStatusCode(_0x2a410b,null))[_0xa6b3('0x32')](handleError(_0x2a410b,null));};exports[_0xa6b3('0x5d')]=function(_0x15f836,_0x591e86){return db[_0xa6b3('0x52')]['findAll']({'where':{'id':_0x15f836[_0xa6b3('0x24')][_0xa6b3('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa6b3('0x5e'),'attributes':['id'],'raw':!![]}]})[_0xa6b3('0x1b')](handleEntityNotFound(_0x591e86,null))[_0xa6b3('0x1b')](function(_0x3929ce){var _0x5ebd47=_[_0xa6b3('0x46')](_0x3929ce,'id');var _0x42998f=[];var _0x4a71d9=[];var _0x5e31b5=squel[_0xa6b3('0x5f')]();_0x5e31b5[_0xa6b3('0x60')](_0xa6b3('0x61'))[_0xa6b3('0x62')](_0xa6b3('0x63'),'tq')[_0xa6b3('0x64')](_0xa6b3('0x65'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xa6b3('0x66'),_0x15f836[_0xa6b3('0x3d')]['id']);for(var _0xae2e18=0x0;_0xae2e18<_0x3929ce[_0xa6b3('0x2d')];_0xae2e18+=0x1){let _0x347418=_0x3929ce[_0xae2e18];for(var _0x1ed755=0x0;_0x1ed755<_0x347418[_0xa6b3('0x5e')][_0xa6b3('0x2d')];_0x1ed755+=0x1){let _0x2e5e56=_0x347418[_0xa6b3('0x5e')][_0x1ed755];var _0x49dd5f=_0x5e31b5['clone']();_0x49dd5f[_0xa6b3('0x42')](_0xa6b3('0x67'),_0x2e5e56['id']);_0x4a71d9[_0xa6b3('0x68')](db[_0xa6b3('0x69')][_0xa6b3('0x24')](_0x49dd5f[_0xa6b3('0x6a')](),{'type':db[_0xa6b3('0x69')][_0xa6b3('0x6b')][_0xa6b3('0x6c')]})[_0xa6b3('0x1b')](function(_0x2b99a9){if(_0x2b99a9[_0xa6b3('0x2d')]===0x1){return _0x2e5e56['id'];}else{var _0x3e931f=_[_0xa6b3('0x6d')](_[_0xa6b3('0x46')](_0x2b99a9,'TeamId'),function(_0x18b9c1){return _[_0xa6b3('0x6e')](_0x5ebd47,_0x18b9c1);});if(_0x3e931f){return _0x2e5e56['id'];}}}));}}return BPromise[_0xa6b3('0x6f')](_0x4a71d9)[_0xa6b3('0x1b')](function(_0x48dd84){_0x42998f=_(_0x42998f)['union'](_0x48dd84)['compact']()['value']();return db['ChatQueue'][_0xa6b3('0x31')]({'where':{'id':_0x15f836[_0xa6b3('0x3d')]['id']}})[_0xa6b3('0x1b')](function(_0x20dff5){return db[_0xa6b3('0x69')][_0xa6b3('0x58')](function(_0x8c02e8){return _0x20dff5[_0xa6b3('0x5d')](_0x15f836[_0xa6b3('0x24')]['ids'],{'transaction':_0x8c02e8})['then'](function(){if(!_[_0xa6b3('0x70')](_0x42998f)){return _0x20dff5['removeAgents'](_0x42998f,{'transaction':_0x8c02e8});}})['then'](function(){_0x42998f[_0xa6b3('0x5b')](function(_0x1bb730){socket[_0xa6b3('0x5c')]('userChatQueue:remove',{'UserId':_0x1bb730,'ChatQueueId':_0x20dff5['id']});});});});});});})['then'](respondWithStatusCode(_0x591e86,null))['catch'](handleError(_0x591e86,null));};exports[_0xa6b3('0x71')]=function(_0x3f26c1,_0x3dad4d){return db['ChatQueue']['find']({'where':{'id':_0x3f26c1['params']['id']}})[_0xa6b3('0x1b')](handleEntityNotFound(_0x3dad4d,null))[_0xa6b3('0x1b')](function(_0x1e4c3b){if(_0x1e4c3b){return _0x1e4c3b['addAgents'](_0x3f26c1[_0xa6b3('0x3c')][_0xa6b3('0x54')],_[_0xa6b3('0x72')](_0x3f26c1[_0xa6b3('0x3c')],[_0xa6b3('0x54'),'id'])||{})['spread'](function(_0x5cdda4){for(var _0x30f63d=0x0;_0x30f63d<_0x3f26c1[_0xa6b3('0x3c')][_0xa6b3('0x54')][_0xa6b3('0x2d')];_0x30f63d+=0x1){socket['emit'](_0xa6b3('0x73'),{'UserId':Number(_0x3f26c1[_0xa6b3('0x3c')][_0xa6b3('0x54')][_0x30f63d]),'ChatQueueId':Number(_0x3f26c1['params']['id'])});}return _0x5cdda4;});}})[_0xa6b3('0x1b')](respondWithResult(_0x3dad4d,null))[_0xa6b3('0x32')](handleError(_0x3dad4d,null));};exports[_0xa6b3('0x74')]=function(_0x235e8e,_0x388751){return db[_0xa6b3('0x1e')]['find']({'where':{'id':_0x235e8e[_0xa6b3('0x3d')]['id']}})[_0xa6b3('0x1b')](handleEntityNotFound(_0x388751,null))['then'](function(_0x25d3b0){if(_0x25d3b0){return _0x25d3b0[_0xa6b3('0x74')](_0x235e8e['query']['ids'])[_0xa6b3('0x1b')](function(){if(_['isArray'](_0x235e8e[_0xa6b3('0x24')][_0xa6b3('0x54')])){for(var _0x1bfc4a=0x0;_0x1bfc4a<_0x235e8e[_0xa6b3('0x24')][_0xa6b3('0x54')]['length'];_0x1bfc4a+=0x1){socket[_0xa6b3('0x5c')](_0xa6b3('0x75'),{'UserId':Number(_0x235e8e[_0xa6b3('0x24')][_0xa6b3('0x54')][_0x1bfc4a]),'ChatQueueId':Number(_0x235e8e[_0xa6b3('0x3d')]['id'])});}}else{socket[_0xa6b3('0x5c')](_0xa6b3('0x75'),{'UserId':Number(_0x235e8e[_0xa6b3('0x24')]['ids']),'ChatQueueId':Number(_0x235e8e[_0xa6b3('0x3d')]['id'])});}});}})[_0xa6b3('0x1b')](respondWithStatusCode(_0x388751,null))[_0xa6b3('0x32')](handleError(_0x388751,null));};exports['getAgents']=function(_0x5402cc,_0x35d4fd){var _0x1d8f65={};var _0x512229={};var _0x56519a;var _0x10d3df;return db[_0xa6b3('0x1e')][_0xa6b3('0x51')]({'where':{'id':_0x5402cc[_0xa6b3('0x3d')]['id']}})[_0xa6b3('0x1b')](handleEntityNotFound(_0x35d4fd,null))[_0xa6b3('0x1b')](function(_0x40c2f8){if(_0x40c2f8){_0x56519a=_0x40c2f8;_0x512229['model']=_[_0xa6b3('0x28')](db[_0xa6b3('0x48')][_0xa6b3('0x1f')]);_0x512229[_0xa6b3('0x24')]=_[_0xa6b3('0x28')](_0x5402cc['query']);_0x512229['filters']=_[_0xa6b3('0x2b')](_0x512229[_0xa6b3('0x27')],_0x512229['query']);_0x1d8f65[_0xa6b3('0x2a')]=_[_0xa6b3('0x2b')](_0x512229[_0xa6b3('0x27')],qs[_0xa6b3('0x2c')](_0x5402cc['query'][_0xa6b3('0x2c')]));_0x1d8f65['attributes']=_0x1d8f65[_0xa6b3('0x2a')]['length']?_0x1d8f65[_0xa6b3('0x2a')]:_0x512229[_0xa6b3('0x27')];_0x1d8f65[_0xa6b3('0x76')]=qs[_0xa6b3('0x41')](_0x5402cc[_0xa6b3('0x24')][_0xa6b3('0x41')]);_0x1d8f65[_0xa6b3('0x42')]=qs[_0xa6b3('0x29')](_[_0xa6b3('0x43')](_0x5402cc[_0xa6b3('0x24')],_0x512229[_0xa6b3('0x29')]));if(_0x5402cc[_0xa6b3('0x24')][_0xa6b3('0x45')]){_0x1d8f65[_0xa6b3('0x42')]=_[_0xa6b3('0x2f')](_0x1d8f65['where'],{'$or':_[_0xa6b3('0x46')](_0x1d8f65[_0xa6b3('0x2a')],function(_0x4cb711){var _0x5829c9={};_0x5829c9[_0x4cb711]={'$like':'%'+_0x5402cc['query'][_0xa6b3('0x45')]+'%'};return _0x5829c9;})});}_0x1d8f65=_[_0xa6b3('0x2f')]({},_0x1d8f65,_0x5402cc[_0xa6b3('0x30')]);return _0x56519a[_0xa6b3('0x77')](_0x1d8f65);}})[_0xa6b3('0x1b')](function(_0x2dbd69){if(_0x2dbd69){_0x10d3df=_0x2dbd69[_0xa6b3('0x2d')];if(!_0x5402cc[_0xa6b3('0x24')][_0xa6b3('0x78')](_0xa6b3('0x40'))){_0x1d8f65[_0xa6b3('0x13')]=qs[_0xa6b3('0x13')](_0x5402cc[_0xa6b3('0x24')]['limit']);_0x1d8f65['offset']=qs['offset'](_0x5402cc['query']['offset']);}return _0x56519a[_0xa6b3('0x77')](_0x1d8f65);}})[_0xa6b3('0x1b')](function(_0x25cb41){if(_0x25cb41){return _0x25cb41?{'count':_0x10d3df,'rows':_0x25cb41}:null;}})[_0xa6b3('0x1b')](respondWithResult(_0x35d4fd,null))[_0xa6b3('0x32')](handleError(_0x35d4fd,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 46ec30b..f2aaf39 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 _0x7fc4=['../../mysqldb','ChatQueue','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x5b40e4,_0xd9db24){var _0x59af32=function(_0x1ccf78){while(--_0x1ccf78){_0x5b40e4['push'](_0x5b40e4['shift']());}};_0x59af32(++_0xd9db24);}(_0x7fc4,0x8f));var _0x47fc=function(_0x2c1e30,_0x52d61e){_0x2c1e30=_0x2c1e30-0x0;var _0x891bcc=_0x7fc4[_0x2c1e30];return _0x891bcc;};'use strict';var EventEmitter=require(_0x47fc('0x0'));var ChatQueue=require(_0x47fc('0x1'))['db'][_0x47fc('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x47fc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x47fc('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2148f7){return function(_0x3724b6,_0x3bcb71,_0x52f167){ChatQueueEvents[_0x47fc('0x5')](_0x2148f7+':'+_0x3724b6['id'],_0x3724b6);ChatQueueEvents['emit'](_0x2148f7,_0x3724b6);_0x52f167(null);};}for(var e in events){if(events[_0x47fc('0x6')](e)){var event=events[e];ChatQueue[_0x47fc('0x7')](e,emitEvent(event));}}module[_0x47fc('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0x6057=['emit','hasOwnProperty','events','../../mysqldb','update','remove'];(function(_0x471969,_0x3397bc){var _0x3ee654=function(_0x147130){while(--_0x147130){_0x471969['push'](_0x471969['shift']());}};_0x3ee654(++_0x3397bc);}(_0x6057,0x8c));var _0x7605=function(_0xf0bc07,_0x510ebf){_0xf0bc07=_0xf0bc07-0x0;var _0x1c50c2=_0x6057[_0xf0bc07];return _0x1c50c2;};'use strict';var EventEmitter=require(_0x7605('0x0'));var ChatQueue=require(_0x7605('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x7605('0x2'),'afterDestroy':_0x7605('0x3')};function emitEvent(_0x75d1d9){return function(_0x1425ff,_0x222bc7,_0x406c25){ChatQueueEvents[_0x7605('0x4')](_0x75d1d9+':'+_0x1425ff['id'],_0x1425ff);ChatQueueEvents['emit'](_0x75d1d9,_0x1425ff);_0x406c25(null);};}for(var e in events){if(events[_0x7605('0x5')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 2af17f6..1fd3d16 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 _0xa157=['lodash','../../config/logger','api','bluebird','request-promise','rimraf','./chatQueue.attributes','exports','define','chat_queues'];(function(_0x25efdf,_0x521462){var _0x22c495=function(_0x184469){while(--_0x184469){_0x25efdf['push'](_0x25efdf['shift']());}};_0x22c495(++_0x521462);}(_0xa157,0x12c));var _0x7a15=function(_0x33d580,_0x177cf2){_0x33d580=_0x33d580-0x0;var _0x4cf904=_0xa157[_0x33d580];return _0x4cf904;};'use strict';var _=require(_0x7a15('0x0'));var util=require('util');var logger=require(_0x7a15('0x1'))(_0x7a15('0x2'));var moment=require('moment');var BPromise=require(_0x7a15('0x3'));var rp=require(_0x7a15('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7a15('0x5'));var config=require('../../config/environment');var attributes=require(_0x7a15('0x6'));module[_0x7a15('0x7')]=function(_0x1f62ba,_0x5c45ac){return _0x1f62ba[_0x7a15('0x8')]('ChatQueue',attributes,{'tableName':_0x7a15('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ca0=['moment','bluebird','request-promise','path','exports','lodash','../../config/logger'];(function(_0x5c5b4d,_0x3b4781){var _0x448a9e=function(_0x44710f){while(--_0x44710f){_0x5c5b4d['push'](_0x5c5b4d['shift']());}};_0x448a9e(++_0x3b4781);}(_0x7ca0,0x1cc));var _0x07ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7ca0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x07ca('0x0'));var util=require('util');var logger=require(_0x07ca('0x1'))('api');var moment=require(_0x07ca('0x2'));var BPromise=require(_0x07ca('0x3'));var rp=require(_0x07ca('0x4'));var fs=require('fs');var path=require(_0x07ca('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatQueue.attributes');module[_0x07ca('0x6')]=function(_0x3bf799,_0x129ba1){return _0x3bf799['define']('ChatQueue',attributes,{'tableName':'chat_queues','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 14b3c2a..c671035 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 _0x2162=['model','GetChatQueue','ShowChatQueue','ChatQueue','find','where','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','findAll','options','raw','limit','map','include','attributes'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x2162,0x110));var _0x2216=function(_0x24c15a,_0x261c48){_0x24c15a=_0x24c15a-0x0;var _0x2a3137=_0x2162[_0x24c15a];return _0x2a3137;};'use strict';var _=require('lodash');var util=require(_0x2216('0x0'));var moment=require('moment');var BPromise=require(_0x2216('0x1'));var rs=require(_0x2216('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2216('0x3'))['db'];var utils=require(_0x2216('0x4'));var logger=require('../../config/logger')(_0x2216('0x5'));var config=require(_0x2216('0x6'));var jayson=require(_0x2216('0x7'));var client=jayson['client'][_0x2216('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x2216('0x9')],{'host':_0x2216('0xa'),'port':0x18eb});var socket=require(_0x2216('0xb'))(new Redis(config[_0x2216('0x9')]));require('./chatQueue.socket')['register'](socket);function respondWithRpcPromise(_0x5ef687,_0x4b16f8,_0x26087b){return new BPromise(function(_0x291559,_0x4bae57){return client[_0x2216('0xc')](_0x5ef687,_0x26087b)[_0x2216('0xd')](function(_0x462180){logger[_0x2216('0xe')]('ChatQueue,\x20%s,\x20%s',_0x4b16f8,_0x2216('0xf'));logger[_0x2216('0x10')](_0x2216('0x11'),_0x4b16f8,_0x2216('0xf'),JSON[_0x2216('0x12')](_0x462180));if(_0x462180[_0x2216('0x13')]){if(_0x462180[_0x2216('0x13')][_0x2216('0x14')]===0x1f4){logger['error'](_0x2216('0x15'),_0x4b16f8,_0x462180[_0x2216('0x13')]['message']);return _0x4bae57(_0x462180[_0x2216('0x13')]['message']);}logger[_0x2216('0x13')](_0x2216('0x15'),_0x4b16f8,_0x462180[_0x2216('0x13')][_0x2216('0x16')]);return _0x291559(_0x462180[_0x2216('0x13')][_0x2216('0x16')]);}else{logger[_0x2216('0xe')](_0x2216('0x15'),_0x4b16f8,_0x2216('0xf'));_0x291559(_0x462180[_0x2216('0x17')][_0x2216('0x16')]);}})[_0x2216('0x18')](function(_0x376a36){logger[_0x2216('0x13')](_0x2216('0x15'),_0x4b16f8,_0x376a36);_0x4bae57(_0x376a36);});});}exports['GetChatQueue']=function(_0x1157f7){var _0x36708c=this;return new Promise(function(_0x41ac4b,_0x230faa){return db['ChatQueue'][_0x2216('0x19')]({'raw':_0x1157f7[_0x2216('0x1a')]?_0x1157f7[_0x2216('0x1a')][_0x2216('0x1b')]===undefined?!![]:![]:!![],'where':_0x1157f7['options']?_0x1157f7['options']['where']||null:null,'attributes':_0x1157f7[_0x2216('0x1a')]?_0x1157f7[_0x2216('0x1a')]['attributes']||null:null,'limit':_0x1157f7[_0x2216('0x1a')]?_0x1157f7[_0x2216('0x1a')][_0x2216('0x1c')]||null:null,'include':_0x1157f7[_0x2216('0x1a')]?_0x1157f7[_0x2216('0x1a')]['include']?_[_0x2216('0x1d')](_0x1157f7[_0x2216('0x1a')][_0x2216('0x1e')],function(_0x15fded){return{'model':db[_0x15fded['model']],'as':_0x15fded['as'],'attributes':_0x15fded[_0x2216('0x1f')],'include':_0x15fded[_0x2216('0x1e')]?_[_0x2216('0x1d')](_0x15fded[_0x2216('0x1e')],function(_0xcb96b6){return{'model':db[_0xcb96b6[_0x2216('0x20')]],'as':_0xcb96b6['as'],'attributes':_0xcb96b6[_0x2216('0x1f')],'include':_0xcb96b6[_0x2216('0x1e')]?_['map'](_0xcb96b6[_0x2216('0x1e')],function(_0x50703e){return{'model':db[_0x50703e['model']],'as':_0x50703e['as'],'attributes':_0x50703e[_0x2216('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d08fd){logger['info'](_0x2216('0x21'),_0x1157f7);logger[_0x2216('0x10')](_0x2216('0x21'),_0x1157f7,JSON[_0x2216('0x12')](_0x2d08fd));_0x41ac4b(_0x2d08fd);})[_0x2216('0x18')](function(_0x2fd7cb){logger[_0x2216('0x13')](_0x2216('0x21'),_0x2fd7cb[_0x2216('0x16')],_0x1157f7);_0x230faa(_0x36708c[_0x2216('0x13')](0x1f4,_0x2fd7cb['message']));});});};exports[_0x2216('0x22')]=function(_0xcb23b0){var _0x22e017=this;return new Promise(function(_0x3fde1f,_0x4861d2){return db[_0x2216('0x23')][_0x2216('0x24')]({'raw':_0xcb23b0[_0x2216('0x1a')]?_0xcb23b0[_0x2216('0x1a')][_0x2216('0x1b')]===undefined?!![]:![]:!![],'where':_0xcb23b0[_0x2216('0x1a')]?_0xcb23b0[_0x2216('0x1a')][_0x2216('0x25')]||null:null,'attributes':_0xcb23b0['options']?_0xcb23b0[_0x2216('0x1a')]['attributes']||null:null,'include':_0xcb23b0[_0x2216('0x1a')]?_0xcb23b0[_0x2216('0x1a')]['include']?_['map'](_0xcb23b0[_0x2216('0x1a')][_0x2216('0x1e')],function(_0x133f0f){return{'model':db[_0x133f0f[_0x2216('0x20')]],'as':_0x133f0f['as'],'attributes':_0x133f0f[_0x2216('0x1f')],'include':_0x133f0f[_0x2216('0x1e')]?_[_0x2216('0x1d')](_0x133f0f[_0x2216('0x1e')],function(_0x4ee42c){return{'model':db[_0x4ee42c['model']],'as':_0x4ee42c['as'],'attributes':_0x4ee42c[_0x2216('0x1f')],'include':_0x4ee42c[_0x2216('0x1e')]?_[_0x2216('0x1d')](_0x4ee42c['include'],function(_0x372df4){return{'model':db[_0x372df4[_0x2216('0x20')]],'as':_0x372df4['as'],'attributes':_0x372df4[_0x2216('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2216('0xd')](function(_0x4eee0a){logger[_0x2216('0xe')](_0x2216('0x22'),_0xcb23b0);logger['debug'](_0x2216('0x22'),_0xcb23b0,JSON[_0x2216('0x12')](_0x4eee0a));_0x3fde1f(_0x4eee0a);})[_0x2216('0x18')](function(_0x52ac76){logger[_0x2216('0x13')](_0x2216('0x22'),_0x52ac76[_0x2216('0x16')],_0xcb23b0);_0x4861d2(_0x22e017['error'](0x1f4,_0x52ac76[_0x2216('0x16')]));});});}; \ No newline at end of file +var _0xbdbe=['model','attributes','raw','ShowChatQueue','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','GetChatQueue','findAll','options','where','limit','include','map'];(function(_0x53fe97,_0x544271){var _0x5c49a2=function(_0x3fa2b4){while(--_0x3fa2b4){_0x53fe97['push'](_0x53fe97['shift']());}};_0x5c49a2(++_0x544271);}(_0xbdbe,0x1f3));var _0xebdb=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xbdbe[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xebdb('0x0'));var util=require('util');var moment=require(_0xebdb('0x1'));var BPromise=require('bluebird');var rs=require(_0xebdb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xebdb('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xebdb('0x4'))('rpc');var config=require(_0xebdb('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xebdb('0x6')][_0xebdb('0x7')]({'port':0x232a});config[_0xebdb('0x8')]=_[_0xebdb('0x9')](config[_0xebdb('0x8')],{'host':_0xebdb('0xa'),'port':0x18eb});var socket=require(_0xebdb('0xb'))(new Redis(config[_0xebdb('0x8')]));require(_0xebdb('0xc'))[_0xebdb('0xd')](socket);function respondWithRpcPromise(_0x3b2730,_0x54a360,_0xcdbd2d){return new BPromise(function(_0x1622d5,_0x557d85){return client[_0xebdb('0xe')](_0x3b2730,_0xcdbd2d)[_0xebdb('0xf')](function(_0x2379d3){logger[_0xebdb('0x10')]('ChatQueue,\x20%s,\x20%s',_0x54a360,'request\x20sent');logger[_0xebdb('0x11')](_0xebdb('0x12'),_0x54a360,_0xebdb('0x13'),JSON[_0xebdb('0x14')](_0x2379d3));if(_0x2379d3['error']){if(_0x2379d3[_0xebdb('0x15')][_0xebdb('0x16')]===0x1f4){logger[_0xebdb('0x15')](_0xebdb('0x17'),_0x54a360,_0x2379d3[_0xebdb('0x15')][_0xebdb('0x18')]);return _0x557d85(_0x2379d3[_0xebdb('0x15')][_0xebdb('0x18')]);}logger[_0xebdb('0x15')](_0xebdb('0x17'),_0x54a360,_0x2379d3['error'][_0xebdb('0x18')]);return _0x1622d5(_0x2379d3['error']['message']);}else{logger[_0xebdb('0x10')](_0xebdb('0x17'),_0x54a360,'request\x20sent');_0x1622d5(_0x2379d3[_0xebdb('0x19')][_0xebdb('0x18')]);}})['catch'](function(_0x2de2f5){logger['error']('ChatQueue,\x20%s,\x20%s',_0x54a360,_0x2de2f5);_0x557d85(_0x2de2f5);});});}exports[_0xebdb('0x1a')]=function(_0x253c65){var _0x28e85b=this;return new Promise(function(_0x5c76cc,_0x38a4dd){return db['ChatQueue'][_0xebdb('0x1b')]({'raw':_0x253c65[_0xebdb('0x1c')]?_0x253c65['options']['raw']===undefined?!![]:![]:!![],'where':_0x253c65[_0xebdb('0x1c')]?_0x253c65['options'][_0xebdb('0x1d')]||null:null,'attributes':_0x253c65[_0xebdb('0x1c')]?_0x253c65[_0xebdb('0x1c')]['attributes']||null:null,'limit':_0x253c65['options']?_0x253c65[_0xebdb('0x1c')][_0xebdb('0x1e')]||null:null,'include':_0x253c65[_0xebdb('0x1c')]?_0x253c65[_0xebdb('0x1c')][_0xebdb('0x1f')]?_[_0xebdb('0x20')](_0x253c65[_0xebdb('0x1c')][_0xebdb('0x1f')],function(_0x5b721f){return{'model':db[_0x5b721f[_0xebdb('0x21')]],'as':_0x5b721f['as'],'attributes':_0x5b721f[_0xebdb('0x22')],'include':_0x5b721f[_0xebdb('0x1f')]?_['map'](_0x5b721f[_0xebdb('0x1f')],function(_0x59d9f7){return{'model':db[_0x59d9f7[_0xebdb('0x21')]],'as':_0x59d9f7['as'],'attributes':_0x59d9f7[_0xebdb('0x22')],'include':_0x59d9f7['include']?_[_0xebdb('0x20')](_0x59d9f7['include'],function(_0x497642){return{'model':db[_0x497642[_0xebdb('0x21')]],'as':_0x497642['as'],'attributes':_0x497642[_0xebdb('0x22')]};}):[]};}):[]};}):[]:[]})[_0xebdb('0xf')](function(_0x5136f2){logger[_0xebdb('0x10')](_0xebdb('0x1a'),_0x253c65);logger[_0xebdb('0x11')](_0xebdb('0x1a'),_0x253c65,JSON[_0xebdb('0x14')](_0x5136f2));_0x5c76cc(_0x5136f2);})['catch'](function(_0x538920){logger[_0xebdb('0x15')](_0xebdb('0x1a'),_0x538920['message'],_0x253c65);_0x38a4dd(_0x28e85b['error'](0x1f4,_0x538920['message']));});});};exports['ShowChatQueue']=function(_0x2ba46e){var _0x5f578a=this;return new Promise(function(_0x38637c,_0xd1843){return db['ChatQueue']['find']({'raw':_0x2ba46e[_0xebdb('0x1c')]?_0x2ba46e[_0xebdb('0x1c')][_0xebdb('0x23')]===undefined?!![]:![]:!![],'where':_0x2ba46e['options']?_0x2ba46e[_0xebdb('0x1c')][_0xebdb('0x1d')]||null:null,'attributes':_0x2ba46e[_0xebdb('0x1c')]?_0x2ba46e[_0xebdb('0x1c')][_0xebdb('0x22')]||null:null,'include':_0x2ba46e[_0xebdb('0x1c')]?_0x2ba46e['options'][_0xebdb('0x1f')]?_[_0xebdb('0x20')](_0x2ba46e[_0xebdb('0x1c')][_0xebdb('0x1f')],function(_0x3dc8d3){return{'model':db[_0x3dc8d3[_0xebdb('0x21')]],'as':_0x3dc8d3['as'],'attributes':_0x3dc8d3[_0xebdb('0x22')],'include':_0x3dc8d3[_0xebdb('0x1f')]?_[_0xebdb('0x20')](_0x3dc8d3['include'],function(_0x4fb00a){return{'model':db[_0x4fb00a['model']],'as':_0x4fb00a['as'],'attributes':_0x4fb00a[_0xebdb('0x22')],'include':_0x4fb00a[_0xebdb('0x1f')]?_['map'](_0x4fb00a[_0xebdb('0x1f')],function(_0x31fb4c){return{'model':db[_0x31fb4c['model']],'as':_0x31fb4c['as'],'attributes':_0x31fb4c[_0xebdb('0x22')]};}):[]};}):[]};}):[]:[]})[_0xebdb('0xf')](function(_0x4dd3c2){logger['info'](_0xebdb('0x24'),_0x2ba46e);logger[_0xebdb('0x11')](_0xebdb('0x24'),_0x2ba46e,JSON['stringify'](_0x4dd3c2));_0x38637c(_0x4dd3c2);})[_0xebdb('0x25')](function(_0x123644){logger[_0xebdb('0x15')](_0xebdb('0x24'),_0x123644[_0xebdb('0x18')],_0x2ba46e);_0xd1843(_0x5f578a[_0xebdb('0x15')](0x1f4,_0x123644[_0xebdb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 04f186b..fbaae46 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 _0x222f=['./chatQueue.events','save','remove','update','emit','register'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x222f,0x1a4));var _0xf222=function(_0x279755,_0x42ad77){_0x279755=_0x279755-0x0;var _0x138178=_0x222f[_0x279755];return _0x138178;};'use strict';var ChatQueueEvents=require(_0xf222('0x0'));var events=[_0xf222('0x1'),_0xf222('0x2'),_0xf222('0x3')];function createListener(_0x4d09ec,_0x4b4237){return function(_0x195de1){_0x4b4237[_0xf222('0x4')](_0x4d09ec,_0x195de1);};}function removeListener(_0x307791,_0x7b187d){return function(){ChatQueueEvents['removeListener'](_0x307791,_0x7b187d);};}exports[_0xf222('0x5')]=function(_0x54a758){for(var _0x112e6d=0x0,_0x26f129=events['length'];_0x112e6d<_0x26f129;_0x112e6d++){var _0xf5a105=events[_0x112e6d];var _0x302d7a=createListener('chatQueue:'+_0xf5a105,_0x54a758);ChatQueueEvents['on'](_0xf5a105,_0x302d7a);}}; \ No newline at end of file +var _0x6f0d=['update','emit','removeListener','length','save','remove'];(function(_0x70a8a5,_0x35a384){var _0x2b563b=function(_0x4bbb5b){while(--_0x4bbb5b){_0x70a8a5['push'](_0x70a8a5['shift']());}};_0x2b563b(++_0x35a384);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x2e9f87,_0x246ba8){_0x2e9f87=_0x2e9f87-0x0;var _0x43eb1c=_0x6f0d[_0x2e9f87];return _0x43eb1c;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0xd6f0('0x0'),_0xd6f0('0x1'),_0xd6f0('0x2')];function createListener(_0x107a8c,_0x573473){return function(_0x275230){_0x573473[_0xd6f0('0x3')](_0x107a8c,_0x275230);};}function removeListener(_0x2f78fb,_0x25344b){return function(){ChatQueueEvents[_0xd6f0('0x4')](_0x2f78fb,_0x25344b);};}exports['register']=function(_0x2d2ce6){for(var _0x4a8b0c=0x0,_0xe21ac4=events[_0xd6f0('0x5')];_0x4a8b0c<_0xe21ac4;_0x4a8b0c++){var _0x8b89a9=events[_0x4a8b0c];var _0x1a48a0=createListener('chatQueue:'+_0x8b89a9,_0x2d2ce6);ChatQueueEvents['on'](_0x8b89a9,_0x1a48a0);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index a22d8a2..1864af2 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 _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x48de73,_0x5cb42f){var _0x2ff266=function(_0xa2b9ea){while(--_0xa2b9ea){_0x48de73['push'](_0x48de73['shift']());}};_0x2ff266(++_0x5cb42f);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x5cae73,_0x7deb8f){var _0x2722ce=function(_0x702135){while(--_0x702135){_0x5cae73['push'](_0x5cae73['shift']());}};_0x2722ce(++_0x7deb8f);}(_0x55ca,0x126));var _0xa55c=function(_0x143a91,_0x235332){_0x143a91=_0x143a91-0x0;var _0x1906f5=_0x55ca[_0x143a91];return _0x1906f5;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 1752f0d..518246e 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 _0xf2ad=['STRING','DATE','moment','exports'];(function(_0x3515a0,_0xc6dccf){var _0x560260=function(_0x171b46){while(--_0x171b46){_0x3515a0['push'](_0x3515a0['shift']());}};_0x560260(++_0xc6dccf);}(_0xf2ad,0x1f2));var _0xdf2a=function(_0x25efdf,_0x521462){_0x25efdf=_0x25efdf-0x0;var _0x22c495=_0xf2ad[_0x25efdf];return _0x22c495;};'use strict';var moment=require(_0xdf2a('0x0'));var Sequelize=require('sequelize');module[_0xdf2a('0x1')]={'uniqueid':{'type':Sequelize[_0xdf2a('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xdf2a('0x2')]},'joinAt':{'type':Sequelize[_0xdf2a('0x3')]},'leaveAt':{'type':Sequelize[_0xdf2a('0x3')]},'acceptAt':{'type':Sequelize[_0xdf2a('0x3')]},'exitAt':{'type':Sequelize[_0xdf2a('0x3')]},'reason':{'type':Sequelize[_0xdf2a('0x2')]}}; \ No newline at end of file +var _0xea3a=['sequelize','exports','STRING','DATE','moment'];(function(_0x35df37,_0x927820){var _0x30f707=function(_0x1b0475){while(--_0x1b0475){_0x35df37['push'](_0x35df37['shift']());}};_0x30f707(++_0x927820);}(_0xea3a,0x13f));var _0xaea3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xea3a[_0x4565bf];return _0x5610ba;};'use strict';var moment=require(_0xaea3('0x0'));var Sequelize=require(_0xaea3('0x1'));module[_0xaea3('0x2')]={'uniqueid':{'type':Sequelize[_0xaea3('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xaea3('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xaea3('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xaea3('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index f24420e..b8b12f8 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 _0x36f3=['map','includeAll','include','findAll','rows','catch','show','params','filters','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','undefined','limit','offset','count','set','json','apply','reject','save','update','then','destroy','error','name','index','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','where','pick','merge'];(function(_0x143cfd,_0x1a336e){var _0x2cb5f5=function(_0x1523fa){while(--_0x1523fa){_0x143cfd['push'](_0x143cfd['shift']());}};_0x2cb5f5(++_0x1a336e);}(_0x36f3,0xe6));var _0x336f=function(_0x4099af,_0x1578bf){_0x4099af=_0x4099af-0x0;var _0x46e189=_0x36f3[_0x4099af];return _0x46e189;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x336f('0x0'));var zipdir=require(_0x336f('0x1'));var jsonpatch=require(_0x336f('0x2'));var rp=require(_0x336f('0x3'));var moment=require(_0x336f('0x4'));var BPromise=require(_0x336f('0x5'));var Mustache=require(_0x336f('0x6'));var util=require(_0x336f('0x7'));var path=require(_0x336f('0x8'));var sox=require('sox');var csv=require(_0x336f('0x9'));var ejs=require(_0x336f('0xa'));var fs=require('fs');var fs_extra=require(_0x336f('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x336f('0xc'));var jsforce=require(_0x336f('0xd'));var deskjs=require(_0x336f('0xe'));var toCsv=require(_0x336f('0x9'));var querystring=require(_0x336f('0xf'));var Papa=require(_0x336f('0x10'));var Redis=require(_0x336f('0x11'));var authService=require(_0x336f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x336f('0x13'));var hardwareService=require(_0x336f('0x14'));var logger=require(_0x336f('0x15'))(_0x336f('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x336f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2edd0c,_0x29f1ff){_0x29f1ff=_0x29f1ff||0xcc;return function(_0x4986ba){if(_0x4986ba){return _0x2edd0c[_0x336f('0x18')](_0x29f1ff);}return _0x2edd0c[_0x336f('0x19')](_0x29f1ff)[_0x336f('0x1a')]();};}function respondWithResult(_0x14f88f,_0x12c5e0){_0x12c5e0=_0x12c5e0||0xc8;return function(_0x1e021b){if(_0x1e021b){return _0x14f88f[_0x336f('0x19')](_0x12c5e0)['json'](_0x1e021b);}};}function respondWithFilteredResult(_0x163061,_0x670ed5){return function(_0x3c7d01){if(_0x3c7d01){var _0x115be9=typeof _0x670ed5['offset']===_0x336f('0x1b')&&typeof _0x670ed5[_0x336f('0x1c')]===_0x336f('0x1b');var _0x724918=_0x3c7d01['count'];var _0xbbe464=_0x115be9?0x0:_0x670ed5[_0x336f('0x1d')];var _0x5d1eec=_0x115be9?_0x3c7d01[_0x336f('0x1e')]:_0x670ed5[_0x336f('0x1d')]+_0x670ed5[_0x336f('0x1c')];var _0x5a7d0d;if(_0x5d1eec>=_0x724918){_0x5d1eec=_0x724918;_0x5a7d0d=0xc8;}else{_0x5a7d0d=0xce;}_0x163061[_0x336f('0x19')](_0x5a7d0d);return _0x163061[_0x336f('0x1f')]('Content-Range',_0xbbe464+'-'+_0x5d1eec+'/'+_0x724918)[_0x336f('0x20')](_0x3c7d01);}return null;};}function patchUpdates(_0x245612){return function(_0x13b12c){try{jsonpatch[_0x336f('0x21')](_0x13b12c,_0x245612,!![]);}catch(_0x4ebd9f){return BPromise[_0x336f('0x22')](_0x4ebd9f);}return _0x13b12c[_0x336f('0x23')]();};}function saveUpdates(_0x183a5d,_0x2031b3){return function(_0x175637){if(_0x175637){return _0x175637[_0x336f('0x24')](_0x183a5d)[_0x336f('0x25')](function(_0x20ee82){return _0x20ee82;});}return null;};}function removeEntity(_0x26de86,_0x149fc){return function(_0x1a6e60){if(_0x1a6e60){return _0x1a6e60[_0x336f('0x26')]()[_0x336f('0x25')](function(){_0x26de86['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x386d6f,_0x377bcd){return function(_0x1aa9c0){if(!_0x1aa9c0){_0x386d6f[_0x336f('0x18')](0x194);}return _0x1aa9c0;};}function handleError(_0x526cc1,_0x1cfba1){_0x1cfba1=_0x1cfba1||0x1f4;return function(_0x282e07){logger[_0x336f('0x27')](_0x282e07['stack']);if(_0x282e07[_0x336f('0x28')]){delete _0x282e07[_0x336f('0x28')];}_0x526cc1[_0x336f('0x19')](_0x1cfba1)['send'](_0x282e07);};}exports[_0x336f('0x29')]=function(_0x1c6bb9,_0x395aad){var _0x1195c1={},_0x19e727={},_0x2978b8={'count':0x0,'rows':[]};var _0x5d5684=_['map'](db[_0x336f('0x2a')][_0x336f('0x2b')],function(_0x390ded){return{'name':_0x390ded[_0x336f('0x2c')],'type':_0x390ded[_0x336f('0x2d')][_0x336f('0x2e')]};});_0x19e727[_0x336f('0x2f')]=_['map'](_0x5d5684,_0x336f('0x28'));_0x19e727[_0x336f('0x30')]=_[_0x336f('0x31')](_0x1c6bb9['query']);_0x19e727['filters']=_[_0x336f('0x32')](_0x19e727[_0x336f('0x2f')],_0x19e727['query']);_0x1195c1[_0x336f('0x33')]=_[_0x336f('0x32')](_0x19e727['model'],qs[_0x336f('0x34')](_0x1c6bb9[_0x336f('0x30')][_0x336f('0x34')]));_0x1195c1[_0x336f('0x33')]=_0x1195c1[_0x336f('0x33')][_0x336f('0x35')]?_0x1195c1['attributes']:_0x19e727['model'];if(!_0x1c6bb9['query'][_0x336f('0x36')]('nolimit')){_0x1195c1[_0x336f('0x1c')]=qs[_0x336f('0x1c')](_0x1c6bb9['query'][_0x336f('0x1c')]);_0x1195c1[_0x336f('0x1d')]=qs[_0x336f('0x1d')](_0x1c6bb9[_0x336f('0x30')]['offset']);}_0x1195c1['order']=qs['sort'](_0x1c6bb9[_0x336f('0x30')]['sort']);_0x1195c1[_0x336f('0x37')]=qs['filters'](_[_0x336f('0x38')](_0x1c6bb9[_0x336f('0x30')],_0x19e727['filters']),_0x5d5684);if(_0x1c6bb9[_0x336f('0x30')]['filter']){_0x1195c1['where']=_[_0x336f('0x39')](_0x1195c1[_0x336f('0x37')],{'$or':_[_0x336f('0x3a')](_0x5d5684,function(_0x5c0cd8){if(_0x5c0cd8['type']!=='VIRTUAL'){var _0x32c243={};_0x32c243[_0x5c0cd8['name']]={'$like':'%'+_0x1c6bb9[_0x336f('0x30')]['filter']+'%'};return _0x32c243;}})});}_0x1195c1=_[_0x336f('0x39')]({},_0x1195c1,_0x1c6bb9['options']);var _0x442dae={'where':_0x1195c1['where']};return db[_0x336f('0x2a')][_0x336f('0x1e')](_0x442dae)[_0x336f('0x25')](function(_0x2dc122){_0x2978b8[_0x336f('0x1e')]=_0x2dc122;if(_0x1c6bb9[_0x336f('0x30')][_0x336f('0x3b')]){_0x1195c1[_0x336f('0x3c')]=[{'all':!![]}];}return db[_0x336f('0x2a')][_0x336f('0x3d')](_0x1195c1);})[_0x336f('0x25')](function(_0x1c4f7c){_0x2978b8[_0x336f('0x3e')]=_0x1c4f7c;return _0x2978b8;})['then'](respondWithFilteredResult(_0x395aad,_0x1195c1))[_0x336f('0x3f')](handleError(_0x395aad,null));};exports[_0x336f('0x40')]=function(_0x2d0708,_0x572315){var _0x7c5f5d={'raw':!![],'where':{'id':_0x2d0708[_0x336f('0x41')]['id']}},_0xe5cbd3={};_0xe5cbd3['model']=_[_0x336f('0x31')](db[_0x336f('0x2a')]['rawAttributes']);_0xe5cbd3[_0x336f('0x30')]=_[_0x336f('0x31')](_0x2d0708[_0x336f('0x30')]);_0xe5cbd3[_0x336f('0x42')]=_[_0x336f('0x32')](_0xe5cbd3[_0x336f('0x2f')],_0xe5cbd3[_0x336f('0x30')]);_0x7c5f5d['attributes']=_[_0x336f('0x32')](_0xe5cbd3['model'],qs[_0x336f('0x34')](_0x2d0708[_0x336f('0x30')]['fields']));_0x7c5f5d[_0x336f('0x33')]=_0x7c5f5d['attributes']['length']?_0x7c5f5d[_0x336f('0x33')]:_0xe5cbd3[_0x336f('0x2f')];if(_0x2d0708[_0x336f('0x30')][_0x336f('0x3b')]){_0x7c5f5d[_0x336f('0x3c')]=[{'all':!![]}];}_0x7c5f5d=_[_0x336f('0x39')]({},_0x7c5f5d,_0x2d0708[_0x336f('0x43')]);return db[_0x336f('0x2a')][_0x336f('0x44')](_0x7c5f5d)['then'](handleEntityNotFound(_0x572315,null))[_0x336f('0x25')](respondWithResult(_0x572315,null))['catch'](handleError(_0x572315,null));};exports['create']=function(_0x1b8802,_0x21c6ee){return db[_0x336f('0x2a')][_0x336f('0x45')](_0x1b8802[_0x336f('0x46')],{})[_0x336f('0x25')](respondWithResult(_0x21c6ee,0xc9))[_0x336f('0x3f')](handleError(_0x21c6ee,null));};exports[_0x336f('0x24')]=function(_0x5809e1,_0xc5bd24){if(_0x5809e1[_0x336f('0x46')]['id']){delete _0x5809e1[_0x336f('0x46')]['id'];}return db[_0x336f('0x2a')][_0x336f('0x44')]({'where':{'id':_0x5809e1['params']['id']}})['then'](handleEntityNotFound(_0xc5bd24,null))[_0x336f('0x25')](saveUpdates(_0x5809e1[_0x336f('0x46')],null))[_0x336f('0x25')](respondWithResult(_0xc5bd24,null))[_0x336f('0x3f')](handleError(_0xc5bd24,null));};exports[_0x336f('0x26')]=function(_0x7a21b2,_0x5ada31){return db['ChatQueueReport']['find']({'where':{'id':_0x7a21b2[_0x336f('0x41')]['id']}})[_0x336f('0x25')](handleEntityNotFound(_0x5ada31,null))[_0x336f('0x25')](removeEntity(_0x5ada31,null))['catch'](handleError(_0x5ada31,null));};exports[_0x336f('0x47')]=function(_0x10345b,_0x10f8b2){return db[_0x336f('0x2a')][_0x336f('0x47')]()['then'](respondWithResult(_0x10f8b2,null))[_0x336f('0x3f')](handleError(_0x10f8b2,null));}; \ No newline at end of file +var _0x9d56=['end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','name','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','show','keys','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','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'];(function(_0x2578d1,_0x2990b6){var _0x2567da=function(_0x5be91b){while(--_0x5be91b){_0x2578d1['push'](_0x2578d1['shift']());}};_0x2567da(++_0x2990b6);}(_0x9d56,0x122));var _0x69d5=function(_0x21105e,_0x4a91a7){_0x21105e=_0x21105e-0x0;var _0x15988c=_0x9d56[_0x21105e];return _0x15988c;};'use strict';var emlformat=require(_0x69d5('0x0'));var rimraf=require(_0x69d5('0x1'));var zipdir=require(_0x69d5('0x2'));var jsonpatch=require(_0x69d5('0x3'));var rp=require('request-promise');var moment=require(_0x69d5('0x4'));var BPromise=require(_0x69d5('0x5'));var Mustache=require(_0x69d5('0x6'));var util=require(_0x69d5('0x7'));var path=require(_0x69d5('0x8'));var sox=require('sox');var csv=require(_0x69d5('0x9'));var ejs=require(_0x69d5('0xa'));var fs=require('fs');var fs_extra=require(_0x69d5('0xb'));var _=require(_0x69d5('0xc'));var squel=require(_0x69d5('0xd'));var crypto=require(_0x69d5('0xe'));var jsforce=require(_0x69d5('0xf'));var deskjs=require(_0x69d5('0x10'));var toCsv=require(_0x69d5('0x9'));var querystring=require(_0x69d5('0x11'));var Papa=require(_0x69d5('0x12'));var Redis=require(_0x69d5('0x13'));var authService=require(_0x69d5('0x14'));var qs=require(_0x69d5('0x15'));var as=require(_0x69d5('0x16'));var hardwareService=require(_0x69d5('0x17'));var logger=require(_0x69d5('0x18'))(_0x69d5('0x19'));var utils=require(_0x69d5('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x69d5('0x1b'));var db=require(_0x69d5('0x1c'))['db'];function respondWithStatusCode(_0x2cc733,_0x4641a7){_0x4641a7=_0x4641a7||0xcc;return function(_0x1c34d9){if(_0x1c34d9){return _0x2cc733['sendStatus'](_0x4641a7);}return _0x2cc733[_0x69d5('0x1d')](_0x4641a7)[_0x69d5('0x1e')]();};}function respondWithResult(_0x263954,_0x134e84){_0x134e84=_0x134e84||0xc8;return function(_0x56843c){if(_0x56843c){return _0x263954['status'](_0x134e84)['json'](_0x56843c);}};}function respondWithFilteredResult(_0x279ce5,_0x33cf2e){return function(_0x56bbbc){if(_0x56bbbc){var _0x28492b=typeof _0x33cf2e[_0x69d5('0x1f')]==='undefined'&&typeof _0x33cf2e[_0x69d5('0x20')]===_0x69d5('0x21');var _0x304417=_0x56bbbc[_0x69d5('0x22')];var _0x16e628=_0x28492b?0x0:_0x33cf2e[_0x69d5('0x1f')];var _0x6763ac=_0x28492b?_0x56bbbc[_0x69d5('0x22')]:_0x33cf2e['offset']+_0x33cf2e[_0x69d5('0x20')];var _0x16c02c;if(_0x6763ac>=_0x304417){_0x6763ac=_0x304417;_0x16c02c=0xc8;}else{_0x16c02c=0xce;}_0x279ce5[_0x69d5('0x1d')](_0x16c02c);return _0x279ce5[_0x69d5('0x23')](_0x69d5('0x24'),_0x16e628+'-'+_0x6763ac+'/'+_0x304417)[_0x69d5('0x25')](_0x56bbbc);}return null;};}function patchUpdates(_0x1f9ed7){return function(_0xc557e3){try{jsonpatch[_0x69d5('0x26')](_0xc557e3,_0x1f9ed7,!![]);}catch(_0x497c1a){return BPromise['reject'](_0x497c1a);}return _0xc557e3[_0x69d5('0x27')]();};}function saveUpdates(_0x3fc1a4,_0xa81fe0){return function(_0x1558b6){if(_0x1558b6){return _0x1558b6[_0x69d5('0x28')](_0x3fc1a4)[_0x69d5('0x29')](function(_0x1ec0d3){return _0x1ec0d3;});}return null;};}function removeEntity(_0x22e984,_0x23ee57){return function(_0x49b3f5){if(_0x49b3f5){return _0x49b3f5[_0x69d5('0x2a')]()[_0x69d5('0x29')](function(){_0x22e984[_0x69d5('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e1d8d,_0x53ea6e){return function(_0x5e27e7){if(!_0x5e27e7){_0x2e1d8d[_0x69d5('0x2b')](0x194);}return _0x5e27e7;};}function handleError(_0x49b94f,_0x27ffd8){_0x27ffd8=_0x27ffd8||0x1f4;return function(_0x7636f2){logger[_0x69d5('0x2c')](_0x7636f2['stack']);if(_0x7636f2[_0x69d5('0x2d')]){delete _0x7636f2[_0x69d5('0x2d')];}_0x49b94f[_0x69d5('0x1d')](_0x27ffd8)['send'](_0x7636f2);};}exports['index']=function(_0x3f0ced,_0x41173f){var _0x2892a6={},_0x4d8fb={},_0xf4edd9={'count':0x0,'rows':[]};var _0x4d961f=_[_0x69d5('0x2e')](db[_0x69d5('0x2f')][_0x69d5('0x30')],function(_0x252f43){return{'name':_0x252f43[_0x69d5('0x31')],'type':_0x252f43[_0x69d5('0x32')][_0x69d5('0x33')]};});_0x4d8fb[_0x69d5('0x34')]=_['map'](_0x4d961f,_0x69d5('0x2d'));_0x4d8fb[_0x69d5('0x35')]=_['keys'](_0x3f0ced[_0x69d5('0x35')]);_0x4d8fb['filters']=_[_0x69d5('0x36')](_0x4d8fb[_0x69d5('0x34')],_0x4d8fb[_0x69d5('0x35')]);_0x2892a6['attributes']=_[_0x69d5('0x36')](_0x4d8fb[_0x69d5('0x34')],qs['fields'](_0x3f0ced[_0x69d5('0x35')][_0x69d5('0x37')]));_0x2892a6[_0x69d5('0x38')]=_0x2892a6['attributes'][_0x69d5('0x39')]?_0x2892a6[_0x69d5('0x38')]:_0x4d8fb[_0x69d5('0x34')];if(!_0x3f0ced[_0x69d5('0x35')][_0x69d5('0x3a')](_0x69d5('0x3b'))){_0x2892a6[_0x69d5('0x20')]=qs[_0x69d5('0x20')](_0x3f0ced[_0x69d5('0x35')][_0x69d5('0x20')]);_0x2892a6[_0x69d5('0x1f')]=qs[_0x69d5('0x1f')](_0x3f0ced[_0x69d5('0x35')][_0x69d5('0x1f')]);}_0x2892a6[_0x69d5('0x3c')]=qs[_0x69d5('0x3d')](_0x3f0ced[_0x69d5('0x35')]['sort']);_0x2892a6[_0x69d5('0x3e')]=qs[_0x69d5('0x3f')](_[_0x69d5('0x40')](_0x3f0ced['query'],_0x4d8fb[_0x69d5('0x3f')]),_0x4d961f);if(_0x3f0ced[_0x69d5('0x35')][_0x69d5('0x41')]){_0x2892a6['where']=_[_0x69d5('0x42')](_0x2892a6['where'],{'$or':_[_0x69d5('0x2e')](_0x4d961f,function(_0x1ae187){if(_0x1ae187[_0x69d5('0x32')]!=='VIRTUAL'){var _0x45ca18={};_0x45ca18[_0x1ae187[_0x69d5('0x2d')]]={'$like':'%'+_0x3f0ced[_0x69d5('0x35')][_0x69d5('0x41')]+'%'};return _0x45ca18;}})});}_0x2892a6=_['merge']({},_0x2892a6,_0x3f0ced[_0x69d5('0x43')]);var _0x661bca={'where':_0x2892a6[_0x69d5('0x3e')]};return db[_0x69d5('0x2f')][_0x69d5('0x22')](_0x661bca)[_0x69d5('0x29')](function(_0x51a8f1){_0xf4edd9[_0x69d5('0x22')]=_0x51a8f1;if(_0x3f0ced['query']['includeAll']){_0x2892a6[_0x69d5('0x44')]=[{'all':!![]}];}return db[_0x69d5('0x2f')][_0x69d5('0x45')](_0x2892a6);})[_0x69d5('0x29')](function(_0xa93202){_0xf4edd9[_0x69d5('0x46')]=_0xa93202;return _0xf4edd9;})[_0x69d5('0x29')](respondWithFilteredResult(_0x41173f,_0x2892a6))[_0x69d5('0x47')](handleError(_0x41173f,null));};exports[_0x69d5('0x48')]=function(_0x23527b,_0x13075d){var _0x5d2ba2={'raw':!![],'where':{'id':_0x23527b['params']['id']}},_0x4cf243={};_0x4cf243['model']=_[_0x69d5('0x49')](db[_0x69d5('0x2f')][_0x69d5('0x30')]);_0x4cf243[_0x69d5('0x35')]=_[_0x69d5('0x49')](_0x23527b[_0x69d5('0x35')]);_0x4cf243['filters']=_['intersection'](_0x4cf243[_0x69d5('0x34')],_0x4cf243[_0x69d5('0x35')]);_0x5d2ba2[_0x69d5('0x38')]=_[_0x69d5('0x36')](_0x4cf243[_0x69d5('0x34')],qs[_0x69d5('0x37')](_0x23527b[_0x69d5('0x35')][_0x69d5('0x37')]));_0x5d2ba2['attributes']=_0x5d2ba2['attributes'][_0x69d5('0x39')]?_0x5d2ba2[_0x69d5('0x38')]:_0x4cf243[_0x69d5('0x34')];if(_0x23527b[_0x69d5('0x35')][_0x69d5('0x4a')]){_0x5d2ba2[_0x69d5('0x44')]=[{'all':!![]}];}_0x5d2ba2=_['merge']({},_0x5d2ba2,_0x23527b['options']);return db[_0x69d5('0x2f')][_0x69d5('0x4b')](_0x5d2ba2)[_0x69d5('0x29')](handleEntityNotFound(_0x13075d,null))[_0x69d5('0x29')](respondWithResult(_0x13075d,null))[_0x69d5('0x47')](handleError(_0x13075d,null));};exports[_0x69d5('0x4c')]=function(_0x37a47e,_0x173e85){return db[_0x69d5('0x2f')][_0x69d5('0x4c')](_0x37a47e['body'],{})[_0x69d5('0x29')](respondWithResult(_0x173e85,0xc9))[_0x69d5('0x47')](handleError(_0x173e85,null));};exports[_0x69d5('0x28')]=function(_0x4497b4,_0x1a4ed4){if(_0x4497b4['body']['id']){delete _0x4497b4[_0x69d5('0x4d')]['id'];}return db['ChatQueueReport'][_0x69d5('0x4b')]({'where':{'id':_0x4497b4[_0x69d5('0x4e')]['id']}})[_0x69d5('0x29')](handleEntityNotFound(_0x1a4ed4,null))['then'](saveUpdates(_0x4497b4[_0x69d5('0x4d')],null))[_0x69d5('0x29')](respondWithResult(_0x1a4ed4,null))[_0x69d5('0x47')](handleError(_0x1a4ed4,null));};exports[_0x69d5('0x2a')]=function(_0x153ca4,_0x5266ce){return db[_0x69d5('0x2f')][_0x69d5('0x4b')]({'where':{'id':_0x153ca4[_0x69d5('0x4e')]['id']}})[_0x69d5('0x29')](handleEntityNotFound(_0x5266ce,null))[_0x69d5('0x29')](removeEntity(_0x5266ce,null))[_0x69d5('0x47')](handleError(_0x5266ce,null));};exports[_0x69d5('0x4f')]=function(_0xa04ef2,_0x2ef443){return db[_0x69d5('0x2f')][_0x69d5('0x4f')]()[_0x69d5('0x29')](respondWithResult(_0x2ef443,null))[_0x69d5('0x47')](handleError(_0x2ef443,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 3abd2b9..54a1b93 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x26b5ff,_0x92009a){var _0x58603e=function(_0x4454ff){while(--_0x4454ff){_0x26b5ff['push'](_0x26b5ff['shift']());}};_0x58603e(++_0x92009a);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0xbcacfd,_0x5d02ab){var _0x3cba9e=function(_0x5d6b95){while(--_0x5d6b95){_0xbcacfd['push'](_0xbcacfd['shift']());}};_0x3cba9e(++_0x5d02ab);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 3bcd53e..fe69e51 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 _0x6206=['ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','options','UpdateChatQueueReport','update','body','where','attributes','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x32f1ef,_0x51a021){var _0x2e89d2=function(_0x338da0){while(--_0x338da0){_0x32f1ef['push'](_0x32f1ef['shift']());}};_0x2e89d2(++_0x51a021);}(_0x6206,0x1b4));var _0x6620=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x6206[_0x4b7895];return _0x264180;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6620('0x0'));var BPromise=require(_0x6620('0x1'));var rs=require(_0x6620('0x2'));var fs=require('fs');var Redis=require(_0x6620('0x3'));var db=require(_0x6620('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6620('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6620('0x6'));var client=jayson[_0x6620('0x7')][_0x6620('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x329c79,_0x414470,_0x2f1de0){return new BPromise(function(_0x1f2a98,_0xd1730c){return client[_0x6620('0x9')](_0x329c79,_0x2f1de0)[_0x6620('0xa')](function(_0x359f76){logger[_0x6620('0xb')](_0x6620('0xc'),_0x414470,_0x6620('0xd'));logger['debug'](_0x6620('0xe'),_0x414470,'request\x20sent',JSON[_0x6620('0xf')](_0x359f76));if(_0x359f76['error']){if(_0x359f76[_0x6620('0x10')]['code']===0x1f4){logger[_0x6620('0x10')](_0x6620('0xc'),_0x414470,_0x359f76[_0x6620('0x10')]['message']);return _0xd1730c(_0x359f76[_0x6620('0x10')]['message']);}logger[_0x6620('0x10')](_0x6620('0xc'),_0x414470,_0x359f76[_0x6620('0x10')][_0x6620('0x11')]);return _0x1f2a98(_0x359f76[_0x6620('0x10')][_0x6620('0x11')]);}else{logger[_0x6620('0xb')](_0x6620('0xc'),_0x414470,'request\x20sent');_0x1f2a98(_0x359f76[_0x6620('0x12')][_0x6620('0x11')]);}})[_0x6620('0x13')](function(_0x2512ac){logger[_0x6620('0x10')](_0x6620('0xc'),_0x414470,_0x2512ac);_0xd1730c(_0x2512ac);});});}exports[_0x6620('0x14')]=function(_0x33874d){var _0x2fa1f7=this;return new Promise(function(_0x180e16,_0x557489){return db[_0x6620('0x15')][_0x6620('0x16')](_0x33874d['body'],{'raw':_0x33874d[_0x6620('0x17')]?_0x33874d['options']['raw']===undefined?!![]:![]:!![]})[_0x6620('0xa')](function(_0x2341c5){logger['info'](_0x6620('0x14'),_0x33874d);logger['debug'](_0x6620('0x14'),_0x33874d,JSON[_0x6620('0xf')](_0x2341c5));_0x180e16(_0x2341c5);})[_0x6620('0x13')](function(_0x410008){logger[_0x6620('0x10')](_0x6620('0x14'),_0x410008[_0x6620('0x11')],_0x33874d);_0x557489(_0x2fa1f7[_0x6620('0x10')](0x1f4,_0x410008[_0x6620('0x11')]));});});};exports[_0x6620('0x18')]=function(_0x48ee6d){var _0x2eb9ef=this;return new Promise(function(_0x181a63,_0x1e5cf7){return db[_0x6620('0x15')][_0x6620('0x19')](_0x48ee6d[_0x6620('0x1a')],{'raw':_0x48ee6d[_0x6620('0x17')]?_0x48ee6d[_0x6620('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48ee6d[_0x6620('0x17')]?_0x48ee6d[_0x6620('0x17')][_0x6620('0x1b')]||null:null,'attributes':_0x48ee6d[_0x6620('0x17')]?_0x48ee6d[_0x6620('0x17')][_0x6620('0x1c')]||null:null,'limit':_0x48ee6d[_0x6620('0x17')]?_0x48ee6d[_0x6620('0x17')][_0x6620('0x1d')]||null:null})[_0x6620('0xa')](function(_0x548046){logger[_0x6620('0xb')](_0x6620('0x18'),_0x48ee6d);logger['debug'](_0x6620('0x18'),_0x48ee6d,JSON[_0x6620('0xf')](_0x548046));_0x181a63(_0x548046);})['catch'](function(_0x24b4fd){logger['error'](_0x6620('0x18'),_0x24b4fd['message'],_0x48ee6d);_0x1e5cf7(_0x2eb9ef[_0x6620('0x10')](0x1f4,_0x24b4fd['message']));});});}; \ No newline at end of file +var _0xa2b6=['then','UpdateChatQueueReport','update','body','where','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw'];(function(_0x4067ac,_0x363603){var _0x53d74d=function(_0x492ad4){while(--_0x492ad4){_0x4067ac['push'](_0x4067ac['shift']());}};_0x53d74d(++_0x363603);}(_0xa2b6,0x1a6));var _0x6a2b=function(_0x5aa4ac,_0x74073a){_0x5aa4ac=_0x5aa4ac-0x0;var _0x31dfb8=_0xa2b6[_0x5aa4ac];return _0x31dfb8;};'use strict';var _=require(_0x6a2b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6a2b('0x1'));var rs=require(_0x6a2b('0x2'));var fs=require('fs');var Redis=require(_0x6a2b('0x3'));var db=require(_0x6a2b('0x4'))['db'];var utils=require(_0x6a2b('0x5'));var logger=require(_0x6a2b('0x6'))(_0x6a2b('0x7'));var config=require('../../config/environment');var jayson=require(_0x6a2b('0x8'));var client=jayson[_0x6a2b('0x9')][_0x6a2b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d6d5e,_0xfbd0c4,_0x17528d){return new BPromise(function(_0x2edd87,_0x5f1260){return client[_0x6a2b('0xb')](_0x4d6d5e,_0x17528d)['then'](function(_0x4c2c8b){logger[_0x6a2b('0xc')](_0x6a2b('0xd'),_0xfbd0c4,_0x6a2b('0xe'));logger['debug'](_0x6a2b('0xf'),_0xfbd0c4,_0x6a2b('0xe'),JSON[_0x6a2b('0x10')](_0x4c2c8b));if(_0x4c2c8b['error']){if(_0x4c2c8b[_0x6a2b('0x11')]['code']===0x1f4){logger[_0x6a2b('0x11')](_0x6a2b('0xd'),_0xfbd0c4,_0x4c2c8b[_0x6a2b('0x11')][_0x6a2b('0x12')]);return _0x5f1260(_0x4c2c8b['error'][_0x6a2b('0x12')]);}logger[_0x6a2b('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0xfbd0c4,_0x4c2c8b[_0x6a2b('0x11')][_0x6a2b('0x12')]);return _0x2edd87(_0x4c2c8b['error']['message']);}else{logger[_0x6a2b('0xc')](_0x6a2b('0xd'),_0xfbd0c4,_0x6a2b('0xe'));_0x2edd87(_0x4c2c8b[_0x6a2b('0x13')][_0x6a2b('0x12')]);}})[_0x6a2b('0x14')](function(_0x237151){logger['error'](_0x6a2b('0xd'),_0xfbd0c4,_0x237151);_0x5f1260(_0x237151);});});}exports[_0x6a2b('0x15')]=function(_0x149b51){var _0x98920=this;return new Promise(function(_0x20ad3a,_0x4db38d){return db[_0x6a2b('0x16')][_0x6a2b('0x17')](_0x149b51['body'],{'raw':_0x149b51[_0x6a2b('0x18')]?_0x149b51[_0x6a2b('0x18')][_0x6a2b('0x19')]===undefined?!![]:![]:!![]})[_0x6a2b('0x1a')](function(_0x2f9642){logger['info'](_0x6a2b('0x15'),_0x149b51);logger['debug']('CreateChatQueueReport',_0x149b51,JSON[_0x6a2b('0x10')](_0x2f9642));_0x20ad3a(_0x2f9642);})[_0x6a2b('0x14')](function(_0x30d78d){logger[_0x6a2b('0x11')](_0x6a2b('0x15'),_0x30d78d[_0x6a2b('0x12')],_0x149b51);_0x4db38d(_0x98920[_0x6a2b('0x11')](0x1f4,_0x30d78d[_0x6a2b('0x12')]));});});};exports[_0x6a2b('0x1b')]=function(_0xda7851){var _0x5e83be=this;return new Promise(function(_0x352949,_0x6389bb){return db[_0x6a2b('0x16')][_0x6a2b('0x1c')](_0xda7851[_0x6a2b('0x1d')],{'raw':_0xda7851[_0x6a2b('0x18')]?_0xda7851[_0x6a2b('0x18')][_0x6a2b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xda7851[_0x6a2b('0x18')]?_0xda7851[_0x6a2b('0x18')][_0x6a2b('0x1e')]||null:null,'attributes':_0xda7851['options']?_0xda7851[_0x6a2b('0x18')]['attributes']||null:null,'limit':_0xda7851[_0x6a2b('0x18')]?_0xda7851[_0x6a2b('0x18')][_0x6a2b('0x1f')]||null:null})[_0x6a2b('0x1a')](function(_0x4d2877){logger[_0x6a2b('0xc')](_0x6a2b('0x1b'),_0xda7851);logger['debug'](_0x6a2b('0x1b'),_0xda7851,JSON['stringify'](_0x4d2877));_0x352949(_0x4d2877);})[_0x6a2b('0x14')](function(_0x3c6f34){logger[_0x6a2b('0x11')](_0x6a2b('0x1b'),_0x3c6f34[_0x6a2b('0x12')],_0xda7851);_0x6389bb(_0x5e83be[_0x6a2b('0x11')](0x1f4,_0x3c6f34[_0x6a2b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 7e586e3..3a197e7 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 _0x9453=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./chatQueueReport.controller','get','index','/describe','describe','isAuthenticated','show','put','/:id','update'];(function(_0xe6391c,_0x322480){var _0x3f396f=function(_0x13f612){while(--_0x13f612){_0xe6391c['push'](_0xe6391c['shift']());}};_0x3f396f(++_0x322480);}(_0x9453,0x88));var _0x3945=function(_0x393650,_0x7f8f1f){_0x393650=_0x393650-0x0;var _0x18e2db=_0x9453[_0x393650];return _0x18e2db;};'use strict';var multer=require(_0x3945('0x0'));var util=require(_0x3945('0x1'));var path=require(_0x3945('0x2'));var timeout=require(_0x3945('0x3'));var express=require('express');var router=express[_0x3945('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3945('0x5'));var config=require('../../config/environment');var controller=require(_0x3945('0x6'));router[_0x3945('0x7')]('/',auth['isAuthenticated'](),controller[_0x3945('0x8')]);router[_0x3945('0x7')](_0x3945('0x9'),auth['isAuthenticated'](),controller[_0x3945('0xa')]);router['get']('/:id',auth[_0x3945('0xb')](),controller[_0x3945('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x3945('0xd')](_0x3945('0xe'),auth[_0x3945('0xb')](),controller[_0x3945('0xf')]);router[_0x3945('0x10')](_0x3945('0xe'),auth[_0x3945('0xb')](),controller[_0x3945('0x11')]);module[_0x3945('0x12')]=router; \ No newline at end of file +var _0xf329=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','exports','multer'];(function(_0x13ea36,_0x2805ad){var _0x312066=function(_0xfbee88){while(--_0xfbee88){_0x13ea36['push'](_0x13ea36['shift']());}};_0x312066(++_0x2805ad);}(_0xf329,0x1a3));var _0x9f32=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf329[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9f32('0x0'));var util=require(_0x9f32('0x1'));var path=require('path');var timeout=require(_0x9f32('0x2'));var express=require(_0x9f32('0x3'));var router=express[_0x9f32('0x4')]();var fs_extra=require(_0x9f32('0x5'));var auth=require(_0x9f32('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9f32('0x7'));var controller=require(_0x9f32('0x8'));router[_0x9f32('0x9')]('/',auth[_0x9f32('0xa')](),controller[_0x9f32('0xb')]);router[_0x9f32('0x9')](_0x9f32('0xc'),auth[_0x9f32('0xa')](),controller[_0x9f32('0xd')]);router[_0x9f32('0x9')](_0x9f32('0xe'),auth['isAuthenticated'](),controller[_0x9f32('0xf')]);router['post']('/',auth[_0x9f32('0xa')](),controller[_0x9f32('0x10')]);router[_0x9f32('0x11')](_0x9f32('0xe'),auth['isAuthenticated'](),controller[_0x9f32('0x12')]);router[_0x9f32('0x13')](_0x9f32('0xe'),auth[_0x9f32('0xa')](),controller['destroy']);module[_0x9f32('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index e9c7814..6370781 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x4bb593,_0x272ed0){var _0x2da2d8=function(_0x4b25e9){while(--_0x4b25e9){_0x4bb593['push'](_0x4bb593['shift']());}};_0x2da2d8(++_0x272ed0);}(_0xaa88,0x137));var _0x8aa8=function(_0x3efe87,_0x35ad48){_0x3efe87=_0x3efe87-0x0;var _0x56a4cc=_0xaa88[_0x3efe87];return _0x56a4cc;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x5634df,_0x332cf8){var _0x4f2d43=function(_0x5a6a03){while(--_0x5a6a03){_0x5634df['push'](_0x5634df['shift']());}};_0x4f2d43(++_0x332cf8);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5ca74a,_0x3a057c){_0x5ca74a=_0x5ca74a-0x0;var _0x96e793=_0xf4eb[_0x5ca74a];return _0x96e793;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 348dfff..2ef2006 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 _0xae35=['papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','end','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','include','findAll','params','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','jsforce','desk.js','to-csv','querystring'];(function(_0x48a6e7,_0x5e9ecf){var _0x428fa7=function(_0x5e691a){while(--_0x5e691a){_0x48a6e7['push'](_0x48a6e7['shift']());}};_0x428fa7(++_0x5e9ecf);}(_0xae35,0x7b));var _0x5ae3=function(_0x294649,_0x4c0712){_0x294649=_0x294649-0x0;var _0x1225a8=_0xae35[_0x294649];return _0x1225a8;};'use strict';var emlformat=require(_0x5ae3('0x0'));var rimraf=require(_0x5ae3('0x1'));var zipdir=require(_0x5ae3('0x2'));var jsonpatch=require(_0x5ae3('0x3'));var rp=require(_0x5ae3('0x4'));var moment=require(_0x5ae3('0x5'));var BPromise=require(_0x5ae3('0x6'));var Mustache=require(_0x5ae3('0x7'));var util=require(_0x5ae3('0x8'));var path=require(_0x5ae3('0x9'));var sox=require(_0x5ae3('0xa'));var csv=require('to-csv');var ejs=require(_0x5ae3('0xb'));var fs=require('fs');var fs_extra=require(_0x5ae3('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5ae3('0xd'));var deskjs=require(_0x5ae3('0xe'));var toCsv=require(_0x5ae3('0xf'));var querystring=require(_0x5ae3('0x10'));var Papa=require(_0x5ae3('0x11'));var Redis=require(_0x5ae3('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5ae3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ae3('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x5ae3('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f974d,_0x19f66a){_0x19f66a=_0x19f66a||0xcc;return function(_0x5cb990){if(_0x5cb990){return _0x4f974d[_0x5ae3('0x16')](_0x19f66a);}return _0x4f974d['status'](_0x19f66a)['end']();};}function respondWithResult(_0x47b657,_0x3e8907){_0x3e8907=_0x3e8907||0xc8;return function(_0x2b7f95){if(_0x2b7f95){return _0x47b657[_0x5ae3('0x17')](_0x3e8907)[_0x5ae3('0x18')](_0x2b7f95);}};}function respondWithFilteredResult(_0xc8eb21,_0x3b4982){return function(_0x1dd78b){if(_0x1dd78b){var _0x17cf57=typeof _0x3b4982[_0x5ae3('0x19')]===_0x5ae3('0x1a')&&typeof _0x3b4982[_0x5ae3('0x1b')]===_0x5ae3('0x1a');var _0x28d2db=_0x1dd78b[_0x5ae3('0x1c')];var _0x2d88d1=_0x17cf57?0x0:_0x3b4982[_0x5ae3('0x19')];var _0x2083b8=_0x17cf57?_0x1dd78b['count']:_0x3b4982['offset']+_0x3b4982[_0x5ae3('0x1b')];var _0xed1955;if(_0x2083b8>=_0x28d2db){_0x2083b8=_0x28d2db;_0xed1955=0xc8;}else{_0xed1955=0xce;}_0xc8eb21['status'](_0xed1955);return _0xc8eb21[_0x5ae3('0x1d')]('Content-Range',_0x2d88d1+'-'+_0x2083b8+'/'+_0x28d2db)[_0x5ae3('0x18')](_0x1dd78b);}return null;};}function patchUpdates(_0x1e0005){return function(_0x43cc98){try{jsonpatch[_0x5ae3('0x1e')](_0x43cc98,_0x1e0005,!![]);}catch(_0xa9e73){return BPromise['reject'](_0xa9e73);}return _0x43cc98[_0x5ae3('0x1f')]();};}function saveUpdates(_0x3f6c55,_0x4c218c){return function(_0x413a7f){if(_0x413a7f){return _0x413a7f[_0x5ae3('0x20')](_0x3f6c55)[_0x5ae3('0x21')](function(_0x30530b){return _0x30530b;});}return null;};}function removeEntity(_0x494534,_0x22188f){return function(_0x3c8816){if(_0x3c8816){return _0x3c8816['destroy']()['then'](function(){_0x494534['status'](0xcc)[_0x5ae3('0x22')]();});}};}function handleEntityNotFound(_0x1196ff,_0x380521){return function(_0x2f54af){if(!_0x2f54af){_0x1196ff[_0x5ae3('0x16')](0x194);}return _0x2f54af;};}function handleError(_0x28e1ca,_0x20f4b0){_0x20f4b0=_0x20f4b0||0x1f4;return function(_0x3a0fcf){logger[_0x5ae3('0x23')](_0x3a0fcf[_0x5ae3('0x24')]);if(_0x3a0fcf[_0x5ae3('0x25')]){delete _0x3a0fcf[_0x5ae3('0x25')];}_0x28e1ca[_0x5ae3('0x17')](_0x20f4b0)[_0x5ae3('0x26')](_0x3a0fcf);};}exports[_0x5ae3('0x27')]=function(_0x40e6b4,_0x4ad139){var _0x24029c={},_0x591f10={},_0xf29ba8={'count':0x0,'rows':[]};var _0x225c2e=_[_0x5ae3('0x28')](db[_0x5ae3('0x29')][_0x5ae3('0x2a')],function(_0x1bd406){return{'name':_0x1bd406['fieldName'],'type':_0x1bd406[_0x5ae3('0x2b')]['key']};});_0x591f10[_0x5ae3('0x2c')]=_['map'](_0x225c2e,'name');_0x591f10['query']=_[_0x5ae3('0x2d')](_0x40e6b4[_0x5ae3('0x2e')]);_0x591f10['filters']=_[_0x5ae3('0x2f')](_0x591f10[_0x5ae3('0x2c')],_0x591f10[_0x5ae3('0x2e')]);_0x24029c[_0x5ae3('0x30')]=_['intersection'](_0x591f10[_0x5ae3('0x2c')],qs['fields'](_0x40e6b4[_0x5ae3('0x2e')][_0x5ae3('0x31')]));_0x24029c[_0x5ae3('0x30')]=_0x24029c[_0x5ae3('0x30')][_0x5ae3('0x32')]?_0x24029c[_0x5ae3('0x30')]:_0x591f10['model'];if(!_0x40e6b4['query'][_0x5ae3('0x33')](_0x5ae3('0x34'))){_0x24029c[_0x5ae3('0x1b')]=qs['limit'](_0x40e6b4[_0x5ae3('0x2e')][_0x5ae3('0x1b')]);_0x24029c[_0x5ae3('0x19')]=qs[_0x5ae3('0x19')](_0x40e6b4[_0x5ae3('0x2e')][_0x5ae3('0x19')]);}_0x24029c[_0x5ae3('0x35')]=qs[_0x5ae3('0x36')](_0x40e6b4[_0x5ae3('0x2e')][_0x5ae3('0x36')]);_0x24029c['where']=qs[_0x5ae3('0x37')](_[_0x5ae3('0x38')](_0x40e6b4[_0x5ae3('0x2e')],_0x591f10[_0x5ae3('0x37')]),_0x225c2e);if(_0x40e6b4[_0x5ae3('0x2e')][_0x5ae3('0x39')]){_0x24029c['where']=_[_0x5ae3('0x3a')](_0x24029c[_0x5ae3('0x3b')],{'$or':_[_0x5ae3('0x28')](_0x225c2e,function(_0x96f71d){if(_0x96f71d[_0x5ae3('0x2b')]!==_0x5ae3('0x3c')){var _0x5eb838={};_0x5eb838[_0x96f71d[_0x5ae3('0x25')]]={'$like':'%'+_0x40e6b4['query']['filter']+'%'};return _0x5eb838;}})});}_0x24029c=_[_0x5ae3('0x3a')]({},_0x24029c,_0x40e6b4[_0x5ae3('0x3d')]);var _0x4e3af5={'where':_0x24029c[_0x5ae3('0x3b')]};return db[_0x5ae3('0x29')][_0x5ae3('0x1c')](_0x4e3af5)['then'](function(_0x5eac03){_0xf29ba8[_0x5ae3('0x1c')]=_0x5eac03;if(_0x40e6b4[_0x5ae3('0x2e')]['includeAll']){_0x24029c[_0x5ae3('0x3e')]=[{'all':!![]}];}return db[_0x5ae3('0x29')][_0x5ae3('0x3f')](_0x24029c);})[_0x5ae3('0x21')](function(_0x55c05e){_0xf29ba8['rows']=_0x55c05e;return _0xf29ba8;})['then'](respondWithFilteredResult(_0x4ad139,_0x24029c))['catch'](handleError(_0x4ad139,null));};exports['show']=function(_0x320f0f,_0x3ab133){var _0x4e4be3={'raw':!![],'where':{'id':_0x320f0f[_0x5ae3('0x40')]['id']}},_0x23c363={};_0x23c363['model']=_[_0x5ae3('0x2d')](db[_0x5ae3('0x29')]['rawAttributes']);_0x23c363[_0x5ae3('0x2e')]=_[_0x5ae3('0x2d')](_0x320f0f['query']);_0x23c363[_0x5ae3('0x37')]=_[_0x5ae3('0x2f')](_0x23c363[_0x5ae3('0x2c')],_0x23c363[_0x5ae3('0x2e')]);_0x4e4be3[_0x5ae3('0x30')]=_[_0x5ae3('0x2f')](_0x23c363[_0x5ae3('0x2c')],qs[_0x5ae3('0x31')](_0x320f0f[_0x5ae3('0x2e')]['fields']));_0x4e4be3[_0x5ae3('0x30')]=_0x4e4be3[_0x5ae3('0x30')][_0x5ae3('0x32')]?_0x4e4be3[_0x5ae3('0x30')]:_0x23c363[_0x5ae3('0x2c')];if(_0x320f0f[_0x5ae3('0x2e')]['includeAll']){_0x4e4be3['include']=[{'all':!![]}];}_0x4e4be3=_['merge']({},_0x4e4be3,_0x320f0f[_0x5ae3('0x3d')]);return db[_0x5ae3('0x29')]['find'](_0x4e4be3)[_0x5ae3('0x21')](handleEntityNotFound(_0x3ab133,null))[_0x5ae3('0x21')](respondWithResult(_0x3ab133,null))[_0x5ae3('0x41')](handleError(_0x3ab133,null));};exports[_0x5ae3('0x42')]=function(_0x198f03,_0x57be84){return db[_0x5ae3('0x29')][_0x5ae3('0x42')](_0x198f03[_0x5ae3('0x43')],{})['then'](respondWithResult(_0x57be84,0xc9))[_0x5ae3('0x41')](handleError(_0x57be84,null));};exports['update']=function(_0x32b1f7,_0x16019e){if(_0x32b1f7[_0x5ae3('0x43')]['id']){delete _0x32b1f7['body']['id'];}return db[_0x5ae3('0x29')]['find']({'where':{'id':_0x32b1f7[_0x5ae3('0x40')]['id']}})[_0x5ae3('0x21')](handleEntityNotFound(_0x16019e,null))[_0x5ae3('0x21')](saveUpdates(_0x32b1f7[_0x5ae3('0x43')],null))[_0x5ae3('0x21')](respondWithResult(_0x16019e,null))[_0x5ae3('0x41')](handleError(_0x16019e,null));};exports[_0x5ae3('0x44')]=function(_0x482872,_0x573c3e){return db[_0x5ae3('0x29')]['find']({'where':{'id':_0x482872[_0x5ae3('0x40')]['id']}})[_0x5ae3('0x21')](handleEntityNotFound(_0x573c3e,null))[_0x5ae3('0x21')](removeEntity(_0x573c3e,null))[_0x5ae3('0x41')](handleError(_0x573c3e,null));};exports['describe']=function(_0x37c690,_0x344b1f){return db['ChatTransferReport'][_0x5ae3('0x45')]()[_0x5ae3('0x21')](respondWithResult(_0x344b1f,null))['catch'](handleError(_0x344b1f,null));}; \ No newline at end of file +var _0x8d02=['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','../../mysqldb','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','sox'];(function(_0x4f0f32,_0x5f4739){var _0x40dcd4=function(_0x40591e){while(--_0x40591e){_0x4f0f32['push'](_0x4f0f32['shift']());}};_0x40dcd4(++_0x5f4739);}(_0x8d02,0xda));var _0x28d0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8d02[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x28d0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x28d0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x28d0('0x2'));var moment=require(_0x28d0('0x3'));var BPromise=require(_0x28d0('0x4'));var Mustache=require(_0x28d0('0x5'));var util=require('util');var path=require('path');var sox=require(_0x28d0('0x6'));var csv=require('to-csv');var ejs=require(_0x28d0('0x7'));var fs=require('fs');var fs_extra=require(_0x28d0('0x8'));var _=require('lodash');var squel=require(_0x28d0('0x9'));var crypto=require(_0x28d0('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x28d0('0xb'));var toCsv=require(_0x28d0('0xc'));var querystring=require(_0x28d0('0xd'));var Papa=require(_0x28d0('0xe'));var Redis=require(_0x28d0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x28d0('0x10'));var as=require(_0x28d0('0x11'));var hardwareService=require(_0x28d0('0x12'));var logger=require(_0x28d0('0x13'))(_0x28d0('0x14'));var utils=require(_0x28d0('0x15'));var config=require(_0x28d0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x28d0('0x17'))['db'];function respondWithStatusCode(_0xd3bbf5,_0x39acde){_0x39acde=_0x39acde||0xcc;return function(_0x3dba0f){if(_0x3dba0f){return _0xd3bbf5['sendStatus'](_0x39acde);}return _0xd3bbf5['status'](_0x39acde)[_0x28d0('0x18')]();};}function respondWithResult(_0x38ec12,_0x4e9601){_0x4e9601=_0x4e9601||0xc8;return function(_0x57b769){if(_0x57b769){return _0x38ec12['status'](_0x4e9601)[_0x28d0('0x19')](_0x57b769);}};}function respondWithFilteredResult(_0x30a606,_0x3ef19b){return function(_0x4a950f){if(_0x4a950f){var _0x4ad6d4=typeof _0x3ef19b[_0x28d0('0x1a')]===_0x28d0('0x1b')&&typeof _0x3ef19b[_0x28d0('0x1c')]==='undefined';var _0x1129b8=_0x4a950f[_0x28d0('0x1d')];var _0x4d3ada=_0x4ad6d4?0x0:_0x3ef19b[_0x28d0('0x1a')];var _0x8fd22a=_0x4ad6d4?_0x4a950f[_0x28d0('0x1d')]:_0x3ef19b['offset']+_0x3ef19b[_0x28d0('0x1c')];var _0x3b3bfd;if(_0x8fd22a>=_0x1129b8){_0x8fd22a=_0x1129b8;_0x3b3bfd=0xc8;}else{_0x3b3bfd=0xce;}_0x30a606[_0x28d0('0x1e')](_0x3b3bfd);return _0x30a606['set'](_0x28d0('0x1f'),_0x4d3ada+'-'+_0x8fd22a+'/'+_0x1129b8)['json'](_0x4a950f);}return null;};}function patchUpdates(_0x588a0d){return function(_0x3933ca){try{jsonpatch[_0x28d0('0x20')](_0x3933ca,_0x588a0d,!![]);}catch(_0x53bfaa){return BPromise[_0x28d0('0x21')](_0x53bfaa);}return _0x3933ca[_0x28d0('0x22')]();};}function saveUpdates(_0x48428b,_0x101bc9){return function(_0x556df9){if(_0x556df9){return _0x556df9[_0x28d0('0x23')](_0x48428b)[_0x28d0('0x24')](function(_0x98ee3){return _0x98ee3;});}return null;};}function removeEntity(_0x3b89ca,_0x4f1db7){return function(_0x4f3976){if(_0x4f3976){return _0x4f3976[_0x28d0('0x25')]()[_0x28d0('0x24')](function(){_0x3b89ca[_0x28d0('0x1e')](0xcc)[_0x28d0('0x18')]();});}};}function handleEntityNotFound(_0x42c5cf,_0x8dca0c){return function(_0x35909e){if(!_0x35909e){_0x42c5cf[_0x28d0('0x26')](0x194);}return _0x35909e;};}function handleError(_0x30fbb9,_0x3416c7){_0x3416c7=_0x3416c7||0x1f4;return function(_0x28c6fc){logger[_0x28d0('0x27')](_0x28c6fc[_0x28d0('0x28')]);if(_0x28c6fc[_0x28d0('0x29')]){delete _0x28c6fc[_0x28d0('0x29')];}_0x30fbb9[_0x28d0('0x1e')](_0x3416c7)[_0x28d0('0x2a')](_0x28c6fc);};}exports[_0x28d0('0x2b')]=function(_0x45dca8,_0x2b0229){var _0x1fa18={},_0x2b9659={},_0x44ec2e={'count':0x0,'rows':[]};var _0x13b395=_[_0x28d0('0x2c')](db[_0x28d0('0x2d')][_0x28d0('0x2e')],function(_0x29e546){return{'name':_0x29e546[_0x28d0('0x2f')],'type':_0x29e546[_0x28d0('0x30')][_0x28d0('0x31')]};});_0x2b9659[_0x28d0('0x32')]=_[_0x28d0('0x2c')](_0x13b395,_0x28d0('0x29'));_0x2b9659[_0x28d0('0x33')]=_[_0x28d0('0x34')](_0x45dca8['query']);_0x2b9659[_0x28d0('0x35')]=_[_0x28d0('0x36')](_0x2b9659[_0x28d0('0x32')],_0x2b9659[_0x28d0('0x33')]);_0x1fa18['attributes']=_[_0x28d0('0x36')](_0x2b9659['model'],qs[_0x28d0('0x37')](_0x45dca8[_0x28d0('0x33')]['fields']));_0x1fa18[_0x28d0('0x38')]=_0x1fa18[_0x28d0('0x38')][_0x28d0('0x39')]?_0x1fa18[_0x28d0('0x38')]:_0x2b9659[_0x28d0('0x32')];if(!_0x45dca8[_0x28d0('0x33')]['hasOwnProperty']('nolimit')){_0x1fa18['limit']=qs[_0x28d0('0x1c')](_0x45dca8['query'][_0x28d0('0x1c')]);_0x1fa18[_0x28d0('0x1a')]=qs['offset'](_0x45dca8[_0x28d0('0x33')][_0x28d0('0x1a')]);}_0x1fa18['order']=qs['sort'](_0x45dca8[_0x28d0('0x33')][_0x28d0('0x3a')]);_0x1fa18[_0x28d0('0x3b')]=qs[_0x28d0('0x35')](_[_0x28d0('0x3c')](_0x45dca8[_0x28d0('0x33')],_0x2b9659[_0x28d0('0x35')]),_0x13b395);if(_0x45dca8['query'][_0x28d0('0x3d')]){_0x1fa18['where']=_[_0x28d0('0x3e')](_0x1fa18[_0x28d0('0x3b')],{'$or':_[_0x28d0('0x2c')](_0x13b395,function(_0x29bac6){if(_0x29bac6[_0x28d0('0x30')]!==_0x28d0('0x3f')){var _0x17e1d9={};_0x17e1d9[_0x29bac6[_0x28d0('0x29')]]={'$like':'%'+_0x45dca8[_0x28d0('0x33')][_0x28d0('0x3d')]+'%'};return _0x17e1d9;}})});}_0x1fa18=_[_0x28d0('0x3e')]({},_0x1fa18,_0x45dca8[_0x28d0('0x40')]);var _0xe42ba9={'where':_0x1fa18[_0x28d0('0x3b')]};return db[_0x28d0('0x2d')][_0x28d0('0x1d')](_0xe42ba9)[_0x28d0('0x24')](function(_0x3a3343){_0x44ec2e[_0x28d0('0x1d')]=_0x3a3343;if(_0x45dca8[_0x28d0('0x33')][_0x28d0('0x41')]){_0x1fa18[_0x28d0('0x42')]=[{'all':!![]}];}return db[_0x28d0('0x2d')][_0x28d0('0x43')](_0x1fa18);})['then'](function(_0x4a140b){_0x44ec2e[_0x28d0('0x44')]=_0x4a140b;return _0x44ec2e;})[_0x28d0('0x24')](respondWithFilteredResult(_0x2b0229,_0x1fa18))[_0x28d0('0x45')](handleError(_0x2b0229,null));};exports['show']=function(_0x334d69,_0x2816d3){var _0x536f73={'raw':!![],'where':{'id':_0x334d69[_0x28d0('0x46')]['id']}},_0x43a5f6={};_0x43a5f6[_0x28d0('0x32')]=_[_0x28d0('0x34')](db[_0x28d0('0x2d')][_0x28d0('0x2e')]);_0x43a5f6['query']=_[_0x28d0('0x34')](_0x334d69[_0x28d0('0x33')]);_0x43a5f6[_0x28d0('0x35')]=_[_0x28d0('0x36')](_0x43a5f6[_0x28d0('0x32')],_0x43a5f6['query']);_0x536f73[_0x28d0('0x38')]=_['intersection'](_0x43a5f6['model'],qs[_0x28d0('0x37')](_0x334d69[_0x28d0('0x33')]['fields']));_0x536f73[_0x28d0('0x38')]=_0x536f73['attributes'][_0x28d0('0x39')]?_0x536f73[_0x28d0('0x38')]:_0x43a5f6[_0x28d0('0x32')];if(_0x334d69[_0x28d0('0x33')]['includeAll']){_0x536f73[_0x28d0('0x42')]=[{'all':!![]}];}_0x536f73=_[_0x28d0('0x3e')]({},_0x536f73,_0x334d69[_0x28d0('0x40')]);return db[_0x28d0('0x2d')][_0x28d0('0x47')](_0x536f73)[_0x28d0('0x24')](handleEntityNotFound(_0x2816d3,null))[_0x28d0('0x24')](respondWithResult(_0x2816d3,null))[_0x28d0('0x45')](handleError(_0x2816d3,null));};exports[_0x28d0('0x48')]=function(_0x3b0c55,_0x4d0674){return db['ChatTransferReport'][_0x28d0('0x48')](_0x3b0c55[_0x28d0('0x49')],{})[_0x28d0('0x24')](respondWithResult(_0x4d0674,0xc9))['catch'](handleError(_0x4d0674,null));};exports[_0x28d0('0x23')]=function(_0x4fb803,_0x2d753b){if(_0x4fb803[_0x28d0('0x49')]['id']){delete _0x4fb803[_0x28d0('0x49')]['id'];}return db[_0x28d0('0x2d')][_0x28d0('0x47')]({'where':{'id':_0x4fb803['params']['id']}})[_0x28d0('0x24')](handleEntityNotFound(_0x2d753b,null))[_0x28d0('0x24')](saveUpdates(_0x4fb803[_0x28d0('0x49')],null))[_0x28d0('0x24')](respondWithResult(_0x2d753b,null))[_0x28d0('0x45')](handleError(_0x2d753b,null));};exports[_0x28d0('0x25')]=function(_0x1e946e,_0x3abeeb){return db['ChatTransferReport']['find']({'where':{'id':_0x1e946e['params']['id']}})['then'](handleEntityNotFound(_0x3abeeb,null))[_0x28d0('0x24')](removeEntity(_0x3abeeb,null))[_0x28d0('0x45')](handleError(_0x3abeeb,null));};exports[_0x28d0('0x4a')]=function(_0x514fb6,_0x8f2cb3){return db[_0x28d0('0x2d')]['describe']()['then'](respondWithResult(_0x8f2cb3,null))[_0x28d0('0x45')](handleError(_0x8f2cb3,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index e887951..3e69661 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 _0x7b31=['./chatTransferReport.attributes','exports','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x39899b,_0x5596c6){var _0x3eeb44=function(_0x34b483){while(--_0x34b483){_0x39899b['push'](_0x39899b['shift']());}};_0x3eeb44(++_0x5596c6);}(_0x7b31,0xee));var _0x17b3=function(_0x34fa36,_0x44121c){_0x34fa36=_0x34fa36-0x0;var _0x4acc08=_0x7b31[_0x34fa36];return _0x4acc08;};'use strict';var _=require(_0x17b3('0x0'));var util=require(_0x17b3('0x1'));var logger=require(_0x17b3('0x2'))(_0x17b3('0x3'));var moment=require(_0x17b3('0x4'));var BPromise=require(_0x17b3('0x5'));var rp=require(_0x17b3('0x6'));var fs=require('fs');var path=require(_0x17b3('0x7'));var rimraf=require('rimraf');var config=require(_0x17b3('0x8'));var attributes=require(_0x17b3('0x9'));module[_0x17b3('0xa')]=function(_0x58b47b,_0x2168b6){return _0x58b47b['define']('ChatTransferReport',attributes,{'tableName':_0x17b3('0xb'),'paranoid':![],'indexes':[{'name':_0x17b3('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x347c=['ChatTransferReport','uniqueid','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define'];(function(_0x2d67b4,_0x4ca8fe){var _0x4cd582=function(_0x21180a){while(--_0x21180a){_0x2d67b4['push'](_0x2d67b4['shift']());}};_0x4cd582(++_0x4ca8fe);}(_0x347c,0x16a));var _0xc347=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x347c[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0xc347('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc347('0x1'));var moment=require(_0xc347('0x2'));var BPromise=require('bluebird');var rp=require(_0xc347('0x3'));var fs=require('fs');var path=require(_0xc347('0x4'));var rimraf=require(_0xc347('0x5'));var config=require(_0xc347('0x6'));var attributes=require(_0xc347('0x7'));module[_0xc347('0x8')]=function(_0x423426,_0x503779){return _0x423426[_0xc347('0x9')](_0xc347('0xa'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xc347('0xb'),'fields':[_0xc347('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index a87fc23..55bd851 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 _0xbac3=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x3e4f43,_0x224773){var _0x30f56c=function(_0x381a0f){while(--_0x381a0f){_0x3e4f43['push'](_0x3e4f43['shift']());}};_0x30f56c(++_0x224773);}(_0xbac3,0x1ef));var _0x3bac=function(_0x13eaae,_0x11ec0a){_0x13eaae=_0x13eaae-0x0;var _0x4493db=_0xbac3[_0x13eaae];return _0x4493db;};'use strict';var _=require(_0x3bac('0x0'));var util=require('util');var moment=require(_0x3bac('0x1'));var BPromise=require(_0x3bac('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3bac('0x3'));var db=require(_0x3bac('0x4'))['db'];var utils=require(_0x3bac('0x5'));var logger=require(_0x3bac('0x6'))(_0x3bac('0x7'));var config=require(_0x3bac('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3bac('0x9')][_0x3bac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x157915,_0x828d0f,_0x385dea){return new BPromise(function(_0x196987,_0x5cf8de){return client[_0x3bac('0xb')](_0x157915,_0x385dea)[_0x3bac('0xc')](function(_0x2e96d8){logger[_0x3bac('0xd')](_0x3bac('0xe'),_0x828d0f,'request\x20sent');logger['debug']('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x828d0f,_0x3bac('0xf'),JSON['stringify'](_0x2e96d8));if(_0x2e96d8['error']){if(_0x2e96d8['error']['code']===0x1f4){logger[_0x3bac('0x10')](_0x3bac('0xe'),_0x828d0f,_0x2e96d8[_0x3bac('0x10')][_0x3bac('0x11')]);return _0x5cf8de(_0x2e96d8[_0x3bac('0x10')][_0x3bac('0x11')]);}logger[_0x3bac('0x10')](_0x3bac('0xe'),_0x828d0f,_0x2e96d8[_0x3bac('0x10')][_0x3bac('0x11')]);return _0x196987(_0x2e96d8[_0x3bac('0x10')][_0x3bac('0x11')]);}else{logger[_0x3bac('0xd')](_0x3bac('0xe'),_0x828d0f,_0x3bac('0xf'));_0x196987(_0x2e96d8['result'][_0x3bac('0x11')]);}})[_0x3bac('0x12')](function(_0x222764){logger[_0x3bac('0x10')](_0x3bac('0xe'),_0x828d0f,_0x222764);_0x5cf8de(_0x222764);});});} \ No newline at end of file +var _0x6c0f=['info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x7ad123,_0xeeeef3){var _0x37d073=function(_0x51367b){while(--_0x51367b){_0x7ad123['push'](_0x7ad123['shift']());}};_0x37d073(++_0xeeeef3);}(_0x6c0f,0x15c));var _0xf6c0=function(_0x5d6a08,_0x5f3a16){_0x5d6a08=_0x5d6a08-0x0;var _0x1f9acc=_0x6c0f[_0x5d6a08];return _0x1f9acc;};'use strict';var _=require(_0xf6c0('0x0'));var util=require('util');var moment=require(_0xf6c0('0x1'));var BPromise=require('bluebird');var rs=require(_0xf6c0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf6c0('0x3'))['db'];var utils=require(_0xf6c0('0x4'));var logger=require('../../config/logger')(_0xf6c0('0x5'));var config=require(_0xf6c0('0x6'));var jayson=require(_0xf6c0('0x7'));var client=jayson[_0xf6c0('0x8')][_0xf6c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41eef1,_0x4dbf84,_0x156324){return new BPromise(function(_0x4fe409,_0x105926){return client[_0xf6c0('0xa')](_0x41eef1,_0x156324)[_0xf6c0('0xb')](function(_0x30ec9b){logger[_0xf6c0('0xc')](_0xf6c0('0xd'),_0x4dbf84,_0xf6c0('0xe'));logger[_0xf6c0('0xf')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x4dbf84,_0xf6c0('0xe'),JSON[_0xf6c0('0x10')](_0x30ec9b));if(_0x30ec9b[_0xf6c0('0x11')]){if(_0x30ec9b[_0xf6c0('0x11')]['code']===0x1f4){logger[_0xf6c0('0x11')](_0xf6c0('0xd'),_0x4dbf84,_0x30ec9b['error'][_0xf6c0('0x12')]);return _0x105926(_0x30ec9b[_0xf6c0('0x11')][_0xf6c0('0x12')]);}logger['error'](_0xf6c0('0xd'),_0x4dbf84,_0x30ec9b[_0xf6c0('0x11')][_0xf6c0('0x12')]);return _0x4fe409(_0x30ec9b['error'][_0xf6c0('0x12')]);}else{logger[_0xf6c0('0xc')](_0xf6c0('0xd'),_0x4dbf84,_0xf6c0('0xe'));_0x4fe409(_0x30ec9b[_0xf6c0('0x13')]['message']);}})['catch'](function(_0x518eff){logger['error'](_0xf6c0('0xd'),_0x4dbf84,_0x518eff);_0x105926(_0x518eff);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 0de56ae..53df50e 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 _0x517e=['put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','show','post','create'];(function(_0x46ef1d,_0x24926){var _0x49ce69=function(_0x5db4fc){while(--_0x5db4fc){_0x46ef1d['push'](_0x46ef1d['shift']());}};_0x49ce69(++_0x24926);}(_0x517e,0x115));var _0xe517=function(_0x136a67,_0x50cc82){_0x136a67=_0x136a67-0x0;var _0x4d3ed2=_0x517e[_0x136a67];return _0x4d3ed2;};'use strict';var multer=require(_0xe517('0x0'));var util=require(_0xe517('0x1'));var path=require(_0xe517('0x2'));var timeout=require(_0xe517('0x3'));var express=require(_0xe517('0x4'));var router=express[_0xe517('0x5')]();var fs_extra=require(_0xe517('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe517('0x7'));var config=require(_0xe517('0x8'));var controller=require('./chatTransferReport.controller');router['get']('/',auth[_0xe517('0x9')](),controller[_0xe517('0xa')]);router[_0xe517('0xb')](_0xe517('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xe517('0xb')](_0xe517('0xd'),auth[_0xe517('0x9')](),controller[_0xe517('0xe')]);router[_0xe517('0xf')]('/',auth['isAuthenticated'](),controller[_0xe517('0x10')]);router[_0xe517('0x11')](_0xe517('0xd'),auth[_0xe517('0x9')](),controller[_0xe517('0x12')]);router[_0xe517('0x13')](_0xe517('0xd'),auth['isAuthenticated'](),controller[_0xe517('0x14')]);module['exports']=router; \ No newline at end of file +var _0x502b=['put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x1a5e46,_0x39c459){var _0x2edd08=function(_0x21e7b9){while(--_0x21e7b9){_0x1a5e46['push'](_0x1a5e46['shift']());}};_0x2edd08(++_0x39c459);}(_0x502b,0xdf));var _0xb502=function(_0x1a5946,_0x426991){_0x1a5946=_0x1a5946-0x0;var _0x25e9d5=_0x502b[_0x1a5946];return _0x25e9d5;};'use strict';var multer=require(_0xb502('0x0'));var util=require(_0xb502('0x1'));var path=require(_0xb502('0x2'));var timeout=require(_0xb502('0x3'));var express=require(_0xb502('0x4'));var router=express[_0xb502('0x5')]();var fs_extra=require(_0xb502('0x6'));var auth=require(_0xb502('0x7'));var interaction=require(_0xb502('0x8'));var config=require('../../config/environment');var controller=require(_0xb502('0x9'));router[_0xb502('0xa')]('/',auth['isAuthenticated'](),controller[_0xb502('0xb')]);router[_0xb502('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xb502('0xc'),auth[_0xb502('0xd')](),controller[_0xb502('0xe')]);router[_0xb502('0xf')]('/',auth[_0xb502('0xd')](),controller[_0xb502('0x10')]);router[_0xb502('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xb502('0x12')]);router[_0xb502('0x13')](_0xb502('0xc'),auth[_0xb502('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index fa06c2e..8bde91e 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 _0x2943=['New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','INTEGER','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Skip','Feedback','star','stringify','input','name','text','getDataValue','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','parse','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'];(function(_0x19456a,_0x44ae21){var _0x4c7a95=function(_0x5e49ff){while(--_0x5e49ff){_0x19456a['push'](_0x19456a['shift']());}};_0x4c7a95(++_0x44ae21);}(_0x2943,0xe6));var _0x3294=function(_0x2bddf9,_0x22c873){_0x2bddf9=_0x2bddf9-0x0;var _0x3f3ae9=_0x2943[_0x2bddf9];return _0x3f3ae9;};'use strict';var Sequelize=require(_0x3294('0x0'));var rs=require(_0x3294('0x1'));module[_0x3294('0x2')]={'name':{'type':Sequelize[_0x3294('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3294('0x4')},'description':{'type':Sequelize[_0x3294('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x3294('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x3294('0x6')},'customerAlias':{'type':Sequelize[_0x3294('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x3294('0x3')],'allowNull':![],'defaultValue':_0x3294('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3294('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3294('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3294('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x3294('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x3294('0xa')](_0x3294('0xb'),_0x3294('0xc')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x3294('0x3')],'defaultValue':_0x3294('0xd')},'start_chat_button':{'type':Sequelize[_0x3294('0x3')],'defaultValue':_0x3294('0xe')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x3294('0xf')},'header_offline':{'type':Sequelize[_0x3294('0x3')],'defaultValue':_0x3294('0x10')},'download_transcript':{'type':Sequelize[_0x3294('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x3294('0x11')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x3294('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x3294('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x3294('0x12')]},'closingQuestion':{'type':Sequelize[_0x3294('0x3')],'defaultValue':_0x3294('0x13')},'formSubmitSuccessMessage':{'type':Sequelize[_0x3294('0x3')],'defaultValue':_0x3294('0x14')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x3294('0x15')},'noteTitle':{'type':Sequelize[_0x3294('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x3294('0x16')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x3294('0x3')],'defaultValue':_0x3294('0xf')},'skipMessageButton':{'type':Sequelize[_0x3294('0x3')],'defaultValue':_0x3294('0x17')},'conditionAgreement':{'type':Sequelize[_0x3294('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x3294('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x3294('0x3')],'defaultValue':_0x3294('0x18')},'ratingType':{'type':Sequelize[_0x3294('0xa')](_0x3294('0x19'),'thumb'),'defaultValue':_0x3294('0x19')},'ratingStarsNumber':{'type':Sequelize[_0x3294('0x11')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x3294('0x12')],'defaultValue':function(){return JSON[_0x3294('0x1a')]({'items':[{'type':_0x3294('0x1b'),'variable':null,'config':{'placeholder':_0x3294('0x1c'),'type':_0x3294('0x1d'),'required':!![]},'props':{'title':_0x3294('0x1c'),'helpText':''}},{'type':_0x3294('0x1b'),'props':{'title':_0x3294('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x3294('0x5'),'type':_0x3294('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x3294('0x1e')](_0x3294('0x1f'))?JSON['parse'](this['getDataValue'](_0x3294('0x1f'))):{};},'set':function(_0x1b904b){return this[_0x3294('0x20')](_0x3294('0x1f'),JSON[_0x3294('0x1a')](_0x1b904b));}},'offlineForm':{'type':Sequelize[_0x3294('0x12')],'defaultValue':function(){return JSON[_0x3294('0x1a')]({'items':[{'type':_0x3294('0x1b'),'props':{'title':_0x3294('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x3294('0x5'),'type':_0x3294('0x5')},'variable':null},{'type':_0x3294('0x21'),'config':{'placeholder':_0x3294('0x22')},'props':{'title':'Comments','helpText':_0x3294('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0x3294('0x1e')](_0x3294('0x24'))?JSON[_0x3294('0x25')](this[_0x3294('0x1e')](_0x3294('0x24'))):{};},'set':function(_0x4811e5){return this[_0x3294('0x20')](_0x3294('0x24'),JSON[_0x3294('0x1a')](_0x4811e5));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x3294('0x26')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x3294('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x3294('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x3294('0x3')]},'forwardOffline':{'type':Sequelize[_0x3294('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x3294('0x3')]},'waitingTitle':{'type':Sequelize[_0x3294('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x3294('0x3')],'defaultValue':_0x3294('0x27')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x3294('0x28')},'offlineMessageBody':{'type':Sequelize[_0x3294('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x3294('0x3')],'defaultValue':_0x3294('0x29')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x3294('0x17')},'sendUnmanaged':{'type':Sequelize[_0x3294('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x3294('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x3294('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x3294('0x12')]},'showAgentAvatar':{'type':Sequelize[_0x3294('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x3294('0x12')],'defaultValue':function(){return _0x3294('0x2a');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x3294('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x3294('0x3')],'defaultValue':_0x3294('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x3294('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x3294('0x3')],'defaultValue':_0x3294('0x2c')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x3294('0x2d')},'messagesAlignment':{'type':Sequelize[_0x3294('0x3')],'defaultValue':_0x3294('0x2e')},'defaultTitle':{'type':Sequelize[_0x3294('0x3')]},'customerAvatar':{'type':Sequelize[_0x3294('0x12')]},'showCustomerAvatar':{'type':Sequelize[_0x3294('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x3294('0x11')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x3294('0x3')],'allowNull':![],'defaultValue':_0x3294('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x3294('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3294('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3294('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x3294('0x3')],'defaultValue':_0x3294('0x30')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3294('0x11')],'comment':_0x3294('0x31')},'mandatoryDisposition':{'type':Sequelize[_0x3294('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x59e320){if(!_0x59e320)this[_0x3294('0x20')](_0x3294('0x32'),null);this['setDataValue'](_0x3294('0x33'),_0x59e320);}},'vidaooEscalation':{'type':Sequelize[_0x3294('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x3294('0x3')]},'vidaooTopic':{'type':Sequelize[_0x3294('0x3')],'allowNull':![],'defaultValue':_0x3294('0x34')},'vidaooNote':{'type':Sequelize[_0x3294('0x3')],'defaultValue':function(){return _0x3294('0x35');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x3294('0x12')]}}; \ No newline at end of file +var _0xddfb=['STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','star','thumb','input','name','getDataValue','parse','onlineForm','setDataValue','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports'];(function(_0x77fd25,_0x226ea2){var _0xe14528=function(_0x1551d5){while(--_0x1551d5){_0x77fd25['push'](_0x77fd25['shift']());}};_0xe14528(++_0x226ea2);}(_0xddfb,0x101));var _0xbddf=function(_0x4b2d73,_0x57f61f){_0x4b2d73=_0x4b2d73-0x0;var _0x590b2c=_0xddfb[_0x4b2d73];return _0x590b2c;};'use strict';var Sequelize=require(_0xbddf('0x0'));var rs=require(_0xbddf('0x1'));module[_0xbddf('0x2')]={'name':{'type':Sequelize[_0xbddf('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xbddf('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xbddf('0x3')]},'mapKey':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0x4')},'mapKeyOffline':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0xbddf('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xbddf('0x5')},'customerAlias':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xbddf('0x3')],'allowNull':![],'defaultValue':_0xbddf('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xbddf('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbddf('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xbddf('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xbddf('0x3')]},'animation':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xbddf('0xa')](_0xbddf('0xb'),'squared'),'defaultValue':_0xbddf('0xb')},'header_online':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0xc')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xbddf('0xd')},'header_offline':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0xe')},'download_transcript':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xbddf('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xbddf('0xf')]},'closingQuestion':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0x12')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xbddf('0x13')},'closingMessage':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0x14')},'closingMessageButton':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0xd')},'skipMessageButton':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0x15')},'conditionAgreement':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xbddf('0xa')](_0xbddf('0x16'),_0xbddf('0x17')),'defaultValue':_0xbddf('0x16')},'ratingStarsNumber':{'type':Sequelize[_0xbddf('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xbddf('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xbddf('0x18'),'variable':null,'config':{'placeholder':_0xbddf('0x19'),'type':'text','required':!![]},'props':{'title':_0xbddf('0x19'),'helpText':''}},{'type':_0xbddf('0x18'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xbddf('0x4'),'type':_0xbddf('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xbddf('0x1a')]('onlineForm')?JSON[_0xbddf('0x1b')](this['getDataValue'](_0xbddf('0x1c'))):{};},'set':function(_0x267db7){return this[_0xbddf('0x1d')](_0xbddf('0x1c'),JSON[_0xbddf('0x1e')](_0x267db7));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','props':{'title':_0xbddf('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xbddf('0x4'),'type':_0xbddf('0x4')},'variable':null},{'type':_0xbddf('0x1f'),'config':{'placeholder':'Comments'},'props':{'title':_0xbddf('0x20'),'helpText':_0xbddf('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0xbddf('0x1a')](_0xbddf('0x22'))?JSON['parse'](this[_0xbddf('0x1a')](_0xbddf('0x22'))):{};},'set':function(_0x7668de){return this[_0xbddf('0x1d')](_0xbddf('0x22'),JSON[_0xbddf('0x1e')](_0x7668de));}},'token':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xbddf('0x3')]},'forwardOffline':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xbddf('0x3')]},'waitingTitle':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0x23')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xbddf('0x24')},'offlineMessageSubject':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0x25')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xbddf('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xbddf('0x27')},'skipUnmanaged':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0x15')},'sendUnmanaged':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xbddf('0xf')]},'showAgentAvatar':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xbddf('0xf')],'defaultValue':function(){return _0xbddf('0x28');}},'notificationSound':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0xbddf('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xbddf('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xbddf('0x2a')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0x2b')},'messagesAlignment':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0x2c')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xbddf('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xbddf('0x3')],'allowNull':![],'defaultValue':_0xbddf('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbddf('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xbddf('0x2e')},'systemAvatar':{'type':Sequelize[_0xbddf('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbddf('0x8')],'comment':_0xbddf('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':![],'comment':_0xbddf('0x30'),'set':function(_0x5ef7c6){if(!_0x5ef7c6)this[_0xbddf('0x1d')](_0xbddf('0x31'),null);this[_0xbddf('0x1d')](_0xbddf('0x32'),_0x5ef7c6);}},'vidaooEscalation':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xbddf('0x3')]},'vidaooTopic':{'type':Sequelize[_0xbddf('0x3')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':function(){return _0xbddf('0x33');}},'vidaooMetadata':{'type':Sequelize[_0xbddf('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index f6760fa..02c4609 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 _0x0fda=['queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','Sequelize','ValidationError','no\x20available\x20attributes','difference','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','offlineMessageBody','ChatOfflineMessage','server','attachments','basename','openNewInteraction','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','originalname','mimetype','subjectOffline','mapValues','Chat','notifyMail','offline-chat','remove','addInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','tag','getSnippet','virtual','custom','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','3.10.1','origin','http://localhost:9000','testWebsiteWithWildcard','remote','x-real-ip','connection','remoteAddress','render','alignment','textColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','sequelize','Transaction','READ_COMMITTED','finally','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','getFields','online','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','path','ejs','fs-extra','lodash','querystring','html-to-text','ioredis','../../config/logger','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','handleError','./helpers/wildcard-expressions','url','URL','redis','defaults','localhost','socket.io-emitter','register','client','http','request','info','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','status','end','json','undefined','limit','count','offset','then','destroy','get','ChatWebsites','sendStatus','stack','name','send','user-agent-parser','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','model','type','index','Pause','mandatoryDispositionPause','map','ChatWebsite','fieldName','key','query','attributes','intersection','fields','length','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','rows','catch','show','options','find','create','body','address','split','forEach','testWildcardValidity','trim','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','ChatWebsiteId','getDispositions','findOne','keys','Disposition','hasOwnProperty','nolimit','order','addAnswer','CannedAnswer','getAnswers','rawAttributes','findAll','ids','addLogo','sitepic','filename','addCustomerAvatar','customerAvatar','file','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/','getSystemAvatar','server/files/images/avatars/system_avatar.png','Interval','resolve','timezone','ifTime','notify','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','CmContact','No\x20available\x20attributes','createdAt','includes','updatedAt','CompanyId','from','CmList','List','ChatApplication','Intervals','interval','account','orderBy','Applications','priority','asc','list','ListId','Contacts','contact','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','messageId','created','autoclose','push','ChatMessage','AttachmentId','UserId','applications','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','queueId'];(function(_0x3bf925,_0x4dd8e4){var _0x2128a1=function(_0x4d2049){while(--_0x4d2049){_0x3bf925['push'](_0x3bf925['shift']());}};_0x2128a1(++_0x4dd8e4);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x4c3819,_0x2d4d27){_0x4c3819=_0x4c3819-0x0;var _0xf75525=_0x0fda[_0x4c3819];return _0xf75525;};'use strict';var Mustache=require(_0xa0fd('0x0'));var util=require('util');var path=require(_0xa0fd('0x1'));var ejs=require(_0xa0fd('0x2'));var fs=require('fs');var fs_extra=require(_0xa0fd('0x3'));var _=require(_0xa0fd('0x4'));var querystring=require(_0xa0fd('0x5'));var htmlToText=require(_0xa0fd('0x6'));var Redis=require(_0xa0fd('0x7'));var jayson=require('jayson/promise');var qs=require('../../components/parsers/qs');var logger=require(_0xa0fd('0x8'))('api');var config=require('../../config/environment');var APIBadRequestError=require(_0xa0fd('0x9'))[_0xa0fd('0xa')];var APINotFoundError=require(_0xa0fd('0x9'))[_0xa0fd('0xb')];var APIOutOfIntervalError=require('../../errors/api')[_0xa0fd('0xc')];var APIHandleError=require(_0xa0fd('0x9'))[_0xa0fd('0xd')];var APIConflictError=require(_0xa0fd('0x9'))['APIConflictError'];var wildcardUtils=require(_0xa0fd('0xe'));var URL=require(_0xa0fd('0xf'))[_0xa0fd('0x10')];var db=require('../../mysqldb')['db'];config[_0xa0fd('0x11')]=_[_0xa0fd('0x12')](config[_0xa0fd('0x11')],{'host':_0xa0fd('0x13'),'port':0x18eb});var socket=require(_0xa0fd('0x14'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0xa0fd('0x15')](socket);var client=jayson[_0xa0fd('0x16')]['http']({'port':0x232c});var client9002=jayson[_0xa0fd('0x16')][_0xa0fd('0x17')]({'port':0x232a});var client9003=jayson[_0xa0fd('0x16')][_0xa0fd('0x17')]({'port':0x232b});var client9001=jayson[_0xa0fd('0x16')][_0xa0fd('0x17')]({'port':0x2329});function respondWithRpcPromise(_0x2811c0,_0x4fe62c,_0x1c6ffc,_0x326ba8){return new Promise(function(_0x5605ae,_0x50aa6d){var _0x205506=_0x326ba8||client;return _0x205506[_0xa0fd('0x18')](_0x2811c0,_0x1c6ffc)['then'](function(_0x2b8d15){logger[_0xa0fd('0x19')](_0xa0fd('0x1a'),_0x4fe62c,'request\x20sent');logger['debug'](_0xa0fd('0x1b'),_0x4fe62c,'request\x20sent',JSON[_0xa0fd('0x1c')](_0x2b8d15));if(_0x2b8d15[_0xa0fd('0x1d')]){if(_0x2b8d15[_0xa0fd('0x1d')][_0xa0fd('0x1e')]===0x1f4){logger[_0xa0fd('0x1d')](_0xa0fd('0x1a'),_0x4fe62c,_0x2b8d15[_0xa0fd('0x1d')]['message']);return _0x50aa6d(_0x2b8d15[_0xa0fd('0x1d')][_0xa0fd('0x1f')]);}logger[_0xa0fd('0x1d')](_0xa0fd('0x1a'),_0x4fe62c,_0x2b8d15[_0xa0fd('0x1d')][_0xa0fd('0x1f')]);return _0x5605ae(_0x2b8d15[_0xa0fd('0x1d')][_0xa0fd('0x1f')]);}else{logger[_0xa0fd('0x19')](_0xa0fd('0x1a'),_0x4fe62c,_0xa0fd('0x20'));_0x5605ae(_0x2b8d15[_0xa0fd('0x21')][_0xa0fd('0x1f')]);}})['catch'](function(_0x37177b){logger[_0xa0fd('0x1d')]('ChatWebsite,\x20%s,\x20%s',_0x4fe62c,_0x37177b);_0x50aa6d(_0x37177b);});});}function respondWithStatusCode(_0x197ae5,_0x3cd5b0){_0x3cd5b0=_0x3cd5b0||0xcc;return function(_0x4f9258){if(_0x4f9258){return _0x197ae5['sendStatus'](_0x3cd5b0);}return _0x197ae5[_0xa0fd('0x22')](_0x3cd5b0)[_0xa0fd('0x23')]();};}function respondWithResult(_0x4d2c96,_0x5c70fb){_0x5c70fb=_0x5c70fb||0xc8;return function(_0x5b50c0){if(_0x5b50c0){return _0x4d2c96['status'](_0x5c70fb)[_0xa0fd('0x24')](_0x5b50c0);}};}function respondWithFilteredResult(_0x5ef13e,_0x3212d5){return function(_0x1db300){if(_0x1db300){var _0x2f5b0d=typeof _0x3212d5['offset']===_0xa0fd('0x25')&&typeof _0x3212d5[_0xa0fd('0x26')]===_0xa0fd('0x25');var _0x1dd0c4=_0x1db300[_0xa0fd('0x27')];var _0x58ddb3=_0x2f5b0d?0x0:_0x3212d5[_0xa0fd('0x28')];var _0xf69d1c=_0x2f5b0d?_0x1db300[_0xa0fd('0x27')]:_0x3212d5[_0xa0fd('0x28')]+_0x3212d5['limit'];var _0x33785f;if(_0xf69d1c>=_0x1dd0c4){_0xf69d1c=_0x1dd0c4;_0x33785f=0xc8;}else{_0x33785f=0xce;}_0x5ef13e[_0xa0fd('0x22')](_0x33785f);return _0x5ef13e['set']('Content-Range',_0x58ddb3+'-'+_0xf69d1c+'/'+_0x1dd0c4)['json'](_0x1db300);}return null;};}function saveUpdates(_0x1fc249){return function(_0x481271){if(_0x481271){return _0x481271['update'](_0x1fc249)[_0xa0fd('0x29')](function(_0x56f911){return _0x56f911;});}return null;};}function removeEntity(_0xbaa5d2){return function(_0x410246){if(_0x410246){return _0x410246[_0xa0fd('0x2a')]()[_0xa0fd('0x29')](function(){var _0x1f6e72=_0x410246[_0xa0fd('0x2b')]({'plain':!![]});var _0x3d2e32=_0xa0fd('0x2c');return db['UserProfileResource'][_0xa0fd('0x2a')]({'where':{'type':_0x3d2e32,'resourceId':_0x1f6e72['id']}})['then'](function(){return _0x410246;});})[_0xa0fd('0x29')](function(){_0xbaa5d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x33f24b){return function(_0x4bcec1){if(!_0x4bcec1){_0x33f24b[_0xa0fd('0x2d')](0x194);}return _0x4bcec1;};}function handleError(_0x322deb,_0x431d31){_0x431d31=_0x431d31||0x1f4;return function(_0x3c7884){logger['error'](_0x3c7884[_0xa0fd('0x2e')]);if(_0x3c7884[_0xa0fd('0x2f')]){delete _0x3c7884[_0xa0fd('0x2f')];}_0x322deb[_0xa0fd('0x22')](_0x431d31)[_0xa0fd('0x30')](_0x3c7884);};}function createInteractionObject(_0x31f1e2,_0x41feca,_0x5e20ea,_0x5f12ac){var _0x2aa6a8=require(_0xa0fd('0x31'));var _0x283740=new _0x2aa6a8();var _0x155f5=_0x283740['setUA'](_0x5e20ea[_0xa0fd('0x32')])[_0xa0fd('0x33')]();var _0x273511=_0x41feca[_0xa0fd('0x34')];if(_0x5e20ea[_0xa0fd('0x35')]){_0x273511=_0x5e20ea['cf-connecting-ip'];}else if(_0x5e20ea[_0xa0fd('0x36')]){_0x273511=_[_0xa0fd('0x37')](_0x5e20ea['x-forwarded-for']['split'](','));}return{'ContactId':_0x5f12ac['id'],'ChatWebsiteId':_0x31f1e2,'from':(_0x5f12ac[_0xa0fd('0x38')]||'')+'\x20'+(_0x5f12ac[_0xa0fd('0x39')]||''),'customerIp':_0x273511,'customerPort':_0x5e20ea[_0xa0fd('0x3a')]?_0x5e20ea[_0xa0fd('0x3a')]:null,'referer':_0x41feca[_0xa0fd('0x3b')],'browserName':_0x155f5[_0xa0fd('0x3c')][_0xa0fd('0x2f')]&&_0x155f5[_0xa0fd('0x3c')][_0xa0fd('0x3d')]?util[_0xa0fd('0x3e')](_0xa0fd('0x3f'),_0x155f5[_0xa0fd('0x3c')][_0xa0fd('0x2f')],_0x155f5[_0xa0fd('0x3c')][_0xa0fd('0x3d')]):'unknown','browserVersion':_0x155f5['browser']['version']||_0xa0fd('0x40'),'osName':util[_0xa0fd('0x3e')](_0xa0fd('0x3f'),_0x155f5['os']['name'],_0x155f5['os'][_0xa0fd('0x3d')]),'osVersion':_0x155f5['os'][_0xa0fd('0x3d')],'deviceModel':_0x155f5[_0xa0fd('0x41')]['model']&&_0x155f5[_0xa0fd('0x41')][_0xa0fd('0x42')]?util[_0xa0fd('0x3e')](_0xa0fd('0x43'),_0x155f5[_0xa0fd('0x41')][_0xa0fd('0x44')],_0x155f5['device'][_0xa0fd('0x42')],_0x155f5[_0xa0fd('0x41')][_0xa0fd('0x45')]):null,'deviceVendor':_0x155f5[_0xa0fd('0x41')][_0xa0fd('0x42')],'deviceType':_0x155f5[_0xa0fd('0x41')]['type'],'formData':JSON[_0xa0fd('0x1c')](_0x41feca)};}exports[_0xa0fd('0x46')]=function(_0xf1c674,_0x1cc583){var _0x16d0cc={'include':[{'model':db[_0xa0fd('0x47')],'as':_0xa0fd('0x48')}]},_0x508747={},_0x5a6824={'count':0x0,'rows':[]};var _0x3677c1=_[_0xa0fd('0x49')](db[_0xa0fd('0x4a')]['rawAttributes'],function(_0x2d9777){return{'name':_0x2d9777[_0xa0fd('0x4b')],'type':_0x2d9777[_0xa0fd('0x45')][_0xa0fd('0x4c')]};});_0x508747[_0xa0fd('0x44')]=_[_0xa0fd('0x49')](_0x3677c1,'name');_0x508747['query']=_['keys'](_0xf1c674[_0xa0fd('0x4d')]);_0x508747['filters']=_['intersection'](_0x508747[_0xa0fd('0x44')],_0x508747['query']);_0x16d0cc[_0xa0fd('0x4e')]=_[_0xa0fd('0x4f')](_0x508747['model'],qs['fields'](_0xf1c674[_0xa0fd('0x4d')][_0xa0fd('0x50')]));_0x16d0cc[_0xa0fd('0x4e')]=_0x16d0cc[_0xa0fd('0x4e')][_0xa0fd('0x51')]?_0x16d0cc[_0xa0fd('0x4e')]:_0x508747['model'];if(!_0xf1c674['query']['hasOwnProperty']('nolimit')){_0x16d0cc[_0xa0fd('0x26')]=qs[_0xa0fd('0x26')](_0xf1c674[_0xa0fd('0x4d')][_0xa0fd('0x26')]);_0x16d0cc[_0xa0fd('0x28')]=qs['offset'](_0xf1c674['query']['offset']);}_0x16d0cc['order']=qs['sort'](_0xf1c674[_0xa0fd('0x4d')][_0xa0fd('0x52')]);_0x16d0cc[_0xa0fd('0x53')]=qs[_0xa0fd('0x54')](_[_0xa0fd('0x55')](_0xf1c674[_0xa0fd('0x4d')],_0x508747[_0xa0fd('0x54')]),_0x3677c1);if(_0xf1c674[_0xa0fd('0x4d')][_0xa0fd('0x56')]){_0x16d0cc[_0xa0fd('0x53')]=_['merge'](_0x16d0cc['where'],{'$or':_[_0xa0fd('0x49')](_0x3677c1,function(_0x3fbd1a){if(_0x3fbd1a[_0xa0fd('0x45')]!==_0xa0fd('0x57')){var _0x4c4339={};_0x4c4339[_0x3fbd1a[_0xa0fd('0x2f')]]={'$like':'%'+_0xf1c674[_0xa0fd('0x4d')]['filter']+'%'};return _0x4c4339;}})});}_0x16d0cc=_[_0xa0fd('0x58')]({},_0x16d0cc,_0xf1c674['options']);var _0x1df896={'where':_0x16d0cc[_0xa0fd('0x53')]};return db['ChatWebsite'][_0xa0fd('0x27')](_0x1df896)[_0xa0fd('0x29')](function(_0x10d3c3){_0x5a6824[_0xa0fd('0x27')]=_0x10d3c3;if(_0xf1c674[_0xa0fd('0x4d')][_0xa0fd('0x59')]){_0x16d0cc[_0xa0fd('0x5a')]=[{'all':!![]}];}return db[_0xa0fd('0x4a')]['findAll'](_0x16d0cc);})[_0xa0fd('0x29')](function(_0x4f7c12){_0x5a6824[_0xa0fd('0x5b')]=_0x4f7c12;return _0x5a6824;})[_0xa0fd('0x29')](respondWithFilteredResult(_0x1cc583,_0x16d0cc))[_0xa0fd('0x5c')](handleError(_0x1cc583,null));};exports[_0xa0fd('0x5d')]=function(_0xa37ca9,_0x4a7ae4){var _0x31710d={'raw':![],'where':{'id':_0xa37ca9['params']['id']},'include':[{'model':db[_0xa0fd('0x47')],'as':_0xa0fd('0x48')}]},_0xb5941e={};_0xb5941e[_0xa0fd('0x44')]=_['keys'](db[_0xa0fd('0x4a')]['rawAttributes']);_0xb5941e[_0xa0fd('0x4d')]=_['keys'](_0xa37ca9[_0xa0fd('0x4d')]);_0xb5941e['filters']=_[_0xa0fd('0x4f')](_0xb5941e[_0xa0fd('0x44')],_0xb5941e[_0xa0fd('0x4d')]);_0x31710d[_0xa0fd('0x4e')]=_[_0xa0fd('0x4f')](_0xb5941e[_0xa0fd('0x44')],qs[_0xa0fd('0x50')](_0xa37ca9['query'][_0xa0fd('0x50')]));_0x31710d[_0xa0fd('0x4e')]=_0x31710d[_0xa0fd('0x4e')][_0xa0fd('0x51')]?_0x31710d[_0xa0fd('0x4e')]:_0xb5941e['model'];if(_0xa37ca9['query']['includeAll']){_0x31710d[_0xa0fd('0x5a')]=[{'all':!![]}];}_0x31710d=_['merge']({},_0x31710d,_0xa37ca9[_0xa0fd('0x5e')]);return db['ChatWebsite'][_0xa0fd('0x5f')](_0x31710d)[_0xa0fd('0x29')](handleEntityNotFound(_0x4a7ae4,null))[_0xa0fd('0x29')](respondWithResult(_0x4a7ae4,null))[_0xa0fd('0x5c')](handleError(_0x4a7ae4,null));};exports[_0xa0fd('0x60')]=function(_0x5c3efa,_0x471a34){var _0x12cc39=null;_0x5c3efa[_0xa0fd('0x61')][_0xa0fd('0x62')][_0xa0fd('0x63')](',')[_0xa0fd('0x64')](_0x527e93=>{if(_0x527e93['trim']()!==''&&!wildcardUtils[_0xa0fd('0x65')](_0x527e93[_0xa0fd('0x66')]())){_0x12cc39=new APIBadRequestError('\x22'+_0x527e93[_0xa0fd('0x66')]()+_0xa0fd('0x67'));}});if(_0x12cc39){return handleError(_0x471a34,null)(_0x12cc39);}return db[_0xa0fd('0x4a')][_0xa0fd('0x60')](_0x5c3efa[_0xa0fd('0x61')],{})[_0xa0fd('0x29')](function(_0x545f7f){var _0xc69e41=_0x5c3efa[_0xa0fd('0x68')][_0xa0fd('0x2b')]({'plain':!![]});if(!_0xc69e41)throw new Error(_0xa0fd('0x69'));if(_0xc69e41[_0xa0fd('0x6a')]===_0xa0fd('0x68')){var _0x45f7df=_0x545f7f[_0xa0fd('0x2b')]({'plain':!![]});var _0x319e80=_0xa0fd('0x2c');return db[_0xa0fd('0x6b')][_0xa0fd('0x5f')]({'where':{'name':_0x319e80,'userProfileId':_0xc69e41['userProfileId']},'raw':!![]})[_0xa0fd('0x29')](function(_0x3cd5a5){if(_0x3cd5a5&&_0x3cd5a5[_0xa0fd('0x6c')]===0x0){return db[_0xa0fd('0x6d')][_0xa0fd('0x60')]({'name':_0x45f7df[_0xa0fd('0x2f')],'resourceId':_0x45f7df['id'],'type':_0x3cd5a5[_0xa0fd('0x2f')],'sectionId':_0x3cd5a5['id']},{})[_0xa0fd('0x29')](function(){return _0x545f7f;});}else{return _0x545f7f;}})[_0xa0fd('0x5c')](function(_0x4452f0){logger['error'](_0xa0fd('0x6e'),_0x4452f0);throw _0x4452f0;});}return _0x545f7f;})[_0xa0fd('0x29')](respondWithResult(_0x471a34,0xc9))[_0xa0fd('0x5c')](handleError(_0x471a34,null));};exports[_0xa0fd('0x6f')]=function(_0x239243,_0x1196d4){var _0x15c756=null;_0x239243[_0xa0fd('0x61')]['address'][_0xa0fd('0x63')](',')[_0xa0fd('0x64')](_0x5934fa=>{if(_0x5934fa[_0xa0fd('0x66')]()!==''&&!wildcardUtils[_0xa0fd('0x65')](_0x5934fa[_0xa0fd('0x66')]())){_0x15c756=new APIBadRequestError('\x22'+_0x5934fa[_0xa0fd('0x66')]()+_0xa0fd('0x67'));}});if(_0x15c756){return handleError(_0x1196d4,null)(_0x15c756);}if(_0x239243['body']['id']){delete _0x239243[_0xa0fd('0x61')]['id'];}return db[_0xa0fd('0x4a')][_0xa0fd('0x5f')]({'where':{'id':_0x239243[_0xa0fd('0x70')]['id']},'include':[{'model':db[_0xa0fd('0x47')],'as':_0xa0fd('0x48')}]})[_0xa0fd('0x29')](handleEntityNotFound(_0x1196d4,null))[_0xa0fd('0x29')](saveUpdates(_0x239243[_0xa0fd('0x61')],null))[_0xa0fd('0x29')](respondWithResult(_0x1196d4,null))[_0xa0fd('0x5c')](handleError(_0x1196d4,null));};exports[_0xa0fd('0x2a')]=function(_0x36452c,_0x7d5b1d){return db[_0xa0fd('0x4a')][_0xa0fd('0x5f')]({'where':{'id':_0x36452c[_0xa0fd('0x70')]['id']}})[_0xa0fd('0x29')](handleEntityNotFound(_0x7d5b1d,null))[_0xa0fd('0x29')](removeEntity(_0x7d5b1d,null))['catch'](handleError(_0x7d5b1d,null));};exports[_0xa0fd('0x71')]=function(_0x36523e,_0x356f36){return db[_0xa0fd('0x4a')]['describe']()[_0xa0fd('0x29')](respondWithResult(_0x356f36,null))[_0xa0fd('0x5c')](handleError(_0x356f36,null));};exports[_0xa0fd('0x72')]=function(_0x495bc1,_0xc2f803){if(_0x495bc1['body']['id']){delete _0x495bc1[_0xa0fd('0x61')]['id'];}return db[_0xa0fd('0x4a')]['find']({'where':{'id':_0x495bc1['params']['id']}})[_0xa0fd('0x29')](handleEntityNotFound(_0xc2f803,null))['then'](function(_0x5afbc8){if(_0x5afbc8){_0x495bc1[_0xa0fd('0x61')][_0xa0fd('0x73')]=_0x5afbc8['id'];return db['Disposition'][_0xa0fd('0x60')](_0x495bc1[_0xa0fd('0x61')]);}})[_0xa0fd('0x29')](respondWithResult(_0xc2f803,null))[_0xa0fd('0x5c')](handleError(_0xc2f803,null));};exports[_0xa0fd('0x74')]=function(_0x59ab1e,_0x398455){var _0x6c8da3={'raw':![],'where':{}};var _0x50153f={};var _0x424676={'count':0x0,'rows':[]};return db[_0xa0fd('0x4a')][_0xa0fd('0x75')]({'where':{'id':_0x59ab1e['params']['id']}})[_0xa0fd('0x29')](handleEntityNotFound(_0x398455,null))['then'](function(_0x24fa4f){if(_0x24fa4f){_0x50153f[_0xa0fd('0x44')]=_[_0xa0fd('0x76')](db[_0xa0fd('0x77')]['rawAttributes']);_0x50153f[_0xa0fd('0x4d')]=_[_0xa0fd('0x76')](_0x59ab1e[_0xa0fd('0x4d')]);_0x50153f[_0xa0fd('0x54')]=_[_0xa0fd('0x4f')](_0x50153f[_0xa0fd('0x44')],_0x50153f['query']);_0x6c8da3[_0xa0fd('0x4e')]=_[_0xa0fd('0x4f')](_0x50153f[_0xa0fd('0x44')],qs[_0xa0fd('0x50')](_0x59ab1e[_0xa0fd('0x4d')][_0xa0fd('0x50')]));_0x6c8da3['attributes']=_0x6c8da3['attributes'][_0xa0fd('0x51')]?_0x6c8da3[_0xa0fd('0x4e')]:_0x50153f['model'];if(!_0x59ab1e[_0xa0fd('0x4d')][_0xa0fd('0x78')](_0xa0fd('0x79'))){_0x6c8da3[_0xa0fd('0x26')]=qs[_0xa0fd('0x26')](_0x59ab1e[_0xa0fd('0x4d')][_0xa0fd('0x26')]);_0x6c8da3[_0xa0fd('0x28')]=qs[_0xa0fd('0x28')](_0x59ab1e['query'][_0xa0fd('0x28')]);}_0x6c8da3[_0xa0fd('0x7a')]=qs[_0xa0fd('0x52')](_0x59ab1e['query'][_0xa0fd('0x52')]);_0x6c8da3[_0xa0fd('0x53')]=qs['filters'](_['pick'](_0x59ab1e[_0xa0fd('0x4d')],_0x50153f[_0xa0fd('0x54')]));_0x6c8da3[_0xa0fd('0x53')][_0xa0fd('0x73')]=_0x24fa4f['id'];if(_0x59ab1e['query']['filter']){_0x6c8da3[_0xa0fd('0x53')]=_[_0xa0fd('0x58')](_0x6c8da3[_0xa0fd('0x53')],{'$or':_[_0xa0fd('0x49')](_0x6c8da3[_0xa0fd('0x4e')],function(_0x57945d){var _0x56801a={};_0x56801a[_0x57945d]={'$like':'%'+_0x59ab1e[_0xa0fd('0x4d')][_0xa0fd('0x56')]+'%'};return _0x56801a;})});}_0x6c8da3=_[_0xa0fd('0x58')]({},_0x6c8da3,_0x59ab1e[_0xa0fd('0x5e')]);return db[_0xa0fd('0x77')][_0xa0fd('0x27')]({'where':_0x6c8da3[_0xa0fd('0x53')]})[_0xa0fd('0x29')](function(_0x1b3dfa){_0x424676[_0xa0fd('0x27')]=_0x1b3dfa;if(_0x59ab1e[_0xa0fd('0x4d')][_0xa0fd('0x59')]){_0x6c8da3[_0xa0fd('0x5a')]=[{'all':!![]}];}return db[_0xa0fd('0x77')]['findAll'](_0x6c8da3);})[_0xa0fd('0x29')](function(_0x28ddc2){_0x424676[_0xa0fd('0x5b')]=_0x28ddc2;return _0x424676;});}})[_0xa0fd('0x29')](respondWithFilteredResult(_0x398455,_0x6c8da3))['catch'](handleError(_0x398455,null));};exports['removeDispositions']=function(_0x785ba5,_0x49f1a3){return db[_0xa0fd('0x4a')][_0xa0fd('0x5f')]({'where':{'id':_0x785ba5[_0xa0fd('0x70')]['id']}})[_0xa0fd('0x29')](handleEntityNotFound(_0x49f1a3,null))['then'](function(_0x537979){if(_0x537979){return _0x537979['removeDispositions'](_0x785ba5['query']['ids']);}})['then'](respondWithStatusCode(_0x49f1a3,null))[_0xa0fd('0x5c')](handleError(_0x49f1a3,null));};exports[_0xa0fd('0x7b')]=function(_0xabf058,_0x51c982){if(_0xabf058[_0xa0fd('0x61')]['id']){delete _0xabf058['body']['id'];}return db[_0xa0fd('0x4a')][_0xa0fd('0x5f')]({'where':{'id':_0xabf058[_0xa0fd('0x70')]['id']}})[_0xa0fd('0x29')](handleEntityNotFound(_0x51c982,null))['then'](function(_0xee8c4f){if(_0xee8c4f){_0xabf058[_0xa0fd('0x61')][_0xa0fd('0x73')]=_0xee8c4f['id'];return db[_0xa0fd('0x7c')][_0xa0fd('0x60')](_0xabf058[_0xa0fd('0x61')]);}})['then'](respondWithResult(_0x51c982,null))[_0xa0fd('0x5c')](handleError(_0x51c982,null));};exports[_0xa0fd('0x7d')]=function(_0x91853c,_0x33cfc6){var _0x1091c4={'raw':![],'where':{}};var _0x433a8c={};var _0x2d46f2={'count':0x0,'rows':[]};return db[_0xa0fd('0x4a')]['findOne']({'where':{'id':_0x91853c[_0xa0fd('0x70')]['id']}})['then'](handleEntityNotFound(_0x33cfc6,null))[_0xa0fd('0x29')](function(_0x320a53){if(_0x320a53){_0x433a8c[_0xa0fd('0x44')]=_['keys'](db[_0xa0fd('0x7c')][_0xa0fd('0x7e')]);_0x433a8c[_0xa0fd('0x4d')]=_[_0xa0fd('0x76')](_0x91853c['query']);_0x433a8c['filters']=_[_0xa0fd('0x4f')](_0x433a8c['model'],_0x433a8c[_0xa0fd('0x4d')]);_0x1091c4[_0xa0fd('0x4e')]=_[_0xa0fd('0x4f')](_0x433a8c['model'],qs[_0xa0fd('0x50')](_0x91853c[_0xa0fd('0x4d')]['fields']));_0x1091c4[_0xa0fd('0x4e')]=_0x1091c4['attributes']['length']?_0x1091c4[_0xa0fd('0x4e')]:_0x433a8c[_0xa0fd('0x44')];if(!_0x91853c[_0xa0fd('0x4d')]['hasOwnProperty'](_0xa0fd('0x79'))){_0x1091c4['limit']=qs[_0xa0fd('0x26')](_0x91853c[_0xa0fd('0x4d')][_0xa0fd('0x26')]);_0x1091c4[_0xa0fd('0x28')]=qs[_0xa0fd('0x28')](_0x91853c['query'][_0xa0fd('0x28')]);}_0x1091c4[_0xa0fd('0x7a')]=qs[_0xa0fd('0x52')](_0x91853c[_0xa0fd('0x4d')][_0xa0fd('0x52')]);_0x1091c4[_0xa0fd('0x53')]=qs[_0xa0fd('0x54')](_['pick'](_0x91853c[_0xa0fd('0x4d')],_0x433a8c[_0xa0fd('0x54')]));_0x1091c4[_0xa0fd('0x53')][_0xa0fd('0x73')]=_0x320a53['id'];if(_0x91853c[_0xa0fd('0x4d')]['filter']){_0x1091c4[_0xa0fd('0x53')]=_[_0xa0fd('0x58')](_0x1091c4[_0xa0fd('0x53')],{'$or':_[_0xa0fd('0x49')](_0x1091c4['attributes'],function(_0x550d8c){var _0x3bb845={};_0x3bb845[_0x550d8c]={'$like':'%'+_0x91853c['query'][_0xa0fd('0x56')]+'%'};return _0x3bb845;})});}_0x1091c4=_[_0xa0fd('0x58')]({},_0x1091c4,_0x91853c['options']);return db[_0xa0fd('0x7c')]['count']({'where':_0x1091c4[_0xa0fd('0x53')]})[_0xa0fd('0x29')](function(_0x4e335c){_0x2d46f2['count']=_0x4e335c;if(_0x91853c[_0xa0fd('0x4d')]['includeAll']){_0x1091c4[_0xa0fd('0x5a')]=[{'all':!![]}];}return db['CannedAnswer'][_0xa0fd('0x7f')](_0x1091c4);})['then'](function(_0x3c8d51){_0x2d46f2[_0xa0fd('0x5b')]=_0x3c8d51;return _0x2d46f2;});}})[_0xa0fd('0x29')](respondWithFilteredResult(_0x33cfc6,_0x1091c4))[_0xa0fd('0x5c')](handleError(_0x33cfc6,null));};exports['removeAnswers']=function(_0x3198ef,_0x29fe97){return db['ChatWebsite'][_0xa0fd('0x5f')]({'where':{'id':_0x3198ef[_0xa0fd('0x70')]['id']}})['then'](handleEntityNotFound(_0x29fe97,null))[_0xa0fd('0x29')](function(_0x69e5c3){if(_0x69e5c3){return _0x69e5c3['removeAnswers'](_0x3198ef[_0xa0fd('0x4d')][_0xa0fd('0x80')]);}})[_0xa0fd('0x29')](respondWithStatusCode(_0x29fe97,null))[_0xa0fd('0x5c')](handleError(_0x29fe97,null));};exports[_0xa0fd('0x81')]=function(_0xf65b43,_0x28546a){_0xf65b43[_0xa0fd('0x61')][_0xa0fd('0x82')]=_0xf65b43['file'][_0xa0fd('0x83')];return db[_0xa0fd('0x4a')]['find']({'where':{'id':_0xf65b43['params']['id']}})[_0xa0fd('0x29')](handleEntityNotFound(_0x28546a,null))[_0xa0fd('0x29')](saveUpdates(_0xf65b43[_0xa0fd('0x61')],null))[_0xa0fd('0x29')](respondWithResult(_0x28546a,null))[_0xa0fd('0x5c')](handleError(_0x28546a,null));};exports['addAvatar']=function(_0x2ae0fe,_0x41b201){_0x2ae0fe[_0xa0fd('0x61')]['agentAvatar']=_0x2ae0fe['file'][_0xa0fd('0x83')];return db[_0xa0fd('0x4a')][_0xa0fd('0x5f')]({'where':{'id':_0x2ae0fe[_0xa0fd('0x70')]['id']}})[_0xa0fd('0x29')](handleEntityNotFound(_0x41b201,null))['then'](saveUpdates(_0x2ae0fe[_0xa0fd('0x61')],null))[_0xa0fd('0x29')](respondWithResult(_0x41b201,null))[_0xa0fd('0x5c')](handleError(_0x41b201,null));};exports[_0xa0fd('0x84')]=function(_0x7dbcea,_0xf39378){_0x7dbcea['body'][_0xa0fd('0x85')]=_0x7dbcea[_0xa0fd('0x86')][_0xa0fd('0x83')];return db[_0xa0fd('0x4a')][_0xa0fd('0x5f')]({'where':{'id':_0x7dbcea[_0xa0fd('0x70')]['id']}})[_0xa0fd('0x29')](handleEntityNotFound(_0xf39378,null))['then'](saveUpdates(_0x7dbcea[_0xa0fd('0x61')],null))['then'](respondWithResult(_0xf39378,null))['catch'](handleError(_0xf39378,null));};exports['addSystemAvatar']=function(_0x52ff09,_0x54b24f){_0x52ff09['body'][_0xa0fd('0x87')]=_0x52ff09[_0xa0fd('0x86')]['filename'];return db[_0xa0fd('0x4a')][_0xa0fd('0x5f')]({'where':{'id':_0x52ff09[_0xa0fd('0x70')]['id']}})[_0xa0fd('0x29')](handleEntityNotFound(_0x54b24f,null))['then'](saveUpdates(_0x52ff09[_0xa0fd('0x61')],null))[_0xa0fd('0x29')](respondWithResult(_0x54b24f,null))[_0xa0fd('0x5c')](handleError(_0x54b24f,null));};exports[_0xa0fd('0x88')]=function(_0x16da38,_0x239982){var _0x544d47=path[_0xa0fd('0x89')](config[_0xa0fd('0x8a')],_0xa0fd('0x8b'));var _0x15a37f={'where':{'id':_0x16da38[_0xa0fd('0x70')]['id']},'attributes':['id',_0xa0fd('0x82')],'raw':!![]};var _0x5a038c=![];return require(_0xa0fd('0x8c'))[_0xa0fd('0x8d')]()['then'](function(_0x57c1ce){if(_0x57c1ce){_0x5a038c=_0x57c1ce['custom'];}})[_0xa0fd('0x29')](function(){return db['ChatWebsite']['find'](_0x15a37f);})[_0xa0fd('0x29')](handleEntityNotFound(_0x239982,null))[_0xa0fd('0x29')](function(_0x2647f9){if(_0x2647f9){if(!_[_0xa0fd('0x8e')](_0x2647f9[_0xa0fd('0x82')])){if(fs[_0xa0fd('0x8f')](path[_0xa0fd('0x89')](config['root'],_0xa0fd('0x90'),_0x2647f9['sitepic']))&&_0x5a038c){_0x544d47=path[_0xa0fd('0x89')](config['root'],_0xa0fd('0x90'),_0x2647f9[_0xa0fd('0x82')]);}}return _0x239982[_0xa0fd('0x91')](_0x544d47);}})[_0xa0fd('0x5c')](handleError(_0x239982,null));};exports[_0xa0fd('0x92')]=function(_0x5028a5,_0x3743fa){var _0x5d847d=path[_0xa0fd('0x89')](config['root'],_0xa0fd('0x93'));var _0x520c68={'where':{'id':_0x5028a5[_0xa0fd('0x70')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xa0fd('0x4a')]['find'](_0x520c68)[_0xa0fd('0x29')](handleEntityNotFound(_0x3743fa,null))['then'](function(_0x5b3546){if(_0x5b3546){if(!_[_0xa0fd('0x8e')](_0x5b3546[_0xa0fd('0x94')])){if(fs['existsSync'](path[_0xa0fd('0x89')](config[_0xa0fd('0x8a')],'server/files/images/avatars/',_0x5b3546['agentAvatar']))){_0x5d847d=path[_0xa0fd('0x89')](config['root'],'server/files/images/avatars/',_0x5b3546[_0xa0fd('0x94')]);}}return _0x3743fa['download'](_0x5d847d);}})[_0xa0fd('0x5c')](handleError(_0x3743fa,null));};exports[_0xa0fd('0x95')]=function(_0x2e88cf,_0x575f53){var _0x27c385=path[_0xa0fd('0x89')](config[_0xa0fd('0x8a')],_0xa0fd('0x96'));var _0x3e3f64={'where':{'id':_0x2e88cf[_0xa0fd('0x70')]['id']},'attributes':['id',_0xa0fd('0x85'),_0xa0fd('0x97')],'raw':!![]};return db[_0xa0fd('0x4a')][_0xa0fd('0x5f')](_0x3e3f64)['then'](handleEntityNotFound(_0x575f53,null))[_0xa0fd('0x29')](function(_0x27aa2d){if(_0x27aa2d){if(!_[_0xa0fd('0x8e')](_0x27aa2d['customerAvatar'])){if(fs[_0xa0fd('0x8f')](path['join'](config[_0xa0fd('0x8a')],_0xa0fd('0x98'),_0x27aa2d[_0xa0fd('0x85')]))&&_0x27aa2d[_0xa0fd('0x97')]){_0x27c385=path['join'](config[_0xa0fd('0x8a')],_0xa0fd('0x98'),_0x27aa2d[_0xa0fd('0x85')]);}}return _0x575f53[_0xa0fd('0x91')](_0x27c385);}})['catch'](handleError(_0x575f53,null));};exports[_0xa0fd('0x99')]=function(_0x239c6b,_0xdfc377){var _0x4d58cc=path['join'](config[_0xa0fd('0x8a')],_0xa0fd('0x9a'));var _0x201d04={'where':{'id':_0x239c6b[_0xa0fd('0x70')]['id']},'attributes':['id',_0xa0fd('0x87')],'raw':!![]};return db[_0xa0fd('0x4a')][_0xa0fd('0x5f')](_0x201d04)[_0xa0fd('0x29')](handleEntityNotFound(_0xdfc377,null))[_0xa0fd('0x29')](function(_0x1f73f4){if(_0x1f73f4){if(!_[_0xa0fd('0x8e')](_0x1f73f4[_0xa0fd('0x87')])){if(fs[_0xa0fd('0x8f')](path[_0xa0fd('0x89')](config['root'],_0xa0fd('0x98'),_0x1f73f4[_0xa0fd('0x87')]))){_0x4d58cc=path[_0xa0fd('0x89')](config[_0xa0fd('0x8a')],_0xa0fd('0x98'),_0x1f73f4['systemAvatar']);}}return _0xdfc377[_0xa0fd('0x91')](_0x4d58cc);}})[_0xa0fd('0x5c')](handleError(_0xdfc377,null));};function checkWebsiteInterval(_0x2b6d98){var _0x41d6f5=_0x2b6d98[_0xa0fd('0x9b')];if(!_0x41d6f5){return Promise[_0xa0fd('0x9c')](_0x2b6d98);}var _0x4138e9=_0x2b6d98[_0xa0fd('0x9d')]||undefined;return _0x41d6f5[_0xa0fd('0x9e')](_0x4138e9)[_0xa0fd('0x29')](function(_0x3fab51){if(!_0x3fab51){throw new APIOutOfIntervalError();}return _0x2b6d98;});}exports[_0xa0fd('0x9f')]=function(_0x31776b,_0x3afe1a){var _0x44acb5={'body':_0x31776b['body'],'channel':'chat'};var _0x363262=[];var _0x160b0c=[];var _0x3d5af0={};var _0x4c398f=![];if(_0x31776b['body']['id']){delete _0x31776b['body']['id'];}if(_[_0xa0fd('0x8e')](_0x31776b[_0xa0fd('0x61')]['from'])){throw new APIBadRequestError(_0xa0fd('0xa0'));}if(_[_0xa0fd('0x8e')](_0x31776b[_0xa0fd('0x61')][_0xa0fd('0xa1')])){throw new APIBadRequestError(_0xa0fd('0xa2'));}if(_[_0xa0fd('0xa3')](_0x31776b[_0xa0fd('0x61')][_0xa0fd('0x61')])){throw new APIBadRequestError(_0xa0fd('0xa4'));}var _0x2185d6=_0x31776b[_0xa0fd('0x61')][_0xa0fd('0x34')]&&_0x31776b['body'][_0xa0fd('0x3b')];return db[_0xa0fd('0xa5')][_0xa0fd('0x71')]()[_0xa0fd('0x29')](function(_0xff8796){if(!_0xff8796){throw new Error(_0xa0fd('0xa6'));}_0x363262=Object[_0xa0fd('0x76')](_0xff8796)[_0xa0fd('0x56')](function(_0x37475b){return![_0xa0fd('0xa7'),'updatedAt'][_0xa0fd('0xa8')](_0x37475b);});_0x160b0c=Object['keys'](_0xff8796)['filter'](function(_0x55516f){return![_0xa0fd('0xa7'),_0xa0fd('0xa9'),_0xa0fd('0xaa'),'ListId']['includes'](_0x55516f);});if(!_[_0xa0fd('0xa8')](_0x160b0c,_0x31776b[_0xa0fd('0x61')][_0xa0fd('0xa1')])){throw new APIBadRequestError('Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20'+_0x160b0c[_0xa0fd('0x89')](',\x20'));}_0x3d5af0[_0x31776b[_0xa0fd('0x61')][_0xa0fd('0xa1')]]=_0x31776b[_0xa0fd('0x61')][_0xa0fd('0xab')];})[_0xa0fd('0x29')](function(){return db[_0xa0fd('0x4a')]['find']({'where':{'id':_0x31776b['params']['id']},'include':[{'model':db[_0xa0fd('0xac')],'as':_0xa0fd('0xad'),'include':[{'model':db[_0xa0fd('0xa5')],'as':'Contacts','where':_0x3d5af0,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xa0fd('0xae')],'as':'Applications'},{'model':db[_0xa0fd('0x9b')],'as':_0xa0fd('0x9b'),'include':[{'model':db['Interval'],'as':_0xa0fd('0xaf'),'attributes':['id',_0xa0fd('0xb0')],'raw':!![]}]}]});})[_0xa0fd('0x29')](function(_0x250863){if(!_0x250863){throw new APINotFoundError(util[_0xa0fd('0x3e')]('Chat\x20Website\x20with\x20id\x20%s\x20not\x20found',_0x31776b[_0xa0fd('0x70')]['id']));}if(_0x2185d6){return checkWebsiteInterval(_0x250863);}return _0x250863;})[_0xa0fd('0x29')](function(_0x2a6825){_0x44acb5[_0xa0fd('0xb1')]=_0x2a6825;_0x44acb5['applications']=_[_0xa0fd('0xb2')](_0x2a6825[_0xa0fd('0xb3')],[_0xa0fd('0xb4')],[_0xa0fd('0xb5')]);if(_0x44acb5[_0xa0fd('0xb1')][_0xa0fd('0xb3')]){delete _0x44acb5['account'][_0xa0fd('0xb3')];}_0x44acb5[_0xa0fd('0xb6')]=_0x2a6825['List']||{'id':_0x2a6825[_0xa0fd('0xb7')]};if(_0x44acb5['list']&&_0x44acb5[_0xa0fd('0xb6')][_0xa0fd('0xb8')][_0xa0fd('0x51')]){return _0x44acb5[_0xa0fd('0xb6')]['Contacts'][0x0];}var _0x38707f=_[_0xa0fd('0x12')](_0x31776b[_0xa0fd('0x61')],{'firstName':_0x31776b[_0xa0fd('0x61')]['from'],'ListId':_0x2a6825['ListId']});_0x38707f[_0x31776b[_0xa0fd('0x61')]['mapKey']]=_0x31776b[_0xa0fd('0x61')][_0xa0fd('0xab')];return db[_0xa0fd('0xa5')][_0xa0fd('0x60')](_0x38707f,{'fields':_0x363262,'raw':!![]});})[_0xa0fd('0x29')](function(_0x389ce9){_0x44acb5[_0xa0fd('0xb9')]=_0x389ce9;var _0x53a8fb=createInteractionObject(_0x31776b[_0xa0fd('0x70')]['id'],_0x31776b[_0xa0fd('0x61')],_0x31776b[_0xa0fd('0xba')],_0x389ce9);var _0x43130a={'ChatWebsiteId':_0x31776b['params']['id']};if(_0x31776b[_0xa0fd('0x61')][_0xa0fd('0xbb')]){_0x43130a[_0xa0fd('0xbb')]=_0x31776b[_0xa0fd('0x61')][_0xa0fd('0xbb')];_0x43130a[_0xa0fd('0xbc')]=![];return db[_0xa0fd('0xbd')][_0xa0fd('0x5f')]({'where':_0x43130a})['then'](function(_0x4195fe){var _0x8f35e4=_0x31776b[_0xa0fd('0x61')][_0xa0fd('0x34')]&&_0x31776b[_0xa0fd('0x61')]['referer'];if(_0x4195fe){_0x4c398f=!![];return _0x4195fe;}else if(!_0x8f35e4&&_0x4195fe&&_0x4195fe[_0xa0fd('0xbc')]){throw new APIConflictError(_0xa0fd('0xbe'));}_0x53a8fb[_0xa0fd('0xbb')]=_0x31776b['body']['threadId'];_0x53a8fb['externalUrl']=_0x31776b[_0xa0fd('0x61')][_0xa0fd('0xbf')];return db[_0xa0fd('0xbd')]['create'](_0x53a8fb);});}_0x43130a[_0xa0fd('0xc0')]=_0x389ce9['id'];if(_0x31776b['body'][_0xa0fd('0xc1')]&&_0x31776b['body']['interaction']['id']){_0x43130a['id']=_0x31776b['body']['interaction']['id'];return db['ChatInteraction'][_0xa0fd('0x5f')]({'where':_0x43130a})[_0xa0fd('0x29')](function(_0x42cd7a){var _0x4e5e6a=_0x31776b[_0xa0fd('0x61')][_0xa0fd('0x34')]&&_0x31776b['body'][_0xa0fd('0x3b')];if(!_0x4e5e6a&&_0x42cd7a&&_0x42cd7a['closed']){throw new APIConflictError(_0xa0fd('0xbe'));}else if(_0x42cd7a){_0x4c398f=!![];return _0x42cd7a;}else{return db['ChatInteraction'][_0xa0fd('0x60')](_0x53a8fb);}});}return db['ChatInteraction'][_0xa0fd('0x60')](_0x53a8fb);})['then'](function(_0xba90df){if(!_0x4c398f){return _0xba90df;}var _0x195fe5={'from':(_0x44acb5[_0xa0fd('0xb9')][_0xa0fd('0x38')]||'')+'\x20'+(_0x44acb5['contact'][_0xa0fd('0x39')]||'')};if(_0x31776b[_0xa0fd('0x61')][_0xa0fd('0xbb')]&&_0x31776b[_0xa0fd('0x61')][_0xa0fd('0xc2')]&&_0x31776b[_0xa0fd('0x61')][_0xa0fd('0xbb')]!=_0x31776b['body'][_0xa0fd('0xc2')]){_0x195fe5[_0xa0fd('0xbb')]=_0x31776b['body'][_0xa0fd('0xc2')];}return _0xba90df[_0xa0fd('0x6f')](_0x195fe5);})[_0xa0fd('0x29')](function(_0xf5dff9){_0x44acb5['interaction']=_0xf5dff9[_0xa0fd('0x2b')]({'plain':!![]});_0x44acb5[_0xa0fd('0xc1')][_0xa0fd('0xc3')]=!_0x4c398f;if(_0x44acb5[_0xa0fd('0xc1')][_0xa0fd('0xc3')]){if(_0x44acb5[_0xa0fd('0xb1')][_0xa0fd('0xc4')]){_0x44acb5['applications'][_0xa0fd('0xc5')]({'id':0x0,'priority':_0x44acb5['applications'][_0xa0fd('0x51')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0xa0fd('0xc6')]['create']({'body':_0x31776b[_0xa0fd('0x61')][_0xa0fd('0x61')],'ChatWebsiteId':_0x31776b[_0xa0fd('0x70')]['id'],'ChatInteractionId':_0xf5dff9['id'],'direction':'in','ContactId':_0x44acb5[_0xa0fd('0xb9')]['id'],'AttachmentId':_0x31776b[_0xa0fd('0x61')][_0xa0fd('0xc7')]});})['then'](function(_0x4d2500){_0x44acb5[_0xa0fd('0x1f')]=_0x4d2500;if(!_0x44acb5[_0xa0fd('0xc1')][_0xa0fd('0xc8')]){return;}return db['User'][_0xa0fd('0x5f')]({'attributes':['id','name'],'where':{'id':_0x44acb5[_0xa0fd('0xc1')][_0xa0fd('0xc8')]}});})[_0xa0fd('0x29')](function(_0x259193){if(_0x259193){_0x44acb5[_0xa0fd('0xc9')][_0xa0fd('0xca')]({'id':0x0,'priority':0x0,'app':_0xa0fd('0xcb'),'appdata':_0x259193[_0xa0fd('0x2f')]+','+(_0x44acb5[_0xa0fd('0xb1')][_0xa0fd('0xcc')]||0xa),'interval':_0xa0fd('0xcd')});_0x44acb5[_0xa0fd('0xce')]=!![];}if(!_0x44acb5[_0xa0fd('0xc1')]['queueId']){return;}return db['ChatQueue'][_0xa0fd('0x5f')]({'attributes':['id',_0xa0fd('0x2f')],'where':{'id':_0x44acb5[_0xa0fd('0xc1')][_0xa0fd('0xcf')]}});})[_0xa0fd('0x29')](function(_0x19515b){if(_0x19515b){_0x44acb5['applications'][_0xa0fd('0xca')]({'id':0x0,'priority':0x1,'app':_0xa0fd('0xd0'),'appdata':_0x19515b['name']+','+(_0x44acb5[_0xa0fd('0xb1')][_0xa0fd('0xd1')]||0x12c),'interval':_0xa0fd('0xcd')});}return respondWithRpcPromise(_0xa0fd('0xd2'),_0xa0fd('0xd3'),_0x44acb5);})[_0xa0fd('0x29')](function(_0x235fc2){respondWithRpcPromise(_0xa0fd('0xd4'),_0xa0fd('0xd4'),{'event':_0xa0fd('0x9f'),'message':_0x235fc2},client9002);return _0x235fc2;})[_0xa0fd('0x29')](respondWithResult(_0x3afe1a,null))[_0xa0fd('0x5c')](APIHandleError(_0x3afe1a));};exports[_0xa0fd('0xd5')]=function(_0x214ff2,_0x174406){var _0x4e4153,_0x48e0c0,_0x1807e3;var _0x442e23=[];var _0x42365d={};var _0x32e160=_0x214ff2['files']||[];var _0x49ae73=[];var _0x120fb2;return db[_0xa0fd('0xa5')][_0xa0fd('0x71')]()[_0xa0fd('0x29')](function(_0x4c95e2){if(!_0x4c95e2){throw new db[(_0xa0fd('0xd6'))][(_0xa0fd('0xd7'))](_0xa0fd('0xd8'));}_0x442e23=_[_0xa0fd('0xd9')](_[_0xa0fd('0x76')](_0x4c95e2),['createdAt',_0xa0fd('0xa9'),'CompanyId',_0xa0fd('0xb7')]);if(_0x214ff2['body']['id']){delete _0x214ff2[_0xa0fd('0x61')]['id'];}if(_[_0xa0fd('0x8e')](_0x214ff2[_0xa0fd('0x61')]['from'])){throw _0x174406[_0xa0fd('0x22')](0x1f4)[_0xa0fd('0x30')](new db[(_0xa0fd('0xd6'))][(_0xa0fd('0xd7'))](_0xa0fd('0xda')));}if(_[_0xa0fd('0x8e')](_0x214ff2[_0xa0fd('0x61')][_0xa0fd('0x61')])||_0x214ff2['body'][_0xa0fd('0x61')]===''){throw _0x174406[_0xa0fd('0x22')](0x1f4)['send'](new db[(_0xa0fd('0xd6'))][(_0xa0fd('0xd7'))](_0xa0fd('0xdb')));}if(_[_0xa0fd('0x8e')](_0x214ff2[_0xa0fd('0x61')][_0xa0fd('0xdc')])){throw _0x174406[_0xa0fd('0x22')](0x1f4)[_0xa0fd('0x30')](new db[(_0xa0fd('0xd6'))][(_0xa0fd('0xd7'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x442e23));}if(!_[_0xa0fd('0xa8')](_0x442e23,_0x214ff2[_0xa0fd('0x61')][_0xa0fd('0xdc')])){throw _0x174406[_0xa0fd('0x22')](0x1f4)[_0xa0fd('0x30')](new db[(_0xa0fd('0xd6'))]['ValidationError'](_0xa0fd('0xdd')+_0x442e23));}_0x42365d[_0x214ff2[_0xa0fd('0x61')]['mapKeyOffline']]=_0x214ff2[_0xa0fd('0x61')]['from'];})[_0xa0fd('0x29')](function(){return db[_0xa0fd('0x4a')][_0xa0fd('0x5f')]({'where':{'id':_0x214ff2[_0xa0fd('0x70')]['id']},'include':[{'model':db[_0xa0fd('0xac')],'as':_0xa0fd('0xad')},{'model':db[_0xa0fd('0xde')],'as':_0xa0fd('0xde')}]});})[_0xa0fd('0x29')](handleEntityNotFound(_0x174406,null))[_0xa0fd('0x29')](function(_0x31d06){if(_0x31d06&&_0x31d06[_0xa0fd('0xad')]){_0x48e0c0=_0x31d06;var _0x504f6d=_[_0xa0fd('0x12')](_0x214ff2['body'],{'firstName':_0x214ff2['body'][_0xa0fd('0xab')],'phone':_0x214ff2[_0xa0fd('0x61')][_0xa0fd('0xab')],'ListId':_0x31d06['ListId']});_0x504f6d[_0x214ff2[_0xa0fd('0x61')][_0xa0fd('0xdc')]]=_0x214ff2['body'][_0xa0fd('0xab')];return db['CmContact'][_0xa0fd('0xdf')]({'where':_0x42365d,'defaults':_0x504f6d});}})[_0xa0fd('0xe0')](function(_0x29b790){if(_0x29b790){_0x1807e3=_0x29b790;var _0x13aac3=fs[_0xa0fd('0xe1')](path[_0xa0fd('0x89')](config[_0xa0fd('0x8a')],_0xa0fd('0xe2')),_0xa0fd('0xe3'));var _0x549ac2=ejs['render'](_0x13aac3,{'body':_['toPairs'](_0x214ff2[_0xa0fd('0x61')][_0xa0fd('0x61')]),'bodyTitle':_0x48e0c0[_0xa0fd('0xe4')]});return db[_0xa0fd('0xe5')]['create']({'body':_0x549ac2,'plainBody':htmlToText['fromString'](_0x549ac2),'ContactId':_0x29b790['id'],'ChatWebsiteId':_0x48e0c0['id']});}})['then'](function(_0x36c22d){_0x120fb2=_0x36c22d;if(_0x32e160[_0xa0fd('0x51')]){var _0x12f159=_0x32e160[_0xa0fd('0x49')](function(_0x1fe7b3){return{'name':_0x1fe7b3['originalname'],'basename':_0x1fe7b3[_0xa0fd('0x83')],'type':_0x1fe7b3['mimetype'],'ChatOfflineMessageId':_0x36c22d['id']};});_0x49ae73=_0x12f159[_0xa0fd('0x49')](_0x5b8536=>{var _0x330cf5={'filename':_0x5b8536[_0xa0fd('0x2f')],'path':path[_0xa0fd('0x89')](config['root'],_0xa0fd('0xe6'),'files',_0xa0fd('0xe7'),'offline-chat',_0x5b8536[_0xa0fd('0xe8')])};return _0x330cf5;});if(!_0x48e0c0[_0xa0fd('0xe9')]){return db['sequelize'][_0xa0fd('0xea')](function(_0xf20388){return db[_0xa0fd('0xeb')][_0xa0fd('0xec')](_0x12f159,{'transaction':_0xf20388});});}}})[_0xa0fd('0x29')](function(){if(_0x120fb2){_0x4e4153=_0x120fb2;return db[_0xa0fd('0xde')][_0xa0fd('0x75')]({'where':{'service':!![]},'include':[{'model':db[_0xa0fd('0xed')],'as':_0xa0fd('0xee'),'raw':!![],'include':[{'model':db[_0xa0fd('0xef')],'as':_0xa0fd('0xef'),'raw':!![]}]}]});}})[_0xa0fd('0x29')](function(_0x52e9d5){if(_0x52e9d5&&_0x52e9d5['Smtp']&&_0x48e0c0[_0xa0fd('0xf0')]&&_0x48e0c0[_0xa0fd('0xf1')]){var _0x53e964=_0x52e9d5[_0xa0fd('0xf2')]();return respondWithRpcPromise(_0xa0fd('0xf3'),'sendMail',{'account':_0x53e964,'message':{'from':util[_0xa0fd('0x3e')](_0xa0fd('0xf4'),_0x52e9d5[_0xa0fd('0x2f')],_0x52e9d5[_0xa0fd('0xf5')]||_0x52e9d5[_0xa0fd('0xee')][_0xa0fd('0x68')]),'to':_0x48e0c0[_0xa0fd('0xf1')],'subject':_0x48e0c0[_0xa0fd('0xf6')],'html':_0x4e4153[_0xa0fd('0x61')],'attachments':_0x49ae73}},client9003)[_0xa0fd('0x29')](function(){return _0x4e4153;})[_0xa0fd('0x5c')](function(_0x384fd9){logger[_0xa0fd('0x1d')](_0x384fd9);});}})['then'](function(){if(_0x48e0c0&&_0x48e0c0[_0xa0fd('0xe9')]&&_0x48e0c0[_0xa0fd('0xf7')]){var _0x8e6ad8=[];if(_0x32e160[_0xa0fd('0x51')]){_0x8e6ad8=_0x32e160['map'](function(_0x35ed76){return{'name':_0x35ed76[_0xa0fd('0xf8')],'basename':_0x35ed76[_0xa0fd('0x83')],'type':_0x35ed76[_0xa0fd('0xf9')],'ChatOfflineMessageId':_0x120fb2['id']};});}var _0x548cd1;if(!_['isNil'](_0x48e0c0[_0xa0fd('0xfa')])){var _0x21f169=_['map'](_0x214ff2['body'],function(_0x23826c){return _0x23826c;});var _0x14eed8=_['toPairsIn'](_0x21f169)[0x0];var _0x59a9d6=_[_0xa0fd('0xfb')](_0x14eed8,function(_0x208022){return _0x208022;});_0x548cd1=_0x59a9d6[0x1][_0x48e0c0[_0xa0fd('0xfa')]];}var _0x2cb010={'from':_0x1807e3[_0xa0fd('0xf5')],'firstName':_0x1807e3[_0xa0fd('0x38')],'lastName':_0x1807e3[_0xa0fd('0x39')],'mapKey':_0xa0fd('0xf5'),'message':{'from':_0x1807e3['email'],'to':_0x48e0c0[_0xa0fd('0xde')][_0xa0fd('0xf5')],'cc':'','subject':_[_0xa0fd('0x8e')](_0x548cd1)?_0x48e0c0[_0xa0fd('0xf6')]:_0x548cd1,'messageId':'','sentAt':new Date(),'attach':_0x8e6ad8[_0xa0fd('0x51')],'attachments':_0x8e6ad8,'originChannel':_0xa0fd('0xfc'),'ChatWebsiteId':_0x48e0c0['id'],'ChatOfflineMessageId':_0x4e4153['id'],'originTo':_0x48e0c0['MailAccount'][_0xa0fd('0xf5')]},'body':_0x4e4153[_0xa0fd('0x61')]};var _0x2cbaea={'account':{'id':_0x48e0c0[_0xa0fd('0xf7')]},'body':_0x2cb010,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount',_0xa0fd('0xfd'),_0x2cbaea,client9001)[_0xa0fd('0x29')](function(){return _0x4e4153;})['catch'](function(_0x1d6296){logger[_0xa0fd('0x1d')](_0x1d6296);});}return;})[_0xa0fd('0x29')](function(){if(_0x4e4153){return _0x4e4153;}})[_0xa0fd('0x29')](respondWithResult(_0x174406,null))[_0xa0fd('0x5c')](function(){for(var _0x3257c6 of _0x32e160){var _0x1acc84=path[_0xa0fd('0x89')](config[_0xa0fd('0x8a')],_0xa0fd('0xe6'),'files','attachments',_0xa0fd('0xfe'),_0x3257c6[_0xa0fd('0x83')]);fs_extra[_0xa0fd('0xff')](_0x1acc84)[_0xa0fd('0x5c')](function(_0x1aec9d){logger['error']('Could\x20not\x20remove\x20attachment\x20file',_0x1acc84,_0x1aec9d);});}});};exports[_0xa0fd('0x100')]=function(_0x136591,_0x567244){return db[_0xa0fd('0xbd')][_0xa0fd('0x5f')]({'where':{'id':_0x136591['params']['id']}})['then'](handleEntityNotFound(_0x567244,null))[_0xa0fd('0x29')](function(_0x6ee599){if(_0x6ee599){return _0x6ee599[_0xa0fd('0x100')](_0x136591[_0xa0fd('0x61')]['ids'],_[_0xa0fd('0x101')](_0x136591[_0xa0fd('0x61')],[_0xa0fd('0x80'),'id'])||{});}})[_0xa0fd('0x29')](respondWithResult(_0x567244,null))[_0xa0fd('0x5c')](handleError(_0x567244,null));};exports[_0xa0fd('0x102')]=function(_0x108811,_0x1b5223){var _0x180281={'raw':![],'where':{}};var _0x571ce7={};var _0x7b7808={'count':0x0,'rows':[]};return db[_0xa0fd('0x4a')]['findOne']({'where':{'id':_0x108811[_0xa0fd('0x70')]['id']}})['then'](handleEntityNotFound(_0x1b5223,null))[_0xa0fd('0x29')](function(_0xf5039e){if(_0xf5039e){_0x571ce7['model']=_[_0xa0fd('0x76')](db[_0xa0fd('0xbd')][_0xa0fd('0x7e')]);_0x571ce7[_0xa0fd('0x4d')]=_[_0xa0fd('0x76')](_0x108811['query']);_0x571ce7['filters']=_[_0xa0fd('0x4f')](_0x571ce7[_0xa0fd('0x44')],_0x571ce7[_0xa0fd('0x4d')]);_0x180281[_0xa0fd('0x4e')]=_[_0xa0fd('0x4f')](_0x571ce7[_0xa0fd('0x44')],qs[_0xa0fd('0x50')](_0x108811['query'][_0xa0fd('0x50')]));_0x180281[_0xa0fd('0x4e')]=_0x180281[_0xa0fd('0x4e')][_0xa0fd('0x51')]?_0x180281[_0xa0fd('0x4e')]:_0x571ce7['model'];if(!_0x108811[_0xa0fd('0x4d')][_0xa0fd('0x78')](_0xa0fd('0x79'))){_0x180281[_0xa0fd('0x26')]=qs[_0xa0fd('0x26')](_0x108811[_0xa0fd('0x4d')]['limit']);_0x180281[_0xa0fd('0x28')]=qs['offset'](_0x108811['query'][_0xa0fd('0x28')]);}_0x180281[_0xa0fd('0x7a')]=qs['sort'](_0x108811[_0xa0fd('0x4d')][_0xa0fd('0x52')]);_0x180281[_0xa0fd('0x53')]=qs[_0xa0fd('0x54')](_[_0xa0fd('0x55')](_0x108811[_0xa0fd('0x4d')],_0x571ce7[_0xa0fd('0x54')]));_0x180281[_0xa0fd('0x53')]['ChatWebsiteId']=_0xf5039e['id'];if(_0x108811[_0xa0fd('0x4d')][_0xa0fd('0x56')]){_0x180281[_0xa0fd('0x53')]=_['merge'](_0x180281[_0xa0fd('0x53')],{'$or':_[_0xa0fd('0x49')](_0x180281['attributes'],function(_0x20b71e){var _0xb927a7={};_0xb927a7[_0x20b71e]={'$like':'%'+_0x108811[_0xa0fd('0x4d')]['filter']+'%'};return _0xb927a7;})});}_0x180281=_[_0xa0fd('0x58')]({},_0x180281,_0x108811[_0xa0fd('0x5e')]);return db['ChatInteraction'][_0xa0fd('0x27')]({'where':_0x180281[_0xa0fd('0x53')]})[_0xa0fd('0x29')](function(_0x2094fd){_0x7b7808['count']=_0x2094fd;if(_0x108811['query']['includeAll']){_0x180281['include']=[{'model':db[_0xa0fd('0xa5')],'as':_0xa0fd('0x103'),'required':![]},{'model':db[_0xa0fd('0x104')],'as':_0xa0fd('0x105'),'attributes':[_0xa0fd('0x2f'),_0xa0fd('0x106'),_0xa0fd('0x107')],'required':![]},{'model':db[_0xa0fd('0x108')],'as':_0xa0fd('0x109'),'attributes':['id',_0xa0fd('0x2f'),'color'],'where':_0x108811[_0xa0fd('0x4d')][_0xa0fd('0x10a')]?{'id':_0x108811['query'][_0xa0fd('0x10a')]}:undefined,'required':_0x108811['query'][_0xa0fd('0x10a')]?!![]:![]}];}return db[_0xa0fd('0xbd')]['findAll'](_0x180281);})['then'](function(_0x184747){_0x7b7808[_0xa0fd('0x5b')]=_0x184747;return _0x7b7808;});}})[_0xa0fd('0x29')](respondWithFilteredResult(_0x1b5223,_0x180281))[_0xa0fd('0x5c')](handleError(_0x1b5223,null));};exports[_0xa0fd('0x10b')]=function(_0x1f1f70,_0x34f26d){var _0x2b5339=0x0;var _0x561ee8=0x0;var _0x467828=![];var _0x4410d3;var _0x2dd046;return db[_0xa0fd('0x4a')]['find']({'where':{'id':_0x1f1f70[_0xa0fd('0x70')]['id']},'include':[{'model':db[_0xa0fd('0x9b')],'as':_0xa0fd('0x9b'),'include':[{'model':db['Interval'],'as':_0xa0fd('0xaf'),'attributes':['id',_0xa0fd('0xb0')]}]}]})[_0xa0fd('0x29')](handleEntityNotFound(_0x34f26d,null))[_0xa0fd('0x29')](function(_0x169292){if(_0x169292){_0x4410d3=_0x169292;return _0x169292['getProactiveActions']({'raw':!![]});}})[_0xa0fd('0x29')](function(_0x4f86bd){if(_0x4410d3){if(_0x4f86bd){_0x2dd046=_0x4f86bd;}}return require(_0xa0fd('0x8c'))[_0xa0fd('0x8d')]();})[_0xa0fd('0x29')](function(_0x1540d0){if(_0x1540d0){_0x561ee8=_0x1540d0[_0xa0fd('0x10c')];_0x467828=_0x1540d0[_0xa0fd('0x10d')];}})[_0xa0fd('0x29')](function(){return db[_0xa0fd('0xbd')][_0xa0fd('0x27')]({'where':{'closed':![]}});})[_0xa0fd('0x29')](function(_0x1e8ca9){_0x2b5339=_0x1e8ca9;if(_0x561ee8&&_0x1e8ca9>_0x561ee8){return db[_0xa0fd('0x10e')][_0xa0fd('0x75')]({'where':{'id':0x1}})[_0xa0fd('0x29')](function(_0x2d73c8){if(_0x2d73c8){_0x2d73c8[_0xa0fd('0x10f')](_0xa0fd('0x110'));}});}})['then'](function(){var _0x245bd2=_0x4410d3['Interval'];var _0x8b14b0=_0x4410d3[_0xa0fd('0x9d')]||undefined;return _0x245bd2?_0x245bd2['ifTime'](_0x8b14b0):!![];})['then'](function(_0x393d4d){var _0x34b2b0=fs[_0xa0fd('0xe1')](path[_0xa0fd('0x89')](config[_0xa0fd('0x8a')],_0xa0fd('0x111')),'utf8');var _0x44ccc5=_0xa0fd('0x112');var _0x4ba475=![];var _0x188b93,_0x2ee2d2;if(_0x1f1f70[_0xa0fd('0xba')]['referer']){_0x188b93=new URL(_0x1f1f70[_0xa0fd('0xba')][_0xa0fd('0x3b')])[_0xa0fd('0x113')];}else if(_0x1f1f70['headers'][_0xa0fd('0x113')]){_0x188b93=new URL(_0x1f1f70['headers'][_0xa0fd('0x113')])[_0xa0fd('0x113')];}else{_0x188b93=_0xa0fd('0x114');}_0x2ee2d2=typeof _0x4410d3[_0xa0fd('0x62')][_0xa0fd('0x63')](',')[_0xa0fd('0x5f')](function(_0xe2fb30){return wildcardUtils[_0xa0fd('0x115')](_0xe2fb30,_0x188b93);})!==_0xa0fd('0x25');var _0x2a1b40={'chatVersion':_0x44ccc5,'chatWebsiteAddressOrigin':_0x2ee2d2?_0x188b93:_0x4410d3[_0xa0fd('0x62')],'remote':_0x4410d3[_0xa0fd('0x116')],'query':querystring[_0xa0fd('0x1c')](_[_0xa0fd('0x58')](_0x4410d3['get']({'plain':!![]}),{'customerIp':_0x1f1f70[_0xa0fd('0xba')][_0xa0fd('0x36')]||_0x1f1f70[_0xa0fd('0xba')][_0xa0fd('0x117')]||_0x1f1f70[_0xa0fd('0x118')][_0xa0fd('0x119')]||_0x1f1f70['ip'],'referer':_0x1f1f70[_0xa0fd('0xba')][_0xa0fd('0x3b')],'openedInteractions':_0x2b5339,'maxInteractions':_0x561ee8,'virtual':_0x467828[_0xa0fd('0x10c')],'online':_0x393d4d,'custom':_0x467828,'address':_0x2ee2d2?_0x188b93:null}))['replace'](/'/g,'\x5c\x27')};_0x34f26d[_0xa0fd('0x30')](ejs['render'](Mustache[_0xa0fd('0x11a')](_0x34b2b0,_0x2a1b40),{'proactiveActions':_0x2dd046,'alignment':_0x4410d3[_0xa0fd('0x11b')],'verticalAlignment':_0x4410d3['verticalAlignment'],'div_color':_0x4410d3['color'],'labelText':_0x4410d3['labelText'],'text_color':_0x4410d3[_0xa0fd('0x11c')],'text_button_color':_0x4410d3['textButtonColor'],'button_color':_0x4410d3[_0xa0fd('0x11d')],'background_color':_0x4410d3[_0xa0fd('0x11e')],'hideWhenOffline':_0x4410d3[_0xa0fd('0x11f')],'intervalId':_0x4410d3[_0xa0fd('0x120')],'isDevelopment':_0x4ba475,'chatVersion':_0x44ccc5}));})[_0xa0fd('0x5c')](handleError(_0x34f26d,null));};exports[_0xa0fd('0x121')]=function(_0x3ff43e,_0xada1a0){var _0x1b5abb=_0x3ff43e['params']['id'];var _0x29de9b=_0x3ff43e[_0xa0fd('0x61')];var _0x4d1788=0xc8;var _0x447a6e=null;return db[_0xa0fd('0x122')]['transaction']({'isolationLevel':db[_0xa0fd('0x122')][_0xa0fd('0x123')]['ISOLATION_LEVELS'][_0xa0fd('0x124')]},function(_0x25227b){return db['ChatWebsite'][_0xa0fd('0x75')]({'where':{'id':_0x1b5abb},'transaction':_0x25227b})[_0xa0fd('0x29')](function(_0x139b1b){if(_0x139b1b){return db[_0xa0fd('0xae')][_0xa0fd('0x2a')]({'where':{'ChatWebsiteId':_0x1b5abb},'transaction':_0x25227b})[_0xa0fd('0x29')](function(){var _0x1ee64c=_[_0xa0fd('0x49')](_0x29de9b,function(_0x2583a9){_0x2583a9['ChatWebsiteId']=_0x1b5abb;return _0x2583a9;});return db[_0xa0fd('0xae')][_0xa0fd('0xec')](_0x1ee64c,{'transaction':_0x25227b});});}else{_0x4d1788=0x194;_0x447a6e=[];}});})[_0xa0fd('0x29')](function(){if(_0x4d1788!==0x194){return db[_0xa0fd('0xae')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x1b5abb},'order':_0xa0fd('0xb4')})[_0xa0fd('0x29')](function(_0x264a28){_0x447a6e=_0x264a28;});}})[_0xa0fd('0x5c')](function(_0x10ed7d){_0x4d1788=0x1f4;logger[_0xa0fd('0x1d')](_0x10ed7d['stack']);if(_0x10ed7d[_0xa0fd('0x2f')]){delete _0x10ed7d[_0xa0fd('0x2f')];}_0x447a6e=_0x10ed7d;})[_0xa0fd('0x125')](function(){if(_0x447a6e===null){_0xada1a0[_0xa0fd('0x2d')](_0x4d1788);}else{if(_0x4d1788===0x1f4){_0xada1a0[_0xa0fd('0x22')](_0x4d1788)['send'](_0x447a6e);}else{_0xada1a0[_0xa0fd('0x22')](_0x4d1788)[_0xa0fd('0x24')](_0x447a6e);}}});};exports[_0xa0fd('0x126')]=function(_0x44d5a8,_0x4639b9){var _0x588214={};var _0x19a1a9={};var _0x3d212f;var _0x5c9f33;return db[_0xa0fd('0x4a')][_0xa0fd('0x75')]({'where':{'id':_0x44d5a8[_0xa0fd('0x70')]['id']}})[_0xa0fd('0x29')](handleEntityNotFound(_0x4639b9,null))[_0xa0fd('0x29')](function(_0x3af596){if(_0x3af596){_0x3d212f=_0x3af596;_0x19a1a9[_0xa0fd('0x44')]=_['keys'](db[_0xa0fd('0xae')][_0xa0fd('0x7e')]);_0x19a1a9[_0xa0fd('0x4d')]=_['keys'](_0x44d5a8[_0xa0fd('0x4d')]);_0x19a1a9[_0xa0fd('0x54')]=_['intersection'](_0x19a1a9[_0xa0fd('0x44')],_0x19a1a9[_0xa0fd('0x4d')]);_0x588214['attributes']=_[_0xa0fd('0x4f')](_0x19a1a9[_0xa0fd('0x44')],qs[_0xa0fd('0x50')](_0x44d5a8[_0xa0fd('0x4d')][_0xa0fd('0x50')]));_0x588214[_0xa0fd('0x4e')]=_0x588214['attributes']['length']?_0x588214[_0xa0fd('0x4e')]:_0x19a1a9['model'];_0x588214[_0xa0fd('0x7a')]=qs[_0xa0fd('0x52')](_0x44d5a8[_0xa0fd('0x4d')][_0xa0fd('0x52')]);_0x588214[_0xa0fd('0x53')]=qs['filters'](_[_0xa0fd('0x55')](_0x44d5a8['query'],_0x19a1a9['filters']));if(_0x44d5a8[_0xa0fd('0x4d')][_0xa0fd('0x56')]){_0x588214['where']=_[_0xa0fd('0x58')](_0x588214['where'],{'$or':_['map'](_0x588214[_0xa0fd('0x4e')],function(_0x14a866){var _0xb5a5bf={};_0xb5a5bf[_0x14a866]={'$like':'%'+_0x44d5a8[_0xa0fd('0x4d')][_0xa0fd('0x56')]+'%'};return _0xb5a5bf;})});}_0x588214=_[_0xa0fd('0x58')]({},_0x588214,_0x44d5a8[_0xa0fd('0x5e')]);return _0x3d212f[_0xa0fd('0x126')](_0x588214);}})[_0xa0fd('0x29')](function(_0x266848){if(_0x266848){_0x5c9f33=_0x266848['length'];if(!_0x44d5a8[_0xa0fd('0x4d')][_0xa0fd('0x78')](_0xa0fd('0x79'))){_0x588214[_0xa0fd('0x26')]=qs[_0xa0fd('0x26')](_0x44d5a8[_0xa0fd('0x4d')][_0xa0fd('0x26')]);_0x588214[_0xa0fd('0x28')]=qs['offset'](_0x44d5a8['query'][_0xa0fd('0x28')]);}return _0x3d212f[_0xa0fd('0x126')](_0x588214);}})[_0xa0fd('0x29')](function(_0x2cf9ed){if(_0x2cf9ed){return _0x2cf9ed?{'count':_0x5c9f33,'rows':_0x2cf9ed}:null;}})[_0xa0fd('0x29')](respondWithResult(_0x4639b9,null))[_0xa0fd('0x5c')](handleError(_0x4639b9,null));};exports[_0xa0fd('0x127')]=function(_0x52d5a9,_0x5918ed){return db[_0xa0fd('0x128')][_0xa0fd('0x5f')]({'where':{'id':_0x52d5a9[_0xa0fd('0x70')]['id']}})[_0xa0fd('0x29')](handleEntityNotFound(_0x5918ed,null))[_0xa0fd('0x29')](function(_0x77ab48){if(_0x77ab48){return _0x77ab48['addProactiveActions'](_0x52d5a9['body'][_0xa0fd('0x80')],_['omit'](_0x52d5a9[_0xa0fd('0x61')],['ids','id'])||{});}})[_0xa0fd('0x29')](respondWithResult(_0x5918ed,null))[_0xa0fd('0x5c')](handleError(_0x5918ed,null));};exports[_0xa0fd('0x129')]=function(_0x1bcb40,_0x39b66b){var _0x6d66bf={};var _0x547549={};var _0x7d6fdf;var _0x5bf1a5;return db[_0xa0fd('0x4a')]['findOne']({'where':{'id':_0x1bcb40[_0xa0fd('0x70')]['id']}})['then'](handleEntityNotFound(_0x39b66b,null))[_0xa0fd('0x29')](function(_0x1320bd){if(_0x1320bd){_0x7d6fdf=_0x1320bd;_0x547549[_0xa0fd('0x44')]=_[_0xa0fd('0x76')](db[_0xa0fd('0x12a')]['rawAttributes']);_0x547549[_0xa0fd('0x4d')]=_[_0xa0fd('0x76')](_0x1bcb40[_0xa0fd('0x4d')]);_0x547549[_0xa0fd('0x54')]=_[_0xa0fd('0x4f')](_0x547549[_0xa0fd('0x44')],_0x547549[_0xa0fd('0x4d')]);_0x6d66bf[_0xa0fd('0x4e')]=_[_0xa0fd('0x4f')](_0x547549[_0xa0fd('0x44')],qs[_0xa0fd('0x50')](_0x1bcb40[_0xa0fd('0x4d')]['fields']));_0x6d66bf[_0xa0fd('0x4e')]=_0x6d66bf[_0xa0fd('0x4e')][_0xa0fd('0x51')]?_0x6d66bf['attributes']:_0x547549['model'];_0x6d66bf[_0xa0fd('0x7a')]=qs[_0xa0fd('0x52')](_0x1bcb40[_0xa0fd('0x4d')][_0xa0fd('0x52')]);_0x6d66bf['where']=qs[_0xa0fd('0x54')](_[_0xa0fd('0x55')](_0x1bcb40[_0xa0fd('0x4d')],_0x547549[_0xa0fd('0x54')]));if(_0x1bcb40[_0xa0fd('0x4d')][_0xa0fd('0x56')]){_0x6d66bf['where']=_[_0xa0fd('0x58')](_0x6d66bf[_0xa0fd('0x53')],{'$or':_[_0xa0fd('0x49')](_0x6d66bf[_0xa0fd('0x4e')],function(_0x22014e){var _0x19dfe3={};_0x19dfe3[_0x22014e]={'$like':'%'+_0x1bcb40[_0xa0fd('0x4d')][_0xa0fd('0x56')]+'%'};return _0x19dfe3;})});}_0x6d66bf=_['merge']({},_0x6d66bf,_0x1bcb40['options']);return _0x7d6fdf[_0xa0fd('0x129')](_0x6d66bf);}})['then'](function(_0x1131e3){if(_0x1131e3){_0x5bf1a5=_0x1131e3[_0xa0fd('0x51')];if(!_0x1bcb40['query']['hasOwnProperty'](_0xa0fd('0x79'))){_0x6d66bf[_0xa0fd('0x26')]=qs['limit'](_0x1bcb40[_0xa0fd('0x4d')]['limit']);_0x6d66bf[_0xa0fd('0x28')]=qs[_0xa0fd('0x28')](_0x1bcb40[_0xa0fd('0x4d')]['offset']);}return _0x7d6fdf['getProactiveActions'](_0x6d66bf);}})['then'](function(_0x5a60a9){if(_0x5a60a9){return _0x5a60a9?{'count':_0x5bf1a5,'rows':_0x5a60a9}:null;}})[_0xa0fd('0x29')](respondWithResult(_0x39b66b,null))['catch'](handleError(_0x39b66b,null));};exports[_0xa0fd('0x12b')]=function(_0x3b0925,_0x3ce595){var _0x56628c=_0x3b0925[_0xa0fd('0x4d')][_0xa0fd('0x12c')]==='false'?'offlineForm':_0xa0fd('0x12d');return db[_0xa0fd('0x4a')][_0xa0fd('0x5f')]({'attributes':['id',_0x56628c],'where':{'id':_0x3b0925[_0xa0fd('0x70')]['id']}})[_0xa0fd('0x29')](handleEntityNotFound(_0x3ce595,null))[_0xa0fd('0x29')](function(_0x158b1b){if(_0x158b1b){var _0x172b4a=_0x158b1b[_0x56628c];var _0x299209=_0x172b4a&&_0x172b4a[_0xa0fd('0x12e')]?_0x172b4a[_0xa0fd('0x12e')]:[];_0x3ce595[_0xa0fd('0x30')]({'fromKey':_[_0xa0fd('0x8e')](_0x172b4a[_0xa0fd('0x12f')])?undefined:_0x172b4a['fromKey'],'count':_0x299209[_0xa0fd('0x51')],'rows':_0x299209});}})[_0xa0fd('0x5c')](handleError(_0x3ce595,null));};exports[_0xa0fd('0x130')]=function(_0x2d4dc4,_0x2777c0){var _0x3f21a8={'raw':![],'where':{}};var _0x275578={};var _0x11a06a={'count':0x0,'rows':[]};return db[_0xa0fd('0x4a')][_0xa0fd('0x75')]({'where':{'id':_0x2d4dc4[_0xa0fd('0x70')]['id']}})['then'](handleEntityNotFound(_0x2777c0,null))['then'](function(_0x462b31){if(_0x462b31){_0x275578[_0xa0fd('0x44')]=_[_0xa0fd('0x76')](db[_0xa0fd('0xe5')][_0xa0fd('0x7e')]);_0x275578[_0xa0fd('0x4d')]=_['keys'](_0x2d4dc4['query']);_0x275578[_0xa0fd('0x54')]=_[_0xa0fd('0x4f')](_0x275578[_0xa0fd('0x44')],_0x275578['query']);_0x3f21a8[_0xa0fd('0x4e')]=_[_0xa0fd('0x4f')](_0x275578[_0xa0fd('0x44')],qs['fields'](_0x2d4dc4['query'][_0xa0fd('0x50')]));_0x3f21a8[_0xa0fd('0x4e')]=_0x3f21a8[_0xa0fd('0x4e')]['length']?_0x3f21a8[_0xa0fd('0x4e')]:_0x275578[_0xa0fd('0x44')];if(!_0x2d4dc4[_0xa0fd('0x4d')][_0xa0fd('0x78')](_0xa0fd('0x79'))){_0x3f21a8[_0xa0fd('0x26')]=qs[_0xa0fd('0x26')](_0x2d4dc4['query'][_0xa0fd('0x26')]);_0x3f21a8[_0xa0fd('0x28')]=qs['offset'](_0x2d4dc4[_0xa0fd('0x4d')][_0xa0fd('0x28')]);}_0x3f21a8[_0xa0fd('0x7a')]=qs['sort'](_0x2d4dc4[_0xa0fd('0x4d')][_0xa0fd('0x52')]);_0x3f21a8[_0xa0fd('0x53')]=qs['filters'](_[_0xa0fd('0x55')](_0x2d4dc4[_0xa0fd('0x4d')],_0x275578[_0xa0fd('0x54')]));_0x3f21a8[_0xa0fd('0x53')]['ChatWebsiteId']=_0x462b31['id'];if(_0x2d4dc4[_0xa0fd('0x4d')][_0xa0fd('0x56')]){_0x3f21a8[_0xa0fd('0x53')]=_[_0xa0fd('0x58')](_0x3f21a8['where'],{'$or':_[_0xa0fd('0x49')](_0x3f21a8[_0xa0fd('0x4e')],function(_0x147241){var _0x260a93={};_0x260a93[_0x147241]={'$like':'%'+_0x2d4dc4[_0xa0fd('0x4d')][_0xa0fd('0x56')]+'%'};return _0x260a93;})});}_0x3f21a8=_['merge']({},_0x3f21a8,_0x2d4dc4[_0xa0fd('0x5e')]);return db[_0xa0fd('0xe5')]['count']({'where':_0x3f21a8[_0xa0fd('0x53')]})['then'](function(_0x212318){_0x11a06a[_0xa0fd('0x27')]=_0x212318;if(_0x2d4dc4[_0xa0fd('0x4d')][_0xa0fd('0x59')]){_0x3f21a8[_0xa0fd('0x5a')]=[{'all':!![]}];}else{_0x3f21a8[_0xa0fd('0x5a')]=[{'model':db[_0xa0fd('0xa5')],'as':_0xa0fd('0x103'),'required':![]},{'model':db['Attachment'],'as':'Attachments','required':![]}];}return db[_0xa0fd('0xe5')][_0xa0fd('0x7f')](_0x3f21a8);})['then'](function(_0x2eb0d6){_0x11a06a['rows']=_0x2eb0d6;return _0x11a06a;});}})[_0xa0fd('0x29')](respondWithFilteredResult(_0x2777c0,_0x3f21a8))[_0xa0fd('0x5c')](handleError(_0x2777c0,null));};exports[_0xa0fd('0x131')]=function(_0x3a263a,_0x30e2e2){return db[_0xa0fd('0x4a')]['find']({'where':{'id':_0x3a263a[_0xa0fd('0x70')]['id']}})['then'](handleEntityNotFound(_0x30e2e2,null))[_0xa0fd('0x29')](function(_0x4bc35b){if(_0x4bc35b){return _0x4bc35b[_0xa0fd('0x131')](_0x3a263a[_0xa0fd('0x61')]['ids'],_['omit'](_0x3a263a[_0xa0fd('0x61')],[_0xa0fd('0x80'),'id'])||{})[_0xa0fd('0xe0')](function(_0x516ce6){for(var _0xe40db=0x0;_0xe40db<_0x3a263a['body'][_0xa0fd('0x80')][_0xa0fd('0x51')];_0xe40db+=0x1){socket[_0xa0fd('0x132')](_0xa0fd('0x133'),{'UserId':Number(_0x3a263a[_0xa0fd('0x61')][_0xa0fd('0x80')][_0xe40db]),'ChatWebsiteId':Number(_0x3a263a[_0xa0fd('0x70')]['id'])});}return _0x516ce6;});}})[_0xa0fd('0x29')](respondWithResult(_0x30e2e2,null))[_0xa0fd('0x5c')](handleError(_0x30e2e2,null));};exports[_0xa0fd('0x134')]=function(_0x353a7d,_0x4e8d38){return db[_0xa0fd('0x4a')][_0xa0fd('0x5f')]({'where':{'id':_0x353a7d[_0xa0fd('0x70')]['id']}})[_0xa0fd('0x29')](handleEntityNotFound(_0x4e8d38,null))['then'](function(_0x4b9d31){if(_0x4b9d31){return _0x4b9d31[_0xa0fd('0x134')](_0x353a7d[_0xa0fd('0x4d')][_0xa0fd('0x80')])[_0xa0fd('0x29')](function(){if(_[_0xa0fd('0x135')](_0x353a7d[_0xa0fd('0x4d')]['ids'])){for(var _0xb1b3ab=0x0;_0xb1b3ab<_0x353a7d[_0xa0fd('0x4d')][_0xa0fd('0x80')]['length'];_0xb1b3ab+=0x1){socket[_0xa0fd('0x132')]('userChatWebsite:remove',{'UserId':Number(_0x353a7d[_0xa0fd('0x4d')][_0xa0fd('0x80')][_0xb1b3ab]),'ChatWebsiteId':Number(_0x353a7d[_0xa0fd('0x70')]['id'])});}}else{socket[_0xa0fd('0x132')](_0xa0fd('0x136'),{'UserId':Number(_0x353a7d[_0xa0fd('0x4d')][_0xa0fd('0x80')]),'ChatWebsiteId':Number(_0x353a7d['params']['id'])});}});}})[_0xa0fd('0x29')](respondWithStatusCode(_0x4e8d38,null))[_0xa0fd('0x5c')](handleError(_0x4e8d38,null));};exports[_0xa0fd('0x137')]=function(_0x562461,_0x1c8a6d){var _0x201a2c={};var _0x3245e6={};var _0x3702c2;var _0x5e205e;return db[_0xa0fd('0x4a')]['findOne']({'where':{'id':_0x562461[_0xa0fd('0x70')]['id']}})[_0xa0fd('0x29')](handleEntityNotFound(_0x1c8a6d,null))[_0xa0fd('0x29')](function(_0xad52df){if(_0xad52df){_0x3702c2=_0xad52df;_0x3245e6[_0xa0fd('0x44')]=_[_0xa0fd('0x76')](db[_0xa0fd('0x104')][_0xa0fd('0x7e')]);_0x3245e6[_0xa0fd('0x4d')]=_[_0xa0fd('0x76')](_0x562461[_0xa0fd('0x4d')]);_0x3245e6['filters']=_[_0xa0fd('0x4f')](_0x3245e6[_0xa0fd('0x44')],_0x3245e6[_0xa0fd('0x4d')]);_0x201a2c[_0xa0fd('0x4e')]=_[_0xa0fd('0x4f')](_0x3245e6[_0xa0fd('0x44')],qs[_0xa0fd('0x50')](_0x562461[_0xa0fd('0x4d')][_0xa0fd('0x50')]));_0x201a2c[_0xa0fd('0x4e')]=_0x201a2c[_0xa0fd('0x4e')][_0xa0fd('0x51')]?_0x201a2c['attributes']:_0x3245e6['model'];_0x201a2c['order']=qs[_0xa0fd('0x52')](_0x562461[_0xa0fd('0x4d')][_0xa0fd('0x52')]);_0x201a2c[_0xa0fd('0x53')]=qs[_0xa0fd('0x54')](_[_0xa0fd('0x55')](_0x562461[_0xa0fd('0x4d')],_0x3245e6[_0xa0fd('0x54')]));if(_0x562461['query']['filter']){_0x201a2c[_0xa0fd('0x53')]=_[_0xa0fd('0x58')](_0x201a2c[_0xa0fd('0x53')],{'$or':_[_0xa0fd('0x49')](_0x201a2c[_0xa0fd('0x4e')],function(_0x5f3479){var _0x17a13f={};_0x17a13f[_0x5f3479]={'$like':'%'+_0x562461['query'][_0xa0fd('0x56')]+'%'};return _0x17a13f;})});}_0x201a2c=_[_0xa0fd('0x58')]({},_0x201a2c,_0x562461[_0xa0fd('0x5e')]);return _0x3702c2[_0xa0fd('0x137')](_0x201a2c);}})[_0xa0fd('0x29')](function(_0x251515){if(_0x251515){_0x5e205e=_0x251515[_0xa0fd('0x51')];if(!_0x562461[_0xa0fd('0x4d')][_0xa0fd('0x78')](_0xa0fd('0x79'))){_0x201a2c[_0xa0fd('0x26')]=qs['limit'](_0x562461[_0xa0fd('0x4d')]['limit']);_0x201a2c['offset']=qs[_0xa0fd('0x28')](_0x562461[_0xa0fd('0x4d')]['offset']);}return _0x3702c2['getAgents'](_0x201a2c);}})[_0xa0fd('0x29')](function(_0x3aae5b){if(_0x3aae5b){return _0x3aae5b?{'count':_0x5e205e,'rows':_0x3aae5b}:null;}})['then'](respondWithResult(_0x1c8a6d,null))[_0xa0fd('0x5c')](handleError(_0x1c8a6d,null));}; \ No newline at end of file +var _0x2123=['offline-chat','basename','openNewInteraction','sequelize','Attachment','bulkCreate','findOne','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','email','MailAccountId','subjectOffline','toPairsIn','mapValues','offlineMessageSubject','Chat','notifyMail','server','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','internal','Tag','Tags','color','tag','getSnippet','getProactiveActions','virtual','License','increment','server/files/chat/iframe.ejs','3.10.1','origin','testWebsiteWithWildcard','x-real-ip','connection','remoteAddress','replace','render','alignment','verticalAlignment','labelText','textColor','color_button','backgroundColor','hideWhenOffline','IntervalId','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','stack','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','online','offlineForm','items','fromKey','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','querystring','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','handleError','url','URL','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','then','info','debug','request\x20sent','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','update','get','ChatWebsites','UserProfileResource','destroy','end','name','send','user-agent-parser','user-agent','getResult','customerIp','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','format','%s\x20%s','version','unknown','model','device','vendor','%s\x20%s\x20%s','type','index','mandatoryDispositionPause','map','rawAttributes','fieldName','query','keys','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','ChatWebsite','includeAll','include','findAll','show','Pause','intersection','find','create','body','address','forEach','trim','testWildcardValidity','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','params','describe','ChatWebsiteId','Disposition','getDispositions','length','pick','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addLogo','filename','addAvatar','agentAvatar','file','addSystemAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','root','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','server/files/images/avatars/system_avatar.png','Interval','resolve','timezone','ifTime','notify','chat','from','MapKey\x20is\x20mandatory','Body\x20is\x20mandatory','createdAt','updatedAt','includes','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','mapKey','CmList','List','CmContact','ChatApplication','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','applications','orderBy','Applications','priority','asc','account','list','Contacts','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','contact','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','unshift','waitForTheAssignedQueue','Start','EventManager','offline','files','Sequelize','ValidationError','no\x20available\x20attributes','difference','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype'];(function(_0x3d1ed2,_0x4975c3){var _0x39b31c=function(_0x23630c){while(--_0x23630c){_0x3d1ed2['push'](_0x3d1ed2['shift']());}};_0x39b31c(++_0x4975c3);}(_0x2123,0x190));var _0x3212=function(_0x115e68,_0x26a20a){_0x115e68=_0x115e68-0x0;var _0x1510be=_0x2123[_0x115e68];return _0x1510be;};'use strict';var Mustache=require(_0x3212('0x0'));var util=require(_0x3212('0x1'));var path=require(_0x3212('0x2'));var ejs=require(_0x3212('0x3'));var fs=require('fs');var fs_extra=require(_0x3212('0x4'));var _=require(_0x3212('0x5'));var querystring=require(_0x3212('0x6'));var htmlToText=require(_0x3212('0x7'));var Redis=require(_0x3212('0x8'));var jayson=require(_0x3212('0x9'));var qs=require(_0x3212('0xa'));var logger=require(_0x3212('0xb'))('api');var config=require(_0x3212('0xc'));var APIBadRequestError=require(_0x3212('0xd'))[_0x3212('0xe')];var APINotFoundError=require('../../errors/api')[_0x3212('0xf')];var APIOutOfIntervalError=require('../../errors/api')[_0x3212('0x10')];var APIHandleError=require(_0x3212('0xd'))[_0x3212('0x11')];var APIConflictError=require(_0x3212('0xd'))['APIConflictError'];var wildcardUtils=require('./helpers/wildcard-expressions');var URL=require(_0x3212('0x12'))[_0x3212('0x13')];var db=require(_0x3212('0x14'))['db'];config[_0x3212('0x15')]=_[_0x3212('0x16')](config[_0x3212('0x15')],{'host':_0x3212('0x17'),'port':0x18eb});var socket=require(_0x3212('0x18'))(new Redis(config[_0x3212('0x15')]));require(_0x3212('0x19'))[_0x3212('0x1a')](socket);var client=jayson[_0x3212('0x1b')][_0x3212('0x1c')]({'port':0x232c});var client9002=jayson[_0x3212('0x1b')][_0x3212('0x1c')]({'port':0x232a});var client9003=jayson[_0x3212('0x1b')][_0x3212('0x1c')]({'port':0x232b});var client9001=jayson[_0x3212('0x1b')][_0x3212('0x1c')]({'port':0x2329});function respondWithRpcPromise(_0x46c5f5,_0x42069c,_0x1ef2f7,_0x5b2ab8){return new Promise(function(_0x43a642,_0x1719a5){var _0x2720c6=_0x5b2ab8||client;return _0x2720c6[_0x3212('0x1d')](_0x46c5f5,_0x1ef2f7)[_0x3212('0x1e')](function(_0x34ce95){logger[_0x3212('0x1f')]('ChatWebsite,\x20%s,\x20%s',_0x42069c,'request\x20sent');logger[_0x3212('0x20')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x42069c,_0x3212('0x21'),JSON[_0x3212('0x22')](_0x34ce95));if(_0x34ce95[_0x3212('0x23')]){if(_0x34ce95[_0x3212('0x23')][_0x3212('0x24')]===0x1f4){logger['error'](_0x3212('0x25'),_0x42069c,_0x34ce95[_0x3212('0x23')]['message']);return _0x1719a5(_0x34ce95[_0x3212('0x23')][_0x3212('0x26')]);}logger[_0x3212('0x23')]('ChatWebsite,\x20%s,\x20%s',_0x42069c,_0x34ce95['error'][_0x3212('0x26')]);return _0x43a642(_0x34ce95[_0x3212('0x23')][_0x3212('0x26')]);}else{logger[_0x3212('0x1f')](_0x3212('0x25'),_0x42069c,_0x3212('0x21'));_0x43a642(_0x34ce95['result']['message']);}})[_0x3212('0x27')](function(_0x47cfdc){logger[_0x3212('0x23')](_0x3212('0x25'),_0x42069c,_0x47cfdc);_0x1719a5(_0x47cfdc);});});}function respondWithStatusCode(_0x3319d0,_0x5bb0a5){_0x5bb0a5=_0x5bb0a5||0xcc;return function(_0x2d1b92){if(_0x2d1b92){return _0x3319d0[_0x3212('0x28')](_0x5bb0a5);}return _0x3319d0[_0x3212('0x29')](_0x5bb0a5)['end']();};}function respondWithResult(_0x206980,_0x35b4eb){_0x35b4eb=_0x35b4eb||0xc8;return function(_0x108eee){if(_0x108eee){return _0x206980[_0x3212('0x29')](_0x35b4eb)[_0x3212('0x2a')](_0x108eee);}};}function respondWithFilteredResult(_0x1638c5,_0x16df03){return function(_0x3813a3){if(_0x3813a3){var _0x1de338=typeof _0x16df03[_0x3212('0x2b')]===_0x3212('0x2c')&&typeof _0x16df03[_0x3212('0x2d')]==='undefined';var _0x1e2660=_0x3813a3[_0x3212('0x2e')];var _0x4726fb=_0x1de338?0x0:_0x16df03[_0x3212('0x2b')];var _0x402a01=_0x1de338?_0x3813a3[_0x3212('0x2e')]:_0x16df03[_0x3212('0x2b')]+_0x16df03['limit'];var _0x3cbd1a;if(_0x402a01>=_0x1e2660){_0x402a01=_0x1e2660;_0x3cbd1a=0xc8;}else{_0x3cbd1a=0xce;}_0x1638c5['status'](_0x3cbd1a);return _0x1638c5[_0x3212('0x2f')]('Content-Range',_0x4726fb+'-'+_0x402a01+'/'+_0x1e2660)[_0x3212('0x2a')](_0x3813a3);}return null;};}function saveUpdates(_0x4ddc8f){return function(_0x4d17bb){if(_0x4d17bb){return _0x4d17bb[_0x3212('0x30')](_0x4ddc8f)['then'](function(_0x294422){return _0x294422;});}return null;};}function removeEntity(_0x3754ce){return function(_0x2c664b){if(_0x2c664b){return _0x2c664b['destroy']()[_0x3212('0x1e')](function(){var _0x412740=_0x2c664b[_0x3212('0x31')]({'plain':!![]});var _0x487ce4=_0x3212('0x32');return db[_0x3212('0x33')][_0x3212('0x34')]({'where':{'type':_0x487ce4,'resourceId':_0x412740['id']}})[_0x3212('0x1e')](function(){return _0x2c664b;});})[_0x3212('0x1e')](function(){_0x3754ce['status'](0xcc)[_0x3212('0x35')]();});}};}function handleEntityNotFound(_0x3fc885){return function(_0x422b7b){if(!_0x422b7b){_0x3fc885['sendStatus'](0x194);}return _0x422b7b;};}function handleError(_0x42f481,_0x410961){_0x410961=_0x410961||0x1f4;return function(_0x40a602){logger[_0x3212('0x23')](_0x40a602['stack']);if(_0x40a602[_0x3212('0x36')]){delete _0x40a602[_0x3212('0x36')];}_0x42f481[_0x3212('0x29')](_0x410961)[_0x3212('0x37')](_0x40a602);};}function createInteractionObject(_0x5ae0cc,_0x4e5349,_0x539b7a,_0x540dfc){var _0xb2908a=require(_0x3212('0x38'));var _0x3f8018=new _0xb2908a();var _0x87587d=_0x3f8018['setUA'](_0x539b7a[_0x3212('0x39')])[_0x3212('0x3a')]();var _0x18e20=_0x4e5349[_0x3212('0x3b')];if(_0x539b7a['cf-connecting-ip']){_0x18e20=_0x539b7a['cf-connecting-ip'];}else if(_0x539b7a[_0x3212('0x3c')]){_0x18e20=_[_0x3212('0x3d')](_0x539b7a[_0x3212('0x3c')][_0x3212('0x3e')](','));}return{'ContactId':_0x540dfc['id'],'ChatWebsiteId':_0x5ae0cc,'from':(_0x540dfc[_0x3212('0x3f')]||'')+'\x20'+(_0x540dfc[_0x3212('0x40')]||''),'customerIp':_0x18e20,'customerPort':_0x539b7a[_0x3212('0x41')]?_0x539b7a['x-real-port']:null,'referer':_0x4e5349[_0x3212('0x42')],'browserName':_0x87587d[_0x3212('0x43')][_0x3212('0x36')]&&_0x87587d[_0x3212('0x43')]['version']?util[_0x3212('0x44')](_0x3212('0x45'),_0x87587d[_0x3212('0x43')][_0x3212('0x36')],_0x87587d['browser'][_0x3212('0x46')]):'unknown','browserVersion':_0x87587d[_0x3212('0x43')][_0x3212('0x46')]||_0x3212('0x47'),'osName':util[_0x3212('0x44')](_0x3212('0x45'),_0x87587d['os'][_0x3212('0x36')],_0x87587d['os'][_0x3212('0x46')]),'osVersion':_0x87587d['os'][_0x3212('0x46')],'deviceModel':_0x87587d['device'][_0x3212('0x48')]&&_0x87587d[_0x3212('0x49')][_0x3212('0x4a')]?util[_0x3212('0x44')](_0x3212('0x4b'),_0x87587d[_0x3212('0x49')][_0x3212('0x48')],_0x87587d['device'][_0x3212('0x4a')],_0x87587d[_0x3212('0x49')][_0x3212('0x4c')]):null,'deviceVendor':_0x87587d[_0x3212('0x49')]['vendor'],'deviceType':_0x87587d['device']['type'],'formData':JSON['stringify'](_0x4e5349)};}exports[_0x3212('0x4d')]=function(_0x5b1fc5,_0x22de3d){var _0x661418={'include':[{'model':db['Pause'],'as':_0x3212('0x4e')}]},_0xa6854f={},_0x29f95c={'count':0x0,'rows':[]};var _0xb7124f=_[_0x3212('0x4f')](db['ChatWebsite'][_0x3212('0x50')],function(_0x341286){return{'name':_0x341286[_0x3212('0x51')],'type':_0x341286[_0x3212('0x4c')]['key']};});_0xa6854f[_0x3212('0x48')]=_[_0x3212('0x4f')](_0xb7124f,'name');_0xa6854f[_0x3212('0x52')]=_[_0x3212('0x53')](_0x5b1fc5[_0x3212('0x52')]);_0xa6854f['filters']=_['intersection'](_0xa6854f[_0x3212('0x48')],_0xa6854f[_0x3212('0x52')]);_0x661418[_0x3212('0x54')]=_['intersection'](_0xa6854f[_0x3212('0x48')],qs[_0x3212('0x55')](_0x5b1fc5['query'][_0x3212('0x55')]));_0x661418[_0x3212('0x54')]=_0x661418[_0x3212('0x54')]['length']?_0x661418['attributes']:_0xa6854f[_0x3212('0x48')];if(!_0x5b1fc5[_0x3212('0x52')][_0x3212('0x56')](_0x3212('0x57'))){_0x661418['limit']=qs[_0x3212('0x2d')](_0x5b1fc5[_0x3212('0x52')][_0x3212('0x2d')]);_0x661418['offset']=qs[_0x3212('0x2b')](_0x5b1fc5['query'][_0x3212('0x2b')]);}_0x661418[_0x3212('0x58')]=qs[_0x3212('0x59')](_0x5b1fc5[_0x3212('0x52')]['sort']);_0x661418[_0x3212('0x5a')]=qs[_0x3212('0x5b')](_['pick'](_0x5b1fc5[_0x3212('0x52')],_0xa6854f[_0x3212('0x5b')]),_0xb7124f);if(_0x5b1fc5[_0x3212('0x52')][_0x3212('0x5c')]){_0x661418[_0x3212('0x5a')]=_[_0x3212('0x5d')](_0x661418[_0x3212('0x5a')],{'$or':_['map'](_0xb7124f,function(_0xe5878d){if(_0xe5878d[_0x3212('0x4c')]!==_0x3212('0x5e')){var _0x8f9c82={};_0x8f9c82[_0xe5878d['name']]={'$like':'%'+_0x5b1fc5['query']['filter']+'%'};return _0x8f9c82;}})});}_0x661418=_['merge']({},_0x661418,_0x5b1fc5[_0x3212('0x5f')]);var _0x5eb862={'where':_0x661418[_0x3212('0x5a')]};return db[_0x3212('0x60')][_0x3212('0x2e')](_0x5eb862)[_0x3212('0x1e')](function(_0xdf24b8){_0x29f95c[_0x3212('0x2e')]=_0xdf24b8;if(_0x5b1fc5[_0x3212('0x52')][_0x3212('0x61')]){_0x661418[_0x3212('0x62')]=[{'all':!![]}];}return db[_0x3212('0x60')][_0x3212('0x63')](_0x661418);})['then'](function(_0x51751b){_0x29f95c['rows']=_0x51751b;return _0x29f95c;})[_0x3212('0x1e')](respondWithFilteredResult(_0x22de3d,_0x661418))[_0x3212('0x27')](handleError(_0x22de3d,null));};exports[_0x3212('0x64')]=function(_0x4228b7,_0x3f1e7c){var _0x81656={'raw':![],'where':{'id':_0x4228b7['params']['id']},'include':[{'model':db[_0x3212('0x65')],'as':_0x3212('0x4e')}]},_0x4b60cf={};_0x4b60cf['model']=_['keys'](db[_0x3212('0x60')][_0x3212('0x50')]);_0x4b60cf['query']=_[_0x3212('0x53')](_0x4228b7[_0x3212('0x52')]);_0x4b60cf[_0x3212('0x5b')]=_[_0x3212('0x66')](_0x4b60cf[_0x3212('0x48')],_0x4b60cf['query']);_0x81656[_0x3212('0x54')]=_[_0x3212('0x66')](_0x4b60cf[_0x3212('0x48')],qs[_0x3212('0x55')](_0x4228b7['query'][_0x3212('0x55')]));_0x81656[_0x3212('0x54')]=_0x81656[_0x3212('0x54')]['length']?_0x81656[_0x3212('0x54')]:_0x4b60cf[_0x3212('0x48')];if(_0x4228b7[_0x3212('0x52')][_0x3212('0x61')]){_0x81656['include']=[{'all':!![]}];}_0x81656=_[_0x3212('0x5d')]({},_0x81656,_0x4228b7[_0x3212('0x5f')]);return db[_0x3212('0x60')][_0x3212('0x67')](_0x81656)['then'](handleEntityNotFound(_0x3f1e7c,null))[_0x3212('0x1e')](respondWithResult(_0x3f1e7c,null))[_0x3212('0x27')](handleError(_0x3f1e7c,null));};exports[_0x3212('0x68')]=function(_0x116301,_0x5c39b2){var _0x30c039=null;_0x116301[_0x3212('0x69')][_0x3212('0x6a')][_0x3212('0x3e')](',')[_0x3212('0x6b')](_0x3ae978=>{if(_0x3ae978[_0x3212('0x6c')]()!==''&&!wildcardUtils[_0x3212('0x6d')](_0x3ae978[_0x3212('0x6c')]())){_0x30c039=new APIBadRequestError('\x22'+_0x3ae978['trim']()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x30c039){return handleError(_0x5c39b2,null)(_0x30c039);}return db[_0x3212('0x60')][_0x3212('0x68')](_0x116301['body'],{})[_0x3212('0x1e')](function(_0x241551){var _0x46dff8=_0x116301[_0x3212('0x6e')]['get']({'plain':!![]});if(!_0x46dff8)throw new Error(_0x3212('0x6f'));if(_0x46dff8[_0x3212('0x70')]===_0x3212('0x6e')){var _0x1298d5=_0x241551[_0x3212('0x31')]({'plain':!![]});var _0x3f92c1='ChatWebsites';return db[_0x3212('0x71')][_0x3212('0x67')]({'where':{'name':_0x3f92c1,'userProfileId':_0x46dff8['userProfileId']},'raw':!![]})['then'](function(_0xa2962b){if(_0xa2962b&&_0xa2962b[_0x3212('0x72')]===0x0){return db[_0x3212('0x33')][_0x3212('0x68')]({'name':_0x1298d5[_0x3212('0x36')],'resourceId':_0x1298d5['id'],'type':_0xa2962b['name'],'sectionId':_0xa2962b['id']},{})[_0x3212('0x1e')](function(){return _0x241551;});}else{return _0x241551;}})[_0x3212('0x27')](function(_0x5b2a69){logger[_0x3212('0x23')](_0x3212('0x73'),_0x5b2a69);throw _0x5b2a69;});}return _0x241551;})['then'](respondWithResult(_0x5c39b2,0xc9))[_0x3212('0x27')](handleError(_0x5c39b2,null));};exports[_0x3212('0x30')]=function(_0x1653b0,_0x4f1c35){var _0x304e0a=null;_0x1653b0['body']['address']['split'](',')[_0x3212('0x6b')](_0x4a6d23=>{if(_0x4a6d23[_0x3212('0x6c')]()!==''&&!wildcardUtils['testWildcardValidity'](_0x4a6d23[_0x3212('0x6c')]())){_0x304e0a=new APIBadRequestError('\x22'+_0x4a6d23[_0x3212('0x6c')]()+_0x3212('0x74'));}});if(_0x304e0a){return handleError(_0x4f1c35,null)(_0x304e0a);}if(_0x1653b0[_0x3212('0x69')]['id']){delete _0x1653b0[_0x3212('0x69')]['id'];}return db['ChatWebsite'][_0x3212('0x67')]({'where':{'id':_0x1653b0[_0x3212('0x75')]['id']},'include':[{'model':db[_0x3212('0x65')],'as':_0x3212('0x4e')}]})[_0x3212('0x1e')](handleEntityNotFound(_0x4f1c35,null))[_0x3212('0x1e')](saveUpdates(_0x1653b0['body'],null))[_0x3212('0x1e')](respondWithResult(_0x4f1c35,null))[_0x3212('0x27')](handleError(_0x4f1c35,null));};exports[_0x3212('0x34')]=function(_0x1d9afc,_0x45c5ec){return db[_0x3212('0x60')][_0x3212('0x67')]({'where':{'id':_0x1d9afc[_0x3212('0x75')]['id']}})[_0x3212('0x1e')](handleEntityNotFound(_0x45c5ec,null))[_0x3212('0x1e')](removeEntity(_0x45c5ec,null))['catch'](handleError(_0x45c5ec,null));};exports['describe']=function(_0x10e970,_0x301b41){return db['ChatWebsite'][_0x3212('0x76')]()['then'](respondWithResult(_0x301b41,null))['catch'](handleError(_0x301b41,null));};exports['addDisposition']=function(_0x4e307d,_0x4f70b2){if(_0x4e307d['body']['id']){delete _0x4e307d['body']['id'];}return db[_0x3212('0x60')]['find']({'where':{'id':_0x4e307d[_0x3212('0x75')]['id']}})[_0x3212('0x1e')](handleEntityNotFound(_0x4f70b2,null))[_0x3212('0x1e')](function(_0x295c99){if(_0x295c99){_0x4e307d[_0x3212('0x69')][_0x3212('0x77')]=_0x295c99['id'];return db[_0x3212('0x78')][_0x3212('0x68')](_0x4e307d[_0x3212('0x69')]);}})[_0x3212('0x1e')](respondWithResult(_0x4f70b2,null))[_0x3212('0x27')](handleError(_0x4f70b2,null));};exports[_0x3212('0x79')]=function(_0x177a58,_0x578101){var _0x7110c1={'raw':![],'where':{}};var _0x4c8dc8={};var _0x114d34={'count':0x0,'rows':[]};return db[_0x3212('0x60')]['findOne']({'where':{'id':_0x177a58['params']['id']}})['then'](handleEntityNotFound(_0x578101,null))[_0x3212('0x1e')](function(_0x4f63fa){if(_0x4f63fa){_0x4c8dc8['model']=_[_0x3212('0x53')](db[_0x3212('0x78')][_0x3212('0x50')]);_0x4c8dc8[_0x3212('0x52')]=_[_0x3212('0x53')](_0x177a58[_0x3212('0x52')]);_0x4c8dc8['filters']=_['intersection'](_0x4c8dc8['model'],_0x4c8dc8['query']);_0x7110c1[_0x3212('0x54')]=_[_0x3212('0x66')](_0x4c8dc8['model'],qs['fields'](_0x177a58['query'][_0x3212('0x55')]));_0x7110c1['attributes']=_0x7110c1[_0x3212('0x54')][_0x3212('0x7a')]?_0x7110c1[_0x3212('0x54')]:_0x4c8dc8[_0x3212('0x48')];if(!_0x177a58[_0x3212('0x52')][_0x3212('0x56')](_0x3212('0x57'))){_0x7110c1[_0x3212('0x2d')]=qs['limit'](_0x177a58[_0x3212('0x52')][_0x3212('0x2d')]);_0x7110c1[_0x3212('0x2b')]=qs[_0x3212('0x2b')](_0x177a58[_0x3212('0x52')]['offset']);}_0x7110c1[_0x3212('0x58')]=qs[_0x3212('0x59')](_0x177a58['query'][_0x3212('0x59')]);_0x7110c1[_0x3212('0x5a')]=qs[_0x3212('0x5b')](_[_0x3212('0x7b')](_0x177a58[_0x3212('0x52')],_0x4c8dc8[_0x3212('0x5b')]));_0x7110c1[_0x3212('0x5a')]['ChatWebsiteId']=_0x4f63fa['id'];if(_0x177a58[_0x3212('0x52')][_0x3212('0x5c')]){_0x7110c1[_0x3212('0x5a')]=_[_0x3212('0x5d')](_0x7110c1[_0x3212('0x5a')],{'$or':_[_0x3212('0x4f')](_0x7110c1[_0x3212('0x54')],function(_0x22c08b){var _0x2509f9={};_0x2509f9[_0x22c08b]={'$like':'%'+_0x177a58[_0x3212('0x52')]['filter']+'%'};return _0x2509f9;})});}_0x7110c1=_[_0x3212('0x5d')]({},_0x7110c1,_0x177a58[_0x3212('0x5f')]);return db['Disposition']['count']({'where':_0x7110c1['where']})[_0x3212('0x1e')](function(_0x4e6b83){_0x114d34[_0x3212('0x2e')]=_0x4e6b83;if(_0x177a58['query']['includeAll']){_0x7110c1[_0x3212('0x62')]=[{'all':!![]}];}return db['Disposition'][_0x3212('0x63')](_0x7110c1);})[_0x3212('0x1e')](function(_0x836bb8){_0x114d34[_0x3212('0x7c')]=_0x836bb8;return _0x114d34;});}})['then'](respondWithFilteredResult(_0x578101,_0x7110c1))[_0x3212('0x27')](handleError(_0x578101,null));};exports[_0x3212('0x7d')]=function(_0x415288,_0x480fae){return db[_0x3212('0x60')]['find']({'where':{'id':_0x415288[_0x3212('0x75')]['id']}})['then'](handleEntityNotFound(_0x480fae,null))[_0x3212('0x1e')](function(_0x2fe8f6){if(_0x2fe8f6){return _0x2fe8f6['removeDispositions'](_0x415288[_0x3212('0x52')][_0x3212('0x7e')]);}})[_0x3212('0x1e')](respondWithStatusCode(_0x480fae,null))[_0x3212('0x27')](handleError(_0x480fae,null));};exports[_0x3212('0x7f')]=function(_0x374c2,_0x3a9749){if(_0x374c2[_0x3212('0x69')]['id']){delete _0x374c2['body']['id'];}return db[_0x3212('0x60')][_0x3212('0x67')]({'where':{'id':_0x374c2['params']['id']}})[_0x3212('0x1e')](handleEntityNotFound(_0x3a9749,null))[_0x3212('0x1e')](function(_0x3650af){if(_0x3650af){_0x374c2[_0x3212('0x69')][_0x3212('0x77')]=_0x3650af['id'];return db['CannedAnswer'][_0x3212('0x68')](_0x374c2[_0x3212('0x69')]);}})[_0x3212('0x1e')](respondWithResult(_0x3a9749,null))[_0x3212('0x27')](handleError(_0x3a9749,null));};exports[_0x3212('0x80')]=function(_0x5dc8d1,_0x56612b){var _0x2aa5d5={'raw':![],'where':{}};var _0x5735e7={};var _0x285fb0={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x5dc8d1[_0x3212('0x75')]['id']}})['then'](handleEntityNotFound(_0x56612b,null))[_0x3212('0x1e')](function(_0x589c12){if(_0x589c12){_0x5735e7[_0x3212('0x48')]=_[_0x3212('0x53')](db[_0x3212('0x81')][_0x3212('0x50')]);_0x5735e7[_0x3212('0x52')]=_[_0x3212('0x53')](_0x5dc8d1[_0x3212('0x52')]);_0x5735e7[_0x3212('0x5b')]=_[_0x3212('0x66')](_0x5735e7['model'],_0x5735e7[_0x3212('0x52')]);_0x2aa5d5[_0x3212('0x54')]=_[_0x3212('0x66')](_0x5735e7['model'],qs[_0x3212('0x55')](_0x5dc8d1[_0x3212('0x52')][_0x3212('0x55')]));_0x2aa5d5[_0x3212('0x54')]=_0x2aa5d5[_0x3212('0x54')][_0x3212('0x7a')]?_0x2aa5d5[_0x3212('0x54')]:_0x5735e7[_0x3212('0x48')];if(!_0x5dc8d1['query'][_0x3212('0x56')](_0x3212('0x57'))){_0x2aa5d5[_0x3212('0x2d')]=qs[_0x3212('0x2d')](_0x5dc8d1[_0x3212('0x52')][_0x3212('0x2d')]);_0x2aa5d5[_0x3212('0x2b')]=qs[_0x3212('0x2b')](_0x5dc8d1[_0x3212('0x52')][_0x3212('0x2b')]);}_0x2aa5d5[_0x3212('0x58')]=qs[_0x3212('0x59')](_0x5dc8d1[_0x3212('0x52')]['sort']);_0x2aa5d5[_0x3212('0x5a')]=qs[_0x3212('0x5b')](_[_0x3212('0x7b')](_0x5dc8d1[_0x3212('0x52')],_0x5735e7[_0x3212('0x5b')]));_0x2aa5d5[_0x3212('0x5a')][_0x3212('0x77')]=_0x589c12['id'];if(_0x5dc8d1[_0x3212('0x52')]['filter']){_0x2aa5d5[_0x3212('0x5a')]=_['merge'](_0x2aa5d5[_0x3212('0x5a')],{'$or':_[_0x3212('0x4f')](_0x2aa5d5[_0x3212('0x54')],function(_0x4ae27a){var _0x5df8f9={};_0x5df8f9[_0x4ae27a]={'$like':'%'+_0x5dc8d1['query'][_0x3212('0x5c')]+'%'};return _0x5df8f9;})});}_0x2aa5d5=_[_0x3212('0x5d')]({},_0x2aa5d5,_0x5dc8d1['options']);return db[_0x3212('0x81')][_0x3212('0x2e')]({'where':_0x2aa5d5[_0x3212('0x5a')]})[_0x3212('0x1e')](function(_0x42b39a){_0x285fb0[_0x3212('0x2e')]=_0x42b39a;if(_0x5dc8d1[_0x3212('0x52')][_0x3212('0x61')]){_0x2aa5d5['include']=[{'all':!![]}];}return db[_0x3212('0x81')][_0x3212('0x63')](_0x2aa5d5);})[_0x3212('0x1e')](function(_0x162a7d){_0x285fb0[_0x3212('0x7c')]=_0x162a7d;return _0x285fb0;});}})['then'](respondWithFilteredResult(_0x56612b,_0x2aa5d5))[_0x3212('0x27')](handleError(_0x56612b,null));};exports[_0x3212('0x82')]=function(_0x1e3424,_0x2d3563){return db[_0x3212('0x60')]['find']({'where':{'id':_0x1e3424[_0x3212('0x75')]['id']}})['then'](handleEntityNotFound(_0x2d3563,null))['then'](function(_0x5671c3){if(_0x5671c3){return _0x5671c3['removeAnswers'](_0x1e3424[_0x3212('0x52')][_0x3212('0x7e')]);}})[_0x3212('0x1e')](respondWithStatusCode(_0x2d3563,null))[_0x3212('0x27')](handleError(_0x2d3563,null));};exports[_0x3212('0x83')]=function(_0x3e3499,_0x161ca1){_0x3e3499[_0x3212('0x69')]['sitepic']=_0x3e3499['file'][_0x3212('0x84')];return db[_0x3212('0x60')]['find']({'where':{'id':_0x3e3499[_0x3212('0x75')]['id']}})[_0x3212('0x1e')](handleEntityNotFound(_0x161ca1,null))['then'](saveUpdates(_0x3e3499[_0x3212('0x69')],null))['then'](respondWithResult(_0x161ca1,null))['catch'](handleError(_0x161ca1,null));};exports[_0x3212('0x85')]=function(_0x3429ca,_0x11c234){_0x3429ca[_0x3212('0x69')][_0x3212('0x86')]=_0x3429ca[_0x3212('0x87')]['filename'];return db[_0x3212('0x60')][_0x3212('0x67')]({'where':{'id':_0x3429ca['params']['id']}})[_0x3212('0x1e')](handleEntityNotFound(_0x11c234,null))[_0x3212('0x1e')](saveUpdates(_0x3429ca[_0x3212('0x69')],null))['then'](respondWithResult(_0x11c234,null))[_0x3212('0x27')](handleError(_0x11c234,null));};exports['addCustomerAvatar']=function(_0x14ff48,_0x584b80){_0x14ff48['body']['customerAvatar']=_0x14ff48[_0x3212('0x87')][_0x3212('0x84')];return db['ChatWebsite'][_0x3212('0x67')]({'where':{'id':_0x14ff48[_0x3212('0x75')]['id']}})[_0x3212('0x1e')](handleEntityNotFound(_0x584b80,null))[_0x3212('0x1e')](saveUpdates(_0x14ff48[_0x3212('0x69')],null))[_0x3212('0x1e')](respondWithResult(_0x584b80,null))[_0x3212('0x27')](handleError(_0x584b80,null));};exports[_0x3212('0x88')]=function(_0x272cec,_0x5746b9){_0x272cec[_0x3212('0x69')][_0x3212('0x89')]=_0x272cec[_0x3212('0x87')][_0x3212('0x84')];return db[_0x3212('0x60')][_0x3212('0x67')]({'where':{'id':_0x272cec[_0x3212('0x75')]['id']}})[_0x3212('0x1e')](handleEntityNotFound(_0x5746b9,null))[_0x3212('0x1e')](saveUpdates(_0x272cec[_0x3212('0x69')],null))[_0x3212('0x1e')](respondWithResult(_0x5746b9,null))[_0x3212('0x27')](handleError(_0x5746b9,null));};exports[_0x3212('0x8a')]=function(_0x4ef7ae,_0x582479){var _0x13441a=path[_0x3212('0x8b')](config['root'],_0x3212('0x8c'));var _0x5e493f={'where':{'id':_0x4ef7ae[_0x3212('0x75')]['id']},'attributes':['id',_0x3212('0x8d')],'raw':!![]};var _0x5b77cf=![];return require(_0x3212('0x8e'))[_0x3212('0x8f')]()[_0x3212('0x1e')](function(_0x397ecc){if(_0x397ecc){_0x5b77cf=_0x397ecc[_0x3212('0x90')];}})['then'](function(){return db[_0x3212('0x60')][_0x3212('0x67')](_0x5e493f);})[_0x3212('0x1e')](handleEntityNotFound(_0x582479,null))[_0x3212('0x1e')](function(_0x5f5ceb){if(_0x5f5ceb){if(!_[_0x3212('0x91')](_0x5f5ceb[_0x3212('0x8d')])){if(fs[_0x3212('0x92')](path[_0x3212('0x8b')](config['root'],_0x3212('0x93'),_0x5f5ceb['sitepic']))&&_0x5b77cf){_0x13441a=path[_0x3212('0x8b')](config[_0x3212('0x94')],_0x3212('0x93'),_0x5f5ceb['sitepic']);}}return _0x582479[_0x3212('0x95')](_0x13441a);}})['catch'](handleError(_0x582479,null));};exports['getAvatar']=function(_0x4ab1c5,_0x2c895a){var _0x211434=path[_0x3212('0x8b')](config[_0x3212('0x94')],_0x3212('0x96'));var _0x59bc64={'where':{'id':_0x4ab1c5[_0x3212('0x75')]['id']},'attributes':['id',_0x3212('0x86')],'raw':!![]};return db[_0x3212('0x60')]['find'](_0x59bc64)[_0x3212('0x1e')](handleEntityNotFound(_0x2c895a,null))[_0x3212('0x1e')](function(_0xfabca5){if(_0xfabca5){if(!_['isNil'](_0xfabca5[_0x3212('0x86')])){if(fs[_0x3212('0x92')](path[_0x3212('0x8b')](config[_0x3212('0x94')],'server/files/images/avatars/',_0xfabca5[_0x3212('0x86')]))){_0x211434=path[_0x3212('0x8b')](config[_0x3212('0x94')],_0x3212('0x97'),_0xfabca5[_0x3212('0x86')]);}}return _0x2c895a[_0x3212('0x95')](_0x211434);}})[_0x3212('0x27')](handleError(_0x2c895a,null));};exports[_0x3212('0x98')]=function(_0x150df7,_0x114f32){var _0x2e7a06=path['join'](config[_0x3212('0x94')],_0x3212('0x99'));var _0x248809={'where':{'id':_0x150df7['params']['id']},'attributes':['id',_0x3212('0x9a'),'showCustomerAvatar'],'raw':!![]};return db[_0x3212('0x60')][_0x3212('0x67')](_0x248809)[_0x3212('0x1e')](handleEntityNotFound(_0x114f32,null))[_0x3212('0x1e')](function(_0x484a1c){if(_0x484a1c){if(!_['isNil'](_0x484a1c[_0x3212('0x9a')])){if(fs['existsSync'](path['join'](config[_0x3212('0x94')],_0x3212('0x97'),_0x484a1c[_0x3212('0x9a')]))&&_0x484a1c['showCustomerAvatar']){_0x2e7a06=path[_0x3212('0x8b')](config[_0x3212('0x94')],_0x3212('0x97'),_0x484a1c['customerAvatar']);}}return _0x114f32[_0x3212('0x95')](_0x2e7a06);}})[_0x3212('0x27')](handleError(_0x114f32,null));};exports['getSystemAvatar']=function(_0x421019,_0x38bfb7){var _0x39b919=path[_0x3212('0x8b')](config[_0x3212('0x94')],_0x3212('0x9b'));var _0x36cd12={'where':{'id':_0x421019[_0x3212('0x75')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x3212('0x60')][_0x3212('0x67')](_0x36cd12)[_0x3212('0x1e')](handleEntityNotFound(_0x38bfb7,null))['then'](function(_0x58ddce){if(_0x58ddce){if(!_['isNil'](_0x58ddce[_0x3212('0x89')])){if(fs[_0x3212('0x92')](path[_0x3212('0x8b')](config['root'],_0x3212('0x97'),_0x58ddce[_0x3212('0x89')]))){_0x39b919=path[_0x3212('0x8b')](config[_0x3212('0x94')],_0x3212('0x97'),_0x58ddce[_0x3212('0x89')]);}}return _0x38bfb7[_0x3212('0x95')](_0x39b919);}})[_0x3212('0x27')](handleError(_0x38bfb7,null));};function checkWebsiteInterval(_0x117d5e){var _0x3f5c7a=_0x117d5e[_0x3212('0x9c')];if(!_0x3f5c7a){return Promise[_0x3212('0x9d')](_0x117d5e);}var _0x23c357=_0x117d5e[_0x3212('0x9e')]||undefined;return _0x3f5c7a[_0x3212('0x9f')](_0x23c357)['then'](function(_0x5410ee){if(!_0x5410ee){throw new APIOutOfIntervalError();}return _0x117d5e;});}exports[_0x3212('0xa0')]=function(_0x276440,_0x50ed8d){var _0x151c1b={'body':_0x276440['body'],'channel':_0x3212('0xa1')};var _0x52a17c=[];var _0x2416bb=[];var _0x299400={};var _0x5f6c86=![];if(_0x276440[_0x3212('0x69')]['id']){delete _0x276440[_0x3212('0x69')]['id'];}if(_[_0x3212('0x91')](_0x276440[_0x3212('0x69')][_0x3212('0xa2')])){throw new APIBadRequestError('From\x20is\x20mandatory');}if(_[_0x3212('0x91')](_0x276440[_0x3212('0x69')]['mapKey'])){throw new APIBadRequestError(_0x3212('0xa3'));}if(_['isEmpty'](_0x276440[_0x3212('0x69')]['body'])){throw new APIBadRequestError(_0x3212('0xa4'));}var _0x99efa3=_0x276440[_0x3212('0x69')][_0x3212('0x3b')]&&_0x276440[_0x3212('0x69')][_0x3212('0x42')];return db['CmContact'][_0x3212('0x76')]()[_0x3212('0x1e')](function(_0x2b4188){if(!_0x2b4188){throw new Error('No\x20available\x20attributes');}_0x52a17c=Object[_0x3212('0x53')](_0x2b4188)[_0x3212('0x5c')](function(_0xaa863f){return![_0x3212('0xa5'),_0x3212('0xa6')][_0x3212('0xa7')](_0xaa863f);});_0x2416bb=Object[_0x3212('0x53')](_0x2b4188)[_0x3212('0x5c')](function(_0x2ae201){return![_0x3212('0xa5'),_0x3212('0xa6'),_0x3212('0xa8'),_0x3212('0xa9')]['includes'](_0x2ae201);});if(!_['includes'](_0x2416bb,_0x276440[_0x3212('0x69')]['mapKey'])){throw new APIBadRequestError(_0x3212('0xaa')+_0x2416bb['join'](',\x20'));}_0x299400[_0x276440[_0x3212('0x69')][_0x3212('0xab')]]=_0x276440[_0x3212('0x69')][_0x3212('0xa2')];})[_0x3212('0x1e')](function(){return db['ChatWebsite'][_0x3212('0x67')]({'where':{'id':_0x276440['params']['id']},'include':[{'model':db[_0x3212('0xac')],'as':_0x3212('0xad'),'include':[{'model':db[_0x3212('0xae')],'as':'Contacts','where':_0x299400,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x3212('0xaf')],'as':'Applications'},{'model':db['Interval'],'as':_0x3212('0x9c'),'include':[{'model':db[_0x3212('0x9c')],'as':_0x3212('0xb0'),'attributes':['id',_0x3212('0xb1')],'raw':!![]}]}]});})[_0x3212('0x1e')](function(_0x1d04fa){if(!_0x1d04fa){throw new APINotFoundError(util[_0x3212('0x44')](_0x3212('0xb2'),_0x276440[_0x3212('0x75')]['id']));}if(_0x99efa3){return checkWebsiteInterval(_0x1d04fa);}return _0x1d04fa;})['then'](function(_0x130b7a){_0x151c1b['account']=_0x130b7a;_0x151c1b[_0x3212('0xb3')]=_[_0x3212('0xb4')](_0x130b7a[_0x3212('0xb5')],[_0x3212('0xb6')],[_0x3212('0xb7')]);if(_0x151c1b[_0x3212('0xb8')][_0x3212('0xb5')]){delete _0x151c1b['account'][_0x3212('0xb5')];}_0x151c1b[_0x3212('0xb9')]=_0x130b7a[_0x3212('0xad')]||{'id':_0x130b7a[_0x3212('0xa9')]};if(_0x151c1b[_0x3212('0xb9')]&&_0x151c1b['list'][_0x3212('0xba')]['length']){return _0x151c1b['list']['Contacts'][0x0];}var _0x3d8761=_['defaults'](_0x276440['body'],{'firstName':_0x276440[_0x3212('0x69')]['from'],'ListId':_0x130b7a[_0x3212('0xa9')]});_0x3d8761[_0x276440[_0x3212('0x69')]['mapKey']]=_0x276440[_0x3212('0x69')][_0x3212('0xa2')];return db[_0x3212('0xae')][_0x3212('0x68')](_0x3d8761,{'fields':_0x52a17c,'raw':!![]});})[_0x3212('0x1e')](function(_0x3e57a8){_0x151c1b['contact']=_0x3e57a8;var _0x5cb478=createInteractionObject(_0x276440['params']['id'],_0x276440[_0x3212('0x69')],_0x276440[_0x3212('0xbb')],_0x3e57a8);var _0x14a707={'ChatWebsiteId':_0x276440[_0x3212('0x75')]['id']};if(_0x276440[_0x3212('0x69')]['threadId']){_0x14a707[_0x3212('0xbc')]=_0x276440[_0x3212('0x69')][_0x3212('0xbc')];_0x14a707[_0x3212('0xbd')]=![];return db[_0x3212('0xbe')][_0x3212('0x67')]({'where':_0x14a707})['then'](function(_0x2b8e20){var _0x2a3824=_0x276440['body'][_0x3212('0x3b')]&&_0x276440[_0x3212('0x69')][_0x3212('0x42')];if(_0x2b8e20){_0x5f6c86=!![];return _0x2b8e20;}else if(!_0x2a3824&&_0x2b8e20&&_0x2b8e20[_0x3212('0xbd')]){throw new APIConflictError(_0x3212('0xbf'));}_0x5cb478[_0x3212('0xbc')]=_0x276440['body']['threadId'];_0x5cb478[_0x3212('0xc0')]=_0x276440[_0x3212('0x69')][_0x3212('0xc0')];return db[_0x3212('0xbe')][_0x3212('0x68')](_0x5cb478);});}_0x14a707[_0x3212('0xc1')]=_0x3e57a8['id'];if(_0x276440[_0x3212('0x69')][_0x3212('0xc2')]&&_0x276440[_0x3212('0x69')][_0x3212('0xc2')]['id']){_0x14a707['id']=_0x276440[_0x3212('0x69')][_0x3212('0xc2')]['id'];return db['ChatInteraction'][_0x3212('0x67')]({'where':_0x14a707})[_0x3212('0x1e')](function(_0x241113){var _0x521fdd=_0x276440[_0x3212('0x69')][_0x3212('0x3b')]&&_0x276440[_0x3212('0x69')][_0x3212('0x42')];if(!_0x521fdd&&_0x241113&&_0x241113[_0x3212('0xbd')]){throw new APIConflictError(_0x3212('0xbf'));}else if(_0x241113){_0x5f6c86=!![];return _0x241113;}else{return db[_0x3212('0xbe')][_0x3212('0x68')](_0x5cb478);}});}return db[_0x3212('0xbe')][_0x3212('0x68')](_0x5cb478);})[_0x3212('0x1e')](function(_0x134fe5){if(!_0x5f6c86){return _0x134fe5;}var _0x1f3741={'from':(_0x151c1b[_0x3212('0xc3')]['firstName']||'')+'\x20'+(_0x151c1b[_0x3212('0xc3')][_0x3212('0x40')]||'')};if(_0x276440[_0x3212('0x69')][_0x3212('0xbc')]&&_0x276440['body']['messageId']&&_0x276440[_0x3212('0x69')][_0x3212('0xbc')]!=_0x276440[_0x3212('0x69')][_0x3212('0xc4')]){_0x1f3741[_0x3212('0xbc')]=_0x276440[_0x3212('0x69')][_0x3212('0xc4')];}return _0x134fe5['update'](_0x1f3741);})[_0x3212('0x1e')](function(_0x23027f){_0x151c1b[_0x3212('0xc2')]=_0x23027f[_0x3212('0x31')]({'plain':!![]});_0x151c1b[_0x3212('0xc2')][_0x3212('0xc5')]=!_0x5f6c86;if(_0x151c1b['interaction'][_0x3212('0xc5')]){if(_0x151c1b[_0x3212('0xb8')][_0x3212('0xc6')]){_0x151c1b[_0x3212('0xb3')][_0x3212('0xc7')]({'id':0x0,'priority':_0x151c1b[_0x3212('0xb3')][_0x3212('0x7a')]+0x1,'app':_0x3212('0xc8'),'appdata':_0x3212('0xc9'),'interval':_0x3212('0xca')});}}return db[_0x3212('0xcb')][_0x3212('0x68')]({'body':_0x276440[_0x3212('0x69')][_0x3212('0x69')],'ChatWebsiteId':_0x276440['params']['id'],'ChatInteractionId':_0x23027f['id'],'direction':'in','ContactId':_0x151c1b[_0x3212('0xc3')]['id'],'AttachmentId':_0x276440[_0x3212('0x69')][_0x3212('0xcc')]});})[_0x3212('0x1e')](function(_0x3338c3){_0x151c1b[_0x3212('0x26')]=_0x3338c3;if(!_0x151c1b['interaction'][_0x3212('0xcd')]){return;}return db[_0x3212('0xce')][_0x3212('0x67')]({'attributes':['id',_0x3212('0x36')],'where':{'id':_0x151c1b[_0x3212('0xc2')]['UserId']}});})[_0x3212('0x1e')](function(_0x1aaffb){if(_0x1aaffb){_0x151c1b[_0x3212('0xb3')]['unshift']({'id':0x0,'priority':0x0,'app':_0x3212('0xcf'),'appdata':_0x1aaffb[_0x3212('0x36')]+','+(_0x151c1b[_0x3212('0xb8')][_0x3212('0xd0')]||0xa),'interval':'*,*,*,*'});_0x151c1b[_0x3212('0xd1')]=!![];}if(!_0x151c1b['interaction'][_0x3212('0xd2')]){return;}return db[_0x3212('0xd3')][_0x3212('0x67')]({'attributes':['id',_0x3212('0x36')],'where':{'id':_0x151c1b[_0x3212('0xc2')][_0x3212('0xd2')]}});})['then'](function(_0x335207){if(_0x335207){_0x151c1b[_0x3212('0xb3')][_0x3212('0xd4')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x335207[_0x3212('0x36')]+','+(_0x151c1b[_0x3212('0xb8')][_0x3212('0xd5')]||0x12c),'interval':_0x3212('0xca')});}return respondWithRpcPromise(_0x3212('0xd6'),'startRouting',_0x151c1b);})[_0x3212('0x1e')](function(_0x2db4d7){respondWithRpcPromise(_0x3212('0xd7'),_0x3212('0xd7'),{'event':'notify','message':_0x2db4d7},client9002);return _0x2db4d7;})[_0x3212('0x1e')](respondWithResult(_0x50ed8d,null))['catch'](APIHandleError(_0x50ed8d));};exports[_0x3212('0xd8')]=function(_0x5044dd,_0x3551bc){var _0x2ac9a0,_0x114525,_0x499fb0;var _0x4e427b=[];var _0x3794aa={};var _0x22c635=_0x5044dd[_0x3212('0xd9')]||[];var _0x455d2d=[];var _0x54e195;return db[_0x3212('0xae')][_0x3212('0x76')]()[_0x3212('0x1e')](function(_0x1c628b){if(!_0x1c628b){throw new db[(_0x3212('0xda'))][(_0x3212('0xdb'))](_0x3212('0xdc'));}_0x4e427b=_[_0x3212('0xdd')](_['keys'](_0x1c628b),[_0x3212('0xa5'),_0x3212('0xa6'),'CompanyId',_0x3212('0xa9')]);if(_0x5044dd[_0x3212('0x69')]['id']){delete _0x5044dd[_0x3212('0x69')]['id'];}if(_[_0x3212('0x91')](_0x5044dd[_0x3212('0x69')][_0x3212('0xa2')])){throw _0x3551bc['status'](0x1f4)[_0x3212('0x37')](new db['Sequelize'][(_0x3212('0xdb'))](_0x3212('0xde')));}if(_[_0x3212('0x91')](_0x5044dd['body'][_0x3212('0x69')])||_0x5044dd[_0x3212('0x69')][_0x3212('0x69')]===''){throw _0x3551bc[_0x3212('0x29')](0x1f4)[_0x3212('0x37')](new db[(_0x3212('0xda'))][(_0x3212('0xdb'))](_0x3212('0xdf')));}if(_[_0x3212('0x91')](_0x5044dd['body'][_0x3212('0xe0')])){throw _0x3551bc[_0x3212('0x29')](0x1f4)[_0x3212('0x37')](new db[(_0x3212('0xda'))][(_0x3212('0xdb'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e427b));}if(!_['includes'](_0x4e427b,_0x5044dd[_0x3212('0x69')]['mapKeyOffline'])){throw _0x3551bc[_0x3212('0x29')](0x1f4)['send'](new db[(_0x3212('0xda'))][(_0x3212('0xdb'))](_0x3212('0xe1')+_0x4e427b));}_0x3794aa[_0x5044dd['body'][_0x3212('0xe0')]]=_0x5044dd[_0x3212('0x69')]['from'];})['then'](function(){return db[_0x3212('0x60')][_0x3212('0x67')]({'where':{'id':_0x5044dd[_0x3212('0x75')]['id']},'include':[{'model':db['CmList'],'as':_0x3212('0xad')},{'model':db['MailAccount'],'as':_0x3212('0xe2')}]});})['then'](handleEntityNotFound(_0x3551bc,null))['then'](function(_0x236981){if(_0x236981&&_0x236981[_0x3212('0xad')]){_0x114525=_0x236981;var _0x1ae319=_[_0x3212('0x16')](_0x5044dd[_0x3212('0x69')],{'firstName':_0x5044dd[_0x3212('0x69')]['from'],'phone':_0x5044dd[_0x3212('0x69')][_0x3212('0xa2')],'ListId':_0x236981['ListId']});_0x1ae319[_0x5044dd[_0x3212('0x69')][_0x3212('0xe0')]]=_0x5044dd[_0x3212('0x69')][_0x3212('0xa2')];return db[_0x3212('0xae')][_0x3212('0xe3')]({'where':_0x3794aa,'defaults':_0x1ae319});}})[_0x3212('0xe4')](function(_0xd5ed8a){if(_0xd5ed8a){_0x499fb0=_0xd5ed8a;var _0x57b8b6=fs[_0x3212('0xe5')](path['join'](config['root'],_0x3212('0xe6')),_0x3212('0xe7'));var _0x47ab77=ejs['render'](_0x57b8b6,{'body':_[_0x3212('0xe8')](_0x5044dd[_0x3212('0x69')]['body']),'bodyTitle':_0x114525[_0x3212('0xe9')]});return db[_0x3212('0xea')][_0x3212('0x68')]({'body':_0x47ab77,'plainBody':htmlToText[_0x3212('0xeb')](_0x47ab77),'ContactId':_0xd5ed8a['id'],'ChatWebsiteId':_0x114525['id']});}})['then'](function(_0x22c557){_0x54e195=_0x22c557;if(_0x22c635[_0x3212('0x7a')]){var _0x55621c=_0x22c635['map'](function(_0x452503){return{'name':_0x452503[_0x3212('0xec')],'basename':_0x452503[_0x3212('0x84')],'type':_0x452503[_0x3212('0xed')],'ChatOfflineMessageId':_0x22c557['id']};});_0x455d2d=_0x55621c[_0x3212('0x4f')](_0x13f591=>{var _0x52a99e={'filename':_0x13f591['name'],'path':path[_0x3212('0x8b')](config['root'],'server','files','attachments',_0x3212('0xee'),_0x13f591[_0x3212('0xef')])};return _0x52a99e;});if(!_0x114525[_0x3212('0xf0')]){return db[_0x3212('0xf1')]['transaction'](function(_0x409508){return db[_0x3212('0xf2')][_0x3212('0xf3')](_0x55621c,{'transaction':_0x409508});});}}})[_0x3212('0x1e')](function(){if(_0x54e195){_0x2ac9a0=_0x54e195;return db[_0x3212('0xe2')][_0x3212('0xf4')]({'where':{'service':!![]},'include':[{'model':db[_0x3212('0xf5')],'as':_0x3212('0xf6'),'raw':!![],'include':[{'model':db[_0x3212('0xf7')],'as':'CloudProvider','raw':!![]}]}]});}})['then'](function(_0x184e57){if(_0x184e57&&_0x184e57[_0x3212('0xf6')]&&_0x114525[_0x3212('0xf8')]&&_0x114525[_0x3212('0xf9')]){var _0x282bcf=_0x184e57[_0x3212('0xfa')]();return respondWithRpcPromise(_0x3212('0xfb'),'sendMail',{'account':_0x282bcf,'message':{'from':util[_0x3212('0x44')](_0x3212('0xfc'),_0x184e57['name'],_0x184e57[_0x3212('0xfd')]||_0x184e57[_0x3212('0xf6')][_0x3212('0x6e')]),'to':_0x114525[_0x3212('0xf9')],'subject':_0x114525['offlineMessageSubject'],'html':_0x2ac9a0[_0x3212('0x69')],'attachments':_0x455d2d}},client9003)[_0x3212('0x1e')](function(){return _0x2ac9a0;})[_0x3212('0x27')](function(_0x562e85){logger[_0x3212('0x23')](_0x562e85);});}})[_0x3212('0x1e')](function(){if(_0x114525&&_0x114525['openNewInteraction']&&_0x114525[_0x3212('0xfe')]){var _0x14fcf7=[];if(_0x22c635[_0x3212('0x7a')]){_0x14fcf7=_0x22c635['map'](function(_0x29b1ab){return{'name':_0x29b1ab[_0x3212('0xec')],'basename':_0x29b1ab[_0x3212('0x84')],'type':_0x29b1ab[_0x3212('0xed')],'ChatOfflineMessageId':_0x54e195['id']};});}var _0x51e780;if(!_[_0x3212('0x91')](_0x114525[_0x3212('0xff')])){var _0x528e3e=_['map'](_0x5044dd[_0x3212('0x69')],function(_0x44988f){return _0x44988f;});var _0x439337=_[_0x3212('0x100')](_0x528e3e)[0x0];var _0x50b201=_[_0x3212('0x101')](_0x439337,function(_0x14c9af){return _0x14c9af;});_0x51e780=_0x50b201[0x1][_0x114525[_0x3212('0xff')]];}var _0x50f128={'from':_0x499fb0[_0x3212('0xfd')],'firstName':_0x499fb0[_0x3212('0x3f')],'lastName':_0x499fb0[_0x3212('0x40')],'mapKey':_0x3212('0xfd'),'message':{'from':_0x499fb0[_0x3212('0xfd')],'to':_0x114525[_0x3212('0xe2')][_0x3212('0xfd')],'cc':'','subject':_['isNil'](_0x51e780)?_0x114525[_0x3212('0x102')]:_0x51e780,'messageId':'','sentAt':new Date(),'attach':_0x14fcf7[_0x3212('0x7a')],'attachments':_0x14fcf7,'originChannel':_0x3212('0x103'),'ChatWebsiteId':_0x114525['id'],'ChatOfflineMessageId':_0x2ac9a0['id'],'originTo':_0x114525[_0x3212('0xe2')]['email']},'body':_0x2ac9a0['body']};var _0x2bedb4={'account':{'id':_0x114525[_0x3212('0xfe')]},'body':_0x50f128,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount',_0x3212('0x104'),_0x2bedb4,client9001)[_0x3212('0x1e')](function(){return _0x2ac9a0;})[_0x3212('0x27')](function(_0x52c52a){logger[_0x3212('0x23')](_0x52c52a);});}return;})[_0x3212('0x1e')](function(){if(_0x2ac9a0){return _0x2ac9a0;}})['then'](respondWithResult(_0x3551bc,null))[_0x3212('0x27')](function(){for(var _0x116961 of _0x22c635){var _0x3e3ab7=path[_0x3212('0x8b')](config[_0x3212('0x94')],_0x3212('0x105'),_0x3212('0xd9'),_0x3212('0x106'),'offline-chat',_0x116961['filename']);fs_extra[_0x3212('0x107')](_0x3e3ab7)['catch'](function(_0x4e242f){logger[_0x3212('0x23')](_0x3212('0x108'),_0x3e3ab7,_0x4e242f);});}});};exports[_0x3212('0x109')]=function(_0x58b237,_0x234330){return db[_0x3212('0xbe')]['find']({'where':{'id':_0x58b237[_0x3212('0x75')]['id']}})[_0x3212('0x1e')](handleEntityNotFound(_0x234330,null))[_0x3212('0x1e')](function(_0x5cba55){if(_0x5cba55){return _0x5cba55[_0x3212('0x109')](_0x58b237['body'][_0x3212('0x7e')],_[_0x3212('0x10a')](_0x58b237[_0x3212('0x69')],[_0x3212('0x7e'),'id'])||{});}})[_0x3212('0x1e')](respondWithResult(_0x234330,null))['catch'](handleError(_0x234330,null));};exports[_0x3212('0x10b')]=function(_0x3c0359,_0x23e662){var _0x134dbc={'raw':![],'where':{}};var _0x2e9a0f={};var _0x1c0adc={'count':0x0,'rows':[]};return db[_0x3212('0x60')][_0x3212('0xf4')]({'where':{'id':_0x3c0359[_0x3212('0x75')]['id']}})['then'](handleEntityNotFound(_0x23e662,null))[_0x3212('0x1e')](function(_0x572101){if(_0x572101){_0x2e9a0f[_0x3212('0x48')]=_[_0x3212('0x53')](db[_0x3212('0xbe')][_0x3212('0x50')]);_0x2e9a0f['query']=_[_0x3212('0x53')](_0x3c0359[_0x3212('0x52')]);_0x2e9a0f['filters']=_['intersection'](_0x2e9a0f[_0x3212('0x48')],_0x2e9a0f[_0x3212('0x52')]);_0x134dbc['attributes']=_[_0x3212('0x66')](_0x2e9a0f[_0x3212('0x48')],qs['fields'](_0x3c0359[_0x3212('0x52')][_0x3212('0x55')]));_0x134dbc[_0x3212('0x54')]=_0x134dbc[_0x3212('0x54')][_0x3212('0x7a')]?_0x134dbc[_0x3212('0x54')]:_0x2e9a0f['model'];if(!_0x3c0359['query'][_0x3212('0x56')](_0x3212('0x57'))){_0x134dbc[_0x3212('0x2d')]=qs['limit'](_0x3c0359[_0x3212('0x52')][_0x3212('0x2d')]);_0x134dbc[_0x3212('0x2b')]=qs['offset'](_0x3c0359[_0x3212('0x52')][_0x3212('0x2b')]);}_0x134dbc['order']=qs[_0x3212('0x59')](_0x3c0359[_0x3212('0x52')]['sort']);_0x134dbc['where']=qs[_0x3212('0x5b')](_['pick'](_0x3c0359[_0x3212('0x52')],_0x2e9a0f['filters']));_0x134dbc['where'][_0x3212('0x77')]=_0x572101['id'];if(_0x3c0359['query'][_0x3212('0x5c')]){_0x134dbc[_0x3212('0x5a')]=_[_0x3212('0x5d')](_0x134dbc['where'],{'$or':_[_0x3212('0x4f')](_0x134dbc['attributes'],function(_0x3348ba){var _0x513862={};_0x513862[_0x3348ba]={'$like':'%'+_0x3c0359[_0x3212('0x52')][_0x3212('0x5c')]+'%'};return _0x513862;})});}_0x134dbc=_[_0x3212('0x5d')]({},_0x134dbc,_0x3c0359[_0x3212('0x5f')]);return db[_0x3212('0xbe')][_0x3212('0x2e')]({'where':_0x134dbc[_0x3212('0x5a')]})[_0x3212('0x1e')](function(_0x481352){_0x1c0adc['count']=_0x481352;if(_0x3c0359[_0x3212('0x52')][_0x3212('0x61')]){_0x134dbc[_0x3212('0x62')]=[{'model':db[_0x3212('0xae')],'as':_0x3212('0x10c'),'required':![]},{'model':db[_0x3212('0xce')],'as':_0x3212('0x10d'),'attributes':[_0x3212('0x36'),'fullname',_0x3212('0x10e')],'required':![]},{'model':db[_0x3212('0x10f')],'as':_0x3212('0x110'),'attributes':['id',_0x3212('0x36'),_0x3212('0x111')],'where':_0x3c0359['query'][_0x3212('0x112')]?{'id':_0x3c0359[_0x3212('0x52')][_0x3212('0x112')]}:undefined,'required':_0x3c0359[_0x3212('0x52')]['tag']?!![]:![]}];}return db['ChatInteraction'][_0x3212('0x63')](_0x134dbc);})[_0x3212('0x1e')](function(_0x1b2e77){_0x1c0adc[_0x3212('0x7c')]=_0x1b2e77;return _0x1c0adc;});}})[_0x3212('0x1e')](respondWithFilteredResult(_0x23e662,_0x134dbc))[_0x3212('0x27')](handleError(_0x23e662,null));};exports[_0x3212('0x113')]=function(_0x4f356c,_0xa129d1){var _0x563b6a=0x0;var _0x1fb2d2=0x0;var _0x5845c6=![];var _0x163030;var _0xf24677;return db[_0x3212('0x60')][_0x3212('0x67')]({'where':{'id':_0x4f356c[_0x3212('0x75')]['id']},'include':[{'model':db[_0x3212('0x9c')],'as':_0x3212('0x9c'),'include':[{'model':db[_0x3212('0x9c')],'as':_0x3212('0xb0'),'attributes':['id',_0x3212('0xb1')]}]}]})[_0x3212('0x1e')](handleEntityNotFound(_0xa129d1,null))[_0x3212('0x1e')](function(_0xcdb3a6){if(_0xcdb3a6){_0x163030=_0xcdb3a6;return _0xcdb3a6[_0x3212('0x114')]({'raw':!![]});}})[_0x3212('0x1e')](function(_0x2c0ae1){if(_0x163030){if(_0x2c0ae1){_0xf24677=_0x2c0ae1;}}return require(_0x3212('0x8e'))['getLicense']();})['then'](function(_0x11a5d6){if(_0x11a5d6){_0x1fb2d2=_0x11a5d6[_0x3212('0x115')];_0x5845c6=_0x11a5d6[_0x3212('0x90')];}})[_0x3212('0x1e')](function(){return db[_0x3212('0xbe')][_0x3212('0x2e')]({'where':{'closed':![]}});})['then'](function(_0x5a2155){_0x563b6a=_0x5a2155;if(_0x1fb2d2&&_0x5a2155>_0x1fb2d2){return db[_0x3212('0x116')]['findOne']({'where':{'id':0x1}})[_0x3212('0x1e')](function(_0x159c64){if(_0x159c64){_0x159c64[_0x3212('0x117')]('chatLicenseExceeded');}});}})[_0x3212('0x1e')](function(){var _0x169102=_0x163030['Interval'];var _0x110441=_0x163030[_0x3212('0x9e')]||undefined;return _0x169102?_0x169102[_0x3212('0x9f')](_0x110441):!![];})[_0x3212('0x1e')](function(_0x2acbd9){var _0x29335d=fs[_0x3212('0xe5')](path[_0x3212('0x8b')](config[_0x3212('0x94')],_0x3212('0x118')),_0x3212('0xe7'));var _0xf36a6f=_0x3212('0x119');var _0x2f4434=![];var _0x522927,_0x5575f2;if(_0x4f356c[_0x3212('0xbb')][_0x3212('0x42')]){_0x522927=new URL(_0x4f356c['headers'][_0x3212('0x42')])[_0x3212('0x11a')];}else if(_0x4f356c[_0x3212('0xbb')][_0x3212('0x11a')]){_0x522927=new URL(_0x4f356c['headers']['origin'])[_0x3212('0x11a')];}else{_0x522927='http://localhost:9000';}_0x5575f2=typeof _0x163030['address'][_0x3212('0x3e')](',')[_0x3212('0x67')](function(_0x1ff53b){return wildcardUtils[_0x3212('0x11b')](_0x1ff53b,_0x522927);})!=='undefined';var _0x48706f={'chatVersion':_0xf36a6f,'chatWebsiteAddressOrigin':_0x5575f2?_0x522927:_0x163030['address'],'remote':_0x163030['remote'],'query':querystring['stringify'](_[_0x3212('0x5d')](_0x163030[_0x3212('0x31')]({'plain':!![]}),{'customerIp':_0x4f356c[_0x3212('0xbb')][_0x3212('0x3c')]||_0x4f356c['headers'][_0x3212('0x11c')]||_0x4f356c[_0x3212('0x11d')][_0x3212('0x11e')]||_0x4f356c['ip'],'referer':_0x4f356c[_0x3212('0xbb')][_0x3212('0x42')],'openedInteractions':_0x563b6a,'maxInteractions':_0x1fb2d2,'virtual':_0x5845c6[_0x3212('0x115')],'online':_0x2acbd9,'custom':_0x5845c6,'address':_0x5575f2?_0x522927:null}))[_0x3212('0x11f')](/'/g,'\x5c\x27')};_0xa129d1[_0x3212('0x37')](ejs[_0x3212('0x120')](Mustache['render'](_0x29335d,_0x48706f),{'proactiveActions':_0xf24677,'alignment':_0x163030[_0x3212('0x121')],'verticalAlignment':_0x163030[_0x3212('0x122')],'div_color':_0x163030[_0x3212('0x111')],'labelText':_0x163030[_0x3212('0x123')],'text_color':_0x163030[_0x3212('0x124')],'text_button_color':_0x163030['textButtonColor'],'button_color':_0x163030[_0x3212('0x125')],'background_color':_0x163030[_0x3212('0x126')],'hideWhenOffline':_0x163030[_0x3212('0x127')],'intervalId':_0x163030[_0x3212('0x128')],'isDevelopment':_0x2f4434,'chatVersion':_0xf36a6f}));})[_0x3212('0x27')](handleError(_0xa129d1,null));};exports['addApplications']=function(_0x544b12,_0x2f043f){var _0x884c93=_0x544b12[_0x3212('0x75')]['id'];var _0x100d6c=_0x544b12[_0x3212('0x69')];var _0x370293=0xc8;var _0x14e5cb=null;return db[_0x3212('0xf1')][_0x3212('0x129')]({'isolationLevel':db[_0x3212('0xf1')][_0x3212('0x12a')][_0x3212('0x12b')][_0x3212('0x12c')]},function(_0x7def32){return db[_0x3212('0x60')][_0x3212('0xf4')]({'where':{'id':_0x884c93},'transaction':_0x7def32})[_0x3212('0x1e')](function(_0x3da674){if(_0x3da674){return db['ChatApplication'][_0x3212('0x34')]({'where':{'ChatWebsiteId':_0x884c93},'transaction':_0x7def32})[_0x3212('0x1e')](function(){var _0x239dd3=_[_0x3212('0x4f')](_0x100d6c,function(_0x4327b0){_0x4327b0[_0x3212('0x77')]=_0x884c93;return _0x4327b0;});return db[_0x3212('0xaf')]['bulkCreate'](_0x239dd3,{'transaction':_0x7def32});});}else{_0x370293=0x194;_0x14e5cb=[];}});})['then'](function(){if(_0x370293!==0x194){return db[_0x3212('0xaf')][_0x3212('0x12d')]({'where':{'ChatWebsiteId':_0x884c93},'order':_0x3212('0xb6')})[_0x3212('0x1e')](function(_0xdea68e){_0x14e5cb=_0xdea68e;});}})[_0x3212('0x27')](function(_0x1af398){_0x370293=0x1f4;logger[_0x3212('0x23')](_0x1af398[_0x3212('0x12e')]);if(_0x1af398[_0x3212('0x36')]){delete _0x1af398[_0x3212('0x36')];}_0x14e5cb=_0x1af398;})[_0x3212('0x12f')](function(){if(_0x14e5cb===null){_0x2f043f['sendStatus'](_0x370293);}else{if(_0x370293===0x1f4){_0x2f043f[_0x3212('0x29')](_0x370293)[_0x3212('0x37')](_0x14e5cb);}else{_0x2f043f['status'](_0x370293)[_0x3212('0x2a')](_0x14e5cb);}}});};exports['getApplications']=function(_0xa585b5,_0x57efa5){var _0x5caf79={};var _0x416d7c={};var _0xd840aa;var _0x3f5771;return db[_0x3212('0x60')][_0x3212('0xf4')]({'where':{'id':_0xa585b5[_0x3212('0x75')]['id']}})[_0x3212('0x1e')](handleEntityNotFound(_0x57efa5,null))['then'](function(_0xb75803){if(_0xb75803){_0xd840aa=_0xb75803;_0x416d7c[_0x3212('0x48')]=_[_0x3212('0x53')](db[_0x3212('0xaf')][_0x3212('0x50')]);_0x416d7c[_0x3212('0x52')]=_['keys'](_0xa585b5[_0x3212('0x52')]);_0x416d7c[_0x3212('0x5b')]=_['intersection'](_0x416d7c[_0x3212('0x48')],_0x416d7c[_0x3212('0x52')]);_0x5caf79[_0x3212('0x54')]=_[_0x3212('0x66')](_0x416d7c['model'],qs[_0x3212('0x55')](_0xa585b5['query'][_0x3212('0x55')]));_0x5caf79['attributes']=_0x5caf79['attributes'][_0x3212('0x7a')]?_0x5caf79[_0x3212('0x54')]:_0x416d7c['model'];_0x5caf79[_0x3212('0x58')]=qs['sort'](_0xa585b5[_0x3212('0x52')][_0x3212('0x59')]);_0x5caf79['where']=qs[_0x3212('0x5b')](_[_0x3212('0x7b')](_0xa585b5['query'],_0x416d7c[_0x3212('0x5b')]));if(_0xa585b5[_0x3212('0x52')][_0x3212('0x5c')]){_0x5caf79[_0x3212('0x5a')]=_[_0x3212('0x5d')](_0x5caf79[_0x3212('0x5a')],{'$or':_['map'](_0x5caf79[_0x3212('0x54')],function(_0x592ffc){var _0x4b4e6b={};_0x4b4e6b[_0x592ffc]={'$like':'%'+_0xa585b5[_0x3212('0x52')][_0x3212('0x5c')]+'%'};return _0x4b4e6b;})});}_0x5caf79=_[_0x3212('0x5d')]({},_0x5caf79,_0xa585b5[_0x3212('0x5f')]);return _0xd840aa[_0x3212('0x130')](_0x5caf79);}})[_0x3212('0x1e')](function(_0x19fd6a){if(_0x19fd6a){_0x3f5771=_0x19fd6a[_0x3212('0x7a')];if(!_0xa585b5['query'][_0x3212('0x56')](_0x3212('0x57'))){_0x5caf79['limit']=qs[_0x3212('0x2d')](_0xa585b5[_0x3212('0x52')][_0x3212('0x2d')]);_0x5caf79[_0x3212('0x2b')]=qs[_0x3212('0x2b')](_0xa585b5['query'][_0x3212('0x2b')]);}return _0xd840aa[_0x3212('0x130')](_0x5caf79);}})[_0x3212('0x1e')](function(_0x2dedd9){if(_0x2dedd9){return _0x2dedd9?{'count':_0x3f5771,'rows':_0x2dedd9}:null;}})[_0x3212('0x1e')](respondWithResult(_0x57efa5,null))[_0x3212('0x27')](handleError(_0x57efa5,null));};exports[_0x3212('0x131')]=function(_0x56fe82,_0x787711){return db[_0x3212('0x132')]['find']({'where':{'id':_0x56fe82[_0x3212('0x75')]['id']}})[_0x3212('0x1e')](handleEntityNotFound(_0x787711,null))['then'](function(_0x4164ae){if(_0x4164ae){return _0x4164ae['addProactiveActions'](_0x56fe82[_0x3212('0x69')][_0x3212('0x7e')],_[_0x3212('0x10a')](_0x56fe82[_0x3212('0x69')],[_0x3212('0x7e'),'id'])||{});}})[_0x3212('0x1e')](respondWithResult(_0x787711,null))[_0x3212('0x27')](handleError(_0x787711,null));};exports[_0x3212('0x114')]=function(_0x348509,_0x5391c8){var _0x3d287c={};var _0x45cd82={};var _0x3c64a1;var _0x43c895;return db[_0x3212('0x60')][_0x3212('0xf4')]({'where':{'id':_0x348509['params']['id']}})['then'](handleEntityNotFound(_0x5391c8,null))[_0x3212('0x1e')](function(_0xddb1b6){if(_0xddb1b6){_0x3c64a1=_0xddb1b6;_0x45cd82[_0x3212('0x48')]=_[_0x3212('0x53')](db[_0x3212('0x133')][_0x3212('0x50')]);_0x45cd82[_0x3212('0x52')]=_['keys'](_0x348509['query']);_0x45cd82[_0x3212('0x5b')]=_['intersection'](_0x45cd82[_0x3212('0x48')],_0x45cd82['query']);_0x3d287c[_0x3212('0x54')]=_[_0x3212('0x66')](_0x45cd82[_0x3212('0x48')],qs['fields'](_0x348509[_0x3212('0x52')][_0x3212('0x55')]));_0x3d287c[_0x3212('0x54')]=_0x3d287c[_0x3212('0x54')]['length']?_0x3d287c['attributes']:_0x45cd82[_0x3212('0x48')];_0x3d287c['order']=qs['sort'](_0x348509[_0x3212('0x52')]['sort']);_0x3d287c[_0x3212('0x5a')]=qs[_0x3212('0x5b')](_[_0x3212('0x7b')](_0x348509[_0x3212('0x52')],_0x45cd82[_0x3212('0x5b')]));if(_0x348509[_0x3212('0x52')][_0x3212('0x5c')]){_0x3d287c[_0x3212('0x5a')]=_[_0x3212('0x5d')](_0x3d287c[_0x3212('0x5a')],{'$or':_[_0x3212('0x4f')](_0x3d287c[_0x3212('0x54')],function(_0x1bc301){var _0x44d8b0={};_0x44d8b0[_0x1bc301]={'$like':'%'+_0x348509[_0x3212('0x52')][_0x3212('0x5c')]+'%'};return _0x44d8b0;})});}_0x3d287c=_[_0x3212('0x5d')]({},_0x3d287c,_0x348509['options']);return _0x3c64a1[_0x3212('0x114')](_0x3d287c);}})['then'](function(_0x26f991){if(_0x26f991){_0x43c895=_0x26f991[_0x3212('0x7a')];if(!_0x348509['query'][_0x3212('0x56')](_0x3212('0x57'))){_0x3d287c[_0x3212('0x2d')]=qs['limit'](_0x348509[_0x3212('0x52')][_0x3212('0x2d')]);_0x3d287c['offset']=qs[_0x3212('0x2b')](_0x348509['query']['offset']);}return _0x3c64a1['getProactiveActions'](_0x3d287c);}})[_0x3212('0x1e')](function(_0x5c769f){if(_0x5c769f){return _0x5c769f?{'count':_0x43c895,'rows':_0x5c769f}:null;}})[_0x3212('0x1e')](respondWithResult(_0x5391c8,null))['catch'](handleError(_0x5391c8,null));};exports['getFields']=function(_0x2b5b0e,_0x1aa61b){var _0xcb81c7=_0x2b5b0e[_0x3212('0x52')][_0x3212('0x134')]==='false'?_0x3212('0x135'):'onlineForm';return db['ChatWebsite']['find']({'attributes':['id',_0xcb81c7],'where':{'id':_0x2b5b0e['params']['id']}})[_0x3212('0x1e')](handleEntityNotFound(_0x1aa61b,null))['then'](function(_0x1982c7){if(_0x1982c7){var _0x49df5a=_0x1982c7[_0xcb81c7];var _0x3b88ab=_0x49df5a&&_0x49df5a[_0x3212('0x136')]?_0x49df5a['items']:[];_0x1aa61b[_0x3212('0x37')]({'fromKey':_[_0x3212('0x91')](_0x49df5a[_0x3212('0x137')])?undefined:_0x49df5a[_0x3212('0x137')],'count':_0x3b88ab[_0x3212('0x7a')],'rows':_0x3b88ab});}})[_0x3212('0x27')](handleError(_0x1aa61b,null));};exports['getOfflineMessages']=function(_0x8590d5,_0xa77e1){var _0x885068={'raw':![],'where':{}};var _0x4fedb5={};var _0x2dbb3b={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x3212('0xf4')]({'where':{'id':_0x8590d5[_0x3212('0x75')]['id']}})[_0x3212('0x1e')](handleEntityNotFound(_0xa77e1,null))[_0x3212('0x1e')](function(_0x322b5e){if(_0x322b5e){_0x4fedb5[_0x3212('0x48')]=_[_0x3212('0x53')](db[_0x3212('0xea')][_0x3212('0x50')]);_0x4fedb5[_0x3212('0x52')]=_[_0x3212('0x53')](_0x8590d5[_0x3212('0x52')]);_0x4fedb5['filters']=_[_0x3212('0x66')](_0x4fedb5['model'],_0x4fedb5[_0x3212('0x52')]);_0x885068[_0x3212('0x54')]=_[_0x3212('0x66')](_0x4fedb5[_0x3212('0x48')],qs[_0x3212('0x55')](_0x8590d5['query'][_0x3212('0x55')]));_0x885068[_0x3212('0x54')]=_0x885068[_0x3212('0x54')][_0x3212('0x7a')]?_0x885068['attributes']:_0x4fedb5['model'];if(!_0x8590d5[_0x3212('0x52')][_0x3212('0x56')](_0x3212('0x57'))){_0x885068[_0x3212('0x2d')]=qs[_0x3212('0x2d')](_0x8590d5[_0x3212('0x52')][_0x3212('0x2d')]);_0x885068[_0x3212('0x2b')]=qs[_0x3212('0x2b')](_0x8590d5[_0x3212('0x52')][_0x3212('0x2b')]);}_0x885068[_0x3212('0x58')]=qs['sort'](_0x8590d5[_0x3212('0x52')][_0x3212('0x59')]);_0x885068['where']=qs[_0x3212('0x5b')](_[_0x3212('0x7b')](_0x8590d5[_0x3212('0x52')],_0x4fedb5[_0x3212('0x5b')]));_0x885068[_0x3212('0x5a')][_0x3212('0x77')]=_0x322b5e['id'];if(_0x8590d5[_0x3212('0x52')][_0x3212('0x5c')]){_0x885068[_0x3212('0x5a')]=_[_0x3212('0x5d')](_0x885068[_0x3212('0x5a')],{'$or':_[_0x3212('0x4f')](_0x885068[_0x3212('0x54')],function(_0x308a46){var _0x3a392d={};_0x3a392d[_0x308a46]={'$like':'%'+_0x8590d5['query'][_0x3212('0x5c')]+'%'};return _0x3a392d;})});}_0x885068=_[_0x3212('0x5d')]({},_0x885068,_0x8590d5[_0x3212('0x5f')]);return db[_0x3212('0xea')]['count']({'where':_0x885068['where']})['then'](function(_0x19ec90){_0x2dbb3b['count']=_0x19ec90;if(_0x8590d5['query'][_0x3212('0x61')]){_0x885068[_0x3212('0x62')]=[{'all':!![]}];}else{_0x885068['include']=[{'model':db[_0x3212('0xae')],'as':_0x3212('0x10c'),'required':![]},{'model':db[_0x3212('0xf2')],'as':'Attachments','required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x885068);})['then'](function(_0x19bd8b){_0x2dbb3b[_0x3212('0x7c')]=_0x19bd8b;return _0x2dbb3b;});}})[_0x3212('0x1e')](respondWithFilteredResult(_0xa77e1,_0x885068))[_0x3212('0x27')](handleError(_0xa77e1,null));};exports[_0x3212('0x138')]=function(_0x141c16,_0x145dd3){return db[_0x3212('0x60')][_0x3212('0x67')]({'where':{'id':_0x141c16[_0x3212('0x75')]['id']}})['then'](handleEntityNotFound(_0x145dd3,null))[_0x3212('0x1e')](function(_0x15a812){if(_0x15a812){return _0x15a812[_0x3212('0x138')](_0x141c16[_0x3212('0x69')][_0x3212('0x7e')],_[_0x3212('0x10a')](_0x141c16['body'],['ids','id'])||{})['spread'](function(_0x4e3ff3){for(var _0x5dda62=0x0;_0x5dda62<_0x141c16[_0x3212('0x69')][_0x3212('0x7e')][_0x3212('0x7a')];_0x5dda62+=0x1){socket['emit'](_0x3212('0x139'),{'UserId':Number(_0x141c16[_0x3212('0x69')]['ids'][_0x5dda62]),'ChatWebsiteId':Number(_0x141c16['params']['id'])});}return _0x4e3ff3;});}})[_0x3212('0x1e')](respondWithResult(_0x145dd3,null))['catch'](handleError(_0x145dd3,null));};exports[_0x3212('0x13a')]=function(_0x1fb016,_0x230999){return db[_0x3212('0x60')][_0x3212('0x67')]({'where':{'id':_0x1fb016[_0x3212('0x75')]['id']}})[_0x3212('0x1e')](handleEntityNotFound(_0x230999,null))[_0x3212('0x1e')](function(_0x4d21b0){if(_0x4d21b0){return _0x4d21b0[_0x3212('0x13a')](_0x1fb016['query'][_0x3212('0x7e')])['then'](function(){if(_[_0x3212('0x13b')](_0x1fb016[_0x3212('0x52')][_0x3212('0x7e')])){for(var _0xee24a7=0x0;_0xee24a7<_0x1fb016[_0x3212('0x52')][_0x3212('0x7e')][_0x3212('0x7a')];_0xee24a7+=0x1){socket[_0x3212('0x13c')](_0x3212('0x13d'),{'UserId':Number(_0x1fb016[_0x3212('0x52')][_0x3212('0x7e')][_0xee24a7]),'ChatWebsiteId':Number(_0x1fb016[_0x3212('0x75')]['id'])});}}else{socket[_0x3212('0x13c')]('userChatWebsite:remove',{'UserId':Number(_0x1fb016['query'][_0x3212('0x7e')]),'ChatWebsiteId':Number(_0x1fb016[_0x3212('0x75')]['id'])});}});}})['then'](respondWithStatusCode(_0x230999,null))[_0x3212('0x27')](handleError(_0x230999,null));};exports['getAgents']=function(_0x5e9fa9,_0x668041){var _0x262d20={};var _0x1561da={};var _0x48c23d;var _0x44cd1;return db[_0x3212('0x60')]['findOne']({'where':{'id':_0x5e9fa9[_0x3212('0x75')]['id']}})[_0x3212('0x1e')](handleEntityNotFound(_0x668041,null))[_0x3212('0x1e')](function(_0xc13e4d){if(_0xc13e4d){_0x48c23d=_0xc13e4d;_0x1561da[_0x3212('0x48')]=_[_0x3212('0x53')](db[_0x3212('0xce')]['rawAttributes']);_0x1561da[_0x3212('0x52')]=_[_0x3212('0x53')](_0x5e9fa9['query']);_0x1561da[_0x3212('0x5b')]=_['intersection'](_0x1561da[_0x3212('0x48')],_0x1561da['query']);_0x262d20[_0x3212('0x54')]=_[_0x3212('0x66')](_0x1561da['model'],qs[_0x3212('0x55')](_0x5e9fa9[_0x3212('0x52')][_0x3212('0x55')]));_0x262d20[_0x3212('0x54')]=_0x262d20[_0x3212('0x54')][_0x3212('0x7a')]?_0x262d20[_0x3212('0x54')]:_0x1561da[_0x3212('0x48')];_0x262d20[_0x3212('0x58')]=qs[_0x3212('0x59')](_0x5e9fa9[_0x3212('0x52')]['sort']);_0x262d20['where']=qs['filters'](_[_0x3212('0x7b')](_0x5e9fa9[_0x3212('0x52')],_0x1561da[_0x3212('0x5b')]));if(_0x5e9fa9[_0x3212('0x52')][_0x3212('0x5c')]){_0x262d20['where']=_[_0x3212('0x5d')](_0x262d20['where'],{'$or':_['map'](_0x262d20[_0x3212('0x54')],function(_0x38d073){var _0xafb9cc={};_0xafb9cc[_0x38d073]={'$like':'%'+_0x5e9fa9['query']['filter']+'%'};return _0xafb9cc;})});}_0x262d20=_['merge']({},_0x262d20,_0x5e9fa9['options']);return _0x48c23d['getAgents'](_0x262d20);}})['then'](function(_0x3e82ec){if(_0x3e82ec){_0x44cd1=_0x3e82ec[_0x3212('0x7a')];if(!_0x5e9fa9[_0x3212('0x52')]['hasOwnProperty'](_0x3212('0x57'))){_0x262d20[_0x3212('0x2d')]=qs[_0x3212('0x2d')](_0x5e9fa9['query'][_0x3212('0x2d')]);_0x262d20[_0x3212('0x2b')]=qs['offset'](_0x5e9fa9[_0x3212('0x52')][_0x3212('0x2b')]);}return _0x48c23d[_0x3212('0x13e')](_0x262d20);}})[_0x3212('0x1e')](function(_0x508579){if(_0x508579){return _0x508579?{'count':_0x44cd1,'rows':_0x508579}:null;}})[_0x3212('0x1e')](respondWithResult(_0x668041,null))[_0x3212('0x27')](handleError(_0x668041,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index a8c1fc3..fb92f78 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 _0xe0c3=['events','ChatWebsite','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports'];(function(_0x35457b,_0x116ab7){var _0x4f8627=function(_0x2c68b8){while(--_0x2c68b8){_0x35457b['push'](_0x35457b['shift']());}};_0x4f8627(++_0x116ab7);}(_0xe0c3,0xea));var _0x3e0c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe0c3[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x3e0c('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x3e0c('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x3e0c('0x2')](0x0);var events={'afterCreate':_0x3e0c('0x3'),'afterUpdate':_0x3e0c('0x4'),'afterDestroy':_0x3e0c('0x5')};function emitEvent(_0x410ec4){return function(_0x31851c,_0x26c964,_0x1a026f){ChatWebsiteEvents['emit'](_0x410ec4+':'+_0x31851c['id'],_0x31851c);ChatWebsiteEvents['emit'](_0x410ec4,_0x31851c);_0x1a026f(null);};}for(var e in events){if(events[_0x3e0c('0x6')](e)){var event=events[e];ChatWebsite[_0x3e0c('0x7')](e,emitEvent(event));}}module[_0x3e0c('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x581a=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x34a49c,_0x311bf9){var _0x178e9d=function(_0x5dd714){while(--_0x5dd714){_0x34a49c['push'](_0x34a49c['shift']());}};_0x178e9d(++_0x311bf9);}(_0x581a,0x127));var _0xa581=function(_0x5c7e81,_0x10384d){_0x5c7e81=_0x5c7e81-0x0;var _0xf51111=_0x581a[_0x5c7e81];return _0xf51111;};'use strict';var EventEmitter=require(_0xa581('0x0'));var ChatWebsite=require(_0xa581('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xa581('0x2')](0x0);var events={'afterCreate':_0xa581('0x3'),'afterUpdate':_0xa581('0x4'),'afterDestroy':_0xa581('0x5')};function emitEvent(_0x3f5c21){return function(_0x4e64cc,_0x4e65d7,_0x198faf){ChatWebsiteEvents['emit'](_0x3f5c21+':'+_0x4e64cc['id'],_0x4e64cc);ChatWebsiteEvents[_0xa581('0x6')](_0x3f5c21,_0x4e64cc);_0x198faf(null);};}for(var e in events){if(events[_0xa581('0x7')](e)){var event=events[e];ChatWebsite[_0xa581('0x8')](e,emitEvent(event));}}module[_0xa581('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 8c24f2d..18c372c 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 _0x2b55=['api','moment','bluebird','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','../../config/logger'];(function(_0x4c6081,_0x4821a7){var _0x2933be=function(_0x78f29){while(--_0x78f29){_0x4c6081['push'](_0x4c6081['shift']());}};_0x2933be(++_0x4821a7);}(_0x2b55,0x147));var _0x52b5=function(_0x8a4931,_0x5a7a4a){_0x8a4931=_0x8a4931-0x0;var _0x113b99=_0x2b55[_0x8a4931];return _0x113b99;};'use strict';var _=require(_0x52b5('0x0'));var util=require(_0x52b5('0x1'));var logger=require(_0x52b5('0x2'))(_0x52b5('0x3'));var moment=require(_0x52b5('0x4'));var BPromise=require(_0x52b5('0x5'));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(_0x52b5('0x6'));module[_0x52b5('0x7')]=function(_0x4a721d,_0xde1243){return _0x4a721d[_0x52b5('0x8')](_0x52b5('0x9'),attributes,{'tableName':_0x52b5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84a3=['api','moment','bluebird','path','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util'];(function(_0x59bf3e,_0x3a8e33){var _0x4a2340=function(_0x570a75){while(--_0x570a75){_0x59bf3e['push'](_0x59bf3e['shift']());}};_0x4a2340(++_0x3a8e33);}(_0x84a3,0x1a0));var _0x384a=function(_0x35ea7c,_0x4aa05d){_0x35ea7c=_0x35ea7c-0x0;var _0x56bdfc=_0x84a3[_0x35ea7c];return _0x56bdfc;};'use strict';var _=require(_0x384a('0x0'));var util=require(_0x384a('0x1'));var logger=require('../../config/logger')(_0x384a('0x2'));var moment=require(_0x384a('0x3'));var BPromise=require(_0x384a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x384a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x384a('0x6'));module[_0x384a('0x7')]=function(_0x3a36f4,_0x314d52){return _0x3a36f4[_0x384a('0x8')](_0x384a('0x9'),attributes,{'tableName':_0x384a('0xa'),'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 bf89590..8d5fe54 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 _0xfb7c=['rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3d34da,_0x3abcc1){var _0xcf6af8=function(_0x300a53){while(--_0x300a53){_0x3d34da['push'](_0x3d34da['shift']());}};_0xcf6af8(++_0x3abcc1);}(_0xfb7c,0x1d4));var _0xcfb7=function(_0x6f4696,_0x45e8da){_0x6f4696=_0x6f4696-0x0;var _0x3e9056=_0xfb7c[_0x6f4696];return _0x3e9056;};'use strict';var _=require(_0xcfb7('0x0'));var util=require(_0xcfb7('0x1'));var moment=require(_0xcfb7('0x2'));var BPromise=require(_0xcfb7('0x3'));var rs=require(_0xcfb7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcfb7('0x5'))['db'];var utils=require(_0xcfb7('0x6'));var logger=require(_0xcfb7('0x7'))(_0xcfb7('0x8'));var config=require('../../config/environment');var jayson=require(_0xcfb7('0x9'));var client=jayson[_0xcfb7('0xa')][_0xcfb7('0xb')]({'port':0x232a});config[_0xcfb7('0xc')]=_[_0xcfb7('0xd')](config[_0xcfb7('0xc')],{'host':_0xcfb7('0xe'),'port':0x18eb});var socket=require(_0xcfb7('0xf'))(new Redis(config[_0xcfb7('0xc')]));require(_0xcfb7('0x10'))[_0xcfb7('0x11')](socket);function respondWithRpcPromise(_0x3b6390,_0x662830,_0x59d1ed){return new BPromise(function(_0x26c40c,_0x57a5ff){return client['request'](_0x3b6390,_0x59d1ed)[_0xcfb7('0x12')](function(_0x4b9f4c){logger[_0xcfb7('0x13')](_0xcfb7('0x14'),_0x662830,_0xcfb7('0x15'));logger[_0xcfb7('0x16')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x662830,_0xcfb7('0x15'),JSON[_0xcfb7('0x17')](_0x4b9f4c));if(_0x4b9f4c[_0xcfb7('0x18')]){if(_0x4b9f4c[_0xcfb7('0x18')][_0xcfb7('0x19')]===0x1f4){logger['error'](_0xcfb7('0x14'),_0x662830,_0x4b9f4c[_0xcfb7('0x18')][_0xcfb7('0x1a')]);return _0x57a5ff(_0x4b9f4c[_0xcfb7('0x18')]['message']);}logger[_0xcfb7('0x18')](_0xcfb7('0x14'),_0x662830,_0x4b9f4c['error'][_0xcfb7('0x1a')]);return _0x26c40c(_0x4b9f4c[_0xcfb7('0x18')]['message']);}else{logger[_0xcfb7('0x13')](_0xcfb7('0x14'),_0x662830,_0xcfb7('0x15'));_0x26c40c(_0x4b9f4c[_0xcfb7('0x1b')]['message']);}})['catch'](function(_0x56d387){logger[_0xcfb7('0x18')](_0xcfb7('0x14'),_0x662830,_0x56d387);_0x57a5ff(_0x56d387);});});} \ No newline at end of file +var _0xd105=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','request','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0xd105,0x194));var _0x5d10=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd105[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5d10('0x0'));var util=require(_0x5d10('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5d10('0x2'));var fs=require('fs');var Redis=require(_0x5d10('0x3'));var db=require(_0x5d10('0x4'))['db'];var utils=require(_0x5d10('0x5'));var logger=require(_0x5d10('0x6'))(_0x5d10('0x7'));var config=require('../../config/environment');var jayson=require(_0x5d10('0x8'));var client=jayson['client'][_0x5d10('0x9')]({'port':0x232a});config['redis']=_[_0x5d10('0xa')](config[_0x5d10('0xb')],{'host':_0x5d10('0xc'),'port':0x18eb});var socket=require(_0x5d10('0xd'))(new Redis(config[_0x5d10('0xb')]));require(_0x5d10('0xe'))['register'](socket);function respondWithRpcPromise(_0x3c328f,_0x1b7775,_0x131652){return new BPromise(function(_0x3fe30b,_0x51511d){return client[_0x5d10('0xf')](_0x3c328f,_0x131652)['then'](function(_0x5710c5){logger['info'](_0x5d10('0x10'),_0x1b7775,_0x5d10('0x11'));logger[_0x5d10('0x12')](_0x5d10('0x13'),_0x1b7775,'request\x20sent',JSON[_0x5d10('0x14')](_0x5710c5));if(_0x5710c5[_0x5d10('0x15')]){if(_0x5710c5['error'][_0x5d10('0x16')]===0x1f4){logger['error'](_0x5d10('0x10'),_0x1b7775,_0x5710c5[_0x5d10('0x15')][_0x5d10('0x17')]);return _0x51511d(_0x5710c5['error'][_0x5d10('0x17')]);}logger['error'](_0x5d10('0x10'),_0x1b7775,_0x5710c5[_0x5d10('0x15')][_0x5d10('0x17')]);return _0x3fe30b(_0x5710c5['error'][_0x5d10('0x17')]);}else{logger[_0x5d10('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x1b7775,_0x5d10('0x11'));_0x3fe30b(_0x5710c5[_0x5d10('0x19')]['message']);}})[_0x5d10('0x1a')](function(_0x31b5b7){logger['error'](_0x5d10('0x10'),_0x1b7775,_0x31b5b7);_0x51511d(_0x31b5b7);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 6591f29..2b3969d 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 _0xb9f3=['./chatWebsite.events','save','emit','removeListener','register','length','chatWebsite:'];(function(_0x1a6629,_0x1ab63d){var _0x1eb452=function(_0x46e91c){while(--_0x46e91c){_0x1a6629['push'](_0x1a6629['shift']());}};_0x1eb452(++_0x1ab63d);}(_0xb9f3,0x150));var _0x3b9f=function(_0x223134,_0x323bd3){_0x223134=_0x223134-0x0;var _0x3bcc90=_0xb9f3[_0x223134];return _0x3bcc90;};'use strict';var ChatWebsiteEvents=require(_0x3b9f('0x0'));var events=[_0x3b9f('0x1'),'remove','update'];function createListener(_0x1a29b5,_0x244c0e){return function(_0x106ce8){_0x244c0e[_0x3b9f('0x2')](_0x1a29b5,_0x106ce8);};}function removeListener(_0x532f88,_0x54f159){return function(){ChatWebsiteEvents[_0x3b9f('0x3')](_0x532f88,_0x54f159);};}exports[_0x3b9f('0x4')]=function(_0x3c4882){for(var _0x15ba3a=0x0,_0x3c87e1=events[_0x3b9f('0x5')];_0x15ba3a<_0x3c87e1;_0x15ba3a++){var _0x280ba1=events[_0x15ba3a];var _0x3c5bdf=createListener(_0x3b9f('0x6')+_0x280ba1,_0x3c4882);ChatWebsiteEvents['on'](_0x280ba1,_0x3c5bdf);}}; \ No newline at end of file +var _0xa686=['register','chatWebsite:','./chatWebsite.events','save','remove','update','removeListener'];(function(_0x3214c7,_0x47e426){var _0x206cb4=function(_0xb9b6be){while(--_0xb9b6be){_0x3214c7['push'](_0x3214c7['shift']());}};_0x206cb4(++_0x47e426);}(_0xa686,0xfe));var _0x6a68=function(_0x534602,_0x548725){_0x534602=_0x534602-0x0;var _0xa1e3f2=_0xa686[_0x534602];return _0xa1e3f2;};'use strict';var ChatWebsiteEvents=require(_0x6a68('0x0'));var events=[_0x6a68('0x1'),_0x6a68('0x2'),_0x6a68('0x3')];function createListener(_0x92f542,_0x467f6d){return function(_0x3361c1){_0x467f6d['emit'](_0x92f542,_0x3361c1);};}function removeListener(_0x46eebb,_0x4122a6){return function(){ChatWebsiteEvents[_0x6a68('0x4')](_0x46eebb,_0x4122a6);};}exports[_0x6a68('0x5')]=function(_0x2568be){for(var _0x2e4d45=0x0,_0x59b056=events['length'];_0x2e4d45<_0x59b056;_0x2e4d45++){var _0x22e3bc=events[_0x2e4d45];var _0x49821c=createListener(_0x6a68('0x6')+_0x22e3bc,_0x2568be);ChatWebsiteEvents['on'](_0x22e3bc,_0x49821c);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index ec82565..a72dfa7 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x161a=['url','URL','localhost','trim','replace','([\x5cw]+)','test','exports'];(function(_0x5d7b48,_0x1c8eaa){var _0x31bd82=function(_0x3632d5){while(--_0x3632d5){_0x5d7b48['push'](_0x5d7b48['shift']());}};_0x31bd82(++_0x1c8eaa);}(_0x161a,0x140));var _0xa161=function(_0x10d34b,_0x4fef76){_0x10d34b=_0x10d34b-0x0;var _0x92b0bf=_0x161a[_0x10d34b];return _0x92b0bf;};var escapeRegExp=require('../../../utils/misc')['escapeRegExp'];var URL=require(_0xa161('0x0'))[_0xa161('0x1')];function testWildcardValidity(_0x549285){var _0x4ca66c=!![];try{new URL(_0x549285['replace']('*',_0xa161('0x2')));}catch(_0x36340b){_0x4ca66c=![];}return _0x4ca66c&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)['test'](_0x549285);}function testWebsiteWithWildcard(_0x551cc8,_0x7fde92){var _0x1705ab;var _0x12d54c=escapeRegExp(_0x551cc8[_0xa161('0x3')]()[_0xa161('0x4')](/\/$/,''))[_0xa161('0x4')]('\x5c*',_0xa161('0x5'));try{new URL(_0x551cc8['replace']('\x5c*',_0xa161('0x2')));_0x1705ab=new RegExp(_0x12d54c)[_0xa161('0x6')](_0x7fde92);}catch(_0x327221){_0x1705ab=![];}return _0x1705ab;}module[_0xa161('0x7')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0xedf1=['trim','([\x5cw]+)','localhost','../../../utils/misc','escapeRegExp','replace','test'];(function(_0x1e3a2e,_0x5131d0){var _0x3e6769=function(_0x3bf600){while(--_0x3bf600){_0x1e3a2e['push'](_0x1e3a2e['shift']());}};_0x3e6769(++_0x5131d0);}(_0xedf1,0xb2));var _0x1edf=function(_0xd69543,_0x5a1041){_0xd69543=_0xd69543-0x0;var _0x3588cb=_0xedf1[_0xd69543];return _0x3588cb;};var escapeRegExp=require(_0x1edf('0x0'))[_0x1edf('0x1')];var URL=require('url')['URL'];function testWildcardValidity(_0xdf58cf){var _0x462fc4=!![];try{new URL(_0xdf58cf[_0x1edf('0x2')]('*','localhost'));}catch(_0x224972){_0x462fc4=![];}return _0x462fc4&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x1edf('0x3')](_0xdf58cf);}function testWebsiteWithWildcard(_0x3a5efd,_0x5ec722){var _0x52238d;var _0x1b84af=escapeRegExp(_0x3a5efd[_0x1edf('0x4')]()[_0x1edf('0x2')](/\/$/,''))[_0x1edf('0x2')]('\x5c*',_0x1edf('0x5'));try{new URL(_0x3a5efd[_0x1edf('0x2')]('\x5c*',_0x1edf('0x6')));_0x52238d=new RegExp(_0x1b84af)[_0x1edf('0x3')](_0x5ec722);}catch(_0x30a13f){_0x52238d=![];}return _0x52238d;}module['exports']={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 8dff054..df19ac3 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 _0xc769=['/:id/customer_avatar','single','addCustomerAvatar','/:id/system_avatar','/:id/notify','notify','server/files','attachments','ensureDir','replace','extname','/:id/offline','any','offline','/:id/interactions','addInteraction','/:id/applications','addApplications','addProactiveActions','update','/:id/dispositions','removeDispositions','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','getAvatar','getSystemAvatar','getInteractions','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','create','post','addDisposition','addAnswer','join','root','server/files/images/logos/','format','%s-%s','now','originalname','file','addLogo','diskStorage','server/files/images/avatars/'];(function(_0x33c2af,_0x163198){var _0x13c04a=function(_0x4de68e){while(--_0x4de68e){_0x33c2af['push'](_0x33c2af['shift']());}};_0x13c04a(++_0x163198);}(_0xc769,0x1f4));var _0x9c76=function(_0x3c3d39,_0xa5e915){_0x3c3d39=_0x3c3d39-0x0;var _0x57015a=_0xc769[_0x3c3d39];return _0x57015a;};'use strict';var multer=require(_0x9c76('0x0'));var util=require('util');var path=require(_0x9c76('0x1'));var timeout=require(_0x9c76('0x2'));var express=require(_0x9c76('0x3'));var router=express['Router']();var fs_extra=require(_0x9c76('0x4'));var auth=require(_0x9c76('0x5'));var interaction=require(_0x9c76('0x6'));var config=require(_0x9c76('0x7'));var controller=require(_0x9c76('0x8'));router[_0x9c76('0x9')]('/',auth[_0x9c76('0xa')](),controller['index']);router['get'](_0x9c76('0xb'),auth['isAuthenticated'](),controller[_0x9c76('0xc')]);router[_0x9c76('0x9')](_0x9c76('0xd'),auth['isAuthenticated'](),controller[_0x9c76('0xe')]);router[_0x9c76('0x9')]('/:id/dispositions',auth[_0x9c76('0xa')](),controller['getDispositions']);router['get'](_0x9c76('0xf'),auth[_0x9c76('0xa')](),controller[_0x9c76('0x10')]);router[_0x9c76('0x9')](_0x9c76('0x11'),controller['getLogo']);router[_0x9c76('0x9')](_0x9c76('0x12'),controller[_0x9c76('0x13')]);router['get']('/:id/customer_avatar',controller['getCustomerAvatar']);router['get']('/:id/system_avatar',controller[_0x9c76('0x14')]);router[_0x9c76('0x9')]('/:id/interactions',auth[_0x9c76('0xa')](),controller[_0x9c76('0x15')]);router['get']('/:id/snippet',controller['getSnippet']);router['get']('/:id/applications',auth[_0x9c76('0xa')](),controller['getApplications']);router[_0x9c76('0x9')](_0x9c76('0x16'),auth[_0x9c76('0xa')](),controller[_0x9c76('0x17')]);router[_0x9c76('0x9')]('/:id/fields',controller[_0x9c76('0x18')]);router[_0x9c76('0x9')](_0x9c76('0x19'),auth['isAuthenticated'](),controller[_0x9c76('0x1a')]);router[_0x9c76('0x9')](_0x9c76('0x1b'),auth['isAuthenticated'](),controller[_0x9c76('0x1c')]);router['post']('/',auth[_0x9c76('0xa')](),controller[_0x9c76('0x1d')]);router[_0x9c76('0x1e')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x9c76('0x1f')]);router[_0x9c76('0x1e')](_0x9c76('0xf'),auth[_0x9c76('0xa')](),controller[_0x9c76('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4871ba,_0x526e0d,_0x1584a0){_0x1584a0(null,path[_0x9c76('0x21')](config[_0x9c76('0x22')],_0x9c76('0x23')));},'filename':function(_0x3b1e41,_0xda22f2,_0x4fd49){_0x4fd49(null,util[_0x9c76('0x24')](_0x9c76('0x25'),Date[_0x9c76('0x26')](),_0xda22f2[_0x9c76('0x27')]));}})});router['post'](_0x9c76('0x11'),upload['single'](_0x9c76('0x28')),controller[_0x9c76('0x29')]);var upload=multer({'storage':multer[_0x9c76('0x2a')]({'destination':function(_0x52dac4,_0x21510a,_0x16fa0a){_0x16fa0a(null,path[_0x9c76('0x21')](config['root'],_0x9c76('0x2b')));},'filename':function(_0x44eb27,_0x3a2c62,_0x34c12c){_0x34c12c(null,util[_0x9c76('0x24')](_0x9c76('0x25'),Date[_0x9c76('0x26')](),_0x3a2c62[_0x9c76('0x27')]));}})});router[_0x9c76('0x1e')](_0x9c76('0x12'),upload['single'](_0x9c76('0x28')),controller['addAvatar']);var upload=multer({'storage':multer[_0x9c76('0x2a')]({'destination':function(_0x5c7fe7,_0x446257,_0x3831a5){_0x3831a5(null,path[_0x9c76('0x21')](config['root'],_0x9c76('0x2b')));},'filename':function(_0x409d12,_0x448963,_0x47ef73){_0x47ef73(null,util[_0x9c76('0x24')](_0x9c76('0x25'),Date[_0x9c76('0x26')](),_0x448963['originalname']));}})});router[_0x9c76('0x1e')](_0x9c76('0x2c'),upload[_0x9c76('0x2d')](_0x9c76('0x28')),controller[_0x9c76('0x2e')]);var upload=multer({'storage':multer[_0x9c76('0x2a')]({'destination':function(_0x565472,_0x326146,_0x25e7f8){_0x25e7f8(null,path[_0x9c76('0x21')](config[_0x9c76('0x22')],_0x9c76('0x2b')));},'filename':function(_0x2e353d,_0x2f93c2,_0x49e43a){_0x49e43a(null,util[_0x9c76('0x24')]('%s-%s',Date[_0x9c76('0x26')](),_0x2f93c2[_0x9c76('0x27')]));}})});router['post'](_0x9c76('0x2f'),upload[_0x9c76('0x2d')](_0x9c76('0x28')),controller['addSystemAvatar']);router[_0x9c76('0x1e')](_0x9c76('0x30'),controller[_0x9c76('0x31')]);const offlineUploadMulter=multer({'storage':multer[_0x9c76('0x2a')]({'destination':function(_0x100c01,_0x4e0b24,_0x1c5235){const _0x3e8dea=path[_0x9c76('0x21')](config[_0x9c76('0x22')],_0x9c76('0x32'),_0x9c76('0x33'),'offline-chat');fs_extra[_0x9c76('0x34')](_0x3e8dea,function(){_0x1c5235(null,_0x3e8dea);});},'filename':function(_0x18e65e,_0x4a35d7,_0x5b5921){const _0x74e1ce=_0x4a35d7['originalname'][_0x9c76('0x35')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x398f0f=path[_0x9c76('0x36')](_0x74e1ce);const _0x4eeb2e=Date[_0x9c76('0x26')]()+'-'+_0x74e1ce['replace'](_0x398f0f,'')+_0x398f0f;_0x5b5921(null,_0x4eeb2e);}})});router[_0x9c76('0x1e')](_0x9c76('0x37'),offlineUploadMulter[_0x9c76('0x38')](),controller[_0x9c76('0x39')]);router[_0x9c76('0x1e')](_0x9c76('0x3a'),auth[_0x9c76('0xa')](),controller[_0x9c76('0x3b')]);router[_0x9c76('0x1e')](_0x9c76('0x3c'),auth[_0x9c76('0xa')](),controller[_0x9c76('0x3d')]);router['post'](_0x9c76('0x16'),auth[_0x9c76('0xa')](),controller[_0x9c76('0x3e')]);router[_0x9c76('0x1e')](_0x9c76('0x1b'),auth[_0x9c76('0xa')](),controller['addAgents']);router['put'](_0x9c76('0xd'),auth[_0x9c76('0xa')](),controller[_0x9c76('0x3f')]);router['delete'](_0x9c76('0xd'),auth[_0x9c76('0xa')](),controller['destroy']);router['delete'](_0x9c76('0x40'),auth[_0x9c76('0xa')](),controller[_0x9c76('0x41')]);router[_0x9c76('0x42')](_0x9c76('0xf'),auth[_0x9c76('0xa')](),controller['removeAnswers']);router[_0x9c76('0x42')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x9c76('0x43')]=router; \ No newline at end of file +var _0xa2b3=['single','file','server/files/images/avatars/','%s-%s','addAvatar','addSystemAvatar','notify','server/files','attachments','ensureDir','replace','extname','/:id/offline','offline','/:id/interactions','/:id/applications','/:id/users','addAgents','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','/:id/canned_answers','/:id/logo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','getOfflineMessages','post','create','addAnswer','diskStorage','join','root','server/files/images/logos/','format','now','originalname'];(function(_0x19ac90,_0x554f04){var _0x4b9d7d=function(_0x3efc03){while(--_0x3efc03){_0x19ac90['push'](_0x19ac90['shift']());}};_0x4b9d7d(++_0x554f04);}(_0xa2b3,0x162));var _0x3a2b=function(_0x742cb3,_0x43cb32){_0x742cb3=_0x742cb3-0x0;var _0x191a5d=_0xa2b3[_0x742cb3];return _0x191a5d;};'use strict';var multer=require('multer');var util=require(_0x3a2b('0x0'));var path=require(_0x3a2b('0x1'));var timeout=require(_0x3a2b('0x2'));var express=require(_0x3a2b('0x3'));var router=express['Router']();var fs_extra=require(_0x3a2b('0x4'));var auth=require(_0x3a2b('0x5'));var interaction=require(_0x3a2b('0x6'));var config=require(_0x3a2b('0x7'));var controller=require(_0x3a2b('0x8'));router[_0x3a2b('0x9')]('/',auth[_0x3a2b('0xa')](),controller[_0x3a2b('0xb')]);router[_0x3a2b('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x3a2b('0xc')]);router[_0x3a2b('0x9')](_0x3a2b('0xd'),auth[_0x3a2b('0xa')](),controller[_0x3a2b('0xe')]);router[_0x3a2b('0x9')](_0x3a2b('0xf'),auth[_0x3a2b('0xa')](),controller['getDispositions']);router['get'](_0x3a2b('0x10'),auth[_0x3a2b('0xa')](),controller['getAnswers']);router[_0x3a2b('0x9')](_0x3a2b('0x11'),controller['getLogo']);router['get'](_0x3a2b('0x12'),controller[_0x3a2b('0x13')]);router[_0x3a2b('0x9')](_0x3a2b('0x14'),controller[_0x3a2b('0x15')]);router[_0x3a2b('0x9')](_0x3a2b('0x16'),controller[_0x3a2b('0x17')]);router['get']('/:id/interactions',auth[_0x3a2b('0xa')](),controller[_0x3a2b('0x18')]);router[_0x3a2b('0x9')](_0x3a2b('0x19'),controller['getSnippet']);router['get']('/:id/applications',auth[_0x3a2b('0xa')](),controller[_0x3a2b('0x1a')]);router[_0x3a2b('0x9')](_0x3a2b('0x1b'),auth[_0x3a2b('0xa')](),controller[_0x3a2b('0x1c')]);router[_0x3a2b('0x9')](_0x3a2b('0x1d'),controller[_0x3a2b('0x1e')]);router[_0x3a2b('0x9')]('/:id/offline_messages',auth[_0x3a2b('0xa')](),controller[_0x3a2b('0x1f')]);router[_0x3a2b('0x9')]('/:id/users',auth[_0x3a2b('0xa')](),controller['getAgents']);router[_0x3a2b('0x20')]('/',auth[_0x3a2b('0xa')](),controller[_0x3a2b('0x21')]);router['post']('/:id/dispositions',auth[_0x3a2b('0xa')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0x3a2b('0xa')](),controller[_0x3a2b('0x22')]);var upload=multer({'storage':multer[_0x3a2b('0x23')]({'destination':function(_0x32e46b,_0x586a03,_0x32fcb7){_0x32fcb7(null,path[_0x3a2b('0x24')](config[_0x3a2b('0x25')],_0x3a2b('0x26')));},'filename':function(_0x40de23,_0x4bf2d0,_0x2d9a67){_0x2d9a67(null,util[_0x3a2b('0x27')]('%s-%s',Date[_0x3a2b('0x28')](),_0x4bf2d0[_0x3a2b('0x29')]));}})});router[_0x3a2b('0x20')](_0x3a2b('0x11'),upload[_0x3a2b('0x2a')](_0x3a2b('0x2b')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x22e01e,_0x5779dc,_0xdb2717){_0xdb2717(null,path[_0x3a2b('0x24')](config['root'],_0x3a2b('0x2c')));},'filename':function(_0x478150,_0x5cd491,_0x386de6){_0x386de6(null,util[_0x3a2b('0x27')](_0x3a2b('0x2d'),Date[_0x3a2b('0x28')](),_0x5cd491[_0x3a2b('0x29')]));}})});router['post']('/:id/avatar',upload['single']('file'),controller[_0x3a2b('0x2e')]);var upload=multer({'storage':multer[_0x3a2b('0x23')]({'destination':function(_0x3dbca4,_0x597e81,_0x556ea4){_0x556ea4(null,path['join'](config['root'],_0x3a2b('0x2c')));},'filename':function(_0x5f4a63,_0x4f5650,_0x449ae2){_0x449ae2(null,util[_0x3a2b('0x27')](_0x3a2b('0x2d'),Date[_0x3a2b('0x28')](),_0x4f5650[_0x3a2b('0x29')]));}})});router[_0x3a2b('0x20')](_0x3a2b('0x14'),upload[_0x3a2b('0x2a')]('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x41491f,_0x56dfca,_0xbb54b3){_0xbb54b3(null,path['join'](config[_0x3a2b('0x25')],_0x3a2b('0x2c')));},'filename':function(_0xc584bb,_0x34465c,_0x1af7c8){_0x1af7c8(null,util[_0x3a2b('0x27')](_0x3a2b('0x2d'),Date['now'](),_0x34465c[_0x3a2b('0x29')]));}})});router[_0x3a2b('0x20')](_0x3a2b('0x16'),upload[_0x3a2b('0x2a')](_0x3a2b('0x2b')),controller[_0x3a2b('0x2f')]);router[_0x3a2b('0x20')]('/:id/notify',controller[_0x3a2b('0x30')]);const offlineUploadMulter=multer({'storage':multer[_0x3a2b('0x23')]({'destination':function(_0x59baa1,_0x8deb87,_0x2dde22){const _0xa7aa76=path[_0x3a2b('0x24')](config[_0x3a2b('0x25')],_0x3a2b('0x31'),_0x3a2b('0x32'),'offline-chat');fs_extra[_0x3a2b('0x33')](_0xa7aa76,function(){_0x2dde22(null,_0xa7aa76);});},'filename':function(_0xef8faf,_0x27331a,_0x3bed3d){const _0x20e107=_0x27331a[_0x3a2b('0x29')][_0x3a2b('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x28c512=path[_0x3a2b('0x35')](_0x20e107);const _0x3f9236=Date[_0x3a2b('0x28')]()+'-'+_0x20e107[_0x3a2b('0x34')](_0x28c512,'')+_0x28c512;_0x3bed3d(null,_0x3f9236);}})});router[_0x3a2b('0x20')](_0x3a2b('0x36'),offlineUploadMulter['any'](),controller[_0x3a2b('0x37')]);router[_0x3a2b('0x20')](_0x3a2b('0x38'),auth['isAuthenticated'](),controller['addInteraction']);router[_0x3a2b('0x20')](_0x3a2b('0x39'),auth['isAuthenticated'](),controller['addApplications']);router['post'](_0x3a2b('0x1b'),auth[_0x3a2b('0xa')](),controller['addProactiveActions']);router['post'](_0x3a2b('0x3a'),auth[_0x3a2b('0xa')](),controller[_0x3a2b('0x3b')]);router['put'](_0x3a2b('0xd'),auth['isAuthenticated'](),controller[_0x3a2b('0x3c')]);router[_0x3a2b('0x3d')](_0x3a2b('0xd'),auth['isAuthenticated'](),controller[_0x3a2b('0x3e')]);router[_0x3a2b('0x3d')](_0x3a2b('0xf'),auth[_0x3a2b('0xa')](),controller[_0x3a2b('0x3f')]);router[_0x3a2b('0x3d')](_0x3a2b('0x10'),auth['isAuthenticated'](),controller[_0x3a2b('0x40')]);router['delete'](_0x3a2b('0x3a'),auth[_0x3a2b('0xa')](),controller[_0x3a2b('0x41')]);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 0381bc7..db93428 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 _0x29e8=['client-side-logger','Client-Side\x20logger\x20not\x20found!','/client-logs','use','isAuthenticated','express','../components/auth/service','Router','env','production','app','get'];(function(_0x5144bd,_0x46e5f0){var _0x3bac80=function(_0x4b6dd2){while(--_0x4b6dd2){_0x5144bd['push'](_0x5144bd['shift']());}};_0x3bac80(++_0x46e5f0);}(_0x29e8,0xdd));var _0x829e=function(_0x64ca36,_0x1863c1){_0x64ca36=_0x64ca36-0x0;var _0x19e5f7=_0x29e8[_0x64ca36];return _0x19e5f7;};var beaverLogger=require('beaver-logger/server');var express=require(_0x829e('0x0'));var auth=require(_0x829e('0x1'));var config=require('../config/environment');var router=express[_0x829e('0x2')]();var isProduction=config[_0x829e('0x3')]===_0x829e('0x4')||![];function clientSideLogs(_0x3f5aaa,_0x25d3ce,_0x12baa2){var _0x23b5ee=_0x3f5aaa[_0x829e('0x5')][_0x829e('0x6')](_0x829e('0x7'));if(!_0x23b5ee){throw new Error(_0x829e('0x8'));}return beaverLogger['expressEndpoint']({'uri':_0x829e('0x9'),'logger':_0x23b5ee,'enableCors':!isProduction})(_0x3f5aaa,_0x25d3ce,_0x12baa2);}router[_0x829e('0xa')](auth[_0x829e('0xb')](),clientSideLogs);module['exports']=router; \ No newline at end of file +var _0x6c18=['Router','env','expressEndpoint','use','beaver-logger/server','express','../components/auth/service'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x6c18,0x1a1));var _0x86c1=function(_0x4c3b80,_0x196af9){_0x4c3b80=_0x4c3b80-0x0;var _0x3290a1=_0x6c18[_0x4c3b80];return _0x3290a1;};var beaverLogger=require(_0x86c1('0x0'));var express=require(_0x86c1('0x1'));var auth=require(_0x86c1('0x2'));var config=require('../config/environment');var router=express[_0x86c1('0x3')]();var isProduction=config[_0x86c1('0x4')]==='production'||![];function clientSideLogs(_0x2fb387,_0xa121ff,_0x3d6b3f){var _0x158b1c=_0x2fb387['app']['get']('client-side-logger');if(!_0x158b1c){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0x86c1('0x5')]({'uri':'/client-logs','logger':_0x158b1c,'enableCors':!isProduction})(_0x2fb387,_0xa121ff,_0x3d6b3f);}router[_0x86c1('0x6')](auth['isAuthenticated'](),clientSideLogs);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index a784d15..e4a6d63 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 _0xbff0=['Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','STRING','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','AmazonAWS'];(function(_0x3e0763,_0x3d12be){var _0x351ca2=function(_0x9beae7){while(--_0x9beae7){_0x3e0763['push'](_0x3e0763['shift']());}};_0x351ca2(++_0x3d12be);}(_0xbff0,0xde));var _0x0bff=function(_0x301064,_0x1985aa){_0x301064=_0x301064-0x0;var _0x5bc841=_0xbff0[_0x301064];return _0x5bc841;};'use strict';var Sequelize=require(_0x0bff('0x0'));module[_0x0bff('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x0bff('0x2'),_0x0bff('0x3'),_0x0bff('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x0bff('0x5'),_0x0bff('0x6'))},'data1':{'type':Sequelize['STRING'],'comment':_0x0bff('0x7')},'data2':{'type':Sequelize[_0x0bff('0x8')],'comment':_0x0bff('0x9')},'data3':{'type':Sequelize[_0x0bff('0x8')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0x0bff('0x8')],'comment':_0x0bff('0xa')},'data5':{'type':Sequelize[_0x0bff('0xb')],'comment':_0x0bff('0xc')},'data6':{'type':Sequelize[_0x0bff('0xb')],'comment':_0x0bff('0xd')},'data7':{'type':Sequelize[_0x0bff('0xb')],'comment':_0x0bff('0xe')}}; \ No newline at end of file +var _0x7c19=['ENUM','AmazonAWS','Google','MicrosoftAzure','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING'];(function(_0x100e36,_0x4da225){var _0x1df0c9=function(_0xe4b84f){while(--_0xe4b84f){_0x100e36['push'](_0x100e36['shift']());}};_0x1df0c9(++_0x4da225);}(_0x7c19,0x174));var _0x97c1=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x7c19[_0x422905];return _0x33dc6c;};'use strict';var Sequelize=require(_0x97c1('0x0'));module[_0x97c1('0x1')]={'name':{'type':Sequelize[_0x97c1('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x97c1('0x3')](_0x97c1('0x4'),_0x97c1('0x5'),_0x97c1('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x97c1('0x3')]('Outlook365',_0x97c1('0x7'))},'data1':{'type':Sequelize[_0x97c1('0x2')],'comment':_0x97c1('0x8')},'data2':{'type':Sequelize[_0x97c1('0x2')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0x97c1('0x2')],'comment':_0x97c1('0x9')},'data4':{'type':Sequelize[_0x97c1('0x2')],'comment':_0x97c1('0xa')},'data5':{'type':Sequelize[_0x97c1('0xb')],'comment':_0x97c1('0xc')},'data6':{'type':Sequelize[_0x97c1('0xb')],'comment':_0x97c1('0xd')},'data7':{'type':Sequelize[_0x97c1('0xb')],'comment':_0x97c1('0xe')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 94ea16d..e78f9d0 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 _0x2741=['data5','refresh_token','data6','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','message','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','update','destroy','then','end','error','stack','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','type','key','query','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','rows','service','decryptString','data3','catch','show','params','keys','intersection','find','MicrosoftAzure','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','create','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','get','from','base64','toString','ascii','parse','isValidIdToken','Unable\x20to\x20validate\x20id_token','state','getOauth2MicrosoftAccessToken','code'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x2741,0x1e9));var _0x1274=function(_0x442d58,_0x192b11){_0x442d58=_0x442d58-0x0;var _0x205c77=_0x2741[_0x442d58];return _0x205c77;};'use strict';var _=require(_0x1274('0x0'));var Redis=require(_0x1274('0x1'));var qs=require(_0x1274('0x2'));var encryptor=require(_0x1274('0x3'));var config=require(_0x1274('0x4'));var logger=require(_0x1274('0x5'))('api');var db=require(_0x1274('0x6'))['db'];var oauth=require(_0x1274('0x7'));config[_0x1274('0x8')]=_[_0x1274('0x9')](config[_0x1274('0x8')],{'host':_0x1274('0xa'),'port':0x18eb});var socket=require(_0x1274('0xb'))(new Redis(config[_0x1274('0x8')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x4f42a5,_0x4dfbbc){_0x4dfbbc=_0x4dfbbc||0xcc;return function(_0x93d87){if(_0x93d87){return _0x4f42a5[_0x1274('0xc')](_0x4dfbbc);}return _0x4f42a5[_0x1274('0xd')](_0x4dfbbc)['end']();};}function respondWithResult(_0x1f76a8,_0x30264b){_0x30264b=_0x30264b||0xc8;return function(_0x23b8e3){if(_0x23b8e3){return _0x1f76a8[_0x1274('0xd')](_0x30264b)[_0x1274('0xe')](_0x23b8e3);}};}function respondWithFilteredResult(_0x248096,_0x38de52){return function(_0x33cf48){if(_0x33cf48){var _0x1862bc=typeof _0x38de52[_0x1274('0xf')]===_0x1274('0x10')&&typeof _0x38de52[_0x1274('0x11')]===_0x1274('0x10');var _0x1f573d=_0x33cf48[_0x1274('0x12')];var _0x8278f5=_0x1862bc?0x0:_0x38de52[_0x1274('0xf')];var _0x3b83a5=_0x1862bc?_0x33cf48[_0x1274('0x12')]:_0x38de52[_0x1274('0xf')]+_0x38de52[_0x1274('0x11')];var _0x22104f;if(_0x3b83a5>=_0x1f573d){_0x3b83a5=_0x1f573d;_0x22104f=0xc8;}else{_0x22104f=0xce;}_0x248096[_0x1274('0xd')](_0x22104f);return _0x248096['set']('Content-Range',_0x8278f5+'-'+_0x3b83a5+'/'+_0x1f573d)[_0x1274('0xe')](_0x33cf48);}return null;};}function saveUpdates(_0x5c6cb1){return function(_0x25e434){if(_0x25e434){return _0x25e434[_0x1274('0x13')](_0x5c6cb1)['then'](function(_0x3e6e11){return _0x3e6e11;});}return null;};}function removeEntity(_0x4e9609){return function(_0x84be30){if(_0x84be30){return _0x84be30[_0x1274('0x14')]()[_0x1274('0x15')](function(){_0x4e9609[_0x1274('0xd')](0xcc)[_0x1274('0x16')]();});}};}function handleEntityNotFound(_0x63b519){return function(_0x2c6556){if(!_0x2c6556){_0x63b519[_0x1274('0xc')](0x194);}return _0x2c6556;};}function handleError(_0x30366a,_0x5f79a2){_0x5f79a2=_0x5f79a2||0x1f4;return function(_0x39531f){logger[_0x1274('0x17')](_0x39531f[_0x1274('0x18')]);if(_0x39531f[_0x1274('0x19')]){delete _0x39531f[_0x1274('0x19')];}_0x30366a[_0x1274('0xd')](_0x5f79a2)[_0x1274('0x1a')](_0x39531f);};}function maskClientSecret(_0x5deb32){return _[_0x1274('0x1b')](_0x5deb32[_0x1274('0x1c')](0x0,0x3),0x14,'*');}exports[_0x1274('0x1d')]=function(_0x4d014d,_0x422a54){var _0x1fd8ed={},_0x332ce2={},_0x5e6942={'count':0x0,'rows':[]};var _0x1c8b07=_[_0x1274('0x1e')](db[_0x1274('0x1f')][_0x1274('0x20')],function(_0x27d954){return{'name':_0x27d954['fieldName'],'type':_0x27d954[_0x1274('0x21')][_0x1274('0x22')]};});_0x332ce2['model']=_[_0x1274('0x1e')](_0x1c8b07,_0x1274('0x19'));_0x332ce2[_0x1274('0x23')]=_['keys'](_0x4d014d[_0x1274('0x23')]);_0x332ce2['filters']=_['intersection'](_0x332ce2[_0x1274('0x24')],_0x332ce2['query']);_0x1fd8ed[_0x1274('0x25')]=_['intersection'](_0x332ce2[_0x1274('0x24')],qs[_0x1274('0x26')](_0x4d014d[_0x1274('0x23')][_0x1274('0x26')]));_0x1fd8ed[_0x1274('0x25')]=_0x1fd8ed['attributes'][_0x1274('0x27')]?_0x1fd8ed['attributes']:_0x332ce2[_0x1274('0x24')];if(!_0x4d014d[_0x1274('0x23')][_0x1274('0x28')](_0x1274('0x29'))){_0x1fd8ed[_0x1274('0x11')]=qs[_0x1274('0x11')](_0x4d014d[_0x1274('0x23')]['limit']);_0x1fd8ed[_0x1274('0xf')]=qs[_0x1274('0xf')](_0x4d014d['query']['offset']);}_0x1fd8ed['order']=qs[_0x1274('0x2a')](_0x4d014d[_0x1274('0x23')][_0x1274('0x2a')]);_0x1fd8ed[_0x1274('0x2b')]=qs['filters'](_[_0x1274('0x2c')](_0x4d014d[_0x1274('0x23')],_0x332ce2[_0x1274('0x2d')]),_0x1c8b07);if(_0x4d014d[_0x1274('0x23')][_0x1274('0x2e')]){_0x1fd8ed[_0x1274('0x2b')]=_['merge'](_0x1fd8ed[_0x1274('0x2b')],{'$or':_['map'](_0x1c8b07,function(_0x582d0d){if(_0x582d0d[_0x1274('0x21')]!==_0x1274('0x2f')){var _0x367c0a={};_0x367c0a[_0x582d0d[_0x1274('0x19')]]={'$like':'%'+_0x4d014d[_0x1274('0x23')][_0x1274('0x2e')]+'%'};return _0x367c0a;}})});}_0x1fd8ed=_[_0x1274('0x30')]({},_0x1fd8ed,_0x4d014d[_0x1274('0x31')]);var _0x56a894={'where':_0x1fd8ed[_0x1274('0x2b')]};return db[_0x1274('0x1f')][_0x1274('0x12')](_0x56a894)[_0x1274('0x15')](function(_0x265bf6){_0x5e6942[_0x1274('0x12')]=_0x265bf6;if(_0x4d014d[_0x1274('0x23')][_0x1274('0x32')]){_0x1fd8ed[_0x1274('0x33')]=[{'all':!![]}];}return db[_0x1274('0x1f')]['findAll'](_0x1fd8ed);})['then'](function(_0xccd906){_0x5e6942[_0x1274('0x34')]=_[_0x1274('0x1e')](_0xccd906,function(_0x409288){if(_0x409288[_0x1274('0x35')]==='MicrosoftAzure'){var _0x281339=encryptor[_0x1274('0x36')](_0x409288[_0x1274('0x37')]);_0x409288[_0x1274('0x37')]=maskClientSecret(_0x281339);}return _0x409288;});return _0x5e6942;})[_0x1274('0x15')](respondWithFilteredResult(_0x422a54,_0x1fd8ed))[_0x1274('0x38')](handleError(_0x422a54,null));};exports[_0x1274('0x39')]=function(_0x39701d,_0x55cf0d){var _0x207345={'raw':!![],'where':{'id':_0x39701d[_0x1274('0x3a')]['id']}},_0x1ccb0a={};_0x1ccb0a[_0x1274('0x24')]=_[_0x1274('0x3b')](db[_0x1274('0x1f')]['rawAttributes']);_0x1ccb0a[_0x1274('0x23')]=_['keys'](_0x39701d['query']);_0x1ccb0a[_0x1274('0x2d')]=_[_0x1274('0x3c')](_0x1ccb0a[_0x1274('0x24')],_0x1ccb0a[_0x1274('0x23')]);_0x207345[_0x1274('0x25')]=_['intersection'](_0x1ccb0a[_0x1274('0x24')],qs['fields'](_0x39701d['query']['fields']));_0x207345[_0x1274('0x25')]=_0x207345['attributes']['length']?_0x207345[_0x1274('0x25')]:_0x1ccb0a[_0x1274('0x24')];if(_0x39701d['query'][_0x1274('0x32')]){_0x207345[_0x1274('0x33')]=[{'all':!![]}];}_0x207345=_[_0x1274('0x30')]({},_0x207345,_0x39701d[_0x1274('0x31')]);return db['CloudProvider'][_0x1274('0x3d')](_0x207345)[_0x1274('0x15')](handleEntityNotFound(_0x55cf0d,null))[_0x1274('0x15')](function(_0x46cb0d){if(_0x46cb0d[_0x1274('0x35')]===_0x1274('0x3e')){var _0x24f413=encryptor[_0x1274('0x36')](_0x46cb0d[_0x1274('0x37')]);_0x46cb0d['data3']=maskClientSecret(_0x24f413);}return _0x46cb0d;})['then'](respondWithResult(_0x55cf0d,null))[_0x1274('0x38')](handleError(_0x55cf0d,null));};exports['create']=function(_0x203455,_0x30d757){if(!_0x203455[_0x1274('0x3f')]['name'])throw new Error(_0x1274('0x40'));if(!_0x203455[_0x1274('0x3f')][_0x1274('0x35')])throw new Error(_0x1274('0x41'));var _0x101491=db['CloudProvider'][_0x1274('0x20')][_0x1274('0x35')][_0x1274('0x42')];if(!_0x101491[_0x1274('0x43')](_0x203455[_0x1274('0x3f')][_0x1274('0x35')]))throw new Error(_0x1274('0x44')+_0x101491[_0x1274('0x45')](',\x20'));if(_0x203455[_0x1274('0x3f')][_0x1274('0x35')]===_0x1274('0x3e')&&_0x203455['body'][_0x1274('0x37')]){_0x203455[_0x1274('0x3f')]['data3']=encryptor[_0x1274('0x46')](_0x203455[_0x1274('0x3f')]['data3']);}return db[_0x1274('0x1f')][_0x1274('0x47')](_0x203455['body'],{})[_0x1274('0x15')](respondWithResult(_0x30d757,0xc9))[_0x1274('0x38')](handleError(_0x30d757,null));};exports[_0x1274('0x13')]=function(_0x2dbc6a,_0x363c33){if(_0x2dbc6a[_0x1274('0x3f')]['id']){delete _0x2dbc6a[_0x1274('0x3f')]['id'];}return db[_0x1274('0x1f')]['find']({'where':{'id':_0x2dbc6a[_0x1274('0x3a')]['id']}})[_0x1274('0x15')](handleEntityNotFound(_0x363c33,null))[_0x1274('0x15')](function(_0x221b97){if(_0x221b97['service']==='MicrosoftAzure'&&_0x2dbc6a[_0x1274('0x3f')][_0x1274('0x37')]){_0x2dbc6a[_0x1274('0x3f')]['data3']=encryptor[_0x1274('0x46')](_0x2dbc6a['body'][_0x1274('0x37')]);}return _0x221b97;})['then'](saveUpdates(_0x2dbc6a[_0x1274('0x3f')],null))[_0x1274('0x15')](respondWithResult(_0x363c33,null))[_0x1274('0x38')](handleError(_0x363c33,null));};exports[_0x1274('0x14')]=function(_0x3431b1,_0x459b62){return db['CloudProvider'][_0x1274('0x3d')]({'where':{'id':_0x3431b1[_0x1274('0x3a')]['id']}})[_0x1274('0x15')](handleEntityNotFound(_0x459b62,null))['then'](removeEntity(_0x459b62,null))['catch'](handleError(_0x459b62,null));};exports[_0x1274('0x48')]=function(_0x297fe5,_0x266699){return db[_0x1274('0x1f')][_0x1274('0x49')]({'where':{'id':_0x297fe5[_0x1274('0x3a')]['id']},'raw':!![]})['then'](function(_0x32e382){if(!_0x32e382)return _0x266699['sendStatus'](0x194);return{'url':oauth[_0x1274('0x4a')](_0x32e382,_0x297fe5['user']['id'])};})[_0x1274('0x15')](respondWithResult(_0x266699,null))['catch'](handleError(_0x266699,null));};exports[_0x1274('0x4b')]=function(_0x3acb64,_0x299f8a){var _0x46501f=_0x3acb64['body'];var _0x4d8333;var _0x58e7d6;if(_0x46501f[_0x1274('0x17')])throw _0x46501f;redis[_0x1274('0x4c')](_0x46501f['state'])[_0x1274('0x15')](function(_0x2e5065){if(!_0x2e5065)throw new Error('Invalid\x20state\x20parameter');_0x4d8333=JSON['parse'](_0x2e5065);var _0x188990=Buffer[_0x1274('0x4d')](_0x46501f['state'],_0x1274('0x4e'))[_0x1274('0x4f')](_0x1274('0x50'));_0x58e7d6=JSON[_0x1274('0x51')](_0x188990);if(!oauth[_0x1274('0x52')](_0x46501f['id_token'],_0x4d8333['oauth2Claims']))throw new Error(_0x1274('0x53'));redis['del'](_0x46501f[_0x1274('0x54')]);return oauth[_0x1274('0x55')](_0x46501f[_0x1274('0x56')],_0x4d8333);})[_0x1274('0x15')](function(_0x1cd29a){_0x4d8333[_0x1274('0x57')]=_0x1cd29a['access_token'];_0x4d8333['data6']=_0x1cd29a[_0x1274('0x58')];return db['CloudProvider'][_0x1274('0x13')]({'data5':_0x4d8333[_0x1274('0x57')],'data6':_0x4d8333[_0x1274('0x59')]},{'where':{'id':_0x4d8333['id']}});})[_0x1274('0x15')](function(){oauth[_0x1274('0x5a')](_0x4d8333);socket[_0x1274('0x5b')](_0x1274('0x5c'),{'id':_0x58e7d6['id']});return;})['then'](respondWithStatusCode(_0x299f8a,null))['catch'](function(_0x51e2fa){if(_0x58e7d6){socket[_0x1274('0x5b')](_0x1274('0x5d'),{'id':_0x58e7d6['id']});}if(!_0x4d8333){logger[_0x1274('0x17')]('Invalid\x20authentication\x20state\x20parameter',_0x51e2fa);return _0x299f8a[_0x1274('0xd')](0x1f4)['send'](_0x51e2fa[_0x1274('0x5e')]);}logger['error']('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x4d8333['id'],JSON[_0x1274('0x5f')](_0x51e2fa));});}; \ No newline at end of file +var _0x1846=['Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','find','destroy','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','state','Invalid\x20state\x20parameter','base64','isValidIdToken','oauth2Claims','del','getOauth2MicrosoftAccessToken','code','access_token','data6','refresh_token','startRefreshInterval','microsoftAuthorization:error','message','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','api','./cloudProvider.oauth','redis','defaults','localhost','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','sendStatus','error','name','send','padEnd','map','CloudProvider','fieldName','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','merge','type','VIRTUAL','filter','options','includeAll','include','rows','service','data3','catch','show','params','MicrosoftAzure','decryptString','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','rawAttributes','values','includes'];(function(_0x420085,_0x4fde85){var _0x617837=function(_0x2c94cc){while(--_0x2c94cc){_0x420085['push'](_0x420085['shift']());}};_0x617837(++_0x4fde85);}(_0x1846,0x179));var _0x6184=function(_0x27c24d,_0x2b50f1){_0x27c24d=_0x27c24d-0x0;var _0x14e722=_0x1846[_0x27c24d];return _0x14e722;};'use strict';var _=require(_0x6184('0x0'));var Redis=require(_0x6184('0x1'));var qs=require(_0x6184('0x2'));var encryptor=require(_0x6184('0x3'));var config=require(_0x6184('0x4'));var logger=require('../../config/logger')(_0x6184('0x5'));var db=require('../../mysqldb')['db'];var oauth=require(_0x6184('0x6'));config[_0x6184('0x7')]=_[_0x6184('0x8')](config['redis'],{'host':_0x6184('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6184('0x7')]));var redis=new Redis(config[_0x6184('0x7')]);function respondWithStatusCode(_0x4c4214,_0x36f382){_0x36f382=_0x36f382||0xcc;return function(_0x4c74e7){if(_0x4c74e7){return _0x4c4214['sendStatus'](_0x36f382);}return _0x4c4214[_0x6184('0xa')](_0x36f382)[_0x6184('0xb')]();};}function respondWithResult(_0x1d5be5,_0x4c65de){_0x4c65de=_0x4c65de||0xc8;return function(_0x2769f6){if(_0x2769f6){return _0x1d5be5['status'](_0x4c65de)[_0x6184('0xc')](_0x2769f6);}};}function respondWithFilteredResult(_0x439ebe,_0x290748){return function(_0x3c5104){if(_0x3c5104){var _0x2d3671=typeof _0x290748[_0x6184('0xd')]===_0x6184('0xe')&&typeof _0x290748[_0x6184('0xf')]==='undefined';var _0x502bb3=_0x3c5104['count'];var _0x360c21=_0x2d3671?0x0:_0x290748[_0x6184('0xd')];var _0x5791a3=_0x2d3671?_0x3c5104[_0x6184('0x10')]:_0x290748[_0x6184('0xd')]+_0x290748['limit'];var _0x5e2c4e;if(_0x5791a3>=_0x502bb3){_0x5791a3=_0x502bb3;_0x5e2c4e=0xc8;}else{_0x5e2c4e=0xce;}_0x439ebe['status'](_0x5e2c4e);return _0x439ebe[_0x6184('0x11')](_0x6184('0x12'),_0x360c21+'-'+_0x5791a3+'/'+_0x502bb3)[_0x6184('0xc')](_0x3c5104);}return null;};}function saveUpdates(_0x51f531){return function(_0x1eb58e){if(_0x1eb58e){return _0x1eb58e[_0x6184('0x13')](_0x51f531)[_0x6184('0x14')](function(_0x16f1cb){return _0x16f1cb;});}return null;};}function removeEntity(_0x46d80b){return function(_0x776a31){if(_0x776a31){return _0x776a31['destroy']()[_0x6184('0x14')](function(){_0x46d80b[_0x6184('0xa')](0xcc)[_0x6184('0xb')]();});}};}function handleEntityNotFound(_0xbc1ab9){return function(_0x47c36e){if(!_0x47c36e){_0xbc1ab9[_0x6184('0x15')](0x194);}return _0x47c36e;};}function handleError(_0x4951a9,_0x1b2894){_0x1b2894=_0x1b2894||0x1f4;return function(_0x33d70a){logger[_0x6184('0x16')](_0x33d70a['stack']);if(_0x33d70a['name']){delete _0x33d70a[_0x6184('0x17')];}_0x4951a9[_0x6184('0xa')](_0x1b2894)[_0x6184('0x18')](_0x33d70a);};}function maskClientSecret(_0x9a2625){return _[_0x6184('0x19')](_0x9a2625['slice'](0x0,0x3),0x14,'*');}exports['index']=function(_0x1db518,_0x14ad0a){var _0x1d017c={},_0x48259d={},_0x257096={'count':0x0,'rows':[]};var _0x3f96d5=_[_0x6184('0x1a')](db[_0x6184('0x1b')]['rawAttributes'],function(_0x31895b){return{'name':_0x31895b[_0x6184('0x1c')],'type':_0x31895b['type']['key']};});_0x48259d[_0x6184('0x1d')]=_['map'](_0x3f96d5,_0x6184('0x17'));_0x48259d[_0x6184('0x1e')]=_[_0x6184('0x1f')](_0x1db518[_0x6184('0x1e')]);_0x48259d['filters']=_[_0x6184('0x20')](_0x48259d[_0x6184('0x1d')],_0x48259d[_0x6184('0x1e')]);_0x1d017c['attributes']=_['intersection'](_0x48259d[_0x6184('0x1d')],qs[_0x6184('0x21')](_0x1db518['query'][_0x6184('0x21')]));_0x1d017c['attributes']=_0x1d017c[_0x6184('0x22')][_0x6184('0x23')]?_0x1d017c[_0x6184('0x22')]:_0x48259d['model'];if(!_0x1db518['query'][_0x6184('0x24')]('nolimit')){_0x1d017c['limit']=qs[_0x6184('0xf')](_0x1db518['query'][_0x6184('0xf')]);_0x1d017c['offset']=qs[_0x6184('0xd')](_0x1db518[_0x6184('0x1e')]['offset']);}_0x1d017c[_0x6184('0x25')]=qs['sort'](_0x1db518['query'][_0x6184('0x26')]);_0x1d017c[_0x6184('0x27')]=qs[_0x6184('0x28')](_['pick'](_0x1db518[_0x6184('0x1e')],_0x48259d[_0x6184('0x28')]),_0x3f96d5);if(_0x1db518[_0x6184('0x1e')]['filter']){_0x1d017c['where']=_[_0x6184('0x29')](_0x1d017c[_0x6184('0x27')],{'$or':_[_0x6184('0x1a')](_0x3f96d5,function(_0x3ea1af){if(_0x3ea1af[_0x6184('0x2a')]!==_0x6184('0x2b')){var _0x3fb7c6={};_0x3fb7c6[_0x3ea1af[_0x6184('0x17')]]={'$like':'%'+_0x1db518[_0x6184('0x1e')][_0x6184('0x2c')]+'%'};return _0x3fb7c6;}})});}_0x1d017c=_[_0x6184('0x29')]({},_0x1d017c,_0x1db518[_0x6184('0x2d')]);var _0x24dad5={'where':_0x1d017c[_0x6184('0x27')]};return db[_0x6184('0x1b')]['count'](_0x24dad5)[_0x6184('0x14')](function(_0x29e5e9){_0x257096[_0x6184('0x10')]=_0x29e5e9;if(_0x1db518[_0x6184('0x1e')][_0x6184('0x2e')]){_0x1d017c[_0x6184('0x2f')]=[{'all':!![]}];}return db[_0x6184('0x1b')]['findAll'](_0x1d017c);})[_0x6184('0x14')](function(_0x167a8c){_0x257096[_0x6184('0x30')]=_[_0x6184('0x1a')](_0x167a8c,function(_0x2ef894){if(_0x2ef894[_0x6184('0x31')]==='MicrosoftAzure'){var _0x304cb4=encryptor['decryptString'](_0x2ef894[_0x6184('0x32')]);_0x2ef894[_0x6184('0x32')]=maskClientSecret(_0x304cb4);}return _0x2ef894;});return _0x257096;})[_0x6184('0x14')](respondWithFilteredResult(_0x14ad0a,_0x1d017c))[_0x6184('0x33')](handleError(_0x14ad0a,null));};exports[_0x6184('0x34')]=function(_0x479fd5,_0x1ee2ba){var _0x5744ce={'raw':!![],'where':{'id':_0x479fd5[_0x6184('0x35')]['id']}},_0x51bb4c={};_0x51bb4c[_0x6184('0x1d')]=_[_0x6184('0x1f')](db[_0x6184('0x1b')]['rawAttributes']);_0x51bb4c['query']=_[_0x6184('0x1f')](_0x479fd5[_0x6184('0x1e')]);_0x51bb4c['filters']=_[_0x6184('0x20')](_0x51bb4c[_0x6184('0x1d')],_0x51bb4c[_0x6184('0x1e')]);_0x5744ce[_0x6184('0x22')]=_[_0x6184('0x20')](_0x51bb4c[_0x6184('0x1d')],qs[_0x6184('0x21')](_0x479fd5[_0x6184('0x1e')][_0x6184('0x21')]));_0x5744ce[_0x6184('0x22')]=_0x5744ce[_0x6184('0x22')]['length']?_0x5744ce[_0x6184('0x22')]:_0x51bb4c[_0x6184('0x1d')];if(_0x479fd5[_0x6184('0x1e')]['includeAll']){_0x5744ce[_0x6184('0x2f')]=[{'all':!![]}];}_0x5744ce=_[_0x6184('0x29')]({},_0x5744ce,_0x479fd5['options']);return db[_0x6184('0x1b')]['find'](_0x5744ce)['then'](handleEntityNotFound(_0x1ee2ba,null))[_0x6184('0x14')](function(_0x42a4b2){if(_0x42a4b2[_0x6184('0x31')]===_0x6184('0x36')){var _0x344142=encryptor[_0x6184('0x37')](_0x42a4b2[_0x6184('0x32')]);_0x42a4b2[_0x6184('0x32')]=maskClientSecret(_0x344142);}return _0x42a4b2;})['then'](respondWithResult(_0x1ee2ba,null))['catch'](handleError(_0x1ee2ba,null));};exports[_0x6184('0x38')]=function(_0x27e678,_0x38e4d2){if(!_0x27e678[_0x6184('0x39')][_0x6184('0x17')])throw new Error(_0x6184('0x3a'));if(!_0x27e678['body'][_0x6184('0x31')])throw new Error(_0x6184('0x3b'));var _0x1f42b2=db[_0x6184('0x1b')][_0x6184('0x3c')][_0x6184('0x31')][_0x6184('0x3d')];if(!_0x1f42b2[_0x6184('0x3e')](_0x27e678['body'][_0x6184('0x31')]))throw new Error(_0x6184('0x3f')+_0x1f42b2[_0x6184('0x40')](',\x20'));if(_0x27e678['body'][_0x6184('0x31')]===_0x6184('0x36')&&_0x27e678['body'][_0x6184('0x32')]){_0x27e678[_0x6184('0x39')]['data3']=encryptor[_0x6184('0x41')](_0x27e678[_0x6184('0x39')][_0x6184('0x32')]);}return db[_0x6184('0x1b')][_0x6184('0x38')](_0x27e678[_0x6184('0x39')],{})[_0x6184('0x14')](respondWithResult(_0x38e4d2,0xc9))[_0x6184('0x33')](handleError(_0x38e4d2,null));};exports[_0x6184('0x13')]=function(_0x3626d9,_0x5d231b){if(_0x3626d9[_0x6184('0x39')]['id']){delete _0x3626d9[_0x6184('0x39')]['id'];}return db[_0x6184('0x1b')][_0x6184('0x42')]({'where':{'id':_0x3626d9['params']['id']}})[_0x6184('0x14')](handleEntityNotFound(_0x5d231b,null))[_0x6184('0x14')](function(_0xf7e50e){if(_0xf7e50e[_0x6184('0x31')]===_0x6184('0x36')&&_0x3626d9[_0x6184('0x39')]['data3']){_0x3626d9['body'][_0x6184('0x32')]=encryptor[_0x6184('0x41')](_0x3626d9[_0x6184('0x39')]['data3']);}return _0xf7e50e;})[_0x6184('0x14')](saveUpdates(_0x3626d9[_0x6184('0x39')],null))[_0x6184('0x14')](respondWithResult(_0x5d231b,null))[_0x6184('0x33')](handleError(_0x5d231b,null));};exports[_0x6184('0x43')]=function(_0x499b16,_0x3d3641){return db[_0x6184('0x1b')]['find']({'where':{'id':_0x499b16[_0x6184('0x35')]['id']}})[_0x6184('0x14')](handleEntityNotFound(_0x3d3641,null))[_0x6184('0x14')](removeEntity(_0x3d3641,null))[_0x6184('0x33')](handleError(_0x3d3641,null));};exports[_0x6184('0x44')]=function(_0x4a56a3,_0x4d1d7c){return db['CloudProvider'][_0x6184('0x45')]({'where':{'id':_0x4a56a3['params']['id']},'raw':!![]})[_0x6184('0x14')](function(_0x5ed1d4){if(!_0x5ed1d4)return _0x4d1d7c[_0x6184('0x15')](0x194);return{'url':oauth[_0x6184('0x46')](_0x5ed1d4,_0x4a56a3[_0x6184('0x47')]['id'])};})['then'](respondWithResult(_0x4d1d7c,null))[_0x6184('0x33')](handleError(_0x4d1d7c,null));};exports[_0x6184('0x48')]=function(_0xf9554c,_0xb4dd3){var _0x7e08b9=_0xf9554c[_0x6184('0x39')];var _0x74d3a7;var _0x4183d5;if(_0x7e08b9[_0x6184('0x16')])throw _0x7e08b9;redis['get'](_0x7e08b9[_0x6184('0x49')])['then'](function(_0x64fb30){if(!_0x64fb30)throw new Error(_0x6184('0x4a'));_0x74d3a7=JSON['parse'](_0x64fb30);var _0x5ba478=Buffer['from'](_0x7e08b9[_0x6184('0x49')],_0x6184('0x4b'))['toString']('ascii');_0x4183d5=JSON['parse'](_0x5ba478);if(!oauth[_0x6184('0x4c')](_0x7e08b9['id_token'],_0x74d3a7[_0x6184('0x4d')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x6184('0x4e')](_0x7e08b9[_0x6184('0x49')]);return oauth[_0x6184('0x4f')](_0x7e08b9[_0x6184('0x50')],_0x74d3a7);})[_0x6184('0x14')](function(_0x405061){_0x74d3a7['data5']=_0x405061[_0x6184('0x51')];_0x74d3a7[_0x6184('0x52')]=_0x405061[_0x6184('0x53')];return db[_0x6184('0x1b')][_0x6184('0x13')]({'data5':_0x74d3a7['data5'],'data6':_0x74d3a7['data6']},{'where':{'id':_0x74d3a7['id']}});})['then'](function(){oauth[_0x6184('0x54')](_0x74d3a7);socket['emit']('microsoftAuthorization:success',{'id':_0x4183d5['id']});return;})[_0x6184('0x14')](respondWithStatusCode(_0xb4dd3,null))['catch'](function(_0x222e8a){if(_0x4183d5){socket['emit'](_0x6184('0x55'),{'id':_0x4183d5['id']});}if(!_0x74d3a7){logger[_0x6184('0x16')]('Invalid\x20authentication\x20state\x20parameter',_0x222e8a);return _0xb4dd3[_0x6184('0xa')](0x1f4)[_0x6184('0x18')](_0x222e8a[_0x6184('0x56')]);}logger[_0x6184('0x16')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x74d3a7['id'],JSON[_0x6184('0x57')](_0x222e8a));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index cc10bce..ddc1351 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 _0x8bd5=['../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','api','bluebird','request-promise','rimraf'];(function(_0x133199,_0x307e52){var _0x17cfaa=function(_0x59d572){while(--_0x59d572){_0x133199['push'](_0x133199['shift']());}};_0x17cfaa(++_0x307e52);}(_0x8bd5,0x74));var _0x58bd=function(_0x45b9c8,_0x4d6d5a){_0x45b9c8=_0x45b9c8-0x0;var _0x48344f=_0x8bd5[_0x45b9c8];return _0x48344f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x58bd('0x0'));var moment=require('moment');var BPromise=require(_0x58bd('0x1'));var rp=require(_0x58bd('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x58bd('0x3'));var config=require(_0x58bd('0x4'));var attributes=require(_0x58bd('0x5'));module[_0x58bd('0x6')]=function(_0x422069,_0x33bee6){return _0x422069[_0x58bd('0x7')](_0x58bd('0x8'),attributes,{'tableName':_0x58bd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x932f=['api','bluebird','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','util','../../config/logger'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x932f,0x103));var _0xf932=function(_0x5e2301,_0x4d8038){_0x5e2301=_0x5e2301-0x0;var _0x370597=_0x932f[_0x5e2301];return _0x370597;};'use strict';var _=require('lodash');var util=require(_0xf932('0x0'));var logger=require(_0xf932('0x1'))(_0xf932('0x2'));var moment=require('moment');var BPromise=require(_0xf932('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf932('0x4'));module[_0xf932('0x5')]=function(_0x24703e,_0x478159){return _0x24703e[_0xf932('0x6')](_0xf932('0x7'),attributes,{'tableName':_0xf932('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 9e2f9b1..d533e4e 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 _0x9703=['refresh_token','data6','data4','POST','data5','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','decryptString','intervals','bind','findAll','inspect','exports','lodash','jsonwebtoken','moment','ioredis','util','../../components/encryptor','../../config/environment','../../config/logger','api','redis','defaults','localhost','openid','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','replace','{TENANT_ID}','data2','code','id_token','from','stringify','toString','base64','randomBytes','client_id','data1','redirect_uri','response_mode','form_post','scope','nonce','prompt','login','key','value','oauth2/','payload','issuer','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9703,0x144));var _0x3970=function(_0x21cc4e,_0x24a7ac){_0x21cc4e=_0x21cc4e-0x0;var _0x3b7125=_0x9703[_0x21cc4e];return _0x3b7125;};'use strict';var _=require(_0x3970('0x0'));var crypto=require('crypto');var jwt=require(_0x3970('0x1'));var moment=require(_0x3970('0x2'));var Redis=require(_0x3970('0x3'));var rp=require('request-promise');var util=require(_0x3970('0x4'));var encryptor=require(_0x3970('0x5'));var config=require(_0x3970('0x6'));var logger=require(_0x3970('0x7'))(_0x3970('0x8'));var schedule=require('../../config/schedule/cloud-provider');var db=require('../../mysqldb')['db'];config[_0x3970('0x9')]=_[_0x3970('0xa')](config[_0x3970('0x9')],{'host':_0x3970('0xb'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x3970('0xc'),_0x3970('0xd'),_0x3970('0xe'),'offline_access',_0x3970('0xf'),_0x3970('0x10'),_0x3970('0x11')],'Dynamics365':[_0x3970('0xc'),_0x3970('0x12')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x3970('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x57477a){var _0x5cdbfc=_[_0x3970('0x14')](AZURE_AUTH_SCOPES[_0x57477a[_0x3970('0x15')]]);if(_0x57477a[_0x3970('0x15')]===_0x3970('0x16'))_0x5cdbfc[_0x3970('0x17')](_0x57477a[_0x3970('0x18')]+_0x3970('0x19'));return _0x5cdbfc[_0x3970('0x1a')]('\x20');}function getAccessTokenScope(_0xe2e0b9){if(_0xe2e0b9[_0x3970('0x15')]===_0x3970('0x1b'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0xe2e0b9['type']===_0x3970('0x16'))return _0xe2e0b9[_0x3970('0x18')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x5520eb,_0x14309f){var _0x36c792=MICROSOFT_AUTH_URL[_0x3970('0x1c')](_0x3970('0x1d'),_0x5520eb[_0x3970('0x1e')]);var _0x264531=[_0x3970('0x1f'),_0x3970('0x20')];var _0x5205a5=Buffer[_0x3970('0x21')](JSON[_0x3970('0x22')]({'id':_0x14309f}))[_0x3970('0x23')](_0x3970('0x24'));var _0x9d6e30=crypto[_0x3970('0x25')](0x10)['toString']('hex');var _0x50593d=getAuthorizationScopes(_0x5520eb);var _0xe6198c=[{'key':_0x3970('0x26'),'value':_0x5520eb[_0x3970('0x27')]},{'key':'response_type','value':encodeURIComponent(_0x264531[_0x3970('0x1a')]('\x20'))},{'key':_0x3970('0x28'),'value':_0x5520eb['data4']},{'key':_0x3970('0x29'),'value':_0x3970('0x2a')},{'key':_0x3970('0x2b'),'value':encodeURIComponent(_0x50593d)},{'key':'state','value':_0x5205a5},{'key':_0x3970('0x2c'),'value':_0x9d6e30},{'key':_0x3970('0x2d'),'value':_0x3970('0x2e')}];var _0x2cf29c=_0x36c792+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0xe6198c,function(_0x425856){return _0x425856[_0x3970('0x2f')]+'='+_0x425856[_0x3970('0x30')];})['join']('&');_0x5520eb['oauth2Claims']={'issuer':_0x36c792[_0x3970('0x1c')](_0x3970('0x31'),''),'audience':_0x5520eb[_0x3970('0x27')],'state':_0x5205a5,'nonce':_0x9d6e30};redis['set'](_0x5205a5,JSON['stringify'](_0x5520eb));return _0x2cf29c;}function isValidIdToken(_0x42f403,_0x538218){try{var _0x5ea8bd=jwt['decode'](_0x42f403,{'complete':!![]});var _0x489346=_0x5ea8bd[_0x3970('0x32')];if(_0x489346['iss']!==_0x538218[_0x3970('0x33')])return![];if(_0x489346['aud']!==_0x538218[_0x3970('0x34')])return![];if(_0x489346[_0x3970('0x2c')]!==_0x538218[_0x3970('0x2c')])return![];if(moment()[_0x3970('0x35')](moment[_0x3970('0x36')](_0x489346[_0x3970('0x37')])))return![];return!![];}catch(_0x2a8c8d){throw _0x2a8c8d;}}function refreshOauth2MicrosoftAccessToken(_0x114671){return Promise[_0x3970('0x38')]()[_0x3970('0x39')](function(){if(_0x114671[_0x3970('0x3a')])return _0x114671;return db[_0x3970('0x3b')][_0x3970('0x3c')]({'where':{'id':_0x114671['id']},'raw':!![]});})[_0x3970('0x39')](function(_0x4b78f6){var _0x125a4b={'grant_type':_0x3970('0x3d'),'refresh_token':_0x4b78f6[_0x3970('0x3e')],'scope':getAccessTokenScope(_0x4b78f6),'redirect_uri':_0x4b78f6[_0x3970('0x3f')],'client_id':_0x4b78f6[_0x3970('0x27')],'client_secret':encryptor['decryptString'](_0x4b78f6['data3'])};var _0x9ba242={'method':_0x3970('0x40'),'uri':MICROSOFT_AUTH_URL[_0x3970('0x1c')](_0x3970('0x1d'),_0x4b78f6[_0x3970('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x125a4b,'json':!![]};return rp(_0x9ba242);})[_0x3970('0x39')](function(_0x119d4e){_0x114671[_0x3970('0x41')]=_0x119d4e['access_token'];_0x114671['data6']=_0x119d4e[_0x3970('0x3d')];return db[_0x3970('0x3b')][_0x3970('0x42')]({'data5':_0x114671[_0x3970('0x41')],'data6':_0x114671['data6']},{'where':{'id':_0x114671['id']}});})[_0x3970('0x39')](function(){return _0x114671;})[_0x3970('0x43')](function(_0x4cb9c4){logger[_0x3970('0x44')](_0x3970('0x45'),_0x114671['id'],_0x4cb9c4);});}function getOauth2MicrosoftAccessToken(_0x5d642d,_0x4da496){var _0x162bf6={'grant_type':_0x3970('0x46'),'code':_0x5d642d,'scope':getAccessTokenScope(_0x4da496),'redirect_uri':_0x4da496[_0x3970('0x3f')],'client_id':_0x4da496[_0x3970('0x27')],'client_secret':encryptor[_0x3970('0x47')](_0x4da496['data3'])};var _0x22eea2={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x3970('0x1c')]('{TENANT_ID}',_0x4da496[_0x3970('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x162bf6,'json':!![]};return rp(_0x22eea2);}function startRefreshInterval(_0x527ea5){var _0x5a5d6c=schedule[_0x3970('0x48')];if(_0x5a5d6c[_0x527ea5['id']])clearInterval(_0x5a5d6c[_0x527ea5['id']]);_0x5a5d6c[_0x527ea5['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x3970('0x49')](this,{'id':_0x527ea5['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x3970('0x48')]=_0x5a5d6c;}function startAllRefreshIntervals(){return db[_0x3970('0x3b')][_0x3970('0x4a')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x2afb85){var _0x5dc8b7=_0x2afb85[_0x3970('0x14')](function(_0x4724e1){return refreshOauth2MicrosoftAccessToken(_0x4724e1)['then'](function(_0xcbaede){startRefreshInterval(_0xcbaede);});});return Promise['all'](_0x5dc8b7);})[_0x3970('0x43')](function(_0x1ce5c5){var _0x16aaba=_0x1ce5c5?util[_0x3970('0x4b')](_0x1ce5c5,{'showHidden':![],'depth':null}):'';logger[_0x3970('0x44')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x16aaba);});}module[_0x3970('0x4c')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x393a=['openid','profile','email','offline_access','https://outlook.office.com/SMTP.Send','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','replace','{TENANT_ID}','data2','id_token','from','toString','base64','randomBytes','hex','client_id','response_type','redirect_uri','data4','response_mode','form_post','scope','state','nonce','prompt','login','value','oauth2Claims','oauth2/','data1','set','stringify','decode','payload','issuer','isAfter','unix','exp','resolve','then','data3','refresh_token','data6','data5','CloudProvider','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','POST','intervals','bind','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x393a,0x1c9));var _0xa393=function(_0x514038,_0x450ef3){_0x514038=_0x514038-0x0;var _0x589720=_0x393a[_0x514038];return _0x589720;};'use strict';var _=require(_0xa393('0x0'));var crypto=require(_0xa393('0x1'));var jwt=require(_0xa393('0x2'));var moment=require(_0xa393('0x3'));var Redis=require(_0xa393('0x4'));var rp=require(_0xa393('0x5'));var util=require(_0xa393('0x6'));var encryptor=require(_0xa393('0x7'));var config=require(_0xa393('0x8'));var logger=require(_0xa393('0x9'))(_0xa393('0xa'));var schedule=require(_0xa393('0xb'));var db=require(_0xa393('0xc'))['db'];config[_0xa393('0xd')]=_[_0xa393('0xe')](config[_0xa393('0xd')],{'host':_0xa393('0xf'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0xa393('0x10');var AZURE_AUTH_SCOPES={'Outlook365':[_0xa393('0x11'),_0xa393('0x12'),_0xa393('0x13'),_0xa393('0x14'),'https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All',_0xa393('0x15')],'Dynamics365':[_0xa393('0x11'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0xa393('0x16');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x32f0a7){var _0x1a4edd=_[_0xa393('0x17')](AZURE_AUTH_SCOPES[_0x32f0a7[_0xa393('0x18')]]);if(_0x32f0a7[_0xa393('0x18')]===_0xa393('0x19'))_0x1a4edd[_0xa393('0x1a')](_0x32f0a7[_0xa393('0x1b')]+_0xa393('0x1c'));return _0x1a4edd[_0xa393('0x1d')]('\x20');}function getAccessTokenScope(_0x1108be){if(_0x1108be[_0xa393('0x18')]===_0xa393('0x1e'))return _0xa393('0x1f');if(_0x1108be[_0xa393('0x18')]===_0xa393('0x19'))return _0x1108be[_0xa393('0x1b')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x13977d,_0x236901){var _0x27e7de=MICROSOFT_AUTH_URL[_0xa393('0x20')](_0xa393('0x21'),_0x13977d[_0xa393('0x22')]);var _0x3630a2=['code',_0xa393('0x23')];var _0x242117=Buffer[_0xa393('0x24')](JSON['stringify']({'id':_0x236901}))[_0xa393('0x25')](_0xa393('0x26'));var _0x1dbab6=crypto[_0xa393('0x27')](0x10)['toString'](_0xa393('0x28'));var _0x1ad011=getAuthorizationScopes(_0x13977d);var _0x5b746e=[{'key':_0xa393('0x29'),'value':_0x13977d['data1']},{'key':_0xa393('0x2a'),'value':encodeURIComponent(_0x3630a2[_0xa393('0x1d')]('\x20'))},{'key':_0xa393('0x2b'),'value':_0x13977d[_0xa393('0x2c')]},{'key':_0xa393('0x2d'),'value':_0xa393('0x2e')},{'key':_0xa393('0x2f'),'value':encodeURIComponent(_0x1ad011)},{'key':_0xa393('0x30'),'value':_0x242117},{'key':_0xa393('0x31'),'value':_0x1dbab6},{'key':_0xa393('0x32'),'value':_0xa393('0x33')}];var _0x387025=_0x27e7de+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xa393('0x17')](_0x5b746e,function(_0x58909f){return _0x58909f['key']+'='+_0x58909f[_0xa393('0x34')];})[_0xa393('0x1d')]('&');_0x13977d[_0xa393('0x35')]={'issuer':_0x27e7de[_0xa393('0x20')](_0xa393('0x36'),''),'audience':_0x13977d[_0xa393('0x37')],'state':_0x242117,'nonce':_0x1dbab6};redis[_0xa393('0x38')](_0x242117,JSON[_0xa393('0x39')](_0x13977d));return _0x387025;}function isValidIdToken(_0x28645c,_0x1ed17e){try{var _0x480d17=jwt[_0xa393('0x3a')](_0x28645c,{'complete':!![]});var _0x5e2415=_0x480d17[_0xa393('0x3b')];if(_0x5e2415['iss']!==_0x1ed17e[_0xa393('0x3c')])return![];if(_0x5e2415['aud']!==_0x1ed17e['audience'])return![];if(_0x5e2415['nonce']!==_0x1ed17e[_0xa393('0x31')])return![];if(moment()[_0xa393('0x3d')](moment[_0xa393('0x3e')](_0x5e2415[_0xa393('0x3f')])))return![];return!![];}catch(_0x334937){throw _0x334937;}}function refreshOauth2MicrosoftAccessToken(_0x32e6d3){return Promise[_0xa393('0x40')]()[_0xa393('0x41')](function(){if(_0x32e6d3[_0xa393('0x42')])return _0x32e6d3;return db['CloudProvider']['findOne']({'where':{'id':_0x32e6d3['id']},'raw':!![]});})[_0xa393('0x41')](function(_0x1bcfdc){var _0x3ef367={'grant_type':_0xa393('0x43'),'refresh_token':_0x1bcfdc[_0xa393('0x44')],'scope':getAccessTokenScope(_0x1bcfdc),'redirect_uri':_0x1bcfdc['data4'],'client_id':_0x1bcfdc['data1'],'client_secret':encryptor['decryptString'](_0x1bcfdc[_0xa393('0x42')])};var _0x328720={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xa393('0x20')](_0xa393('0x21'),_0x1bcfdc['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3ef367,'json':!![]};return rp(_0x328720);})[_0xa393('0x41')](function(_0x4ea550){_0x32e6d3[_0xa393('0x45')]=_0x4ea550['access_token'];_0x32e6d3[_0xa393('0x44')]=_0x4ea550[_0xa393('0x43')];return db[_0xa393('0x46')]['update']({'data5':_0x32e6d3[_0xa393('0x45')],'data6':_0x32e6d3[_0xa393('0x44')]},{'where':{'id':_0x32e6d3['id']}});})['then'](function(){return _0x32e6d3;})['catch'](function(_0x422721){logger[_0xa393('0x47')](_0xa393('0x48'),_0x32e6d3['id'],_0x422721);});}function getOauth2MicrosoftAccessToken(_0x2caad1,_0x1f2854){var _0x9df3c3={'grant_type':_0xa393('0x49'),'code':_0x2caad1,'scope':getAccessTokenScope(_0x1f2854),'redirect_uri':_0x1f2854['data4'],'client_id':_0x1f2854[_0xa393('0x37')],'client_secret':encryptor['decryptString'](_0x1f2854[_0xa393('0x42')])};var _0x4d30dc={'method':_0xa393('0x4a'),'uri':MICROSOFT_AUTH_URL[_0xa393('0x20')](_0xa393('0x21'),_0x1f2854[_0xa393('0x22')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x9df3c3,'json':!![]};return rp(_0x4d30dc);}function startRefreshInterval(_0x58832b){var _0x343430=schedule[_0xa393('0x4b')];if(_0x343430[_0x58832b['id']])clearInterval(_0x343430[_0x58832b['id']]);_0x343430[_0x58832b['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xa393('0x4c')](this,{'id':_0x58832b['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xa393('0x4b')]=_0x343430;}function startAllRefreshIntervals(){return db['CloudProvider']['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xa393('0x41')](function(_0x3bd3e5){var _0x804b2c=_0x3bd3e5['map'](function(_0xd11ff8){return refreshOauth2MicrosoftAccessToken(_0xd11ff8)[_0xa393('0x41')](function(_0x155909){startRefreshInterval(_0x155909);});});return Promise['all'](_0x804b2c);})['catch'](function(_0x631962){var _0x213204=_0x631962?util['inspect'](_0x631962,{'showHidden':![],'depth':null}):'';logger['error'](_0xa393('0x4d'),_0x213204);});}module[_0xa393('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 a5bcf02..dd452cb 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 _0xd5f9=['../../config/environment','then','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x41561b,_0x1a4792){var _0x2fa151=function(_0x12bfee){while(--_0x12bfee){_0x41561b['push'](_0x41561b['shift']());}};_0x2fa151(++_0x1a4792);}(_0xd5f9,0x1f1));var _0x9d5f=function(_0x3e10c0,_0x385bdc){_0x3e10c0=_0x3e10c0-0x0;var _0x2fb415=_0xd5f9[_0x3e10c0];return _0x2fb415;};'use strict';var _=require(_0x9d5f('0x0'));var util=require(_0x9d5f('0x1'));var moment=require(_0x9d5f('0x2'));var BPromise=require(_0x9d5f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9d5f('0x4'));var db=require(_0x9d5f('0x5'))['db'];var utils=require(_0x9d5f('0x6'));var logger=require(_0x9d5f('0x7'))(_0x9d5f('0x8'));var config=require(_0x9d5f('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1dca4b,_0x2e1c4e,_0x4ac60a){return new BPromise(function(_0x402a35,_0x255389){return client['request'](_0x1dca4b,_0x4ac60a)[_0x9d5f('0xa')](function(_0x241166){logger['info'](_0x9d5f('0xb'),_0x2e1c4e,'request\x20sent');logger[_0x9d5f('0xc')](_0x9d5f('0xd'),_0x2e1c4e,_0x9d5f('0xe'),JSON[_0x9d5f('0xf')](_0x241166));if(_0x241166[_0x9d5f('0x10')]){if(_0x241166['error'][_0x9d5f('0x11')]===0x1f4){logger[_0x9d5f('0x10')](_0x9d5f('0xb'),_0x2e1c4e,_0x241166[_0x9d5f('0x10')][_0x9d5f('0x12')]);return _0x255389(_0x241166[_0x9d5f('0x10')][_0x9d5f('0x12')]);}logger[_0x9d5f('0x10')](_0x9d5f('0xb'),_0x2e1c4e,_0x241166['error']['message']);return _0x402a35(_0x241166['error']['message']);}else{logger[_0x9d5f('0x13')](_0x9d5f('0xb'),_0x2e1c4e,'request\x20sent');_0x402a35(_0x241166[_0x9d5f('0x14')][_0x9d5f('0x12')]);}})[_0x9d5f('0x15')](function(_0x3a9220){logger[_0x9d5f('0x10')]('CloudProvider,\x20%s,\x20%s',_0x2e1c4e,_0x3a9220);_0x255389(_0x3a9220);});});} \ No newline at end of file +var _0xb19a=['CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x56801e,_0x1bf4bc){var _0x54e02d=function(_0x4a5a34){while(--_0x4a5a34){_0x56801e['push'](_0x56801e['shift']());}};_0x54e02d(++_0x1bf4bc);}(_0xb19a,0xd0));var _0xab19=function(_0x3612ca,_0x23946f){_0x3612ca=_0x3612ca-0x0;var _0x494fc5=_0xb19a[_0x3612ca];return _0x494fc5;};'use strict';var _=require(_0xab19('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xab19('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab19('0x2'))['db'];var utils=require(_0xab19('0x3'));var logger=require(_0xab19('0x4'))(_0xab19('0x5'));var config=require(_0xab19('0x6'));var jayson=require(_0xab19('0x7'));var client=jayson[_0xab19('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9d5c1d,_0x131291,_0x59d282){return new BPromise(function(_0x300038,_0x479d0b){return client[_0xab19('0x9')](_0x9d5c1d,_0x59d282)[_0xab19('0xa')](function(_0x2c6a67){logger[_0xab19('0xb')](_0xab19('0xc'),_0x131291,_0xab19('0xd'));logger[_0xab19('0xe')](_0xab19('0xf'),_0x131291,_0xab19('0xd'),JSON[_0xab19('0x10')](_0x2c6a67));if(_0x2c6a67[_0xab19('0x11')]){if(_0x2c6a67[_0xab19('0x11')]['code']===0x1f4){logger['error'](_0xab19('0xc'),_0x131291,_0x2c6a67['error'][_0xab19('0x12')]);return _0x479d0b(_0x2c6a67[_0xab19('0x11')][_0xab19('0x12')]);}logger[_0xab19('0x11')](_0xab19('0xc'),_0x131291,_0x2c6a67[_0xab19('0x11')][_0xab19('0x12')]);return _0x300038(_0x2c6a67['error'][_0xab19('0x12')]);}else{logger[_0xab19('0xb')]('CloudProvider,\x20%s,\x20%s',_0x131291,_0xab19('0xd'));_0x300038(_0x2c6a67[_0xab19('0x13')]['message']);}})['catch'](function(_0x2284b8){logger[_0xab19('0x11')](_0xab19('0xc'),_0x131291,_0x2284b8);_0x479d0b(_0x2284b8);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 6138f71..c0e2dee 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 _0x7a54=['isAuthenticated','/:id','show','post','create','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','exports','express','Router','../../components/auth/service','get'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x7a54,0x106));var _0x47a5=function(_0x39acaa,_0x1028a4){_0x39acaa=_0x39acaa-0x0;var _0x36ae79=_0x7a54[_0x39acaa];return _0x36ae79;};'use strict';var express=require(_0x47a5('0x0'));var router=express[_0x47a5('0x1')]();var auth=require(_0x47a5('0x2'));var controller=require('./cloudProvider.controller');router[_0x47a5('0x3')]('/',auth[_0x47a5('0x4')](),controller['index']);router[_0x47a5('0x3')](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller[_0x47a5('0x6')]);router[_0x47a5('0x7')]('/',auth['isAuthenticated'](),controller[_0x47a5('0x8')]);router['put'](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller['update']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x47a5('0x3')](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router['post']('/oauth2/microsoft/callback',controller[_0x47a5('0xc')]);module[_0x47a5('0xd')]=router; \ No newline at end of file +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(_0x4404ff,_0x13d7a9){var _0x5e7b19=function(_0x13847a){while(--_0x13847a){_0x4404ff['push'](_0x4404ff['shift']());}};_0x5e7b19(++_0x13d7a9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3c762a,_0x5bef8e){_0x3c762a=_0x3c762a-0x0;var _0x4a3c2a=_0x5f2f[_0x3c762a];return _0x4a3c2a;};'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 diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 757e78a..22fe1cf 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 _0x54f3=['exports','STRING','name'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x54f3,0x120));var _0x354f=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x54f3[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require('sequelize');module[_0x354f('0x0')]={'name':{'type':Sequelize[_0x354f('0x1')],'unique':_0x354f('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x354f('0x1')]},'companyId':{'type':Sequelize[_0x354f('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x354f('0x1')]},'type':{'type':Sequelize[_0x354f('0x1')]},'street':{'type':Sequelize[_0x354f('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x354f('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x354f('0x1')]},'sStreet':{'type':Sequelize[_0x354f('0x1')]},'sPostalCode':{'type':Sequelize[_0x354f('0x1')]},'sCity':{'type':Sequelize[_0x354f('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x354f('0x1')]}}; \ No newline at end of file +var _0x192f=['sequelize','STRING'];(function(_0x3227c2,_0x22390f){var _0x1dc977=function(_0x34c591){while(--_0x34c591){_0x3227c2['push'](_0x3227c2['shift']());}};_0x1dc977(++_0x22390f);}(_0x192f,0xd6));var _0xf192=function(_0x1256d6,_0x5dc965){_0x1256d6=_0x1256d6-0x0;var _0x70d3fb=_0x192f[_0x1256d6];return _0x70d3fb;};'use strict';var Sequelize=require(_0xf192('0x0'));module['exports']={'name':{'type':Sequelize[_0xf192('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xf192('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xf192('0x1')]},'fax':{'type':Sequelize[_0xf192('0x1')]},'type':{'type':Sequelize[_0xf192('0x1')]},'street':{'type':Sequelize[_0xf192('0x1')]},'postalCode':{'type':Sequelize[_0xf192('0x1')]},'city':{'type':Sequelize[_0xf192('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xf192('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xf192('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xf192('0x1')]},'sCity':{'type':Sequelize[_0xf192('0x1')]},'sCountry':{'type':Sequelize[_0xf192('0x1')]},'description':{'type':Sequelize[_0xf192('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 6047e06..3b669ba 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 _0xc8d3=['count','limit','set','Content-Range','save','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','index','describe','model','keys','query','filters','intersection','fields','attributes','length','order','sort','where','pick','merge','filter','options','CmCompany','includeAll','include','catch','show','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','omit','ids','findOne','map','getContacts','hasOwnProperty','nolimit','eml-format','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x2162e0,_0xd18181){var _0x162d05=function(_0x421403){while(--_0x421403){_0x2162e0['push'](_0x2162e0['shift']());}};_0x162d05(++_0xd18181);}(_0xc8d3,0x19c));var _0x3c8d=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0xc8d3[_0x2d89ce];return _0x3fad10;};'use strict';var emlformat=require(_0x3c8d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3c8d('0x1'));var rp=require(_0x3c8d('0x2'));var moment=require(_0x3c8d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3c8d('0x4'));var util=require(_0x3c8d('0x5'));var path=require('path');var sox=require(_0x3c8d('0x6'));var csv=require('to-csv');var ejs=require(_0x3c8d('0x7'));var fs=require('fs');var fs_extra=require(_0x3c8d('0x8'));var _=require(_0x3c8d('0x9'));var squel=require(_0x3c8d('0xa'));var crypto=require(_0x3c8d('0xb'));var jsforce=require(_0x3c8d('0xc'));var deskjs=require(_0x3c8d('0xd'));var toCsv=require(_0x3c8d('0xe'));var querystring=require(_0x3c8d('0xf'));var Papa=require('papaparse');var Redis=require(_0x3c8d('0x10'));var authService=require(_0x3c8d('0x11'));var qs=require(_0x3c8d('0x12'));var as=require(_0x3c8d('0x13'));var hardwareService=require(_0x3c8d('0x14'));var logger=require(_0x3c8d('0x15'))(_0x3c8d('0x16'));var utils=require(_0x3c8d('0x17'));var config=require(_0x3c8d('0x18'));var licenseUtil=require(_0x3c8d('0x19'));var db=require(_0x3c8d('0x1a'))['db'];function respondWithStatusCode(_0x1668be,_0x276da0){_0x276da0=_0x276da0||0xcc;return function(_0x2fb365){if(_0x2fb365){return _0x1668be[_0x3c8d('0x1b')](_0x276da0);}return _0x1668be[_0x3c8d('0x1c')](_0x276da0)[_0x3c8d('0x1d')]();};}function respondWithResult(_0x336afa,_0x5195d7){_0x5195d7=_0x5195d7||0xc8;return function(_0x37ab99){if(_0x37ab99){return _0x336afa[_0x3c8d('0x1c')](_0x5195d7)[_0x3c8d('0x1e')](_0x37ab99);}};}function respondWithFilteredResult(_0x31638e,_0x203a9b){return function(_0x36b170){if(_0x36b170){var _0x2121f1=typeof _0x203a9b[_0x3c8d('0x1f')]===_0x3c8d('0x20')&&typeof _0x203a9b['limit']===_0x3c8d('0x20');var _0xf02acf=_0x36b170[_0x3c8d('0x21')];var _0x21159c=_0x2121f1?0x0:_0x203a9b[_0x3c8d('0x1f')];var _0x234cf5=_0x2121f1?_0x36b170[_0x3c8d('0x21')]:_0x203a9b[_0x3c8d('0x1f')]+_0x203a9b[_0x3c8d('0x22')];var _0x4e0502;if(_0x234cf5>=_0xf02acf){_0x234cf5=_0xf02acf;_0x4e0502=0xc8;}else{_0x4e0502=0xce;}_0x31638e[_0x3c8d('0x1c')](_0x4e0502);return _0x31638e[_0x3c8d('0x23')](_0x3c8d('0x24'),_0x21159c+'-'+_0x234cf5+'/'+_0xf02acf)[_0x3c8d('0x1e')](_0x36b170);}return null;};}function patchUpdates(_0x1f9cc2){return function(_0x4a01e9){try{jsonpatch['apply'](_0x4a01e9,_0x1f9cc2,!![]);}catch(_0x4a510d){return BPromise['reject'](_0x4a510d);}return _0x4a01e9[_0x3c8d('0x25')]();};}function saveUpdates(_0x186e7a,_0x1b6cfc){return function(_0x52e249){if(_0x52e249){return _0x52e249[_0x3c8d('0x26')](_0x186e7a)[_0x3c8d('0x27')](function(_0x833bfb){return _0x833bfb;});}return null;};}function removeEntity(_0x2a71a6,_0x2da356){return function(_0x5330bc){if(_0x5330bc){return _0x5330bc[_0x3c8d('0x28')]()[_0x3c8d('0x27')](function(){var _0x5489d8=_0x5330bc[_0x3c8d('0x29')]({'plain':!![]});var _0x3803c8=_0x3c8d('0x2a');return db[_0x3c8d('0x2b')][_0x3c8d('0x28')]({'where':{'type':_0x3803c8,'resourceId':_0x5489d8['id']}})[_0x3c8d('0x27')](function(){return _0x5330bc;});})[_0x3c8d('0x27')](function(){_0x2a71a6[_0x3c8d('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cd0c8,_0x15e539){return function(_0x2bebdf){if(!_0x2bebdf){_0x4cd0c8[_0x3c8d('0x1b')](0x194);}return _0x2bebdf;};}function handleError(_0x5d9596,_0x1b3daf){_0x1b3daf=_0x1b3daf||0x1f4;return function(_0xd31828){logger[_0x3c8d('0x2c')](_0xd31828[_0x3c8d('0x2d')]);if(_0xd31828[_0x3c8d('0x2e')]){delete _0xd31828['name'];}_0x5d9596[_0x3c8d('0x1c')](_0x1b3daf)['send'](_0xd31828);};}exports[_0x3c8d('0x2f')]=function(_0x11d7f,_0x1fd621){var _0x2c0d0a={},_0x40d36b={},_0x25e0bb={'count':0x0,'rows':[]};return db['CmCompany'][_0x3c8d('0x30')]()[_0x3c8d('0x27')](function(_0x64437e){_0x40d36b[_0x3c8d('0x31')]=_[_0x3c8d('0x32')](_0x64437e);_0x40d36b['query']=_[_0x3c8d('0x32')](_0x11d7f[_0x3c8d('0x33')]);_0x40d36b[_0x3c8d('0x34')]=_['intersection'](_0x40d36b[_0x3c8d('0x31')],_0x40d36b[_0x3c8d('0x33')]);_0x2c0d0a['attributes']=_[_0x3c8d('0x35')](_0x40d36b[_0x3c8d('0x31')],qs[_0x3c8d('0x36')](_0x11d7f[_0x3c8d('0x33')][_0x3c8d('0x36')]));_0x2c0d0a[_0x3c8d('0x37')]=_0x2c0d0a[_0x3c8d('0x37')][_0x3c8d('0x38')]?_0x2c0d0a[_0x3c8d('0x37')]:_0x40d36b[_0x3c8d('0x31')];if(!_0x11d7f['query']['hasOwnProperty']('nolimit')){_0x2c0d0a[_0x3c8d('0x22')]=qs['limit'](_0x11d7f['query'][_0x3c8d('0x22')]);_0x2c0d0a['offset']=qs[_0x3c8d('0x1f')](_0x11d7f['query'][_0x3c8d('0x1f')]);}_0x2c0d0a[_0x3c8d('0x39')]=qs[_0x3c8d('0x3a')](_0x11d7f['query'][_0x3c8d('0x3a')]);_0x2c0d0a[_0x3c8d('0x3b')]=qs['filters'](_[_0x3c8d('0x3c')](_0x11d7f['query'],_0x40d36b['filters']),_0x64437e);if(_0x11d7f[_0x3c8d('0x33')]['filter']){_0x2c0d0a[_0x3c8d('0x3b')]=_[_0x3c8d('0x3d')](_0x2c0d0a[_0x3c8d('0x3b')],{'$or':_['map'](_0x2c0d0a[_0x3c8d('0x37')],function(_0x349918){var _0x5952f5={};_0x5952f5[_0x349918]={'$like':'%'+_0x11d7f[_0x3c8d('0x33')][_0x3c8d('0x3e')]+'%'};return _0x5952f5;})});}_0x2c0d0a=_[_0x3c8d('0x3d')]({},_0x2c0d0a,_0x11d7f[_0x3c8d('0x3f')]);var _0x4ee8be={'where':_0x2c0d0a[_0x3c8d('0x3b')]};return db[_0x3c8d('0x40')]['count'](_0x4ee8be)['then'](function(_0x2a80e3){_0x25e0bb[_0x3c8d('0x21')]=_0x2a80e3;if(_0x11d7f[_0x3c8d('0x33')][_0x3c8d('0x41')]){_0x2c0d0a[_0x3c8d('0x42')]=[{'all':!![]}];}return db[_0x3c8d('0x40')]['findAll'](_0x2c0d0a);})['then'](function(_0x528018){_0x25e0bb['rows']=_0x528018;return _0x25e0bb;})['then'](respondWithFilteredResult(_0x1fd621,_0x2c0d0a))[_0x3c8d('0x43')](handleError(_0x1fd621,null));})[_0x3c8d('0x43')](handleError(_0x1fd621,null));};exports[_0x3c8d('0x44')]=function(_0x3320e7,_0x220ecb){var _0x505548={'raw':![],'where':{'id':_0x3320e7[_0x3c8d('0x45')]['id']}},_0x3f5e76={};_0x3f5e76[_0x3c8d('0x31')]=_[_0x3c8d('0x32')](db[_0x3c8d('0x40')][_0x3c8d('0x46')]);_0x3f5e76['query']=_[_0x3c8d('0x32')](_0x3320e7[_0x3c8d('0x33')]);_0x3f5e76[_0x3c8d('0x34')]=_[_0x3c8d('0x35')](_0x3f5e76[_0x3c8d('0x31')],_0x3f5e76['query']);_0x505548[_0x3c8d('0x37')]=_['intersection'](_0x3f5e76['model'],qs['fields'](_0x3320e7[_0x3c8d('0x33')][_0x3c8d('0x36')]));_0x505548[_0x3c8d('0x37')]=_0x505548[_0x3c8d('0x37')]['length']?_0x505548['attributes']:_0x3f5e76['model'];if(_0x3320e7[_0x3c8d('0x33')][_0x3c8d('0x41')]){_0x505548[_0x3c8d('0x42')]=[{'all':!![]}];}_0x505548=_['merge']({},_0x505548,_0x3320e7[_0x3c8d('0x3f')]);return db['CmCompany'][_0x3c8d('0x47')](_0x505548)['then'](handleEntityNotFound(_0x220ecb,null))[_0x3c8d('0x27')](respondWithResult(_0x220ecb,null))[_0x3c8d('0x43')](handleError(_0x220ecb,null));};exports[_0x3c8d('0x48')]=function(_0x54825b,_0x422445){return db[_0x3c8d('0x40')][_0x3c8d('0x48')](_0x54825b[_0x3c8d('0x49')],{})[_0x3c8d('0x27')](function(_0x5830a6){var _0x1305ba=_0x54825b['user'][_0x3c8d('0x29')]({'plain':!![]});if(!_0x1305ba)throw new Error(_0x3c8d('0x4a'));if(_0x1305ba[_0x3c8d('0x4b')]==='user'){var _0xde7bd1=_0x5830a6[_0x3c8d('0x29')]({'plain':!![]});var _0x460f30=_0x3c8d('0x2a');return db[_0x3c8d('0x4c')][_0x3c8d('0x47')]({'where':{'name':_0x460f30,'userProfileId':_0x1305ba[_0x3c8d('0x4d')]},'raw':!![]})[_0x3c8d('0x27')](function(_0x2a1b67){if(_0x2a1b67&&_0x2a1b67[_0x3c8d('0x4e')]===0x0){return db[_0x3c8d('0x2b')][_0x3c8d('0x48')]({'name':_0xde7bd1[_0x3c8d('0x2e')],'resourceId':_0xde7bd1['id'],'type':_0x2a1b67[_0x3c8d('0x2e')],'sectionId':_0x2a1b67['id']},{})[_0x3c8d('0x27')](function(){return _0x5830a6;});}else{return _0x5830a6;}})[_0x3c8d('0x43')](function(_0x26f45a){logger['error'](_0x3c8d('0x4f'),_0x26f45a);throw _0x26f45a;});}return _0x5830a6;})[_0x3c8d('0x27')](respondWithResult(_0x422445,0xc9))['catch'](handleError(_0x422445,null));};exports[_0x3c8d('0x26')]=function(_0x5a3897,_0x4c182f){if(_0x5a3897[_0x3c8d('0x49')]['id']){delete _0x5a3897[_0x3c8d('0x49')]['id'];}return db[_0x3c8d('0x40')][_0x3c8d('0x47')]({'where':{'id':_0x5a3897[_0x3c8d('0x45')]['id']}})[_0x3c8d('0x27')](handleEntityNotFound(_0x4c182f,null))[_0x3c8d('0x27')](saveUpdates(_0x5a3897['body'],null))['then'](respondWithResult(_0x4c182f,null))[_0x3c8d('0x43')](handleError(_0x4c182f,null));};exports[_0x3c8d('0x28')]=function(_0x303bbc,_0x5d8c95){return db['CmCompany'][_0x3c8d('0x47')]({'where':{'id':_0x303bbc[_0x3c8d('0x45')]['id']}})[_0x3c8d('0x27')](handleEntityNotFound(_0x5d8c95,null))[_0x3c8d('0x27')](removeEntity(_0x5d8c95,null))[_0x3c8d('0x43')](handleError(_0x5d8c95,null));};exports[_0x3c8d('0x30')]=function(_0x1df4f2,_0x5764f9){return db[_0x3c8d('0x40')][_0x3c8d('0x30')]()[_0x3c8d('0x27')](respondWithResult(_0x5764f9,null))['catch'](handleError(_0x5764f9,null));};exports[_0x3c8d('0x50')]=function(_0x3e3318,_0xf84863,_0x4ea1ec){return db[_0x3c8d('0x51')]['find']({'where':{'id':_0x3e3318[_0x3c8d('0x45')]['id']}})[_0x3c8d('0x27')](handleEntityNotFound(_0xf84863,null))[_0x3c8d('0x27')](function(_0x1b8fbc){if(_0x1b8fbc){return _0x1b8fbc[_0x3c8d('0x50')](_0x3e3318[_0x3c8d('0x49')]['ids'],_[_0x3c8d('0x52')](_0x3e3318[_0x3c8d('0x49')],[_0x3c8d('0x53'),'id'])||{});}})[_0x3c8d('0x27')](respondWithResult(_0xf84863,null))[_0x3c8d('0x43')](handleError(_0xf84863,null));};exports['getContacts']=function(_0x5e80c9,_0xefad3c,_0x523645){var _0x3f8479={};var _0x171cb4={};var _0x2429cf;var _0x3d8fa2;return db[_0x3c8d('0x40')][_0x3c8d('0x54')]({'where':{'id':_0x5e80c9[_0x3c8d('0x45')]['id']}})[_0x3c8d('0x27')](handleEntityNotFound(_0xefad3c,null))[_0x3c8d('0x27')](function(_0x297b26){if(_0x297b26){_0x2429cf=_0x297b26;_0x171cb4['model']=_[_0x3c8d('0x32')](db[_0x3c8d('0x51')][_0x3c8d('0x46')]);_0x171cb4['query']=_[_0x3c8d('0x32')](_0x5e80c9[_0x3c8d('0x33')]);_0x171cb4['filters']=_['intersection'](_0x171cb4[_0x3c8d('0x31')],_0x171cb4['query']);_0x3f8479[_0x3c8d('0x37')]=_[_0x3c8d('0x35')](_0x171cb4['model'],qs[_0x3c8d('0x36')](_0x5e80c9[_0x3c8d('0x33')][_0x3c8d('0x36')]));_0x3f8479[_0x3c8d('0x37')]=_0x3f8479[_0x3c8d('0x37')]['length']?_0x3f8479[_0x3c8d('0x37')]:_0x171cb4[_0x3c8d('0x31')];_0x3f8479[_0x3c8d('0x39')]=qs[_0x3c8d('0x3a')](_0x5e80c9['query'][_0x3c8d('0x3a')]);_0x3f8479[_0x3c8d('0x3b')]=qs['filters'](_['pick'](_0x5e80c9[_0x3c8d('0x33')],_0x171cb4[_0x3c8d('0x34')]));if(_0x5e80c9[_0x3c8d('0x33')][_0x3c8d('0x3e')]){_0x3f8479[_0x3c8d('0x3b')]=_[_0x3c8d('0x3d')](_0x3f8479[_0x3c8d('0x3b')],{'$or':_[_0x3c8d('0x55')](_0x3f8479[_0x3c8d('0x37')],function(_0x2abc8f){var _0x27f5b8={};_0x27f5b8[_0x2abc8f]={'$like':'%'+_0x5e80c9['query']['filter']+'%'};return _0x27f5b8;})});}_0x3f8479=_[_0x3c8d('0x3d')]({},_0x3f8479,_0x5e80c9[_0x3c8d('0x3f')]);return _0x2429cf[_0x3c8d('0x56')](_0x3f8479);}})[_0x3c8d('0x27')](function(_0x1c90fa){if(_0x1c90fa){_0x3d8fa2=_0x1c90fa[_0x3c8d('0x38')];if(!_0x5e80c9[_0x3c8d('0x33')][_0x3c8d('0x57')](_0x3c8d('0x58'))){_0x3f8479['limit']=qs[_0x3c8d('0x22')](_0x5e80c9[_0x3c8d('0x33')]['limit']);_0x3f8479[_0x3c8d('0x1f')]=qs[_0x3c8d('0x1f')](_0x5e80c9[_0x3c8d('0x33')]['offset']);}return _0x2429cf[_0x3c8d('0x56')](_0x3f8479);}})[_0x3c8d('0x27')](function(_0x5cb35e){if(_0x5cb35e){return _0x5cb35e?{'count':_0x3d8fa2,'rows':_0x5cb35e}:null;}})[_0x3c8d('0x27')](respondWithResult(_0xefad3c,null))['catch'](handleError(_0xefad3c,null));}; \ No newline at end of file +var _0x3c2a=['save','then','destroy','get','Companies','stack','send','index','CmCompany','describe','model','keys','query','intersection','attributes','fields','length','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','params','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','name','error','update','CmContact','ids','omit','getContacts','map','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','apply','reject'];(function(_0x7413e,_0x57af5b){var _0x331148=function(_0x2ce64f){while(--_0x2ce64f){_0x7413e['push'](_0x7413e['shift']());}};_0x331148(++_0x57af5b);}(_0x3c2a,0xd2));var _0xa3c2=function(_0x449afc,_0xc77bc9){_0x449afc=_0x449afc-0x0;var _0x166e11=_0x3c2a[_0x449afc];return _0x166e11;};'use strict';var emlformat=require(_0xa3c2('0x0'));var rimraf=require(_0xa3c2('0x1'));var zipdir=require(_0xa3c2('0x2'));var jsonpatch=require(_0xa3c2('0x3'));var rp=require(_0xa3c2('0x4'));var moment=require(_0xa3c2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa3c2('0x6'));var util=require('util');var path=require('path');var sox=require(_0xa3c2('0x7'));var csv=require(_0xa3c2('0x8'));var ejs=require(_0xa3c2('0x9'));var fs=require('fs');var fs_extra=require(_0xa3c2('0xa'));var _=require('lodash');var squel=require(_0xa3c2('0xb'));var crypto=require(_0xa3c2('0xc'));var jsforce=require(_0xa3c2('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa3c2('0xe'));var Papa=require(_0xa3c2('0xf'));var Redis=require(_0xa3c2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa3c2('0x11'));var as=require(_0xa3c2('0x12'));var hardwareService=require(_0xa3c2('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xa3c2('0x14'));var config=require(_0xa3c2('0x15'));var licenseUtil=require(_0xa3c2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fe760,_0x308f19){_0x308f19=_0x308f19||0xcc;return function(_0x3af865){if(_0x3af865){return _0x4fe760[_0xa3c2('0x17')](_0x308f19);}return _0x4fe760[_0xa3c2('0x18')](_0x308f19)[_0xa3c2('0x19')]();};}function respondWithResult(_0x76d68f,_0x1d19df){_0x1d19df=_0x1d19df||0xc8;return function(_0x1dee63){if(_0x1dee63){return _0x76d68f[_0xa3c2('0x18')](_0x1d19df)[_0xa3c2('0x1a')](_0x1dee63);}};}function respondWithFilteredResult(_0x2adbc5,_0x1c6a8a){return function(_0x200873){if(_0x200873){var _0x204cfa=typeof _0x1c6a8a['offset']===_0xa3c2('0x1b')&&typeof _0x1c6a8a['limit']===_0xa3c2('0x1b');var _0x3b3c8c=_0x200873[_0xa3c2('0x1c')];var _0x34632f=_0x204cfa?0x0:_0x1c6a8a[_0xa3c2('0x1d')];var _0x319a71=_0x204cfa?_0x200873[_0xa3c2('0x1c')]:_0x1c6a8a[_0xa3c2('0x1d')]+_0x1c6a8a[_0xa3c2('0x1e')];var _0x248b00;if(_0x319a71>=_0x3b3c8c){_0x319a71=_0x3b3c8c;_0x248b00=0xc8;}else{_0x248b00=0xce;}_0x2adbc5[_0xa3c2('0x18')](_0x248b00);return _0x2adbc5['set']('Content-Range',_0x34632f+'-'+_0x319a71+'/'+_0x3b3c8c)[_0xa3c2('0x1a')](_0x200873);}return null;};}function patchUpdates(_0x39fd47){return function(_0x2f30d1){try{jsonpatch[_0xa3c2('0x1f')](_0x2f30d1,_0x39fd47,!![]);}catch(_0xad598b){return BPromise[_0xa3c2('0x20')](_0xad598b);}return _0x2f30d1[_0xa3c2('0x21')]();};}function saveUpdates(_0x2d2fcb,_0x51d686){return function(_0x994b3b){if(_0x994b3b){return _0x994b3b['update'](_0x2d2fcb)[_0xa3c2('0x22')](function(_0x57458e){return _0x57458e;});}return null;};}function removeEntity(_0x20b0fa,_0x2809da){return function(_0xcc1f3a){if(_0xcc1f3a){return _0xcc1f3a[_0xa3c2('0x23')]()[_0xa3c2('0x22')](function(){var _0x31bf95=_0xcc1f3a[_0xa3c2('0x24')]({'plain':!![]});var _0x4daa46=_0xa3c2('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x4daa46,'resourceId':_0x31bf95['id']}})[_0xa3c2('0x22')](function(){return _0xcc1f3a;});})[_0xa3c2('0x22')](function(){_0x20b0fa[_0xa3c2('0x18')](0xcc)[_0xa3c2('0x19')]();});}};}function handleEntityNotFound(_0x4281c5,_0x1cce99){return function(_0x53c0dc){if(!_0x53c0dc){_0x4281c5['sendStatus'](0x194);}return _0x53c0dc;};}function handleError(_0x34eed4,_0x10c8c3){_0x10c8c3=_0x10c8c3||0x1f4;return function(_0x5ef712){logger['error'](_0x5ef712[_0xa3c2('0x26')]);if(_0x5ef712['name']){delete _0x5ef712['name'];}_0x34eed4[_0xa3c2('0x18')](_0x10c8c3)[_0xa3c2('0x27')](_0x5ef712);};}exports[_0xa3c2('0x28')]=function(_0x685103,_0x28f3b7){var _0x2d0fa8={},_0x281903={},_0x367a53={'count':0x0,'rows':[]};return db[_0xa3c2('0x29')][_0xa3c2('0x2a')]()['then'](function(_0x2b4274){_0x281903[_0xa3c2('0x2b')]=_[_0xa3c2('0x2c')](_0x2b4274);_0x281903[_0xa3c2('0x2d')]=_[_0xa3c2('0x2c')](_0x685103[_0xa3c2('0x2d')]);_0x281903['filters']=_[_0xa3c2('0x2e')](_0x281903['model'],_0x281903[_0xa3c2('0x2d')]);_0x2d0fa8[_0xa3c2('0x2f')]=_['intersection'](_0x281903[_0xa3c2('0x2b')],qs['fields'](_0x685103[_0xa3c2('0x2d')][_0xa3c2('0x30')]));_0x2d0fa8[_0xa3c2('0x2f')]=_0x2d0fa8['attributes'][_0xa3c2('0x31')]?_0x2d0fa8[_0xa3c2('0x2f')]:_0x281903[_0xa3c2('0x2b')];if(!_0x685103[_0xa3c2('0x2d')]['hasOwnProperty']('nolimit')){_0x2d0fa8[_0xa3c2('0x1e')]=qs[_0xa3c2('0x1e')](_0x685103[_0xa3c2('0x2d')][_0xa3c2('0x1e')]);_0x2d0fa8[_0xa3c2('0x1d')]=qs[_0xa3c2('0x1d')](_0x685103[_0xa3c2('0x2d')][_0xa3c2('0x1d')]);}_0x2d0fa8['order']=qs['sort'](_0x685103['query'][_0xa3c2('0x32')]);_0x2d0fa8[_0xa3c2('0x33')]=qs[_0xa3c2('0x34')](_[_0xa3c2('0x35')](_0x685103[_0xa3c2('0x2d')],_0x281903[_0xa3c2('0x34')]),_0x2b4274);if(_0x685103['query'][_0xa3c2('0x36')]){_0x2d0fa8['where']=_[_0xa3c2('0x37')](_0x2d0fa8[_0xa3c2('0x33')],{'$or':_['map'](_0x2d0fa8[_0xa3c2('0x2f')],function(_0x5eb571){var _0x5a7a59={};_0x5a7a59[_0x5eb571]={'$like':'%'+_0x685103[_0xa3c2('0x2d')][_0xa3c2('0x36')]+'%'};return _0x5a7a59;})});}_0x2d0fa8=_[_0xa3c2('0x37')]({},_0x2d0fa8,_0x685103[_0xa3c2('0x38')]);var _0xe84387={'where':_0x2d0fa8[_0xa3c2('0x33')]};return db[_0xa3c2('0x29')][_0xa3c2('0x1c')](_0xe84387)[_0xa3c2('0x22')](function(_0x3e4ef9){_0x367a53[_0xa3c2('0x1c')]=_0x3e4ef9;if(_0x685103[_0xa3c2('0x2d')][_0xa3c2('0x39')]){_0x2d0fa8[_0xa3c2('0x3a')]=[{'all':!![]}];}return db['CmCompany'][_0xa3c2('0x3b')](_0x2d0fa8);})[_0xa3c2('0x22')](function(_0xc02640){_0x367a53['rows']=_0xc02640;return _0x367a53;})[_0xa3c2('0x22')](respondWithFilteredResult(_0x28f3b7,_0x2d0fa8))['catch'](handleError(_0x28f3b7,null));})['catch'](handleError(_0x28f3b7,null));};exports['show']=function(_0x4312df,_0x3a71ba){var _0x102746={'raw':![],'where':{'id':_0x4312df[_0xa3c2('0x3c')]['id']}},_0x5343a7={};_0x5343a7[_0xa3c2('0x2b')]=_[_0xa3c2('0x2c')](db[_0xa3c2('0x29')][_0xa3c2('0x3d')]);_0x5343a7[_0xa3c2('0x2d')]=_['keys'](_0x4312df[_0xa3c2('0x2d')]);_0x5343a7[_0xa3c2('0x34')]=_[_0xa3c2('0x2e')](_0x5343a7[_0xa3c2('0x2b')],_0x5343a7[_0xa3c2('0x2d')]);_0x102746[_0xa3c2('0x2f')]=_['intersection'](_0x5343a7['model'],qs[_0xa3c2('0x30')](_0x4312df[_0xa3c2('0x2d')][_0xa3c2('0x30')]));_0x102746[_0xa3c2('0x2f')]=_0x102746[_0xa3c2('0x2f')][_0xa3c2('0x31')]?_0x102746['attributes']:_0x5343a7[_0xa3c2('0x2b')];if(_0x4312df[_0xa3c2('0x2d')][_0xa3c2('0x39')]){_0x102746['include']=[{'all':!![]}];}_0x102746=_[_0xa3c2('0x37')]({},_0x102746,_0x4312df[_0xa3c2('0x38')]);return db[_0xa3c2('0x29')][_0xa3c2('0x3e')](_0x102746)[_0xa3c2('0x22')](handleEntityNotFound(_0x3a71ba,null))['then'](respondWithResult(_0x3a71ba,null))[_0xa3c2('0x3f')](handleError(_0x3a71ba,null));};exports[_0xa3c2('0x40')]=function(_0x2ae14c,_0x5b5c42){return db[_0xa3c2('0x29')][_0xa3c2('0x40')](_0x2ae14c[_0xa3c2('0x41')],{})[_0xa3c2('0x22')](function(_0x54c0b0){var _0x132b20=_0x2ae14c[_0xa3c2('0x42')][_0xa3c2('0x24')]({'plain':!![]});if(!_0x132b20)throw new Error(_0xa3c2('0x43'));if(_0x132b20['role']===_0xa3c2('0x42')){var _0x7a5996=_0x54c0b0[_0xa3c2('0x24')]({'plain':!![]});var _0x496589='Companies';return db[_0xa3c2('0x44')][_0xa3c2('0x3e')]({'where':{'name':_0x496589,'userProfileId':_0x132b20[_0xa3c2('0x45')]},'raw':!![]})['then'](function(_0x199817){if(_0x199817&&_0x199817[_0xa3c2('0x46')]===0x0){return db[_0xa3c2('0x47')][_0xa3c2('0x40')]({'name':_0x7a5996[_0xa3c2('0x48')],'resourceId':_0x7a5996['id'],'type':_0x199817[_0xa3c2('0x48')],'sectionId':_0x199817['id']},{})['then'](function(){return _0x54c0b0;});}else{return _0x54c0b0;}})['catch'](function(_0x12f114){logger[_0xa3c2('0x49')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12f114);throw _0x12f114;});}return _0x54c0b0;})['then'](respondWithResult(_0x5b5c42,0xc9))[_0xa3c2('0x3f')](handleError(_0x5b5c42,null));};exports[_0xa3c2('0x4a')]=function(_0x5b64cc,_0x3bdb8c){if(_0x5b64cc[_0xa3c2('0x41')]['id']){delete _0x5b64cc[_0xa3c2('0x41')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x5b64cc[_0xa3c2('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3bdb8c,null))['then'](saveUpdates(_0x5b64cc[_0xa3c2('0x41')],null))['then'](respondWithResult(_0x3bdb8c,null))[_0xa3c2('0x3f')](handleError(_0x3bdb8c,null));};exports['destroy']=function(_0x340a2c,_0x459de2){return db[_0xa3c2('0x29')][_0xa3c2('0x3e')]({'where':{'id':_0x340a2c[_0xa3c2('0x3c')]['id']}})[_0xa3c2('0x22')](handleEntityNotFound(_0x459de2,null))[_0xa3c2('0x22')](removeEntity(_0x459de2,null))['catch'](handleError(_0x459de2,null));};exports[_0xa3c2('0x2a')]=function(_0x285fe7,_0x4bc940){return db[_0xa3c2('0x29')][_0xa3c2('0x2a')]()[_0xa3c2('0x22')](respondWithResult(_0x4bc940,null))[_0xa3c2('0x3f')](handleError(_0x4bc940,null));};exports['addContacts']=function(_0x10c0c1,_0x160a97,_0x17fbfb){return db[_0xa3c2('0x4b')][_0xa3c2('0x3e')]({'where':{'id':_0x10c0c1[_0xa3c2('0x3c')]['id']}})[_0xa3c2('0x22')](handleEntityNotFound(_0x160a97,null))['then'](function(_0x4a2094){if(_0x4a2094){return _0x4a2094['addContacts'](_0x10c0c1[_0xa3c2('0x41')][_0xa3c2('0x4c')],_[_0xa3c2('0x4d')](_0x10c0c1[_0xa3c2('0x41')],[_0xa3c2('0x4c'),'id'])||{});}})['then'](respondWithResult(_0x160a97,null))[_0xa3c2('0x3f')](handleError(_0x160a97,null));};exports[_0xa3c2('0x4e')]=function(_0x27cecd,_0x22bba1,_0x7cba83){var _0x21e7a5={};var _0x4ed0dd={};var _0x598894;var _0x48105c;return db[_0xa3c2('0x29')]['findOne']({'where':{'id':_0x27cecd[_0xa3c2('0x3c')]['id']}})[_0xa3c2('0x22')](handleEntityNotFound(_0x22bba1,null))[_0xa3c2('0x22')](function(_0x155971){if(_0x155971){_0x598894=_0x155971;_0x4ed0dd[_0xa3c2('0x2b')]=_[_0xa3c2('0x2c')](db['CmContact'][_0xa3c2('0x3d')]);_0x4ed0dd['query']=_[_0xa3c2('0x2c')](_0x27cecd[_0xa3c2('0x2d')]);_0x4ed0dd[_0xa3c2('0x34')]=_[_0xa3c2('0x2e')](_0x4ed0dd[_0xa3c2('0x2b')],_0x4ed0dd['query']);_0x21e7a5[_0xa3c2('0x2f')]=_['intersection'](_0x4ed0dd[_0xa3c2('0x2b')],qs[_0xa3c2('0x30')](_0x27cecd['query'][_0xa3c2('0x30')]));_0x21e7a5[_0xa3c2('0x2f')]=_0x21e7a5['attributes'][_0xa3c2('0x31')]?_0x21e7a5[_0xa3c2('0x2f')]:_0x4ed0dd[_0xa3c2('0x2b')];_0x21e7a5['order']=qs['sort'](_0x27cecd[_0xa3c2('0x2d')][_0xa3c2('0x32')]);_0x21e7a5[_0xa3c2('0x33')]=qs['filters'](_['pick'](_0x27cecd['query'],_0x4ed0dd[_0xa3c2('0x34')]));if(_0x27cecd['query'][_0xa3c2('0x36')]){_0x21e7a5[_0xa3c2('0x33')]=_[_0xa3c2('0x37')](_0x21e7a5['where'],{'$or':_[_0xa3c2('0x4f')](_0x21e7a5[_0xa3c2('0x2f')],function(_0x258bc6){var _0x93d41f={};_0x93d41f[_0x258bc6]={'$like':'%'+_0x27cecd[_0xa3c2('0x2d')][_0xa3c2('0x36')]+'%'};return _0x93d41f;})});}_0x21e7a5=_[_0xa3c2('0x37')]({},_0x21e7a5,_0x27cecd[_0xa3c2('0x38')]);return _0x598894['getContacts'](_0x21e7a5);}})[_0xa3c2('0x22')](function(_0xe6c1fe){if(_0xe6c1fe){_0x48105c=_0xe6c1fe['length'];if(!_0x27cecd[_0xa3c2('0x2d')]['hasOwnProperty'](_0xa3c2('0x50'))){_0x21e7a5[_0xa3c2('0x1e')]=qs[_0xa3c2('0x1e')](_0x27cecd[_0xa3c2('0x2d')][_0xa3c2('0x1e')]);_0x21e7a5[_0xa3c2('0x1d')]=qs[_0xa3c2('0x1d')](_0x27cecd['query'][_0xa3c2('0x1d')]);}return _0x598894[_0xa3c2('0x4e')](_0x21e7a5);}})['then'](function(_0x6cd16e){if(_0x6cd16e){return _0x6cd16e?{'count':_0x48105c,'rows':_0x6cd16e}:null;}})[_0xa3c2('0x22')](respondWithResult(_0x22bba1,null))['catch'](handleError(_0x22bba1,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 4f30470..58ec5a8 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 _0x9879=['cm_companies','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./cmCompany.attributes','exports','define'];(function(_0xca2360,_0x5d7eb2){var _0xa8b24b=function(_0x5b5381){while(--_0x5b5381){_0xca2360['push'](_0xca2360['shift']());}};_0xa8b24b(++_0x5d7eb2);}(_0x9879,0xa6));var _0x9987=function(_0xcd3673,_0x327208){_0xcd3673=_0xcd3673-0x0;var _0x22a7c4=_0x9879[_0xcd3673];return _0x22a7c4;};'use strict';var _=require('lodash');var util=require(_0x9987('0x0'));var logger=require(_0x9987('0x1'))(_0x9987('0x2'));var moment=require(_0x9987('0x3'));var BPromise=require(_0x9987('0x4'));var rp=require(_0x9987('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9987('0x6'));var attributes=require(_0x9987('0x7'));module[_0x9987('0x8')]=function(_0x1a7b0f,_0x11cfa0){return _0x1a7b0f[_0x9987('0x9')]('CmCompany',attributes,{'tableName':_0x9987('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b4c=['moment','bluebird','request-promise','path','rimraf','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2b4c,0x1de));var _0xc2b4=function(_0x1e3c04,_0x5bb966){_0x1e3c04=_0x1e3c04-0x0;var _0x4f89bb=_0x2b4c[_0x1e3c04];return _0x4f89bb;};'use strict';var _=require(_0xc2b4('0x0'));var util=require(_0xc2b4('0x1'));var logger=require('../../config/logger')(_0xc2b4('0x2'));var moment=require(_0xc2b4('0x3'));var BPromise=require(_0xc2b4('0x4'));var rp=require(_0xc2b4('0x5'));var fs=require('fs');var path=require(_0xc2b4('0x6'));var rimraf=require(_0xc2b4('0x7'));var config=require('../../config/environment');var attributes=require(_0xc2b4('0x8'));module[_0xc2b4('0x9')]=function(_0x593beb,_0x49caf8){return _0x593beb[_0xc2b4('0xa')](_0xc2b4('0xb'),attributes,{'tableName':_0xc2b4('0xc'),'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 8621609..42ce9f7 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 _0xe109=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x55e6db,_0x102cbc){var _0x18f2b1=function(_0x29cbd8){while(--_0x29cbd8){_0x55e6db['push'](_0x55e6db['shift']());}};_0x18f2b1(++_0x102cbc);}(_0xe109,0x16b));var _0x9e10=function(_0x102363,_0x158232){_0x102363=_0x102363-0x0;var _0x59c3ed=_0xe109[_0x102363];return _0x59c3ed;};'use strict';var _=require(_0x9e10('0x0'));var util=require(_0x9e10('0x1'));var moment=require(_0x9e10('0x2'));var BPromise=require('bluebird');var rs=require(_0x9e10('0x3'));var fs=require('fs');var Redis=require(_0x9e10('0x4'));var db=require(_0x9e10('0x5'))['db'];var utils=require(_0x9e10('0x6'));var logger=require(_0x9e10('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9e10('0x8'));var client=jayson['client'][_0x9e10('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x286e0f,_0x3453eb,_0x2e0462){return new BPromise(function(_0xd9c360,_0x36ba54){return client['request'](_0x286e0f,_0x2e0462)['then'](function(_0x3ba882){logger[_0x9e10('0xa')](_0x9e10('0xb'),_0x3453eb,_0x9e10('0xc'));logger[_0x9e10('0xd')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x3453eb,'request\x20sent',JSON[_0x9e10('0xe')](_0x3ba882));if(_0x3ba882[_0x9e10('0xf')]){if(_0x3ba882['error'][_0x9e10('0x10')]===0x1f4){logger[_0x9e10('0xf')](_0x9e10('0xb'),_0x3453eb,_0x3ba882[_0x9e10('0xf')]['message']);return _0x36ba54(_0x3ba882[_0x9e10('0xf')][_0x9e10('0x11')]);}logger[_0x9e10('0xf')](_0x9e10('0xb'),_0x3453eb,_0x3ba882[_0x9e10('0xf')]['message']);return _0xd9c360(_0x3ba882[_0x9e10('0xf')]['message']);}else{logger['info'](_0x9e10('0xb'),_0x3453eb,_0x9e10('0xc'));_0xd9c360(_0x3ba882[_0x9e10('0x12')][_0x9e10('0x11')]);}})[_0x9e10('0x13')](function(_0x5db0ea){logger[_0x9e10('0xf')](_0x9e10('0xb'),_0x3453eb,_0x5db0ea);_0x36ba54(_0x5db0ea);});});} \ No newline at end of file +var _0x4312=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','CmCompany,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x1e16b9,_0x237d96){var _0x5c59c9=function(_0x5a3301){while(--_0x5a3301){_0x1e16b9['push'](_0x1e16b9['shift']());}};_0x5c59c9(++_0x237d96);}(_0x4312,0x1cb));var _0x2431=function(_0x55fc03,_0x43ce48){_0x55fc03=_0x55fc03-0x0;var _0x5bf429=_0x4312[_0x55fc03];return _0x5bf429;};'use strict';var _=require(_0x2431('0x0'));var util=require(_0x2431('0x1'));var moment=require(_0x2431('0x2'));var BPromise=require(_0x2431('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2431('0x4'));var db=require(_0x2431('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2431('0x6'))(_0x2431('0x7'));var config=require(_0x2431('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2431('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x556ac2,_0x274da8,_0x63d0f0){return new BPromise(function(_0x5da25c,_0x593a7b){return client[_0x2431('0xa')](_0x556ac2,_0x63d0f0)[_0x2431('0xb')](function(_0x34c385){logger[_0x2431('0xc')]('CmCompany,\x20%s,\x20%s',_0x274da8,'request\x20sent');logger[_0x2431('0xd')](_0x2431('0xe'),_0x274da8,'request\x20sent',JSON['stringify'](_0x34c385));if(_0x34c385['error']){if(_0x34c385[_0x2431('0xf')][_0x2431('0x10')]===0x1f4){logger[_0x2431('0xf')](_0x2431('0x11'),_0x274da8,_0x34c385[_0x2431('0xf')][_0x2431('0x12')]);return _0x593a7b(_0x34c385[_0x2431('0xf')][_0x2431('0x12')]);}logger[_0x2431('0xf')](_0x2431('0x11'),_0x274da8,_0x34c385[_0x2431('0xf')][_0x2431('0x12')]);return _0x5da25c(_0x34c385[_0x2431('0xf')][_0x2431('0x12')]);}else{logger['info'](_0x2431('0x11'),_0x274da8,'request\x20sent');_0x5da25c(_0x34c385[_0x2431('0x13')][_0x2431('0x12')]);}})[_0x2431('0x14')](function(_0x1ce8f6){logger[_0x2431('0xf')](_0x2431('0x11'),_0x274da8,_0x1ce8f6);_0x593a7b(_0x1ce8f6);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index cf0b286..b14d298 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 _0x36d2=['express','fs-extra','../../components/auth/service','../../config/environment','./cmCompany.controller','get','index','/describe','/:id','isAuthenticated','show','/:id/contacts','getContacts','create','post','addContacts','put','delete','exports','util','connect-timeout'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x36d2,0x1b7));var _0x236d=function(_0x2cfb48,_0x24b83b){_0x2cfb48=_0x2cfb48-0x0;var _0xc4594f=_0x36d2[_0x2cfb48];return _0xc4594f;};'use strict';var multer=require('multer');var util=require(_0x236d('0x0'));var path=require('path');var timeout=require(_0x236d('0x1'));var express=require(_0x236d('0x2'));var router=express['Router']();var fs_extra=require(_0x236d('0x3'));var auth=require(_0x236d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x236d('0x5'));var controller=require(_0x236d('0x6'));router[_0x236d('0x7')]('/',auth['isAuthenticated'](),controller[_0x236d('0x8')]);router[_0x236d('0x7')](_0x236d('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x236d('0xa'),auth[_0x236d('0xb')](),controller[_0x236d('0xc')]);router[_0x236d('0x7')](_0x236d('0xd'),auth[_0x236d('0xb')](),controller[_0x236d('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x236d('0xf')]);router[_0x236d('0x10')](_0x236d('0xd'),auth[_0x236d('0xb')](),controller[_0x236d('0x11')]);router[_0x236d('0x12')](_0x236d('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x236d('0x13')](_0x236d('0xa'),auth[_0x236d('0xb')](),controller['destroy']);module[_0x236d('0x14')]=router; \ No newline at end of file +var _0xe608=['show','/:id/contacts','post','create','addContacts','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','get','describe'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0xe608,0x1cd));var _0x8e60=function(_0x4f3207,_0x264c78){_0x4f3207=_0x4f3207-0x0;var _0x87adb6=_0xe608[_0x4f3207];return _0x87adb6;};'use strict';var multer=require(_0x8e60('0x0'));var util=require(_0x8e60('0x1'));var path=require(_0x8e60('0x2'));var timeout=require(_0x8e60('0x3'));var express=require('express');var router=express[_0x8e60('0x4')]();var fs_extra=require(_0x8e60('0x5'));var auth=require(_0x8e60('0x6'));var interaction=require(_0x8e60('0x7'));var config=require(_0x8e60('0x8'));var controller=require(_0x8e60('0x9'));router['get']('/',auth[_0x8e60('0xa')](),controller[_0x8e60('0xb')]);router[_0x8e60('0xc')]('/describe',auth[_0x8e60('0xa')](),controller[_0x8e60('0xd')]);router[_0x8e60('0xc')]('/:id',auth[_0x8e60('0xa')](),controller[_0x8e60('0xe')]);router[_0x8e60('0xc')](_0x8e60('0xf'),auth[_0x8e60('0xa')](),controller['getContacts']);router[_0x8e60('0x10')]('/',auth['isAuthenticated'](),controller[_0x8e60('0x11')]);router[_0x8e60('0x10')](_0x8e60('0xf'),auth[_0x8e60('0xa')](),controller[_0x8e60('0x12')]);router[_0x8e60('0x13')](_0x8e60('0x14'),auth['isAuthenticated'](),controller[_0x8e60('0x15')]);router[_0x8e60('0x16')](_0x8e60('0x14'),auth[_0x8e60('0xa')](),controller[_0x8e60('0x17')]);module[_0x8e60('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 55c2448..b764316 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 _0x3b91=['INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize','exports','STRING','TEXT'];(function(_0x6eb833,_0x2bb5e5){var _0xdfc38c=function(_0x13c4a4){while(--_0x13c4a4){_0x6eb833['push'](_0x6eb833['shift']());}};_0xdfc38c(++_0x2bb5e5);}(_0x3b91,0x15a));var _0x13b9=function(_0x475004,_0x33de48){_0x475004=_0x475004-0x0;var _0x2f16fd=_0x3b91[_0x475004];return _0x2f16fd;};'use strict';var _=require(_0x13b9('0x0'));var Sequelize=require(_0x13b9('0x1'));module[_0x13b9('0x2')]={'firstName':{'type':Sequelize[_0x13b9('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x13b9('0x3')]},'street':{'type':Sequelize[_0x13b9('0x3')]},'postalCode':{'type':Sequelize[_0x13b9('0x3')]},'city':{'type':Sequelize[_0x13b9('0x3')]},'country':{'type':Sequelize[_0x13b9('0x3')]},'dateOfBirth':{'type':Sequelize[_0x13b9('0x3')]},'description':{'type':Sequelize[_0x13b9('0x4')]},'phone':{'type':Sequelize[_0x13b9('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x13b9('0x3')]},'email':{'type':Sequelize[_0x13b9('0x3')]},'url':{'type':Sequelize[_0x13b9('0x3')]},'facebook':{'type':Sequelize[_0x13b9('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x13b9('0x3')]},'skype':{'type':Sequelize[_0x13b9('0x3')]},'teams':{'type':Sequelize[_0x13b9('0x3')]},'viber':{'type':Sequelize[_0x13b9('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x13b9('0x3')]},'UserId':{'type':Sequelize[_0x13b9('0x5')]},'AdditionalPhones':{'type':Sequelize[_0x13b9('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x13b9('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x13b9('0x7')],'defaultValue':Sequelize[_0x13b9('0x8')]},'dialTimezone':{'type':Sequelize[_0x13b9('0x3')]},'utcOffset':{'type':Sequelize[_0x13b9('0x5')]}}; \ No newline at end of file +var _0x7028=['exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','lodash'];(function(_0xd28119,_0x2a8097){var _0x418b38=function(_0x331d0e){while(--_0x331d0e){_0xd28119['push'](_0xd28119['shift']());}};_0x418b38(++_0x2a8097);}(_0x7028,0xfb));var _0x8702=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0x7028[_0x1fafa5];return _0xcf08c9;};'use strict';var _=require(_0x8702('0x0'));var Sequelize=require('sequelize');module[_0x8702('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x8702('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x8702('0x2')]},'city':{'type':Sequelize[_0x8702('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x8702('0x2')]},'description':{'type':Sequelize[_0x8702('0x3')]},'phone':{'type':Sequelize[_0x8702('0x2')]},'mobile':{'type':Sequelize[_0x8702('0x2')]},'fax':{'type':Sequelize[_0x8702('0x2')]},'email':{'type':Sequelize[_0x8702('0x2')]},'url':{'type':Sequelize[_0x8702('0x2')]},'facebook':{'type':Sequelize[_0x8702('0x2')]},'fb_data':{'type':Sequelize[_0x8702('0x2')]},'twitter':{'type':Sequelize[_0x8702('0x2')]},'skype':{'type':Sequelize[_0x8702('0x2')]},'teams':{'type':Sequelize[_0x8702('0x2')]},'viber':{'type':Sequelize[_0x8702('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x8702('0x2')]},'telegram':{'type':Sequelize[_0x8702('0x2')]},'UserId':{'type':Sequelize[_0x8702('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x8702('0x2')]},'priority':{'type':Sequelize[_0x8702('0x4')](0x2)[_0x8702('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x8702('0x6')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0x8702('0x2')]},'utcOffset':{'type':Sequelize[_0x8702('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 09d8f57..f0ad13d 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 _0xf2e3=['include','rows','getHopperHistories','ContactId','CmHopperHistory','includeAll','getHopperFinals','CmHopperFinal','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','binding_keys','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','import','agent','binding','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','importUpdates','User','../../components/import/cm/csvUpdates','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','getJourney','mail','chat','openchannel','fax','voice','-createdAt','channel','includes','Invalid\x20channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','source','callerid','starttime','duration','note','createdAt','userDisposition','userSecondDisposition','UserId','DESC','findAndCountAll','startCase','Website','closed','closedAt','secondDisposition','thirdDisposition','key','Owner','fullname','color','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingValue','referer','subject','substatus','externalUrl','threadId','Interaction','sortBy','reverse','bluebird','path','lodash','squel','papaparse','ioredis','../../components/contacts','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','sendStatus','stack','name','send','index','describe','findAll','query','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','length','alias','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','columnName','merge','body','from','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','create','isNil','dialTimezone','timezones','utcOffset','additionalPhones','duplicates','where','$or','push','ListId','findOrCreate','spread','hasOwnProperty','contact','all','Tag','Tags','tag','Phones','ItemType','literal','Phones.OrderBy','format','cf_%d','CmCustomField','omit','pickBy','table','cm_contacts','toParam','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','map','options','nolimit','findOne','setTags','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','ContactItemType','`ItemType`.OrderBy','CmHopperId','item','ItemType.OrderBy','getAdditionalPhones','fromContactId','CmContactId','toContactId','bulkCreate','rescheduleAdditionalPhones','hopperId','getHoppers'];(function(_0xdd22b4,_0x30d40a){var _0x40d550=function(_0x5a9ac6){while(--_0x5a9ac6){_0xdd22b4['push'](_0xdd22b4['shift']());}};_0x40d550(++_0x30d40a);}(_0xf2e3,0x15f));var _0x3f2e=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xf2e3[_0x176329];return _0x31997c;};'use strict';var moment=require('moment');var BPromise=require(_0x3f2e('0x0'));var util=require('util');var path=require(_0x3f2e('0x1'));var fs=require('fs');var _=require(_0x3f2e('0x2'));var squel=require(_0x3f2e('0x3'));var Papa=require(_0x3f2e('0x4'));var Redis=require(_0x3f2e('0x5'));var contacts=require(_0x3f2e('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x3f2e('0x7'))(_0x3f2e('0x8'));var config=require(_0x3f2e('0x9'));var shared=require('../../config/environment/shared');var db=require(_0x3f2e('0xa'))['db'];config[_0x3f2e('0xb')]=_[_0x3f2e('0xc')](config['redis'],{'host':_0x3f2e('0xd'),'port':0x18eb});var socket=require(_0x3f2e('0xe'))(new Redis(config[_0x3f2e('0xb')]));require('./cmContact.socket')[_0x3f2e('0xf')](socket);function respondWithResult(_0x2d34b9,_0x488334){_0x488334=_0x488334||0xc8;return function(_0x52056c){if(_0x52056c){return _0x2d34b9[_0x3f2e('0x10')](_0x488334)[_0x3f2e('0x11')](_0x52056c);}};}function respondWithFilteredResult(_0x2b8fba,_0x2e09da){return function(_0x851f9a){if(_0x851f9a){var _0x303a90=typeof _0x2e09da[_0x3f2e('0x12')]===_0x3f2e('0x13')&&typeof _0x2e09da[_0x3f2e('0x14')]===_0x3f2e('0x13');var _0xe8f0da=_0x851f9a[_0x3f2e('0x15')];var _0x38a156=_0x303a90?0x0:_0x2e09da[_0x3f2e('0x12')];var _0x4e6c66=_0x303a90?_0x851f9a[_0x3f2e('0x15')]:_0x2e09da[_0x3f2e('0x12')]+_0x2e09da[_0x3f2e('0x14')];var _0x2e9a2a;if(_0x4e6c66>=_0xe8f0da){_0x4e6c66=_0xe8f0da;_0x2e9a2a=0xc8;}else{_0x2e9a2a=0xce;}_0x2b8fba['status'](_0x2e9a2a);return _0x2b8fba['set'](_0x3f2e('0x16'),_0x38a156+'-'+_0x4e6c66+'/'+_0xe8f0da)['json'](_0x851f9a);}return null;};}function saveUpdates(_0x6ae745){return function(_0x466ba0){if(_0x466ba0){return _0x466ba0[_0x3f2e('0x17')](_0x6ae745)[_0x3f2e('0x18')](function(_0x2bfba6){return _0x2bfba6;});}return null;};}function removeEntity(_0x15937d){return function(_0x523d90){if(_0x523d90){return _0x523d90[_0x3f2e('0x19')]()[_0x3f2e('0x18')](function(){_0x15937d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38ebe0){return function(_0x5caa14){if(!_0x5caa14){_0x38ebe0[_0x3f2e('0x1a')](0x194);}return _0x5caa14;};}function handleError(_0x104cf2,_0x357655){_0x357655=_0x357655||0x1f4;return function(_0x286736){logger['error'](_0x286736[_0x3f2e('0x1b')]);if(_0x286736[_0x3f2e('0x1c')]){delete _0x286736['name'];}_0x104cf2[_0x3f2e('0x10')](_0x357655)[_0x3f2e('0x1d')](_0x286736);};}exports[_0x3f2e('0x1e')]=function(_0x170b00,_0xe63c83){var _0x3ee968={};return contacts[_0x3f2e('0x1f')]()['then'](function(_0x15a3b4){_0x3ee968=qs['getOptions'](_0x15a3b4,_0x170b00);return contacts[_0x3f2e('0x20')](_0x170b00[_0x3f2e('0x21')],_0x170b00['user'],_0x3ee968,_0x15a3b4);})[_0x3f2e('0x18')](respondWithFilteredResult(_0xe63c83,_0x3ee968))[_0x3f2e('0x22')](handleError(_0xe63c83,null));};exports[_0x3f2e('0x19')]=function(_0x288291,_0x4ff0fb){return db[_0x3f2e('0x23')][_0x3f2e('0x24')]({'where':{'id':_0x288291[_0x3f2e('0x25')]['id']}})['then'](handleEntityNotFound(_0x4ff0fb,null))['then'](removeEntity(_0x4ff0fb,null))[_0x3f2e('0x22')](handleError(_0x4ff0fb,null));};exports['describe']=function(_0x4be7da,_0x103dff){return db[_0x3f2e('0x23')][_0x3f2e('0x1f')]()[_0x3f2e('0x18')](function(_0x14552e){delete _0x14552e[_0x3f2e('0x26')];for(var _0x425f64=0x0;_0x425f640x0){return new Promise(function(_0x67f90e){var _0x22d816=[];for(var _0x4940cf=0x0;_0x4940cf<_0x5295d4[_0x3f2e('0x2c')];_0x4940cf++){_0x22d816['push'](insertAdditionalPhones(_0x5295d4[_0x4940cf][_0x3f2e('0x61')],_0x5295d4[_0x4940cf]['additionalPhones']));}Promise[_0x3f2e('0x62')](_0x22d816)[_0x3f2e('0x18')](function(){_0x67f90e(0x1);});})['then'](function(){return{'success':_0x544460,'failure':_0x1e5cb2,'duplicates':_0x5aeadf};});}else{return{'success':_0x544460,'failure':_0x1e5cb2,'duplicates':_0x5aeadf};}}})[_0x3f2e('0x18')](respondWithResult(_0x2f47b1,0xc9))['catch'](handleError(_0x2f47b1,null));};exports['show']=function(_0x4b5958,_0x4f6cd4){var _0x1cd658;return db['CmContact'][_0x3f2e('0x1f')]()[_0x3f2e('0x18')](function(_0x2246f6){return db[_0x3f2e('0x23')][_0x3f2e('0x24')]({'where':{'id':_0x4b5958[_0x3f2e('0x25')]['id']},'include':[{'model':db[_0x3f2e('0x63')],'as':_0x3f2e('0x64'),'attributes':['id','name','color'],'required':_0x4b5958[_0x3f2e('0x21')][_0x3f2e('0x65')]?!![]:![]},{'model':db[_0x3f2e('0x49')],'as':_0x3f2e('0x66'),'where':{'CmContactId':_0x4b5958[_0x3f2e('0x25')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0x3f2e('0x67')}]}],'order':[db['sequelize'][_0x3f2e('0x68')](_0x3f2e('0x69'))],'attributes':_[_0x3f2e('0x27')](_0x2246f6)});})[_0x3f2e('0x18')](function(_0xbf6b7e){if(!_[_0x3f2e('0x54')](_0xbf6b7e)){_0x1cd658=_0xbf6b7e[_0x3f2e('0x38')]({'plain':!![]});var _0x5c050c={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xbf6b7e&&_0xbf6b7e[_0x3f2e('0x5d')]){if(_0xbf6b7e[_0x3f2e('0x5d')]){_0x5c050c['where']['$and'][_0x3f2e('0x5c')]({'ListId':{'$ne':_0xbf6b7e['ListId']}});}}return db['CmCustomField']['findAll'](_0x5c050c);}})[_0x3f2e('0x18')](function(_0x49220d){if(!_[_0x3f2e('0x54')](_0x49220d)){return _['omit'](_0x1cd658,_['map'](_0x49220d,function(_0x5b718d){return util[_0x3f2e('0x6a')](_0x3f2e('0x6b'),_0x5b718d['id']);}));}})[_0x3f2e('0x18')](handleEntityNotFound(_0x4f6cd4,null))[_0x3f2e('0x18')](respondWithResult(_0x4f6cd4,null))['catch'](handleError(_0x4f6cd4,null));};exports[_0x3f2e('0x17')]=function(_0x2cb722,_0x83dd9a){var _0x5e43e4;if(_0x2cb722[_0x3f2e('0x36')]['id']){delete _0x2cb722[_0x3f2e('0x36')]['id'];}if(!_[_0x3f2e('0x54')](_0x2cb722['body'][_0x3f2e('0x55')])){var _0x188843=_0x2cb722[_0x3f2e('0x36')][_0x3f2e('0x55')];if(!_[_0x3f2e('0x54')](shared['timezones'][_0x188843]))_0x2cb722[_0x3f2e('0x36')][_0x3f2e('0x57')]=shared[_0x3f2e('0x56')][_0x188843][_0x3f2e('0x57')];}return db[_0x3f2e('0x23')][_0x3f2e('0x24')]({'where':{'id':_0x2cb722[_0x3f2e('0x25')]['id']}})[_0x3f2e('0x18')](handleEntityNotFound(_0x83dd9a,null))['then'](saveUpdates(_0x2cb722[_0x3f2e('0x36')],null))[_0x3f2e('0x18')](function(_0x2a2c40){_0x5e43e4=_0x2a2c40;var _0x47310b={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2a2c40&&_0x2a2c40[_0x3f2e('0x5d')]){if(_0x2a2c40[_0x3f2e('0x5d')]){_0x47310b[_0x3f2e('0x5a')]['$and'][_0x3f2e('0x5c')]({'ListId':{'$ne':_0x2a2c40[_0x3f2e('0x5d')]}});}}return db[_0x3f2e('0x6c')][_0x3f2e('0x20')](_0x47310b);})[_0x3f2e('0x18')](function(_0x2eb301){if(_0x2eb301){return _[_0x3f2e('0x6d')](_[_0x3f2e('0x6e')](_0x2cb722[_0x3f2e('0x36')],function(_0x33f26e,_0x1e4d81){return _[_0x3f2e('0x28')](_0x1e4d81,'cf_');}),_['map'](_0x2eb301,function(_0x1243c6){return util['format'](_0x3f2e('0x6b'),_0x1243c6['id']);}));}})[_0x3f2e('0x18')](function(_0x2d0e80){if(_0x2d0e80&&!_['isEmpty'](_0x2d0e80)){var _0x202b9a=squel[_0x3f2e('0x17')]()[_0x3f2e('0x6f')](_0x3f2e('0x70'))['setFields'](_0x2d0e80)[_0x3f2e('0x5a')]('id\x20=\x20?',_0x2cb722[_0x3f2e('0x25')]['id'])[_0x3f2e('0x71')]();return db['sequelize'][_0x3f2e('0x21')](_0x202b9a['text'],{'replacements':_0x202b9a['values']});}})[_0x3f2e('0x18')](function(){if(_0x2cb722['body'][_0x3f2e('0x72')]&&_0x5e43e4){return db[_0x3f2e('0x3d')]['update']({'phone':_0x2cb722[_0x3f2e('0x36')][_0x3f2e('0x72')],'OrderBy':0x0},{'where':{'ContactId':_0x5e43e4['id']}});}})['then'](function(){return _0x5e43e4;})[_0x3f2e('0x18')](respondWithResult(_0x83dd9a,null))[_0x3f2e('0x22')](handleError(_0x83dd9a,null));};exports[_0x3f2e('0x73')]=function(_0x364037,_0xd9fe8f){var _0x4e09f6={};var _0x2cde85={};var _0x12f0ec;var _0x1597b7;return db['CmContact']['findOne']({'where':{'id':_0x364037[_0x3f2e('0x25')]['id']}})[_0x3f2e('0x18')](handleEntityNotFound(_0xd9fe8f,null))['then'](function(_0x48a8a7){if(_0x48a8a7){_0x12f0ec=_0x48a8a7;_0x2cde85[_0x3f2e('0x74')]=_[_0x3f2e('0x27')](db['Tag'][_0x3f2e('0x75')]);_0x2cde85['query']=_[_0x3f2e('0x27')](_0x364037[_0x3f2e('0x21')]);_0x2cde85[_0x3f2e('0x76')]=_[_0x3f2e('0x77')](_0x2cde85['model'],_0x2cde85[_0x3f2e('0x21')]);_0x4e09f6[_0x3f2e('0x78')]=_[_0x3f2e('0x77')](_0x2cde85['model'],qs[_0x3f2e('0x79')](_0x364037[_0x3f2e('0x21')][_0x3f2e('0x79')]));_0x4e09f6[_0x3f2e('0x78')]=_0x4e09f6['attributes'][_0x3f2e('0x2c')]?_0x4e09f6[_0x3f2e('0x78')]:_0x2cde85[_0x3f2e('0x74')];_0x4e09f6[_0x3f2e('0x7a')]=qs['sort'](_0x364037[_0x3f2e('0x21')][_0x3f2e('0x7b')]);_0x4e09f6[_0x3f2e('0x5a')]=qs[_0x3f2e('0x76')](_[_0x3f2e('0x7c')](_0x364037[_0x3f2e('0x21')],_0x2cde85[_0x3f2e('0x76')]));if(_0x364037[_0x3f2e('0x21')][_0x3f2e('0x7d')]){_0x4e09f6[_0x3f2e('0x5a')]=_[_0x3f2e('0x35')](_0x4e09f6[_0x3f2e('0x5a')],{'$or':_[_0x3f2e('0x7e')](_0x4e09f6[_0x3f2e('0x78')],function(_0x488ed8){var _0x43367b={};_0x43367b[_0x488ed8]={'$like':'%'+_0x364037[_0x3f2e('0x21')][_0x3f2e('0x7d')]+'%'};return _0x43367b;})});}_0x4e09f6=_[_0x3f2e('0x35')]({},_0x4e09f6,_0x364037[_0x3f2e('0x7f')]);return _0x12f0ec[_0x3f2e('0x73')](_0x4e09f6);}})[_0x3f2e('0x18')](function(_0x314b82){if(_0x314b82){_0x1597b7=_0x314b82[_0x3f2e('0x2c')];if(!_0x364037[_0x3f2e('0x21')][_0x3f2e('0x60')](_0x3f2e('0x80'))){_0x4e09f6[_0x3f2e('0x14')]=qs[_0x3f2e('0x14')](_0x364037[_0x3f2e('0x21')][_0x3f2e('0x14')]);_0x4e09f6['offset']=qs[_0x3f2e('0x12')](_0x364037[_0x3f2e('0x21')][_0x3f2e('0x12')]);}return _0x12f0ec['getTags'](_0x4e09f6);}})[_0x3f2e('0x18')](function(_0x3f819a){if(_0x3f819a){return _0x3f819a?{'count':_0x1597b7,'rows':_0x3f819a}:null;}})[_0x3f2e('0x18')](respondWithResult(_0xd9fe8f,null))[_0x3f2e('0x22')](handleError(_0xd9fe8f,null));};exports['setTags']=function(_0x31c62e,_0x5e1339){if(_0x31c62e[_0x3f2e('0x36')]['id']){delete _0x31c62e[_0x3f2e('0x36')]['id'];}return db[_0x3f2e('0x23')][_0x3f2e('0x81')]({'where':{'id':_0x31c62e[_0x3f2e('0x25')]['id']}})[_0x3f2e('0x18')](handleEntityNotFound(_0x5e1339,null))[_0x3f2e('0x18')](function(_0xdefd05){if(_0xdefd05){return _0xdefd05[_0x3f2e('0x82')](_0x31c62e[_0x3f2e('0x36')]['ids']||[]);}return null;})[_0x3f2e('0x18')](respondWithResult(_0x5e1339,null))[_0x3f2e('0x22')](handleError(_0x5e1339,null));};exports[_0x3f2e('0x83')]=function(_0x4947f9,_0x404973){var _0x39cb34=[];_0x39cb34[_0x3f2e('0x5c')](addAdditionalPhones(_0x4947f9[_0x3f2e('0x36')]));Promise[_0x3f2e('0x62')](_0x39cb34)['then'](function(){_0x39cb34=[];_0x39cb34['push'](deleteCmHopperPhones(_0x4947f9['body']['id']));_0x39cb34[_0x3f2e('0x5c')](addCmHopperPhones(_0x4947f9[_0x3f2e('0x36')]['id']));Promise[_0x3f2e('0x62')](_0x39cb34)[_0x3f2e('0x18')](function(){return[0x1];})[_0x3f2e('0x18')](respondWithResult(_0x404973,null));});};function addAdditionalPhones(_0x5cf6d8){var _0x1ff8b2;return new Promise(function(_0x29fc16){return db['CmContactHasItem'][_0x3f2e('0x19')]({'where':{'CmContactId':_0x5cf6d8['id']}})[_0x3f2e('0x18')](function(){db['ContactItemType'][_0x3f2e('0x20')]({'raw':!![],'attributes':['id',_0x3f2e('0x84')]})[_0x3f2e('0x18')](function(_0xcfd3a7){var _0x5af0ab=[];for(var _0x3b860e=0x0;_0x3b860e<_0x5cf6d8[_0x3f2e('0x85')][_0x3f2e('0x2c')];_0x3b860e++){var _0x42ad42=_0x5cf6d8[_0x3f2e('0x86')]?_[_0x3f2e('0x54')](_0x5cf6d8[_0x3f2e('0x86')][_0x3b860e])?'':_0x5cf6d8['item_types'][_0x3b860e]:_0x5cf6d8['items'][_0x3b860e][_0x3f2e('0x87')]?_0x5cf6d8['items'][_0x3b860e][_0x3f2e('0x87')]:'';var _0x30d9ea=_[_0x3f2e('0x54')](_0x5cf6d8[_0x3f2e('0x85')][_0x3b860e][_0x3f2e('0x88')])?'':_0x5cf6d8[_0x3f2e('0x85')][_0x3b860e]['description'];var _0x19cdcf=_0x42ad42+':'+_0x5cf6d8[_0x3f2e('0x85')][_0x3b860e][_0x3f2e('0x72')]+'§'+_0x30d9ea;if(_[_0x3f2e('0x54')](_0x1ff8b2))_0x1ff8b2=_0x19cdcf;else _0x1ff8b2+=';'+_0x19cdcf;var _0xbb6a3f=null;var _0x3bc460=null;if(_0x5cf6d8[_0x3f2e('0x86')]){if(!_['isNil'](_0x5cf6d8[_0x3f2e('0x86')][_0x3b860e])){_0x3bc460=_['find'](_0xcfd3a7,function(_0x5bf313){return _0x5bf313['id']===_0x5cf6d8[_0x3f2e('0x86')][_0x3b860e];});if(!_[_0x3f2e('0x54')](_0x3bc460)){_0xbb6a3f=_0x3bc460[_0x3f2e('0x84')];}}}else{if(!_[_0x3f2e('0x54')](_0x5cf6d8[_0x3f2e('0x85')][_0x3b860e])){_0x3bc460=_['find'](_0xcfd3a7,function(_0x43a72f){return _0x43a72f['id']===_0x5cf6d8[_0x3f2e('0x85')][_0x3b860e][_0x3f2e('0x87')];});if(!_[_0x3f2e('0x54')](_0x3bc460)){_0xbb6a3f=_0x3b860e;}}}if(_[_0x3f2e('0x54')](_0xbb6a3f)){_0xbb6a3f=0x64;}_0x5af0ab['push'](addAdditionalPhone(_0x5cf6d8['id'],_0x5cf6d8['items'][_0x3b860e]['phone'],_0x5cf6d8[_0x3f2e('0x86')]?_[_0x3f2e('0x54')](_0x5cf6d8[_0x3f2e('0x86')][_0x3b860e])?null:_0x5cf6d8[_0x3f2e('0x86')][_0x3b860e]:_0x5cf6d8['items'][_0x3b860e]['ItemTypeId']?_0x5cf6d8[_0x3f2e('0x85')][_0x3b860e]['ItemTypeId']:null,_0xbb6a3f,_0x30d9ea));}Promise[_0x3f2e('0x62')](_0x5af0ab)[_0x3f2e('0x18')](function(){db[_0x3f2e('0x23')][_0x3f2e('0x17')]({'AdditionalPhones':_0x1ff8b2},{'where':{'id':_0x5cf6d8['id']}})[_0x3f2e('0x18')](function(){_0x29fc16(0x1);});});});});});}function addAdditionalPhone(_0x45bb8e,_0x36d0f1,_0x197b83,_0x2772fa,_0x1821d9){return db[_0x3f2e('0x49')][_0x3f2e('0x24')]({'where':{'CmContactId':_0x45bb8e,'item':_0x36d0f1}})[_0x3f2e('0x18')](function(_0x4cb5a9){if(_0x4cb5a9)logger['info'](_0x3f2e('0x89'),_0x4cb5a9);else{db[_0x3f2e('0x49')][_0x3f2e('0x53')]({'CmContactId':_0x45bb8e,'item':_0x36d0f1,'ItemTypeId':_0x197b83,'OrderBy':_0x2772fa,'ItemClass':_0x3f2e('0x8a'),'description':_0x1821d9});}});}function deleteCmHopperPhones(_0x9c6878){return new Promise(function(_0x3e8c56){return db[_0x3f2e('0x3d')][_0x3f2e('0x20')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x9c6878}})[_0x3f2e('0x18')](function(_0x280206){db[_0x3f2e('0x8b')][_0x3f2e('0x19')]({'where':{'CmHopperId':{'$in':_[_0x3f2e('0x7e')](_0x280206,'id')}}});})[_0x3f2e('0x18')](function(){_0x3e8c56(0x1);});});}function addCmHopperPhones(_0x40be4c){return new Promise(function(_0x3a01d1){return db[_0x3f2e('0x3d')][_0x3f2e('0x20')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x40be4c}})['then'](function(_0x4b6d36){var _0x51f1cc=[];_['map'](_0x4b6d36,function(_0x25a906){_0x51f1cc[_0x3f2e('0x5c')](createCmHopperPhone(_0x40be4c,_0x25a906['id']));});Promise[_0x3f2e('0x62')](_0x51f1cc)[_0x3f2e('0x18')](function(){_0x3a01d1(0x1);});});});}function createCmHopperPhone(_0x253498,_0x404ca6){return new Promise(function(_0x33a4de){db[_0x3f2e('0x49')]['findAll']({'raw':!![],'attributes':['item','OrderBy'],'where':{'CmContactId':_0x253498,'ItemClass':_0x3f2e('0x8a')},'include':[{'model':db[_0x3f2e('0x8c')],'attributes':[_0x3f2e('0x84')],'as':_0x3f2e('0x67')}],'order':[_0x3f2e('0x84'),db['sequelize']['literal'](_0x3f2e('0x8d'))]})[_0x3f2e('0x18')](function(_0x18b61f){var _0x27cd52=0x1;var _0x2ec9ed=_['map'](_0x18b61f,function(_0x2b4182){_0x2b4182[_0x3f2e('0x8e')]=_0x404ca6;_0x2b4182[_0x3f2e('0x72')]=_0x2b4182[_0x3f2e('0x8f')];_0x2b4182[_0x3f2e('0x84')]=_0x27cd52;delete _0x2b4182[_0x3f2e('0x90')];_0x27cd52=_0x27cd52+0x1;return _0x2b4182;});return db[_0x3f2e('0x8b')]['bulkCreate'](_0x2ec9ed,{});})[_0x3f2e('0x18')](function(){_0x33a4de(0x1);});});}function insertAdditionalPhones(_0x393abc,_0x121782){return new Promise(function(_0x9e6db6){var _0x2d1b48=[];for(var _0x223835=0x0;_0x223835<_0x121782['length'];_0x223835++){var _0x5442d0=_0x121782[_0x223835];_0x2d1b48[_0x3f2e('0x5c')](parseContactItemType(_0x5442d0));}Promise[_0x3f2e('0x62')](_0x2d1b48)[_0x3f2e('0x18')](function(){var _0x2225dd={'id':_0x393abc['id'],'items':_0x121782};return addAdditionalPhones(_0x2225dd)[_0x3f2e('0x18')](function(){return addCmHopperPhones(_0x393abc['id']);});})[_0x3f2e('0x18')](function(){_0x9e6db6(_0x393abc);});});}function parseContactItemType(_0x2305f8){return new Promise(function(_0x320b5e){if(_0x2305f8[_0x3f2e('0x60')]('ItemTypeId')){_0x320b5e(_0x2305f8);}else{return db[_0x3f2e('0x8c')][_0x3f2e('0x24')]({'where':{'name':_0x2305f8['ItemType']}})['then'](function(_0x297cb4){if(_[_0x3f2e('0x54')](_0x297cb4))_0x2305f8[_0x3f2e('0x87')]=null;else _0x2305f8['ItemTypeId']=_0x297cb4['id'];_0x320b5e(_0x2305f8);});}});}exports[_0x3f2e('0x91')]=function(_0x135a2f,_0x13f6d5){return db[_0x3f2e('0x49')][_0x3f2e('0x20')]({'raw':!![],'where':{'CmContactId':_0x135a2f[_0x3f2e('0x25')]['id'],'ItemClass':'PHONE'},'include':[{'model':db['ContactItemType'],'as':_0x3f2e('0x67')}],'order':[['OrderBy'],[db['sequelize'][_0x3f2e('0x68')](_0x3f2e('0x8d'))]]})['then'](function(_0x33f525){return _0x33f525;})[_0x3f2e('0x18')](respondWithResult(_0x13f6d5,null))[_0x3f2e('0x22')](handleError(_0x13f6d5,null));};exports['duplicateAdditionalPhones']=function(_0x1bd7e8,_0x3e8813){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x1bd7e8['body'][_0x3f2e('0x92')]}})[_0x3f2e('0x18')](function(_0x58eceb){var _0x545dee=_['map'](_0x58eceb,function(_0x30b2ff){_0x30b2ff[_0x3f2e('0x93')]=_0x1bd7e8['body'][_0x3f2e('0x94')];return _0x30b2ff;});return db[_0x3f2e('0x49')][_0x3f2e('0x95')](_0x545dee,{});})[_0x3f2e('0x18')](function(){return addCmHopperPhones(_0x1bd7e8[_0x3f2e('0x36')][_0x3f2e('0x94')]);})[_0x3f2e('0x18')](function(){return['ok'];})[_0x3f2e('0x18')](respondWithResult(_0x3e8813,null))[_0x3f2e('0x22')](handleError(_0x3e8813,null));};exports[_0x3f2e('0x96')]=function(_0x34854c,_0x52f5a8){var _0x45ab30=[];_0x45ab30[_0x3f2e('0x5c')](createCmHopperPhone(_0x34854c[_0x3f2e('0x36')]['id'],_0x34854c[_0x3f2e('0x36')][_0x3f2e('0x97')]));Promise[_0x3f2e('0x62')](_0x45ab30)[_0x3f2e('0x18')](function(){return[0x1];})[_0x3f2e('0x18')](respondWithResult(_0x52f5a8,null));};exports[_0x3f2e('0x98')]=function(_0x2f4412,_0x1f222f){var _0x3353ae={'raw':![],'where':{}};var _0x333685={};var _0x4186e5={'count':0x0,'rows':[]};return db[_0x3f2e('0x23')][_0x3f2e('0x81')]({'where':{'id':_0x2f4412['params']['id']}})[_0x3f2e('0x18')](handleEntityNotFound(_0x1f222f,null))['then'](function(_0x31a7d9){if(_0x31a7d9){_0x333685[_0x3f2e('0x74')]=_[_0x3f2e('0x27')](db[_0x3f2e('0x3d')][_0x3f2e('0x75')]);_0x333685[_0x3f2e('0x21')]=_['keys'](_0x2f4412[_0x3f2e('0x21')]);_0x333685['filters']=_[_0x3f2e('0x77')](_0x333685[_0x3f2e('0x74')],_0x333685[_0x3f2e('0x21')]);_0x3353ae[_0x3f2e('0x78')]=_[_0x3f2e('0x77')](_0x333685['model'],qs[_0x3f2e('0x79')](_0x2f4412['query'][_0x3f2e('0x79')]));_0x3353ae['attributes']=_0x3353ae['attributes'][_0x3f2e('0x2c')]?_0x3353ae[_0x3f2e('0x78')]:_0x333685[_0x3f2e('0x74')];if(!_0x2f4412[_0x3f2e('0x21')]['hasOwnProperty'](_0x3f2e('0x80'))){_0x3353ae[_0x3f2e('0x14')]=qs['limit'](_0x2f4412[_0x3f2e('0x21')][_0x3f2e('0x14')]);_0x3353ae[_0x3f2e('0x12')]=qs['offset'](_0x2f4412[_0x3f2e('0x21')]['offset']);}_0x3353ae[_0x3f2e('0x7a')]=qs['sort'](_0x2f4412['query'][_0x3f2e('0x7b')]);_0x3353ae['where']=qs[_0x3f2e('0x76')](_['pick'](_0x2f4412[_0x3f2e('0x21')],_0x333685['filters']));_0x3353ae[_0x3f2e('0x5a')]['ContactId']=_0x31a7d9['id'];if(_0x2f4412[_0x3f2e('0x21')][_0x3f2e('0x7d')]){_0x3353ae[_0x3f2e('0x5a')]=_[_0x3f2e('0x35')](_0x3353ae['where'],{'$or':_[_0x3f2e('0x7e')](_0x3353ae[_0x3f2e('0x78')],function(_0x462712){var _0x312980={};_0x312980[_0x462712]={'$like':'%'+_0x2f4412[_0x3f2e('0x21')][_0x3f2e('0x7d')]+'%'};return _0x312980;})});}_0x3353ae=_[_0x3f2e('0x35')]({},_0x3353ae,_0x2f4412[_0x3f2e('0x7f')]);return db[_0x3f2e('0x3d')][_0x3f2e('0x15')]({'where':_0x3353ae[_0x3f2e('0x5a')]})[_0x3f2e('0x18')](function(_0xa7637){_0x4186e5['count']=_0xa7637;if(_0x2f4412['query']['includeAll']){_0x3353ae[_0x3f2e('0x99')]=[{'all':!![]}];}return db[_0x3f2e('0x3d')]['findAll'](_0x3353ae);})[_0x3f2e('0x18')](function(_0x3aceeb){_0x4186e5[_0x3f2e('0x9a')]=_0x3aceeb;return _0x4186e5;});}})[_0x3f2e('0x18')](respondWithFilteredResult(_0x1f222f,_0x3353ae))[_0x3f2e('0x22')](handleError(_0x1f222f,null));};exports[_0x3f2e('0x9b')]=function(_0x1ac501,_0xa2ad71){var _0x5b97bd={'raw':!![],'where':{}};var _0xe48980={};var _0xaadaf4={'count':0x0,'rows':[]};return db[_0x3f2e('0x23')][_0x3f2e('0x81')]({'where':{'id':_0x1ac501[_0x3f2e('0x25')]['id']}})['then'](handleEntityNotFound(_0xa2ad71,null))[_0x3f2e('0x18')](function(_0x2b8832){if(_0x2b8832){_0xe48980[_0x3f2e('0x74')]=_[_0x3f2e('0x27')](db['CmHopperHistory'][_0x3f2e('0x75')]);_0xe48980[_0x3f2e('0x21')]=_[_0x3f2e('0x27')](_0x1ac501[_0x3f2e('0x21')]);_0xe48980[_0x3f2e('0x76')]=_['intersection'](_0xe48980[_0x3f2e('0x74')],_0xe48980[_0x3f2e('0x21')]);_0x5b97bd[_0x3f2e('0x78')]=_[_0x3f2e('0x77')](_0xe48980[_0x3f2e('0x74')],qs[_0x3f2e('0x79')](_0x1ac501[_0x3f2e('0x21')][_0x3f2e('0x79')]));_0x5b97bd[_0x3f2e('0x78')]=_0x5b97bd[_0x3f2e('0x78')][_0x3f2e('0x2c')]?_0x5b97bd[_0x3f2e('0x78')]:_0xe48980['model'];if(!_0x1ac501[_0x3f2e('0x21')][_0x3f2e('0x60')](_0x3f2e('0x80'))){_0x5b97bd[_0x3f2e('0x14')]=qs['limit'](_0x1ac501[_0x3f2e('0x21')][_0x3f2e('0x14')]);_0x5b97bd['offset']=qs['offset'](_0x1ac501[_0x3f2e('0x21')]['offset']);}_0x5b97bd[_0x3f2e('0x7a')]=qs[_0x3f2e('0x7b')](_0x1ac501[_0x3f2e('0x21')][_0x3f2e('0x7b')]);_0x5b97bd[_0x3f2e('0x5a')]=qs['filters'](_['pick'](_0x1ac501['query'],_0xe48980[_0x3f2e('0x76')]));_0x5b97bd[_0x3f2e('0x5a')][_0x3f2e('0x9c')]=_0x2b8832['id'];if(_0x1ac501[_0x3f2e('0x21')][_0x3f2e('0x7d')]){_0x5b97bd[_0x3f2e('0x5a')]=_[_0x3f2e('0x35')](_0x5b97bd[_0x3f2e('0x5a')],{'$or':_[_0x3f2e('0x7e')](_0x5b97bd[_0x3f2e('0x78')],function(_0x445066){var _0x506682={};_0x506682[_0x445066]={'$like':'%'+_0x1ac501[_0x3f2e('0x21')][_0x3f2e('0x7d')]+'%'};return _0x506682;})});}_0x5b97bd=_['merge']({},_0x5b97bd,_0x1ac501[_0x3f2e('0x7f')]);return db[_0x3f2e('0x9d')][_0x3f2e('0x15')]({'where':_0x5b97bd['where']})['then'](function(_0x2312a8){_0xaadaf4[_0x3f2e('0x15')]=_0x2312a8;if(_0x1ac501[_0x3f2e('0x21')][_0x3f2e('0x9e')]){_0x5b97bd[_0x3f2e('0x99')]=[{'all':!![]}];}return db[_0x3f2e('0x9d')]['findAll'](_0x5b97bd);})[_0x3f2e('0x18')](function(_0x83a0f5){_0xaadaf4[_0x3f2e('0x9a')]=_0x83a0f5;return _0xaadaf4;});}})['then'](respondWithFilteredResult(_0xa2ad71,_0x5b97bd))['catch'](handleError(_0xa2ad71,null));};exports[_0x3f2e('0x9f')]=function(_0x439a00,_0x4c70fa){var _0x24b8d8={'raw':!![],'where':{}};var _0x2a0262={};var _0x45d330={'count':0x0,'rows':[]};return db[_0x3f2e('0x23')][_0x3f2e('0x81')]({'where':{'id':_0x439a00['params']['id']}})['then'](handleEntityNotFound(_0x4c70fa,null))[_0x3f2e('0x18')](function(_0x5bd7af){if(_0x5bd7af){_0x2a0262[_0x3f2e('0x74')]=_['keys'](db[_0x3f2e('0xa0')][_0x3f2e('0x75')]);_0x2a0262[_0x3f2e('0x21')]=_[_0x3f2e('0x27')](_0x439a00[_0x3f2e('0x21')]);_0x2a0262['filters']=_['intersection'](_0x2a0262[_0x3f2e('0x74')],_0x2a0262['query']);_0x24b8d8[_0x3f2e('0x78')]=_[_0x3f2e('0x77')](_0x2a0262[_0x3f2e('0x74')],qs[_0x3f2e('0x79')](_0x439a00[_0x3f2e('0x21')][_0x3f2e('0x79')]));_0x24b8d8[_0x3f2e('0x78')]=_0x24b8d8[_0x3f2e('0x78')]['length']?_0x24b8d8[_0x3f2e('0x78')]:_0x2a0262[_0x3f2e('0x74')];if(!_0x439a00['query'][_0x3f2e('0x60')](_0x3f2e('0x80'))){_0x24b8d8[_0x3f2e('0x14')]=qs[_0x3f2e('0x14')](_0x439a00['query'][_0x3f2e('0x14')]);_0x24b8d8[_0x3f2e('0x12')]=qs[_0x3f2e('0x12')](_0x439a00[_0x3f2e('0x21')]['offset']);}_0x24b8d8[_0x3f2e('0x7a')]=qs[_0x3f2e('0x7b')](_0x439a00[_0x3f2e('0x21')]['sort']);_0x24b8d8[_0x3f2e('0x5a')]=qs[_0x3f2e('0x76')](_[_0x3f2e('0x7c')](_0x439a00['query'],_0x2a0262['filters']));_0x24b8d8['where'][_0x3f2e('0x9c')]=_0x5bd7af['id'];if(_0x439a00['query'][_0x3f2e('0x7d')]){_0x24b8d8[_0x3f2e('0x5a')]=_[_0x3f2e('0x35')](_0x24b8d8['where'],{'$or':_[_0x3f2e('0x7e')](_0x24b8d8[_0x3f2e('0x78')],function(_0x47d040){var _0x28122e={};_0x28122e[_0x47d040]={'$like':'%'+_0x439a00[_0x3f2e('0x21')][_0x3f2e('0x7d')]+'%'};return _0x28122e;})});}_0x24b8d8=_[_0x3f2e('0x35')]({},_0x24b8d8,_0x439a00[_0x3f2e('0x7f')]);return db[_0x3f2e('0xa0')][_0x3f2e('0x15')]({'where':_0x24b8d8['where']})[_0x3f2e('0x18')](function(_0x2ad299){_0x45d330['count']=_0x2ad299;if(_0x439a00[_0x3f2e('0x21')][_0x3f2e('0x9e')]){_0x24b8d8[_0x3f2e('0x99')]=[{'all':!![]}];}return db[_0x3f2e('0xa0')][_0x3f2e('0x20')](_0x24b8d8);})[_0x3f2e('0x18')](function(_0x598750){_0x45d330[_0x3f2e('0x9a')]=_0x598750;return _0x45d330;});}})['then'](respondWithFilteredResult(_0x4c70fa,_0x24b8d8))[_0x3f2e('0x22')](handleError(_0x4c70fa,null));};exports[_0x3f2e('0xa1')]=function(_0x3b8312,_0x2012bf){var _0x4b9fd4={'raw':!![],'where':{}};var _0x1731ea={};var _0x2d2229={'count':0x0,'rows':[]};return db[_0x3f2e('0x23')][_0x3f2e('0x81')]({'where':{'id':_0x3b8312[_0x3f2e('0x25')]['id']}})[_0x3f2e('0x18')](handleEntityNotFound(_0x2012bf,null))[_0x3f2e('0x18')](function(_0x41041f){if(_0x41041f){_0x1731ea['model']=_[_0x3f2e('0x27')](db[_0x3f2e('0x50')]['rawAttributes']);_0x1731ea[_0x3f2e('0x21')]=_['keys'](_0x3b8312[_0x3f2e('0x21')]);_0x1731ea[_0x3f2e('0x76')]=_[_0x3f2e('0x77')](_0x1731ea[_0x3f2e('0x74')],_0x1731ea[_0x3f2e('0x21')]);_0x4b9fd4[_0x3f2e('0x78')]=_[_0x3f2e('0x77')](_0x1731ea[_0x3f2e('0x74')],qs['fields'](_0x3b8312['query']['fields']));_0x4b9fd4['attributes']=_0x4b9fd4[_0x3f2e('0x78')][_0x3f2e('0x2c')]?_0x4b9fd4[_0x3f2e('0x78')]:_0x1731ea['model'];if(!_0x3b8312[_0x3f2e('0x21')][_0x3f2e('0x60')](_0x3f2e('0x80'))){_0x4b9fd4[_0x3f2e('0x14')]=qs[_0x3f2e('0x14')](_0x3b8312['query']['limit']);_0x4b9fd4['offset']=qs[_0x3f2e('0x12')](_0x3b8312[_0x3f2e('0x21')][_0x3f2e('0x12')]);}_0x4b9fd4[_0x3f2e('0x7a')]=qs['sort'](_0x3b8312[_0x3f2e('0x21')]['sort']);_0x4b9fd4[_0x3f2e('0x5a')]=qs[_0x3f2e('0x76')](_[_0x3f2e('0x7c')](_0x3b8312[_0x3f2e('0x21')],_0x1731ea[_0x3f2e('0x76')]));_0x4b9fd4[_0x3f2e('0x5a')][_0x3f2e('0x9c')]=_0x41041f['id'];if(_0x3b8312[_0x3f2e('0x21')][_0x3f2e('0x7d')]){_0x4b9fd4[_0x3f2e('0x5a')]=_[_0x3f2e('0x35')](_0x4b9fd4[_0x3f2e('0x5a')],{'$or':_[_0x3f2e('0x7e')](_0x4b9fd4[_0x3f2e('0x78')],function(_0x1867e4){var _0x32abf6={};_0x32abf6[_0x1867e4]={'$like':'%'+_0x3b8312[_0x3f2e('0x21')][_0x3f2e('0x7d')]+'%'};return _0x32abf6;})});}_0x4b9fd4=_[_0x3f2e('0x35')]({},_0x4b9fd4,_0x3b8312[_0x3f2e('0x7f')]);return db[_0x3f2e('0x50')]['count']({'where':_0x4b9fd4[_0x3f2e('0x5a')]})[_0x3f2e('0x18')](function(_0x1c0ebb){_0x2d2229['count']=_0x1c0ebb;if(_0x3b8312[_0x3f2e('0x21')][_0x3f2e('0x9e')]){_0x4b9fd4[_0x3f2e('0x99')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x4b9fd4);})[_0x3f2e('0x18')](function(_0x516437){_0x2d2229[_0x3f2e('0x9a')]=_0x516437;return _0x2d2229;});}})[_0x3f2e('0x18')](respondWithFilteredResult(_0x2012bf,_0x4b9fd4))[_0x3f2e('0x22')](handleError(_0x2012bf,null));};exports[_0x3f2e('0xa2')]=function(_0x364a2c,_0x3725a6){try{if(!_0x364a2c['body'][_0x3f2e('0x5d')]){throw new Error(_0x3f2e('0xa3'));}if(!_0x364a2c['body']['binding_keys']){throw new Error(_0x3f2e('0xa4'));}if(!_0x364a2c[_0x3f2e('0x36')][_0x3f2e('0xa5')]){throw new Error(_0x3f2e('0xa6'));}if(!_0x364a2c[_0x3f2e('0x36')][_0x3f2e('0xa7')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x1c8b6e=_0x364a2c['body'][_0x3f2e('0xa8')][_0x3f2e('0xa9')](',');var _0x19de89=_0x364a2c[_0x3f2e('0x36')][_0x3f2e('0xa5')]['split'](',');if(!_0x1c8b6e['length']||!_0x19de89[_0x3f2e('0x2c')]||_0x1c8b6e[_0x3f2e('0x2c')]!==_0x19de89[_0x3f2e('0x2c')]){throw new Error(_0x3f2e('0xaa'));}_0x364a2c[_0x3f2e('0x36')][_0x3f2e('0x79')]=_[_0x3f2e('0xab')](_0x1c8b6e,_0x19de89);if(!_0x364a2c[_0x3f2e('0x36')][_0x3f2e('0x79')][_0x3f2e('0x72')]){throw new Error(_0x3f2e('0xac'));}if(!_0x364a2c[_0x3f2e('0x36')][_0x3f2e('0x79')][_0x3f2e('0xad')]){throw new Error(_0x3f2e('0xae'));}var _0x3185bb=path[_0x3f2e('0x3b')](config[_0x3f2e('0xaf')],_0x3f2e('0xb0'),_0x364a2c[_0x3f2e('0xb1')][_0x3f2e('0xb2')]);fs[_0x3f2e('0xb3')](_0x3185bb,parseInt(_0x3f2e('0xb4'),0x8));var _0x13aaf8=require(_0x3f2e('0xb5'))[_0x3f2e('0xb6')](path['join'](__dirname,'../../components/import/cm/csv'),[_0x3185bb,_0x364a2c['body'][_0x3f2e('0xa8')],_0x364a2c[_0x3f2e('0x36')][_0x3f2e('0xa5')],_0x364a2c[_0x3f2e('0x36')][_0x3f2e('0x5d')],_0x364a2c[_0x3f2e('0x36')][_0x3f2e('0xb7')],_0x364a2c[_0x3f2e('0x36')]['duplicates'],_0x364a2c['body'][_0x3f2e('0xa7')]]);return _0x3725a6[_0x3f2e('0x10')](0xc8)[_0x3f2e('0x11')]({'message':_0x3f2e('0xb8'),'pid':_0x13aaf8[_0x3f2e('0xb9')]});}catch(_0x25b520){return _0x3725a6['status'](0x1f4)[_0x3f2e('0x1d')](_0x25b520);}};exports[_0x3f2e('0xba')]=function(_0x64401c,_0x48fc61){var _0x3a97d8=fs[_0x3f2e('0xbb')](_0x64401c['file']['path']);Papa[_0x3f2e('0xbc')](_0x3a97d8,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x12bde8){return _0x48fc61['status'](0xc8)[_0x3f2e('0x11')]({'file':_0x64401c[_0x3f2e('0xb1')],'fields':_0x12bde8['meta'][_0x3f2e('0x79')]});}});};exports[_0x3f2e('0xbd')]=function(_0x5923a3,_0x56ecb8){return db['User'][_0x3f2e('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':_0x3f2e('0xbe')}})[_0x3f2e('0x18')](function(_0x227e1d){var _0x1a69c7=![];if(!_0x5923a3['body']['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x5923a3['body'][_0x3f2e('0xbf')][_0x3f2e('0x72')]){throw new Error(_0x3f2e('0xac'));}if(!_0x5923a3[_0x3f2e('0x36')][_0x3f2e('0xbf')][_0x3f2e('0xad')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x5923a3['body'][_0x3f2e('0xa7')]){throw new Error(_0x3f2e('0xc0'));}var _0x27c438=require(_0x3f2e('0xb5'))['fork'](path[_0x3f2e('0x3b')](__dirname,_0x3f2e('0xc1')),[_0x5923a3['params']['id'],JSON['stringify'](_0x5923a3[_0x3f2e('0x36')]),JSON[_0x3f2e('0xc2')](_0x227e1d)]);_0x27c438['on']('message',function(){_0x1a69c7=!![];return _0x56ecb8['status'](0xc8)[_0x3f2e('0x11')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x27c438[_0x3f2e('0xb9')]});});_0x27c438['on']('exit',function(_0x3b523f){if(_0x3b523f&&!_0x1a69c7){return _0x56ecb8[_0x3f2e('0x10')](0x1f4)['json']({'message':'error\x20child\x20process','pid':_0x27c438[_0x3f2e('0xb9')]});}});})[_0x3f2e('0x22')](handleError(_0x56ecb8,null));};exports[_0x3f2e('0xc3')]=function(_0x1ce45b,_0x5a3a29){return db[_0x3f2e('0xc4')][_0x3f2e('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':_0x3f2e('0xbe')}})[_0x3f2e('0x18')](function(_0x45f0b7){var _0x2ee87d=![];if(!_0x1ce45b[_0x3f2e('0x36')][_0x3f2e('0x5d')]){throw new Error(_0x3f2e('0xa3'));}if(!_0x1ce45b[_0x3f2e('0x36')][_0x3f2e('0xbf')][_0x3f2e('0x72')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x1ce45b['body'][_0x3f2e('0xbf')][_0x3f2e('0xad')]){throw new Error(_0x3f2e('0xae'));}if(!_0x1ce45b[_0x3f2e('0x36')][_0x3f2e('0xa7')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x349c99=require('child_process')[_0x3f2e('0xb6')](path['join'](__dirname,_0x3f2e('0xc5')),[_0x1ce45b[_0x3f2e('0x25')]['id'],JSON[_0x3f2e('0xc2')](_0x1ce45b[_0x3f2e('0x36')]),JSON['stringify'](_0x45f0b7)]);_0x349c99['on'](_0x3f2e('0xc6'),function(){_0x2ee87d=!![];return _0x5a3a29[_0x3f2e('0x10')](0xc8)[_0x3f2e('0x11')]({'message':_0x3f2e('0xc7'),'pid':_0x349c99['pid']});});_0x349c99['on'](_0x3f2e('0xc8'),function(_0x4ac06e){if(_0x4ac06e&&!_0x2ee87d){return _0x5a3a29['status'](0x1f4)['json']({'message':_0x3f2e('0xc9'),'pid':_0x349c99[_0x3f2e('0xb9')]});}});})[_0x3f2e('0x22')](handleError(_0x5a3a29,null));};exports[_0x3f2e('0xca')]=function(_0x39bc6b,_0x2a5588){var _0x55c2cc=[_0x3f2e('0xcb'),_0x3f2e('0xcc'),'sms',_0x3f2e('0xcd'),_0x3f2e('0xce'),'whatsapp',_0x3f2e('0xcf')];var _0x4ee479={'offset':0x0,'order':qs[_0x3f2e('0x7b')](_0x3f2e('0xd0'))},_0x4f78af={'count':0x0,'rows':[]};Promise['resolve']()[_0x3f2e('0x18')](function(){if(_0x39bc6b[_0x3f2e('0x21')][_0x3f2e('0xd1')]){if(!_[_0x3f2e('0xd2')](_0x55c2cc,_0x39bc6b['query']['channel']['toLowerCase']())){throw new Error(_0x3f2e('0xd3'));}_0x55c2cc=[_0x39bc6b['query'][_0x3f2e('0xd1')][_0x3f2e('0xd4')]()];}if(_0x39bc6b[_0x3f2e('0x21')][_0x3f2e('0xd5')]){try{var _0x142b46=JSON['parse'](_0x39bc6b['query']['range']);if(!moment(_0x142b46['from'])[_0x3f2e('0xd6')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x142b46['to'])[_0x3f2e('0xd6')]()){throw new Error(_0x3f2e('0xd7'));}}catch(_0x334bf5){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x39bc6b[_0x3f2e('0x21')][_0x3f2e('0x60')](_0x3f2e('0x80'))){_0x4ee479[_0x3f2e('0x14')]=qs[_0x3f2e('0x14')](_0x39bc6b[_0x3f2e('0x21')][_0x3f2e('0x14')]||0xa);_0x4ee479[_0x3f2e('0x12')]=qs[_0x3f2e('0x12')](_0x39bc6b[_0x3f2e('0x21')][_0x3f2e('0x12')]);}var _0x37ceda=_0x55c2cc[_0x3f2e('0x7e')](function(_0x3ed29e){if(_0x3ed29e===_0x3f2e('0xcf')){var _0x33c25e={'attributes':['id',_0x3f2e('0xd8'),_0x3f2e('0x2f'),_0x3f2e('0xd9'),'destination',_0x3f2e('0xda'),_0x3f2e('0xdb'),'endtime',_0x3f2e('0xdc'),_0x3f2e('0xdd'),_0x3f2e('0xde'),_0x3f2e('0xdf'),_0x3f2e('0xe0'),'userThirdDisposition',_0x3f2e('0xe1')],'where':{'ContactId':_0x39bc6b[_0x3f2e('0x25')]['id']},'include':[{'model':db[_0x3f2e('0xc4')],'as':_0x3f2e('0xc4'),'attributes':['id','name','fullname',_0x3f2e('0x2d')]}],'order':[[_0x3f2e('0xde'),_0x3f2e('0xe2')]]};if(_0x39bc6b[_0x3f2e('0x21')][_0x3f2e('0xd5')]){_0x33c25e[_0x3f2e('0x5a')]['createdAt']={'$gte':_0x142b46['from'],'$lte':_0x142b46['to']};}return db['VoiceCallReport'][_0x3f2e('0xe3')](_0x33c25e)[_0x3f2e('0x18')](function(_0x4a4c7b){_0x4f78af[_0x3f2e('0x15')]+=_0x4a4c7b['count'];return _['map'](_0x4a4c7b[_0x3f2e('0x9a')],function(_0x1654c0){var _0x3a3a8c=_0x1654c0[_0x3f2e('0x38')]({'plain':!![]});_0x3a3a8c[_0x3f2e('0xd1')]=_0x3ed29e;if(_0x3a3a8c[_0x3f2e('0xc4')]){_0x3a3a8c[_0x3f2e('0xc4')]={'id':_0x3a3a8c[_0x3f2e('0xc4')]['id'],'name':_0x3a3a8c['User']['name'],'fullname':_0x3a3a8c[_0x3f2e('0xc4')]['fullname'],'alias':_0x3a3a8c[_0x3f2e('0xc4')]['alias']};}return _0x3a3a8c;});});}else{var _0x572fee=_[_0x3f2e('0xe4')](_0x3ed29e)+(_0x3ed29e===_0x3f2e('0xcc')?_0x3f2e('0xe5'):'Account');var _0x145148={'attributes':['id',_0x3f2e('0xe6'),_0x3f2e('0xe7'),_0x3f2e('0xde'),_0x3f2e('0xdd'),'disposition',_0x3f2e('0xe8'),_0x3f2e('0xe9'),_0x3f2e('0xe1'),_0x572fee+'Id'],'where':{'ContactId':_0x39bc6b[_0x3f2e('0x25')]['id']},'include':[{'model':db[_0x572fee],'as':'Account','attributes':['id',_0x3f2e('0x1c'),_0x3f2e('0xea')]},{'model':db[_0x3f2e('0xc4')],'as':_0x3f2e('0xeb'),'attributes':['id',_0x3f2e('0x1c'),_0x3f2e('0xec')]},{'model':db[_0x3f2e('0x63')],'as':_0x3f2e('0x64'),'attributes':['id','name',_0x3f2e('0xed')],'through':{'attributes':[]}}],'order':[[_0x3f2e('0xde'),'DESC']]};if(_0x39bc6b[_0x3f2e('0x21')][_0x3f2e('0xd5')]){_0x145148['where'][_0x3f2e('0xde')]={'$gte':_0x142b46['from'],'$lte':_0x142b46['to']};}switch(_0x3ed29e){case'chat':_0x145148[_0x3f2e('0x78')][_0x3f2e('0x5c')]('browserName',_0x3f2e('0xee'),_0x3f2e('0xef'),_0x3f2e('0xf0'),_0x3f2e('0xf1'),_0x3f2e('0xf2'),'ratingType',_0x3f2e('0xf3'),_0x3f2e('0xf4'));break;case'mail':_0x145148['attributes'][_0x3f2e('0x5c')](_0x3f2e('0xf5'),_0x3f2e('0xf6'));break;case _0x3f2e('0xcd'):_0x145148[_0x3f2e('0x78')][_0x3f2e('0x5c')](_0x3f2e('0xf7'),_0x3f2e('0xf8'));break;}return db[_['startCase'](_0x3ed29e)+_0x3f2e('0xf9')][_0x3f2e('0xe3')](_0x145148)[_0x3f2e('0x18')](function(_0x2d956d){_0x4f78af[_0x3f2e('0x15')]+=_0x2d956d[_0x3f2e('0x15')];return _['map'](_0x2d956d[_0x3f2e('0x9a')],function(_0x3ea2b6){var _0x1b9e98=_0x3ea2b6['get']({'plain':!![]});_0x1b9e98['channel']=_0x3ed29e;if(_0x1b9e98['Owner']){_0x1b9e98[_0x3f2e('0xeb')]={'id':_0x1b9e98[_0x3f2e('0xeb')]['id'],'name':_0x1b9e98['Owner'][_0x3f2e('0x1c')],'fullname':_0x1b9e98['Owner'][_0x3f2e('0xec')]};}return _0x1b9e98;});});}});return Promise[_0x3f2e('0x62')](_0x37ceda);})[_0x3f2e('0x18')](function(_0x20415c){return _(_0x20415c)['flatten']()[_0x3f2e('0xfa')]('createdAt')[_0x3f2e('0xfb')]()['value']();})[_0x3f2e('0x18')](function(_0x5bcd52){_0x4f78af[_0x3f2e('0x9a')]=_0x4ee479[_0x3f2e('0x14')]?_0x5bcd52['slice'](_0x4ee479[_0x3f2e('0x12')],_0x4ee479['offset']+_0x4ee479[_0x3f2e('0x14')]):_0x5bcd52;return _0x4f78af;})['then'](respondWithFilteredResult(_0x2a5588,_0x4ee479))[_0x3f2e('0x22')](handleError(_0x2a5588,null));}; \ No newline at end of file +var _0x2ee6=['bluebird','path','lodash','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment/shared','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','offset','limit','count','Content-Range','json','update','then','destroy','sendStatus','stack','name','index','describe','getOptions','findAll','user','CmContact','find','catch','tags','keys','startsWith','cf_','displayName','query','analytics','CmCustomField','length','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','hasOwnProperty','columnName','merge','body','get','mergeWith','isArray','from','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatMessage','MailInteraction','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','create','join','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','push','ListId','findOrCreate','spread','contact','all','params','Tag','Tags','color','tag','Phones','ContactItemType','sequelize','literal','Phones.OrderBy','$and','omit','map','format','pickBy','table','cm_contacts','id\x20=\x20?','toParam','phone','CmHopper','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','findOne','setTags','ids','OrderBy','item_types','items','ItemTypeId','description','contact\x20phone\x20exists','item','ItemType','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','nolimit','ContactId','options','includeAll','include','rows','CmHopperFinal','getJscriptySessions','binding_keys','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','file','filename','chmodSync','child_process','CompanyId','File\x20uploaded\x20correctly!','pid','send','createReadStream','parse','meta','import','User','agent','binding','No\x20firstName\x20column\x20specified','fork','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','../../components/import/cm/csvUpdates','message','getJourney','mail','chat','sms','openchannel','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','alias','DESC','findAndCountAll','fullname','startCase','Website','closed','thirdDisposition','Owner','browserName','customerIp','customerPort','deviceModel','ratingType','ratingValue','subject','substatus','externalUrl','Interaction','reverse','slice','moment'];(function(_0x3059c9,_0x369424){var _0xb20e2=function(_0x317df5){while(--_0x317df5){_0x3059c9['push'](_0x3059c9['shift']());}};_0xb20e2(++_0x369424);}(_0x2ee6,0xf1));var _0x62ee=function(_0x2655c1,_0x3cd78e){_0x2655c1=_0x2655c1-0x0;var _0x338853=_0x2ee6[_0x2655c1];return _0x338853;};'use strict';var moment=require(_0x62ee('0x0'));var BPromise=require(_0x62ee('0x1'));var util=require('util');var path=require(_0x62ee('0x2'));var fs=require('fs');var _=require(_0x62ee('0x3'));var squel=require('squel');var Papa=require(_0x62ee('0x4'));var Redis=require(_0x62ee('0x5'));var contacts=require('../../components/contacts');var qs=require(_0x62ee('0x6'));var logger=require(_0x62ee('0x7'))('api');var config=require('../../config/environment');var shared=require(_0x62ee('0x8'));var db=require('../../mysqldb')['db'];config[_0x62ee('0x9')]=_[_0x62ee('0xa')](config['redis'],{'host':_0x62ee('0xb'),'port':0x18eb});var socket=require(_0x62ee('0xc'))(new Redis(config[_0x62ee('0x9')]));require(_0x62ee('0xd'))[_0x62ee('0xe')](socket);function respondWithResult(_0x5360b5,_0x3a3b60){_0x3a3b60=_0x3a3b60||0xc8;return function(_0x489ef5){if(_0x489ef5){return _0x5360b5[_0x62ee('0xf')](_0x3a3b60)['json'](_0x489ef5);}};}function respondWithFilteredResult(_0x1ce844,_0x1f6ab5){return function(_0x2e785c){if(_0x2e785c){var _0x596305=typeof _0x1f6ab5[_0x62ee('0x10')]==='undefined'&&typeof _0x1f6ab5[_0x62ee('0x11')]==='undefined';var _0x1cd427=_0x2e785c[_0x62ee('0x12')];var _0x38928f=_0x596305?0x0:_0x1f6ab5[_0x62ee('0x10')];var _0x4a0679=_0x596305?_0x2e785c['count']:_0x1f6ab5[_0x62ee('0x10')]+_0x1f6ab5[_0x62ee('0x11')];var _0x56cedc;if(_0x4a0679>=_0x1cd427){_0x4a0679=_0x1cd427;_0x56cedc=0xc8;}else{_0x56cedc=0xce;}_0x1ce844[_0x62ee('0xf')](_0x56cedc);return _0x1ce844['set'](_0x62ee('0x13'),_0x38928f+'-'+_0x4a0679+'/'+_0x1cd427)[_0x62ee('0x14')](_0x2e785c);}return null;};}function saveUpdates(_0x46fd0e){return function(_0x4001a9){if(_0x4001a9){return _0x4001a9[_0x62ee('0x15')](_0x46fd0e)[_0x62ee('0x16')](function(_0x3d73b1){return _0x3d73b1;});}return null;};}function removeEntity(_0x5c7ac4){return function(_0x266550){if(_0x266550){return _0x266550[_0x62ee('0x17')]()[_0x62ee('0x16')](function(){_0x5c7ac4[_0x62ee('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x319116){return function(_0xdbaefa){if(!_0xdbaefa){_0x319116[_0x62ee('0x18')](0x194);}return _0xdbaefa;};}function handleError(_0x4460b1,_0x2697e9){_0x2697e9=_0x2697e9||0x1f4;return function(_0x5d988b){logger['error'](_0x5d988b[_0x62ee('0x19')]);if(_0x5d988b[_0x62ee('0x1a')]){delete _0x5d988b[_0x62ee('0x1a')];}_0x4460b1[_0x62ee('0xf')](_0x2697e9)['send'](_0x5d988b);};}exports[_0x62ee('0x1b')]=function(_0x73af3f,_0x517959){var _0x1e3445={};return contacts[_0x62ee('0x1c')]()[_0x62ee('0x16')](function(_0x210883){_0x1e3445=qs[_0x62ee('0x1d')](_0x210883,_0x73af3f);return contacts[_0x62ee('0x1e')](_0x73af3f['query'],_0x73af3f[_0x62ee('0x1f')],_0x1e3445,_0x210883);})[_0x62ee('0x16')](respondWithFilteredResult(_0x517959,_0x1e3445))['catch'](handleError(_0x517959,null));};exports[_0x62ee('0x17')]=function(_0x5e225f,_0x259f51){return db[_0x62ee('0x20')][_0x62ee('0x21')]({'where':{'id':_0x5e225f['params']['id']}})['then'](handleEntityNotFound(_0x259f51,null))[_0x62ee('0x16')](removeEntity(_0x259f51,null))[_0x62ee('0x22')](handleError(_0x259f51,null));};exports['describe']=function(_0x537646,_0x3779ff){return db[_0x62ee('0x20')][_0x62ee('0x1c')]()['then'](function(_0x4426fd){delete _0x4426fd[_0x62ee('0x23')];for(var _0x2f3a61=0x0;_0x2f3a610x0){return new Promise(function(_0x3647d9){var _0xd8126c=[];for(var _0x178117=0x0;_0x178117<_0x35f1c2[_0x62ee('0x2b')];_0x178117++){_0xd8126c[_0x62ee('0x59')](insertAdditionalPhones(_0x35f1c2[_0x178117][_0x62ee('0x5d')],_0x35f1c2[_0x178117][_0x62ee('0x53')]));}Promise[_0x62ee('0x5e')](_0xd8126c)['then'](function(){_0x3647d9(0x1);});})[_0x62ee('0x16')](function(){return{'success':_0x222c32,'failure':_0x53578f,'duplicates':_0x46756b};});}else{return{'success':_0x222c32,'failure':_0x53578f,'duplicates':_0x46756b};}}})[_0x62ee('0x16')](respondWithResult(_0x5d3c49,0xc9))[_0x62ee('0x22')](handleError(_0x5d3c49,null));};exports['show']=function(_0x11d67e,_0x1d3e01){var _0x3ce1e2;return db[_0x62ee('0x20')]['describe']()[_0x62ee('0x16')](function(_0x45b706){return db[_0x62ee('0x20')][_0x62ee('0x21')]({'where':{'id':_0x11d67e[_0x62ee('0x5f')]['id']},'include':[{'model':db[_0x62ee('0x60')],'as':_0x62ee('0x61'),'attributes':['id',_0x62ee('0x1a'),_0x62ee('0x62')],'required':_0x11d67e[_0x62ee('0x28')][_0x62ee('0x63')]?!![]:![]},{'model':db[_0x62ee('0x42')],'as':_0x62ee('0x64'),'where':{'CmContactId':_0x11d67e['params']['id']},'required':![],'include':[{'model':db[_0x62ee('0x65')],'as':'ItemType'}]}],'order':[db[_0x62ee('0x66')][_0x62ee('0x67')](_0x62ee('0x68'))],'attributes':_['keys'](_0x45b706)});})[_0x62ee('0x16')](function(_0x2f2cac){if(!_[_0x62ee('0x4f')](_0x2f2cac)){_0x3ce1e2=_0x2f2cac[_0x62ee('0x34')]({'plain':!![]});var _0x5d150d={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2f2cac&&_0x2f2cac['ListId']){if(_0x2f2cac[_0x62ee('0x5a')]){_0x5d150d['where'][_0x62ee('0x69')][_0x62ee('0x59')]({'ListId':{'$ne':_0x2f2cac[_0x62ee('0x5a')]}});}}return db[_0x62ee('0x2a')][_0x62ee('0x1e')](_0x5d150d);}})[_0x62ee('0x16')](function(_0x2dca6b){if(!_[_0x62ee('0x4f')](_0x2dca6b)){return _[_0x62ee('0x6a')](_0x3ce1e2,_[_0x62ee('0x6b')](_0x2dca6b,function(_0x38e555){return util[_0x62ee('0x6c')]('cf_%d',_0x38e555['id']);}));}})['then'](handleEntityNotFound(_0x1d3e01,null))[_0x62ee('0x16')](respondWithResult(_0x1d3e01,null))[_0x62ee('0x22')](handleError(_0x1d3e01,null));};exports['update']=function(_0x1f0313,_0x1ee6ac){var _0x4eaa47;if(_0x1f0313['body']['id']){delete _0x1f0313[_0x62ee('0x33')]['id'];}if(!_[_0x62ee('0x4f')](_0x1f0313['body'][_0x62ee('0x50')])){var _0x351b0f=_0x1f0313[_0x62ee('0x33')]['dialTimezone'];if(!_[_0x62ee('0x4f')](shared['timezones'][_0x351b0f]))_0x1f0313[_0x62ee('0x33')]['utcOffset']=shared[_0x62ee('0x51')][_0x351b0f]['utcOffset'];}return db[_0x62ee('0x20')]['find']({'where':{'id':_0x1f0313[_0x62ee('0x5f')]['id']}})[_0x62ee('0x16')](handleEntityNotFound(_0x1ee6ac,null))['then'](saveUpdates(_0x1f0313['body'],null))[_0x62ee('0x16')](function(_0x4bca0e){_0x4eaa47=_0x4bca0e;var _0xc5f34d={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4bca0e&&_0x4bca0e[_0x62ee('0x5a')]){if(_0x4bca0e[_0x62ee('0x5a')]){_0xc5f34d[_0x62ee('0x57')][_0x62ee('0x69')][_0x62ee('0x59')]({'ListId':{'$ne':_0x4bca0e[_0x62ee('0x5a')]}});}}return db[_0x62ee('0x2a')][_0x62ee('0x1e')](_0xc5f34d);})[_0x62ee('0x16')](function(_0x4cc07d){if(_0x4cc07d){return _[_0x62ee('0x6a')](_[_0x62ee('0x6d')](_0x1f0313[_0x62ee('0x33')],function(_0x33034b,_0x392582){return _[_0x62ee('0x25')](_0x392582,_0x62ee('0x26'));}),_[_0x62ee('0x6b')](_0x4cc07d,function(_0x329b22){return util['format']('cf_%d',_0x329b22['id']);}));}})[_0x62ee('0x16')](function(_0xe53b68){if(_0xe53b68&&!_['isEmpty'](_0xe53b68)){var _0x5e0d71=squel[_0x62ee('0x15')]()[_0x62ee('0x6e')](_0x62ee('0x6f'))['setFields'](_0xe53b68)[_0x62ee('0x57')](_0x62ee('0x70'),_0x1f0313[_0x62ee('0x5f')]['id'])[_0x62ee('0x71')]();return db[_0x62ee('0x66')][_0x62ee('0x28')](_0x5e0d71['text'],{'replacements':_0x5e0d71[_0x62ee('0x2d')]});}})[_0x62ee('0x16')](function(){if(_0x1f0313[_0x62ee('0x33')][_0x62ee('0x72')]&&_0x4eaa47){return db[_0x62ee('0x73')][_0x62ee('0x15')]({'phone':_0x1f0313[_0x62ee('0x33')][_0x62ee('0x72')],'OrderBy':0x0},{'where':{'ContactId':_0x4eaa47['id']}});}})[_0x62ee('0x16')](function(){return _0x4eaa47;})[_0x62ee('0x16')](respondWithResult(_0x1ee6ac,null))[_0x62ee('0x22')](handleError(_0x1ee6ac,null));};exports[_0x62ee('0x74')]=function(_0x42e57c,_0x1f9754){var _0x234626={};var _0x3cd3a8={};var _0x1edfc7;var _0x5185c3;return db[_0x62ee('0x20')]['findOne']({'where':{'id':_0x42e57c[_0x62ee('0x5f')]['id']}})[_0x62ee('0x16')](handleEntityNotFound(_0x1f9754,null))[_0x62ee('0x16')](function(_0x530721){if(_0x530721){_0x1edfc7=_0x530721;_0x3cd3a8[_0x62ee('0x75')]=_['keys'](db[_0x62ee('0x60')][_0x62ee('0x76')]);_0x3cd3a8['query']=_[_0x62ee('0x24')](_0x42e57c[_0x62ee('0x28')]);_0x3cd3a8[_0x62ee('0x77')]=_[_0x62ee('0x78')](_0x3cd3a8[_0x62ee('0x75')],_0x3cd3a8[_0x62ee('0x28')]);_0x234626[_0x62ee('0x79')]=_[_0x62ee('0x78')](_0x3cd3a8[_0x62ee('0x75')],qs['fields'](_0x42e57c[_0x62ee('0x28')][_0x62ee('0x7a')]));_0x234626[_0x62ee('0x79')]=_0x234626['attributes']['length']?_0x234626[_0x62ee('0x79')]:_0x3cd3a8['model'];_0x234626[_0x62ee('0x7b')]=qs[_0x62ee('0x7c')](_0x42e57c[_0x62ee('0x28')]['sort']);_0x234626[_0x62ee('0x57')]=qs[_0x62ee('0x77')](_[_0x62ee('0x7d')](_0x42e57c[_0x62ee('0x28')],_0x3cd3a8[_0x62ee('0x77')]));if(_0x42e57c['query'][_0x62ee('0x7e')]){_0x234626[_0x62ee('0x57')]=_[_0x62ee('0x32')](_0x234626[_0x62ee('0x57')],{'$or':_[_0x62ee('0x6b')](_0x234626[_0x62ee('0x79')],function(_0x16ef7e){var _0x30daca={};_0x30daca[_0x16ef7e]={'$like':'%'+_0x42e57c[_0x62ee('0x28')][_0x62ee('0x7e')]+'%'};return _0x30daca;})});}_0x234626=_[_0x62ee('0x32')]({},_0x234626,_0x42e57c['options']);return _0x1edfc7[_0x62ee('0x74')](_0x234626);}})[_0x62ee('0x16')](function(_0x231f1c){if(_0x231f1c){_0x5185c3=_0x231f1c[_0x62ee('0x2b')];if(!_0x42e57c[_0x62ee('0x28')][_0x62ee('0x30')]('nolimit')){_0x234626[_0x62ee('0x11')]=qs[_0x62ee('0x11')](_0x42e57c[_0x62ee('0x28')][_0x62ee('0x11')]);_0x234626['offset']=qs[_0x62ee('0x10')](_0x42e57c[_0x62ee('0x28')][_0x62ee('0x10')]);}return _0x1edfc7[_0x62ee('0x74')](_0x234626);}})['then'](function(_0x3fff1d){if(_0x3fff1d){return _0x3fff1d?{'count':_0x5185c3,'rows':_0x3fff1d}:null;}})[_0x62ee('0x16')](respondWithResult(_0x1f9754,null))['catch'](handleError(_0x1f9754,null));};exports['setTags']=function(_0x15c955,_0x438286){if(_0x15c955[_0x62ee('0x33')]['id']){delete _0x15c955[_0x62ee('0x33')]['id'];}return db['CmContact'][_0x62ee('0x7f')]({'where':{'id':_0x15c955[_0x62ee('0x5f')]['id']}})[_0x62ee('0x16')](handleEntityNotFound(_0x438286,null))[_0x62ee('0x16')](function(_0x43f5fc){if(_0x43f5fc){return _0x43f5fc[_0x62ee('0x80')](_0x15c955['body'][_0x62ee('0x81')]||[]);}return null;})[_0x62ee('0x16')](respondWithResult(_0x438286,null))[_0x62ee('0x22')](handleError(_0x438286,null));};exports['setAdditionalPhones']=function(_0x1f8407,_0x39526c){var _0x2827ca=[];_0x2827ca['push'](addAdditionalPhones(_0x1f8407[_0x62ee('0x33')]));Promise[_0x62ee('0x5e')](_0x2827ca)[_0x62ee('0x16')](function(){_0x2827ca=[];_0x2827ca[_0x62ee('0x59')](deleteCmHopperPhones(_0x1f8407[_0x62ee('0x33')]['id']));_0x2827ca[_0x62ee('0x59')](addCmHopperPhones(_0x1f8407[_0x62ee('0x33')]['id']));Promise[_0x62ee('0x5e')](_0x2827ca)[_0x62ee('0x16')](function(){return[0x1];})[_0x62ee('0x16')](respondWithResult(_0x39526c,null));});};function addAdditionalPhones(_0x4862f8){var _0x2a3c88;return new Promise(function(_0x5d10fc){return db[_0x62ee('0x42')][_0x62ee('0x17')]({'where':{'CmContactId':_0x4862f8['id']}})['then'](function(){db[_0x62ee('0x65')][_0x62ee('0x1e')]({'raw':!![],'attributes':['id',_0x62ee('0x82')]})[_0x62ee('0x16')](function(_0x4c5ecb){var _0x1c6141=[];for(var _0x43d6f1=0x0;_0x43d6f1<_0x4862f8['items'][_0x62ee('0x2b')];_0x43d6f1++){var _0x524044=_0x4862f8[_0x62ee('0x83')]?_[_0x62ee('0x4f')](_0x4862f8[_0x62ee('0x83')][_0x43d6f1])?'':_0x4862f8['item_types'][_0x43d6f1]:_0x4862f8[_0x62ee('0x84')][_0x43d6f1][_0x62ee('0x85')]?_0x4862f8[_0x62ee('0x84')][_0x43d6f1][_0x62ee('0x85')]:'';var _0x1ef784=_[_0x62ee('0x4f')](_0x4862f8[_0x62ee('0x84')][_0x43d6f1]['description'])?'':_0x4862f8[_0x62ee('0x84')][_0x43d6f1][_0x62ee('0x86')];var _0x413ac9=_0x524044+':'+_0x4862f8[_0x62ee('0x84')][_0x43d6f1][_0x62ee('0x72')]+'§'+_0x1ef784;if(_['isNil'](_0x2a3c88))_0x2a3c88=_0x413ac9;else _0x2a3c88+=';'+_0x413ac9;var _0xe11bb0=null;var _0x52e5b4=null;if(_0x4862f8[_0x62ee('0x83')]){if(!_[_0x62ee('0x4f')](_0x4862f8[_0x62ee('0x83')][_0x43d6f1])){_0x52e5b4=_['find'](_0x4c5ecb,function(_0x2fffeb){return _0x2fffeb['id']===_0x4862f8[_0x62ee('0x83')][_0x43d6f1];});if(!_[_0x62ee('0x4f')](_0x52e5b4)){_0xe11bb0=_0x52e5b4[_0x62ee('0x82')];}}}else{if(!_[_0x62ee('0x4f')](_0x4862f8[_0x62ee('0x84')][_0x43d6f1])){_0x52e5b4=_['find'](_0x4c5ecb,function(_0x271244){return _0x271244['id']===_0x4862f8[_0x62ee('0x84')][_0x43d6f1][_0x62ee('0x85')];});if(!_[_0x62ee('0x4f')](_0x52e5b4)){_0xe11bb0=_0x43d6f1;}}}if(_[_0x62ee('0x4f')](_0xe11bb0)){_0xe11bb0=0x64;}_0x1c6141[_0x62ee('0x59')](addAdditionalPhone(_0x4862f8['id'],_0x4862f8[_0x62ee('0x84')][_0x43d6f1][_0x62ee('0x72')],_0x4862f8[_0x62ee('0x83')]?_[_0x62ee('0x4f')](_0x4862f8['item_types'][_0x43d6f1])?null:_0x4862f8[_0x62ee('0x83')][_0x43d6f1]:_0x4862f8[_0x62ee('0x84')][_0x43d6f1]['ItemTypeId']?_0x4862f8[_0x62ee('0x84')][_0x43d6f1]['ItemTypeId']:null,_0xe11bb0,_0x1ef784));}Promise[_0x62ee('0x5e')](_0x1c6141)[_0x62ee('0x16')](function(){db[_0x62ee('0x20')]['update']({'AdditionalPhones':_0x2a3c88},{'where':{'id':_0x4862f8['id']}})[_0x62ee('0x16')](function(){_0x5d10fc(0x1);});});});});});}function addAdditionalPhone(_0x4bf7d0,_0x4dc9c4,_0x19f487,_0x3f794e,_0x407f26){return db[_0x62ee('0x42')][_0x62ee('0x21')]({'where':{'CmContactId':_0x4bf7d0,'item':_0x4dc9c4}})[_0x62ee('0x16')](function(_0x29f2c3){if(_0x29f2c3)logger[_0x62ee('0x2e')](_0x62ee('0x87'),_0x29f2c3);else{db[_0x62ee('0x42')][_0x62ee('0x4d')]({'CmContactId':_0x4bf7d0,'item':_0x4dc9c4,'ItemTypeId':_0x19f487,'OrderBy':_0x3f794e,'ItemClass':'PHONE','description':_0x407f26});}});}function deleteCmHopperPhones(_0x2fbd72){return new Promise(function(_0x5cd53e){return db[_0x62ee('0x73')][_0x62ee('0x1e')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2fbd72}})[_0x62ee('0x16')](function(_0x38db73){db['CmHopperAdditionalPhone']['destroy']({'where':{'CmHopperId':{'$in':_[_0x62ee('0x6b')](_0x38db73,'id')}}});})[_0x62ee('0x16')](function(){_0x5cd53e(0x1);});});}function addCmHopperPhones(_0xdd2e97){return new Promise(function(_0x5cbe96){return db[_0x62ee('0x73')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0xdd2e97}})[_0x62ee('0x16')](function(_0x3fe8f8){var _0x16aa23=[];_['map'](_0x3fe8f8,function(_0x3e5346){_0x16aa23['push'](createCmHopperPhone(_0xdd2e97,_0x3e5346['id']));});Promise[_0x62ee('0x5e')](_0x16aa23)[_0x62ee('0x16')](function(){_0x5cbe96(0x1);});});});}function createCmHopperPhone(_0xa7eafd,_0x5b3e12){return new Promise(function(_0x47c6ea){db[_0x62ee('0x42')]['findAll']({'raw':!![],'attributes':[_0x62ee('0x88'),_0x62ee('0x82')],'where':{'CmContactId':_0xa7eafd,'ItemClass':'PHONE'},'include':[{'model':db['ContactItemType'],'attributes':[_0x62ee('0x82')],'as':_0x62ee('0x89')}],'order':[_0x62ee('0x82'),db[_0x62ee('0x66')][_0x62ee('0x67')](_0x62ee('0x8a'))]})[_0x62ee('0x16')](function(_0x5b5318){var _0x41f8d4=0x1;var _0x3255fa=_[_0x62ee('0x6b')](_0x5b5318,function(_0x4bfaad){_0x4bfaad[_0x62ee('0x8b')]=_0x5b3e12;_0x4bfaad['phone']=_0x4bfaad[_0x62ee('0x88')];_0x4bfaad['OrderBy']=_0x41f8d4;delete _0x4bfaad[_0x62ee('0x8c')];_0x41f8d4=_0x41f8d4+0x1;return _0x4bfaad;});return db['CmHopperAdditionalPhone'][_0x62ee('0x54')](_0x3255fa,{});})[_0x62ee('0x16')](function(){_0x47c6ea(0x1);});});}function insertAdditionalPhones(_0x33ba3a,_0x52f4a0){return new Promise(function(_0x165b2a){var _0x414722=[];for(var _0xb2e168=0x0;_0xb2e168<_0x52f4a0[_0x62ee('0x2b')];_0xb2e168++){var _0xe0e4a7=_0x52f4a0[_0xb2e168];_0x414722['push'](parseContactItemType(_0xe0e4a7));}Promise['all'](_0x414722)['then'](function(){var _0x472ccb={'id':_0x33ba3a['id'],'items':_0x52f4a0};return addAdditionalPhones(_0x472ccb)[_0x62ee('0x16')](function(){return addCmHopperPhones(_0x33ba3a['id']);});})['then'](function(){_0x165b2a(_0x33ba3a);});});}function parseContactItemType(_0x497565){return new Promise(function(_0x2408b9){if(_0x497565['hasOwnProperty'](_0x62ee('0x85'))){_0x2408b9(_0x497565);}else{return db[_0x62ee('0x65')]['find']({'where':{'name':_0x497565['ItemType']}})['then'](function(_0x2b976e){if(_[_0x62ee('0x4f')](_0x2b976e))_0x497565[_0x62ee('0x85')]=null;else _0x497565['ItemTypeId']=_0x2b976e['id'];_0x2408b9(_0x497565);});}});}exports[_0x62ee('0x8d')]=function(_0x116e1b,_0x23b55d){return db['CmContactHasItem'][_0x62ee('0x1e')]({'raw':!![],'where':{'CmContactId':_0x116e1b[_0x62ee('0x5f')]['id'],'ItemClass':'PHONE'},'include':[{'model':db['ContactItemType'],'as':_0x62ee('0x89')}],'order':[[_0x62ee('0x82')],[db['sequelize']['literal'](_0x62ee('0x8a'))]]})[_0x62ee('0x16')](function(_0x4f9cf3){return _0x4f9cf3;})[_0x62ee('0x16')](respondWithResult(_0x23b55d,null))[_0x62ee('0x22')](handleError(_0x23b55d,null));};exports[_0x62ee('0x8e')]=function(_0x4229bb,_0x4f5652){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x4229bb['body'][_0x62ee('0x8f')]}})[_0x62ee('0x16')](function(_0x3610bc){var _0x47caa1=_['map'](_0x3610bc,function(_0xea3fa){_0xea3fa[_0x62ee('0x90')]=_0x4229bb[_0x62ee('0x33')][_0x62ee('0x91')];return _0xea3fa;});return db[_0x62ee('0x42')][_0x62ee('0x54')](_0x47caa1,{});})[_0x62ee('0x16')](function(){return addCmHopperPhones(_0x4229bb[_0x62ee('0x33')][_0x62ee('0x91')]);})[_0x62ee('0x16')](function(){return['ok'];})[_0x62ee('0x16')](respondWithResult(_0x4f5652,null))[_0x62ee('0x22')](handleError(_0x4f5652,null));};exports[_0x62ee('0x92')]=function(_0x61a6d9,_0x407522){var _0x203dcc=[];_0x203dcc[_0x62ee('0x59')](createCmHopperPhone(_0x61a6d9['body']['id'],_0x61a6d9['body'][_0x62ee('0x93')]));Promise[_0x62ee('0x5e')](_0x203dcc)[_0x62ee('0x16')](function(){return[0x1];})[_0x62ee('0x16')](respondWithResult(_0x407522,null));};exports[_0x62ee('0x94')]=function(_0x5d1f20,_0x2fa749){var _0x20c48f={'raw':![],'where':{}};var _0x65a86f={};var _0x416e5b={'count':0x0,'rows':[]};return db[_0x62ee('0x20')][_0x62ee('0x7f')]({'where':{'id':_0x5d1f20[_0x62ee('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2fa749,null))[_0x62ee('0x16')](function(_0x566bb8){if(_0x566bb8){_0x65a86f[_0x62ee('0x75')]=_[_0x62ee('0x24')](db[_0x62ee('0x73')]['rawAttributes']);_0x65a86f[_0x62ee('0x28')]=_[_0x62ee('0x24')](_0x5d1f20[_0x62ee('0x28')]);_0x65a86f[_0x62ee('0x77')]=_['intersection'](_0x65a86f[_0x62ee('0x75')],_0x65a86f[_0x62ee('0x28')]);_0x20c48f[_0x62ee('0x79')]=_[_0x62ee('0x78')](_0x65a86f['model'],qs[_0x62ee('0x7a')](_0x5d1f20['query'][_0x62ee('0x7a')]));_0x20c48f['attributes']=_0x20c48f['attributes'][_0x62ee('0x2b')]?_0x20c48f['attributes']:_0x65a86f[_0x62ee('0x75')];if(!_0x5d1f20[_0x62ee('0x28')]['hasOwnProperty'](_0x62ee('0x95'))){_0x20c48f[_0x62ee('0x11')]=qs[_0x62ee('0x11')](_0x5d1f20['query']['limit']);_0x20c48f[_0x62ee('0x10')]=qs[_0x62ee('0x10')](_0x5d1f20[_0x62ee('0x28')][_0x62ee('0x10')]);}_0x20c48f[_0x62ee('0x7b')]=qs[_0x62ee('0x7c')](_0x5d1f20['query'][_0x62ee('0x7c')]);_0x20c48f[_0x62ee('0x57')]=qs[_0x62ee('0x77')](_[_0x62ee('0x7d')](_0x5d1f20[_0x62ee('0x28')],_0x65a86f[_0x62ee('0x77')]));_0x20c48f[_0x62ee('0x57')][_0x62ee('0x96')]=_0x566bb8['id'];if(_0x5d1f20[_0x62ee('0x28')][_0x62ee('0x7e')]){_0x20c48f[_0x62ee('0x57')]=_[_0x62ee('0x32')](_0x20c48f['where'],{'$or':_[_0x62ee('0x6b')](_0x20c48f[_0x62ee('0x79')],function(_0x35f1be){var _0x2d9c53={};_0x2d9c53[_0x35f1be]={'$like':'%'+_0x5d1f20[_0x62ee('0x28')][_0x62ee('0x7e')]+'%'};return _0x2d9c53;})});}_0x20c48f=_[_0x62ee('0x32')]({},_0x20c48f,_0x5d1f20[_0x62ee('0x97')]);return db['CmHopper'][_0x62ee('0x12')]({'where':_0x20c48f[_0x62ee('0x57')]})[_0x62ee('0x16')](function(_0x423ed8){_0x416e5b[_0x62ee('0x12')]=_0x423ed8;if(_0x5d1f20[_0x62ee('0x28')][_0x62ee('0x98')]){_0x20c48f[_0x62ee('0x99')]=[{'all':!![]}];}return db[_0x62ee('0x73')][_0x62ee('0x1e')](_0x20c48f);})[_0x62ee('0x16')](function(_0x3b3b57){_0x416e5b[_0x62ee('0x9a')]=_0x3b3b57;return _0x416e5b;});}})['then'](respondWithFilteredResult(_0x2fa749,_0x20c48f))[_0x62ee('0x22')](handleError(_0x2fa749,null));};exports['getHopperHistories']=function(_0x1e6e1b,_0x1d6a49){var _0x109a7e={'raw':!![],'where':{}};var _0x33ffe3={};var _0x3a92d7={'count':0x0,'rows':[]};return db[_0x62ee('0x20')][_0x62ee('0x7f')]({'where':{'id':_0x1e6e1b[_0x62ee('0x5f')]['id']}})[_0x62ee('0x16')](handleEntityNotFound(_0x1d6a49,null))[_0x62ee('0x16')](function(_0xa2cdc9){if(_0xa2cdc9){_0x33ffe3[_0x62ee('0x75')]=_['keys'](db['CmHopperHistory'][_0x62ee('0x76')]);_0x33ffe3[_0x62ee('0x28')]=_[_0x62ee('0x24')](_0x1e6e1b[_0x62ee('0x28')]);_0x33ffe3[_0x62ee('0x77')]=_['intersection'](_0x33ffe3[_0x62ee('0x75')],_0x33ffe3[_0x62ee('0x28')]);_0x109a7e[_0x62ee('0x79')]=_['intersection'](_0x33ffe3['model'],qs[_0x62ee('0x7a')](_0x1e6e1b[_0x62ee('0x28')]['fields']));_0x109a7e[_0x62ee('0x79')]=_0x109a7e[_0x62ee('0x79')]['length']?_0x109a7e['attributes']:_0x33ffe3[_0x62ee('0x75')];if(!_0x1e6e1b[_0x62ee('0x28')][_0x62ee('0x30')](_0x62ee('0x95'))){_0x109a7e['limit']=qs[_0x62ee('0x11')](_0x1e6e1b[_0x62ee('0x28')][_0x62ee('0x11')]);_0x109a7e['offset']=qs[_0x62ee('0x10')](_0x1e6e1b[_0x62ee('0x28')]['offset']);}_0x109a7e[_0x62ee('0x7b')]=qs['sort'](_0x1e6e1b[_0x62ee('0x28')]['sort']);_0x109a7e[_0x62ee('0x57')]=qs[_0x62ee('0x77')](_[_0x62ee('0x7d')](_0x1e6e1b['query'],_0x33ffe3[_0x62ee('0x77')]));_0x109a7e[_0x62ee('0x57')][_0x62ee('0x96')]=_0xa2cdc9['id'];if(_0x1e6e1b['query'][_0x62ee('0x7e')]){_0x109a7e[_0x62ee('0x57')]=_[_0x62ee('0x32')](_0x109a7e[_0x62ee('0x57')],{'$or':_['map'](_0x109a7e[_0x62ee('0x79')],function(_0x172add){var _0x409b75={};_0x409b75[_0x172add]={'$like':'%'+_0x1e6e1b[_0x62ee('0x28')][_0x62ee('0x7e')]+'%'};return _0x409b75;})});}_0x109a7e=_[_0x62ee('0x32')]({},_0x109a7e,_0x1e6e1b[_0x62ee('0x97')]);return db[_0x62ee('0x43')]['count']({'where':_0x109a7e[_0x62ee('0x57')]})[_0x62ee('0x16')](function(_0x39c1e4){_0x3a92d7['count']=_0x39c1e4;if(_0x1e6e1b[_0x62ee('0x28')]['includeAll']){_0x109a7e['include']=[{'all':!![]}];}return db[_0x62ee('0x43')][_0x62ee('0x1e')](_0x109a7e);})['then'](function(_0x426684){_0x3a92d7[_0x62ee('0x9a')]=_0x426684;return _0x3a92d7;});}})[_0x62ee('0x16')](respondWithFilteredResult(_0x1d6a49,_0x109a7e))[_0x62ee('0x22')](handleError(_0x1d6a49,null));};exports['getHopperFinals']=function(_0x2937f4,_0x3d845a){var _0x24244b={'raw':!![],'where':{}};var _0xa75254={};var _0x22e0f4={'count':0x0,'rows':[]};return db[_0x62ee('0x20')][_0x62ee('0x7f')]({'where':{'id':_0x2937f4[_0x62ee('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3d845a,null))['then'](function(_0x3566cf){if(_0x3566cf){_0xa75254[_0x62ee('0x75')]=_['keys'](db[_0x62ee('0x9b')][_0x62ee('0x76')]);_0xa75254[_0x62ee('0x28')]=_[_0x62ee('0x24')](_0x2937f4[_0x62ee('0x28')]);_0xa75254[_0x62ee('0x77')]=_['intersection'](_0xa75254[_0x62ee('0x75')],_0xa75254[_0x62ee('0x28')]);_0x24244b['attributes']=_[_0x62ee('0x78')](_0xa75254[_0x62ee('0x75')],qs[_0x62ee('0x7a')](_0x2937f4[_0x62ee('0x28')]['fields']));_0x24244b[_0x62ee('0x79')]=_0x24244b[_0x62ee('0x79')][_0x62ee('0x2b')]?_0x24244b[_0x62ee('0x79')]:_0xa75254['model'];if(!_0x2937f4['query']['hasOwnProperty'](_0x62ee('0x95'))){_0x24244b['limit']=qs[_0x62ee('0x11')](_0x2937f4[_0x62ee('0x28')][_0x62ee('0x11')]);_0x24244b[_0x62ee('0x10')]=qs[_0x62ee('0x10')](_0x2937f4['query'][_0x62ee('0x10')]);}_0x24244b['order']=qs[_0x62ee('0x7c')](_0x2937f4[_0x62ee('0x28')][_0x62ee('0x7c')]);_0x24244b['where']=qs[_0x62ee('0x77')](_[_0x62ee('0x7d')](_0x2937f4[_0x62ee('0x28')],_0xa75254['filters']));_0x24244b[_0x62ee('0x57')]['ContactId']=_0x3566cf['id'];if(_0x2937f4[_0x62ee('0x28')][_0x62ee('0x7e')]){_0x24244b[_0x62ee('0x57')]=_['merge'](_0x24244b[_0x62ee('0x57')],{'$or':_['map'](_0x24244b[_0x62ee('0x79')],function(_0x244128){var _0x385856={};_0x385856[_0x244128]={'$like':'%'+_0x2937f4['query'][_0x62ee('0x7e')]+'%'};return _0x385856;})});}_0x24244b=_[_0x62ee('0x32')]({},_0x24244b,_0x2937f4[_0x62ee('0x97')]);return db['CmHopperFinal'][_0x62ee('0x12')]({'where':_0x24244b[_0x62ee('0x57')]})[_0x62ee('0x16')](function(_0x4a7fb9){_0x22e0f4[_0x62ee('0x12')]=_0x4a7fb9;if(_0x2937f4[_0x62ee('0x28')][_0x62ee('0x98')]){_0x24244b[_0x62ee('0x99')]=[{'all':!![]}];}return db[_0x62ee('0x9b')][_0x62ee('0x1e')](_0x24244b);})[_0x62ee('0x16')](function(_0x41dda9){_0x22e0f4[_0x62ee('0x9a')]=_0x41dda9;return _0x22e0f4;});}})[_0x62ee('0x16')](respondWithFilteredResult(_0x3d845a,_0x24244b))[_0x62ee('0x22')](handleError(_0x3d845a,null));};exports[_0x62ee('0x9c')]=function(_0x2a6bd1,_0x29f93d){var _0x3fc162={'raw':!![],'where':{}};var _0x338686={};var _0x18604d={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x2a6bd1[_0x62ee('0x5f')]['id']}})[_0x62ee('0x16')](handleEntityNotFound(_0x29f93d,null))[_0x62ee('0x16')](function(_0x1760e1){if(_0x1760e1){_0x338686[_0x62ee('0x75')]=_['keys'](db['JscriptySessionReport']['rawAttributes']);_0x338686[_0x62ee('0x28')]=_[_0x62ee('0x24')](_0x2a6bd1[_0x62ee('0x28')]);_0x338686['filters']=_[_0x62ee('0x78')](_0x338686[_0x62ee('0x75')],_0x338686[_0x62ee('0x28')]);_0x3fc162[_0x62ee('0x79')]=_[_0x62ee('0x78')](_0x338686['model'],qs[_0x62ee('0x7a')](_0x2a6bd1[_0x62ee('0x28')]['fields']));_0x3fc162[_0x62ee('0x79')]=_0x3fc162[_0x62ee('0x79')][_0x62ee('0x2b')]?_0x3fc162[_0x62ee('0x79')]:_0x338686[_0x62ee('0x75')];if(!_0x2a6bd1['query'][_0x62ee('0x30')]('nolimit')){_0x3fc162[_0x62ee('0x11')]=qs[_0x62ee('0x11')](_0x2a6bd1['query'][_0x62ee('0x11')]);_0x3fc162['offset']=qs['offset'](_0x2a6bd1[_0x62ee('0x28')][_0x62ee('0x10')]);}_0x3fc162['order']=qs[_0x62ee('0x7c')](_0x2a6bd1['query'][_0x62ee('0x7c')]);_0x3fc162[_0x62ee('0x57')]=qs[_0x62ee('0x77')](_[_0x62ee('0x7d')](_0x2a6bd1[_0x62ee('0x28')],_0x338686[_0x62ee('0x77')]));_0x3fc162[_0x62ee('0x57')][_0x62ee('0x96')]=_0x1760e1['id'];if(_0x2a6bd1[_0x62ee('0x28')][_0x62ee('0x7e')]){_0x3fc162[_0x62ee('0x57')]=_[_0x62ee('0x32')](_0x3fc162['where'],{'$or':_[_0x62ee('0x6b')](_0x3fc162['attributes'],function(_0x3f8c47){var _0x7957f0={};_0x7957f0[_0x3f8c47]={'$like':'%'+_0x2a6bd1[_0x62ee('0x28')][_0x62ee('0x7e')]+'%'};return _0x7957f0;})});}_0x3fc162=_['merge']({},_0x3fc162,_0x2a6bd1[_0x62ee('0x97')]);return db[_0x62ee('0x49')]['count']({'where':_0x3fc162[_0x62ee('0x57')]})[_0x62ee('0x16')](function(_0x2e15e4){_0x18604d['count']=_0x2e15e4;if(_0x2a6bd1[_0x62ee('0x28')][_0x62ee('0x98')]){_0x3fc162[_0x62ee('0x99')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x62ee('0x1e')](_0x3fc162);})[_0x62ee('0x16')](function(_0x5a5dc6){_0x18604d[_0x62ee('0x9a')]=_0x5a5dc6;return _0x18604d;});}})[_0x62ee('0x16')](respondWithFilteredResult(_0x29f93d,_0x3fc162))['catch'](handleError(_0x29f93d,null));};exports['uploadCsv']=function(_0x4b8e90,_0x362ec9){try{if(!_0x4b8e90['body'][_0x62ee('0x5a')]){throw new Error('No\x20ListId\x20specified');}if(!_0x4b8e90[_0x62ee('0x33')][_0x62ee('0x9d')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x4b8e90[_0x62ee('0x33')][_0x62ee('0x9e')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x4b8e90['body'][_0x62ee('0x9f')]){throw new Error(_0x62ee('0xa0'));}var _0x2484b8=_0x4b8e90[_0x62ee('0x33')]['binding_keys'][_0x62ee('0xa1')](',');var _0x519f34=_0x4b8e90[_0x62ee('0x33')][_0x62ee('0x9e')][_0x62ee('0xa1')](',');if(!_0x2484b8['length']||!_0x519f34['length']||_0x2484b8[_0x62ee('0x2b')]!==_0x519f34[_0x62ee('0x2b')]){throw new Error(_0x62ee('0xa2'));}_0x4b8e90[_0x62ee('0x33')][_0x62ee('0x7a')]=_[_0x62ee('0xa3')](_0x2484b8,_0x519f34);if(!_0x4b8e90[_0x62ee('0x33')]['fields'][_0x62ee('0x72')]){throw new Error(_0x62ee('0xa4'));}if(!_0x4b8e90['body'][_0x62ee('0x7a')][_0x62ee('0xa5')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x151ad7=path[_0x62ee('0x4e')](config[_0x62ee('0xa6')],_0x62ee('0xa7'),_0x4b8e90[_0x62ee('0xa8')][_0x62ee('0xa9')]);fs[_0x62ee('0xaa')](_0x151ad7,parseInt('0777',0x8));var _0x2474b1=require(_0x62ee('0xab'))['fork'](path[_0x62ee('0x4e')](__dirname,'../../components/import/cm/csv'),[_0x151ad7,_0x4b8e90['body'][_0x62ee('0x9d')],_0x4b8e90['body'][_0x62ee('0x9e')],_0x4b8e90[_0x62ee('0x33')]['ListId'],_0x4b8e90[_0x62ee('0x33')][_0x62ee('0xac')],_0x4b8e90[_0x62ee('0x33')][_0x62ee('0x56')],_0x4b8e90['body']['socket_timestamp']]);return _0x362ec9[_0x62ee('0xf')](0xc8)[_0x62ee('0x14')]({'message':_0x62ee('0xad'),'pid':_0x2474b1[_0x62ee('0xae')]});}catch(_0x273e8a){return _0x362ec9['status'](0x1f4)[_0x62ee('0xaf')](_0x273e8a);}};exports['upload']=function(_0x4c5df5,_0x4dc21d){var _0x58470b=fs[_0x62ee('0xb0')](_0x4c5df5[_0x62ee('0xa8')][_0x62ee('0x2')]);Papa[_0x62ee('0xb1')](_0x58470b,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x42777b){return _0x4dc21d[_0x62ee('0xf')](0xc8)[_0x62ee('0x14')]({'file':_0x4c5df5[_0x62ee('0xa8')],'fields':_0x42777b[_0x62ee('0xb2')][_0x62ee('0x7a')]});}});};exports[_0x62ee('0xb3')]=function(_0x46e814,_0x1a518c){return db[_0x62ee('0xb4')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x62ee('0xb5')}})[_0x62ee('0x16')](function(_0x2973ed){var _0x6ae516=![];if(!_0x46e814['body']['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x46e814[_0x62ee('0x33')][_0x62ee('0xb6')][_0x62ee('0x72')]){throw new Error(_0x62ee('0xa4'));}if(!_0x46e814[_0x62ee('0x33')]['binding'][_0x62ee('0xa5')]){throw new Error(_0x62ee('0xb7'));}if(!_0x46e814[_0x62ee('0x33')][_0x62ee('0x9f')]){throw new Error(_0x62ee('0xa0'));}var _0x13173f=require(_0x62ee('0xab'))[_0x62ee('0xb8')](path[_0x62ee('0x4e')](__dirname,_0x62ee('0xb9')),[_0x46e814[_0x62ee('0x5f')]['id'],JSON[_0x62ee('0xba')](_0x46e814[_0x62ee('0x33')]),JSON[_0x62ee('0xba')](_0x2973ed)]);_0x13173f['on']('message',function(){_0x6ae516=!![];return _0x1a518c[_0x62ee('0xf')](0xc8)[_0x62ee('0x14')]({'message':_0x62ee('0xbb'),'pid':_0x13173f[_0x62ee('0xae')]});});_0x13173f['on'](_0x62ee('0xbc'),function(_0x245d78){if(_0x245d78&&!_0x6ae516){return _0x1a518c['status'](0x1f4)[_0x62ee('0x14')]({'message':_0x62ee('0xbd'),'pid':_0x13173f[_0x62ee('0xae')]});}});})[_0x62ee('0x22')](handleError(_0x1a518c,null));};exports['importUpdates']=function(_0x1311fc,_0x5dd7e1){return db['User'][_0x62ee('0x1e')]({'raw':!![],'attributes':['id'],'where':{'role':_0x62ee('0xb5')}})[_0x62ee('0x16')](function(_0x3e2e49){var _0x546ed9=![];if(!_0x1311fc[_0x62ee('0x33')]['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x1311fc[_0x62ee('0x33')][_0x62ee('0xb6')][_0x62ee('0x72')]){throw new Error(_0x62ee('0xa4'));}if(!_0x1311fc[_0x62ee('0x33')][_0x62ee('0xb6')][_0x62ee('0xa5')]){throw new Error(_0x62ee('0xb7'));}if(!_0x1311fc[_0x62ee('0x33')]['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x2a6976=require('child_process')[_0x62ee('0xb8')](path[_0x62ee('0x4e')](__dirname,_0x62ee('0xbe')),[_0x1311fc[_0x62ee('0x5f')]['id'],JSON[_0x62ee('0xba')](_0x1311fc[_0x62ee('0x33')]),JSON['stringify'](_0x3e2e49)]);_0x2a6976['on'](_0x62ee('0xbf'),function(){_0x546ed9=!![];return _0x5dd7e1[_0x62ee('0xf')](0xc8)['json']({'message':_0x62ee('0xbb'),'pid':_0x2a6976['pid']});});_0x2a6976['on'](_0x62ee('0xbc'),function(_0xcc959f){if(_0xcc959f&&!_0x546ed9){return _0x5dd7e1[_0x62ee('0xf')](0x1f4)[_0x62ee('0x14')]({'message':_0x62ee('0xbd'),'pid':_0x2a6976['pid']});}});})[_0x62ee('0x22')](handleError(_0x5dd7e1,null));};exports[_0x62ee('0xc0')]=function(_0x298232,_0x5e3edc){var _0x32a2ec=[_0x62ee('0xc1'),_0x62ee('0xc2'),_0x62ee('0xc3'),_0x62ee('0xc4'),'fax',_0x62ee('0xc5'),_0x62ee('0xc6')];var _0x11b16a={'offset':0x0,'order':qs[_0x62ee('0x7c')](_0x62ee('0xc7'))},_0x389d52={'count':0x0,'rows':[]};Promise[_0x62ee('0xc8')]()[_0x62ee('0x16')](function(){if(_0x298232[_0x62ee('0x28')][_0x62ee('0xc9')]){if(!_[_0x62ee('0xca')](_0x32a2ec,_0x298232[_0x62ee('0x28')]['channel']['toLowerCase']())){throw new Error('Invalid\x20channel');}_0x32a2ec=[_0x298232[_0x62ee('0x28')][_0x62ee('0xc9')][_0x62ee('0xcb')]()];}if(_0x298232[_0x62ee('0x28')][_0x62ee('0xcc')]){try{var _0x836d62=JSON['parse'](_0x298232[_0x62ee('0x28')][_0x62ee('0xcc')]);if(!moment(_0x836d62[_0x62ee('0x37')])[_0x62ee('0xcd')]()){throw new Error(_0x62ee('0xce'));}if(!moment(_0x836d62['to'])[_0x62ee('0xcd')]()){throw new Error(_0x62ee('0xcf'));}}catch(_0x1cf0f6){throw new Error(_0x62ee('0xd0'));}}if(!_0x298232[_0x62ee('0x28')][_0x62ee('0x30')]('nolimit')){_0x11b16a[_0x62ee('0x11')]=qs['limit'](_0x298232[_0x62ee('0x28')][_0x62ee('0x11')]||0xa);_0x11b16a[_0x62ee('0x10')]=qs['offset'](_0x298232[_0x62ee('0x28')]['offset']);}var _0xb5d043=_0x32a2ec[_0x62ee('0x6b')](function(_0x16715d){if(_0x16715d===_0x62ee('0xc6')){var _0x29585d={'attributes':['id',_0x62ee('0xd1'),'type',_0x62ee('0xd2'),_0x62ee('0xd3'),'callerid',_0x62ee('0xd4'),_0x62ee('0xd5'),_0x62ee('0xd6'),_0x62ee('0xd7'),_0x62ee('0xd8'),_0x62ee('0xd9'),_0x62ee('0xda'),_0x62ee('0xdb'),_0x62ee('0xdc')],'where':{'ContactId':_0x298232[_0x62ee('0x5f')]['id']},'include':[{'model':db['User'],'as':'User','attributes':['id','name','fullname',_0x62ee('0xdd')]}],'order':[[_0x62ee('0xd8'),_0x62ee('0xde')]]};if(_0x298232[_0x62ee('0x28')][_0x62ee('0xcc')]){_0x29585d['where'][_0x62ee('0xd8')]={'$gte':_0x836d62[_0x62ee('0x37')],'$lte':_0x836d62['to']};}return db['VoiceCallReport'][_0x62ee('0xdf')](_0x29585d)[_0x62ee('0x16')](function(_0x400be4){_0x389d52[_0x62ee('0x12')]+=_0x400be4[_0x62ee('0x12')];return _[_0x62ee('0x6b')](_0x400be4['rows'],function(_0x52230e){var _0x3757ab=_0x52230e[_0x62ee('0x34')]({'plain':!![]});_0x3757ab[_0x62ee('0xc9')]=_0x16715d;if(_0x3757ab[_0x62ee('0xb4')]){_0x3757ab[_0x62ee('0xb4')]={'id':_0x3757ab['User']['id'],'name':_0x3757ab['User'][_0x62ee('0x1a')],'fullname':_0x3757ab['User'][_0x62ee('0xe0')],'alias':_0x3757ab[_0x62ee('0xb4')][_0x62ee('0xdd')]};}return _0x3757ab;});});}else{var _0x290d94=_[_0x62ee('0xe1')](_0x16715d)+(_0x16715d===_0x62ee('0xc2')?_0x62ee('0xe2'):'Account');var _0x2ee543={'attributes':['id',_0x62ee('0xe3'),'closedAt',_0x62ee('0xd8'),_0x62ee('0xd7'),'disposition','secondDisposition',_0x62ee('0xe4'),'UserId',_0x290d94+'Id'],'where':{'ContactId':_0x298232[_0x62ee('0x5f')]['id']},'include':[{'model':db[_0x290d94],'as':'Account','attributes':['id',_0x62ee('0x1a'),'key']},{'model':db[_0x62ee('0xb4')],'as':_0x62ee('0xe5'),'attributes':['id',_0x62ee('0x1a'),_0x62ee('0xe0')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x62ee('0x1a'),_0x62ee('0x62')],'through':{'attributes':[]}}],'order':[['createdAt',_0x62ee('0xde')]]};if(_0x298232['query'][_0x62ee('0xcc')]){_0x2ee543['where']['createdAt']={'$gte':_0x836d62[_0x62ee('0x37')],'$lte':_0x836d62['to']};}switch(_0x16715d){case _0x62ee('0xc2'):_0x2ee543[_0x62ee('0x79')][_0x62ee('0x59')](_0x62ee('0xe6'),_0x62ee('0xe7'),_0x62ee('0xe8'),_0x62ee('0xe9'),'osName','ratingMessage',_0x62ee('0xea'),_0x62ee('0xeb'),'referer');break;case _0x62ee('0xc1'):_0x2ee543[_0x62ee('0x79')][_0x62ee('0x59')](_0x62ee('0xec'),_0x62ee('0xed'));break;case'openchannel':_0x2ee543[_0x62ee('0x79')][_0x62ee('0x59')](_0x62ee('0xee'),'threadId');break;}return db[_[_0x62ee('0xe1')](_0x16715d)+_0x62ee('0xef')]['findAndCountAll'](_0x2ee543)[_0x62ee('0x16')](function(_0x1b7278){_0x389d52[_0x62ee('0x12')]+=_0x1b7278[_0x62ee('0x12')];return _[_0x62ee('0x6b')](_0x1b7278[_0x62ee('0x9a')],function(_0x20db6c){var _0x3d0e87=_0x20db6c[_0x62ee('0x34')]({'plain':!![]});_0x3d0e87['channel']=_0x16715d;if(_0x3d0e87[_0x62ee('0xe5')]){_0x3d0e87[_0x62ee('0xe5')]={'id':_0x3d0e87['Owner']['id'],'name':_0x3d0e87[_0x62ee('0xe5')][_0x62ee('0x1a')],'fullname':_0x3d0e87[_0x62ee('0xe5')][_0x62ee('0xe0')]};}return _0x3d0e87;});});}});return Promise[_0x62ee('0x5e')](_0xb5d043);})[_0x62ee('0x16')](function(_0x188f9b){return _(_0x188f9b)['flatten']()['sortBy'](_0x62ee('0xd8'))[_0x62ee('0xf0')]()['value']();})[_0x62ee('0x16')](function(_0x58e33f){_0x389d52[_0x62ee('0x9a')]=_0x11b16a[_0x62ee('0x11')]?_0x58e33f[_0x62ee('0xf1')](_0x11b16a[_0x62ee('0x10')],_0x11b16a[_0x62ee('0x10')]+_0x11b16a[_0x62ee('0x11')]):_0x58e33f;return _0x389d52;})[_0x62ee('0x16')](respondWithFilteredResult(_0x5e3edc,_0x11b16a))[_0x62ee('0x22')](handleError(_0x5e3edc,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index e147b0d..9207ff0 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 _0x2d3a=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','CmContact','setMaxListeners'];(function(_0x57975f,_0x388556){var _0x4793b8=function(_0x652c05){while(--_0x652c05){_0x57975f['push'](_0x57975f['shift']());}};_0x4793b8(++_0x388556);}(_0x2d3a,0x1bc));var _0xa2d3=function(_0x2d8434,_0x43d781){_0x2d8434=_0x2d8434-0x0;var _0x26b9e4=_0x2d3a[_0x2d8434];return _0x26b9e4;};'use strict';var EventEmitter=require(_0xa2d3('0x0'));var CmContact=require(_0xa2d3('0x1'))['db'][_0xa2d3('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xa2d3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa2d3('0x4')};function emitEvent(_0x5b9c7a){return function(_0xe6a471,_0x261c04,_0x3aa23a){CmContactEvents[_0xa2d3('0x5')](_0x5b9c7a+':'+_0xe6a471['id'],_0xe6a471);CmContactEvents['emit'](_0x5b9c7a,_0xe6a471);_0x3aa23a(null);};}for(var e in events){if(events[_0xa2d3('0x6')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0xa2d3('0x7')]=CmContactEvents; \ No newline at end of file +var _0x5b47=['update','remove','emit','hasOwnProperty','events','../../mysqldb','save'];(function(_0x585133,_0x2412a1){var _0x18254a=function(_0x4c8aaf){while(--_0x4c8aaf){_0x585133['push'](_0x585133['shift']());}};_0x18254a(++_0x2412a1);}(_0x5b47,0x11c));var _0x75b4=function(_0x37fd7f,_0x2a4530){_0x37fd7f=_0x37fd7f-0x0;var _0x2021df=_0x5b47[_0x37fd7f];return _0x2021df;};'use strict';var EventEmitter=require(_0x75b4('0x0'));var CmContact=require(_0x75b4('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x75b4('0x2'),'afterUpdate':_0x75b4('0x3'),'afterDestroy':_0x75b4('0x4')};function emitEvent(_0x27f2f2){return function(_0x568b5e,_0x37a74f,_0x8eccdc){CmContactEvents[_0x75b4('0x5')](_0x27f2f2+':'+_0x568b5e['id'],_0x568b5e);CmContactEvents[_0x75b4('0x5')](_0x27f2f2,_0x568b5e);_0x8eccdc(null);};}for(var e in events){if(events[_0x75b4('0x6')](e)){var event=events[e];CmContact['hook'](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 13b6164..e1253bb 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 _0x44ce=['fax','email','utf8mb4_unicode_ci','models','get','error','catch','[cmContact][afterCreate]','isEmpty','length','ContactId','push','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','inspect','lodash','util','../../config/logger','api','moment','../../config/environment/shared','./cmContact.attributes','Campaign','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','findOne','then','dialTimezone','resolve','timezones','utcOffset','minutes','ListId','priority','callbackUniqueid','phone','assign','CmHopper','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','create','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','VoiceQueueId','dialCheckDuplicateType','onlyIfOpen','VoiceQueue','outbound','Lists','map','findAll','all','CmList','CmHopperBlack','BlackLists','exports','define','CmContact','cm_contacts','fti_cm_contacts','mobile'];(function(_0x3d5304,_0x1e01e5){var _0x58f9ea=function(_0x3e3bc4){while(--_0x3e3bc4){_0x3d5304['push'](_0x3d5304['shift']());}};_0x58f9ea(++_0x1e01e5);}(_0x44ce,0x94));var _0xe44c=function(_0x3d035b,_0x23633a){_0x3d035b=_0x3d035b-0x0;var _0x38ddb2=_0x44ce[_0x3d035b];return _0x38ddb2;};'use strict';var _=require(_0xe44c('0x0'));var util=require(_0xe44c('0x1'));var logger=require(_0xe44c('0x2'))(_0xe44c('0x3'));var moment=require(_0xe44c('0x4'));var shared=require(_0xe44c('0x5'));var attributes=require(_0xe44c('0x6'));function getTimezoneCallbackAt(_0x17baa0,_0x37383d,_0x3b6501,_0x9b5285){var _0x264ecd=_0x9b5285?_0xe44c('0x7'):'VoiceQueue';var _0x58cfd0=_0x3b6501['scheduledat']?_0x3b6501[_0xe44c('0x8')]:moment()[_0xe44c('0x9')](_0xe44c('0xa'));if(_[_0xe44c('0xb')](_0x3b6501['dialTimezone'])){return Promise['resolve'](_0x58cfd0);}return _0x17baa0[_0x264ecd][_0xe44c('0xc')]({'where':{'id':_0x37383d}})[_0xe44c('0xd')](function(_0x400ce6){if(_[_0xe44c('0xb')](_0x400ce6)||_[_0xe44c('0xb')](_0x400ce6[_0xe44c('0xe')])){return Promise[_0xe44c('0xf')](_0x58cfd0);}var _0x5a0017=shared[_0xe44c('0x10')];var _0x59a568=_0x5a0017[_0x400ce6[_0xe44c('0xe')]];var _0x2dd7e6=_0x5a0017[_0x3b6501[_0xe44c('0xe')]];if(_[_0xe44c('0xb')](_0x59a568)&&_[_0xe44c('0xb')](_0x2dd7e6)){return Promise[_0xe44c('0xf')](_0x58cfd0);}var _0x24a5a4=_0x59a568[_0xe44c('0x11')]-_0x2dd7e6[_0xe44c('0x11')];var _0x3893ce=_0x3b6501['scheduledat']?_0x3b6501[_0xe44c('0x8')]:moment();_0x58cfd0=moment(_0x3893ce)['add'](_0x24a5a4,_0xe44c('0x12'))[_0xe44c('0x9')](_0xe44c('0xa'));return Promise['resolve'](_0x58cfd0);});}function getNewHopperPayload(_0x3dc528){return{'phone':_0x3dc528['phone'],'ContactId':_0x3dc528['id'],'ListId':_0x3dc528[_0xe44c('0x13')],'scheduledat':_0x3dc528['scheduledat']?_0x3dc528[_0xe44c('0x8')]:moment()[_0xe44c('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x3dc528[_0xe44c('0x14')]?_0x3dc528[_0xe44c('0x14')]:0x2,'callback':_0x3dc528[_0xe44c('0x15')]?!![]:![],'callbackuniqueid':_0x3dc528[_0xe44c('0x15')]?_0x3dc528['callbackUniqueid']:undefined,'callbackat':_0x3dc528[_0xe44c('0x15')]?moment()[_0xe44c('0x9')](_0xe44c('0xa')):undefined};}function handleAlwaysCheckDuplicate(_0x246951,_0x2f39b0,_0x1eecc6,_0x19f0a8){var _0x3d81d5={'phone':_0x1eecc6[_0xe44c('0x16')]};var _0x195244={'calleridnum':_0x1eecc6[_0xe44c('0x16')]};if(_0x19f0a8){Object[_0xe44c('0x17')](_0x3d81d5,{'CampaignId':_0x2f39b0['id']});Object[_0xe44c('0x17')](_0x195244,{'CampaignId':_0x2f39b0['id']});}else{Object[_0xe44c('0x17')](_0x3d81d5,{'VoiceQueueId':_0x2f39b0['id']});Object[_0xe44c('0x17')](_0x195244,{'VoiceQueueId':_0x2f39b0['id']});}return _0x246951[_0xe44c('0x18')][_0xe44c('0xc')]({'where':_0x3d81d5})['then'](function(_0x169247){if(_0x169247){throw new Error(_0xe44c('0x19')+_0x1eecc6['phone']+_0xe44c('0x1a')+_0x2f39b0['id']);}return _0x246951[_0xe44c('0x1b')][_0xe44c('0xc')]({'where':_0x195244});})[_0xe44c('0xd')](function(_0x1f85fd){if(_0x1f85fd){throw new Error(_0xe44c('0x1c')+_0x1eecc6[_0xe44c('0x16')]+_0xe44c('0x1a')+_0x2f39b0['id']);}var _0x25040=getNewHopperPayload(_0x1eecc6);if(_0x19f0a8){_0x25040[_0xe44c('0x1d')]=_0x2f39b0['id'];}else{_0x25040['VoiceQueueId']=_0x2f39b0['id'];}return _0x246951[_0xe44c('0x18')][_0xe44c('0x1e')](_0x25040);});}function handleOnlyIfOpenCheckDuplicate(_0x5d9594,_0x2d9e8f,_0x1881ba,_0x4e146a){var _0x297c44={'phone':_0x1881ba['phone']};if(_0x4e146a){Object[_0xe44c('0x17')](_0x297c44,{'CampaignId':_0x2d9e8f['id']});}else{Object[_0xe44c('0x17')](_0x297c44,{'VoiceQueueId':_0x2d9e8f['id']});}return _0x5d9594[_0xe44c('0x18')][_0xe44c('0xc')]({'where':_0x297c44})[_0xe44c('0xd')](function(_0x218cdb){if(_0x218cdb){throw new Error(_0xe44c('0x1f')+_0x1881ba[_0xe44c('0x16')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x2d9e8f['id']);}var _0x19b5de=getNewHopperPayload(_0x1881ba);if(_0x4e146a){_0x19b5de[_0xe44c('0x1d')]=_0x2d9e8f['id'];}else{_0x19b5de[_0xe44c('0x20')]=_0x2d9e8f['id'];}return _0x5d9594[_0xe44c('0x18')]['create'](_0x19b5de);});}function handleNeverCheckDuplicate(_0x2f8330,_0xb903e1,_0x17087f){var _0x1f4d48=getNewHopperPayload(_0x17087f);_0x1f4d48[_0xe44c('0x20')]=_0xb903e1['id'];return _0x2f8330[_0xe44c('0x18')][_0xe44c('0x1e')](_0x1f4d48);}function handleCheckDuplicate(_0x3b5a45,_0x18c3f7,_0x100136,_0x45abb9){return getTimezoneCallbackAt(_0x3b5a45,_0x18c3f7,_0x100136,_0x45abb9)['then'](function(_0x272da4){_0x100136['scheduledat']=_0x272da4;switch(_0x18c3f7[_0xe44c('0x21')]){case'always':return handleAlwaysCheckDuplicate(_0x3b5a45,_0x18c3f7,_0x100136,_0x45abb9);case _0xe44c('0x22'):return handleOnlyIfOpenCheckDuplicate(_0x3b5a45,_0x18c3f7,_0x100136,_0x45abb9);default:return handleNeverCheckDuplicate(_0x3b5a45,_0x18c3f7,_0x100136);}});}function createHopperForVoiceQueues(_0x593649,_0x4188ea){return _0x593649[_0xe44c('0x23')]['findAll']({'where':{'type':_0xe44c('0x24')},'attributes':['id',_0xe44c('0x21'),_0xe44c('0xe')],'include':[{'model':_0x593649['CmList'],'as':_0xe44c('0x25'),'where':{'id':_0x4188ea[_0xe44c('0x13')]}}],'raw':!![]})[_0xe44c('0xd')](function(_0x18b303){var _0x1fb594=_0x18b303[_0xe44c('0x26')](function(_0x51e1dc){return handleCheckDuplicate(_0x593649,_0x51e1dc,_0x4188ea,![]);});return Promise['all'](_0x1fb594);});}function createHopperForCampaigns(_0x43c6c0,_0x4419a6){return _0x43c6c0['Campaign'][_0xe44c('0x27')]({'attributes':['id','dialCheckDuplicateType',_0xe44c('0xe')],'include':[{'model':_0x43c6c0['CmList'],'as':_0xe44c('0x25'),'where':{'id':_0x4419a6['ListId']}}],'raw':!![]})[_0xe44c('0xd')](function(_0x5519af){var _0x13c28c=_0x5519af[_0xe44c('0x26')](function(_0x216346){return handleCheckDuplicate(_0x43c6c0,_0x216346,_0x4419a6,!![]);});return Promise[_0xe44c('0x28')](_0x13c28c);});}function createHopperBlackForVoiceQueues(_0x17aea5,_0x3c50ee){return _0x17aea5['VoiceQueue'][_0xe44c('0x27')]({'where':{'type':_0xe44c('0x24')},'attributes':['id'],'include':[{'model':_0x17aea5[_0xe44c('0x29')],'as':'BlackLists','where':{'id':_0x3c50ee['ListId']}}],'raw':!![]})[_0xe44c('0xd')](function(_0x3dd37b){var _0x22e8e9=_0x3dd37b[_0xe44c('0x26')](function(_0x11af35){return _0x17aea5[_0xe44c('0x2a')][_0xe44c('0x1e')]({'phone':_0x3c50ee['phone'],'ContactId':_0x3c50ee['id'],'ListId':_0x3c50ee[_0xe44c('0x13')],'VoiceQueueId':_0x11af35['id']});});return Promise[_0xe44c('0x28')](_0x22e8e9);});}function createHopperBlackForCampaigns(_0x35715a,_0xb68eb6){return _0x35715a[_0xe44c('0x7')][_0xe44c('0x27')]({'attributes':['id'],'include':[{'model':_0x35715a[_0xe44c('0x29')],'as':_0xe44c('0x2b'),'where':{'id':_0xb68eb6[_0xe44c('0x13')]}}],'raw':!![]})[_0xe44c('0xd')](function(_0x25b784){var _0x41d4d5=_0x25b784[_0xe44c('0x26')](function(_0x534c21){return _0x35715a[_0xe44c('0x2a')]['create']({'phone':_0xb68eb6[_0xe44c('0x16')],'ContactId':_0xb68eb6['id'],'ListId':_0xb68eb6[_0xe44c('0x13')],'CampaignId':_0x534c21['id']});});return Promise['all'](_0x41d4d5);});}module[_0xe44c('0x2c')]=function(_0x4ccbb7){return _0x4ccbb7[_0xe44c('0x2d')](_0xe44c('0x2e'),attributes,{'tableName':_0xe44c('0x2f'),'paranoid':!![],'indexes':[{'name':_0xe44c('0x16'),'fields':[_0xe44c('0x16')]},{'name':_0xe44c('0x30'),'fields':['firstName','lastName',_0xe44c('0x16'),_0xe44c('0x31'),_0xe44c('0x32'),_0xe44c('0x33')],'type':'FULLTEXT'}],'timestamps':!![],'charset':'utf8mb4','collate':_0xe44c('0x34'),'hooks':{'afterCreate':function(_0x3ae2d5,_0xbdbb48,_0x1ba50c){var _0x2c66a6=_0x4ccbb7[_0xe44c('0x35')];var _0x2bfad7=_0x3ae2d5[_0xe44c('0x36')]({'plain':!![]});if(!_0x2bfad7['ListId']){logger[_0xe44c('0x37')]('[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20'+_0x2bfad7['id']);return _0x1ba50c();}if(!_0x2bfad7[_0xe44c('0x16')]){return _0x1ba50c();}return createHopperForVoiceQueues(_0x2c66a6,_0x2bfad7)['then'](function(){return createHopperBlackForVoiceQueues(_0x2c66a6,_0x2bfad7);})[_0xe44c('0xd')](function(){return createHopperForCampaigns(_0x2c66a6,_0x2bfad7);})[_0xe44c('0xd')](function(){return createHopperBlackForCampaigns(_0x2c66a6,_0x2bfad7);})[_0xe44c('0xd')](function(){return _0x1ba50c();})[_0xe44c('0x38')](function(_0xcad04a){logger['error'](_0xe44c('0x39'),_0xcad04a['message']);_0x1ba50c();});},'afterDestroy':function(_0x94e997,_0x4b9df7,_0x2c3438){var _0x57021c=_0x4ccbb7[_0xe44c('0x35')];var _0x34911b=_0x94e997[_0xe44c('0x36')]({'plain':!![]});return _0x57021c[_0xe44c('0x18')][_0xe44c('0x27')]({'raw':!![],'where':{'ListId':_0x34911b[_0xe44c('0x13')],'ContactId':_0x34911b['id']}})[_0xe44c('0xd')](function(_0x3bc32c){if(!_[_0xe44c('0x3a')](_0x3bc32c)){var _0x591fa2=[];for(var _0x5252a1=0x0;_0x5252a1<_0x3bc32c[_0xe44c('0x3b')];_0x5252a1+=0x1){var _0x2a34a3=_0x57021c[_0xe44c('0x18')]['destroy']({'where':{'ListId':_0x3bc32c[_0x5252a1][_0xe44c('0x13')],'ContactId':_0x3bc32c[_0x5252a1][_0xe44c('0x3c')],'VoiceQueueId':_0x3bc32c[_0x5252a1][_0xe44c('0x20')],'CampaignId':_0x3bc32c[_0x5252a1]['CampaignId']}});_0x591fa2[_0xe44c('0x3d')](_0x2a34a3);}return Promise[_0xe44c('0x28')](_0x591fa2);}})['then'](function(_0x49c7e9){logger[_0xe44c('0x3e')](_0xe44c('0x3f'),util['inspect'](_0x49c7e9,{'showHidden':![],'depth':null}));_0x2c3438();})[_0xe44c('0x38')](function(_0x5c5b9c){logger['error'](_0xe44c('0x40'),util[_0xe44c('0x41')](_0x5c5b9c,{'showHidden':![],'depth':null}));_0x2c3438(_0x5c5b9c);});}}});}; \ No newline at end of file +var _0x847a=['[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','util','../../config/logger','api','../../config/environment/shared','./cmContact.attributes','VoiceQueue','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','resolve','findOne','then','utcOffset','add','minutes','phone','ListId','priority','callbackUniqueid','assign','CmHopper','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','VoiceQueueId','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','create','dialCheckDuplicateType','always','findAll','Lists','map','all','Campaign','CmList','outbound','BlackLists','CmHopperBlack','exports','CmContact','cm_contacts','fti_cm_contacts','firstName','mobile','fax','email','FULLTEXT','utf8mb4_unicode_ci','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','[cmContact][afterCreate]','message','isEmpty','length','destroy','ContactId','push','info'];(function(_0x2e1657,_0x2692e4){var _0x3a4418=function(_0x3e7ebe){while(--_0x3e7ebe){_0x2e1657['push'](_0x2e1657['shift']());}};_0x3a4418(++_0x2692e4);}(_0x847a,0xcc));var _0xa847=function(_0x4f5de1,_0x4413de){_0x4f5de1=_0x4f5de1-0x0;var _0xf8ca59=_0x847a[_0x4f5de1];return _0xf8ca59;};'use strict';var _=require('lodash');var util=require(_0xa847('0x0'));var logger=require(_0xa847('0x1'))(_0xa847('0x2'));var moment=require('moment');var shared=require(_0xa847('0x3'));var attributes=require(_0xa847('0x4'));function getTimezoneCallbackAt(_0x3c69eb,_0x1d437e,_0x5ac6e3,_0xee4320){var _0x1ef305=_0xee4320?'Campaign':_0xa847('0x5');var _0x3ba978=_0x5ac6e3[_0xa847('0x6')]?_0x5ac6e3['scheduledat']:moment()[_0xa847('0x7')](_0xa847('0x8'));if(_[_0xa847('0x9')](_0x5ac6e3[_0xa847('0xa')])){return Promise[_0xa847('0xb')](_0x3ba978);}return _0x3c69eb[_0x1ef305][_0xa847('0xc')]({'where':{'id':_0x1d437e}})[_0xa847('0xd')](function(_0x46d1e3){if(_[_0xa847('0x9')](_0x46d1e3)||_['isNil'](_0x46d1e3[_0xa847('0xa')])){return Promise[_0xa847('0xb')](_0x3ba978);}var _0x327141=shared['timezones'];var _0x4ffdb4=_0x327141[_0x46d1e3[_0xa847('0xa')]];var _0x222bb9=_0x327141[_0x5ac6e3[_0xa847('0xa')]];if(_[_0xa847('0x9')](_0x4ffdb4)&&_[_0xa847('0x9')](_0x222bb9)){return Promise[_0xa847('0xb')](_0x3ba978);}var _0x5c3150=_0x4ffdb4[_0xa847('0xe')]-_0x222bb9[_0xa847('0xe')];var _0x3f5360=_0x5ac6e3[_0xa847('0x6')]?_0x5ac6e3[_0xa847('0x6')]:moment();_0x3ba978=moment(_0x3f5360)[_0xa847('0xf')](_0x5c3150,_0xa847('0x10'))[_0xa847('0x7')](_0xa847('0x8'));return Promise[_0xa847('0xb')](_0x3ba978);});}function getNewHopperPayload(_0x5e979c){return{'phone':_0x5e979c[_0xa847('0x11')],'ContactId':_0x5e979c['id'],'ListId':_0x5e979c[_0xa847('0x12')],'scheduledat':_0x5e979c[_0xa847('0x6')]?_0x5e979c['scheduledat']:moment()[_0xa847('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x5e979c[_0xa847('0x13')]?_0x5e979c[_0xa847('0x13')]:0x2,'callback':_0x5e979c[_0xa847('0x14')]?!![]:![],'callbackuniqueid':_0x5e979c[_0xa847('0x14')]?_0x5e979c[_0xa847('0x14')]:undefined,'callbackat':_0x5e979c[_0xa847('0x14')]?moment()['format'](_0xa847('0x8')):undefined};}function handleAlwaysCheckDuplicate(_0x44ed0d,_0x562c9e,_0x47395e,_0x872ec9){var _0x1235ad={'phone':_0x47395e[_0xa847('0x11')]};var _0x1b42ba={'calleridnum':_0x47395e[_0xa847('0x11')]};if(_0x872ec9){Object['assign'](_0x1235ad,{'CampaignId':_0x562c9e['id']});Object[_0xa847('0x15')](_0x1b42ba,{'CampaignId':_0x562c9e['id']});}else{Object[_0xa847('0x15')](_0x1235ad,{'VoiceQueueId':_0x562c9e['id']});Object[_0xa847('0x15')](_0x1b42ba,{'VoiceQueueId':_0x562c9e['id']});}return _0x44ed0d[_0xa847('0x16')][_0xa847('0xc')]({'where':_0x1235ad})[_0xa847('0xd')](function(_0x3718ae){if(_0x3718ae){throw new Error(_0xa847('0x17')+_0x47395e[_0xa847('0x11')]+_0xa847('0x18')+_0x562c9e['id']);}return _0x44ed0d['CmHopperFinal']['findOne']({'where':_0x1b42ba});})[_0xa847('0xd')](function(_0x2b85da){if(_0x2b85da){throw new Error(_0xa847('0x19')+_0x47395e['phone']+_0xa847('0x18')+_0x562c9e['id']);}var _0xed3e90=getNewHopperPayload(_0x47395e);if(_0x872ec9){_0xed3e90[_0xa847('0x1a')]=_0x562c9e['id'];}else{_0xed3e90[_0xa847('0x1b')]=_0x562c9e['id'];}return _0x44ed0d['CmHopper']['create'](_0xed3e90);});}function handleOnlyIfOpenCheckDuplicate(_0x3c67c6,_0x260cd1,_0xa21f29,_0x409c15){var _0x456383={'phone':_0xa21f29['phone']};if(_0x409c15){Object['assign'](_0x456383,{'CampaignId':_0x260cd1['id']});}else{Object[_0xa847('0x15')](_0x456383,{'VoiceQueueId':_0x260cd1['id']});}return _0x3c67c6[_0xa847('0x16')]['findOne']({'where':_0x456383})['then'](function(_0x2a74e1){if(_0x2a74e1){throw new Error(_0xa847('0x1c')+_0xa21f29['phone']+'\x20in\x20Campaign\x20with\x20id\x20'+_0x260cd1['id']);}var _0x253f22=getNewHopperPayload(_0xa21f29);if(_0x409c15){_0x253f22['CampaignId']=_0x260cd1['id'];}else{_0x253f22[_0xa847('0x1b')]=_0x260cd1['id'];}return _0x3c67c6['CmHopper'][_0xa847('0x1d')](_0x253f22);});}function handleNeverCheckDuplicate(_0x312ce7,_0x2a755d,_0x58e4e8){var _0x1a69dd=getNewHopperPayload(_0x58e4e8);_0x1a69dd['VoiceQueueId']=_0x2a755d['id'];return _0x312ce7[_0xa847('0x16')]['create'](_0x1a69dd);}function handleCheckDuplicate(_0x2c15ff,_0x4f5589,_0x42e7b3,_0x2d2cbd){return getTimezoneCallbackAt(_0x2c15ff,_0x4f5589,_0x42e7b3,_0x2d2cbd)[_0xa847('0xd')](function(_0x598dc5){_0x42e7b3[_0xa847('0x6')]=_0x598dc5;switch(_0x4f5589[_0xa847('0x1e')]){case _0xa847('0x1f'):return handleAlwaysCheckDuplicate(_0x2c15ff,_0x4f5589,_0x42e7b3,_0x2d2cbd);case'onlyIfOpen':return handleOnlyIfOpenCheckDuplicate(_0x2c15ff,_0x4f5589,_0x42e7b3,_0x2d2cbd);default:return handleNeverCheckDuplicate(_0x2c15ff,_0x4f5589,_0x42e7b3);}});}function createHopperForVoiceQueues(_0x155484,_0x6ee668){return _0x155484['VoiceQueue'][_0xa847('0x20')]({'where':{'type':'outbound'},'attributes':['id',_0xa847('0x1e'),'dialTimezone'],'include':[{'model':_0x155484['CmList'],'as':_0xa847('0x21'),'where':{'id':_0x6ee668[_0xa847('0x12')]}}],'raw':!![]})['then'](function(_0xc83ac3){var _0x5f36c2=_0xc83ac3[_0xa847('0x22')](function(_0x1aa9f8){return handleCheckDuplicate(_0x155484,_0x1aa9f8,_0x6ee668,![]);});return Promise[_0xa847('0x23')](_0x5f36c2);});}function createHopperForCampaigns(_0x541533,_0x297afe){return _0x541533[_0xa847('0x24')][_0xa847('0x20')]({'attributes':['id','dialCheckDuplicateType',_0xa847('0xa')],'include':[{'model':_0x541533[_0xa847('0x25')],'as':_0xa847('0x21'),'where':{'id':_0x297afe[_0xa847('0x12')]}}],'raw':!![]})[_0xa847('0xd')](function(_0xad066){var _0x7a36a2=_0xad066['map'](function(_0x3e6893){return handleCheckDuplicate(_0x541533,_0x3e6893,_0x297afe,!![]);});return Promise[_0xa847('0x23')](_0x7a36a2);});}function createHopperBlackForVoiceQueues(_0xf4ec8f,_0xf51700){return _0xf4ec8f[_0xa847('0x5')][_0xa847('0x20')]({'where':{'type':_0xa847('0x26')},'attributes':['id'],'include':[{'model':_0xf4ec8f[_0xa847('0x25')],'as':_0xa847('0x27'),'where':{'id':_0xf51700[_0xa847('0x12')]}}],'raw':!![]})[_0xa847('0xd')](function(_0x25d208){var _0x5d35c8=_0x25d208[_0xa847('0x22')](function(_0x1447da){return _0xf4ec8f['CmHopperBlack'][_0xa847('0x1d')]({'phone':_0xf51700[_0xa847('0x11')],'ContactId':_0xf51700['id'],'ListId':_0xf51700[_0xa847('0x12')],'VoiceQueueId':_0x1447da['id']});});return Promise[_0xa847('0x23')](_0x5d35c8);});}function createHopperBlackForCampaigns(_0x1a5ed2,_0x4d31bc){return _0x1a5ed2[_0xa847('0x24')]['findAll']({'attributes':['id'],'include':[{'model':_0x1a5ed2[_0xa847('0x25')],'as':_0xa847('0x27'),'where':{'id':_0x4d31bc['ListId']}}],'raw':!![]})[_0xa847('0xd')](function(_0x48586c){var _0x1b3eab=_0x48586c[_0xa847('0x22')](function(_0x10ff45){return _0x1a5ed2[_0xa847('0x28')][_0xa847('0x1d')]({'phone':_0x4d31bc[_0xa847('0x11')],'ContactId':_0x4d31bc['id'],'ListId':_0x4d31bc[_0xa847('0x12')],'CampaignId':_0x10ff45['id']});});return Promise['all'](_0x1b3eab);});}module[_0xa847('0x29')]=function(_0x9c197b){return _0x9c197b['define'](_0xa847('0x2a'),attributes,{'tableName':_0xa847('0x2b'),'paranoid':!![],'indexes':[{'name':_0xa847('0x11'),'fields':[_0xa847('0x11')]},{'name':_0xa847('0x2c'),'fields':[_0xa847('0x2d'),'lastName',_0xa847('0x11'),_0xa847('0x2e'),_0xa847('0x2f'),_0xa847('0x30')],'type':_0xa847('0x31')}],'timestamps':!![],'charset':'utf8mb4','collate':_0xa847('0x32'),'hooks':{'afterCreate':function(_0xcdd7bc,_0x3497ba,_0x1372ce){var _0x1545a4=_0x9c197b[_0xa847('0x33')];var _0x33487f=_0xcdd7bc[_0xa847('0x34')]({'plain':!![]});if(!_0x33487f['ListId']){logger[_0xa847('0x35')](_0xa847('0x36')+_0x33487f['id']);return _0x1372ce();}if(!_0x33487f[_0xa847('0x11')]){return _0x1372ce();}return createHopperForVoiceQueues(_0x1545a4,_0x33487f)[_0xa847('0xd')](function(){return createHopperBlackForVoiceQueues(_0x1545a4,_0x33487f);})[_0xa847('0xd')](function(){return createHopperForCampaigns(_0x1545a4,_0x33487f);})[_0xa847('0xd')](function(){return createHopperBlackForCampaigns(_0x1545a4,_0x33487f);})[_0xa847('0xd')](function(){return _0x1372ce();})[_0xa847('0x37')](function(_0x11d0bf){logger[_0xa847('0x35')](_0xa847('0x38'),_0x11d0bf[_0xa847('0x39')]);_0x1372ce();});},'afterDestroy':function(_0x1dd8f2,_0x4bd265,_0x17751e){var _0x485568=_0x9c197b[_0xa847('0x33')];var _0x141288=_0x1dd8f2['get']({'plain':!![]});return _0x485568['CmHopper'][_0xa847('0x20')]({'raw':!![],'where':{'ListId':_0x141288['ListId'],'ContactId':_0x141288['id']}})[_0xa847('0xd')](function(_0x2784de){if(!_[_0xa847('0x3a')](_0x2784de)){var _0xb34822=[];for(var _0x4a75a5=0x0;_0x4a75a5<_0x2784de[_0xa847('0x3b')];_0x4a75a5+=0x1){var _0x31fcc9=_0x485568[_0xa847('0x16')][_0xa847('0x3c')]({'where':{'ListId':_0x2784de[_0x4a75a5][_0xa847('0x12')],'ContactId':_0x2784de[_0x4a75a5][_0xa847('0x3d')],'VoiceQueueId':_0x2784de[_0x4a75a5][_0xa847('0x1b')],'CampaignId':_0x2784de[_0x4a75a5][_0xa847('0x1a')]}});_0xb34822[_0xa847('0x3e')](_0x31fcc9);}return Promise[_0xa847('0x23')](_0xb34822);}})[_0xa847('0xd')](function(_0x2bf567){logger[_0xa847('0x3f')](_0xa847('0x40'),util[_0xa847('0x41')](_0x2bf567,{'showHidden':![],'depth':null}));_0x17751e();})['catch'](function(_0x585574){logger[_0xa847('0x35')](_0xa847('0x42'),util[_0xa847('0x41')](_0x585574,{'showHidden':![],'depth':null}));_0x17751e(_0x585574);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 58a1dc0..182c40a 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(_0x327e18,_0x1eeb93){var _0x39935d=function(_0x54377c){while(--_0x54377c){_0x327e18['push'](_0x327e18['shift']());}};_0x39935d(++_0x1eeb93);}(_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(_0x72d7f8,_0x2e619e){var _0x30f9fb=function(_0x5632e6){while(--_0x5632e6){_0x72d7f8['push'](_0x72d7f8['shift']());}};_0x30f9fb(++_0x2e619e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 292443b..3a6bc4f 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 _0x8b04=['exports','STRING','PHONE','INTEGER','sequelize'];(function(_0x4da1cb,_0x3e6aec){var _0x503cb1=function(_0xaff627){while(--_0xaff627){_0x4da1cb['push'](_0x4da1cb['shift']());}};_0x503cb1(++_0x3e6aec);}(_0x8b04,0x130));var _0x48b0=function(_0x1dfa1a,_0x2a9522){_0x1dfa1a=_0x1dfa1a-0x0;var _0x1d7844=_0x8b04[_0x1dfa1a];return _0x1d7844;};'use strict';var Sequelize=require(_0x48b0('0x0'));module[_0x48b0('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x48b0('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x48b0('0x2')],'defaultValue':_0x48b0('0x3')},'OrderBy':{'type':Sequelize[_0x48b0('0x4')],'defaultValue':null},'description':{'type':Sequelize[_0x48b0('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x279d=['STRING','PHONE','sequelize','exports','INTEGER'];(function(_0x239501,_0x5180cd){var _0x346937=function(_0x111583){while(--_0x111583){_0x239501['push'](_0x239501['shift']());}};_0x346937(++_0x5180cd);}(_0x279d,0x1d8));var _0xd279=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x279d[_0x1203f];return _0x365f0a;};'use strict';var Sequelize=require(_0xd279('0x0'));module[_0xd279('0x1')]={'CmContactId':{'type':Sequelize[_0xd279('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xd279('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0xd279('0x4')},'OrderBy':{'type':Sequelize[_0xd279('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'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 f823aba..9324a9d 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 _0x1601=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../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','reject','save','update','then','destroy','get','CmContactHasItems','error','stack','name','index','map','CmContactHasItem','rawAttributes','type','model','query','keys','filters','intersection','attributes'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x1601,0xc9));var _0x1160=function(_0x2e7025,_0x187270){_0x2e7025=_0x2e7025-0x0;var _0x5373ed=_0x1601[_0x2e7025];return _0x5373ed;};'use strict';var emlformat=require(_0x1160('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1160('0x1'));var jsonpatch=require(_0x1160('0x2'));var rp=require(_0x1160('0x3'));var moment=require(_0x1160('0x4'));var BPromise=require(_0x1160('0x5'));var Mustache=require(_0x1160('0x6'));var util=require('util');var path=require(_0x1160('0x7'));var sox=require(_0x1160('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1160('0x9'));var _=require(_0x1160('0xa'));var squel=require('squel');var crypto=require(_0x1160('0xb'));var jsforce=require(_0x1160('0xc'));var deskjs=require(_0x1160('0xd'));var toCsv=require(_0x1160('0xe'));var querystring=require('querystring');var Papa=require(_0x1160('0xf'));var Redis=require(_0x1160('0x10'));var authService=require(_0x1160('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1160('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1160('0x13'))(_0x1160('0x14'));var utils=require(_0x1160('0x15'));var config=require(_0x1160('0x16'));var licenseUtil=require(_0x1160('0x17'));var db=require(_0x1160('0x18'))['db'];function respondWithStatusCode(_0x472d65,_0x5e4bc9){_0x5e4bc9=_0x5e4bc9||0xcc;return function(_0x3b0ece){if(_0x3b0ece){return _0x472d65[_0x1160('0x19')](_0x5e4bc9);}return _0x472d65[_0x1160('0x1a')](_0x5e4bc9)[_0x1160('0x1b')]();};}function respondWithResult(_0x22a592,_0x5f338d){_0x5f338d=_0x5f338d||0xc8;return function(_0x4d1ffe){if(_0x4d1ffe){return _0x22a592[_0x1160('0x1a')](_0x5f338d)[_0x1160('0x1c')](_0x4d1ffe);}};}function respondWithFilteredResult(_0x2a5194,_0x1a0ca7){return function(_0x4b38d4){if(_0x4b38d4){var _0xfca350=typeof _0x1a0ca7[_0x1160('0x1d')]===_0x1160('0x1e')&&typeof _0x1a0ca7[_0x1160('0x1f')]===_0x1160('0x1e');var _0x191cf4=_0x4b38d4['count'];var _0x427b28=_0xfca350?0x0:_0x1a0ca7['offset'];var _0x3018e6=_0xfca350?_0x4b38d4[_0x1160('0x20')]:_0x1a0ca7[_0x1160('0x1d')]+_0x1a0ca7[_0x1160('0x1f')];var _0x4898c5;if(_0x3018e6>=_0x191cf4){_0x3018e6=_0x191cf4;_0x4898c5=0xc8;}else{_0x4898c5=0xce;}_0x2a5194[_0x1160('0x1a')](_0x4898c5);return _0x2a5194[_0x1160('0x21')](_0x1160('0x22'),_0x427b28+'-'+_0x3018e6+'/'+_0x191cf4)['json'](_0x4b38d4);}return null;};}function patchUpdates(_0x7e4362){return function(_0x41e511){try{jsonpatch[_0x1160('0x23')](_0x41e511,_0x7e4362,!![]);}catch(_0x4849a8){return BPromise[_0x1160('0x24')](_0x4849a8);}return _0x41e511[_0x1160('0x25')]();};}function saveUpdates(_0x4081b1,_0x4acd5d){return function(_0x340716){if(_0x340716){return _0x340716[_0x1160('0x26')](_0x4081b1)[_0x1160('0x27')](function(_0x4173d){return _0x4173d;});}return null;};}function removeEntity(_0x230acf,_0x1562a0){return function(_0x2f37e7){if(_0x2f37e7){return _0x2f37e7[_0x1160('0x28')]()['then'](function(){var _0x2e4409=_0x2f37e7[_0x1160('0x29')]({'plain':!![]});var _0x52026a=_0x1160('0x2a');return db['UserProfileResource'][_0x1160('0x28')]({'where':{'type':_0x52026a,'resourceId':_0x2e4409['id']}})[_0x1160('0x27')](function(){return _0x2f37e7;});})['then'](function(){_0x230acf[_0x1160('0x1a')](0xcc)[_0x1160('0x1b')]();});}};}function handleEntityNotFound(_0x5c78bf,_0x5c0034){return function(_0x6ee882){if(!_0x6ee882){_0x5c78bf[_0x1160('0x19')](0x194);}return _0x6ee882;};}function handleError(_0x1752b1,_0x4e0562){_0x4e0562=_0x4e0562||0x1f4;return function(_0x280fef){logger[_0x1160('0x2b')](_0x280fef[_0x1160('0x2c')]);if(_0x280fef[_0x1160('0x2d')]){delete _0x280fef[_0x1160('0x2d')];}_0x1752b1[_0x1160('0x1a')](_0x4e0562)['send'](_0x280fef);};}exports[_0x1160('0x2e')]=function(_0x785fe8,_0x398251){var _0x30418d={},_0x49b257={},_0x10093e={'count':0x0,'rows':[]};var _0x38782c=_[_0x1160('0x2f')](db[_0x1160('0x30')][_0x1160('0x31')],function(_0x228fe8){return{'name':_0x228fe8['fieldName'],'type':_0x228fe8[_0x1160('0x32')]['key']};});_0x49b257[_0x1160('0x33')]=_['map'](_0x38782c,_0x1160('0x2d'));_0x49b257[_0x1160('0x34')]=_[_0x1160('0x35')](_0x785fe8[_0x1160('0x34')]);_0x49b257[_0x1160('0x36')]=_[_0x1160('0x37')](_0x49b257['model'],_0x49b257[_0x1160('0x34')]);_0x30418d[_0x1160('0x38')]=_['intersection'](_0x49b257[_0x1160('0x33')],qs[_0x1160('0x39')](_0x785fe8[_0x1160('0x34')]['fields']));_0x30418d[_0x1160('0x38')]=_0x30418d[_0x1160('0x38')][_0x1160('0x3a')]?_0x30418d[_0x1160('0x38')]:_0x49b257['model'];if(!_0x785fe8[_0x1160('0x34')][_0x1160('0x3b')](_0x1160('0x3c'))){_0x30418d[_0x1160('0x1f')]=qs['limit'](_0x785fe8['query'][_0x1160('0x1f')]);_0x30418d[_0x1160('0x1d')]=qs[_0x1160('0x1d')](_0x785fe8['query'][_0x1160('0x1d')]);}_0x30418d[_0x1160('0x3d')]=qs[_0x1160('0x3e')](_0x785fe8[_0x1160('0x34')][_0x1160('0x3e')]);_0x30418d[_0x1160('0x3f')]=qs[_0x1160('0x36')](_[_0x1160('0x40')](_0x785fe8[_0x1160('0x34')],_0x49b257[_0x1160('0x36')]),_0x38782c);if(_0x785fe8[_0x1160('0x34')][_0x1160('0x41')]){_0x30418d['where']=_[_0x1160('0x42')](_0x30418d[_0x1160('0x3f')],{'$or':_[_0x1160('0x2f')](_0x38782c,function(_0x2c343b){if(_0x2c343b[_0x1160('0x32')]!==_0x1160('0x43')){var _0xa8eaff={};_0xa8eaff[_0x2c343b[_0x1160('0x2d')]]={'$like':'%'+_0x785fe8[_0x1160('0x34')]['filter']+'%'};return _0xa8eaff;}})});}_0x30418d=_[_0x1160('0x42')]({},_0x30418d,_0x785fe8[_0x1160('0x44')]);var _0x1e88a6={'where':_0x30418d[_0x1160('0x3f')]};return db[_0x1160('0x30')][_0x1160('0x20')](_0x1e88a6)[_0x1160('0x27')](function(_0x4e26d2){_0x10093e[_0x1160('0x20')]=_0x4e26d2;if(_0x785fe8[_0x1160('0x34')]['includeAll']){_0x30418d['include']=[{'all':!![]}];}return db[_0x1160('0x30')][_0x1160('0x45')](_0x30418d);})[_0x1160('0x27')](function(_0xfc918){_0x10093e[_0x1160('0x46')]=_0xfc918;return _0x10093e;})[_0x1160('0x27')](respondWithFilteredResult(_0x398251,_0x30418d))[_0x1160('0x47')](handleError(_0x398251,null));};exports[_0x1160('0x48')]=function(_0x3a0600,_0x948c78){var _0x3b6b6e={'raw':!![],'where':{'id':_0x3a0600[_0x1160('0x49')]['id']}},_0x4a3c20={};_0x4a3c20[_0x1160('0x33')]=_[_0x1160('0x35')](db[_0x1160('0x30')]['rawAttributes']);_0x4a3c20[_0x1160('0x34')]=_[_0x1160('0x35')](_0x3a0600[_0x1160('0x34')]);_0x4a3c20[_0x1160('0x36')]=_['intersection'](_0x4a3c20[_0x1160('0x33')],_0x4a3c20['query']);_0x3b6b6e['attributes']=_['intersection'](_0x4a3c20['model'],qs[_0x1160('0x39')](_0x3a0600[_0x1160('0x34')]['fields']));_0x3b6b6e[_0x1160('0x38')]=_0x3b6b6e[_0x1160('0x38')][_0x1160('0x3a')]?_0x3b6b6e['attributes']:_0x4a3c20['model'];if(_0x3a0600[_0x1160('0x34')][_0x1160('0x4a')]){_0x3b6b6e[_0x1160('0x4b')]=[{'all':!![]}];}_0x3b6b6e=_['merge']({},_0x3b6b6e,_0x3a0600[_0x1160('0x44')]);return db[_0x1160('0x30')][_0x1160('0x4c')](_0x3b6b6e)[_0x1160('0x27')](handleEntityNotFound(_0x948c78,null))[_0x1160('0x27')](respondWithResult(_0x948c78,null))['catch'](handleError(_0x948c78,null));};exports[_0x1160('0x4d')]=function(_0x276cb9,_0xb6cd4b){return db[_0x1160('0x30')][_0x1160('0x4d')](_0x276cb9[_0x1160('0x4e')],{})[_0x1160('0x27')](function(_0x50b7af){var _0x5c009b=_0x276cb9['user'][_0x1160('0x29')]({'plain':!![]});if(!_0x5c009b)throw new Error(_0x1160('0x4f'));if(_0x5c009b[_0x1160('0x50')]==='user'){var _0x44d004=_0x50b7af['get']({'plain':!![]});var _0x43b00a=_0x1160('0x2a');return db[_0x1160('0x51')][_0x1160('0x4c')]({'where':{'name':_0x43b00a,'userProfileId':_0x5c009b[_0x1160('0x52')]},'raw':!![]})[_0x1160('0x27')](function(_0x3d972e){if(_0x3d972e&&_0x3d972e[_0x1160('0x53')]===0x0){return db[_0x1160('0x54')]['create']({'name':_0x44d004[_0x1160('0x2d')],'resourceId':_0x44d004['id'],'type':_0x3d972e['name'],'sectionId':_0x3d972e['id']},{})['then'](function(){return _0x50b7af;});}else{return _0x50b7af;}})['catch'](function(_0x27a703){logger[_0x1160('0x2b')](_0x1160('0x55'),_0x27a703);throw _0x27a703;});}return _0x50b7af;})[_0x1160('0x27')](respondWithResult(_0xb6cd4b,0xc9))[_0x1160('0x47')](handleError(_0xb6cd4b,null));};exports[_0x1160('0x26')]=function(_0x509398,_0xfb1217){if(_0x509398[_0x1160('0x4e')]['id']){delete _0x509398[_0x1160('0x4e')]['id'];}return db['CmContactHasItem'][_0x1160('0x4c')]({'where':{'id':_0x509398['params']['id']}})[_0x1160('0x27')](handleEntityNotFound(_0xfb1217,null))[_0x1160('0x27')](saveUpdates(_0x509398[_0x1160('0x4e')],null))[_0x1160('0x27')](respondWithResult(_0xfb1217,null))['catch'](handleError(_0xfb1217,null));};exports[_0x1160('0x28')]=function(_0x9ad796,_0x3956ce){return db[_0x1160('0x30')][_0x1160('0x4c')]({'where':{'id':_0x9ad796['params']['id']}})[_0x1160('0x27')](handleEntityNotFound(_0x3956ce,null))[_0x1160('0x27')](removeEntity(_0x3956ce,null))[_0x1160('0x47')](handleError(_0x3956ce,null));}; \ No newline at end of file +var _0xf9a9=['VIRTUAL','filter','merge','options','CmContactHasItem','then','includeAll','findAll','catch','show','params','length','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','set','apply','save','update','get','CmContactHasItems','UserProfileResource','destroy','status','error','name','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x156fba,_0x12912a){var _0x58c9ea=function(_0x2231d8){while(--_0x2231d8){_0x156fba['push'](_0x156fba['shift']());}};_0x58c9ea(++_0x12912a);}(_0xf9a9,0x156));var _0x9f9a=function(_0x54d5d1,_0x4baeef){_0x54d5d1=_0x54d5d1-0x0;var _0x26e240=_0xf9a9[_0x54d5d1];return _0x26e240;};'use strict';var emlformat=require(_0x9f9a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9f9a('0x1'));var rp=require(_0x9f9a('0x2'));var moment=require(_0x9f9a('0x3'));var BPromise=require(_0x9f9a('0x4'));var Mustache=require('mustache');var util=require(_0x9f9a('0x5'));var path=require('path');var sox=require(_0x9f9a('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9f9a('0x7'));var _=require(_0x9f9a('0x8'));var squel=require(_0x9f9a('0x9'));var crypto=require(_0x9f9a('0xa'));var jsforce=require(_0x9f9a('0xb'));var deskjs=require(_0x9f9a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9f9a('0xd'));var Papa=require(_0x9f9a('0xe'));var Redis=require(_0x9f9a('0xf'));var authService=require(_0x9f9a('0x10'));var qs=require(_0x9f9a('0x11'));var as=require(_0x9f9a('0x12'));var hardwareService=require(_0x9f9a('0x13'));var logger=require(_0x9f9a('0x14'))('api');var utils=require(_0x9f9a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9f9a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d9ce2,_0x26493f){_0x26493f=_0x26493f||0xcc;return function(_0x42b50f){if(_0x42b50f){return _0x1d9ce2[_0x9f9a('0x17')](_0x26493f);}return _0x1d9ce2['status'](_0x26493f)[_0x9f9a('0x18')]();};}function respondWithResult(_0x34fc96,_0x5454d){_0x5454d=_0x5454d||0xc8;return function(_0x19e82e){if(_0x19e82e){return _0x34fc96['status'](_0x5454d)[_0x9f9a('0x19')](_0x19e82e);}};}function respondWithFilteredResult(_0x502f87,_0x5df353){return function(_0x1143bb){if(_0x1143bb){var _0x32e6b=typeof _0x5df353[_0x9f9a('0x1a')]===_0x9f9a('0x1b')&&typeof _0x5df353[_0x9f9a('0x1c')]===_0x9f9a('0x1b');var _0x2381d8=_0x1143bb['count'];var _0x22c10f=_0x32e6b?0x0:_0x5df353['offset'];var _0x2d798e=_0x32e6b?_0x1143bb[_0x9f9a('0x1d')]:_0x5df353[_0x9f9a('0x1a')]+_0x5df353[_0x9f9a('0x1c')];var _0x41058e;if(_0x2d798e>=_0x2381d8){_0x2d798e=_0x2381d8;_0x41058e=0xc8;}else{_0x41058e=0xce;}_0x502f87['status'](_0x41058e);return _0x502f87[_0x9f9a('0x1e')]('Content-Range',_0x22c10f+'-'+_0x2d798e+'/'+_0x2381d8)[_0x9f9a('0x19')](_0x1143bb);}return null;};}function patchUpdates(_0x18d086){return function(_0x304dc8){try{jsonpatch[_0x9f9a('0x1f')](_0x304dc8,_0x18d086,!![]);}catch(_0x28a8d4){return BPromise['reject'](_0x28a8d4);}return _0x304dc8[_0x9f9a('0x20')]();};}function saveUpdates(_0x409940,_0x5c1f80){return function(_0x336438){if(_0x336438){return _0x336438[_0x9f9a('0x21')](_0x409940)['then'](function(_0x513011){return _0x513011;});}return null;};}function removeEntity(_0xcb2187,_0x4a0cf2){return function(_0x5071ac){if(_0x5071ac){return _0x5071ac['destroy']()['then'](function(){var _0x6fc2be=_0x5071ac[_0x9f9a('0x22')]({'plain':!![]});var _0x18db83=_0x9f9a('0x23');return db[_0x9f9a('0x24')][_0x9f9a('0x25')]({'where':{'type':_0x18db83,'resourceId':_0x6fc2be['id']}})['then'](function(){return _0x5071ac;});})['then'](function(){_0xcb2187[_0x9f9a('0x26')](0xcc)[_0x9f9a('0x18')]();});}};}function handleEntityNotFound(_0x31a820,_0x38aea8){return function(_0xc81bd2){if(!_0xc81bd2){_0x31a820[_0x9f9a('0x17')](0x194);}return _0xc81bd2;};}function handleError(_0x3fb11d,_0x11a6e3){_0x11a6e3=_0x11a6e3||0x1f4;return function(_0x8e8e2a){logger[_0x9f9a('0x27')](_0x8e8e2a['stack']);if(_0x8e8e2a[_0x9f9a('0x28')]){delete _0x8e8e2a[_0x9f9a('0x28')];}_0x3fb11d[_0x9f9a('0x26')](_0x11a6e3)['send'](_0x8e8e2a);};}exports[_0x9f9a('0x29')]=function(_0x40ce50,_0x3beaac){var _0x47bc5b={},_0x1311f4={},_0x42eba2={'count':0x0,'rows':[]};var _0x55e9d4=_[_0x9f9a('0x2a')](db['CmContactHasItem'][_0x9f9a('0x2b')],function(_0xc7292f){return{'name':_0xc7292f[_0x9f9a('0x2c')],'type':_0xc7292f[_0x9f9a('0x2d')]['key']};});_0x1311f4['model']=_[_0x9f9a('0x2a')](_0x55e9d4,_0x9f9a('0x28'));_0x1311f4[_0x9f9a('0x2e')]=_[_0x9f9a('0x2f')](_0x40ce50['query']);_0x1311f4[_0x9f9a('0x30')]=_[_0x9f9a('0x31')](_0x1311f4[_0x9f9a('0x32')],_0x1311f4[_0x9f9a('0x2e')]);_0x47bc5b[_0x9f9a('0x33')]=_['intersection'](_0x1311f4[_0x9f9a('0x32')],qs['fields'](_0x40ce50[_0x9f9a('0x2e')][_0x9f9a('0x34')]));_0x47bc5b[_0x9f9a('0x33')]=_0x47bc5b[_0x9f9a('0x33')]['length']?_0x47bc5b[_0x9f9a('0x33')]:_0x1311f4['model'];if(!_0x40ce50['query'][_0x9f9a('0x35')](_0x9f9a('0x36'))){_0x47bc5b[_0x9f9a('0x1c')]=qs[_0x9f9a('0x1c')](_0x40ce50[_0x9f9a('0x2e')]['limit']);_0x47bc5b[_0x9f9a('0x1a')]=qs[_0x9f9a('0x1a')](_0x40ce50[_0x9f9a('0x2e')]['offset']);}_0x47bc5b[_0x9f9a('0x37')]=qs[_0x9f9a('0x38')](_0x40ce50[_0x9f9a('0x2e')]['sort']);_0x47bc5b[_0x9f9a('0x39')]=qs['filters'](_['pick'](_0x40ce50['query'],_0x1311f4['filters']),_0x55e9d4);if(_0x40ce50['query']['filter']){_0x47bc5b[_0x9f9a('0x39')]=_['merge'](_0x47bc5b[_0x9f9a('0x39')],{'$or':_[_0x9f9a('0x2a')](_0x55e9d4,function(_0x54ba7a){if(_0x54ba7a[_0x9f9a('0x2d')]!==_0x9f9a('0x3a')){var _0x50212c={};_0x50212c[_0x54ba7a[_0x9f9a('0x28')]]={'$like':'%'+_0x40ce50[_0x9f9a('0x2e')][_0x9f9a('0x3b')]+'%'};return _0x50212c;}})});}_0x47bc5b=_[_0x9f9a('0x3c')]({},_0x47bc5b,_0x40ce50[_0x9f9a('0x3d')]);var _0x5c18fd={'where':_0x47bc5b[_0x9f9a('0x39')]};return db[_0x9f9a('0x3e')][_0x9f9a('0x1d')](_0x5c18fd)[_0x9f9a('0x3f')](function(_0x113f5c){_0x42eba2[_0x9f9a('0x1d')]=_0x113f5c;if(_0x40ce50['query'][_0x9f9a('0x40')]){_0x47bc5b['include']=[{'all':!![]}];}return db[_0x9f9a('0x3e')][_0x9f9a('0x41')](_0x47bc5b);})[_0x9f9a('0x3f')](function(_0x2acd96){_0x42eba2['rows']=_0x2acd96;return _0x42eba2;})[_0x9f9a('0x3f')](respondWithFilteredResult(_0x3beaac,_0x47bc5b))[_0x9f9a('0x42')](handleError(_0x3beaac,null));};exports[_0x9f9a('0x43')]=function(_0x4af47f,_0x34a848){var _0xb2bf69={'raw':!![],'where':{'id':_0x4af47f[_0x9f9a('0x44')]['id']}},_0x312879={};_0x312879[_0x9f9a('0x32')]=_[_0x9f9a('0x2f')](db[_0x9f9a('0x3e')]['rawAttributes']);_0x312879[_0x9f9a('0x2e')]=_[_0x9f9a('0x2f')](_0x4af47f[_0x9f9a('0x2e')]);_0x312879[_0x9f9a('0x30')]=_['intersection'](_0x312879[_0x9f9a('0x32')],_0x312879['query']);_0xb2bf69[_0x9f9a('0x33')]=_['intersection'](_0x312879[_0x9f9a('0x32')],qs[_0x9f9a('0x34')](_0x4af47f[_0x9f9a('0x2e')]['fields']));_0xb2bf69[_0x9f9a('0x33')]=_0xb2bf69[_0x9f9a('0x33')][_0x9f9a('0x45')]?_0xb2bf69[_0x9f9a('0x33')]:_0x312879[_0x9f9a('0x32')];if(_0x4af47f[_0x9f9a('0x2e')][_0x9f9a('0x40')]){_0xb2bf69[_0x9f9a('0x46')]=[{'all':!![]}];}_0xb2bf69=_[_0x9f9a('0x3c')]({},_0xb2bf69,_0x4af47f[_0x9f9a('0x3d')]);return db['CmContactHasItem']['find'](_0xb2bf69)[_0x9f9a('0x3f')](handleEntityNotFound(_0x34a848,null))['then'](respondWithResult(_0x34a848,null))['catch'](handleError(_0x34a848,null));};exports[_0x9f9a('0x47')]=function(_0x296898,_0x1ac901){return db[_0x9f9a('0x3e')][_0x9f9a('0x47')](_0x296898[_0x9f9a('0x48')],{})[_0x9f9a('0x3f')](function(_0x216150){var _0x5f3a22=_0x296898[_0x9f9a('0x49')]['get']({'plain':!![]});if(!_0x5f3a22)throw new Error(_0x9f9a('0x4a'));if(_0x5f3a22[_0x9f9a('0x4b')]===_0x9f9a('0x49')){var _0x5029e3=_0x216150['get']({'plain':!![]});var _0x463182=_0x9f9a('0x23');return db[_0x9f9a('0x4c')]['find']({'where':{'name':_0x463182,'userProfileId':_0x5f3a22[_0x9f9a('0x4d')]},'raw':!![]})[_0x9f9a('0x3f')](function(_0x528ccf){if(_0x528ccf&&_0x528ccf['autoAssociation']===0x0){return db['UserProfileResource'][_0x9f9a('0x47')]({'name':_0x5029e3[_0x9f9a('0x28')],'resourceId':_0x5029e3['id'],'type':_0x528ccf['name'],'sectionId':_0x528ccf['id']},{})[_0x9f9a('0x3f')](function(){return _0x216150;});}else{return _0x216150;}})[_0x9f9a('0x42')](function(_0x488186){logger['error'](_0x9f9a('0x4e'),_0x488186);throw _0x488186;});}return _0x216150;})['then'](respondWithResult(_0x1ac901,0xc9))['catch'](handleError(_0x1ac901,null));};exports[_0x9f9a('0x21')]=function(_0x31842c,_0x59d912){if(_0x31842c[_0x9f9a('0x48')]['id']){delete _0x31842c[_0x9f9a('0x48')]['id'];}return db[_0x9f9a('0x3e')][_0x9f9a('0x4f')]({'where':{'id':_0x31842c['params']['id']}})[_0x9f9a('0x3f')](handleEntityNotFound(_0x59d912,null))[_0x9f9a('0x3f')](saveUpdates(_0x31842c[_0x9f9a('0x48')],null))[_0x9f9a('0x3f')](respondWithResult(_0x59d912,null))[_0x9f9a('0x42')](handleError(_0x59d912,null));};exports[_0x9f9a('0x25')]=function(_0xfe2671,_0x4b9c0e){return db[_0x9f9a('0x3e')][_0x9f9a('0x4f')]({'where':{'id':_0xfe2671[_0x9f9a('0x44')]['id']}})[_0x9f9a('0x3f')](handleEntityNotFound(_0x4b9c0e,null))[_0x9f9a('0x3f')](removeEntity(_0x4b9c0e,null))[_0x9f9a('0x42')](handleError(_0x4b9c0e,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 592a157..eba2edf 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 _0xc27d=['define','CmContactHasItem','cm_contact_has_items','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes'];(function(_0x173fb3,_0x5d448a){var _0x4cc36e=function(_0x412456){while(--_0x412456){_0x173fb3['push'](_0x173fb3['shift']());}};_0x4cc36e(++_0x5d448a);}(_0xc27d,0xdf));var _0xdc27=function(_0x576963,_0x590db2){_0x576963=_0x576963-0x0;var _0x29f9cf=_0xc27d[_0x576963];return _0x29f9cf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdc27('0x0'))(_0xdc27('0x1'));var moment=require(_0xdc27('0x2'));var BPromise=require('bluebird');var rp=require(_0xdc27('0x3'));var fs=require('fs');var path=require(_0xdc27('0x4'));var rimraf=require(_0xdc27('0x5'));var config=require(_0xdc27('0x6'));var attributes=require(_0xdc27('0x7'));module['exports']=function(_0x865b6d,_0xcea8e0){return _0x865b6d[_0xdc27('0x8')](_0xdc27('0x9'),attributes,{'tableName':_0xdc27('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeea4=['request-promise','path','rimraf','./cmContactHasItem.attributes','define','cm_contact_has_items','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xeb1bd9,_0x5a21e5){var _0x54967e=function(_0x3536ba){while(--_0x3536ba){_0xeb1bd9['push'](_0xeb1bd9['shift']());}};_0x54967e(++_0x5a21e5);}(_0xeea4,0x19e));var _0x4eea=function(_0x43a6e0,_0x1de407){_0x43a6e0=_0x43a6e0-0x0;var _0x4109f7=_0xeea4[_0x43a6e0];return _0x4109f7;};'use strict';var _=require(_0x4eea('0x0'));var util=require(_0x4eea('0x1'));var logger=require(_0x4eea('0x2'))(_0x4eea('0x3'));var moment=require(_0x4eea('0x4'));var BPromise=require(_0x4eea('0x5'));var rp=require(_0x4eea('0x6'));var fs=require('fs');var path=require(_0x4eea('0x7'));var rimraf=require(_0x4eea('0x8'));var config=require('../../config/environment');var attributes=require(_0x4eea('0x9'));module['exports']=function(_0x2df4ae,_0x383566){return _0x2df4ae[_0x4eea('0xa')]('CmContactHasItem',attributes,{'tableName':_0x4eea('0xb'),'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 2f40627..1076681 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 _0xe7c4=['request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','CmContactHasItem,\x20%s,\x20%s'];(function(_0x3eaabf,_0x5c5e48){var _0x2c297e=function(_0x8c62dc){while(--_0x8c62dc){_0x3eaabf['push'](_0x3eaabf['shift']());}};_0x2c297e(++_0x5c5e48);}(_0xe7c4,0x81));var _0x4e7c=function(_0xa7f511,_0x5964f1){_0xa7f511=_0xa7f511-0x0;var _0x108ec0=_0xe7c4[_0xa7f511];return _0x108ec0;};'use strict';var _=require(_0x4e7c('0x0'));var util=require(_0x4e7c('0x1'));var moment=require(_0x4e7c('0x2'));var BPromise=require(_0x4e7c('0x3'));var rs=require(_0x4e7c('0x4'));var fs=require('fs');var Redis=require(_0x4e7c('0x5'));var db=require(_0x4e7c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4e7c('0x7'))(_0x4e7c('0x8'));var config=require(_0x4e7c('0x9'));var jayson=require(_0x4e7c('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x388de1,_0xf72d2f,_0x4dc396){return new BPromise(function(_0xb955f2,_0x102c00){return client[_0x4e7c('0xb')](_0x388de1,_0x4dc396)[_0x4e7c('0xc')](function(_0x1cadf2){logger[_0x4e7c('0xd')](_0x4e7c('0xe'),_0xf72d2f,_0x4e7c('0xf'));logger[_0x4e7c('0x10')](_0x4e7c('0x11'),_0xf72d2f,_0x4e7c('0xf'),JSON[_0x4e7c('0x12')](_0x1cadf2));if(_0x1cadf2[_0x4e7c('0x13')]){if(_0x1cadf2[_0x4e7c('0x13')][_0x4e7c('0x14')]===0x1f4){logger[_0x4e7c('0x13')](_0x4e7c('0xe'),_0xf72d2f,_0x1cadf2['error']['message']);return _0x102c00(_0x1cadf2[_0x4e7c('0x13')][_0x4e7c('0x15')]);}logger[_0x4e7c('0x13')](_0x4e7c('0xe'),_0xf72d2f,_0x1cadf2[_0x4e7c('0x13')][_0x4e7c('0x15')]);return _0xb955f2(_0x1cadf2[_0x4e7c('0x13')]['message']);}else{logger['info'](_0x4e7c('0xe'),_0xf72d2f,_0x4e7c('0xf'));_0xb955f2(_0x1cadf2[_0x4e7c('0x16')][_0x4e7c('0x15')]);}})[_0x4e7c('0x17')](function(_0x59f1b2){logger[_0x4e7c('0x13')](_0x4e7c('0xe'),_0xf72d2f,_0x59f1b2);_0x102c00(_0x59f1b2);});});} \ No newline at end of file +var _0xd932=['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','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x5b29a1,_0xb626b6){var _0x2dd190=function(_0x25dff2){while(--_0x25dff2){_0x5b29a1['push'](_0x5b29a1['shift']());}};_0x2dd190(++_0xb626b6);}(_0xd932,0x6a));var _0x2d93=function(_0x2f4d97,_0x296a32){_0x2f4d97=_0x2f4d97-0x0;var _0x2e33aa=_0xd932[_0x2f4d97];return _0x2e33aa;};'use strict';var _=require(_0x2d93('0x0'));var util=require(_0x2d93('0x1'));var moment=require(_0x2d93('0x2'));var BPromise=require(_0x2d93('0x3'));var rs=require(_0x2d93('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2d93('0x5'));var logger=require('../../config/logger')(_0x2d93('0x6'));var config=require(_0x2d93('0x7'));var jayson=require(_0x2d93('0x8'));var client=jayson[_0x2d93('0x9')][_0x2d93('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f2863,_0x5efc29,_0x5b7d00){return new BPromise(function(_0x238b0e,_0x36f272){return client[_0x2d93('0xb')](_0x2f2863,_0x5b7d00)[_0x2d93('0xc')](function(_0x27407a){logger[_0x2d93('0xd')](_0x2d93('0xe'),_0x5efc29,_0x2d93('0xf'));logger[_0x2d93('0x10')](_0x2d93('0x11'),_0x5efc29,_0x2d93('0xf'),JSON[_0x2d93('0x12')](_0x27407a));if(_0x27407a['error']){if(_0x27407a['error']['code']===0x1f4){logger[_0x2d93('0x13')](_0x2d93('0xe'),_0x5efc29,_0x27407a[_0x2d93('0x13')][_0x2d93('0x14')]);return _0x36f272(_0x27407a['error'][_0x2d93('0x14')]);}logger[_0x2d93('0x13')]('CmContactHasItem,\x20%s,\x20%s',_0x5efc29,_0x27407a[_0x2d93('0x13')]['message']);return _0x238b0e(_0x27407a['error'][_0x2d93('0x14')]);}else{logger['info'](_0x2d93('0xe'),_0x5efc29,_0x2d93('0xf'));_0x238b0e(_0x27407a[_0x2d93('0x15')]['message']);}})[_0x2d93('0x16')](function(_0x387772){logger[_0x2d93('0x13')](_0x2d93('0xe'),_0x5efc29,_0x387772);_0x36f272(_0x387772);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index f2306a7..7d7f8ca 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 _0xad00=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xad00,0x195));var _0x0ad0=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xad00[_0x4709c0];return _0x13348b;};'use strict';var multer=require(_0x0ad0('0x0'));var util=require(_0x0ad0('0x1'));var path=require(_0x0ad0('0x2'));var timeout=require(_0x0ad0('0x3'));var express=require(_0x0ad0('0x4'));var router=express[_0x0ad0('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0ad0('0x6'));var interaction=require(_0x0ad0('0x7'));var config=require(_0x0ad0('0x8'));var controller=require('./cmContactHasItem.controller');router[_0x0ad0('0x9')]('/',auth[_0x0ad0('0xa')](),controller[_0x0ad0('0xb')]);router[_0x0ad0('0x9')](_0x0ad0('0xc'),auth[_0x0ad0('0xa')](),controller[_0x0ad0('0xd')]);router[_0x0ad0('0xe')]('/',auth[_0x0ad0('0xa')](),controller[_0x0ad0('0xf')]);router['put'](_0x0ad0('0xc'),auth[_0x0ad0('0xa')](),controller[_0x0ad0('0x10')]);router[_0x0ad0('0x11')](_0x0ad0('0xc'),auth[_0x0ad0('0xa')](),controller[_0x0ad0('0x12')]);module[_0x0ad0('0x13')]=router; \ No newline at end of file +var _0x9820=['delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','put','update'];(function(_0x4c2537,_0x20afdf){var _0x94fb5c=function(_0x49e2f3){while(--_0x49e2f3){_0x4c2537['push'](_0x4c2537['shift']());}};_0x94fb5c(++_0x20afdf);}(_0x9820,0xb6));var _0x0982=function(_0xa42dd2,_0xb40a24){_0xa42dd2=_0xa42dd2-0x0;var _0x26c3f1=_0x9820[_0xa42dd2];return _0x26c3f1;};'use strict';var multer=require(_0x0982('0x0'));var util=require('util');var path=require(_0x0982('0x1'));var timeout=require(_0x0982('0x2'));var express=require(_0x0982('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0982('0x4'));var interaction=require(_0x0982('0x5'));var config=require(_0x0982('0x6'));var controller=require(_0x0982('0x7'));router[_0x0982('0x8')]('/',auth[_0x0982('0x9')](),controller[_0x0982('0xa')]);router[_0x0982('0x8')](_0x0982('0xb'),auth[_0x0982('0x9')](),controller[_0x0982('0xc')]);router[_0x0982('0xd')]('/',auth[_0x0982('0x9')](),controller['create']);router[_0x0982('0xe')](_0x0982('0xb'),auth[_0x0982('0x9')](),controller[_0x0982('0xf')]);router[_0x0982('0x10')](_0x0982('0xb'),auth[_0x0982('0x9')](),controller['destroy']);module[_0x0982('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 954711a..7c45a79 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 _0x48ff=['BOOLEAN','ENUM','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','name','TEXT','long','select','values','isArray','setDataValue','stringify'];(function(_0x47c0d8,_0x195708){var _0x12f83c=function(_0x126117){while(--_0x126117){_0x47c0d8['push'](_0x47c0d8['shift']());}};_0x12f83c(++_0x195708);}(_0x48ff,0x8a));var _0xf48f=function(_0x57ab14,_0x506efa){_0x57ab14=_0x57ab14-0x0;var _0x42c52f=_0x48ff[_0x57ab14];return _0x42c52f;};'use strict';var Sequelize=require(_0xf48f('0x0'));var _=require(_0xf48f('0x1'));module[_0xf48f('0x2')]={'name':{'type':Sequelize[_0xf48f('0x3')],'get':function(_0x3b6ea5){return this[_0xf48f('0x4')](_0xf48f('0x5'));}},'alias':{'type':Sequelize[_0xf48f('0x6')],'allowNull':![],'set':function(_0x410410){this['setDataValue']('alias',_0x410410?_0x410410:this[_0xf48f('0x4')](_0xf48f('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0xf48f('0x8')](_0xf48f('0x9')),'get':function(){if(this[_0xf48f('0x4')]('type')===_0xf48f('0xa')){return JSON['parse'](this['getDataValue']('values'));}else{return this['getDataValue'](_0xf48f('0xb'));}},'set':function(_0x332e3f){if(Array[_0xf48f('0xc')](_0x332e3f)){this[_0xf48f('0xd')](_0xf48f('0xb'),JSON[_0xf48f('0xe')](_0x332e3f));}else{this[_0xf48f('0xd')](_0xf48f('0xb'),_0x332e3f);}}},'required':{'type':Sequelize[_0xf48f('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xf48f('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xf48f('0x10')]('voice')}}; \ No newline at end of file +var _0x9b18=['exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long','select','values','isArray','BOOLEAN','ENUM','voice','sequelize','lodash'];(function(_0x651aaf,_0x35f9a4){var _0x5efa91=function(_0x36fb6f){while(--_0x36fb6f){_0x651aaf['push'](_0x651aaf['shift']());}};_0x5efa91(++_0x35f9a4);}(_0x9b18,0x1a7));var _0x89b1=function(_0x26b5ff,_0x92009a){_0x26b5ff=_0x26b5ff-0x0;var _0x58603e=_0x9b18[_0x26b5ff];return _0x58603e;};'use strict';var Sequelize=require(_0x89b1('0x0'));var _=require(_0x89b1('0x1'));module[_0x89b1('0x2')]={'name':{'type':Sequelize[_0x89b1('0x3')],'get':function(_0x444e49){return this[_0x89b1('0x4')](_0x89b1('0x5'));}},'alias':{'type':Sequelize[_0x89b1('0x6')],'allowNull':![],'set':function(_0x28228d){this[_0x89b1('0x7')](_0x89b1('0x5'),_0x28228d?_0x28228d:this['getDataValue'](_0x89b1('0x8')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x89b1('0x9')](_0x89b1('0xa')),'get':function(){if(this[_0x89b1('0x4')]('type')===_0x89b1('0xb')){return JSON['parse'](this[_0x89b1('0x4')](_0x89b1('0xc')));}else{return this[_0x89b1('0x4')]('values');}},'set':function(_0x24b66f){if(Array[_0x89b1('0xd')](_0x24b66f)){this['setDataValue'](_0x89b1('0xc'),JSON['stringify'](_0x24b66f));}else{this[_0x89b1('0x7')](_0x89b1('0xc'),_0x24b66f);}}},'required':{'type':Sequelize[_0x89b1('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x89b1('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x89b1('0xf')](_0x89b1('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index c44c297..8e69421 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 _0x5dbe=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','save','update','destroy','then','error','stack','name','send','map','CmCustomField','rawAttributes','fieldName','type','key','differenceBy','query','keys','filters','intersection','model','fields','attributes','nolimit','order','sort','where','filter','merge','options','count','includeAll','findAll','rows','catch','show','params','length','find','body','sequelize','create','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x305fa3,_0x18d27b){var _0x5b3132=function(_0x140e34){while(--_0x140e34){_0x305fa3['push'](_0x305fa3['shift']());}};_0x5b3132(++_0x18d27b);}(_0x5dbe,0xf3));var _0xe5db=function(_0x524efa,_0xbe406e){_0x524efa=_0x524efa-0x0;var _0x775cd5=_0x5dbe[_0x524efa];return _0x775cd5;};'use strict';var emlformat=require(_0xe5db('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe5db('0x1'));var jsonpatch=require(_0xe5db('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe5db('0x3'));var Mustache=require(_0xe5db('0x4'));var util=require(_0xe5db('0x5'));var path=require(_0xe5db('0x6'));var sox=require(_0xe5db('0x7'));var csv=require('to-csv');var ejs=require(_0xe5db('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe5db('0x9'));var squel=require(_0xe5db('0xa'));var crypto=require(_0xe5db('0xb'));var jsforce=require(_0xe5db('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe5db('0xd'));var querystring=require(_0xe5db('0xe'));var Papa=require(_0xe5db('0xf'));var Redis=require(_0xe5db('0x10'));var authService=require(_0xe5db('0x11'));var qs=require(_0xe5db('0x12'));var as=require(_0xe5db('0x13'));var hardwareService=require(_0xe5db('0x14'));var logger=require(_0xe5db('0x15'))('api');var utils=require(_0xe5db('0x16'));var config=require(_0xe5db('0x17'));var licenseUtil=require(_0xe5db('0x18'));var db=require(_0xe5db('0x19'))['db'];function respondWithStatusCode(_0x4892af,_0x19db6e){_0x19db6e=_0x19db6e||0xcc;return function(_0x424239){if(_0x424239){return _0x4892af[_0xe5db('0x1a')](_0x19db6e);}return _0x4892af[_0xe5db('0x1b')](_0x19db6e)[_0xe5db('0x1c')]();};}function respondWithResult(_0x63e864,_0x3641f1){_0x3641f1=_0x3641f1||0xc8;return function(_0x32c0c4){if(_0x32c0c4){return _0x63e864[_0xe5db('0x1b')](_0x3641f1)[_0xe5db('0x1d')](_0x32c0c4);}};}function respondWithFilteredResult(_0x501f95,_0x2dd81d){return function(_0x1ec506){if(_0x1ec506){var _0x55740f=typeof _0x2dd81d[_0xe5db('0x1e')]===_0xe5db('0x1f')&&typeof _0x2dd81d[_0xe5db('0x20')]===_0xe5db('0x1f');var _0x585a62=_0x1ec506['count'];var _0x4d7ae5=_0x55740f?0x0:_0x2dd81d[_0xe5db('0x1e')];var _0x422a7b=_0x55740f?_0x1ec506['count']:_0x2dd81d[_0xe5db('0x1e')]+_0x2dd81d['limit'];var _0x249075;if(_0x422a7b>=_0x585a62){_0x422a7b=_0x585a62;_0x249075=0xc8;}else{_0x249075=0xce;}_0x501f95['status'](_0x249075);return _0x501f95[_0xe5db('0x21')](_0xe5db('0x22'),_0x4d7ae5+'-'+_0x422a7b+'/'+_0x585a62)['json'](_0x1ec506);}return null;};}function patchUpdates(_0x4e64c9){return function(_0xd7ee53){try{jsonpatch['apply'](_0xd7ee53,_0x4e64c9,!![]);}catch(_0x48fa79){return BPromise['reject'](_0x48fa79);}return _0xd7ee53[_0xe5db('0x23')]();};}function saveUpdates(_0x2623dd,_0x11fbba){return function(_0x5f08a2){if(_0x5f08a2){return _0x5f08a2[_0xe5db('0x24')](_0x2623dd)['then'](function(_0x34152d){return _0x34152d;});}return null;};}function removeEntity(_0x4c0521,_0x34b4ef){return function(_0x1c1b48){if(_0x1c1b48){return _0x1c1b48[_0xe5db('0x25')]()[_0xe5db('0x26')](function(){_0x4c0521[_0xe5db('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19bb2c,_0x50e037){return function(_0x55f5f4){if(!_0x55f5f4){_0x19bb2c['sendStatus'](0x194);}return _0x55f5f4;};}function handleError(_0x5cace0,_0x5491a5){_0x5491a5=_0x5491a5||0x1f4;return function(_0x2c935b){logger[_0xe5db('0x27')](_0x2c935b[_0xe5db('0x28')]);if(_0x2c935b['name']){delete _0x2c935b[_0xe5db('0x29')];}_0x5cace0[_0xe5db('0x1b')](_0x5491a5)[_0xe5db('0x2a')](_0x2c935b);};}exports['index']=function(_0x5ea4a1,_0x46c66d){var _0x52b851={},_0x446bf2={},_0x898e={'count':0x0,'rows':[]};var _0xf7dbbc=_[_0xe5db('0x2b')](db[_0xe5db('0x2c')][_0xe5db('0x2d')],function(_0x59fc72){return{'name':_0x59fc72[_0xe5db('0x2e')],'type':_0x59fc72[_0xe5db('0x2f')][_0xe5db('0x30')]};});_0x446bf2['model']=_[_0xe5db('0x31')](_[_0xe5db('0x2b')](_0xf7dbbc,_0xe5db('0x29')),['name']);_0x446bf2[_0xe5db('0x32')]=_[_0xe5db('0x33')](_0x5ea4a1[_0xe5db('0x32')]);_0x446bf2[_0xe5db('0x34')]=_[_0xe5db('0x35')](_0x446bf2[_0xe5db('0x36')],_0x446bf2[_0xe5db('0x32')]);_0x52b851['attributes']=_[_0xe5db('0x35')](_0x446bf2[_0xe5db('0x36')],qs['fields'](_0x5ea4a1[_0xe5db('0x32')][_0xe5db('0x37')]));_0x52b851[_0xe5db('0x38')]=_0x52b851[_0xe5db('0x38')]['length']?_0x52b851['attributes']:_0x446bf2[_0xe5db('0x36')];if(!_0x5ea4a1[_0xe5db('0x32')]['hasOwnProperty'](_0xe5db('0x39'))){_0x52b851[_0xe5db('0x20')]=qs[_0xe5db('0x20')](_0x5ea4a1['query'][_0xe5db('0x20')]);_0x52b851[_0xe5db('0x1e')]=qs[_0xe5db('0x1e')](_0x5ea4a1[_0xe5db('0x32')]['offset']);}_0x52b851[_0xe5db('0x3a')]=qs[_0xe5db('0x3b')](_0x5ea4a1[_0xe5db('0x32')]['sort']);_0x52b851[_0xe5db('0x3c')]=qs[_0xe5db('0x34')](_['pick'](_0x5ea4a1[_0xe5db('0x32')],_0x446bf2[_0xe5db('0x34')]),_0xf7dbbc);if(_0x5ea4a1[_0xe5db('0x32')]['filter']){_0x52b851['where']=_['merge'](_0x52b851[_0xe5db('0x3c')],{'$or':_[_0xe5db('0x2b')](_0xf7dbbc,function(_0x1470c6){if(_0x1470c6['type']!=='VIRTUAL'){var _0x2d2848={};_0x2d2848[_0x1470c6[_0xe5db('0x29')]]={'$like':'%'+_0x5ea4a1['query'][_0xe5db('0x3d')]+'%'};return _0x2d2848;}})});}_0x52b851=_[_0xe5db('0x3e')]({},_0x52b851,_0x5ea4a1[_0xe5db('0x3f')]);var _0x4d49e5={'where':_0x52b851[_0xe5db('0x3c')]};return db[_0xe5db('0x2c')]['count'](_0x4d49e5)[_0xe5db('0x26')](function(_0x5534f6){_0x898e[_0xe5db('0x40')]=_0x5534f6;if(_0x5ea4a1[_0xe5db('0x32')][_0xe5db('0x41')]){_0x52b851['include']=[{'all':!![]}];}return db[_0xe5db('0x2c')][_0xe5db('0x42')](_0x52b851);})['then'](function(_0x2e5fba){_0x898e[_0xe5db('0x43')]=_0x2e5fba;return _0x898e;})[_0xe5db('0x26')](respondWithFilteredResult(_0x46c66d,_0x52b851))[_0xe5db('0x44')](handleError(_0x46c66d,null));};exports[_0xe5db('0x45')]=function(_0xe063ad,_0x5bcc03){var _0xbd4bd8={'raw':!![],'where':{'id':_0xe063ad[_0xe5db('0x46')]['id']}},_0x40f391={};_0x40f391[_0xe5db('0x36')]=_[_0xe5db('0x33')](db['CmCustomField']['rawAttributes']);_0x40f391['query']=_[_0xe5db('0x33')](_0xe063ad[_0xe5db('0x32')]);_0x40f391['filters']=_['intersection'](_0x40f391['model'],_0x40f391['query']);_0xbd4bd8['attributes']=_['intersection'](_0x40f391[_0xe5db('0x36')],qs['fields'](_0xe063ad[_0xe5db('0x32')][_0xe5db('0x37')]));_0xbd4bd8[_0xe5db('0x38')]=_0xbd4bd8[_0xe5db('0x38')][_0xe5db('0x47')]?_0xbd4bd8[_0xe5db('0x38')]:_0x40f391[_0xe5db('0x36')];if(_0xe063ad[_0xe5db('0x32')]['includeAll']){_0xbd4bd8['include']=[{'all':!![]}];}_0xbd4bd8=_[_0xe5db('0x3e')]({},_0xbd4bd8,_0xe063ad[_0xe5db('0x3f')]);return db[_0xe5db('0x2c')][_0xe5db('0x48')](_0xbd4bd8)[_0xe5db('0x26')](handleEntityNotFound(_0x5bcc03,null))[_0xe5db('0x26')](respondWithResult(_0x5bcc03,null))[_0xe5db('0x44')](handleError(_0x5bcc03,null));};exports[_0xe5db('0x24')]=function(_0xf00cb4,_0x27bcc4){if(_0xf00cb4['body']['id']){delete _0xf00cb4[_0xe5db('0x49')]['id'];}return db[_0xe5db('0x2c')][_0xe5db('0x48')]({'where':{'id':_0xf00cb4[_0xe5db('0x46')]['id']}})[_0xe5db('0x26')](handleEntityNotFound(_0x27bcc4,null))['then'](saveUpdates(_0xf00cb4[_0xe5db('0x49')],null))[_0xe5db('0x26')](respondWithResult(_0x27bcc4,null))[_0xe5db('0x44')](handleError(_0x27bcc4,null));};exports[_0xe5db('0x25')]=function(_0x588757,_0x2e9cf8){return db['CmCustomField']['find']({'where':{'id':_0x588757[_0xe5db('0x46')]['id']}})[_0xe5db('0x26')](handleEntityNotFound(_0x2e9cf8,null))['then'](removeEntity(_0x2e9cf8,null))[_0xe5db('0x44')](handleError(_0x2e9cf8,null));};exports['create']=function(_0x4aea75,_0x13ff94){var _0x3c1a7c;return db[_0xe5db('0x4a')]['transaction'](function(_0x3615ce){return db[_0xe5db('0x2c')][_0xe5db('0x4b')](_0x4aea75['body'],{'transaction':_0x3615ce})[_0xe5db('0x26')](function(_0xb5cfb9){_0x3c1a7c=_0xb5cfb9;var _0x2cca67={'type':db[_0xe5db('0x4c')][_0xe5db('0x4d')],'transaction':_0x3615ce};switch(_0x4aea75['body']['type']){case _0xe5db('0x4e'):_0x2cca67[_0xe5db('0x2f')]=db[_0xe5db('0x4c')]['TEXT'];break;case'number':_0x2cca67['type']=db[_0xe5db('0x4c')][_0xe5db('0x4f')];break;case _0xe5db('0x50'):_0x2cca67[_0xe5db('0x2f')]=db['Sequelize'][_0xe5db('0x51')];_0x2cca67[_0xe5db('0x52')]=![];break;default:}return db[_0xe5db('0x4a')][_0xe5db('0x53')][_0xe5db('0x54')](_0xe5db('0x55'),util[_0xe5db('0x56')](_0xe5db('0x57'),_0x3c1a7c['id']),_0x2cca67);})['then'](function(){return _0x3c1a7c;});})[_0xe5db('0x26')](respondWithResult(_0x13ff94,0xc9))[_0xe5db('0x44')](handleError(_0x13ff94,null));}; \ No newline at end of file +var _0x3e2a=['show','find','body','params','destroy','create','sequelize','Sequelize','TEXT','text','number','switch','BOOLEAN','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','save','update','then','name','send','index','map','rawAttributes','fieldName','type','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','CmCustomField','findAll','rows','catch'];(function(_0x4699da,_0x50b098){var _0x5b745d=function(_0x14c792){while(--_0x14c792){_0x4699da['push'](_0x4699da['shift']());}};_0x5b745d(++_0x50b098);}(_0x3e2a,0x10c));var _0xa3e2=function(_0x438687,_0x16e2fe){_0x438687=_0x438687-0x0;var _0x2e3313=_0x3e2a[_0x438687];return _0x2e3313;};'use strict';var emlformat=require(_0xa3e2('0x0'));var rimraf=require(_0xa3e2('0x1'));var zipdir=require(_0xa3e2('0x2'));var jsonpatch=require(_0xa3e2('0x3'));var rp=require(_0xa3e2('0x4'));var moment=require(_0xa3e2('0x5'));var BPromise=require(_0xa3e2('0x6'));var Mustache=require(_0xa3e2('0x7'));var util=require(_0xa3e2('0x8'));var path=require('path');var sox=require(_0xa3e2('0x9'));var csv=require('to-csv');var ejs=require(_0xa3e2('0xa'));var fs=require('fs');var fs_extra=require(_0xa3e2('0xb'));var _=require(_0xa3e2('0xc'));var squel=require(_0xa3e2('0xd'));var crypto=require(_0xa3e2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa3e2('0xf'));var toCsv=require(_0xa3e2('0x10'));var querystring=require('querystring');var Papa=require(_0xa3e2('0x11'));var Redis=require(_0xa3e2('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa3e2('0x13'));var logger=require(_0xa3e2('0x14'))(_0xa3e2('0x15'));var utils=require('../../config/utils');var config=require(_0xa3e2('0x16'));var licenseUtil=require(_0xa3e2('0x17'));var db=require(_0xa3e2('0x18'))['db'];function respondWithStatusCode(_0x48627f,_0x3556e0){_0x3556e0=_0x3556e0||0xcc;return function(_0x3b6884){if(_0x3b6884){return _0x48627f['sendStatus'](_0x3556e0);}return _0x48627f[_0xa3e2('0x19')](_0x3556e0)[_0xa3e2('0x1a')]();};}function respondWithResult(_0x47aa71,_0x1f7ca2){_0x1f7ca2=_0x1f7ca2||0xc8;return function(_0x570cf2){if(_0x570cf2){return _0x47aa71['status'](_0x1f7ca2)[_0xa3e2('0x1b')](_0x570cf2);}};}function respondWithFilteredResult(_0x27e259,_0x3f2319){return function(_0x4d1c19){if(_0x4d1c19){var _0x2dd399=typeof _0x3f2319['offset']===_0xa3e2('0x1c')&&typeof _0x3f2319['limit']===_0xa3e2('0x1c');var _0xde7e29=_0x4d1c19[_0xa3e2('0x1d')];var _0x2486c1=_0x2dd399?0x0:_0x3f2319[_0xa3e2('0x1e')];var _0x3fb6d1=_0x2dd399?_0x4d1c19['count']:_0x3f2319[_0xa3e2('0x1e')]+_0x3f2319[_0xa3e2('0x1f')];var _0x7471c1;if(_0x3fb6d1>=_0xde7e29){_0x3fb6d1=_0xde7e29;_0x7471c1=0xc8;}else{_0x7471c1=0xce;}_0x27e259[_0xa3e2('0x19')](_0x7471c1);return _0x27e259[_0xa3e2('0x20')](_0xa3e2('0x21'),_0x2486c1+'-'+_0x3fb6d1+'/'+_0xde7e29)[_0xa3e2('0x1b')](_0x4d1c19);}return null;};}function patchUpdates(_0x1c697b){return function(_0x247003){try{jsonpatch['apply'](_0x247003,_0x1c697b,!![]);}catch(_0x3d8540){return BPromise['reject'](_0x3d8540);}return _0x247003[_0xa3e2('0x22')]();};}function saveUpdates(_0x36b93d,_0xbc7240){return function(_0x480b59){if(_0x480b59){return _0x480b59[_0xa3e2('0x23')](_0x36b93d)[_0xa3e2('0x24')](function(_0x5d63c4){return _0x5d63c4;});}return null;};}function removeEntity(_0x29559c,_0x416730){return function(_0x1c9411){if(_0x1c9411){return _0x1c9411['destroy']()['then'](function(){_0x29559c['status'](0xcc)[_0xa3e2('0x1a')]();});}};}function handleEntityNotFound(_0x32c1e7,_0x27c274){return function(_0x51c82b){if(!_0x51c82b){_0x32c1e7['sendStatus'](0x194);}return _0x51c82b;};}function handleError(_0x40348e,_0x3b06bb){_0x3b06bb=_0x3b06bb||0x1f4;return function(_0xd5af7b){logger['error'](_0xd5af7b['stack']);if(_0xd5af7b['name']){delete _0xd5af7b[_0xa3e2('0x25')];}_0x40348e[_0xa3e2('0x19')](_0x3b06bb)[_0xa3e2('0x26')](_0xd5af7b);};}exports[_0xa3e2('0x27')]=function(_0x4098a6,_0x217d0b){var _0xa260de={},_0x2d6d88={},_0x1535a8={'count':0x0,'rows':[]};var _0x46113e=_[_0xa3e2('0x28')](db['CmCustomField'][_0xa3e2('0x29')],function(_0x55a939){return{'name':_0x55a939[_0xa3e2('0x2a')],'type':_0x55a939[_0xa3e2('0x2b')]['key']};});_0x2d6d88[_0xa3e2('0x2c')]=_[_0xa3e2('0x2d')](_['map'](_0x46113e,_0xa3e2('0x25')),[_0xa3e2('0x25')]);_0x2d6d88[_0xa3e2('0x2e')]=_[_0xa3e2('0x2f')](_0x4098a6[_0xa3e2('0x2e')]);_0x2d6d88[_0xa3e2('0x30')]=_[_0xa3e2('0x31')](_0x2d6d88[_0xa3e2('0x2c')],_0x2d6d88['query']);_0xa260de[_0xa3e2('0x32')]=_[_0xa3e2('0x31')](_0x2d6d88[_0xa3e2('0x2c')],qs[_0xa3e2('0x33')](_0x4098a6[_0xa3e2('0x2e')]['fields']));_0xa260de['attributes']=_0xa260de[_0xa3e2('0x32')][_0xa3e2('0x34')]?_0xa260de[_0xa3e2('0x32')]:_0x2d6d88['model'];if(!_0x4098a6[_0xa3e2('0x2e')][_0xa3e2('0x35')](_0xa3e2('0x36'))){_0xa260de['limit']=qs[_0xa3e2('0x1f')](_0x4098a6['query']['limit']);_0xa260de[_0xa3e2('0x1e')]=qs['offset'](_0x4098a6['query'][_0xa3e2('0x1e')]);}_0xa260de[_0xa3e2('0x37')]=qs['sort'](_0x4098a6[_0xa3e2('0x2e')]['sort']);_0xa260de[_0xa3e2('0x38')]=qs[_0xa3e2('0x30')](_[_0xa3e2('0x39')](_0x4098a6[_0xa3e2('0x2e')],_0x2d6d88[_0xa3e2('0x30')]),_0x46113e);if(_0x4098a6[_0xa3e2('0x2e')][_0xa3e2('0x3a')]){_0xa260de[_0xa3e2('0x38')]=_[_0xa3e2('0x3b')](_0xa260de[_0xa3e2('0x38')],{'$or':_['map'](_0x46113e,function(_0x52ba4a){if(_0x52ba4a[_0xa3e2('0x2b')]!==_0xa3e2('0x3c')){var _0x4f2cd2={};_0x4f2cd2[_0x52ba4a['name']]={'$like':'%'+_0x4098a6[_0xa3e2('0x2e')][_0xa3e2('0x3a')]+'%'};return _0x4f2cd2;}})});}_0xa260de=_[_0xa3e2('0x3b')]({},_0xa260de,_0x4098a6[_0xa3e2('0x3d')]);var _0x35aae9={'where':_0xa260de[_0xa3e2('0x38')]};return db['CmCustomField'][_0xa3e2('0x1d')](_0x35aae9)[_0xa3e2('0x24')](function(_0x5137be){_0x1535a8[_0xa3e2('0x1d')]=_0x5137be;if(_0x4098a6['query'][_0xa3e2('0x3e')]){_0xa260de[_0xa3e2('0x3f')]=[{'all':!![]}];}return db[_0xa3e2('0x40')][_0xa3e2('0x41')](_0xa260de);})['then'](function(_0xfd0737){_0x1535a8[_0xa3e2('0x42')]=_0xfd0737;return _0x1535a8;})[_0xa3e2('0x24')](respondWithFilteredResult(_0x217d0b,_0xa260de))[_0xa3e2('0x43')](handleError(_0x217d0b,null));};exports[_0xa3e2('0x44')]=function(_0x4af843,_0x30ab6f){var _0x76cdb8={'raw':!![],'where':{'id':_0x4af843['params']['id']}},_0xdce978={};_0xdce978[_0xa3e2('0x2c')]=_[_0xa3e2('0x2f')](db[_0xa3e2('0x40')][_0xa3e2('0x29')]);_0xdce978[_0xa3e2('0x2e')]=_['keys'](_0x4af843[_0xa3e2('0x2e')]);_0xdce978[_0xa3e2('0x30')]=_[_0xa3e2('0x31')](_0xdce978['model'],_0xdce978['query']);_0x76cdb8[_0xa3e2('0x32')]=_[_0xa3e2('0x31')](_0xdce978['model'],qs[_0xa3e2('0x33')](_0x4af843[_0xa3e2('0x2e')][_0xa3e2('0x33')]));_0x76cdb8[_0xa3e2('0x32')]=_0x76cdb8[_0xa3e2('0x32')][_0xa3e2('0x34')]?_0x76cdb8[_0xa3e2('0x32')]:_0xdce978[_0xa3e2('0x2c')];if(_0x4af843[_0xa3e2('0x2e')][_0xa3e2('0x3e')]){_0x76cdb8[_0xa3e2('0x3f')]=[{'all':!![]}];}_0x76cdb8=_[_0xa3e2('0x3b')]({},_0x76cdb8,_0x4af843[_0xa3e2('0x3d')]);return db[_0xa3e2('0x40')][_0xa3e2('0x45')](_0x76cdb8)[_0xa3e2('0x24')](handleEntityNotFound(_0x30ab6f,null))['then'](respondWithResult(_0x30ab6f,null))['catch'](handleError(_0x30ab6f,null));};exports[_0xa3e2('0x23')]=function(_0x4da7b0,_0x21ce4c){if(_0x4da7b0[_0xa3e2('0x46')]['id']){delete _0x4da7b0['body']['id'];}return db[_0xa3e2('0x40')][_0xa3e2('0x45')]({'where':{'id':_0x4da7b0[_0xa3e2('0x47')]['id']}})['then'](handleEntityNotFound(_0x21ce4c,null))[_0xa3e2('0x24')](saveUpdates(_0x4da7b0['body'],null))[_0xa3e2('0x24')](respondWithResult(_0x21ce4c,null))[_0xa3e2('0x43')](handleError(_0x21ce4c,null));};exports[_0xa3e2('0x48')]=function(_0x58b347,_0x26c22e){return db[_0xa3e2('0x40')]['find']({'where':{'id':_0x58b347['params']['id']}})[_0xa3e2('0x24')](handleEntityNotFound(_0x26c22e,null))[_0xa3e2('0x24')](removeEntity(_0x26c22e,null))[_0xa3e2('0x43')](handleError(_0x26c22e,null));};exports[_0xa3e2('0x49')]=function(_0x18208f,_0x2407d5){var _0x4c4d7a;return db[_0xa3e2('0x4a')]['transaction'](function(_0x48aff7){return db['CmCustomField'][_0xa3e2('0x49')](_0x18208f[_0xa3e2('0x46')],{'transaction':_0x48aff7})[_0xa3e2('0x24')](function(_0x5bf3bb){_0x4c4d7a=_0x5bf3bb;var _0x452af1={'type':db[_0xa3e2('0x4b')][_0xa3e2('0x4c')],'transaction':_0x48aff7};switch(_0x18208f[_0xa3e2('0x46')][_0xa3e2('0x2b')]){case _0xa3e2('0x4d'):_0x452af1[_0xa3e2('0x2b')]=db[_0xa3e2('0x4b')][_0xa3e2('0x4c')];break;case _0xa3e2('0x4e'):_0x452af1[_0xa3e2('0x2b')]=db[_0xa3e2('0x4b')]['INTEGER'];break;case _0xa3e2('0x4f'):_0x452af1[_0xa3e2('0x2b')]=db[_0xa3e2('0x4b')][_0xa3e2('0x50')];_0x452af1['defaultValue']=![];break;default:}return db[_0xa3e2('0x4a')]['queryInterface']['addColumn'](_0xa3e2('0x51'),util[_0xa3e2('0x52')](_0xa3e2('0x53'),_0x4c4d7a['id']),_0x452af1);})[_0xa3e2('0x24')](function(){return _0x4c4d7a;});})[_0xa3e2('0x24')](respondWithResult(_0x2407d5,0xc9))['catch'](handleError(_0x2407d5,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index d1b86bd..fa3a93e 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 _0xcd39=['request-promise','rimraf','./cmCustomField.attributes','exports','CmCustomField','util','api','moment','bluebird'];(function(_0xc77498,_0x519cfe){var _0x5f2ac2=function(_0x3cd1a0){while(--_0x3cd1a0){_0xc77498['push'](_0xc77498['shift']());}};_0x5f2ac2(++_0x519cfe);}(_0xcd39,0x1eb));var _0x9cd3=function(_0x5216e0,_0x4f8cb9){_0x5216e0=_0x5216e0-0x0;var _0x5b3f40=_0xcd39[_0x5216e0];return _0x5b3f40;};'use strict';var _=require('lodash');var util=require(_0x9cd3('0x0'));var logger=require('../../config/logger')(_0x9cd3('0x1'));var moment=require(_0x9cd3('0x2'));var BPromise=require(_0x9cd3('0x3'));var rp=require(_0x9cd3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9cd3('0x5'));var config=require('../../config/environment');var attributes=require(_0x9cd3('0x6'));module[_0x9cd3('0x7')]=function(_0x342242,_0x55e11a){return _0x342242['define'](_0x9cd3('0x8'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x82c0=['exports','define','CmCustomField','cm_custom_fields','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes'];(function(_0x24e6f8,_0x18325d){var _0x36708f=function(_0x57a05b){while(--_0x57a05b){_0x24e6f8['push'](_0x24e6f8['shift']());}};_0x36708f(++_0x18325d);}(_0x82c0,0x138));var _0x082c=function(_0x55a58c,_0x56ab1f){_0x55a58c=_0x55a58c-0x0;var _0x33c533=_0x82c0[_0x55a58c];return _0x33c533;};'use strict';var _=require(_0x082c('0x0'));var util=require('util');var logger=require(_0x082c('0x1'))(_0x082c('0x2'));var moment=require(_0x082c('0x3'));var BPromise=require(_0x082c('0x4'));var rp=require(_0x082c('0x5'));var fs=require('fs');var path=require(_0x082c('0x6'));var rimraf=require(_0x082c('0x7'));var config=require(_0x082c('0x8'));var attributes=require(_0x082c('0x9'));module[_0x082c('0xa')]=function(_0x5da2f,_0x5eb1ae){return _0x5da2f[_0x082c('0xb')](_0x082c('0xc'),attributes,{'tableName':_0x082c('0xd'),'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 c2a2ca9..1c80c36 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 _0x745c=['message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x146484,_0x27a7f0){var _0x4c7aa3=function(_0x481b98){while(--_0x481b98){_0x146484['push'](_0x146484['shift']());}};_0x4c7aa3(++_0x27a7f0);}(_0x745c,0x1e4));var _0xc745=function(_0x25875a,_0x54dd06){_0x25875a=_0x25875a-0x0;var _0x21daee=_0x745c[_0x25875a];return _0x21daee;};'use strict';var _=require(_0xc745('0x0'));var util=require(_0xc745('0x1'));var moment=require('moment');var BPromise=require(_0xc745('0x2'));var rs=require(_0xc745('0x3'));var fs=require('fs');var Redis=require(_0xc745('0x4'));var db=require(_0xc745('0x5'))['db'];var utils=require(_0xc745('0x6'));var logger=require(_0xc745('0x7'))(_0xc745('0x8'));var config=require(_0xc745('0x9'));var jayson=require(_0xc745('0xa'));var client=jayson[_0xc745('0xb')][_0xc745('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x881cc7,_0x2a5fbe,_0x264074){return new BPromise(function(_0x4df180,_0x4a6889){return client['request'](_0x881cc7,_0x264074)['then'](function(_0x4e081c){logger[_0xc745('0xd')](_0xc745('0xe'),_0x2a5fbe,'request\x20sent');logger[_0xc745('0xf')](_0xc745('0x10'),_0x2a5fbe,'request\x20sent',JSON[_0xc745('0x11')](_0x4e081c));if(_0x4e081c['error']){if(_0x4e081c[_0xc745('0x12')][_0xc745('0x13')]===0x1f4){logger[_0xc745('0x12')]('CmCustomField,\x20%s,\x20%s',_0x2a5fbe,_0x4e081c[_0xc745('0x12')]['message']);return _0x4a6889(_0x4e081c[_0xc745('0x12')]['message']);}logger['error'](_0xc745('0xe'),_0x2a5fbe,_0x4e081c[_0xc745('0x12')][_0xc745('0x14')]);return _0x4df180(_0x4e081c['error'][_0xc745('0x14')]);}else{logger[_0xc745('0xd')](_0xc745('0xe'),_0x2a5fbe,_0xc745('0x15'));_0x4df180(_0x4e081c[_0xc745('0x16')]['message']);}})[_0xc745('0x17')](function(_0x4f3f2b){logger[_0xc745('0x12')]('CmCustomField,\x20%s,\x20%s',_0x2a5fbe,_0x4f3f2b);_0x4a6889(_0x4f3f2b);});});} \ No newline at end of file +var _0xf663=['stringify','code','error','message','result','catch','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xf663,0x16b));var _0x3f66=function(_0x53f1ee,_0x29cff6){_0x53f1ee=_0x53f1ee-0x0;var _0x3638da=_0xf663[_0x53f1ee];return _0x3638da;};'use strict';var _=require(_0x3f66('0x0'));var util=require('util');var moment=require(_0x3f66('0x1'));var BPromise=require('bluebird');var rs=require(_0x3f66('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3f66('0x3'));var logger=require(_0x3f66('0x4'))(_0x3f66('0x5'));var config=require(_0x3f66('0x6'));var jayson=require(_0x3f66('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1fc9bb,_0x4d677f,_0x31ee7e){return new BPromise(function(_0x2fa516,_0x246618){return client[_0x3f66('0x8')](_0x1fc9bb,_0x31ee7e)[_0x3f66('0x9')](function(_0x4e9b80){logger[_0x3f66('0xa')](_0x3f66('0xb'),_0x4d677f,_0x3f66('0xc'));logger[_0x3f66('0xd')](_0x3f66('0xe'),_0x4d677f,_0x3f66('0xc'),JSON[_0x3f66('0xf')](_0x4e9b80));if(_0x4e9b80['error']){if(_0x4e9b80['error'][_0x3f66('0x10')]===0x1f4){logger[_0x3f66('0x11')](_0x3f66('0xb'),_0x4d677f,_0x4e9b80['error'][_0x3f66('0x12')]);return _0x246618(_0x4e9b80[_0x3f66('0x11')]['message']);}logger[_0x3f66('0x11')](_0x3f66('0xb'),_0x4d677f,_0x4e9b80[_0x3f66('0x11')]['message']);return _0x2fa516(_0x4e9b80[_0x3f66('0x11')][_0x3f66('0x12')]);}else{logger[_0x3f66('0xa')]('CmCustomField,\x20%s,\x20%s',_0x4d677f,_0x3f66('0xc'));_0x2fa516(_0x4e9b80[_0x3f66('0x13')][_0x3f66('0x12')]);}})[_0x3f66('0x14')](function(_0x1a4bc2){logger['error']('CmCustomField,\x20%s,\x20%s',_0x4d677f,_0x1a4bc2);_0x246618(_0x1a4bc2);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index ed8ed04..5b5d17e 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 _0x3baf=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','post','create','put'];(function(_0x13750c,_0x91becf){var _0x26acfd=function(_0x3ef89d){while(--_0x3ef89d){_0x13750c['push'](_0x13750c['shift']());}};_0x26acfd(++_0x91becf);}(_0x3baf,0xf7));var _0xf3ba=function(_0x11db48,_0x363415){_0x11db48=_0x11db48-0x0;var _0x2cc224=_0x3baf[_0x11db48];return _0x2cc224;};'use strict';var multer=require(_0xf3ba('0x0'));var util=require(_0xf3ba('0x1'));var path=require(_0xf3ba('0x2'));var timeout=require(_0xf3ba('0x3'));var express=require(_0xf3ba('0x4'));var router=express[_0xf3ba('0x5')]();var fs_extra=require(_0xf3ba('0x6'));var auth=require(_0xf3ba('0x7'));var interaction=require(_0xf3ba('0x8'));var config=require(_0xf3ba('0x9'));var controller=require(_0xf3ba('0xa'));router[_0xf3ba('0xb')]('/',auth[_0xf3ba('0xc')](),controller[_0xf3ba('0xd')]);router[_0xf3ba('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xf3ba('0xe')]('/',auth['isAuthenticated'](),controller[_0xf3ba('0xf')]);router[_0xf3ba('0x10')](_0xf3ba('0x11'),auth[_0xf3ba('0xc')](),controller[_0xf3ba('0x12')]);router[_0xf3ba('0x13')](_0xf3ba('0x11'),auth[_0xf3ba('0xc')](),controller[_0xf3ba('0x14')]);module[_0xf3ba('0x15')]=router; \ No newline at end of file +var _0x8d0a=['../../components/interaction/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index','get','/:id','create','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4befdb,_0x4819ea){var _0x575441=function(_0x282b41){while(--_0x282b41){_0x4befdb['push'](_0x4befdb['shift']());}};_0x575441(++_0x4819ea);}(_0x8d0a,0x65));var _0xa8d0=function(_0x48f04e,_0x1fa8f2){_0x48f04e=_0x48f04e-0x0;var _0x4b0219=_0x8d0a[_0x48f04e];return _0x4b0219;};'use strict';var multer=require(_0xa8d0('0x0'));var util=require('util');var path=require(_0xa8d0('0x1'));var timeout=require(_0xa8d0('0x2'));var express=require(_0xa8d0('0x3'));var router=express[_0xa8d0('0x4')]();var fs_extra=require(_0xa8d0('0x5'));var auth=require(_0xa8d0('0x6'));var interaction=require(_0xa8d0('0x7'));var config=require(_0xa8d0('0x8'));var controller=require(_0xa8d0('0x9'));router['get']('/',auth[_0xa8d0('0xa')](),controller[_0xa8d0('0xb')]);router[_0xa8d0('0xc')](_0xa8d0('0xd'),auth[_0xa8d0('0xa')](),controller['show']);router['post']('/',auth[_0xa8d0('0xa')](),controller[_0xa8d0('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xa8d0('0xf')]);router['delete'](_0xa8d0('0xd'),auth[_0xa8d0('0xa')](),controller[_0xa8d0('0x10')]);module[_0xa8d0('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index edd540a..98cb88a 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 _0x7779=['format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','STRING','BOOLEAN','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7779,0xe1));var _0x9777=function(_0x299eb8,_0x2a3c76){_0x299eb8=_0x299eb8-0x0;var _0x59ee49=_0x7779[_0x299eb8];return _0x59ee49;};'use strict';var moment=require(_0x9777('0x0'));var Sequelize=require(_0x9777('0x1'));module['exports']={'phone':{'type':Sequelize[_0x9777('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x9777('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x9777('0x4')],'defaultValue':moment()[_0x9777('0x5')](_0x9777('0x6'))},'countbusyretry':{'type':Sequelize[_0x9777('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9777('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x9777('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9777('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x9777('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x9777('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x9777('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x9777('0x7')],'unique':_0x9777('0x9')},'ListId':{'type':Sequelize[_0x9777('0x7')],'unique':'contactListQueue'},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x9777('0x7')],'unique':_0x9777('0x9')},'CampaignId':{'type':Sequelize[_0x9777('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x9777('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9777('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x9777('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x9777('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x9777('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x6f1d=['contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED'];(function(_0x32883a,_0x14cdb2){var _0x2d0f09=function(_0x35d201){while(--_0x35d201){_0x32883a['push'](_0x32883a['shift']());}};_0x2d0f09(++_0x14cdb2);}(_0x6f1d,0x1c3));var _0xd6f1=function(_0x9c7b0,_0x1ad85d){_0x9c7b0=_0x9c7b0-0x0;var _0x18c429=_0x6f1d[_0x9c7b0];return _0x18c429;};'use strict';var moment=require(_0xd6f1('0x0'));var Sequelize=require(_0xd6f1('0x1'));module[_0xd6f1('0x2')]={'phone':{'type':Sequelize[_0xd6f1('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xd6f1('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xd6f1('0x5')],'defaultValue':moment()['format'](_0xd6f1('0x6'))},'countbusyretry':{'type':Sequelize[_0xd6f1('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd6f1('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd6f1('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xd6f1('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd6f1('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd6f1('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xd6f1('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xd6f1('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xd6f1('0x7')],'unique':_0xd6f1('0x9')},'ListId':{'type':Sequelize[_0xd6f1('0x7')],'unique':'contactListQueue'},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xd6f1('0x7')],'unique':_0xd6f1('0x9')},'CampaignId':{'type':Sequelize[_0xd6f1('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xd6f1('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd6f1('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd6f1('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd6f1('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xd6f1('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xd6f1('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0xd6f1('0x5')],'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 4892f89..369356f 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 _0x61a5=['$gte','$lt','$lte','$ne','$between','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contained','$any','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','catch','show','params','fields','include','options','find','create','body','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','omit','dataValues','createdAt','updatedAt','state','statedesc','campaign','membername','user','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','end','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','direction','hopperIds','ASC','DESC','isEmpty','priority','scheduledAt','literal','findOne','recallme','UPDATE','Contact','Company','List','Queue','getPreviewRecall','transaction','scheduledat','LOCK','CmCompany','CmList','dialActive','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','moment','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','json','offset','undefined','count','limit','status','set','Content-Range','update','then','sendStatus','error','stack','name','send','index','CmHopper','fieldName','type','model','map','query','keys','intersection','filters','$and','$or','$gt'];(function(_0x4c2189,_0x308589){var _0x583fa8=function(_0x25b5f8){while(--_0x25b5f8){_0x4c2189['push'](_0x4c2189['shift']());}};_0x583fa8(++_0x308589);}(_0x61a5,0xf0));var _0x561a=function(_0x52c4e9,_0x5412d0){_0x52c4e9=_0x52c4e9-0x0;var _0x252a03=_0x61a5[_0x52c4e9];return _0x252a03;};'use strict';var moment=require(_0x561a('0x0'));var _=require('lodash');var qs=require(_0x561a('0x1'));var logger=require(_0x561a('0x2'))(_0x561a('0x3'));var shared=require(_0x561a('0x4'));var db=require(_0x561a('0x5'))['db'];function respondWithResult(_0x58f636,_0xe92b4d){_0xe92b4d=_0xe92b4d||0xc8;return function(_0x33c0f5){if(_0x33c0f5){return _0x58f636['status'](_0xe92b4d)[_0x561a('0x6')](_0x33c0f5);}};}function respondWithFilteredResult(_0x31f762,_0x24c89a){return function(_0x2646bd){if(_0x2646bd){var _0x3d55f8=typeof _0x24c89a[_0x561a('0x7')]===_0x561a('0x8')&&typeof _0x24c89a['limit']===_0x561a('0x8');var _0x52563e=_0x2646bd[_0x561a('0x9')];var _0x5288b4=_0x3d55f8?0x0:_0x24c89a['offset'];var _0x34e464=_0x3d55f8?_0x2646bd[_0x561a('0x9')]:_0x24c89a['offset']+_0x24c89a[_0x561a('0xa')];var _0x5cc8ed;if(_0x34e464>=_0x52563e){_0x34e464=_0x52563e;_0x5cc8ed=0xc8;}else{_0x5cc8ed=0xce;}_0x31f762[_0x561a('0xb')](_0x5cc8ed);return _0x31f762[_0x561a('0xc')](_0x561a('0xd'),_0x5288b4+'-'+_0x34e464+'/'+_0x52563e)[_0x561a('0x6')](_0x2646bd);}return null;};}function saveUpdates(_0x2777c6,_0x3dfa9f){return function(_0x136465){if(_0x136465){return _0x136465[_0x561a('0xe')](_0x2777c6)[_0x561a('0xf')](function(_0x4f1e33){return _0x4f1e33;});}return null;};}function handleEntityNotFound(_0x2a332e,_0x28638b){return function(_0x5696b9){if(!_0x5696b9){_0x2a332e[_0x561a('0x10')](0x194);}return _0x5696b9;};}function handleError(_0x64498a,_0x1ab5ae){_0x1ab5ae=_0x1ab5ae||0x1f4;return function(_0xecbcc4){logger[_0x561a('0x11')](_0xecbcc4[_0x561a('0x12')]);if(_0xecbcc4[_0x561a('0x13')]){delete _0xecbcc4[_0x561a('0x13')];}_0x64498a[_0x561a('0xb')](_0x1ab5ae)[_0x561a('0x14')](_0xecbcc4);};}exports[_0x561a('0x15')]=function(_0x48df6a,_0x43c5aa){var _0x190057={},_0x533d95={},_0x11033f={'count':0x0,'rows':[]};var _0x785831=_['map'](db[_0x561a('0x16')]['rawAttributes'],function(_0x4d66b8){return{'name':_0x4d66b8[_0x561a('0x17')],'type':_0x4d66b8[_0x561a('0x18')]['key']};});_0x533d95[_0x561a('0x19')]=_[_0x561a('0x1a')](_0x785831,_0x561a('0x13'));_0x533d95[_0x561a('0x1b')]=_[_0x561a('0x1c')](_0x48df6a[_0x561a('0x1b')]);_0x533d95['filters']=_[_0x561a('0x1d')](_0x533d95[_0x561a('0x19')],_0x533d95[_0x561a('0x1b')]);_0x533d95['filters']=_['concat'](_0x533d95[_0x561a('0x1e')],[_0x561a('0x1f'),_0x561a('0x20'),_0x561a('0x21'),_0x561a('0x22'),_0x561a('0x23'),_0x561a('0x24'),_0x561a('0x25'),'$eq','$not',_0x561a('0x26'),_0x561a('0x27'),_0x561a('0x28'),_0x561a('0x29'),'$like',_0x561a('0x2a'),_0x561a('0x2b'),_0x561a('0x2c'),_0x561a('0x2d'),_0x561a('0x2e'),'$contains',_0x561a('0x2f'),_0x561a('0x30')]);_0x190057['attributes']=_[_0x561a('0x1d')](_0x533d95[_0x561a('0x19')],qs['fields'](_0x48df6a[_0x561a('0x1b')]['fields']));_0x190057['attributes']=_0x190057[_0x561a('0x31')][_0x561a('0x32')]?_0x190057['attributes']:_0x533d95[_0x561a('0x19')];if(!_0x48df6a[_0x561a('0x1b')][_0x561a('0x33')](_0x561a('0x34'))){_0x190057[_0x561a('0xa')]=qs[_0x561a('0xa')](_0x48df6a[_0x561a('0x1b')][_0x561a('0xa')]);_0x190057['offset']=qs[_0x561a('0x7')](_0x48df6a[_0x561a('0x1b')][_0x561a('0x7')]);}_0x190057[_0x561a('0x35')]=qs[_0x561a('0x36')](_0x48df6a['query'][_0x561a('0x36')]);_0x190057[_0x561a('0x37')]=qs[_0x561a('0x1e')](_[_0x561a('0x38')](_0x48df6a['query'],_0x533d95[_0x561a('0x1e')]),_0x785831);if(_0x48df6a[_0x561a('0x1b')][_0x561a('0x39')]){_0x190057['where']=_['merge'](_0x190057[_0x561a('0x37')],{'$or':_['map'](_0x785831,function(_0x5a45a4){if(_0x5a45a4['type']!==_0x561a('0x3a')){var _0x2a2479={};_0x2a2479[_0x5a45a4[_0x561a('0x13')]]={'$like':'%'+_0x48df6a[_0x561a('0x1b')][_0x561a('0x39')]+'%'};return _0x2a2479;}})});}_0x190057=_[_0x561a('0x3b')]({},_0x190057,_0x48df6a['options']);var _0x588a39={'where':_0x190057[_0x561a('0x37')]};return db[_0x561a('0x16')][_0x561a('0x9')](_0x588a39)[_0x561a('0xf')](function(_0x4d81f7){_0x11033f[_0x561a('0x9')]=_0x4d81f7;if(_0x48df6a[_0x561a('0x1b')][_0x561a('0x3c')]){_0x190057['include']=[{'all':!![]}];}return db[_0x561a('0x16')][_0x561a('0x3d')](_0x190057);})[_0x561a('0xf')](function(_0x330c8d){_0x11033f['rows']=_0x330c8d;return _0x11033f;})[_0x561a('0xf')](respondWithFilteredResult(_0x43c5aa,_0x190057))[_0x561a('0x3e')](handleError(_0x43c5aa,null));};exports[_0x561a('0x3f')]=function(_0x5c59dc,_0x3ebf2b){var _0x3ae2db={'raw':!![],'where':{'id':_0x5c59dc[_0x561a('0x40')]['id']}},_0x289c68={};_0x289c68[_0x561a('0x19')]=_[_0x561a('0x1c')](db[_0x561a('0x16')]['rawAttributes']);_0x289c68[_0x561a('0x1b')]=_[_0x561a('0x1c')](_0x5c59dc[_0x561a('0x1b')]);_0x289c68[_0x561a('0x1e')]=_[_0x561a('0x1d')](_0x289c68[_0x561a('0x19')],_0x289c68['query']);_0x3ae2db[_0x561a('0x31')]=_[_0x561a('0x1d')](_0x289c68[_0x561a('0x19')],qs[_0x561a('0x41')](_0x5c59dc[_0x561a('0x1b')][_0x561a('0x41')]));_0x3ae2db[_0x561a('0x31')]=_0x3ae2db[_0x561a('0x31')][_0x561a('0x32')]?_0x3ae2db['attributes']:_0x289c68[_0x561a('0x19')];if(_0x5c59dc[_0x561a('0x1b')]['includeAll']){_0x3ae2db[_0x561a('0x42')]=[{'all':!![]}];}_0x3ae2db=_['merge']({},_0x3ae2db,_0x5c59dc[_0x561a('0x43')]);return db[_0x561a('0x16')][_0x561a('0x44')](_0x3ae2db)[_0x561a('0xf')](handleEntityNotFound(_0x3ebf2b,null))[_0x561a('0xf')](respondWithResult(_0x3ebf2b,null))['catch'](handleError(_0x3ebf2b,null));};exports[_0x561a('0x45')]=function(_0x12e7c6,_0x30b94d){return db[_0x561a('0x16')][_0x561a('0x45')](_0x12e7c6[_0x561a('0x46')],{})['then'](respondWithResult(_0x30b94d,0xc9))['catch'](handleError(_0x30b94d,null));};exports[_0x561a('0xe')]=function(_0x5d6f3d,_0x4c4127){if(_0x5d6f3d['body']['id']){delete _0x5d6f3d['body']['id'];}return db['CmHopper'][_0x561a('0x44')]({'where':{'id':_0x5d6f3d[_0x561a('0x40')]['id']}})[_0x561a('0xf')](handleEntityNotFound(_0x4c4127,null))['then'](saveUpdates(_0x5d6f3d[_0x561a('0x46')],null))['then'](respondWithResult(_0x4c4127,null))['catch'](handleError(_0x4c4127,null));};exports[_0x561a('0x47')]=function(_0x13a2ad,_0x19d247){return db['CmHopper'][_0x561a('0x47')]()['then'](respondWithResult(_0x19d247,null))[_0x561a('0x3e')](handleError(_0x19d247,null));};exports['destroy']=function(_0x1bd3df,_0x43d557){var _0x68dc4a;var _0x14d82b=_0x1bd3df[_0x561a('0x40')]['id'];return db[_0x561a('0x16')][_0x561a('0x44')]({'where':{'id':_0x1bd3df[_0x561a('0x40')]['id']}})[_0x561a('0xf')](handleEntityNotFound(_0x43d557,null))['then'](function(_0x1cb7e4){if(_0x1cb7e4){return _0x1cb7e4[_0x561a('0x48')]()[_0x561a('0xf')](function(_0x48ed34){return _0x48ed34;});}})[_0x561a('0xf')](function(_0x4583b1){_0x68dc4a=_0x4583b1;if(_0x4583b1){if(_0x4583b1['VoiceQueueId']||_0x4583b1[_0x561a('0x49')]){return db[_0x4583b1[_0x561a('0x4a')]?_0x561a('0x4b'):'Campaign'][_0x561a('0x44')]({'where':{'id':_0x4583b1[_0x561a('0x4a')]?_0x4583b1[_0x561a('0x4a')]:_0x4583b1[_0x561a('0x49')]},'attributes':['id',_0x561a('0x13')],'raw':!![]});}}})[_0x561a('0xf')](function(_0x3d9b63){var _0x4ebb99={};if(_0x3d9b63){_[_0x561a('0x3b')](_0x4ebb99,_[_0x561a('0x4c')](_0x68dc4a[_0x561a('0x4d')],[_0x561a('0x4e'),_0x561a('0x4f'),'id']));_0x4ebb99[_0x561a('0x50')]=0x15;_0x4ebb99[_0x561a('0x51')]='deleted';_0x4ebb99[_0x561a('0x52')]=_0x3d9b63[_0x561a('0x13')];_0x4ebb99[_0x561a('0x53')]=_0x1bd3df['user'][_0x561a('0x13')];_0x4ebb99['UserId']=_0x1bd3df[_0x561a('0x54')]['id'];_0x4ebb99[_0x561a('0x55')]=!![];_0x4ebb99[_0x561a('0x56')]=moment()[_0x561a('0x57')](_0x561a('0x58'));_0x4ebb99[_0x561a('0x59')]=_0x68dc4a[_0x561a('0x5a')];_0x4ebb99['campaigntype']=_0x68dc4a['VoiceQueueId']?_0x561a('0x5b'):_0x561a('0x5c');return db[_0x561a('0x5d')][_0x561a('0x44')]({'where':{'id':_0x4ebb99[_0x561a('0x5e')]},'attributes':[_0x561a('0x5f'),'lastName']})[_0x561a('0xf')](function(_0x1b0ecf){if(!_['isNil'](_0x43d557)&&!_[_0x561a('0x60')](_0x1b0ecf['firstName'])){_0x4ebb99[_0x561a('0x61')]=_0x1b0ecf[_0x561a('0x5f')];if(!_[_0x561a('0x60')](_0x1b0ecf[_0x561a('0x62')])){_0x4ebb99[_0x561a('0x61')]+='\x20'+_0x1b0ecf['lastName'];}}})[_0x561a('0x63')](function(){return db['CmHopperFinal'][_0x561a('0x45')](_0x4ebb99);});}})[_0x561a('0xf')](function(_0x457d0e){return db['CmHopperAdditionalPhone']['destroy']({'where':{'CmHopperId':_0x14d82b}});})['then'](function(){return _0x43d557['status'](0xcc)[_0x561a('0x64')]();})[_0x561a('0x3e')](handleError(_0x43d557,null));};exports['getPreview']=function(_0xb0f744,_0xe76184){var _0x209f07=[];return db['CmContact'][_0x561a('0x47')]()[_0x561a('0xf')](function(_0x4341a4){_0x209f07=_[_0x561a('0x1c')](_0x4341a4);return _0xb0f744[_0x561a('0x54')][_0x561a('0x65')]({'where':{'type':_0x561a('0x66'),'dialActive':!![],'dialMethod':_0x561a('0x67')},'attributes':['id',_0x561a('0x68'),_0x561a('0x69')],'raw':!![]});})[_0x561a('0xf')](function(_0x5ac279){if(_0x5ac279&&_0x5ac279[_0x561a('0x32')]){return db[_0x561a('0x6a')]['transaction'](function(_0x54056b){var _0x33509a={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x561a('0x57')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x561a('0x1a')](_0x5ac279,'id')},'$or':[{'UserId':null},{'UserId':_0xb0f744[_0x561a('0x54')]['id']}]};var _0x174483={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x5ac279)[_0x561a('0x39')]([_0x561a('0x69'),0x0])[_0x561a('0x1a')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0xb0f744['user']['id']}]};var _0x518826={'$or':[_0x33509a,_0x174483]};var _0x21234d=[];if(_0xb0f744[_0x561a('0x46')][_0x561a('0x6b')]&&_0xb0f744[_0x561a('0x46')][_0x561a('0x6b')]==='prev'){if(!_['isEmpty'](_0xb0f744['body'][_0x561a('0x6c')])){_0x518826['id']={'$in':_0xb0f744[_0x561a('0x46')][_0x561a('0x6c')]};}_0x21234d=[['priority','ASC'],['scheduledAt',_0x5ac279[0x0]['dialOrderByScheduledAt']===_0x561a('0x6d')?_0x561a('0x6e'):'ASC'],db[_0x561a('0x6a')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x561a('0x6e')]];}else{if(!_[_0x561a('0x6f')](_0xb0f744['body'][_0x561a('0x6c')])){_0x518826['id']={'$notIn':_0xb0f744['body'][_0x561a('0x6c')]};}_0x21234d=[[_0x561a('0x70'),_0x561a('0x6e')],[_0x561a('0x71'),_0x5ac279[0x0][_0x561a('0x68')]],db[_0x561a('0x6a')][_0x561a('0x72')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id','ASC']];}return db[_0x561a('0x16')][_0x561a('0x73')]({'attributes':['id','scheduledat',_0x561a('0x5a'),_0x561a('0x74')],'where':_0x518826,'order':_0x21234d,'transaction':_0x54056b,'lock':_0x54056b['LOCK'][_0x561a('0x75')],'include':[{'model':db[_0x561a('0x5d')],'as':_0x561a('0x76'),'attributes':_0x209f07,'include':[{'model':db['CmCompany'],'as':_0x561a('0x77'),'attributes':['id',_0x561a('0x13')]}]},{'model':db['CmList'],'as':_0x561a('0x78'),'attributes':['id','name']},{'model':db[_0x561a('0x4b')],'as':_0x561a('0x79'),'attributes':['id',_0x561a('0x13'),'dialActive']}]})[_0x561a('0xf')](function(_0x4e155f){if(_0x4e155f){return _0x4e155f[_0x561a('0xe')]({'UserId':_0xb0f744['user']['id']},{'transaction':_0x54056b});}});});}})[_0x561a('0xf')](handleEntityNotFound(_0xe76184,null))[_0x561a('0xf')](respondWithResult(_0xe76184,null))[_0x561a('0x3e')](handleError(_0xe76184,null));};exports[_0x561a('0x7a')]=function(_0x3e0b55,_0x127301,_0x4dcb3a){var _0x528846=[];var _0x43dd9b=_0x3e0b55[_0x561a('0x40')]['id'];var _0x5153f0=_0x3e0b55[_0x561a('0x54')]['id'];return db[_0x561a('0x5d')][_0x561a('0x47')]()[_0x561a('0xf')](function(_0x26699b){_0x528846=_[_0x561a('0x1c')](_0x26699b);return db[_0x561a('0x6a')][_0x561a('0x7b')](function(_0x127a29){const _0x45df37={'id':_0x43dd9b};return db[_0x561a('0x16')][_0x561a('0x73')]({'attributes':['id',_0x561a('0x7c'),'recallme'],'where':_0x45df37,'transaction':_0x127a29,'lock':_0x127a29[_0x561a('0x7d')][_0x561a('0x75')],'include':[{'model':db[_0x561a('0x5d')],'as':'Contact','attributes':_0x528846,'include':[{'model':db[_0x561a('0x7e')],'as':_0x561a('0x77'),'attributes':['id',_0x561a('0x13')]}]},{'model':db[_0x561a('0x7f')],'as':'List','attributes':['id',_0x561a('0x13')]},{'model':db[_0x561a('0x4b')],'as':_0x561a('0x79'),'attributes':['id',_0x561a('0x13'),_0x561a('0x80')]}]})[_0x561a('0xf')](function(_0x40d801){if(_0x40d801){return _0x40d801['update']({'UserId':_0x5153f0},{'transaction':_0x127a29});}});});})['then'](handleEntityNotFound(_0x127301,null))[_0x561a('0xf')](respondWithResult(_0x127301,null))[_0x561a('0x3e')](handleError(_0x127301,null));};exports['getOpenContacts']=function(_0x5a6e8a,_0x54f78e){return _0x5a6e8a[_0x561a('0x54')][_0x561a('0x65')]({'where':{'type':_0x561a('0x66'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})['then'](function(_0x4ec14a){if(_0x4ec14a&&_0x4ec14a[_0x561a('0x32')]){return db[_0x561a('0x16')][_0x561a('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x561a('0x57')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x561a('0x1a')](_0x4ec14a,'id')},'$or':[{'UserId':null},{'UserId':_0x5a6e8a[_0x561a('0x54')]['id']}]}});}return 0x0;})[_0x561a('0xf')](function(_0x3698c2){if(!_[_0x561a('0x60')](_0x3698c2)&&_['isNumber'](_0x3698c2)){return _0x54f78e['status'](0xc8)[_0x561a('0x6')]({'contacts':_0x3698c2});}else{logger[_0x561a('0x11')](_0x561a('0x81'),_0x561a('0x82'),0x194,_0x561a('0x83'));_0x54f78e[_0x561a('0x10')](0x194);}})['catch'](handleError(_0x54f78e,null));};exports[_0x561a('0x84')]=function(_0x1d3771,_0x168fe8){var _0x443a4a=shared[_0x561a('0x85')];var _0x56ce02=[];_[_0x561a('0x1a')](_0x443a4a,function(_0x81c3e4){_0x56ce02[_0x561a('0x86')]({'id':_0x81c3e4[_0x561a('0x13')],'name':_0x81c3e4[_0x561a('0x13')],'utcOffset':_0x81c3e4[_0x561a('0x87')]});});return _0x168fe8[_0x561a('0xb')](0xc8)[_0x561a('0x6')]({'tz':_0x56ce02});};exports[_0x561a('0x88')]=function(_0x5bdb1c,_0x379e9e){var _0x2d3cb3=shared[_0x561a('0x85')];var _0x2874a0={};if(!_[_0x561a('0x60')](_0x2d3cb3[_0x5bdb1c[_0x561a('0x46')]['id']]))_0x2874a0=_0x2d3cb3[_0x5bdb1c[_0x561a('0x46')]['id']];return _0x379e9e['status'](0xc8)[_0x561a('0x6')](_0x2874a0);}; \ No newline at end of file +var _0x2fed=['offset','undefined','count','limit','set','Content-Range','update','error','stack','name','send','map','CmHopper','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','concat','$and','$gte','$lt','$lte','$ne','$eq','$in','$notIn','$like','$notLike','$notILike','$overlap','$contains','$any','attributes','fields','length','nolimit','sort','pick','filter','where','merge','options','then','includeAll','include','rows','show','params','find','catch','create','body','describe','destroy','CampaignId','VoiceQueue','Campaign','VoiceQueueId','createdAt','state','statedesc','deleted','campaign','user','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','value','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','LOCK','dialActive','getOpenContacts','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','timezones','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','json'];(function(_0x271eed,_0x16cb91){var _0x30cc89=function(_0x104324){while(--_0x104324){_0x271eed['push'](_0x271eed['shift']());}};_0x30cc89(++_0x16cb91);}(_0x2fed,0x7c));var _0xd2fe=function(_0x4ef044,_0x4490cc){_0x4ef044=_0x4ef044-0x0;var _0x509a04=_0x2fed[_0x4ef044];return _0x509a04;};'use strict';var moment=require(_0xd2fe('0x0'));var _=require(_0xd2fe('0x1'));var qs=require(_0xd2fe('0x2'));var logger=require(_0xd2fe('0x3'))(_0xd2fe('0x4'));var shared=require('../../config/environment');var db=require(_0xd2fe('0x5'))['db'];function respondWithResult(_0x20b497,_0x48707a){_0x48707a=_0x48707a||0xc8;return function(_0x58f3f8){if(_0x58f3f8){return _0x20b497[_0xd2fe('0x6')](_0x48707a)[_0xd2fe('0x7')](_0x58f3f8);}};}function respondWithFilteredResult(_0xd85f89,_0x5be4d3){return function(_0x2f7bf5){if(_0x2f7bf5){var _0x44e015=typeof _0x5be4d3[_0xd2fe('0x8')]===_0xd2fe('0x9')&&typeof _0x5be4d3['limit']===_0xd2fe('0x9');var _0x107546=_0x2f7bf5[_0xd2fe('0xa')];var _0x1943ab=_0x44e015?0x0:_0x5be4d3[_0xd2fe('0x8')];var _0x2a06a9=_0x44e015?_0x2f7bf5[_0xd2fe('0xa')]:_0x5be4d3[_0xd2fe('0x8')]+_0x5be4d3[_0xd2fe('0xb')];var _0x13c68f;if(_0x2a06a9>=_0x107546){_0x2a06a9=_0x107546;_0x13c68f=0xc8;}else{_0x13c68f=0xce;}_0xd85f89[_0xd2fe('0x6')](_0x13c68f);return _0xd85f89[_0xd2fe('0xc')](_0xd2fe('0xd'),_0x1943ab+'-'+_0x2a06a9+'/'+_0x107546)[_0xd2fe('0x7')](_0x2f7bf5);}return null;};}function saveUpdates(_0x72f7e0,_0x2431da){return function(_0x22e414){if(_0x22e414){return _0x22e414[_0xd2fe('0xe')](_0x72f7e0)['then'](function(_0x1c2401){return _0x1c2401;});}return null;};}function handleEntityNotFound(_0x30fad9,_0x2a9355){return function(_0x5607a3){if(!_0x5607a3){_0x30fad9['sendStatus'](0x194);}return _0x5607a3;};}function handleError(_0x4ab9d2,_0x203bea){_0x203bea=_0x203bea||0x1f4;return function(_0x54f4cc){logger[_0xd2fe('0xf')](_0x54f4cc[_0xd2fe('0x10')]);if(_0x54f4cc[_0xd2fe('0x11')]){delete _0x54f4cc[_0xd2fe('0x11')];}_0x4ab9d2[_0xd2fe('0x6')](_0x203bea)[_0xd2fe('0x12')](_0x54f4cc);};}exports['index']=function(_0x5486e2,_0xe958a0){var _0x40162f={},_0x57f517={},_0x3ca715={'count':0x0,'rows':[]};var _0x247e4c=_[_0xd2fe('0x13')](db[_0xd2fe('0x14')][_0xd2fe('0x15')],function(_0x38d5ab){return{'name':_0x38d5ab[_0xd2fe('0x16')],'type':_0x38d5ab[_0xd2fe('0x17')][_0xd2fe('0x18')]};});_0x57f517[_0xd2fe('0x19')]=_['map'](_0x247e4c,_0xd2fe('0x11'));_0x57f517['query']=_[_0xd2fe('0x1a')](_0x5486e2[_0xd2fe('0x1b')]);_0x57f517[_0xd2fe('0x1c')]=_[_0xd2fe('0x1d')](_0x57f517['model'],_0x57f517[_0xd2fe('0x1b')]);_0x57f517['filters']=_[_0xd2fe('0x1e')](_0x57f517[_0xd2fe('0x1c')],[_0xd2fe('0x1f'),'$or','$gt',_0xd2fe('0x20'),_0xd2fe('0x21'),_0xd2fe('0x22'),_0xd2fe('0x23'),_0xd2fe('0x24'),'$not','$between','$notBetween',_0xd2fe('0x25'),_0xd2fe('0x26'),_0xd2fe('0x27'),_0xd2fe('0x28'),'$iLike',_0xd2fe('0x29'),_0xd2fe('0x27'),_0xd2fe('0x2a'),_0xd2fe('0x2b'),'$contained',_0xd2fe('0x2c')]);_0x40162f[_0xd2fe('0x2d')]=_[_0xd2fe('0x1d')](_0x57f517['model'],qs[_0xd2fe('0x2e')](_0x5486e2[_0xd2fe('0x1b')][_0xd2fe('0x2e')]));_0x40162f[_0xd2fe('0x2d')]=_0x40162f['attributes'][_0xd2fe('0x2f')]?_0x40162f[_0xd2fe('0x2d')]:_0x57f517[_0xd2fe('0x19')];if(!_0x5486e2[_0xd2fe('0x1b')]['hasOwnProperty'](_0xd2fe('0x30'))){_0x40162f[_0xd2fe('0xb')]=qs[_0xd2fe('0xb')](_0x5486e2[_0xd2fe('0x1b')][_0xd2fe('0xb')]);_0x40162f[_0xd2fe('0x8')]=qs['offset'](_0x5486e2[_0xd2fe('0x1b')][_0xd2fe('0x8')]);}_0x40162f['order']=qs[_0xd2fe('0x31')](_0x5486e2[_0xd2fe('0x1b')][_0xd2fe('0x31')]);_0x40162f['where']=qs[_0xd2fe('0x1c')](_[_0xd2fe('0x32')](_0x5486e2['query'],_0x57f517[_0xd2fe('0x1c')]),_0x247e4c);if(_0x5486e2[_0xd2fe('0x1b')][_0xd2fe('0x33')]){_0x40162f[_0xd2fe('0x34')]=_[_0xd2fe('0x35')](_0x40162f[_0xd2fe('0x34')],{'$or':_['map'](_0x247e4c,function(_0x4dd379){if(_0x4dd379[_0xd2fe('0x17')]!=='VIRTUAL'){var _0x50a2ff={};_0x50a2ff[_0x4dd379[_0xd2fe('0x11')]]={'$like':'%'+_0x5486e2[_0xd2fe('0x1b')][_0xd2fe('0x33')]+'%'};return _0x50a2ff;}})});}_0x40162f=_[_0xd2fe('0x35')]({},_0x40162f,_0x5486e2[_0xd2fe('0x36')]);var _0x4e0b4d={'where':_0x40162f[_0xd2fe('0x34')]};return db['CmHopper']['count'](_0x4e0b4d)[_0xd2fe('0x37')](function(_0x325ef7){_0x3ca715[_0xd2fe('0xa')]=_0x325ef7;if(_0x5486e2[_0xd2fe('0x1b')][_0xd2fe('0x38')]){_0x40162f[_0xd2fe('0x39')]=[{'all':!![]}];}return db[_0xd2fe('0x14')]['findAll'](_0x40162f);})[_0xd2fe('0x37')](function(_0x135829){_0x3ca715[_0xd2fe('0x3a')]=_0x135829;return _0x3ca715;})['then'](respondWithFilteredResult(_0xe958a0,_0x40162f))['catch'](handleError(_0xe958a0,null));};exports[_0xd2fe('0x3b')]=function(_0x3b0c00,_0x11a6df){var _0x1151e7={'raw':!![],'where':{'id':_0x3b0c00[_0xd2fe('0x3c')]['id']}},_0x3c6267={};_0x3c6267[_0xd2fe('0x19')]=_['keys'](db[_0xd2fe('0x14')][_0xd2fe('0x15')]);_0x3c6267['query']=_[_0xd2fe('0x1a')](_0x3b0c00[_0xd2fe('0x1b')]);_0x3c6267[_0xd2fe('0x1c')]=_[_0xd2fe('0x1d')](_0x3c6267['model'],_0x3c6267[_0xd2fe('0x1b')]);_0x1151e7[_0xd2fe('0x2d')]=_[_0xd2fe('0x1d')](_0x3c6267[_0xd2fe('0x19')],qs['fields'](_0x3b0c00[_0xd2fe('0x1b')][_0xd2fe('0x2e')]));_0x1151e7[_0xd2fe('0x2d')]=_0x1151e7['attributes'][_0xd2fe('0x2f')]?_0x1151e7[_0xd2fe('0x2d')]:_0x3c6267[_0xd2fe('0x19')];if(_0x3b0c00['query'][_0xd2fe('0x38')]){_0x1151e7[_0xd2fe('0x39')]=[{'all':!![]}];}_0x1151e7=_['merge']({},_0x1151e7,_0x3b0c00['options']);return db['CmHopper'][_0xd2fe('0x3d')](_0x1151e7)[_0xd2fe('0x37')](handleEntityNotFound(_0x11a6df,null))['then'](respondWithResult(_0x11a6df,null))[_0xd2fe('0x3e')](handleError(_0x11a6df,null));};exports[_0xd2fe('0x3f')]=function(_0x17589d,_0x5e6f7d){return db[_0xd2fe('0x14')][_0xd2fe('0x3f')](_0x17589d[_0xd2fe('0x40')],{})[_0xd2fe('0x37')](respondWithResult(_0x5e6f7d,0xc9))[_0xd2fe('0x3e')](handleError(_0x5e6f7d,null));};exports[_0xd2fe('0xe')]=function(_0x36baa2,_0x4fe5cb){if(_0x36baa2[_0xd2fe('0x40')]['id']){delete _0x36baa2[_0xd2fe('0x40')]['id'];}return db[_0xd2fe('0x14')][_0xd2fe('0x3d')]({'where':{'id':_0x36baa2[_0xd2fe('0x3c')]['id']}})['then'](handleEntityNotFound(_0x4fe5cb,null))['then'](saveUpdates(_0x36baa2[_0xd2fe('0x40')],null))[_0xd2fe('0x37')](respondWithResult(_0x4fe5cb,null))[_0xd2fe('0x3e')](handleError(_0x4fe5cb,null));};exports['describe']=function(_0x5c4956,_0xc09227){return db[_0xd2fe('0x14')][_0xd2fe('0x41')]()[_0xd2fe('0x37')](respondWithResult(_0xc09227,null))[_0xd2fe('0x3e')](handleError(_0xc09227,null));};exports[_0xd2fe('0x42')]=function(_0x377e88,_0x13ec7d){var _0x465490;var _0x4318f4=_0x377e88[_0xd2fe('0x3c')]['id'];return db['CmHopper'][_0xd2fe('0x3d')]({'where':{'id':_0x377e88[_0xd2fe('0x3c')]['id']}})[_0xd2fe('0x37')](handleEntityNotFound(_0x13ec7d,null))['then'](function(_0xcf824e){if(_0xcf824e){return _0xcf824e['destroy']()['then'](function(_0x2238be){return _0x2238be;});}})['then'](function(_0x3be739){_0x465490=_0x3be739;if(_0x3be739){if(_0x3be739['VoiceQueueId']||_0x3be739[_0xd2fe('0x43')]){return db[_0x3be739['VoiceQueueId']?_0xd2fe('0x44'):_0xd2fe('0x45')]['find']({'where':{'id':_0x3be739['VoiceQueueId']?_0x3be739[_0xd2fe('0x46')]:_0x3be739[_0xd2fe('0x43')]},'attributes':['id','name'],'raw':!![]});}}})[_0xd2fe('0x37')](function(_0x363015){var _0xd4ce24={};if(_0x363015){_['merge'](_0xd4ce24,_['omit'](_0x465490['dataValues'],[_0xd2fe('0x47'),'updatedAt','id']));_0xd4ce24[_0xd2fe('0x48')]=0x15;_0xd4ce24[_0xd2fe('0x49')]=_0xd2fe('0x4a');_0xd4ce24[_0xd2fe('0x4b')]=_0x363015[_0xd2fe('0x11')];_0xd4ce24['membername']=_0x377e88[_0xd2fe('0x4c')][_0xd2fe('0x11')];_0xd4ce24['UserId']=_0x377e88[_0xd2fe('0x4c')]['id'];_0xd4ce24[_0xd2fe('0x4a')]=!![];_0xd4ce24['deletedat']=moment()[_0xd2fe('0x4d')](_0xd2fe('0x4e'));_0xd4ce24[_0xd2fe('0x4f')]=_0x465490[_0xd2fe('0x50')];_0xd4ce24['campaigntype']=_0x465490['VoiceQueueId']?_0xd2fe('0x51'):_0xd2fe('0x52');return db[_0xd2fe('0x53')]['find']({'where':{'id':_0xd4ce24[_0xd2fe('0x54')]},'attributes':['firstName',_0xd2fe('0x55')]})['then'](function(_0x4107de){if(!_['isNil'](_0x13ec7d)&&!_[_0xd2fe('0x56')](_0x4107de[_0xd2fe('0x57')])){_0xd4ce24[_0xd2fe('0x58')]=_0x4107de['firstName'];if(!_[_0xd2fe('0x56')](_0x4107de['lastName'])){_0xd4ce24[_0xd2fe('0x58')]+='\x20'+_0x4107de[_0xd2fe('0x55')];}}})[_0xd2fe('0x59')](function(){return db[_0xd2fe('0x5a')]['create'](_0xd4ce24);});}})[_0xd2fe('0x37')](function(_0x52e516){return db[_0xd2fe('0x5b')][_0xd2fe('0x42')]({'where':{'CmHopperId':_0x4318f4}});})[_0xd2fe('0x37')](function(){return _0x13ec7d[_0xd2fe('0x6')](0xcc)[_0xd2fe('0x5c')]();})[_0xd2fe('0x3e')](handleError(_0x13ec7d,null));};exports['getPreview']=function(_0x20783a,_0x1c6592){var _0x4c7325=[];return db['CmContact'][_0xd2fe('0x41')]()['then'](function(_0x22948f){_0x4c7325=_[_0xd2fe('0x1a')](_0x22948f);return _0x20783a[_0xd2fe('0x4c')][_0xd2fe('0x5d')]({'where':{'type':_0xd2fe('0x5e'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xd2fe('0x5f'),'dialPreviewAutoRecallMe'],'raw':!![]});})['then'](function(_0x16d68a){if(_0x16d68a&&_0x16d68a[_0xd2fe('0x2f')]){return db['sequelize']['transaction'](function(_0x291d88){var _0x264d9d={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xd2fe('0x4d')](_0xd2fe('0x4e'))},'VoiceQueueId':{'$in':_[_0xd2fe('0x13')](_0x16d68a,'id')},'$or':[{'UserId':null},{'UserId':_0x20783a[_0xd2fe('0x4c')]['id']}]};var _0x5e5d7c={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x16d68a)[_0xd2fe('0x33')]([_0xd2fe('0x60'),0x0])[_0xd2fe('0x13')]('id')[_0xd2fe('0x61')]()},'$or':[{'UserId':null},{'UserId':_0x20783a[_0xd2fe('0x4c')]['id']}]};var _0x184d39={'$or':[_0x264d9d,_0x5e5d7c]};var _0x10021b=[];if(_0x20783a[_0xd2fe('0x40')]['direction']&&_0x20783a['body'][_0xd2fe('0x62')]===_0xd2fe('0x63')){if(!_[_0xd2fe('0x64')](_0x20783a[_0xd2fe('0x40')][_0xd2fe('0x65')])){_0x184d39['id']={'$in':_0x20783a['body'][_0xd2fe('0x65')]};}_0x10021b=[[_0xd2fe('0x66'),_0xd2fe('0x67')],['scheduledAt',_0x16d68a[0x0][_0xd2fe('0x5f')]==='ASC'?_0xd2fe('0x68'):'ASC'],db[_0xd2fe('0x69')][_0xd2fe('0x6a')](_0xd2fe('0x6b')),['id',_0xd2fe('0x68')]];}else{if(!_[_0xd2fe('0x64')](_0x20783a[_0xd2fe('0x40')]['hopperIds'])){_0x184d39['id']={'$notIn':_0x20783a[_0xd2fe('0x40')][_0xd2fe('0x65')]};}_0x10021b=[[_0xd2fe('0x66'),'DESC'],[_0xd2fe('0x6c'),_0x16d68a[0x0]['dialOrderByScheduledAt']],db[_0xd2fe('0x69')]['literal'](_0xd2fe('0x6d')),['id',_0xd2fe('0x67')]];}return db[_0xd2fe('0x14')][_0xd2fe('0x6e')]({'attributes':['id',_0xd2fe('0x6f'),_0xd2fe('0x50'),_0xd2fe('0x70')],'where':_0x184d39,'order':_0x10021b,'transaction':_0x291d88,'lock':_0x291d88['LOCK'][_0xd2fe('0x71')],'include':[{'model':db[_0xd2fe('0x53')],'as':_0xd2fe('0x72'),'attributes':_0x4c7325,'include':[{'model':db[_0xd2fe('0x73')],'as':_0xd2fe('0x74'),'attributes':['id',_0xd2fe('0x11')]}]},{'model':db[_0xd2fe('0x75')],'as':_0xd2fe('0x76'),'attributes':['id','name']},{'model':db[_0xd2fe('0x44')],'as':_0xd2fe('0x77'),'attributes':['id','name','dialActive']}]})['then'](function(_0x19e1e0){if(_0x19e1e0){return _0x19e1e0[_0xd2fe('0xe')]({'UserId':_0x20783a[_0xd2fe('0x4c')]['id']},{'transaction':_0x291d88});}});});}})[_0xd2fe('0x37')](handleEntityNotFound(_0x1c6592,null))['then'](respondWithResult(_0x1c6592,null))[_0xd2fe('0x3e')](handleError(_0x1c6592,null));};exports['getPreviewRecall']=function(_0x5ca53c,_0x322cc2,_0x4f5e96){var _0x22a007=[];var _0x24a619=_0x5ca53c[_0xd2fe('0x3c')]['id'];var _0xe6d707=_0x5ca53c['user']['id'];return db[_0xd2fe('0x53')][_0xd2fe('0x41')]()[_0xd2fe('0x37')](function(_0x169ead){_0x22a007=_[_0xd2fe('0x1a')](_0x169ead);return db[_0xd2fe('0x69')]['transaction'](function(_0x4c910c){const _0x318dbf={'id':_0x24a619};return db[_0xd2fe('0x14')][_0xd2fe('0x6e')]({'attributes':['id',_0xd2fe('0x6f'),'recallme'],'where':_0x318dbf,'transaction':_0x4c910c,'lock':_0x4c910c[_0xd2fe('0x78')][_0xd2fe('0x71')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x22a007,'include':[{'model':db[_0xd2fe('0x73')],'as':_0xd2fe('0x74'),'attributes':['id',_0xd2fe('0x11')]}]},{'model':db[_0xd2fe('0x75')],'as':_0xd2fe('0x76'),'attributes':['id',_0xd2fe('0x11')]},{'model':db[_0xd2fe('0x44')],'as':_0xd2fe('0x77'),'attributes':['id','name',_0xd2fe('0x79')]}]})[_0xd2fe('0x37')](function(_0x5dbaec){if(_0x5dbaec){return _0x5dbaec[_0xd2fe('0xe')]({'UserId':_0xe6d707},{'transaction':_0x4c910c});}});});})['then'](handleEntityNotFound(_0x322cc2,null))['then'](respondWithResult(_0x322cc2,null))['catch'](handleError(_0x322cc2,null));};exports[_0xd2fe('0x7a')]=function(_0x593310,_0x655d1){return _0x593310[_0xd2fe('0x4c')][_0xd2fe('0x5d')]({'where':{'type':_0xd2fe('0x5e'),'dialActive':!![],'dialMethod':_0xd2fe('0x7b')},'attributes':['id'],'raw':!![]})['then'](function(_0x3e2088){if(_0x3e2088&&_0x3e2088[_0xd2fe('0x2f')]){return db[_0xd2fe('0x14')][_0xd2fe('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xd2fe('0x4d')](_0xd2fe('0x4e'))},'VoiceQueueId':{'$in':_[_0xd2fe('0x13')](_0x3e2088,'id')},'$or':[{'UserId':null},{'UserId':_0x593310['user']['id']}]}});}return 0x0;})[_0xd2fe('0x37')](function(_0x4ac020){if(!_[_0xd2fe('0x56')](_0x4ac020)&&_[_0xd2fe('0x7c')](_0x4ac020)){return _0x655d1[_0xd2fe('0x6')](0xc8)[_0xd2fe('0x7')]({'contacts':_0x4ac020});}else{logger['error'](_0xd2fe('0x7d'),_0xd2fe('0x7a'),0x194,_0xd2fe('0x7e'));_0x655d1[_0xd2fe('0x7f')](0x194);}})['catch'](handleError(_0x655d1,null));};exports[_0xd2fe('0x80')]=function(_0x872048,_0x159ba2){var _0x2c370f=shared[_0xd2fe('0x81')];var _0x275608=[];_[_0xd2fe('0x13')](_0x2c370f,function(_0x59153c){_0x275608['push']({'id':_0x59153c[_0xd2fe('0x11')],'name':_0x59153c[_0xd2fe('0x11')],'utcOffset':_0x59153c[_0xd2fe('0x82')]});});return _0x159ba2[_0xd2fe('0x6')](0xc8)[_0xd2fe('0x7')]({'tz':_0x275608});};exports[_0xd2fe('0x83')]=function(_0x36cbb0,_0x3d3d00){var _0x167922=shared[_0xd2fe('0x81')];var _0x35687b={};if(!_[_0xd2fe('0x56')](_0x167922[_0x36cbb0[_0xd2fe('0x40')]['id']]))_0x35687b=_0x167922[_0x36cbb0[_0xd2fe('0x40')]['id']];return _0x3d3d00[_0xd2fe('0x6')](0xc8)[_0xd2fe('0x7')](_0x35687b);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index da55429..04d63fd 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 _0xbd51=['./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4e9a22,_0x65e645){var _0x364420=function(_0x4ecb09){while(--_0x4ecb09){_0x4e9a22['push'](_0x4e9a22['shift']());}};_0x364420(++_0x65e645);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x2ee485,_0x489149){_0x2ee485=_0x2ee485-0x0;var _0x491080=_0xbd51[_0x2ee485];return _0x491080;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var logger=require(_0x1bd5('0x1'))(_0x1bd5('0x2'));var moment=require(_0x1bd5('0x3'));var BPromise=require(_0x1bd5('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(_0x1bd5('0x5'));module[_0x1bd5('0x6')]=function(_0x43e6b6,_0x59ddfb){return _0x43e6b6[_0x1bd5('0x7')](_0x1bd5('0x8'),attributes,{'tableName':_0x1bd5('0x9'),'paranoid':![],'indexes':[{'name':_0x1bd5('0xa'),'fields':[_0x1bd5('0xa')]},{'name':'phone','fields':[_0x1bd5('0xb')]},{'name':'priority','fields':[_0x1bd5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc1c6=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','exports','CmHopper','cm_hopper','scheduledat','phone','priority'];(function(_0x22b375,_0x4942de){var _0x197dfd=function(_0x190f7a){while(--_0x190f7a){_0x22b375['push'](_0x22b375['shift']());}};_0x197dfd(++_0x4942de);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x31ac31,_0x2944c1){_0x31ac31=_0x31ac31-0x0;var _0x387b08=_0xc1c6[_0x31ac31];return _0x387b08;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module[_0x6c1c('0x7')]=function(_0x524a6b,_0x50c1bb){return _0x524a6b['define'](_0x6c1c('0x8'),attributes,{'tableName':_0x6c1c('0x9'),'paranoid':![],'indexes':[{'name':_0x6c1c('0xa'),'fields':[_0x6c1c('0xa')]},{'name':'phone','fields':[_0x6c1c('0xb')]},{'name':_0x6c1c('0xc'),'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 8e9d4a6..131b428 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 _0xb9c1=['UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','User','Agent','name','length','push','all','GetContactDialer','dataValues','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','destroy','CountReScheduled','literal','format','\x22%s\x22','GetContactRecallMe','keys','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','NOW()','voicePause','CmList','List','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','model','map','info','stringify','catch','error','message','ShowCmHopper','find','then','debug','CreateCmHopper','create','body'];(function(_0x59ca7f,_0x340135){var _0x484377=function(_0x4f0cd9){while(--_0x4f0cd9){_0x59ca7f['push'](_0x59ca7f['shift']());}};_0x484377(++_0x340135);}(_0xb9c1,0xc1));var _0x1b9c=function(_0x3333e9,_0x4d1d0e){_0x3333e9=_0x3333e9-0x0;var _0x48b7bb=_0xb9c1[_0x3333e9];return _0x48b7bb;};'use strict';var _=require(_0x1b9c('0x0'));var util=require('util');var moment=require(_0x1b9c('0x1'));var BPromise=require(_0x1b9c('0x2'));var db=require(_0x1b9c('0x3'))['db'];var logger=require(_0x1b9c('0x4'))(_0x1b9c('0x5'));exports[_0x1b9c('0x6')]=function(_0x199494){var _0x145bf6=this;return new Promise(function(_0x212169,_0x594f40){return db[_0x1b9c('0x7')][_0x1b9c('0x8')]({'raw':_0x199494['options']?_0x199494[_0x1b9c('0x9')][_0x1b9c('0xa')]===undefined?!![]:![]:!![],'where':_0x199494[_0x1b9c('0x9')]?_0x199494[_0x1b9c('0x9')][_0x1b9c('0xb')]||null:null,'attributes':_0x199494[_0x1b9c('0x9')]?_0x199494[_0x1b9c('0x9')][_0x1b9c('0xc')]||null:null,'limit':_0x199494[_0x1b9c('0x9')]?_0x199494['options'][_0x1b9c('0xd')]||null:null,'include':_0x199494[_0x1b9c('0x9')]?_0x199494[_0x1b9c('0x9')]['include']?_['map'](_0x199494[_0x1b9c('0x9')][_0x1b9c('0xe')],function(_0x13bea2){return{'model':db[_0x13bea2[_0x1b9c('0xf')]],'as':_0x13bea2['as'],'attributes':_0x13bea2[_0x1b9c('0xc')],'include':_0x13bea2['include']?_[_0x1b9c('0x10')](_0x13bea2[_0x1b9c('0xe')],function(_0x3fc40d){return{'model':db[_0x3fc40d['model']],'as':_0x3fc40d['as'],'attributes':_0x3fc40d['attributes'],'include':_0x3fc40d[_0x1b9c('0xe')]?_[_0x1b9c('0x10')](_0x3fc40d['include'],function(_0x1717bb){return{'model':db[_0x1717bb[_0x1b9c('0xf')]],'as':_0x1717bb['as'],'attributes':_0x1717bb[_0x1b9c('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x191cd5){logger[_0x1b9c('0x11')]('GetCmHopper',_0x199494);logger['debug']('GetCmHopper',_0x199494,JSON[_0x1b9c('0x12')](_0x191cd5));_0x212169(_0x191cd5);})[_0x1b9c('0x13')](function(_0x49d3ec){logger[_0x1b9c('0x14')]('GetCmHopper',_0x49d3ec[_0x1b9c('0x15')],_0x199494);_0x594f40(_0x145bf6[_0x1b9c('0x14')](0x1f4,_0x49d3ec['message']));});});};exports[_0x1b9c('0x16')]=function(_0x52253b){var _0x92088a=this;return new Promise(function(_0x494c29,_0x3bf09e){return db[_0x1b9c('0x7')][_0x1b9c('0x17')]({'raw':_0x52253b[_0x1b9c('0x9')]?_0x52253b[_0x1b9c('0x9')][_0x1b9c('0xa')]===undefined?!![]:![]:!![],'where':_0x52253b[_0x1b9c('0x9')]?_0x52253b[_0x1b9c('0x9')]['where']||null:null,'attributes':_0x52253b[_0x1b9c('0x9')]?_0x52253b[_0x1b9c('0x9')][_0x1b9c('0xc')]||null:null,'include':_0x52253b[_0x1b9c('0x9')]?_0x52253b[_0x1b9c('0x9')]['include']?_[_0x1b9c('0x10')](_0x52253b[_0x1b9c('0x9')][_0x1b9c('0xe')],function(_0x14e952){return{'model':db[_0x14e952[_0x1b9c('0xf')]],'as':_0x14e952['as'],'attributes':_0x14e952[_0x1b9c('0xc')],'include':_0x14e952[_0x1b9c('0xe')]?_[_0x1b9c('0x10')](_0x14e952['include'],function(_0x51efbe){return{'model':db[_0x51efbe[_0x1b9c('0xf')]],'as':_0x51efbe['as'],'attributes':_0x51efbe['attributes'],'include':_0x51efbe[_0x1b9c('0xe')]?_['map'](_0x51efbe[_0x1b9c('0xe')],function(_0x4d2f46){return{'model':db[_0x4d2f46[_0x1b9c('0xf')]],'as':_0x4d2f46['as'],'attributes':_0x4d2f46[_0x1b9c('0xc')]};}):[]};}):[]};}):[]:[]})[_0x1b9c('0x18')](function(_0xa75b7f){logger['info'](_0x1b9c('0x16'),_0x52253b);logger[_0x1b9c('0x19')]('ShowCmHopper',_0x52253b,JSON[_0x1b9c('0x12')](_0xa75b7f));_0x494c29(_0xa75b7f);})[_0x1b9c('0x13')](function(_0x5ac689){logger['error'](_0x1b9c('0x16'),_0x5ac689['message'],_0x52253b);_0x3bf09e(_0x92088a[_0x1b9c('0x14')](0x1f4,_0x5ac689[_0x1b9c('0x15')]));});});};exports[_0x1b9c('0x1a')]=function(_0x54a9ef){var _0x2513b3=this;return new Promise(function(_0x340724,_0x280dfd){return db[_0x1b9c('0x7')][_0x1b9c('0x1b')](_0x54a9ef[_0x1b9c('0x1c')],{'raw':_0x54a9ef[_0x1b9c('0x9')]?_0x54a9ef[_0x1b9c('0x9')][_0x1b9c('0xa')]===undefined?!![]:![]:!![]})['then'](function(_0x5209f1){logger['info'](_0x1b9c('0x1a'),_0x54a9ef);logger['debug'](_0x1b9c('0x1a'),_0x54a9ef,JSON[_0x1b9c('0x12')](_0x5209f1));_0x340724(_0x5209f1);})[_0x1b9c('0x13')](function(_0x31fba3){logger[_0x1b9c('0x14')](_0x1b9c('0x1a'),_0x31fba3['message'],_0x54a9ef);_0x280dfd(_0x2513b3[_0x1b9c('0x14')](0x1f4,_0x31fba3['message']));});});};exports[_0x1b9c('0x1d')]=function(_0x4e975d){var _0x2acb57=this;return new Promise(function(_0x467ebd,_0x36bc0e){return db[_0x1b9c('0x7')][_0x1b9c('0x1e')](_0x4e975d[_0x1b9c('0x1c')],{'raw':_0x4e975d[_0x1b9c('0x9')]?_0x4e975d[_0x1b9c('0x9')][_0x1b9c('0xa')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e975d[_0x1b9c('0x9')]?_0x4e975d['options'][_0x1b9c('0xb')]||null:null,'attributes':_0x4e975d['options']?_0x4e975d[_0x1b9c('0x9')][_0x1b9c('0xc')]||null:null,'limit':_0x4e975d[_0x1b9c('0x9')]?_0x4e975d[_0x1b9c('0x9')][_0x1b9c('0xd')]||null:null})['then'](function(_0x59636b){logger[_0x1b9c('0x11')](_0x1b9c('0x1d'),_0x4e975d);logger[_0x1b9c('0x11')](_0x1b9c('0x1f'),JSON['stringify'](_0x4e975d[_0x1b9c('0x9')][_0x1b9c('0xb')]),_0x4e975d[_0x1b9c('0x1c')]['active']);logger[_0x1b9c('0x19')](_0x1b9c('0x1d'),_0x4e975d,JSON['stringify'](_0x59636b));_0x467ebd(_0x59636b);})['catch'](function(_0x566400){logger[_0x1b9c('0x14')]('UpdateCmHopper',_0x566400[_0x1b9c('0x15')],_0x4e975d);_0x36bc0e(_0x2acb57[_0x1b9c('0x14')](0x1f4,_0x566400[_0x1b9c('0x15')]));});});};exports[_0x1b9c('0x20')]=function(_0x152c30){var _0x1f5b82=this;return new Promise(function(_0x5f36ac,_0x49e67f){return db[_0x1b9c('0x7')]['destroy']({'where':_0x152c30[_0x1b9c('0x9')]?_0x152c30[_0x1b9c('0x9')][_0x1b9c('0xb')]||null:null})[_0x1b9c('0x18')](function(_0x34f109){logger['info'](_0x1b9c('0x20'),_0x152c30);logger[_0x1b9c('0x19')](_0x1b9c('0x20'),_0x152c30,JSON[_0x1b9c('0x12')](_0x34f109));_0x5f36ac(_0x34f109);})[_0x1b9c('0x13')](function(_0x49268b){logger[_0x1b9c('0x14')]('DestroyCmHopper',_0x49268b[_0x1b9c('0x15')],_0x152c30);_0x49e67f(_0x1f5b82[_0x1b9c('0x14')](0x1f4,_0x49268b[_0x1b9c('0x15')]));});});};exports['GetContactDialer']=function(_0x40d926){var _0x230e01=this;return new Promise(function(_0x14f1ef,_0x249117){return db[_0x1b9c('0x21')][_0x1b9c('0x22')]()[_0x1b9c('0x18')](function(_0x30efe7){return db[_0x1b9c('0x23')][_0x1b9c('0x24')](function(_0x309d9f){return db['CmHopper'][_0x1b9c('0x8')]({'where':_0x40d926[_0x1b9c('0x9')]?_0x40d926['options'][_0x1b9c('0xb')]||null:null,'attributes':_0x40d926[_0x1b9c('0x9')]?_0x40d926['options']['attributes']||null:null,'limit':_0x40d926[_0x1b9c('0x9')]?_0x40d926['options'][_0x1b9c('0xd')]||null:null,'order':_0x40d926[_0x1b9c('0x9')]?_0x40d926[_0x1b9c('0x9')][_0x1b9c('0x25')]||null:null,'transaction':_0x309d9f,'lock':_0x309d9f[_0x1b9c('0x26')][_0x1b9c('0x27')],'include':[{'model':db[_0x1b9c('0x21')],'as':_0x1b9c('0x28'),'attributes':_['keys'](_0x30efe7)},{'model':db[_0x1b9c('0x29')],'as':_0x1b9c('0x2a'),'attributes':['id',_0x1b9c('0x2b'),'voicePause']}]})['then'](function(_0x15a7c5){var _0x1b5dd9=[];var _0x44156f=[];for(var _0x4c465f=0x0;_0x4c465f<_0x15a7c5[_0x1b9c('0x2c')];_0x4c465f+=0x1){var _0xd3b935=_0x15a7c5[_0x4c465f]['UserId'];if(_0xd3b935===null){_0x1b5dd9[_0x1b9c('0x2d')](_0x15a7c5[_0x4c465f][_0x1b9c('0x1e')](_0x40d926['body'],{'transaction':_0x309d9f}));}else if(!_0x44156f['includes'](_0xd3b935)){_0x44156f[_0x1b9c('0x2d')](_0xd3b935);_0x1b5dd9['push'](_0x15a7c5[_0x4c465f][_0x1b9c('0x1e')](_0x40d926['body'],{'transaction':_0x309d9f}));}}return BPromise[_0x1b9c('0x2e')](_0x1b5dd9);});})[_0x1b9c('0x18')](function(_0x53caf0){logger[_0x1b9c('0x11')](_0x1b9c('0x2f'),_0x40d926);if(_0x53caf0[_0x1b9c('0x2c')]>0x0){logger[_0x1b9c('0x11')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x53caf0[0x0][_0x1b9c('0x30')]['id'],_0x53caf0[0x0][_0x1b9c('0x30')]['ContactId'],_0x53caf0[0x0][_0x1b9c('0x30')]['active']);}logger[_0x1b9c('0x19')](_0x1b9c('0x2f'),_0x40d926,JSON[_0x1b9c('0x12')](_0x53caf0));_0x14f1ef(_0x53caf0);})[_0x1b9c('0x13')](function(_0x4989a3){logger[_0x1b9c('0x14')](_0x1b9c('0x2f'),_0x4989a3[_0x1b9c('0x15')],_0x40d926);_0x249117(_0x230e01['error'](0x1f4,_0x4989a3[_0x1b9c('0x15')]));});});});};exports[_0x1b9c('0x31')]=function(_0x91c172){var _0x42072c=this;return new Promise(function(_0x2c2340,_0x247d3a){return db['sequelize'][_0x1b9c('0x24')](function(_0x495bd0){return db[_0x1b9c('0x32')][_0x1b9c('0x1b')](_0x91c172[_0x1b9c('0x1c')],{'raw':_0x91c172['options']?_0x91c172[_0x1b9c('0x9')][_0x1b9c('0xa')]===undefined?!![]:![]:!![],'transaction':_0x495bd0})[_0x1b9c('0x18')](function(){logger[_0x1b9c('0x11')](_0x1b9c('0x33'),JSON[_0x1b9c('0x12')](_0x91c172[_0x1b9c('0x9')][_0x1b9c('0xb')]),_0x91c172[_0x1b9c('0x9')][_0x1b9c('0xb')][_0x1b9c('0x34')]);return db[_0x1b9c('0x7')][_0x1b9c('0x35')]({'where':_0x91c172[_0x1b9c('0x9')]?_0x91c172[_0x1b9c('0x9')][_0x1b9c('0xb')]||null:null,'transaction':_0x495bd0});});})[_0x1b9c('0x18')](function(_0x2b491c){logger[_0x1b9c('0x11')]('MoveContactManagedDialer',_0x91c172);logger['debug']('MoveContactManagedDialer',_0x91c172,JSON[_0x1b9c('0x12')](_0x2b491c));_0x2c2340(_0x2b491c);})['catch'](function(_0x154b88){logger[_0x1b9c('0x14')](_0x1b9c('0x31'),_0x154b88[_0x1b9c('0x15')],_0x91c172);_0x247d3a(_0x42072c['error'](0x1f4,_0x154b88[_0x1b9c('0x15')]));});});};exports[_0x1b9c('0x36')]=function(_0x38bf94){var _0x12abf0=this;return new Promise(function(_0x4c3a8b,_0x49f556){return db[_0x1b9c('0x7')][_0x1b9c('0x8')]({'raw':_0x38bf94['options']?_0x38bf94[_0x1b9c('0x9')][_0x1b9c('0xa')]===undefined?!![]:![]:!![],'where':_0x38bf94[_0x1b9c('0x9')]?_0x38bf94[_0x1b9c('0x9')][_0x1b9c('0xb')]||null:null,'attributes':[[db[_0x1b9c('0x23')]['fn']('COUNT',db[_0x1b9c('0x23')]['fn']('IF',db[_0x1b9c('0x23')][_0x1b9c('0x37')]('`scheduledat`\x20>=\x20'+util[_0x1b9c('0x38')](_0x1b9c('0x39'),moment()[_0x1b9c('0x38')]('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0x1b9c('0x18')](function(_0x11a466){logger['info'](_0x1b9c('0x36'),_0x38bf94);logger['debug'](_0x1b9c('0x36'),_0x38bf94,JSON[_0x1b9c('0x12')](_0x11a466));_0x4c3a8b(_0x11a466);})['catch'](function(_0x434047){logger[_0x1b9c('0x14')](_0x1b9c('0x36'),_0x434047['message'],_0x38bf94);_0x49f556(_0x12abf0[_0x1b9c('0x14')](0x1f4,_0x434047['message']));});});};exports[_0x1b9c('0x3a')]=function(_0x57568f){var _0x2665e5=this;return new Promise(function(_0x127da3,_0x2db235){return db[_0x1b9c('0x21')][_0x1b9c('0x22')]()['then'](function(){return db[_0x1b9c('0x23')]['transaction'](function(_0x5513c8){return db[_0x1b9c('0x7')]['findAll']({'where':_0x57568f[_0x1b9c('0x9')]?_0x57568f[_0x1b9c('0x9')][_0x1b9c('0xb')]||null:null,'attributes':_0x57568f[_0x1b9c('0x9')]?_0x57568f[_0x1b9c('0x9')][_0x1b9c('0xc')]||null:null,'limit':0x1,'order':_0x57568f[_0x1b9c('0x9')]?_0x57568f[_0x1b9c('0x9')][_0x1b9c('0x25')]||null:null,'group':db[_0x1b9c('0x7')]['UserId'],'transaction':_0x5513c8,'lock':_0x5513c8['LOCK'][_0x1b9c('0x27')],'include':_0x57568f[_0x1b9c('0x9')]?_0x57568f['options'][_0x1b9c('0xe')]?_['map'](_0x57568f[_0x1b9c('0x9')]['include'],function(_0x1007da){return{'model':db[_0x1007da['model']],'as':_0x1007da['as'],'attributes':_0x1007da[_0x1b9c('0xc')],'include':_0x1007da[_0x1b9c('0xe')]?_[_0x1b9c('0x10')](_0x1007da[_0x1b9c('0xe')],function(_0x2c1055){return{'model':db[_0x2c1055[_0x1b9c('0xf')]],'as':_0x2c1055['as'],'attributes':_0x2c1055[_0x1b9c('0xc')],'include':_0x2c1055[_0x1b9c('0xe')]?_[_0x1b9c('0x10')](_0x2c1055[_0x1b9c('0xe')],function(_0x2d6f52){return{'model':db[_0x2d6f52[_0x1b9c('0xf')]],'as':_0x2d6f52['as'],'attributes':_0x2d6f52[_0x1b9c('0xc')]};}):[]};}):[]};}):[]:[]})[_0x1b9c('0x18')](function(_0x4ff77c){var _0x3e5709=[];for(var _0x745564=0x0;_0x745564<_0x4ff77c[_0x1b9c('0x2c')];_0x745564+=0x1){_0x3e5709['push'](_0x4ff77c[_0x745564][_0x1b9c('0x1e')](_0x57568f[_0x1b9c('0x1c')],{'transaction':_0x5513c8}));}return BPromise[_0x1b9c('0x2e')](_0x3e5709);});})[_0x1b9c('0x18')](function(_0x42b49b){logger[_0x1b9c('0x11')](_0x1b9c('0x3a'),_0x57568f);logger['debug'](_0x1b9c('0x3a'),_0x57568f,JSON['stringify'](_0x42b49b));_0x127da3(_0x42b49b);})[_0x1b9c('0x13')](function(_0x140ac4){logger[_0x1b9c('0x14')](_0x1b9c('0x3a'),_0x140ac4[_0x1b9c('0x15')],_0x57568f);_0x2db235(_0x2665e5['error'](0x1f4,_0x140ac4['message']));});});});};exports['GetCmHopperPreview']=function(_0x145072){var _0x114493=this;return new Promise(function(_0x287b58,_0x23d6c9){db[_0x1b9c('0x21')]['describe']()[_0x1b9c('0x18')](function(_0x1b95c9){return db[_0x1b9c('0x7')][_0x1b9c('0x8')]({'raw':_0x145072[_0x1b9c('0x9')]?_0x145072[_0x1b9c('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x145072[_0x1b9c('0x9')]?_0x145072[_0x1b9c('0x9')][_0x1b9c('0xb')]||null:null,'attributes':_0x145072[_0x1b9c('0x9')]?_0x145072[_0x1b9c('0x9')]['attributes']||null:null,'limit':_0x145072[_0x1b9c('0x9')]?_0x145072[_0x1b9c('0x9')]['limit']||null:null,'include':_0x145072['options']?_0x145072[_0x1b9c('0x9')][_0x1b9c('0xe')]?_['map'](_0x145072[_0x1b9c('0x9')][_0x1b9c('0xe')],function(_0x1a59dc){return{'model':db[_0x1a59dc[_0x1b9c('0xf')]],'as':_0x1a59dc['as'],'attributes':_0x1a59dc['as']===_0x1b9c('0x28')?_[_0x1b9c('0x3b')](_0x1b95c9):_0x1a59dc[_0x1b9c('0xc')],'include':_0x1a59dc[_0x1b9c('0xe')]?_[_0x1b9c('0x10')](_0x1a59dc[_0x1b9c('0xe')],function(_0x533e18){return{'model':db[_0x533e18[_0x1b9c('0xf')]],'as':_0x533e18['as'],'attributes':_0x533e18[_0x1b9c('0xc')],'include':_0x533e18[_0x1b9c('0xe')]?_[_0x1b9c('0x10')](_0x533e18['include'],function(_0x7c8d2){return{'model':db[_0x7c8d2['model']],'as':_0x7c8d2['as'],'attributes':_0x7c8d2[_0x1b9c('0xc')]};}):[]};}):[]};}):[]:[]})[_0x1b9c('0x18')](function(_0xddbfad){logger[_0x1b9c('0x11')]('GetCmHopper',_0x145072);logger[_0x1b9c('0x19')](_0x1b9c('0x6'),_0x145072,JSON[_0x1b9c('0x12')](_0xddbfad));_0x287b58(_0xddbfad);})[_0x1b9c('0x13')](function(_0x9472e7){logger[_0x1b9c('0x14')]('GetCmHopper',_0x9472e7['message'],_0x145072);_0x23d6c9(_0x114493['error'](0x1f4,_0x9472e7[_0x1b9c('0x15')]));});});});};exports['GetContactByPhone']=function(_0x159d2a){var _0x312170=this;return new Promise(function(_0x5573cd,_0x14c825){return db['CmContact'][_0x1b9c('0x3c')]({'raw':!![],'where':{'phone':_0x159d2a[_0x1b9c('0x9')][_0x1b9c('0xb')][_0x1b9c('0x3d')]},'attributes':['id',_0x1b9c('0x3e')],'order':[['id',_0x1b9c('0x3f')]]})[_0x1b9c('0x18')](function(_0x2d0482){logger[_0x1b9c('0x11')]('getContactByPhone',_0x159d2a);logger[_0x1b9c('0x19')]('getContactByPhone',_0x159d2a,JSON[_0x1b9c('0x12')](_0x2d0482));_0x5573cd(_0x2d0482);})[_0x1b9c('0x13')](function(_0x1e0bd7){logger['error'](_0x1b9c('0x40'),_0x1e0bd7[_0x1b9c('0x15')],_0x159d2a);_0x14c825(_0x312170[_0x1b9c('0x14')](0x1f4,_0x1e0bd7['message']));});});};exports['ResetActiveCalls']=function(_0x63cd6d){var _0x33274d=this;return new Promise(function(_0x1fa669,_0x260c0b){return db[_0x1b9c('0x23')]['transaction'](function(_0x18c4d6){var _0x4309b2=_0x63cd6d[_0x1b9c('0x9')]&&_0x63cd6d[_0x1b9c('0x9')][_0x1b9c('0xb')]?_0x63cd6d[_0x1b9c('0x9')][_0x1b9c('0xb')]:{};return db[_0x1b9c('0x7')][_0x1b9c('0x1e')](_0x63cd6d[_0x1b9c('0x1c')],{'where':_0x4309b2,'transaction':_0x18c4d6})[_0x1b9c('0x18')](function(_0x428133){logger['info'](_0x1b9c('0x41'),_0x63cd6d);logger[_0x1b9c('0x19')]('ResetActiveCalls',_0x63cd6d,JSON[_0x1b9c('0x12')](_0x428133));_0x1fa669(_0x428133);})[_0x1b9c('0x13')](function(_0x1bf19b){logger[_0x1b9c('0x14')](_0x1b9c('0x41'),_0x1bf19b[_0x1b9c('0x15')],_0x63cd6d);_0x260c0b(_0x33274d[_0x1b9c('0x14')](0x1f4,_0x1bf19b['message']));});});});};exports[_0x1b9c('0x42')]=function(_0x43fa74){var _0x3a1dcd=this;var _0x4c5872=_0x43fa74[_0x1b9c('0x1c')]['where']['voiceQueueIds'];var _0x6dbcb8=_0x43fa74[_0x1b9c('0x1c')][_0x1b9c('0xb')][_0x1b9c('0x43')];var _0x20fe44=_0x43fa74[_0x1b9c('0x1c')][_0x1b9c('0xb')][_0x1b9c('0x44')];return new Promise(function(_0x5669be,_0x4e8ea8){return db[_0x1b9c('0x7')]['findAll']({'where':{'voiceQueueId':{'$in':_0x4c5872},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x1b9c('0x23')][_0x1b9c('0x37')](_0x1b9c('0x45')+_0x6dbcb8+'\x20MINUTE'),'$gt':db['sequelize']['literal'](_0x1b9c('0x46'))}},'UserId':{'$in':_0x20fe44}},'include':[{'model':db['CmContact'],'as':'Contact'},{'model':db[_0x1b9c('0x29')],'as':_0x1b9c('0x2a'),'attributes':['id',_0x1b9c('0x2b'),_0x1b9c('0x47')]},{'model':db[_0x1b9c('0x48')],'as':_0x1b9c('0x49')}]})[_0x1b9c('0x18')](function(_0x335cc5){if(_0x335cc5[_0x1b9c('0x2c')]>0x0){return db[_0x1b9c('0x23')][_0x1b9c('0x24')](function(_0x7325b0){return db[_0x1b9c('0x7')][_0x1b9c('0x1e')]({'recallmeNotifiedDate':db[_0x1b9c('0x23')][_0x1b9c('0x37')](_0x1b9c('0x46'))},{'where':{'id':{'$in':_[_0x1b9c('0x10')](_0x335cc5,'id')}},'transaction':_0x7325b0})['then'](function(){_0x5669be(_0x335cc5);})[_0x1b9c('0x13')](function(_0x22d2a2){logger[_0x1b9c('0x14')](_0x1b9c('0x42'),_0x22d2a2[_0x1b9c('0x15')],_0x43fa74);_0x4e8ea8(_0x3a1dcd[_0x1b9c('0x14')](0x1f4,_0x22d2a2[_0x1b9c('0x15')]));});})[_0x1b9c('0x13')](function(_0x339993){logger[_0x1b9c('0x14')](_0x1b9c('0x42'),_0x339993[_0x1b9c('0x15')],_0x43fa74);_0x4e8ea8(_0x3a1dcd[_0x1b9c('0x14')](0x1f4,_0x339993[_0x1b9c('0x15')]));});}else{_0x5669be(_0x335cc5);}});});}; \ No newline at end of file +var _0xdca3=['\x20,\x201,\x20null','GetContactRecallMe','keys','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','List','CmHopperHandlePreviewRecallNotifications','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','options','where','attributes','limit','include','map','model','info','debug','stringify','catch','error','message','ShowCmHopper','then','CreateCmHopper','create','body','raw','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','transaction','order','LOCK','UPDATE','Contact','User','Agent','name','voicePause','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','sequelize','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','findAll','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x374ccf,_0xa945c4){var _0x443cde=function(_0x27ff10){while(--_0x27ff10){_0x374ccf['push'](_0x374ccf['shift']());}};_0x443cde(++_0xa945c4);}(_0xdca3,0x64));var _0x3dca=function(_0x134005,_0x6b531e){_0x134005=_0x134005-0x0;var _0x789512=_0xdca3[_0x134005];return _0x789512;};'use strict';var _=require(_0x3dca('0x0'));var util=require('util');var moment=require(_0x3dca('0x1'));var BPromise=require(_0x3dca('0x2'));var db=require(_0x3dca('0x3'))['db'];var logger=require(_0x3dca('0x4'))(_0x3dca('0x5'));exports[_0x3dca('0x6')]=function(_0x3af6cf){var _0x221ad8=this;return new Promise(function(_0x3887bd,_0x10c46f){return db[_0x3dca('0x7')]['findAll']({'raw':_0x3af6cf[_0x3dca('0x8')]?_0x3af6cf['options']['raw']===undefined?!![]:![]:!![],'where':_0x3af6cf[_0x3dca('0x8')]?_0x3af6cf['options'][_0x3dca('0x9')]||null:null,'attributes':_0x3af6cf[_0x3dca('0x8')]?_0x3af6cf[_0x3dca('0x8')][_0x3dca('0xa')]||null:null,'limit':_0x3af6cf['options']?_0x3af6cf[_0x3dca('0x8')][_0x3dca('0xb')]||null:null,'include':_0x3af6cf[_0x3dca('0x8')]?_0x3af6cf[_0x3dca('0x8')][_0x3dca('0xc')]?_[_0x3dca('0xd')](_0x3af6cf['options'][_0x3dca('0xc')],function(_0x5d7f81){return{'model':db[_0x5d7f81['model']],'as':_0x5d7f81['as'],'attributes':_0x5d7f81[_0x3dca('0xa')],'include':_0x5d7f81[_0x3dca('0xc')]?_[_0x3dca('0xd')](_0x5d7f81[_0x3dca('0xc')],function(_0x2a3754){return{'model':db[_0x2a3754[_0x3dca('0xe')]],'as':_0x2a3754['as'],'attributes':_0x2a3754[_0x3dca('0xa')],'include':_0x2a3754[_0x3dca('0xc')]?_[_0x3dca('0xd')](_0x2a3754[_0x3dca('0xc')],function(_0x3d1154){return{'model':db[_0x3d1154[_0x3dca('0xe')]],'as':_0x3d1154['as'],'attributes':_0x3d1154[_0x3dca('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d2439){logger[_0x3dca('0xf')](_0x3dca('0x6'),_0x3af6cf);logger[_0x3dca('0x10')](_0x3dca('0x6'),_0x3af6cf,JSON[_0x3dca('0x11')](_0x4d2439));_0x3887bd(_0x4d2439);})[_0x3dca('0x12')](function(_0x47b1e9){logger[_0x3dca('0x13')](_0x3dca('0x6'),_0x47b1e9[_0x3dca('0x14')],_0x3af6cf);_0x10c46f(_0x221ad8[_0x3dca('0x13')](0x1f4,_0x47b1e9['message']));});});};exports[_0x3dca('0x15')]=function(_0x18b9ab){var _0x111d38=this;return new Promise(function(_0x5f0520,_0x501201){return db[_0x3dca('0x7')]['find']({'raw':_0x18b9ab[_0x3dca('0x8')]?_0x18b9ab[_0x3dca('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x18b9ab[_0x3dca('0x8')]?_0x18b9ab['options'][_0x3dca('0x9')]||null:null,'attributes':_0x18b9ab[_0x3dca('0x8')]?_0x18b9ab[_0x3dca('0x8')][_0x3dca('0xa')]||null:null,'include':_0x18b9ab[_0x3dca('0x8')]?_0x18b9ab['options'][_0x3dca('0xc')]?_[_0x3dca('0xd')](_0x18b9ab[_0x3dca('0x8')]['include'],function(_0x3c3021){return{'model':db[_0x3c3021[_0x3dca('0xe')]],'as':_0x3c3021['as'],'attributes':_0x3c3021['attributes'],'include':_0x3c3021[_0x3dca('0xc')]?_[_0x3dca('0xd')](_0x3c3021[_0x3dca('0xc')],function(_0x2580f6){return{'model':db[_0x2580f6[_0x3dca('0xe')]],'as':_0x2580f6['as'],'attributes':_0x2580f6[_0x3dca('0xa')],'include':_0x2580f6[_0x3dca('0xc')]?_[_0x3dca('0xd')](_0x2580f6[_0x3dca('0xc')],function(_0x10d1e8){return{'model':db[_0x10d1e8[_0x3dca('0xe')]],'as':_0x10d1e8['as'],'attributes':_0x10d1e8[_0x3dca('0xa')]};}):[]};}):[]};}):[]:[]})[_0x3dca('0x16')](function(_0x12560e){logger[_0x3dca('0xf')](_0x3dca('0x15'),_0x18b9ab);logger[_0x3dca('0x10')](_0x3dca('0x15'),_0x18b9ab,JSON[_0x3dca('0x11')](_0x12560e));_0x5f0520(_0x12560e);})['catch'](function(_0x2cddce){logger[_0x3dca('0x13')](_0x3dca('0x15'),_0x2cddce[_0x3dca('0x14')],_0x18b9ab);_0x501201(_0x111d38[_0x3dca('0x13')](0x1f4,_0x2cddce[_0x3dca('0x14')]));});});};exports[_0x3dca('0x17')]=function(_0x5cb047){var _0x57bbea=this;return new Promise(function(_0x59b102,_0xd0a73f){return db['CmHopper'][_0x3dca('0x18')](_0x5cb047[_0x3dca('0x19')],{'raw':_0x5cb047[_0x3dca('0x8')]?_0x5cb047[_0x3dca('0x8')][_0x3dca('0x1a')]===undefined?!![]:![]:!![]})[_0x3dca('0x16')](function(_0x25f732){logger[_0x3dca('0xf')](_0x3dca('0x17'),_0x5cb047);logger[_0x3dca('0x10')](_0x3dca('0x17'),_0x5cb047,JSON['stringify'](_0x25f732));_0x59b102(_0x25f732);})[_0x3dca('0x12')](function(_0x26357c){logger[_0x3dca('0x13')](_0x3dca('0x17'),_0x26357c['message'],_0x5cb047);_0xd0a73f(_0x57bbea[_0x3dca('0x13')](0x1f4,_0x26357c['message']));});});};exports[_0x3dca('0x1b')]=function(_0x114f2d){var _0xe0a218=this;return new Promise(function(_0x2c8d8d,_0x2d0bc7){return db[_0x3dca('0x7')][_0x3dca('0x1c')](_0x114f2d['body'],{'raw':_0x114f2d[_0x3dca('0x8')]?_0x114f2d[_0x3dca('0x8')][_0x3dca('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x114f2d[_0x3dca('0x8')]?_0x114f2d[_0x3dca('0x8')][_0x3dca('0x9')]||null:null,'attributes':_0x114f2d['options']?_0x114f2d[_0x3dca('0x8')][_0x3dca('0xa')]||null:null,'limit':_0x114f2d[_0x3dca('0x8')]?_0x114f2d[_0x3dca('0x8')][_0x3dca('0xb')]||null:null})[_0x3dca('0x16')](function(_0x58e555){logger[_0x3dca('0xf')](_0x3dca('0x1b'),_0x114f2d);logger[_0x3dca('0xf')](_0x3dca('0x1d'),JSON[_0x3dca('0x11')](_0x114f2d[_0x3dca('0x8')][_0x3dca('0x9')]),_0x114f2d[_0x3dca('0x19')][_0x3dca('0x1e')]);logger[_0x3dca('0x10')](_0x3dca('0x1b'),_0x114f2d,JSON[_0x3dca('0x11')](_0x58e555));_0x2c8d8d(_0x58e555);})[_0x3dca('0x12')](function(_0xe8998e){logger[_0x3dca('0x13')](_0x3dca('0x1b'),_0xe8998e[_0x3dca('0x14')],_0x114f2d);_0x2d0bc7(_0xe0a218['error'](0x1f4,_0xe8998e[_0x3dca('0x14')]));});});};exports[_0x3dca('0x1f')]=function(_0x4bab8a){var _0x184588=this;return new Promise(function(_0x390dfc,_0x38abf8){return db[_0x3dca('0x7')][_0x3dca('0x20')]({'where':_0x4bab8a[_0x3dca('0x8')]?_0x4bab8a[_0x3dca('0x8')][_0x3dca('0x9')]||null:null})[_0x3dca('0x16')](function(_0x195cc3){logger['info'](_0x3dca('0x1f'),_0x4bab8a);logger[_0x3dca('0x10')](_0x3dca('0x1f'),_0x4bab8a,JSON[_0x3dca('0x11')](_0x195cc3));_0x390dfc(_0x195cc3);})[_0x3dca('0x12')](function(_0x57b2e7){logger[_0x3dca('0x13')]('DestroyCmHopper',_0x57b2e7['message'],_0x4bab8a);_0x38abf8(_0x184588['error'](0x1f4,_0x57b2e7['message']));});});};exports[_0x3dca('0x21')]=function(_0x743b14){var _0x26b363=this;return new Promise(function(_0x2147b8,_0x4dd206){return db[_0x3dca('0x22')][_0x3dca('0x23')]()[_0x3dca('0x16')](function(_0xbadc17){return db['sequelize'][_0x3dca('0x24')](function(_0x20b356){return db[_0x3dca('0x7')]['findAll']({'where':_0x743b14[_0x3dca('0x8')]?_0x743b14[_0x3dca('0x8')][_0x3dca('0x9')]||null:null,'attributes':_0x743b14[_0x3dca('0x8')]?_0x743b14[_0x3dca('0x8')][_0x3dca('0xa')]||null:null,'limit':_0x743b14[_0x3dca('0x8')]?_0x743b14['options']['limit']||null:null,'order':_0x743b14['options']?_0x743b14['options'][_0x3dca('0x25')]||null:null,'transaction':_0x20b356,'lock':_0x20b356[_0x3dca('0x26')][_0x3dca('0x27')],'include':[{'model':db[_0x3dca('0x22')],'as':_0x3dca('0x28'),'attributes':_['keys'](_0xbadc17)},{'model':db[_0x3dca('0x29')],'as':_0x3dca('0x2a'),'attributes':['id',_0x3dca('0x2b'),_0x3dca('0x2c')]}]})[_0x3dca('0x16')](function(_0x3fe52f){var _0x203afd=[];var _0x441579=[];for(var _0x35272c=0x0;_0x35272c<_0x3fe52f[_0x3dca('0x2d')];_0x35272c+=0x1){var _0x5779db=_0x3fe52f[_0x35272c][_0x3dca('0x2e')];if(_0x5779db===null){_0x203afd[_0x3dca('0x2f')](_0x3fe52f[_0x35272c][_0x3dca('0x1c')](_0x743b14[_0x3dca('0x19')],{'transaction':_0x20b356}));}else if(!_0x441579[_0x3dca('0x30')](_0x5779db)){_0x441579[_0x3dca('0x2f')](_0x5779db);_0x203afd[_0x3dca('0x2f')](_0x3fe52f[_0x35272c][_0x3dca('0x1c')](_0x743b14[_0x3dca('0x19')],{'transaction':_0x20b356}));}}return BPromise[_0x3dca('0x31')](_0x203afd);});})['then'](function(_0x1dae0c){logger[_0x3dca('0xf')](_0x3dca('0x21'),_0x743b14);if(_0x1dae0c[_0x3dca('0x2d')]>0x0){logger[_0x3dca('0xf')](_0x3dca('0x32'),_0x1dae0c[0x0]['dataValues']['id'],_0x1dae0c[0x0][_0x3dca('0x33')][_0x3dca('0x34')],_0x1dae0c[0x0]['dataValues'][_0x3dca('0x1e')]);}logger[_0x3dca('0x10')]('GetContactDialer',_0x743b14,JSON['stringify'](_0x1dae0c));_0x2147b8(_0x1dae0c);})['catch'](function(_0x14a355){logger[_0x3dca('0x13')](_0x3dca('0x21'),_0x14a355[_0x3dca('0x14')],_0x743b14);_0x4dd206(_0x26b363[_0x3dca('0x13')](0x1f4,_0x14a355[_0x3dca('0x14')]));});});});};exports[_0x3dca('0x35')]=function(_0x2330bf){var _0x567534=this;return new Promise(function(_0x266ef4,_0x321bef){return db[_0x3dca('0x36')][_0x3dca('0x24')](function(_0x246935){return db[_0x3dca('0x37')]['create'](_0x2330bf[_0x3dca('0x19')],{'raw':_0x2330bf[_0x3dca('0x8')]?_0x2330bf[_0x3dca('0x8')][_0x3dca('0x1a')]===undefined?!![]:![]:!![],'transaction':_0x246935})[_0x3dca('0x16')](function(){logger[_0x3dca('0xf')](_0x3dca('0x38'),JSON[_0x3dca('0x11')](_0x2330bf[_0x3dca('0x8')][_0x3dca('0x9')]),_0x2330bf[_0x3dca('0x8')][_0x3dca('0x9')][_0x3dca('0x1e')]);return db['CmHopper']['destroy']({'where':_0x2330bf['options']?_0x2330bf[_0x3dca('0x8')][_0x3dca('0x9')]||null:null,'transaction':_0x246935});});})[_0x3dca('0x16')](function(_0x40df15){logger[_0x3dca('0xf')](_0x3dca('0x35'),_0x2330bf);logger[_0x3dca('0x10')](_0x3dca('0x35'),_0x2330bf,JSON[_0x3dca('0x11')](_0x40df15));_0x266ef4(_0x40df15);})[_0x3dca('0x12')](function(_0x5ba3f8){logger[_0x3dca('0x13')](_0x3dca('0x35'),_0x5ba3f8[_0x3dca('0x14')],_0x2330bf);_0x321bef(_0x567534[_0x3dca('0x13')](0x1f4,_0x5ba3f8[_0x3dca('0x14')]));});});};exports[_0x3dca('0x39')]=function(_0x86b69e){var _0x45e010=this;return new Promise(function(_0x667031,_0xf14197){return db[_0x3dca('0x7')][_0x3dca('0x3a')]({'raw':_0x86b69e[_0x3dca('0x8')]?_0x86b69e[_0x3dca('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x86b69e[_0x3dca('0x8')]?_0x86b69e['options'][_0x3dca('0x9')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x3dca('0x36')]['fn']('IF',db['sequelize'][_0x3dca('0x3b')](_0x3dca('0x3c')+util[_0x3dca('0x3d')](_0x3dca('0x3e'),moment()['format'](_0x3dca('0x3f')))+_0x3dca('0x40')))),'contactsRescheduled']]})['then'](function(_0x543b09){logger[_0x3dca('0xf')](_0x3dca('0x39'),_0x86b69e);logger[_0x3dca('0x10')](_0x3dca('0x39'),_0x86b69e,JSON[_0x3dca('0x11')](_0x543b09));_0x667031(_0x543b09);})[_0x3dca('0x12')](function(_0x4b0747){logger[_0x3dca('0x13')](_0x3dca('0x39'),_0x4b0747['message'],_0x86b69e);_0xf14197(_0x45e010['error'](0x1f4,_0x4b0747[_0x3dca('0x14')]));});});};exports[_0x3dca('0x41')]=function(_0x719341){var _0x2bf178=this;return new Promise(function(_0x2a0730,_0x4571f7){return db[_0x3dca('0x22')][_0x3dca('0x23')]()[_0x3dca('0x16')](function(){return db[_0x3dca('0x36')][_0x3dca('0x24')](function(_0x2a5b45){return db[_0x3dca('0x7')][_0x3dca('0x3a')]({'where':_0x719341['options']?_0x719341[_0x3dca('0x8')][_0x3dca('0x9')]||null:null,'attributes':_0x719341[_0x3dca('0x8')]?_0x719341['options'][_0x3dca('0xa')]||null:null,'limit':0x1,'order':_0x719341['options']?_0x719341[_0x3dca('0x8')][_0x3dca('0x25')]||null:null,'group':db[_0x3dca('0x7')][_0x3dca('0x2e')],'transaction':_0x2a5b45,'lock':_0x2a5b45[_0x3dca('0x26')]['UPDATE'],'include':_0x719341[_0x3dca('0x8')]?_0x719341[_0x3dca('0x8')][_0x3dca('0xc')]?_[_0x3dca('0xd')](_0x719341[_0x3dca('0x8')]['include'],function(_0xbfc8f7){return{'model':db[_0xbfc8f7['model']],'as':_0xbfc8f7['as'],'attributes':_0xbfc8f7[_0x3dca('0xa')],'include':_0xbfc8f7[_0x3dca('0xc')]?_[_0x3dca('0xd')](_0xbfc8f7[_0x3dca('0xc')],function(_0x116c05){return{'model':db[_0x116c05[_0x3dca('0xe')]],'as':_0x116c05['as'],'attributes':_0x116c05[_0x3dca('0xa')],'include':_0x116c05['include']?_['map'](_0x116c05[_0x3dca('0xc')],function(_0x46904e){return{'model':db[_0x46904e[_0x3dca('0xe')]],'as':_0x46904e['as'],'attributes':_0x46904e[_0x3dca('0xa')]};}):[]};}):[]};}):[]:[]})[_0x3dca('0x16')](function(_0x2875a0){var _0x5b37d8=[];for(var _0x49ced4=0x0;_0x49ced4<_0x2875a0[_0x3dca('0x2d')];_0x49ced4+=0x1){_0x5b37d8[_0x3dca('0x2f')](_0x2875a0[_0x49ced4][_0x3dca('0x1c')](_0x719341[_0x3dca('0x19')],{'transaction':_0x2a5b45}));}return BPromise[_0x3dca('0x31')](_0x5b37d8);});})[_0x3dca('0x16')](function(_0x5a8dc1){logger[_0x3dca('0xf')]('GetContactRecallMe',_0x719341);logger['debug'](_0x3dca('0x41'),_0x719341,JSON[_0x3dca('0x11')](_0x5a8dc1));_0x2a0730(_0x5a8dc1);})[_0x3dca('0x12')](function(_0x264877){logger[_0x3dca('0x13')](_0x3dca('0x41'),_0x264877[_0x3dca('0x14')],_0x719341);_0x4571f7(_0x2bf178['error'](0x1f4,_0x264877['message']));});});});};exports['GetCmHopperPreview']=function(_0x3dfae0){var _0x3dbbab=this;return new Promise(function(_0x28ed00,_0x41aa75){db[_0x3dca('0x22')][_0x3dca('0x23')]()[_0x3dca('0x16')](function(_0x2965c9){return db[_0x3dca('0x7')][_0x3dca('0x3a')]({'raw':_0x3dfae0[_0x3dca('0x8')]?_0x3dfae0['options'][_0x3dca('0x1a')]===undefined?!![]:![]:!![],'where':_0x3dfae0[_0x3dca('0x8')]?_0x3dfae0[_0x3dca('0x8')][_0x3dca('0x9')]||null:null,'attributes':_0x3dfae0[_0x3dca('0x8')]?_0x3dfae0['options'][_0x3dca('0xa')]||null:null,'limit':_0x3dfae0[_0x3dca('0x8')]?_0x3dfae0[_0x3dca('0x8')][_0x3dca('0xb')]||null:null,'include':_0x3dfae0[_0x3dca('0x8')]?_0x3dfae0['options'][_0x3dca('0xc')]?_[_0x3dca('0xd')](_0x3dfae0[_0x3dca('0x8')][_0x3dca('0xc')],function(_0x4a35b2){return{'model':db[_0x4a35b2['model']],'as':_0x4a35b2['as'],'attributes':_0x4a35b2['as']==='Contact'?_[_0x3dca('0x42')](_0x2965c9):_0x4a35b2[_0x3dca('0xa')],'include':_0x4a35b2[_0x3dca('0xc')]?_['map'](_0x4a35b2[_0x3dca('0xc')],function(_0x19c4e7){return{'model':db[_0x19c4e7[_0x3dca('0xe')]],'as':_0x19c4e7['as'],'attributes':_0x19c4e7[_0x3dca('0xa')],'include':_0x19c4e7[_0x3dca('0xc')]?_[_0x3dca('0xd')](_0x19c4e7[_0x3dca('0xc')],function(_0x3b98bc){return{'model':db[_0x3b98bc[_0x3dca('0xe')]],'as':_0x3b98bc['as'],'attributes':_0x3b98bc[_0x3dca('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x181fc3){logger[_0x3dca('0xf')](_0x3dca('0x6'),_0x3dfae0);logger[_0x3dca('0x10')](_0x3dca('0x6'),_0x3dfae0,JSON['stringify'](_0x181fc3));_0x28ed00(_0x181fc3);})[_0x3dca('0x12')](function(_0x9fe40c){logger[_0x3dca('0x13')](_0x3dca('0x6'),_0x9fe40c['message'],_0x3dfae0);_0x41aa75(_0x3dbbab[_0x3dca('0x13')](0x1f4,_0x9fe40c[_0x3dca('0x14')]));});});});};exports[_0x3dca('0x43')]=function(_0x139d4d){var _0x5d38e4=this;return new Promise(function(_0x26e354,_0x142a3d){return db[_0x3dca('0x22')][_0x3dca('0x44')]({'raw':!![],'where':{'phone':_0x139d4d['options']['where'][_0x3dca('0x45')]},'attributes':['id',_0x3dca('0x46')],'order':[['id',_0x3dca('0x47')]]})[_0x3dca('0x16')](function(_0x5a3adf){logger[_0x3dca('0xf')](_0x3dca('0x48'),_0x139d4d);logger['debug'](_0x3dca('0x48'),_0x139d4d,JSON[_0x3dca('0x11')](_0x5a3adf));_0x26e354(_0x5a3adf);})[_0x3dca('0x12')](function(_0xea9282){logger[_0x3dca('0x13')](_0x3dca('0x48'),_0xea9282[_0x3dca('0x14')],_0x139d4d);_0x142a3d(_0x5d38e4[_0x3dca('0x13')](0x1f4,_0xea9282['message']));});});};exports[_0x3dca('0x49')]=function(_0x510b21){var _0x506530=this;return new Promise(function(_0xee4c3,_0x51935d){return db[_0x3dca('0x36')]['transaction'](function(_0x3db6d0){var _0x560817=_0x510b21[_0x3dca('0x8')]&&_0x510b21[_0x3dca('0x8')][_0x3dca('0x9')]?_0x510b21[_0x3dca('0x8')][_0x3dca('0x9')]:{};return db[_0x3dca('0x7')][_0x3dca('0x1c')](_0x510b21[_0x3dca('0x19')],{'where':_0x560817,'transaction':_0x3db6d0})[_0x3dca('0x16')](function(_0x659e94){logger['info']('ResetActiveCalls',_0x510b21);logger[_0x3dca('0x10')](_0x3dca('0x49'),_0x510b21,JSON['stringify'](_0x659e94));_0xee4c3(_0x659e94);})['catch'](function(_0x18d6c1){logger[_0x3dca('0x13')](_0x3dca('0x49'),_0x18d6c1[_0x3dca('0x14')],_0x510b21);_0x51935d(_0x506530[_0x3dca('0x13')](0x1f4,_0x18d6c1[_0x3dca('0x14')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x50981e){var _0x2c7279=this;var _0x116ca9=_0x50981e[_0x3dca('0x19')][_0x3dca('0x9')][_0x3dca('0x4a')];var _0x23aad7=_0x50981e['body'][_0x3dca('0x9')][_0x3dca('0x4b')];var _0x357ab9=_0x50981e[_0x3dca('0x19')][_0x3dca('0x9')][_0x3dca('0x4c')];return new Promise(function(_0x128122,_0x4aaa50){return db['CmHopper'][_0x3dca('0x3a')]({'where':{'voiceQueueId':{'$in':_0x116ca9},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x3dca('0x36')][_0x3dca('0x3b')](_0x3dca('0x4d')+_0x23aad7+_0x3dca('0x4e')),'$gt':db[_0x3dca('0x36')][_0x3dca('0x3b')](_0x3dca('0x4f'))}},'UserId':{'$in':_0x357ab9}},'include':[{'model':db[_0x3dca('0x22')],'as':_0x3dca('0x28')},{'model':db[_0x3dca('0x29')],'as':_0x3dca('0x2a'),'attributes':['id',_0x3dca('0x2b'),'voicePause']},{'model':db['CmList'],'as':_0x3dca('0x50')}]})[_0x3dca('0x16')](function(_0x1d108){if(_0x1d108[_0x3dca('0x2d')]>0x0){return db[_0x3dca('0x36')]['transaction'](function(_0x2eff41){return db[_0x3dca('0x7')][_0x3dca('0x1c')]({'recallmeNotifiedDate':db[_0x3dca('0x36')][_0x3dca('0x3b')](_0x3dca('0x4f'))},{'where':{'id':{'$in':_[_0x3dca('0xd')](_0x1d108,'id')}},'transaction':_0x2eff41})['then'](function(){_0x128122(_0x1d108);})['catch'](function(_0xe4bace){logger[_0x3dca('0x13')](_0x3dca('0x51'),_0xe4bace[_0x3dca('0x14')],_0x50981e);_0x4aaa50(_0x2c7279['error'](0x1f4,_0xe4bace[_0x3dca('0x14')]));});})['catch'](function(_0x5d1361){logger['error'](_0x3dca('0x51'),_0x5d1361[_0x3dca('0x14')],_0x50981e);_0x4aaa50(_0x2c7279['error'](0x1f4,_0x5d1361[_0x3dca('0x14')]));});}else{_0x128122(_0x1d108);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 040b412..8a3cb7c 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 _0x9ec2=['index','/describe','isAuthenticated','describe','/opencontacts','getOpenContacts','/timezones','/:id','/:id/previewrecall','getPreviewRecall','post','/preview','getPreview','getTimezone','put','update','destroy','exports','Router','../../components/auth/service','get'];(function(_0x173113,_0x316a7c){var _0x3bea89=function(_0xd33ac1){while(--_0xd33ac1){_0x173113['push'](_0x173113['shift']());}};_0x3bea89(++_0x316a7c);}(_0x9ec2,0x1e0));var _0x29ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ec2[_0x3dd15e];return _0x231fd0;};'use strict';var express=require('express');var router=express[_0x29ec('0x0')]();var auth=require(_0x29ec('0x1'));var controller=require('./cmHopper.controller');router[_0x29ec('0x2')]('/',auth['isAuthenticated'](),controller[_0x29ec('0x3')]);router[_0x29ec('0x2')](_0x29ec('0x4'),auth[_0x29ec('0x5')](),controller[_0x29ec('0x6')]);router[_0x29ec('0x2')](_0x29ec('0x7'),auth[_0x29ec('0x5')](),controller[_0x29ec('0x8')]);router[_0x29ec('0x2')](_0x29ec('0x9'),auth['isAuthenticated'](),controller['getTimezones']);router[_0x29ec('0x2')](_0x29ec('0xa'),auth[_0x29ec('0x5')](),controller['show']);router[_0x29ec('0x2')](_0x29ec('0xb'),auth[_0x29ec('0x5')](),controller[_0x29ec('0xc')]);router[_0x29ec('0xd')]('/',auth[_0x29ec('0x5')](),controller['create']);router[_0x29ec('0xd')](_0x29ec('0xe'),auth['isAuthenticated'](),controller[_0x29ec('0xf')]);router['post']('/timezone',auth[_0x29ec('0x5')](),controller[_0x29ec('0x10')]);router[_0x29ec('0x11')]('/:id',auth[_0x29ec('0x5')](),controller[_0x29ec('0x12')]);router['delete']('/:id',auth[_0x29ec('0x5')](),controller[_0x29ec('0x13')]);module[_0x29ec('0x14')]=router; \ No newline at end of file +var _0xc6bb=['/:id','show','/:id/previewrecall','getPreviewRecall','post','/preview','getPreview','getTimezone','put','update','delete','destroy','exports','express','Router','../../components/auth/service','get','isAuthenticated','index','/describe','/opencontacts','getOpenContacts','/timezones'];(function(_0x1443eb,_0x203408){var _0x2b8810=function(_0x48bc4e){while(--_0x48bc4e){_0x1443eb['push'](_0x1443eb['shift']());}};_0x2b8810(++_0x203408);}(_0xc6bb,0x194));var _0xbc6b=function(_0x3d990d,_0xd2d650){_0x3d990d=_0x3d990d-0x0;var _0x1d2857=_0xc6bb[_0x3d990d];return _0x1d2857;};'use strict';var express=require(_0xbc6b('0x0'));var router=express[_0xbc6b('0x1')]();var auth=require(_0xbc6b('0x2'));var controller=require('./cmHopper.controller');router[_0xbc6b('0x3')]('/',auth[_0xbc6b('0x4')](),controller[_0xbc6b('0x5')]);router[_0xbc6b('0x3')](_0xbc6b('0x6'),auth[_0xbc6b('0x4')](),controller['describe']);router[_0xbc6b('0x3')](_0xbc6b('0x7'),auth[_0xbc6b('0x4')](),controller[_0xbc6b('0x8')]);router['get'](_0xbc6b('0x9'),auth[_0xbc6b('0x4')](),controller['getTimezones']);router[_0xbc6b('0x3')](_0xbc6b('0xa'),auth[_0xbc6b('0x4')](),controller[_0xbc6b('0xb')]);router[_0xbc6b('0x3')](_0xbc6b('0xc'),auth[_0xbc6b('0x4')](),controller[_0xbc6b('0xd')]);router[_0xbc6b('0xe')]('/',auth[_0xbc6b('0x4')](),controller['create']);router['post'](_0xbc6b('0xf'),auth[_0xbc6b('0x4')](),controller[_0xbc6b('0x10')]);router['post']('/timezone',auth['isAuthenticated'](),controller[_0xbc6b('0x11')]);router[_0xbc6b('0x12')](_0xbc6b('0xa'),auth['isAuthenticated'](),controller[_0xbc6b('0x13')]);router[_0xbc6b('0x14')](_0xbc6b('0xa'),auth[_0xbc6b('0x4')](),controller[_0xbc6b('0x15')]);module[_0xbc6b('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 702c158..f456085 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 _0x454f=['DATE','format','moment','sequelize','INTEGER','STRING'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0x454f,0x8c));var _0xf454=function(_0x1ebc9c,_0xcb1e5a){_0x1ebc9c=_0x1ebc9c-0x0;var _0x400ad9=_0x454f[_0x1ebc9c];return _0x400ad9;};'use strict';var moment=require(_0xf454('0x0'));var Sequelize=require(_0xf454('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0xf454('0x2')]},'phone':{'type':Sequelize[_0xf454('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xf454('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xf454('0x4')],'defaultValue':moment()[_0xf454('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf454('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xf454('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf454('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf454('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf454('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x01f9=['YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','STRING','INTEGER','DATE','format'];(function(_0x177cfa,_0x463c2c){var _0x4ae48b=function(_0x438671){while(--_0x438671){_0x177cfa['push'](_0x177cfa['shift']());}};_0x4ae48b(++_0x463c2c);}(_0x01f9,0xa9));var _0x901f=function(_0x59328b,_0x3e1186){_0x59328b=_0x59328b-0x0;var _0x2593ea=_0x01f9[_0x59328b];return _0x2593ea;};'use strict';var moment=require(_0x901f('0x0'));var Sequelize=require(_0x901f('0x1'));module[_0x901f('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x901f('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x901f('0x4')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x901f('0x5')],'defaultValue':moment()[_0x901f('0x6')](_0x901f('0x7'))},'countbusyretry':{'type':Sequelize[_0x901f('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x901f('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x901f('0x4')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x901f('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x901f('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x901f('0x4')],'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 7519d38..dc814a0 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 _0x6895=['keys','intersection','fields','attributes','length','hasOwnProperty','sort','filters','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','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','params','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','sendStatus','error','stack','send','map','CmHopperAdditionalPhone','rawAttributes','fieldName','key','model','name','query'];(function(_0x52a903,_0x3bab0f){var _0x14a58e=function(_0x325805){while(--_0x325805){_0x52a903['push'](_0x52a903['shift']());}};_0x14a58e(++_0x3bab0f);}(_0x6895,0x119));var _0x5689=function(_0x3e7a26,_0x2206d2){_0x3e7a26=_0x3e7a26-0x0;var _0x377293=_0x6895[_0x3e7a26];return _0x377293;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5689('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5689('0x1'));var rp=require(_0x5689('0x2'));var moment=require(_0x5689('0x3'));var BPromise=require(_0x5689('0x4'));var Mustache=require('mustache');var util=require(_0x5689('0x5'));var path=require(_0x5689('0x6'));var sox=require(_0x5689('0x7'));var csv=require(_0x5689('0x8'));var ejs=require(_0x5689('0x9'));var fs=require('fs');var fs_extra=require(_0x5689('0xa'));var _=require(_0x5689('0xb'));var squel=require(_0x5689('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5689('0x8'));var querystring=require(_0x5689('0xd'));var Papa=require(_0x5689('0xe'));var Redis=require(_0x5689('0xf'));var authService=require(_0x5689('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5689('0x11'));var logger=require('../../config/logger')(_0x5689('0x12'));var utils=require(_0x5689('0x13'));var config=require(_0x5689('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x5689('0x15'))['db'];function respondWithStatusCode(_0x494b1e,_0x14c26c){_0x14c26c=_0x14c26c||0xcc;return function(_0x769acc){if(_0x769acc){return _0x494b1e['sendStatus'](_0x14c26c);}return _0x494b1e['status'](_0x14c26c)[_0x5689('0x16')]();};}function respondWithResult(_0x224175,_0x9118e5){_0x9118e5=_0x9118e5||0xc8;return function(_0x4744de){if(_0x4744de){return _0x224175[_0x5689('0x17')](_0x9118e5)['json'](_0x4744de);}};}function respondWithFilteredResult(_0x434a46,_0x259ef3){return function(_0x34780a){if(_0x34780a){var _0x11582c=typeof _0x259ef3[_0x5689('0x18')]==='undefined'&&typeof _0x259ef3[_0x5689('0x19')]===_0x5689('0x1a');var _0xf41b5b=_0x34780a['count'];var _0x43b9f2=_0x11582c?0x0:_0x259ef3[_0x5689('0x18')];var _0x3dce7b=_0x11582c?_0x34780a[_0x5689('0x1b')]:_0x259ef3[_0x5689('0x18')]+_0x259ef3['limit'];var _0x4f7eae;if(_0x3dce7b>=_0xf41b5b){_0x3dce7b=_0xf41b5b;_0x4f7eae=0xc8;}else{_0x4f7eae=0xce;}_0x434a46[_0x5689('0x17')](_0x4f7eae);return _0x434a46[_0x5689('0x1c')](_0x5689('0x1d'),_0x43b9f2+'-'+_0x3dce7b+'/'+_0xf41b5b)[_0x5689('0x1e')](_0x34780a);}return null;};}function patchUpdates(_0x255bad){return function(_0x2bcf1d){try{jsonpatch['apply'](_0x2bcf1d,_0x255bad,!![]);}catch(_0x9e6a44){return BPromise[_0x5689('0x1f')](_0x9e6a44);}return _0x2bcf1d[_0x5689('0x20')]();};}function saveUpdates(_0x10885b,_0x55e3a6){return function(_0x6606b5){if(_0x6606b5){return _0x6606b5[_0x5689('0x21')](_0x10885b)[_0x5689('0x22')](function(_0x17a22c){return _0x17a22c;});}return null;};}function removeEntity(_0x53213e,_0x47b2f3){return function(_0x28e8bd){if(_0x28e8bd){return _0x28e8bd[_0x5689('0x23')]()[_0x5689('0x22')](function(){var _0x36f1c6=_0x28e8bd[_0x5689('0x24')]({'plain':!![]});var _0x2f84f8=_0x5689('0x25');return db[_0x5689('0x26')]['destroy']({'where':{'type':_0x2f84f8,'resourceId':_0x36f1c6['id']}})['then'](function(){return _0x28e8bd;});})[_0x5689('0x22')](function(){_0x53213e[_0x5689('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38d865,_0x535560){return function(_0x47a977){if(!_0x47a977){_0x38d865[_0x5689('0x27')](0x194);}return _0x47a977;};}function handleError(_0x457fdc,_0x3ce49f){_0x3ce49f=_0x3ce49f||0x1f4;return function(_0x2e3667){logger[_0x5689('0x28')](_0x2e3667[_0x5689('0x29')]);if(_0x2e3667['name']){delete _0x2e3667['name'];}_0x457fdc[_0x5689('0x17')](_0x3ce49f)[_0x5689('0x2a')](_0x2e3667);};}exports['index']=function(_0x46cdfb,_0x3e501e){var _0x2462ac={},_0x1ce40e={},_0x37c3d8={'count':0x0,'rows':[]};var _0x2c9790=_[_0x5689('0x2b')](db[_0x5689('0x2c')][_0x5689('0x2d')],function(_0x21d9a7){return{'name':_0x21d9a7[_0x5689('0x2e')],'type':_0x21d9a7['type'][_0x5689('0x2f')]};});_0x1ce40e[_0x5689('0x30')]=_[_0x5689('0x2b')](_0x2c9790,_0x5689('0x31'));_0x1ce40e[_0x5689('0x32')]=_[_0x5689('0x33')](_0x46cdfb[_0x5689('0x32')]);_0x1ce40e['filters']=_[_0x5689('0x34')](_0x1ce40e['model'],_0x1ce40e[_0x5689('0x32')]);_0x2462ac['attributes']=_[_0x5689('0x34')](_0x1ce40e[_0x5689('0x30')],qs[_0x5689('0x35')](_0x46cdfb[_0x5689('0x32')][_0x5689('0x35')]));_0x2462ac['attributes']=_0x2462ac[_0x5689('0x36')][_0x5689('0x37')]?_0x2462ac['attributes']:_0x1ce40e['model'];if(!_0x46cdfb[_0x5689('0x32')][_0x5689('0x38')]('nolimit')){_0x2462ac[_0x5689('0x19')]=qs[_0x5689('0x19')](_0x46cdfb[_0x5689('0x32')][_0x5689('0x19')]);_0x2462ac[_0x5689('0x18')]=qs['offset'](_0x46cdfb['query'][_0x5689('0x18')]);}_0x2462ac['order']=qs[_0x5689('0x39')](_0x46cdfb[_0x5689('0x32')][_0x5689('0x39')]);_0x2462ac['where']=qs[_0x5689('0x3a')](_[_0x5689('0x3b')](_0x46cdfb[_0x5689('0x32')],_0x1ce40e['filters']),_0x2c9790);if(_0x46cdfb[_0x5689('0x32')][_0x5689('0x3c')]){_0x2462ac[_0x5689('0x3d')]=_['merge'](_0x2462ac[_0x5689('0x3d')],{'$or':_[_0x5689('0x2b')](_0x2c9790,function(_0x338f66){if(_0x338f66[_0x5689('0x3e')]!==_0x5689('0x3f')){var _0x55ddb6={};_0x55ddb6[_0x338f66[_0x5689('0x31')]]={'$like':'%'+_0x46cdfb['query']['filter']+'%'};return _0x55ddb6;}})});}_0x2462ac=_[_0x5689('0x40')]({},_0x2462ac,_0x46cdfb[_0x5689('0x41')]);var _0x2417d5={'where':_0x2462ac[_0x5689('0x3d')]};return db[_0x5689('0x2c')][_0x5689('0x1b')](_0x2417d5)[_0x5689('0x22')](function(_0x32e933){_0x37c3d8[_0x5689('0x1b')]=_0x32e933;if(_0x46cdfb[_0x5689('0x32')][_0x5689('0x42')]){_0x2462ac[_0x5689('0x43')]=[{'all':!![]}];}return db[_0x5689('0x2c')][_0x5689('0x44')](_0x2462ac);})[_0x5689('0x22')](function(_0x15adf2){_0x37c3d8[_0x5689('0x45')]=_0x15adf2;return _0x37c3d8;})[_0x5689('0x22')](respondWithFilteredResult(_0x3e501e,_0x2462ac))[_0x5689('0x46')](handleError(_0x3e501e,null));};exports[_0x5689('0x47')]=function(_0x218e48,_0x588f5b){var _0x49a3d6={'raw':!![],'where':{'id':_0x218e48['params']['id']}},_0x1766dc={};_0x1766dc['model']=_[_0x5689('0x33')](db[_0x5689('0x2c')][_0x5689('0x2d')]);_0x1766dc['query']=_[_0x5689('0x33')](_0x218e48[_0x5689('0x32')]);_0x1766dc[_0x5689('0x3a')]=_[_0x5689('0x34')](_0x1766dc[_0x5689('0x30')],_0x1766dc[_0x5689('0x32')]);_0x49a3d6[_0x5689('0x36')]=_[_0x5689('0x34')](_0x1766dc[_0x5689('0x30')],qs[_0x5689('0x35')](_0x218e48[_0x5689('0x32')][_0x5689('0x35')]));_0x49a3d6[_0x5689('0x36')]=_0x49a3d6[_0x5689('0x36')]['length']?_0x49a3d6['attributes']:_0x1766dc[_0x5689('0x30')];if(_0x218e48['query'][_0x5689('0x42')]){_0x49a3d6[_0x5689('0x43')]=[{'all':!![]}];}_0x49a3d6=_[_0x5689('0x40')]({},_0x49a3d6,_0x218e48[_0x5689('0x41')]);return db[_0x5689('0x2c')][_0x5689('0x48')](_0x49a3d6)[_0x5689('0x22')](handleEntityNotFound(_0x588f5b,null))[_0x5689('0x22')](respondWithResult(_0x588f5b,null))[_0x5689('0x46')](handleError(_0x588f5b,null));};exports[_0x5689('0x49')]=function(_0x3e2253,_0x3b7fca){return db[_0x5689('0x2c')][_0x5689('0x49')](_0x3e2253[_0x5689('0x4a')],{})[_0x5689('0x22')](function(_0x24d46b){var _0x17dcbc=_0x3e2253[_0x5689('0x4b')]['get']({'plain':!![]});if(!_0x17dcbc)throw new Error(_0x5689('0x4c'));if(_0x17dcbc[_0x5689('0x4d')]==='user'){var _0x1e9e8b=_0x24d46b[_0x5689('0x24')]({'plain':!![]});var _0x3d50d5=_0x5689('0x25');return db[_0x5689('0x4e')][_0x5689('0x48')]({'where':{'name':_0x3d50d5,'userProfileId':_0x17dcbc[_0x5689('0x4f')]},'raw':!![]})[_0x5689('0x22')](function(_0x4cdc68){if(_0x4cdc68&&_0x4cdc68[_0x5689('0x50')]===0x0){return db[_0x5689('0x26')][_0x5689('0x49')]({'name':_0x1e9e8b[_0x5689('0x31')],'resourceId':_0x1e9e8b['id'],'type':_0x4cdc68[_0x5689('0x31')],'sectionId':_0x4cdc68['id']},{})[_0x5689('0x22')](function(){return _0x24d46b;});}else{return _0x24d46b;}})[_0x5689('0x46')](function(_0x22f258){logger[_0x5689('0x28')](_0x5689('0x51'),_0x22f258);throw _0x22f258;});}return _0x24d46b;})[_0x5689('0x22')](respondWithResult(_0x3b7fca,0xc9))['catch'](handleError(_0x3b7fca,null));};exports['update']=function(_0x35bc8d,_0x3f5e13){if(_0x35bc8d[_0x5689('0x4a')]['id']){delete _0x35bc8d[_0x5689('0x4a')]['id'];}return db[_0x5689('0x2c')]['find']({'where':{'id':_0x35bc8d[_0x5689('0x52')]['id']}})[_0x5689('0x22')](handleEntityNotFound(_0x3f5e13,null))['then'](saveUpdates(_0x35bc8d[_0x5689('0x4a')],null))[_0x5689('0x22')](respondWithResult(_0x3f5e13,null))[_0x5689('0x46')](handleError(_0x3f5e13,null));};exports[_0x5689('0x23')]=function(_0x4e60b6,_0x2bae46){return db[_0x5689('0x2c')][_0x5689('0x48')]({'where':{'id':_0x4e60b6[_0x5689('0x52')]['id']}})[_0x5689('0x22')](handleEntityNotFound(_0x2bae46,null))[_0x5689('0x22')](removeEntity(_0x2bae46,null))[_0x5689('0x46')](handleError(_0x2bae46,null));}; \ No newline at end of file +var _0x4d0c=['../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','order','sort','filters','pick','filter','merge','where','includeAll','include','rows','catch','show','params','keys','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','CmHopperAdditionalPhones','UserProfileSection','autoAssociation','UserProfileResource','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','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x2ca9d4,_0x51d5c6){var _0x258956=function(_0x47a0e5){while(--_0x47a0e5){_0x2ca9d4['push'](_0x2ca9d4['shift']());}};_0x258956(++_0x51d5c6);}(_0x4d0c,0x186));var _0xc4d0=function(_0x1ecd59,_0x5efc3e){_0x1ecd59=_0x1ecd59-0x0;var _0x53aedb=_0x4d0c[_0x1ecd59];return _0x53aedb;};'use strict';var emlformat=require(_0xc4d0('0x0'));var rimraf=require(_0xc4d0('0x1'));var zipdir=require(_0xc4d0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc4d0('0x3'));var moment=require(_0xc4d0('0x4'));var BPromise=require(_0xc4d0('0x5'));var Mustache=require(_0xc4d0('0x6'));var util=require(_0xc4d0('0x7'));var path=require(_0xc4d0('0x8'));var sox=require(_0xc4d0('0x9'));var csv=require(_0xc4d0('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc4d0('0xb'));var _=require(_0xc4d0('0xc'));var squel=require(_0xc4d0('0xd'));var crypto=require(_0xc4d0('0xe'));var jsforce=require(_0xc4d0('0xf'));var deskjs=require(_0xc4d0('0x10'));var toCsv=require(_0xc4d0('0xa'));var querystring=require(_0xc4d0('0x11'));var Papa=require(_0xc4d0('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc4d0('0x13'));var as=require(_0xc4d0('0x14'));var hardwareService=require(_0xc4d0('0x15'));var logger=require(_0xc4d0('0x16'))(_0xc4d0('0x17'));var utils=require(_0xc4d0('0x18'));var config=require(_0xc4d0('0x19'));var licenseUtil=require(_0xc4d0('0x1a'));var db=require(_0xc4d0('0x1b'))['db'];function respondWithStatusCode(_0x1b4504,_0x21aea7){_0x21aea7=_0x21aea7||0xcc;return function(_0x5487d6){if(_0x5487d6){return _0x1b4504['sendStatus'](_0x21aea7);}return _0x1b4504[_0xc4d0('0x1c')](_0x21aea7)[_0xc4d0('0x1d')]();};}function respondWithResult(_0xf827b9,_0x1ad024){_0x1ad024=_0x1ad024||0xc8;return function(_0x5e8c84){if(_0x5e8c84){return _0xf827b9[_0xc4d0('0x1c')](_0x1ad024)[_0xc4d0('0x1e')](_0x5e8c84);}};}function respondWithFilteredResult(_0x5e4851,_0x145f94){return function(_0x44bde8){if(_0x44bde8){var _0x196c67=typeof _0x145f94[_0xc4d0('0x1f')]==='undefined'&&typeof _0x145f94[_0xc4d0('0x20')]===_0xc4d0('0x21');var _0x3a4074=_0x44bde8[_0xc4d0('0x22')];var _0x2b03d0=_0x196c67?0x0:_0x145f94[_0xc4d0('0x1f')];var _0x1577b8=_0x196c67?_0x44bde8[_0xc4d0('0x22')]:_0x145f94[_0xc4d0('0x1f')]+_0x145f94['limit'];var _0x160c97;if(_0x1577b8>=_0x3a4074){_0x1577b8=_0x3a4074;_0x160c97=0xc8;}else{_0x160c97=0xce;}_0x5e4851[_0xc4d0('0x1c')](_0x160c97);return _0x5e4851[_0xc4d0('0x23')]('Content-Range',_0x2b03d0+'-'+_0x1577b8+'/'+_0x3a4074)['json'](_0x44bde8);}return null;};}function patchUpdates(_0x20e088){return function(_0x38e3f3){try{jsonpatch[_0xc4d0('0x24')](_0x38e3f3,_0x20e088,!![]);}catch(_0xb9da16){return BPromise[_0xc4d0('0x25')](_0xb9da16);}return _0x38e3f3[_0xc4d0('0x26')]();};}function saveUpdates(_0x3e59ca,_0x33222e){return function(_0x489178){if(_0x489178){return _0x489178[_0xc4d0('0x27')](_0x3e59ca)[_0xc4d0('0x28')](function(_0x370bd7){return _0x370bd7;});}return null;};}function removeEntity(_0x5cbef9,_0x32161a){return function(_0x31bc6a){if(_0x31bc6a){return _0x31bc6a[_0xc4d0('0x29')]()[_0xc4d0('0x28')](function(){var _0x3ebcd4=_0x31bc6a['get']({'plain':!![]});var _0x5ae7aa='CmHopperAdditionalPhones';return db['UserProfileResource']['destroy']({'where':{'type':_0x5ae7aa,'resourceId':_0x3ebcd4['id']}})[_0xc4d0('0x28')](function(){return _0x31bc6a;});})[_0xc4d0('0x28')](function(){_0x5cbef9['status'](0xcc)[_0xc4d0('0x1d')]();});}};}function handleEntityNotFound(_0xcaee6b,_0x4dcc7a){return function(_0x2d0296){if(!_0x2d0296){_0xcaee6b['sendStatus'](0x194);}return _0x2d0296;};}function handleError(_0x147db6,_0x44ef6e){_0x44ef6e=_0x44ef6e||0x1f4;return function(_0xde1ee1){logger[_0xc4d0('0x2a')](_0xde1ee1[_0xc4d0('0x2b')]);if(_0xde1ee1[_0xc4d0('0x2c')]){delete _0xde1ee1[_0xc4d0('0x2c')];}_0x147db6['status'](_0x44ef6e)['send'](_0xde1ee1);};}exports[_0xc4d0('0x2d')]=function(_0x19617e,_0x392360){var _0x3c679e={},_0xb68b05={},_0x2881f2={'count':0x0,'rows':[]};var _0x1d4183=_[_0xc4d0('0x2e')](db[_0xc4d0('0x2f')][_0xc4d0('0x30')],function(_0x90bdde){return{'name':_0x90bdde[_0xc4d0('0x31')],'type':_0x90bdde[_0xc4d0('0x32')]['key']};});_0xb68b05[_0xc4d0('0x33')]=_[_0xc4d0('0x2e')](_0x1d4183,'name');_0xb68b05[_0xc4d0('0x34')]=_['keys'](_0x19617e['query']);_0xb68b05['filters']=_[_0xc4d0('0x35')](_0xb68b05[_0xc4d0('0x33')],_0xb68b05[_0xc4d0('0x34')]);_0x3c679e['attributes']=_[_0xc4d0('0x35')](_0xb68b05['model'],qs[_0xc4d0('0x36')](_0x19617e[_0xc4d0('0x34')][_0xc4d0('0x36')]));_0x3c679e[_0xc4d0('0x37')]=_0x3c679e['attributes'][_0xc4d0('0x38')]?_0x3c679e['attributes']:_0xb68b05['model'];if(!_0x19617e[_0xc4d0('0x34')]['hasOwnProperty']('nolimit')){_0x3c679e['limit']=qs[_0xc4d0('0x20')](_0x19617e['query'][_0xc4d0('0x20')]);_0x3c679e['offset']=qs[_0xc4d0('0x1f')](_0x19617e['query'][_0xc4d0('0x1f')]);}_0x3c679e[_0xc4d0('0x39')]=qs['sort'](_0x19617e[_0xc4d0('0x34')][_0xc4d0('0x3a')]);_0x3c679e['where']=qs[_0xc4d0('0x3b')](_[_0xc4d0('0x3c')](_0x19617e['query'],_0xb68b05[_0xc4d0('0x3b')]),_0x1d4183);if(_0x19617e[_0xc4d0('0x34')][_0xc4d0('0x3d')]){_0x3c679e['where']=_[_0xc4d0('0x3e')](_0x3c679e[_0xc4d0('0x3f')],{'$or':_[_0xc4d0('0x2e')](_0x1d4183,function(_0x2e77c5){if(_0x2e77c5[_0xc4d0('0x32')]!=='VIRTUAL'){var _0x577183={};_0x577183[_0x2e77c5['name']]={'$like':'%'+_0x19617e['query']['filter']+'%'};return _0x577183;}})});}_0x3c679e=_[_0xc4d0('0x3e')]({},_0x3c679e,_0x19617e['options']);var _0x2dc6e9={'where':_0x3c679e[_0xc4d0('0x3f')]};return db['CmHopperAdditionalPhone']['count'](_0x2dc6e9)[_0xc4d0('0x28')](function(_0x370af9){_0x2881f2[_0xc4d0('0x22')]=_0x370af9;if(_0x19617e[_0xc4d0('0x34')][_0xc4d0('0x40')]){_0x3c679e[_0xc4d0('0x41')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone']['findAll'](_0x3c679e);})['then'](function(_0x4d75ea){_0x2881f2[_0xc4d0('0x42')]=_0x4d75ea;return _0x2881f2;})[_0xc4d0('0x28')](respondWithFilteredResult(_0x392360,_0x3c679e))[_0xc4d0('0x43')](handleError(_0x392360,null));};exports[_0xc4d0('0x44')]=function(_0x5a4bd5,_0x32fc42){var _0x149441={'raw':!![],'where':{'id':_0x5a4bd5[_0xc4d0('0x45')]['id']}},_0x978b64={};_0x978b64[_0xc4d0('0x33')]=_[_0xc4d0('0x46')](db[_0xc4d0('0x2f')][_0xc4d0('0x30')]);_0x978b64[_0xc4d0('0x34')]=_['keys'](_0x5a4bd5[_0xc4d0('0x34')]);_0x978b64[_0xc4d0('0x3b')]=_[_0xc4d0('0x35')](_0x978b64[_0xc4d0('0x33')],_0x978b64[_0xc4d0('0x34')]);_0x149441[_0xc4d0('0x37')]=_[_0xc4d0('0x35')](_0x978b64[_0xc4d0('0x33')],qs[_0xc4d0('0x36')](_0x5a4bd5[_0xc4d0('0x34')][_0xc4d0('0x36')]));_0x149441['attributes']=_0x149441[_0xc4d0('0x37')][_0xc4d0('0x38')]?_0x149441[_0xc4d0('0x37')]:_0x978b64[_0xc4d0('0x33')];if(_0x5a4bd5[_0xc4d0('0x34')][_0xc4d0('0x40')]){_0x149441['include']=[{'all':!![]}];}_0x149441=_[_0xc4d0('0x3e')]({},_0x149441,_0x5a4bd5[_0xc4d0('0x47')]);return db[_0xc4d0('0x2f')][_0xc4d0('0x48')](_0x149441)[_0xc4d0('0x28')](handleEntityNotFound(_0x32fc42,null))[_0xc4d0('0x28')](respondWithResult(_0x32fc42,null))[_0xc4d0('0x43')](handleError(_0x32fc42,null));};exports['create']=function(_0x1ec795,_0x5e4cd4){return db[_0xc4d0('0x2f')][_0xc4d0('0x49')](_0x1ec795[_0xc4d0('0x4a')],{})[_0xc4d0('0x28')](function(_0x3cb692){var _0x21c68b=_0x1ec795[_0xc4d0('0x4b')][_0xc4d0('0x4c')]({'plain':!![]});if(!_0x21c68b)throw new Error(_0xc4d0('0x4d'));if(_0x21c68b['role']==='user'){var _0x4a05d6=_0x3cb692[_0xc4d0('0x4c')]({'plain':!![]});var _0x261b9d=_0xc4d0('0x4e');return db[_0xc4d0('0x4f')]['find']({'where':{'name':_0x261b9d,'userProfileId':_0x21c68b['userProfileId']},'raw':!![]})[_0xc4d0('0x28')](function(_0x551720){if(_0x551720&&_0x551720[_0xc4d0('0x50')]===0x0){return db[_0xc4d0('0x51')]['create']({'name':_0x4a05d6[_0xc4d0('0x2c')],'resourceId':_0x4a05d6['id'],'type':_0x551720[_0xc4d0('0x2c')],'sectionId':_0x551720['id']},{})[_0xc4d0('0x28')](function(){return _0x3cb692;});}else{return _0x3cb692;}})[_0xc4d0('0x43')](function(_0x3bdf3e){logger[_0xc4d0('0x2a')](_0xc4d0('0x52'),_0x3bdf3e);throw _0x3bdf3e;});}return _0x3cb692;})[_0xc4d0('0x28')](respondWithResult(_0x5e4cd4,0xc9))[_0xc4d0('0x43')](handleError(_0x5e4cd4,null));};exports['update']=function(_0x2cb239,_0x2dde7f){if(_0x2cb239[_0xc4d0('0x4a')]['id']){delete _0x2cb239[_0xc4d0('0x4a')]['id'];}return db[_0xc4d0('0x2f')][_0xc4d0('0x48')]({'where':{'id':_0x2cb239['params']['id']}})[_0xc4d0('0x28')](handleEntityNotFound(_0x2dde7f,null))[_0xc4d0('0x28')](saveUpdates(_0x2cb239['body'],null))['then'](respondWithResult(_0x2dde7f,null))[_0xc4d0('0x43')](handleError(_0x2dde7f,null));};exports[_0xc4d0('0x29')]=function(_0x3eb1b5,_0x9391aa){return db[_0xc4d0('0x2f')][_0xc4d0('0x48')]({'where':{'id':_0x3eb1b5[_0xc4d0('0x45')]['id']}})['then'](handleEntityNotFound(_0x9391aa,null))[_0xc4d0('0x28')](removeEntity(_0x9391aa,null))[_0xc4d0('0x43')](handleError(_0x9391aa,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index e0c4899..ff7c6c9 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 _0xec86=['bluebird','request-promise','path','rimraf','./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','api'];(function(_0x1710e0,_0x4c7f7d){var _0x1a3805=function(_0x2e3b8f){while(--_0x2e3b8f){_0x1710e0['push'](_0x1710e0['shift']());}};_0x1a3805(++_0x4c7f7d);}(_0xec86,0x1d4));var _0x6ec8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xec86[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6ec8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6ec8('0x1'));var moment=require('moment');var BPromise=require(_0x6ec8('0x2'));var rp=require(_0x6ec8('0x3'));var fs=require('fs');var path=require(_0x6ec8('0x4'));var rimraf=require(_0x6ec8('0x5'));var config=require('../../config/environment');var attributes=require(_0x6ec8('0x6'));module[_0x6ec8('0x7')]=function(_0x5d516b,_0x25de2b){return _0x5d516b['define'](_0x6ec8('0x8'),attributes,{'tableName':_0x6ec8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed87=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed87,0xfa));var _0x7ed8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xed87[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7ed8('0x0'));var util=require(_0x7ed8('0x1'));var logger=require(_0x7ed8('0x2'))(_0x7ed8('0x3'));var moment=require(_0x7ed8('0x4'));var BPromise=require(_0x7ed8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7ed8('0x6'));var rimraf=require(_0x7ed8('0x7'));var config=require(_0x7ed8('0x8'));var attributes=require(_0x7ed8('0x9'));module[_0x7ed8('0xa')]=function(_0x5e5651,_0x48e9d0){return _0x5e5651[_0x7ed8('0xb')]('CmHopperAdditionalPhone',attributes,{'tableName':'cm_hopper_additional_phones','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 6af2b4a..b3e1066 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 _0x4cb1=['countcongestionretry','countagentrejectretry','entity','SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','isNil','phone','createdAt','updatedAt','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','catch','VerifyAdditionalPhones','CmHopper','body','ContactId','ListId','VoiceQueueId','CampaignId','findOne','OrderBy','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','dialGlobalMaxRetry','CmHopperAdditionalPhone','ASC','countbusyretry'];(function(_0x2646db,_0xb55473){var _0x3336f9=function(_0x372784){while(--_0x372784){_0x2646db['push'](_0x2646db['shift']());}};_0x3336f9(++_0xb55473);}(_0x4cb1,0x167));var _0x14cb=function(_0x235164,_0x45322a){_0x235164=_0x235164-0x0;var _0x35639a=_0x4cb1[_0x235164];return _0x35639a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x14cb('0x0'));var BPromise=require(_0x14cb('0x1'));var rs=require(_0x14cb('0x2'));var fs=require('fs');var Redis=require(_0x14cb('0x3'));var db=require(_0x14cb('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x14cb('0x5'));var jayson=require(_0x14cb('0x6'));var client=jayson[_0x14cb('0x7')][_0x14cb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23aa5f,_0x2b7caf,_0x9ed853){return new BPromise(function(_0x1fd724,_0x3b1d4d){return client[_0x14cb('0x9')](_0x23aa5f,_0x9ed853)[_0x14cb('0xa')](function(_0x4b849a){logger[_0x14cb('0xb')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2b7caf,'request\x20sent');logger[_0x14cb('0xc')](_0x14cb('0xd'),_0x2b7caf,_0x14cb('0xe'),JSON[_0x14cb('0xf')](_0x4b849a));if(_0x4b849a[_0x14cb('0x10')]){if(_0x4b849a[_0x14cb('0x10')][_0x14cb('0x11')]===0x1f4){logger['error'](_0x14cb('0x12'),_0x2b7caf,_0x4b849a[_0x14cb('0x10')][_0x14cb('0x13')]);return _0x3b1d4d(_0x4b849a[_0x14cb('0x10')][_0x14cb('0x13')]);}logger[_0x14cb('0x10')](_0x14cb('0x12'),_0x2b7caf,_0x4b849a[_0x14cb('0x10')]['message']);return _0x1fd724(_0x4b849a[_0x14cb('0x10')][_0x14cb('0x13')]);}else{logger[_0x14cb('0xb')](_0x14cb('0x12'),_0x2b7caf,_0x14cb('0xe'));_0x1fd724(_0x4b849a[_0x14cb('0x14')][_0x14cb('0x13')]);}})[_0x14cb('0x15')](function(_0x332a10){logger['error'](_0x14cb('0x12'),_0x2b7caf,_0x332a10);_0x3b1d4d(_0x332a10);});});}exports[_0x14cb('0x16')]=function(_0x36e6a0){var _0x4a40b4=this;return new Promise(function(_0xe24aab,_0x2d4ac9){return db[_0x14cb('0x17')]['findOne']({'raw':!![],'where':{'ContactId':_0x36e6a0[_0x14cb('0x18')][_0x14cb('0x19')],'ListId':_0x36e6a0['body'][_0x14cb('0x1a')],'VoiceQueueId':_0x36e6a0[_0x14cb('0x18')]['VoiceQueueId']===undefined?null:_0x36e6a0[_0x14cb('0x18')][_0x14cb('0x1b')],'CampaignId':_0x36e6a0['body'][_0x14cb('0x1c')]===undefined?null:_0x36e6a0['body']['CampaignId']}})['then'](function(_0x4dd5a4){if(_0x4dd5a4!=null){return db['CmHopperAdditionalPhone'][_0x14cb('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x4dd5a4['id'],'OrderBy':{'$gt':_0x4dd5a4[_0x14cb('0x1e')]}},'order':[[_0x14cb('0x1e'),'ASC']]})[_0x14cb('0xa')](function(_0xce9f6b){var _0x495192=0x0;if(_0xce9f6b){if(_0xce9f6b['countbusyretry']+_0xce9f6b['countcongestionretry']+_0xce9f6b[_0x14cb('0x1f')]+_0xce9f6b[_0x14cb('0x20')]+_0xce9f6b[_0x14cb('0x21')]+_0xce9f6b[_0x14cb('0x22')]+_0xce9f6b[_0x14cb('0x23')]+_0xce9f6b['countagentrejectretry']<_0x36e6a0['entity'][_0x14cb('0x24')])_0x495192=0x1;_0xe24aab({'additional':_0x495192});}else{return db[_0x14cb('0x25')][_0x14cb('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x4dd5a4['id']},'order':[['OrderBy',_0x14cb('0x26')]]})[_0x14cb('0xa')](function(_0x49412a){var _0xfd3b4=0x0;if(_0x49412a){if(_0x49412a[_0x14cb('0x27')]+_0x49412a[_0x14cb('0x28')]+_0x49412a['countnoanswerretry']+_0x49412a['countnosuchnumberretry']+_0x49412a[_0x14cb('0x21')]+_0x49412a[_0x14cb('0x22')]+_0x49412a[_0x14cb('0x23')]+_0x49412a[_0x14cb('0x29')]<_0x36e6a0[_0x14cb('0x2a')]['dialGlobalMaxRetry'])_0xfd3b4=0x1;_0xe24aab({'additional':_0xfd3b4});}else{_0xe24aab({'additional':0x0});}})[_0x14cb('0x15')](function(_0x5c8cb8){logger['error'](_0x14cb('0x16'),_0x5c8cb8['message']);_0x2d4ac9(_0x4a40b4[_0x14cb('0x10')](0x1f4,_0x5c8cb8['message']));});}})[_0x14cb('0x15')](function(_0x3571f7){logger[_0x14cb('0x10')](_0x14cb('0x16'),_0x3571f7[_0x14cb('0x13')]);_0x2d4ac9(_0x4a40b4[_0x14cb('0x10')](0x1f4,_0x3571f7['message']));});}else _0xe24aab({'additional':0x0});});});};exports[_0x14cb('0x2b')]=function(_0x346cc2){var _0x663f2b=this;return new Promise(function(_0x2c95c5,_0x29897c){return db[_0x14cb('0x17')][_0x14cb('0x1d')]({'raw':!![],'where':{'ContactId':_0x346cc2[_0x14cb('0x18')][_0x14cb('0x19')],'ListId':_0x346cc2[_0x14cb('0x18')][_0x14cb('0x1a')],'VoiceQueueId':_0x346cc2[_0x14cb('0x18')]['VoiceQueueId']===undefined?null:_0x346cc2['body'][_0x14cb('0x1b')],'CampaignId':_0x346cc2[_0x14cb('0x18')][_0x14cb('0x1c')]===undefined?null:_0x346cc2[_0x14cb('0x18')]['CampaignId']}})[_0x14cb('0xa')](function(_0x345a63){if(_0x345a63!=null){return db['CmHopperAdditionalPhone'][_0x14cb('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x345a63['id'],'OrderBy':{'$gte':_0x345a63[_0x14cb('0x1e')]}},'order':[[_0x14cb('0x1e'),'ASC']]})[_0x14cb('0xa')](function(_0x4b473a){if(_0x4b473a)return activateAdditionalPhone(_0x345a63,_0x346cc2['body'],_0x4b473a,_0x346cc2[_0x14cb('0x2c')],_0x346cc2['waitTime'])[_0x14cb('0xa')](function(_0x3a513b){_0x2c95c5(_0x3a513b);});else{return db[_0x14cb('0x25')][_0x14cb('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x345a63['id']},'order':[[_0x14cb('0x1e'),'ASC']]})[_0x14cb('0xa')](function(_0x50dac3){if(_0x50dac3)return activateAdditionalPhone(_0x345a63,_0x346cc2[_0x14cb('0x18')],_0x50dac3,_0x346cc2[_0x14cb('0x2c')],_0x346cc2[_0x14cb('0x2d')])[_0x14cb('0xa')](function(_0x44fae1){_0x2c95c5(_0x44fae1);});else{_0x2c95c5({'id':_0x345a63['id'],'phone':''});}})[_0x14cb('0x15')](function(_0x5df968){logger[_0x14cb('0x10')](_0x14cb('0x16'),_0x5df968[_0x14cb('0x13')]);_0x29897c(_0x663f2b[_0x14cb('0x10')](0x1f4,_0x5df968[_0x14cb('0x13')]));});}})[_0x14cb('0x15')](function(_0x4b7f9c){logger[_0x14cb('0x10')](_0x14cb('0x16'),_0x4b7f9c[_0x14cb('0x13')]);_0x29897c(_0x663f2b[_0x14cb('0x10')](0x1f4,_0x4b7f9c[_0x14cb('0x13')]));});}else _0x2c95c5(0x1);});});};function activateAdditionalPhone(_0x3a6284,_0x53655a,_0x173258,_0x24dc34,_0x22fc5b){return new Promise(function(_0xeb6892,_0x30af32){var _0x47de93;if(_['isNil'](_0x173258[_0x14cb('0x2e')])){_0x173258['scheduledat']=moment();}if(moment()>moment(_0x173258[_0x14cb('0x2e')])){_0x47de93=moment()[_0x14cb('0x2f')](_0x22fc5b||0x3,_0x14cb('0x30'));}else{if(_0x173258[_0x14cb('0x1e')]==0x0){_0x47de93=moment(_0x173258[_0x14cb('0x2e')]);}else{_0x47de93=moment()[_0x14cb('0x2f')](_0x22fc5b||0x3,_0x14cb('0x30'));}}if(_[_0x14cb('0x31')](_0x47de93)){_0x47de93=moment()[_0x14cb('0x2f')](_0x22fc5b||0x3,_0x14cb('0x30'));}var _0x3bbd97={'phone':_0x3a6284[_0x14cb('0x32')],'active':0x0,'OrderBy':_[_0x14cb('0x31')](_0x3a6284[_0x14cb('0x1e')])?0x0:_0x3a6284['OrderBy'],'scheduledat':moment()[_0x14cb('0x2f')](_0x24dc34||0x1,_0x14cb('0x30')),'countbusyretry':_0x53655a[_0x14cb('0x27')],'countcongestionretry':_0x53655a[_0x14cb('0x28')],'countnoanswerretry':_0x53655a[_0x14cb('0x1f')],'countnosuchnumberretry':_0x53655a[_0x14cb('0x20')],'countdropretry':_0x53655a['countdropretry'],'countabandonedretry':_0x53655a[_0x14cb('0x22')],'countmachineretry':_0x53655a['countmachineretry'],'countagentrejectretry':_0x53655a['countagentrejectretry'],'createdAt':_0x53655a[_0x14cb('0x33')],'updatedAt':_0x53655a[_0x14cb('0x34')]};var _0x5817d4={'CmHopperId':_0x3a6284['id'],'phone':_0x173258[_0x14cb('0x32')],'active':0x0,'OrderBy':_[_0x14cb('0x31')](_0x173258['OrderBy'])?0x0:_0x173258[_0x14cb('0x1e')],'scheduledat':_0x47de93,'countbusyretry':_0x173258[_0x14cb('0x27')],'countcongestionretry':_0x173258[_0x14cb('0x28')],'countnoanswerretry':_0x173258[_0x14cb('0x1f')],'countnosuchnumberretry':_0x173258[_0x14cb('0x20')],'countdropretry':_0x173258[_0x14cb('0x21')],'countabandonedretry':_0x173258['countabandonedretry'],'countmachineretry':_0x173258[_0x14cb('0x23')],'countagentrejectretry':_0x173258[_0x14cb('0x29')],'createdAt':_0x173258['createdAt'],'updatedAt':_0x173258[_0x14cb('0x34')]};return db[_0x14cb('0x35')]['transaction'](function(_0x2195e7){return db[_0x14cb('0x25')][_0x14cb('0x36')](_0x3bbd97,{'where':{'id':_0x173258['id']}},{'transaction':_0x2195e7})[_0x14cb('0xa')](function(){return db[_0x14cb('0x17')]['update'](_0x5817d4,{'where':{'id':_0x3a6284['id']}},{'transaction':_0x2195e7});});})[_0x14cb('0xa')](function(_0x56c3ef){_0xeb6892({'id':_0x3a6284['id'],'phone':_0x173258['phone']});})['catch'](function(_0x386c88){logger[_0x14cb('0x10')](_0x14cb('0x37'),_0x386c88[_0x14cb('0x13')]);_0x30af32({'error':_0x386c88[_0x14cb('0x13')]});});});}exports[_0x14cb('0x38')]=function(_0x1fade5){var _0x88e167=this;return new Promise(function(_0x1e80e2,_0x37961d){return db['CmHopper'][_0x14cb('0x36')](_0x1fade5[_0x14cb('0x18')]['field'],{'where':{'id':_0x1fade5[_0x14cb('0x18')]['id']}})[_0x14cb('0xa')](function(_0x3030b2){_0x1e80e2(_0x3030b2);})['catch'](function(_0x1358ef){logger[_0x14cb('0x10')](_0x14cb('0x38'),_0x1358ef['message']);_0x37961d(_0x88e167[_0x14cb('0x10')](0x1f4,_0x1358ef['message']));});});}; \ No newline at end of file +var _0xc216=['jayson/promise','client','request','then','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','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','entity','dialGlobalMaxRetry','countmachineretry','VerifyAdditionalPhones','SwapAdditionalPhones','OrderBy','duration','waitTime','isNil','scheduledat','minutes','add','phone','createdAt','updatedAt','sequelize','transaction','update','IncrementPreviewCounters','field','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x4a78dc,_0x2db037){var _0x1bf6a4=function(_0x4163b4){while(--_0x4163b4){_0x4a78dc['push'](_0x4a78dc['shift']());}};_0x1bf6a4(++_0x2db037);}(_0xc216,0x18e));var _0x6c21=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xc216[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0x6c21('0x0'));var util=require(_0x6c21('0x1'));var moment=require(_0x6c21('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c21('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c21('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6c21('0x5'))(_0x6c21('0x6'));var config=require(_0x6c21('0x7'));var jayson=require(_0x6c21('0x8'));var client=jayson[_0x6c21('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f90d8,_0x137f1b,_0x4e31a2){return new BPromise(function(_0x4a3c1e,_0x3f86d2){return client[_0x6c21('0xa')](_0x1f90d8,_0x4e31a2)[_0x6c21('0xb')](function(_0x12fc15){logger[_0x6c21('0xc')](_0x6c21('0xd'),_0x137f1b,_0x6c21('0xe'));logger[_0x6c21('0xf')](_0x6c21('0x10'),_0x137f1b,_0x6c21('0xe'),JSON[_0x6c21('0x11')](_0x12fc15));if(_0x12fc15[_0x6c21('0x12')]){if(_0x12fc15[_0x6c21('0x12')][_0x6c21('0x13')]===0x1f4){logger[_0x6c21('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x137f1b,_0x12fc15[_0x6c21('0x12')][_0x6c21('0x14')]);return _0x3f86d2(_0x12fc15['error'][_0x6c21('0x14')]);}logger[_0x6c21('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x137f1b,_0x12fc15[_0x6c21('0x12')]['message']);return _0x4a3c1e(_0x12fc15[_0x6c21('0x12')][_0x6c21('0x14')]);}else{logger[_0x6c21('0xc')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x137f1b,_0x6c21('0xe'));_0x4a3c1e(_0x12fc15[_0x6c21('0x15')]['message']);}})[_0x6c21('0x16')](function(_0x43ea40){logger[_0x6c21('0x12')](_0x6c21('0xd'),_0x137f1b,_0x43ea40);_0x3f86d2(_0x43ea40);});});}exports['VerifyAdditionalPhones']=function(_0x205789){var _0x57ae73=this;return new Promise(function(_0x293ede,_0x26f990){return db[_0x6c21('0x17')][_0x6c21('0x18')]({'raw':!![],'where':{'ContactId':_0x205789['body']['ContactId'],'ListId':_0x205789[_0x6c21('0x19')][_0x6c21('0x1a')],'VoiceQueueId':_0x205789[_0x6c21('0x19')][_0x6c21('0x1b')]===undefined?null:_0x205789['body'][_0x6c21('0x1b')],'CampaignId':_0x205789[_0x6c21('0x19')][_0x6c21('0x1c')]===undefined?null:_0x205789[_0x6c21('0x19')][_0x6c21('0x1c')]}})[_0x6c21('0xb')](function(_0x52a6d2){if(_0x52a6d2!=null){return db[_0x6c21('0x1d')][_0x6c21('0x18')]({'raw':!![],'where':{'CmHopperId':_0x52a6d2['id'],'OrderBy':{'$gt':_0x52a6d2['OrderBy']}},'order':[['OrderBy',_0x6c21('0x1e')]]})[_0x6c21('0xb')](function(_0x188244){var _0x51b113=0x0;if(_0x188244){if(_0x188244[_0x6c21('0x1f')]+_0x188244[_0x6c21('0x20')]+_0x188244[_0x6c21('0x21')]+_0x188244[_0x6c21('0x22')]+_0x188244[_0x6c21('0x23')]+_0x188244[_0x6c21('0x24')]+_0x188244['countmachineretry']+_0x188244[_0x6c21('0x25')]<_0x205789[_0x6c21('0x26')][_0x6c21('0x27')])_0x51b113=0x1;_0x293ede({'additional':_0x51b113});}else{return db[_0x6c21('0x1d')][_0x6c21('0x18')]({'raw':!![],'where':{'CmHopperId':_0x52a6d2['id']},'order':[['OrderBy','ASC']]})[_0x6c21('0xb')](function(_0xe9c575){var _0x12b0ac=0x0;if(_0xe9c575){if(_0xe9c575[_0x6c21('0x1f')]+_0xe9c575[_0x6c21('0x20')]+_0xe9c575['countnoanswerretry']+_0xe9c575[_0x6c21('0x22')]+_0xe9c575[_0x6c21('0x23')]+_0xe9c575[_0x6c21('0x24')]+_0xe9c575[_0x6c21('0x28')]+_0xe9c575[_0x6c21('0x25')]<_0x205789[_0x6c21('0x26')]['dialGlobalMaxRetry'])_0x12b0ac=0x1;_0x293ede({'additional':_0x12b0ac});}else{_0x293ede({'additional':0x0});}})[_0x6c21('0x16')](function(_0x4e5951){logger[_0x6c21('0x12')]('VerifyAdditionalPhones',_0x4e5951['message']);_0x26f990(_0x57ae73[_0x6c21('0x12')](0x1f4,_0x4e5951[_0x6c21('0x14')]));});}})[_0x6c21('0x16')](function(_0x2d3201){logger['error'](_0x6c21('0x29'),_0x2d3201[_0x6c21('0x14')]);_0x26f990(_0x57ae73['error'](0x1f4,_0x2d3201['message']));});}else _0x293ede({'additional':0x0});});});};exports[_0x6c21('0x2a')]=function(_0x3016d9){var _0x496cff=this;return new Promise(function(_0x107a17,_0x1f4e3d){return db[_0x6c21('0x17')][_0x6c21('0x18')]({'raw':!![],'where':{'ContactId':_0x3016d9[_0x6c21('0x19')]['ContactId'],'ListId':_0x3016d9['body'][_0x6c21('0x1a')],'VoiceQueueId':_0x3016d9['body'][_0x6c21('0x1b')]===undefined?null:_0x3016d9['body']['VoiceQueueId'],'CampaignId':_0x3016d9[_0x6c21('0x19')][_0x6c21('0x1c')]===undefined?null:_0x3016d9[_0x6c21('0x19')][_0x6c21('0x1c')]}})['then'](function(_0x187858){if(_0x187858!=null){return db[_0x6c21('0x1d')][_0x6c21('0x18')]({'raw':!![],'where':{'CmHopperId':_0x187858['id'],'OrderBy':{'$gte':_0x187858[_0x6c21('0x2b')]}},'order':[[_0x6c21('0x2b'),_0x6c21('0x1e')]]})['then'](function(_0x40e016){if(_0x40e016)return activateAdditionalPhone(_0x187858,_0x3016d9[_0x6c21('0x19')],_0x40e016,_0x3016d9[_0x6c21('0x2c')],_0x3016d9[_0x6c21('0x2d')])[_0x6c21('0xb')](function(_0x4ff340){_0x107a17(_0x4ff340);});else{return db[_0x6c21('0x1d')][_0x6c21('0x18')]({'raw':!![],'where':{'CmHopperId':_0x187858['id']},'order':[[_0x6c21('0x2b'),_0x6c21('0x1e')]]})[_0x6c21('0xb')](function(_0xcfd5ff){if(_0xcfd5ff)return activateAdditionalPhone(_0x187858,_0x3016d9['body'],_0xcfd5ff,_0x3016d9['duration'],_0x3016d9['waitTime'])[_0x6c21('0xb')](function(_0x46d7c3){_0x107a17(_0x46d7c3);});else{_0x107a17({'id':_0x187858['id'],'phone':''});}})[_0x6c21('0x16')](function(_0xeb5c13){logger[_0x6c21('0x12')]('VerifyAdditionalPhones',_0xeb5c13[_0x6c21('0x14')]);_0x1f4e3d(_0x496cff[_0x6c21('0x12')](0x1f4,_0xeb5c13['message']));});}})[_0x6c21('0x16')](function(_0x4629c4){logger['error'](_0x6c21('0x29'),_0x4629c4[_0x6c21('0x14')]);_0x1f4e3d(_0x496cff[_0x6c21('0x12')](0x1f4,_0x4629c4[_0x6c21('0x14')]));});}else _0x107a17(0x1);});});};function activateAdditionalPhone(_0x43f780,_0xcba253,_0x22c386,_0x2d18a9,_0x325029){return new Promise(function(_0x344697,_0x475544){var _0x27f875;if(_[_0x6c21('0x2e')](_0x22c386['scheduledat'])){_0x22c386[_0x6c21('0x2f')]=moment();}if(moment()>moment(_0x22c386[_0x6c21('0x2f')])){_0x27f875=moment()['add'](_0x325029||0x3,_0x6c21('0x30'));}else{if(_0x22c386[_0x6c21('0x2b')]==0x0){_0x27f875=moment(_0x22c386[_0x6c21('0x2f')]);}else{_0x27f875=moment()[_0x6c21('0x31')](_0x325029||0x3,_0x6c21('0x30'));}}if(_[_0x6c21('0x2e')](_0x27f875)){_0x27f875=moment()['add'](_0x325029||0x3,_0x6c21('0x30'));}var _0x576c58={'phone':_0x43f780[_0x6c21('0x32')],'active':0x0,'OrderBy':_[_0x6c21('0x2e')](_0x43f780['OrderBy'])?0x0:_0x43f780['OrderBy'],'scheduledat':moment()[_0x6c21('0x31')](_0x2d18a9||0x1,'minutes'),'countbusyretry':_0xcba253[_0x6c21('0x1f')],'countcongestionretry':_0xcba253[_0x6c21('0x20')],'countnoanswerretry':_0xcba253[_0x6c21('0x21')],'countnosuchnumberretry':_0xcba253[_0x6c21('0x22')],'countdropretry':_0xcba253[_0x6c21('0x23')],'countabandonedretry':_0xcba253['countabandonedretry'],'countmachineretry':_0xcba253['countmachineretry'],'countagentrejectretry':_0xcba253[_0x6c21('0x25')],'createdAt':_0xcba253[_0x6c21('0x33')],'updatedAt':_0xcba253['updatedAt']};var _0x2d03ed={'CmHopperId':_0x43f780['id'],'phone':_0x22c386['phone'],'active':0x0,'OrderBy':_['isNil'](_0x22c386[_0x6c21('0x2b')])?0x0:_0x22c386[_0x6c21('0x2b')],'scheduledat':_0x27f875,'countbusyretry':_0x22c386[_0x6c21('0x1f')],'countcongestionretry':_0x22c386[_0x6c21('0x20')],'countnoanswerretry':_0x22c386[_0x6c21('0x21')],'countnosuchnumberretry':_0x22c386['countnosuchnumberretry'],'countdropretry':_0x22c386[_0x6c21('0x23')],'countabandonedretry':_0x22c386['countabandonedretry'],'countmachineretry':_0x22c386[_0x6c21('0x28')],'countagentrejectretry':_0x22c386['countagentrejectretry'],'createdAt':_0x22c386[_0x6c21('0x33')],'updatedAt':_0x22c386[_0x6c21('0x34')]};return db[_0x6c21('0x35')][_0x6c21('0x36')](function(_0x5a0e9d){return db[_0x6c21('0x1d')][_0x6c21('0x37')](_0x576c58,{'where':{'id':_0x22c386['id']}},{'transaction':_0x5a0e9d})[_0x6c21('0xb')](function(){return db[_0x6c21('0x17')][_0x6c21('0x37')](_0x2d03ed,{'where':{'id':_0x43f780['id']}},{'transaction':_0x5a0e9d});});})[_0x6c21('0xb')](function(_0x4a6fe6){_0x344697({'id':_0x43f780['id'],'phone':_0x22c386['phone']});})[_0x6c21('0x16')](function(_0xfd7386){logger[_0x6c21('0x12')]('activateAdditionalPhone',_0xfd7386[_0x6c21('0x14')]);_0x475544({'error':_0xfd7386[_0x6c21('0x14')]});});});}exports[_0x6c21('0x38')]=function(_0x4fc445){var _0x3c864a=this;return new Promise(function(_0x59318c,_0x5628d3){return db['CmHopper'][_0x6c21('0x37')](_0x4fc445['body'][_0x6c21('0x39')],{'where':{'id':_0x4fc445[_0x6c21('0x19')]['id']}})['then'](function(_0x4f43e5){_0x59318c(_0x4f43e5);})['catch'](function(_0x82446b){logger[_0x6c21('0x12')]('IncrementPreviewCounters',_0x82446b[_0x6c21('0x14')]);_0x5628d3(_0x3c864a[_0x6c21('0x12')](0x1f4,_0x82446b[_0x6c21('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 14c6022..248ad5e 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 _0x2761=['/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x2761,0x1c1));var _0x1276=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x2761[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0x1276('0x0'));var util=require('util');var path=require(_0x1276('0x1'));var timeout=require(_0x1276('0x2'));var express=require(_0x1276('0x3'));var router=express[_0x1276('0x4')]();var fs_extra=require(_0x1276('0x5'));var auth=require(_0x1276('0x6'));var interaction=require(_0x1276('0x7'));var config=require(_0x1276('0x8'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x1276('0x9')]('/',auth['isAuthenticated'](),controller[_0x1276('0xa')]);router[_0x1276('0x9')](_0x1276('0xb'),auth[_0x1276('0xc')](),controller[_0x1276('0xd')]);router[_0x1276('0xe')]('/',auth[_0x1276('0xc')](),controller[_0x1276('0xf')]);router['put'](_0x1276('0xb'),auth[_0x1276('0xc')](),controller[_0x1276('0x10')]);router[_0x1276('0x11')](_0x1276('0xb'),auth[_0x1276('0xc')](),controller[_0x1276('0x12')]);module[_0x1276('0x13')]=router; \ No newline at end of file +var _0xb62e=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','index','get','show','post','/:id','update','delete','destroy','exports','multer','util'];(function(_0x2766b6,_0xca339e){var _0x24bde8=function(_0x3dc9d8){while(--_0x3dc9d8){_0x2766b6['push'](_0x2766b6['shift']());}};_0x24bde8(++_0xca339e);}(_0xb62e,0x1de));var _0xeb62=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xb62e[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var path=require(_0xeb62('0x2'));var timeout=require(_0xeb62('0x3'));var express=require('express');var router=express[_0xeb62('0x4')]();var fs_extra=require(_0xeb62('0x5'));var auth=require(_0xeb62('0x6'));var interaction=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var controller=require(_0xeb62('0x9'));router['get']('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0xb')]);router[_0xeb62('0xc')]('/:id',auth[_0xeb62('0xa')](),controller[_0xeb62('0xd')]);router[_0xeb62('0xe')]('/',auth[_0xeb62('0xa')](),controller['create']);router['put'](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x10')]);router[_0xeb62('0x11')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x12')]);module[_0xeb62('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 97df7df..668b8c4 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 _0xeb9e=['STRING','INTEGER','contactListQueue','sequelize'];(function(_0x2c3f08,_0x380f2b){var _0x4ea2ab=function(_0x4b198a){while(--_0x4b198a){_0x2c3f08['push'](_0x2c3f08['shift']());}};_0x4ea2ab(++_0x380f2b);}(_0xeb9e,0x143));var _0xeeb9=function(_0x1f0b7d,_0x32ab5b){_0x1f0b7d=_0x1f0b7d-0x0;var _0xa1ba18=_0xeb9e[_0x1f0b7d];return _0xa1ba18;};'use strict';var moment=require('moment');var Sequelize=require(_0xeeb9('0x0'));module['exports']={'phone':{'type':Sequelize[_0xeeb9('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xeeb9('0x2')],'unique':_0xeeb9('0x3')},'ListId':{'type':Sequelize[_0xeeb9('0x2')],'unique':_0xeeb9('0x3')},'VoiceQueueId':{'type':Sequelize[_0xeeb9('0x2')],'unique':_0xeeb9('0x3')}}; \ No newline at end of file +var _0x1c9a=['STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0x3af5a5,_0x361da7){var _0x24cbc1=function(_0x399d67){while(--_0x399d67){_0x3af5a5['push'](_0x3af5a5['shift']());}};_0x24cbc1(++_0x361da7);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0x21ae3f,_0x5d7234){_0x21ae3f=_0x21ae3f-0x0;var _0x447e03=_0x1c9a[_0x21ae3f];return _0x447e03;};'use strict';var moment=require(_0xa1c9('0x0'));var Sequelize=require(_0xa1c9('0x1'));module['exports']={'phone':{'type':Sequelize[_0xa1c9('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xa1c9('0x3')],'unique':_0xa1c9('0x4')},'ListId':{'type':Sequelize[_0xa1c9('0x3')],'unique':_0xa1c9('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xa1c9('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 0323e40..beb36c2 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 _0xe137=['name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','include','findAll','rows','show','CmHopperBlack','keys','includeAll','options','find','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error'];(function(_0x4f9cd1,_0x447a10){var _0x3b2d1=function(_0x363a5c){while(--_0x363a5c){_0x4f9cd1['push'](_0x4f9cd1['shift']());}};_0x3b2d1(++_0x447a10);}(_0xe137,0xb3));var _0x7e13=function(_0x178668,_0x1ec300){_0x178668=_0x178668-0x0;var _0x26107d=_0xe137[_0x178668];return _0x26107d;};'use strict';var emlformat=require(_0x7e13('0x0'));var rimraf=require(_0x7e13('0x1'));var zipdir=require(_0x7e13('0x2'));var jsonpatch=require(_0x7e13('0x3'));var rp=require(_0x7e13('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7e13('0x5'));var util=require('util');var path=require(_0x7e13('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e13('0x7'));var _=require(_0x7e13('0x8'));var squel=require(_0x7e13('0x9'));var crypto=require(_0x7e13('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7e13('0xb'));var querystring=require(_0x7e13('0xc'));var Papa=require(_0x7e13('0xd'));var Redis=require(_0x7e13('0xe'));var authService=require(_0x7e13('0xf'));var qs=require(_0x7e13('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7e13('0x11'));var logger=require(_0x7e13('0x12'))(_0x7e13('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7e13('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6e3d10,_0x2a0266){_0x2a0266=_0x2a0266||0xcc;return function(_0x214395){if(_0x214395){return _0x6e3d10[_0x7e13('0x15')](_0x2a0266);}return _0x6e3d10[_0x7e13('0x16')](_0x2a0266)[_0x7e13('0x17')]();};}function respondWithResult(_0x3ad2d1,_0x3cd137){_0x3cd137=_0x3cd137||0xc8;return function(_0x1d2c07){if(_0x1d2c07){return _0x3ad2d1['status'](_0x3cd137)[_0x7e13('0x18')](_0x1d2c07);}};}function respondWithFilteredResult(_0x2ca343,_0xc99624){return function(_0x266a5b){if(_0x266a5b){var _0x51447a=typeof _0xc99624[_0x7e13('0x19')]==='undefined'&&typeof _0xc99624[_0x7e13('0x1a')]===_0x7e13('0x1b');var _0x316c4e=_0x266a5b[_0x7e13('0x1c')];var _0x483c3b=_0x51447a?0x0:_0xc99624[_0x7e13('0x19')];var _0x3ea219=_0x51447a?_0x266a5b['count']:_0xc99624[_0x7e13('0x19')]+_0xc99624[_0x7e13('0x1a')];var _0x23ec31;if(_0x3ea219>=_0x316c4e){_0x3ea219=_0x316c4e;_0x23ec31=0xc8;}else{_0x23ec31=0xce;}_0x2ca343[_0x7e13('0x16')](_0x23ec31);return _0x2ca343[_0x7e13('0x1d')](_0x7e13('0x1e'),_0x483c3b+'-'+_0x3ea219+'/'+_0x316c4e)[_0x7e13('0x18')](_0x266a5b);}return null;};}function patchUpdates(_0x122070){return function(_0x3ee6c0){try{jsonpatch[_0x7e13('0x1f')](_0x3ee6c0,_0x122070,!![]);}catch(_0x20d8e4){return BPromise['reject'](_0x20d8e4);}return _0x3ee6c0[_0x7e13('0x20')]();};}function saveUpdates(_0x7b096d,_0x56b331){return function(_0x58df4d){if(_0x58df4d){return _0x58df4d[_0x7e13('0x21')](_0x7b096d)[_0x7e13('0x22')](function(_0x5e0611){return _0x5e0611;});}return null;};}function removeEntity(_0x542864,_0x5835c8){return function(_0x580745){if(_0x580745){return _0x580745[_0x7e13('0x23')]()[_0x7e13('0x22')](function(){_0x542864[_0x7e13('0x16')](0xcc)[_0x7e13('0x17')]();});}};}function handleEntityNotFound(_0x1f56e9,_0x49c7f0){return function(_0xa54815){if(!_0xa54815){_0x1f56e9[_0x7e13('0x15')](0x194);}return _0xa54815;};}function handleError(_0x25d7e8,_0x4d0ee2){_0x4d0ee2=_0x4d0ee2||0x1f4;return function(_0x57fe31){logger[_0x7e13('0x24')](_0x57fe31['stack']);if(_0x57fe31['name']){delete _0x57fe31[_0x7e13('0x25')];}_0x25d7e8[_0x7e13('0x16')](_0x4d0ee2)[_0x7e13('0x26')](_0x57fe31);};}exports[_0x7e13('0x27')]=function(_0x19925a,_0x434bed){var _0x5d939c={},_0x4d9a39={},_0x553dc1={'count':0x0,'rows':[]};var _0x52c4de=_[_0x7e13('0x28')](db['CmHopperBlack'][_0x7e13('0x29')],function(_0x409ec8){return{'name':_0x409ec8[_0x7e13('0x2a')],'type':_0x409ec8[_0x7e13('0x2b')]['key']};});_0x4d9a39[_0x7e13('0x2c')]=_[_0x7e13('0x28')](_0x52c4de,_0x7e13('0x25'));_0x4d9a39['query']=_['keys'](_0x19925a[_0x7e13('0x2d')]);_0x4d9a39[_0x7e13('0x2e')]=_[_0x7e13('0x2f')](_0x4d9a39[_0x7e13('0x2c')],_0x4d9a39[_0x7e13('0x2d')]);_0x5d939c['attributes']=_[_0x7e13('0x2f')](_0x4d9a39[_0x7e13('0x2c')],qs[_0x7e13('0x30')](_0x19925a[_0x7e13('0x2d')]['fields']));_0x5d939c[_0x7e13('0x31')]=_0x5d939c[_0x7e13('0x31')][_0x7e13('0x32')]?_0x5d939c['attributes']:_0x4d9a39[_0x7e13('0x2c')];if(!_0x19925a[_0x7e13('0x2d')]['hasOwnProperty'](_0x7e13('0x33'))){_0x5d939c[_0x7e13('0x1a')]=qs['limit'](_0x19925a['query'][_0x7e13('0x1a')]);_0x5d939c[_0x7e13('0x19')]=qs['offset'](_0x19925a[_0x7e13('0x2d')][_0x7e13('0x19')]);}_0x5d939c[_0x7e13('0x34')]=qs['sort'](_0x19925a['query'][_0x7e13('0x35')]);_0x5d939c['where']=qs[_0x7e13('0x2e')](_[_0x7e13('0x36')](_0x19925a[_0x7e13('0x2d')],_0x4d9a39[_0x7e13('0x2e')]),_0x52c4de);if(_0x19925a[_0x7e13('0x2d')][_0x7e13('0x37')]){_0x5d939c['where']=_[_0x7e13('0x38')](_0x5d939c[_0x7e13('0x39')],{'$or':_['map'](_0x52c4de,function(_0x3fc5b1){if(_0x3fc5b1[_0x7e13('0x2b')]!==_0x7e13('0x3a')){var _0x27c3ff={};_0x27c3ff[_0x3fc5b1['name']]={'$like':'%'+_0x19925a[_0x7e13('0x2d')][_0x7e13('0x37')]+'%'};return _0x27c3ff;}})});}_0x5d939c=_[_0x7e13('0x38')]({},_0x5d939c,_0x19925a['options']);var _0x11eca0={'where':_0x5d939c[_0x7e13('0x39')]};return db['CmHopperBlack']['count'](_0x11eca0)[_0x7e13('0x22')](function(_0xdf579f){_0x553dc1['count']=_0xdf579f;if(_0x19925a['query']['includeAll']){_0x5d939c[_0x7e13('0x3b')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x7e13('0x3c')](_0x5d939c);})['then'](function(_0x1e384a){_0x553dc1[_0x7e13('0x3d')]=_0x1e384a;return _0x553dc1;})[_0x7e13('0x22')](respondWithFilteredResult(_0x434bed,_0x5d939c))['catch'](handleError(_0x434bed,null));};exports[_0x7e13('0x3e')]=function(_0x58cec8,_0x2ec770){var _0x4ada30={'raw':!![],'where':{'id':_0x58cec8['params']['id']}},_0x4c8a96={};_0x4c8a96[_0x7e13('0x2c')]=_['keys'](db[_0x7e13('0x3f')][_0x7e13('0x29')]);_0x4c8a96[_0x7e13('0x2d')]=_[_0x7e13('0x40')](_0x58cec8['query']);_0x4c8a96['filters']=_[_0x7e13('0x2f')](_0x4c8a96['model'],_0x4c8a96[_0x7e13('0x2d')]);_0x4ada30[_0x7e13('0x31')]=_[_0x7e13('0x2f')](_0x4c8a96[_0x7e13('0x2c')],qs[_0x7e13('0x30')](_0x58cec8[_0x7e13('0x2d')]['fields']));_0x4ada30[_0x7e13('0x31')]=_0x4ada30['attributes'][_0x7e13('0x32')]?_0x4ada30[_0x7e13('0x31')]:_0x4c8a96[_0x7e13('0x2c')];if(_0x58cec8['query'][_0x7e13('0x41')]){_0x4ada30[_0x7e13('0x3b')]=[{'all':!![]}];}_0x4ada30=_[_0x7e13('0x38')]({},_0x4ada30,_0x58cec8[_0x7e13('0x42')]);return db[_0x7e13('0x3f')][_0x7e13('0x43')](_0x4ada30)[_0x7e13('0x22')](handleEntityNotFound(_0x2ec770,null))[_0x7e13('0x22')](respondWithResult(_0x2ec770,null))[_0x7e13('0x44')](handleError(_0x2ec770,null));};exports[_0x7e13('0x21')]=function(_0x1cbf68,_0x2b7ac3){if(_0x1cbf68[_0x7e13('0x45')]['id']){delete _0x1cbf68[_0x7e13('0x45')]['id'];}return db[_0x7e13('0x3f')][_0x7e13('0x43')]({'where':{'id':_0x1cbf68['params']['id']}})[_0x7e13('0x22')](handleEntityNotFound(_0x2b7ac3,null))[_0x7e13('0x22')](saveUpdates(_0x1cbf68[_0x7e13('0x45')],null))[_0x7e13('0x22')](respondWithResult(_0x2b7ac3,null))[_0x7e13('0x44')](handleError(_0x2b7ac3,null));};exports[_0x7e13('0x23')]=function(_0x396522,_0x3356b){return db[_0x7e13('0x3f')][_0x7e13('0x43')]({'where':{'id':_0x396522[_0x7e13('0x46')]['id']}})[_0x7e13('0x22')](handleEntityNotFound(_0x3356b,null))[_0x7e13('0x22')](removeEntity(_0x3356b,null))['catch'](handleError(_0x3356b,null));};exports[_0x7e13('0x47')]=function(_0x3aacc2,_0xa75a18){return db[_0x7e13('0x3f')][_0x7e13('0x47')]()[_0x7e13('0x22')](respondWithResult(_0xa75a18,null))[_0x7e13('0x44')](handleError(_0xa75a18,null));}; \ No newline at end of file +var _0x4bb2=['Content-Range','apply','reject','save','then','destroy','end','stack','name','send','index','CmHopperBlack','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','update','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set'];(function(_0xbca081,_0x30dcfa){var _0x10f563=function(_0xf98062){while(--_0xf98062){_0xbca081['push'](_0xbca081['shift']());}};_0x10f563(++_0x30dcfa);}(_0x4bb2,0x11c));var _0x24bb=function(_0x4eaa52,_0x492a49){_0x4eaa52=_0x4eaa52-0x0;var _0x8b3438=_0x4bb2[_0x4eaa52];return _0x8b3438;};'use strict';var emlformat=require(_0x24bb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x24bb('0x1'));var jsonpatch=require(_0x24bb('0x2'));var rp=require(_0x24bb('0x3'));var moment=require('moment');var BPromise=require(_0x24bb('0x4'));var Mustache=require(_0x24bb('0x5'));var util=require('util');var path=require(_0x24bb('0x6'));var sox=require(_0x24bb('0x7'));var csv=require(_0x24bb('0x8'));var ejs=require(_0x24bb('0x9'));var fs=require('fs');var fs_extra=require(_0x24bb('0xa'));var _=require(_0x24bb('0xb'));var squel=require(_0x24bb('0xc'));var crypto=require(_0x24bb('0xd'));var jsforce=require(_0x24bb('0xe'));var deskjs=require(_0x24bb('0xf'));var toCsv=require(_0x24bb('0x8'));var querystring=require(_0x24bb('0x10'));var Papa=require(_0x24bb('0x11'));var Redis=require(_0x24bb('0x12'));var authService=require(_0x24bb('0x13'));var qs=require(_0x24bb('0x14'));var as=require(_0x24bb('0x15'));var hardwareService=require(_0x24bb('0x16'));var logger=require(_0x24bb('0x17'))(_0x24bb('0x18'));var utils=require(_0x24bb('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x24bb('0x1a'));var db=require(_0x24bb('0x1b'))['db'];function respondWithStatusCode(_0x24b7d1,_0xd1a04d){_0xd1a04d=_0xd1a04d||0xcc;return function(_0x4ab274){if(_0x4ab274){return _0x24b7d1[_0x24bb('0x1c')](_0xd1a04d);}return _0x24b7d1[_0x24bb('0x1d')](_0xd1a04d)['end']();};}function respondWithResult(_0x11b082,_0x51832b){_0x51832b=_0x51832b||0xc8;return function(_0x15f4e6){if(_0x15f4e6){return _0x11b082[_0x24bb('0x1d')](_0x51832b)[_0x24bb('0x1e')](_0x15f4e6);}};}function respondWithFilteredResult(_0x50b4d9,_0x37e14f){return function(_0x43e637){if(_0x43e637){var _0x50b058=typeof _0x37e14f['offset']===_0x24bb('0x1f')&&typeof _0x37e14f[_0x24bb('0x20')]==='undefined';var _0x29a24c=_0x43e637[_0x24bb('0x21')];var _0x5e07a3=_0x50b058?0x0:_0x37e14f[_0x24bb('0x22')];var _0x1a5eae=_0x50b058?_0x43e637[_0x24bb('0x21')]:_0x37e14f['offset']+_0x37e14f[_0x24bb('0x20')];var _0x348cac;if(_0x1a5eae>=_0x29a24c){_0x1a5eae=_0x29a24c;_0x348cac=0xc8;}else{_0x348cac=0xce;}_0x50b4d9[_0x24bb('0x1d')](_0x348cac);return _0x50b4d9[_0x24bb('0x23')](_0x24bb('0x24'),_0x5e07a3+'-'+_0x1a5eae+'/'+_0x29a24c)[_0x24bb('0x1e')](_0x43e637);}return null;};}function patchUpdates(_0x358076){return function(_0x2c94a2){try{jsonpatch[_0x24bb('0x25')](_0x2c94a2,_0x358076,!![]);}catch(_0x17ddf0){return BPromise[_0x24bb('0x26')](_0x17ddf0);}return _0x2c94a2[_0x24bb('0x27')]();};}function saveUpdates(_0xc14ec9,_0x1e6143){return function(_0x37ea33){if(_0x37ea33){return _0x37ea33['update'](_0xc14ec9)[_0x24bb('0x28')](function(_0x1db765){return _0x1db765;});}return null;};}function removeEntity(_0x5f38eb,_0x1bce9f){return function(_0x4ba330){if(_0x4ba330){return _0x4ba330[_0x24bb('0x29')]()[_0x24bb('0x28')](function(){_0x5f38eb[_0x24bb('0x1d')](0xcc)[_0x24bb('0x2a')]();});}};}function handleEntityNotFound(_0xfb4968,_0x426b7c){return function(_0x34f296){if(!_0x34f296){_0xfb4968[_0x24bb('0x1c')](0x194);}return _0x34f296;};}function handleError(_0x2d6819,_0x3c7809){_0x3c7809=_0x3c7809||0x1f4;return function(_0x28c62e){logger['error'](_0x28c62e[_0x24bb('0x2b')]);if(_0x28c62e[_0x24bb('0x2c')]){delete _0x28c62e['name'];}_0x2d6819[_0x24bb('0x1d')](_0x3c7809)[_0x24bb('0x2d')](_0x28c62e);};}exports[_0x24bb('0x2e')]=function(_0x8f54fc,_0x49ce71){var _0x1c0e52={},_0x3d59c3={},_0x3ba2cc={'count':0x0,'rows':[]};var _0x28a2ad=_['map'](db[_0x24bb('0x2f')]['rawAttributes'],function(_0x19b542){return{'name':_0x19b542[_0x24bb('0x30')],'type':_0x19b542[_0x24bb('0x31')]['key']};});_0x3d59c3['model']=_[_0x24bb('0x32')](_0x28a2ad,_0x24bb('0x2c'));_0x3d59c3[_0x24bb('0x33')]=_[_0x24bb('0x34')](_0x8f54fc[_0x24bb('0x33')]);_0x3d59c3[_0x24bb('0x35')]=_[_0x24bb('0x36')](_0x3d59c3[_0x24bb('0x37')],_0x3d59c3[_0x24bb('0x33')]);_0x1c0e52[_0x24bb('0x38')]=_[_0x24bb('0x36')](_0x3d59c3[_0x24bb('0x37')],qs['fields'](_0x8f54fc[_0x24bb('0x33')][_0x24bb('0x39')]));_0x1c0e52['attributes']=_0x1c0e52[_0x24bb('0x38')][_0x24bb('0x3a')]?_0x1c0e52[_0x24bb('0x38')]:_0x3d59c3[_0x24bb('0x37')];if(!_0x8f54fc[_0x24bb('0x33')]['hasOwnProperty'](_0x24bb('0x3b'))){_0x1c0e52[_0x24bb('0x20')]=qs['limit'](_0x8f54fc[_0x24bb('0x33')][_0x24bb('0x20')]);_0x1c0e52[_0x24bb('0x22')]=qs[_0x24bb('0x22')](_0x8f54fc['query'][_0x24bb('0x22')]);}_0x1c0e52[_0x24bb('0x3c')]=qs[_0x24bb('0x3d')](_0x8f54fc['query'][_0x24bb('0x3d')]);_0x1c0e52[_0x24bb('0x3e')]=qs[_0x24bb('0x35')](_[_0x24bb('0x3f')](_0x8f54fc[_0x24bb('0x33')],_0x3d59c3[_0x24bb('0x35')]),_0x28a2ad);if(_0x8f54fc[_0x24bb('0x33')]['filter']){_0x1c0e52['where']=_[_0x24bb('0x40')](_0x1c0e52[_0x24bb('0x3e')],{'$or':_['map'](_0x28a2ad,function(_0x30818a){if(_0x30818a['type']!==_0x24bb('0x41')){var _0x8935aa={};_0x8935aa[_0x30818a[_0x24bb('0x2c')]]={'$like':'%'+_0x8f54fc['query'][_0x24bb('0x42')]+'%'};return _0x8935aa;}})});}_0x1c0e52=_[_0x24bb('0x40')]({},_0x1c0e52,_0x8f54fc[_0x24bb('0x43')]);var _0x7e5805={'where':_0x1c0e52[_0x24bb('0x3e')]};return db[_0x24bb('0x2f')]['count'](_0x7e5805)[_0x24bb('0x28')](function(_0xa985e){_0x3ba2cc[_0x24bb('0x21')]=_0xa985e;if(_0x8f54fc['query'][_0x24bb('0x44')]){_0x1c0e52[_0x24bb('0x45')]=[{'all':!![]}];}return db[_0x24bb('0x2f')][_0x24bb('0x46')](_0x1c0e52);})['then'](function(_0x5980f5){_0x3ba2cc[_0x24bb('0x47')]=_0x5980f5;return _0x3ba2cc;})[_0x24bb('0x28')](respondWithFilteredResult(_0x49ce71,_0x1c0e52))[_0x24bb('0x48')](handleError(_0x49ce71,null));};exports[_0x24bb('0x49')]=function(_0x2f9536,_0x3fda01){var _0x38255c={'raw':!![],'where':{'id':_0x2f9536['params']['id']}},_0x3e88d7={};_0x3e88d7[_0x24bb('0x37')]=_[_0x24bb('0x34')](db[_0x24bb('0x2f')][_0x24bb('0x4a')]);_0x3e88d7[_0x24bb('0x33')]=_[_0x24bb('0x34')](_0x2f9536['query']);_0x3e88d7['filters']=_[_0x24bb('0x36')](_0x3e88d7[_0x24bb('0x37')],_0x3e88d7[_0x24bb('0x33')]);_0x38255c[_0x24bb('0x38')]=_[_0x24bb('0x36')](_0x3e88d7[_0x24bb('0x37')],qs[_0x24bb('0x39')](_0x2f9536[_0x24bb('0x33')][_0x24bb('0x39')]));_0x38255c[_0x24bb('0x38')]=_0x38255c[_0x24bb('0x38')][_0x24bb('0x3a')]?_0x38255c[_0x24bb('0x38')]:_0x3e88d7[_0x24bb('0x37')];if(_0x2f9536[_0x24bb('0x33')][_0x24bb('0x44')]){_0x38255c['include']=[{'all':!![]}];}_0x38255c=_['merge']({},_0x38255c,_0x2f9536[_0x24bb('0x43')]);return db['CmHopperBlack'][_0x24bb('0x4b')](_0x38255c)[_0x24bb('0x28')](handleEntityNotFound(_0x3fda01,null))[_0x24bb('0x28')](respondWithResult(_0x3fda01,null))['catch'](handleError(_0x3fda01,null));};exports[_0x24bb('0x4c')]=function(_0x1595ce,_0x5f31bc){if(_0x1595ce[_0x24bb('0x4d')]['id']){delete _0x1595ce[_0x24bb('0x4d')]['id'];}return db['CmHopperBlack']['find']({'where':{'id':_0x1595ce[_0x24bb('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5f31bc,null))['then'](saveUpdates(_0x1595ce[_0x24bb('0x4d')],null))[_0x24bb('0x28')](respondWithResult(_0x5f31bc,null))[_0x24bb('0x48')](handleError(_0x5f31bc,null));};exports[_0x24bb('0x29')]=function(_0x416a13,_0x526707){return db[_0x24bb('0x2f')]['find']({'where':{'id':_0x416a13[_0x24bb('0x4e')]['id']}})[_0x24bb('0x28')](handleEntityNotFound(_0x526707,null))[_0x24bb('0x28')](removeEntity(_0x526707,null))[_0x24bb('0x48')](handleError(_0x526707,null));};exports[_0x24bb('0x4f')]=function(_0x48aa36,_0x33c900){return db[_0x24bb('0x2f')][_0x24bb('0x4f')]()[_0x24bb('0x28')](respondWithResult(_0x33c900,null))[_0x24bb('0x48')](handleError(_0x33c900,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index d0aa4d4..846d6f7 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 _0xfa66=['request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2110ce,_0x37c29b){var _0x139610=function(_0x16b65a){while(--_0x16b65a){_0x2110ce['push'](_0x2110ce['shift']());}};_0x139610(++_0x37c29b);}(_0xfa66,0x12e));var _0x6fa6=function(_0x151359,_0x424fa1){_0x151359=_0x151359-0x0;var _0x285507=_0xfa66[_0x151359];return _0x285507;};'use strict';var _=require(_0x6fa6('0x0'));var util=require(_0x6fa6('0x1'));var logger=require(_0x6fa6('0x2'))(_0x6fa6('0x3'));var moment=require(_0x6fa6('0x4'));var BPromise=require(_0x6fa6('0x5'));var rp=require(_0x6fa6('0x6'));var fs=require('fs');var path=require(_0x6fa6('0x7'));var rimraf=require(_0x6fa6('0x8'));var config=require(_0x6fa6('0x9'));var attributes=require(_0x6fa6('0xa'));module[_0x6fa6('0xb')]=function(_0x49cb7b,_0x23fcf9){return _0x49cb7b[_0x6fa6('0xc')]('CmHopperBlack',attributes,{'tableName':_0x6fa6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x926f=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','cm_hopper_black','lodash','util','api','moment'];(function(_0x3792e6,_0x32bd91){var _0x441e44=function(_0x357478){while(--_0x357478){_0x3792e6['push'](_0x3792e6['shift']());}};_0x441e44(++_0x32bd91);}(_0x926f,0x168));var _0xf926=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x926f[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xf926('0x0'));var util=require(_0xf926('0x1'));var logger=require('../../config/logger')(_0xf926('0x2'));var moment=require(_0xf926('0x3'));var BPromise=require(_0xf926('0x4'));var rp=require(_0xf926('0x5'));var fs=require('fs');var path=require(_0xf926('0x6'));var rimraf=require(_0xf926('0x7'));var config=require(_0xf926('0x8'));var attributes=require(_0xf926('0x9'));module[_0xf926('0xa')]=function(_0x3f1500,_0x202adc){return _0x3f1500[_0xf926('0xb')]('CmHopperBlack',attributes,{'tableName':_0xf926('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 ea8a1af..705c1f4 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 _0x1f6e=['then','UpdateCmHopperBlack','update','body','where','DestroyCmHopperBlack','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','raw','options','attributes','limit','include','map','model'];(function(_0x3d4f9e,_0xf816fe){var _0x320f80=function(_0xb1790a){while(--_0xb1790a){_0x3d4f9e['push'](_0x3d4f9e['shift']());}};_0x320f80(++_0xf816fe);}(_0x1f6e,0x1e6));var _0xe1f6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1f6e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe1f6('0x0'));var util=require(_0xe1f6('0x1'));var moment=require('moment');var BPromise=require(_0xe1f6('0x2'));var rs=require(_0xe1f6('0x3'));var fs=require('fs');var Redis=require(_0xe1f6('0x4'));var db=require(_0xe1f6('0x5'))['db'];var utils=require(_0xe1f6('0x6'));var logger=require(_0xe1f6('0x7'))(_0xe1f6('0x8'));var config=require(_0xe1f6('0x9'));var jayson=require(_0xe1f6('0xa'));var client=jayson['client'][_0xe1f6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x130a6b,_0x27a74f,_0x5bdd69){return new BPromise(function(_0x12982d,_0x854a33){return client[_0xe1f6('0xc')](_0x130a6b,_0x5bdd69)['then'](function(_0x591eb4){logger[_0xe1f6('0xd')](_0xe1f6('0xe'),_0x27a74f,_0xe1f6('0xf'));logger[_0xe1f6('0x10')](_0xe1f6('0x11'),_0x27a74f,_0xe1f6('0xf'),JSON[_0xe1f6('0x12')](_0x591eb4));if(_0x591eb4['error']){if(_0x591eb4[_0xe1f6('0x13')][_0xe1f6('0x14')]===0x1f4){logger[_0xe1f6('0x13')](_0xe1f6('0xe'),_0x27a74f,_0x591eb4[_0xe1f6('0x13')][_0xe1f6('0x15')]);return _0x854a33(_0x591eb4[_0xe1f6('0x13')]['message']);}logger[_0xe1f6('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0x27a74f,_0x591eb4[_0xe1f6('0x13')][_0xe1f6('0x15')]);return _0x12982d(_0x591eb4[_0xe1f6('0x13')][_0xe1f6('0x15')]);}else{logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x27a74f,_0xe1f6('0xf'));_0x12982d(_0x591eb4[_0xe1f6('0x16')][_0xe1f6('0x15')]);}})[_0xe1f6('0x17')](function(_0x1361b2){logger[_0xe1f6('0x13')](_0xe1f6('0xe'),_0x27a74f,_0x1361b2);_0x854a33(_0x1361b2);});});}exports[_0xe1f6('0x18')]=function(_0x240b3a){var _0x114499=this;return new Promise(function(_0x4b8977,_0xdbeb67){return db[_0xe1f6('0x19')][_0xe1f6('0x1a')]({'raw':_0x240b3a['options']?_0x240b3a['options'][_0xe1f6('0x1b')]===undefined?!![]:![]:!![],'where':_0x240b3a[_0xe1f6('0x1c')]?_0x240b3a[_0xe1f6('0x1c')]['where']||null:null,'attributes':_0x240b3a[_0xe1f6('0x1c')]?_0x240b3a[_0xe1f6('0x1c')][_0xe1f6('0x1d')]||null:null,'limit':_0x240b3a[_0xe1f6('0x1c')]?_0x240b3a['options'][_0xe1f6('0x1e')]||null:null,'include':_0x240b3a[_0xe1f6('0x1c')]?_0x240b3a['options'][_0xe1f6('0x1f')]?_[_0xe1f6('0x20')](_0x240b3a[_0xe1f6('0x1c')][_0xe1f6('0x1f')],function(_0x53ac84){return{'model':db[_0x53ac84[_0xe1f6('0x21')]],'as':_0x53ac84['as'],'attributes':_0x53ac84[_0xe1f6('0x1d')],'include':_0x53ac84[_0xe1f6('0x1f')]?_[_0xe1f6('0x20')](_0x53ac84[_0xe1f6('0x1f')],function(_0x2f6bdf){return{'model':db[_0x2f6bdf[_0xe1f6('0x21')]],'as':_0x2f6bdf['as'],'attributes':_0x2f6bdf[_0xe1f6('0x1d')],'include':_0x2f6bdf['include']?_['map'](_0x2f6bdf[_0xe1f6('0x1f')],function(_0x425e9b){return{'model':db[_0x425e9b[_0xe1f6('0x21')]],'as':_0x425e9b['as'],'attributes':_0x425e9b[_0xe1f6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe1f6('0x22')](function(_0x27adb5){logger['info'](_0xe1f6('0x18'),_0x240b3a);logger[_0xe1f6('0x10')](_0xe1f6('0x18'),_0x240b3a,JSON[_0xe1f6('0x12')](_0x27adb5));_0x4b8977(_0x27adb5);})[_0xe1f6('0x17')](function(_0x1373d5){logger[_0xe1f6('0x13')](_0xe1f6('0x18'),_0x1373d5['message'],_0x240b3a);_0xdbeb67(_0x114499['error'](0x1f4,_0x1373d5['message']));});});};exports[_0xe1f6('0x23')]=function(_0x47d59a){var _0x3ab21e=this;return new Promise(function(_0xeeeec6,_0x3c83df){return db[_0xe1f6('0x19')][_0xe1f6('0x24')](_0x47d59a[_0xe1f6('0x25')],{'raw':_0x47d59a[_0xe1f6('0x1c')]?_0x47d59a[_0xe1f6('0x1c')][_0xe1f6('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47d59a[_0xe1f6('0x1c')]?_0x47d59a['options'][_0xe1f6('0x26')]||null:null,'attributes':_0x47d59a[_0xe1f6('0x1c')]?_0x47d59a['options'][_0xe1f6('0x1d')]||null:null,'limit':_0x47d59a[_0xe1f6('0x1c')]?_0x47d59a['options'][_0xe1f6('0x1e')]||null:null})['then'](function(_0x227fe3){logger[_0xe1f6('0xd')](_0xe1f6('0x23'),_0x47d59a);logger[_0xe1f6('0x10')](_0xe1f6('0x23'),_0x47d59a,JSON[_0xe1f6('0x12')](_0x227fe3));_0xeeeec6(_0x227fe3);})[_0xe1f6('0x17')](function(_0x45855c){logger[_0xe1f6('0x13')](_0xe1f6('0x23'),_0x45855c['message'],_0x47d59a);_0x3c83df(_0x3ab21e['error'](0x1f4,_0x45855c[_0xe1f6('0x15')]));});});};exports[_0xe1f6('0x27')]=function(_0x4e5f3f){var _0x37312f=this;return new Promise(function(_0x5213ef,_0x40e5fe){return db['CmHopperBlack']['destroy']({'where':_0x4e5f3f[_0xe1f6('0x1c')]?_0x4e5f3f[_0xe1f6('0x1c')][_0xe1f6('0x26')]||null:null})['then'](function(_0x5b53aa){logger[_0xe1f6('0xd')]('DestroyCmHopperBlack',_0x4e5f3f);logger['debug'](_0xe1f6('0x27'),_0x4e5f3f,JSON['stringify'](_0x5b53aa));_0x5213ef(_0x5b53aa);})[_0xe1f6('0x17')](function(_0x446778){logger[_0xe1f6('0x13')](_0xe1f6('0x27'),_0x446778[_0xe1f6('0x15')],_0x4e5f3f);_0x40e5fe(_0x37312f[_0xe1f6('0x13')](0x1f4,_0x446778[_0xe1f6('0x15')]));});});}; \ No newline at end of file +var _0x595e=['stringify','UpdateCmHopperBlack','update','body','raw','DestroyCmHopperBlack','lodash','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','GetCmHopperBlack','CmHopperBlack','options','where','attributes','limit','include','map','model'];(function(_0x4f3d05,_0x54bb67){var _0x2b8439=function(_0x24276c){while(--_0x24276c){_0x4f3d05['push'](_0x4f3d05['shift']());}};_0x2b8439(++_0x54bb67);}(_0x595e,0x192));var _0xe595=function(_0x2178c4,_0x3b38c0){_0x2178c4=_0x2178c4-0x0;var _0x3d9dd2=_0x595e[_0x2178c4];return _0x3d9dd2;};'use strict';var _=require(_0xe595('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe595('0x1'));var rs=require(_0xe595('0x2'));var fs=require('fs');var Redis=require(_0xe595('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe595('0x4'));var jayson=require(_0xe595('0x5'));var client=jayson[_0xe595('0x6')][_0xe595('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1c3136,_0x19dd59,_0x13f3e0){return new BPromise(function(_0x44ad59,_0x10ce89){return client[_0xe595('0x8')](_0x1c3136,_0x13f3e0)[_0xe595('0x9')](function(_0x204c55){logger[_0xe595('0xa')](_0xe595('0xb'),_0x19dd59,_0xe595('0xc'));logger[_0xe595('0xd')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x19dd59,'request\x20sent',JSON['stringify'](_0x204c55));if(_0x204c55['error']){if(_0x204c55[_0xe595('0xe')][_0xe595('0xf')]===0x1f4){logger[_0xe595('0xe')](_0xe595('0xb'),_0x19dd59,_0x204c55['error']['message']);return _0x10ce89(_0x204c55[_0xe595('0xe')][_0xe595('0x10')]);}logger[_0xe595('0xe')](_0xe595('0xb'),_0x19dd59,_0x204c55[_0xe595('0xe')][_0xe595('0x10')]);return _0x44ad59(_0x204c55['error'][_0xe595('0x10')]);}else{logger[_0xe595('0xa')]('CmHopperBlack,\x20%s,\x20%s',_0x19dd59,'request\x20sent');_0x44ad59(_0x204c55['result']['message']);}})[_0xe595('0x11')](function(_0x494751){logger[_0xe595('0xe')](_0xe595('0xb'),_0x19dd59,_0x494751);_0x10ce89(_0x494751);});});}exports[_0xe595('0x12')]=function(_0x1d63b7){var _0xc0c31c=this;return new Promise(function(_0x544d2b,_0x34790e){return db[_0xe595('0x13')]['findAll']({'raw':_0x1d63b7['options']?_0x1d63b7[_0xe595('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x1d63b7[_0xe595('0x14')]?_0x1d63b7[_0xe595('0x14')][_0xe595('0x15')]||null:null,'attributes':_0x1d63b7[_0xe595('0x14')]?_0x1d63b7[_0xe595('0x14')][_0xe595('0x16')]||null:null,'limit':_0x1d63b7['options']?_0x1d63b7[_0xe595('0x14')][_0xe595('0x17')]||null:null,'include':_0x1d63b7[_0xe595('0x14')]?_0x1d63b7['options'][_0xe595('0x18')]?_[_0xe595('0x19')](_0x1d63b7['options'][_0xe595('0x18')],function(_0x4562b5){return{'model':db[_0x4562b5[_0xe595('0x1a')]],'as':_0x4562b5['as'],'attributes':_0x4562b5[_0xe595('0x16')],'include':_0x4562b5[_0xe595('0x18')]?_[_0xe595('0x19')](_0x4562b5[_0xe595('0x18')],function(_0x16fddf){return{'model':db[_0x16fddf[_0xe595('0x1a')]],'as':_0x16fddf['as'],'attributes':_0x16fddf['attributes'],'include':_0x16fddf[_0xe595('0x18')]?_[_0xe595('0x19')](_0x16fddf[_0xe595('0x18')],function(_0x3bca4f){return{'model':db[_0x3bca4f[_0xe595('0x1a')]],'as':_0x3bca4f['as'],'attributes':_0x3bca4f[_0xe595('0x16')]};}):[]};}):[]};}):[]:[]})[_0xe595('0x9')](function(_0x23293a){logger[_0xe595('0xa')](_0xe595('0x12'),_0x1d63b7);logger['debug'](_0xe595('0x12'),_0x1d63b7,JSON[_0xe595('0x1b')](_0x23293a));_0x544d2b(_0x23293a);})[_0xe595('0x11')](function(_0x43bdfe){logger[_0xe595('0xe')](_0xe595('0x12'),_0x43bdfe[_0xe595('0x10')],_0x1d63b7);_0x34790e(_0xc0c31c[_0xe595('0xe')](0x1f4,_0x43bdfe[_0xe595('0x10')]));});});};exports[_0xe595('0x1c')]=function(_0x1eea9a){var _0x11550a=this;return new Promise(function(_0x4807ee,_0x40666e){return db[_0xe595('0x13')][_0xe595('0x1d')](_0x1eea9a[_0xe595('0x1e')],{'raw':_0x1eea9a[_0xe595('0x14')]?_0x1eea9a[_0xe595('0x14')][_0xe595('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1eea9a['options']?_0x1eea9a[_0xe595('0x14')]['where']||null:null,'attributes':_0x1eea9a[_0xe595('0x14')]?_0x1eea9a[_0xe595('0x14')]['attributes']||null:null,'limit':_0x1eea9a['options']?_0x1eea9a[_0xe595('0x14')][_0xe595('0x17')]||null:null})[_0xe595('0x9')](function(_0x3e0b32){logger[_0xe595('0xa')]('UpdateCmHopperBlack',_0x1eea9a);logger['debug']('UpdateCmHopperBlack',_0x1eea9a,JSON['stringify'](_0x3e0b32));_0x4807ee(_0x3e0b32);})[_0xe595('0x11')](function(_0x469888){logger[_0xe595('0xe')](_0xe595('0x1c'),_0x469888[_0xe595('0x10')],_0x1eea9a);_0x40666e(_0x11550a[_0xe595('0xe')](0x1f4,_0x469888['message']));});});};exports[_0xe595('0x20')]=function(_0x51e26a){var _0x472f7d=this;return new Promise(function(_0x5c88f3,_0x278022){return db[_0xe595('0x13')]['destroy']({'where':_0x51e26a[_0xe595('0x14')]?_0x51e26a['options'][_0xe595('0x15')]||null:null})[_0xe595('0x9')](function(_0x38fbf3){logger[_0xe595('0xa')](_0xe595('0x20'),_0x51e26a);logger[_0xe595('0xd')](_0xe595('0x20'),_0x51e26a,JSON['stringify'](_0x38fbf3));_0x5c88f3(_0x38fbf3);})['catch'](function(_0x2b2e20){logger['error']('DestroyCmHopperBlack',_0x2b2e20[_0xe595('0x10')],_0x51e26a);_0x278022(_0x472f7d[_0xe595('0xe')](0x1f4,_0x2b2e20['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 0009540..b70cff5 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 _0x1883=['../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','/:id','show','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x104b96,_0x2d1df8){var _0x14b65c=function(_0x37debb){while(--_0x37debb){_0x104b96['push'](_0x104b96['shift']());}};_0x14b65c(++_0x2d1df8);}(_0x1883,0xab));var _0x3188=function(_0x992dd1,_0x45ceac){_0x992dd1=_0x992dd1-0x0;var _0x2bf63a=_0x1883[_0x992dd1];return _0x2bf63a;};'use strict';var multer=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var path=require(_0x3188('0x2'));var timeout=require(_0x3188('0x3'));var express=require(_0x3188('0x4'));var router=express[_0x3188('0x5')]();var fs_extra=require(_0x3188('0x6'));var auth=require(_0x3188('0x7'));var interaction=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var controller=require(_0x3188('0xa'));router[_0x3188('0xb')]('/',auth[_0x3188('0xc')](),controller[_0x3188('0xd')]);router[_0x3188('0xb')](_0x3188('0xe'),auth[_0x3188('0xc')](),controller['describe']);router[_0x3188('0xb')](_0x3188('0xf'),auth['isAuthenticated'](),controller[_0x3188('0x10')]);router['put'](_0x3188('0xf'),auth[_0x3188('0xc')](),controller[_0x3188('0x11')]);router[_0x3188('0x12')]('/:id',auth[_0x3188('0xc')](),controller[_0x3188('0x13')]);module['exports']=router; \ No newline at end of file +var _0x6455=['index','/describe','/:id','show','put','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated'];(function(_0x223461,_0x2bca70){var _0x4dbe0a=function(_0x3c3cb6){while(--_0x3c3cb6){_0x223461['push'](_0x223461['shift']());}};_0x4dbe0a(++_0x2bca70);}(_0x6455,0x97));var _0x5645=function(_0x253341,_0x1f842a){_0x253341=_0x253341-0x0;var _0x19d069=_0x6455[_0x253341];return _0x19d069;};'use strict';var multer=require(_0x5645('0x0'));var util=require('util');var path=require(_0x5645('0x1'));var timeout=require(_0x5645('0x2'));var express=require(_0x5645('0x3'));var router=express[_0x5645('0x4')]();var fs_extra=require(_0x5645('0x5'));var auth=require(_0x5645('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5645('0x7'));var controller=require(_0x5645('0x8'));router[_0x5645('0x9')]('/',auth[_0x5645('0xa')](),controller[_0x5645('0xb')]);router[_0x5645('0x9')](_0x5645('0xc'),auth[_0x5645('0xa')](),controller['describe']);router['get'](_0x5645('0xd'),auth[_0x5645('0xa')](),controller[_0x5645('0xe')]);router[_0x5645('0xf')](_0x5645('0xd'),auth[_0x5645('0xa')](),controller['update']);router[_0x5645('0x10')](_0x5645('0xd'),auth[_0x5645('0xa')](),controller[_0x5645('0x11')]);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 862f63e..8268701 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 _0x5135=['exports','INTEGER','DATE','STRING','followuptime','diff','seconds','BOOLEAN','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5135,0x86));var _0x5513=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x5135[_0x2ec461];return _0x28603d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5513('0x0'));module[_0x5513('0x1')]={'state':{'type':Sequelize[_0x5513('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x5513('0x3')]},'countbusyretry':{'type':Sequelize[_0x5513('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5513('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5513('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5513('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x5513('0x4')]},'originatecalleridname':{'type':Sequelize[_0x5513('0x4')]},'calleridnum':{'type':Sequelize[_0x5513('0x4')]},'calleridname':{'type':Sequelize[_0x5513('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x5513('0x3')]},'droptime':{'type':Sequelize[_0x5513('0x3')]},'endtime':{'type':Sequelize[_0x5513('0x3')]},'ringtime':{'type':Sequelize[_0x5513('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x5513('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5513('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5513('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5513('0x4')]},'campaign':{'type':Sequelize[_0x5513('0x4')]},'campaigntype':{'type':Sequelize[_0x5513('0x4')]},'membername':{'type':Sequelize[_0x5513('0x4')]},'reason':{'type':Sequelize[_0x5513('0x4')]},'disposition':{'type':Sequelize[_0x5513('0x4')]},'secondDisposition':{'type':Sequelize[_0x5513('0x4')]},'thirdDisposition':{'type':Sequelize[_0x5513('0x4')]},'dispositionat':{'type':Sequelize[_0x5513('0x3')],'set':function(_0x448474){var _0x13e7ff=this['getDataValue']('endtime');if(_0x13e7ff&&_0x448474){this['setDataValue'](_0x5513('0x5'),moment(_0x448474)[_0x5513('0x6')](moment(_0x13e7ff),_0x5513('0x7')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x5513('0x8')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x5513('0x8')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x5513('0x8')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x5513('0x3')]},'callback':{'type':Sequelize[_0x5513('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5513('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5513('0x3')]},'deleted':{'type':Sequelize[_0x5513('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x5513('0x3')]},'recallme':{'type':Sequelize[_0x5513('0x8')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x5513('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5513('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5513('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5513('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5513('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1c11=['exports','INTEGER','STRING','DATE','getDataValue','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment'];(function(_0x43316d,_0x5ebd8f){var _0x52d343=function(_0x231e52){while(--_0x231e52){_0x43316d['push'](_0x43316d['shift']());}};_0x52d343(++_0x5ebd8f);}(_0x1c11,0x6a));var _0x11c1=function(_0x507ed1,_0x14675c){_0x507ed1=_0x507ed1-0x0;var _0x2e26f1=_0x1c11[_0x507ed1];return _0x2e26f1;};'use strict';var Sequelize=require(_0x11c1('0x0'));var moment=require(_0x11c1('0x1'));module[_0x11c1('0x2')]={'state':{'type':Sequelize[_0x11c1('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x11c1('0x4')]},'scheduledat':{'type':Sequelize[_0x11c1('0x5')]},'countbusyretry':{'type':Sequelize[_0x11c1('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x11c1('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x11c1('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x11c1('0x5')]},'responsetime':{'type':Sequelize[_0x11c1('0x5')]},'answertime':{'type':Sequelize[_0x11c1('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x11c1('0x5')]},'ringtime':{'type':Sequelize[_0x11c1('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x11c1('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x11c1('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x11c1('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x11c1('0x4')]},'campaign':{'type':Sequelize[_0x11c1('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x11c1('0x4')]},'reason':{'type':Sequelize[_0x11c1('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x11c1('0x4')]},'thirdDisposition':{'type':Sequelize[_0x11c1('0x4')]},'dispositionat':{'type':Sequelize[_0x11c1('0x5')],'set':function(_0x24d461){var _0x381f24=this[_0x11c1('0x6')]('endtime');if(_0x381f24&&_0x24d461){this[_0x11c1('0x7')](_0x11c1('0x8'),moment(_0x24d461)[_0x11c1('0x9')](moment(_0x381f24),_0x11c1('0xa')));}}},'amd':{'type':Sequelize[_0x11c1('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x11c1('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x11c1('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x11c1('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x11c1('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x11c1('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x11c1('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 fcabb4a..29c5448 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 _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(_0x5da6f9,_0x111700){var _0x103a21=function(_0x4b7139){while(--_0x4b7139){_0x5da6f9['push'](_0x5da6f9['shift']());}};_0x103a21(++_0x111700);}(_0xb016,0x159));var _0x6b01=function(_0xca6057,_0x5866d7){_0xca6057=_0xca6057-0x0;var _0x27a8e3=_0xb016[_0xca6057];return _0x27a8e3;};'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 +var _0x7096=['group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','findOne','rimraf','fast-json-patch','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','CmHopperFinal','find','catch','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','noSuchContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','createdAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum','state\x20=\x204'];(function(_0x77d39c,_0x296249){var _0x1706ec=function(_0x5f0738){while(--_0x5f0738){_0x77d39c['push'](_0x77d39c['shift']());}};_0x1706ec(++_0x296249);}(_0x7096,0x10c));var _0x6709=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x7096[_0x334841];return _0x5beb4b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6709('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6709('0x1'));var rp=require('request-promise');var moment=require(_0x6709('0x2'));var BPromise=require(_0x6709('0x3'));var Mustache=require(_0x6709('0x4'));var util=require(_0x6709('0x5'));var path=require(_0x6709('0x6'));var sox=require(_0x6709('0x7'));var csv=require(_0x6709('0x8'));var ejs=require(_0x6709('0x9'));var fs=require('fs');var fs_extra=require(_0x6709('0xa'));var _=require(_0x6709('0xb'));var squel=require(_0x6709('0xc'));var crypto=require(_0x6709('0xd'));var jsforce=require(_0x6709('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6709('0xf'));var Papa=require(_0x6709('0x10'));var Redis=require(_0x6709('0x11'));var authService=require(_0x6709('0x12'));var qs=require(_0x6709('0x13'));var as=require(_0x6709('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6709('0x15'));var utils=require(_0x6709('0x16'));var config=require(_0x6709('0x17'));var licenseUtil=require(_0x6709('0x18'));var db=require(_0x6709('0x19'))['db'];function respondWithStatusCode(_0x288f51,_0x1d56a5){_0x1d56a5=_0x1d56a5||0xcc;return function(_0x1ac547){if(_0x1ac547){return _0x288f51['sendStatus'](_0x1d56a5);}return _0x288f51[_0x6709('0x1a')](_0x1d56a5)[_0x6709('0x1b')]();};}function respondWithResult(_0x4d5255,_0x3706e1){_0x3706e1=_0x3706e1||0xc8;return function(_0x4e4587){if(_0x4e4587){return _0x4d5255[_0x6709('0x1a')](_0x3706e1)['json'](_0x4e4587);}};}function respondWithFilteredResult(_0x41af1f,_0x4bc059){return function(_0x149233){if(_0x149233){var _0x28866a=typeof _0x4bc059[_0x6709('0x1c')]===_0x6709('0x1d')&&typeof _0x4bc059['limit']==='undefined';var _0x5c4f94=_0x149233[_0x6709('0x1e')];var _0x235a54=_0x28866a?0x0:_0x4bc059['offset'];var _0x9c1fd8=_0x28866a?_0x149233[_0x6709('0x1e')]:_0x4bc059[_0x6709('0x1c')]+_0x4bc059['limit'];var _0x13cf04;if(_0x9c1fd8>=_0x5c4f94){_0x9c1fd8=_0x5c4f94;_0x13cf04=0xc8;}else{_0x13cf04=0xce;}_0x41af1f[_0x6709('0x1a')](_0x13cf04);return _0x41af1f[_0x6709('0x1f')](_0x6709('0x20'),_0x235a54+'-'+_0x9c1fd8+'/'+_0x5c4f94)['json'](_0x149233);}return null;};}function patchUpdates(_0x3c4971){return function(_0x1edac3){try{jsonpatch[_0x6709('0x21')](_0x1edac3,_0x3c4971,!![]);}catch(_0x3cf882){return BPromise[_0x6709('0x22')](_0x3cf882);}return _0x1edac3[_0x6709('0x23')]();};}function saveUpdates(_0x45921e,_0x17763d){return function(_0x386224){if(_0x386224){return _0x386224[_0x6709('0x24')](_0x45921e)[_0x6709('0x25')](function(_0xa36371){return _0xa36371;});}return null;};}function removeEntity(_0x5cf48b,_0x29f25f){return function(_0x81138e){if(_0x81138e){return _0x81138e[_0x6709('0x26')]()['then'](function(){_0x5cf48b[_0x6709('0x1a')](0xcc)[_0x6709('0x1b')]();});}};}function handleEntityNotFound(_0x20a347,_0x44b465){return function(_0x588e00){if(!_0x588e00){_0x20a347[_0x6709('0x27')](0x194);}return _0x588e00;};}function handleError(_0x3076fe,_0x50f7d6){_0x50f7d6=_0x50f7d6||0x1f4;return function(_0x585073){logger[_0x6709('0x28')](_0x585073['stack']);if(_0x585073[_0x6709('0x29')]){delete _0x585073[_0x6709('0x29')];}_0x3076fe['status'](_0x50f7d6)[_0x6709('0x2a')](_0x585073);};}exports['index']=function(_0x46a325,_0x3cd555){var _0x5b6906={},_0x137137={},_0x4e6989={'count':0x0,'rows':[]};var _0xe066d8=_[_0x6709('0x2b')](db['CmHopperFinal'][_0x6709('0x2c')],function(_0x5deff5){return{'name':_0x5deff5[_0x6709('0x2d')],'type':_0x5deff5[_0x6709('0x2e')]['key']};});_0x137137['model']=_[_0x6709('0x2b')](_0xe066d8,_0x6709('0x29'));_0x137137[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x46a325[_0x6709('0x2f')]);_0x137137[_0x6709('0x31')]=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],_0x137137[_0x6709('0x2f')]);_0x5b6906['attributes']=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],qs[_0x6709('0x34')](_0x46a325[_0x6709('0x2f')]['fields']));_0x5b6906[_0x6709('0x35')]=_0x5b6906[_0x6709('0x35')][_0x6709('0x36')]?_0x5b6906[_0x6709('0x35')]:_0x137137['model'];if(!_0x46a325[_0x6709('0x2f')][_0x6709('0x37')]('nolimit')){_0x5b6906[_0x6709('0x38')]=qs[_0x6709('0x38')](_0x46a325['query'][_0x6709('0x38')]);_0x5b6906[_0x6709('0x1c')]=qs[_0x6709('0x1c')](_0x46a325[_0x6709('0x2f')][_0x6709('0x1c')]);}_0x5b6906[_0x6709('0x39')]=qs[_0x6709('0x3a')](_0x46a325['query'][_0x6709('0x3a')]);_0x5b6906[_0x6709('0x3b')]=qs['filters'](_[_0x6709('0x3c')](_0x46a325[_0x6709('0x2f')],_0x137137[_0x6709('0x31')]),_0xe066d8);if(_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]){_0x5b6906[_0x6709('0x3b')]=_['merge'](_0x5b6906[_0x6709('0x3b')],{'$or':_['map'](_0xe066d8,function(_0x31e05a){if(_0x31e05a[_0x6709('0x2e')]!==_0x6709('0x3e')){var _0x48492f={};_0x48492f[_0x31e05a[_0x6709('0x29')]]={'$like':'%'+_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]+'%'};return _0x48492f;}})});}_0x5b6906=_[_0x6709('0x3f')]({},_0x5b6906,_0x46a325[_0x6709('0x40')]);var _0x1030ee={'where':_0x5b6906[_0x6709('0x3b')]};return db['CmHopperFinal'][_0x6709('0x1e')](_0x1030ee)[_0x6709('0x25')](function(_0x50fbcd){_0x4e6989[_0x6709('0x1e')]=_0x50fbcd;if(_0x46a325[_0x6709('0x2f')][_0x6709('0x41')]){_0x5b6906[_0x6709('0x42')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x5b6906);})[_0x6709('0x25')](function(_0x3f0da1){_0x4e6989[_0x6709('0x43')]=_0x3f0da1;return _0x4e6989;})[_0x6709('0x25')](respondWithFilteredResult(_0x3cd555,_0x5b6906))['catch'](handleError(_0x3cd555,null));};exports['show']=function(_0x5af1fb,_0x3d4237){var _0x293577={'raw':!![],'where':{'id':_0x5af1fb[_0x6709('0x44')]['id']}},_0x54f74e={};_0x54f74e[_0x6709('0x33')]=_['keys'](db['CmHopperFinal'][_0x6709('0x2c')]);_0x54f74e[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x5af1fb[_0x6709('0x2f')]);_0x54f74e[_0x6709('0x31')]=_['intersection'](_0x54f74e[_0x6709('0x33')],_0x54f74e['query']);_0x293577[_0x6709('0x35')]=_[_0x6709('0x32')](_0x54f74e[_0x6709('0x33')],qs['fields'](_0x5af1fb[_0x6709('0x2f')]['fields']));_0x293577['attributes']=_0x293577[_0x6709('0x35')][_0x6709('0x36')]?_0x293577[_0x6709('0x35')]:_0x54f74e[_0x6709('0x33')];if(_0x5af1fb[_0x6709('0x2f')][_0x6709('0x41')]){_0x293577[_0x6709('0x42')]=[{'all':!![]}];}_0x293577=_[_0x6709('0x3f')]({},_0x293577,_0x5af1fb[_0x6709('0x40')]);return db[_0x6709('0x45')][_0x6709('0x46')](_0x293577)[_0x6709('0x25')](handleEntityNotFound(_0x3d4237,null))[_0x6709('0x25')](respondWithResult(_0x3d4237,null))[_0x6709('0x47')](handleError(_0x3d4237,null));};exports[_0x6709('0x48')]=function(_0x4f82a0,_0xfbb810){return db['CmHopperFinal']['describe']()[_0x6709('0x25')](respondWithResult(_0xfbb810,null))[_0x6709('0x47')](handleError(_0xfbb810,null));};exports[_0x6709('0x24')]=function(_0xe8dd1,_0x22363b){if(_0xe8dd1[_0x6709('0x49')][_0x6709('0x4a')]){delete _0xe8dd1[_0x6709('0x49')]['uniqueid'];}return db[_0x6709('0x45')][_0x6709('0x46')]({'where':{'uniqueid':_0xe8dd1[_0x6709('0x44')]['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x22363b,null))['then'](saveUpdates(_0xe8dd1[_0x6709('0x49')],null))['then'](respondWithResult(_0x22363b,null))[_0x6709('0x47')](handleError(_0x22363b,null));};exports[_0x6709('0x4b')]=function(_0x2a563b,_0xb257b5,_0x35c9cd){return db['CmHopperFinal'][_0x6709('0x4c')]({'raw':![],'where':{'VoiceQueueId':_0x2a563b[_0x6709('0x44')]['id']},'attributes':[[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db['sequelize']['literal'](_0x6709('0x4f')))),'noSuchContacts'],[db['sequelize']['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x51')))),_0x6709('0x52')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')]('`state`\x20=\x205,\x201,\x20null'))),_0x6709('0x53')],[db[_0x6709('0x4d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x54')))),_0x6709('0x55')],[db['sequelize']['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x56')))),_0x6709('0x57')],[db[_0x6709('0x4d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x6709('0x58')],[db[_0x6709('0x4d')]['fn']('COUNT',db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x59')))),'reCallContacts'],[db['sequelize']['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x5a')))),'answeringMachine']]})[_0x6709('0x25')](handleEntityNotFound(_0xb257b5,null))['then'](respondWithResult(_0xb257b5,null))['catch'](handleError(_0xb257b5,null));};exports[_0x6709('0x5b')]=function(_0x511bae,_0x124199,_0x5cf7c0){return db[_0x6709('0x45')][_0x6709('0x4c')]({'raw':![],'where':{'CampaignId':_0x511bae[_0x6709('0x44')]['id']},'attributes':[[db[_0x6709('0x4d')]['fn']('COUNT',db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x4f')))),_0x6709('0x5c')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x51')))),_0x6709('0x52')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')]('`state`\x20=\x205,\x201,\x20null'))),_0x6709('0x53')],[db[_0x6709('0x4d')]['fn']('COUNT',db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x54')))),_0x6709('0x55')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')]['literal'](_0x6709('0x56')))),_0x6709('0x57')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x5d')))),_0x6709('0x58')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0x6709('0x5e')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x5a')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x124199,null))[_0x6709('0x25')](respondWithResult(_0x124199,null))['catch'](handleError(_0x124199,null));};exports[_0x6709('0x5f')]=function(_0x47b7d9,_0x123183,_0x2f1faf){return db['VoiceQueue']['find']({'where':{'id':_0x47b7d9['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x123183,null))[_0x6709('0x25')](function(_0x24c584){var _0xbbfc50;if(_0x24c584){_0xbbfc50=squel[_0x6709('0x60')]()[_0x6709('0x61')](_0x6709('0x62'))[_0x6709('0x63')]([_0x6709('0x64'),_0x6709('0x65'),_0x6709('0x66'),_0x6709('0x67'),_0x6709('0x68'),'createdAt',_0x6709('0x69')],squel[_0x6709('0x6a')]()[_0x6709('0x6b')](_0x6709('0x6c'),'phone')['field'](_0x6709('0x6d'),'scheduledAt')['field'](_0x6709('0x6e'),_0x6709('0x66'))['field'](_0x6709('0x6f'),_0x6709('0x67'))[_0x6709('0x6b')](_0x6709('0x70'),_0x6709('0x68'))['field']('NOW()',_0x6709('0x71'))[_0x6709('0x6b')]('NOW()',_0x6709('0x69'))[_0x6709('0x72')](_0x6709('0x73'))['where'](_0x6709('0x74'),_0x47b7d9[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')]('state\x20=\x20?',_0x47b7d9['body'][_0x6709('0x76')][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x77'))[_0x6709('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()[_0x6709('0x6b')]('phone')[_0x6709('0x72')](_0x6709('0x62'))[_0x6709('0x3b')](_0x6709('0x74'),_0x47b7d9[_0x6709('0x44')]['id']['toString']()))[_0x6709('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()['field'](_0x6709('0x78'))[_0x6709('0x72')](_0x6709('0x73'))[_0x6709('0x3b')]('VoiceQueueId\x20=\x20?',_0x47b7d9[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x79')))[_0x6709('0x7a')](_0x6709('0x66')))['toString']();return db[_0x6709('0x4d')][_0x6709('0x2f')](_0xbbfc50);}return[];})[_0x6709('0x25')](respondWithResult(_0x123183,null))['catch'](handleError(_0x123183,null));};exports[_0x6709('0x7b')]=function(_0x124270,_0x57f14e,_0x4388a1){return db[_0x6709('0x7c')][_0x6709('0x46')]({'where':{'id':_0x124270['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x57f14e,null))[_0x6709('0x25')](function(_0x409723){var _0x5c8564;if(_0x409723){_0x5c8564=squel[_0x6709('0x60')]()[_0x6709('0x61')](_0x6709('0x62'))[_0x6709('0x63')]([_0x6709('0x64'),_0x6709('0x65'),'ContactId',_0x6709('0x67'),_0x6709('0x7d'),'createdAt',_0x6709('0x69')],squel[_0x6709('0x6a')]()[_0x6709('0x6b')]('ANY_VALUE(calleridnum)',_0x6709('0x64'))[_0x6709('0x6b')](_0x6709('0x6d'),_0x6709('0x65'))[_0x6709('0x6b')](_0x6709('0x6e'),_0x6709('0x66'))['field'](_0x6709('0x6f'),_0x6709('0x67'))[_0x6709('0x6b')](_0x6709('0x7e'),_0x6709('0x7d'))[_0x6709('0x6b')](_0x6709('0x6d'),'createdAt')[_0x6709('0x6b')]('NOW()',_0x6709('0x69'))[_0x6709('0x72')](_0x6709('0x73'))[_0x6709('0x3b')](_0x6709('0x7f'),_0x124270[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x80'),_0x124270[_0x6709('0x49')][_0x6709('0x76')][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x77'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()[_0x6709('0x6b')]('phone')[_0x6709('0x72')](_0x6709('0x62'))[_0x6709('0x3b')](_0x6709('0x7f'),_0x124270[_0x6709('0x44')]['id'][_0x6709('0x75')]()))[_0x6709('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()[_0x6709('0x6b')](_0x6709('0x78'))[_0x6709('0x72')]('cm_hopper_final')['where'](_0x6709('0x7f'),_0x124270[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x79')))[_0x6709('0x7a')](_0x6709('0x66')))[_0x6709('0x75')]();return db[_0x6709('0x4d')][_0x6709('0x2f')](_0x5c8564);}return[];})[_0x6709('0x25')](respondWithResult(_0x57f14e,null))[_0x6709('0x47')](handleError(_0x57f14e,null));};exports['checkContactHopper']=function(_0x4767b7,_0x5f7adc,_0x393934){return db['CmHopper'][_0x6709('0x81')]({'where':{'VoiceQueueId':_0x4767b7[_0x6709('0x49')]['VoiceQueueId'],'CampaignId':_0x4767b7[_0x6709('0x49')]['CampaignId'],'ContactId':_0x4767b7[_0x6709('0x49')][_0x6709('0x66')]}})[_0x6709('0x25')](handleEntityNotFound(_0x5f7adc,null))[_0x6709('0x25')](function(_0x45cd4e){if(_0x45cd4e){return _0x45cd4e;}return null;})[_0x6709('0x25')](respondWithResult(_0x5f7adc,null))[_0x6709('0x47')](handleError(_0x5f7adc,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 6839ae6..f8c7719 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 _0x5751=['../../config/environment','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x5a18c3,_0x5c6928){var _0x3e22e7=function(_0x1cc5a5){while(--_0x1cc5a5){_0x5a18c3['push'](_0x5a18c3['shift']());}};_0x3e22e7(++_0x5c6928);}(_0x5751,0x192));var _0x1575=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x5751[_0x556bb1];return _0x45455f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1575('0x0'))(_0x1575('0x1'));var moment=require('moment');var BPromise=require(_0x1575('0x2'));var rp=require(_0x1575('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1575('0x4'));var config=require(_0x1575('0x5'));var attributes=require(_0x1575('0x6'));module[_0x1575('0x7')]=function(_0xfeccc2,_0x474752){return _0xfeccc2[_0x1575('0x8')]('CmHopperFinal',attributes,{'tableName':_0x1575('0x9'),'paranoid':![],'indexes':[{'name':_0x1575('0xa'),'fields':[_0x1575('0xa')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf54e=['exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','api','request-promise','path','rimraf','./cmHopperFinal.attributes'];(function(_0x3a5e83,_0x598916){var _0x3a3297=function(_0x558bb1){while(--_0x558bb1){_0x3a5e83['push'](_0x3a5e83['shift']());}};_0x3a3297(++_0x598916);}(_0xf54e,0x155));var _0xef54=function(_0x284bc3,_0x22dffe){_0x284bc3=_0x284bc3-0x0;var _0x41ac81=_0xf54e[_0x284bc3];return _0x41ac81;};'use strict';var _=require(_0xef54('0x0'));var util=require('util');var logger=require(_0xef54('0x1'))(_0xef54('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xef54('0x3'));var fs=require('fs');var path=require(_0xef54('0x4'));var rimraf=require(_0xef54('0x5'));var config=require('../../config/environment');var attributes=require(_0xef54('0x6'));module[_0xef54('0x7')]=function(_0x16cb9f,_0x3daae7){return _0x16cb9f['define'](_0xef54('0x8'),attributes,{'tableName':_0xef54('0x9'),'paranoid':![],'indexes':[{'name':_0xef54('0xa'),'fields':[_0xef54('0xa')]},{'name':_0xef54('0xb'),'fields':[_0xef54('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 15f31a6..90bcb25 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x45cf0b,_0x3cb841){var _0x2963e2=function(_0x4e5cca){while(--_0x4e5cca){_0x45cf0b['push'](_0x45cf0b['shift']());}};_0x2963e2(++_0x3cb841);}(_0x7a54,0x106));var _0x47a5=function(_0x517623,_0x4a5441){_0x517623=_0x517623-0x0;var _0x59737f=_0x7a54[_0x517623];return _0x59737f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x5b8631,_0x4f5ecd){var _0xb473b1=function(_0x83d2ad){while(--_0x83d2ad){_0x5b8631['push'](_0x5b8631['shift']());}};_0xb473b1(++_0x4f5ecd);}(_0x7a54,0x106));var _0x47a5=function(_0x52cf30,_0x546685){_0x52cf30=_0x52cf30-0x0;var _0x5d406d=_0x7a54[_0x52cf30];return _0x5d406d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 7b98e1c..e58767f 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 _0x382a=['/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','index','/describe','isAuthenticated','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x382a,0x91));var _0xa382=function(_0x176865,_0x465e53){_0x176865=_0x176865-0x0;var _0x2bc1e1=_0x382a[_0x176865];return _0x2bc1e1;};'use strict';var multer=require(_0xa382('0x0'));var util=require(_0xa382('0x1'));var path=require(_0xa382('0x2'));var timeout=require(_0xa382('0x3'));var express=require(_0xa382('0x4'));var router=express['Router']();var fs_extra=require(_0xa382('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa382('0x6'));var config=require(_0xa382('0x7'));var controller=require(_0xa382('0x8'));router[_0xa382('0x9')]('/',auth['isAuthenticated'](),controller[_0xa382('0xa')]);router['get'](_0xa382('0xb'),auth[_0xa382('0xc')](),controller['describe']);router[_0xa382('0x9')](_0xa382('0xd'),auth[_0xa382('0xc')](),controller[_0xa382('0xe')]);router['get'](_0xa382('0xf'),auth['isAuthenticated'](),controller[_0xa382('0x10')]);router[_0xa382('0x9')](_0xa382('0x11'),auth[_0xa382('0xc')](),controller[_0xa382('0x12')]);router[_0xa382('0x13')](_0xa382('0x14'),auth['isAuthenticated'](),controller[_0xa382('0x15')]);router[_0xa382('0x13')](_0xa382('0x16'),auth[_0xa382('0xc')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xa382('0x13')]('/checkContactHopper',auth['isAuthenticated'](),controller[_0xa382('0x17')]);router[_0xa382('0x18')](_0xa382('0xd'),auth[_0xa382('0xc')](),controller[_0xa382('0x19')]);module[_0xa382('0x1a')]=router; \ No newline at end of file +var _0xb511=['/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post'];(function(_0x3ee911,_0x279ed5){var _0x1dd99f=function(_0x34083e){while(--_0x34083e){_0x3ee911['push'](_0x3ee911['shift']());}};_0x1dd99f(++_0x279ed5);}(_0xb511,0x165));var _0x1b51=function(_0x2a13ed,_0xde27ff){_0x2a13ed=_0x2a13ed-0x0;var _0xddc517=_0xb511[_0x2a13ed];return _0xddc517;};'use strict';var multer=require(_0x1b51('0x0'));var util=require(_0x1b51('0x1'));var path=require(_0x1b51('0x2'));var timeout=require('connect-timeout');var express=require(_0x1b51('0x3'));var router=express[_0x1b51('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1b51('0x5'));var interaction=require(_0x1b51('0x6'));var config=require(_0x1b51('0x7'));var controller=require('./cmHopperFinal.controller');router[_0x1b51('0x8')]('/',auth[_0x1b51('0x9')](),controller['index']);router[_0x1b51('0x8')](_0x1b51('0xa'),auth['isAuthenticated'](),controller[_0x1b51('0xb')]);router[_0x1b51('0x8')](_0x1b51('0xc'),auth[_0x1b51('0x9')](),controller[_0x1b51('0xd')]);router[_0x1b51('0x8')](_0x1b51('0xe'),auth[_0x1b51('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x1b51('0x8')](_0x1b51('0xf'),auth[_0x1b51('0x9')](),controller[_0x1b51('0x10')]);router[_0x1b51('0x11')](_0x1b51('0x12'),auth['isAuthenticated'](),controller[_0x1b51('0x13')]);router[_0x1b51('0x11')](_0x1b51('0x14'),auth[_0x1b51('0x9')](),controller[_0x1b51('0x15')]);router[_0x1b51('0x11')](_0x1b51('0x16'),auth['isAuthenticated'](),controller[_0x1b51('0x17')]);router['put']('/:id',auth[_0x1b51('0x9')](),controller[_0x1b51('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 1001994..061d089 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 _0xc58f=['exports','INTEGER','DATE','STRING','BOOLEAN','sequelize'];(function(_0x3c4047,_0x26c881){var _0xea78a2=function(_0x4f1147){while(--_0x4f1147){_0x3c4047['push'](_0x3c4047['shift']());}};_0xea78a2(++_0x26c881);}(_0xc58f,0xad));var _0xfc58=function(_0x13e8ac,_0x25c0c0){_0x13e8ac=_0x13e8ac-0x0;var _0xc77ea6=_0xc58f[_0x13e8ac];return _0xc77ea6;};'use strict';var Sequelize=require(_0xfc58('0x0'));module[_0xfc58('0x1')]={'state':{'type':Sequelize[_0xfc58('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xfc58('0x3')]},'countbusyretry':{'type':Sequelize[_0xfc58('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xfc58('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfc58('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xfc58('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xfc58('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xfc58('0x4')]},'originatecalleridname':{'type':Sequelize[_0xfc58('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xfc58('0x4')]},'starttime':{'type':Sequelize[_0xfc58('0x3')]},'responsetime':{'type':Sequelize[_0xfc58('0x3')]},'answertime':{'type':Sequelize[_0xfc58('0x3')]},'droptime':{'type':Sequelize[_0xfc58('0x3')]},'endtime':{'type':Sequelize[_0xfc58('0x3')]},'ringtime':{'type':Sequelize[_0xfc58('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xfc58('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xfc58('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xfc58('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xfc58('0x4')]},'campaign':{'type':Sequelize[_0xfc58('0x4')]},'campaigntype':{'type':Sequelize[_0xfc58('0x4')]},'membername':{'type':Sequelize[_0xfc58('0x4')]},'reason':{'type':Sequelize[_0xfc58('0x4')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xfc58('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xfc58('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xfc58('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xfc58('0x3')]},'edited':{'type':Sequelize[_0xfc58('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xfc58('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xfc58('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xfc58('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xfc58('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xfc58('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xfc58('0x4')]}}; \ No newline at end of file +var _0x9e84=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x30310b,_0x327c8c){var _0xea7e20=function(_0x4afdb8){while(--_0x4afdb8){_0x30310b['push'](_0x30310b['shift']());}};_0xea7e20(++_0x327c8c);}(_0x9e84,0x196));var _0x49e8=function(_0x16e57d,_0x2cb7ba){_0x16e57d=_0x16e57d-0x0;var _0x40239c=_0x9e84[_0x16e57d];return _0x40239c;};'use strict';var Sequelize=require(_0x49e8('0x0'));module[_0x49e8('0x1')]={'state':{'type':Sequelize[_0x49e8('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x49e8('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x49e8('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x49e8('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x49e8('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x49e8('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x49e8('0x3')]},'calleridnum':{'type':Sequelize[_0x49e8('0x3')]},'calleridname':{'type':Sequelize[_0x49e8('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x49e8('0x4')]},'answertime':{'type':Sequelize[_0x49e8('0x4')]},'droptime':{'type':Sequelize[_0x49e8('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x49e8('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x49e8('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x49e8('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x49e8('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x49e8('0x3')]},'reason':{'type':Sequelize[_0x49e8('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x49e8('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x49e8('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x49e8('0x4')]},'recallme':{'type':Sequelize[_0x49e8('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x49e8('0x4')]},'edited':{'type':Sequelize[_0x49e8('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x49e8('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x49e8('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x49e8('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x49e8('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 65bae71..2809385 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 _0x5c6d=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','end','error','name','send','map','CmHopperHistory','fieldName','type','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','catch','params','keys','rawAttributes','length','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x5260a1,_0x4b672f){var _0x1c2b9a=function(_0x5c8636){while(--_0x5c8636){_0x5260a1['push'](_0x5260a1['shift']());}};_0x1c2b9a(++_0x4b672f);}(_0x5c6d,0xc5));var _0xd5c6=function(_0x38123d,_0x567dab){_0x38123d=_0x38123d-0x0;var _0x2e27a3=_0x5c6d[_0x38123d];return _0x2e27a3;};'use strict';var emlformat=require(_0xd5c6('0x0'));var rimraf=require(_0xd5c6('0x1'));var zipdir=require(_0xd5c6('0x2'));var jsonpatch=require(_0xd5c6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd5c6('0x4'));var Mustache=require(_0xd5c6('0x5'));var util=require('util');var path=require(_0xd5c6('0x6'));var sox=require(_0xd5c6('0x7'));var csv=require(_0xd5c6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd5c6('0x9'));var _=require(_0xd5c6('0xa'));var squel=require(_0xd5c6('0xb'));var crypto=require(_0xd5c6('0xc'));var jsforce=require(_0xd5c6('0xd'));var deskjs=require(_0xd5c6('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd5c6('0xf'));var Papa=require(_0xd5c6('0x10'));var Redis=require(_0xd5c6('0x11'));var authService=require(_0xd5c6('0x12'));var qs=require(_0xd5c6('0x13'));var as=require(_0xd5c6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd5c6('0x15'))(_0xd5c6('0x16'));var utils=require(_0xd5c6('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd5c6('0x18'));var db=require(_0xd5c6('0x19'))['db'];function respondWithStatusCode(_0x3d8721,_0x5a954d){_0x5a954d=_0x5a954d||0xcc;return function(_0x2396e2){if(_0x2396e2){return _0x3d8721[_0xd5c6('0x1a')](_0x5a954d);}return _0x3d8721['status'](_0x5a954d)['end']();};}function respondWithResult(_0x385b45,_0x1b5602){_0x1b5602=_0x1b5602||0xc8;return function(_0x2574fa){if(_0x2574fa){return _0x385b45[_0xd5c6('0x1b')](_0x1b5602)[_0xd5c6('0x1c')](_0x2574fa);}};}function respondWithFilteredResult(_0x5fa5bd,_0x5af712){return function(_0x2ca933){if(_0x2ca933){var _0x1e9b7a=typeof _0x5af712['offset']===_0xd5c6('0x1d')&&typeof _0x5af712[_0xd5c6('0x1e')]===_0xd5c6('0x1d');var _0xd72cc9=_0x2ca933[_0xd5c6('0x1f')];var _0x1827d2=_0x1e9b7a?0x0:_0x5af712[_0xd5c6('0x20')];var _0x595943=_0x1e9b7a?_0x2ca933[_0xd5c6('0x1f')]:_0x5af712['offset']+_0x5af712[_0xd5c6('0x1e')];var _0x1a21a2;if(_0x595943>=_0xd72cc9){_0x595943=_0xd72cc9;_0x1a21a2=0xc8;}else{_0x1a21a2=0xce;}_0x5fa5bd[_0xd5c6('0x1b')](_0x1a21a2);return _0x5fa5bd[_0xd5c6('0x21')](_0xd5c6('0x22'),_0x1827d2+'-'+_0x595943+'/'+_0xd72cc9)['json'](_0x2ca933);}return null;};}function patchUpdates(_0x475da8){return function(_0x5a5e85){try{jsonpatch['apply'](_0x5a5e85,_0x475da8,!![]);}catch(_0x5b90d0){return BPromise[_0xd5c6('0x23')](_0x5b90d0);}return _0x5a5e85[_0xd5c6('0x24')]();};}function saveUpdates(_0x1fc79f,_0x2751d0){return function(_0x19dfa2){if(_0x19dfa2){return _0x19dfa2[_0xd5c6('0x25')](_0x1fc79f)[_0xd5c6('0x26')](function(_0x491749){return _0x491749;});}return null;};}function removeEntity(_0x662772,_0x29c8c7){return function(_0x13687e){if(_0x13687e){return _0x13687e[_0xd5c6('0x27')]()[_0xd5c6('0x26')](function(){_0x662772[_0xd5c6('0x1b')](0xcc)[_0xd5c6('0x28')]();});}};}function handleEntityNotFound(_0x27291a,_0x2e88dd){return function(_0x1ec950){if(!_0x1ec950){_0x27291a[_0xd5c6('0x1a')](0x194);}return _0x1ec950;};}function handleError(_0x4784e9,_0x3cb0a7){_0x3cb0a7=_0x3cb0a7||0x1f4;return function(_0x17833e){logger[_0xd5c6('0x29')](_0x17833e['stack']);if(_0x17833e[_0xd5c6('0x2a')]){delete _0x17833e[_0xd5c6('0x2a')];}_0x4784e9[_0xd5c6('0x1b')](_0x3cb0a7)[_0xd5c6('0x2b')](_0x17833e);};}exports['index']=function(_0x4f88c7,_0x13f1a0){var _0x344c47={},_0x392d94={},_0x484081={'count':0x0,'rows':[]};var _0x2f8683=_[_0xd5c6('0x2c')](db[_0xd5c6('0x2d')]['rawAttributes'],function(_0x1a30a9){return{'name':_0x1a30a9[_0xd5c6('0x2e')],'type':_0x1a30a9[_0xd5c6('0x2f')]['key']};});_0x392d94[_0xd5c6('0x30')]=_[_0xd5c6('0x2c')](_0x2f8683,_0xd5c6('0x2a'));_0x392d94[_0xd5c6('0x31')]=_['keys'](_0x4f88c7[_0xd5c6('0x31')]);_0x392d94['filters']=_[_0xd5c6('0x32')](_0x392d94[_0xd5c6('0x30')],_0x392d94[_0xd5c6('0x31')]);_0x344c47[_0xd5c6('0x33')]=_[_0xd5c6('0x32')](_0x392d94[_0xd5c6('0x30')],qs['fields'](_0x4f88c7[_0xd5c6('0x31')][_0xd5c6('0x34')]));_0x344c47[_0xd5c6('0x33')]=_0x344c47[_0xd5c6('0x33')]['length']?_0x344c47[_0xd5c6('0x33')]:_0x392d94[_0xd5c6('0x30')];if(!_0x4f88c7[_0xd5c6('0x31')][_0xd5c6('0x35')](_0xd5c6('0x36'))){_0x344c47[_0xd5c6('0x1e')]=qs[_0xd5c6('0x1e')](_0x4f88c7[_0xd5c6('0x31')]['limit']);_0x344c47[_0xd5c6('0x20')]=qs[_0xd5c6('0x20')](_0x4f88c7[_0xd5c6('0x31')][_0xd5c6('0x20')]);}_0x344c47[_0xd5c6('0x37')]=qs[_0xd5c6('0x38')](_0x4f88c7[_0xd5c6('0x31')][_0xd5c6('0x38')]);_0x344c47[_0xd5c6('0x39')]=qs['filters'](_[_0xd5c6('0x3a')](_0x4f88c7[_0xd5c6('0x31')],_0x392d94['filters']),_0x2f8683);if(_0x4f88c7[_0xd5c6('0x31')][_0xd5c6('0x3b')]){_0x344c47[_0xd5c6('0x39')]=_['merge'](_0x344c47[_0xd5c6('0x39')],{'$or':_['map'](_0x2f8683,function(_0x6141d8){if(_0x6141d8['type']!=='VIRTUAL'){var _0x2bdb49={};_0x2bdb49[_0x6141d8[_0xd5c6('0x2a')]]={'$like':'%'+_0x4f88c7[_0xd5c6('0x31')][_0xd5c6('0x3b')]+'%'};return _0x2bdb49;}})});}_0x344c47=_[_0xd5c6('0x3c')]({},_0x344c47,_0x4f88c7[_0xd5c6('0x3d')]);var _0x40aa5e={'where':_0x344c47[_0xd5c6('0x39')]};return db[_0xd5c6('0x2d')][_0xd5c6('0x1f')](_0x40aa5e)['then'](function(_0x87eac0){_0x484081[_0xd5c6('0x1f')]=_0x87eac0;if(_0x4f88c7[_0xd5c6('0x31')]['includeAll']){_0x344c47[_0xd5c6('0x3e')]=[{'all':!![]}];}return db[_0xd5c6('0x2d')]['findAll'](_0x344c47);})[_0xd5c6('0x26')](function(_0x46e755){_0x484081['rows']=_0x46e755;return _0x484081;})['then'](respondWithFilteredResult(_0x13f1a0,_0x344c47))[_0xd5c6('0x3f')](handleError(_0x13f1a0,null));};exports['show']=function(_0x928dc0,_0x5d165e){var _0x44cc2d={'raw':!![],'where':{'id':_0x928dc0[_0xd5c6('0x40')]['id']}},_0x7fee2={};_0x7fee2[_0xd5c6('0x30')]=_[_0xd5c6('0x41')](db[_0xd5c6('0x2d')][_0xd5c6('0x42')]);_0x7fee2['query']=_[_0xd5c6('0x41')](_0x928dc0[_0xd5c6('0x31')]);_0x7fee2['filters']=_[_0xd5c6('0x32')](_0x7fee2['model'],_0x7fee2[_0xd5c6('0x31')]);_0x44cc2d[_0xd5c6('0x33')]=_[_0xd5c6('0x32')](_0x7fee2['model'],qs[_0xd5c6('0x34')](_0x928dc0['query'][_0xd5c6('0x34')]));_0x44cc2d['attributes']=_0x44cc2d[_0xd5c6('0x33')][_0xd5c6('0x43')]?_0x44cc2d[_0xd5c6('0x33')]:_0x7fee2[_0xd5c6('0x30')];if(_0x928dc0[_0xd5c6('0x31')]['includeAll']){_0x44cc2d[_0xd5c6('0x3e')]=[{'all':!![]}];}_0x44cc2d=_[_0xd5c6('0x3c')]({},_0x44cc2d,_0x928dc0['options']);return db['CmHopperHistory'][_0xd5c6('0x44')](_0x44cc2d)[_0xd5c6('0x26')](handleEntityNotFound(_0x5d165e,null))[_0xd5c6('0x26')](respondWithResult(_0x5d165e,null))[_0xd5c6('0x3f')](handleError(_0x5d165e,null));};exports[_0xd5c6('0x45')]=function(_0x45e560,_0xbc1c11){return db['CmHopperHistory'][_0xd5c6('0x45')](_0x45e560[_0xd5c6('0x46')],{})[_0xd5c6('0x26')](respondWithResult(_0xbc1c11,0xc9))[_0xd5c6('0x3f')](handleError(_0xbc1c11,null));};exports[_0xd5c6('0x47')]=function(_0x2a4ac1,_0x297268){return db['CmHopperHistory'][_0xd5c6('0x47')]()[_0xd5c6('0x26')](respondWithResult(_0x297268,null))[_0xd5c6('0x3f')](handleError(_0x297268,null));};exports[_0xd5c6('0x25')]=function(_0x2952fd,_0x549d02){if(_0x2952fd['body'][_0xd5c6('0x48')]){delete _0x2952fd[_0xd5c6('0x46')][_0xd5c6('0x48')];}return db[_0xd5c6('0x2d')][_0xd5c6('0x44')]({'where':{'uniqueid':_0x2952fd[_0xd5c6('0x40')]['id']}})['then'](handleEntityNotFound(_0x549d02,null))[_0xd5c6('0x26')](saveUpdates(_0x2952fd[_0xd5c6('0x46')],null))[_0xd5c6('0x26')](respondWithResult(_0x549d02,null))[_0xd5c6('0x3f')](handleError(_0x549d02,null));}; \ No newline at end of file +var _0xd60c=['name','map','CmHopperHistory','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','show','params','create','body','describe','uniqueid','find','rimraf','zip-dir','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','api','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack'];(function(_0x193d08,_0x6ecee0){var _0x1be95c=function(_0x354a7e){while(--_0x354a7e){_0x193d08['push'](_0x193d08['shift']());}};_0x1be95c(++_0x6ecee0);}(_0xd60c,0xb3));var _0xcd60=function(_0x1b67fb,_0x3af3b0){_0x1b67fb=_0x1b67fb-0x0;var _0x57c9df=_0xd60c[_0x1b67fb];return _0x57c9df;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcd60('0x0'));var zipdir=require(_0xcd60('0x1'));var jsonpatch=require(_0xcd60('0x2'));var rp=require(_0xcd60('0x3'));var moment=require(_0xcd60('0x4'));var BPromise=require(_0xcd60('0x5'));var Mustache=require(_0xcd60('0x6'));var util=require(_0xcd60('0x7'));var path=require('path');var sox=require(_0xcd60('0x8'));var csv=require(_0xcd60('0x9'));var ejs=require(_0xcd60('0xa'));var fs=require('fs');var fs_extra=require(_0xcd60('0xb'));var _=require('lodash');var squel=require(_0xcd60('0xc'));var crypto=require(_0xcd60('0xd'));var jsforce=require(_0xcd60('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcd60('0x9'));var querystring=require(_0xcd60('0xf'));var Papa=require(_0xcd60('0x10'));var Redis=require(_0xcd60('0x11'));var authService=require(_0xcd60('0x12'));var qs=require(_0xcd60('0x13'));var as=require(_0xcd60('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcd60('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcd60('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x459ee9,_0x5775c2){_0x5775c2=_0x5775c2||0xcc;return function(_0x565576){if(_0x565576){return _0x459ee9[_0xcd60('0x17')](_0x5775c2);}return _0x459ee9['status'](_0x5775c2)[_0xcd60('0x18')]();};}function respondWithResult(_0x11133a,_0x8a48c1){_0x8a48c1=_0x8a48c1||0xc8;return function(_0x281c4c){if(_0x281c4c){return _0x11133a[_0xcd60('0x19')](_0x8a48c1)[_0xcd60('0x1a')](_0x281c4c);}};}function respondWithFilteredResult(_0x3fef3c,_0x12e274){return function(_0x2a4889){if(_0x2a4889){var _0x153caa=typeof _0x12e274[_0xcd60('0x1b')]===_0xcd60('0x1c')&&typeof _0x12e274['limit']===_0xcd60('0x1c');var _0x390eab=_0x2a4889[_0xcd60('0x1d')];var _0x2df0cb=_0x153caa?0x0:_0x12e274[_0xcd60('0x1b')];var _0x3399f7=_0x153caa?_0x2a4889[_0xcd60('0x1d')]:_0x12e274[_0xcd60('0x1b')]+_0x12e274[_0xcd60('0x1e')];var _0x1e468e;if(_0x3399f7>=_0x390eab){_0x3399f7=_0x390eab;_0x1e468e=0xc8;}else{_0x1e468e=0xce;}_0x3fef3c[_0xcd60('0x19')](_0x1e468e);return _0x3fef3c[_0xcd60('0x1f')](_0xcd60('0x20'),_0x2df0cb+'-'+_0x3399f7+'/'+_0x390eab)[_0xcd60('0x1a')](_0x2a4889);}return null;};}function patchUpdates(_0x2a4479){return function(_0x143bea){try{jsonpatch[_0xcd60('0x21')](_0x143bea,_0x2a4479,!![]);}catch(_0x4f3702){return BPromise['reject'](_0x4f3702);}return _0x143bea[_0xcd60('0x22')]();};}function saveUpdates(_0x561bd4,_0x3f2c7f){return function(_0x11bc3f){if(_0x11bc3f){return _0x11bc3f[_0xcd60('0x23')](_0x561bd4)[_0xcd60('0x24')](function(_0x2cab8c){return _0x2cab8c;});}return null;};}function removeEntity(_0x4ff95b,_0x4063bb){return function(_0x180fd9){if(_0x180fd9){return _0x180fd9[_0xcd60('0x25')]()[_0xcd60('0x24')](function(){_0x4ff95b[_0xcd60('0x19')](0xcc)[_0xcd60('0x18')]();});}};}function handleEntityNotFound(_0x375344,_0x2697fd){return function(_0x38875a){if(!_0x38875a){_0x375344['sendStatus'](0x194);}return _0x38875a;};}function handleError(_0x2af216,_0x368c1f){_0x368c1f=_0x368c1f||0x1f4;return function(_0x42c50d){logger[_0xcd60('0x26')](_0x42c50d[_0xcd60('0x27')]);if(_0x42c50d['name']){delete _0x42c50d[_0xcd60('0x28')];}_0x2af216[_0xcd60('0x19')](_0x368c1f)['send'](_0x42c50d);};}exports['index']=function(_0x591bbc,_0x219ece){var _0x4163f4={},_0x461edc={},_0x400ca9={'count':0x0,'rows':[]};var _0x1f910e=_[_0xcd60('0x29')](db[_0xcd60('0x2a')][_0xcd60('0x2b')],function(_0x565fa9){return{'name':_0x565fa9[_0xcd60('0x2c')],'type':_0x565fa9['type'][_0xcd60('0x2d')]};});_0x461edc[_0xcd60('0x2e')]=_[_0xcd60('0x29')](_0x1f910e,_0xcd60('0x28'));_0x461edc[_0xcd60('0x2f')]=_[_0xcd60('0x30')](_0x591bbc[_0xcd60('0x2f')]);_0x461edc[_0xcd60('0x31')]=_['intersection'](_0x461edc[_0xcd60('0x2e')],_0x461edc[_0xcd60('0x2f')]);_0x4163f4[_0xcd60('0x32')]=_[_0xcd60('0x33')](_0x461edc[_0xcd60('0x2e')],qs[_0xcd60('0x34')](_0x591bbc[_0xcd60('0x2f')][_0xcd60('0x34')]));_0x4163f4[_0xcd60('0x32')]=_0x4163f4[_0xcd60('0x32')][_0xcd60('0x35')]?_0x4163f4[_0xcd60('0x32')]:_0x461edc['model'];if(!_0x591bbc['query'][_0xcd60('0x36')](_0xcd60('0x37'))){_0x4163f4[_0xcd60('0x1e')]=qs[_0xcd60('0x1e')](_0x591bbc[_0xcd60('0x2f')][_0xcd60('0x1e')]);_0x4163f4[_0xcd60('0x1b')]=qs['offset'](_0x591bbc[_0xcd60('0x2f')][_0xcd60('0x1b')]);}_0x4163f4['order']=qs[_0xcd60('0x38')](_0x591bbc[_0xcd60('0x2f')]['sort']);_0x4163f4['where']=qs[_0xcd60('0x31')](_[_0xcd60('0x39')](_0x591bbc[_0xcd60('0x2f')],_0x461edc[_0xcd60('0x31')]),_0x1f910e);if(_0x591bbc[_0xcd60('0x2f')][_0xcd60('0x3a')]){_0x4163f4[_0xcd60('0x3b')]=_[_0xcd60('0x3c')](_0x4163f4[_0xcd60('0x3b')],{'$or':_[_0xcd60('0x29')](_0x1f910e,function(_0x43d6d9){if(_0x43d6d9['type']!=='VIRTUAL'){var _0x55b30e={};_0x55b30e[_0x43d6d9[_0xcd60('0x28')]]={'$like':'%'+_0x591bbc[_0xcd60('0x2f')][_0xcd60('0x3a')]+'%'};return _0x55b30e;}})});}_0x4163f4=_[_0xcd60('0x3c')]({},_0x4163f4,_0x591bbc[_0xcd60('0x3d')]);var _0x45a78c={'where':_0x4163f4['where']};return db['CmHopperHistory']['count'](_0x45a78c)[_0xcd60('0x24')](function(_0x1e610c){_0x400ca9[_0xcd60('0x1d')]=_0x1e610c;if(_0x591bbc[_0xcd60('0x2f')][_0xcd60('0x3e')]){_0x4163f4[_0xcd60('0x3f')]=[{'all':!![]}];}return db[_0xcd60('0x2a')][_0xcd60('0x40')](_0x4163f4);})[_0xcd60('0x24')](function(_0xa728af){_0x400ca9['rows']=_0xa728af;return _0x400ca9;})[_0xcd60('0x24')](respondWithFilteredResult(_0x219ece,_0x4163f4))[_0xcd60('0x41')](handleError(_0x219ece,null));};exports[_0xcd60('0x42')]=function(_0x49af50,_0x49dc42){var _0x113346={'raw':!![],'where':{'id':_0x49af50[_0xcd60('0x43')]['id']}},_0x1850b6={};_0x1850b6['model']=_['keys'](db['CmHopperHistory'][_0xcd60('0x2b')]);_0x1850b6['query']=_[_0xcd60('0x30')](_0x49af50[_0xcd60('0x2f')]);_0x1850b6['filters']=_[_0xcd60('0x33')](_0x1850b6[_0xcd60('0x2e')],_0x1850b6[_0xcd60('0x2f')]);_0x113346['attributes']=_[_0xcd60('0x33')](_0x1850b6[_0xcd60('0x2e')],qs[_0xcd60('0x34')](_0x49af50[_0xcd60('0x2f')]['fields']));_0x113346['attributes']=_0x113346[_0xcd60('0x32')][_0xcd60('0x35')]?_0x113346[_0xcd60('0x32')]:_0x1850b6[_0xcd60('0x2e')];if(_0x49af50[_0xcd60('0x2f')][_0xcd60('0x3e')]){_0x113346[_0xcd60('0x3f')]=[{'all':!![]}];}_0x113346=_[_0xcd60('0x3c')]({},_0x113346,_0x49af50[_0xcd60('0x3d')]);return db[_0xcd60('0x2a')]['find'](_0x113346)['then'](handleEntityNotFound(_0x49dc42,null))['then'](respondWithResult(_0x49dc42,null))[_0xcd60('0x41')](handleError(_0x49dc42,null));};exports[_0xcd60('0x44')]=function(_0x12e9b5,_0x4888e4){return db[_0xcd60('0x2a')]['create'](_0x12e9b5[_0xcd60('0x45')],{})[_0xcd60('0x24')](respondWithResult(_0x4888e4,0xc9))[_0xcd60('0x41')](handleError(_0x4888e4,null));};exports[_0xcd60('0x46')]=function(_0x59d845,_0x5a665b){return db[_0xcd60('0x2a')][_0xcd60('0x46')]()[_0xcd60('0x24')](respondWithResult(_0x5a665b,null))[_0xcd60('0x41')](handleError(_0x5a665b,null));};exports[_0xcd60('0x23')]=function(_0x3bdd7d,_0xd14ed8){if(_0x3bdd7d[_0xcd60('0x45')][_0xcd60('0x47')]){delete _0x3bdd7d[_0xcd60('0x45')][_0xcd60('0x47')];}return db[_0xcd60('0x2a')][_0xcd60('0x48')]({'where':{'uniqueid':_0x3bdd7d[_0xcd60('0x43')]['id']}})[_0xcd60('0x24')](handleEntityNotFound(_0xd14ed8,null))[_0xcd60('0x24')](saveUpdates(_0x3bdd7d['body'],null))[_0xcd60('0x24')](respondWithResult(_0xd14ed8,null))['catch'](handleError(_0xd14ed8,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 5ec7731..3d287fa 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 _0x9c9b=['bluebird','path','rimraf','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','util','../../config/logger','api','moment'];(function(_0x253d1c,_0x30be97){var _0x16b3c2=function(_0x1ec045){while(--_0x1ec045){_0x253d1c['push'](_0x253d1c['shift']());}};_0x16b3c2(++_0x30be97);}(_0x9c9b,0x194));var _0xb9c9=function(_0x33db67,_0x1e0188){_0x33db67=_0x33db67-0x0;var _0x3e6842=_0x9c9b[_0x33db67];return _0x3e6842;};'use strict';var _=require('lodash');var util=require(_0xb9c9('0x0'));var logger=require(_0xb9c9('0x1'))(_0xb9c9('0x2'));var moment=require(_0xb9c9('0x3'));var BPromise=require(_0xb9c9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9c9('0x5'));var rimraf=require(_0xb9c9('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0xfe4cb4,_0x26bf07){return _0xfe4cb4[_0xb9c9('0x7')](_0xb9c9('0x8'),attributes,{'tableName':_0xb9c9('0x9'),'paranoid':![],'indexes':[{'name':_0xb9c9('0xa'),'fields':[_0xb9c9('0xa')]},{'name':_0xb9c9('0xb'),'fields':[_0xb9c9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf55c=['moment','bluebird','request-promise','path','rimraf','./cmHopperHistory.attributes','exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','api'];(function(_0x31ca96,_0x552a76){var _0x42ea4f=function(_0x2a9cec){while(--_0x2a9cec){_0x31ca96['push'](_0x31ca96['shift']());}};_0x42ea4f(++_0x552a76);}(_0xf55c,0x1e7));var _0xcf55=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xf55c[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0xcf55('0x0'));var util=require('util');var logger=require(_0xcf55('0x1'))(_0xcf55('0x2'));var moment=require(_0xcf55('0x3'));var BPromise=require(_0xcf55('0x4'));var rp=require(_0xcf55('0x5'));var fs=require('fs');var path=require(_0xcf55('0x6'));var rimraf=require(_0xcf55('0x7'));var config=require('../../config/environment');var attributes=require(_0xcf55('0x8'));module[_0xcf55('0x9')]=function(_0x14574c,_0x3a6de7){return _0x14574c['define'](_0xcf55('0xa'),attributes,{'tableName':_0xcf55('0xb'),'paranoid':![],'indexes':[{'name':_0xcf55('0xc'),'fields':[_0xcf55('0xc')]},{'name':'uniqueid','fields':[_0xcf55('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index c28cd7d..955dae2 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 _0x8b29=['http','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','CreateCmHopperHistory','create','body','options','findAll','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','raw','name','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`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','campaign','GetVoiceQueueHopperHistory','catch','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x379f2b,_0x26b993){var _0x1f9662=function(_0x1c48b5){while(--_0x1c48b5){_0x379f2b['push'](_0x379f2b['shift']());}};_0x1f9662(++_0x26b993);}(_0x8b29,0xbe));var _0x98b2=function(_0x45bff7,_0x32bd06){_0x45bff7=_0x45bff7-0x0;var _0x3e21e8=_0x8b29[_0x45bff7];return _0x3e21e8;};'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')]('CmHopperHistory,\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);});});}exports[_0x98b2('0x14')]=function(_0x4b9f2c){var _0x1cd8c6=this;return new Promise(function(_0x588837,_0x989082){return db['CmHopperHistory'][_0x98b2('0x15')](_0x4b9f2c[_0x98b2('0x16')],{'raw':_0x4b9f2c[_0x98b2('0x17')]?_0x4b9f2c[_0x98b2('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x98b2('0xa')](function(_0x242cbd){logger['info']('CreateCmHopperHistory',_0x4b9f2c);logger[_0x98b2('0xd')](_0x98b2('0x14'),_0x4b9f2c,JSON['stringify'](_0x242cbd));_0x588837(_0x242cbd);})['catch'](function(_0x3796c0){logger[_0x98b2('0x10')]('CreateCmHopperHistory',_0x3796c0[_0x98b2('0x12')],_0x4b9f2c);_0x989082(_0x1cd8c6[_0x98b2('0x10')](0x1f4,_0x3796c0[_0x98b2('0x12')]));});});};exports['AvgHandleTime']=function(_0x2a5587){var _0x58be0e=this;return new Promise(function(_0x1d6e33,_0x4c34f1){return db['CmHopperHistory'][_0x98b2('0x18')]({'raw':_0x2a5587[_0x98b2('0x17')]?_0x2a5587[_0x98b2('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2a5587['options']?_0x2a5587['options'][_0x98b2('0x19')]||null:null,'attributes':[[db[_0x98b2('0x1a')]['fn']('COUNT',db[_0x98b2('0x1a')][_0x98b2('0x1b')]('id')),_0x98b2('0x1c')],[db['sequelize']['fn'](_0x98b2('0x1d'),db[_0x98b2('0x1a')]['fn']('IF',db[_0x98b2('0x1a')][_0x98b2('0x1e')](_0x98b2('0x1f')))),'predictiveIntervalAnsweredCalls'],[db[_0x98b2('0x1a')]['fn']('COUNT',db[_0x98b2('0x1a')]['fn']('IF',db[_0x98b2('0x1a')]['literal'](_0x98b2('0x20')))),_0x98b2('0x21')],[db['sequelize']['fn'](_0x98b2('0x1d'),db[_0x98b2('0x1a')]['fn']('IF',db[_0x98b2('0x1a')][_0x98b2('0x1e')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x98b2('0x1a')]['fn'](_0x98b2('0x22'),db[_0x98b2('0x1a')]['fn']('IF',db[_0x98b2('0x1a')][_0x98b2('0x1e')](_0x98b2('0x23')))),'predictiveIntervalAvgHoldtime'],[db[_0x98b2('0x1a')]['fn'](_0x98b2('0x22'),db[_0x98b2('0x1a')]['fn']('IF',db[_0x98b2('0x1a')][_0x98b2('0x1e')](_0x98b2('0x24')))),_0x98b2('0x25')]]})[_0x98b2('0xa')](function(_0x273037){logger[_0x98b2('0x13')](_0x98b2('0x26'),_0x2a5587);logger[_0x98b2('0xd')](_0x98b2('0x26'),_0x2a5587,JSON['stringify'](_0x273037));_0x1d6e33(_0x273037);})['catch'](function(_0x3ef9fb){logger[_0x98b2('0x10')](_0x98b2('0x26'),_0x3ef9fb[_0x98b2('0x12')],_0x2a5587);_0x4c34f1(_0x58be0e[_0x98b2('0x10')](0x1f4,_0x3ef9fb[_0x98b2('0x12')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x47d969){var _0x364d23=this;return new Promise(function(_0x30e09a,_0x35d085){return db['CmHopperHistory'][_0x98b2('0x18')]({'raw':_0x47d969[_0x98b2('0x17')]?_0x47d969[_0x98b2('0x17')][_0x98b2('0x27')]===undefined?!![]:![]:!![],'where':_0x47d969[_0x98b2('0x17')]?_0x47d969[_0x98b2('0x17')][_0x98b2('0x19')]||null:null,'attributes':[['campaign',_0x98b2('0x28')],[db['sequelize']['fn'](_0x98b2('0x1d'),db[_0x98b2('0x1a')]['fn']('IF',db[_0x98b2('0x1a')][_0x98b2('0x1e')]('`state`\x20=\x200,\x201,\x20null'))),'outboundNoSuchCallsDay'],[db[_0x98b2('0x1a')]['fn'](_0x98b2('0x1d'),db[_0x98b2('0x1a')]['fn']('IF',db['sequelize'][_0x98b2('0x1e')](_0x98b2('0x29')))),_0x98b2('0x2a')],[db[_0x98b2('0x1a')]['fn'](_0x98b2('0x1d'),db[_0x98b2('0x1a')]['fn']('IF',db['sequelize'][_0x98b2('0x1e')](_0x98b2('0x1f')))),_0x98b2('0x2b')],[db['sequelize']['fn'](_0x98b2('0x1d'),db[_0x98b2('0x1a')]['fn']('IF',db[_0x98b2('0x1a')][_0x98b2('0x1e')](_0x98b2('0x2c')))),_0x98b2('0x2d')],[db['sequelize']['fn'](_0x98b2('0x1d'),db['sequelize']['fn']('IF',db[_0x98b2('0x1a')][_0x98b2('0x1e')](_0x98b2('0x2e')))),_0x98b2('0x2f')],[db[_0x98b2('0x1a')]['fn'](_0x98b2('0x1d'),db[_0x98b2('0x1a')]['fn']('IF',db[_0x98b2('0x1a')][_0x98b2('0x1e')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x98b2('0x30')],[db['sequelize']['fn'](_0x98b2('0x1d'),db[_0x98b2('0x1a')]['fn']('IF',db[_0x98b2('0x1a')][_0x98b2('0x1e')](_0x98b2('0x31')))),_0x98b2('0x32')],[db['sequelize']['fn'](_0x98b2('0x1d'),db[_0x98b2('0x1a')]['fn']('IF',db[_0x98b2('0x1a')][_0x98b2('0x1e')](_0x98b2('0x33')))),'outboundUnknownCallsDay'],[db['sequelize']['fn'](_0x98b2('0x1d'),db[_0x98b2('0x1a')]['fn']('IF',db[_0x98b2('0x1a')][_0x98b2('0x1e')]('`state`\x20=\x2013,\x201,\x20null'))),'outboundBlacklistCallsDay'],[db['sequelize']['fn'](_0x98b2('0x1d'),db[_0x98b2('0x1a')]['fn']('IF',db[_0x98b2('0x1a')][_0x98b2('0x1e')](_0x98b2('0x34')))),_0x98b2('0x35')],[db[_0x98b2('0x1a')]['fn'](_0x98b2('0x1d'),db[_0x98b2('0x1a')]['fn']('IF',db['sequelize'][_0x98b2('0x1e')]('`state`\x20=\x2018,\x201,\x20null'))),_0x98b2('0x36')],[db[_0x98b2('0x1a')]['fn'](_0x98b2('0x1d'),db[_0x98b2('0x1a')]['fn']('IF',db['sequelize'][_0x98b2('0x1e')](_0x98b2('0x37')))),_0x98b2('0x38')],[db[_0x98b2('0x1a')]['fn'](_0x98b2('0x1d'),db['sequelize']['fn']('IF',db[_0x98b2('0x1a')][_0x98b2('0x1e')](_0x98b2('0x39')))),_0x98b2('0x36')],[db[_0x98b2('0x1a')]['fn'](_0x98b2('0x1d'),db[_0x98b2('0x1a')]['fn']('IF',db[_0x98b2('0x1a')][_0x98b2('0x1e')](_0x98b2('0x3a')))),_0x98b2('0x3b')]],'group':[_0x98b2('0x3c')]})['then'](function(_0x3b083a){logger[_0x98b2('0x13')]('GetVoiceQueueHopperHistory',_0x47d969);logger['debug'](_0x98b2('0x3d'),_0x47d969,JSON['stringify'](_0x3b083a));_0x30e09a(_0x3b083a);})[_0x98b2('0x3e')](function(_0x1cad33){logger[_0x98b2('0x10')](_0x98b2('0x3d'),_0x1cad33[_0x98b2('0x12')],_0x47d969);_0x35d085(_0x364d23[_0x98b2('0x10')](0x1f4,_0x1cad33['message']));});});};exports[_0x98b2('0x3f')]=function(_0x54ab16){var _0x4d74e9=this;return new Promise(function(_0xf9da91,_0x27da73){return db['CmHopperHistory'][_0x98b2('0x18')]({'raw':_0x54ab16[_0x98b2('0x17')]?_0x54ab16['options'][_0x98b2('0x27')]===undefined?!![]:![]:!![],'where':_0x54ab16[_0x98b2('0x17')]?_0x54ab16[_0x98b2('0x17')][_0x98b2('0x19')]||null:null,'attributes':[['campaign','name'],[db[_0x98b2('0x1a')]['fn'](_0x98b2('0x1d'),db[_0x98b2('0x1a')][_0x98b2('0x1b')]('id')),_0x98b2('0x40')],[db['sequelize']['fn']('COUNT',db[_0x98b2('0x1a')]['fn']('IF',db['sequelize'][_0x98b2('0x1e')](_0x98b2('0x1f')))),_0x98b2('0x41')]],'group':[_0x98b2('0x3c')]})[_0x98b2('0xa')](function(_0x2e7bab){logger['info'](_0x98b2('0x3f'),_0x54ab16);logger[_0x98b2('0xd')](_0x98b2('0x3f'),_0x54ab16,JSON[_0x98b2('0xf')](_0x2e7bab));_0xf9da91(_0x2e7bab);})[_0x98b2('0x3e')](function(_0x9dc387){logger['error']('GetCampaignHopperHistory',_0x9dc387[_0x98b2('0x12')],_0x54ab16);_0x27da73(_0x4d74e9[_0x98b2('0x10')](0x1f4,_0x9dc387[_0x98b2('0x12')]));});});}; \ No newline at end of file +var _0x6f7a=['outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','campaign','GetCampaignHopperHistory','ivrTotalCallsDays','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','request\x20sent','result','catch','CmHopperHistory','body','options','raw','CreateCmHopperHistory','AvgHandleTime','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null'];(function(_0x36103e,_0x73f0c4){var _0x4a5e7c=function(_0x51608e){while(--_0x51608e){_0x36103e['push'](_0x36103e['shift']());}};_0x4a5e7c(++_0x73f0c4);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x399976,_0x3e841b){_0x399976=_0x399976-0x0;var _0x24c43c=_0x6f7a[_0x399976];return _0x24c43c;};'use strict';var _=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var moment=require(_0xa6f7('0x2'));var BPromise=require(_0xa6f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa6f7('0x4'));var db=require(_0xa6f7('0x5'))['db'];var utils=require(_0xa6f7('0x6'));var logger=require(_0xa6f7('0x7'))(_0xa6f7('0x8'));var config=require(_0xa6f7('0x9'));var jayson=require(_0xa6f7('0xa'));var client=jayson[_0xa6f7('0xb')][_0xa6f7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x335aaa,_0x1a06d1,_0x481a8c){return new BPromise(function(_0x4b4f9e,_0x30f2a7){return client[_0xa6f7('0xd')](_0x335aaa,_0x481a8c)[_0xa6f7('0xe')](function(_0x362404){logger[_0xa6f7('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x1a06d1,'request\x20sent');logger[_0xa6f7('0x10')](_0xa6f7('0x11'),_0x1a06d1,'request\x20sent',JSON[_0xa6f7('0x12')](_0x362404));if(_0x362404['error']){if(_0x362404[_0xa6f7('0x13')][_0xa6f7('0x14')]===0x1f4){logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x362404['error'][_0xa6f7('0x16')]);return _0x30f2a7(_0x362404['error'][_0xa6f7('0x16')]);}logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x362404['error'][_0xa6f7('0x16')]);return _0x4b4f9e(_0x362404['error'][_0xa6f7('0x16')]);}else{logger['info'](_0xa6f7('0x15'),_0x1a06d1,_0xa6f7('0x17'));_0x4b4f9e(_0x362404[_0xa6f7('0x18')]['message']);}})[_0xa6f7('0x19')](function(_0x22635e){logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x22635e);_0x30f2a7(_0x22635e);});});}exports['CreateCmHopperHistory']=function(_0x4a8827){var _0xba7755=this;return new Promise(function(_0x5298ba,_0x378967){return db[_0xa6f7('0x1a')]['create'](_0x4a8827[_0xa6f7('0x1b')],{'raw':_0x4a8827[_0xa6f7('0x1c')]?_0x4a8827[_0xa6f7('0x1c')][_0xa6f7('0x1d')]===undefined?!![]:![]:!![]})[_0xa6f7('0xe')](function(_0x1aa8dc){logger['info'](_0xa6f7('0x1e'),_0x4a8827);logger[_0xa6f7('0x10')]('CreateCmHopperHistory',_0x4a8827,JSON['stringify'](_0x1aa8dc));_0x5298ba(_0x1aa8dc);})['catch'](function(_0x1de6c9){logger[_0xa6f7('0x13')]('CreateCmHopperHistory',_0x1de6c9['message'],_0x4a8827);_0x378967(_0xba7755['error'](0x1f4,_0x1de6c9[_0xa6f7('0x16')]));});});};exports[_0xa6f7('0x1f')]=function(_0x28263e){var _0x5baaa9=this;return new Promise(function(_0x484874,_0x2f4907){return db['CmHopperHistory']['findAll']({'raw':_0x28263e[_0xa6f7('0x1c')]?_0x28263e['options'][_0xa6f7('0x1d')]===undefined?!![]:![]:!![],'where':_0x28263e[_0xa6f7('0x1c')]?_0x28263e[_0xa6f7('0x1c')][_0xa6f7('0x20')]||null:null,'attributes':[[db[_0xa6f7('0x21')]['fn']('COUNT',db['sequelize'][_0xa6f7('0x22')]('id')),_0xa6f7('0x23')],[db['sequelize']['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')](_0xa6f7('0x26')))),_0xa6f7('0x27')],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')](_0xa6f7('0x28')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x24'),db['sequelize']['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x29'),db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),'predictiveIntervalAvgHoldtime'],[db[_0xa6f7('0x21')]['fn']('AVG',db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')](_0xa6f7('0x2a')))),_0xa6f7('0x2b')]]})[_0xa6f7('0xe')](function(_0x4d2d38){logger[_0xa6f7('0xf')](_0xa6f7('0x1f'),_0x28263e);logger[_0xa6f7('0x10')]('AvgHandleTime',_0x28263e,JSON[_0xa6f7('0x12')](_0x4d2d38));_0x484874(_0x4d2d38);})['catch'](function(_0x1170c4){logger[_0xa6f7('0x13')](_0xa6f7('0x1f'),_0x1170c4['message'],_0x28263e);_0x2f4907(_0x5baaa9[_0xa6f7('0x13')](0x1f4,_0x1170c4[_0xa6f7('0x16')]));});});};exports[_0xa6f7('0x2c')]=function(_0x37b833){var _0x14444c=this;return new Promise(function(_0x28490e,_0x4a28a7){return db[_0xa6f7('0x1a')][_0xa6f7('0x2d')]({'raw':_0x37b833[_0xa6f7('0x1c')]?_0x37b833[_0xa6f7('0x1c')][_0xa6f7('0x1d')]===undefined?!![]:![]:!![],'where':_0x37b833[_0xa6f7('0x1c')]?_0x37b833[_0xa6f7('0x1c')][_0xa6f7('0x20')]||null:null,'attributes':[['campaign',_0xa6f7('0x2e')],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x24'),db['sequelize']['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')]('`state`\x20=\x200,\x201,\x20null'))),_0xa6f7('0x2f')],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')]['literal'](_0xa6f7('0x30')))),_0xa6f7('0x31')],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')](_0xa6f7('0x26')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')](_0xa6f7('0x32')))),_0xa6f7('0x33')],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')]['literal'](_0xa6f7('0x34')))),_0xa6f7('0x35')],[db['sequelize']['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xa6f7('0x36')],[db['sequelize']['fn']('COUNT',db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')](_0xa6f7('0x37')))),_0xa6f7('0x38')],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x24'),db['sequelize']['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')]('`state`\x20=\x2012,\x201,\x20null'))),_0xa6f7('0x39')],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x24'),db['sequelize']['fn']('IF',db[_0xa6f7('0x21')]['literal'](_0xa6f7('0x3a')))),_0xa6f7('0x3b')],[db[_0xa6f7('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa6f7('0x21')]['literal'](_0xa6f7('0x3c')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')](_0xa6f7('0x3d')))),_0xa6f7('0x3e')],[db['sequelize']['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db['sequelize'][_0xa6f7('0x25')]('`state`\x20=\x2016,\x201,\x20null'))),_0xa6f7('0x3f')],[db['sequelize']['fn']('COUNT',db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')](_0xa6f7('0x40')))),_0xa6f7('0x3e')],[db['sequelize']['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db['sequelize'][_0xa6f7('0x25')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xa6f7('0x41')]],'group':[_0xa6f7('0x42')]})[_0xa6f7('0xe')](function(_0x55369a){logger[_0xa6f7('0xf')]('GetVoiceQueueHopperHistory',_0x37b833);logger[_0xa6f7('0x10')](_0xa6f7('0x2c'),_0x37b833,JSON[_0xa6f7('0x12')](_0x55369a));_0x28490e(_0x55369a);})[_0xa6f7('0x19')](function(_0xa6bff9){logger['error']('GetVoiceQueueHopperHistory',_0xa6bff9[_0xa6f7('0x16')],_0x37b833);_0x4a28a7(_0x14444c[_0xa6f7('0x13')](0x1f4,_0xa6bff9[_0xa6f7('0x16')]));});});};exports[_0xa6f7('0x43')]=function(_0x5931e9){var _0x9d901e=this;return new Promise(function(_0x2105dd,_0x14d841){return db[_0xa6f7('0x1a')][_0xa6f7('0x2d')]({'raw':_0x5931e9[_0xa6f7('0x1c')]?_0x5931e9['options'][_0xa6f7('0x1d')]===undefined?!![]:![]:!![],'where':_0x5931e9[_0xa6f7('0x1c')]?_0x5931e9[_0xa6f7('0x1c')]['where']||null:null,'attributes':[[_0xa6f7('0x42'),_0xa6f7('0x2e')],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x24'),db['sequelize']['col']('id')),_0xa6f7('0x44')],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')](_0xa6f7('0x26')))),'ivrAnswerCallsDay']],'group':[_0xa6f7('0x42')]})[_0xa6f7('0xe')](function(_0x2f131c){logger[_0xa6f7('0xf')](_0xa6f7('0x43'),_0x5931e9);logger[_0xa6f7('0x10')](_0xa6f7('0x43'),_0x5931e9,JSON[_0xa6f7('0x12')](_0x2f131c));_0x2105dd(_0x2f131c);})[_0xa6f7('0x19')](function(_0x186956){logger[_0xa6f7('0x13')]('GetCampaignHopperHistory',_0x186956[_0xa6f7('0x16')],_0x5931e9);_0x14d841(_0x9d901e['error'](0x1f4,_0x186956[_0xa6f7('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 51bde43..923ff04 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 _0x9461=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','create','put','exports','multer','path','connect-timeout','Router','fs-extra'];(function(_0x3b8f2e,_0x5a99a8){var _0x1433d5=function(_0x5e0353){while(--_0x5e0353){_0x3b8f2e['push'](_0x3b8f2e['shift']());}};_0x1433d5(++_0x5a99a8);}(_0x9461,0x17b));var _0x1946=function(_0x1b1c69,_0x49a48f){_0x1b1c69=_0x1b1c69-0x0;var _0x1c8558=_0x9461[_0x1b1c69];return _0x1c8558;};'use strict';var multer=require(_0x1946('0x0'));var util=require('util');var path=require(_0x1946('0x1'));var timeout=require(_0x1946('0x2'));var express=require('express');var router=express[_0x1946('0x3')]();var fs_extra=require(_0x1946('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1946('0x5'));var config=require(_0x1946('0x6'));var controller=require('./cmHopperHistory.controller');router[_0x1946('0x7')]('/',auth[_0x1946('0x8')](),controller[_0x1946('0x9')]);router[_0x1946('0x7')](_0x1946('0xa'),auth[_0x1946('0x8')](),controller[_0x1946('0xb')]);router[_0x1946('0x7')]('/:id',auth[_0x1946('0x8')](),controller[_0x1946('0xc')]);router['post']('/',auth[_0x1946('0x8')](),controller[_0x1946('0xd')]);router[_0x1946('0xe')]('/:id',auth[_0x1946('0x8')](),controller['update']);module[_0x1946('0xf')]=router; \ No newline at end of file +var _0x7151=['fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','update','exports','connect-timeout','express'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x7151,0x1ae));var _0x1715=function(_0x2d3206,_0x434cf5){_0x2d3206=_0x2d3206-0x0;var _0x18702d=_0x7151[_0x2d3206];return _0x18702d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1715('0x0'));var express=require(_0x1715('0x1'));var router=express['Router']();var fs_extra=require(_0x1715('0x2'));var auth=require(_0x1715('0x3'));var interaction=require(_0x1715('0x4'));var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router['get']('/',auth[_0x1715('0x5')](),controller[_0x1715('0x6')]);router[_0x1715('0x7')](_0x1715('0x8'),auth['isAuthenticated'](),controller[_0x1715('0x9')]);router[_0x1715('0x7')](_0x1715('0xa'),auth[_0x1715('0x5')](),controller[_0x1715('0xb')]);router[_0x1715('0xc')]('/',auth[_0x1715('0x5')](),controller['create']);router[_0x1715('0xd')](_0x1715('0xa'),auth['isAuthenticated'](),controller[_0x1715('0xe')]);module[_0x1715('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 9a33a03..327b67e 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 _0x8558=['name','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8558,0x103));var _0x8855=function(_0x53ef2d,_0xca87a3){_0x53ef2d=_0x53ef2d-0x0;var _0x1b6c73=_0x8558[_0x53ef2d];return _0x1b6c73;};'use strict';var Sequelize=require('sequelize');module[_0x8855('0x0')]={'name':{'type':Sequelize[_0x8855('0x1')],'unique':_0x8855('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8855('0x1')]},'dialPrefix':{'type':Sequelize[_0x8855('0x1')]}}; \ No newline at end of file +var _0x6737=['exports','STRING'];(function(_0x5d79d9,_0x4b4a43){var _0x1bf590=function(_0x147325){while(--_0x147325){_0x5d79d9['push'](_0x5d79d9['shift']());}};_0x1bf590(++_0x4b4a43);}(_0x6737,0xe2));var _0x7673=function(_0x4981d3,_0x952abb){_0x4981d3=_0x4981d3-0x0;var _0x433b80=_0x6737[_0x4981d3];return _0x433b80;};'use strict';var Sequelize=require('sequelize');module[_0x7673('0x0')]={'name':{'type':Sequelize[_0x7673('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7673('0x1')]},'dialPrefix':{'type':Sequelize[_0x7673('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 6a2cfad..de5507d 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 _0x723c=['CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','customField_','alias','item','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','description','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','addCustomField','sequelize','addCustomFields','Sequelize','TEXT','number','switch','BOOLEAN','defaultValue','queryInterface','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','undefined','count','offset','limit','json','reject','save','update','destroy','then','get','Lists','UserProfileResource','error','stack','name','index','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','CmList','includeAll','include','findAll','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','describe','addDisposition','Disposition','getDispositions','findOne','hasOwnProperty','rows','removeDispositions','ids','addContacts','CmContact','tags','isArray','push','omit','success','dataValues','message','getContacts'];(function(_0x415727,_0xb2e02c){var _0x50f623=function(_0xe269ad){while(--_0xe269ad){_0x415727['push'](_0x415727['shift']());}};_0x50f623(++_0xb2e02c);}(_0x723c,0x17b));var _0xc723=function(_0xa1841f,_0x296e3d){_0xa1841f=_0xa1841f-0x0;var _0x50a86e=_0x723c[_0xa1841f];return _0x50a86e;};'use strict';var emlformat=require(_0xc723('0x0'));var rimraf=require(_0xc723('0x1'));var zipdir=require(_0xc723('0x2'));var jsonpatch=require(_0xc723('0x3'));var rp=require(_0xc723('0x4'));var moment=require(_0xc723('0x5'));var BPromise=require(_0xc723('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc723('0x7'));var sox=require('sox');var csv=require(_0xc723('0x8'));var ejs=require(_0xc723('0x9'));var fs=require('fs');var fs_extra=require(_0xc723('0xa'));var _=require(_0xc723('0xb'));var squel=require('squel');var crypto=require(_0xc723('0xc'));var jsforce=require(_0xc723('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc723('0x8'));var querystring=require(_0xc723('0xe'));var Papa=require(_0xc723('0xf'));var Redis=require(_0xc723('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc723('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc723('0x12'))(_0xc723('0x13'));var utils=require(_0xc723('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc723('0x15'));var db=require(_0xc723('0x16'))['db'];var csv_results;config[_0xc723('0x17')]=_['defaults'](config[_0xc723('0x17')],{'host':_0xc723('0x18'),'port':0x18eb});var socket=require(_0xc723('0x19'))(new Redis(config[_0xc723('0x17')]));require(_0xc723('0x1a'))[_0xc723('0x1b')](socket);function respondWithStatusCode(_0x8b23fc,_0x4018c0){_0x4018c0=_0x4018c0||0xcc;return function(_0x50c04f){if(_0x50c04f){return _0x8b23fc[_0xc723('0x1c')](_0x4018c0);}return _0x8b23fc[_0xc723('0x1d')](_0x4018c0)[_0xc723('0x1e')]();};}function respondWithResult(_0x4ddc79,_0x2e73a2){_0x2e73a2=_0x2e73a2||0xc8;return function(_0x27e0d9){if(_0x27e0d9){return _0x4ddc79['status'](_0x2e73a2)['json'](_0x27e0d9);}};}function respondWithFilteredResult(_0x27504b,_0x4ad2fb){return function(_0x3a6b9c){if(_0x3a6b9c){var _0x2fe4e4=typeof _0x4ad2fb['offset']===_0xc723('0x1f')&&typeof _0x4ad2fb['limit']===_0xc723('0x1f');var _0xf5ef83=_0x3a6b9c[_0xc723('0x20')];var _0xe61c53=_0x2fe4e4?0x0:_0x4ad2fb[_0xc723('0x21')];var _0x211de2=_0x2fe4e4?_0x3a6b9c[_0xc723('0x20')]:_0x4ad2fb['offset']+_0x4ad2fb[_0xc723('0x22')];var _0x5104ec;if(_0x211de2>=_0xf5ef83){_0x211de2=_0xf5ef83;_0x5104ec=0xc8;}else{_0x5104ec=0xce;}_0x27504b[_0xc723('0x1d')](_0x5104ec);return _0x27504b['set']('Content-Range',_0xe61c53+'-'+_0x211de2+'/'+_0xf5ef83)[_0xc723('0x23')](_0x3a6b9c);}return null;};}function patchUpdates(_0x20c552){return function(_0x8de455){try{jsonpatch['apply'](_0x8de455,_0x20c552,!![]);}catch(_0x4b5b96){return BPromise[_0xc723('0x24')](_0x4b5b96);}return _0x8de455[_0xc723('0x25')]();};}function saveUpdates(_0x552f51,_0x3c582b){return function(_0x325961){if(_0x325961){return _0x325961[_0xc723('0x26')](_0x552f51)['then'](function(_0x32d26f){return _0x32d26f;});}return null;};}function removeEntity(_0x1a13d1,_0x5f3398){return function(_0x597f0e){if(_0x597f0e){return _0x597f0e[_0xc723('0x27')]()[_0xc723('0x28')](function(){var _0x1744cd=_0x597f0e[_0xc723('0x29')]({'plain':!![]});var _0x3957eb=_0xc723('0x2a');return db[_0xc723('0x2b')][_0xc723('0x27')]({'where':{'type':_0x3957eb,'resourceId':_0x1744cd['id']}})[_0xc723('0x28')](function(){return _0x597f0e;});})[_0xc723('0x28')](function(){_0x1a13d1[_0xc723('0x1d')](0xcc)[_0xc723('0x1e')]();});}};}function handleEntityNotFound(_0x5f234a,_0x48d7bb){return function(_0x4f35aa){if(!_0x4f35aa){_0x5f234a[_0xc723('0x1c')](0x194);}return _0x4f35aa;};}function handleError(_0xb65314,_0x15c7e3){_0x15c7e3=_0x15c7e3||0x1f4;return function(_0x4cc1d4){logger[_0xc723('0x2c')](_0x4cc1d4[_0xc723('0x2d')]);if(_0x4cc1d4['name']){delete _0x4cc1d4[_0xc723('0x2e')];}_0xb65314[_0xc723('0x1d')](_0x15c7e3)['send'](_0x4cc1d4);};}exports[_0xc723('0x2f')]=function(_0x1e2c47,_0x5a2ffd){var _0x156fbe={},_0x1229ac={},_0x11f85e={'count':0x0,'rows':[]};var _0x2d967c=_['map'](db['CmList'][_0xc723('0x30')],function(_0x265127){return{'name':_0x265127[_0xc723('0x31')],'type':_0x265127[_0xc723('0x32')]['key']};});_0x1229ac[_0xc723('0x33')]=_['map'](_0x2d967c,_0xc723('0x2e'));_0x1229ac['query']=_[_0xc723('0x34')](_0x1e2c47[_0xc723('0x35')]);_0x1229ac[_0xc723('0x36')]=_[_0xc723('0x37')](_0x1229ac[_0xc723('0x33')],_0x1229ac[_0xc723('0x35')]);_0x156fbe['attributes']=_[_0xc723('0x37')](_0x1229ac[_0xc723('0x33')],qs['fields'](_0x1e2c47[_0xc723('0x35')][_0xc723('0x38')]));_0x156fbe[_0xc723('0x39')]=_0x156fbe[_0xc723('0x39')]['length']?_0x156fbe['attributes']:_0x1229ac[_0xc723('0x33')];if(!_0x1e2c47[_0xc723('0x35')]['hasOwnProperty'](_0xc723('0x3a'))){_0x156fbe[_0xc723('0x22')]=qs[_0xc723('0x22')](_0x1e2c47[_0xc723('0x35')][_0xc723('0x22')]);_0x156fbe[_0xc723('0x21')]=qs['offset'](_0x1e2c47['query'][_0xc723('0x21')]);}_0x156fbe[_0xc723('0x3b')]=qs[_0xc723('0x3c')](_0x1e2c47['query']['sort']);_0x156fbe['where']=qs['filters'](_[_0xc723('0x3d')](_0x1e2c47[_0xc723('0x35')],_0x1229ac[_0xc723('0x36')]),_0x2d967c);if(_0x1e2c47[_0xc723('0x35')][_0xc723('0x3e')]){_0x156fbe[_0xc723('0x3f')]=_[_0xc723('0x40')](_0x156fbe[_0xc723('0x3f')],{'$or':_[_0xc723('0x41')](_0x2d967c,function(_0x29eb8e){if(_0x29eb8e[_0xc723('0x32')]!==_0xc723('0x42')){var _0x3a1b83={};_0x3a1b83[_0x29eb8e['name']]={'$like':'%'+_0x1e2c47[_0xc723('0x35')][_0xc723('0x3e')]+'%'};return _0x3a1b83;}})});}_0x156fbe=_[_0xc723('0x40')]({},_0x156fbe,_0x1e2c47[_0xc723('0x43')]);var _0x220927={'where':_0x156fbe[_0xc723('0x3f')]};return db[_0xc723('0x44')]['count'](_0x220927)['then'](function(_0x3318f4){_0x11f85e[_0xc723('0x20')]=_0x3318f4;if(_0x1e2c47[_0xc723('0x35')][_0xc723('0x45')]){_0x156fbe[_0xc723('0x46')]=[{'all':!![]}];}return db[_0xc723('0x44')][_0xc723('0x47')](_0x156fbe);})[_0xc723('0x28')](function(_0x4cac6c){_0x11f85e['rows']=_0x4cac6c;return _0x11f85e;})[_0xc723('0x28')](respondWithFilteredResult(_0x5a2ffd,_0x156fbe))['catch'](handleError(_0x5a2ffd,null));};exports[_0xc723('0x48')]=function(_0x4e289d,_0x107c6c){var _0x23a7b7={'raw':![],'where':{'id':_0x4e289d[_0xc723('0x49')]['id']}},_0x598580={};_0x598580['model']=_['keys'](db[_0xc723('0x44')]['rawAttributes']);_0x598580[_0xc723('0x35')]=_[_0xc723('0x34')](_0x4e289d[_0xc723('0x35')]);_0x598580[_0xc723('0x36')]=_['intersection'](_0x598580['model'],_0x598580[_0xc723('0x35')]);_0x23a7b7[_0xc723('0x39')]=_[_0xc723('0x37')](_0x598580[_0xc723('0x33')],qs[_0xc723('0x38')](_0x4e289d[_0xc723('0x35')]['fields']));_0x23a7b7[_0xc723('0x39')]=_0x23a7b7['attributes'][_0xc723('0x4a')]?_0x23a7b7[_0xc723('0x39')]:_0x598580['model'];if(_0x4e289d[_0xc723('0x35')][_0xc723('0x45')]){_0x23a7b7[_0xc723('0x46')]=[{'all':!![]}];}_0x23a7b7=_[_0xc723('0x40')]({},_0x23a7b7,_0x4e289d[_0xc723('0x43')]);return db[_0xc723('0x44')]['find'](_0x23a7b7)[_0xc723('0x28')](handleEntityNotFound(_0x107c6c,null))[_0xc723('0x28')](respondWithResult(_0x107c6c,null))['catch'](handleError(_0x107c6c,null));};exports[_0xc723('0x4b')]=function(_0x31d576,_0x57936a){return db['CmList'][_0xc723('0x4b')](_0x31d576[_0xc723('0x4c')],{})[_0xc723('0x28')](function(_0x2c03c3){var _0x3a3595=_0x31d576[_0xc723('0x4d')][_0xc723('0x29')]({'plain':!![]});if(!_0x3a3595)throw new Error(_0xc723('0x4e'));if(_0x3a3595[_0xc723('0x4f')]===_0xc723('0x4d')){var _0x4c9e30=_0x2c03c3[_0xc723('0x29')]({'plain':!![]});var _0xabaa74=_0xc723('0x2a');return db[_0xc723('0x50')][_0xc723('0x51')]({'where':{'name':_0xabaa74,'userProfileId':_0x3a3595[_0xc723('0x52')]},'raw':!![]})[_0xc723('0x28')](function(_0x2901bb){if(_0x2901bb&&_0x2901bb['autoAssociation']===0x0){return db[_0xc723('0x2b')][_0xc723('0x4b')]({'name':_0x4c9e30[_0xc723('0x2e')],'resourceId':_0x4c9e30['id'],'type':_0x2901bb[_0xc723('0x2e')],'sectionId':_0x2901bb['id']},{})[_0xc723('0x28')](function(){return _0x2c03c3;});}else{return _0x2c03c3;}})['catch'](function(_0x4c408d){logger[_0xc723('0x2c')](_0xc723('0x53'),_0x4c408d);throw _0x4c408d;});}return _0x2c03c3;})['then'](respondWithResult(_0x57936a,0xc9))['catch'](handleError(_0x57936a,null));};exports[_0xc723('0x26')]=function(_0x2ef658,_0x1d1db9){if(_0x2ef658['body']['id']){delete _0x2ef658['body']['id'];}return db[_0xc723('0x44')][_0xc723('0x51')]({'where':{'id':_0x2ef658[_0xc723('0x49')]['id']}})[_0xc723('0x28')](handleEntityNotFound(_0x1d1db9,null))['then'](saveUpdates(_0x2ef658['body'],null))[_0xc723('0x28')](respondWithResult(_0x1d1db9,null))['catch'](handleError(_0x1d1db9,null));};exports[_0xc723('0x27')]=function(_0x347bfe,_0x417464){return db['CmList'][_0xc723('0x51')]({'where':{'id':_0x347bfe[_0xc723('0x49')]['id']}})[_0xc723('0x28')](handleEntityNotFound(_0x417464,null))[_0xc723('0x28')](removeEntity(_0x417464,null))[_0xc723('0x54')](handleError(_0x417464,null));};exports['describe']=function(_0xed72f2,_0x946bb9){return db[_0xc723('0x44')][_0xc723('0x55')]()[_0xc723('0x28')](respondWithResult(_0x946bb9,null))[_0xc723('0x54')](handleError(_0x946bb9,null));};exports[_0xc723('0x56')]=function(_0x4f6755,_0x17737d,_0x57dcab){if(_0x4f6755['body']['id']){delete _0x4f6755['body']['id'];}return db['CmList'][_0xc723('0x51')]({'where':{'id':_0x4f6755[_0xc723('0x49')]['id']}})[_0xc723('0x28')](handleEntityNotFound(_0x17737d,null))[_0xc723('0x28')](function(_0x2da95c){if(_0x2da95c){_0x4f6755[_0xc723('0x4c')]['ListId']=_0x2da95c['id'];return db[_0xc723('0x57')][_0xc723('0x4b')](_0x4f6755[_0xc723('0x4c')]);}})[_0xc723('0x28')](respondWithResult(_0x17737d,null))[_0xc723('0x54')](handleError(_0x17737d,null));};exports[_0xc723('0x58')]=function(_0x43c055,_0x432896,_0x58b823){var _0x11c14e={'raw':![],'where':{}};var _0xa4533c={};var _0x1ef177={'count':0x0,'rows':[]};return db[_0xc723('0x44')][_0xc723('0x59')]({'where':{'id':_0x43c055['params']['id']}})[_0xc723('0x28')](handleEntityNotFound(_0x432896,null))[_0xc723('0x28')](function(_0x2d9cc8){if(_0x2d9cc8){_0xa4533c['model']=_[_0xc723('0x34')](db[_0xc723('0x57')][_0xc723('0x30')]);_0xa4533c[_0xc723('0x35')]=_[_0xc723('0x34')](_0x43c055['query']);_0xa4533c[_0xc723('0x36')]=_['intersection'](_0xa4533c[_0xc723('0x33')],_0xa4533c[_0xc723('0x35')]);_0x11c14e[_0xc723('0x39')]=_[_0xc723('0x37')](_0xa4533c['model'],qs[_0xc723('0x38')](_0x43c055['query'][_0xc723('0x38')]));_0x11c14e[_0xc723('0x39')]=_0x11c14e[_0xc723('0x39')][_0xc723('0x4a')]?_0x11c14e['attributes']:_0xa4533c[_0xc723('0x33')];if(!_0x43c055['query'][_0xc723('0x5a')](_0xc723('0x3a'))){_0x11c14e[_0xc723('0x22')]=qs[_0xc723('0x22')](_0x43c055['query'][_0xc723('0x22')]);_0x11c14e[_0xc723('0x21')]=qs[_0xc723('0x21')](_0x43c055[_0xc723('0x35')]['offset']);}_0x11c14e[_0xc723('0x3b')]=qs['sort'](_0x43c055[_0xc723('0x35')][_0xc723('0x3c')]);_0x11c14e[_0xc723('0x3f')]=qs[_0xc723('0x36')](_[_0xc723('0x3d')](_0x43c055[_0xc723('0x35')],_0xa4533c[_0xc723('0x36')]));_0x11c14e[_0xc723('0x3f')]['ListId']=_0x2d9cc8['id'];if(_0x43c055['query'][_0xc723('0x3e')]){_0x11c14e[_0xc723('0x3f')]=_['merge'](_0x11c14e['where'],{'$or':_[_0xc723('0x41')](_0x11c14e['attributes'],function(_0x1b3fc5){var _0x14130f={};_0x14130f[_0x1b3fc5]={'$like':'%'+_0x43c055[_0xc723('0x35')][_0xc723('0x3e')]+'%'};return _0x14130f;})});}_0x11c14e=_['merge']({},_0x11c14e,_0x43c055['options']);return db[_0xc723('0x57')][_0xc723('0x20')]({'where':_0x11c14e[_0xc723('0x3f')]})[_0xc723('0x28')](function(_0x47eeed){_0x1ef177[_0xc723('0x20')]=_0x47eeed;if(_0x43c055[_0xc723('0x35')]['includeAll']){_0x11c14e[_0xc723('0x46')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x11c14e);})['then'](function(_0x323990){_0x1ef177[_0xc723('0x5b')]=_0x323990;return _0x1ef177;});}})[_0xc723('0x28')](respondWithFilteredResult(_0x432896,_0x11c14e))[_0xc723('0x54')](handleError(_0x432896,null));};exports[_0xc723('0x5c')]=function(_0x464e22,_0xa6b83d,_0x42eef0){return db['CmList']['find']({'where':{'id':_0x464e22[_0xc723('0x49')]['id']}})[_0xc723('0x28')](handleEntityNotFound(_0xa6b83d,null))[_0xc723('0x28')](function(_0x404587){if(_0x404587){return _0x404587[_0xc723('0x5c')](_0x464e22[_0xc723('0x35')][_0xc723('0x5d')]);}})['then'](respondWithStatusCode(_0xa6b83d,null))[_0xc723('0x54')](handleError(_0xa6b83d,null));};exports[_0xc723('0x5e')]=function(_0xd3c339,_0x527192,_0x492e70){return db[_0xc723('0x44')]['find']({'where':{'id':_0xd3c339[_0xc723('0x49')]['id']}})[_0xc723('0x28')](handleEntityNotFound(_0x527192,null))[_0xc723('0x28')](function(_0x4ff269){if(_0x4ff269){var _0x2c2710=[];var _0x4117b8={'success':[],'errors':[]};return db[_0xc723('0x5f')]['describe']()[_0xc723('0x28')](function(_0x340f3c){if(_0xd3c339[_0xc723('0x4c')][_0xc723('0x60')]&&_[_0xc723('0x61')](_0xd3c339[_0xc723('0x4c')][_0xc723('0x60')])){if(_0xd3c339[_0xc723('0x4c')][_0xc723('0x60')][_0xc723('0x4a')]){_0xd3c339[_0xc723('0x4c')][_0xc723('0x60')]=_0xd3c339[_0xc723('0x4c')][_0xc723('0x60')]['join'](';')+';';}else{_0xd3c339[_0xc723('0x4c')][_0xc723('0x60')]=null;}}else{_0xd3c339['body'][_0xc723('0x60')]=null;}if(_0xd3c339[_0xc723('0x4c')]&&_['isArray'](_0xd3c339[_0xc723('0x4c')])){for(var _0xebb3d6=0x0;_0xebb3d6<_0xd3c339[_0xc723('0x4c')][_0xc723('0x4a')];_0xebb3d6+=0x1){_0xd3c339[_0xc723('0x4c')][_0xebb3d6]['ListId']=_0xd3c339[_0xc723('0x49')]['id'];_0x2c2710[_0xc723('0x62')](_0xd3c339[_0xc723('0x4c')][_0xebb3d6]);}return BPromise['each'](_0x2c2710,function(_0x317ee2){return db[_0xc723('0x5f')][_0xc723('0x4b')](_[_0xc723('0x63')](_0x317ee2,[_0xc723('0x5d'),'id'])||{},{'fields':_['keys'](_0x340f3c),'raw':!![]})[_0xc723('0x28')](function(_0x1e502e){_0x4117b8[_0xc723('0x64')][_0xc723('0x62')](_0x1e502e[_0xc723('0x65')]);})['catch'](function(_0x4b79bd){_0x4117b8['errors'][_0xc723('0x62')]({'data':_0x317ee2,'error':_0x4b79bd[_0xc723('0x66')]});});})[_0xc723('0x28')](function(_0x67bd83){return _0x4117b8;})['catch'](function(_0x5be7af){return _0x5be7af;});}else{_0x527192['status'](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})[_0xc723('0x28')](respondWithResult(_0x527192,null))[_0xc723('0x54')](handleError(_0x527192,null));};exports[_0xc723('0x67')]=function(_0x2f48d8,_0x13bb55,_0xc7e097){var _0x52c615;return db['CmList'][_0xc723('0x51')]({'where':{'id':_0x2f48d8[_0xc723('0x49')]['id']},'include':[{'model':db[_0xc723('0x68')],'as':_0xc723('0x69')}]})[_0xc723('0x28')](handleEntityNotFound(_0x13bb55,null))[_0xc723('0x28')](function(_0x50c62c){if(_0x50c62c){_0x52c615=_0x50c62c;return db[_0xc723('0x5f')][_0xc723('0x30')];}})[_0xc723('0x28')](function(_0x214a4b){if(_0x214a4b){var _0x248161={};var _0x45f063={};_0x45f063['model']=_[_0xc723('0x6a')](_['keys'](_0x214a4b),_['map'](_0x52c615[_0xc723('0x69')],function(_0xa97bb4){return util[_0xc723('0x6b')](_0xc723('0x6c'),_0xa97bb4['id']);}));_0x45f063[_0xc723('0x35')]=_[_0xc723('0x34')](_0x2f48d8[_0xc723('0x35')]);_0x45f063['filters']=_['intersection'](_0x45f063['model'],_0x45f063[_0xc723('0x35')]);_0x248161[_0xc723('0x39')]=_[_0xc723('0x37')](_0x45f063['model'],qs['fields'](_0x2f48d8[_0xc723('0x35')][_0xc723('0x38')]));_0x248161[_0xc723('0x39')]=_0x248161[_0xc723('0x39')][_0xc723('0x4a')]?_0x248161[_0xc723('0x39')]:_0x45f063[_0xc723('0x33')];if(!_0x2f48d8[_0xc723('0x35')][_0xc723('0x5a')](_0xc723('0x3a'))){_0x248161['limit']=qs[_0xc723('0x22')](_0x2f48d8[_0xc723('0x35')]['limit']);_0x248161[_0xc723('0x21')]=qs[_0xc723('0x21')](_0x2f48d8[_0xc723('0x35')][_0xc723('0x21')]);}_0x248161[_0xc723('0x3b')]=qs['sort'](_0x2f48d8['query'][_0xc723('0x3c')]);_0x248161['where']=qs[_0xc723('0x36')](_[_0xc723('0x3d')](_0x2f48d8['query'],_0x45f063[_0xc723('0x36')]));_0x248161[_0xc723('0x6d')]=!![];if(_0x2f48d8[_0xc723('0x35')]['filter']){_0x248161[_0xc723('0x3f')]=_[_0xc723('0x40')](_0x248161['where'],{'$or':_[_0xc723('0x41')](_0x248161[_0xc723('0x39')],function(_0xaeb699){var _0x1c9b5a={};_0x1c9b5a[_0xaeb699]={'$like':'%'+_0x2f48d8[_0xc723('0x35')][_0xc723('0x3e')]+'%'};return _0x1c9b5a;})});}_0x248161=_[_0xc723('0x40')]({},_0x248161,_0x2f48d8[_0xc723('0x43')]);return _0x52c615[_0xc723('0x67')](_0x248161);}})[_0xc723('0x28')](respondWithResult(_0x13bb55,null))[_0xc723('0x54')](handleError(_0x13bb55,null));};exports[_0xc723('0x6e')]=function(_0x40c6d7,_0x379643,_0x442c78){var _0x440e41;var _0x471008;var _0x2a70fa;var _0x1da1a3=_0x40c6d7[_0xc723('0x49')]['id'];csv_results=[];return db[_0xc723('0x6f')][_0xc723('0x47')]({'attributes':['id',_0xc723('0x2e')],'raw':!![],'order':[_0xc723('0x70')]})[_0xc723('0x28')](function(_0x2da383){_0x440e41=_0x2da383;var _0x224f32=_[_0xc723('0x34')](db[_0xc723('0x5f')][_0xc723('0x30')]);return db[_0xc723('0x68')][_0xc723('0x47')]({'raw':!![],'attributes':['id','alias']})[_0xc723('0x28')](function(_0x2659fa){_0x471008=_0x2659fa;var _0x4a9c34=squel[_0xc723('0x71')]()[_0xc723('0x38')](_0x224f32)[_0xc723('0x72')](_0xc723('0x73'),'c')[_0xc723('0x3f')](_0xc723('0x74'),_0x1da1a3)[_0xc723('0x3f')](_0xc723('0x75'))[_0xc723('0x76')]();for(var _0x192839=0x0;_0x192839<_0x471008[_0xc723('0x4a')];_0x192839++){_0x4a9c34[_0xc723('0x77')]('c.cf_'+_0x471008[_0x192839]['id'],_0xc723('0x78')+_0x471008[_0x192839][_0xc723('0x79')]);}for(var _0x192839=0x0;_0x192839<_0x440e41[_0xc723('0x4a')];_0x192839++){_0x4a9c34[_0xc723('0x77')](squel[_0xc723('0x71')]()['field'](_0xc723('0x7a'))[_0xc723('0x72')](_0xc723('0x7b'))[_0xc723('0x3f')](_0xc723('0x7c'),_0x440e41[_0x192839]['id'])['where']('CmContactId\x20=\x20c.id'),_0xc723('0x7d')+_0x440e41[_0x192839][_0xc723('0x2e')]);_0x4a9c34[_0xc723('0x77')](squel[_0xc723('0x71')]()[_0xc723('0x77')](_0xc723('0x7e'))[_0xc723('0x72')]('cm_contact_has_items')[_0xc723('0x3f')]('ItemTypeId\x20=\x20?',_0x440e41[_0x192839]['id'])[_0xc723('0x3f')](_0xc723('0x7f')),_0xc723('0x80')+_0x440e41[_0x192839][_0xc723('0x2e')]);}var _0x5c7447=[];_0x5c7447[_0xc723('0x62')](_0x4a9c34[_0xc723('0x81')]());BPromise['each'](_0x5c7447,handleQuery)[_0xc723('0x28')](function(_0x141ea1){handleQuery(_0x4a9c34[_0xc723('0x81')]());var _0x3d062a=csv_results[0x0];if(!_[_0xc723('0x82')](_0x3d062a)){var _0x460738=toCsv(_0x3d062a);var _0x485246=Date[_0xc723('0x83')]();fs[_0xc723('0x84')](util['format'](_0xc723('0x85'),_0x1da1a3,_0x485246),_0x460738);_0x379643[_0xc723('0x86')](_0xc723('0x87'),_0xc723('0x88')+util[_0xc723('0x6b')]('list_%d_%s.csv',_0x1da1a3,_0x485246));_0x379643['setHeader'](_0xc723('0x89'),_0xc723('0x8a'));return _0x379643['download'](util['format']('/tmp/list_%d_%s.csv',_0x1da1a3,_0x485246));}else{return _0x379643[_0xc723('0x1c')](0xcc);}});});});};exports[_0xc723('0x8b')]=function(_0x586019,_0x1405bb,_0x35c667){var _0x1c3064;delete _0x586019[_0xc723('0x4c')]['id'];return db[_0xc723('0x44')]['findOne']({'where':{'id':_0x586019['params']['id']}})['then'](handleEntityNotFound(_0x1405bb,null))[_0xc723('0x28')](function(_0x40eb22){if(_0x40eb22){return db[_0xc723('0x8c')]['transaction'](function(_0xd7d7ff){return db[_0xc723('0x68')][_0xc723('0x4b')](_0x586019[_0xc723('0x4c')],{'transaction':_0xd7d7ff})[_0xc723('0x28')](function(_0x5cdcc3){_0x1c3064=_0x5cdcc3;return _0x40eb22[_0xc723('0x8d')](_0x5cdcc3,{'transaction':_0xd7d7ff});})['then'](function(){var _0x1dd87d={'type':db[_0xc723('0x8e')][_0xc723('0x8f')],'transaction':_0xd7d7ff};switch(_0x586019[_0xc723('0x4c')]['type']){case'text':_0x1dd87d['type']=db['Sequelize'][_0xc723('0x8f')];break;case _0xc723('0x90'):_0x1dd87d[_0xc723('0x32')]=db[_0xc723('0x8e')]['INTEGER'];break;case _0xc723('0x91'):_0x1dd87d[_0xc723('0x32')]=db['Sequelize'][_0xc723('0x92')];_0x1dd87d[_0xc723('0x93')]=![];break;default:}return db[_0xc723('0x8c')][_0xc723('0x94')]['addColumn']('cm_contacts',util[_0xc723('0x6b')](_0xc723('0x95'),_0x1c3064['id']),_0x1dd87d);})[_0xc723('0x28')](function(){return _0x1c3064;});});}})[_0xc723('0x28')](respondWithResult(_0x1405bb,null))[_0xc723('0x54')](handleError(_0x1405bb,null));};exports[_0xc723('0x96')]=function(_0x5a0b4d,_0x5ce491,_0x59f4df){var _0x161308={};var _0x25702f={};var _0x5f04b9;var _0x577efe;return db[_0xc723('0x44')][_0xc723('0x59')]({'where':{'id':_0x5a0b4d['params']['id']}})[_0xc723('0x28')](handleEntityNotFound(_0x5ce491,null))[_0xc723('0x28')](function(_0x43cfb4){if(_0x43cfb4){_0x5f04b9=_0x43cfb4;_0x25702f[_0xc723('0x33')]=_['keys'](db[_0xc723('0x68')][_0xc723('0x30')]);_0x25702f[_0xc723('0x35')]=_[_0xc723('0x34')](_0x5a0b4d['query']);_0x25702f[_0xc723('0x36')]=_[_0xc723('0x37')](_0x25702f[_0xc723('0x33')],_0x25702f[_0xc723('0x35')]);_0x161308[_0xc723('0x39')]=_[_0xc723('0x37')](_0x25702f[_0xc723('0x33')],qs[_0xc723('0x38')](_0x5a0b4d[_0xc723('0x35')][_0xc723('0x38')]));_0x161308[_0xc723('0x39')]=_0x161308[_0xc723('0x39')][_0xc723('0x4a')]?_0x161308[_0xc723('0x39')]:_0x25702f[_0xc723('0x33')];_0x161308[_0xc723('0x3b')]=qs[_0xc723('0x3c')](_0x5a0b4d[_0xc723('0x35')][_0xc723('0x3c')]);_0x161308[_0xc723('0x3f')]=qs[_0xc723('0x36')](_[_0xc723('0x3d')](_0x5a0b4d['query'],_0x25702f[_0xc723('0x36')]));_0x161308[_0xc723('0x3f')]=_[_0xc723('0x40')](_0x161308[_0xc723('0x3f')],{'$or':[{'ListId':_0x43cfb4['id']},{'ListId':null}]});if(_0x5a0b4d[_0xc723('0x35')]['filter']){_0x161308[_0xc723('0x3f')]=_[_0xc723('0x40')](_0x161308['where'],{'$or':_[_0xc723('0x41')](_0x161308[_0xc723('0x39')],function(_0x3179d9){var _0x2781e6={};_0x2781e6[_0x3179d9]={'$like':'%'+_0x5a0b4d['query'][_0xc723('0x3e')]+'%'};return _0x2781e6;})});}_0x161308=_[_0xc723('0x40')]({},_0x161308,_0x5a0b4d[_0xc723('0x43')]);return db[_0xc723('0x68')][_0xc723('0x97')](_0x161308);}})[_0xc723('0x28')](respondWithResult(_0x5ce491,null))[_0xc723('0x54')](handleError(_0x5ce491,null));};exports[_0xc723('0x98')]=function(_0x5041f8,_0x27e22a){return db[_0xc723('0x68')][_0xc723('0x97')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x27e22a,null))['then'](function(_0x2a7f1d){return _0x2a7f1d;})[_0xc723('0x28')](respondWithResult(_0x27e22a,null))['catch'](handleError(_0x27e22a,null));};exports[_0xc723('0x99')]=function(_0x47c3f2,_0x52c392,_0xd63d76){return db[_0xc723('0x44')][_0xc723('0x51')]({'where':{'id':_0x47c3f2[_0xc723('0x49')]['id']}})['then'](handleEntityNotFound(_0x52c392,null))[_0xc723('0x28')](function(_0x48aa9a){if(_0x48aa9a){return _0x48aa9a[_0xc723('0x99')](_0x47c3f2[_0xc723('0x4c')][_0xc723('0x5d')],_['omit'](_0x47c3f2[_0xc723('0x4c')],[_0xc723('0x5d'),'id'])||{})[_0xc723('0x9a')](function(_0x551875){for(var _0x1825da=0x0;_0x1825da<_0x47c3f2[_0xc723('0x4c')]['ids']['length'];_0x1825da+=0x1){socket[_0xc723('0x9b')](_0xc723('0x9c'),{'UserId':Number(_0x47c3f2[_0xc723('0x4c')]['ids'][_0x1825da]),'CmListId':Number(_0x47c3f2['params']['id'])});}return _0x551875;});}})[_0xc723('0x28')](respondWithResult(_0x52c392,null))[_0xc723('0x54')](handleError(_0x52c392,null));};exports['removeAgents']=function(_0x28b84a,_0xf0cd11,_0x5b9e8b){return db['CmList'][_0xc723('0x51')]({'where':{'id':_0x28b84a[_0xc723('0x49')]['id']}})[_0xc723('0x28')](handleEntityNotFound(_0xf0cd11,null))[_0xc723('0x28')](function(_0x508a3){if(_0x508a3){return _0x508a3[_0xc723('0x9d')](_0x28b84a[_0xc723('0x35')][_0xc723('0x5d')])[_0xc723('0x28')](function(){if(_[_0xc723('0x61')](_0x28b84a[_0xc723('0x35')]['ids'])){for(var _0x12869d=0x0;_0x12869d<_0x28b84a[_0xc723('0x35')][_0xc723('0x5d')]['length'];_0x12869d+=0x1){socket[_0xc723('0x9b')]('userCmList:remove',{'UserId':Number(_0x28b84a[_0xc723('0x35')][_0xc723('0x5d')][_0x12869d]),'CmListId':Number(_0x28b84a[_0xc723('0x49')]['id'])});}}else{socket[_0xc723('0x9b')](_0xc723('0x9e'),{'UserId':Number(_0x28b84a[_0xc723('0x35')][_0xc723('0x5d')]),'CmListId':Number(_0x28b84a[_0xc723('0x49')]['id'])});}});}})[_0xc723('0x28')](respondWithStatusCode(_0xf0cd11,null))[_0xc723('0x54')](handleError(_0xf0cd11,null));};exports[_0xc723('0x9f')]=function(_0xf49aca,_0x42980a,_0x1960c7){var _0x1495a2={};var _0x43f6d9={};var _0x553821;var _0x5d8ed6;return db[_0xc723('0x44')][_0xc723('0x59')]({'where':{'id':_0xf49aca[_0xc723('0x49')]['id']}})[_0xc723('0x28')](handleEntityNotFound(_0x42980a,null))['then'](function(_0x4bb5b7){if(_0x4bb5b7){_0x553821=_0x4bb5b7;_0x43f6d9[_0xc723('0x33')]=_[_0xc723('0x34')](db['User'][_0xc723('0x30')]);_0x43f6d9[_0xc723('0x35')]=_[_0xc723('0x34')](_0xf49aca[_0xc723('0x35')]);_0x43f6d9['filters']=_[_0xc723('0x37')](_0x43f6d9[_0xc723('0x33')],_0x43f6d9[_0xc723('0x35')]);_0x1495a2[_0xc723('0x39')]=_[_0xc723('0x37')](_0x43f6d9[_0xc723('0x33')],qs[_0xc723('0x38')](_0xf49aca[_0xc723('0x35')][_0xc723('0x38')]));_0x1495a2[_0xc723('0x39')]=_0x1495a2[_0xc723('0x39')][_0xc723('0x4a')]?_0x1495a2['attributes']:_0x43f6d9[_0xc723('0x33')];_0x1495a2[_0xc723('0x3b')]=qs[_0xc723('0x3c')](_0xf49aca[_0xc723('0x35')][_0xc723('0x3c')]);_0x1495a2[_0xc723('0x3f')]=qs[_0xc723('0x36')](_[_0xc723('0x3d')](_0xf49aca[_0xc723('0x35')],_0x43f6d9[_0xc723('0x36')]));if(_0xf49aca[_0xc723('0x35')]['filter']){_0x1495a2[_0xc723('0x3f')]=_['merge'](_0x1495a2[_0xc723('0x3f')],{'$or':_[_0xc723('0x41')](_0x1495a2['attributes'],function(_0x586a34){var _0x50f631={};_0x50f631[_0x586a34]={'$like':'%'+_0xf49aca[_0xc723('0x35')][_0xc723('0x3e')]+'%'};return _0x50f631;})});}_0x1495a2=_['merge']({},_0x1495a2,_0xf49aca[_0xc723('0x43')]);return _0x553821['getAgents'](_0x1495a2);}})['then'](function(_0x5b3f9f){if(_0x5b3f9f){_0x5d8ed6=_0x5b3f9f[_0xc723('0x4a')];if(!_0xf49aca[_0xc723('0x35')]['hasOwnProperty'](_0xc723('0x3a'))){_0x1495a2[_0xc723('0x22')]=qs['limit'](_0xf49aca['query'][_0xc723('0x22')]);_0x1495a2[_0xc723('0x21')]=qs[_0xc723('0x21')](_0xf49aca[_0xc723('0x35')][_0xc723('0x21')]);}return _0x553821[_0xc723('0x9f')](_0x1495a2);}})['then'](function(_0x5afffb){if(_0x5afffb){return _0x5afffb?{'count':_0x5d8ed6,'rows':_0x5afffb}:null;}})[_0xc723('0x28')](respondWithResult(_0x42980a,null))[_0xc723('0x54')](handleError(_0x42980a,null));};function handleQuery(_0x57d567){logger[_0xc723('0xa0')](_0x57d567);return db[_0xc723('0x8c')][_0xc723('0x35')](_0x57d567)[_0xc723('0x9a')](function(_0xab88a){csv_results[_0xc723('0x62')](_0xab88a);})[_0xc723('0x54')](function(_0x827fd8){logger[_0xc723('0x2c')](_0x827fd8[_0xc723('0x66')]);});} \ No newline at end of file +var _0xc996=['rows','catch','show','params','keys','options','find','create','role','Lists','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','findOne','order','ListId','addContacts','CmContact','tags','join','push','each','omit','ids','success','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','ContactItemType','OrderBy','alias','from','cm_contacts','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','select','item','CmContactId\x20=\x20c.id','description','ItemTypeId\x20=\x20?','toString','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','sendStatus','transaction','addCustomFields','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','isArray','userCmList:remove','getAgents','info','sequelize','message','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','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','redis','defaults','localhost','socket.io-emitter','./cmList.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','CmList','rawAttributes','fieldName','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll'];(function(_0x37f229,_0x2417cc){var _0x4fe43a=function(_0x873d9f){while(--_0x873d9f){_0x37f229['push'](_0x37f229['shift']());}};_0x4fe43a(++_0x2417cc);}(_0xc996,0x105));var _0x6c99=function(_0x19aaa2,_0x4399b6){_0x19aaa2=_0x19aaa2-0x0;var _0x3f754e=_0xc996[_0x19aaa2];return _0x3f754e;};'use strict';var emlformat=require(_0x6c99('0x0'));var rimraf=require(_0x6c99('0x1'));var zipdir=require(_0x6c99('0x2'));var jsonpatch=require(_0x6c99('0x3'));var rp=require(_0x6c99('0x4'));var moment=require(_0x6c99('0x5'));var BPromise=require(_0x6c99('0x6'));var Mustache=require(_0x6c99('0x7'));var util=require('util');var path=require(_0x6c99('0x8'));var sox=require(_0x6c99('0x9'));var csv=require(_0x6c99('0xa'));var ejs=require(_0x6c99('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6c99('0xc'));var crypto=require('crypto');var jsforce=require(_0x6c99('0xd'));var deskjs=require(_0x6c99('0xe'));var toCsv=require(_0x6c99('0xa'));var querystring=require(_0x6c99('0xf'));var Papa=require(_0x6c99('0x10'));var Redis=require(_0x6c99('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6c99('0x12'));var as=require(_0x6c99('0x13'));var hardwareService=require(_0x6c99('0x14'));var logger=require(_0x6c99('0x15'))(_0x6c99('0x16'));var utils=require(_0x6c99('0x17'));var config=require(_0x6c99('0x18'));var licenseUtil=require(_0x6c99('0x19'));var db=require(_0x6c99('0x1a'))['db'];var csv_results;config[_0x6c99('0x1b')]=_[_0x6c99('0x1c')](config[_0x6c99('0x1b')],{'host':_0x6c99('0x1d'),'port':0x18eb});var socket=require(_0x6c99('0x1e'))(new Redis(config[_0x6c99('0x1b')]));require(_0x6c99('0x1f'))['register'](socket);function respondWithStatusCode(_0x158636,_0x57c487){_0x57c487=_0x57c487||0xcc;return function(_0x12946d){if(_0x12946d){return _0x158636['sendStatus'](_0x57c487);}return _0x158636[_0x6c99('0x20')](_0x57c487)[_0x6c99('0x21')]();};}function respondWithResult(_0x23ac90,_0x3950a4){_0x3950a4=_0x3950a4||0xc8;return function(_0x27ee56){if(_0x27ee56){return _0x23ac90[_0x6c99('0x20')](_0x3950a4)[_0x6c99('0x22')](_0x27ee56);}};}function respondWithFilteredResult(_0x1c96e2,_0x4f619a){return function(_0x78fe3f){if(_0x78fe3f){var _0x391fe7=typeof _0x4f619a[_0x6c99('0x23')]===_0x6c99('0x24')&&typeof _0x4f619a[_0x6c99('0x25')]==='undefined';var _0x548ff9=_0x78fe3f[_0x6c99('0x26')];var _0x3dc419=_0x391fe7?0x0:_0x4f619a[_0x6c99('0x23')];var _0x59c3c3=_0x391fe7?_0x78fe3f[_0x6c99('0x26')]:_0x4f619a[_0x6c99('0x23')]+_0x4f619a[_0x6c99('0x25')];var _0x12f3f2;if(_0x59c3c3>=_0x548ff9){_0x59c3c3=_0x548ff9;_0x12f3f2=0xc8;}else{_0x12f3f2=0xce;}_0x1c96e2[_0x6c99('0x20')](_0x12f3f2);return _0x1c96e2[_0x6c99('0x27')](_0x6c99('0x28'),_0x3dc419+'-'+_0x59c3c3+'/'+_0x548ff9)[_0x6c99('0x22')](_0x78fe3f);}return null;};}function patchUpdates(_0x52b582){return function(_0x512b24){try{jsonpatch['apply'](_0x512b24,_0x52b582,!![]);}catch(_0x21f264){return BPromise[_0x6c99('0x29')](_0x21f264);}return _0x512b24[_0x6c99('0x2a')]();};}function saveUpdates(_0xbfaf1e,_0xd5703f){return function(_0x539903){if(_0x539903){return _0x539903[_0x6c99('0x2b')](_0xbfaf1e)[_0x6c99('0x2c')](function(_0x347bba){return _0x347bba;});}return null;};}function removeEntity(_0x4db814,_0x1ff2db){return function(_0x34e7ba){if(_0x34e7ba){return _0x34e7ba[_0x6c99('0x2d')]()[_0x6c99('0x2c')](function(){var _0x4152f8=_0x34e7ba[_0x6c99('0x2e')]({'plain':!![]});var _0x1f9d44='Lists';return db[_0x6c99('0x2f')][_0x6c99('0x2d')]({'where':{'type':_0x1f9d44,'resourceId':_0x4152f8['id']}})['then'](function(){return _0x34e7ba;});})['then'](function(){_0x4db814[_0x6c99('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fc67e,_0x482883){return function(_0x5dd92e){if(!_0x5dd92e){_0x2fc67e['sendStatus'](0x194);}return _0x5dd92e;};}function handleError(_0x268b1b,_0x24961c){_0x24961c=_0x24961c||0x1f4;return function(_0x53bfed){logger[_0x6c99('0x30')](_0x53bfed[_0x6c99('0x31')]);if(_0x53bfed['name']){delete _0x53bfed[_0x6c99('0x32')];}_0x268b1b[_0x6c99('0x20')](_0x24961c)[_0x6c99('0x33')](_0x53bfed);};}exports[_0x6c99('0x34')]=function(_0x39e021,_0x204669){var _0x3b4b5c={},_0x2ae2e8={},_0x28f593={'count':0x0,'rows':[]};var _0x2920b6=_['map'](db[_0x6c99('0x35')][_0x6c99('0x36')],function(_0x5103dd){return{'name':_0x5103dd[_0x6c99('0x37')],'type':_0x5103dd['type'][_0x6c99('0x38')]};});_0x2ae2e8['model']=_[_0x6c99('0x39')](_0x2920b6,_0x6c99('0x32'));_0x2ae2e8[_0x6c99('0x3a')]=_['keys'](_0x39e021['query']);_0x2ae2e8[_0x6c99('0x3b')]=_[_0x6c99('0x3c')](_0x2ae2e8[_0x6c99('0x3d')],_0x2ae2e8[_0x6c99('0x3a')]);_0x3b4b5c[_0x6c99('0x3e')]=_[_0x6c99('0x3c')](_0x2ae2e8[_0x6c99('0x3d')],qs[_0x6c99('0x3f')](_0x39e021[_0x6c99('0x3a')][_0x6c99('0x3f')]));_0x3b4b5c[_0x6c99('0x3e')]=_0x3b4b5c['attributes'][_0x6c99('0x40')]?_0x3b4b5c[_0x6c99('0x3e')]:_0x2ae2e8[_0x6c99('0x3d')];if(!_0x39e021['query'][_0x6c99('0x41')](_0x6c99('0x42'))){_0x3b4b5c['limit']=qs[_0x6c99('0x25')](_0x39e021[_0x6c99('0x3a')][_0x6c99('0x25')]);_0x3b4b5c[_0x6c99('0x23')]=qs[_0x6c99('0x23')](_0x39e021['query'][_0x6c99('0x23')]);}_0x3b4b5c['order']=qs['sort'](_0x39e021[_0x6c99('0x3a')][_0x6c99('0x43')]);_0x3b4b5c[_0x6c99('0x44')]=qs[_0x6c99('0x3b')](_[_0x6c99('0x45')](_0x39e021[_0x6c99('0x3a')],_0x2ae2e8['filters']),_0x2920b6);if(_0x39e021[_0x6c99('0x3a')][_0x6c99('0x46')]){_0x3b4b5c[_0x6c99('0x44')]=_[_0x6c99('0x47')](_0x3b4b5c['where'],{'$or':_[_0x6c99('0x39')](_0x2920b6,function(_0x44efa9){if(_0x44efa9[_0x6c99('0x48')]!==_0x6c99('0x49')){var _0x58939d={};_0x58939d[_0x44efa9[_0x6c99('0x32')]]={'$like':'%'+_0x39e021[_0x6c99('0x3a')]['filter']+'%'};return _0x58939d;}})});}_0x3b4b5c=_[_0x6c99('0x47')]({},_0x3b4b5c,_0x39e021['options']);var _0xd0cc8e={'where':_0x3b4b5c[_0x6c99('0x44')]};return db[_0x6c99('0x35')][_0x6c99('0x26')](_0xd0cc8e)[_0x6c99('0x2c')](function(_0x4cd04c){_0x28f593['count']=_0x4cd04c;if(_0x39e021[_0x6c99('0x3a')][_0x6c99('0x4a')]){_0x3b4b5c[_0x6c99('0x4b')]=[{'all':!![]}];}return db[_0x6c99('0x35')][_0x6c99('0x4c')](_0x3b4b5c);})['then'](function(_0x51ad1a){_0x28f593[_0x6c99('0x4d')]=_0x51ad1a;return _0x28f593;})[_0x6c99('0x2c')](respondWithFilteredResult(_0x204669,_0x3b4b5c))[_0x6c99('0x4e')](handleError(_0x204669,null));};exports[_0x6c99('0x4f')]=function(_0x1a164a,_0x296391){var _0x58ac56={'raw':![],'where':{'id':_0x1a164a[_0x6c99('0x50')]['id']}},_0x32b7e5={};_0x32b7e5['model']=_[_0x6c99('0x51')](db['CmList'][_0x6c99('0x36')]);_0x32b7e5['query']=_[_0x6c99('0x51')](_0x1a164a[_0x6c99('0x3a')]);_0x32b7e5[_0x6c99('0x3b')]=_[_0x6c99('0x3c')](_0x32b7e5[_0x6c99('0x3d')],_0x32b7e5[_0x6c99('0x3a')]);_0x58ac56[_0x6c99('0x3e')]=_['intersection'](_0x32b7e5['model'],qs[_0x6c99('0x3f')](_0x1a164a[_0x6c99('0x3a')][_0x6c99('0x3f')]));_0x58ac56[_0x6c99('0x3e')]=_0x58ac56[_0x6c99('0x3e')][_0x6c99('0x40')]?_0x58ac56[_0x6c99('0x3e')]:_0x32b7e5[_0x6c99('0x3d')];if(_0x1a164a[_0x6c99('0x3a')][_0x6c99('0x4a')]){_0x58ac56[_0x6c99('0x4b')]=[{'all':!![]}];}_0x58ac56=_['merge']({},_0x58ac56,_0x1a164a[_0x6c99('0x52')]);return db[_0x6c99('0x35')][_0x6c99('0x53')](_0x58ac56)[_0x6c99('0x2c')](handleEntityNotFound(_0x296391,null))[_0x6c99('0x2c')](respondWithResult(_0x296391,null))[_0x6c99('0x4e')](handleError(_0x296391,null));};exports['create']=function(_0xd17221,_0x4bcc0f){return db[_0x6c99('0x35')][_0x6c99('0x54')](_0xd17221['body'],{})[_0x6c99('0x2c')](function(_0x441daa){var _0x51ea1b=_0xd17221['user'][_0x6c99('0x2e')]({'plain':!![]});if(!_0x51ea1b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x51ea1b[_0x6c99('0x55')]==='user'){var _0x30cc64=_0x441daa[_0x6c99('0x2e')]({'plain':!![]});var _0x1d2c89=_0x6c99('0x56');return db[_0x6c99('0x57')][_0x6c99('0x53')]({'where':{'name':_0x1d2c89,'userProfileId':_0x51ea1b[_0x6c99('0x58')]},'raw':!![]})[_0x6c99('0x2c')](function(_0x342172){if(_0x342172&&_0x342172[_0x6c99('0x59')]===0x0){return db[_0x6c99('0x2f')]['create']({'name':_0x30cc64[_0x6c99('0x32')],'resourceId':_0x30cc64['id'],'type':_0x342172['name'],'sectionId':_0x342172['id']},{})[_0x6c99('0x2c')](function(){return _0x441daa;});}else{return _0x441daa;}})[_0x6c99('0x4e')](function(_0x2a8567){logger[_0x6c99('0x30')](_0x6c99('0x5a'),_0x2a8567);throw _0x2a8567;});}return _0x441daa;})['then'](respondWithResult(_0x4bcc0f,0xc9))['catch'](handleError(_0x4bcc0f,null));};exports[_0x6c99('0x2b')]=function(_0x192cdb,_0x2569bd){if(_0x192cdb[_0x6c99('0x5b')]['id']){delete _0x192cdb['body']['id'];}return db[_0x6c99('0x35')][_0x6c99('0x53')]({'where':{'id':_0x192cdb['params']['id']}})[_0x6c99('0x2c')](handleEntityNotFound(_0x2569bd,null))['then'](saveUpdates(_0x192cdb['body'],null))[_0x6c99('0x2c')](respondWithResult(_0x2569bd,null))['catch'](handleError(_0x2569bd,null));};exports[_0x6c99('0x2d')]=function(_0x9f06bc,_0x1082dc){return db[_0x6c99('0x35')][_0x6c99('0x53')]({'where':{'id':_0x9f06bc[_0x6c99('0x50')]['id']}})[_0x6c99('0x2c')](handleEntityNotFound(_0x1082dc,null))[_0x6c99('0x2c')](removeEntity(_0x1082dc,null))['catch'](handleError(_0x1082dc,null));};exports['describe']=function(_0xa10d6d,_0x2f8013){return db['CmList'][_0x6c99('0x5c')]()[_0x6c99('0x2c')](respondWithResult(_0x2f8013,null))[_0x6c99('0x4e')](handleError(_0x2f8013,null));};exports[_0x6c99('0x5d')]=function(_0x59bbb2,_0x2b579b,_0x25f15d){if(_0x59bbb2[_0x6c99('0x5b')]['id']){delete _0x59bbb2['body']['id'];}return db['CmList']['find']({'where':{'id':_0x59bbb2[_0x6c99('0x50')]['id']}})['then'](handleEntityNotFound(_0x2b579b,null))[_0x6c99('0x2c')](function(_0x43cb82){if(_0x43cb82){_0x59bbb2[_0x6c99('0x5b')]['ListId']=_0x43cb82['id'];return db[_0x6c99('0x5e')]['create'](_0x59bbb2['body']);}})[_0x6c99('0x2c')](respondWithResult(_0x2b579b,null))['catch'](handleError(_0x2b579b,null));};exports['getDispositions']=function(_0x34b6e6,_0x26866b,_0x582d3b){var _0x3004ac={'raw':![],'where':{}};var _0x1778a8={};var _0x5e2656={'count':0x0,'rows':[]};return db[_0x6c99('0x35')][_0x6c99('0x5f')]({'where':{'id':_0x34b6e6[_0x6c99('0x50')]['id']}})[_0x6c99('0x2c')](handleEntityNotFound(_0x26866b,null))[_0x6c99('0x2c')](function(_0x2d2bbd){if(_0x2d2bbd){_0x1778a8[_0x6c99('0x3d')]=_[_0x6c99('0x51')](db['Disposition'][_0x6c99('0x36')]);_0x1778a8[_0x6c99('0x3a')]=_['keys'](_0x34b6e6[_0x6c99('0x3a')]);_0x1778a8['filters']=_[_0x6c99('0x3c')](_0x1778a8[_0x6c99('0x3d')],_0x1778a8[_0x6c99('0x3a')]);_0x3004ac[_0x6c99('0x3e')]=_[_0x6c99('0x3c')](_0x1778a8[_0x6c99('0x3d')],qs[_0x6c99('0x3f')](_0x34b6e6[_0x6c99('0x3a')][_0x6c99('0x3f')]));_0x3004ac[_0x6c99('0x3e')]=_0x3004ac[_0x6c99('0x3e')][_0x6c99('0x40')]?_0x3004ac[_0x6c99('0x3e')]:_0x1778a8[_0x6c99('0x3d')];if(!_0x34b6e6[_0x6c99('0x3a')][_0x6c99('0x41')]('nolimit')){_0x3004ac['limit']=qs[_0x6c99('0x25')](_0x34b6e6[_0x6c99('0x3a')][_0x6c99('0x25')]);_0x3004ac[_0x6c99('0x23')]=qs['offset'](_0x34b6e6[_0x6c99('0x3a')]['offset']);}_0x3004ac[_0x6c99('0x60')]=qs['sort'](_0x34b6e6[_0x6c99('0x3a')][_0x6c99('0x43')]);_0x3004ac[_0x6c99('0x44')]=qs[_0x6c99('0x3b')](_[_0x6c99('0x45')](_0x34b6e6[_0x6c99('0x3a')],_0x1778a8[_0x6c99('0x3b')]));_0x3004ac['where'][_0x6c99('0x61')]=_0x2d2bbd['id'];if(_0x34b6e6[_0x6c99('0x3a')][_0x6c99('0x46')]){_0x3004ac[_0x6c99('0x44')]=_['merge'](_0x3004ac[_0x6c99('0x44')],{'$or':_['map'](_0x3004ac[_0x6c99('0x3e')],function(_0x41797e){var _0x233a2b={};_0x233a2b[_0x41797e]={'$like':'%'+_0x34b6e6[_0x6c99('0x3a')][_0x6c99('0x46')]+'%'};return _0x233a2b;})});}_0x3004ac=_[_0x6c99('0x47')]({},_0x3004ac,_0x34b6e6[_0x6c99('0x52')]);return db['Disposition'][_0x6c99('0x26')]({'where':_0x3004ac[_0x6c99('0x44')]})['then'](function(_0x3a5906){_0x5e2656['count']=_0x3a5906;if(_0x34b6e6['query']['includeAll']){_0x3004ac[_0x6c99('0x4b')]=[{'all':!![]}];}return db[_0x6c99('0x5e')][_0x6c99('0x4c')](_0x3004ac);})['then'](function(_0x3a5894){_0x5e2656['rows']=_0x3a5894;return _0x5e2656;});}})[_0x6c99('0x2c')](respondWithFilteredResult(_0x26866b,_0x3004ac))[_0x6c99('0x4e')](handleError(_0x26866b,null));};exports['removeDispositions']=function(_0x5717fe,_0x2c2cae,_0x1736eb){return db['CmList'][_0x6c99('0x53')]({'where':{'id':_0x5717fe['params']['id']}})['then'](handleEntityNotFound(_0x2c2cae,null))['then'](function(_0x111fda){if(_0x111fda){return _0x111fda['removeDispositions'](_0x5717fe['query']['ids']);}})[_0x6c99('0x2c')](respondWithStatusCode(_0x2c2cae,null))['catch'](handleError(_0x2c2cae,null));};exports[_0x6c99('0x62')]=function(_0x24f4be,_0xd36774,_0x3ed533){return db[_0x6c99('0x35')][_0x6c99('0x53')]({'where':{'id':_0x24f4be[_0x6c99('0x50')]['id']}})[_0x6c99('0x2c')](handleEntityNotFound(_0xd36774,null))['then'](function(_0x431cb2){if(_0x431cb2){var _0x4587f7=[];var _0xd3dac8={'success':[],'errors':[]};return db[_0x6c99('0x63')]['describe']()[_0x6c99('0x2c')](function(_0x30bb73){if(_0x24f4be[_0x6c99('0x5b')]['tags']&&_['isArray'](_0x24f4be[_0x6c99('0x5b')][_0x6c99('0x64')])){if(_0x24f4be[_0x6c99('0x5b')]['tags'][_0x6c99('0x40')]){_0x24f4be[_0x6c99('0x5b')][_0x6c99('0x64')]=_0x24f4be['body'][_0x6c99('0x64')][_0x6c99('0x65')](';')+';';}else{_0x24f4be[_0x6c99('0x5b')][_0x6c99('0x64')]=null;}}else{_0x24f4be[_0x6c99('0x5b')]['tags']=null;}if(_0x24f4be['body']&&_['isArray'](_0x24f4be[_0x6c99('0x5b')])){for(var _0x315d14=0x0;_0x315d14<_0x24f4be[_0x6c99('0x5b')]['length'];_0x315d14+=0x1){_0x24f4be[_0x6c99('0x5b')][_0x315d14]['ListId']=_0x24f4be[_0x6c99('0x50')]['id'];_0x4587f7[_0x6c99('0x66')](_0x24f4be['body'][_0x315d14]);}return BPromise[_0x6c99('0x67')](_0x4587f7,function(_0x545dd7){return db['CmContact'][_0x6c99('0x54')](_[_0x6c99('0x68')](_0x545dd7,[_0x6c99('0x69'),'id'])||{},{'fields':_[_0x6c99('0x51')](_0x30bb73),'raw':!![]})[_0x6c99('0x2c')](function(_0x5f3002){_0xd3dac8[_0x6c99('0x6a')][_0x6c99('0x66')](_0x5f3002[_0x6c99('0x6b')]);})[_0x6c99('0x4e')](function(_0x5b5580){_0xd3dac8[_0x6c99('0x6c')]['push']({'data':_0x545dd7,'error':_0x5b5580['message']});});})[_0x6c99('0x2c')](function(_0x4fd7d3){return _0xd3dac8;})[_0x6c99('0x4e')](function(_0x5a527b){return _0x5a527b;});}else{_0xd36774['status'](0x190)['json']({'message':_0x6c99('0x6d')});}});}})['then'](respondWithResult(_0xd36774,null))['catch'](handleError(_0xd36774,null));};exports[_0x6c99('0x6e')]=function(_0x315af5,_0x9e288b,_0x3590a7){var _0x1712ed;return db[_0x6c99('0x35')]['find']({'where':{'id':_0x315af5[_0x6c99('0x50')]['id']},'include':[{'model':db[_0x6c99('0x6f')],'as':_0x6c99('0x70')}]})[_0x6c99('0x2c')](handleEntityNotFound(_0x9e288b,null))[_0x6c99('0x2c')](function(_0x2891a1){if(_0x2891a1){_0x1712ed=_0x2891a1;return db[_0x6c99('0x63')][_0x6c99('0x36')];}})['then'](function(_0x36e1d5){if(_0x36e1d5){var _0x312993={};var _0xd0b0a6={};_0xd0b0a6[_0x6c99('0x3d')]=_[_0x6c99('0x71')](_['keys'](_0x36e1d5),_['map'](_0x1712ed[_0x6c99('0x70')],function(_0x5b0786){return util[_0x6c99('0x72')](_0x6c99('0x73'),_0x5b0786['id']);}));_0xd0b0a6['query']=_[_0x6c99('0x51')](_0x315af5['query']);_0xd0b0a6['filters']=_[_0x6c99('0x3c')](_0xd0b0a6['model'],_0xd0b0a6['query']);_0x312993[_0x6c99('0x3e')]=_['intersection'](_0xd0b0a6['model'],qs[_0x6c99('0x3f')](_0x315af5[_0x6c99('0x3a')][_0x6c99('0x3f')]));_0x312993[_0x6c99('0x3e')]=_0x312993['attributes'][_0x6c99('0x40')]?_0x312993[_0x6c99('0x3e')]:_0xd0b0a6[_0x6c99('0x3d')];if(!_0x315af5[_0x6c99('0x3a')][_0x6c99('0x41')](_0x6c99('0x42'))){_0x312993['limit']=qs['limit'](_0x315af5[_0x6c99('0x3a')][_0x6c99('0x25')]);_0x312993['offset']=qs[_0x6c99('0x23')](_0x315af5[_0x6c99('0x3a')]['offset']);}_0x312993[_0x6c99('0x60')]=qs[_0x6c99('0x43')](_0x315af5['query'][_0x6c99('0x43')]);_0x312993[_0x6c99('0x44')]=qs[_0x6c99('0x3b')](_['pick'](_0x315af5[_0x6c99('0x3a')],_0xd0b0a6['filters']));_0x312993['raw']=!![];if(_0x315af5[_0x6c99('0x3a')][_0x6c99('0x46')]){_0x312993[_0x6c99('0x44')]=_[_0x6c99('0x47')](_0x312993[_0x6c99('0x44')],{'$or':_['map'](_0x312993[_0x6c99('0x3e')],function(_0x27c995){var _0x36968d={};_0x36968d[_0x27c995]={'$like':'%'+_0x315af5[_0x6c99('0x3a')][_0x6c99('0x46')]+'%'};return _0x36968d;})});}_0x312993=_['merge']({},_0x312993,_0x315af5[_0x6c99('0x52')]);return _0x1712ed[_0x6c99('0x6e')](_0x312993);}})['then'](respondWithResult(_0x9e288b,null))[_0x6c99('0x4e')](handleError(_0x9e288b,null));};exports['getContactsCsv']=function(_0x10918b,_0x25deff,_0x467a15){var _0xbdd544;var _0x333bf7;var _0x3ed1b5;var _0x361108=_0x10918b['params']['id'];csv_results=[];return db[_0x6c99('0x74')]['findAll']({'attributes':['id',_0x6c99('0x32')],'raw':!![],'order':[_0x6c99('0x75')]})[_0x6c99('0x2c')](function(_0x168bc8){_0xbdd544=_0x168bc8;var _0x5b09e7=_[_0x6c99('0x51')](db[_0x6c99('0x63')][_0x6c99('0x36')]);return db[_0x6c99('0x6f')][_0x6c99('0x4c')]({'raw':!![],'attributes':['id',_0x6c99('0x76')]})[_0x6c99('0x2c')](function(_0x29033a){_0x333bf7=_0x29033a;var _0x345fbd=squel['select']()[_0x6c99('0x3f')](_0x5b09e7)[_0x6c99('0x77')](_0x6c99('0x78'),'c')[_0x6c99('0x44')]('c.ListId\x20=\x20?',_0x361108)['where'](_0x6c99('0x79'))[_0x6c99('0x7a')]();for(var _0x5b83b8=0x0;_0x5b83b8<_0x333bf7[_0x6c99('0x40')];_0x5b83b8++){_0x345fbd[_0x6c99('0x7b')](_0x6c99('0x7c')+_0x333bf7[_0x5b83b8]['id'],_0x6c99('0x7d')+_0x333bf7[_0x5b83b8][_0x6c99('0x76')]);}for(var _0x5b83b8=0x0;_0x5b83b8<_0xbdd544['length'];_0x5b83b8++){_0x345fbd[_0x6c99('0x7b')](squel[_0x6c99('0x7e')]()['field'](_0x6c99('0x7f'))[_0x6c99('0x77')]('cm_contact_has_items')[_0x6c99('0x44')]('ItemTypeId\x20=\x20?',_0xbdd544[_0x5b83b8]['id'])[_0x6c99('0x44')](_0x6c99('0x80')),'additionalPhone_'+_0xbdd544[_0x5b83b8][_0x6c99('0x32')]);_0x345fbd['field'](squel[_0x6c99('0x7e')]()['field'](_0x6c99('0x81'))['from']('cm_contact_has_items')[_0x6c99('0x44')](_0x6c99('0x82'),_0xbdd544[_0x5b83b8]['id'])['where']('CmContactId\x20=\x20c.id'),'description_additionalPhone_'+_0xbdd544[_0x5b83b8][_0x6c99('0x32')]);}var _0x342f0=[];_0x342f0[_0x6c99('0x66')](_0x345fbd[_0x6c99('0x83')]());BPromise[_0x6c99('0x67')](_0x342f0,handleQuery)['then'](function(_0x428701){handleQuery(_0x345fbd[_0x6c99('0x83')]());var _0xe38f4c=csv_results[0x0];if(!_['isEmpty'](_0xe38f4c)){var _0x3c8fb9=toCsv(_0xe38f4c);var _0x440d64=Date[_0x6c99('0x84')]();fs[_0x6c99('0x85')](util['format'](_0x6c99('0x86'),_0x361108,_0x440d64),_0x3c8fb9);_0x25deff[_0x6c99('0x87')](_0x6c99('0x88'),_0x6c99('0x89')+util[_0x6c99('0x72')](_0x6c99('0x8a'),_0x361108,_0x440d64));_0x25deff[_0x6c99('0x87')](_0x6c99('0x8b'),_0x6c99('0x8c'));return _0x25deff[_0x6c99('0x8d')](util[_0x6c99('0x72')](_0x6c99('0x86'),_0x361108,_0x440d64));}else{return _0x25deff[_0x6c99('0x8e')](0xcc);}});});});};exports['addCustomField']=function(_0x1cc69a,_0x369654,_0x51f810){var _0x36e1e0;delete _0x1cc69a['body']['id'];return db[_0x6c99('0x35')][_0x6c99('0x5f')]({'where':{'id':_0x1cc69a[_0x6c99('0x50')]['id']}})[_0x6c99('0x2c')](handleEntityNotFound(_0x369654,null))[_0x6c99('0x2c')](function(_0x32a2b7){if(_0x32a2b7){return db['sequelize'][_0x6c99('0x8f')](function(_0x74b63){return db[_0x6c99('0x6f')][_0x6c99('0x54')](_0x1cc69a['body'],{'transaction':_0x74b63})[_0x6c99('0x2c')](function(_0x18743c){_0x36e1e0=_0x18743c;return _0x32a2b7[_0x6c99('0x90')](_0x18743c,{'transaction':_0x74b63});})[_0x6c99('0x2c')](function(){var _0x199eef={'type':db[_0x6c99('0x91')][_0x6c99('0x92')],'transaction':_0x74b63};switch(_0x1cc69a['body'][_0x6c99('0x48')]){case _0x6c99('0x93'):_0x199eef[_0x6c99('0x48')]=db[_0x6c99('0x91')][_0x6c99('0x92')];break;case'number':_0x199eef[_0x6c99('0x48')]=db[_0x6c99('0x91')][_0x6c99('0x94')];break;case _0x6c99('0x95'):_0x199eef[_0x6c99('0x48')]=db[_0x6c99('0x91')][_0x6c99('0x96')];_0x199eef[_0x6c99('0x97')]=![];break;default:}return db['sequelize'][_0x6c99('0x98')][_0x6c99('0x99')]('cm_contacts',util[_0x6c99('0x72')](_0x6c99('0x9a'),_0x36e1e0['id']),_0x199eef);})['then'](function(){return _0x36e1e0;});});}})['then'](respondWithResult(_0x369654,null))['catch'](handleError(_0x369654,null));};exports[_0x6c99('0x9b')]=function(_0x2ed66c,_0x3ffe1b,_0x420767){var _0x222e0d={};var _0x532c92={};var _0x3f0d8f;var _0x349cbf;return db[_0x6c99('0x35')]['findOne']({'where':{'id':_0x2ed66c['params']['id']}})['then'](handleEntityNotFound(_0x3ffe1b,null))[_0x6c99('0x2c')](function(_0x5335e7){if(_0x5335e7){_0x3f0d8f=_0x5335e7;_0x532c92[_0x6c99('0x3d')]=_['keys'](db[_0x6c99('0x6f')][_0x6c99('0x36')]);_0x532c92[_0x6c99('0x3a')]=_['keys'](_0x2ed66c[_0x6c99('0x3a')]);_0x532c92[_0x6c99('0x3b')]=_[_0x6c99('0x3c')](_0x532c92[_0x6c99('0x3d')],_0x532c92[_0x6c99('0x3a')]);_0x222e0d[_0x6c99('0x3e')]=_[_0x6c99('0x3c')](_0x532c92[_0x6c99('0x3d')],qs[_0x6c99('0x3f')](_0x2ed66c[_0x6c99('0x3a')][_0x6c99('0x3f')]));_0x222e0d['attributes']=_0x222e0d[_0x6c99('0x3e')][_0x6c99('0x40')]?_0x222e0d[_0x6c99('0x3e')]:_0x532c92[_0x6c99('0x3d')];_0x222e0d['order']=qs['sort'](_0x2ed66c[_0x6c99('0x3a')][_0x6c99('0x43')]);_0x222e0d['where']=qs[_0x6c99('0x3b')](_[_0x6c99('0x45')](_0x2ed66c[_0x6c99('0x3a')],_0x532c92[_0x6c99('0x3b')]));_0x222e0d[_0x6c99('0x44')]=_[_0x6c99('0x47')](_0x222e0d[_0x6c99('0x44')],{'$or':[{'ListId':_0x5335e7['id']},{'ListId':null}]});if(_0x2ed66c['query'][_0x6c99('0x46')]){_0x222e0d[_0x6c99('0x44')]=_[_0x6c99('0x47')](_0x222e0d[_0x6c99('0x44')],{'$or':_['map'](_0x222e0d[_0x6c99('0x3e')],function(_0x12004c){var _0x3c41c7={};_0x3c41c7[_0x12004c]={'$like':'%'+_0x2ed66c[_0x6c99('0x3a')][_0x6c99('0x46')]+'%'};return _0x3c41c7;})});}_0x222e0d=_[_0x6c99('0x47')]({},_0x222e0d,_0x2ed66c['options']);return db['CmCustomField'][_0x6c99('0x9c')](_0x222e0d);}})['then'](respondWithResult(_0x3ffe1b,null))[_0x6c99('0x4e')](handleError(_0x3ffe1b,null));};exports[_0x6c99('0x9d')]=function(_0x116ab6,_0x2eb6a5){return db[_0x6c99('0x6f')][_0x6c99('0x9c')]({'where':{'ListId':null}})[_0x6c99('0x2c')](handleEntityNotFound(_0x2eb6a5,null))['then'](function(_0x9b3f9a){return _0x9b3f9a;})[_0x6c99('0x2c')](respondWithResult(_0x2eb6a5,null))[_0x6c99('0x4e')](handleError(_0x2eb6a5,null));};exports['addAgents']=function(_0x5a8085,_0x32641b,_0x217454){return db[_0x6c99('0x35')]['find']({'where':{'id':_0x5a8085[_0x6c99('0x50')]['id']}})[_0x6c99('0x2c')](handleEntityNotFound(_0x32641b,null))['then'](function(_0x4ab4e7){if(_0x4ab4e7){return _0x4ab4e7[_0x6c99('0x9e')](_0x5a8085['body'][_0x6c99('0x69')],_['omit'](_0x5a8085['body'],[_0x6c99('0x69'),'id'])||{})[_0x6c99('0x9f')](function(_0x1668ec){for(var _0x32d0e8=0x0;_0x32d0e8<_0x5a8085['body']['ids']['length'];_0x32d0e8+=0x1){socket[_0x6c99('0xa0')](_0x6c99('0xa1'),{'UserId':Number(_0x5a8085[_0x6c99('0x5b')]['ids'][_0x32d0e8]),'CmListId':Number(_0x5a8085[_0x6c99('0x50')]['id'])});}return _0x1668ec;});}})[_0x6c99('0x2c')](respondWithResult(_0x32641b,null))[_0x6c99('0x4e')](handleError(_0x32641b,null));};exports[_0x6c99('0xa2')]=function(_0x39664a,_0x3e4d9f,_0x1f0091){return db[_0x6c99('0x35')][_0x6c99('0x53')]({'where':{'id':_0x39664a['params']['id']}})[_0x6c99('0x2c')](handleEntityNotFound(_0x3e4d9f,null))[_0x6c99('0x2c')](function(_0x324fe8){if(_0x324fe8){return _0x324fe8[_0x6c99('0xa2')](_0x39664a[_0x6c99('0x3a')][_0x6c99('0x69')])['then'](function(){if(_[_0x6c99('0xa3')](_0x39664a['query'][_0x6c99('0x69')])){for(var _0x164835=0x0;_0x164835<_0x39664a[_0x6c99('0x3a')]['ids']['length'];_0x164835+=0x1){socket[_0x6c99('0xa0')](_0x6c99('0xa4'),{'UserId':Number(_0x39664a['query']['ids'][_0x164835]),'CmListId':Number(_0x39664a['params']['id'])});}}else{socket[_0x6c99('0xa0')]('userCmList:remove',{'UserId':Number(_0x39664a[_0x6c99('0x3a')][_0x6c99('0x69')]),'CmListId':Number(_0x39664a['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3e4d9f,null))[_0x6c99('0x4e')](handleError(_0x3e4d9f,null));};exports['getAgents']=function(_0x4cfc33,_0x3d68c2,_0x295bcc){var _0x43f646={};var _0x3cbb82={};var _0x5f2e0b;var _0x4581ad;return db[_0x6c99('0x35')][_0x6c99('0x5f')]({'where':{'id':_0x4cfc33['params']['id']}})[_0x6c99('0x2c')](handleEntityNotFound(_0x3d68c2,null))[_0x6c99('0x2c')](function(_0x1c482c){if(_0x1c482c){_0x5f2e0b=_0x1c482c;_0x3cbb82[_0x6c99('0x3d')]=_['keys'](db['User']['rawAttributes']);_0x3cbb82[_0x6c99('0x3a')]=_['keys'](_0x4cfc33['query']);_0x3cbb82[_0x6c99('0x3b')]=_[_0x6c99('0x3c')](_0x3cbb82[_0x6c99('0x3d')],_0x3cbb82[_0x6c99('0x3a')]);_0x43f646[_0x6c99('0x3e')]=_[_0x6c99('0x3c')](_0x3cbb82['model'],qs[_0x6c99('0x3f')](_0x4cfc33['query']['fields']));_0x43f646[_0x6c99('0x3e')]=_0x43f646[_0x6c99('0x3e')][_0x6c99('0x40')]?_0x43f646[_0x6c99('0x3e')]:_0x3cbb82[_0x6c99('0x3d')];_0x43f646[_0x6c99('0x60')]=qs[_0x6c99('0x43')](_0x4cfc33[_0x6c99('0x3a')][_0x6c99('0x43')]);_0x43f646[_0x6c99('0x44')]=qs[_0x6c99('0x3b')](_['pick'](_0x4cfc33['query'],_0x3cbb82[_0x6c99('0x3b')]));if(_0x4cfc33[_0x6c99('0x3a')]['filter']){_0x43f646['where']=_[_0x6c99('0x47')](_0x43f646[_0x6c99('0x44')],{'$or':_[_0x6c99('0x39')](_0x43f646[_0x6c99('0x3e')],function(_0x320713){var _0x97a3fc={};_0x97a3fc[_0x320713]={'$like':'%'+_0x4cfc33[_0x6c99('0x3a')]['filter']+'%'};return _0x97a3fc;})});}_0x43f646=_['merge']({},_0x43f646,_0x4cfc33[_0x6c99('0x52')]);return _0x5f2e0b['getAgents'](_0x43f646);}})[_0x6c99('0x2c')](function(_0x5c88ea){if(_0x5c88ea){_0x4581ad=_0x5c88ea[_0x6c99('0x40')];if(!_0x4cfc33[_0x6c99('0x3a')][_0x6c99('0x41')](_0x6c99('0x42'))){_0x43f646['limit']=qs[_0x6c99('0x25')](_0x4cfc33[_0x6c99('0x3a')][_0x6c99('0x25')]);_0x43f646[_0x6c99('0x23')]=qs[_0x6c99('0x23')](_0x4cfc33[_0x6c99('0x3a')][_0x6c99('0x23')]);}return _0x5f2e0b[_0x6c99('0xa5')](_0x43f646);}})[_0x6c99('0x2c')](function(_0x54f226){if(_0x54f226){return _0x54f226?{'count':_0x4581ad,'rows':_0x54f226}:null;}})[_0x6c99('0x2c')](respondWithResult(_0x3d68c2,null))[_0x6c99('0x4e')](handleError(_0x3d68c2,null));};function handleQuery(_0x1c25e4){logger[_0x6c99('0xa6')](_0x1c25e4);return db[_0x6c99('0xa7')][_0x6c99('0x3a')](_0x1c25e4)[_0x6c99('0x9f')](function(_0x388753){csv_results['push'](_0x388753);})['catch'](function(_0x304a86){logger[_0x6c99('0x30')](_0x304a86[_0x6c99('0xa8')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 1f5135e..1b932bb 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 _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe14b,0x93));var _0xbe14=function(_0x9c6362,_0x1ef30a){_0x9c6362=_0x9c6362-0x0;var _0x3f6b91=_0xe14b[_0x9c6362];return _0x3f6b91;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file +var _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x17541e,_0x46df72){var _0x1c17eb=function(_0x5f1d1e){while(--_0x5f1d1e){_0x17541e['push'](_0x17541e['shift']());}};_0x1c17eb(++_0x46df72);}(_0x7217,0x19e));var _0x7721=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x7217[_0x34bf97];return _0x292719;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 10f1622..275c46b 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 _0xac4a=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cmList.attributes','define','cm_lists'];(function(_0x14c6e9,_0x399222){var _0x4c1eed=function(_0x167ceb){while(--_0x167ceb){_0x14c6e9['push'](_0x14c6e9['shift']());}};_0x4c1eed(++_0x399222);}(_0xac4a,0x13f));var _0xaac4=function(_0x4ce2dc,_0x3c39af){_0x4ce2dc=_0x4ce2dc-0x0;var _0x19f585=_0xac4a[_0x4ce2dc];return _0x19f585;};'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 +var _0xe706=['request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util','../../config/logger','moment','bluebird'];(function(_0x22183a,_0x1aad62){var _0x48ff64=function(_0x204a8b){while(--_0x204a8b){_0x22183a['push'](_0x22183a['shift']());}};_0x48ff64(++_0x1aad62);}(_0xe706,0xa3));var _0x6e70=function(_0x204d21,_0x5d3952){_0x204d21=_0x204d21-0x0;var _0x55df50=_0xe706[_0x204d21];return _0x55df50;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index e8c4b15..81a9a6a 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 _0x7f38=['info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','redis','./cmList.socket','register','then'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x7f38,0x1ec));var _0x87f3=function(_0x373e4f,_0x55a083){_0x373e4f=_0x373e4f-0x0;var _0x53c41e=_0x7f38[_0x373e4f];return _0x53c41e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x87f3('0x0'));var BPromise=require(_0x87f3('0x1'));var rs=require(_0x87f3('0x2'));var fs=require('fs');var Redis=require(_0x87f3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x87f3('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x87f3('0x5'));var jayson=require(_0x87f3('0x6'));var client=jayson[_0x87f3('0x7')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x87f3('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x87f3('0x8')]));require(_0x87f3('0x9'))[_0x87f3('0xa')](socket);function respondWithRpcPromise(_0x228728,_0x4e9180,_0x4d7af7){return new BPromise(function(_0x102197,_0xc1bcf){return client['request'](_0x228728,_0x4d7af7)[_0x87f3('0xb')](function(_0x2d4c0e){logger[_0x87f3('0xc')](_0x87f3('0xd'),_0x4e9180,'request\x20sent');logger[_0x87f3('0xe')](_0x87f3('0xf'),_0x4e9180,_0x87f3('0x10'),JSON[_0x87f3('0x11')](_0x2d4c0e));if(_0x2d4c0e['error']){if(_0x2d4c0e[_0x87f3('0x12')]['code']===0x1f4){logger[_0x87f3('0x12')](_0x87f3('0xd'),_0x4e9180,_0x2d4c0e[_0x87f3('0x12')]['message']);return _0xc1bcf(_0x2d4c0e[_0x87f3('0x12')][_0x87f3('0x13')]);}logger[_0x87f3('0x12')](_0x87f3('0xd'),_0x4e9180,_0x2d4c0e[_0x87f3('0x12')]['message']);return _0x102197(_0x2d4c0e[_0x87f3('0x12')][_0x87f3('0x13')]);}else{logger[_0x87f3('0xc')](_0x87f3('0xd'),_0x4e9180,_0x87f3('0x10'));_0x102197(_0x2d4c0e['result'][_0x87f3('0x13')]);}})[_0x87f3('0x14')](function(_0x305e4c){logger[_0x87f3('0x12')]('CmList,\x20%s,\x20%s',_0x4e9180,_0x305e4c);_0xc1bcf(_0x305e4c);});});} \ No newline at end of file +var _0x5d5c=['request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\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','redis','defaults','localhost','./cmList.socket','register'];(function(_0x447b23,_0x49c577){var _0x2f37c7=function(_0x19d049){while(--_0x19d049){_0x447b23['push'](_0x447b23['shift']());}};_0x2f37c7(++_0x49c577);}(_0x5d5c,0x1cf));var _0xc5d5=function(_0xccf869,_0x2556a5){_0xccf869=_0xccf869-0x0;var _0x21a9db=_0x5d5c[_0xccf869];return _0x21a9db;};'use strict';var _=require(_0xc5d5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc5d5('0x1'));var rs=require(_0xc5d5('0x2'));var fs=require('fs');var Redis=require(_0xc5d5('0x3'));var db=require(_0xc5d5('0x4'))['db'];var utils=require(_0xc5d5('0x5'));var logger=require(_0xc5d5('0x6'))(_0xc5d5('0x7'));var config=require(_0xc5d5('0x8'));var jayson=require(_0xc5d5('0x9'));var client=jayson[_0xc5d5('0xa')][_0xc5d5('0xb')]({'port':0x232a});config[_0xc5d5('0xc')]=_[_0xc5d5('0xd')](config[_0xc5d5('0xc')],{'host':_0xc5d5('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc5d5('0xc')]));require(_0xc5d5('0xf'))[_0xc5d5('0x10')](socket);function respondWithRpcPromise(_0x107bde,_0x8805bf,_0x4023bf){return new BPromise(function(_0x104dfa,_0x17a04c){return client[_0xc5d5('0x11')](_0x107bde,_0x4023bf)[_0xc5d5('0x12')](function(_0x555af7){logger[_0xc5d5('0x13')](_0xc5d5('0x14'),_0x8805bf,_0xc5d5('0x15'));logger[_0xc5d5('0x16')](_0xc5d5('0x17'),_0x8805bf,'request\x20sent',JSON[_0xc5d5('0x18')](_0x555af7));if(_0x555af7['error']){if(_0x555af7[_0xc5d5('0x19')][_0xc5d5('0x1a')]===0x1f4){logger['error'](_0xc5d5('0x14'),_0x8805bf,_0x555af7[_0xc5d5('0x19')][_0xc5d5('0x1b')]);return _0x17a04c(_0x555af7[_0xc5d5('0x19')][_0xc5d5('0x1b')]);}logger['error'](_0xc5d5('0x14'),_0x8805bf,_0x555af7[_0xc5d5('0x19')]['message']);return _0x104dfa(_0x555af7[_0xc5d5('0x19')][_0xc5d5('0x1b')]);}else{logger['info'](_0xc5d5('0x14'),_0x8805bf,_0xc5d5('0x15'));_0x104dfa(_0x555af7[_0xc5d5('0x1c')][_0xc5d5('0x1b')]);}})[_0xc5d5('0x1d')](function(_0xc34858){logger[_0xc5d5('0x19')](_0xc5d5('0x14'),_0x8805bf,_0xc34858);_0x17a04c(_0xc34858);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 466c9a7..bad5a88 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 _0x25ef=['remove','update','emit','removeListener','register','length','cmList:','./cmList.events'];(function(_0x2ffcdf,_0x5e8cc6){var _0x2715aa=function(_0x588b1f){while(--_0x588b1f){_0x2ffcdf['push'](_0x2ffcdf['shift']());}};_0x2715aa(++_0x5e8cc6);}(_0x25ef,0xf7));var _0xf25e=function(_0x477864,_0x2fc625){_0x477864=_0x477864-0x0;var _0x37d121=_0x25ef[_0x477864];return _0x37d121;};'use strict';var CmListEvents=require(_0xf25e('0x0'));var events=['save',_0xf25e('0x1'),_0xf25e('0x2')];function createListener(_0x23c690,_0x55b7bb){return function(_0x212544){_0x55b7bb[_0xf25e('0x3')](_0x23c690,_0x212544);};}function removeListener(_0x58f621,_0x5806b6){return function(){CmListEvents[_0xf25e('0x4')](_0x58f621,_0x5806b6);};}exports[_0xf25e('0x5')]=function(_0x148f96){for(var _0x47f98a=0x0,_0x3d5a1a=events[_0xf25e('0x6')];_0x47f98a<_0x3d5a1a;_0x47f98a++){var _0x706c6c=events[_0x47f98a];var _0x15500a=createListener(_0xf25e('0x7')+_0x706c6c,_0x148f96);CmListEvents['on'](_0x706c6c,_0x15500a);}}; \ No newline at end of file +var _0x36cb=['remove','update','emit','register','./cmList.events','save'];(function(_0x1d3c84,_0x27447d){var _0x211702=function(_0x39d180){while(--_0x39d180){_0x1d3c84['push'](_0x1d3c84['shift']());}};_0x211702(++_0x27447d);}(_0x36cb,0x70));var _0xb36c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x36cb[_0x42cae2];return _0x5f256f;};'use strict';var CmListEvents=require(_0xb36c('0x0'));var events=[_0xb36c('0x1'),_0xb36c('0x2'),_0xb36c('0x3')];function createListener(_0x4a70b7,_0x337e40){return function(_0x1fa7db){_0x337e40[_0xb36c('0x4')](_0x4a70b7,_0x1fa7db);};}function removeListener(_0x2952ad,_0x270611){return function(){CmListEvents['removeListener'](_0x2952ad,_0x270611);};}exports[_0xb36c('0x5')]=function(_0x1cc3bd){for(var _0xe83503=0x0,_0x268077=events['length'];_0xe83503<_0x268077;_0xe83503++){var _0x644fec=events[_0xe83503];var _0x275ba8=createListener('cmList:'+_0x644fec,_0x1cc3bd);CmListEvents['on'](_0x644fec,_0x275ba8);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 13bc9a9..280bab1 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 _0xcfee=['addDisposition','addContacts','addCustomField','/:id/users','addAgents','put','delete','destroy','removeAgents','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','index','/describe','describe','get','/global_fields','/:id','/:id/dispositions','/:id/contacts','getContacts','/:id/fields','getCustomFields','getAgents','post'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xcfee,0x175));var _0xecfe=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xcfee[_0x46e363];return _0x3fb059;};'use strict';var multer=require('multer');var util=require(_0xecfe('0x0'));var path=require(_0xecfe('0x1'));var timeout=require(_0xecfe('0x2'));var express=require(_0xecfe('0x3'));var router=express['Router']();var fs_extra=require(_0xecfe('0x4'));var auth=require(_0xecfe('0x5'));var interaction=require(_0xecfe('0x6'));var config=require(_0xecfe('0x7'));var controller=require(_0xecfe('0x8'));router['get']('/',auth[_0xecfe('0x9')](),controller[_0xecfe('0xa')]);router['get'](_0xecfe('0xb'),auth[_0xecfe('0x9')](),controller[_0xecfe('0xc')]);router[_0xecfe('0xd')](_0xecfe('0xe'),auth[_0xecfe('0x9')](),controller['getGlobalCustomFields']);router['get'](_0xecfe('0xf'),auth[_0xecfe('0x9')](),controller['show']);router[_0xecfe('0xd')](_0xecfe('0x10'),auth[_0xecfe('0x9')](),controller['getDispositions']);router[_0xecfe('0xd')](_0xecfe('0x11'),auth[_0xecfe('0x9')](),controller[_0xecfe('0x12')]);router[_0xecfe('0xd')]('/:id/contacts/csv',auth[_0xecfe('0x9')](),controller['getContactsCsv']);router['get'](_0xecfe('0x13'),auth[_0xecfe('0x9')](),controller[_0xecfe('0x14')]);router[_0xecfe('0xd')]('/:id/users',auth[_0xecfe('0x9')](),controller[_0xecfe('0x15')]);router[_0xecfe('0x16')]('/',auth[_0xecfe('0x9')](),controller['create']);router[_0xecfe('0x16')](_0xecfe('0x10'),auth[_0xecfe('0x9')](),controller[_0xecfe('0x17')]);router[_0xecfe('0x16')](_0xecfe('0x11'),auth[_0xecfe('0x9')](),controller[_0xecfe('0x18')]);router[_0xecfe('0x16')](_0xecfe('0x13'),auth[_0xecfe('0x9')](),controller[_0xecfe('0x19')]);router[_0xecfe('0x16')](_0xecfe('0x1a'),auth[_0xecfe('0x9')](),controller[_0xecfe('0x1b')]);router[_0xecfe('0x1c')](_0xecfe('0xf'),auth[_0xecfe('0x9')](),controller['update']);router[_0xecfe('0x1d')](_0xecfe('0xf'),auth[_0xecfe('0x9')](),controller[_0xecfe('0x1e')]);router[_0xecfe('0x1d')](_0xecfe('0x10'),auth[_0xecfe('0x9')](),controller['removeDispositions']);router[_0xecfe('0x1d')](_0xecfe('0x1a'),auth[_0xecfe('0x9')](),controller[_0xecfe('0x1f')]);module[_0xecfe('0x20')]=router; \ No newline at end of file +var _0xb7df=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','/global_fields','getGlobalCustomFields','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','getAgents','create','post','addContacts','addCustomField','/:id','update','delete','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x1a21ff,_0x4a7550){var _0x25afc1=function(_0x4a66ec){while(--_0x4a66ec){_0x1a21ff['push'](_0x1a21ff['shift']());}};_0x25afc1(++_0x4a7550);}(_0xb7df,0xf6));var _0xfb7d=function(_0x3a7501,_0x537066){_0x3a7501=_0x3a7501-0x0;var _0x3205a4=_0xb7df[_0x3a7501];return _0x3205a4;};'use strict';var multer=require(_0xfb7d('0x0'));var util=require(_0xfb7d('0x1'));var path=require(_0xfb7d('0x2'));var timeout=require(_0xfb7d('0x3'));var express=require(_0xfb7d('0x4'));var router=express[_0xfb7d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfb7d('0x6'));var interaction=require(_0xfb7d('0x7'));var config=require(_0xfb7d('0x8'));var controller=require(_0xfb7d('0x9'));router[_0xfb7d('0xa')]('/',auth[_0xfb7d('0xb')](),controller[_0xfb7d('0xc')]);router[_0xfb7d('0xa')](_0xfb7d('0xd'),auth[_0xfb7d('0xb')](),controller['describe']);router['get'](_0xfb7d('0xe'),auth[_0xfb7d('0xb')](),controller[_0xfb7d('0xf')]);router[_0xfb7d('0xa')]('/:id',auth[_0xfb7d('0xb')](),controller[_0xfb7d('0x10')]);router[_0xfb7d('0xa')](_0xfb7d('0x11'),auth['isAuthenticated'](),controller[_0xfb7d('0x12')]);router[_0xfb7d('0xa')](_0xfb7d('0x13'),auth['isAuthenticated'](),controller[_0xfb7d('0x14')]);router[_0xfb7d('0xa')](_0xfb7d('0x15'),auth[_0xfb7d('0xb')](),controller['getContactsCsv']);router[_0xfb7d('0xa')](_0xfb7d('0x16'),auth[_0xfb7d('0xb')](),controller[_0xfb7d('0x17')]);router[_0xfb7d('0xa')](_0xfb7d('0x18'),auth[_0xfb7d('0xb')](),controller[_0xfb7d('0x19')]);router['post']('/',auth[_0xfb7d('0xb')](),controller[_0xfb7d('0x1a')]);router[_0xfb7d('0x1b')](_0xfb7d('0x11'),auth[_0xfb7d('0xb')](),controller['addDisposition']);router[_0xfb7d('0x1b')](_0xfb7d('0x13'),auth['isAuthenticated'](),controller[_0xfb7d('0x1c')]);router['post'](_0xfb7d('0x16'),auth[_0xfb7d('0xb')](),controller[_0xfb7d('0x1d')]);router[_0xfb7d('0x1b')](_0xfb7d('0x18'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xfb7d('0x1e'),auth[_0xfb7d('0xb')](),controller[_0xfb7d('0x1f')]);router[_0xfb7d('0x20')](_0xfb7d('0x1e'),auth[_0xfb7d('0xb')](),controller['destroy']);router[_0xfb7d('0x20')](_0xfb7d('0x11'),auth[_0xfb7d('0xb')](),controller[_0xfb7d('0x21')]);router['delete'](_0xfb7d('0x18'),auth[_0xfb7d('0xb')](),controller[_0xfb7d('0x22')]);module[_0xfb7d('0x23')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 79e52d5..19b5b19 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 _0x8abb=['STRING','sequelize','getDataValue','field'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x8abb,0x17d));var _0xb8ab=function(_0x51b06a,_0x69bfa5){_0x51b06a=_0x51b06a-0x0;var _0xa2336c=_0x8abb[_0x51b06a];return _0xa2336c;};'use strict';var Sequelize=require(_0xb8ab('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5c1158){return this[_0xb8ab('0x1')](_0xb8ab('0x2'));}},'field':{'type':Sequelize[_0xb8ab('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0xb8ab('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0xb8ab('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0xddbc=['getDataValue','field','STRING','sequelize','exports','VIRTUAL'];(function(_0x104e21,_0x2ea86f){var _0x605b37=function(_0x580fce){while(--_0x580fce){_0x104e21['push'](_0x104e21['shift']());}};_0x605b37(++_0x2ea86f);}(_0xddbc,0xbd));var _0xcddb=function(_0xecaf71,_0x3905af){_0xecaf71=_0xecaf71-0x0;var _0x25b220=_0xddbc[_0xecaf71];return _0x25b220;};'use strict';var Sequelize=require(_0xcddb('0x0'));module[_0xcddb('0x1')]={'name':{'type':Sequelize[_0xcddb('0x2')],'get':function(_0x52f533){return this[_0xcddb('0x3')](_0xcddb('0x4'));}},'field':{'type':Sequelize[_0xcddb('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0xcddb('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0xcddb('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 bafb1dd..a956627 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 _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x5e3df5,_0x34b435){var _0x2bc2f6=function(_0x28644b){while(--_0x28644b){_0x5e3df5['push'](_0x5e3df5['shift']());}};_0x2bc2f6(++_0x34b435);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +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(_0x1b1237,_0x4a8e35){var _0x1d96bc=function(_0x5c4442){while(--_0x5c4442){_0x1b1237['push'](_0x1b1237['shift']());}};_0x1d96bc(++_0x4a8e35);}(_0x7a54,0x106));var _0x47a5=function(_0x1f6afc,_0x201fac){_0x1f6afc=_0x1f6afc-0x0;var _0x58c863=_0x7a54[_0x1f6afc];return _0x58c863;};'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 99460b5..bc8ba87 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 _0x64ce=['define','Condition','tools_conditions','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports'];(function(_0x2dc81b,_0x2063ae){var _0x3a2946=function(_0x398317){while(--_0x398317){_0x2dc81b['push'](_0x2dc81b['shift']());}};_0x3a2946(++_0x2063ae);}(_0x64ce,0xc3));var _0xe64c=function(_0x1b96c9,_0x166085){_0x1b96c9=_0x1b96c9-0x0;var _0x534a56=_0x64ce[_0x1b96c9];return _0x534a56;};'use strict';var _=require(_0xe64c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe64c('0x1'));var moment=require('moment');var BPromise=require(_0xe64c('0x2'));var rp=require(_0xe64c('0x3'));var fs=require('fs');var path=require(_0xe64c('0x4'));var rimraf=require(_0xe64c('0x5'));var config=require(_0xe64c('0x6'));var attributes=require(_0xe64c('0x7'));module[_0xe64c('0x8')]=function(_0xb95a34,_0x56f6b5){return _0xb95a34[_0xe64c('0x9')](_0xe64c('0xa'),attributes,{'tableName':_0xe64c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85b7=['request-promise','path','rimraf','../../config/environment','./condition.attributes','lodash','util','bluebird'];(function(_0x1d350c,_0x5c71a3){var _0x309b19=function(_0x2158f2){while(--_0x2158f2){_0x1d350c['push'](_0x1d350c['shift']());}};_0x309b19(++_0x5c71a3);}(_0x85b7,0x195));var _0x785b=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x85b7[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x785b('0x0'));var util=require(_0x785b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x785b('0x2'));var rp=require(_0x785b('0x3'));var fs=require('fs');var path=require(_0x785b('0x4'));var rimraf=require(_0x785b('0x5'));var config=require(_0x785b('0x6'));var attributes=require(_0x785b('0x7'));module['exports']=function(_0x2a9844,_0xfef705){return _0x2a9844['define']('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 00fa853..b2aad15 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 _0x2578=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird'];(function(_0x44e054,_0x2b8042){var _0x244f0e=function(_0x5e001c){while(--_0x5e001c){_0x44e054['push'](_0x44e054['shift']());}};_0x244f0e(++_0x2b8042);}(_0x2578,0x1b2));var _0x8257=function(_0x547a87,_0x4d4e24){_0x547a87=_0x547a87-0x0;var _0x11fde1=_0x2578[_0x547a87];return _0x11fde1;};'use strict';var _=require(_0x8257('0x0'));var util=require(_0x8257('0x1'));var moment=require('moment');var BPromise=require(_0x8257('0x2'));var rs=require(_0x8257('0x3'));var fs=require('fs');var Redis=require(_0x8257('0x4'));var db=require(_0x8257('0x5'))['db'];var utils=require(_0x8257('0x6'));var logger=require(_0x8257('0x7'))(_0x8257('0x8'));var config=require(_0x8257('0x9'));var jayson=require(_0x8257('0xa'));var client=jayson[_0x8257('0xb')][_0x8257('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x58eaed,_0x41382a,_0x4b1aa4){return new BPromise(function(_0x4439a1,_0x3b4acd){return client[_0x8257('0xd')](_0x58eaed,_0x4b1aa4)[_0x8257('0xe')](function(_0x563751){logger[_0x8257('0xf')](_0x8257('0x10'),_0x41382a,_0x8257('0x11'));logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0x41382a,_0x8257('0x11'),JSON[_0x8257('0x12')](_0x563751));if(_0x563751[_0x8257('0x13')]){if(_0x563751[_0x8257('0x13')][_0x8257('0x14')]===0x1f4){logger[_0x8257('0x13')]('Condition,\x20%s,\x20%s',_0x41382a,_0x563751['error'][_0x8257('0x15')]);return _0x3b4acd(_0x563751['error'][_0x8257('0x15')]);}logger[_0x8257('0x13')](_0x8257('0x10'),_0x41382a,_0x563751[_0x8257('0x13')]['message']);return _0x4439a1(_0x563751[_0x8257('0x13')][_0x8257('0x15')]);}else{logger[_0x8257('0xf')](_0x8257('0x10'),_0x41382a,_0x8257('0x11'));_0x4439a1(_0x563751['result'][_0x8257('0x15')]);}})[_0x8257('0x16')](function(_0x423fde){logger['error'](_0x8257('0x10'),_0x41382a,_0x423fde);_0x3b4acd(_0x423fde);});});} \ No newline at end of file +var _0x18f5=['then','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x1ce6d7,_0x59daef){var _0x23006e=function(_0x1a6997){while(--_0x1a6997){_0x1ce6d7['push'](_0x1ce6d7['shift']());}};_0x23006e(++_0x59daef);}(_0x18f5,0x14c));var _0x518f=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x18f5[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0x518f('0x0'));var util=require(_0x518f('0x1'));var moment=require('moment');var BPromise=require(_0x518f('0x2'));var rs=require(_0x518f('0x3'));var fs=require('fs');var Redis=require(_0x518f('0x4'));var db=require(_0x518f('0x5'))['db'];var utils=require(_0x518f('0x6'));var logger=require(_0x518f('0x7'))(_0x518f('0x8'));var config=require(_0x518f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x518f('0xa')][_0x518f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10146b,_0x30c2d1,_0x4d9fef){return new BPromise(function(_0x555724,_0x36cac0){return client[_0x518f('0xc')](_0x10146b,_0x4d9fef)[_0x518f('0xd')](function(_0x4825b9){logger[_0x518f('0xe')](_0x518f('0xf'),_0x30c2d1,'request\x20sent');logger[_0x518f('0x10')](_0x518f('0x11'),_0x30c2d1,_0x518f('0x12'),JSON['stringify'](_0x4825b9));if(_0x4825b9[_0x518f('0x13')]){if(_0x4825b9[_0x518f('0x13')][_0x518f('0x14')]===0x1f4){logger[_0x518f('0x13')](_0x518f('0xf'),_0x30c2d1,_0x4825b9[_0x518f('0x13')][_0x518f('0x15')]);return _0x36cac0(_0x4825b9[_0x518f('0x13')][_0x518f('0x15')]);}logger[_0x518f('0x13')](_0x518f('0xf'),_0x30c2d1,_0x4825b9[_0x518f('0x13')][_0x518f('0x15')]);return _0x555724(_0x4825b9[_0x518f('0x13')][_0x518f('0x15')]);}else{logger[_0x518f('0xe')](_0x518f('0xf'),_0x30c2d1,_0x518f('0x12'));_0x555724(_0x4825b9[_0x518f('0x16')][_0x518f('0x15')]);}})['catch'](function(_0x5ceb72){logger['error'](_0x518f('0xf'),_0x30c2d1,_0x5ceb72);_0x36cac0(_0x5ceb72);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 8479dd3..bdc15d9 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 _0x162b=['update','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','put','/:id','isAuthenticated'];(function(_0x31b57a,_0x3dddf3){var _0x2df3dd=function(_0x394522){while(--_0x394522){_0x31b57a['push'](_0x31b57a['shift']());}};_0x2df3dd(++_0x3dddf3);}(_0x162b,0x17b));var _0xb162=function(_0x322318,_0x276d64){_0x322318=_0x322318-0x0;var _0x59ce6f=_0x162b[_0x322318];return _0x59ce6f;};'use strict';var multer=require(_0xb162('0x0'));var util=require(_0xb162('0x1'));var path=require(_0xb162('0x2'));var timeout=require(_0xb162('0x3'));var express=require(_0xb162('0x4'));var router=express['Router']();var fs_extra=require(_0xb162('0x5'));var auth=require(_0xb162('0x6'));var interaction=require(_0xb162('0x7'));var config=require('../../config/environment');var controller=require('./condition.controller');router[_0xb162('0x8')](_0xb162('0x9'),auth[_0xb162('0xa')](),controller[_0xb162('0xb')]);router['delete'](_0xb162('0x9'),auth[_0xb162('0xa')](),controller[_0xb162('0xc')]);module['exports']=router; \ No newline at end of file +var _0xd97d=['/:id','multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated','update','delete'];(function(_0x4a61ad,_0x4b1e21){var _0x2a060b=function(_0x587882){while(--_0x587882){_0x4a61ad['push'](_0x4a61ad['shift']());}};_0x2a060b(++_0x4b1e21);}(_0xd97d,0x1b9));var _0xdd97=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xd97d[_0x279d37];return _0x530173;};'use strict';var multer=require(_0xdd97('0x0'));var util=require(_0xdd97('0x1'));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(_0xdd97('0x2'));var interaction=require(_0xdd97('0x3'));var config=require(_0xdd97('0x4'));var controller=require(_0xdd97('0x5'));router[_0xdd97('0x6')]('/:id',auth[_0xdd97('0x7')](),controller[_0xdd97('0x8')]);router[_0xdd97('0x9')](_0xdd97('0xa'),auth[_0xdd97('0x7')](),controller['destroy']);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 ce4dde4..87f9aee 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 _0xb3c0=['INTEGER','STRING','sequelize','exports','name'];(function(_0xf05c4d,_0x140378){var _0x14030b=function(_0x4e0fe9){while(--_0x4e0fe9){_0xf05c4d['push'](_0xf05c4d['shift']());}};_0x14030b(++_0x140378);}(_0xb3c0,0x129));var _0x0b3c=function(_0x389726,_0x282267){_0x389726=_0x389726-0x0;var _0x295a74=_0xb3c0[_0x389726];return _0x295a74;};'use strict';var Sequelize=require(_0x0b3c('0x0'));module[_0x0b3c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0b3c('0x2')},'OrderBy':{'type':Sequelize[_0x0b3c('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x0b3c('0x4')],'allowNull':!![]}}; \ No newline at end of file +var _0xa064=['STRING','name','sequelize','exports'];(function(_0x31ab90,_0x145a96){var _0x2d6123=function(_0x2bf73f){while(--_0x2bf73f){_0x31ab90['push'](_0x31ab90['shift']());}};_0x2d6123(++_0x145a96);}(_0xa064,0x19a));var _0x4a06=function(_0xf1402a,_0x187f5c){_0xf1402a=_0xf1402a-0x0;var _0x4f7ead=_0xa064[_0xf1402a];return _0x4f7ead;};'use strict';var Sequelize=require(_0x4a06('0x0'));module[_0x4a06('0x1')]={'name':{'type':Sequelize[_0x4a06('0x2')],'allowNull':![],'unique':_0x4a06('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 486ef2f..c79b54e 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 _0x351d=['path','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','end','status','json','limit','count','offset','apply','reject','save','update','destroy','then','get','ContactItemTypes','error','stack','name','send','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','rows','catch','show','length','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util'];(function(_0x512677,_0x3af1f6){var _0x4a3cc0=function(_0x3394be){while(--_0x3394be){_0x512677['push'](_0x512677['shift']());}};_0x4a3cc0(++_0x3af1f6);}(_0x351d,0x90));var _0xd351=function(_0x2e4953,_0x2c565c){_0x2e4953=_0x2e4953-0x0;var _0x241163=_0x351d[_0x2e4953];return _0x241163;};'use strict';var emlformat=require(_0xd351('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd351('0x1'));var jsonpatch=require(_0xd351('0x2'));var rp=require(_0xd351('0x3'));var moment=require('moment');var BPromise=require(_0xd351('0x4'));var Mustache=require('mustache');var util=require(_0xd351('0x5'));var path=require(_0xd351('0x6'));var sox=require('sox');var csv=require(_0xd351('0x7'));var ejs=require(_0xd351('0x8'));var fs=require('fs');var fs_extra=require(_0xd351('0x9'));var _=require('lodash');var squel=require(_0xd351('0xa'));var crypto=require(_0xd351('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd351('0xc'));var toCsv=require(_0xd351('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd351('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd351('0xe'));var as=require(_0xd351('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd351('0x10'))(_0xd351('0x11'));var utils=require('../../config/utils');var config=require(_0xd351('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3eb40c,_0x15549a){_0x15549a=_0x15549a||0xcc;return function(_0x23445f){if(_0x23445f){return _0x3eb40c[_0xd351('0x13')](_0x15549a);}return _0x3eb40c['status'](_0x15549a)[_0xd351('0x14')]();};}function respondWithResult(_0x316cf6,_0x597d7c){_0x597d7c=_0x597d7c||0xc8;return function(_0xc5a145){if(_0xc5a145){return _0x316cf6[_0xd351('0x15')](_0x597d7c)[_0xd351('0x16')](_0xc5a145);}};}function respondWithFilteredResult(_0xf1c285,_0x3867fb){return function(_0x4d238c){if(_0x4d238c){var _0x9f790f=typeof _0x3867fb['offset']==='undefined'&&typeof _0x3867fb[_0xd351('0x17')]==='undefined';var _0x21e591=_0x4d238c[_0xd351('0x18')];var _0x4e0164=_0x9f790f?0x0:_0x3867fb['offset'];var _0x1e1a3c=_0x9f790f?_0x4d238c[_0xd351('0x18')]:_0x3867fb[_0xd351('0x19')]+_0x3867fb[_0xd351('0x17')];var _0x51f265;if(_0x1e1a3c>=_0x21e591){_0x1e1a3c=_0x21e591;_0x51f265=0xc8;}else{_0x51f265=0xce;}_0xf1c285[_0xd351('0x15')](_0x51f265);return _0xf1c285['set']('Content-Range',_0x4e0164+'-'+_0x1e1a3c+'/'+_0x21e591)[_0xd351('0x16')](_0x4d238c);}return null;};}function patchUpdates(_0x4a427b){return function(_0x33b1e5){try{jsonpatch[_0xd351('0x1a')](_0x33b1e5,_0x4a427b,!![]);}catch(_0x3634c9){return BPromise[_0xd351('0x1b')](_0x3634c9);}return _0x33b1e5[_0xd351('0x1c')]();};}function saveUpdates(_0x53e729,_0x18625b){return function(_0xbbc58){if(_0xbbc58){return _0xbbc58[_0xd351('0x1d')](_0x53e729)['then'](function(_0x1ce7f7){return _0x1ce7f7;});}return null;};}function removeEntity(_0x2d9aa0,_0x365bbc){return function(_0x59fb6d){if(_0x59fb6d){return _0x59fb6d[_0xd351('0x1e')]()[_0xd351('0x1f')](function(){var _0x4626c4=_0x59fb6d[_0xd351('0x20')]({'plain':!![]});var _0x489c9a=_0xd351('0x21');return db['UserProfileResource'][_0xd351('0x1e')]({'where':{'type':_0x489c9a,'resourceId':_0x4626c4['id']}})[_0xd351('0x1f')](function(){return _0x59fb6d;});})['then'](function(){_0x2d9aa0[_0xd351('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50d67e,_0x1d0cb1){return function(_0x560be9){if(!_0x560be9){_0x50d67e['sendStatus'](0x194);}return _0x560be9;};}function handleError(_0x134580,_0x555a50){_0x555a50=_0x555a50||0x1f4;return function(_0x38471c){logger[_0xd351('0x22')](_0x38471c[_0xd351('0x23')]);if(_0x38471c['name']){delete _0x38471c[_0xd351('0x24')];}_0x134580['status'](_0x555a50)[_0xd351('0x25')](_0x38471c);};}exports['index']=function(_0x5f07b1,_0xeb4da9){var _0x38c82f={},_0x3f9ef3={},_0x33b43d={'count':0x0,'rows':[]};var _0x48aa96=_[_0xd351('0x26')](db[_0xd351('0x27')][_0xd351('0x28')],function(_0x41da60){return{'name':_0x41da60[_0xd351('0x29')],'type':_0x41da60[_0xd351('0x2a')][_0xd351('0x2b')]};});_0x3f9ef3[_0xd351('0x2c')]=_[_0xd351('0x26')](_0x48aa96,'name');_0x3f9ef3[_0xd351('0x2d')]=_[_0xd351('0x2e')](_0x5f07b1[_0xd351('0x2d')]);_0x3f9ef3[_0xd351('0x2f')]=_['intersection'](_0x3f9ef3[_0xd351('0x2c')],_0x3f9ef3[_0xd351('0x2d')]);_0x38c82f[_0xd351('0x30')]=_[_0xd351('0x31')](_0x3f9ef3[_0xd351('0x2c')],qs[_0xd351('0x32')](_0x5f07b1[_0xd351('0x2d')][_0xd351('0x32')]));_0x38c82f[_0xd351('0x30')]=_0x38c82f['attributes']['length']?_0x38c82f[_0xd351('0x30')]:_0x3f9ef3[_0xd351('0x2c')];if(!_0x5f07b1[_0xd351('0x2d')][_0xd351('0x33')](_0xd351('0x34'))){_0x38c82f[_0xd351('0x17')]=qs['limit'](_0x5f07b1['query'][_0xd351('0x17')]);_0x38c82f['offset']=qs[_0xd351('0x19')](_0x5f07b1[_0xd351('0x2d')][_0xd351('0x19')]);}_0x38c82f[_0xd351('0x35')]=qs[_0xd351('0x36')](_0x5f07b1[_0xd351('0x2d')][_0xd351('0x36')]);_0x38c82f[_0xd351('0x37')]=qs[_0xd351('0x2f')](_[_0xd351('0x38')](_0x5f07b1[_0xd351('0x2d')],_0x3f9ef3['filters']),_0x48aa96);if(_0x5f07b1[_0xd351('0x2d')]['filter']){_0x38c82f[_0xd351('0x37')]=_[_0xd351('0x39')](_0x38c82f[_0xd351('0x37')],{'$or':_[_0xd351('0x26')](_0x48aa96,function(_0x3b42e7){if(_0x3b42e7[_0xd351('0x2a')]!=='VIRTUAL'){var _0x3ad98e={};_0x3ad98e[_0x3b42e7[_0xd351('0x24')]]={'$like':'%'+_0x5f07b1['query'][_0xd351('0x3a')]+'%'};return _0x3ad98e;}})});}_0x38c82f=_[_0xd351('0x39')]({},_0x38c82f,_0x5f07b1[_0xd351('0x3b')]);var _0x1fc216={'where':_0x38c82f[_0xd351('0x37')]};return db['ContactItemType']['count'](_0x1fc216)[_0xd351('0x1f')](function(_0x3935aa){_0x33b43d['count']=_0x3935aa;if(_0x5f07b1['query'][_0xd351('0x3c')]){_0x38c82f[_0xd351('0x3d')]=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x38c82f);})[_0xd351('0x1f')](function(_0x18f9d1){_0x33b43d[_0xd351('0x3e')]=_0x18f9d1;return _0x33b43d;})[_0xd351('0x1f')](respondWithFilteredResult(_0xeb4da9,_0x38c82f))[_0xd351('0x3f')](handleError(_0xeb4da9,null));};exports[_0xd351('0x40')]=function(_0x6192c3,_0x110458){var _0x129605={'raw':!![],'where':{'id':_0x6192c3['params']['id']}},_0x553360={};_0x553360[_0xd351('0x2c')]=_[_0xd351('0x2e')](db[_0xd351('0x27')][_0xd351('0x28')]);_0x553360[_0xd351('0x2d')]=_[_0xd351('0x2e')](_0x6192c3[_0xd351('0x2d')]);_0x553360[_0xd351('0x2f')]=_[_0xd351('0x31')](_0x553360[_0xd351('0x2c')],_0x553360[_0xd351('0x2d')]);_0x129605[_0xd351('0x30')]=_[_0xd351('0x31')](_0x553360[_0xd351('0x2c')],qs[_0xd351('0x32')](_0x6192c3[_0xd351('0x2d')]['fields']));_0x129605[_0xd351('0x30')]=_0x129605[_0xd351('0x30')][_0xd351('0x41')]?_0x129605['attributes']:_0x553360[_0xd351('0x2c')];if(_0x6192c3[_0xd351('0x2d')][_0xd351('0x3c')]){_0x129605[_0xd351('0x3d')]=[{'all':!![]}];}_0x129605=_[_0xd351('0x39')]({},_0x129605,_0x6192c3['options']);return db[_0xd351('0x27')]['find'](_0x129605)[_0xd351('0x1f')](handleEntityNotFound(_0x110458,null))[_0xd351('0x1f')](respondWithResult(_0x110458,null))['catch'](handleError(_0x110458,null));};exports['create']=function(_0x1bd727,_0x444206){return db[_0xd351('0x27')]['create'](_0x1bd727[_0xd351('0x42')],{})[_0xd351('0x1f')](function(_0x548d90){var _0xf3ce5=_0x1bd727['user'][_0xd351('0x20')]({'plain':!![]});if(!_0xf3ce5)throw new Error(_0xd351('0x43'));if(_0xf3ce5['role']==='user'){var _0x25ea1e=_0x548d90['get']({'plain':!![]});var _0xf9f375=_0xd351('0x21');return db[_0xd351('0x44')]['find']({'where':{'name':_0xf9f375,'userProfileId':_0xf3ce5[_0xd351('0x45')]},'raw':!![]})['then'](function(_0x5527da){if(_0x5527da&&_0x5527da['autoAssociation']===0x0){return db[_0xd351('0x46')][_0xd351('0x47')]({'name':_0x25ea1e[_0xd351('0x24')],'resourceId':_0x25ea1e['id'],'type':_0x5527da['name'],'sectionId':_0x5527da['id']},{})['then'](function(){return _0x548d90;});}else{return _0x548d90;}})[_0xd351('0x3f')](function(_0x42f248){logger['error'](_0xd351('0x48'),_0x42f248);throw _0x42f248;});}return _0x548d90;})[_0xd351('0x1f')](respondWithResult(_0x444206,0xc9))['catch'](handleError(_0x444206,null));};exports[_0xd351('0x1d')]=function(_0x59ab0f,_0x22394e){if(_0x59ab0f['body']['id']){delete _0x59ab0f[_0xd351('0x42')]['id'];}return db[_0xd351('0x27')][_0xd351('0x49')]({'where':{'id':_0x59ab0f[_0xd351('0x4a')]['id']}})[_0xd351('0x1f')](handleEntityNotFound(_0x22394e,null))[_0xd351('0x1f')](saveUpdates(_0x59ab0f[_0xd351('0x42')],null))['then'](respondWithResult(_0x22394e,null))['catch'](handleError(_0x22394e,null));};exports[_0xd351('0x1e')]=function(_0x624224,_0x53a9da){return db[_0xd351('0x27')][_0xd351('0x49')]({'where':{'id':_0x624224[_0xd351('0x4a')]['id']}})['then'](handleEntityNotFound(_0x53a9da,null))[_0xd351('0x1f')](db['CmContactHasItem']['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x624224[_0xd351('0x4a')]['id']}}))[_0xd351('0x1f')](removeEntity(_0x53a9da,null))['catch'](handleError(_0x53a9da,null));}; \ No newline at end of file +var _0xd7d1=['autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','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','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','get','end','error','stack','name','index','map','ContactItemType','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','catch','params','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ContactItemTypes','UserProfileSection','userProfileId'];(function(_0x2e3108,_0x9d5811){var _0x88d17=function(_0x4cdae6){while(--_0x4cdae6){_0x2e3108['push'](_0x2e3108['shift']());}};_0x88d17(++_0x9d5811);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x34e25a,_0x31464c){_0x34e25a=_0x34e25a-0x0;var _0x1f7eec=_0xd7d1[_0x34e25a];return _0x1f7eec;};'use strict';var emlformat=require(_0x1d7d('0x0'));var rimraf=require(_0x1d7d('0x1'));var zipdir=require(_0x1d7d('0x2'));var jsonpatch=require(_0x1d7d('0x3'));var rp=require(_0x1d7d('0x4'));var moment=require(_0x1d7d('0x5'));var BPromise=require(_0x1d7d('0x6'));var Mustache=require(_0x1d7d('0x7'));var util=require(_0x1d7d('0x8'));var path=require(_0x1d7d('0x9'));var sox=require(_0x1d7d('0xa'));var csv=require(_0x1d7d('0xb'));var ejs=require(_0x1d7d('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1d7d('0xd'));var squel=require(_0x1d7d('0xe'));var crypto=require(_0x1d7d('0xf'));var jsforce=require(_0x1d7d('0x10'));var deskjs=require(_0x1d7d('0x11'));var toCsv=require(_0x1d7d('0xb'));var querystring=require(_0x1d7d('0x12'));var Papa=require(_0x1d7d('0x13'));var Redis=require(_0x1d7d('0x14'));var authService=require(_0x1d7d('0x15'));var qs=require(_0x1d7d('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d7d('0x17'));var logger=require('../../config/logger')(_0x1d7d('0x18'));var utils=require(_0x1d7d('0x19'));var config=require(_0x1d7d('0x1a'));var licenseUtil=require(_0x1d7d('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11b83f,_0x5ae1c9){_0x5ae1c9=_0x5ae1c9||0xcc;return function(_0x577e07){if(_0x577e07){return _0x11b83f[_0x1d7d('0x1c')](_0x5ae1c9);}return _0x11b83f[_0x1d7d('0x1d')](_0x5ae1c9)['end']();};}function respondWithResult(_0x55dba7,_0x1d3822){_0x1d3822=_0x1d3822||0xc8;return function(_0x334e78){if(_0x334e78){return _0x55dba7[_0x1d7d('0x1d')](_0x1d3822)[_0x1d7d('0x1e')](_0x334e78);}};}function respondWithFilteredResult(_0xeb05b3,_0x53423f){return function(_0x28adf3){if(_0x28adf3){var _0x1de6cc=typeof _0x53423f['offset']===_0x1d7d('0x1f')&&typeof _0x53423f[_0x1d7d('0x20')]===_0x1d7d('0x1f');var _0x47826a=_0x28adf3[_0x1d7d('0x21')];var _0x4db4f2=_0x1de6cc?0x0:_0x53423f[_0x1d7d('0x22')];var _0x191024=_0x1de6cc?_0x28adf3['count']:_0x53423f['offset']+_0x53423f[_0x1d7d('0x20')];var _0x1a5101;if(_0x191024>=_0x47826a){_0x191024=_0x47826a;_0x1a5101=0xc8;}else{_0x1a5101=0xce;}_0xeb05b3[_0x1d7d('0x1d')](_0x1a5101);return _0xeb05b3[_0x1d7d('0x23')](_0x1d7d('0x24'),_0x4db4f2+'-'+_0x191024+'/'+_0x47826a)[_0x1d7d('0x1e')](_0x28adf3);}return null;};}function patchUpdates(_0x54d401){return function(_0x225f85){try{jsonpatch[_0x1d7d('0x25')](_0x225f85,_0x54d401,!![]);}catch(_0x3a93d0){return BPromise['reject'](_0x3a93d0);}return _0x225f85[_0x1d7d('0x26')]();};}function saveUpdates(_0x12c54b,_0x4a1cdc){return function(_0x5950bd){if(_0x5950bd){return _0x5950bd[_0x1d7d('0x27')](_0x12c54b)[_0x1d7d('0x28')](function(_0x3d631f){return _0x3d631f;});}return null;};}function removeEntity(_0x5097b8,_0x377653){return function(_0x106376){if(_0x106376){return _0x106376[_0x1d7d('0x29')]()[_0x1d7d('0x28')](function(){var _0x4fa346=_0x106376[_0x1d7d('0x2a')]({'plain':!![]});var _0x151198='ContactItemTypes';return db['UserProfileResource'][_0x1d7d('0x29')]({'where':{'type':_0x151198,'resourceId':_0x4fa346['id']}})['then'](function(){return _0x106376;});})[_0x1d7d('0x28')](function(){_0x5097b8[_0x1d7d('0x1d')](0xcc)[_0x1d7d('0x2b')]();});}};}function handleEntityNotFound(_0x22c40d,_0x465938){return function(_0x59f827){if(!_0x59f827){_0x22c40d[_0x1d7d('0x1c')](0x194);}return _0x59f827;};}function handleError(_0x98c1ad,_0x352d5a){_0x352d5a=_0x352d5a||0x1f4;return function(_0x58672c){logger[_0x1d7d('0x2c')](_0x58672c[_0x1d7d('0x2d')]);if(_0x58672c[_0x1d7d('0x2e')]){delete _0x58672c['name'];}_0x98c1ad['status'](_0x352d5a)['send'](_0x58672c);};}exports[_0x1d7d('0x2f')]=function(_0x329f56,_0x559f19){var _0x1ebcbc={},_0x3e4136={},_0x16a81d={'count':0x0,'rows':[]};var _0x3336ab=_[_0x1d7d('0x30')](db[_0x1d7d('0x31')][_0x1d7d('0x32')],function(_0x803dc9){return{'name':_0x803dc9[_0x1d7d('0x33')],'type':_0x803dc9[_0x1d7d('0x34')]['key']};});_0x3e4136['model']=_[_0x1d7d('0x30')](_0x3336ab,_0x1d7d('0x2e'));_0x3e4136[_0x1d7d('0x35')]=_[_0x1d7d('0x36')](_0x329f56[_0x1d7d('0x35')]);_0x3e4136[_0x1d7d('0x37')]=_[_0x1d7d('0x38')](_0x3e4136[_0x1d7d('0x39')],_0x3e4136[_0x1d7d('0x35')]);_0x1ebcbc['attributes']=_[_0x1d7d('0x38')](_0x3e4136[_0x1d7d('0x39')],qs[_0x1d7d('0x3a')](_0x329f56[_0x1d7d('0x35')]['fields']));_0x1ebcbc['attributes']=_0x1ebcbc[_0x1d7d('0x3b')][_0x1d7d('0x3c')]?_0x1ebcbc['attributes']:_0x3e4136[_0x1d7d('0x39')];if(!_0x329f56[_0x1d7d('0x35')]['hasOwnProperty']('nolimit')){_0x1ebcbc[_0x1d7d('0x20')]=qs[_0x1d7d('0x20')](_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x20')]);_0x1ebcbc[_0x1d7d('0x22')]=qs[_0x1d7d('0x22')](_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x22')]);}_0x1ebcbc[_0x1d7d('0x3d')]=qs[_0x1d7d('0x3e')](_0x329f56['query']['sort']);_0x1ebcbc['where']=qs['filters'](_[_0x1d7d('0x3f')](_0x329f56['query'],_0x3e4136[_0x1d7d('0x37')]),_0x3336ab);if(_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x40')]){_0x1ebcbc['where']=_[_0x1d7d('0x41')](_0x1ebcbc[_0x1d7d('0x42')],{'$or':_[_0x1d7d('0x30')](_0x3336ab,function(_0x5b7e01){if(_0x5b7e01[_0x1d7d('0x34')]!==_0x1d7d('0x43')){var _0xfb9845={};_0xfb9845[_0x5b7e01[_0x1d7d('0x2e')]]={'$like':'%'+_0x329f56['query'][_0x1d7d('0x40')]+'%'};return _0xfb9845;}})});}_0x1ebcbc=_[_0x1d7d('0x41')]({},_0x1ebcbc,_0x329f56[_0x1d7d('0x44')]);var _0x456d51={'where':_0x1ebcbc['where']};return db[_0x1d7d('0x31')]['count'](_0x456d51)[_0x1d7d('0x28')](function(_0x31b850){_0x16a81d[_0x1d7d('0x21')]=_0x31b850;if(_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x45')]){_0x1ebcbc['include']=[{'all':!![]}];}return db['ContactItemType'][_0x1d7d('0x46')](_0x1ebcbc);})[_0x1d7d('0x28')](function(_0x1637fc){_0x16a81d['rows']=_0x1637fc;return _0x16a81d;})['then'](respondWithFilteredResult(_0x559f19,_0x1ebcbc))[_0x1d7d('0x47')](handleError(_0x559f19,null));};exports['show']=function(_0x86e7bc,_0x379e75){var _0x1d1064={'raw':!![],'where':{'id':_0x86e7bc[_0x1d7d('0x48')]['id']}},_0x21394c={};_0x21394c[_0x1d7d('0x39')]=_[_0x1d7d('0x36')](db['ContactItemType'][_0x1d7d('0x32')]);_0x21394c[_0x1d7d('0x35')]=_['keys'](_0x86e7bc[_0x1d7d('0x35')]);_0x21394c[_0x1d7d('0x37')]=_[_0x1d7d('0x38')](_0x21394c[_0x1d7d('0x39')],_0x21394c[_0x1d7d('0x35')]);_0x1d1064[_0x1d7d('0x3b')]=_[_0x1d7d('0x38')](_0x21394c[_0x1d7d('0x39')],qs[_0x1d7d('0x3a')](_0x86e7bc[_0x1d7d('0x35')][_0x1d7d('0x3a')]));_0x1d1064[_0x1d7d('0x3b')]=_0x1d1064['attributes'][_0x1d7d('0x3c')]?_0x1d1064['attributes']:_0x21394c[_0x1d7d('0x39')];if(_0x86e7bc['query'][_0x1d7d('0x45')]){_0x1d1064[_0x1d7d('0x49')]=[{'all':!![]}];}_0x1d1064=_[_0x1d7d('0x41')]({},_0x1d1064,_0x86e7bc[_0x1d7d('0x44')]);return db['ContactItemType'][_0x1d7d('0x4a')](_0x1d1064)['then'](handleEntityNotFound(_0x379e75,null))['then'](respondWithResult(_0x379e75,null))[_0x1d7d('0x47')](handleError(_0x379e75,null));};exports['create']=function(_0x57e416,_0x3727be){return db[_0x1d7d('0x31')]['create'](_0x57e416[_0x1d7d('0x4b')],{})[_0x1d7d('0x28')](function(_0x527711){var _0x1f3a63=_0x57e416[_0x1d7d('0x4c')][_0x1d7d('0x2a')]({'plain':!![]});if(!_0x1f3a63)throw new Error(_0x1d7d('0x4d'));if(_0x1f3a63['role']==='user'){var _0x3f73eb=_0x527711[_0x1d7d('0x2a')]({'plain':!![]});var _0x35ff5d=_0x1d7d('0x4e');return db[_0x1d7d('0x4f')]['find']({'where':{'name':_0x35ff5d,'userProfileId':_0x1f3a63[_0x1d7d('0x50')]},'raw':!![]})[_0x1d7d('0x28')](function(_0x344b66){if(_0x344b66&&_0x344b66[_0x1d7d('0x51')]===0x0){return db[_0x1d7d('0x52')][_0x1d7d('0x53')]({'name':_0x3f73eb[_0x1d7d('0x2e')],'resourceId':_0x3f73eb['id'],'type':_0x344b66[_0x1d7d('0x2e')],'sectionId':_0x344b66['id']},{})[_0x1d7d('0x28')](function(){return _0x527711;});}else{return _0x527711;}})['catch'](function(_0x3e7c4c){logger[_0x1d7d('0x2c')](_0x1d7d('0x54'),_0x3e7c4c);throw _0x3e7c4c;});}return _0x527711;})['then'](respondWithResult(_0x3727be,0xc9))['catch'](handleError(_0x3727be,null));};exports[_0x1d7d('0x27')]=function(_0x2d4cc3,_0x3f5434){if(_0x2d4cc3['body']['id']){delete _0x2d4cc3[_0x1d7d('0x4b')]['id'];}return db[_0x1d7d('0x31')]['find']({'where':{'id':_0x2d4cc3[_0x1d7d('0x48')]['id']}})[_0x1d7d('0x28')](handleEntityNotFound(_0x3f5434,null))[_0x1d7d('0x28')](saveUpdates(_0x2d4cc3[_0x1d7d('0x4b')],null))['then'](respondWithResult(_0x3f5434,null))[_0x1d7d('0x47')](handleError(_0x3f5434,null));};exports[_0x1d7d('0x29')]=function(_0x4ba6ec,_0x4d4c34){return db[_0x1d7d('0x31')][_0x1d7d('0x4a')]({'where':{'id':_0x4ba6ec['params']['id']}})['then'](handleEntityNotFound(_0x4d4c34,null))[_0x1d7d('0x28')](db[_0x1d7d('0x55')][_0x1d7d('0x27')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x4ba6ec[_0x1d7d('0x48')]['id']}}))['then'](removeEntity(_0x4d4c34,null))[_0x1d7d('0x47')](handleError(_0x4d4c34,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index e76cf0a..1b4dad9 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 _0x75a7=['request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','ContactItemType','lodash','util','../../config/logger','api','moment'];(function(_0x2c6858,_0x2fffab){var _0x216fdf=function(_0x51e3ef){while(--_0x51e3ef){_0x2c6858['push'](_0x2c6858['shift']());}};_0x216fdf(++_0x2fffab);}(_0x75a7,0x127));var _0x775a=function(_0x1d8af0,_0x44f849){_0x1d8af0=_0x1d8af0-0x0;var _0x36fb49=_0x75a7[_0x1d8af0];return _0x36fb49;};'use strict';var _=require(_0x775a('0x0'));var util=require(_0x775a('0x1'));var logger=require(_0x775a('0x2'))(_0x775a('0x3'));var moment=require(_0x775a('0x4'));var BPromise=require('bluebird');var rp=require(_0x775a('0x5'));var fs=require('fs');var path=require(_0x775a('0x6'));var rimraf=require(_0x775a('0x7'));var config=require(_0x775a('0x8'));var attributes=require(_0x775a('0x9'));module[_0x775a('0xa')]=function(_0x1ed8e9,_0x5c1c08){return _0x1ed8e9['define'](_0x775a('0xb'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89c4=['path','rimraf','../../config/environment','./contactItemType.attributes','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x33051b,_0x4a2656){var _0x347b4c=function(_0x46c108){while(--_0x46c108){_0x33051b['push'](_0x33051b['shift']());}};_0x347b4c(++_0x4a2656);}(_0x89c4,0x1aa));var _0x489c=function(_0x5085ca,_0x227aef){_0x5085ca=_0x5085ca-0x0;var _0x246084=_0x89c4[_0x5085ca];return _0x246084;};'use strict';var _=require(_0x489c('0x0'));var util=require(_0x489c('0x1'));var logger=require(_0x489c('0x2'))(_0x489c('0x3'));var moment=require('moment');var BPromise=require(_0x489c('0x4'));var rp=require(_0x489c('0x5'));var fs=require('fs');var path=require(_0x489c('0x6'));var rimraf=require(_0x489c('0x7'));var config=require(_0x489c('0x8'));var attributes=require(_0x489c('0x9'));module['exports']=function(_0xd706af,_0x1873cf){return _0xd706af['define'](_0x489c('0xa'),attributes,{'tableName':_0x489c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 5e54d6c..484726d 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 _0x8ec7=['error','message','result','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0x8ec7,0x1f1));var _0x78ec=function(_0x246f0c,_0x39f734){_0x246f0c=_0x246f0c-0x0;var _0x30fe50=_0x8ec7[_0x246f0c];return _0x30fe50;};'use strict';var _=require(_0x78ec('0x0'));var util=require(_0x78ec('0x1'));var moment=require('moment');var BPromise=require(_0x78ec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78ec('0x3'))['db'];var utils=require(_0x78ec('0x4'));var logger=require('../../config/logger')(_0x78ec('0x5'));var config=require(_0x78ec('0x6'));var jayson=require(_0x78ec('0x7'));var client=jayson[_0x78ec('0x8')][_0x78ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d2780,_0x21e3f7,_0x4ca55e){return new BPromise(function(_0x372108,_0x268c50){return client[_0x78ec('0xa')](_0x5d2780,_0x4ca55e)['then'](function(_0x367c80){logger[_0x78ec('0xb')](_0x78ec('0xc'),_0x21e3f7,_0x78ec('0xd'));logger[_0x78ec('0xe')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x21e3f7,'request\x20sent',JSON[_0x78ec('0xf')](_0x367c80));if(_0x367c80[_0x78ec('0x10')]){if(_0x367c80[_0x78ec('0x10')]['code']===0x1f4){logger[_0x78ec('0x10')](_0x78ec('0xc'),_0x21e3f7,_0x367c80[_0x78ec('0x10')][_0x78ec('0x11')]);return _0x268c50(_0x367c80[_0x78ec('0x10')][_0x78ec('0x11')]);}logger[_0x78ec('0x10')](_0x78ec('0xc'),_0x21e3f7,_0x367c80[_0x78ec('0x10')][_0x78ec('0x11')]);return _0x372108(_0x367c80[_0x78ec('0x10')]['message']);}else{logger[_0x78ec('0xb')](_0x78ec('0xc'),_0x21e3f7,_0x78ec('0xd'));_0x372108(_0x367c80[_0x78ec('0x12')][_0x78ec('0x11')]);}})['catch'](function(_0x4f9ffd){logger['error']('ContactItemType,\x20%s,\x20%s',_0x21e3f7,_0x4f9ffd);_0x268c50(_0x4f9ffd);});});} \ No newline at end of file +var _0x2d72=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5c1b30,_0x40e70a){var _0x3eb46d=function(_0xfa32f){while(--_0xfa32f){_0x5c1b30['push'](_0x5c1b30['shift']());}};_0x3eb46d(++_0x40e70a);}(_0x2d72,0x119));var _0x22d7=function(_0xc587f5,_0x20721e){_0xc587f5=_0xc587f5-0x0;var _0x374b1e=_0x2d72[_0xc587f5];return _0x374b1e;};'use strict';var _=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var moment=require(_0x22d7('0x2'));var BPromise=require(_0x22d7('0x3'));var rs=require(_0x22d7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x22d7('0x5'))['db'];var utils=require(_0x22d7('0x6'));var logger=require(_0x22d7('0x7'))(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var jayson=require(_0x22d7('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x34739c,_0x323350,_0x2098ec){return new BPromise(function(_0x2fb8c1,_0x43e733){return client[_0x22d7('0xb')](_0x34739c,_0x2098ec)['then'](function(_0x54c69e){logger[_0x22d7('0xc')](_0x22d7('0xd'),_0x323350,'request\x20sent');logger[_0x22d7('0xe')](_0x22d7('0xf'),_0x323350,_0x22d7('0x10'),JSON[_0x22d7('0x11')](_0x54c69e));if(_0x54c69e['error']){if(_0x54c69e[_0x22d7('0x12')][_0x22d7('0x13')]===0x1f4){logger[_0x22d7('0x12')](_0x22d7('0xd'),_0x323350,_0x54c69e[_0x22d7('0x12')][_0x22d7('0x14')]);return _0x43e733(_0x54c69e[_0x22d7('0x12')][_0x22d7('0x14')]);}logger['error']('ContactItemType,\x20%s,\x20%s',_0x323350,_0x54c69e[_0x22d7('0x12')]['message']);return _0x2fb8c1(_0x54c69e[_0x22d7('0x12')][_0x22d7('0x14')]);}else{logger[_0x22d7('0xc')](_0x22d7('0xd'),_0x323350,_0x22d7('0x10'));_0x2fb8c1(_0x54c69e['result'][_0x22d7('0x14')]);}})[_0x22d7('0x15')](function(_0xe90890){logger[_0x22d7('0x12')]('ContactItemType,\x20%s,\x20%s',_0x323350,_0xe90890);_0x43e733(_0xe90890);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index aa50743..6ad43ea 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 _0xd702=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x4c23b6,_0x4bd0e6){var _0x507cde=function(_0x3a626f){while(--_0x3a626f){_0x4c23b6['push'](_0x4c23b6['shift']());}};_0x507cde(++_0x4bd0e6);}(_0xd702,0x121));var _0x2d70=function(_0x59dc26,_0x1b2a67){_0x59dc26=_0x59dc26-0x0;var _0x1324a7=_0xd702[_0x59dc26];return _0x1324a7;};'use strict';var multer=require('multer');var util=require(_0x2d70('0x0'));var path=require(_0x2d70('0x1'));var timeout=require(_0x2d70('0x2'));var express=require(_0x2d70('0x3'));var router=express[_0x2d70('0x4')]();var fs_extra=require(_0x2d70('0x5'));var auth=require(_0x2d70('0x6'));var interaction=require(_0x2d70('0x7'));var config=require(_0x2d70('0x8'));var controller=require(_0x2d70('0x9'));router['get']('/',auth[_0x2d70('0xa')](),controller[_0x2d70('0xb')]);router['get'](_0x2d70('0xc'),auth['isAuthenticated'](),controller[_0x2d70('0xd')]);router[_0x2d70('0xe')]('/',auth['isAuthenticated'](),controller[_0x2d70('0xf')]);router[_0x2d70('0x10')](_0x2d70('0xc'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x2d70('0xa')](),controller['destroy']);module[_0x2d70('0x11')]=router; \ No newline at end of file +var _0x8551=['index','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller'];(function(_0x3dd2de,_0x224bd1){var _0x85ee26=function(_0x3b55b5){while(--_0x3b55b5){_0x3dd2de['push'](_0x3dd2de['shift']());}};_0x85ee26(++_0x224bd1);}(_0x8551,0x84));var _0x1855=function(_0x17f145,_0x3422bb){_0x17f145=_0x17f145-0x0;var _0x2d5420=_0x8551[_0x17f145];return _0x2d5420;};'use strict';var multer=require(_0x1855('0x0'));var util=require(_0x1855('0x1'));var path=require(_0x1855('0x2'));var timeout=require('connect-timeout');var express=require(_0x1855('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1855('0x4'));var interaction=require(_0x1855('0x5'));var config=require(_0x1855('0x6'));var controller=require(_0x1855('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x1855('0x8')]);router[_0x1855('0x9')](_0x1855('0xa'),auth[_0x1855('0xb')](),controller[_0x1855('0xc')]);router[_0x1855('0xd')]('/',auth['isAuthenticated'](),controller[_0x1855('0xe')]);router[_0x1855('0xf')](_0x1855('0xa'),auth[_0x1855('0xb')](),controller[_0x1855('0x10')]);router[_0x1855('0x11')]('/:id',auth[_0x1855('0xb')](),controller[_0x1855('0x12')]);module[_0x1855('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index afc9d37..26ce194 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x108131,_0x39a0f4){var _0x23bda7=function(_0x1ce983){while(--_0x1ce983){_0x108131['push'](_0x108131['shift']());}};_0x23bda7(++_0x39a0f4);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x5cc8,_0x1faa02){var _0x450661=function(_0x237b05){while(--_0x237b05){_0x5cc8['push'](_0x5cc8['shift']());}};_0x450661(++_0x1faa02);}(_0xb7e7,0x121));var _0x7b7e=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0xb7e7[_0x468b0f];return _0x3e74d9;};'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 diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index e19fccd..0180d06 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 _0x8a82=['redis','defaults','socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','destroy','then','get','end','error','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','keys','query','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','filters','includeAll','create','user','role','CustomDashboards','find','userProfileId','autoAssociation','UserProfileResource','omit','body','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','iframe','attrUrl','attrs','custom','attrPath','value','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrSmsAccounts','web-report','reportType','attrReport','attrRefresh','stringify','addItem','DashboardItem','getItems','findOne','pick','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','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'];(function(_0x3c4ab7,_0x25ed12){var _0x536d89=function(_0x30d0cc){while(--_0x30d0cc){_0x3c4ab7['push'](_0x3c4ab7['shift']());}};_0x536d89(++_0x25ed12);}(_0x8a82,0x69));var _0x28a8=function(_0x26cd80,_0x397b6d){_0x26cd80=_0x26cd80-0x0;var _0x238cda=_0x8a82[_0x26cd80];return _0x238cda;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x28a8('0x0'));var zipdir=require(_0x28a8('0x1'));var jsonpatch=require(_0x28a8('0x2'));var rp=require(_0x28a8('0x3'));var moment=require(_0x28a8('0x4'));var BPromise=require(_0x28a8('0x5'));var Mustache=require(_0x28a8('0x6'));var util=require(_0x28a8('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x28a8('0x8'));var ejs=require(_0x28a8('0x9'));var fs=require('fs');var fs_extra=require(_0x28a8('0xa'));var _=require('lodash');var squel=require(_0x28a8('0xb'));var crypto=require('crypto');var jsforce=require(_0x28a8('0xc'));var deskjs=require(_0x28a8('0xd'));var toCsv=require(_0x28a8('0x8'));var querystring=require('querystring');var Papa=require(_0x28a8('0xe'));var Redis=require(_0x28a8('0xf'));var authService=require(_0x28a8('0x10'));var qs=require(_0x28a8('0x11'));var as=require(_0x28a8('0x12'));var hardwareService=require(_0x28a8('0x13'));var logger=require(_0x28a8('0x14'))('api');var utils=require(_0x28a8('0x15'));var config=require(_0x28a8('0x16'));var licenseUtil=require(_0x28a8('0x17'));var db=require('../../mysqldb')['db'];config[_0x28a8('0x18')]=_[_0x28a8('0x19')](config[_0x28a8('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x28a8('0x1a'))(new Redis(config[_0x28a8('0x18')]));require(_0x28a8('0x1b'))[_0x28a8('0x1c')](socket);function respondWithStatusCode(_0x20caf5,_0x5518d8){_0x5518d8=_0x5518d8||0xcc;return function(_0x11b9b4){if(_0x11b9b4){return _0x20caf5[_0x28a8('0x1d')](_0x5518d8);}return _0x20caf5[_0x28a8('0x1e')](_0x5518d8)['end']();};}function respondWithResult(_0x1e8fad,_0x3f3560){_0x3f3560=_0x3f3560||0xc8;return function(_0x40ae07){if(_0x40ae07){return _0x1e8fad['status'](_0x3f3560)[_0x28a8('0x1f')](_0x40ae07);}};}function respondWithFilteredResult(_0x2da3fa,_0x4e7cc6){return function(_0x310b46){if(_0x310b46){var _0x124c5a=typeof _0x4e7cc6[_0x28a8('0x20')]===_0x28a8('0x21')&&typeof _0x4e7cc6['limit']==='undefined';var _0x405bac=_0x310b46['count'];var _0x142ae2=_0x124c5a?0x0:_0x4e7cc6['offset'];var _0x5a7ff7=_0x124c5a?_0x310b46[_0x28a8('0x22')]:_0x4e7cc6[_0x28a8('0x20')]+_0x4e7cc6[_0x28a8('0x23')];var _0xb81e60;if(_0x5a7ff7>=_0x405bac){_0x5a7ff7=_0x405bac;_0xb81e60=0xc8;}else{_0xb81e60=0xce;}_0x2da3fa['status'](_0xb81e60);return _0x2da3fa[_0x28a8('0x24')](_0x28a8('0x25'),_0x142ae2+'-'+_0x5a7ff7+'/'+_0x405bac)[_0x28a8('0x1f')](_0x310b46);}return null;};}function patchUpdates(_0x3559c7){return function(_0x24fca3){try{jsonpatch['apply'](_0x24fca3,_0x3559c7,!![]);}catch(_0x58f95d){return BPromise[_0x28a8('0x26')](_0x58f95d);}return _0x24fca3[_0x28a8('0x27')]();};}function saveUpdates(_0x2de655,_0x152484){return function(_0x3713e4){if(_0x3713e4){return _0x3713e4['update'](_0x2de655)['then'](function(_0x2efb7e){return _0x2efb7e;});}return null;};}function removeEntity(_0x59155d,_0x5bf568){return function(_0x9d5ca6){if(_0x9d5ca6){return _0x9d5ca6[_0x28a8('0x28')]()[_0x28a8('0x29')](function(){var _0x10cbb5=_0x9d5ca6[_0x28a8('0x2a')]({'plain':!![]});var _0x29b777='CustomDashboards';return db['UserProfileResource']['destroy']({'where':{'type':_0x29b777,'resourceId':_0x10cbb5['id']}})['then'](function(){return _0x9d5ca6;});})['then'](function(){_0x59155d['status'](0xcc)[_0x28a8('0x2b')]();});}};}function handleEntityNotFound(_0x152411,_0x26ad66){return function(_0x578c1f){if(!_0x578c1f){_0x152411['sendStatus'](0x194);}return _0x578c1f;};}function handleError(_0x64107a,_0x49546f){_0x49546f=_0x49546f||0x1f4;return function(_0x244bf8){logger[_0x28a8('0x2c')](_0x244bf8['stack']);if(_0x244bf8[_0x28a8('0x2d')]){delete _0x244bf8[_0x28a8('0x2d')];}_0x64107a[_0x28a8('0x1e')](_0x49546f)[_0x28a8('0x2e')](_0x244bf8);};}exports[_0x28a8('0x2f')]=function(_0x20cd95,_0x610823){var _0x23da0a={},_0x19db01={},_0x147e13={'count':0x0,'rows':[]};var _0x30cb5b=_[_0x28a8('0x30')](db[_0x28a8('0x31')][_0x28a8('0x32')],function(_0x3b107c){return{'name':_0x3b107c[_0x28a8('0x33')],'type':_0x3b107c[_0x28a8('0x34')][_0x28a8('0x35')]};});_0x19db01['model']=_['map'](_0x30cb5b,_0x28a8('0x2d'));_0x19db01['query']=_[_0x28a8('0x36')](_0x20cd95[_0x28a8('0x37')]);_0x19db01['filters']=_[_0x28a8('0x38')](_0x19db01['model'],_0x19db01['query']);_0x23da0a[_0x28a8('0x39')]=_[_0x28a8('0x38')](_0x19db01['model'],qs[_0x28a8('0x3a')](_0x20cd95[_0x28a8('0x37')][_0x28a8('0x3a')]));_0x23da0a[_0x28a8('0x39')]=_0x23da0a[_0x28a8('0x39')][_0x28a8('0x3b')]?_0x23da0a[_0x28a8('0x39')]:_0x19db01[_0x28a8('0x3c')];if(!_0x20cd95[_0x28a8('0x37')][_0x28a8('0x3d')](_0x28a8('0x3e'))){_0x23da0a[_0x28a8('0x23')]=qs[_0x28a8('0x23')](_0x20cd95[_0x28a8('0x37')]['limit']);_0x23da0a[_0x28a8('0x20')]=qs['offset'](_0x20cd95[_0x28a8('0x37')][_0x28a8('0x20')]);}_0x23da0a[_0x28a8('0x3f')]=qs[_0x28a8('0x40')](_0x20cd95[_0x28a8('0x37')][_0x28a8('0x40')]);_0x23da0a[_0x28a8('0x41')]=qs['filters'](_['pick'](_0x20cd95[_0x28a8('0x37')],_0x19db01['filters']),_0x30cb5b);if(_0x20cd95[_0x28a8('0x37')][_0x28a8('0x42')]){_0x23da0a[_0x28a8('0x41')]=_[_0x28a8('0x43')](_0x23da0a[_0x28a8('0x41')],{'$or':_[_0x28a8('0x30')](_0x30cb5b,function(_0x56adbd){if(_0x56adbd[_0x28a8('0x34')]!==_0x28a8('0x44')){var _0x1991f4={};_0x1991f4[_0x56adbd['name']]={'$like':'%'+_0x20cd95[_0x28a8('0x37')][_0x28a8('0x42')]+'%'};return _0x1991f4;}})});}_0x23da0a=_['merge']({},_0x23da0a,_0x20cd95[_0x28a8('0x45')]);var _0x43b48c={'where':_0x23da0a['where']};return db[_0x28a8('0x31')][_0x28a8('0x22')](_0x43b48c)[_0x28a8('0x29')](function(_0xb99924){_0x147e13['count']=_0xb99924;if(_0x20cd95[_0x28a8('0x37')]['includeAll']){_0x23da0a[_0x28a8('0x46')]=[{'all':!![]}];}return db[_0x28a8('0x31')][_0x28a8('0x47')](_0x23da0a);})[_0x28a8('0x29')](function(_0x344a46){_0x147e13['rows']=_0x344a46;return _0x147e13;})[_0x28a8('0x29')](respondWithFilteredResult(_0x610823,_0x23da0a))[_0x28a8('0x48')](handleError(_0x610823,null));};exports[_0x28a8('0x49')]=function(_0x45eefd,_0x55ed91){var _0x5899e4={'raw':![],'where':{'id':_0x45eefd[_0x28a8('0x4a')]['id']}},_0xbbd6e4={};_0xbbd6e4[_0x28a8('0x3c')]=_[_0x28a8('0x36')](db['Dashboard'][_0x28a8('0x32')]);_0xbbd6e4[_0x28a8('0x37')]=_[_0x28a8('0x36')](_0x45eefd[_0x28a8('0x37')]);_0xbbd6e4[_0x28a8('0x4b')]=_['intersection'](_0xbbd6e4[_0x28a8('0x3c')],_0xbbd6e4[_0x28a8('0x37')]);_0x5899e4[_0x28a8('0x39')]=_[_0x28a8('0x38')](_0xbbd6e4['model'],qs[_0x28a8('0x3a')](_0x45eefd[_0x28a8('0x37')]['fields']));_0x5899e4[_0x28a8('0x39')]=_0x5899e4[_0x28a8('0x39')]['length']?_0x5899e4[_0x28a8('0x39')]:_0xbbd6e4[_0x28a8('0x3c')];if(_0x45eefd[_0x28a8('0x37')][_0x28a8('0x4c')]){_0x5899e4[_0x28a8('0x46')]=[{'all':!![]}];}_0x5899e4=_[_0x28a8('0x43')]({},_0x5899e4,_0x45eefd['options']);return db[_0x28a8('0x31')]['find'](_0x5899e4)[_0x28a8('0x29')](handleEntityNotFound(_0x55ed91,null))[_0x28a8('0x29')](respondWithResult(_0x55ed91,null))[_0x28a8('0x48')](handleError(_0x55ed91,null));};exports[_0x28a8('0x4d')]=function(_0x1b46f4,_0x2e8b2a){return db[_0x28a8('0x31')]['create'](_0x1b46f4['body'],{})[_0x28a8('0x29')](function(_0x2841b6){var _0x49cc05=_0x1b46f4[_0x28a8('0x4e')][_0x28a8('0x2a')]({'plain':!![]});if(!_0x49cc05)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49cc05[_0x28a8('0x4f')]===_0x28a8('0x4e')){var _0x39a294=_0x2841b6[_0x28a8('0x2a')]({'plain':!![]});var _0x5ba21d=_0x28a8('0x50');return db['UserProfileSection'][_0x28a8('0x51')]({'where':{'name':_0x5ba21d,'userProfileId':_0x49cc05[_0x28a8('0x52')]},'raw':!![]})[_0x28a8('0x29')](function(_0x380839){if(_0x380839&&_0x380839[_0x28a8('0x53')]===0x0){return db[_0x28a8('0x54')][_0x28a8('0x4d')]({'name':_0x39a294[_0x28a8('0x2d')],'resourceId':_0x39a294['id'],'type':_0x380839[_0x28a8('0x2d')],'sectionId':_0x380839['id']},{})[_0x28a8('0x29')](function(){return _0x2841b6;});}else{return _0x2841b6;}})[_0x28a8('0x48')](function(_0xa58676){logger[_0x28a8('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa58676);throw _0xa58676;});}return _0x2841b6;})[_0x28a8('0x29')](respondWithResult(_0x2e8b2a,0xc9))[_0x28a8('0x48')](handleError(_0x2e8b2a,null));};exports['clone']=function(_0x16ecc5,_0x25816e){var _0x1561e7={'where':{'id':_0x16ecc5[_0x28a8('0x4a')]['id']}},_0x343086={};_0x343086[_0x28a8('0x3c')]=_['keys'](db[_0x28a8('0x31')][_0x28a8('0x32')]);_0x1561e7['attributes']=_[_0x28a8('0x38')](_0x343086[_0x28a8('0x3c')],qs[_0x28a8('0x3a')](_0x16ecc5[_0x28a8('0x37')][_0x28a8('0x3a')]));_0x1561e7[_0x28a8('0x39')]=_0x1561e7[_0x28a8('0x39')][_0x28a8('0x3b')]?_0x1561e7[_0x28a8('0x39')]:_0x343086[_0x28a8('0x3c')];if(_0x16ecc5['query'][_0x28a8('0x4c')]){_0x1561e7[_0x28a8('0x46')]=[{'all':!![]}];}_0x1561e7=_[_0x28a8('0x43')]({},_0x1561e7,_0x16ecc5[_0x28a8('0x45')]);return db[_0x28a8('0x31')]['find'](_0x1561e7)[_0x28a8('0x29')](handleEntityNotFound(_0x25816e,null))[_0x28a8('0x29')](function(_0x22e0ce){if(_0x22e0ce){var _0x193cff=_0x22e0ce['get']({'plain':!![]});_0x193cff=qs[_0x28a8('0x55')](_0x193cff,['id','createdAt','updatedAt']);_0x16ecc5['body']=_[_0x28a8('0x55')](_0x16ecc5[_0x28a8('0x56')],['id','createdAt',_0x28a8('0x57')]);return db[_0x28a8('0x31')][_0x28a8('0x4d')](_[_0x28a8('0x43')](_0x193cff,_0x16ecc5[_0x28a8('0x56')]),{'include':_0x16ecc5[_0x28a8('0x37')][_0x28a8('0x4c')]?[{'all':!![]}]:undefined})[_0x28a8('0x29')](function(_0x16b82f){var _0x1a8426=_0x16ecc5[_0x28a8('0x4e')][_0x28a8('0x2a')]({'plain':!![]});if(!_0x1a8426)throw new Error(_0x28a8('0x58'));if(_0x1a8426[_0x28a8('0x4f')]===_0x28a8('0x4e')){var _0x406922=_0x16b82f['get']({'plain':!![]});var _0x271bce=_0x28a8('0x50');return db['UserProfileSection'][_0x28a8('0x51')]({'where':{'name':_0x271bce,'userProfileId':_0x1a8426['userProfileId']},'raw':!![]})[_0x28a8('0x29')](function(_0x51815f){if(_0x51815f&&_0x51815f['autoAssociation']===0x0){return db[_0x28a8('0x54')]['create']({'name':_0x406922[_0x28a8('0x2d')],'resourceId':_0x406922['id'],'type':_0x51815f[_0x28a8('0x2d')],'sectionId':_0x51815f['id']},{})[_0x28a8('0x29')](function(){return _0x16b82f;});}else{return _0x16b82f;}})[_0x28a8('0x48')](function(_0x460fbb){logger[_0x28a8('0x2c')](_0x28a8('0x59'),_0x460fbb);throw _0x460fbb;});}return _0x16b82f;});}})[_0x28a8('0x29')](respondWithResult(_0x25816e,0xc9))[_0x28a8('0x48')](handleError(_0x25816e,null));};exports[_0x28a8('0x5a')]=function(_0x128645,_0x5189d1){if(_0x128645[_0x28a8('0x56')]['id']){delete _0x128645[_0x28a8('0x56')]['id'];}return db['Dashboard'][_0x28a8('0x51')]({'where':{'id':_0x128645['params']['id']}})[_0x28a8('0x29')](handleEntityNotFound(_0x5189d1,null))['then'](saveUpdates(_0x128645['body'],null))[_0x28a8('0x29')](respondWithResult(_0x5189d1,null))[_0x28a8('0x48')](handleError(_0x5189d1,null));};exports[_0x28a8('0x28')]=function(_0x36187d,_0x62f4c3){return db[_0x28a8('0x31')][_0x28a8('0x51')]({'where':{'id':_0x36187d[_0x28a8('0x4a')]['id']}})[_0x28a8('0x29')](handleEntityNotFound(_0x62f4c3,null))[_0x28a8('0x29')](removeEntity(_0x62f4c3,null))['catch'](handleError(_0x62f4c3,null));};function widgetAttributes(_0x4e0c44){try{switch(_0x4e0c44[_0x28a8('0x34')]){case _0x28a8('0x5b'):return[{'name':'attrUrl','value':_0x4e0c44[_0x28a8('0x5c')]||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x0]?_0x4e0c44[_0x28a8('0x5d')][0x0]['value']:undefined)||'https://'}];case _0x28a8('0x5e'):return[{'name':_0x28a8('0x5f'),'value':_0x4e0c44[_0x28a8('0x5f')]||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x0]?_0x4e0c44[_0x28a8('0x5d')][0x0][_0x28a8('0x60')]:undefined)||''}];case _0x28a8('0x61'):return[{'name':_0x28a8('0x62'),'value':_0x4e0c44['attrHourFormat']||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x0]?_0x4e0c44['attrs'][0x0][_0x28a8('0x60')]:undefined)||'HH:mm:ss'},{'name':_0x28a8('0x63'),'value':_0x4e0c44['attrTimezone']||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x1]?_0x4e0c44['attrs'][0x1][_0x28a8('0x60')]:undefined)||_0x28a8('0x64')},{'name':_0x28a8('0x65'),'value':_0x4e0c44[_0x28a8('0x65')]||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x2]?_0x4e0c44[_0x28a8('0x5d')][0x2][_0x28a8('0x60')]:undefined)||0xc}];case _0x28a8('0x66'):return[{'name':_0x28a8('0x67'),'value':_0x4e0c44['attrMetric']||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x0]?_0x4e0c44[_0x28a8('0x5d')][0x0][_0x28a8('0x60')]:undefined)||_0x28a8('0x68')},{'name':_0x28a8('0x69'),'value':_0x4e0c44[_0x28a8('0x69')]||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x1]?_0x4e0c44[_0x28a8('0x5d')][0x1][_0x28a8('0x60')]:undefined)||[]},{'name':_0x28a8('0x65'),'value':_0x4e0c44['attrFontSize']||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44['attrs'][0x2]?_0x4e0c44[_0x28a8('0x5d')][0x2][_0x28a8('0x60')]:undefined)||0x14},{'name':_0x28a8('0x6a'),'value':_0x4e0c44[_0x28a8('0x6a')]||(_0x4e0c44['attrs']&&_0x4e0c44[_0x28a8('0x5d')][0x3]?_0x4e0c44['attrs'][0x3]['value']:undefined)||_0x28a8('0x6b')},{'name':'attrEmailAccounts','value':_0x4e0c44[_0x28a8('0x6c')]||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44['attrs'][0x4]?_0x4e0c44[_0x28a8('0x5d')][0x4][_0x28a8('0x60')]:undefined)||''},{'name':_0x28a8('0x6d'),'value':_0x4e0c44['attrFaxAccounts']||(_0x4e0c44['attrs']&&_0x4e0c44[_0x28a8('0x5d')][0x5]?_0x4e0c44[_0x28a8('0x5d')][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x4e0c44['attrSmsAccounts']||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x6]?_0x4e0c44[_0x28a8('0x5d')][0x6][_0x28a8('0x60')]:undefined)||''},{'name':_0x28a8('0x6e'),'value':_0x4e0c44[_0x28a8('0x6e')]||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x7]?_0x4e0c44[_0x28a8('0x5d')][0x7][_0x28a8('0x60')]:undefined)||''},{'name':_0x28a8('0x6f'),'value':_0x4e0c44[_0x28a8('0x6f')]||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x8]?_0x4e0c44[_0x28a8('0x5d')][0x8][_0x28a8('0x60')]:undefined)||''},{'name':_0x28a8('0x70'),'value':_0x4e0c44['attrChatWebsites']||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x9]?_0x4e0c44[_0x28a8('0x5d')][0x9][_0x28a8('0x60')]:undefined)||''}];case _0x28a8('0x71'):case _0x28a8('0x72'):return[{'name':_0x28a8('0x73'),'value':_0x4e0c44[_0x28a8('0x73')]||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44['attrs'][0x0]?_0x4e0c44[_0x28a8('0x5d')][0x0]['value']:undefined)||_0x28a8('0x68')},{'name':_0x28a8('0x74'),'value':_0x4e0c44[_0x28a8('0x74')]||(_0x4e0c44['attrs']&&_0x4e0c44[_0x28a8('0x5d')][0x1]?_0x4e0c44[_0x28a8('0x5d')][0x1][_0x28a8('0x60')]:undefined)||null},{'name':_0x28a8('0x75'),'value':_0x4e0c44[_0x28a8('0x75')]||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44['attrs'][0x2]?_0x4e0c44['attrs'][0x2]['value']:undefined)||null},{'name':_0x28a8('0x69'),'value':_0x4e0c44[_0x28a8('0x69')]||(_0x4e0c44['attrs']&&_0x4e0c44[_0x28a8('0x5d')][0x3]?_0x4e0c44[_0x28a8('0x5d')][0x3]['value']:undefined)||[]},{'name':_0x28a8('0x6a'),'value':_0x4e0c44['attrChannel']||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x4]?_0x4e0c44[_0x28a8('0x5d')][0x4][_0x28a8('0x60')]:undefined)||_0x28a8('0x6b')},{'name':_0x28a8('0x6c'),'value':_0x4e0c44['attrEmailAccounts']||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44['attrs'][0x5]?_0x4e0c44[_0x28a8('0x5d')][0x5][_0x28a8('0x60')]:undefined)||''},{'name':_0x28a8('0x6d'),'value':_0x4e0c44[_0x28a8('0x6d')]||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x6]?_0x4e0c44[_0x28a8('0x5d')][0x6][_0x28a8('0x60')]:undefined)||''},{'name':_0x28a8('0x76'),'value':_0x4e0c44['attrSmsAccounts']||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x7]?_0x4e0c44[_0x28a8('0x5d')][0x7][_0x28a8('0x60')]:undefined)||''},{'name':_0x28a8('0x6e'),'value':_0x4e0c44[_0x28a8('0x6e')]||(_0x4e0c44['attrs']&&_0x4e0c44[_0x28a8('0x5d')][0x8]?_0x4e0c44[_0x28a8('0x5d')][0x8][_0x28a8('0x60')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x4e0c44[_0x28a8('0x6f')]||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x9]?_0x4e0c44['attrs'][0x9][_0x28a8('0x60')]:undefined)||''},{'name':_0x28a8('0x70'),'value':_0x4e0c44[_0x28a8('0x70')]||(_0x4e0c44['attrs']&&_0x4e0c44[_0x28a8('0x5d')][0xa]?_0x4e0c44[_0x28a8('0x5d')][0xa][_0x28a8('0x60')]:undefined)||''}];case _0x28a8('0x77'):return[{'name':'attrReport','type':_0x4e0c44[_0x28a8('0x78')]||(_0x4e0c44['attrs']&&_0x4e0c44['attrs'][0x0]?_0x4e0c44[_0x28a8('0x5d')][0x0]['type']:undefined)||null,'value':_0x4e0c44[_0x28a8('0x79')]||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x0]?_0x4e0c44[_0x28a8('0x5d')][0x0][_0x28a8('0x60')]:undefined)||null},{'name':_0x28a8('0x7a'),'value':_0x4e0c44[_0x28a8('0x7a')]||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44['attrs'][0x1]?_0x4e0c44['attrs'][0x1][_0x28a8('0x60')]:undefined)||0x0}];default:return[];}}catch(_0xd5182e){logger['error']('widgetAttributes:\x20%s',JSON[_0x28a8('0x7b')](_0xd5182e));return[];}}exports[_0x28a8('0x7c')]=function(_0x28fd19,_0x4f171a,_0x3f3146){if(_0x28fd19[_0x28a8('0x56')]['id']){delete _0x28fd19[_0x28a8('0x56')]['id'];}return db['Dashboard'][_0x28a8('0x51')]({'where':{'id':_0x28fd19[_0x28a8('0x4a')]['id']}})[_0x28a8('0x29')](handleEntityNotFound(_0x4f171a,null))[_0x28a8('0x29')](function(_0x357580){if(_0x357580){_0x28fd19[_0x28a8('0x56')]['DashboardId']=_0x357580['id'];_0x28fd19['body'][_0x28a8('0x5d')]=widgetAttributes(_0x28fd19[_0x28a8('0x56')]);return db[_0x28a8('0x7d')][_0x28a8('0x4d')](_0x28fd19['body']);}})[_0x28a8('0x29')](respondWithResult(_0x4f171a,null))[_0x28a8('0x48')](handleError(_0x4f171a,null));};exports[_0x28a8('0x7e')]=function(_0x17f8a9,_0x48e264,_0x3fb0fe){var _0x368385={};var _0x3de8a8={};var _0x88c8d4;var _0x99b56d;return db['Dashboard'][_0x28a8('0x7f')]({'where':{'id':_0x17f8a9[_0x28a8('0x4a')]['id']}})[_0x28a8('0x29')](handleEntityNotFound(_0x48e264,null))[_0x28a8('0x29')](function(_0x2c9ea1){if(_0x2c9ea1){_0x88c8d4=_0x2c9ea1;_0x3de8a8[_0x28a8('0x3c')]=_[_0x28a8('0x36')](db[_0x28a8('0x7d')][_0x28a8('0x32')]);_0x3de8a8[_0x28a8('0x37')]=_[_0x28a8('0x36')](_0x17f8a9['query']);_0x3de8a8[_0x28a8('0x4b')]=_[_0x28a8('0x38')](_0x3de8a8[_0x28a8('0x3c')],_0x3de8a8[_0x28a8('0x37')]);_0x368385[_0x28a8('0x39')]=_[_0x28a8('0x38')](_0x3de8a8[_0x28a8('0x3c')],qs['fields'](_0x17f8a9['query'][_0x28a8('0x3a')]));_0x368385[_0x28a8('0x39')]=_0x368385[_0x28a8('0x39')]['length']?_0x368385[_0x28a8('0x39')]:_0x3de8a8[_0x28a8('0x3c')];_0x368385['order']=qs[_0x28a8('0x40')](_0x17f8a9[_0x28a8('0x37')]['sort']);_0x368385[_0x28a8('0x41')]=qs['filters'](_[_0x28a8('0x80')](_0x17f8a9[_0x28a8('0x37')],_0x3de8a8[_0x28a8('0x4b')]));if(_0x17f8a9[_0x28a8('0x37')]['filter']){_0x368385[_0x28a8('0x41')]=_['merge'](_0x368385[_0x28a8('0x41')],{'$or':_[_0x28a8('0x30')](_0x368385['attributes'],function(_0xe45a87){var _0xa15e11={};_0xa15e11[_0xe45a87]={'$like':'%'+_0x17f8a9[_0x28a8('0x37')]['filter']+'%'};return _0xa15e11;})});}_0x368385=_[_0x28a8('0x43')]({},_0x368385,_0x17f8a9[_0x28a8('0x45')]);return _0x88c8d4[_0x28a8('0x7e')](_0x368385);}})[_0x28a8('0x29')](function(_0x46b263){if(_0x46b263){_0x99b56d=_0x46b263['length'];if(!_0x17f8a9['query'][_0x28a8('0x3d')](_0x28a8('0x3e'))){_0x368385[_0x28a8('0x23')]=qs[_0x28a8('0x23')](_0x17f8a9[_0x28a8('0x37')]['limit']);_0x368385[_0x28a8('0x20')]=qs['offset'](_0x17f8a9[_0x28a8('0x37')][_0x28a8('0x20')]);}return _0x88c8d4[_0x28a8('0x7e')](_0x368385);}})[_0x28a8('0x29')](function(_0x2901bb){if(_0x2901bb){return _0x2901bb?{'count':_0x99b56d,'rows':_0x2901bb}:null;}})['then'](respondWithResult(_0x48e264,null))[_0x28a8('0x48')](handleError(_0x48e264,null));}; \ No newline at end of file +var _0xb940=['getItems','findOne','filters','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','attributes','intersection','model','fields','order','sort','where','pick','filter','merge','options','includeAll','include','Dashboard','findAll','catch','show','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','omit','updatedAt','autoAssociation','find','type','iframe','attrUrl','attrs','value','https://','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem'];(function(_0x4bcda0,_0x1bdbfd){var _0x278fbf=function(_0x38ca76){while(--_0x38ca76){_0x4bcda0['push'](_0x4bcda0['shift']());}};_0x278fbf(++_0x1bdbfd);}(_0xb940,0x10f));var _0x0b94=function(_0x54dcad,_0x554f46){_0x54dcad=_0x54dcad-0x0;var _0x537c56=_0xb940[_0x54dcad];return _0x537c56;};'use strict';var emlformat=require(_0x0b94('0x0'));var rimraf=require(_0x0b94('0x1'));var zipdir=require(_0x0b94('0x2'));var jsonpatch=require(_0x0b94('0x3'));var rp=require(_0x0b94('0x4'));var moment=require('moment');var BPromise=require(_0x0b94('0x5'));var Mustache=require(_0x0b94('0x6'));var util=require(_0x0b94('0x7'));var path=require(_0x0b94('0x8'));var sox=require(_0x0b94('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0b94('0xa'));var squel=require(_0x0b94('0xb'));var crypto=require(_0x0b94('0xc'));var jsforce=require(_0x0b94('0xd'));var deskjs=require(_0x0b94('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0b94('0xf'));var Papa=require(_0x0b94('0x10'));var Redis=require(_0x0b94('0x11'));var authService=require(_0x0b94('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0b94('0x13'));var hardwareService=require(_0x0b94('0x14'));var logger=require(_0x0b94('0x15'))(_0x0b94('0x16'));var utils=require(_0x0b94('0x17'));var config=require(_0x0b94('0x18'));var licenseUtil=require(_0x0b94('0x19'));var db=require(_0x0b94('0x1a'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x0b94('0x1b'),'port':0x18eb});var socket=require(_0x0b94('0x1c'))(new Redis(config[_0x0b94('0x1d')]));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x3e5b7f,_0x4a674f){_0x4a674f=_0x4a674f||0xcc;return function(_0x2cd9ce){if(_0x2cd9ce){return _0x3e5b7f[_0x0b94('0x1e')](_0x4a674f);}return _0x3e5b7f[_0x0b94('0x1f')](_0x4a674f)[_0x0b94('0x20')]();};}function respondWithResult(_0x56bddf,_0xcf2bb6){_0xcf2bb6=_0xcf2bb6||0xc8;return function(_0x5909c1){if(_0x5909c1){return _0x56bddf['status'](_0xcf2bb6)[_0x0b94('0x21')](_0x5909c1);}};}function respondWithFilteredResult(_0x1e1b34,_0x4ca050){return function(_0x497b3f){if(_0x497b3f){var _0x56543e=typeof _0x4ca050['offset']==='undefined'&&typeof _0x4ca050[_0x0b94('0x22')]===_0x0b94('0x23');var _0x3219d6=_0x497b3f[_0x0b94('0x24')];var _0x56375e=_0x56543e?0x0:_0x4ca050['offset'];var _0x46131b=_0x56543e?_0x497b3f[_0x0b94('0x24')]:_0x4ca050[_0x0b94('0x25')]+_0x4ca050[_0x0b94('0x22')];var _0x4e5714;if(_0x46131b>=_0x3219d6){_0x46131b=_0x3219d6;_0x4e5714=0xc8;}else{_0x4e5714=0xce;}_0x1e1b34['status'](_0x4e5714);return _0x1e1b34[_0x0b94('0x26')](_0x0b94('0x27'),_0x56375e+'-'+_0x46131b+'/'+_0x3219d6)[_0x0b94('0x21')](_0x497b3f);}return null;};}function patchUpdates(_0x2ab370){return function(_0x22ccab){try{jsonpatch[_0x0b94('0x28')](_0x22ccab,_0x2ab370,!![]);}catch(_0x51807e){return BPromise[_0x0b94('0x29')](_0x51807e);}return _0x22ccab[_0x0b94('0x2a')]();};}function saveUpdates(_0x4776ee,_0x4504cb){return function(_0x3b41fb){if(_0x3b41fb){return _0x3b41fb[_0x0b94('0x2b')](_0x4776ee)[_0x0b94('0x2c')](function(_0x45bf4c){return _0x45bf4c;});}return null;};}function removeEntity(_0x4be68f,_0x438138){return function(_0x672d47){if(_0x672d47){return _0x672d47[_0x0b94('0x2d')]()[_0x0b94('0x2c')](function(){var _0x4e381f=_0x672d47[_0x0b94('0x2e')]({'plain':!![]});var _0xcea9f7=_0x0b94('0x2f');return db[_0x0b94('0x30')][_0x0b94('0x2d')]({'where':{'type':_0xcea9f7,'resourceId':_0x4e381f['id']}})[_0x0b94('0x2c')](function(){return _0x672d47;});})[_0x0b94('0x2c')](function(){_0x4be68f[_0x0b94('0x1f')](0xcc)[_0x0b94('0x20')]();});}};}function handleEntityNotFound(_0x57768c,_0xb8dcdf){return function(_0x3f51af){if(!_0x3f51af){_0x57768c['sendStatus'](0x194);}return _0x3f51af;};}function handleError(_0x48047d,_0x80c160){_0x80c160=_0x80c160||0x1f4;return function(_0x48b949){logger[_0x0b94('0x31')](_0x48b949[_0x0b94('0x32')]);if(_0x48b949[_0x0b94('0x33')]){delete _0x48b949['name'];}_0x48047d[_0x0b94('0x1f')](_0x80c160)[_0x0b94('0x34')](_0x48b949);};}exports[_0x0b94('0x35')]=function(_0x23d07f,_0x2e961a){var _0x58889f={},_0x202a9c={},_0x9fb9f4={'count':0x0,'rows':[]};var _0x4f618a=_[_0x0b94('0x36')](db['Dashboard'][_0x0b94('0x37')],function(_0xd448fb){return{'name':_0xd448fb[_0x0b94('0x38')],'type':_0xd448fb['type'][_0x0b94('0x39')]};});_0x202a9c['model']=_[_0x0b94('0x36')](_0x4f618a,_0x0b94('0x33'));_0x202a9c[_0x0b94('0x3a')]=_[_0x0b94('0x3b')](_0x23d07f[_0x0b94('0x3a')]);_0x202a9c['filters']=_['intersection'](_0x202a9c['model'],_0x202a9c['query']);_0x58889f[_0x0b94('0x3c')]=_[_0x0b94('0x3d')](_0x202a9c[_0x0b94('0x3e')],qs[_0x0b94('0x3f')](_0x23d07f['query']['fields']));_0x58889f[_0x0b94('0x3c')]=_0x58889f['attributes']['length']?_0x58889f['attributes']:_0x202a9c['model'];if(!_0x23d07f[_0x0b94('0x3a')]['hasOwnProperty']('nolimit')){_0x58889f[_0x0b94('0x22')]=qs[_0x0b94('0x22')](_0x23d07f[_0x0b94('0x3a')][_0x0b94('0x22')]);_0x58889f['offset']=qs[_0x0b94('0x25')](_0x23d07f[_0x0b94('0x3a')][_0x0b94('0x25')]);}_0x58889f[_0x0b94('0x40')]=qs['sort'](_0x23d07f[_0x0b94('0x3a')][_0x0b94('0x41')]);_0x58889f[_0x0b94('0x42')]=qs['filters'](_[_0x0b94('0x43')](_0x23d07f['query'],_0x202a9c['filters']),_0x4f618a);if(_0x23d07f[_0x0b94('0x3a')][_0x0b94('0x44')]){_0x58889f['where']=_[_0x0b94('0x45')](_0x58889f[_0x0b94('0x42')],{'$or':_[_0x0b94('0x36')](_0x4f618a,function(_0x51d38e){if(_0x51d38e['type']!=='VIRTUAL'){var _0x55cb9b={};_0x55cb9b[_0x51d38e[_0x0b94('0x33')]]={'$like':'%'+_0x23d07f[_0x0b94('0x3a')]['filter']+'%'};return _0x55cb9b;}})});}_0x58889f=_['merge']({},_0x58889f,_0x23d07f[_0x0b94('0x46')]);var _0x4725d3={'where':_0x58889f[_0x0b94('0x42')]};return db['Dashboard'][_0x0b94('0x24')](_0x4725d3)[_0x0b94('0x2c')](function(_0x2c3fe5){_0x9fb9f4['count']=_0x2c3fe5;if(_0x23d07f[_0x0b94('0x3a')][_0x0b94('0x47')]){_0x58889f[_0x0b94('0x48')]=[{'all':!![]}];}return db[_0x0b94('0x49')][_0x0b94('0x4a')](_0x58889f);})[_0x0b94('0x2c')](function(_0x3230e2){_0x9fb9f4['rows']=_0x3230e2;return _0x9fb9f4;})[_0x0b94('0x2c')](respondWithFilteredResult(_0x2e961a,_0x58889f))[_0x0b94('0x4b')](handleError(_0x2e961a,null));};exports[_0x0b94('0x4c')]=function(_0x35ae38,_0x108458){var _0xddb158={'raw':![],'where':{'id':_0x35ae38['params']['id']}},_0x3dad11={};_0x3dad11['model']=_[_0x0b94('0x3b')](db[_0x0b94('0x49')]['rawAttributes']);_0x3dad11[_0x0b94('0x3a')]=_['keys'](_0x35ae38['query']);_0x3dad11['filters']=_[_0x0b94('0x3d')](_0x3dad11['model'],_0x3dad11[_0x0b94('0x3a')]);_0xddb158[_0x0b94('0x3c')]=_[_0x0b94('0x3d')](_0x3dad11[_0x0b94('0x3e')],qs[_0x0b94('0x3f')](_0x35ae38[_0x0b94('0x3a')][_0x0b94('0x3f')]));_0xddb158[_0x0b94('0x3c')]=_0xddb158[_0x0b94('0x3c')][_0x0b94('0x4d')]?_0xddb158[_0x0b94('0x3c')]:_0x3dad11['model'];if(_0x35ae38['query'][_0x0b94('0x47')]){_0xddb158[_0x0b94('0x48')]=[{'all':!![]}];}_0xddb158=_['merge']({},_0xddb158,_0x35ae38[_0x0b94('0x46')]);return db[_0x0b94('0x49')]['find'](_0xddb158)[_0x0b94('0x2c')](handleEntityNotFound(_0x108458,null))[_0x0b94('0x2c')](respondWithResult(_0x108458,null))['catch'](handleError(_0x108458,null));};exports['create']=function(_0x4ed179,_0x40e840){return db[_0x0b94('0x49')][_0x0b94('0x4e')](_0x4ed179[_0x0b94('0x4f')],{})[_0x0b94('0x2c')](function(_0x2524d5){var _0x538250=_0x4ed179[_0x0b94('0x50')]['get']({'plain':!![]});if(!_0x538250)throw new Error(_0x0b94('0x51'));if(_0x538250[_0x0b94('0x52')]==='user'){var _0x54cb3e=_0x2524d5[_0x0b94('0x2e')]({'plain':!![]});var _0x1c0024=_0x0b94('0x2f');return db[_0x0b94('0x53')]['find']({'where':{'name':_0x1c0024,'userProfileId':_0x538250[_0x0b94('0x54')]},'raw':!![]})['then'](function(_0x410d0c){if(_0x410d0c&&_0x410d0c['autoAssociation']===0x0){return db['UserProfileResource'][_0x0b94('0x4e')]({'name':_0x54cb3e[_0x0b94('0x33')],'resourceId':_0x54cb3e['id'],'type':_0x410d0c[_0x0b94('0x33')],'sectionId':_0x410d0c['id']},{})['then'](function(){return _0x2524d5;});}else{return _0x2524d5;}})[_0x0b94('0x4b')](function(_0x3a66ab){logger[_0x0b94('0x31')](_0x0b94('0x55'),_0x3a66ab);throw _0x3a66ab;});}return _0x2524d5;})[_0x0b94('0x2c')](respondWithResult(_0x40e840,0xc9))[_0x0b94('0x4b')](handleError(_0x40e840,null));};exports['clone']=function(_0x4ca45d,_0x636296){var _0x54853f={'where':{'id':_0x4ca45d[_0x0b94('0x56')]['id']}},_0x186e14={};_0x186e14[_0x0b94('0x3e')]=_[_0x0b94('0x3b')](db[_0x0b94('0x49')][_0x0b94('0x37')]);_0x54853f[_0x0b94('0x3c')]=_[_0x0b94('0x3d')](_0x186e14['model'],qs[_0x0b94('0x3f')](_0x4ca45d['query'][_0x0b94('0x3f')]));_0x54853f['attributes']=_0x54853f[_0x0b94('0x3c')][_0x0b94('0x4d')]?_0x54853f[_0x0b94('0x3c')]:_0x186e14[_0x0b94('0x3e')];if(_0x4ca45d[_0x0b94('0x3a')][_0x0b94('0x47')]){_0x54853f[_0x0b94('0x48')]=[{'all':!![]}];}_0x54853f=_[_0x0b94('0x45')]({},_0x54853f,_0x4ca45d['options']);return db[_0x0b94('0x49')]['find'](_0x54853f)[_0x0b94('0x2c')](handleEntityNotFound(_0x636296,null))[_0x0b94('0x2c')](function(_0x14ccd3){if(_0x14ccd3){var _0x455613=_0x14ccd3[_0x0b94('0x2e')]({'plain':!![]});_0x455613=qs[_0x0b94('0x57')](_0x455613,['id','createdAt',_0x0b94('0x58')]);_0x4ca45d['body']=_[_0x0b94('0x57')](_0x4ca45d[_0x0b94('0x4f')],['id','createdAt',_0x0b94('0x58')]);return db[_0x0b94('0x49')][_0x0b94('0x4e')](_[_0x0b94('0x45')](_0x455613,_0x4ca45d[_0x0b94('0x4f')]),{'include':_0x4ca45d[_0x0b94('0x3a')][_0x0b94('0x47')]?[{'all':!![]}]:undefined})[_0x0b94('0x2c')](function(_0x920255){var _0x58b71f=_0x4ca45d[_0x0b94('0x50')]['get']({'plain':!![]});if(!_0x58b71f)throw new Error(_0x0b94('0x51'));if(_0x58b71f['role']===_0x0b94('0x50')){var _0x15264d=_0x920255['get']({'plain':!![]});var _0xd933b5='CustomDashboards';return db[_0x0b94('0x53')]['find']({'where':{'name':_0xd933b5,'userProfileId':_0x58b71f['userProfileId']},'raw':!![]})[_0x0b94('0x2c')](function(_0x2ed383){if(_0x2ed383&&_0x2ed383[_0x0b94('0x59')]===0x0){return db['UserProfileResource'][_0x0b94('0x4e')]({'name':_0x15264d[_0x0b94('0x33')],'resourceId':_0x15264d['id'],'type':_0x2ed383[_0x0b94('0x33')],'sectionId':_0x2ed383['id']},{})[_0x0b94('0x2c')](function(){return _0x920255;});}else{return _0x920255;}})[_0x0b94('0x4b')](function(_0x26a564){logger[_0x0b94('0x31')](_0x0b94('0x55'),_0x26a564);throw _0x26a564;});}return _0x920255;});}})[_0x0b94('0x2c')](respondWithResult(_0x636296,0xc9))['catch'](handleError(_0x636296,null));};exports['update']=function(_0x448cba,_0x282cbb){if(_0x448cba[_0x0b94('0x4f')]['id']){delete _0x448cba[_0x0b94('0x4f')]['id'];}return db[_0x0b94('0x49')][_0x0b94('0x5a')]({'where':{'id':_0x448cba[_0x0b94('0x56')]['id']}})[_0x0b94('0x2c')](handleEntityNotFound(_0x282cbb,null))[_0x0b94('0x2c')](saveUpdates(_0x448cba[_0x0b94('0x4f')],null))[_0x0b94('0x2c')](respondWithResult(_0x282cbb,null))['catch'](handleError(_0x282cbb,null));};exports['destroy']=function(_0x228330,_0x309226){return db[_0x0b94('0x49')][_0x0b94('0x5a')]({'where':{'id':_0x228330[_0x0b94('0x56')]['id']}})[_0x0b94('0x2c')](handleEntityNotFound(_0x309226,null))[_0x0b94('0x2c')](removeEntity(_0x309226,null))['catch'](handleError(_0x309226,null));};function widgetAttributes(_0x27a9da){try{switch(_0x27a9da[_0x0b94('0x5b')]){case _0x0b94('0x5c'):return[{'name':_0x0b94('0x5d'),'value':_0x27a9da['attrUrl']||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da['attrs'][0x0]?_0x27a9da['attrs'][0x0][_0x0b94('0x5f')]:undefined)||_0x0b94('0x60')}];case'custom':return[{'name':'attrPath','value':_0x27a9da[_0x0b94('0x61')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da[_0x0b94('0x5e')][0x0]?_0x27a9da[_0x0b94('0x5e')][0x0][_0x0b94('0x5f')]:undefined)||''}];case'clock':return[{'name':_0x0b94('0x62'),'value':_0x27a9da[_0x0b94('0x62')]||(_0x27a9da['attrs']&&_0x27a9da[_0x0b94('0x5e')][0x0]?_0x27a9da[_0x0b94('0x5e')][0x0][_0x0b94('0x5f')]:undefined)||_0x0b94('0x63')},{'name':_0x0b94('0x64'),'value':_0x27a9da[_0x0b94('0x64')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da[_0x0b94('0x5e')][0x1]?_0x27a9da[_0x0b94('0x5e')][0x1]['value']:undefined)||_0x0b94('0x65')},{'name':_0x0b94('0x66'),'value':_0x27a9da[_0x0b94('0x66')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da['attrs'][0x2]?_0x27a9da[_0x0b94('0x5e')][0x2][_0x0b94('0x5f')]:undefined)||0xc}];case _0x0b94('0x67'):return[{'name':_0x0b94('0x68'),'value':_0x27a9da[_0x0b94('0x68')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da[_0x0b94('0x5e')][0x0]?_0x27a9da[_0x0b94('0x5e')][0x0][_0x0b94('0x5f')]:undefined)||_0x0b94('0x69')},{'name':_0x0b94('0x6a'),'value':_0x27a9da['attrVoiceQueues']||(_0x27a9da['attrs']&&_0x27a9da[_0x0b94('0x5e')][0x1]?_0x27a9da[_0x0b94('0x5e')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x27a9da['attrFontSize']||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da[_0x0b94('0x5e')][0x2]?_0x27a9da[_0x0b94('0x5e')][0x2][_0x0b94('0x5f')]:undefined)||0x14},{'name':'attrChannel','value':_0x27a9da[_0x0b94('0x6b')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da[_0x0b94('0x5e')][0x3]?_0x27a9da[_0x0b94('0x5e')][0x3]['value']:undefined)||_0x0b94('0x6c')},{'name':'attrEmailAccounts','value':_0x27a9da[_0x0b94('0x6d')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da[_0x0b94('0x5e')][0x4]?_0x27a9da[_0x0b94('0x5e')][0x4][_0x0b94('0x5f')]:undefined)||''},{'name':_0x0b94('0x6e'),'value':_0x27a9da[_0x0b94('0x6e')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da[_0x0b94('0x5e')][0x5]?_0x27a9da[_0x0b94('0x5e')][0x5][_0x0b94('0x5f')]:undefined)||''},{'name':_0x0b94('0x6f'),'value':_0x27a9da[_0x0b94('0x6f')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da['attrs'][0x6]?_0x27a9da[_0x0b94('0x5e')][0x6]['value']:undefined)||''},{'name':_0x0b94('0x70'),'value':_0x27a9da[_0x0b94('0x70')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da['attrs'][0x7]?_0x27a9da[_0x0b94('0x5e')][0x7][_0x0b94('0x5f')]:undefined)||''},{'name':_0x0b94('0x71'),'value':_0x27a9da[_0x0b94('0x71')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da[_0x0b94('0x5e')][0x8]?_0x27a9da[_0x0b94('0x5e')][0x8][_0x0b94('0x5f')]:undefined)||''},{'name':_0x0b94('0x72'),'value':_0x27a9da[_0x0b94('0x72')]||(_0x27a9da['attrs']&&_0x27a9da['attrs'][0x9]?_0x27a9da[_0x0b94('0x5e')][0x9][_0x0b94('0x5f')]:undefined)||''}];case _0x0b94('0x73'):case _0x0b94('0x74'):return[{'name':_0x0b94('0x75'),'value':_0x27a9da[_0x0b94('0x75')]||(_0x27a9da['attrs']&&_0x27a9da[_0x0b94('0x5e')][0x0]?_0x27a9da[_0x0b94('0x5e')][0x0][_0x0b94('0x5f')]:undefined)||_0x0b94('0x69')},{'name':_0x0b94('0x76'),'value':_0x27a9da[_0x0b94('0x76')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da['attrs'][0x1]?_0x27a9da['attrs'][0x1]['value']:undefined)||null},{'name':_0x0b94('0x77'),'value':_0x27a9da[_0x0b94('0x77')]||(_0x27a9da['attrs']&&_0x27a9da['attrs'][0x2]?_0x27a9da[_0x0b94('0x5e')][0x2][_0x0b94('0x5f')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x27a9da[_0x0b94('0x6a')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da['attrs'][0x3]?_0x27a9da[_0x0b94('0x5e')][0x3][_0x0b94('0x5f')]:undefined)||[]},{'name':_0x0b94('0x6b'),'value':_0x27a9da[_0x0b94('0x6b')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da[_0x0b94('0x5e')][0x4]?_0x27a9da[_0x0b94('0x5e')][0x4][_0x0b94('0x5f')]:undefined)||_0x0b94('0x6c')},{'name':_0x0b94('0x6d'),'value':_0x27a9da[_0x0b94('0x6d')]||(_0x27a9da['attrs']&&_0x27a9da[_0x0b94('0x5e')][0x5]?_0x27a9da['attrs'][0x5][_0x0b94('0x5f')]:undefined)||''},{'name':_0x0b94('0x6e'),'value':_0x27a9da['attrFaxAccounts']||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da[_0x0b94('0x5e')][0x6]?_0x27a9da[_0x0b94('0x5e')][0x6][_0x0b94('0x5f')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x27a9da[_0x0b94('0x6f')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da[_0x0b94('0x5e')][0x7]?_0x27a9da['attrs'][0x7]['value']:undefined)||''},{'name':_0x0b94('0x70'),'value':_0x27a9da[_0x0b94('0x70')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da[_0x0b94('0x5e')][0x8]?_0x27a9da['attrs'][0x8][_0x0b94('0x5f')]:undefined)||''},{'name':_0x0b94('0x71'),'value':_0x27a9da[_0x0b94('0x71')]||(_0x27a9da['attrs']&&_0x27a9da[_0x0b94('0x5e')][0x9]?_0x27a9da['attrs'][0x9][_0x0b94('0x5f')]:undefined)||''},{'name':_0x0b94('0x72'),'value':_0x27a9da[_0x0b94('0x72')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da[_0x0b94('0x5e')][0xa]?_0x27a9da[_0x0b94('0x5e')][0xa][_0x0b94('0x5f')]:undefined)||''}];case _0x0b94('0x78'):return[{'name':_0x0b94('0x79'),'type':_0x27a9da[_0x0b94('0x7a')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da['attrs'][0x0]?_0x27a9da[_0x0b94('0x5e')][0x0]['type']:undefined)||null,'value':_0x27a9da[_0x0b94('0x79')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da[_0x0b94('0x5e')][0x0]?_0x27a9da['attrs'][0x0]['value']:undefined)||null},{'name':_0x0b94('0x7b'),'value':_0x27a9da['attrRefresh']||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da[_0x0b94('0x5e')][0x1]?_0x27a9da[_0x0b94('0x5e')][0x1][_0x0b94('0x5f')]:undefined)||0x0}];default:return[];}}catch(_0x1eed78){logger[_0x0b94('0x31')](_0x0b94('0x7c'),JSON[_0x0b94('0x7d')](_0x1eed78));return[];}}exports[_0x0b94('0x7e')]=function(_0x20b34e,_0x5f2a7b,_0x1bce98){if(_0x20b34e['body']['id']){delete _0x20b34e[_0x0b94('0x4f')]['id'];}return db[_0x0b94('0x49')][_0x0b94('0x5a')]({'where':{'id':_0x20b34e[_0x0b94('0x56')]['id']}})[_0x0b94('0x2c')](handleEntityNotFound(_0x5f2a7b,null))['then'](function(_0x25b6ac){if(_0x25b6ac){_0x20b34e[_0x0b94('0x4f')]['DashboardId']=_0x25b6ac['id'];_0x20b34e[_0x0b94('0x4f')][_0x0b94('0x5e')]=widgetAttributes(_0x20b34e[_0x0b94('0x4f')]);return db[_0x0b94('0x7f')][_0x0b94('0x4e')](_0x20b34e['body']);}})[_0x0b94('0x2c')](respondWithResult(_0x5f2a7b,null))[_0x0b94('0x4b')](handleError(_0x5f2a7b,null));};exports[_0x0b94('0x80')]=function(_0x513fc5,_0x46effb,_0x43d499){var _0x1cd791={};var _0x1733ea={};var _0x17cc97;var _0x9fc75e;return db[_0x0b94('0x49')][_0x0b94('0x81')]({'where':{'id':_0x513fc5[_0x0b94('0x56')]['id']}})['then'](handleEntityNotFound(_0x46effb,null))[_0x0b94('0x2c')](function(_0xa84e9){if(_0xa84e9){_0x17cc97=_0xa84e9;_0x1733ea[_0x0b94('0x3e')]=_['keys'](db['DashboardItem'][_0x0b94('0x37')]);_0x1733ea[_0x0b94('0x3a')]=_[_0x0b94('0x3b')](_0x513fc5['query']);_0x1733ea[_0x0b94('0x82')]=_['intersection'](_0x1733ea[_0x0b94('0x3e')],_0x1733ea[_0x0b94('0x3a')]);_0x1cd791[_0x0b94('0x3c')]=_[_0x0b94('0x3d')](_0x1733ea[_0x0b94('0x3e')],qs[_0x0b94('0x3f')](_0x513fc5['query'][_0x0b94('0x3f')]));_0x1cd791[_0x0b94('0x3c')]=_0x1cd791[_0x0b94('0x3c')][_0x0b94('0x4d')]?_0x1cd791['attributes']:_0x1733ea[_0x0b94('0x3e')];_0x1cd791[_0x0b94('0x40')]=qs[_0x0b94('0x41')](_0x513fc5['query'][_0x0b94('0x41')]);_0x1cd791[_0x0b94('0x42')]=qs['filters'](_['pick'](_0x513fc5[_0x0b94('0x3a')],_0x1733ea['filters']));if(_0x513fc5[_0x0b94('0x3a')]['filter']){_0x1cd791['where']=_[_0x0b94('0x45')](_0x1cd791[_0x0b94('0x42')],{'$or':_[_0x0b94('0x36')](_0x1cd791[_0x0b94('0x3c')],function(_0x5ba96c){var _0x3295fa={};_0x3295fa[_0x5ba96c]={'$like':'%'+_0x513fc5[_0x0b94('0x3a')]['filter']+'%'};return _0x3295fa;})});}_0x1cd791=_['merge']({},_0x1cd791,_0x513fc5[_0x0b94('0x46')]);return _0x17cc97[_0x0b94('0x80')](_0x1cd791);}})['then'](function(_0x52b87e){if(_0x52b87e){_0x9fc75e=_0x52b87e[_0x0b94('0x4d')];if(!_0x513fc5[_0x0b94('0x3a')][_0x0b94('0x83')](_0x0b94('0x84'))){_0x1cd791[_0x0b94('0x22')]=qs[_0x0b94('0x22')](_0x513fc5['query'][_0x0b94('0x22')]);_0x1cd791[_0x0b94('0x25')]=qs['offset'](_0x513fc5[_0x0b94('0x3a')][_0x0b94('0x25')]);}return _0x17cc97['getItems'](_0x1cd791);}})[_0x0b94('0x2c')](function(_0x4a3a4f){if(_0x4a3a4f){return _0x4a3a4f?{'count':_0x9fc75e,'rows':_0x4a3a4f}:null;}})[_0x0b94('0x2c')](respondWithResult(_0x46effb,null))['catch'](handleError(_0x46effb,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index c9a9546..c16f50f 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 _0xeb33=['hasOwnProperty','hook','events','../../mysqldb','Dashboard','save','emit'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0xeb33,0xf0));var _0x3eb3=function(_0x251999,_0x101e56){_0x251999=_0x251999-0x0;var _0x14b385=_0xeb33[_0x251999];return _0x14b385;};'use strict';var EventEmitter=require(_0x3eb3('0x0'));var Dashboard=require(_0x3eb3('0x1'))['db'][_0x3eb3('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3eb3('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4aaab9){return function(_0x308b10,_0x176657,_0x39f1f8){DashboardEvents[_0x3eb3('0x4')](_0x4aaab9+':'+_0x308b10['id'],_0x308b10);DashboardEvents['emit'](_0x4aaab9,_0x308b10);_0x39f1f8(null);};}for(var e in events){if(events[_0x3eb3('0x5')](e)){var event=events[e];Dashboard[_0x3eb3('0x6')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x9ff9=['hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x301e03,_0xfd3ffb){var _0x3b776e=function(_0x5375d0){while(--_0x5375d0){_0x301e03['push'](_0x301e03['shift']());}};_0x3b776e(++_0xfd3ffb);}(_0x9ff9,0x1c3));var _0x99ff=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x9ff9[_0x481bf7];return _0x461787;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x99ff('0x0'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x99ff('0x1')](0x0);var events={'afterCreate':_0x99ff('0x2'),'afterUpdate':'update','afterDestroy':_0x99ff('0x3')};function emitEvent(_0x3a1b21){return function(_0x24dd77,_0x3aa823,_0x56f748){DashboardEvents[_0x99ff('0x4')](_0x3a1b21+':'+_0x24dd77['id'],_0x24dd77);DashboardEvents[_0x99ff('0x4')](_0x3a1b21,_0x24dd77);_0x56f748(null);};}for(var e in events){if(events[_0x99ff('0x5')](e)){var event=events[e];Dashboard[_0x99ff('0x6')](e,emitEvent(event));}}module[_0x99ff('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index c72ef2a..b465654 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 _0xf313=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','Dashboard','lodash'];(function(_0x51c5d3,_0x20137e){var _0x1d5909=function(_0x56a5ef){while(--_0x56a5ef){_0x51c5d3['push'](_0x51c5d3['shift']());}};_0x1d5909(++_0x20137e);}(_0xf313,0x12b));var _0x3f31=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xf313[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x3f31('0x0'));var util=require('util');var logger=require(_0x3f31('0x1'))(_0x3f31('0x2'));var moment=require('moment');var BPromise=require(_0x3f31('0x3'));var rp=require(_0x3f31('0x4'));var fs=require('fs');var path=require(_0x3f31('0x5'));var rimraf=require('rimraf');var config=require(_0x3f31('0x6'));var attributes=require('./dashboard.attributes');module[_0x3f31('0x7')]=function(_0x552f9e,_0x3c9c9f){return _0x552f9e[_0x3f31('0x8')](_0x3f31('0x9'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa72e=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','Dashboard','dashboards','lodash','util'];(function(_0x2e25b6,_0x32ed94){var _0x1a99c3=function(_0x2c4281){while(--_0x2c4281){_0x2e25b6['push'](_0x2e25b6['shift']());}};_0x1a99c3(++_0x32ed94);}(_0xa72e,0x150));var _0xea72=function(_0x5374c9,_0x5239e8){_0x5374c9=_0x5374c9-0x0;var _0x1f4e5e=_0xa72e[_0x5374c9];return _0x1f4e5e;};'use strict';var _=require(_0xea72('0x0'));var util=require(_0xea72('0x1'));var logger=require(_0xea72('0x2'))(_0xea72('0x3'));var moment=require(_0xea72('0x4'));var BPromise=require(_0xea72('0x5'));var rp=require(_0xea72('0x6'));var fs=require('fs');var path=require(_0xea72('0x7'));var rimraf=require(_0xea72('0x8'));var config=require(_0xea72('0x9'));var attributes=require(_0xea72('0xa'));module['exports']=function(_0x3512e6,_0x3d5399){return _0x3512e6['define'](_0xea72('0xb'),attributes,{'tableName':_0xea72('0xc'),'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 f684b43..9932312 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 _0x2e99=['../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboard.socket','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x24341c,_0x137c37){var _0x3409f6=function(_0x390115){while(--_0x390115){_0x24341c['push'](_0x24341c['shift']());}};_0x3409f6(++_0x137c37);}(_0x2e99,0xf4));var _0x92e9=function(_0x2cfaaf,_0x880529){_0x2cfaaf=_0x2cfaaf-0x0;var _0x444943=_0x2e99[_0x2cfaaf];return _0x444943;};'use strict';var _=require(_0x92e9('0x0'));var util=require(_0x92e9('0x1'));var moment=require(_0x92e9('0x2'));var BPromise=require(_0x92e9('0x3'));var rs=require(_0x92e9('0x4'));var fs=require('fs');var Redis=require(_0x92e9('0x5'));var db=require(_0x92e9('0x6'))['db'];var utils=require(_0x92e9('0x7'));var logger=require(_0x92e9('0x8'))('rpc');var config=require(_0x92e9('0x9'));var jayson=require(_0x92e9('0xa'));var client=jayson[_0x92e9('0xb')][_0x92e9('0xc')]({'port':0x232a});config[_0x92e9('0xd')]=_['defaults'](config['redis'],{'host':_0x92e9('0xe'),'port':0x18eb});var socket=require(_0x92e9('0xf'))(new Redis(config[_0x92e9('0xd')]));require(_0x92e9('0x10'))['register'](socket);function respondWithRpcPromise(_0x24bdec,_0x17eb6c,_0xa05a04){return new BPromise(function(_0x161de1,_0x117bdf){return client['request'](_0x24bdec,_0xa05a04)[_0x92e9('0x11')](function(_0x4c097d){logger[_0x92e9('0x12')](_0x92e9('0x13'),_0x17eb6c,_0x92e9('0x14'));logger[_0x92e9('0x15')](_0x92e9('0x16'),_0x17eb6c,_0x92e9('0x14'),JSON[_0x92e9('0x17')](_0x4c097d));if(_0x4c097d[_0x92e9('0x18')]){if(_0x4c097d['error']['code']===0x1f4){logger[_0x92e9('0x18')](_0x92e9('0x13'),_0x17eb6c,_0x4c097d[_0x92e9('0x18')][_0x92e9('0x19')]);return _0x117bdf(_0x4c097d[_0x92e9('0x18')][_0x92e9('0x19')]);}logger[_0x92e9('0x18')](_0x92e9('0x13'),_0x17eb6c,_0x4c097d[_0x92e9('0x18')]['message']);return _0x161de1(_0x4c097d['error'][_0x92e9('0x19')]);}else{logger[_0x92e9('0x12')](_0x92e9('0x13'),_0x17eb6c,'request\x20sent');_0x161de1(_0x4c097d[_0x92e9('0x1a')][_0x92e9('0x19')]);}})[_0x92e9('0x1b')](function(_0xf97f6){logger['error'](_0x92e9('0x13'),_0x17eb6c,_0xf97f6);_0x117bdf(_0xf97f6);});});} \ No newline at end of file +var _0xf0c0=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','./dashboard.socket','register','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','randomstring','../../mysqldb'];(function(_0x25b24a,_0x1c0163){var _0x224e68=function(_0x1fc9d2){while(--_0x1fc9d2){_0x25b24a['push'](_0x25b24a['shift']());}};_0x224e68(++_0x1c0163);}(_0xf0c0,0x15a));var _0x0f0c=function(_0xe99738,_0x2bf43f){_0xe99738=_0xe99738-0x0;var _0x131cc4=_0xf0c0[_0xe99738];return _0x131cc4;};'use strict';var _=require('lodash');var util=require(_0x0f0c('0x0'));var moment=require(_0x0f0c('0x1'));var BPromise=require('bluebird');var rs=require(_0x0f0c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f0c('0x3'))['db'];var utils=require(_0x0f0c('0x4'));var logger=require('../../config/logger')(_0x0f0c('0x5'));var config=require(_0x0f0c('0x6'));var jayson=require(_0x0f0c('0x7'));var client=jayson[_0x0f0c('0x8')][_0x0f0c('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x0f0c('0xa'),'port':0x18eb});var socket=require(_0x0f0c('0xb'))(new Redis(config[_0x0f0c('0xc')]));require(_0x0f0c('0xd'))[_0x0f0c('0xe')](socket);function respondWithRpcPromise(_0x3bf33d,_0x389a60,_0x3f4126){return new BPromise(function(_0x1a8074,_0x32f424){return client[_0x0f0c('0xf')](_0x3bf33d,_0x3f4126)['then'](function(_0x4b12c4){logger[_0x0f0c('0x10')](_0x0f0c('0x11'),_0x389a60,_0x0f0c('0x12'));logger[_0x0f0c('0x13')](_0x0f0c('0x14'),_0x389a60,_0x0f0c('0x12'),JSON['stringify'](_0x4b12c4));if(_0x4b12c4['error']){if(_0x4b12c4[_0x0f0c('0x15')][_0x0f0c('0x16')]===0x1f4){logger['error'](_0x0f0c('0x11'),_0x389a60,_0x4b12c4[_0x0f0c('0x15')][_0x0f0c('0x17')]);return _0x32f424(_0x4b12c4[_0x0f0c('0x15')]['message']);}logger[_0x0f0c('0x15')](_0x0f0c('0x11'),_0x389a60,_0x4b12c4[_0x0f0c('0x15')][_0x0f0c('0x17')]);return _0x1a8074(_0x4b12c4['error'][_0x0f0c('0x17')]);}else{logger['info'](_0x0f0c('0x11'),_0x389a60,_0x0f0c('0x12'));_0x1a8074(_0x4b12c4['result'][_0x0f0c('0x17')]);}})[_0x0f0c('0x18')](function(_0xd3be0c){logger[_0x0f0c('0x15')](_0x0f0c('0x11'),_0x389a60,_0xd3be0c);_0x32f424(_0xd3be0c);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 21a46dc..a9cdd7e 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 _0x866e=['length','./dashboard.events','remove','removeListener'];(function(_0x140ef7,_0x38c3fa){var _0x446793=function(_0xe52a50){while(--_0xe52a50){_0x140ef7['push'](_0x140ef7['shift']());}};_0x446793(++_0x38c3fa);}(_0x866e,0xad));var _0xe866=function(_0x52d298,_0x5c056e){_0x52d298=_0x52d298-0x0;var _0x12323a=_0x866e[_0x52d298];return _0x12323a;};'use strict';var DashboardEvents=require(_0xe866('0x0'));var events=['save',_0xe866('0x1'),'update'];function createListener(_0x2439af,_0x61d5f8){return function(_0x523810){_0x61d5f8['emit'](_0x2439af,_0x523810);};}function removeListener(_0x2cb964,_0x5b931a){return function(){DashboardEvents[_0xe866('0x2')](_0x2cb964,_0x5b931a);};}exports['register']=function(_0x5263e2){for(var _0x2960c7=0x0,_0x4369f2=events[_0xe866('0x3')];_0x2960c7<_0x4369f2;_0x2960c7++){var _0x2a65bd=events[_0x2960c7];var _0xbcfa6d=createListener('dashboard:'+_0x2a65bd,_0x5263e2);DashboardEvents['on'](_0x2a65bd,_0xbcfa6d);}}; \ No newline at end of file +var _0xe513=['removeListener','register','length','save','remove','update','emit'];(function(_0x44d9cc,_0x3d912c){var _0x15b090=function(_0xf25ca3){while(--_0xf25ca3){_0x44d9cc['push'](_0x44d9cc['shift']());}};_0x15b090(++_0x3d912c);}(_0xe513,0xf8));var _0x3e51=function(_0x4d46f2,_0x26e045){_0x4d46f2=_0x4d46f2-0x0;var _0x228d1f=_0xe513[_0x4d46f2];return _0x228d1f;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x3e51('0x0'),_0x3e51('0x1'),_0x3e51('0x2')];function createListener(_0x57f5d5,_0x36e032){return function(_0x19d860){_0x36e032[_0x3e51('0x3')](_0x57f5d5,_0x19d860);};}function removeListener(_0x5a3469,_0xda2020){return function(){DashboardEvents[_0x3e51('0x4')](_0x5a3469,_0xda2020);};}exports[_0x3e51('0x5')]=function(_0x1ab2a2){for(var _0x11779d=0x0,_0x550183=events[_0x3e51('0x6')];_0x11779d<_0x550183;_0x11779d++){var _0x3b85d0=events[_0x11779d];var _0x14d83e=createListener('dashboard:'+_0x3b85d0,_0x1ab2a2);DashboardEvents['on'](_0x3b85d0,_0x14d83e);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 45767b0..fa9c3f5 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 _0xb874=['clone','addItem','put','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/items','getItems','post','/:id/clone'];(function(_0x22cb0e,_0x190ba9){var _0x10b1ed=function(_0x3844dc){while(--_0x3844dc){_0x22cb0e['push'](_0x22cb0e['shift']());}};_0x10b1ed(++_0x190ba9);}(_0xb874,0x12f));var _0x4b87=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb874[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x4b87('0x0'));var util=require(_0x4b87('0x1'));var path=require(_0x4b87('0x2'));var timeout=require(_0x4b87('0x3'));var express=require(_0x4b87('0x4'));var router=express[_0x4b87('0x5')]();var fs_extra=require(_0x4b87('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4b87('0x7'));var config=require(_0x4b87('0x8'));var controller=require('./dashboard.controller');router[_0x4b87('0x9')]('/',auth[_0x4b87('0xa')](),controller['index']);router['get'](_0x4b87('0xb'),auth[_0x4b87('0xa')](),controller[_0x4b87('0xc')]);router['get'](_0x4b87('0xd'),auth['isAuthenticated'](),controller[_0x4b87('0xe')]);router[_0x4b87('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4b87('0xf')](_0x4b87('0x10'),auth['isAuthenticated'](),controller[_0x4b87('0x11')]);router[_0x4b87('0xf')]('/:id/items',auth[_0x4b87('0xa')](),controller[_0x4b87('0x12')]);router[_0x4b87('0x13')]('/:id',auth[_0x4b87('0xa')](),controller['update']);router['delete'](_0x4b87('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xfe87=['isAuthenticated','index','get','/:id','getItems','post','create','/:id/clone','clone','/:id/items','update','exports','util','connect-timeout','express','Router','fs-extra','../../config/environment','./dashboard.controller'];(function(_0x3ab46c,_0x4d26cc){var _0x2c7e90=function(_0x29e83d){while(--_0x29e83d){_0x3ab46c['push'](_0x3ab46c['shift']());}};_0x2c7e90(++_0x4d26cc);}(_0xfe87,0x162));var _0x7fe8=function(_0xf295e9,_0x4657c0){_0xf295e9=_0xf295e9-0x0;var _0x562421=_0xfe87[_0xf295e9];return _0x562421;};'use strict';var multer=require('multer');var util=require(_0x7fe8('0x0'));var path=require('path');var timeout=require(_0x7fe8('0x1'));var express=require(_0x7fe8('0x2'));var router=express[_0x7fe8('0x3')]();var fs_extra=require(_0x7fe8('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7fe8('0x5'));var controller=require(_0x7fe8('0x6'));router['get']('/',auth[_0x7fe8('0x7')](),controller[_0x7fe8('0x8')]);router[_0x7fe8('0x9')](_0x7fe8('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x7fe8('0x9')]('/:id/items',auth[_0x7fe8('0x7')](),controller[_0x7fe8('0xb')]);router[_0x7fe8('0xc')]('/',auth[_0x7fe8('0x7')](),controller[_0x7fe8('0xd')]);router['post'](_0x7fe8('0xe'),auth['isAuthenticated'](),controller[_0x7fe8('0xf')]);router[_0x7fe8('0xc')](_0x7fe8('0x10'),auth[_0x7fe8('0x7')](),controller['addItem']);router['put'](_0x7fe8('0xa'),auth[_0x7fe8('0x7')](),controller[_0x7fe8('0x11')]);router['delete'](_0x7fe8('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x7fe8('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 4e191d9..e9c9354 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 _0xe3da=['squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','sequelize'];(function(_0x4a8617,_0x5d3dc5){var _0x44b7dd=function(_0x44d3d9){while(--_0x44d3d9){_0x4a8617['push'](_0x4a8617['shift']());}};_0x44b7dd(++_0x5d3dc5);}(_0xe3da,0x1cd));var _0xae3d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3da[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xae3d('0x0'));var squel=require(_0xae3d('0x1'));var _=require(_0xae3d('0x2'));module[_0xae3d('0x3')]={'title':{'type':Sequelize[_0xae3d('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xae3d('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xae3d('0x5')](_0xae3d('0x6')),'get':function(){try{return JSON[_0xae3d('0x7')](this[_0xae3d('0x8')](_0xae3d('0x9')));}catch(_0x26282d){return[];}},'set':function(_0xa9a1a){try{this[_0xae3d('0xa')](_0xae3d('0x9'),JSON[_0xae3d('0xb')](_0xa9a1a));}catch(_0x583b98){this[_0xae3d('0xa')](_0xae3d('0x9'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xae3d('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xae3d('0xc')]},'col':{'type':Sequelize[_0xae3d('0xc')]},'background':{'type':Sequelize[_0xae3d('0x4')],'allowNull':![],'defaultValue':_0xae3d('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xae3d('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xae3d('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0xeda8=['TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','#ffffff','sequelize','squel','exports','STRING'];(function(_0x3438cf,_0x73b174){var _0x278698=function(_0xbba932){while(--_0xbba932){_0x3438cf['push'](_0x3438cf['shift']());}};_0x278698(++_0x73b174);}(_0xeda8,0x104));var _0x8eda=function(_0x4c09ff,_0x23a3cc){_0x4c09ff=_0x4c09ff-0x0;var _0x4cf397=_0xeda8[_0x4c09ff];return _0x4cf397;};'use strict';var Sequelize=require(_0x8eda('0x0'));var squel=require(_0x8eda('0x1'));var _=require('lodash');module[_0x8eda('0x2')]={'title':{'type':Sequelize[_0x8eda('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8eda('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x8eda('0x4')](_0x8eda('0x5')),'get':function(){try{return JSON[_0x8eda('0x6')](this[_0x8eda('0x7')](_0x8eda('0x8')));}catch(_0x22dee9){return[];}},'set':function(_0x1f3556){try{this[_0x8eda('0x9')](_0x8eda('0x8'),JSON['stringify'](_0x1f3556));}catch(_0x28b721){this[_0x8eda('0x9')](_0x8eda('0x8'),JSON[_0x8eda('0xa')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x8eda('0x3')],'allowNull':![],'defaultValue':_0x8eda('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x8eda('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x8eda('0x3')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 390014a..5ea4bcc 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 _0xe0c1=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','reject','save','then','error','name','send','show','params','DashboardItem','query','keys','filters','intersection','model','attributes','length','options','catch','destroy','find','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','type','attrReport','attrRefresh','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x39d8fe,_0xae071e){var _0x4b52a6=function(_0xa91476){while(--_0xa91476){_0x39d8fe['push'](_0x39d8fe['shift']());}};_0x4b52a6(++_0xae071e);}(_0xe0c1,0x10f));var _0x1e0c=function(_0xfbcbb,_0x12233e){_0xfbcbb=_0xfbcbb-0x0;var _0x531aa4=_0xe0c1[_0xfbcbb];return _0x531aa4;};'use strict';var emlformat=require(_0x1e0c('0x0'));var rimraf=require(_0x1e0c('0x1'));var zipdir=require(_0x1e0c('0x2'));var jsonpatch=require(_0x1e0c('0x3'));var rp=require(_0x1e0c('0x4'));var moment=require(_0x1e0c('0x5'));var BPromise=require(_0x1e0c('0x6'));var Mustache=require('mustache');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(_0x1e0c('0x7'));var _=require(_0x1e0c('0x8'));var squel=require(_0x1e0c('0x9'));var crypto=require(_0x1e0c('0xa'));var jsforce=require(_0x1e0c('0xb'));var deskjs=require(_0x1e0c('0xc'));var toCsv=require(_0x1e0c('0xd'));var querystring=require(_0x1e0c('0xe'));var Papa=require('papaparse');var Redis=require(_0x1e0c('0xf'));var authService=require(_0x1e0c('0x10'));var qs=require(_0x1e0c('0x11'));var as=require(_0x1e0c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e0c('0x13'))(_0x1e0c('0x14'));var utils=require(_0x1e0c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1e0c('0x16'));var db=require('../../mysqldb')['db'];config[_0x1e0c('0x17')]=_[_0x1e0c('0x18')](config[_0x1e0c('0x17')],{'host':_0x1e0c('0x19'),'port':0x18eb});var socket=require(_0x1e0c('0x1a'))(new Redis(config[_0x1e0c('0x17')]));require(_0x1e0c('0x1b'))[_0x1e0c('0x1c')](socket);function respondWithStatusCode(_0x1fbc44,_0x452248){_0x452248=_0x452248||0xcc;return function(_0x599d0b){if(_0x599d0b){return _0x1fbc44[_0x1e0c('0x1d')](_0x452248);}return _0x1fbc44['status'](_0x452248)[_0x1e0c('0x1e')]();};}function respondWithResult(_0xcf9c3b,_0x13840b){_0x13840b=_0x13840b||0xc8;return function(_0xb52d20){if(_0xb52d20){return _0xcf9c3b[_0x1e0c('0x1f')](_0x13840b)[_0x1e0c('0x20')](_0xb52d20);}};}function respondWithFilteredResult(_0x35a9cc,_0x4e2fbd){return function(_0x4315aa){if(_0x4315aa){var _0x1d0fe6=typeof _0x4e2fbd[_0x1e0c('0x21')]===_0x1e0c('0x22')&&typeof _0x4e2fbd['limit']==='undefined';var _0x596304=_0x4315aa[_0x1e0c('0x23')];var _0x268365=_0x1d0fe6?0x0:_0x4e2fbd[_0x1e0c('0x21')];var _0x186a02=_0x1d0fe6?_0x4315aa[_0x1e0c('0x23')]:_0x4e2fbd[_0x1e0c('0x21')]+_0x4e2fbd[_0x1e0c('0x24')];var _0x3c955c;if(_0x186a02>=_0x596304){_0x186a02=_0x596304;_0x3c955c=0xc8;}else{_0x3c955c=0xce;}_0x35a9cc['status'](_0x3c955c);return _0x35a9cc['set'](_0x1e0c('0x25'),_0x268365+'-'+_0x186a02+'/'+_0x596304)[_0x1e0c('0x20')](_0x4315aa);}return null;};}function patchUpdates(_0x3b1200){return function(_0xb29b17){try{jsonpatch['apply'](_0xb29b17,_0x3b1200,!![]);}catch(_0x4743e7){return BPromise[_0x1e0c('0x26')](_0x4743e7);}return _0xb29b17[_0x1e0c('0x27')]();};}function saveUpdates(_0x1cf772,_0x3d5f10){return function(_0x1697a4){if(_0x1697a4){return _0x1697a4['update'](_0x1cf772)['then'](function(_0x1d7c49){return _0x1d7c49;});}return null;};}function removeEntity(_0x3867c6,_0x4296b5){return function(_0x46eb21){if(_0x46eb21){return _0x46eb21['destroy']()[_0x1e0c('0x28')](function(){_0x3867c6[_0x1e0c('0x1f')](0xcc)[_0x1e0c('0x1e')]();});}};}function handleEntityNotFound(_0x5e7e6f,_0xef59ad){return function(_0x1a6a87){if(!_0x1a6a87){_0x5e7e6f[_0x1e0c('0x1d')](0x194);}return _0x1a6a87;};}function handleError(_0x2d8c99,_0x2c7593){_0x2c7593=_0x2c7593||0x1f4;return function(_0x4e0cea){logger[_0x1e0c('0x29')](_0x4e0cea['stack']);if(_0x4e0cea[_0x1e0c('0x2a')]){delete _0x4e0cea['name'];}_0x2d8c99[_0x1e0c('0x1f')](_0x2c7593)[_0x1e0c('0x2b')](_0x4e0cea);};}exports[_0x1e0c('0x2c')]=function(_0x28422a,_0x11cb84){var _0x5be528={'raw':![],'where':{'id':_0x28422a[_0x1e0c('0x2d')]['id']}},_0x1c96bf={};_0x1c96bf['model']=_['keys'](db[_0x1e0c('0x2e')]['rawAttributes']);_0x1c96bf[_0x1e0c('0x2f')]=_[_0x1e0c('0x30')](_0x28422a[_0x1e0c('0x2f')]);_0x1c96bf[_0x1e0c('0x31')]=_[_0x1e0c('0x32')](_0x1c96bf[_0x1e0c('0x33')],_0x1c96bf[_0x1e0c('0x2f')]);_0x5be528[_0x1e0c('0x34')]=_[_0x1e0c('0x32')](_0x1c96bf[_0x1e0c('0x33')],qs['fields'](_0x28422a[_0x1e0c('0x2f')]['fields']));_0x5be528[_0x1e0c('0x34')]=_0x5be528['attributes'][_0x1e0c('0x35')]?_0x5be528['attributes']:_0x1c96bf[_0x1e0c('0x33')];if(_0x28422a[_0x1e0c('0x2f')]['includeAll']){_0x5be528['include']=[{'all':!![]}];}_0x5be528=_['merge']({},_0x5be528,_0x28422a[_0x1e0c('0x36')]);return db['DashboardItem']['find'](_0x5be528)[_0x1e0c('0x28')](handleEntityNotFound(_0x11cb84,null))[_0x1e0c('0x28')](respondWithResult(_0x11cb84,null))[_0x1e0c('0x37')](handleError(_0x11cb84,null));};exports[_0x1e0c('0x38')]=function(_0x293bef,_0x40d2e9){return db['DashboardItem'][_0x1e0c('0x39')]({'where':{'id':_0x293bef[_0x1e0c('0x2d')]['id']}})[_0x1e0c('0x28')](handleEntityNotFound(_0x40d2e9,null))[_0x1e0c('0x28')](removeEntity(_0x40d2e9,null))[_0x1e0c('0x37')](handleError(_0x40d2e9,null));};function widgetAttributes(_0x208d98){try{switch(_0x208d98['type']){case _0x1e0c('0x3a'):return[{'name':_0x1e0c('0x3b'),'value':_0x208d98[_0x1e0c('0x3b')]||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98[_0x1e0c('0x3c')][0x0]?_0x208d98[_0x1e0c('0x3c')][0x0]['value']:undefined)||_0x1e0c('0x3d')}];case _0x1e0c('0x3e'):return[{'name':'attrPath','value':_0x208d98[_0x1e0c('0x3f')]||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98['attrs'][0x0]?_0x208d98['attrs'][0x0][_0x1e0c('0x40')]:undefined)||''}];case _0x1e0c('0x41'):return[{'name':_0x1e0c('0x42'),'value':_0x208d98[_0x1e0c('0x42')]||(_0x208d98['attrs']&&_0x208d98['attrs'][0x0]?_0x208d98[_0x1e0c('0x3c')][0x0]['value']:undefined)||_0x1e0c('0x43')},{'name':_0x1e0c('0x44'),'value':_0x208d98[_0x1e0c('0x44')]||(_0x208d98['attrs']&&_0x208d98['attrs'][0x1]?_0x208d98[_0x1e0c('0x3c')][0x1]['value']:undefined)||_0x1e0c('0x45')},{'name':'attrFontSize','value':_0x208d98[_0x1e0c('0x46')]||(_0x208d98['attrs']&&_0x208d98[_0x1e0c('0x3c')][0x2]?_0x208d98['attrs'][0x2][_0x1e0c('0x40')]:undefined)||0xc}];case _0x1e0c('0x47'):return[{'name':_0x1e0c('0x48'),'value':_0x208d98[_0x1e0c('0x48')]||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98[_0x1e0c('0x3c')][0x0]?_0x208d98['attrs'][0x0]['value']:undefined)||_0x1e0c('0x49')},{'name':_0x1e0c('0x4a'),'value':_0x208d98[_0x1e0c('0x4a')]||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98[_0x1e0c('0x3c')][0x1]?_0x208d98[_0x1e0c('0x3c')][0x1]['value']:undefined)||[]},{'name':_0x1e0c('0x46'),'value':_0x208d98[_0x1e0c('0x46')]||(_0x208d98['attrs']&&_0x208d98['attrs'][0x2]?_0x208d98[_0x1e0c('0x3c')][0x2][_0x1e0c('0x40')]:undefined)||0x14},{'name':_0x1e0c('0x4b'),'value':_0x208d98[_0x1e0c('0x4b')]||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98[_0x1e0c('0x3c')][0x3]?_0x208d98[_0x1e0c('0x3c')][0x3][_0x1e0c('0x40')]:undefined)||_0x1e0c('0x4c')},{'name':_0x1e0c('0x4d'),'value':_0x208d98[_0x1e0c('0x4d')]||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98['attrs'][0x4]?_0x208d98[_0x1e0c('0x3c')][0x4]['value']:undefined)||''},{'name':_0x1e0c('0x4e'),'value':_0x208d98[_0x1e0c('0x4e')]||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98[_0x1e0c('0x3c')][0x5]?_0x208d98[_0x1e0c('0x3c')][0x5][_0x1e0c('0x40')]:undefined)||''},{'name':_0x1e0c('0x4f'),'value':_0x208d98[_0x1e0c('0x4f')]||(_0x208d98['attrs']&&_0x208d98['attrs'][0x6]?_0x208d98[_0x1e0c('0x3c')][0x6][_0x1e0c('0x40')]:undefined)||''},{'name':_0x1e0c('0x50'),'value':_0x208d98['attrOpenchannelAccounts']||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98[_0x1e0c('0x3c')][0x7]?_0x208d98[_0x1e0c('0x3c')][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x208d98[_0x1e0c('0x51')]||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98['attrs'][0x8]?_0x208d98[_0x1e0c('0x3c')][0x8][_0x1e0c('0x40')]:undefined)||''},{'name':_0x1e0c('0x52'),'value':_0x208d98['attrChatWebsites']||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98['attrs'][0x9]?_0x208d98[_0x1e0c('0x3c')][0x9][_0x1e0c('0x40')]:undefined)||''}];case _0x1e0c('0x53'):case _0x1e0c('0x54'):return[{'name':_0x1e0c('0x55'),'value':_0x208d98[_0x1e0c('0x55')]||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98[_0x1e0c('0x3c')][0x0]?_0x208d98[_0x1e0c('0x3c')][0x0]['value']:undefined)||'total'},{'name':_0x1e0c('0x56'),'value':_0x208d98[_0x1e0c('0x56')]||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98[_0x1e0c('0x3c')][0x1]?_0x208d98[_0x1e0c('0x3c')][0x1][_0x1e0c('0x40')]:undefined)||null},{'name':'attrSerie3','value':_0x208d98[_0x1e0c('0x57')]||(_0x208d98['attrs']&&_0x208d98['attrs'][0x2]?_0x208d98[_0x1e0c('0x3c')][0x2]['value']:undefined)||null},{'name':_0x1e0c('0x4a'),'value':_0x208d98[_0x1e0c('0x4a')]||(_0x208d98['attrs']&&_0x208d98['attrs'][0x3]?_0x208d98[_0x1e0c('0x3c')][0x3]['value']:undefined)||[]},{'name':_0x1e0c('0x4b'),'value':_0x208d98[_0x1e0c('0x4b')]||(_0x208d98['attrs']&&_0x208d98[_0x1e0c('0x3c')][0x4]?_0x208d98[_0x1e0c('0x3c')][0x4][_0x1e0c('0x40')]:undefined)||_0x1e0c('0x4c')},{'name':_0x1e0c('0x4d'),'value':_0x208d98[_0x1e0c('0x4d')]||(_0x208d98['attrs']&&_0x208d98['attrs'][0x5]?_0x208d98[_0x1e0c('0x3c')][0x5][_0x1e0c('0x40')]:undefined)||''},{'name':_0x1e0c('0x4e'),'value':_0x208d98[_0x1e0c('0x4e')]||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98[_0x1e0c('0x3c')][0x6]?_0x208d98[_0x1e0c('0x3c')][0x6]['value']:undefined)||''},{'name':_0x1e0c('0x4f'),'value':_0x208d98[_0x1e0c('0x4f')]||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98[_0x1e0c('0x3c')][0x7]?_0x208d98[_0x1e0c('0x3c')][0x7][_0x1e0c('0x40')]:undefined)||''},{'name':_0x1e0c('0x50'),'value':_0x208d98['attrOpenchannelAccounts']||(_0x208d98['attrs']&&_0x208d98[_0x1e0c('0x3c')][0x8]?_0x208d98['attrs'][0x8][_0x1e0c('0x40')]:undefined)||''},{'name':_0x1e0c('0x51'),'value':_0x208d98[_0x1e0c('0x51')]||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98[_0x1e0c('0x3c')][0x9]?_0x208d98[_0x1e0c('0x3c')][0x9]['value']:undefined)||''},{'name':_0x1e0c('0x52'),'value':_0x208d98[_0x1e0c('0x52')]||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98[_0x1e0c('0x3c')][0xa]?_0x208d98[_0x1e0c('0x3c')][0xa]['value']:undefined)||''}];case _0x1e0c('0x58'):return[{'name':'attrReport','type':_0x208d98[_0x1e0c('0x59')]||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98[_0x1e0c('0x3c')][0x0]?_0x208d98[_0x1e0c('0x3c')][0x0][_0x1e0c('0x5a')]:undefined)||null,'value':_0x208d98[_0x1e0c('0x5b')]||(_0x208d98['attrs']&&_0x208d98[_0x1e0c('0x3c')][0x0]?_0x208d98[_0x1e0c('0x3c')][0x0][_0x1e0c('0x40')]:undefined)||null},{'name':_0x1e0c('0x5c'),'value':_0x208d98['attrRefresh']||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98[_0x1e0c('0x3c')][0x1]?_0x208d98[_0x1e0c('0x3c')][0x1][_0x1e0c('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x2ae0ab){logger[_0x1e0c('0x29')]('widgetAttributes:\x20%s',JSON['stringify'](_0x2ae0ab));return[];}}exports[_0x1e0c('0x5d')]=function(_0x35febe,_0x126969){if(_0x35febe[_0x1e0c('0x5e')]){_0x35febe['body'][_0x1e0c('0x3c')]=widgetAttributes(_0x35febe[_0x1e0c('0x5e')]);}return db['DashboardItem'][_0x1e0c('0x5d')](_0x35febe[_0x1e0c('0x5e')],{})[_0x1e0c('0x28')](respondWithResult(_0x126969,0xc9))['catch'](handleError(_0x126969,null));};exports['update']=function(_0x163bca,_0x2ad822){if(_0x163bca['body']['id']){delete _0x163bca[_0x1e0c('0x5e')]['id'];}_0x163bca[_0x1e0c('0x5e')]['attrs']=widgetAttributes(_0x163bca[_0x1e0c('0x5e')]);return db[_0x1e0c('0x2e')][_0x1e0c('0x39')]({'where':{'id':_0x163bca['params']['id']}})[_0x1e0c('0x28')](handleEntityNotFound(_0x2ad822,null))['then'](saveUpdates(_0x163bca['body'],null))[_0x1e0c('0x28')](respondWithResult(_0x2ad822,null))[_0x1e0c('0x37')](handleError(_0x2ad822,null));}; \ No newline at end of file +var _0x71ad=['name','show','params','keys','rawAttributes','query','intersection','model','fields','attributes','length','includeAll','include','merge','options','DashboardItem','find','catch','attrUrl','attrs','value','https://','attrPath','attrHourFormat','HH:mm:ss','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update','eml-format','rimraf','fast-json-patch','moment','bluebird','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack'];(function(_0x3ab7ed,_0x57a3a7){var _0x3ba976=function(_0x1e2bc5){while(--_0x1e2bc5){_0x3ab7ed['push'](_0x3ab7ed['shift']());}};_0x3ba976(++_0x57a3a7);}(_0x71ad,0xee));var _0xd71a=function(_0x55419b,_0x2e5656){_0x55419b=_0x55419b-0x0;var _0x29b5ac=_0x71ad[_0x55419b];return _0x29b5ac;};'use strict';var emlformat=require(_0xd71a('0x0'));var rimraf=require(_0xd71a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd71a('0x2'));var rp=require('request-promise');var moment=require(_0xd71a('0x3'));var BPromise=require(_0xd71a('0x4'));var Mustache=require('mustache');var util=require(_0xd71a('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xd71a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd71a('0x7'));var _=require(_0xd71a('0x8'));var squel=require(_0xd71a('0x9'));var crypto=require(_0xd71a('0xa'));var jsforce=require(_0xd71a('0xb'));var deskjs=require(_0xd71a('0xc'));var toCsv=require(_0xd71a('0x6'));var querystring=require('querystring');var Papa=require(_0xd71a('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd71a('0xe'));var as=require(_0xd71a('0xf'));var hardwareService=require(_0xd71a('0x10'));var logger=require(_0xd71a('0x11'))(_0xd71a('0x12'));var utils=require(_0xd71a('0x13'));var config=require(_0xd71a('0x14'));var licenseUtil=require(_0xd71a('0x15'));var db=require(_0xd71a('0x16'))['db'];config[_0xd71a('0x17')]=_['defaults'](config[_0xd71a('0x17')],{'host':_0xd71a('0x18'),'port':0x18eb});var socket=require(_0xd71a('0x19'))(new Redis(config[_0xd71a('0x17')]));require(_0xd71a('0x1a'))[_0xd71a('0x1b')](socket);function respondWithStatusCode(_0x10c0de,_0x188886){_0x188886=_0x188886||0xcc;return function(_0x388203){if(_0x388203){return _0x10c0de[_0xd71a('0x1c')](_0x188886);}return _0x10c0de[_0xd71a('0x1d')](_0x188886)[_0xd71a('0x1e')]();};}function respondWithResult(_0x2c54c5,_0x4256da){_0x4256da=_0x4256da||0xc8;return function(_0xd16472){if(_0xd16472){return _0x2c54c5['status'](_0x4256da)[_0xd71a('0x1f')](_0xd16472);}};}function respondWithFilteredResult(_0x21334d,_0x6abf4f){return function(_0x5389fd){if(_0x5389fd){var _0x50cceb=typeof _0x6abf4f['offset']===_0xd71a('0x20')&&typeof _0x6abf4f[_0xd71a('0x21')]===_0xd71a('0x20');var _0x25bb9b=_0x5389fd[_0xd71a('0x22')];var _0x31a58d=_0x50cceb?0x0:_0x6abf4f['offset'];var _0x408c0d=_0x50cceb?_0x5389fd[_0xd71a('0x22')]:_0x6abf4f['offset']+_0x6abf4f['limit'];var _0xc16934;if(_0x408c0d>=_0x25bb9b){_0x408c0d=_0x25bb9b;_0xc16934=0xc8;}else{_0xc16934=0xce;}_0x21334d[_0xd71a('0x1d')](_0xc16934);return _0x21334d[_0xd71a('0x23')](_0xd71a('0x24'),_0x31a58d+'-'+_0x408c0d+'/'+_0x25bb9b)['json'](_0x5389fd);}return null;};}function patchUpdates(_0x1732f0){return function(_0x3afdb5){try{jsonpatch[_0xd71a('0x25')](_0x3afdb5,_0x1732f0,!![]);}catch(_0x3be820){return BPromise[_0xd71a('0x26')](_0x3be820);}return _0x3afdb5[_0xd71a('0x27')]();};}function saveUpdates(_0x4528e8,_0x3aedde){return function(_0x46dc82){if(_0x46dc82){return _0x46dc82['update'](_0x4528e8)[_0xd71a('0x28')](function(_0x525ce9){return _0x525ce9;});}return null;};}function removeEntity(_0x339d6f,_0x589954){return function(_0x59e8fe){if(_0x59e8fe){return _0x59e8fe[_0xd71a('0x29')]()['then'](function(){_0x339d6f[_0xd71a('0x1d')](0xcc)[_0xd71a('0x1e')]();});}};}function handleEntityNotFound(_0x402735,_0x2e44a2){return function(_0x174209){if(!_0x174209){_0x402735[_0xd71a('0x1c')](0x194);}return _0x174209;};}function handleError(_0x57c38b,_0x4606de){_0x4606de=_0x4606de||0x1f4;return function(_0x33f503){logger[_0xd71a('0x2a')](_0x33f503[_0xd71a('0x2b')]);if(_0x33f503[_0xd71a('0x2c')]){delete _0x33f503[_0xd71a('0x2c')];}_0x57c38b[_0xd71a('0x1d')](_0x4606de)['send'](_0x33f503);};}exports[_0xd71a('0x2d')]=function(_0x5de362,_0x472c44){var _0x4c5054={'raw':![],'where':{'id':_0x5de362[_0xd71a('0x2e')]['id']}},_0x93a1fe={};_0x93a1fe['model']=_[_0xd71a('0x2f')](db['DashboardItem'][_0xd71a('0x30')]);_0x93a1fe['query']=_['keys'](_0x5de362[_0xd71a('0x31')]);_0x93a1fe['filters']=_[_0xd71a('0x32')](_0x93a1fe[_0xd71a('0x33')],_0x93a1fe[_0xd71a('0x31')]);_0x4c5054['attributes']=_['intersection'](_0x93a1fe[_0xd71a('0x33')],qs[_0xd71a('0x34')](_0x5de362['query'][_0xd71a('0x34')]));_0x4c5054[_0xd71a('0x35')]=_0x4c5054[_0xd71a('0x35')][_0xd71a('0x36')]?_0x4c5054[_0xd71a('0x35')]:_0x93a1fe[_0xd71a('0x33')];if(_0x5de362[_0xd71a('0x31')][_0xd71a('0x37')]){_0x4c5054[_0xd71a('0x38')]=[{'all':!![]}];}_0x4c5054=_[_0xd71a('0x39')]({},_0x4c5054,_0x5de362[_0xd71a('0x3a')]);return db[_0xd71a('0x3b')][_0xd71a('0x3c')](_0x4c5054)[_0xd71a('0x28')](handleEntityNotFound(_0x472c44,null))['then'](respondWithResult(_0x472c44,null))[_0xd71a('0x3d')](handleError(_0x472c44,null));};exports['destroy']=function(_0x6c55a,_0x2fd90b){return db['DashboardItem'][_0xd71a('0x3c')]({'where':{'id':_0x6c55a[_0xd71a('0x2e')]['id']}})[_0xd71a('0x28')](handleEntityNotFound(_0x2fd90b,null))['then'](removeEntity(_0x2fd90b,null))[_0xd71a('0x3d')](handleError(_0x2fd90b,null));};function widgetAttributes(_0x3b5dee){try{switch(_0x3b5dee['type']){case'iframe':return[{'name':_0xd71a('0x3e'),'value':_0x3b5dee[_0xd71a('0x3e')]||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee[_0xd71a('0x3f')][0x0]?_0x3b5dee[_0xd71a('0x3f')][0x0][_0xd71a('0x40')]:undefined)||_0xd71a('0x41')}];case'custom':return[{'name':_0xd71a('0x42'),'value':_0x3b5dee[_0xd71a('0x42')]||(_0x3b5dee['attrs']&&_0x3b5dee[_0xd71a('0x3f')][0x0]?_0x3b5dee['attrs'][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0xd71a('0x43'),'value':_0x3b5dee[_0xd71a('0x43')]||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee['attrs'][0x0]?_0x3b5dee[_0xd71a('0x3f')][0x0][_0xd71a('0x40')]:undefined)||_0xd71a('0x44')},{'name':'attrTimezone','value':_0x3b5dee['attrTimezone']||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee[_0xd71a('0x3f')][0x1]?_0x3b5dee[_0xd71a('0x3f')][0x1]['value']:undefined)||_0xd71a('0x45')},{'name':_0xd71a('0x46'),'value':_0x3b5dee[_0xd71a('0x46')]||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee['attrs'][0x2]?_0x3b5dee['attrs'][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0xd71a('0x47'),'value':_0x3b5dee[_0xd71a('0x47')]||(_0x3b5dee['attrs']&&_0x3b5dee[_0xd71a('0x3f')][0x0]?_0x3b5dee[_0xd71a('0x3f')][0x0][_0xd71a('0x40')]:undefined)||_0xd71a('0x48')},{'name':_0xd71a('0x49'),'value':_0x3b5dee['attrVoiceQueues']||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee[_0xd71a('0x3f')][0x1]?_0x3b5dee[_0xd71a('0x3f')][0x1][_0xd71a('0x40')]:undefined)||[]},{'name':_0xd71a('0x46'),'value':_0x3b5dee[_0xd71a('0x46')]||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee['attrs'][0x2]?_0x3b5dee[_0xd71a('0x3f')][0x2][_0xd71a('0x40')]:undefined)||0x14},{'name':_0xd71a('0x4a'),'value':_0x3b5dee[_0xd71a('0x4a')]||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee[_0xd71a('0x3f')][0x3]?_0x3b5dee[_0xd71a('0x3f')][0x3]['value']:undefined)||_0xd71a('0x4b')},{'name':_0xd71a('0x4c'),'value':_0x3b5dee['attrEmailAccounts']||(_0x3b5dee['attrs']&&_0x3b5dee['attrs'][0x4]?_0x3b5dee[_0xd71a('0x3f')][0x4]['value']:undefined)||''},{'name':_0xd71a('0x4d'),'value':_0x3b5dee[_0xd71a('0x4d')]||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee[_0xd71a('0x3f')][0x5]?_0x3b5dee[_0xd71a('0x3f')][0x5][_0xd71a('0x40')]:undefined)||''},{'name':_0xd71a('0x4e'),'value':_0x3b5dee[_0xd71a('0x4e')]||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee[_0xd71a('0x3f')][0x6]?_0x3b5dee['attrs'][0x6][_0xd71a('0x40')]:undefined)||''},{'name':_0xd71a('0x4f'),'value':_0x3b5dee['attrOpenchannelAccounts']||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee[_0xd71a('0x3f')][0x7]?_0x3b5dee['attrs'][0x7]['value']:undefined)||''},{'name':_0xd71a('0x50'),'value':_0x3b5dee[_0xd71a('0x50')]||(_0x3b5dee['attrs']&&_0x3b5dee[_0xd71a('0x3f')][0x8]?_0x3b5dee['attrs'][0x8][_0xd71a('0x40')]:undefined)||''},{'name':_0xd71a('0x51'),'value':_0x3b5dee['attrChatWebsites']||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee[_0xd71a('0x3f')][0x9]?_0x3b5dee[_0xd71a('0x3f')][0x9][_0xd71a('0x40')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':'attrSerie1','value':_0x3b5dee[_0xd71a('0x52')]||(_0x3b5dee['attrs']&&_0x3b5dee[_0xd71a('0x3f')][0x0]?_0x3b5dee[_0xd71a('0x3f')][0x0][_0xd71a('0x40')]:undefined)||_0xd71a('0x48')},{'name':_0xd71a('0x53'),'value':_0x3b5dee['attrSerie2']||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee[_0xd71a('0x3f')][0x1]?_0x3b5dee[_0xd71a('0x3f')][0x1][_0xd71a('0x40')]:undefined)||null},{'name':_0xd71a('0x54'),'value':_0x3b5dee[_0xd71a('0x54')]||(_0x3b5dee['attrs']&&_0x3b5dee[_0xd71a('0x3f')][0x2]?_0x3b5dee[_0xd71a('0x3f')][0x2][_0xd71a('0x40')]:undefined)||null},{'name':_0xd71a('0x49'),'value':_0x3b5dee[_0xd71a('0x49')]||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee[_0xd71a('0x3f')][0x3]?_0x3b5dee[_0xd71a('0x3f')][0x3]['value']:undefined)||[]},{'name':_0xd71a('0x4a'),'value':_0x3b5dee[_0xd71a('0x4a')]||(_0x3b5dee['attrs']&&_0x3b5dee[_0xd71a('0x3f')][0x4]?_0x3b5dee[_0xd71a('0x3f')][0x4][_0xd71a('0x40')]:undefined)||_0xd71a('0x4b')},{'name':'attrEmailAccounts','value':_0x3b5dee[_0xd71a('0x4c')]||(_0x3b5dee['attrs']&&_0x3b5dee[_0xd71a('0x3f')][0x5]?_0x3b5dee[_0xd71a('0x3f')][0x5][_0xd71a('0x40')]:undefined)||''},{'name':_0xd71a('0x4d'),'value':_0x3b5dee[_0xd71a('0x4d')]||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee['attrs'][0x6]?_0x3b5dee[_0xd71a('0x3f')][0x6]['value']:undefined)||''},{'name':_0xd71a('0x4e'),'value':_0x3b5dee[_0xd71a('0x4e')]||(_0x3b5dee['attrs']&&_0x3b5dee[_0xd71a('0x3f')][0x7]?_0x3b5dee[_0xd71a('0x3f')][0x7][_0xd71a('0x40')]:undefined)||''},{'name':_0xd71a('0x4f'),'value':_0x3b5dee[_0xd71a('0x4f')]||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee[_0xd71a('0x3f')][0x8]?_0x3b5dee[_0xd71a('0x3f')][0x8][_0xd71a('0x40')]:undefined)||''},{'name':_0xd71a('0x50'),'value':_0x3b5dee[_0xd71a('0x50')]||(_0x3b5dee['attrs']&&_0x3b5dee[_0xd71a('0x3f')][0x9]?_0x3b5dee[_0xd71a('0x3f')][0x9]['value']:undefined)||''},{'name':_0xd71a('0x51'),'value':_0x3b5dee[_0xd71a('0x51')]||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee[_0xd71a('0x3f')][0xa]?_0x3b5dee[_0xd71a('0x3f')][0xa]['value']:undefined)||''}];case _0xd71a('0x55'):return[{'name':_0xd71a('0x56'),'type':_0x3b5dee[_0xd71a('0x57')]||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee[_0xd71a('0x3f')][0x0]?_0x3b5dee[_0xd71a('0x3f')][0x0]['type']:undefined)||null,'value':_0x3b5dee[_0xd71a('0x56')]||(_0x3b5dee['attrs']&&_0x3b5dee[_0xd71a('0x3f')][0x0]?_0x3b5dee[_0xd71a('0x3f')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x3b5dee[_0xd71a('0x58')]||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee['attrs'][0x1]?_0x3b5dee[_0xd71a('0x3f')][0x1][_0xd71a('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x3109a8){logger['error'](_0xd71a('0x59'),JSON[_0xd71a('0x5a')](_0x3109a8));return[];}}exports[_0xd71a('0x5b')]=function(_0x3cdd5d,_0x510f62){if(_0x3cdd5d[_0xd71a('0x5c')]){_0x3cdd5d[_0xd71a('0x5c')][_0xd71a('0x3f')]=widgetAttributes(_0x3cdd5d[_0xd71a('0x5c')]);}return db[_0xd71a('0x3b')][_0xd71a('0x5b')](_0x3cdd5d[_0xd71a('0x5c')],{})[_0xd71a('0x28')](respondWithResult(_0x510f62,0xc9))[_0xd71a('0x3d')](handleError(_0x510f62,null));};exports[_0xd71a('0x5d')]=function(_0x38449a,_0x5194ca){if(_0x38449a['body']['id']){delete _0x38449a[_0xd71a('0x5c')]['id'];}_0x38449a[_0xd71a('0x5c')][_0xd71a('0x3f')]=widgetAttributes(_0x38449a[_0xd71a('0x5c')]);return db[_0xd71a('0x3b')][_0xd71a('0x3c')]({'where':{'id':_0x38449a['params']['id']}})['then'](handleEntityNotFound(_0x5194ca,null))['then'](saveUpdates(_0x38449a[_0xd71a('0x5c')],null))[_0xd71a('0x28')](respondWithResult(_0x5194ca,null))[_0xd71a('0x3d')](handleError(_0x5194ca,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 54846f9..d0127bc 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 _0x221f=['save','remove','emit','hook','exports','events','DashboardItem','setMaxListeners'];(function(_0x5b7e4a,_0x2747e4){var _0x5e5858=function(_0x4783b3){while(--_0x4783b3){_0x5b7e4a['push'](_0x5b7e4a['shift']());}};_0x5e5858(++_0x2747e4);}(_0x221f,0x19d));var _0xf221=function(_0x26f1cf,_0x3ed15f){_0x26f1cf=_0x26f1cf-0x0;var _0x6674e8=_0x221f[_0x26f1cf];return _0x6674e8;};'use strict';var EventEmitter=require(_0xf221('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0xf221('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xf221('0x2')](0x0);var events={'afterCreate':_0xf221('0x3'),'afterUpdate':'update','afterDestroy':_0xf221('0x4')};function emitEvent(_0x370609){return function(_0xe279d1,_0x363a9c,_0x969947){DashboardItemEvents[_0xf221('0x5')](_0x370609+':'+_0xe279d1['id'],_0xe279d1);DashboardItemEvents[_0xf221('0x5')](_0x370609,_0xe279d1);_0x969947(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xf221('0x6')](e,emitEvent(event));}}module[_0xf221('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0x624d=['remove','emit','exports','DashboardItem','setMaxListeners'];(function(_0xc3aa24,_0x48eeb5){var _0x20f67b=function(_0x286be5){while(--_0x286be5){_0xc3aa24['push'](_0xc3aa24['shift']());}};_0x20f67b(++_0x48eeb5);}(_0x624d,0xbc));var _0xd624=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x624d[_0x138f59];return _0x3d114d;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db'][_0xd624('0x0')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xd624('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd624('0x2')};function emitEvent(_0x5b2cce){return function(_0x1be98e,_0x25e2a8,_0x5eba22){DashboardItemEvents[_0xd624('0x3')](_0x5b2cce+':'+_0x1be98e['id'],_0x1be98e);DashboardItemEvents[_0xd624('0x3')](_0x5b2cce,_0x1be98e);_0x5eba22(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xd624('0x4')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index d70a1e6..704dbbe 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 _0x5145=['define','DashboardItem','dashboard_items','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./dashboardItem.attributes','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5145,0x93));var _0x5514=function(_0x5f0a7d,_0x1e2628){_0x5f0a7d=_0x5f0a7d-0x0;var _0x233fd6=_0x5145[_0x5f0a7d];return _0x233fd6;};'use strict';var _=require(_0x5514('0x0'));var util=require(_0x5514('0x1'));var logger=require(_0x5514('0x2'))('api');var moment=require(_0x5514('0x3'));var BPromise=require('bluebird');var rp=require(_0x5514('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5514('0x5'));var config=require(_0x5514('0x6'));var attributes=require(_0x5514('0x7'));module[_0x5514('0x8')]=function(_0x399032,_0x205a65){return _0x399032[_0x5514('0x9')](_0x5514('0xa'),attributes,{'tableName':_0x5514('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b76=['dashboard_items','lodash','util','../../config/logger','moment','bluebird','request-promise','./dashboardItem.attributes','DashboardItem'];(function(_0x2f88e9,_0x414b34){var _0x268e4e=function(_0x379921){while(--_0x379921){_0x2f88e9['push'](_0x2f88e9['shift']());}};_0x268e4e(++_0x414b34);}(_0x4b76,0x1cc));var _0x64b7=function(_0x3ae130,_0x1822a7){_0x3ae130=_0x3ae130-0x0;var _0x3f79aa=_0x4b76[_0x3ae130];return _0x3f79aa;};'use strict';var _=require(_0x64b7('0x0'));var util=require(_0x64b7('0x1'));var logger=require(_0x64b7('0x2'))('api');var moment=require(_0x64b7('0x3'));var BPromise=require(_0x64b7('0x4'));var rp=require(_0x64b7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x64b7('0x6'));module['exports']=function(_0x2509b2,_0x338e79){return _0x2509b2['define'](_0x64b7('0x7'),attributes,{'tableName':_0x64b7('0x8'),'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 ce4a2bd..d8ecebb 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 _0x1e7e=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x47c0cd,_0xcbeafb){var _0x3c1b5e=function(_0x29458a){while(--_0x29458a){_0x47c0cd['push'](_0x47c0cd['shift']());}};_0x3c1b5e(++_0xcbeafb);}(_0x1e7e,0x122));var _0xe1e7=function(_0x5ae2c,_0x216476){_0x5ae2c=_0x5ae2c-0x0;var _0x3962fd=_0x1e7e[_0x5ae2c];return _0x3962fd;};'use strict';var _=require(_0xe1e7('0x0'));var util=require(_0xe1e7('0x1'));var moment=require(_0xe1e7('0x2'));var BPromise=require(_0xe1e7('0x3'));var rs=require(_0xe1e7('0x4'));var fs=require('fs');var Redis=require(_0xe1e7('0x5'));var db=require(_0xe1e7('0x6'))['db'];var utils=require(_0xe1e7('0x7'));var logger=require(_0xe1e7('0x8'))(_0xe1e7('0x9'));var config=require(_0xe1e7('0xa'));var jayson=require(_0xe1e7('0xb'));var client=jayson[_0xe1e7('0xc')][_0xe1e7('0xd')]({'port':0x232a});config[_0xe1e7('0xe')]=_[_0xe1e7('0xf')](config['redis'],{'host':_0xe1e7('0x10'),'port':0x18eb});var socket=require(_0xe1e7('0x11'))(new Redis(config['redis']));require(_0xe1e7('0x12'))[_0xe1e7('0x13')](socket);function respondWithRpcPromise(_0x169a7d,_0x5bf7e9,_0x369979){return new BPromise(function(_0x1c3d9c,_0x2c7bd7){return client['request'](_0x169a7d,_0x369979)['then'](function(_0x2b1477){logger[_0xe1e7('0x14')](_0xe1e7('0x15'),_0x5bf7e9,_0xe1e7('0x16'));logger['debug'](_0xe1e7('0x17'),_0x5bf7e9,_0xe1e7('0x16'),JSON[_0xe1e7('0x18')](_0x2b1477));if(_0x2b1477[_0xe1e7('0x19')]){if(_0x2b1477[_0xe1e7('0x19')][_0xe1e7('0x1a')]===0x1f4){logger[_0xe1e7('0x19')](_0xe1e7('0x15'),_0x5bf7e9,_0x2b1477[_0xe1e7('0x19')][_0xe1e7('0x1b')]);return _0x2c7bd7(_0x2b1477[_0xe1e7('0x19')][_0xe1e7('0x1b')]);}logger[_0xe1e7('0x19')](_0xe1e7('0x15'),_0x5bf7e9,_0x2b1477['error']['message']);return _0x1c3d9c(_0x2b1477[_0xe1e7('0x19')]['message']);}else{logger[_0xe1e7('0x14')](_0xe1e7('0x15'),_0x5bf7e9,_0xe1e7('0x16'));_0x1c3d9c(_0x2b1477[_0xe1e7('0x1c')][_0xe1e7('0x1b')]);}})[_0xe1e7('0x1d')](function(_0x28f71d){logger['error'](_0xe1e7('0x15'),_0x5bf7e9,_0x28f71d);_0x2c7bd7(_0x28f71d);});});} \ No newline at end of file +var _0xc83e=['localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x2786ea,_0x16c3c3){var _0x5c38e5=function(_0x5a53c5){while(--_0x5a53c5){_0x2786ea['push'](_0x2786ea['shift']());}};_0x5c38e5(++_0x16c3c3);}(_0xc83e,0x17b));var _0xec83=function(_0x39d711,_0xe11eb7){_0x39d711=_0x39d711-0x0;var _0xee1d0c=_0xc83e[_0x39d711];return _0xee1d0c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xec83('0x0'));var BPromise=require('bluebird');var rs=require(_0xec83('0x1'));var fs=require('fs');var Redis=require(_0xec83('0x2'));var db=require(_0xec83('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xec83('0x4'))(_0xec83('0x5'));var config=require(_0xec83('0x6'));var jayson=require(_0xec83('0x7'));var client=jayson['client'][_0xec83('0x8')]({'port':0x232a});config[_0xec83('0x9')]=_[_0xec83('0xa')](config[_0xec83('0x9')],{'host':_0xec83('0xb'),'port':0x18eb});var socket=require(_0xec83('0xc'))(new Redis(config['redis']));require(_0xec83('0xd'))[_0xec83('0xe')](socket);function respondWithRpcPromise(_0x47d47b,_0x2c238f,_0x4a93af){return new BPromise(function(_0xed956,_0x4fe904){return client[_0xec83('0xf')](_0x47d47b,_0x4a93af)[_0xec83('0x10')](function(_0x2e9d41){logger[_0xec83('0x11')](_0xec83('0x12'),_0x2c238f,_0xec83('0x13'));logger[_0xec83('0x14')](_0xec83('0x15'),_0x2c238f,_0xec83('0x13'),JSON[_0xec83('0x16')](_0x2e9d41));if(_0x2e9d41[_0xec83('0x17')]){if(_0x2e9d41[_0xec83('0x17')]['code']===0x1f4){logger[_0xec83('0x17')]('DashboardItem,\x20%s,\x20%s',_0x2c238f,_0x2e9d41[_0xec83('0x17')][_0xec83('0x18')]);return _0x4fe904(_0x2e9d41[_0xec83('0x17')][_0xec83('0x18')]);}logger['error'](_0xec83('0x12'),_0x2c238f,_0x2e9d41[_0xec83('0x17')][_0xec83('0x18')]);return _0xed956(_0x2e9d41[_0xec83('0x17')][_0xec83('0x18')]);}else{logger[_0xec83('0x11')](_0xec83('0x12'),_0x2c238f,_0xec83('0x13'));_0xed956(_0x2e9d41['result']['message']);}})[_0xec83('0x19')](function(_0x5be35d){logger[_0xec83('0x17')](_0xec83('0x12'),_0x2c238f,_0x5be35d);_0x4fe904(_0x5be35d);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index ae3de17..d536533 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 _0x7dba=['remove','emit','removeListener','register','length','dashboardItem:','./dashboardItem.events'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x7dba,0x1b1));var _0xa7db=function(_0x3faf41,_0x45850e){_0x3faf41=_0x3faf41-0x0;var _0x49d289=_0x7dba[_0x3faf41];return _0x49d289;};'use strict';var DashboardItemEvents=require(_0xa7db('0x0'));var events=['save',_0xa7db('0x1'),'update'];function createListener(_0x52b866,_0x41422a){return function(_0x2719ff){_0x41422a[_0xa7db('0x2')](_0x52b866,_0x2719ff);};}function removeListener(_0x18f767,_0x329676){return function(){DashboardItemEvents[_0xa7db('0x3')](_0x18f767,_0x329676);};}exports[_0xa7db('0x4')]=function(_0x9e3d9e){for(var _0x3f3028=0x0,_0x51c2e7=events[_0xa7db('0x5')];_0x3f3028<_0x51c2e7;_0x3f3028++){var _0x2a4c67=events[_0x3f3028];var _0x175466=createListener(_0xa7db('0x6')+_0x2a4c67,_0x9e3d9e);DashboardItemEvents['on'](_0x2a4c67,_0x175466);}}; \ No newline at end of file +var _0x4db6=['remove','update','emit','removeListener','register','dashboardItem:','./dashboardItem.events'];(function(_0x58d5ac,_0x11c4bc){var _0x37985c=function(_0x419671){while(--_0x419671){_0x58d5ac['push'](_0x58d5ac['shift']());}};_0x37985c(++_0x11c4bc);}(_0x4db6,0x6f));var _0x64db=function(_0x5272b2,_0x59f060){_0x5272b2=_0x5272b2-0x0;var _0x2ca6c5=_0x4db6[_0x5272b2];return _0x2ca6c5;};'use strict';var DashboardItemEvents=require(_0x64db('0x0'));var events=['save',_0x64db('0x1'),_0x64db('0x2')];function createListener(_0x2a63a1,_0x5657b3){return function(_0x268cf6){_0x5657b3[_0x64db('0x3')](_0x2a63a1,_0x268cf6);};}function removeListener(_0x512997,_0x246f0d){return function(){DashboardItemEvents[_0x64db('0x4')](_0x512997,_0x246f0d);};}exports[_0x64db('0x5')]=function(_0x4acf36){for(var _0x1075d9=0x0,_0x59ce2a=events['length'];_0x1075d9<_0x59ce2a;_0x1075d9++){var _0x4e1ef1=events[_0x1075d9];var _0x2e37f3=createListener(_0x64db('0x6')+_0x4e1ef1,_0x4acf36);DashboardItemEvents['on'](_0x4e1ef1,_0x2e37f3);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index be2aea3..333533b 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 _0x062a=['/:id','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','isAuthenticated','show','post','create'];(function(_0x29c3b2,_0x3c12ac){var _0x4b3aa7=function(_0x622a9d){while(--_0x622a9d){_0x29c3b2['push'](_0x29c3b2['shift']());}};_0x4b3aa7(++_0x3c12ac);}(_0x062a,0x73));var _0xa062=function(_0x404992,_0x58aca1){_0x404992=_0x404992-0x0;var _0x384bae=_0x062a[_0x404992];return _0x384bae;};'use strict';var multer=require(_0xa062('0x0'));var util=require(_0xa062('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa062('0x2'));var router=express[_0xa062('0x3')]();var fs_extra=require(_0xa062('0x4'));var auth=require(_0xa062('0x5'));var interaction=require(_0xa062('0x6'));var config=require(_0xa062('0x7'));var controller=require(_0xa062('0x8'));router['get']('/:id',auth[_0xa062('0x9')](),controller[_0xa062('0xa')]);router[_0xa062('0xb')]('/',auth[_0xa062('0x9')](),controller[_0xa062('0xc')]);router['put'](_0xa062('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xa062('0xe')]('/:id',auth[_0xa062('0x9')](),controller['destroy']);module[_0xa062('0xf')]=router; \ No newline at end of file +var _0xf16a=['destroy','util','path','express','Router','fs-extra','../../components/interaction/service','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete'];(function(_0x42b623,_0x3e4823){var _0x55a3dd=function(_0xf11159){while(--_0xf11159){_0x42b623['push'](_0x42b623['shift']());}};_0x55a3dd(++_0x3e4823);}(_0xf16a,0xcd));var _0xaf16=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0xf16a[_0x474bc0];return _0x4b24cf;};'use strict';var multer=require('multer');var util=require(_0xaf16('0x0'));var path=require(_0xaf16('0x1'));var timeout=require('connect-timeout');var express=require(_0xaf16('0x2'));var router=express[_0xaf16('0x3')]();var fs_extra=require(_0xaf16('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xaf16('0x5'));var config=require('../../config/environment');var controller=require(_0xaf16('0x6'));router[_0xaf16('0x7')](_0xaf16('0x8'),auth[_0xaf16('0x9')](),controller[_0xaf16('0xa')]);router[_0xaf16('0xb')]('/',auth[_0xaf16('0x9')](),controller[_0xaf16('0xc')]);router[_0xaf16('0xd')](_0xaf16('0x8'),auth[_0xaf16('0x9')](),controller[_0xaf16('0xe')]);router[_0xaf16('0xf')]('/:id',auth[_0xaf16('0x9')](),controller[_0xaf16('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 37ebbde..937c15c 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 _0xf779=['STRING','ENUM','first','second','sequelize','exports'];(function(_0x2e8328,_0x4aff6f){var _0x26bc81=function(_0x400bc6){while(--_0x400bc6){_0x2e8328['push'](_0x2e8328['shift']());}};_0x26bc81(++_0x4aff6f);}(_0xf779,0x1b4));var _0x9f77=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf779[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9f77('0x0'));module[_0x9f77('0x1')]={'name':{'type':Sequelize[_0x9f77('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x9f77('0x3')](_0x9f77('0x4'),_0x9f77('0x5'),'third'),'allowNull':![],'defaultValue':_0x9f77('0x4')},'description':{'type':Sequelize[_0x9f77('0x2')]}}; \ No newline at end of file +var _0xc71e=['STRING','ENUM','first','second','third','exports'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xc71e,0x13d));var _0xec71=function(_0x2b3179,_0x2ac04c){_0x2b3179=_0x2b3179-0x0;var _0x1e40ee=_0xc71e[_0x2b3179];return _0x1e40ee;};'use strict';var Sequelize=require('sequelize');module[_0xec71('0x0')]={'name':{'type':Sequelize[_0xec71('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xec71('0x2')](_0xec71('0x3'),_0xec71('0x4'),_0xec71('0x5')),'allowNull':![],'defaultValue':_0xec71('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 3573b6d..5b6615e 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 _0x4f96=['filter','Disposition','include','findAll','rows','show','params','includeAll','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','count','limit','set','Content-Range','json','apply','reject','save','update','then','get','Dispositions','UserProfileResource','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL'];(function(_0x3acb52,_0x94375){var _0x5cbf45=function(_0x22ad34){while(--_0x22ad34){_0x3acb52['push'](_0x3acb52['shift']());}};_0x5cbf45(++_0x94375);}(_0x4f96,0xb9));var _0x64f9=function(_0x574250,_0x3ec0d7){_0x574250=_0x574250-0x0;var _0x5e3d92=_0x4f96[_0x574250];return _0x5e3d92;};'use strict';var emlformat=require(_0x64f9('0x0'));var rimraf=require(_0x64f9('0x1'));var zipdir=require(_0x64f9('0x2'));var jsonpatch=require(_0x64f9('0x3'));var rp=require(_0x64f9('0x4'));var moment=require(_0x64f9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x64f9('0x6'));var util=require('util');var path=require('path');var sox=require(_0x64f9('0x7'));var csv=require('to-csv');var ejs=require(_0x64f9('0x8'));var fs=require('fs');var fs_extra=require(_0x64f9('0x9'));var _=require(_0x64f9('0xa'));var squel=require(_0x64f9('0xb'));var crypto=require(_0x64f9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x64f9('0xd'));var toCsv=require('to-csv');var querystring=require(_0x64f9('0xe'));var Papa=require(_0x64f9('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x64f9('0x10'));var as=require(_0x64f9('0x11'));var hardwareService=require(_0x64f9('0x12'));var logger=require(_0x64f9('0x13'))(_0x64f9('0x14'));var utils=require('../../config/utils');var config=require(_0x64f9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x64f9('0x16'))['db'];function respondWithStatusCode(_0x4491bb,_0x4b5ecd){_0x4b5ecd=_0x4b5ecd||0xcc;return function(_0x2db632){if(_0x2db632){return _0x4491bb[_0x64f9('0x17')](_0x4b5ecd);}return _0x4491bb[_0x64f9('0x18')](_0x4b5ecd)[_0x64f9('0x19')]();};}function respondWithResult(_0x33da78,_0x4b52b3){_0x4b52b3=_0x4b52b3||0xc8;return function(_0x14febc){if(_0x14febc){return _0x33da78['status'](_0x4b52b3)['json'](_0x14febc);}};}function respondWithFilteredResult(_0x3f69a5,_0x2109cb){return function(_0x5c2a12){if(_0x5c2a12){var _0xd9aa4b=typeof _0x2109cb[_0x64f9('0x1a')]==='undefined'&&typeof _0x2109cb['limit']==='undefined';var _0x534c2c=_0x5c2a12[_0x64f9('0x1b')];var _0x28553e=_0xd9aa4b?0x0:_0x2109cb[_0x64f9('0x1a')];var _0x238672=_0xd9aa4b?_0x5c2a12['count']:_0x2109cb['offset']+_0x2109cb[_0x64f9('0x1c')];var _0x482a6d;if(_0x238672>=_0x534c2c){_0x238672=_0x534c2c;_0x482a6d=0xc8;}else{_0x482a6d=0xce;}_0x3f69a5[_0x64f9('0x18')](_0x482a6d);return _0x3f69a5[_0x64f9('0x1d')](_0x64f9('0x1e'),_0x28553e+'-'+_0x238672+'/'+_0x534c2c)[_0x64f9('0x1f')](_0x5c2a12);}return null;};}function patchUpdates(_0x1bdda9){return function(_0x89eb57){try{jsonpatch[_0x64f9('0x20')](_0x89eb57,_0x1bdda9,!![]);}catch(_0x40b9b7){return BPromise[_0x64f9('0x21')](_0x40b9b7);}return _0x89eb57[_0x64f9('0x22')]();};}function saveUpdates(_0x253a94,_0x327e59){return function(_0x55ca87){if(_0x55ca87){return _0x55ca87[_0x64f9('0x23')](_0x253a94)[_0x64f9('0x24')](function(_0x714f93){return _0x714f93;});}return null;};}function removeEntity(_0x4a1796,_0x5ce72e){return function(_0x51544b){if(_0x51544b){return _0x51544b['destroy']()[_0x64f9('0x24')](function(){var _0x35169c=_0x51544b[_0x64f9('0x25')]({'plain':!![]});var _0x1f8e45=_0x64f9('0x26');return db[_0x64f9('0x27')]['destroy']({'where':{'type':_0x1f8e45,'resourceId':_0x35169c['id']}})['then'](function(){return _0x51544b;});})[_0x64f9('0x24')](function(){_0x4a1796['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x104bc8,_0x4ec97d){return function(_0x4f9c6a){if(!_0x4f9c6a){_0x104bc8[_0x64f9('0x17')](0x194);}return _0x4f9c6a;};}function handleError(_0x434c2f,_0x6c6d14){_0x6c6d14=_0x6c6d14||0x1f4;return function(_0x2d9c3e){logger[_0x64f9('0x28')](_0x2d9c3e['stack']);if(_0x2d9c3e[_0x64f9('0x29')]){delete _0x2d9c3e[_0x64f9('0x29')];}_0x434c2f[_0x64f9('0x18')](_0x6c6d14)['send'](_0x2d9c3e);};}exports[_0x64f9('0x2a')]=function(_0x3dc350,_0x276714){var _0x4f16ae={},_0x57ab35={},_0x4ffee7={'count':0x0,'rows':[]};var _0x9e0bed=_[_0x64f9('0x2b')](db['Disposition'][_0x64f9('0x2c')],function(_0x198aad){return{'name':_0x198aad[_0x64f9('0x2d')],'type':_0x198aad[_0x64f9('0x2e')][_0x64f9('0x2f')]};});_0x57ab35[_0x64f9('0x30')]=_[_0x64f9('0x2b')](_0x9e0bed,_0x64f9('0x29'));_0x57ab35[_0x64f9('0x31')]=_[_0x64f9('0x32')](_0x3dc350['query']);_0x57ab35[_0x64f9('0x33')]=_[_0x64f9('0x34')](_0x57ab35[_0x64f9('0x30')],_0x57ab35[_0x64f9('0x31')]);_0x4f16ae[_0x64f9('0x35')]=_['intersection'](_0x57ab35[_0x64f9('0x30')],qs[_0x64f9('0x36')](_0x3dc350['query'][_0x64f9('0x36')]));_0x4f16ae['attributes']=_0x4f16ae['attributes'][_0x64f9('0x37')]?_0x4f16ae[_0x64f9('0x35')]:_0x57ab35[_0x64f9('0x30')];if(!_0x3dc350[_0x64f9('0x31')][_0x64f9('0x38')](_0x64f9('0x39'))){_0x4f16ae[_0x64f9('0x1c')]=qs[_0x64f9('0x1c')](_0x3dc350['query'][_0x64f9('0x1c')]);_0x4f16ae[_0x64f9('0x1a')]=qs[_0x64f9('0x1a')](_0x3dc350[_0x64f9('0x31')][_0x64f9('0x1a')]);}_0x4f16ae[_0x64f9('0x3a')]=qs[_0x64f9('0x3b')](_0x3dc350[_0x64f9('0x31')][_0x64f9('0x3b')]);_0x4f16ae[_0x64f9('0x3c')]=qs['filters'](_[_0x64f9('0x3d')](_0x3dc350[_0x64f9('0x31')],_0x57ab35[_0x64f9('0x33')]),_0x9e0bed);if(_0x3dc350['query']['filter']){_0x4f16ae[_0x64f9('0x3c')]=_[_0x64f9('0x3e')](_0x4f16ae[_0x64f9('0x3c')],{'$or':_[_0x64f9('0x2b')](_0x9e0bed,function(_0x5b9bf0){if(_0x5b9bf0[_0x64f9('0x2e')]!==_0x64f9('0x3f')){var _0xd4beb5={};_0xd4beb5[_0x5b9bf0[_0x64f9('0x29')]]={'$like':'%'+_0x3dc350[_0x64f9('0x31')][_0x64f9('0x40')]+'%'};return _0xd4beb5;}})});}_0x4f16ae=_[_0x64f9('0x3e')]({},_0x4f16ae,_0x3dc350['options']);var _0x20de4b={'where':_0x4f16ae['where']};return db[_0x64f9('0x41')]['count'](_0x20de4b)[_0x64f9('0x24')](function(_0x3a20d8){_0x4ffee7['count']=_0x3a20d8;if(_0x3dc350[_0x64f9('0x31')]['includeAll']){_0x4f16ae[_0x64f9('0x42')]=[{'all':!![]}];}return db[_0x64f9('0x41')][_0x64f9('0x43')](_0x4f16ae);})['then'](function(_0x51838b){_0x4ffee7[_0x64f9('0x44')]=_0x51838b;return _0x4ffee7;})[_0x64f9('0x24')](respondWithFilteredResult(_0x276714,_0x4f16ae))['catch'](handleError(_0x276714,null));};exports[_0x64f9('0x45')]=function(_0x30fcd9,_0xbdcc87){var _0x1f724a={'raw':!![],'where':{'id':_0x30fcd9[_0x64f9('0x46')]['id']}},_0x8e3d17={};_0x8e3d17['model']=_['keys'](db[_0x64f9('0x41')][_0x64f9('0x2c')]);_0x8e3d17[_0x64f9('0x31')]=_[_0x64f9('0x32')](_0x30fcd9[_0x64f9('0x31')]);_0x8e3d17[_0x64f9('0x33')]=_[_0x64f9('0x34')](_0x8e3d17[_0x64f9('0x30')],_0x8e3d17['query']);_0x1f724a[_0x64f9('0x35')]=_[_0x64f9('0x34')](_0x8e3d17[_0x64f9('0x30')],qs[_0x64f9('0x36')](_0x30fcd9[_0x64f9('0x31')][_0x64f9('0x36')]));_0x1f724a[_0x64f9('0x35')]=_0x1f724a[_0x64f9('0x35')][_0x64f9('0x37')]?_0x1f724a[_0x64f9('0x35')]:_0x8e3d17[_0x64f9('0x30')];if(_0x30fcd9[_0x64f9('0x31')][_0x64f9('0x47')]){_0x1f724a[_0x64f9('0x42')]=[{'all':!![]}];}_0x1f724a=_[_0x64f9('0x3e')]({},_0x1f724a,_0x30fcd9[_0x64f9('0x48')]);return db['Disposition'][_0x64f9('0x49')](_0x1f724a)[_0x64f9('0x24')](handleEntityNotFound(_0xbdcc87,null))[_0x64f9('0x24')](respondWithResult(_0xbdcc87,null))[_0x64f9('0x4a')](handleError(_0xbdcc87,null));};exports['create']=function(_0x5d6b04,_0x3299dd){return db[_0x64f9('0x41')][_0x64f9('0x4b')](_0x5d6b04[_0x64f9('0x4c')],{})[_0x64f9('0x24')](function(_0x3ce265){var _0x3fb745=_0x5d6b04[_0x64f9('0x4d')][_0x64f9('0x25')]({'plain':!![]});if(!_0x3fb745)throw new Error(_0x64f9('0x4e'));if(_0x3fb745[_0x64f9('0x4f')]===_0x64f9('0x4d')){var _0x7bbd1d=_0x3ce265[_0x64f9('0x25')]({'plain':!![]});var _0x5adf8c=_0x64f9('0x26');return db[_0x64f9('0x50')][_0x64f9('0x49')]({'where':{'name':_0x5adf8c,'userProfileId':_0x3fb745['userProfileId']},'raw':!![]})['then'](function(_0x2e537b){if(_0x2e537b&&_0x2e537b['autoAssociation']===0x0){return db[_0x64f9('0x27')][_0x64f9('0x4b')]({'name':_0x7bbd1d[_0x64f9('0x29')],'resourceId':_0x7bbd1d['id'],'type':_0x2e537b['name'],'sectionId':_0x2e537b['id']},{})[_0x64f9('0x24')](function(){return _0x3ce265;});}else{return _0x3ce265;}})[_0x64f9('0x4a')](function(_0x3ca96d){logger[_0x64f9('0x28')](_0x64f9('0x51'),_0x3ca96d);throw _0x3ca96d;});}return _0x3ce265;})[_0x64f9('0x24')](respondWithResult(_0x3299dd,0xc9))['catch'](handleError(_0x3299dd,null));};exports[_0x64f9('0x23')]=function(_0x31656c,_0xf4b8c7){if(_0x31656c[_0x64f9('0x4c')]['id']){delete _0x31656c[_0x64f9('0x4c')]['id'];}return db[_0x64f9('0x41')]['find']({'where':{'id':_0x31656c['params']['id']}})[_0x64f9('0x24')](handleEntityNotFound(_0xf4b8c7,null))[_0x64f9('0x24')](saveUpdates(_0x31656c[_0x64f9('0x4c')],null))[_0x64f9('0x24')](respondWithResult(_0xf4b8c7,null))['catch'](handleError(_0xf4b8c7,null));};exports[_0x64f9('0x52')]=function(_0x21b869,_0x151562){return db[_0x64f9('0x41')][_0x64f9('0x49')]({'where':{'id':_0x21b869[_0x64f9('0x46')]['id']}})[_0x64f9('0x24')](handleEntityNotFound(_0x151562,null))[_0x64f9('0x24')](removeEntity(_0x151562,null))[_0x64f9('0x4a')](handleError(_0x151562,null));}; \ No newline at end of file +var _0x37a7=['model','keys','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','params','intersection','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','moment','bluebird','sox','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','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','get','Dispositions','UserProfileResource','destroy','error','stack','name','index','map','Disposition','rawAttributes','fieldName','type','key'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x37a7,0x6f));var _0x737a=function(_0x179822,_0x2f4122){_0x179822=_0x179822-0x0;var _0x319cad=_0x37a7[_0x179822];return _0x319cad;};'use strict';var emlformat=require(_0x737a('0x0'));var rimraf=require(_0x737a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x737a('0x2'));var BPromise=require(_0x737a('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x737a('0x4'));var csv=require(_0x737a('0x5'));var ejs=require(_0x737a('0x6'));var fs=require('fs');var fs_extra=require(_0x737a('0x7'));var _=require(_0x737a('0x8'));var squel=require('squel');var crypto=require(_0x737a('0x9'));var jsforce=require(_0x737a('0xa'));var deskjs=require(_0x737a('0xb'));var toCsv=require(_0x737a('0x5'));var querystring=require('querystring');var Papa=require(_0x737a('0xc'));var Redis=require(_0x737a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x737a('0xe'));var as=require(_0x737a('0xf'));var hardwareService=require(_0x737a('0x10'));var logger=require(_0x737a('0x11'))(_0x737a('0x12'));var utils=require(_0x737a('0x13'));var config=require(_0x737a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x737a('0x15'))['db'];function respondWithStatusCode(_0x22cc58,_0x2c4e57){_0x2c4e57=_0x2c4e57||0xcc;return function(_0x202575){if(_0x202575){return _0x22cc58[_0x737a('0x16')](_0x2c4e57);}return _0x22cc58[_0x737a('0x17')](_0x2c4e57)[_0x737a('0x18')]();};}function respondWithResult(_0x216a1d,_0x59b844){_0x59b844=_0x59b844||0xc8;return function(_0x449a00){if(_0x449a00){return _0x216a1d[_0x737a('0x17')](_0x59b844)['json'](_0x449a00);}};}function respondWithFilteredResult(_0x597c9d,_0xbf359e){return function(_0x37fc59){if(_0x37fc59){var _0x64901f=typeof _0xbf359e[_0x737a('0x19')]===_0x737a('0x1a')&&typeof _0xbf359e[_0x737a('0x1b')]==='undefined';var _0x369f2f=_0x37fc59['count'];var _0x30344f=_0x64901f?0x0:_0xbf359e[_0x737a('0x19')];var _0x58fb1f=_0x64901f?_0x37fc59[_0x737a('0x1c')]:_0xbf359e['offset']+_0xbf359e['limit'];var _0x3bf493;if(_0x58fb1f>=_0x369f2f){_0x58fb1f=_0x369f2f;_0x3bf493=0xc8;}else{_0x3bf493=0xce;}_0x597c9d[_0x737a('0x17')](_0x3bf493);return _0x597c9d['set'](_0x737a('0x1d'),_0x30344f+'-'+_0x58fb1f+'/'+_0x369f2f)[_0x737a('0x1e')](_0x37fc59);}return null;};}function patchUpdates(_0x8d8378){return function(_0x5d8e46){try{jsonpatch[_0x737a('0x1f')](_0x5d8e46,_0x8d8378,!![]);}catch(_0x4ac430){return BPromise[_0x737a('0x20')](_0x4ac430);}return _0x5d8e46['save']();};}function saveUpdates(_0x28a36e,_0x21d412){return function(_0x1e801d){if(_0x1e801d){return _0x1e801d[_0x737a('0x21')](_0x28a36e)[_0x737a('0x22')](function(_0xd334c0){return _0xd334c0;});}return null;};}function removeEntity(_0x1979e9,_0x379439){return function(_0x4deb7c){if(_0x4deb7c){return _0x4deb7c['destroy']()[_0x737a('0x22')](function(){var _0x54a7ec=_0x4deb7c[_0x737a('0x23')]({'plain':!![]});var _0x55c901=_0x737a('0x24');return db[_0x737a('0x25')][_0x737a('0x26')]({'where':{'type':_0x55c901,'resourceId':_0x54a7ec['id']}})[_0x737a('0x22')](function(){return _0x4deb7c;});})[_0x737a('0x22')](function(){_0x1979e9['status'](0xcc)[_0x737a('0x18')]();});}};}function handleEntityNotFound(_0xff0afc,_0x437b9a){return function(_0xb9d3fd){if(!_0xb9d3fd){_0xff0afc[_0x737a('0x16')](0x194);}return _0xb9d3fd;};}function handleError(_0x39873b,_0x32189a){_0x32189a=_0x32189a||0x1f4;return function(_0x5a3590){logger[_0x737a('0x27')](_0x5a3590[_0x737a('0x28')]);if(_0x5a3590[_0x737a('0x29')]){delete _0x5a3590[_0x737a('0x29')];}_0x39873b[_0x737a('0x17')](_0x32189a)['send'](_0x5a3590);};}exports[_0x737a('0x2a')]=function(_0x3dd65d,_0x4115c5){var _0x42df4f={},_0x50b09f={},_0x2b5d86={'count':0x0,'rows':[]};var _0x3d3157=_[_0x737a('0x2b')](db[_0x737a('0x2c')][_0x737a('0x2d')],function(_0x430776){return{'name':_0x430776[_0x737a('0x2e')],'type':_0x430776[_0x737a('0x2f')][_0x737a('0x30')]};});_0x50b09f[_0x737a('0x31')]=_['map'](_0x3d3157,'name');_0x50b09f['query']=_[_0x737a('0x32')](_0x3dd65d['query']);_0x50b09f['filters']=_['intersection'](_0x50b09f['model'],_0x50b09f['query']);_0x42df4f[_0x737a('0x33')]=_['intersection'](_0x50b09f['model'],qs[_0x737a('0x34')](_0x3dd65d[_0x737a('0x35')][_0x737a('0x34')]));_0x42df4f[_0x737a('0x33')]=_0x42df4f[_0x737a('0x33')][_0x737a('0x36')]?_0x42df4f[_0x737a('0x33')]:_0x50b09f[_0x737a('0x31')];if(!_0x3dd65d[_0x737a('0x35')][_0x737a('0x37')](_0x737a('0x38'))){_0x42df4f[_0x737a('0x1b')]=qs[_0x737a('0x1b')](_0x3dd65d[_0x737a('0x35')][_0x737a('0x1b')]);_0x42df4f[_0x737a('0x19')]=qs['offset'](_0x3dd65d[_0x737a('0x35')][_0x737a('0x19')]);}_0x42df4f[_0x737a('0x39')]=qs[_0x737a('0x3a')](_0x3dd65d[_0x737a('0x35')]['sort']);_0x42df4f[_0x737a('0x3b')]=qs[_0x737a('0x3c')](_[_0x737a('0x3d')](_0x3dd65d['query'],_0x50b09f['filters']),_0x3d3157);if(_0x3dd65d[_0x737a('0x35')][_0x737a('0x3e')]){_0x42df4f['where']=_[_0x737a('0x3f')](_0x42df4f[_0x737a('0x3b')],{'$or':_[_0x737a('0x2b')](_0x3d3157,function(_0x1439cc){if(_0x1439cc[_0x737a('0x2f')]!=='VIRTUAL'){var _0x2309fc={};_0x2309fc[_0x1439cc[_0x737a('0x29')]]={'$like':'%'+_0x3dd65d[_0x737a('0x35')][_0x737a('0x3e')]+'%'};return _0x2309fc;}})});}_0x42df4f=_['merge']({},_0x42df4f,_0x3dd65d[_0x737a('0x40')]);var _0x20cea7={'where':_0x42df4f[_0x737a('0x3b')]};return db['Disposition']['count'](_0x20cea7)[_0x737a('0x22')](function(_0x43a939){_0x2b5d86[_0x737a('0x1c')]=_0x43a939;if(_0x3dd65d[_0x737a('0x35')]['includeAll']){_0x42df4f[_0x737a('0x41')]=[{'all':!![]}];}return db[_0x737a('0x2c')][_0x737a('0x42')](_0x42df4f);})[_0x737a('0x22')](function(_0xca416f){_0x2b5d86[_0x737a('0x43')]=_0xca416f;return _0x2b5d86;})['then'](respondWithFilteredResult(_0x4115c5,_0x42df4f))[_0x737a('0x44')](handleError(_0x4115c5,null));};exports['show']=function(_0x4fcd83,_0x89535){var _0x3e4a7b={'raw':!![],'where':{'id':_0x4fcd83[_0x737a('0x45')]['id']}},_0x1c9815={};_0x1c9815['model']=_['keys'](db[_0x737a('0x2c')][_0x737a('0x2d')]);_0x1c9815[_0x737a('0x35')]=_['keys'](_0x4fcd83[_0x737a('0x35')]);_0x1c9815[_0x737a('0x3c')]=_[_0x737a('0x46')](_0x1c9815[_0x737a('0x31')],_0x1c9815[_0x737a('0x35')]);_0x3e4a7b[_0x737a('0x33')]=_[_0x737a('0x46')](_0x1c9815[_0x737a('0x31')],qs[_0x737a('0x34')](_0x4fcd83[_0x737a('0x35')][_0x737a('0x34')]));_0x3e4a7b[_0x737a('0x33')]=_0x3e4a7b[_0x737a('0x33')][_0x737a('0x36')]?_0x3e4a7b[_0x737a('0x33')]:_0x1c9815[_0x737a('0x31')];if(_0x4fcd83[_0x737a('0x35')][_0x737a('0x47')]){_0x3e4a7b['include']=[{'all':!![]}];}_0x3e4a7b=_[_0x737a('0x3f')]({},_0x3e4a7b,_0x4fcd83[_0x737a('0x40')]);return db[_0x737a('0x2c')][_0x737a('0x48')](_0x3e4a7b)['then'](handleEntityNotFound(_0x89535,null))[_0x737a('0x22')](respondWithResult(_0x89535,null))[_0x737a('0x44')](handleError(_0x89535,null));};exports[_0x737a('0x49')]=function(_0xd91856,_0x3f9b66){return db[_0x737a('0x2c')][_0x737a('0x49')](_0xd91856[_0x737a('0x4a')],{})['then'](function(_0x51229c){var _0x3be1ab=_0xd91856[_0x737a('0x4b')][_0x737a('0x23')]({'plain':!![]});if(!_0x3be1ab)throw new Error(_0x737a('0x4c'));if(_0x3be1ab['role']===_0x737a('0x4b')){var _0x13d85d=_0x51229c[_0x737a('0x23')]({'plain':!![]});var _0x4056df=_0x737a('0x24');return db[_0x737a('0x4d')]['find']({'where':{'name':_0x4056df,'userProfileId':_0x3be1ab[_0x737a('0x4e')]},'raw':!![]})['then'](function(_0x72afc6){if(_0x72afc6&&_0x72afc6[_0x737a('0x4f')]===0x0){return db[_0x737a('0x25')][_0x737a('0x49')]({'name':_0x13d85d[_0x737a('0x29')],'resourceId':_0x13d85d['id'],'type':_0x72afc6['name'],'sectionId':_0x72afc6['id']},{})[_0x737a('0x22')](function(){return _0x51229c;});}else{return _0x51229c;}})[_0x737a('0x44')](function(_0x4d53c0){logger[_0x737a('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d53c0);throw _0x4d53c0;});}return _0x51229c;})['then'](respondWithResult(_0x3f9b66,0xc9))[_0x737a('0x44')](handleError(_0x3f9b66,null));};exports[_0x737a('0x21')]=function(_0x243699,_0x228029){if(_0x243699['body']['id']){delete _0x243699[_0x737a('0x4a')]['id'];}return db['Disposition'][_0x737a('0x48')]({'where':{'id':_0x243699[_0x737a('0x45')]['id']}})[_0x737a('0x22')](handleEntityNotFound(_0x228029,null))['then'](saveUpdates(_0x243699[_0x737a('0x4a')],null))[_0x737a('0x22')](respondWithResult(_0x228029,null))[_0x737a('0x44')](handleError(_0x228029,null));};exports[_0x737a('0x26')]=function(_0x565ed6,_0x2b0e59){return db['Disposition'][_0x737a('0x48')]({'where':{'id':_0x565ed6[_0x737a('0x45')]['id']}})[_0x737a('0x22')](handleEntityNotFound(_0x2b0e59,null))['then'](removeEntity(_0x2b0e59,null))[_0x737a('0x44')](handleError(_0x2b0e59,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 6186bc4..4a4155c 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 _0x9e63=['ChatWebsiteId','MailAccountId','name_sms','SmsAccountId','name_fax','name_openchannel','WhatsappAccountId','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat'];(function(_0x33446f,_0x3f9d63){var _0x344eac=function(_0x53b1a4){while(--_0x53b1a4){_0x33446f['push'](_0x33446f['shift']());}};_0x344eac(++_0x3f9d63);}(_0x9e63,0xaf));var _0x39e6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9e63[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x39e6('0x0'));var util=require(_0x39e6('0x1'));var logger=require('../../config/logger')(_0x39e6('0x2'));var moment=require(_0x39e6('0x3'));var BPromise=require('bluebird');var rp=require(_0x39e6('0x4'));var fs=require('fs');var path=require(_0x39e6('0x5'));var rimraf=require(_0x39e6('0x6'));var config=require(_0x39e6('0x7'));var attributes=require(_0x39e6('0x8'));module[_0x39e6('0x9')]=function(_0x1ca664,_0x29b835){return _0x1ca664[_0x39e6('0xa')](_0x39e6('0xb'),attributes,{'tableName':_0x39e6('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x39e6('0xd'),'fields':[_0x39e6('0xe'),_0x39e6('0xf')]},{'unique':!![],'name':_0x39e6('0x10'),'fields':[_0x39e6('0xe'),_0x39e6('0x11')]},{'unique':!![],'name':'name_mail','fields':[_0x39e6('0xe'),_0x39e6('0x12')]},{'unique':!![],'name':_0x39e6('0x13'),'fields':[_0x39e6('0xe'),_0x39e6('0x14')]},{'unique':!![],'name':_0x39e6('0x15'),'fields':[_0x39e6('0xe'),'FaxAccountId']},{'unique':!![],'name':_0x39e6('0x16'),'fields':[_0x39e6('0xe'),'OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0x39e6('0xe'),_0x39e6('0x17')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0856=['OpenchannelAccountId','name_whatsapp','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./disposition.attributes','exports','define','tools_dispositions','name','ListId','ChatWebsiteId','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel'];(function(_0x1047c0,_0x49ba21){var _0x135d76=function(_0xc24635){while(--_0xc24635){_0x1047c0['push'](_0x1047c0['shift']());}};_0x135d76(++_0x49ba21);}(_0x0856,0x1a6));var _0x6085=function(_0x249db2,_0x29185b){_0x249db2=_0x249db2-0x0;var _0x18be94=_0x0856[_0x249db2];return _0x18be94;};'use strict';var _=require(_0x6085('0x0'));var util=require('util');var logger=require(_0x6085('0x1'))(_0x6085('0x2'));var moment=require(_0x6085('0x3'));var BPromise=require('bluebird');var rp=require(_0x6085('0x4'));var fs=require('fs');var path=require(_0x6085('0x5'));var rimraf=require('rimraf');var config=require(_0x6085('0x6'));var attributes=require(_0x6085('0x7'));module[_0x6085('0x8')]=function(_0x9a7a71,_0x5361d6){return _0x9a7a71[_0x6085('0x9')]('Disposition',attributes,{'tableName':_0x6085('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x6085('0xb'),_0x6085('0xc')]},{'unique':!![],'name':'name_chat','fields':['name',_0x6085('0xd')]},{'unique':!![],'name':'name_mail','fields':['name',_0x6085('0xe')]},{'unique':!![],'name':'name_sms','fields':['name',_0x6085('0xf')]},{'unique':!![],'name':_0x6085('0x10'),'fields':[_0x6085('0xb'),_0x6085('0x11')]},{'unique':!![],'name':_0x6085('0x12'),'fields':[_0x6085('0xb'),_0x6085('0x13')]},{'unique':!![],'name':_0x6085('0x14'),'fields':[_0x6085('0xb'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index b5c4941..318953b 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(_0xf55248,_0x40d1ab){var _0x92a83b=function(_0x518eab){while(--_0x518eab){_0xf55248['push'](_0xf55248['shift']());}};_0x92a83b(++_0x40d1ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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(_0x1c3834,_0x4eeab1){var _0x4cd7c7=function(_0x3b36fe){while(--_0x3b36fe){_0x1c3834['push'](_0x1c3834['shift']());}};_0x4cd7c7(++_0x4eeab1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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 38bfd5b..0ce0d1d 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 _0xbbc8=['get','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x553997,_0x46f7ac){var _0x425cad=function(_0x3abfe1){while(--_0x3abfe1){_0x553997['push'](_0x553997['shift']());}};_0x425cad(++_0x46f7ac);}(_0xbbc8,0x106));var _0x8bbc=function(_0x5d6d7d,_0x1f1ed8){_0x5d6d7d=_0x5d6d7d-0x0;var _0x2ad1a7=_0xbbc8[_0x5d6d7d];return _0x2ad1a7;};'use strict';var multer=require('multer');var util=require(_0x8bbc('0x0'));var path=require(_0x8bbc('0x1'));var timeout=require(_0x8bbc('0x2'));var express=require('express');var router=express[_0x8bbc('0x3')]();var fs_extra=require(_0x8bbc('0x4'));var auth=require(_0x8bbc('0x5'));var interaction=require(_0x8bbc('0x6'));var config=require(_0x8bbc('0x7'));var controller=require('./disposition.controller');router[_0x8bbc('0x8')]('/',auth[_0x8bbc('0x9')](),controller['index']);router['get'](_0x8bbc('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x8bbc('0xb')]('/',auth[_0x8bbc('0x9')](),controller[_0x8bbc('0xc')]);router[_0x8bbc('0xd')](_0x8bbc('0xa'),auth['isAuthenticated'](),controller[_0x8bbc('0xe')]);router[_0x8bbc('0xf')](_0x8bbc('0xa'),auth[_0x8bbc('0x9')](),controller[_0x8bbc('0x10')]);module[_0x8bbc('0x11')]=router; \ No newline at end of file +var _0x274b=['post','create','put','update','delete','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show'];(function(_0x449339,_0x4c6fdc){var _0x41bf1f=function(_0x100ba9){while(--_0x100ba9){_0x449339['push'](_0x449339['shift']());}};_0x41bf1f(++_0x4c6fdc);}(_0x274b,0x102));var _0xb274=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x274b[_0x550d12];return _0x12103d;};'use strict';var multer=require(_0xb274('0x0'));var util=require(_0xb274('0x1'));var path=require(_0xb274('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb274('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb274('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb274('0x5'));var controller=require(_0xb274('0x6'));router[_0xb274('0x7')]('/',auth[_0xb274('0x8')](),controller[_0xb274('0x9')]);router[_0xb274('0x7')](_0xb274('0xa'),auth[_0xb274('0x8')](),controller[_0xb274('0xb')]);router[_0xb274('0xc')]('/',auth[_0xb274('0x8')](),controller[_0xb274('0xd')]);router[_0xb274('0xe')](_0xb274('0xa'),auth[_0xb274('0x8')](),controller[_0xb274('0xf')]);router[_0xb274('0x10')](_0xb274('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xb274('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index bbfce92..c426bad 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 _0x1dcc=['SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','12000','14400','ENUM','9600','v17,v27,v29','INTEGER'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x4b3ea4,_0x1e46f2){_0x4b3ea4=_0x4b3ea4-0x0;var _0x3dae3d=_0x1dcc[_0x4b3ea4];return _0x3dae3d;};'use strict';var Sequelize=require(_0xc1dc('0x0'));module[_0xc1dc('0x1')]={'name':{'type':Sequelize[_0xc1dc('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc1dc('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0xc1dc('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xc1dc('0x2')],'defaultValue':_0xc1dc('0x4')},'localstationid':{'type':Sequelize[_0xc1dc('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM'](_0xc1dc('0x5'),_0xc1dc('0x6'),_0xc1dc('0x7'),'9600',_0xc1dc('0x8'),_0xc1dc('0x9')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xc1dc('0xa')]('2400',_0xc1dc('0x6'),'7200',_0xc1dc('0xb'),_0xc1dc('0x8'),_0xc1dc('0x9')),'defaultValue':_0xc1dc('0x9')},'modem':{'type':Sequelize[_0xc1dc('0x2')],'defaultValue':_0xc1dc('0xc')},'gateway':{'type':Sequelize[_0xc1dc('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xc1dc('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xc1dc('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0xc1dc('0xe'),_0xc1dc('0xf'),_0xc1dc('0x10'),'KHOMP'),'defaultValue':_0xc1dc('0xe')},'key':{'type':Sequelize[_0xc1dc('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xc1dc('0x11')],'defaultValue':function(){return _0xc1dc('0x12');}},'notificationSound':{'type':Sequelize[_0xc1dc('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc1dc('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc1dc('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xc1dc('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc1dc('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc1dc('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc1dc('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc1dc('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0xc1dc('0x14')},'mandatoryDisposition':{'type':Sequelize[_0xc1dc('0x13')],'defaultValue':![],'comment':_0xc1dc('0x15'),'set':function(_0x47c72e){if(!_0x47c72e)this[_0xc1dc('0x16')](_0xc1dc('0x17'),null);this['setDataValue']('mandatoryDisposition',_0x47c72e);}}}; \ No newline at end of file +var _0x11e5=['9600','12000','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','STRING','yes','2400','4800','7200','14400','ENUM'];(function(_0x2272b5,_0x362458){var _0x110156=function(_0x5c2e32){while(--_0x5c2e32){_0x2272b5['push'](_0x2272b5['shift']());}};_0x110156(++_0x362458);}(_0x11e5,0x8b));var _0x511e=function(_0x3bb5b4,_0x128455){_0x3bb5b4=_0x3bb5b4-0x0;var _0x586c60=_0x11e5[_0x3bb5b4];return _0x586c60;};'use strict';var Sequelize=require(_0x511e('0x0'));module['exports']={'name':{'type':Sequelize[_0x511e('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x511e('0x1')]},'ecm':{'type':Sequelize['ENUM'](_0x511e('0x2'),'no'),'defaultValue':_0x511e('0x2')},'headerinfo':{'type':Sequelize[_0x511e('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x511e('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM'](_0x511e('0x3'),_0x511e('0x4'),_0x511e('0x5'),'9600','12000',_0x511e('0x6')),'defaultValue':_0x511e('0x4')},'maxrate':{'type':Sequelize[_0x511e('0x7')](_0x511e('0x3'),_0x511e('0x4'),_0x511e('0x5'),_0x511e('0x8'),_0x511e('0x9'),_0x511e('0x6')),'defaultValue':_0x511e('0x6')},'modem':{'type':Sequelize[_0x511e('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x511e('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['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x511e('0x7')](_0x511e('0xa'),_0x511e('0xb'),_0x511e('0xc'),_0x511e('0xd')),'defaultValue':_0x511e('0xa')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x511e('0xe')],'defaultValue':function(){return _0x511e('0xf');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x511e('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x511e('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x511e('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x511e('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x511e('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x511e('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x511e('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x511e('0x10')],'defaultValue':![],'comment':_0x511e('0x13'),'set':function(_0x577616){if(!_0x577616)this[_0x511e('0x14')]('mandatoryDispositionPauseId',null);this[_0x511e('0x14')]('mandatoryDisposition',_0x577616);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 0b31f23..bb338cc 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 _0x93d6=['\x22%s\x22\x20<%s>','fax','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','spread','ContactId','dataValues','SendFax','path','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','zip-dir','request-promise','bluebird','mustache','util','fs-extra','lodash','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','destroy','get','FaxAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','FaxAccount','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','include','findAll','rows','mandatoryDispositionPause','length','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','FaxAccountId','getDispositions','pick','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','FaxInteraction','omit','getInteractions','Contact','User','internal','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','priority','finally','getApplications','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','minrate','modem','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','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','CmContact','Contacts','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x93d6,0x1a3));var _0x693d=function(_0x146497,_0x534896){_0x146497=_0x146497-0x0;var _0x4e6144=_0x93d6[_0x146497];return _0x4e6144;};'use strict';var emlformat=require(_0x693d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x693d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x693d('0x2'));var moment=require('moment');var BPromise=require(_0x693d('0x3'));var Mustache=require(_0x693d('0x4'));var util=require(_0x693d('0x5'));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(_0x693d('0x6'));var _=require(_0x693d('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x693d('0x8'));var toCsv=require(_0x693d('0x9'));var querystring=require('querystring');var Papa=require(_0x693d('0xa'));var Redis=require(_0x693d('0xb'));var authService=require(_0x693d('0xc'));var qs=require(_0x693d('0xd'));var as=require(_0x693d('0xe'));var hardwareService=require(_0x693d('0xf'));var logger=require('../../config/logger')(_0x693d('0x10'));var utils=require(_0x693d('0x11'));var config=require(_0x693d('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x693d('0x13'))['db'];config['redis']=_['defaults'](config[_0x693d('0x14')],{'host':_0x693d('0x15'),'port':0x18eb});var socket=require(_0x693d('0x16'))(new Redis(config['redis']));require(_0x693d('0x17'))[_0x693d('0x18')](socket);var jayson=require(_0x693d('0x19'));var client=jayson[_0x693d('0x1a')][_0x693d('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0x693d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xbf061,_0xc0d793,_0x3c7894,_0x154960){return new BPromise(function(_0x3fd012,_0x1054b9){var _0x2e4635=_0x154960||client;return _0x2e4635['request'](_0xbf061,_0x3c7894)[_0x693d('0x1c')](function(_0x5b18fe){logger[_0x693d('0x1d')]('FaxAccount,\x20%s,\x20%s',_0xc0d793,_0x693d('0x1e'));logger[_0x693d('0x1f')](_0x693d('0x20'),_0xc0d793,_0x693d('0x1e'),JSON[_0x693d('0x21')](_0x5b18fe));if(_0x5b18fe[_0x693d('0x22')]){if(_0x5b18fe[_0x693d('0x22')][_0x693d('0x23')]===0x1f4){logger['error'](_0x693d('0x24'),_0xc0d793,_0x5b18fe[_0x693d('0x22')][_0x693d('0x25')]);return _0x1054b9(_0x5b18fe[_0x693d('0x22')]['message']);}logger[_0x693d('0x22')](_0x693d('0x24'),_0xc0d793,_0x5b18fe[_0x693d('0x22')][_0x693d('0x25')]);return _0x3fd012(_0x5b18fe[_0x693d('0x22')][_0x693d('0x25')]);}else{logger[_0x693d('0x1d')](_0x693d('0x24'),_0xc0d793,_0x693d('0x1e'));_0x3fd012(_0x5b18fe[_0x693d('0x26')][_0x693d('0x25')]);}})[_0x693d('0x27')](function(_0x11d9e4){logger['error'](_0x693d('0x24'),_0xc0d793,_0x11d9e4);_0x1054b9(_0x11d9e4);});});}function respondWithStatusCode(_0x19f0c6,_0x36fdca){_0x36fdca=_0x36fdca||0xcc;return function(_0x34e924){if(_0x34e924){return _0x19f0c6['sendStatus'](_0x36fdca);}return _0x19f0c6[_0x693d('0x28')](_0x36fdca)[_0x693d('0x29')]();};}function respondWithResult(_0x1686ff,_0x54bd10){_0x54bd10=_0x54bd10||0xc8;return function(_0x55ef3c){if(_0x55ef3c){return _0x1686ff[_0x693d('0x28')](_0x54bd10)[_0x693d('0x2a')](_0x55ef3c);}};}function respondWithFilteredResult(_0x17d2cf,_0x2b63aa){return function(_0x5413d5){if(_0x5413d5){var _0x3c6834=typeof _0x2b63aa['offset']===_0x693d('0x2b')&&typeof _0x2b63aa[_0x693d('0x2c')]==='undefined';var _0x425e49=_0x5413d5[_0x693d('0x2d')];var _0x5c3819=_0x3c6834?0x0:_0x2b63aa['offset'];var _0x253f45=_0x3c6834?_0x5413d5[_0x693d('0x2d')]:_0x2b63aa[_0x693d('0x2e')]+_0x2b63aa['limit'];var _0x2d8f34;if(_0x253f45>=_0x425e49){_0x253f45=_0x425e49;_0x2d8f34=0xc8;}else{_0x2d8f34=0xce;}_0x17d2cf[_0x693d('0x28')](_0x2d8f34);return _0x17d2cf[_0x693d('0x2f')](_0x693d('0x30'),_0x5c3819+'-'+_0x253f45+'/'+_0x425e49)['json'](_0x5413d5);}return null;};}function patchUpdates(_0x413f16){return function(_0x1f6e04){try{jsonpatch['apply'](_0x1f6e04,_0x413f16,!![]);}catch(_0xdc2c5f){return BPromise['reject'](_0xdc2c5f);}return _0x1f6e04[_0x693d('0x31')]();};}function saveUpdates(_0x2f8d77,_0x497213){return function(_0x573a0b){if(_0x573a0b){return _0x573a0b[_0x693d('0x32')](_0x2f8d77)[_0x693d('0x1c')](function(_0x48d889){return _0x48d889;});}return null;};}function removeEntity(_0x4fc9b2,_0xa4cf67){return function(_0x5e24ba){if(_0x5e24ba){return _0x5e24ba[_0x693d('0x33')]()[_0x693d('0x1c')](function(){var _0xe7d2c9=_0x5e24ba[_0x693d('0x34')]({'plain':!![]});var _0x279df0=_0x693d('0x35');return db[_0x693d('0x36')][_0x693d('0x33')]({'where':{'type':_0x279df0,'resourceId':_0xe7d2c9['id']}})[_0x693d('0x1c')](function(){return _0x5e24ba;});})[_0x693d('0x1c')](function(){_0x4fc9b2[_0x693d('0x28')](0xcc)[_0x693d('0x29')]();});}};}function handleEntityNotFound(_0x498de7,_0x367a8a){return function(_0x3965ec){if(!_0x3965ec){_0x498de7[_0x693d('0x37')](0x194);}return _0x3965ec;};}function handleError(_0x3aa404,_0x8e8bd7){_0x8e8bd7=_0x8e8bd7||0x1f4;return function(_0x501dc9){logger[_0x693d('0x22')](_0x501dc9[_0x693d('0x38')]);if(_0x501dc9['name']){delete _0x501dc9[_0x693d('0x39')];}_0x3aa404[_0x693d('0x28')](_0x8e8bd7)[_0x693d('0x3a')](_0x501dc9);};}exports[_0x693d('0x3b')]=function(_0x6ecc26,_0x50422b){var _0xcab7ba={'include':[{'model':db[_0x693d('0x3c')],'as':'mandatoryDispositionPause'}]},_0x2bd240={},_0x4f1ce4={'count':0x0,'rows':[]};var _0xea7ea3=_['map'](db[_0x693d('0x3d')][_0x693d('0x3e')],function(_0x5193cd){return{'name':_0x5193cd[_0x693d('0x3f')],'type':_0x5193cd[_0x693d('0x40')][_0x693d('0x41')]};});_0x2bd240[_0x693d('0x42')]=_[_0x693d('0x43')](_0xea7ea3,_0x693d('0x39'));_0x2bd240[_0x693d('0x44')]=_[_0x693d('0x45')](_0x6ecc26[_0x693d('0x44')]);_0x2bd240['filters']=_[_0x693d('0x46')](_0x2bd240['model'],_0x2bd240[_0x693d('0x44')]);_0xcab7ba['attributes']=_[_0x693d('0x46')](_0x2bd240[_0x693d('0x42')],qs['fields'](_0x6ecc26[_0x693d('0x44')][_0x693d('0x47')]));_0xcab7ba[_0x693d('0x48')]=_0xcab7ba[_0x693d('0x48')]['length']?_0xcab7ba['attributes']:_0x2bd240[_0x693d('0x42')];if(!_0x6ecc26[_0x693d('0x44')][_0x693d('0x49')](_0x693d('0x4a'))){_0xcab7ba[_0x693d('0x2c')]=qs[_0x693d('0x2c')](_0x6ecc26[_0x693d('0x44')][_0x693d('0x2c')]);_0xcab7ba[_0x693d('0x2e')]=qs[_0x693d('0x2e')](_0x6ecc26[_0x693d('0x44')][_0x693d('0x2e')]);}_0xcab7ba[_0x693d('0x4b')]=qs['sort'](_0x6ecc26[_0x693d('0x44')][_0x693d('0x4c')]);_0xcab7ba[_0x693d('0x4d')]=qs[_0x693d('0x4e')](_['pick'](_0x6ecc26[_0x693d('0x44')],_0x2bd240[_0x693d('0x4e')]),_0xea7ea3);if(_0x6ecc26['query']['filter']){_0xcab7ba[_0x693d('0x4d')]=_[_0x693d('0x4f')](_0xcab7ba[_0x693d('0x4d')],{'$or':_[_0x693d('0x43')](_0xea7ea3,function(_0x5eac77){if(_0x5eac77[_0x693d('0x40')]!==_0x693d('0x50')){var _0x5b2578={};_0x5b2578[_0x5eac77[_0x693d('0x39')]]={'$like':'%'+_0x6ecc26[_0x693d('0x44')][_0x693d('0x51')]+'%'};return _0x5b2578;}})});}_0xcab7ba=_[_0x693d('0x4f')]({},_0xcab7ba,_0x6ecc26['options']);var _0x5a2687={'where':_0xcab7ba[_0x693d('0x4d')]};return db['FaxAccount']['count'](_0x5a2687)['then'](function(_0x4a1708){_0x4f1ce4[_0x693d('0x2d')]=_0x4a1708;if(_0x6ecc26[_0x693d('0x44')]['includeAll']){_0xcab7ba[_0x693d('0x52')]=[{'all':!![]}];}return db[_0x693d('0x3d')][_0x693d('0x53')](_0xcab7ba);})[_0x693d('0x1c')](function(_0x3214e0){_0x4f1ce4[_0x693d('0x54')]=_0x3214e0;return _0x4f1ce4;})[_0x693d('0x1c')](respondWithFilteredResult(_0x50422b,_0xcab7ba))[_0x693d('0x27')](handleError(_0x50422b,null));};exports['show']=function(_0x11fd00,_0x5f2c33){var _0x1669c9={'raw':![],'where':{'id':_0x11fd00['params']['id']},'include':[{'model':db[_0x693d('0x3c')],'as':_0x693d('0x55')}]},_0xfa2d14={};_0xfa2d14[_0x693d('0x42')]=_[_0x693d('0x45')](db[_0x693d('0x3d')][_0x693d('0x3e')]);_0xfa2d14[_0x693d('0x44')]=_['keys'](_0x11fd00[_0x693d('0x44')]);_0xfa2d14['filters']=_[_0x693d('0x46')](_0xfa2d14[_0x693d('0x42')],_0xfa2d14['query']);_0x1669c9[_0x693d('0x48')]=_[_0x693d('0x46')](_0xfa2d14[_0x693d('0x42')],qs[_0x693d('0x47')](_0x11fd00[_0x693d('0x44')][_0x693d('0x47')]));_0x1669c9['attributes']=_0x1669c9[_0x693d('0x48')][_0x693d('0x56')]?_0x1669c9[_0x693d('0x48')]:_0xfa2d14['model'];if(_0x11fd00[_0x693d('0x44')][_0x693d('0x57')]){_0x1669c9[_0x693d('0x52')]=[{'all':!![]}];}_0x1669c9=_['merge']({},_0x1669c9,_0x11fd00[_0x693d('0x58')]);return db['FaxAccount']['find'](_0x1669c9)[_0x693d('0x1c')](handleEntityNotFound(_0x5f2c33,null))['then'](respondWithResult(_0x5f2c33,null))['catch'](handleError(_0x5f2c33,null));};exports[_0x693d('0x59')]=function(_0x56eadb,_0x4d1bf8){return db[_0x693d('0x3d')][_0x693d('0x59')](_0x56eadb[_0x693d('0x5a')],{})[_0x693d('0x1c')](function(_0x28d7ee){var _0x3ff29a=_0x56eadb[_0x693d('0x5b')]['get']({'plain':!![]});if(!_0x3ff29a)throw new Error(_0x693d('0x5c'));if(_0x3ff29a[_0x693d('0x5d')]===_0x693d('0x5b')){var _0x39fe92=_0x28d7ee[_0x693d('0x34')]({'plain':!![]});var _0x12751a='FaxAccounts';return db[_0x693d('0x5e')][_0x693d('0x5f')]({'where':{'name':_0x12751a,'userProfileId':_0x3ff29a[_0x693d('0x60')]},'raw':!![]})[_0x693d('0x1c')](function(_0x1cce16){if(_0x1cce16&&_0x1cce16[_0x693d('0x61')]===0x0){return db[_0x693d('0x36')]['create']({'name':_0x39fe92[_0x693d('0x39')],'resourceId':_0x39fe92['id'],'type':_0x1cce16[_0x693d('0x39')],'sectionId':_0x1cce16['id']},{})[_0x693d('0x1c')](function(){return _0x28d7ee;});}else{return _0x28d7ee;}})[_0x693d('0x27')](function(_0x53d917){logger[_0x693d('0x22')](_0x693d('0x62'),_0x53d917);throw _0x53d917;});}return _0x28d7ee;})[_0x693d('0x1c')](respondWithResult(_0x4d1bf8,0xc9))[_0x693d('0x27')](handleError(_0x4d1bf8,null));};exports[_0x693d('0x32')]=function(_0x223132,_0x3e47a1){if(_0x223132[_0x693d('0x5a')]['id']){delete _0x223132['body']['id'];}return db['FaxAccount'][_0x693d('0x5f')]({'where':{'id':_0x223132[_0x693d('0x63')]['id']},'include':[{'model':db[_0x693d('0x3c')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x3e47a1,null))[_0x693d('0x1c')](saveUpdates(_0x223132[_0x693d('0x5a')],null))[_0x693d('0x1c')](respondWithResult(_0x3e47a1,null))['catch'](handleError(_0x3e47a1,null));};exports[_0x693d('0x33')]=function(_0x12f8e8,_0x4ecf3b){return db[_0x693d('0x3d')][_0x693d('0x5f')]({'where':{'id':_0x12f8e8['params']['id']}})[_0x693d('0x1c')](handleEntityNotFound(_0x4ecf3b,null))['then'](removeEntity(_0x4ecf3b,null))[_0x693d('0x27')](handleError(_0x4ecf3b,null));};exports[_0x693d('0x64')]=function(_0x2511d1,_0x4743b6){return db[_0x693d('0x3d')][_0x693d('0x64')]()[_0x693d('0x1c')](respondWithResult(_0x4743b6,null))['catch'](handleError(_0x4743b6,null));};exports[_0x693d('0x65')]=function(_0x2ff92b,_0x39a701,_0x4432f9){if(_0x2ff92b[_0x693d('0x5a')]['id']){delete _0x2ff92b[_0x693d('0x5a')]['id'];}return db[_0x693d('0x3d')][_0x693d('0x5f')]({'where':{'id':_0x2ff92b['params']['id']}})[_0x693d('0x1c')](handleEntityNotFound(_0x39a701,null))[_0x693d('0x1c')](function(_0x23fd1d){if(_0x23fd1d){_0x2ff92b[_0x693d('0x5a')][_0x693d('0x66')]=_0x23fd1d['id'];return db['Disposition'][_0x693d('0x59')](_0x2ff92b[_0x693d('0x5a')]);}})[_0x693d('0x1c')](respondWithResult(_0x39a701,null))[_0x693d('0x27')](handleError(_0x39a701,null));};exports[_0x693d('0x67')]=function(_0x2a4c11,_0x2153fc,_0x496f1b){var _0x5df028={'raw':![],'where':{}};var _0x16d5bc={};var _0x2e8a06={'count':0x0,'rows':[]};return db[_0x693d('0x3d')]['findOne']({'where':{'id':_0x2a4c11[_0x693d('0x63')]['id']}})[_0x693d('0x1c')](handleEntityNotFound(_0x2153fc,null))['then'](function(_0x5ace0b){if(_0x5ace0b){_0x16d5bc['model']=_[_0x693d('0x45')](db['Disposition'][_0x693d('0x3e')]);_0x16d5bc['query']=_[_0x693d('0x45')](_0x2a4c11[_0x693d('0x44')]);_0x16d5bc[_0x693d('0x4e')]=_[_0x693d('0x46')](_0x16d5bc[_0x693d('0x42')],_0x16d5bc['query']);_0x5df028[_0x693d('0x48')]=_['intersection'](_0x16d5bc[_0x693d('0x42')],qs['fields'](_0x2a4c11['query'][_0x693d('0x47')]));_0x5df028[_0x693d('0x48')]=_0x5df028[_0x693d('0x48')][_0x693d('0x56')]?_0x5df028[_0x693d('0x48')]:_0x16d5bc[_0x693d('0x42')];if(!_0x2a4c11[_0x693d('0x44')][_0x693d('0x49')](_0x693d('0x4a'))){_0x5df028[_0x693d('0x2c')]=qs['limit'](_0x2a4c11['query'][_0x693d('0x2c')]);_0x5df028[_0x693d('0x2e')]=qs[_0x693d('0x2e')](_0x2a4c11[_0x693d('0x44')]['offset']);}_0x5df028[_0x693d('0x4b')]=qs[_0x693d('0x4c')](_0x2a4c11[_0x693d('0x44')][_0x693d('0x4c')]);_0x5df028[_0x693d('0x4d')]=qs[_0x693d('0x4e')](_[_0x693d('0x68')](_0x2a4c11['query'],_0x16d5bc[_0x693d('0x4e')]));_0x5df028[_0x693d('0x4d')]['FaxAccountId']=_0x5ace0b['id'];if(_0x2a4c11[_0x693d('0x44')]['filter']){_0x5df028[_0x693d('0x4d')]=_[_0x693d('0x4f')](_0x5df028[_0x693d('0x4d')],{'$or':_[_0x693d('0x43')](_0x5df028[_0x693d('0x48')],function(_0x10f527){var _0x356d0d={};_0x356d0d[_0x10f527]={'$like':'%'+_0x2a4c11[_0x693d('0x44')][_0x693d('0x51')]+'%'};return _0x356d0d;})});}_0x5df028=_['merge']({},_0x5df028,_0x2a4c11[_0x693d('0x58')]);return db[_0x693d('0x69')][_0x693d('0x2d')]({'where':_0x5df028[_0x693d('0x4d')]})[_0x693d('0x1c')](function(_0x581959){_0x2e8a06[_0x693d('0x2d')]=_0x581959;if(_0x2a4c11[_0x693d('0x44')]['includeAll']){_0x5df028['include']=[{'all':!![]}];}return db[_0x693d('0x69')][_0x693d('0x53')](_0x5df028);})['then'](function(_0x56fb10){_0x2e8a06[_0x693d('0x54')]=_0x56fb10;return _0x2e8a06;});}})[_0x693d('0x1c')](respondWithFilteredResult(_0x2153fc,_0x5df028))[_0x693d('0x27')](handleError(_0x2153fc,null));};exports[_0x693d('0x6a')]=function(_0x3a53d0,_0x4baaf6,_0x5b3973){return db[_0x693d('0x3d')][_0x693d('0x5f')]({'where':{'id':_0x3a53d0[_0x693d('0x63')]['id']}})['then'](handleEntityNotFound(_0x4baaf6,null))[_0x693d('0x1c')](function(_0x140d1c){if(_0x140d1c){return _0x140d1c['removeDispositions'](_0x3a53d0[_0x693d('0x44')][_0x693d('0x6b')]);}})[_0x693d('0x1c')](respondWithStatusCode(_0x4baaf6,null))[_0x693d('0x27')](handleError(_0x4baaf6,null));};exports[_0x693d('0x6c')]=function(_0x49dd88,_0x20240e,_0x480997){if(_0x49dd88[_0x693d('0x5a')]['id']){delete _0x49dd88['body']['id'];}return db[_0x693d('0x3d')]['find']({'where':{'id':_0x49dd88[_0x693d('0x63')]['id']}})[_0x693d('0x1c')](handleEntityNotFound(_0x20240e,null))[_0x693d('0x1c')](function(_0xdf7a5f){if(_0xdf7a5f){_0x49dd88[_0x693d('0x5a')][_0x693d('0x66')]=_0xdf7a5f['id'];return db[_0x693d('0x6d')][_0x693d('0x59')](_0x49dd88['body']);}})['then'](respondWithResult(_0x20240e,null))[_0x693d('0x27')](handleError(_0x20240e,null));};exports[_0x693d('0x6e')]=function(_0x3f1b2f,_0x35e6b3,_0x4efe7e){var _0x155e3b={'raw':![],'where':{}};var _0x1b5fc4={};var _0x23840b={'count':0x0,'rows':[]};return db[_0x693d('0x3d')][_0x693d('0x6f')]({'where':{'id':_0x3f1b2f[_0x693d('0x63')]['id']}})[_0x693d('0x1c')](handleEntityNotFound(_0x35e6b3,null))[_0x693d('0x1c')](function(_0x4ff12d){if(_0x4ff12d){_0x1b5fc4[_0x693d('0x42')]=_[_0x693d('0x45')](db[_0x693d('0x6d')][_0x693d('0x3e')]);_0x1b5fc4[_0x693d('0x44')]=_['keys'](_0x3f1b2f['query']);_0x1b5fc4[_0x693d('0x4e')]=_['intersection'](_0x1b5fc4[_0x693d('0x42')],_0x1b5fc4['query']);_0x155e3b[_0x693d('0x48')]=_['intersection'](_0x1b5fc4['model'],qs[_0x693d('0x47')](_0x3f1b2f[_0x693d('0x44')][_0x693d('0x47')]));_0x155e3b['attributes']=_0x155e3b[_0x693d('0x48')][_0x693d('0x56')]?_0x155e3b[_0x693d('0x48')]:_0x1b5fc4[_0x693d('0x42')];if(!_0x3f1b2f[_0x693d('0x44')][_0x693d('0x49')]('nolimit')){_0x155e3b[_0x693d('0x2c')]=qs[_0x693d('0x2c')](_0x3f1b2f[_0x693d('0x44')][_0x693d('0x2c')]);_0x155e3b[_0x693d('0x2e')]=qs[_0x693d('0x2e')](_0x3f1b2f[_0x693d('0x44')][_0x693d('0x2e')]);}_0x155e3b[_0x693d('0x4b')]=qs[_0x693d('0x4c')](_0x3f1b2f[_0x693d('0x44')][_0x693d('0x4c')]);_0x155e3b['where']=qs[_0x693d('0x4e')](_[_0x693d('0x68')](_0x3f1b2f[_0x693d('0x44')],_0x1b5fc4[_0x693d('0x4e')]));_0x155e3b['where']['FaxAccountId']=_0x4ff12d['id'];if(_0x3f1b2f[_0x693d('0x44')]['filter']){_0x155e3b[_0x693d('0x4d')]=_[_0x693d('0x4f')](_0x155e3b[_0x693d('0x4d')],{'$or':_[_0x693d('0x43')](_0x155e3b[_0x693d('0x48')],function(_0x8e3ab6){var _0x3157c9={};_0x3157c9[_0x8e3ab6]={'$like':'%'+_0x3f1b2f[_0x693d('0x44')][_0x693d('0x51')]+'%'};return _0x3157c9;})});}_0x155e3b=_['merge']({},_0x155e3b,_0x3f1b2f[_0x693d('0x58')]);return db[_0x693d('0x6d')][_0x693d('0x2d')]({'where':_0x155e3b[_0x693d('0x4d')]})['then'](function(_0x7a85bd){_0x23840b[_0x693d('0x2d')]=_0x7a85bd;if(_0x3f1b2f[_0x693d('0x44')][_0x693d('0x57')]){_0x155e3b['include']=[{'all':!![]}];}return db[_0x693d('0x6d')]['findAll'](_0x155e3b);})['then'](function(_0x2b58f0){_0x23840b['rows']=_0x2b58f0;return _0x23840b;});}})[_0x693d('0x1c')](respondWithFilteredResult(_0x35e6b3,_0x155e3b))[_0x693d('0x27')](handleError(_0x35e6b3,null));};exports[_0x693d('0x70')]=function(_0x6c73df,_0x51e7a8,_0x298b91){return db[_0x693d('0x3d')][_0x693d('0x5f')]({'where':{'id':_0x6c73df[_0x693d('0x63')]['id']}})[_0x693d('0x1c')](handleEntityNotFound(_0x51e7a8,null))['then'](function(_0x593ffe){if(_0x593ffe){return _0x593ffe[_0x693d('0x70')](_0x6c73df['query']['ids']);}})['then'](respondWithStatusCode(_0x51e7a8,null))['catch'](handleError(_0x51e7a8,null));};exports['addInteraction']=function(_0x4f8c34,_0xc35274,_0x196742){return db[_0x693d('0x71')]['find']({'where':{'id':_0x4f8c34['params']['id']}})[_0x693d('0x1c')](handleEntityNotFound(_0xc35274,null))[_0x693d('0x1c')](function(_0x8a9f6c){if(_0x8a9f6c){return _0x8a9f6c['addInteraction'](_0x4f8c34[_0x693d('0x5a')][_0x693d('0x6b')],_[_0x693d('0x72')](_0x4f8c34[_0x693d('0x5a')],['ids','id'])||{});}})['then'](respondWithResult(_0xc35274,null))['catch'](handleError(_0xc35274,null));};exports[_0x693d('0x73')]=function(_0x4a9844,_0x2cf8cc,_0x376d2a){var _0x1f9dfc={'raw':![],'where':{}};var _0x586bae={};var _0x597d0b={'count':0x0,'rows':[]};return db[_0x693d('0x3d')][_0x693d('0x6f')]({'where':{'id':_0x4a9844[_0x693d('0x63')]['id']}})['then'](handleEntityNotFound(_0x2cf8cc,null))['then'](function(_0x1698c4){if(_0x1698c4){_0x586bae[_0x693d('0x42')]=_[_0x693d('0x45')](db['FaxInteraction'][_0x693d('0x3e')]);_0x586bae[_0x693d('0x44')]=_[_0x693d('0x45')](_0x4a9844[_0x693d('0x44')]);_0x586bae[_0x693d('0x4e')]=_[_0x693d('0x46')](_0x586bae[_0x693d('0x42')],_0x586bae[_0x693d('0x44')]);_0x1f9dfc[_0x693d('0x48')]=_[_0x693d('0x46')](_0x586bae[_0x693d('0x42')],qs[_0x693d('0x47')](_0x4a9844[_0x693d('0x44')][_0x693d('0x47')]));_0x1f9dfc[_0x693d('0x48')]=_0x1f9dfc[_0x693d('0x48')]['length']?_0x1f9dfc['attributes']:_0x586bae[_0x693d('0x42')];if(!_0x4a9844[_0x693d('0x44')][_0x693d('0x49')](_0x693d('0x4a'))){_0x1f9dfc['limit']=qs['limit'](_0x4a9844['query']['limit']);_0x1f9dfc[_0x693d('0x2e')]=qs[_0x693d('0x2e')](_0x4a9844[_0x693d('0x44')]['offset']);}_0x1f9dfc['order']=qs['sort'](_0x4a9844[_0x693d('0x44')][_0x693d('0x4c')]);_0x1f9dfc[_0x693d('0x4d')]=qs[_0x693d('0x4e')](_[_0x693d('0x68')](_0x4a9844[_0x693d('0x44')],_0x586bae[_0x693d('0x4e')]));_0x1f9dfc[_0x693d('0x4d')][_0x693d('0x66')]=_0x1698c4['id'];if(_0x4a9844[_0x693d('0x44')][_0x693d('0x51')]){_0x1f9dfc[_0x693d('0x4d')]=_[_0x693d('0x4f')](_0x1f9dfc[_0x693d('0x4d')],{'$or':_[_0x693d('0x43')](_0x1f9dfc[_0x693d('0x48')],function(_0x47ab5e){var _0x2cd675={};_0x2cd675[_0x47ab5e]={'$like':'%'+_0x4a9844[_0x693d('0x44')]['filter']+'%'};return _0x2cd675;})});}_0x1f9dfc=_[_0x693d('0x4f')]({},_0x1f9dfc,_0x4a9844[_0x693d('0x58')]);return db[_0x693d('0x71')]['count']({'where':_0x1f9dfc[_0x693d('0x4d')]})[_0x693d('0x1c')](function(_0x865ee7){_0x597d0b[_0x693d('0x2d')]=_0x865ee7;if(_0x4a9844[_0x693d('0x44')][_0x693d('0x57')]){_0x1f9dfc[_0x693d('0x52')]=[{'model':db['CmContact'],'as':_0x693d('0x74'),'required':![]},{'model':db[_0x693d('0x75')],'as':'Owner','attributes':[_0x693d('0x39'),'fullname',_0x693d('0x76')],'required':![]},{'model':db['Tag'],'as':_0x693d('0x77'),'attributes':['id',_0x693d('0x39'),_0x693d('0x78')],'where':_0x4a9844[_0x693d('0x44')][_0x693d('0x79')]?{'id':_0x4a9844[_0x693d('0x44')]['tag']}:undefined,'required':_0x4a9844[_0x693d('0x44')][_0x693d('0x79')]?!![]:![]}];}return db[_0x693d('0x71')][_0x693d('0x53')](_0x1f9dfc);})[_0x693d('0x1c')](function(_0x4958b1){_0x597d0b[_0x693d('0x54')]=_0x4958b1;return _0x597d0b;});}})[_0x693d('0x1c')](respondWithFilteredResult(_0x2cf8cc,_0x1f9dfc))['catch'](handleError(_0x2cf8cc,null));};exports[_0x693d('0x7a')]=function(_0x3a57c0,_0x193e56){var _0xa09520=_0x3a57c0[_0x693d('0x63')]['id'];var _0x241b4d=_0x3a57c0['body'];var _0x4e54c1=0xc8;var _0x2e89eb=null;return db[_0x693d('0x7b')][_0x693d('0x7c')]({'isolationLevel':db['sequelize'][_0x693d('0x7d')][_0x693d('0x7e')][_0x693d('0x7f')]},function(_0x13ad30){return db[_0x693d('0x3d')][_0x693d('0x6f')]({'where':{'id':_0xa09520},'transaction':_0x13ad30})[_0x693d('0x1c')](function(_0x21edf5){if(_0x21edf5){return db[_0x693d('0x80')][_0x693d('0x33')]({'where':{'FaxAccountId':_0xa09520},'transaction':_0x13ad30})[_0x693d('0x1c')](function(){var _0x248a7c=_['map'](_0x241b4d,function(_0x2d59b4){_0x2d59b4[_0x693d('0x66')]=_0xa09520;return _0x2d59b4;});return db[_0x693d('0x80')]['bulkCreate'](_0x248a7c,{'transaction':_0x13ad30});});}else{_0x4e54c1=0x194;_0x2e89eb=[];}});})[_0x693d('0x1c')](function(){if(_0x4e54c1!==0x194){return db['FaxApplication'][_0x693d('0x81')]({'where':{'FaxAccountId':_0xa09520},'order':_0x693d('0x82')})[_0x693d('0x1c')](function(_0x471f14){_0x2e89eb=_0x471f14;});}})[_0x693d('0x27')](function(_0x4416b8){_0x4e54c1=0x1f4;logger[_0x693d('0x22')](_0x4416b8[_0x693d('0x38')]);if(_0x4416b8[_0x693d('0x39')]){delete _0x4416b8[_0x693d('0x39')];}_0x2e89eb=_0x4416b8;})[_0x693d('0x83')](function(){if(_0x2e89eb===null){_0x193e56[_0x693d('0x37')](_0x4e54c1);}else{if(_0x4e54c1===0x1f4){_0x193e56['status'](_0x4e54c1)['send'](_0x2e89eb);}else{_0x193e56[_0x693d('0x28')](_0x4e54c1)[_0x693d('0x2a')](_0x2e89eb);}}});};exports[_0x693d('0x84')]=function(_0x20a4ad,_0x220775,_0x5cdba8){var _0x52f696={};var _0x5034af={};var _0x4fed3e;var _0xe0d54f;return db['FaxAccount'][_0x693d('0x6f')]({'where':{'id':_0x20a4ad[_0x693d('0x63')]['id']}})[_0x693d('0x1c')](handleEntityNotFound(_0x220775,null))[_0x693d('0x1c')](function(_0x3cad6f){if(_0x3cad6f){_0x4fed3e=_0x3cad6f;_0x5034af[_0x693d('0x42')]=_[_0x693d('0x45')](db[_0x693d('0x80')]['rawAttributes']);_0x5034af[_0x693d('0x44')]=_[_0x693d('0x45')](_0x20a4ad['query']);_0x5034af['filters']=_[_0x693d('0x46')](_0x5034af[_0x693d('0x42')],_0x5034af['query']);_0x52f696[_0x693d('0x48')]=_[_0x693d('0x46')](_0x5034af[_0x693d('0x42')],qs[_0x693d('0x47')](_0x20a4ad[_0x693d('0x44')][_0x693d('0x47')]));_0x52f696[_0x693d('0x48')]=_0x52f696['attributes']['length']?_0x52f696['attributes']:_0x5034af[_0x693d('0x42')];_0x52f696[_0x693d('0x4b')]=qs[_0x693d('0x4c')](_0x20a4ad['query'][_0x693d('0x4c')]);_0x52f696['where']=qs['filters'](_[_0x693d('0x68')](_0x20a4ad['query'],_0x5034af['filters']));if(_0x20a4ad[_0x693d('0x44')]['filter']){_0x52f696['where']=_[_0x693d('0x4f')](_0x52f696['where'],{'$or':_[_0x693d('0x43')](_0x52f696[_0x693d('0x48')],function(_0x450cde){var _0x2eb849={};_0x2eb849[_0x450cde]={'$like':'%'+_0x20a4ad[_0x693d('0x44')]['filter']+'%'};return _0x2eb849;})});}_0x52f696=_[_0x693d('0x4f')]({},_0x52f696,_0x20a4ad['options']);return _0x4fed3e['getApplications'](_0x52f696);}})[_0x693d('0x1c')](function(_0x5e8655){if(_0x5e8655){_0xe0d54f=_0x5e8655[_0x693d('0x56')];if(!_0x20a4ad[_0x693d('0x44')][_0x693d('0x49')](_0x693d('0x4a'))){_0x52f696[_0x693d('0x2c')]=qs[_0x693d('0x2c')](_0x20a4ad[_0x693d('0x44')]['limit']);_0x52f696[_0x693d('0x2e')]=qs[_0x693d('0x2e')](_0x20a4ad[_0x693d('0x44')][_0x693d('0x2e')]);}return _0x4fed3e[_0x693d('0x84')](_0x52f696);}})[_0x693d('0x1c')](function(_0x27704e){if(_0x27704e){return _0x27704e?{'count':_0xe0d54f,'rows':_0x27704e}:null;}})[_0x693d('0x1c')](respondWithResult(_0x220775,null))[_0x693d('0x27')](handleError(_0x220775,null));};function Extension(_0x6db9f2,_0x172f5f,_0x559c7b,_0x14496e){this['context']=_0x693d('0x85');this[_0x693d('0x86')]=_0x6db9f2[_0x693d('0x87')];this[_0x693d('0x88')]=_0x14496e;this['type']=_0x693d('0x89');this[_0x693d('0x8a')]=_0x693d('0x8b');this['FaxAccountId']=_0x6db9f2['id'];this['priority']=_0x172f5f;this['appdata']=_0x559c7b;}function createExtensionsReciveFax(_0x49ac00){var _0x229886=0x1;var _0x28f686=[];_0x28f686[_0x693d('0x8c')](new Extension(_0x49ac00,_0x229886,'',_0x693d('0x8d')));_0x229886+=0x1;_0x28f686[_0x693d('0x8c')](new Extension(_0x49ac00,_0x229886,_0x693d('0x8e'),_0x693d('0x8f')));_0x229886+=0x1;for(var _0x499099 in _0x49ac00){if(_0x49ac00[_0x693d('0x49')](_0x499099)&&(_0x499099===_0x693d('0x90')||_0x499099===_0x693d('0x87')||_0x499099===_0x693d('0x91')||_0x499099===_0x693d('0x92')||_0x499099===_0x693d('0x93')||_0x499099==='maxrate'||_0x499099===_0x693d('0x94')||_0x499099===_0x693d('0x95')||_0x499099==='t38timeout')){_0x28f686['push'](new Extension(_0x49ac00,_0x229886,'FAXOPT('+_0x499099+')='+_0x49ac00[_0x499099],_0x693d('0x8f')));_0x229886+=0x1;}}_0x28f686[_0x693d('0x8c')](new Extension(_0x49ac00,_0x229886,'6',_0x693d('0x96')));_0x229886+=0x1;_0x28f686[_0x693d('0x8c')](new Extension(_0x49ac00,_0x229886,_0x693d('0x97'),'ReceiveFax'));_0x229886=0x0;return _0x28f686;}exports[_0x693d('0x98')]=function(_0x37dec8,_0x3d906a,_0x41820d){var _0x550c4c;return db[_0x693d('0x7b')][_0x693d('0x7c')](function(_0x1a6bf4){return db['FaxAccount']['create'](_0x37dec8[_0x693d('0x5a')],{'transaction':_0x1a6bf4})[_0x693d('0x1c')](function(_0x351a1e){_0x550c4c=_0x351a1e[_0x693d('0x34')]({'plain':!![]});return db[_0x693d('0x99')]['bulkCreate'](createExtensionsReciveFax(_0x550c4c),{'transaction':_0x1a6bf4});});})[_0x693d('0x1c')](function(){return _0x550c4c;})[_0x693d('0x1c')](respondWithResult(_0x3d906a,null))[_0x693d('0x27')](handleError(_0x3d906a,null));};exports[_0x693d('0x9a')]=function(_0x5b6d99,_0x235205,_0x2f90eb){var _0x24a8dc;return db[_0x693d('0x7b')][_0x693d('0x7c')](function(_0x524039){return db[_0x693d('0x3d')][_0x693d('0x32')](_0x5b6d99[_0x693d('0x5a')],{'where':{'id':_0x5b6d99[_0x693d('0x5a')]['id']},'transaction':_0x524039})[_0x693d('0x1c')](function(_0x13e608){return db['VoiceExtension'][_0x693d('0x33')]({'where':{'FaxAccountId':_0x5b6d99['body']['id']},'transaction':_0x524039})[_0x693d('0x1c')](function(_0x153348){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_[_0x693d('0x72')](_0x5b6d99[_0x693d('0x5a')],[_0x693d('0x9b'),_0x693d('0x41'),_0x693d('0x9c'),_0x693d('0x9d'),_0x693d('0x9e'),_0x693d('0x9f')])),{'transaction':_0x524039});});});})[_0x693d('0x1c')](function(){return db[_0x693d('0x3d')][_0x693d('0xa0')](_0x5b6d99[_0x693d('0x5a')]['id']);})[_0x693d('0x1c')](respondWithResult(_0x235205,null))[_0x693d('0x27')](handleError(_0x235205,null));};exports[_0x693d('0xa1')]=function(_0x26614e,_0x2bd0e5,_0x2320ce){var _0x44db49={'raw':!![],'where':{}};var _0x20e1ca={};var _0x53dfda={'count':0x0,'rows':[]};return db[_0x693d('0x3d')][_0x693d('0x6f')]({'where':{'id':_0x26614e[_0x693d('0x63')]['id']}})['then'](handleEntityNotFound(_0x2bd0e5,null))['then'](function(_0x251e8f){if(_0x251e8f){_0x20e1ca[_0x693d('0x42')]=_['keys'](db[_0x693d('0xa2')][_0x693d('0x3e')]);_0x20e1ca['query']=_['keys'](_0x26614e['query']);_0x20e1ca[_0x693d('0x4e')]=_[_0x693d('0x46')](_0x20e1ca[_0x693d('0x42')],_0x20e1ca[_0x693d('0x44')]);_0x44db49[_0x693d('0x48')]=_[_0x693d('0x46')](_0x20e1ca[_0x693d('0x42')],qs[_0x693d('0x47')](_0x26614e[_0x693d('0x44')][_0x693d('0x47')]));_0x44db49[_0x693d('0x48')]=_0x44db49['attributes']['length']?_0x44db49['attributes']:_0x20e1ca['model'];if(!_0x26614e[_0x693d('0x44')]['hasOwnProperty'](_0x693d('0x4a'))){_0x44db49[_0x693d('0x2c')]=qs['limit'](_0x26614e['query'][_0x693d('0x2c')]);_0x44db49[_0x693d('0x2e')]=qs[_0x693d('0x2e')](_0x26614e[_0x693d('0x44')][_0x693d('0x2e')]);}_0x44db49['order']=qs[_0x693d('0x4c')](_0x26614e[_0x693d('0x44')]['sort']);_0x44db49[_0x693d('0x4d')]=qs[_0x693d('0x4e')](_['pick'](_0x26614e[_0x693d('0x44')],_0x20e1ca[_0x693d('0x4e')]));_0x44db49[_0x693d('0x4d')][_0x693d('0x66')]=_0x251e8f['id'];if(_0x26614e[_0x693d('0x44')]['filter']){_0x44db49['where']=_[_0x693d('0x4f')](_0x44db49[_0x693d('0x4d')],{'$or':_[_0x693d('0x43')](_0x44db49[_0x693d('0x48')],function(_0x98964f){var _0x406301={};_0x406301[_0x98964f]={'$like':'%'+_0x26614e['query']['filter']+'%'};return _0x406301;})});}if(_0x26614e['query'][_0x693d('0xa3')]){var _0x2c4c07=_0x26614e[_0x693d('0x44')][_0x693d('0xa3')][_0x693d('0xa4')](',');var _0x221ad3={};_0x221ad3[_0x2c4c07[0x0]]={'$gte':moment(_0x2c4c07[0x1])[_0x693d('0xa5')](_0x693d('0xa6'))};_0x44db49[_0x693d('0x4d')]=_[_0x693d('0x4f')](_0x44db49[_0x693d('0x4d')],_0x221ad3);}_0x44db49=_[_0x693d('0x4f')]({},_0x44db49,_0x26614e['options']);return db['FaxMessage']['count']({'where':_0x44db49[_0x693d('0x4d')]})['then'](function(_0x1eae80){_0x53dfda[_0x693d('0x2d')]=_0x1eae80;if(_0x26614e[_0x693d('0x44')][_0x693d('0x57')]){_0x44db49[_0x693d('0x52')]=[{'all':!![]}];}return db[_0x693d('0xa2')][_0x693d('0x53')](_0x44db49);})[_0x693d('0x1c')](function(_0x543e7f){_0x53dfda['rows']=_0x543e7f;return _0x53dfda;});}})[_0x693d('0x1c')](respondWithFilteredResult(_0x2bd0e5,_0x44db49))[_0x693d('0x27')](handleError(_0x2bd0e5,null));};exports[_0x693d('0x3a')]=function(_0xb23313,_0x4777b6,_0x1b2dcf){var _0x16a039,_0x1fb24b={},_0xe037c3;if(_0xb23313[_0x693d('0x5a')]['to']){_0xe037c3=_0xb23313[_0x693d('0x5a')]['to'][0x0];}return db['FaxAccount'][_0x693d('0x5f')]({'where':{'id':_0xb23313['params']['id']},'include':[{'model':db['CmList'],'as':_0x693d('0xa7'),'include':[{'model':db[_0x693d('0xa8')],'as':_0x693d('0xa9'),'where':{'fax':_0xe037c3},'limit':0x1,'order':[[_0x693d('0x9d'),_0x693d('0xaa')]]}]}]})['then'](handleEntityNotFound(_0x4777b6,null))[_0x693d('0x1c')](function(_0x3c1441){_0x16a039=_0x3c1441;if(_0xb23313[_0x693d('0x5a')][_0x693d('0xab')]&&_0xb23313[_0x693d('0x5a')][_0x693d('0xab')]['length']){for(var _0x4938ef=0x0;_0x4938ef<_0xb23313[_0x693d('0x5a')][_0x693d('0xab')][_0x693d('0x56')];_0x4938ef+=0x1){_0xb23313[_0x693d('0x5a')]['attachments'][_0x4938ef]={'filename':_0xb23313[_0x693d('0x5a')]['attachments'][_0x4938ef][_0x693d('0x39')],'id':_0xb23313[_0x693d('0x5a')][_0x693d('0xab')][_0x4938ef]['id'],'path':path['join'](config[_0x693d('0xac')],_0x693d('0xad'),_0xb23313['body'][_0x693d('0xab')][_0x4938ef][_0x693d('0xae')])};}}return respondWithRpcPromise('CheckAfterSend',_0x693d('0xaf'),{'FaxAccountId':_[_0x693d('0xb0')](_0xb23313[_0x693d('0x63')]['id'])?undefined:_0xb23313[_0x693d('0x63')]['id'],'path':_['isNil'](_0xb23313[_0x693d('0x5a')][_0x693d('0xab')][0x0]['path'])?undefined:_0xb23313[_0x693d('0x5a')]['attachments'][0x0]['path'],'fax':_[_0x693d('0xb0')](_0xb23313[_0x693d('0x5a')]['to'][0x0])?undefined:_0xb23313[_0x693d('0x5a')]['to'][0x0]},client9002);})['then'](function(){if(_0x16a039){if(_[_0x693d('0xb0')](_0xb23313[_0x693d('0x5a')][_0x693d('0xb1')])){_0xb23313[_0x693d('0x5a')]['from']=util[_0x693d('0xa5')](_0x693d('0xb2'),_0x16a039[_0x693d('0x39')],_0x16a039[_0x693d('0xb3')]);}if(_0x16a039[_0x693d('0xa7')]){if(_0x16a039[_0x693d('0xa7')][_0x693d('0xa9')]['length']){return _0x16a039['List'][_0x693d('0xa9')][0x0];}else{return db[_0x693d('0xa8')]['create'](_[_0x693d('0xb4')](_0xb23313[_0x693d('0x5a')],{'firstName':_0xb23313['body']['to'][0x0],'phone':_0xb23313[_0x693d('0x5a')]['to'][0x0],'fax':_0xb23313[_0x693d('0x5a')]['to'][0x0],'ListId':_0x16a039['ListId']}));}}else{throw new Error(_0x693d('0xb5'));}}else{throw new Error(_0x693d('0xb6'));}})[_0x693d('0x1c')](function(_0x58cf44){if(_0x58cf44){return db['FaxInteraction'][_0x693d('0x5f')]({'where':{'ContactId':_0x58cf44['id'],'closed':![],'FaxAccountId':_0x16a039['id']}})[_0x693d('0x1c')](function(_0x2560ea){if(_0x2560ea){return[_0x2560ea,![]];}return db[_0x693d('0x71')][_0x693d('0x59')]({'UserId':_0xb23313[_0x693d('0x5b')]['id'],'ContactId':_0x58cf44['id'],'FaxAccountId':_0x16a039['id'],'fax':_0xb23313[_0x693d('0x5a')]['to'][0x0],'firstMsgDirection':_0x693d('0xb7'),'Messages':[_[_0x693d('0x4f')](_0xb23313[_0x693d('0x5a')],{'read':![],'body':_0xb23313[_0x693d('0x5a')][_0x693d('0xab')][0x0][_0x693d('0xb8')],'FaxAccountId':_0x16a039['id'],'UserId':_0xb23313[_0x693d('0x5b')]['id'],'ContactId':_0x58cf44['id'],'AttachmentId':_0xb23313['body']['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x693d('0xb9')}]})['then'](function(_0x2a0350){return[_0x2a0350,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x693d('0xba')](function(_0x56f53f,_0x9a377b){if(_0x9a377b){return _0x56f53f;}return db[_0x693d('0xa2')]['create']({'direction':_0x693d('0xb7'),'read':![],'body':_0xb23313['body']['attachments'][0x0]['filename'],'FaxAccountId':_0x16a039['id'],'FaxInteractionId':_0x56f53f['id'],'UserId':_0xb23313['user']['id'],'ContactId':_0x56f53f[_0x693d('0xbb')],'AttachmentId':_0xb23313[_0x693d('0x5a')]['attachments'][0x0]['id']})['then'](function(_0x38b594){_0x56f53f[_0x693d('0xbc')][_0x693d('0xb9')]=[];_0x56f53f[_0x693d('0xbc')][_0x693d('0xb9')][_0x693d('0x8c')](_0x38b594[_0x693d('0xbc')]);return _0x56f53f;});})[_0x693d('0x1c')](function(_0x569b9c){respondWithRpcPromise(_0x693d('0xbd'),'SendFax',{'FaxAccountId':_[_0x693d('0xb0')](_0xb23313[_0x693d('0x63')]['id'])?undefined:_0xb23313['params']['id'],'path':_[_0x693d('0xb0')](_0xb23313['body']['attachments'][0x0][_0x693d('0xbe')])?undefined:_0xb23313[_0x693d('0x5a')][_0x693d('0xab')][0x0][_0x693d('0xbe')],'fax':_[_0x693d('0xb0')](_0xb23313[_0x693d('0x5a')]['to'][0x0])?undefined:_0xb23313[_0x693d('0x5a')]['to'][0x0],'AttachmentId':_0xb23313[_0x693d('0x5a')][_0x693d('0xab')][0x0]['id']},client9002)[_0x693d('0x1c')](function(_0x41eda5){logger[_0x693d('0x1d')]('SendFaxRpc,\x20%s',_0x41eda5);})[_0x693d('0x27')](function(_0x136d73){logger['info'](_0x693d('0xbf'),_0x136d73);});return _0x569b9c;})[_0x693d('0x1c')](respondWithResult(_0x4777b6,null))[_0x693d('0x27')](handleError(_0x4777b6,null));};exports[_0x693d('0xc0')]=function(_0x3b164d,_0x383948,_0x46ff03){return db[_0x693d('0x3d')]['find']({'where':{'id':_0x3b164d[_0x693d('0x63')]['id']}})[_0x693d('0x1c')](handleEntityNotFound(_0x383948,null))[_0x693d('0x1c')](function(_0x4fdc73){if(_0x4fdc73){return _0x4fdc73[_0x693d('0xc0')](_0x3b164d['body'][_0x693d('0x6b')],_[_0x693d('0x72')](_0x3b164d[_0x693d('0x5a')],[_0x693d('0x6b'),'id'])||{})['spread'](function(_0x47bfcf){for(var _0x4b12a2=0x0;_0x4b12a2<_0x3b164d['body'][_0x693d('0x6b')][_0x693d('0x56')];_0x4b12a2+=0x1){socket[_0x693d('0xc1')](_0x693d('0xc2'),{'UserId':Number(_0x3b164d['body']['ids'][_0x4b12a2]),'FaxAccountId':Number(_0x3b164d[_0x693d('0x63')]['id'])});}return _0x47bfcf;});}})['then'](respondWithResult(_0x383948,null))['catch'](handleError(_0x383948,null));};exports['removeAgents']=function(_0x374c4f,_0x3b26cb,_0x507042){return db[_0x693d('0x3d')][_0x693d('0x5f')]({'where':{'id':_0x374c4f['params']['id']}})['then'](handleEntityNotFound(_0x3b26cb,null))[_0x693d('0x1c')](function(_0x5df136){if(_0x5df136){return _0x5df136[_0x693d('0xc3')](_0x374c4f[_0x693d('0x44')][_0x693d('0x6b')])[_0x693d('0x1c')](function(){if(_[_0x693d('0xc4')](_0x374c4f[_0x693d('0x44')]['ids'])){for(var _0x13fee2=0x0;_0x13fee2<_0x374c4f[_0x693d('0x44')]['ids'][_0x693d('0x56')];_0x13fee2+=0x1){socket[_0x693d('0xc1')](_0x693d('0xc5'),{'UserId':Number(_0x374c4f[_0x693d('0x44')][_0x693d('0x6b')][_0x13fee2]),'FaxAccountId':Number(_0x374c4f[_0x693d('0x63')]['id'])});}}else{socket[_0x693d('0xc1')](_0x693d('0xc5'),{'UserId':Number(_0x374c4f['query'][_0x693d('0x6b')]),'FaxAccountId':Number(_0x374c4f[_0x693d('0x63')]['id'])});}});}})['then'](respondWithStatusCode(_0x3b26cb,null))[_0x693d('0x27')](handleError(_0x3b26cb,null));};exports[_0x693d('0xc6')]=function(_0x5ae70b,_0x96fded,_0x49a573){var _0x270cb3={};var _0x3374f3={};var _0x5ea3dd;var _0x48822e;return db[_0x693d('0x3d')]['findOne']({'where':{'id':_0x5ae70b[_0x693d('0x63')]['id']}})['then'](handleEntityNotFound(_0x96fded,null))[_0x693d('0x1c')](function(_0x2bab92){if(_0x2bab92){_0x5ea3dd=_0x2bab92;_0x3374f3['model']=_['keys'](db[_0x693d('0x75')][_0x693d('0x3e')]);_0x3374f3[_0x693d('0x44')]=_[_0x693d('0x45')](_0x5ae70b['query']);_0x3374f3[_0x693d('0x4e')]=_[_0x693d('0x46')](_0x3374f3[_0x693d('0x42')],_0x3374f3['query']);_0x270cb3[_0x693d('0x48')]=_['intersection'](_0x3374f3[_0x693d('0x42')],qs[_0x693d('0x47')](_0x5ae70b[_0x693d('0x44')][_0x693d('0x47')]));_0x270cb3['attributes']=_0x270cb3[_0x693d('0x48')][_0x693d('0x56')]?_0x270cb3[_0x693d('0x48')]:_0x3374f3['model'];_0x270cb3['order']=qs[_0x693d('0x4c')](_0x5ae70b[_0x693d('0x44')]['sort']);_0x270cb3[_0x693d('0x4d')]=qs[_0x693d('0x4e')](_['pick'](_0x5ae70b[_0x693d('0x44')],_0x3374f3['filters']));if(_0x5ae70b['query']['filter']){_0x270cb3[_0x693d('0x4d')]=_['merge'](_0x270cb3['where'],{'$or':_['map'](_0x270cb3[_0x693d('0x48')],function(_0x27fc3a){var _0x1137b3={};_0x1137b3[_0x27fc3a]={'$like':'%'+_0x5ae70b[_0x693d('0x44')][_0x693d('0x51')]+'%'};return _0x1137b3;})});}_0x270cb3=_[_0x693d('0x4f')]({},_0x270cb3,_0x5ae70b[_0x693d('0x58')]);return _0x5ea3dd['getAgents'](_0x270cb3);}})[_0x693d('0x1c')](function(_0x105a8a){if(_0x105a8a){_0x48822e=_0x105a8a[_0x693d('0x56')];if(!_0x5ae70b[_0x693d('0x44')][_0x693d('0x49')](_0x693d('0x4a'))){_0x270cb3['limit']=qs[_0x693d('0x2c')](_0x5ae70b[_0x693d('0x44')]['limit']);_0x270cb3[_0x693d('0x2e')]=qs[_0x693d('0x2e')](_0x5ae70b[_0x693d('0x44')][_0x693d('0x2e')]);}return _0x5ea3dd[_0x693d('0xc6')](_0x270cb3);}})[_0x693d('0x1c')](function(_0x5c33d3){if(_0x5c33d3){return _0x5c33d3?{'count':_0x48822e,'rows':_0x5c33d3}:null;}})[_0x693d('0x1c')](respondWithResult(_0x96fded,null))[_0x693d('0x27')](handleError(_0x96fded,null));}; \ No newline at end of file +var _0xc6df=['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','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','reject','save','update','destroy','get','FaxAccounts','stack','name','send','index','mandatoryDispositionPause','map','FaxAccount','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','Pause','keys','rawAttributes','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','params','describe','addDisposition','FaxAccountId','Disposition','findOne','nolimit','findAll','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','transaction','sequelize','Transaction','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','appdata','push','Answer','CDR(type)=inbound-fax','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','updatedAt','ListId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','filename','spread','out','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','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','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','jayson/promise'];(function(_0x3d891a,_0x14aa28){var _0x2bcf32=function(_0x51e25d){while(--_0x51e25d){_0x3d891a['push'](_0x3d891a['shift']());}};_0x2bcf32(++_0x14aa28);}(_0xc6df,0xac));var _0xfc6d=function(_0x4ffe7d,_0x386818){_0x4ffe7d=_0x4ffe7d-0x0;var _0x365ef9=_0xc6df[_0x4ffe7d];return _0x365ef9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfc6d('0x0'));var zipdir=require(_0xfc6d('0x1'));var jsonpatch=require(_0xfc6d('0x2'));var rp=require(_0xfc6d('0x3'));var moment=require(_0xfc6d('0x4'));var BPromise=require(_0xfc6d('0x5'));var Mustache=require(_0xfc6d('0x6'));var util=require(_0xfc6d('0x7'));var path=require(_0xfc6d('0x8'));var sox=require(_0xfc6d('0x9'));var csv=require(_0xfc6d('0xa'));var ejs=require(_0xfc6d('0xb'));var fs=require('fs');var fs_extra=require(_0xfc6d('0xc'));var _=require(_0xfc6d('0xd'));var squel=require(_0xfc6d('0xe'));var crypto=require(_0xfc6d('0xf'));var jsforce=require(_0xfc6d('0x10'));var deskjs=require(_0xfc6d('0x11'));var toCsv=require('to-csv');var querystring=require(_0xfc6d('0x12'));var Papa=require('papaparse');var Redis=require(_0xfc6d('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xfc6d('0x14'));var as=require(_0xfc6d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xfc6d('0x16'));var licenseUtil=require(_0xfc6d('0x17'));var db=require('../../mysqldb')['db'];config[_0xfc6d('0x18')]=_[_0xfc6d('0x19')](config[_0xfc6d('0x18')],{'host':_0xfc6d('0x1a'),'port':0x18eb});var socket=require(_0xfc6d('0x1b'))(new Redis(config[_0xfc6d('0x18')]));require('./faxAccount.socket')[_0xfc6d('0x1c')](socket);var jayson=require(_0xfc6d('0x1d'));var client=jayson[_0xfc6d('0x1e')][_0xfc6d('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0xfc6d('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3628b1,_0x46c14b,_0x212f6e,_0x1c5828){return new BPromise(function(_0x3a7e49,_0x4508c5){var _0x38f71f=_0x1c5828||client;return _0x38f71f[_0xfc6d('0x20')](_0x3628b1,_0x212f6e)[_0xfc6d('0x21')](function(_0x2144e7){logger['info'](_0xfc6d('0x22'),_0x46c14b,_0xfc6d('0x23'));logger[_0xfc6d('0x24')](_0xfc6d('0x25'),_0x46c14b,'request\x20sent',JSON[_0xfc6d('0x26')](_0x2144e7));if(_0x2144e7[_0xfc6d('0x27')]){if(_0x2144e7[_0xfc6d('0x27')][_0xfc6d('0x28')]===0x1f4){logger[_0xfc6d('0x27')](_0xfc6d('0x22'),_0x46c14b,_0x2144e7[_0xfc6d('0x27')][_0xfc6d('0x29')]);return _0x4508c5(_0x2144e7[_0xfc6d('0x27')][_0xfc6d('0x29')]);}logger[_0xfc6d('0x27')](_0xfc6d('0x22'),_0x46c14b,_0x2144e7[_0xfc6d('0x27')][_0xfc6d('0x29')]);return _0x3a7e49(_0x2144e7[_0xfc6d('0x27')][_0xfc6d('0x29')]);}else{logger[_0xfc6d('0x2a')]('FaxAccount,\x20%s,\x20%s',_0x46c14b,_0xfc6d('0x23'));_0x3a7e49(_0x2144e7[_0xfc6d('0x2b')][_0xfc6d('0x29')]);}})['catch'](function(_0x3d7feb){logger[_0xfc6d('0x27')](_0xfc6d('0x22'),_0x46c14b,_0x3d7feb);_0x4508c5(_0x3d7feb);});});}function respondWithStatusCode(_0x27c10e,_0x126d93){_0x126d93=_0x126d93||0xcc;return function(_0x237050){if(_0x237050){return _0x27c10e[_0xfc6d('0x2c')](_0x126d93);}return _0x27c10e[_0xfc6d('0x2d')](_0x126d93)[_0xfc6d('0x2e')]();};}function respondWithResult(_0x2caf1d,_0x599ef8){_0x599ef8=_0x599ef8||0xc8;return function(_0x2f0240){if(_0x2f0240){return _0x2caf1d['status'](_0x599ef8)[_0xfc6d('0x2f')](_0x2f0240);}};}function respondWithFilteredResult(_0x1b4c37,_0x28d0e6){return function(_0x2b47f3){if(_0x2b47f3){var _0x5ee70a=typeof _0x28d0e6['offset']===_0xfc6d('0x30')&&typeof _0x28d0e6[_0xfc6d('0x31')]===_0xfc6d('0x30');var _0x4c1ca5=_0x2b47f3['count'];var _0x40efa4=_0x5ee70a?0x0:_0x28d0e6[_0xfc6d('0x32')];var _0x134bee=_0x5ee70a?_0x2b47f3[_0xfc6d('0x33')]:_0x28d0e6[_0xfc6d('0x32')]+_0x28d0e6[_0xfc6d('0x31')];var _0x541e55;if(_0x134bee>=_0x4c1ca5){_0x134bee=_0x4c1ca5;_0x541e55=0xc8;}else{_0x541e55=0xce;}_0x1b4c37[_0xfc6d('0x2d')](_0x541e55);return _0x1b4c37[_0xfc6d('0x34')]('Content-Range',_0x40efa4+'-'+_0x134bee+'/'+_0x4c1ca5)[_0xfc6d('0x2f')](_0x2b47f3);}return null;};}function patchUpdates(_0xfcc062){return function(_0x4ed3ec){try{jsonpatch[_0xfc6d('0x35')](_0x4ed3ec,_0xfcc062,!![]);}catch(_0x391d07){return BPromise[_0xfc6d('0x36')](_0x391d07);}return _0x4ed3ec[_0xfc6d('0x37')]();};}function saveUpdates(_0x1a975c,_0x4e4d0f){return function(_0x2ffec5){if(_0x2ffec5){return _0x2ffec5[_0xfc6d('0x38')](_0x1a975c)[_0xfc6d('0x21')](function(_0x19c9fa){return _0x19c9fa;});}return null;};}function removeEntity(_0x1e7227,_0x44a46a){return function(_0x27fa6f){if(_0x27fa6f){return _0x27fa6f[_0xfc6d('0x39')]()[_0xfc6d('0x21')](function(){var _0x5094c8=_0x27fa6f[_0xfc6d('0x3a')]({'plain':!![]});var _0x337510=_0xfc6d('0x3b');return db['UserProfileResource'][_0xfc6d('0x39')]({'where':{'type':_0x337510,'resourceId':_0x5094c8['id']}})[_0xfc6d('0x21')](function(){return _0x27fa6f;});})[_0xfc6d('0x21')](function(){_0x1e7227['status'](0xcc)[_0xfc6d('0x2e')]();});}};}function handleEntityNotFound(_0x7a19a1,_0x492f80){return function(_0x5dc5cb){if(!_0x5dc5cb){_0x7a19a1[_0xfc6d('0x2c')](0x194);}return _0x5dc5cb;};}function handleError(_0x2342f2,_0x21171a){_0x21171a=_0x21171a||0x1f4;return function(_0x8e119c){logger[_0xfc6d('0x27')](_0x8e119c[_0xfc6d('0x3c')]);if(_0x8e119c[_0xfc6d('0x3d')]){delete _0x8e119c['name'];}_0x2342f2[_0xfc6d('0x2d')](_0x21171a)[_0xfc6d('0x3e')](_0x8e119c);};}exports[_0xfc6d('0x3f')]=function(_0x50cf6b,_0x1f8186){var _0x58ecc2={'include':[{'model':db['Pause'],'as':_0xfc6d('0x40')}]},_0x160e1a={},_0x2f38a6={'count':0x0,'rows':[]};var _0x1b7292=_[_0xfc6d('0x41')](db[_0xfc6d('0x42')]['rawAttributes'],function(_0x409ea2){return{'name':_0x409ea2['fieldName'],'type':_0x409ea2[_0xfc6d('0x43')][_0xfc6d('0x44')]};});_0x160e1a['model']=_[_0xfc6d('0x41')](_0x1b7292,'name');_0x160e1a[_0xfc6d('0x45')]=_['keys'](_0x50cf6b[_0xfc6d('0x45')]);_0x160e1a[_0xfc6d('0x46')]=_[_0xfc6d('0x47')](_0x160e1a[_0xfc6d('0x48')],_0x160e1a[_0xfc6d('0x45')]);_0x58ecc2[_0xfc6d('0x49')]=_[_0xfc6d('0x47')](_0x160e1a[_0xfc6d('0x48')],qs[_0xfc6d('0x4a')](_0x50cf6b[_0xfc6d('0x45')][_0xfc6d('0x4a')]));_0x58ecc2[_0xfc6d('0x49')]=_0x58ecc2[_0xfc6d('0x49')]['length']?_0x58ecc2[_0xfc6d('0x49')]:_0x160e1a[_0xfc6d('0x48')];if(!_0x50cf6b[_0xfc6d('0x45')][_0xfc6d('0x4b')]('nolimit')){_0x58ecc2['limit']=qs[_0xfc6d('0x31')](_0x50cf6b[_0xfc6d('0x45')][_0xfc6d('0x31')]);_0x58ecc2[_0xfc6d('0x32')]=qs[_0xfc6d('0x32')](_0x50cf6b[_0xfc6d('0x45')]['offset']);}_0x58ecc2[_0xfc6d('0x4c')]=qs[_0xfc6d('0x4d')](_0x50cf6b['query']['sort']);_0x58ecc2[_0xfc6d('0x4e')]=qs['filters'](_[_0xfc6d('0x4f')](_0x50cf6b['query'],_0x160e1a[_0xfc6d('0x46')]),_0x1b7292);if(_0x50cf6b[_0xfc6d('0x45')][_0xfc6d('0x50')]){_0x58ecc2[_0xfc6d('0x4e')]=_[_0xfc6d('0x51')](_0x58ecc2[_0xfc6d('0x4e')],{'$or':_[_0xfc6d('0x41')](_0x1b7292,function(_0x2ef746){if(_0x2ef746[_0xfc6d('0x43')]!=='VIRTUAL'){var _0x52ed70={};_0x52ed70[_0x2ef746['name']]={'$like':'%'+_0x50cf6b[_0xfc6d('0x45')][_0xfc6d('0x50')]+'%'};return _0x52ed70;}})});}_0x58ecc2=_['merge']({},_0x58ecc2,_0x50cf6b[_0xfc6d('0x52')]);var _0x444493={'where':_0x58ecc2[_0xfc6d('0x4e')]};return db['FaxAccount']['count'](_0x444493)[_0xfc6d('0x21')](function(_0x2e6eb3){_0x2f38a6[_0xfc6d('0x33')]=_0x2e6eb3;if(_0x50cf6b[_0xfc6d('0x45')][_0xfc6d('0x53')]){_0x58ecc2[_0xfc6d('0x54')]=[{'all':!![]}];}return db[_0xfc6d('0x42')]['findAll'](_0x58ecc2);})[_0xfc6d('0x21')](function(_0x12bd6c){_0x2f38a6[_0xfc6d('0x55')]=_0x12bd6c;return _0x2f38a6;})[_0xfc6d('0x21')](respondWithFilteredResult(_0x1f8186,_0x58ecc2))[_0xfc6d('0x56')](handleError(_0x1f8186,null));};exports[_0xfc6d('0x57')]=function(_0x484e2c,_0x502f9b){var _0x2ca6cd={'raw':![],'where':{'id':_0x484e2c['params']['id']},'include':[{'model':db[_0xfc6d('0x58')],'as':_0xfc6d('0x40')}]},_0x171c1c={};_0x171c1c[_0xfc6d('0x48')]=_[_0xfc6d('0x59')](db[_0xfc6d('0x42')][_0xfc6d('0x5a')]);_0x171c1c[_0xfc6d('0x45')]=_['keys'](_0x484e2c[_0xfc6d('0x45')]);_0x171c1c[_0xfc6d('0x46')]=_[_0xfc6d('0x47')](_0x171c1c['model'],_0x171c1c[_0xfc6d('0x45')]);_0x2ca6cd['attributes']=_[_0xfc6d('0x47')](_0x171c1c[_0xfc6d('0x48')],qs['fields'](_0x484e2c[_0xfc6d('0x45')][_0xfc6d('0x4a')]));_0x2ca6cd['attributes']=_0x2ca6cd['attributes'][_0xfc6d('0x5b')]?_0x2ca6cd[_0xfc6d('0x49')]:_0x171c1c[_0xfc6d('0x48')];if(_0x484e2c[_0xfc6d('0x45')][_0xfc6d('0x53')]){_0x2ca6cd['include']=[{'all':!![]}];}_0x2ca6cd=_[_0xfc6d('0x51')]({},_0x2ca6cd,_0x484e2c[_0xfc6d('0x52')]);return db[_0xfc6d('0x42')][_0xfc6d('0x5c')](_0x2ca6cd)[_0xfc6d('0x21')](handleEntityNotFound(_0x502f9b,null))[_0xfc6d('0x21')](respondWithResult(_0x502f9b,null))['catch'](handleError(_0x502f9b,null));};exports['create']=function(_0x1361c9,_0x3583af){return db[_0xfc6d('0x42')][_0xfc6d('0x5d')](_0x1361c9[_0xfc6d('0x5e')],{})[_0xfc6d('0x21')](function(_0x5df870){var _0x5aa159=_0x1361c9[_0xfc6d('0x5f')][_0xfc6d('0x3a')]({'plain':!![]});if(!_0x5aa159)throw new Error(_0xfc6d('0x60'));if(_0x5aa159[_0xfc6d('0x61')]===_0xfc6d('0x5f')){var _0xbb4264=_0x5df870[_0xfc6d('0x3a')]({'plain':!![]});var _0x1d4ff9='FaxAccounts';return db[_0xfc6d('0x62')][_0xfc6d('0x5c')]({'where':{'name':_0x1d4ff9,'userProfileId':_0x5aa159[_0xfc6d('0x63')]},'raw':!![]})['then'](function(_0x3642e8){if(_0x3642e8&&_0x3642e8[_0xfc6d('0x64')]===0x0){return db['UserProfileResource'][_0xfc6d('0x5d')]({'name':_0xbb4264[_0xfc6d('0x3d')],'resourceId':_0xbb4264['id'],'type':_0x3642e8[_0xfc6d('0x3d')],'sectionId':_0x3642e8['id']},{})[_0xfc6d('0x21')](function(){return _0x5df870;});}else{return _0x5df870;}})[_0xfc6d('0x56')](function(_0x25431b){logger['error'](_0xfc6d('0x65'),_0x25431b);throw _0x25431b;});}return _0x5df870;})['then'](respondWithResult(_0x3583af,0xc9))[_0xfc6d('0x56')](handleError(_0x3583af,null));};exports[_0xfc6d('0x38')]=function(_0x1a0534,_0x381a1){if(_0x1a0534[_0xfc6d('0x5e')]['id']){delete _0x1a0534[_0xfc6d('0x5e')]['id'];}return db[_0xfc6d('0x42')][_0xfc6d('0x5c')]({'where':{'id':_0x1a0534['params']['id']},'include':[{'model':db[_0xfc6d('0x58')],'as':_0xfc6d('0x40')}]})[_0xfc6d('0x21')](handleEntityNotFound(_0x381a1,null))[_0xfc6d('0x21')](saveUpdates(_0x1a0534[_0xfc6d('0x5e')],null))[_0xfc6d('0x21')](respondWithResult(_0x381a1,null))['catch'](handleError(_0x381a1,null));};exports[_0xfc6d('0x39')]=function(_0x425c69,_0x208cce){return db[_0xfc6d('0x42')][_0xfc6d('0x5c')]({'where':{'id':_0x425c69[_0xfc6d('0x66')]['id']}})[_0xfc6d('0x21')](handleEntityNotFound(_0x208cce,null))[_0xfc6d('0x21')](removeEntity(_0x208cce,null))[_0xfc6d('0x56')](handleError(_0x208cce,null));};exports[_0xfc6d('0x67')]=function(_0x32367e,_0x5d7591){return db[_0xfc6d('0x42')][_0xfc6d('0x67')]()[_0xfc6d('0x21')](respondWithResult(_0x5d7591,null))['catch'](handleError(_0x5d7591,null));};exports[_0xfc6d('0x68')]=function(_0x471cad,_0x29081a,_0x457342){if(_0x471cad['body']['id']){delete _0x471cad[_0xfc6d('0x5e')]['id'];}return db[_0xfc6d('0x42')][_0xfc6d('0x5c')]({'where':{'id':_0x471cad[_0xfc6d('0x66')]['id']}})[_0xfc6d('0x21')](handleEntityNotFound(_0x29081a,null))[_0xfc6d('0x21')](function(_0x4cce2f){if(_0x4cce2f){_0x471cad[_0xfc6d('0x5e')][_0xfc6d('0x69')]=_0x4cce2f['id'];return db[_0xfc6d('0x6a')][_0xfc6d('0x5d')](_0x471cad[_0xfc6d('0x5e')]);}})[_0xfc6d('0x21')](respondWithResult(_0x29081a,null))[_0xfc6d('0x56')](handleError(_0x29081a,null));};exports['getDispositions']=function(_0xdea8a0,_0x185031,_0x29e855){var _0x2e976d={'raw':![],'where':{}};var _0x3825c8={};var _0x176272={'count':0x0,'rows':[]};return db[_0xfc6d('0x42')][_0xfc6d('0x6b')]({'where':{'id':_0xdea8a0[_0xfc6d('0x66')]['id']}})[_0xfc6d('0x21')](handleEntityNotFound(_0x185031,null))[_0xfc6d('0x21')](function(_0x773dd7){if(_0x773dd7){_0x3825c8[_0xfc6d('0x48')]=_[_0xfc6d('0x59')](db[_0xfc6d('0x6a')][_0xfc6d('0x5a')]);_0x3825c8[_0xfc6d('0x45')]=_['keys'](_0xdea8a0['query']);_0x3825c8[_0xfc6d('0x46')]=_[_0xfc6d('0x47')](_0x3825c8[_0xfc6d('0x48')],_0x3825c8[_0xfc6d('0x45')]);_0x2e976d['attributes']=_[_0xfc6d('0x47')](_0x3825c8[_0xfc6d('0x48')],qs['fields'](_0xdea8a0['query'][_0xfc6d('0x4a')]));_0x2e976d[_0xfc6d('0x49')]=_0x2e976d[_0xfc6d('0x49')][_0xfc6d('0x5b')]?_0x2e976d[_0xfc6d('0x49')]:_0x3825c8[_0xfc6d('0x48')];if(!_0xdea8a0[_0xfc6d('0x45')]['hasOwnProperty'](_0xfc6d('0x6c'))){_0x2e976d[_0xfc6d('0x31')]=qs['limit'](_0xdea8a0['query'][_0xfc6d('0x31')]);_0x2e976d[_0xfc6d('0x32')]=qs[_0xfc6d('0x32')](_0xdea8a0[_0xfc6d('0x45')][_0xfc6d('0x32')]);}_0x2e976d['order']=qs['sort'](_0xdea8a0[_0xfc6d('0x45')][_0xfc6d('0x4d')]);_0x2e976d[_0xfc6d('0x4e')]=qs[_0xfc6d('0x46')](_[_0xfc6d('0x4f')](_0xdea8a0[_0xfc6d('0x45')],_0x3825c8['filters']));_0x2e976d[_0xfc6d('0x4e')]['FaxAccountId']=_0x773dd7['id'];if(_0xdea8a0[_0xfc6d('0x45')]['filter']){_0x2e976d[_0xfc6d('0x4e')]=_['merge'](_0x2e976d[_0xfc6d('0x4e')],{'$or':_['map'](_0x2e976d[_0xfc6d('0x49')],function(_0x2bb96a){var _0x4376a6={};_0x4376a6[_0x2bb96a]={'$like':'%'+_0xdea8a0[_0xfc6d('0x45')][_0xfc6d('0x50')]+'%'};return _0x4376a6;})});}_0x2e976d=_['merge']({},_0x2e976d,_0xdea8a0[_0xfc6d('0x52')]);return db[_0xfc6d('0x6a')][_0xfc6d('0x33')]({'where':_0x2e976d['where']})[_0xfc6d('0x21')](function(_0xbdf1c2){_0x176272[_0xfc6d('0x33')]=_0xbdf1c2;if(_0xdea8a0[_0xfc6d('0x45')][_0xfc6d('0x53')]){_0x2e976d[_0xfc6d('0x54')]=[{'all':!![]}];}return db[_0xfc6d('0x6a')][_0xfc6d('0x6d')](_0x2e976d);})[_0xfc6d('0x21')](function(_0x88b704){_0x176272['rows']=_0x88b704;return _0x176272;});}})[_0xfc6d('0x21')](respondWithFilteredResult(_0x185031,_0x2e976d))['catch'](handleError(_0x185031,null));};exports[_0xfc6d('0x6e')]=function(_0xdd3699,_0x3bfc41,_0x17f86d){return db[_0xfc6d('0x42')][_0xfc6d('0x5c')]({'where':{'id':_0xdd3699[_0xfc6d('0x66')]['id']}})[_0xfc6d('0x21')](handleEntityNotFound(_0x3bfc41,null))[_0xfc6d('0x21')](function(_0x2544b9){if(_0x2544b9){return _0x2544b9[_0xfc6d('0x6e')](_0xdd3699['query'][_0xfc6d('0x6f')]);}})[_0xfc6d('0x21')](respondWithStatusCode(_0x3bfc41,null))[_0xfc6d('0x56')](handleError(_0x3bfc41,null));};exports['addAnswer']=function(_0x51f8ce,_0x334529,_0x456e43){if(_0x51f8ce[_0xfc6d('0x5e')]['id']){delete _0x51f8ce[_0xfc6d('0x5e')]['id'];}return db[_0xfc6d('0x42')]['find']({'where':{'id':_0x51f8ce[_0xfc6d('0x66')]['id']}})[_0xfc6d('0x21')](handleEntityNotFound(_0x334529,null))[_0xfc6d('0x21')](function(_0x56d95c){if(_0x56d95c){_0x51f8ce[_0xfc6d('0x5e')][_0xfc6d('0x69')]=_0x56d95c['id'];return db['CannedAnswer'][_0xfc6d('0x5d')](_0x51f8ce[_0xfc6d('0x5e')]);}})['then'](respondWithResult(_0x334529,null))[_0xfc6d('0x56')](handleError(_0x334529,null));};exports[_0xfc6d('0x70')]=function(_0x6c99ed,_0x144b3a,_0x4c232d){var _0x539728={'raw':![],'where':{}};var _0x226bc0={};var _0x1b6dce={'count':0x0,'rows':[]};return db[_0xfc6d('0x42')]['findOne']({'where':{'id':_0x6c99ed[_0xfc6d('0x66')]['id']}})[_0xfc6d('0x21')](handleEntityNotFound(_0x144b3a,null))['then'](function(_0x3be5c4){if(_0x3be5c4){_0x226bc0[_0xfc6d('0x48')]=_[_0xfc6d('0x59')](db[_0xfc6d('0x71')]['rawAttributes']);_0x226bc0[_0xfc6d('0x45')]=_[_0xfc6d('0x59')](_0x6c99ed[_0xfc6d('0x45')]);_0x226bc0['filters']=_[_0xfc6d('0x47')](_0x226bc0[_0xfc6d('0x48')],_0x226bc0[_0xfc6d('0x45')]);_0x539728[_0xfc6d('0x49')]=_[_0xfc6d('0x47')](_0x226bc0['model'],qs['fields'](_0x6c99ed[_0xfc6d('0x45')][_0xfc6d('0x4a')]));_0x539728[_0xfc6d('0x49')]=_0x539728[_0xfc6d('0x49')]['length']?_0x539728[_0xfc6d('0x49')]:_0x226bc0[_0xfc6d('0x48')];if(!_0x6c99ed[_0xfc6d('0x45')][_0xfc6d('0x4b')](_0xfc6d('0x6c'))){_0x539728[_0xfc6d('0x31')]=qs['limit'](_0x6c99ed['query']['limit']);_0x539728[_0xfc6d('0x32')]=qs[_0xfc6d('0x32')](_0x6c99ed[_0xfc6d('0x45')][_0xfc6d('0x32')]);}_0x539728['order']=qs[_0xfc6d('0x4d')](_0x6c99ed[_0xfc6d('0x45')][_0xfc6d('0x4d')]);_0x539728[_0xfc6d('0x4e')]=qs[_0xfc6d('0x46')](_['pick'](_0x6c99ed[_0xfc6d('0x45')],_0x226bc0[_0xfc6d('0x46')]));_0x539728[_0xfc6d('0x4e')][_0xfc6d('0x69')]=_0x3be5c4['id'];if(_0x6c99ed[_0xfc6d('0x45')][_0xfc6d('0x50')]){_0x539728[_0xfc6d('0x4e')]=_[_0xfc6d('0x51')](_0x539728['where'],{'$or':_[_0xfc6d('0x41')](_0x539728['attributes'],function(_0x2adef2){var _0x2a6779={};_0x2a6779[_0x2adef2]={'$like':'%'+_0x6c99ed['query']['filter']+'%'};return _0x2a6779;})});}_0x539728=_[_0xfc6d('0x51')]({},_0x539728,_0x6c99ed[_0xfc6d('0x52')]);return db[_0xfc6d('0x71')][_0xfc6d('0x33')]({'where':_0x539728[_0xfc6d('0x4e')]})['then'](function(_0x1b0a2f){_0x1b6dce['count']=_0x1b0a2f;if(_0x6c99ed['query'][_0xfc6d('0x53')]){_0x539728[_0xfc6d('0x54')]=[{'all':!![]}];}return db[_0xfc6d('0x71')]['findAll'](_0x539728);})[_0xfc6d('0x21')](function(_0x528509){_0x1b6dce[_0xfc6d('0x55')]=_0x528509;return _0x1b6dce;});}})[_0xfc6d('0x21')](respondWithFilteredResult(_0x144b3a,_0x539728))[_0xfc6d('0x56')](handleError(_0x144b3a,null));};exports[_0xfc6d('0x72')]=function(_0x1395ea,_0x463e6e,_0x5d5e84){return db[_0xfc6d('0x42')]['find']({'where':{'id':_0x1395ea[_0xfc6d('0x66')]['id']}})[_0xfc6d('0x21')](handleEntityNotFound(_0x463e6e,null))[_0xfc6d('0x21')](function(_0x2e0e3f){if(_0x2e0e3f){return _0x2e0e3f[_0xfc6d('0x72')](_0x1395ea[_0xfc6d('0x45')][_0xfc6d('0x6f')]);}})[_0xfc6d('0x21')](respondWithStatusCode(_0x463e6e,null))[_0xfc6d('0x56')](handleError(_0x463e6e,null));};exports[_0xfc6d('0x73')]=function(_0x1225b6,_0x1fdf2a,_0x214f0a){return db[_0xfc6d('0x74')][_0xfc6d('0x5c')]({'where':{'id':_0x1225b6[_0xfc6d('0x66')]['id']}})[_0xfc6d('0x21')](handleEntityNotFound(_0x1fdf2a,null))['then'](function(_0x615bf){if(_0x615bf){return _0x615bf[_0xfc6d('0x73')](_0x1225b6[_0xfc6d('0x5e')][_0xfc6d('0x6f')],_[_0xfc6d('0x75')](_0x1225b6[_0xfc6d('0x5e')],[_0xfc6d('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x1fdf2a,null))[_0xfc6d('0x56')](handleError(_0x1fdf2a,null));};exports[_0xfc6d('0x76')]=function(_0x6941aa,_0x24c9b3,_0x19c335){var _0x1d959d={'raw':![],'where':{}};var _0x2264e6={};var _0x26340f={'count':0x0,'rows':[]};return db[_0xfc6d('0x42')][_0xfc6d('0x6b')]({'where':{'id':_0x6941aa[_0xfc6d('0x66')]['id']}})[_0xfc6d('0x21')](handleEntityNotFound(_0x24c9b3,null))[_0xfc6d('0x21')](function(_0x2fe4c9){if(_0x2fe4c9){_0x2264e6[_0xfc6d('0x48')]=_[_0xfc6d('0x59')](db['FaxInteraction'][_0xfc6d('0x5a')]);_0x2264e6[_0xfc6d('0x45')]=_['keys'](_0x6941aa[_0xfc6d('0x45')]);_0x2264e6[_0xfc6d('0x46')]=_[_0xfc6d('0x47')](_0x2264e6[_0xfc6d('0x48')],_0x2264e6['query']);_0x1d959d[_0xfc6d('0x49')]=_[_0xfc6d('0x47')](_0x2264e6[_0xfc6d('0x48')],qs[_0xfc6d('0x4a')](_0x6941aa[_0xfc6d('0x45')][_0xfc6d('0x4a')]));_0x1d959d[_0xfc6d('0x49')]=_0x1d959d[_0xfc6d('0x49')][_0xfc6d('0x5b')]?_0x1d959d[_0xfc6d('0x49')]:_0x2264e6['model'];if(!_0x6941aa[_0xfc6d('0x45')][_0xfc6d('0x4b')]('nolimit')){_0x1d959d[_0xfc6d('0x31')]=qs[_0xfc6d('0x31')](_0x6941aa[_0xfc6d('0x45')][_0xfc6d('0x31')]);_0x1d959d['offset']=qs[_0xfc6d('0x32')](_0x6941aa[_0xfc6d('0x45')][_0xfc6d('0x32')]);}_0x1d959d[_0xfc6d('0x4c')]=qs[_0xfc6d('0x4d')](_0x6941aa[_0xfc6d('0x45')][_0xfc6d('0x4d')]);_0x1d959d[_0xfc6d('0x4e')]=qs['filters'](_[_0xfc6d('0x4f')](_0x6941aa[_0xfc6d('0x45')],_0x2264e6[_0xfc6d('0x46')]));_0x1d959d[_0xfc6d('0x4e')][_0xfc6d('0x69')]=_0x2fe4c9['id'];if(_0x6941aa[_0xfc6d('0x45')][_0xfc6d('0x50')]){_0x1d959d[_0xfc6d('0x4e')]=_['merge'](_0x1d959d[_0xfc6d('0x4e')],{'$or':_['map'](_0x1d959d['attributes'],function(_0x4e94cf){var _0x1874d8={};_0x1874d8[_0x4e94cf]={'$like':'%'+_0x6941aa[_0xfc6d('0x45')][_0xfc6d('0x50')]+'%'};return _0x1874d8;})});}_0x1d959d=_[_0xfc6d('0x51')]({},_0x1d959d,_0x6941aa['options']);return db[_0xfc6d('0x74')][_0xfc6d('0x33')]({'where':_0x1d959d[_0xfc6d('0x4e')]})[_0xfc6d('0x21')](function(_0x1aa5ec){_0x26340f[_0xfc6d('0x33')]=_0x1aa5ec;if(_0x6941aa[_0xfc6d('0x45')][_0xfc6d('0x53')]){_0x1d959d['include']=[{'model':db[_0xfc6d('0x77')],'as':_0xfc6d('0x78'),'required':![]},{'model':db[_0xfc6d('0x79')],'as':_0xfc6d('0x7a'),'attributes':[_0xfc6d('0x3d'),_0xfc6d('0x7b'),'internal'],'required':![]},{'model':db[_0xfc6d('0x7c')],'as':_0xfc6d('0x7d'),'attributes':['id','name',_0xfc6d('0x7e')],'where':_0x6941aa[_0xfc6d('0x45')]['tag']?{'id':_0x6941aa[_0xfc6d('0x45')][_0xfc6d('0x7f')]}:undefined,'required':_0x6941aa[_0xfc6d('0x45')]['tag']?!![]:![]}];}return db['FaxInteraction'][_0xfc6d('0x6d')](_0x1d959d);})[_0xfc6d('0x21')](function(_0x4a387b){_0x26340f[_0xfc6d('0x55')]=_0x4a387b;return _0x26340f;});}})[_0xfc6d('0x21')](respondWithFilteredResult(_0x24c9b3,_0x1d959d))[_0xfc6d('0x56')](handleError(_0x24c9b3,null));};exports['addApplications']=function(_0x25b149,_0x1d32d1){var _0x5346b3=_0x25b149[_0xfc6d('0x66')]['id'];var _0x3e2268=_0x25b149[_0xfc6d('0x5e')];var _0x36d013=0xc8;var _0x18b5f5=null;return db['sequelize'][_0xfc6d('0x80')]({'isolationLevel':db[_0xfc6d('0x81')][_0xfc6d('0x82')]['ISOLATION_LEVELS'][_0xfc6d('0x83')]},function(_0x49814e){return db[_0xfc6d('0x42')]['findOne']({'where':{'id':_0x5346b3},'transaction':_0x49814e})[_0xfc6d('0x21')](function(_0x39d093){if(_0x39d093){return db[_0xfc6d('0x84')][_0xfc6d('0x39')]({'where':{'FaxAccountId':_0x5346b3},'transaction':_0x49814e})['then'](function(){var _0x113a88=_['map'](_0x3e2268,function(_0x2bf969){_0x2bf969[_0xfc6d('0x69')]=_0x5346b3;return _0x2bf969;});return db['FaxApplication'][_0xfc6d('0x85')](_0x113a88,{'transaction':_0x49814e});});}else{_0x36d013=0x194;_0x18b5f5=[];}});})[_0xfc6d('0x21')](function(){if(_0x36d013!==0x194){return db[_0xfc6d('0x84')][_0xfc6d('0x86')]({'where':{'FaxAccountId':_0x5346b3},'order':_0xfc6d('0x87')})['then'](function(_0x58f826){_0x18b5f5=_0x58f826;});}})[_0xfc6d('0x56')](function(_0x4bf00d){_0x36d013=0x1f4;logger[_0xfc6d('0x27')](_0x4bf00d[_0xfc6d('0x3c')]);if(_0x4bf00d[_0xfc6d('0x3d')]){delete _0x4bf00d[_0xfc6d('0x3d')];}_0x18b5f5=_0x4bf00d;})[_0xfc6d('0x88')](function(){if(_0x18b5f5===null){_0x1d32d1[_0xfc6d('0x2c')](_0x36d013);}else{if(_0x36d013===0x1f4){_0x1d32d1[_0xfc6d('0x2d')](_0x36d013)['send'](_0x18b5f5);}else{_0x1d32d1[_0xfc6d('0x2d')](_0x36d013)[_0xfc6d('0x2f')](_0x18b5f5);}}});};exports[_0xfc6d('0x89')]=function(_0x4150eb,_0x2b329f,_0x2ddd4b){var _0x52928f={};var _0x9535f7={};var _0x50a9ab;var _0x503a9f;return db[_0xfc6d('0x42')][_0xfc6d('0x6b')]({'where':{'id':_0x4150eb[_0xfc6d('0x66')]['id']}})[_0xfc6d('0x21')](handleEntityNotFound(_0x2b329f,null))[_0xfc6d('0x21')](function(_0xca5663){if(_0xca5663){_0x50a9ab=_0xca5663;_0x9535f7[_0xfc6d('0x48')]=_[_0xfc6d('0x59')](db[_0xfc6d('0x84')][_0xfc6d('0x5a')]);_0x9535f7['query']=_[_0xfc6d('0x59')](_0x4150eb[_0xfc6d('0x45')]);_0x9535f7['filters']=_[_0xfc6d('0x47')](_0x9535f7['model'],_0x9535f7[_0xfc6d('0x45')]);_0x52928f[_0xfc6d('0x49')]=_[_0xfc6d('0x47')](_0x9535f7[_0xfc6d('0x48')],qs[_0xfc6d('0x4a')](_0x4150eb[_0xfc6d('0x45')][_0xfc6d('0x4a')]));_0x52928f[_0xfc6d('0x49')]=_0x52928f[_0xfc6d('0x49')]['length']?_0x52928f[_0xfc6d('0x49')]:_0x9535f7[_0xfc6d('0x48')];_0x52928f[_0xfc6d('0x4c')]=qs['sort'](_0x4150eb[_0xfc6d('0x45')][_0xfc6d('0x4d')]);_0x52928f[_0xfc6d('0x4e')]=qs['filters'](_[_0xfc6d('0x4f')](_0x4150eb[_0xfc6d('0x45')],_0x9535f7[_0xfc6d('0x46')]));if(_0x4150eb[_0xfc6d('0x45')]['filter']){_0x52928f[_0xfc6d('0x4e')]=_['merge'](_0x52928f['where'],{'$or':_[_0xfc6d('0x41')](_0x52928f[_0xfc6d('0x49')],function(_0x2d9f2b){var _0x10fb06={};_0x10fb06[_0x2d9f2b]={'$like':'%'+_0x4150eb[_0xfc6d('0x45')]['filter']+'%'};return _0x10fb06;})});}_0x52928f=_['merge']({},_0x52928f,_0x4150eb[_0xfc6d('0x52')]);return _0x50a9ab[_0xfc6d('0x89')](_0x52928f);}})['then'](function(_0x4f48fb){if(_0x4f48fb){_0x503a9f=_0x4f48fb[_0xfc6d('0x5b')];if(!_0x4150eb[_0xfc6d('0x45')][_0xfc6d('0x4b')](_0xfc6d('0x6c'))){_0x52928f[_0xfc6d('0x31')]=qs[_0xfc6d('0x31')](_0x4150eb[_0xfc6d('0x45')][_0xfc6d('0x31')]);_0x52928f[_0xfc6d('0x32')]=qs[_0xfc6d('0x32')](_0x4150eb['query']['offset']);}return _0x50a9ab[_0xfc6d('0x89')](_0x52928f);}})[_0xfc6d('0x21')](function(_0x347d97){if(_0x347d97){return _0x347d97?{'count':_0x503a9f,'rows':_0x347d97}:null;}})[_0xfc6d('0x21')](respondWithResult(_0x2b329f,null))[_0xfc6d('0x56')](handleError(_0x2b329f,null));};function Extension(_0x58396c,_0x560d3a,_0x4957c5,_0x4656b5){this[_0xfc6d('0x8a')]=_0xfc6d('0x8b');this[_0xfc6d('0x8c')]=_0x58396c[_0xfc6d('0x8d')];this[_0xfc6d('0x8e')]=_0x4656b5;this[_0xfc6d('0x43')]=_0xfc6d('0x8f');this[_0xfc6d('0x90')]='Fax\x20Extension';this[_0xfc6d('0x69')]=_0x58396c['id'];this[_0xfc6d('0x87')]=_0x560d3a;this[_0xfc6d('0x91')]=_0x4957c5;}function createExtensionsReciveFax(_0x1a3a81){var _0x324181=0x1;var _0x3ac8c1=[];_0x3ac8c1[_0xfc6d('0x92')](new Extension(_0x1a3a81,_0x324181,'',_0xfc6d('0x93')));_0x324181+=0x1;_0x3ac8c1['push'](new Extension(_0x1a3a81,_0x324181,_0xfc6d('0x94'),'Set'));_0x324181+=0x1;for(var _0x554407 in _0x1a3a81){if(_0x1a3a81['hasOwnProperty'](_0x554407)&&(_0x554407==='ecm'||_0x554407===_0xfc6d('0x8d')||_0x554407===_0xfc6d('0x95')||_0x554407===_0xfc6d('0x96')||_0x554407===_0xfc6d('0x97')||_0x554407===_0xfc6d('0x98')||_0x554407===_0xfc6d('0x99')||_0x554407===_0xfc6d('0x9a')||_0x554407===_0xfc6d('0x9b'))){_0x3ac8c1['push'](new Extension(_0x1a3a81,_0x324181,_0xfc6d('0x9c')+_0x554407+')='+_0x1a3a81[_0x554407],_0xfc6d('0x9d')));_0x324181+=0x1;}}_0x3ac8c1[_0xfc6d('0x92')](new Extension(_0x1a3a81,_0x324181,'6',_0xfc6d('0x9e')));_0x324181+=0x1;_0x3ac8c1[_0xfc6d('0x92')](new Extension(_0x1a3a81,_0x324181,_0xfc6d('0x9f'),_0xfc6d('0xa0')));_0x324181=0x0;return _0x3ac8c1;}exports[_0xfc6d('0xa1')]=function(_0x4913ca,_0x540515,_0x408f79){var _0x4a0b1d;return db[_0xfc6d('0x81')]['transaction'](function(_0x4ab6ef){return db[_0xfc6d('0x42')][_0xfc6d('0x5d')](_0x4913ca[_0xfc6d('0x5e')],{'transaction':_0x4ab6ef})[_0xfc6d('0x21')](function(_0x4439a3){_0x4a0b1d=_0x4439a3[_0xfc6d('0x3a')]({'plain':!![]});return db[_0xfc6d('0xa2')]['bulkCreate'](createExtensionsReciveFax(_0x4a0b1d),{'transaction':_0x4ab6ef});});})['then'](function(){return _0x4a0b1d;})[_0xfc6d('0x21')](respondWithResult(_0x540515,null))[_0xfc6d('0x56')](handleError(_0x540515,null));};exports[_0xfc6d('0xa3')]=function(_0x43c389,_0x431da0,_0x2dbed2){var _0x4ea65d;return db[_0xfc6d('0x81')]['transaction'](function(_0x39d3ea){return db[_0xfc6d('0x42')][_0xfc6d('0x38')](_0x43c389['body'],{'where':{'id':_0x43c389['body']['id']},'transaction':_0x39d3ea})[_0xfc6d('0x21')](function(_0x54809b){return db[_0xfc6d('0xa2')][_0xfc6d('0x39')]({'where':{'FaxAccountId':_0x43c389[_0xfc6d('0x5e')]['id']},'transaction':_0x39d3ea})['then'](function(_0x181acd){return db[_0xfc6d('0xa2')][_0xfc6d('0x85')](createExtensionsReciveFax(_[_0xfc6d('0x75')](_0x43c389[_0xfc6d('0x5e')],[_0xfc6d('0xa4'),_0xfc6d('0x44'),'createdAt',_0xfc6d('0xa5'),'TrunkId',_0xfc6d('0xa6')])),{'transaction':_0x39d3ea});});});})['then'](function(){return db[_0xfc6d('0x42')]['findById'](_0x43c389[_0xfc6d('0x5e')]['id']);})[_0xfc6d('0x21')](respondWithResult(_0x431da0,null))[_0xfc6d('0x56')](handleError(_0x431da0,null));};exports[_0xfc6d('0xa7')]=function(_0xc0c311,_0x5264e5,_0x1c06a1){var _0x59246c={'raw':!![],'where':{}};var _0x46655c={};var _0x18a040={'count':0x0,'rows':[]};return db[_0xfc6d('0x42')][_0xfc6d('0x6b')]({'where':{'id':_0xc0c311[_0xfc6d('0x66')]['id']}})[_0xfc6d('0x21')](handleEntityNotFound(_0x5264e5,null))[_0xfc6d('0x21')](function(_0x4f6220){if(_0x4f6220){_0x46655c[_0xfc6d('0x48')]=_['keys'](db[_0xfc6d('0xa8')][_0xfc6d('0x5a')]);_0x46655c['query']=_[_0xfc6d('0x59')](_0xc0c311['query']);_0x46655c[_0xfc6d('0x46')]=_[_0xfc6d('0x47')](_0x46655c[_0xfc6d('0x48')],_0x46655c[_0xfc6d('0x45')]);_0x59246c[_0xfc6d('0x49')]=_[_0xfc6d('0x47')](_0x46655c[_0xfc6d('0x48')],qs[_0xfc6d('0x4a')](_0xc0c311['query'][_0xfc6d('0x4a')]));_0x59246c[_0xfc6d('0x49')]=_0x59246c['attributes']['length']?_0x59246c[_0xfc6d('0x49')]:_0x46655c[_0xfc6d('0x48')];if(!_0xc0c311[_0xfc6d('0x45')][_0xfc6d('0x4b')](_0xfc6d('0x6c'))){_0x59246c['limit']=qs[_0xfc6d('0x31')](_0xc0c311['query'][_0xfc6d('0x31')]);_0x59246c['offset']=qs[_0xfc6d('0x32')](_0xc0c311['query'][_0xfc6d('0x32')]);}_0x59246c[_0xfc6d('0x4c')]=qs[_0xfc6d('0x4d')](_0xc0c311['query'][_0xfc6d('0x4d')]);_0x59246c[_0xfc6d('0x4e')]=qs[_0xfc6d('0x46')](_[_0xfc6d('0x4f')](_0xc0c311[_0xfc6d('0x45')],_0x46655c[_0xfc6d('0x46')]));_0x59246c[_0xfc6d('0x4e')][_0xfc6d('0x69')]=_0x4f6220['id'];if(_0xc0c311[_0xfc6d('0x45')][_0xfc6d('0x50')]){_0x59246c[_0xfc6d('0x4e')]=_[_0xfc6d('0x51')](_0x59246c[_0xfc6d('0x4e')],{'$or':_[_0xfc6d('0x41')](_0x59246c[_0xfc6d('0x49')],function(_0x1e9521){var _0x12f97e={};_0x12f97e[_0x1e9521]={'$like':'%'+_0xc0c311[_0xfc6d('0x45')][_0xfc6d('0x50')]+'%'};return _0x12f97e;})});}if(_0xc0c311[_0xfc6d('0x45')][_0xfc6d('0xa9')]){var _0x5bbc1f=_0xc0c311[_0xfc6d('0x45')][_0xfc6d('0xa9')][_0xfc6d('0xaa')](',');var _0x3448d3={};_0x3448d3[_0x5bbc1f[0x0]]={'$gte':moment(_0x5bbc1f[0x1])[_0xfc6d('0xab')](_0xfc6d('0xac'))};_0x59246c[_0xfc6d('0x4e')]=_[_0xfc6d('0x51')](_0x59246c['where'],_0x3448d3);}_0x59246c=_[_0xfc6d('0x51')]({},_0x59246c,_0xc0c311[_0xfc6d('0x52')]);return db['FaxMessage']['count']({'where':_0x59246c[_0xfc6d('0x4e')]})[_0xfc6d('0x21')](function(_0x11bdca){_0x18a040[_0xfc6d('0x33')]=_0x11bdca;if(_0xc0c311[_0xfc6d('0x45')][_0xfc6d('0x53')]){_0x59246c[_0xfc6d('0x54')]=[{'all':!![]}];}return db[_0xfc6d('0xa8')][_0xfc6d('0x6d')](_0x59246c);})[_0xfc6d('0x21')](function(_0x122e08){_0x18a040[_0xfc6d('0x55')]=_0x122e08;return _0x18a040;});}})[_0xfc6d('0x21')](respondWithFilteredResult(_0x5264e5,_0x59246c))[_0xfc6d('0x56')](handleError(_0x5264e5,null));};exports[_0xfc6d('0x3e')]=function(_0x49d8c0,_0x1e6fe1,_0x4cf4df){var _0x1aeb77,_0x849835={},_0x3aa15b;if(_0x49d8c0[_0xfc6d('0x5e')]['to']){_0x3aa15b=_0x49d8c0[_0xfc6d('0x5e')]['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x49d8c0[_0xfc6d('0x66')]['id']},'include':[{'model':db['CmList'],'as':_0xfc6d('0xad'),'include':[{'model':db[_0xfc6d('0x77')],'as':_0xfc6d('0xae'),'where':{'fax':_0x3aa15b},'limit':0x1,'order':[[_0xfc6d('0xa5'),_0xfc6d('0xaf')]]}]}]})[_0xfc6d('0x21')](handleEntityNotFound(_0x1e6fe1,null))['then'](function(_0x2572b5){_0x1aeb77=_0x2572b5;if(_0x49d8c0[_0xfc6d('0x5e')][_0xfc6d('0xb0')]&&_0x49d8c0['body'][_0xfc6d('0xb0')][_0xfc6d('0x5b')]){for(var _0x11c320=0x0;_0x11c320<_0x49d8c0[_0xfc6d('0x5e')][_0xfc6d('0xb0')]['length'];_0x11c320+=0x1){_0x49d8c0[_0xfc6d('0x5e')][_0xfc6d('0xb0')][_0x11c320]={'filename':_0x49d8c0[_0xfc6d('0x5e')][_0xfc6d('0xb0')][_0x11c320][_0xfc6d('0x3d')],'id':_0x49d8c0[_0xfc6d('0x5e')]['attachments'][_0x11c320]['id'],'path':path['join'](config[_0xfc6d('0xb1')],_0xfc6d('0xb2'),_0x49d8c0[_0xfc6d('0x5e')][_0xfc6d('0xb0')][_0x11c320][_0xfc6d('0xb3')])};}}return respondWithRpcPromise('CheckAfterSend',_0xfc6d('0xb4'),{'FaxAccountId':_[_0xfc6d('0xb5')](_0x49d8c0[_0xfc6d('0x66')]['id'])?undefined:_0x49d8c0[_0xfc6d('0x66')]['id'],'path':_[_0xfc6d('0xb5')](_0x49d8c0[_0xfc6d('0x5e')][_0xfc6d('0xb0')][0x0]['path'])?undefined:_0x49d8c0['body'][_0xfc6d('0xb0')][0x0][_0xfc6d('0x8')],'fax':_[_0xfc6d('0xb5')](_0x49d8c0[_0xfc6d('0x5e')]['to'][0x0])?undefined:_0x49d8c0[_0xfc6d('0x5e')]['to'][0x0]},client9002);})[_0xfc6d('0x21')](function(){if(_0x1aeb77){if(_[_0xfc6d('0xb5')](_0x49d8c0[_0xfc6d('0x5e')][_0xfc6d('0xb6')])){_0x49d8c0[_0xfc6d('0x5e')][_0xfc6d('0xb6')]=util[_0xfc6d('0xab')](_0xfc6d('0xb7'),_0x1aeb77[_0xfc6d('0x3d')],_0x1aeb77[_0xfc6d('0xb8')]);}if(_0x1aeb77['List']){if(_0x1aeb77[_0xfc6d('0xad')][_0xfc6d('0xae')][_0xfc6d('0x5b')]){return _0x1aeb77[_0xfc6d('0xad')]['Contacts'][0x0];}else{return db[_0xfc6d('0x77')][_0xfc6d('0x5d')](_[_0xfc6d('0x19')](_0x49d8c0['body'],{'firstName':_0x49d8c0[_0xfc6d('0x5e')]['to'][0x0],'phone':_0x49d8c0[_0xfc6d('0x5e')]['to'][0x0],'fax':_0x49d8c0[_0xfc6d('0x5e')]['to'][0x0],'ListId':_0x1aeb77[_0xfc6d('0xa6')]}));}}else{throw new Error(_0xfc6d('0xb9'));}}else{throw new Error(_0xfc6d('0xba'));}})['then'](function(_0x21ee97){if(_0x21ee97){return db[_0xfc6d('0x74')][_0xfc6d('0x5c')]({'where':{'ContactId':_0x21ee97['id'],'closed':![],'FaxAccountId':_0x1aeb77['id']}})[_0xfc6d('0x21')](function(_0x378446){if(_0x378446){return[_0x378446,![]];}return db[_0xfc6d('0x74')][_0xfc6d('0x5d')]({'UserId':_0x49d8c0['user']['id'],'ContactId':_0x21ee97['id'],'FaxAccountId':_0x1aeb77['id'],'fax':_0x49d8c0[_0xfc6d('0x5e')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xfc6d('0x51')](_0x49d8c0[_0xfc6d('0x5e')],{'read':![],'body':_0x49d8c0[_0xfc6d('0x5e')][_0xfc6d('0xb0')][0x0][_0xfc6d('0xbb')],'FaxAccountId':_0x1aeb77['id'],'UserId':_0x49d8c0[_0xfc6d('0x5f')]['id'],'ContactId':_0x21ee97['id'],'AttachmentId':_0x49d8c0[_0xfc6d('0x5e')][_0xfc6d('0xb0')][0x0]['id']})]},{'include':[{'model':db[_0xfc6d('0xa8')],'as':'Messages'}]})[_0xfc6d('0x21')](function(_0x182f77){return[_0x182f77,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xfc6d('0xbc')](function(_0x3b3f58,_0x262b17){if(_0x262b17){return _0x3b3f58;}return db[_0xfc6d('0xa8')][_0xfc6d('0x5d')]({'direction':_0xfc6d('0xbd'),'read':![],'body':_0x49d8c0['body'][_0xfc6d('0xb0')][0x0][_0xfc6d('0xbb')],'FaxAccountId':_0x1aeb77['id'],'FaxInteractionId':_0x3b3f58['id'],'UserId':_0x49d8c0[_0xfc6d('0x5f')]['id'],'ContactId':_0x3b3f58[_0xfc6d('0xbe')],'AttachmentId':_0x49d8c0['body']['attachments'][0x0]['id']})[_0xfc6d('0x21')](function(_0x5b415c){_0x3b3f58[_0xfc6d('0xbf')][_0xfc6d('0xc0')]=[];_0x3b3f58['dataValues'][_0xfc6d('0xc0')][_0xfc6d('0x92')](_0x5b415c['dataValues']);return _0x3b3f58;});})[_0xfc6d('0x21')](function(_0x17be8d){respondWithRpcPromise(_0xfc6d('0xc1'),_0xfc6d('0xc1'),{'FaxAccountId':_[_0xfc6d('0xb5')](_0x49d8c0[_0xfc6d('0x66')]['id'])?undefined:_0x49d8c0[_0xfc6d('0x66')]['id'],'path':_[_0xfc6d('0xb5')](_0x49d8c0[_0xfc6d('0x5e')][_0xfc6d('0xb0')][0x0]['path'])?undefined:_0x49d8c0[_0xfc6d('0x5e')][_0xfc6d('0xb0')][0x0][_0xfc6d('0x8')],'fax':_[_0xfc6d('0xb5')](_0x49d8c0[_0xfc6d('0x5e')]['to'][0x0])?undefined:_0x49d8c0[_0xfc6d('0x5e')]['to'][0x0],'AttachmentId':_0x49d8c0[_0xfc6d('0x5e')][_0xfc6d('0xb0')][0x0]['id']},client9002)[_0xfc6d('0x21')](function(_0x49a7a0){logger['info'](_0xfc6d('0xc2'),_0x49a7a0);})['catch'](function(_0x543e53){logger[_0xfc6d('0x2a')](_0xfc6d('0xc2'),_0x543e53);});return _0x17be8d;})[_0xfc6d('0x21')](respondWithResult(_0x1e6fe1,null))[_0xfc6d('0x56')](handleError(_0x1e6fe1,null));};exports[_0xfc6d('0xc3')]=function(_0x1afe03,_0x151d2e,_0x9e3913){return db[_0xfc6d('0x42')][_0xfc6d('0x5c')]({'where':{'id':_0x1afe03['params']['id']}})['then'](handleEntityNotFound(_0x151d2e,null))[_0xfc6d('0x21')](function(_0x5c46c9){if(_0x5c46c9){return _0x5c46c9[_0xfc6d('0xc3')](_0x1afe03[_0xfc6d('0x5e')][_0xfc6d('0x6f')],_['omit'](_0x1afe03['body'],[_0xfc6d('0x6f'),'id'])||{})['spread'](function(_0x29f5a1){for(var _0x4e27d5=0x0;_0x4e27d5<_0x1afe03[_0xfc6d('0x5e')][_0xfc6d('0x6f')][_0xfc6d('0x5b')];_0x4e27d5+=0x1){socket[_0xfc6d('0xc4')](_0xfc6d('0xc5'),{'UserId':Number(_0x1afe03[_0xfc6d('0x5e')]['ids'][_0x4e27d5]),'FaxAccountId':Number(_0x1afe03['params']['id'])});}return _0x29f5a1;});}})[_0xfc6d('0x21')](respondWithResult(_0x151d2e,null))[_0xfc6d('0x56')](handleError(_0x151d2e,null));};exports[_0xfc6d('0xc6')]=function(_0x3ba6ab,_0x25451e,_0x2e7162){return db[_0xfc6d('0x42')][_0xfc6d('0x5c')]({'where':{'id':_0x3ba6ab[_0xfc6d('0x66')]['id']}})[_0xfc6d('0x21')](handleEntityNotFound(_0x25451e,null))[_0xfc6d('0x21')](function(_0x46438a){if(_0x46438a){return _0x46438a['removeAgents'](_0x3ba6ab[_0xfc6d('0x45')]['ids'])[_0xfc6d('0x21')](function(){if(_[_0xfc6d('0xc7')](_0x3ba6ab[_0xfc6d('0x45')]['ids'])){for(var _0x209f9a=0x0;_0x209f9a<_0x3ba6ab[_0xfc6d('0x45')][_0xfc6d('0x6f')][_0xfc6d('0x5b')];_0x209f9a+=0x1){socket['emit'](_0xfc6d('0xc8'),{'UserId':Number(_0x3ba6ab[_0xfc6d('0x45')][_0xfc6d('0x6f')][_0x209f9a]),'FaxAccountId':Number(_0x3ba6ab['params']['id'])});}}else{socket[_0xfc6d('0xc4')]('userFaxAccount:remove',{'UserId':Number(_0x3ba6ab[_0xfc6d('0x45')]['ids']),'FaxAccountId':Number(_0x3ba6ab[_0xfc6d('0x66')]['id'])});}});}})['then'](respondWithStatusCode(_0x25451e,null))[_0xfc6d('0x56')](handleError(_0x25451e,null));};exports[_0xfc6d('0xc9')]=function(_0x4c4eb3,_0x264a2c,_0x2552a7){var _0xcb6912={};var _0xdf79f0={};var _0x4cc8ab;var _0xdccaa6;return db[_0xfc6d('0x42')][_0xfc6d('0x6b')]({'where':{'id':_0x4c4eb3[_0xfc6d('0x66')]['id']}})[_0xfc6d('0x21')](handleEntityNotFound(_0x264a2c,null))[_0xfc6d('0x21')](function(_0x262c80){if(_0x262c80){_0x4cc8ab=_0x262c80;_0xdf79f0[_0xfc6d('0x48')]=_[_0xfc6d('0x59')](db[_0xfc6d('0x79')][_0xfc6d('0x5a')]);_0xdf79f0[_0xfc6d('0x45')]=_['keys'](_0x4c4eb3['query']);_0xdf79f0[_0xfc6d('0x46')]=_[_0xfc6d('0x47')](_0xdf79f0[_0xfc6d('0x48')],_0xdf79f0[_0xfc6d('0x45')]);_0xcb6912[_0xfc6d('0x49')]=_[_0xfc6d('0x47')](_0xdf79f0['model'],qs[_0xfc6d('0x4a')](_0x4c4eb3[_0xfc6d('0x45')][_0xfc6d('0x4a')]));_0xcb6912['attributes']=_0xcb6912[_0xfc6d('0x49')][_0xfc6d('0x5b')]?_0xcb6912[_0xfc6d('0x49')]:_0xdf79f0['model'];_0xcb6912['order']=qs[_0xfc6d('0x4d')](_0x4c4eb3['query'][_0xfc6d('0x4d')]);_0xcb6912[_0xfc6d('0x4e')]=qs[_0xfc6d('0x46')](_[_0xfc6d('0x4f')](_0x4c4eb3[_0xfc6d('0x45')],_0xdf79f0[_0xfc6d('0x46')]));if(_0x4c4eb3[_0xfc6d('0x45')]['filter']){_0xcb6912['where']=_[_0xfc6d('0x51')](_0xcb6912[_0xfc6d('0x4e')],{'$or':_['map'](_0xcb6912['attributes'],function(_0xdc4b53){var _0x3b2229={};_0x3b2229[_0xdc4b53]={'$like':'%'+_0x4c4eb3[_0xfc6d('0x45')][_0xfc6d('0x50')]+'%'};return _0x3b2229;})});}_0xcb6912=_[_0xfc6d('0x51')]({},_0xcb6912,_0x4c4eb3[_0xfc6d('0x52')]);return _0x4cc8ab[_0xfc6d('0xc9')](_0xcb6912);}})[_0xfc6d('0x21')](function(_0x43feb1){if(_0x43feb1){_0xdccaa6=_0x43feb1[_0xfc6d('0x5b')];if(!_0x4c4eb3[_0xfc6d('0x45')][_0xfc6d('0x4b')](_0xfc6d('0x6c'))){_0xcb6912[_0xfc6d('0x31')]=qs['limit'](_0x4c4eb3[_0xfc6d('0x45')]['limit']);_0xcb6912[_0xfc6d('0x32')]=qs[_0xfc6d('0x32')](_0x4c4eb3['query'][_0xfc6d('0x32')]);}return _0x4cc8ab[_0xfc6d('0xc9')](_0xcb6912);}})['then'](function(_0x30ee65){if(_0x30ee65){return _0x30ee65?{'count':_0xdccaa6,'rows':_0x30ee65}:null;}})[_0xfc6d('0x21')](respondWithResult(_0x264a2c,null))['catch'](handleError(_0x264a2c,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 067d4d9..1f20b64 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 _0x5d30=['../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x1b3c93,_0x3a6456){var _0x1e4b5b=function(_0x3a97c5){while(--_0x3a97c5){_0x1b3c93['push'](_0x1b3c93['shift']());}};_0x1e4b5b(++_0x3a6456);}(_0x5d30,0x135));var _0x05d3=function(_0x44e00a,_0x248bbc){_0x44e00a=_0x44e00a-0x0;var _0x2bdfba=_0x5d30[_0x44e00a];return _0x2bdfba;};'use strict';var EventEmitter=require(_0x05d3('0x0'));var FaxAccount=require(_0x05d3('0x1'))['db'][_0x05d3('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x05d3('0x3')](0x0);var events={'afterCreate':_0x05d3('0x4'),'afterUpdate':_0x05d3('0x5'),'afterDestroy':_0x05d3('0x6')};function emitEvent(_0x472da5){return function(_0x21f06e,_0x14e388,_0x103bfb){FaxAccountEvents[_0x05d3('0x7')](_0x472da5+':'+_0x21f06e['id'],_0x21f06e);FaxAccountEvents['emit'](_0x472da5,_0x21f06e);_0x103bfb(null);};}for(var e in events){if(events[_0x05d3('0x8')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x05d3('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0xae60=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','remove','emit'];(function(_0x467cb0,_0x303070){var _0x2153f7=function(_0x51775a){while(--_0x51775a){_0x467cb0['push'](_0x467cb0['shift']());}};_0x2153f7(++_0x303070);}(_0xae60,0x18f));var _0x0ae6=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xae60[_0x26f702];return _0x11417d;};'use strict';var EventEmitter=require(_0x0ae6('0x0'));var FaxAccount=require(_0x0ae6('0x1'))['db'][_0x0ae6('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x0ae6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0ae6('0x4')};function emitEvent(_0x3c7e5e){return function(_0x215e86,_0x52d10e,_0x56d9ce){FaxAccountEvents['emit'](_0x3c7e5e+':'+_0x215e86['id'],_0x215e86);FaxAccountEvents[_0x0ae6('0x5')](_0x3c7e5e,_0x215e86);_0x56d9ce(null);};}for(var e in events){if(events[_0x0ae6('0x6')](e)){var event=events[e];FaxAccount[_0x0ae6('0x7')](e,emitEvent(event));}}module[_0x0ae6('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 84c35c7..ec7b70c 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 _0xba22=['lodash','util','../../config/logger','bluebird','path','rimraf','./faxAccount.attributes','exports','define','fax_accounts'];(function(_0x2f8c59,_0x4248e5){var _0x2b4a05=function(_0x5c6605){while(--_0x5c6605){_0x2f8c59['push'](_0x2f8c59['shift']());}};_0x2b4a05(++_0x4248e5);}(_0xba22,0x10e));var _0x2ba2=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xba22[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0x2ba2('0x0'));var util=require(_0x2ba2('0x1'));var logger=require(_0x2ba2('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2ba2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ba2('0x4'));var rimraf=require(_0x2ba2('0x5'));var config=require('../../config/environment');var attributes=require(_0x2ba2('0x6'));module[_0x2ba2('0x7')]=function(_0x186cd6,_0x111696){return _0x186cd6[_0x2ba2('0x8')]('FaxAccount',attributes,{'tableName':_0x2ba2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x884e=['lodash','util','../../config/logger','api','moment','request-promise','path','exports','FaxAccount'];(function(_0x2e38b9,_0x367528){var _0x53fb4d=function(_0x19a656){while(--_0x19a656){_0x2e38b9['push'](_0x2e38b9['shift']());}};_0x53fb4d(++_0x367528);}(_0x884e,0xfc));var _0xe884=function(_0x2b9a73,_0x57885f){_0x2b9a73=_0x2b9a73-0x0;var _0x20f360=_0x884e[_0x2b9a73];return _0x20f360;};'use strict';var _=require(_0xe884('0x0'));var util=require(_0xe884('0x1'));var logger=require(_0xe884('0x2'))(_0xe884('0x3'));var moment=require(_0xe884('0x4'));var BPromise=require('bluebird');var rp=require(_0xe884('0x5'));var fs=require('fs');var path=require(_0xe884('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module[_0xe884('0x7')]=function(_0x10be02,_0x3c2e17){return _0x10be02['define'](_0xe884('0x8'),attributes,{'tableName':'fax_accounts','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 c3b1657..1bebee7 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 _0x543f=['raw','where','attributes','limit','map','include','model','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','createdAt','difference','updatedAt','CompanyId','body','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','FaxAccount','find','account','CmList','List','Contacts','DESC','Applications','get','applications','orderBy','priority','asc','length','ListId','create','FaxInteraction','spread','autoclose','push','close','FaxMessage','ContactId','interaction','UserId','User','name','waitForTheAssignedAgent','*,*,*,*','queueId','unshift','queue','Start','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetFaxAccount','findAll','options'];(function(_0xeb4849,_0x21d281){var _0x5006c2=function(_0x4db46d){while(--_0x4db46d){_0xeb4849['push'](_0xeb4849['shift']());}};_0x5006c2(++_0x21d281);}(_0x543f,0xee));var _0xf543=function(_0x4f6e60,_0x489974){_0x4f6e60=_0x4f6e60-0x0;var _0x19cc6c=_0x543f[_0x4f6e60];return _0x19cc6c;};'use strict';var _=require(_0xf543('0x0'));var util=require(_0xf543('0x1'));var moment=require(_0xf543('0x2'));var BPromise=require(_0xf543('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf543('0x4'));var db=require(_0xf543('0x5'))['db'];var utils=require(_0xf543('0x6'));var logger=require(_0xf543('0x7'))(_0xf543('0x8'));var config=require('../../config/environment');var jayson=require(_0xf543('0x9'));var client=jayson['client'][_0xf543('0xa')]({'port':0x232c});config[_0xf543('0xb')]=_[_0xf543('0xc')](config[_0xf543('0xb')],{'host':_0xf543('0xd'),'port':0x18eb});var socket=require(_0xf543('0xe'))(new Redis(config[_0xf543('0xb')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x2fbb38,_0x1e4bf3,_0x37cfd3){return new BPromise(function(_0xce6ca0,_0x482d2e){return client[_0xf543('0xf')](_0x2fbb38,_0x37cfd3)[_0xf543('0x10')](function(_0xbf19e0){logger[_0xf543('0x11')](_0xf543('0x12'),_0x1e4bf3,_0xf543('0x13'));logger[_0xf543('0x14')](_0xf543('0x15'),_0x1e4bf3,_0xf543('0x13'),JSON[_0xf543('0x16')](_0xbf19e0));if(_0xbf19e0[_0xf543('0x17')]){if(_0xbf19e0[_0xf543('0x17')]['code']===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x1e4bf3,_0xbf19e0[_0xf543('0x17')][_0xf543('0x18')]);return _0x482d2e(_0xbf19e0['error']['message']);}logger['error'](_0xf543('0x12'),_0x1e4bf3,_0xbf19e0[_0xf543('0x17')][_0xf543('0x18')]);return _0xce6ca0(_0xbf19e0[_0xf543('0x17')]['message']);}else{logger[_0xf543('0x11')](_0xf543('0x12'),_0x1e4bf3,_0xf543('0x13'));_0xce6ca0(_0xbf19e0['result'][_0xf543('0x18')]);}})[_0xf543('0x19')](function(_0x2485da){logger[_0xf543('0x17')](_0xf543('0x12'),_0x1e4bf3,_0x2485da);_0x482d2e(_0x2485da);});});}exports[_0xf543('0x1a')]=function(_0x4c4246){var _0x1a6493=this;return new Promise(function(_0x5a2c39,_0x9c7c8e){return db['FaxAccount'][_0xf543('0x1b')]({'raw':_0x4c4246['options']?_0x4c4246[_0xf543('0x1c')][_0xf543('0x1d')]===undefined?!![]:![]:!![],'where':_0x4c4246[_0xf543('0x1c')]?_0x4c4246[_0xf543('0x1c')][_0xf543('0x1e')]||null:null,'attributes':_0x4c4246['options']?_0x4c4246[_0xf543('0x1c')][_0xf543('0x1f')]||null:null,'limit':_0x4c4246[_0xf543('0x1c')]?_0x4c4246['options'][_0xf543('0x20')]||null:null,'include':_0x4c4246[_0xf543('0x1c')]?_0x4c4246[_0xf543('0x1c')]['include']?_[_0xf543('0x21')](_0x4c4246['options'][_0xf543('0x22')],function(_0x1839de){return{'model':db[_0x1839de[_0xf543('0x23')]],'as':_0x1839de['as'],'attributes':_0x1839de['attributes'],'include':_0x1839de[_0xf543('0x22')]?_[_0xf543('0x21')](_0x1839de[_0xf543('0x22')],function(_0x58bc8b){return{'model':db[_0x58bc8b[_0xf543('0x23')]],'as':_0x58bc8b['as'],'attributes':_0x58bc8b[_0xf543('0x1f')],'include':_0x58bc8b['include']?_['map'](_0x58bc8b['include'],function(_0x10a946){return{'model':db[_0x10a946[_0xf543('0x23')]],'as':_0x10a946['as'],'attributes':_0x10a946[_0xf543('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x171cce){logger[_0xf543('0x11')](_0xf543('0x1a'),_0x4c4246);logger[_0xf543('0x14')](_0xf543('0x1a'),_0x4c4246,JSON[_0xf543('0x16')](_0x171cce));_0x5a2c39(_0x171cce);})[_0xf543('0x19')](function(_0x3d7290){logger[_0xf543('0x17')](_0xf543('0x1a'),_0x3d7290[_0xf543('0x18')],_0x4c4246);_0x9c7c8e(_0x1a6493[_0xf543('0x17')](0x1f4,_0x3d7290['message']));});});};exports[_0xf543('0x24')]=function(_0x4025e5,_0x43bc98,_0x27bfee){var _0x275e44=this;return new Promise(function(_0xca775c,_0x12a103){var _0x436b2b={'body':_0x4025e5['body'],'channel':_0xf543('0x25')};var _0x3ddbe8=[];var _0x275190=[];var _0x3a8f72={};return db[_0xf543('0x26')][_0xf543('0x27')]()[_0xf543('0x10')](function(_0x103423){if(!_0x103423){throw new db[(_0xf543('0x28'))][(_0xf543('0x29'))](_0xf543('0x2a'));}_0x3ddbe8=_['difference'](_[_0xf543('0x2b')](_0x103423),[_0xf543('0x2c'),'updatedAt']);_0x275190=_[_0xf543('0x2d')](_[_0xf543('0x2b')](_0x103423),[_0xf543('0x2c'),_0xf543('0x2e'),_0xf543('0x2f'),'ListId']);if(_0x4025e5[_0xf543('0x30')]['id']){delete _0x4025e5[_0xf543('0x30')]['id'];}if(_['isNil'](_0x4025e5['body'][_0xf543('0x31')])){throw new db['Sequelize'][(_0xf543('0x29'))]('from\x20is\x20mandatory');}if(_[_0xf543('0x32')](_0x4025e5[_0xf543('0x30')][_0xf543('0x30')])||_0x4025e5[_0xf543('0x30')][_0xf543('0x30')]===''){throw new db[(_0xf543('0x28'))]['ValidationError'](_0xf543('0x33'));}if(_[_0xf543('0x32')](_0x4025e5[_0xf543('0x30')]['mapKey'])){throw new db[(_0xf543('0x28'))][(_0xf543('0x29'))](_0xf543('0x34')+_0x275190);}if(!_[_0xf543('0x35')](_0x275190,_0x4025e5[_0xf543('0x30')]['mapKey'])){throw new db[(_0xf543('0x28'))][(_0xf543('0x29'))](_0xf543('0x36')+_0x275190);}_0x3a8f72[_0x4025e5['body'][_0xf543('0x37')]]=_0x4025e5['body'][_0xf543('0x31')];})[_0xf543('0x10')](function(){return db[_0xf543('0x38')][_0xf543('0x39')]({'where':{'id':_0x4025e5[_0xf543('0x3a')]['id']},'include':[{'model':db[_0xf543('0x3b')],'as':_0xf543('0x3c'),'include':[{'model':db[_0xf543('0x26')],'as':_0xf543('0x3d'),'where':_0x3a8f72,'limit':0x1,'order':[[_0xf543('0x2e'),_0xf543('0x3e')]]}]},{'model':db['FaxApplication'],'as':_0xf543('0x3f')}]});})[_0xf543('0x10')](function(_0x486492){if(_0x486492&&_0x486492[_0xf543('0x3c')]){var _0x46703f=_0x486492[_0xf543('0x40')]({'plain':!![]});_0x436b2b[_0xf543('0x3a')]=_0x46703f;_0x436b2b[_0xf543('0x41')]=_0x46703f[_0xf543('0x3f')];_0x436b2b['list']=_0x46703f['List'];_0x436b2b[_0xf543('0x41')]=_[_0xf543('0x42')](_0x436b2b['applications'],[_0xf543('0x43')],[_0xf543('0x44')]);if(_0x436b2b[_0xf543('0x3a')][_0xf543('0x3f')]){delete _0x436b2b[_0xf543('0x3a')][_0xf543('0x3f')];}if(_0x436b2b[_0xf543('0x3a')][_0xf543('0x3c')]&&_0x436b2b[_0xf543('0x3a')][_0xf543('0x3c')][_0xf543('0x3d')][_0xf543('0x45')]){return _0x436b2b[_0xf543('0x3a')][_0xf543('0x3c')][_0xf543('0x3d')][0x0];}var _0x53c0bb=_[_0xf543('0xc')](_0x4025e5['body'],{'firstName':_0x4025e5[_0xf543('0x30')][_0xf543('0x31')],'ListId':_0x46703f[_0xf543('0x46')]});_0x53c0bb[_0x4025e5[_0xf543('0x30')]['mapKey']]=_0x4025e5[_0xf543('0x30')][_0xf543('0x31')];return db[_0xf543('0x26')][_0xf543('0x47')](_0x53c0bb,{'fields':_0x3ddbe8,'raw':!![]});}})[_0xf543('0x10')](function(_0x29cf91){_0x436b2b['contact']=_0x29cf91;if(_0x29cf91){var _0x23c215={'ContactId':_0x29cf91['id'],'FaxAccountId':_0x4025e5[_0xf543('0x3a')]['id'],'fax':_0x29cf91[_0xf543('0x25')]};return db[_0xf543('0x48')]['find']({'where':{'ContactId':_0x29cf91['id'],'closed':![],'FaxAccountId':_0x4025e5[_0xf543('0x3a')]['id']}})[_0xf543('0x10')](function(_0xc1bc23){if(_0xc1bc23){return[_0xc1bc23,![]];}return db['FaxInteraction'][_0xf543('0x47')](_0x23c215)[_0xf543('0x10')](function(_0x468a73){return[_0x468a73,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xf543('0x49')](function(_0x165932,_0x20f92e){var _0x21a299=_0x165932[_0xf543('0x40')]({'plain':!![]});if(_0x20f92e){if(_0x436b2b[_0xf543('0x3a')][_0xf543('0x4a')]){_0x436b2b[_0xf543('0x41')][_0xf543('0x4b')]({'id':0x0,'priority':_0x436b2b[_0xf543('0x41')]['length']+0x1,'app':_0xf543('0x4c'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x21a299['created']=!![];}else{_0x21a299['created']=![];}_0x436b2b['interaction']=_0x21a299;return db[_0xf543('0x4d')][_0xf543('0x47')]({'body':_0x4025e5[_0xf543('0x30')][_0xf543('0x30')],'FaxAccountId':_0x4025e5['account']['id'],'FaxInteractionId':_0x165932['id'],'direction':'in','ContactId':_0x165932[_0xf543('0x4e')],'AttachmentId':_0x4025e5['body']['AttachmentId']});})['then'](function(_0x52ecaf){_0x436b2b['message']=_0x52ecaf;if(!_0x436b2b[_0xf543('0x4f')][_0xf543('0x50')])return;return db[_0xf543('0x51')][_0xf543('0x39')]({'attributes':['id',_0xf543('0x52')],'where':{'id':_0x436b2b['interaction']['UserId']}});})['then'](function(_0x49f548){if(_0x49f548){_0x436b2b[_0xf543('0x41')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x49f548[_0xf543('0x52')]+','+(_0x436b2b[_0xf543('0x3a')][_0xf543('0x53')]||0xa),'interval':_0xf543('0x54')});}if(!_0x436b2b[_0xf543('0x4f')]['queueId'])return;return db['FaxQueue'][_0xf543('0x39')]({'attributes':['id',_0xf543('0x52')],'where':{'id':_0x436b2b[_0xf543('0x4f')][_0xf543('0x55')]}});})[_0xf543('0x10')](function(_0x4df651){if(_0x4df651){_0x436b2b[_0xf543('0x41')][_0xf543('0x56')]({'id':0x0,'priority':0x1,'app':_0xf543('0x57'),'appdata':_0x4df651[_0xf543('0x52')]+','+(_0x436b2b[_0xf543('0x3a')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xf543('0x58'),'startRouting',_0x436b2b);})[_0xf543('0x10')](function(_0x260b10){_0xca775c(_0x260b10);})[_0xf543('0x19')](function(_0x612957){_0x12a103(_0x275e44[_0xf543('0x17')](0x1f4,_0x612957['message']));});});}; \ No newline at end of file +var _0xca6c=['CmList','List','Contacts','DESC','FaxApplication','Applications','applications','list','orderBy','priority','contact','create','Contact\x20not\x20found','spread','get','autoclose','close','unmanaged','*,*,*,*','created','interaction','ContactId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','./faxAccount.socket','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','GetFaxAccount','FaxAccount','findAll','options','where','attributes','limit','map','include','model','then','stringify','NotifyFaxAccount','body','fax','CmContact','describe','no\x20available\x20attributes','keys','createdAt','updatedAt','CompanyId','isNil','from','Sequelize','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find','account'];(function(_0x2c7f1e,_0x11ca53){var _0x5027fa=function(_0x5d9753){while(--_0x5d9753){_0x2c7f1e['push'](_0x2c7f1e['shift']());}};_0x5027fa(++_0x11ca53);}(_0xca6c,0x126));var _0xcca6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xca6c[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xcca6('0x0'));var util=require(_0xcca6('0x1'));var moment=require('moment');var BPromise=require(_0xcca6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcca6('0x3'));var db=require(_0xcca6('0x4'))['db'];var utils=require(_0xcca6('0x5'));var logger=require(_0xcca6('0x6'))(_0xcca6('0x7'));var config=require(_0xcca6('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcca6('0x9')]({'port':0x232c});config[_0xcca6('0xa')]=_[_0xcca6('0xb')](config[_0xcca6('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcca6('0xa')]));require(_0xcca6('0xc'))['register'](socket);function respondWithRpcPromise(_0x5b92f8,_0xe59d3f,_0x28a5eb){return new BPromise(function(_0x526506,_0x4ee231){return client[_0xcca6('0xd')](_0x5b92f8,_0x28a5eb)['then'](function(_0x11d6a8){logger[_0xcca6('0xe')](_0xcca6('0xf'),_0xe59d3f,_0xcca6('0x10'));logger[_0xcca6('0x11')](_0xcca6('0x12'),_0xe59d3f,_0xcca6('0x10'),JSON['stringify'](_0x11d6a8));if(_0x11d6a8[_0xcca6('0x13')]){if(_0x11d6a8[_0xcca6('0x13')][_0xcca6('0x14')]===0x1f4){logger[_0xcca6('0x13')](_0xcca6('0xf'),_0xe59d3f,_0x11d6a8[_0xcca6('0x13')][_0xcca6('0x15')]);return _0x4ee231(_0x11d6a8[_0xcca6('0x13')][_0xcca6('0x15')]);}logger['error'](_0xcca6('0xf'),_0xe59d3f,_0x11d6a8[_0xcca6('0x13')][_0xcca6('0x15')]);return _0x526506(_0x11d6a8[_0xcca6('0x13')][_0xcca6('0x15')]);}else{logger['info'](_0xcca6('0xf'),_0xe59d3f,_0xcca6('0x10'));_0x526506(_0x11d6a8['result'][_0xcca6('0x15')]);}})['catch'](function(_0xcf8f9a){logger[_0xcca6('0x13')]('FaxAccount,\x20%s,\x20%s',_0xe59d3f,_0xcf8f9a);_0x4ee231(_0xcf8f9a);});});}exports[_0xcca6('0x16')]=function(_0x285491){var _0x5ade3e=this;return new Promise(function(_0x45e483,_0x181a99){return db[_0xcca6('0x17')][_0xcca6('0x18')]({'raw':_0x285491[_0xcca6('0x19')]?_0x285491[_0xcca6('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x285491[_0xcca6('0x19')]?_0x285491[_0xcca6('0x19')][_0xcca6('0x1a')]||null:null,'attributes':_0x285491[_0xcca6('0x19')]?_0x285491[_0xcca6('0x19')][_0xcca6('0x1b')]||null:null,'limit':_0x285491[_0xcca6('0x19')]?_0x285491[_0xcca6('0x19')][_0xcca6('0x1c')]||null:null,'include':_0x285491[_0xcca6('0x19')]?_0x285491['options']['include']?_[_0xcca6('0x1d')](_0x285491[_0xcca6('0x19')][_0xcca6('0x1e')],function(_0xbaa277){return{'model':db[_0xbaa277[_0xcca6('0x1f')]],'as':_0xbaa277['as'],'attributes':_0xbaa277[_0xcca6('0x1b')],'include':_0xbaa277['include']?_[_0xcca6('0x1d')](_0xbaa277['include'],function(_0x47672e){return{'model':db[_0x47672e[_0xcca6('0x1f')]],'as':_0x47672e['as'],'attributes':_0x47672e[_0xcca6('0x1b')],'include':_0x47672e[_0xcca6('0x1e')]?_[_0xcca6('0x1d')](_0x47672e[_0xcca6('0x1e')],function(_0x149fc3){return{'model':db[_0x149fc3[_0xcca6('0x1f')]],'as':_0x149fc3['as'],'attributes':_0x149fc3['attributes']};}):[]};}):[]};}):[]:[]})[_0xcca6('0x20')](function(_0x4bcd74){logger[_0xcca6('0xe')](_0xcca6('0x16'),_0x285491);logger[_0xcca6('0x11')](_0xcca6('0x16'),_0x285491,JSON[_0xcca6('0x21')](_0x4bcd74));_0x45e483(_0x4bcd74);})['catch'](function(_0x185404){logger[_0xcca6('0x13')](_0xcca6('0x16'),_0x185404['message'],_0x285491);_0x181a99(_0x5ade3e[_0xcca6('0x13')](0x1f4,_0x185404[_0xcca6('0x15')]));});});};exports[_0xcca6('0x22')]=function(_0xd2a990,_0x1cc795,_0x28e361){var _0x352831=this;return new Promise(function(_0x3d9033,_0x19b4b9){var _0x16309c={'body':_0xd2a990[_0xcca6('0x23')],'channel':_0xcca6('0x24')};var _0x1d1bff=[];var _0x591d6b=[];var _0xdebc6d={};return db[_0xcca6('0x25')][_0xcca6('0x26')]()[_0xcca6('0x20')](function(_0x590371){if(!_0x590371){throw new db['Sequelize']['ValidationError'](_0xcca6('0x27'));}_0x1d1bff=_['difference'](_[_0xcca6('0x28')](_0x590371),[_0xcca6('0x29'),_0xcca6('0x2a')]);_0x591d6b=_['difference'](_[_0xcca6('0x28')](_0x590371),[_0xcca6('0x29'),_0xcca6('0x2a'),_0xcca6('0x2b'),'ListId']);if(_0xd2a990['body']['id']){delete _0xd2a990[_0xcca6('0x23')]['id'];}if(_[_0xcca6('0x2c')](_0xd2a990[_0xcca6('0x23')][_0xcca6('0x2d')])){throw new db[(_0xcca6('0x2e'))][(_0xcca6('0x2f'))](_0xcca6('0x30'));}if(_['isNil'](_0xd2a990[_0xcca6('0x23')][_0xcca6('0x23')])||_0xd2a990[_0xcca6('0x23')]['body']===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0xd2a990[_0xcca6('0x23')][_0xcca6('0x31')])){throw new db['Sequelize']['ValidationError'](_0xcca6('0x32')+_0x591d6b);}if(!_[_0xcca6('0x33')](_0x591d6b,_0xd2a990[_0xcca6('0x23')][_0xcca6('0x31')])){throw new db[(_0xcca6('0x2e'))][(_0xcca6('0x2f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x591d6b);}_0xdebc6d[_0xd2a990[_0xcca6('0x23')]['mapKey']]=_0xd2a990[_0xcca6('0x23')][_0xcca6('0x2d')];})['then'](function(){return db[_0xcca6('0x17')][_0xcca6('0x34')]({'where':{'id':_0xd2a990[_0xcca6('0x35')]['id']},'include':[{'model':db[_0xcca6('0x36')],'as':_0xcca6('0x37'),'include':[{'model':db[_0xcca6('0x25')],'as':_0xcca6('0x38'),'where':_0xdebc6d,'limit':0x1,'order':[[_0xcca6('0x2a'),_0xcca6('0x39')]]}]},{'model':db[_0xcca6('0x3a')],'as':_0xcca6('0x3b')}]});})['then'](function(_0x515901){if(_0x515901&&_0x515901[_0xcca6('0x37')]){var _0x364318=_0x515901['get']({'plain':!![]});_0x16309c['account']=_0x364318;_0x16309c[_0xcca6('0x3c')]=_0x364318['Applications'];_0x16309c[_0xcca6('0x3d')]=_0x364318[_0xcca6('0x37')];_0x16309c[_0xcca6('0x3c')]=_[_0xcca6('0x3e')](_0x16309c['applications'],[_0xcca6('0x3f')],['asc']);if(_0x16309c[_0xcca6('0x35')][_0xcca6('0x3b')]){delete _0x16309c[_0xcca6('0x35')][_0xcca6('0x3b')];}if(_0x16309c['account'][_0xcca6('0x37')]&&_0x16309c[_0xcca6('0x35')]['List'][_0xcca6('0x38')]['length']){return _0x16309c[_0xcca6('0x35')]['List'][_0xcca6('0x38')][0x0];}var _0x5aa046=_['defaults'](_0xd2a990[_0xcca6('0x23')],{'firstName':_0xd2a990[_0xcca6('0x23')][_0xcca6('0x2d')],'ListId':_0x364318['ListId']});_0x5aa046[_0xd2a990['body'][_0xcca6('0x31')]]=_0xd2a990[_0xcca6('0x23')][_0xcca6('0x2d')];return db['CmContact']['create'](_0x5aa046,{'fields':_0x1d1bff,'raw':!![]});}})[_0xcca6('0x20')](function(_0x7423ac){_0x16309c[_0xcca6('0x40')]=_0x7423ac;if(_0x7423ac){var _0x791aca={'ContactId':_0x7423ac['id'],'FaxAccountId':_0xd2a990[_0xcca6('0x35')]['id'],'fax':_0x7423ac[_0xcca6('0x24')]};return db['FaxInteraction'][_0xcca6('0x34')]({'where':{'ContactId':_0x7423ac['id'],'closed':![],'FaxAccountId':_0xd2a990['account']['id']}})[_0xcca6('0x20')](function(_0x523361){if(_0x523361){return[_0x523361,![]];}return db['FaxInteraction'][_0xcca6('0x41')](_0x791aca)[_0xcca6('0x20')](function(_0x21464e){return[_0x21464e,!![]];});});}else{throw new Error(_0xcca6('0x42'));}})[_0xcca6('0x43')](function(_0xae5b06,_0x3a976c){var _0x1c4a8f=_0xae5b06[_0xcca6('0x44')]({'plain':!![]});if(_0x3a976c){if(_0x16309c[_0xcca6('0x35')][_0xcca6('0x45')]){_0x16309c[_0xcca6('0x3c')]['push']({'id':0x0,'priority':_0x16309c[_0xcca6('0x3c')]['length']+0x1,'app':_0xcca6('0x46'),'appdata':_0xcca6('0x47'),'interval':_0xcca6('0x48')});}_0x1c4a8f['created']=!![];}else{_0x1c4a8f[_0xcca6('0x49')]=![];}_0x16309c[_0xcca6('0x4a')]=_0x1c4a8f;return db['FaxMessage'][_0xcca6('0x41')]({'body':_0xd2a990[_0xcca6('0x23')][_0xcca6('0x23')],'FaxAccountId':_0xd2a990[_0xcca6('0x35')]['id'],'FaxInteractionId':_0xae5b06['id'],'direction':'in','ContactId':_0xae5b06[_0xcca6('0x4b')],'AttachmentId':_0xd2a990[_0xcca6('0x23')]['AttachmentId']});})['then'](function(_0x15a85b){_0x16309c['message']=_0x15a85b;if(!_0x16309c[_0xcca6('0x4a')][_0xcca6('0x4c')])return;return db[_0xcca6('0x4d')]['find']({'attributes':['id',_0xcca6('0x4e')],'where':{'id':_0x16309c[_0xcca6('0x4a')][_0xcca6('0x4c')]}});})[_0xcca6('0x20')](function(_0x26c7cd){if(_0x26c7cd){_0x16309c[_0xcca6('0x3c')][_0xcca6('0x4f')]({'id':0x0,'priority':0x0,'app':_0xcca6('0x50'),'appdata':_0x26c7cd['name']+','+(_0x16309c[_0xcca6('0x35')][_0xcca6('0x51')]||0xa),'interval':_0xcca6('0x48')});}if(!_0x16309c[_0xcca6('0x4a')]['queueId'])return;return db['FaxQueue']['find']({'attributes':['id',_0xcca6('0x4e')],'where':{'id':_0x16309c['interaction'][_0xcca6('0x52')]}});})[_0xcca6('0x20')](function(_0x2e6da8){if(_0x2e6da8){_0x16309c[_0xcca6('0x3c')]['unshift']({'id':0x0,'priority':0x1,'app':_0xcca6('0x53'),'appdata':_0x2e6da8['name']+','+(_0x16309c['account'][_0xcca6('0x54')]||0x12c),'interval':_0xcca6('0x48')});}return respondWithRpcPromise(_0xcca6('0x55'),'startRouting',_0x16309c);})[_0xcca6('0x20')](function(_0x58c40f){_0x3d9033(_0x58c40f);})[_0xcca6('0x56')](function(_0x106d33){_0x19b4b9(_0x352831[_0xcca6('0x13')](0x1f4,_0x106d33['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 4de3eb3..8a6d520 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 _0xa6fd=['length','faxAccount:','./faxAccount.events','save','remove','emit','removeListener','register'];(function(_0x1ccf21,_0x1a3963){var _0x456815=function(_0x3feeb0){while(--_0x3feeb0){_0x1ccf21['push'](_0x1ccf21['shift']());}};_0x456815(++_0x1a3963);}(_0xa6fd,0xd2));var _0xda6f=function(_0xa990b7,_0x26c527){_0xa990b7=_0xa990b7-0x0;var _0x52c99c=_0xa6fd[_0xa990b7];return _0x52c99c;};'use strict';var FaxAccountEvents=require(_0xda6f('0x0'));var events=[_0xda6f('0x1'),_0xda6f('0x2'),'update'];function createListener(_0x2ec806,_0xf49c08){return function(_0x3fddd0){_0xf49c08[_0xda6f('0x3')](_0x2ec806,_0x3fddd0);};}function removeListener(_0x13cee2,_0x2f20aa){return function(){FaxAccountEvents[_0xda6f('0x4')](_0x13cee2,_0x2f20aa);};}exports[_0xda6f('0x5')]=function(_0x266b52){for(var _0x1de9b1=0x0,_0x1199d3=events[_0xda6f('0x6')];_0x1de9b1<_0x1199d3;_0x1de9b1++){var _0x5dc0b4=events[_0x1de9b1];var _0x222a1e=createListener(_0xda6f('0x7')+_0x5dc0b4,_0x266b52);FaxAccountEvents['on'](_0x5dc0b4,_0x222a1e);}}; \ No newline at end of file +var _0xc986=['save','remove','update','emit','removeListener','register','faxAccount:','./faxAccount.events'];(function(_0x4a88f1,_0x253162){var _0x422677=function(_0x22c5fa){while(--_0x22c5fa){_0x4a88f1['push'](_0x4a88f1['shift']());}};_0x422677(++_0x253162);}(_0xc986,0x6f));var _0x6c98=function(_0x2d4a07,_0x2e1f4d){_0x2d4a07=_0x2d4a07-0x0;var _0x43f637=_0xc986[_0x2d4a07];return _0x43f637;};'use strict';var FaxAccountEvents=require(_0x6c98('0x0'));var events=[_0x6c98('0x1'),_0x6c98('0x2'),_0x6c98('0x3')];function createListener(_0x2ecbcf,_0x12a707){return function(_0x4b162f){_0x12a707[_0x6c98('0x4')](_0x2ecbcf,_0x4b162f);};}function removeListener(_0x2df507,_0x54d832){return function(){FaxAccountEvents[_0x6c98('0x5')](_0x2df507,_0x54d832);};}exports[_0x6c98('0x6')]=function(_0x29ad28){for(var _0x55ef4a=0x0,_0x4197aa=events['length'];_0x55ef4a<_0x4197aa;_0x55ef4a++){var _0xc04aa7=events[_0x55ef4a];var _0x452af7=createListener(_0x6c98('0x7')+_0xc04aa7,_0x29ad28);FaxAccountEvents['on'](_0xc04aa7,_0x452af7);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index f4857a6..8d4afb3 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 _0xf119=['connect-timeout','Router','../../components/auth/service','../../config/environment','./faxAccount.controller','isAuthenticated','index','get','/describe','show','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','updateAccountApplications','/:id/send','addAgents','put','update','/:id','destroy','delete','removeDispositions','removeAnswers','exports','multer','util','path'];(function(_0x3da707,_0x30c36d){var _0x342ee7=function(_0x175135){while(--_0x175135){_0x3da707['push'](_0x3da707['shift']());}};_0x342ee7(++_0x30c36d);}(_0xf119,0x1de));var _0x9f11=function(_0x34c872,_0x42844e){_0x34c872=_0x34c872-0x0;var _0x10a5b5=_0xf119[_0x34c872];return _0x10a5b5;};'use strict';var multer=require(_0x9f11('0x0'));var util=require(_0x9f11('0x1'));var path=require(_0x9f11('0x2'));var timeout=require(_0x9f11('0x3'));var express=require('express');var router=express[_0x9f11('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9f11('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9f11('0x6'));var controller=require(_0x9f11('0x7'));router['get']('/',auth[_0x9f11('0x8')](),controller[_0x9f11('0x9')]);router[_0x9f11('0xa')](_0x9f11('0xb'),auth[_0x9f11('0x8')](),controller['describe']);router[_0x9f11('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x9f11('0xc')]);router['get']('/:id/dispositions',auth[_0x9f11('0x8')](),controller[_0x9f11('0xd')]);router[_0x9f11('0xa')](_0x9f11('0xe'),auth[_0x9f11('0x8')](),controller[_0x9f11('0xf')]);router['get'](_0x9f11('0x10'),auth[_0x9f11('0x8')](),controller['getInteractions']);router['get'](_0x9f11('0x11'),auth[_0x9f11('0x8')](),controller['getApplications']);router[_0x9f11('0xa')](_0x9f11('0x12'),auth[_0x9f11('0x8')](),controller[_0x9f11('0x13')]);router[_0x9f11('0xa')](_0x9f11('0x14'),auth['isAuthenticated'](),controller[_0x9f11('0x15')]);router[_0x9f11('0x16')]('/',auth['isAuthenticated'](),controller[_0x9f11('0x17')]);router[_0x9f11('0x16')]('/:id/dispositions',auth[_0x9f11('0x8')](),controller[_0x9f11('0x18')]);router[_0x9f11('0x16')](_0x9f11('0xe'),auth[_0x9f11('0x8')](),controller[_0x9f11('0x19')]);router[_0x9f11('0x16')](_0x9f11('0x10'),auth[_0x9f11('0x8')](),controller['addInteraction']);router[_0x9f11('0x16')](_0x9f11('0x11'),auth[_0x9f11('0x8')](),controller['addApplications']);router['post']('/addaccountapplications',auth['isAuthenticated'](),controller['addAccountApplications']);router[_0x9f11('0x16')]('/updateaccountapplications',auth[_0x9f11('0x8')](),controller[_0x9f11('0x1a')]);router[_0x9f11('0x16')](_0x9f11('0x1b'),auth[_0x9f11('0x8')](),controller['send']);router[_0x9f11('0x16')](_0x9f11('0x14'),auth[_0x9f11('0x8')](),controller[_0x9f11('0x1c')]);router[_0x9f11('0x1d')]('/:id',auth[_0x9f11('0x8')](),controller[_0x9f11('0x1e')]);router['delete'](_0x9f11('0x1f'),auth['isAuthenticated'](),controller[_0x9f11('0x20')]);router[_0x9f11('0x21')]('/:id/dispositions',auth[_0x9f11('0x8')](),controller[_0x9f11('0x22')]);router['delete'](_0x9f11('0xe'),auth[_0x9f11('0x8')](),controller[_0x9f11('0x23')]);router['delete'](_0x9f11('0x14'),auth[_0x9f11('0x8')](),controller['removeAgents']);module[_0x9f11('0x24')]=router; \ No newline at end of file +var _0x54d2=['Router','../../components/auth/service','get','isAuthenticated','index','/:id','show','getDispositions','/:id/canned_answers','getInteractions','/:id/messages','getMessages','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','/:id/interactions','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','/:id/users','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','path','connect-timeout','express'];(function(_0x242390,_0x5c4166){var _0x2c9a46=function(_0x39d6ca){while(--_0x39d6ca){_0x242390['push'](_0x242390['shift']());}};_0x2c9a46(++_0x5c4166);}(_0x54d2,0x16f));var _0x254d=function(_0x465555,_0x135159){_0x465555=_0x465555-0x0;var _0x3eaf27=_0x54d2[_0x465555];return _0x3eaf27;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x254d('0x0'));var timeout=require(_0x254d('0x1'));var express=require(_0x254d('0x2'));var router=express[_0x254d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x254d('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxAccount.controller');router[_0x254d('0x5')]('/',auth[_0x254d('0x6')](),controller[_0x254d('0x7')]);router[_0x254d('0x5')]('/describe',auth[_0x254d('0x6')](),controller['describe']);router['get'](_0x254d('0x8'),auth[_0x254d('0x6')](),controller[_0x254d('0x9')]);router[_0x254d('0x5')]('/:id/dispositions',auth[_0x254d('0x6')](),controller[_0x254d('0xa')]);router[_0x254d('0x5')](_0x254d('0xb'),auth[_0x254d('0x6')](),controller['getAnswers']);router[_0x254d('0x5')]('/:id/interactions',auth[_0x254d('0x6')](),controller[_0x254d('0xc')]);router[_0x254d('0x5')]('/:id/applications',auth[_0x254d('0x6')](),controller['getApplications']);router[_0x254d('0x5')](_0x254d('0xd'),auth['isAuthenticated'](),controller[_0x254d('0xe')]);router['get']('/:id/users',auth[_0x254d('0x6')](),controller[_0x254d('0xf')]);router[_0x254d('0x10')]('/',auth[_0x254d('0x6')](),controller[_0x254d('0x11')]);router[_0x254d('0x10')](_0x254d('0x12'),auth['isAuthenticated'](),controller[_0x254d('0x13')]);router[_0x254d('0x10')](_0x254d('0xb'),auth[_0x254d('0x6')](),controller[_0x254d('0x14')]);router[_0x254d('0x10')](_0x254d('0x15'),auth[_0x254d('0x6')](),controller[_0x254d('0x16')]);router[_0x254d('0x10')]('/:id/applications',auth[_0x254d('0x6')](),controller[_0x254d('0x17')]);router[_0x254d('0x10')](_0x254d('0x18'),auth[_0x254d('0x6')](),controller[_0x254d('0x19')]);router[_0x254d('0x10')](_0x254d('0x1a'),auth[_0x254d('0x6')](),controller[_0x254d('0x1b')]);router[_0x254d('0x10')](_0x254d('0x1c'),auth[_0x254d('0x6')](),controller['send']);router[_0x254d('0x10')](_0x254d('0x1d'),auth[_0x254d('0x6')](),controller['addAgents']);router[_0x254d('0x1e')](_0x254d('0x8'),auth[_0x254d('0x6')](),controller['update']);router[_0x254d('0x1f')](_0x254d('0x8'),auth['isAuthenticated'](),controller[_0x254d('0x20')]);router['delete'](_0x254d('0x12'),auth[_0x254d('0x6')](),controller[_0x254d('0x21')]);router[_0x254d('0x1f')]('/:id/canned_answers',auth[_0x254d('0x6')](),controller[_0x254d('0x22')]);router['delete'](_0x254d('0x1d'),auth[_0x254d('0x6')](),controller[_0x254d('0x23')]);module[_0x254d('0x24')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index fff42bd..c140500 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 _0x9d83=['STRING','noop','sequelize','exports','INTEGER'];(function(_0x16920a,_0x509068){var _0x421782=function(_0x52dcdb){while(--_0x52dcdb){_0x16920a['push'](_0x16920a['shift']());}};_0x421782(++_0x509068);}(_0x9d83,0xf7));var _0x39d8=function(_0x524e23,_0x1e2aa7){_0x524e23=_0x524e23-0x0;var _0x231413=_0x9d83[_0x524e23];return _0x231413;};'use strict';var Sequelize=require(_0x39d8('0x0'));module[_0x39d8('0x1')]={'priority':{'type':Sequelize[_0x39d8('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x39d8('0x3')],'allowNull':![],'defaultValue':_0x39d8('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x39d8('0x3')]},'interval':{'type':Sequelize[_0x39d8('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xa457=['TEXT','exports','INTEGER','STRING','noop'];(function(_0x570ef2,_0x5c0e34){var _0x4b6fb3=function(_0x5dde9f){while(--_0x5dde9f){_0x570ef2['push'](_0x570ef2['shift']());}};_0x4b6fb3(++_0x5c0e34);}(_0xa457,0x1eb));var _0x7a45=function(_0x27539d,_0x10b197){_0x27539d=_0x27539d-0x0;var _0x38e34e=_0xa457[_0x27539d];return _0x38e34e;};'use strict';var Sequelize=require('sequelize');module[_0x7a45('0x0')]={'priority':{'type':Sequelize[_0x7a45('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x7a45('0x2')],'allowNull':![],'defaultValue':_0x7a45('0x3')},'appdata':{'type':Sequelize[_0x7a45('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7a45('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 758a8c5..20c257e 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 _0xffe5=['offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','FaxApplication','rawAttributes','type','key','model','query','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','keys','find','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x42bafd,_0x3f0fe3){var _0x2ed705=function(_0x4311ea){while(--_0x4311ea){_0x42bafd['push'](_0x42bafd['shift']());}};_0x2ed705(++_0x3f0fe3);}(_0xffe5,0xbe));var _0x5ffe=function(_0x5ed0c5,_0xc21d27){_0x5ed0c5=_0x5ed0c5-0x0;var _0x2b8b5f=_0xffe5[_0x5ed0c5];return _0x2b8b5f;};'use strict';var emlformat=require(_0x5ffe('0x0'));var rimraf=require(_0x5ffe('0x1'));var zipdir=require(_0x5ffe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5ffe('0x3'));var moment=require(_0x5ffe('0x4'));var BPromise=require(_0x5ffe('0x5'));var Mustache=require(_0x5ffe('0x6'));var util=require(_0x5ffe('0x7'));var path=require(_0x5ffe('0x8'));var sox=require(_0x5ffe('0x9'));var csv=require('to-csv');var ejs=require(_0x5ffe('0xa'));var fs=require('fs');var fs_extra=require(_0x5ffe('0xb'));var _=require(_0x5ffe('0xc'));var squel=require(_0x5ffe('0xd'));var crypto=require(_0x5ffe('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5ffe('0xf'));var toCsv=require(_0x5ffe('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5ffe('0x11'));var qs=require(_0x5ffe('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ffe('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x5ffe('0x14'));var licenseUtil=require(_0x5ffe('0x15'));var db=require(_0x5ffe('0x16'))['db'];function respondWithStatusCode(_0x2dfacc,_0x35664f){_0x35664f=_0x35664f||0xcc;return function(_0x2368ac){if(_0x2368ac){return _0x2dfacc[_0x5ffe('0x17')](_0x35664f);}return _0x2dfacc[_0x5ffe('0x18')](_0x35664f)[_0x5ffe('0x19')]();};}function respondWithResult(_0x6112ff,_0x274c18){_0x274c18=_0x274c18||0xc8;return function(_0x54562f){if(_0x54562f){return _0x6112ff[_0x5ffe('0x18')](_0x274c18)['json'](_0x54562f);}};}function respondWithFilteredResult(_0x183030,_0x3ecfd8){return function(_0x5a090d){if(_0x5a090d){var _0x2bc3de=typeof _0x3ecfd8[_0x5ffe('0x1a')]===_0x5ffe('0x1b')&&typeof _0x3ecfd8[_0x5ffe('0x1c')]===_0x5ffe('0x1b');var _0x4ac8a1=_0x5a090d[_0x5ffe('0x1d')];var _0xc75a2f=_0x2bc3de?0x0:_0x3ecfd8[_0x5ffe('0x1a')];var _0x397b45=_0x2bc3de?_0x5a090d[_0x5ffe('0x1d')]:_0x3ecfd8['offset']+_0x3ecfd8['limit'];var _0x261c4b;if(_0x397b45>=_0x4ac8a1){_0x397b45=_0x4ac8a1;_0x261c4b=0xc8;}else{_0x261c4b=0xce;}_0x183030[_0x5ffe('0x18')](_0x261c4b);return _0x183030[_0x5ffe('0x1e')](_0x5ffe('0x1f'),_0xc75a2f+'-'+_0x397b45+'/'+_0x4ac8a1)['json'](_0x5a090d);}return null;};}function patchUpdates(_0x222551){return function(_0x29ab72){try{jsonpatch['apply'](_0x29ab72,_0x222551,!![]);}catch(_0x393884){return BPromise[_0x5ffe('0x20')](_0x393884);}return _0x29ab72[_0x5ffe('0x21')]();};}function saveUpdates(_0x5b81fe,_0x2d5151){return function(_0xc971af){if(_0xc971af){return _0xc971af[_0x5ffe('0x22')](_0x5b81fe)['then'](function(_0x192f43){return _0x192f43;});}return null;};}function removeEntity(_0xd61b02,_0x53bb21){return function(_0x2c6e3f){if(_0x2c6e3f){return _0x2c6e3f[_0x5ffe('0x23')]()[_0x5ffe('0x24')](function(){_0xd61b02[_0x5ffe('0x18')](0xcc)[_0x5ffe('0x19')]();});}};}function handleEntityNotFound(_0x43b07a,_0x526ca8){return function(_0x3f5270){if(!_0x3f5270){_0x43b07a['sendStatus'](0x194);}return _0x3f5270;};}function handleError(_0x18c979,_0x52f438){_0x52f438=_0x52f438||0x1f4;return function(_0x4e5513){logger[_0x5ffe('0x25')](_0x4e5513[_0x5ffe('0x26')]);if(_0x4e5513[_0x5ffe('0x27')]){delete _0x4e5513['name'];}_0x18c979['status'](_0x52f438)[_0x5ffe('0x28')](_0x4e5513);};}exports[_0x5ffe('0x29')]=function(_0x547581,_0x2ab982){var _0x5b7ccd={},_0x1f9180={},_0x2f6f25={'count':0x0,'rows':[]};var _0x127292=_[_0x5ffe('0x2a')](db[_0x5ffe('0x2b')][_0x5ffe('0x2c')],function(_0x23ee69){return{'name':_0x23ee69['fieldName'],'type':_0x23ee69[_0x5ffe('0x2d')][_0x5ffe('0x2e')]};});_0x1f9180[_0x5ffe('0x2f')]=_[_0x5ffe('0x2a')](_0x127292,_0x5ffe('0x27'));_0x1f9180[_0x5ffe('0x30')]=_['keys'](_0x547581[_0x5ffe('0x30')]);_0x1f9180['filters']=_[_0x5ffe('0x31')](_0x1f9180[_0x5ffe('0x2f')],_0x1f9180['query']);_0x5b7ccd['attributes']=_[_0x5ffe('0x31')](_0x1f9180['model'],qs[_0x5ffe('0x32')](_0x547581[_0x5ffe('0x30')][_0x5ffe('0x32')]));_0x5b7ccd['attributes']=_0x5b7ccd['attributes'][_0x5ffe('0x33')]?_0x5b7ccd[_0x5ffe('0x34')]:_0x1f9180[_0x5ffe('0x2f')];if(!_0x547581[_0x5ffe('0x30')][_0x5ffe('0x35')](_0x5ffe('0x36'))){_0x5b7ccd[_0x5ffe('0x1c')]=qs[_0x5ffe('0x1c')](_0x547581[_0x5ffe('0x30')]['limit']);_0x5b7ccd[_0x5ffe('0x1a')]=qs[_0x5ffe('0x1a')](_0x547581[_0x5ffe('0x30')][_0x5ffe('0x1a')]);}_0x5b7ccd[_0x5ffe('0x37')]=qs[_0x5ffe('0x38')](_0x547581[_0x5ffe('0x30')][_0x5ffe('0x38')]);_0x5b7ccd[_0x5ffe('0x39')]=qs[_0x5ffe('0x3a')](_['pick'](_0x547581[_0x5ffe('0x30')],_0x1f9180[_0x5ffe('0x3a')]),_0x127292);if(_0x547581[_0x5ffe('0x30')][_0x5ffe('0x3b')]){_0x5b7ccd[_0x5ffe('0x39')]=_[_0x5ffe('0x3c')](_0x5b7ccd['where'],{'$or':_[_0x5ffe('0x2a')](_0x127292,function(_0x5aaea8){if(_0x5aaea8[_0x5ffe('0x2d')]!==_0x5ffe('0x3d')){var _0x8c65fc={};_0x8c65fc[_0x5aaea8[_0x5ffe('0x27')]]={'$like':'%'+_0x547581[_0x5ffe('0x30')][_0x5ffe('0x3b')]+'%'};return _0x8c65fc;}})});}_0x5b7ccd=_[_0x5ffe('0x3c')]({},_0x5b7ccd,_0x547581[_0x5ffe('0x3e')]);var _0xc5dd49={'where':_0x5b7ccd[_0x5ffe('0x39')]};return db[_0x5ffe('0x2b')][_0x5ffe('0x1d')](_0xc5dd49)['then'](function(_0xcb5b97){_0x2f6f25['count']=_0xcb5b97;if(_0x547581[_0x5ffe('0x30')][_0x5ffe('0x3f')]){_0x5b7ccd[_0x5ffe('0x40')]=[{'all':!![]}];}return db['FaxApplication'][_0x5ffe('0x41')](_0x5b7ccd);})[_0x5ffe('0x24')](function(_0x4d3d59){_0x2f6f25['rows']=_0x4d3d59;return _0x2f6f25;})['then'](respondWithFilteredResult(_0x2ab982,_0x5b7ccd))[_0x5ffe('0x42')](handleError(_0x2ab982,null));};exports[_0x5ffe('0x43')]=function(_0x19c6b0,_0x215fb2){var _0x3910c8={'raw':!![],'where':{'id':_0x19c6b0['params']['id']}},_0x121576={};_0x121576[_0x5ffe('0x2f')]=_['keys'](db['FaxApplication'][_0x5ffe('0x2c')]);_0x121576['query']=_[_0x5ffe('0x44')](_0x19c6b0['query']);_0x121576[_0x5ffe('0x3a')]=_['intersection'](_0x121576[_0x5ffe('0x2f')],_0x121576[_0x5ffe('0x30')]);_0x3910c8[_0x5ffe('0x34')]=_[_0x5ffe('0x31')](_0x121576[_0x5ffe('0x2f')],qs[_0x5ffe('0x32')](_0x19c6b0[_0x5ffe('0x30')][_0x5ffe('0x32')]));_0x3910c8[_0x5ffe('0x34')]=_0x3910c8['attributes'][_0x5ffe('0x33')]?_0x3910c8[_0x5ffe('0x34')]:_0x121576[_0x5ffe('0x2f')];if(_0x19c6b0['query'][_0x5ffe('0x3f')]){_0x3910c8[_0x5ffe('0x40')]=[{'all':!![]}];}_0x3910c8=_['merge']({},_0x3910c8,_0x19c6b0[_0x5ffe('0x3e')]);return db['FaxApplication'][_0x5ffe('0x45')](_0x3910c8)[_0x5ffe('0x24')](handleEntityNotFound(_0x215fb2,null))[_0x5ffe('0x24')](respondWithResult(_0x215fb2,null))[_0x5ffe('0x42')](handleError(_0x215fb2,null));};exports['create']=function(_0x483cc9,_0x27d8f0){return db['FaxApplication']['create'](_0x483cc9[_0x5ffe('0x46')],{})[_0x5ffe('0x24')](respondWithResult(_0x27d8f0,0xc9))[_0x5ffe('0x42')](handleError(_0x27d8f0,null));};exports[_0x5ffe('0x22')]=function(_0x312d71,_0x52dcee){if(_0x312d71['body']['id']){delete _0x312d71[_0x5ffe('0x46')]['id'];}return db['FaxApplication'][_0x5ffe('0x45')]({'where':{'id':_0x312d71[_0x5ffe('0x47')]['id']}})['then'](handleEntityNotFound(_0x52dcee,null))['then'](saveUpdates(_0x312d71[_0x5ffe('0x46')],null))[_0x5ffe('0x24')](respondWithResult(_0x52dcee,null))['catch'](handleError(_0x52dcee,null));};exports[_0x5ffe('0x23')]=function(_0x5d2ec6,_0x3e552e){return db['FaxApplication'][_0x5ffe('0x45')]({'where':{'id':_0x5d2ec6[_0x5ffe('0x47')]['id']}})[_0x5ffe('0x24')](handleEntityNotFound(_0x3e552e,null))[_0x5ffe('0x24')](removeEntity(_0x3e552e,null))[_0x5ffe('0x42')](handleError(_0x3e552e,null));}; \ No newline at end of file +var _0x8749=['map','keys','intersection','attributes','fields','length','query','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','FaxApplication','rawAttributes','type','key','model'];(function(_0x1c0781,_0x4a19f1){var _0x1f577e=function(_0x396577){while(--_0x396577){_0x1c0781['push'](_0x1c0781['shift']());}};_0x1f577e(++_0x4a19f1);}(_0x8749,0xb0));var _0x9874=function(_0x27c1ab,_0x3734be){_0x27c1ab=_0x27c1ab-0x0;var _0x5087a3=_0x8749[_0x27c1ab];return _0x5087a3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9874('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9874('0x1'));var Mustache=require(_0x9874('0x2'));var util=require(_0x9874('0x3'));var path=require(_0x9874('0x4'));var sox=require(_0x9874('0x5'));var csv=require(_0x9874('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9874('0x7'));var _=require('lodash');var squel=require(_0x9874('0x8'));var crypto=require(_0x9874('0x9'));var jsforce=require(_0x9874('0xa'));var deskjs=require(_0x9874('0xb'));var toCsv=require(_0x9874('0x6'));var querystring=require(_0x9874('0xc'));var Papa=require(_0x9874('0xd'));var Redis=require(_0x9874('0xe'));var authService=require(_0x9874('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9874('0x10'));var hardwareService=require(_0x9874('0x11'));var logger=require(_0x9874('0x12'))(_0x9874('0x13'));var utils=require(_0x9874('0x14'));var config=require(_0x9874('0x15'));var licenseUtil=require(_0x9874('0x16'));var db=require(_0x9874('0x17'))['db'];function respondWithStatusCode(_0x4b14a2,_0x15f44a){_0x15f44a=_0x15f44a||0xcc;return function(_0x29d102){if(_0x29d102){return _0x4b14a2[_0x9874('0x18')](_0x15f44a);}return _0x4b14a2[_0x9874('0x19')](_0x15f44a)['end']();};}function respondWithResult(_0xb0a0fa,_0x22eecc){_0x22eecc=_0x22eecc||0xc8;return function(_0x1f4b32){if(_0x1f4b32){return _0xb0a0fa[_0x9874('0x19')](_0x22eecc)[_0x9874('0x1a')](_0x1f4b32);}};}function respondWithFilteredResult(_0x4b9fbf,_0x1c5c84){return function(_0x29bff2){if(_0x29bff2){var _0x43f361=typeof _0x1c5c84[_0x9874('0x1b')]==='undefined'&&typeof _0x1c5c84[_0x9874('0x1c')]===_0x9874('0x1d');var _0x3e211b=_0x29bff2['count'];var _0x442ce1=_0x43f361?0x0:_0x1c5c84['offset'];var _0x3ffa30=_0x43f361?_0x29bff2[_0x9874('0x1e')]:_0x1c5c84['offset']+_0x1c5c84[_0x9874('0x1c')];var _0x4a92b1;if(_0x3ffa30>=_0x3e211b){_0x3ffa30=_0x3e211b;_0x4a92b1=0xc8;}else{_0x4a92b1=0xce;}_0x4b9fbf['status'](_0x4a92b1);return _0x4b9fbf[_0x9874('0x1f')](_0x9874('0x20'),_0x442ce1+'-'+_0x3ffa30+'/'+_0x3e211b)[_0x9874('0x1a')](_0x29bff2);}return null;};}function patchUpdates(_0x4fa9e5){return function(_0x3a1f2c){try{jsonpatch[_0x9874('0x21')](_0x3a1f2c,_0x4fa9e5,!![]);}catch(_0x10343c){return BPromise[_0x9874('0x22')](_0x10343c);}return _0x3a1f2c[_0x9874('0x23')]();};}function saveUpdates(_0x374681,_0x45c855){return function(_0x1e6901){if(_0x1e6901){return _0x1e6901[_0x9874('0x24')](_0x374681)[_0x9874('0x25')](function(_0x5d3a1a){return _0x5d3a1a;});}return null;};}function removeEntity(_0x21d641,_0x10801c){return function(_0x36f441){if(_0x36f441){return _0x36f441[_0x9874('0x26')]()['then'](function(){_0x21d641[_0x9874('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a7238,_0x40a79c){return function(_0x4e7087){if(!_0x4e7087){_0x3a7238[_0x9874('0x18')](0x194);}return _0x4e7087;};}function handleError(_0x3dfac3,_0x192714){_0x192714=_0x192714||0x1f4;return function(_0x29c408){logger[_0x9874('0x27')](_0x29c408[_0x9874('0x28')]);if(_0x29c408[_0x9874('0x29')]){delete _0x29c408['name'];}_0x3dfac3[_0x9874('0x19')](_0x192714)[_0x9874('0x2a')](_0x29c408);};}exports[_0x9874('0x2b')]=function(_0x33dba6,_0xe2f2d4){var _0x5a2525={},_0x690763={},_0x3e3d3f={'count':0x0,'rows':[]};var _0x1fe9b0=_['map'](db[_0x9874('0x2c')][_0x9874('0x2d')],function(_0x1493e5){return{'name':_0x1493e5['fieldName'],'type':_0x1493e5[_0x9874('0x2e')][_0x9874('0x2f')]};});_0x690763[_0x9874('0x30')]=_[_0x9874('0x31')](_0x1fe9b0,'name');_0x690763['query']=_[_0x9874('0x32')](_0x33dba6['query']);_0x690763['filters']=_[_0x9874('0x33')](_0x690763['model'],_0x690763['query']);_0x5a2525[_0x9874('0x34')]=_['intersection'](_0x690763[_0x9874('0x30')],qs[_0x9874('0x35')](_0x33dba6['query'][_0x9874('0x35')]));_0x5a2525[_0x9874('0x34')]=_0x5a2525[_0x9874('0x34')][_0x9874('0x36')]?_0x5a2525[_0x9874('0x34')]:_0x690763[_0x9874('0x30')];if(!_0x33dba6[_0x9874('0x37')][_0x9874('0x38')](_0x9874('0x39'))){_0x5a2525[_0x9874('0x1c')]=qs[_0x9874('0x1c')](_0x33dba6[_0x9874('0x37')][_0x9874('0x1c')]);_0x5a2525[_0x9874('0x1b')]=qs[_0x9874('0x1b')](_0x33dba6[_0x9874('0x37')][_0x9874('0x1b')]);}_0x5a2525['order']=qs[_0x9874('0x3a')](_0x33dba6[_0x9874('0x37')][_0x9874('0x3a')]);_0x5a2525[_0x9874('0x3b')]=qs[_0x9874('0x3c')](_[_0x9874('0x3d')](_0x33dba6[_0x9874('0x37')],_0x690763[_0x9874('0x3c')]),_0x1fe9b0);if(_0x33dba6[_0x9874('0x37')]['filter']){_0x5a2525[_0x9874('0x3b')]=_[_0x9874('0x3e')](_0x5a2525['where'],{'$or':_[_0x9874('0x31')](_0x1fe9b0,function(_0x177f4f){if(_0x177f4f[_0x9874('0x2e')]!==_0x9874('0x3f')){var _0x3c9741={};_0x3c9741[_0x177f4f['name']]={'$like':'%'+_0x33dba6[_0x9874('0x37')]['filter']+'%'};return _0x3c9741;}})});}_0x5a2525=_[_0x9874('0x3e')]({},_0x5a2525,_0x33dba6[_0x9874('0x40')]);var _0x5a293b={'where':_0x5a2525[_0x9874('0x3b')]};return db[_0x9874('0x2c')][_0x9874('0x1e')](_0x5a293b)[_0x9874('0x25')](function(_0x3d420d){_0x3e3d3f[_0x9874('0x1e')]=_0x3d420d;if(_0x33dba6[_0x9874('0x37')][_0x9874('0x41')]){_0x5a2525[_0x9874('0x42')]=[{'all':!![]}];}return db[_0x9874('0x2c')][_0x9874('0x43')](_0x5a2525);})[_0x9874('0x25')](function(_0x41745e){_0x3e3d3f[_0x9874('0x44')]=_0x41745e;return _0x3e3d3f;})[_0x9874('0x25')](respondWithFilteredResult(_0xe2f2d4,_0x5a2525))['catch'](handleError(_0xe2f2d4,null));};exports[_0x9874('0x45')]=function(_0x4b974b,_0x424991){var _0x2c0df7={'raw':!![],'where':{'id':_0x4b974b['params']['id']}},_0x190de9={};_0x190de9[_0x9874('0x30')]=_['keys'](db[_0x9874('0x2c')][_0x9874('0x2d')]);_0x190de9[_0x9874('0x37')]=_[_0x9874('0x32')](_0x4b974b[_0x9874('0x37')]);_0x190de9[_0x9874('0x3c')]=_['intersection'](_0x190de9[_0x9874('0x30')],_0x190de9[_0x9874('0x37')]);_0x2c0df7['attributes']=_['intersection'](_0x190de9[_0x9874('0x30')],qs[_0x9874('0x35')](_0x4b974b[_0x9874('0x37')][_0x9874('0x35')]));_0x2c0df7[_0x9874('0x34')]=_0x2c0df7['attributes'][_0x9874('0x36')]?_0x2c0df7[_0x9874('0x34')]:_0x190de9['model'];if(_0x4b974b[_0x9874('0x37')][_0x9874('0x41')]){_0x2c0df7[_0x9874('0x42')]=[{'all':!![]}];}_0x2c0df7=_['merge']({},_0x2c0df7,_0x4b974b[_0x9874('0x40')]);return db[_0x9874('0x2c')][_0x9874('0x46')](_0x2c0df7)[_0x9874('0x25')](handleEntityNotFound(_0x424991,null))['then'](respondWithResult(_0x424991,null))[_0x9874('0x47')](handleError(_0x424991,null));};exports[_0x9874('0x48')]=function(_0x3219d9,_0x21b6fc){return db['FaxApplication'][_0x9874('0x48')](_0x3219d9['body'],{})[_0x9874('0x25')](respondWithResult(_0x21b6fc,0xc9))[_0x9874('0x47')](handleError(_0x21b6fc,null));};exports[_0x9874('0x24')]=function(_0x2fa515,_0x6363ed){if(_0x2fa515[_0x9874('0x49')]['id']){delete _0x2fa515[_0x9874('0x49')]['id'];}return db['FaxApplication']['find']({'where':{'id':_0x2fa515['params']['id']}})[_0x9874('0x25')](handleEntityNotFound(_0x6363ed,null))[_0x9874('0x25')](saveUpdates(_0x2fa515[_0x9874('0x49')],null))['then'](respondWithResult(_0x6363ed,null))['catch'](handleError(_0x6363ed,null));};exports['destroy']=function(_0x5b90f3,_0x4b8c35){return db[_0x9874('0x2c')][_0x9874('0x46')]({'where':{'id':_0x5b90f3[_0x9874('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4b8c35,null))[_0x9874('0x25')](removeEntity(_0x4b8c35,null))[_0x9874('0x47')](handleError(_0x4b8c35,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index ca5a6e3..a52ee52 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 _0x3108=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x97cc12,_0x54d583){var _0x5a25d7=function(_0x46add6){while(--_0x46add6){_0x97cc12['push'](_0x97cc12['shift']());}};_0x5a25d7(++_0x54d583);}(_0x3108,0x107));var _0x8310=function(_0xad1709,_0x464a66){_0xad1709=_0xad1709-0x0;var _0x54938e=_0x3108[_0xad1709];return _0x54938e;};'use strict';var _=require(_0x8310('0x0'));var util=require('util');var logger=require(_0x8310('0x1'))('api');var moment=require(_0x8310('0x2'));var BPromise=require('bluebird');var rp=require(_0x8310('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8310('0x4'));var config=require(_0x8310('0x5'));var attributes=require(_0x8310('0x6'));module[_0x8310('0x7')]=function(_0x527394,_0x3c85a4){return _0x527394[_0x8310('0x8')]('FaxApplication',attributes,{'tableName':_0x8310('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8310('0xa'),'collate':_0x8310('0xb')});}; \ No newline at end of file +var _0x8552=['moment','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x12f010,_0x532524){var _0x59572d=function(_0x9c49b6){while(--_0x9c49b6){_0x12f010['push'](_0x12f010['shift']());}};_0x59572d(++_0x532524);}(_0x8552,0x141));var _0x2855=function(_0x5e3891,_0x3614b8){_0x5e3891=_0x5e3891-0x0;var _0x5673f1=_0x8552[_0x5e3891];return _0x5673f1;};'use strict';var _=require(_0x2855('0x0'));var util=require(_0x2855('0x1'));var logger=require(_0x2855('0x2'))(_0x2855('0x3'));var moment=require(_0x2855('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2855('0x5'));var rimraf=require(_0x2855('0x6'));var config=require(_0x2855('0x7'));var attributes=require(_0x2855('0x8'));module[_0x2855('0x9')]=function(_0x34ee75,_0x5a0fdd){return _0x34ee75[_0x2855('0xa')](_0x2855('0xb'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2855('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 4266237..34fd8fa 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 _0x16dc=['FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','attributes','limit','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x4d3f27,_0x30546a){var _0x6fd21f=function(_0x3d6647){while(--_0x3d6647){_0x4d3f27['push'](_0x4d3f27['shift']());}};_0x6fd21f(++_0x30546a);}(_0x16dc,0xe3));var _0xc16d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x16dc[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xc16d('0x0'));var moment=require('moment');var BPromise=require(_0xc16d('0x1'));var rs=require(_0xc16d('0x2'));var fs=require('fs');var Redis=require(_0xc16d('0x3'));var db=require(_0xc16d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc16d('0x5'))(_0xc16d('0x6'));var config=require(_0xc16d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc16d('0x8')][_0xc16d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37706f,_0x445435,_0x5e9616){return new BPromise(function(_0x20bc6f,_0x328726){return client[_0xc16d('0xa')](_0x37706f,_0x5e9616)[_0xc16d('0xb')](function(_0x4933ef){logger[_0xc16d('0xc')](_0xc16d('0xd'),_0x445435,_0xc16d('0xe'));logger[_0xc16d('0xf')](_0xc16d('0x10'),_0x445435,_0xc16d('0xe'),JSON['stringify'](_0x4933ef));if(_0x4933ef[_0xc16d('0x11')]){if(_0x4933ef['error'][_0xc16d('0x12')]===0x1f4){logger[_0xc16d('0x11')](_0xc16d('0xd'),_0x445435,_0x4933ef[_0xc16d('0x11')][_0xc16d('0x13')]);return _0x328726(_0x4933ef[_0xc16d('0x11')][_0xc16d('0x13')]);}logger[_0xc16d('0x11')](_0xc16d('0xd'),_0x445435,_0x4933ef[_0xc16d('0x11')][_0xc16d('0x13')]);return _0x20bc6f(_0x4933ef[_0xc16d('0x11')]['message']);}else{logger[_0xc16d('0xc')]('FaxApplication,\x20%s,\x20%s',_0x445435,_0xc16d('0xe'));_0x20bc6f(_0x4933ef[_0xc16d('0x14')][_0xc16d('0x13')]);}})[_0xc16d('0x15')](function(_0x46ddf0){logger[_0xc16d('0x11')](_0xc16d('0xd'),_0x445435,_0x46ddf0);_0x328726(_0x46ddf0);});});}exports[_0xc16d('0x16')]=function(_0x15cb87){var _0x2b0642=this;return new Promise(function(_0x549dcb,_0x22d8ac){return db[_0xc16d('0x17')][_0xc16d('0x18')](_0x15cb87[_0xc16d('0x19')],{'raw':_0x15cb87[_0xc16d('0x1a')]?_0x15cb87[_0xc16d('0x1a')][_0xc16d('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15cb87[_0xc16d('0x1a')]?_0x15cb87['options']['where']||null:null,'attributes':_0x15cb87[_0xc16d('0x1a')]?_0x15cb87[_0xc16d('0x1a')][_0xc16d('0x1c')]||null:null,'limit':_0x15cb87['options']?_0x15cb87[_0xc16d('0x1a')][_0xc16d('0x1d')]||null:null})[_0xc16d('0xb')](function(_0x21dfb8){logger[_0xc16d('0xc')](_0xc16d('0x16'),_0x15cb87);logger[_0xc16d('0xf')]('UpdateFaxApplication',_0x15cb87,JSON['stringify'](_0x21dfb8));_0x549dcb(_0x21dfb8);})[_0xc16d('0x15')](function(_0x5819f9){logger[_0xc16d('0x11')](_0xc16d('0x16'),_0x5819f9[_0xc16d('0x13')],_0x15cb87);_0x22d8ac(_0x2b0642[_0xc16d('0x11')](0x1f4,_0x5819f9[_0xc16d('0x13')]));});});}; \ No newline at end of file +var _0xb089=['result','catch','update','body','options','where','attributes','limit','UpdateFaxApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxApplication,\x20%s,\x20%s','message'];(function(_0x128d68,_0x555a32){var _0x24ad4d=function(_0x101a3a){while(--_0x101a3a){_0x128d68['push'](_0x128d68['shift']());}};_0x24ad4d(++_0x555a32);}(_0xb089,0x174));var _0x9b08=function(_0x239129,_0xc26811){_0x239129=_0x239129-0x0;var _0x11fda2=_0xb089[_0x239129];return _0x11fda2;};'use strict';var _=require(_0x9b08('0x0'));var util=require(_0x9b08('0x1'));var moment=require(_0x9b08('0x2'));var BPromise=require(_0x9b08('0x3'));var rs=require(_0x9b08('0x4'));var fs=require('fs');var Redis=require(_0x9b08('0x5'));var db=require(_0x9b08('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b08('0x7'))(_0x9b08('0x8'));var config=require(_0x9b08('0x9'));var jayson=require(_0x9b08('0xa'));var client=jayson[_0x9b08('0xb')][_0x9b08('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa71f7b,_0x45fd6c,_0x90941c){return new BPromise(function(_0x2c41e8,_0x5a7bc1){return client[_0x9b08('0xd')](_0xa71f7b,_0x90941c)[_0x9b08('0xe')](function(_0x1fd81e){logger[_0x9b08('0xf')]('FaxApplication,\x20%s,\x20%s',_0x45fd6c,_0x9b08('0x10'));logger[_0x9b08('0x11')](_0x9b08('0x12'),_0x45fd6c,_0x9b08('0x10'),JSON[_0x9b08('0x13')](_0x1fd81e));if(_0x1fd81e[_0x9b08('0x14')]){if(_0x1fd81e['error'][_0x9b08('0x15')]===0x1f4){logger['error'](_0x9b08('0x16'),_0x45fd6c,_0x1fd81e['error'][_0x9b08('0x17')]);return _0x5a7bc1(_0x1fd81e[_0x9b08('0x14')][_0x9b08('0x17')]);}logger['error'](_0x9b08('0x16'),_0x45fd6c,_0x1fd81e[_0x9b08('0x14')][_0x9b08('0x17')]);return _0x2c41e8(_0x1fd81e[_0x9b08('0x14')][_0x9b08('0x17')]);}else{logger[_0x9b08('0xf')]('FaxApplication,\x20%s,\x20%s',_0x45fd6c,_0x9b08('0x10'));_0x2c41e8(_0x1fd81e[_0x9b08('0x18')]['message']);}})[_0x9b08('0x19')](function(_0x20127a){logger[_0x9b08('0x14')](_0x9b08('0x16'),_0x45fd6c,_0x20127a);_0x5a7bc1(_0x20127a);});});}exports['UpdateFaxApplication']=function(_0x19d0c8){var _0x1a8542=this;return new Promise(function(_0x4c68f5,_0xee78d1){return db['FaxApplication'][_0x9b08('0x1a')](_0x19d0c8[_0x9b08('0x1b')],{'raw':_0x19d0c8['options']?_0x19d0c8[_0x9b08('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19d0c8['options']?_0x19d0c8[_0x9b08('0x1c')][_0x9b08('0x1d')]||null:null,'attributes':_0x19d0c8[_0x9b08('0x1c')]?_0x19d0c8[_0x9b08('0x1c')][_0x9b08('0x1e')]||null:null,'limit':_0x19d0c8[_0x9b08('0x1c')]?_0x19d0c8[_0x9b08('0x1c')][_0x9b08('0x1f')]||null:null})[_0x9b08('0xe')](function(_0x593505){logger[_0x9b08('0xf')](_0x9b08('0x20'),_0x19d0c8);logger[_0x9b08('0x11')]('UpdateFaxApplication',_0x19d0c8,JSON[_0x9b08('0x13')](_0x593505));_0x4c68f5(_0x593505);})[_0x9b08('0x19')](function(_0x5a0d4b){logger[_0x9b08('0x14')](_0x9b08('0x20'),_0x5a0d4b[_0x9b08('0x17')],_0x19d0c8);_0xee78d1(_0x1a8542[_0x9b08('0x14')](0x1f4,_0x5a0d4b[_0x9b08('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 43d2c7c..0c0d5bd 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 _0x93e9=['multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x358973,_0x17f72d){var _0x48b844=function(_0x35edf1){while(--_0x35edf1){_0x358973['push'](_0x358973['shift']());}};_0x48b844(++_0x17f72d);}(_0x93e9,0xcc));var _0x993e=function(_0x5fd2a6,_0x25dcdc){_0x5fd2a6=_0x5fd2a6-0x0;var _0x12a506=_0x93e9[_0x5fd2a6];return _0x12a506;};'use strict';var multer=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var path=require(_0x993e('0x2'));var timeout=require(_0x993e('0x3'));var express=require(_0x993e('0x4'));var router=express[_0x993e('0x5')]();var fs_extra=require(_0x993e('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x993e('0x7'));var controller=require(_0x993e('0x8'));router[_0x993e('0x9')]('/',auth[_0x993e('0xa')](),controller[_0x993e('0xb')]);router[_0x993e('0x9')](_0x993e('0xc'),auth[_0x993e('0xa')](),controller['show']);router[_0x993e('0xd')]('/',auth[_0x993e('0xa')](),controller[_0x993e('0xe')]);router[_0x993e('0xf')](_0x993e('0xc'),auth[_0x993e('0xa')](),controller[_0x993e('0x10')]);router['delete'](_0x993e('0xc'),auth[_0x993e('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3266=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxApplication.controller','isAuthenticated','index','get','post','create','put','/:id','update','delete','destroy'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3266,0x6a));var _0x6326=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0x3266[_0x2ae2ad];return _0x26dbd7;};'use strict';var multer=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var path=require(_0x6326('0x2'));var timeout=require(_0x6326('0x3'));var express=require(_0x6326('0x4'));var router=express[_0x6326('0x5')]();var fs_extra=require(_0x6326('0x6'));var auth=require(_0x6326('0x7'));var interaction=require(_0x6326('0x8'));var config=require('../../config/environment');var controller=require(_0x6326('0x9'));router['get']('/',auth[_0x6326('0xa')](),controller[_0x6326('0xb')]);router[_0x6326('0xc')]('/:id',auth[_0x6326('0xa')](),controller['show']);router[_0x6326('0xd')]('/',auth[_0x6326('0xa')](),controller[_0x6326('0xe')]);router[_0x6326('0xf')](_0x6326('0x10'),auth['isAuthenticated'](),controller[_0x6326('0x11')]);router[_0x6326('0x12')](_0x6326('0x10'),auth[_0x6326('0xa')](),controller[_0x6326('0x13')]);module[_0x6326('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 4299d01..5a128b5 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 _0xd824=['exports','STRING','DATE','INTEGER','sequelize'];(function(_0x42abed,_0x4bca02){var _0x2dcbf0=function(_0x5eb843){while(--_0x5eb843){_0x42abed['push'](_0x42abed['shift']());}};_0x2dcbf0(++_0x4bca02);}(_0xd824,0xc2));var _0x4d82=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd824[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x4d82('0x0'));module[_0x4d82('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x4d82('0x2')]},'secondDisposition':{'type':Sequelize[_0x4d82('0x2')]},'thirdDisposition':{'type':Sequelize[_0x4d82('0x2')]},'note':{'type':Sequelize[_0x4d82('0x2')]},'read1stAt':{'type':Sequelize[_0x4d82('0x3')]},'fax':{'type':Sequelize[_0x4d82('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4d82('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x4d82('0x4')]}}; \ No newline at end of file +var _0x627e=['out','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x627e,0x14a));var _0xe627=function(_0x13b0ba,_0x1aeb85){_0x13b0ba=_0x13b0ba-0x0;var _0x5a29f1=_0x627e[_0x13b0ba];return _0x5a29f1;};'use strict';var Sequelize=require(_0xe627('0x0'));module[_0xe627('0x1')]={'closed':{'type':Sequelize[_0xe627('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe627('0x3')]},'disposition':{'type':Sequelize[_0xe627('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xe627('0x4')]},'note':{'type':Sequelize[_0xe627('0x4')]},'read1stAt':{'type':Sequelize[_0xe627('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe627('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xe627('0x5')]('in',_0xe627('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xe627('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 6c37b22..37bb2e6 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 _0x5d9e=['status','end','offset','undefined','limit','count','set','json','update','then','destroy','error','stack','name','send','map','rawAttributes','type','getOptions','findAll','fax','query','user','catch','show','params','model','keys','FaxInteraction','filters','intersection','attributes','fields','length','includeAll','include','options','find','create','body','describe','addMessage','FaxMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','FaxInteractionId','merge','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','omit','spread','Tag','color','emit','faxInteractionTags:save','unix','toString','join','files','root','transcript-%d-%s.zip','Attachment','createdAt','Messages','get','mkdirSync','basename','createReadStream','createWriteStream','resolve','download','log','unlinkSync','rimraf','zip-dir','moment','bluebird','path','lodash','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x5d9e,0x1dc));var _0xe5d9=function(_0x398562,_0x5a90d3){_0x398562=_0x398562-0x0;var _0x51e2c3=_0x5d9e[_0x398562];return _0x51e2c3;};'use strict';var rimraf=require(_0xe5d9('0x0'));var zipdir=require(_0xe5d9('0x1'));var moment=require(_0xe5d9('0x2'));var BPromise=require(_0xe5d9('0x3'));var util=require('util');var path=require(_0xe5d9('0x4'));var fs=require('fs');var _=require(_0xe5d9('0x5'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0xe5d9('0x6'))(_0xe5d9('0x7'));var config=require('../../config/environment');var db=require(_0xe5d9('0x8'))['db'];config[_0xe5d9('0x9')]=_[_0xe5d9('0xa')](config[_0xe5d9('0x9')],{'host':_0xe5d9('0xb'),'port':0x18eb});var socket=require(_0xe5d9('0xc'))(new Redis(config[_0xe5d9('0x9')]));require('./faxInteraction.socket')['register'](socket);function respondWithStatusCode(_0x3e02a8,_0x1d62be){_0x1d62be=_0x1d62be||0xcc;return function(_0x1b8b10){if(_0x1b8b10){return _0x3e02a8[_0xe5d9('0xd')](_0x1d62be);}return _0x3e02a8[_0xe5d9('0xe')](_0x1d62be)[_0xe5d9('0xf')]();};}function respondWithResult(_0x4a79b7,_0x47f502){_0x47f502=_0x47f502||0xc8;return function(_0x186edc){if(_0x186edc){return _0x4a79b7['status'](_0x47f502)['json'](_0x186edc);}};}function respondWithFilteredResult(_0x7af67f,_0x58e3c4){return function(_0x4b9caa){if(_0x4b9caa){var _0xdf8a93=typeof _0x58e3c4[_0xe5d9('0x10')]===_0xe5d9('0x11')&&typeof _0x58e3c4[_0xe5d9('0x12')]==='undefined';var _0x573c5a=_0x4b9caa['count'];var _0x2d8847=_0xdf8a93?0x0:_0x58e3c4[_0xe5d9('0x10')];var _0x25f06b=_0xdf8a93?_0x4b9caa[_0xe5d9('0x13')]:_0x58e3c4[_0xe5d9('0x10')]+_0x58e3c4['limit'];var _0x1badd2;if(_0x25f06b>=_0x573c5a){_0x25f06b=_0x573c5a;_0x1badd2=0xc8;}else{_0x1badd2=0xce;}_0x7af67f[_0xe5d9('0xe')](_0x1badd2);return _0x7af67f[_0xe5d9('0x14')]('Content-Range',_0x2d8847+'-'+_0x25f06b+'/'+_0x573c5a)[_0xe5d9('0x15')](_0x4b9caa);}return null;};}function saveUpdates(_0x317109){return function(_0x382fcc){if(_0x382fcc){return _0x382fcc[_0xe5d9('0x16')](_0x317109)[_0xe5d9('0x17')](function(_0x425186){return _0x425186;});}return null;};}function removeEntity(_0x5c15eb){return function(_0x346e4b){if(_0x346e4b){return _0x346e4b[_0xe5d9('0x18')]()['then'](function(){_0x5c15eb[_0xe5d9('0xe')](0xcc)[_0xe5d9('0xf')]();});}};}function handleEntityNotFound(_0x32bd0c){return function(_0x413135){if(!_0x413135){_0x32bd0c['sendStatus'](0x194);}return _0x413135;};}function handleError(_0x276a79,_0x19d22d){_0x19d22d=_0x19d22d||0x1f4;return function(_0x3c40d3){logger[_0xe5d9('0x19')](_0x3c40d3[_0xe5d9('0x1a')]);if(_0x3c40d3[_0xe5d9('0x1b')]){delete _0x3c40d3[_0xe5d9('0x1b')];}_0x276a79[_0xe5d9('0xe')](_0x19d22d)[_0xe5d9('0x1c')](_0x3c40d3);};}exports['index']=function(_0x1d5f19,_0x53884d){var _0x34e353={};var _0x558051=_[_0xe5d9('0x1d')](db['FaxInteraction'][_0xe5d9('0x1e')],function(_0x477534){return{'name':_0x477534['fieldName'],'type':_0x477534[_0xe5d9('0x1f')]['key']};});_0x34e353=qs[_0xe5d9('0x20')](_0x558051,_0x1d5f19);return interaction[_0xe5d9('0x21')](_0xe5d9('0x22'),_0x1d5f19[_0xe5d9('0x23')],_0x1d5f19[_0xe5d9('0x24')],_0x34e353,_0x558051)[_0xe5d9('0x17')](respondWithFilteredResult(_0x53884d,_0x34e353))[_0xe5d9('0x25')](handleError(_0x53884d,null));};exports[_0xe5d9('0x26')]=function(_0x345523,_0x13fa7a){var _0x3c0f88={'raw':![],'where':{'id':_0x345523[_0xe5d9('0x27')]['id']}},_0x1840a1={};_0x1840a1[_0xe5d9('0x28')]=_[_0xe5d9('0x29')](db[_0xe5d9('0x2a')]['rawAttributes']);_0x1840a1[_0xe5d9('0x23')]=_[_0xe5d9('0x29')](_0x345523[_0xe5d9('0x23')]);_0x1840a1[_0xe5d9('0x2b')]=_[_0xe5d9('0x2c')](_0x1840a1[_0xe5d9('0x28')],_0x1840a1[_0xe5d9('0x23')]);_0x3c0f88[_0xe5d9('0x2d')]=_['intersection'](_0x1840a1['model'],qs['fields'](_0x345523['query'][_0xe5d9('0x2e')]));_0x3c0f88[_0xe5d9('0x2d')]=_0x3c0f88[_0xe5d9('0x2d')][_0xe5d9('0x2f')]?_0x3c0f88[_0xe5d9('0x2d')]:_0x1840a1['model'];if(_0x345523['query'][_0xe5d9('0x30')]){_0x3c0f88[_0xe5d9('0x31')]=[{'all':!![]}];}_0x3c0f88=_['merge']({},_0x3c0f88,_0x345523[_0xe5d9('0x32')]);return db['FaxInteraction'][_0xe5d9('0x33')](_0x3c0f88)[_0xe5d9('0x17')](handleEntityNotFound(_0x13fa7a,null))[_0xe5d9('0x17')](respondWithResult(_0x13fa7a,null))[_0xe5d9('0x25')](handleError(_0x13fa7a,null));};exports[_0xe5d9('0x34')]=function(_0x262595,_0x6812f8){return db[_0xe5d9('0x2a')]['create'](_0x262595[_0xe5d9('0x35')],{})[_0xe5d9('0x17')](respondWithResult(_0x6812f8,0xc9))[_0xe5d9('0x25')](handleError(_0x6812f8,null));};exports['update']=function(_0x2c058d,_0x3ca1ac){if(_0x2c058d[_0xe5d9('0x35')]['id']){delete _0x2c058d[_0xe5d9('0x35')]['id'];}return db[_0xe5d9('0x2a')][_0xe5d9('0x33')]({'where':{'id':_0x2c058d['params']['id']}})['then'](handleEntityNotFound(_0x3ca1ac,null))[_0xe5d9('0x17')](saveUpdates(_0x2c058d['body'],null))[_0xe5d9('0x17')](respondWithResult(_0x3ca1ac,null))['catch'](handleError(_0x3ca1ac,null));};exports[_0xe5d9('0x18')]=function(_0x16f28d,_0x5cc36f){return db[_0xe5d9('0x2a')][_0xe5d9('0x33')]({'where':{'id':_0x16f28d['params']['id']}})[_0xe5d9('0x17')](handleEntityNotFound(_0x5cc36f,null))[_0xe5d9('0x17')](removeEntity(_0x5cc36f,null))['catch'](handleError(_0x5cc36f,null));};exports['describe']=function(_0xf2ace0,_0x503f73){return db[_0xe5d9('0x2a')][_0xe5d9('0x36')]()['then'](respondWithResult(_0x503f73,null))['catch'](handleError(_0x503f73,null));};exports[_0xe5d9('0x37')]=function(_0x39dbb7,_0x2c9fba){return db[_0xe5d9('0x38')][_0xe5d9('0x33')]({'where':{'id':_0x39dbb7[_0xe5d9('0x27')]['id']}})['then'](handleEntityNotFound(_0x2c9fba,null))['then'](function(_0x1f66dd){if(_0x1f66dd){return _0x1f66dd['addMessage'](_0x39dbb7[_0xe5d9('0x35')][_0xe5d9('0x39')],_['omit'](_0x39dbb7[_0xe5d9('0x35')],[_0xe5d9('0x39'),'id'])||{});}})[_0xe5d9('0x17')](respondWithResult(_0x2c9fba,null))['catch'](handleError(_0x2c9fba,null));};exports[_0xe5d9('0x3a')]=function(_0x18576b,_0x475003){var _0x230fc5={'raw':![],'where':{}};var _0xa43cc={};var _0x87364d={'count':0x0,'rows':[]};return db[_0xe5d9('0x2a')][_0xe5d9('0x3b')]({'where':{'id':_0x18576b[_0xe5d9('0x27')]['id']}})[_0xe5d9('0x17')](handleEntityNotFound(_0x475003,null))[_0xe5d9('0x17')](function(_0x963954){if(_0x963954){_0xa43cc['model']=_[_0xe5d9('0x29')](db[_0xe5d9('0x38')]['rawAttributes']);_0xa43cc[_0xe5d9('0x23')]=_[_0xe5d9('0x29')](_0x18576b['query']);_0xa43cc[_0xe5d9('0x2b')]=_[_0xe5d9('0x2c')](_0xa43cc['model'],_0xa43cc['query']);_0x230fc5[_0xe5d9('0x2d')]=_[_0xe5d9('0x2c')](_0xa43cc[_0xe5d9('0x28')],qs['fields'](_0x18576b[_0xe5d9('0x23')][_0xe5d9('0x2e')]));_0x230fc5[_0xe5d9('0x2d')]=_0x230fc5['attributes']['length']?_0x230fc5[_0xe5d9('0x2d')]:_0xa43cc[_0xe5d9('0x28')];if(!_0x18576b[_0xe5d9('0x23')][_0xe5d9('0x3c')](_0xe5d9('0x3d'))){_0x230fc5[_0xe5d9('0x12')]=qs['limit'](_0x18576b[_0xe5d9('0x23')][_0xe5d9('0x12')]);_0x230fc5['offset']=qs[_0xe5d9('0x10')](_0x18576b['query']['offset']);}_0x230fc5[_0xe5d9('0x3e')]=qs[_0xe5d9('0x3f')](_0x18576b[_0xe5d9('0x23')]['sort']);_0x230fc5[_0xe5d9('0x40')]=qs[_0xe5d9('0x2b')](_['pick'](_0x18576b[_0xe5d9('0x23')],_0xa43cc['filters']));_0x230fc5[_0xe5d9('0x40')][_0xe5d9('0x41')]=_0x963954['id'];if(_0x18576b[_0xe5d9('0x23')]['filter']){_0x230fc5[_0xe5d9('0x40')]=_[_0xe5d9('0x42')](_0x230fc5[_0xe5d9('0x40')],{'$or':_[_0xe5d9('0x1d')](_0x230fc5['attributes'],function(_0x6d76bb){var _0x498e0c={};_0x498e0c[_0x6d76bb]={'$like':'%'+_0x18576b[_0xe5d9('0x23')][_0xe5d9('0x43')]+'%'};return _0x498e0c;})});}if(_0x18576b[_0xe5d9('0x23')]['$gte']){var _0x4ffd1d=_0x18576b[_0xe5d9('0x23')][_0xe5d9('0x44')][_0xe5d9('0x45')](',');var _0x20e853={};_0x20e853[_0x4ffd1d[0x0]]={'$gte':moment(_0x4ffd1d[0x1])[_0xe5d9('0x46')](_0xe5d9('0x47'))};_0x230fc5['where']=_[_0xe5d9('0x42')](_0x230fc5[_0xe5d9('0x40')],_0x20e853);}_0x230fc5=_[_0xe5d9('0x42')]({},_0x230fc5,_0x18576b[_0xe5d9('0x32')]);return db['FaxMessage'][_0xe5d9('0x13')]({'where':_0x230fc5['where']})[_0xe5d9('0x17')](function(_0x43b1b1){_0x87364d[_0xe5d9('0x13')]=_0x43b1b1;if(_0x18576b[_0xe5d9('0x23')][_0xe5d9('0x30')]){_0x230fc5['include']=[{'all':!![]}];}return db[_0xe5d9('0x38')][_0xe5d9('0x21')](_0x230fc5);})[_0xe5d9('0x17')](function(_0x3bd18a){_0x87364d[_0xe5d9('0x48')]=_0x3bd18a;return _0x87364d;});}})[_0xe5d9('0x17')](respondWithFilteredResult(_0x475003,_0x230fc5))[_0xe5d9('0x25')](handleError(_0x475003,null));};exports[_0xe5d9('0x49')]=function(_0x101b43,_0xfbbf2d){return db[_0xe5d9('0x2a')]['find']({'where':{'id':_0x101b43[_0xe5d9('0x27')]['id']}})[_0xe5d9('0x17')](handleEntityNotFound(_0xfbbf2d,null))[_0xe5d9('0x17')](function(_0x57df69){if(_0x57df69){return _0x57df69['setTags'](_0x101b43[_0xe5d9('0x35')][_0xe5d9('0x39')],_[_0xe5d9('0x4a')](_0x101b43[_0xe5d9('0x35')],[_0xe5d9('0x39'),'id'])||{})[_0xe5d9('0x4b')](function(){return db[_0xe5d9('0x4c')][_0xe5d9('0x21')]({'attributes':['id',_0xe5d9('0x1b'),_0xe5d9('0x4d')],'where':{'id':_0x101b43['body'][_0xe5d9('0x39')]}});})[_0xe5d9('0x17')](function(_0xe01668){socket[_0xe5d9('0x4e')](_0xe5d9('0x4f'),{'id':Number(_0x101b43[_0xe5d9('0x27')]['id']),'tags':_0xe01668||[]});return{'id':Number(_0x101b43[_0xe5d9('0x27')]['id']),'tags':_0xe01668||[]};});}})[_0xe5d9('0x17')](respondWithResult(_0xfbbf2d,null))['catch'](handleError(_0xfbbf2d,null));};exports['removeTags']=function(_0xdd8320,_0x459464){return db[_0xe5d9('0x2a')][_0xe5d9('0x33')]({'where':{'id':_0xdd8320[_0xe5d9('0x27')]['id']}})[_0xe5d9('0x17')](handleEntityNotFound(_0x459464,null))[_0xe5d9('0x17')](function(_0x4d515b){if(_0x4d515b){return _0x4d515b['removeTags'](_0xdd8320[_0xe5d9('0x23')][_0xe5d9('0x39')]);}})['then'](respondWithStatusCode(_0x459464,null))[_0xe5d9('0x25')](handleError(_0x459464,null));};exports['download']=function(_0x503998,_0x3cfea7){var _0x265d87=moment()[_0xe5d9('0x50')]()[_0xe5d9('0x51')]();var _0x14d6d2=path[_0xe5d9('0x52')](config['root'],'server',_0xe5d9('0x53'),'tmp');var _0x2cd27c=path[_0xe5d9('0x52')](config[_0xe5d9('0x54')],'server','files','attachments');var _0x32bb4c=path[_0xe5d9('0x52')](_0x14d6d2,_0x265d87);var _0x3f8ef2=util[_0xe5d9('0x46')](_0xe5d9('0x55'),_0x503998[_0xe5d9('0x27')]['id'],_0x265d87);var _0x344742=path[_0xe5d9('0x52')](_0x14d6d2,_0x3f8ef2);var _0x259444=[];_0x259444['push']({'model':db[_0xe5d9('0x56')],'as':_0xe5d9('0x56'),'raw':!![]});var _0x38c10b=[{'model':db[_0xe5d9('0x38')],'as':'Messages','attributes':['id',_0xe5d9('0x35'),_0xe5d9('0x57')],'include':_0x259444}];return db[_0xe5d9('0x2a')][_0xe5d9('0x33')]({'where':{'id':_0x503998[_0xe5d9('0x27')]['id']},'include':_0x38c10b})['then'](handleEntityNotFound(_0x3cfea7,null))[_0xe5d9('0x17')](function(_0x42908a){if(_0x42908a&&_0x42908a[_0xe5d9('0x58')]){var _0x1b25cc=_0x42908a[_0xe5d9('0x59')]({'plain':!![]});fs[_0xe5d9('0x5a')](_0x32bb4c);for(var _0xc03a29=0x0;_0xc03a29<_0x1b25cc['Messages'][_0xe5d9('0x2f')];_0xc03a29++){var _0x935ac9=_0x1b25cc[_0xe5d9('0x58')][_0xc03a29][_0xe5d9('0x56')];if(_0x935ac9){var _0x20d6c6=path[_0xe5d9('0x52')](_0x2cd27c,_0x935ac9[_0xe5d9('0x5b')]);if(fs['existsSync'](_0x20d6c6)){fs[_0xe5d9('0x5c')](_0x20d6c6)['pipe'](fs[_0xe5d9('0x5d')](path[_0xe5d9('0x52')](_0x32bb4c,_0x935ac9[_0xe5d9('0x5b')])));}}}return BPromise[_0xe5d9('0x5e')]()[_0xe5d9('0x17')](function(){return new BPromise(function(_0xd7062,_0x20e3d0){zipdir(_0x32bb4c,{'saveTo':_0x344742},function(_0x4c0401,_0x57bb24){if(_0x4c0401)return _0x20e3d0(_0x4c0401);return _0xd7062(_0x57bb24);});})[_0xe5d9('0x17')](function(){return new BPromise(function(_0x5510ef,_0x33bacb){rimraf(_0x32bb4c,function(_0x2833f1){if(_0x2833f1)_0x33bacb(_0x2833f1);return _0x5510ef();});});})[_0xe5d9('0x17')](function(){return _0x3cfea7[_0xe5d9('0x5f')](_0x344742,_0x3f8ef2,function(_0x2ff05c){if(_0x2ff05c){console[_0xe5d9('0x60')]('err',_0x2ff05c);}else{fs[_0xe5d9('0x61')](_0x344742);}});});});}else{return _0x3cfea7[_0xe5d9('0xd')](0xc8);}})['catch'](handleError(_0x3cfea7,null));}; \ No newline at end of file +var _0xf72c=['where','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','findAll','color','emit','faxInteractionTags:save','removeTags','join','root','server','files','transcript-%d-%s.zip','Attachment','createdAt','Messages','get','mkdirSync','length','basename','pipe','download','log','err','unlinkSync','rimraf','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','then','end','error','stack','name','send','index','FaxInteraction','rawAttributes','type','key','getOptions','catch','params','keys','query','filters','model','attributes','intersection','fields','includeAll','merge','options','find','create','body','update','destroy','describe','FaxMessage','addMessage','ids','omit','getMessages','hasOwnProperty','sort'];(function(_0x3c1864,_0x4829c0){var _0x5c7b3a=function(_0x4a41fe){while(--_0x4a41fe){_0x3c1864['push'](_0x3c1864['shift']());}};_0x5c7b3a(++_0x4829c0);}(_0xf72c,0xde));var _0xcf72=function(_0x341be2,_0x95b5a6){_0x341be2=_0x341be2-0x0;var _0x48a954=_0xf72c[_0x341be2];return _0x48a954;};'use strict';var rimraf=require(_0xcf72('0x0'));var zipdir=require('zip-dir');var moment=require(_0xcf72('0x1'));var BPromise=require(_0xcf72('0x2'));var util=require(_0xcf72('0x3'));var path=require(_0xcf72('0x4'));var fs=require('fs');var _=require(_0xcf72('0x5'));var Redis=require(_0xcf72('0x6'));var interaction=require(_0xcf72('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0xcf72('0x8'))(_0xcf72('0x9'));var config=require(_0xcf72('0xa'));var db=require(_0xcf72('0xb'))['db'];config[_0xcf72('0xc')]=_[_0xcf72('0xd')](config[_0xcf72('0xc')],{'host':_0xcf72('0xe'),'port':0x18eb});var socket=require(_0xcf72('0xf'))(new Redis(config[_0xcf72('0xc')]));require(_0xcf72('0x10'))['register'](socket);function respondWithStatusCode(_0x510942,_0x1f829a){_0x1f829a=_0x1f829a||0xcc;return function(_0x4cfbb0){if(_0x4cfbb0){return _0x510942[_0xcf72('0x11')](_0x1f829a);}return _0x510942[_0xcf72('0x12')](_0x1f829a)['end']();};}function respondWithResult(_0x27053a,_0x4a575a){_0x4a575a=_0x4a575a||0xc8;return function(_0xb93e2){if(_0xb93e2){return _0x27053a[_0xcf72('0x12')](_0x4a575a)[_0xcf72('0x13')](_0xb93e2);}};}function respondWithFilteredResult(_0x18fd48,_0x39f23f){return function(_0x147823){if(_0x147823){var _0x359620=typeof _0x39f23f[_0xcf72('0x14')]===_0xcf72('0x15')&&typeof _0x39f23f[_0xcf72('0x16')]==='undefined';var _0x4516aa=_0x147823[_0xcf72('0x17')];var _0x1696bf=_0x359620?0x0:_0x39f23f[_0xcf72('0x14')];var _0x4c5bb3=_0x359620?_0x147823[_0xcf72('0x17')]:_0x39f23f['offset']+_0x39f23f[_0xcf72('0x16')];var _0xa45a03;if(_0x4c5bb3>=_0x4516aa){_0x4c5bb3=_0x4516aa;_0xa45a03=0xc8;}else{_0xa45a03=0xce;}_0x18fd48[_0xcf72('0x12')](_0xa45a03);return _0x18fd48[_0xcf72('0x18')](_0xcf72('0x19'),_0x1696bf+'-'+_0x4c5bb3+'/'+_0x4516aa)[_0xcf72('0x13')](_0x147823);}return null;};}function saveUpdates(_0x139d94){return function(_0x48d43e){if(_0x48d43e){return _0x48d43e['update'](_0x139d94)[_0xcf72('0x1a')](function(_0x47231d){return _0x47231d;});}return null;};}function removeEntity(_0x356c79){return function(_0x12c8bb){if(_0x12c8bb){return _0x12c8bb['destroy']()[_0xcf72('0x1a')](function(){_0x356c79[_0xcf72('0x12')](0xcc)[_0xcf72('0x1b')]();});}};}function handleEntityNotFound(_0x38f142){return function(_0x177386){if(!_0x177386){_0x38f142[_0xcf72('0x11')](0x194);}return _0x177386;};}function handleError(_0x5074bf,_0x1f7ad3){_0x1f7ad3=_0x1f7ad3||0x1f4;return function(_0xc5bce){logger[_0xcf72('0x1c')](_0xc5bce[_0xcf72('0x1d')]);if(_0xc5bce[_0xcf72('0x1e')]){delete _0xc5bce[_0xcf72('0x1e')];}_0x5074bf[_0xcf72('0x12')](_0x1f7ad3)[_0xcf72('0x1f')](_0xc5bce);};}exports[_0xcf72('0x20')]=function(_0x4ce72d,_0x2745ec){var _0x18313d={};var _0x5e73c1=_['map'](db[_0xcf72('0x21')][_0xcf72('0x22')],function(_0x1d380c){return{'name':_0x1d380c['fieldName'],'type':_0x1d380c[_0xcf72('0x23')][_0xcf72('0x24')]};});_0x18313d=qs[_0xcf72('0x25')](_0x5e73c1,_0x4ce72d);return interaction['findAll']('fax',_0x4ce72d['query'],_0x4ce72d['user'],_0x18313d,_0x5e73c1)[_0xcf72('0x1a')](respondWithFilteredResult(_0x2745ec,_0x18313d))[_0xcf72('0x26')](handleError(_0x2745ec,null));};exports['show']=function(_0x404d68,_0x44d4ee){var _0x4c683c={'raw':![],'where':{'id':_0x404d68[_0xcf72('0x27')]['id']}},_0x594d3b={};_0x594d3b['model']=_[_0xcf72('0x28')](db[_0xcf72('0x21')][_0xcf72('0x22')]);_0x594d3b[_0xcf72('0x29')]=_[_0xcf72('0x28')](_0x404d68[_0xcf72('0x29')]);_0x594d3b[_0xcf72('0x2a')]=_['intersection'](_0x594d3b[_0xcf72('0x2b')],_0x594d3b[_0xcf72('0x29')]);_0x4c683c[_0xcf72('0x2c')]=_[_0xcf72('0x2d')](_0x594d3b[_0xcf72('0x2b')],qs[_0xcf72('0x2e')](_0x404d68[_0xcf72('0x29')][_0xcf72('0x2e')]));_0x4c683c[_0xcf72('0x2c')]=_0x4c683c[_0xcf72('0x2c')]['length']?_0x4c683c['attributes']:_0x594d3b[_0xcf72('0x2b')];if(_0x404d68[_0xcf72('0x29')][_0xcf72('0x2f')]){_0x4c683c['include']=[{'all':!![]}];}_0x4c683c=_[_0xcf72('0x30')]({},_0x4c683c,_0x404d68[_0xcf72('0x31')]);return db[_0xcf72('0x21')][_0xcf72('0x32')](_0x4c683c)[_0xcf72('0x1a')](handleEntityNotFound(_0x44d4ee,null))[_0xcf72('0x1a')](respondWithResult(_0x44d4ee,null))['catch'](handleError(_0x44d4ee,null));};exports[_0xcf72('0x33')]=function(_0x2ed447,_0x123631){return db[_0xcf72('0x21')][_0xcf72('0x33')](_0x2ed447[_0xcf72('0x34')],{})[_0xcf72('0x1a')](respondWithResult(_0x123631,0xc9))[_0xcf72('0x26')](handleError(_0x123631,null));};exports[_0xcf72('0x35')]=function(_0x5aa1f6,_0x4cc93e){if(_0x5aa1f6['body']['id']){delete _0x5aa1f6[_0xcf72('0x34')]['id'];}return db[_0xcf72('0x21')][_0xcf72('0x32')]({'where':{'id':_0x5aa1f6[_0xcf72('0x27')]['id']}})[_0xcf72('0x1a')](handleEntityNotFound(_0x4cc93e,null))[_0xcf72('0x1a')](saveUpdates(_0x5aa1f6['body'],null))[_0xcf72('0x1a')](respondWithResult(_0x4cc93e,null))[_0xcf72('0x26')](handleError(_0x4cc93e,null));};exports[_0xcf72('0x36')]=function(_0x25616c,_0x3bba81){return db[_0xcf72('0x21')][_0xcf72('0x32')]({'where':{'id':_0x25616c['params']['id']}})[_0xcf72('0x1a')](handleEntityNotFound(_0x3bba81,null))[_0xcf72('0x1a')](removeEntity(_0x3bba81,null))['catch'](handleError(_0x3bba81,null));};exports[_0xcf72('0x37')]=function(_0x538abe,_0x20bc84){return db['FaxInteraction']['describe']()[_0xcf72('0x1a')](respondWithResult(_0x20bc84,null))[_0xcf72('0x26')](handleError(_0x20bc84,null));};exports['addMessage']=function(_0x57e899,_0x2534e1){return db[_0xcf72('0x38')][_0xcf72('0x32')]({'where':{'id':_0x57e899[_0xcf72('0x27')]['id']}})[_0xcf72('0x1a')](handleEntityNotFound(_0x2534e1,null))[_0xcf72('0x1a')](function(_0x1034bb){if(_0x1034bb){return _0x1034bb[_0xcf72('0x39')](_0x57e899[_0xcf72('0x34')][_0xcf72('0x3a')],_[_0xcf72('0x3b')](_0x57e899['body'],['ids','id'])||{});}})[_0xcf72('0x1a')](respondWithResult(_0x2534e1,null))[_0xcf72('0x26')](handleError(_0x2534e1,null));};exports[_0xcf72('0x3c')]=function(_0x297b42,_0x2e3d7d){var _0x2c6f67={'raw':![],'where':{}};var _0x1276e9={};var _0x5acea5={'count':0x0,'rows':[]};return db[_0xcf72('0x21')]['findOne']({'where':{'id':_0x297b42[_0xcf72('0x27')]['id']}})[_0xcf72('0x1a')](handleEntityNotFound(_0x2e3d7d,null))[_0xcf72('0x1a')](function(_0x25b96d){if(_0x25b96d){_0x1276e9[_0xcf72('0x2b')]=_[_0xcf72('0x28')](db[_0xcf72('0x38')][_0xcf72('0x22')]);_0x1276e9[_0xcf72('0x29')]=_['keys'](_0x297b42[_0xcf72('0x29')]);_0x1276e9[_0xcf72('0x2a')]=_['intersection'](_0x1276e9['model'],_0x1276e9[_0xcf72('0x29')]);_0x2c6f67[_0xcf72('0x2c')]=_['intersection'](_0x1276e9[_0xcf72('0x2b')],qs['fields'](_0x297b42['query'][_0xcf72('0x2e')]));_0x2c6f67[_0xcf72('0x2c')]=_0x2c6f67['attributes']['length']?_0x2c6f67[_0xcf72('0x2c')]:_0x1276e9[_0xcf72('0x2b')];if(!_0x297b42[_0xcf72('0x29')][_0xcf72('0x3d')]('nolimit')){_0x2c6f67[_0xcf72('0x16')]=qs['limit'](_0x297b42[_0xcf72('0x29')][_0xcf72('0x16')]);_0x2c6f67['offset']=qs[_0xcf72('0x14')](_0x297b42[_0xcf72('0x29')]['offset']);}_0x2c6f67['order']=qs[_0xcf72('0x3e')](_0x297b42['query'][_0xcf72('0x3e')]);_0x2c6f67[_0xcf72('0x3f')]=qs['filters'](_['pick'](_0x297b42['query'],_0x1276e9[_0xcf72('0x2a')]));_0x2c6f67['where']['FaxInteractionId']=_0x25b96d['id'];if(_0x297b42[_0xcf72('0x29')][_0xcf72('0x40')]){_0x2c6f67[_0xcf72('0x3f')]=_[_0xcf72('0x30')](_0x2c6f67[_0xcf72('0x3f')],{'$or':_[_0xcf72('0x41')](_0x2c6f67[_0xcf72('0x2c')],function(_0x2ffd6b){var _0x3739aa={};_0x3739aa[_0x2ffd6b]={'$like':'%'+_0x297b42[_0xcf72('0x29')][_0xcf72('0x40')]+'%'};return _0x3739aa;})});}if(_0x297b42['query']['$gte']){var _0x14c029=_0x297b42[_0xcf72('0x29')][_0xcf72('0x42')][_0xcf72('0x43')](',');var _0x34af60={};_0x34af60[_0x14c029[0x0]]={'$gte':moment(_0x14c029[0x1])[_0xcf72('0x44')](_0xcf72('0x45'))};_0x2c6f67[_0xcf72('0x3f')]=_[_0xcf72('0x30')](_0x2c6f67[_0xcf72('0x3f')],_0x34af60);}_0x2c6f67=_['merge']({},_0x2c6f67,_0x297b42[_0xcf72('0x31')]);return db[_0xcf72('0x38')][_0xcf72('0x17')]({'where':_0x2c6f67[_0xcf72('0x3f')]})[_0xcf72('0x1a')](function(_0x3f45c2){_0x5acea5[_0xcf72('0x17')]=_0x3f45c2;if(_0x297b42[_0xcf72('0x29')]['includeAll']){_0x2c6f67['include']=[{'all':!![]}];}return db[_0xcf72('0x38')]['findAll'](_0x2c6f67);})[_0xcf72('0x1a')](function(_0x4976af){_0x5acea5[_0xcf72('0x46')]=_0x4976af;return _0x5acea5;});}})[_0xcf72('0x1a')](respondWithFilteredResult(_0x2e3d7d,_0x2c6f67))[_0xcf72('0x26')](handleError(_0x2e3d7d,null));};exports[_0xcf72('0x47')]=function(_0x4b8557,_0x5873e6){return db['FaxInteraction'][_0xcf72('0x32')]({'where':{'id':_0x4b8557[_0xcf72('0x27')]['id']}})[_0xcf72('0x1a')](handleEntityNotFound(_0x5873e6,null))[_0xcf72('0x1a')](function(_0x3495ff){if(_0x3495ff){return _0x3495ff[_0xcf72('0x48')](_0x4b8557[_0xcf72('0x34')][_0xcf72('0x3a')],_['omit'](_0x4b8557[_0xcf72('0x34')],[_0xcf72('0x3a'),'id'])||{})['spread'](function(){return db['Tag'][_0xcf72('0x49')]({'attributes':['id','name',_0xcf72('0x4a')],'where':{'id':_0x4b8557['body'][_0xcf72('0x3a')]}});})[_0xcf72('0x1a')](function(_0x41ccf1){socket[_0xcf72('0x4b')](_0xcf72('0x4c'),{'id':Number(_0x4b8557[_0xcf72('0x27')]['id']),'tags':_0x41ccf1||[]});return{'id':Number(_0x4b8557['params']['id']),'tags':_0x41ccf1||[]};});}})[_0xcf72('0x1a')](respondWithResult(_0x5873e6,null))['catch'](handleError(_0x5873e6,null));};exports[_0xcf72('0x4d')]=function(_0x51d1e9,_0x96a891){return db[_0xcf72('0x21')][_0xcf72('0x32')]({'where':{'id':_0x51d1e9[_0xcf72('0x27')]['id']}})[_0xcf72('0x1a')](handleEntityNotFound(_0x96a891,null))[_0xcf72('0x1a')](function(_0x379de3){if(_0x379de3){return _0x379de3['removeTags'](_0x51d1e9[_0xcf72('0x29')][_0xcf72('0x3a')]);}})['then'](respondWithStatusCode(_0x96a891,null))[_0xcf72('0x26')](handleError(_0x96a891,null));};exports['download']=function(_0x265b7f,_0x23a044){var _0x4b42af=moment()['unix']()['toString']();var _0x49fb7f=path[_0xcf72('0x4e')](config[_0xcf72('0x4f')],_0xcf72('0x50'),'files','tmp');var _0x23cd53=path['join'](config[_0xcf72('0x4f')],_0xcf72('0x50'),_0xcf72('0x51'),'attachments');var _0x223196=path[_0xcf72('0x4e')](_0x49fb7f,_0x4b42af);var _0x380480=util[_0xcf72('0x44')](_0xcf72('0x52'),_0x265b7f[_0xcf72('0x27')]['id'],_0x4b42af);var _0x105380=path[_0xcf72('0x4e')](_0x49fb7f,_0x380480);var _0x1fd651=[];_0x1fd651['push']({'model':db[_0xcf72('0x53')],'as':_0xcf72('0x53'),'raw':!![]});var _0x391443=[{'model':db[_0xcf72('0x38')],'as':'Messages','attributes':['id',_0xcf72('0x34'),_0xcf72('0x54')],'include':_0x1fd651}];return db['FaxInteraction'][_0xcf72('0x32')]({'where':{'id':_0x265b7f[_0xcf72('0x27')]['id']},'include':_0x391443})[_0xcf72('0x1a')](handleEntityNotFound(_0x23a044,null))['then'](function(_0x13543c){if(_0x13543c&&_0x13543c[_0xcf72('0x55')]){var _0x532461=_0x13543c[_0xcf72('0x56')]({'plain':!![]});fs[_0xcf72('0x57')](_0x223196);for(var _0x4da941=0x0;_0x4da941<_0x532461[_0xcf72('0x55')][_0xcf72('0x58')];_0x4da941++){var _0x4009f9=_0x532461[_0xcf72('0x55')][_0x4da941][_0xcf72('0x53')];if(_0x4009f9){var _0x2e8c5c=path[_0xcf72('0x4e')](_0x23cd53,_0x4009f9[_0xcf72('0x59')]);if(fs['existsSync'](_0x2e8c5c)){fs['createReadStream'](_0x2e8c5c)[_0xcf72('0x5a')](fs['createWriteStream'](path['join'](_0x223196,_0x4009f9['basename'])));}}}return BPromise['resolve']()[_0xcf72('0x1a')](function(){return new BPromise(function(_0x31000a,_0x4827cb){zipdir(_0x223196,{'saveTo':_0x105380},function(_0x56ad5b,_0x43060b){if(_0x56ad5b)return _0x4827cb(_0x56ad5b);return _0x31000a(_0x43060b);});})[_0xcf72('0x1a')](function(){return new BPromise(function(_0x359c1a,_0x5966fc){rimraf(_0x223196,function(_0x5c0679){if(_0x5c0679)_0x5966fc(_0x5c0679);return _0x359c1a();});});})[_0xcf72('0x1a')](function(){return _0x23a044[_0xcf72('0x5b')](_0x105380,_0x380480,function(_0x1f0ad1){if(_0x1f0ad1){console[_0xcf72('0x5c')](_0xcf72('0x5d'),_0x1f0ad1);}else{fs[_0xcf72('0x5e')](_0x105380);}});});});}else{return _0x23a044['sendStatus'](0xc8);}})[_0xcf72('0x26')](handleError(_0x23a044,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index a86e680..ad6b3d0 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 _0xbf36=['FaxInteraction','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','findAll','then','length','catch','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x5bc18d,_0x4a1372){var _0x32a08e=function(_0x22d348){while(--_0x22d348){_0x5bc18d['push'](_0x5bc18d['shift']());}};_0x32a08e(++_0x4a1372);}(_0xbf36,0x1ee));var _0x6bf3=function(_0xff646,_0x5722cc){_0xff646=_0xff646-0x0;var _0x177504=_0xbf36[_0xff646];return _0x177504;};'use strict';var EventEmitter=require(_0x6bf3('0x0'));var FaxInteraction=require(_0x6bf3('0x1'))['db'][_0x6bf3('0x2')];var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x6bf3('0x3')](0x0);var events={'afterCreate':_0x6bf3('0x4'),'afterUpdate':_0x6bf3('0x5'),'afterDestroy':_0x6bf3('0x6')};function emitEvent(_0x5594e8){return function(_0x5e38f5,_0x351463,_0xa09766){_0x5e38f5[_0x6bf3('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3dae91){_0x5e38f5[_0x6bf3('0x8')](_0x6bf3('0x9'),_0x3dae91['map'](function(_0x42c1aa){return{'id':_0x42c1aa['id']};}));return FaxMessage[_0x6bf3('0xa')]({'where':{'FaxInteractionId':_0x5e38f5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6bf3('0xb')](function(_0x2c42c5){_0x5e38f5[_0x6bf3('0x8')]('unreadMessages',_0x2c42c5[_0x6bf3('0xc')]);FaxInteractionEvents['emit'](_0x5594e8+':'+_0x5e38f5['id'],_0x5e38f5);FaxInteractionEvents['emit'](_0x5594e8,_0x5e38f5);_0xa09766(null);})[_0x6bf3('0xd')](_0xa09766(null));};}for(var e in events){if(events[_0x6bf3('0xe')](e)){var event=events[e];FaxInteraction[_0x6bf3('0xf')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0xa2ea=['setDataValue','findAll','then','unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove','getUsers'];(function(_0x2eec08,_0x4085b9){var _0x2769d9=function(_0x7bb2cb){while(--_0x7bb2cb){_0x2eec08['push'](_0x2eec08['shift']());}};_0x2769d9(++_0x4085b9);}(_0xa2ea,0x158));var _0xaa2e=function(_0xe779,_0x1a1b29){_0xe779=_0xe779-0x0;var _0x5201de=_0xa2ea[_0xe779];return _0x5201de;};'use strict';var EventEmitter=require(_0xaa2e('0x0'));var FaxInteraction=require(_0xaa2e('0x1'))['db'][_0xaa2e('0x2')];var FaxMessage=require(_0xaa2e('0x1'))['db'][_0xaa2e('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xaa2e('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xaa2e('0x5'),'afterDestroy':_0xaa2e('0x6')};function emitEvent(_0x5177cd){return function(_0x4f652c,_0x2fc170,_0x2ea8ae){_0x4f652c[_0xaa2e('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x53b2ce){_0x4f652c[_0xaa2e('0x8')]('Users',_0x53b2ce['map'](function(_0x5c0bf9){return{'id':_0x5c0bf9['id']};}));return FaxMessage[_0xaa2e('0x9')]({'where':{'FaxInteractionId':_0x4f652c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xaa2e('0xa')](function(_0x5e81f6){_0x4f652c[_0xaa2e('0x8')](_0xaa2e('0xb'),_0x5e81f6[_0xaa2e('0xc')]);FaxInteractionEvents[_0xaa2e('0xd')](_0x5177cd+':'+_0x4f652c['id'],_0x4f652c);FaxInteractionEvents[_0xaa2e('0xd')](_0x5177cd,_0x4f652c);_0x2ea8ae(null);})['catch'](_0x2ea8ae(null));};}for(var e in events){if(events[_0xaa2e('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xaa2e('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 3f42366..8633595 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 _0xe256=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xe256,0x197));var _0x6e25=function(_0x515bb8,_0x333e51){_0x515bb8=_0x515bb8-0x0;var _0x3691b7=_0xe256[_0x515bb8];return _0x3691b7;};'use strict';var _=require(_0x6e25('0x0'));var util=require(_0x6e25('0x1'));var logger=require(_0x6e25('0x2'))('api');var moment=require(_0x6e25('0x3'));var BPromise=require(_0x6e25('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e25('0x5'));var rimraf=require(_0x6e25('0x6'));var config=require(_0x6e25('0x7'));var attributes=require(_0x6e25('0x8'));module[_0x6e25('0x9')]=function(_0x2e6b46,_0x213db8){return _0x2e6b46[_0x6e25('0xa')](_0x6e25('0xb'),attributes,{'tableName':_0x6e25('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5c9cf3,_0x595fef,_0x299d28){if(_0x5c9cf3[_0x6e25('0xd')](_0x6e25('0xe'))){_0x5c9cf3[_0x6e25('0xf')]=moment()['format'](_0x6e25('0x10'));}_0x299d28(null,_0x5c9cf3);}}});}; \ No newline at end of file +var _0x00c2=['format','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','changed','closed','closedAt'];(function(_0x580971,_0x10984d){var _0x16d873=function(_0x594084){while(--_0x594084){_0x580971['push'](_0x580971['shift']());}};_0x16d873(++_0x10984d);}(_0x00c2,0x6a));var _0x200c=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x00c2[_0x432682];return _0x463d05;};'use strict';var _=require(_0x200c('0x0'));var util=require(_0x200c('0x1'));var logger=require('../../config/logger')(_0x200c('0x2'));var moment=require('moment');var BPromise=require(_0x200c('0x3'));var rp=require(_0x200c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x200c('0x5'));var config=require(_0x200c('0x6'));var attributes=require(_0x200c('0x7'));module[_0x200c('0x8')]=function(_0xeda4ec,_0x89bb23){return _0xeda4ec[_0x200c('0x9')](_0x200c('0xa'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1bfd6b,_0x11c95d,_0x56fecb){if(_0x1bfd6b[_0x200c('0xb')](_0x200c('0xc'))){_0x1bfd6b[_0x200c('0xd')]=moment()[_0x200c('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x56fecb(null,_0x1bfd6b);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index e2d5f51..49e3dee 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 _0x2d7c=['addTags','body','ids','omit','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','request','then','info','FaxInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','UpdateFaxInteraction','options','raw','where','attributes','limit','AddTagsToFaxInteraction'];(function(_0x304e17,_0x1568ee){var _0x42a19c=function(_0x5b62d3){while(--_0x5b62d3){_0x304e17['push'](_0x304e17['shift']());}};_0x42a19c(++_0x1568ee);}(_0x2d7c,0x116));var _0xc2d7=function(_0x511e82,_0x5c8e7b){_0x511e82=_0x511e82-0x0;var _0x32bc8e=_0x2d7c[_0x511e82];return _0x32bc8e;};'use strict';var _=require(_0xc2d7('0x0'));var util=require('util');var moment=require(_0xc2d7('0x1'));var BPromise=require(_0xc2d7('0x2'));var rs=require(_0xc2d7('0x3'));var fs=require('fs');var Redis=require(_0xc2d7('0x4'));var db=require(_0xc2d7('0x5'))['db'];var utils=require(_0xc2d7('0x6'));var logger=require(_0xc2d7('0x7'))(_0xc2d7('0x8'));var config=require(_0xc2d7('0x9'));var jayson=require(_0xc2d7('0xa'));var client=jayson[_0xc2d7('0xb')][_0xc2d7('0xc')]({'port':0x232a});config[_0xc2d7('0xd')]=_['defaults'](config[_0xc2d7('0xd')],{'host':_0xc2d7('0xe'),'port':0x18eb});var socket=require(_0xc2d7('0xf'))(new Redis(config['redis']));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0xfc6303,_0x3f964a,_0xb0eed7){return new BPromise(function(_0x4bd5f1,_0x4894ef){return client[_0xc2d7('0x10')](_0xfc6303,_0xb0eed7)[_0xc2d7('0x11')](function(_0xcf5a76){logger[_0xc2d7('0x12')](_0xc2d7('0x13'),_0x3f964a,'request\x20sent');logger[_0xc2d7('0x14')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x3f964a,_0xc2d7('0x15'),JSON[_0xc2d7('0x16')](_0xcf5a76));if(_0xcf5a76[_0xc2d7('0x17')]){if(_0xcf5a76[_0xc2d7('0x17')][_0xc2d7('0x18')]===0x1f4){logger['error'](_0xc2d7('0x13'),_0x3f964a,_0xcf5a76[_0xc2d7('0x17')][_0xc2d7('0x19')]);return _0x4894ef(_0xcf5a76[_0xc2d7('0x17')][_0xc2d7('0x19')]);}logger[_0xc2d7('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x3f964a,_0xcf5a76[_0xc2d7('0x17')]['message']);return _0x4bd5f1(_0xcf5a76[_0xc2d7('0x17')][_0xc2d7('0x19')]);}else{logger[_0xc2d7('0x12')](_0xc2d7('0x13'),_0x3f964a,_0xc2d7('0x15'));_0x4bd5f1(_0xcf5a76['result'][_0xc2d7('0x19')]);}})[_0xc2d7('0x1a')](function(_0x1049b8){logger[_0xc2d7('0x17')](_0xc2d7('0x13'),_0x3f964a,_0x1049b8);_0x4894ef(_0x1049b8);});});}exports[_0xc2d7('0x1b')]=function(_0x3a59f2){var _0x18705b=this;return new Promise(function(_0x23a32a,_0x126b65){return db['FaxInteraction']['update'](_0x3a59f2['body'],{'raw':_0x3a59f2['options']?_0x3a59f2[_0xc2d7('0x1c')][_0xc2d7('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a59f2[_0xc2d7('0x1c')]?_0x3a59f2[_0xc2d7('0x1c')][_0xc2d7('0x1e')]||null:null,'attributes':_0x3a59f2[_0xc2d7('0x1c')]?_0x3a59f2[_0xc2d7('0x1c')][_0xc2d7('0x1f')]||null:null,'limit':_0x3a59f2[_0xc2d7('0x1c')]?_0x3a59f2[_0xc2d7('0x1c')][_0xc2d7('0x20')]||null:null})[_0xc2d7('0x11')](function(_0x112be5){logger[_0xc2d7('0x12')](_0xc2d7('0x1b'),_0x3a59f2);logger[_0xc2d7('0x14')](_0xc2d7('0x1b'),_0x3a59f2,JSON[_0xc2d7('0x16')](_0x112be5));_0x23a32a(_0x112be5);})[_0xc2d7('0x1a')](function(_0x21cf1c){logger[_0xc2d7('0x17')](_0xc2d7('0x1b'),_0x21cf1c['message'],_0x3a59f2);_0x126b65(_0x18705b[_0xc2d7('0x17')](0x1f4,_0x21cf1c[_0xc2d7('0x19')]));});});};exports[_0xc2d7('0x21')]=function(_0xc83cdd){return new Promise(function(_0x2172e8,_0x3f2da6){return db['FaxInteraction']['find']({'where':_0xc83cdd[_0xc2d7('0x1c')]?_0xc83cdd[_0xc2d7('0x1c')][_0xc2d7('0x1e')]||null:null})[_0xc2d7('0x11')](function(_0x332507){if(_0x332507){return _0x332507[_0xc2d7('0x22')](_0xc83cdd[_0xc2d7('0x23')][_0xc2d7('0x24')],_[_0xc2d7('0x25')](_0xc83cdd[_0xc2d7('0x23')],[_0xc2d7('0x24'),'id'])||{});}})['spread'](function(_0x1f9ac1){logger['info'](_0xc2d7('0x26'),_0xc83cdd);logger[_0xc2d7('0x14')](_0xc2d7('0x26'),_0xc83cdd,JSON['stringify'](_0x1f9ac1));_0x2172e8(_0x1f9ac1);})[_0xc2d7('0x1a')](function(_0x3d5405){logger[_0xc2d7('0x17')]('AddTags',_0x3d5405[_0xc2d7('0x19')],_0xc83cdd);_0x3f2da6(_this[_0xc2d7('0x17')](0x1f4,_0x3d5405['message']));});});}; \ No newline at end of file +var _0x4ec4=['register','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','result','UpdateFaxInteraction','FaxInteraction','options','raw','where','attributes','limit','catch','AddTagsToFaxInteraction','addTags','body','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x4ec4,0x1aa));var _0x44ec=function(_0x32fe5b,_0x464e33){_0x32fe5b=_0x32fe5b-0x0;var _0x2440e5=_0x4ec4[_0x32fe5b];return _0x2440e5;};'use strict';var _=require(_0x44ec('0x0'));var util=require(_0x44ec('0x1'));var moment=require('moment');var BPromise=require(_0x44ec('0x2'));var rs=require(_0x44ec('0x3'));var fs=require('fs');var Redis=require(_0x44ec('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x44ec('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x44ec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x44ec('0x7')][_0x44ec('0x8')]({'port':0x232a});config[_0x44ec('0x9')]=_[_0x44ec('0xa')](config[_0x44ec('0x9')],{'host':_0x44ec('0xb'),'port':0x18eb});var socket=require(_0x44ec('0xc'))(new Redis(config[_0x44ec('0x9')]));require(_0x44ec('0xd'))[_0x44ec('0xe')](socket);function respondWithRpcPromise(_0x1496ac,_0x5be5a2,_0x3a3e11){return new BPromise(function(_0x28a1ea,_0x1b231f){return client['request'](_0x1496ac,_0x3a3e11)[_0x44ec('0xf')](function(_0x5d782f){logger[_0x44ec('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x5be5a2,_0x44ec('0x11'));logger[_0x44ec('0x12')](_0x44ec('0x13'),_0x5be5a2,'request\x20sent',JSON[_0x44ec('0x14')](_0x5d782f));if(_0x5d782f[_0x44ec('0x15')]){if(_0x5d782f[_0x44ec('0x15')][_0x44ec('0x16')]===0x1f4){logger[_0x44ec('0x15')](_0x44ec('0x17'),_0x5be5a2,_0x5d782f['error'][_0x44ec('0x18')]);return _0x1b231f(_0x5d782f[_0x44ec('0x15')][_0x44ec('0x18')]);}logger['error'](_0x44ec('0x17'),_0x5be5a2,_0x5d782f[_0x44ec('0x15')][_0x44ec('0x18')]);return _0x28a1ea(_0x5d782f[_0x44ec('0x15')][_0x44ec('0x18')]);}else{logger[_0x44ec('0x10')](_0x44ec('0x17'),_0x5be5a2,_0x44ec('0x11'));_0x28a1ea(_0x5d782f[_0x44ec('0x19')]['message']);}})['catch'](function(_0x40d5b6){logger[_0x44ec('0x15')](_0x44ec('0x17'),_0x5be5a2,_0x40d5b6);_0x1b231f(_0x40d5b6);});});}exports[_0x44ec('0x1a')]=function(_0x3f8938){var _0x504cd1=this;return new Promise(function(_0x4816fd,_0x54d822){return db[_0x44ec('0x1b')]['update'](_0x3f8938['body'],{'raw':_0x3f8938['options']?_0x3f8938[_0x44ec('0x1c')][_0x44ec('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f8938[_0x44ec('0x1c')]?_0x3f8938['options'][_0x44ec('0x1e')]||null:null,'attributes':_0x3f8938[_0x44ec('0x1c')]?_0x3f8938[_0x44ec('0x1c')][_0x44ec('0x1f')]||null:null,'limit':_0x3f8938[_0x44ec('0x1c')]?_0x3f8938[_0x44ec('0x1c')][_0x44ec('0x20')]||null:null})[_0x44ec('0xf')](function(_0x2c99d3){logger[_0x44ec('0x10')](_0x44ec('0x1a'),_0x3f8938);logger['debug']('UpdateFaxInteraction',_0x3f8938,JSON[_0x44ec('0x14')](_0x2c99d3));_0x4816fd(_0x2c99d3);})[_0x44ec('0x21')](function(_0x46f0d9){logger[_0x44ec('0x15')](_0x44ec('0x1a'),_0x46f0d9[_0x44ec('0x18')],_0x3f8938);_0x54d822(_0x504cd1[_0x44ec('0x15')](0x1f4,_0x46f0d9['message']));});});};exports[_0x44ec('0x22')]=function(_0x137ae5){return new Promise(function(_0x126d3b,_0x24c0d1){return db[_0x44ec('0x1b')]['find']({'where':_0x137ae5[_0x44ec('0x1c')]?_0x137ae5[_0x44ec('0x1c')][_0x44ec('0x1e')]||null:null})[_0x44ec('0xf')](function(_0x15b39f){if(_0x15b39f){return _0x15b39f[_0x44ec('0x23')](_0x137ae5[_0x44ec('0x24')][_0x44ec('0x25')],_['omit'](_0x137ae5[_0x44ec('0x24')],[_0x44ec('0x25'),'id'])||{});}})[_0x44ec('0x26')](function(_0x594c28){logger[_0x44ec('0x10')]('AddTags',_0x137ae5);logger['debug']('AddTags',_0x137ae5,JSON[_0x44ec('0x14')](_0x594c28));_0x126d3b(_0x594c28);})[_0x44ec('0x21')](function(_0x145495){logger[_0x44ec('0x15')](_0x44ec('0x27'),_0x145495[_0x44ec('0x18')],_0x137ae5);_0x24c0d1(_this[_0x44ec('0x15')](0x1f4,_0x145495['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 76a3100..9ed57b4 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 _0xef5c=['register','length','faxInteraction:','./faxInteraction.events','save','remove','update','removeListener'];(function(_0x31c10d,_0x5aa26f){var _0x16d696=function(_0x32d35e){while(--_0x32d35e){_0x31c10d['push'](_0x31c10d['shift']());}};_0x16d696(++_0x5aa26f);}(_0xef5c,0xbb));var _0xcef5=function(_0x565e36,_0x550f47){_0x565e36=_0x565e36-0x0;var _0xe0260e=_0xef5c[_0x565e36];return _0xe0260e;};'use strict';var FaxInteractionEvents=require(_0xcef5('0x0'));var events=[_0xcef5('0x1'),_0xcef5('0x2'),_0xcef5('0x3')];function createListener(_0x235605,_0x20cf3f){return function(_0x3bb28d){_0x20cf3f['emit'](_0x235605,_0x3bb28d);};}function removeListener(_0x103435,_0x3a3b89){return function(){FaxInteractionEvents[_0xcef5('0x4')](_0x103435,_0x3a3b89);};}exports[_0xcef5('0x5')]=function(_0x43d5b2){for(var _0x114bac=0x0,_0x1170fb=events[_0xcef5('0x6')];_0x114bac<_0x1170fb;_0x114bac++){var _0x2677e3=events[_0x114bac];var _0x2089fb=createListener(_0xcef5('0x7')+_0x2677e3,_0x43d5b2);FaxInteractionEvents['on'](_0x2677e3,_0x2089fb);}}; \ No newline at end of file +var _0x2220=['remove','update','emit','removeListener','register','length','save'];(function(_0x195e4a,_0x2e769a){var _0x650a3a=function(_0x24197e){while(--_0x24197e){_0x195e4a['push'](_0x195e4a['shift']());}};_0x650a3a(++_0x2e769a);}(_0x2220,0xa0));var _0x0222=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x2220[_0x4b2863];return _0x567d67;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x0222('0x0'),_0x0222('0x1'),_0x0222('0x2')];function createListener(_0x3b91d6,_0x4f131c){return function(_0x2fecd0){_0x4f131c[_0x0222('0x3')](_0x3b91d6,_0x2fecd0);};}function removeListener(_0x2a4bdc,_0x34192d){return function(){FaxInteractionEvents[_0x0222('0x4')](_0x2a4bdc,_0x34192d);};}exports[_0x0222('0x5')]=function(_0x51e694){for(var _0x3b3e45=0x0,_0x46d8c8=events[_0x0222('0x6')];_0x3b3e45<_0x46d8c8;_0x3b3e45++){var _0x45faa9=events[_0x3b3e45];var _0x5187f8=createListener('faxInteraction:'+_0x45faa9,_0x51e694);FaxInteractionEvents['on'](_0x45faa9,_0x5187f8);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 1bd696d..985fed3 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 _0x5c6e=['update','delete','faxinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','fax','faxinteraction:addtags','addTags','put','tracked','faxinteraction:update'];(function(_0x2122f,_0x41c9d7){var _0x25924c=function(_0x4adc79){while(--_0x4adc79){_0x2122f['push'](_0x2122f['shift']());}};_0x25924c(++_0x41c9d7);}(_0x5c6e,0x11c));var _0xe5c6=function(_0x1d7037,_0x57dd95){_0x1d7037=_0x1d7037-0x0;var _0x4d6568=_0x5c6e[_0x1d7037];return _0x4d6568;};'use strict';var multer=require(_0xe5c6('0x0'));var util=require(_0xe5c6('0x1'));var path=require(_0xe5c6('0x2'));var timeout=require(_0xe5c6('0x3'));var express=require(_0xe5c6('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe5c6('0x5'));var controller=require(_0xe5c6('0x6'));router[_0xe5c6('0x7')]('/',auth[_0xe5c6('0x8')](),controller[_0xe5c6('0x9')]);router[_0xe5c6('0x7')]('/describe',auth[_0xe5c6('0x8')](),controller['describe']);router[_0xe5c6('0x7')](_0xe5c6('0xa'),auth[_0xe5c6('0x8')](),controller[_0xe5c6('0xb')]);router[_0xe5c6('0x7')]('/:id/messages',auth[_0xe5c6('0x8')](),controller[_0xe5c6('0xc')]);router[_0xe5c6('0x7')](_0xe5c6('0xd'),auth[_0xe5c6('0x8')](),controller[_0xe5c6('0xe')]);router[_0xe5c6('0xf')]('/',auth['isAuthenticated'](),controller[_0xe5c6('0x10')]);router[_0xe5c6('0xf')](_0xe5c6('0x11'),auth['isAuthenticated'](),controller[_0xe5c6('0x12')]);router[_0xe5c6('0xf')](_0xe5c6('0x13'),auth[_0xe5c6('0x8')](),interaction['tracked'](_0xe5c6('0x14'),_0xe5c6('0x15')),controller[_0xe5c6('0x16')]);router[_0xe5c6('0x17')]('/:id',auth['isAuthenticated'](),interaction[_0xe5c6('0x18')](_0xe5c6('0x14'),_0xe5c6('0x19')),controller[_0xe5c6('0x1a')]);router[_0xe5c6('0x1b')](_0xe5c6('0xa'),auth[_0xe5c6('0x8')](),interaction[_0xe5c6('0x18')]('fax',_0xe5c6('0x1c')),controller[_0xe5c6('0x1d')]);router['delete']('/:id/tags',auth[_0xe5c6('0x8')](),controller['removeTags']);module[_0xe5c6('0x1e')]=router; \ No newline at end of file +var _0x5272=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','describe','/:id','show','getMessages','download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','faxinteraction:destroy','destroy','removeTags','exports','util','path'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5272,0xde));var _0x2527=function(_0x19ba9f,_0x52f705){_0x19ba9f=_0x19ba9f-0x0;var _0x3e930d=_0x5272[_0x19ba9f];return _0x3e930d;};'use strict';var multer=require('multer');var util=require(_0x2527('0x0'));var path=require(_0x2527('0x1'));var timeout=require(_0x2527('0x2'));var express=require(_0x2527('0x3'));var router=express[_0x2527('0x4')]();var fs_extra=require(_0x2527('0x5'));var auth=require(_0x2527('0x6'));var interaction=require(_0x2527('0x7'));var config=require(_0x2527('0x8'));var controller=require(_0x2527('0x9'));router[_0x2527('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x2527('0xb')](),controller[_0x2527('0xc')]);router[_0x2527('0xa')](_0x2527('0xd'),auth['isAuthenticated'](),controller[_0x2527('0xe')]);router[_0x2527('0xa')]('/:id/messages',auth['isAuthenticated'](),controller[_0x2527('0xf')]);router[_0x2527('0xa')]('/:id/download',auth[_0x2527('0xb')](),controller[_0x2527('0x10')]);router[_0x2527('0x11')]('/',auth['isAuthenticated'](),controller[_0x2527('0x12')]);router['post']('/:id/messages',auth[_0x2527('0xb')](),controller[_0x2527('0x13')]);router[_0x2527('0x11')](_0x2527('0x14'),auth[_0x2527('0xb')](),interaction[_0x2527('0x15')](_0x2527('0x16'),_0x2527('0x17')),controller[_0x2527('0x18')]);router[_0x2527('0x19')](_0x2527('0xd'),auth[_0x2527('0xb')](),interaction['tracked'](_0x2527('0x16'),_0x2527('0x1a')),controller[_0x2527('0x1b')]);router['delete'](_0x2527('0xd'),auth['isAuthenticated'](),interaction['tracked'](_0x2527('0x16'),_0x2527('0x1c')),controller[_0x2527('0x1d')]);router['delete']('/:id/tags',auth[_0x2527('0xb')](),controller[_0x2527('0x1e')]);module[_0x2527('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 bd02c79..5c3ebfd 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 _0xe3ee=['out','DATE','TEXT','medium'];(function(_0xf086a2,_0x44f469){var _0x5ca86f=function(_0x19a3dd){while(--_0x19a3dd){_0xf086a2['push'](_0xf086a2['shift']());}};_0x5ca86f(++_0x44f469);}(_0xe3ee,0x116));var _0xee3e=function(_0x10cf8c,_0x15488c){_0x10cf8c=_0x10cf8c-0x0;var _0x53b810=_0xe3ee[_0x10cf8c];return _0x53b810;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xee3e('0x0')](_0xee3e('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xee3e('0x2')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xee3e('0x3')]}}; \ No newline at end of file +var _0xe3ee=['out','DATE','TEXT','medium'];(function(_0xbda4c7,_0x4e3cf9){var _0x1660e9=function(_0x12dd26){while(--_0x12dd26){_0xbda4c7['push'](_0xbda4c7['shift']());}};_0x1660e9(++_0x4e3cf9);}(_0xe3ee,0x116));var _0xee3e=function(_0x3c091a,_0x27c569){_0x3c091a=_0x3c091a-0x0;var _0x192387=_0xe3ee[_0x3c091a];return _0x192387;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xee3e('0x0')](_0xee3e('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xee3e('0x2')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xee3e('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 550d003..5067c6b 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 _0xdbd3=['EventManager','fax-interactions','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','fullname','email','interface','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','root','server','files','attachments','download','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','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','redis','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','map','FaxMessage','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','where','merge','include','findAll','rows','params','keys','rawAttributes','length','includeAll','options','find','catch','body','describe','accept','fax','UserId','user','agent','FaxInteraction','FaxInteractionId','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','get','role','interaction','null','AcceptMessage','acceptMessage','sequelize','QueryTypes','SELECT','contact','User','internal','SIP/%s','channel','event'];(function(_0x410895,_0x1afef3){var _0x5acf7e=function(_0x400893){while(--_0x400893){_0x410895['push'](_0x410895['shift']());}};_0x5acf7e(++_0x1afef3);}(_0xdbd3,0x141));var _0x3dbd=function(_0x5f49c0,_0x27a1b4){_0x5f49c0=_0x5f49c0-0x0;var _0x5ab653=_0xdbd3[_0x5f49c0];return _0x5ab653;};'use strict';var emlformat=require(_0x3dbd('0x0'));var rimraf=require(_0x3dbd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3dbd('0x2'));var rp=require(_0x3dbd('0x3'));var moment=require(_0x3dbd('0x4'));var BPromise=require(_0x3dbd('0x5'));var Mustache=require(_0x3dbd('0x6'));var util=require('util');var path=require('path');var sox=require(_0x3dbd('0x7'));var csv=require(_0x3dbd('0x8'));var ejs=require(_0x3dbd('0x9'));var fs=require('fs');var fs_extra=require(_0x3dbd('0xa'));var _=require('lodash');var squel=require(_0x3dbd('0xb'));var crypto=require(_0x3dbd('0xc'));var jsforce=require(_0x3dbd('0xd'));var deskjs=require(_0x3dbd('0xe'));var toCsv=require(_0x3dbd('0x8'));var querystring=require(_0x3dbd('0xf'));var Papa=require(_0x3dbd('0x10'));var Redis=require('ioredis');var authService=require(_0x3dbd('0x11'));var qs=require(_0x3dbd('0x12'));var as=require(_0x3dbd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3dbd('0x14'))(_0x3dbd('0x15'));var utils=require(_0x3dbd('0x16'));var config=require(_0x3dbd('0x17'));var licenseUtil=require(_0x3dbd('0x18'));var db=require(_0x3dbd('0x19'))['db'];config['redis']=_['defaults'](config[_0x3dbd('0x1a')],{'host':_0x3dbd('0x1b'),'port':0x18eb});var socket=require(_0x3dbd('0x1c'))(new Redis(config[_0x3dbd('0x1a')]));require(_0x3dbd('0x1d'))['register'](socket);var jayson=require(_0x3dbd('0x1e'));var client=jayson[_0x3dbd('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x3dbd('0x1f')][_0x3dbd('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x344909,_0x29ac1f,_0x20bce9,_0x20b31b){return new BPromise(function(_0x129212,_0x12b8a5){var _0x29f648=_0x20b31b||client;return _0x29f648[_0x3dbd('0x21')](_0x344909,_0x20bce9)[_0x3dbd('0x22')](function(_0x35ce7a){logger['info'](_0x3dbd('0x23'),_0x29ac1f,_0x3dbd('0x24'));logger[_0x3dbd('0x25')](_0x3dbd('0x26'),_0x29ac1f,_0x3dbd('0x24'),JSON[_0x3dbd('0x27')](_0x35ce7a));if(_0x35ce7a[_0x3dbd('0x28')]){if(_0x35ce7a['error'][_0x3dbd('0x29')]===0x1f4){logger[_0x3dbd('0x28')]('FaxMessage,\x20%s,\x20%s',_0x29ac1f,_0x35ce7a[_0x3dbd('0x28')]['message']);return _0x12b8a5(_0x35ce7a[_0x3dbd('0x28')]['message']);}logger[_0x3dbd('0x28')]('FaxMessage,\x20%s,\x20%s',_0x29ac1f,_0x35ce7a['error'][_0x3dbd('0x2a')]);return _0x129212(_0x35ce7a[_0x3dbd('0x28')]['message']);}else{logger[_0x3dbd('0x2b')](_0x3dbd('0x23'),_0x29ac1f,_0x3dbd('0x24'));_0x129212(_0x35ce7a[_0x3dbd('0x2c')]['message']);}})['catch'](function(_0x3802a3){logger[_0x3dbd('0x28')](_0x3dbd('0x23'),_0x29ac1f,_0x3802a3);_0x12b8a5(_0x3802a3);});});}function respondWithStatusCode(_0x221d14,_0x28d714){_0x28d714=_0x28d714||0xcc;return function(_0x4b5457){if(_0x4b5457){return _0x221d14[_0x3dbd('0x2d')](_0x28d714);}return _0x221d14[_0x3dbd('0x2e')](_0x28d714)[_0x3dbd('0x2f')]();};}function respondWithResult(_0x3910d1,_0x3bbb35){_0x3bbb35=_0x3bbb35||0xc8;return function(_0x47a758){if(_0x47a758){return _0x3910d1[_0x3dbd('0x2e')](_0x3bbb35)['json'](_0x47a758);}};}function respondWithFilteredResult(_0x4b8c2b,_0x5cf798){return function(_0x3a9d6a){if(_0x3a9d6a){var _0x2cf29d=typeof _0x5cf798[_0x3dbd('0x30')]==='undefined'&&typeof _0x5cf798[_0x3dbd('0x31')]===_0x3dbd('0x32');var _0x45b64a=_0x3a9d6a[_0x3dbd('0x33')];var _0xa9c128=_0x2cf29d?0x0:_0x5cf798[_0x3dbd('0x30')];var _0x3c1aa4=_0x2cf29d?_0x3a9d6a[_0x3dbd('0x33')]:_0x5cf798[_0x3dbd('0x30')]+_0x5cf798[_0x3dbd('0x31')];var _0x25cc3f;if(_0x3c1aa4>=_0x45b64a){_0x3c1aa4=_0x45b64a;_0x25cc3f=0xc8;}else{_0x25cc3f=0xce;}_0x4b8c2b[_0x3dbd('0x2e')](_0x25cc3f);return _0x4b8c2b[_0x3dbd('0x34')](_0x3dbd('0x35'),_0xa9c128+'-'+_0x3c1aa4+'/'+_0x45b64a)[_0x3dbd('0x36')](_0x3a9d6a);}return null;};}function patchUpdates(_0x45ed0d){return function(_0x353113){try{jsonpatch[_0x3dbd('0x37')](_0x353113,_0x45ed0d,!![]);}catch(_0x3bf79b){return BPromise[_0x3dbd('0x38')](_0x3bf79b);}return _0x353113[_0x3dbd('0x39')]();};}function saveUpdates(_0x2f67b9,_0x1b33d3){return function(_0x2a8408){if(_0x2a8408){return _0x2a8408[_0x3dbd('0x3a')](_0x2f67b9)[_0x3dbd('0x22')](function(_0x433960){return _0x433960;});}return null;};}function removeEntity(_0x32ea48,_0x10fb92){return function(_0x431bd0){if(_0x431bd0){return _0x431bd0[_0x3dbd('0x3b')]()['then'](function(){_0x32ea48[_0x3dbd('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c2eed,_0x4f16db){return function(_0x2ca8d4){if(!_0x2ca8d4){_0x5c2eed[_0x3dbd('0x2d')](0x194);}return _0x2ca8d4;};}function handleError(_0x648029,_0x900fd5){_0x900fd5=_0x900fd5||0x1f4;return function(_0x177e08){logger[_0x3dbd('0x28')](_0x177e08[_0x3dbd('0x3c')]);if(_0x177e08[_0x3dbd('0x3d')]){delete _0x177e08[_0x3dbd('0x3d')];}_0x648029[_0x3dbd('0x2e')](_0x900fd5)[_0x3dbd('0x3e')](_0x177e08);};}exports['index']=function(_0x392e42,_0x21a125){var _0x562387={},_0x31a277={},_0x5aa0fc={'count':0x0,'rows':[]};var _0x46e751=_[_0x3dbd('0x3f')](db[_0x3dbd('0x40')]['rawAttributes'],function(_0x17e038){return{'name':_0x17e038[_0x3dbd('0x41')],'type':_0x17e038[_0x3dbd('0x42')][_0x3dbd('0x43')]};});_0x31a277[_0x3dbd('0x44')]=_['map'](_0x46e751,_0x3dbd('0x3d'));_0x31a277[_0x3dbd('0x45')]=_['keys'](_0x392e42[_0x3dbd('0x45')]);_0x31a277[_0x3dbd('0x46')]=_[_0x3dbd('0x47')](_0x31a277[_0x3dbd('0x44')],_0x31a277[_0x3dbd('0x45')]);_0x562387['attributes']=_['intersection'](_0x31a277['model'],qs[_0x3dbd('0x48')](_0x392e42['query'][_0x3dbd('0x48')]));_0x562387['attributes']=_0x562387[_0x3dbd('0x49')]['length']?_0x562387['attributes']:_0x31a277['model'];if(!_0x392e42[_0x3dbd('0x45')]['hasOwnProperty'](_0x3dbd('0x4a'))){_0x562387[_0x3dbd('0x31')]=qs[_0x3dbd('0x31')](_0x392e42[_0x3dbd('0x45')]['limit']);_0x562387[_0x3dbd('0x30')]=qs[_0x3dbd('0x30')](_0x392e42[_0x3dbd('0x45')][_0x3dbd('0x30')]);}_0x562387[_0x3dbd('0x4b')]=qs['sort'](_0x392e42[_0x3dbd('0x45')][_0x3dbd('0x4c')]);_0x562387['where']=qs['filters'](_[_0x3dbd('0x4d')](_0x392e42[_0x3dbd('0x45')],_0x31a277[_0x3dbd('0x46')]),_0x46e751);if(_0x392e42['query'][_0x3dbd('0x4e')]){_0x562387[_0x3dbd('0x4f')]=_[_0x3dbd('0x50')](_0x562387[_0x3dbd('0x4f')],{'$or':_[_0x3dbd('0x3f')](_0x46e751,function(_0x3b8467){if(_0x3b8467['type']!=='VIRTUAL'){var _0x49d95d={};_0x49d95d[_0x3b8467['name']]={'$like':'%'+_0x392e42['query'][_0x3dbd('0x4e')]+'%'};return _0x49d95d;}})});}_0x562387=_['merge']({},_0x562387,_0x392e42['options']);var _0x1bd347={'where':_0x562387['where']};return db['FaxMessage'][_0x3dbd('0x33')](_0x1bd347)['then'](function(_0x935fb3){_0x5aa0fc['count']=_0x935fb3;if(_0x392e42[_0x3dbd('0x45')]['includeAll']){_0x562387[_0x3dbd('0x51')]=[{'all':!![]}];}return db[_0x3dbd('0x40')][_0x3dbd('0x52')](_0x562387);})['then'](function(_0x45459b){_0x5aa0fc[_0x3dbd('0x53')]=_0x45459b;return _0x5aa0fc;})[_0x3dbd('0x22')](respondWithFilteredResult(_0x21a125,_0x562387))['catch'](handleError(_0x21a125,null));};exports['show']=function(_0x51ad6f,_0x4ad37d){var _0x24ef8d={'raw':!![],'where':{'id':_0x51ad6f[_0x3dbd('0x54')]['id']}},_0x572f79={};_0x572f79[_0x3dbd('0x44')]=_[_0x3dbd('0x55')](db[_0x3dbd('0x40')][_0x3dbd('0x56')]);_0x572f79[_0x3dbd('0x45')]=_[_0x3dbd('0x55')](_0x51ad6f[_0x3dbd('0x45')]);_0x572f79[_0x3dbd('0x46')]=_[_0x3dbd('0x47')](_0x572f79[_0x3dbd('0x44')],_0x572f79[_0x3dbd('0x45')]);_0x24ef8d[_0x3dbd('0x49')]=_[_0x3dbd('0x47')](_0x572f79[_0x3dbd('0x44')],qs[_0x3dbd('0x48')](_0x51ad6f[_0x3dbd('0x45')][_0x3dbd('0x48')]));_0x24ef8d[_0x3dbd('0x49')]=_0x24ef8d[_0x3dbd('0x49')][_0x3dbd('0x57')]?_0x24ef8d['attributes']:_0x572f79[_0x3dbd('0x44')];if(_0x51ad6f['query'][_0x3dbd('0x58')]){_0x24ef8d['include']=[{'all':!![]}];}_0x24ef8d=_['merge']({},_0x24ef8d,_0x51ad6f[_0x3dbd('0x59')]);return db[_0x3dbd('0x40')][_0x3dbd('0x5a')](_0x24ef8d)[_0x3dbd('0x22')](handleEntityNotFound(_0x4ad37d,null))[_0x3dbd('0x22')](respondWithResult(_0x4ad37d,null))[_0x3dbd('0x5b')](handleError(_0x4ad37d,null));};exports[_0x3dbd('0x3a')]=function(_0x43f25c,_0x53ce7a){if(_0x43f25c[_0x3dbd('0x5c')]['id']){delete _0x43f25c[_0x3dbd('0x5c')]['id'];}return db[_0x3dbd('0x40')][_0x3dbd('0x5a')]({'where':{'id':_0x43f25c['params']['id']}})[_0x3dbd('0x22')](handleEntityNotFound(_0x53ce7a,null))[_0x3dbd('0x22')](saveUpdates(_0x43f25c[_0x3dbd('0x5c')],null))[_0x3dbd('0x22')](respondWithResult(_0x53ce7a,null))['catch'](handleError(_0x53ce7a,null));};exports[_0x3dbd('0x3b')]=function(_0xc31956,_0x25e9a8){return db['FaxMessage'][_0x3dbd('0x5a')]({'where':{'id':_0xc31956[_0x3dbd('0x54')]['id']}})[_0x3dbd('0x22')](handleEntityNotFound(_0x25e9a8,null))[_0x3dbd('0x22')](removeEntity(_0x25e9a8,null))['catch'](handleError(_0x25e9a8,null));};exports[_0x3dbd('0x5d')]=function(_0x158f6f,_0x2f1dc0){return db[_0x3dbd('0x40')][_0x3dbd('0x5d')]()[_0x3dbd('0x22')](respondWithResult(_0x2f1dc0,null))[_0x3dbd('0x5b')](handleError(_0x2f1dc0,null));};var interaction_log=require(_0x3dbd('0x14'))('fax-interactions');exports[_0x3dbd('0x5e')]=function(_0x2c6b86,_0x32e636,_0x486ad4){var _0x1fcd3c={'agent':{},'channel':_0x3dbd('0x5f')};if(_0x2c6b86[_0x3dbd('0x5c')]['id']){delete _0x2c6b86[_0x3dbd('0x5c')]['id'];}_0x2c6b86[_0x3dbd('0x5c')]['read']=!![];_0x2c6b86[_0x3dbd('0x5c')]['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2c6b86[_0x3dbd('0x5c')][_0x3dbd('0x60')]=_0x2c6b86[_0x3dbd('0x5c')][_0x3dbd('0x60')]||_0x2c6b86[_0x3dbd('0x61')]['id'];_0x1fcd3c[_0x3dbd('0x62')]['id']=_0x2c6b86[_0x3dbd('0x5c')][_0x3dbd('0x60')];return db[_0x3dbd('0x40')]['find']({'where':{'id':_0x2c6b86[_0x3dbd('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x32e636,null))[_0x3dbd('0x22')](saveUpdates(_0x2c6b86[_0x3dbd('0x5c')],null))[_0x3dbd('0x22')](function(_0x560ae4){if(_0x560ae4){_0x1fcd3c['message']=_0x560ae4['get']({'plain':!![]});return db[_0x3dbd('0x63')][_0x3dbd('0x5a')]({'where':{'id':_0x560ae4[_0x3dbd('0x64')]}});}return null;})[_0x3dbd('0x22')](handleEntityNotFound(_0x32e636,null))[_0x3dbd('0x22')](function(_0x3ff90c){if(_0x3ff90c){return _0x3ff90c[_0x3dbd('0x3a')]({'UserId':_0x2c6b86['body']['UserId'],'read1stAt':_[_0x3dbd('0x65')](_0x3ff90c[_0x3dbd('0x66')])?moment()[_0x3dbd('0x67')](_0x3dbd('0x68')):undefined});}return null;})['then'](function(_0x169daf){if(_0x169daf){_0x1fcd3c['interaction']=_0x169daf[_0x3dbd('0x69')]({'plain':!![]});interaction_log[_0x3dbd('0x2b')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2c6b86['user']['id'],_0x2c6b86[_0x3dbd('0x61')][_0x3dbd('0x3d')],_0x2c6b86[_0x3dbd('0x61')][_0x3dbd('0x6a')],_0x1fcd3c[_0x3dbd('0x6b')]['id'],_0x2c6b86[_0x3dbd('0x5c')]?JSON[_0x3dbd('0x27')](_0x2c6b86['body']):_0x3dbd('0x6c'));return respondWithRpcPromise(_0x3dbd('0x6d'),_0x3dbd('0x6e'),_0x1fcd3c);}return null;})[_0x3dbd('0x22')](function(_0x267ea9){var _0x3d637e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x267ea9['message']['ContactId'];return db[_0x3dbd('0x6f')][_0x3dbd('0x45')](_0x3d637e,{'type':db['Sequelize'][_0x3dbd('0x70')][_0x3dbd('0x71')],'raw':!![]})[_0x3dbd('0x22')](function(_0x3e4329){return _0x3e4329;});})['then'](function(_0x54c654){if(_0x54c654){_0x1fcd3c[_0x3dbd('0x2a')][_0x3dbd('0x72')]=_0x54c654[0x0];if(!_0x2c6b86[_0x3dbd('0x5c')][_0x3dbd('0x60')])return;return db[_0x3dbd('0x73')]['find']({'where':{'id':_0x2c6b86[_0x3dbd('0x5c')][_0x3dbd('0x60')],'role':'agent'},'attributes':['id',_0x3dbd('0x3d'),'fullname','email',_0x3dbd('0x74')],'raw':!![]});}return null;})[_0x3dbd('0x22')](function(_0x6a465d){if(!_0x6a465d)return null;_0x1fcd3c[_0x3dbd('0x2a')]['agent']=_0x6a465d;return _0x1fcd3c;})['then'](function(_0x21ece9){if(_0x21ece9){if(_0x2c6b86['body']['manual']){_0x1fcd3c[_0x3dbd('0x2a')]['interface']=util[_0x3dbd('0x67')](_0x3dbd('0x75'),_0x2c6b86[_0x3dbd('0x61')][_0x3dbd('0x3d')]);_0x1fcd3c[_0x3dbd('0x2a')]['channel']=_0x1fcd3c['channel'];_0x1fcd3c['message']['motionChannel']=_0x1fcd3c[_0x3dbd('0x76')];_0x1fcd3c[_0x3dbd('0x2a')][_0x3dbd('0x77')]=_0x3dbd('0x5e');return respondWithRpcPromise('EventManager',_0x3dbd('0x78'),{'event':'acceptmessage','message':_0x1fcd3c['message']},client9002)['then'](function(){return _0x1fcd3c;});}return _0x1fcd3c;}return null;})[_0x3dbd('0x22')](respondWithResult(_0x32e636,null))['catch'](handleError(_0x32e636,null));};var interaction_log=require(_0x3dbd('0x14'))(_0x3dbd('0x79'));exports[_0x3dbd('0x38')]=function(_0x4da74b,_0x2fbd33,_0x2b202f){var _0x86852={'agent':{},'channel':'fax'};if(_0x4da74b[_0x3dbd('0x5c')]['id']){delete _0x4da74b['body']['id'];}_0x4da74b['body'][_0x3dbd('0x60')]=_0x4da74b[_0x3dbd('0x5c')][_0x3dbd('0x60')]||_0x4da74b[_0x3dbd('0x61')]['id'];_0x86852['agent']['id']=_0x4da74b[_0x3dbd('0x5c')][_0x3dbd('0x60')];return db[_0x3dbd('0x40')]['find']({'where':{'id':_0x4da74b[_0x3dbd('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2fbd33,null))[_0x3dbd('0x22')](function(_0x4e90c6){if(_0x4e90c6){_0x86852['message']=_0x4e90c6[_0x3dbd('0x69')]({'plain':!![]});return db[_0x3dbd('0x63')][_0x3dbd('0x5a')]({'where':{'id':_0x4e90c6[_0x3dbd('0x64')]}});}return null;})[_0x3dbd('0x22')](handleEntityNotFound(_0x2fbd33,null))['then'](function(_0x33c9f3){if(_0x33c9f3){_0x86852['interaction']=_0x33c9f3[_0x3dbd('0x69')]({'plain':!![]});interaction_log[_0x3dbd('0x2b')](_0x3dbd('0x7a'),_0x4da74b[_0x3dbd('0x61')]['id'],_0x4da74b[_0x3dbd('0x61')][_0x3dbd('0x3d')],_0x4da74b[_0x3dbd('0x61')][_0x3dbd('0x6a')],_0x86852[_0x3dbd('0x6b')]['id'],_0x4da74b['body']?JSON[_0x3dbd('0x27')](_0x4da74b['body']):_0x3dbd('0x6c'));return respondWithRpcPromise(_0x3dbd('0x7b'),_0x3dbd('0x7c'),_0x86852);}return null;})[_0x3dbd('0x22')](function(_0x337b7f){var _0x1a994d=_0x3dbd('0x7d')+_0x337b7f['message'][_0x3dbd('0x7e')];return db['sequelize'][_0x3dbd('0x45')](_0x1a994d,{'type':db[_0x3dbd('0x7f')][_0x3dbd('0x70')][_0x3dbd('0x71')],'raw':!![]})[_0x3dbd('0x22')](function(_0x4ee6d2){return _0x4ee6d2;});})['then'](function(_0x281f17){if(_0x281f17){_0x86852[_0x3dbd('0x2a')]['contact']=_0x281f17[0x0];if(!_0x4da74b['body'][_0x3dbd('0x60')])return;return db['User'][_0x3dbd('0x5a')]({'where':{'id':_0x4da74b[_0x3dbd('0x5c')]['UserId'],'role':_0x3dbd('0x62')},'attributes':['id',_0x3dbd('0x3d'),_0x3dbd('0x80'),_0x3dbd('0x81'),'internal'],'raw':!![]});}return null;})['then'](function(_0x1c369b){if(!_0x1c369b)return null;_0x86852['message'][_0x3dbd('0x62')]=_0x1c369b;return _0x86852;})[_0x3dbd('0x22')](function(_0x16f649){if(_0x16f649){_0x16f649['message'][_0x3dbd('0x82')]=util[_0x3dbd('0x67')](_0x3dbd('0x75'),_0x4da74b[_0x3dbd('0x61')][_0x3dbd('0x3d')]);_0x16f649[_0x3dbd('0x2a')][_0x3dbd('0x76')]=_0x86852[_0x3dbd('0x76')];_0x16f649[_0x3dbd('0x2a')]['motionChannel']=_0x86852[_0x3dbd('0x76')];_0x16f649[_0x3dbd('0x2a')][_0x3dbd('0x77')]=_0x3dbd('0x38');respondWithRpcPromise(_0x3dbd('0x78'),_0x3dbd('0x78'),{'event':_0x3dbd('0x83'),'message':_0x16f649['message']},client9002);return _0x86852;}return null;})[_0x3dbd('0x22')](respondWithResult(_0x2fbd33,null))[_0x3dbd('0x5b')](handleError(_0x2fbd33,null));};exports[_0x3dbd('0x84')]=function(_0x343eaf,_0x2cc5c7){var _0x53dcb7;return db[_0x3dbd('0x40')][_0x3dbd('0x84')](_0x343eaf['body'],{})[_0x3dbd('0x22')](function(_0x492288){_0x53dcb7=_0x492288;return db[_0x3dbd('0x85')][_0x3dbd('0x86')]({'where':{'id':_0x53dcb7[_0x3dbd('0x7e')]}});})[_0x3dbd('0x22')](function(_0x5d3f1d){if(_['isNil'](_0x5d3f1d)){return;}else{_0x53dcb7['fax']=_0x5d3f1d[_0x3dbd('0x5f')];return db[_0x3dbd('0x87')][_0x3dbd('0x86')]({'where':{'id':_0x53dcb7[_0x3dbd('0x88')]}});}})[_0x3dbd('0x22')](function(_0x56c2de){return respondWithRpcPromise(_0x3dbd('0x89'),_0x3dbd('0x89'),{'FaxAccountId':_[_0x3dbd('0x65')](_0x343eaf[_0x3dbd('0x5c')])?undefined:_0x343eaf[_0x3dbd('0x5c')][_0x3dbd('0x8a')],'path':_[_0x3dbd('0x65')](_0x56c2de)?undefined:util[_0x3dbd('0x67')](_0x3dbd('0x8b'),_0x56c2de[_0x3dbd('0x8c')]),'fax':_[_0x3dbd('0x65')](_0x53dcb7[_0x3dbd('0x5f')])?undefined:_0x53dcb7[_0x3dbd('0x5f')],'AttachmentId':_0x53dcb7['AttachmentId']},client9002);})[_0x3dbd('0x22')](respondWithResult(_0x2cc5c7,0xc9))['catch'](handleError(_0x2cc5c7,null));};exports['download']=function(_0x5f10b1,_0x3aa9f4){var _0x29cd01=path[_0x3dbd('0x8d')](config[_0x3dbd('0x8e')],_0x3dbd('0x8f'),_0x3dbd('0x90'),_0x3dbd('0x91'));return db['FaxMessage'][_0x3dbd('0x5a')]({'where':{'id':_0x5f10b1[_0x3dbd('0x54')]['id']},'include':[{'model':db[_0x3dbd('0x87')],'as':_0x3dbd('0x87')}]})[_0x3dbd('0x22')](handleEntityNotFound(_0x3aa9f4,null))[_0x3dbd('0x22')](function(_0x22b6fb){if(_0x22b6fb){return _0x3aa9f4[_0x3dbd('0x92')](path['join'](_0x29cd01,_0x22b6fb[_0x3dbd('0x87')]['basename']));}})[_0x3dbd('0x5b')](handleError(_0x3aa9f4,null));}; \ No newline at end of file +var _0xbfda=['files','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','offset','undefined','count','limit','apply','reject','destroy','sendStatus','stack','name','send','index','map','FaxMessage','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','filters','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','show','rawAttributes','include','options','find','update','body','params','describe','../../config/logger','fax-interactions','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteraction','FaxInteractionId','interaction','[FAXMESSAGE: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','QueryTypes','contact','User','agent','fullname','email','internal','interface','motionChannel','channel','event','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','SIP/%s','EventManager','rejectmessage','create','CmContact','findOne','isNil','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','server'];(function(_0x58a4fe,_0x11d439){var _0x697de2=function(_0xe38c14){while(--_0xe38c14){_0x58a4fe['push'](_0x58a4fe['shift']());}};_0x697de2(++_0x11d439);}(_0xbfda,0x1ab));var _0xabfd=function(_0x397bfb,_0x589665){_0x397bfb=_0x397bfb-0x0;var _0x16c9b9=_0xbfda[_0x397bfb];return _0x16c9b9;};'use strict';var emlformat=require(_0xabfd('0x0'));var rimraf=require(_0xabfd('0x1'));var zipdir=require(_0xabfd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xabfd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xabfd('0x4'));var util=require(_0xabfd('0x5'));var path=require(_0xabfd('0x6'));var sox=require('sox');var csv=require(_0xabfd('0x7'));var ejs=require(_0xabfd('0x8'));var fs=require('fs');var fs_extra=require(_0xabfd('0x9'));var _=require(_0xabfd('0xa'));var squel=require(_0xabfd('0xb'));var crypto=require('crypto');var jsforce=require(_0xabfd('0xc'));var deskjs=require(_0xabfd('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xabfd('0xe'));var Redis=require(_0xabfd('0xf'));var authService=require(_0xabfd('0x10'));var qs=require(_0xabfd('0x11'));var as=require(_0xabfd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xabfd('0x13'));var config=require(_0xabfd('0x14'));var licenseUtil=require(_0xabfd('0x15'));var db=require(_0xabfd('0x16'))['db'];config[_0xabfd('0x17')]=_[_0xabfd('0x18')](config[_0xabfd('0x17')],{'host':_0xabfd('0x19'),'port':0x18eb});var socket=require(_0xabfd('0x1a'))(new Redis(config[_0xabfd('0x17')]));require('./faxMessage.socket')[_0xabfd('0x1b')](socket);var jayson=require(_0xabfd('0x1c'));var client=jayson[_0xabfd('0x1d')][_0xabfd('0x1e')]({'port':0x232c});var client9002=jayson[_0xabfd('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41316e,_0x4add9f,_0x224193,_0x20ba7f){return new BPromise(function(_0x2cf85e,_0x494352){var _0x2081c1=_0x20ba7f||client;return _0x2081c1[_0xabfd('0x1f')](_0x41316e,_0x224193)[_0xabfd('0x20')](function(_0x1ffa37){logger[_0xabfd('0x21')](_0xabfd('0x22'),_0x4add9f,_0xabfd('0x23'));logger[_0xabfd('0x24')](_0xabfd('0x25'),_0x4add9f,_0xabfd('0x23'),JSON[_0xabfd('0x26')](_0x1ffa37));if(_0x1ffa37[_0xabfd('0x27')]){if(_0x1ffa37['error'][_0xabfd('0x28')]===0x1f4){logger[_0xabfd('0x27')](_0xabfd('0x22'),_0x4add9f,_0x1ffa37['error']['message']);return _0x494352(_0x1ffa37[_0xabfd('0x27')][_0xabfd('0x29')]);}logger[_0xabfd('0x27')]('FaxMessage,\x20%s,\x20%s',_0x4add9f,_0x1ffa37[_0xabfd('0x27')][_0xabfd('0x29')]);return _0x2cf85e(_0x1ffa37[_0xabfd('0x27')][_0xabfd('0x29')]);}else{logger[_0xabfd('0x21')](_0xabfd('0x22'),_0x4add9f,_0xabfd('0x23'));_0x2cf85e(_0x1ffa37[_0xabfd('0x2a')][_0xabfd('0x29')]);}})[_0xabfd('0x2b')](function(_0x4fdbaa){logger[_0xabfd('0x27')](_0xabfd('0x22'),_0x4add9f,_0x4fdbaa);_0x494352(_0x4fdbaa);});});}function respondWithStatusCode(_0x1f5571,_0x5e7edf){_0x5e7edf=_0x5e7edf||0xcc;return function(_0x2ae5d1){if(_0x2ae5d1){return _0x1f5571['sendStatus'](_0x5e7edf);}return _0x1f5571['status'](_0x5e7edf)[_0xabfd('0x2c')]();};}function respondWithResult(_0x1339bd,_0x232f97){_0x232f97=_0x232f97||0xc8;return function(_0x5da0dd){if(_0x5da0dd){return _0x1339bd[_0xabfd('0x2d')](_0x232f97)[_0xabfd('0x2e')](_0x5da0dd);}};}function respondWithFilteredResult(_0xaf3b46,_0x29fc74){return function(_0x1b3f56){if(_0x1b3f56){var _0x247e54=typeof _0x29fc74[_0xabfd('0x2f')]===_0xabfd('0x30')&&typeof _0x29fc74['limit']==='undefined';var _0x18995c=_0x1b3f56[_0xabfd('0x31')];var _0x3f2eaa=_0x247e54?0x0:_0x29fc74[_0xabfd('0x2f')];var _0x3f88d4=_0x247e54?_0x1b3f56[_0xabfd('0x31')]:_0x29fc74[_0xabfd('0x2f')]+_0x29fc74[_0xabfd('0x32')];var _0x1c5f3f;if(_0x3f88d4>=_0x18995c){_0x3f88d4=_0x18995c;_0x1c5f3f=0xc8;}else{_0x1c5f3f=0xce;}_0xaf3b46[_0xabfd('0x2d')](_0x1c5f3f);return _0xaf3b46['set']('Content-Range',_0x3f2eaa+'-'+_0x3f88d4+'/'+_0x18995c)[_0xabfd('0x2e')](_0x1b3f56);}return null;};}function patchUpdates(_0x37e9db){return function(_0x1b96e7){try{jsonpatch[_0xabfd('0x33')](_0x1b96e7,_0x37e9db,!![]);}catch(_0x35c784){return BPromise[_0xabfd('0x34')](_0x35c784);}return _0x1b96e7['save']();};}function saveUpdates(_0x1fba6d,_0x2402af){return function(_0x5e1277){if(_0x5e1277){return _0x5e1277['update'](_0x1fba6d)[_0xabfd('0x20')](function(_0x11c7a0){return _0x11c7a0;});}return null;};}function removeEntity(_0x1bef3b,_0x371302){return function(_0x44a127){if(_0x44a127){return _0x44a127[_0xabfd('0x35')]()[_0xabfd('0x20')](function(){_0x1bef3b[_0xabfd('0x2d')](0xcc)[_0xabfd('0x2c')]();});}};}function handleEntityNotFound(_0x43e2cf,_0x16c1d0){return function(_0x229fde){if(!_0x229fde){_0x43e2cf[_0xabfd('0x36')](0x194);}return _0x229fde;};}function handleError(_0x71df86,_0x106475){_0x106475=_0x106475||0x1f4;return function(_0x415aa7){logger[_0xabfd('0x27')](_0x415aa7[_0xabfd('0x37')]);if(_0x415aa7[_0xabfd('0x38')]){delete _0x415aa7[_0xabfd('0x38')];}_0x71df86[_0xabfd('0x2d')](_0x106475)[_0xabfd('0x39')](_0x415aa7);};}exports[_0xabfd('0x3a')]=function(_0x5acc14,_0x51bb2c){var _0x3b3860={},_0x137ce6={},_0x21af5a={'count':0x0,'rows':[]};var _0x26c746=_[_0xabfd('0x3b')](db[_0xabfd('0x3c')]['rawAttributes'],function(_0x36679b){return{'name':_0x36679b[_0xabfd('0x3d')],'type':_0x36679b[_0xabfd('0x3e')][_0xabfd('0x3f')]};});_0x137ce6[_0xabfd('0x40')]=_[_0xabfd('0x3b')](_0x26c746,_0xabfd('0x38'));_0x137ce6[_0xabfd('0x41')]=_[_0xabfd('0x42')](_0x5acc14['query']);_0x137ce6['filters']=_[_0xabfd('0x43')](_0x137ce6[_0xabfd('0x40')],_0x137ce6[_0xabfd('0x41')]);_0x3b3860[_0xabfd('0x44')]=_[_0xabfd('0x43')](_0x137ce6[_0xabfd('0x40')],qs['fields'](_0x5acc14[_0xabfd('0x41')][_0xabfd('0x45')]));_0x3b3860[_0xabfd('0x44')]=_0x3b3860[_0xabfd('0x44')]['length']?_0x3b3860[_0xabfd('0x44')]:_0x137ce6[_0xabfd('0x40')];if(!_0x5acc14[_0xabfd('0x41')][_0xabfd('0x46')](_0xabfd('0x47'))){_0x3b3860[_0xabfd('0x32')]=qs[_0xabfd('0x32')](_0x5acc14[_0xabfd('0x41')][_0xabfd('0x32')]);_0x3b3860[_0xabfd('0x2f')]=qs[_0xabfd('0x2f')](_0x5acc14[_0xabfd('0x41')][_0xabfd('0x2f')]);}_0x3b3860['order']=qs['sort'](_0x5acc14[_0xabfd('0x41')]['sort']);_0x3b3860['where']=qs[_0xabfd('0x48')](_[_0xabfd('0x49')](_0x5acc14[_0xabfd('0x41')],_0x137ce6[_0xabfd('0x48')]),_0x26c746);if(_0x5acc14[_0xabfd('0x41')][_0xabfd('0x4a')]){_0x3b3860[_0xabfd('0x4b')]=_[_0xabfd('0x4c')](_0x3b3860[_0xabfd('0x4b')],{'$or':_['map'](_0x26c746,function(_0x9a071e){if(_0x9a071e[_0xabfd('0x3e')]!==_0xabfd('0x4d')){var _0x2d22c5={};_0x2d22c5[_0x9a071e['name']]={'$like':'%'+_0x5acc14[_0xabfd('0x41')][_0xabfd('0x4a')]+'%'};return _0x2d22c5;}})});}_0x3b3860=_[_0xabfd('0x4c')]({},_0x3b3860,_0x5acc14['options']);var _0x55be66={'where':_0x3b3860['where']};return db[_0xabfd('0x3c')]['count'](_0x55be66)[_0xabfd('0x20')](function(_0x1afee6){_0x21af5a['count']=_0x1afee6;if(_0x5acc14[_0xabfd('0x41')][_0xabfd('0x4e')]){_0x3b3860['include']=[{'all':!![]}];}return db['FaxMessage'][_0xabfd('0x4f')](_0x3b3860);})[_0xabfd('0x20')](function(_0x1a774d){_0x21af5a[_0xabfd('0x50')]=_0x1a774d;return _0x21af5a;})[_0xabfd('0x20')](respondWithFilteredResult(_0x51bb2c,_0x3b3860))[_0xabfd('0x2b')](handleError(_0x51bb2c,null));};exports[_0xabfd('0x51')]=function(_0x26958c,_0xe07366){var _0x34fa94={'raw':!![],'where':{'id':_0x26958c['params']['id']}},_0x3d23e7={};_0x3d23e7[_0xabfd('0x40')]=_[_0xabfd('0x42')](db[_0xabfd('0x3c')][_0xabfd('0x52')]);_0x3d23e7[_0xabfd('0x41')]=_[_0xabfd('0x42')](_0x26958c[_0xabfd('0x41')]);_0x3d23e7[_0xabfd('0x48')]=_[_0xabfd('0x43')](_0x3d23e7['model'],_0x3d23e7[_0xabfd('0x41')]);_0x34fa94[_0xabfd('0x44')]=_[_0xabfd('0x43')](_0x3d23e7[_0xabfd('0x40')],qs['fields'](_0x26958c[_0xabfd('0x41')][_0xabfd('0x45')]));_0x34fa94['attributes']=_0x34fa94[_0xabfd('0x44')]['length']?_0x34fa94['attributes']:_0x3d23e7[_0xabfd('0x40')];if(_0x26958c[_0xabfd('0x41')]['includeAll']){_0x34fa94[_0xabfd('0x53')]=[{'all':!![]}];}_0x34fa94=_[_0xabfd('0x4c')]({},_0x34fa94,_0x26958c[_0xabfd('0x54')]);return db[_0xabfd('0x3c')][_0xabfd('0x55')](_0x34fa94)['then'](handleEntityNotFound(_0xe07366,null))[_0xabfd('0x20')](respondWithResult(_0xe07366,null))[_0xabfd('0x2b')](handleError(_0xe07366,null));};exports[_0xabfd('0x56')]=function(_0x52e84b,_0x1ff536){if(_0x52e84b[_0xabfd('0x57')]['id']){delete _0x52e84b[_0xabfd('0x57')]['id'];}return db['FaxMessage'][_0xabfd('0x55')]({'where':{'id':_0x52e84b['params']['id']}})[_0xabfd('0x20')](handleEntityNotFound(_0x1ff536,null))[_0xabfd('0x20')](saveUpdates(_0x52e84b['body'],null))[_0xabfd('0x20')](respondWithResult(_0x1ff536,null))['catch'](handleError(_0x1ff536,null));};exports[_0xabfd('0x35')]=function(_0x5e7ea5,_0x24f011){return db['FaxMessage']['find']({'where':{'id':_0x5e7ea5[_0xabfd('0x58')]['id']}})['then'](handleEntityNotFound(_0x24f011,null))[_0xabfd('0x20')](removeEntity(_0x24f011,null))['catch'](handleError(_0x24f011,null));};exports[_0xabfd('0x59')]=function(_0x484f60,_0x34489c){return db[_0xabfd('0x3c')][_0xabfd('0x59')]()[_0xabfd('0x20')](respondWithResult(_0x34489c,null))['catch'](handleError(_0x34489c,null));};var interaction_log=require(_0xabfd('0x5a'))(_0xabfd('0x5b'));exports[_0xabfd('0x5c')]=function(_0x518062,_0x402a27,_0xb3c51){var _0x54ffaf={'agent':{},'channel':_0xabfd('0x5d')};if(_0x518062[_0xabfd('0x57')]['id']){delete _0x518062[_0xabfd('0x57')]['id'];}_0x518062['body'][_0xabfd('0x5e')]=!![];_0x518062[_0xabfd('0x57')]['readAt']=moment()[_0xabfd('0x5f')](_0xabfd('0x60'));_0x518062[_0xabfd('0x57')]['UserId']=_0x518062[_0xabfd('0x57')][_0xabfd('0x61')]||_0x518062[_0xabfd('0x62')]['id'];_0x54ffaf['agent']['id']=_0x518062[_0xabfd('0x57')]['UserId'];return db[_0xabfd('0x3c')][_0xabfd('0x55')]({'where':{'id':_0x518062['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x402a27,null))[_0xabfd('0x20')](saveUpdates(_0x518062['body'],null))[_0xabfd('0x20')](function(_0x5c84a0){if(_0x5c84a0){_0x54ffaf['message']=_0x5c84a0[_0xabfd('0x63')]({'plain':!![]});return db[_0xabfd('0x64')]['find']({'where':{'id':_0x5c84a0[_0xabfd('0x65')]}});}return null;})[_0xabfd('0x20')](handleEntityNotFound(_0x402a27,null))[_0xabfd('0x20')](function(_0x2fe850){if(_0x2fe850){return _0x2fe850[_0xabfd('0x56')]({'UserId':_0x518062['body']['UserId'],'read1stAt':_['isNil'](_0x2fe850['read1stAt'])?moment()['format'](_0xabfd('0x60')):undefined});}return null;})['then'](function(_0x549c50){if(_0x549c50){_0x54ffaf[_0xabfd('0x66')]=_0x549c50[_0xabfd('0x63')]({'plain':!![]});interaction_log[_0xabfd('0x21')](_0xabfd('0x67'),_0x518062[_0xabfd('0x62')]['id'],_0x518062[_0xabfd('0x62')]['name'],_0x518062['user']['role'],_0x54ffaf[_0xabfd('0x66')]['id'],_0x518062['body']?JSON[_0xabfd('0x26')](_0x518062['body']):_0xabfd('0x68'));return respondWithRpcPromise(_0xabfd('0x69'),_0xabfd('0x6a'),_0x54ffaf);}return null;})[_0xabfd('0x20')](function(_0x2d081c){var _0x4e9353=_0xabfd('0x6b')+_0x2d081c[_0xabfd('0x29')][_0xabfd('0x6c')];return db[_0xabfd('0x6d')]['query'](_0x4e9353,{'type':db['Sequelize'][_0xabfd('0x6e')]['SELECT'],'raw':!![]})[_0xabfd('0x20')](function(_0x4d4b5a){return _0x4d4b5a;});})[_0xabfd('0x20')](function(_0x35398f){if(_0x35398f){_0x54ffaf[_0xabfd('0x29')][_0xabfd('0x6f')]=_0x35398f[0x0];if(!_0x518062[_0xabfd('0x57')][_0xabfd('0x61')])return;return db[_0xabfd('0x70')][_0xabfd('0x55')]({'where':{'id':_0x518062[_0xabfd('0x57')][_0xabfd('0x61')],'role':_0xabfd('0x71')},'attributes':['id','name',_0xabfd('0x72'),_0xabfd('0x73'),_0xabfd('0x74')],'raw':!![]});}return null;})[_0xabfd('0x20')](function(_0x1273b2){if(!_0x1273b2)return null;_0x54ffaf['message'][_0xabfd('0x71')]=_0x1273b2;return _0x54ffaf;})[_0xabfd('0x20')](function(_0x14bb4d){if(_0x14bb4d){if(_0x518062[_0xabfd('0x57')]['manual']){_0x54ffaf['message'][_0xabfd('0x75')]=util['format']('SIP/%s',_0x518062[_0xabfd('0x62')][_0xabfd('0x38')]);_0x54ffaf[_0xabfd('0x29')]['channel']=_0x54ffaf['channel'];_0x54ffaf[_0xabfd('0x29')][_0xabfd('0x76')]=_0x54ffaf[_0xabfd('0x77')];_0x54ffaf[_0xabfd('0x29')][_0xabfd('0x78')]=_0xabfd('0x5c');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x54ffaf[_0xabfd('0x29')]},client9002)[_0xabfd('0x20')](function(){return _0x54ffaf;});}return _0x54ffaf;}return null;})[_0xabfd('0x20')](respondWithResult(_0x402a27,null))[_0xabfd('0x2b')](handleError(_0x402a27,null));};var interaction_log=require(_0xabfd('0x5a'))(_0xabfd('0x5b'));exports[_0xabfd('0x34')]=function(_0x43e850,_0xac46e5,_0x1b0a58){var _0x6e4410={'agent':{},'channel':_0xabfd('0x5d')};if(_0x43e850[_0xabfd('0x57')]['id']){delete _0x43e850['body']['id'];}_0x43e850[_0xabfd('0x57')]['UserId']=_0x43e850[_0xabfd('0x57')][_0xabfd('0x61')]||_0x43e850[_0xabfd('0x62')]['id'];_0x6e4410[_0xabfd('0x71')]['id']=_0x43e850[_0xabfd('0x57')][_0xabfd('0x61')];return db['FaxMessage'][_0xabfd('0x55')]({'where':{'id':_0x43e850[_0xabfd('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xac46e5,null))[_0xabfd('0x20')](function(_0x5a5d6b){if(_0x5a5d6b){_0x6e4410[_0xabfd('0x29')]=_0x5a5d6b['get']({'plain':!![]});return db[_0xabfd('0x64')][_0xabfd('0x55')]({'where':{'id':_0x5a5d6b[_0xabfd('0x65')]}});}return null;})['then'](handleEntityNotFound(_0xac46e5,null))[_0xabfd('0x20')](function(_0x11d6c9){if(_0x11d6c9){_0x6e4410['interaction']=_0x11d6c9['get']({'plain':!![]});interaction_log['info'](_0xabfd('0x79'),_0x43e850[_0xabfd('0x62')]['id'],_0x43e850[_0xabfd('0x62')][_0xabfd('0x38')],_0x43e850['user']['role'],_0x6e4410['interaction']['id'],_0x43e850[_0xabfd('0x57')]?JSON[_0xabfd('0x26')](_0x43e850[_0xabfd('0x57')]):_0xabfd('0x68'));return respondWithRpcPromise(_0xabfd('0x7a'),_0xabfd('0x7b'),_0x6e4410);}return null;})[_0xabfd('0x20')](function(_0x369612){var _0x7241d7=_0xabfd('0x6b')+_0x369612[_0xabfd('0x29')][_0xabfd('0x6c')];return db[_0xabfd('0x6d')]['query'](_0x7241d7,{'type':db['Sequelize'][_0xabfd('0x6e')][_0xabfd('0x7c')],'raw':!![]})['then'](function(_0x419f98){return _0x419f98;});})[_0xabfd('0x20')](function(_0x13f5f4){if(_0x13f5f4){_0x6e4410[_0xabfd('0x29')][_0xabfd('0x6f')]=_0x13f5f4[0x0];if(!_0x43e850[_0xabfd('0x57')][_0xabfd('0x61')])return;return db[_0xabfd('0x70')][_0xabfd('0x55')]({'where':{'id':_0x43e850[_0xabfd('0x57')][_0xabfd('0x61')],'role':_0xabfd('0x71')},'attributes':['id',_0xabfd('0x38'),_0xabfd('0x72'),_0xabfd('0x73'),_0xabfd('0x74')],'raw':!![]});}return null;})['then'](function(_0x217201){if(!_0x217201)return null;_0x6e4410[_0xabfd('0x29')]['agent']=_0x217201;return _0x6e4410;})[_0xabfd('0x20')](function(_0x52b6bb){if(_0x52b6bb){_0x52b6bb[_0xabfd('0x29')][_0xabfd('0x75')]=util[_0xabfd('0x5f')](_0xabfd('0x7d'),_0x43e850[_0xabfd('0x62')]['name']);_0x52b6bb[_0xabfd('0x29')][_0xabfd('0x77')]=_0x6e4410[_0xabfd('0x77')];_0x52b6bb[_0xabfd('0x29')][_0xabfd('0x76')]=_0x6e4410[_0xabfd('0x77')];_0x52b6bb[_0xabfd('0x29')][_0xabfd('0x78')]='reject';respondWithRpcPromise(_0xabfd('0x7e'),_0xabfd('0x7e'),{'event':_0xabfd('0x7f'),'message':_0x52b6bb['message']},client9002);return _0x6e4410;}return null;})['then'](respondWithResult(_0xac46e5,null))[_0xabfd('0x2b')](handleError(_0xac46e5,null));};exports[_0xabfd('0x80')]=function(_0x472475,_0x2772e3){var _0x49d2bd;return db['FaxMessage']['create'](_0x472475[_0xabfd('0x57')],{})[_0xabfd('0x20')](function(_0x27c843){_0x49d2bd=_0x27c843;return db[_0xabfd('0x81')][_0xabfd('0x82')]({'where':{'id':_0x49d2bd[_0xabfd('0x6c')]}});})[_0xabfd('0x20')](function(_0x27039a){if(_[_0xabfd('0x83')](_0x27039a)){return;}else{_0x49d2bd[_0xabfd('0x5d')]=_0x27039a[_0xabfd('0x5d')];return db[_0xabfd('0x84')][_0xabfd('0x82')]({'where':{'id':_0x49d2bd['AttachmentId']}});}})['then'](function(_0x3c251e){return respondWithRpcPromise(_0xabfd('0x85'),_0xabfd('0x85'),{'FaxAccountId':_[_0xabfd('0x83')](_0x472475['body'])?undefined:_0x472475[_0xabfd('0x57')][_0xabfd('0x86')],'path':_[_0xabfd('0x83')](_0x3c251e)?undefined:util[_0xabfd('0x5f')](_0xabfd('0x87'),_0x3c251e[_0xabfd('0x88')]),'fax':_[_0xabfd('0x83')](_0x49d2bd['fax'])?undefined:_0x49d2bd[_0xabfd('0x5d')],'AttachmentId':_0x49d2bd[_0xabfd('0x89')]},client9002);})['then'](respondWithResult(_0x2772e3,0xc9))['catch'](handleError(_0x2772e3,null));};exports[_0xabfd('0x8a')]=function(_0x523da9,_0x2997b5){var _0x47537b=path[_0xabfd('0x8b')](config['root'],_0xabfd('0x8c'),_0xabfd('0x8d'),'attachments');return db[_0xabfd('0x3c')]['find']({'where':{'id':_0x523da9[_0xabfd('0x58')]['id']},'include':[{'model':db[_0xabfd('0x84')],'as':_0xabfd('0x84')}]})[_0xabfd('0x20')](handleEntityNotFound(_0x2997b5,null))[_0xabfd('0x20')](function(_0x4346fa){if(_0x4346fa){return _0x2997b5['download'](path[_0xabfd('0x8b')](_0x47537b,_0x4346fa[_0xabfd('0x84')][_0xabfd('0x88')]));}})[_0xabfd('0x2b')](handleError(_0x2997b5,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 0d62ef5..05c9e57 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 _0x2af8=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','FaxMessage'];(function(_0x1f0ad7,_0xbdbf69){var _0xc907ef=function(_0x8bc3ef){while(--_0x8bc3ef){_0x1f0ad7['push'](_0x1f0ad7['shift']());}};_0xc907ef(++_0xbdbf69);}(_0x2af8,0xf6));var _0x82af=function(_0x1eae9e,_0x28746e){_0x1eae9e=_0x1eae9e-0x0;var _0x49e6d4=_0x2af8[_0x1eae9e];return _0x49e6d4;};'use strict';var EventEmitter=require(_0x82af('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x82af('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x82af('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x82af('0x3'),'afterDestroy':_0x82af('0x4')};function emitEvent(_0x5f107e){return function(_0x29c672,_0x4a8c15,_0xafdd39){FaxMessageEvents[_0x82af('0x5')](_0x5f107e+':'+_0x29c672['id'],_0x29c672);FaxMessageEvents['emit'](_0x5f107e,_0x29c672);_0xafdd39(null);};}for(var e in events){if(events[_0x82af('0x6')](e)){var event=events[e];FaxMessage[_0x82af('0x7')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x5fdc=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners','save'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x5fdc,0x127));var _0xc5fd=function(_0x3a268e,_0x45ca06){_0x3a268e=_0x3a268e-0x0;var _0x2835c8=_0x5fdc[_0x3a268e];return _0x2835c8;};'use strict';var EventEmitter=require(_0xc5fd('0x0'));var FaxMessage=require(_0xc5fd('0x1'))['db'][_0xc5fd('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc5fd('0x3')](0x0);var events={'afterCreate':_0xc5fd('0x4'),'afterUpdate':_0xc5fd('0x5'),'afterDestroy':_0xc5fd('0x6')};function emitEvent(_0x4d015c){return function(_0xfdf928,_0x1b6205,_0xca27a0){FaxMessageEvents[_0xc5fd('0x7')](_0x4d015c+':'+_0xfdf928['id'],_0xfdf928);FaxMessageEvents[_0xc5fd('0x7')](_0x4d015c,_0xfdf928);_0xca27a0(null);};}for(var e in events){if(events[_0xc5fd('0x8')](e)){var event=events[e];FaxMessage[_0xc5fd('0x9')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index c87f11d..8736aaf 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 _0xd549=['then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxMessage.attributes','exports','fax_messages','fti_fax_messages','FULLTEXT','direction','toLowerCase','secret','isNil','UserId','FaxInteraction'];(function(_0x55fb83,_0x1d3856){var _0x59a87a=function(_0x38bdd1){while(--_0x38bdd1){_0x55fb83['push'](_0x55fb83['shift']());}};_0x59a87a(++_0x1d3856);}(_0xd549,0xce));var _0x9d54=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xd549[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x9d54('0x0'));var util=require('util');var logger=require(_0x9d54('0x1'))(_0x9d54('0x2'));var moment=require(_0x9d54('0x3'));var BPromise=require(_0x9d54('0x4'));var rp=require(_0x9d54('0x5'));var fs=require('fs');var path=require(_0x9d54('0x6'));var rimraf=require(_0x9d54('0x7'));var config=require('../../config/environment');var attributes=require(_0x9d54('0x8'));module[_0x9d54('0x9')]=function(_0x302046,_0x34696c){return _0x302046['define']('FaxMessage',attributes,{'tableName':_0x9d54('0xa'),'paranoid':![],'indexes':[{'name':_0x9d54('0xb'),'fields':['body'],'type':_0x9d54('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x33b213,_0x591e04,_0x5b418d){var _0x2e600b=_0x302046['models'];var _0x2eaf59=_0x33b213['get']({'plain':!![]});if(_0x2eaf59[_0x9d54('0xd')][_0x9d54('0xe')]()==='in'||_0x2eaf59[_0x9d54('0xd')]['toLowerCase']()==='out'&&!_0x2eaf59[_0x9d54('0xf')]&&!_[_0x9d54('0x10')](_0x2eaf59[_0x9d54('0x11')])){_0x2e600b[_0x9d54('0x12')]['findOne']({'where':{'id':_0x2eaf59['FaxInteractionId']}})[_0x9d54('0x13')](function(_0x14defc){if(_0x14defc){_0x14defc['update']({'lastMsgAt':_0x2eaf59[_0x9d54('0x14')],'lastMsgDirection':_0x2eaf59['direction'][_0x9d54('0xe')]()});}})[_0x9d54('0x15')](function(_0x5d00e3){console[_0x9d54('0x16')](_0x5d00e3);});}_0x5b418d();}},'charset':_0x9d54('0x17'),'collate':_0x9d54('0x18')});}; \ No newline at end of file +var _0xeb40=['FaxInteractionId','then','update','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','fax_messages','fti_fax_messages','FULLTEXT','get','direction','toLowerCase','out','isNil','findOne'];(function(_0x53b5a0,_0x17c9a8){var _0x300f8c=function(_0x69a548){while(--_0x69a548){_0x53b5a0['push'](_0x53b5a0['shift']());}};_0x300f8c(++_0x17c9a8);}(_0xeb40,0x87));var _0x0eb4=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0xeb40[_0x2faddb];return _0x273c05;};'use strict';var _=require(_0x0eb4('0x0'));var util=require(_0x0eb4('0x1'));var logger=require(_0x0eb4('0x2'))(_0x0eb4('0x3'));var moment=require(_0x0eb4('0x4'));var BPromise=require(_0x0eb4('0x5'));var rp=require(_0x0eb4('0x6'));var fs=require('fs');var path=require(_0x0eb4('0x7'));var rimraf=require(_0x0eb4('0x8'));var config=require(_0x0eb4('0x9'));var attributes=require(_0x0eb4('0xa'));module[_0x0eb4('0xb')]=function(_0xfe5bd4,_0x4d6eb7){return _0xfe5bd4['define']('FaxMessage',attributes,{'tableName':_0x0eb4('0xc'),'paranoid':![],'indexes':[{'name':_0x0eb4('0xd'),'fields':['body'],'type':_0x0eb4('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x18804d,_0x2b1a84,_0x191ac2){var _0x3ecc5e=_0xfe5bd4['models'];var _0x22982a=_0x18804d[_0x0eb4('0xf')]({'plain':!![]});if(_0x22982a[_0x0eb4('0x10')][_0x0eb4('0x11')]()==='in'||_0x22982a[_0x0eb4('0x10')][_0x0eb4('0x11')]()===_0x0eb4('0x12')&&!_0x22982a['secret']&&!_[_0x0eb4('0x13')](_0x22982a['UserId'])){_0x3ecc5e['FaxInteraction'][_0x0eb4('0x14')]({'where':{'id':_0x22982a[_0x0eb4('0x15')]}})[_0x0eb4('0x16')](function(_0x33c82f){if(_0x33c82f){_0x33c82f[_0x0eb4('0x17')]({'lastMsgAt':_0x22982a['createdAt'],'lastMsgDirection':_0x22982a[_0x0eb4('0x10')]['toLowerCase']()});}})['catch'](function(_0x5b0642){console[_0x0eb4('0x18')](_0x5b0642);});}_0x191ac2();}},'charset':_0x0eb4('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 7dd7851..236a5d9 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 _0xbec5=['then','info','request\x20sent','debug','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','catch','CreateFaxMessage','FaxMessage','create','body','options','UpdateFaxMessage','update','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket'];(function(_0x2069d8,_0x580879){var _0x257db3=function(_0x65aef4){while(--_0x65aef4){_0x2069d8['push'](_0x2069d8['shift']());}};_0x257db3(++_0x580879);}(_0xbec5,0xe5));var _0x5bec=function(_0x11f5ff,_0xa0ef18){_0x11f5ff=_0x11f5ff-0x0;var _0x46eefb=_0xbec5[_0x11f5ff];return _0x46eefb;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var moment=require('moment');var BPromise=require(_0x5bec('0x2'));var rs=require(_0x5bec('0x3'));var fs=require('fs');var Redis=require(_0x5bec('0x4'));var db=require(_0x5bec('0x5'))['db'];var utils=require(_0x5bec('0x6'));var logger=require('../../config/logger')(_0x5bec('0x7'));var config=require(_0x5bec('0x8'));var jayson=require(_0x5bec('0x9'));var client=jayson['client'][_0x5bec('0xa')]({'port':0x232a});config[_0x5bec('0xb')]=_[_0x5bec('0xc')](config[_0x5bec('0xb')],{'host':_0x5bec('0xd'),'port':0x18eb});var socket=require(_0x5bec('0xe'))(new Redis(config[_0x5bec('0xb')]));require(_0x5bec('0xf'))['register'](socket);function respondWithRpcPromise(_0x41a827,_0x5c2d67,_0x748f75){return new BPromise(function(_0x2a70a7,_0x117162){return client['request'](_0x41a827,_0x748f75)[_0x5bec('0x10')](function(_0x18fa47){logger[_0x5bec('0x11')]('FaxMessage,\x20%s,\x20%s',_0x5c2d67,_0x5bec('0x12'));logger[_0x5bec('0x13')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x5c2d67,_0x5bec('0x12'),JSON[_0x5bec('0x14')](_0x18fa47));if(_0x18fa47[_0x5bec('0x15')]){if(_0x18fa47[_0x5bec('0x15')][_0x5bec('0x16')]===0x1f4){logger[_0x5bec('0x15')](_0x5bec('0x17'),_0x5c2d67,_0x18fa47[_0x5bec('0x15')][_0x5bec('0x18')]);return _0x117162(_0x18fa47[_0x5bec('0x15')][_0x5bec('0x18')]);}logger[_0x5bec('0x15')](_0x5bec('0x17'),_0x5c2d67,_0x18fa47['error']['message']);return _0x2a70a7(_0x18fa47[_0x5bec('0x15')][_0x5bec('0x18')]);}else{logger[_0x5bec('0x11')](_0x5bec('0x17'),_0x5c2d67,'request\x20sent');_0x2a70a7(_0x18fa47['result'][_0x5bec('0x18')]);}})[_0x5bec('0x19')](function(_0x4e0191){logger[_0x5bec('0x15')](_0x5bec('0x17'),_0x5c2d67,_0x4e0191);_0x117162(_0x4e0191);});});}exports[_0x5bec('0x1a')]=function(_0x593786){var _0x554f9f=this;return new Promise(function(_0xab397b,_0x5be91c){return db[_0x5bec('0x1b')][_0x5bec('0x1c')](_0x593786[_0x5bec('0x1d')],{'raw':_0x593786[_0x5bec('0x1e')]?_0x593786[_0x5bec('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x5bec('0x10')](function(_0x4cfcb8){logger[_0x5bec('0x11')](_0x5bec('0x1a'),_0x593786);logger['debug'](_0x5bec('0x1a'),_0x593786,JSON[_0x5bec('0x14')](_0x4cfcb8));_0xab397b(_0x4cfcb8);})['catch'](function(_0x45afb7){logger[_0x5bec('0x15')](_0x5bec('0x1a'),_0x45afb7[_0x5bec('0x18')],_0x593786);_0x5be91c(_0x554f9f[_0x5bec('0x15')](0x1f4,_0x45afb7[_0x5bec('0x18')]));});});};exports[_0x5bec('0x1f')]=function(_0x4de66a){var _0x5b63ab=this;return new Promise(function(_0x5e44b3,_0x2961bd){return db[_0x5bec('0x1b')][_0x5bec('0x20')](_0x4de66a['body'],{'raw':_0x4de66a[_0x5bec('0x1e')]?_0x4de66a[_0x5bec('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4de66a[_0x5bec('0x1e')]?_0x4de66a[_0x5bec('0x1e')]['where']||null:null,'attributes':_0x4de66a['options']?_0x4de66a[_0x5bec('0x1e')][_0x5bec('0x21')]||null:null,'limit':_0x4de66a[_0x5bec('0x1e')]?_0x4de66a[_0x5bec('0x1e')][_0x5bec('0x22')]||null:null})[_0x5bec('0x10')](function(_0x5d6621){logger[_0x5bec('0x11')]('UpdateFaxMessage',_0x4de66a);logger[_0x5bec('0x13')](_0x5bec('0x1f'),_0x4de66a,JSON[_0x5bec('0x14')](_0x5d6621));_0x5e44b3(_0x5d6621);})[_0x5bec('0x19')](function(_0x5128c0){logger[_0x5bec('0x15')](_0x5bec('0x1f'),_0x5128c0[_0x5bec('0x18')],_0x4de66a);_0x2961bd(_0x5b63ab['error'](0x1f4,_0x5128c0[_0x5bec('0x18')]));});});}; \ No newline at end of file +var _0x0e85=['catch','FaxMessage','create','body','options','raw','info','CreateFaxMessage','UpdateFaxMessage','update','where','attributes','limit','lodash','util','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','request','then','request\x20sent','debug','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result'];(function(_0x4bb052,_0x1eff82){var _0x818cc=function(_0x2b4430){while(--_0x2b4430){_0x4bb052['push'](_0x4bb052['shift']());}};_0x818cc(++_0x1eff82);}(_0x0e85,0x7c));var _0x50e8=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x0e85[_0x45b034];return _0x509cb0;};'use strict';var _=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var moment=require('moment');var BPromise=require(_0x50e8('0x2'));var rs=require(_0x50e8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x50e8('0x4'))('rpc');var config=require(_0x50e8('0x5'));var jayson=require(_0x50e8('0x6'));var client=jayson[_0x50e8('0x7')][_0x50e8('0x8')]({'port':0x232a});config['redis']=_[_0x50e8('0x9')](config[_0x50e8('0xa')],{'host':_0x50e8('0xb'),'port':0x18eb});var socket=require(_0x50e8('0xc'))(new Redis(config[_0x50e8('0xa')]));require(_0x50e8('0xd'))['register'](socket);function respondWithRpcPromise(_0x11717c,_0x228ed1,_0x19d1bc){return new BPromise(function(_0x2d4750,_0x154b9e){return client[_0x50e8('0xe')](_0x11717c,_0x19d1bc)[_0x50e8('0xf')](function(_0x3d25ea){logger['info']('FaxMessage,\x20%s,\x20%s',_0x228ed1,_0x50e8('0x10'));logger[_0x50e8('0x11')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x228ed1,'request\x20sent',JSON[_0x50e8('0x12')](_0x3d25ea));if(_0x3d25ea[_0x50e8('0x13')]){if(_0x3d25ea[_0x50e8('0x13')][_0x50e8('0x14')]===0x1f4){logger['error'](_0x50e8('0x15'),_0x228ed1,_0x3d25ea[_0x50e8('0x13')][_0x50e8('0x16')]);return _0x154b9e(_0x3d25ea['error']['message']);}logger[_0x50e8('0x13')](_0x50e8('0x15'),_0x228ed1,_0x3d25ea[_0x50e8('0x13')][_0x50e8('0x16')]);return _0x2d4750(_0x3d25ea[_0x50e8('0x13')][_0x50e8('0x16')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x228ed1,_0x50e8('0x10'));_0x2d4750(_0x3d25ea[_0x50e8('0x17')][_0x50e8('0x16')]);}})[_0x50e8('0x18')](function(_0x5dae4e){logger[_0x50e8('0x13')](_0x50e8('0x15'),_0x228ed1,_0x5dae4e);_0x154b9e(_0x5dae4e);});});}exports['CreateFaxMessage']=function(_0x415596){var _0x55997c=this;return new Promise(function(_0x4d2318,_0xe04a5c){return db[_0x50e8('0x19')][_0x50e8('0x1a')](_0x415596[_0x50e8('0x1b')],{'raw':_0x415596['options']?_0x415596[_0x50e8('0x1c')][_0x50e8('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x31d23c){logger[_0x50e8('0x1e')]('CreateFaxMessage',_0x415596);logger[_0x50e8('0x11')](_0x50e8('0x1f'),_0x415596,JSON['stringify'](_0x31d23c));_0x4d2318(_0x31d23c);})['catch'](function(_0x59582d){logger[_0x50e8('0x13')](_0x50e8('0x1f'),_0x59582d[_0x50e8('0x16')],_0x415596);_0xe04a5c(_0x55997c[_0x50e8('0x13')](0x1f4,_0x59582d[_0x50e8('0x16')]));});});};exports[_0x50e8('0x20')]=function(_0x53d848){var _0x3a6442=this;return new Promise(function(_0x396611,_0x4b3a09){return db[_0x50e8('0x19')][_0x50e8('0x21')](_0x53d848[_0x50e8('0x1b')],{'raw':_0x53d848[_0x50e8('0x1c')]?_0x53d848['options'][_0x50e8('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53d848['options']?_0x53d848[_0x50e8('0x1c')][_0x50e8('0x22')]||null:null,'attributes':_0x53d848[_0x50e8('0x1c')]?_0x53d848['options'][_0x50e8('0x23')]||null:null,'limit':_0x53d848[_0x50e8('0x1c')]?_0x53d848[_0x50e8('0x1c')][_0x50e8('0x24')]||null:null})[_0x50e8('0xf')](function(_0x18aa31){logger[_0x50e8('0x1e')]('UpdateFaxMessage',_0x53d848);logger[_0x50e8('0x11')](_0x50e8('0x20'),_0x53d848,JSON['stringify'](_0x18aa31));_0x396611(_0x18aa31);})['catch'](function(_0x329b9c){logger[_0x50e8('0x13')](_0x50e8('0x20'),_0x329b9c['message'],_0x53d848);_0x4b3a09(_0x3a6442['error'](0x1f4,_0x329b9c[_0x50e8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 3c58c1a..e8a5bba 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 _0x8c2b=['./faxMessage.events','update','register','length','faxMessage:'];(function(_0x1b290e,_0x3a47c){var _0x298465=function(_0x5db5a5){while(--_0x5db5a5){_0x1b290e['push'](_0x1b290e['shift']());}};_0x298465(++_0x3a47c);}(_0x8c2b,0x6e));var _0xb8c2=function(_0x5383b4,_0x307870){_0x5383b4=_0x5383b4-0x0;var _0x2702c2=_0x8c2b[_0x5383b4];return _0x2702c2;};'use strict';var FaxMessageEvents=require(_0xb8c2('0x0'));var events=['save','remove',_0xb8c2('0x1')];function createListener(_0x513b13,_0x31a21a){return function(_0x2f46ee){_0x31a21a['emit'](_0x513b13,_0x2f46ee);};}function removeListener(_0x495559,_0x53cff5){return function(){FaxMessageEvents['removeListener'](_0x495559,_0x53cff5);};}exports[_0xb8c2('0x2')]=function(_0xc015b4){for(var _0x427b3b=0x0,_0x1bc878=events[_0xb8c2('0x3')];_0x427b3b<_0x1bc878;_0x427b3b++){var _0x1e45a4=events[_0x427b3b];var _0x2af153=createListener(_0xb8c2('0x4')+_0x1e45a4,_0xc015b4);FaxMessageEvents['on'](_0x1e45a4,_0x2af153);}}; \ No newline at end of file +var _0x8f48=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x362162,_0x189524){var _0x30a7d2=function(_0x374169){while(--_0x374169){_0x362162['push'](_0x362162['shift']());}};_0x30a7d2(++_0x189524);}(_0x8f48,0xd2));var _0x88f4=function(_0x1d5400,_0x567e3c){_0x1d5400=_0x1d5400-0x0;var _0x21d9fe=_0x8f48[_0x1d5400];return _0x21d9fe;};'use strict';var FaxMessageEvents=require(_0x88f4('0x0'));var events=[_0x88f4('0x1'),_0x88f4('0x2'),_0x88f4('0x3')];function createListener(_0x509de6,_0x457306){return function(_0x2ff936){_0x457306[_0x88f4('0x4')](_0x509de6,_0x2ff936);};}function removeListener(_0x38f223,_0x2325b9){return function(){FaxMessageEvents[_0x88f4('0x5')](_0x38f223,_0x2325b9);};}exports[_0x88f4('0x6')]=function(_0x399f37){for(var _0x44fd6e=0x0,_0x2c9d23=events[_0x88f4('0x7')];_0x44fd6e<_0x2c9d23;_0x44fd6e++){var _0x138827=events[_0x44fd6e];var _0x37a915=createListener(_0x88f4('0x8')+_0x138827,_0x399f37);FaxMessageEvents['on'](_0x138827,_0x37a915);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 330eb6c..29cc1a7 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(_0x5e1dac,_0x260087){var _0x4dc299=function(_0x557c08){while(--_0x557c08){_0x5e1dac['push'](_0x5e1dac['shift']());}};_0x4dc299(++_0x260087);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x40cb69,_0x37f2ba){_0x40cb69=_0x40cb69-0x0;var _0x55e036=_0xc6d8[_0x40cb69];return _0x55e036;};'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 _0x1be1=['create','put','update','/:id/accept','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','describe','/:id','/:id/download','download','post','tracked','faxmessage:create'];(function(_0x506d2f,_0x5ab76e){var _0x101255=function(_0x1596b1){while(--_0x1596b1){_0x506d2f['push'](_0x506d2f['shift']());}};_0x101255(++_0x5ab76e);}(_0x1be1,0x192));var _0x11be=function(_0x5e33da,_0x2bfcc5){_0x5e33da=_0x5e33da-0x0;var _0x2aedb8=_0x1be1[_0x5e33da];return _0x2aedb8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x11be('0x0'));var timeout=require(_0x11be('0x1'));var express=require('express');var router=express[_0x11be('0x2')]();var fs_extra=require(_0x11be('0x3'));var auth=require(_0x11be('0x4'));var interaction=require(_0x11be('0x5'));var config=require('../../config/environment');var controller=require(_0x11be('0x6'));router[_0x11be('0x7')]('/',auth[_0x11be('0x8')](),controller['index']);router[_0x11be('0x7')]('/describe',auth[_0x11be('0x8')](),controller[_0x11be('0x9')]);router[_0x11be('0x7')](_0x11be('0xa'),auth[_0x11be('0x8')](),controller['show']);router[_0x11be('0x7')](_0x11be('0xb'),auth['isAuthenticated'](),controller[_0x11be('0xc')]);router[_0x11be('0xd')]('/',auth[_0x11be('0x8')](),interaction[_0x11be('0xe')]('fax',_0x11be('0xf')),controller[_0x11be('0x10')]);router[_0x11be('0x11')]('/:id',auth[_0x11be('0x8')](),controller[_0x11be('0x12')]);router['put'](_0x11be('0x13'),auth['isAuthenticated'](),controller['accept']);router['put']('/:id/reject',auth['isAuthenticated'](),controller['reject']);router['delete'](_0x11be('0xa'),auth['isAuthenticated'](),controller[_0x11be('0x14')]);module[_0x11be('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index a19c652..53fc21c 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 _0xa33c=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa33c,0xd4));var _0xca33=function(_0x5e8a30,_0x5194fb){_0x5e8a30=_0x5e8a30-0x0;var _0x14f14d=_0xa33c[_0x5e8a30];return _0x14f14d;};'use strict';var Sequelize=require(_0xca33('0x0'));module[_0xca33('0x1')]={'name':{'type':Sequelize[_0xca33('0x2')],'unique':_0xca33('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xca33('0x2')]},'timeout':{'type':Sequelize[_0xca33('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xca33('0x5')](_0xca33('0x6'),'beepall',_0xca33('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc06a=['ENUM','rrmemory','sequelize','exports','name','INTEGER'];(function(_0x4cd0bf,_0x54f608){var _0x24af58=function(_0x2f1773){while(--_0x2f1773){_0x4cd0bf['push'](_0x4cd0bf['shift']());}};_0x24af58(++_0x54f608);}(_0xc06a,0x1be));var _0xac06=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc06a[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xac06('0x0'));module[_0xac06('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xac06('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xac06('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xac06('0x4')](_0xac06('0x5'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xac06('0x3')],'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 53f5b65..b959ce6 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 _0x187d=['push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','forEach','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','isArray','getAgents','nolimit','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','update','then','destroy','get','FaxQueues','UserProfileResource','stack','name','send','rawAttributes','fieldName','type','getOptions','FaxQueue','include','query','findAll','rows','show','params','model','keys','filters','attributes','fields','length','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','catch','error','describe','getMembers','findOne','UserFaxQueue','intersection','hasOwnProperty','order','sort','where','pick','FaxQueueId','filter','map','merge','options','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','faxPause','getTeams','addTeams','ids','Team','Agents','voicePause','interface','flatMap','transaction','each','findOrCreate','emit','removeTeams','select','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?'];(function(_0x400d9e,_0x1426d8){var _0x498976=function(_0x45b1d8){while(--_0x45b1d8){_0x400d9e['push'](_0x400d9e['shift']());}};_0x498976(++_0x1426d8);}(_0x187d,0x93));var _0xd187=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x187d[_0x1e7b16];return _0x37fadc;};'use strict';var BPromise=require(_0xd187('0x0'));var util=require('util');var _=require(_0xd187('0x1'));var squel=require(_0xd187('0x2'));var Redis=require(_0xd187('0x3'));var qs=require(_0xd187('0x4'));var logger=require(_0xd187('0x5'))(_0xd187('0x6'));var config=require('../../config/environment');var db=require(_0xd187('0x7'))['db'];config[_0xd187('0x8')]=_['defaults'](config[_0xd187('0x8')],{'host':_0xd187('0x9'),'port':0x18eb});var socket=require(_0xd187('0xa'))(new Redis(config[_0xd187('0x8')]));require(_0xd187('0xb'))[_0xd187('0xc')](socket);function respondWithStatusCode(_0x358c45,_0x461a44){_0x461a44=_0x461a44||0xcc;return function(_0x5b480f){if(_0x5b480f){return _0x358c45[_0xd187('0xd')](_0x461a44);}return _0x358c45[_0xd187('0xe')](_0x461a44)[_0xd187('0xf')]();};}function respondWithResult(_0x473866,_0x33ca45){_0x33ca45=_0x33ca45||0xc8;return function(_0x2a61a4){if(_0x2a61a4){return _0x473866['status'](_0x33ca45)[_0xd187('0x10')](_0x2a61a4);}};}function respondWithFilteredResult(_0x412ccf,_0x18237b){return function(_0x5e6180){if(_0x5e6180){var _0x37e80c=typeof _0x18237b[_0xd187('0x11')]===_0xd187('0x12')&&typeof _0x18237b['limit']===_0xd187('0x12');var _0x18ce42=_0x5e6180[_0xd187('0x13')];var _0x126d1a=_0x37e80c?0x0:_0x18237b['offset'];var _0x39a927=_0x37e80c?_0x5e6180[_0xd187('0x13')]:_0x18237b[_0xd187('0x11')]+_0x18237b[_0xd187('0x14')];var _0x4c8f68;if(_0x39a927>=_0x18ce42){_0x39a927=_0x18ce42;_0x4c8f68=0xc8;}else{_0x4c8f68=0xce;}_0x412ccf[_0xd187('0xe')](_0x4c8f68);return _0x412ccf['set']('Content-Range',_0x126d1a+'-'+_0x39a927+'/'+_0x18ce42)[_0xd187('0x10')](_0x5e6180);}return null;};}function saveUpdates(_0x5a4986){return function(_0x4ec155){if(_0x4ec155){return _0x4ec155[_0xd187('0x15')](_0x5a4986)[_0xd187('0x16')](function(_0x374fe0){return _0x374fe0;});}return null;};}function removeEntity(_0x10d9fd){return function(_0x21df74){if(_0x21df74){return _0x21df74[_0xd187('0x17')]()[_0xd187('0x16')](function(){var _0x369809=_0x21df74[_0xd187('0x18')]({'plain':!![]});var _0x46fca3=_0xd187('0x19');return db[_0xd187('0x1a')][_0xd187('0x17')]({'where':{'type':_0x46fca3,'resourceId':_0x369809['id']}})['then'](function(){return _0x21df74;});})[_0xd187('0x16')](function(){_0x10d9fd[_0xd187('0xe')](0xcc)[_0xd187('0xf')]();});}};}function handleEntityNotFound(_0x5bcf5b){return function(_0x5a0360){if(!_0x5a0360){_0x5bcf5b['sendStatus'](0x194);}return _0x5a0360;};}function handleError(_0x435d94,_0x33741d){_0x33741d=_0x33741d||0x1f4;return function(_0x249a82){logger['error'](_0x249a82[_0xd187('0x1b')]);if(_0x249a82['name']){delete _0x249a82[_0xd187('0x1c')];}_0x435d94['status'](_0x33741d)[_0xd187('0x1d')](_0x249a82);};}exports['index']=function(_0x4f3879,_0x2c76fd){var _0x4d992b={};var _0x12da33={'count':0x0,'rows':[]};var _0x598aa4=_['map'](db['FaxQueue'][_0xd187('0x1e')],function(_0xeff822){return{'name':_0xeff822[_0xd187('0x1f')],'type':_0xeff822[_0xd187('0x20')]['key']};});_0x4d992b=qs[_0xd187('0x21')](_0x598aa4,_0x4f3879);var _0x2875c8={'where':_0x4d992b['where']};return db[_0xd187('0x22')][_0xd187('0x13')](_0x2875c8)[_0xd187('0x16')](function(_0x4c50a5){_0x12da33[_0xd187('0x13')]=_0x4c50a5;_0x4d992b['include']=qs[_0xd187('0x23')](_0x4f3879[_0xd187('0x24')]);return db[_0xd187('0x22')][_0xd187('0x25')](_0x4d992b);})['then'](function(_0x140e54){_0x12da33[_0xd187('0x26')]=_0x140e54;return _0x12da33;})['then'](respondWithFilteredResult(_0x2c76fd,_0x4d992b))['catch'](handleError(_0x2c76fd,null));};exports[_0xd187('0x27')]=function(_0x1836cf,_0x13f285){var _0x481346={'raw':!![],'where':{'id':_0x1836cf[_0xd187('0x28')]['id']}},_0x2874b2={};_0x2874b2[_0xd187('0x29')]=_[_0xd187('0x2a')](db['FaxQueue'][_0xd187('0x1e')]);_0x2874b2[_0xd187('0x24')]=_[_0xd187('0x2a')](_0x1836cf['query']);_0x2874b2[_0xd187('0x2b')]=_['intersection'](_0x2874b2[_0xd187('0x29')],_0x2874b2[_0xd187('0x24')]);_0x481346[_0xd187('0x2c')]=_['intersection'](_0x2874b2['model'],qs[_0xd187('0x2d')](_0x1836cf[_0xd187('0x24')]['fields']));_0x481346[_0xd187('0x2c')]=_0x481346[_0xd187('0x2c')][_0xd187('0x2e')]?_0x481346['attributes']:_0x2874b2['model'];if(_0x1836cf[_0xd187('0x24')][_0xd187('0x2f')]){_0x481346['include']=[{'all':!![]}];}_0x481346=_['merge']({},_0x481346,_0x1836cf['options']);return db[_0xd187('0x22')]['find'](_0x481346)[_0xd187('0x16')](handleEntityNotFound(_0x13f285,null))[_0xd187('0x16')](respondWithResult(_0x13f285,null))['catch'](handleError(_0x13f285,null));};exports[_0xd187('0x30')]=function(_0x5674ca,_0x293ce9){return db[_0xd187('0x22')]['create'](_0x5674ca[_0xd187('0x31')],{})[_0xd187('0x16')](function(_0x56cbb2){var _0x4399a5=_0x5674ca['user']['get']({'plain':!![]});if(!_0x4399a5)throw new Error(_0xd187('0x32'));if(_0x4399a5[_0xd187('0x33')]===_0xd187('0x34')){var _0x1a8f54=_0x56cbb2[_0xd187('0x18')]({'plain':!![]});var _0x51964d=_0xd187('0x19');return db[_0xd187('0x35')][_0xd187('0x36')]({'where':{'name':_0x51964d,'userProfileId':_0x4399a5['userProfileId']},'raw':!![]})['then'](function(_0x538c05){if(_0x538c05&&_0x538c05['autoAssociation']===0x0){return db[_0xd187('0x1a')][_0xd187('0x30')]({'name':_0x1a8f54[_0xd187('0x1c')],'resourceId':_0x1a8f54['id'],'type':_0x538c05[_0xd187('0x1c')],'sectionId':_0x538c05['id']},{})[_0xd187('0x16')](function(){return _0x56cbb2;});}else{return _0x56cbb2;}})[_0xd187('0x37')](function(_0x4699e1){logger[_0xd187('0x38')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4699e1);throw _0x4699e1;});}return _0x56cbb2;})[_0xd187('0x16')](respondWithResult(_0x293ce9,0xc9))[_0xd187('0x37')](handleError(_0x293ce9,null));};exports[_0xd187('0x15')]=function(_0x51c7fc,_0x21cbf6){if(_0x51c7fc['body']['id']){delete _0x51c7fc[_0xd187('0x31')]['id'];}return db[_0xd187('0x22')][_0xd187('0x36')]({'where':{'id':_0x51c7fc[_0xd187('0x28')]['id']}})[_0xd187('0x16')](handleEntityNotFound(_0x21cbf6,null))['then'](saveUpdates(_0x51c7fc[_0xd187('0x31')],null))[_0xd187('0x16')](respondWithResult(_0x21cbf6,null))[_0xd187('0x37')](handleError(_0x21cbf6,null));};exports[_0xd187('0x17')]=function(_0x4d6e80,_0xa02567){return db[_0xd187('0x22')]['find']({'where':{'id':_0x4d6e80[_0xd187('0x28')]['id']}})[_0xd187('0x16')](handleEntityNotFound(_0xa02567,null))['then'](removeEntity(_0xa02567,null))['catch'](handleError(_0xa02567,null));};exports[_0xd187('0x39')]=function(_0x5b5d25,_0x505764){return db['FaxQueue']['describe']()[_0xd187('0x16')](respondWithResult(_0x505764,null))[_0xd187('0x37')](handleError(_0x505764,null));};exports[_0xd187('0x3a')]=function(_0x248d6e,_0x321b86){var _0x60062b={'raw':!![],'where':{}},_0x452114={},_0x573155;return db[_0xd187('0x22')][_0xd187('0x3b')]({'where':{'id':_0x248d6e[_0xd187('0x28')]['id']}})[_0xd187('0x16')](handleEntityNotFound(_0x321b86,null))[_0xd187('0x16')](function(_0x2dc84f){if(_0x2dc84f){_0x573155=_0x2dc84f[_0xd187('0x18')]({'plain':!![]});_0x452114[_0xd187('0x29')]=_['keys'](db[_0xd187('0x3c')][_0xd187('0x1e')]);_0x452114[_0xd187('0x24')]=_[_0xd187('0x2a')](_0x248d6e[_0xd187('0x24')]);_0x452114['filters']=_[_0xd187('0x3d')](_0x452114[_0xd187('0x29')],_0x452114['query']);_0x60062b[_0xd187('0x2c')]=_[_0xd187('0x3d')](_0x452114['model'],qs['fields'](_0x248d6e['query']['fields']));_0x60062b[_0xd187('0x2c')]=_0x60062b[_0xd187('0x2c')][_0xd187('0x2e')]?_0x60062b[_0xd187('0x2c')]:_0x452114[_0xd187('0x29')];if(!_0x248d6e[_0xd187('0x24')][_0xd187('0x3e')]('nolimit')){_0x60062b[_0xd187('0x14')]=qs[_0xd187('0x14')](_0x248d6e[_0xd187('0x24')][_0xd187('0x14')]);_0x60062b['offset']=qs[_0xd187('0x11')](_0x248d6e['query']['offset']);}_0x60062b[_0xd187('0x3f')]=qs['sort'](_0x248d6e[_0xd187('0x24')][_0xd187('0x40')]);_0x60062b[_0xd187('0x41')]=qs[_0xd187('0x2b')](_[_0xd187('0x42')](_0x248d6e[_0xd187('0x24')],_0x452114[_0xd187('0x2b')]));_0x60062b[_0xd187('0x41')][_0xd187('0x43')]=_0x2dc84f['id'];if(_0x248d6e['query'][_0xd187('0x44')]){_0x60062b[_0xd187('0x41')]=_['merge'](_0x60062b[_0xd187('0x41')],{'$or':_[_0xd187('0x45')](_0x60062b[_0xd187('0x2c')],function(_0x57eaf5){var _0x2b87fe={};_0x2b87fe[_0x57eaf5]={'$like':'%'+_0x248d6e[_0xd187('0x24')]['filter']+'%'};return _0x2b87fe;})});}_0x60062b=_[_0xd187('0x46')]({},_0x60062b,_0x248d6e[_0xd187('0x47')]);return db['UserFaxQueue'][_0xd187('0x25')](_0x60062b);}})['then'](function(_0x1840d9){if(_0x1840d9){return db[_0xd187('0x48')][_0xd187('0x49')]({'where':{'id':_[_0xd187('0x45')](_0x1840d9,_0xd187('0x4a')),'role':_0xd187('0x4b')},'attributes':['id',_0xd187('0x1c'),'faxPause',_0xd187('0x4c'),_0xd187('0x4d')]});}})[_0xd187('0x16')](function(_0x56b36b){if(_0x56b36b){return{'count':_0x56b36b[_0xd187('0x13')],'rows':_[_0xd187('0x45')](_0x56b36b[_0xd187('0x26')],function(_0x2409c2){return{'membername':_0x2409c2[_0xd187('0x1c')],'UserId':_0x2409c2['id'],'queue_name':_0x573155[_0xd187('0x1c')],'FaxQueueId':_0x573155['id'],'interface':util[_0xd187('0x4e')](_0xd187('0x4f'),_0xd187('0x50'),_0x2409c2[_0xd187('0x1c')]),'penalty':0x0,'paused':_0x2409c2[_0xd187('0x51')],'createdAt':_0x2409c2[_0xd187('0x4d')],'updatedAt':_0x2409c2[_0xd187('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd187('0x16')](respondWithFilteredResult(_0x321b86,_0x60062b))[_0xd187('0x37')](handleError(_0x321b86,null));};exports[_0xd187('0x52')]=function(_0x42fb32,_0x3499b3){var _0x2c4155={};var _0x36a8cc={};var _0x5292dd;var _0x4de2db;return db['FaxQueue'][_0xd187('0x3b')]({'where':{'id':_0x42fb32[_0xd187('0x28')]['id']}})[_0xd187('0x16')](handleEntityNotFound(_0x3499b3,null))[_0xd187('0x16')](function(_0x51fbdb){if(_0x51fbdb){_0x5292dd=_0x51fbdb;_0x36a8cc[_0xd187('0x29')]=_[_0xd187('0x2a')](db['Team']['rawAttributes']);_0x36a8cc[_0xd187('0x24')]=_[_0xd187('0x2a')](_0x42fb32[_0xd187('0x24')]);_0x36a8cc[_0xd187('0x2b')]=_['intersection'](_0x36a8cc[_0xd187('0x29')],_0x36a8cc['query']);_0x2c4155[_0xd187('0x2c')]=_[_0xd187('0x3d')](_0x36a8cc[_0xd187('0x29')],qs[_0xd187('0x2d')](_0x42fb32['query'][_0xd187('0x2d')]));_0x2c4155[_0xd187('0x2c')]=_0x2c4155[_0xd187('0x2c')][_0xd187('0x2e')]?_0x2c4155[_0xd187('0x2c')]:_0x36a8cc['model'];_0x2c4155['order']=qs[_0xd187('0x40')](_0x42fb32[_0xd187('0x24')][_0xd187('0x40')]);_0x2c4155[_0xd187('0x41')]=qs[_0xd187('0x2b')](_[_0xd187('0x42')](_0x42fb32[_0xd187('0x24')],_0x36a8cc[_0xd187('0x2b')]));if(_0x42fb32[_0xd187('0x24')][_0xd187('0x44')]){_0x2c4155[_0xd187('0x41')]=_[_0xd187('0x46')](_0x2c4155['where'],{'$or':_[_0xd187('0x45')](_0x2c4155[_0xd187('0x2c')],function(_0x54e908){var _0x3528b9={};_0x3528b9[_0x54e908]={'$like':'%'+_0x42fb32[_0xd187('0x24')]['filter']+'%'};return _0x3528b9;})});}_0x2c4155=_['merge']({},_0x2c4155,_0x42fb32[_0xd187('0x47')]);return _0x5292dd[_0xd187('0x52')](_0x2c4155);}})[_0xd187('0x16')](function(_0x2f743b){if(_0x2f743b){_0x4de2db=_0x2f743b['length'];if(!_0x42fb32[_0xd187('0x24')][_0xd187('0x3e')]('nolimit')){_0x2c4155['limit']=qs[_0xd187('0x14')](_0x42fb32['query'][_0xd187('0x14')]);_0x2c4155[_0xd187('0x11')]=qs['offset'](_0x42fb32[_0xd187('0x24')]['offset']);}return _0x5292dd[_0xd187('0x52')](_0x2c4155);}})['then'](function(_0x534d03){if(_0x534d03){return _0x534d03?{'count':_0x4de2db,'rows':_0x534d03}:null;}})['then'](respondWithResult(_0x3499b3,null))[_0xd187('0x37')](handleError(_0x3499b3,null));};exports[_0xd187('0x53')]=function(_0x421585,_0x216829){var _0x18e07a=_0x421585[_0xd187('0x31')][_0xd187('0x54')];return db[_0xd187('0x55')]['findAll']({'where':{'id':_0x18e07a},'attributes':['id'],'include':[{'model':db[_0xd187('0x48')],'as':_0xd187('0x56'),'attributes':['id',_0xd187('0x1c'),'online',_0xd187('0x57'),_0xd187('0x58')],'raw':!![]}]})[_0xd187('0x16')](function(_0x433dd3){if(_0x433dd3){var _0x5360d0=_[_0xd187('0x59')](_0x433dd3,function(_0x3a71bb){var _0x4c3255=_0x3a71bb[_0xd187('0x18')]({'plain':!![]});return _0x4c3255[_0xd187('0x56')];});return db[_0xd187('0x22')][_0xd187('0x36')]({'where':{'id':_0x421585['params']['id']}})[_0xd187('0x16')](function(_0x9e6304){return db['sequelize'][_0xd187('0x5a')](function(_0x4f75bb){return _0x9e6304['addTeams'](_0x18e07a,{'transaction':_0x4f75bb})['then'](function(){return BPromise[_0xd187('0x5b')](_0x5360d0,function(_0x28472d){return db[_0xd187('0x3c')][_0xd187('0x5c')]({'where':{'UserId':_0x28472d['id'],'FaxQueueId':_0x421585[_0xd187('0x28')]['id']},'transaction':_0x4f75bb});});})[_0xd187('0x16')](function(){_0x5360d0['forEach'](function(_0xbbe4fb){socket[_0xd187('0x5d')]('userFaxQueue:save',{'UserId':_0xbbe4fb['id'],'FaxQueueId':_0x9e6304['id']});});});});});}})['then'](respondWithStatusCode(_0x216829,null))[_0xd187('0x37')](handleError(_0x216829,null));};exports[_0xd187('0x5e')]=function(_0xaf156f,_0x1f163a){return db[_0xd187('0x55')][_0xd187('0x25')]({'where':{'id':_0xaf156f['query'][_0xd187('0x54')]},'attributes':['id'],'include':[{'model':db[_0xd187('0x48')],'as':_0xd187('0x56'),'attributes':['id'],'raw':!![]}]})[_0xd187('0x16')](handleEntityNotFound(_0x1f163a,null))[_0xd187('0x16')](function(_0x2879ff){var _0x1982cd=_[_0xd187('0x45')](_0x2879ff,'id');var _0x3d9b2f=[];var _0xf31fac=[];var _0x195497=squel[_0xd187('0x5f')]();_0x195497['field']('tq.TeamId')[_0xd187('0x60')](_0xd187('0x61'),'tq')[_0xd187('0x62')](_0xd187('0x63'),'ut',_0xd187('0x64'))[_0xd187('0x41')]('FaxQueueId\x20=\x20?',_0xaf156f[_0xd187('0x28')]['id']);for(var _0x5541ef=0x0;_0x5541ef<_0x2879ff[_0xd187('0x2e')];_0x5541ef+=0x1){let _0x520f86=_0x2879ff[_0x5541ef];for(var _0x5cbfa6=0x0;_0x5cbfa6<_0x520f86[_0xd187('0x56')]['length'];_0x5cbfa6+=0x1){let _0x2fc480=_0x520f86[_0xd187('0x56')][_0x5cbfa6];var _0x1ccb17=_0x195497[_0xd187('0x65')]();_0x1ccb17[_0xd187('0x41')](_0xd187('0x66'),_0x2fc480['id']);_0xf31fac[_0xd187('0x67')](db[_0xd187('0x68')][_0xd187('0x24')](_0x1ccb17[_0xd187('0x69')](),{'type':db[_0xd187('0x68')][_0xd187('0x6a')][_0xd187('0x6b')]})[_0xd187('0x16')](function(_0x25fc08){if(_0x25fc08['length']===0x1){return _0x2fc480['id'];}else{var _0x524dca=_[_0xd187('0x6c')](_[_0xd187('0x45')](_0x25fc08,_0xd187('0x6d')),function(_0x59cc5a){return _[_0xd187('0x6e')](_0x1982cd,_0x59cc5a);});if(_0x524dca){return _0x2fc480['id'];}}}));}}return BPromise[_0xd187('0x6f')](_0xf31fac)['then'](function(_0x4c020b){_0x3d9b2f=_(_0x3d9b2f)[_0xd187('0x70')](_0x4c020b)[_0xd187('0x71')]()[_0xd187('0x72')]();return db[_0xd187('0x22')][_0xd187('0x36')]({'where':{'id':_0xaf156f[_0xd187('0x28')]['id']}})['then'](function(_0x22900){return db[_0xd187('0x68')]['transaction'](function(_0x3244dd){return _0x22900[_0xd187('0x5e')](_0xaf156f[_0xd187('0x24')][_0xd187('0x54')],{'transaction':_0x3244dd})['then'](function(){if(!_['isEmpty'](_0x3d9b2f)){return _0x22900[_0xd187('0x73')](_0x3d9b2f,{'transaction':_0x3244dd});}})[_0xd187('0x16')](function(){_0x3d9b2f[_0xd187('0x74')](function(_0x5f4122){socket[_0xd187('0x5d')](_0xd187('0x75'),{'UserId':_0x5f4122,'FaxQueueId':_0x22900['id']});});});});});});})[_0xd187('0x16')](respondWithStatusCode(_0x1f163a,null))[_0xd187('0x37')](handleError(_0x1f163a,null));};exports['addAgents']=function(_0x17d7d6,_0x4efb9f){return db['FaxQueue']['find']({'where':{'id':_0x17d7d6['params']['id']}})['then'](handleEntityNotFound(_0x4efb9f,null))['then'](function(_0x49d76d){if(_0x49d76d){return _0x49d76d[_0xd187('0x76')](_0x17d7d6[_0xd187('0x31')]['ids'],_[_0xd187('0x77')](_0x17d7d6[_0xd187('0x31')],[_0xd187('0x54'),'id'])||{})[_0xd187('0x78')](function(_0x453e35){for(var _0x4a1189=0x0;_0x4a1189<_0x17d7d6[_0xd187('0x31')]['ids'][_0xd187('0x2e')];_0x4a1189+=0x1){socket[_0xd187('0x5d')](_0xd187('0x79'),{'UserId':Number(_0x17d7d6[_0xd187('0x31')][_0xd187('0x54')][_0x4a1189]),'FaxQueueId':Number(_0x17d7d6[_0xd187('0x28')]['id'])});}return _0x453e35;});}})[_0xd187('0x16')](respondWithResult(_0x4efb9f,null))['catch'](handleError(_0x4efb9f,null));};exports[_0xd187('0x73')]=function(_0x138281,_0x4e358e){return db[_0xd187('0x22')][_0xd187('0x36')]({'where':{'id':_0x138281['params']['id']}})[_0xd187('0x16')](handleEntityNotFound(_0x4e358e,null))[_0xd187('0x16')](function(_0x224312){if(_0x224312){return _0x224312[_0xd187('0x73')](_0x138281[_0xd187('0x24')][_0xd187('0x54')])[_0xd187('0x16')](function(){if(_[_0xd187('0x7a')](_0x138281['query'][_0xd187('0x54')])){for(var _0x516cb3=0x0;_0x516cb3<_0x138281[_0xd187('0x24')][_0xd187('0x54')][_0xd187('0x2e')];_0x516cb3+=0x1){socket[_0xd187('0x5d')]('userFaxQueue:remove',{'UserId':Number(_0x138281['query'][_0xd187('0x54')][_0x516cb3]),'FaxQueueId':Number(_0x138281[_0xd187('0x28')]['id'])});}}else{socket['emit'](_0xd187('0x75'),{'UserId':Number(_0x138281[_0xd187('0x24')][_0xd187('0x54')]),'FaxQueueId':Number(_0x138281[_0xd187('0x28')]['id'])});}});}})[_0xd187('0x16')](respondWithStatusCode(_0x4e358e,null))[_0xd187('0x37')](handleError(_0x4e358e,null));};exports['getAgents']=function(_0x16a7bd,_0x1e834d){var _0x259f1f={};var _0x23e30b={};var _0x1d1d36;var _0x37f046;return db[_0xd187('0x22')][_0xd187('0x3b')]({'where':{'id':_0x16a7bd[_0xd187('0x28')]['id']}})['then'](handleEntityNotFound(_0x1e834d,null))[_0xd187('0x16')](function(_0x162df6){if(_0x162df6){_0x1d1d36=_0x162df6;_0x23e30b[_0xd187('0x29')]=_['keys'](db[_0xd187('0x48')][_0xd187('0x1e')]);_0x23e30b[_0xd187('0x24')]=_[_0xd187('0x2a')](_0x16a7bd[_0xd187('0x24')]);_0x23e30b[_0xd187('0x2b')]=_['intersection'](_0x23e30b[_0xd187('0x29')],_0x23e30b[_0xd187('0x24')]);_0x259f1f[_0xd187('0x2c')]=_['intersection'](_0x23e30b[_0xd187('0x29')],qs[_0xd187('0x2d')](_0x16a7bd[_0xd187('0x24')][_0xd187('0x2d')]));_0x259f1f[_0xd187('0x2c')]=_0x259f1f[_0xd187('0x2c')]['length']?_0x259f1f[_0xd187('0x2c')]:_0x23e30b[_0xd187('0x29')];_0x259f1f['order']=qs[_0xd187('0x40')](_0x16a7bd[_0xd187('0x24')]['sort']);_0x259f1f[_0xd187('0x41')]=qs[_0xd187('0x2b')](_['pick'](_0x16a7bd[_0xd187('0x24')],_0x23e30b[_0xd187('0x2b')]));if(_0x16a7bd['query'][_0xd187('0x44')]){_0x259f1f['where']=_[_0xd187('0x46')](_0x259f1f[_0xd187('0x41')],{'$or':_[_0xd187('0x45')](_0x259f1f[_0xd187('0x2c')],function(_0x636c28){var _0x4b6948={};_0x4b6948[_0x636c28]={'$like':'%'+_0x16a7bd['query'][_0xd187('0x44')]+'%'};return _0x4b6948;})});}_0x259f1f=_[_0xd187('0x46')]({},_0x259f1f,_0x16a7bd[_0xd187('0x47')]);return _0x1d1d36[_0xd187('0x7b')](_0x259f1f);}})[_0xd187('0x16')](function(_0x307522){if(_0x307522){_0x37f046=_0x307522[_0xd187('0x2e')];if(!_0x16a7bd['query'][_0xd187('0x3e')](_0xd187('0x7c'))){_0x259f1f[_0xd187('0x14')]=qs[_0xd187('0x14')](_0x16a7bd[_0xd187('0x24')][_0xd187('0x14')]);_0x259f1f['offset']=qs[_0xd187('0x11')](_0x16a7bd[_0xd187('0x24')][_0xd187('0x11')]);}return _0x1d1d36[_0xd187('0x7b')](_0x259f1f);}})[_0xd187('0x16')](function(_0x38a7cd){if(_0x38a7cd){return _0x38a7cd?{'count':_0x37f046,'rows':_0x38a7cd}:null;}})[_0xd187('0x16')](respondWithResult(_0x1e834d,null))[_0xd187('0x37')](handleError(_0x1e834d,null));}; \ No newline at end of file +var _0xfdbd=['../../config/environment','redis','localhost','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','FaxQueues','stack','name','send','index','map','FaxQueue','fieldName','type','getOptions','where','include','query','findAll','rows','catch','show','params','model','rawAttributes','keys','filters','intersection','fields','attributes','length','includeAll','merge','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','nolimit','order','sort','FaxQueueId','filter','User','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','pick','hasOwnProperty','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','userFaxQueue:save','removeTeams','select','tq.TeamId','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','compact','isEmpty','removeAgents','forEach','userFaxQueue:remove','addAgents','omit','spread','emit','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x4e09b4,_0x2d97da){var _0x458bd6=function(_0x464438){while(--_0x464438){_0x4e09b4['push'](_0x4e09b4['shift']());}};_0x458bd6(++_0x2d97da);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x5d04ee,_0x2a38ca){_0x5d04ee=_0x5d04ee-0x0;var _0x4a666a=_0xfdbd[_0x5d04ee];return _0x4a666a;};'use strict';var BPromise=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var _=require(_0xdfdb('0x2'));var squel=require(_0xdfdb('0x3'));var Redis=require(_0xdfdb('0x4'));var qs=require(_0xdfdb('0x5'));var logger=require(_0xdfdb('0x6'))(_0xdfdb('0x7'));var config=require(_0xdfdb('0x8'));var db=require('../../mysqldb')['db'];config[_0xdfdb('0x9')]=_['defaults'](config[_0xdfdb('0x9')],{'host':_0xdfdb('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxQueue.socket')[_0xdfdb('0xb')](socket);function respondWithStatusCode(_0xf72a24,_0x47c629){_0x47c629=_0x47c629||0xcc;return function(_0x11d845){if(_0x11d845){return _0xf72a24[_0xdfdb('0xc')](_0x47c629);}return _0xf72a24[_0xdfdb('0xd')](_0x47c629)[_0xdfdb('0xe')]();};}function respondWithResult(_0x3a44a9,_0x1ace28){_0x1ace28=_0x1ace28||0xc8;return function(_0x2bb8d4){if(_0x2bb8d4){return _0x3a44a9['status'](_0x1ace28)[_0xdfdb('0xf')](_0x2bb8d4);}};}function respondWithFilteredResult(_0x1972db,_0x527c05){return function(_0x293714){if(_0x293714){var _0x33a706=typeof _0x527c05[_0xdfdb('0x10')]===_0xdfdb('0x11')&&typeof _0x527c05[_0xdfdb('0x12')]===_0xdfdb('0x11');var _0xf5d903=_0x293714[_0xdfdb('0x13')];var _0x51162f=_0x33a706?0x0:_0x527c05['offset'];var _0x2c44dc=_0x33a706?_0x293714['count']:_0x527c05[_0xdfdb('0x10')]+_0x527c05[_0xdfdb('0x12')];var _0x11a56a;if(_0x2c44dc>=_0xf5d903){_0x2c44dc=_0xf5d903;_0x11a56a=0xc8;}else{_0x11a56a=0xce;}_0x1972db[_0xdfdb('0xd')](_0x11a56a);return _0x1972db[_0xdfdb('0x14')](_0xdfdb('0x15'),_0x51162f+'-'+_0x2c44dc+'/'+_0xf5d903)['json'](_0x293714);}return null;};}function saveUpdates(_0x4fd3d5){return function(_0x2a0295){if(_0x2a0295){return _0x2a0295[_0xdfdb('0x16')](_0x4fd3d5)[_0xdfdb('0x17')](function(_0x55ab5a){return _0x55ab5a;});}return null;};}function removeEntity(_0x3eb100){return function(_0xb677b1){if(_0xb677b1){return _0xb677b1[_0xdfdb('0x18')]()[_0xdfdb('0x17')](function(){var _0x306a33=_0xb677b1[_0xdfdb('0x19')]({'plain':!![]});var _0x693a2c=_0xdfdb('0x1a');return db['UserProfileResource'][_0xdfdb('0x18')]({'where':{'type':_0x693a2c,'resourceId':_0x306a33['id']}})[_0xdfdb('0x17')](function(){return _0xb677b1;});})[_0xdfdb('0x17')](function(){_0x3eb100['status'](0xcc)[_0xdfdb('0xe')]();});}};}function handleEntityNotFound(_0x397f7c){return function(_0x2c7dd1){if(!_0x2c7dd1){_0x397f7c['sendStatus'](0x194);}return _0x2c7dd1;};}function handleError(_0x280e53,_0x789bd2){_0x789bd2=_0x789bd2||0x1f4;return function(_0x334cdd){logger['error'](_0x334cdd[_0xdfdb('0x1b')]);if(_0x334cdd['name']){delete _0x334cdd[_0xdfdb('0x1c')];}_0x280e53[_0xdfdb('0xd')](_0x789bd2)[_0xdfdb('0x1d')](_0x334cdd);};}exports[_0xdfdb('0x1e')]=function(_0x4f69cf,_0x4c253e){var _0x4363d8={};var _0x956843={'count':0x0,'rows':[]};var _0x400663=_[_0xdfdb('0x1f')](db[_0xdfdb('0x20')]['rawAttributes'],function(_0xec4d22){return{'name':_0xec4d22[_0xdfdb('0x21')],'type':_0xec4d22[_0xdfdb('0x22')]['key']};});_0x4363d8=qs[_0xdfdb('0x23')](_0x400663,_0x4f69cf);var _0x5df454={'where':_0x4363d8[_0xdfdb('0x24')]};return db[_0xdfdb('0x20')][_0xdfdb('0x13')](_0x5df454)['then'](function(_0x5bc174){_0x956843[_0xdfdb('0x13')]=_0x5bc174;_0x4363d8[_0xdfdb('0x25')]=qs[_0xdfdb('0x25')](_0x4f69cf[_0xdfdb('0x26')]);return db[_0xdfdb('0x20')][_0xdfdb('0x27')](_0x4363d8);})['then'](function(_0xf396d5){_0x956843[_0xdfdb('0x28')]=_0xf396d5;return _0x956843;})[_0xdfdb('0x17')](respondWithFilteredResult(_0x4c253e,_0x4363d8))[_0xdfdb('0x29')](handleError(_0x4c253e,null));};exports[_0xdfdb('0x2a')]=function(_0x157de8,_0x2dbdf9){var _0x1ce036={'raw':!![],'where':{'id':_0x157de8[_0xdfdb('0x2b')]['id']}},_0x68398d={};_0x68398d[_0xdfdb('0x2c')]=_['keys'](db['FaxQueue'][_0xdfdb('0x2d')]);_0x68398d['query']=_[_0xdfdb('0x2e')](_0x157de8[_0xdfdb('0x26')]);_0x68398d[_0xdfdb('0x2f')]=_[_0xdfdb('0x30')](_0x68398d['model'],_0x68398d[_0xdfdb('0x26')]);_0x1ce036['attributes']=_[_0xdfdb('0x30')](_0x68398d[_0xdfdb('0x2c')],qs[_0xdfdb('0x31')](_0x157de8[_0xdfdb('0x26')][_0xdfdb('0x31')]));_0x1ce036[_0xdfdb('0x32')]=_0x1ce036['attributes'][_0xdfdb('0x33')]?_0x1ce036[_0xdfdb('0x32')]:_0x68398d['model'];if(_0x157de8[_0xdfdb('0x26')][_0xdfdb('0x34')]){_0x1ce036[_0xdfdb('0x25')]=[{'all':!![]}];}_0x1ce036=_[_0xdfdb('0x35')]({},_0x1ce036,_0x157de8[_0xdfdb('0x36')]);return db[_0xdfdb('0x20')][_0xdfdb('0x37')](_0x1ce036)[_0xdfdb('0x17')](handleEntityNotFound(_0x2dbdf9,null))[_0xdfdb('0x17')](respondWithResult(_0x2dbdf9,null))[_0xdfdb('0x29')](handleError(_0x2dbdf9,null));};exports[_0xdfdb('0x38')]=function(_0x5530d8,_0x2defcc){return db[_0xdfdb('0x20')][_0xdfdb('0x38')](_0x5530d8[_0xdfdb('0x39')],{})[_0xdfdb('0x17')](function(_0x3e234e){var _0x3ec73a=_0x5530d8[_0xdfdb('0x3a')]['get']({'plain':!![]});if(!_0x3ec73a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ec73a[_0xdfdb('0x3b')]===_0xdfdb('0x3a')){var _0x16e100=_0x3e234e[_0xdfdb('0x19')]({'plain':!![]});var _0x349739=_0xdfdb('0x1a');return db[_0xdfdb('0x3c')][_0xdfdb('0x37')]({'where':{'name':_0x349739,'userProfileId':_0x3ec73a[_0xdfdb('0x3d')]},'raw':!![]})['then'](function(_0x175f57){if(_0x175f57&&_0x175f57[_0xdfdb('0x3e')]===0x0){return db[_0xdfdb('0x3f')][_0xdfdb('0x38')]({'name':_0x16e100[_0xdfdb('0x1c')],'resourceId':_0x16e100['id'],'type':_0x175f57['name'],'sectionId':_0x175f57['id']},{})[_0xdfdb('0x17')](function(){return _0x3e234e;});}else{return _0x3e234e;}})[_0xdfdb('0x29')](function(_0x3e9f88){logger[_0xdfdb('0x40')](_0xdfdb('0x41'),_0x3e9f88);throw _0x3e9f88;});}return _0x3e234e;})['then'](respondWithResult(_0x2defcc,0xc9))[_0xdfdb('0x29')](handleError(_0x2defcc,null));};exports[_0xdfdb('0x16')]=function(_0xf0482a,_0x5b4381){if(_0xf0482a[_0xdfdb('0x39')]['id']){delete _0xf0482a['body']['id'];}return db[_0xdfdb('0x20')]['find']({'where':{'id':_0xf0482a[_0xdfdb('0x2b')]['id']}})[_0xdfdb('0x17')](handleEntityNotFound(_0x5b4381,null))['then'](saveUpdates(_0xf0482a[_0xdfdb('0x39')],null))['then'](respondWithResult(_0x5b4381,null))[_0xdfdb('0x29')](handleError(_0x5b4381,null));};exports[_0xdfdb('0x18')]=function(_0x246ce2,_0x2566f8){return db[_0xdfdb('0x20')]['find']({'where':{'id':_0x246ce2['params']['id']}})[_0xdfdb('0x17')](handleEntityNotFound(_0x2566f8,null))[_0xdfdb('0x17')](removeEntity(_0x2566f8,null))['catch'](handleError(_0x2566f8,null));};exports[_0xdfdb('0x42')]=function(_0x59d0c3,_0xa7be4b){return db[_0xdfdb('0x20')][_0xdfdb('0x42')]()[_0xdfdb('0x17')](respondWithResult(_0xa7be4b,null))[_0xdfdb('0x29')](handleError(_0xa7be4b,null));};exports[_0xdfdb('0x43')]=function(_0x41701c,_0x11ce58){var _0x2ac36e={'raw':!![],'where':{}},_0xd101bf={},_0x24f88a;return db[_0xdfdb('0x20')][_0xdfdb('0x44')]({'where':{'id':_0x41701c[_0xdfdb('0x2b')]['id']}})[_0xdfdb('0x17')](handleEntityNotFound(_0x11ce58,null))[_0xdfdb('0x17')](function(_0x5ae070){if(_0x5ae070){_0x24f88a=_0x5ae070['get']({'plain':!![]});_0xd101bf[_0xdfdb('0x2c')]=_[_0xdfdb('0x2e')](db[_0xdfdb('0x45')]['rawAttributes']);_0xd101bf[_0xdfdb('0x26')]=_[_0xdfdb('0x2e')](_0x41701c[_0xdfdb('0x26')]);_0xd101bf[_0xdfdb('0x2f')]=_['intersection'](_0xd101bf[_0xdfdb('0x2c')],_0xd101bf[_0xdfdb('0x26')]);_0x2ac36e['attributes']=_[_0xdfdb('0x30')](_0xd101bf[_0xdfdb('0x2c')],qs[_0xdfdb('0x31')](_0x41701c[_0xdfdb('0x26')][_0xdfdb('0x31')]));_0x2ac36e[_0xdfdb('0x32')]=_0x2ac36e[_0xdfdb('0x32')][_0xdfdb('0x33')]?_0x2ac36e[_0xdfdb('0x32')]:_0xd101bf['model'];if(!_0x41701c[_0xdfdb('0x26')]['hasOwnProperty'](_0xdfdb('0x46'))){_0x2ac36e[_0xdfdb('0x12')]=qs[_0xdfdb('0x12')](_0x41701c[_0xdfdb('0x26')][_0xdfdb('0x12')]);_0x2ac36e[_0xdfdb('0x10')]=qs[_0xdfdb('0x10')](_0x41701c['query'][_0xdfdb('0x10')]);}_0x2ac36e[_0xdfdb('0x47')]=qs[_0xdfdb('0x48')](_0x41701c[_0xdfdb('0x26')][_0xdfdb('0x48')]);_0x2ac36e['where']=qs[_0xdfdb('0x2f')](_['pick'](_0x41701c[_0xdfdb('0x26')],_0xd101bf[_0xdfdb('0x2f')]));_0x2ac36e[_0xdfdb('0x24')][_0xdfdb('0x49')]=_0x5ae070['id'];if(_0x41701c[_0xdfdb('0x26')]['filter']){_0x2ac36e[_0xdfdb('0x24')]=_[_0xdfdb('0x35')](_0x2ac36e['where'],{'$or':_[_0xdfdb('0x1f')](_0x2ac36e[_0xdfdb('0x32')],function(_0x1102f4){var _0x47b8b7={};_0x47b8b7[_0x1102f4]={'$like':'%'+_0x41701c[_0xdfdb('0x26')][_0xdfdb('0x4a')]+'%'};return _0x47b8b7;})});}_0x2ac36e=_[_0xdfdb('0x35')]({},_0x2ac36e,_0x41701c[_0xdfdb('0x36')]);return db[_0xdfdb('0x45')][_0xdfdb('0x27')](_0x2ac36e);}})['then'](function(_0x54f778){if(_0x54f778){return db[_0xdfdb('0x4b')]['findAndCountAll']({'where':{'id':_['map'](_0x54f778,'UserId'),'role':_0xdfdb('0x4c')},'attributes':['id',_0xdfdb('0x1c'),_0xdfdb('0x4d'),_0xdfdb('0x4e'),_0xdfdb('0x4f')]});}})[_0xdfdb('0x17')](function(_0xa1d520){if(_0xa1d520){return{'count':_0xa1d520[_0xdfdb('0x13')],'rows':_[_0xdfdb('0x1f')](_0xa1d520['rows'],function(_0x50f938){return{'membername':_0x50f938[_0xdfdb('0x1c')],'UserId':_0x50f938['id'],'queue_name':_0x24f88a['name'],'FaxQueueId':_0x24f88a['id'],'interface':util[_0xdfdb('0x50')](_0xdfdb('0x51'),_0xdfdb('0x52'),_0x50f938['name']),'penalty':0x0,'paused':_0x50f938[_0xdfdb('0x4d')],'createdAt':_0x50f938[_0xdfdb('0x4f')],'updatedAt':_0x50f938[_0xdfdb('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xdfdb('0x17')](respondWithFilteredResult(_0x11ce58,_0x2ac36e))[_0xdfdb('0x29')](handleError(_0x11ce58,null));};exports[_0xdfdb('0x53')]=function(_0x7e6cd1,_0xc4d29c){var _0x54e145={};var _0x934be6={};var _0x22e816;var _0x5279c6;return db[_0xdfdb('0x20')][_0xdfdb('0x44')]({'where':{'id':_0x7e6cd1[_0xdfdb('0x2b')]['id']}})[_0xdfdb('0x17')](handleEntityNotFound(_0xc4d29c,null))['then'](function(_0x4a7690){if(_0x4a7690){_0x22e816=_0x4a7690;_0x934be6[_0xdfdb('0x2c')]=_[_0xdfdb('0x2e')](db['Team'][_0xdfdb('0x2d')]);_0x934be6[_0xdfdb('0x26')]=_[_0xdfdb('0x2e')](_0x7e6cd1['query']);_0x934be6['filters']=_[_0xdfdb('0x30')](_0x934be6[_0xdfdb('0x2c')],_0x934be6['query']);_0x54e145['attributes']=_[_0xdfdb('0x30')](_0x934be6['model'],qs['fields'](_0x7e6cd1[_0xdfdb('0x26')]['fields']));_0x54e145[_0xdfdb('0x32')]=_0x54e145[_0xdfdb('0x32')]['length']?_0x54e145['attributes']:_0x934be6[_0xdfdb('0x2c')];_0x54e145[_0xdfdb('0x47')]=qs['sort'](_0x7e6cd1[_0xdfdb('0x26')][_0xdfdb('0x48')]);_0x54e145[_0xdfdb('0x24')]=qs[_0xdfdb('0x2f')](_[_0xdfdb('0x54')](_0x7e6cd1['query'],_0x934be6['filters']));if(_0x7e6cd1[_0xdfdb('0x26')][_0xdfdb('0x4a')]){_0x54e145[_0xdfdb('0x24')]=_[_0xdfdb('0x35')](_0x54e145[_0xdfdb('0x24')],{'$or':_[_0xdfdb('0x1f')](_0x54e145['attributes'],function(_0xd226af){var _0x3c3228={};_0x3c3228[_0xd226af]={'$like':'%'+_0x7e6cd1[_0xdfdb('0x26')][_0xdfdb('0x4a')]+'%'};return _0x3c3228;})});}_0x54e145=_[_0xdfdb('0x35')]({},_0x54e145,_0x7e6cd1[_0xdfdb('0x36')]);return _0x22e816[_0xdfdb('0x53')](_0x54e145);}})[_0xdfdb('0x17')](function(_0x38fa9c){if(_0x38fa9c){_0x5279c6=_0x38fa9c[_0xdfdb('0x33')];if(!_0x7e6cd1['query'][_0xdfdb('0x55')](_0xdfdb('0x46'))){_0x54e145[_0xdfdb('0x12')]=qs[_0xdfdb('0x12')](_0x7e6cd1[_0xdfdb('0x26')]['limit']);_0x54e145[_0xdfdb('0x10')]=qs[_0xdfdb('0x10')](_0x7e6cd1[_0xdfdb('0x26')][_0xdfdb('0x10')]);}return _0x22e816['getTeams'](_0x54e145);}})[_0xdfdb('0x17')](function(_0x47040b){if(_0x47040b){return _0x47040b?{'count':_0x5279c6,'rows':_0x47040b}:null;}})[_0xdfdb('0x17')](respondWithResult(_0xc4d29c,null))[_0xdfdb('0x29')](handleError(_0xc4d29c,null));};exports[_0xdfdb('0x56')]=function(_0x79f282,_0x4149f1){var _0x4497f0=_0x79f282[_0xdfdb('0x39')][_0xdfdb('0x57')];return db[_0xdfdb('0x58')]['findAll']({'where':{'id':_0x4497f0},'attributes':['id'],'include':[{'model':db[_0xdfdb('0x4b')],'as':_0xdfdb('0x59'),'attributes':['id','name',_0xdfdb('0x5a'),_0xdfdb('0x5b'),_0xdfdb('0x5c')],'raw':!![]}]})['then'](function(_0x56140e){if(_0x56140e){var _0x4c4d3a=_[_0xdfdb('0x5d')](_0x56140e,function(_0x465565){var _0x1c7964=_0x465565[_0xdfdb('0x19')]({'plain':!![]});return _0x1c7964[_0xdfdb('0x59')];});return db[_0xdfdb('0x20')][_0xdfdb('0x37')]({'where':{'id':_0x79f282['params']['id']}})[_0xdfdb('0x17')](function(_0xcda070){return db[_0xdfdb('0x5e')][_0xdfdb('0x5f')](function(_0x5b6e35){return _0xcda070[_0xdfdb('0x56')](_0x4497f0,{'transaction':_0x5b6e35})[_0xdfdb('0x17')](function(){return BPromise['each'](_0x4c4d3a,function(_0x2ced3d){return db[_0xdfdb('0x45')][_0xdfdb('0x60')]({'where':{'UserId':_0x2ced3d['id'],'FaxQueueId':_0x79f282[_0xdfdb('0x2b')]['id']},'transaction':_0x5b6e35});});})[_0xdfdb('0x17')](function(){_0x4c4d3a['forEach'](function(_0x3a652e){socket['emit'](_0xdfdb('0x61'),{'UserId':_0x3a652e['id'],'FaxQueueId':_0xcda070['id']});});});});});}})[_0xdfdb('0x17')](respondWithStatusCode(_0x4149f1,null))[_0xdfdb('0x29')](handleError(_0x4149f1,null));};exports[_0xdfdb('0x62')]=function(_0x110097,_0x542ab8){return db[_0xdfdb('0x58')][_0xdfdb('0x27')]({'where':{'id':_0x110097['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xdfdb('0x4b')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x542ab8,null))[_0xdfdb('0x17')](function(_0x36d46e){var _0x17e4d2=_[_0xdfdb('0x1f')](_0x36d46e,'id');var _0x2f03f2=[];var _0x4669c2=[];var _0x317549=squel[_0xdfdb('0x63')]();_0x317549['field'](_0xdfdb('0x64'))['from'](_0xdfdb('0x65'),'tq')[_0xdfdb('0x66')](_0xdfdb('0x67'),'ut',_0xdfdb('0x68'))[_0xdfdb('0x24')]('FaxQueueId\x20=\x20?',_0x110097[_0xdfdb('0x2b')]['id']);for(var _0x64639f=0x0;_0x64639f<_0x36d46e[_0xdfdb('0x33')];_0x64639f+=0x1){let _0x1b6445=_0x36d46e[_0x64639f];for(var _0x36241c=0x0;_0x36241c<_0x1b6445['Agents']['length'];_0x36241c+=0x1){let _0x231f20=_0x1b6445[_0xdfdb('0x59')][_0x36241c];var _0x5dd0b4=_0x317549[_0xdfdb('0x69')]();_0x5dd0b4['where'](_0xdfdb('0x6a'),_0x231f20['id']);_0x4669c2[_0xdfdb('0x6b')](db[_0xdfdb('0x5e')]['query'](_0x5dd0b4[_0xdfdb('0x6c')](),{'type':db['sequelize']['QueryTypes'][_0xdfdb('0x6d')]})['then'](function(_0x30d00e){if(_0x30d00e[_0xdfdb('0x33')]===0x1){return _0x231f20['id'];}else{var _0x162eeb=_[_0xdfdb('0x6e')](_[_0xdfdb('0x1f')](_0x30d00e,_0xdfdb('0x6f')),function(_0x305cf2){return _[_0xdfdb('0x70')](_0x17e4d2,_0x305cf2);});if(_0x162eeb){return _0x231f20['id'];}}}));}}return BPromise[_0xdfdb('0x71')](_0x4669c2)[_0xdfdb('0x17')](function(_0x5ed460){_0x2f03f2=_(_0x2f03f2)['union'](_0x5ed460)[_0xdfdb('0x72')]()['value']();return db['FaxQueue']['find']({'where':{'id':_0x110097['params']['id']}})[_0xdfdb('0x17')](function(_0x2caabb){return db[_0xdfdb('0x5e')][_0xdfdb('0x5f')](function(_0x3bda27){return _0x2caabb[_0xdfdb('0x62')](_0x110097[_0xdfdb('0x26')][_0xdfdb('0x57')],{'transaction':_0x3bda27})[_0xdfdb('0x17')](function(){if(!_[_0xdfdb('0x73')](_0x2f03f2)){return _0x2caabb[_0xdfdb('0x74')](_0x2f03f2,{'transaction':_0x3bda27});}})[_0xdfdb('0x17')](function(){_0x2f03f2[_0xdfdb('0x75')](function(_0x561ced){socket['emit'](_0xdfdb('0x76'),{'UserId':_0x561ced,'FaxQueueId':_0x2caabb['id']});});});});});});})[_0xdfdb('0x17')](respondWithStatusCode(_0x542ab8,null))[_0xdfdb('0x29')](handleError(_0x542ab8,null));};exports[_0xdfdb('0x77')]=function(_0x44d944,_0x18505c){return db[_0xdfdb('0x20')][_0xdfdb('0x37')]({'where':{'id':_0x44d944[_0xdfdb('0x2b')]['id']}})['then'](handleEntityNotFound(_0x18505c,null))[_0xdfdb('0x17')](function(_0x3a2d02){if(_0x3a2d02){return _0x3a2d02[_0xdfdb('0x77')](_0x44d944[_0xdfdb('0x39')][_0xdfdb('0x57')],_[_0xdfdb('0x78')](_0x44d944['body'],[_0xdfdb('0x57'),'id'])||{})[_0xdfdb('0x79')](function(_0x379122){for(var _0x3c09ec=0x0;_0x3c09ec<_0x44d944[_0xdfdb('0x39')][_0xdfdb('0x57')]['length'];_0x3c09ec+=0x1){socket[_0xdfdb('0x7a')](_0xdfdb('0x61'),{'UserId':Number(_0x44d944[_0xdfdb('0x39')]['ids'][_0x3c09ec]),'FaxQueueId':Number(_0x44d944['params']['id'])});}return _0x379122;});}})[_0xdfdb('0x17')](respondWithResult(_0x18505c,null))['catch'](handleError(_0x18505c,null));};exports['removeAgents']=function(_0x276efc,_0x27c72c){return db['FaxQueue']['find']({'where':{'id':_0x276efc[_0xdfdb('0x2b')]['id']}})[_0xdfdb('0x17')](handleEntityNotFound(_0x27c72c,null))[_0xdfdb('0x17')](function(_0x1bc293){if(_0x1bc293){return _0x1bc293[_0xdfdb('0x74')](_0x276efc['query']['ids'])[_0xdfdb('0x17')](function(){if(_['isArray'](_0x276efc[_0xdfdb('0x26')][_0xdfdb('0x57')])){for(var _0x3c9465=0x0;_0x3c9465<_0x276efc['query'][_0xdfdb('0x57')][_0xdfdb('0x33')];_0x3c9465+=0x1){socket[_0xdfdb('0x7a')](_0xdfdb('0x76'),{'UserId':Number(_0x276efc['query'][_0xdfdb('0x57')][_0x3c9465]),'FaxQueueId':Number(_0x276efc[_0xdfdb('0x2b')]['id'])});}}else{socket[_0xdfdb('0x7a')](_0xdfdb('0x76'),{'UserId':Number(_0x276efc['query'][_0xdfdb('0x57')]),'FaxQueueId':Number(_0x276efc['params']['id'])});}});}})['then'](respondWithStatusCode(_0x27c72c,null))['catch'](handleError(_0x27c72c,null));};exports['getAgents']=function(_0x56d3e6,_0x171624){var _0xe8ac6c={};var _0x266246={};var _0x17445a;var _0x3a3f23;return db[_0xdfdb('0x20')][_0xdfdb('0x44')]({'where':{'id':_0x56d3e6[_0xdfdb('0x2b')]['id']}})['then'](handleEntityNotFound(_0x171624,null))[_0xdfdb('0x17')](function(_0x502e43){if(_0x502e43){_0x17445a=_0x502e43;_0x266246[_0xdfdb('0x2c')]=_[_0xdfdb('0x2e')](db['User'][_0xdfdb('0x2d')]);_0x266246[_0xdfdb('0x26')]=_['keys'](_0x56d3e6[_0xdfdb('0x26')]);_0x266246[_0xdfdb('0x2f')]=_[_0xdfdb('0x30')](_0x266246[_0xdfdb('0x2c')],_0x266246['query']);_0xe8ac6c[_0xdfdb('0x32')]=_[_0xdfdb('0x30')](_0x266246[_0xdfdb('0x2c')],qs[_0xdfdb('0x31')](_0x56d3e6[_0xdfdb('0x26')]['fields']));_0xe8ac6c['attributes']=_0xe8ac6c[_0xdfdb('0x32')][_0xdfdb('0x33')]?_0xe8ac6c['attributes']:_0x266246[_0xdfdb('0x2c')];_0xe8ac6c['order']=qs[_0xdfdb('0x48')](_0x56d3e6[_0xdfdb('0x26')][_0xdfdb('0x48')]);_0xe8ac6c[_0xdfdb('0x24')]=qs[_0xdfdb('0x2f')](_['pick'](_0x56d3e6[_0xdfdb('0x26')],_0x266246[_0xdfdb('0x2f')]));if(_0x56d3e6[_0xdfdb('0x26')][_0xdfdb('0x4a')]){_0xe8ac6c[_0xdfdb('0x24')]=_[_0xdfdb('0x35')](_0xe8ac6c[_0xdfdb('0x24')],{'$or':_[_0xdfdb('0x1f')](_0xe8ac6c[_0xdfdb('0x32')],function(_0x41e162){var _0x2ee99b={};_0x2ee99b[_0x41e162]={'$like':'%'+_0x56d3e6[_0xdfdb('0x26')][_0xdfdb('0x4a')]+'%'};return _0x2ee99b;})});}_0xe8ac6c=_['merge']({},_0xe8ac6c,_0x56d3e6[_0xdfdb('0x36')]);return _0x17445a[_0xdfdb('0x7b')](_0xe8ac6c);}})['then'](function(_0x5a2d56){if(_0x5a2d56){_0x3a3f23=_0x5a2d56[_0xdfdb('0x33')];if(!_0x56d3e6[_0xdfdb('0x26')][_0xdfdb('0x55')]('nolimit')){_0xe8ac6c[_0xdfdb('0x12')]=qs[_0xdfdb('0x12')](_0x56d3e6['query'][_0xdfdb('0x12')]);_0xe8ac6c[_0xdfdb('0x10')]=qs[_0xdfdb('0x10')](_0x56d3e6['query'][_0xdfdb('0x10')]);}return _0x17445a[_0xdfdb('0x7b')](_0xe8ac6c);}})[_0xdfdb('0x17')](function(_0x1bd0d0){if(_0x1bd0d0){return _0x1bd0d0?{'count':_0x3a3f23,'rows':_0x1bd0d0}:null;}})[_0xdfdb('0x17')](respondWithResult(_0x171624,null))[_0xdfdb('0x29')](handleError(_0x171624,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index a83fd78..4e3a2a3 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 _0xf5e6=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','save'];(function(_0x35f14f,_0x2a2960){var _0x3c738c=function(_0x393235){while(--_0x393235){_0x35f14f['push'](_0x35f14f['shift']());}};_0x3c738c(++_0x2a2960);}(_0xf5e6,0xb5));var _0x6f5e=function(_0x2bd101,_0x1a6fb3){_0x2bd101=_0x2bd101-0x0;var _0x30e156=_0xf5e6[_0x2bd101];return _0x30e156;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x6f5e('0x0'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x6f5e('0x1')](0x0);var events={'afterCreate':_0x6f5e('0x2'),'afterUpdate':_0x6f5e('0x3'),'afterDestroy':_0x6f5e('0x4')};function emitEvent(_0x5975df){return function(_0x4148e4,_0x441ff7,_0x58d628){FaxQueueEvents[_0x6f5e('0x5')](_0x5975df+':'+_0x4148e4['id'],_0x4148e4);FaxQueueEvents[_0x6f5e('0x5')](_0x5975df,_0x4148e4);_0x58d628(null);};}for(var e in events){if(events[_0x6f5e('0x6')](e)){var event=events[e];FaxQueue[_0x6f5e('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0xf22c=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners'];(function(_0x123280,_0x19a19f){var _0x387b58=function(_0xdbd693){while(--_0xdbd693){_0x123280['push'](_0x123280['shift']());}};_0x387b58(++_0x19a19f);}(_0xf22c,0x1e5));var _0xcf22=function(_0x48f261,_0x1ca37a){_0x48f261=_0x48f261-0x0;var _0x3fea51=_0xf22c[_0x48f261];return _0x3fea51;};'use strict';var EventEmitter=require(_0xcf22('0x0'));var FaxQueue=require(_0xcf22('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xcf22('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcf22('0x3'),'afterDestroy':_0xcf22('0x4')};function emitEvent(_0x50dd84){return function(_0x4a59ce,_0x5337ae,_0x16aab8){FaxQueueEvents[_0xcf22('0x5')](_0x50dd84+':'+_0x4a59ce['id'],_0x4a59ce);FaxQueueEvents['emit'](_0x50dd84,_0x4a59ce);_0x16aab8(null);};}for(var e in events){if(events[_0xcf22('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xcf22('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 46f67c5..47a8c88 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 _0x139c=['../../config/environment','exports','define','fax_queues','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x4b4f24,_0x5654a8){var _0x1c13d4=function(_0x4940bf){while(--_0x4940bf){_0x4b4f24['push'](_0x4b4f24['shift']());}};_0x1c13d4(++_0x5654a8);}(_0x139c,0x138));var _0xc139=function(_0x2ee0b7,_0x1c6591){_0x2ee0b7=_0x2ee0b7-0x0;var _0x156128=_0x139c[_0x2ee0b7];return _0x156128;};'use strict';var _=require(_0xc139('0x0'));var util=require(_0xc139('0x1'));var logger=require('../../config/logger')(_0xc139('0x2'));var moment=require(_0xc139('0x3'));var BPromise=require(_0xc139('0x4'));var rp=require(_0xc139('0x5'));var fs=require('fs');var path=require(_0xc139('0x6'));var rimraf=require('rimraf');var config=require(_0xc139('0x7'));var attributes=require('./faxQueue.attributes');module[_0xc139('0x8')]=function(_0x51b604,_0x55dbe0){return _0x51b604[_0xc139('0x9')]('FaxQueue',attributes,{'tableName':_0xc139('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07f7=['bluebird','request-promise','rimraf','../../config/environment','./faxQueue.attributes','exports','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x07f7,0x181));var _0x707f=function(_0x3b632f,_0x453380){_0x3b632f=_0x3b632f-0x0;var _0x10e788=_0x07f7[_0x3b632f];return _0x10e788;};'use strict';var _=require(_0x707f('0x0'));var util=require(_0x707f('0x1'));var logger=require(_0x707f('0x2'))(_0x707f('0x3'));var moment=require(_0x707f('0x4'));var BPromise=require(_0x707f('0x5'));var rp=require(_0x707f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x707f('0x7'));var config=require(_0x707f('0x8'));var attributes=require(_0x707f('0x9'));module[_0x707f('0xa')]=function(_0x6c8150,_0x110195){return _0x6c8150['define'](_0x707f('0xb'),attributes,{'tableName':_0x707f('0xc'),'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 42fc554..210163b 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 _0xb339=['where','attributes','limit','include','map','model','then','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxQueue.socket','register','request','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFaxQueue','FaxQueue','options','raw'];(function(_0x2144f3,_0x5f325e){var _0x18cc72=function(_0x2e798a){while(--_0x2e798a){_0x2144f3['push'](_0x2144f3['shift']());}};_0x18cc72(++_0x5f325e);}(_0xb339,0x1ad));var _0x9b33=function(_0x56608c,_0x29eb74){_0x56608c=_0x56608c-0x0;var _0x3c7fb0=_0xb339[_0x56608c];return _0x3c7fb0;};'use strict';var _=require(_0x9b33('0x0'));var util=require(_0x9b33('0x1'));var moment=require(_0x9b33('0x2'));var BPromise=require(_0x9b33('0x3'));var rs=require(_0x9b33('0x4'));var fs=require('fs');var Redis=require(_0x9b33('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9b33('0x6'));var logger=require('../../config/logger')(_0x9b33('0x7'));var config=require(_0x9b33('0x8'));var jayson=require(_0x9b33('0x9'));var client=jayson[_0x9b33('0xa')][_0x9b33('0xb')]({'port':0x232a});config[_0x9b33('0xc')]=_[_0x9b33('0xd')](config[_0x9b33('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x9b33('0xe'))(new Redis(config[_0x9b33('0xc')]));require(_0x9b33('0xf'))[_0x9b33('0x10')](socket);function respondWithRpcPromise(_0xa479a7,_0x46d2ac,_0x255d96){return new BPromise(function(_0x4807d9,_0x1424b6){return client[_0x9b33('0x11')](_0xa479a7,_0x255d96)['then'](function(_0x403c2a){logger['info'](_0x9b33('0x12'),_0x46d2ac,_0x9b33('0x13'));logger[_0x9b33('0x14')](_0x9b33('0x15'),_0x46d2ac,_0x9b33('0x13'),JSON[_0x9b33('0x16')](_0x403c2a));if(_0x403c2a[_0x9b33('0x17')]){if(_0x403c2a[_0x9b33('0x17')][_0x9b33('0x18')]===0x1f4){logger[_0x9b33('0x17')]('FaxQueue,\x20%s,\x20%s',_0x46d2ac,_0x403c2a[_0x9b33('0x17')][_0x9b33('0x19')]);return _0x1424b6(_0x403c2a[_0x9b33('0x17')][_0x9b33('0x19')]);}logger['error']('FaxQueue,\x20%s,\x20%s',_0x46d2ac,_0x403c2a[_0x9b33('0x17')]['message']);return _0x4807d9(_0x403c2a[_0x9b33('0x17')][_0x9b33('0x19')]);}else{logger[_0x9b33('0x1a')](_0x9b33('0x12'),_0x46d2ac,'request\x20sent');_0x4807d9(_0x403c2a[_0x9b33('0x1b')][_0x9b33('0x19')]);}})[_0x9b33('0x1c')](function(_0x5e2a7d){logger[_0x9b33('0x17')](_0x9b33('0x12'),_0x46d2ac,_0x5e2a7d);_0x1424b6(_0x5e2a7d);});});}exports[_0x9b33('0x1d')]=function(_0x2830e8){var _0x21c4cc=this;return new Promise(function(_0xf70151,_0x2c1661){return db[_0x9b33('0x1e')]['findAll']({'raw':_0x2830e8[_0x9b33('0x1f')]?_0x2830e8[_0x9b33('0x1f')][_0x9b33('0x20')]===undefined?!![]:![]:!![],'where':_0x2830e8[_0x9b33('0x1f')]?_0x2830e8[_0x9b33('0x1f')][_0x9b33('0x21')]||null:null,'attributes':_0x2830e8['options']?_0x2830e8['options'][_0x9b33('0x22')]||null:null,'limit':_0x2830e8[_0x9b33('0x1f')]?_0x2830e8[_0x9b33('0x1f')][_0x9b33('0x23')]||null:null,'include':_0x2830e8[_0x9b33('0x1f')]?_0x2830e8[_0x9b33('0x1f')][_0x9b33('0x24')]?_[_0x9b33('0x25')](_0x2830e8[_0x9b33('0x1f')][_0x9b33('0x24')],function(_0x22026e){return{'model':db[_0x22026e[_0x9b33('0x26')]],'as':_0x22026e['as'],'attributes':_0x22026e[_0x9b33('0x22')],'include':_0x22026e[_0x9b33('0x24')]?_[_0x9b33('0x25')](_0x22026e['include'],function(_0x319b88){return{'model':db[_0x319b88[_0x9b33('0x26')]],'as':_0x319b88['as'],'attributes':_0x319b88[_0x9b33('0x22')],'include':_0x319b88[_0x9b33('0x24')]?_[_0x9b33('0x25')](_0x319b88[_0x9b33('0x24')],function(_0x453742){return{'model':db[_0x453742[_0x9b33('0x26')]],'as':_0x453742['as'],'attributes':_0x453742[_0x9b33('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9b33('0x27')](function(_0x40357f){logger[_0x9b33('0x1a')](_0x9b33('0x1d'),_0x2830e8);logger['debug'](_0x9b33('0x1d'),_0x2830e8,JSON[_0x9b33('0x16')](_0x40357f));_0xf70151(_0x40357f);})['catch'](function(_0x3d9d1d){logger[_0x9b33('0x17')](_0x9b33('0x1d'),_0x3d9d1d[_0x9b33('0x19')],_0x2830e8);_0x2c1661(_0x21c4cc[_0x9b33('0x17')](0x1f4,_0x3d9d1d[_0x9b33('0x19')]));});});};exports[_0x9b33('0x28')]=function(_0x39a0ea){var _0x3de307=this;return new Promise(function(_0x2eac4e,_0x52f59c){return db[_0x9b33('0x1e')][_0x9b33('0x29')]({'raw':_0x39a0ea[_0x9b33('0x1f')]?_0x39a0ea['options'][_0x9b33('0x20')]===undefined?!![]:![]:!![],'where':_0x39a0ea['options']?_0x39a0ea['options'][_0x9b33('0x21')]||null:null,'attributes':_0x39a0ea[_0x9b33('0x1f')]?_0x39a0ea[_0x9b33('0x1f')][_0x9b33('0x22')]||null:null,'include':_0x39a0ea['options']?_0x39a0ea[_0x9b33('0x1f')][_0x9b33('0x24')]?_[_0x9b33('0x25')](_0x39a0ea[_0x9b33('0x1f')][_0x9b33('0x24')],function(_0x366216){return{'model':db[_0x366216[_0x9b33('0x26')]],'as':_0x366216['as'],'attributes':_0x366216[_0x9b33('0x22')],'include':_0x366216['include']?_[_0x9b33('0x25')](_0x366216[_0x9b33('0x24')],function(_0x170837){return{'model':db[_0x170837['model']],'as':_0x170837['as'],'attributes':_0x170837[_0x9b33('0x22')],'include':_0x170837[_0x9b33('0x24')]?_['map'](_0x170837[_0x9b33('0x24')],function(_0x589fc8){return{'model':db[_0x589fc8[_0x9b33('0x26')]],'as':_0x589fc8['as'],'attributes':_0x589fc8[_0x9b33('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a789d){logger[_0x9b33('0x1a')](_0x9b33('0x28'),_0x39a0ea);logger['debug'](_0x9b33('0x28'),_0x39a0ea,JSON['stringify'](_0x3a789d));_0x2eac4e(_0x3a789d);})[_0x9b33('0x1c')](function(_0x12f485){logger[_0x9b33('0x17')](_0x9b33('0x28'),_0x12f485['message'],_0x39a0ea);_0x52f59c(_0x3de307[_0x9b33('0x17')](0x1f4,_0x12f485['message']));});});}; \ No newline at end of file +var _0xb0fb=['error','message','catch','GetFaxQueue','FaxQueue','findAll','options','raw','limit','include','attributes','map','model','debug','find','where','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5e4759,_0x1f8793){var _0x1aefe3=function(_0x1be07e){while(--_0x1be07e){_0x5e4759['push'](_0x5e4759['shift']());}};_0x1aefe3(++_0x1f8793);}(_0xb0fb,0x149));var _0xbb0f=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb0fb[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xbb0f('0x0'));var util=require(_0xbb0f('0x1'));var moment=require(_0xbb0f('0x2'));var BPromise=require(_0xbb0f('0x3'));var rs=require(_0xbb0f('0x4'));var fs=require('fs');var Redis=require(_0xbb0f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb0f('0x6'));var logger=require(_0xbb0f('0x7'))('rpc');var config=require(_0xbb0f('0x8'));var jayson=require(_0xbb0f('0x9'));var client=jayson[_0xbb0f('0xa')][_0xbb0f('0xb')]({'port':0x232a});config[_0xbb0f('0xc')]=_['defaults'](config[_0xbb0f('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xbb0f('0xd'))(new Redis(config[_0xbb0f('0xc')]));require('./faxQueue.socket')[_0xbb0f('0xe')](socket);function respondWithRpcPromise(_0xbecdc,_0x4b9dce,_0x351839){return new BPromise(function(_0x10d1ef,_0x98a1c0){return client[_0xbb0f('0xf')](_0xbecdc,_0x351839)[_0xbb0f('0x10')](function(_0x50591d){logger[_0xbb0f('0x11')](_0xbb0f('0x12'),_0x4b9dce,_0xbb0f('0x13'));logger['debug'](_0xbb0f('0x14'),_0x4b9dce,_0xbb0f('0x13'),JSON[_0xbb0f('0x15')](_0x50591d));if(_0x50591d[_0xbb0f('0x16')]){if(_0x50591d['error']['code']===0x1f4){logger[_0xbb0f('0x16')]('FaxQueue,\x20%s,\x20%s',_0x4b9dce,_0x50591d[_0xbb0f('0x16')][_0xbb0f('0x17')]);return _0x98a1c0(_0x50591d[_0xbb0f('0x16')]['message']);}logger[_0xbb0f('0x16')](_0xbb0f('0x12'),_0x4b9dce,_0x50591d[_0xbb0f('0x16')][_0xbb0f('0x17')]);return _0x10d1ef(_0x50591d[_0xbb0f('0x16')][_0xbb0f('0x17')]);}else{logger[_0xbb0f('0x11')](_0xbb0f('0x12'),_0x4b9dce,'request\x20sent');_0x10d1ef(_0x50591d['result'][_0xbb0f('0x17')]);}})[_0xbb0f('0x18')](function(_0x1571ec){logger['error'](_0xbb0f('0x12'),_0x4b9dce,_0x1571ec);_0x98a1c0(_0x1571ec);});});}exports[_0xbb0f('0x19')]=function(_0x4480f3){var _0x5e6672=this;return new Promise(function(_0x88bad3,_0x48e885){return db[_0xbb0f('0x1a')][_0xbb0f('0x1b')]({'raw':_0x4480f3[_0xbb0f('0x1c')]?_0x4480f3[_0xbb0f('0x1c')][_0xbb0f('0x1d')]===undefined?!![]:![]:!![],'where':_0x4480f3[_0xbb0f('0x1c')]?_0x4480f3[_0xbb0f('0x1c')]['where']||null:null,'attributes':_0x4480f3[_0xbb0f('0x1c')]?_0x4480f3[_0xbb0f('0x1c')]['attributes']||null:null,'limit':_0x4480f3[_0xbb0f('0x1c')]?_0x4480f3[_0xbb0f('0x1c')][_0xbb0f('0x1e')]||null:null,'include':_0x4480f3[_0xbb0f('0x1c')]?_0x4480f3['options'][_0xbb0f('0x1f')]?_['map'](_0x4480f3[_0xbb0f('0x1c')][_0xbb0f('0x1f')],function(_0x4e2cc9){return{'model':db[_0x4e2cc9['model']],'as':_0x4e2cc9['as'],'attributes':_0x4e2cc9[_0xbb0f('0x20')],'include':_0x4e2cc9['include']?_[_0xbb0f('0x21')](_0x4e2cc9[_0xbb0f('0x1f')],function(_0x33bd92){return{'model':db[_0x33bd92[_0xbb0f('0x22')]],'as':_0x33bd92['as'],'attributes':_0x33bd92[_0xbb0f('0x20')],'include':_0x33bd92[_0xbb0f('0x1f')]?_[_0xbb0f('0x21')](_0x33bd92['include'],function(_0x2ea852){return{'model':db[_0x2ea852[_0xbb0f('0x22')]],'as':_0x2ea852['as'],'attributes':_0x2ea852[_0xbb0f('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbb0f('0x10')](function(_0x797634){logger[_0xbb0f('0x11')](_0xbb0f('0x19'),_0x4480f3);logger[_0xbb0f('0x23')]('GetFaxQueue',_0x4480f3,JSON['stringify'](_0x797634));_0x88bad3(_0x797634);})[_0xbb0f('0x18')](function(_0x1fdd7f){logger[_0xbb0f('0x16')](_0xbb0f('0x19'),_0x1fdd7f[_0xbb0f('0x17')],_0x4480f3);_0x48e885(_0x5e6672['error'](0x1f4,_0x1fdd7f[_0xbb0f('0x17')]));});});};exports['ShowFaxQueue']=function(_0x5baab1){var _0x7d3bb=this;return new Promise(function(_0x310aa6,_0x1543ac){return db[_0xbb0f('0x1a')][_0xbb0f('0x24')]({'raw':_0x5baab1[_0xbb0f('0x1c')]?_0x5baab1[_0xbb0f('0x1c')][_0xbb0f('0x1d')]===undefined?!![]:![]:!![],'where':_0x5baab1[_0xbb0f('0x1c')]?_0x5baab1['options'][_0xbb0f('0x25')]||null:null,'attributes':_0x5baab1[_0xbb0f('0x1c')]?_0x5baab1[_0xbb0f('0x1c')][_0xbb0f('0x20')]||null:null,'include':_0x5baab1[_0xbb0f('0x1c')]?_0x5baab1[_0xbb0f('0x1c')][_0xbb0f('0x1f')]?_[_0xbb0f('0x21')](_0x5baab1[_0xbb0f('0x1c')]['include'],function(_0x22cb21){return{'model':db[_0x22cb21[_0xbb0f('0x22')]],'as':_0x22cb21['as'],'attributes':_0x22cb21[_0xbb0f('0x20')],'include':_0x22cb21[_0xbb0f('0x1f')]?_[_0xbb0f('0x21')](_0x22cb21[_0xbb0f('0x1f')],function(_0x5cee6a){return{'model':db[_0x5cee6a[_0xbb0f('0x22')]],'as':_0x5cee6a['as'],'attributes':_0x5cee6a[_0xbb0f('0x20')],'include':_0x5cee6a[_0xbb0f('0x1f')]?_['map'](_0x5cee6a['include'],function(_0x3669df){return{'model':db[_0x3669df[_0xbb0f('0x22')]],'as':_0x3669df['as'],'attributes':_0x3669df[_0xbb0f('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a8afa){logger[_0xbb0f('0x11')](_0xbb0f('0x26'),_0x5baab1);logger[_0xbb0f('0x23')]('ShowFaxQueue',_0x5baab1,JSON[_0xbb0f('0x15')](_0x3a8afa));_0x310aa6(_0x3a8afa);})[_0xbb0f('0x18')](function(_0x57f0d1){logger[_0xbb0f('0x16')](_0xbb0f('0x26'),_0x57f0d1['message'],_0x5baab1);_0x1543ac(_0x7d3bb[_0xbb0f('0x16')](0x1f4,_0x57f0d1['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 5765d90..f30d271 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 _0xbea5=['removeListener','register','length','faxQueue:','./faxQueue.events','save','remove','update'];(function(_0x18b3ad,_0x2a0be7){var _0x23057a=function(_0x3a1d84){while(--_0x3a1d84){_0x18b3ad['push'](_0x18b3ad['shift']());}};_0x23057a(++_0x2a0be7);}(_0xbea5,0x13c));var _0x5bea=function(_0x13b7fd,_0x4eaf7f){_0x13b7fd=_0x13b7fd-0x0;var _0x32a74a=_0xbea5[_0x13b7fd];return _0x32a74a;};'use strict';var FaxQueueEvents=require(_0x5bea('0x0'));var events=[_0x5bea('0x1'),_0x5bea('0x2'),_0x5bea('0x3')];function createListener(_0x2885a2,_0x5e6ec3){return function(_0x544acf){_0x5e6ec3['emit'](_0x2885a2,_0x544acf);};}function removeListener(_0x1d12aa,_0x4007fa){return function(){FaxQueueEvents[_0x5bea('0x4')](_0x1d12aa,_0x4007fa);};}exports[_0x5bea('0x5')]=function(_0x115efa){for(var _0x20c132=0x0,_0x250fdd=events[_0x5bea('0x6')];_0x20c132<_0x250fdd;_0x20c132++){var _0x3a0192=events[_0x20c132];var _0x2585c1=createListener(_0x5bea('0x7')+_0x3a0192,_0x115efa);FaxQueueEvents['on'](_0x3a0192,_0x2585c1);}}; \ No newline at end of file +var _0x0f37=['length','faxQueue:','save','update','emit','removeListener','register'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0f37,0x191));var _0x70f3=function(_0x513254,_0x1305ca){_0x513254=_0x513254-0x0;var _0x384c92=_0x0f37[_0x513254];return _0x384c92;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x70f3('0x0'),'remove',_0x70f3('0x1')];function createListener(_0x2efdab,_0x2f1b6a){return function(_0xe0402c){_0x2f1b6a[_0x70f3('0x2')](_0x2efdab,_0xe0402c);};}function removeListener(_0x1ae3d3,_0x37cc2d){return function(){FaxQueueEvents[_0x70f3('0x3')](_0x1ae3d3,_0x37cc2d);};}exports[_0x70f3('0x4')]=function(_0x3c5925){for(var _0x58a8df=0x0,_0x31ae64=events[_0x70f3('0x5')];_0x58a8df<_0x31ae64;_0x58a8df++){var _0x513385=events[_0x58a8df];var _0x4fe47e=createListener(_0x70f3('0x6')+_0x513385,_0x3c5925);FaxQueueEvents['on'](_0x513385,_0x4fe47e);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 6692ab9..9e0e80a 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 _0x6d38=['../../config/environment','./faxQueue.controller','isAuthenticated','index','get','/describe','/:id','/:id/members','/:id/teams','getAgents','post','create','/:id/users','addAgents','put','update','destroy','delete','removeTeams','removeAgents','util','path','connect-timeout','fs-extra','../../components/interaction/service'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x6d38,0x1ef));var _0x86d3=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x6d38[_0x21a9d9];return _0x46adce;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x86d3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var controller=require(_0x86d3('0x6'));router['get']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0x8')]);router[_0x86d3('0x9')](_0x86d3('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x86d3('0x9')](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller['show']);router['get'](_0x86d3('0xc'),auth[_0x86d3('0x7')](),controller['getMembers']);router['get'](_0x86d3('0xd'),auth[_0x86d3('0x7')](),controller['getTeams']);router[_0x86d3('0x9')]('/:id/users',auth[_0x86d3('0x7')](),controller[_0x86d3('0xe')]);router[_0x86d3('0xf')]('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0x10')]);router[_0x86d3('0xf')](_0x86d3('0xd'),auth[_0x86d3('0x7')](),controller['addTeams']);router[_0x86d3('0xf')](_0x86d3('0x11'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x12')]);router[_0x86d3('0x13')](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x14')]);router['delete'](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x15')]);router[_0x86d3('0x16')](_0x86d3('0xd'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x17')]);router[_0x86d3('0x16')](_0x86d3('0x11'),auth['isAuthenticated'](),controller[_0x86d3('0x18')]);module['exports']=router; \ No newline at end of file +var _0x687b=['multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','create','post','addTeams','addAgents','put','/:id','update','delete','destroy','exports'];(function(_0x560e64,_0x3b0905){var _0x5a9701=function(_0x2d438b){while(--_0x2d438b){_0x560e64['push'](_0x560e64['shift']());}};_0x5a9701(++_0x3b0905);}(_0x687b,0x14a));var _0xb687=function(_0x28111f,_0x254934){_0x28111f=_0x28111f-0x0;var _0x5203e6=_0x687b[_0x28111f];return _0x5203e6;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb687('0x4'));var auth=require(_0xb687('0x5'));var interaction=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var controller=require(_0xb687('0x8'));router[_0xb687('0x9')]('/',auth[_0xb687('0xa')](),controller[_0xb687('0xb')]);router[_0xb687('0x9')](_0xb687('0xc'),auth['isAuthenticated'](),controller[_0xb687('0xd')]);router[_0xb687('0x9')]('/:id',auth[_0xb687('0xa')](),controller[_0xb687('0xe')]);router[_0xb687('0x9')](_0xb687('0xf'),auth[_0xb687('0xa')](),controller[_0xb687('0x10')]);router[_0xb687('0x9')](_0xb687('0x11'),auth[_0xb687('0xa')](),controller['getTeams']);router[_0xb687('0x9')](_0xb687('0x12'),auth[_0xb687('0xa')](),controller[_0xb687('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb687('0x14')]);router[_0xb687('0x15')]('/:id/teams',auth[_0xb687('0xa')](),controller[_0xb687('0x16')]);router[_0xb687('0x15')](_0xb687('0x12'),auth[_0xb687('0xa')](),controller[_0xb687('0x17')]);router[_0xb687('0x18')](_0xb687('0x19'),auth[_0xb687('0xa')](),controller[_0xb687('0x1a')]);router[_0xb687('0x1b')](_0xb687('0x19'),auth['isAuthenticated'](),controller[_0xb687('0x1c')]);router[_0xb687('0x1b')](_0xb687('0x11'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xb687('0x1b')](_0xb687('0x12'),auth[_0xb687('0xa')](),controller['removeAgents']);module[_0xb687('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 911872f..446fde0 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 _0x716a=['exports','STRING','DATE','moment','sequelize'];(function(_0x2311c9,_0x19a509){var _0x4cf57a=function(_0xf776d2){while(--_0xf776d2){_0x2311c9['push'](_0x2311c9['shift']());}};_0x4cf57a(++_0x19a509);}(_0x716a,0x1a2));var _0xa716=function(_0x1678c8,_0x1c32f4){_0x1678c8=_0x1678c8-0x0;var _0x387aa9=_0x716a[_0x1678c8];return _0x387aa9;};'use strict';var moment=require(_0xa716('0x0'));var Sequelize=require(_0xa716('0x1'));module[_0xa716('0x2')]={'uniqueid':{'type':Sequelize[_0xa716('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa716('0x3')]},'joinAt':{'type':Sequelize[_0xa716('0x4')]},'leaveAt':{'type':Sequelize[_0xa716('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xa716('0x4')]},'reason':{'type':Sequelize[_0xa716('0x3')]}}; \ No newline at end of file +var _0x61d8=['exports','STRING','DATE','moment','sequelize'];(function(_0x5aa39e,_0x4c04da){var _0x2d9180=function(_0x4e5654){while(--_0x4e5654){_0x5aa39e['push'](_0x5aa39e['shift']());}};_0x2d9180(++_0x4c04da);}(_0x61d8,0x12f));var _0x861d=function(_0x14b251,_0x2d28f6){_0x14b251=_0x14b251-0x0;var _0x2a7a48=_0x61d8[_0x14b251];return _0x2a7a48;};'use strict';var moment=require(_0x861d('0x0'));var Sequelize=require(_0x861d('0x1'));module[_0x861d('0x2')]={'uniqueid':{'type':Sequelize[_0x861d('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x861d('0x3')]},'joinAt':{'type':Sequelize[_0x861d('0x4')]},'leaveAt':{'type':Sequelize[_0x861d('0x4')]},'acceptAt':{'type':Sequelize[_0x861d('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x861d('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 24840fa..67defcf 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 _0x4627=['apply','reject','save','then','end','sendStatus','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','params','length','include','create','body','find','destroy','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','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','Content-Range','json'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4627,0x115));var _0x7462=function(_0x43d16c,_0x2b5447){_0x43d16c=_0x43d16c-0x0;var _0x208cce=_0x4627[_0x43d16c];return _0x208cce;};'use strict';var emlformat=require(_0x7462('0x0'));var rimraf=require(_0x7462('0x1'));var zipdir=require(_0x7462('0x2'));var jsonpatch=require(_0x7462('0x3'));var rp=require(_0x7462('0x4'));var moment=require(_0x7462('0x5'));var BPromise=require(_0x7462('0x6'));var Mustache=require(_0x7462('0x7'));var util=require(_0x7462('0x8'));var path=require(_0x7462('0x9'));var sox=require(_0x7462('0xa'));var csv=require(_0x7462('0xb'));var ejs=require(_0x7462('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7462('0xd'));var squel=require(_0x7462('0xe'));var crypto=require(_0x7462('0xf'));var jsforce=require(_0x7462('0x10'));var deskjs=require(_0x7462('0x11'));var toCsv=require(_0x7462('0xb'));var querystring=require(_0x7462('0x12'));var Papa=require(_0x7462('0x13'));var Redis=require(_0x7462('0x14'));var authService=require(_0x7462('0x15'));var qs=require(_0x7462('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7462('0x17'))(_0x7462('0x18'));var utils=require(_0x7462('0x19'));var config=require(_0x7462('0x1a'));var licenseUtil=require(_0x7462('0x1b'));var db=require(_0x7462('0x1c'))['db'];function respondWithStatusCode(_0x31bf84,_0x4e313a){_0x4e313a=_0x4e313a||0xcc;return function(_0x5cb363){if(_0x5cb363){return _0x31bf84['sendStatus'](_0x4e313a);}return _0x31bf84[_0x7462('0x1d')](_0x4e313a)['end']();};}function respondWithResult(_0x1ba7e5,_0x461bd2){_0x461bd2=_0x461bd2||0xc8;return function(_0x368f45){if(_0x368f45){return _0x1ba7e5[_0x7462('0x1d')](_0x461bd2)['json'](_0x368f45);}};}function respondWithFilteredResult(_0x27b8f5,_0x4913ff){return function(_0x36b008){if(_0x36b008){var _0x42ed50=typeof _0x4913ff[_0x7462('0x1e')]===_0x7462('0x1f')&&typeof _0x4913ff['limit']===_0x7462('0x1f');var _0x56ed70=_0x36b008[_0x7462('0x20')];var _0x216eba=_0x42ed50?0x0:_0x4913ff[_0x7462('0x1e')];var _0x26e25f=_0x42ed50?_0x36b008['count']:_0x4913ff[_0x7462('0x1e')]+_0x4913ff['limit'];var _0x85341c;if(_0x26e25f>=_0x56ed70){_0x26e25f=_0x56ed70;_0x85341c=0xc8;}else{_0x85341c=0xce;}_0x27b8f5[_0x7462('0x1d')](_0x85341c);return _0x27b8f5['set'](_0x7462('0x21'),_0x216eba+'-'+_0x26e25f+'/'+_0x56ed70)[_0x7462('0x22')](_0x36b008);}return null;};}function patchUpdates(_0x4d0e60){return function(_0x25a44a){try{jsonpatch[_0x7462('0x23')](_0x25a44a,_0x4d0e60,!![]);}catch(_0x2e9a25){return BPromise[_0x7462('0x24')](_0x2e9a25);}return _0x25a44a[_0x7462('0x25')]();};}function saveUpdates(_0x4404eb,_0x32da06){return function(_0x3c9616){if(_0x3c9616){return _0x3c9616['update'](_0x4404eb)[_0x7462('0x26')](function(_0x52460e){return _0x52460e;});}return null;};}function removeEntity(_0x185934,_0x11caf5){return function(_0x290715){if(_0x290715){return _0x290715['destroy']()[_0x7462('0x26')](function(){_0x185934['status'](0xcc)[_0x7462('0x27')]();});}};}function handleEntityNotFound(_0x5473d1,_0x5759fa){return function(_0x29992b){if(!_0x29992b){_0x5473d1[_0x7462('0x28')](0x194);}return _0x29992b;};}function handleError(_0x51d9d9,_0x5575fc){_0x5575fc=_0x5575fc||0x1f4;return function(_0x554d21){logger['error'](_0x554d21['stack']);if(_0x554d21[_0x7462('0x29')]){delete _0x554d21[_0x7462('0x29')];}_0x51d9d9['status'](_0x5575fc)[_0x7462('0x2a')](_0x554d21);};}exports[_0x7462('0x2b')]=function(_0x3a3313,_0x10a673){var _0x4948c9={},_0x1f279b={},_0x3523c={'count':0x0,'rows':[]};var _0x30cb61=_[_0x7462('0x2c')](db[_0x7462('0x2d')][_0x7462('0x2e')],function(_0x1136e7){return{'name':_0x1136e7[_0x7462('0x2f')],'type':_0x1136e7[_0x7462('0x30')][_0x7462('0x31')]};});_0x1f279b['model']=_[_0x7462('0x2c')](_0x30cb61,'name');_0x1f279b[_0x7462('0x32')]=_[_0x7462('0x33')](_0x3a3313[_0x7462('0x32')]);_0x1f279b[_0x7462('0x34')]=_['intersection'](_0x1f279b[_0x7462('0x35')],_0x1f279b[_0x7462('0x32')]);_0x4948c9[_0x7462('0x36')]=_[_0x7462('0x37')](_0x1f279b[_0x7462('0x35')],qs[_0x7462('0x38')](_0x3a3313['query'][_0x7462('0x38')]));_0x4948c9['attributes']=_0x4948c9[_0x7462('0x36')]['length']?_0x4948c9[_0x7462('0x36')]:_0x1f279b[_0x7462('0x35')];if(!_0x3a3313['query'][_0x7462('0x39')](_0x7462('0x3a'))){_0x4948c9[_0x7462('0x3b')]=qs[_0x7462('0x3b')](_0x3a3313[_0x7462('0x32')][_0x7462('0x3b')]);_0x4948c9[_0x7462('0x1e')]=qs[_0x7462('0x1e')](_0x3a3313[_0x7462('0x32')][_0x7462('0x1e')]);}_0x4948c9[_0x7462('0x3c')]=qs[_0x7462('0x3d')](_0x3a3313[_0x7462('0x32')][_0x7462('0x3d')]);_0x4948c9['where']=qs[_0x7462('0x34')](_[_0x7462('0x3e')](_0x3a3313[_0x7462('0x32')],_0x1f279b[_0x7462('0x34')]),_0x30cb61);if(_0x3a3313['query'][_0x7462('0x3f')]){_0x4948c9[_0x7462('0x40')]=_[_0x7462('0x41')](_0x4948c9[_0x7462('0x40')],{'$or':_[_0x7462('0x2c')](_0x30cb61,function(_0x235075){if(_0x235075['type']!==_0x7462('0x42')){var _0x11192a={};_0x11192a[_0x235075[_0x7462('0x29')]]={'$like':'%'+_0x3a3313[_0x7462('0x32')]['filter']+'%'};return _0x11192a;}})});}_0x4948c9=_[_0x7462('0x41')]({},_0x4948c9,_0x3a3313[_0x7462('0x43')]);var _0x2ceb2c={'where':_0x4948c9['where']};return db[_0x7462('0x2d')][_0x7462('0x20')](_0x2ceb2c)[_0x7462('0x26')](function(_0x592df3){_0x3523c[_0x7462('0x20')]=_0x592df3;if(_0x3a3313['query'][_0x7462('0x44')]){_0x4948c9['include']=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0x4948c9);})[_0x7462('0x26')](function(_0x128029){_0x3523c[_0x7462('0x45')]=_0x128029;return _0x3523c;})['then'](respondWithFilteredResult(_0x10a673,_0x4948c9))['catch'](handleError(_0x10a673,null));};exports['show']=function(_0x3baf7a,_0x8aa7cd){var _0x57e0ae={'raw':!![],'where':{'id':_0x3baf7a[_0x7462('0x46')]['id']}},_0x5e50c7={};_0x5e50c7[_0x7462('0x35')]=_[_0x7462('0x33')](db[_0x7462('0x2d')]['rawAttributes']);_0x5e50c7['query']=_[_0x7462('0x33')](_0x3baf7a[_0x7462('0x32')]);_0x5e50c7[_0x7462('0x34')]=_[_0x7462('0x37')](_0x5e50c7['model'],_0x5e50c7[_0x7462('0x32')]);_0x57e0ae[_0x7462('0x36')]=_[_0x7462('0x37')](_0x5e50c7['model'],qs[_0x7462('0x38')](_0x3baf7a['query'][_0x7462('0x38')]));_0x57e0ae['attributes']=_0x57e0ae['attributes'][_0x7462('0x47')]?_0x57e0ae[_0x7462('0x36')]:_0x5e50c7[_0x7462('0x35')];if(_0x3baf7a[_0x7462('0x32')][_0x7462('0x44')]){_0x57e0ae[_0x7462('0x48')]=[{'all':!![]}];}_0x57e0ae=_[_0x7462('0x41')]({},_0x57e0ae,_0x3baf7a[_0x7462('0x43')]);return db[_0x7462('0x2d')]['find'](_0x57e0ae)['then'](handleEntityNotFound(_0x8aa7cd,null))[_0x7462('0x26')](respondWithResult(_0x8aa7cd,null))['catch'](handleError(_0x8aa7cd,null));};exports[_0x7462('0x49')]=function(_0x53ddd2,_0x331459){return db[_0x7462('0x2d')][_0x7462('0x49')](_0x53ddd2[_0x7462('0x4a')],{})[_0x7462('0x26')](respondWithResult(_0x331459,0xc9))['catch'](handleError(_0x331459,null));};exports['update']=function(_0xe71f4d,_0x37fc97){if(_0xe71f4d[_0x7462('0x4a')]['id']){delete _0xe71f4d[_0x7462('0x4a')]['id'];}return db[_0x7462('0x2d')][_0x7462('0x4b')]({'where':{'id':_0xe71f4d['params']['id']}})[_0x7462('0x26')](handleEntityNotFound(_0x37fc97,null))[_0x7462('0x26')](saveUpdates(_0xe71f4d[_0x7462('0x4a')],null))[_0x7462('0x26')](respondWithResult(_0x37fc97,null))['catch'](handleError(_0x37fc97,null));};exports[_0x7462('0x4c')]=function(_0x26fa39,_0x4429da){return db['FaxQueueReport'][_0x7462('0x4b')]({'where':{'id':_0x26fa39['params']['id']}})[_0x7462('0x26')](handleEntityNotFound(_0x4429da,null))[_0x7462('0x26')](removeEntity(_0x4429da,null))['catch'](handleError(_0x4429da,null));};exports['describe']=function(_0x198fdb,_0x3c82fa){return db[_0x7462('0x2d')][_0x7462('0x4d')]()[_0x7462('0x26')](respondWithResult(_0x3c82fa,null))['catch'](handleError(_0x3c82fa,null));}; \ No newline at end of file +var _0x0aaf=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','keys','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','model','query'];(function(_0x436de0,_0x4c04f0){var _0x2be7d4=function(_0x548a0c){while(--_0x548a0c){_0x436de0['push'](_0x436de0['shift']());}};_0x2be7d4(++_0x4c04f0);}(_0x0aaf,0x1c8));var _0xf0aa=function(_0x596284,_0x1cd02b){_0x596284=_0x596284-0x0;var _0x5313c6=_0x0aaf[_0x596284];return _0x5313c6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf0aa('0x0'));var jsonpatch=require(_0xf0aa('0x1'));var rp=require(_0xf0aa('0x2'));var moment=require(_0xf0aa('0x3'));var BPromise=require(_0xf0aa('0x4'));var Mustache=require('mustache');var util=require(_0xf0aa('0x5'));var path=require(_0xf0aa('0x6'));var sox=require('sox');var csv=require(_0xf0aa('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf0aa('0x8'));var _=require('lodash');var squel=require(_0xf0aa('0x9'));var crypto=require(_0xf0aa('0xa'));var jsforce=require(_0xf0aa('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf0aa('0x7'));var querystring=require(_0xf0aa('0xc'));var Papa=require('papaparse');var Redis=require(_0xf0aa('0xd'));var authService=require(_0xf0aa('0xe'));var qs=require(_0xf0aa('0xf'));var as=require(_0xf0aa('0x10'));var hardwareService=require(_0xf0aa('0x11'));var logger=require(_0xf0aa('0x12'))(_0xf0aa('0x13'));var utils=require(_0xf0aa('0x14'));var config=require(_0xf0aa('0x15'));var licenseUtil=require(_0xf0aa('0x16'));var db=require(_0xf0aa('0x17'))['db'];function respondWithStatusCode(_0x40b5be,_0x47961e){_0x47961e=_0x47961e||0xcc;return function(_0x4f8622){if(_0x4f8622){return _0x40b5be[_0xf0aa('0x18')](_0x47961e);}return _0x40b5be[_0xf0aa('0x19')](_0x47961e)['end']();};}function respondWithResult(_0x4dc456,_0x37a6ac){_0x37a6ac=_0x37a6ac||0xc8;return function(_0x51bb2c){if(_0x51bb2c){return _0x4dc456[_0xf0aa('0x19')](_0x37a6ac)['json'](_0x51bb2c);}};}function respondWithFilteredResult(_0x22bb2e,_0x4b6219){return function(_0x3fb1fe){if(_0x3fb1fe){var _0x114c96=typeof _0x4b6219[_0xf0aa('0x1a')]===_0xf0aa('0x1b')&&typeof _0x4b6219[_0xf0aa('0x1c')]===_0xf0aa('0x1b');var _0x34e6f7=_0x3fb1fe[_0xf0aa('0x1d')];var _0x4e3fe6=_0x114c96?0x0:_0x4b6219[_0xf0aa('0x1a')];var _0x30f055=_0x114c96?_0x3fb1fe['count']:_0x4b6219[_0xf0aa('0x1a')]+_0x4b6219[_0xf0aa('0x1c')];var _0x35f407;if(_0x30f055>=_0x34e6f7){_0x30f055=_0x34e6f7;_0x35f407=0xc8;}else{_0x35f407=0xce;}_0x22bb2e[_0xf0aa('0x19')](_0x35f407);return _0x22bb2e[_0xf0aa('0x1e')](_0xf0aa('0x1f'),_0x4e3fe6+'-'+_0x30f055+'/'+_0x34e6f7)['json'](_0x3fb1fe);}return null;};}function patchUpdates(_0x112980){return function(_0x227cba){try{jsonpatch[_0xf0aa('0x20')](_0x227cba,_0x112980,!![]);}catch(_0x388893){return BPromise[_0xf0aa('0x21')](_0x388893);}return _0x227cba[_0xf0aa('0x22')]();};}function saveUpdates(_0x49e9fc,_0x5e2470){return function(_0x4c6f86){if(_0x4c6f86){return _0x4c6f86[_0xf0aa('0x23')](_0x49e9fc)['then'](function(_0xc4e56c){return _0xc4e56c;});}return null;};}function removeEntity(_0x245e0c,_0x40cbbb){return function(_0x2983ee){if(_0x2983ee){return _0x2983ee[_0xf0aa('0x24')]()[_0xf0aa('0x25')](function(){_0x245e0c[_0xf0aa('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x169a07,_0x3c21fc){return function(_0x44a7bf){if(!_0x44a7bf){_0x169a07[_0xf0aa('0x18')](0x194);}return _0x44a7bf;};}function handleError(_0x74188d,_0x1dc140){_0x1dc140=_0x1dc140||0x1f4;return function(_0x17b7f6){logger[_0xf0aa('0x26')](_0x17b7f6['stack']);if(_0x17b7f6['name']){delete _0x17b7f6[_0xf0aa('0x27')];}_0x74188d['status'](_0x1dc140)[_0xf0aa('0x28')](_0x17b7f6);};}exports['index']=function(_0x403ac2,_0x381179){var _0x4d2c9b={},_0x56b555={},_0x3b99ea={'count':0x0,'rows':[]};var _0x132950=_[_0xf0aa('0x29')](db[_0xf0aa('0x2a')][_0xf0aa('0x2b')],function(_0x3f51cd){return{'name':_0x3f51cd[_0xf0aa('0x2c')],'type':_0x3f51cd[_0xf0aa('0x2d')]['key']};});_0x56b555[_0xf0aa('0x2e')]=_[_0xf0aa('0x29')](_0x132950,'name');_0x56b555['query']=_['keys'](_0x403ac2[_0xf0aa('0x2f')]);_0x56b555[_0xf0aa('0x30')]=_['intersection'](_0x56b555[_0xf0aa('0x2e')],_0x56b555['query']);_0x4d2c9b['attributes']=_[_0xf0aa('0x31')](_0x56b555[_0xf0aa('0x2e')],qs['fields'](_0x403ac2[_0xf0aa('0x2f')][_0xf0aa('0x32')]));_0x4d2c9b['attributes']=_0x4d2c9b[_0xf0aa('0x33')][_0xf0aa('0x34')]?_0x4d2c9b[_0xf0aa('0x33')]:_0x56b555[_0xf0aa('0x2e')];if(!_0x403ac2[_0xf0aa('0x2f')][_0xf0aa('0x35')](_0xf0aa('0x36'))){_0x4d2c9b['limit']=qs[_0xf0aa('0x1c')](_0x403ac2['query'][_0xf0aa('0x1c')]);_0x4d2c9b[_0xf0aa('0x1a')]=qs[_0xf0aa('0x1a')](_0x403ac2[_0xf0aa('0x2f')]['offset']);}_0x4d2c9b[_0xf0aa('0x37')]=qs['sort'](_0x403ac2[_0xf0aa('0x2f')][_0xf0aa('0x38')]);_0x4d2c9b[_0xf0aa('0x39')]=qs[_0xf0aa('0x30')](_[_0xf0aa('0x3a')](_0x403ac2[_0xf0aa('0x2f')],_0x56b555[_0xf0aa('0x30')]),_0x132950);if(_0x403ac2['query'][_0xf0aa('0x3b')]){_0x4d2c9b[_0xf0aa('0x39')]=_[_0xf0aa('0x3c')](_0x4d2c9b[_0xf0aa('0x39')],{'$or':_['map'](_0x132950,function(_0x5e11ac){if(_0x5e11ac[_0xf0aa('0x2d')]!==_0xf0aa('0x3d')){var _0x493ed1={};_0x493ed1[_0x5e11ac[_0xf0aa('0x27')]]={'$like':'%'+_0x403ac2[_0xf0aa('0x2f')][_0xf0aa('0x3b')]+'%'};return _0x493ed1;}})});}_0x4d2c9b=_[_0xf0aa('0x3c')]({},_0x4d2c9b,_0x403ac2[_0xf0aa('0x3e')]);var _0x410163={'where':_0x4d2c9b[_0xf0aa('0x39')]};return db[_0xf0aa('0x2a')][_0xf0aa('0x1d')](_0x410163)[_0xf0aa('0x25')](function(_0x26d923){_0x3b99ea[_0xf0aa('0x1d')]=_0x26d923;if(_0x403ac2[_0xf0aa('0x2f')][_0xf0aa('0x3f')]){_0x4d2c9b['include']=[{'all':!![]}];}return db[_0xf0aa('0x2a')]['findAll'](_0x4d2c9b);})['then'](function(_0x2d239d){_0x3b99ea[_0xf0aa('0x40')]=_0x2d239d;return _0x3b99ea;})['then'](respondWithFilteredResult(_0x381179,_0x4d2c9b))[_0xf0aa('0x41')](handleError(_0x381179,null));};exports['show']=function(_0x22d3a6,_0x451eca){var _0x48046c={'raw':!![],'where':{'id':_0x22d3a6[_0xf0aa('0x42')]['id']}},_0x8579d1={};_0x8579d1['model']=_[_0xf0aa('0x43')](db[_0xf0aa('0x2a')][_0xf0aa('0x2b')]);_0x8579d1[_0xf0aa('0x2f')]=_[_0xf0aa('0x43')](_0x22d3a6[_0xf0aa('0x2f')]);_0x8579d1['filters']=_[_0xf0aa('0x31')](_0x8579d1['model'],_0x8579d1[_0xf0aa('0x2f')]);_0x48046c[_0xf0aa('0x33')]=_['intersection'](_0x8579d1[_0xf0aa('0x2e')],qs[_0xf0aa('0x32')](_0x22d3a6[_0xf0aa('0x2f')][_0xf0aa('0x32')]));_0x48046c[_0xf0aa('0x33')]=_0x48046c[_0xf0aa('0x33')][_0xf0aa('0x34')]?_0x48046c['attributes']:_0x8579d1[_0xf0aa('0x2e')];if(_0x22d3a6[_0xf0aa('0x2f')][_0xf0aa('0x3f')]){_0x48046c['include']=[{'all':!![]}];}_0x48046c=_[_0xf0aa('0x3c')]({},_0x48046c,_0x22d3a6[_0xf0aa('0x3e')]);return db['FaxQueueReport'][_0xf0aa('0x44')](_0x48046c)[_0xf0aa('0x25')](handleEntityNotFound(_0x451eca,null))['then'](respondWithResult(_0x451eca,null))[_0xf0aa('0x41')](handleError(_0x451eca,null));};exports[_0xf0aa('0x45')]=function(_0x13f29e,_0xf6dc5b){return db[_0xf0aa('0x2a')][_0xf0aa('0x45')](_0x13f29e[_0xf0aa('0x46')],{})['then'](respondWithResult(_0xf6dc5b,0xc9))[_0xf0aa('0x41')](handleError(_0xf6dc5b,null));};exports[_0xf0aa('0x23')]=function(_0x3a0811,_0x193c12){if(_0x3a0811[_0xf0aa('0x46')]['id']){delete _0x3a0811[_0xf0aa('0x46')]['id'];}return db[_0xf0aa('0x2a')][_0xf0aa('0x44')]({'where':{'id':_0x3a0811[_0xf0aa('0x42')]['id']}})[_0xf0aa('0x25')](handleEntityNotFound(_0x193c12,null))['then'](saveUpdates(_0x3a0811[_0xf0aa('0x46')],null))[_0xf0aa('0x25')](respondWithResult(_0x193c12,null))[_0xf0aa('0x41')](handleError(_0x193c12,null));};exports[_0xf0aa('0x24')]=function(_0x3bf4fb,_0x508df5){return db[_0xf0aa('0x2a')][_0xf0aa('0x44')]({'where':{'id':_0x3bf4fb['params']['id']}})[_0xf0aa('0x25')](handleEntityNotFound(_0x508df5,null))[_0xf0aa('0x25')](removeEntity(_0x508df5,null))[_0xf0aa('0x41')](handleError(_0x508df5,null));};exports[_0xf0aa('0x47')]=function(_0x4c82bc,_0x5cd52b){return db[_0xf0aa('0x2a')][_0xf0aa('0x47')]()[_0xf0aa('0x25')](respondWithResult(_0x5cd52b,null))[_0xf0aa('0x41')](handleError(_0x5cd52b,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index fffa5d1..b4d1d10 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 _0x1cb9=['api','moment','bluebird','path','rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4c39d9,_0x5062a9){_0x4c39d9=_0x4c39d9-0x0;var _0x50bb1=_0x1cb9[_0x4c39d9];return _0x50bb1;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x91cb('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x203362,_0x397599){var _0x14d3b4=function(_0x4fc4b4){while(--_0x4fc4b4){_0x203362['push'](_0x203362['shift']());}};_0x14d3b4(++_0x397599);}(_0xf494,0x1c6));var _0x4f49=function(_0x2d26cd,_0x4a44e1){_0x2d26cd=_0x2d26cd-0x0;var _0x2a03f3=_0xf494[_0x2d26cd];return _0x2a03f3;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 75f7c08..15ba535 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 _0x6bd2=['request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','UpdateFaxQueueReport','update','where','attributes','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','request','info','FaxQueueReport,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6bd2,0xed));var _0x26bd=function(_0x60047e,_0x5b82ff){_0x60047e=_0x60047e-0x0;var _0x4057b1=_0x6bd2[_0x60047e];return _0x4057b1;};'use strict';var _=require(_0x26bd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x26bd('0x1'));var rs=require(_0x26bd('0x2'));var fs=require('fs');var Redis=require(_0x26bd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x26bd('0x4'));var logger=require(_0x26bd('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x26bd('0x6'));var client=jayson[_0x26bd('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1be82e,_0x7f92f5,_0x2beae2){return new BPromise(function(_0x117a8f,_0x2208c3){return client[_0x26bd('0x8')](_0x1be82e,_0x2beae2)['then'](function(_0x1d431c){logger[_0x26bd('0x9')](_0x26bd('0xa'),_0x7f92f5,_0x26bd('0xb'));logger[_0x26bd('0xc')](_0x26bd('0xd'),_0x7f92f5,_0x26bd('0xb'),JSON[_0x26bd('0xe')](_0x1d431c));if(_0x1d431c[_0x26bd('0xf')]){if(_0x1d431c['error'][_0x26bd('0x10')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x7f92f5,_0x1d431c[_0x26bd('0xf')][_0x26bd('0x11')]);return _0x2208c3(_0x1d431c[_0x26bd('0xf')]['message']);}logger[_0x26bd('0xf')](_0x26bd('0xa'),_0x7f92f5,_0x1d431c['error'][_0x26bd('0x11')]);return _0x117a8f(_0x1d431c['error'][_0x26bd('0x11')]);}else{logger[_0x26bd('0x9')]('FaxQueueReport,\x20%s,\x20%s',_0x7f92f5,'request\x20sent');_0x117a8f(_0x1d431c[_0x26bd('0x12')][_0x26bd('0x11')]);}})[_0x26bd('0x13')](function(_0x5bb9c1){logger[_0x26bd('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x7f92f5,_0x5bb9c1);_0x2208c3(_0x5bb9c1);});});}exports[_0x26bd('0x14')]=function(_0x358a31){var _0x26df18=this;return new Promise(function(_0x243b68,_0x43aac3){return db[_0x26bd('0x15')][_0x26bd('0x16')](_0x358a31[_0x26bd('0x17')],{'raw':_0x358a31[_0x26bd('0x18')]?_0x358a31[_0x26bd('0x18')][_0x26bd('0x19')]===undefined?!![]:![]:!![]})[_0x26bd('0x1a')](function(_0x50d464){logger['info'](_0x26bd('0x14'),_0x358a31);logger['debug']('CreateFaxQueueReport',_0x358a31,JSON[_0x26bd('0xe')](_0x50d464));_0x243b68(_0x50d464);})[_0x26bd('0x13')](function(_0x370037){logger['error'](_0x26bd('0x14'),_0x370037[_0x26bd('0x11')],_0x358a31);_0x43aac3(_0x26df18['error'](0x1f4,_0x370037[_0x26bd('0x11')]));});});};exports[_0x26bd('0x1b')]=function(_0x446510){var _0x4b06e1=this;return new Promise(function(_0x1ffe63,_0x3e45fd){return db[_0x26bd('0x15')][_0x26bd('0x1c')](_0x446510[_0x26bd('0x17')],{'raw':_0x446510[_0x26bd('0x18')]?_0x446510[_0x26bd('0x18')][_0x26bd('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x446510[_0x26bd('0x18')]?_0x446510['options'][_0x26bd('0x1d')]||null:null,'attributes':_0x446510[_0x26bd('0x18')]?_0x446510['options'][_0x26bd('0x1e')]||null:null,'limit':_0x446510[_0x26bd('0x18')]?_0x446510['options']['limit']||null:null})[_0x26bd('0x1a')](function(_0x5ba65d){logger['info'](_0x26bd('0x1b'),_0x446510);logger[_0x26bd('0xc')]('UpdateFaxQueueReport',_0x446510,JSON[_0x26bd('0xe')](_0x5ba65d));_0x1ffe63(_0x5ba65d);})[_0x26bd('0x13')](function(_0x1a2464){logger['error']('UpdateFaxQueueReport',_0x1a2464[_0x26bd('0x11')],_0x446510);_0x3e45fd(_0x4b06e1[_0x26bd('0xf')](0x1f4,_0x1a2464[_0x26bd('0x11')]));});});}; \ No newline at end of file +var _0x4656=['info','stringify','update','body','where','attributes','then','UpdateFaxQueueReport','util','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw'];(function(_0x3d44c5,_0x22daa4){var _0x1778cf=function(_0x504bf7){while(--_0x504bf7){_0x3d44c5['push'](_0x3d44c5['shift']());}};_0x1778cf(++_0x22daa4);}(_0x4656,0x1ba));var _0x6465=function(_0x2a7b8e,_0x50ffce){_0x2a7b8e=_0x2a7b8e-0x0;var _0x29b5c8=_0x4656[_0x2a7b8e];return _0x29b5c8;};'use strict';var _=require('lodash');var util=require(_0x6465('0x0'));var moment=require('moment');var BPromise=require(_0x6465('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6465('0x2'));var logger=require('../../config/logger')(_0x6465('0x3'));var config=require(_0x6465('0x4'));var jayson=require(_0x6465('0x5'));var client=jayson[_0x6465('0x6')][_0x6465('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x472863,_0x4b723a,_0x454c40){return new BPromise(function(_0x75133b,_0x5e6a9c){return client[_0x6465('0x8')](_0x472863,_0x454c40)['then'](function(_0x3ca769){logger['info'](_0x6465('0x9'),_0x4b723a,_0x6465('0xa'));logger[_0x6465('0xb')](_0x6465('0xc'),_0x4b723a,_0x6465('0xa'),JSON['stringify'](_0x3ca769));if(_0x3ca769['error']){if(_0x3ca769[_0x6465('0xd')][_0x6465('0xe')]===0x1f4){logger[_0x6465('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x4b723a,_0x3ca769['error'][_0x6465('0xf')]);return _0x5e6a9c(_0x3ca769['error']['message']);}logger[_0x6465('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x4b723a,_0x3ca769[_0x6465('0xd')][_0x6465('0xf')]);return _0x75133b(_0x3ca769[_0x6465('0xd')][_0x6465('0xf')]);}else{logger['info'](_0x6465('0x9'),_0x4b723a,_0x6465('0xa'));_0x75133b(_0x3ca769[_0x6465('0x10')][_0x6465('0xf')]);}})[_0x6465('0x11')](function(_0x25f58f){logger[_0x6465('0xd')](_0x6465('0x9'),_0x4b723a,_0x25f58f);_0x5e6a9c(_0x25f58f);});});}exports[_0x6465('0x12')]=function(_0x3484f9){var _0x118ac7=this;return new Promise(function(_0x1fc43d,_0x369c67){return db[_0x6465('0x13')][_0x6465('0x14')](_0x3484f9['body'],{'raw':_0x3484f9[_0x6465('0x15')]?_0x3484f9[_0x6465('0x15')][_0x6465('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x519117){logger[_0x6465('0x17')](_0x6465('0x12'),_0x3484f9);logger[_0x6465('0xb')](_0x6465('0x12'),_0x3484f9,JSON[_0x6465('0x18')](_0x519117));_0x1fc43d(_0x519117);})['catch'](function(_0x4ae05d){logger[_0x6465('0xd')](_0x6465('0x12'),_0x4ae05d['message'],_0x3484f9);_0x369c67(_0x118ac7[_0x6465('0xd')](0x1f4,_0x4ae05d[_0x6465('0xf')]));});});};exports['UpdateFaxQueueReport']=function(_0x4bcd78){var _0x1cb357=this;return new Promise(function(_0x770846,_0x545671){return db[_0x6465('0x13')][_0x6465('0x19')](_0x4bcd78[_0x6465('0x1a')],{'raw':_0x4bcd78[_0x6465('0x15')]?_0x4bcd78[_0x6465('0x15')][_0x6465('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bcd78['options']?_0x4bcd78['options'][_0x6465('0x1b')]||null:null,'attributes':_0x4bcd78['options']?_0x4bcd78[_0x6465('0x15')][_0x6465('0x1c')]||null:null,'limit':_0x4bcd78[_0x6465('0x15')]?_0x4bcd78[_0x6465('0x15')]['limit']||null:null})[_0x6465('0x1d')](function(_0x56847e){logger['info'](_0x6465('0x1e'),_0x4bcd78);logger[_0x6465('0xb')](_0x6465('0x1e'),_0x4bcd78,JSON[_0x6465('0x18')](_0x56847e));_0x770846(_0x56847e);})[_0x6465('0x11')](function(_0x1cece0){logger[_0x6465('0xd')](_0x6465('0x1e'),_0x1cece0[_0x6465('0xf')],_0x4bcd78);_0x545671(_0x1cb357[_0x6465('0xd')](0x1f4,_0x1cece0[_0x6465('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 883c613..c00037b 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 _0xfb7f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','index','get','describe','/:id','post','put','update','destroy','exports','util','path','express'];(function(_0x395bfe,_0x4db521){var _0x35c81c=function(_0x484a1b){while(--_0x484a1b){_0x395bfe['push'](_0x395bfe['shift']());}};_0x35c81c(++_0x4db521);}(_0xfb7f,0x107));var _0xffb7=function(_0x29bdc9,_0x3e7217){_0x29bdc9=_0x29bdc9-0x0;var _0x5cf78f=_0xfb7f[_0x29bdc9];return _0x5cf78f;};'use strict';var multer=require('multer');var util=require(_0xffb7('0x0'));var path=require(_0xffb7('0x1'));var timeout=require('connect-timeout');var express=require(_0xffb7('0x2'));var router=express[_0xffb7('0x3')]();var fs_extra=require(_0xffb7('0x4'));var auth=require(_0xffb7('0x5'));var interaction=require(_0xffb7('0x6'));var config=require(_0xffb7('0x7'));var controller=require(_0xffb7('0x8'));router['get']('/',auth[_0xffb7('0x9')](),controller[_0xffb7('0xa')]);router[_0xffb7('0xb')]('/describe',auth['isAuthenticated'](),controller[_0xffb7('0xc')]);router[_0xffb7('0xb')](_0xffb7('0xd'),auth[_0xffb7('0x9')](),controller['show']);router[_0xffb7('0xe')]('/',auth[_0xffb7('0x9')](),controller['create']);router[_0xffb7('0xf')](_0xffb7('0xd'),auth[_0xffb7('0x9')](),controller[_0xffb7('0x10')]);router['delete'](_0xffb7('0xd'),auth[_0xffb7('0x9')](),controller[_0xffb7('0x11')]);module[_0xffb7('0x12')]=router; \ No newline at end of file +var _0x5234=['Router','../../config/environment','get','index','describe','/:id','isAuthenticated','post','create','delete','destroy','multer','util','path','connect-timeout'];(function(_0x340045,_0x3be566){var _0x4814cd=function(_0x1bf02d){while(--_0x1bf02d){_0x340045['push'](_0x340045['shift']());}};_0x4814cd(++_0x3be566);}(_0x5234,0xce));var _0x4523=function(_0x4d3083,_0x4ab36e){_0x4d3083=_0x4d3083-0x0;var _0x204dc4=_0x5234[_0x4d3083];return _0x204dc4;};'use strict';var multer=require(_0x4523('0x0'));var util=require(_0x4523('0x1'));var path=require(_0x4523('0x2'));var timeout=require(_0x4523('0x3'));var express=require('express');var router=express[_0x4523('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4523('0x5'));var controller=require('./faxQueueReport.controller');router[_0x4523('0x6')]('/',auth['isAuthenticated'](),controller[_0x4523('0x7')]);router[_0x4523('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x4523('0x8')]);router[_0x4523('0x6')](_0x4523('0x9'),auth[_0x4523('0xa')](),controller['show']);router[_0x4523('0xb')]('/',auth['isAuthenticated'](),controller[_0x4523('0xc')]);router['put'](_0x4523('0x9'),auth[_0x4523('0xa')](),controller['update']);router[_0x4523('0xd')](_0x4523('0x9'),auth['isAuthenticated'](),controller[_0x4523('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index e628dc0..7613a1c 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0xcba9b4,_0x4e4ecd){var _0x15c441=function(_0x1354a7){while(--_0x1354a7){_0xcba9b4['push'](_0xcba9b4['shift']());}};_0x15c441(++_0x4e4ecd);}(_0x00bb,0x1d8));var _0xb00b=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x00bb[_0x29b609];return _0x54c952;};'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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x3e49fe,_0x552dba){var _0x150873=function(_0x88c188){while(--_0x88c188){_0x3e49fe['push'](_0x3e49fe['shift']());}};_0x150873(++_0x552dba);}(_0x9c44,0x178));var _0x49c4=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x9c44[_0x2e4aa2];return _0x5e6092;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index fa300d5..b2aa749 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 _0x8349=['body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','apply','save','update','then','destroy','name','send','index','map','FaxTransferReport','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','sort','filters','pick','merge','where','type','filter','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','create'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x8349,0x93));var _0x9834=function(_0x19ebfd,_0x5ae121){_0x19ebfd=_0x19ebfd-0x0;var _0x11017a=_0x8349[_0x19ebfd];return _0x11017a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9834('0x0'));var zipdir=require(_0x9834('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9834('0x2'));var moment=require(_0x9834('0x3'));var BPromise=require(_0x9834('0x4'));var Mustache=require(_0x9834('0x5'));var util=require(_0x9834('0x6'));var path=require(_0x9834('0x7'));var sox=require(_0x9834('0x8'));var csv=require('to-csv');var ejs=require(_0x9834('0x9'));var fs=require('fs');var fs_extra=require(_0x9834('0xa'));var _=require(_0x9834('0xb'));var squel=require(_0x9834('0xc'));var crypto=require(_0x9834('0xd'));var jsforce=require(_0x9834('0xe'));var deskjs=require(_0x9834('0xf'));var toCsv=require(_0x9834('0x10'));var querystring=require(_0x9834('0x11'));var Papa=require(_0x9834('0x12'));var Redis=require(_0x9834('0x13'));var authService=require(_0x9834('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x9834('0x15'));var hardwareService=require(_0x9834('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x9834('0x17'));var config=require(_0x9834('0x18'));var licenseUtil=require(_0x9834('0x19'));var db=require(_0x9834('0x1a'))['db'];function respondWithStatusCode(_0x4c8018,_0x48ffd9){_0x48ffd9=_0x48ffd9||0xcc;return function(_0x3447fe){if(_0x3447fe){return _0x4c8018[_0x9834('0x1b')](_0x48ffd9);}return _0x4c8018[_0x9834('0x1c')](_0x48ffd9)[_0x9834('0x1d')]();};}function respondWithResult(_0x3d5dad,_0x91d14b){_0x91d14b=_0x91d14b||0xc8;return function(_0x51db2d){if(_0x51db2d){return _0x3d5dad['status'](_0x91d14b)[_0x9834('0x1e')](_0x51db2d);}};}function respondWithFilteredResult(_0x3448a,_0xd93230){return function(_0x3e1a54){if(_0x3e1a54){var _0x2c8d9f=typeof _0xd93230[_0x9834('0x1f')]==='undefined'&&typeof _0xd93230['limit']===_0x9834('0x20');var _0x182a57=_0x3e1a54[_0x9834('0x21')];var _0x45253d=_0x2c8d9f?0x0:_0xd93230[_0x9834('0x1f')];var _0x50d488=_0x2c8d9f?_0x3e1a54['count']:_0xd93230[_0x9834('0x1f')]+_0xd93230['limit'];var _0x5a29fd;if(_0x50d488>=_0x182a57){_0x50d488=_0x182a57;_0x5a29fd=0xc8;}else{_0x5a29fd=0xce;}_0x3448a['status'](_0x5a29fd);return _0x3448a['set']('Content-Range',_0x45253d+'-'+_0x50d488+'/'+_0x182a57)[_0x9834('0x1e')](_0x3e1a54);}return null;};}function patchUpdates(_0x499c28){return function(_0x21e523){try{jsonpatch[_0x9834('0x22')](_0x21e523,_0x499c28,!![]);}catch(_0x588e6b){return BPromise['reject'](_0x588e6b);}return _0x21e523[_0x9834('0x23')]();};}function saveUpdates(_0x6839a9,_0xb85be4){return function(_0x3444af){if(_0x3444af){return _0x3444af[_0x9834('0x24')](_0x6839a9)[_0x9834('0x25')](function(_0x1c5d23){return _0x1c5d23;});}return null;};}function removeEntity(_0xd9794,_0xe85eed){return function(_0x53da31){if(_0x53da31){return _0x53da31[_0x9834('0x26')]()[_0x9834('0x25')](function(){_0xd9794[_0x9834('0x1c')](0xcc)[_0x9834('0x1d')]();});}};}function handleEntityNotFound(_0x348eea,_0x1d3433){return function(_0x10bcc6){if(!_0x10bcc6){_0x348eea[_0x9834('0x1b')](0x194);}return _0x10bcc6;};}function handleError(_0x397566,_0x31b2e0){_0x31b2e0=_0x31b2e0||0x1f4;return function(_0x1a3e96){logger['error'](_0x1a3e96['stack']);if(_0x1a3e96[_0x9834('0x27')]){delete _0x1a3e96[_0x9834('0x27')];}_0x397566['status'](_0x31b2e0)[_0x9834('0x28')](_0x1a3e96);};}exports[_0x9834('0x29')]=function(_0x48c91a,_0x270d2c){var _0x306684={},_0x3f1958={},_0x1e37f5={'count':0x0,'rows':[]};var _0x2c4174=_[_0x9834('0x2a')](db[_0x9834('0x2b')]['rawAttributes'],function(_0x19aa1c){return{'name':_0x19aa1c[_0x9834('0x2c')],'type':_0x19aa1c['type'][_0x9834('0x2d')]};});_0x3f1958[_0x9834('0x2e')]=_[_0x9834('0x2a')](_0x2c4174,'name');_0x3f1958[_0x9834('0x2f')]=_[_0x9834('0x30')](_0x48c91a[_0x9834('0x2f')]);_0x3f1958['filters']=_[_0x9834('0x31')](_0x3f1958[_0x9834('0x2e')],_0x3f1958[_0x9834('0x2f')]);_0x306684[_0x9834('0x32')]=_[_0x9834('0x31')](_0x3f1958[_0x9834('0x2e')],qs['fields'](_0x48c91a[_0x9834('0x2f')][_0x9834('0x33')]));_0x306684['attributes']=_0x306684[_0x9834('0x32')][_0x9834('0x34')]?_0x306684[_0x9834('0x32')]:_0x3f1958[_0x9834('0x2e')];if(!_0x48c91a[_0x9834('0x2f')][_0x9834('0x35')]('nolimit')){_0x306684[_0x9834('0x36')]=qs[_0x9834('0x36')](_0x48c91a[_0x9834('0x2f')][_0x9834('0x36')]);_0x306684[_0x9834('0x1f')]=qs[_0x9834('0x1f')](_0x48c91a[_0x9834('0x2f')][_0x9834('0x1f')]);}_0x306684['order']=qs[_0x9834('0x37')](_0x48c91a[_0x9834('0x2f')][_0x9834('0x37')]);_0x306684['where']=qs[_0x9834('0x38')](_[_0x9834('0x39')](_0x48c91a[_0x9834('0x2f')],_0x3f1958[_0x9834('0x38')]),_0x2c4174);if(_0x48c91a[_0x9834('0x2f')]['filter']){_0x306684['where']=_[_0x9834('0x3a')](_0x306684[_0x9834('0x3b')],{'$or':_[_0x9834('0x2a')](_0x2c4174,function(_0x2c1bd5){if(_0x2c1bd5[_0x9834('0x3c')]!=='VIRTUAL'){var _0x17e237={};_0x17e237[_0x2c1bd5[_0x9834('0x27')]]={'$like':'%'+_0x48c91a['query'][_0x9834('0x3d')]+'%'};return _0x17e237;}})});}_0x306684=_[_0x9834('0x3a')]({},_0x306684,_0x48c91a['options']);var _0x3b5fd9={'where':_0x306684[_0x9834('0x3b')]};return db[_0x9834('0x2b')][_0x9834('0x21')](_0x3b5fd9)[_0x9834('0x25')](function(_0x252915){_0x1e37f5[_0x9834('0x21')]=_0x252915;if(_0x48c91a[_0x9834('0x2f')][_0x9834('0x3e')]){_0x306684[_0x9834('0x3f')]=[{'all':!![]}];}return db[_0x9834('0x2b')][_0x9834('0x40')](_0x306684);})[_0x9834('0x25')](function(_0xa0f3d9){_0x1e37f5['rows']=_0xa0f3d9;return _0x1e37f5;})[_0x9834('0x25')](respondWithFilteredResult(_0x270d2c,_0x306684))[_0x9834('0x41')](handleError(_0x270d2c,null));};exports[_0x9834('0x42')]=function(_0x1cf46c,_0x1a8fe3){var _0xd47f97={'raw':!![],'where':{'id':_0x1cf46c[_0x9834('0x43')]['id']}},_0x2dae16={};_0x2dae16[_0x9834('0x2e')]=_['keys'](db[_0x9834('0x2b')][_0x9834('0x44')]);_0x2dae16[_0x9834('0x2f')]=_[_0x9834('0x30')](_0x1cf46c['query']);_0x2dae16['filters']=_[_0x9834('0x31')](_0x2dae16['model'],_0x2dae16['query']);_0xd47f97[_0x9834('0x32')]=_[_0x9834('0x31')](_0x2dae16['model'],qs[_0x9834('0x33')](_0x1cf46c[_0x9834('0x2f')][_0x9834('0x33')]));_0xd47f97[_0x9834('0x32')]=_0xd47f97[_0x9834('0x32')][_0x9834('0x34')]?_0xd47f97[_0x9834('0x32')]:_0x2dae16['model'];if(_0x1cf46c[_0x9834('0x2f')][_0x9834('0x3e')]){_0xd47f97[_0x9834('0x3f')]=[{'all':!![]}];}_0xd47f97=_[_0x9834('0x3a')]({},_0xd47f97,_0x1cf46c[_0x9834('0x45')]);return db['FaxTransferReport'][_0x9834('0x46')](_0xd47f97)[_0x9834('0x25')](handleEntityNotFound(_0x1a8fe3,null))['then'](respondWithResult(_0x1a8fe3,null))[_0x9834('0x41')](handleError(_0x1a8fe3,null));};exports[_0x9834('0x47')]=function(_0x15291f,_0x4c9d03){return db[_0x9834('0x2b')][_0x9834('0x47')](_0x15291f[_0x9834('0x48')],{})[_0x9834('0x25')](respondWithResult(_0x4c9d03,0xc9))[_0x9834('0x41')](handleError(_0x4c9d03,null));};exports[_0x9834('0x24')]=function(_0x2c10c0,_0x483c85){if(_0x2c10c0['body']['id']){delete _0x2c10c0[_0x9834('0x48')]['id'];}return db[_0x9834('0x2b')][_0x9834('0x46')]({'where':{'id':_0x2c10c0[_0x9834('0x43')]['id']}})[_0x9834('0x25')](handleEntityNotFound(_0x483c85,null))['then'](saveUpdates(_0x2c10c0['body'],null))[_0x9834('0x25')](respondWithResult(_0x483c85,null))['catch'](handleError(_0x483c85,null));};exports[_0x9834('0x26')]=function(_0x4b3fca,_0x1c0ea3){return db[_0x9834('0x2b')][_0x9834('0x46')]({'where':{'id':_0x4b3fca[_0x9834('0x43')]['id']}})[_0x9834('0x25')](handleEntityNotFound(_0x1c0ea3,null))[_0x9834('0x25')](removeEntity(_0x1c0ea3,null))['catch'](handleError(_0x1c0ea3,null));};exports['describe']=function(_0x4438da,_0x324f27){return db['FaxTransferReport']['describe']()[_0x9834('0x25')](respondWithResult(_0x324f27,null))[_0x9834('0x41')](handleError(_0x324f27,null));}; \ No newline at end of file +var _0x2cf6=['where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','show','params','keys','include','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','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','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort'];(function(_0x9b1a81,_0x4e9dfc){var _0x76b7e5=function(_0xc4ebac){while(--_0xc4ebac){_0x9b1a81['push'](_0x9b1a81['shift']());}};_0x76b7e5(++_0x4e9dfc);}(_0x2cf6,0x1a2));var _0x62cf=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x2cf6[_0x3a6efd];return _0x487b9a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x62cf('0x0'));var zipdir=require(_0x62cf('0x1'));var jsonpatch=require(_0x62cf('0x2'));var rp=require(_0x62cf('0x3'));var moment=require(_0x62cf('0x4'));var BPromise=require(_0x62cf('0x5'));var Mustache=require(_0x62cf('0x6'));var util=require(_0x62cf('0x7'));var path=require(_0x62cf('0x8'));var sox=require(_0x62cf('0x9'));var csv=require(_0x62cf('0xa'));var ejs=require(_0x62cf('0xb'));var fs=require('fs');var fs_extra=require(_0x62cf('0xc'));var _=require(_0x62cf('0xd'));var squel=require(_0x62cf('0xe'));var crypto=require('crypto');var jsforce=require(_0x62cf('0xf'));var deskjs=require(_0x62cf('0x10'));var toCsv=require(_0x62cf('0xa'));var querystring=require(_0x62cf('0x11'));var Papa=require(_0x62cf('0x12'));var Redis=require(_0x62cf('0x13'));var authService=require(_0x62cf('0x14'));var qs=require(_0x62cf('0x15'));var as=require(_0x62cf('0x16'));var hardwareService=require(_0x62cf('0x17'));var logger=require(_0x62cf('0x18'))(_0x62cf('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x62cf('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36b03a,_0x403037){_0x403037=_0x403037||0xcc;return function(_0x5a60f8){if(_0x5a60f8){return _0x36b03a[_0x62cf('0x1b')](_0x403037);}return _0x36b03a[_0x62cf('0x1c')](_0x403037)[_0x62cf('0x1d')]();};}function respondWithResult(_0x1e17c2,_0x3ccaee){_0x3ccaee=_0x3ccaee||0xc8;return function(_0x23b371){if(_0x23b371){return _0x1e17c2[_0x62cf('0x1c')](_0x3ccaee)[_0x62cf('0x1e')](_0x23b371);}};}function respondWithFilteredResult(_0x1e3215,_0x53473f){return function(_0xe9aaae){if(_0xe9aaae){var _0x317ad0=typeof _0x53473f[_0x62cf('0x1f')]===_0x62cf('0x20')&&typeof _0x53473f[_0x62cf('0x21')]===_0x62cf('0x20');var _0x32cf10=_0xe9aaae[_0x62cf('0x22')];var _0x407925=_0x317ad0?0x0:_0x53473f[_0x62cf('0x1f')];var _0x4819d6=_0x317ad0?_0xe9aaae[_0x62cf('0x22')]:_0x53473f[_0x62cf('0x1f')]+_0x53473f[_0x62cf('0x21')];var _0x24b7c2;if(_0x4819d6>=_0x32cf10){_0x4819d6=_0x32cf10;_0x24b7c2=0xc8;}else{_0x24b7c2=0xce;}_0x1e3215['status'](_0x24b7c2);return _0x1e3215[_0x62cf('0x23')](_0x62cf('0x24'),_0x407925+'-'+_0x4819d6+'/'+_0x32cf10)[_0x62cf('0x1e')](_0xe9aaae);}return null;};}function patchUpdates(_0x56a478){return function(_0x22f112){try{jsonpatch[_0x62cf('0x25')](_0x22f112,_0x56a478,!![]);}catch(_0x170960){return BPromise[_0x62cf('0x26')](_0x170960);}return _0x22f112[_0x62cf('0x27')]();};}function saveUpdates(_0x5bb168,_0x2217e9){return function(_0x323e6b){if(_0x323e6b){return _0x323e6b['update'](_0x5bb168)['then'](function(_0x8492d0){return _0x8492d0;});}return null;};}function removeEntity(_0x3693c5,_0x2622e5){return function(_0x142fdb){if(_0x142fdb){return _0x142fdb[_0x62cf('0x28')]()[_0x62cf('0x29')](function(){_0x3693c5[_0x62cf('0x1c')](0xcc)[_0x62cf('0x1d')]();});}};}function handleEntityNotFound(_0x5ec458,_0x8865b7){return function(_0x360d1c){if(!_0x360d1c){_0x5ec458[_0x62cf('0x1b')](0x194);}return _0x360d1c;};}function handleError(_0x274015,_0xc1054d){_0xc1054d=_0xc1054d||0x1f4;return function(_0x3e4c8c){logger[_0x62cf('0x2a')](_0x3e4c8c['stack']);if(_0x3e4c8c['name']){delete _0x3e4c8c[_0x62cf('0x2b')];}_0x274015['status'](_0xc1054d)[_0x62cf('0x2c')](_0x3e4c8c);};}exports[_0x62cf('0x2d')]=function(_0x3a7394,_0x3a80cf){var _0x28f98e={},_0x53fa6e={},_0x3c61e5={'count':0x0,'rows':[]};var _0x5a970c=_[_0x62cf('0x2e')](db[_0x62cf('0x2f')][_0x62cf('0x30')],function(_0x537355){return{'name':_0x537355[_0x62cf('0x31')],'type':_0x537355[_0x62cf('0x32')][_0x62cf('0x33')]};});_0x53fa6e[_0x62cf('0x34')]=_[_0x62cf('0x2e')](_0x5a970c,_0x62cf('0x2b'));_0x53fa6e[_0x62cf('0x35')]=_['keys'](_0x3a7394[_0x62cf('0x35')]);_0x53fa6e[_0x62cf('0x36')]=_[_0x62cf('0x37')](_0x53fa6e[_0x62cf('0x34')],_0x53fa6e['query']);_0x28f98e['attributes']=_['intersection'](_0x53fa6e[_0x62cf('0x34')],qs[_0x62cf('0x38')](_0x3a7394[_0x62cf('0x35')][_0x62cf('0x38')]));_0x28f98e[_0x62cf('0x39')]=_0x28f98e['attributes'][_0x62cf('0x3a')]?_0x28f98e['attributes']:_0x53fa6e[_0x62cf('0x34')];if(!_0x3a7394['query'][_0x62cf('0x3b')](_0x62cf('0x3c'))){_0x28f98e['limit']=qs[_0x62cf('0x21')](_0x3a7394['query'][_0x62cf('0x21')]);_0x28f98e['offset']=qs['offset'](_0x3a7394['query'][_0x62cf('0x1f')]);}_0x28f98e['order']=qs[_0x62cf('0x3d')](_0x3a7394['query'][_0x62cf('0x3d')]);_0x28f98e[_0x62cf('0x3e')]=qs[_0x62cf('0x36')](_[_0x62cf('0x3f')](_0x3a7394[_0x62cf('0x35')],_0x53fa6e['filters']),_0x5a970c);if(_0x3a7394[_0x62cf('0x35')][_0x62cf('0x40')]){_0x28f98e[_0x62cf('0x3e')]=_['merge'](_0x28f98e['where'],{'$or':_[_0x62cf('0x2e')](_0x5a970c,function(_0x30c763){if(_0x30c763[_0x62cf('0x32')]!==_0x62cf('0x41')){var _0x1b7d3e={};_0x1b7d3e[_0x30c763['name']]={'$like':'%'+_0x3a7394['query'][_0x62cf('0x40')]+'%'};return _0x1b7d3e;}})});}_0x28f98e=_[_0x62cf('0x42')]({},_0x28f98e,_0x3a7394[_0x62cf('0x43')]);var _0x5e315b={'where':_0x28f98e[_0x62cf('0x3e')]};return db[_0x62cf('0x2f')][_0x62cf('0x22')](_0x5e315b)['then'](function(_0x2316e8){_0x3c61e5[_0x62cf('0x22')]=_0x2316e8;if(_0x3a7394[_0x62cf('0x35')]['includeAll']){_0x28f98e['include']=[{'all':!![]}];}return db[_0x62cf('0x2f')][_0x62cf('0x44')](_0x28f98e);})[_0x62cf('0x29')](function(_0x5ce12e){_0x3c61e5[_0x62cf('0x45')]=_0x5ce12e;return _0x3c61e5;})[_0x62cf('0x29')](respondWithFilteredResult(_0x3a80cf,_0x28f98e))[_0x62cf('0x46')](handleError(_0x3a80cf,null));};exports[_0x62cf('0x47')]=function(_0x10575d,_0x406b1f){var _0x14f9de={'raw':!![],'where':{'id':_0x10575d[_0x62cf('0x48')]['id']}},_0x1ed8d3={};_0x1ed8d3[_0x62cf('0x34')]=_[_0x62cf('0x49')](db[_0x62cf('0x2f')][_0x62cf('0x30')]);_0x1ed8d3[_0x62cf('0x35')]=_[_0x62cf('0x49')](_0x10575d[_0x62cf('0x35')]);_0x1ed8d3[_0x62cf('0x36')]=_['intersection'](_0x1ed8d3[_0x62cf('0x34')],_0x1ed8d3[_0x62cf('0x35')]);_0x14f9de['attributes']=_[_0x62cf('0x37')](_0x1ed8d3[_0x62cf('0x34')],qs[_0x62cf('0x38')](_0x10575d['query'][_0x62cf('0x38')]));_0x14f9de['attributes']=_0x14f9de[_0x62cf('0x39')]['length']?_0x14f9de[_0x62cf('0x39')]:_0x1ed8d3[_0x62cf('0x34')];if(_0x10575d[_0x62cf('0x35')]['includeAll']){_0x14f9de[_0x62cf('0x4a')]=[{'all':!![]}];}_0x14f9de=_['merge']({},_0x14f9de,_0x10575d[_0x62cf('0x43')]);return db[_0x62cf('0x2f')][_0x62cf('0x4b')](_0x14f9de)[_0x62cf('0x29')](handleEntityNotFound(_0x406b1f,null))[_0x62cf('0x29')](respondWithResult(_0x406b1f,null))[_0x62cf('0x46')](handleError(_0x406b1f,null));};exports[_0x62cf('0x4c')]=function(_0x42e678,_0x262d23){return db[_0x62cf('0x2f')][_0x62cf('0x4c')](_0x42e678[_0x62cf('0x4d')],{})[_0x62cf('0x29')](respondWithResult(_0x262d23,0xc9))[_0x62cf('0x46')](handleError(_0x262d23,null));};exports[_0x62cf('0x4e')]=function(_0x134599,_0x5d84c1){if(_0x134599[_0x62cf('0x4d')]['id']){delete _0x134599[_0x62cf('0x4d')]['id'];}return db[_0x62cf('0x2f')][_0x62cf('0x4b')]({'where':{'id':_0x134599[_0x62cf('0x48')]['id']}})[_0x62cf('0x29')](handleEntityNotFound(_0x5d84c1,null))[_0x62cf('0x29')](saveUpdates(_0x134599[_0x62cf('0x4d')],null))['then'](respondWithResult(_0x5d84c1,null))[_0x62cf('0x46')](handleError(_0x5d84c1,null));};exports[_0x62cf('0x28')]=function(_0x4bbe05,_0x34231b){return db[_0x62cf('0x2f')]['find']({'where':{'id':_0x4bbe05[_0x62cf('0x48')]['id']}})[_0x62cf('0x29')](handleEntityNotFound(_0x34231b,null))[_0x62cf('0x29')](removeEntity(_0x34231b,null))[_0x62cf('0x46')](handleError(_0x34231b,null));};exports[_0x62cf('0x4f')]=function(_0x397cd2,_0x3ade8d){return db[_0x62cf('0x2f')][_0x62cf('0x4f')]()['then'](respondWithResult(_0x3ade8d,null))[_0x62cf('0x46')](handleError(_0x3ade8d,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index ad21a7a..2195eab 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 _0xa0d9=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','FaxTransferReport','report_fax_transfer','uniqueid'];(function(_0x5cf543,_0x15a6e0){var _0x4966ab=function(_0x545f19){while(--_0x545f19){_0x5cf543['push'](_0x5cf543['shift']());}};_0x4966ab(++_0x15a6e0);}(_0xa0d9,0x1e0));var _0x9a0d=function(_0x4a93bb,_0x495404){_0x4a93bb=_0x4a93bb-0x0;var _0x208468=_0xa0d9[_0x4a93bb];return _0x208468;};'use strict';var _=require(_0x9a0d('0x0'));var util=require(_0x9a0d('0x1'));var logger=require('../../config/logger')(_0x9a0d('0x2'));var moment=require(_0x9a0d('0x3'));var BPromise=require(_0x9a0d('0x4'));var rp=require(_0x9a0d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9a0d('0x6'));var config=require(_0x9a0d('0x7'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x33f151,_0x16c8e9){return _0x33f151[_0x9a0d('0x8')](_0x9a0d('0x9'),attributes,{'tableName':_0x9a0d('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9a0d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3e82=['request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x36c7ba,_0x58b215){var _0x1a9b22=function(_0x5d8ecc){while(--_0x5d8ecc){_0x36c7ba['push'](_0x36c7ba['shift']());}};_0x1a9b22(++_0x58b215);}(_0x3e82,0x18a));var _0x23e8=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x3e82[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x23e8('0x0'));var util=require(_0x23e8('0x1'));var logger=require(_0x23e8('0x2'))(_0x23e8('0x3'));var moment=require(_0x23e8('0x4'));var BPromise=require(_0x23e8('0x5'));var rp=require(_0x23e8('0x6'));var fs=require('fs');var path=require(_0x23e8('0x7'));var rimraf=require(_0x23e8('0x8'));var config=require(_0x23e8('0x9'));var attributes=require(_0x23e8('0xa'));module[_0x23e8('0xb')]=function(_0x2da65f,_0x5742ac){return _0x2da65f[_0x23e8('0xc')](_0x23e8('0xd'),attributes,{'tableName':_0x23e8('0xe'),'paranoid':![],'indexes':[{'name':_0x23e8('0xf'),'fields':[_0x23e8('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 34b7b62..5380691 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 _0xe25f=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0xeffc63,_0x4acafd){var _0x175db2=function(_0x131a8b){while(--_0x131a8b){_0xeffc63['push'](_0xeffc63['shift']());}};_0x175db2(++_0x4acafd);}(_0xe25f,0x95));var _0xfe25=function(_0x56377a,_0x41d1e2){_0x56377a=_0x56377a-0x0;var _0x5d9b85=_0xe25f[_0x56377a];return _0x5d9b85;};'use strict';var _=require('lodash');var util=require(_0xfe25('0x0'));var moment=require(_0xfe25('0x1'));var BPromise=require('bluebird');var rs=require(_0xfe25('0x2'));var fs=require('fs');var Redis=require(_0xfe25('0x3'));var db=require(_0xfe25('0x4'))['db'];var utils=require(_0xfe25('0x5'));var logger=require(_0xfe25('0x6'))(_0xfe25('0x7'));var config=require(_0xfe25('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfe25('0x9')][_0xfe25('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fa280,_0x5239f5,_0x3158e5){return new BPromise(function(_0x528b63,_0xdba292){return client[_0xfe25('0xb')](_0x3fa280,_0x3158e5)['then'](function(_0x3c31cb){logger['info'](_0xfe25('0xc'),_0x5239f5,_0xfe25('0xd'));logger[_0xfe25('0xe')](_0xfe25('0xf'),_0x5239f5,'request\x20sent',JSON[_0xfe25('0x10')](_0x3c31cb));if(_0x3c31cb['error']){if(_0x3c31cb[_0xfe25('0x11')][_0xfe25('0x12')]===0x1f4){logger[_0xfe25('0x11')](_0xfe25('0xc'),_0x5239f5,_0x3c31cb[_0xfe25('0x11')][_0xfe25('0x13')]);return _0xdba292(_0x3c31cb[_0xfe25('0x11')][_0xfe25('0x13')]);}logger[_0xfe25('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x5239f5,_0x3c31cb[_0xfe25('0x11')]['message']);return _0x528b63(_0x3c31cb['error'][_0xfe25('0x13')]);}else{logger[_0xfe25('0x14')]('FaxTransferReport,\x20%s,\x20%s',_0x5239f5,'request\x20sent');_0x528b63(_0x3c31cb[_0xfe25('0x15')]['message']);}})['catch'](function(_0x22ee7e){logger[_0xfe25('0x11')](_0xfe25('0xc'),_0x5239f5,_0x22ee7e);_0xdba292(_0x22ee7e);});});} \ No newline at end of file +var _0x2a6b=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x2a6b,0x83));var _0xb2a6=function(_0x4e80e8,_0x1e6ee6){_0x4e80e8=_0x4e80e8-0x0;var _0x2b5b45=_0x2a6b[_0x4e80e8];return _0x2b5b45;};'use strict';var _=require('lodash');var util=require(_0xb2a6('0x0'));var moment=require(_0xb2a6('0x1'));var BPromise=require(_0xb2a6('0x2'));var rs=require(_0xb2a6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb2a6('0x4'))['db'];var utils=require(_0xb2a6('0x5'));var logger=require(_0xb2a6('0x6'))(_0xb2a6('0x7'));var config=require(_0xb2a6('0x8'));var jayson=require(_0xb2a6('0x9'));var client=jayson[_0xb2a6('0xa')][_0xb2a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d67d8,_0x218e48,_0x32af93){return new BPromise(function(_0x18ad75,_0x3c5c04){return client[_0xb2a6('0xc')](_0x4d67d8,_0x32af93)[_0xb2a6('0xd')](function(_0x3fede8){logger[_0xb2a6('0xe')](_0xb2a6('0xf'),_0x218e48,_0xb2a6('0x10'));logger[_0xb2a6('0x11')](_0xb2a6('0x12'),_0x218e48,_0xb2a6('0x10'),JSON['stringify'](_0x3fede8));if(_0x3fede8['error']){if(_0x3fede8[_0xb2a6('0x13')]['code']===0x1f4){logger[_0xb2a6('0x13')](_0xb2a6('0xf'),_0x218e48,_0x3fede8[_0xb2a6('0x13')][_0xb2a6('0x14')]);return _0x3c5c04(_0x3fede8[_0xb2a6('0x13')]['message']);}logger[_0xb2a6('0x13')](_0xb2a6('0xf'),_0x218e48,_0x3fede8[_0xb2a6('0x13')][_0xb2a6('0x14')]);return _0x18ad75(_0x3fede8['error'][_0xb2a6('0x14')]);}else{logger[_0xb2a6('0xe')](_0xb2a6('0xf'),_0x218e48,_0xb2a6('0x10'));_0x18ad75(_0x3fede8[_0xb2a6('0x15')][_0xb2a6('0x14')]);}})[_0xb2a6('0x16')](function(_0x1fed5f){logger['error'](_0xb2a6('0xf'),_0x218e48,_0x1fed5f);_0x3c5c04(_0x1fed5f);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 37f8e1b..81c5de6 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 _0xf38b=['/describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index'];(function(_0x2721b8,_0x111d60){var _0x52153f=function(_0x8d29a5){while(--_0x8d29a5){_0x2721b8['push'](_0x2721b8['shift']());}};_0x52153f(++_0x111d60);}(_0xf38b,0x8d));var _0xbf38=function(_0x5247f1,_0x16defa){_0x5247f1=_0x5247f1-0x0;var _0x18b6fa=_0xf38b[_0x5247f1];return _0x18b6fa;};'use strict';var multer=require(_0xbf38('0x0'));var util=require(_0xbf38('0x1'));var path=require(_0xbf38('0x2'));var timeout=require(_0xbf38('0x3'));var express=require(_0xbf38('0x4'));var router=express['Router']();var fs_extra=require(_0xbf38('0x5'));var auth=require(_0xbf38('0x6'));var interaction=require(_0xbf38('0x7'));var config=require(_0xbf38('0x8'));var controller=require(_0xbf38('0x9'));router[_0xbf38('0xa')]('/',auth[_0xbf38('0xb')](),controller[_0xbf38('0xc')]);router[_0xbf38('0xa')](_0xbf38('0xd'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xbf38('0xe'),auth[_0xbf38('0xb')](),controller[_0xbf38('0xf')]);router[_0xbf38('0x10')]('/',auth[_0xbf38('0xb')](),controller[_0xbf38('0x11')]);router[_0xbf38('0x12')](_0xbf38('0xe'),auth[_0xbf38('0xb')](),controller['update']);router[_0xbf38('0x13')]('/:id',auth[_0xbf38('0xb')](),controller[_0xbf38('0x14')]);module[_0xbf38('0x15')]=router; \ No newline at end of file +var _0xad10=['isAuthenticated','index','get','/describe','/:id','create','put','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxTransferReport.controller'];(function(_0x1f244d,_0x19e830){var _0x16003a=function(_0x1ee3f3){while(--_0x1ee3f3){_0x1f244d['push'](_0x1f244d['shift']());}};_0x16003a(++_0x19e830);}(_0xad10,0x75));var _0x0ad1=function(_0x353c9c,_0x1e8bce){_0x353c9c=_0x353c9c-0x0;var _0x503654=_0xad10[_0x353c9c];return _0x503654;};'use strict';var multer=require(_0x0ad1('0x0'));var util=require('util');var path=require(_0x0ad1('0x1'));var timeout=require(_0x0ad1('0x2'));var express=require(_0x0ad1('0x3'));var router=express[_0x0ad1('0x4')]();var fs_extra=require(_0x0ad1('0x5'));var auth=require(_0x0ad1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0ad1('0x7'));var controller=require(_0x0ad1('0x8'));router['get']('/',auth[_0x0ad1('0x9')](),controller[_0x0ad1('0xa')]);router[_0x0ad1('0xb')](_0x0ad1('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x0ad1('0xb')](_0x0ad1('0xd'),auth[_0x0ad1('0x9')](),controller['show']);router['post']('/',auth[_0x0ad1('0x9')](),controller[_0x0ad1('0xe')]);router[_0x0ad1('0xf')](_0x0ad1('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x0ad1('0xd'),auth[_0x0ad1('0x9')](),controller[_0x0ad1('0x10')]);module[_0x0ad1('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 30063a4..879a4d5 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 _0x908a=['isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','put','update','delete','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get'];(function(_0x3ca2f3,_0xc432d4){var _0x2f4880=function(_0x5d744a){while(--_0x5d744a){_0x3ca2f3['push'](_0x3ca2f3['shift']());}};_0x2f4880(++_0xc432d4);}(_0x908a,0x199));var _0xa908=function(_0xd513cb,_0x5d8397){_0xd513cb=_0xd513cb-0x0;var _0x3f2b4c=_0x908a[_0xd513cb];return _0x3f2b4c;};'use strict';var multer=require('multer');var util=require(_0xa908('0x0'));var path=require(_0xa908('0x1'));var timeout=require('connect-timeout');var express=require(_0xa908('0x2'));var router=express[_0xa908('0x3')]();var fs_extra=require(_0xa908('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa908('0x5'));var config=require(_0xa908('0x6'));var controller=require(_0xa908('0x7'));router[_0xa908('0x8')]('/',auth[_0xa908('0x9')](),controller[_0xa908('0xa')]);router['get'](_0xa908('0xb'),auth[_0xa908('0x9')](),controller[_0xa908('0xc')]);router[_0xa908('0x8')](_0xa908('0xd'),auth[_0xa908('0x9')](),controller['getConfigurations']);router[_0xa908('0x8')](_0xa908('0xe'),auth['isAuthenticated'](),controller[_0xa908('0xf')]);router[_0xa908('0x10')]('/',auth[_0xa908('0x9')](),controller[_0xa908('0x11')]);router['post'](_0xa908('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xa908('0x12')](_0xa908('0xb'),auth[_0xa908('0x9')](),controller[_0xa908('0x13')]);router[_0xa908('0x14')](_0xa908('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xa908('0x15')]=router; \ No newline at end of file +var _0x33fd=['../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x36f243,_0x188505){var _0x426436=function(_0x1c8622){while(--_0x1c8622){_0x36f243['push'](_0x36f243['shift']());}};_0x426436(++_0x188505);}(_0x33fd,0xb7));var _0xd33f=function(_0x22ac70,_0x2f460f){_0x22ac70=_0x22ac70-0x0;var _0x280358=_0x33fd[_0x22ac70];return _0x280358;};'use strict';var multer=require(_0xd33f('0x0'));var util=require(_0xd33f('0x1'));var path=require(_0xd33f('0x2'));var timeout=require(_0xd33f('0x3'));var express=require(_0xd33f('0x4'));var router=express[_0xd33f('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd33f('0x6'));var config=require(_0xd33f('0x7'));var controller=require(_0xd33f('0x8'));router[_0xd33f('0x9')]('/',auth[_0xd33f('0xa')](),controller['index']);router[_0xd33f('0x9')](_0xd33f('0xb'),auth[_0xd33f('0xa')](),controller[_0xd33f('0xc')]);router[_0xd33f('0x9')](_0xd33f('0xd'),auth['isAuthenticated'](),controller[_0xd33f('0xe')]);router[_0xd33f('0x9')](_0xd33f('0xf'),auth['isAuthenticated'](),controller[_0xd33f('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xd33f('0x11')]('/:id/configurations',auth[_0xd33f('0xa')](),controller[_0xd33f('0x12')]);router['put'](_0xd33f('0xb'),auth[_0xd33f('0xa')](),controller['update']);router[_0xd33f('0x13')](_0xd33f('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xd33f('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index ba3967d..5f04d81 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 _0x61fe=['STRING','ENUM','basic','integrationTab','newTab','sequelize'];(function(_0x688b4b,_0x910c5b){var _0x1a2dc1=function(_0x24c444){while(--_0x24c444){_0x688b4b['push'](_0x688b4b['shift']());}};_0x1a2dc1(++_0x910c5b);}(_0x61fe,0x197));var _0xe61f=function(_0x4d465c,_0x1845ae){_0x4d465c=_0x4d465c-0x0;var _0x2c078d=_0x61fe[_0x4d465c];return _0x2c078d;};'use strict';var Sequelize=require(_0xe61f('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe61f('0x1')]},'username':{'type':Sequelize[_0xe61f('0x1')]},'remoteUri':{'type':Sequelize[_0xe61f('0x1')]},'authType':{'type':Sequelize[_0xe61f('0x2')](_0xe61f('0x3')),'defaultValue':_0xe61f('0x3')},'password':{'type':Sequelize[_0xe61f('0x1')]},'consumerKey':{'type':Sequelize[_0xe61f('0x1')]},'consumerSecret':{'type':Sequelize[_0xe61f('0x1')]},'token':{'type':Sequelize[_0xe61f('0x1')]},'tokenSecret':{'type':Sequelize[_0xe61f('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe61f('0x4'),_0xe61f('0x5')),'defaultValue':_0xe61f('0x4')}}; \ No newline at end of file +var _0x5cfe=['newTab','exports','STRING','ENUM','basic','integrationTab'];(function(_0x2108d1,_0x58f8d9){var _0x171cff=function(_0x2e45ed){while(--_0x2e45ed){_0x2108d1['push'](_0x2108d1['shift']());}};_0x171cff(++_0x58f8d9);}(_0x5cfe,0x10f));var _0xe5cf=function(_0x208bf0,_0x24abcc){_0x208bf0=_0x208bf0-0x0;var _0x4e554e=_0x5cfe[_0x208bf0];return _0x4e554e;};'use strict';var Sequelize=require('sequelize');module[_0xe5cf('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe5cf('0x1')]},'username':{'type':Sequelize[_0xe5cf('0x1')]},'remoteUri':{'type':Sequelize[_0xe5cf('0x1')]},'authType':{'type':Sequelize[_0xe5cf('0x2')](_0xe5cf('0x3')),'defaultValue':_0xe5cf('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xe5cf('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xe5cf('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xe5cf('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xe5cf('0x2')](_0xe5cf('0x4'),_0xe5cf('0x5')),'defaultValue':_0xe5cf('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 8fb959a..dabebcb 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 _0xa1dd=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','options','DeskAccount','include','rows','catch','show','params','includeAll','find','create','update','body','findOne','DeskConfiguration','sort','getConfigurations','AccountId','channel','Descriptions','getDescriptions','DeskField','Subjects','priority','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','remoteUri','slice','substring','%s/custom_fields','application/json','basic','Authorization','%s:%s','base64','_embedded','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x1058ed,_0x109d8d){var _0x4e4661=function(_0x2fc1df){while(--_0x2fc1df){_0x1058ed['push'](_0x1058ed['shift']());}};_0x4e4661(++_0x109d8d);}(_0xa1dd,0x13c));var _0xda1d=function(_0x275e57,_0x3215e1){_0x275e57=_0x275e57-0x0;var _0x1bba4c=_0xa1dd[_0x275e57];return _0x1bba4c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xda1d('0x0'));var zipdir=require(_0xda1d('0x1'));var jsonpatch=require(_0xda1d('0x2'));var rp=require(_0xda1d('0x3'));var moment=require(_0xda1d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xda1d('0x5'));var util=require(_0xda1d('0x6'));var path=require(_0xda1d('0x7'));var sox=require(_0xda1d('0x8'));var csv=require('to-csv');var ejs=require(_0xda1d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xda1d('0xa'));var crypto=require(_0xda1d('0xb'));var jsforce=require(_0xda1d('0xc'));var deskjs=require(_0xda1d('0xd'));var toCsv=require('to-csv');var querystring=require(_0xda1d('0xe'));var Papa=require(_0xda1d('0xf'));var Redis=require(_0xda1d('0x10'));var authService=require(_0xda1d('0x11'));var qs=require(_0xda1d('0x12'));var as=require(_0xda1d('0x13'));var hardwareService=require(_0xda1d('0x14'));var logger=require(_0xda1d('0x15'))('api');var utils=require(_0xda1d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xda1d('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x53c84f,_0x32db5f){_0x32db5f=_0x32db5f||0xcc;return function(_0x2990ea){if(_0x2990ea){return _0x53c84f['sendStatus'](_0x32db5f);}return _0x53c84f[_0xda1d('0x18')](_0x32db5f)[_0xda1d('0x19')]();};}function respondWithResult(_0x1fc705,_0x4f212a){_0x4f212a=_0x4f212a||0xc8;return function(_0x3e7f3e){if(_0x3e7f3e){return _0x1fc705[_0xda1d('0x18')](_0x4f212a)['json'](_0x3e7f3e);}};}function respondWithFilteredResult(_0x57796e,_0x4af39b){return function(_0x4d1b07){if(_0x4d1b07){var _0x56d872=typeof _0x4af39b[_0xda1d('0x1a')]===_0xda1d('0x1b')&&typeof _0x4af39b[_0xda1d('0x1c')]===_0xda1d('0x1b');var _0x315432=_0x4d1b07[_0xda1d('0x1d')];var _0x2794bc=_0x56d872?0x0:_0x4af39b[_0xda1d('0x1a')];var _0x5a2d86=_0x56d872?_0x4d1b07['count']:_0x4af39b[_0xda1d('0x1a')]+_0x4af39b[_0xda1d('0x1c')];var _0xf42db3;if(_0x5a2d86>=_0x315432){_0x5a2d86=_0x315432;_0xf42db3=0xc8;}else{_0xf42db3=0xce;}_0x57796e[_0xda1d('0x18')](_0xf42db3);return _0x57796e['set'](_0xda1d('0x1e'),_0x2794bc+'-'+_0x5a2d86+'/'+_0x315432)[_0xda1d('0x1f')](_0x4d1b07);}return null;};}function patchUpdates(_0x554399){return function(_0x3c244f){try{jsonpatch[_0xda1d('0x20')](_0x3c244f,_0x554399,!![]);}catch(_0x1c852c){return BPromise[_0xda1d('0x21')](_0x1c852c);}return _0x3c244f['save']();};}function saveUpdates(_0x15a55c,_0x2c0bbd){return function(_0x76d343){if(_0x76d343){return _0x76d343['update'](_0x15a55c)['then'](function(_0x4f5296){return _0x4f5296;});}return null;};}function removeEntity(_0xfcf5ae,_0x59c4ef){return function(_0x5acf5c){if(_0x5acf5c){return _0x5acf5c[_0xda1d('0x22')]()[_0xda1d('0x23')](function(){_0xfcf5ae[_0xda1d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c57a9,_0x3fef13){return function(_0x152f86){if(!_0x152f86){_0x2c57a9[_0xda1d('0x24')](0x194);}return _0x152f86;};}function handleError(_0x43ecfb,_0x321538){_0x321538=_0x321538||0x1f4;return function(_0x48d411){logger[_0xda1d('0x25')](_0x48d411[_0xda1d('0x26')]);if(_0x48d411[_0xda1d('0x27')]){delete _0x48d411[_0xda1d('0x27')];}_0x43ecfb[_0xda1d('0x18')](_0x321538)[_0xda1d('0x28')](_0x48d411);};}exports[_0xda1d('0x29')]=function(_0x308bce,_0x5e3b43){var _0x21aa11={},_0x238127={},_0x372c15={'count':0x0,'rows':[]};var _0x4b9e6e=_[_0xda1d('0x2a')](db['DeskAccount'][_0xda1d('0x2b')],function(_0x430af3){return{'name':_0x430af3[_0xda1d('0x2c')],'type':_0x430af3[_0xda1d('0x2d')]['key']};});_0x238127[_0xda1d('0x2e')]=_[_0xda1d('0x2a')](_0x4b9e6e,_0xda1d('0x27'));_0x238127['query']=_[_0xda1d('0x2f')](_0x308bce[_0xda1d('0x30')]);_0x238127[_0xda1d('0x31')]=_[_0xda1d('0x32')](_0x238127[_0xda1d('0x2e')],_0x238127[_0xda1d('0x30')]);_0x21aa11[_0xda1d('0x33')]=_[_0xda1d('0x32')](_0x238127['model'],qs[_0xda1d('0x34')](_0x308bce[_0xda1d('0x30')]['fields']));_0x21aa11[_0xda1d('0x33')]=_0x21aa11[_0xda1d('0x33')][_0xda1d('0x35')]?_0x21aa11['attributes']:_0x238127[_0xda1d('0x2e')];if(!_0x308bce[_0xda1d('0x30')][_0xda1d('0x36')](_0xda1d('0x37'))){_0x21aa11['limit']=qs[_0xda1d('0x1c')](_0x308bce['query'][_0xda1d('0x1c')]);_0x21aa11[_0xda1d('0x1a')]=qs[_0xda1d('0x1a')](_0x308bce[_0xda1d('0x30')]['offset']);}_0x21aa11[_0xda1d('0x38')]=qs['sort'](_0x308bce[_0xda1d('0x30')]['sort']);_0x21aa11[_0xda1d('0x39')]=qs[_0xda1d('0x31')](_[_0xda1d('0x3a')](_0x308bce[_0xda1d('0x30')],_0x238127['filters']),_0x4b9e6e);if(_0x308bce[_0xda1d('0x30')][_0xda1d('0x3b')]){_0x21aa11[_0xda1d('0x39')]=_['merge'](_0x21aa11[_0xda1d('0x39')],{'$or':_[_0xda1d('0x2a')](_0x4b9e6e,function(_0x1ad8b3){if(_0x1ad8b3[_0xda1d('0x2d')]!==_0xda1d('0x3c')){var _0x385ed1={};_0x385ed1[_0x1ad8b3[_0xda1d('0x27')]]={'$like':'%'+_0x308bce[_0xda1d('0x30')]['filter']+'%'};return _0x385ed1;}})});}_0x21aa11=_[_0xda1d('0x3d')]({},_0x21aa11,_0x308bce[_0xda1d('0x3e')]);var _0x541aa9={'where':_0x21aa11[_0xda1d('0x39')]};return db[_0xda1d('0x3f')][_0xda1d('0x1d')](_0x541aa9)[_0xda1d('0x23')](function(_0x568c14){_0x372c15['count']=_0x568c14;if(_0x308bce[_0xda1d('0x30')]['includeAll']){_0x21aa11[_0xda1d('0x40')]=[{'all':!![]}];}return db[_0xda1d('0x3f')]['findAll'](_0x21aa11);})[_0xda1d('0x23')](function(_0x3b651d){_0x372c15[_0xda1d('0x41')]=_0x3b651d;return _0x372c15;})[_0xda1d('0x23')](respondWithFilteredResult(_0x5e3b43,_0x21aa11))[_0xda1d('0x42')](handleError(_0x5e3b43,null));};exports[_0xda1d('0x43')]=function(_0x49663f,_0x3a2241){var _0x19b8c4={'raw':![],'where':{'id':_0x49663f[_0xda1d('0x44')]['id']}},_0x593d7f={};_0x593d7f[_0xda1d('0x2e')]=_['keys'](db['DeskAccount'][_0xda1d('0x2b')]);_0x593d7f[_0xda1d('0x30')]=_['keys'](_0x49663f['query']);_0x593d7f[_0xda1d('0x31')]=_[_0xda1d('0x32')](_0x593d7f[_0xda1d('0x2e')],_0x593d7f[_0xda1d('0x30')]);_0x19b8c4[_0xda1d('0x33')]=_['intersection'](_0x593d7f[_0xda1d('0x2e')],qs['fields'](_0x49663f[_0xda1d('0x30')][_0xda1d('0x34')]));_0x19b8c4[_0xda1d('0x33')]=_0x19b8c4['attributes'][_0xda1d('0x35')]?_0x19b8c4[_0xda1d('0x33')]:_0x593d7f['model'];if(_0x49663f[_0xda1d('0x30')][_0xda1d('0x45')]){_0x19b8c4['include']=[{'all':!![]}];}_0x19b8c4=_[_0xda1d('0x3d')]({},_0x19b8c4,_0x49663f[_0xda1d('0x3e')]);return db[_0xda1d('0x3f')][_0xda1d('0x46')](_0x19b8c4)['then'](handleEntityNotFound(_0x3a2241,null))['then'](respondWithResult(_0x3a2241,null))[_0xda1d('0x42')](handleError(_0x3a2241,null));};exports[_0xda1d('0x47')]=function(_0x139d90,_0xe400f7){return db[_0xda1d('0x3f')][_0xda1d('0x47')](_0x139d90['body'],{})[_0xda1d('0x23')](respondWithResult(_0xe400f7,0xc9))[_0xda1d('0x42')](handleError(_0xe400f7,null));};exports[_0xda1d('0x48')]=function(_0x2d316c,_0x3d0305){if(_0x2d316c[_0xda1d('0x49')]['id']){delete _0x2d316c['body']['id'];}return db[_0xda1d('0x3f')][_0xda1d('0x46')]({'where':{'id':_0x2d316c[_0xda1d('0x44')]['id']}})[_0xda1d('0x23')](handleEntityNotFound(_0x3d0305,null))['then'](saveUpdates(_0x2d316c[_0xda1d('0x49')],null))[_0xda1d('0x23')](respondWithResult(_0x3d0305,null))[_0xda1d('0x42')](handleError(_0x3d0305,null));};exports[_0xda1d('0x22')]=function(_0x2da43,_0x4c02c3){return db[_0xda1d('0x3f')][_0xda1d('0x46')]({'where':{'id':_0x2da43[_0xda1d('0x44')]['id']}})['then'](handleEntityNotFound(_0x4c02c3,null))['then'](removeEntity(_0x4c02c3,null))['catch'](handleError(_0x4c02c3,null));};exports['getConfigurations']=function(_0x1aac6b,_0x54fdd3,_0x41495a){var _0x3ba291={};var _0x47be96={};var _0x2fabdc;var _0x3d5df4;return db['DeskAccount'][_0xda1d('0x4a')]({'where':{'id':_0x1aac6b[_0xda1d('0x44')]['id']}})[_0xda1d('0x23')](handleEntityNotFound(_0x54fdd3,null))[_0xda1d('0x23')](function(_0x1adc31){if(_0x1adc31){_0x2fabdc=_0x1adc31;_0x47be96[_0xda1d('0x2e')]=_[_0xda1d('0x2f')](db[_0xda1d('0x4b')][_0xda1d('0x2b')]);_0x47be96['query']=_[_0xda1d('0x2f')](_0x1aac6b[_0xda1d('0x30')]);_0x47be96[_0xda1d('0x31')]=_[_0xda1d('0x32')](_0x47be96[_0xda1d('0x2e')],_0x47be96[_0xda1d('0x30')]);_0x3ba291['attributes']=_['intersection'](_0x47be96[_0xda1d('0x2e')],qs[_0xda1d('0x34')](_0x1aac6b[_0xda1d('0x30')][_0xda1d('0x34')]));_0x3ba291[_0xda1d('0x33')]=_0x3ba291[_0xda1d('0x33')][_0xda1d('0x35')]?_0x3ba291['attributes']:_0x47be96['model'];_0x3ba291[_0xda1d('0x38')]=qs[_0xda1d('0x4c')](_0x1aac6b['query'][_0xda1d('0x4c')]);_0x3ba291['where']=qs[_0xda1d('0x31')](_['pick'](_0x1aac6b[_0xda1d('0x30')],_0x47be96[_0xda1d('0x31')]));if(_0x1aac6b['query'][_0xda1d('0x3b')]){_0x3ba291['where']=_[_0xda1d('0x3d')](_0x3ba291[_0xda1d('0x39')],{'$or':_[_0xda1d('0x2a')](_0x3ba291[_0xda1d('0x33')],function(_0x1dd5b8){var _0x29b7ea={};_0x29b7ea[_0x1dd5b8]={'$like':'%'+_0x1aac6b[_0xda1d('0x30')][_0xda1d('0x3b')]+'%'};return _0x29b7ea;})});}_0x3ba291=_[_0xda1d('0x3d')]({},_0x3ba291,_0x1aac6b[_0xda1d('0x3e')]);return _0x2fabdc['getConfigurations'](_0x3ba291);}})['then'](function(_0x4dba89){if(_0x4dba89){_0x3d5df4=_0x4dba89[_0xda1d('0x35')];if(!_0x1aac6b[_0xda1d('0x30')][_0xda1d('0x36')](_0xda1d('0x37'))){_0x3ba291[_0xda1d('0x1c')]=qs[_0xda1d('0x1c')](_0x1aac6b[_0xda1d('0x30')][_0xda1d('0x1c')]);_0x3ba291[_0xda1d('0x1a')]=qs['offset'](_0x1aac6b['query'][_0xda1d('0x1a')]);}return _0x2fabdc[_0xda1d('0x4d')](_0x3ba291);}})[_0xda1d('0x23')](function(_0x45ceef){if(_0x45ceef){return _0x45ceef?{'count':_0x3d5df4,'rows':_0x45ceef}:null;}})[_0xda1d('0x23')](respondWithResult(_0x54fdd3,null))[_0xda1d('0x42')](handleError(_0x54fdd3,null));};exports['addConfiguration']=function(_0x992db6,_0xfcbf3d,_0x3a3091){if(_0x992db6['body']['id']){delete _0x992db6[_0xda1d('0x49')]['id'];}return db['DeskAccount'][_0xda1d('0x4a')]({'where':{'id':_0x992db6[_0xda1d('0x44')]['id']}})['then'](handleEntityNotFound(_0xfcbf3d,null))[_0xda1d('0x23')](function(_0x209da1){if(_0x209da1){_0x992db6[_0xda1d('0x49')][_0xda1d('0x4e')]=_0x209da1['id'];_0x992db6[_0xda1d('0x49')]['Subjects']=integrations['getSubjects'](_0x992db6[_0xda1d('0x49')][_0xda1d('0x4f')],_0x992db6[_0xda1d('0x49')][_0xda1d('0x2d')]);_0x992db6[_0xda1d('0x49')][_0xda1d('0x50')]=integrations[_0xda1d('0x51')](_0x992db6[_0xda1d('0x49')][_0xda1d('0x4f')],_0x992db6['body']['type']);return db[_0xda1d('0x4b')]['create'](_0x992db6[_0xda1d('0x49')],{'include':[{'model':db[_0xda1d('0x52')],'as':_0xda1d('0x53')},{'model':db[_0xda1d('0x52')],'as':'Descriptions'}]});}return null;})[_0xda1d('0x23')](respondWithResult(_0xfcbf3d,null))['catch'](handleError(_0xfcbf3d,null));};exports['getFields']=function(_0x52cdf3,_0x3e53fc,_0x77ce63){var _0x5b798d=[{'name':_0xda1d('0x54'),'label':_0xda1d('0x54'),'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 _0x1c5917='';return db[_0xda1d('0x3f')][_0xda1d('0x4a')]({'where':{'id':_0x52cdf3['params']['id']},'attributes':['id','remoteUri',_0xda1d('0x55'),_0xda1d('0x56'),_0xda1d('0x57'),_0xda1d('0x58'),_0xda1d('0x59'),_0xda1d('0x5a'),_0xda1d('0x5b')]})[_0xda1d('0x23')](handleEntityNotFound(_0x3e53fc,null))[_0xda1d('0x23')](function(_0xbba0aa){if(_0xbba0aa){_0x1c5917=_0xbba0aa[_0xda1d('0x5c')];var _0x2cb717=_0x1c5917[_0xda1d('0x5d')](-0x1);if(_0x2cb717==='/'){_0x1c5917=_0x1c5917[_0xda1d('0x5e')](0x0,_0x1c5917['lastIndexOf'](_0x2cb717));}var _0x4899b8={'method':'GET','uri':util['format'](_0xda1d('0x5f'),_0x1c5917),'headers':{'Content-Type':_0xda1d('0x60'),'Accept':'application/json'},'json':!![]};if(_0xbba0aa['authType']===_0xda1d('0x61')){_0x4899b8['headers'][_0xda1d('0x62')]=util['format']('Basic\x20%s',new Buffer(util['format'](_0xda1d('0x63'),_0xbba0aa[_0xda1d('0x56')],_0xbba0aa[_0xda1d('0x57')]))['toString'](_0xda1d('0x64')));}return rp(_0x4899b8)[_0xda1d('0x23')](function(_0x50ad09){return _0x5b798d['concat'](_[_0xda1d('0x2a')](_0x50ad09[_0xda1d('0x65')][_0xda1d('0x66')],function(_0x1c382a){return{'id':_0x1c382a[_0xda1d('0x27')],'name':_0x1c382a[_0xda1d('0x27')],'type':_0x1c382a['type'],'active':_0x1c382a[_0xda1d('0x67')],'label':_0x1c382a[_0xda1d('0x68')],'custom':!![]};}));});}})[_0xda1d('0x23')](function(_0x41efec){return{'count':_0x41efec['length'],'rows':_0x41efec};})['then'](respondWithResult(_0x3e53fc,null))[_0xda1d('0x42')](function(_0x1a844e){var _0x1268ab=_0x52cdf3['query']['test']?0x1f4:_0x1a844e[_0xda1d('0x69')]||0x1f4;logger[_0xda1d('0x25')](_0xda1d('0x6a'),_0xda1d('0x6b'),_0x1268ab,JSON[_0xda1d('0x6c')](_0x1a844e));delete _0x1a844e[_0xda1d('0x27')];if(_0x1268ab===0x191){_0x1268ab=0x190;}_0x3e53fc[_0xda1d('0x18')](_0x1268ab)[_0xda1d('0x28')](_0x52cdf3[_0xda1d('0x30')][_0xda1d('0x6d')]?{'message':_0xda1d('0x6e'),'statusCode':_0x1a844e[_0xda1d('0x69')]}:_0x1a844e);});}; \ No newline at end of file +var _0x5bcc=['zip-dir','moment','bluebird','util','path','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','end','stack','send','map','DeskAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','name','options','includeAll','include','findAll','params','find','catch','create','body','getConfigurations','findOne','DeskConfiguration','length','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','DeskField','getFields','username','password','consumerKey','token','tokenSecret','remoteUri','slice','substring','GET','format','%s/custom_fields','application/json','authType','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','label','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x5bcc,0x15d));var _0xc5bc=function(_0x57ea8d,_0x2429e4){_0x57ea8d=_0x57ea8d-0x0;var _0xf40aef=_0x5bcc[_0x57ea8d];return _0xf40aef;};'use strict';var emlformat=require(_0xc5bc('0x0'));var rimraf=require(_0xc5bc('0x1'));var zipdir=require(_0xc5bc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc5bc('0x3'));var BPromise=require(_0xc5bc('0x4'));var Mustache=require('mustache');var util=require(_0xc5bc('0x5'));var path=require(_0xc5bc('0x6'));var sox=require(_0xc5bc('0x7'));var csv=require(_0xc5bc('0x8'));var ejs=require(_0xc5bc('0x9'));var fs=require('fs');var fs_extra=require(_0xc5bc('0xa'));var _=require('lodash');var squel=require(_0xc5bc('0xb'));var crypto=require(_0xc5bc('0xc'));var jsforce=require(_0xc5bc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc5bc('0x8'));var querystring=require(_0xc5bc('0xe'));var Papa=require(_0xc5bc('0xf'));var Redis=require(_0xc5bc('0x10'));var authService=require(_0xc5bc('0x11'));var qs=require(_0xc5bc('0x12'));var as=require(_0xc5bc('0x13'));var hardwareService=require(_0xc5bc('0x14'));var logger=require(_0xc5bc('0x15'))(_0xc5bc('0x16'));var utils=require('../../config/utils');var config=require(_0xc5bc('0x17'));var licenseUtil=require(_0xc5bc('0x18'));var db=require(_0xc5bc('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xa21fc,_0xc526f0){_0xc526f0=_0xc526f0||0xcc;return function(_0x581515){if(_0x581515){return _0xa21fc[_0xc5bc('0x1a')](_0xc526f0);}return _0xa21fc[_0xc5bc('0x1b')](_0xc526f0)['end']();};}function respondWithResult(_0x2ca2f7,_0x599187){_0x599187=_0x599187||0xc8;return function(_0x1ff09f){if(_0x1ff09f){return _0x2ca2f7[_0xc5bc('0x1b')](_0x599187)[_0xc5bc('0x1c')](_0x1ff09f);}};}function respondWithFilteredResult(_0x451dc8,_0x1d7a4e){return function(_0x12329d){if(_0x12329d){var _0x56ebf2=typeof _0x1d7a4e[_0xc5bc('0x1d')]===_0xc5bc('0x1e')&&typeof _0x1d7a4e[_0xc5bc('0x1f')]==='undefined';var _0x4b2dc3=_0x12329d[_0xc5bc('0x20')];var _0x5ed2ac=_0x56ebf2?0x0:_0x1d7a4e[_0xc5bc('0x1d')];var _0x23103=_0x56ebf2?_0x12329d['count']:_0x1d7a4e[_0xc5bc('0x1d')]+_0x1d7a4e['limit'];var _0x2232a8;if(_0x23103>=_0x4b2dc3){_0x23103=_0x4b2dc3;_0x2232a8=0xc8;}else{_0x2232a8=0xce;}_0x451dc8['status'](_0x2232a8);return _0x451dc8[_0xc5bc('0x21')]('Content-Range',_0x5ed2ac+'-'+_0x23103+'/'+_0x4b2dc3)[_0xc5bc('0x1c')](_0x12329d);}return null;};}function patchUpdates(_0x4b9ec2){return function(_0x4edef7){try{jsonpatch[_0xc5bc('0x22')](_0x4edef7,_0x4b9ec2,!![]);}catch(_0x3ea6b4){return BPromise[_0xc5bc('0x23')](_0x3ea6b4);}return _0x4edef7[_0xc5bc('0x24')]();};}function saveUpdates(_0x52999b,_0x5a1f8f){return function(_0x2c1806){if(_0x2c1806){return _0x2c1806[_0xc5bc('0x25')](_0x52999b)['then'](function(_0x5f3361){return _0x5f3361;});}return null;};}function removeEntity(_0x10a60d,_0x207ce0){return function(_0x395a4b){if(_0x395a4b){return _0x395a4b[_0xc5bc('0x26')]()[_0xc5bc('0x27')](function(){_0x10a60d[_0xc5bc('0x1b')](0xcc)[_0xc5bc('0x28')]();});}};}function handleEntityNotFound(_0x30fec5,_0x2ef083){return function(_0x175258){if(!_0x175258){_0x30fec5[_0xc5bc('0x1a')](0x194);}return _0x175258;};}function handleError(_0x379b02,_0x3935a4){_0x3935a4=_0x3935a4||0x1f4;return function(_0x4c3334){logger['error'](_0x4c3334[_0xc5bc('0x29')]);if(_0x4c3334['name']){delete _0x4c3334['name'];}_0x379b02[_0xc5bc('0x1b')](_0x3935a4)[_0xc5bc('0x2a')](_0x4c3334);};}exports['index']=function(_0x442e81,_0x4bee04){var _0x27907e={},_0x4a15a0={},_0x4f13c4={'count':0x0,'rows':[]};var _0x5cb728=_[_0xc5bc('0x2b')](db[_0xc5bc('0x2c')][_0xc5bc('0x2d')],function(_0x35cfa1){return{'name':_0x35cfa1[_0xc5bc('0x2e')],'type':_0x35cfa1[_0xc5bc('0x2f')][_0xc5bc('0x30')]};});_0x4a15a0['model']=_[_0xc5bc('0x2b')](_0x5cb728,'name');_0x4a15a0[_0xc5bc('0x31')]=_[_0xc5bc('0x32')](_0x442e81[_0xc5bc('0x31')]);_0x4a15a0[_0xc5bc('0x33')]=_[_0xc5bc('0x34')](_0x4a15a0[_0xc5bc('0x35')],_0x4a15a0[_0xc5bc('0x31')]);_0x27907e['attributes']=_[_0xc5bc('0x34')](_0x4a15a0['model'],qs['fields'](_0x442e81['query'][_0xc5bc('0x36')]));_0x27907e[_0xc5bc('0x37')]=_0x27907e[_0xc5bc('0x37')]['length']?_0x27907e[_0xc5bc('0x37')]:_0x4a15a0[_0xc5bc('0x35')];if(!_0x442e81[_0xc5bc('0x31')][_0xc5bc('0x38')](_0xc5bc('0x39'))){_0x27907e[_0xc5bc('0x1f')]=qs[_0xc5bc('0x1f')](_0x442e81['query'][_0xc5bc('0x1f')]);_0x27907e['offset']=qs['offset'](_0x442e81[_0xc5bc('0x31')]['offset']);}_0x27907e[_0xc5bc('0x3a')]=qs[_0xc5bc('0x3b')](_0x442e81['query'][_0xc5bc('0x3b')]);_0x27907e[_0xc5bc('0x3c')]=qs['filters'](_[_0xc5bc('0x3d')](_0x442e81[_0xc5bc('0x31')],_0x4a15a0['filters']),_0x5cb728);if(_0x442e81[_0xc5bc('0x31')]['filter']){_0x27907e['where']=_[_0xc5bc('0x3e')](_0x27907e[_0xc5bc('0x3c')],{'$or':_[_0xc5bc('0x2b')](_0x5cb728,function(_0x579039){if(_0x579039[_0xc5bc('0x2f')]!==_0xc5bc('0x3f')){var _0x12f69c={};_0x12f69c[_0x579039[_0xc5bc('0x40')]]={'$like':'%'+_0x442e81[_0xc5bc('0x31')]['filter']+'%'};return _0x12f69c;}})});}_0x27907e=_['merge']({},_0x27907e,_0x442e81[_0xc5bc('0x41')]);var _0x4bb5cb={'where':_0x27907e[_0xc5bc('0x3c')]};return db[_0xc5bc('0x2c')][_0xc5bc('0x20')](_0x4bb5cb)[_0xc5bc('0x27')](function(_0x2b276a){_0x4f13c4[_0xc5bc('0x20')]=_0x2b276a;if(_0x442e81[_0xc5bc('0x31')][_0xc5bc('0x42')]){_0x27907e[_0xc5bc('0x43')]=[{'all':!![]}];}return db[_0xc5bc('0x2c')][_0xc5bc('0x44')](_0x27907e);})[_0xc5bc('0x27')](function(_0x3f0277){_0x4f13c4['rows']=_0x3f0277;return _0x4f13c4;})[_0xc5bc('0x27')](respondWithFilteredResult(_0x4bee04,_0x27907e))['catch'](handleError(_0x4bee04,null));};exports['show']=function(_0x1f4f8d,_0xecb0cd){var _0x22821c={'raw':![],'where':{'id':_0x1f4f8d[_0xc5bc('0x45')]['id']}},_0x1448a7={};_0x1448a7[_0xc5bc('0x35')]=_[_0xc5bc('0x32')](db['DeskAccount']['rawAttributes']);_0x1448a7['query']=_[_0xc5bc('0x32')](_0x1f4f8d['query']);_0x1448a7[_0xc5bc('0x33')]=_[_0xc5bc('0x34')](_0x1448a7[_0xc5bc('0x35')],_0x1448a7[_0xc5bc('0x31')]);_0x22821c[_0xc5bc('0x37')]=_[_0xc5bc('0x34')](_0x1448a7[_0xc5bc('0x35')],qs['fields'](_0x1f4f8d[_0xc5bc('0x31')][_0xc5bc('0x36')]));_0x22821c['attributes']=_0x22821c[_0xc5bc('0x37')]['length']?_0x22821c[_0xc5bc('0x37')]:_0x1448a7[_0xc5bc('0x35')];if(_0x1f4f8d[_0xc5bc('0x31')][_0xc5bc('0x42')]){_0x22821c[_0xc5bc('0x43')]=[{'all':!![]}];}_0x22821c=_['merge']({},_0x22821c,_0x1f4f8d[_0xc5bc('0x41')]);return db[_0xc5bc('0x2c')][_0xc5bc('0x46')](_0x22821c)[_0xc5bc('0x27')](handleEntityNotFound(_0xecb0cd,null))['then'](respondWithResult(_0xecb0cd,null))[_0xc5bc('0x47')](handleError(_0xecb0cd,null));};exports[_0xc5bc('0x48')]=function(_0x1aa4e2,_0x14a2d9){return db[_0xc5bc('0x2c')][_0xc5bc('0x48')](_0x1aa4e2['body'],{})[_0xc5bc('0x27')](respondWithResult(_0x14a2d9,0xc9))[_0xc5bc('0x47')](handleError(_0x14a2d9,null));};exports['update']=function(_0x2e44c8,_0x4ee612){if(_0x2e44c8[_0xc5bc('0x49')]['id']){delete _0x2e44c8[_0xc5bc('0x49')]['id'];}return db['DeskAccount'][_0xc5bc('0x46')]({'where':{'id':_0x2e44c8[_0xc5bc('0x45')]['id']}})[_0xc5bc('0x27')](handleEntityNotFound(_0x4ee612,null))[_0xc5bc('0x27')](saveUpdates(_0x2e44c8[_0xc5bc('0x49')],null))[_0xc5bc('0x27')](respondWithResult(_0x4ee612,null))[_0xc5bc('0x47')](handleError(_0x4ee612,null));};exports['destroy']=function(_0x31bf66,_0x29a9f9){return db[_0xc5bc('0x2c')][_0xc5bc('0x46')]({'where':{'id':_0x31bf66[_0xc5bc('0x45')]['id']}})[_0xc5bc('0x27')](handleEntityNotFound(_0x29a9f9,null))[_0xc5bc('0x27')](removeEntity(_0x29a9f9,null))['catch'](handleError(_0x29a9f9,null));};exports[_0xc5bc('0x4a')]=function(_0x27eabf,_0x36362d,_0x914f3e){var _0x202c45={};var _0x4f198a={};var _0x18bbea;var _0x48d356;return db['DeskAccount'][_0xc5bc('0x4b')]({'where':{'id':_0x27eabf[_0xc5bc('0x45')]['id']}})[_0xc5bc('0x27')](handleEntityNotFound(_0x36362d,null))[_0xc5bc('0x27')](function(_0x4cab9d){if(_0x4cab9d){_0x18bbea=_0x4cab9d;_0x4f198a[_0xc5bc('0x35')]=_['keys'](db[_0xc5bc('0x4c')][_0xc5bc('0x2d')]);_0x4f198a[_0xc5bc('0x31')]=_[_0xc5bc('0x32')](_0x27eabf['query']);_0x4f198a[_0xc5bc('0x33')]=_[_0xc5bc('0x34')](_0x4f198a[_0xc5bc('0x35')],_0x4f198a[_0xc5bc('0x31')]);_0x202c45['attributes']=_[_0xc5bc('0x34')](_0x4f198a[_0xc5bc('0x35')],qs[_0xc5bc('0x36')](_0x27eabf[_0xc5bc('0x31')][_0xc5bc('0x36')]));_0x202c45[_0xc5bc('0x37')]=_0x202c45['attributes'][_0xc5bc('0x4d')]?_0x202c45[_0xc5bc('0x37')]:_0x4f198a[_0xc5bc('0x35')];_0x202c45[_0xc5bc('0x3a')]=qs[_0xc5bc('0x3b')](_0x27eabf['query'][_0xc5bc('0x3b')]);_0x202c45[_0xc5bc('0x3c')]=qs[_0xc5bc('0x33')](_[_0xc5bc('0x3d')](_0x27eabf[_0xc5bc('0x31')],_0x4f198a['filters']));if(_0x27eabf[_0xc5bc('0x31')]['filter']){_0x202c45[_0xc5bc('0x3c')]=_['merge'](_0x202c45[_0xc5bc('0x3c')],{'$or':_[_0xc5bc('0x2b')](_0x202c45[_0xc5bc('0x37')],function(_0x1e9f6e){var _0x1eb424={};_0x1eb424[_0x1e9f6e]={'$like':'%'+_0x27eabf[_0xc5bc('0x31')]['filter']+'%'};return _0x1eb424;})});}_0x202c45=_[_0xc5bc('0x3e')]({},_0x202c45,_0x27eabf['options']);return _0x18bbea['getConfigurations'](_0x202c45);}})[_0xc5bc('0x27')](function(_0x1727f4){if(_0x1727f4){_0x48d356=_0x1727f4[_0xc5bc('0x4d')];if(!_0x27eabf[_0xc5bc('0x31')][_0xc5bc('0x38')]('nolimit')){_0x202c45[_0xc5bc('0x1f')]=qs[_0xc5bc('0x1f')](_0x27eabf[_0xc5bc('0x31')][_0xc5bc('0x1f')]);_0x202c45[_0xc5bc('0x1d')]=qs[_0xc5bc('0x1d')](_0x27eabf[_0xc5bc('0x31')]['offset']);}return _0x18bbea['getConfigurations'](_0x202c45);}})[_0xc5bc('0x27')](function(_0x4aaeb9){if(_0x4aaeb9){return _0x4aaeb9?{'count':_0x48d356,'rows':_0x4aaeb9}:null;}})[_0xc5bc('0x27')](respondWithResult(_0x36362d,null))['catch'](handleError(_0x36362d,null));};exports[_0xc5bc('0x4e')]=function(_0x1b5717,_0x580d7a,_0x47dcac){if(_0x1b5717[_0xc5bc('0x49')]['id']){delete _0x1b5717[_0xc5bc('0x49')]['id'];}return db[_0xc5bc('0x2c')]['findOne']({'where':{'id':_0x1b5717[_0xc5bc('0x45')]['id']}})[_0xc5bc('0x27')](handleEntityNotFound(_0x580d7a,null))[_0xc5bc('0x27')](function(_0x9947b0){if(_0x9947b0){_0x1b5717['body'][_0xc5bc('0x4f')]=_0x9947b0['id'];_0x1b5717[_0xc5bc('0x49')][_0xc5bc('0x50')]=integrations['getSubjects'](_0x1b5717[_0xc5bc('0x49')][_0xc5bc('0x51')],_0x1b5717[_0xc5bc('0x49')][_0xc5bc('0x2f')]);_0x1b5717[_0xc5bc('0x49')][_0xc5bc('0x52')]=integrations[_0xc5bc('0x53')](_0x1b5717[_0xc5bc('0x49')]['channel'],_0x1b5717[_0xc5bc('0x49')][_0xc5bc('0x2f')]);return db[_0xc5bc('0x4c')]['create'](_0x1b5717[_0xc5bc('0x49')],{'include':[{'model':db[_0xc5bc('0x54')],'as':_0xc5bc('0x50')},{'model':db[_0xc5bc('0x54')],'as':'Descriptions'}]});}return null;})[_0xc5bc('0x27')](respondWithResult(_0x580d7a,null))[_0xc5bc('0x47')](handleError(_0x580d7a,null));};exports[_0xc5bc('0x55')]=function(_0x273cfb,_0xc92112,_0x2276dc){var _0x32c560=[{'name':'priority','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 _0x24cf1e='';return db['DeskAccount'][_0xc5bc('0x4b')]({'where':{'id':_0x273cfb[_0xc5bc('0x45')]['id']},'attributes':['id','remoteUri','authType',_0xc5bc('0x56'),_0xc5bc('0x57'),_0xc5bc('0x58'),'consumerSecret',_0xc5bc('0x59'),_0xc5bc('0x5a')]})[_0xc5bc('0x27')](handleEntityNotFound(_0xc92112,null))[_0xc5bc('0x27')](function(_0x3323d9){if(_0x3323d9){_0x24cf1e=_0x3323d9[_0xc5bc('0x5b')];var _0x121bea=_0x24cf1e[_0xc5bc('0x5c')](-0x1);if(_0x121bea==='/'){_0x24cf1e=_0x24cf1e[_0xc5bc('0x5d')](0x0,_0x24cf1e['lastIndexOf'](_0x121bea));}var _0x27d88d={'method':_0xc5bc('0x5e'),'uri':util[_0xc5bc('0x5f')](_0xc5bc('0x60'),_0x24cf1e),'headers':{'Content-Type':_0xc5bc('0x61'),'Accept':'application/json'},'json':!![]};if(_0x3323d9[_0xc5bc('0x62')]===_0xc5bc('0x63')){_0x27d88d[_0xc5bc('0x64')][_0xc5bc('0x65')]=util[_0xc5bc('0x5f')](_0xc5bc('0x66'),new Buffer(util[_0xc5bc('0x5f')](_0xc5bc('0x67'),_0x3323d9[_0xc5bc('0x56')],_0x3323d9[_0xc5bc('0x57')]))[_0xc5bc('0x68')](_0xc5bc('0x69')));}return rp(_0x27d88d)[_0xc5bc('0x27')](function(_0x3b3ded){return _0x32c560[_0xc5bc('0x6a')](_[_0xc5bc('0x2b')](_0x3b3ded[_0xc5bc('0x6b')][_0xc5bc('0x6c')],function(_0x538db2){return{'id':_0x538db2['name'],'name':_0x538db2[_0xc5bc('0x40')],'type':_0x538db2['type'],'active':_0x538db2[_0xc5bc('0x6d')],'label':_0x538db2[_0xc5bc('0x6e')],'custom':!![]};}));});}})[_0xc5bc('0x27')](function(_0x53024c){return{'count':_0x53024c[_0xc5bc('0x4d')],'rows':_0x53024c};})[_0xc5bc('0x27')](respondWithResult(_0xc92112,null))[_0xc5bc('0x47')](function(_0x4f22f5){var _0x59d9cd=_0x273cfb['query'][_0xc5bc('0x6f')]?0x1f4:_0x4f22f5[_0xc5bc('0x70')]||0x1f4;logger[_0xc5bc('0x71')](_0xc5bc('0x72'),_0xc5bc('0x55'),_0x59d9cd,JSON[_0xc5bc('0x73')](_0x4f22f5));delete _0x4f22f5[_0xc5bc('0x40')];if(_0x59d9cd===0x191){_0x59d9cd=0x190;}_0xc92112[_0xc5bc('0x1b')](_0x59d9cd)[_0xc5bc('0x2a')](_0x273cfb['query'][_0xc5bc('0x6f')]?{'message':_0xc5bc('0x74'),'statusCode':_0x4f22f5[_0xc5bc('0x70')]}:_0x4f22f5);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index ef17b03..6a9695d 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 _0xcbd8=['lodash','util','moment','bluebird','request-promise','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','DeskAccount','int_desk_accounts'];(function(_0x47c958,_0x3cfe09){var _0x573eab=function(_0x380ec6){while(--_0x380ec6){_0x47c958['push'](_0x47c958['shift']());}};_0x573eab(++_0x3cfe09);}(_0xcbd8,0x17c));var _0x8cbd=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xcbd8[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x8cbd('0x0'));var util=require(_0x8cbd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8cbd('0x2'));var BPromise=require(_0x8cbd('0x3'));var rp=require(_0x8cbd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8cbd('0x5'));var attributes=require(_0x8cbd('0x6'));var integrations=require(_0x8cbd('0x7'));module['exports']=function(_0x4bf34a,_0x1cff67){return _0x4bf34a['define'](_0x8cbd('0x8'),attributes,{'tableName':_0x8cbd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c01=['../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','api','moment','bluebird','path','rimraf','./intDeskAccount.attributes'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x0c01,0x161));var _0x10c0=function(_0x1d8613,_0x4cabf0){_0x1d8613=_0x1d8613-0x0;var _0x33feea=_0x0c01[_0x1d8613];return _0x33feea;};'use strict';var _=require(_0x10c0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x10c0('0x1'));var moment=require(_0x10c0('0x2'));var BPromise=require(_0x10c0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x10c0('0x4'));var rimraf=require(_0x10c0('0x5'));var config=require('../../config/environment');var attributes=require(_0x10c0('0x6'));var integrations=require(_0x10c0('0x7'));module[_0x10c0('0x8')]=function(_0x3c5674,_0x482618){return _0x3c5674[_0x10c0('0x9')](_0x10c0('0xa'),attributes,{'tableName':_0x10c0('0xb'),'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 7dcce4f..6a5eee5 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 _0x964e=['info','request\x20sent','debug','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','attributes','limit','include','map','model','ShowDeskAccount','find','where','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x2ab44d,_0x1dd6b6){var _0x306b50=function(_0x2d5a02){while(--_0x2d5a02){_0x2ab44d['push'](_0x2ab44d['shift']());}};_0x306b50(++_0x1dd6b6);}(_0x964e,0x149));var _0xe964=function(_0x3b3895,_0x23273b){_0x3b3895=_0x3b3895-0x0;var _0x10f219=_0x964e[_0x3b3895];return _0x10f219;};'use strict';var _=require(_0xe964('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe964('0x1'));var fs=require('fs');var Redis=require(_0xe964('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe964('0x3'));var logger=require(_0xe964('0x4'))(_0xe964('0x5'));var config=require('../../config/environment');var jayson=require(_0xe964('0x6'));var client=jayson[_0xe964('0x7')][_0xe964('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x18445a,_0x11d31a,_0x1632ae){return new BPromise(function(_0xc67a97,_0x355333){return client[_0xe964('0x9')](_0x18445a,_0x1632ae)[_0xe964('0xa')](function(_0x144f1f){logger[_0xe964('0xb')]('DeskAccount,\x20%s,\x20%s',_0x11d31a,_0xe964('0xc'));logger[_0xe964('0xd')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x11d31a,_0xe964('0xc'),JSON[_0xe964('0xe')](_0x144f1f));if(_0x144f1f[_0xe964('0xf')]){if(_0x144f1f[_0xe964('0xf')][_0xe964('0x10')]===0x1f4){logger[_0xe964('0xf')](_0xe964('0x11'),_0x11d31a,_0x144f1f[_0xe964('0xf')][_0xe964('0x12')]);return _0x355333(_0x144f1f[_0xe964('0xf')][_0xe964('0x12')]);}logger[_0xe964('0xf')](_0xe964('0x11'),_0x11d31a,_0x144f1f[_0xe964('0xf')][_0xe964('0x12')]);return _0xc67a97(_0x144f1f[_0xe964('0xf')][_0xe964('0x12')]);}else{logger['info'](_0xe964('0x11'),_0x11d31a,_0xe964('0xc'));_0xc67a97(_0x144f1f[_0xe964('0x13')][_0xe964('0x12')]);}})[_0xe964('0x14')](function(_0x3aa391){logger['error'](_0xe964('0x11'),_0x11d31a,_0x3aa391);_0x355333(_0x3aa391);});});}exports[_0xe964('0x15')]=function(_0x5594c8){var _0x4c4ee0=this;return new Promise(function(_0x3a0a85,_0xdaee89){return db[_0xe964('0x16')][_0xe964('0x17')]({'raw':_0x5594c8[_0xe964('0x18')]?_0x5594c8[_0xe964('0x18')][_0xe964('0x19')]===undefined?!![]:![]:!![],'where':_0x5594c8['options']?_0x5594c8['options']['where']||null:null,'attributes':_0x5594c8['options']?_0x5594c8[_0xe964('0x18')][_0xe964('0x1a')]||null:null,'limit':_0x5594c8[_0xe964('0x18')]?_0x5594c8[_0xe964('0x18')][_0xe964('0x1b')]||null:null,'include':_0x5594c8[_0xe964('0x18')]?_0x5594c8[_0xe964('0x18')][_0xe964('0x1c')]?_['map'](_0x5594c8[_0xe964('0x18')]['include'],function(_0x509aa3){return{'model':db[_0x509aa3['model']],'as':_0x509aa3['as'],'attributes':_0x509aa3[_0xe964('0x1a')],'include':_0x509aa3[_0xe964('0x1c')]?_[_0xe964('0x1d')](_0x509aa3['include'],function(_0x4b58dc){return{'model':db[_0x4b58dc[_0xe964('0x1e')]],'as':_0x4b58dc['as'],'attributes':_0x4b58dc['attributes'],'include':_0x4b58dc[_0xe964('0x1c')]?_['map'](_0x4b58dc[_0xe964('0x1c')],function(_0x1e93e0){return{'model':db[_0x1e93e0[_0xe964('0x1e')]],'as':_0x1e93e0['as'],'attributes':_0x1e93e0[_0xe964('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe964('0xa')](function(_0x3f1778){logger[_0xe964('0xb')]('GetDeskAccount',_0x5594c8);logger['debug'](_0xe964('0x15'),_0x5594c8,JSON[_0xe964('0xe')](_0x3f1778));_0x3a0a85(_0x3f1778);})[_0xe964('0x14')](function(_0x5f5bbc){logger[_0xe964('0xf')]('GetDeskAccount',_0x5f5bbc[_0xe964('0x12')],_0x5594c8);_0xdaee89(_0x4c4ee0['error'](0x1f4,_0x5f5bbc['message']));});});};exports[_0xe964('0x1f')]=function(_0x1428ba){var _0x3c776d=this;return new Promise(function(_0x5c5d7c,_0x24b025){return db['DeskAccount'][_0xe964('0x20')]({'raw':_0x1428ba[_0xe964('0x18')]?_0x1428ba[_0xe964('0x18')][_0xe964('0x19')]===undefined?!![]:![]:!![],'where':_0x1428ba[_0xe964('0x18')]?_0x1428ba[_0xe964('0x18')][_0xe964('0x21')]||null:null,'attributes':_0x1428ba['options']?_0x1428ba[_0xe964('0x18')]['attributes']||null:null,'include':_0x1428ba[_0xe964('0x18')]?_0x1428ba['options']['include']?_[_0xe964('0x1d')](_0x1428ba[_0xe964('0x18')][_0xe964('0x1c')],function(_0x434769){return{'model':db[_0x434769[_0xe964('0x1e')]],'as':_0x434769['as'],'attributes':_0x434769[_0xe964('0x1a')],'include':_0x434769['include']?_[_0xe964('0x1d')](_0x434769[_0xe964('0x1c')],function(_0xd93d31){return{'model':db[_0xd93d31[_0xe964('0x1e')]],'as':_0xd93d31['as'],'attributes':_0xd93d31[_0xe964('0x1a')],'include':_0xd93d31[_0xe964('0x1c')]?_['map'](_0xd93d31[_0xe964('0x1c')],function(_0x43a803){return{'model':db[_0x43a803[_0xe964('0x1e')]],'as':_0x43a803['as'],'attributes':_0x43a803[_0xe964('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe964('0xa')](function(_0x3bf1eb){logger[_0xe964('0xb')]('ShowDeskAccount',_0x1428ba);logger[_0xe964('0xd')](_0xe964('0x1f'),_0x1428ba,JSON[_0xe964('0xe')](_0x3bf1eb));_0x5c5d7c(_0x3bf1eb);})[_0xe964('0x14')](function(_0x489c6b){logger[_0xe964('0xf')]('ShowDeskAccount',_0x489c6b['message'],_0x1428ba);_0x24b025(_0x3c776d[_0xe964('0xf')](0x1f4,_0x489c6b[_0xe964('0x12')]));});});}; \ No newline at end of file +var _0xc97a=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','DeskAccount,\x20%s,\x20%s','message','catch','GetDeskAccount','DeskAccount','findAll','options','where','attributes','limit','include','map','model','then','ShowDeskAccount','raw','stringify','lodash','moment','bluebird','randomstring','ioredis'];(function(_0xdd82b4,_0x5cd8b8){var _0x549bb2=function(_0x426fd9){while(--_0x426fd9){_0xdd82b4['push'](_0xdd82b4['shift']());}};_0x549bb2(++_0x5cd8b8);}(_0xc97a,0x87));var _0xac97=function(_0x2f4760,_0x262c58){_0x2f4760=_0x2f4760-0x0;var _0x42cf89=_0xc97a[_0x2f4760];return _0x42cf89;};'use strict';var _=require(_0xac97('0x0'));var util=require('util');var moment=require(_0xac97('0x1'));var BPromise=require(_0xac97('0x2'));var rs=require(_0xac97('0x3'));var fs=require('fs');var Redis=require(_0xac97('0x4'));var db=require(_0xac97('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xac97('0x6'))(_0xac97('0x7'));var config=require(_0xac97('0x8'));var jayson=require(_0xac97('0x9'));var client=jayson[_0xac97('0xa')][_0xac97('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xdc2c67,_0x344941,_0x1f5baa){return new BPromise(function(_0xa69a3b,_0x388c34){return client['request'](_0xdc2c67,_0x1f5baa)['then'](function(_0x25ac45){logger[_0xac97('0xc')]('DeskAccount,\x20%s,\x20%s',_0x344941,_0xac97('0xd'));logger[_0xac97('0xe')](_0xac97('0xf'),_0x344941,'request\x20sent',JSON['stringify'](_0x25ac45));if(_0x25ac45[_0xac97('0x10')]){if(_0x25ac45[_0xac97('0x10')][_0xac97('0x11')]===0x1f4){logger[_0xac97('0x10')](_0xac97('0x12'),_0x344941,_0x25ac45[_0xac97('0x10')]['message']);return _0x388c34(_0x25ac45[_0xac97('0x10')][_0xac97('0x13')]);}logger[_0xac97('0x10')](_0xac97('0x12'),_0x344941,_0x25ac45[_0xac97('0x10')][_0xac97('0x13')]);return _0xa69a3b(_0x25ac45[_0xac97('0x10')][_0xac97('0x13')]);}else{logger[_0xac97('0xc')]('DeskAccount,\x20%s,\x20%s',_0x344941,_0xac97('0xd'));_0xa69a3b(_0x25ac45['result'][_0xac97('0x13')]);}})[_0xac97('0x14')](function(_0x31b3d8){logger[_0xac97('0x10')](_0xac97('0x12'),_0x344941,_0x31b3d8);_0x388c34(_0x31b3d8);});});}exports[_0xac97('0x15')]=function(_0x3630e3){var _0x4dee5a=this;return new Promise(function(_0x6256c6,_0x2cb8ce){return db[_0xac97('0x16')][_0xac97('0x17')]({'raw':_0x3630e3[_0xac97('0x18')]?_0x3630e3[_0xac97('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3630e3[_0xac97('0x18')]?_0x3630e3[_0xac97('0x18')][_0xac97('0x19')]||null:null,'attributes':_0x3630e3['options']?_0x3630e3['options'][_0xac97('0x1a')]||null:null,'limit':_0x3630e3[_0xac97('0x18')]?_0x3630e3[_0xac97('0x18')][_0xac97('0x1b')]||null:null,'include':_0x3630e3[_0xac97('0x18')]?_0x3630e3[_0xac97('0x18')][_0xac97('0x1c')]?_[_0xac97('0x1d')](_0x3630e3[_0xac97('0x18')][_0xac97('0x1c')],function(_0x306ac6){return{'model':db[_0x306ac6[_0xac97('0x1e')]],'as':_0x306ac6['as'],'attributes':_0x306ac6[_0xac97('0x1a')],'include':_0x306ac6[_0xac97('0x1c')]?_[_0xac97('0x1d')](_0x306ac6[_0xac97('0x1c')],function(_0x626e19){return{'model':db[_0x626e19['model']],'as':_0x626e19['as'],'attributes':_0x626e19[_0xac97('0x1a')],'include':_0x626e19['include']?_['map'](_0x626e19[_0xac97('0x1c')],function(_0x2698ae){return{'model':db[_0x2698ae[_0xac97('0x1e')]],'as':_0x2698ae['as'],'attributes':_0x2698ae['attributes']};}):[]};}):[]};}):[]:[]})[_0xac97('0x1f')](function(_0x3ed914){logger[_0xac97('0xc')](_0xac97('0x15'),_0x3630e3);logger[_0xac97('0xe')]('GetDeskAccount',_0x3630e3,JSON['stringify'](_0x3ed914));_0x6256c6(_0x3ed914);})[_0xac97('0x14')](function(_0x1c5194){logger['error'](_0xac97('0x15'),_0x1c5194[_0xac97('0x13')],_0x3630e3);_0x2cb8ce(_0x4dee5a[_0xac97('0x10')](0x1f4,_0x1c5194[_0xac97('0x13')]));});});};exports[_0xac97('0x20')]=function(_0xc66ada){var _0x6ac7a=this;return new Promise(function(_0x3aab47,_0x57c94c){return db[_0xac97('0x16')]['find']({'raw':_0xc66ada[_0xac97('0x18')]?_0xc66ada[_0xac97('0x18')][_0xac97('0x21')]===undefined?!![]:![]:!![],'where':_0xc66ada[_0xac97('0x18')]?_0xc66ada[_0xac97('0x18')][_0xac97('0x19')]||null:null,'attributes':_0xc66ada[_0xac97('0x18')]?_0xc66ada[_0xac97('0x18')]['attributes']||null:null,'include':_0xc66ada[_0xac97('0x18')]?_0xc66ada[_0xac97('0x18')][_0xac97('0x1c')]?_[_0xac97('0x1d')](_0xc66ada[_0xac97('0x18')][_0xac97('0x1c')],function(_0x41d058){return{'model':db[_0x41d058[_0xac97('0x1e')]],'as':_0x41d058['as'],'attributes':_0x41d058['attributes'],'include':_0x41d058[_0xac97('0x1c')]?_['map'](_0x41d058[_0xac97('0x1c')],function(_0x52e325){return{'model':db[_0x52e325[_0xac97('0x1e')]],'as':_0x52e325['as'],'attributes':_0x52e325['attributes'],'include':_0x52e325[_0xac97('0x1c')]?_[_0xac97('0x1d')](_0x52e325[_0xac97('0x1c')],function(_0x3e25d7){return{'model':db[_0x3e25d7[_0xac97('0x1e')]],'as':_0x3e25d7['as'],'attributes':_0x3e25d7[_0xac97('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xac97('0x1f')](function(_0x552d3a){logger[_0xac97('0xc')]('ShowDeskAccount',_0xc66ada);logger['debug']('ShowDeskAccount',_0xc66ada,JSON[_0xac97('0x22')](_0x552d3a));_0x3aab47(_0x552d3a);})['catch'](function(_0x13d89d){logger[_0xac97('0x10')](_0xac97('0x20'),_0x13d89d[_0xac97('0x13')],_0xc66ada);_0x57c94c(_0x6ac7a['error'](0x1f4,_0x13d89d[_0xac97('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 9efc492..441d808 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 _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x42d67a,_0x4049ad){var _0x5dcef9=function(_0x4aa90f){while(--_0x4aa90f){_0x42d67a['push'](_0x42d67a['shift']());}};_0x5dcef9(++_0x4049ad);}(_0xedd9,0xfc));var _0x9edd=function(_0x8cc8b3,_0x2adbd9){_0x8cc8b3=_0x8cc8b3-0x0;var _0x295b74=_0xedd9[_0x8cc8b3];return _0x295b74;};'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('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=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(_0x4223c9,_0x298ff1){var _0x5df12e=function(_0x1e001b){while(--_0x1e001b){_0x4223c9['push'](_0x4223c9['shift']());}};_0x5df12e(++_0x298ff1);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 a910c7f..20ab7ff 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 _0xaaa6=['STRING','sequelize','exports'];(function(_0xd627f1,_0x4a848b){var _0x2d6d38=function(_0x7ad880){while(--_0x7ad880){_0xd627f1['push'](_0xd627f1['shift']());}};_0x2d6d38(++_0x4a848b);}(_0xaaa6,0x166));var _0x6aaa=function(_0xe718ab,_0x3c155f){_0xe718ab=_0xe718ab-0x0;var _0x5cbe5d=_0xaaa6[_0xe718ab];return _0x5cbe5d;};'use strict';var Sequelize=require(_0x6aaa('0x0'));module[_0x6aaa('0x1')]={'name':{'type':Sequelize[_0x6aaa('0x2')]},'description':{'type':Sequelize[_0x6aaa('0x2')]}}; \ No newline at end of file +var _0x4b4b=['sequelize','exports','STRING'];(function(_0x54b662,_0x1738b6){var _0x1b74da=function(_0x2b67f2){while(--_0x2b67f2){_0x54b662['push'](_0x54b662['shift']());}};_0x1b74da(++_0x1738b6);}(_0x4b4b,0xdb));var _0xb4b4=function(_0x56634a,_0x33948d){_0x56634a=_0x56634a-0x0;var _0x236619=_0x4b4b[_0x56634a];return _0x236619;};'use strict';var Sequelize=require(_0xb4b4('0x0'));module[_0xb4b4('0x1')]={'name':{'type':Sequelize[_0xb4b4('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index a6c7bc2..a28b47f 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 _0x2cc9=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','find','create','getFields','findOne','DeskField','sort','hasOwnProperty','getSubjects','options','getDescriptions','getTags','Tag','setTags','body','ids'];(function(_0x21ddb5,_0x4e5746){var _0x5d32a1=function(_0x17afda){while(--_0x17afda){_0x21ddb5['push'](_0x21ddb5['shift']());}};_0x5d32a1(++_0x4e5746);}(_0x2cc9,0xa2));var _0x92cc=function(_0x49fcc6,_0x22b508){_0x49fcc6=_0x49fcc6-0x0;var _0x5e3aaa=_0x2cc9[_0x49fcc6];return _0x5e3aaa;};'use strict';var emlformat=require(_0x92cc('0x0'));var rimraf=require(_0x92cc('0x1'));var zipdir=require(_0x92cc('0x2'));var jsonpatch=require(_0x92cc('0x3'));var rp=require('request-promise');var moment=require(_0x92cc('0x4'));var BPromise=require(_0x92cc('0x5'));var Mustache=require(_0x92cc('0x6'));var util=require(_0x92cc('0x7'));var path=require(_0x92cc('0x8'));var sox=require('sox');var csv=require(_0x92cc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x92cc('0xa'));var _=require('lodash');var squel=require(_0x92cc('0xb'));var crypto=require(_0x92cc('0xc'));var jsforce=require(_0x92cc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x92cc('0x9'));var querystring=require(_0x92cc('0xe'));var Papa=require(_0x92cc('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x92cc('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x92cc('0x11'));var logger=require(_0x92cc('0x12'))('api');var utils=require(_0x92cc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x92cc('0x14'));var db=require(_0x92cc('0x15'))['db'];function respondWithStatusCode(_0x2d5f43,_0x2b33e4){_0x2b33e4=_0x2b33e4||0xcc;return function(_0x390e62){if(_0x390e62){return _0x2d5f43[_0x92cc('0x16')](_0x2b33e4);}return _0x2d5f43['status'](_0x2b33e4)['end']();};}function respondWithResult(_0x46a844,_0x16b6d3){_0x16b6d3=_0x16b6d3||0xc8;return function(_0x5081c2){if(_0x5081c2){return _0x46a844[_0x92cc('0x17')](_0x16b6d3)['json'](_0x5081c2);}};}function respondWithFilteredResult(_0x274155,_0x4315f7){return function(_0x164a11){if(_0x164a11){var _0x4cd226=typeof _0x4315f7[_0x92cc('0x18')]==='undefined'&&typeof _0x4315f7[_0x92cc('0x19')]===_0x92cc('0x1a');var _0x10f9b1=_0x164a11[_0x92cc('0x1b')];var _0xd467f5=_0x4cd226?0x0:_0x4315f7[_0x92cc('0x18')];var _0x35f4d6=_0x4cd226?_0x164a11[_0x92cc('0x1b')]:_0x4315f7[_0x92cc('0x18')]+_0x4315f7[_0x92cc('0x19')];var _0x8d6832;if(_0x35f4d6>=_0x10f9b1){_0x35f4d6=_0x10f9b1;_0x8d6832=0xc8;}else{_0x8d6832=0xce;}_0x274155['status'](_0x8d6832);return _0x274155['set'](_0x92cc('0x1c'),_0xd467f5+'-'+_0x35f4d6+'/'+_0x10f9b1)['json'](_0x164a11);}return null;};}function patchUpdates(_0x5d4e12){return function(_0x6f7bf2){try{jsonpatch[_0x92cc('0x1d')](_0x6f7bf2,_0x5d4e12,!![]);}catch(_0x127829){return BPromise[_0x92cc('0x1e')](_0x127829);}return _0x6f7bf2[_0x92cc('0x1f')]();};}function saveUpdates(_0x7ab2df,_0x241906){return function(_0x247026){if(_0x247026){return _0x247026[_0x92cc('0x20')](_0x7ab2df)[_0x92cc('0x21')](function(_0x294196){return _0x294196;});}return null;};}function removeEntity(_0x1fe2c9,_0x52a77a){return function(_0x37c9cc){if(_0x37c9cc){return _0x37c9cc[_0x92cc('0x22')]()[_0x92cc('0x21')](function(){_0x1fe2c9[_0x92cc('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2af659,_0x59e998){return function(_0x5af2e0){if(!_0x5af2e0){_0x2af659[_0x92cc('0x16')](0x194);}return _0x5af2e0;};}function handleError(_0x2c3de5,_0x344ff1){_0x344ff1=_0x344ff1||0x1f4;return function(_0x5257c2){logger['error'](_0x5257c2[_0x92cc('0x23')]);if(_0x5257c2['name']){delete _0x5257c2[_0x92cc('0x24')];}_0x2c3de5[_0x92cc('0x17')](_0x344ff1)[_0x92cc('0x25')](_0x5257c2);};}exports[_0x92cc('0x26')]=function(_0x2f79b5,_0x3aac07){var _0x2f2715={},_0x435c66={},_0x2bf79f={'count':0x0,'rows':[]};var _0x1d22f8=_[_0x92cc('0x27')](db[_0x92cc('0x28')][_0x92cc('0x29')],function(_0x24532b){return{'name':_0x24532b[_0x92cc('0x2a')],'type':_0x24532b[_0x92cc('0x2b')]['key']};});_0x435c66[_0x92cc('0x2c')]=_['map'](_0x1d22f8,_0x92cc('0x24'));_0x435c66[_0x92cc('0x2d')]=_['keys'](_0x2f79b5[_0x92cc('0x2d')]);_0x435c66[_0x92cc('0x2e')]=_[_0x92cc('0x2f')](_0x435c66[_0x92cc('0x2c')],_0x435c66['query']);_0x2f2715[_0x92cc('0x30')]=_[_0x92cc('0x2f')](_0x435c66[_0x92cc('0x2c')],qs[_0x92cc('0x31')](_0x2f79b5[_0x92cc('0x2d')][_0x92cc('0x31')]));_0x2f2715[_0x92cc('0x30')]=_0x2f2715['attributes'][_0x92cc('0x32')]?_0x2f2715['attributes']:_0x435c66[_0x92cc('0x2c')];if(!_0x2f79b5[_0x92cc('0x2d')]['hasOwnProperty'](_0x92cc('0x33'))){_0x2f2715[_0x92cc('0x19')]=qs[_0x92cc('0x19')](_0x2f79b5['query']['limit']);_0x2f2715[_0x92cc('0x18')]=qs['offset'](_0x2f79b5['query'][_0x92cc('0x18')]);}_0x2f2715[_0x92cc('0x34')]=qs['sort'](_0x2f79b5[_0x92cc('0x2d')]['sort']);_0x2f2715['where']=qs[_0x92cc('0x2e')](_[_0x92cc('0x35')](_0x2f79b5[_0x92cc('0x2d')],_0x435c66[_0x92cc('0x2e')]),_0x1d22f8);if(_0x2f79b5['query'][_0x92cc('0x36')]){_0x2f2715['where']=_[_0x92cc('0x37')](_0x2f2715[_0x92cc('0x38')],{'$or':_[_0x92cc('0x27')](_0x1d22f8,function(_0x1f5484){if(_0x1f5484[_0x92cc('0x2b')]!==_0x92cc('0x39')){var _0x2c9248={};_0x2c9248[_0x1f5484[_0x92cc('0x24')]]={'$like':'%'+_0x2f79b5[_0x92cc('0x2d')]['filter']+'%'};return _0x2c9248;}})});}_0x2f2715=_[_0x92cc('0x37')]({},_0x2f2715,_0x2f79b5['options']);var _0x27dd65={'where':_0x2f2715[_0x92cc('0x38')]};return db[_0x92cc('0x28')]['count'](_0x27dd65)[_0x92cc('0x21')](function(_0x3f30c0){_0x2bf79f[_0x92cc('0x1b')]=_0x3f30c0;if(_0x2f79b5[_0x92cc('0x2d')][_0x92cc('0x3a')]){_0x2f2715[_0x92cc('0x3b')]=[{'all':!![]}];}return db[_0x92cc('0x28')][_0x92cc('0x3c')](_0x2f2715);})['then'](function(_0x28734c){_0x2bf79f[_0x92cc('0x3d')]=_0x28734c;return _0x2bf79f;})[_0x92cc('0x21')](respondWithFilteredResult(_0x3aac07,_0x2f2715))[_0x92cc('0x3e')](handleError(_0x3aac07,null));};exports[_0x92cc('0x3f')]=function(_0x433aa6,_0x3fd18a){var _0xd9fb0f={'raw':![],'where':{'id':_0x433aa6[_0x92cc('0x40')]['id']}},_0x4cd001={};_0x4cd001[_0x92cc('0x2c')]=_['keys'](db['DeskConfiguration']['rawAttributes']);_0x4cd001[_0x92cc('0x2d')]=_[_0x92cc('0x41')](_0x433aa6[_0x92cc('0x2d')]);_0x4cd001['filters']=_[_0x92cc('0x2f')](_0x4cd001[_0x92cc('0x2c')],_0x4cd001['query']);_0xd9fb0f[_0x92cc('0x30')]=_[_0x92cc('0x2f')](_0x4cd001[_0x92cc('0x2c')],qs[_0x92cc('0x31')](_0x433aa6[_0x92cc('0x2d')][_0x92cc('0x31')]));_0xd9fb0f[_0x92cc('0x30')]=_0xd9fb0f['attributes'][_0x92cc('0x32')]?_0xd9fb0f['attributes']:_0x4cd001[_0x92cc('0x2c')];if(_0x433aa6[_0x92cc('0x2d')][_0x92cc('0x3a')]){_0xd9fb0f[_0x92cc('0x3b')]=[{'all':!![]}];}_0xd9fb0f=_[_0x92cc('0x37')]({},_0xd9fb0f,_0x433aa6['options']);return db['DeskConfiguration'][_0x92cc('0x42')](_0xd9fb0f)[_0x92cc('0x21')](handleEntityNotFound(_0x3fd18a,null))[_0x92cc('0x21')](respondWithResult(_0x3fd18a,null))[_0x92cc('0x3e')](handleError(_0x3fd18a,null));};exports[_0x92cc('0x43')]=function(_0xa0ec64,_0x3aa93a){return db['DeskConfiguration'][_0x92cc('0x43')](_0xa0ec64['body'],{})[_0x92cc('0x21')](respondWithResult(_0x3aa93a,0xc9))[_0x92cc('0x3e')](handleError(_0x3aa93a,null));};exports['update']=function(_0x1d4164,_0xa01f52){if(_0x1d4164['body']['id']){delete _0x1d4164['body']['id'];}return db[_0x92cc('0x28')][_0x92cc('0x42')]({'where':{'id':_0x1d4164[_0x92cc('0x40')]['id']}})[_0x92cc('0x21')](handleEntityNotFound(_0xa01f52,null))[_0x92cc('0x21')](saveUpdates(_0x1d4164['body'],null))[_0x92cc('0x21')](respondWithResult(_0xa01f52,null))[_0x92cc('0x3e')](handleError(_0xa01f52,null));};exports[_0x92cc('0x22')]=function(_0x177f1b,_0x4e86b2){return db[_0x92cc('0x28')][_0x92cc('0x42')]({'where':{'id':_0x177f1b[_0x92cc('0x40')]['id']}})[_0x92cc('0x21')](handleEntityNotFound(_0x4e86b2,null))[_0x92cc('0x21')](removeEntity(_0x4e86b2,null))[_0x92cc('0x3e')](handleError(_0x4e86b2,null));};exports[_0x92cc('0x44')]=function(_0x569161,_0x9b1f8b,_0x15051f){var _0xde5075={};var _0x12561d={};var _0xe3e645;var _0x120bb1;return db[_0x92cc('0x28')][_0x92cc('0x45')]({'where':{'id':_0x569161['params']['id']}})[_0x92cc('0x21')](handleEntityNotFound(_0x9b1f8b,null))['then'](function(_0x34f7c7){if(_0x34f7c7){_0xe3e645=_0x34f7c7;_0x12561d['model']=_[_0x92cc('0x41')](db[_0x92cc('0x46')][_0x92cc('0x29')]);_0x12561d[_0x92cc('0x2d')]=_[_0x92cc('0x41')](_0x569161[_0x92cc('0x2d')]);_0x12561d[_0x92cc('0x2e')]=_[_0x92cc('0x2f')](_0x12561d[_0x92cc('0x2c')],_0x12561d[_0x92cc('0x2d')]);_0xde5075[_0x92cc('0x30')]=_['intersection'](_0x12561d[_0x92cc('0x2c')],qs['fields'](_0x569161[_0x92cc('0x2d')][_0x92cc('0x31')]));_0xde5075[_0x92cc('0x30')]=_0xde5075[_0x92cc('0x30')][_0x92cc('0x32')]?_0xde5075['attributes']:_0x12561d['model'];_0xde5075[_0x92cc('0x34')]=qs['sort'](_0x569161['query'][_0x92cc('0x47')]);_0xde5075[_0x92cc('0x38')]=qs[_0x92cc('0x2e')](_[_0x92cc('0x35')](_0x569161[_0x92cc('0x2d')],_0x12561d[_0x92cc('0x2e')]));if(_0x569161[_0x92cc('0x2d')][_0x92cc('0x36')]){_0xde5075[_0x92cc('0x38')]=_[_0x92cc('0x37')](_0xde5075[_0x92cc('0x38')],{'$or':_[_0x92cc('0x27')](_0xde5075['attributes'],function(_0xec5569){var _0x5dba18={};_0x5dba18[_0xec5569]={'$like':'%'+_0x569161['query'][_0x92cc('0x36')]+'%'};return _0x5dba18;})});}_0xde5075=_[_0x92cc('0x37')]({},_0xde5075,_0x569161['options']);return _0xe3e645[_0x92cc('0x44')](_0xde5075);}})[_0x92cc('0x21')](function(_0x26df6a){if(_0x26df6a){_0x120bb1=_0x26df6a[_0x92cc('0x32')];if(!_0x569161[_0x92cc('0x2d')][_0x92cc('0x48')](_0x92cc('0x33'))){_0xde5075['limit']=qs[_0x92cc('0x19')](_0x569161[_0x92cc('0x2d')][_0x92cc('0x19')]);_0xde5075[_0x92cc('0x18')]=qs[_0x92cc('0x18')](_0x569161[_0x92cc('0x2d')][_0x92cc('0x18')]);}return _0xe3e645[_0x92cc('0x44')](_0xde5075);}})[_0x92cc('0x21')](function(_0x16f060){if(_0x16f060){return _0x16f060?{'count':_0x120bb1,'rows':_0x16f060}:null;}})['then'](respondWithResult(_0x9b1f8b,null))['catch'](handleError(_0x9b1f8b,null));};exports[_0x92cc('0x49')]=function(_0x59819a,_0x206da9,_0x51d268){var _0x2f0b2c={};var _0x25afa9={};var _0x111402;var _0x347580;return db['DeskConfiguration']['findOne']({'where':{'id':_0x59819a['params']['id']}})[_0x92cc('0x21')](handleEntityNotFound(_0x206da9,null))[_0x92cc('0x21')](function(_0xf25743){if(_0xf25743){_0x111402=_0xf25743;_0x25afa9[_0x92cc('0x2c')]=_[_0x92cc('0x41')](db[_0x92cc('0x46')][_0x92cc('0x29')]);_0x25afa9[_0x92cc('0x2d')]=_['keys'](_0x59819a[_0x92cc('0x2d')]);_0x25afa9['filters']=_[_0x92cc('0x2f')](_0x25afa9['model'],_0x25afa9['query']);_0x2f0b2c[_0x92cc('0x30')]=_['intersection'](_0x25afa9['model'],qs['fields'](_0x59819a['query'][_0x92cc('0x31')]));_0x2f0b2c[_0x92cc('0x30')]=_0x2f0b2c[_0x92cc('0x30')][_0x92cc('0x32')]?_0x2f0b2c[_0x92cc('0x30')]:_0x25afa9['model'];_0x2f0b2c['order']=qs[_0x92cc('0x47')](_0x59819a[_0x92cc('0x2d')][_0x92cc('0x47')]);_0x2f0b2c[_0x92cc('0x38')]=qs[_0x92cc('0x2e')](_[_0x92cc('0x35')](_0x59819a[_0x92cc('0x2d')],_0x25afa9[_0x92cc('0x2e')]));if(_0x59819a[_0x92cc('0x2d')][_0x92cc('0x36')]){_0x2f0b2c[_0x92cc('0x38')]=_['merge'](_0x2f0b2c[_0x92cc('0x38')],{'$or':_[_0x92cc('0x27')](_0x2f0b2c[_0x92cc('0x30')],function(_0xdc1b59){var _0x46fbdb={};_0x46fbdb[_0xdc1b59]={'$like':'%'+_0x59819a[_0x92cc('0x2d')][_0x92cc('0x36')]+'%'};return _0x46fbdb;})});}_0x2f0b2c=_[_0x92cc('0x37')]({},_0x2f0b2c,_0x59819a[_0x92cc('0x4a')]);return _0x111402['getSubjects'](_0x2f0b2c);}})['then'](function(_0x21cea9){if(_0x21cea9){_0x347580=_0x21cea9['length'];if(!_0x59819a[_0x92cc('0x2d')][_0x92cc('0x48')](_0x92cc('0x33'))){_0x2f0b2c[_0x92cc('0x19')]=qs[_0x92cc('0x19')](_0x59819a[_0x92cc('0x2d')]['limit']);_0x2f0b2c[_0x92cc('0x18')]=qs[_0x92cc('0x18')](_0x59819a[_0x92cc('0x2d')][_0x92cc('0x18')]);}return _0x111402[_0x92cc('0x49')](_0x2f0b2c);}})[_0x92cc('0x21')](function(_0x5c5ea4){if(_0x5c5ea4){return _0x5c5ea4?{'count':_0x347580,'rows':_0x5c5ea4}:null;}})[_0x92cc('0x21')](respondWithResult(_0x206da9,null))[_0x92cc('0x3e')](handleError(_0x206da9,null));};exports['getDescriptions']=function(_0x51431b,_0x305d4b,_0x54763e){var _0x4c652e={};var _0x1ae082={};var _0x38c418;var _0x566eea;return db[_0x92cc('0x28')][_0x92cc('0x45')]({'where':{'id':_0x51431b[_0x92cc('0x40')]['id']}})['then'](handleEntityNotFound(_0x305d4b,null))[_0x92cc('0x21')](function(_0x57902f){if(_0x57902f){_0x38c418=_0x57902f;_0x1ae082[_0x92cc('0x2c')]=_[_0x92cc('0x41')](db[_0x92cc('0x46')][_0x92cc('0x29')]);_0x1ae082[_0x92cc('0x2d')]=_[_0x92cc('0x41')](_0x51431b[_0x92cc('0x2d')]);_0x1ae082[_0x92cc('0x2e')]=_['intersection'](_0x1ae082[_0x92cc('0x2c')],_0x1ae082[_0x92cc('0x2d')]);_0x4c652e[_0x92cc('0x30')]=_[_0x92cc('0x2f')](_0x1ae082[_0x92cc('0x2c')],qs[_0x92cc('0x31')](_0x51431b['query'][_0x92cc('0x31')]));_0x4c652e[_0x92cc('0x30')]=_0x4c652e[_0x92cc('0x30')]['length']?_0x4c652e['attributes']:_0x1ae082[_0x92cc('0x2c')];_0x4c652e[_0x92cc('0x34')]=qs[_0x92cc('0x47')](_0x51431b[_0x92cc('0x2d')]['sort']);_0x4c652e[_0x92cc('0x38')]=qs[_0x92cc('0x2e')](_['pick'](_0x51431b[_0x92cc('0x2d')],_0x1ae082[_0x92cc('0x2e')]));if(_0x51431b[_0x92cc('0x2d')][_0x92cc('0x36')]){_0x4c652e[_0x92cc('0x38')]=_[_0x92cc('0x37')](_0x4c652e['where'],{'$or':_[_0x92cc('0x27')](_0x4c652e[_0x92cc('0x30')],function(_0xbb73a7){var _0x920e46={};_0x920e46[_0xbb73a7]={'$like':'%'+_0x51431b[_0x92cc('0x2d')]['filter']+'%'};return _0x920e46;})});}_0x4c652e=_[_0x92cc('0x37')]({},_0x4c652e,_0x51431b[_0x92cc('0x4a')]);return _0x38c418[_0x92cc('0x4b')](_0x4c652e);}})['then'](function(_0x105f16){if(_0x105f16){_0x566eea=_0x105f16[_0x92cc('0x32')];if(!_0x51431b[_0x92cc('0x2d')][_0x92cc('0x48')]('nolimit')){_0x4c652e[_0x92cc('0x19')]=qs[_0x92cc('0x19')](_0x51431b[_0x92cc('0x2d')][_0x92cc('0x19')]);_0x4c652e[_0x92cc('0x18')]=qs[_0x92cc('0x18')](_0x51431b[_0x92cc('0x2d')][_0x92cc('0x18')]);}return _0x38c418['getDescriptions'](_0x4c652e);}})[_0x92cc('0x21')](function(_0xf64372){if(_0xf64372){return _0xf64372?{'count':_0x566eea,'rows':_0xf64372}:null;}})[_0x92cc('0x21')](respondWithResult(_0x305d4b,null))[_0x92cc('0x3e')](handleError(_0x305d4b,null));};exports[_0x92cc('0x4c')]=function(_0x368e60,_0x413e91,_0x10f702){var _0x546b89={};var _0x4669fc={};var _0x420742;var _0x496b82;return db[_0x92cc('0x28')][_0x92cc('0x45')]({'where':{'id':_0x368e60[_0x92cc('0x40')]['id']}})[_0x92cc('0x21')](handleEntityNotFound(_0x413e91,null))['then'](function(_0x3dd687){if(_0x3dd687){_0x420742=_0x3dd687;_0x4669fc[_0x92cc('0x2c')]=_[_0x92cc('0x41')](db[_0x92cc('0x4d')][_0x92cc('0x29')]);_0x4669fc[_0x92cc('0x2d')]=_[_0x92cc('0x41')](_0x368e60['query']);_0x4669fc['filters']=_[_0x92cc('0x2f')](_0x4669fc[_0x92cc('0x2c')],_0x4669fc[_0x92cc('0x2d')]);_0x546b89['attributes']=_[_0x92cc('0x2f')](_0x4669fc[_0x92cc('0x2c')],qs[_0x92cc('0x31')](_0x368e60[_0x92cc('0x2d')][_0x92cc('0x31')]));_0x546b89[_0x92cc('0x30')]=_0x546b89[_0x92cc('0x30')][_0x92cc('0x32')]?_0x546b89[_0x92cc('0x30')]:_0x4669fc[_0x92cc('0x2c')];_0x546b89[_0x92cc('0x34')]=qs['sort'](_0x368e60[_0x92cc('0x2d')][_0x92cc('0x47')]);_0x546b89[_0x92cc('0x38')]=qs['filters'](_['pick'](_0x368e60[_0x92cc('0x2d')],_0x4669fc[_0x92cc('0x2e')]));if(_0x368e60[_0x92cc('0x2d')][_0x92cc('0x36')]){_0x546b89[_0x92cc('0x38')]=_[_0x92cc('0x37')](_0x546b89[_0x92cc('0x38')],{'$or':_[_0x92cc('0x27')](_0x546b89[_0x92cc('0x30')],function(_0x22f1b8){var _0xd47942={};_0xd47942[_0x22f1b8]={'$like':'%'+_0x368e60['query'][_0x92cc('0x36')]+'%'};return _0xd47942;})});}_0x546b89=_[_0x92cc('0x37')]({},_0x546b89,_0x368e60[_0x92cc('0x4a')]);return _0x420742['getTags'](_0x546b89);}})[_0x92cc('0x21')](function(_0x471c90){if(_0x471c90){_0x496b82=_0x471c90[_0x92cc('0x32')];if(!_0x368e60[_0x92cc('0x2d')][_0x92cc('0x48')](_0x92cc('0x33'))){_0x546b89[_0x92cc('0x19')]=qs[_0x92cc('0x19')](_0x368e60[_0x92cc('0x2d')][_0x92cc('0x19')]);_0x546b89[_0x92cc('0x18')]=qs['offset'](_0x368e60[_0x92cc('0x2d')][_0x92cc('0x18')]);}return _0x420742[_0x92cc('0x4c')](_0x546b89);}})[_0x92cc('0x21')](function(_0x42e4fb){if(_0x42e4fb){return _0x42e4fb?{'count':_0x496b82,'rows':_0x42e4fb}:null;}})['then'](respondWithResult(_0x413e91,null))['catch'](handleError(_0x413e91,null));};exports[_0x92cc('0x4e')]=function(_0x48d64a,_0xfc06b5,_0x55009c){if(_0x48d64a[_0x92cc('0x4f')]['id']){delete _0x48d64a[_0x92cc('0x4f')]['id'];}return db[_0x92cc('0x28')]['findOne']({'where':{'id':_0x48d64a[_0x92cc('0x40')]['id']}})[_0x92cc('0x21')](handleEntityNotFound(_0xfc06b5,null))['then'](function(_0x274564){if(_0x274564){return _0x274564[_0x92cc('0x4e')](_0x48d64a[_0x92cc('0x4f')][_0x92cc('0x50')]||[]);}return null;})[_0x92cc('0x21')](respondWithResult(_0xfc06b5,null))[_0x92cc('0x3e')](handleError(_0xfc06b5,null));}; \ No newline at end of file +var _0xa562=['Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','include','options','find','create','body','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set'];(function(_0x2b6e32,_0x44356e){var _0x59959f=function(_0x1d96e4){while(--_0x1d96e4){_0x2b6e32['push'](_0x2b6e32['shift']());}};_0x59959f(++_0x44356e);}(_0xa562,0x8a));var _0x2a56=function(_0x4fe19c,_0x45d0fe){_0x4fe19c=_0x4fe19c-0x0;var _0x952ac7=_0xa562[_0x4fe19c];return _0x952ac7;};'use strict';var emlformat=require(_0x2a56('0x0'));var rimraf=require(_0x2a56('0x1'));var zipdir=require(_0x2a56('0x2'));var jsonpatch=require(_0x2a56('0x3'));var rp=require(_0x2a56('0x4'));var moment=require(_0x2a56('0x5'));var BPromise=require(_0x2a56('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2a56('0x7'));var csv=require(_0x2a56('0x8'));var ejs=require(_0x2a56('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2a56('0xa'));var crypto=require('crypto');var jsforce=require(_0x2a56('0xb'));var deskjs=require(_0x2a56('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2a56('0xd'));var Redis=require(_0x2a56('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2a56('0xf'));var as=require(_0x2a56('0x10'));var hardwareService=require(_0x2a56('0x11'));var logger=require(_0x2a56('0x12'))(_0x2a56('0x13'));var utils=require(_0x2a56('0x14'));var config=require(_0x2a56('0x15'));var licenseUtil=require(_0x2a56('0x16'));var db=require(_0x2a56('0x17'))['db'];function respondWithStatusCode(_0x35091c,_0x551823){_0x551823=_0x551823||0xcc;return function(_0xacce95){if(_0xacce95){return _0x35091c[_0x2a56('0x18')](_0x551823);}return _0x35091c[_0x2a56('0x19')](_0x551823)[_0x2a56('0x1a')]();};}function respondWithResult(_0x13c88e,_0x52c061){_0x52c061=_0x52c061||0xc8;return function(_0x144881){if(_0x144881){return _0x13c88e[_0x2a56('0x19')](_0x52c061)['json'](_0x144881);}};}function respondWithFilteredResult(_0x50ce80,_0x166ca3){return function(_0x313908){if(_0x313908){var _0x51b1fc=typeof _0x166ca3[_0x2a56('0x1b')]===_0x2a56('0x1c')&&typeof _0x166ca3[_0x2a56('0x1d')]==='undefined';var _0x54c36b=_0x313908[_0x2a56('0x1e')];var _0x38ea42=_0x51b1fc?0x0:_0x166ca3['offset'];var _0x3df5f2=_0x51b1fc?_0x313908[_0x2a56('0x1e')]:_0x166ca3[_0x2a56('0x1b')]+_0x166ca3[_0x2a56('0x1d')];var _0x1e9bf8;if(_0x3df5f2>=_0x54c36b){_0x3df5f2=_0x54c36b;_0x1e9bf8=0xc8;}else{_0x1e9bf8=0xce;}_0x50ce80[_0x2a56('0x19')](_0x1e9bf8);return _0x50ce80[_0x2a56('0x1f')](_0x2a56('0x20'),_0x38ea42+'-'+_0x3df5f2+'/'+_0x54c36b)[_0x2a56('0x21')](_0x313908);}return null;};}function patchUpdates(_0x295e6b){return function(_0x47cd09){try{jsonpatch[_0x2a56('0x22')](_0x47cd09,_0x295e6b,!![]);}catch(_0x1c51c6){return BPromise['reject'](_0x1c51c6);}return _0x47cd09[_0x2a56('0x23')]();};}function saveUpdates(_0x351afd,_0x561845){return function(_0x1ed9bc){if(_0x1ed9bc){return _0x1ed9bc[_0x2a56('0x24')](_0x351afd)[_0x2a56('0x25')](function(_0x1e024f){return _0x1e024f;});}return null;};}function removeEntity(_0x56ae2d,_0x2f8ce7){return function(_0x4949b4){if(_0x4949b4){return _0x4949b4[_0x2a56('0x26')]()[_0x2a56('0x25')](function(){_0x56ae2d[_0x2a56('0x19')](0xcc)[_0x2a56('0x1a')]();});}};}function handleEntityNotFound(_0x2d1828,_0x584da2){return function(_0x4d254b){if(!_0x4d254b){_0x2d1828[_0x2a56('0x18')](0x194);}return _0x4d254b;};}function handleError(_0x1bdbdb,_0x164b1c){_0x164b1c=_0x164b1c||0x1f4;return function(_0x2be2b3){logger[_0x2a56('0x27')](_0x2be2b3[_0x2a56('0x28')]);if(_0x2be2b3[_0x2a56('0x29')]){delete _0x2be2b3[_0x2a56('0x29')];}_0x1bdbdb[_0x2a56('0x19')](_0x164b1c)[_0x2a56('0x2a')](_0x2be2b3);};}exports[_0x2a56('0x2b')]=function(_0x14b953,_0x9cf0a4){var _0x190a68={},_0x331cc9={},_0x5f288d={'count':0x0,'rows':[]};var _0x3f0ebc=_[_0x2a56('0x2c')](db[_0x2a56('0x2d')][_0x2a56('0x2e')],function(_0x406fab){return{'name':_0x406fab[_0x2a56('0x2f')],'type':_0x406fab[_0x2a56('0x30')][_0x2a56('0x31')]};});_0x331cc9[_0x2a56('0x32')]=_[_0x2a56('0x2c')](_0x3f0ebc,_0x2a56('0x29'));_0x331cc9[_0x2a56('0x33')]=_[_0x2a56('0x34')](_0x14b953[_0x2a56('0x33')]);_0x331cc9[_0x2a56('0x35')]=_[_0x2a56('0x36')](_0x331cc9[_0x2a56('0x32')],_0x331cc9[_0x2a56('0x33')]);_0x190a68[_0x2a56('0x37')]=_[_0x2a56('0x36')](_0x331cc9[_0x2a56('0x32')],qs[_0x2a56('0x38')](_0x14b953[_0x2a56('0x33')][_0x2a56('0x38')]));_0x190a68['attributes']=_0x190a68[_0x2a56('0x37')][_0x2a56('0x39')]?_0x190a68[_0x2a56('0x37')]:_0x331cc9[_0x2a56('0x32')];if(!_0x14b953['query'][_0x2a56('0x3a')](_0x2a56('0x3b'))){_0x190a68[_0x2a56('0x1d')]=qs[_0x2a56('0x1d')](_0x14b953[_0x2a56('0x33')]['limit']);_0x190a68['offset']=qs[_0x2a56('0x1b')](_0x14b953[_0x2a56('0x33')][_0x2a56('0x1b')]);}_0x190a68[_0x2a56('0x3c')]=qs[_0x2a56('0x3d')](_0x14b953[_0x2a56('0x33')][_0x2a56('0x3d')]);_0x190a68[_0x2a56('0x3e')]=qs[_0x2a56('0x35')](_[_0x2a56('0x3f')](_0x14b953[_0x2a56('0x33')],_0x331cc9['filters']),_0x3f0ebc);if(_0x14b953[_0x2a56('0x33')][_0x2a56('0x40')]){_0x190a68[_0x2a56('0x3e')]=_[_0x2a56('0x41')](_0x190a68[_0x2a56('0x3e')],{'$or':_[_0x2a56('0x2c')](_0x3f0ebc,function(_0x43c865){if(_0x43c865[_0x2a56('0x30')]!==_0x2a56('0x42')){var _0x2163a0={};_0x2163a0[_0x43c865[_0x2a56('0x29')]]={'$like':'%'+_0x14b953[_0x2a56('0x33')]['filter']+'%'};return _0x2163a0;}})});}_0x190a68=_[_0x2a56('0x41')]({},_0x190a68,_0x14b953['options']);var _0x3d5b0f={'where':_0x190a68[_0x2a56('0x3e')]};return db[_0x2a56('0x2d')][_0x2a56('0x1e')](_0x3d5b0f)[_0x2a56('0x25')](function(_0x98b412){_0x5f288d[_0x2a56('0x1e')]=_0x98b412;if(_0x14b953[_0x2a56('0x33')][_0x2a56('0x43')]){_0x190a68['include']=[{'all':!![]}];}return db[_0x2a56('0x2d')]['findAll'](_0x190a68);})['then'](function(_0x11686b){_0x5f288d[_0x2a56('0x44')]=_0x11686b;return _0x5f288d;})[_0x2a56('0x25')](respondWithFilteredResult(_0x9cf0a4,_0x190a68))[_0x2a56('0x45')](handleError(_0x9cf0a4,null));};exports[_0x2a56('0x46')]=function(_0x3daa38,_0x40253d){var _0x15e67f={'raw':![],'where':{'id':_0x3daa38[_0x2a56('0x47')]['id']}},_0x52266e={};_0x52266e[_0x2a56('0x32')]=_[_0x2a56('0x34')](db[_0x2a56('0x2d')][_0x2a56('0x2e')]);_0x52266e[_0x2a56('0x33')]=_['keys'](_0x3daa38[_0x2a56('0x33')]);_0x52266e['filters']=_['intersection'](_0x52266e[_0x2a56('0x32')],_0x52266e[_0x2a56('0x33')]);_0x15e67f[_0x2a56('0x37')]=_[_0x2a56('0x36')](_0x52266e[_0x2a56('0x32')],qs['fields'](_0x3daa38[_0x2a56('0x33')][_0x2a56('0x38')]));_0x15e67f[_0x2a56('0x37')]=_0x15e67f['attributes']['length']?_0x15e67f[_0x2a56('0x37')]:_0x52266e['model'];if(_0x3daa38[_0x2a56('0x33')][_0x2a56('0x43')]){_0x15e67f[_0x2a56('0x48')]=[{'all':!![]}];}_0x15e67f=_[_0x2a56('0x41')]({},_0x15e67f,_0x3daa38[_0x2a56('0x49')]);return db[_0x2a56('0x2d')][_0x2a56('0x4a')](_0x15e67f)[_0x2a56('0x25')](handleEntityNotFound(_0x40253d,null))['then'](respondWithResult(_0x40253d,null))[_0x2a56('0x45')](handleError(_0x40253d,null));};exports[_0x2a56('0x4b')]=function(_0x2fd683,_0x5a0c10){return db[_0x2a56('0x2d')][_0x2a56('0x4b')](_0x2fd683[_0x2a56('0x4c')],{})['then'](respondWithResult(_0x5a0c10,0xc9))[_0x2a56('0x45')](handleError(_0x5a0c10,null));};exports[_0x2a56('0x24')]=function(_0x200b35,_0x4403d3){if(_0x200b35[_0x2a56('0x4c')]['id']){delete _0x200b35[_0x2a56('0x4c')]['id'];}return db['DeskConfiguration'][_0x2a56('0x4a')]({'where':{'id':_0x200b35['params']['id']}})['then'](handleEntityNotFound(_0x4403d3,null))[_0x2a56('0x25')](saveUpdates(_0x200b35['body'],null))[_0x2a56('0x25')](respondWithResult(_0x4403d3,null))[_0x2a56('0x45')](handleError(_0x4403d3,null));};exports[_0x2a56('0x26')]=function(_0x3b22e5,_0xb6b07d){return db[_0x2a56('0x2d')][_0x2a56('0x4a')]({'where':{'id':_0x3b22e5['params']['id']}})[_0x2a56('0x25')](handleEntityNotFound(_0xb6b07d,null))[_0x2a56('0x25')](removeEntity(_0xb6b07d,null))[_0x2a56('0x45')](handleError(_0xb6b07d,null));};exports[_0x2a56('0x4d')]=function(_0x2ae523,_0xa706cc,_0x4f18bd){var _0x576c35={};var _0x3031dc={};var _0x160a25;var _0x281a6a;return db[_0x2a56('0x2d')][_0x2a56('0x4e')]({'where':{'id':_0x2ae523['params']['id']}})[_0x2a56('0x25')](handleEntityNotFound(_0xa706cc,null))[_0x2a56('0x25')](function(_0x6b9bd8){if(_0x6b9bd8){_0x160a25=_0x6b9bd8;_0x3031dc[_0x2a56('0x32')]=_[_0x2a56('0x34')](db[_0x2a56('0x4f')][_0x2a56('0x2e')]);_0x3031dc['query']=_[_0x2a56('0x34')](_0x2ae523[_0x2a56('0x33')]);_0x3031dc[_0x2a56('0x35')]=_['intersection'](_0x3031dc['model'],_0x3031dc['query']);_0x576c35[_0x2a56('0x37')]=_[_0x2a56('0x36')](_0x3031dc[_0x2a56('0x32')],qs[_0x2a56('0x38')](_0x2ae523[_0x2a56('0x33')][_0x2a56('0x38')]));_0x576c35[_0x2a56('0x37')]=_0x576c35[_0x2a56('0x37')][_0x2a56('0x39')]?_0x576c35[_0x2a56('0x37')]:_0x3031dc[_0x2a56('0x32')];_0x576c35[_0x2a56('0x3c')]=qs['sort'](_0x2ae523['query'][_0x2a56('0x3d')]);_0x576c35[_0x2a56('0x3e')]=qs[_0x2a56('0x35')](_['pick'](_0x2ae523[_0x2a56('0x33')],_0x3031dc[_0x2a56('0x35')]));if(_0x2ae523[_0x2a56('0x33')][_0x2a56('0x40')]){_0x576c35[_0x2a56('0x3e')]=_[_0x2a56('0x41')](_0x576c35['where'],{'$or':_[_0x2a56('0x2c')](_0x576c35[_0x2a56('0x37')],function(_0x3ce56d){var _0x4a9c7d={};_0x4a9c7d[_0x3ce56d]={'$like':'%'+_0x2ae523['query'][_0x2a56('0x40')]+'%'};return _0x4a9c7d;})});}_0x576c35=_['merge']({},_0x576c35,_0x2ae523[_0x2a56('0x49')]);return _0x160a25[_0x2a56('0x4d')](_0x576c35);}})[_0x2a56('0x25')](function(_0x172e6d){if(_0x172e6d){_0x281a6a=_0x172e6d['length'];if(!_0x2ae523[_0x2a56('0x33')][_0x2a56('0x3a')]('nolimit')){_0x576c35[_0x2a56('0x1d')]=qs[_0x2a56('0x1d')](_0x2ae523['query']['limit']);_0x576c35[_0x2a56('0x1b')]=qs['offset'](_0x2ae523[_0x2a56('0x33')][_0x2a56('0x1b')]);}return _0x160a25[_0x2a56('0x4d')](_0x576c35);}})[_0x2a56('0x25')](function(_0x5ca60f){if(_0x5ca60f){return _0x5ca60f?{'count':_0x281a6a,'rows':_0x5ca60f}:null;}})[_0x2a56('0x25')](respondWithResult(_0xa706cc,null))[_0x2a56('0x45')](handleError(_0xa706cc,null));};exports[_0x2a56('0x50')]=function(_0x258bcf,_0xc8f000,_0x23b2c2){var _0x2b01d0={};var _0x33be63={};var _0x4bf2cf;var _0x4d724b;return db['DeskConfiguration']['findOne']({'where':{'id':_0x258bcf['params']['id']}})[_0x2a56('0x25')](handleEntityNotFound(_0xc8f000,null))['then'](function(_0x5d19dc){if(_0x5d19dc){_0x4bf2cf=_0x5d19dc;_0x33be63[_0x2a56('0x32')]=_[_0x2a56('0x34')](db[_0x2a56('0x4f')][_0x2a56('0x2e')]);_0x33be63[_0x2a56('0x33')]=_[_0x2a56('0x34')](_0x258bcf[_0x2a56('0x33')]);_0x33be63[_0x2a56('0x35')]=_[_0x2a56('0x36')](_0x33be63[_0x2a56('0x32')],_0x33be63[_0x2a56('0x33')]);_0x2b01d0[_0x2a56('0x37')]=_[_0x2a56('0x36')](_0x33be63[_0x2a56('0x32')],qs[_0x2a56('0x38')](_0x258bcf[_0x2a56('0x33')][_0x2a56('0x38')]));_0x2b01d0[_0x2a56('0x37')]=_0x2b01d0[_0x2a56('0x37')][_0x2a56('0x39')]?_0x2b01d0[_0x2a56('0x37')]:_0x33be63[_0x2a56('0x32')];_0x2b01d0['order']=qs['sort'](_0x258bcf[_0x2a56('0x33')][_0x2a56('0x3d')]);_0x2b01d0[_0x2a56('0x3e')]=qs[_0x2a56('0x35')](_[_0x2a56('0x3f')](_0x258bcf['query'],_0x33be63[_0x2a56('0x35')]));if(_0x258bcf[_0x2a56('0x33')][_0x2a56('0x40')]){_0x2b01d0['where']=_[_0x2a56('0x41')](_0x2b01d0[_0x2a56('0x3e')],{'$or':_[_0x2a56('0x2c')](_0x2b01d0[_0x2a56('0x37')],function(_0x5007ca){var _0x249cf5={};_0x249cf5[_0x5007ca]={'$like':'%'+_0x258bcf[_0x2a56('0x33')]['filter']+'%'};return _0x249cf5;})});}_0x2b01d0=_['merge']({},_0x2b01d0,_0x258bcf['options']);return _0x4bf2cf[_0x2a56('0x50')](_0x2b01d0);}})['then'](function(_0x47bb8e){if(_0x47bb8e){_0x4d724b=_0x47bb8e[_0x2a56('0x39')];if(!_0x258bcf['query'][_0x2a56('0x3a')](_0x2a56('0x3b'))){_0x2b01d0[_0x2a56('0x1d')]=qs['limit'](_0x258bcf[_0x2a56('0x33')][_0x2a56('0x1d')]);_0x2b01d0[_0x2a56('0x1b')]=qs[_0x2a56('0x1b')](_0x258bcf[_0x2a56('0x33')][_0x2a56('0x1b')]);}return _0x4bf2cf[_0x2a56('0x50')](_0x2b01d0);}})[_0x2a56('0x25')](function(_0x5a6c8e){if(_0x5a6c8e){return _0x5a6c8e?{'count':_0x4d724b,'rows':_0x5a6c8e}:null;}})[_0x2a56('0x25')](respondWithResult(_0xc8f000,null))[_0x2a56('0x45')](handleError(_0xc8f000,null));};exports[_0x2a56('0x51')]=function(_0x252180,_0x25d9b5,_0x365ae1){var _0x222df6={};var _0x223589={};var _0x43b685;var _0x38cd62;return db[_0x2a56('0x2d')][_0x2a56('0x4e')]({'where':{'id':_0x252180[_0x2a56('0x47')]['id']}})[_0x2a56('0x25')](handleEntityNotFound(_0x25d9b5,null))[_0x2a56('0x25')](function(_0x35e745){if(_0x35e745){_0x43b685=_0x35e745;_0x223589['model']=_[_0x2a56('0x34')](db[_0x2a56('0x4f')][_0x2a56('0x2e')]);_0x223589[_0x2a56('0x33')]=_['keys'](_0x252180[_0x2a56('0x33')]);_0x223589[_0x2a56('0x35')]=_[_0x2a56('0x36')](_0x223589['model'],_0x223589[_0x2a56('0x33')]);_0x222df6[_0x2a56('0x37')]=_[_0x2a56('0x36')](_0x223589[_0x2a56('0x32')],qs[_0x2a56('0x38')](_0x252180['query'][_0x2a56('0x38')]));_0x222df6[_0x2a56('0x37')]=_0x222df6['attributes']['length']?_0x222df6[_0x2a56('0x37')]:_0x223589['model'];_0x222df6[_0x2a56('0x3c')]=qs[_0x2a56('0x3d')](_0x252180[_0x2a56('0x33')][_0x2a56('0x3d')]);_0x222df6[_0x2a56('0x3e')]=qs[_0x2a56('0x35')](_['pick'](_0x252180[_0x2a56('0x33')],_0x223589[_0x2a56('0x35')]));if(_0x252180[_0x2a56('0x33')]['filter']){_0x222df6[_0x2a56('0x3e')]=_[_0x2a56('0x41')](_0x222df6[_0x2a56('0x3e')],{'$or':_['map'](_0x222df6[_0x2a56('0x37')],function(_0x46c37a){var _0x3cac6e={};_0x3cac6e[_0x46c37a]={'$like':'%'+_0x252180[_0x2a56('0x33')]['filter']+'%'};return _0x3cac6e;})});}_0x222df6=_['merge']({},_0x222df6,_0x252180[_0x2a56('0x49')]);return _0x43b685[_0x2a56('0x51')](_0x222df6);}})[_0x2a56('0x25')](function(_0x31ae41){if(_0x31ae41){_0x38cd62=_0x31ae41['length'];if(!_0x252180[_0x2a56('0x33')][_0x2a56('0x3a')](_0x2a56('0x3b'))){_0x222df6[_0x2a56('0x1d')]=qs[_0x2a56('0x1d')](_0x252180[_0x2a56('0x33')][_0x2a56('0x1d')]);_0x222df6[_0x2a56('0x1b')]=qs[_0x2a56('0x1b')](_0x252180[_0x2a56('0x33')]['offset']);}return _0x43b685[_0x2a56('0x51')](_0x222df6);}})[_0x2a56('0x25')](function(_0x284b4c){if(_0x284b4c){return _0x284b4c?{'count':_0x38cd62,'rows':_0x284b4c}:null;}})[_0x2a56('0x25')](respondWithResult(_0x25d9b5,null))[_0x2a56('0x45')](handleError(_0x25d9b5,null));};exports[_0x2a56('0x52')]=function(_0x449256,_0x5bad66,_0x54ccd2){var _0x729122={};var _0x38bdd6={};var _0x48ec0d;var _0x9a952e;return db[_0x2a56('0x2d')][_0x2a56('0x4e')]({'where':{'id':_0x449256[_0x2a56('0x47')]['id']}})[_0x2a56('0x25')](handleEntityNotFound(_0x5bad66,null))['then'](function(_0x2e1689){if(_0x2e1689){_0x48ec0d=_0x2e1689;_0x38bdd6[_0x2a56('0x32')]=_['keys'](db[_0x2a56('0x53')][_0x2a56('0x2e')]);_0x38bdd6['query']=_['keys'](_0x449256['query']);_0x38bdd6[_0x2a56('0x35')]=_[_0x2a56('0x36')](_0x38bdd6['model'],_0x38bdd6[_0x2a56('0x33')]);_0x729122['attributes']=_[_0x2a56('0x36')](_0x38bdd6[_0x2a56('0x32')],qs[_0x2a56('0x38')](_0x449256[_0x2a56('0x33')][_0x2a56('0x38')]));_0x729122[_0x2a56('0x37')]=_0x729122[_0x2a56('0x37')][_0x2a56('0x39')]?_0x729122[_0x2a56('0x37')]:_0x38bdd6['model'];_0x729122['order']=qs[_0x2a56('0x3d')](_0x449256['query'][_0x2a56('0x3d')]);_0x729122['where']=qs[_0x2a56('0x35')](_[_0x2a56('0x3f')](_0x449256['query'],_0x38bdd6[_0x2a56('0x35')]));if(_0x449256[_0x2a56('0x33')]['filter']){_0x729122[_0x2a56('0x3e')]=_[_0x2a56('0x41')](_0x729122[_0x2a56('0x3e')],{'$or':_[_0x2a56('0x2c')](_0x729122['attributes'],function(_0x17939a){var _0x2a6f05={};_0x2a6f05[_0x17939a]={'$like':'%'+_0x449256[_0x2a56('0x33')][_0x2a56('0x40')]+'%'};return _0x2a6f05;})});}_0x729122=_['merge']({},_0x729122,_0x449256[_0x2a56('0x49')]);return _0x48ec0d[_0x2a56('0x52')](_0x729122);}})['then'](function(_0x59fd78){if(_0x59fd78){_0x9a952e=_0x59fd78[_0x2a56('0x39')];if(!_0x449256[_0x2a56('0x33')][_0x2a56('0x3a')](_0x2a56('0x3b'))){_0x729122[_0x2a56('0x1d')]=qs[_0x2a56('0x1d')](_0x449256['query']['limit']);_0x729122[_0x2a56('0x1b')]=qs[_0x2a56('0x1b')](_0x449256[_0x2a56('0x33')]['offset']);}return _0x48ec0d[_0x2a56('0x52')](_0x729122);}})[_0x2a56('0x25')](function(_0x3af5d3){if(_0x3af5d3){return _0x3af5d3?{'count':_0x9a952e,'rows':_0x3af5d3}:null;}})[_0x2a56('0x25')](respondWithResult(_0x5bad66,null))[_0x2a56('0x45')](handleError(_0x5bad66,null));};exports[_0x2a56('0x54')]=function(_0xed9911,_0x3fd87e,_0x5140bd){if(_0xed9911[_0x2a56('0x4c')]['id']){delete _0xed9911['body']['id'];}return db[_0x2a56('0x2d')]['findOne']({'where':{'id':_0xed9911[_0x2a56('0x47')]['id']}})[_0x2a56('0x25')](handleEntityNotFound(_0x3fd87e,null))[_0x2a56('0x25')](function(_0x3fc81a){if(_0x3fc81a){return _0x3fc81a['setTags'](_0xed9911[_0x2a56('0x4c')]['ids']||[]);}return null;})['then'](respondWithResult(_0x3fd87e,null))[_0x2a56('0x45')](handleError(_0x3fd87e,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index a718ab6..49926ce 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 _0xadc9=['path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xf11596,_0x18bfb1){var _0x3459cf=function(_0x4f893b){while(--_0x4f893b){_0xf11596['push'](_0xf11596['shift']());}};_0x3459cf(++_0x18bfb1);}(_0xadc9,0x94));var _0x9adc=function(_0x5af8af,_0x6df2cd){_0x5af8af=_0x5af8af-0x0;var _0x59da8f=_0xadc9[_0x5af8af];return _0x59da8f;};'use strict';var _=require(_0x9adc('0x0'));var util=require(_0x9adc('0x1'));var logger=require(_0x9adc('0x2'))(_0x9adc('0x3'));var moment=require(_0x9adc('0x4'));var BPromise=require(_0x9adc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9adc('0x6'));var rimraf=require(_0x9adc('0x7'));var config=require(_0x9adc('0x8'));var attributes=require(_0x9adc('0x9'));module[_0x9adc('0xa')]=function(_0x2f7f9d,_0x2aa6d1){return _0x2f7f9d[_0x9adc('0xb')](_0x9adc('0xc'),attributes,{'tableName':_0x9adc('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7cf=['./intDeskConfiguration.attributes','define','DeskConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x7740d,_0x552612){var _0x185bad=function(_0x4bdfaa){while(--_0x4bdfaa){_0x7740d['push'](_0x7740d['shift']());}};_0x185bad(++_0x552612);}(_0xc7cf,0x148));var _0xfc7c=function(_0x148879,_0x5b4c11){_0x148879=_0x148879-0x0;var _0x4f7027=_0xc7cf[_0x148879];return _0x4f7027;};'use strict';var _=require(_0xfc7c('0x0'));var util=require(_0xfc7c('0x1'));var logger=require(_0xfc7c('0x2'))(_0xfc7c('0x3'));var moment=require(_0xfc7c('0x4'));var BPromise=require(_0xfc7c('0x5'));var rp=require(_0xfc7c('0x6'));var fs=require('fs');var path=require(_0xfc7c('0x7'));var rimraf=require(_0xfc7c('0x8'));var config=require(_0xfc7c('0x9'));var attributes=require(_0xfc7c('0xa'));module['exports']=function(_0x1a64c8,_0x57d121){return _0x1a64c8[_0xfc7c('0xb')](_0xfc7c('0xc'),attributes,{'tableName':'int_desk_configurations','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 af297d4..e4a021a 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 _0xe820=['message','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0xe820,0xd2));var _0x0e82=function(_0x28359e,_0x4a7c19){_0x28359e=_0x28359e-0x0;var _0x108990=_0xe820[_0x28359e];return _0x108990;};'use strict';var _=require(_0x0e82('0x0'));var util=require('util');var moment=require(_0x0e82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0e82('0x2'));var db=require(_0x0e82('0x3'))['db'];var utils=require(_0x0e82('0x4'));var logger=require('../../config/logger')(_0x0e82('0x5'));var config=require('../../config/environment');var jayson=require(_0x0e82('0x6'));var client=jayson[_0x0e82('0x7')][_0x0e82('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x328b32,_0x2a0f9b,_0x55f277){return new BPromise(function(_0x10013b,_0x33c8a2){return client[_0x0e82('0x9')](_0x328b32,_0x55f277)[_0x0e82('0xa')](function(_0x3b7792){logger['info'](_0x0e82('0xb'),_0x2a0f9b,_0x0e82('0xc'));logger[_0x0e82('0xd')](_0x0e82('0xe'),_0x2a0f9b,_0x0e82('0xc'),JSON[_0x0e82('0xf')](_0x3b7792));if(_0x3b7792[_0x0e82('0x10')]){if(_0x3b7792['error'][_0x0e82('0x11')]===0x1f4){logger[_0x0e82('0x10')](_0x0e82('0xb'),_0x2a0f9b,_0x3b7792[_0x0e82('0x10')][_0x0e82('0x12')]);return _0x33c8a2(_0x3b7792[_0x0e82('0x10')]['message']);}logger[_0x0e82('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x2a0f9b,_0x3b7792['error'][_0x0e82('0x12')]);return _0x10013b(_0x3b7792['error']['message']);}else{logger['info'](_0x0e82('0xb'),_0x2a0f9b,'request\x20sent');_0x10013b(_0x3b7792['result'][_0x0e82('0x12')]);}})['catch'](function(_0x319303){logger[_0x0e82('0x10')](_0x0e82('0xb'),_0x2a0f9b,_0x319303);_0x33c8a2(_0x319303);});});} \ No newline at end of file +var _0xa866=['jayson/promise','client','request','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','DeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x491a74,_0x47acde){var _0xfc2d2e=function(_0x290257){while(--_0x290257){_0x491a74['push'](_0x491a74['shift']());}};_0xfc2d2e(++_0x47acde);}(_0xa866,0x6a));var _0x6a86=function(_0x3f167d,_0x4eb6b0){_0x3f167d=_0x3f167d-0x0;var _0x57981f=_0xa866[_0x3f167d];return _0x57981f;};'use strict';var _=require(_0x6a86('0x0'));var util=require(_0x6a86('0x1'));var moment=require(_0x6a86('0x2'));var BPromise=require(_0x6a86('0x3'));var rs=require(_0x6a86('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a86('0x5'))['db'];var utils=require(_0x6a86('0x6'));var logger=require(_0x6a86('0x7'))('rpc');var config=require(_0x6a86('0x8'));var jayson=require(_0x6a86('0x9'));var client=jayson[_0x6a86('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x183997,_0x288910,_0x3ed589){return new BPromise(function(_0x1330e1,_0x37e3ee){return client[_0x6a86('0xb')](_0x183997,_0x3ed589)[_0x6a86('0xc')](function(_0x4a83c9){logger[_0x6a86('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x288910,_0x6a86('0xe'));logger[_0x6a86('0xf')](_0x6a86('0x10'),_0x288910,'request\x20sent',JSON[_0x6a86('0x11')](_0x4a83c9));if(_0x4a83c9[_0x6a86('0x12')]){if(_0x4a83c9['error']['code']===0x1f4){logger[_0x6a86('0x12')](_0x6a86('0x13'),_0x288910,_0x4a83c9[_0x6a86('0x12')][_0x6a86('0x14')]);return _0x37e3ee(_0x4a83c9[_0x6a86('0x12')][_0x6a86('0x14')]);}logger[_0x6a86('0x12')](_0x6a86('0x13'),_0x288910,_0x4a83c9['error'][_0x6a86('0x14')]);return _0x1330e1(_0x4a83c9[_0x6a86('0x12')]['message']);}else{logger[_0x6a86('0xd')](_0x6a86('0x13'),_0x288910,_0x6a86('0xe'));_0x1330e1(_0x4a83c9[_0x6a86('0x15')][_0x6a86('0x14')]);}})[_0x6a86('0x16')](function(_0x500b59){logger[_0x6a86('0x12')](_0x6a86('0x13'),_0x288910,_0x500b59);_0x37e3ee(_0x500b59);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 5952a7b..e30543b 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 _0x74e6=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','get','/:id','put','update','delete','destroy','exports','multer'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x74e6,0xed));var _0x674e=function(_0x783414,_0x312c77){_0x783414=_0x783414-0x0;var _0x294b0f=_0x74e6[_0x783414];return _0x294b0f;};'use strict';var multer=require(_0x674e('0x0'));var util=require(_0x674e('0x1'));var path=require(_0x674e('0x2'));var timeout=require(_0x674e('0x3'));var express=require('express');var router=express[_0x674e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x674e('0x5'));var interaction=require(_0x674e('0x6'));var config=require(_0x674e('0x7'));var controller=require(_0x674e('0x8'));router['get']('/',auth[_0x674e('0x9')](),controller['index']);router[_0x674e('0xa')](_0x674e('0xb'),auth[_0x674e('0x9')](),controller['show']);router['post']('/',auth[_0x674e('0x9')](),controller['create']);router[_0x674e('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x674e('0xd')]);router[_0x674e('0xe')](_0x674e('0xb'),auth[_0x674e('0x9')](),controller[_0x674e('0xf')]);module[_0x674e('0x10')]=router; \ No newline at end of file +var _0x1505=['../../config/environment','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x37a6a9,_0x54c390){var _0x32fbe9=function(_0x278244){while(--_0x278244){_0x37a6a9['push'](_0x37a6a9['shift']());}};_0x32fbe9(++_0x54c390);}(_0x1505,0x1cb));var _0x5150=function(_0x18e603,_0x4da640){_0x18e603=_0x18e603-0x0;var _0x2574cc=_0x1505[_0x18e603];return _0x2574cc;};'use strict';var multer=require(_0x5150('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5150('0x1'));var express=require('express');var router=express[_0x5150('0x2')]();var fs_extra=require(_0x5150('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5150('0x4'));var config=require(_0x5150('0x5'));var controller=require('./intDeskField.controller');router[_0x5150('0x6')]('/',auth[_0x5150('0x7')](),controller['index']);router[_0x5150('0x6')](_0x5150('0x8'),auth[_0x5150('0x7')](),controller[_0x5150('0x9')]);router['post']('/',auth[_0x5150('0x7')](),controller[_0x5150('0xa')]);router[_0x5150('0xb')](_0x5150('0x8'),auth[_0x5150('0x7')](),controller[_0x5150('0xc')]);router[_0x5150('0xd')](_0x5150('0x8'),auth[_0x5150('0x7')](),controller[_0x5150('0xe')]);module[_0x5150('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index e5a4853..021d4fc 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 _0xe318=['variable','keyValue','picklist','STRING','sequelize','ENUM','string'];(function(_0xf031c7,_0x2feb97){var _0x63320b=function(_0xb3bd54){while(--_0xb3bd54){_0xf031c7['push'](_0xf031c7['shift']());}};_0x63320b(++_0x2feb97);}(_0xe318,0x97));var _0x8e31=function(_0x5aa1dc,_0x34b45){_0x5aa1dc=_0x5aa1dc-0x0;var _0x59ec02=_0xe318[_0x5aa1dc];return _0x59ec02;};'use strict';var Sequelize=require(_0x8e31('0x0'));module['exports']={'type':{'type':Sequelize[_0x8e31('0x1')](_0x8e31('0x2'),_0x8e31('0x3'),'customVariable',_0x8e31('0x4'),_0x8e31('0x5')),'defaultValue':_0x8e31('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8e31('0x6')]},'keyType':{'type':Sequelize[_0x8e31('0x1')](_0x8e31('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x8e31('0x6')]},'idField':{'type':Sequelize[_0x8e31('0x6')]},'nameField':{'type':Sequelize[_0x8e31('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8e31('0x6')]}}; \ No newline at end of file +var _0x76ec=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','exports'];(function(_0x1a234f,_0x1d2ff1){var _0x49f492=function(_0x290909){while(--_0x290909){_0x1a234f['push'](_0x1a234f['shift']());}};_0x49f492(++_0x1d2ff1);}(_0x76ec,0x9f));var _0xc76e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x76ec[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0xc76e('0x0')]={'type':{'type':Sequelize[_0xc76e('0x1')](_0xc76e('0x2'),_0xc76e('0x3'),_0xc76e('0x4'),_0xc76e('0x5'),_0xc76e('0x6')),'defaultValue':_0xc76e('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc76e('0x7')]},'keyType':{'type':Sequelize[_0xc76e('0x1')](_0xc76e('0x2'),_0xc76e('0x3'),_0xc76e('0x4'))},'keyContent':{'type':Sequelize[_0xc76e('0x7')]},'idField':{'type':Sequelize[_0xc76e('0x7')]},'nameField':{'type':Sequelize[_0xc76e('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc76e('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index ac5dd82..bc8b688 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 _0xdfd2=['destroy','then','error','stack','name','index','DeskField','fieldName','key','map','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','include','findAll','catch','params','keys','includeAll','create','body','find','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save'];(function(_0x44f18c,_0x32f655){var _0xa22910=function(_0x406fd4){while(--_0x406fd4){_0x44f18c['push'](_0x44f18c['shift']());}};_0xa22910(++_0x32f655);}(_0xdfd2,0xf6));var _0x2dfd=function(_0xd3e346,_0x429d1b){_0xd3e346=_0xd3e346-0x0;var _0x4ab747=_0xdfd2[_0xd3e346];return _0x4ab747;};'use strict';var emlformat=require(_0x2dfd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2dfd('0x1'));var jsonpatch=require(_0x2dfd('0x2'));var rp=require('request-promise');var moment=require(_0x2dfd('0x3'));var BPromise=require(_0x2dfd('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2dfd('0x5'));var sox=require(_0x2dfd('0x6'));var csv=require(_0x2dfd('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2dfd('0x8'));var squel=require(_0x2dfd('0x9'));var crypto=require(_0x2dfd('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2dfd('0xb'));var toCsv=require(_0x2dfd('0x7'));var querystring=require(_0x2dfd('0xc'));var Papa=require(_0x2dfd('0xd'));var Redis=require(_0x2dfd('0xe'));var authService=require(_0x2dfd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2dfd('0x10'));var hardwareService=require(_0x2dfd('0x11'));var logger=require(_0x2dfd('0x12'))(_0x2dfd('0x13'));var utils=require(_0x2dfd('0x14'));var config=require(_0x2dfd('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2595bc,_0x5d13de){_0x5d13de=_0x5d13de||0xcc;return function(_0x14b1dd){if(_0x14b1dd){return _0x2595bc[_0x2dfd('0x16')](_0x5d13de);}return _0x2595bc[_0x2dfd('0x17')](_0x5d13de)[_0x2dfd('0x18')]();};}function respondWithResult(_0x6653cd,_0x432d63){_0x432d63=_0x432d63||0xc8;return function(_0x21d7f3){if(_0x21d7f3){return _0x6653cd[_0x2dfd('0x17')](_0x432d63)['json'](_0x21d7f3);}};}function respondWithFilteredResult(_0x22f717,_0x413ee4){return function(_0x214441){if(_0x214441){var _0x48ec9b=typeof _0x413ee4[_0x2dfd('0x19')]==='undefined'&&typeof _0x413ee4['limit']===_0x2dfd('0x1a');var _0x19676c=_0x214441[_0x2dfd('0x1b')];var _0x336146=_0x48ec9b?0x0:_0x413ee4[_0x2dfd('0x19')];var _0x4cd8de=_0x48ec9b?_0x214441[_0x2dfd('0x1b')]:_0x413ee4[_0x2dfd('0x19')]+_0x413ee4[_0x2dfd('0x1c')];var _0x211e89;if(_0x4cd8de>=_0x19676c){_0x4cd8de=_0x19676c;_0x211e89=0xc8;}else{_0x211e89=0xce;}_0x22f717[_0x2dfd('0x17')](_0x211e89);return _0x22f717[_0x2dfd('0x1d')](_0x2dfd('0x1e'),_0x336146+'-'+_0x4cd8de+'/'+_0x19676c)[_0x2dfd('0x1f')](_0x214441);}return null;};}function patchUpdates(_0x2fa9d0){return function(_0x592d3e){try{jsonpatch['apply'](_0x592d3e,_0x2fa9d0,!![]);}catch(_0x4db0df){return BPromise[_0x2dfd('0x20')](_0x4db0df);}return _0x592d3e[_0x2dfd('0x21')]();};}function saveUpdates(_0x31a749,_0x813475){return function(_0x53895f){if(_0x53895f){return _0x53895f['update'](_0x31a749)['then'](function(_0x20d490){return _0x20d490;});}return null;};}function removeEntity(_0x1e61cd,_0x310421){return function(_0x50e1ca){if(_0x50e1ca){return _0x50e1ca[_0x2dfd('0x22')]()[_0x2dfd('0x23')](function(){_0x1e61cd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e3a33,_0xff43b){return function(_0x5d13ec){if(!_0x5d13ec){_0x1e3a33['sendStatus'](0x194);}return _0x5d13ec;};}function handleError(_0xf4a2e8,_0x1dbc5a){_0x1dbc5a=_0x1dbc5a||0x1f4;return function(_0x144e43){logger[_0x2dfd('0x24')](_0x144e43[_0x2dfd('0x25')]);if(_0x144e43[_0x2dfd('0x26')]){delete _0x144e43[_0x2dfd('0x26')];}_0xf4a2e8['status'](_0x1dbc5a)['send'](_0x144e43);};}exports[_0x2dfd('0x27')]=function(_0x2bd5aa,_0x5910cb){var _0x4b1be3={},_0x1117d4={},_0x4eb72c={'count':0x0,'rows':[]};var _0x3920a7=_['map'](db[_0x2dfd('0x28')]['rawAttributes'],function(_0x4c840f){return{'name':_0x4c840f[_0x2dfd('0x29')],'type':_0x4c840f['type'][_0x2dfd('0x2a')]};});_0x1117d4['model']=_[_0x2dfd('0x2b')](_0x3920a7,_0x2dfd('0x26'));_0x1117d4[_0x2dfd('0x2c')]=_['keys'](_0x2bd5aa[_0x2dfd('0x2c')]);_0x1117d4[_0x2dfd('0x2d')]=_[_0x2dfd('0x2e')](_0x1117d4['model'],_0x1117d4[_0x2dfd('0x2c')]);_0x4b1be3[_0x2dfd('0x2f')]=_[_0x2dfd('0x2e')](_0x1117d4[_0x2dfd('0x30')],qs[_0x2dfd('0x31')](_0x2bd5aa[_0x2dfd('0x2c')][_0x2dfd('0x31')]));_0x4b1be3[_0x2dfd('0x2f')]=_0x4b1be3[_0x2dfd('0x2f')][_0x2dfd('0x32')]?_0x4b1be3[_0x2dfd('0x2f')]:_0x1117d4[_0x2dfd('0x30')];if(!_0x2bd5aa['query'][_0x2dfd('0x33')](_0x2dfd('0x34'))){_0x4b1be3[_0x2dfd('0x1c')]=qs[_0x2dfd('0x1c')](_0x2bd5aa[_0x2dfd('0x2c')][_0x2dfd('0x1c')]);_0x4b1be3[_0x2dfd('0x19')]=qs[_0x2dfd('0x19')](_0x2bd5aa[_0x2dfd('0x2c')][_0x2dfd('0x19')]);}_0x4b1be3[_0x2dfd('0x35')]=qs['sort'](_0x2bd5aa['query'][_0x2dfd('0x36')]);_0x4b1be3[_0x2dfd('0x37')]=qs['filters'](_[_0x2dfd('0x38')](_0x2bd5aa[_0x2dfd('0x2c')],_0x1117d4['filters']),_0x3920a7);if(_0x2bd5aa[_0x2dfd('0x2c')][_0x2dfd('0x39')]){_0x4b1be3[_0x2dfd('0x37')]=_[_0x2dfd('0x3a')](_0x4b1be3[_0x2dfd('0x37')],{'$or':_[_0x2dfd('0x2b')](_0x3920a7,function(_0x20bcec){if(_0x20bcec[_0x2dfd('0x3b')]!=='VIRTUAL'){var _0x543b83={};_0x543b83[_0x20bcec[_0x2dfd('0x26')]]={'$like':'%'+_0x2bd5aa[_0x2dfd('0x2c')][_0x2dfd('0x39')]+'%'};return _0x543b83;}})});}_0x4b1be3=_[_0x2dfd('0x3a')]({},_0x4b1be3,_0x2bd5aa[_0x2dfd('0x3c')]);var _0x4b8d37={'where':_0x4b1be3[_0x2dfd('0x37')]};return db[_0x2dfd('0x28')]['count'](_0x4b8d37)['then'](function(_0x21c172){_0x4eb72c[_0x2dfd('0x1b')]=_0x21c172;if(_0x2bd5aa['query']['includeAll']){_0x4b1be3[_0x2dfd('0x3d')]=[{'all':!![]}];}return db[_0x2dfd('0x28')][_0x2dfd('0x3e')](_0x4b1be3);})[_0x2dfd('0x23')](function(_0x40ff7d){_0x4eb72c['rows']=_0x40ff7d;return _0x4eb72c;})[_0x2dfd('0x23')](respondWithFilteredResult(_0x5910cb,_0x4b1be3))[_0x2dfd('0x3f')](handleError(_0x5910cb,null));};exports['show']=function(_0x31f84d,_0x4b9c34){var _0x12492d={'raw':!![],'where':{'id':_0x31f84d[_0x2dfd('0x40')]['id']}},_0x471472={};_0x471472[_0x2dfd('0x30')]=_[_0x2dfd('0x41')](db[_0x2dfd('0x28')]['rawAttributes']);_0x471472[_0x2dfd('0x2c')]=_[_0x2dfd('0x41')](_0x31f84d['query']);_0x471472[_0x2dfd('0x2d')]=_['intersection'](_0x471472['model'],_0x471472[_0x2dfd('0x2c')]);_0x12492d[_0x2dfd('0x2f')]=_[_0x2dfd('0x2e')](_0x471472[_0x2dfd('0x30')],qs['fields'](_0x31f84d[_0x2dfd('0x2c')][_0x2dfd('0x31')]));_0x12492d[_0x2dfd('0x2f')]=_0x12492d[_0x2dfd('0x2f')][_0x2dfd('0x32')]?_0x12492d[_0x2dfd('0x2f')]:_0x471472[_0x2dfd('0x30')];if(_0x31f84d[_0x2dfd('0x2c')][_0x2dfd('0x42')]){_0x12492d[_0x2dfd('0x3d')]=[{'all':!![]}];}_0x12492d=_[_0x2dfd('0x3a')]({},_0x12492d,_0x31f84d[_0x2dfd('0x3c')]);return db[_0x2dfd('0x28')]['find'](_0x12492d)[_0x2dfd('0x23')](handleEntityNotFound(_0x4b9c34,null))[_0x2dfd('0x23')](respondWithResult(_0x4b9c34,null))[_0x2dfd('0x3f')](handleError(_0x4b9c34,null));};exports[_0x2dfd('0x43')]=function(_0x277f33,_0x26dde9){return db[_0x2dfd('0x28')][_0x2dfd('0x43')](_0x277f33[_0x2dfd('0x44')],{})[_0x2dfd('0x23')](respondWithResult(_0x26dde9,0xc9))[_0x2dfd('0x3f')](handleError(_0x26dde9,null));};exports['update']=function(_0x5b44a1,_0x27ef97){if(_0x5b44a1[_0x2dfd('0x44')]['id']){delete _0x5b44a1[_0x2dfd('0x44')]['id'];}return db[_0x2dfd('0x28')]['find']({'where':{'id':_0x5b44a1[_0x2dfd('0x40')]['id']}})[_0x2dfd('0x23')](handleEntityNotFound(_0x27ef97,null))[_0x2dfd('0x23')](saveUpdates(_0x5b44a1[_0x2dfd('0x44')],null))[_0x2dfd('0x23')](respondWithResult(_0x27ef97,null))[_0x2dfd('0x3f')](handleError(_0x27ef97,null));};exports[_0x2dfd('0x22')]=function(_0x5d359e,_0x1242f3){return db[_0x2dfd('0x28')][_0x2dfd('0x45')]({'where':{'id':_0x5d359e[_0x2dfd('0x40')]['id']}})['then'](handleEntityNotFound(_0x1242f3,null))[_0x2dfd('0x23')](removeEntity(_0x1242f3,null))[_0x2dfd('0x3f')](handleError(_0x1242f3,null));}; \ No newline at end of file +var _0xd1f1=['send','index','DeskField','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','fields','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','apply','save','update','then','destroy','end','error','stack','name'];(function(_0x4e007d,_0x5a0b85){var _0x270c4f=function(_0x338a08){while(--_0x338a08){_0x4e007d['push'](_0x4e007d['shift']());}};_0x270c4f(++_0x5a0b85);}(_0xd1f1,0xbc));var _0x1d1f=function(_0x3dac2c,_0x2ad312){_0x3dac2c=_0x3dac2c-0x0;var _0x23f73a=_0xd1f1[_0x3dac2c];return _0x23f73a;};'use strict';var emlformat=require(_0x1d1f('0x0'));var rimraf=require(_0x1d1f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1d1f('0x2'));var rp=require(_0x1d1f('0x3'));var moment=require(_0x1d1f('0x4'));var BPromise=require(_0x1d1f('0x5'));var Mustache=require(_0x1d1f('0x6'));var util=require(_0x1d1f('0x7'));var path=require(_0x1d1f('0x8'));var sox=require('sox');var csv=require(_0x1d1f('0x9'));var ejs=require(_0x1d1f('0xa'));var fs=require('fs');var fs_extra=require(_0x1d1f('0xb'));var _=require(_0x1d1f('0xc'));var squel=require(_0x1d1f('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1d1f('0x9'));var querystring=require(_0x1d1f('0xe'));var Papa=require(_0x1d1f('0xf'));var Redis=require(_0x1d1f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1d1f('0x11'));var as=require(_0x1d1f('0x12'));var hardwareService=require(_0x1d1f('0x13'));var logger=require(_0x1d1f('0x14'))(_0x1d1f('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1d1f('0x16'));var db=require(_0x1d1f('0x17'))['db'];function respondWithStatusCode(_0x5582d4,_0x33e3b1){_0x33e3b1=_0x33e3b1||0xcc;return function(_0x2f3c0f){if(_0x2f3c0f){return _0x5582d4[_0x1d1f('0x18')](_0x33e3b1);}return _0x5582d4[_0x1d1f('0x19')](_0x33e3b1)['end']();};}function respondWithResult(_0x2e0629,_0xa62267){_0xa62267=_0xa62267||0xc8;return function(_0x3db906){if(_0x3db906){return _0x2e0629[_0x1d1f('0x19')](_0xa62267)[_0x1d1f('0x1a')](_0x3db906);}};}function respondWithFilteredResult(_0x152f33,_0x147371){return function(_0x56cec9){if(_0x56cec9){var _0x3f66c7=typeof _0x147371[_0x1d1f('0x1b')]===_0x1d1f('0x1c')&&typeof _0x147371[_0x1d1f('0x1d')]===_0x1d1f('0x1c');var _0x3a9c75=_0x56cec9['count'];var _0x53ff5f=_0x3f66c7?0x0:_0x147371['offset'];var _0x2a5507=_0x3f66c7?_0x56cec9['count']:_0x147371[_0x1d1f('0x1b')]+_0x147371['limit'];var _0x4938d6;if(_0x2a5507>=_0x3a9c75){_0x2a5507=_0x3a9c75;_0x4938d6=0xc8;}else{_0x4938d6=0xce;}_0x152f33['status'](_0x4938d6);return _0x152f33[_0x1d1f('0x1e')]('Content-Range',_0x53ff5f+'-'+_0x2a5507+'/'+_0x3a9c75)[_0x1d1f('0x1a')](_0x56cec9);}return null;};}function patchUpdates(_0xe6b89a){return function(_0xe121be){try{jsonpatch[_0x1d1f('0x1f')](_0xe121be,_0xe6b89a,!![]);}catch(_0x507ee0){return BPromise['reject'](_0x507ee0);}return _0xe121be[_0x1d1f('0x20')]();};}function saveUpdates(_0x491c1b,_0x360051){return function(_0x2c2518){if(_0x2c2518){return _0x2c2518[_0x1d1f('0x21')](_0x491c1b)[_0x1d1f('0x22')](function(_0x23189b){return _0x23189b;});}return null;};}function removeEntity(_0x1e4650,_0x4d406c){return function(_0x3fe260){if(_0x3fe260){return _0x3fe260[_0x1d1f('0x23')]()['then'](function(){_0x1e4650[_0x1d1f('0x19')](0xcc)[_0x1d1f('0x24')]();});}};}function handleEntityNotFound(_0x2aabc7,_0x585ec7){return function(_0x2aebd3){if(!_0x2aebd3){_0x2aabc7[_0x1d1f('0x18')](0x194);}return _0x2aebd3;};}function handleError(_0x318bc9,_0x4f3bbf){_0x4f3bbf=_0x4f3bbf||0x1f4;return function(_0x238db7){logger[_0x1d1f('0x25')](_0x238db7[_0x1d1f('0x26')]);if(_0x238db7['name']){delete _0x238db7[_0x1d1f('0x27')];}_0x318bc9[_0x1d1f('0x19')](_0x4f3bbf)[_0x1d1f('0x28')](_0x238db7);};}exports[_0x1d1f('0x29')]=function(_0x23e61e,_0x57f817){var _0x4989de={},_0x2cc444={},_0x26b533={'count':0x0,'rows':[]};var _0x9f6459=_['map'](db[_0x1d1f('0x2a')][_0x1d1f('0x2b')],function(_0x52474b){return{'name':_0x52474b[_0x1d1f('0x2c')],'type':_0x52474b[_0x1d1f('0x2d')]['key']};});_0x2cc444[_0x1d1f('0x2e')]=_[_0x1d1f('0x2f')](_0x9f6459,_0x1d1f('0x27'));_0x2cc444[_0x1d1f('0x30')]=_[_0x1d1f('0x31')](_0x23e61e[_0x1d1f('0x30')]);_0x2cc444[_0x1d1f('0x32')]=_[_0x1d1f('0x33')](_0x2cc444[_0x1d1f('0x2e')],_0x2cc444['query']);_0x4989de[_0x1d1f('0x34')]=_['intersection'](_0x2cc444[_0x1d1f('0x2e')],qs['fields'](_0x23e61e['query']['fields']));_0x4989de[_0x1d1f('0x34')]=_0x4989de[_0x1d1f('0x34')][_0x1d1f('0x35')]?_0x4989de[_0x1d1f('0x34')]:_0x2cc444[_0x1d1f('0x2e')];if(!_0x23e61e['query'][_0x1d1f('0x36')](_0x1d1f('0x37'))){_0x4989de[_0x1d1f('0x1d')]=qs[_0x1d1f('0x1d')](_0x23e61e[_0x1d1f('0x30')][_0x1d1f('0x1d')]);_0x4989de[_0x1d1f('0x1b')]=qs[_0x1d1f('0x1b')](_0x23e61e[_0x1d1f('0x30')]['offset']);}_0x4989de[_0x1d1f('0x38')]=qs[_0x1d1f('0x39')](_0x23e61e[_0x1d1f('0x30')][_0x1d1f('0x39')]);_0x4989de['where']=qs[_0x1d1f('0x32')](_[_0x1d1f('0x3a')](_0x23e61e[_0x1d1f('0x30')],_0x2cc444[_0x1d1f('0x32')]),_0x9f6459);if(_0x23e61e[_0x1d1f('0x30')]['filter']){_0x4989de['where']=_[_0x1d1f('0x3b')](_0x4989de[_0x1d1f('0x3c')],{'$or':_[_0x1d1f('0x2f')](_0x9f6459,function(_0x27ddb3){if(_0x27ddb3[_0x1d1f('0x2d')]!==_0x1d1f('0x3d')){var _0x28ff35={};_0x28ff35[_0x27ddb3[_0x1d1f('0x27')]]={'$like':'%'+_0x23e61e[_0x1d1f('0x30')][_0x1d1f('0x3e')]+'%'};return _0x28ff35;}})});}_0x4989de=_[_0x1d1f('0x3b')]({},_0x4989de,_0x23e61e[_0x1d1f('0x3f')]);var _0x444958={'where':_0x4989de[_0x1d1f('0x3c')]};return db['DeskField'][_0x1d1f('0x40')](_0x444958)[_0x1d1f('0x22')](function(_0x131e0b){_0x26b533[_0x1d1f('0x40')]=_0x131e0b;if(_0x23e61e[_0x1d1f('0x30')][_0x1d1f('0x41')]){_0x4989de[_0x1d1f('0x42')]=[{'all':!![]}];}return db[_0x1d1f('0x2a')][_0x1d1f('0x43')](_0x4989de);})[_0x1d1f('0x22')](function(_0x12d933){_0x26b533[_0x1d1f('0x44')]=_0x12d933;return _0x26b533;})[_0x1d1f('0x22')](respondWithFilteredResult(_0x57f817,_0x4989de))[_0x1d1f('0x45')](handleError(_0x57f817,null));};exports[_0x1d1f('0x46')]=function(_0x13a887,_0x28885b){var _0x24bbc6={'raw':!![],'where':{'id':_0x13a887['params']['id']}},_0x911278={};_0x911278[_0x1d1f('0x2e')]=_[_0x1d1f('0x31')](db['DeskField'][_0x1d1f('0x2b')]);_0x911278[_0x1d1f('0x30')]=_[_0x1d1f('0x31')](_0x13a887['query']);_0x911278[_0x1d1f('0x32')]=_['intersection'](_0x911278[_0x1d1f('0x2e')],_0x911278[_0x1d1f('0x30')]);_0x24bbc6[_0x1d1f('0x34')]=_[_0x1d1f('0x33')](_0x911278[_0x1d1f('0x2e')],qs[_0x1d1f('0x47')](_0x13a887[_0x1d1f('0x30')]['fields']));_0x24bbc6[_0x1d1f('0x34')]=_0x24bbc6[_0x1d1f('0x34')][_0x1d1f('0x35')]?_0x24bbc6[_0x1d1f('0x34')]:_0x911278[_0x1d1f('0x2e')];if(_0x13a887[_0x1d1f('0x30')]['includeAll']){_0x24bbc6[_0x1d1f('0x42')]=[{'all':!![]}];}_0x24bbc6=_[_0x1d1f('0x3b')]({},_0x24bbc6,_0x13a887[_0x1d1f('0x3f')]);return db['DeskField'][_0x1d1f('0x48')](_0x24bbc6)[_0x1d1f('0x22')](handleEntityNotFound(_0x28885b,null))[_0x1d1f('0x22')](respondWithResult(_0x28885b,null))[_0x1d1f('0x45')](handleError(_0x28885b,null));};exports[_0x1d1f('0x49')]=function(_0x2d7fc5,_0x3eec9b){return db[_0x1d1f('0x2a')][_0x1d1f('0x49')](_0x2d7fc5[_0x1d1f('0x4a')],{})['then'](respondWithResult(_0x3eec9b,0xc9))[_0x1d1f('0x45')](handleError(_0x3eec9b,null));};exports[_0x1d1f('0x21')]=function(_0x5f0afa,_0x21624d){if(_0x5f0afa[_0x1d1f('0x4a')]['id']){delete _0x5f0afa[_0x1d1f('0x4a')]['id'];}return db[_0x1d1f('0x2a')][_0x1d1f('0x48')]({'where':{'id':_0x5f0afa[_0x1d1f('0x4b')]['id']}})[_0x1d1f('0x22')](handleEntityNotFound(_0x21624d,null))[_0x1d1f('0x22')](saveUpdates(_0x5f0afa['body'],null))[_0x1d1f('0x22')](respondWithResult(_0x21624d,null))[_0x1d1f('0x45')](handleError(_0x21624d,null));};exports[_0x1d1f('0x23')]=function(_0x5d2276,_0x49e092){return db[_0x1d1f('0x2a')]['find']({'where':{'id':_0x5d2276['params']['id']}})[_0x1d1f('0x22')](handleEntityNotFound(_0x49e092,null))[_0x1d1f('0x22')](removeEntity(_0x49e092,null))['catch'](handleError(_0x49e092,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index e503f9f..e0b46ef 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 _0x1d16=['path','../../config/environment','./intDeskField.attributes','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x55c1f0,_0x4f574f){var _0x1530fa=function(_0x631542){while(--_0x631542){_0x55c1f0['push'](_0x55c1f0['shift']());}};_0x1530fa(++_0x4f574f);}(_0x1d16,0xaf));var _0x61d1=function(_0x460ede,_0x185eb5){_0x460ede=_0x460ede-0x0;var _0x31944e=_0x1d16[_0x460ede];return _0x31944e;};'use strict';var _=require(_0x61d1('0x0'));var util=require(_0x61d1('0x1'));var logger=require(_0x61d1('0x2'))(_0x61d1('0x3'));var moment=require(_0x61d1('0x4'));var BPromise=require(_0x61d1('0x5'));var rp=require(_0x61d1('0x6'));var fs=require('fs');var path=require(_0x61d1('0x7'));var rimraf=require('rimraf');var config=require(_0x61d1('0x8'));var attributes=require(_0x61d1('0x9'));module['exports']=function(_0x152779,_0x2d02cc){return _0x152779['define']('DeskField',attributes,{'tableName':_0x61d1('0xa'),'paranoid':![],'indexes':[{'name':_0x61d1('0xb'),'fields':[_0x61d1('0xc'),_0x61d1('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2e78=['bluebird','path','rimraf','./intDeskField.attributes','exports','define','DeskField','desk_unique_index','idField','FieldId','lodash','../../config/logger'];(function(_0x550e42,_0x31537b){var _0x33cce0=function(_0x251f25){while(--_0x251f25){_0x550e42['push'](_0x550e42['shift']());}};_0x33cce0(++_0x31537b);}(_0x2e78,0x76));var _0x82e7=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2e78[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x82e7('0x0'));var util=require('util');var logger=require(_0x82e7('0x1'))('api');var moment=require('moment');var BPromise=require(_0x82e7('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x82e7('0x3'));var rimraf=require(_0x82e7('0x4'));var config=require('../../config/environment');var attributes=require(_0x82e7('0x5'));module[_0x82e7('0x6')]=function(_0x520c7c,_0x52c0ae){return _0x520c7c[_0x82e7('0x7')](_0x82e7('0x8'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x82e7('0x9'),'fields':[_0x82e7('0xa'),_0x82e7('0xb')],'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 ddc3f1e..7ca59c2 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 _0xfbdd=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','DeskField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird'];(function(_0x2ebd61,_0x33dd0c){var _0x306cec=function(_0x55c2e5){while(--_0x55c2e5){_0x2ebd61['push'](_0x2ebd61['shift']());}};_0x306cec(++_0x33dd0c);}(_0xfbdd,0x86));var _0xdfbd=function(_0x23721b,_0x3d3cc8){_0x23721b=_0x23721b-0x0;var _0x5431c8=_0xfbdd[_0x23721b];return _0x5431c8;};'use strict';var _=require(_0xdfbd('0x0'));var util=require(_0xdfbd('0x1'));var moment=require(_0xdfbd('0x2'));var BPromise=require(_0xdfbd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdfbd('0x4'))['db'];var utils=require(_0xdfbd('0x5'));var logger=require(_0xdfbd('0x6'))(_0xdfbd('0x7'));var config=require(_0xdfbd('0x8'));var jayson=require(_0xdfbd('0x9'));var client=jayson[_0xdfbd('0xa')][_0xdfbd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36c928,_0x189baf,_0x146025){return new BPromise(function(_0x2c0baa,_0x1c4198){return client[_0xdfbd('0xc')](_0x36c928,_0x146025)[_0xdfbd('0xd')](function(_0x4d8a4f){logger[_0xdfbd('0xe')]('DeskField,\x20%s,\x20%s',_0x189baf,_0xdfbd('0xf'));logger[_0xdfbd('0x10')]('DeskField,\x20%s,\x20%s,\x20%s',_0x189baf,_0xdfbd('0xf'),JSON[_0xdfbd('0x11')](_0x4d8a4f));if(_0x4d8a4f['error']){if(_0x4d8a4f[_0xdfbd('0x12')][_0xdfbd('0x13')]===0x1f4){logger[_0xdfbd('0x12')](_0xdfbd('0x14'),_0x189baf,_0x4d8a4f[_0xdfbd('0x12')][_0xdfbd('0x15')]);return _0x1c4198(_0x4d8a4f['error'][_0xdfbd('0x15')]);}logger['error'](_0xdfbd('0x14'),_0x189baf,_0x4d8a4f[_0xdfbd('0x12')][_0xdfbd('0x15')]);return _0x2c0baa(_0x4d8a4f[_0xdfbd('0x12')]['message']);}else{logger[_0xdfbd('0xe')]('DeskField,\x20%s,\x20%s',_0x189baf,_0xdfbd('0xf'));_0x2c0baa(_0x4d8a4f['result'][_0xdfbd('0x15')]);}})[_0xdfbd('0x16')](function(_0x3e0bc2){logger[_0xdfbd('0x12')](_0xdfbd('0x14'),_0x189baf,_0x3e0bc2);_0x1c4198(_0x3e0bc2);});});} \ No newline at end of file +var _0x1330=['util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1330,0x68));var _0x0133=function(_0x28c939,_0x110e29){_0x28c939=_0x28c939-0x0;var _0x527fe9=_0x1330[_0x28c939];return _0x527fe9;};'use strict';var _=require(_0x0133('0x0'));var util=require(_0x0133('0x1'));var moment=require(_0x0133('0x2'));var BPromise=require('bluebird');var rs=require(_0x0133('0x3'));var fs=require('fs');var Redis=require(_0x0133('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0133('0x5'));var logger=require(_0x0133('0x6'))(_0x0133('0x7'));var config=require(_0x0133('0x8'));var jayson=require(_0x0133('0x9'));var client=jayson[_0x0133('0xa')][_0x0133('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38d396,_0x31b69f,_0x4ee29b){return new BPromise(function(_0x5043f6,_0x5dc149){return client[_0x0133('0xc')](_0x38d396,_0x4ee29b)[_0x0133('0xd')](function(_0x1ab9b1){logger['info'](_0x0133('0xe'),_0x31b69f,_0x0133('0xf'));logger[_0x0133('0x10')]('DeskField,\x20%s,\x20%s,\x20%s',_0x31b69f,_0x0133('0xf'),JSON[_0x0133('0x11')](_0x1ab9b1));if(_0x1ab9b1[_0x0133('0x12')]){if(_0x1ab9b1[_0x0133('0x12')]['code']===0x1f4){logger['error'](_0x0133('0xe'),_0x31b69f,_0x1ab9b1[_0x0133('0x12')][_0x0133('0x13')]);return _0x5dc149(_0x1ab9b1[_0x0133('0x12')]['message']);}logger[_0x0133('0x12')](_0x0133('0xe'),_0x31b69f,_0x1ab9b1['error'][_0x0133('0x13')]);return _0x5043f6(_0x1ab9b1[_0x0133('0x12')]['message']);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x31b69f,_0x0133('0xf'));_0x5043f6(_0x1ab9b1['result']['message']);}})[_0x0133('0x14')](function(_0x28ade9){logger[_0x0133('0x12')](_0x0133('0xe'),_0x31b69f,_0x28ade9);_0x5dc149(_0x28ade9);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 0cb51dd..09547b3 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 _0x3df6=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x31c6b6,_0xdd33b7){var _0x32b27b=function(_0x32f195){while(--_0x32f195){_0x31c6b6['push'](_0x31c6b6['shift']());}};_0x32b27b(++_0xdd33b7);}(_0x3df6,0x1ab));var _0x63df=function(_0x4ce312,_0x476a02){_0x4ce312=_0x4ce312-0x0;var _0x347d20=_0x3df6[_0x4ce312];return _0x347d20;};'use strict';var multer=require(_0x63df('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x63df('0x1'));var router=express[_0x63df('0x2')]();var fs_extra=require(_0x63df('0x3'));var auth=require(_0x63df('0x4'));var interaction=require(_0x63df('0x5'));var config=require(_0x63df('0x6'));var controller=require('./intDynamics365Account.controller');router[_0x63df('0x7')]('/',auth[_0x63df('0x8')](),controller[_0x63df('0x9')]);router[_0x63df('0x7')](_0x63df('0xa'),auth['isAuthenticated'](),controller[_0x63df('0xb')]);router['get'](_0x63df('0xc'),auth[_0x63df('0x8')](),controller[_0x63df('0xd')]);router[_0x63df('0x7')](_0x63df('0xe'),auth[_0x63df('0x8')](),controller[_0x63df('0xf')]);router['post']('/',auth[_0x63df('0x8')](),controller['create']);router[_0x63df('0x10')](_0x63df('0xc'),auth[_0x63df('0x8')](),controller[_0x63df('0x11')]);router[_0x63df('0x12')](_0x63df('0xa'),auth[_0x63df('0x8')](),controller[_0x63df('0x13')]);router[_0x63df('0x14')](_0x63df('0xa'),auth[_0x63df('0x8')](),controller[_0x63df('0x15')]);module[_0x63df('0x16')]=router; \ No newline at end of file +var _0x0b1e=['getFields','post','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations'];(function(_0x3791ad,_0x1ca192){var _0xcd195=function(_0x248891){while(--_0x248891){_0x3791ad['push'](_0x3791ad['shift']());}};_0xcd195(++_0x1ca192);}(_0x0b1e,0x11b));var _0xe0b1=function(_0x3cb3ca,_0x44d697){_0x3cb3ca=_0x3cb3ca-0x0;var _0x214366=_0x0b1e[_0x3cb3ca];return _0x214366;};'use strict';var multer=require(_0xe0b1('0x0'));var util=require(_0xe0b1('0x1'));var path=require(_0xe0b1('0x2'));var timeout=require(_0xe0b1('0x3'));var express=require(_0xe0b1('0x4'));var router=express[_0xe0b1('0x5')]();var fs_extra=require(_0xe0b1('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe0b1('0x7'));var config=require(_0xe0b1('0x8'));var controller=require(_0xe0b1('0x9'));router[_0xe0b1('0xa')]('/',auth[_0xe0b1('0xb')](),controller['index']);router['get'](_0xe0b1('0xc'),auth['isAuthenticated'](),controller[_0xe0b1('0xd')]);router[_0xe0b1('0xa')](_0xe0b1('0xe'),auth['isAuthenticated'](),controller[_0xe0b1('0xf')]);router['get']('/:id/fields',auth[_0xe0b1('0xb')](),controller[_0xe0b1('0x10')]);router[_0xe0b1('0x11')]('/',auth[_0xe0b1('0xb')](),controller['create']);router[_0xe0b1('0x11')](_0xe0b1('0xe'),auth[_0xe0b1('0xb')](),controller[_0xe0b1('0x12')]);router[_0xe0b1('0x13')](_0xe0b1('0xc'),auth[_0xe0b1('0xb')](),controller['update']);router[_0xe0b1('0x14')](_0xe0b1('0xc'),auth[_0xe0b1('0xb')](),controller[_0xe0b1('0x15')]);module[_0xe0b1('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index f64fe1b..974dcbb 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 _0xd7c3=['sequelize','exports','STRING'];(function(_0x372b6a,_0x2c4863){var _0x5e3538=function(_0x157204){while(--_0x157204){_0x372b6a['push'](_0x372b6a['shift']());}};_0x5e3538(++_0x2c4863);}(_0xd7c3,0x1c5));var _0x3d7c=function(_0x2f346c,_0x11fa76){_0x2f346c=_0x2f346c-0x0;var _0x3d3d12=_0xd7c3[_0x2f346c];return _0x3d3d12;};'use strict';var Sequelize=require(_0x3d7c('0x0'));module[_0x3d7c('0x1')]={'name':{'type':Sequelize[_0x3d7c('0x2')]},'username':{'type':Sequelize[_0x3d7c('0x2')]},'password':{'type':Sequelize[_0x3d7c('0x2')]},'remoteUri':{'type':Sequelize[_0x3d7c('0x2')]},'tenantId':{'type':Sequelize[_0x3d7c('0x2')]},'clientId':{'type':Sequelize[_0x3d7c('0x2')]},'clientSecret':{'type':Sequelize[_0x3d7c('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x3d7c('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x302c=['sequelize','exports','STRING'];(function(_0xafb3a3,_0x5a6d91){var _0x30a7c1=function(_0x56828d){while(--_0x56828d){_0xafb3a3['push'](_0xafb3a3['shift']());}};_0x30a7c1(++_0x5a6d91);}(_0x302c,0x15c));var _0xc302=function(_0x4ab425,_0x52d94f){_0x4ab425=_0x4ab425-0x0;var _0x471404=_0x302c[_0x4ab425];return _0x471404;};'use strict';var Sequelize=require(_0xc302('0x0'));module[_0xc302('0x1')]={'name':{'type':Sequelize[_0xc302('0x2')]},'username':{'type':Sequelize[_0xc302('0x2')]},'password':{'type':Sequelize[_0xc302('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xc302('0x2')]},'clientSecret':{'type':Sequelize[_0xc302('0x2')]},'serverUrl':{'type':Sequelize[_0xc302('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index ed68f50..1b903ae 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 _0x2f74=['ticketnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','modernAuthentication','CloudProvider','data7','POST','https://login.microsoftonline.com/','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','LogicalName','@odata.type','PicklistAttributeMetadata','push','forEach','isNil','BooleanAttributeMetadata','all','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','status','send','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel','TrueOption','true','OptionSet','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','offset','undefined','count','limit','set','Content-Range','json','update','then','sendStatus','error','name','index','map','Dynamics365Account','fieldName','type','key','model','query','keys','filters','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','length','create','body','find','getConfigurations','Dynamics365Configuration','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolvebykpiidname','responsiblecontactidname','sentimentvalue','statuscode'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x2f74,0xf0));var _0x42f7=function(_0x37f5a1,_0x461925){_0x37f5a1=_0x37f5a1-0x0;var _0x3a97a5=_0x2f74[_0x37f5a1];return _0x3a97a5;};'use strict';var rp=require(_0x42f7('0x0'));var util=require(_0x42f7('0x1'));var _=require(_0x42f7('0x2'));var qs=require(_0x42f7('0x3'));var logger=require(_0x42f7('0x4'))(_0x42f7('0x5'));var db=require('../../mysqldb')['db'];var integrations=require(_0x42f7('0x6'));function respondWithResult(_0x4d4297,_0x440eb2){_0x440eb2=_0x440eb2||0xc8;return function(_0x3da608){if(_0x3da608){return _0x4d4297['status'](_0x440eb2)['json'](_0x3da608);}};}function respondWithFilteredResult(_0x5b2761,_0x3ce8a8){return function(_0x1c4ced){if(_0x1c4ced){var _0x3da9ab=typeof _0x3ce8a8[_0x42f7('0x7')]===_0x42f7('0x8')&&typeof _0x3ce8a8['limit']===_0x42f7('0x8');var _0x5b468d=_0x1c4ced[_0x42f7('0x9')];var _0x167715=_0x3da9ab?0x0:_0x3ce8a8[_0x42f7('0x7')];var _0x906e54=_0x3da9ab?_0x1c4ced[_0x42f7('0x9')]:_0x3ce8a8[_0x42f7('0x7')]+_0x3ce8a8[_0x42f7('0xa')];var _0x113c41;if(_0x906e54>=_0x5b468d){_0x906e54=_0x5b468d;_0x113c41=0xc8;}else{_0x113c41=0xce;}_0x5b2761['status'](_0x113c41);return _0x5b2761[_0x42f7('0xb')](_0x42f7('0xc'),_0x167715+'-'+_0x906e54+'/'+_0x5b468d)[_0x42f7('0xd')](_0x1c4ced);}return null;};}function saveUpdates(_0x40b6eb){return function(_0x388ea4){if(_0x388ea4){return _0x388ea4[_0x42f7('0xe')](_0x40b6eb)[_0x42f7('0xf')](function(_0x3abc0f){return _0x3abc0f;});}return null;};}function removeEntity(_0x1500fe){return function(_0x3da22c){if(_0x3da22c){return _0x3da22c['destroy']()[_0x42f7('0xf')](function(){_0x1500fe['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x817d33){return function(_0x4d7788){if(!_0x4d7788){_0x817d33[_0x42f7('0x10')](0x194);}return _0x4d7788;};}function handleError(_0x4a093f,_0x5464c1){_0x5464c1=_0x5464c1||0x1f4;return function(_0x4c8b91){logger[_0x42f7('0x11')](_0x4c8b91['stack']);if(_0x4c8b91['name']){delete _0x4c8b91[_0x42f7('0x12')];}_0x4a093f['status'](_0x5464c1)['send'](_0x4c8b91);};}exports[_0x42f7('0x13')]=function(_0x3b6dde,_0x2d8553){var _0x424078={},_0x3b7f2f={},_0x5180eb={'count':0x0,'rows':[]};var _0x50d076=_[_0x42f7('0x14')](db[_0x42f7('0x15')]['rawAttributes'],function(_0x62aa3c){return{'name':_0x62aa3c[_0x42f7('0x16')],'type':_0x62aa3c[_0x42f7('0x17')][_0x42f7('0x18')]};});_0x3b7f2f[_0x42f7('0x19')]=_[_0x42f7('0x14')](_0x50d076,_0x42f7('0x12'));_0x3b7f2f[_0x42f7('0x1a')]=_[_0x42f7('0x1b')](_0x3b6dde[_0x42f7('0x1a')]);_0x3b7f2f[_0x42f7('0x1c')]=_['intersection'](_0x3b7f2f[_0x42f7('0x19')],_0x3b7f2f['query']);_0x424078[_0x42f7('0x1d')]=_['intersection'](_0x3b7f2f[_0x42f7('0x19')],qs[_0x42f7('0x1e')](_0x3b6dde[_0x42f7('0x1a')][_0x42f7('0x1e')]));_0x424078[_0x42f7('0x1d')]=_0x424078[_0x42f7('0x1d')]['length']?_0x424078[_0x42f7('0x1d')]:_0x3b7f2f[_0x42f7('0x19')];if(!_0x3b6dde[_0x42f7('0x1a')]['hasOwnProperty'](_0x42f7('0x1f'))){_0x424078[_0x42f7('0xa')]=qs['limit'](_0x3b6dde[_0x42f7('0x1a')]['limit']);_0x424078[_0x42f7('0x7')]=qs[_0x42f7('0x7')](_0x3b6dde[_0x42f7('0x1a')][_0x42f7('0x7')]);}_0x424078[_0x42f7('0x20')]=qs['sort'](_0x3b6dde[_0x42f7('0x1a')][_0x42f7('0x21')]);_0x424078[_0x42f7('0x22')]=qs['filters'](_['pick'](_0x3b6dde[_0x42f7('0x1a')],_0x3b7f2f[_0x42f7('0x1c')]),_0x50d076);if(_0x3b6dde[_0x42f7('0x1a')][_0x42f7('0x23')]){_0x424078[_0x42f7('0x22')]=_[_0x42f7('0x24')](_0x424078['where'],{'$or':_[_0x42f7('0x14')](_0x50d076,function(_0x505041){if(_0x505041['type']!==_0x42f7('0x25')){var _0xed0125={};_0xed0125[_0x505041[_0x42f7('0x12')]]={'$like':'%'+_0x3b6dde['query'][_0x42f7('0x23')]+'%'};return _0xed0125;}})});}_0x424078=_[_0x42f7('0x24')]({},_0x424078,_0x3b6dde[_0x42f7('0x26')]);var _0x464640={'where':_0x424078[_0x42f7('0x22')]};return db[_0x42f7('0x15')][_0x42f7('0x9')](_0x464640)[_0x42f7('0xf')](function(_0x24bf51){_0x5180eb['count']=_0x24bf51;if(_0x3b6dde[_0x42f7('0x1a')][_0x42f7('0x27')]){_0x424078[_0x42f7('0x28')]=[{'all':!![]}];}return db[_0x42f7('0x15')][_0x42f7('0x29')](_0x424078);})[_0x42f7('0xf')](function(_0x533b6e){_0x5180eb[_0x42f7('0x2a')]=_0x533b6e;return _0x5180eb;})[_0x42f7('0xf')](respondWithFilteredResult(_0x2d8553,_0x424078))[_0x42f7('0x2b')](handleError(_0x2d8553,null));};exports[_0x42f7('0x2c')]=function(_0x425ae5,_0x339606){var _0x34ac7a={'raw':![],'where':{'id':_0x425ae5[_0x42f7('0x2d')]['id']}},_0x20c6d0={};_0x20c6d0[_0x42f7('0x19')]=_['keys'](db['Dynamics365Account'][_0x42f7('0x2e')]);_0x20c6d0[_0x42f7('0x1a')]=_[_0x42f7('0x1b')](_0x425ae5['query']);_0x20c6d0['filters']=_['intersection'](_0x20c6d0[_0x42f7('0x19')],_0x20c6d0[_0x42f7('0x1a')]);_0x34ac7a[_0x42f7('0x1d')]=_[_0x42f7('0x2f')](_0x20c6d0[_0x42f7('0x19')],qs[_0x42f7('0x1e')](_0x425ae5[_0x42f7('0x1a')][_0x42f7('0x1e')]));_0x34ac7a['attributes']=_0x34ac7a[_0x42f7('0x1d')][_0x42f7('0x30')]?_0x34ac7a['attributes']:_0x20c6d0[_0x42f7('0x19')];if(_0x425ae5[_0x42f7('0x1a')][_0x42f7('0x27')]){_0x34ac7a[_0x42f7('0x28')]=[{'all':!![]}];}_0x34ac7a=_[_0x42f7('0x24')]({},_0x34ac7a,_0x425ae5[_0x42f7('0x26')]);return db[_0x42f7('0x15')]['find'](_0x34ac7a)[_0x42f7('0xf')](handleEntityNotFound(_0x339606,null))[_0x42f7('0xf')](respondWithResult(_0x339606,null))[_0x42f7('0x2b')](handleError(_0x339606,null));};exports[_0x42f7('0x31')]=function(_0x5075d0,_0x2f9a21){return db[_0x42f7('0x15')]['create'](_0x5075d0[_0x42f7('0x32')],{})['then'](respondWithResult(_0x2f9a21,0xc9))[_0x42f7('0x2b')](handleError(_0x2f9a21,null));};exports[_0x42f7('0xe')]=function(_0x13a0c0,_0x1d8524){if(_0x13a0c0['body']['id']){delete _0x13a0c0[_0x42f7('0x32')]['id'];}return db['Dynamics365Account'][_0x42f7('0x33')]({'where':{'id':_0x13a0c0[_0x42f7('0x2d')]['id']}})[_0x42f7('0xf')](handleEntityNotFound(_0x1d8524,null))['then'](saveUpdates(_0x13a0c0[_0x42f7('0x32')],null))[_0x42f7('0xf')](respondWithResult(_0x1d8524,null))[_0x42f7('0x2b')](handleError(_0x1d8524,null));};exports['destroy']=function(_0x1b1a99,_0x1cb39e){return db[_0x42f7('0x15')]['find']({'where':{'id':_0x1b1a99[_0x42f7('0x2d')]['id']}})[_0x42f7('0xf')](handleEntityNotFound(_0x1cb39e,null))[_0x42f7('0xf')](removeEntity(_0x1cb39e,null))[_0x42f7('0x2b')](handleError(_0x1cb39e,null));};exports[_0x42f7('0x34')]=function(_0xcbc1f2,_0x1e0138){var _0x527595={};var _0x32124e={};var _0x4114ff;var _0x20c18f;return db[_0x42f7('0x15')]['findOne']({'where':{'id':_0xcbc1f2[_0x42f7('0x2d')]['id']}})[_0x42f7('0xf')](handleEntityNotFound(_0x1e0138,null))[_0x42f7('0xf')](function(_0x1ab795){if(_0x1ab795){_0x4114ff=_0x1ab795;_0x32124e[_0x42f7('0x19')]=_['keys'](db[_0x42f7('0x35')][_0x42f7('0x2e')]);_0x32124e[_0x42f7('0x1a')]=_[_0x42f7('0x1b')](_0xcbc1f2['query']);_0x32124e[_0x42f7('0x1c')]=_['intersection'](_0x32124e[_0x42f7('0x19')],_0x32124e['query']);_0x527595[_0x42f7('0x1d')]=_['intersection'](_0x32124e[_0x42f7('0x19')],qs['fields'](_0xcbc1f2[_0x42f7('0x1a')][_0x42f7('0x1e')]));_0x527595['attributes']=_0x527595[_0x42f7('0x1d')][_0x42f7('0x30')]?_0x527595[_0x42f7('0x1d')]:_0x32124e[_0x42f7('0x19')];_0x527595[_0x42f7('0x20')]=qs[_0x42f7('0x21')](_0xcbc1f2['query'][_0x42f7('0x21')]);_0x527595[_0x42f7('0x22')]=qs[_0x42f7('0x1c')](_['pick'](_0xcbc1f2[_0x42f7('0x1a')],_0x32124e[_0x42f7('0x1c')]));if(_0xcbc1f2[_0x42f7('0x1a')][_0x42f7('0x23')]){_0x527595[_0x42f7('0x22')]=_[_0x42f7('0x24')](_0x527595[_0x42f7('0x22')],{'$or':_['map'](_0x527595[_0x42f7('0x1d')],function(_0x41d1a3){var _0x325486={};_0x325486[_0x41d1a3]={'$like':'%'+_0xcbc1f2[_0x42f7('0x1a')][_0x42f7('0x23')]+'%'};return _0x325486;})});}_0x527595=_[_0x42f7('0x24')]({},_0x527595,_0xcbc1f2['options']);return _0x4114ff[_0x42f7('0x34')](_0x527595);}})[_0x42f7('0xf')](function(_0x4df956){if(_0x4df956){_0x20c18f=_0x4df956['length'];if(!_0xcbc1f2[_0x42f7('0x1a')][_0x42f7('0x36')]('nolimit')){_0x527595[_0x42f7('0xa')]=qs['limit'](_0xcbc1f2[_0x42f7('0x1a')][_0x42f7('0xa')]);_0x527595['offset']=qs[_0x42f7('0x7')](_0xcbc1f2[_0x42f7('0x1a')]['offset']);}return _0x4114ff[_0x42f7('0x34')](_0x527595);}})[_0x42f7('0xf')](function(_0x25bb0a){if(_0x25bb0a){return _0x25bb0a?{'count':_0x20c18f,'rows':_0x25bb0a}:null;}})[_0x42f7('0xf')](respondWithResult(_0x1e0138,null))[_0x42f7('0x2b')](handleError(_0x1e0138,null));};exports[_0x42f7('0x37')]=function(_0x2a1446,_0x6cf632){if(_0x2a1446[_0x42f7('0x32')]['id']){delete _0x2a1446[_0x42f7('0x32')]['id'];}return db[_0x42f7('0x15')][_0x42f7('0x38')]({'where':{'id':_0x2a1446[_0x42f7('0x2d')]['id']}})[_0x42f7('0xf')](handleEntityNotFound(_0x6cf632,null))[_0x42f7('0xf')](function(_0x380059){if(_0x380059){_0x2a1446['body'][_0x42f7('0x39')]=_0x380059['id'];_0x2a1446[_0x42f7('0x32')][_0x42f7('0x3a')]=integrations[_0x42f7('0x3b')](_0x2a1446['body'][_0x42f7('0x3c')],_0x2a1446['body'][_0x42f7('0x17')]);_0x2a1446[_0x42f7('0x32')][_0x42f7('0x3d')]=integrations[_0x42f7('0x3e')](_0x2a1446[_0x42f7('0x32')][_0x42f7('0x3c')],_0x2a1446[_0x42f7('0x32')][_0x42f7('0x17')]);return db[_0x42f7('0x35')][_0x42f7('0x31')](_0x2a1446[_0x42f7('0x32')],{'include':[{'model':db[_0x42f7('0x3f')],'as':_0x42f7('0x3a')},{'model':db['Dynamics365Field'],'as':_0x42f7('0x3d')}]});}return null;})['then'](respondWithResult(_0x6cf632,null))[_0x42f7('0x2b')](handleError(_0x6cf632,null));};function sanitizeRemoteUri(_0x4585d1){var _0x292f91=_0x4585d1[_0x42f7('0x40')](-0x1);if(_0x292f91==='/')return _0x4585d1[_0x42f7('0x41')](0x0,_0x4585d1[_0x42f7('0x42')](_0x292f91));return _0x4585d1;}function getWebApiUrl(_0x1f9769){return util[_0x42f7('0x43')](_0x42f7('0x44'),_0x1f9769);}exports[_0x42f7('0x45')]=function(_0x544f30,_0x40c90f){var _0x4b4a1b=_0x544f30[_0x42f7('0x1a')][_0x42f7('0x46')];var _0x20f751=_0x4b4a1b===_0x42f7('0x47')?_0x42f7('0x48'):_0x42f7('0x49');var _0x1c16e0='';var _0x4c3b54='';var _0x16c62a='';var _0x130bf4='';var _0x4e9d01='';var _0x1231e='';var _0x55ffca='';var _0x13bb87='';var _0x13f226=[_0x42f7('0x4a'),_0x42f7('0x4b'),_0x42f7('0x4c'),_0x42f7('0x4d'),_0x42f7('0x4e'),'subject','phonenumber',_0x42f7('0x4f'),_0x42f7('0x50'),_0x42f7('0x51')];var _0x43c7ef=['accountidname',_0x42f7('0x52'),'actualserviceunits','billedserviceunits','contactidname',_0x42f7('0x53'),_0x42f7('0x54'),'contractidname',_0x42f7('0x55'),_0x42f7('0x56'),'createdbyname',_0x42f7('0x57'),_0x42f7('0x58'),_0x42f7('0x59'),_0x42f7('0x5a'),_0x42f7('0x5b'),_0x42f7('0x5c'),_0x42f7('0x5d'),_0x42f7('0x5e'),'entitlementidname',_0x42f7('0x5f'),_0x42f7('0x60'),_0x42f7('0x61'),_0x42f7('0x62'),'firstresponsebykpiidname','followupby',_0x42f7('0x63'),'influencescore',_0x42f7('0x64'),_0x42f7('0x65'),_0x42f7('0x66'),_0x42f7('0x67'),_0x42f7('0x68'),_0x42f7('0x69'),_0x42f7('0x6a'),_0x42f7('0x6b'),'modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename',_0x42f7('0x6c'),_0x42f7('0x6d'),_0x42f7('0x6e'),'overriddencreatedon',_0x42f7('0x6f'),'owneridtype',_0x42f7('0x70'),'parentcaseidname',_0x42f7('0x71'),_0x42f7('0x72'),_0x42f7('0x73'),_0x42f7('0x74'),_0x42f7('0x75'),'resolveby',_0x42f7('0x76'),'responseby',_0x42f7('0x77'),'responsiblecontactidyominame',_0x42f7('0x78'),'slainvokedidname','slaname','socialprofileidname','statecode',_0x42f7('0x79'),'subjectidname',_0x42f7('0x7a'),'timezoneruleversionnumber',_0x42f7('0x7b'),'traversedpath',_0x42f7('0x7c'),_0x42f7('0x7d')];var _0x31916a=_0x13f226[_0x42f7('0x7e')](_0x43c7ef);return db[_0x42f7('0x15')]['findOne']({'where':{'id':_0x544f30[_0x42f7('0x2d')]['id']},'attributes':['id',_0x42f7('0x7f'),_0x42f7('0x80'),_0x42f7('0x81'),_0x42f7('0x82'),'clientId','clientSecret',_0x42f7('0x83')],'include':[{'model':db[_0x42f7('0x84')],'as':_0x42f7('0x84'),'attributes':['id','data5',_0x42f7('0x85')]}]})[_0x42f7('0xf')](handleEntityNotFound(_0x40c90f,null))[_0x42f7('0xf')](function(_0x5c0b4a){if(_0x5c0b4a){if(_0x5c0b4a['modernAuthentication']){_0x5c0b4a['access_token']=_0x5c0b4a[_0x42f7('0x84')]['data5'];_0x13bb87=sanitizeRemoteUri(_0x5c0b4a[_0x42f7('0x84')][_0x42f7('0x85')]);_0x55ffca=getWebApiUrl(_0x13bb87);return _0x5c0b4a;}_0x13bb87=sanitizeRemoteUri(_0x5c0b4a[_0x42f7('0x81')]);_0x55ffca=getWebApiUrl(_0x13bb87);var _0x47fa69={'method':_0x42f7('0x86'),'uri':_0x42f7('0x87')+_0x5c0b4a[_0x42f7('0x82')]+'/oauth2/token','form':{'client_id':_0x5c0b4a['clientId'],'resource':_0x13bb87,'username':_0x5c0b4a['username'],'password':_0x5c0b4a['password'],'grant_type':'password','client_secret':_0x5c0b4a[_0x42f7('0x88')]},'json':!![]};return rp(_0x47fa69);}})['then'](function(_0x5dffe9){_0x1231e=_0x5dffe9['access_token'];var _0x2de135={'method':_0x42f7('0x89'),'uri':encodeURI(_0x55ffca+_0x42f7('0x8a')+_0x20f751+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x1231e,'If-None-Match':null,'OData-Version':_0x42f7('0x8b')},'json':!![]};return rp(_0x2de135);})[_0x42f7('0xf')](function(_0x4f4221){var _0x245193=_0x4f4221[_0x42f7('0x8c')][0x0];var _0x5f5261=_0x245193[_0x42f7('0x8d')];var _0x2fcbd9={'method':_0x42f7('0x89'),'uri':_0x55ffca+_0x42f7('0x8e')+_0x5f5261+_0x42f7('0x8f'),'headers':{'Authorization':_0x42f7('0x90')+_0x1231e,'If-None-Match':null,'OData-Version':_0x42f7('0x8b')},'json':!![]};return rp(_0x2fcbd9);})[_0x42f7('0xf')](function(_0x6f4f74){_0x1c16e0=_0x6f4f74;_0x4c3b54=_0x1c16e0[_0x42f7('0x91')];_0x4c3b54=_['remove'](_0x4c3b54,function(_0xb9df8c){return!_0x31916a['includes'](_0xb9df8c[_0x42f7('0x92')]);});var _0x282067=[];var _0x3929e4=[];_0x4c3b54['forEach'](function(_0x33d970){if(_0x33d970['@odata.type']){var _0x2b5a0f=_0x33d970[_0x42f7('0x93')][_0x42f7('0x41')](_0x33d970['@odata.type'][_0x42f7('0x42')]('.')+0x1);if(_0x2b5a0f===_0x42f7('0x94')){_0x282067[_0x42f7('0x95')](getSelectList(_0x55ffca,_0x4b4a1b,_0x3929e4,_0x1c16e0[_0x42f7('0x8d')],_0x33d970[_0x42f7('0x8d')],_0x1231e));}}});return Promise['all'](_0x282067);})[_0x42f7('0xf')](function(_0x1eae7e){_0x16c62a=_0x1eae7e[0x0];var _0x791baa=[];var _0x41dbc2=[];_0x4c3b54[_0x42f7('0x96')](function(_0xbf411e){if(!_[_0x42f7('0x97')](_0xbf411e[_0x42f7('0x93')])){var _0x25f0ea=_0xbf411e[_0x42f7('0x93')]['substring'](_0xbf411e[_0x42f7('0x93')]['lastIndexOf']('.')+0x1);if(_0x25f0ea===_0x42f7('0x98')){_0x791baa[_0x42f7('0x95')](getBooleanList(_0x55ffca,_0x4b4a1b,_0x41dbc2,_0x1c16e0['MetadataId'],_0xbf411e['MetadataId'],_0x1231e));}}});return Promise[_0x42f7('0x99')](_0x791baa);})[_0x42f7('0xf')](function(_0x15d56b){_0x130bf4=_0x15d56b[0x0];var _0x50db7c=[];var _0x40c2fd=[];_0x4c3b54[_0x42f7('0x96')](function(_0x41544a){if(_0x41544a[_0x42f7('0x93')]){var _0x53e005=_0x41544a[_0x42f7('0x93')][_0x42f7('0x41')](_0x41544a[_0x42f7('0x93')][_0x42f7('0x42')]('.')+0x1);if(_0x53e005===_0x42f7('0x9a')||_0x53e005===_0x42f7('0x9b')||_0x53e005==='BigIntAttributeMetadata'||_0x53e005===_0x42f7('0x9c')||_0x53e005===_0x42f7('0x9d')||_0x53e005===_0x42f7('0x9e')||_0x53e005===_0x42f7('0x9f')||_0x53e005==='EntityNameAttributeMetadata'||_0x53e005===_0x42f7('0xa0')||_0x53e005===_0x42f7('0xa1')){_0x50db7c[_0x42f7('0x95')](getInputList(_0x55ffca,_0x4b4a1b,_0x53e005,_0x40c2fd,_0x1c16e0[_0x42f7('0x8d')],_0x41544a[_0x42f7('0x8d')],_0x1231e));}}});return Promise[_0x42f7('0x99')](_0x50db7c);})['then'](function(_0xc632a6){_0x4e9d01=_0xc632a6[0x0];var _0x33056b=_0x16c62a[_0x42f7('0x7e')](_0x130bf4)['concat'](_0x4e9d01);var _0x2abe44={'count':_0x33056b[_0x42f7('0x30')],'rows':_0x33056b};return _0x2abe44;})[_0x42f7('0xf')](respondWithResult(_0x40c90f,null))[_0x42f7('0x2b')](function(_0x48acbd){var _0x133767=_0x544f30[_0x42f7('0x1a')][_0x42f7('0xa2')]?0x1f4:_0x48acbd['statusCode']||0x1f4;logger[_0x42f7('0x11')](_0x48acbd['stack']);delete _0x48acbd[_0x42f7('0x12')];if(_0x133767===0x191){_0x133767=0x190;}_0x40c90f[_0x42f7('0xa3')](_0x133767)[_0x42f7('0xa4')](_0x544f30[_0x42f7('0x1a')][_0x42f7('0xa2')]?{'message':_0x42f7('0xa5'),'statusCode':_0x48acbd[_0x42f7('0xa6')]}:_0x48acbd);});};function getSelectList(_0x1219be,_0x48b24a,_0x45547c,_0x1b130a,_0x24332c,_0xc8facf){var _0xf47a3d={'method':_0x42f7('0x89'),'uri':_0x1219be+_0x42f7('0x8e')+_0x1b130a+_0x42f7('0xa7')+_0x24332c+_0x42f7('0xa8')+_0x42f7('0xa9'),'headers':{'Authorization':'Bearer\x20'+_0xc8facf,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xf47a3d)[_0x42f7('0xf')](function(_0x1b63b6){var _0x1bc594=[];var _0x260595=_0x1b63b6['OptionSet'][_0x42f7('0xaa')];_0x260595[_0x42f7('0x96')](function(_0x1acadf){_0x1bc594[_0x42f7('0x95')]({'name':_0x1acadf[_0x42f7('0xab')][_0x42f7('0xac')][_0x42f7('0xab')],'value':String(_0x1acadf['Value'])});});var _0x438717={'id':_0x48b24a+'_'+_0x1b63b6[_0x42f7('0x92')],'name':_0x1b63b6['DisplayName'][_0x42f7('0xac')]['Label'],'custom':![],'options':_0x1bc594};_0x45547c[_0x42f7('0x95')](_0x438717);return _0x45547c;});}function getBooleanList(_0x18eed6,_0x44dfd0,_0x2d48d4,_0x5dc312,_0x46ef4b,_0x23356b){var _0x3280eb={'method':_0x42f7('0x89'),'uri':_0x18eed6+_0x42f7('0x8e')+_0x5dc312+_0x42f7('0xa7')+_0x46ef4b+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x42f7('0x90')+_0x23356b,'If-None-Match':null,'OData-Version':_0x42f7('0x8b')},'json':!![]};return rp(_0x3280eb)[_0x42f7('0xf')](function(_0x409502){var _0x53faf1=[];_0x53faf1[_0x42f7('0x95')]({'name':_0x409502['OptionSet'][_0x42f7('0xad')][_0x42f7('0xab')]['UserLocalizedLabel'][_0x42f7('0xab')],'value':_0x42f7('0xae')},{'name':_0x409502[_0x42f7('0xaf')][_0x42f7('0xb0')]['Label'][_0x42f7('0xac')]['Label'],'value':_0x42f7('0xb1')});var _0x1e0aa1={'id':_0x44dfd0+'_'+_0x409502[_0x42f7('0x92')],'name':_0x409502[_0x42f7('0xb2')][_0x42f7('0xac')][_0x42f7('0xab')],'custom':![],'options':_0x53faf1};_0x2d48d4[_0x42f7('0x95')](_0x1e0aa1);return _0x2d48d4;});}function getInputList(_0x2febe9,_0x131ce3,_0x6ad17b,_0xe6ced0,_0x2952b9,_0x4f7cfe,_0x52ce0c){var _0x4a54d2={'method':_0x42f7('0x89'),'uri':_0x2febe9+'EntityDefinitions('+_0x2952b9+_0x42f7('0xa7')+_0x4f7cfe+_0x42f7('0xb3')+_0x6ad17b+_0x42f7('0xb4'),'headers':{'Authorization':'Bearer\x20'+_0x52ce0c,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4a54d2)[_0x42f7('0xf')](function(_0x2f594e){var _0x1cd0c3={'id':_0x131ce3+'_'+_0x2f594e[_0x42f7('0x92')],'name':_0x2f594e['DisplayName'][_0x42f7('0xac')]?_0x2f594e[_0x42f7('0xb2')]['UserLocalizedLabel']['Label']:_0x2f594e[_0x42f7('0x92')],'custom':![],'options':[]};_0xe6ced0[_0x42f7('0x95')](_0x1cd0c3);return _0xe6ced0;});} \ No newline at end of file +var _0xc102=['../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','set','then','destroy','end','sendStatus','error','name','send','index','Dynamics365Account','fieldName','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','keys','rawAttributes','fields','find','create','body','update','params','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','Descriptions','slice','substring','lastIndexOf','format','getFields','ticketType','incident','Incident','PhoneCall','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','billedserviceunits','contactidname','contactidyominame','createdbyexternalpartyname','createdbyexternalpartyyominame','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','statecode','statuscode','subjectidname','ticketnumber','concat','username','password','remoteUri','tenantId','clientSecret','CloudProvider','data7','modernAuthentication','data5','POST','https://login.microsoftonline.com/','clientId','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','remove','includes','LogicalName','forEach','@odata.type','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','stack','test','Wrong\x20credentials','statusCode','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','request-promise','util','lodash'];(function(_0x114a58,_0x48050){var _0x2c09c9=function(_0xf2348f){while(--_0xf2348f){_0x114a58['push'](_0x114a58['shift']());}};_0x2c09c9(++_0x48050);}(_0xc102,0xb8));var _0x2c10=function(_0x4194a9,_0x5f1599){_0x4194a9=_0x4194a9-0x0;var _0x5b9b5c=_0xc102[_0x4194a9];return _0x5b9b5c;};'use strict';var rp=require(_0x2c10('0x0'));var util=require(_0x2c10('0x1'));var _=require(_0x2c10('0x2'));var qs=require(_0x2c10('0x3'));var logger=require(_0x2c10('0x4'))(_0x2c10('0x5'));var db=require(_0x2c10('0x6'))['db'];var integrations=require(_0x2c10('0x7'));function respondWithResult(_0x44161e,_0x180092){_0x180092=_0x180092||0xc8;return function(_0x178f61){if(_0x178f61){return _0x44161e[_0x2c10('0x8')](_0x180092)[_0x2c10('0x9')](_0x178f61);}};}function respondWithFilteredResult(_0x1fe1d4,_0x43b9cb){return function(_0x2b9e60){if(_0x2b9e60){var _0x743064=typeof _0x43b9cb[_0x2c10('0xa')]===_0x2c10('0xb')&&typeof _0x43b9cb['limit']===_0x2c10('0xb');var _0x24b124=_0x2b9e60[_0x2c10('0xc')];var _0x5ba5d6=_0x743064?0x0:_0x43b9cb[_0x2c10('0xa')];var _0x3fd1eb=_0x743064?_0x2b9e60[_0x2c10('0xc')]:_0x43b9cb[_0x2c10('0xa')]+_0x43b9cb['limit'];var _0x1b4d18;if(_0x3fd1eb>=_0x24b124){_0x3fd1eb=_0x24b124;_0x1b4d18=0xc8;}else{_0x1b4d18=0xce;}_0x1fe1d4['status'](_0x1b4d18);return _0x1fe1d4[_0x2c10('0xd')]('Content-Range',_0x5ba5d6+'-'+_0x3fd1eb+'/'+_0x24b124)[_0x2c10('0x9')](_0x2b9e60);}return null;};}function saveUpdates(_0x56aa3c){return function(_0x2bfc07){if(_0x2bfc07){return _0x2bfc07['update'](_0x56aa3c)[_0x2c10('0xe')](function(_0x3a8531){return _0x3a8531;});}return null;};}function removeEntity(_0x1de18a){return function(_0xbb8da7){if(_0xbb8da7){return _0xbb8da7[_0x2c10('0xf')]()[_0x2c10('0xe')](function(){_0x1de18a[_0x2c10('0x8')](0xcc)[_0x2c10('0x10')]();});}};}function handleEntityNotFound(_0x360961){return function(_0x224c9c){if(!_0x224c9c){_0x360961[_0x2c10('0x11')](0x194);}return _0x224c9c;};}function handleError(_0x21e155,_0x4a5ce5){_0x4a5ce5=_0x4a5ce5||0x1f4;return function(_0xebe12e){logger[_0x2c10('0x12')](_0xebe12e['stack']);if(_0xebe12e['name']){delete _0xebe12e[_0x2c10('0x13')];}_0x21e155[_0x2c10('0x8')](_0x4a5ce5)[_0x2c10('0x14')](_0xebe12e);};}exports[_0x2c10('0x15')]=function(_0x16f3b2,_0x320d94){var _0x24220d={},_0x3008c4={},_0x5d2f85={'count':0x0,'rows':[]};var _0x340951=_['map'](db[_0x2c10('0x16')]['rawAttributes'],function(_0x50e19e){return{'name':_0x50e19e[_0x2c10('0x17')],'type':_0x50e19e['type']['key']};});_0x3008c4[_0x2c10('0x18')]=_[_0x2c10('0x19')](_0x340951,_0x2c10('0x13'));_0x3008c4[_0x2c10('0x1a')]=_['keys'](_0x16f3b2[_0x2c10('0x1a')]);_0x3008c4[_0x2c10('0x1b')]=_[_0x2c10('0x1c')](_0x3008c4[_0x2c10('0x18')],_0x3008c4[_0x2c10('0x1a')]);_0x24220d[_0x2c10('0x1d')]=_[_0x2c10('0x1c')](_0x3008c4['model'],qs['fields'](_0x16f3b2[_0x2c10('0x1a')]['fields']));_0x24220d[_0x2c10('0x1d')]=_0x24220d[_0x2c10('0x1d')][_0x2c10('0x1e')]?_0x24220d['attributes']:_0x3008c4[_0x2c10('0x18')];if(!_0x16f3b2['query'][_0x2c10('0x1f')](_0x2c10('0x20'))){_0x24220d[_0x2c10('0x21')]=qs[_0x2c10('0x21')](_0x16f3b2['query'][_0x2c10('0x21')]);_0x24220d['offset']=qs['offset'](_0x16f3b2[_0x2c10('0x1a')][_0x2c10('0xa')]);}_0x24220d[_0x2c10('0x22')]=qs[_0x2c10('0x23')](_0x16f3b2[_0x2c10('0x1a')]['sort']);_0x24220d[_0x2c10('0x24')]=qs[_0x2c10('0x1b')](_[_0x2c10('0x25')](_0x16f3b2[_0x2c10('0x1a')],_0x3008c4[_0x2c10('0x1b')]),_0x340951);if(_0x16f3b2[_0x2c10('0x1a')][_0x2c10('0x26')]){_0x24220d[_0x2c10('0x24')]=_[_0x2c10('0x27')](_0x24220d[_0x2c10('0x24')],{'$or':_['map'](_0x340951,function(_0x13e7ad){if(_0x13e7ad[_0x2c10('0x28')]!==_0x2c10('0x29')){var _0x313659={};_0x313659[_0x13e7ad[_0x2c10('0x13')]]={'$like':'%'+_0x16f3b2[_0x2c10('0x1a')][_0x2c10('0x26')]+'%'};return _0x313659;}})});}_0x24220d=_[_0x2c10('0x27')]({},_0x24220d,_0x16f3b2[_0x2c10('0x2a')]);var _0x904e61={'where':_0x24220d['where']};return db[_0x2c10('0x16')]['count'](_0x904e61)[_0x2c10('0xe')](function(_0x567a84){_0x5d2f85[_0x2c10('0xc')]=_0x567a84;if(_0x16f3b2[_0x2c10('0x1a')][_0x2c10('0x2b')]){_0x24220d[_0x2c10('0x2c')]=[{'all':!![]}];}return db[_0x2c10('0x16')][_0x2c10('0x2d')](_0x24220d);})['then'](function(_0x19ea1f){_0x5d2f85['rows']=_0x19ea1f;return _0x5d2f85;})[_0x2c10('0xe')](respondWithFilteredResult(_0x320d94,_0x24220d))[_0x2c10('0x2e')](handleError(_0x320d94,null));};exports['show']=function(_0x5c325c,_0x315a5b){var _0x2b9bcf={'raw':![],'where':{'id':_0x5c325c['params']['id']}},_0x30f8ef={};_0x30f8ef['model']=_[_0x2c10('0x2f')](db['Dynamics365Account'][_0x2c10('0x30')]);_0x30f8ef[_0x2c10('0x1a')]=_[_0x2c10('0x2f')](_0x5c325c[_0x2c10('0x1a')]);_0x30f8ef[_0x2c10('0x1b')]=_['intersection'](_0x30f8ef[_0x2c10('0x18')],_0x30f8ef[_0x2c10('0x1a')]);_0x2b9bcf[_0x2c10('0x1d')]=_[_0x2c10('0x1c')](_0x30f8ef['model'],qs[_0x2c10('0x31')](_0x5c325c[_0x2c10('0x1a')][_0x2c10('0x31')]));_0x2b9bcf[_0x2c10('0x1d')]=_0x2b9bcf[_0x2c10('0x1d')]['length']?_0x2b9bcf[_0x2c10('0x1d')]:_0x30f8ef[_0x2c10('0x18')];if(_0x5c325c[_0x2c10('0x1a')][_0x2c10('0x2b')]){_0x2b9bcf['include']=[{'all':!![]}];}_0x2b9bcf=_[_0x2c10('0x27')]({},_0x2b9bcf,_0x5c325c[_0x2c10('0x2a')]);return db[_0x2c10('0x16')][_0x2c10('0x32')](_0x2b9bcf)[_0x2c10('0xe')](handleEntityNotFound(_0x315a5b,null))[_0x2c10('0xe')](respondWithResult(_0x315a5b,null))['catch'](handleError(_0x315a5b,null));};exports['create']=function(_0x38916d,_0x5bcc09){return db[_0x2c10('0x16')][_0x2c10('0x33')](_0x38916d[_0x2c10('0x34')],{})['then'](respondWithResult(_0x5bcc09,0xc9))['catch'](handleError(_0x5bcc09,null));};exports[_0x2c10('0x35')]=function(_0x2162ab,_0x5e317b){if(_0x2162ab[_0x2c10('0x34')]['id']){delete _0x2162ab[_0x2c10('0x34')]['id'];}return db[_0x2c10('0x16')]['find']({'where':{'id':_0x2162ab['params']['id']}})[_0x2c10('0xe')](handleEntityNotFound(_0x5e317b,null))[_0x2c10('0xe')](saveUpdates(_0x2162ab['body'],null))[_0x2c10('0xe')](respondWithResult(_0x5e317b,null))['catch'](handleError(_0x5e317b,null));};exports[_0x2c10('0xf')]=function(_0x5b9fc3,_0xab09d2){return db[_0x2c10('0x16')][_0x2c10('0x32')]({'where':{'id':_0x5b9fc3[_0x2c10('0x36')]['id']}})[_0x2c10('0xe')](handleEntityNotFound(_0xab09d2,null))[_0x2c10('0xe')](removeEntity(_0xab09d2,null))[_0x2c10('0x2e')](handleError(_0xab09d2,null));};exports[_0x2c10('0x37')]=function(_0x5c8eef,_0x2d4c35){var _0x14e354={};var _0x1cccc1={};var _0x28b9b2;var _0x2714ad;return db['Dynamics365Account']['findOne']({'where':{'id':_0x5c8eef[_0x2c10('0x36')]['id']}})[_0x2c10('0xe')](handleEntityNotFound(_0x2d4c35,null))[_0x2c10('0xe')](function(_0x469b87){if(_0x469b87){_0x28b9b2=_0x469b87;_0x1cccc1[_0x2c10('0x18')]=_[_0x2c10('0x2f')](db['Dynamics365Configuration'][_0x2c10('0x30')]);_0x1cccc1[_0x2c10('0x1a')]=_[_0x2c10('0x2f')](_0x5c8eef['query']);_0x1cccc1[_0x2c10('0x1b')]=_[_0x2c10('0x1c')](_0x1cccc1[_0x2c10('0x18')],_0x1cccc1[_0x2c10('0x1a')]);_0x14e354[_0x2c10('0x1d')]=_[_0x2c10('0x1c')](_0x1cccc1['model'],qs[_0x2c10('0x31')](_0x5c8eef[_0x2c10('0x1a')][_0x2c10('0x31')]));_0x14e354['attributes']=_0x14e354[_0x2c10('0x1d')][_0x2c10('0x1e')]?_0x14e354[_0x2c10('0x1d')]:_0x1cccc1['model'];_0x14e354[_0x2c10('0x22')]=qs[_0x2c10('0x23')](_0x5c8eef['query'][_0x2c10('0x23')]);_0x14e354[_0x2c10('0x24')]=qs[_0x2c10('0x1b')](_[_0x2c10('0x25')](_0x5c8eef[_0x2c10('0x1a')],_0x1cccc1[_0x2c10('0x1b')]));if(_0x5c8eef[_0x2c10('0x1a')]['filter']){_0x14e354['where']=_[_0x2c10('0x27')](_0x14e354[_0x2c10('0x24')],{'$or':_[_0x2c10('0x19')](_0x14e354['attributes'],function(_0xcc1620){var _0xd5e7b2={};_0xd5e7b2[_0xcc1620]={'$like':'%'+_0x5c8eef[_0x2c10('0x1a')][_0x2c10('0x26')]+'%'};return _0xd5e7b2;})});}_0x14e354=_[_0x2c10('0x27')]({},_0x14e354,_0x5c8eef[_0x2c10('0x2a')]);return _0x28b9b2['getConfigurations'](_0x14e354);}})['then'](function(_0x35a850){if(_0x35a850){_0x2714ad=_0x35a850[_0x2c10('0x1e')];if(!_0x5c8eef['query'][_0x2c10('0x1f')](_0x2c10('0x20'))){_0x14e354['limit']=qs[_0x2c10('0x21')](_0x5c8eef[_0x2c10('0x1a')][_0x2c10('0x21')]);_0x14e354[_0x2c10('0xa')]=qs[_0x2c10('0xa')](_0x5c8eef[_0x2c10('0x1a')][_0x2c10('0xa')]);}return _0x28b9b2[_0x2c10('0x37')](_0x14e354);}})['then'](function(_0x422222){if(_0x422222){return _0x422222?{'count':_0x2714ad,'rows':_0x422222}:null;}})[_0x2c10('0xe')](respondWithResult(_0x2d4c35,null))[_0x2c10('0x2e')](handleError(_0x2d4c35,null));};exports[_0x2c10('0x38')]=function(_0xe7b3b3,_0x3e500f){if(_0xe7b3b3[_0x2c10('0x34')]['id']){delete _0xe7b3b3['body']['id'];}return db[_0x2c10('0x16')][_0x2c10('0x39')]({'where':{'id':_0xe7b3b3[_0x2c10('0x36')]['id']}})['then'](handleEntityNotFound(_0x3e500f,null))[_0x2c10('0xe')](function(_0x7941ac){if(_0x7941ac){_0xe7b3b3[_0x2c10('0x34')][_0x2c10('0x3a')]=_0x7941ac['id'];_0xe7b3b3[_0x2c10('0x34')][_0x2c10('0x3b')]=integrations[_0x2c10('0x3c')](_0xe7b3b3[_0x2c10('0x34')][_0x2c10('0x3d')],_0xe7b3b3[_0x2c10('0x34')][_0x2c10('0x28')]);_0xe7b3b3['body']['Descriptions']=integrations[_0x2c10('0x3e')](_0xe7b3b3[_0x2c10('0x34')]['channel'],_0xe7b3b3[_0x2c10('0x34')]['type']);return db['Dynamics365Configuration'][_0x2c10('0x33')](_0xe7b3b3[_0x2c10('0x34')],{'include':[{'model':db[_0x2c10('0x3f')],'as':_0x2c10('0x3b')},{'model':db[_0x2c10('0x3f')],'as':_0x2c10('0x40')}]});}return null;})[_0x2c10('0xe')](respondWithResult(_0x3e500f,null))[_0x2c10('0x2e')](handleError(_0x3e500f,null));};function sanitizeRemoteUri(_0x3b3a94){var _0xa8560f=_0x3b3a94[_0x2c10('0x41')](-0x1);if(_0xa8560f==='/')return _0x3b3a94[_0x2c10('0x42')](0x0,_0x3b3a94[_0x2c10('0x43')](_0xa8560f));return _0x3b3a94;}function getWebApiUrl(_0x2514fd){return util[_0x2c10('0x44')]('%s/api/data/v9.0/',_0x2514fd);}exports[_0x2c10('0x45')]=function(_0xd367a3,_0x3dc383){var _0x3b98a9=_0xd367a3[_0x2c10('0x1a')][_0x2c10('0x46')];var _0x41f56a=_0x3b98a9===_0x2c10('0x47')?_0x2c10('0x48'):_0x2c10('0x49');var _0x448648='';var _0x1da198='';var _0x1f357e='';var _0x45667f='';var _0x1a32db='';var _0x3c362f='';var _0x2dd6bd='';var _0x54a101='';var _0x392568=['title','description',_0x2c10('0x4a'),_0x2c10('0x4b'),'caseorigincode',_0x2c10('0x4c'),_0x2c10('0x4d'),_0x2c10('0x4e'),_0x2c10('0x4f'),'phonecall_activity_parties'];var _0xf01766=[_0x2c10('0x50'),_0x2c10('0x51'),'actualserviceunits',_0x2c10('0x52'),_0x2c10('0x53'),_0x2c10('0x54'),'contractdetailidname','contractidname',_0x2c10('0x55'),_0x2c10('0x56'),'createdbyname','createdbyyominame',_0x2c10('0x57'),_0x2c10('0x58'),'createdonbehalfbyyominame',_0x2c10('0x59'),_0x2c10('0x5a'),_0x2c10('0x5b'),_0x2c10('0x5c'),_0x2c10('0x5d'),_0x2c10('0x5e'),_0x2c10('0x5f'),_0x2c10('0x60'),_0x2c10('0x61'),_0x2c10('0x62'),_0x2c10('0x63'),_0x2c10('0x64'),_0x2c10('0x65'),_0x2c10('0x66'),'lastonholdtime',_0x2c10('0x67'),_0x2c10('0x68'),_0x2c10('0x69'),_0x2c10('0x6a'),_0x2c10('0x6b'),_0x2c10('0x6c'),_0x2c10('0x6d'),_0x2c10('0x6e'),'msdyn_incidenttypename',_0x2c10('0x6f'),'numberofchildincidents',_0x2c10('0x70'),_0x2c10('0x71'),_0x2c10('0x72'),_0x2c10('0x73'),_0x2c10('0x74'),_0x2c10('0x75'),_0x2c10('0x76'),'primarycontactidyominame','prioritycodename',_0x2c10('0x77'),_0x2c10('0x78'),_0x2c10('0x79'),_0x2c10('0x7a'),_0x2c10('0x7b'),_0x2c10('0x7c'),_0x2c10('0x7d'),_0x2c10('0x7e'),'slainvokedidname','slaname','socialprofileidname',_0x2c10('0x7f'),_0x2c10('0x80'),_0x2c10('0x81'),_0x2c10('0x82'),'timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber'];var _0x3c8de9=_0x392568[_0x2c10('0x83')](_0xf01766);return db[_0x2c10('0x16')][_0x2c10('0x39')]({'where':{'id':_0xd367a3[_0x2c10('0x36')]['id']},'attributes':['id',_0x2c10('0x84'),_0x2c10('0x85'),_0x2c10('0x86'),_0x2c10('0x87'),'clientId',_0x2c10('0x88'),'modernAuthentication'],'include':[{'model':db[_0x2c10('0x89')],'as':_0x2c10('0x89'),'attributes':['id','data5',_0x2c10('0x8a')]}]})[_0x2c10('0xe')](handleEntityNotFound(_0x3dc383,null))[_0x2c10('0xe')](function(_0x8bfb9){if(_0x8bfb9){if(_0x8bfb9[_0x2c10('0x8b')]){_0x8bfb9['access_token']=_0x8bfb9[_0x2c10('0x89')][_0x2c10('0x8c')];_0x54a101=sanitizeRemoteUri(_0x8bfb9[_0x2c10('0x89')][_0x2c10('0x8a')]);_0x2dd6bd=getWebApiUrl(_0x54a101);return _0x8bfb9;}_0x54a101=sanitizeRemoteUri(_0x8bfb9[_0x2c10('0x86')]);_0x2dd6bd=getWebApiUrl(_0x54a101);var _0x44e2be={'method':_0x2c10('0x8d'),'uri':_0x2c10('0x8e')+_0x8bfb9[_0x2c10('0x87')]+'/oauth2/token','form':{'client_id':_0x8bfb9[_0x2c10('0x8f')],'resource':_0x54a101,'username':_0x8bfb9[_0x2c10('0x84')],'password':_0x8bfb9[_0x2c10('0x85')],'grant_type':'password','client_secret':_0x8bfb9['clientSecret']},'json':!![]};return rp(_0x44e2be);}})[_0x2c10('0xe')](function(_0x3e4e4d){_0x3c362f=_0x3e4e4d[_0x2c10('0x90')];var _0x15079a={'method':_0x2c10('0x91'),'uri':encodeURI(_0x2dd6bd+_0x2c10('0x92')+_0x41f56a+'\x27'),'headers':{'Authorization':_0x2c10('0x93')+_0x3c362f,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x15079a);})[_0x2c10('0xe')](function(_0x12e9fa){var _0x2d595a=_0x12e9fa['value'][0x0];var _0x34c329=_0x2d595a[_0x2c10('0x94')];var _0x5d1320={'method':'GET','uri':_0x2dd6bd+'EntityDefinitions('+_0x34c329+_0x2c10('0x95'),'headers':{'Authorization':_0x2c10('0x93')+_0x3c362f,'If-None-Match':null,'OData-Version':_0x2c10('0x96')},'json':!![]};return rp(_0x5d1320);})['then'](function(_0x63d866){_0x448648=_0x63d866;_0x1da198=_0x448648[_0x2c10('0x97')];_0x1da198=_[_0x2c10('0x98')](_0x1da198,function(_0x1d8bce){return!_0x3c8de9[_0x2c10('0x99')](_0x1d8bce[_0x2c10('0x9a')]);});var _0x1f3082=[];var _0xe1bca3=[];_0x1da198[_0x2c10('0x9b')](function(_0x29087e){if(_0x29087e[_0x2c10('0x9c')]){var _0x37ed4e=_0x29087e[_0x2c10('0x9c')][_0x2c10('0x42')](_0x29087e[_0x2c10('0x9c')][_0x2c10('0x43')]('.')+0x1);if(_0x37ed4e==='PicklistAttributeMetadata'){_0x1f3082[_0x2c10('0x9d')](getSelectList(_0x2dd6bd,_0x3b98a9,_0xe1bca3,_0x448648[_0x2c10('0x94')],_0x29087e[_0x2c10('0x94')],_0x3c362f));}}});return Promise[_0x2c10('0x9e')](_0x1f3082);})[_0x2c10('0xe')](function(_0x3a6b2c){_0x1f357e=_0x3a6b2c[0x0];var _0x5a5eab=[];var _0x46fbde=[];_0x1da198[_0x2c10('0x9b')](function(_0x4800fd){if(!_[_0x2c10('0x9f')](_0x4800fd[_0x2c10('0x9c')])){var _0xf17a90=_0x4800fd[_0x2c10('0x9c')][_0x2c10('0x42')](_0x4800fd['@odata.type'][_0x2c10('0x43')]('.')+0x1);if(_0xf17a90===_0x2c10('0xa0')){_0x5a5eab[_0x2c10('0x9d')](getBooleanList(_0x2dd6bd,_0x3b98a9,_0x46fbde,_0x448648[_0x2c10('0x94')],_0x4800fd[_0x2c10('0x94')],_0x3c362f));}}});return Promise[_0x2c10('0x9e')](_0x5a5eab);})[_0x2c10('0xe')](function(_0x23463b){_0x45667f=_0x23463b[0x0];var _0x4e9193=[];var _0x4906b3=[];_0x1da198[_0x2c10('0x9b')](function(_0x48183f){if(_0x48183f['@odata.type']){var _0x2ddf03=_0x48183f[_0x2c10('0x9c')][_0x2c10('0x42')](_0x48183f['@odata.type']['lastIndexOf']('.')+0x1);if(_0x2ddf03===_0x2c10('0xa1')||_0x2ddf03===_0x2c10('0xa2')||_0x2ddf03===_0x2c10('0xa3')||_0x2ddf03===_0x2c10('0xa4')||_0x2ddf03===_0x2c10('0xa5')||_0x2ddf03===_0x2c10('0xa6')||_0x2ddf03===_0x2c10('0xa7')||_0x2ddf03===_0x2c10('0xa8')||_0x2ddf03==='StateAttributeMetadata'||_0x2ddf03===_0x2c10('0xa9')){_0x4e9193[_0x2c10('0x9d')](getInputList(_0x2dd6bd,_0x3b98a9,_0x2ddf03,_0x4906b3,_0x448648[_0x2c10('0x94')],_0x48183f[_0x2c10('0x94')],_0x3c362f));}}});return Promise[_0x2c10('0x9e')](_0x4e9193);})[_0x2c10('0xe')](function(_0x45cb90){_0x1a32db=_0x45cb90[0x0];var _0x1de71e=_0x1f357e[_0x2c10('0x83')](_0x45667f)['concat'](_0x1a32db);var _0xda56f8={'count':_0x1de71e[_0x2c10('0x1e')],'rows':_0x1de71e};return _0xda56f8;})[_0x2c10('0xe')](respondWithResult(_0x3dc383,null))['catch'](function(_0x17cb38){var _0x8690e7=_0xd367a3['query']['test']?0x1f4:_0x17cb38['statusCode']||0x1f4;logger['error'](_0x17cb38[_0x2c10('0xaa')]);delete _0x17cb38[_0x2c10('0x13')];if(_0x8690e7===0x191){_0x8690e7=0x190;}_0x3dc383['status'](_0x8690e7)[_0x2c10('0x14')](_0xd367a3[_0x2c10('0x1a')][_0x2c10('0xab')]?{'message':_0x2c10('0xac'),'statusCode':_0x17cb38[_0x2c10('0xad')]}:_0x17cb38);});};function getSelectList(_0xa4b6f9,_0x3251fe,_0x46ddf3,_0xbff0e9,_0x179e95,_0x79be92){var _0x27722b={'method':_0x2c10('0x91'),'uri':_0xa4b6f9+_0x2c10('0xae')+_0xbff0e9+_0x2c10('0xaf')+_0x179e95+_0x2c10('0xb0')+_0x2c10('0xb1'),'headers':{'Authorization':_0x2c10('0x93')+_0x79be92,'If-None-Match':null,'OData-Version':_0x2c10('0x96')},'json':!![]};return rp(_0x27722b)[_0x2c10('0xe')](function(_0x2058ff){var _0x28581b=[];var _0x5e8796=_0x2058ff[_0x2c10('0xb2')]['Options'];_0x5e8796[_0x2c10('0x9b')](function(_0x56302f){_0x28581b[_0x2c10('0x9d')]({'name':_0x56302f[_0x2c10('0xb3')][_0x2c10('0xb4')][_0x2c10('0xb3')],'value':String(_0x56302f[_0x2c10('0xb5')])});});var _0x5ac676={'id':_0x3251fe+'_'+_0x2058ff[_0x2c10('0x9a')],'name':_0x2058ff[_0x2c10('0xb6')][_0x2c10('0xb4')][_0x2c10('0xb3')],'custom':![],'options':_0x28581b};_0x46ddf3[_0x2c10('0x9d')](_0x5ac676);return _0x46ddf3;});}function getBooleanList(_0x99185,_0x464347,_0x113ef2,_0x3774da,_0x39379a,_0x43afff){var _0x2335e8={'method':'GET','uri':_0x99185+_0x2c10('0xae')+_0x3774da+_0x2c10('0xaf')+_0x39379a+_0x2c10('0xb7'),'headers':{'Authorization':_0x2c10('0x93')+_0x43afff,'If-None-Match':null,'OData-Version':_0x2c10('0x96')},'json':!![]};return rp(_0x2335e8)['then'](function(_0x19006b){var _0xf523a9=[];_0xf523a9[_0x2c10('0x9d')]({'name':_0x19006b[_0x2c10('0xb2')][_0x2c10('0xb8')][_0x2c10('0xb3')][_0x2c10('0xb4')]['Label'],'value':_0x2c10('0xb9')},{'name':_0x19006b[_0x2c10('0xb2')][_0x2c10('0xba')][_0x2c10('0xb3')][_0x2c10('0xb4')][_0x2c10('0xb3')],'value':'false'});var _0x2de8ed={'id':_0x464347+'_'+_0x19006b[_0x2c10('0x9a')],'name':_0x19006b[_0x2c10('0xb6')][_0x2c10('0xb4')]['Label'],'custom':![],'options':_0xf523a9};_0x113ef2['push'](_0x2de8ed);return _0x113ef2;});}function getInputList(_0x54cf51,_0x15c1c3,_0x51b9fa,_0x47e99c,_0x1aef97,_0x465894,_0xcf874d){var _0x744020={'method':_0x2c10('0x91'),'uri':_0x54cf51+'EntityDefinitions('+_0x1aef97+')/Attributes('+_0x465894+')/Microsoft.Dynamics.CRM.'+_0x51b9fa+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0xcf874d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x744020)['then'](function(_0x3e6c2b){var _0x3f281e={'id':_0x15c1c3+'_'+_0x3e6c2b['LogicalName'],'name':_0x3e6c2b[_0x2c10('0xb6')][_0x2c10('0xb4')]?_0x3e6c2b[_0x2c10('0xb6')][_0x2c10('0xb4')][_0x2c10('0xb3')]:_0x3e6c2b['LogicalName'],'custom':![],'options':[]};_0x47e99c[_0x2c10('0x9d')](_0x3f281e);return _0x47e99c;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 4b0b75b..eac1a80 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 _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x6c8726,_0x5e3c0b){var _0xc68c5b=function(_0x117f46){while(--_0x117f46){_0x6c8726['push'](_0x6c8726['shift']());}};_0xc68c5b(++_0x5e3c0b);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['define','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x1a97d6,_0x126868){var _0x4c4ff0=function(_0x54a475){while(--_0x54a475){_0x1a97d6['push'](_0x1a97d6['shift']());}};_0x4c4ff0(++_0x126868);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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'));var integrations=require(_0x0a9e('0x8'));module['exports']=function(_0x219af0,_0x441e3a){return _0x219af0[_0x0a9e('0x9')]('Dynamics365Account',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 c87ca30..12783f5 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 _0x6ca5=['Dynamics365Account','findAll','options','attributes','limit','include','model','map','debug','ShowDynamics365Account','find','raw','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account'];(function(_0x2dc2ed,_0x10e921){var _0x3f8ab3=function(_0x4e41d4){while(--_0x4e41d4){_0x2dc2ed['push'](_0x2dc2ed['shift']());}};_0x3f8ab3(++_0x10e921);}(_0x6ca5,0x16c));var _0x56ca=function(_0x36b126,_0x30151d){_0x36b126=_0x36b126-0x0;var _0x41f5ab=_0x6ca5[_0x36b126];return _0x41f5ab;};'use strict';var _=require(_0x56ca('0x0'));var util=require(_0x56ca('0x1'));var moment=require(_0x56ca('0x2'));var BPromise=require(_0x56ca('0x3'));var rs=require(_0x56ca('0x4'));var fs=require('fs');var Redis=require(_0x56ca('0x5'));var db=require(_0x56ca('0x6'))['db'];var utils=require(_0x56ca('0x7'));var logger=require(_0x56ca('0x8'))(_0x56ca('0x9'));var config=require(_0x56ca('0xa'));var jayson=require(_0x56ca('0xb'));var client=jayson[_0x56ca('0xc')][_0x56ca('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x30ce8c,_0x4fe2fa,_0x1d3eeb){return new BPromise(function(_0x204471,_0x415bf7){return client[_0x56ca('0xe')](_0x30ce8c,_0x1d3eeb)[_0x56ca('0xf')](function(_0x54abfd){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x4fe2fa,_0x56ca('0x10'));logger['debug'](_0x56ca('0x11'),_0x4fe2fa,_0x56ca('0x10'),JSON[_0x56ca('0x12')](_0x54abfd));if(_0x54abfd[_0x56ca('0x13')]){if(_0x54abfd[_0x56ca('0x13')][_0x56ca('0x14')]===0x1f4){logger[_0x56ca('0x13')](_0x56ca('0x15'),_0x4fe2fa,_0x54abfd[_0x56ca('0x13')]['message']);return _0x415bf7(_0x54abfd['error']['message']);}logger[_0x56ca('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x4fe2fa,_0x54abfd['error'][_0x56ca('0x16')]);return _0x204471(_0x54abfd[_0x56ca('0x13')]['message']);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x4fe2fa,_0x56ca('0x10'));_0x204471(_0x54abfd[_0x56ca('0x17')][_0x56ca('0x16')]);}})[_0x56ca('0x18')](function(_0x1f0320){logger[_0x56ca('0x13')](_0x56ca('0x15'),_0x4fe2fa,_0x1f0320);_0x415bf7(_0x1f0320);});});}exports[_0x56ca('0x19')]=function(_0xd31104){var _0x5031b7=this;return new Promise(function(_0x133d1a,_0x133b70){return db[_0x56ca('0x1a')][_0x56ca('0x1b')]({'raw':_0xd31104[_0x56ca('0x1c')]?_0xd31104[_0x56ca('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xd31104['options']?_0xd31104[_0x56ca('0x1c')]['where']||null:null,'attributes':_0xd31104['options']?_0xd31104['options'][_0x56ca('0x1d')]||null:null,'limit':_0xd31104[_0x56ca('0x1c')]?_0xd31104[_0x56ca('0x1c')][_0x56ca('0x1e')]||null:null,'include':_0xd31104[_0x56ca('0x1c')]?_0xd31104['options'][_0x56ca('0x1f')]?_['map'](_0xd31104['options'][_0x56ca('0x1f')],function(_0x435bea){return{'model':db[_0x435bea[_0x56ca('0x20')]],'as':_0x435bea['as'],'attributes':_0x435bea['attributes'],'include':_0x435bea[_0x56ca('0x1f')]?_[_0x56ca('0x21')](_0x435bea[_0x56ca('0x1f')],function(_0x4c1b7a){return{'model':db[_0x4c1b7a[_0x56ca('0x20')]],'as':_0x4c1b7a['as'],'attributes':_0x4c1b7a[_0x56ca('0x1d')],'include':_0x4c1b7a[_0x56ca('0x1f')]?_[_0x56ca('0x21')](_0x4c1b7a[_0x56ca('0x1f')],function(_0x3af89f){return{'model':db[_0x3af89f[_0x56ca('0x20')]],'as':_0x3af89f['as'],'attributes':_0x3af89f[_0x56ca('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x56ca('0xf')](function(_0x19045c){logger['info'](_0x56ca('0x19'),_0xd31104);logger[_0x56ca('0x22')]('GetDynamics365Account',_0xd31104,JSON['stringify'](_0x19045c));_0x133d1a(_0x19045c);})[_0x56ca('0x18')](function(_0x5565ba){logger['error']('GetDynamics365Account',_0x5565ba[_0x56ca('0x16')],_0xd31104);_0x133b70(_0x5031b7[_0x56ca('0x13')](0x1f4,_0x5565ba['message']));});});};exports[_0x56ca('0x23')]=function(_0x43bd40){var _0x405f35=this;return new Promise(function(_0x4b2b1d,_0x43e3da){return db[_0x56ca('0x1a')][_0x56ca('0x24')]({'raw':_0x43bd40[_0x56ca('0x1c')]?_0x43bd40[_0x56ca('0x1c')][_0x56ca('0x25')]===undefined?!![]:![]:!![],'where':_0x43bd40['options']?_0x43bd40[_0x56ca('0x1c')]['where']||null:null,'attributes':_0x43bd40['options']?_0x43bd40[_0x56ca('0x1c')][_0x56ca('0x1d')]||null:null,'include':_0x43bd40[_0x56ca('0x1c')]?_0x43bd40[_0x56ca('0x1c')]['include']?_[_0x56ca('0x21')](_0x43bd40[_0x56ca('0x1c')][_0x56ca('0x1f')],function(_0x1fa74e){return{'model':db[_0x1fa74e[_0x56ca('0x20')]],'as':_0x1fa74e['as'],'attributes':_0x1fa74e['attributes'],'include':_0x1fa74e[_0x56ca('0x1f')]?_[_0x56ca('0x21')](_0x1fa74e[_0x56ca('0x1f')],function(_0x543718){return{'model':db[_0x543718[_0x56ca('0x20')]],'as':_0x543718['as'],'attributes':_0x543718['attributes'],'include':_0x543718[_0x56ca('0x1f')]?_[_0x56ca('0x21')](_0x543718[_0x56ca('0x1f')],function(_0x422dd1){return{'model':db[_0x422dd1['model']],'as':_0x422dd1['as'],'attributes':_0x422dd1[_0x56ca('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x56ca('0xf')](function(_0x3b40d6){logger[_0x56ca('0x26')](_0x56ca('0x23'),_0x43bd40);logger[_0x56ca('0x22')](_0x56ca('0x23'),_0x43bd40,JSON[_0x56ca('0x12')](_0x3b40d6));_0x4b2b1d(_0x3b40d6);})[_0x56ca('0x18')](function(_0x47377a){logger[_0x56ca('0x13')]('ShowDynamics365Account',_0x47377a[_0x56ca('0x16')],_0x43bd40);_0x43e3da(_0x405f35[_0x56ca('0x13')](0x1f4,_0x47377a['message']));});});}; \ No newline at end of file +var _0x357e=['../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Account,\x20%s,\x20%s','message','info','result','catch','GetDynamics365Account','findAll','options','raw','where','attributes','limit','include','model','map','then','ShowDynamics365Account','Dynamics365Account','find','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x2a0377,_0x429843){var _0x42304f=function(_0x372d3e){while(--_0x372d3e){_0x2a0377['push'](_0x2a0377['shift']());}};_0x42304f(++_0x429843);}(_0x357e,0x1c2));var _0xe357=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x357e[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0xe357('0x0'));var util=require('util');var moment=require(_0xe357('0x1'));var BPromise=require(_0xe357('0x2'));var rs=require(_0xe357('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe357('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe357('0x5'))(_0xe357('0x6'));var config=require('../../config/environment');var jayson=require(_0xe357('0x7'));var client=jayson[_0xe357('0x8')][_0xe357('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d61fc,_0x143654,_0x2dc298){return new BPromise(function(_0x41f2a2,_0x31b8d2){return client[_0xe357('0xa')](_0x3d61fc,_0x2dc298)['then'](function(_0x33394a){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x143654,_0xe357('0xb'));logger[_0xe357('0xc')](_0xe357('0xd'),_0x143654,'request\x20sent',JSON[_0xe357('0xe')](_0x33394a));if(_0x33394a[_0xe357('0xf')]){if(_0x33394a['error']['code']===0x1f4){logger[_0xe357('0xf')](_0xe357('0x10'),_0x143654,_0x33394a[_0xe357('0xf')][_0xe357('0x11')]);return _0x31b8d2(_0x33394a[_0xe357('0xf')][_0xe357('0x11')]);}logger[_0xe357('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x143654,_0x33394a[_0xe357('0xf')][_0xe357('0x11')]);return _0x41f2a2(_0x33394a[_0xe357('0xf')][_0xe357('0x11')]);}else{logger[_0xe357('0x12')](_0xe357('0x10'),_0x143654,_0xe357('0xb'));_0x41f2a2(_0x33394a[_0xe357('0x13')][_0xe357('0x11')]);}})[_0xe357('0x14')](function(_0x25bd30){logger[_0xe357('0xf')](_0xe357('0x10'),_0x143654,_0x25bd30);_0x31b8d2(_0x25bd30);});});}exports[_0xe357('0x15')]=function(_0xe05fbf){var _0x4938c2=this;return new Promise(function(_0x3f400f,_0x543bef){return db['Dynamics365Account'][_0xe357('0x16')]({'raw':_0xe05fbf[_0xe357('0x17')]?_0xe05fbf['options'][_0xe357('0x18')]===undefined?!![]:![]:!![],'where':_0xe05fbf['options']?_0xe05fbf['options'][_0xe357('0x19')]||null:null,'attributes':_0xe05fbf['options']?_0xe05fbf[_0xe357('0x17')][_0xe357('0x1a')]||null:null,'limit':_0xe05fbf[_0xe357('0x17')]?_0xe05fbf[_0xe357('0x17')][_0xe357('0x1b')]||null:null,'include':_0xe05fbf[_0xe357('0x17')]?_0xe05fbf['options'][_0xe357('0x1c')]?_['map'](_0xe05fbf[_0xe357('0x17')][_0xe357('0x1c')],function(_0x175b4b){return{'model':db[_0x175b4b[_0xe357('0x1d')]],'as':_0x175b4b['as'],'attributes':_0x175b4b[_0xe357('0x1a')],'include':_0x175b4b[_0xe357('0x1c')]?_[_0xe357('0x1e')](_0x175b4b[_0xe357('0x1c')],function(_0xad10f6){return{'model':db[_0xad10f6['model']],'as':_0xad10f6['as'],'attributes':_0xad10f6[_0xe357('0x1a')],'include':_0xad10f6[_0xe357('0x1c')]?_[_0xe357('0x1e')](_0xad10f6[_0xe357('0x1c')],function(_0x5b5feb){return{'model':db[_0x5b5feb[_0xe357('0x1d')]],'as':_0x5b5feb['as'],'attributes':_0x5b5feb[_0xe357('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe357('0x1f')](function(_0x5d2352){logger[_0xe357('0x12')](_0xe357('0x15'),_0xe05fbf);logger['debug'](_0xe357('0x15'),_0xe05fbf,JSON[_0xe357('0xe')](_0x5d2352));_0x3f400f(_0x5d2352);})[_0xe357('0x14')](function(_0x1f09d4){logger[_0xe357('0xf')](_0xe357('0x15'),_0x1f09d4['message'],_0xe05fbf);_0x543bef(_0x4938c2[_0xe357('0xf')](0x1f4,_0x1f09d4['message']));});});};exports[_0xe357('0x20')]=function(_0xfe00c){var _0x3d7035=this;return new Promise(function(_0x2c7710,_0x194fa0){return db[_0xe357('0x21')][_0xe357('0x22')]({'raw':_0xfe00c['options']?_0xfe00c[_0xe357('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xfe00c['options']?_0xfe00c[_0xe357('0x17')][_0xe357('0x19')]||null:null,'attributes':_0xfe00c[_0xe357('0x17')]?_0xfe00c[_0xe357('0x17')]['attributes']||null:null,'include':_0xfe00c[_0xe357('0x17')]?_0xfe00c['options'][_0xe357('0x1c')]?_[_0xe357('0x1e')](_0xfe00c[_0xe357('0x17')][_0xe357('0x1c')],function(_0x50d5f6){return{'model':db[_0x50d5f6[_0xe357('0x1d')]],'as':_0x50d5f6['as'],'attributes':_0x50d5f6['attributes'],'include':_0x50d5f6[_0xe357('0x1c')]?_[_0xe357('0x1e')](_0x50d5f6[_0xe357('0x1c')],function(_0x1b4896){return{'model':db[_0x1b4896[_0xe357('0x1d')]],'as':_0x1b4896['as'],'attributes':_0x1b4896['attributes'],'include':_0x1b4896[_0xe357('0x1c')]?_[_0xe357('0x1e')](_0x1b4896['include'],function(_0x59c63){return{'model':db[_0x59c63['model']],'as':_0x59c63['as'],'attributes':_0x59c63['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d2a11){logger[_0xe357('0x12')](_0xe357('0x20'),_0xfe00c);logger['debug'](_0xe357('0x20'),_0xfe00c,JSON['stringify'](_0x2d2a11));_0x2c7710(_0x2d2a11);})[_0xe357('0x14')](function(_0x2fa133){logger[_0xe357('0xf')](_0xe357('0x20'),_0x2fa133[_0xe357('0x11')],_0xfe00c);_0x194fa0(_0x3d7035['error'](0x1f4,_0x2fa133['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 1004c5c..fa586a6 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 _0xdbcd=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','create','put','delete','destroy','exports','util','path'];(function(_0x371f35,_0x33aee4){var _0x141c89=function(_0x50d0ab){while(--_0x50d0ab){_0x371f35['push'](_0x371f35['shift']());}};_0x141c89(++_0x33aee4);}(_0xdbcd,0x67));var _0xddbc=function(_0x2db146,_0x509cc5){_0x2db146=_0x2db146-0x0;var _0x524bcb=_0xdbcd[_0x2db146];return _0x524bcb;};'use strict';var multer=require('multer');var util=require(_0xddbc('0x0'));var path=require(_0xddbc('0x1'));var timeout=require(_0xddbc('0x2'));var express=require('express');var router=express[_0xddbc('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xddbc('0x4'));var interaction=require(_0xddbc('0x5'));var config=require(_0xddbc('0x6'));var controller=require(_0xddbc('0x7'));router[_0xddbc('0x8')]('/',auth[_0xddbc('0x9')](),controller['index']);router[_0xddbc('0x8')](_0xddbc('0xa'),auth['isAuthenticated'](),controller[_0xddbc('0xb')]);router[_0xddbc('0x8')](_0xddbc('0xc'),auth[_0xddbc('0x9')](),controller['getFields']);router['get'](_0xddbc('0xd'),auth['isAuthenticated'](),controller[_0xddbc('0xe')]);router['get']('/:id/descriptions',auth[_0xddbc('0x9')](),controller[_0xddbc('0xf')]);router['post']('/',auth[_0xddbc('0x9')](),controller[_0xddbc('0x10')]);router[_0xddbc('0x11')]('/:id',auth[_0xddbc('0x9')](),controller['update']);router[_0xddbc('0x12')](_0xddbc('0xa'),auth[_0xddbc('0x9')](),controller[_0xddbc('0x13')]);module[_0xddbc('0x14')]=router; \ No newline at end of file +var _0x5044=['show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','/:id','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','index','isAuthenticated'];(function(_0x5a04b2,_0x519606){var _0x42421b=function(_0x2368c6){while(--_0x2368c6){_0x5a04b2['push'](_0x5a04b2['shift']());}};_0x42421b(++_0x519606);}(_0x5044,0x1ef));var _0x4504=function(_0x7fff5e,_0x240271){_0x7fff5e=_0x7fff5e-0x0;var _0x57f9ce=_0x5044[_0x7fff5e];return _0x57f9ce;};'use strict';var multer=require('multer');var util=require(_0x4504('0x0'));var path=require('path');var timeout=require(_0x4504('0x1'));var express=require(_0x4504('0x2'));var router=express[_0x4504('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4504('0x4'));var interaction=require(_0x4504('0x5'));var config=require(_0x4504('0x6'));var controller=require(_0x4504('0x7'));router[_0x4504('0x8')]('/',auth['isAuthenticated'](),controller[_0x4504('0x9')]);router[_0x4504('0x8')]('/:id',auth[_0x4504('0xa')](),controller[_0x4504('0xb')]);router[_0x4504('0x8')](_0x4504('0xc'),auth[_0x4504('0xa')](),controller[_0x4504('0xd')]);router['get'](_0x4504('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x4504('0x8')](_0x4504('0xf'),auth['isAuthenticated'](),controller[_0x4504('0x10')]);router[_0x4504('0x11')]('/',auth['isAuthenticated'](),controller[_0x4504('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x4504('0x13'),auth['isAuthenticated'](),controller[_0x4504('0x14')]);module[_0x4504('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index d183cab..9e8bb47 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 _0xfd0c=['contact','nothing','BOOLEAN','exports','STRING','ENUM','incident','phonecall'];(function(_0x4d62ae,_0x1509f5){var _0x54d4b7=function(_0x492d51){while(--_0x492d51){_0x4d62ae['push'](_0x4d62ae['shift']());}};_0x54d4b7(++_0x1509f5);}(_0xfd0c,0x16b));var _0xcfd0=function(_0x258fb0,_0x5362dc){_0x258fb0=_0x258fb0-0x0;var _0x4d1afe=_0xfd0c[_0x258fb0];return _0x4d1afe;};'use strict';var Sequelize=require('sequelize');module[_0xcfd0('0x0')]={'name':{'type':Sequelize[_0xcfd0('0x1')]},'description':{'type':Sequelize[_0xcfd0('0x1')]},'ticketType':{'type':Sequelize[_0xcfd0('0x2')](_0xcfd0('0x3'),_0xcfd0('0x4')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0xcfd0('0x2')](_0xcfd0('0x5'),_0xcfd0('0x6')),'defaultValue':_0xcfd0('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xcfd0('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7dd9=['phonecall','contact','BOOLEAN','sequelize','STRING','ENUM','incident'];(function(_0x447f6a,_0x5b8a2f){var _0x36bd14=function(_0x3a05f9){while(--_0x3a05f9){_0x447f6a['push'](_0x447f6a['shift']());}};_0x36bd14(++_0x5b8a2f);}(_0x7dd9,0x161));var _0x97dd=function(_0x18be5b,_0x4b04be){_0x18be5b=_0x18be5b-0x0;var _0x3b649c=_0x7dd9[_0x18be5b];return _0x3b649c;};'use strict';var Sequelize=require(_0x97dd('0x0'));module['exports']={'name':{'type':Sequelize[_0x97dd('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x97dd('0x2')](_0x97dd('0x3'),_0x97dd('0x4')),'defaultValue':_0x97dd('0x3')},'moduleCreate':{'type':Sequelize[_0x97dd('0x2')](_0x97dd('0x5'),'nothing'),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x97dd('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x97dd('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index b34c5cf..a1d0800 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 _0x3a53=['keys','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','limit','undefined','count','offset','status','set','apply','save','then','sendStatus','error','stack','name','send','Dynamics365Configuration','fieldName','type','key','model','map','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','catch','show','params','rawAttributes','length','options','find','create','body','update','getFields','findOne'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x3a53,0x148));var _0x33a5=function(_0x5293c8,_0xab0c3c){_0x5293c8=_0x5293c8-0x0;var _0x3623fb=_0x3a53[_0x5293c8];return _0x3623fb;};'use strict';var emlformat=require(_0x33a5('0x0'));var rimraf=require(_0x33a5('0x1'));var zipdir=require(_0x33a5('0x2'));var jsonpatch=require(_0x33a5('0x3'));var rp=require(_0x33a5('0x4'));var moment=require(_0x33a5('0x5'));var BPromise=require(_0x33a5('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x33a5('0x7'));var sox=require(_0x33a5('0x8'));var csv=require(_0x33a5('0x9'));var ejs=require(_0x33a5('0xa'));var fs=require('fs');var fs_extra=require(_0x33a5('0xb'));var _=require(_0x33a5('0xc'));var squel=require('squel');var crypto=require(_0x33a5('0xd'));var jsforce=require(_0x33a5('0xe'));var deskjs=require(_0x33a5('0xf'));var toCsv=require(_0x33a5('0x9'));var querystring=require('querystring');var Papa=require(_0x33a5('0x10'));var Redis=require('ioredis');var authService=require(_0x33a5('0x11'));var qs=require(_0x33a5('0x12'));var as=require(_0x33a5('0x13'));var hardwareService=require(_0x33a5('0x14'));var logger=require('../../config/logger')(_0x33a5('0x15'));var utils=require(_0x33a5('0x16'));var config=require(_0x33a5('0x17'));var licenseUtil=require(_0x33a5('0x18'));var db=require(_0x33a5('0x19'))['db'];function respondWithStatusCode(_0x192131,_0x1be718){_0x1be718=_0x1be718||0xcc;return function(_0x160b6b){if(_0x160b6b){return _0x192131['sendStatus'](_0x1be718);}return _0x192131['status'](_0x1be718)[_0x33a5('0x1a')]();};}function respondWithResult(_0x1ca0ea,_0x3f3897){_0x3f3897=_0x3f3897||0xc8;return function(_0x489559){if(_0x489559){return _0x1ca0ea['status'](_0x3f3897)[_0x33a5('0x1b')](_0x489559);}};}function respondWithFilteredResult(_0xb6bdb1,_0x14134e){return function(_0x2f1d76){if(_0x2f1d76){var _0x3ce14=typeof _0x14134e['offset']==='undefined'&&typeof _0x14134e[_0x33a5('0x1c')]===_0x33a5('0x1d');var _0x11e0e8=_0x2f1d76[_0x33a5('0x1e')];var _0x3914f8=_0x3ce14?0x0:_0x14134e[_0x33a5('0x1f')];var _0x270ea4=_0x3ce14?_0x2f1d76[_0x33a5('0x1e')]:_0x14134e[_0x33a5('0x1f')]+_0x14134e[_0x33a5('0x1c')];var _0x1e16a4;if(_0x270ea4>=_0x11e0e8){_0x270ea4=_0x11e0e8;_0x1e16a4=0xc8;}else{_0x1e16a4=0xce;}_0xb6bdb1[_0x33a5('0x20')](_0x1e16a4);return _0xb6bdb1[_0x33a5('0x21')]('Content-Range',_0x3914f8+'-'+_0x270ea4+'/'+_0x11e0e8)[_0x33a5('0x1b')](_0x2f1d76);}return null;};}function patchUpdates(_0x3d6839){return function(_0x2490a5){try{jsonpatch[_0x33a5('0x22')](_0x2490a5,_0x3d6839,!![]);}catch(_0x3bfdac){return BPromise['reject'](_0x3bfdac);}return _0x2490a5[_0x33a5('0x23')]();};}function saveUpdates(_0x43d48a,_0x578d){return function(_0x14f928){if(_0x14f928){return _0x14f928['update'](_0x43d48a)['then'](function(_0x2ffb8e){return _0x2ffb8e;});}return null;};}function removeEntity(_0x1a213f,_0x2fa2da){return function(_0x4e3e0b){if(_0x4e3e0b){return _0x4e3e0b['destroy']()[_0x33a5('0x24')](function(){_0x1a213f[_0x33a5('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb07984,_0x42ee24){return function(_0x1c339a){if(!_0x1c339a){_0xb07984[_0x33a5('0x25')](0x194);}return _0x1c339a;};}function handleError(_0x40ecd3,_0x59163c){_0x59163c=_0x59163c||0x1f4;return function(_0x1fb077){logger[_0x33a5('0x26')](_0x1fb077[_0x33a5('0x27')]);if(_0x1fb077[_0x33a5('0x28')]){delete _0x1fb077[_0x33a5('0x28')];}_0x40ecd3[_0x33a5('0x20')](_0x59163c)[_0x33a5('0x29')](_0x1fb077);};}exports['index']=function(_0x4a2298,_0x57f3ac){var _0x1075d1={},_0x13f9bc={},_0x31e08f={'count':0x0,'rows':[]};var _0x26dcf4=_['map'](db[_0x33a5('0x2a')]['rawAttributes'],function(_0x509efe){return{'name':_0x509efe[_0x33a5('0x2b')],'type':_0x509efe[_0x33a5('0x2c')][_0x33a5('0x2d')]};});_0x13f9bc[_0x33a5('0x2e')]=_[_0x33a5('0x2f')](_0x26dcf4,_0x33a5('0x28'));_0x13f9bc[_0x33a5('0x30')]=_['keys'](_0x4a2298[_0x33a5('0x30')]);_0x13f9bc['filters']=_['intersection'](_0x13f9bc[_0x33a5('0x2e')],_0x13f9bc['query']);_0x1075d1[_0x33a5('0x31')]=_[_0x33a5('0x32')](_0x13f9bc[_0x33a5('0x2e')],qs[_0x33a5('0x33')](_0x4a2298['query']['fields']));_0x1075d1[_0x33a5('0x31')]=_0x1075d1[_0x33a5('0x31')]['length']?_0x1075d1['attributes']:_0x13f9bc[_0x33a5('0x2e')];if(!_0x4a2298[_0x33a5('0x30')][_0x33a5('0x34')](_0x33a5('0x35'))){_0x1075d1[_0x33a5('0x1c')]=qs[_0x33a5('0x1c')](_0x4a2298[_0x33a5('0x30')]['limit']);_0x1075d1[_0x33a5('0x1f')]=qs[_0x33a5('0x1f')](_0x4a2298[_0x33a5('0x30')][_0x33a5('0x1f')]);}_0x1075d1[_0x33a5('0x36')]=qs['sort'](_0x4a2298[_0x33a5('0x30')][_0x33a5('0x37')]);_0x1075d1['where']=qs[_0x33a5('0x38')](_[_0x33a5('0x39')](_0x4a2298[_0x33a5('0x30')],_0x13f9bc[_0x33a5('0x38')]),_0x26dcf4);if(_0x4a2298[_0x33a5('0x30')][_0x33a5('0x3a')]){_0x1075d1['where']=_[_0x33a5('0x3b')](_0x1075d1[_0x33a5('0x3c')],{'$or':_[_0x33a5('0x2f')](_0x26dcf4,function(_0x294721){if(_0x294721[_0x33a5('0x2c')]!==_0x33a5('0x3d')){var _0x42a83e={};_0x42a83e[_0x294721[_0x33a5('0x28')]]={'$like':'%'+_0x4a2298[_0x33a5('0x30')][_0x33a5('0x3a')]+'%'};return _0x42a83e;}})});}_0x1075d1=_[_0x33a5('0x3b')]({},_0x1075d1,_0x4a2298['options']);var _0x308ca6={'where':_0x1075d1[_0x33a5('0x3c')]};return db[_0x33a5('0x2a')][_0x33a5('0x1e')](_0x308ca6)[_0x33a5('0x24')](function(_0x592bd5){_0x31e08f['count']=_0x592bd5;if(_0x4a2298['query'][_0x33a5('0x3e')]){_0x1075d1[_0x33a5('0x3f')]=[{'all':!![]}];}return db[_0x33a5('0x2a')][_0x33a5('0x40')](_0x1075d1);})[_0x33a5('0x24')](function(_0x2a3bf1){_0x31e08f['rows']=_0x2a3bf1;return _0x31e08f;})['then'](respondWithFilteredResult(_0x57f3ac,_0x1075d1))[_0x33a5('0x41')](handleError(_0x57f3ac,null));};exports[_0x33a5('0x42')]=function(_0x5169c5,_0x23adda){var _0x5861a9={'raw':![],'where':{'id':_0x5169c5[_0x33a5('0x43')]['id']}},_0x5142f3={};_0x5142f3[_0x33a5('0x2e')]=_['keys'](db[_0x33a5('0x2a')][_0x33a5('0x44')]);_0x5142f3[_0x33a5('0x30')]=_['keys'](_0x5169c5['query']);_0x5142f3['filters']=_[_0x33a5('0x32')](_0x5142f3['model'],_0x5142f3[_0x33a5('0x30')]);_0x5861a9[_0x33a5('0x31')]=_[_0x33a5('0x32')](_0x5142f3[_0x33a5('0x2e')],qs[_0x33a5('0x33')](_0x5169c5[_0x33a5('0x30')][_0x33a5('0x33')]));_0x5861a9[_0x33a5('0x31')]=_0x5861a9[_0x33a5('0x31')][_0x33a5('0x45')]?_0x5861a9[_0x33a5('0x31')]:_0x5142f3[_0x33a5('0x2e')];if(_0x5169c5[_0x33a5('0x30')]['includeAll']){_0x5861a9[_0x33a5('0x3f')]=[{'all':!![]}];}_0x5861a9=_[_0x33a5('0x3b')]({},_0x5861a9,_0x5169c5[_0x33a5('0x46')]);return db[_0x33a5('0x2a')][_0x33a5('0x47')](_0x5861a9)[_0x33a5('0x24')](handleEntityNotFound(_0x23adda,null))['then'](respondWithResult(_0x23adda,null))['catch'](handleError(_0x23adda,null));};exports[_0x33a5('0x48')]=function(_0x365131,_0x1962ea){return db[_0x33a5('0x2a')][_0x33a5('0x48')](_0x365131[_0x33a5('0x49')],{})[_0x33a5('0x24')](respondWithResult(_0x1962ea,0xc9))[_0x33a5('0x41')](handleError(_0x1962ea,null));};exports[_0x33a5('0x4a')]=function(_0x8f035,_0x585038){if(_0x8f035[_0x33a5('0x49')]['id']){delete _0x8f035[_0x33a5('0x49')]['id'];}return db[_0x33a5('0x2a')][_0x33a5('0x47')]({'where':{'id':_0x8f035[_0x33a5('0x43')]['id']}})[_0x33a5('0x24')](handleEntityNotFound(_0x585038,null))[_0x33a5('0x24')](saveUpdates(_0x8f035[_0x33a5('0x49')],null))[_0x33a5('0x24')](respondWithResult(_0x585038,null))[_0x33a5('0x41')](handleError(_0x585038,null));};exports['destroy']=function(_0x45ed0d,_0x571c69){return db['Dynamics365Configuration']['find']({'where':{'id':_0x45ed0d[_0x33a5('0x43')]['id']}})[_0x33a5('0x24')](handleEntityNotFound(_0x571c69,null))[_0x33a5('0x24')](removeEntity(_0x571c69,null))[_0x33a5('0x41')](handleError(_0x571c69,null));};exports[_0x33a5('0x4b')]=function(_0xfd67ce,_0x5e4317,_0x2d9dc9){var _0x43ef3d={};var _0x402444={};var _0x5e0c73;var _0x59c7db;return db[_0x33a5('0x2a')][_0x33a5('0x4c')]({'where':{'id':_0xfd67ce[_0x33a5('0x43')]['id']}})[_0x33a5('0x24')](handleEntityNotFound(_0x5e4317,null))['then'](function(_0x2ffb2b){if(_0x2ffb2b){_0x5e0c73=_0x2ffb2b;_0x402444[_0x33a5('0x2e')]=_[_0x33a5('0x4d')](db[_0x33a5('0x4e')][_0x33a5('0x44')]);_0x402444['query']=_[_0x33a5('0x4d')](_0xfd67ce[_0x33a5('0x30')]);_0x402444[_0x33a5('0x38')]=_[_0x33a5('0x32')](_0x402444[_0x33a5('0x2e')],_0x402444[_0x33a5('0x30')]);_0x43ef3d[_0x33a5('0x31')]=_[_0x33a5('0x32')](_0x402444['model'],qs[_0x33a5('0x33')](_0xfd67ce[_0x33a5('0x30')][_0x33a5('0x33')]));_0x43ef3d[_0x33a5('0x31')]=_0x43ef3d[_0x33a5('0x31')][_0x33a5('0x45')]?_0x43ef3d[_0x33a5('0x31')]:_0x402444[_0x33a5('0x2e')];_0x43ef3d['order']=qs['sort'](_0xfd67ce[_0x33a5('0x30')][_0x33a5('0x37')]);_0x43ef3d[_0x33a5('0x3c')]=qs['filters'](_[_0x33a5('0x39')](_0xfd67ce[_0x33a5('0x30')],_0x402444[_0x33a5('0x38')]));if(_0xfd67ce[_0x33a5('0x30')][_0x33a5('0x3a')]){_0x43ef3d[_0x33a5('0x3c')]=_[_0x33a5('0x3b')](_0x43ef3d[_0x33a5('0x3c')],{'$or':_[_0x33a5('0x2f')](_0x43ef3d[_0x33a5('0x31')],function(_0x20ad65){var _0x3c18a7={};_0x3c18a7[_0x20ad65]={'$like':'%'+_0xfd67ce[_0x33a5('0x30')][_0x33a5('0x3a')]+'%'};return _0x3c18a7;})});}_0x43ef3d=_['merge']({},_0x43ef3d,_0xfd67ce['options']);return _0x5e0c73[_0x33a5('0x4b')](_0x43ef3d);}})[_0x33a5('0x24')](function(_0x53b366){if(_0x53b366){_0x59c7db=_0x53b366['length'];if(!_0xfd67ce[_0x33a5('0x30')][_0x33a5('0x34')](_0x33a5('0x35'))){_0x43ef3d[_0x33a5('0x1c')]=qs[_0x33a5('0x1c')](_0xfd67ce['query']['limit']);_0x43ef3d[_0x33a5('0x1f')]=qs[_0x33a5('0x1f')](_0xfd67ce[_0x33a5('0x30')][_0x33a5('0x1f')]);}return _0x5e0c73[_0x33a5('0x4b')](_0x43ef3d);}})[_0x33a5('0x24')](function(_0x5cc451){if(_0x5cc451){return _0x5cc451?{'count':_0x59c7db,'rows':_0x5cc451}:null;}})['then'](respondWithResult(_0x5e4317,null))['catch'](handleError(_0x5e4317,null));};exports[_0x33a5('0x4f')]=function(_0x5692cc,_0xdd0fd8,_0x45359c){var _0x1f08cb={};var _0x41abf={};var _0x2bd3c5;var _0x33a1ac;return db['Dynamics365Configuration'][_0x33a5('0x4c')]({'where':{'id':_0x5692cc[_0x33a5('0x43')]['id']}})[_0x33a5('0x24')](handleEntityNotFound(_0xdd0fd8,null))[_0x33a5('0x24')](function(_0x41853c){if(_0x41853c){_0x2bd3c5=_0x41853c;_0x41abf['model']=_['keys'](db[_0x33a5('0x4e')][_0x33a5('0x44')]);_0x41abf[_0x33a5('0x30')]=_['keys'](_0x5692cc['query']);_0x41abf['filters']=_[_0x33a5('0x32')](_0x41abf[_0x33a5('0x2e')],_0x41abf[_0x33a5('0x30')]);_0x1f08cb[_0x33a5('0x31')]=_['intersection'](_0x41abf[_0x33a5('0x2e')],qs[_0x33a5('0x33')](_0x5692cc[_0x33a5('0x30')][_0x33a5('0x33')]));_0x1f08cb[_0x33a5('0x31')]=_0x1f08cb[_0x33a5('0x31')]['length']?_0x1f08cb[_0x33a5('0x31')]:_0x41abf[_0x33a5('0x2e')];_0x1f08cb[_0x33a5('0x36')]=qs[_0x33a5('0x37')](_0x5692cc[_0x33a5('0x30')][_0x33a5('0x37')]);_0x1f08cb['where']=qs[_0x33a5('0x38')](_['pick'](_0x5692cc['query'],_0x41abf[_0x33a5('0x38')]));if(_0x5692cc[_0x33a5('0x30')][_0x33a5('0x3a')]){_0x1f08cb[_0x33a5('0x3c')]=_['merge'](_0x1f08cb[_0x33a5('0x3c')],{'$or':_[_0x33a5('0x2f')](_0x1f08cb['attributes'],function(_0x2e66ef){var _0x26e5a9={};_0x26e5a9[_0x2e66ef]={'$like':'%'+_0x5692cc[_0x33a5('0x30')][_0x33a5('0x3a')]+'%'};return _0x26e5a9;})});}_0x1f08cb=_[_0x33a5('0x3b')]({},_0x1f08cb,_0x5692cc[_0x33a5('0x46')]);return _0x2bd3c5[_0x33a5('0x4f')](_0x1f08cb);}})[_0x33a5('0x24')](function(_0x374427){if(_0x374427){_0x33a1ac=_0x374427[_0x33a5('0x45')];if(!_0x5692cc[_0x33a5('0x30')]['hasOwnProperty']('nolimit')){_0x1f08cb['limit']=qs[_0x33a5('0x1c')](_0x5692cc[_0x33a5('0x30')][_0x33a5('0x1c')]);_0x1f08cb[_0x33a5('0x1f')]=qs[_0x33a5('0x1f')](_0x5692cc[_0x33a5('0x30')][_0x33a5('0x1f')]);}return _0x2bd3c5[_0x33a5('0x4f')](_0x1f08cb);}})[_0x33a5('0x24')](function(_0x31607f){if(_0x31607f){return _0x31607f?{'count':_0x33a1ac,'rows':_0x31607f}:null;}})['then'](respondWithResult(_0xdd0fd8,null))[_0x33a5('0x41')](handleError(_0xdd0fd8,null));};exports[_0x33a5('0x50')]=function(_0x3e9999,_0x4de39a,_0x1f1894){var _0x2c0d2c={};var _0x6106ae={};var _0x5175f7;var _0x570b2d;return db[_0x33a5('0x2a')][_0x33a5('0x4c')]({'where':{'id':_0x3e9999['params']['id']}})[_0x33a5('0x24')](handleEntityNotFound(_0x4de39a,null))['then'](function(_0x1467c4){if(_0x1467c4){_0x5175f7=_0x1467c4;_0x6106ae[_0x33a5('0x2e')]=_[_0x33a5('0x4d')](db[_0x33a5('0x4e')][_0x33a5('0x44')]);_0x6106ae[_0x33a5('0x30')]=_[_0x33a5('0x4d')](_0x3e9999[_0x33a5('0x30')]);_0x6106ae[_0x33a5('0x38')]=_[_0x33a5('0x32')](_0x6106ae[_0x33a5('0x2e')],_0x6106ae['query']);_0x2c0d2c['attributes']=_[_0x33a5('0x32')](_0x6106ae[_0x33a5('0x2e')],qs[_0x33a5('0x33')](_0x3e9999[_0x33a5('0x30')][_0x33a5('0x33')]));_0x2c0d2c[_0x33a5('0x31')]=_0x2c0d2c['attributes'][_0x33a5('0x45')]?_0x2c0d2c[_0x33a5('0x31')]:_0x6106ae[_0x33a5('0x2e')];_0x2c0d2c[_0x33a5('0x36')]=qs[_0x33a5('0x37')](_0x3e9999[_0x33a5('0x30')][_0x33a5('0x37')]);_0x2c0d2c[_0x33a5('0x3c')]=qs[_0x33a5('0x38')](_[_0x33a5('0x39')](_0x3e9999[_0x33a5('0x30')],_0x6106ae[_0x33a5('0x38')]));if(_0x3e9999[_0x33a5('0x30')][_0x33a5('0x3a')]){_0x2c0d2c['where']=_[_0x33a5('0x3b')](_0x2c0d2c[_0x33a5('0x3c')],{'$or':_[_0x33a5('0x2f')](_0x2c0d2c[_0x33a5('0x31')],function(_0x136f7b){var _0xd6061b={};_0xd6061b[_0x136f7b]={'$like':'%'+_0x3e9999[_0x33a5('0x30')][_0x33a5('0x3a')]+'%'};return _0xd6061b;})});}_0x2c0d2c=_[_0x33a5('0x3b')]({},_0x2c0d2c,_0x3e9999[_0x33a5('0x46')]);return _0x5175f7[_0x33a5('0x50')](_0x2c0d2c);}})[_0x33a5('0x24')](function(_0x5a1123){if(_0x5a1123){_0x570b2d=_0x5a1123[_0x33a5('0x45')];if(!_0x3e9999[_0x33a5('0x30')][_0x33a5('0x34')]('nolimit')){_0x2c0d2c[_0x33a5('0x1c')]=qs[_0x33a5('0x1c')](_0x3e9999[_0x33a5('0x30')][_0x33a5('0x1c')]);_0x2c0d2c['offset']=qs[_0x33a5('0x1f')](_0x3e9999[_0x33a5('0x30')][_0x33a5('0x1f')]);}return _0x5175f7[_0x33a5('0x50')](_0x2c0d2c);}})['then'](function(_0x237442){if(_0x237442){return _0x237442?{'count':_0x570b2d,'rows':_0x237442}:null;}})[_0x33a5('0x24')](respondWithResult(_0x4de39a,null))[_0x33a5('0x41')](handleError(_0x4de39a,null));}; \ No newline at end of file +var _0x87c8=['VIRTUAL','options','Dynamics365Configuration','includeAll','include','findAll','catch','show','params','keys','find','create','body','getFields','length','getSubjects','findOne','Dynamics365Field','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge'];(function(_0x1a7518,_0x5bf115){var _0x1a273c=function(_0x40d9da){while(--_0x40d9da){_0x1a7518['push'](_0x1a7518['shift']());}};_0x1a273c(++_0x5bf115);}(_0x87c8,0x1ad));var _0x887c=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x87c8[_0x4f9b18];return _0x29f20c;};'use strict';var emlformat=require(_0x887c('0x0'));var rimraf=require(_0x887c('0x1'));var zipdir=require(_0x887c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x887c('0x3'));var moment=require(_0x887c('0x4'));var BPromise=require(_0x887c('0x5'));var Mustache=require(_0x887c('0x6'));var util=require(_0x887c('0x7'));var path=require(_0x887c('0x8'));var sox=require(_0x887c('0x9'));var csv=require('to-csv');var ejs=require(_0x887c('0xa'));var fs=require('fs');var fs_extra=require(_0x887c('0xb'));var _=require(_0x887c('0xc'));var squel=require(_0x887c('0xd'));var crypto=require(_0x887c('0xe'));var jsforce=require(_0x887c('0xf'));var deskjs=require(_0x887c('0x10'));var toCsv=require(_0x887c('0x11'));var querystring=require(_0x887c('0x12'));var Papa=require(_0x887c('0x13'));var Redis=require(_0x887c('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x887c('0x15'));var hardwareService=require(_0x887c('0x16'));var logger=require('../../config/logger')(_0x887c('0x17'));var utils=require(_0x887c('0x18'));var config=require(_0x887c('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe8b20,_0x18fac0){_0x18fac0=_0x18fac0||0xcc;return function(_0x1673d2){if(_0x1673d2){return _0xe8b20[_0x887c('0x1a')](_0x18fac0);}return _0xe8b20['status'](_0x18fac0)[_0x887c('0x1b')]();};}function respondWithResult(_0x3709fa,_0x305721){_0x305721=_0x305721||0xc8;return function(_0x34d453){if(_0x34d453){return _0x3709fa[_0x887c('0x1c')](_0x305721)[_0x887c('0x1d')](_0x34d453);}};}function respondWithFilteredResult(_0x21a55c,_0x5a9842){return function(_0x1c0fe4){if(_0x1c0fe4){var _0x515227=typeof _0x5a9842[_0x887c('0x1e')]===_0x887c('0x1f')&&typeof _0x5a9842['limit']===_0x887c('0x1f');var _0x49c4d4=_0x1c0fe4['count'];var _0x4d0a16=_0x515227?0x0:_0x5a9842['offset'];var _0x3bf038=_0x515227?_0x1c0fe4[_0x887c('0x20')]:_0x5a9842[_0x887c('0x1e')]+_0x5a9842[_0x887c('0x21')];var _0x31b4b9;if(_0x3bf038>=_0x49c4d4){_0x3bf038=_0x49c4d4;_0x31b4b9=0xc8;}else{_0x31b4b9=0xce;}_0x21a55c[_0x887c('0x1c')](_0x31b4b9);return _0x21a55c[_0x887c('0x22')](_0x887c('0x23'),_0x4d0a16+'-'+_0x3bf038+'/'+_0x49c4d4)[_0x887c('0x1d')](_0x1c0fe4);}return null;};}function patchUpdates(_0x558e99){return function(_0x319537){try{jsonpatch[_0x887c('0x24')](_0x319537,_0x558e99,!![]);}catch(_0x105ce4){return BPromise[_0x887c('0x25')](_0x105ce4);}return _0x319537[_0x887c('0x26')]();};}function saveUpdates(_0xa97683,_0x4880e8){return function(_0x2f02aa){if(_0x2f02aa){return _0x2f02aa['update'](_0xa97683)[_0x887c('0x27')](function(_0x271d21){return _0x271d21;});}return null;};}function removeEntity(_0x34ccba,_0xbbf7e3){return function(_0x221dc8){if(_0x221dc8){return _0x221dc8[_0x887c('0x28')]()[_0x887c('0x27')](function(){_0x34ccba[_0x887c('0x1c')](0xcc)[_0x887c('0x1b')]();});}};}function handleEntityNotFound(_0x427607,_0x44309d){return function(_0x5799bb){if(!_0x5799bb){_0x427607['sendStatus'](0x194);}return _0x5799bb;};}function handleError(_0x2970b1,_0xc6254b){_0xc6254b=_0xc6254b||0x1f4;return function(_0x58e6e2){logger[_0x887c('0x29')](_0x58e6e2['stack']);if(_0x58e6e2['name']){delete _0x58e6e2[_0x887c('0x2a')];}_0x2970b1[_0x887c('0x1c')](_0xc6254b)[_0x887c('0x2b')](_0x58e6e2);};}exports[_0x887c('0x2c')]=function(_0x238155,_0x1ee397){var _0x1e8e21={},_0x964465={},_0x4e6b57={'count':0x0,'rows':[]};var _0x5da19f=_[_0x887c('0x2d')](db['Dynamics365Configuration'][_0x887c('0x2e')],function(_0x5c5bd9){return{'name':_0x5c5bd9['fieldName'],'type':_0x5c5bd9[_0x887c('0x2f')][_0x887c('0x30')]};});_0x964465[_0x887c('0x31')]=_[_0x887c('0x2d')](_0x5da19f,_0x887c('0x2a'));_0x964465[_0x887c('0x32')]=_['keys'](_0x238155[_0x887c('0x32')]);_0x964465['filters']=_[_0x887c('0x33')](_0x964465[_0x887c('0x31')],_0x964465['query']);_0x1e8e21[_0x887c('0x34')]=_[_0x887c('0x33')](_0x964465[_0x887c('0x31')],qs[_0x887c('0x35')](_0x238155[_0x887c('0x32')][_0x887c('0x35')]));_0x1e8e21[_0x887c('0x34')]=_0x1e8e21['attributes']['length']?_0x1e8e21['attributes']:_0x964465[_0x887c('0x31')];if(!_0x238155[_0x887c('0x32')][_0x887c('0x36')](_0x887c('0x37'))){_0x1e8e21['limit']=qs[_0x887c('0x21')](_0x238155[_0x887c('0x32')][_0x887c('0x21')]);_0x1e8e21[_0x887c('0x1e')]=qs[_0x887c('0x1e')](_0x238155[_0x887c('0x32')][_0x887c('0x1e')]);}_0x1e8e21[_0x887c('0x38')]=qs[_0x887c('0x39')](_0x238155[_0x887c('0x32')][_0x887c('0x39')]);_0x1e8e21[_0x887c('0x3a')]=qs['filters'](_[_0x887c('0x3b')](_0x238155[_0x887c('0x32')],_0x964465[_0x887c('0x3c')]),_0x5da19f);if(_0x238155['query'][_0x887c('0x3d')]){_0x1e8e21['where']=_[_0x887c('0x3e')](_0x1e8e21[_0x887c('0x3a')],{'$or':_[_0x887c('0x2d')](_0x5da19f,function(_0x98c8be){if(_0x98c8be['type']!==_0x887c('0x3f')){var _0x1bd0e8={};_0x1bd0e8[_0x98c8be[_0x887c('0x2a')]]={'$like':'%'+_0x238155[_0x887c('0x32')][_0x887c('0x3d')]+'%'};return _0x1bd0e8;}})});}_0x1e8e21=_[_0x887c('0x3e')]({},_0x1e8e21,_0x238155[_0x887c('0x40')]);var _0x5c0e20={'where':_0x1e8e21['where']};return db[_0x887c('0x41')][_0x887c('0x20')](_0x5c0e20)[_0x887c('0x27')](function(_0x9d7efc){_0x4e6b57[_0x887c('0x20')]=_0x9d7efc;if(_0x238155[_0x887c('0x32')][_0x887c('0x42')]){_0x1e8e21[_0x887c('0x43')]=[{'all':!![]}];}return db[_0x887c('0x41')][_0x887c('0x44')](_0x1e8e21);})['then'](function(_0x5e5456){_0x4e6b57['rows']=_0x5e5456;return _0x4e6b57;})[_0x887c('0x27')](respondWithFilteredResult(_0x1ee397,_0x1e8e21))[_0x887c('0x45')](handleError(_0x1ee397,null));};exports[_0x887c('0x46')]=function(_0x518e71,_0x500ac1){var _0x3e443d={'raw':![],'where':{'id':_0x518e71[_0x887c('0x47')]['id']}},_0x34444c={};_0x34444c[_0x887c('0x31')]=_[_0x887c('0x48')](db[_0x887c('0x41')]['rawAttributes']);_0x34444c[_0x887c('0x32')]=_[_0x887c('0x48')](_0x518e71[_0x887c('0x32')]);_0x34444c[_0x887c('0x3c')]=_[_0x887c('0x33')](_0x34444c[_0x887c('0x31')],_0x34444c[_0x887c('0x32')]);_0x3e443d['attributes']=_[_0x887c('0x33')](_0x34444c[_0x887c('0x31')],qs[_0x887c('0x35')](_0x518e71[_0x887c('0x32')][_0x887c('0x35')]));_0x3e443d[_0x887c('0x34')]=_0x3e443d[_0x887c('0x34')]['length']?_0x3e443d['attributes']:_0x34444c[_0x887c('0x31')];if(_0x518e71[_0x887c('0x32')][_0x887c('0x42')]){_0x3e443d[_0x887c('0x43')]=[{'all':!![]}];}_0x3e443d=_[_0x887c('0x3e')]({},_0x3e443d,_0x518e71['options']);return db[_0x887c('0x41')][_0x887c('0x49')](_0x3e443d)[_0x887c('0x27')](handleEntityNotFound(_0x500ac1,null))[_0x887c('0x27')](respondWithResult(_0x500ac1,null))['catch'](handleError(_0x500ac1,null));};exports[_0x887c('0x4a')]=function(_0x2cc097,_0x43696c){return db[_0x887c('0x41')][_0x887c('0x4a')](_0x2cc097[_0x887c('0x4b')],{})[_0x887c('0x27')](respondWithResult(_0x43696c,0xc9))['catch'](handleError(_0x43696c,null));};exports['update']=function(_0x1515c3,_0x29a9a9){if(_0x1515c3[_0x887c('0x4b')]['id']){delete _0x1515c3[_0x887c('0x4b')]['id'];}return db['Dynamics365Configuration'][_0x887c('0x49')]({'where':{'id':_0x1515c3[_0x887c('0x47')]['id']}})[_0x887c('0x27')](handleEntityNotFound(_0x29a9a9,null))[_0x887c('0x27')](saveUpdates(_0x1515c3['body'],null))[_0x887c('0x27')](respondWithResult(_0x29a9a9,null))[_0x887c('0x45')](handleError(_0x29a9a9,null));};exports['destroy']=function(_0x380eef,_0x5e236f){return db[_0x887c('0x41')]['find']({'where':{'id':_0x380eef[_0x887c('0x47')]['id']}})[_0x887c('0x27')](handleEntityNotFound(_0x5e236f,null))[_0x887c('0x27')](removeEntity(_0x5e236f,null))[_0x887c('0x45')](handleError(_0x5e236f,null));};exports[_0x887c('0x4c')]=function(_0x3acb65,_0x5b2c25,_0x49bfca){var _0x65fe06={};var _0x3c9f65={};var _0xc671ba;var _0x16ce7b;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x3acb65[_0x887c('0x47')]['id']}})[_0x887c('0x27')](handleEntityNotFound(_0x5b2c25,null))[_0x887c('0x27')](function(_0x596024){if(_0x596024){_0xc671ba=_0x596024;_0x3c9f65[_0x887c('0x31')]=_[_0x887c('0x48')](db['Dynamics365Field'][_0x887c('0x2e')]);_0x3c9f65[_0x887c('0x32')]=_['keys'](_0x3acb65[_0x887c('0x32')]);_0x3c9f65[_0x887c('0x3c')]=_['intersection'](_0x3c9f65[_0x887c('0x31')],_0x3c9f65['query']);_0x65fe06[_0x887c('0x34')]=_[_0x887c('0x33')](_0x3c9f65['model'],qs[_0x887c('0x35')](_0x3acb65[_0x887c('0x32')]['fields']));_0x65fe06[_0x887c('0x34')]=_0x65fe06['attributes'][_0x887c('0x4d')]?_0x65fe06[_0x887c('0x34')]:_0x3c9f65['model'];_0x65fe06[_0x887c('0x38')]=qs['sort'](_0x3acb65['query']['sort']);_0x65fe06[_0x887c('0x3a')]=qs['filters'](_['pick'](_0x3acb65[_0x887c('0x32')],_0x3c9f65[_0x887c('0x3c')]));if(_0x3acb65['query'][_0x887c('0x3d')]){_0x65fe06['where']=_[_0x887c('0x3e')](_0x65fe06[_0x887c('0x3a')],{'$or':_[_0x887c('0x2d')](_0x65fe06[_0x887c('0x34')],function(_0x1a21eb){var _0x140e4a={};_0x140e4a[_0x1a21eb]={'$like':'%'+_0x3acb65[_0x887c('0x32')][_0x887c('0x3d')]+'%'};return _0x140e4a;})});}_0x65fe06=_[_0x887c('0x3e')]({},_0x65fe06,_0x3acb65[_0x887c('0x40')]);return _0xc671ba['getFields'](_0x65fe06);}})[_0x887c('0x27')](function(_0x3dff71){if(_0x3dff71){_0x16ce7b=_0x3dff71[_0x887c('0x4d')];if(!_0x3acb65[_0x887c('0x32')][_0x887c('0x36')]('nolimit')){_0x65fe06[_0x887c('0x21')]=qs[_0x887c('0x21')](_0x3acb65[_0x887c('0x32')][_0x887c('0x21')]);_0x65fe06['offset']=qs[_0x887c('0x1e')](_0x3acb65[_0x887c('0x32')][_0x887c('0x1e')]);}return _0xc671ba[_0x887c('0x4c')](_0x65fe06);}})[_0x887c('0x27')](function(_0x1f67f6){if(_0x1f67f6){return _0x1f67f6?{'count':_0x16ce7b,'rows':_0x1f67f6}:null;}})[_0x887c('0x27')](respondWithResult(_0x5b2c25,null))[_0x887c('0x45')](handleError(_0x5b2c25,null));};exports[_0x887c('0x4e')]=function(_0x471737,_0x1195e2,_0x81ac60){var _0x3cbe94={};var _0x5f4b1a={};var _0x57297e;var _0x78fffa;return db['Dynamics365Configuration'][_0x887c('0x4f')]({'where':{'id':_0x471737[_0x887c('0x47')]['id']}})['then'](handleEntityNotFound(_0x1195e2,null))[_0x887c('0x27')](function(_0x2da8a9){if(_0x2da8a9){_0x57297e=_0x2da8a9;_0x5f4b1a['model']=_[_0x887c('0x48')](db[_0x887c('0x50')]['rawAttributes']);_0x5f4b1a['query']=_[_0x887c('0x48')](_0x471737[_0x887c('0x32')]);_0x5f4b1a['filters']=_[_0x887c('0x33')](_0x5f4b1a[_0x887c('0x31')],_0x5f4b1a[_0x887c('0x32')]);_0x3cbe94[_0x887c('0x34')]=_[_0x887c('0x33')](_0x5f4b1a['model'],qs[_0x887c('0x35')](_0x471737[_0x887c('0x32')][_0x887c('0x35')]));_0x3cbe94['attributes']=_0x3cbe94['attributes'][_0x887c('0x4d')]?_0x3cbe94['attributes']:_0x5f4b1a[_0x887c('0x31')];_0x3cbe94[_0x887c('0x38')]=qs['sort'](_0x471737['query']['sort']);_0x3cbe94[_0x887c('0x3a')]=qs['filters'](_[_0x887c('0x3b')](_0x471737[_0x887c('0x32')],_0x5f4b1a[_0x887c('0x3c')]));if(_0x471737[_0x887c('0x32')][_0x887c('0x3d')]){_0x3cbe94['where']=_[_0x887c('0x3e')](_0x3cbe94[_0x887c('0x3a')],{'$or':_[_0x887c('0x2d')](_0x3cbe94[_0x887c('0x34')],function(_0xc78637){var _0x5d6132={};_0x5d6132[_0xc78637]={'$like':'%'+_0x471737[_0x887c('0x32')][_0x887c('0x3d')]+'%'};return _0x5d6132;})});}_0x3cbe94=_['merge']({},_0x3cbe94,_0x471737[_0x887c('0x40')]);return _0x57297e[_0x887c('0x4e')](_0x3cbe94);}})[_0x887c('0x27')](function(_0xd25e91){if(_0xd25e91){_0x78fffa=_0xd25e91[_0x887c('0x4d')];if(!_0x471737[_0x887c('0x32')][_0x887c('0x36')](_0x887c('0x37'))){_0x3cbe94[_0x887c('0x21')]=qs[_0x887c('0x21')](_0x471737[_0x887c('0x32')][_0x887c('0x21')]);_0x3cbe94[_0x887c('0x1e')]=qs[_0x887c('0x1e')](_0x471737['query'][_0x887c('0x1e')]);}return _0x57297e['getSubjects'](_0x3cbe94);}})[_0x887c('0x27')](function(_0x3349cb){if(_0x3349cb){return _0x3349cb?{'count':_0x78fffa,'rows':_0x3349cb}:null;}})[_0x887c('0x27')](respondWithResult(_0x1195e2,null))[_0x887c('0x45')](handleError(_0x1195e2,null));};exports[_0x887c('0x51')]=function(_0x51ae15,_0x20b4ab,_0x25685f){var _0xdc2d86={};var _0x5e0f16={};var _0x3d34d9;var _0x2754b0;return db[_0x887c('0x41')][_0x887c('0x4f')]({'where':{'id':_0x51ae15['params']['id']}})[_0x887c('0x27')](handleEntityNotFound(_0x20b4ab,null))[_0x887c('0x27')](function(_0x54855d){if(_0x54855d){_0x3d34d9=_0x54855d;_0x5e0f16[_0x887c('0x31')]=_[_0x887c('0x48')](db['Dynamics365Field'][_0x887c('0x2e')]);_0x5e0f16[_0x887c('0x32')]=_[_0x887c('0x48')](_0x51ae15[_0x887c('0x32')]);_0x5e0f16[_0x887c('0x3c')]=_[_0x887c('0x33')](_0x5e0f16[_0x887c('0x31')],_0x5e0f16['query']);_0xdc2d86[_0x887c('0x34')]=_[_0x887c('0x33')](_0x5e0f16[_0x887c('0x31')],qs['fields'](_0x51ae15[_0x887c('0x32')][_0x887c('0x35')]));_0xdc2d86[_0x887c('0x34')]=_0xdc2d86[_0x887c('0x34')]['length']?_0xdc2d86[_0x887c('0x34')]:_0x5e0f16[_0x887c('0x31')];_0xdc2d86[_0x887c('0x38')]=qs[_0x887c('0x39')](_0x51ae15[_0x887c('0x32')]['sort']);_0xdc2d86[_0x887c('0x3a')]=qs[_0x887c('0x3c')](_[_0x887c('0x3b')](_0x51ae15[_0x887c('0x32')],_0x5e0f16[_0x887c('0x3c')]));if(_0x51ae15[_0x887c('0x32')][_0x887c('0x3d')]){_0xdc2d86[_0x887c('0x3a')]=_['merge'](_0xdc2d86['where'],{'$or':_[_0x887c('0x2d')](_0xdc2d86['attributes'],function(_0x849b7b){var _0x1c33e2={};_0x1c33e2[_0x849b7b]={'$like':'%'+_0x51ae15[_0x887c('0x32')][_0x887c('0x3d')]+'%'};return _0x1c33e2;})});}_0xdc2d86=_[_0x887c('0x3e')]({},_0xdc2d86,_0x51ae15[_0x887c('0x40')]);return _0x3d34d9['getDescriptions'](_0xdc2d86);}})[_0x887c('0x27')](function(_0x3aec61){if(_0x3aec61){_0x2754b0=_0x3aec61[_0x887c('0x4d')];if(!_0x51ae15[_0x887c('0x32')][_0x887c('0x36')](_0x887c('0x37'))){_0xdc2d86[_0x887c('0x21')]=qs[_0x887c('0x21')](_0x51ae15[_0x887c('0x32')]['limit']);_0xdc2d86['offset']=qs[_0x887c('0x1e')](_0x51ae15[_0x887c('0x32')][_0x887c('0x1e')]);}return _0x3d34d9[_0x887c('0x51')](_0xdc2d86);}})[_0x887c('0x27')](function(_0x31035f){if(_0x31035f){return _0x31035f?{'count':_0x2754b0,'rows':_0x31035f}:null;}})[_0x887c('0x27')](respondWithResult(_0x20b4ab,null))[_0x887c('0x45')](handleError(_0x20b4ab,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index a8d9e39..a5632e4 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 _0x6f0d=['./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x22a2c2,_0x2d5291){_0x22a2c2=_0x22a2c2-0x0;var _0xebbe0a=_0x6f0d[_0x22a2c2];return _0xebbe0a;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var logger=require(_0xd6f0('0x1'))(_0xd6f0('0x2'));var moment=require(_0xd6f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xd6f0('0x4'));var fs=require('fs');var path=require(_0xd6f0('0x5'));var rimraf=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var attributes=require(_0xd6f0('0x8'));module['exports']=function(_0x2d2ce6,_0x4a8b0c){return _0x2d2ce6[_0xd6f0('0x9')](_0xd6f0('0xa'),attributes,{'tableName':_0xd6f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b84=['moment','path','rimraf','../../config/environment','Dynamics365Configuration','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4b84,0x1cc));var _0x44b8=function(_0x19ac6e,_0x435862){_0x19ac6e=_0x19ac6e-0x0;var _0x1cdcf3=_0x4b84[_0x19ac6e];return _0x1cdcf3;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x44b8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x44b8('0x3'));var rimraf=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var attributes=require('./intDynamics365Configuration.attributes');module['exports']=function(_0x55f25d,_0x996a8b){return _0x55f25d['define'](_0x44b8('0x6'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 0d04471..64219f2 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 _0x0027=['request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s'];(function(_0x738fab,_0x312c67){var _0x33b3dd=function(_0x407d96){while(--_0x407d96){_0x738fab['push'](_0x738fab['shift']());}};_0x33b3dd(++_0x312c67);}(_0x0027,0x178));var _0x7002=function(_0x3653a7,_0x4b626f){_0x3653a7=_0x3653a7-0x0;var _0x30f141=_0x0027[_0x3653a7];return _0x30f141;};'use strict';var _=require(_0x7002('0x0'));var util=require(_0x7002('0x1'));var moment=require(_0x7002('0x2'));var BPromise=require(_0x7002('0x3'));var rs=require(_0x7002('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7002('0x5'))['db'];var utils=require(_0x7002('0x6'));var logger=require(_0x7002('0x7'))(_0x7002('0x8'));var config=require('../../config/environment');var jayson=require(_0x7002('0x9'));var client=jayson[_0x7002('0xa')][_0x7002('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e3c52,_0xf3751d,_0x1a451d){return new BPromise(function(_0x513511,_0x3ee2fa){return client[_0x7002('0xc')](_0x5e3c52,_0x1a451d)['then'](function(_0x5f0251){logger[_0x7002('0xd')](_0x7002('0xe'),_0xf3751d,_0x7002('0xf'));logger[_0x7002('0x10')](_0x7002('0x11'),_0xf3751d,_0x7002('0xf'),JSON['stringify'](_0x5f0251));if(_0x5f0251['error']){if(_0x5f0251['error'][_0x7002('0x12')]===0x1f4){logger[_0x7002('0x13')](_0x7002('0xe'),_0xf3751d,_0x5f0251[_0x7002('0x13')][_0x7002('0x14')]);return _0x3ee2fa(_0x5f0251['error'][_0x7002('0x14')]);}logger[_0x7002('0x13')](_0x7002('0xe'),_0xf3751d,_0x5f0251[_0x7002('0x13')][_0x7002('0x14')]);return _0x513511(_0x5f0251[_0x7002('0x13')][_0x7002('0x14')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0xf3751d,_0x7002('0xf'));_0x513511(_0x5f0251[_0x7002('0x15')][_0x7002('0x14')]);}})[_0x7002('0x16')](function(_0x448548){logger[_0x7002('0x13')](_0x7002('0xe'),_0xf3751d,_0x448548);_0x3ee2fa(_0x448548);});});} \ No newline at end of file +var _0xdf94=['Dynamics365Configuration,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf94,0xdf));var _0x4df9=function(_0x33843c,_0x1e6442){_0x33843c=_0x33843c-0x0;var _0x4f0122=_0xdf94[_0x33843c];return _0x4f0122;};'use strict';var _=require(_0x4df9('0x0'));var util=require(_0x4df9('0x1'));var moment=require(_0x4df9('0x2'));var BPromise=require('bluebird');var rs=require(_0x4df9('0x3'));var fs=require('fs');var Redis=require(_0x4df9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4df9('0x5'));var logger=require(_0x4df9('0x6'))(_0x4df9('0x7'));var config=require(_0x4df9('0x8'));var jayson=require(_0x4df9('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2131bc,_0x5e652d,_0x5be610){return new BPromise(function(_0x1b9f5f,_0x1b8ce0){return client[_0x4df9('0xa')](_0x2131bc,_0x5be610)[_0x4df9('0xb')](function(_0x924bb6){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x5e652d,_0x4df9('0xc'));logger[_0x4df9('0xd')](_0x4df9('0xe'),_0x5e652d,_0x4df9('0xc'),JSON[_0x4df9('0xf')](_0x924bb6));if(_0x924bb6['error']){if(_0x924bb6['error'][_0x4df9('0x10')]===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x5e652d,_0x924bb6[_0x4df9('0x11')]['message']);return _0x1b8ce0(_0x924bb6[_0x4df9('0x11')][_0x4df9('0x12')]);}logger['error'](_0x4df9('0x13'),_0x5e652d,_0x924bb6['error'][_0x4df9('0x12')]);return _0x1b9f5f(_0x924bb6['error'][_0x4df9('0x12')]);}else{logger['info'](_0x4df9('0x13'),_0x5e652d,_0x4df9('0xc'));_0x1b9f5f(_0x924bb6[_0x4df9('0x14')][_0x4df9('0x12')]);}})[_0x4df9('0x15')](function(_0x1a3e4f){logger[_0x4df9('0x11')](_0x4df9('0x13'),_0x5e652d,_0x1a3e4f);_0x1b8ce0(_0x1a3e4f);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 986811b..5906a91 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 _0x388b=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','exports','util','path','express'];(function(_0x3c81b5,_0x3f5ed7){var _0x5888c4=function(_0x4e65b0){while(--_0x4e65b0){_0x3c81b5['push'](_0x3c81b5['shift']());}};_0x5888c4(++_0x3f5ed7);}(_0x388b,0x1a1));var _0xb388=function(_0x582881,_0x56f11d){_0x582881=_0x582881-0x0;var _0x346581=_0x388b[_0x582881];return _0x346581;};'use strict';var multer=require('multer');var util=require(_0xb388('0x0'));var path=require(_0xb388('0x1'));var timeout=require('connect-timeout');var express=require(_0xb388('0x2'));var router=express[_0xb388('0x3')]();var fs_extra=require(_0xb388('0x4'));var auth=require(_0xb388('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb388('0x6'));var controller=require('./intDynamics365Field.controller');router[_0xb388('0x7')]('/',auth[_0xb388('0x8')](),controller['index']);router[_0xb388('0x7')](_0xb388('0x9'),auth['isAuthenticated'](),controller[_0xb388('0xa')]);router[_0xb388('0xb')]('/',auth[_0xb388('0x8')](),controller[_0xb388('0xc')]);router[_0xb388('0xd')](_0xb388('0x9'),auth[_0xb388('0x8')](),controller['update']);router['delete']('/:id',auth[_0xb388('0x8')](),controller['destroy']);module[_0xb388('0xe')]=router; \ No newline at end of file +var _0xa44d=['../../config/environment','isAuthenticated','get','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x211087,_0x354fdd){var _0x2a581f=function(_0x2928fe){while(--_0x2928fe){_0x211087['push'](_0x211087['shift']());}};_0x2a581f(++_0x354fdd);}(_0xa44d,0x181));var _0xda44=function(_0x5a1cc9,_0x28f54d){_0x5a1cc9=_0x5a1cc9-0x0;var _0x471761=_0xa44d[_0x5a1cc9];return _0x471761;};'use strict';var multer=require(_0xda44('0x0'));var util=require(_0xda44('0x1'));var path=require('path');var timeout=require(_0xda44('0x2'));var express=require(_0xda44('0x3'));var router=express[_0xda44('0x4')]();var fs_extra=require(_0xda44('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xda44('0x6'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth[_0xda44('0x7')](),controller['index']);router[_0xda44('0x8')](_0xda44('0x9'),auth[_0xda44('0x7')](),controller[_0xda44('0xa')]);router[_0xda44('0xb')]('/',auth['isAuthenticated'](),controller[_0xda44('0xc')]);router[_0xda44('0xd')](_0xda44('0x9'),auth[_0xda44('0x7')](),controller[_0xda44('0xe')]);router['delete']('/:id',auth[_0xda44('0x7')](),controller[_0xda44('0xf')]);module[_0xda44('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index df9c855..b86888d 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 _0x04f5=['ENUM','string','variable','sequelize','exports','customVariable','keyValue','picklist','STRING'];(function(_0x37d4c1,_0x3d8301){var _0xbdc08f=function(_0x1cd121){while(--_0x1cd121){_0x37d4c1['push'](_0x37d4c1['shift']());}};_0xbdc08f(++_0x3d8301);}(_0x04f5,0xe4));var _0x504f=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x04f5[_0xd0b415];return _0x2bdf2c;};'use strict';var Sequelize=require(_0x504f('0x0'));module[_0x504f('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0x504f('0x2'),_0x504f('0x3'),_0x504f('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x504f('0x5')]},'key':{'type':Sequelize[_0x504f('0x5')]},'keyType':{'type':Sequelize[_0x504f('0x6')](_0x504f('0x7'),_0x504f('0x8'),_0x504f('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x504f('0x5')]},'nameField':{'type':Sequelize[_0x504f('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6ab2=['picklist','STRING','ENUM','variable','BOOLEAN','sequelize','exports','string','customVariable','keyValue'];(function(_0x55bb29,_0x591975){var _0x5f4e03=function(_0x11ddbb){while(--_0x11ddbb){_0x55bb29['push'](_0x55bb29['shift']());}};_0x5f4e03(++_0x591975);}(_0x6ab2,0xe1));var _0x26ab=function(_0x26636a,_0x4c92bc){_0x26636a=_0x26636a-0x0;var _0x439a94=_0x6ab2[_0x26636a];return _0x439a94;};'use strict';var Sequelize=require(_0x26ab('0x0'));module[_0x26ab('0x1')]={'type':{'type':Sequelize['ENUM'](_0x26ab('0x2'),'variable',_0x26ab('0x3'),_0x26ab('0x4'),_0x26ab('0x5')),'defaultValue':_0x26ab('0x2')},'content':{'type':Sequelize[_0x26ab('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x26ab('0x7')](_0x26ab('0x2'),_0x26ab('0x8'),_0x26ab('0x3'))},'keyContent':{'type':Sequelize[_0x26ab('0x6')]},'idField':{'type':Sequelize[_0x26ab('0x6')]},'nameField':{'type':Sequelize[_0x26ab('0x6')]},'customField':{'type':Sequelize[_0x26ab('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x26ab('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index e52e28d..ca94e49 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 _0xd137=['error','stack','send','index','map','Dynamics365Field','fieldName','type','key','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then'];(function(_0x220025,_0x401d3e){var _0x276146=function(_0x1a267d){while(--_0x1a267d){_0x220025['push'](_0x220025['shift']());}};_0x276146(++_0x401d3e);}(_0xd137,0x10c));var _0x7d13=function(_0x3194b8,_0x5ebde6){_0x3194b8=_0x3194b8-0x0;var _0x45216d=_0xd137[_0x3194b8];return _0x45216d;};'use strict';var emlformat=require(_0x7d13('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7d13('0x1'));var jsonpatch=require(_0x7d13('0x2'));var rp=require(_0x7d13('0x3'));var moment=require(_0x7d13('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7d13('0x5'));var util=require(_0x7d13('0x6'));var path=require(_0x7d13('0x7'));var sox=require(_0x7d13('0x8'));var csv=require(_0x7d13('0x9'));var ejs=require(_0x7d13('0xa'));var fs=require('fs');var fs_extra=require(_0x7d13('0xb'));var _=require(_0x7d13('0xc'));var squel=require(_0x7d13('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7d13('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7d13('0xf'));var Papa=require(_0x7d13('0x10'));var Redis=require(_0x7d13('0x11'));var authService=require(_0x7d13('0x12'));var qs=require(_0x7d13('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d13('0x14'));var logger=require(_0x7d13('0x15'))(_0x7d13('0x16'));var utils=require(_0x7d13('0x17'));var config=require(_0x7d13('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7d13('0x19'))['db'];function respondWithStatusCode(_0x43ad58,_0x1dc154){_0x1dc154=_0x1dc154||0xcc;return function(_0x148709){if(_0x148709){return _0x43ad58[_0x7d13('0x1a')](_0x1dc154);}return _0x43ad58[_0x7d13('0x1b')](_0x1dc154)[_0x7d13('0x1c')]();};}function respondWithResult(_0x360a3b,_0x391f00){_0x391f00=_0x391f00||0xc8;return function(_0x2f68dd){if(_0x2f68dd){return _0x360a3b['status'](_0x391f00)[_0x7d13('0x1d')](_0x2f68dd);}};}function respondWithFilteredResult(_0x30a335,_0x2342a8){return function(_0x3f2e85){if(_0x3f2e85){var _0x5ccf2c=typeof _0x2342a8[_0x7d13('0x1e')]===_0x7d13('0x1f')&&typeof _0x2342a8[_0x7d13('0x20')]===_0x7d13('0x1f');var _0x24a63a=_0x3f2e85['count'];var _0x2a19e9=_0x5ccf2c?0x0:_0x2342a8[_0x7d13('0x1e')];var _0x5d4377=_0x5ccf2c?_0x3f2e85[_0x7d13('0x21')]:_0x2342a8[_0x7d13('0x1e')]+_0x2342a8['limit'];var _0x37000e;if(_0x5d4377>=_0x24a63a){_0x5d4377=_0x24a63a;_0x37000e=0xc8;}else{_0x37000e=0xce;}_0x30a335[_0x7d13('0x1b')](_0x37000e);return _0x30a335['set'](_0x7d13('0x22'),_0x2a19e9+'-'+_0x5d4377+'/'+_0x24a63a)['json'](_0x3f2e85);}return null;};}function patchUpdates(_0x580da9){return function(_0x1cb411){try{jsonpatch[_0x7d13('0x23')](_0x1cb411,_0x580da9,!![]);}catch(_0xadd607){return BPromise[_0x7d13('0x24')](_0xadd607);}return _0x1cb411[_0x7d13('0x25')]();};}function saveUpdates(_0x4b9f05,_0x324067){return function(_0xa9a6d6){if(_0xa9a6d6){return _0xa9a6d6[_0x7d13('0x26')](_0x4b9f05)[_0x7d13('0x27')](function(_0x1e0c34){return _0x1e0c34;});}return null;};}function removeEntity(_0x3e36ce,_0x2db591){return function(_0x1991fa){if(_0x1991fa){return _0x1991fa['destroy']()[_0x7d13('0x27')](function(){_0x3e36ce[_0x7d13('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45463e,_0x1e5e0e){return function(_0x11a391){if(!_0x11a391){_0x45463e['sendStatus'](0x194);}return _0x11a391;};}function handleError(_0x3e8aaf,_0x163d82){_0x163d82=_0x163d82||0x1f4;return function(_0x221db5){logger[_0x7d13('0x28')](_0x221db5[_0x7d13('0x29')]);if(_0x221db5['name']){delete _0x221db5['name'];}_0x3e8aaf[_0x7d13('0x1b')](_0x163d82)[_0x7d13('0x2a')](_0x221db5);};}exports[_0x7d13('0x2b')]=function(_0x4df563,_0x2a8e43){var _0x31a544={},_0x36e3cf={},_0x5899f7={'count':0x0,'rows':[]};var _0x256a3e=_[_0x7d13('0x2c')](db[_0x7d13('0x2d')]['rawAttributes'],function(_0x1dd830){return{'name':_0x1dd830[_0x7d13('0x2e')],'type':_0x1dd830[_0x7d13('0x2f')][_0x7d13('0x30')]};});_0x36e3cf[_0x7d13('0x31')]=_[_0x7d13('0x2c')](_0x256a3e,_0x7d13('0x32'));_0x36e3cf[_0x7d13('0x33')]=_['keys'](_0x4df563[_0x7d13('0x33')]);_0x36e3cf[_0x7d13('0x34')]=_[_0x7d13('0x35')](_0x36e3cf[_0x7d13('0x31')],_0x36e3cf[_0x7d13('0x33')]);_0x31a544['attributes']=_[_0x7d13('0x35')](_0x36e3cf[_0x7d13('0x31')],qs[_0x7d13('0x36')](_0x4df563[_0x7d13('0x33')]['fields']));_0x31a544[_0x7d13('0x37')]=_0x31a544['attributes'][_0x7d13('0x38')]?_0x31a544[_0x7d13('0x37')]:_0x36e3cf['model'];if(!_0x4df563[_0x7d13('0x33')][_0x7d13('0x39')](_0x7d13('0x3a'))){_0x31a544[_0x7d13('0x20')]=qs[_0x7d13('0x20')](_0x4df563['query'][_0x7d13('0x20')]);_0x31a544[_0x7d13('0x1e')]=qs['offset'](_0x4df563[_0x7d13('0x33')][_0x7d13('0x1e')]);}_0x31a544[_0x7d13('0x3b')]=qs[_0x7d13('0x3c')](_0x4df563[_0x7d13('0x33')][_0x7d13('0x3c')]);_0x31a544['where']=qs[_0x7d13('0x34')](_['pick'](_0x4df563['query'],_0x36e3cf[_0x7d13('0x34')]),_0x256a3e);if(_0x4df563['query'][_0x7d13('0x3d')]){_0x31a544['where']=_['merge'](_0x31a544[_0x7d13('0x3e')],{'$or':_[_0x7d13('0x2c')](_0x256a3e,function(_0x53f7a1){if(_0x53f7a1[_0x7d13('0x2f')]!==_0x7d13('0x3f')){var _0x2b9bbd={};_0x2b9bbd[_0x53f7a1[_0x7d13('0x32')]]={'$like':'%'+_0x4df563[_0x7d13('0x33')][_0x7d13('0x3d')]+'%'};return _0x2b9bbd;}})});}_0x31a544=_[_0x7d13('0x40')]({},_0x31a544,_0x4df563[_0x7d13('0x41')]);var _0x557dce={'where':_0x31a544['where']};return db[_0x7d13('0x2d')][_0x7d13('0x21')](_0x557dce)['then'](function(_0xa41f33){_0x5899f7['count']=_0xa41f33;if(_0x4df563[_0x7d13('0x33')][_0x7d13('0x42')]){_0x31a544[_0x7d13('0x43')]=[{'all':!![]}];}return db[_0x7d13('0x2d')][_0x7d13('0x44')](_0x31a544);})[_0x7d13('0x27')](function(_0x5acdb7){_0x5899f7['rows']=_0x5acdb7;return _0x5899f7;})[_0x7d13('0x27')](respondWithFilteredResult(_0x2a8e43,_0x31a544))[_0x7d13('0x45')](handleError(_0x2a8e43,null));};exports[_0x7d13('0x46')]=function(_0x4a6969,_0x533364){var _0x421ca0={'raw':!![],'where':{'id':_0x4a6969[_0x7d13('0x47')]['id']}},_0x171147={};_0x171147['model']=_[_0x7d13('0x48')](db[_0x7d13('0x2d')]['rawAttributes']);_0x171147['query']=_[_0x7d13('0x48')](_0x4a6969[_0x7d13('0x33')]);_0x171147[_0x7d13('0x34')]=_[_0x7d13('0x35')](_0x171147[_0x7d13('0x31')],_0x171147[_0x7d13('0x33')]);_0x421ca0[_0x7d13('0x37')]=_[_0x7d13('0x35')](_0x171147[_0x7d13('0x31')],qs[_0x7d13('0x36')](_0x4a6969[_0x7d13('0x33')][_0x7d13('0x36')]));_0x421ca0['attributes']=_0x421ca0['attributes']['length']?_0x421ca0[_0x7d13('0x37')]:_0x171147['model'];if(_0x4a6969[_0x7d13('0x33')]['includeAll']){_0x421ca0[_0x7d13('0x43')]=[{'all':!![]}];}_0x421ca0=_[_0x7d13('0x40')]({},_0x421ca0,_0x4a6969['options']);return db[_0x7d13('0x2d')][_0x7d13('0x49')](_0x421ca0)[_0x7d13('0x27')](handleEntityNotFound(_0x533364,null))['then'](respondWithResult(_0x533364,null))[_0x7d13('0x45')](handleError(_0x533364,null));};exports[_0x7d13('0x4a')]=function(_0xb47f90,_0x3b4a18){return db[_0x7d13('0x2d')]['create'](_0xb47f90[_0x7d13('0x4b')],{})['then'](respondWithResult(_0x3b4a18,0xc9))['catch'](handleError(_0x3b4a18,null));};exports[_0x7d13('0x26')]=function(_0x4cb51f,_0x43b07b){if(_0x4cb51f[_0x7d13('0x4b')]['id']){delete _0x4cb51f[_0x7d13('0x4b')]['id'];}return db['Dynamics365Field'][_0x7d13('0x49')]({'where':{'id':_0x4cb51f[_0x7d13('0x47')]['id']}})[_0x7d13('0x27')](handleEntityNotFound(_0x43b07b,null))[_0x7d13('0x27')](saveUpdates(_0x4cb51f['body'],null))[_0x7d13('0x27')](respondWithResult(_0x43b07b,null))[_0x7d13('0x45')](handleError(_0x43b07b,null));};exports[_0x7d13('0x4c')]=function(_0x54864c,_0x517677){return db[_0x7d13('0x2d')][_0x7d13('0x49')]({'where':{'id':_0x54864c[_0x7d13('0x47')]['id']}})[_0x7d13('0x27')](handleEntityNotFound(_0x517677,null))[_0x7d13('0x27')](removeEntity(_0x517677,null))[_0x7d13('0x45')](handleError(_0x517677,null));}; \ No newline at end of file +var _0x8cc7=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','destroy','then','end','error','stack','send','Dynamics365Field','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','map','VIRTUAL','merge','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','update','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x8cc7,0xc7));var _0x78cc=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x8cc7[_0x47b58b];return _0x46bebe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x78cc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x78cc('0x1'));var moment=require('moment');var BPromise=require(_0x78cc('0x2'));var Mustache=require(_0x78cc('0x3'));var util=require(_0x78cc('0x4'));var path=require(_0x78cc('0x5'));var sox=require(_0x78cc('0x6'));var csv=require('to-csv');var ejs=require(_0x78cc('0x7'));var fs=require('fs');var fs_extra=require(_0x78cc('0x8'));var _=require(_0x78cc('0x9'));var squel=require(_0x78cc('0xa'));var crypto=require('crypto');var jsforce=require(_0x78cc('0xb'));var deskjs=require(_0x78cc('0xc'));var toCsv=require('to-csv');var querystring=require(_0x78cc('0xd'));var Papa=require(_0x78cc('0xe'));var Redis=require('ioredis');var authService=require(_0x78cc('0xf'));var qs=require(_0x78cc('0x10'));var as=require(_0x78cc('0x11'));var hardwareService=require(_0x78cc('0x12'));var logger=require(_0x78cc('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x78cc('0x14'));var db=require(_0x78cc('0x15'))['db'];function respondWithStatusCode(_0x533839,_0x58e281){_0x58e281=_0x58e281||0xcc;return function(_0x99d533){if(_0x99d533){return _0x533839[_0x78cc('0x16')](_0x58e281);}return _0x533839[_0x78cc('0x17')](_0x58e281)['end']();};}function respondWithResult(_0x187d42,_0x41eadb){_0x41eadb=_0x41eadb||0xc8;return function(_0x921c){if(_0x921c){return _0x187d42[_0x78cc('0x17')](_0x41eadb)['json'](_0x921c);}};}function respondWithFilteredResult(_0x4f2ad6,_0x1bc52e){return function(_0x436d8c){if(_0x436d8c){var _0x73d072=typeof _0x1bc52e[_0x78cc('0x18')]===_0x78cc('0x19')&&typeof _0x1bc52e[_0x78cc('0x1a')]===_0x78cc('0x19');var _0xa159b1=_0x436d8c['count'];var _0x3bea44=_0x73d072?0x0:_0x1bc52e[_0x78cc('0x18')];var _0x405096=_0x73d072?_0x436d8c[_0x78cc('0x1b')]:_0x1bc52e[_0x78cc('0x18')]+_0x1bc52e[_0x78cc('0x1a')];var _0x1d9f78;if(_0x405096>=_0xa159b1){_0x405096=_0xa159b1;_0x1d9f78=0xc8;}else{_0x1d9f78=0xce;}_0x4f2ad6['status'](_0x1d9f78);return _0x4f2ad6[_0x78cc('0x1c')](_0x78cc('0x1d'),_0x3bea44+'-'+_0x405096+'/'+_0xa159b1)[_0x78cc('0x1e')](_0x436d8c);}return null;};}function patchUpdates(_0x53cd18){return function(_0x18caae){try{jsonpatch['apply'](_0x18caae,_0x53cd18,!![]);}catch(_0x138875){return BPromise[_0x78cc('0x1f')](_0x138875);}return _0x18caae[_0x78cc('0x20')]();};}function saveUpdates(_0x2e77a6,_0x22042a){return function(_0x316e8b){if(_0x316e8b){return _0x316e8b['update'](_0x2e77a6)['then'](function(_0x298e2d){return _0x298e2d;});}return null;};}function removeEntity(_0x105f99,_0x2be36d){return function(_0x4d889d){if(_0x4d889d){return _0x4d889d[_0x78cc('0x21')]()[_0x78cc('0x22')](function(){_0x105f99['status'](0xcc)[_0x78cc('0x23')]();});}};}function handleEntityNotFound(_0xd8075e,_0x4739e5){return function(_0x4f68be){if(!_0x4f68be){_0xd8075e['sendStatus'](0x194);}return _0x4f68be;};}function handleError(_0x4d8345,_0x26515b){_0x26515b=_0x26515b||0x1f4;return function(_0x3433bc){logger[_0x78cc('0x24')](_0x3433bc[_0x78cc('0x25')]);if(_0x3433bc['name']){delete _0x3433bc['name'];}_0x4d8345[_0x78cc('0x17')](_0x26515b)[_0x78cc('0x26')](_0x3433bc);};}exports['index']=function(_0x4435d9,_0x1cb05c){var _0x1972ef={},_0x45c2e9={},_0x52c813={'count':0x0,'rows':[]};var _0x183766=_['map'](db[_0x78cc('0x27')]['rawAttributes'],function(_0xe44e60){return{'name':_0xe44e60['fieldName'],'type':_0xe44e60[_0x78cc('0x28')][_0x78cc('0x29')]};});_0x45c2e9[_0x78cc('0x2a')]=_['map'](_0x183766,_0x78cc('0x2b'));_0x45c2e9[_0x78cc('0x2c')]=_[_0x78cc('0x2d')](_0x4435d9[_0x78cc('0x2c')]);_0x45c2e9[_0x78cc('0x2e')]=_[_0x78cc('0x2f')](_0x45c2e9[_0x78cc('0x2a')],_0x45c2e9[_0x78cc('0x2c')]);_0x1972ef[_0x78cc('0x30')]=_[_0x78cc('0x2f')](_0x45c2e9['model'],qs[_0x78cc('0x31')](_0x4435d9['query'][_0x78cc('0x31')]));_0x1972ef[_0x78cc('0x30')]=_0x1972ef[_0x78cc('0x30')][_0x78cc('0x32')]?_0x1972ef[_0x78cc('0x30')]:_0x45c2e9['model'];if(!_0x4435d9[_0x78cc('0x2c')][_0x78cc('0x33')]('nolimit')){_0x1972ef[_0x78cc('0x1a')]=qs[_0x78cc('0x1a')](_0x4435d9['query'][_0x78cc('0x1a')]);_0x1972ef['offset']=qs['offset'](_0x4435d9[_0x78cc('0x2c')][_0x78cc('0x18')]);}_0x1972ef['order']=qs[_0x78cc('0x34')](_0x4435d9[_0x78cc('0x2c')][_0x78cc('0x34')]);_0x1972ef[_0x78cc('0x35')]=qs['filters'](_[_0x78cc('0x36')](_0x4435d9['query'],_0x45c2e9['filters']),_0x183766);if(_0x4435d9[_0x78cc('0x2c')][_0x78cc('0x37')]){_0x1972ef[_0x78cc('0x35')]=_['merge'](_0x1972ef[_0x78cc('0x35')],{'$or':_[_0x78cc('0x38')](_0x183766,function(_0x1fec84){if(_0x1fec84['type']!==_0x78cc('0x39')){var _0x322d1a={};_0x322d1a[_0x1fec84[_0x78cc('0x2b')]]={'$like':'%'+_0x4435d9[_0x78cc('0x2c')][_0x78cc('0x37')]+'%'};return _0x322d1a;}})});}_0x1972ef=_[_0x78cc('0x3a')]({},_0x1972ef,_0x4435d9['options']);var _0x58dc12={'where':_0x1972ef[_0x78cc('0x35')]};return db[_0x78cc('0x27')]['count'](_0x58dc12)['then'](function(_0xf80743){_0x52c813['count']=_0xf80743;if(_0x4435d9[_0x78cc('0x2c')]['includeAll']){_0x1972ef[_0x78cc('0x3b')]=[{'all':!![]}];}return db[_0x78cc('0x27')][_0x78cc('0x3c')](_0x1972ef);})[_0x78cc('0x22')](function(_0x196369){_0x52c813[_0x78cc('0x3d')]=_0x196369;return _0x52c813;})[_0x78cc('0x22')](respondWithFilteredResult(_0x1cb05c,_0x1972ef))[_0x78cc('0x3e')](handleError(_0x1cb05c,null));};exports[_0x78cc('0x3f')]=function(_0x2786d5,_0x4dd639){var _0x230dd4={'raw':!![],'where':{'id':_0x2786d5[_0x78cc('0x40')]['id']}},_0x1226cd={};_0x1226cd[_0x78cc('0x2a')]=_['keys'](db[_0x78cc('0x27')]['rawAttributes']);_0x1226cd['query']=_[_0x78cc('0x2d')](_0x2786d5[_0x78cc('0x2c')]);_0x1226cd[_0x78cc('0x2e')]=_['intersection'](_0x1226cd[_0x78cc('0x2a')],_0x1226cd[_0x78cc('0x2c')]);_0x230dd4[_0x78cc('0x30')]=_[_0x78cc('0x2f')](_0x1226cd[_0x78cc('0x2a')],qs[_0x78cc('0x31')](_0x2786d5['query'][_0x78cc('0x31')]));_0x230dd4[_0x78cc('0x30')]=_0x230dd4[_0x78cc('0x30')][_0x78cc('0x32')]?_0x230dd4[_0x78cc('0x30')]:_0x1226cd[_0x78cc('0x2a')];if(_0x2786d5[_0x78cc('0x2c')][_0x78cc('0x41')]){_0x230dd4[_0x78cc('0x3b')]=[{'all':!![]}];}_0x230dd4=_[_0x78cc('0x3a')]({},_0x230dd4,_0x2786d5[_0x78cc('0x42')]);return db[_0x78cc('0x27')][_0x78cc('0x43')](_0x230dd4)[_0x78cc('0x22')](handleEntityNotFound(_0x4dd639,null))['then'](respondWithResult(_0x4dd639,null))['catch'](handleError(_0x4dd639,null));};exports[_0x78cc('0x44')]=function(_0x502dda,_0x2f58e4){return db[_0x78cc('0x27')]['create'](_0x502dda[_0x78cc('0x45')],{})[_0x78cc('0x22')](respondWithResult(_0x2f58e4,0xc9))['catch'](handleError(_0x2f58e4,null));};exports[_0x78cc('0x46')]=function(_0xc5c94d,_0x57b1e8){if(_0xc5c94d['body']['id']){delete _0xc5c94d[_0x78cc('0x45')]['id'];}return db[_0x78cc('0x27')][_0x78cc('0x43')]({'where':{'id':_0xc5c94d[_0x78cc('0x40')]['id']}})[_0x78cc('0x22')](handleEntityNotFound(_0x57b1e8,null))[_0x78cc('0x22')](saveUpdates(_0xc5c94d[_0x78cc('0x45')],null))[_0x78cc('0x22')](respondWithResult(_0x57b1e8,null))['catch'](handleError(_0x57b1e8,null));};exports['destroy']=function(_0x5779d5,_0x29344e){return db[_0x78cc('0x27')]['find']({'where':{'id':_0x5779d5[_0x78cc('0x40')]['id']}})[_0x78cc('0x22')](handleEntityNotFound(_0x29344e,null))['then'](removeEntity(_0x29344e,null))['catch'](handleError(_0x29344e,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 1c3d7cd..6ba309b 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 _0xc960=['FieldId','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','int_dynamics365_fields','dynamics365_unique_index','idField'];(function(_0x5515ca,_0x165547){var _0x3aaa35=function(_0x3589f7){while(--_0x3589f7){_0x5515ca['push'](_0x5515ca['shift']());}};_0x3aaa35(++_0x165547);}(_0xc960,0x17a));var _0x0c96=function(_0x1b0750,_0x336303){_0x1b0750=_0x1b0750-0x0;var _0x17aef7=_0xc960[_0x1b0750];return _0x17aef7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0c96('0x0'))('api');var moment=require(_0x0c96('0x1'));var BPromise=require(_0x0c96('0x2'));var rp=require(_0x0c96('0x3'));var fs=require('fs');var path=require(_0x0c96('0x4'));var rimraf=require(_0x0c96('0x5'));var config=require(_0x0c96('0x6'));var attributes=require(_0x0c96('0x7'));module[_0x0c96('0x8')]=function(_0x2d8fb0,_0x4f36bb){return _0x2d8fb0['define']('Dynamics365Field',attributes,{'tableName':_0x0c96('0x9'),'paranoid':![],'indexes':[{'name':_0x0c96('0xa'),'fields':[_0x0c96('0xb'),_0x0c96('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe23f=['FieldId','util','api','moment','bluebird','request-promise','./intDynamics365Field.attributes','exports','define','Dynamics365Field','dynamics365_unique_index','idField'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe23f,0x1b1));var _0xfe23=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xe23f[_0x53ccf2];return _0x5a2964;};'use strict';var _=require('lodash');var util=require(_0xfe23('0x0'));var logger=require('../../config/logger')(_0xfe23('0x1'));var moment=require(_0xfe23('0x2'));var BPromise=require(_0xfe23('0x3'));var rp=require(_0xfe23('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfe23('0x5'));module[_0xfe23('0x6')]=function(_0x2feeb4,_0x296d33){return _0x2feeb4[_0xfe23('0x7')](_0xfe23('0x8'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xfe23('0x9'),'fields':[_0xfe23('0xa'),_0xfe23('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index e8d8d97..d2bb1fc 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 _0x0140=['../../config/logger','rpc','../../config/environment','client','http','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x3a115e,_0x3dac39){var _0x1b7e61=function(_0x393180){while(--_0x393180){_0x3a115e['push'](_0x3a115e['shift']());}};_0x1b7e61(++_0x3dac39);}(_0x0140,0x177));var _0x0014=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0x0140[_0x2adbeb];return _0x5e18a6;};'use strict';var _=require(_0x0014('0x0'));var util=require('util');var moment=require(_0x0014('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0014('0x2'));var db=require(_0x0014('0x3'))['db'];var utils=require(_0x0014('0x4'));var logger=require(_0x0014('0x5'))(_0x0014('0x6'));var config=require(_0x0014('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0014('0x8')][_0x0014('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e15d9,_0xcf898a,_0x5ad2a6){return new BPromise(function(_0x2e8efe,_0x173b85){return client['request'](_0x1e15d9,_0x5ad2a6)[_0x0014('0xa')](function(_0x27993b){logger[_0x0014('0xb')](_0x0014('0xc'),_0xcf898a,_0x0014('0xd'));logger[_0x0014('0xe')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0xcf898a,_0x0014('0xd'),JSON[_0x0014('0xf')](_0x27993b));if(_0x27993b[_0x0014('0x10')]){if(_0x27993b[_0x0014('0x10')][_0x0014('0x11')]===0x1f4){logger[_0x0014('0x10')](_0x0014('0xc'),_0xcf898a,_0x27993b['error']['message']);return _0x173b85(_0x27993b['error'][_0x0014('0x12')]);}logger[_0x0014('0x10')](_0x0014('0xc'),_0xcf898a,_0x27993b['error'][_0x0014('0x12')]);return _0x2e8efe(_0x27993b['error']['message']);}else{logger[_0x0014('0xb')](_0x0014('0xc'),_0xcf898a,_0x0014('0xd'));_0x2e8efe(_0x27993b[_0x0014('0x13')][_0x0014('0x12')]);}})['catch'](function(_0x1bfa44){logger[_0x0014('0x10')](_0x0014('0xc'),_0xcf898a,_0x1bfa44);_0x173b85(_0x1bfa44);});});} \ No newline at end of file +var _0x9da3=['request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x5676fc,_0x1507e4){var _0x13999b=function(_0x11395a){while(--_0x11395a){_0x5676fc['push'](_0x5676fc['shift']());}};_0x13999b(++_0x1507e4);}(_0x9da3,0x8f));var _0x39da=function(_0xd0b60,_0xcacdaa){_0xd0b60=_0xd0b60-0x0;var _0x14851a=_0x9da3[_0xd0b60];return _0x14851a;};'use strict';var _=require(_0x39da('0x0'));var util=require('util');var moment=require(_0x39da('0x1'));var BPromise=require(_0x39da('0x2'));var rs=require(_0x39da('0x3'));var fs=require('fs');var Redis=require(_0x39da('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x39da('0x5'));var logger=require(_0x39da('0x6'))('rpc');var config=require(_0x39da('0x7'));var jayson=require(_0x39da('0x8'));var client=jayson[_0x39da('0x9')][_0x39da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21727b,_0x12fd43,_0xa8199){return new BPromise(function(_0x34fd76,_0x1174d4){return client[_0x39da('0xb')](_0x21727b,_0xa8199)[_0x39da('0xc')](function(_0xeadccc){logger[_0x39da('0xd')](_0x39da('0xe'),_0x12fd43,'request\x20sent');logger[_0x39da('0xf')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x12fd43,_0x39da('0x10'),JSON[_0x39da('0x11')](_0xeadccc));if(_0xeadccc[_0x39da('0x12')]){if(_0xeadccc['error'][_0x39da('0x13')]===0x1f4){logger['error'](_0x39da('0xe'),_0x12fd43,_0xeadccc[_0x39da('0x12')][_0x39da('0x14')]);return _0x1174d4(_0xeadccc[_0x39da('0x12')]['message']);}logger[_0x39da('0x12')](_0x39da('0xe'),_0x12fd43,_0xeadccc[_0x39da('0x12')][_0x39da('0x14')]);return _0x34fd76(_0xeadccc[_0x39da('0x12')][_0x39da('0x14')]);}else{logger[_0x39da('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x12fd43,'request\x20sent');_0x34fd76(_0xeadccc['result'][_0x39da('0x14')]);}})[_0x39da('0x15')](function(_0x302757){logger[_0x39da('0x12')](_0x39da('0xe'),_0x12fd43,_0x302757);_0x1174d4(_0x302757);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 6bd7c93..f548ed4 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 _0xafff=['../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x4553e4,_0x1fec90){var _0x4dcfcf=function(_0x3145b9){while(--_0x3145b9){_0x4553e4['push'](_0x4553e4['shift']());}};_0x4dcfcf(++_0x1fec90);}(_0xafff,0x10d));var _0xfaff=function(_0x22e256,_0x144b14){_0x22e256=_0x22e256-0x0;var _0x58602a=_0xafff[_0x22e256];return _0x58602a;};'use strict';var multer=require(_0xfaff('0x0'));var util=require(_0xfaff('0x1'));var path=require(_0xfaff('0x2'));var timeout=require(_0xfaff('0x3'));var express=require(_0xfaff('0x4'));var router=express['Router']();var fs_extra=require(_0xfaff('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfaff('0x6'));var config=require(_0xfaff('0x7'));var controller=require(_0xfaff('0x8'));router[_0xfaff('0x9')]('/',auth[_0xfaff('0xa')](),controller[_0xfaff('0xb')]);router[_0xfaff('0x9')](_0xfaff('0xc'),auth[_0xfaff('0xa')](),controller[_0xfaff('0xd')]);router['get'](_0xfaff('0xe'),auth[_0xfaff('0xa')](),controller[_0xfaff('0xf')]);router['get'](_0xfaff('0x10'),auth['isAuthenticated'](),controller[_0xfaff('0x11')]);router[_0xfaff('0x12')]('/',auth[_0xfaff('0xa')](),controller[_0xfaff('0x13')]);router[_0xfaff('0x12')](_0xfaff('0xe'),auth['isAuthenticated'](),controller[_0xfaff('0x14')]);router[_0xfaff('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xfaff('0x16')]);router['delete']('/:id',auth[_0xfaff('0xa')](),controller[_0xfaff('0x17')]);module[_0xfaff('0x18')]=router; \ No newline at end of file +var _0xa8e7=['post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x2cd52b,_0x55326f){var _0x126e79=function(_0x315f7d){while(--_0x315f7d){_0x2cd52b['push'](_0x2cd52b['shift']());}};_0x126e79(++_0x55326f);}(_0xa8e7,0x1ac));var _0x7a8e=function(_0xd344ef,_0x132b5f){_0xd344ef=_0xd344ef-0x0;var _0x50a171=_0xa8e7[_0xd344ef];return _0x50a171;};'use strict';var multer=require(_0x7a8e('0x0'));var util=require(_0x7a8e('0x1'));var path=require(_0x7a8e('0x2'));var timeout=require(_0x7a8e('0x3'));var express=require(_0x7a8e('0x4'));var router=express[_0x7a8e('0x5')]();var fs_extra=require(_0x7a8e('0x6'));var auth=require(_0x7a8e('0x7'));var interaction=require(_0x7a8e('0x8'));var config=require(_0x7a8e('0x9'));var controller=require(_0x7a8e('0xa'));router[_0x7a8e('0xb')]('/',auth[_0x7a8e('0xc')](),controller[_0x7a8e('0xd')]);router[_0x7a8e('0xb')](_0x7a8e('0xe'),auth[_0x7a8e('0xc')](),controller[_0x7a8e('0xf')]);router[_0x7a8e('0xb')](_0x7a8e('0x10'),auth['isAuthenticated'](),controller[_0x7a8e('0x11')]);router['get'](_0x7a8e('0x12'),auth['isAuthenticated'](),controller[_0x7a8e('0x13')]);router[_0x7a8e('0x14')]('/',auth[_0x7a8e('0xc')](),controller[_0x7a8e('0x15')]);router['post'](_0x7a8e('0x10'),auth[_0x7a8e('0xc')](),controller[_0x7a8e('0x16')]);router[_0x7a8e('0x17')](_0x7a8e('0xe'),auth[_0x7a8e('0xc')](),controller[_0x7a8e('0x18')]);router[_0x7a8e('0x19')](_0x7a8e('0xe'),auth['isAuthenticated'](),controller[_0x7a8e('0x1a')]);module[_0x7a8e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index af40b8e..e158b77 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 _0x6d11=['exports','STRING','sequelize'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x6d11,0xbf));var _0x16d1=function(_0x5f3309,_0x37871b){_0x5f3309=_0x5f3309-0x0;var _0xea65ec=_0x6d11[_0x5f3309];return _0xea65ec;};'use strict';var Sequelize=require(_0x16d1('0x0'));module[_0x16d1('0x1')]={'name':{'type':Sequelize[_0x16d1('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x16d1('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x16d1('0x2')]},'remoteUri':{'type':Sequelize[_0x16d1('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x1a85=['STRING','remoteUri'];(function(_0x12aa2d,_0x352204){var _0x45a2e3=function(_0x3234bd){while(--_0x3234bd){_0x12aa2d['push'](_0x12aa2d['shift']());}};_0x45a2e3(++_0x352204);}(_0x1a85,0x178));var _0x51a8=function(_0x28b301,_0x1dd9f9){_0x28b301=_0x28b301-0x0;var _0x4febe0=_0x1a85[_0x28b301];return _0x4febe0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x51a8('0x0')]},'description':{'type':Sequelize[_0x51a8('0x0')]},'username':{'type':Sequelize[_0x51a8('0x0')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x51a8('0x0')],'unique':_0x51a8('0x1')},'serverUrl':{'type':Sequelize[_0x51a8('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index fa077ea..4cbed59 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 _0xaf4c=['priority','group','source','ticket_type','remove','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','FreshdeskAccount','key','query','filters','intersection','model','attributes','fields','length','pick','where','merge','type','VIRTUAL','filter','options','count','include','rows','catch','params','keys','rawAttributes','includeAll','find','create','body','update','getConfigurations','findOne','order','sort','hasOwnProperty','nolimit','addConfiguration','AccountId','getSubjects','channel','getDescriptions','FreshdeskConfiguration','Subjects','FreshdeskField','Descriptions','apiKey','remoteUri','substring','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','subject','agent','description'];(function(_0x5533d4,_0x525249){var _0x4cabd2=function(_0x3a9583){while(--_0x3a9583){_0x5533d4['push'](_0x5533d4['shift']());}};_0x4cabd2(++_0x525249);}(_0xaf4c,0x1ed));var _0xcaf4=function(_0x3aff3a,_0x4dda76){_0x3aff3a=_0x3aff3a-0x0;var _0xe4cb01=_0xaf4c[_0x3aff3a];return _0xe4cb01;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcaf4('0x0'));var zipdir=require(_0xcaf4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcaf4('0x2'));var moment=require(_0xcaf4('0x3'));var BPromise=require(_0xcaf4('0x4'));var Mustache=require('mustache');var util=require(_0xcaf4('0x5'));var path=require(_0xcaf4('0x6'));var sox=require(_0xcaf4('0x7'));var csv=require('to-csv');var ejs=require(_0xcaf4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcaf4('0x9'));var squel=require(_0xcaf4('0xa'));var crypto=require(_0xcaf4('0xb'));var jsforce=require(_0xcaf4('0xc'));var deskjs=require(_0xcaf4('0xd'));var toCsv=require(_0xcaf4('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcaf4('0xf'));var authService=require(_0xcaf4('0x10'));var qs=require(_0xcaf4('0x11'));var as=require(_0xcaf4('0x12'));var hardwareService=require(_0xcaf4('0x13'));var logger=require(_0xcaf4('0x14'))(_0xcaf4('0x15'));var utils=require(_0xcaf4('0x16'));var config=require(_0xcaf4('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xcaf4('0x18'))['db'];var integrations=require(_0xcaf4('0x19'));function respondWithStatusCode(_0x4d270c,_0x308173){_0x308173=_0x308173||0xcc;return function(_0x36df7b){if(_0x36df7b){return _0x4d270c[_0xcaf4('0x1a')](_0x308173);}return _0x4d270c['status'](_0x308173)[_0xcaf4('0x1b')]();};}function respondWithResult(_0x2ad48b,_0x593c44){_0x593c44=_0x593c44||0xc8;return function(_0x3e33e7){if(_0x3e33e7){return _0x2ad48b['status'](_0x593c44)[_0xcaf4('0x1c')](_0x3e33e7);}};}function respondWithFilteredResult(_0x191f38,_0x67532a){return function(_0x1ec93e){if(_0x1ec93e){var _0x1380f9=typeof _0x67532a[_0xcaf4('0x1d')]==='undefined'&&typeof _0x67532a[_0xcaf4('0x1e')]==='undefined';var _0x31743d=_0x1ec93e['count'];var _0x17e2e6=_0x1380f9?0x0:_0x67532a[_0xcaf4('0x1d')];var _0x3b4967=_0x1380f9?_0x1ec93e['count']:_0x67532a['offset']+_0x67532a[_0xcaf4('0x1e')];var _0x2c9828;if(_0x3b4967>=_0x31743d){_0x3b4967=_0x31743d;_0x2c9828=0xc8;}else{_0x2c9828=0xce;}_0x191f38[_0xcaf4('0x1f')](_0x2c9828);return _0x191f38[_0xcaf4('0x20')](_0xcaf4('0x21'),_0x17e2e6+'-'+_0x3b4967+'/'+_0x31743d)['json'](_0x1ec93e);}return null;};}function patchUpdates(_0x42d129){return function(_0x3ba74d){try{jsonpatch[_0xcaf4('0x22')](_0x3ba74d,_0x42d129,!![]);}catch(_0x58ada1){return BPromise[_0xcaf4('0x23')](_0x58ada1);}return _0x3ba74d[_0xcaf4('0x24')]();};}function saveUpdates(_0x39ff5d,_0x5b6525){return function(_0xaab3f9){if(_0xaab3f9){return _0xaab3f9['update'](_0x39ff5d)[_0xcaf4('0x25')](function(_0x3fb28a){return _0x3fb28a;});}return null;};}function removeEntity(_0x1d9f77,_0x5e4af3){return function(_0x2078d9){if(_0x2078d9){return _0x2078d9[_0xcaf4('0x26')]()[_0xcaf4('0x25')](function(){_0x1d9f77[_0xcaf4('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45f729,_0xf9fe54){return function(_0x47ae06){if(!_0x47ae06){_0x45f729[_0xcaf4('0x1a')](0x194);}return _0x47ae06;};}function handleError(_0x34b464,_0x43c05d){_0x43c05d=_0x43c05d||0x1f4;return function(_0xaf7045){logger[_0xcaf4('0x27')](_0xaf7045[_0xcaf4('0x28')]);if(_0xaf7045[_0xcaf4('0x29')]){delete _0xaf7045['name'];}_0x34b464[_0xcaf4('0x1f')](_0x43c05d)[_0xcaf4('0x2a')](_0xaf7045);};}exports[_0xcaf4('0x2b')]=function(_0x521926,_0x175cec){var _0x201371={},_0x1fca09={},_0x333249={'count':0x0,'rows':[]};var _0xfac767=_[_0xcaf4('0x2c')](db[_0xcaf4('0x2d')]['rawAttributes'],function(_0x8126a7){return{'name':_0x8126a7['fieldName'],'type':_0x8126a7['type'][_0xcaf4('0x2e')]};});_0x1fca09['model']=_[_0xcaf4('0x2c')](_0xfac767,'name');_0x1fca09[_0xcaf4('0x2f')]=_['keys'](_0x521926[_0xcaf4('0x2f')]);_0x1fca09[_0xcaf4('0x30')]=_[_0xcaf4('0x31')](_0x1fca09[_0xcaf4('0x32')],_0x1fca09[_0xcaf4('0x2f')]);_0x201371[_0xcaf4('0x33')]=_[_0xcaf4('0x31')](_0x1fca09[_0xcaf4('0x32')],qs['fields'](_0x521926[_0xcaf4('0x2f')][_0xcaf4('0x34')]));_0x201371[_0xcaf4('0x33')]=_0x201371[_0xcaf4('0x33')][_0xcaf4('0x35')]?_0x201371['attributes']:_0x1fca09['model'];if(!_0x521926['query']['hasOwnProperty']('nolimit')){_0x201371[_0xcaf4('0x1e')]=qs[_0xcaf4('0x1e')](_0x521926[_0xcaf4('0x2f')]['limit']);_0x201371[_0xcaf4('0x1d')]=qs[_0xcaf4('0x1d')](_0x521926[_0xcaf4('0x2f')][_0xcaf4('0x1d')]);}_0x201371['order']=qs['sort'](_0x521926['query']['sort']);_0x201371['where']=qs[_0xcaf4('0x30')](_[_0xcaf4('0x36')](_0x521926['query'],_0x1fca09[_0xcaf4('0x30')]),_0xfac767);if(_0x521926[_0xcaf4('0x2f')]['filter']){_0x201371[_0xcaf4('0x37')]=_[_0xcaf4('0x38')](_0x201371[_0xcaf4('0x37')],{'$or':_['map'](_0xfac767,function(_0x4b8f50){if(_0x4b8f50[_0xcaf4('0x39')]!==_0xcaf4('0x3a')){var _0x2e554a={};_0x2e554a[_0x4b8f50[_0xcaf4('0x29')]]={'$like':'%'+_0x521926['query'][_0xcaf4('0x3b')]+'%'};return _0x2e554a;}})});}_0x201371=_[_0xcaf4('0x38')]({},_0x201371,_0x521926[_0xcaf4('0x3c')]);var _0x53655b={'where':_0x201371[_0xcaf4('0x37')]};return db[_0xcaf4('0x2d')][_0xcaf4('0x3d')](_0x53655b)[_0xcaf4('0x25')](function(_0x3ad6b5){_0x333249[_0xcaf4('0x3d')]=_0x3ad6b5;if(_0x521926['query']['includeAll']){_0x201371[_0xcaf4('0x3e')]=[{'all':!![]}];}return db[_0xcaf4('0x2d')]['findAll'](_0x201371);})[_0xcaf4('0x25')](function(_0xf6f3e7){_0x333249[_0xcaf4('0x3f')]=_0xf6f3e7;return _0x333249;})[_0xcaf4('0x25')](respondWithFilteredResult(_0x175cec,_0x201371))[_0xcaf4('0x40')](handleError(_0x175cec,null));};exports['show']=function(_0x2597b9,_0x24800e){var _0x340566={'raw':![],'where':{'id':_0x2597b9[_0xcaf4('0x41')]['id']}},_0x1c0abe={};_0x1c0abe['model']=_[_0xcaf4('0x42')](db[_0xcaf4('0x2d')][_0xcaf4('0x43')]);_0x1c0abe['query']=_[_0xcaf4('0x42')](_0x2597b9[_0xcaf4('0x2f')]);_0x1c0abe['filters']=_[_0xcaf4('0x31')](_0x1c0abe[_0xcaf4('0x32')],_0x1c0abe[_0xcaf4('0x2f')]);_0x340566['attributes']=_[_0xcaf4('0x31')](_0x1c0abe[_0xcaf4('0x32')],qs[_0xcaf4('0x34')](_0x2597b9[_0xcaf4('0x2f')][_0xcaf4('0x34')]));_0x340566[_0xcaf4('0x33')]=_0x340566[_0xcaf4('0x33')]['length']?_0x340566[_0xcaf4('0x33')]:_0x1c0abe[_0xcaf4('0x32')];if(_0x2597b9[_0xcaf4('0x2f')][_0xcaf4('0x44')]){_0x340566[_0xcaf4('0x3e')]=[{'all':!![]}];}_0x340566=_[_0xcaf4('0x38')]({},_0x340566,_0x2597b9[_0xcaf4('0x3c')]);return db[_0xcaf4('0x2d')][_0xcaf4('0x45')](_0x340566)['then'](handleEntityNotFound(_0x24800e,null))['then'](respondWithResult(_0x24800e,null))[_0xcaf4('0x40')](handleError(_0x24800e,null));};exports[_0xcaf4('0x46')]=function(_0x40179c,_0x451f1e){return db['FreshdeskAccount']['create'](_0x40179c[_0xcaf4('0x47')],{})[_0xcaf4('0x25')](respondWithResult(_0x451f1e,0xc9))['catch'](handleError(_0x451f1e,null));};exports[_0xcaf4('0x48')]=function(_0x37a2ba,_0x17f030){if(_0x37a2ba[_0xcaf4('0x47')]['id']){delete _0x37a2ba[_0xcaf4('0x47')]['id'];}return db[_0xcaf4('0x2d')][_0xcaf4('0x45')]({'where':{'id':_0x37a2ba[_0xcaf4('0x41')]['id']}})['then'](handleEntityNotFound(_0x17f030,null))['then'](saveUpdates(_0x37a2ba[_0xcaf4('0x47')],null))[_0xcaf4('0x25')](respondWithResult(_0x17f030,null))[_0xcaf4('0x40')](handleError(_0x17f030,null));};exports['destroy']=function(_0x29ca80,_0x2d35be){return db['FreshdeskAccount'][_0xcaf4('0x45')]({'where':{'id':_0x29ca80[_0xcaf4('0x41')]['id']}})[_0xcaf4('0x25')](handleEntityNotFound(_0x2d35be,null))[_0xcaf4('0x25')](removeEntity(_0x2d35be,null))[_0xcaf4('0x40')](handleError(_0x2d35be,null));};exports[_0xcaf4('0x49')]=function(_0x4edf31,_0x336ba8,_0x3b93e4){var _0x4c0b37={};var _0x1983dc={};var _0x5ce637;var _0x51c928;return db['FreshdeskAccount'][_0xcaf4('0x4a')]({'where':{'id':_0x4edf31[_0xcaf4('0x41')]['id']}})[_0xcaf4('0x25')](handleEntityNotFound(_0x336ba8,null))[_0xcaf4('0x25')](function(_0x35de1f){if(_0x35de1f){_0x5ce637=_0x35de1f;_0x1983dc[_0xcaf4('0x32')]=_['keys'](db['FreshdeskConfiguration'][_0xcaf4('0x43')]);_0x1983dc[_0xcaf4('0x2f')]=_['keys'](_0x4edf31[_0xcaf4('0x2f')]);_0x1983dc[_0xcaf4('0x30')]=_[_0xcaf4('0x31')](_0x1983dc[_0xcaf4('0x32')],_0x1983dc[_0xcaf4('0x2f')]);_0x4c0b37[_0xcaf4('0x33')]=_['intersection'](_0x1983dc[_0xcaf4('0x32')],qs['fields'](_0x4edf31['query'][_0xcaf4('0x34')]));_0x4c0b37['attributes']=_0x4c0b37[_0xcaf4('0x33')]['length']?_0x4c0b37[_0xcaf4('0x33')]:_0x1983dc[_0xcaf4('0x32')];_0x4c0b37[_0xcaf4('0x4b')]=qs['sort'](_0x4edf31[_0xcaf4('0x2f')][_0xcaf4('0x4c')]);_0x4c0b37[_0xcaf4('0x37')]=qs[_0xcaf4('0x30')](_[_0xcaf4('0x36')](_0x4edf31[_0xcaf4('0x2f')],_0x1983dc[_0xcaf4('0x30')]));if(_0x4edf31[_0xcaf4('0x2f')][_0xcaf4('0x3b')]){_0x4c0b37['where']=_[_0xcaf4('0x38')](_0x4c0b37['where'],{'$or':_[_0xcaf4('0x2c')](_0x4c0b37[_0xcaf4('0x33')],function(_0x3e6641){var _0x136f75={};_0x136f75[_0x3e6641]={'$like':'%'+_0x4edf31[_0xcaf4('0x2f')][_0xcaf4('0x3b')]+'%'};return _0x136f75;})});}_0x4c0b37=_[_0xcaf4('0x38')]({},_0x4c0b37,_0x4edf31[_0xcaf4('0x3c')]);return _0x5ce637['getConfigurations'](_0x4c0b37);}})[_0xcaf4('0x25')](function(_0x20448){if(_0x20448){_0x51c928=_0x20448[_0xcaf4('0x35')];if(!_0x4edf31[_0xcaf4('0x2f')][_0xcaf4('0x4d')](_0xcaf4('0x4e'))){_0x4c0b37[_0xcaf4('0x1e')]=qs[_0xcaf4('0x1e')](_0x4edf31['query'][_0xcaf4('0x1e')]);_0x4c0b37[_0xcaf4('0x1d')]=qs[_0xcaf4('0x1d')](_0x4edf31[_0xcaf4('0x2f')][_0xcaf4('0x1d')]);}return _0x5ce637[_0xcaf4('0x49')](_0x4c0b37);}})[_0xcaf4('0x25')](function(_0x2449d8){if(_0x2449d8){return _0x2449d8?{'count':_0x51c928,'rows':_0x2449d8}:null;}})[_0xcaf4('0x25')](respondWithResult(_0x336ba8,null))[_0xcaf4('0x40')](handleError(_0x336ba8,null));};exports[_0xcaf4('0x4f')]=function(_0xee99c4,_0x5e89a8,_0xd39332){if(_0xee99c4[_0xcaf4('0x47')]['id']){delete _0xee99c4[_0xcaf4('0x47')]['id'];}return db[_0xcaf4('0x2d')][_0xcaf4('0x4a')]({'where':{'id':_0xee99c4['params']['id']}})[_0xcaf4('0x25')](handleEntityNotFound(_0x5e89a8,null))[_0xcaf4('0x25')](function(_0x429b7a){if(_0x429b7a){_0xee99c4[_0xcaf4('0x47')][_0xcaf4('0x50')]=_0x429b7a['id'];_0xee99c4['body']['Subjects']=integrations[_0xcaf4('0x51')](_0xee99c4[_0xcaf4('0x47')][_0xcaf4('0x52')],_0xee99c4['body'][_0xcaf4('0x39')]);_0xee99c4[_0xcaf4('0x47')]['Descriptions']=integrations[_0xcaf4('0x53')](_0xee99c4['body'][_0xcaf4('0x52')],_0xee99c4['body'][_0xcaf4('0x39')]);return db[_0xcaf4('0x54')]['create'](_0xee99c4[_0xcaf4('0x47')],{'include':[{'model':db['FreshdeskField'],'as':_0xcaf4('0x55')},{'model':db[_0xcaf4('0x56')],'as':_0xcaf4('0x57')}]});}return null;})['then'](respondWithResult(_0x5e89a8,null))[_0xcaf4('0x40')](handleError(_0x5e89a8,null));};exports['getFields']=function(_0x435b23,_0x58a03f,_0x5a4932){var _0x4d8942='';return db[_0xcaf4('0x2d')][_0xcaf4('0x4a')]({'where':{'id':_0x435b23[_0xcaf4('0x41')]['id']},'attributes':['id','remoteUri',_0xcaf4('0x58')]})[_0xcaf4('0x25')](handleEntityNotFound(_0x58a03f,null))[_0xcaf4('0x25')](function(_0x39b606){if(_0x39b606){_0x4d8942=_0x39b606[_0xcaf4('0x59')];var _0x5c10eb=_0x4d8942['slice'](-0x1);if(_0x5c10eb==='/'){_0x4d8942=_0x4d8942[_0xcaf4('0x5a')](0x0,_0x4d8942[_0xcaf4('0x5b')](_0x5c10eb));}return rp({'method':_0xcaf4('0x5c'),'uri':util[_0xcaf4('0x5d')]('%s/%s',_0x4d8942,_0xcaf4('0x5e')),'headers':{'Authorization':util[_0xcaf4('0x5d')](_0xcaf4('0x5f'),new Buffer(util[_0xcaf4('0x5d')](_0xcaf4('0x60'),_0x39b606['apiKey']))[_0xcaf4('0x61')](_0xcaf4('0x62')))},'json':!![]});}})['then'](function(_0x1775b5){if(_0x1775b5){var _0x492c4e=['requester',_0xcaf4('0x63'),_0xcaf4('0x64'),_0xcaf4('0x65'),_0xcaf4('0x1f'),_0xcaf4('0x66'),_0xcaf4('0x67'),_0xcaf4('0x68'),_0xcaf4('0x69'),_0xcaf4('0x67'),'company'];_[_0xcaf4('0x6a')](_0x1775b5,function(_0x3e9a10){return _0x492c4e['includes'](_0x3e9a10[_0xcaf4('0x29')])||!_0x3e9a10[_0xcaf4('0x6b')]&&_0x3e9a10[_0xcaf4('0x39')]!==_0xcaf4('0x6c')&&_0x3e9a10[_0xcaf4('0x39')]!==_0xcaf4('0x6d');});return{'count':_0x1775b5['length'],'rows':_[_0xcaf4('0x2c')](_0x1775b5,function(_0x33e7b4){return{'id':_0x33e7b4[_0xcaf4('0x29')],'name':_0x33e7b4[_0xcaf4('0x6e')],'custom':!_0x33e7b4['default'],'options':_0x33e7b4['choices']?_[_0xcaf4('0x2c')](_0x33e7b4[_0xcaf4('0x6f')],function(_0x1763ba){return{'name':_[_0xcaf4('0x70')](_0x1763ba),'value':_0x1763ba};}):[]};})};}})[_0xcaf4('0x25')](respondWithResult(_0x58a03f,null))['catch'](function(_0x40ccc5){var _0x5f2acc=_0x435b23[_0xcaf4('0x2f')][_0xcaf4('0x71')]?0x1f4:_0x40ccc5[_0xcaf4('0x72')]||0x1f4;logger['error'](_0xcaf4('0x73'),_0xcaf4('0x74'),_0x5f2acc,JSON[_0xcaf4('0x75')](_0x40ccc5));delete _0x40ccc5[_0xcaf4('0x29')];if(_0x5f2acc===0x191){_0x5f2acc=0x190;}_0x58a03f[_0xcaf4('0x1f')](_0x5f2acc)[_0xcaf4('0x2a')](_0x435b23[_0xcaf4('0x2f')][_0xcaf4('0x71')]?{'message':_0xcaf4('0x76'),'statusCode':_0x40ccc5[_0xcaf4('0x72')]}:_0x40ccc5);});}; \ No newline at end of file +var _0x0f88=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','end','stack','name','send','index','map','FreshdeskAccount','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','then','findAll','rows','params','keys','rawAttributes','includeAll','include','find','catch','create','body','getConfigurations','order','pick','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','substring','GET','format','%s/%s','Basic\x20%s','toString','base64','requester','subject','agent','description','source','group','company','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0xfcd7c9,_0x4621fa){var _0x14a2d1=function(_0x47215c){while(--_0x47215c){_0xfcd7c9['push'](_0xfcd7c9['shift']());}};_0x14a2d1(++_0x4621fa);}(_0x0f88,0x1d9));var _0x80f8=function(_0x331b85,_0x5f3e6e){_0x331b85=_0x331b85-0x0;var _0x1b97b2=_0x0f88[_0x331b85];return _0x1b97b2;};'use strict';var emlformat=require(_0x80f8('0x0'));var rimraf=require(_0x80f8('0x1'));var zipdir=require(_0x80f8('0x2'));var jsonpatch=require(_0x80f8('0x3'));var rp=require(_0x80f8('0x4'));var moment=require(_0x80f8('0x5'));var BPromise=require(_0x80f8('0x6'));var Mustache=require(_0x80f8('0x7'));var util=require('util');var path=require(_0x80f8('0x8'));var sox=require('sox');var csv=require(_0x80f8('0x9'));var ejs=require(_0x80f8('0xa'));var fs=require('fs');var fs_extra=require(_0x80f8('0xb'));var _=require(_0x80f8('0xc'));var squel=require(_0x80f8('0xd'));var crypto=require(_0x80f8('0xe'));var jsforce=require(_0x80f8('0xf'));var deskjs=require(_0x80f8('0x10'));var toCsv=require(_0x80f8('0x9'));var querystring=require(_0x80f8('0x11'));var Papa=require(_0x80f8('0x12'));var Redis=require(_0x80f8('0x13'));var authService=require(_0x80f8('0x14'));var qs=require(_0x80f8('0x15'));var as=require(_0x80f8('0x16'));var hardwareService=require(_0x80f8('0x17'));var logger=require(_0x80f8('0x18'))(_0x80f8('0x19'));var utils=require(_0x80f8('0x1a'));var config=require(_0x80f8('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x80f8('0x1c'))['db'];var integrations=require(_0x80f8('0x1d'));function respondWithStatusCode(_0x35538b,_0x5e6020){_0x5e6020=_0x5e6020||0xcc;return function(_0x280db2){if(_0x280db2){return _0x35538b[_0x80f8('0x1e')](_0x5e6020);}return _0x35538b[_0x80f8('0x1f')](_0x5e6020)['end']();};}function respondWithResult(_0x4887d3,_0x4f8755){_0x4f8755=_0x4f8755||0xc8;return function(_0x5e29bf){if(_0x5e29bf){return _0x4887d3[_0x80f8('0x1f')](_0x4f8755)['json'](_0x5e29bf);}};}function respondWithFilteredResult(_0x2c9b94,_0x25c36b){return function(_0x381355){if(_0x381355){var _0x3817be=typeof _0x25c36b[_0x80f8('0x20')]===_0x80f8('0x21')&&typeof _0x25c36b[_0x80f8('0x22')]===_0x80f8('0x21');var _0x375f42=_0x381355[_0x80f8('0x23')];var _0x581196=_0x3817be?0x0:_0x25c36b[_0x80f8('0x20')];var _0x981e13=_0x3817be?_0x381355[_0x80f8('0x23')]:_0x25c36b[_0x80f8('0x20')]+_0x25c36b[_0x80f8('0x22')];var _0x538e77;if(_0x981e13>=_0x375f42){_0x981e13=_0x375f42;_0x538e77=0xc8;}else{_0x538e77=0xce;}_0x2c9b94[_0x80f8('0x1f')](_0x538e77);return _0x2c9b94[_0x80f8('0x24')]('Content-Range',_0x581196+'-'+_0x981e13+'/'+_0x375f42)[_0x80f8('0x25')](_0x381355);}return null;};}function patchUpdates(_0x3d23b5){return function(_0x50d3b9){try{jsonpatch[_0x80f8('0x26')](_0x50d3b9,_0x3d23b5,!![]);}catch(_0x29c71c){return BPromise[_0x80f8('0x27')](_0x29c71c);}return _0x50d3b9[_0x80f8('0x28')]();};}function saveUpdates(_0x214dc7,_0x1a4988){return function(_0x168009){if(_0x168009){return _0x168009[_0x80f8('0x29')](_0x214dc7)['then'](function(_0x26c62a){return _0x26c62a;});}return null;};}function removeEntity(_0x530350,_0x192ae5){return function(_0x5336ad){if(_0x5336ad){return _0x5336ad[_0x80f8('0x2a')]()['then'](function(){_0x530350[_0x80f8('0x1f')](0xcc)[_0x80f8('0x2b')]();});}};}function handleEntityNotFound(_0x5e3f76,_0x57fad1){return function(_0x53be8e){if(!_0x53be8e){_0x5e3f76[_0x80f8('0x1e')](0x194);}return _0x53be8e;};}function handleError(_0x3032bb,_0x4ae1a6){_0x4ae1a6=_0x4ae1a6||0x1f4;return function(_0x40ed3e){logger['error'](_0x40ed3e[_0x80f8('0x2c')]);if(_0x40ed3e['name']){delete _0x40ed3e[_0x80f8('0x2d')];}_0x3032bb['status'](_0x4ae1a6)[_0x80f8('0x2e')](_0x40ed3e);};}exports[_0x80f8('0x2f')]=function(_0x109ea3,_0x46d379){var _0x42e871={},_0x14fcce={},_0x436d24={'count':0x0,'rows':[]};var _0x1bd039=_[_0x80f8('0x30')](db[_0x80f8('0x31')]['rawAttributes'],function(_0x545f3c){return{'name':_0x545f3c[_0x80f8('0x32')],'type':_0x545f3c[_0x80f8('0x33')][_0x80f8('0x34')]};});_0x14fcce[_0x80f8('0x35')]=_['map'](_0x1bd039,_0x80f8('0x2d'));_0x14fcce[_0x80f8('0x36')]=_['keys'](_0x109ea3[_0x80f8('0x36')]);_0x14fcce['filters']=_[_0x80f8('0x37')](_0x14fcce['model'],_0x14fcce[_0x80f8('0x36')]);_0x42e871[_0x80f8('0x38')]=_['intersection'](_0x14fcce['model'],qs[_0x80f8('0x39')](_0x109ea3[_0x80f8('0x36')][_0x80f8('0x39')]));_0x42e871[_0x80f8('0x38')]=_0x42e871[_0x80f8('0x38')][_0x80f8('0x3a')]?_0x42e871[_0x80f8('0x38')]:_0x14fcce['model'];if(!_0x109ea3[_0x80f8('0x36')][_0x80f8('0x3b')](_0x80f8('0x3c'))){_0x42e871[_0x80f8('0x22')]=qs['limit'](_0x109ea3[_0x80f8('0x36')][_0x80f8('0x22')]);_0x42e871[_0x80f8('0x20')]=qs[_0x80f8('0x20')](_0x109ea3['query'][_0x80f8('0x20')]);}_0x42e871['order']=qs['sort'](_0x109ea3[_0x80f8('0x36')][_0x80f8('0x3d')]);_0x42e871[_0x80f8('0x3e')]=qs[_0x80f8('0x3f')](_['pick'](_0x109ea3[_0x80f8('0x36')],_0x14fcce[_0x80f8('0x3f')]),_0x1bd039);if(_0x109ea3[_0x80f8('0x36')][_0x80f8('0x40')]){_0x42e871[_0x80f8('0x3e')]=_[_0x80f8('0x41')](_0x42e871[_0x80f8('0x3e')],{'$or':_[_0x80f8('0x30')](_0x1bd039,function(_0x173c61){if(_0x173c61[_0x80f8('0x33')]!==_0x80f8('0x42')){var _0x592de={};_0x592de[_0x173c61[_0x80f8('0x2d')]]={'$like':'%'+_0x109ea3[_0x80f8('0x36')][_0x80f8('0x40')]+'%'};return _0x592de;}})});}_0x42e871=_[_0x80f8('0x41')]({},_0x42e871,_0x109ea3[_0x80f8('0x43')]);var _0x3940f1={'where':_0x42e871[_0x80f8('0x3e')]};return db['FreshdeskAccount'][_0x80f8('0x23')](_0x3940f1)[_0x80f8('0x44')](function(_0x4365a4){_0x436d24['count']=_0x4365a4;if(_0x109ea3['query']['includeAll']){_0x42e871['include']=[{'all':!![]}];}return db[_0x80f8('0x31')][_0x80f8('0x45')](_0x42e871);})[_0x80f8('0x44')](function(_0x1a9eb9){_0x436d24[_0x80f8('0x46')]=_0x1a9eb9;return _0x436d24;})[_0x80f8('0x44')](respondWithFilteredResult(_0x46d379,_0x42e871))['catch'](handleError(_0x46d379,null));};exports['show']=function(_0x3c6b03,_0x38a9c2){var _0x75feef={'raw':![],'where':{'id':_0x3c6b03[_0x80f8('0x47')]['id']}},_0x5ae1d={};_0x5ae1d['model']=_[_0x80f8('0x48')](db[_0x80f8('0x31')][_0x80f8('0x49')]);_0x5ae1d[_0x80f8('0x36')]=_[_0x80f8('0x48')](_0x3c6b03[_0x80f8('0x36')]);_0x5ae1d[_0x80f8('0x3f')]=_[_0x80f8('0x37')](_0x5ae1d[_0x80f8('0x35')],_0x5ae1d[_0x80f8('0x36')]);_0x75feef[_0x80f8('0x38')]=_[_0x80f8('0x37')](_0x5ae1d[_0x80f8('0x35')],qs[_0x80f8('0x39')](_0x3c6b03[_0x80f8('0x36')][_0x80f8('0x39')]));_0x75feef[_0x80f8('0x38')]=_0x75feef['attributes'][_0x80f8('0x3a')]?_0x75feef[_0x80f8('0x38')]:_0x5ae1d['model'];if(_0x3c6b03['query'][_0x80f8('0x4a')]){_0x75feef[_0x80f8('0x4b')]=[{'all':!![]}];}_0x75feef=_[_0x80f8('0x41')]({},_0x75feef,_0x3c6b03[_0x80f8('0x43')]);return db['FreshdeskAccount'][_0x80f8('0x4c')](_0x75feef)[_0x80f8('0x44')](handleEntityNotFound(_0x38a9c2,null))['then'](respondWithResult(_0x38a9c2,null))[_0x80f8('0x4d')](handleError(_0x38a9c2,null));};exports[_0x80f8('0x4e')]=function(_0x5be18f,_0x181487){return db[_0x80f8('0x31')]['create'](_0x5be18f[_0x80f8('0x4f')],{})['then'](respondWithResult(_0x181487,0xc9))[_0x80f8('0x4d')](handleError(_0x181487,null));};exports['update']=function(_0x3d73ac,_0xf2eb0){if(_0x3d73ac[_0x80f8('0x4f')]['id']){delete _0x3d73ac[_0x80f8('0x4f')]['id'];}return db[_0x80f8('0x31')][_0x80f8('0x4c')]({'where':{'id':_0x3d73ac[_0x80f8('0x47')]['id']}})[_0x80f8('0x44')](handleEntityNotFound(_0xf2eb0,null))['then'](saveUpdates(_0x3d73ac[_0x80f8('0x4f')],null))['then'](respondWithResult(_0xf2eb0,null))[_0x80f8('0x4d')](handleError(_0xf2eb0,null));};exports[_0x80f8('0x2a')]=function(_0x46135b,_0x2ba4c2){return db[_0x80f8('0x31')][_0x80f8('0x4c')]({'where':{'id':_0x46135b[_0x80f8('0x47')]['id']}})[_0x80f8('0x44')](handleEntityNotFound(_0x2ba4c2,null))[_0x80f8('0x44')](removeEntity(_0x2ba4c2,null))[_0x80f8('0x4d')](handleError(_0x2ba4c2,null));};exports[_0x80f8('0x50')]=function(_0x3aa28f,_0xb1204c,_0x133229){var _0x5848ca={};var _0x177e8d={};var _0x8c589f;var _0x87bb6a;return db[_0x80f8('0x31')]['findOne']({'where':{'id':_0x3aa28f[_0x80f8('0x47')]['id']}})['then'](handleEntityNotFound(_0xb1204c,null))[_0x80f8('0x44')](function(_0x3b886b){if(_0x3b886b){_0x8c589f=_0x3b886b;_0x177e8d[_0x80f8('0x35')]=_['keys'](db['FreshdeskConfiguration']['rawAttributes']);_0x177e8d[_0x80f8('0x36')]=_[_0x80f8('0x48')](_0x3aa28f[_0x80f8('0x36')]);_0x177e8d[_0x80f8('0x3f')]=_[_0x80f8('0x37')](_0x177e8d[_0x80f8('0x35')],_0x177e8d[_0x80f8('0x36')]);_0x5848ca['attributes']=_[_0x80f8('0x37')](_0x177e8d[_0x80f8('0x35')],qs[_0x80f8('0x39')](_0x3aa28f[_0x80f8('0x36')]['fields']));_0x5848ca[_0x80f8('0x38')]=_0x5848ca['attributes'][_0x80f8('0x3a')]?_0x5848ca[_0x80f8('0x38')]:_0x177e8d['model'];_0x5848ca[_0x80f8('0x51')]=qs[_0x80f8('0x3d')](_0x3aa28f[_0x80f8('0x36')]['sort']);_0x5848ca[_0x80f8('0x3e')]=qs['filters'](_[_0x80f8('0x52')](_0x3aa28f[_0x80f8('0x36')],_0x177e8d['filters']));if(_0x3aa28f[_0x80f8('0x36')][_0x80f8('0x40')]){_0x5848ca[_0x80f8('0x3e')]=_[_0x80f8('0x41')](_0x5848ca['where'],{'$or':_[_0x80f8('0x30')](_0x5848ca[_0x80f8('0x38')],function(_0x1735ea){var _0x40e717={};_0x40e717[_0x1735ea]={'$like':'%'+_0x3aa28f[_0x80f8('0x36')][_0x80f8('0x40')]+'%'};return _0x40e717;})});}_0x5848ca=_[_0x80f8('0x41')]({},_0x5848ca,_0x3aa28f[_0x80f8('0x43')]);return _0x8c589f[_0x80f8('0x50')](_0x5848ca);}})[_0x80f8('0x44')](function(_0x2a580){if(_0x2a580){_0x87bb6a=_0x2a580[_0x80f8('0x3a')];if(!_0x3aa28f['query'][_0x80f8('0x3b')](_0x80f8('0x3c'))){_0x5848ca[_0x80f8('0x22')]=qs[_0x80f8('0x22')](_0x3aa28f[_0x80f8('0x36')][_0x80f8('0x22')]);_0x5848ca[_0x80f8('0x20')]=qs[_0x80f8('0x20')](_0x3aa28f[_0x80f8('0x36')][_0x80f8('0x20')]);}return _0x8c589f[_0x80f8('0x50')](_0x5848ca);}})['then'](function(_0x522587){if(_0x522587){return _0x522587?{'count':_0x87bb6a,'rows':_0x522587}:null;}})['then'](respondWithResult(_0xb1204c,null))[_0x80f8('0x4d')](handleError(_0xb1204c,null));};exports[_0x80f8('0x53')]=function(_0x52e5e6,_0xebf443,_0x49100e){if(_0x52e5e6[_0x80f8('0x4f')]['id']){delete _0x52e5e6[_0x80f8('0x4f')]['id'];}return db['FreshdeskAccount'][_0x80f8('0x54')]({'where':{'id':_0x52e5e6[_0x80f8('0x47')]['id']}})[_0x80f8('0x44')](handleEntityNotFound(_0xebf443,null))[_0x80f8('0x44')](function(_0x138e34){if(_0x138e34){_0x52e5e6[_0x80f8('0x4f')][_0x80f8('0x55')]=_0x138e34['id'];_0x52e5e6['body'][_0x80f8('0x56')]=integrations[_0x80f8('0x57')](_0x52e5e6[_0x80f8('0x4f')][_0x80f8('0x58')],_0x52e5e6[_0x80f8('0x4f')][_0x80f8('0x33')]);_0x52e5e6[_0x80f8('0x4f')]['Descriptions']=integrations[_0x80f8('0x59')](_0x52e5e6[_0x80f8('0x4f')][_0x80f8('0x58')],_0x52e5e6[_0x80f8('0x4f')][_0x80f8('0x33')]);return db['FreshdeskConfiguration'][_0x80f8('0x4e')](_0x52e5e6[_0x80f8('0x4f')],{'include':[{'model':db[_0x80f8('0x5a')],'as':_0x80f8('0x56')},{'model':db[_0x80f8('0x5a')],'as':_0x80f8('0x5b')}]});}return null;})[_0x80f8('0x44')](respondWithResult(_0xebf443,null))[_0x80f8('0x4d')](handleError(_0xebf443,null));};exports[_0x80f8('0x5c')]=function(_0x4e6839,_0x100470,_0x1bfa2b){var _0x186d8c='';return db[_0x80f8('0x31')][_0x80f8('0x54')]({'where':{'id':_0x4e6839[_0x80f8('0x47')]['id']},'attributes':['id',_0x80f8('0x5d'),_0x80f8('0x5e')]})['then'](handleEntityNotFound(_0x100470,null))['then'](function(_0x22b786){if(_0x22b786){_0x186d8c=_0x22b786['remoteUri'];var _0xd4ba91=_0x186d8c[_0x80f8('0x5f')](-0x1);if(_0xd4ba91==='/'){_0x186d8c=_0x186d8c[_0x80f8('0x60')](0x0,_0x186d8c['lastIndexOf'](_0xd4ba91));}return rp({'method':_0x80f8('0x61'),'uri':util[_0x80f8('0x62')](_0x80f8('0x63'),_0x186d8c,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x80f8('0x62')](_0x80f8('0x64'),new Buffer(util['format']('%s:X',_0x22b786[_0x80f8('0x5e')]))[_0x80f8('0x65')](_0x80f8('0x66')))},'json':!![]});}})['then'](function(_0x59edbd){if(_0x59edbd){var _0x307a57=[_0x80f8('0x67'),_0x80f8('0x68'),_0x80f8('0x69'),_0x80f8('0x6a'),'status','priority','group',_0x80f8('0x6b'),'ticket_type',_0x80f8('0x6c'),_0x80f8('0x6d')];_['remove'](_0x59edbd,function(_0x1621b5){return _0x307a57[_0x80f8('0x6e')](_0x1621b5[_0x80f8('0x2d')])||!_0x1621b5[_0x80f8('0x6f')]&&_0x1621b5[_0x80f8('0x33')]!==_0x80f8('0x70')&&_0x1621b5[_0x80f8('0x33')]!==_0x80f8('0x71');});return{'count':_0x59edbd[_0x80f8('0x3a')],'rows':_[_0x80f8('0x30')](_0x59edbd,function(_0x554b5c){return{'id':_0x554b5c[_0x80f8('0x2d')],'name':_0x554b5c[_0x80f8('0x72')],'custom':!_0x554b5c[_0x80f8('0x6f')],'options':_0x554b5c[_0x80f8('0x73')]?_[_0x80f8('0x30')](_0x554b5c[_0x80f8('0x73')],function(_0x28d1d0){return{'name':_[_0x80f8('0x74')](_0x28d1d0),'value':_0x28d1d0};}):[]};})};}})[_0x80f8('0x44')](respondWithResult(_0x100470,null))['catch'](function(_0x2fdfe0){var _0x25af09=_0x4e6839[_0x80f8('0x36')][_0x80f8('0x75')]?0x1f4:_0x2fdfe0[_0x80f8('0x76')]||0x1f4;logger[_0x80f8('0x77')](_0x80f8('0x78'),_0x80f8('0x5c'),_0x25af09,JSON[_0x80f8('0x79')](_0x2fdfe0));delete _0x2fdfe0[_0x80f8('0x2d')];if(_0x25af09===0x191){_0x25af09=0x190;}_0x100470[_0x80f8('0x1f')](_0x25af09)[_0x80f8('0x2e')](_0x4e6839['query'][_0x80f8('0x75')]?{'message':_0x80f8('0x7a'),'statusCode':_0x2fdfe0[_0x80f8('0x76')]}:_0x2fdfe0);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 630fb26..1a4ddc0 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 _0xda46=['rimraf','../../config/environment','../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x97d7b3,_0x1e59b4){var _0x4be3d6=function(_0x38dc49){while(--_0x38dc49){_0x97d7b3['push'](_0x97d7b3['shift']());}};_0x4be3d6(++_0x1e59b4);}(_0xda46,0xbc));var _0x6da4=function(_0x3b429b,_0x99efec){_0x3b429b=_0x3b429b-0x0;var _0x503882=_0xda46[_0x3b429b];return _0x503882;};'use strict';var _=require(_0x6da4('0x0'));var util=require(_0x6da4('0x1'));var logger=require(_0x6da4('0x2'))('api');var moment=require(_0x6da4('0x3'));var BPromise=require(_0x6da4('0x4'));var rp=require(_0x6da4('0x5'));var fs=require('fs');var path=require(_0x6da4('0x6'));var rimraf=require(_0x6da4('0x7'));var config=require(_0x6da4('0x8'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x6da4('0x9'));module[_0x6da4('0xa')]=function(_0x4487a4,_0x238f68){return _0x4487a4['define'](_0x6da4('0xb'),attributes,{'tableName':_0x6da4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9cb=['FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x5776f0,_0x55bd02){var _0x4b1416=function(_0x2d20f8){while(--_0x2d20f8){_0x5776f0['push'](_0x5776f0['shift']());}};_0x4b1416(++_0x55bd02);}(_0xf9cb,0x11a));var _0xbf9c=function(_0x4a0e68,_0x45c08c){_0x4a0e68=_0x4a0e68-0x0;var _0x4fb274=_0xf9cb[_0x4a0e68];return _0x4fb274;};'use strict';var _=require(_0xbf9c('0x0'));var util=require('util');var logger=require(_0xbf9c('0x1'))(_0xbf9c('0x2'));var moment=require('moment');var BPromise=require(_0xbf9c('0x3'));var rp=require(_0xbf9c('0x4'));var fs=require('fs');var path=require(_0xbf9c('0x5'));var rimraf=require(_0xbf9c('0x6'));var config=require(_0xbf9c('0x7'));var attributes=require(_0xbf9c('0x8'));var integrations=require(_0xbf9c('0x9'));module[_0xbf9c('0xa')]=function(_0x221c5c,_0x215aa5){return _0x221c5c[_0xbf9c('0xb')](_0xbf9c('0xc'),attributes,{'tableName':_0xbf9c('0xd'),'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 91d9cd6..2a415d6 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 _0x4294=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','FreshdeskAccount','findAll','options','where','attributes','limit','include','map','model','then','GetFreshdeskAccount','find','raw','ShowFreshdeskAccount','lodash','util','bluebird'];(function(_0x4a41b6,_0x17f8e9){var _0x3cf615=function(_0xd93c34){while(--_0xd93c34){_0x4a41b6['push'](_0x4a41b6['shift']());}};_0x3cf615(++_0x17f8e9);}(_0x4294,0x6c));var _0x4429=function(_0x831451,_0x8f91c4){_0x831451=_0x831451-0x0;var _0x516e67=_0x4294[_0x831451];return _0x516e67;};'use strict';var _=require(_0x4429('0x0'));var util=require(_0x4429('0x1'));var moment=require('moment');var BPromise=require(_0x4429('0x2'));var rs=require(_0x4429('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4429('0x4'))['db'];var utils=require(_0x4429('0x5'));var logger=require(_0x4429('0x6'))(_0x4429('0x7'));var config=require(_0x4429('0x8'));var jayson=require(_0x4429('0x9'));var client=jayson[_0x4429('0xa')][_0x4429('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x424003,_0x193879,_0xb22e26){return new BPromise(function(_0x37a2d2,_0x4bfeed){return client[_0x4429('0xc')](_0x424003,_0xb22e26)['then'](function(_0x4bf788){logger[_0x4429('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x193879,_0x4429('0xe'));logger['debug'](_0x4429('0xf'),_0x193879,'request\x20sent',JSON[_0x4429('0x10')](_0x4bf788));if(_0x4bf788[_0x4429('0x11')]){if(_0x4bf788['error'][_0x4429('0x12')]===0x1f4){logger['error'](_0x4429('0x13'),_0x193879,_0x4bf788[_0x4429('0x11')][_0x4429('0x14')]);return _0x4bfeed(_0x4bf788[_0x4429('0x11')][_0x4429('0x14')]);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x193879,_0x4bf788['error']['message']);return _0x37a2d2(_0x4bf788[_0x4429('0x11')][_0x4429('0x14')]);}else{logger[_0x4429('0xd')](_0x4429('0x13'),_0x193879,_0x4429('0xe'));_0x37a2d2(_0x4bf788[_0x4429('0x15')]['message']);}})[_0x4429('0x16')](function(_0x47ec79){logger[_0x4429('0x11')](_0x4429('0x13'),_0x193879,_0x47ec79);_0x4bfeed(_0x47ec79);});});}exports['GetFreshdeskAccount']=function(_0x1011ea){var _0x37c450=this;return new Promise(function(_0x1bb127,_0x3c3671){return db[_0x4429('0x17')][_0x4429('0x18')]({'raw':_0x1011ea['options']?_0x1011ea[_0x4429('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1011ea['options']?_0x1011ea['options'][_0x4429('0x1a')]||null:null,'attributes':_0x1011ea[_0x4429('0x19')]?_0x1011ea[_0x4429('0x19')][_0x4429('0x1b')]||null:null,'limit':_0x1011ea['options']?_0x1011ea[_0x4429('0x19')][_0x4429('0x1c')]||null:null,'include':_0x1011ea[_0x4429('0x19')]?_0x1011ea['options']['include']?_['map'](_0x1011ea['options'][_0x4429('0x1d')],function(_0x3acfcc){return{'model':db[_0x3acfcc['model']],'as':_0x3acfcc['as'],'attributes':_0x3acfcc[_0x4429('0x1b')],'include':_0x3acfcc[_0x4429('0x1d')]?_[_0x4429('0x1e')](_0x3acfcc['include'],function(_0x295632){return{'model':db[_0x295632['model']],'as':_0x295632['as'],'attributes':_0x295632['attributes'],'include':_0x295632['include']?_[_0x4429('0x1e')](_0x295632[_0x4429('0x1d')],function(_0x573cae){return{'model':db[_0x573cae[_0x4429('0x1f')]],'as':_0x573cae['as'],'attributes':_0x573cae[_0x4429('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4429('0x20')](function(_0x166320){logger[_0x4429('0xd')]('GetFreshdeskAccount',_0x1011ea);logger['debug'](_0x4429('0x21'),_0x1011ea,JSON[_0x4429('0x10')](_0x166320));_0x1bb127(_0x166320);})[_0x4429('0x16')](function(_0x48a868){logger[_0x4429('0x11')](_0x4429('0x21'),_0x48a868['message'],_0x1011ea);_0x3c3671(_0x37c450[_0x4429('0x11')](0x1f4,_0x48a868[_0x4429('0x14')]));});});};exports['ShowFreshdeskAccount']=function(_0x1a30ef){var _0x51a121=this;return new Promise(function(_0x20c5f1,_0x3ae9b9){return db['FreshdeskAccount'][_0x4429('0x22')]({'raw':_0x1a30ef[_0x4429('0x19')]?_0x1a30ef[_0x4429('0x19')][_0x4429('0x23')]===undefined?!![]:![]:!![],'where':_0x1a30ef[_0x4429('0x19')]?_0x1a30ef['options'][_0x4429('0x1a')]||null:null,'attributes':_0x1a30ef[_0x4429('0x19')]?_0x1a30ef[_0x4429('0x19')][_0x4429('0x1b')]||null:null,'include':_0x1a30ef['options']?_0x1a30ef[_0x4429('0x19')]['include']?_['map'](_0x1a30ef[_0x4429('0x19')]['include'],function(_0x49461c){return{'model':db[_0x49461c['model']],'as':_0x49461c['as'],'attributes':_0x49461c[_0x4429('0x1b')],'include':_0x49461c[_0x4429('0x1d')]?_[_0x4429('0x1e')](_0x49461c[_0x4429('0x1d')],function(_0x5ce03c){return{'model':db[_0x5ce03c[_0x4429('0x1f')]],'as':_0x5ce03c['as'],'attributes':_0x5ce03c[_0x4429('0x1b')],'include':_0x5ce03c[_0x4429('0x1d')]?_['map'](_0x5ce03c['include'],function(_0x200941){return{'model':db[_0x200941[_0x4429('0x1f')]],'as':_0x200941['as'],'attributes':_0x200941[_0x4429('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4429('0x20')](function(_0x404bab){logger[_0x4429('0xd')](_0x4429('0x24'),_0x1a30ef);logger['debug']('ShowFreshdeskAccount',_0x1a30ef,JSON[_0x4429('0x10')](_0x404bab));_0x20c5f1(_0x404bab);})[_0x4429('0x16')](function(_0x499a85){logger['error'](_0x4429('0x24'),_0x499a85[_0x4429('0x14')],_0x1a30ef);_0x3ae9b9(_0x51a121[_0x4429('0x11')](0x1f4,_0x499a85[_0x4429('0x14')]));});});}; \ No newline at end of file +var _0xb30b=['../../config/environment','jayson/promise','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','GetFreshdeskAccount','findAll','options','raw','attributes','limit','include','model','map','ShowFreshdeskAccount','FreshdeskAccount','find','where','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3f39ab,_0x16c981){var _0x170952=function(_0x45e049){while(--_0x45e049){_0x3f39ab['push'](_0x3f39ab['shift']());}};_0x170952(++_0x16c981);}(_0xb30b,0xf4));var _0xbb30=function(_0x301101,_0x2162b2){_0x301101=_0x301101-0x0;var _0x3890d4=_0xb30b[_0x301101];return _0x3890d4;};'use strict';var _=require('lodash');var util=require(_0xbb30('0x0'));var moment=require(_0xbb30('0x1'));var BPromise=require(_0xbb30('0x2'));var rs=require(_0xbb30('0x3'));var fs=require('fs');var Redis=require(_0xbb30('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb30('0x5'));var logger=require(_0xbb30('0x6'))(_0xbb30('0x7'));var config=require(_0xbb30('0x8'));var jayson=require(_0xbb30('0x9'));var client=jayson[_0xbb30('0xa')][_0xbb30('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1437c6,_0x2c454a,_0x1edf46){return new BPromise(function(_0x2c1077,_0x151129){return client['request'](_0x1437c6,_0x1edf46)[_0xbb30('0xc')](function(_0x238ea9){logger[_0xbb30('0xd')](_0xbb30('0xe'),_0x2c454a,_0xbb30('0xf'));logger[_0xbb30('0x10')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x2c454a,'request\x20sent',JSON[_0xbb30('0x11')](_0x238ea9));if(_0x238ea9['error']){if(_0x238ea9['error'][_0xbb30('0x12')]===0x1f4){logger['error'](_0xbb30('0xe'),_0x2c454a,_0x238ea9[_0xbb30('0x13')][_0xbb30('0x14')]);return _0x151129(_0x238ea9[_0xbb30('0x13')][_0xbb30('0x14')]);}logger[_0xbb30('0x13')](_0xbb30('0xe'),_0x2c454a,_0x238ea9['error'][_0xbb30('0x14')]);return _0x2c1077(_0x238ea9[_0xbb30('0x13')]['message']);}else{logger[_0xbb30('0xd')](_0xbb30('0xe'),_0x2c454a,_0xbb30('0xf'));_0x2c1077(_0x238ea9[_0xbb30('0x15')]['message']);}})[_0xbb30('0x16')](function(_0x1e6258){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x2c454a,_0x1e6258);_0x151129(_0x1e6258);});});}exports[_0xbb30('0x17')]=function(_0x39922e){var _0x8ab462=this;return new Promise(function(_0x9395f9,_0x12fb24){return db['FreshdeskAccount'][_0xbb30('0x18')]({'raw':_0x39922e[_0xbb30('0x19')]?_0x39922e[_0xbb30('0x19')][_0xbb30('0x1a')]===undefined?!![]:![]:!![],'where':_0x39922e[_0xbb30('0x19')]?_0x39922e[_0xbb30('0x19')]['where']||null:null,'attributes':_0x39922e[_0xbb30('0x19')]?_0x39922e['options'][_0xbb30('0x1b')]||null:null,'limit':_0x39922e[_0xbb30('0x19')]?_0x39922e['options'][_0xbb30('0x1c')]||null:null,'include':_0x39922e[_0xbb30('0x19')]?_0x39922e['options'][_0xbb30('0x1d')]?_['map'](_0x39922e[_0xbb30('0x19')][_0xbb30('0x1d')],function(_0x489416){return{'model':db[_0x489416[_0xbb30('0x1e')]],'as':_0x489416['as'],'attributes':_0x489416['attributes'],'include':_0x489416[_0xbb30('0x1d')]?_['map'](_0x489416[_0xbb30('0x1d')],function(_0x249827){return{'model':db[_0x249827[_0xbb30('0x1e')]],'as':_0x249827['as'],'attributes':_0x249827['attributes'],'include':_0x249827['include']?_[_0xbb30('0x1f')](_0x249827['include'],function(_0x3ba38e){return{'model':db[_0x3ba38e[_0xbb30('0x1e')]],'as':_0x3ba38e['as'],'attributes':_0x3ba38e[_0xbb30('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb30('0xc')](function(_0x2c8aa2){logger[_0xbb30('0xd')](_0xbb30('0x17'),_0x39922e);logger[_0xbb30('0x10')](_0xbb30('0x17'),_0x39922e,JSON[_0xbb30('0x11')](_0x2c8aa2));_0x9395f9(_0x2c8aa2);})['catch'](function(_0x2f3a6a){logger[_0xbb30('0x13')](_0xbb30('0x17'),_0x2f3a6a[_0xbb30('0x14')],_0x39922e);_0x12fb24(_0x8ab462[_0xbb30('0x13')](0x1f4,_0x2f3a6a[_0xbb30('0x14')]));});});};exports[_0xbb30('0x20')]=function(_0x2691fa){var _0x2eb5d8=this;return new Promise(function(_0x232937,_0x33606e){return db[_0xbb30('0x21')][_0xbb30('0x22')]({'raw':_0x2691fa[_0xbb30('0x19')]?_0x2691fa[_0xbb30('0x19')][_0xbb30('0x1a')]===undefined?!![]:![]:!![],'where':_0x2691fa[_0xbb30('0x19')]?_0x2691fa[_0xbb30('0x19')][_0xbb30('0x23')]||null:null,'attributes':_0x2691fa['options']?_0x2691fa[_0xbb30('0x19')][_0xbb30('0x1b')]||null:null,'include':_0x2691fa[_0xbb30('0x19')]?_0x2691fa[_0xbb30('0x19')][_0xbb30('0x1d')]?_[_0xbb30('0x1f')](_0x2691fa[_0xbb30('0x19')][_0xbb30('0x1d')],function(_0x572e42){return{'model':db[_0x572e42[_0xbb30('0x1e')]],'as':_0x572e42['as'],'attributes':_0x572e42[_0xbb30('0x1b')],'include':_0x572e42[_0xbb30('0x1d')]?_[_0xbb30('0x1f')](_0x572e42[_0xbb30('0x1d')],function(_0x3ccd22){return{'model':db[_0x3ccd22['model']],'as':_0x3ccd22['as'],'attributes':_0x3ccd22[_0xbb30('0x1b')],'include':_0x3ccd22['include']?_['map'](_0x3ccd22[_0xbb30('0x1d')],function(_0x2f26cb){return{'model':db[_0x2f26cb['model']],'as':_0x2f26cb['as'],'attributes':_0x2f26cb[_0xbb30('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb30('0xc')](function(_0x26901c){logger[_0xbb30('0xd')](_0xbb30('0x20'),_0x2691fa);logger[_0xbb30('0x10')](_0xbb30('0x20'),_0x2691fa,JSON[_0xbb30('0x11')](_0x26901c));_0x232937(_0x26901c);})[_0xbb30('0x16')](function(_0x3b8045){logger[_0xbb30('0x13')](_0xbb30('0x20'),_0x3b8045[_0xbb30('0x14')],_0x2691fa);_0x33606e(_0x2eb5d8[_0xbb30('0x13')](0x1f4,_0x3b8045[_0xbb30('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 08c2c1d..7ed0bd6 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 _0x7be1=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','show','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x5156e9,_0xed3375){var _0x31f40b=function(_0x301b1d){while(--_0x301b1d){_0x5156e9['push'](_0x5156e9['shift']());}};_0x31f40b(++_0xed3375);}(_0x7be1,0x9b));var _0x17be=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x7be1[_0xe73080];return _0x12cbc4;};'use strict';var multer=require(_0x17be('0x0'));var util=require(_0x17be('0x1'));var path=require(_0x17be('0x2'));var timeout=require(_0x17be('0x3'));var express=require(_0x17be('0x4'));var router=express[_0x17be('0x5')]();var fs_extra=require(_0x17be('0x6'));var auth=require(_0x17be('0x7'));var interaction=require(_0x17be('0x8'));var config=require(_0x17be('0x9'));var controller=require(_0x17be('0xa'));router['get']('/',auth[_0x17be('0xb')](),controller[_0x17be('0xc')]);router[_0x17be('0xd')]('/:id',auth[_0x17be('0xb')](),controller[_0x17be('0xe')]);router[_0x17be('0xd')]('/:id/fields',auth[_0x17be('0xb')](),controller[_0x17be('0xf')]);router[_0x17be('0xd')]('/:id/subjects',auth[_0x17be('0xb')](),controller[_0x17be('0x10')]);router[_0x17be('0xd')](_0x17be('0x11'),auth[_0x17be('0xb')](),controller[_0x17be('0x12')]);router[_0x17be('0xd')](_0x17be('0x13'),auth[_0x17be('0xb')](),controller[_0x17be('0x14')]);router[_0x17be('0x15')]('/',auth['isAuthenticated'](),controller[_0x17be('0x16')]);router['post'](_0x17be('0x13'),auth[_0x17be('0xb')](),controller['setTags']);router['put'](_0x17be('0x17'),auth[_0x17be('0xb')](),controller['update']);router[_0x17be('0x18')](_0x17be('0x17'),auth[_0x17be('0xb')](),controller[_0x17be('0x19')]);module[_0x17be('0x1a')]=router; \ No newline at end of file +var _0x84d7=['put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags'];(function(_0x1aa4f4,_0xfd4a9f){var _0x3724dd=function(_0x3c84fd){while(--_0x3c84fd){_0x1aa4f4['push'](_0x1aa4f4['shift']());}};_0x3724dd(++_0xfd4a9f);}(_0x84d7,0xcf));var _0x784d=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x84d7[_0x1ae5ab];return _0x1ce001;};'use strict';var multer=require(_0x784d('0x0'));var util=require(_0x784d('0x1'));var path=require(_0x784d('0x2'));var timeout=require('connect-timeout');var express=require(_0x784d('0x3'));var router=express[_0x784d('0x4')]();var fs_extra=require(_0x784d('0x5'));var auth=require(_0x784d('0x6'));var interaction=require(_0x784d('0x7'));var config=require(_0x784d('0x8'));var controller=require(_0x784d('0x9'));router[_0x784d('0xa')]('/',auth[_0x784d('0xb')](),controller[_0x784d('0xc')]);router[_0x784d('0xa')](_0x784d('0xd'),auth[_0x784d('0xb')](),controller[_0x784d('0xe')]);router['get'](_0x784d('0xf'),auth[_0x784d('0xb')](),controller[_0x784d('0x10')]);router[_0x784d('0xa')](_0x784d('0x11'),auth[_0x784d('0xb')](),controller[_0x784d('0x12')]);router[_0x784d('0xa')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x784d('0x13')]);router[_0x784d('0xa')](_0x784d('0x14'),auth[_0x784d('0xb')](),controller[_0x784d('0x15')]);router[_0x784d('0x16')]('/',auth[_0x784d('0xb')](),controller[_0x784d('0x17')]);router[_0x784d('0x16')]('/:id/tags',auth[_0x784d('0xb')](),controller[_0x784d('0x18')]);router[_0x784d('0x19')](_0x784d('0xd'),auth[_0x784d('0xb')](),controller['update']);router[_0x784d('0x1a')](_0x784d('0xd'),auth[_0x784d('0xb')](),controller[_0x784d('0x1b')]);module[_0x784d('0x1c')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 976e732..a74ff58 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 _0x8d96=['STRING','sequelize'];(function(_0x579313,_0x167518){var _0xddbae0=function(_0x20ded7){while(--_0x20ded7){_0x579313['push'](_0x579313['shift']());}};_0xddbae0(++_0x167518);}(_0x8d96,0x1cb));var _0x68d9=function(_0x118986,_0x2ea044){_0x118986=_0x118986-0x0;var _0x25c9e6=_0x8d96[_0x118986];return _0x25c9e6;};'use strict';var Sequelize=require(_0x68d9('0x0'));module['exports']={'name':{'type':Sequelize[_0x68d9('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x132d=['STRING','exports'];(function(_0x7a354a,_0x5ad3c2){var _0x13e6cb=function(_0x12e07e){while(--_0x12e07e){_0x7a354a['push'](_0x7a354a['shift']());}};_0x13e6cb(++_0x5ad3c2);}(_0x132d,0x1d7));var _0xd132=function(_0x57841a,_0x3bf283){_0x57841a=_0x57841a-0x0;var _0x588bab=_0x132d[_0x57841a];return _0x588bab;};'use strict';var Sequelize=require('sequelize');module[_0xd132('0x0')]={'name':{'type':Sequelize[_0xd132('0x1')]},'description':{'type':Sequelize[_0xd132('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 8476f11..d5b2947 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 _0x7535=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','FreshdeskConfiguration','includeAll','include','findAll','catch','params','find','create','body','getFields','findOne','FreshdeskField','getSubjects','pick','nolimit','getDescriptions','getTags','setTags','ids','eml-format','rimraf','moment','bluebird','path','sox'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7535,0x18f));var _0x5753=function(_0x2b4448,_0x5bcc69){_0x2b4448=_0x2b4448-0x0;var _0xb4b465=_0x7535[_0x2b4448];return _0xb4b465;};'use strict';var emlformat=require(_0x5753('0x0'));var rimraf=require(_0x5753('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5753('0x2'));var BPromise=require(_0x5753('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5753('0x4'));var sox=require(_0x5753('0x5'));var csv=require(_0x5753('0x6'));var ejs=require(_0x5753('0x7'));var fs=require('fs');var fs_extra=require(_0x5753('0x8'));var _=require(_0x5753('0x9'));var squel=require(_0x5753('0xa'));var crypto=require(_0x5753('0xb'));var jsforce=require(_0x5753('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5753('0x6'));var querystring=require(_0x5753('0xd'));var Papa=require('papaparse');var Redis=require(_0x5753('0xe'));var authService=require(_0x5753('0xf'));var qs=require(_0x5753('0x10'));var as=require(_0x5753('0x11'));var hardwareService=require(_0x5753('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x5753('0x13'));var config=require(_0x5753('0x14'));var licenseUtil=require(_0x5753('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c13fc,_0x2188b1){_0x2188b1=_0x2188b1||0xcc;return function(_0x3c0762){if(_0x3c0762){return _0x1c13fc[_0x5753('0x16')](_0x2188b1);}return _0x1c13fc[_0x5753('0x17')](_0x2188b1)[_0x5753('0x18')]();};}function respondWithResult(_0x75b0cf,_0x6841c2){_0x6841c2=_0x6841c2||0xc8;return function(_0x377d9c){if(_0x377d9c){return _0x75b0cf[_0x5753('0x17')](_0x6841c2)[_0x5753('0x19')](_0x377d9c);}};}function respondWithFilteredResult(_0xc2491f,_0x4ec0dd){return function(_0x4ed8d4){if(_0x4ed8d4){var _0xd1dea5=typeof _0x4ec0dd[_0x5753('0x1a')]===_0x5753('0x1b')&&typeof _0x4ec0dd[_0x5753('0x1c')]==='undefined';var _0x5d8e24=_0x4ed8d4[_0x5753('0x1d')];var _0x53a4e8=_0xd1dea5?0x0:_0x4ec0dd['offset'];var _0x260480=_0xd1dea5?_0x4ed8d4[_0x5753('0x1d')]:_0x4ec0dd[_0x5753('0x1a')]+_0x4ec0dd[_0x5753('0x1c')];var _0x3bb61d;if(_0x260480>=_0x5d8e24){_0x260480=_0x5d8e24;_0x3bb61d=0xc8;}else{_0x3bb61d=0xce;}_0xc2491f[_0x5753('0x17')](_0x3bb61d);return _0xc2491f['set'](_0x5753('0x1e'),_0x53a4e8+'-'+_0x260480+'/'+_0x5d8e24)['json'](_0x4ed8d4);}return null;};}function patchUpdates(_0x13848d){return function(_0x467ae4){try{jsonpatch[_0x5753('0x1f')](_0x467ae4,_0x13848d,!![]);}catch(_0x1b3816){return BPromise[_0x5753('0x20')](_0x1b3816);}return _0x467ae4[_0x5753('0x21')]();};}function saveUpdates(_0x5765a9,_0x3e741c){return function(_0x254d2d){if(_0x254d2d){return _0x254d2d[_0x5753('0x22')](_0x5765a9)[_0x5753('0x23')](function(_0x15c827){return _0x15c827;});}return null;};}function removeEntity(_0x3d0518,_0x3f7708){return function(_0x49e910){if(_0x49e910){return _0x49e910[_0x5753('0x24')]()[_0x5753('0x23')](function(){_0x3d0518['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48c012,_0x59e474){return function(_0x373a33){if(!_0x373a33){_0x48c012[_0x5753('0x16')](0x194);}return _0x373a33;};}function handleError(_0x50de6e,_0x1a1e5b){_0x1a1e5b=_0x1a1e5b||0x1f4;return function(_0xff32f){logger[_0x5753('0x25')](_0xff32f[_0x5753('0x26')]);if(_0xff32f[_0x5753('0x27')]){delete _0xff32f[_0x5753('0x27')];}_0x50de6e[_0x5753('0x17')](_0x1a1e5b)[_0x5753('0x28')](_0xff32f);};}exports[_0x5753('0x29')]=function(_0x538d47,_0x439b8f){var _0x169f47={},_0x50b211={},_0x35652f={'count':0x0,'rows':[]};var _0x40c5f4=_[_0x5753('0x2a')](db['FreshdeskConfiguration'][_0x5753('0x2b')],function(_0x442668){return{'name':_0x442668['fieldName'],'type':_0x442668[_0x5753('0x2c')][_0x5753('0x2d')]};});_0x50b211[_0x5753('0x2e')]=_['map'](_0x40c5f4,_0x5753('0x27'));_0x50b211[_0x5753('0x2f')]=_[_0x5753('0x30')](_0x538d47[_0x5753('0x2f')]);_0x50b211[_0x5753('0x31')]=_['intersection'](_0x50b211[_0x5753('0x2e')],_0x50b211['query']);_0x169f47[_0x5753('0x32')]=_[_0x5753('0x33')](_0x50b211[_0x5753('0x2e')],qs[_0x5753('0x34')](_0x538d47[_0x5753('0x2f')][_0x5753('0x34')]));_0x169f47[_0x5753('0x32')]=_0x169f47['attributes'][_0x5753('0x35')]?_0x169f47[_0x5753('0x32')]:_0x50b211[_0x5753('0x2e')];if(!_0x538d47['query'][_0x5753('0x36')]('nolimit')){_0x169f47['limit']=qs[_0x5753('0x1c')](_0x538d47['query'][_0x5753('0x1c')]);_0x169f47['offset']=qs['offset'](_0x538d47['query'][_0x5753('0x1a')]);}_0x169f47[_0x5753('0x37')]=qs[_0x5753('0x38')](_0x538d47[_0x5753('0x2f')][_0x5753('0x38')]);_0x169f47[_0x5753('0x39')]=qs[_0x5753('0x31')](_['pick'](_0x538d47[_0x5753('0x2f')],_0x50b211[_0x5753('0x31')]),_0x40c5f4);if(_0x538d47['query'][_0x5753('0x3a')]){_0x169f47[_0x5753('0x39')]=_[_0x5753('0x3b')](_0x169f47['where'],{'$or':_[_0x5753('0x2a')](_0x40c5f4,function(_0x5c98d8){if(_0x5c98d8[_0x5753('0x2c')]!==_0x5753('0x3c')){var _0x5487ba={};_0x5487ba[_0x5c98d8[_0x5753('0x27')]]={'$like':'%'+_0x538d47[_0x5753('0x2f')][_0x5753('0x3a')]+'%'};return _0x5487ba;}})});}_0x169f47=_[_0x5753('0x3b')]({},_0x169f47,_0x538d47[_0x5753('0x3d')]);var _0x5121db={'where':_0x169f47[_0x5753('0x39')]};return db[_0x5753('0x3e')][_0x5753('0x1d')](_0x5121db)[_0x5753('0x23')](function(_0x7007a){_0x35652f['count']=_0x7007a;if(_0x538d47[_0x5753('0x2f')][_0x5753('0x3f')]){_0x169f47[_0x5753('0x40')]=[{'all':!![]}];}return db[_0x5753('0x3e')][_0x5753('0x41')](_0x169f47);})[_0x5753('0x23')](function(_0x5b2bdd){_0x35652f['rows']=_0x5b2bdd;return _0x35652f;})[_0x5753('0x23')](respondWithFilteredResult(_0x439b8f,_0x169f47))[_0x5753('0x42')](handleError(_0x439b8f,null));};exports['show']=function(_0x27e63a,_0x4981ca){var _0x51572f={'raw':![],'where':{'id':_0x27e63a[_0x5753('0x43')]['id']}},_0x1b256f={};_0x1b256f[_0x5753('0x2e')]=_[_0x5753('0x30')](db[_0x5753('0x3e')]['rawAttributes']);_0x1b256f[_0x5753('0x2f')]=_[_0x5753('0x30')](_0x27e63a[_0x5753('0x2f')]);_0x1b256f[_0x5753('0x31')]=_[_0x5753('0x33')](_0x1b256f[_0x5753('0x2e')],_0x1b256f[_0x5753('0x2f')]);_0x51572f[_0x5753('0x32')]=_[_0x5753('0x33')](_0x1b256f[_0x5753('0x2e')],qs[_0x5753('0x34')](_0x27e63a[_0x5753('0x2f')][_0x5753('0x34')]));_0x51572f['attributes']=_0x51572f[_0x5753('0x32')][_0x5753('0x35')]?_0x51572f[_0x5753('0x32')]:_0x1b256f[_0x5753('0x2e')];if(_0x27e63a['query'][_0x5753('0x3f')]){_0x51572f['include']=[{'all':!![]}];}_0x51572f=_[_0x5753('0x3b')]({},_0x51572f,_0x27e63a['options']);return db[_0x5753('0x3e')][_0x5753('0x44')](_0x51572f)['then'](handleEntityNotFound(_0x4981ca,null))[_0x5753('0x23')](respondWithResult(_0x4981ca,null))[_0x5753('0x42')](handleError(_0x4981ca,null));};exports[_0x5753('0x45')]=function(_0x1e988d,_0x6ff695){return db[_0x5753('0x3e')][_0x5753('0x45')](_0x1e988d['body'],{})[_0x5753('0x23')](respondWithResult(_0x6ff695,0xc9))[_0x5753('0x42')](handleError(_0x6ff695,null));};exports['update']=function(_0x4b4d29,_0x2f38b8){if(_0x4b4d29[_0x5753('0x46')]['id']){delete _0x4b4d29[_0x5753('0x46')]['id'];}return db['FreshdeskConfiguration'][_0x5753('0x44')]({'where':{'id':_0x4b4d29[_0x5753('0x43')]['id']}})[_0x5753('0x23')](handleEntityNotFound(_0x2f38b8,null))[_0x5753('0x23')](saveUpdates(_0x4b4d29[_0x5753('0x46')],null))[_0x5753('0x23')](respondWithResult(_0x2f38b8,null))[_0x5753('0x42')](handleError(_0x2f38b8,null));};exports[_0x5753('0x24')]=function(_0x3ff382,_0x35a35c){return db[_0x5753('0x3e')][_0x5753('0x44')]({'where':{'id':_0x3ff382['params']['id']}})[_0x5753('0x23')](handleEntityNotFound(_0x35a35c,null))[_0x5753('0x23')](removeEntity(_0x35a35c,null))[_0x5753('0x42')](handleError(_0x35a35c,null));};exports[_0x5753('0x47')]=function(_0x2abe1d,_0x139a9b,_0x28feda){var _0xa8934={};var _0x59ba80={};var _0x988b20;var _0x3e5550;return db['FreshdeskConfiguration'][_0x5753('0x48')]({'where':{'id':_0x2abe1d[_0x5753('0x43')]['id']}})[_0x5753('0x23')](handleEntityNotFound(_0x139a9b,null))['then'](function(_0xe935ef){if(_0xe935ef){_0x988b20=_0xe935ef;_0x59ba80[_0x5753('0x2e')]=_[_0x5753('0x30')](db[_0x5753('0x49')][_0x5753('0x2b')]);_0x59ba80[_0x5753('0x2f')]=_[_0x5753('0x30')](_0x2abe1d['query']);_0x59ba80[_0x5753('0x31')]=_[_0x5753('0x33')](_0x59ba80[_0x5753('0x2e')],_0x59ba80[_0x5753('0x2f')]);_0xa8934[_0x5753('0x32')]=_[_0x5753('0x33')](_0x59ba80[_0x5753('0x2e')],qs['fields'](_0x2abe1d[_0x5753('0x2f')][_0x5753('0x34')]));_0xa8934[_0x5753('0x32')]=_0xa8934[_0x5753('0x32')][_0x5753('0x35')]?_0xa8934[_0x5753('0x32')]:_0x59ba80['model'];_0xa8934['order']=qs[_0x5753('0x38')](_0x2abe1d[_0x5753('0x2f')][_0x5753('0x38')]);_0xa8934[_0x5753('0x39')]=qs['filters'](_['pick'](_0x2abe1d[_0x5753('0x2f')],_0x59ba80[_0x5753('0x31')]));if(_0x2abe1d['query'][_0x5753('0x3a')]){_0xa8934[_0x5753('0x39')]=_[_0x5753('0x3b')](_0xa8934['where'],{'$or':_[_0x5753('0x2a')](_0xa8934['attributes'],function(_0x2bda1d){var _0x33571a={};_0x33571a[_0x2bda1d]={'$like':'%'+_0x2abe1d[_0x5753('0x2f')]['filter']+'%'};return _0x33571a;})});}_0xa8934=_['merge']({},_0xa8934,_0x2abe1d[_0x5753('0x3d')]);return _0x988b20[_0x5753('0x47')](_0xa8934);}})[_0x5753('0x23')](function(_0x3c28c4){if(_0x3c28c4){_0x3e5550=_0x3c28c4['length'];if(!_0x2abe1d[_0x5753('0x2f')][_0x5753('0x36')]('nolimit')){_0xa8934[_0x5753('0x1c')]=qs[_0x5753('0x1c')](_0x2abe1d[_0x5753('0x2f')][_0x5753('0x1c')]);_0xa8934[_0x5753('0x1a')]=qs['offset'](_0x2abe1d['query'][_0x5753('0x1a')]);}return _0x988b20[_0x5753('0x47')](_0xa8934);}})[_0x5753('0x23')](function(_0x904a52){if(_0x904a52){return _0x904a52?{'count':_0x3e5550,'rows':_0x904a52}:null;}})[_0x5753('0x23')](respondWithResult(_0x139a9b,null))[_0x5753('0x42')](handleError(_0x139a9b,null));};exports[_0x5753('0x4a')]=function(_0x2cc331,_0x5047ba,_0x128b4a){var _0x362bc2={};var _0x231829={};var _0x19caea;var _0x7a84f3;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x2cc331[_0x5753('0x43')]['id']}})[_0x5753('0x23')](handleEntityNotFound(_0x5047ba,null))['then'](function(_0x4b84ac){if(_0x4b84ac){_0x19caea=_0x4b84ac;_0x231829[_0x5753('0x2e')]=_[_0x5753('0x30')](db[_0x5753('0x49')][_0x5753('0x2b')]);_0x231829[_0x5753('0x2f')]=_[_0x5753('0x30')](_0x2cc331['query']);_0x231829[_0x5753('0x31')]=_['intersection'](_0x231829[_0x5753('0x2e')],_0x231829[_0x5753('0x2f')]);_0x362bc2[_0x5753('0x32')]=_['intersection'](_0x231829[_0x5753('0x2e')],qs['fields'](_0x2cc331[_0x5753('0x2f')]['fields']));_0x362bc2['attributes']=_0x362bc2[_0x5753('0x32')][_0x5753('0x35')]?_0x362bc2[_0x5753('0x32')]:_0x231829['model'];_0x362bc2['order']=qs['sort'](_0x2cc331[_0x5753('0x2f')][_0x5753('0x38')]);_0x362bc2[_0x5753('0x39')]=qs[_0x5753('0x31')](_[_0x5753('0x4b')](_0x2cc331[_0x5753('0x2f')],_0x231829['filters']));if(_0x2cc331['query'][_0x5753('0x3a')]){_0x362bc2[_0x5753('0x39')]=_[_0x5753('0x3b')](_0x362bc2[_0x5753('0x39')],{'$or':_['map'](_0x362bc2[_0x5753('0x32')],function(_0x123b59){var _0x23692c={};_0x23692c[_0x123b59]={'$like':'%'+_0x2cc331[_0x5753('0x2f')][_0x5753('0x3a')]+'%'};return _0x23692c;})});}_0x362bc2=_[_0x5753('0x3b')]({},_0x362bc2,_0x2cc331['options']);return _0x19caea[_0x5753('0x4a')](_0x362bc2);}})[_0x5753('0x23')](function(_0x49c0e1){if(_0x49c0e1){_0x7a84f3=_0x49c0e1[_0x5753('0x35')];if(!_0x2cc331['query'][_0x5753('0x36')](_0x5753('0x4c'))){_0x362bc2[_0x5753('0x1c')]=qs['limit'](_0x2cc331[_0x5753('0x2f')][_0x5753('0x1c')]);_0x362bc2[_0x5753('0x1a')]=qs['offset'](_0x2cc331[_0x5753('0x2f')][_0x5753('0x1a')]);}return _0x19caea['getSubjects'](_0x362bc2);}})[_0x5753('0x23')](function(_0x4b0a94){if(_0x4b0a94){return _0x4b0a94?{'count':_0x7a84f3,'rows':_0x4b0a94}:null;}})[_0x5753('0x23')](respondWithResult(_0x5047ba,null))[_0x5753('0x42')](handleError(_0x5047ba,null));};exports[_0x5753('0x4d')]=function(_0x52ad9d,_0x7b699e,_0x23cf50){var _0x38bf3b={};var _0x2b8e73={};var _0x23242e;var _0x4079ed;return db[_0x5753('0x3e')][_0x5753('0x48')]({'where':{'id':_0x52ad9d['params']['id']}})[_0x5753('0x23')](handleEntityNotFound(_0x7b699e,null))[_0x5753('0x23')](function(_0x25ea03){if(_0x25ea03){_0x23242e=_0x25ea03;_0x2b8e73[_0x5753('0x2e')]=_[_0x5753('0x30')](db[_0x5753('0x49')][_0x5753('0x2b')]);_0x2b8e73['query']=_['keys'](_0x52ad9d[_0x5753('0x2f')]);_0x2b8e73[_0x5753('0x31')]=_[_0x5753('0x33')](_0x2b8e73['model'],_0x2b8e73[_0x5753('0x2f')]);_0x38bf3b[_0x5753('0x32')]=_[_0x5753('0x33')](_0x2b8e73[_0x5753('0x2e')],qs['fields'](_0x52ad9d[_0x5753('0x2f')][_0x5753('0x34')]));_0x38bf3b[_0x5753('0x32')]=_0x38bf3b[_0x5753('0x32')][_0x5753('0x35')]?_0x38bf3b['attributes']:_0x2b8e73[_0x5753('0x2e')];_0x38bf3b[_0x5753('0x37')]=qs[_0x5753('0x38')](_0x52ad9d['query'][_0x5753('0x38')]);_0x38bf3b[_0x5753('0x39')]=qs[_0x5753('0x31')](_[_0x5753('0x4b')](_0x52ad9d[_0x5753('0x2f')],_0x2b8e73['filters']));if(_0x52ad9d[_0x5753('0x2f')][_0x5753('0x3a')]){_0x38bf3b[_0x5753('0x39')]=_[_0x5753('0x3b')](_0x38bf3b[_0x5753('0x39')],{'$or':_[_0x5753('0x2a')](_0x38bf3b[_0x5753('0x32')],function(_0x5acf94){var _0x218879={};_0x218879[_0x5acf94]={'$like':'%'+_0x52ad9d['query']['filter']+'%'};return _0x218879;})});}_0x38bf3b=_[_0x5753('0x3b')]({},_0x38bf3b,_0x52ad9d[_0x5753('0x3d')]);return _0x23242e[_0x5753('0x4d')](_0x38bf3b);}})[_0x5753('0x23')](function(_0x113f6b){if(_0x113f6b){_0x4079ed=_0x113f6b[_0x5753('0x35')];if(!_0x52ad9d['query'][_0x5753('0x36')](_0x5753('0x4c'))){_0x38bf3b[_0x5753('0x1c')]=qs[_0x5753('0x1c')](_0x52ad9d[_0x5753('0x2f')][_0x5753('0x1c')]);_0x38bf3b[_0x5753('0x1a')]=qs[_0x5753('0x1a')](_0x52ad9d[_0x5753('0x2f')][_0x5753('0x1a')]);}return _0x23242e[_0x5753('0x4d')](_0x38bf3b);}})[_0x5753('0x23')](function(_0x42684c){if(_0x42684c){return _0x42684c?{'count':_0x4079ed,'rows':_0x42684c}:null;}})[_0x5753('0x23')](respondWithResult(_0x7b699e,null))[_0x5753('0x42')](handleError(_0x7b699e,null));};exports[_0x5753('0x4e')]=function(_0x4e53d3,_0x13c353,_0x117280){var _0x51914e={};var _0x1d9051={};var _0x6cd108;var _0x55a9e1;return db[_0x5753('0x3e')][_0x5753('0x48')]({'where':{'id':_0x4e53d3[_0x5753('0x43')]['id']}})[_0x5753('0x23')](handleEntityNotFound(_0x13c353,null))['then'](function(_0x59a48c){if(_0x59a48c){_0x6cd108=_0x59a48c;_0x1d9051[_0x5753('0x2e')]=_['keys'](db['Tag'][_0x5753('0x2b')]);_0x1d9051[_0x5753('0x2f')]=_['keys'](_0x4e53d3[_0x5753('0x2f')]);_0x1d9051[_0x5753('0x31')]=_['intersection'](_0x1d9051[_0x5753('0x2e')],_0x1d9051[_0x5753('0x2f')]);_0x51914e[_0x5753('0x32')]=_['intersection'](_0x1d9051[_0x5753('0x2e')],qs[_0x5753('0x34')](_0x4e53d3[_0x5753('0x2f')][_0x5753('0x34')]));_0x51914e[_0x5753('0x32')]=_0x51914e[_0x5753('0x32')][_0x5753('0x35')]?_0x51914e['attributes']:_0x1d9051['model'];_0x51914e['order']=qs[_0x5753('0x38')](_0x4e53d3[_0x5753('0x2f')][_0x5753('0x38')]);_0x51914e[_0x5753('0x39')]=qs[_0x5753('0x31')](_['pick'](_0x4e53d3[_0x5753('0x2f')],_0x1d9051[_0x5753('0x31')]));if(_0x4e53d3[_0x5753('0x2f')][_0x5753('0x3a')]){_0x51914e[_0x5753('0x39')]=_[_0x5753('0x3b')](_0x51914e[_0x5753('0x39')],{'$or':_[_0x5753('0x2a')](_0x51914e[_0x5753('0x32')],function(_0x119639){var _0x520d74={};_0x520d74[_0x119639]={'$like':'%'+_0x4e53d3[_0x5753('0x2f')]['filter']+'%'};return _0x520d74;})});}_0x51914e=_[_0x5753('0x3b')]({},_0x51914e,_0x4e53d3[_0x5753('0x3d')]);return _0x6cd108[_0x5753('0x4e')](_0x51914e);}})[_0x5753('0x23')](function(_0x1af93b){if(_0x1af93b){_0x55a9e1=_0x1af93b['length'];if(!_0x4e53d3[_0x5753('0x2f')]['hasOwnProperty'](_0x5753('0x4c'))){_0x51914e[_0x5753('0x1c')]=qs['limit'](_0x4e53d3[_0x5753('0x2f')][_0x5753('0x1c')]);_0x51914e[_0x5753('0x1a')]=qs[_0x5753('0x1a')](_0x4e53d3['query'][_0x5753('0x1a')]);}return _0x6cd108[_0x5753('0x4e')](_0x51914e);}})[_0x5753('0x23')](function(_0x2c8120){if(_0x2c8120){return _0x2c8120?{'count':_0x55a9e1,'rows':_0x2c8120}:null;}})['then'](respondWithResult(_0x13c353,null))['catch'](handleError(_0x13c353,null));};exports['setTags']=function(_0x1bab0d,_0x160417,_0x1be7bf){if(_0x1bab0d['body']['id']){delete _0x1bab0d[_0x5753('0x46')]['id'];}return db[_0x5753('0x3e')][_0x5753('0x48')]({'where':{'id':_0x1bab0d[_0x5753('0x43')]['id']}})[_0x5753('0x23')](handleEntityNotFound(_0x160417,null))[_0x5753('0x23')](function(_0x1eb429){if(_0x1eb429){return _0x1eb429[_0x5753('0x4f')](_0x1bab0d[_0x5753('0x46')][_0x5753('0x50')]||[]);}return null;})[_0x5753('0x23')](respondWithResult(_0x160417,null))[_0x5753('0x42')](handleError(_0x160417,null));}; \ No newline at end of file +var _0xa355=['sort','filter','where','merge','type','VIRTUAL','includeAll','findAll','catch','show','params','keys','include','options','find','create','body','getFields','pick','length','hasOwnProperty','getSubjects','findOne','FreshdeskField','order','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../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','destroy','error','stack','name','index','map','FreshdeskConfiguration','rawAttributes','fieldName','key','query','filters','intersection','attributes','fields','model','nolimit'];(function(_0x116e69,_0x217415){var _0x4b27b6=function(_0xec1fde){while(--_0xec1fde){_0x116e69['push'](_0x116e69['shift']());}};_0x4b27b6(++_0x217415);}(_0xa355,0x16a));var _0x5a35=function(_0x3a7257,_0x4fc699){_0x3a7257=_0x3a7257-0x0;var _0x1e9df6=_0xa355[_0x3a7257];return _0x1e9df6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5a35('0x0'));var zipdir=require(_0x5a35('0x1'));var jsonpatch=require(_0x5a35('0x2'));var rp=require('request-promise');var moment=require(_0x5a35('0x3'));var BPromise=require(_0x5a35('0x4'));var Mustache=require(_0x5a35('0x5'));var util=require(_0x5a35('0x6'));var path=require(_0x5a35('0x7'));var sox=require(_0x5a35('0x8'));var csv=require(_0x5a35('0x9'));var ejs=require(_0x5a35('0xa'));var fs=require('fs');var fs_extra=require(_0x5a35('0xb'));var _=require('lodash');var squel=require(_0x5a35('0xc'));var crypto=require(_0x5a35('0xd'));var jsforce=require(_0x5a35('0xe'));var deskjs=require(_0x5a35('0xf'));var toCsv=require(_0x5a35('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5a35('0x10'));var as=require(_0x5a35('0x11'));var hardwareService=require(_0x5a35('0x12'));var logger=require(_0x5a35('0x13'))(_0x5a35('0x14'));var utils=require(_0x5a35('0x15'));var config=require(_0x5a35('0x16'));var licenseUtil=require(_0x5a35('0x17'));var db=require(_0x5a35('0x18'))['db'];function respondWithStatusCode(_0x47158c,_0x5b74bd){_0x5b74bd=_0x5b74bd||0xcc;return function(_0x5b729b){if(_0x5b729b){return _0x47158c[_0x5a35('0x19')](_0x5b74bd);}return _0x47158c[_0x5a35('0x1a')](_0x5b74bd)[_0x5a35('0x1b')]();};}function respondWithResult(_0x2353db,_0x303a6f){_0x303a6f=_0x303a6f||0xc8;return function(_0x1a5b5a){if(_0x1a5b5a){return _0x2353db[_0x5a35('0x1a')](_0x303a6f)['json'](_0x1a5b5a);}};}function respondWithFilteredResult(_0xfd24d8,_0x45d5ca){return function(_0x5ead98){if(_0x5ead98){var _0x55fe62=typeof _0x45d5ca[_0x5a35('0x1c')]==='undefined'&&typeof _0x45d5ca[_0x5a35('0x1d')]===_0x5a35('0x1e');var _0x3aca20=_0x5ead98[_0x5a35('0x1f')];var _0x39317c=_0x55fe62?0x0:_0x45d5ca[_0x5a35('0x1c')];var _0x32c7cf=_0x55fe62?_0x5ead98[_0x5a35('0x1f')]:_0x45d5ca[_0x5a35('0x1c')]+_0x45d5ca[_0x5a35('0x1d')];var _0x42db0b;if(_0x32c7cf>=_0x3aca20){_0x32c7cf=_0x3aca20;_0x42db0b=0xc8;}else{_0x42db0b=0xce;}_0xfd24d8[_0x5a35('0x1a')](_0x42db0b);return _0xfd24d8['set']('Content-Range',_0x39317c+'-'+_0x32c7cf+'/'+_0x3aca20)['json'](_0x5ead98);}return null;};}function patchUpdates(_0x522587){return function(_0x2d84b6){try{jsonpatch[_0x5a35('0x20')](_0x2d84b6,_0x522587,!![]);}catch(_0x36b756){return BPromise['reject'](_0x36b756);}return _0x2d84b6[_0x5a35('0x21')]();};}function saveUpdates(_0x11f6ba,_0x2e7fa8){return function(_0x52f2ea){if(_0x52f2ea){return _0x52f2ea[_0x5a35('0x22')](_0x11f6ba)[_0x5a35('0x23')](function(_0x22466e){return _0x22466e;});}return null;};}function removeEntity(_0x37de30,_0x8ef730){return function(_0x198c95){if(_0x198c95){return _0x198c95[_0x5a35('0x24')]()[_0x5a35('0x23')](function(){_0x37de30[_0x5a35('0x1a')](0xcc)[_0x5a35('0x1b')]();});}};}function handleEntityNotFound(_0x2c3655,_0x48d656){return function(_0x2191bb){if(!_0x2191bb){_0x2c3655[_0x5a35('0x19')](0x194);}return _0x2191bb;};}function handleError(_0xb39012,_0xfb8042){_0xfb8042=_0xfb8042||0x1f4;return function(_0x49018c){logger[_0x5a35('0x25')](_0x49018c[_0x5a35('0x26')]);if(_0x49018c[_0x5a35('0x27')]){delete _0x49018c[_0x5a35('0x27')];}_0xb39012[_0x5a35('0x1a')](_0xfb8042)['send'](_0x49018c);};}exports[_0x5a35('0x28')]=function(_0x25a7bd,_0xef8799){var _0x14bf10={},_0x14549a={},_0x5e229b={'count':0x0,'rows':[]};var _0x5218f0=_[_0x5a35('0x29')](db[_0x5a35('0x2a')][_0x5a35('0x2b')],function(_0xf8729b){return{'name':_0xf8729b[_0x5a35('0x2c')],'type':_0xf8729b['type'][_0x5a35('0x2d')]};});_0x14549a['model']=_[_0x5a35('0x29')](_0x5218f0,'name');_0x14549a[_0x5a35('0x2e')]=_['keys'](_0x25a7bd[_0x5a35('0x2e')]);_0x14549a[_0x5a35('0x2f')]=_[_0x5a35('0x30')](_0x14549a['model'],_0x14549a[_0x5a35('0x2e')]);_0x14bf10[_0x5a35('0x31')]=_[_0x5a35('0x30')](_0x14549a['model'],qs[_0x5a35('0x32')](_0x25a7bd[_0x5a35('0x2e')][_0x5a35('0x32')]));_0x14bf10[_0x5a35('0x31')]=_0x14bf10[_0x5a35('0x31')]['length']?_0x14bf10[_0x5a35('0x31')]:_0x14549a[_0x5a35('0x33')];if(!_0x25a7bd[_0x5a35('0x2e')]['hasOwnProperty'](_0x5a35('0x34'))){_0x14bf10['limit']=qs['limit'](_0x25a7bd[_0x5a35('0x2e')][_0x5a35('0x1d')]);_0x14bf10['offset']=qs[_0x5a35('0x1c')](_0x25a7bd[_0x5a35('0x2e')]['offset']);}_0x14bf10['order']=qs[_0x5a35('0x35')](_0x25a7bd[_0x5a35('0x2e')][_0x5a35('0x35')]);_0x14bf10['where']=qs[_0x5a35('0x2f')](_['pick'](_0x25a7bd[_0x5a35('0x2e')],_0x14549a[_0x5a35('0x2f')]),_0x5218f0);if(_0x25a7bd[_0x5a35('0x2e')][_0x5a35('0x36')]){_0x14bf10[_0x5a35('0x37')]=_[_0x5a35('0x38')](_0x14bf10[_0x5a35('0x37')],{'$or':_['map'](_0x5218f0,function(_0x349c42){if(_0x349c42[_0x5a35('0x39')]!==_0x5a35('0x3a')){var _0x16cd01={};_0x16cd01[_0x349c42['name']]={'$like':'%'+_0x25a7bd['query']['filter']+'%'};return _0x16cd01;}})});}_0x14bf10=_[_0x5a35('0x38')]({},_0x14bf10,_0x25a7bd['options']);var _0x39a10a={'where':_0x14bf10[_0x5a35('0x37')]};return db[_0x5a35('0x2a')][_0x5a35('0x1f')](_0x39a10a)['then'](function(_0x540900){_0x5e229b[_0x5a35('0x1f')]=_0x540900;if(_0x25a7bd['query'][_0x5a35('0x3b')]){_0x14bf10['include']=[{'all':!![]}];}return db[_0x5a35('0x2a')][_0x5a35('0x3c')](_0x14bf10);})['then'](function(_0x9bd25b){_0x5e229b['rows']=_0x9bd25b;return _0x5e229b;})[_0x5a35('0x23')](respondWithFilteredResult(_0xef8799,_0x14bf10))[_0x5a35('0x3d')](handleError(_0xef8799,null));};exports[_0x5a35('0x3e')]=function(_0xcf9ee8,_0x4efbb3){var _0x691283={'raw':![],'where':{'id':_0xcf9ee8[_0x5a35('0x3f')]['id']}},_0x1e77a3={};_0x1e77a3[_0x5a35('0x33')]=_[_0x5a35('0x40')](db[_0x5a35('0x2a')][_0x5a35('0x2b')]);_0x1e77a3[_0x5a35('0x2e')]=_['keys'](_0xcf9ee8['query']);_0x1e77a3[_0x5a35('0x2f')]=_[_0x5a35('0x30')](_0x1e77a3[_0x5a35('0x33')],_0x1e77a3[_0x5a35('0x2e')]);_0x691283['attributes']=_[_0x5a35('0x30')](_0x1e77a3[_0x5a35('0x33')],qs[_0x5a35('0x32')](_0xcf9ee8[_0x5a35('0x2e')][_0x5a35('0x32')]));_0x691283['attributes']=_0x691283['attributes']['length']?_0x691283[_0x5a35('0x31')]:_0x1e77a3[_0x5a35('0x33')];if(_0xcf9ee8[_0x5a35('0x2e')][_0x5a35('0x3b')]){_0x691283[_0x5a35('0x41')]=[{'all':!![]}];}_0x691283=_['merge']({},_0x691283,_0xcf9ee8[_0x5a35('0x42')]);return db[_0x5a35('0x2a')][_0x5a35('0x43')](_0x691283)['then'](handleEntityNotFound(_0x4efbb3,null))[_0x5a35('0x23')](respondWithResult(_0x4efbb3,null))[_0x5a35('0x3d')](handleError(_0x4efbb3,null));};exports[_0x5a35('0x44')]=function(_0x3b43c3,_0x21ea0f){return db[_0x5a35('0x2a')]['create'](_0x3b43c3['body'],{})[_0x5a35('0x23')](respondWithResult(_0x21ea0f,0xc9))[_0x5a35('0x3d')](handleError(_0x21ea0f,null));};exports[_0x5a35('0x22')]=function(_0x29d4bc,_0x1de2e8){if(_0x29d4bc['body']['id']){delete _0x29d4bc['body']['id'];}return db[_0x5a35('0x2a')]['find']({'where':{'id':_0x29d4bc[_0x5a35('0x3f')]['id']}})[_0x5a35('0x23')](handleEntityNotFound(_0x1de2e8,null))[_0x5a35('0x23')](saveUpdates(_0x29d4bc[_0x5a35('0x45')],null))['then'](respondWithResult(_0x1de2e8,null))[_0x5a35('0x3d')](handleError(_0x1de2e8,null));};exports[_0x5a35('0x24')]=function(_0x13beaa,_0x2c50f3){return db['FreshdeskConfiguration'][_0x5a35('0x43')]({'where':{'id':_0x13beaa[_0x5a35('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2c50f3,null))['then'](removeEntity(_0x2c50f3,null))[_0x5a35('0x3d')](handleError(_0x2c50f3,null));};exports[_0x5a35('0x46')]=function(_0x5af6f8,_0x4287e9,_0x510de0){var _0x56738d={};var _0x4b5d7b={};var _0x5c4a56;var _0x13c4b2;return db[_0x5a35('0x2a')]['findOne']({'where':{'id':_0x5af6f8[_0x5a35('0x3f')]['id']}})[_0x5a35('0x23')](handleEntityNotFound(_0x4287e9,null))['then'](function(_0x4d14f7){if(_0x4d14f7){_0x5c4a56=_0x4d14f7;_0x4b5d7b['model']=_[_0x5a35('0x40')](db['FreshdeskField'][_0x5a35('0x2b')]);_0x4b5d7b[_0x5a35('0x2e')]=_[_0x5a35('0x40')](_0x5af6f8[_0x5a35('0x2e')]);_0x4b5d7b[_0x5a35('0x2f')]=_[_0x5a35('0x30')](_0x4b5d7b[_0x5a35('0x33')],_0x4b5d7b[_0x5a35('0x2e')]);_0x56738d[_0x5a35('0x31')]=_[_0x5a35('0x30')](_0x4b5d7b[_0x5a35('0x33')],qs[_0x5a35('0x32')](_0x5af6f8['query'][_0x5a35('0x32')]));_0x56738d[_0x5a35('0x31')]=_0x56738d[_0x5a35('0x31')]['length']?_0x56738d['attributes']:_0x4b5d7b[_0x5a35('0x33')];_0x56738d['order']=qs[_0x5a35('0x35')](_0x5af6f8['query'][_0x5a35('0x35')]);_0x56738d['where']=qs[_0x5a35('0x2f')](_[_0x5a35('0x47')](_0x5af6f8[_0x5a35('0x2e')],_0x4b5d7b['filters']));if(_0x5af6f8[_0x5a35('0x2e')][_0x5a35('0x36')]){_0x56738d[_0x5a35('0x37')]=_[_0x5a35('0x38')](_0x56738d[_0x5a35('0x37')],{'$or':_['map'](_0x56738d[_0x5a35('0x31')],function(_0xc43ae2){var _0x3707d4={};_0x3707d4[_0xc43ae2]={'$like':'%'+_0x5af6f8['query'][_0x5a35('0x36')]+'%'};return _0x3707d4;})});}_0x56738d=_[_0x5a35('0x38')]({},_0x56738d,_0x5af6f8[_0x5a35('0x42')]);return _0x5c4a56[_0x5a35('0x46')](_0x56738d);}})['then'](function(_0x5b5267){if(_0x5b5267){_0x13c4b2=_0x5b5267[_0x5a35('0x48')];if(!_0x5af6f8['query'][_0x5a35('0x49')](_0x5a35('0x34'))){_0x56738d['limit']=qs[_0x5a35('0x1d')](_0x5af6f8[_0x5a35('0x2e')][_0x5a35('0x1d')]);_0x56738d[_0x5a35('0x1c')]=qs[_0x5a35('0x1c')](_0x5af6f8[_0x5a35('0x2e')][_0x5a35('0x1c')]);}return _0x5c4a56['getFields'](_0x56738d);}})[_0x5a35('0x23')](function(_0x10ee13){if(_0x10ee13){return _0x10ee13?{'count':_0x13c4b2,'rows':_0x10ee13}:null;}})['then'](respondWithResult(_0x4287e9,null))['catch'](handleError(_0x4287e9,null));};exports[_0x5a35('0x4a')]=function(_0xb22f40,_0x5288d2,_0x509b93){var _0x212f9d={};var _0x10d728={};var _0x22634f;var _0x558fc8;return db[_0x5a35('0x2a')][_0x5a35('0x4b')]({'where':{'id':_0xb22f40[_0x5a35('0x3f')]['id']}})[_0x5a35('0x23')](handleEntityNotFound(_0x5288d2,null))['then'](function(_0x187b49){if(_0x187b49){_0x22634f=_0x187b49;_0x10d728[_0x5a35('0x33')]=_[_0x5a35('0x40')](db[_0x5a35('0x4c')][_0x5a35('0x2b')]);_0x10d728[_0x5a35('0x2e')]=_['keys'](_0xb22f40['query']);_0x10d728['filters']=_[_0x5a35('0x30')](_0x10d728[_0x5a35('0x33')],_0x10d728['query']);_0x212f9d[_0x5a35('0x31')]=_[_0x5a35('0x30')](_0x10d728['model'],qs[_0x5a35('0x32')](_0xb22f40[_0x5a35('0x2e')][_0x5a35('0x32')]));_0x212f9d[_0x5a35('0x31')]=_0x212f9d[_0x5a35('0x31')][_0x5a35('0x48')]?_0x212f9d['attributes']:_0x10d728[_0x5a35('0x33')];_0x212f9d[_0x5a35('0x4d')]=qs[_0x5a35('0x35')](_0xb22f40[_0x5a35('0x2e')][_0x5a35('0x35')]);_0x212f9d['where']=qs[_0x5a35('0x2f')](_[_0x5a35('0x47')](_0xb22f40[_0x5a35('0x2e')],_0x10d728[_0x5a35('0x2f')]));if(_0xb22f40['query'][_0x5a35('0x36')]){_0x212f9d[_0x5a35('0x37')]=_['merge'](_0x212f9d[_0x5a35('0x37')],{'$or':_[_0x5a35('0x29')](_0x212f9d['attributes'],function(_0x2140eb){var _0xbb90d0={};_0xbb90d0[_0x2140eb]={'$like':'%'+_0xb22f40[_0x5a35('0x2e')]['filter']+'%'};return _0xbb90d0;})});}_0x212f9d=_['merge']({},_0x212f9d,_0xb22f40['options']);return _0x22634f[_0x5a35('0x4a')](_0x212f9d);}})[_0x5a35('0x23')](function(_0x4857b9){if(_0x4857b9){_0x558fc8=_0x4857b9[_0x5a35('0x48')];if(!_0xb22f40[_0x5a35('0x2e')]['hasOwnProperty'](_0x5a35('0x34'))){_0x212f9d[_0x5a35('0x1d')]=qs[_0x5a35('0x1d')](_0xb22f40[_0x5a35('0x2e')]['limit']);_0x212f9d[_0x5a35('0x1c')]=qs[_0x5a35('0x1c')](_0xb22f40[_0x5a35('0x2e')][_0x5a35('0x1c')]);}return _0x22634f[_0x5a35('0x4a')](_0x212f9d);}})['then'](function(_0xdf7dc4){if(_0xdf7dc4){return _0xdf7dc4?{'count':_0x558fc8,'rows':_0xdf7dc4}:null;}})[_0x5a35('0x23')](respondWithResult(_0x5288d2,null))[_0x5a35('0x3d')](handleError(_0x5288d2,null));};exports[_0x5a35('0x4e')]=function(_0x33024e,_0x73ba59,_0xe71e43){var _0x35ec50={};var _0x138ee7={};var _0x447774;var _0x11ab54;return db[_0x5a35('0x2a')]['findOne']({'where':{'id':_0x33024e[_0x5a35('0x3f')]['id']}})[_0x5a35('0x23')](handleEntityNotFound(_0x73ba59,null))[_0x5a35('0x23')](function(_0x2d9d25){if(_0x2d9d25){_0x447774=_0x2d9d25;_0x138ee7[_0x5a35('0x33')]=_[_0x5a35('0x40')](db[_0x5a35('0x4c')][_0x5a35('0x2b')]);_0x138ee7['query']=_[_0x5a35('0x40')](_0x33024e[_0x5a35('0x2e')]);_0x138ee7[_0x5a35('0x2f')]=_['intersection'](_0x138ee7[_0x5a35('0x33')],_0x138ee7['query']);_0x35ec50[_0x5a35('0x31')]=_['intersection'](_0x138ee7[_0x5a35('0x33')],qs['fields'](_0x33024e[_0x5a35('0x2e')][_0x5a35('0x32')]));_0x35ec50[_0x5a35('0x31')]=_0x35ec50[_0x5a35('0x31')][_0x5a35('0x48')]?_0x35ec50[_0x5a35('0x31')]:_0x138ee7[_0x5a35('0x33')];_0x35ec50[_0x5a35('0x4d')]=qs[_0x5a35('0x35')](_0x33024e[_0x5a35('0x2e')][_0x5a35('0x35')]);_0x35ec50[_0x5a35('0x37')]=qs[_0x5a35('0x2f')](_[_0x5a35('0x47')](_0x33024e[_0x5a35('0x2e')],_0x138ee7[_0x5a35('0x2f')]));if(_0x33024e[_0x5a35('0x2e')][_0x5a35('0x36')]){_0x35ec50[_0x5a35('0x37')]=_['merge'](_0x35ec50[_0x5a35('0x37')],{'$or':_['map'](_0x35ec50[_0x5a35('0x31')],function(_0x572018){var _0x220345={};_0x220345[_0x572018]={'$like':'%'+_0x33024e[_0x5a35('0x2e')][_0x5a35('0x36')]+'%'};return _0x220345;})});}_0x35ec50=_[_0x5a35('0x38')]({},_0x35ec50,_0x33024e['options']);return _0x447774[_0x5a35('0x4e')](_0x35ec50);}})[_0x5a35('0x23')](function(_0xad7477){if(_0xad7477){_0x11ab54=_0xad7477['length'];if(!_0x33024e[_0x5a35('0x2e')]['hasOwnProperty']('nolimit')){_0x35ec50['limit']=qs[_0x5a35('0x1d')](_0x33024e[_0x5a35('0x2e')][_0x5a35('0x1d')]);_0x35ec50[_0x5a35('0x1c')]=qs[_0x5a35('0x1c')](_0x33024e[_0x5a35('0x2e')][_0x5a35('0x1c')]);}return _0x447774[_0x5a35('0x4e')](_0x35ec50);}})[_0x5a35('0x23')](function(_0x115fef){if(_0x115fef){return _0x115fef?{'count':_0x11ab54,'rows':_0x115fef}:null;}})[_0x5a35('0x23')](respondWithResult(_0x73ba59,null))[_0x5a35('0x3d')](handleError(_0x73ba59,null));};exports[_0x5a35('0x4f')]=function(_0x1f4bb9,_0x43c5f4,_0x4fc5c2){var _0x5c04c9={};var _0x4c52df={};var _0x185824;var _0x56dbbf;return db['FreshdeskConfiguration'][_0x5a35('0x4b')]({'where':{'id':_0x1f4bb9[_0x5a35('0x3f')]['id']}})['then'](handleEntityNotFound(_0x43c5f4,null))['then'](function(_0x23e7d9){if(_0x23e7d9){_0x185824=_0x23e7d9;_0x4c52df[_0x5a35('0x33')]=_['keys'](db[_0x5a35('0x50')][_0x5a35('0x2b')]);_0x4c52df[_0x5a35('0x2e')]=_['keys'](_0x1f4bb9[_0x5a35('0x2e')]);_0x4c52df['filters']=_[_0x5a35('0x30')](_0x4c52df[_0x5a35('0x33')],_0x4c52df['query']);_0x5c04c9['attributes']=_[_0x5a35('0x30')](_0x4c52df['model'],qs[_0x5a35('0x32')](_0x1f4bb9[_0x5a35('0x2e')][_0x5a35('0x32')]));_0x5c04c9['attributes']=_0x5c04c9['attributes'][_0x5a35('0x48')]?_0x5c04c9[_0x5a35('0x31')]:_0x4c52df[_0x5a35('0x33')];_0x5c04c9[_0x5a35('0x4d')]=qs[_0x5a35('0x35')](_0x1f4bb9['query'][_0x5a35('0x35')]);_0x5c04c9[_0x5a35('0x37')]=qs[_0x5a35('0x2f')](_[_0x5a35('0x47')](_0x1f4bb9['query'],_0x4c52df[_0x5a35('0x2f')]));if(_0x1f4bb9[_0x5a35('0x2e')][_0x5a35('0x36')]){_0x5c04c9['where']=_[_0x5a35('0x38')](_0x5c04c9[_0x5a35('0x37')],{'$or':_['map'](_0x5c04c9[_0x5a35('0x31')],function(_0x15f544){var _0x303833={};_0x303833[_0x15f544]={'$like':'%'+_0x1f4bb9[_0x5a35('0x2e')][_0x5a35('0x36')]+'%'};return _0x303833;})});}_0x5c04c9=_[_0x5a35('0x38')]({},_0x5c04c9,_0x1f4bb9['options']);return _0x185824[_0x5a35('0x4f')](_0x5c04c9);}})[_0x5a35('0x23')](function(_0x1fad55){if(_0x1fad55){_0x56dbbf=_0x1fad55['length'];if(!_0x1f4bb9[_0x5a35('0x2e')][_0x5a35('0x49')](_0x5a35('0x34'))){_0x5c04c9['limit']=qs[_0x5a35('0x1d')](_0x1f4bb9['query'][_0x5a35('0x1d')]);_0x5c04c9[_0x5a35('0x1c')]=qs[_0x5a35('0x1c')](_0x1f4bb9[_0x5a35('0x2e')][_0x5a35('0x1c')]);}return _0x185824[_0x5a35('0x4f')](_0x5c04c9);}})[_0x5a35('0x23')](function(_0x962a10){if(_0x962a10){return _0x962a10?{'count':_0x56dbbf,'rows':_0x962a10}:null;}})['then'](respondWithResult(_0x43c5f4,null))[_0x5a35('0x3d')](handleError(_0x43c5f4,null));};exports[_0x5a35('0x51')]=function(_0x43044a,_0x54a970,_0xe24bb6){if(_0x43044a['body']['id']){delete _0x43044a[_0x5a35('0x45')]['id'];}return db[_0x5a35('0x2a')][_0x5a35('0x4b')]({'where':{'id':_0x43044a[_0x5a35('0x3f')]['id']}})[_0x5a35('0x23')](handleEntityNotFound(_0x54a970,null))[_0x5a35('0x23')](function(_0x3157db){if(_0x3157db){return _0x3157db[_0x5a35('0x51')](_0x43044a[_0x5a35('0x45')][_0x5a35('0x52')]||[]);}return null;})[_0x5a35('0x23')](respondWithResult(_0x54a970,null))['catch'](handleError(_0x54a970,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 840938b..0941181 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 _0x656e=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger'];(function(_0x45d5d3,_0x55183e){var _0x451079=function(_0xf7c87d){while(--_0xf7c87d){_0x45d5d3['push'](_0x45d5d3['shift']());}};_0x451079(++_0x55183e);}(_0x656e,0x9a));var _0xe656=function(_0x4ece58,_0x50922a){_0x4ece58=_0x4ece58-0x0;var _0x20d209=_0x656e[_0x4ece58];return _0x20d209;};'use strict';var _=require(_0xe656('0x0'));var util=require('util');var logger=require(_0xe656('0x1'))(_0xe656('0x2'));var moment=require(_0xe656('0x3'));var BPromise=require(_0xe656('0x4'));var rp=require(_0xe656('0x5'));var fs=require('fs');var path=require(_0xe656('0x6'));var rimraf=require(_0xe656('0x7'));var config=require(_0xe656('0x8'));var attributes=require(_0xe656('0x9'));module['exports']=function(_0x51a419,_0x1a5903){return _0x51a419[_0xe656('0xa')](_0xe656('0xb'),attributes,{'tableName':_0xe656('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e7d=['int_freshdesk_configurations','util','../../config/logger','moment','bluebird','path','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration'];(function(_0x1e4a8e,_0x18022b){var _0x5408f9=function(_0x4ef2ed){while(--_0x4ef2ed){_0x1e4a8e['push'](_0x1e4a8e['shift']());}};_0x5408f9(++_0x18022b);}(_0x4e7d,0x169));var _0xd4e7=function(_0xc0e98c,_0x4f0469){_0xc0e98c=_0xc0e98c-0x0;var _0x3b2a58=_0x4e7d[_0xc0e98c];return _0x3b2a58;};'use strict';var _=require('lodash');var util=require(_0xd4e7('0x0'));var logger=require(_0xd4e7('0x1'))('api');var moment=require(_0xd4e7('0x2'));var BPromise=require(_0xd4e7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd4e7('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd4e7('0x5'));module[_0xd4e7('0x6')]=function(_0x418790,_0xca86ee){return _0x418790[_0xd4e7('0x7')](_0xd4e7('0x8'),attributes,{'tableName':_0xd4e7('0x9'),'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 4e16755..4597ce0 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 _0xbf32=['request','info','debug','request\x20sent','stringify','error','code','message','FreshdeskConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x5858e0,_0x4059bd){var _0x599502=function(_0x4f3cc6){while(--_0x4f3cc6){_0x5858e0['push'](_0x5858e0['shift']());}};_0x599502(++_0x4059bd);}(_0xbf32,0x1d7));var _0x2bf3=function(_0x53aad0,_0x12d4be){_0x53aad0=_0x53aad0-0x0;var _0x52136c=_0xbf32[_0x53aad0];return _0x52136c;};'use strict';var _=require(_0x2bf3('0x0'));var util=require(_0x2bf3('0x1'));var moment=require(_0x2bf3('0x2'));var BPromise=require(_0x2bf3('0x3'));var rs=require(_0x2bf3('0x4'));var fs=require('fs');var Redis=require(_0x2bf3('0x5'));var db=require(_0x2bf3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2bf3('0x7'))(_0x2bf3('0x8'));var config=require(_0x2bf3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2bf3('0xa')][_0x2bf3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1087f8,_0x5df897,_0x54231d){return new BPromise(function(_0x5aa207,_0x5e188e){return client[_0x2bf3('0xc')](_0x1087f8,_0x54231d)['then'](function(_0x217d61){logger[_0x2bf3('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5df897,'request\x20sent');logger[_0x2bf3('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5df897,_0x2bf3('0xf'),JSON[_0x2bf3('0x10')](_0x217d61));if(_0x217d61[_0x2bf3('0x11')]){if(_0x217d61[_0x2bf3('0x11')][_0x2bf3('0x12')]===0x1f4){logger[_0x2bf3('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5df897,_0x217d61[_0x2bf3('0x11')][_0x2bf3('0x13')]);return _0x5e188e(_0x217d61[_0x2bf3('0x11')]['message']);}logger['error'](_0x2bf3('0x14'),_0x5df897,_0x217d61[_0x2bf3('0x11')][_0x2bf3('0x13')]);return _0x5aa207(_0x217d61[_0x2bf3('0x11')][_0x2bf3('0x13')]);}else{logger[_0x2bf3('0xd')](_0x2bf3('0x14'),_0x5df897,'request\x20sent');_0x5aa207(_0x217d61[_0x2bf3('0x15')][_0x2bf3('0x13')]);}})[_0x2bf3('0x16')](function(_0x1c5c8a){logger[_0x2bf3('0x11')](_0x2bf3('0x14'),_0x5df897,_0x1c5c8a);_0x5e188e(_0x1c5c8a);});});} \ No newline at end of file +var _0x905f=['stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','info','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','debug','request\x20sent'];(function(_0x378a41,_0x42e1de){var _0x38b9b9=function(_0x37d9a7){while(--_0x37d9a7){_0x378a41['push'](_0x378a41['shift']());}};_0x38b9b9(++_0x42e1de);}(_0x905f,0x1d5));var _0xf905=function(_0x39954a,_0x601a95){_0x39954a=_0x39954a-0x0;var _0x134f26=_0x905f[_0x39954a];return _0x134f26;};'use strict';var _=require(_0xf905('0x0'));var util=require(_0xf905('0x1'));var moment=require(_0xf905('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf905('0x3'))['db'];var utils=require(_0xf905('0x4'));var logger=require(_0xf905('0x5'))(_0xf905('0x6'));var config=require(_0xf905('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf905('0x8')][_0xf905('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1982e7,_0x4b2476,_0x55afb1){return new BPromise(function(_0x20b792,_0x2b268d){return client[_0xf905('0xa')](_0x1982e7,_0x55afb1)[_0xf905('0xb')](function(_0x518286){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x4b2476,'request\x20sent');logger[_0xf905('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4b2476,_0xf905('0xd'),JSON[_0xf905('0xe')](_0x518286));if(_0x518286[_0xf905('0xf')]){if(_0x518286[_0xf905('0xf')][_0xf905('0x10')]===0x1f4){logger[_0xf905('0xf')](_0xf905('0x11'),_0x4b2476,_0x518286[_0xf905('0xf')]['message']);return _0x2b268d(_0x518286[_0xf905('0xf')][_0xf905('0x12')]);}logger[_0xf905('0xf')](_0xf905('0x11'),_0x4b2476,_0x518286[_0xf905('0xf')][_0xf905('0x12')]);return _0x20b792(_0x518286[_0xf905('0xf')][_0xf905('0x12')]);}else{logger[_0xf905('0x13')](_0xf905('0x11'),_0x4b2476,'request\x20sent');_0x20b792(_0x518286['result'][_0xf905('0x12')]);}})[_0xf905('0x14')](function(_0x367533){logger[_0xf905('0xf')](_0xf905('0x11'),_0x4b2476,_0x367533);_0x2b268d(_0x367533);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 4182780..6c0e751 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 _0xd0fe=['/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intFreshdeskField.controller','isAuthenticated','index','get'];(function(_0x34d635,_0x2784fc){var _0x3ab288=function(_0x41589b){while(--_0x41589b){_0x34d635['push'](_0x34d635['shift']());}};_0x3ab288(++_0x2784fc);}(_0xd0fe,0x137));var _0xed0f=function(_0x458cda,_0xf168ae){_0x458cda=_0x458cda-0x0;var _0xd961df=_0xd0fe[_0x458cda];return _0xd961df;};'use strict';var multer=require(_0xed0f('0x0'));var util=require(_0xed0f('0x1'));var path=require(_0xed0f('0x2'));var timeout=require(_0xed0f('0x3'));var express=require(_0xed0f('0x4'));var router=express[_0xed0f('0x5')]();var fs_extra=require(_0xed0f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xed0f('0x7'));var config=require('../../config/environment');var controller=require(_0xed0f('0x8'));router['get']('/',auth[_0xed0f('0x9')](),controller[_0xed0f('0xa')]);router[_0xed0f('0xb')](_0xed0f('0xc'),auth['isAuthenticated'](),controller[_0xed0f('0xd')]);router[_0xed0f('0xe')]('/',auth[_0xed0f('0x9')](),controller[_0xed0f('0xf')]);router['put'](_0xed0f('0xc'),auth[_0xed0f('0x9')](),controller[_0xed0f('0x10')]);router[_0xed0f('0x11')](_0xed0f('0xc'),auth['isAuthenticated'](),controller[_0xed0f('0x12')]);module['exports']=router; \ No newline at end of file +var _0xf8ff=['multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','post','put','delete','exports'];(function(_0x1fcf31,_0x395e33){var _0x1cb7c1=function(_0x27024f){while(--_0x27024f){_0x1fcf31['push'](_0x1fcf31['shift']());}};_0x1cb7c1(++_0x395e33);}(_0xf8ff,0xaa));var _0xff8f=function(_0x21c6b8,_0x16d6f6){_0x21c6b8=_0x21c6b8-0x0;var _0x39d474=_0xf8ff[_0x21c6b8];return _0x39d474;};'use strict';var multer=require(_0xff8f('0x0'));var util=require(_0xff8f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xff8f('0x2')]();var fs_extra=require(_0xff8f('0x3'));var auth=require(_0xff8f('0x4'));var interaction=require(_0xff8f('0x5'));var config=require(_0xff8f('0x6'));var controller=require(_0xff8f('0x7'));router[_0xff8f('0x8')]('/',auth[_0xff8f('0x9')](),controller[_0xff8f('0xa')]);router[_0xff8f('0x8')](_0xff8f('0xb'),auth[_0xff8f('0x9')](),controller[_0xff8f('0xc')]);router[_0xff8f('0xd')]('/',auth[_0xff8f('0x9')](),controller['create']);router[_0xff8f('0xe')](_0xff8f('0xb'),auth[_0xff8f('0x9')](),controller['update']);router[_0xff8f('0xf')](_0xff8f('0xb'),auth[_0xff8f('0x9')](),controller['destroy']);module[_0xff8f('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index ddce021..7a57855 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 _0xcaab=['BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x408817,_0x58bbf4){var _0xf75617=function(_0x273027){while(--_0x273027){_0x408817['push'](_0x408817['shift']());}};_0xf75617(++_0x58bbf4);}(_0xcaab,0x121));var _0xbcaa=function(_0x38e2e5,_0x2cf63f){_0x38e2e5=_0x38e2e5-0x0;var _0x3d94c0=_0xcaab[_0x38e2e5];return _0x3d94c0;};'use strict';var Sequelize=require('sequelize');module[_0xbcaa('0x0')]={'type':{'type':Sequelize[_0xbcaa('0x1')](_0xbcaa('0x2'),_0xbcaa('0x3'),_0xbcaa('0x4'),_0xbcaa('0x5'),_0xbcaa('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xbcaa('0x7')]},'key':{'type':Sequelize[_0xbcaa('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xbcaa('0x2'),_0xbcaa('0x3'),_0xbcaa('0x4'))},'keyContent':{'type':Sequelize[_0xbcaa('0x7')]},'idField':{'type':Sequelize[_0xbcaa('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xbcaa('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbcaa('0x7')]}}; \ No newline at end of file +var _0x89fb=['STRING','BOOLEAN','exports','ENUM','string','variable','keyValue','picklist'];(function(_0x2d5c59,_0xd07c56){var _0x46b44c=function(_0x1344ca){while(--_0x1344ca){_0x2d5c59['push'](_0x2d5c59['shift']());}};_0x46b44c(++_0xd07c56);}(_0x89fb,0xd2));var _0xb89f=function(_0x297df7,_0x206419){_0x297df7=_0x297df7-0x0;var _0x51f345=_0x89fb[_0x297df7];return _0x51f345;};'use strict';var Sequelize=require('sequelize');module[_0xb89f('0x0')]={'type':{'type':Sequelize[_0xb89f('0x1')](_0xb89f('0x2'),_0xb89f('0x3'),'customVariable',_0xb89f('0x4'),_0xb89f('0x5')),'defaultValue':_0xb89f('0x2')},'content':{'type':Sequelize[_0xb89f('0x6')]},'key':{'type':Sequelize[_0xb89f('0x6')]},'keyType':{'type':Sequelize['ENUM']('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xb89f('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xb89f('0x6')]},'customField':{'type':Sequelize[_0xb89f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb89f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 96e3603..dbd5d6f 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 _0xa699=['index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','FreshdeskField','includeAll','include','rows','show','params','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','error','stack','name','send'];(function(_0x32e1cc,_0x3605b9){var _0x4ea6b9=function(_0x31cf03){while(--_0x31cf03){_0x32e1cc['push'](_0x32e1cc['shift']());}};_0x4ea6b9(++_0x3605b9);}(_0xa699,0x6b));var _0x9a69=function(_0x3c6ae2,_0x5c52d8){_0x3c6ae2=_0x3c6ae2-0x0;var _0x4edda=_0xa699[_0x3c6ae2];return _0x4edda;};'use strict';var emlformat=require(_0x9a69('0x0'));var rimraf=require(_0x9a69('0x1'));var zipdir=require(_0x9a69('0x2'));var jsonpatch=require(_0x9a69('0x3'));var rp=require(_0x9a69('0x4'));var moment=require(_0x9a69('0x5'));var BPromise=require(_0x9a69('0x6'));var Mustache=require(_0x9a69('0x7'));var util=require(_0x9a69('0x8'));var path=require(_0x9a69('0x9'));var sox=require(_0x9a69('0xa'));var csv=require(_0x9a69('0xb'));var ejs=require(_0x9a69('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9a69('0xd'));var squel=require(_0x9a69('0xe'));var crypto=require(_0x9a69('0xf'));var jsforce=require(_0x9a69('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x9a69('0xb'));var querystring=require(_0x9a69('0x11'));var Papa=require(_0x9a69('0x12'));var Redis=require(_0x9a69('0x13'));var authService=require(_0x9a69('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a69('0x15'));var logger=require('../../config/logger')(_0x9a69('0x16'));var utils=require(_0x9a69('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9a69('0x18'));var db=require(_0x9a69('0x19'))['db'];function respondWithStatusCode(_0x56e43f,_0x81dfb1){_0x81dfb1=_0x81dfb1||0xcc;return function(_0x2e613e){if(_0x2e613e){return _0x56e43f[_0x9a69('0x1a')](_0x81dfb1);}return _0x56e43f[_0x9a69('0x1b')](_0x81dfb1)[_0x9a69('0x1c')]();};}function respondWithResult(_0x70475b,_0x34b5b0){_0x34b5b0=_0x34b5b0||0xc8;return function(_0x2a5b83){if(_0x2a5b83){return _0x70475b[_0x9a69('0x1b')](_0x34b5b0)['json'](_0x2a5b83);}};}function respondWithFilteredResult(_0x2323ae,_0x17de41){return function(_0x2be3ec){if(_0x2be3ec){var _0x5e982d=typeof _0x17de41[_0x9a69('0x1d')]===_0x9a69('0x1e')&&typeof _0x17de41[_0x9a69('0x1f')]===_0x9a69('0x1e');var _0xed2c19=_0x2be3ec['count'];var _0x2e4264=_0x5e982d?0x0:_0x17de41[_0x9a69('0x1d')];var _0x186a5a=_0x5e982d?_0x2be3ec[_0x9a69('0x20')]:_0x17de41[_0x9a69('0x1d')]+_0x17de41[_0x9a69('0x1f')];var _0x2633d5;if(_0x186a5a>=_0xed2c19){_0x186a5a=_0xed2c19;_0x2633d5=0xc8;}else{_0x2633d5=0xce;}_0x2323ae[_0x9a69('0x1b')](_0x2633d5);return _0x2323ae[_0x9a69('0x21')](_0x9a69('0x22'),_0x2e4264+'-'+_0x186a5a+'/'+_0xed2c19)['json'](_0x2be3ec);}return null;};}function patchUpdates(_0x4d8db9){return function(_0x5ebb09){try{jsonpatch[_0x9a69('0x23')](_0x5ebb09,_0x4d8db9,!![]);}catch(_0x12ebe5){return BPromise['reject'](_0x12ebe5);}return _0x5ebb09[_0x9a69('0x24')]();};}function saveUpdates(_0x527ca6,_0x265291){return function(_0x4d6a93){if(_0x4d6a93){return _0x4d6a93['update'](_0x527ca6)['then'](function(_0x189989){return _0x189989;});}return null;};}function removeEntity(_0x5f4138,_0x140cbe){return function(_0x28f5f7){if(_0x28f5f7){return _0x28f5f7[_0x9a69('0x25')]()[_0x9a69('0x26')](function(){_0x5f4138['status'](0xcc)[_0x9a69('0x1c')]();});}};}function handleEntityNotFound(_0x5130b2,_0x203d32){return function(_0x4ef126){if(!_0x4ef126){_0x5130b2['sendStatus'](0x194);}return _0x4ef126;};}function handleError(_0xbcdcd9,_0xf6fea2){_0xf6fea2=_0xf6fea2||0x1f4;return function(_0x268cef){logger[_0x9a69('0x27')](_0x268cef[_0x9a69('0x28')]);if(_0x268cef[_0x9a69('0x29')]){delete _0x268cef[_0x9a69('0x29')];}_0xbcdcd9[_0x9a69('0x1b')](_0xf6fea2)[_0x9a69('0x2a')](_0x268cef);};}exports[_0x9a69('0x2b')]=function(_0x47916a,_0x1ff48e){var _0x165a87={},_0x5433b3={},_0x54e643={'count':0x0,'rows':[]};var _0x4b3539=_[_0x9a69('0x2c')](db['FreshdeskField'][_0x9a69('0x2d')],function(_0x2d15e3){return{'name':_0x2d15e3[_0x9a69('0x2e')],'type':_0x2d15e3[_0x9a69('0x2f')][_0x9a69('0x30')]};});_0x5433b3[_0x9a69('0x31')]=_[_0x9a69('0x2c')](_0x4b3539,_0x9a69('0x29'));_0x5433b3[_0x9a69('0x32')]=_[_0x9a69('0x33')](_0x47916a[_0x9a69('0x32')]);_0x5433b3[_0x9a69('0x34')]=_[_0x9a69('0x35')](_0x5433b3[_0x9a69('0x31')],_0x5433b3[_0x9a69('0x32')]);_0x165a87[_0x9a69('0x36')]=_[_0x9a69('0x35')](_0x5433b3['model'],qs['fields'](_0x47916a[_0x9a69('0x32')][_0x9a69('0x37')]));_0x165a87[_0x9a69('0x36')]=_0x165a87[_0x9a69('0x36')][_0x9a69('0x38')]?_0x165a87['attributes']:_0x5433b3['model'];if(!_0x47916a['query']['hasOwnProperty'](_0x9a69('0x39'))){_0x165a87[_0x9a69('0x1f')]=qs[_0x9a69('0x1f')](_0x47916a[_0x9a69('0x32')][_0x9a69('0x1f')]);_0x165a87[_0x9a69('0x1d')]=qs['offset'](_0x47916a['query'][_0x9a69('0x1d')]);}_0x165a87[_0x9a69('0x3a')]=qs[_0x9a69('0x3b')](_0x47916a['query'][_0x9a69('0x3b')]);_0x165a87[_0x9a69('0x3c')]=qs[_0x9a69('0x34')](_[_0x9a69('0x3d')](_0x47916a[_0x9a69('0x32')],_0x5433b3[_0x9a69('0x34')]),_0x4b3539);if(_0x47916a[_0x9a69('0x32')][_0x9a69('0x3e')]){_0x165a87[_0x9a69('0x3c')]=_[_0x9a69('0x3f')](_0x165a87[_0x9a69('0x3c')],{'$or':_['map'](_0x4b3539,function(_0x1ac0b7){if(_0x1ac0b7['type']!=='VIRTUAL'){var _0x4cc399={};_0x4cc399[_0x1ac0b7['name']]={'$like':'%'+_0x47916a[_0x9a69('0x32')][_0x9a69('0x3e')]+'%'};return _0x4cc399;}})});}_0x165a87=_['merge']({},_0x165a87,_0x47916a['options']);var _0x5a1e62={'where':_0x165a87[_0x9a69('0x3c')]};return db[_0x9a69('0x40')][_0x9a69('0x20')](_0x5a1e62)['then'](function(_0x2ff507){_0x54e643[_0x9a69('0x20')]=_0x2ff507;if(_0x47916a[_0x9a69('0x32')][_0x9a69('0x41')]){_0x165a87[_0x9a69('0x42')]=[{'all':!![]}];}return db[_0x9a69('0x40')]['findAll'](_0x165a87);})[_0x9a69('0x26')](function(_0x27d0db){_0x54e643[_0x9a69('0x43')]=_0x27d0db;return _0x54e643;})[_0x9a69('0x26')](respondWithFilteredResult(_0x1ff48e,_0x165a87))['catch'](handleError(_0x1ff48e,null));};exports[_0x9a69('0x44')]=function(_0x373939,_0x5b309a){var _0x318de1={'raw':!![],'where':{'id':_0x373939[_0x9a69('0x45')]['id']}},_0x3c78e2={};_0x3c78e2['model']=_['keys'](db['FreshdeskField'][_0x9a69('0x2d')]);_0x3c78e2[_0x9a69('0x32')]=_[_0x9a69('0x33')](_0x373939[_0x9a69('0x32')]);_0x3c78e2['filters']=_[_0x9a69('0x35')](_0x3c78e2[_0x9a69('0x31')],_0x3c78e2[_0x9a69('0x32')]);_0x318de1[_0x9a69('0x36')]=_['intersection'](_0x3c78e2[_0x9a69('0x31')],qs[_0x9a69('0x37')](_0x373939[_0x9a69('0x32')][_0x9a69('0x37')]));_0x318de1['attributes']=_0x318de1[_0x9a69('0x36')]['length']?_0x318de1[_0x9a69('0x36')]:_0x3c78e2['model'];if(_0x373939[_0x9a69('0x32')]['includeAll']){_0x318de1[_0x9a69('0x42')]=[{'all':!![]}];}_0x318de1=_['merge']({},_0x318de1,_0x373939[_0x9a69('0x46')]);return db[_0x9a69('0x40')][_0x9a69('0x47')](_0x318de1)[_0x9a69('0x26')](handleEntityNotFound(_0x5b309a,null))['then'](respondWithResult(_0x5b309a,null))[_0x9a69('0x48')](handleError(_0x5b309a,null));};exports[_0x9a69('0x49')]=function(_0x77781d,_0x2537b0){return db[_0x9a69('0x40')][_0x9a69('0x49')](_0x77781d[_0x9a69('0x4a')],{})[_0x9a69('0x26')](respondWithResult(_0x2537b0,0xc9))[_0x9a69('0x48')](handleError(_0x2537b0,null));};exports['update']=function(_0x281ef0,_0x6046a7){if(_0x281ef0[_0x9a69('0x4a')]['id']){delete _0x281ef0[_0x9a69('0x4a')]['id'];}return db[_0x9a69('0x40')][_0x9a69('0x47')]({'where':{'id':_0x281ef0[_0x9a69('0x45')]['id']}})[_0x9a69('0x26')](handleEntityNotFound(_0x6046a7,null))[_0x9a69('0x26')](saveUpdates(_0x281ef0[_0x9a69('0x4a')],null))[_0x9a69('0x26')](respondWithResult(_0x6046a7,null))[_0x9a69('0x48')](handleError(_0x6046a7,null));};exports[_0x9a69('0x25')]=function(_0x43b084,_0x18ab7a){return db['FreshdeskField'][_0x9a69('0x47')]({'where':{'id':_0x43b084[_0x9a69('0x45')]['id']}})[_0x9a69('0x26')](handleEntityNotFound(_0x18ab7a,null))[_0x9a69('0x26')](removeEntity(_0x18ab7a,null))[_0x9a69('0x48')](handleError(_0x18ab7a,null));}; \ No newline at end of file +var _0x2e54=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','error','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where'];(function(_0x20eacd,_0x2394e2){var _0x57942a=function(_0xd86eda){while(--_0xd86eda){_0x20eacd['push'](_0x20eacd['shift']());}};_0x57942a(++_0x2394e2);}(_0x2e54,0x1dd));var _0x42e5=function(_0x3a8e4f,_0x39ce71){_0x3a8e4f=_0x3a8e4f-0x0;var _0x3543a8=_0x2e54[_0x3a8e4f];return _0x3543a8;};'use strict';var emlformat=require(_0x42e5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x42e5('0x1'));var rp=require(_0x42e5('0x2'));var moment=require(_0x42e5('0x3'));var BPromise=require(_0x42e5('0x4'));var Mustache=require(_0x42e5('0x5'));var util=require(_0x42e5('0x6'));var path=require(_0x42e5('0x7'));var sox=require('sox');var csv=require(_0x42e5('0x8'));var ejs=require(_0x42e5('0x9'));var fs=require('fs');var fs_extra=require(_0x42e5('0xa'));var _=require('lodash');var squel=require(_0x42e5('0xb'));var crypto=require('crypto');var jsforce=require(_0x42e5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x42e5('0x8'));var querystring=require(_0x42e5('0xd'));var Papa=require(_0x42e5('0xe'));var Redis=require(_0x42e5('0xf'));var authService=require(_0x42e5('0x10'));var qs=require(_0x42e5('0x11'));var as=require(_0x42e5('0x12'));var hardwareService=require(_0x42e5('0x13'));var logger=require(_0x42e5('0x14'))('api');var utils=require(_0x42e5('0x15'));var config=require(_0x42e5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x42e5('0x17'))['db'];function respondWithStatusCode(_0x12385d,_0x4530ba){_0x4530ba=_0x4530ba||0xcc;return function(_0x41598d){if(_0x41598d){return _0x12385d[_0x42e5('0x18')](_0x4530ba);}return _0x12385d[_0x42e5('0x19')](_0x4530ba)[_0x42e5('0x1a')]();};}function respondWithResult(_0x96fae2,_0x447648){_0x447648=_0x447648||0xc8;return function(_0x23957f){if(_0x23957f){return _0x96fae2['status'](_0x447648)[_0x42e5('0x1b')](_0x23957f);}};}function respondWithFilteredResult(_0x1d8e52,_0x4034bd){return function(_0x388300){if(_0x388300){var _0x2f4999=typeof _0x4034bd[_0x42e5('0x1c')]===_0x42e5('0x1d')&&typeof _0x4034bd[_0x42e5('0x1e')]===_0x42e5('0x1d');var _0x3c7b79=_0x388300[_0x42e5('0x1f')];var _0x38282d=_0x2f4999?0x0:_0x4034bd[_0x42e5('0x1c')];var _0x23fe09=_0x2f4999?_0x388300['count']:_0x4034bd[_0x42e5('0x1c')]+_0x4034bd['limit'];var _0x5f4428;if(_0x23fe09>=_0x3c7b79){_0x23fe09=_0x3c7b79;_0x5f4428=0xc8;}else{_0x5f4428=0xce;}_0x1d8e52[_0x42e5('0x19')](_0x5f4428);return _0x1d8e52[_0x42e5('0x20')]('Content-Range',_0x38282d+'-'+_0x23fe09+'/'+_0x3c7b79)[_0x42e5('0x1b')](_0x388300);}return null;};}function patchUpdates(_0x39a3e2){return function(_0x1c2169){try{jsonpatch[_0x42e5('0x21')](_0x1c2169,_0x39a3e2,!![]);}catch(_0x1150f4){return BPromise[_0x42e5('0x22')](_0x1150f4);}return _0x1c2169[_0x42e5('0x23')]();};}function saveUpdates(_0x58eee5,_0x4da508){return function(_0x283d44){if(_0x283d44){return _0x283d44['update'](_0x58eee5)[_0x42e5('0x24')](function(_0x2e9574){return _0x2e9574;});}return null;};}function removeEntity(_0x37d10e,_0x49490f){return function(_0x32380f){if(_0x32380f){return _0x32380f['destroy']()[_0x42e5('0x24')](function(){_0x37d10e[_0x42e5('0x19')](0xcc)[_0x42e5('0x1a')]();});}};}function handleEntityNotFound(_0x275c80,_0x4638bc){return function(_0x4f52b2){if(!_0x4f52b2){_0x275c80['sendStatus'](0x194);}return _0x4f52b2;};}function handleError(_0x3115e4,_0x534a26){_0x534a26=_0x534a26||0x1f4;return function(_0x56f812){logger[_0x42e5('0x25')](_0x56f812['stack']);if(_0x56f812[_0x42e5('0x26')]){delete _0x56f812[_0x42e5('0x26')];}_0x3115e4[_0x42e5('0x19')](_0x534a26)[_0x42e5('0x27')](_0x56f812);};}exports[_0x42e5('0x28')]=function(_0x2f1edc,_0x59a46b){var _0x3e2ea5={},_0x201d9e={},_0x39f763={'count':0x0,'rows':[]};var _0x2c53d4=_[_0x42e5('0x29')](db[_0x42e5('0x2a')][_0x42e5('0x2b')],function(_0x282cbf){return{'name':_0x282cbf[_0x42e5('0x2c')],'type':_0x282cbf[_0x42e5('0x2d')][_0x42e5('0x2e')]};});_0x201d9e[_0x42e5('0x2f')]=_[_0x42e5('0x29')](_0x2c53d4,'name');_0x201d9e[_0x42e5('0x30')]=_[_0x42e5('0x31')](_0x2f1edc[_0x42e5('0x30')]);_0x201d9e[_0x42e5('0x32')]=_['intersection'](_0x201d9e['model'],_0x201d9e[_0x42e5('0x30')]);_0x3e2ea5['attributes']=_[_0x42e5('0x33')](_0x201d9e['model'],qs[_0x42e5('0x34')](_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x34')]));_0x3e2ea5['attributes']=_0x3e2ea5[_0x42e5('0x35')][_0x42e5('0x36')]?_0x3e2ea5['attributes']:_0x201d9e[_0x42e5('0x2f')];if(!_0x2f1edc['query'][_0x42e5('0x37')](_0x42e5('0x38'))){_0x3e2ea5[_0x42e5('0x1e')]=qs[_0x42e5('0x1e')](_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x1e')]);_0x3e2ea5[_0x42e5('0x1c')]=qs['offset'](_0x2f1edc['query'][_0x42e5('0x1c')]);}_0x3e2ea5[_0x42e5('0x39')]=qs[_0x42e5('0x3a')](_0x2f1edc['query']['sort']);_0x3e2ea5['where']=qs['filters'](_[_0x42e5('0x3b')](_0x2f1edc[_0x42e5('0x30')],_0x201d9e[_0x42e5('0x32')]),_0x2c53d4);if(_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x3c')]){_0x3e2ea5[_0x42e5('0x3d')]=_[_0x42e5('0x3e')](_0x3e2ea5[_0x42e5('0x3d')],{'$or':_['map'](_0x2c53d4,function(_0x260413){if(_0x260413['type']!==_0x42e5('0x3f')){var _0x343363={};_0x343363[_0x260413[_0x42e5('0x26')]]={'$like':'%'+_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x3c')]+'%'};return _0x343363;}})});}_0x3e2ea5=_[_0x42e5('0x3e')]({},_0x3e2ea5,_0x2f1edc[_0x42e5('0x40')]);var _0x5ab9b8={'where':_0x3e2ea5[_0x42e5('0x3d')]};return db[_0x42e5('0x2a')]['count'](_0x5ab9b8)[_0x42e5('0x24')](function(_0x5e8f96){_0x39f763['count']=_0x5e8f96;if(_0x2f1edc['query'][_0x42e5('0x41')]){_0x3e2ea5[_0x42e5('0x42')]=[{'all':!![]}];}return db[_0x42e5('0x2a')][_0x42e5('0x43')](_0x3e2ea5);})[_0x42e5('0x24')](function(_0x77aa22){_0x39f763[_0x42e5('0x44')]=_0x77aa22;return _0x39f763;})['then'](respondWithFilteredResult(_0x59a46b,_0x3e2ea5))[_0x42e5('0x45')](handleError(_0x59a46b,null));};exports[_0x42e5('0x46')]=function(_0x5bec97,_0x398b73){var _0x1c697a={'raw':!![],'where':{'id':_0x5bec97[_0x42e5('0x47')]['id']}},_0x5db771={};_0x5db771[_0x42e5('0x2f')]=_[_0x42e5('0x31')](db[_0x42e5('0x2a')][_0x42e5('0x2b')]);_0x5db771['query']=_[_0x42e5('0x31')](_0x5bec97[_0x42e5('0x30')]);_0x5db771[_0x42e5('0x32')]=_[_0x42e5('0x33')](_0x5db771['model'],_0x5db771[_0x42e5('0x30')]);_0x1c697a[_0x42e5('0x35')]=_[_0x42e5('0x33')](_0x5db771[_0x42e5('0x2f')],qs[_0x42e5('0x34')](_0x5bec97[_0x42e5('0x30')][_0x42e5('0x34')]));_0x1c697a[_0x42e5('0x35')]=_0x1c697a['attributes'][_0x42e5('0x36')]?_0x1c697a['attributes']:_0x5db771['model'];if(_0x5bec97[_0x42e5('0x30')][_0x42e5('0x41')]){_0x1c697a[_0x42e5('0x42')]=[{'all':!![]}];}_0x1c697a=_[_0x42e5('0x3e')]({},_0x1c697a,_0x5bec97[_0x42e5('0x40')]);return db[_0x42e5('0x2a')][_0x42e5('0x48')](_0x1c697a)['then'](handleEntityNotFound(_0x398b73,null))[_0x42e5('0x24')](respondWithResult(_0x398b73,null))[_0x42e5('0x45')](handleError(_0x398b73,null));};exports[_0x42e5('0x49')]=function(_0x21a047,_0x1086b2){return db[_0x42e5('0x2a')][_0x42e5('0x49')](_0x21a047[_0x42e5('0x4a')],{})['then'](respondWithResult(_0x1086b2,0xc9))[_0x42e5('0x45')](handleError(_0x1086b2,null));};exports[_0x42e5('0x4b')]=function(_0x3616f4,_0x48757e){if(_0x3616f4[_0x42e5('0x4a')]['id']){delete _0x3616f4[_0x42e5('0x4a')]['id'];}return db[_0x42e5('0x2a')][_0x42e5('0x48')]({'where':{'id':_0x3616f4[_0x42e5('0x47')]['id']}})['then'](handleEntityNotFound(_0x48757e,null))[_0x42e5('0x24')](saveUpdates(_0x3616f4['body'],null))[_0x42e5('0x24')](respondWithResult(_0x48757e,null))[_0x42e5('0x45')](handleError(_0x48757e,null));};exports[_0x42e5('0x4c')]=function(_0x48b63b,_0x50f59c){return db['FreshdeskField'][_0x42e5('0x48')]({'where':{'id':_0x48b63b[_0x42e5('0x47')]['id']}})[_0x42e5('0x24')](handleEntityNotFound(_0x50f59c,null))[_0x42e5('0x24')](removeEntity(_0x50f59c,null))['catch'](handleError(_0x50f59c,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 933b2f2..1330042 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 _0x23a8=['../../config/environment','./intFreshdeskField.attributes','exports','define','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x5a6de2,_0x5c8b10){var _0x2c0525=function(_0x59d072){while(--_0x59d072){_0x5a6de2['push'](_0x5a6de2['shift']());}};_0x2c0525(++_0x5c8b10);}(_0x23a8,0xd8));var _0x823a=function(_0x4b36f9,_0x582566){_0x4b36f9=_0x4b36f9-0x0;var _0x476e53=_0x23a8[_0x4b36f9];return _0x476e53;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x823a('0x0'))(_0x823a('0x1'));var moment=require(_0x823a('0x2'));var BPromise=require('bluebird');var rp=require(_0x823a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x823a('0x4'));var config=require(_0x823a('0x5'));var attributes=require(_0x823a('0x6'));module[_0x823a('0x7')]=function(_0x4d4a43,_0x37dc78){return _0x4d4a43[_0x823a('0x8')]('FreshdeskField',attributes,{'tableName':_0x823a('0x9'),'paranoid':![],'indexes':[{'name':_0x823a('0xa'),'fields':[_0x823a('0xb'),_0x823a('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x92f0=['./intFreshdeskField.attributes','exports','FreshdeskField','freshdesk_unique_index','FieldId','util','../../config/logger','moment','bluebird','rimraf','../../config/environment'];(function(_0x4fdd82,_0x5c8540){var _0x416dbd=function(_0xcf534){while(--_0xcf534){_0x4fdd82['push'](_0x4fdd82['shift']());}};_0x416dbd(++_0x5c8540);}(_0x92f0,0x10d));var _0x092f=function(_0x49c653,_0x390195){_0x49c653=_0x49c653-0x0;var _0x31e169=_0x92f0[_0x49c653];return _0x31e169;};'use strict';var _=require('lodash');var util=require(_0x092f('0x0'));var logger=require(_0x092f('0x1'))('api');var moment=require(_0x092f('0x2'));var BPromise=require(_0x092f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x092f('0x4'));var config=require(_0x092f('0x5'));var attributes=require(_0x092f('0x6'));module[_0x092f('0x7')]=function(_0x2996b0,_0x2b6dcb){return _0x2996b0['define'](_0x092f('0x8'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x092f('0x9'),'fields':['idField',_0x092f('0xa')],'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 7737e0c..6d76e0e 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 _0x9f82=['client','request','then','info','request\x20sent','debug','error','code','FreshdeskField,\x20%s,\x20%s','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x4d1d6a,_0x307430){var _0x342f67=function(_0xfea4d9){while(--_0xfea4d9){_0x4d1d6a['push'](_0x4d1d6a['shift']());}};_0x342f67(++_0x307430);}(_0x9f82,0x1eb));var _0x29f8=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9f82[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0x29f8('0x0'));var util=require(_0x29f8('0x1'));var moment=require(_0x29f8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x29f8('0x3'));var db=require(_0x29f8('0x4'))['db'];var utils=require(_0x29f8('0x5'));var logger=require(_0x29f8('0x6'))(_0x29f8('0x7'));var config=require('../../config/environment');var jayson=require(_0x29f8('0x8'));var client=jayson[_0x29f8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x186bce,_0x169cc4,_0x57115a){return new BPromise(function(_0x5cc47d,_0x48ea56){return client[_0x29f8('0xa')](_0x186bce,_0x57115a)[_0x29f8('0xb')](function(_0xfab2ef){logger[_0x29f8('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x169cc4,_0x29f8('0xd'));logger[_0x29f8('0xe')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x169cc4,_0x29f8('0xd'),JSON['stringify'](_0xfab2ef));if(_0xfab2ef[_0x29f8('0xf')]){if(_0xfab2ef[_0x29f8('0xf')][_0x29f8('0x10')]===0x1f4){logger[_0x29f8('0xf')](_0x29f8('0x11'),_0x169cc4,_0xfab2ef[_0x29f8('0xf')]['message']);return _0x48ea56(_0xfab2ef[_0x29f8('0xf')][_0x29f8('0x12')]);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x169cc4,_0xfab2ef[_0x29f8('0xf')][_0x29f8('0x12')]);return _0x5cc47d(_0xfab2ef[_0x29f8('0xf')][_0x29f8('0x12')]);}else{logger[_0x29f8('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x169cc4,_0x29f8('0xd'));_0x5cc47d(_0xfab2ef[_0x29f8('0x13')][_0x29f8('0x12')]);}})['catch'](function(_0x330df7){logger['error'](_0x29f8('0x11'),_0x169cc4,_0x330df7);_0x48ea56(_0x330df7);});});} \ No newline at end of file +var _0x2f79=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x50503f,_0x5cec75){var _0x44264b=function(_0x210e97){while(--_0x210e97){_0x50503f['push'](_0x50503f['shift']());}};_0x44264b(++_0x5cec75);}(_0x2f79,0x103));var _0x92f7=function(_0x5c2311,_0x24ae77){_0x5c2311=_0x5c2311-0x0;var _0x2f0ab2=_0x2f79[_0x5c2311];return _0x2f0ab2;};'use strict';var _=require(_0x92f7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x92f7('0x1'));var rs=require(_0x92f7('0x2'));var fs=require('fs');var Redis=require(_0x92f7('0x3'));var db=require(_0x92f7('0x4'))['db'];var utils=require(_0x92f7('0x5'));var logger=require(_0x92f7('0x6'))(_0x92f7('0x7'));var config=require('../../config/environment');var jayson=require(_0x92f7('0x8'));var client=jayson['client'][_0x92f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7ff9fb,_0x112f71,_0x5241c1){return new BPromise(function(_0x3b853c,_0x5f2a48){return client[_0x92f7('0xa')](_0x7ff9fb,_0x5241c1)[_0x92f7('0xb')](function(_0x2b2e1b){logger['info'](_0x92f7('0xc'),_0x112f71,_0x92f7('0xd'));logger['debug']('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x112f71,'request\x20sent',JSON[_0x92f7('0xe')](_0x2b2e1b));if(_0x2b2e1b['error']){if(_0x2b2e1b[_0x92f7('0xf')][_0x92f7('0x10')]===0x1f4){logger[_0x92f7('0xf')]('FreshdeskField,\x20%s,\x20%s',_0x112f71,_0x2b2e1b[_0x92f7('0xf')]['message']);return _0x5f2a48(_0x2b2e1b[_0x92f7('0xf')][_0x92f7('0x11')]);}logger[_0x92f7('0xf')](_0x92f7('0xc'),_0x112f71,_0x2b2e1b[_0x92f7('0xf')][_0x92f7('0x11')]);return _0x3b853c(_0x2b2e1b[_0x92f7('0xf')][_0x92f7('0x11')]);}else{logger['info']('FreshdeskField,\x20%s,\x20%s',_0x112f71,_0x92f7('0xd'));_0x3b853c(_0x2b2e1b[_0x92f7('0x12')]['message']);}})[_0x92f7('0x13')](function(_0x2eb096){logger[_0x92f7('0xf')](_0x92f7('0xc'),_0x112f71,_0x2eb096);_0x5f2a48(_0x2eb096);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 17ee64c..f4adfdf 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 _0x80ed=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','destroy','exports','multer','path'];(function(_0x212d37,_0x48c57e){var _0xf3ec1c=function(_0x3281a7){while(--_0x3281a7){_0x212d37['push'](_0x212d37['shift']());}};_0xf3ec1c(++_0x48c57e);}(_0x80ed,0x11c));var _0xd80e=function(_0x447096,_0x19b068){_0x447096=_0x447096-0x0;var _0x4be6ea=_0x80ed[_0x447096];return _0x4be6ea;};'use strict';var multer=require(_0xd80e('0x0'));var util=require('util');var path=require(_0xd80e('0x1'));var timeout=require(_0xd80e('0x2'));var express=require(_0xd80e('0x3'));var router=express['Router']();var fs_extra=require(_0xd80e('0x4'));var auth=require(_0xd80e('0x5'));var interaction=require(_0xd80e('0x6'));var config=require(_0xd80e('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0xd80e('0x8')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0xa')]);router['get'](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xc')]);router[_0xd80e('0x8')](_0xd80e('0xd'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xe')]);router[_0xd80e('0x8')](_0xd80e('0xf'),auth[_0xd80e('0x9')](),controller['getFields']);router[_0xd80e('0x10')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0x11')]);router[_0xd80e('0x10')](_0xd80e('0xd'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x12')]);router[_0xd80e('0x13')](_0xd80e('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xd80e('0x9')](),controller[_0xd80e('0x14')]);module[_0xd80e('0x15')]=router; \ No newline at end of file +var _0x0fd9=['../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','destroy','exports','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x4d2157,_0x201cf1){var _0x172f80=function(_0x587167){while(--_0x587167){_0x4d2157['push'](_0x4d2157['shift']());}};_0x172f80(++_0x201cf1);}(_0x0fd9,0xa3));var _0x90fd=function(_0x30bd4d,_0x50eb60){_0x30bd4d=_0x30bd4d-0x0;var _0x306915=_0x0fd9[_0x30bd4d];return _0x306915;};'use strict';var multer=require('multer');var util=require(_0x90fd('0x0'));var path=require(_0x90fd('0x1'));var timeout=require(_0x90fd('0x2'));var express=require(_0x90fd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x90fd('0x4'));var interaction=require(_0x90fd('0x5'));var config=require(_0x90fd('0x6'));var controller=require(_0x90fd('0x7'));router[_0x90fd('0x8')]('/',auth[_0x90fd('0x9')](),controller['index']);router['get'](_0x90fd('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x90fd('0x8')](_0x90fd('0xb'),auth['isAuthenticated'](),controller[_0x90fd('0xc')]);router[_0x90fd('0x8')](_0x90fd('0xd'),auth[_0x90fd('0x9')](),controller[_0x90fd('0xe')]);router[_0x90fd('0xf')]('/',auth[_0x90fd('0x9')](),controller[_0x90fd('0x10')]);router[_0x90fd('0xf')]('/:id/configurations',auth[_0x90fd('0x9')](),controller[_0x90fd('0x11')]);router['put'](_0x90fd('0xa'),auth[_0x90fd('0x9')](),controller[_0x90fd('0x12')]);router['delete'](_0x90fd('0xa'),auth['isAuthenticated'](),controller[_0x90fd('0x13')]);module[_0x90fd('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index ca7b8e4..d73149b 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 _0x66fa=['exports','STRING','username','remoteUri','sequelize'];(function(_0x566a15,_0x240781){var _0x5db593=function(_0x245874){while(--_0x245874){_0x566a15['push'](_0x566a15['shift']());}};_0x5db593(++_0x240781);}(_0x66fa,0x117));var _0xa66f=function(_0x3d4782,_0x4a5e43){_0x3d4782=_0x3d4782-0x0;var _0x2b83b0=_0x66fa[_0x3d4782];return _0x2b83b0;};'use strict';var Sequelize=require(_0xa66f('0x0'));module[_0xa66f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa66f('0x2')]},'username':{'type':Sequelize[_0xa66f('0x2')],'unique':_0xa66f('0x3')},'apiKey':{'type':Sequelize[_0xa66f('0x2')]},'remoteUri':{'type':Sequelize[_0xa66f('0x2')],'unique':_0xa66f('0x4')},'serverUrl':{'type':Sequelize[_0xa66f('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xfef3=['sequelize','STRING','username','remoteUri'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xfef3,0x118));var _0x3fef=function(_0x376f18,_0x58c69c){_0x376f18=_0x376f18-0x0;var _0x4cc104=_0xfef3[_0x376f18];return _0x4cc104;};'use strict';var Sequelize=require(_0x3fef('0x0'));module['exports']={'name':{'type':Sequelize[_0x3fef('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3fef('0x1')],'unique':_0x3fef('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x3fef('0x1')],'unique':_0x3fef('0x3')},'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 d9d75f6..80e76a4 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 _0xa536=['crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','FreshsalesAccount','rawAttributes','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','findAll','rows','show','params','keys','include','find','catch','create','body','findOne','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','username','remoteUri','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','email','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0xa536,0x1ee));var _0x6a53=function(_0x225afd,_0x184394){_0x225afd=_0x225afd-0x0;var _0x4bb118=_0xa536[_0x225afd];return _0x4bb118;};'use strict';var emlformat=require(_0x6a53('0x0'));var rimraf=require(_0x6a53('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6a53('0x2'));var rp=require(_0x6a53('0x3'));var moment=require(_0x6a53('0x4'));var BPromise=require(_0x6a53('0x5'));var Mustache=require(_0x6a53('0x6'));var util=require(_0x6a53('0x7'));var path=require(_0x6a53('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6a53('0x9'));var fs=require('fs');var fs_extra=require(_0x6a53('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6a53('0xb'));var jsforce=require(_0x6a53('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6a53('0xd'));var querystring=require('querystring');var Papa=require(_0x6a53('0xe'));var Redis=require(_0x6a53('0xf'));var authService=require(_0x6a53('0x10'));var qs=require(_0x6a53('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6a53('0x12'));var utils=require(_0x6a53('0x13'));var config=require(_0x6a53('0x14'));var licenseUtil=require(_0x6a53('0x15'));var db=require(_0x6a53('0x16'))['db'];var integrations=require(_0x6a53('0x17'));function respondWithStatusCode(_0x4f08de,_0x10cdc6){_0x10cdc6=_0x10cdc6||0xcc;return function(_0x467180){if(_0x467180){return _0x4f08de['sendStatus'](_0x10cdc6);}return _0x4f08de[_0x6a53('0x18')](_0x10cdc6)[_0x6a53('0x19')]();};}function respondWithResult(_0x523f25,_0x1cc556){_0x1cc556=_0x1cc556||0xc8;return function(_0x579e7c){if(_0x579e7c){return _0x523f25[_0x6a53('0x18')](_0x1cc556)[_0x6a53('0x1a')](_0x579e7c);}};}function respondWithFilteredResult(_0x2b41e7,_0x5aa3d3){return function(_0x50bccf){if(_0x50bccf){var _0x37998d=typeof _0x5aa3d3[_0x6a53('0x1b')]===_0x6a53('0x1c')&&typeof _0x5aa3d3['limit']===_0x6a53('0x1c');var _0x33e1f3=_0x50bccf[_0x6a53('0x1d')];var _0x449825=_0x37998d?0x0:_0x5aa3d3[_0x6a53('0x1b')];var _0x5c86bc=_0x37998d?_0x50bccf[_0x6a53('0x1d')]:_0x5aa3d3[_0x6a53('0x1b')]+_0x5aa3d3[_0x6a53('0x1e')];var _0x2faabf;if(_0x5c86bc>=_0x33e1f3){_0x5c86bc=_0x33e1f3;_0x2faabf=0xc8;}else{_0x2faabf=0xce;}_0x2b41e7['status'](_0x2faabf);return _0x2b41e7[_0x6a53('0x1f')](_0x6a53('0x20'),_0x449825+'-'+_0x5c86bc+'/'+_0x33e1f3)[_0x6a53('0x1a')](_0x50bccf);}return null;};}function patchUpdates(_0x520d96){return function(_0x4c1d86){try{jsonpatch[_0x6a53('0x21')](_0x4c1d86,_0x520d96,!![]);}catch(_0x360536){return BPromise['reject'](_0x360536);}return _0x4c1d86[_0x6a53('0x22')]();};}function saveUpdates(_0xcb0ebb,_0x217e39){return function(_0x476d3e){if(_0x476d3e){return _0x476d3e[_0x6a53('0x23')](_0xcb0ebb)[_0x6a53('0x24')](function(_0x4eccd8){return _0x4eccd8;});}return null;};}function removeEntity(_0x332edd,_0x1d009a){return function(_0x2f1667){if(_0x2f1667){return _0x2f1667[_0x6a53('0x25')]()[_0x6a53('0x24')](function(){_0x332edd[_0x6a53('0x18')](0xcc)[_0x6a53('0x19')]();});}};}function handleEntityNotFound(_0xdccbc7,_0x2f1e8a){return function(_0x383b47){if(!_0x383b47){_0xdccbc7['sendStatus'](0x194);}return _0x383b47;};}function handleError(_0x228405,_0x419f90){_0x419f90=_0x419f90||0x1f4;return function(_0x415cb7){logger[_0x6a53('0x26')](_0x415cb7[_0x6a53('0x27')]);if(_0x415cb7[_0x6a53('0x28')]){delete _0x415cb7[_0x6a53('0x28')];}_0x228405[_0x6a53('0x18')](_0x419f90)[_0x6a53('0x29')](_0x415cb7);};}exports['index']=function(_0x2bb1ab,_0x187192){var _0xa64dd6={},_0x2500df={},_0x13132c={'count':0x0,'rows':[]};var _0x1b8e43=_[_0x6a53('0x2a')](db[_0x6a53('0x2b')][_0x6a53('0x2c')],function(_0x3dccc2){return{'name':_0x3dccc2['fieldName'],'type':_0x3dccc2[_0x6a53('0x2d')][_0x6a53('0x2e')]};});_0x2500df['model']=_['map'](_0x1b8e43,_0x6a53('0x28'));_0x2500df[_0x6a53('0x2f')]=_['keys'](_0x2bb1ab[_0x6a53('0x2f')]);_0x2500df['filters']=_['intersection'](_0x2500df[_0x6a53('0x30')],_0x2500df['query']);_0xa64dd6[_0x6a53('0x31')]=_[_0x6a53('0x32')](_0x2500df[_0x6a53('0x30')],qs[_0x6a53('0x33')](_0x2bb1ab[_0x6a53('0x2f')][_0x6a53('0x33')]));_0xa64dd6[_0x6a53('0x31')]=_0xa64dd6[_0x6a53('0x31')][_0x6a53('0x34')]?_0xa64dd6['attributes']:_0x2500df[_0x6a53('0x30')];if(!_0x2bb1ab[_0x6a53('0x2f')][_0x6a53('0x35')](_0x6a53('0x36'))){_0xa64dd6[_0x6a53('0x1e')]=qs[_0x6a53('0x1e')](_0x2bb1ab[_0x6a53('0x2f')]['limit']);_0xa64dd6[_0x6a53('0x1b')]=qs[_0x6a53('0x1b')](_0x2bb1ab[_0x6a53('0x2f')][_0x6a53('0x1b')]);}_0xa64dd6[_0x6a53('0x37')]=qs[_0x6a53('0x38')](_0x2bb1ab['query'][_0x6a53('0x38')]);_0xa64dd6['where']=qs[_0x6a53('0x39')](_[_0x6a53('0x3a')](_0x2bb1ab[_0x6a53('0x2f')],_0x2500df[_0x6a53('0x39')]),_0x1b8e43);if(_0x2bb1ab[_0x6a53('0x2f')][_0x6a53('0x3b')]){_0xa64dd6[_0x6a53('0x3c')]=_['merge'](_0xa64dd6[_0x6a53('0x3c')],{'$or':_['map'](_0x1b8e43,function(_0x1944d6){if(_0x1944d6[_0x6a53('0x2d')]!=='VIRTUAL'){var _0x38b8b8={};_0x38b8b8[_0x1944d6[_0x6a53('0x28')]]={'$like':'%'+_0x2bb1ab[_0x6a53('0x2f')][_0x6a53('0x3b')]+'%'};return _0x38b8b8;}})});}_0xa64dd6=_[_0x6a53('0x3d')]({},_0xa64dd6,_0x2bb1ab[_0x6a53('0x3e')]);var _0x195215={'where':_0xa64dd6[_0x6a53('0x3c')]};return db[_0x6a53('0x2b')][_0x6a53('0x1d')](_0x195215)[_0x6a53('0x24')](function(_0x3314ae){_0x13132c['count']=_0x3314ae;if(_0x2bb1ab[_0x6a53('0x2f')][_0x6a53('0x3f')]){_0xa64dd6['include']=[{'all':!![]}];}return db[_0x6a53('0x2b')][_0x6a53('0x40')](_0xa64dd6);})[_0x6a53('0x24')](function(_0x223b1c){_0x13132c[_0x6a53('0x41')]=_0x223b1c;return _0x13132c;})[_0x6a53('0x24')](respondWithFilteredResult(_0x187192,_0xa64dd6))['catch'](handleError(_0x187192,null));};exports[_0x6a53('0x42')]=function(_0xa93664,_0x2bfedc){var _0x213b5a={'raw':![],'where':{'id':_0xa93664[_0x6a53('0x43')]['id']}},_0x2521b9={};_0x2521b9['model']=_[_0x6a53('0x44')](db[_0x6a53('0x2b')][_0x6a53('0x2c')]);_0x2521b9['query']=_['keys'](_0xa93664[_0x6a53('0x2f')]);_0x2521b9['filters']=_[_0x6a53('0x32')](_0x2521b9[_0x6a53('0x30')],_0x2521b9[_0x6a53('0x2f')]);_0x213b5a[_0x6a53('0x31')]=_[_0x6a53('0x32')](_0x2521b9[_0x6a53('0x30')],qs[_0x6a53('0x33')](_0xa93664[_0x6a53('0x2f')]['fields']));_0x213b5a[_0x6a53('0x31')]=_0x213b5a['attributes'][_0x6a53('0x34')]?_0x213b5a[_0x6a53('0x31')]:_0x2521b9['model'];if(_0xa93664[_0x6a53('0x2f')]['includeAll']){_0x213b5a[_0x6a53('0x45')]=[{'all':!![]}];}_0x213b5a=_['merge']({},_0x213b5a,_0xa93664[_0x6a53('0x3e')]);return db[_0x6a53('0x2b')][_0x6a53('0x46')](_0x213b5a)[_0x6a53('0x24')](handleEntityNotFound(_0x2bfedc,null))[_0x6a53('0x24')](respondWithResult(_0x2bfedc,null))[_0x6a53('0x47')](handleError(_0x2bfedc,null));};exports[_0x6a53('0x48')]=function(_0x2fcbd8,_0x494ba3){return db[_0x6a53('0x2b')]['create'](_0x2fcbd8[_0x6a53('0x49')],{})[_0x6a53('0x24')](respondWithResult(_0x494ba3,0xc9))[_0x6a53('0x47')](handleError(_0x494ba3,null));};exports[_0x6a53('0x23')]=function(_0x2ba4fd,_0x1c3638){if(_0x2ba4fd[_0x6a53('0x49')]['id']){delete _0x2ba4fd[_0x6a53('0x49')]['id'];}return db['FreshsalesAccount'][_0x6a53('0x46')]({'where':{'id':_0x2ba4fd[_0x6a53('0x43')]['id']}})['then'](handleEntityNotFound(_0x1c3638,null))[_0x6a53('0x24')](saveUpdates(_0x2ba4fd[_0x6a53('0x49')],null))[_0x6a53('0x24')](respondWithResult(_0x1c3638,null))[_0x6a53('0x47')](handleError(_0x1c3638,null));};exports[_0x6a53('0x25')]=function(_0x348b84,_0x20e5ca){return db[_0x6a53('0x2b')]['find']({'where':{'id':_0x348b84['params']['id']}})[_0x6a53('0x24')](handleEntityNotFound(_0x20e5ca,null))[_0x6a53('0x24')](removeEntity(_0x20e5ca,null))['catch'](handleError(_0x20e5ca,null));};exports['getConfigurations']=function(_0xdaf1d2,_0xdd3145,_0x18c243){var _0x1abdd0={};var _0x293a1a={};var _0x1448b8;var _0x5858a9;return db[_0x6a53('0x2b')][_0x6a53('0x4a')]({'where':{'id':_0xdaf1d2['params']['id']}})['then'](handleEntityNotFound(_0xdd3145,null))[_0x6a53('0x24')](function(_0x1b814e){if(_0x1b814e){_0x1448b8=_0x1b814e;_0x293a1a[_0x6a53('0x30')]=_[_0x6a53('0x44')](db['FreshsalesConfiguration'][_0x6a53('0x2c')]);_0x293a1a['query']=_[_0x6a53('0x44')](_0xdaf1d2[_0x6a53('0x2f')]);_0x293a1a[_0x6a53('0x39')]=_[_0x6a53('0x32')](_0x293a1a['model'],_0x293a1a[_0x6a53('0x2f')]);_0x1abdd0[_0x6a53('0x31')]=_[_0x6a53('0x32')](_0x293a1a['model'],qs[_0x6a53('0x33')](_0xdaf1d2[_0x6a53('0x2f')][_0x6a53('0x33')]));_0x1abdd0['attributes']=_0x1abdd0[_0x6a53('0x31')][_0x6a53('0x34')]?_0x1abdd0[_0x6a53('0x31')]:_0x293a1a[_0x6a53('0x30')];_0x1abdd0[_0x6a53('0x37')]=qs['sort'](_0xdaf1d2[_0x6a53('0x2f')][_0x6a53('0x38')]);_0x1abdd0[_0x6a53('0x3c')]=qs[_0x6a53('0x39')](_['pick'](_0xdaf1d2[_0x6a53('0x2f')],_0x293a1a[_0x6a53('0x39')]));if(_0xdaf1d2[_0x6a53('0x2f')][_0x6a53('0x3b')]){_0x1abdd0[_0x6a53('0x3c')]=_[_0x6a53('0x3d')](_0x1abdd0[_0x6a53('0x3c')],{'$or':_[_0x6a53('0x2a')](_0x1abdd0[_0x6a53('0x31')],function(_0x5a83a0){var _0x2b5f7f={};_0x2b5f7f[_0x5a83a0]={'$like':'%'+_0xdaf1d2[_0x6a53('0x2f')][_0x6a53('0x3b')]+'%'};return _0x2b5f7f;})});}_0x1abdd0=_[_0x6a53('0x3d')]({},_0x1abdd0,_0xdaf1d2[_0x6a53('0x3e')]);return _0x1448b8[_0x6a53('0x4b')](_0x1abdd0);}})[_0x6a53('0x24')](function(_0xa6a953){if(_0xa6a953){_0x5858a9=_0xa6a953[_0x6a53('0x34')];if(!_0xdaf1d2[_0x6a53('0x2f')][_0x6a53('0x35')]('nolimit')){_0x1abdd0['limit']=qs['limit'](_0xdaf1d2[_0x6a53('0x2f')][_0x6a53('0x1e')]);_0x1abdd0[_0x6a53('0x1b')]=qs[_0x6a53('0x1b')](_0xdaf1d2[_0x6a53('0x2f')][_0x6a53('0x1b')]);}return _0x1448b8[_0x6a53('0x4b')](_0x1abdd0);}})[_0x6a53('0x24')](function(_0x10796b){if(_0x10796b){return _0x10796b?{'count':_0x5858a9,'rows':_0x10796b}:null;}})[_0x6a53('0x24')](respondWithResult(_0xdd3145,null))[_0x6a53('0x47')](handleError(_0xdd3145,null));};exports['addConfiguration']=function(_0x43489f,_0x274225,_0x26d940){if(_0x43489f[_0x6a53('0x49')]['id']){delete _0x43489f[_0x6a53('0x49')]['id'];}return db[_0x6a53('0x2b')]['findOne']({'where':{'id':_0x43489f[_0x6a53('0x43')]['id']}})[_0x6a53('0x24')](handleEntityNotFound(_0x274225,null))[_0x6a53('0x24')](function(_0x378974){if(_0x378974){_0x43489f[_0x6a53('0x49')][_0x6a53('0x4c')]=_0x378974['id'];_0x43489f[_0x6a53('0x49')][_0x6a53('0x4d')]=integrations[_0x6a53('0x4e')](_0x43489f[_0x6a53('0x49')][_0x6a53('0x4f')],_0x43489f[_0x6a53('0x49')][_0x6a53('0x2d')]);_0x43489f[_0x6a53('0x49')][_0x6a53('0x50')]=integrations[_0x6a53('0x51')](_0x43489f[_0x6a53('0x49')][_0x6a53('0x4f')],_0x43489f['body']['type']);return db['FreshsalesConfiguration'][_0x6a53('0x48')](_0x43489f[_0x6a53('0x49')],{'include':[{'model':db[_0x6a53('0x52')],'as':_0x6a53('0x4d')},{'model':db[_0x6a53('0x52')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x274225,null))[_0x6a53('0x47')](handleError(_0x274225,null));};exports['getFields']=function(_0x51890c,_0x1a72bb,_0xaa4e52){var _0x26b25a='';var _0x4f6fe6='';return db[_0x6a53('0x2b')][_0x6a53('0x4a')]({'where':{'id':_0x51890c[_0x6a53('0x43')]['id']},'attributes':['id',_0x6a53('0x53'),_0x6a53('0x54'),'apiKey']})[_0x6a53('0x24')](handleEntityNotFound(_0x1a72bb,null))[_0x6a53('0x24')](function(_0x2879f9){if(_0x2879f9){_0x4f6fe6=_0x2879f9[_0x6a53('0x53')];_0x26b25a=_0x2879f9[_0x6a53('0x54')];var _0x36b6a9=_0x2879f9[_0x6a53('0x54')]['slice'](-0x1);if(_0x36b6a9==='/'){_0x26b25a=_0x26b25a[_0x6a53('0x55')](0x0,_0x26b25a[_0x6a53('0x56')](_0x36b6a9));}return rp({'method':_0x6a53('0x57'),'uri':util[_0x6a53('0x58')](_0x6a53('0x59'),_0x26b25a,_0x6a53('0x5a')),'headers':{'Authorization':_0x6a53('0x5b')+_0x2879f9[_0x6a53('0x5c')]},'json':!![]});}})['then'](function(_0x5eee1b){if(_0x5eee1b){var _0x2ba319=_0x5eee1b[_0x6a53('0x5d')];var _0x2803ad=![];var _0x407a5b=null;for(_0x407a5b=0x0;_0x407a5b<_0x2ba319[_0x6a53('0x34')];_0x407a5b++){if(_0x2ba319[_0x407a5b][_0x6a53('0x5e')]===_0x4f6fe6){_0x2803ad=!![];}}if(_0x2803ad){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x1a72bb,null))[_0x6a53('0x47')](function(_0x28e3c4){var _0x5b23b6=_0x51890c[_0x6a53('0x2f')]['test']?0x1f4:_0x28e3c4[_0x6a53('0x5f')]||0x1f4;logger[_0x6a53('0x26')](_0x6a53('0x60'),_0x6a53('0x61'),_0x5b23b6,JSON[_0x6a53('0x62')](_0x28e3c4));delete _0x28e3c4['name'];if(_0x5b23b6===0x191){_0x5b23b6=0x190;}_0x1a72bb[_0x6a53('0x18')](_0x5b23b6)[_0x6a53('0x29')](_0x51890c['query'][_0x6a53('0x63')]?{'message':_0x6a53('0x64'),'statusCode':_0x28e3c4['statusCode']}:_0x28e3c4);});}; \ No newline at end of file +var _0xd29e=['getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','save','destroy','then','error','stack','name','send','index','map','FreshsalesAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','include','options','find','create','update','body','params','FreshsalesConfiguration','rawAttributes','order','getConfigurations','addConfiguration','AccountId','channel','Descriptions','getDescriptions','FreshsalesField','getFields','findOne','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','Token\x20token=','users','email','statusCode'];(function(_0x331617,_0x522e81){var _0x22e0fc=function(_0x34790a){while(--_0x34790a){_0x331617['push'](_0x331617['shift']());}};_0x22e0fc(++_0x522e81);}(_0xd29e,0x130));var _0xed29=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd29e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xed29('0x0'));var rimraf=require(_0xed29('0x1'));var zipdir=require(_0xed29('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xed29('0x3'));var moment=require('moment');var BPromise=require(_0xed29('0x4'));var Mustache=require(_0xed29('0x5'));var util=require(_0xed29('0x6'));var path=require(_0xed29('0x7'));var sox=require(_0xed29('0x8'));var csv=require(_0xed29('0x9'));var ejs=require(_0xed29('0xa'));var fs=require('fs');var fs_extra=require(_0xed29('0xb'));var _=require(_0xed29('0xc'));var squel=require(_0xed29('0xd'));var crypto=require(_0xed29('0xe'));var jsforce=require(_0xed29('0xf'));var deskjs=require(_0xed29('0x10'));var toCsv=require(_0xed29('0x9'));var querystring=require('querystring');var Papa=require(_0xed29('0x11'));var Redis=require('ioredis');var authService=require(_0xed29('0x12'));var qs=require(_0xed29('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xed29('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xed29('0x15'));function respondWithStatusCode(_0x3fa9f7,_0x362342){_0x362342=_0x362342||0xcc;return function(_0x4120c2){if(_0x4120c2){return _0x3fa9f7[_0xed29('0x16')](_0x362342);}return _0x3fa9f7[_0xed29('0x17')](_0x362342)[_0xed29('0x18')]();};}function respondWithResult(_0x26fc26,_0x291b66){_0x291b66=_0x291b66||0xc8;return function(_0xd50c5d){if(_0xd50c5d){return _0x26fc26[_0xed29('0x17')](_0x291b66)['json'](_0xd50c5d);}};}function respondWithFilteredResult(_0x49b15e,_0x416013){return function(_0xa4b70d){if(_0xa4b70d){var _0x2c5e7f=typeof _0x416013[_0xed29('0x19')]===_0xed29('0x1a')&&typeof _0x416013[_0xed29('0x1b')]===_0xed29('0x1a');var _0x48ed18=_0xa4b70d['count'];var _0x7d2d7d=_0x2c5e7f?0x0:_0x416013[_0xed29('0x19')];var _0x8d5978=_0x2c5e7f?_0xa4b70d[_0xed29('0x1c')]:_0x416013[_0xed29('0x19')]+_0x416013[_0xed29('0x1b')];var _0x2b24c4;if(_0x8d5978>=_0x48ed18){_0x8d5978=_0x48ed18;_0x2b24c4=0xc8;}else{_0x2b24c4=0xce;}_0x49b15e[_0xed29('0x17')](_0x2b24c4);return _0x49b15e[_0xed29('0x1d')]('Content-Range',_0x7d2d7d+'-'+_0x8d5978+'/'+_0x48ed18)[_0xed29('0x1e')](_0xa4b70d);}return null;};}function patchUpdates(_0x20ece4){return function(_0x21817d){try{jsonpatch['apply'](_0x21817d,_0x20ece4,!![]);}catch(_0x875b98){return BPromise[_0xed29('0x1f')](_0x875b98);}return _0x21817d[_0xed29('0x20')]();};}function saveUpdates(_0x2a4fc2,_0x5d3c19){return function(_0x32e7cb){if(_0x32e7cb){return _0x32e7cb['update'](_0x2a4fc2)['then'](function(_0x55d840){return _0x55d840;});}return null;};}function removeEntity(_0x40a94a,_0xccefeb){return function(_0x550ef6){if(_0x550ef6){return _0x550ef6[_0xed29('0x21')]()[_0xed29('0x22')](function(){_0x40a94a[_0xed29('0x17')](0xcc)[_0xed29('0x18')]();});}};}function handleEntityNotFound(_0x3a5700,_0x2aec40){return function(_0x5a28cb){if(!_0x5a28cb){_0x3a5700['sendStatus'](0x194);}return _0x5a28cb;};}function handleError(_0x12ad27,_0x386b6d){_0x386b6d=_0x386b6d||0x1f4;return function(_0x216d33){logger[_0xed29('0x23')](_0x216d33[_0xed29('0x24')]);if(_0x216d33['name']){delete _0x216d33[_0xed29('0x25')];}_0x12ad27[_0xed29('0x17')](_0x386b6d)[_0xed29('0x26')](_0x216d33);};}exports[_0xed29('0x27')]=function(_0x1cbe7c,_0x2358df){var _0x1e1ac2={},_0x2a2f48={},_0x243a64={'count':0x0,'rows':[]};var _0xdfa0bd=_[_0xed29('0x28')](db[_0xed29('0x29')]['rawAttributes'],function(_0x4043b0){return{'name':_0x4043b0[_0xed29('0x2a')],'type':_0x4043b0[_0xed29('0x2b')]['key']};});_0x2a2f48[_0xed29('0x2c')]=_[_0xed29('0x28')](_0xdfa0bd,_0xed29('0x25'));_0x2a2f48[_0xed29('0x2d')]=_[_0xed29('0x2e')](_0x1cbe7c['query']);_0x2a2f48[_0xed29('0x2f')]=_[_0xed29('0x30')](_0x2a2f48[_0xed29('0x2c')],_0x2a2f48[_0xed29('0x2d')]);_0x1e1ac2[_0xed29('0x31')]=_['intersection'](_0x2a2f48[_0xed29('0x2c')],qs[_0xed29('0x32')](_0x1cbe7c['query'][_0xed29('0x32')]));_0x1e1ac2[_0xed29('0x31')]=_0x1e1ac2[_0xed29('0x31')][_0xed29('0x33')]?_0x1e1ac2[_0xed29('0x31')]:_0x2a2f48[_0xed29('0x2c')];if(!_0x1cbe7c[_0xed29('0x2d')][_0xed29('0x34')](_0xed29('0x35'))){_0x1e1ac2[_0xed29('0x1b')]=qs[_0xed29('0x1b')](_0x1cbe7c[_0xed29('0x2d')][_0xed29('0x1b')]);_0x1e1ac2['offset']=qs['offset'](_0x1cbe7c[_0xed29('0x2d')][_0xed29('0x19')]);}_0x1e1ac2['order']=qs[_0xed29('0x36')](_0x1cbe7c[_0xed29('0x2d')][_0xed29('0x36')]);_0x1e1ac2[_0xed29('0x37')]=qs[_0xed29('0x2f')](_[_0xed29('0x38')](_0x1cbe7c[_0xed29('0x2d')],_0x2a2f48[_0xed29('0x2f')]),_0xdfa0bd);if(_0x1cbe7c[_0xed29('0x2d')]['filter']){_0x1e1ac2[_0xed29('0x37')]=_[_0xed29('0x39')](_0x1e1ac2[_0xed29('0x37')],{'$or':_[_0xed29('0x28')](_0xdfa0bd,function(_0x56ef1d){if(_0x56ef1d[_0xed29('0x2b')]!==_0xed29('0x3a')){var _0x135ad4={};_0x135ad4[_0x56ef1d[_0xed29('0x25')]]={'$like':'%'+_0x1cbe7c['query'][_0xed29('0x3b')]+'%'};return _0x135ad4;}})});}_0x1e1ac2=_[_0xed29('0x39')]({},_0x1e1ac2,_0x1cbe7c['options']);var _0x5471a0={'where':_0x1e1ac2[_0xed29('0x37')]};return db[_0xed29('0x29')][_0xed29('0x1c')](_0x5471a0)[_0xed29('0x22')](function(_0x583d2c){_0x243a64[_0xed29('0x1c')]=_0x583d2c;if(_0x1cbe7c[_0xed29('0x2d')][_0xed29('0x3c')]){_0x1e1ac2['include']=[{'all':!![]}];}return db[_0xed29('0x29')][_0xed29('0x3d')](_0x1e1ac2);})[_0xed29('0x22')](function(_0x3b7607){_0x243a64[_0xed29('0x3e')]=_0x3b7607;return _0x243a64;})['then'](respondWithFilteredResult(_0x2358df,_0x1e1ac2))[_0xed29('0x3f')](handleError(_0x2358df,null));};exports[_0xed29('0x40')]=function(_0x3b8902,_0x1ef77c){var _0xc42571={'raw':![],'where':{'id':_0x3b8902['params']['id']}},_0x4bc07e={};_0x4bc07e[_0xed29('0x2c')]=_[_0xed29('0x2e')](db['FreshsalesAccount']['rawAttributes']);_0x4bc07e['query']=_[_0xed29('0x2e')](_0x3b8902[_0xed29('0x2d')]);_0x4bc07e[_0xed29('0x2f')]=_[_0xed29('0x30')](_0x4bc07e[_0xed29('0x2c')],_0x4bc07e[_0xed29('0x2d')]);_0xc42571['attributes']=_[_0xed29('0x30')](_0x4bc07e[_0xed29('0x2c')],qs['fields'](_0x3b8902['query'][_0xed29('0x32')]));_0xc42571[_0xed29('0x31')]=_0xc42571[_0xed29('0x31')][_0xed29('0x33')]?_0xc42571[_0xed29('0x31')]:_0x4bc07e[_0xed29('0x2c')];if(_0x3b8902['query'][_0xed29('0x3c')]){_0xc42571[_0xed29('0x41')]=[{'all':!![]}];}_0xc42571=_['merge']({},_0xc42571,_0x3b8902[_0xed29('0x42')]);return db[_0xed29('0x29')][_0xed29('0x43')](_0xc42571)[_0xed29('0x22')](handleEntityNotFound(_0x1ef77c,null))[_0xed29('0x22')](respondWithResult(_0x1ef77c,null))['catch'](handleError(_0x1ef77c,null));};exports[_0xed29('0x44')]=function(_0xe6a2ec,_0x272dac){return db['FreshsalesAccount'][_0xed29('0x44')](_0xe6a2ec['body'],{})['then'](respondWithResult(_0x272dac,0xc9))[_0xed29('0x3f')](handleError(_0x272dac,null));};exports[_0xed29('0x45')]=function(_0x5dca49,_0x1a7680){if(_0x5dca49[_0xed29('0x46')]['id']){delete _0x5dca49[_0xed29('0x46')]['id'];}return db[_0xed29('0x29')][_0xed29('0x43')]({'where':{'id':_0x5dca49[_0xed29('0x47')]['id']}})[_0xed29('0x22')](handleEntityNotFound(_0x1a7680,null))[_0xed29('0x22')](saveUpdates(_0x5dca49['body'],null))[_0xed29('0x22')](respondWithResult(_0x1a7680,null))['catch'](handleError(_0x1a7680,null));};exports[_0xed29('0x21')]=function(_0x4e2873,_0x4f03d3){return db['FreshsalesAccount'][_0xed29('0x43')]({'where':{'id':_0x4e2873[_0xed29('0x47')]['id']}})[_0xed29('0x22')](handleEntityNotFound(_0x4f03d3,null))['then'](removeEntity(_0x4f03d3,null))['catch'](handleError(_0x4f03d3,null));};exports['getConfigurations']=function(_0x2a7e7d,_0x30a52d,_0x5a3965){var _0x36148e={};var _0x4546de={};var _0x472e01;var _0x1b0c6b;return db[_0xed29('0x29')]['findOne']({'where':{'id':_0x2a7e7d[_0xed29('0x47')]['id']}})[_0xed29('0x22')](handleEntityNotFound(_0x30a52d,null))[_0xed29('0x22')](function(_0x52b3ef){if(_0x52b3ef){_0x472e01=_0x52b3ef;_0x4546de['model']=_['keys'](db[_0xed29('0x48')][_0xed29('0x49')]);_0x4546de[_0xed29('0x2d')]=_[_0xed29('0x2e')](_0x2a7e7d['query']);_0x4546de[_0xed29('0x2f')]=_[_0xed29('0x30')](_0x4546de[_0xed29('0x2c')],_0x4546de['query']);_0x36148e[_0xed29('0x31')]=_['intersection'](_0x4546de[_0xed29('0x2c')],qs['fields'](_0x2a7e7d[_0xed29('0x2d')][_0xed29('0x32')]));_0x36148e[_0xed29('0x31')]=_0x36148e[_0xed29('0x31')][_0xed29('0x33')]?_0x36148e[_0xed29('0x31')]:_0x4546de[_0xed29('0x2c')];_0x36148e[_0xed29('0x4a')]=qs[_0xed29('0x36')](_0x2a7e7d['query'][_0xed29('0x36')]);_0x36148e[_0xed29('0x37')]=qs['filters'](_['pick'](_0x2a7e7d[_0xed29('0x2d')],_0x4546de[_0xed29('0x2f')]));if(_0x2a7e7d['query'][_0xed29('0x3b')]){_0x36148e[_0xed29('0x37')]=_['merge'](_0x36148e[_0xed29('0x37')],{'$or':_['map'](_0x36148e[_0xed29('0x31')],function(_0x287434){var _0x130fcb={};_0x130fcb[_0x287434]={'$like':'%'+_0x2a7e7d[_0xed29('0x2d')][_0xed29('0x3b')]+'%'};return _0x130fcb;})});}_0x36148e=_[_0xed29('0x39')]({},_0x36148e,_0x2a7e7d[_0xed29('0x42')]);return _0x472e01[_0xed29('0x4b')](_0x36148e);}})[_0xed29('0x22')](function(_0xb2f9ab){if(_0xb2f9ab){_0x1b0c6b=_0xb2f9ab[_0xed29('0x33')];if(!_0x2a7e7d[_0xed29('0x2d')][_0xed29('0x34')](_0xed29('0x35'))){_0x36148e[_0xed29('0x1b')]=qs[_0xed29('0x1b')](_0x2a7e7d[_0xed29('0x2d')][_0xed29('0x1b')]);_0x36148e[_0xed29('0x19')]=qs[_0xed29('0x19')](_0x2a7e7d[_0xed29('0x2d')][_0xed29('0x19')]);}return _0x472e01[_0xed29('0x4b')](_0x36148e);}})['then'](function(_0x3d8e9b){if(_0x3d8e9b){return _0x3d8e9b?{'count':_0x1b0c6b,'rows':_0x3d8e9b}:null;}})[_0xed29('0x22')](respondWithResult(_0x30a52d,null))[_0xed29('0x3f')](handleError(_0x30a52d,null));};exports[_0xed29('0x4c')]=function(_0x5d88e7,_0x40fb5c,_0x2d5a46){if(_0x5d88e7[_0xed29('0x46')]['id']){delete _0x5d88e7[_0xed29('0x46')]['id'];}return db[_0xed29('0x29')]['findOne']({'where':{'id':_0x5d88e7[_0xed29('0x47')]['id']}})[_0xed29('0x22')](handleEntityNotFound(_0x40fb5c,null))[_0xed29('0x22')](function(_0x50c225){if(_0x50c225){_0x5d88e7[_0xed29('0x46')][_0xed29('0x4d')]=_0x50c225['id'];_0x5d88e7[_0xed29('0x46')]['Subjects']=integrations['getSubjects'](_0x5d88e7[_0xed29('0x46')][_0xed29('0x4e')],_0x5d88e7[_0xed29('0x46')][_0xed29('0x2b')]);_0x5d88e7['body'][_0xed29('0x4f')]=integrations[_0xed29('0x50')](_0x5d88e7[_0xed29('0x46')][_0xed29('0x4e')],_0x5d88e7[_0xed29('0x46')][_0xed29('0x2b')]);return db[_0xed29('0x48')][_0xed29('0x44')](_0x5d88e7[_0xed29('0x46')],{'include':[{'model':db[_0xed29('0x51')],'as':'Subjects'},{'model':db[_0xed29('0x51')],'as':_0xed29('0x4f')}]});}return null;})['then'](respondWithResult(_0x40fb5c,null))[_0xed29('0x3f')](handleError(_0x40fb5c,null));};exports[_0xed29('0x52')]=function(_0x19302f,_0x7e920c,_0x2e0ac6){var _0x5610c7='';var _0x5d3432='';return db[_0xed29('0x29')][_0xed29('0x53')]({'where':{'id':_0x19302f[_0xed29('0x47')]['id']},'attributes':['id',_0xed29('0x54'),_0xed29('0x55'),_0xed29('0x56')]})[_0xed29('0x22')](handleEntityNotFound(_0x7e920c,null))[_0xed29('0x22')](function(_0x36aa96){if(_0x36aa96){_0x5d3432=_0x36aa96[_0xed29('0x54')];_0x5610c7=_0x36aa96[_0xed29('0x55')];var _0x14bba6=_0x36aa96['remoteUri'][_0xed29('0x57')](-0x1);if(_0x14bba6==='/'){_0x5610c7=_0x5610c7[_0xed29('0x58')](0x0,_0x5610c7[_0xed29('0x59')](_0x14bba6));}return rp({'method':_0xed29('0x5a'),'uri':util[_0xed29('0x5b')]('%s%s',_0x5610c7,'/api/selector/owners'),'headers':{'Authorization':_0xed29('0x5c')+_0x36aa96[_0xed29('0x56')]},'json':!![]});}})['then'](function(_0x248a6d){if(_0x248a6d){var _0xc2aaaf=_0x248a6d[_0xed29('0x5d')];var _0x4aa134=![];var _0x57cb54=null;for(_0x57cb54=0x0;_0x57cb54<_0xc2aaaf[_0xed29('0x33')];_0x57cb54++){if(_0xc2aaaf[_0x57cb54][_0xed29('0x5e')]===_0x5d3432){_0x4aa134=!![];}}if(_0x4aa134){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x7e920c,null))['catch'](function(_0xf00059){var _0x1b17e4=_0x19302f[_0xed29('0x2d')]['test']?0x1f4:_0xf00059[_0xed29('0x5f')]||0x1f4;logger['error'](_0xed29('0x60'),_0xed29('0x52'),_0x1b17e4,JSON[_0xed29('0x61')](_0xf00059));delete _0xf00059[_0xed29('0x25')];if(_0x1b17e4===0x191){_0x1b17e4=0x190;}_0x7e920c[_0xed29('0x17')](_0x1b17e4)[_0xed29('0x26')](_0x19302f[_0xed29('0x2d')][_0xed29('0x62')]?{'message':_0xed29('0x63'),'statusCode':_0xf00059[_0xed29('0x5f')]}:_0xf00059);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 4940c4a..a779cc7 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 _0x9f0e=['define','FreshsalesAccount','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x838baf,_0x4243d9){var _0x20fc7d=function(_0x9b2d1b){while(--_0x9b2d1b){_0x838baf['push'](_0x838baf['shift']());}};_0x20fc7d(++_0x4243d9);}(_0x9f0e,0x116));var _0xe9f0=function(_0x7f8c63,_0x58f1b0){_0x7f8c63=_0x7f8c63-0x0;var _0x239b71=_0x9f0e[_0x7f8c63];return _0x239b71;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var logger=require(_0xe9f0('0x2'))(_0xe9f0('0x3'));var moment=require(_0xe9f0('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe9f0('0x5'));var rimraf=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var attributes=require(_0xe9f0('0x8'));var integrations=require(_0xe9f0('0x9'));module['exports']=function(_0x5b87c1,_0x3a17b3){return _0x5b87c1[_0xe9f0('0xa')](_0xe9f0('0xb'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x01d9=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0x45ef1c,_0x32686b){var _0x270719=function(_0x257bec){while(--_0x257bec){_0x45ef1c['push'](_0x45ef1c['shift']());}};_0x270719(++_0x32686b);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require('moment');var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require(_0x901d('0x9'));var integrations=require(_0x901d('0xa'));module['exports']=function(_0x1e5d7d,_0x6c9ac8){return _0x1e5d7d[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 2b8bd1b..c925781 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 _0x0424=['info','result','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','attributes','limit','include','model','map','ShowFreshsalesAccount','find','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x2ee2dd,_0x3faf72){var _0x5b7475=function(_0x3dd02f){while(--_0x3dd02f){_0x2ee2dd['push'](_0x2ee2dd['shift']());}};_0x5b7475(++_0x3faf72);}(_0x0424,0x159));var _0x4042=function(_0x377ddf,_0x102e9a){_0x377ddf=_0x377ddf-0x0;var _0x5b8465=_0x0424[_0x377ddf];return _0x5b8465;};'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')]('FreshsalesAccount,\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')]['findAll']({'raw':_0x466077[_0x4042('0x17')]?_0x466077[_0x4042('0x17')][_0x4042('0x18')]===undefined?!![]:![]:!![],'where':_0x466077[_0x4042('0x17')]?_0x466077['options'][_0x4042('0x19')]||null:null,'attributes':_0x466077[_0x4042('0x17')]?_0x466077[_0x4042('0x17')][_0x4042('0x1a')]||null:null,'limit':_0x466077['options']?_0x466077[_0x4042('0x17')][_0x4042('0x1b')]||null:null,'include':_0x466077[_0x4042('0x17')]?_0x466077[_0x4042('0x17')][_0x4042('0x1c')]?_['map'](_0x466077[_0x4042('0x17')][_0x4042('0x1c')],function(_0x519f2c){return{'model':db[_0x519f2c[_0x4042('0x1d')]],'as':_0x519f2c['as'],'attributes':_0x519f2c['attributes'],'include':_0x519f2c[_0x4042('0x1c')]?_[_0x4042('0x1e')](_0x519f2c[_0x4042('0x1c')],function(_0x5d5c6d){return{'model':db[_0x5d5c6d[_0x4042('0x1d')]],'as':_0x5d5c6d['as'],'attributes':_0x5d5c6d[_0x4042('0x1a')],'include':_0x5d5c6d[_0x4042('0x1c')]?_[_0x4042('0x1e')](_0x5d5c6d[_0x4042('0x1c')],function(_0x52e575){return{'model':db[_0x52e575['model']],'as':_0x52e575['as'],'attributes':_0x52e575[_0x4042('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4042('0xa')](function(_0x26542c){logger[_0x4042('0x12')](_0x4042('0x15'),_0x466077);logger[_0x4042('0xd')]('GetFreshsalesAccount',_0x466077,JSON[_0x4042('0xf')](_0x26542c));_0xe5c1ec(_0x26542c);})[_0x4042('0x14')](function(_0x4a6a6e){logger[_0x4042('0x10')](_0x4042('0x15'),_0x4a6a6e[_0x4042('0x11')],_0x466077);_0x4fe024(_0x4b02d4['error'](0x1f4,_0x4a6a6e['message']));});});};exports[_0x4042('0x1f')]=function(_0x43bd1c){var _0x59773f=this;return new Promise(function(_0x3e9304,_0xc42d70){return db[_0x4042('0x16')][_0x4042('0x20')]({'raw':_0x43bd1c[_0x4042('0x17')]?_0x43bd1c[_0x4042('0x17')][_0x4042('0x18')]===undefined?!![]:![]:!![],'where':_0x43bd1c[_0x4042('0x17')]?_0x43bd1c[_0x4042('0x17')]['where']||null:null,'attributes':_0x43bd1c[_0x4042('0x17')]?_0x43bd1c[_0x4042('0x17')]['attributes']||null:null,'include':_0x43bd1c[_0x4042('0x17')]?_0x43bd1c[_0x4042('0x17')]['include']?_[_0x4042('0x1e')](_0x43bd1c[_0x4042('0x17')][_0x4042('0x1c')],function(_0xaa7c99){return{'model':db[_0xaa7c99[_0x4042('0x1d')]],'as':_0xaa7c99['as'],'attributes':_0xaa7c99[_0x4042('0x1a')],'include':_0xaa7c99[_0x4042('0x1c')]?_[_0x4042('0x1e')](_0xaa7c99[_0x4042('0x1c')],function(_0x37195b){return{'model':db[_0x37195b[_0x4042('0x1d')]],'as':_0x37195b['as'],'attributes':_0x37195b[_0x4042('0x1a')],'include':_0x37195b[_0x4042('0x1c')]?_[_0x4042('0x1e')](_0x37195b[_0x4042('0x1c')],function(_0x2b5f5e){return{'model':db[_0x2b5f5e[_0x4042('0x1d')]],'as':_0x2b5f5e['as'],'attributes':_0x2b5f5e[_0x4042('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4042('0xa')](function(_0x26b7b0){logger[_0x4042('0x12')]('ShowFreshsalesAccount',_0x43bd1c);logger[_0x4042('0xd')](_0x4042('0x1f'),_0x43bd1c,JSON[_0x4042('0xf')](_0x26b7b0));_0x3e9304(_0x26b7b0);})[_0x4042('0x14')](function(_0x588932){logger[_0x4042('0x10')](_0x4042('0x1f'),_0x588932[_0x4042('0x11')],_0x43bd1c);_0xc42d70(_0x59773f[_0x4042('0x10')](0x1f4,_0x588932[_0x4042('0x11')]));});});}; \ No newline at end of file +var _0x5f66=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','GetFreshsalesAccount','findAll','options','attributes','limit','include','model','map','ShowFreshsalesAccount','FreshsalesAccount','raw','where','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x26870d,_0x34c5e2){var _0x3fc281=function(_0x376df3){while(--_0x376df3){_0x26870d['push'](_0x26870d['shift']());}};_0x3fc281(++_0x34c5e2);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'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});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});}exports[_0x65f6('0x15')]=function(_0x1f974c){var _0xc8660c=this;return new Promise(function(_0x18380e,_0x495dd6){return db['FreshsalesAccount'][_0x65f6('0x16')]({'raw':_0x1f974c['options']?_0x1f974c['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')]['where']||null:null,'attributes':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')][_0x65f6('0x18')]||null:null,'limit':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')][_0x65f6('0x19')]||null:null,'include':_0x1f974c['options']?_0x1f974c[_0x65f6('0x17')]['include']?_['map'](_0x1f974c[_0x65f6('0x17')][_0x65f6('0x1a')],function(_0x524e42){return{'model':db[_0x524e42[_0x65f6('0x1b')]],'as':_0x524e42['as'],'attributes':_0x524e42[_0x65f6('0x18')],'include':_0x524e42[_0x65f6('0x1a')]?_[_0x65f6('0x1c')](_0x524e42['include'],function(_0x9d7bb0){return{'model':db[_0x9d7bb0[_0x65f6('0x1b')]],'as':_0x9d7bb0['as'],'attributes':_0x9d7bb0[_0x65f6('0x18')],'include':_0x9d7bb0['include']?_['map'](_0x9d7bb0['include'],function(_0x29abdb){return{'model':db[_0x29abdb[_0x65f6('0x1b')]],'as':_0x29abdb['as'],'attributes':_0x29abdb['attributes']};}):[]};}):[]};}):[]:[]})[_0x65f6('0xa')](function(_0x28f710){logger['info'](_0x65f6('0x15'),_0x1f974c);logger[_0x65f6('0xd')](_0x65f6('0x15'),_0x1f974c,JSON['stringify'](_0x28f710));_0x18380e(_0x28f710);})['catch'](function(_0x488d36){logger[_0x65f6('0x12')](_0x65f6('0x15'),_0x488d36[_0x65f6('0x11')],_0x1f974c);_0x495dd6(_0xc8660c[_0x65f6('0x12')](0x1f4,_0x488d36[_0x65f6('0x11')]));});});};exports[_0x65f6('0x1d')]=function(_0x144e55){var _0x4ace4c=this;return new Promise(function(_0x4ea23d,_0x154cbd){return db[_0x65f6('0x1e')]['find']({'raw':_0x144e55['options']?_0x144e55[_0x65f6('0x17')][_0x65f6('0x1f')]===undefined?!![]:![]:!![],'where':_0x144e55[_0x65f6('0x17')]?_0x144e55[_0x65f6('0x17')][_0x65f6('0x20')]||null:null,'attributes':_0x144e55[_0x65f6('0x17')]?_0x144e55['options'][_0x65f6('0x18')]||null:null,'include':_0x144e55[_0x65f6('0x17')]?_0x144e55[_0x65f6('0x17')]['include']?_[_0x65f6('0x1c')](_0x144e55[_0x65f6('0x17')][_0x65f6('0x1a')],function(_0x45510a){return{'model':db[_0x45510a[_0x65f6('0x1b')]],'as':_0x45510a['as'],'attributes':_0x45510a[_0x65f6('0x18')],'include':_0x45510a['include']?_[_0x65f6('0x1c')](_0x45510a[_0x65f6('0x1a')],function(_0x4f3e22){return{'model':db[_0x4f3e22[_0x65f6('0x1b')]],'as':_0x4f3e22['as'],'attributes':_0x4f3e22['attributes'],'include':_0x4f3e22[_0x65f6('0x1a')]?_['map'](_0x4f3e22[_0x65f6('0x1a')],function(_0x24f7fd){return{'model':db[_0x24f7fd['model']],'as':_0x24f7fd['as'],'attributes':_0x24f7fd[_0x65f6('0x18')]};}):[]};}):[]};}):[]:[]})[_0x65f6('0xa')](function(_0x3b261d){logger['info']('ShowFreshsalesAccount',_0x144e55);logger[_0x65f6('0xd')]('ShowFreshsalesAccount',_0x144e55,JSON[_0x65f6('0xf')](_0x3b261d));_0x4ea23d(_0x3b261d);})['catch'](function(_0x22d760){logger[_0x65f6('0x12')]('ShowFreshsalesAccount',_0x22d760[_0x65f6('0x11')],_0x144e55);_0x154cbd(_0x4ace4c['error'](0x1f4,_0x22d760['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index b61af79..7e6152c 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 _0xe8f0=['getDescriptions','/:id/fields','getFields','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0xf81816,_0x391f04){var _0x5264a5=function(_0x571b25){while(--_0x571b25){_0xf81816['push'](_0xf81816['shift']());}};_0x5264a5(++_0x391f04);}(_0xe8f0,0x1e3));var _0x0e8f=function(_0x52e073,_0x2f8210){_0x52e073=_0x52e073-0x0;var _0x7b8a45=_0xe8f0[_0x52e073];return _0x7b8a45;};'use strict';var multer=require('multer');var util=require(_0x0e8f('0x0'));var path=require(_0x0e8f('0x1'));var timeout=require(_0x0e8f('0x2'));var express=require(_0x0e8f('0x3'));var router=express[_0x0e8f('0x4')]();var fs_extra=require(_0x0e8f('0x5'));var auth=require(_0x0e8f('0x6'));var interaction=require(_0x0e8f('0x7'));var config=require('../../config/environment');var controller=require(_0x0e8f('0x8'));router[_0x0e8f('0x9')]('/',auth[_0x0e8f('0xa')](),controller[_0x0e8f('0xb')]);router['get'](_0x0e8f('0xc'),auth[_0x0e8f('0xa')](),controller[_0x0e8f('0xd')]);router[_0x0e8f('0x9')](_0x0e8f('0xe'),auth[_0x0e8f('0xa')](),controller[_0x0e8f('0xf')]);router['get'](_0x0e8f('0x10'),auth['isAuthenticated'](),controller[_0x0e8f('0x11')]);router[_0x0e8f('0x9')](_0x0e8f('0x12'),auth['isAuthenticated'](),controller[_0x0e8f('0x13')]);router['post']('/',auth[_0x0e8f('0xa')](),controller[_0x0e8f('0x14')]);router['put'](_0x0e8f('0xc'),auth['isAuthenticated'](),controller[_0x0e8f('0x15')]);router[_0x0e8f('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x0e8f('0x17')]);module[_0x0e8f('0x18')]=router; \ No newline at end of file +var _0xcd8d=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','getSubjects','getDescriptions','/:id/fields','getFields','create','put','/:id','delete','destroy','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd8d,0x6d));var _0xdcd8=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xcd8d[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0xdcd8('0x0'));var util=require('util');var path=require(_0xdcd8('0x1'));var timeout=require('connect-timeout');var express=require(_0xdcd8('0x2'));var router=express[_0xdcd8('0x3')]();var fs_extra=require(_0xdcd8('0x4'));var auth=require(_0xdcd8('0x5'));var interaction=require(_0xdcd8('0x6'));var config=require(_0xdcd8('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router[_0xdcd8('0x8')]('/',auth[_0xdcd8('0x9')](),controller[_0xdcd8('0xa')]);router[_0xdcd8('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xdcd8('0xb')]);router[_0xdcd8('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xdcd8('0xc')]);router[_0xdcd8('0x8')]('/:id/descriptions',auth[_0xdcd8('0x9')](),controller[_0xdcd8('0xd')]);router['get'](_0xdcd8('0xe'),auth[_0xdcd8('0x9')](),controller[_0xdcd8('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdcd8('0x10')]);router[_0xdcd8('0x11')](_0xdcd8('0x12'),auth[_0xdcd8('0x9')](),controller['update']);router[_0xdcd8('0x13')](_0xdcd8('0x12'),auth[_0xdcd8('0x9')](),controller[_0xdcd8('0x14')]);module[_0xdcd8('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 7eb2338..b283e03 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 _0xd39a=['sequelize','STRING'];(function(_0x3467d,_0x239b0e){var _0x8b13e7=function(_0x533510){while(--_0x533510){_0x3467d['push'](_0x3467d['shift']());}};_0x8b13e7(++_0x239b0e);}(_0xd39a,0x1f4));var _0xad39=function(_0x51b169,_0x5efbc2){_0x51b169=_0x51b169-0x0;var _0x12605a=_0xd39a[_0x51b169];return _0x12605a;};'use strict';var Sequelize=require(_0xad39('0x0'));module['exports']={'name':{'type':Sequelize[_0xad39('0x1')]},'description':{'type':Sequelize[_0xad39('0x1')]}}; \ No newline at end of file +var _0x4320=['exports','STRING','sequelize'];(function(_0x815fac,_0x3a4fd7){var _0x2cabb2=function(_0x456bc6){while(--_0x456bc6){_0x815fac['push'](_0x815fac['shift']());}};_0x2cabb2(++_0x3a4fd7);}(_0x4320,0x194));var _0x0432=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x4320[_0x422905];return _0x33dc6c;};'use strict';var Sequelize=require(_0x0432('0x0'));module[_0x0432('0x1')]={'name':{'type':Sequelize[_0x0432('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 3739a19..c395e1b 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 _0xe000=['limit','count','set','Content-Range','json','save','then','destroy','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','model','query','keys','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','VIRTUAL','options','where','include','findAll','rows','catch','show','params','intersection','includeAll','find','body','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','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','end','status','offset','undefined'];(function(_0xd3e907,_0x309e5b){var _0x164844=function(_0x369060){while(--_0x369060){_0xd3e907['push'](_0xd3e907['shift']());}};_0x164844(++_0x309e5b);}(_0xe000,0x7e));var _0x0e00=function(_0x1cc534,_0x47b3d8){_0x1cc534=_0x1cc534-0x0;var _0x257fd4=_0xe000[_0x1cc534];return _0x257fd4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0e00('0x0'));var jsonpatch=require(_0x0e00('0x1'));var rp=require(_0x0e00('0x2'));var moment=require('moment');var BPromise=require(_0x0e00('0x3'));var Mustache=require(_0x0e00('0x4'));var util=require(_0x0e00('0x5'));var path=require('path');var sox=require(_0x0e00('0x6'));var csv=require(_0x0e00('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e00('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0e00('0x9'));var deskjs=require(_0x0e00('0xa'));var toCsv=require('to-csv');var querystring=require(_0x0e00('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0e00('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x0e00('0xd'));var hardwareService=require(_0x0e00('0xe'));var logger=require(_0x0e00('0xf'))(_0x0e00('0x10'));var utils=require(_0x0e00('0x11'));var config=require(_0x0e00('0x12'));var licenseUtil=require(_0x0e00('0x13'));var db=require(_0x0e00('0x14'))['db'];function respondWithStatusCode(_0x30a665,_0x4a9686){_0x4a9686=_0x4a9686||0xcc;return function(_0x50677e){if(_0x50677e){return _0x30a665[_0x0e00('0x15')](_0x4a9686);}return _0x30a665['status'](_0x4a9686)[_0x0e00('0x16')]();};}function respondWithResult(_0x57e55d,_0x6687e2){_0x6687e2=_0x6687e2||0xc8;return function(_0x3b5567){if(_0x3b5567){return _0x57e55d[_0x0e00('0x17')](_0x6687e2)['json'](_0x3b5567);}};}function respondWithFilteredResult(_0x25cccf,_0x486cbb){return function(_0x54de0f){if(_0x54de0f){var _0x1c49a5=typeof _0x486cbb[_0x0e00('0x18')]===_0x0e00('0x19')&&typeof _0x486cbb[_0x0e00('0x1a')]===_0x0e00('0x19');var _0x329fd3=_0x54de0f[_0x0e00('0x1b')];var _0x5171df=_0x1c49a5?0x0:_0x486cbb[_0x0e00('0x18')];var _0x5b20a3=_0x1c49a5?_0x54de0f[_0x0e00('0x1b')]:_0x486cbb[_0x0e00('0x18')]+_0x486cbb['limit'];var _0x460069;if(_0x5b20a3>=_0x329fd3){_0x5b20a3=_0x329fd3;_0x460069=0xc8;}else{_0x460069=0xce;}_0x25cccf['status'](_0x460069);return _0x25cccf[_0x0e00('0x1c')](_0x0e00('0x1d'),_0x5171df+'-'+_0x5b20a3+'/'+_0x329fd3)[_0x0e00('0x1e')](_0x54de0f);}return null;};}function patchUpdates(_0x759774){return function(_0x3ed209){try{jsonpatch['apply'](_0x3ed209,_0x759774,!![]);}catch(_0x571116){return BPromise['reject'](_0x571116);}return _0x3ed209[_0x0e00('0x1f')]();};}function saveUpdates(_0x42bda6,_0x7b94a7){return function(_0x32d552){if(_0x32d552){return _0x32d552['update'](_0x42bda6)[_0x0e00('0x20')](function(_0x46a1a7){return _0x46a1a7;});}return null;};}function removeEntity(_0x2b5732,_0x59b97a){return function(_0xc0da95){if(_0xc0da95){return _0xc0da95[_0x0e00('0x21')]()['then'](function(){_0x2b5732[_0x0e00('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3013bc,_0x443131){return function(_0x5841b2){if(!_0x5841b2){_0x3013bc[_0x0e00('0x15')](0x194);}return _0x5841b2;};}function handleError(_0xaf5371,_0x4125a2){_0x4125a2=_0x4125a2||0x1f4;return function(_0x39fc18){logger[_0x0e00('0x22')](_0x39fc18[_0x0e00('0x23')]);if(_0x39fc18[_0x0e00('0x24')]){delete _0x39fc18[_0x0e00('0x24')];}_0xaf5371['status'](_0x4125a2)[_0x0e00('0x25')](_0x39fc18);};}exports[_0x0e00('0x26')]=function(_0x1a453e,_0x524ead){var _0x368af8={},_0x311ccd={},_0x34f064={'count':0x0,'rows':[]};var _0x197c3c=_[_0x0e00('0x27')](db[_0x0e00('0x28')][_0x0e00('0x29')],function(_0x1474d3){return{'name':_0x1474d3[_0x0e00('0x2a')],'type':_0x1474d3[_0x0e00('0x2b')]['key']};});_0x311ccd[_0x0e00('0x2c')]=_[_0x0e00('0x27')](_0x197c3c,'name');_0x311ccd[_0x0e00('0x2d')]=_[_0x0e00('0x2e')](_0x1a453e[_0x0e00('0x2d')]);_0x311ccd['filters']=_['intersection'](_0x311ccd[_0x0e00('0x2c')],_0x311ccd[_0x0e00('0x2d')]);_0x368af8['attributes']=_['intersection'](_0x311ccd['model'],qs[_0x0e00('0x2f')](_0x1a453e['query']['fields']));_0x368af8[_0x0e00('0x30')]=_0x368af8[_0x0e00('0x30')][_0x0e00('0x31')]?_0x368af8['attributes']:_0x311ccd['model'];if(!_0x1a453e['query'][_0x0e00('0x32')](_0x0e00('0x33'))){_0x368af8['limit']=qs[_0x0e00('0x1a')](_0x1a453e['query']['limit']);_0x368af8[_0x0e00('0x18')]=qs[_0x0e00('0x18')](_0x1a453e['query'][_0x0e00('0x18')]);}_0x368af8[_0x0e00('0x34')]=qs[_0x0e00('0x35')](_0x1a453e['query']['sort']);_0x368af8['where']=qs[_0x0e00('0x36')](_[_0x0e00('0x37')](_0x1a453e[_0x0e00('0x2d')],_0x311ccd[_0x0e00('0x36')]),_0x197c3c);if(_0x1a453e[_0x0e00('0x2d')][_0x0e00('0x38')]){_0x368af8['where']=_[_0x0e00('0x39')](_0x368af8['where'],{'$or':_[_0x0e00('0x27')](_0x197c3c,function(_0x2677c3){if(_0x2677c3[_0x0e00('0x2b')]!==_0x0e00('0x3a')){var _0x4b189d={};_0x4b189d[_0x2677c3[_0x0e00('0x24')]]={'$like':'%'+_0x1a453e[_0x0e00('0x2d')][_0x0e00('0x38')]+'%'};return _0x4b189d;}})});}_0x368af8=_[_0x0e00('0x39')]({},_0x368af8,_0x1a453e[_0x0e00('0x3b')]);var _0x440d4a={'where':_0x368af8[_0x0e00('0x3c')]};return db[_0x0e00('0x28')][_0x0e00('0x1b')](_0x440d4a)[_0x0e00('0x20')](function(_0x494b02){_0x34f064[_0x0e00('0x1b')]=_0x494b02;if(_0x1a453e[_0x0e00('0x2d')]['includeAll']){_0x368af8[_0x0e00('0x3d')]=[{'all':!![]}];}return db[_0x0e00('0x28')][_0x0e00('0x3e')](_0x368af8);})[_0x0e00('0x20')](function(_0x34f3cc){_0x34f064[_0x0e00('0x3f')]=_0x34f3cc;return _0x34f064;})[_0x0e00('0x20')](respondWithFilteredResult(_0x524ead,_0x368af8))[_0x0e00('0x40')](handleError(_0x524ead,null));};exports[_0x0e00('0x41')]=function(_0x2088f5,_0x31779a){var _0x4cb2e5={'raw':![],'where':{'id':_0x2088f5[_0x0e00('0x42')]['id']}},_0x3db530={};_0x3db530['model']=_[_0x0e00('0x2e')](db[_0x0e00('0x28')][_0x0e00('0x29')]);_0x3db530['query']=_[_0x0e00('0x2e')](_0x2088f5[_0x0e00('0x2d')]);_0x3db530[_0x0e00('0x36')]=_[_0x0e00('0x43')](_0x3db530['model'],_0x3db530[_0x0e00('0x2d')]);_0x4cb2e5[_0x0e00('0x30')]=_['intersection'](_0x3db530[_0x0e00('0x2c')],qs[_0x0e00('0x2f')](_0x2088f5['query'][_0x0e00('0x2f')]));_0x4cb2e5[_0x0e00('0x30')]=_0x4cb2e5[_0x0e00('0x30')]['length']?_0x4cb2e5[_0x0e00('0x30')]:_0x3db530[_0x0e00('0x2c')];if(_0x2088f5['query'][_0x0e00('0x44')]){_0x4cb2e5[_0x0e00('0x3d')]=[{'all':!![]}];}_0x4cb2e5=_[_0x0e00('0x39')]({},_0x4cb2e5,_0x2088f5[_0x0e00('0x3b')]);return db[_0x0e00('0x28')][_0x0e00('0x45')](_0x4cb2e5)[_0x0e00('0x20')](handleEntityNotFound(_0x31779a,null))[_0x0e00('0x20')](respondWithResult(_0x31779a,null))['catch'](handleError(_0x31779a,null));};exports['create']=function(_0x15546a,_0x5291b8){return db[_0x0e00('0x28')]['create'](_0x15546a['body'],{})['then'](respondWithResult(_0x5291b8,0xc9))[_0x0e00('0x40')](handleError(_0x5291b8,null));};exports['update']=function(_0x467da2,_0x510c6a){if(_0x467da2[_0x0e00('0x46')]['id']){delete _0x467da2[_0x0e00('0x46')]['id'];}return db[_0x0e00('0x28')]['find']({'where':{'id':_0x467da2['params']['id']}})[_0x0e00('0x20')](handleEntityNotFound(_0x510c6a,null))['then'](saveUpdates(_0x467da2['body'],null))[_0x0e00('0x20')](respondWithResult(_0x510c6a,null))[_0x0e00('0x40')](handleError(_0x510c6a,null));};exports[_0x0e00('0x21')]=function(_0x15783c,_0x3ad70a){return db['FreshsalesConfiguration'][_0x0e00('0x45')]({'where':{'id':_0x15783c[_0x0e00('0x42')]['id']}})[_0x0e00('0x20')](handleEntityNotFound(_0x3ad70a,null))[_0x0e00('0x20')](removeEntity(_0x3ad70a,null))[_0x0e00('0x40')](handleError(_0x3ad70a,null));};exports[_0x0e00('0x47')]=function(_0x16116e,_0x4d99a5,_0x3d28fa){var _0x54f9da={};var _0x2c9a6c={};var _0x98eb41;var _0x122d54;return db[_0x0e00('0x28')][_0x0e00('0x48')]({'where':{'id':_0x16116e[_0x0e00('0x42')]['id']}})[_0x0e00('0x20')](handleEntityNotFound(_0x4d99a5,null))[_0x0e00('0x20')](function(_0x55d3bc){if(_0x55d3bc){_0x98eb41=_0x55d3bc;_0x2c9a6c[_0x0e00('0x2c')]=_[_0x0e00('0x2e')](db[_0x0e00('0x49')][_0x0e00('0x29')]);_0x2c9a6c[_0x0e00('0x2d')]=_['keys'](_0x16116e['query']);_0x2c9a6c['filters']=_[_0x0e00('0x43')](_0x2c9a6c['model'],_0x2c9a6c['query']);_0x54f9da[_0x0e00('0x30')]=_[_0x0e00('0x43')](_0x2c9a6c[_0x0e00('0x2c')],qs['fields'](_0x16116e['query'][_0x0e00('0x2f')]));_0x54f9da[_0x0e00('0x30')]=_0x54f9da[_0x0e00('0x30')][_0x0e00('0x31')]?_0x54f9da['attributes']:_0x2c9a6c[_0x0e00('0x2c')];_0x54f9da[_0x0e00('0x34')]=qs[_0x0e00('0x35')](_0x16116e[_0x0e00('0x2d')][_0x0e00('0x35')]);_0x54f9da['where']=qs[_0x0e00('0x36')](_[_0x0e00('0x37')](_0x16116e['query'],_0x2c9a6c[_0x0e00('0x36')]));if(_0x16116e[_0x0e00('0x2d')]['filter']){_0x54f9da['where']=_[_0x0e00('0x39')](_0x54f9da[_0x0e00('0x3c')],{'$or':_[_0x0e00('0x27')](_0x54f9da[_0x0e00('0x30')],function(_0x5aa30a){var _0x37082c={};_0x37082c[_0x5aa30a]={'$like':'%'+_0x16116e[_0x0e00('0x2d')][_0x0e00('0x38')]+'%'};return _0x37082c;})});}_0x54f9da=_[_0x0e00('0x39')]({},_0x54f9da,_0x16116e[_0x0e00('0x3b')]);return _0x98eb41[_0x0e00('0x47')](_0x54f9da);}})[_0x0e00('0x20')](function(_0x463aa0){if(_0x463aa0){_0x122d54=_0x463aa0[_0x0e00('0x31')];if(!_0x16116e[_0x0e00('0x2d')][_0x0e00('0x32')]('nolimit')){_0x54f9da[_0x0e00('0x1a')]=qs[_0x0e00('0x1a')](_0x16116e[_0x0e00('0x2d')][_0x0e00('0x1a')]);_0x54f9da[_0x0e00('0x18')]=qs[_0x0e00('0x18')](_0x16116e['query']['offset']);}return _0x98eb41[_0x0e00('0x47')](_0x54f9da);}})[_0x0e00('0x20')](function(_0x3ec40c){if(_0x3ec40c){return _0x3ec40c?{'count':_0x122d54,'rows':_0x3ec40c}:null;}})[_0x0e00('0x20')](respondWithResult(_0x4d99a5,null))['catch'](handleError(_0x4d99a5,null));};exports[_0x0e00('0x4a')]=function(_0x28f524,_0x3df330,_0x3bd523){var _0xee1aff={};var _0x2601d1={};var _0x9be55b;var _0x1641d4;return db['FreshsalesConfiguration'][_0x0e00('0x48')]({'where':{'id':_0x28f524['params']['id']}})['then'](handleEntityNotFound(_0x3df330,null))[_0x0e00('0x20')](function(_0x2d232a){if(_0x2d232a){_0x9be55b=_0x2d232a;_0x2601d1[_0x0e00('0x2c')]=_[_0x0e00('0x2e')](db[_0x0e00('0x49')]['rawAttributes']);_0x2601d1[_0x0e00('0x2d')]=_[_0x0e00('0x2e')](_0x28f524[_0x0e00('0x2d')]);_0x2601d1['filters']=_[_0x0e00('0x43')](_0x2601d1[_0x0e00('0x2c')],_0x2601d1[_0x0e00('0x2d')]);_0xee1aff[_0x0e00('0x30')]=_[_0x0e00('0x43')](_0x2601d1[_0x0e00('0x2c')],qs[_0x0e00('0x2f')](_0x28f524[_0x0e00('0x2d')]['fields']));_0xee1aff[_0x0e00('0x30')]=_0xee1aff[_0x0e00('0x30')]['length']?_0xee1aff['attributes']:_0x2601d1[_0x0e00('0x2c')];_0xee1aff[_0x0e00('0x34')]=qs['sort'](_0x28f524['query'][_0x0e00('0x35')]);_0xee1aff[_0x0e00('0x3c')]=qs[_0x0e00('0x36')](_[_0x0e00('0x37')](_0x28f524[_0x0e00('0x2d')],_0x2601d1[_0x0e00('0x36')]));if(_0x28f524['query'][_0x0e00('0x38')]){_0xee1aff[_0x0e00('0x3c')]=_[_0x0e00('0x39')](_0xee1aff[_0x0e00('0x3c')],{'$or':_[_0x0e00('0x27')](_0xee1aff[_0x0e00('0x30')],function(_0x2ebf8f){var _0x3ff038={};_0x3ff038[_0x2ebf8f]={'$like':'%'+_0x28f524[_0x0e00('0x2d')]['filter']+'%'};return _0x3ff038;})});}_0xee1aff=_[_0x0e00('0x39')]({},_0xee1aff,_0x28f524[_0x0e00('0x3b')]);return _0x9be55b[_0x0e00('0x4a')](_0xee1aff);}})[_0x0e00('0x20')](function(_0x2180fe){if(_0x2180fe){_0x1641d4=_0x2180fe['length'];if(!_0x28f524[_0x0e00('0x2d')]['hasOwnProperty'](_0x0e00('0x33'))){_0xee1aff[_0x0e00('0x1a')]=qs[_0x0e00('0x1a')](_0x28f524['query'][_0x0e00('0x1a')]);_0xee1aff[_0x0e00('0x18')]=qs['offset'](_0x28f524[_0x0e00('0x2d')]['offset']);}return _0x9be55b[_0x0e00('0x4a')](_0xee1aff);}})[_0x0e00('0x20')](function(_0x1c2e57){if(_0x1c2e57){return _0x1c2e57?{'count':_0x1641d4,'rows':_0x1c2e57}:null;}})[_0x0e00('0x20')](respondWithResult(_0x3df330,null))[_0x0e00('0x40')](handleError(_0x3df330,null));};exports[_0x0e00('0x4b')]=function(_0x196a3d,_0x2b3b8f,_0x14d490){var _0x20ce4c={};var _0x3ef57b={};var _0x3cea86;var _0x2691c6;return db[_0x0e00('0x28')]['findOne']({'where':{'id':_0x196a3d[_0x0e00('0x42')]['id']}})[_0x0e00('0x20')](handleEntityNotFound(_0x2b3b8f,null))[_0x0e00('0x20')](function(_0x4e5fb5){if(_0x4e5fb5){_0x3cea86=_0x4e5fb5;_0x3ef57b[_0x0e00('0x2c')]=_[_0x0e00('0x2e')](db[_0x0e00('0x49')][_0x0e00('0x29')]);_0x3ef57b[_0x0e00('0x2d')]=_['keys'](_0x196a3d[_0x0e00('0x2d')]);_0x3ef57b[_0x0e00('0x36')]=_[_0x0e00('0x43')](_0x3ef57b[_0x0e00('0x2c')],_0x3ef57b[_0x0e00('0x2d')]);_0x20ce4c[_0x0e00('0x30')]=_[_0x0e00('0x43')](_0x3ef57b[_0x0e00('0x2c')],qs[_0x0e00('0x2f')](_0x196a3d['query']['fields']));_0x20ce4c[_0x0e00('0x30')]=_0x20ce4c[_0x0e00('0x30')]['length']?_0x20ce4c[_0x0e00('0x30')]:_0x3ef57b[_0x0e00('0x2c')];_0x20ce4c[_0x0e00('0x34')]=qs[_0x0e00('0x35')](_0x196a3d[_0x0e00('0x2d')]['sort']);_0x20ce4c['where']=qs[_0x0e00('0x36')](_[_0x0e00('0x37')](_0x196a3d[_0x0e00('0x2d')],_0x3ef57b[_0x0e00('0x36')]));if(_0x196a3d[_0x0e00('0x2d')][_0x0e00('0x38')]){_0x20ce4c['where']=_[_0x0e00('0x39')](_0x20ce4c[_0x0e00('0x3c')],{'$or':_[_0x0e00('0x27')](_0x20ce4c[_0x0e00('0x30')],function(_0x17ef4c){var _0x569fd7={};_0x569fd7[_0x17ef4c]={'$like':'%'+_0x196a3d['query'][_0x0e00('0x38')]+'%'};return _0x569fd7;})});}_0x20ce4c=_[_0x0e00('0x39')]({},_0x20ce4c,_0x196a3d['options']);return _0x3cea86[_0x0e00('0x4b')](_0x20ce4c);}})[_0x0e00('0x20')](function(_0x1dadfb){if(_0x1dadfb){_0x2691c6=_0x1dadfb[_0x0e00('0x31')];if(!_0x196a3d['query'][_0x0e00('0x32')](_0x0e00('0x33'))){_0x20ce4c[_0x0e00('0x1a')]=qs[_0x0e00('0x1a')](_0x196a3d[_0x0e00('0x2d')][_0x0e00('0x1a')]);_0x20ce4c[_0x0e00('0x18')]=qs[_0x0e00('0x18')](_0x196a3d[_0x0e00('0x2d')][_0x0e00('0x18')]);}return _0x3cea86['getFields'](_0x20ce4c);}})[_0x0e00('0x20')](function(_0x15d79d){if(_0x15d79d){return _0x15d79d?{'count':_0x2691c6,'rows':_0x15d79d}:null;}})[_0x0e00('0x20')](respondWithResult(_0x2b3b8f,null))['catch'](handleError(_0x2b3b8f,null));}; \ No newline at end of file +var _0xe946=['index','map','FreshsalesConfiguration','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','nolimit','order','sort','filters','pick','merge','where','VIRTUAL','filter','includeAll','include','rows','catch','params','length','options','find','create','body','getSubjects','findOne','FreshsalesField','hasOwnProperty','getDescriptions','getFields','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','update','then','destroy','stack','name'];(function(_0x33acb5,_0x1205f6){var _0x4e6e87=function(_0x23d615){while(--_0x23d615){_0x33acb5['push'](_0x33acb5['shift']());}};_0x4e6e87(++_0x1205f6);}(_0xe946,0x18d));var _0x6e94=function(_0x501add,_0x32692a){_0x501add=_0x501add-0x0;var _0x33cfae=_0xe946[_0x501add];return _0x33cfae;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6e94('0x0'));var zipdir=require(_0x6e94('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e94('0x2'));var moment=require(_0x6e94('0x3'));var BPromise=require(_0x6e94('0x4'));var Mustache=require(_0x6e94('0x5'));var util=require('util');var path=require(_0x6e94('0x6'));var sox=require('sox');var csv=require(_0x6e94('0x7'));var ejs=require(_0x6e94('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6e94('0x9'));var squel=require(_0x6e94('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6e94('0xb'));var Papa=require(_0x6e94('0xc'));var Redis=require(_0x6e94('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6e94('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6e94('0xf'))('api');var utils=require(_0x6e94('0x10'));var config=require(_0x6e94('0x11'));var licenseUtil=require(_0x6e94('0x12'));var db=require(_0x6e94('0x13'))['db'];function respondWithStatusCode(_0x16d4c5,_0x1286a6){_0x1286a6=_0x1286a6||0xcc;return function(_0x198225){if(_0x198225){return _0x16d4c5[_0x6e94('0x14')](_0x1286a6);}return _0x16d4c5[_0x6e94('0x15')](_0x1286a6)[_0x6e94('0x16')]();};}function respondWithResult(_0x3a8bc5,_0x2155cc){_0x2155cc=_0x2155cc||0xc8;return function(_0x3f4318){if(_0x3f4318){return _0x3a8bc5[_0x6e94('0x15')](_0x2155cc)[_0x6e94('0x17')](_0x3f4318);}};}function respondWithFilteredResult(_0x4e993c,_0x1862f2){return function(_0x2b7973){if(_0x2b7973){var _0x3ee6e0=typeof _0x1862f2['offset']==='undefined'&&typeof _0x1862f2['limit']==='undefined';var _0x2eea2b=_0x2b7973['count'];var _0x5d79fc=_0x3ee6e0?0x0:_0x1862f2[_0x6e94('0x18')];var _0x43b65c=_0x3ee6e0?_0x2b7973[_0x6e94('0x19')]:_0x1862f2[_0x6e94('0x18')]+_0x1862f2[_0x6e94('0x1a')];var _0x326922;if(_0x43b65c>=_0x2eea2b){_0x43b65c=_0x2eea2b;_0x326922=0xc8;}else{_0x326922=0xce;}_0x4e993c[_0x6e94('0x15')](_0x326922);return _0x4e993c[_0x6e94('0x1b')](_0x6e94('0x1c'),_0x5d79fc+'-'+_0x43b65c+'/'+_0x2eea2b)[_0x6e94('0x17')](_0x2b7973);}return null;};}function patchUpdates(_0x2e3f94){return function(_0x3ab1b5){try{jsonpatch[_0x6e94('0x1d')](_0x3ab1b5,_0x2e3f94,!![]);}catch(_0x1c7dfe){return BPromise['reject'](_0x1c7dfe);}return _0x3ab1b5['save']();};}function saveUpdates(_0x3530e9,_0x5be11a){return function(_0x3cc0a0){if(_0x3cc0a0){return _0x3cc0a0[_0x6e94('0x1e')](_0x3530e9)[_0x6e94('0x1f')](function(_0x2a4dbe){return _0x2a4dbe;});}return null;};}function removeEntity(_0x2a399b,_0x406786){return function(_0x218a5d){if(_0x218a5d){return _0x218a5d[_0x6e94('0x20')]()[_0x6e94('0x1f')](function(){_0x2a399b[_0x6e94('0x15')](0xcc)[_0x6e94('0x16')]();});}};}function handleEntityNotFound(_0x8bb2c7,_0x4ff2e7){return function(_0x2f882f){if(!_0x2f882f){_0x8bb2c7[_0x6e94('0x14')](0x194);}return _0x2f882f;};}function handleError(_0xd29526,_0x16f9ee){_0x16f9ee=_0x16f9ee||0x1f4;return function(_0x122cf8){logger['error'](_0x122cf8[_0x6e94('0x21')]);if(_0x122cf8[_0x6e94('0x22')]){delete _0x122cf8[_0x6e94('0x22')];}_0xd29526[_0x6e94('0x15')](_0x16f9ee)['send'](_0x122cf8);};}exports[_0x6e94('0x23')]=function(_0x27e6da,_0x38b12d){var _0x1cbde5={},_0x1e6776={},_0x3cac79={'count':0x0,'rows':[]};var _0x416cc5=_[_0x6e94('0x24')](db[_0x6e94('0x25')][_0x6e94('0x26')],function(_0x2c4d42){return{'name':_0x2c4d42['fieldName'],'type':_0x2c4d42[_0x6e94('0x27')][_0x6e94('0x28')]};});_0x1e6776['model']=_[_0x6e94('0x24')](_0x416cc5,'name');_0x1e6776[_0x6e94('0x29')]=_[_0x6e94('0x2a')](_0x27e6da[_0x6e94('0x29')]);_0x1e6776['filters']=_[_0x6e94('0x2b')](_0x1e6776[_0x6e94('0x2c')],_0x1e6776['query']);_0x1cbde5['attributes']=_[_0x6e94('0x2b')](_0x1e6776[_0x6e94('0x2c')],qs[_0x6e94('0x2d')](_0x27e6da[_0x6e94('0x29')][_0x6e94('0x2d')]));_0x1cbde5[_0x6e94('0x2e')]=_0x1cbde5[_0x6e94('0x2e')]['length']?_0x1cbde5[_0x6e94('0x2e')]:_0x1e6776[_0x6e94('0x2c')];if(!_0x27e6da['query']['hasOwnProperty'](_0x6e94('0x2f'))){_0x1cbde5[_0x6e94('0x1a')]=qs[_0x6e94('0x1a')](_0x27e6da[_0x6e94('0x29')][_0x6e94('0x1a')]);_0x1cbde5[_0x6e94('0x18')]=qs[_0x6e94('0x18')](_0x27e6da[_0x6e94('0x29')][_0x6e94('0x18')]);}_0x1cbde5[_0x6e94('0x30')]=qs[_0x6e94('0x31')](_0x27e6da[_0x6e94('0x29')][_0x6e94('0x31')]);_0x1cbde5['where']=qs[_0x6e94('0x32')](_[_0x6e94('0x33')](_0x27e6da[_0x6e94('0x29')],_0x1e6776[_0x6e94('0x32')]),_0x416cc5);if(_0x27e6da['query']['filter']){_0x1cbde5['where']=_[_0x6e94('0x34')](_0x1cbde5[_0x6e94('0x35')],{'$or':_[_0x6e94('0x24')](_0x416cc5,function(_0x54c288){if(_0x54c288[_0x6e94('0x27')]!==_0x6e94('0x36')){var _0x3b1934={};_0x3b1934[_0x54c288[_0x6e94('0x22')]]={'$like':'%'+_0x27e6da['query'][_0x6e94('0x37')]+'%'};return _0x3b1934;}})});}_0x1cbde5=_['merge']({},_0x1cbde5,_0x27e6da['options']);var _0x3d4167={'where':_0x1cbde5[_0x6e94('0x35')]};return db[_0x6e94('0x25')][_0x6e94('0x19')](_0x3d4167)[_0x6e94('0x1f')](function(_0x4602ba){_0x3cac79[_0x6e94('0x19')]=_0x4602ba;if(_0x27e6da[_0x6e94('0x29')][_0x6e94('0x38')]){_0x1cbde5[_0x6e94('0x39')]=[{'all':!![]}];}return db[_0x6e94('0x25')]['findAll'](_0x1cbde5);})['then'](function(_0x1c1160){_0x3cac79[_0x6e94('0x3a')]=_0x1c1160;return _0x3cac79;})[_0x6e94('0x1f')](respondWithFilteredResult(_0x38b12d,_0x1cbde5))[_0x6e94('0x3b')](handleError(_0x38b12d,null));};exports['show']=function(_0x4aea00,_0x42070e){var _0x4ac7cd={'raw':![],'where':{'id':_0x4aea00[_0x6e94('0x3c')]['id']}},_0x31c717={};_0x31c717[_0x6e94('0x2c')]=_[_0x6e94('0x2a')](db[_0x6e94('0x25')][_0x6e94('0x26')]);_0x31c717['query']=_[_0x6e94('0x2a')](_0x4aea00[_0x6e94('0x29')]);_0x31c717['filters']=_['intersection'](_0x31c717['model'],_0x31c717['query']);_0x4ac7cd[_0x6e94('0x2e')]=_[_0x6e94('0x2b')](_0x31c717[_0x6e94('0x2c')],qs[_0x6e94('0x2d')](_0x4aea00[_0x6e94('0x29')]['fields']));_0x4ac7cd['attributes']=_0x4ac7cd['attributes'][_0x6e94('0x3d')]?_0x4ac7cd['attributes']:_0x31c717[_0x6e94('0x2c')];if(_0x4aea00[_0x6e94('0x29')]['includeAll']){_0x4ac7cd['include']=[{'all':!![]}];}_0x4ac7cd=_[_0x6e94('0x34')]({},_0x4ac7cd,_0x4aea00[_0x6e94('0x3e')]);return db[_0x6e94('0x25')][_0x6e94('0x3f')](_0x4ac7cd)['then'](handleEntityNotFound(_0x42070e,null))['then'](respondWithResult(_0x42070e,null))[_0x6e94('0x3b')](handleError(_0x42070e,null));};exports[_0x6e94('0x40')]=function(_0x1a1006,_0xcd7cab){return db[_0x6e94('0x25')][_0x6e94('0x40')](_0x1a1006[_0x6e94('0x41')],{})[_0x6e94('0x1f')](respondWithResult(_0xcd7cab,0xc9))['catch'](handleError(_0xcd7cab,null));};exports[_0x6e94('0x1e')]=function(_0x3258b5,_0x23234e){if(_0x3258b5[_0x6e94('0x41')]['id']){delete _0x3258b5['body']['id'];}return db[_0x6e94('0x25')][_0x6e94('0x3f')]({'where':{'id':_0x3258b5[_0x6e94('0x3c')]['id']}})[_0x6e94('0x1f')](handleEntityNotFound(_0x23234e,null))['then'](saveUpdates(_0x3258b5[_0x6e94('0x41')],null))['then'](respondWithResult(_0x23234e,null))[_0x6e94('0x3b')](handleError(_0x23234e,null));};exports[_0x6e94('0x20')]=function(_0x2a2a7a,_0x5eef56){return db[_0x6e94('0x25')][_0x6e94('0x3f')]({'where':{'id':_0x2a2a7a[_0x6e94('0x3c')]['id']}})[_0x6e94('0x1f')](handleEntityNotFound(_0x5eef56,null))[_0x6e94('0x1f')](removeEntity(_0x5eef56,null))[_0x6e94('0x3b')](handleError(_0x5eef56,null));};exports[_0x6e94('0x42')]=function(_0x235938,_0x2717e2,_0xdb0689){var _0x22326e={};var _0x5497d6={};var _0x5b105d;var _0x30de8e;return db[_0x6e94('0x25')][_0x6e94('0x43')]({'where':{'id':_0x235938[_0x6e94('0x3c')]['id']}})[_0x6e94('0x1f')](handleEntityNotFound(_0x2717e2,null))[_0x6e94('0x1f')](function(_0x512cc6){if(_0x512cc6){_0x5b105d=_0x512cc6;_0x5497d6[_0x6e94('0x2c')]=_[_0x6e94('0x2a')](db[_0x6e94('0x44')][_0x6e94('0x26')]);_0x5497d6[_0x6e94('0x29')]=_[_0x6e94('0x2a')](_0x235938[_0x6e94('0x29')]);_0x5497d6[_0x6e94('0x32')]=_[_0x6e94('0x2b')](_0x5497d6['model'],_0x5497d6[_0x6e94('0x29')]);_0x22326e['attributes']=_[_0x6e94('0x2b')](_0x5497d6[_0x6e94('0x2c')],qs[_0x6e94('0x2d')](_0x235938[_0x6e94('0x29')]['fields']));_0x22326e[_0x6e94('0x2e')]=_0x22326e[_0x6e94('0x2e')]['length']?_0x22326e[_0x6e94('0x2e')]:_0x5497d6[_0x6e94('0x2c')];_0x22326e[_0x6e94('0x30')]=qs['sort'](_0x235938[_0x6e94('0x29')]['sort']);_0x22326e[_0x6e94('0x35')]=qs[_0x6e94('0x32')](_[_0x6e94('0x33')](_0x235938[_0x6e94('0x29')],_0x5497d6[_0x6e94('0x32')]));if(_0x235938[_0x6e94('0x29')][_0x6e94('0x37')]){_0x22326e[_0x6e94('0x35')]=_[_0x6e94('0x34')](_0x22326e[_0x6e94('0x35')],{'$or':_[_0x6e94('0x24')](_0x22326e[_0x6e94('0x2e')],function(_0x365cf3){var _0x165ca9={};_0x165ca9[_0x365cf3]={'$like':'%'+_0x235938[_0x6e94('0x29')]['filter']+'%'};return _0x165ca9;})});}_0x22326e=_[_0x6e94('0x34')]({},_0x22326e,_0x235938[_0x6e94('0x3e')]);return _0x5b105d[_0x6e94('0x42')](_0x22326e);}})[_0x6e94('0x1f')](function(_0x41e5c4){if(_0x41e5c4){_0x30de8e=_0x41e5c4[_0x6e94('0x3d')];if(!_0x235938[_0x6e94('0x29')][_0x6e94('0x45')](_0x6e94('0x2f'))){_0x22326e[_0x6e94('0x1a')]=qs[_0x6e94('0x1a')](_0x235938['query'][_0x6e94('0x1a')]);_0x22326e[_0x6e94('0x18')]=qs['offset'](_0x235938[_0x6e94('0x29')][_0x6e94('0x18')]);}return _0x5b105d[_0x6e94('0x42')](_0x22326e);}})['then'](function(_0x7f3d3b){if(_0x7f3d3b){return _0x7f3d3b?{'count':_0x30de8e,'rows':_0x7f3d3b}:null;}})[_0x6e94('0x1f')](respondWithResult(_0x2717e2,null))[_0x6e94('0x3b')](handleError(_0x2717e2,null));};exports[_0x6e94('0x46')]=function(_0xff7b48,_0x54320e,_0x482ca4){var _0x2f9e55={};var _0x4ae684={};var _0x5f4319;var _0x2ef526;return db[_0x6e94('0x25')]['findOne']({'where':{'id':_0xff7b48[_0x6e94('0x3c')]['id']}})[_0x6e94('0x1f')](handleEntityNotFound(_0x54320e,null))[_0x6e94('0x1f')](function(_0x55d1ce){if(_0x55d1ce){_0x5f4319=_0x55d1ce;_0x4ae684[_0x6e94('0x2c')]=_[_0x6e94('0x2a')](db[_0x6e94('0x44')][_0x6e94('0x26')]);_0x4ae684['query']=_['keys'](_0xff7b48[_0x6e94('0x29')]);_0x4ae684[_0x6e94('0x32')]=_[_0x6e94('0x2b')](_0x4ae684[_0x6e94('0x2c')],_0x4ae684['query']);_0x2f9e55[_0x6e94('0x2e')]=_[_0x6e94('0x2b')](_0x4ae684[_0x6e94('0x2c')],qs['fields'](_0xff7b48['query'][_0x6e94('0x2d')]));_0x2f9e55[_0x6e94('0x2e')]=_0x2f9e55[_0x6e94('0x2e')]['length']?_0x2f9e55[_0x6e94('0x2e')]:_0x4ae684['model'];_0x2f9e55['order']=qs[_0x6e94('0x31')](_0xff7b48[_0x6e94('0x29')]['sort']);_0x2f9e55[_0x6e94('0x35')]=qs[_0x6e94('0x32')](_[_0x6e94('0x33')](_0xff7b48[_0x6e94('0x29')],_0x4ae684[_0x6e94('0x32')]));if(_0xff7b48[_0x6e94('0x29')][_0x6e94('0x37')]){_0x2f9e55[_0x6e94('0x35')]=_[_0x6e94('0x34')](_0x2f9e55['where'],{'$or':_['map'](_0x2f9e55[_0x6e94('0x2e')],function(_0x53c4a1){var _0x658205={};_0x658205[_0x53c4a1]={'$like':'%'+_0xff7b48['query']['filter']+'%'};return _0x658205;})});}_0x2f9e55=_[_0x6e94('0x34')]({},_0x2f9e55,_0xff7b48[_0x6e94('0x3e')]);return _0x5f4319[_0x6e94('0x46')](_0x2f9e55);}})['then'](function(_0x5614a6){if(_0x5614a6){_0x2ef526=_0x5614a6[_0x6e94('0x3d')];if(!_0xff7b48['query'][_0x6e94('0x45')](_0x6e94('0x2f'))){_0x2f9e55[_0x6e94('0x1a')]=qs['limit'](_0xff7b48[_0x6e94('0x29')][_0x6e94('0x1a')]);_0x2f9e55[_0x6e94('0x18')]=qs[_0x6e94('0x18')](_0xff7b48[_0x6e94('0x29')][_0x6e94('0x18')]);}return _0x5f4319['getDescriptions'](_0x2f9e55);}})['then'](function(_0x2d5abc){if(_0x2d5abc){return _0x2d5abc?{'count':_0x2ef526,'rows':_0x2d5abc}:null;}})[_0x6e94('0x1f')](respondWithResult(_0x54320e,null))[_0x6e94('0x3b')](handleError(_0x54320e,null));};exports['getFields']=function(_0x44ada8,_0x5e296c,_0x3ea332){var _0x58c2f0={};var _0x7104ce={};var _0x3659b8;var _0x3df065;return db[_0x6e94('0x25')]['findOne']({'where':{'id':_0x44ada8['params']['id']}})[_0x6e94('0x1f')](handleEntityNotFound(_0x5e296c,null))[_0x6e94('0x1f')](function(_0x565f48){if(_0x565f48){_0x3659b8=_0x565f48;_0x7104ce['model']=_[_0x6e94('0x2a')](db[_0x6e94('0x44')][_0x6e94('0x26')]);_0x7104ce[_0x6e94('0x29')]=_['keys'](_0x44ada8[_0x6e94('0x29')]);_0x7104ce[_0x6e94('0x32')]=_[_0x6e94('0x2b')](_0x7104ce[_0x6e94('0x2c')],_0x7104ce[_0x6e94('0x29')]);_0x58c2f0[_0x6e94('0x2e')]=_[_0x6e94('0x2b')](_0x7104ce[_0x6e94('0x2c')],qs[_0x6e94('0x2d')](_0x44ada8[_0x6e94('0x29')][_0x6e94('0x2d')]));_0x58c2f0[_0x6e94('0x2e')]=_0x58c2f0[_0x6e94('0x2e')][_0x6e94('0x3d')]?_0x58c2f0['attributes']:_0x7104ce[_0x6e94('0x2c')];_0x58c2f0[_0x6e94('0x30')]=qs[_0x6e94('0x31')](_0x44ada8[_0x6e94('0x29')][_0x6e94('0x31')]);_0x58c2f0[_0x6e94('0x35')]=qs[_0x6e94('0x32')](_['pick'](_0x44ada8[_0x6e94('0x29')],_0x7104ce[_0x6e94('0x32')]));if(_0x44ada8[_0x6e94('0x29')][_0x6e94('0x37')]){_0x58c2f0[_0x6e94('0x35')]=_['merge'](_0x58c2f0[_0x6e94('0x35')],{'$or':_[_0x6e94('0x24')](_0x58c2f0[_0x6e94('0x2e')],function(_0xfb5b7c){var _0xe8e555={};_0xe8e555[_0xfb5b7c]={'$like':'%'+_0x44ada8[_0x6e94('0x29')]['filter']+'%'};return _0xe8e555;})});}_0x58c2f0=_[_0x6e94('0x34')]({},_0x58c2f0,_0x44ada8[_0x6e94('0x3e')]);return _0x3659b8[_0x6e94('0x47')](_0x58c2f0);}})[_0x6e94('0x1f')](function(_0x47ef1c){if(_0x47ef1c){_0x3df065=_0x47ef1c[_0x6e94('0x3d')];if(!_0x44ada8[_0x6e94('0x29')]['hasOwnProperty'](_0x6e94('0x2f'))){_0x58c2f0[_0x6e94('0x1a')]=qs['limit'](_0x44ada8['query'][_0x6e94('0x1a')]);_0x58c2f0[_0x6e94('0x18')]=qs[_0x6e94('0x18')](_0x44ada8[_0x6e94('0x29')][_0x6e94('0x18')]);}return _0x3659b8['getFields'](_0x58c2f0);}})[_0x6e94('0x1f')](function(_0x402a57){if(_0x402a57){return _0x402a57?{'count':_0x3df065,'rows':_0x402a57}:null;}})[_0x6e94('0x1f')](respondWithResult(_0x5e296c,null))[_0x6e94('0x3b')](handleError(_0x5e296c,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index b34f81b..5c6a1e4 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 _0x7827=['bluebird','request-promise','rimraf','../../config/environment','exports','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger'];(function(_0x42121d,_0x1c31ab){var _0x2d6fde=function(_0x347a95){while(--_0x347a95){_0x42121d['push'](_0x42121d['shift']());}};_0x2d6fde(++_0x1c31ab);}(_0x7827,0x197));var _0x7782=function(_0x58a18a,_0x1d948a){_0x58a18a=_0x58a18a-0x0;var _0x504330=_0x7827[_0x58a18a];return _0x504330;};'use strict';var _=require(_0x7782('0x0'));var util=require(_0x7782('0x1'));var logger=require(_0x7782('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7782('0x3'));var rp=require(_0x7782('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7782('0x5'));var config=require(_0x7782('0x6'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x7782('0x7')]=function(_0x1f76bc,_0x582220){return _0x1f76bc['define'](_0x7782('0x8'),attributes,{'tableName':_0x7782('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4590=['int_freshsales_configurations','util','../../config/logger','moment','request-promise','../../config/environment','define','FreshsalesConfiguration'];(function(_0x36a469,_0x59d84c){var _0x3347fc=function(_0x3860e7){while(--_0x3860e7){_0x36a469['push'](_0x36a469['shift']());}};_0x3347fc(++_0x59d84c);}(_0x4590,0x1e9));var _0x0459=function(_0x480e55,_0x4162a1){_0x480e55=_0x480e55-0x0;var _0x10cc3e=_0x4590[_0x480e55];return _0x10cc3e;};'use strict';var _=require('lodash');var util=require(_0x0459('0x0'));var logger=require(_0x0459('0x1'))('api');var moment=require(_0x0459('0x2'));var BPromise=require('bluebird');var rp=require(_0x0459('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0459('0x4'));var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x3242ca,_0xdbc37d){return _0x3242ca[_0x0459('0x5')](_0x0459('0x6'),attributes,{'tableName':_0x0459('0x7'),'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 53ff5d9..63cec95 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 _0xc4f8=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x59f0dc,_0x1e2497){var _0x5b5445=function(_0x57ca91){while(--_0x57ca91){_0x59f0dc['push'](_0x59f0dc['shift']());}};_0x5b5445(++_0x1e2497);}(_0xc4f8,0x7c));var _0x8c4f=function(_0x48703d,_0x1ca448){_0x48703d=_0x48703d-0x0;var _0x20c0ad=_0xc4f8[_0x48703d];return _0x20c0ad;};'use strict';var _=require(_0x8c4f('0x0'));var util=require(_0x8c4f('0x1'));var moment=require(_0x8c4f('0x2'));var BPromise=require(_0x8c4f('0x3'));var rs=require(_0x8c4f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c4f('0x5'))['db'];var utils=require(_0x8c4f('0x6'));var logger=require(_0x8c4f('0x7'))(_0x8c4f('0x8'));var config=require('../../config/environment');var jayson=require(_0x8c4f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3bdcbe,_0x486232,_0x737338){return new BPromise(function(_0x5adb6c,_0x4c6bea){return client[_0x8c4f('0xa')](_0x3bdcbe,_0x737338)['then'](function(_0x1a0df7){logger[_0x8c4f('0xb')](_0x8c4f('0xc'),_0x486232,_0x8c4f('0xd'));logger['debug'](_0x8c4f('0xe'),_0x486232,_0x8c4f('0xd'),JSON[_0x8c4f('0xf')](_0x1a0df7));if(_0x1a0df7[_0x8c4f('0x10')]){if(_0x1a0df7[_0x8c4f('0x10')][_0x8c4f('0x11')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x486232,_0x1a0df7['error']['message']);return _0x4c6bea(_0x1a0df7[_0x8c4f('0x10')][_0x8c4f('0x12')]);}logger[_0x8c4f('0x10')](_0x8c4f('0xc'),_0x486232,_0x1a0df7[_0x8c4f('0x10')]['message']);return _0x5adb6c(_0x1a0df7[_0x8c4f('0x10')][_0x8c4f('0x12')]);}else{logger[_0x8c4f('0xb')](_0x8c4f('0xc'),_0x486232,_0x8c4f('0xd'));_0x5adb6c(_0x1a0df7[_0x8c4f('0x13')][_0x8c4f('0x12')]);}})[_0x8c4f('0x14')](function(_0xce4c1){logger[_0x8c4f('0x10')](_0x8c4f('0xc'),_0x486232,_0xce4c1);_0x4c6bea(_0xce4c1);});});} \ No newline at end of file +var _0x4f9b=['request\x20sent','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x4f9b,0x177));var _0xb4f9=function(_0x4f8e71,_0x38be16){_0x4f8e71=_0x4f8e71-0x0;var _0x6ae113=_0x4f9b[_0x4f8e71];return _0x6ae113;};'use strict';var _=require(_0xb4f9('0x0'));var util=require(_0xb4f9('0x1'));var moment=require(_0xb4f9('0x2'));var BPromise=require(_0xb4f9('0x3'));var rs=require(_0xb4f9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb4f9('0x5'));var logger=require('../../config/logger')(_0xb4f9('0x6'));var config=require(_0xb4f9('0x7'));var jayson=require(_0xb4f9('0x8'));var client=jayson[_0xb4f9('0x9')][_0xb4f9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2225e1,_0x34c6a8,_0x3c9d4f){return new BPromise(function(_0x65627d,_0x57a16b){return client[_0xb4f9('0xb')](_0x2225e1,_0x3c9d4f)['then'](function(_0x19b0a5){logger[_0xb4f9('0xc')](_0xb4f9('0xd'),_0x34c6a8,'request\x20sent');logger[_0xb4f9('0xe')](_0xb4f9('0xf'),_0x34c6a8,_0xb4f9('0x10'),JSON[_0xb4f9('0x11')](_0x19b0a5));if(_0x19b0a5['error']){if(_0x19b0a5['error'][_0xb4f9('0x12')]===0x1f4){logger[_0xb4f9('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x34c6a8,_0x19b0a5[_0xb4f9('0x13')]['message']);return _0x57a16b(_0x19b0a5[_0xb4f9('0x13')][_0xb4f9('0x14')]);}logger['error'](_0xb4f9('0xd'),_0x34c6a8,_0x19b0a5[_0xb4f9('0x13')][_0xb4f9('0x14')]);return _0x65627d(_0x19b0a5[_0xb4f9('0x13')][_0xb4f9('0x14')]);}else{logger[_0xb4f9('0xc')](_0xb4f9('0xd'),_0x34c6a8,'request\x20sent');_0x65627d(_0x19b0a5[_0xb4f9('0x15')][_0xb4f9('0x14')]);}})[_0xb4f9('0x16')](function(_0x2b4a54){logger[_0xb4f9('0x13')](_0xb4f9('0xd'),_0x34c6a8,_0x2b4a54);_0x57a16b(_0x2b4a54);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index a8c8f9f..16008fe 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 _0xe205=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','get','isAuthenticated','index','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x38c6f4,_0x1463ed){var _0x4919e9=function(_0x425e10){while(--_0x425e10){_0x38c6f4['push'](_0x38c6f4['shift']());}};_0x4919e9(++_0x1463ed);}(_0xe205,0xa7));var _0x5e20=function(_0x3580d0,_0x4eb891){_0x3580d0=_0x3580d0-0x0;var _0x3646d4=_0xe205[_0x3580d0];return _0x3646d4;};'use strict';var multer=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var path=require(_0x5e20('0x2'));var timeout=require(_0x5e20('0x3'));var express=require(_0x5e20('0x4'));var router=express[_0x5e20('0x5')]();var fs_extra=require(_0x5e20('0x6'));var auth=require(_0x5e20('0x7'));var interaction=require(_0x5e20('0x8'));var config=require('../../config/environment');var controller=require(_0x5e20('0x9'));router[_0x5e20('0xa')]('/',auth[_0x5e20('0xb')](),controller[_0x5e20('0xc')]);router['get']('/:id',auth[_0x5e20('0xb')](),controller['show']);router['post']('/',auth[_0x5e20('0xb')](),controller[_0x5e20('0xd')]);router['put'](_0x5e20('0xe'),auth[_0x5e20('0xb')](),controller[_0x5e20('0xf')]);router[_0x5e20('0x10')]('/:id',auth[_0x5e20('0xb')](),controller[_0x5e20('0x11')]);module[_0x5e20('0x12')]=router; \ No newline at end of file +var _0x8cfd=['post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','show'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8cfd,0xe4));var _0xd8cf=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x8cfd[_0x29d915];return _0x160f86;};'use strict';var multer=require(_0xd8cf('0x0'));var util=require(_0xd8cf('0x1'));var path=require(_0xd8cf('0x2'));var timeout=require(_0xd8cf('0x3'));var express=require(_0xd8cf('0x4'));var router=express[_0xd8cf('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd8cf('0x6'));var interaction=require(_0xd8cf('0x7'));var config=require(_0xd8cf('0x8'));var controller=require(_0xd8cf('0x9'));router[_0xd8cf('0xa')]('/',auth[_0xd8cf('0xb')](),controller[_0xd8cf('0xc')]);router['get']('/:id',auth[_0xd8cf('0xb')](),controller[_0xd8cf('0xd')]);router[_0xd8cf('0xe')]('/',auth[_0xd8cf('0xb')](),controller[_0xd8cf('0xf')]);router[_0xd8cf('0x10')]('/:id',auth[_0xd8cf('0xb')](),controller[_0xd8cf('0x11')]);router[_0xd8cf('0x12')](_0xd8cf('0x13'),auth[_0xd8cf('0xb')](),controller[_0xd8cf('0x14')]);module[_0xd8cf('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index a432944..47cf9e3 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 _0x5254=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x5d8c78,_0x25783a){var _0x4df4f1=function(_0x1b0090){while(--_0x1b0090){_0x5d8c78['push'](_0x5d8c78['shift']());}};_0x4df4f1(++_0x25783a);}(_0x5254,0x19c));var _0x4525=function(_0x1819f2,_0x5e4c56){_0x1819f2=_0x1819f2-0x0;var _0x4f9a84=_0x5254[_0x1819f2];return _0x4f9a84;};'use strict';var Sequelize=require(_0x4525('0x0'));module['exports']={'type':{'type':Sequelize[_0x4525('0x1')](_0x4525('0x2'),_0x4525('0x3'),_0x4525('0x4'),_0x4525('0x5'),_0x4525('0x6')),'defaultValue':_0x4525('0x2')},'content':{'type':Sequelize[_0x4525('0x7')]},'key':{'type':Sequelize[_0x4525('0x7')]},'keyType':{'type':Sequelize[_0x4525('0x1')](_0x4525('0x2'),_0x4525('0x3'),_0x4525('0x4'))},'keyContent':{'type':Sequelize[_0x4525('0x7')]},'idField':{'type':Sequelize[_0x4525('0x7')]},'nameField':{'type':Sequelize[_0x4525('0x7')]},'customField':{'type':Sequelize[_0x4525('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4525('0x7')]}}; \ No newline at end of file +var _0x5602=['variable','customVariable','keyValue','string','STRING','ENUM','sequelize','exports'];(function(_0x5d60ae,_0x53fa46){var _0x3cbb30=function(_0x162208){while(--_0x162208){_0x5d60ae['push'](_0x5d60ae['shift']());}};_0x3cbb30(++_0x53fa46);}(_0x5602,0x1ce));var _0x2560=function(_0x48bae0,_0x562dc2){_0x48bae0=_0x48bae0-0x0;var _0x10f582=_0x5602[_0x48bae0];return _0x10f582;};'use strict';var Sequelize=require(_0x2560('0x0'));module[_0x2560('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x2560('0x2'),_0x2560('0x3'),_0x2560('0x4'),'picklist'),'defaultValue':_0x2560('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2560('0x6')]},'keyType':{'type':Sequelize[_0x2560('0x7')](_0x2560('0x5'),_0x2560('0x2'),_0x2560('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2560('0x6')]},'nameField':{'type':Sequelize[_0x2560('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 1086887..cf9f7db 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 _0xbd9b=['update','destroy','then','stack','name','send','map','FreshsalesField','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','filter','merge','where','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','eml-format','rimraf','request-promise','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','reject','save'];(function(_0x38f9bb,_0x565c47){var _0x169ba5=function(_0xffab2e){while(--_0xffab2e){_0x38f9bb['push'](_0x38f9bb['shift']());}};_0x169ba5(++_0x565c47);}(_0xbd9b,0xe1));var _0xbbd9=function(_0x208790,_0x5b82db){_0x208790=_0x208790-0x0;var _0x2597c7=_0xbd9b[_0x208790];return _0x2597c7;};'use strict';var emlformat=require(_0xbbd9('0x0'));var rimraf=require(_0xbbd9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbbd9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbbd9('0x3'));var util=require(_0xbbd9('0x4'));var path=require(_0xbbd9('0x5'));var sox=require('sox');var csv=require(_0xbbd9('0x6'));var ejs=require(_0xbbd9('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbbd9('0x8'));var squel=require(_0xbbd9('0x9'));var crypto=require(_0xbbd9('0xa'));var jsforce=require(_0xbbd9('0xb'));var deskjs=require(_0xbbd9('0xc'));var toCsv=require(_0xbbd9('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbbd9('0xd'));var qs=require(_0xbbd9('0xe'));var as=require(_0xbbd9('0xf'));var hardwareService=require(_0xbbd9('0x10'));var logger=require(_0xbbd9('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbbd9('0x12'));var db=require(_0xbbd9('0x13'))['db'];function respondWithStatusCode(_0x15b7d7,_0xd91807){_0xd91807=_0xd91807||0xcc;return function(_0x50c5d5){if(_0x50c5d5){return _0x15b7d7[_0xbbd9('0x14')](_0xd91807);}return _0x15b7d7['status'](_0xd91807)[_0xbbd9('0x15')]();};}function respondWithResult(_0x16e56b,_0x2960e8){_0x2960e8=_0x2960e8||0xc8;return function(_0x8c38c0){if(_0x8c38c0){return _0x16e56b['status'](_0x2960e8)[_0xbbd9('0x16')](_0x8c38c0);}};}function respondWithFilteredResult(_0x387583,_0x2c0b8c){return function(_0x154f95){if(_0x154f95){var _0x52c332=typeof _0x2c0b8c[_0xbbd9('0x17')]===_0xbbd9('0x18')&&typeof _0x2c0b8c[_0xbbd9('0x19')]===_0xbbd9('0x18');var _0x484d9e=_0x154f95[_0xbbd9('0x1a')];var _0xa22ba1=_0x52c332?0x0:_0x2c0b8c[_0xbbd9('0x17')];var _0x164c88=_0x52c332?_0x154f95[_0xbbd9('0x1a')]:_0x2c0b8c['offset']+_0x2c0b8c[_0xbbd9('0x19')];var _0x4e7f8c;if(_0x164c88>=_0x484d9e){_0x164c88=_0x484d9e;_0x4e7f8c=0xc8;}else{_0x4e7f8c=0xce;}_0x387583[_0xbbd9('0x1b')](_0x4e7f8c);return _0x387583['set'](_0xbbd9('0x1c'),_0xa22ba1+'-'+_0x164c88+'/'+_0x484d9e)[_0xbbd9('0x16')](_0x154f95);}return null;};}function patchUpdates(_0x3f36bb){return function(_0x6bf28a){try{jsonpatch['apply'](_0x6bf28a,_0x3f36bb,!![]);}catch(_0x5d9451){return BPromise[_0xbbd9('0x1d')](_0x5d9451);}return _0x6bf28a[_0xbbd9('0x1e')]();};}function saveUpdates(_0x447d90,_0x277e92){return function(_0x422019){if(_0x422019){return _0x422019[_0xbbd9('0x1f')](_0x447d90)['then'](function(_0x51ad66){return _0x51ad66;});}return null;};}function removeEntity(_0x230a55,_0x2ec427){return function(_0x22037a){if(_0x22037a){return _0x22037a[_0xbbd9('0x20')]()[_0xbbd9('0x21')](function(){_0x230a55[_0xbbd9('0x1b')](0xcc)[_0xbbd9('0x15')]();});}};}function handleEntityNotFound(_0x78d4ad,_0x554dc0){return function(_0x37695b){if(!_0x37695b){_0x78d4ad[_0xbbd9('0x14')](0x194);}return _0x37695b;};}function handleError(_0x7ff295,_0x40eeb8){_0x40eeb8=_0x40eeb8||0x1f4;return function(_0x1d1985){logger['error'](_0x1d1985[_0xbbd9('0x22')]);if(_0x1d1985[_0xbbd9('0x23')]){delete _0x1d1985['name'];}_0x7ff295[_0xbbd9('0x1b')](_0x40eeb8)[_0xbbd9('0x24')](_0x1d1985);};}exports['index']=function(_0x9a6139,_0x204eed){var _0x5f254f={},_0x52b6ad={},_0x43ba70={'count':0x0,'rows':[]};var _0x1bfc10=_[_0xbbd9('0x25')](db[_0xbbd9('0x26')]['rawAttributes'],function(_0x6c0cfa){return{'name':_0x6c0cfa['fieldName'],'type':_0x6c0cfa[_0xbbd9('0x27')]['key']};});_0x52b6ad[_0xbbd9('0x28')]=_[_0xbbd9('0x25')](_0x1bfc10,_0xbbd9('0x23'));_0x52b6ad[_0xbbd9('0x29')]=_[_0xbbd9('0x2a')](_0x9a6139[_0xbbd9('0x29')]);_0x52b6ad[_0xbbd9('0x2b')]=_['intersection'](_0x52b6ad[_0xbbd9('0x28')],_0x52b6ad[_0xbbd9('0x29')]);_0x5f254f[_0xbbd9('0x2c')]=_[_0xbbd9('0x2d')](_0x52b6ad[_0xbbd9('0x28')],qs[_0xbbd9('0x2e')](_0x9a6139[_0xbbd9('0x29')]['fields']));_0x5f254f[_0xbbd9('0x2c')]=_0x5f254f['attributes'][_0xbbd9('0x2f')]?_0x5f254f[_0xbbd9('0x2c')]:_0x52b6ad[_0xbbd9('0x28')];if(!_0x9a6139['query']['hasOwnProperty'](_0xbbd9('0x30'))){_0x5f254f[_0xbbd9('0x19')]=qs[_0xbbd9('0x19')](_0x9a6139[_0xbbd9('0x29')]['limit']);_0x5f254f['offset']=qs[_0xbbd9('0x17')](_0x9a6139[_0xbbd9('0x29')][_0xbbd9('0x17')]);}_0x5f254f['order']=qs[_0xbbd9('0x31')](_0x9a6139[_0xbbd9('0x29')][_0xbbd9('0x31')]);_0x5f254f['where']=qs['filters'](_['pick'](_0x9a6139[_0xbbd9('0x29')],_0x52b6ad[_0xbbd9('0x2b')]),_0x1bfc10);if(_0x9a6139[_0xbbd9('0x29')][_0xbbd9('0x32')]){_0x5f254f['where']=_[_0xbbd9('0x33')](_0x5f254f[_0xbbd9('0x34')],{'$or':_[_0xbbd9('0x25')](_0x1bfc10,function(_0x471613){if(_0x471613[_0xbbd9('0x27')]!==_0xbbd9('0x35')){var _0x5a7a97={};_0x5a7a97[_0x471613[_0xbbd9('0x23')]]={'$like':'%'+_0x9a6139[_0xbbd9('0x29')]['filter']+'%'};return _0x5a7a97;}})});}_0x5f254f=_['merge']({},_0x5f254f,_0x9a6139['options']);var _0x4665e7={'where':_0x5f254f[_0xbbd9('0x34')]};return db[_0xbbd9('0x26')][_0xbbd9('0x1a')](_0x4665e7)[_0xbbd9('0x21')](function(_0x2527a9){_0x43ba70['count']=_0x2527a9;if(_0x9a6139[_0xbbd9('0x29')][_0xbbd9('0x36')]){_0x5f254f[_0xbbd9('0x37')]=[{'all':!![]}];}return db[_0xbbd9('0x26')]['findAll'](_0x5f254f);})[_0xbbd9('0x21')](function(_0x33a0b2){_0x43ba70[_0xbbd9('0x38')]=_0x33a0b2;return _0x43ba70;})[_0xbbd9('0x21')](respondWithFilteredResult(_0x204eed,_0x5f254f))[_0xbbd9('0x39')](handleError(_0x204eed,null));};exports[_0xbbd9('0x3a')]=function(_0x58f11f,_0x559e04){var _0x28662={'raw':!![],'where':{'id':_0x58f11f[_0xbbd9('0x3b')]['id']}},_0x235772={};_0x235772[_0xbbd9('0x28')]=_[_0xbbd9('0x2a')](db[_0xbbd9('0x26')]['rawAttributes']);_0x235772[_0xbbd9('0x29')]=_[_0xbbd9('0x2a')](_0x58f11f[_0xbbd9('0x29')]);_0x235772[_0xbbd9('0x2b')]=_[_0xbbd9('0x2d')](_0x235772[_0xbbd9('0x28')],_0x235772[_0xbbd9('0x29')]);_0x28662[_0xbbd9('0x2c')]=_[_0xbbd9('0x2d')](_0x235772[_0xbbd9('0x28')],qs[_0xbbd9('0x2e')](_0x58f11f['query']['fields']));_0x28662[_0xbbd9('0x2c')]=_0x28662[_0xbbd9('0x2c')][_0xbbd9('0x2f')]?_0x28662['attributes']:_0x235772[_0xbbd9('0x28')];if(_0x58f11f[_0xbbd9('0x29')][_0xbbd9('0x36')]){_0x28662[_0xbbd9('0x37')]=[{'all':!![]}];}_0x28662=_[_0xbbd9('0x33')]({},_0x28662,_0x58f11f[_0xbbd9('0x3c')]);return db[_0xbbd9('0x26')][_0xbbd9('0x3d')](_0x28662)['then'](handleEntityNotFound(_0x559e04,null))['then'](respondWithResult(_0x559e04,null))[_0xbbd9('0x39')](handleError(_0x559e04,null));};exports[_0xbbd9('0x3e')]=function(_0xd223,_0x27921e){return db[_0xbbd9('0x26')][_0xbbd9('0x3e')](_0xd223[_0xbbd9('0x3f')],{})[_0xbbd9('0x21')](respondWithResult(_0x27921e,0xc9))['catch'](handleError(_0x27921e,null));};exports['update']=function(_0x5f0bef,_0x275d38){if(_0x5f0bef['body']['id']){delete _0x5f0bef['body']['id'];}return db[_0xbbd9('0x26')][_0xbbd9('0x3d')]({'where':{'id':_0x5f0bef['params']['id']}})[_0xbbd9('0x21')](handleEntityNotFound(_0x275d38,null))['then'](saveUpdates(_0x5f0bef['body'],null))[_0xbbd9('0x21')](respondWithResult(_0x275d38,null))[_0xbbd9('0x39')](handleError(_0x275d38,null));};exports['destroy']=function(_0x2e8f32,_0x201cca){return db[_0xbbd9('0x26')]['find']({'where':{'id':_0x2e8f32[_0xbbd9('0x3b')]['id']}})[_0xbbd9('0x21')](handleEntityNotFound(_0x201cca,null))[_0xbbd9('0x21')](removeEntity(_0x201cca,null))['catch'](handleError(_0x201cca,null));}; \ No newline at end of file +var _0x42e0=['create','body','find','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','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/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','error','stack','name','send','index','FreshsalesField','rawAttributes','fieldName','type','key','map','intersection','query','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys'];(function(_0x44216d,_0x4938a7){var _0xeca523=function(_0x11faf1){while(--_0x11faf1){_0x44216d['push'](_0x44216d['shift']());}};_0xeca523(++_0x4938a7);}(_0x42e0,0x140));var _0x042e=function(_0x24184e,_0x1ed3c8){_0x24184e=_0x24184e-0x0;var _0x558030=_0x42e0[_0x24184e];return _0x558030;};'use strict';var emlformat=require(_0x042e('0x0'));var rimraf=require(_0x042e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x042e('0x2'));var rp=require(_0x042e('0x3'));var moment=require(_0x042e('0x4'));var BPromise=require(_0x042e('0x5'));var Mustache=require(_0x042e('0x6'));var util=require(_0x042e('0x7'));var path=require(_0x042e('0x8'));var sox=require(_0x042e('0x9'));var csv=require(_0x042e('0xa'));var ejs=require(_0x042e('0xb'));var fs=require('fs');var fs_extra=require(_0x042e('0xc'));var _=require(_0x042e('0xd'));var squel=require(_0x042e('0xe'));var crypto=require(_0x042e('0xf'));var jsforce=require(_0x042e('0x10'));var deskjs=require(_0x042e('0x11'));var toCsv=require(_0x042e('0xa'));var querystring=require(_0x042e('0x12'));var Papa=require('papaparse');var Redis=require(_0x042e('0x13'));var authService=require(_0x042e('0x14'));var qs=require(_0x042e('0x15'));var as=require(_0x042e('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x042e('0x17'))(_0x042e('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x042e('0x19'));var db=require(_0x042e('0x1a'))['db'];function respondWithStatusCode(_0x4c4686,_0x1fe1a9){_0x1fe1a9=_0x1fe1a9||0xcc;return function(_0x4744db){if(_0x4744db){return _0x4c4686[_0x042e('0x1b')](_0x1fe1a9);}return _0x4c4686['status'](_0x1fe1a9)[_0x042e('0x1c')]();};}function respondWithResult(_0xa32e4f,_0x1807e5){_0x1807e5=_0x1807e5||0xc8;return function(_0x491bec){if(_0x491bec){return _0xa32e4f[_0x042e('0x1d')](_0x1807e5)[_0x042e('0x1e')](_0x491bec);}};}function respondWithFilteredResult(_0x27ea89,_0x4c6808){return function(_0x25c982){if(_0x25c982){var _0x1a1844=typeof _0x4c6808[_0x042e('0x1f')]===_0x042e('0x20')&&typeof _0x4c6808[_0x042e('0x21')]===_0x042e('0x20');var _0x3d7050=_0x25c982['count'];var _0xa6ec0b=_0x1a1844?0x0:_0x4c6808[_0x042e('0x1f')];var _0xe95466=_0x1a1844?_0x25c982[_0x042e('0x22')]:_0x4c6808[_0x042e('0x1f')]+_0x4c6808[_0x042e('0x21')];var _0x125276;if(_0xe95466>=_0x3d7050){_0xe95466=_0x3d7050;_0x125276=0xc8;}else{_0x125276=0xce;}_0x27ea89[_0x042e('0x1d')](_0x125276);return _0x27ea89['set'](_0x042e('0x23'),_0xa6ec0b+'-'+_0xe95466+'/'+_0x3d7050)[_0x042e('0x1e')](_0x25c982);}return null;};}function patchUpdates(_0x19c7cd){return function(_0x39ee61){try{jsonpatch[_0x042e('0x24')](_0x39ee61,_0x19c7cd,!![]);}catch(_0x50a130){return BPromise['reject'](_0x50a130);}return _0x39ee61[_0x042e('0x25')]();};}function saveUpdates(_0x2b25a9,_0x467dcf){return function(_0x40d26e){if(_0x40d26e){return _0x40d26e[_0x042e('0x26')](_0x2b25a9)[_0x042e('0x27')](function(_0x36cd3a){return _0x36cd3a;});}return null;};}function removeEntity(_0xdb6c04,_0x10e98c){return function(_0xe37c4d){if(_0xe37c4d){return _0xe37c4d['destroy']()[_0x042e('0x27')](function(){_0xdb6c04[_0x042e('0x1d')](0xcc)[_0x042e('0x1c')]();});}};}function handleEntityNotFound(_0x4833ab,_0x512c5b){return function(_0xd08c7a){if(!_0xd08c7a){_0x4833ab[_0x042e('0x1b')](0x194);}return _0xd08c7a;};}function handleError(_0xb43687,_0x5422bd){_0x5422bd=_0x5422bd||0x1f4;return function(_0x759ae7){logger[_0x042e('0x28')](_0x759ae7[_0x042e('0x29')]);if(_0x759ae7[_0x042e('0x2a')]){delete _0x759ae7['name'];}_0xb43687[_0x042e('0x1d')](_0x5422bd)[_0x042e('0x2b')](_0x759ae7);};}exports[_0x042e('0x2c')]=function(_0x1c43de,_0x27aca9){var _0x132b3d={},_0x1675b3={},_0xac0e5b={'count':0x0,'rows':[]};var _0x13e5c=_['map'](db[_0x042e('0x2d')][_0x042e('0x2e')],function(_0x3fc9ec){return{'name':_0x3fc9ec[_0x042e('0x2f')],'type':_0x3fc9ec[_0x042e('0x30')][_0x042e('0x31')]};});_0x1675b3['model']=_[_0x042e('0x32')](_0x13e5c,_0x042e('0x2a'));_0x1675b3['query']=_['keys'](_0x1c43de['query']);_0x1675b3['filters']=_[_0x042e('0x33')](_0x1675b3['model'],_0x1675b3[_0x042e('0x34')]);_0x132b3d[_0x042e('0x35')]=_['intersection'](_0x1675b3[_0x042e('0x36')],qs[_0x042e('0x37')](_0x1c43de[_0x042e('0x34')]['fields']));_0x132b3d[_0x042e('0x35')]=_0x132b3d[_0x042e('0x35')][_0x042e('0x38')]?_0x132b3d['attributes']:_0x1675b3[_0x042e('0x36')];if(!_0x1c43de[_0x042e('0x34')][_0x042e('0x39')](_0x042e('0x3a'))){_0x132b3d[_0x042e('0x21')]=qs[_0x042e('0x21')](_0x1c43de[_0x042e('0x34')][_0x042e('0x21')]);_0x132b3d[_0x042e('0x1f')]=qs['offset'](_0x1c43de[_0x042e('0x34')]['offset']);}_0x132b3d[_0x042e('0x3b')]=qs[_0x042e('0x3c')](_0x1c43de[_0x042e('0x34')][_0x042e('0x3c')]);_0x132b3d['where']=qs[_0x042e('0x3d')](_[_0x042e('0x3e')](_0x1c43de['query'],_0x1675b3[_0x042e('0x3d')]),_0x13e5c);if(_0x1c43de['query'][_0x042e('0x3f')]){_0x132b3d['where']=_[_0x042e('0x40')](_0x132b3d[_0x042e('0x41')],{'$or':_['map'](_0x13e5c,function(_0x1db73a){if(_0x1db73a[_0x042e('0x30')]!==_0x042e('0x42')){var _0x1f034d={};_0x1f034d[_0x1db73a[_0x042e('0x2a')]]={'$like':'%'+_0x1c43de[_0x042e('0x34')][_0x042e('0x3f')]+'%'};return _0x1f034d;}})});}_0x132b3d=_[_0x042e('0x40')]({},_0x132b3d,_0x1c43de[_0x042e('0x43')]);var _0x939735={'where':_0x132b3d[_0x042e('0x41')]};return db[_0x042e('0x2d')][_0x042e('0x22')](_0x939735)['then'](function(_0x34b316){_0xac0e5b[_0x042e('0x22')]=_0x34b316;if(_0x1c43de[_0x042e('0x34')][_0x042e('0x44')]){_0x132b3d[_0x042e('0x45')]=[{'all':!![]}];}return db['FreshsalesField'][_0x042e('0x46')](_0x132b3d);})[_0x042e('0x27')](function(_0x1ba1d3){_0xac0e5b[_0x042e('0x47')]=_0x1ba1d3;return _0xac0e5b;})[_0x042e('0x27')](respondWithFilteredResult(_0x27aca9,_0x132b3d))[_0x042e('0x48')](handleError(_0x27aca9,null));};exports['show']=function(_0x4279fc,_0x384ad3){var _0x4bac20={'raw':!![],'where':{'id':_0x4279fc[_0x042e('0x49')]['id']}},_0x39c107={};_0x39c107[_0x042e('0x36')]=_[_0x042e('0x4a')](db[_0x042e('0x2d')][_0x042e('0x2e')]);_0x39c107[_0x042e('0x34')]=_[_0x042e('0x4a')](_0x4279fc[_0x042e('0x34')]);_0x39c107[_0x042e('0x3d')]=_['intersection'](_0x39c107[_0x042e('0x36')],_0x39c107['query']);_0x4bac20[_0x042e('0x35')]=_['intersection'](_0x39c107[_0x042e('0x36')],qs['fields'](_0x4279fc['query'][_0x042e('0x37')]));_0x4bac20[_0x042e('0x35')]=_0x4bac20[_0x042e('0x35')][_0x042e('0x38')]?_0x4bac20[_0x042e('0x35')]:_0x39c107[_0x042e('0x36')];if(_0x4279fc[_0x042e('0x34')][_0x042e('0x44')]){_0x4bac20[_0x042e('0x45')]=[{'all':!![]}];}_0x4bac20=_[_0x042e('0x40')]({},_0x4bac20,_0x4279fc[_0x042e('0x43')]);return db[_0x042e('0x2d')]['find'](_0x4bac20)['then'](handleEntityNotFound(_0x384ad3,null))[_0x042e('0x27')](respondWithResult(_0x384ad3,null))[_0x042e('0x48')](handleError(_0x384ad3,null));};exports[_0x042e('0x4b')]=function(_0x5997b6,_0x2722f9){return db['FreshsalesField'][_0x042e('0x4b')](_0x5997b6[_0x042e('0x4c')],{})[_0x042e('0x27')](respondWithResult(_0x2722f9,0xc9))['catch'](handleError(_0x2722f9,null));};exports[_0x042e('0x26')]=function(_0x2db8f8,_0x3c7501){if(_0x2db8f8[_0x042e('0x4c')]['id']){delete _0x2db8f8['body']['id'];}return db[_0x042e('0x2d')][_0x042e('0x4d')]({'where':{'id':_0x2db8f8[_0x042e('0x49')]['id']}})[_0x042e('0x27')](handleEntityNotFound(_0x3c7501,null))[_0x042e('0x27')](saveUpdates(_0x2db8f8[_0x042e('0x4c')],null))[_0x042e('0x27')](respondWithResult(_0x3c7501,null))[_0x042e('0x48')](handleError(_0x3c7501,null));};exports[_0x042e('0x4e')]=function(_0x54b8e7,_0x53d418){return db['FreshsalesField'][_0x042e('0x4d')]({'where':{'id':_0x54b8e7[_0x042e('0x49')]['id']}})['then'](handleEntityNotFound(_0x53d418,null))['then'](removeEntity(_0x53d418,null))[_0x042e('0x48')](handleError(_0x53d418,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 89f97e4..0cbf605 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(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xb350,0x6f));var _0x0b35=function(_0xcd3806,_0x3182ad){_0xcd3806=_0xcd3806-0x0;var _0x5e3594=_0xb350[_0xcd3806];return _0x5e3594;};'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 _0x58cc=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x58cc,0x7a));var _0xc58c=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x58cc[_0x173d7e];return _0x2220d6;};'use strict';var _=require(_0xc58c('0x0'));var util=require(_0xc58c('0x1'));var logger=require(_0xc58c('0x2'))(_0xc58c('0x3'));var moment=require(_0xc58c('0x4'));var BPromise=require(_0xc58c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc58c('0x6'));var rimraf=require(_0xc58c('0x7'));var config=require(_0xc58c('0x8'));var attributes=require(_0xc58c('0x9'));module[_0xc58c('0xa')]=function(_0x3a0b8b,_0x513202){return _0x3a0b8b['define'](_0xc58c('0xb'),attributes,{'tableName':_0xc58c('0xc'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xc58c('0xd'),_0xc58c('0xe')],'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 9126726..9efdfaa 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 _0x2542=['info','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x459734,_0x2af78a){var _0x48ec57=function(_0x14bae3){while(--_0x14bae3){_0x459734['push'](_0x459734['shift']());}};_0x48ec57(++_0x2af78a);}(_0x2542,0x169));var _0x2254=function(_0x2a5d23,_0x4e18b2){_0x2a5d23=_0x2a5d23-0x0;var _0x375a55=_0x2542[_0x2a5d23];return _0x375a55;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file +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(_0x5a3f3a,_0x3ae10e){var _0x5a6216=function(_0x1303cd){while(--_0x1303cd){_0x5a3f3a['push'](_0x5a3f3a['shift']());}};_0x5a6216(++_0x3ae10e);}(_0x31f0,0xb7));var _0x031f=function(_0x3cb05f,_0x3af69d){_0x3cb05f=_0x3cb05f-0x0;var _0x382190=_0x31f0[_0x3cb05f];return _0x382190;};'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 d18302c..5fc1df8 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(_0x223738,_0x29fdca){var _0x3f47c=function(_0x2e9918){while(--_0x2e9918){_0x223738['push'](_0x223738['shift']());}};_0x3f47c(++_0x29fdca);}(_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 +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(_0x15be7b,_0x2afa15){var _0x1d6519=function(_0xf46d3){while(--_0xf46d3){_0x15be7b['push'](_0x15be7b['shift']());}};_0x1d6519(++_0x2afa15);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 80abafe..169e6a4 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 _0x6132=['ENUM','integrationTab','newTab','exports','STRING','username'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x6132,0xf3));var _0x2613=function(_0x4d87c5,_0x2e76a7){_0x4d87c5=_0x4d87c5-0x0;var _0x53c5ca=_0x6132[_0x4d87c5];return _0x53c5ca;};'use strict';var Sequelize=require('sequelize');module[_0x2613('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2613('0x1')]},'username':{'type':Sequelize[_0x2613('0x1')],'unique':_0x2613('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x2613('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x2613('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2613('0x3')](_0x2613('0x4'),_0x2613('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x5fdc=['newTab','sequelize','exports','STRING','username','ENUM','integrationTab'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5fdc,0x127));var _0xc5fd=function(_0x655ef5,_0x5cc7de){_0x655ef5=_0x655ef5-0x0;var _0x3f1797=_0x5fdc[_0x655ef5];return _0x3f1797;};'use strict';var Sequelize=require(_0xc5fd('0x0'));module[_0xc5fd('0x1')]={'name':{'type':Sequelize[_0xc5fd('0x2')]},'description':{'type':Sequelize[_0xc5fd('0x2')]},'username':{'type':Sequelize[_0xc5fd('0x2')],'unique':_0xc5fd('0x3')},'remoteUri':{'type':Sequelize[_0xc5fd('0x2')]},'password':{'type':Sequelize[_0xc5fd('0x2')]},'clientId':{'type':Sequelize[_0xc5fd('0x2')]},'clientSecret':{'type':Sequelize[_0xc5fd('0x2')]},'securityToken':{'type':Sequelize[_0xc5fd('0x2')]},'serverUrl':{'type':Sequelize[_0xc5fd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc5fd('0x4')](_0xc5fd('0x5'),_0xc5fd('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index cb3a54d..e47596f 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 _0x64ab=['Subject','Description','string','int','picklist','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','True','true','False','false','test','getFields','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','offset','undefined','limit','set','Content-Range','json','apply','reject','then','destroy','end','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','update','getConfigurations','SalesforceConfiguration','pick','addConfiguration','findOne','AccountId','getSubjects','channel','getDescriptions','SalesforceField','Subjects','Descriptions','Task','remoteUri','clientId','clientSecret','username','password','securityToken','login','concat','ticketType','sobject','describe','ActivityDate','IsReminderSet','IsRecurrence'];(function(_0x2ec7f2,_0xe24da3){var _0x29de00=function(_0x383338){while(--_0x383338){_0x2ec7f2['push'](_0x2ec7f2['shift']());}};_0x29de00(++_0xe24da3);}(_0x64ab,0x110));var _0xb64a=function(_0x3f664f,_0x35b2eb){_0x3f664f=_0x3f664f-0x0;var _0x508501=_0x64ab[_0x3f664f];return _0x508501;};'use strict';var emlformat=require(_0xb64a('0x0'));var rimraf=require(_0xb64a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb64a('0x2'));var rp=require(_0xb64a('0x3'));var moment=require(_0xb64a('0x4'));var BPromise=require(_0xb64a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb64a('0x6'));var sox=require(_0xb64a('0x7'));var csv=require(_0xb64a('0x8'));var ejs=require(_0xb64a('0x9'));var fs=require('fs');var fs_extra=require(_0xb64a('0xa'));var _=require(_0xb64a('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb64a('0xc'));var deskjs=require(_0xb64a('0xd'));var toCsv=require(_0xb64a('0x8'));var querystring=require(_0xb64a('0xe'));var Papa=require(_0xb64a('0xf'));var Redis=require('ioredis');var authService=require(_0xb64a('0x10'));var qs=require(_0xb64a('0x11'));var as=require(_0xb64a('0x12'));var hardwareService=require(_0xb64a('0x13'));var logger=require(_0xb64a('0x14'))(_0xb64a('0x15'));var utils=require(_0xb64a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb64a('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x24322a,_0x58004d){_0x58004d=_0x58004d||0xcc;return function(_0xfa6cc5){if(_0xfa6cc5){return _0x24322a[_0xb64a('0x18')](_0x58004d);}return _0x24322a[_0xb64a('0x19')](_0x58004d)['end']();};}function respondWithResult(_0xe5b959,_0x4c5108){_0x4c5108=_0x4c5108||0xc8;return function(_0x3d336a){if(_0x3d336a){return _0xe5b959['status'](_0x4c5108)['json'](_0x3d336a);}};}function respondWithFilteredResult(_0x55ccbc,_0x373a58){return function(_0x1788f8){if(_0x1788f8){var _0x4e6885=typeof _0x373a58[_0xb64a('0x1a')]===_0xb64a('0x1b')&&typeof _0x373a58[_0xb64a('0x1c')]===_0xb64a('0x1b');var _0x58dccf=_0x1788f8['count'];var _0x1992ea=_0x4e6885?0x0:_0x373a58[_0xb64a('0x1a')];var _0x5a0e7b=_0x4e6885?_0x1788f8['count']:_0x373a58[_0xb64a('0x1a')]+_0x373a58[_0xb64a('0x1c')];var _0x4cbc71;if(_0x5a0e7b>=_0x58dccf){_0x5a0e7b=_0x58dccf;_0x4cbc71=0xc8;}else{_0x4cbc71=0xce;}_0x55ccbc[_0xb64a('0x19')](_0x4cbc71);return _0x55ccbc[_0xb64a('0x1d')](_0xb64a('0x1e'),_0x1992ea+'-'+_0x5a0e7b+'/'+_0x58dccf)[_0xb64a('0x1f')](_0x1788f8);}return null;};}function patchUpdates(_0x2d6ebb){return function(_0xc61ba0){try{jsonpatch[_0xb64a('0x20')](_0xc61ba0,_0x2d6ebb,!![]);}catch(_0xe89633){return BPromise[_0xb64a('0x21')](_0xe89633);}return _0xc61ba0['save']();};}function saveUpdates(_0x17d355,_0xf23c9c){return function(_0x431e69){if(_0x431e69){return _0x431e69['update'](_0x17d355)[_0xb64a('0x22')](function(_0x4fa201){return _0x4fa201;});}return null;};}function removeEntity(_0x78f77,_0x4255a1){return function(_0x31f9bc){if(_0x31f9bc){return _0x31f9bc[_0xb64a('0x23')]()[_0xb64a('0x22')](function(){_0x78f77[_0xb64a('0x19')](0xcc)[_0xb64a('0x24')]();});}};}function handleEntityNotFound(_0x5e4371,_0x53d08e){return function(_0x4f33b4){if(!_0x4f33b4){_0x5e4371['sendStatus'](0x194);}return _0x4f33b4;};}function handleError(_0x37f9b5,_0x283ecf){_0x283ecf=_0x283ecf||0x1f4;return function(_0x44b57e){logger[_0xb64a('0x25')](_0x44b57e[_0xb64a('0x26')]);if(_0x44b57e[_0xb64a('0x27')]){delete _0x44b57e[_0xb64a('0x27')];}_0x37f9b5[_0xb64a('0x19')](_0x283ecf)[_0xb64a('0x28')](_0x44b57e);};}exports[_0xb64a('0x29')]=function(_0x489ed1,_0x4529c5){var _0x5a4ce0={},_0x18c93d={},_0x1d231b={'count':0x0,'rows':[]};var _0x36bc50=_[_0xb64a('0x2a')](db[_0xb64a('0x2b')][_0xb64a('0x2c')],function(_0x3964b8){return{'name':_0x3964b8[_0xb64a('0x2d')],'type':_0x3964b8[_0xb64a('0x2e')][_0xb64a('0x2f')]};});_0x18c93d['model']=_[_0xb64a('0x2a')](_0x36bc50,_0xb64a('0x27'));_0x18c93d['query']=_[_0xb64a('0x30')](_0x489ed1[_0xb64a('0x31')]);_0x18c93d[_0xb64a('0x32')]=_[_0xb64a('0x33')](_0x18c93d['model'],_0x18c93d['query']);_0x5a4ce0[_0xb64a('0x34')]=_[_0xb64a('0x33')](_0x18c93d[_0xb64a('0x35')],qs['fields'](_0x489ed1['query'][_0xb64a('0x36')]));_0x5a4ce0['attributes']=_0x5a4ce0[_0xb64a('0x34')]['length']?_0x5a4ce0[_0xb64a('0x34')]:_0x18c93d[_0xb64a('0x35')];if(!_0x489ed1[_0xb64a('0x31')][_0xb64a('0x37')](_0xb64a('0x38'))){_0x5a4ce0[_0xb64a('0x1c')]=qs[_0xb64a('0x1c')](_0x489ed1[_0xb64a('0x31')]['limit']);_0x5a4ce0[_0xb64a('0x1a')]=qs[_0xb64a('0x1a')](_0x489ed1[_0xb64a('0x31')][_0xb64a('0x1a')]);}_0x5a4ce0[_0xb64a('0x39')]=qs[_0xb64a('0x3a')](_0x489ed1[_0xb64a('0x31')]['sort']);_0x5a4ce0[_0xb64a('0x3b')]=qs['filters'](_['pick'](_0x489ed1[_0xb64a('0x31')],_0x18c93d[_0xb64a('0x32')]),_0x36bc50);if(_0x489ed1[_0xb64a('0x31')][_0xb64a('0x3c')]){_0x5a4ce0[_0xb64a('0x3b')]=_[_0xb64a('0x3d')](_0x5a4ce0[_0xb64a('0x3b')],{'$or':_[_0xb64a('0x2a')](_0x36bc50,function(_0xe69885){if(_0xe69885[_0xb64a('0x2e')]!=='VIRTUAL'){var _0xfa0a04={};_0xfa0a04[_0xe69885['name']]={'$like':'%'+_0x489ed1[_0xb64a('0x31')][_0xb64a('0x3c')]+'%'};return _0xfa0a04;}})});}_0x5a4ce0=_['merge']({},_0x5a4ce0,_0x489ed1[_0xb64a('0x3e')]);var _0x4c997d={'where':_0x5a4ce0[_0xb64a('0x3b')]};return db[_0xb64a('0x2b')][_0xb64a('0x3f')](_0x4c997d)[_0xb64a('0x22')](function(_0x2a440c){_0x1d231b[_0xb64a('0x3f')]=_0x2a440c;if(_0x489ed1[_0xb64a('0x31')]['includeAll']){_0x5a4ce0[_0xb64a('0x40')]=[{'all':!![]}];}return db['SalesforceAccount'][_0xb64a('0x41')](_0x5a4ce0);})[_0xb64a('0x22')](function(_0x5d4662){_0x1d231b[_0xb64a('0x42')]=_0x5d4662;return _0x1d231b;})['then'](respondWithFilteredResult(_0x4529c5,_0x5a4ce0))[_0xb64a('0x43')](handleError(_0x4529c5,null));};exports[_0xb64a('0x44')]=function(_0x1430c5,_0xad7537){var _0x438b36={'raw':![],'where':{'id':_0x1430c5[_0xb64a('0x45')]['id']}},_0x525fef={};_0x525fef[_0xb64a('0x35')]=_['keys'](db[_0xb64a('0x2b')][_0xb64a('0x2c')]);_0x525fef[_0xb64a('0x31')]=_[_0xb64a('0x30')](_0x1430c5['query']);_0x525fef[_0xb64a('0x32')]=_[_0xb64a('0x33')](_0x525fef[_0xb64a('0x35')],_0x525fef['query']);_0x438b36[_0xb64a('0x34')]=_[_0xb64a('0x33')](_0x525fef[_0xb64a('0x35')],qs[_0xb64a('0x36')](_0x1430c5[_0xb64a('0x31')][_0xb64a('0x36')]));_0x438b36[_0xb64a('0x34')]=_0x438b36['attributes'][_0xb64a('0x46')]?_0x438b36[_0xb64a('0x34')]:_0x525fef[_0xb64a('0x35')];if(_0x1430c5['query'][_0xb64a('0x47')]){_0x438b36[_0xb64a('0x40')]=[{'all':!![]}];}_0x438b36=_[_0xb64a('0x3d')]({},_0x438b36,_0x1430c5['options']);return db[_0xb64a('0x2b')][_0xb64a('0x48')](_0x438b36)[_0xb64a('0x22')](handleEntityNotFound(_0xad7537,null))['then'](respondWithResult(_0xad7537,null))[_0xb64a('0x43')](handleError(_0xad7537,null));};exports[_0xb64a('0x49')]=function(_0x1a1303,_0x3e4a4b){return db[_0xb64a('0x2b')][_0xb64a('0x49')](_0x1a1303[_0xb64a('0x4a')],{})[_0xb64a('0x22')](respondWithResult(_0x3e4a4b,0xc9))[_0xb64a('0x43')](handleError(_0x3e4a4b,null));};exports[_0xb64a('0x4b')]=function(_0x2561e8,_0x4926e0){if(_0x2561e8[_0xb64a('0x4a')]['id']){delete _0x2561e8[_0xb64a('0x4a')]['id'];}return db[_0xb64a('0x2b')][_0xb64a('0x48')]({'where':{'id':_0x2561e8['params']['id']}})[_0xb64a('0x22')](handleEntityNotFound(_0x4926e0,null))[_0xb64a('0x22')](saveUpdates(_0x2561e8[_0xb64a('0x4a')],null))[_0xb64a('0x22')](respondWithResult(_0x4926e0,null))[_0xb64a('0x43')](handleError(_0x4926e0,null));};exports['destroy']=function(_0x4c0f28,_0x4f491d){return db[_0xb64a('0x2b')][_0xb64a('0x48')]({'where':{'id':_0x4c0f28[_0xb64a('0x45')]['id']}})[_0xb64a('0x22')](handleEntityNotFound(_0x4f491d,null))[_0xb64a('0x22')](removeEntity(_0x4f491d,null))[_0xb64a('0x43')](handleError(_0x4f491d,null));};exports[_0xb64a('0x4c')]=function(_0xfac9e2,_0x52a4c5,_0x50ad6d){var _0x155878={};var _0x5b27c3={};var _0x3b7961;var _0x12c639;return db[_0xb64a('0x2b')]['findOne']({'where':{'id':_0xfac9e2[_0xb64a('0x45')]['id']}})[_0xb64a('0x22')](handleEntityNotFound(_0x52a4c5,null))[_0xb64a('0x22')](function(_0x5ac9c3){if(_0x5ac9c3){_0x3b7961=_0x5ac9c3;_0x5b27c3[_0xb64a('0x35')]=_[_0xb64a('0x30')](db[_0xb64a('0x4d')][_0xb64a('0x2c')]);_0x5b27c3['query']=_[_0xb64a('0x30')](_0xfac9e2[_0xb64a('0x31')]);_0x5b27c3['filters']=_['intersection'](_0x5b27c3[_0xb64a('0x35')],_0x5b27c3[_0xb64a('0x31')]);_0x155878[_0xb64a('0x34')]=_['intersection'](_0x5b27c3[_0xb64a('0x35')],qs[_0xb64a('0x36')](_0xfac9e2[_0xb64a('0x31')][_0xb64a('0x36')]));_0x155878['attributes']=_0x155878[_0xb64a('0x34')][_0xb64a('0x46')]?_0x155878[_0xb64a('0x34')]:_0x5b27c3[_0xb64a('0x35')];_0x155878[_0xb64a('0x39')]=qs[_0xb64a('0x3a')](_0xfac9e2['query'][_0xb64a('0x3a')]);_0x155878[_0xb64a('0x3b')]=qs[_0xb64a('0x32')](_[_0xb64a('0x4e')](_0xfac9e2['query'],_0x5b27c3[_0xb64a('0x32')]));if(_0xfac9e2[_0xb64a('0x31')]['filter']){_0x155878[_0xb64a('0x3b')]=_[_0xb64a('0x3d')](_0x155878[_0xb64a('0x3b')],{'$or':_['map'](_0x155878[_0xb64a('0x34')],function(_0x4429ce){var _0x2a6149={};_0x2a6149[_0x4429ce]={'$like':'%'+_0xfac9e2[_0xb64a('0x31')][_0xb64a('0x3c')]+'%'};return _0x2a6149;})});}_0x155878=_['merge']({},_0x155878,_0xfac9e2[_0xb64a('0x3e')]);return _0x3b7961[_0xb64a('0x4c')](_0x155878);}})['then'](function(_0x4c9a30){if(_0x4c9a30){_0x12c639=_0x4c9a30[_0xb64a('0x46')];if(!_0xfac9e2[_0xb64a('0x31')]['hasOwnProperty'](_0xb64a('0x38'))){_0x155878[_0xb64a('0x1c')]=qs[_0xb64a('0x1c')](_0xfac9e2['query'][_0xb64a('0x1c')]);_0x155878['offset']=qs[_0xb64a('0x1a')](_0xfac9e2[_0xb64a('0x31')][_0xb64a('0x1a')]);}return _0x3b7961['getConfigurations'](_0x155878);}})[_0xb64a('0x22')](function(_0x3dddfe){if(_0x3dddfe){return _0x3dddfe?{'count':_0x12c639,'rows':_0x3dddfe}:null;}})[_0xb64a('0x22')](respondWithResult(_0x52a4c5,null))[_0xb64a('0x43')](handleError(_0x52a4c5,null));};exports[_0xb64a('0x4f')]=function(_0x181f8d,_0x222340,_0x5e9843){if(_0x181f8d[_0xb64a('0x4a')]['id']){delete _0x181f8d[_0xb64a('0x4a')]['id'];}return db[_0xb64a('0x2b')][_0xb64a('0x50')]({'where':{'id':_0x181f8d[_0xb64a('0x45')]['id']}})['then'](handleEntityNotFound(_0x222340,null))[_0xb64a('0x22')](function(_0x1181af){if(_0x1181af){_0x181f8d[_0xb64a('0x4a')][_0xb64a('0x51')]=_0x1181af['id'];_0x181f8d[_0xb64a('0x4a')]['Subjects']=integrations[_0xb64a('0x52')](_0x181f8d[_0xb64a('0x4a')][_0xb64a('0x53')],_0x181f8d['body'][_0xb64a('0x2e')]);_0x181f8d[_0xb64a('0x4a')]['Descriptions']=integrations[_0xb64a('0x54')](_0x181f8d[_0xb64a('0x4a')][_0xb64a('0x53')],_0x181f8d[_0xb64a('0x4a')][_0xb64a('0x2e')]);return db[_0xb64a('0x4d')][_0xb64a('0x49')](_0x181f8d['body'],{'include':[{'model':db[_0xb64a('0x55')],'as':_0xb64a('0x56')},{'model':db[_0xb64a('0x55')],'as':_0xb64a('0x57')}]});}return null;})[_0xb64a('0x22')](respondWithResult(_0x222340,null))[_0xb64a('0x43')](handleError(_0x222340,null));};exports['getFields']=function(_0x2a8490,_0x198cc0,_0x4bb9e4){var _0x3bdf3f;var _0x441e86='';var _0x41d941=_0xb64a('0x58');return db[_0xb64a('0x2b')][_0xb64a('0x50')]({'where':{'id':_0x2a8490[_0xb64a('0x45')]['id']},'attributes':['id',_0xb64a('0x59'),_0xb64a('0x5a'),_0xb64a('0x5b'),_0xb64a('0x5c'),_0xb64a('0x5d'),_0xb64a('0x5e')]})[_0xb64a('0x22')](handleEntityNotFound(_0x198cc0,null))[_0xb64a('0x22')](function(_0x256103){if(_0x256103){_0x441e86=_0x256103[_0xb64a('0x59')];var _0x1804e5=_0x441e86['slice'](-0x1);if(_0x1804e5==='/'){_0x441e86=_0x441e86['substring'](0x0,_0x441e86['lastIndexOf'](_0x1804e5));}_0x3bdf3f=new jsforce['Connection']({'oauth2':{'loginUrl':_0x441e86,'clientId':_0x256103[_0xb64a('0x5a')],'clientSecret':_0x256103['clientSecret']}});return _0x3bdf3f[_0xb64a('0x5f')](_0x256103[_0xb64a('0x5c')],_0x256103[_0xb64a('0x5d')][_0xb64a('0x60')](_0x256103[_0xb64a('0x5e')]));}})[_0xb64a('0x22')](function(_0x4b4244){if(_0x4b4244){if(!_['isNil'](_0x2a8490['query'][_0xb64a('0x61')])){_0x41d941=_0x2a8490['query'][_0xb64a('0x61')];}return _0x3bdf3f[_0xb64a('0x62')](_0x41d941)[_0xb64a('0x63')]();}})[_0xb64a('0x22')](function(_0x514c88){var _0x434475=['OwnerId',_0xb64a('0x64'),_0xb64a('0x65'),_0xb64a('0x66'),_0xb64a('0x67'),_0xb64a('0x68')];var _0x4e4f4e=[_0xb64a('0x69'),_0xb64a('0x6a'),_0xb64a('0x6b'),_0xb64a('0x6c'),_0xb64a('0x6d'),_0xb64a('0x6e'),_0xb64a('0x6f')];if(_0x514c88){_[_0xb64a('0x70')](_0x514c88['fields'],function(_0x360c96){return _0x434475['includes'](_0x360c96['name'])||!_0x4e4f4e[_0xb64a('0x71')](_0x360c96[_0xb64a('0x2e')]);});return{'count':_0x514c88[_0xb64a('0x36')]['length'],'rows':_[_0xb64a('0x2a')](_0x514c88[_0xb64a('0x36')],function(_0x5138ca){return{'id':_0x5138ca['name'],'name':_0x5138ca[_0xb64a('0x72')],'custom':_0x5138ca[_0xb64a('0x73')],'options':_0x5138ca['picklistValues'][_0xb64a('0x46')]>0x0?_[_0xb64a('0x2a')](_0x5138ca[_0xb64a('0x74')],function(_0x185ea9){return{'name':_0x185ea9[_0xb64a('0x72')],'value':_0x185ea9[_0xb64a('0x75')]};}):_0x5138ca[_0xb64a('0x2e')]==_0xb64a('0x6c')?[{'name':_0xb64a('0x76'),'value':_0xb64a('0x77')},{'name':_0xb64a('0x78'),'value':_0xb64a('0x79')}]:[]};})};}})[_0xb64a('0x22')](respondWithResult(_0x198cc0,null))[_0xb64a('0x43')](function(_0x2f4d1b){var _0x2c92af=_0x2a8490[_0xb64a('0x31')][_0xb64a('0x7a')]?0x1f4:_0x2f4d1b['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xb64a('0x7b'),_0x2c92af,JSON['stringify'](_0x2f4d1b));delete _0x2f4d1b['name'];if(_0x2c92af===0x191){_0x2c92af=0x190;}_0x198cc0[_0xb64a('0x19')](_0x2c92af)['send'](_0x2a8490['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x2f4d1b[_0xb64a('0x7c')]}:_0x2f4d1b);});}; \ No newline at end of file +var _0x4ea2=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','count','set','apply','reject','save','update','destroy','then','end','error','name','send','index','map','SalesforceAccount','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','username','password','securityToken','substring','lastIndexOf','Connection','clientId','clientSecret','isNil','ticketType','sobject','describe','OwnerId','IsReminderSet','IsRecurrence','Subject','string','int','boolean','email','textarea','phone','remove','custom','picklistValues','label','value','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs'];(function(_0x5a9138,_0x49cf49){var _0x20b4fd=function(_0xc36e22){while(--_0xc36e22){_0x5a9138['push'](_0x5a9138['shift']());}};_0x20b4fd(++_0x49cf49);}(_0x4ea2,0x15a));var _0x24ea=function(_0x946518,_0x22816f){_0x946518=_0x946518-0x0;var _0x909b69=_0x4ea2[_0x946518];return _0x909b69;};'use strict';var emlformat=require(_0x24ea('0x0'));var rimraf=require(_0x24ea('0x1'));var zipdir=require(_0x24ea('0x2'));var jsonpatch=require(_0x24ea('0x3'));var rp=require(_0x24ea('0x4'));var moment=require(_0x24ea('0x5'));var BPromise=require(_0x24ea('0x6'));var Mustache=require(_0x24ea('0x7'));var util=require(_0x24ea('0x8'));var path=require(_0x24ea('0x9'));var sox=require('sox');var csv=require(_0x24ea('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x24ea('0xb'));var _=require(_0x24ea('0xc'));var squel=require(_0x24ea('0xd'));var crypto=require(_0x24ea('0xe'));var jsforce=require(_0x24ea('0xf'));var deskjs=require(_0x24ea('0x10'));var toCsv=require(_0x24ea('0xa'));var querystring=require(_0x24ea('0x11'));var Papa=require(_0x24ea('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x24ea('0x13'));var as=require(_0x24ea('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x24ea('0x15'))(_0x24ea('0x16'));var utils=require('../../config/utils');var config=require(_0x24ea('0x17'));var licenseUtil=require(_0x24ea('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4b3680,_0x2f96af){_0x2f96af=_0x2f96af||0xcc;return function(_0x2a9085){if(_0x2a9085){return _0x4b3680['sendStatus'](_0x2f96af);}return _0x4b3680[_0x24ea('0x19')](_0x2f96af)['end']();};}function respondWithResult(_0x12ac32,_0x12f7fe){_0x12f7fe=_0x12f7fe||0xc8;return function(_0x38260f){if(_0x38260f){return _0x12ac32['status'](_0x12f7fe)[_0x24ea('0x1a')](_0x38260f);}};}function respondWithFilteredResult(_0x5779bc,_0x17f339){return function(_0x2f3032){if(_0x2f3032){var _0x258dbe=typeof _0x17f339[_0x24ea('0x1b')]==='undefined'&&typeof _0x17f339[_0x24ea('0x1c')]==='undefined';var _0x824dd2=_0x2f3032['count'];var _0x1d26cf=_0x258dbe?0x0:_0x17f339[_0x24ea('0x1b')];var _0x4d55d8=_0x258dbe?_0x2f3032[_0x24ea('0x1d')]:_0x17f339[_0x24ea('0x1b')]+_0x17f339[_0x24ea('0x1c')];var _0x45e68f;if(_0x4d55d8>=_0x824dd2){_0x4d55d8=_0x824dd2;_0x45e68f=0xc8;}else{_0x45e68f=0xce;}_0x5779bc[_0x24ea('0x19')](_0x45e68f);return _0x5779bc[_0x24ea('0x1e')]('Content-Range',_0x1d26cf+'-'+_0x4d55d8+'/'+_0x824dd2)[_0x24ea('0x1a')](_0x2f3032);}return null;};}function patchUpdates(_0x432db1){return function(_0x3796cb){try{jsonpatch[_0x24ea('0x1f')](_0x3796cb,_0x432db1,!![]);}catch(_0x2db3b6){return BPromise[_0x24ea('0x20')](_0x2db3b6);}return _0x3796cb[_0x24ea('0x21')]();};}function saveUpdates(_0x275727,_0x34d0bd){return function(_0x2a622c){if(_0x2a622c){return _0x2a622c[_0x24ea('0x22')](_0x275727)['then'](function(_0x2f1ad1){return _0x2f1ad1;});}return null;};}function removeEntity(_0x11cbf8,_0x3ee9ef){return function(_0x5efdd1){if(_0x5efdd1){return _0x5efdd1[_0x24ea('0x23')]()[_0x24ea('0x24')](function(){_0x11cbf8['status'](0xcc)[_0x24ea('0x25')]();});}};}function handleEntityNotFound(_0x570f3b,_0x3b3884){return function(_0x4eb04d){if(!_0x4eb04d){_0x570f3b['sendStatus'](0x194);}return _0x4eb04d;};}function handleError(_0x55a9b4,_0x5b6719){_0x5b6719=_0x5b6719||0x1f4;return function(_0x55db1a){logger[_0x24ea('0x26')](_0x55db1a['stack']);if(_0x55db1a['name']){delete _0x55db1a[_0x24ea('0x27')];}_0x55a9b4[_0x24ea('0x19')](_0x5b6719)[_0x24ea('0x28')](_0x55db1a);};}exports[_0x24ea('0x29')]=function(_0x1cc979,_0x52dc2d){var _0x45acc4={},_0x235c91={},_0x3efd9e={'count':0x0,'rows':[]};var _0x4a5085=_[_0x24ea('0x2a')](db[_0x24ea('0x2b')][_0x24ea('0x2c')],function(_0x5670b2){return{'name':_0x5670b2['fieldName'],'type':_0x5670b2[_0x24ea('0x2d')]['key']};});_0x235c91['model']=_[_0x24ea('0x2a')](_0x4a5085,_0x24ea('0x27'));_0x235c91['query']=_[_0x24ea('0x2e')](_0x1cc979[_0x24ea('0x2f')]);_0x235c91[_0x24ea('0x30')]=_[_0x24ea('0x31')](_0x235c91[_0x24ea('0x32')],_0x235c91[_0x24ea('0x2f')]);_0x45acc4[_0x24ea('0x33')]=_[_0x24ea('0x31')](_0x235c91[_0x24ea('0x32')],qs[_0x24ea('0x34')](_0x1cc979['query']['fields']));_0x45acc4[_0x24ea('0x33')]=_0x45acc4[_0x24ea('0x33')][_0x24ea('0x35')]?_0x45acc4[_0x24ea('0x33')]:_0x235c91[_0x24ea('0x32')];if(!_0x1cc979[_0x24ea('0x2f')][_0x24ea('0x36')](_0x24ea('0x37'))){_0x45acc4['limit']=qs[_0x24ea('0x1c')](_0x1cc979[_0x24ea('0x2f')][_0x24ea('0x1c')]);_0x45acc4[_0x24ea('0x1b')]=qs[_0x24ea('0x1b')](_0x1cc979[_0x24ea('0x2f')][_0x24ea('0x1b')]);}_0x45acc4[_0x24ea('0x38')]=qs[_0x24ea('0x39')](_0x1cc979[_0x24ea('0x2f')]['sort']);_0x45acc4[_0x24ea('0x3a')]=qs[_0x24ea('0x30')](_[_0x24ea('0x3b')](_0x1cc979[_0x24ea('0x2f')],_0x235c91[_0x24ea('0x30')]),_0x4a5085);if(_0x1cc979[_0x24ea('0x2f')][_0x24ea('0x3c')]){_0x45acc4[_0x24ea('0x3a')]=_[_0x24ea('0x3d')](_0x45acc4[_0x24ea('0x3a')],{'$or':_[_0x24ea('0x2a')](_0x4a5085,function(_0x19783d){if(_0x19783d[_0x24ea('0x2d')]!==_0x24ea('0x3e')){var _0x4b94e8={};_0x4b94e8[_0x19783d['name']]={'$like':'%'+_0x1cc979[_0x24ea('0x2f')][_0x24ea('0x3c')]+'%'};return _0x4b94e8;}})});}_0x45acc4=_[_0x24ea('0x3d')]({},_0x45acc4,_0x1cc979[_0x24ea('0x3f')]);var _0x14e1e8={'where':_0x45acc4[_0x24ea('0x3a')]};return db[_0x24ea('0x2b')]['count'](_0x14e1e8)[_0x24ea('0x24')](function(_0x40c92f){_0x3efd9e[_0x24ea('0x1d')]=_0x40c92f;if(_0x1cc979['query'][_0x24ea('0x40')]){_0x45acc4[_0x24ea('0x41')]=[{'all':!![]}];}return db[_0x24ea('0x2b')][_0x24ea('0x42')](_0x45acc4);})[_0x24ea('0x24')](function(_0x6a7fa5){_0x3efd9e[_0x24ea('0x43')]=_0x6a7fa5;return _0x3efd9e;})[_0x24ea('0x24')](respondWithFilteredResult(_0x52dc2d,_0x45acc4))[_0x24ea('0x44')](handleError(_0x52dc2d,null));};exports[_0x24ea('0x45')]=function(_0x2d5b46,_0x3ec4d1){var _0x4abe98={'raw':![],'where':{'id':_0x2d5b46[_0x24ea('0x46')]['id']}},_0x203c0a={};_0x203c0a[_0x24ea('0x32')]=_[_0x24ea('0x2e')](db[_0x24ea('0x2b')][_0x24ea('0x2c')]);_0x203c0a[_0x24ea('0x2f')]=_[_0x24ea('0x2e')](_0x2d5b46[_0x24ea('0x2f')]);_0x203c0a[_0x24ea('0x30')]=_[_0x24ea('0x31')](_0x203c0a[_0x24ea('0x32')],_0x203c0a[_0x24ea('0x2f')]);_0x4abe98[_0x24ea('0x33')]=_[_0x24ea('0x31')](_0x203c0a[_0x24ea('0x32')],qs[_0x24ea('0x34')](_0x2d5b46[_0x24ea('0x2f')][_0x24ea('0x34')]));_0x4abe98['attributes']=_0x4abe98['attributes'][_0x24ea('0x35')]?_0x4abe98['attributes']:_0x203c0a[_0x24ea('0x32')];if(_0x2d5b46[_0x24ea('0x2f')]['includeAll']){_0x4abe98[_0x24ea('0x41')]=[{'all':!![]}];}_0x4abe98=_[_0x24ea('0x3d')]({},_0x4abe98,_0x2d5b46[_0x24ea('0x3f')]);return db['SalesforceAccount'][_0x24ea('0x47')](_0x4abe98)[_0x24ea('0x24')](handleEntityNotFound(_0x3ec4d1,null))[_0x24ea('0x24')](respondWithResult(_0x3ec4d1,null))['catch'](handleError(_0x3ec4d1,null));};exports[_0x24ea('0x48')]=function(_0x50d7a6,_0x20c372){return db[_0x24ea('0x2b')][_0x24ea('0x48')](_0x50d7a6[_0x24ea('0x49')],{})['then'](respondWithResult(_0x20c372,0xc9))[_0x24ea('0x44')](handleError(_0x20c372,null));};exports['update']=function(_0x11dfd1,_0x195e08){if(_0x11dfd1[_0x24ea('0x49')]['id']){delete _0x11dfd1[_0x24ea('0x49')]['id'];}return db[_0x24ea('0x2b')][_0x24ea('0x47')]({'where':{'id':_0x11dfd1[_0x24ea('0x46')]['id']}})[_0x24ea('0x24')](handleEntityNotFound(_0x195e08,null))[_0x24ea('0x24')](saveUpdates(_0x11dfd1[_0x24ea('0x49')],null))[_0x24ea('0x24')](respondWithResult(_0x195e08,null))[_0x24ea('0x44')](handleError(_0x195e08,null));};exports['destroy']=function(_0x43cfcc,_0x43ea27){return db[_0x24ea('0x2b')]['find']({'where':{'id':_0x43cfcc['params']['id']}})['then'](handleEntityNotFound(_0x43ea27,null))['then'](removeEntity(_0x43ea27,null))[_0x24ea('0x44')](handleError(_0x43ea27,null));};exports[_0x24ea('0x4a')]=function(_0x4e4b98,_0x4f144a,_0x796b65){var _0x1589f9={};var _0x2e125a={};var _0x39977f;var _0x1c48ef;return db[_0x24ea('0x2b')][_0x24ea('0x4b')]({'where':{'id':_0x4e4b98[_0x24ea('0x46')]['id']}})['then'](handleEntityNotFound(_0x4f144a,null))['then'](function(_0x4c1260){if(_0x4c1260){_0x39977f=_0x4c1260;_0x2e125a[_0x24ea('0x32')]=_['keys'](db[_0x24ea('0x4c')][_0x24ea('0x2c')]);_0x2e125a[_0x24ea('0x2f')]=_[_0x24ea('0x2e')](_0x4e4b98[_0x24ea('0x2f')]);_0x2e125a['filters']=_[_0x24ea('0x31')](_0x2e125a[_0x24ea('0x32')],_0x2e125a[_0x24ea('0x2f')]);_0x1589f9[_0x24ea('0x33')]=_[_0x24ea('0x31')](_0x2e125a[_0x24ea('0x32')],qs[_0x24ea('0x34')](_0x4e4b98[_0x24ea('0x2f')][_0x24ea('0x34')]));_0x1589f9[_0x24ea('0x33')]=_0x1589f9[_0x24ea('0x33')][_0x24ea('0x35')]?_0x1589f9[_0x24ea('0x33')]:_0x2e125a[_0x24ea('0x32')];_0x1589f9['order']=qs[_0x24ea('0x39')](_0x4e4b98[_0x24ea('0x2f')][_0x24ea('0x39')]);_0x1589f9['where']=qs[_0x24ea('0x30')](_[_0x24ea('0x3b')](_0x4e4b98['query'],_0x2e125a[_0x24ea('0x30')]));if(_0x4e4b98[_0x24ea('0x2f')][_0x24ea('0x3c')]){_0x1589f9['where']=_[_0x24ea('0x3d')](_0x1589f9[_0x24ea('0x3a')],{'$or':_['map'](_0x1589f9[_0x24ea('0x33')],function(_0x1b362a){var _0x31a701={};_0x31a701[_0x1b362a]={'$like':'%'+_0x4e4b98[_0x24ea('0x2f')][_0x24ea('0x3c')]+'%'};return _0x31a701;})});}_0x1589f9=_[_0x24ea('0x3d')]({},_0x1589f9,_0x4e4b98[_0x24ea('0x3f')]);return _0x39977f[_0x24ea('0x4a')](_0x1589f9);}})['then'](function(_0x19cf82){if(_0x19cf82){_0x1c48ef=_0x19cf82['length'];if(!_0x4e4b98['query'][_0x24ea('0x36')](_0x24ea('0x37'))){_0x1589f9[_0x24ea('0x1c')]=qs[_0x24ea('0x1c')](_0x4e4b98[_0x24ea('0x2f')][_0x24ea('0x1c')]);_0x1589f9['offset']=qs[_0x24ea('0x1b')](_0x4e4b98['query'][_0x24ea('0x1b')]);}return _0x39977f['getConfigurations'](_0x1589f9);}})[_0x24ea('0x24')](function(_0x543a63){if(_0x543a63){return _0x543a63?{'count':_0x1c48ef,'rows':_0x543a63}:null;}})[_0x24ea('0x24')](respondWithResult(_0x4f144a,null))[_0x24ea('0x44')](handleError(_0x4f144a,null));};exports[_0x24ea('0x4d')]=function(_0x436250,_0x296d92,_0x3eacd5){if(_0x436250['body']['id']){delete _0x436250['body']['id'];}return db[_0x24ea('0x2b')][_0x24ea('0x4b')]({'where':{'id':_0x436250[_0x24ea('0x46')]['id']}})[_0x24ea('0x24')](handleEntityNotFound(_0x296d92,null))[_0x24ea('0x24')](function(_0x1e34c8){if(_0x1e34c8){_0x436250[_0x24ea('0x49')][_0x24ea('0x4e')]=_0x1e34c8['id'];_0x436250[_0x24ea('0x49')][_0x24ea('0x4f')]=integrations['getSubjects'](_0x436250[_0x24ea('0x49')][_0x24ea('0x50')],_0x436250[_0x24ea('0x49')][_0x24ea('0x2d')]);_0x436250[_0x24ea('0x49')][_0x24ea('0x51')]=integrations[_0x24ea('0x52')](_0x436250[_0x24ea('0x49')][_0x24ea('0x50')],_0x436250[_0x24ea('0x49')][_0x24ea('0x2d')]);return db[_0x24ea('0x4c')][_0x24ea('0x48')](_0x436250[_0x24ea('0x49')],{'include':[{'model':db[_0x24ea('0x53')],'as':'Subjects'},{'model':db[_0x24ea('0x53')],'as':'Descriptions'}]});}return null;})[_0x24ea('0x24')](respondWithResult(_0x296d92,null))[_0x24ea('0x44')](handleError(_0x296d92,null));};exports[_0x24ea('0x54')]=function(_0x3699fc,_0x50d39e,_0xd4f466){var _0x4391cc;var _0x1cda23='';var _0x10684e=_0x24ea('0x55');return db[_0x24ea('0x2b')][_0x24ea('0x4b')]({'where':{'id':_0x3699fc[_0x24ea('0x46')]['id']},'attributes':['id',_0x24ea('0x56'),'clientId','clientSecret',_0x24ea('0x57'),_0x24ea('0x58'),_0x24ea('0x59')]})[_0x24ea('0x24')](handleEntityNotFound(_0x50d39e,null))[_0x24ea('0x24')](function(_0x4b49bd){if(_0x4b49bd){_0x1cda23=_0x4b49bd[_0x24ea('0x56')];var _0x420c93=_0x1cda23['slice'](-0x1);if(_0x420c93==='/'){_0x1cda23=_0x1cda23[_0x24ea('0x5a')](0x0,_0x1cda23[_0x24ea('0x5b')](_0x420c93));}_0x4391cc=new jsforce[(_0x24ea('0x5c'))]({'oauth2':{'loginUrl':_0x1cda23,'clientId':_0x4b49bd[_0x24ea('0x5d')],'clientSecret':_0x4b49bd[_0x24ea('0x5e')]}});return _0x4391cc['login'](_0x4b49bd[_0x24ea('0x57')],_0x4b49bd[_0x24ea('0x58')]['concat'](_0x4b49bd[_0x24ea('0x59')]));}})[_0x24ea('0x24')](function(_0x188d6e){if(_0x188d6e){if(!_[_0x24ea('0x5f')](_0x3699fc[_0x24ea('0x2f')][_0x24ea('0x60')])){_0x10684e=_0x3699fc[_0x24ea('0x2f')]['ticketType'];}return _0x4391cc[_0x24ea('0x61')](_0x10684e)[_0x24ea('0x62')]();}})['then'](function(_0x273788){var _0x476cd1=[_0x24ea('0x63'),'ActivityDate',_0x24ea('0x64'),_0x24ea('0x65'),_0x24ea('0x66'),'Description'];var _0xff50=[_0x24ea('0x67'),_0x24ea('0x68'),'picklist',_0x24ea('0x69'),_0x24ea('0x6a'),_0x24ea('0x6b'),_0x24ea('0x6c')];if(_0x273788){_[_0x24ea('0x6d')](_0x273788[_0x24ea('0x34')],function(_0x37e825){return _0x476cd1['includes'](_0x37e825[_0x24ea('0x27')])||!_0xff50['includes'](_0x37e825[_0x24ea('0x2d')]);});return{'count':_0x273788[_0x24ea('0x34')][_0x24ea('0x35')],'rows':_['map'](_0x273788[_0x24ea('0x34')],function(_0x2c1756){return{'id':_0x2c1756[_0x24ea('0x27')],'name':_0x2c1756['label'],'custom':_0x2c1756[_0x24ea('0x6e')],'options':_0x2c1756[_0x24ea('0x6f')]['length']>0x0?_[_0x24ea('0x2a')](_0x2c1756[_0x24ea('0x6f')],function(_0x4efccf){return{'name':_0x4efccf[_0x24ea('0x70')],'value':_0x4efccf[_0x24ea('0x71')]};}):_0x2c1756[_0x24ea('0x2d')]==_0x24ea('0x69')?[{'name':'True','value':_0x24ea('0x72')},{'name':_0x24ea('0x73'),'value':_0x24ea('0x74')}]:[]};})};}})[_0x24ea('0x24')](respondWithResult(_0x50d39e,null))[_0x24ea('0x44')](function(_0x5a84d2){var _0x1550ca=_0x3699fc['query'][_0x24ea('0x75')]?0x1f4:_0x5a84d2[_0x24ea('0x76')]||0x1f4;logger[_0x24ea('0x26')](_0x24ea('0x77'),_0x24ea('0x54'),_0x1550ca,JSON[_0x24ea('0x78')](_0x5a84d2));delete _0x5a84d2[_0x24ea('0x27')];if(_0x1550ca===0x191){_0x1550ca=0x190;}_0x50d39e[_0x24ea('0x19')](_0x1550ca)[_0x24ea('0x28')](_0x3699fc['query'][_0x24ea('0x75')]?{'message':_0x24ea('0x79'),'statusCode':_0x5a84d2[_0x24ea('0x76')]}:_0x5a84d2);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index da2ff6c..5b97a37 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 _0x9fdc=['SalesforceAccount','int_salesforce_accounts','util','api','moment','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x4eee9e,_0x57aa9f){var _0x37bc2b=function(_0x34f107){while(--_0x34f107){_0x4eee9e['push'](_0x4eee9e['shift']());}};_0x37bc2b(++_0x57aa9f);}(_0x9fdc,0xce));var _0xc9fd=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9fdc[_0x17b6e3];return _0x3906f3;};'use strict';var _=require('lodash');var util=require(_0xc9fd('0x0'));var logger=require('../../config/logger')(_0xc9fd('0x1'));var moment=require(_0xc9fd('0x2'));var BPromise=require(_0xc9fd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc9fd('0x4'));var rimraf=require(_0xc9fd('0x5'));var config=require(_0xc9fd('0x6'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xc9fd('0x7'));module[_0xc9fd('0x8')]=function(_0x50f0cb,_0x191117){return _0x50f0cb[_0xc9fd('0x9')](_0xc9fd('0xa'),attributes,{'tableName':_0xc9fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6055=['../../config/logger','api','moment','bluebird','path','rimraf','../../components/integrations/configuration','define','SalesforceAccount','lodash','util'];(function(_0xfc42ee,_0x4f05c3){var _0x98b245=function(_0x2cb744){while(--_0x2cb744){_0xfc42ee['push'](_0xfc42ee['shift']());}};_0x98b245(++_0x4f05c3);}(_0x6055,0x15e));var _0x5605=function(_0x147f83,_0x1ae7de){_0x147f83=_0x147f83-0x0;var _0x543f5b=_0x6055[_0x147f83];return _0x543f5b;};'use strict';var _=require(_0x5605('0x0'));var util=require(_0x5605('0x1'));var logger=require(_0x5605('0x2'))(_0x5605('0x3'));var moment=require(_0x5605('0x4'));var BPromise=require(_0x5605('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5605('0x6'));var rimraf=require(_0x5605('0x7'));var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x5605('0x8'));module['exports']=function(_0x5c64fe,_0x40a85e){return _0x5c64fe[_0x5605('0x9')](_0x5605('0xa'),attributes,{'tableName':'int_salesforce_accounts','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 20244d6..2c087df 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 _0xd3ad=['GetSalesforceAccount','ShowSalesforceAccount','find','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','SalesforceAccount','options','raw','attributes','limit','include','map','model'];(function(_0x1c880f,_0x51c1c2){var _0x4a13f3=function(_0x16a9e9){while(--_0x16a9e9){_0x1c880f['push'](_0x1c880f['shift']());}};_0x4a13f3(++_0x51c1c2);}(_0xd3ad,0x90));var _0xdd3a=function(_0x5ce435,_0x14a009){_0x5ce435=_0x5ce435-0x0;var _0x43a035=_0xd3ad[_0x5ce435];return _0x43a035;};'use strict';var _=require(_0xdd3a('0x0'));var util=require(_0xdd3a('0x1'));var moment=require('moment');var BPromise=require(_0xdd3a('0x2'));var rs=require(_0xdd3a('0x3'));var fs=require('fs');var Redis=require(_0xdd3a('0x4'));var db=require(_0xdd3a('0x5'))['db'];var utils=require(_0xdd3a('0x6'));var logger=require(_0xdd3a('0x7'))(_0xdd3a('0x8'));var config=require(_0xdd3a('0x9'));var jayson=require(_0xdd3a('0xa'));var client=jayson['client'][_0xdd3a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x442bda,_0x5d0473,_0x522da8){return new BPromise(function(_0x946716,_0x3da71d){return client[_0xdd3a('0xc')](_0x442bda,_0x522da8)[_0xdd3a('0xd')](function(_0x2fbd61){logger['info'](_0xdd3a('0xe'),_0x5d0473,_0xdd3a('0xf'));logger[_0xdd3a('0x10')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x5d0473,'request\x20sent',JSON[_0xdd3a('0x11')](_0x2fbd61));if(_0x2fbd61[_0xdd3a('0x12')]){if(_0x2fbd61[_0xdd3a('0x12')][_0xdd3a('0x13')]===0x1f4){logger[_0xdd3a('0x12')](_0xdd3a('0xe'),_0x5d0473,_0x2fbd61[_0xdd3a('0x12')][_0xdd3a('0x14')]);return _0x3da71d(_0x2fbd61[_0xdd3a('0x12')][_0xdd3a('0x14')]);}logger['error'](_0xdd3a('0xe'),_0x5d0473,_0x2fbd61[_0xdd3a('0x12')][_0xdd3a('0x14')]);return _0x946716(_0x2fbd61[_0xdd3a('0x12')][_0xdd3a('0x14')]);}else{logger[_0xdd3a('0x15')](_0xdd3a('0xe'),_0x5d0473,_0xdd3a('0xf'));_0x946716(_0x2fbd61['result']['message']);}})[_0xdd3a('0x16')](function(_0x4d6707){logger[_0xdd3a('0x12')](_0xdd3a('0xe'),_0x5d0473,_0x4d6707);_0x3da71d(_0x4d6707);});});}exports['GetSalesforceAccount']=function(_0x5d4117){var _0x24ac06=this;return new Promise(function(_0x4e707c,_0x5f5966){return db[_0xdd3a('0x17')]['findAll']({'raw':_0x5d4117[_0xdd3a('0x18')]?_0x5d4117[_0xdd3a('0x18')][_0xdd3a('0x19')]===undefined?!![]:![]:!![],'where':_0x5d4117[_0xdd3a('0x18')]?_0x5d4117[_0xdd3a('0x18')]['where']||null:null,'attributes':_0x5d4117['options']?_0x5d4117[_0xdd3a('0x18')][_0xdd3a('0x1a')]||null:null,'limit':_0x5d4117[_0xdd3a('0x18')]?_0x5d4117[_0xdd3a('0x18')][_0xdd3a('0x1b')]||null:null,'include':_0x5d4117[_0xdd3a('0x18')]?_0x5d4117[_0xdd3a('0x18')][_0xdd3a('0x1c')]?_[_0xdd3a('0x1d')](_0x5d4117[_0xdd3a('0x18')][_0xdd3a('0x1c')],function(_0x2439da){return{'model':db[_0x2439da[_0xdd3a('0x1e')]],'as':_0x2439da['as'],'attributes':_0x2439da[_0xdd3a('0x1a')],'include':_0x2439da[_0xdd3a('0x1c')]?_['map'](_0x2439da[_0xdd3a('0x1c')],function(_0x33ef95){return{'model':db[_0x33ef95[_0xdd3a('0x1e')]],'as':_0x33ef95['as'],'attributes':_0x33ef95[_0xdd3a('0x1a')],'include':_0x33ef95['include']?_[_0xdd3a('0x1d')](_0x33ef95[_0xdd3a('0x1c')],function(_0x193566){return{'model':db[_0x193566[_0xdd3a('0x1e')]],'as':_0x193566['as'],'attributes':_0x193566[_0xdd3a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xdd3a('0xd')](function(_0x46a422){logger['info']('GetSalesforceAccount',_0x5d4117);logger['debug']('GetSalesforceAccount',_0x5d4117,JSON[_0xdd3a('0x11')](_0x46a422));_0x4e707c(_0x46a422);})[_0xdd3a('0x16')](function(_0x2728c5){logger[_0xdd3a('0x12')](_0xdd3a('0x1f'),_0x2728c5[_0xdd3a('0x14')],_0x5d4117);_0x5f5966(_0x24ac06['error'](0x1f4,_0x2728c5[_0xdd3a('0x14')]));});});};exports[_0xdd3a('0x20')]=function(_0x268d3c){var _0xced190=this;return new Promise(function(_0x5de914,_0x23928b){return db[_0xdd3a('0x17')][_0xdd3a('0x21')]({'raw':_0x268d3c['options']?_0x268d3c['options'][_0xdd3a('0x19')]===undefined?!![]:![]:!![],'where':_0x268d3c['options']?_0x268d3c[_0xdd3a('0x18')][_0xdd3a('0x22')]||null:null,'attributes':_0x268d3c[_0xdd3a('0x18')]?_0x268d3c[_0xdd3a('0x18')][_0xdd3a('0x1a')]||null:null,'include':_0x268d3c['options']?_0x268d3c[_0xdd3a('0x18')][_0xdd3a('0x1c')]?_[_0xdd3a('0x1d')](_0x268d3c['options'][_0xdd3a('0x1c')],function(_0x547feb){return{'model':db[_0x547feb[_0xdd3a('0x1e')]],'as':_0x547feb['as'],'attributes':_0x547feb[_0xdd3a('0x1a')],'include':_0x547feb['include']?_['map'](_0x547feb[_0xdd3a('0x1c')],function(_0x6a3c8a){return{'model':db[_0x6a3c8a[_0xdd3a('0x1e')]],'as':_0x6a3c8a['as'],'attributes':_0x6a3c8a['attributes'],'include':_0x6a3c8a['include']?_['map'](_0x6a3c8a['include'],function(_0xf6871e){return{'model':db[_0xf6871e['model']],'as':_0xf6871e['as'],'attributes':_0xf6871e['attributes']};}):[]};}):[]};}):[]:[]})[_0xdd3a('0xd')](function(_0x9ff171){logger[_0xdd3a('0x15')]('ShowSalesforceAccount',_0x268d3c);logger[_0xdd3a('0x10')](_0xdd3a('0x20'),_0x268d3c,JSON['stringify'](_0x9ff171));_0x5de914(_0x9ff171);})[_0xdd3a('0x16')](function(_0x56999c){logger['error'](_0xdd3a('0x20'),_0x56999c[_0xdd3a('0x14')],_0x268d3c);_0x23928b(_0xced190[_0xdd3a('0x12')](0x1f4,_0x56999c[_0xdd3a('0x14')]));});});}; \ No newline at end of file +var _0x0c73=['ioredis','rpc','jayson/promise','client','then','info','SalesforceAccount,\x20%s,\x20%s','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','raw','where','attributes','limit','include','model','map','debug','ShowSalesforceAccount','find','lodash','util','moment','bluebird','randomstring'];(function(_0x478b8d,_0x4f84c1){var _0x48f84e=function(_0x42f7c8){while(--_0x42f7c8){_0x478b8d['push'](_0x478b8d['shift']());}};_0x48f84e(++_0x4f84c1);}(_0x0c73,0x7f));var _0x30c7=function(_0x219390,_0x1f7d52){_0x219390=_0x219390-0x0;var _0x40f56c=_0x0c73[_0x219390];return _0x40f56c;};'use strict';var _=require(_0x30c7('0x0'));var util=require(_0x30c7('0x1'));var moment=require(_0x30c7('0x2'));var BPromise=require(_0x30c7('0x3'));var rs=require(_0x30c7('0x4'));var fs=require('fs');var Redis=require(_0x30c7('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x30c7('0x6'));var config=require('../../config/environment');var jayson=require(_0x30c7('0x7'));var client=jayson[_0x30c7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25273c,_0x107af2,_0x28a77b){return new BPromise(function(_0x1840ed,_0x169456){return client['request'](_0x25273c,_0x28a77b)[_0x30c7('0x9')](function(_0x209b72){logger[_0x30c7('0xa')](_0x30c7('0xb'),_0x107af2,'request\x20sent');logger['debug'](_0x30c7('0xc'),_0x107af2,_0x30c7('0xd'),JSON[_0x30c7('0xe')](_0x209b72));if(_0x209b72['error']){if(_0x209b72[_0x30c7('0xf')][_0x30c7('0x10')]===0x1f4){logger[_0x30c7('0xf')](_0x30c7('0xb'),_0x107af2,_0x209b72[_0x30c7('0xf')][_0x30c7('0x11')]);return _0x169456(_0x209b72[_0x30c7('0xf')]['message']);}logger[_0x30c7('0xf')](_0x30c7('0xb'),_0x107af2,_0x209b72[_0x30c7('0xf')][_0x30c7('0x11')]);return _0x1840ed(_0x209b72['error'][_0x30c7('0x11')]);}else{logger[_0x30c7('0xa')](_0x30c7('0xb'),_0x107af2,_0x30c7('0xd'));_0x1840ed(_0x209b72[_0x30c7('0x12')][_0x30c7('0x11')]);}})[_0x30c7('0x13')](function(_0x1d5ce7){logger[_0x30c7('0xf')](_0x30c7('0xb'),_0x107af2,_0x1d5ce7);_0x169456(_0x1d5ce7);});});}exports[_0x30c7('0x14')]=function(_0x1d4daf){var _0x5e16f1=this;return new Promise(function(_0x42ad16,_0x1fbdd4){return db[_0x30c7('0x15')]['findAll']({'raw':_0x1d4daf[_0x30c7('0x16')]?_0x1d4daf[_0x30c7('0x16')][_0x30c7('0x17')]===undefined?!![]:![]:!![],'where':_0x1d4daf[_0x30c7('0x16')]?_0x1d4daf[_0x30c7('0x16')][_0x30c7('0x18')]||null:null,'attributes':_0x1d4daf['options']?_0x1d4daf['options'][_0x30c7('0x19')]||null:null,'limit':_0x1d4daf[_0x30c7('0x16')]?_0x1d4daf[_0x30c7('0x16')][_0x30c7('0x1a')]||null:null,'include':_0x1d4daf[_0x30c7('0x16')]?_0x1d4daf[_0x30c7('0x16')][_0x30c7('0x1b')]?_['map'](_0x1d4daf['options'][_0x30c7('0x1b')],function(_0x1df898){return{'model':db[_0x1df898[_0x30c7('0x1c')]],'as':_0x1df898['as'],'attributes':_0x1df898['attributes'],'include':_0x1df898[_0x30c7('0x1b')]?_[_0x30c7('0x1d')](_0x1df898[_0x30c7('0x1b')],function(_0x40339e){return{'model':db[_0x40339e['model']],'as':_0x40339e['as'],'attributes':_0x40339e[_0x30c7('0x19')],'include':_0x40339e[_0x30c7('0x1b')]?_[_0x30c7('0x1d')](_0x40339e[_0x30c7('0x1b')],function(_0x3e8a35){return{'model':db[_0x3e8a35['model']],'as':_0x3e8a35['as'],'attributes':_0x3e8a35[_0x30c7('0x19')]};}):[]};}):[]};}):[]:[]})[_0x30c7('0x9')](function(_0x591a93){logger[_0x30c7('0xa')]('GetSalesforceAccount',_0x1d4daf);logger[_0x30c7('0x1e')](_0x30c7('0x14'),_0x1d4daf,JSON[_0x30c7('0xe')](_0x591a93));_0x42ad16(_0x591a93);})[_0x30c7('0x13')](function(_0x155dd1){logger[_0x30c7('0xf')](_0x30c7('0x14'),_0x155dd1[_0x30c7('0x11')],_0x1d4daf);_0x1fbdd4(_0x5e16f1[_0x30c7('0xf')](0x1f4,_0x155dd1[_0x30c7('0x11')]));});});};exports[_0x30c7('0x1f')]=function(_0x313226){var _0x449fa0=this;return new Promise(function(_0x233938,_0x13b1f3){return db[_0x30c7('0x15')][_0x30c7('0x20')]({'raw':_0x313226['options']?_0x313226[_0x30c7('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x313226[_0x30c7('0x16')]?_0x313226['options']['where']||null:null,'attributes':_0x313226[_0x30c7('0x16')]?_0x313226['options'][_0x30c7('0x19')]||null:null,'include':_0x313226[_0x30c7('0x16')]?_0x313226[_0x30c7('0x16')][_0x30c7('0x1b')]?_['map'](_0x313226['options'][_0x30c7('0x1b')],function(_0x200854){return{'model':db[_0x200854[_0x30c7('0x1c')]],'as':_0x200854['as'],'attributes':_0x200854[_0x30c7('0x19')],'include':_0x200854['include']?_[_0x30c7('0x1d')](_0x200854['include'],function(_0x14632e){return{'model':db[_0x14632e[_0x30c7('0x1c')]],'as':_0x14632e['as'],'attributes':_0x14632e[_0x30c7('0x19')],'include':_0x14632e[_0x30c7('0x1b')]?_[_0x30c7('0x1d')](_0x14632e[_0x30c7('0x1b')],function(_0x207acf){return{'model':db[_0x207acf['model']],'as':_0x207acf['as'],'attributes':_0x207acf[_0x30c7('0x19')]};}):[]};}):[]};}):[]:[]})[_0x30c7('0x9')](function(_0x14f6b4){logger[_0x30c7('0xa')](_0x30c7('0x1f'),_0x313226);logger[_0x30c7('0x1e')](_0x30c7('0x1f'),_0x313226,JSON[_0x30c7('0xe')](_0x14f6b4));_0x233938(_0x14f6b4);})[_0x30c7('0x13')](function(_0x5ea9bb){logger[_0x30c7('0xf')](_0x30c7('0x1f'),_0x5ea9bb[_0x30c7('0x11')],_0x313226);_0x13b1f3(_0x449fa0[_0x30c7('0xf')](0x1f4,_0x5ea9bb['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 98f5750..d4a7129 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 _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x2ac55d,_0x516771){var _0x59486b=function(_0x3e1900){while(--_0x3e1900){_0x2ac55d['push'](_0x2ac55d['shift']());}};_0x59486b(++_0x516771);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5f66[_0x5d4607];return _0x5e4a86;};'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('./intSalesforceConfiguration.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['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file +var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x478ced,_0x157857){var _0x2e8a20=function(_0xfd00a6){while(--_0xfd00a6){_0x478ced['push'](_0x478ced['shift']());}};_0x2e8a20(++_0x157857);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'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('./intSalesforceConfiguration.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['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 4d8c04d..cb530a4 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 _0x8f58=['nothing','sequelize','STRING','ENUM','Task','contact_lead','contact','lead','account'];(function(_0xa35c14,_0xb8d25e){var _0x42fd1b=function(_0xd778ed){while(--_0xd778ed){_0xa35c14['push'](_0xa35c14['shift']());}};_0x42fd1b(++_0xb8d25e);}(_0x8f58,0xeb));var _0x88f5=function(_0x4f3feb,_0x1d1f17){_0x4f3feb=_0x4f3feb-0x0;var _0xf68dfd=_0x8f58[_0x4f3feb];return _0xf68dfd;};'use strict';var Sequelize=require(_0x88f5('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x88f5('0x1')]},'ticketType':{'type':Sequelize[_0x88f5('0x2')](_0x88f5('0x3'),'Case'),'defaultValue':_0x88f5('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0x88f5('0x4'),_0x88f5('0x5'),_0x88f5('0x6'),'account_contact_lead',_0x88f5('0x7')),'defaultValue':_0x88f5('0x4')},'moduleCreate':{'type':Sequelize[_0x88f5('0x2')](_0x88f5('0x8'),_0x88f5('0x5'),'lead','account'),'defaultValue':_0x88f5('0x6')},'leadId':{'type':Sequelize[_0x88f5('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x88f5('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbd45=['ENUM','contact_lead','contact','lead','account','nothing','sequelize','exports','STRING','Task','Case'];(function(_0x261a2e,_0x4eb9fd){var _0x5347d2=function(_0x11e001){while(--_0x11e001){_0x261a2e['push'](_0x261a2e['shift']());}};_0x5347d2(++_0x4eb9fd);}(_0xbd45,0x166));var _0x5bd4=function(_0x53bd57,_0x55cfd9){_0x53bd57=_0x53bd57-0x0;var _0x282a68=_0xbd45[_0x53bd57];return _0x282a68;};'use strict';var Sequelize=require(_0x5bd4('0x0'));module[_0x5bd4('0x1')]={'name':{'type':Sequelize[_0x5bd4('0x2')]},'description':{'type':Sequelize[_0x5bd4('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x5bd4('0x3'),_0x5bd4('0x4')),'defaultValue':_0x5bd4('0x3')},'moduleSearch':{'type':Sequelize[_0x5bd4('0x5')](_0x5bd4('0x6'),_0x5bd4('0x7'),_0x5bd4('0x8'),'account_contact_lead',_0x5bd4('0x9')),'defaultValue':_0x5bd4('0x6')},'moduleCreate':{'type':Sequelize[_0x5bd4('0x5')](_0x5bd4('0xa'),_0x5bd4('0x7'),'lead',_0x5bd4('0x9')),'defaultValue':_0x5bd4('0x8')},'leadId':{'type':Sequelize[_0x5bd4('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x5bd4('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x5bd4('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x5bd4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index e19f6ad..20d5444 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 _0x9f4b=['SalesforceField','getSubjects','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','SalesforceConfiguration','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','create','body','find','getFields','findOne'];(function(_0x34f980,_0x387963){var _0x5069c0=function(_0x581f72){while(--_0x581f72){_0x34f980['push'](_0x34f980['shift']());}};_0x5069c0(++_0x387963);}(_0x9f4b,0xfc));var _0xb9f4=function(_0x20cfab,_0x1e46f1){_0x20cfab=_0x20cfab-0x0;var _0x4c0a22=_0x9f4b[_0x20cfab];return _0x4c0a22;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb9f4('0x0'));var jsonpatch=require(_0xb9f4('0x1'));var rp=require(_0xb9f4('0x2'));var moment=require(_0xb9f4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb9f4('0x4'));var util=require(_0xb9f4('0x5'));var path=require(_0xb9f4('0x6'));var sox=require(_0xb9f4('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb9f4('0x8'));var _=require(_0xb9f4('0x9'));var squel=require(_0xb9f4('0xa'));var crypto=require(_0xb9f4('0xb'));var jsforce=require(_0xb9f4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb9f4('0xd'));var querystring=require('querystring');var Papa=require(_0xb9f4('0xe'));var Redis=require(_0xb9f4('0xf'));var authService=require(_0xb9f4('0x10'));var qs=require(_0xb9f4('0x11'));var as=require(_0xb9f4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb9f4('0x13'))(_0xb9f4('0x14'));var utils=require(_0xb9f4('0x15'));var config=require(_0xb9f4('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb9f4('0x17'))['db'];function respondWithStatusCode(_0x29850f,_0x2e4572){_0x2e4572=_0x2e4572||0xcc;return function(_0x4fb403){if(_0x4fb403){return _0x29850f[_0xb9f4('0x18')](_0x2e4572);}return _0x29850f[_0xb9f4('0x19')](_0x2e4572)[_0xb9f4('0x1a')]();};}function respondWithResult(_0x4c948e,_0x255e35){_0x255e35=_0x255e35||0xc8;return function(_0x42bc1d){if(_0x42bc1d){return _0x4c948e['status'](_0x255e35)[_0xb9f4('0x1b')](_0x42bc1d);}};}function respondWithFilteredResult(_0x2dcabe,_0x15bfad){return function(_0x3c1297){if(_0x3c1297){var _0x24c9b5=typeof _0x15bfad[_0xb9f4('0x1c')]==='undefined'&&typeof _0x15bfad[_0xb9f4('0x1d')]===_0xb9f4('0x1e');var _0x49dd12=_0x3c1297[_0xb9f4('0x1f')];var _0x519040=_0x24c9b5?0x0:_0x15bfad[_0xb9f4('0x1c')];var _0x5f1763=_0x24c9b5?_0x3c1297[_0xb9f4('0x1f')]:_0x15bfad['offset']+_0x15bfad[_0xb9f4('0x1d')];var _0x3f28ca;if(_0x5f1763>=_0x49dd12){_0x5f1763=_0x49dd12;_0x3f28ca=0xc8;}else{_0x3f28ca=0xce;}_0x2dcabe[_0xb9f4('0x19')](_0x3f28ca);return _0x2dcabe[_0xb9f4('0x20')](_0xb9f4('0x21'),_0x519040+'-'+_0x5f1763+'/'+_0x49dd12)[_0xb9f4('0x1b')](_0x3c1297);}return null;};}function patchUpdates(_0x8f6ce){return function(_0x1b1234){try{jsonpatch[_0xb9f4('0x22')](_0x1b1234,_0x8f6ce,!![]);}catch(_0x549f43){return BPromise[_0xb9f4('0x23')](_0x549f43);}return _0x1b1234[_0xb9f4('0x24')]();};}function saveUpdates(_0x5d5a65,_0x2b6a38){return function(_0xe8a6b){if(_0xe8a6b){return _0xe8a6b[_0xb9f4('0x25')](_0x5d5a65)[_0xb9f4('0x26')](function(_0x35742d){return _0x35742d;});}return null;};}function removeEntity(_0x58efa3,_0x48e4a6){return function(_0x2812fd){if(_0x2812fd){return _0x2812fd[_0xb9f4('0x27')]()[_0xb9f4('0x26')](function(){_0x58efa3[_0xb9f4('0x19')](0xcc)[_0xb9f4('0x1a')]();});}};}function handleEntityNotFound(_0x2d1df2,_0x1cea80){return function(_0x3abac2){if(!_0x3abac2){_0x2d1df2[_0xb9f4('0x18')](0x194);}return _0x3abac2;};}function handleError(_0x1dbf39,_0x14ea94){_0x14ea94=_0x14ea94||0x1f4;return function(_0x6b6b89){logger[_0xb9f4('0x28')](_0x6b6b89[_0xb9f4('0x29')]);if(_0x6b6b89[_0xb9f4('0x2a')]){delete _0x6b6b89[_0xb9f4('0x2a')];}_0x1dbf39['status'](_0x14ea94)[_0xb9f4('0x2b')](_0x6b6b89);};}exports['index']=function(_0x382078,_0x107331){var _0x25f43e={},_0x2925dd={},_0x443b72={'count':0x0,'rows':[]};var _0x23fa53=_[_0xb9f4('0x2c')](db[_0xb9f4('0x2d')]['rawAttributes'],function(_0x3cadd0){return{'name':_0x3cadd0[_0xb9f4('0x2e')],'type':_0x3cadd0[_0xb9f4('0x2f')][_0xb9f4('0x30')]};});_0x2925dd[_0xb9f4('0x31')]=_[_0xb9f4('0x2c')](_0x23fa53,'name');_0x2925dd['query']=_[_0xb9f4('0x32')](_0x382078[_0xb9f4('0x33')]);_0x2925dd['filters']=_['intersection'](_0x2925dd[_0xb9f4('0x31')],_0x2925dd[_0xb9f4('0x33')]);_0x25f43e[_0xb9f4('0x34')]=_[_0xb9f4('0x35')](_0x2925dd[_0xb9f4('0x31')],qs[_0xb9f4('0x36')](_0x382078[_0xb9f4('0x33')][_0xb9f4('0x36')]));_0x25f43e[_0xb9f4('0x34')]=_0x25f43e[_0xb9f4('0x34')][_0xb9f4('0x37')]?_0x25f43e['attributes']:_0x2925dd[_0xb9f4('0x31')];if(!_0x382078[_0xb9f4('0x33')][_0xb9f4('0x38')](_0xb9f4('0x39'))){_0x25f43e[_0xb9f4('0x1d')]=qs[_0xb9f4('0x1d')](_0x382078['query']['limit']);_0x25f43e[_0xb9f4('0x1c')]=qs['offset'](_0x382078[_0xb9f4('0x33')]['offset']);}_0x25f43e[_0xb9f4('0x3a')]=qs['sort'](_0x382078['query'][_0xb9f4('0x3b')]);_0x25f43e['where']=qs[_0xb9f4('0x3c')](_[_0xb9f4('0x3d')](_0x382078['query'],_0x2925dd['filters']),_0x23fa53);if(_0x382078['query'][_0xb9f4('0x3e')]){_0x25f43e[_0xb9f4('0x3f')]=_[_0xb9f4('0x40')](_0x25f43e[_0xb9f4('0x3f')],{'$or':_['map'](_0x23fa53,function(_0x14e48e){if(_0x14e48e[_0xb9f4('0x2f')]!==_0xb9f4('0x41')){var _0x21a79c={};_0x21a79c[_0x14e48e[_0xb9f4('0x2a')]]={'$like':'%'+_0x382078[_0xb9f4('0x33')][_0xb9f4('0x3e')]+'%'};return _0x21a79c;}})});}_0x25f43e=_[_0xb9f4('0x40')]({},_0x25f43e,_0x382078[_0xb9f4('0x42')]);var _0x3afbb6={'where':_0x25f43e[_0xb9f4('0x3f')]};return db[_0xb9f4('0x2d')][_0xb9f4('0x1f')](_0x3afbb6)[_0xb9f4('0x26')](function(_0x9ed7cd){_0x443b72[_0xb9f4('0x1f')]=_0x9ed7cd;if(_0x382078[_0xb9f4('0x33')][_0xb9f4('0x43')]){_0x25f43e['include']=[{'all':!![]}];}return db[_0xb9f4('0x2d')][_0xb9f4('0x44')](_0x25f43e);})[_0xb9f4('0x26')](function(_0x1af987){_0x443b72[_0xb9f4('0x45')]=_0x1af987;return _0x443b72;})['then'](respondWithFilteredResult(_0x107331,_0x25f43e))[_0xb9f4('0x46')](handleError(_0x107331,null));};exports[_0xb9f4('0x47')]=function(_0x2e05f2,_0x4252db){var _0x377dd7={'raw':![],'where':{'id':_0x2e05f2[_0xb9f4('0x48')]['id']}},_0x98d591={};_0x98d591[_0xb9f4('0x31')]=_['keys'](db[_0xb9f4('0x2d')][_0xb9f4('0x49')]);_0x98d591[_0xb9f4('0x33')]=_[_0xb9f4('0x32')](_0x2e05f2['query']);_0x98d591[_0xb9f4('0x3c')]=_['intersection'](_0x98d591[_0xb9f4('0x31')],_0x98d591[_0xb9f4('0x33')]);_0x377dd7[_0xb9f4('0x34')]=_['intersection'](_0x98d591['model'],qs[_0xb9f4('0x36')](_0x2e05f2[_0xb9f4('0x33')][_0xb9f4('0x36')]));_0x377dd7[_0xb9f4('0x34')]=_0x377dd7[_0xb9f4('0x34')]['length']?_0x377dd7[_0xb9f4('0x34')]:_0x98d591[_0xb9f4('0x31')];if(_0x2e05f2[_0xb9f4('0x33')][_0xb9f4('0x43')]){_0x377dd7[_0xb9f4('0x4a')]=[{'all':!![]}];}_0x377dd7=_[_0xb9f4('0x40')]({},_0x377dd7,_0x2e05f2[_0xb9f4('0x42')]);return db['SalesforceConfiguration']['find'](_0x377dd7)[_0xb9f4('0x26')](handleEntityNotFound(_0x4252db,null))[_0xb9f4('0x26')](respondWithResult(_0x4252db,null))[_0xb9f4('0x46')](handleError(_0x4252db,null));};exports[_0xb9f4('0x4b')]=function(_0x2aef3c,_0x509093){return db[_0xb9f4('0x2d')]['create'](_0x2aef3c[_0xb9f4('0x4c')],{})['then'](respondWithResult(_0x509093,0xc9))[_0xb9f4('0x46')](handleError(_0x509093,null));};exports[_0xb9f4('0x25')]=function(_0x23299b,_0xef69c8){if(_0x23299b[_0xb9f4('0x4c')]['id']){delete _0x23299b[_0xb9f4('0x4c')]['id'];}return db['SalesforceConfiguration'][_0xb9f4('0x4d')]({'where':{'id':_0x23299b[_0xb9f4('0x48')]['id']}})['then'](handleEntityNotFound(_0xef69c8,null))[_0xb9f4('0x26')](saveUpdates(_0x23299b[_0xb9f4('0x4c')],null))[_0xb9f4('0x26')](respondWithResult(_0xef69c8,null))['catch'](handleError(_0xef69c8,null));};exports[_0xb9f4('0x27')]=function(_0x28ac96,_0x4ed7ee){return db[_0xb9f4('0x2d')][_0xb9f4('0x4d')]({'where':{'id':_0x28ac96[_0xb9f4('0x48')]['id']}})[_0xb9f4('0x26')](handleEntityNotFound(_0x4ed7ee,null))[_0xb9f4('0x26')](removeEntity(_0x4ed7ee,null))[_0xb9f4('0x46')](handleError(_0x4ed7ee,null));};exports[_0xb9f4('0x4e')]=function(_0x9dc3bc,_0x388e1a,_0x5dfb65){var _0x4e6d3f={};var _0x54799e={};var _0x321201;var _0x2f06a3;return db[_0xb9f4('0x2d')][_0xb9f4('0x4f')]({'where':{'id':_0x9dc3bc[_0xb9f4('0x48')]['id']}})[_0xb9f4('0x26')](handleEntityNotFound(_0x388e1a,null))['then'](function(_0x3e26e1){if(_0x3e26e1){_0x321201=_0x3e26e1;_0x54799e[_0xb9f4('0x31')]=_[_0xb9f4('0x32')](db[_0xb9f4('0x50')]['rawAttributes']);_0x54799e['query']=_['keys'](_0x9dc3bc[_0xb9f4('0x33')]);_0x54799e['filters']=_[_0xb9f4('0x35')](_0x54799e['model'],_0x54799e[_0xb9f4('0x33')]);_0x4e6d3f[_0xb9f4('0x34')]=_['intersection'](_0x54799e[_0xb9f4('0x31')],qs[_0xb9f4('0x36')](_0x9dc3bc[_0xb9f4('0x33')]['fields']));_0x4e6d3f[_0xb9f4('0x34')]=_0x4e6d3f[_0xb9f4('0x34')][_0xb9f4('0x37')]?_0x4e6d3f['attributes']:_0x54799e[_0xb9f4('0x31')];_0x4e6d3f[_0xb9f4('0x3a')]=qs[_0xb9f4('0x3b')](_0x9dc3bc[_0xb9f4('0x33')][_0xb9f4('0x3b')]);_0x4e6d3f[_0xb9f4('0x3f')]=qs[_0xb9f4('0x3c')](_[_0xb9f4('0x3d')](_0x9dc3bc[_0xb9f4('0x33')],_0x54799e[_0xb9f4('0x3c')]));if(_0x9dc3bc[_0xb9f4('0x33')][_0xb9f4('0x3e')]){_0x4e6d3f['where']=_['merge'](_0x4e6d3f[_0xb9f4('0x3f')],{'$or':_['map'](_0x4e6d3f[_0xb9f4('0x34')],function(_0x563998){var _0x336399={};_0x336399[_0x563998]={'$like':'%'+_0x9dc3bc[_0xb9f4('0x33')]['filter']+'%'};return _0x336399;})});}_0x4e6d3f=_[_0xb9f4('0x40')]({},_0x4e6d3f,_0x9dc3bc[_0xb9f4('0x42')]);return _0x321201['getFields'](_0x4e6d3f);}})[_0xb9f4('0x26')](function(_0x3c2c51){if(_0x3c2c51){_0x2f06a3=_0x3c2c51[_0xb9f4('0x37')];if(!_0x9dc3bc[_0xb9f4('0x33')][_0xb9f4('0x38')](_0xb9f4('0x39'))){_0x4e6d3f[_0xb9f4('0x1d')]=qs['limit'](_0x9dc3bc[_0xb9f4('0x33')]['limit']);_0x4e6d3f['offset']=qs[_0xb9f4('0x1c')](_0x9dc3bc['query']['offset']);}return _0x321201[_0xb9f4('0x4e')](_0x4e6d3f);}})[_0xb9f4('0x26')](function(_0xbd904b){if(_0xbd904b){return _0xbd904b?{'count':_0x2f06a3,'rows':_0xbd904b}:null;}})[_0xb9f4('0x26')](respondWithResult(_0x388e1a,null))[_0xb9f4('0x46')](handleError(_0x388e1a,null));};exports[_0xb9f4('0x51')]=function(_0x1216fb,_0x7a74,_0x3fcdba){var _0x2e1405={};var _0x222991={};var _0x12ae8d;var _0x5434e8;return db[_0xb9f4('0x2d')]['findOne']({'where':{'id':_0x1216fb['params']['id']}})[_0xb9f4('0x26')](handleEntityNotFound(_0x7a74,null))[_0xb9f4('0x26')](function(_0xe86674){if(_0xe86674){_0x12ae8d=_0xe86674;_0x222991['model']=_[_0xb9f4('0x32')](db[_0xb9f4('0x50')][_0xb9f4('0x49')]);_0x222991['query']=_['keys'](_0x1216fb[_0xb9f4('0x33')]);_0x222991[_0xb9f4('0x3c')]=_[_0xb9f4('0x35')](_0x222991[_0xb9f4('0x31')],_0x222991[_0xb9f4('0x33')]);_0x2e1405['attributes']=_[_0xb9f4('0x35')](_0x222991[_0xb9f4('0x31')],qs[_0xb9f4('0x36')](_0x1216fb[_0xb9f4('0x33')][_0xb9f4('0x36')]));_0x2e1405[_0xb9f4('0x34')]=_0x2e1405[_0xb9f4('0x34')][_0xb9f4('0x37')]?_0x2e1405[_0xb9f4('0x34')]:_0x222991[_0xb9f4('0x31')];_0x2e1405[_0xb9f4('0x3a')]=qs[_0xb9f4('0x3b')](_0x1216fb[_0xb9f4('0x33')]['sort']);_0x2e1405[_0xb9f4('0x3f')]=qs[_0xb9f4('0x3c')](_[_0xb9f4('0x3d')](_0x1216fb[_0xb9f4('0x33')],_0x222991['filters']));if(_0x1216fb[_0xb9f4('0x33')][_0xb9f4('0x3e')]){_0x2e1405[_0xb9f4('0x3f')]=_['merge'](_0x2e1405['where'],{'$or':_[_0xb9f4('0x2c')](_0x2e1405[_0xb9f4('0x34')],function(_0x4cfc42){var _0x1cfc7b={};_0x1cfc7b[_0x4cfc42]={'$like':'%'+_0x1216fb[_0xb9f4('0x33')][_0xb9f4('0x3e')]+'%'};return _0x1cfc7b;})});}_0x2e1405=_[_0xb9f4('0x40')]({},_0x2e1405,_0x1216fb[_0xb9f4('0x42')]);return _0x12ae8d[_0xb9f4('0x51')](_0x2e1405);}})[_0xb9f4('0x26')](function(_0x473bbe){if(_0x473bbe){_0x5434e8=_0x473bbe[_0xb9f4('0x37')];if(!_0x1216fb[_0xb9f4('0x33')][_0xb9f4('0x38')](_0xb9f4('0x39'))){_0x2e1405[_0xb9f4('0x1d')]=qs[_0xb9f4('0x1d')](_0x1216fb[_0xb9f4('0x33')][_0xb9f4('0x1d')]);_0x2e1405[_0xb9f4('0x1c')]=qs[_0xb9f4('0x1c')](_0x1216fb[_0xb9f4('0x33')][_0xb9f4('0x1c')]);}return _0x12ae8d[_0xb9f4('0x51')](_0x2e1405);}})[_0xb9f4('0x26')](function(_0x49068c){if(_0x49068c){return _0x49068c?{'count':_0x5434e8,'rows':_0x49068c}:null;}})[_0xb9f4('0x26')](respondWithResult(_0x7a74,null))['catch'](handleError(_0x7a74,null));};exports[_0xb9f4('0x52')]=function(_0x4c4734,_0x50a7b8,_0x747eba){var _0x4e4c42={};var _0x29d667={};var _0x131ecc;var _0xf42c44;return db[_0xb9f4('0x2d')][_0xb9f4('0x4f')]({'where':{'id':_0x4c4734['params']['id']}})[_0xb9f4('0x26')](handleEntityNotFound(_0x50a7b8,null))['then'](function(_0x15444f){if(_0x15444f){_0x131ecc=_0x15444f;_0x29d667['model']=_[_0xb9f4('0x32')](db['SalesforceField'][_0xb9f4('0x49')]);_0x29d667['query']=_[_0xb9f4('0x32')](_0x4c4734[_0xb9f4('0x33')]);_0x29d667[_0xb9f4('0x3c')]=_[_0xb9f4('0x35')](_0x29d667[_0xb9f4('0x31')],_0x29d667['query']);_0x4e4c42[_0xb9f4('0x34')]=_['intersection'](_0x29d667[_0xb9f4('0x31')],qs[_0xb9f4('0x36')](_0x4c4734[_0xb9f4('0x33')][_0xb9f4('0x36')]));_0x4e4c42['attributes']=_0x4e4c42['attributes'][_0xb9f4('0x37')]?_0x4e4c42[_0xb9f4('0x34')]:_0x29d667[_0xb9f4('0x31')];_0x4e4c42[_0xb9f4('0x3a')]=qs[_0xb9f4('0x3b')](_0x4c4734[_0xb9f4('0x33')][_0xb9f4('0x3b')]);_0x4e4c42[_0xb9f4('0x3f')]=qs[_0xb9f4('0x3c')](_[_0xb9f4('0x3d')](_0x4c4734[_0xb9f4('0x33')],_0x29d667[_0xb9f4('0x3c')]));if(_0x4c4734[_0xb9f4('0x33')]['filter']){_0x4e4c42[_0xb9f4('0x3f')]=_[_0xb9f4('0x40')](_0x4e4c42[_0xb9f4('0x3f')],{'$or':_['map'](_0x4e4c42[_0xb9f4('0x34')],function(_0x1fd457){var _0x1bc86f={};_0x1bc86f[_0x1fd457]={'$like':'%'+_0x4c4734[_0xb9f4('0x33')][_0xb9f4('0x3e')]+'%'};return _0x1bc86f;})});}_0x4e4c42=_[_0xb9f4('0x40')]({},_0x4e4c42,_0x4c4734[_0xb9f4('0x42')]);return _0x131ecc[_0xb9f4('0x52')](_0x4e4c42);}})[_0xb9f4('0x26')](function(_0x2bbd10){if(_0x2bbd10){_0xf42c44=_0x2bbd10['length'];if(!_0x4c4734[_0xb9f4('0x33')]['hasOwnProperty'](_0xb9f4('0x39'))){_0x4e4c42[_0xb9f4('0x1d')]=qs[_0xb9f4('0x1d')](_0x4c4734[_0xb9f4('0x33')][_0xb9f4('0x1d')]);_0x4e4c42['offset']=qs[_0xb9f4('0x1c')](_0x4c4734[_0xb9f4('0x33')][_0xb9f4('0x1c')]);}return _0x131ecc['getDescriptions'](_0x4e4c42);}})['then'](function(_0x181644){if(_0x181644){return _0x181644?{'count':_0xf42c44,'rows':_0x181644}:null;}})[_0xb9f4('0x26')](respondWithResult(_0x50a7b8,null))[_0xb9f4('0x46')](handleError(_0x50a7b8,null));}; \ No newline at end of file +var _0x048f=['offset','undefined','limit','count','set','apply','then','destroy','stack','name','send','index','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','include','find','create','body','getFields','SalesforceField','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json'];(function(_0x4dcf0c,_0x35e342){var _0x5396bb=function(_0x5062da){while(--_0x5062da){_0x4dcf0c['push'](_0x4dcf0c['shift']());}};_0x5396bb(++_0x35e342);}(_0x048f,0xcd));var _0xf048=function(_0x5d6bd6,_0x1eb18a){_0x5d6bd6=_0x5d6bd6-0x0;var _0x3b8649=_0x048f[_0x5d6bd6];return _0x3b8649;};'use strict';var emlformat=require(_0xf048('0x0'));var rimraf=require(_0xf048('0x1'));var zipdir=require(_0xf048('0x2'));var jsonpatch=require(_0xf048('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf048('0x4'));var Mustache=require(_0xf048('0x5'));var util=require(_0xf048('0x6'));var path=require(_0xf048('0x7'));var sox=require(_0xf048('0x8'));var csv=require(_0xf048('0x9'));var ejs=require(_0xf048('0xa'));var fs=require('fs');var fs_extra=require(_0xf048('0xb'));var _=require(_0xf048('0xc'));var squel=require(_0xf048('0xd'));var crypto=require(_0xf048('0xe'));var jsforce=require(_0xf048('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf048('0x9'));var querystring=require('querystring');var Papa=require(_0xf048('0x10'));var Redis=require(_0xf048('0x11'));var authService=require(_0xf048('0x12'));var qs=require(_0xf048('0x13'));var as=require(_0xf048('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf048('0x15'));var utils=require(_0xf048('0x16'));var config=require(_0xf048('0x17'));var licenseUtil=require(_0xf048('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c3742,_0x521475){_0x521475=_0x521475||0xcc;return function(_0x269c5a){if(_0x269c5a){return _0x2c3742[_0xf048('0x19')](_0x521475);}return _0x2c3742[_0xf048('0x1a')](_0x521475)[_0xf048('0x1b')]();};}function respondWithResult(_0x202932,_0x4d6849){_0x4d6849=_0x4d6849||0xc8;return function(_0x5a6a1b){if(_0x5a6a1b){return _0x202932['status'](_0x4d6849)[_0xf048('0x1c')](_0x5a6a1b);}};}function respondWithFilteredResult(_0x3a2994,_0x53f2a5){return function(_0x2f9af9){if(_0x2f9af9){var _0x38137e=typeof _0x53f2a5[_0xf048('0x1d')]===_0xf048('0x1e')&&typeof _0x53f2a5[_0xf048('0x1f')]===_0xf048('0x1e');var _0x414875=_0x2f9af9['count'];var _0x42609b=_0x38137e?0x0:_0x53f2a5[_0xf048('0x1d')];var _0x284899=_0x38137e?_0x2f9af9[_0xf048('0x20')]:_0x53f2a5['offset']+_0x53f2a5[_0xf048('0x1f')];var _0x265c82;if(_0x284899>=_0x414875){_0x284899=_0x414875;_0x265c82=0xc8;}else{_0x265c82=0xce;}_0x3a2994[_0xf048('0x1a')](_0x265c82);return _0x3a2994[_0xf048('0x21')]('Content-Range',_0x42609b+'-'+_0x284899+'/'+_0x414875)['json'](_0x2f9af9);}return null;};}function patchUpdates(_0x1c6fdf){return function(_0x37b659){try{jsonpatch[_0xf048('0x22')](_0x37b659,_0x1c6fdf,!![]);}catch(_0x342166){return BPromise['reject'](_0x342166);}return _0x37b659['save']();};}function saveUpdates(_0x337f96,_0x374930){return function(_0x1955a7){if(_0x1955a7){return _0x1955a7['update'](_0x337f96)[_0xf048('0x23')](function(_0x59fbc0){return _0x59fbc0;});}return null;};}function removeEntity(_0xa86146,_0x4e2630){return function(_0xf34e63){if(_0xf34e63){return _0xf34e63[_0xf048('0x24')]()[_0xf048('0x23')](function(){_0xa86146[_0xf048('0x1a')](0xcc)[_0xf048('0x1b')]();});}};}function handleEntityNotFound(_0x57152f,_0xa90a3d){return function(_0x5dc012){if(!_0x5dc012){_0x57152f[_0xf048('0x19')](0x194);}return _0x5dc012;};}function handleError(_0x486163,_0x352d92){_0x352d92=_0x352d92||0x1f4;return function(_0xcae83c){logger['error'](_0xcae83c[_0xf048('0x25')]);if(_0xcae83c[_0xf048('0x26')]){delete _0xcae83c[_0xf048('0x26')];}_0x486163[_0xf048('0x1a')](_0x352d92)[_0xf048('0x27')](_0xcae83c);};}exports[_0xf048('0x28')]=function(_0x378c57,_0x5e6064){var _0x59d4b5={},_0x24d5f3={},_0x1477ee={'count':0x0,'rows':[]};var _0x1f1bd6=_['map'](db[_0xf048('0x29')][_0xf048('0x2a')],function(_0x5e7c82){return{'name':_0x5e7c82[_0xf048('0x2b')],'type':_0x5e7c82[_0xf048('0x2c')][_0xf048('0x2d')]};});_0x24d5f3[_0xf048('0x2e')]=_['map'](_0x1f1bd6,'name');_0x24d5f3[_0xf048('0x2f')]=_['keys'](_0x378c57['query']);_0x24d5f3[_0xf048('0x30')]=_[_0xf048('0x31')](_0x24d5f3[_0xf048('0x2e')],_0x24d5f3[_0xf048('0x2f')]);_0x59d4b5[_0xf048('0x32')]=_[_0xf048('0x31')](_0x24d5f3['model'],qs[_0xf048('0x33')](_0x378c57[_0xf048('0x2f')][_0xf048('0x33')]));_0x59d4b5[_0xf048('0x32')]=_0x59d4b5[_0xf048('0x32')][_0xf048('0x34')]?_0x59d4b5[_0xf048('0x32')]:_0x24d5f3[_0xf048('0x2e')];if(!_0x378c57[_0xf048('0x2f')][_0xf048('0x35')](_0xf048('0x36'))){_0x59d4b5[_0xf048('0x1f')]=qs[_0xf048('0x1f')](_0x378c57[_0xf048('0x2f')][_0xf048('0x1f')]);_0x59d4b5[_0xf048('0x1d')]=qs[_0xf048('0x1d')](_0x378c57[_0xf048('0x2f')]['offset']);}_0x59d4b5[_0xf048('0x37')]=qs[_0xf048('0x38')](_0x378c57['query'][_0xf048('0x38')]);_0x59d4b5[_0xf048('0x39')]=qs[_0xf048('0x30')](_['pick'](_0x378c57[_0xf048('0x2f')],_0x24d5f3[_0xf048('0x30')]),_0x1f1bd6);if(_0x378c57[_0xf048('0x2f')][_0xf048('0x3a')]){_0x59d4b5[_0xf048('0x39')]=_[_0xf048('0x3b')](_0x59d4b5[_0xf048('0x39')],{'$or':_[_0xf048('0x3c')](_0x1f1bd6,function(_0x13eb94){if(_0x13eb94[_0xf048('0x2c')]!==_0xf048('0x3d')){var _0x5b20f8={};_0x5b20f8[_0x13eb94['name']]={'$like':'%'+_0x378c57[_0xf048('0x2f')][_0xf048('0x3a')]+'%'};return _0x5b20f8;}})});}_0x59d4b5=_[_0xf048('0x3b')]({},_0x59d4b5,_0x378c57[_0xf048('0x3e')]);var _0x6361e4={'where':_0x59d4b5[_0xf048('0x39')]};return db[_0xf048('0x29')]['count'](_0x6361e4)[_0xf048('0x23')](function(_0xfe2fc6){_0x1477ee[_0xf048('0x20')]=_0xfe2fc6;if(_0x378c57['query'][_0xf048('0x3f')]){_0x59d4b5['include']=[{'all':!![]}];}return db[_0xf048('0x29')][_0xf048('0x40')](_0x59d4b5);})[_0xf048('0x23')](function(_0x1b797d){_0x1477ee[_0xf048('0x41')]=_0x1b797d;return _0x1477ee;})[_0xf048('0x23')](respondWithFilteredResult(_0x5e6064,_0x59d4b5))[_0xf048('0x42')](handleError(_0x5e6064,null));};exports['show']=function(_0x3aa5c1,_0x825b88){var _0x31bca7={'raw':![],'where':{'id':_0x3aa5c1[_0xf048('0x43')]['id']}},_0x45afcc={};_0x45afcc[_0xf048('0x2e')]=_[_0xf048('0x44')](db[_0xf048('0x29')][_0xf048('0x2a')]);_0x45afcc[_0xf048('0x2f')]=_[_0xf048('0x44')](_0x3aa5c1[_0xf048('0x2f')]);_0x45afcc[_0xf048('0x30')]=_[_0xf048('0x31')](_0x45afcc[_0xf048('0x2e')],_0x45afcc[_0xf048('0x2f')]);_0x31bca7['attributes']=_['intersection'](_0x45afcc[_0xf048('0x2e')],qs['fields'](_0x3aa5c1['query']['fields']));_0x31bca7[_0xf048('0x32')]=_0x31bca7[_0xf048('0x32')][_0xf048('0x34')]?_0x31bca7[_0xf048('0x32')]:_0x45afcc[_0xf048('0x2e')];if(_0x3aa5c1[_0xf048('0x2f')][_0xf048('0x3f')]){_0x31bca7[_0xf048('0x45')]=[{'all':!![]}];}_0x31bca7=_[_0xf048('0x3b')]({},_0x31bca7,_0x3aa5c1['options']);return db[_0xf048('0x29')][_0xf048('0x46')](_0x31bca7)[_0xf048('0x23')](handleEntityNotFound(_0x825b88,null))[_0xf048('0x23')](respondWithResult(_0x825b88,null))['catch'](handleError(_0x825b88,null));};exports[_0xf048('0x47')]=function(_0x4da748,_0x871462){return db[_0xf048('0x29')][_0xf048('0x47')](_0x4da748[_0xf048('0x48')],{})[_0xf048('0x23')](respondWithResult(_0x871462,0xc9))[_0xf048('0x42')](handleError(_0x871462,null));};exports['update']=function(_0x1eb104,_0x12bb63){if(_0x1eb104[_0xf048('0x48')]['id']){delete _0x1eb104[_0xf048('0x48')]['id'];}return db[_0xf048('0x29')][_0xf048('0x46')]({'where':{'id':_0x1eb104['params']['id']}})[_0xf048('0x23')](handleEntityNotFound(_0x12bb63,null))[_0xf048('0x23')](saveUpdates(_0x1eb104[_0xf048('0x48')],null))[_0xf048('0x23')](respondWithResult(_0x12bb63,null))[_0xf048('0x42')](handleError(_0x12bb63,null));};exports[_0xf048('0x24')]=function(_0x5fdfb9,_0x2d2b3d){return db[_0xf048('0x29')]['find']({'where':{'id':_0x5fdfb9[_0xf048('0x43')]['id']}})['then'](handleEntityNotFound(_0x2d2b3d,null))['then'](removeEntity(_0x2d2b3d,null))[_0xf048('0x42')](handleError(_0x2d2b3d,null));};exports[_0xf048('0x49')]=function(_0x23d86c,_0x255cf4,_0x3406aa){var _0x383603={};var _0x17b10d={};var _0x281d2c;var _0x3de586;return db[_0xf048('0x29')]['findOne']({'where':{'id':_0x23d86c[_0xf048('0x43')]['id']}})['then'](handleEntityNotFound(_0x255cf4,null))['then'](function(_0x867430){if(_0x867430){_0x281d2c=_0x867430;_0x17b10d[_0xf048('0x2e')]=_[_0xf048('0x44')](db[_0xf048('0x4a')][_0xf048('0x2a')]);_0x17b10d[_0xf048('0x2f')]=_[_0xf048('0x44')](_0x23d86c[_0xf048('0x2f')]);_0x17b10d[_0xf048('0x30')]=_[_0xf048('0x31')](_0x17b10d['model'],_0x17b10d[_0xf048('0x2f')]);_0x383603[_0xf048('0x32')]=_[_0xf048('0x31')](_0x17b10d[_0xf048('0x2e')],qs[_0xf048('0x33')](_0x23d86c[_0xf048('0x2f')][_0xf048('0x33')]));_0x383603[_0xf048('0x32')]=_0x383603[_0xf048('0x32')][_0xf048('0x34')]?_0x383603[_0xf048('0x32')]:_0x17b10d[_0xf048('0x2e')];_0x383603['order']=qs[_0xf048('0x38')](_0x23d86c[_0xf048('0x2f')]['sort']);_0x383603[_0xf048('0x39')]=qs['filters'](_[_0xf048('0x4b')](_0x23d86c['query'],_0x17b10d[_0xf048('0x30')]));if(_0x23d86c['query']['filter']){_0x383603['where']=_['merge'](_0x383603[_0xf048('0x39')],{'$or':_[_0xf048('0x3c')](_0x383603[_0xf048('0x32')],function(_0xdafd3d){var _0x5717de={};_0x5717de[_0xdafd3d]={'$like':'%'+_0x23d86c[_0xf048('0x2f')][_0xf048('0x3a')]+'%'};return _0x5717de;})});}_0x383603=_[_0xf048('0x3b')]({},_0x383603,_0x23d86c[_0xf048('0x3e')]);return _0x281d2c['getFields'](_0x383603);}})['then'](function(_0x1be0d5){if(_0x1be0d5){_0x3de586=_0x1be0d5['length'];if(!_0x23d86c[_0xf048('0x2f')][_0xf048('0x35')](_0xf048('0x36'))){_0x383603[_0xf048('0x1f')]=qs[_0xf048('0x1f')](_0x23d86c[_0xf048('0x2f')][_0xf048('0x1f')]);_0x383603[_0xf048('0x1d')]=qs[_0xf048('0x1d')](_0x23d86c[_0xf048('0x2f')][_0xf048('0x1d')]);}return _0x281d2c[_0xf048('0x49')](_0x383603);}})[_0xf048('0x23')](function(_0x317930){if(_0x317930){return _0x317930?{'count':_0x3de586,'rows':_0x317930}:null;}})[_0xf048('0x23')](respondWithResult(_0x255cf4,null))[_0xf048('0x42')](handleError(_0x255cf4,null));};exports[_0xf048('0x4c')]=function(_0x153c48,_0x433f2c,_0x4e7ab1){var _0x383fea={};var _0x2b3862={};var _0x10e6c7;var _0x486af2;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x153c48['params']['id']}})['then'](handleEntityNotFound(_0x433f2c,null))[_0xf048('0x23')](function(_0x88a7fb){if(_0x88a7fb){_0x10e6c7=_0x88a7fb;_0x2b3862[_0xf048('0x2e')]=_[_0xf048('0x44')](db[_0xf048('0x4a')][_0xf048('0x2a')]);_0x2b3862[_0xf048('0x2f')]=_[_0xf048('0x44')](_0x153c48[_0xf048('0x2f')]);_0x2b3862[_0xf048('0x30')]=_[_0xf048('0x31')](_0x2b3862[_0xf048('0x2e')],_0x2b3862['query']);_0x383fea['attributes']=_[_0xf048('0x31')](_0x2b3862[_0xf048('0x2e')],qs[_0xf048('0x33')](_0x153c48[_0xf048('0x2f')][_0xf048('0x33')]));_0x383fea['attributes']=_0x383fea[_0xf048('0x32')]['length']?_0x383fea[_0xf048('0x32')]:_0x2b3862[_0xf048('0x2e')];_0x383fea[_0xf048('0x37')]=qs[_0xf048('0x38')](_0x153c48[_0xf048('0x2f')]['sort']);_0x383fea[_0xf048('0x39')]=qs['filters'](_[_0xf048('0x4b')](_0x153c48[_0xf048('0x2f')],_0x2b3862[_0xf048('0x30')]));if(_0x153c48[_0xf048('0x2f')][_0xf048('0x3a')]){_0x383fea[_0xf048('0x39')]=_['merge'](_0x383fea['where'],{'$or':_['map'](_0x383fea[_0xf048('0x32')],function(_0x3f3d87){var _0x24dc80={};_0x24dc80[_0x3f3d87]={'$like':'%'+_0x153c48[_0xf048('0x2f')][_0xf048('0x3a')]+'%'};return _0x24dc80;})});}_0x383fea=_['merge']({},_0x383fea,_0x153c48['options']);return _0x10e6c7['getSubjects'](_0x383fea);}})[_0xf048('0x23')](function(_0x561b5d){if(_0x561b5d){_0x486af2=_0x561b5d[_0xf048('0x34')];if(!_0x153c48[_0xf048('0x2f')][_0xf048('0x35')]('nolimit')){_0x383fea[_0xf048('0x1f')]=qs['limit'](_0x153c48[_0xf048('0x2f')][_0xf048('0x1f')]);_0x383fea[_0xf048('0x1d')]=qs[_0xf048('0x1d')](_0x153c48[_0xf048('0x2f')]['offset']);}return _0x10e6c7[_0xf048('0x4c')](_0x383fea);}})[_0xf048('0x23')](function(_0x220419){if(_0x220419){return _0x220419?{'count':_0x486af2,'rows':_0x220419}:null;}})[_0xf048('0x23')](respondWithResult(_0x433f2c,null))[_0xf048('0x42')](handleError(_0x433f2c,null));};exports[_0xf048('0x4d')]=function(_0x37792f,_0x2d609a,_0x5b37dc){var _0x3fb469={};var _0x1a8f94={};var _0x4c3b2e;var _0x1af3fd;return db[_0xf048('0x29')]['findOne']({'where':{'id':_0x37792f[_0xf048('0x43')]['id']}})[_0xf048('0x23')](handleEntityNotFound(_0x2d609a,null))[_0xf048('0x23')](function(_0x21269a){if(_0x21269a){_0x4c3b2e=_0x21269a;_0x1a8f94[_0xf048('0x2e')]=_['keys'](db['SalesforceField'][_0xf048('0x2a')]);_0x1a8f94[_0xf048('0x2f')]=_[_0xf048('0x44')](_0x37792f[_0xf048('0x2f')]);_0x1a8f94[_0xf048('0x30')]=_[_0xf048('0x31')](_0x1a8f94[_0xf048('0x2e')],_0x1a8f94[_0xf048('0x2f')]);_0x3fb469[_0xf048('0x32')]=_['intersection'](_0x1a8f94[_0xf048('0x2e')],qs[_0xf048('0x33')](_0x37792f[_0xf048('0x2f')]['fields']));_0x3fb469['attributes']=_0x3fb469[_0xf048('0x32')]['length']?_0x3fb469[_0xf048('0x32')]:_0x1a8f94[_0xf048('0x2e')];_0x3fb469[_0xf048('0x37')]=qs[_0xf048('0x38')](_0x37792f[_0xf048('0x2f')][_0xf048('0x38')]);_0x3fb469[_0xf048('0x39')]=qs[_0xf048('0x30')](_[_0xf048('0x4b')](_0x37792f[_0xf048('0x2f')],_0x1a8f94[_0xf048('0x30')]));if(_0x37792f[_0xf048('0x2f')][_0xf048('0x3a')]){_0x3fb469[_0xf048('0x39')]=_[_0xf048('0x3b')](_0x3fb469[_0xf048('0x39')],{'$or':_['map'](_0x3fb469[_0xf048('0x32')],function(_0x144e4d){var _0x1305e4={};_0x1305e4[_0x144e4d]={'$like':'%'+_0x37792f[_0xf048('0x2f')][_0xf048('0x3a')]+'%'};return _0x1305e4;})});}_0x3fb469=_['merge']({},_0x3fb469,_0x37792f[_0xf048('0x3e')]);return _0x4c3b2e[_0xf048('0x4d')](_0x3fb469);}})[_0xf048('0x23')](function(_0x3340bd){if(_0x3340bd){_0x1af3fd=_0x3340bd[_0xf048('0x34')];if(!_0x37792f[_0xf048('0x2f')][_0xf048('0x35')](_0xf048('0x36'))){_0x3fb469[_0xf048('0x1f')]=qs[_0xf048('0x1f')](_0x37792f['query'][_0xf048('0x1f')]);_0x3fb469[_0xf048('0x1d')]=qs[_0xf048('0x1d')](_0x37792f['query']['offset']);}return _0x4c3b2e[_0xf048('0x4d')](_0x3fb469);}})[_0xf048('0x23')](function(_0x5e3a4e){if(_0x5e3a4e){return _0x5e3a4e?{'count':_0x1af3fd,'rows':_0x5e3a4e}:null;}})[_0xf048('0x23')](respondWithResult(_0x2d609a,null))[_0xf048('0x42')](handleError(_0x2d609a,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index b553ed2..2a918e1 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 _0x08c2=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration'];(function(_0x15cba0,_0x14164b){var _0x4b7b48=function(_0x54cbdb){while(--_0x54cbdb){_0x15cba0['push'](_0x15cba0['shift']());}};_0x4b7b48(++_0x14164b);}(_0x08c2,0x9a));var _0x208c=function(_0x512973,_0x564e8b){_0x512973=_0x512973-0x0;var _0x32f2e1=_0x08c2[_0x512973];return _0x32f2e1;};'use strict';var _=require(_0x208c('0x0'));var util=require(_0x208c('0x1'));var logger=require('../../config/logger')(_0x208c('0x2'));var moment=require('moment');var BPromise=require(_0x208c('0x3'));var rp=require(_0x208c('0x4'));var fs=require('fs');var path=require(_0x208c('0x5'));var rimraf=require(_0x208c('0x6'));var config=require(_0x208c('0x7'));var attributes=require(_0x208c('0x8'));module[_0x208c('0x9')]=function(_0x429c79,_0x314f9c){return _0x429c79['define'](_0x208c('0xa'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x266c=['request-promise','rimraf','../../config/environment','exports','define','SalesforceConfiguration','lodash','../../config/logger','moment','bluebird'];(function(_0x3a63da,_0x324e74){var _0xfbaf0c=function(_0x4c85c4){while(--_0x4c85c4){_0x3a63da['push'](_0x3a63da['shift']());}};_0xfbaf0c(++_0x324e74);}(_0x266c,0x178));var _0xc266=function(_0x8d2ba,_0xe5c613){_0x8d2ba=_0x8d2ba-0x0;var _0x2f5f34=_0x266c[_0x8d2ba];return _0x2f5f34;};'use strict';var _=require(_0xc266('0x0'));var util=require('util');var logger=require(_0xc266('0x1'))('api');var moment=require(_0xc266('0x2'));var BPromise=require(_0xc266('0x3'));var rp=require(_0xc266('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc266('0x5'));var config=require(_0xc266('0x6'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xc266('0x7')]=function(_0x46a8c7,_0x4fceaf){return _0x46a8c7[_0xc266('0x8')](_0xc266('0x9'),attributes,{'tableName':'int_salesforce_configurations','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 6b74a66..e5cfcff 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 _0x30c4=['bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x54784f,_0x2a24d8){var _0x241e1b=function(_0x3a4cc2){while(--_0x3a4cc2){_0x54784f['push'](_0x54784f['shift']());}};_0x241e1b(++_0x2a24d8);}(_0x30c4,0xad));var _0x430c=function(_0x511e81,_0x40b17d){_0x511e81=_0x511e81-0x0;var _0x207de6=_0x30c4[_0x511e81];return _0x207de6;};'use strict';var _=require(_0x430c('0x0'));var util=require(_0x430c('0x1'));var moment=require(_0x430c('0x2'));var BPromise=require(_0x430c('0x3'));var rs=require(_0x430c('0x4'));var fs=require('fs');var Redis=require(_0x430c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x430c('0x6'));var logger=require('../../config/logger')(_0x430c('0x7'));var config=require('../../config/environment');var jayson=require(_0x430c('0x8'));var client=jayson[_0x430c('0x9')][_0x430c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbc92e1,_0x57786a,_0x369220){return new BPromise(function(_0x579d04,_0xc36ba0){return client[_0x430c('0xb')](_0xbc92e1,_0x369220)[_0x430c('0xc')](function(_0x5f2a29){logger[_0x430c('0xd')](_0x430c('0xe'),_0x57786a,'request\x20sent');logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x57786a,_0x430c('0xf'),JSON[_0x430c('0x10')](_0x5f2a29));if(_0x5f2a29['error']){if(_0x5f2a29[_0x430c('0x11')][_0x430c('0x12')]===0x1f4){logger[_0x430c('0x11')](_0x430c('0xe'),_0x57786a,_0x5f2a29['error'][_0x430c('0x13')]);return _0xc36ba0(_0x5f2a29[_0x430c('0x11')]['message']);}logger[_0x430c('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x57786a,_0x5f2a29['error'][_0x430c('0x13')]);return _0x579d04(_0x5f2a29[_0x430c('0x11')][_0x430c('0x13')]);}else{logger[_0x430c('0xd')](_0x430c('0xe'),_0x57786a,_0x430c('0xf'));_0x579d04(_0x5f2a29[_0x430c('0x14')][_0x430c('0x13')]);}})[_0x430c('0x15')](function(_0x3e7413){logger[_0x430c('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x57786a,_0x3e7413);_0xc36ba0(_0x3e7413);});});} \ No newline at end of file +var _0x5fa9=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x3da647,_0xa1a501){var _0x2e91a2=function(_0x34a811){while(--_0x34a811){_0x3da647['push'](_0x3da647['shift']());}};_0x2e91a2(++_0xa1a501);}(_0x5fa9,0x1f3));var _0x95fa=function(_0x30066f,_0x5891c9){_0x30066f=_0x30066f-0x0;var _0x1ad673=_0x5fa9[_0x30066f];return _0x1ad673;};'use strict';var _=require(_0x95fa('0x0'));var util=require(_0x95fa('0x1'));var moment=require(_0x95fa('0x2'));var BPromise=require(_0x95fa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x95fa('0x4'));var db=require(_0x95fa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x95fa('0x6'))(_0x95fa('0x7'));var config=require(_0x95fa('0x8'));var jayson=require(_0x95fa('0x9'));var client=jayson['client'][_0x95fa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7d09c5,_0x11feda,_0x166ffa){return new BPromise(function(_0x303189,_0x47afbf){return client[_0x95fa('0xb')](_0x7d09c5,_0x166ffa)[_0x95fa('0xc')](function(_0x2c5b9d){logger[_0x95fa('0xd')](_0x95fa('0xe'),_0x11feda,_0x95fa('0xf'));logger[_0x95fa('0x10')](_0x95fa('0x11'),_0x11feda,_0x95fa('0xf'),JSON[_0x95fa('0x12')](_0x2c5b9d));if(_0x2c5b9d['error']){if(_0x2c5b9d['error'][_0x95fa('0x13')]===0x1f4){logger['error'](_0x95fa('0xe'),_0x11feda,_0x2c5b9d[_0x95fa('0x14')][_0x95fa('0x15')]);return _0x47afbf(_0x2c5b9d[_0x95fa('0x14')]['message']);}logger['error'](_0x95fa('0xe'),_0x11feda,_0x2c5b9d[_0x95fa('0x14')]['message']);return _0x303189(_0x2c5b9d[_0x95fa('0x14')][_0x95fa('0x15')]);}else{logger[_0x95fa('0xd')](_0x95fa('0xe'),_0x11feda,'request\x20sent');_0x303189(_0x2c5b9d[_0x95fa('0x16')]['message']);}})[_0x95fa('0x17')](function(_0x806d86){logger[_0x95fa('0x14')](_0x95fa('0xe'),_0x11feda,_0x806d86);_0x47afbf(_0x806d86);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 6309d65..ef5c33a 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 _0xbba6=['index','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xbba6,0xe7));var _0x6bba=function(_0x18e75c,_0x3d8b9e){_0x18e75c=_0x18e75c-0x0;var _0x3a5863=_0xbba6[_0x18e75c];return _0x3a5863;};'use strict';var multer=require('multer');var util=require(_0x6bba('0x0'));var path=require(_0x6bba('0x1'));var timeout=require(_0x6bba('0x2'));var express=require('express');var router=express[_0x6bba('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6bba('0x4'));var interaction=require(_0x6bba('0x5'));var config=require('../../config/environment');var controller=require(_0x6bba('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x6bba('0x7')]);router['get'](_0x6bba('0x8'),auth[_0x6bba('0x9')](),controller[_0x6bba('0xa')]);router[_0x6bba('0xb')]('/',auth['isAuthenticated'](),controller[_0x6bba('0xc')]);router['put'](_0x6bba('0x8'),auth[_0x6bba('0x9')](),controller[_0x6bba('0xd')]);router[_0x6bba('0xe')](_0x6bba('0x8'),auth[_0x6bba('0x9')](),controller[_0x6bba('0xf')]);module[_0x6bba('0x10')]=router; \ No newline at end of file +var _0x1e8a=['/:id','isAuthenticated','show','post','create','put','update','delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get'];(function(_0x4828b1,_0x5c8cf3){var _0x1fec1b=function(_0x3f2e5a){while(--_0x3f2e5a){_0x4828b1['push'](_0x4828b1['shift']());}};_0x1fec1b(++_0x5c8cf3);}(_0x1e8a,0x75));var _0xa1e8=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x1e8a[_0x501510];return _0x1e6ee5;};'use strict';var multer=require('multer');var util=require(_0xa1e8('0x0'));var path=require(_0xa1e8('0x1'));var timeout=require(_0xa1e8('0x2'));var express=require('express');var router=express[_0xa1e8('0x3')]();var fs_extra=require(_0xa1e8('0x4'));var auth=require(_0xa1e8('0x5'));var interaction=require(_0xa1e8('0x6'));var config=require('../../config/environment');var controller=require(_0xa1e8('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xa1e8('0x8')](_0xa1e8('0x9'),auth[_0xa1e8('0xa')](),controller[_0xa1e8('0xb')]);router[_0xa1e8('0xc')]('/',auth[_0xa1e8('0xa')](),controller[_0xa1e8('0xd')]);router[_0xa1e8('0xe')](_0xa1e8('0x9'),auth[_0xa1e8('0xa')](),controller[_0xa1e8('0xf')]);router[_0xa1e8('0x10')]('/:id',auth[_0xa1e8('0xa')](),controller[_0xa1e8('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index f99c562..b9df1a0 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 _0x704b=['variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x2028d2,_0x6cf9ff){var _0x3ec1fd=function(_0x49c742){while(--_0x49c742){_0x2028d2['push'](_0x2028d2['shift']());}};_0x3ec1fd(++_0x6cf9ff);}(_0x704b,0x12e));var _0xb704=function(_0x172feb,_0x4bb62f){_0x172feb=_0x172feb-0x0;var _0x5341af=_0x704b[_0x172feb];return _0x5341af;};'use strict';var Sequelize=require(_0xb704('0x0'));module[_0xb704('0x1')]={'type':{'type':Sequelize[_0xb704('0x2')](_0xb704('0x3'),_0xb704('0x4'),_0xb704('0x5'),_0xb704('0x6'),_0xb704('0x7')),'defaultValue':_0xb704('0x3')},'content':{'type':Sequelize[_0xb704('0x8')]},'key':{'type':Sequelize[_0xb704('0x8')]},'keyType':{'type':Sequelize[_0xb704('0x2')](_0xb704('0x3'),'variable',_0xb704('0x5'))},'keyContent':{'type':Sequelize[_0xb704('0x8')]},'idField':{'type':Sequelize[_0xb704('0x8')]},'variableName':{'type':Sequelize[_0xb704('0x8')]}}; \ No newline at end of file +var _0x4e91=['variable','sequelize','customVariable','picklist','STRING','string'];(function(_0x5c6272,_0xd82df5){var _0x19c236=function(_0x332352){while(--_0x332352){_0x5c6272['push'](_0x5c6272['shift']());}};_0x19c236(++_0xd82df5);}(_0x4e91,0x157));var _0x14e9=function(_0x4b7b69,_0x3ab075){_0x4b7b69=_0x4b7b69-0x0;var _0x173b4c=_0x4e91[_0x4b7b69];return _0x173b4c;};'use strict';var Sequelize=require(_0x14e9('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string','variable',_0x14e9('0x1'),'keyValue',_0x14e9('0x2')),'defaultValue':'string'},'content':{'type':Sequelize[_0x14e9('0x3')]},'key':{'type':Sequelize[_0x14e9('0x3')]},'keyType':{'type':Sequelize['ENUM'](_0x14e9('0x4'),_0x14e9('0x5'),_0x14e9('0x1'))},'keyContent':{'type':Sequelize[_0x14e9('0x3')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x14e9('0x3')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 4da39b8..203ffe1 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 _0xf52e=['status','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','options','SalesforceField','includeAll','include','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end'];(function(_0x1d3272,_0x2c24b8){var _0x573b3b=function(_0x17d447){while(--_0x17d447){_0x1d3272['push'](_0x1d3272['shift']());}};_0x573b3b(++_0x2c24b8);}(_0xf52e,0x1ed));var _0xef52=function(_0x5923a0,_0x48d93e){_0x5923a0=_0x5923a0-0x0;var _0x268cb0=_0xf52e[_0x5923a0];return _0x268cb0;};'use strict';var emlformat=require(_0xef52('0x0'));var rimraf=require(_0xef52('0x1'));var zipdir=require(_0xef52('0x2'));var jsonpatch=require(_0xef52('0x3'));var rp=require(_0xef52('0x4'));var moment=require(_0xef52('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xef52('0x6'));var util=require('util');var path=require('path');var sox=require(_0xef52('0x7'));var csv=require(_0xef52('0x8'));var ejs=require(_0xef52('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xef52('0xa'));var squel=require('squel');var crypto=require(_0xef52('0xb'));var jsforce=require(_0xef52('0xc'));var deskjs=require(_0xef52('0xd'));var toCsv=require(_0xef52('0x8'));var querystring=require('querystring');var Papa=require(_0xef52('0xe'));var Redis=require(_0xef52('0xf'));var authService=require(_0xef52('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xef52('0x11'));var hardwareService=require(_0xef52('0x12'));var logger=require(_0xef52('0x13'))(_0xef52('0x14'));var utils=require(_0xef52('0x15'));var config=require(_0xef52('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xef52('0x17'))['db'];function respondWithStatusCode(_0x3b57ce,_0x2343d5){_0x2343d5=_0x2343d5||0xcc;return function(_0x41368a){if(_0x41368a){return _0x3b57ce['sendStatus'](_0x2343d5);}return _0x3b57ce['status'](_0x2343d5)[_0xef52('0x18')]();};}function respondWithResult(_0x6e31dd,_0xc12d21){_0xc12d21=_0xc12d21||0xc8;return function(_0x2266a5){if(_0x2266a5){return _0x6e31dd[_0xef52('0x19')](_0xc12d21)['json'](_0x2266a5);}};}function respondWithFilteredResult(_0x347108,_0x5a1588){return function(_0x2160fa){if(_0x2160fa){var _0x3c6f8b=typeof _0x5a1588['offset']===_0xef52('0x1a')&&typeof _0x5a1588[_0xef52('0x1b')]===_0xef52('0x1a');var _0xa59d96=_0x2160fa[_0xef52('0x1c')];var _0x4d221d=_0x3c6f8b?0x0:_0x5a1588[_0xef52('0x1d')];var _0x14f62a=_0x3c6f8b?_0x2160fa[_0xef52('0x1c')]:_0x5a1588[_0xef52('0x1d')]+_0x5a1588['limit'];var _0x537942;if(_0x14f62a>=_0xa59d96){_0x14f62a=_0xa59d96;_0x537942=0xc8;}else{_0x537942=0xce;}_0x347108[_0xef52('0x19')](_0x537942);return _0x347108[_0xef52('0x1e')](_0xef52('0x1f'),_0x4d221d+'-'+_0x14f62a+'/'+_0xa59d96)[_0xef52('0x20')](_0x2160fa);}return null;};}function patchUpdates(_0x3e88f3){return function(_0x5b78ba){try{jsonpatch[_0xef52('0x21')](_0x5b78ba,_0x3e88f3,!![]);}catch(_0x4375f6){return BPromise['reject'](_0x4375f6);}return _0x5b78ba[_0xef52('0x22')]();};}function saveUpdates(_0x137faa,_0x29355f){return function(_0x46c402){if(_0x46c402){return _0x46c402[_0xef52('0x23')](_0x137faa)[_0xef52('0x24')](function(_0x4755e0){return _0x4755e0;});}return null;};}function removeEntity(_0x40c704,_0x42119d){return function(_0x5a1dc9){if(_0x5a1dc9){return _0x5a1dc9[_0xef52('0x25')]()[_0xef52('0x24')](function(){_0x40c704[_0xef52('0x19')](0xcc)[_0xef52('0x18')]();});}};}function handleEntityNotFound(_0x270d3a,_0x582069){return function(_0x3f6e11){if(!_0x3f6e11){_0x270d3a[_0xef52('0x26')](0x194);}return _0x3f6e11;};}function handleError(_0x3afa14,_0x2ad124){_0x2ad124=_0x2ad124||0x1f4;return function(_0x493e08){logger[_0xef52('0x27')](_0x493e08[_0xef52('0x28')]);if(_0x493e08['name']){delete _0x493e08[_0xef52('0x29')];}_0x3afa14[_0xef52('0x19')](_0x2ad124)['send'](_0x493e08);};}exports[_0xef52('0x2a')]=function(_0x287e11,_0x46b090){var _0xec83a8={},_0x4f9505={},_0x385495={'count':0x0,'rows':[]};var _0x35aee9=_[_0xef52('0x2b')](db['SalesforceField'][_0xef52('0x2c')],function(_0x476678){return{'name':_0x476678[_0xef52('0x2d')],'type':_0x476678[_0xef52('0x2e')][_0xef52('0x2f')]};});_0x4f9505[_0xef52('0x30')]=_[_0xef52('0x2b')](_0x35aee9,_0xef52('0x29'));_0x4f9505['query']=_[_0xef52('0x31')](_0x287e11['query']);_0x4f9505[_0xef52('0x32')]=_[_0xef52('0x33')](_0x4f9505[_0xef52('0x30')],_0x4f9505[_0xef52('0x34')]);_0xec83a8[_0xef52('0x35')]=_[_0xef52('0x33')](_0x4f9505[_0xef52('0x30')],qs[_0xef52('0x36')](_0x287e11['query']['fields']));_0xec83a8[_0xef52('0x35')]=_0xec83a8[_0xef52('0x35')][_0xef52('0x37')]?_0xec83a8['attributes']:_0x4f9505['model'];if(!_0x287e11['query'][_0xef52('0x38')](_0xef52('0x39'))){_0xec83a8[_0xef52('0x1b')]=qs[_0xef52('0x1b')](_0x287e11[_0xef52('0x34')]['limit']);_0xec83a8[_0xef52('0x1d')]=qs[_0xef52('0x1d')](_0x287e11['query'][_0xef52('0x1d')]);}_0xec83a8[_0xef52('0x3a')]=qs['sort'](_0x287e11[_0xef52('0x34')]['sort']);_0xec83a8[_0xef52('0x3b')]=qs['filters'](_[_0xef52('0x3c')](_0x287e11[_0xef52('0x34')],_0x4f9505[_0xef52('0x32')]),_0x35aee9);if(_0x287e11[_0xef52('0x34')]['filter']){_0xec83a8[_0xef52('0x3b')]=_['merge'](_0xec83a8[_0xef52('0x3b')],{'$or':_[_0xef52('0x2b')](_0x35aee9,function(_0x5c4384){if(_0x5c4384[_0xef52('0x2e')]!=='VIRTUAL'){var _0x1d84f3={};_0x1d84f3[_0x5c4384['name']]={'$like':'%'+_0x287e11['query']['filter']+'%'};return _0x1d84f3;}})});}_0xec83a8=_[_0xef52('0x3d')]({},_0xec83a8,_0x287e11[_0xef52('0x3e')]);var _0xef418a={'where':_0xec83a8[_0xef52('0x3b')]};return db[_0xef52('0x3f')][_0xef52('0x1c')](_0xef418a)[_0xef52('0x24')](function(_0x24b1ec){_0x385495[_0xef52('0x1c')]=_0x24b1ec;if(_0x287e11['query'][_0xef52('0x40')]){_0xec83a8[_0xef52('0x41')]=[{'all':!![]}];}return db[_0xef52('0x3f')][_0xef52('0x42')](_0xec83a8);})['then'](function(_0x1d722b){_0x385495[_0xef52('0x43')]=_0x1d722b;return _0x385495;})[_0xef52('0x24')](respondWithFilteredResult(_0x46b090,_0xec83a8))[_0xef52('0x44')](handleError(_0x46b090,null));};exports[_0xef52('0x45')]=function(_0x25d83f,_0x49a488){var _0x32303c={'raw':!![],'where':{'id':_0x25d83f[_0xef52('0x46')]['id']}},_0x164aef={};_0x164aef['model']=_['keys'](db[_0xef52('0x3f')][_0xef52('0x2c')]);_0x164aef[_0xef52('0x34')]=_['keys'](_0x25d83f[_0xef52('0x34')]);_0x164aef[_0xef52('0x32')]=_[_0xef52('0x33')](_0x164aef['model'],_0x164aef[_0xef52('0x34')]);_0x32303c[_0xef52('0x35')]=_[_0xef52('0x33')](_0x164aef[_0xef52('0x30')],qs['fields'](_0x25d83f['query'][_0xef52('0x36')]));_0x32303c[_0xef52('0x35')]=_0x32303c[_0xef52('0x35')][_0xef52('0x37')]?_0x32303c[_0xef52('0x35')]:_0x164aef[_0xef52('0x30')];if(_0x25d83f[_0xef52('0x34')][_0xef52('0x40')]){_0x32303c[_0xef52('0x41')]=[{'all':!![]}];}_0x32303c=_[_0xef52('0x3d')]({},_0x32303c,_0x25d83f[_0xef52('0x3e')]);return db[_0xef52('0x3f')]['find'](_0x32303c)[_0xef52('0x24')](handleEntityNotFound(_0x49a488,null))['then'](respondWithResult(_0x49a488,null))['catch'](handleError(_0x49a488,null));};exports[_0xef52('0x47')]=function(_0x188e91,_0x4a5697){return db[_0xef52('0x3f')][_0xef52('0x47')](_0x188e91[_0xef52('0x48')],{})[_0xef52('0x24')](respondWithResult(_0x4a5697,0xc9))[_0xef52('0x44')](handleError(_0x4a5697,null));};exports[_0xef52('0x23')]=function(_0x2901aa,_0x73b891){if(_0x2901aa[_0xef52('0x48')]['id']){delete _0x2901aa[_0xef52('0x48')]['id'];}return db[_0xef52('0x3f')]['find']({'where':{'id':_0x2901aa['params']['id']}})[_0xef52('0x24')](handleEntityNotFound(_0x73b891,null))['then'](saveUpdates(_0x2901aa[_0xef52('0x48')],null))[_0xef52('0x24')](respondWithResult(_0x73b891,null))[_0xef52('0x44')](handleError(_0x73b891,null));};exports[_0xef52('0x25')]=function(_0x1afc0e,_0x4e3a2c){return db[_0xef52('0x3f')][_0xef52('0x49')]({'where':{'id':_0x1afc0e['params']['id']}})[_0xef52('0x24')](handleEntityNotFound(_0x4e3a2c,null))[_0xef52('0x24')](removeEntity(_0x4e3a2c,null))[_0xef52('0x44')](handleError(_0x4e3a2c,null));}; \ No newline at end of file +var _0x5558=['api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SalesforceField','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','body','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x905c3e,_0x568bac){var _0x435b47=function(_0x13ca3c){while(--_0x13ca3c){_0x905c3e['push'](_0x905c3e['shift']());}};_0x435b47(++_0x568bac);}(_0x5558,0x7e));var _0x8555=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x5558[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8555('0x0'));var jsonpatch=require(_0x8555('0x1'));var rp=require('request-promise');var moment=require(_0x8555('0x2'));var BPromise=require(_0x8555('0x3'));var Mustache=require('mustache');var util=require(_0x8555('0x4'));var path=require('path');var sox=require(_0x8555('0x5'));var csv=require(_0x8555('0x6'));var ejs=require(_0x8555('0x7'));var fs=require('fs');var fs_extra=require(_0x8555('0x8'));var _=require(_0x8555('0x9'));var squel=require(_0x8555('0xa'));var crypto=require('crypto');var jsforce=require(_0x8555('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8555('0x6'));var querystring=require(_0x8555('0xc'));var Papa=require(_0x8555('0xd'));var Redis=require(_0x8555('0xe'));var authService=require(_0x8555('0xf'));var qs=require(_0x8555('0x10'));var as=require(_0x8555('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8555('0x12'));var utils=require('../../config/utils');var config=require(_0x8555('0x13'));var licenseUtil=require(_0x8555('0x14'));var db=require(_0x8555('0x15'))['db'];function respondWithStatusCode(_0x5a2089,_0x54b30d){_0x54b30d=_0x54b30d||0xcc;return function(_0x186d54){if(_0x186d54){return _0x5a2089['sendStatus'](_0x54b30d);}return _0x5a2089[_0x8555('0x16')](_0x54b30d)[_0x8555('0x17')]();};}function respondWithResult(_0x568b7a,_0x4d0067){_0x4d0067=_0x4d0067||0xc8;return function(_0x38b428){if(_0x38b428){return _0x568b7a['status'](_0x4d0067)['json'](_0x38b428);}};}function respondWithFilteredResult(_0x160325,_0x2d7a39){return function(_0x49e330){if(_0x49e330){var _0x355622=typeof _0x2d7a39[_0x8555('0x18')]===_0x8555('0x19')&&typeof _0x2d7a39[_0x8555('0x1a')]===_0x8555('0x19');var _0x24cf3f=_0x49e330[_0x8555('0x1b')];var _0x24b9f1=_0x355622?0x0:_0x2d7a39['offset'];var _0x6a34e=_0x355622?_0x49e330[_0x8555('0x1b')]:_0x2d7a39[_0x8555('0x18')]+_0x2d7a39[_0x8555('0x1a')];var _0x5097b6;if(_0x6a34e>=_0x24cf3f){_0x6a34e=_0x24cf3f;_0x5097b6=0xc8;}else{_0x5097b6=0xce;}_0x160325[_0x8555('0x16')](_0x5097b6);return _0x160325[_0x8555('0x1c')](_0x8555('0x1d'),_0x24b9f1+'-'+_0x6a34e+'/'+_0x24cf3f)[_0x8555('0x1e')](_0x49e330);}return null;};}function patchUpdates(_0x11ea9f){return function(_0xce3518){try{jsonpatch[_0x8555('0x1f')](_0xce3518,_0x11ea9f,!![]);}catch(_0x3e132a){return BPromise[_0x8555('0x20')](_0x3e132a);}return _0xce3518[_0x8555('0x21')]();};}function saveUpdates(_0x4fb394,_0x3a2ca2){return function(_0x17ac4d){if(_0x17ac4d){return _0x17ac4d[_0x8555('0x22')](_0x4fb394)[_0x8555('0x23')](function(_0x5cf6e9){return _0x5cf6e9;});}return null;};}function removeEntity(_0x36daa1,_0x4bdfee){return function(_0x3d8a63){if(_0x3d8a63){return _0x3d8a63[_0x8555('0x24')]()[_0x8555('0x23')](function(){_0x36daa1[_0x8555('0x16')](0xcc)[_0x8555('0x17')]();});}};}function handleEntityNotFound(_0x543327,_0x5b2283){return function(_0x255e83){if(!_0x255e83){_0x543327[_0x8555('0x25')](0x194);}return _0x255e83;};}function handleError(_0x113812,_0x3a8916){_0x3a8916=_0x3a8916||0x1f4;return function(_0x830f66){logger[_0x8555('0x26')](_0x830f66[_0x8555('0x27')]);if(_0x830f66[_0x8555('0x28')]){delete _0x830f66[_0x8555('0x28')];}_0x113812[_0x8555('0x16')](_0x3a8916)[_0x8555('0x29')](_0x830f66);};}exports[_0x8555('0x2a')]=function(_0x10454d,_0x4e19ca){var _0x305d85={},_0x9e1914={},_0x21320d={'count':0x0,'rows':[]};var _0x114990=_[_0x8555('0x2b')](db[_0x8555('0x2c')][_0x8555('0x2d')],function(_0x21e719){return{'name':_0x21e719['fieldName'],'type':_0x21e719[_0x8555('0x2e')][_0x8555('0x2f')]};});_0x9e1914['model']=_[_0x8555('0x2b')](_0x114990,_0x8555('0x28'));_0x9e1914[_0x8555('0x30')]=_[_0x8555('0x31')](_0x10454d['query']);_0x9e1914[_0x8555('0x32')]=_[_0x8555('0x33')](_0x9e1914[_0x8555('0x34')],_0x9e1914[_0x8555('0x30')]);_0x305d85['attributes']=_['intersection'](_0x9e1914[_0x8555('0x34')],qs[_0x8555('0x35')](_0x10454d[_0x8555('0x30')][_0x8555('0x35')]));_0x305d85[_0x8555('0x36')]=_0x305d85[_0x8555('0x36')][_0x8555('0x37')]?_0x305d85[_0x8555('0x36')]:_0x9e1914['model'];if(!_0x10454d['query']['hasOwnProperty']('nolimit')){_0x305d85[_0x8555('0x1a')]=qs[_0x8555('0x1a')](_0x10454d[_0x8555('0x30')][_0x8555('0x1a')]);_0x305d85[_0x8555('0x18')]=qs[_0x8555('0x18')](_0x10454d[_0x8555('0x30')][_0x8555('0x18')]);}_0x305d85[_0x8555('0x38')]=qs['sort'](_0x10454d[_0x8555('0x30')]['sort']);_0x305d85[_0x8555('0x39')]=qs['filters'](_[_0x8555('0x3a')](_0x10454d[_0x8555('0x30')],_0x9e1914[_0x8555('0x32')]),_0x114990);if(_0x10454d['query'][_0x8555('0x3b')]){_0x305d85['where']=_[_0x8555('0x3c')](_0x305d85[_0x8555('0x39')],{'$or':_[_0x8555('0x2b')](_0x114990,function(_0x335a26){if(_0x335a26[_0x8555('0x2e')]!==_0x8555('0x3d')){var _0xd520de={};_0xd520de[_0x335a26['name']]={'$like':'%'+_0x10454d[_0x8555('0x30')][_0x8555('0x3b')]+'%'};return _0xd520de;}})});}_0x305d85=_[_0x8555('0x3c')]({},_0x305d85,_0x10454d['options']);var _0x2fbfa5={'where':_0x305d85[_0x8555('0x39')]};return db['SalesforceField'][_0x8555('0x1b')](_0x2fbfa5)[_0x8555('0x23')](function(_0x2b71b5){_0x21320d[_0x8555('0x1b')]=_0x2b71b5;if(_0x10454d[_0x8555('0x30')][_0x8555('0x3e')]){_0x305d85[_0x8555('0x3f')]=[{'all':!![]}];}return db['SalesforceField'][_0x8555('0x40')](_0x305d85);})[_0x8555('0x23')](function(_0x30a1c7){_0x21320d[_0x8555('0x41')]=_0x30a1c7;return _0x21320d;})[_0x8555('0x23')](respondWithFilteredResult(_0x4e19ca,_0x305d85))[_0x8555('0x42')](handleError(_0x4e19ca,null));};exports[_0x8555('0x43')]=function(_0x51e46d,_0x44c014){var _0x58feff={'raw':!![],'where':{'id':_0x51e46d[_0x8555('0x44')]['id']}},_0xfff3a9={};_0xfff3a9[_0x8555('0x34')]=_[_0x8555('0x31')](db[_0x8555('0x2c')][_0x8555('0x2d')]);_0xfff3a9[_0x8555('0x30')]=_[_0x8555('0x31')](_0x51e46d[_0x8555('0x30')]);_0xfff3a9['filters']=_[_0x8555('0x33')](_0xfff3a9[_0x8555('0x34')],_0xfff3a9['query']);_0x58feff[_0x8555('0x36')]=_[_0x8555('0x33')](_0xfff3a9[_0x8555('0x34')],qs[_0x8555('0x35')](_0x51e46d[_0x8555('0x30')][_0x8555('0x35')]));_0x58feff[_0x8555('0x36')]=_0x58feff['attributes'][_0x8555('0x37')]?_0x58feff[_0x8555('0x36')]:_0xfff3a9[_0x8555('0x34')];if(_0x51e46d[_0x8555('0x30')][_0x8555('0x3e')]){_0x58feff[_0x8555('0x3f')]=[{'all':!![]}];}_0x58feff=_[_0x8555('0x3c')]({},_0x58feff,_0x51e46d[_0x8555('0x45')]);return db['SalesforceField'][_0x8555('0x46')](_0x58feff)[_0x8555('0x23')](handleEntityNotFound(_0x44c014,null))[_0x8555('0x23')](respondWithResult(_0x44c014,null))[_0x8555('0x42')](handleError(_0x44c014,null));};exports['create']=function(_0x112987,_0x465800){return db[_0x8555('0x2c')]['create'](_0x112987['body'],{})[_0x8555('0x23')](respondWithResult(_0x465800,0xc9))[_0x8555('0x42')](handleError(_0x465800,null));};exports['update']=function(_0x246c95,_0x4a40c6){if(_0x246c95['body']['id']){delete _0x246c95[_0x8555('0x47')]['id'];}return db[_0x8555('0x2c')][_0x8555('0x46')]({'where':{'id':_0x246c95['params']['id']}})['then'](handleEntityNotFound(_0x4a40c6,null))[_0x8555('0x23')](saveUpdates(_0x246c95[_0x8555('0x47')],null))['then'](respondWithResult(_0x4a40c6,null))[_0x8555('0x42')](handleError(_0x4a40c6,null));};exports[_0x8555('0x24')]=function(_0xd9e296,_0x2907b9){return db[_0x8555('0x2c')][_0x8555('0x46')]({'where':{'id':_0xd9e296[_0x8555('0x44')]['id']}})[_0x8555('0x23')](handleEntityNotFound(_0x2907b9,null))['then'](removeEntity(_0x2907b9,null))[_0x8555('0x42')](handleError(_0x2907b9,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 73364ef..a4d3168 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 _0xa503=['moment','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId'];(function(_0x253b13,_0x247a2f){var _0x396bcc=function(_0x152c32){while(--_0x152c32){_0x253b13['push'](_0x253b13['shift']());}};_0x396bcc(++_0x247a2f);}(_0xa503,0xc0));var _0x3a50=function(_0x51ff38,_0x4c3fb9){_0x51ff38=_0x51ff38-0x0;var _0x54c6f7=_0xa503[_0x51ff38];return _0x54c6f7;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3a50('0x0'));var BPromise=require('bluebird');var rp=require(_0x3a50('0x1'));var fs=require('fs');var path=require(_0x3a50('0x2'));var rimraf=require(_0x3a50('0x3'));var config=require(_0x3a50('0x4'));var attributes=require(_0x3a50('0x5'));module['exports']=function(_0x597581,_0x344f66){return _0x597581[_0x3a50('0x6')](_0x3a50('0x7'),attributes,{'tableName':_0x3a50('0x8'),'paranoid':![],'indexes':[{'name':_0x3a50('0x9'),'fields':[_0x3a50('0xa'),_0x3a50('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3dcc=['request-promise','path','rimraf','../../config/environment','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','lodash','util','api','moment','bluebird'];(function(_0x49ec46,_0x5053f9){var _0x537d69=function(_0x1707fe){while(--_0x1707fe){_0x49ec46['push'](_0x49ec46['shift']());}};_0x537d69(++_0x5053f9);}(_0x3dcc,0x64));var _0xc3dc=function(_0x56e32e,_0x9eb2f6){_0x56e32e=_0x56e32e-0x0;var _0x2a757b=_0x3dcc[_0x56e32e];return _0x2a757b;};'use strict';var _=require(_0xc3dc('0x0'));var util=require(_0xc3dc('0x1'));var logger=require('../../config/logger')(_0xc3dc('0x2'));var moment=require(_0xc3dc('0x3'));var BPromise=require(_0xc3dc('0x4'));var rp=require(_0xc3dc('0x5'));var fs=require('fs');var path=require(_0xc3dc('0x6'));var rimraf=require(_0xc3dc('0x7'));var config=require(_0xc3dc('0x8'));var attributes=require('./intSalesforceField.attributes');module[_0xc3dc('0x9')]=function(_0x64bdaa,_0x57bd5d){return _0x64bdaa[_0xc3dc('0xa')](_0xc3dc('0xb'),attributes,{'tableName':_0xc3dc('0xc'),'paranoid':![],'indexes':[{'name':_0xc3dc('0xd'),'fields':[_0xc3dc('0xe'),'FieldId'],'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 5420194..2f71475 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 _0x08fe=['jayson/promise','client','then','info','debug','request\x20sent','stringify','error','message','SalesforceField,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x08fe,0x12a));var _0xe08f=function(_0x547bb6,_0x2d6f27){_0x547bb6=_0x547bb6-0x0;var _0x1a9154=_0x08fe[_0x547bb6];return _0x1a9154;};'use strict';var _=require(_0xe08f('0x0'));var util=require(_0xe08f('0x1'));var moment=require(_0xe08f('0x2'));var BPromise=require('bluebird');var rs=require(_0xe08f('0x3'));var fs=require('fs');var Redis=require(_0xe08f('0x4'));var db=require(_0xe08f('0x5'))['db'];var utils=require(_0xe08f('0x6'));var logger=require(_0xe08f('0x7'))(_0xe08f('0x8'));var config=require(_0xe08f('0x9'));var jayson=require(_0xe08f('0xa'));var client=jayson[_0xe08f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ad71a,_0x365e0c,_0x1bcf34){return new BPromise(function(_0x230161,_0x46f2cb){return client['request'](_0x1ad71a,_0x1bcf34)[_0xe08f('0xc')](function(_0x2556ca){logger[_0xe08f('0xd')]('SalesforceField,\x20%s,\x20%s',_0x365e0c,'request\x20sent');logger[_0xe08f('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x365e0c,_0xe08f('0xf'),JSON[_0xe08f('0x10')](_0x2556ca));if(_0x2556ca[_0xe08f('0x11')]){if(_0x2556ca['error']['code']===0x1f4){logger[_0xe08f('0x11')]('SalesforceField,\x20%s,\x20%s',_0x365e0c,_0x2556ca['error'][_0xe08f('0x12')]);return _0x46f2cb(_0x2556ca[_0xe08f('0x11')][_0xe08f('0x12')]);}logger[_0xe08f('0x11')](_0xe08f('0x13'),_0x365e0c,_0x2556ca[_0xe08f('0x11')][_0xe08f('0x12')]);return _0x230161(_0x2556ca[_0xe08f('0x11')][_0xe08f('0x12')]);}else{logger[_0xe08f('0xd')](_0xe08f('0x13'),_0x365e0c,_0xe08f('0xf'));_0x230161(_0x2556ca[_0xe08f('0x14')][_0xe08f('0x12')]);}})[_0xe08f('0x15')](function(_0x581c23){logger[_0xe08f('0x11')](_0xe08f('0x13'),_0x365e0c,_0x581c23);_0x46f2cb(_0x581c23);});});} \ No newline at end of file +var _0x8c5f=['../../config/environment','request','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x253c71,_0x41784c){var _0x305a6c=function(_0x389d7e){while(--_0x389d7e){_0x253c71['push'](_0x253c71['shift']());}};_0x305a6c(++_0x41784c);}(_0x8c5f,0x7f));var _0xf8c5=function(_0x3e33b3,_0x3ff7c4){_0x3e33b3=_0x3e33b3-0x0;var _0x122c13=_0x8c5f[_0x3e33b3];return _0x122c13;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf8c5('0x0'));var BPromise=require(_0xf8c5('0x1'));var rs=require(_0xf8c5('0x2'));var fs=require('fs');var Redis=require(_0xf8c5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf8c5('0x4'))(_0xf8c5('0x5'));var config=require(_0xf8c5('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x179640,_0xe7380c,_0x353609){return new BPromise(function(_0x5b7b6c,_0x2550e1){return client[_0xf8c5('0x7')](_0x179640,_0x353609)['then'](function(_0xf0f315){logger['info']('SalesforceField,\x20%s,\x20%s',_0xe7380c,_0xf8c5('0x8'));logger[_0xf8c5('0x9')](_0xf8c5('0xa'),_0xe7380c,_0xf8c5('0x8'),JSON[_0xf8c5('0xb')](_0xf0f315));if(_0xf0f315[_0xf8c5('0xc')]){if(_0xf0f315[_0xf8c5('0xc')][_0xf8c5('0xd')]===0x1f4){logger[_0xf8c5('0xc')](_0xf8c5('0xe'),_0xe7380c,_0xf0f315[_0xf8c5('0xc')]['message']);return _0x2550e1(_0xf0f315['error']['message']);}logger[_0xf8c5('0xc')](_0xf8c5('0xe'),_0xe7380c,_0xf0f315['error']['message']);return _0x5b7b6c(_0xf0f315['error'][_0xf8c5('0xf')]);}else{logger[_0xf8c5('0x10')](_0xf8c5('0xe'),_0xe7380c,'request\x20sent');_0x5b7b6c(_0xf0f315[_0xf8c5('0x11')][_0xf8c5('0xf')]);}})[_0xf8c5('0x12')](function(_0x573958){logger[_0xf8c5('0xc')](_0xf8c5('0xe'),_0xe7380c,_0x573958);_0x2550e1(_0x573958);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 3706250..30dd4f1 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 _0xfc81=['put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration'];(function(_0x543e1d,_0x214a58){var _0x221d0b=function(_0x33c533){while(--_0x33c533){_0x543e1d['push'](_0x543e1d['shift']());}};_0x221d0b(++_0x214a58);}(_0xfc81,0x88));var _0x1fc8=function(_0xcf5436,_0x4632c3){_0xcf5436=_0xcf5436-0x0;var _0xc4f5c8=_0xfc81[_0xcf5436];return _0xc4f5c8;};'use strict';var multer=require('multer');var util=require(_0x1fc8('0x0'));var path=require(_0x1fc8('0x1'));var timeout=require(_0x1fc8('0x2'));var express=require(_0x1fc8('0x3'));var router=express[_0x1fc8('0x4')]();var fs_extra=require(_0x1fc8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1fc8('0x6'));var config=require('../../config/environment');var controller=require(_0x1fc8('0x7'));router[_0x1fc8('0x8')]('/',auth[_0x1fc8('0x9')](),controller[_0x1fc8('0xa')]);router[_0x1fc8('0x8')](_0x1fc8('0xb'),auth[_0x1fc8('0x9')](),controller[_0x1fc8('0xc')]);router[_0x1fc8('0x8')](_0x1fc8('0xd'),auth[_0x1fc8('0x9')](),controller['getConfigurations']);router['get'](_0x1fc8('0xe'),auth[_0x1fc8('0x9')](),controller[_0x1fc8('0xf')]);router[_0x1fc8('0x10')]('/',auth[_0x1fc8('0x9')](),controller['create']);router[_0x1fc8('0x10')](_0x1fc8('0xd'),auth[_0x1fc8('0x9')](),controller[_0x1fc8('0x11')]);router[_0x1fc8('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x1fc8('0x13')]);router[_0x1fc8('0x14')](_0x1fc8('0xb'),auth[_0x1fc8('0x9')](),controller[_0x1fc8('0x15')]);module['exports']=router; \ No newline at end of file +var _0x7ebf=['index','/:id','show','getConfigurations','/:id/fields','post','/:id/configurations','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x7ebf,0x1da));var _0xf7eb=function(_0x93813a,_0x42999a){_0x93813a=_0x93813a-0x0;var _0x201d7b=_0x7ebf[_0x93813a];return _0x201d7b;};'use strict';var multer=require(_0xf7eb('0x0'));var util=require(_0xf7eb('0x1'));var path=require('path');var timeout=require(_0xf7eb('0x2'));var express=require(_0xf7eb('0x3'));var router=express[_0xf7eb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf7eb('0x5'));var interaction=require(_0xf7eb('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowAccount.controller');router[_0xf7eb('0x7')]('/',auth[_0xf7eb('0x8')](),controller[_0xf7eb('0x9')]);router[_0xf7eb('0x7')](_0xf7eb('0xa'),auth[_0xf7eb('0x8')](),controller[_0xf7eb('0xb')]);router[_0xf7eb('0x7')]('/:id/configurations',auth[_0xf7eb('0x8')](),controller[_0xf7eb('0xc')]);router['get'](_0xf7eb('0xd'),auth[_0xf7eb('0x8')](),controller['getFields']);router[_0xf7eb('0xe')]('/',auth[_0xf7eb('0x8')](),controller['create']);router[_0xf7eb('0xe')](_0xf7eb('0xf'),auth[_0xf7eb('0x8')](),controller['addConfiguration']);router[_0xf7eb('0x10')](_0xf7eb('0xa'),auth[_0xf7eb('0x8')](),controller[_0xf7eb('0x11')]);router[_0xf7eb('0x12')](_0xf7eb('0xa'),auth['isAuthenticated'](),controller[_0xf7eb('0x13')]);module[_0xf7eb('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index e44bd53..1590ec1 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 _0x81ee=['STRING','remoteUri','sequelize','exports'];(function(_0x1d1cf4,_0x53e367){var _0x385bb9=function(_0x30e64e){while(--_0x30e64e){_0x1d1cf4['push'](_0x1d1cf4['shift']());}};_0x385bb9(++_0x53e367);}(_0x81ee,0xde));var _0xe81e=function(_0x27f748,_0x52fdd1){_0x27f748=_0x27f748-0x0;var _0x7811b=_0x81ee[_0x27f748];return _0x7811b;};'use strict';var Sequelize=require(_0xe81e('0x0'));module[_0xe81e('0x1')]={'name':{'type':Sequelize[_0xe81e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe81e('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xe81e('0x2')]},'email':{'type':Sequelize[_0xe81e('0x2')]},'remoteUri':{'type':Sequelize[_0xe81e('0x2')],'unique':_0xe81e('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x146c=['STRING','remoteUri','exports'];(function(_0x3afe18,_0x26922c){var _0x19ed1f=function(_0x1c0660){while(--_0x1c0660){_0x3afe18['push'](_0x3afe18['shift']());}};_0x19ed1f(++_0x26922c);}(_0x146c,0xd7));var _0xc146=function(_0x4e07a1,_0x1e41c4){_0x4e07a1=_0x4e07a1-0x0;var _0x3c3d8b=_0x146c[_0x4e07a1];return _0x3c3d8b;};'use strict';var Sequelize=require('sequelize');module[_0xc146('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc146('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xc146('0x1')]},'remoteUri':{'type':Sequelize[_0xc146('0x1')],'unique':_0xc146('0x2')},'serverUrl':{'type':Sequelize[_0xc146('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 fcf7f12..b3bae64 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 _0x5c04=['then','destroy','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','getConfigurations','addConfiguration','findOne','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','Subjects','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','caused_by','upon_reject','child_incidents','number','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','impact','active','work_notes_list','business_service','priority','sys_domain_path','time_worked','opened_at','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','urgency','problem_id','company','reassignment_count','assigned_to','comments','sla_due','approval','sys_mod_count','escalation','upon_approval','correlation_id','location','category','username','password','email','remoteUri','serverUrl','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','includes','forEach','internalType','all','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','push','concat','ServiceNow\x20error:\x20','test','statusCode','error','boolean','True','true','False','false','inactive','value','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update'];(function(_0x5c0e2e,_0x1becd3){var _0x426c37=function(_0x332025){while(--_0x332025){_0x5c0e2e['push'](_0x5c0e2e['shift']());}};_0x426c37(++_0x1becd3);}(_0x5c04,0x143));var _0x45c0=function(_0x18f140,_0x3de293){_0x18f140=_0x18f140-0x0;var _0x387a89=_0x5c04[_0x18f140];return _0x387a89;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x45c0('0x0'));var zipdir=require(_0x45c0('0x1'));var jsonpatch=require(_0x45c0('0x2'));var rp=require(_0x45c0('0x3'));var moment=require(_0x45c0('0x4'));var BPromise=require(_0x45c0('0x5'));var Mustache=require(_0x45c0('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x45c0('0x7'));var ejs=require(_0x45c0('0x8'));var fs=require('fs');var fs_extra=require(_0x45c0('0x9'));var _=require(_0x45c0('0xa'));var squel=require('squel');var crypto=require(_0x45c0('0xb'));var jsforce=require(_0x45c0('0xc'));var deskjs=require(_0x45c0('0xd'));var toCsv=require(_0x45c0('0x7'));var querystring=require(_0x45c0('0xe'));var Papa=require('papaparse');var Redis=require(_0x45c0('0xf'));var authService=require(_0x45c0('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x45c0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x45c0('0x12'))('api');var utils=require(_0x45c0('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x45c0('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0x45c0('0x15'));function respondWithStatusCode(_0x1ee669,_0xb59ca1){_0xb59ca1=_0xb59ca1||0xcc;return function(_0x3a8a31){if(_0x3a8a31){return _0x1ee669[_0x45c0('0x16')](_0xb59ca1);}return _0x1ee669['status'](_0xb59ca1)[_0x45c0('0x17')]();};}function respondWithResult(_0x5a8a65,_0x3b015a){_0x3b015a=_0x3b015a||0xc8;return function(_0x55af5d){if(_0x55af5d){return _0x5a8a65[_0x45c0('0x18')](_0x3b015a)[_0x45c0('0x19')](_0x55af5d);}};}function respondWithFilteredResult(_0x51736d,_0x131fc2){return function(_0x1abc8e){if(_0x1abc8e){var _0x58514e=typeof _0x131fc2['offset']===_0x45c0('0x1a')&&typeof _0x131fc2[_0x45c0('0x1b')]===_0x45c0('0x1a');var _0x159289=_0x1abc8e[_0x45c0('0x1c')];var _0x3d743e=_0x58514e?0x0:_0x131fc2[_0x45c0('0x1d')];var _0x380d7f=_0x58514e?_0x1abc8e[_0x45c0('0x1c')]:_0x131fc2[_0x45c0('0x1d')]+_0x131fc2[_0x45c0('0x1b')];var _0x2d3858;if(_0x380d7f>=_0x159289){_0x380d7f=_0x159289;_0x2d3858=0xc8;}else{_0x2d3858=0xce;}_0x51736d[_0x45c0('0x18')](_0x2d3858);return _0x51736d[_0x45c0('0x1e')](_0x45c0('0x1f'),_0x3d743e+'-'+_0x380d7f+'/'+_0x159289)[_0x45c0('0x19')](_0x1abc8e);}return null;};}function patchUpdates(_0x4a352b){return function(_0x3270c3){try{jsonpatch['apply'](_0x3270c3,_0x4a352b,!![]);}catch(_0x1efda9){return BPromise[_0x45c0('0x20')](_0x1efda9);}return _0x3270c3[_0x45c0('0x21')]();};}function saveUpdates(_0x3b8a7b,_0x4f624b){return function(_0x310572){if(_0x310572){return _0x310572[_0x45c0('0x22')](_0x3b8a7b)[_0x45c0('0x23')](function(_0x454a8a){return _0x454a8a;});}return null;};}function removeEntity(_0x1ea933,_0x49c50b){return function(_0x31a6db){if(_0x31a6db){return _0x31a6db[_0x45c0('0x24')]()['then'](function(){_0x1ea933[_0x45c0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22611a,_0x580816){return function(_0x621130){if(!_0x621130){_0x22611a[_0x45c0('0x16')](0x194);}return _0x621130;};}function handleError(_0x52a70d,_0x32305d){_0x32305d=_0x32305d||0x1f4;return function(_0x2e27c6){logger['error'](_0x2e27c6[_0x45c0('0x25')]);if(_0x2e27c6['name']){delete _0x2e27c6[_0x45c0('0x26')];}_0x52a70d[_0x45c0('0x18')](_0x32305d)[_0x45c0('0x27')](_0x2e27c6);};}exports[_0x45c0('0x28')]=function(_0xf7ac0a,_0x609672){var _0x503ebc={},_0x3899e8={},_0x4ed869={'count':0x0,'rows':[]};var _0x5d03c8=_[_0x45c0('0x29')](db[_0x45c0('0x2a')][_0x45c0('0x2b')],function(_0x1ea4df){return{'name':_0x1ea4df[_0x45c0('0x2c')],'type':_0x1ea4df[_0x45c0('0x2d')][_0x45c0('0x2e')]};});_0x3899e8['model']=_[_0x45c0('0x29')](_0x5d03c8,_0x45c0('0x26'));_0x3899e8[_0x45c0('0x2f')]=_[_0x45c0('0x30')](_0xf7ac0a[_0x45c0('0x2f')]);_0x3899e8[_0x45c0('0x31')]=_['intersection'](_0x3899e8[_0x45c0('0x32')],_0x3899e8[_0x45c0('0x2f')]);_0x503ebc[_0x45c0('0x33')]=_[_0x45c0('0x34')](_0x3899e8['model'],qs[_0x45c0('0x35')](_0xf7ac0a[_0x45c0('0x2f')]['fields']));_0x503ebc[_0x45c0('0x33')]=_0x503ebc[_0x45c0('0x33')][_0x45c0('0x36')]?_0x503ebc[_0x45c0('0x33')]:_0x3899e8[_0x45c0('0x32')];if(!_0xf7ac0a[_0x45c0('0x2f')][_0x45c0('0x37')](_0x45c0('0x38'))){_0x503ebc[_0x45c0('0x1b')]=qs[_0x45c0('0x1b')](_0xf7ac0a[_0x45c0('0x2f')][_0x45c0('0x1b')]);_0x503ebc[_0x45c0('0x1d')]=qs['offset'](_0xf7ac0a['query'][_0x45c0('0x1d')]);}_0x503ebc[_0x45c0('0x39')]=qs[_0x45c0('0x3a')](_0xf7ac0a[_0x45c0('0x2f')]['sort']);_0x503ebc['where']=qs[_0x45c0('0x31')](_[_0x45c0('0x3b')](_0xf7ac0a[_0x45c0('0x2f')],_0x3899e8[_0x45c0('0x31')]),_0x5d03c8);if(_0xf7ac0a['query'][_0x45c0('0x3c')]){_0x503ebc[_0x45c0('0x3d')]=_[_0x45c0('0x3e')](_0x503ebc[_0x45c0('0x3d')],{'$or':_[_0x45c0('0x29')](_0x5d03c8,function(_0x49c556){if(_0x49c556[_0x45c0('0x2d')]!=='VIRTUAL'){var _0x4a516f={};_0x4a516f[_0x49c556[_0x45c0('0x26')]]={'$like':'%'+_0xf7ac0a[_0x45c0('0x2f')]['filter']+'%'};return _0x4a516f;}})});}_0x503ebc=_[_0x45c0('0x3e')]({},_0x503ebc,_0xf7ac0a[_0x45c0('0x3f')]);var _0x53c47f={'where':_0x503ebc['where']};return db[_0x45c0('0x2a')][_0x45c0('0x1c')](_0x53c47f)[_0x45c0('0x23')](function(_0x28eb8c){_0x4ed869[_0x45c0('0x1c')]=_0x28eb8c;if(_0xf7ac0a[_0x45c0('0x2f')][_0x45c0('0x40')]){_0x503ebc[_0x45c0('0x41')]=[{'all':!![]}];}return db[_0x45c0('0x2a')][_0x45c0('0x42')](_0x503ebc);})[_0x45c0('0x23')](function(_0x4c4793){_0x4ed869[_0x45c0('0x43')]=_0x4c4793;return _0x4ed869;})['then'](respondWithFilteredResult(_0x609672,_0x503ebc))[_0x45c0('0x44')](handleError(_0x609672,null));};exports['show']=function(_0x12804e,_0x3aa4b7){var _0x3f00e4={'raw':![],'where':{'id':_0x12804e[_0x45c0('0x45')]['id']}},_0xdcbaf0={};_0xdcbaf0[_0x45c0('0x32')]=_['keys'](db['ServicenowAccount']['rawAttributes']);_0xdcbaf0[_0x45c0('0x2f')]=_[_0x45c0('0x30')](_0x12804e[_0x45c0('0x2f')]);_0xdcbaf0[_0x45c0('0x31')]=_[_0x45c0('0x34')](_0xdcbaf0['model'],_0xdcbaf0[_0x45c0('0x2f')]);_0x3f00e4[_0x45c0('0x33')]=_[_0x45c0('0x34')](_0xdcbaf0['model'],qs['fields'](_0x12804e[_0x45c0('0x2f')][_0x45c0('0x35')]));_0x3f00e4['attributes']=_0x3f00e4[_0x45c0('0x33')][_0x45c0('0x36')]?_0x3f00e4[_0x45c0('0x33')]:_0xdcbaf0[_0x45c0('0x32')];if(_0x12804e['query'][_0x45c0('0x40')]){_0x3f00e4[_0x45c0('0x41')]=[{'all':!![]}];}_0x3f00e4=_[_0x45c0('0x3e')]({},_0x3f00e4,_0x12804e[_0x45c0('0x3f')]);return db['ServicenowAccount'][_0x45c0('0x46')](_0x3f00e4)[_0x45c0('0x23')](handleEntityNotFound(_0x3aa4b7,null))[_0x45c0('0x23')](respondWithResult(_0x3aa4b7,null))['catch'](handleError(_0x3aa4b7,null));};exports[_0x45c0('0x47')]=function(_0x52e025,_0xba89e5){return db[_0x45c0('0x2a')][_0x45c0('0x47')](_0x52e025[_0x45c0('0x48')],{})[_0x45c0('0x23')](respondWithResult(_0xba89e5,0xc9))[_0x45c0('0x44')](handleError(_0xba89e5,null));};exports['update']=function(_0xc33684,_0x10023d){if(_0xc33684[_0x45c0('0x48')]['id']){delete _0xc33684['body']['id'];}return db[_0x45c0('0x2a')][_0x45c0('0x46')]({'where':{'id':_0xc33684[_0x45c0('0x45')]['id']}})['then'](handleEntityNotFound(_0x10023d,null))['then'](saveUpdates(_0xc33684[_0x45c0('0x48')],null))['then'](respondWithResult(_0x10023d,null))[_0x45c0('0x44')](handleError(_0x10023d,null));};exports[_0x45c0('0x24')]=function(_0x24b033,_0x38c4e0){return db[_0x45c0('0x2a')][_0x45c0('0x46')]({'where':{'id':_0x24b033[_0x45c0('0x45')]['id']}})['then'](handleEntityNotFound(_0x38c4e0,null))[_0x45c0('0x23')](removeEntity(_0x38c4e0,null))['catch'](handleError(_0x38c4e0,null));};exports[_0x45c0('0x49')]=function(_0x5c6476,_0x280052,_0x433ee0){var _0x51e8ea={};var _0x2a16ac={};var _0x3b5530;var _0x442545;return db[_0x45c0('0x2a')]['findOne']({'where':{'id':_0x5c6476[_0x45c0('0x45')]['id']}})[_0x45c0('0x23')](handleEntityNotFound(_0x280052,null))[_0x45c0('0x23')](function(_0x41992b){if(_0x41992b){_0x3b5530=_0x41992b;_0x2a16ac['model']=_['keys'](db['ServicenowConfiguration'][_0x45c0('0x2b')]);_0x2a16ac[_0x45c0('0x2f')]=_['keys'](_0x5c6476[_0x45c0('0x2f')]);_0x2a16ac[_0x45c0('0x31')]=_[_0x45c0('0x34')](_0x2a16ac[_0x45c0('0x32')],_0x2a16ac['query']);_0x51e8ea[_0x45c0('0x33')]=_[_0x45c0('0x34')](_0x2a16ac[_0x45c0('0x32')],qs['fields'](_0x5c6476[_0x45c0('0x2f')][_0x45c0('0x35')]));_0x51e8ea[_0x45c0('0x33')]=_0x51e8ea[_0x45c0('0x33')]['length']?_0x51e8ea[_0x45c0('0x33')]:_0x2a16ac[_0x45c0('0x32')];_0x51e8ea[_0x45c0('0x39')]=qs['sort'](_0x5c6476['query'][_0x45c0('0x3a')]);_0x51e8ea['where']=qs['filters'](_[_0x45c0('0x3b')](_0x5c6476[_0x45c0('0x2f')],_0x2a16ac[_0x45c0('0x31')]));if(_0x5c6476[_0x45c0('0x2f')]['filter']){_0x51e8ea[_0x45c0('0x3d')]=_[_0x45c0('0x3e')](_0x51e8ea[_0x45c0('0x3d')],{'$or':_[_0x45c0('0x29')](_0x51e8ea['attributes'],function(_0xf0e8b3){var _0x366e50={};_0x366e50[_0xf0e8b3]={'$like':'%'+_0x5c6476[_0x45c0('0x2f')][_0x45c0('0x3c')]+'%'};return _0x366e50;})});}_0x51e8ea=_[_0x45c0('0x3e')]({},_0x51e8ea,_0x5c6476[_0x45c0('0x3f')]);return _0x3b5530['getConfigurations'](_0x51e8ea);}})['then'](function(_0x1b49e4){if(_0x1b49e4){_0x442545=_0x1b49e4[_0x45c0('0x36')];if(!_0x5c6476[_0x45c0('0x2f')]['hasOwnProperty']('nolimit')){_0x51e8ea['limit']=qs[_0x45c0('0x1b')](_0x5c6476[_0x45c0('0x2f')]['limit']);_0x51e8ea[_0x45c0('0x1d')]=qs[_0x45c0('0x1d')](_0x5c6476[_0x45c0('0x2f')][_0x45c0('0x1d')]);}return _0x3b5530[_0x45c0('0x49')](_0x51e8ea);}})[_0x45c0('0x23')](function(_0x58f3c4){if(_0x58f3c4){return _0x58f3c4?{'count':_0x442545,'rows':_0x58f3c4}:null;}})[_0x45c0('0x23')](respondWithResult(_0x280052,null))['catch'](handleError(_0x280052,null));};exports[_0x45c0('0x4a')]=function(_0x41341f,_0xdaacd5,_0x4b780f){if(_0x41341f['body']['id']){delete _0x41341f[_0x45c0('0x48')]['id'];}return db[_0x45c0('0x2a')][_0x45c0('0x4b')]({'where':{'id':_0x41341f[_0x45c0('0x45')]['id']}})['then'](handleEntityNotFound(_0xdaacd5,null))[_0x45c0('0x23')](function(_0xdbd994){if(_0xdbd994){_0x41341f[_0x45c0('0x48')]['AccountId']=_0xdbd994['id'];_0x41341f[_0x45c0('0x48')]['Subjects']=integrations[_0x45c0('0x4c')](_0x41341f['body'][_0x45c0('0x4d')],_0x41341f[_0x45c0('0x48')][_0x45c0('0x2d')]);_0x41341f[_0x45c0('0x48')][_0x45c0('0x4e')]=integrations[_0x45c0('0x4f')](_0x41341f['body']['channel'],_0x41341f[_0x45c0('0x48')]['type']);return db[_0x45c0('0x50')][_0x45c0('0x47')](_0x41341f['body'],{'include':[{'model':db[_0x45c0('0x51')],'as':_0x45c0('0x52')},{'model':db[_0x45c0('0x51')],'as':_0x45c0('0x4e')}]});}return null;})[_0x45c0('0x23')](respondWithResult(_0xdaacd5,null))[_0x45c0('0x44')](handleError(_0xdaacd5,null));};exports['getFields']=function(_0xb4fa14,_0xb5db53,_0xa5c20d){var _0x2c3442=[_0x45c0('0x53'),_0x45c0('0x54'),_0x45c0('0x55'),_0x45c0('0x56'),_0x45c0('0x57'),_0x45c0('0x58'),_0x45c0('0x59'),_0x45c0('0x5a'),'category'];var _0x356911=['parent',_0x45c0('0x53'),_0x45c0('0x5b'),'watch_list',_0x45c0('0x5c'),'sys_updated_on',_0x45c0('0x5d'),_0x45c0('0x54'),'approval_history',_0x45c0('0x5e'),_0x45c0('0x5f'),_0x45c0('0x60'),'opened_by',_0x45c0('0x61'),_0x45c0('0x62'),_0x45c0('0x63'),_0x45c0('0x64'),_0x45c0('0x65'),_0x45c0('0x55'),_0x45c0('0x39'),_0x45c0('0x66'),'closed_at','cmdb_ci','delivery_plan',_0x45c0('0x67'),_0x45c0('0x68'),_0x45c0('0x69'),_0x45c0('0x6a'),_0x45c0('0x6b'),_0x45c0('0x6c'),'rfc',_0x45c0('0x6d'),'expected_start',_0x45c0('0x6e'),'business_duration',_0x45c0('0x6f'),_0x45c0('0x70'),_0x45c0('0x71'),_0x45c0('0x72'),_0x45c0('0x73'),_0x45c0('0x74'),_0x45c0('0x56'),_0x45c0('0x75'),_0x45c0('0x76'),_0x45c0('0x57'),'correlation_display','delivery_task',_0x45c0('0x77'),_0x45c0('0x78'),_0x45c0('0x79'),_0x45c0('0x7a'),_0x45c0('0x7b'),_0x45c0('0x7c'),_0x45c0('0x58'),_0x45c0('0x7d'),_0x45c0('0x7e'),_0x45c0('0x7f'),_0x45c0('0x80'),_0x45c0('0x81'),_0x45c0('0x82'),_0x45c0('0x83'),'reopened_by',_0x45c0('0x59'),_0x45c0('0x84'),_0x45c0('0x85'),_0x45c0('0x86'),_0x45c0('0x87'),'activity_due',_0x45c0('0x88'),'severity',_0x45c0('0x89'),_0x45c0('0x8a'),_0x45c0('0x8b'),'comments_and_work_notes','due_date',_0x45c0('0x8c'),'reopen_count','sys_tags',_0x45c0('0x8d'),_0x45c0('0x8e'),_0x45c0('0x8f'),_0x45c0('0x90'),_0x45c0('0x91')];var _0x37a528='';var _0x3eb6d4='';var _0x4f7a9b=[];var _0x3f06f4='';var _0x5e6e96='';var _0x400474=[];var _0x2766ad='';var _0x1506b7='';var _0x141b48={};var _0x2787ed='';return db[_0x45c0('0x2a')][_0x45c0('0x4b')]({'where':{'id':_0xb4fa14[_0x45c0('0x45')]['id']},'attributes':['id',_0x45c0('0x92'),_0x45c0('0x93'),_0x45c0('0x94'),_0x45c0('0x95'),_0x45c0('0x96')]})[_0x45c0('0x23')](handleEntityNotFound(_0xb5db53,null))['then'](function(_0x43fd97){if(_0x43fd97){_0x2787ed=_0x43fd97[_0x45c0('0x95')];var _0x1e3cd4=_0x2787ed['slice'](-0x1);if(_0x1e3cd4==='/'){_0x2787ed=_0x2787ed['substring'](0x0,_0x2787ed['lastIndexOf'](_0x1e3cd4));}_0x1506b7=util[_0x45c0('0x97')]('%s/api/now/doc/table/schema/',_0x2787ed);_0x2766ad=util[_0x45c0('0x97')](_0x45c0('0x98'),_0x2787ed);_0x141b48={'user':_0x43fd97[_0x45c0('0x92')],'pass':_0x43fd97[_0x45c0('0x93')]};var _0x3ed10f={'method':_0x45c0('0x99'),'uri':_0x1506b7+_0x45c0('0x9a'),'auth':_0x141b48,'json':!![]};return rp(_0x3ed10f);}})[_0x45c0('0x23')](function(_0xcc62dd){if(_0xcc62dd[_0x45c0('0x9b')]['length']>0x0){_0x37a528=_0xcc62dd[_0x45c0('0x9b')];}console[_0x45c0('0x9c')](_0x45c0('0x9d'),_0x37a528);_0x400474=[];_0x3eb6d4=Object[_0x45c0('0x9e')]([],_0x37a528);_['remove'](_0x3eb6d4,function(_0x4be5db){return!_0x2c3442[_0x45c0('0x9f')](_0x4be5db['name']);});_0x3eb6d4[_0x45c0('0xa0')](function(_0x442cd1){var _0x37b4fa=createFieldObject(_0x2766ad,_0x141b48,_0x442cd1[_0x45c0('0xa1')],_0x442cd1[_0x45c0('0x26')],_0x442cd1['label'],![]);_0x400474['push'](_0x37b4fa);});return Promise[_0x45c0('0xa2')](_0x400474);})[_0x45c0('0x23')](function(_0x44b353){_0x4f7a9b=_0x44b353;_0x3f06f4=Object[_0x45c0('0x9e')]([],_0x37a528);console[_0x45c0('0x9c')]('TCL:\x20_object',_0x37a528);_[_0x45c0('0xa3')](_0x3f06f4,function(_0xd93438){return _0x356911[_0x45c0('0x9f')](_0xd93438[_0x45c0('0x26')]);});console[_0x45c0('0x9c')](_0x45c0('0xa4'),_0x3f06f4);_0x400474=[];_0x3f06f4['forEach'](function(_0x2dbdd4){var _0x4f8d53=createFieldObject(_0x2766ad,_0x141b48,_0x2dbdd4[_0x45c0('0xa1')],_0x2dbdd4[_0x45c0('0x26')],_0x2dbdd4[_0x45c0('0xa5')],!![]);_0x400474[_0x45c0('0xa6')](_0x4f8d53);});return Promise[_0x45c0('0xa2')](_0x400474);})['then'](function(_0x594de3){_0x5e6e96=_0x594de3;var _0x55f3dd=_0x4f7a9b[_0x45c0('0xa7')](_0x5e6e96);return{'count':_0x55f3dd[_0x45c0('0x36')],'rows':_0x55f3dd};})[_0x45c0('0x23')](respondWithResult(_0xb5db53,null))['catch'](function(_0x46abce){console[_0x45c0('0x9c')](_0x45c0('0xa8')+_0x46abce);var _0x56c65a=_0xb4fa14['query'][_0x45c0('0xa9')]?0x1f4:_0x46abce[_0x45c0('0xaa')]||0x1f4;logger[_0x45c0('0xab')](_0x46abce[_0x45c0('0x25')]);delete _0x46abce[_0x45c0('0x26')];if(_0x56c65a===0x191){_0x56c65a=0x190;}_0xb5db53[_0x45c0('0x18')](_0x56c65a)[_0x45c0('0x27')](_0xb4fa14[_0x45c0('0x2f')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x46abce[_0x45c0('0xaa')]}:_0x46abce);});};function createFieldObject(_0x46e61b,_0xafcda5,_0x406619,_0x57b2c9,_0x589c55,_0x48ce05){return new Promise(function(_0x1ae3aa,_0x2e38b2){var _0xe74ee3={'id':_0x57b2c9,'name':_0x589c55,'custom':_0x48ce05};if(_0x406619===_0x45c0('0xac')){_0xe74ee3[_0x45c0('0x3f')]=[{'name':_0x45c0('0xad'),'value':_0x45c0('0xae')},{'name':_0x45c0('0xaf'),'value':_0x45c0('0xb0')}];_0x1ae3aa(_0xe74ee3);}else{var _0x1e6377={'method':_0x45c0('0x99'),'uri':_0x46e61b+'sys_choice?sysparm_query=name=incident^element='+_0x57b2c9,'auth':_0xafcda5,'json':!![]};return rp(_0x1e6377)['then'](function(_0x51a677){var _0x5eca76=[];if(_0x51a677[_0x45c0('0x9b')][_0x45c0('0x36')]>0x0){_0x51a677['result']['forEach'](function(_0x21fd66){if(_0x21fd66[_0x45c0('0xb1')]===_0x45c0('0xb0')){var _0xb8b6ba={'name':_0x21fd66[_0x45c0('0xa5')],'value':_0x21fd66[_0x45c0('0xb2')]};_0x5eca76[_0x45c0('0xa6')](_0xb8b6ba);}});}_0xe74ee3[_0x45c0('0x3f')]=_0x5eca76;if(_0xe74ee3[_0x45c0('0x3f')][_0x45c0('0x36')]>0x0){_0x1ae3aa(_0xe74ee3);}else{if(_0x48ce05==![]){_0x1ae3aa();}else{_0x1ae3aa(_0xe74ee3);}}});}});} \ No newline at end of file +var _0x2fca=['../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','name','ServicenowAccount','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','find','create','body','findOne','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ServicenowConfiguration','ServicenowField','Descriptions','getFields','made_sla','hold_reason','knowledge','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','approval_history','resolved_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','order','closed_at','cmdb_ci','delivery_plan','impact','active','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','caller_id','approval_set','subcategory','work_notes','close_code','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','notify','sys_class_name','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_tags','escalation','upon_approval','correlation_id','username','password','remoteUri','slice','lastIndexOf','%s/api/now/doc/table/schema/','incident?sysparm_display_value=all','result','remove','includes','internalType','label','push','all','assign','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','true','False','false','GET','forEach','inactive','value','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment'];(function(_0x30d05d,_0x3cceb9){var _0xddaf4b=function(_0x5a6f8f){while(--_0x5a6f8f){_0x30d05d['push'](_0x30d05d['shift']());}};_0xddaf4b(++_0x3cceb9);}(_0x2fca,0x155));var _0xa2fc=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x2fca[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0xa2fc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa2fc('0x1'));var jsonpatch=require(_0xa2fc('0x2'));var rp=require(_0xa2fc('0x3'));var moment=require(_0xa2fc('0x4'));var BPromise=require(_0xa2fc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa2fc('0x6'));var sox=require(_0xa2fc('0x7'));var csv=require(_0xa2fc('0x8'));var ejs=require(_0xa2fc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa2fc('0xa'));var squel=require('squel');var crypto=require(_0xa2fc('0xb'));var jsforce=require(_0xa2fc('0xc'));var deskjs=require(_0xa2fc('0xd'));var toCsv=require(_0xa2fc('0x8'));var querystring=require(_0xa2fc('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa2fc('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2fc('0x10'))('api');var utils=require(_0xa2fc('0x11'));var config=require(_0xa2fc('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xa2fc('0x13'))['db'];var integrations=require(_0xa2fc('0x14'));function respondWithStatusCode(_0x193145,_0x2324d1){_0x2324d1=_0x2324d1||0xcc;return function(_0x4f90cf){if(_0x4f90cf){return _0x193145[_0xa2fc('0x15')](_0x2324d1);}return _0x193145[_0xa2fc('0x16')](_0x2324d1)[_0xa2fc('0x17')]();};}function respondWithResult(_0x1fa102,_0xea4bd4){_0xea4bd4=_0xea4bd4||0xc8;return function(_0x3b4ea3){if(_0x3b4ea3){return _0x1fa102[_0xa2fc('0x16')](_0xea4bd4)[_0xa2fc('0x18')](_0x3b4ea3);}};}function respondWithFilteredResult(_0x188a30,_0xd439b9){return function(_0x33eaab){if(_0x33eaab){var _0x5dd33=typeof _0xd439b9[_0xa2fc('0x19')]===_0xa2fc('0x1a')&&typeof _0xd439b9['limit']===_0xa2fc('0x1a');var _0x371888=_0x33eaab[_0xa2fc('0x1b')];var _0x2d38da=_0x5dd33?0x0:_0xd439b9[_0xa2fc('0x19')];var _0x318f61=_0x5dd33?_0x33eaab[_0xa2fc('0x1b')]:_0xd439b9[_0xa2fc('0x19')]+_0xd439b9[_0xa2fc('0x1c')];var _0x49c95a;if(_0x318f61>=_0x371888){_0x318f61=_0x371888;_0x49c95a=0xc8;}else{_0x49c95a=0xce;}_0x188a30[_0xa2fc('0x16')](_0x49c95a);return _0x188a30[_0xa2fc('0x1d')](_0xa2fc('0x1e'),_0x2d38da+'-'+_0x318f61+'/'+_0x371888)[_0xa2fc('0x18')](_0x33eaab);}return null;};}function patchUpdates(_0x57987e){return function(_0x339756){try{jsonpatch[_0xa2fc('0x1f')](_0x339756,_0x57987e,!![]);}catch(_0x2f1662){return BPromise[_0xa2fc('0x20')](_0x2f1662);}return _0x339756[_0xa2fc('0x21')]();};}function saveUpdates(_0x24f609,_0x5e274f){return function(_0x4b2f85){if(_0x4b2f85){return _0x4b2f85[_0xa2fc('0x22')](_0x24f609)['then'](function(_0x429098){return _0x429098;});}return null;};}function removeEntity(_0x57dee8,_0x5f0929){return function(_0xe7daf9){if(_0xe7daf9){return _0xe7daf9[_0xa2fc('0x23')]()[_0xa2fc('0x24')](function(){_0x57dee8[_0xa2fc('0x16')](0xcc)[_0xa2fc('0x17')]();});}};}function handleEntityNotFound(_0x1af330,_0x1ab707){return function(_0x36538f){if(!_0x36538f){_0x1af330[_0xa2fc('0x15')](0x194);}return _0x36538f;};}function handleError(_0x80b43,_0x2cb45a){_0x2cb45a=_0x2cb45a||0x1f4;return function(_0xa0666d){logger[_0xa2fc('0x25')](_0xa0666d['stack']);if(_0xa0666d['name']){delete _0xa0666d[_0xa2fc('0x26')];}_0x80b43[_0xa2fc('0x16')](_0x2cb45a)['send'](_0xa0666d);};}exports['index']=function(_0x2ba3a4,_0x26887d){var _0x381164={},_0x1b4939={},_0x57e8e1={'count':0x0,'rows':[]};var _0x256ff3=_['map'](db[_0xa2fc('0x27')]['rawAttributes'],function(_0x94433f){return{'name':_0x94433f[_0xa2fc('0x28')],'type':_0x94433f[_0xa2fc('0x29')][_0xa2fc('0x2a')]};});_0x1b4939[_0xa2fc('0x2b')]=_[_0xa2fc('0x2c')](_0x256ff3,_0xa2fc('0x26'));_0x1b4939['query']=_['keys'](_0x2ba3a4[_0xa2fc('0x2d')]);_0x1b4939[_0xa2fc('0x2e')]=_[_0xa2fc('0x2f')](_0x1b4939[_0xa2fc('0x2b')],_0x1b4939[_0xa2fc('0x2d')]);_0x381164['attributes']=_['intersection'](_0x1b4939[_0xa2fc('0x2b')],qs[_0xa2fc('0x30')](_0x2ba3a4[_0xa2fc('0x2d')][_0xa2fc('0x30')]));_0x381164['attributes']=_0x381164[_0xa2fc('0x31')][_0xa2fc('0x32')]?_0x381164[_0xa2fc('0x31')]:_0x1b4939['model'];if(!_0x2ba3a4[_0xa2fc('0x2d')][_0xa2fc('0x33')]('nolimit')){_0x381164[_0xa2fc('0x1c')]=qs[_0xa2fc('0x1c')](_0x2ba3a4[_0xa2fc('0x2d')][_0xa2fc('0x1c')]);_0x381164[_0xa2fc('0x19')]=qs[_0xa2fc('0x19')](_0x2ba3a4[_0xa2fc('0x2d')][_0xa2fc('0x19')]);}_0x381164['order']=qs[_0xa2fc('0x34')](_0x2ba3a4['query']['sort']);_0x381164[_0xa2fc('0x35')]=qs['filters'](_[_0xa2fc('0x36')](_0x2ba3a4['query'],_0x1b4939[_0xa2fc('0x2e')]),_0x256ff3);if(_0x2ba3a4[_0xa2fc('0x2d')][_0xa2fc('0x37')]){_0x381164['where']=_[_0xa2fc('0x38')](_0x381164['where'],{'$or':_[_0xa2fc('0x2c')](_0x256ff3,function(_0xb248e){if(_0xb248e[_0xa2fc('0x29')]!=='VIRTUAL'){var _0x4ee6d7={};_0x4ee6d7[_0xb248e['name']]={'$like':'%'+_0x2ba3a4[_0xa2fc('0x2d')][_0xa2fc('0x37')]+'%'};return _0x4ee6d7;}})});}_0x381164=_[_0xa2fc('0x38')]({},_0x381164,_0x2ba3a4[_0xa2fc('0x39')]);var _0x9a97ee={'where':_0x381164['where']};return db['ServicenowAccount'][_0xa2fc('0x1b')](_0x9a97ee)[_0xa2fc('0x24')](function(_0x36cf62){_0x57e8e1['count']=_0x36cf62;if(_0x2ba3a4[_0xa2fc('0x2d')][_0xa2fc('0x3a')]){_0x381164[_0xa2fc('0x3b')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xa2fc('0x3c')](_0x381164);})[_0xa2fc('0x24')](function(_0x40458b){_0x57e8e1['rows']=_0x40458b;return _0x57e8e1;})[_0xa2fc('0x24')](respondWithFilteredResult(_0x26887d,_0x381164))[_0xa2fc('0x3d')](handleError(_0x26887d,null));};exports[_0xa2fc('0x3e')]=function(_0x23ed13,_0x5d4ae4){var _0x4160ea={'raw':![],'where':{'id':_0x23ed13[_0xa2fc('0x3f')]['id']}},_0x14fc50={};_0x14fc50[_0xa2fc('0x2b')]=_[_0xa2fc('0x40')](db['ServicenowAccount'][_0xa2fc('0x41')]);_0x14fc50['query']=_[_0xa2fc('0x40')](_0x23ed13[_0xa2fc('0x2d')]);_0x14fc50[_0xa2fc('0x2e')]=_[_0xa2fc('0x2f')](_0x14fc50[_0xa2fc('0x2b')],_0x14fc50[_0xa2fc('0x2d')]);_0x4160ea[_0xa2fc('0x31')]=_[_0xa2fc('0x2f')](_0x14fc50[_0xa2fc('0x2b')],qs['fields'](_0x23ed13['query']['fields']));_0x4160ea[_0xa2fc('0x31')]=_0x4160ea[_0xa2fc('0x31')]['length']?_0x4160ea[_0xa2fc('0x31')]:_0x14fc50['model'];if(_0x23ed13['query'][_0xa2fc('0x3a')]){_0x4160ea[_0xa2fc('0x3b')]=[{'all':!![]}];}_0x4160ea=_[_0xa2fc('0x38')]({},_0x4160ea,_0x23ed13[_0xa2fc('0x39')]);return db[_0xa2fc('0x27')][_0xa2fc('0x42')](_0x4160ea)[_0xa2fc('0x24')](handleEntityNotFound(_0x5d4ae4,null))[_0xa2fc('0x24')](respondWithResult(_0x5d4ae4,null))['catch'](handleError(_0x5d4ae4,null));};exports[_0xa2fc('0x43')]=function(_0x3bbd0b,_0x424cb8){return db['ServicenowAccount'][_0xa2fc('0x43')](_0x3bbd0b['body'],{})[_0xa2fc('0x24')](respondWithResult(_0x424cb8,0xc9))[_0xa2fc('0x3d')](handleError(_0x424cb8,null));};exports[_0xa2fc('0x22')]=function(_0x29fe3b,_0x166337){if(_0x29fe3b['body']['id']){delete _0x29fe3b[_0xa2fc('0x44')]['id'];}return db[_0xa2fc('0x27')][_0xa2fc('0x42')]({'where':{'id':_0x29fe3b[_0xa2fc('0x3f')]['id']}})[_0xa2fc('0x24')](handleEntityNotFound(_0x166337,null))['then'](saveUpdates(_0x29fe3b[_0xa2fc('0x44')],null))[_0xa2fc('0x24')](respondWithResult(_0x166337,null))[_0xa2fc('0x3d')](handleError(_0x166337,null));};exports[_0xa2fc('0x23')]=function(_0x389ad9,_0x341263){return db[_0xa2fc('0x27')][_0xa2fc('0x42')]({'where':{'id':_0x389ad9['params']['id']}})[_0xa2fc('0x24')](handleEntityNotFound(_0x341263,null))[_0xa2fc('0x24')](removeEntity(_0x341263,null))[_0xa2fc('0x3d')](handleError(_0x341263,null));};exports['getConfigurations']=function(_0x5d59e2,_0x445ed9,_0x23a288){var _0x393ab8={};var _0xe5bc72={};var _0x4d687e;var _0x486036;return db[_0xa2fc('0x27')][_0xa2fc('0x45')]({'where':{'id':_0x5d59e2[_0xa2fc('0x3f')]['id']}})[_0xa2fc('0x24')](handleEntityNotFound(_0x445ed9,null))[_0xa2fc('0x24')](function(_0x467cc6){if(_0x467cc6){_0x4d687e=_0x467cc6;_0xe5bc72['model']=_[_0xa2fc('0x40')](db['ServicenowConfiguration'][_0xa2fc('0x41')]);_0xe5bc72['query']=_['keys'](_0x5d59e2[_0xa2fc('0x2d')]);_0xe5bc72['filters']=_[_0xa2fc('0x2f')](_0xe5bc72[_0xa2fc('0x2b')],_0xe5bc72['query']);_0x393ab8['attributes']=_[_0xa2fc('0x2f')](_0xe5bc72[_0xa2fc('0x2b')],qs[_0xa2fc('0x30')](_0x5d59e2['query'][_0xa2fc('0x30')]));_0x393ab8[_0xa2fc('0x31')]=_0x393ab8['attributes'][_0xa2fc('0x32')]?_0x393ab8[_0xa2fc('0x31')]:_0xe5bc72[_0xa2fc('0x2b')];_0x393ab8['order']=qs[_0xa2fc('0x34')](_0x5d59e2[_0xa2fc('0x2d')][_0xa2fc('0x34')]);_0x393ab8[_0xa2fc('0x35')]=qs[_0xa2fc('0x2e')](_[_0xa2fc('0x36')](_0x5d59e2[_0xa2fc('0x2d')],_0xe5bc72['filters']));if(_0x5d59e2[_0xa2fc('0x2d')][_0xa2fc('0x37')]){_0x393ab8['where']=_['merge'](_0x393ab8[_0xa2fc('0x35')],{'$or':_[_0xa2fc('0x2c')](_0x393ab8['attributes'],function(_0x9ffbd3){var _0x501f48={};_0x501f48[_0x9ffbd3]={'$like':'%'+_0x5d59e2[_0xa2fc('0x2d')][_0xa2fc('0x37')]+'%'};return _0x501f48;})});}_0x393ab8=_[_0xa2fc('0x38')]({},_0x393ab8,_0x5d59e2[_0xa2fc('0x39')]);return _0x4d687e[_0xa2fc('0x46')](_0x393ab8);}})[_0xa2fc('0x24')](function(_0x50809){if(_0x50809){_0x486036=_0x50809[_0xa2fc('0x32')];if(!_0x5d59e2[_0xa2fc('0x2d')][_0xa2fc('0x33')]('nolimit')){_0x393ab8[_0xa2fc('0x1c')]=qs['limit'](_0x5d59e2['query']['limit']);_0x393ab8[_0xa2fc('0x19')]=qs[_0xa2fc('0x19')](_0x5d59e2[_0xa2fc('0x2d')]['offset']);}return _0x4d687e['getConfigurations'](_0x393ab8);}})[_0xa2fc('0x24')](function(_0x5210d6){if(_0x5210d6){return _0x5210d6?{'count':_0x486036,'rows':_0x5210d6}:null;}})[_0xa2fc('0x24')](respondWithResult(_0x445ed9,null))[_0xa2fc('0x3d')](handleError(_0x445ed9,null));};exports[_0xa2fc('0x47')]=function(_0x473394,_0x5ca1c6,_0x3f8826){if(_0x473394[_0xa2fc('0x44')]['id']){delete _0x473394['body']['id'];}return db[_0xa2fc('0x27')][_0xa2fc('0x45')]({'where':{'id':_0x473394[_0xa2fc('0x3f')]['id']}})[_0xa2fc('0x24')](handleEntityNotFound(_0x5ca1c6,null))[_0xa2fc('0x24')](function(_0x4be6fb){if(_0x4be6fb){_0x473394[_0xa2fc('0x44')][_0xa2fc('0x48')]=_0x4be6fb['id'];_0x473394['body'][_0xa2fc('0x49')]=integrations[_0xa2fc('0x4a')](_0x473394[_0xa2fc('0x44')][_0xa2fc('0x4b')],_0x473394[_0xa2fc('0x44')]['type']);_0x473394['body']['Descriptions']=integrations[_0xa2fc('0x4c')](_0x473394[_0xa2fc('0x44')][_0xa2fc('0x4b')],_0x473394[_0xa2fc('0x44')][_0xa2fc('0x29')]);return db[_0xa2fc('0x4d')]['create'](_0x473394[_0xa2fc('0x44')],{'include':[{'model':db[_0xa2fc('0x4e')],'as':_0xa2fc('0x49')},{'model':db[_0xa2fc('0x4e')],'as':_0xa2fc('0x4f')}]});}return null;})[_0xa2fc('0x24')](respondWithResult(_0x5ca1c6,null))[_0xa2fc('0x3d')](handleError(_0x5ca1c6,null));};exports[_0xa2fc('0x50')]=function(_0x4b5b63,_0x9d1979,_0x1040a6){var _0xacb54b=[_0xa2fc('0x51'),_0xa2fc('0x52'),_0xa2fc('0x53'),'subcategory','close_code','notify',_0xa2fc('0x54'),_0xa2fc('0x55'),_0xa2fc('0x56')];var _0x364d2d=[_0xa2fc('0x57'),_0xa2fc('0x51'),_0xa2fc('0x58'),_0xa2fc('0x59'),_0xa2fc('0x5a'),_0xa2fc('0x5b'),'child_incidents',_0xa2fc('0x52'),_0xa2fc('0x5c'),'number',_0xa2fc('0x5d'),'sys_updated_by',_0xa2fc('0x5e'),_0xa2fc('0x5f'),_0xa2fc('0x60'),_0xa2fc('0x61'),_0xa2fc('0x62'),_0xa2fc('0x63'),_0xa2fc('0x53'),_0xa2fc('0x64'),'calendar_stc',_0xa2fc('0x65'),_0xa2fc('0x66'),_0xa2fc('0x67'),_0xa2fc('0x68'),_0xa2fc('0x69'),'work_notes_list',_0xa2fc('0x6a'),_0xa2fc('0x6b'),_0xa2fc('0x6c'),_0xa2fc('0x6d'),_0xa2fc('0x6e'),_0xa2fc('0x6f'),_0xa2fc('0x70'),_0xa2fc('0x71'),_0xa2fc('0x72'),'work_end','reopened_time','resolved_at',_0xa2fc('0x73'),_0xa2fc('0x74'),_0xa2fc('0x75'),_0xa2fc('0x76'),'short_description',_0xa2fc('0x77'),_0xa2fc('0x78'),_0xa2fc('0x79'),_0xa2fc('0x7a'),_0xa2fc('0x7b'),_0xa2fc('0x7c'),_0xa2fc('0x7d'),_0xa2fc('0x7e'),_0xa2fc('0x7f'),_0xa2fc('0x80'),_0xa2fc('0x81'),'close_notes',_0xa2fc('0x82'),_0xa2fc('0x83'),_0xa2fc('0x84'),_0xa2fc('0x85'),_0xa2fc('0x86'),_0xa2fc('0x87'),_0xa2fc('0x54'),_0xa2fc('0x88'),_0xa2fc('0x89'),_0xa2fc('0x8a'),_0xa2fc('0x8b'),'activity_due',_0xa2fc('0x8c'),_0xa2fc('0x55'),_0xa2fc('0x8d'),_0xa2fc('0x8e'),_0xa2fc('0x8f'),_0xa2fc('0x90'),_0xa2fc('0x91'),'sys_mod_count','reopen_count',_0xa2fc('0x92'),_0xa2fc('0x93'),_0xa2fc('0x94'),_0xa2fc('0x95'),'location',_0xa2fc('0x56')];var _0x1fc279='';var _0x391400='';var _0x53222f=[];var _0x4f3c1f='';var _0x34d808='';var _0x1fc969=[];var _0x41c4f0='';var _0xf0121d='';var _0x49bd61={};var _0x136406='';return db[_0xa2fc('0x27')]['findOne']({'where':{'id':_0x4b5b63[_0xa2fc('0x3f')]['id']},'attributes':['id',_0xa2fc('0x96'),_0xa2fc('0x97'),'email',_0xa2fc('0x98'),'serverUrl']})[_0xa2fc('0x24')](handleEntityNotFound(_0x9d1979,null))[_0xa2fc('0x24')](function(_0x33e8b9){if(_0x33e8b9){_0x136406=_0x33e8b9[_0xa2fc('0x98')];var _0x4b2538=_0x136406[_0xa2fc('0x99')](-0x1);if(_0x4b2538==='/'){_0x136406=_0x136406['substring'](0x0,_0x136406[_0xa2fc('0x9a')](_0x4b2538));}_0xf0121d=util['format'](_0xa2fc('0x9b'),_0x136406);_0x41c4f0=util['format']('%s/api/now/table/',_0x136406);_0x49bd61={'user':_0x33e8b9[_0xa2fc('0x96')],'pass':_0x33e8b9['password']};var _0x3c358e={'method':'GET','uri':_0xf0121d+_0xa2fc('0x9c'),'auth':_0x49bd61,'json':!![]};return rp(_0x3c358e);}})[_0xa2fc('0x24')](function(_0x2f8f9d){if(_0x2f8f9d[_0xa2fc('0x9d')][_0xa2fc('0x32')]>0x0){_0x1fc279=_0x2f8f9d[_0xa2fc('0x9d')];}console['log']('incident\x20table\x20objects',_0x1fc279);_0x1fc969=[];_0x391400=Object['assign']([],_0x1fc279);_[_0xa2fc('0x9e')](_0x391400,function(_0x1195fb){return!_0xacb54b[_0xa2fc('0x9f')](_0x1195fb[_0xa2fc('0x26')]);});_0x391400['forEach'](function(_0x1b7129){var _0x56c3d6=createFieldObject(_0x41c4f0,_0x49bd61,_0x1b7129[_0xa2fc('0xa0')],_0x1b7129[_0xa2fc('0x26')],_0x1b7129[_0xa2fc('0xa1')],![]);_0x1fc969[_0xa2fc('0xa2')](_0x56c3d6);});return Promise[_0xa2fc('0xa3')](_0x1fc969);})['then'](function(_0x8a407a){_0x53222f=_0x8a407a;_0x4f3c1f=Object[_0xa2fc('0xa4')]([],_0x1fc279);console[_0xa2fc('0xa5')]('TCL:\x20_object',_0x1fc279);_['remove'](_0x4f3c1f,function(_0x16b040){return _0x364d2d[_0xa2fc('0x9f')](_0x16b040['name']);});console[_0xa2fc('0xa5')](_0xa2fc('0xa6'),_0x4f3c1f);_0x1fc969=[];_0x4f3c1f['forEach'](function(_0x484fad){var _0x3f999a=createFieldObject(_0x41c4f0,_0x49bd61,_0x484fad[_0xa2fc('0xa0')],_0x484fad[_0xa2fc('0x26')],_0x484fad['label'],!![]);_0x1fc969[_0xa2fc('0xa2')](_0x3f999a);});return Promise[_0xa2fc('0xa3')](_0x1fc969);})[_0xa2fc('0x24')](function(_0x1e65af){_0x34d808=_0x1e65af;var _0x3a5d1a=_0x53222f[_0xa2fc('0xa7')](_0x34d808);return{'count':_0x3a5d1a['length'],'rows':_0x3a5d1a};})[_0xa2fc('0x24')](respondWithResult(_0x9d1979,null))[_0xa2fc('0x3d')](function(_0x611049){console['log'](_0xa2fc('0xa8')+_0x611049);var _0x138f3e=_0x4b5b63[_0xa2fc('0x2d')][_0xa2fc('0xa9')]?0x1f4:_0x611049[_0xa2fc('0xaa')]||0x1f4;logger[_0xa2fc('0x25')](_0x611049['stack']);delete _0x611049[_0xa2fc('0x26')];if(_0x138f3e===0x191){_0x138f3e=0x190;}_0x9d1979[_0xa2fc('0x16')](_0x138f3e)['send'](_0x4b5b63[_0xa2fc('0x2d')]['test']?{'message':_0xa2fc('0xab'),'statusCode':_0x611049[_0xa2fc('0xaa')]}:_0x611049);});};function createFieldObject(_0x12d744,_0xdebcb1,_0x287980,_0x1df161,_0x12ed70,_0xb38b1f){return new Promise(function(_0xeade6,_0x263310){var _0x4ccbc6={'id':_0x1df161,'name':_0x12ed70,'custom':_0xb38b1f};if(_0x287980===_0xa2fc('0xac')){_0x4ccbc6[_0xa2fc('0x39')]=[{'name':'True','value':_0xa2fc('0xad')},{'name':_0xa2fc('0xae'),'value':_0xa2fc('0xaf')}];_0xeade6(_0x4ccbc6);}else{var _0x9f0796={'method':_0xa2fc('0xb0'),'uri':_0x12d744+'sys_choice?sysparm_query=name=incident^element='+_0x1df161,'auth':_0xdebcb1,'json':!![]};return rp(_0x9f0796)[_0xa2fc('0x24')](function(_0x4ff005){var _0x56f111=[];if(_0x4ff005[_0xa2fc('0x9d')][_0xa2fc('0x32')]>0x0){_0x4ff005[_0xa2fc('0x9d')][_0xa2fc('0xb1')](function(_0x2f7bb3){if(_0x2f7bb3[_0xa2fc('0xb2')]===_0xa2fc('0xaf')){var _0x57baaf={'name':_0x2f7bb3[_0xa2fc('0xa1')],'value':_0x2f7bb3[_0xa2fc('0xb3')]};_0x56f111[_0xa2fc('0xa2')](_0x57baaf);}});}_0x4ccbc6[_0xa2fc('0x39')]=_0x56f111;if(_0x4ccbc6[_0xa2fc('0x39')][_0xa2fc('0x32')]>0x0){_0xeade6(_0x4ccbc6);}else{if(_0xb38b1f==![]){_0xeade6();}else{_0xeade6(_0x4ccbc6);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 3bbdf17..12c8ad6 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 _0x1623=['path','./intServicenowAccount.attributes','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','api','moment','bluebird','request-promise'];(function(_0x253499,_0x9208cb){var _0x5d585e=function(_0x4931c8){while(--_0x4931c8){_0x253499['push'](_0x253499['shift']());}};_0x5d585e(++_0x9208cb);}(_0x1623,0xab));var _0x3162=function(_0x2eafb9,_0x435192){_0x2eafb9=_0x2eafb9-0x0;var _0x508123=_0x1623[_0x2eafb9];return _0x508123;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3162('0x1'));var moment=require(_0x3162('0x2'));var BPromise=require(_0x3162('0x3'));var rp=require(_0x3162('0x4'));var fs=require('fs');var path=require(_0x3162('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3162('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x3162('0x7')]=function(_0x428de6,_0x53260d){return _0x428de6[_0x3162('0x8')](_0x3162('0x9'),attributes,{'tableName':_0x3162('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeff8=['rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define','int_servicenow_accounts','lodash','util','api','moment','bluebird','path'];(function(_0x3a9d2b,_0x4a754d){var _0x50dff9=function(_0x300429){while(--_0x300429){_0x3a9d2b['push'](_0x3a9d2b['shift']());}};_0x50dff9(++_0x4a754d);}(_0xeff8,0x186));var _0x8eff=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0xeff8[_0x1fc122];return _0xa2cb13;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var logger=require('../../config/logger')(_0x8eff('0x2'));var moment=require(_0x8eff('0x3'));var BPromise=require(_0x8eff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8eff('0x5'));var rimraf=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var attributes=require(_0x8eff('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x8eff('0x9')]=function(_0xb54063,_0x3409bc){return _0xb54063[_0x8eff('0xa')]('ServicenowAccount',attributes,{'tableName':_0x8eff('0xb'),'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 6dbe6c0..1dba5d6 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 _0x5620=['catch','GetServicenowAccount','ServicenowAccount','options','raw','attributes','include','model','map','stringify','ShowServicenowAccount','find','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x4b4288,_0x21a90b){var _0x3912d5=function(_0x38ec9d){while(--_0x38ec9d){_0x4b4288['push'](_0x4b4288['shift']());}};_0x3912d5(++_0x21a90b);}(_0x5620,0xc6));var _0x0562=function(_0x48961c,_0x280e9d){_0x48961c=_0x48961c-0x0;var _0x1d895d=_0x5620[_0x48961c];return _0x1d895d;};'use strict';var _=require('lodash');var util=require(_0x0562('0x0'));var moment=require(_0x0562('0x1'));var BPromise=require(_0x0562('0x2'));var rs=require(_0x0562('0x3'));var fs=require('fs');var Redis=require(_0x0562('0x4'));var db=require(_0x0562('0x5'))['db'];var utils=require(_0x0562('0x6'));var logger=require(_0x0562('0x7'))(_0x0562('0x8'));var config=require(_0x0562('0x9'));var jayson=require(_0x0562('0xa'));var client=jayson[_0x0562('0xb')][_0x0562('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x457ac0,_0x6d65ce,_0x4182cb){return new BPromise(function(_0xa44663,_0x1e0e80){return client[_0x0562('0xd')](_0x457ac0,_0x4182cb)[_0x0562('0xe')](function(_0x27a02b){logger[_0x0562('0xf')](_0x0562('0x10'),_0x6d65ce,_0x0562('0x11'));logger[_0x0562('0x12')](_0x0562('0x13'),_0x6d65ce,_0x0562('0x11'),JSON['stringify'](_0x27a02b));if(_0x27a02b[_0x0562('0x14')]){if(_0x27a02b[_0x0562('0x14')][_0x0562('0x15')]===0x1f4){logger[_0x0562('0x14')](_0x0562('0x10'),_0x6d65ce,_0x27a02b[_0x0562('0x14')][_0x0562('0x16')]);return _0x1e0e80(_0x27a02b[_0x0562('0x14')][_0x0562('0x16')]);}logger[_0x0562('0x14')](_0x0562('0x10'),_0x6d65ce,_0x27a02b[_0x0562('0x14')]['message']);return _0xa44663(_0x27a02b[_0x0562('0x14')][_0x0562('0x16')]);}else{logger[_0x0562('0xf')](_0x0562('0x10'),_0x6d65ce,_0x0562('0x11'));_0xa44663(_0x27a02b[_0x0562('0x17')]['message']);}})[_0x0562('0x18')](function(_0x190ec0){logger[_0x0562('0x14')](_0x0562('0x10'),_0x6d65ce,_0x190ec0);_0x1e0e80(_0x190ec0);});});}exports[_0x0562('0x19')]=function(_0x3ae278){var _0x3bf3ca=this;return new Promise(function(_0x19694d,_0x56d6c9){return db[_0x0562('0x1a')]['findAll']({'raw':_0x3ae278[_0x0562('0x1b')]?_0x3ae278[_0x0562('0x1b')][_0x0562('0x1c')]===undefined?!![]:![]:!![],'where':_0x3ae278[_0x0562('0x1b')]?_0x3ae278[_0x0562('0x1b')]['where']||null:null,'attributes':_0x3ae278[_0x0562('0x1b')]?_0x3ae278[_0x0562('0x1b')][_0x0562('0x1d')]||null:null,'limit':_0x3ae278[_0x0562('0x1b')]?_0x3ae278['options']['limit']||null:null,'include':_0x3ae278[_0x0562('0x1b')]?_0x3ae278[_0x0562('0x1b')][_0x0562('0x1e')]?_['map'](_0x3ae278['options'][_0x0562('0x1e')],function(_0x392451){return{'model':db[_0x392451[_0x0562('0x1f')]],'as':_0x392451['as'],'attributes':_0x392451['attributes'],'include':_0x392451[_0x0562('0x1e')]?_[_0x0562('0x20')](_0x392451[_0x0562('0x1e')],function(_0x40f74a){return{'model':db[_0x40f74a['model']],'as':_0x40f74a['as'],'attributes':_0x40f74a[_0x0562('0x1d')],'include':_0x40f74a['include']?_['map'](_0x40f74a[_0x0562('0x1e')],function(_0x364d98){return{'model':db[_0x364d98[_0x0562('0x1f')]],'as':_0x364d98['as'],'attributes':_0x364d98[_0x0562('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x231c87){logger['info']('GetServicenowAccount',_0x3ae278);logger['debug'](_0x0562('0x19'),_0x3ae278,JSON[_0x0562('0x21')](_0x231c87));_0x19694d(_0x231c87);})['catch'](function(_0x3b604a){logger['error'](_0x0562('0x19'),_0x3b604a[_0x0562('0x16')],_0x3ae278);_0x56d6c9(_0x3bf3ca[_0x0562('0x14')](0x1f4,_0x3b604a[_0x0562('0x16')]));});});};exports[_0x0562('0x22')]=function(_0x2accd2){var _0x3a0639=this;return new Promise(function(_0x1a74d4,_0x34ccc4){return db['ServicenowAccount'][_0x0562('0x23')]({'raw':_0x2accd2['options']?_0x2accd2['options'][_0x0562('0x1c')]===undefined?!![]:![]:!![],'where':_0x2accd2[_0x0562('0x1b')]?_0x2accd2['options'][_0x0562('0x24')]||null:null,'attributes':_0x2accd2[_0x0562('0x1b')]?_0x2accd2['options'][_0x0562('0x1d')]||null:null,'include':_0x2accd2[_0x0562('0x1b')]?_0x2accd2[_0x0562('0x1b')][_0x0562('0x1e')]?_[_0x0562('0x20')](_0x2accd2['options'][_0x0562('0x1e')],function(_0x11afef){return{'model':db[_0x11afef[_0x0562('0x1f')]],'as':_0x11afef['as'],'attributes':_0x11afef[_0x0562('0x1d')],'include':_0x11afef[_0x0562('0x1e')]?_[_0x0562('0x20')](_0x11afef['include'],function(_0x2a5d7a){return{'model':db[_0x2a5d7a[_0x0562('0x1f')]],'as':_0x2a5d7a['as'],'attributes':_0x2a5d7a[_0x0562('0x1d')],'include':_0x2a5d7a[_0x0562('0x1e')]?_[_0x0562('0x20')](_0x2a5d7a[_0x0562('0x1e')],function(_0x199030){return{'model':db[_0x199030[_0x0562('0x1f')]],'as':_0x199030['as'],'attributes':_0x199030['attributes']};}):[]};}):[]};}):[]:[]})[_0x0562('0xe')](function(_0x5202f7){logger[_0x0562('0xf')](_0x0562('0x22'),_0x2accd2);logger[_0x0562('0x12')]('ShowServicenowAccount',_0x2accd2,JSON[_0x0562('0x21')](_0x5202f7));_0x1a74d4(_0x5202f7);})[_0x0562('0x18')](function(_0xb6fac4){logger['error']('ShowServicenowAccount',_0xb6fac4[_0x0562('0x16')],_0x2accd2);_0x34ccc4(_0x3a0639['error'](0x1f4,_0xb6fac4[_0x0562('0x16')]));});});}; \ No newline at end of file +var _0xd63f=['ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','limit','map','include','attributes','model','ShowServicenowAccount','then','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xd63f,0x1e3));var _0xfd63=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd63f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xfd63('0x0'));var util=require(_0xfd63('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfd63('0x2'));var fs=require('fs');var Redis=require(_0xfd63('0x3'));var db=require(_0xfd63('0x4'))['db'];var utils=require(_0xfd63('0x5'));var logger=require(_0xfd63('0x6'))(_0xfd63('0x7'));var config=require(_0xfd63('0x8'));var jayson=require(_0xfd63('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x15cf6f,_0x45f437,_0x5ca50e){return new BPromise(function(_0x3b0799,_0x3a6692){return client[_0xfd63('0xa')](_0x15cf6f,_0x5ca50e)['then'](function(_0x43dd7f){logger[_0xfd63('0xb')](_0xfd63('0xc'),_0x45f437,_0xfd63('0xd'));logger[_0xfd63('0xe')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x45f437,_0xfd63('0xd'),JSON[_0xfd63('0xf')](_0x43dd7f));if(_0x43dd7f[_0xfd63('0x10')]){if(_0x43dd7f[_0xfd63('0x10')][_0xfd63('0x11')]===0x1f4){logger[_0xfd63('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x45f437,_0x43dd7f[_0xfd63('0x10')][_0xfd63('0x12')]);return _0x3a6692(_0x43dd7f['error'][_0xfd63('0x12')]);}logger[_0xfd63('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x45f437,_0x43dd7f[_0xfd63('0x10')][_0xfd63('0x12')]);return _0x3b0799(_0x43dd7f[_0xfd63('0x10')]['message']);}else{logger[_0xfd63('0xb')](_0xfd63('0xc'),_0x45f437,_0xfd63('0xd'));_0x3b0799(_0x43dd7f['result'][_0xfd63('0x12')]);}})[_0xfd63('0x13')](function(_0x5043e8){logger[_0xfd63('0x10')](_0xfd63('0xc'),_0x45f437,_0x5043e8);_0x3a6692(_0x5043e8);});});}exports[_0xfd63('0x14')]=function(_0x48d788){var _0x235548=this;return new Promise(function(_0x239307,_0x5f1d5b){return db[_0xfd63('0x15')][_0xfd63('0x16')]({'raw':_0x48d788[_0xfd63('0x17')]?_0x48d788[_0xfd63('0x17')][_0xfd63('0x18')]===undefined?!![]:![]:!![],'where':_0x48d788['options']?_0x48d788['options'][_0xfd63('0x19')]||null:null,'attributes':_0x48d788[_0xfd63('0x17')]?_0x48d788[_0xfd63('0x17')]['attributes']||null:null,'limit':_0x48d788[_0xfd63('0x17')]?_0x48d788[_0xfd63('0x17')][_0xfd63('0x1a')]||null:null,'include':_0x48d788[_0xfd63('0x17')]?_0x48d788[_0xfd63('0x17')]['include']?_[_0xfd63('0x1b')](_0x48d788[_0xfd63('0x17')][_0xfd63('0x1c')],function(_0x312ce9){return{'model':db[_0x312ce9['model']],'as':_0x312ce9['as'],'attributes':_0x312ce9[_0xfd63('0x1d')],'include':_0x312ce9['include']?_[_0xfd63('0x1b')](_0x312ce9[_0xfd63('0x1c')],function(_0x400b89){return{'model':db[_0x400b89[_0xfd63('0x1e')]],'as':_0x400b89['as'],'attributes':_0x400b89[_0xfd63('0x1d')],'include':_0x400b89[_0xfd63('0x1c')]?_[_0xfd63('0x1b')](_0x400b89[_0xfd63('0x1c')],function(_0x6119b6){return{'model':db[_0x6119b6[_0xfd63('0x1e')]],'as':_0x6119b6['as'],'attributes':_0x6119b6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e4658){logger[_0xfd63('0xb')]('GetServicenowAccount',_0x48d788);logger[_0xfd63('0xe')](_0xfd63('0x14'),_0x48d788,JSON[_0xfd63('0xf')](_0x3e4658));_0x239307(_0x3e4658);})[_0xfd63('0x13')](function(_0xdef6c9){logger['error']('GetServicenowAccount',_0xdef6c9[_0xfd63('0x12')],_0x48d788);_0x5f1d5b(_0x235548[_0xfd63('0x10')](0x1f4,_0xdef6c9[_0xfd63('0x12')]));});});};exports[_0xfd63('0x1f')]=function(_0xb7f778){var _0x171dd4=this;return new Promise(function(_0x93d492,_0x5db1ea){return db[_0xfd63('0x15')]['find']({'raw':_0xb7f778['options']?_0xb7f778[_0xfd63('0x17')][_0xfd63('0x18')]===undefined?!![]:![]:!![],'where':_0xb7f778['options']?_0xb7f778[_0xfd63('0x17')]['where']||null:null,'attributes':_0xb7f778[_0xfd63('0x17')]?_0xb7f778[_0xfd63('0x17')][_0xfd63('0x1d')]||null:null,'include':_0xb7f778['options']?_0xb7f778[_0xfd63('0x17')][_0xfd63('0x1c')]?_['map'](_0xb7f778['options'][_0xfd63('0x1c')],function(_0x31acc1){return{'model':db[_0x31acc1['model']],'as':_0x31acc1['as'],'attributes':_0x31acc1[_0xfd63('0x1d')],'include':_0x31acc1[_0xfd63('0x1c')]?_[_0xfd63('0x1b')](_0x31acc1[_0xfd63('0x1c')],function(_0x458231){return{'model':db[_0x458231[_0xfd63('0x1e')]],'as':_0x458231['as'],'attributes':_0x458231['attributes'],'include':_0x458231[_0xfd63('0x1c')]?_[_0xfd63('0x1b')](_0x458231[_0xfd63('0x1c')],function(_0x40c389){return{'model':db[_0x40c389[_0xfd63('0x1e')]],'as':_0x40c389['as'],'attributes':_0x40c389[_0xfd63('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfd63('0x20')](function(_0x531fb1){logger[_0xfd63('0xb')](_0xfd63('0x1f'),_0xb7f778);logger['debug'](_0xfd63('0x1f'),_0xb7f778,JSON[_0xfd63('0xf')](_0x531fb1));_0x93d492(_0x531fb1);})[_0xfd63('0x13')](function(_0x154bcd){logger['error'](_0xfd63('0x1f'),_0x154bcd['message'],_0xb7f778);_0x5db1ea(_0x171dd4[_0xfd63('0x10')](0x1f4,_0x154bcd['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index b650575..6f67d7e 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 _0xccb2=['get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x22be44,_0xff22cc){var _0x6634e4=function(_0x1d9ee5){while(--_0x1d9ee5){_0x22be44['push'](_0x22be44['shift']());}};_0x6634e4(++_0xff22cc);}(_0xccb2,0x1f0));var _0x2ccb=function(_0x3b35e4,_0x54216e){_0x3b35e4=_0x3b35e4-0x0;var _0x18f1bf=_0xccb2[_0x3b35e4];return _0x18f1bf;};'use strict';var multer=require(_0x2ccb('0x0'));var util=require(_0x2ccb('0x1'));var path=require(_0x2ccb('0x2'));var timeout=require(_0x2ccb('0x3'));var express=require(_0x2ccb('0x4'));var router=express['Router']();var fs_extra=require(_0x2ccb('0x5'));var auth=require(_0x2ccb('0x6'));var interaction=require(_0x2ccb('0x7'));var config=require('../../config/environment');var controller=require('./intServicenowConfiguration.controller');router[_0x2ccb('0x8')]('/',auth[_0x2ccb('0x9')](),controller[_0x2ccb('0xa')]);router[_0x2ccb('0x8')](_0x2ccb('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x2ccb('0x8')](_0x2ccb('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x2ccb('0x8')](_0x2ccb('0xd'),auth['isAuthenticated'](),controller[_0x2ccb('0xe')]);router[_0x2ccb('0x8')]('/:id/descriptions',auth[_0x2ccb('0x9')](),controller['getDescriptions']);router[_0x2ccb('0xf')]('/',auth['isAuthenticated'](),controller[_0x2ccb('0x10')]);router[_0x2ccb('0x11')](_0x2ccb('0xb'),auth['isAuthenticated'](),controller[_0x2ccb('0x12')]);router[_0x2ccb('0x13')](_0x2ccb('0xb'),auth[_0x2ccb('0x9')](),controller[_0x2ccb('0x14')]);module['exports']=router; \ No newline at end of file +var _0xc6a5=['isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get'];(function(_0x3569e7,_0x2efc4c){var _0x3bdcf8=function(_0x544c54){while(--_0x544c54){_0x3569e7['push'](_0x3569e7['shift']());}};_0x3bdcf8(++_0x2efc4c);}(_0xc6a5,0x12c));var _0x5c6a=function(_0x3f53eb,_0x2a86d2){_0x3f53eb=_0x3f53eb-0x0;var _0x40486a=_0xc6a5[_0x3f53eb];return _0x40486a;};'use strict';var multer=require(_0x5c6a('0x0'));var util=require(_0x5c6a('0x1'));var path=require(_0x5c6a('0x2'));var timeout=require(_0x5c6a('0x3'));var express=require(_0x5c6a('0x4'));var router=express[_0x5c6a('0x5')]();var fs_extra=require(_0x5c6a('0x6'));var auth=require(_0x5c6a('0x7'));var interaction=require(_0x5c6a('0x8'));var config=require(_0x5c6a('0x9'));var controller=require(_0x5c6a('0xa'));router[_0x5c6a('0xb')]('/',auth[_0x5c6a('0xc')](),controller[_0x5c6a('0xd')]);router[_0x5c6a('0xb')](_0x5c6a('0xe'),auth['isAuthenticated'](),controller[_0x5c6a('0xf')]);router['get'](_0x5c6a('0x10'),auth[_0x5c6a('0xc')](),controller[_0x5c6a('0x11')]);router['get'](_0x5c6a('0x12'),auth['isAuthenticated'](),controller[_0x5c6a('0x13')]);router[_0x5c6a('0xb')](_0x5c6a('0x14'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x5c6a('0x15')]('/',auth[_0x5c6a('0xc')](),controller[_0x5c6a('0x16')]);router['put'](_0x5c6a('0xe'),auth[_0x5c6a('0xc')](),controller[_0x5c6a('0x17')]);router[_0x5c6a('0x18')]('/:id',auth[_0x5c6a('0xc')](),controller['destroy']);module[_0x5c6a('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 f4a5a42..dcff6c6 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 _0xb03d=['exports','STRING','sequelize'];(function(_0x50f1c0,_0xa77c4e){var _0x25b47b=function(_0x17c18e){while(--_0x17c18e){_0x50f1c0['push'](_0x50f1c0['shift']());}};_0x25b47b(++_0xa77c4e);}(_0xb03d,0x1c7));var _0xdb03=function(_0x1b9eb7,_0x47c831){_0x1b9eb7=_0x1b9eb7-0x0;var _0x2ecb41=_0xb03d[_0x1b9eb7];return _0x2ecb41;};'use strict';var Sequelize=require(_0xdb03('0x0'));module[_0xdb03('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdb03('0x2')]}}; \ No newline at end of file +var _0x51f0=['exports','STRING','sequelize'];(function(_0x260fb9,_0x2bc9da){var _0x5326af=function(_0x3f00ae){while(--_0x3f00ae){_0x260fb9['push'](_0x260fb9['shift']());}};_0x5326af(++_0x2bc9da);}(_0x51f0,0x1d0));var _0x051f=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x51f0[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x051f('0x0'));module[_0x051f('0x1')]={'name':{'type':Sequelize[_0x051f('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 40ae321..f99984e 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 _0x44b9=['offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','ServicenowConfiguration','include','findAll','rows','params','includeAll','find','create','body','catch','getFields','findOne','keys','ServicenowField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x391de1,_0xbd41be){var _0x13d33d=function(_0x9835d7){while(--_0x9835d7){_0x391de1['push'](_0x391de1['shift']());}};_0x13d33d(++_0xbd41be);}(_0x44b9,0x86));var _0x944b=function(_0x129db2,_0x5f2363){_0x129db2=_0x129db2-0x0;var _0x3c4776=_0x44b9[_0x129db2];return _0x3c4776;};'use strict';var emlformat=require(_0x944b('0x0'));var rimraf=require(_0x944b('0x1'));var zipdir=require(_0x944b('0x2'));var jsonpatch=require(_0x944b('0x3'));var rp=require('request-promise');var moment=require(_0x944b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x944b('0x5'));var util=require(_0x944b('0x6'));var path=require(_0x944b('0x7'));var sox=require('sox');var csv=require(_0x944b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x944b('0x9'));var _=require(_0x944b('0xa'));var squel=require(_0x944b('0xb'));var crypto=require('crypto');var jsforce=require(_0x944b('0xc'));var deskjs=require(_0x944b('0xd'));var toCsv=require(_0x944b('0x8'));var querystring=require(_0x944b('0xe'));var Papa=require('papaparse');var Redis=require(_0x944b('0xf'));var authService=require(_0x944b('0x10'));var qs=require(_0x944b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x944b('0x12'));var logger=require('../../config/logger')(_0x944b('0x13'));var utils=require(_0x944b('0x14'));var config=require(_0x944b('0x15'));var licenseUtil=require(_0x944b('0x16'));var db=require(_0x944b('0x17'))['db'];function respondWithStatusCode(_0x171234,_0x19e8f1){_0x19e8f1=_0x19e8f1||0xcc;return function(_0x2a64b4){if(_0x2a64b4){return _0x171234[_0x944b('0x18')](_0x19e8f1);}return _0x171234['status'](_0x19e8f1)[_0x944b('0x19')]();};}function respondWithResult(_0x163a3e,_0x5d2dc2){_0x5d2dc2=_0x5d2dc2||0xc8;return function(_0x120047){if(_0x120047){return _0x163a3e[_0x944b('0x1a')](_0x5d2dc2)[_0x944b('0x1b')](_0x120047);}};}function respondWithFilteredResult(_0x788cb5,_0x973763){return function(_0x210754){if(_0x210754){var _0xc75906=typeof _0x973763[_0x944b('0x1c')]===_0x944b('0x1d')&&typeof _0x973763[_0x944b('0x1e')]===_0x944b('0x1d');var _0x517e9d=_0x210754[_0x944b('0x1f')];var _0x344d51=_0xc75906?0x0:_0x973763[_0x944b('0x1c')];var _0x376d4d=_0xc75906?_0x210754[_0x944b('0x1f')]:_0x973763[_0x944b('0x1c')]+_0x973763['limit'];var _0xaeb81e;if(_0x376d4d>=_0x517e9d){_0x376d4d=_0x517e9d;_0xaeb81e=0xc8;}else{_0xaeb81e=0xce;}_0x788cb5[_0x944b('0x1a')](_0xaeb81e);return _0x788cb5[_0x944b('0x20')]('Content-Range',_0x344d51+'-'+_0x376d4d+'/'+_0x517e9d)['json'](_0x210754);}return null;};}function patchUpdates(_0x10b3d7){return function(_0x35d37b){try{jsonpatch[_0x944b('0x21')](_0x35d37b,_0x10b3d7,!![]);}catch(_0x366948){return BPromise[_0x944b('0x22')](_0x366948);}return _0x35d37b[_0x944b('0x23')]();};}function saveUpdates(_0xcdd8b0,_0x191dae){return function(_0x555964){if(_0x555964){return _0x555964[_0x944b('0x24')](_0xcdd8b0)[_0x944b('0x25')](function(_0xb9c97a){return _0xb9c97a;});}return null;};}function removeEntity(_0x4f3e83,_0x5aef23){return function(_0x5cf7ea){if(_0x5cf7ea){return _0x5cf7ea[_0x944b('0x26')]()['then'](function(){_0x4f3e83['status'](0xcc)[_0x944b('0x19')]();});}};}function handleEntityNotFound(_0x5d3a52,_0x427f72){return function(_0x58cb93){if(!_0x58cb93){_0x5d3a52[_0x944b('0x18')](0x194);}return _0x58cb93;};}function handleError(_0x13fd3a,_0x41cf7d){_0x41cf7d=_0x41cf7d||0x1f4;return function(_0x331f36){logger[_0x944b('0x27')](_0x331f36['stack']);if(_0x331f36[_0x944b('0x28')]){delete _0x331f36[_0x944b('0x28')];}_0x13fd3a[_0x944b('0x1a')](_0x41cf7d)[_0x944b('0x29')](_0x331f36);};}exports[_0x944b('0x2a')]=function(_0x2a4148,_0x43c01a){var _0x420ead={},_0x202baa={},_0xa3d2c9={'count':0x0,'rows':[]};var _0xbd38b6=_['map'](db['ServicenowConfiguration'][_0x944b('0x2b')],function(_0x40b0cb){return{'name':_0x40b0cb[_0x944b('0x2c')],'type':_0x40b0cb[_0x944b('0x2d')][_0x944b('0x2e')]};});_0x202baa[_0x944b('0x2f')]=_[_0x944b('0x30')](_0xbd38b6,'name');_0x202baa[_0x944b('0x31')]=_['keys'](_0x2a4148[_0x944b('0x31')]);_0x202baa['filters']=_[_0x944b('0x32')](_0x202baa[_0x944b('0x2f')],_0x202baa['query']);_0x420ead['attributes']=_[_0x944b('0x32')](_0x202baa[_0x944b('0x2f')],qs[_0x944b('0x33')](_0x2a4148[_0x944b('0x31')][_0x944b('0x33')]));_0x420ead[_0x944b('0x34')]=_0x420ead[_0x944b('0x34')][_0x944b('0x35')]?_0x420ead[_0x944b('0x34')]:_0x202baa['model'];if(!_0x2a4148['query'][_0x944b('0x36')](_0x944b('0x37'))){_0x420ead[_0x944b('0x1e')]=qs[_0x944b('0x1e')](_0x2a4148[_0x944b('0x31')][_0x944b('0x1e')]);_0x420ead['offset']=qs[_0x944b('0x1c')](_0x2a4148[_0x944b('0x31')][_0x944b('0x1c')]);}_0x420ead[_0x944b('0x38')]=qs[_0x944b('0x39')](_0x2a4148[_0x944b('0x31')][_0x944b('0x39')]);_0x420ead[_0x944b('0x3a')]=qs[_0x944b('0x3b')](_[_0x944b('0x3c')](_0x2a4148[_0x944b('0x31')],_0x202baa['filters']),_0xbd38b6);if(_0x2a4148[_0x944b('0x31')][_0x944b('0x3d')]){_0x420ead[_0x944b('0x3a')]=_[_0x944b('0x3e')](_0x420ead[_0x944b('0x3a')],{'$or':_['map'](_0xbd38b6,function(_0xd4d3a4){if(_0xd4d3a4[_0x944b('0x2d')]!==_0x944b('0x3f')){var _0x2e1b3a={};_0x2e1b3a[_0xd4d3a4[_0x944b('0x28')]]={'$like':'%'+_0x2a4148['query'][_0x944b('0x3d')]+'%'};return _0x2e1b3a;}})});}_0x420ead=_[_0x944b('0x3e')]({},_0x420ead,_0x2a4148[_0x944b('0x40')]);var _0x2e49d6={'where':_0x420ead[_0x944b('0x3a')]};return db[_0x944b('0x41')][_0x944b('0x1f')](_0x2e49d6)[_0x944b('0x25')](function(_0x192beb){_0xa3d2c9[_0x944b('0x1f')]=_0x192beb;if(_0x2a4148['query']['includeAll']){_0x420ead[_0x944b('0x42')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x944b('0x43')](_0x420ead);})[_0x944b('0x25')](function(_0x5995a2){_0xa3d2c9[_0x944b('0x44')]=_0x5995a2;return _0xa3d2c9;})['then'](respondWithFilteredResult(_0x43c01a,_0x420ead))['catch'](handleError(_0x43c01a,null));};exports['show']=function(_0x5806c6,_0x184a77){var _0x239921={'raw':![],'where':{'id':_0x5806c6[_0x944b('0x45')]['id']}},_0x6859f1={};_0x6859f1[_0x944b('0x2f')]=_['keys'](db[_0x944b('0x41')]['rawAttributes']);_0x6859f1[_0x944b('0x31')]=_['keys'](_0x5806c6[_0x944b('0x31')]);_0x6859f1['filters']=_[_0x944b('0x32')](_0x6859f1[_0x944b('0x2f')],_0x6859f1[_0x944b('0x31')]);_0x239921[_0x944b('0x34')]=_[_0x944b('0x32')](_0x6859f1[_0x944b('0x2f')],qs[_0x944b('0x33')](_0x5806c6[_0x944b('0x31')][_0x944b('0x33')]));_0x239921['attributes']=_0x239921[_0x944b('0x34')]['length']?_0x239921[_0x944b('0x34')]:_0x6859f1[_0x944b('0x2f')];if(_0x5806c6[_0x944b('0x31')][_0x944b('0x46')]){_0x239921[_0x944b('0x42')]=[{'all':!![]}];}_0x239921=_[_0x944b('0x3e')]({},_0x239921,_0x5806c6[_0x944b('0x40')]);return db[_0x944b('0x41')][_0x944b('0x47')](_0x239921)[_0x944b('0x25')](handleEntityNotFound(_0x184a77,null))[_0x944b('0x25')](respondWithResult(_0x184a77,null))['catch'](handleError(_0x184a77,null));};exports[_0x944b('0x48')]=function(_0x294013,_0x575151){return db[_0x944b('0x41')][_0x944b('0x48')](_0x294013[_0x944b('0x49')],{})[_0x944b('0x25')](respondWithResult(_0x575151,0xc9))[_0x944b('0x4a')](handleError(_0x575151,null));};exports[_0x944b('0x24')]=function(_0x1c2ee3,_0x33ab66){if(_0x1c2ee3['body']['id']){delete _0x1c2ee3[_0x944b('0x49')]['id'];}return db[_0x944b('0x41')][_0x944b('0x47')]({'where':{'id':_0x1c2ee3[_0x944b('0x45')]['id']}})[_0x944b('0x25')](handleEntityNotFound(_0x33ab66,null))[_0x944b('0x25')](saveUpdates(_0x1c2ee3[_0x944b('0x49')],null))[_0x944b('0x25')](respondWithResult(_0x33ab66,null))[_0x944b('0x4a')](handleError(_0x33ab66,null));};exports[_0x944b('0x26')]=function(_0x14cfd5,_0x5a9849){return db[_0x944b('0x41')][_0x944b('0x47')]({'where':{'id':_0x14cfd5['params']['id']}})[_0x944b('0x25')](handleEntityNotFound(_0x5a9849,null))[_0x944b('0x25')](removeEntity(_0x5a9849,null))[_0x944b('0x4a')](handleError(_0x5a9849,null));};exports[_0x944b('0x4b')]=function(_0x5c842f,_0xa6d7b2,_0x52652e){var _0x9ef2d1={};var _0x29b409={};var _0x3e3a8c;var _0x108ba6;return db['ServicenowConfiguration'][_0x944b('0x4c')]({'where':{'id':_0x5c842f[_0x944b('0x45')]['id']}})[_0x944b('0x25')](handleEntityNotFound(_0xa6d7b2,null))[_0x944b('0x25')](function(_0x5acac1){if(_0x5acac1){_0x3e3a8c=_0x5acac1;_0x29b409[_0x944b('0x2f')]=_[_0x944b('0x4d')](db[_0x944b('0x4e')][_0x944b('0x2b')]);_0x29b409[_0x944b('0x31')]=_[_0x944b('0x4d')](_0x5c842f['query']);_0x29b409[_0x944b('0x3b')]=_[_0x944b('0x32')](_0x29b409[_0x944b('0x2f')],_0x29b409[_0x944b('0x31')]);_0x9ef2d1[_0x944b('0x34')]=_[_0x944b('0x32')](_0x29b409[_0x944b('0x2f')],qs[_0x944b('0x33')](_0x5c842f[_0x944b('0x31')]['fields']));_0x9ef2d1[_0x944b('0x34')]=_0x9ef2d1[_0x944b('0x34')][_0x944b('0x35')]?_0x9ef2d1[_0x944b('0x34')]:_0x29b409[_0x944b('0x2f')];_0x9ef2d1['order']=qs[_0x944b('0x39')](_0x5c842f[_0x944b('0x31')][_0x944b('0x39')]);_0x9ef2d1['where']=qs[_0x944b('0x3b')](_['pick'](_0x5c842f['query'],_0x29b409[_0x944b('0x3b')]));if(_0x5c842f[_0x944b('0x31')][_0x944b('0x3d')]){_0x9ef2d1[_0x944b('0x3a')]=_[_0x944b('0x3e')](_0x9ef2d1['where'],{'$or':_[_0x944b('0x30')](_0x9ef2d1[_0x944b('0x34')],function(_0x471642){var _0x13eac8={};_0x13eac8[_0x471642]={'$like':'%'+_0x5c842f[_0x944b('0x31')][_0x944b('0x3d')]+'%'};return _0x13eac8;})});}_0x9ef2d1=_['merge']({},_0x9ef2d1,_0x5c842f['options']);return _0x3e3a8c[_0x944b('0x4b')](_0x9ef2d1);}})[_0x944b('0x25')](function(_0x3f84d8){if(_0x3f84d8){_0x108ba6=_0x3f84d8[_0x944b('0x35')];if(!_0x5c842f[_0x944b('0x31')][_0x944b('0x36')]('nolimit')){_0x9ef2d1[_0x944b('0x1e')]=qs[_0x944b('0x1e')](_0x5c842f[_0x944b('0x31')]['limit']);_0x9ef2d1['offset']=qs[_0x944b('0x1c')](_0x5c842f[_0x944b('0x31')][_0x944b('0x1c')]);}return _0x3e3a8c[_0x944b('0x4b')](_0x9ef2d1);}})['then'](function(_0x1a99c6){if(_0x1a99c6){return _0x1a99c6?{'count':_0x108ba6,'rows':_0x1a99c6}:null;}})[_0x944b('0x25')](respondWithResult(_0xa6d7b2,null))['catch'](handleError(_0xa6d7b2,null));};exports[_0x944b('0x4f')]=function(_0x1f9e85,_0xa4208d,_0x51c6ff){var _0x3c624f={};var _0x569830={};var _0x3ca945;var _0x2d9412;return db['ServicenowConfiguration'][_0x944b('0x4c')]({'where':{'id':_0x1f9e85[_0x944b('0x45')]['id']}})[_0x944b('0x25')](handleEntityNotFound(_0xa4208d,null))['then'](function(_0x1687c0){if(_0x1687c0){_0x3ca945=_0x1687c0;_0x569830['model']=_[_0x944b('0x4d')](db['ServicenowField']['rawAttributes']);_0x569830['query']=_[_0x944b('0x4d')](_0x1f9e85[_0x944b('0x31')]);_0x569830[_0x944b('0x3b')]=_[_0x944b('0x32')](_0x569830[_0x944b('0x2f')],_0x569830[_0x944b('0x31')]);_0x3c624f[_0x944b('0x34')]=_[_0x944b('0x32')](_0x569830[_0x944b('0x2f')],qs[_0x944b('0x33')](_0x1f9e85[_0x944b('0x31')][_0x944b('0x33')]));_0x3c624f[_0x944b('0x34')]=_0x3c624f[_0x944b('0x34')][_0x944b('0x35')]?_0x3c624f[_0x944b('0x34')]:_0x569830['model'];_0x3c624f[_0x944b('0x38')]=qs[_0x944b('0x39')](_0x1f9e85[_0x944b('0x31')][_0x944b('0x39')]);_0x3c624f[_0x944b('0x3a')]=qs[_0x944b('0x3b')](_['pick'](_0x1f9e85[_0x944b('0x31')],_0x569830[_0x944b('0x3b')]));if(_0x1f9e85['query'][_0x944b('0x3d')]){_0x3c624f['where']=_[_0x944b('0x3e')](_0x3c624f[_0x944b('0x3a')],{'$or':_['map'](_0x3c624f[_0x944b('0x34')],function(_0x129101){var _0x341e9b={};_0x341e9b[_0x129101]={'$like':'%'+_0x1f9e85[_0x944b('0x31')][_0x944b('0x3d')]+'%'};return _0x341e9b;})});}_0x3c624f=_[_0x944b('0x3e')]({},_0x3c624f,_0x1f9e85['options']);return _0x3ca945[_0x944b('0x4f')](_0x3c624f);}})[_0x944b('0x25')](function(_0x5f5125){if(_0x5f5125){_0x2d9412=_0x5f5125['length'];if(!_0x1f9e85[_0x944b('0x31')][_0x944b('0x36')](_0x944b('0x37'))){_0x3c624f['limit']=qs[_0x944b('0x1e')](_0x1f9e85[_0x944b('0x31')][_0x944b('0x1e')]);_0x3c624f[_0x944b('0x1c')]=qs[_0x944b('0x1c')](_0x1f9e85[_0x944b('0x31')][_0x944b('0x1c')]);}return _0x3ca945['getSubjects'](_0x3c624f);}})[_0x944b('0x25')](function(_0x5f4876){if(_0x5f4876){return _0x5f4876?{'count':_0x2d9412,'rows':_0x5f4876}:null;}})[_0x944b('0x25')](respondWithResult(_0xa4208d,null))[_0x944b('0x4a')](handleError(_0xa4208d,null));};exports[_0x944b('0x50')]=function(_0x173852,_0x22d055,_0x2ec8e3){var _0x29c307={};var _0x4493a2={};var _0x5a1cc4;var _0xaa3a9;return db[_0x944b('0x41')][_0x944b('0x4c')]({'where':{'id':_0x173852[_0x944b('0x45')]['id']}})[_0x944b('0x25')](handleEntityNotFound(_0x22d055,null))['then'](function(_0x4a2e3e){if(_0x4a2e3e){_0x5a1cc4=_0x4a2e3e;_0x4493a2['model']=_['keys'](db['ServicenowField'][_0x944b('0x2b')]);_0x4493a2['query']=_[_0x944b('0x4d')](_0x173852[_0x944b('0x31')]);_0x4493a2[_0x944b('0x3b')]=_[_0x944b('0x32')](_0x4493a2[_0x944b('0x2f')],_0x4493a2['query']);_0x29c307[_0x944b('0x34')]=_['intersection'](_0x4493a2[_0x944b('0x2f')],qs[_0x944b('0x33')](_0x173852[_0x944b('0x31')]['fields']));_0x29c307[_0x944b('0x34')]=_0x29c307['attributes'][_0x944b('0x35')]?_0x29c307['attributes']:_0x4493a2[_0x944b('0x2f')];_0x29c307[_0x944b('0x38')]=qs[_0x944b('0x39')](_0x173852[_0x944b('0x31')][_0x944b('0x39')]);_0x29c307[_0x944b('0x3a')]=qs[_0x944b('0x3b')](_[_0x944b('0x3c')](_0x173852['query'],_0x4493a2['filters']));if(_0x173852['query'][_0x944b('0x3d')]){_0x29c307['where']=_[_0x944b('0x3e')](_0x29c307[_0x944b('0x3a')],{'$or':_[_0x944b('0x30')](_0x29c307[_0x944b('0x34')],function(_0x16b5cc){var _0x4e8722={};_0x4e8722[_0x16b5cc]={'$like':'%'+_0x173852['query'][_0x944b('0x3d')]+'%'};return _0x4e8722;})});}_0x29c307=_['merge']({},_0x29c307,_0x173852['options']);return _0x5a1cc4[_0x944b('0x50')](_0x29c307);}})[_0x944b('0x25')](function(_0x402365){if(_0x402365){_0xaa3a9=_0x402365['length'];if(!_0x173852[_0x944b('0x31')][_0x944b('0x36')]('nolimit')){_0x29c307[_0x944b('0x1e')]=qs[_0x944b('0x1e')](_0x173852[_0x944b('0x31')][_0x944b('0x1e')]);_0x29c307['offset']=qs[_0x944b('0x1c')](_0x173852[_0x944b('0x31')][_0x944b('0x1c')]);}return _0x5a1cc4['getDescriptions'](_0x29c307);}})['then'](function(_0x201921){if(_0x201921){return _0x201921?{'count':_0xaa3a9,'rows':_0x201921}:null;}})[_0x944b('0x25')](respondWithResult(_0x22d055,null))[_0x944b('0x4a')](handleError(_0x22d055,null));}; \ No newline at end of file +var _0xf4b4=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','ServicenowConfiguration','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','catch','show','params','find','create','body','update','getFields','findOne','ServicenowField','order','options','getSubjects','getDescriptions','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x2cc744,_0x2da12c){var _0x5a1f8e=function(_0x5b0315){while(--_0x5b0315){_0x2cc744['push'](_0x2cc744['shift']());}};_0x5a1f8e(++_0x2da12c);}(_0xf4b4,0x11f));var _0x4f4b=function(_0x3b06f1,_0x2c2f9a){_0x3b06f1=_0x3b06f1-0x0;var _0x1ab7fd=_0xf4b4[_0x3b06f1];return _0x1ab7fd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4f4b('0x0'));var rp=require(_0x4f4b('0x1'));var moment=require(_0x4f4b('0x2'));var BPromise=require(_0x4f4b('0x3'));var Mustache=require('mustache');var util=require(_0x4f4b('0x4'));var path=require(_0x4f4b('0x5'));var sox=require(_0x4f4b('0x6'));var csv=require(_0x4f4b('0x7'));var ejs=require(_0x4f4b('0x8'));var fs=require('fs');var fs_extra=require(_0x4f4b('0x9'));var _=require(_0x4f4b('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f4b('0xb'));var deskjs=require(_0x4f4b('0xc'));var toCsv=require(_0x4f4b('0x7'));var querystring=require('querystring');var Papa=require(_0x4f4b('0xd'));var Redis=require(_0x4f4b('0xe'));var authService=require(_0x4f4b('0xf'));var qs=require(_0x4f4b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f4b('0x11'));var logger=require(_0x4f4b('0x12'))(_0x4f4b('0x13'));var utils=require('../../config/utils');var config=require(_0x4f4b('0x14'));var licenseUtil=require(_0x4f4b('0x15'));var db=require(_0x4f4b('0x16'))['db'];function respondWithStatusCode(_0x11139f,_0x18c63a){_0x18c63a=_0x18c63a||0xcc;return function(_0x35c304){if(_0x35c304){return _0x11139f[_0x4f4b('0x17')](_0x18c63a);}return _0x11139f[_0x4f4b('0x18')](_0x18c63a)[_0x4f4b('0x19')]();};}function respondWithResult(_0x54f296,_0x400d38){_0x400d38=_0x400d38||0xc8;return function(_0x55e8f6){if(_0x55e8f6){return _0x54f296[_0x4f4b('0x18')](_0x400d38)[_0x4f4b('0x1a')](_0x55e8f6);}};}function respondWithFilteredResult(_0x2d5f9c,_0x29e2ce){return function(_0x51d4dd){if(_0x51d4dd){var _0x58e327=typeof _0x29e2ce[_0x4f4b('0x1b')]==='undefined'&&typeof _0x29e2ce[_0x4f4b('0x1c')]==='undefined';var _0x2b08fe=_0x51d4dd[_0x4f4b('0x1d')];var _0x4f8ebb=_0x58e327?0x0:_0x29e2ce[_0x4f4b('0x1b')];var _0xfa64b6=_0x58e327?_0x51d4dd['count']:_0x29e2ce[_0x4f4b('0x1b')]+_0x29e2ce[_0x4f4b('0x1c')];var _0x25caf6;if(_0xfa64b6>=_0x2b08fe){_0xfa64b6=_0x2b08fe;_0x25caf6=0xc8;}else{_0x25caf6=0xce;}_0x2d5f9c[_0x4f4b('0x18')](_0x25caf6);return _0x2d5f9c[_0x4f4b('0x1e')](_0x4f4b('0x1f'),_0x4f8ebb+'-'+_0xfa64b6+'/'+_0x2b08fe)[_0x4f4b('0x1a')](_0x51d4dd);}return null;};}function patchUpdates(_0x3dfa3a){return function(_0x40a842){try{jsonpatch[_0x4f4b('0x20')](_0x40a842,_0x3dfa3a,!![]);}catch(_0x4c7568){return BPromise[_0x4f4b('0x21')](_0x4c7568);}return _0x40a842[_0x4f4b('0x22')]();};}function saveUpdates(_0x43c8f3,_0x590f95){return function(_0x5280a8){if(_0x5280a8){return _0x5280a8['update'](_0x43c8f3)[_0x4f4b('0x23')](function(_0x1f4d07){return _0x1f4d07;});}return null;};}function removeEntity(_0x19cd3c,_0x4b2a6d){return function(_0x3972ef){if(_0x3972ef){return _0x3972ef[_0x4f4b('0x24')]()[_0x4f4b('0x23')](function(){_0x19cd3c['status'](0xcc)[_0x4f4b('0x19')]();});}};}function handleEntityNotFound(_0x74ad5e,_0x4644d0){return function(_0x4b2f22){if(!_0x4b2f22){_0x74ad5e[_0x4f4b('0x17')](0x194);}return _0x4b2f22;};}function handleError(_0x2d3de2,_0x3b309e){_0x3b309e=_0x3b309e||0x1f4;return function(_0x3eb6b4){logger[_0x4f4b('0x25')](_0x3eb6b4[_0x4f4b('0x26')]);if(_0x3eb6b4['name']){delete _0x3eb6b4[_0x4f4b('0x27')];}_0x2d3de2[_0x4f4b('0x18')](_0x3b309e)[_0x4f4b('0x28')](_0x3eb6b4);};}exports['index']=function(_0x43b452,_0x28c00e){var _0xdbadde={},_0x18181b={},_0x22031e={'count':0x0,'rows':[]};var _0x2ac948=_[_0x4f4b('0x29')](db[_0x4f4b('0x2a')][_0x4f4b('0x2b')],function(_0x243669){return{'name':_0x243669['fieldName'],'type':_0x243669[_0x4f4b('0x2c')]['key']};});_0x18181b[_0x4f4b('0x2d')]=_['map'](_0x2ac948,_0x4f4b('0x27'));_0x18181b[_0x4f4b('0x2e')]=_[_0x4f4b('0x2f')](_0x43b452[_0x4f4b('0x2e')]);_0x18181b[_0x4f4b('0x30')]=_[_0x4f4b('0x31')](_0x18181b[_0x4f4b('0x2d')],_0x18181b[_0x4f4b('0x2e')]);_0xdbadde[_0x4f4b('0x32')]=_[_0x4f4b('0x31')](_0x18181b['model'],qs[_0x4f4b('0x33')](_0x43b452[_0x4f4b('0x2e')][_0x4f4b('0x33')]));_0xdbadde[_0x4f4b('0x32')]=_0xdbadde[_0x4f4b('0x32')][_0x4f4b('0x34')]?_0xdbadde[_0x4f4b('0x32')]:_0x18181b['model'];if(!_0x43b452[_0x4f4b('0x2e')][_0x4f4b('0x35')](_0x4f4b('0x36'))){_0xdbadde[_0x4f4b('0x1c')]=qs[_0x4f4b('0x1c')](_0x43b452[_0x4f4b('0x2e')][_0x4f4b('0x1c')]);_0xdbadde[_0x4f4b('0x1b')]=qs[_0x4f4b('0x1b')](_0x43b452[_0x4f4b('0x2e')][_0x4f4b('0x1b')]);}_0xdbadde['order']=qs[_0x4f4b('0x37')](_0x43b452[_0x4f4b('0x2e')][_0x4f4b('0x37')]);_0xdbadde[_0x4f4b('0x38')]=qs['filters'](_[_0x4f4b('0x39')](_0x43b452[_0x4f4b('0x2e')],_0x18181b[_0x4f4b('0x30')]),_0x2ac948);if(_0x43b452['query'][_0x4f4b('0x3a')]){_0xdbadde[_0x4f4b('0x38')]=_['merge'](_0xdbadde[_0x4f4b('0x38')],{'$or':_[_0x4f4b('0x29')](_0x2ac948,function(_0x52b23e){if(_0x52b23e[_0x4f4b('0x2c')]!==_0x4f4b('0x3b')){var _0x55d42b={};_0x55d42b[_0x52b23e['name']]={'$like':'%'+_0x43b452[_0x4f4b('0x2e')][_0x4f4b('0x3a')]+'%'};return _0x55d42b;}})});}_0xdbadde=_[_0x4f4b('0x3c')]({},_0xdbadde,_0x43b452['options']);var _0x53af07={'where':_0xdbadde['where']};return db[_0x4f4b('0x2a')][_0x4f4b('0x1d')](_0x53af07)[_0x4f4b('0x23')](function(_0xdda957){_0x22031e[_0x4f4b('0x1d')]=_0xdda957;if(_0x43b452[_0x4f4b('0x2e')][_0x4f4b('0x3d')]){_0xdbadde[_0x4f4b('0x3e')]=[{'all':!![]}];}return db[_0x4f4b('0x2a')]['findAll'](_0xdbadde);})[_0x4f4b('0x23')](function(_0x15724c){_0x22031e['rows']=_0x15724c;return _0x22031e;})[_0x4f4b('0x23')](respondWithFilteredResult(_0x28c00e,_0xdbadde))[_0x4f4b('0x3f')](handleError(_0x28c00e,null));};exports[_0x4f4b('0x40')]=function(_0x5e45c9,_0x4a5b73){var _0xf82cc3={'raw':![],'where':{'id':_0x5e45c9[_0x4f4b('0x41')]['id']}},_0x5bb9c0={};_0x5bb9c0[_0x4f4b('0x2d')]=_[_0x4f4b('0x2f')](db[_0x4f4b('0x2a')][_0x4f4b('0x2b')]);_0x5bb9c0['query']=_['keys'](_0x5e45c9[_0x4f4b('0x2e')]);_0x5bb9c0[_0x4f4b('0x30')]=_['intersection'](_0x5bb9c0[_0x4f4b('0x2d')],_0x5bb9c0[_0x4f4b('0x2e')]);_0xf82cc3[_0x4f4b('0x32')]=_[_0x4f4b('0x31')](_0x5bb9c0['model'],qs[_0x4f4b('0x33')](_0x5e45c9[_0x4f4b('0x2e')][_0x4f4b('0x33')]));_0xf82cc3[_0x4f4b('0x32')]=_0xf82cc3['attributes']['length']?_0xf82cc3[_0x4f4b('0x32')]:_0x5bb9c0[_0x4f4b('0x2d')];if(_0x5e45c9[_0x4f4b('0x2e')][_0x4f4b('0x3d')]){_0xf82cc3['include']=[{'all':!![]}];}_0xf82cc3=_[_0x4f4b('0x3c')]({},_0xf82cc3,_0x5e45c9['options']);return db['ServicenowConfiguration'][_0x4f4b('0x42')](_0xf82cc3)[_0x4f4b('0x23')](handleEntityNotFound(_0x4a5b73,null))[_0x4f4b('0x23')](respondWithResult(_0x4a5b73,null))[_0x4f4b('0x3f')](handleError(_0x4a5b73,null));};exports[_0x4f4b('0x43')]=function(_0x49e30c,_0x3e00a0){return db[_0x4f4b('0x2a')][_0x4f4b('0x43')](_0x49e30c[_0x4f4b('0x44')],{})[_0x4f4b('0x23')](respondWithResult(_0x3e00a0,0xc9))[_0x4f4b('0x3f')](handleError(_0x3e00a0,null));};exports[_0x4f4b('0x45')]=function(_0x5f26bc,_0x1ff115){if(_0x5f26bc[_0x4f4b('0x44')]['id']){delete _0x5f26bc['body']['id'];}return db[_0x4f4b('0x2a')][_0x4f4b('0x42')]({'where':{'id':_0x5f26bc[_0x4f4b('0x41')]['id']}})[_0x4f4b('0x23')](handleEntityNotFound(_0x1ff115,null))[_0x4f4b('0x23')](saveUpdates(_0x5f26bc[_0x4f4b('0x44')],null))[_0x4f4b('0x23')](respondWithResult(_0x1ff115,null))['catch'](handleError(_0x1ff115,null));};exports[_0x4f4b('0x24')]=function(_0xebb011,_0x3818ba){return db[_0x4f4b('0x2a')][_0x4f4b('0x42')]({'where':{'id':_0xebb011[_0x4f4b('0x41')]['id']}})[_0x4f4b('0x23')](handleEntityNotFound(_0x3818ba,null))[_0x4f4b('0x23')](removeEntity(_0x3818ba,null))[_0x4f4b('0x3f')](handleError(_0x3818ba,null));};exports[_0x4f4b('0x46')]=function(_0x9e9122,_0x31fd8f,_0xf2520f){var _0x199646={};var _0xe4de43={};var _0x2a945d;var _0x22c15a;return db['ServicenowConfiguration'][_0x4f4b('0x47')]({'where':{'id':_0x9e9122[_0x4f4b('0x41')]['id']}})['then'](handleEntityNotFound(_0x31fd8f,null))[_0x4f4b('0x23')](function(_0x3fa7a3){if(_0x3fa7a3){_0x2a945d=_0x3fa7a3;_0xe4de43[_0x4f4b('0x2d')]=_[_0x4f4b('0x2f')](db[_0x4f4b('0x48')][_0x4f4b('0x2b')]);_0xe4de43['query']=_[_0x4f4b('0x2f')](_0x9e9122[_0x4f4b('0x2e')]);_0xe4de43['filters']=_['intersection'](_0xe4de43[_0x4f4b('0x2d')],_0xe4de43['query']);_0x199646[_0x4f4b('0x32')]=_[_0x4f4b('0x31')](_0xe4de43[_0x4f4b('0x2d')],qs[_0x4f4b('0x33')](_0x9e9122['query'][_0x4f4b('0x33')]));_0x199646[_0x4f4b('0x32')]=_0x199646[_0x4f4b('0x32')]['length']?_0x199646[_0x4f4b('0x32')]:_0xe4de43[_0x4f4b('0x2d')];_0x199646[_0x4f4b('0x49')]=qs['sort'](_0x9e9122[_0x4f4b('0x2e')][_0x4f4b('0x37')]);_0x199646['where']=qs[_0x4f4b('0x30')](_[_0x4f4b('0x39')](_0x9e9122[_0x4f4b('0x2e')],_0xe4de43[_0x4f4b('0x30')]));if(_0x9e9122['query'][_0x4f4b('0x3a')]){_0x199646[_0x4f4b('0x38')]=_[_0x4f4b('0x3c')](_0x199646['where'],{'$or':_[_0x4f4b('0x29')](_0x199646['attributes'],function(_0x4c337c){var _0x1e3895={};_0x1e3895[_0x4c337c]={'$like':'%'+_0x9e9122[_0x4f4b('0x2e')]['filter']+'%'};return _0x1e3895;})});}_0x199646=_[_0x4f4b('0x3c')]({},_0x199646,_0x9e9122[_0x4f4b('0x4a')]);return _0x2a945d['getFields'](_0x199646);}})['then'](function(_0x4ad61b){if(_0x4ad61b){_0x22c15a=_0x4ad61b[_0x4f4b('0x34')];if(!_0x9e9122[_0x4f4b('0x2e')][_0x4f4b('0x35')](_0x4f4b('0x36'))){_0x199646['limit']=qs[_0x4f4b('0x1c')](_0x9e9122['query'][_0x4f4b('0x1c')]);_0x199646[_0x4f4b('0x1b')]=qs[_0x4f4b('0x1b')](_0x9e9122[_0x4f4b('0x2e')][_0x4f4b('0x1b')]);}return _0x2a945d[_0x4f4b('0x46')](_0x199646);}})[_0x4f4b('0x23')](function(_0x53e84b){if(_0x53e84b){return _0x53e84b?{'count':_0x22c15a,'rows':_0x53e84b}:null;}})[_0x4f4b('0x23')](respondWithResult(_0x31fd8f,null))['catch'](handleError(_0x31fd8f,null));};exports[_0x4f4b('0x4b')]=function(_0x412a8a,_0x41133f,_0x2fc21c){var _0x1d4d42={};var _0x13eb18={};var _0x463f0c;var _0xb499df;return db[_0x4f4b('0x2a')][_0x4f4b('0x47')]({'where':{'id':_0x412a8a[_0x4f4b('0x41')]['id']}})[_0x4f4b('0x23')](handleEntityNotFound(_0x41133f,null))[_0x4f4b('0x23')](function(_0xe988a5){if(_0xe988a5){_0x463f0c=_0xe988a5;_0x13eb18[_0x4f4b('0x2d')]=_[_0x4f4b('0x2f')](db[_0x4f4b('0x48')]['rawAttributes']);_0x13eb18[_0x4f4b('0x2e')]=_[_0x4f4b('0x2f')](_0x412a8a[_0x4f4b('0x2e')]);_0x13eb18[_0x4f4b('0x30')]=_[_0x4f4b('0x31')](_0x13eb18[_0x4f4b('0x2d')],_0x13eb18[_0x4f4b('0x2e')]);_0x1d4d42[_0x4f4b('0x32')]=_[_0x4f4b('0x31')](_0x13eb18[_0x4f4b('0x2d')],qs['fields'](_0x412a8a[_0x4f4b('0x2e')][_0x4f4b('0x33')]));_0x1d4d42[_0x4f4b('0x32')]=_0x1d4d42[_0x4f4b('0x32')][_0x4f4b('0x34')]?_0x1d4d42[_0x4f4b('0x32')]:_0x13eb18[_0x4f4b('0x2d')];_0x1d4d42['order']=qs['sort'](_0x412a8a[_0x4f4b('0x2e')][_0x4f4b('0x37')]);_0x1d4d42[_0x4f4b('0x38')]=qs[_0x4f4b('0x30')](_[_0x4f4b('0x39')](_0x412a8a[_0x4f4b('0x2e')],_0x13eb18['filters']));if(_0x412a8a[_0x4f4b('0x2e')][_0x4f4b('0x3a')]){_0x1d4d42[_0x4f4b('0x38')]=_[_0x4f4b('0x3c')](_0x1d4d42['where'],{'$or':_[_0x4f4b('0x29')](_0x1d4d42[_0x4f4b('0x32')],function(_0x260993){var _0x40fb09={};_0x40fb09[_0x260993]={'$like':'%'+_0x412a8a[_0x4f4b('0x2e')][_0x4f4b('0x3a')]+'%'};return _0x40fb09;})});}_0x1d4d42=_[_0x4f4b('0x3c')]({},_0x1d4d42,_0x412a8a['options']);return _0x463f0c[_0x4f4b('0x4b')](_0x1d4d42);}})[_0x4f4b('0x23')](function(_0x50d0de){if(_0x50d0de){_0xb499df=_0x50d0de[_0x4f4b('0x34')];if(!_0x412a8a[_0x4f4b('0x2e')]['hasOwnProperty'](_0x4f4b('0x36'))){_0x1d4d42['limit']=qs['limit'](_0x412a8a[_0x4f4b('0x2e')][_0x4f4b('0x1c')]);_0x1d4d42[_0x4f4b('0x1b')]=qs[_0x4f4b('0x1b')](_0x412a8a[_0x4f4b('0x2e')][_0x4f4b('0x1b')]);}return _0x463f0c[_0x4f4b('0x4b')](_0x1d4d42);}})[_0x4f4b('0x23')](function(_0x1e4547){if(_0x1e4547){return _0x1e4547?{'count':_0xb499df,'rows':_0x1e4547}:null;}})[_0x4f4b('0x23')](respondWithResult(_0x41133f,null))[_0x4f4b('0x3f')](handleError(_0x41133f,null));};exports[_0x4f4b('0x4c')]=function(_0x262860,_0x325dd6,_0xb58462){var _0x4c7995={};var _0x53abcd={};var _0xa21969;var _0xa900d8;return db[_0x4f4b('0x2a')][_0x4f4b('0x47')]({'where':{'id':_0x262860[_0x4f4b('0x41')]['id']}})[_0x4f4b('0x23')](handleEntityNotFound(_0x325dd6,null))[_0x4f4b('0x23')](function(_0x3c118a){if(_0x3c118a){_0xa21969=_0x3c118a;_0x53abcd[_0x4f4b('0x2d')]=_[_0x4f4b('0x2f')](db[_0x4f4b('0x48')][_0x4f4b('0x2b')]);_0x53abcd[_0x4f4b('0x2e')]=_[_0x4f4b('0x2f')](_0x262860['query']);_0x53abcd[_0x4f4b('0x30')]=_[_0x4f4b('0x31')](_0x53abcd[_0x4f4b('0x2d')],_0x53abcd['query']);_0x4c7995[_0x4f4b('0x32')]=_[_0x4f4b('0x31')](_0x53abcd[_0x4f4b('0x2d')],qs[_0x4f4b('0x33')](_0x262860['query']['fields']));_0x4c7995[_0x4f4b('0x32')]=_0x4c7995[_0x4f4b('0x32')]['length']?_0x4c7995[_0x4f4b('0x32')]:_0x53abcd[_0x4f4b('0x2d')];_0x4c7995[_0x4f4b('0x49')]=qs[_0x4f4b('0x37')](_0x262860[_0x4f4b('0x2e')][_0x4f4b('0x37')]);_0x4c7995[_0x4f4b('0x38')]=qs[_0x4f4b('0x30')](_[_0x4f4b('0x39')](_0x262860[_0x4f4b('0x2e')],_0x53abcd[_0x4f4b('0x30')]));if(_0x262860['query'][_0x4f4b('0x3a')]){_0x4c7995[_0x4f4b('0x38')]=_['merge'](_0x4c7995[_0x4f4b('0x38')],{'$or':_['map'](_0x4c7995[_0x4f4b('0x32')],function(_0x26bb2f){var _0x12449e={};_0x12449e[_0x26bb2f]={'$like':'%'+_0x262860[_0x4f4b('0x2e')][_0x4f4b('0x3a')]+'%'};return _0x12449e;})});}_0x4c7995=_[_0x4f4b('0x3c')]({},_0x4c7995,_0x262860[_0x4f4b('0x4a')]);return _0xa21969[_0x4f4b('0x4c')](_0x4c7995);}})[_0x4f4b('0x23')](function(_0x24bc29){if(_0x24bc29){_0xa900d8=_0x24bc29[_0x4f4b('0x34')];if(!_0x262860[_0x4f4b('0x2e')][_0x4f4b('0x35')](_0x4f4b('0x36'))){_0x4c7995[_0x4f4b('0x1c')]=qs['limit'](_0x262860[_0x4f4b('0x2e')][_0x4f4b('0x1c')]);_0x4c7995['offset']=qs['offset'](_0x262860['query']['offset']);}return _0xa21969[_0x4f4b('0x4c')](_0x4c7995);}})[_0x4f4b('0x23')](function(_0x128536){if(_0x128536){return _0x128536?{'count':_0xa900d8,'rows':_0x128536}:null;}})['then'](respondWithResult(_0x325dd6,null))[_0x4f4b('0x3f')](handleError(_0x325dd6,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index a94117e..41031de 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 _0x135b=['request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','bluebird'];(function(_0x2373f3,_0x41ee8b){var _0x155c41=function(_0x1e860a){while(--_0x1e860a){_0x2373f3['push'](_0x2373f3['shift']());}};_0x155c41(++_0x41ee8b);}(_0x135b,0xaf));var _0xb135=function(_0x301ca3,_0x4233c5){_0x301ca3=_0x301ca3-0x0;var _0x131292=_0x135b[_0x301ca3];return _0x131292;};'use strict';var _=require(_0xb135('0x0'));var util=require(_0xb135('0x1'));var logger=require(_0xb135('0x2'))(_0xb135('0x3'));var moment=require('moment');var BPromise=require(_0xb135('0x4'));var rp=require(_0xb135('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb135('0x6'));var config=require(_0xb135('0x7'));var attributes=require(_0xb135('0x8'));module['exports']=function(_0x51a09c,_0x5b96fe){return _0x51a09c[_0xb135('0x9')](_0xb135('0xa'),attributes,{'tableName':_0xb135('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02f7=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ServicenowConfiguration','int_servicenow_configurations','lodash'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x02f7,0x1d3));var _0x702f=function(_0x2faeae,_0x2f7aa4){_0x2faeae=_0x2faeae-0x0;var _0xf0b909=_0x02f7[_0x2faeae];return _0xf0b909;};'use strict';var _=require(_0x702f('0x0'));var util=require(_0x702f('0x1'));var logger=require(_0x702f('0x2'))('api');var moment=require(_0x702f('0x3'));var BPromise=require(_0x702f('0x4'));var rp=require(_0x702f('0x5'));var fs=require('fs');var path=require(_0x702f('0x6'));var rimraf=require(_0x702f('0x7'));var config=require(_0x702f('0x8'));var attributes=require('./intServicenowConfiguration.attributes');module['exports']=function(_0x449ba1,_0x4ff1d2){return _0x449ba1[_0x702f('0x9')](_0x702f('0xa'),attributes,{'tableName':_0x702f('0xb'),'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 643cc3a..13d7115 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 _0x83ff=['http','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','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x21c8a9,_0x5687f4){var _0x1f8a72=function(_0x54f365){while(--_0x54f365){_0x21c8a9['push'](_0x21c8a9['shift']());}};_0x1f8a72(++_0x5687f4);}(_0x83ff,0x7c));var _0xf83f=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x83ff[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0xf83f('0x0'));var util=require(_0xf83f('0x1'));var moment=require(_0xf83f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf83f('0x3'));var logger=require(_0xf83f('0x4'))('rpc');var config=require(_0xf83f('0x5'));var jayson=require(_0xf83f('0x6'));var client=jayson[_0xf83f('0x7')][_0xf83f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42e2ab,_0x4bbe90,_0x203313){return new BPromise(function(_0x47a50f,_0x4cb8a3){return client[_0xf83f('0x9')](_0x42e2ab,_0x203313)[_0xf83f('0xa')](function(_0x4433ad){logger[_0xf83f('0xb')](_0xf83f('0xc'),_0x4bbe90,_0xf83f('0xd'));logger[_0xf83f('0xe')](_0xf83f('0xf'),_0x4bbe90,_0xf83f('0xd'),JSON[_0xf83f('0x10')](_0x4433ad));if(_0x4433ad[_0xf83f('0x11')]){if(_0x4433ad[_0xf83f('0x11')][_0xf83f('0x12')]===0x1f4){logger['error'](_0xf83f('0xc'),_0x4bbe90,_0x4433ad[_0xf83f('0x11')][_0xf83f('0x13')]);return _0x4cb8a3(_0x4433ad[_0xf83f('0x11')]['message']);}logger[_0xf83f('0x11')](_0xf83f('0xc'),_0x4bbe90,_0x4433ad[_0xf83f('0x11')][_0xf83f('0x13')]);return _0x47a50f(_0x4433ad['error']['message']);}else{logger[_0xf83f('0xb')](_0xf83f('0xc'),_0x4bbe90,_0xf83f('0xd'));_0x47a50f(_0x4433ad[_0xf83f('0x14')][_0xf83f('0x13')]);}})[_0xf83f('0x15')](function(_0x42d24a){logger['error'](_0xf83f('0xc'),_0x4bbe90,_0x42d24a);_0x4cb8a3(_0x42d24a);});});} \ No newline at end of file +var _0x29e8=['rpc','../../config/environment','http','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x13ff98,_0x40a5d8){var _0x595e08=function(_0x53569f){while(--_0x53569f){_0x13ff98['push'](_0x13ff98['shift']());}};_0x595e08(++_0x40a5d8);}(_0x29e8,0x116));var _0x829e=function(_0x270db7,_0x8ddb01){_0x270db7=_0x270db7-0x0;var _0x59e0d7=_0x29e8[_0x270db7];return _0x59e0d7;};'use strict';var _=require(_0x829e('0x0'));var util=require(_0x829e('0x1'));var moment=require(_0x829e('0x2'));var BPromise=require(_0x829e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x829e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x829e('0x5'));var logger=require(_0x829e('0x6'))(_0x829e('0x7'));var config=require(_0x829e('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x829e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x509ddb,_0x4a2a28,_0x2764f7){return new BPromise(function(_0x4b565a,_0x348843){return client['request'](_0x509ddb,_0x2764f7)['then'](function(_0x23a71c){logger[_0x829e('0xa')](_0x829e('0xb'),_0x4a2a28,_0x829e('0xc'));logger[_0x829e('0xd')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x4a2a28,_0x829e('0xc'),JSON[_0x829e('0xe')](_0x23a71c));if(_0x23a71c[_0x829e('0xf')]){if(_0x23a71c[_0x829e('0xf')]['code']===0x1f4){logger[_0x829e('0xf')](_0x829e('0xb'),_0x4a2a28,_0x23a71c[_0x829e('0xf')]['message']);return _0x348843(_0x23a71c[_0x829e('0xf')][_0x829e('0x10')]);}logger[_0x829e('0xf')](_0x829e('0xb'),_0x4a2a28,_0x23a71c[_0x829e('0xf')][_0x829e('0x10')]);return _0x4b565a(_0x23a71c['error'][_0x829e('0x10')]);}else{logger[_0x829e('0xa')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4a2a28,'request\x20sent');_0x4b565a(_0x23a71c[_0x829e('0x11')][_0x829e('0x10')]);}})[_0x829e('0x12')](function(_0x525850){logger['error'](_0x829e('0xb'),_0x4a2a28,_0x525850);_0x348843(_0x525850);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index f32dcc8..4c0a403 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 _0x3813=['show','post','create','delete','destroy','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x3813,0xd2));var _0x3381=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3813[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3381('0x0'));var timeout=require(_0x3381('0x1'));var express=require(_0x3381('0x2'));var router=express[_0x3381('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3381('0x4'));var config=require(_0x3381('0x5'));var controller=require(_0x3381('0x6'));router[_0x3381('0x7')]('/',auth[_0x3381('0x8')](),controller[_0x3381('0x9')]);router['get'](_0x3381('0xa'),auth[_0x3381('0x8')](),controller[_0x3381('0xb')]);router[_0x3381('0xc')]('/',auth['isAuthenticated'](),controller[_0x3381('0xd')]);router['put'](_0x3381('0xa'),auth[_0x3381('0x8')](),controller['update']);router[_0x3381('0xe')]('/:id',auth[_0x3381('0x8')](),controller[_0x3381('0xf')]);module[_0x3381('0x10')]=router; \ No newline at end of file +var _0xdd9c=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','post','create','delete'];(function(_0x1f8116,_0xcacfa3){var _0xe4d430=function(_0x4fe182){while(--_0x4fe182){_0x1f8116['push'](_0x1f8116['shift']());}};_0xe4d430(++_0xcacfa3);}(_0xdd9c,0xbc));var _0xcdd9=function(_0x5b4108,_0x29f3c3){_0x5b4108=_0x5b4108-0x0;var _0x11d6f6=_0xdd9c[_0x5b4108];return _0x11d6f6;};'use strict';var multer=require(_0xcdd9('0x0'));var util=require(_0xcdd9('0x1'));var path=require(_0xcdd9('0x2'));var timeout=require(_0xcdd9('0x3'));var express=require(_0xcdd9('0x4'));var router=express[_0xcdd9('0x5')]();var fs_extra=require(_0xcdd9('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xcdd9('0x7'));var config=require(_0xcdd9('0x8'));var controller=require('./intServicenowField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xcdd9('0x9')]);router[_0xcdd9('0xa')](_0xcdd9('0xb'),auth[_0xcdd9('0xc')](),controller['show']);router[_0xcdd9('0xd')]('/',auth[_0xcdd9('0xc')](),controller[_0xcdd9('0xe')]);router['put'](_0xcdd9('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xcdd9('0xf')](_0xcdd9('0xb'),auth[_0xcdd9('0xc')](),controller[_0xcdd9('0x10')]);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 1187555..747bdd9 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 _0x90cc=['BOOLEAN','exports','ENUM','string','customVariable','keyValue','STRING','variable'];(function(_0x5e7b10,_0x14c110){var _0x56712d=function(_0x2bb04e){while(--_0x2bb04e){_0x5e7b10['push'](_0x5e7b10['shift']());}};_0x56712d(++_0x14c110);}(_0x90cc,0xa1));var _0xc90c=function(_0x409e99,_0x957631){_0x409e99=_0x409e99-0x0;var _0x124641=_0x90cc[_0x409e99];return _0x124641;};'use strict';var Sequelize=require('sequelize');module[_0xc90c('0x0')]={'type':{'type':Sequelize[_0xc90c('0x1')](_0xc90c('0x2'),'variable',_0xc90c('0x3'),_0xc90c('0x4'),'picklist'),'defaultValue':_0xc90c('0x2')},'content':{'type':Sequelize[_0xc90c('0x5')]},'key':{'type':Sequelize[_0xc90c('0x5')]},'keyType':{'type':Sequelize[_0xc90c('0x1')](_0xc90c('0x2'),_0xc90c('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0xc90c('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc90c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc90c('0x5')]}}; \ No newline at end of file +var _0x8800=['ENUM','string','variable','keyValue','picklist','customVariable','STRING','BOOLEAN','sequelize','exports'];(function(_0x34e24e,_0x1cea00){var _0x38bd75=function(_0x359beb){while(--_0x359beb){_0x34e24e['push'](_0x34e24e['shift']());}};_0x38bd75(++_0x1cea00);}(_0x8800,0x13e));var _0x0880=function(_0x1f4ac6,_0xeb1599){_0x1f4ac6=_0x1f4ac6-0x0;var _0x29cf8a=_0x8800[_0x1f4ac6];return _0x29cf8a;};'use strict';var Sequelize=require(_0x0880('0x0'));module[_0x0880('0x1')]={'type':{'type':Sequelize[_0x0880('0x2')](_0x0880('0x3'),_0x0880('0x4'),'customVariable',_0x0880('0x5'),_0x0880('0x6')),'defaultValue':_0x0880('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0880('0x2')](_0x0880('0x3'),_0x0880('0x4'),_0x0880('0x7'))},'keyContent':{'type':Sequelize[_0x0880('0x8')]},'idField':{'type':Sequelize[_0x0880('0x8')]},'nameField':{'type':Sequelize[_0x0880('0x8')]},'customField':{'type':Sequelize[_0x0880('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0880('0x8')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 8da36ee..6b24c10 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 _0xb2d3=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/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','reject','save','update','destroy','then','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','show','params','intersection','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir'];(function(_0x206b24,_0x15fefb){var _0x41fb12=function(_0xa5e205){while(--_0xa5e205){_0x206b24['push'](_0x206b24['shift']());}};_0x41fb12(++_0x15fefb);}(_0xb2d3,0x197));var _0x3b2d=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xb2d3[_0x2c7618];return _0x5ce3f0;};'use strict';var emlformat=require(_0x3b2d('0x0'));var rimraf=require(_0x3b2d('0x1'));var zipdir=require(_0x3b2d('0x2'));var jsonpatch=require(_0x3b2d('0x3'));var rp=require(_0x3b2d('0x4'));var moment=require('moment');var BPromise=require(_0x3b2d('0x5'));var Mustache=require(_0x3b2d('0x6'));var util=require(_0x3b2d('0x7'));var path=require(_0x3b2d('0x8'));var sox=require(_0x3b2d('0x9'));var csv=require(_0x3b2d('0xa'));var ejs=require(_0x3b2d('0xb'));var fs=require('fs');var fs_extra=require(_0x3b2d('0xc'));var _=require(_0x3b2d('0xd'));var squel=require(_0x3b2d('0xe'));var crypto=require(_0x3b2d('0xf'));var jsforce=require(_0x3b2d('0x10'));var deskjs=require(_0x3b2d('0x11'));var toCsv=require(_0x3b2d('0xa'));var querystring=require(_0x3b2d('0x12'));var Papa=require(_0x3b2d('0x13'));var Redis=require(_0x3b2d('0x14'));var authService=require(_0x3b2d('0x15'));var qs=require(_0x3b2d('0x16'));var as=require(_0x3b2d('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3b2d('0x18'))(_0x3b2d('0x19'));var utils=require(_0x3b2d('0x1a'));var config=require(_0x3b2d('0x1b'));var licenseUtil=require(_0x3b2d('0x1c'));var db=require(_0x3b2d('0x1d'))['db'];function respondWithStatusCode(_0xd302ae,_0x150dfc){_0x150dfc=_0x150dfc||0xcc;return function(_0x4e26c6){if(_0x4e26c6){return _0xd302ae[_0x3b2d('0x1e')](_0x150dfc);}return _0xd302ae[_0x3b2d('0x1f')](_0x150dfc)[_0x3b2d('0x20')]();};}function respondWithResult(_0x201c03,_0x5d9ea2){_0x5d9ea2=_0x5d9ea2||0xc8;return function(_0x113bd4){if(_0x113bd4){return _0x201c03[_0x3b2d('0x1f')](_0x5d9ea2)[_0x3b2d('0x21')](_0x113bd4);}};}function respondWithFilteredResult(_0x1abe6b,_0x453ef3){return function(_0x3c27a2){if(_0x3c27a2){var _0x67e953=typeof _0x453ef3[_0x3b2d('0x22')]===_0x3b2d('0x23')&&typeof _0x453ef3[_0x3b2d('0x24')]===_0x3b2d('0x23');var _0x5d73fa=_0x3c27a2[_0x3b2d('0x25')];var _0x553cce=_0x67e953?0x0:_0x453ef3[_0x3b2d('0x22')];var _0x33ec43=_0x67e953?_0x3c27a2['count']:_0x453ef3[_0x3b2d('0x22')]+_0x453ef3[_0x3b2d('0x24')];var _0x239c25;if(_0x33ec43>=_0x5d73fa){_0x33ec43=_0x5d73fa;_0x239c25=0xc8;}else{_0x239c25=0xce;}_0x1abe6b[_0x3b2d('0x1f')](_0x239c25);return _0x1abe6b[_0x3b2d('0x26')](_0x3b2d('0x27'),_0x553cce+'-'+_0x33ec43+'/'+_0x5d73fa)['json'](_0x3c27a2);}return null;};}function patchUpdates(_0x5e04ac){return function(_0x4db88f){try{jsonpatch[_0x3b2d('0x28')](_0x4db88f,_0x5e04ac,!![]);}catch(_0x439696){return BPromise[_0x3b2d('0x29')](_0x439696);}return _0x4db88f[_0x3b2d('0x2a')]();};}function saveUpdates(_0x26235a,_0x322ecd){return function(_0x2f9956){if(_0x2f9956){return _0x2f9956[_0x3b2d('0x2b')](_0x26235a)['then'](function(_0x32d784){return _0x32d784;});}return null;};}function removeEntity(_0x37cb74,_0x542fcf){return function(_0x5b6d04){if(_0x5b6d04){return _0x5b6d04[_0x3b2d('0x2c')]()[_0x3b2d('0x2d')](function(){_0x37cb74[_0x3b2d('0x1f')](0xcc)[_0x3b2d('0x20')]();});}};}function handleEntityNotFound(_0xed91d0,_0x2218b2){return function(_0x3b8e62){if(!_0x3b8e62){_0xed91d0['sendStatus'](0x194);}return _0x3b8e62;};}function handleError(_0x3cdb29,_0x253798){_0x253798=_0x253798||0x1f4;return function(_0x113658){logger[_0x3b2d('0x2e')](_0x113658['stack']);if(_0x113658['name']){delete _0x113658[_0x3b2d('0x2f')];}_0x3cdb29[_0x3b2d('0x1f')](_0x253798)[_0x3b2d('0x30')](_0x113658);};}exports[_0x3b2d('0x31')]=function(_0x3889f8,_0x2cb5d1){var _0x499fde={},_0x16c19e={},_0x42ac33={'count':0x0,'rows':[]};var _0x5f193a=_[_0x3b2d('0x32')](db[_0x3b2d('0x33')][_0x3b2d('0x34')],function(_0x3736ff){return{'name':_0x3736ff[_0x3b2d('0x35')],'type':_0x3736ff[_0x3b2d('0x36')][_0x3b2d('0x37')]};});_0x16c19e[_0x3b2d('0x38')]=_[_0x3b2d('0x32')](_0x5f193a,_0x3b2d('0x2f'));_0x16c19e['query']=_[_0x3b2d('0x39')](_0x3889f8[_0x3b2d('0x3a')]);_0x16c19e[_0x3b2d('0x3b')]=_['intersection'](_0x16c19e[_0x3b2d('0x38')],_0x16c19e['query']);_0x499fde[_0x3b2d('0x3c')]=_['intersection'](_0x16c19e[_0x3b2d('0x38')],qs[_0x3b2d('0x3d')](_0x3889f8[_0x3b2d('0x3a')][_0x3b2d('0x3d')]));_0x499fde[_0x3b2d('0x3c')]=_0x499fde['attributes'][_0x3b2d('0x3e')]?_0x499fde[_0x3b2d('0x3c')]:_0x16c19e[_0x3b2d('0x38')];if(!_0x3889f8['query'][_0x3b2d('0x3f')](_0x3b2d('0x40'))){_0x499fde['limit']=qs[_0x3b2d('0x24')](_0x3889f8[_0x3b2d('0x3a')][_0x3b2d('0x24')]);_0x499fde[_0x3b2d('0x22')]=qs[_0x3b2d('0x22')](_0x3889f8[_0x3b2d('0x3a')]['offset']);}_0x499fde[_0x3b2d('0x41')]=qs[_0x3b2d('0x42')](_0x3889f8[_0x3b2d('0x3a')][_0x3b2d('0x42')]);_0x499fde[_0x3b2d('0x43')]=qs['filters'](_['pick'](_0x3889f8[_0x3b2d('0x3a')],_0x16c19e['filters']),_0x5f193a);if(_0x3889f8['query'][_0x3b2d('0x44')]){_0x499fde[_0x3b2d('0x43')]=_['merge'](_0x499fde['where'],{'$or':_[_0x3b2d('0x32')](_0x5f193a,function(_0x5b4dc0){if(_0x5b4dc0[_0x3b2d('0x36')]!=='VIRTUAL'){var _0x572af4={};_0x572af4[_0x5b4dc0[_0x3b2d('0x2f')]]={'$like':'%'+_0x3889f8['query'][_0x3b2d('0x44')]+'%'};return _0x572af4;}})});}_0x499fde=_[_0x3b2d('0x45')]({},_0x499fde,_0x3889f8[_0x3b2d('0x46')]);var _0x254c8e={'where':_0x499fde['where']};return db['ServicenowField']['count'](_0x254c8e)[_0x3b2d('0x2d')](function(_0x18e48e){_0x42ac33[_0x3b2d('0x25')]=_0x18e48e;if(_0x3889f8[_0x3b2d('0x3a')]['includeAll']){_0x499fde[_0x3b2d('0x47')]=[{'all':!![]}];}return db[_0x3b2d('0x33')][_0x3b2d('0x48')](_0x499fde);})[_0x3b2d('0x2d')](function(_0x3f7b10){_0x42ac33[_0x3b2d('0x49')]=_0x3f7b10;return _0x42ac33;})['then'](respondWithFilteredResult(_0x2cb5d1,_0x499fde))['catch'](handleError(_0x2cb5d1,null));};exports[_0x3b2d('0x4a')]=function(_0x521254,_0x52fb39){var _0x54a764={'raw':!![],'where':{'id':_0x521254[_0x3b2d('0x4b')]['id']}},_0x247ba5={};_0x247ba5[_0x3b2d('0x38')]=_[_0x3b2d('0x39')](db['ServicenowField'][_0x3b2d('0x34')]);_0x247ba5[_0x3b2d('0x3a')]=_[_0x3b2d('0x39')](_0x521254['query']);_0x247ba5[_0x3b2d('0x3b')]=_[_0x3b2d('0x4c')](_0x247ba5[_0x3b2d('0x38')],_0x247ba5['query']);_0x54a764[_0x3b2d('0x3c')]=_[_0x3b2d('0x4c')](_0x247ba5['model'],qs[_0x3b2d('0x3d')](_0x521254[_0x3b2d('0x3a')][_0x3b2d('0x3d')]));_0x54a764[_0x3b2d('0x3c')]=_0x54a764[_0x3b2d('0x3c')]['length']?_0x54a764[_0x3b2d('0x3c')]:_0x247ba5[_0x3b2d('0x38')];if(_0x521254['query'][_0x3b2d('0x4d')]){_0x54a764['include']=[{'all':!![]}];}_0x54a764=_['merge']({},_0x54a764,_0x521254[_0x3b2d('0x46')]);return db[_0x3b2d('0x33')][_0x3b2d('0x4e')](_0x54a764)[_0x3b2d('0x2d')](handleEntityNotFound(_0x52fb39,null))[_0x3b2d('0x2d')](respondWithResult(_0x52fb39,null))[_0x3b2d('0x4f')](handleError(_0x52fb39,null));};exports[_0x3b2d('0x50')]=function(_0xd7a500,_0x47d69f){return db[_0x3b2d('0x33')][_0x3b2d('0x50')](_0xd7a500[_0x3b2d('0x51')],{})[_0x3b2d('0x2d')](respondWithResult(_0x47d69f,0xc9))[_0x3b2d('0x4f')](handleError(_0x47d69f,null));};exports[_0x3b2d('0x2b')]=function(_0x4fb3cc,_0x4d8112){if(_0x4fb3cc['body']['id']){delete _0x4fb3cc['body']['id'];}return db[_0x3b2d('0x33')][_0x3b2d('0x4e')]({'where':{'id':_0x4fb3cc[_0x3b2d('0x4b')]['id']}})[_0x3b2d('0x2d')](handleEntityNotFound(_0x4d8112,null))[_0x3b2d('0x2d')](saveUpdates(_0x4fb3cc[_0x3b2d('0x51')],null))[_0x3b2d('0x2d')](respondWithResult(_0x4d8112,null))[_0x3b2d('0x4f')](handleError(_0x4d8112,null));};exports[_0x3b2d('0x2c')]=function(_0x3f0bc0,_0x3e06a3){return db[_0x3b2d('0x33')][_0x3b2d('0x4e')]({'where':{'id':_0x3f0bc0[_0x3b2d('0x4b')]['id']}})[_0x3b2d('0x2d')](handleEntityNotFound(_0x3e06a3,null))['then'](removeEntity(_0x3e06a3,null))[_0x3b2d('0x4f')](handleError(_0x3e06a3,null));}; \ No newline at end of file +var _0xa763=['filters','pick','filter','where','VIRTUAL','options','include','findAll','catch','show','keys','includeAll','merge','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xa763,0x17d));var _0x3a76=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0xa763[_0x377a6e];return _0x37f751;};'use strict';var emlformat=require(_0x3a76('0x0'));var rimraf=require(_0x3a76('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3a76('0x2'));var rp=require(_0x3a76('0x3'));var moment=require(_0x3a76('0x4'));var BPromise=require(_0x3a76('0x5'));var Mustache=require(_0x3a76('0x6'));var util=require(_0x3a76('0x7'));var path=require('path');var sox=require(_0x3a76('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3a76('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3a76('0xa'));var jsforce=require(_0x3a76('0xb'));var deskjs=require(_0x3a76('0xc'));var toCsv=require(_0x3a76('0xd'));var querystring=require(_0x3a76('0xe'));var Papa=require(_0x3a76('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3a76('0x10'));var as=require(_0x3a76('0x11'));var hardwareService=require(_0x3a76('0x12'));var logger=require(_0x3a76('0x13'))(_0x3a76('0x14'));var utils=require(_0x3a76('0x15'));var config=require(_0x3a76('0x16'));var licenseUtil=require(_0x3a76('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xdf9cd0,_0x468bb1){_0x468bb1=_0x468bb1||0xcc;return function(_0x3407f8){if(_0x3407f8){return _0xdf9cd0[_0x3a76('0x18')](_0x468bb1);}return _0xdf9cd0['status'](_0x468bb1)[_0x3a76('0x19')]();};}function respondWithResult(_0x2929e3,_0x1a2591){_0x1a2591=_0x1a2591||0xc8;return function(_0x567fc0){if(_0x567fc0){return _0x2929e3[_0x3a76('0x1a')](_0x1a2591)[_0x3a76('0x1b')](_0x567fc0);}};}function respondWithFilteredResult(_0x11dbfb,_0x32c8ba){return function(_0x351a9a){if(_0x351a9a){var _0x549f16=typeof _0x32c8ba[_0x3a76('0x1c')]===_0x3a76('0x1d')&&typeof _0x32c8ba['limit']===_0x3a76('0x1d');var _0x4b6653=_0x351a9a[_0x3a76('0x1e')];var _0x1b6501=_0x549f16?0x0:_0x32c8ba[_0x3a76('0x1c')];var _0x415371=_0x549f16?_0x351a9a[_0x3a76('0x1e')]:_0x32c8ba['offset']+_0x32c8ba[_0x3a76('0x1f')];var _0x2a9825;if(_0x415371>=_0x4b6653){_0x415371=_0x4b6653;_0x2a9825=0xc8;}else{_0x2a9825=0xce;}_0x11dbfb[_0x3a76('0x1a')](_0x2a9825);return _0x11dbfb[_0x3a76('0x20')](_0x3a76('0x21'),_0x1b6501+'-'+_0x415371+'/'+_0x4b6653)[_0x3a76('0x1b')](_0x351a9a);}return null;};}function patchUpdates(_0x294ed4){return function(_0x34ba3f){try{jsonpatch[_0x3a76('0x22')](_0x34ba3f,_0x294ed4,!![]);}catch(_0x25a5cc){return BPromise['reject'](_0x25a5cc);}return _0x34ba3f[_0x3a76('0x23')]();};}function saveUpdates(_0x2bb861,_0xc748bd){return function(_0x5ca849){if(_0x5ca849){return _0x5ca849['update'](_0x2bb861)[_0x3a76('0x24')](function(_0x3234b9){return _0x3234b9;});}return null;};}function removeEntity(_0x53bbbd,_0x4d8838){return function(_0x1ca014){if(_0x1ca014){return _0x1ca014[_0x3a76('0x25')]()[_0x3a76('0x24')](function(){_0x53bbbd[_0x3a76('0x1a')](0xcc)[_0x3a76('0x19')]();});}};}function handleEntityNotFound(_0x1c9ea4,_0x27692e){return function(_0x3041fd){if(!_0x3041fd){_0x1c9ea4[_0x3a76('0x18')](0x194);}return _0x3041fd;};}function handleError(_0x1d95cf,_0x75bc6c){_0x75bc6c=_0x75bc6c||0x1f4;return function(_0x2e3dd5){logger[_0x3a76('0x26')](_0x2e3dd5['stack']);if(_0x2e3dd5['name']){delete _0x2e3dd5[_0x3a76('0x27')];}_0x1d95cf['status'](_0x75bc6c)[_0x3a76('0x28')](_0x2e3dd5);};}exports[_0x3a76('0x29')]=function(_0x2874c7,_0x509e56){var _0x53de86={},_0x4d8858={},_0x4be787={'count':0x0,'rows':[]};var _0x1f8726=_[_0x3a76('0x2a')](db[_0x3a76('0x2b')][_0x3a76('0x2c')],function(_0x2491e7){return{'name':_0x2491e7[_0x3a76('0x2d')],'type':_0x2491e7[_0x3a76('0x2e')][_0x3a76('0x2f')]};});_0x4d8858[_0x3a76('0x30')]=_[_0x3a76('0x2a')](_0x1f8726,'name');_0x4d8858[_0x3a76('0x31')]=_['keys'](_0x2874c7[_0x3a76('0x31')]);_0x4d8858['filters']=_[_0x3a76('0x32')](_0x4d8858[_0x3a76('0x30')],_0x4d8858[_0x3a76('0x31')]);_0x53de86[_0x3a76('0x33')]=_[_0x3a76('0x32')](_0x4d8858[_0x3a76('0x30')],qs[_0x3a76('0x34')](_0x2874c7[_0x3a76('0x31')]['fields']));_0x53de86['attributes']=_0x53de86[_0x3a76('0x33')][_0x3a76('0x35')]?_0x53de86[_0x3a76('0x33')]:_0x4d8858[_0x3a76('0x30')];if(!_0x2874c7[_0x3a76('0x31')][_0x3a76('0x36')](_0x3a76('0x37'))){_0x53de86[_0x3a76('0x1f')]=qs[_0x3a76('0x1f')](_0x2874c7['query'][_0x3a76('0x1f')]);_0x53de86[_0x3a76('0x1c')]=qs[_0x3a76('0x1c')](_0x2874c7[_0x3a76('0x31')]['offset']);}_0x53de86['order']=qs['sort'](_0x2874c7[_0x3a76('0x31')][_0x3a76('0x38')]);_0x53de86['where']=qs[_0x3a76('0x39')](_[_0x3a76('0x3a')](_0x2874c7[_0x3a76('0x31')],_0x4d8858[_0x3a76('0x39')]),_0x1f8726);if(_0x2874c7[_0x3a76('0x31')][_0x3a76('0x3b')]){_0x53de86[_0x3a76('0x3c')]=_['merge'](_0x53de86[_0x3a76('0x3c')],{'$or':_[_0x3a76('0x2a')](_0x1f8726,function(_0x2c1b9a){if(_0x2c1b9a[_0x3a76('0x2e')]!==_0x3a76('0x3d')){var _0x9e077={};_0x9e077[_0x2c1b9a[_0x3a76('0x27')]]={'$like':'%'+_0x2874c7[_0x3a76('0x31')][_0x3a76('0x3b')]+'%'};return _0x9e077;}})});}_0x53de86=_['merge']({},_0x53de86,_0x2874c7[_0x3a76('0x3e')]);var _0x206a00={'where':_0x53de86[_0x3a76('0x3c')]};return db['ServicenowField']['count'](_0x206a00)[_0x3a76('0x24')](function(_0x520627){_0x4be787['count']=_0x520627;if(_0x2874c7[_0x3a76('0x31')]['includeAll']){_0x53de86[_0x3a76('0x3f')]=[{'all':!![]}];}return db[_0x3a76('0x2b')][_0x3a76('0x40')](_0x53de86);})[_0x3a76('0x24')](function(_0x5c4450){_0x4be787['rows']=_0x5c4450;return _0x4be787;})[_0x3a76('0x24')](respondWithFilteredResult(_0x509e56,_0x53de86))[_0x3a76('0x41')](handleError(_0x509e56,null));};exports[_0x3a76('0x42')]=function(_0x328233,_0xc9c56){var _0x21f4b2={'raw':!![],'where':{'id':_0x328233['params']['id']}},_0x3d5f89={};_0x3d5f89[_0x3a76('0x30')]=_['keys'](db[_0x3a76('0x2b')][_0x3a76('0x2c')]);_0x3d5f89[_0x3a76('0x31')]=_[_0x3a76('0x43')](_0x328233['query']);_0x3d5f89[_0x3a76('0x39')]=_[_0x3a76('0x32')](_0x3d5f89[_0x3a76('0x30')],_0x3d5f89[_0x3a76('0x31')]);_0x21f4b2[_0x3a76('0x33')]=_['intersection'](_0x3d5f89[_0x3a76('0x30')],qs[_0x3a76('0x34')](_0x328233[_0x3a76('0x31')][_0x3a76('0x34')]));_0x21f4b2[_0x3a76('0x33')]=_0x21f4b2[_0x3a76('0x33')][_0x3a76('0x35')]?_0x21f4b2['attributes']:_0x3d5f89[_0x3a76('0x30')];if(_0x328233[_0x3a76('0x31')][_0x3a76('0x44')]){_0x21f4b2['include']=[{'all':!![]}];}_0x21f4b2=_[_0x3a76('0x45')]({},_0x21f4b2,_0x328233['options']);return db[_0x3a76('0x2b')][_0x3a76('0x46')](_0x21f4b2)[_0x3a76('0x24')](handleEntityNotFound(_0xc9c56,null))[_0x3a76('0x24')](respondWithResult(_0xc9c56,null))[_0x3a76('0x41')](handleError(_0xc9c56,null));};exports[_0x3a76('0x47')]=function(_0x574ed8,_0x1c7001){return db[_0x3a76('0x2b')][_0x3a76('0x47')](_0x574ed8[_0x3a76('0x48')],{})[_0x3a76('0x24')](respondWithResult(_0x1c7001,0xc9))[_0x3a76('0x41')](handleError(_0x1c7001,null));};exports['update']=function(_0x3a44a9,_0xe814e3){if(_0x3a44a9[_0x3a76('0x48')]['id']){delete _0x3a44a9['body']['id'];}return db[_0x3a76('0x2b')]['find']({'where':{'id':_0x3a44a9['params']['id']}})[_0x3a76('0x24')](handleEntityNotFound(_0xe814e3,null))[_0x3a76('0x24')](saveUpdates(_0x3a44a9[_0x3a76('0x48')],null))[_0x3a76('0x24')](respondWithResult(_0xe814e3,null))['catch'](handleError(_0xe814e3,null));};exports[_0x3a76('0x25')]=function(_0x3473b4,_0x4dd865){return db[_0x3a76('0x2b')]['find']({'where':{'id':_0x3473b4['params']['id']}})['then'](handleEntityNotFound(_0x4dd865,null))[_0x3a76('0x24')](removeEntity(_0x4dd865,null))[_0x3a76('0x41')](handleError(_0x4dd865,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 0797725..923718e 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 _0x0760=['define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowField.attributes'];(function(_0x49ae8f,_0x1cfb08){var _0x1bc83b=function(_0x5ec284){while(--_0x5ec284){_0x49ae8f['push'](_0x49ae8f['shift']());}};_0x1bc83b(++_0x1cfb08);}(_0x0760,0xc9));var _0x0076=function(_0x5ed96d,_0x390d0f){_0x5ed96d=_0x5ed96d-0x0;var _0x24dd4d=_0x0760[_0x5ed96d];return _0x24dd4d;};'use strict';var _=require(_0x0076('0x0'));var util=require(_0x0076('0x1'));var logger=require('../../config/logger')(_0x0076('0x2'));var moment=require(_0x0076('0x3'));var BPromise=require(_0x0076('0x4'));var rp=require(_0x0076('0x5'));var fs=require('fs');var path=require(_0x0076('0x6'));var rimraf=require('rimraf');var config=require(_0x0076('0x7'));var attributes=require(_0x0076('0x8'));module['exports']=function(_0x48a38e,_0x55fef2){return _0x48a38e[_0x0076('0x9')](_0x0076('0xa'),attributes,{'tableName':_0x0076('0xb'),'paranoid':![],'indexes':[{'name':_0x0076('0xc'),'fields':[_0x0076('0xd'),_0x0076('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb74f=['../../config/environment','define','ServicenowField','int_servicenow_fields','FieldId','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x1c1bc3,_0x17c354){var _0x1983d6=function(_0x107863){while(--_0x107863){_0x1c1bc3['push'](_0x1c1bc3['shift']());}};_0x1983d6(++_0x17c354);}(_0xb74f,0x14f));var _0xfb74=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb74f[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfb74('0x0'))(_0xfb74('0x1'));var moment=require(_0xfb74('0x2'));var BPromise=require(_0xfb74('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb74('0x4'));var rimraf=require(_0xfb74('0x5'));var config=require(_0xfb74('0x6'));var attributes=require('./intServicenowField.attributes');module['exports']=function(_0x2d8623,_0x7252d3){return _0x2d8623[_0xfb74('0x7')](_0xfb74('0x8'),attributes,{'tableName':_0xfb74('0x9'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':['idField',_0xfb74('0xa')],'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 2ee44a1..c256526 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 _0xa9e0=['http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\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(_0x3173ef,_0x1c543e){var _0xfe9682=function(_0x555c2f){while(--_0x555c2f){_0x3173ef['push'](_0x3173ef['shift']());}};_0xfe9682(++_0x1c543e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 _0xf4eb=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x26ee83,_0x587e8d){var _0x3159a3=function(_0x38f13b){while(--_0x38f13b){_0x26ee83['push'](_0x26ee83['shift']());}};_0x3159a3(++_0x587e8d);}(_0xf4eb,0xec));var _0xbf4e=function(_0x1b50dc,_0x13b441){_0x1b50dc=_0x1b50dc-0x0;var _0x1e0561=_0xf4eb[_0x1b50dc];return _0x1e0561;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('ServicenowField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 6e5c7d8..2eb98c0 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(_0x15f50b,_0x11fccb){var _0x233a84=function(_0x2002a4){while(--_0x2002a4){_0x15f50b['push'](_0x15f50b['shift']());}};_0x233a84(++_0x11fccb);}(_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 _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(_0x52bd69,_0x19a336){var _0x16fec7=function(_0x3c7a4e){while(--_0x3c7a4e){_0x52bd69['push'](_0x52bd69['shift']());}};_0x16fec7(++_0x19a336);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index a7eddd1..db16113 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(_0xaaf593,_0x13925c){var _0x34aa15=function(_0x44af51){while(--_0x44af51){_0xaaf593['push'](_0xaaf593['shift']());}};_0x34aa15(++_0x13925c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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(_0x5baa49,_0x3c9233){var _0x394735=function(_0x400988){while(--_0x400988){_0x5baa49['push'](_0x5baa49['shift']());}};_0x394735(++_0x3c9233);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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 838daad..213ed43 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 _0xd192=['date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','username','password','remoteUri','substring','format','%s%s','/service/v4_1/rest.php','JSON','Invalid\x20Login','Password\x20Expired','get_module_fields','stringify','Calls','module_fields','remove','label','values','value','statusCode','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','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','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','then','destroy','error','stack','name','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','where','filter','VIRTUAL','merge','options','include','findAll','catch','show','params','keys','find','create','body','getConfigurations','sort','pick','nolimit','addConfiguration','findOne','getSubjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','getFields','description'];(function(_0x5a6e62,_0x3fd2c5){var _0x15e072=function(_0x142fe0){while(--_0x142fe0){_0x5a6e62['push'](_0x5a6e62['shift']());}};_0x15e072(++_0x3fd2c5);}(_0xd192,0x8d));var _0x2d19=function(_0x34f366,_0x472d41){_0x34f366=_0x34f366-0x0;var _0x3fcedb=_0xd192[_0x34f366];return _0x3fcedb;};'use strict';var emlformat=require(_0x2d19('0x0'));var rimraf=require(_0x2d19('0x1'));var zipdir=require(_0x2d19('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2d19('0x3'));var BPromise=require(_0x2d19('0x4'));var Mustache=require('mustache');var util=require(_0x2d19('0x5'));var path=require(_0x2d19('0x6'));var sox=require(_0x2d19('0x7'));var csv=require(_0x2d19('0x8'));var ejs=require(_0x2d19('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d19('0xa'));var squel=require(_0x2d19('0xb'));var crypto=require(_0x2d19('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2d19('0xd'));var toCsv=require(_0x2d19('0x8'));var querystring=require(_0x2d19('0xe'));var Papa=require(_0x2d19('0xf'));var Redis=require(_0x2d19('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2d19('0x11'));var as=require(_0x2d19('0x12'));var hardwareService=require(_0x2d19('0x13'));var logger=require(_0x2d19('0x14'))(_0x2d19('0x15'));var utils=require(_0x2d19('0x16'));var config=require(_0x2d19('0x17'));var licenseUtil=require(_0x2d19('0x18'));var db=require(_0x2d19('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xcb742,_0x46a1d3){_0x46a1d3=_0x46a1d3||0xcc;return function(_0x23196b){if(_0x23196b){return _0xcb742[_0x2d19('0x1a')](_0x46a1d3);}return _0xcb742['status'](_0x46a1d3)[_0x2d19('0x1b')]();};}function respondWithResult(_0x29f78f,_0x2a8053){_0x2a8053=_0x2a8053||0xc8;return function(_0x50dd05){if(_0x50dd05){return _0x29f78f[_0x2d19('0x1c')](_0x2a8053)['json'](_0x50dd05);}};}function respondWithFilteredResult(_0x36d8bf,_0x4d6a4f){return function(_0x25ab60){if(_0x25ab60){var _0xae40c0=typeof _0x4d6a4f[_0x2d19('0x1d')]===_0x2d19('0x1e')&&typeof _0x4d6a4f[_0x2d19('0x1f')]===_0x2d19('0x1e');var _0x32aac8=_0x25ab60[_0x2d19('0x20')];var _0x1b2865=_0xae40c0?0x0:_0x4d6a4f['offset'];var _0x4f9186=_0xae40c0?_0x25ab60[_0x2d19('0x20')]:_0x4d6a4f[_0x2d19('0x1d')]+_0x4d6a4f['limit'];var _0x3a9a95;if(_0x4f9186>=_0x32aac8){_0x4f9186=_0x32aac8;_0x3a9a95=0xc8;}else{_0x3a9a95=0xce;}_0x36d8bf[_0x2d19('0x1c')](_0x3a9a95);return _0x36d8bf['set'](_0x2d19('0x21'),_0x1b2865+'-'+_0x4f9186+'/'+_0x32aac8)[_0x2d19('0x22')](_0x25ab60);}return null;};}function patchUpdates(_0x3e5f6e){return function(_0x1cd264){try{jsonpatch[_0x2d19('0x23')](_0x1cd264,_0x3e5f6e,!![]);}catch(_0x1e1154){return BPromise[_0x2d19('0x24')](_0x1e1154);}return _0x1cd264['save']();};}function saveUpdates(_0x26c2ee,_0x38885b){return function(_0x324957){if(_0x324957){return _0x324957['update'](_0x26c2ee)[_0x2d19('0x25')](function(_0x4756d8){return _0x4756d8;});}return null;};}function removeEntity(_0x2e9e08,_0x344f31){return function(_0x1a0c79){if(_0x1a0c79){return _0x1a0c79[_0x2d19('0x26')]()[_0x2d19('0x25')](function(){_0x2e9e08[_0x2d19('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a9551,_0x2d1c00){return function(_0x369e0c){if(!_0x369e0c){_0x2a9551[_0x2d19('0x1a')](0x194);}return _0x369e0c;};}function handleError(_0x2ae3ca,_0x59de91){_0x59de91=_0x59de91||0x1f4;return function(_0x4e090e){logger[_0x2d19('0x27')](_0x4e090e[_0x2d19('0x28')]);if(_0x4e090e[_0x2d19('0x29')]){delete _0x4e090e[_0x2d19('0x29')];}_0x2ae3ca[_0x2d19('0x1c')](_0x59de91)['send'](_0x4e090e);};}exports['index']=function(_0x3b8467,_0xfcafec){var _0x3cd93c={},_0x576559={},_0x46a919={'count':0x0,'rows':[]};var _0x189f38=_[_0x2d19('0x2a')](db[_0x2d19('0x2b')][_0x2d19('0x2c')],function(_0x556fa3){return{'name':_0x556fa3[_0x2d19('0x2d')],'type':_0x556fa3[_0x2d19('0x2e')][_0x2d19('0x2f')]};});_0x576559[_0x2d19('0x30')]=_['map'](_0x189f38,_0x2d19('0x29'));_0x576559['query']=_['keys'](_0x3b8467[_0x2d19('0x31')]);_0x576559[_0x2d19('0x32')]=_['intersection'](_0x576559['model'],_0x576559[_0x2d19('0x31')]);_0x3cd93c[_0x2d19('0x33')]=_[_0x2d19('0x34')](_0x576559[_0x2d19('0x30')],qs[_0x2d19('0x35')](_0x3b8467[_0x2d19('0x31')][_0x2d19('0x35')]));_0x3cd93c[_0x2d19('0x33')]=_0x3cd93c[_0x2d19('0x33')][_0x2d19('0x36')]?_0x3cd93c[_0x2d19('0x33')]:_0x576559[_0x2d19('0x30')];if(!_0x3b8467[_0x2d19('0x31')][_0x2d19('0x37')]('nolimit')){_0x3cd93c[_0x2d19('0x1f')]=qs['limit'](_0x3b8467[_0x2d19('0x31')][_0x2d19('0x1f')]);_0x3cd93c[_0x2d19('0x1d')]=qs[_0x2d19('0x1d')](_0x3b8467['query'][_0x2d19('0x1d')]);}_0x3cd93c[_0x2d19('0x38')]=qs['sort'](_0x3b8467[_0x2d19('0x31')]['sort']);_0x3cd93c[_0x2d19('0x39')]=qs[_0x2d19('0x32')](_['pick'](_0x3b8467[_0x2d19('0x31')],_0x576559[_0x2d19('0x32')]),_0x189f38);if(_0x3b8467[_0x2d19('0x31')][_0x2d19('0x3a')]){_0x3cd93c[_0x2d19('0x39')]=_['merge'](_0x3cd93c[_0x2d19('0x39')],{'$or':_[_0x2d19('0x2a')](_0x189f38,function(_0x5d7f58){if(_0x5d7f58[_0x2d19('0x2e')]!==_0x2d19('0x3b')){var _0x271aeb={};_0x271aeb[_0x5d7f58[_0x2d19('0x29')]]={'$like':'%'+_0x3b8467[_0x2d19('0x31')]['filter']+'%'};return _0x271aeb;}})});}_0x3cd93c=_[_0x2d19('0x3c')]({},_0x3cd93c,_0x3b8467[_0x2d19('0x3d')]);var _0x5759e5={'where':_0x3cd93c[_0x2d19('0x39')]};return db[_0x2d19('0x2b')][_0x2d19('0x20')](_0x5759e5)[_0x2d19('0x25')](function(_0x5cf113){_0x46a919['count']=_0x5cf113;if(_0x3b8467[_0x2d19('0x31')]['includeAll']){_0x3cd93c[_0x2d19('0x3e')]=[{'all':!![]}];}return db[_0x2d19('0x2b')][_0x2d19('0x3f')](_0x3cd93c);})[_0x2d19('0x25')](function(_0x5012e0){_0x46a919['rows']=_0x5012e0;return _0x46a919;})[_0x2d19('0x25')](respondWithFilteredResult(_0xfcafec,_0x3cd93c))[_0x2d19('0x40')](handleError(_0xfcafec,null));};exports[_0x2d19('0x41')]=function(_0x47770b,_0x3e060e){var _0x35c9e8={'raw':![],'where':{'id':_0x47770b[_0x2d19('0x42')]['id']}},_0x100dfd={};_0x100dfd[_0x2d19('0x30')]=_[_0x2d19('0x43')](db[_0x2d19('0x2b')][_0x2d19('0x2c')]);_0x100dfd['query']=_['keys'](_0x47770b[_0x2d19('0x31')]);_0x100dfd['filters']=_[_0x2d19('0x34')](_0x100dfd[_0x2d19('0x30')],_0x100dfd[_0x2d19('0x31')]);_0x35c9e8['attributes']=_[_0x2d19('0x34')](_0x100dfd['model'],qs[_0x2d19('0x35')](_0x47770b[_0x2d19('0x31')][_0x2d19('0x35')]));_0x35c9e8[_0x2d19('0x33')]=_0x35c9e8[_0x2d19('0x33')][_0x2d19('0x36')]?_0x35c9e8[_0x2d19('0x33')]:_0x100dfd[_0x2d19('0x30')];if(_0x47770b['query']['includeAll']){_0x35c9e8[_0x2d19('0x3e')]=[{'all':!![]}];}_0x35c9e8=_[_0x2d19('0x3c')]({},_0x35c9e8,_0x47770b[_0x2d19('0x3d')]);return db[_0x2d19('0x2b')][_0x2d19('0x44')](_0x35c9e8)['then'](handleEntityNotFound(_0x3e060e,null))[_0x2d19('0x25')](respondWithResult(_0x3e060e,null))[_0x2d19('0x40')](handleError(_0x3e060e,null));};exports[_0x2d19('0x45')]=function(_0xade053,_0x373269){return db['SugarcrmAccount']['create'](_0xade053[_0x2d19('0x46')],{})[_0x2d19('0x25')](respondWithResult(_0x373269,0xc9))[_0x2d19('0x40')](handleError(_0x373269,null));};exports['update']=function(_0x5bc8f9,_0x439cf9){if(_0x5bc8f9[_0x2d19('0x46')]['id']){delete _0x5bc8f9[_0x2d19('0x46')]['id'];}return db[_0x2d19('0x2b')][_0x2d19('0x44')]({'where':{'id':_0x5bc8f9[_0x2d19('0x42')]['id']}})['then'](handleEntityNotFound(_0x439cf9,null))[_0x2d19('0x25')](saveUpdates(_0x5bc8f9[_0x2d19('0x46')],null))[_0x2d19('0x25')](respondWithResult(_0x439cf9,null))['catch'](handleError(_0x439cf9,null));};exports[_0x2d19('0x26')]=function(_0x22fa63,_0x457b3a){return db[_0x2d19('0x2b')][_0x2d19('0x44')]({'where':{'id':_0x22fa63[_0x2d19('0x42')]['id']}})[_0x2d19('0x25')](handleEntityNotFound(_0x457b3a,null))[_0x2d19('0x25')](removeEntity(_0x457b3a,null))[_0x2d19('0x40')](handleError(_0x457b3a,null));};exports[_0x2d19('0x47')]=function(_0x3f3d66,_0xedf666,_0x371207){var _0xd4cc92={};var _0x4cd38d={};var _0x40e7b5;var _0xbea0b8;return db[_0x2d19('0x2b')]['findOne']({'where':{'id':_0x3f3d66[_0x2d19('0x42')]['id']}})[_0x2d19('0x25')](handleEntityNotFound(_0xedf666,null))['then'](function(_0x39578a){if(_0x39578a){_0x40e7b5=_0x39578a;_0x4cd38d[_0x2d19('0x30')]=_[_0x2d19('0x43')](db['SugarcrmConfiguration'][_0x2d19('0x2c')]);_0x4cd38d[_0x2d19('0x31')]=_[_0x2d19('0x43')](_0x3f3d66['query']);_0x4cd38d[_0x2d19('0x32')]=_[_0x2d19('0x34')](_0x4cd38d[_0x2d19('0x30')],_0x4cd38d[_0x2d19('0x31')]);_0xd4cc92['attributes']=_[_0x2d19('0x34')](_0x4cd38d[_0x2d19('0x30')],qs[_0x2d19('0x35')](_0x3f3d66['query']['fields']));_0xd4cc92[_0x2d19('0x33')]=_0xd4cc92[_0x2d19('0x33')][_0x2d19('0x36')]?_0xd4cc92['attributes']:_0x4cd38d[_0x2d19('0x30')];_0xd4cc92[_0x2d19('0x38')]=qs[_0x2d19('0x48')](_0x3f3d66['query'][_0x2d19('0x48')]);_0xd4cc92[_0x2d19('0x39')]=qs[_0x2d19('0x32')](_[_0x2d19('0x49')](_0x3f3d66[_0x2d19('0x31')],_0x4cd38d[_0x2d19('0x32')]));if(_0x3f3d66[_0x2d19('0x31')][_0x2d19('0x3a')]){_0xd4cc92[_0x2d19('0x39')]=_[_0x2d19('0x3c')](_0xd4cc92['where'],{'$or':_[_0x2d19('0x2a')](_0xd4cc92['attributes'],function(_0xdf6f3d){var _0x3384f1={};_0x3384f1[_0xdf6f3d]={'$like':'%'+_0x3f3d66[_0x2d19('0x31')][_0x2d19('0x3a')]+'%'};return _0x3384f1;})});}_0xd4cc92=_[_0x2d19('0x3c')]({},_0xd4cc92,_0x3f3d66['options']);return _0x40e7b5[_0x2d19('0x47')](_0xd4cc92);}})[_0x2d19('0x25')](function(_0x5b32fe){if(_0x5b32fe){_0xbea0b8=_0x5b32fe[_0x2d19('0x36')];if(!_0x3f3d66[_0x2d19('0x31')][_0x2d19('0x37')](_0x2d19('0x4a'))){_0xd4cc92[_0x2d19('0x1f')]=qs[_0x2d19('0x1f')](_0x3f3d66['query']['limit']);_0xd4cc92[_0x2d19('0x1d')]=qs[_0x2d19('0x1d')](_0x3f3d66[_0x2d19('0x31')][_0x2d19('0x1d')]);}return _0x40e7b5[_0x2d19('0x47')](_0xd4cc92);}})['then'](function(_0x4b49ae){if(_0x4b49ae){return _0x4b49ae?{'count':_0xbea0b8,'rows':_0x4b49ae}:null;}})[_0x2d19('0x25')](respondWithResult(_0xedf666,null))[_0x2d19('0x40')](handleError(_0xedf666,null));};exports[_0x2d19('0x4b')]=function(_0xbb056,_0x11fef8,_0x67cf3e){if(_0xbb056[_0x2d19('0x46')]['id']){delete _0xbb056['body']['id'];}return db['SugarcrmAccount'][_0x2d19('0x4c')]({'where':{'id':_0xbb056[_0x2d19('0x42')]['id']}})[_0x2d19('0x25')](handleEntityNotFound(_0x11fef8,null))[_0x2d19('0x25')](function(_0x303d4e){if(_0x303d4e){_0xbb056[_0x2d19('0x46')]['AccountId']=_0x303d4e['id'];_0xbb056[_0x2d19('0x46')]['Subjects']=integrations[_0x2d19('0x4d')](_0xbb056['body'][_0x2d19('0x4e')],_0xbb056[_0x2d19('0x46')][_0x2d19('0x2e')]);_0xbb056[_0x2d19('0x46')][_0x2d19('0x4f')]=integrations[_0x2d19('0x50')](_0xbb056[_0x2d19('0x46')][_0x2d19('0x4e')],_0xbb056[_0x2d19('0x46')][_0x2d19('0x2e')]);return db[_0x2d19('0x51')][_0x2d19('0x45')](_0xbb056[_0x2d19('0x46')],{'include':[{'model':db[_0x2d19('0x52')],'as':'Subjects'},{'model':db[_0x2d19('0x52')],'as':'Descriptions'}]});}return null;})[_0x2d19('0x25')](respondWithResult(_0x11fef8,null))['catch'](handleError(_0x11fef8,null));};exports[_0x2d19('0x53')]=function(_0x10becd,_0x4d17af,_0x119567){var _0x45ba43='';var _0x535925=['id','name','assigned_user_id','created_by',_0x2d19('0x54'),_0x2d19('0x55'),_0x2d19('0x56'),_0x2d19('0x57'),_0x2d19('0x58'),_0x2d19('0x59'),_0x2d19('0x5a'),'direction'];return db[_0x2d19('0x2b')][_0x2d19('0x4c')]({'where':{'id':_0x10becd[_0x2d19('0x42')]['id']},'attributes':['id',_0x2d19('0x5b'),_0x2d19('0x5c'),'remoteUri']})['then'](handleEntityNotFound(_0x4d17af,null))['then'](function(_0x5b3a29){if(_0x5b3a29){_0x45ba43=_0x5b3a29[_0x2d19('0x5d')];var _0x3eff63=_0x45ba43['slice'](-0x1);if(_0x3eff63==='/'){_0x45ba43=_0x45ba43[_0x2d19('0x5e')](0x0,_0x45ba43['lastIndexOf'](_0x3eff63));}return rp({'method':'POST','uri':util[_0x2d19('0x5f')](_0x2d19('0x60'),_0x45ba43,_0x2d19('0x61')),'json':!![],'form':{'method':'login','input_type':_0x2d19('0x62'),'response_type':_0x2d19('0x62'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x5b3a29[_0x2d19('0x5b')],'password':_0x5b3a29['password'],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0x6f0e11){if(_0x6f0e11&&_0x6f0e11[_0x2d19('0x29')]!==_0x2d19('0x63')&&_0x6f0e11['name']!==_0x2d19('0x64')){return rp({'method':'POST','uri':util[_0x2d19('0x5f')](_0x2d19('0x60'),_0x45ba43,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x2d19('0x65'),'input_type':_0x2d19('0x62'),'response_type':_0x2d19('0x62'),'rest_data':JSON[_0x2d19('0x66')]({'session':_0x6f0e11['id'],'module_name':_0x2d19('0x67')})}})[_0x2d19('0x25')](function(_0x327364){if(_0x327364){var _0x3df06c=_['values'](_0x327364[_0x2d19('0x68')]);_[_0x2d19('0x69')](_0x3df06c,function(_0x569212){return _0x535925['includes'](_0x569212['name']);});return{'count':_0x3df06c[_0x2d19('0x36')],'rows':_[_0x2d19('0x2a')](_0x3df06c,function(_0x46d35a){return{'id':_0x46d35a[_0x2d19('0x29')],'name':_0x46d35a[_0x2d19('0x6a')],'custom':_['endsWith'](_0x46d35a[_0x2d19('0x29')],'_c')?!![]:![],'options':_0x46d35a[_0x2d19('0x3d')]?_[_0x2d19('0x2a')](_[_0x2d19('0x6b')](_0x46d35a['options']),function(_0x2260cf){return{'name':_0x2260cf[_0x2d19('0x6c')],'value':_0x2260cf[_0x2d19('0x29')]};}):[]};})};}})[_0x2d19('0x25')](respondWithResult(_0x4d17af,null))[_0x2d19('0x40')](function(_0x15789d){var _0x41827a=_0x10becd['query']['test']?0x1f4:_0x15789d[_0x2d19('0x6d')]||0x1f4;logger[_0x2d19('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0x2d19('0x53'),_0x41827a,JSON[_0x2d19('0x66')](_0x15789d));delete _0x15789d[_0x2d19('0x29')];if(_0x41827a===0x191){_0x41827a=0x190;}_0x4d17af[_0x2d19('0x1c')](_0x41827a)[_0x2d19('0x6e')](_0x10becd['query'][_0x2d19('0x6f')]?{'message':_0x2d19('0x70'),'statusCode':_0x15789d[_0x2d19('0x6d')]}:_0x15789d);});}else{var _0x1dbd90=0x1f4;_0x4d17af['status'](_0x1dbd90)[_0x2d19('0x6e')]({'message':_0x2d19('0x70'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xada9=['papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','then','includeAll','include','findAll','rows','catch','show','find','create','body','params','getConfigurations','findOne','SugarcrmConfiguration','options','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','Subjects','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_id','parent_name','direction','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','values','module_fields','includes','label','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring'];(function(_0x1b864a,_0x5ee497){var _0x3e8b04=function(_0x28be8e){while(--_0x28be8e){_0x1b864a['push'](_0x1b864a['shift']());}};_0x3e8b04(++_0x5ee497);}(_0xada9,0x70));var _0x9ada=function(_0x5dfeb6,_0xf17364){_0x5dfeb6=_0x5dfeb6-0x0;var _0x1c9371=_0xada9[_0x5dfeb6];return _0x1c9371;};'use strict';var emlformat=require(_0x9ada('0x0'));var rimraf=require(_0x9ada('0x1'));var zipdir=require(_0x9ada('0x2'));var jsonpatch=require(_0x9ada('0x3'));var rp=require(_0x9ada('0x4'));var moment=require(_0x9ada('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x9ada('0x6'));var sox=require(_0x9ada('0x7'));var csv=require('to-csv');var ejs=require(_0x9ada('0x8'));var fs=require('fs');var fs_extra=require(_0x9ada('0x9'));var _=require(_0x9ada('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9ada('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9ada('0xc'));var querystring=require(_0x9ada('0xd'));var Papa=require(_0x9ada('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9ada('0xf'));var hardwareService=require(_0x9ada('0x10'));var logger=require(_0x9ada('0x11'))(_0x9ada('0x12'));var utils=require(_0x9ada('0x13'));var config=require(_0x9ada('0x14'));var licenseUtil=require(_0x9ada('0x15'));var db=require(_0x9ada('0x16'))['db'];var integrations=require(_0x9ada('0x17'));function respondWithStatusCode(_0x3d1b13,_0x54d36c){_0x54d36c=_0x54d36c||0xcc;return function(_0x7314c2){if(_0x7314c2){return _0x3d1b13[_0x9ada('0x18')](_0x54d36c);}return _0x3d1b13[_0x9ada('0x19')](_0x54d36c)[_0x9ada('0x1a')]();};}function respondWithResult(_0x2378a5,_0x17f075){_0x17f075=_0x17f075||0xc8;return function(_0x3b192f){if(_0x3b192f){return _0x2378a5['status'](_0x17f075)[_0x9ada('0x1b')](_0x3b192f);}};}function respondWithFilteredResult(_0x4b44fd,_0x3909f6){return function(_0x23fef7){if(_0x23fef7){var _0x587fbb=typeof _0x3909f6[_0x9ada('0x1c')]===_0x9ada('0x1d')&&typeof _0x3909f6[_0x9ada('0x1e')]===_0x9ada('0x1d');var _0x58a9f5=_0x23fef7[_0x9ada('0x1f')];var _0x2ad4af=_0x587fbb?0x0:_0x3909f6[_0x9ada('0x1c')];var _0x1a2d0d=_0x587fbb?_0x23fef7[_0x9ada('0x1f')]:_0x3909f6[_0x9ada('0x1c')]+_0x3909f6[_0x9ada('0x1e')];var _0x3d85cd;if(_0x1a2d0d>=_0x58a9f5){_0x1a2d0d=_0x58a9f5;_0x3d85cd=0xc8;}else{_0x3d85cd=0xce;}_0x4b44fd[_0x9ada('0x19')](_0x3d85cd);return _0x4b44fd[_0x9ada('0x20')](_0x9ada('0x21'),_0x2ad4af+'-'+_0x1a2d0d+'/'+_0x58a9f5)[_0x9ada('0x1b')](_0x23fef7);}return null;};}function patchUpdates(_0x58cc0c){return function(_0x3b4a35){try{jsonpatch[_0x9ada('0x22')](_0x3b4a35,_0x58cc0c,!![]);}catch(_0x29f21e){return BPromise[_0x9ada('0x23')](_0x29f21e);}return _0x3b4a35[_0x9ada('0x24')]();};}function saveUpdates(_0x5c28a6,_0x2dae46){return function(_0x420297){if(_0x420297){return _0x420297[_0x9ada('0x25')](_0x5c28a6)['then'](function(_0xce512f){return _0xce512f;});}return null;};}function removeEntity(_0x10f82e,_0x11cc28){return function(_0x41eb43){if(_0x41eb43){return _0x41eb43[_0x9ada('0x26')]()['then'](function(){_0x10f82e['status'](0xcc)[_0x9ada('0x1a')]();});}};}function handleEntityNotFound(_0x5a78dc,_0x39b499){return function(_0x426a54){if(!_0x426a54){_0x5a78dc['sendStatus'](0x194);}return _0x426a54;};}function handleError(_0x5722ff,_0x4303b2){_0x4303b2=_0x4303b2||0x1f4;return function(_0x3f79fd){logger[_0x9ada('0x27')](_0x3f79fd[_0x9ada('0x28')]);if(_0x3f79fd[_0x9ada('0x29')]){delete _0x3f79fd[_0x9ada('0x29')];}_0x5722ff[_0x9ada('0x19')](_0x4303b2)[_0x9ada('0x2a')](_0x3f79fd);};}exports[_0x9ada('0x2b')]=function(_0x42b817,_0xa6e4b1){var _0xecfa53={},_0x1fdf00={},_0x50f12a={'count':0x0,'rows':[]};var _0x395c75=_[_0x9ada('0x2c')](db[_0x9ada('0x2d')][_0x9ada('0x2e')],function(_0x52f8af){return{'name':_0x52f8af[_0x9ada('0x2f')],'type':_0x52f8af[_0x9ada('0x30')][_0x9ada('0x31')]};});_0x1fdf00[_0x9ada('0x32')]=_[_0x9ada('0x2c')](_0x395c75,'name');_0x1fdf00['query']=_[_0x9ada('0x33')](_0x42b817[_0x9ada('0x34')]);_0x1fdf00[_0x9ada('0x35')]=_[_0x9ada('0x36')](_0x1fdf00[_0x9ada('0x32')],_0x1fdf00[_0x9ada('0x34')]);_0xecfa53[_0x9ada('0x37')]=_[_0x9ada('0x36')](_0x1fdf00['model'],qs['fields'](_0x42b817[_0x9ada('0x34')][_0x9ada('0x38')]));_0xecfa53['attributes']=_0xecfa53[_0x9ada('0x37')][_0x9ada('0x39')]?_0xecfa53[_0x9ada('0x37')]:_0x1fdf00[_0x9ada('0x32')];if(!_0x42b817['query'][_0x9ada('0x3a')](_0x9ada('0x3b'))){_0xecfa53[_0x9ada('0x1e')]=qs[_0x9ada('0x1e')](_0x42b817[_0x9ada('0x34')][_0x9ada('0x1e')]);_0xecfa53['offset']=qs[_0x9ada('0x1c')](_0x42b817[_0x9ada('0x34')]['offset']);}_0xecfa53[_0x9ada('0x3c')]=qs[_0x9ada('0x3d')](_0x42b817[_0x9ada('0x34')]['sort']);_0xecfa53[_0x9ada('0x3e')]=qs['filters'](_[_0x9ada('0x3f')](_0x42b817[_0x9ada('0x34')],_0x1fdf00['filters']),_0x395c75);if(_0x42b817['query']['filter']){_0xecfa53[_0x9ada('0x3e')]=_[_0x9ada('0x40')](_0xecfa53[_0x9ada('0x3e')],{'$or':_['map'](_0x395c75,function(_0x2acd58){if(_0x2acd58[_0x9ada('0x30')]!==_0x9ada('0x41')){var _0xd45199={};_0xd45199[_0x2acd58['name']]={'$like':'%'+_0x42b817[_0x9ada('0x34')][_0x9ada('0x42')]+'%'};return _0xd45199;}})});}_0xecfa53=_['merge']({},_0xecfa53,_0x42b817['options']);var _0x34f720={'where':_0xecfa53['where']};return db[_0x9ada('0x2d')][_0x9ada('0x1f')](_0x34f720)[_0x9ada('0x43')](function(_0x53b43c){_0x50f12a[_0x9ada('0x1f')]=_0x53b43c;if(_0x42b817[_0x9ada('0x34')][_0x9ada('0x44')]){_0xecfa53[_0x9ada('0x45')]=[{'all':!![]}];}return db[_0x9ada('0x2d')][_0x9ada('0x46')](_0xecfa53);})[_0x9ada('0x43')](function(_0x2ab630){_0x50f12a[_0x9ada('0x47')]=_0x2ab630;return _0x50f12a;})['then'](respondWithFilteredResult(_0xa6e4b1,_0xecfa53))[_0x9ada('0x48')](handleError(_0xa6e4b1,null));};exports[_0x9ada('0x49')]=function(_0x2492a3,_0x238b48){var _0x472944={'raw':![],'where':{'id':_0x2492a3['params']['id']}},_0x4180cc={};_0x4180cc[_0x9ada('0x32')]=_['keys'](db['SugarcrmAccount'][_0x9ada('0x2e')]);_0x4180cc[_0x9ada('0x34')]=_[_0x9ada('0x33')](_0x2492a3[_0x9ada('0x34')]);_0x4180cc['filters']=_[_0x9ada('0x36')](_0x4180cc[_0x9ada('0x32')],_0x4180cc['query']);_0x472944[_0x9ada('0x37')]=_[_0x9ada('0x36')](_0x4180cc['model'],qs['fields'](_0x2492a3[_0x9ada('0x34')]['fields']));_0x472944['attributes']=_0x472944[_0x9ada('0x37')]['length']?_0x472944['attributes']:_0x4180cc[_0x9ada('0x32')];if(_0x2492a3[_0x9ada('0x34')]['includeAll']){_0x472944[_0x9ada('0x45')]=[{'all':!![]}];}_0x472944=_[_0x9ada('0x40')]({},_0x472944,_0x2492a3['options']);return db['SugarcrmAccount'][_0x9ada('0x4a')](_0x472944)['then'](handleEntityNotFound(_0x238b48,null))['then'](respondWithResult(_0x238b48,null))[_0x9ada('0x48')](handleError(_0x238b48,null));};exports[_0x9ada('0x4b')]=function(_0x37320a,_0x4690ce){return db[_0x9ada('0x2d')][_0x9ada('0x4b')](_0x37320a[_0x9ada('0x4c')],{})[_0x9ada('0x43')](respondWithResult(_0x4690ce,0xc9))[_0x9ada('0x48')](handleError(_0x4690ce,null));};exports[_0x9ada('0x25')]=function(_0x2328cc,_0x5d2c0f){if(_0x2328cc[_0x9ada('0x4c')]['id']){delete _0x2328cc[_0x9ada('0x4c')]['id'];}return db['SugarcrmAccount'][_0x9ada('0x4a')]({'where':{'id':_0x2328cc[_0x9ada('0x4d')]['id']}})[_0x9ada('0x43')](handleEntityNotFound(_0x5d2c0f,null))[_0x9ada('0x43')](saveUpdates(_0x2328cc['body'],null))[_0x9ada('0x43')](respondWithResult(_0x5d2c0f,null))[_0x9ada('0x48')](handleError(_0x5d2c0f,null));};exports[_0x9ada('0x26')]=function(_0x257e34,_0x243387){return db[_0x9ada('0x2d')]['find']({'where':{'id':_0x257e34[_0x9ada('0x4d')]['id']}})[_0x9ada('0x43')](handleEntityNotFound(_0x243387,null))[_0x9ada('0x43')](removeEntity(_0x243387,null))['catch'](handleError(_0x243387,null));};exports[_0x9ada('0x4e')]=function(_0x26bafc,_0x50865a,_0x3c91c0){var _0x3d2fa9={};var _0x42b38d={};var _0x716701;var _0x434c2c;return db['SugarcrmAccount'][_0x9ada('0x4f')]({'where':{'id':_0x26bafc[_0x9ada('0x4d')]['id']}})[_0x9ada('0x43')](handleEntityNotFound(_0x50865a,null))[_0x9ada('0x43')](function(_0x28be55){if(_0x28be55){_0x716701=_0x28be55;_0x42b38d[_0x9ada('0x32')]=_[_0x9ada('0x33')](db[_0x9ada('0x50')][_0x9ada('0x2e')]);_0x42b38d[_0x9ada('0x34')]=_['keys'](_0x26bafc[_0x9ada('0x34')]);_0x42b38d['filters']=_[_0x9ada('0x36')](_0x42b38d['model'],_0x42b38d[_0x9ada('0x34')]);_0x3d2fa9[_0x9ada('0x37')]=_[_0x9ada('0x36')](_0x42b38d[_0x9ada('0x32')],qs[_0x9ada('0x38')](_0x26bafc[_0x9ada('0x34')][_0x9ada('0x38')]));_0x3d2fa9[_0x9ada('0x37')]=_0x3d2fa9['attributes'][_0x9ada('0x39')]?_0x3d2fa9[_0x9ada('0x37')]:_0x42b38d[_0x9ada('0x32')];_0x3d2fa9[_0x9ada('0x3c')]=qs[_0x9ada('0x3d')](_0x26bafc[_0x9ada('0x34')][_0x9ada('0x3d')]);_0x3d2fa9[_0x9ada('0x3e')]=qs[_0x9ada('0x35')](_['pick'](_0x26bafc[_0x9ada('0x34')],_0x42b38d['filters']));if(_0x26bafc[_0x9ada('0x34')][_0x9ada('0x42')]){_0x3d2fa9[_0x9ada('0x3e')]=_['merge'](_0x3d2fa9[_0x9ada('0x3e')],{'$or':_[_0x9ada('0x2c')](_0x3d2fa9[_0x9ada('0x37')],function(_0x2a0e27){var _0x5aa74a={};_0x5aa74a[_0x2a0e27]={'$like':'%'+_0x26bafc['query'][_0x9ada('0x42')]+'%'};return _0x5aa74a;})});}_0x3d2fa9=_[_0x9ada('0x40')]({},_0x3d2fa9,_0x26bafc[_0x9ada('0x51')]);return _0x716701[_0x9ada('0x4e')](_0x3d2fa9);}})[_0x9ada('0x43')](function(_0x518e3b){if(_0x518e3b){_0x434c2c=_0x518e3b[_0x9ada('0x39')];if(!_0x26bafc['query'][_0x9ada('0x3a')](_0x9ada('0x3b'))){_0x3d2fa9[_0x9ada('0x1e')]=qs[_0x9ada('0x1e')](_0x26bafc[_0x9ada('0x34')][_0x9ada('0x1e')]);_0x3d2fa9[_0x9ada('0x1c')]=qs[_0x9ada('0x1c')](_0x26bafc['query'][_0x9ada('0x1c')]);}return _0x716701['getConfigurations'](_0x3d2fa9);}})[_0x9ada('0x43')](function(_0x68426f){if(_0x68426f){return _0x68426f?{'count':_0x434c2c,'rows':_0x68426f}:null;}})[_0x9ada('0x43')](respondWithResult(_0x50865a,null))[_0x9ada('0x48')](handleError(_0x50865a,null));};exports[_0x9ada('0x52')]=function(_0x53baee,_0x4ee068,_0x4fd076){if(_0x53baee[_0x9ada('0x4c')]['id']){delete _0x53baee[_0x9ada('0x4c')]['id'];}return db['SugarcrmAccount'][_0x9ada('0x4f')]({'where':{'id':_0x53baee[_0x9ada('0x4d')]['id']}})[_0x9ada('0x43')](handleEntityNotFound(_0x4ee068,null))[_0x9ada('0x43')](function(_0x28b014){if(_0x28b014){_0x53baee[_0x9ada('0x4c')][_0x9ada('0x53')]=_0x28b014['id'];_0x53baee[_0x9ada('0x4c')]['Subjects']=integrations[_0x9ada('0x54')](_0x53baee[_0x9ada('0x4c')][_0x9ada('0x55')],_0x53baee[_0x9ada('0x4c')]['type']);_0x53baee[_0x9ada('0x4c')][_0x9ada('0x56')]=integrations[_0x9ada('0x57')](_0x53baee[_0x9ada('0x4c')]['channel'],_0x53baee[_0x9ada('0x4c')][_0x9ada('0x30')]);return db['SugarcrmConfiguration'][_0x9ada('0x4b')](_0x53baee[_0x9ada('0x4c')],{'include':[{'model':db[_0x9ada('0x58')],'as':_0x9ada('0x59')},{'model':db[_0x9ada('0x58')],'as':_0x9ada('0x56')}]});}return null;})['then'](respondWithResult(_0x4ee068,null))[_0x9ada('0x48')](handleError(_0x4ee068,null));};exports[_0x9ada('0x5a')]=function(_0x378802,_0x4b7096,_0x1ffaf5){var _0xf6eca9='';var _0x146c0e=['id',_0x9ada('0x29'),_0x9ada('0x5b'),'created_by',_0x9ada('0x5c'),_0x9ada('0x5d'),_0x9ada('0x5e'),_0x9ada('0x5f'),_0x9ada('0x60'),'parent_type',_0x9ada('0x61'),_0x9ada('0x62')];return db[_0x9ada('0x2d')][_0x9ada('0x4f')]({'where':{'id':_0x378802[_0x9ada('0x4d')]['id']},'attributes':['id','username',_0x9ada('0x63'),_0x9ada('0x64')]})[_0x9ada('0x43')](handleEntityNotFound(_0x4b7096,null))['then'](function(_0x55cb0f){if(_0x55cb0f){_0xf6eca9=_0x55cb0f[_0x9ada('0x64')];var _0x1a5c7b=_0xf6eca9[_0x9ada('0x65')](-0x1);if(_0x1a5c7b==='/'){_0xf6eca9=_0xf6eca9[_0x9ada('0x66')](0x0,_0xf6eca9[_0x9ada('0x67')](_0x1a5c7b));}return rp({'method':_0x9ada('0x68'),'uri':util[_0x9ada('0x69')](_0x9ada('0x6a'),_0xf6eca9,_0x9ada('0x6b')),'json':!![],'form':{'method':_0x9ada('0x6c'),'input_type':_0x9ada('0x6d'),'response_type':_0x9ada('0x6d'),'rest_data':JSON[_0x9ada('0x6e')]({'user_auth':{'user_name':_0x55cb0f[_0x9ada('0x6f')],'password':_0x55cb0f[_0x9ada('0x63')],'encryption':_0x9ada('0x70')},'application':_0x9ada('0x71')})}});}})[_0x9ada('0x43')](function(_0x522597){if(_0x522597&&_0x522597['name']!==_0x9ada('0x72')&&_0x522597[_0x9ada('0x29')]!==_0x9ada('0x73')){return rp({'method':'POST','uri':util[_0x9ada('0x69')](_0x9ada('0x6a'),_0xf6eca9,_0x9ada('0x6b')),'json':!![],'form':{'method':_0x9ada('0x74'),'input_type':_0x9ada('0x6d'),'response_type':_0x9ada('0x6d'),'rest_data':JSON[_0x9ada('0x6e')]({'session':_0x522597['id'],'module_name':'Calls'})}})[_0x9ada('0x43')](function(_0x42f125){if(_0x42f125){var _0x1ce456=_[_0x9ada('0x75')](_0x42f125[_0x9ada('0x76')]);_['remove'](_0x1ce456,function(_0x4ffe18){return _0x146c0e[_0x9ada('0x77')](_0x4ffe18[_0x9ada('0x29')]);});return{'count':_0x1ce456[_0x9ada('0x39')],'rows':_[_0x9ada('0x2c')](_0x1ce456,function(_0x18646a){return{'id':_0x18646a['name'],'name':_0x18646a[_0x9ada('0x78')],'custom':_['endsWith'](_0x18646a[_0x9ada('0x29')],'_c')?!![]:![],'options':_0x18646a[_0x9ada('0x51')]?_[_0x9ada('0x2c')](_[_0x9ada('0x75')](_0x18646a[_0x9ada('0x51')]),function(_0x960d6f){return{'name':_0x960d6f[_0x9ada('0x79')],'value':_0x960d6f[_0x9ada('0x29')]};}):[]};})};}})[_0x9ada('0x43')](respondWithResult(_0x4b7096,null))[_0x9ada('0x48')](function(_0x364625){var _0x22f76b=_0x378802['query'][_0x9ada('0x7a')]?0x1f4:_0x364625[_0x9ada('0x7b')]||0x1f4;logger[_0x9ada('0x27')](_0x9ada('0x7c'),'getFields',_0x22f76b,JSON[_0x9ada('0x6e')](_0x364625));delete _0x364625[_0x9ada('0x29')];if(_0x22f76b===0x191){_0x22f76b=0x190;}_0x4b7096['status'](_0x22f76b)[_0x9ada('0x2a')](_0x378802[_0x9ada('0x34')][_0x9ada('0x7a')]?{'message':'Wrong\x20credentials','statusCode':_0x364625[_0x9ada('0x7b')]}:_0x364625);});}else{var _0x2f1650=0x1f4;_0x4b7096[_0x9ada('0x19')](_0x2f1650)[_0x9ada('0x2a')]({'message':_0x9ada('0x7d'),'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 ab3a1c0..57b59b3 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 _0x95c9=['path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','../../config/logger','moment','request-promise'];(function(_0x4b69a1,_0xdd2aab){var _0x29f522=function(_0x2a2c87){while(--_0x2a2c87){_0x4b69a1['push'](_0x4b69a1['shift']());}};_0x29f522(++_0xdd2aab);}(_0x95c9,0x1e7));var _0x995c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x95c9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x995c('0x0'))('api');var moment=require(_0x995c('0x1'));var BPromise=require('bluebird');var rp=require(_0x995c('0x2'));var fs=require('fs');var path=require(_0x995c('0x3'));var rimraf=require(_0x995c('0x4'));var config=require(_0x995c('0x5'));var attributes=require(_0x995c('0x6'));var integrations=require(_0x995c('0x7'));module[_0x995c('0x8')]=function(_0x213269,_0x540865){return _0x213269[_0x995c('0x9')]('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b6b=['../../config/environment','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x1f0d60,_0x58a2c2){var _0x148a20=function(_0x96e0a3){while(--_0x96e0a3){_0x1f0d60['push'](_0x1f0d60['shift']());}};_0x148a20(++_0x58a2c2);}(_0x0b6b,0x125));var _0xb0b6=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x0b6b[_0x36ed3c];return _0x52a2e0;};'use strict';var _=require(_0xb0b6('0x0'));var util=require('util');var logger=require(_0xb0b6('0x1'))(_0xb0b6('0x2'));var moment=require(_0xb0b6('0x3'));var BPromise=require('bluebird');var rp=require(_0xb0b6('0x4'));var fs=require('fs');var path=require(_0xb0b6('0x5'));var rimraf=require(_0xb0b6('0x6'));var config=require(_0xb0b6('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xb0b6('0x8'));module[_0xb0b6('0x9')]=function(_0x1477ff,_0x2b4782){return _0x1477ff['define'](_0xb0b6('0xa'),attributes,{'tableName':_0xb0b6('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 03c9852..7793ce8 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 _0xd1d9=['limit','include','map','model','attributes','stringify','ShowSugarcrmAccount','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where'];(function(_0xb99421,_0xaab133){var _0x4b3ec7=function(_0x591d1a){while(--_0x591d1a){_0xb99421['push'](_0xb99421['shift']());}};_0x4b3ec7(++_0xaab133);}(_0xd1d9,0xb7));var _0x9d1d=function(_0xc4b308,_0x965288){_0xc4b308=_0xc4b308-0x0;var _0x2c90fc=_0xd1d9[_0xc4b308];return _0x2c90fc;};'use strict';var _=require(_0x9d1d('0x0'));var util=require(_0x9d1d('0x1'));var moment=require('moment');var BPromise=require(_0x9d1d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9d1d('0x3'));var db=require(_0x9d1d('0x4'))['db'];var utils=require(_0x9d1d('0x5'));var logger=require(_0x9d1d('0x6'))('rpc');var config=require(_0x9d1d('0x7'));var jayson=require(_0x9d1d('0x8'));var client=jayson[_0x9d1d('0x9')][_0x9d1d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e9905,_0x3d0a6e,_0x2483b3){return new BPromise(function(_0x244918,_0x428bd5){return client[_0x9d1d('0xb')](_0x5e9905,_0x2483b3)[_0x9d1d('0xc')](function(_0x3ff40c){logger[_0x9d1d('0xd')](_0x9d1d('0xe'),_0x3d0a6e,'request\x20sent');logger[_0x9d1d('0xf')](_0x9d1d('0x10'),_0x3d0a6e,_0x9d1d('0x11'),JSON['stringify'](_0x3ff40c));if(_0x3ff40c[_0x9d1d('0x12')]){if(_0x3ff40c[_0x9d1d('0x12')]['code']===0x1f4){logger['error'](_0x9d1d('0xe'),_0x3d0a6e,_0x3ff40c[_0x9d1d('0x12')][_0x9d1d('0x13')]);return _0x428bd5(_0x3ff40c[_0x9d1d('0x12')][_0x9d1d('0x13')]);}logger[_0x9d1d('0x12')](_0x9d1d('0xe'),_0x3d0a6e,_0x3ff40c[_0x9d1d('0x12')][_0x9d1d('0x13')]);return _0x244918(_0x3ff40c['error'][_0x9d1d('0x13')]);}else{logger[_0x9d1d('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x3d0a6e,_0x9d1d('0x11'));_0x244918(_0x3ff40c['result'][_0x9d1d('0x13')]);}})[_0x9d1d('0x14')](function(_0x3d32ec){logger[_0x9d1d('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x3d0a6e,_0x3d32ec);_0x428bd5(_0x3d32ec);});});}exports[_0x9d1d('0x15')]=function(_0x1fe1ac){var _0x3d68ad=this;return new Promise(function(_0x4f7197,_0x19e99a){return db[_0x9d1d('0x16')][_0x9d1d('0x17')]({'raw':_0x1fe1ac[_0x9d1d('0x18')]?_0x1fe1ac['options'][_0x9d1d('0x19')]===undefined?!![]:![]:!![],'where':_0x1fe1ac['options']?_0x1fe1ac[_0x9d1d('0x18')][_0x9d1d('0x1a')]||null:null,'attributes':_0x1fe1ac['options']?_0x1fe1ac['options']['attributes']||null:null,'limit':_0x1fe1ac[_0x9d1d('0x18')]?_0x1fe1ac[_0x9d1d('0x18')][_0x9d1d('0x1b')]||null:null,'include':_0x1fe1ac[_0x9d1d('0x18')]?_0x1fe1ac['options'][_0x9d1d('0x1c')]?_[_0x9d1d('0x1d')](_0x1fe1ac['options']['include'],function(_0x135a0a){return{'model':db[_0x135a0a[_0x9d1d('0x1e')]],'as':_0x135a0a['as'],'attributes':_0x135a0a[_0x9d1d('0x1f')],'include':_0x135a0a[_0x9d1d('0x1c')]?_[_0x9d1d('0x1d')](_0x135a0a[_0x9d1d('0x1c')],function(_0x39234c){return{'model':db[_0x39234c[_0x9d1d('0x1e')]],'as':_0x39234c['as'],'attributes':_0x39234c[_0x9d1d('0x1f')],'include':_0x39234c[_0x9d1d('0x1c')]?_[_0x9d1d('0x1d')](_0x39234c[_0x9d1d('0x1c')],function(_0x264867){return{'model':db[_0x264867['model']],'as':_0x264867['as'],'attributes':_0x264867['attributes']};}):[]};}):[]};}):[]:[]})[_0x9d1d('0xc')](function(_0x5825e3){logger[_0x9d1d('0xd')](_0x9d1d('0x15'),_0x1fe1ac);logger['debug'](_0x9d1d('0x15'),_0x1fe1ac,JSON[_0x9d1d('0x20')](_0x5825e3));_0x4f7197(_0x5825e3);})['catch'](function(_0x8a653c){logger['error']('GetSugarcrmAccount',_0x8a653c['message'],_0x1fe1ac);_0x19e99a(_0x3d68ad['error'](0x1f4,_0x8a653c[_0x9d1d('0x13')]));});});};exports[_0x9d1d('0x21')]=function(_0x594a4b){var _0x3d6008=this;return new Promise(function(_0x4b864f,_0x412eb0){return db['SugarcrmAccount'][_0x9d1d('0x22')]({'raw':_0x594a4b['options']?_0x594a4b[_0x9d1d('0x18')][_0x9d1d('0x19')]===undefined?!![]:![]:!![],'where':_0x594a4b[_0x9d1d('0x18')]?_0x594a4b[_0x9d1d('0x18')][_0x9d1d('0x1a')]||null:null,'attributes':_0x594a4b[_0x9d1d('0x18')]?_0x594a4b[_0x9d1d('0x18')][_0x9d1d('0x1f')]||null:null,'include':_0x594a4b[_0x9d1d('0x18')]?_0x594a4b[_0x9d1d('0x18')][_0x9d1d('0x1c')]?_['map'](_0x594a4b[_0x9d1d('0x18')][_0x9d1d('0x1c')],function(_0x586e8f){return{'model':db[_0x586e8f[_0x9d1d('0x1e')]],'as':_0x586e8f['as'],'attributes':_0x586e8f[_0x9d1d('0x1f')],'include':_0x586e8f[_0x9d1d('0x1c')]?_['map'](_0x586e8f[_0x9d1d('0x1c')],function(_0x1873d8){return{'model':db[_0x1873d8['model']],'as':_0x1873d8['as'],'attributes':_0x1873d8['attributes'],'include':_0x1873d8[_0x9d1d('0x1c')]?_[_0x9d1d('0x1d')](_0x1873d8['include'],function(_0x41efe3){return{'model':db[_0x41efe3[_0x9d1d('0x1e')]],'as':_0x41efe3['as'],'attributes':_0x41efe3[_0x9d1d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9d1d('0xc')](function(_0xa503f2){logger[_0x9d1d('0xd')](_0x9d1d('0x21'),_0x594a4b);logger[_0x9d1d('0xf')](_0x9d1d('0x21'),_0x594a4b,JSON[_0x9d1d('0x20')](_0xa503f2));_0x4b864f(_0xa503f2);})[_0x9d1d('0x14')](function(_0xa07e34){logger[_0x9d1d('0x12')](_0x9d1d('0x21'),_0xa07e34[_0x9d1d('0x13')],_0x594a4b);_0x412eb0(_0x3d6008[_0x9d1d('0x12')](0x1f4,_0xa07e34['message']));});});}; \ No newline at end of file +var _0xa0f7=['client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','options','raw','where','attributes','limit','map','include','model','GetSugarcrmAccount','ShowSugarcrmAccount','SugarcrmAccount','find','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x935fc8,_0x2e6376){var _0x2bd2e4=function(_0x35a00f){while(--_0x35a00f){_0x935fc8['push'](_0x935fc8['shift']());}};_0x2bd2e4(++_0x2e6376);}(_0xa0f7,0x69));var _0x7a0f=function(_0x19f177,_0x31f453){_0x19f177=_0x19f177-0x0;var _0x579289=_0xa0f7[_0x19f177];return _0x579289;};'use strict';var _=require(_0x7a0f('0x0'));var util=require(_0x7a0f('0x1'));var moment=require(_0x7a0f('0x2'));var BPromise=require(_0x7a0f('0x3'));var rs=require(_0x7a0f('0x4'));var fs=require('fs');var Redis=require(_0x7a0f('0x5'));var db=require(_0x7a0f('0x6'))['db'];var utils=require(_0x7a0f('0x7'));var logger=require(_0x7a0f('0x8'))(_0x7a0f('0x9'));var config=require(_0x7a0f('0xa'));var jayson=require(_0x7a0f('0xb'));var client=jayson[_0x7a0f('0xc')][_0x7a0f('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3fc35f,_0x23521c,_0x2deeef){return new BPromise(function(_0x16c553,_0x53e3ec){return client[_0x7a0f('0xe')](_0x3fc35f,_0x2deeef)[_0x7a0f('0xf')](function(_0x6d78a7){logger[_0x7a0f('0x10')](_0x7a0f('0x11'),_0x23521c,_0x7a0f('0x12'));logger[_0x7a0f('0x13')](_0x7a0f('0x14'),_0x23521c,_0x7a0f('0x12'),JSON['stringify'](_0x6d78a7));if(_0x6d78a7['error']){if(_0x6d78a7[_0x7a0f('0x15')][_0x7a0f('0x16')]===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x23521c,_0x6d78a7[_0x7a0f('0x15')][_0x7a0f('0x17')]);return _0x53e3ec(_0x6d78a7[_0x7a0f('0x15')]['message']);}logger[_0x7a0f('0x15')](_0x7a0f('0x11'),_0x23521c,_0x6d78a7['error']['message']);return _0x16c553(_0x6d78a7[_0x7a0f('0x15')]['message']);}else{logger[_0x7a0f('0x10')](_0x7a0f('0x11'),_0x23521c,_0x7a0f('0x12'));_0x16c553(_0x6d78a7[_0x7a0f('0x18')][_0x7a0f('0x17')]);}})[_0x7a0f('0x19')](function(_0x3bd0a0){logger[_0x7a0f('0x15')]('SugarcrmAccount,\x20%s,\x20%s',_0x23521c,_0x3bd0a0);_0x53e3ec(_0x3bd0a0);});});}exports['GetSugarcrmAccount']=function(_0x479a30){var _0x3a835b=this;return new Promise(function(_0x322513,_0x1517e6){return db['SugarcrmAccount']['findAll']({'raw':_0x479a30['options']?_0x479a30[_0x7a0f('0x1a')][_0x7a0f('0x1b')]===undefined?!![]:![]:!![],'where':_0x479a30[_0x7a0f('0x1a')]?_0x479a30[_0x7a0f('0x1a')][_0x7a0f('0x1c')]||null:null,'attributes':_0x479a30[_0x7a0f('0x1a')]?_0x479a30[_0x7a0f('0x1a')][_0x7a0f('0x1d')]||null:null,'limit':_0x479a30['options']?_0x479a30[_0x7a0f('0x1a')][_0x7a0f('0x1e')]||null:null,'include':_0x479a30[_0x7a0f('0x1a')]?_0x479a30[_0x7a0f('0x1a')]['include']?_[_0x7a0f('0x1f')](_0x479a30[_0x7a0f('0x1a')][_0x7a0f('0x20')],function(_0x43b1b0){return{'model':db[_0x43b1b0[_0x7a0f('0x21')]],'as':_0x43b1b0['as'],'attributes':_0x43b1b0['attributes'],'include':_0x43b1b0[_0x7a0f('0x20')]?_[_0x7a0f('0x1f')](_0x43b1b0[_0x7a0f('0x20')],function(_0x1f6175){return{'model':db[_0x1f6175[_0x7a0f('0x21')]],'as':_0x1f6175['as'],'attributes':_0x1f6175['attributes'],'include':_0x1f6175['include']?_[_0x7a0f('0x1f')](_0x1f6175[_0x7a0f('0x20')],function(_0x30920a){return{'model':db[_0x30920a[_0x7a0f('0x21')]],'as':_0x30920a['as'],'attributes':_0x30920a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7a0f('0xf')](function(_0x4a4d09){logger[_0x7a0f('0x10')](_0x7a0f('0x22'),_0x479a30);logger[_0x7a0f('0x13')](_0x7a0f('0x22'),_0x479a30,JSON['stringify'](_0x4a4d09));_0x322513(_0x4a4d09);})[_0x7a0f('0x19')](function(_0xd4f308){logger[_0x7a0f('0x15')](_0x7a0f('0x22'),_0xd4f308['message'],_0x479a30);_0x1517e6(_0x3a835b['error'](0x1f4,_0xd4f308[_0x7a0f('0x17')]));});});};exports[_0x7a0f('0x23')]=function(_0x5e0b72){var _0x53d1e8=this;return new Promise(function(_0x357c15,_0x207d94){return db[_0x7a0f('0x24')][_0x7a0f('0x25')]({'raw':_0x5e0b72[_0x7a0f('0x1a')]?_0x5e0b72['options'][_0x7a0f('0x1b')]===undefined?!![]:![]:!![],'where':_0x5e0b72[_0x7a0f('0x1a')]?_0x5e0b72[_0x7a0f('0x1a')][_0x7a0f('0x1c')]||null:null,'attributes':_0x5e0b72[_0x7a0f('0x1a')]?_0x5e0b72['options']['attributes']||null:null,'include':_0x5e0b72['options']?_0x5e0b72['options'][_0x7a0f('0x20')]?_[_0x7a0f('0x1f')](_0x5e0b72[_0x7a0f('0x1a')][_0x7a0f('0x20')],function(_0x167150){return{'model':db[_0x167150[_0x7a0f('0x21')]],'as':_0x167150['as'],'attributes':_0x167150[_0x7a0f('0x1d')],'include':_0x167150[_0x7a0f('0x20')]?_[_0x7a0f('0x1f')](_0x167150['include'],function(_0x1a4f6d){return{'model':db[_0x1a4f6d[_0x7a0f('0x21')]],'as':_0x1a4f6d['as'],'attributes':_0x1a4f6d[_0x7a0f('0x1d')],'include':_0x1a4f6d[_0x7a0f('0x20')]?_[_0x7a0f('0x1f')](_0x1a4f6d['include'],function(_0x53800f){return{'model':db[_0x53800f['model']],'as':_0x53800f['as'],'attributes':_0x53800f['attributes']};}):[]};}):[]};}):[]:[]})[_0x7a0f('0xf')](function(_0x221fd3){logger[_0x7a0f('0x10')](_0x7a0f('0x23'),_0x5e0b72);logger[_0x7a0f('0x13')]('ShowSugarcrmAccount',_0x5e0b72,JSON[_0x7a0f('0x26')](_0x221fd3));_0x357c15(_0x221fd3);})[_0x7a0f('0x19')](function(_0x5a36fa){logger[_0x7a0f('0x15')]('ShowSugarcrmAccount',_0x5a36fa[_0x7a0f('0x17')],_0x5e0b72);_0x207d94(_0x53d1e8[_0x7a0f('0x15')](0x1f4,_0x5a36fa[_0x7a0f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 764299d..d556836 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 _0x53c7=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','create','delete','destroy'];(function(_0x30f2d1,_0x5710ac){var _0x44605d=function(_0x46d60b){while(--_0x46d60b){_0x30f2d1['push'](_0x30f2d1['shift']());}};_0x44605d(++_0x5710ac);}(_0x53c7,0x191));var _0x753c=function(_0x4b7802,_0x42e9c1){_0x4b7802=_0x4b7802-0x0;var _0x505a7f=_0x53c7[_0x4b7802];return _0x505a7f;};'use strict';var multer=require(_0x753c('0x0'));var util=require('util');var path=require(_0x753c('0x1'));var timeout=require(_0x753c('0x2'));var express=require(_0x753c('0x3'));var router=express[_0x753c('0x4')]();var fs_extra=require(_0x753c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x753c('0x6'));var controller=require(_0x753c('0x7'));router[_0x753c('0x8')]('/',auth[_0x753c('0x9')](),controller['index']);router[_0x753c('0x8')](_0x753c('0xa'),auth[_0x753c('0x9')](),controller[_0x753c('0xb')]);router[_0x753c('0x8')](_0x753c('0xc'),auth[_0x753c('0x9')](),controller[_0x753c('0xd')]);router[_0x753c('0x8')]('/:id/subjects',auth[_0x753c('0x9')](),controller[_0x753c('0xe')]);router[_0x753c('0x8')](_0x753c('0xf'),auth[_0x753c('0x9')](),controller['getDescriptions']);router['post']('/',auth[_0x753c('0x9')](),controller[_0x753c('0x10')]);router['put']('/:id',auth[_0x753c('0x9')](),controller['update']);router[_0x753c('0x11')](_0x753c('0xa'),auth['isAuthenticated'](),controller[_0x753c('0x12')]);module[_0x753c('0x13')]=router; \ No newline at end of file +var _0x6bc6=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports'];(function(_0x52dfb6,_0xd5f97){var _0x45d9e9=function(_0x35ff42){while(--_0x35ff42){_0x52dfb6['push'](_0x52dfb6['shift']());}};_0x45d9e9(++_0xd5f97);}(_0x6bc6,0x1b0));var _0x66bc=function(_0x7185f7,_0x37065){_0x7185f7=_0x7185f7-0x0;var _0x182e45=_0x6bc6[_0x7185f7];return _0x182e45;};'use strict';var multer=require('multer');var util=require(_0x66bc('0x0'));var path=require(_0x66bc('0x1'));var timeout=require(_0x66bc('0x2'));var express=require(_0x66bc('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x66bc('0x4'));var interaction=require(_0x66bc('0x5'));var config=require(_0x66bc('0x6'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x66bc('0x7')]('/',auth[_0x66bc('0x8')](),controller[_0x66bc('0x9')]);router['get'](_0x66bc('0xa'),auth[_0x66bc('0x8')](),controller['show']);router[_0x66bc('0x7')](_0x66bc('0xb'),auth[_0x66bc('0x8')](),controller[_0x66bc('0xc')]);router[_0x66bc('0x7')](_0x66bc('0xd'),auth[_0x66bc('0x8')](),controller[_0x66bc('0xe')]);router['get'](_0x66bc('0xf'),auth[_0x66bc('0x8')](),controller[_0x66bc('0x10')]);router[_0x66bc('0x11')]('/',auth[_0x66bc('0x8')](),controller[_0x66bc('0x12')]);router[_0x66bc('0x13')](_0x66bc('0xa'),auth[_0x66bc('0x8')](),controller[_0x66bc('0x14')]);router[_0x66bc('0x15')]('/:id',auth[_0x66bc('0x8')](),controller[_0x66bc('0x16')]);module[_0x66bc('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index c9d477a..0ec9e51 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 _0xfa40=['exports','STRING','sequelize'];(function(_0x3f7407,_0x3692a1){var _0x2bc899=function(_0x5b8924){while(--_0x5b8924){_0x3f7407['push'](_0x3f7407['shift']());}};_0x2bc899(++_0x3692a1);}(_0xfa40,0x119));var _0x0fa4=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xfa40[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x0fa4('0x0'));module[_0x0fa4('0x1')]={'name':{'type':Sequelize[_0x0fa4('0x2')]},'description':{'type':Sequelize[_0x0fa4('0x2')]}}; \ No newline at end of file +var _0x2d78=['exports','STRING','sequelize'];(function(_0x3bad64,_0x42849c){var _0x5826fc=function(_0x1aed69){while(--_0x1aed69){_0x3bad64['push'](_0x3bad64['shift']());}};_0x5826fc(++_0x42849c);}(_0x2d78,0xd1));var _0x82d7=function(_0x3dee92,_0x55e1eb){_0x3dee92=_0x3dee92-0x0;var _0x44d36e=_0x2d78[_0x3dee92];return _0x44d36e;};'use strict';var Sequelize=require(_0x82d7('0x0'));module[_0x82d7('0x1')]={'name':{'type':Sequelize[_0x82d7('0x2')]},'description':{'type':Sequelize[_0x82d7('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index f9b25bb..78bbea9 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 _0x50b7=['find','create','body','getFields','findOne','SugarcrmField','pick','hasOwnProperty','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','destroy','then','end','name','send','index','SugarcrmConfiguration','rawAttributes','type','model','map','query','keys','attributes','intersection','fields','length','order','sort','where','filters','filter','merge','options','include','findAll','catch','show','params','includeAll'];(function(_0x401bc1,_0x593774){var _0x531154=function(_0x4ce8f8){while(--_0x4ce8f8){_0x401bc1['push'](_0x401bc1['shift']());}};_0x531154(++_0x593774);}(_0x50b7,0x16e));var _0x750b=function(_0x208223,_0x369914){_0x208223=_0x208223-0x0;var _0xaa5608=_0x50b7[_0x208223];return _0xaa5608;};'use strict';var emlformat=require(_0x750b('0x0'));var rimraf=require(_0x750b('0x1'));var zipdir=require(_0x750b('0x2'));var jsonpatch=require(_0x750b('0x3'));var rp=require(_0x750b('0x4'));var moment=require(_0x750b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x750b('0x6'));var util=require('util');var path=require(_0x750b('0x7'));var sox=require('sox');var csv=require(_0x750b('0x8'));var ejs=require(_0x750b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x750b('0xa'));var squel=require(_0x750b('0xb'));var crypto=require(_0x750b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x750b('0xd'));var toCsv=require(_0x750b('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x750b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x750b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x750b('0x10'));var logger=require('../../config/logger')(_0x750b('0x11'));var utils=require(_0x750b('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b2b5a,_0x378814){_0x378814=_0x378814||0xcc;return function(_0x3f27c5){if(_0x3f27c5){return _0x4b2b5a[_0x750b('0x13')](_0x378814);}return _0x4b2b5a[_0x750b('0x14')](_0x378814)['end']();};}function respondWithResult(_0x4b315d,_0x39f982){_0x39f982=_0x39f982||0xc8;return function(_0x206a1c){if(_0x206a1c){return _0x4b315d[_0x750b('0x14')](_0x39f982)[_0x750b('0x15')](_0x206a1c);}};}function respondWithFilteredResult(_0x2505dc,_0x19da27){return function(_0x3a77a1){if(_0x3a77a1){var _0x252c1a=typeof _0x19da27[_0x750b('0x16')]===_0x750b('0x17')&&typeof _0x19da27[_0x750b('0x18')]===_0x750b('0x17');var _0x5389d3=_0x3a77a1[_0x750b('0x19')];var _0x3a2800=_0x252c1a?0x0:_0x19da27[_0x750b('0x16')];var _0x38ecc0=_0x252c1a?_0x3a77a1[_0x750b('0x19')]:_0x19da27[_0x750b('0x16')]+_0x19da27[_0x750b('0x18')];var _0x5c625d;if(_0x38ecc0>=_0x5389d3){_0x38ecc0=_0x5389d3;_0x5c625d=0xc8;}else{_0x5c625d=0xce;}_0x2505dc[_0x750b('0x14')](_0x5c625d);return _0x2505dc[_0x750b('0x1a')]('Content-Range',_0x3a2800+'-'+_0x38ecc0+'/'+_0x5389d3)['json'](_0x3a77a1);}return null;};}function patchUpdates(_0xf2019b){return function(_0x8a38ca){try{jsonpatch[_0x750b('0x1b')](_0x8a38ca,_0xf2019b,!![]);}catch(_0x5e2fd7){return BPromise['reject'](_0x5e2fd7);}return _0x8a38ca[_0x750b('0x1c')]();};}function saveUpdates(_0x3bc8e7,_0x1dfdee){return function(_0x425a0c){if(_0x425a0c){return _0x425a0c[_0x750b('0x1d')](_0x3bc8e7)['then'](function(_0x1cc7ba){return _0x1cc7ba;});}return null;};}function removeEntity(_0x4a935b,_0x1a5c06){return function(_0x5baa71){if(_0x5baa71){return _0x5baa71[_0x750b('0x1e')]()[_0x750b('0x1f')](function(){_0x4a935b['status'](0xcc)[_0x750b('0x20')]();});}};}function handleEntityNotFound(_0x5cac2e,_0x3fbfbf){return function(_0x592b){if(!_0x592b){_0x5cac2e['sendStatus'](0x194);}return _0x592b;};}function handleError(_0x7b1af8,_0x3f9175){_0x3f9175=_0x3f9175||0x1f4;return function(_0x532f05){logger['error'](_0x532f05['stack']);if(_0x532f05[_0x750b('0x21')]){delete _0x532f05[_0x750b('0x21')];}_0x7b1af8['status'](_0x3f9175)[_0x750b('0x22')](_0x532f05);};}exports[_0x750b('0x23')]=function(_0x684df7,_0x4b0d5c){var _0x870e43={},_0x29ce1f={},_0x2534d7={'count':0x0,'rows':[]};var _0x32e994=_['map'](db[_0x750b('0x24')][_0x750b('0x25')],function(_0x28deaa){return{'name':_0x28deaa['fieldName'],'type':_0x28deaa[_0x750b('0x26')]['key']};});_0x29ce1f[_0x750b('0x27')]=_[_0x750b('0x28')](_0x32e994,_0x750b('0x21'));_0x29ce1f[_0x750b('0x29')]=_[_0x750b('0x2a')](_0x684df7[_0x750b('0x29')]);_0x29ce1f['filters']=_['intersection'](_0x29ce1f['model'],_0x29ce1f[_0x750b('0x29')]);_0x870e43[_0x750b('0x2b')]=_[_0x750b('0x2c')](_0x29ce1f[_0x750b('0x27')],qs[_0x750b('0x2d')](_0x684df7[_0x750b('0x29')][_0x750b('0x2d')]));_0x870e43[_0x750b('0x2b')]=_0x870e43['attributes'][_0x750b('0x2e')]?_0x870e43['attributes']:_0x29ce1f[_0x750b('0x27')];if(!_0x684df7[_0x750b('0x29')]['hasOwnProperty']('nolimit')){_0x870e43[_0x750b('0x18')]=qs[_0x750b('0x18')](_0x684df7['query'][_0x750b('0x18')]);_0x870e43[_0x750b('0x16')]=qs['offset'](_0x684df7['query'][_0x750b('0x16')]);}_0x870e43[_0x750b('0x2f')]=qs[_0x750b('0x30')](_0x684df7[_0x750b('0x29')][_0x750b('0x30')]);_0x870e43[_0x750b('0x31')]=qs[_0x750b('0x32')](_['pick'](_0x684df7[_0x750b('0x29')],_0x29ce1f[_0x750b('0x32')]),_0x32e994);if(_0x684df7[_0x750b('0x29')][_0x750b('0x33')]){_0x870e43[_0x750b('0x31')]=_['merge'](_0x870e43[_0x750b('0x31')],{'$or':_[_0x750b('0x28')](_0x32e994,function(_0x3598ec){if(_0x3598ec[_0x750b('0x26')]!=='VIRTUAL'){var _0x5d9421={};_0x5d9421[_0x3598ec[_0x750b('0x21')]]={'$like':'%'+_0x684df7[_0x750b('0x29')][_0x750b('0x33')]+'%'};return _0x5d9421;}})});}_0x870e43=_[_0x750b('0x34')]({},_0x870e43,_0x684df7[_0x750b('0x35')]);var _0x565dff={'where':_0x870e43[_0x750b('0x31')]};return db[_0x750b('0x24')][_0x750b('0x19')](_0x565dff)[_0x750b('0x1f')](function(_0x24ebc0){_0x2534d7['count']=_0x24ebc0;if(_0x684df7[_0x750b('0x29')]['includeAll']){_0x870e43[_0x750b('0x36')]=[{'all':!![]}];}return db[_0x750b('0x24')][_0x750b('0x37')](_0x870e43);})['then'](function(_0xc51bad){_0x2534d7['rows']=_0xc51bad;return _0x2534d7;})[_0x750b('0x1f')](respondWithFilteredResult(_0x4b0d5c,_0x870e43))[_0x750b('0x38')](handleError(_0x4b0d5c,null));};exports[_0x750b('0x39')]=function(_0x24459e,_0x1070be){var _0x33a0a5={'raw':![],'where':{'id':_0x24459e[_0x750b('0x3a')]['id']}},_0x38cb2d={};_0x38cb2d[_0x750b('0x27')]=_[_0x750b('0x2a')](db[_0x750b('0x24')]['rawAttributes']);_0x38cb2d[_0x750b('0x29')]=_[_0x750b('0x2a')](_0x24459e[_0x750b('0x29')]);_0x38cb2d[_0x750b('0x32')]=_['intersection'](_0x38cb2d[_0x750b('0x27')],_0x38cb2d[_0x750b('0x29')]);_0x33a0a5[_0x750b('0x2b')]=_[_0x750b('0x2c')](_0x38cb2d[_0x750b('0x27')],qs[_0x750b('0x2d')](_0x24459e[_0x750b('0x29')]['fields']));_0x33a0a5[_0x750b('0x2b')]=_0x33a0a5[_0x750b('0x2b')]['length']?_0x33a0a5['attributes']:_0x38cb2d[_0x750b('0x27')];if(_0x24459e[_0x750b('0x29')][_0x750b('0x3b')]){_0x33a0a5[_0x750b('0x36')]=[{'all':!![]}];}_0x33a0a5=_[_0x750b('0x34')]({},_0x33a0a5,_0x24459e[_0x750b('0x35')]);return db[_0x750b('0x24')][_0x750b('0x3c')](_0x33a0a5)[_0x750b('0x1f')](handleEntityNotFound(_0x1070be,null))['then'](respondWithResult(_0x1070be,null))[_0x750b('0x38')](handleError(_0x1070be,null));};exports[_0x750b('0x3d')]=function(_0x134873,_0x47dfdb){return db[_0x750b('0x24')][_0x750b('0x3d')](_0x134873[_0x750b('0x3e')],{})[_0x750b('0x1f')](respondWithResult(_0x47dfdb,0xc9))[_0x750b('0x38')](handleError(_0x47dfdb,null));};exports[_0x750b('0x1d')]=function(_0x27740d,_0x4e1ae3){if(_0x27740d[_0x750b('0x3e')]['id']){delete _0x27740d[_0x750b('0x3e')]['id'];}return db[_0x750b('0x24')][_0x750b('0x3c')]({'where':{'id':_0x27740d[_0x750b('0x3a')]['id']}})[_0x750b('0x1f')](handleEntityNotFound(_0x4e1ae3,null))[_0x750b('0x1f')](saveUpdates(_0x27740d[_0x750b('0x3e')],null))['then'](respondWithResult(_0x4e1ae3,null))[_0x750b('0x38')](handleError(_0x4e1ae3,null));};exports[_0x750b('0x1e')]=function(_0xbe94bc,_0x59d2d7){return db[_0x750b('0x24')]['find']({'where':{'id':_0xbe94bc['params']['id']}})['then'](handleEntityNotFound(_0x59d2d7,null))[_0x750b('0x1f')](removeEntity(_0x59d2d7,null))[_0x750b('0x38')](handleError(_0x59d2d7,null));};exports[_0x750b('0x3f')]=function(_0xe2e4,_0x4249a2,_0x5a7b6d){var _0x399285={};var _0x3a5912={};var _0x1c6d47;var _0x49bb5e;return db[_0x750b('0x24')][_0x750b('0x40')]({'where':{'id':_0xe2e4[_0x750b('0x3a')]['id']}})[_0x750b('0x1f')](handleEntityNotFound(_0x4249a2,null))[_0x750b('0x1f')](function(_0x23798a){if(_0x23798a){_0x1c6d47=_0x23798a;_0x3a5912[_0x750b('0x27')]=_[_0x750b('0x2a')](db[_0x750b('0x41')]['rawAttributes']);_0x3a5912['query']=_['keys'](_0xe2e4[_0x750b('0x29')]);_0x3a5912[_0x750b('0x32')]=_[_0x750b('0x2c')](_0x3a5912['model'],_0x3a5912[_0x750b('0x29')]);_0x399285['attributes']=_[_0x750b('0x2c')](_0x3a5912['model'],qs[_0x750b('0x2d')](_0xe2e4[_0x750b('0x29')][_0x750b('0x2d')]));_0x399285[_0x750b('0x2b')]=_0x399285[_0x750b('0x2b')][_0x750b('0x2e')]?_0x399285[_0x750b('0x2b')]:_0x3a5912[_0x750b('0x27')];_0x399285[_0x750b('0x2f')]=qs[_0x750b('0x30')](_0xe2e4[_0x750b('0x29')][_0x750b('0x30')]);_0x399285[_0x750b('0x31')]=qs['filters'](_[_0x750b('0x42')](_0xe2e4[_0x750b('0x29')],_0x3a5912[_0x750b('0x32')]));if(_0xe2e4[_0x750b('0x29')][_0x750b('0x33')]){_0x399285[_0x750b('0x31')]=_['merge'](_0x399285[_0x750b('0x31')],{'$or':_[_0x750b('0x28')](_0x399285['attributes'],function(_0x2ed8f4){var _0x316a31={};_0x316a31[_0x2ed8f4]={'$like':'%'+_0xe2e4[_0x750b('0x29')][_0x750b('0x33')]+'%'};return _0x316a31;})});}_0x399285=_[_0x750b('0x34')]({},_0x399285,_0xe2e4[_0x750b('0x35')]);return _0x1c6d47[_0x750b('0x3f')](_0x399285);}})['then'](function(_0x270610){if(_0x270610){_0x49bb5e=_0x270610['length'];if(!_0xe2e4[_0x750b('0x29')][_0x750b('0x43')](_0x750b('0x44'))){_0x399285[_0x750b('0x18')]=qs[_0x750b('0x18')](_0xe2e4[_0x750b('0x29')]['limit']);_0x399285[_0x750b('0x16')]=qs['offset'](_0xe2e4['query'][_0x750b('0x16')]);}return _0x1c6d47['getFields'](_0x399285);}})['then'](function(_0x12a327){if(_0x12a327){return _0x12a327?{'count':_0x49bb5e,'rows':_0x12a327}:null;}})[_0x750b('0x1f')](respondWithResult(_0x4249a2,null))['catch'](handleError(_0x4249a2,null));};exports[_0x750b('0x45')]=function(_0x487e65,_0x1d1787,_0x5151d7){var _0x20caa9={};var _0x4ccb23={};var _0x24d26c;var _0x3d7178;return db[_0x750b('0x24')]['findOne']({'where':{'id':_0x487e65[_0x750b('0x3a')]['id']}})[_0x750b('0x1f')](handleEntityNotFound(_0x1d1787,null))[_0x750b('0x1f')](function(_0x3f8e3e){if(_0x3f8e3e){_0x24d26c=_0x3f8e3e;_0x4ccb23[_0x750b('0x27')]=_[_0x750b('0x2a')](db[_0x750b('0x41')][_0x750b('0x25')]);_0x4ccb23[_0x750b('0x29')]=_[_0x750b('0x2a')](_0x487e65['query']);_0x4ccb23[_0x750b('0x32')]=_[_0x750b('0x2c')](_0x4ccb23[_0x750b('0x27')],_0x4ccb23[_0x750b('0x29')]);_0x20caa9[_0x750b('0x2b')]=_[_0x750b('0x2c')](_0x4ccb23[_0x750b('0x27')],qs[_0x750b('0x2d')](_0x487e65['query'][_0x750b('0x2d')]));_0x20caa9[_0x750b('0x2b')]=_0x20caa9['attributes'][_0x750b('0x2e')]?_0x20caa9[_0x750b('0x2b')]:_0x4ccb23['model'];_0x20caa9[_0x750b('0x2f')]=qs[_0x750b('0x30')](_0x487e65[_0x750b('0x29')][_0x750b('0x30')]);_0x20caa9['where']=qs[_0x750b('0x32')](_[_0x750b('0x42')](_0x487e65['query'],_0x4ccb23['filters']));if(_0x487e65[_0x750b('0x29')]['filter']){_0x20caa9[_0x750b('0x31')]=_[_0x750b('0x34')](_0x20caa9[_0x750b('0x31')],{'$or':_[_0x750b('0x28')](_0x20caa9[_0x750b('0x2b')],function(_0x287635){var _0x5d7334={};_0x5d7334[_0x287635]={'$like':'%'+_0x487e65[_0x750b('0x29')][_0x750b('0x33')]+'%'};return _0x5d7334;})});}_0x20caa9=_[_0x750b('0x34')]({},_0x20caa9,_0x487e65[_0x750b('0x35')]);return _0x24d26c[_0x750b('0x45')](_0x20caa9);}})[_0x750b('0x1f')](function(_0x2f52eb){if(_0x2f52eb){_0x3d7178=_0x2f52eb[_0x750b('0x2e')];if(!_0x487e65['query'][_0x750b('0x43')](_0x750b('0x44'))){_0x20caa9[_0x750b('0x18')]=qs['limit'](_0x487e65[_0x750b('0x29')][_0x750b('0x18')]);_0x20caa9['offset']=qs['offset'](_0x487e65['query'][_0x750b('0x16')]);}return _0x24d26c[_0x750b('0x45')](_0x20caa9);}})[_0x750b('0x1f')](function(_0x44bd3f){if(_0x44bd3f){return _0x44bd3f?{'count':_0x3d7178,'rows':_0x44bd3f}:null;}})[_0x750b('0x1f')](respondWithResult(_0x1d1787,null))[_0x750b('0x38')](handleError(_0x1d1787,null));};exports[_0x750b('0x46')]=function(_0x31d4e5,_0x3d78a7,_0x5ddcde){var _0x240f37={};var _0xe26c3b={};var _0x13e878;var _0x3266a2;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x31d4e5[_0x750b('0x3a')]['id']}})[_0x750b('0x1f')](handleEntityNotFound(_0x3d78a7,null))['then'](function(_0x3762c2){if(_0x3762c2){_0x13e878=_0x3762c2;_0xe26c3b[_0x750b('0x27')]=_['keys'](db[_0x750b('0x41')][_0x750b('0x25')]);_0xe26c3b[_0x750b('0x29')]=_[_0x750b('0x2a')](_0x31d4e5[_0x750b('0x29')]);_0xe26c3b[_0x750b('0x32')]=_['intersection'](_0xe26c3b['model'],_0xe26c3b[_0x750b('0x29')]);_0x240f37[_0x750b('0x2b')]=_[_0x750b('0x2c')](_0xe26c3b['model'],qs[_0x750b('0x2d')](_0x31d4e5[_0x750b('0x29')][_0x750b('0x2d')]));_0x240f37[_0x750b('0x2b')]=_0x240f37['attributes'][_0x750b('0x2e')]?_0x240f37[_0x750b('0x2b')]:_0xe26c3b[_0x750b('0x27')];_0x240f37[_0x750b('0x2f')]=qs['sort'](_0x31d4e5[_0x750b('0x29')][_0x750b('0x30')]);_0x240f37[_0x750b('0x31')]=qs[_0x750b('0x32')](_[_0x750b('0x42')](_0x31d4e5[_0x750b('0x29')],_0xe26c3b['filters']));if(_0x31d4e5['query']['filter']){_0x240f37['where']=_[_0x750b('0x34')](_0x240f37[_0x750b('0x31')],{'$or':_[_0x750b('0x28')](_0x240f37[_0x750b('0x2b')],function(_0x4d8db3){var _0x3a0c39={};_0x3a0c39[_0x4d8db3]={'$like':'%'+_0x31d4e5[_0x750b('0x29')][_0x750b('0x33')]+'%'};return _0x3a0c39;})});}_0x240f37=_[_0x750b('0x34')]({},_0x240f37,_0x31d4e5[_0x750b('0x35')]);return _0x13e878[_0x750b('0x46')](_0x240f37);}})[_0x750b('0x1f')](function(_0x1c2739){if(_0x1c2739){_0x3266a2=_0x1c2739['length'];if(!_0x31d4e5[_0x750b('0x29')][_0x750b('0x43')]('nolimit')){_0x240f37[_0x750b('0x18')]=qs[_0x750b('0x18')](_0x31d4e5[_0x750b('0x29')][_0x750b('0x18')]);_0x240f37[_0x750b('0x16')]=qs['offset'](_0x31d4e5['query']['offset']);}return _0x13e878[_0x750b('0x46')](_0x240f37);}})['then'](function(_0x4ea926){if(_0x4ea926){return _0x4ea926?{'count':_0x3266a2,'rows':_0x4ea926}:null;}})[_0x750b('0x1f')](respondWithResult(_0x3d78a7,null))[_0x750b('0x38')](handleError(_0x3d78a7,null));}; \ No newline at end of file +var _0x6580=['getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','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','offset','undefined','count','limit','set','Content-Range','apply','save','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','SugarcrmConfiguration','includeAll','include','findAll','show','params','keys','options','find','catch','create','update','body','destroy'];(function(_0x5372e6,_0x2eea2d){var _0x56a815=function(_0x1c27d8){while(--_0x1c27d8){_0x5372e6['push'](_0x5372e6['shift']());}};_0x56a815(++_0x2eea2d);}(_0x6580,0x1a9));var _0x0658=function(_0x59cf32,_0x2b2956){_0x59cf32=_0x59cf32-0x0;var _0x163db4=_0x6580[_0x59cf32];return _0x163db4;};'use strict';var emlformat=require(_0x0658('0x0'));var rimraf=require(_0x0658('0x1'));var zipdir=require(_0x0658('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0658('0x3'));var moment=require(_0x0658('0x4'));var BPromise=require(_0x0658('0x5'));var Mustache=require(_0x0658('0x6'));var util=require(_0x0658('0x7'));var path=require(_0x0658('0x8'));var sox=require('sox');var csv=require(_0x0658('0x9'));var ejs=require(_0x0658('0xa'));var fs=require('fs');var fs_extra=require(_0x0658('0xb'));var _=require('lodash');var squel=require(_0x0658('0xc'));var crypto=require(_0x0658('0xd'));var jsforce=require(_0x0658('0xe'));var deskjs=require(_0x0658('0xf'));var toCsv=require(_0x0658('0x9'));var querystring=require(_0x0658('0x10'));var Papa=require(_0x0658('0x11'));var Redis=require('ioredis');var authService=require(_0x0658('0x12'));var qs=require(_0x0658('0x13'));var as=require(_0x0658('0x14'));var hardwareService=require(_0x0658('0x15'));var logger=require(_0x0658('0x16'))(_0x0658('0x17'));var utils=require(_0x0658('0x18'));var config=require(_0x0658('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a5e9f,_0x5951a9){_0x5951a9=_0x5951a9||0xcc;return function(_0x23fff1){if(_0x23fff1){return _0x3a5e9f[_0x0658('0x1a')](_0x5951a9);}return _0x3a5e9f[_0x0658('0x1b')](_0x5951a9)[_0x0658('0x1c')]();};}function respondWithResult(_0x22345c,_0x31d9f0){_0x31d9f0=_0x31d9f0||0xc8;return function(_0x102b02){if(_0x102b02){return _0x22345c[_0x0658('0x1b')](_0x31d9f0)[_0x0658('0x1d')](_0x102b02);}};}function respondWithFilteredResult(_0x2413d8,_0x1b4ee8){return function(_0xf35f10){if(_0xf35f10){var _0x20d3d3=typeof _0x1b4ee8[_0x0658('0x1e')]===_0x0658('0x1f')&&typeof _0x1b4ee8['limit']===_0x0658('0x1f');var _0x3972ed=_0xf35f10[_0x0658('0x20')];var _0x398807=_0x20d3d3?0x0:_0x1b4ee8[_0x0658('0x1e')];var _0x43b0cb=_0x20d3d3?_0xf35f10[_0x0658('0x20')]:_0x1b4ee8[_0x0658('0x1e')]+_0x1b4ee8[_0x0658('0x21')];var _0x4abc72;if(_0x43b0cb>=_0x3972ed){_0x43b0cb=_0x3972ed;_0x4abc72=0xc8;}else{_0x4abc72=0xce;}_0x2413d8[_0x0658('0x1b')](_0x4abc72);return _0x2413d8[_0x0658('0x22')](_0x0658('0x23'),_0x398807+'-'+_0x43b0cb+'/'+_0x3972ed)[_0x0658('0x1d')](_0xf35f10);}return null;};}function patchUpdates(_0x2bb0b4){return function(_0x4be16a){try{jsonpatch[_0x0658('0x24')](_0x4be16a,_0x2bb0b4,!![]);}catch(_0x259375){return BPromise['reject'](_0x259375);}return _0x4be16a[_0x0658('0x25')]();};}function saveUpdates(_0x49e9f0,_0x398430){return function(_0x3f0c87){if(_0x3f0c87){return _0x3f0c87['update'](_0x49e9f0)[_0x0658('0x26')](function(_0x1be9ef){return _0x1be9ef;});}return null;};}function removeEntity(_0x5b0b8b,_0x44c9e7){return function(_0x51e3c9){if(_0x51e3c9){return _0x51e3c9['destroy']()[_0x0658('0x26')](function(){_0x5b0b8b[_0x0658('0x1b')](0xcc)[_0x0658('0x1c')]();});}};}function handleEntityNotFound(_0x3e375a,_0x23dc57){return function(_0x1e011e){if(!_0x1e011e){_0x3e375a[_0x0658('0x1a')](0x194);}return _0x1e011e;};}function handleError(_0x412076,_0x222e65){_0x222e65=_0x222e65||0x1f4;return function(_0xc7cc4d){logger[_0x0658('0x27')](_0xc7cc4d[_0x0658('0x28')]);if(_0xc7cc4d[_0x0658('0x29')]){delete _0xc7cc4d[_0x0658('0x29')];}_0x412076['status'](_0x222e65)[_0x0658('0x2a')](_0xc7cc4d);};}exports[_0x0658('0x2b')]=function(_0x1c4995,_0x472b58){var _0x228ff9={},_0x5158a4={},_0x107b2b={'count':0x0,'rows':[]};var _0x1fd05e=_['map'](db['SugarcrmConfiguration'][_0x0658('0x2c')],function(_0xe6e296){return{'name':_0xe6e296[_0x0658('0x2d')],'type':_0xe6e296[_0x0658('0x2e')][_0x0658('0x2f')]};});_0x5158a4[_0x0658('0x30')]=_[_0x0658('0x31')](_0x1fd05e,_0x0658('0x29'));_0x5158a4[_0x0658('0x32')]=_['keys'](_0x1c4995['query']);_0x5158a4[_0x0658('0x33')]=_['intersection'](_0x5158a4[_0x0658('0x30')],_0x5158a4[_0x0658('0x32')]);_0x228ff9[_0x0658('0x34')]=_[_0x0658('0x35')](_0x5158a4[_0x0658('0x30')],qs[_0x0658('0x36')](_0x1c4995[_0x0658('0x32')][_0x0658('0x36')]));_0x228ff9['attributes']=_0x228ff9[_0x0658('0x34')][_0x0658('0x37')]?_0x228ff9[_0x0658('0x34')]:_0x5158a4['model'];if(!_0x1c4995[_0x0658('0x32')][_0x0658('0x38')](_0x0658('0x39'))){_0x228ff9[_0x0658('0x21')]=qs[_0x0658('0x21')](_0x1c4995[_0x0658('0x32')][_0x0658('0x21')]);_0x228ff9[_0x0658('0x1e')]=qs[_0x0658('0x1e')](_0x1c4995[_0x0658('0x32')]['offset']);}_0x228ff9[_0x0658('0x3a')]=qs[_0x0658('0x3b')](_0x1c4995[_0x0658('0x32')][_0x0658('0x3b')]);_0x228ff9['where']=qs[_0x0658('0x33')](_[_0x0658('0x3c')](_0x1c4995[_0x0658('0x32')],_0x5158a4[_0x0658('0x33')]),_0x1fd05e);if(_0x1c4995[_0x0658('0x32')][_0x0658('0x3d')]){_0x228ff9[_0x0658('0x3e')]=_[_0x0658('0x3f')](_0x228ff9[_0x0658('0x3e')],{'$or':_[_0x0658('0x31')](_0x1fd05e,function(_0x754d88){if(_0x754d88['type']!==_0x0658('0x40')){var _0x20268b={};_0x20268b[_0x754d88[_0x0658('0x29')]]={'$like':'%'+_0x1c4995[_0x0658('0x32')]['filter']+'%'};return _0x20268b;}})});}_0x228ff9=_['merge']({},_0x228ff9,_0x1c4995['options']);var _0x5e30d4={'where':_0x228ff9['where']};return db[_0x0658('0x41')][_0x0658('0x20')](_0x5e30d4)[_0x0658('0x26')](function(_0x49f3e5){_0x107b2b['count']=_0x49f3e5;if(_0x1c4995[_0x0658('0x32')][_0x0658('0x42')]){_0x228ff9[_0x0658('0x43')]=[{'all':!![]}];}return db[_0x0658('0x41')][_0x0658('0x44')](_0x228ff9);})[_0x0658('0x26')](function(_0x4851a0){_0x107b2b['rows']=_0x4851a0;return _0x107b2b;})[_0x0658('0x26')](respondWithFilteredResult(_0x472b58,_0x228ff9))['catch'](handleError(_0x472b58,null));};exports[_0x0658('0x45')]=function(_0x37aaf8,_0x11bf19){var _0x153fdf={'raw':![],'where':{'id':_0x37aaf8[_0x0658('0x46')]['id']}},_0x1efb6f={};_0x1efb6f[_0x0658('0x30')]=_[_0x0658('0x47')](db['SugarcrmConfiguration'][_0x0658('0x2c')]);_0x1efb6f[_0x0658('0x32')]=_['keys'](_0x37aaf8[_0x0658('0x32')]);_0x1efb6f['filters']=_['intersection'](_0x1efb6f[_0x0658('0x30')],_0x1efb6f[_0x0658('0x32')]);_0x153fdf['attributes']=_[_0x0658('0x35')](_0x1efb6f[_0x0658('0x30')],qs[_0x0658('0x36')](_0x37aaf8[_0x0658('0x32')][_0x0658('0x36')]));_0x153fdf[_0x0658('0x34')]=_0x153fdf['attributes'][_0x0658('0x37')]?_0x153fdf[_0x0658('0x34')]:_0x1efb6f[_0x0658('0x30')];if(_0x37aaf8[_0x0658('0x32')][_0x0658('0x42')]){_0x153fdf[_0x0658('0x43')]=[{'all':!![]}];}_0x153fdf=_[_0x0658('0x3f')]({},_0x153fdf,_0x37aaf8[_0x0658('0x48')]);return db[_0x0658('0x41')][_0x0658('0x49')](_0x153fdf)['then'](handleEntityNotFound(_0x11bf19,null))[_0x0658('0x26')](respondWithResult(_0x11bf19,null))[_0x0658('0x4a')](handleError(_0x11bf19,null));};exports[_0x0658('0x4b')]=function(_0x36a7cc,_0x3f914b){return db[_0x0658('0x41')][_0x0658('0x4b')](_0x36a7cc['body'],{})['then'](respondWithResult(_0x3f914b,0xc9))[_0x0658('0x4a')](handleError(_0x3f914b,null));};exports[_0x0658('0x4c')]=function(_0x15181c,_0x23d62c){if(_0x15181c[_0x0658('0x4d')]['id']){delete _0x15181c[_0x0658('0x4d')]['id'];}return db[_0x0658('0x41')][_0x0658('0x49')]({'where':{'id':_0x15181c[_0x0658('0x46')]['id']}})[_0x0658('0x26')](handleEntityNotFound(_0x23d62c,null))['then'](saveUpdates(_0x15181c[_0x0658('0x4d')],null))[_0x0658('0x26')](respondWithResult(_0x23d62c,null))[_0x0658('0x4a')](handleError(_0x23d62c,null));};exports[_0x0658('0x4e')]=function(_0x2125f9,_0x4783bc){return db[_0x0658('0x41')]['find']({'where':{'id':_0x2125f9[_0x0658('0x46')]['id']}})[_0x0658('0x26')](handleEntityNotFound(_0x4783bc,null))[_0x0658('0x26')](removeEntity(_0x4783bc,null))[_0x0658('0x4a')](handleError(_0x4783bc,null));};exports[_0x0658('0x4f')]=function(_0x400947,_0x274b68,_0x32e158){var _0x2c1dca={};var _0x44863d={};var _0x2f6223;var _0x3ef448;return db['SugarcrmConfiguration'][_0x0658('0x50')]({'where':{'id':_0x400947[_0x0658('0x46')]['id']}})[_0x0658('0x26')](handleEntityNotFound(_0x274b68,null))['then'](function(_0x4ecd4f){if(_0x4ecd4f){_0x2f6223=_0x4ecd4f;_0x44863d[_0x0658('0x30')]=_[_0x0658('0x47')](db[_0x0658('0x51')][_0x0658('0x2c')]);_0x44863d[_0x0658('0x32')]=_[_0x0658('0x47')](_0x400947['query']);_0x44863d[_0x0658('0x33')]=_[_0x0658('0x35')](_0x44863d[_0x0658('0x30')],_0x44863d[_0x0658('0x32')]);_0x2c1dca[_0x0658('0x34')]=_['intersection'](_0x44863d[_0x0658('0x30')],qs[_0x0658('0x36')](_0x400947[_0x0658('0x32')][_0x0658('0x36')]));_0x2c1dca['attributes']=_0x2c1dca[_0x0658('0x34')]['length']?_0x2c1dca[_0x0658('0x34')]:_0x44863d[_0x0658('0x30')];_0x2c1dca[_0x0658('0x3a')]=qs[_0x0658('0x3b')](_0x400947[_0x0658('0x32')][_0x0658('0x3b')]);_0x2c1dca['where']=qs[_0x0658('0x33')](_[_0x0658('0x3c')](_0x400947[_0x0658('0x32')],_0x44863d['filters']));if(_0x400947[_0x0658('0x32')][_0x0658('0x3d')]){_0x2c1dca[_0x0658('0x3e')]=_[_0x0658('0x3f')](_0x2c1dca[_0x0658('0x3e')],{'$or':_[_0x0658('0x31')](_0x2c1dca[_0x0658('0x34')],function(_0x29523a){var _0x3fc269={};_0x3fc269[_0x29523a]={'$like':'%'+_0x400947[_0x0658('0x32')][_0x0658('0x3d')]+'%'};return _0x3fc269;})});}_0x2c1dca=_[_0x0658('0x3f')]({},_0x2c1dca,_0x400947[_0x0658('0x48')]);return _0x2f6223[_0x0658('0x4f')](_0x2c1dca);}})['then'](function(_0x573e78){if(_0x573e78){_0x3ef448=_0x573e78[_0x0658('0x37')];if(!_0x400947[_0x0658('0x32')][_0x0658('0x38')]('nolimit')){_0x2c1dca[_0x0658('0x21')]=qs[_0x0658('0x21')](_0x400947[_0x0658('0x32')][_0x0658('0x21')]);_0x2c1dca[_0x0658('0x1e')]=qs[_0x0658('0x1e')](_0x400947['query']['offset']);}return _0x2f6223[_0x0658('0x4f')](_0x2c1dca);}})['then'](function(_0x36a116){if(_0x36a116){return _0x36a116?{'count':_0x3ef448,'rows':_0x36a116}:null;}})[_0x0658('0x26')](respondWithResult(_0x274b68,null))[_0x0658('0x4a')](handleError(_0x274b68,null));};exports[_0x0658('0x52')]=function(_0x329055,_0x1278d5,_0x26e3e4){var _0x1509d1={};var _0x21f958={};var _0x4a1e75;var _0x290130;return db[_0x0658('0x41')][_0x0658('0x50')]({'where':{'id':_0x329055['params']['id']}})[_0x0658('0x26')](handleEntityNotFound(_0x1278d5,null))['then'](function(_0x5be106){if(_0x5be106){_0x4a1e75=_0x5be106;_0x21f958[_0x0658('0x30')]=_[_0x0658('0x47')](db[_0x0658('0x51')]['rawAttributes']);_0x21f958['query']=_[_0x0658('0x47')](_0x329055[_0x0658('0x32')]);_0x21f958[_0x0658('0x33')]=_[_0x0658('0x35')](_0x21f958[_0x0658('0x30')],_0x21f958[_0x0658('0x32')]);_0x1509d1[_0x0658('0x34')]=_[_0x0658('0x35')](_0x21f958['model'],qs[_0x0658('0x36')](_0x329055[_0x0658('0x32')]['fields']));_0x1509d1['attributes']=_0x1509d1['attributes'][_0x0658('0x37')]?_0x1509d1[_0x0658('0x34')]:_0x21f958[_0x0658('0x30')];_0x1509d1['order']=qs[_0x0658('0x3b')](_0x329055['query'][_0x0658('0x3b')]);_0x1509d1[_0x0658('0x3e')]=qs[_0x0658('0x33')](_[_0x0658('0x3c')](_0x329055[_0x0658('0x32')],_0x21f958['filters']));if(_0x329055['query'][_0x0658('0x3d')]){_0x1509d1[_0x0658('0x3e')]=_[_0x0658('0x3f')](_0x1509d1[_0x0658('0x3e')],{'$or':_[_0x0658('0x31')](_0x1509d1[_0x0658('0x34')],function(_0x2eeb7f){var _0x496e00={};_0x496e00[_0x2eeb7f]={'$like':'%'+_0x329055['query'][_0x0658('0x3d')]+'%'};return _0x496e00;})});}_0x1509d1=_[_0x0658('0x3f')]({},_0x1509d1,_0x329055[_0x0658('0x48')]);return _0x4a1e75[_0x0658('0x52')](_0x1509d1);}})[_0x0658('0x26')](function(_0x414f68){if(_0x414f68){_0x290130=_0x414f68[_0x0658('0x37')];if(!_0x329055[_0x0658('0x32')][_0x0658('0x38')](_0x0658('0x39'))){_0x1509d1['limit']=qs[_0x0658('0x21')](_0x329055[_0x0658('0x32')]['limit']);_0x1509d1['offset']=qs[_0x0658('0x1e')](_0x329055[_0x0658('0x32')][_0x0658('0x1e')]);}return _0x4a1e75[_0x0658('0x52')](_0x1509d1);}})[_0x0658('0x26')](function(_0x5bf03e){if(_0x5bf03e){return _0x5bf03e?{'count':_0x290130,'rows':_0x5bf03e}:null;}})[_0x0658('0x26')](respondWithResult(_0x1278d5,null))[_0x0658('0x4a')](handleError(_0x1278d5,null));};exports[_0x0658('0x53')]=function(_0x32defe,_0x43ad4d,_0x763b5c){var _0x1a4ad5={};var _0x17dbc3={};var _0x1f18ca;var _0x2a20de;return db['SugarcrmConfiguration'][_0x0658('0x50')]({'where':{'id':_0x32defe[_0x0658('0x46')]['id']}})[_0x0658('0x26')](handleEntityNotFound(_0x43ad4d,null))[_0x0658('0x26')](function(_0x450663){if(_0x450663){_0x1f18ca=_0x450663;_0x17dbc3['model']=_[_0x0658('0x47')](db[_0x0658('0x51')][_0x0658('0x2c')]);_0x17dbc3[_0x0658('0x32')]=_[_0x0658('0x47')](_0x32defe[_0x0658('0x32')]);_0x17dbc3[_0x0658('0x33')]=_['intersection'](_0x17dbc3[_0x0658('0x30')],_0x17dbc3['query']);_0x1a4ad5[_0x0658('0x34')]=_[_0x0658('0x35')](_0x17dbc3[_0x0658('0x30')],qs[_0x0658('0x36')](_0x32defe[_0x0658('0x32')]['fields']));_0x1a4ad5[_0x0658('0x34')]=_0x1a4ad5[_0x0658('0x34')]['length']?_0x1a4ad5[_0x0658('0x34')]:_0x17dbc3[_0x0658('0x30')];_0x1a4ad5[_0x0658('0x3a')]=qs[_0x0658('0x3b')](_0x32defe[_0x0658('0x32')][_0x0658('0x3b')]);_0x1a4ad5[_0x0658('0x3e')]=qs[_0x0658('0x33')](_[_0x0658('0x3c')](_0x32defe['query'],_0x17dbc3['filters']));if(_0x32defe[_0x0658('0x32')][_0x0658('0x3d')]){_0x1a4ad5[_0x0658('0x3e')]=_[_0x0658('0x3f')](_0x1a4ad5['where'],{'$or':_[_0x0658('0x31')](_0x1a4ad5[_0x0658('0x34')],function(_0x41805d){var _0x2a2003={};_0x2a2003[_0x41805d]={'$like':'%'+_0x32defe[_0x0658('0x32')][_0x0658('0x3d')]+'%'};return _0x2a2003;})});}_0x1a4ad5=_['merge']({},_0x1a4ad5,_0x32defe[_0x0658('0x48')]);return _0x1f18ca[_0x0658('0x53')](_0x1a4ad5);}})['then'](function(_0x198d0c){if(_0x198d0c){_0x2a20de=_0x198d0c[_0x0658('0x37')];if(!_0x32defe[_0x0658('0x32')][_0x0658('0x38')](_0x0658('0x39'))){_0x1a4ad5[_0x0658('0x21')]=qs[_0x0658('0x21')](_0x32defe[_0x0658('0x32')][_0x0658('0x21')]);_0x1a4ad5[_0x0658('0x1e')]=qs['offset'](_0x32defe['query']['offset']);}return _0x1f18ca[_0x0658('0x53')](_0x1a4ad5);}})[_0x0658('0x26')](function(_0x447ed2){if(_0x447ed2){return _0x447ed2?{'count':_0x2a20de,'rows':_0x447ed2}:null;}})['then'](respondWithResult(_0x43ad4d,null))[_0x0658('0x4a')](handleError(_0x43ad4d,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 5a2d4d3..798db87 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 _0xa86f=['int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration'];(function(_0x22e0be,_0x2cd85b){var _0x4b1d8e=function(_0x412a23){while(--_0x412a23){_0x22e0be['push'](_0x22e0be['shift']());}};_0x4b1d8e(++_0x2cd85b);}(_0xa86f,0x115));var _0xfa86=function(_0x278e78,_0x482823){_0x278e78=_0x278e78-0x0;var _0x1228a0=_0xa86f[_0x278e78];return _0x1228a0;};'use strict';var _=require(_0xfa86('0x0'));var util=require(_0xfa86('0x1'));var logger=require(_0xfa86('0x2'))(_0xfa86('0x3'));var moment=require(_0xfa86('0x4'));var BPromise=require(_0xfa86('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa86('0x6'));var rimraf=require(_0xfa86('0x7'));var config=require('../../config/environment');var attributes=require(_0xfa86('0x8'));module[_0xfa86('0x9')]=function(_0x1079aa,_0x2536f4){return _0x1079aa['define'](_0xfa86('0xa'),attributes,{'tableName':_0xfa86('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2113=['api','moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','util','../../config/logger'];(function(_0x5ab91c,_0x4d5085){var _0x4c1724=function(_0x2ebd4b){while(--_0x2ebd4b){_0x5ab91c['push'](_0x5ab91c['shift']());}};_0x4c1724(++_0x4d5085);}(_0x2113,0x166));var _0x3211=function(_0x4adb24,_0x1d8d9b){_0x4adb24=_0x4adb24-0x0;var _0x3dbaa3=_0x2113[_0x4adb24];return _0x3dbaa3;};'use strict';var _=require('lodash');var util=require(_0x3211('0x0'));var logger=require(_0x3211('0x1'))(_0x3211('0x2'));var moment=require(_0x3211('0x3'));var BPromise=require(_0x3211('0x4'));var rp=require(_0x3211('0x5'));var fs=require('fs');var path=require(_0x3211('0x6'));var rimraf=require('rimraf');var config=require(_0x3211('0x7'));var attributes=require(_0x3211('0x8'));module[_0x3211('0x9')]=function(_0x21d0c2,_0x241e75){return _0x21d0c2[_0x3211('0xa')](_0x3211('0xb'),attributes,{'tableName':'int_sugarcrm_configurations','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 40d0f5f..bf85c21 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 _0x8ddb=['../../config/environment','jayson/promise','http','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x4d45c6,_0x38ce1a){var _0x27d7de=function(_0x504201){while(--_0x504201){_0x4d45c6['push'](_0x4d45c6['shift']());}};_0x27d7de(++_0x38ce1a);}(_0x8ddb,0x111));var _0xb8dd=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x8ddb[_0x288f5e];return _0x476cc9;};'use strict';var _=require(_0xb8dd('0x0'));var util=require(_0xb8dd('0x1'));var moment=require(_0xb8dd('0x2'));var BPromise=require(_0xb8dd('0x3'));var rs=require(_0xb8dd('0x4'));var fs=require('fs');var Redis=require(_0xb8dd('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb8dd('0x6'))('rpc');var config=require(_0xb8dd('0x7'));var jayson=require(_0xb8dd('0x8'));var client=jayson['client'][_0xb8dd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f9ca0,_0x20feac,_0x4d5bcb){return new BPromise(function(_0x2a3515,_0x8b2f5e){return client['request'](_0x4f9ca0,_0x4d5bcb)['then'](function(_0x34fe4e){logger[_0xb8dd('0xa')](_0xb8dd('0xb'),_0x20feac,_0xb8dd('0xc'));logger[_0xb8dd('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x20feac,'request\x20sent',JSON[_0xb8dd('0xe')](_0x34fe4e));if(_0x34fe4e[_0xb8dd('0xf')]){if(_0x34fe4e[_0xb8dd('0xf')][_0xb8dd('0x10')]===0x1f4){logger[_0xb8dd('0xf')](_0xb8dd('0xb'),_0x20feac,_0x34fe4e[_0xb8dd('0xf')][_0xb8dd('0x11')]);return _0x8b2f5e(_0x34fe4e[_0xb8dd('0xf')]['message']);}logger['error'](_0xb8dd('0xb'),_0x20feac,_0x34fe4e['error'][_0xb8dd('0x11')]);return _0x2a3515(_0x34fe4e[_0xb8dd('0xf')][_0xb8dd('0x11')]);}else{logger[_0xb8dd('0xa')](_0xb8dd('0xb'),_0x20feac,_0xb8dd('0xc'));_0x2a3515(_0x34fe4e[_0xb8dd('0x12')][_0xb8dd('0x11')]);}})[_0xb8dd('0x13')](function(_0x218d9f){logger[_0xb8dd('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x20feac,_0x218d9f);_0x8b2f5e(_0x218d9f);});});} \ No newline at end of file +var _0x8423=['debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','request\x20sent'];(function(_0x22b53d,_0x38b652){var _0x593dee=function(_0x5cc69a){while(--_0x5cc69a){_0x22b53d['push'](_0x22b53d['shift']());}};_0x593dee(++_0x38b652);}(_0x8423,0x1ab));var _0x3842=function(_0x48c46a,_0xfe126d){_0x48c46a=_0x48c46a-0x0;var _0x465257=_0x8423[_0x48c46a];return _0x465257;};'use strict';var _=require(_0x3842('0x0'));var util=require(_0x3842('0x1'));var moment=require('moment');var BPromise=require(_0x3842('0x2'));var rs=require(_0x3842('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3842('0x4'))['db'];var utils=require(_0x3842('0x5'));var logger=require(_0x3842('0x6'))(_0x3842('0x7'));var config=require(_0x3842('0x8'));var jayson=require(_0x3842('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1ef861,_0x5a2c6e,_0x3c8051){return new BPromise(function(_0x3dfe82,_0x4f6d98){return client[_0x3842('0xa')](_0x1ef861,_0x3c8051)['then'](function(_0x225530){logger[_0x3842('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5a2c6e,_0x3842('0xc'));logger[_0x3842('0xd')](_0x3842('0xe'),_0x5a2c6e,'request\x20sent',JSON[_0x3842('0xf')](_0x225530));if(_0x225530[_0x3842('0x10')]){if(_0x225530[_0x3842('0x10')][_0x3842('0x11')]===0x1f4){logger[_0x3842('0x10')](_0x3842('0x12'),_0x5a2c6e,_0x225530['error'][_0x3842('0x13')]);return _0x4f6d98(_0x225530[_0x3842('0x10')][_0x3842('0x13')]);}logger[_0x3842('0x10')](_0x3842('0x12'),_0x5a2c6e,_0x225530[_0x3842('0x10')][_0x3842('0x13')]);return _0x3dfe82(_0x225530[_0x3842('0x10')][_0x3842('0x13')]);}else{logger['info'](_0x3842('0x12'),_0x5a2c6e,_0x3842('0xc'));_0x3dfe82(_0x225530[_0x3842('0x14')][_0x3842('0x13')]);}})[_0x3842('0x15')](function(_0x1270e4){logger['error'](_0x3842('0x12'),_0x5a2c6e,_0x1270e4);_0x4f6d98(_0x1270e4);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 33cfb94..aa8bc30 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 _0x387c=['./intSugarcrmField.controller','get','isAuthenticated','index','show','create','/:id','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4e5552,_0x19ec4e){var _0x60a338=function(_0x40c70e){while(--_0x40c70e){_0x4e5552['push'](_0x4e5552['shift']());}};_0x60a338(++_0x19ec4e);}(_0x387c,0xc6));var _0xc387=function(_0x5ce15c,_0x19c917){_0x5ce15c=_0x5ce15c-0x0;var _0x36e4f5=_0x387c[_0x5ce15c];return _0x36e4f5;};'use strict';var multer=require(_0xc387('0x0'));var util=require('util');var path=require(_0xc387('0x1'));var timeout=require('connect-timeout');var express=require(_0xc387('0x2'));var router=express[_0xc387('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc387('0x4'));var interaction=require(_0xc387('0x5'));var config=require('../../config/environment');var controller=require(_0xc387('0x6'));router[_0xc387('0x7')]('/',auth[_0xc387('0x8')](),controller[_0xc387('0x9')]);router[_0xc387('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xc387('0xa')]);router['post']('/',auth[_0xc387('0x8')](),controller[_0xc387('0xb')]);router['put'](_0xc387('0xc'),auth[_0xc387('0x8')](),controller[_0xc387('0xd')]);router[_0xc387('0xe')](_0xc387('0xc'),auth[_0xc387('0x8')](),controller[_0xc387('0xf')]);module[_0xc387('0x10')]=router; \ No newline at end of file +var _0x76c6=['show','post','put','update','multer','path','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id'];(function(_0x602739,_0x12fc9d){var _0x584ef7=function(_0x223ea5){while(--_0x223ea5){_0x602739['push'](_0x602739['shift']());}};_0x584ef7(++_0x12fc9d);}(_0x76c6,0x1d5));var _0x676c=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0x76c6[_0x238671];return _0x474844;};'use strict';var multer=require(_0x676c('0x0'));var util=require('util');var path=require(_0x676c('0x1'));var timeout=require('connect-timeout');var express=require(_0x676c('0x2'));var router=express[_0x676c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x676c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x676c('0x5'));var controller=require(_0x676c('0x6'));router[_0x676c('0x7')]('/',auth[_0x676c('0x8')](),controller[_0x676c('0x9')]);router[_0x676c('0x7')](_0x676c('0xa'),auth[_0x676c('0x8')](),controller[_0x676c('0xb')]);router[_0x676c('0xc')]('/',auth[_0x676c('0x8')](),controller['create']);router[_0x676c('0xd')](_0x676c('0xa'),auth[_0x676c('0x8')](),controller[_0x676c('0xe')]);router['delete'](_0x676c('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 05ff414..5d12cb5 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 _0x407a=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x1db920,_0x270acc){var _0x3230e0=function(_0xc60d28){while(--_0xc60d28){_0x1db920['push'](_0x1db920['shift']());}};_0x3230e0(++_0x270acc);}(_0x407a,0x127));var _0xa407=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x407a[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xa407('0x0'));module[_0xa407('0x1')]={'type':{'type':Sequelize[_0xa407('0x2')](_0xa407('0x3'),_0xa407('0x4'),_0xa407('0x5'),_0xa407('0x6'),_0xa407('0x7')),'defaultValue':_0xa407('0x3')},'content':{'type':Sequelize[_0xa407('0x8')]},'key':{'type':Sequelize[_0xa407('0x8')]},'keyType':{'type':Sequelize[_0xa407('0x2')](_0xa407('0x3'),_0xa407('0x4'),_0xa407('0x5'))},'keyContent':{'type':Sequelize[_0xa407('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa407('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa407('0x8')]}}; \ No newline at end of file +var _0x69db=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','picklist'];(function(_0xc2e46e,_0x3b979c){var _0x1a355d=function(_0x2cd000){while(--_0x2cd000){_0xc2e46e['push'](_0xc2e46e['shift']());}};_0x1a355d(++_0x3b979c);}(_0x69db,0x110));var _0xb69d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x69db[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb69d('0x0'));module[_0xb69d('0x1')]={'type':{'type':Sequelize[_0xb69d('0x2')](_0xb69d('0x3'),_0xb69d('0x4'),'customVariable',_0xb69d('0x5'),_0xb69d('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb69d('0x7')]},'key':{'type':Sequelize[_0xb69d('0x7')]},'keyType':{'type':Sequelize[_0xb69d('0x2')](_0xb69d('0x3'),_0xb69d('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb69d('0x7')]},'nameField':{'type':Sequelize[_0xb69d('0x7')]},'customField':{'type':Sequelize[_0xb69d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 0f666da..183d91a 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 _0x904d=['reject','save','update','destroy','then','sendStatus','name','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','pick','where','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','length','include','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','limit','count','set','Content-Range','apply'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x904d,0xb2));var _0xd904=function(_0x4dbcd6,_0x34326c){_0x4dbcd6=_0x4dbcd6-0x0;var _0x541e55=_0x904d[_0x4dbcd6];return _0x541e55;};'use strict';var emlformat=require(_0xd904('0x0'));var rimraf=require(_0xd904('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd904('0x2'));var rp=require(_0xd904('0x3'));var moment=require(_0xd904('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd904('0x5'));var path=require(_0xd904('0x6'));var sox=require(_0xd904('0x7'));var csv=require(_0xd904('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd904('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd904('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd904('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd904('0xb'));var authService=require(_0xd904('0xc'));var qs=require(_0xd904('0xd'));var as=require(_0xd904('0xe'));var hardwareService=require(_0xd904('0xf'));var logger=require(_0xd904('0x10'))(_0xd904('0x11'));var utils=require(_0xd904('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xd904('0x13'));var db=require(_0xd904('0x14'))['db'];function respondWithStatusCode(_0x51514c,_0x14e28a){_0x14e28a=_0x14e28a||0xcc;return function(_0xd9277d){if(_0xd9277d){return _0x51514c['sendStatus'](_0x14e28a);}return _0x51514c[_0xd904('0x15')](_0x14e28a)['end']();};}function respondWithResult(_0x1a514e,_0x580f5b){_0x580f5b=_0x580f5b||0xc8;return function(_0x5cd7cc){if(_0x5cd7cc){return _0x1a514e[_0xd904('0x15')](_0x580f5b)[_0xd904('0x16')](_0x5cd7cc);}};}function respondWithFilteredResult(_0x56e3be,_0x3d89e2){return function(_0x4ceee8){if(_0x4ceee8){var _0x4f0e73=typeof _0x3d89e2[_0xd904('0x17')]==='undefined'&&typeof _0x3d89e2[_0xd904('0x18')]==='undefined';var _0x51c54a=_0x4ceee8[_0xd904('0x19')];var _0x44db66=_0x4f0e73?0x0:_0x3d89e2[_0xd904('0x17')];var _0x40684b=_0x4f0e73?_0x4ceee8['count']:_0x3d89e2[_0xd904('0x17')]+_0x3d89e2[_0xd904('0x18')];var _0x3dafd0;if(_0x40684b>=_0x51c54a){_0x40684b=_0x51c54a;_0x3dafd0=0xc8;}else{_0x3dafd0=0xce;}_0x56e3be[_0xd904('0x15')](_0x3dafd0);return _0x56e3be[_0xd904('0x1a')](_0xd904('0x1b'),_0x44db66+'-'+_0x40684b+'/'+_0x51c54a)[_0xd904('0x16')](_0x4ceee8);}return null;};}function patchUpdates(_0x47cc26){return function(_0x27de4a){try{jsonpatch[_0xd904('0x1c')](_0x27de4a,_0x47cc26,!![]);}catch(_0x2d03bb){return BPromise[_0xd904('0x1d')](_0x2d03bb);}return _0x27de4a[_0xd904('0x1e')]();};}function saveUpdates(_0x29c869,_0x1dac1f){return function(_0x5584b9){if(_0x5584b9){return _0x5584b9[_0xd904('0x1f')](_0x29c869)['then'](function(_0x1c5f63){return _0x1c5f63;});}return null;};}function removeEntity(_0x9884f9,_0x3c695f){return function(_0x59f7b1){if(_0x59f7b1){return _0x59f7b1[_0xd904('0x20')]()[_0xd904('0x21')](function(){_0x9884f9[_0xd904('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ebf22,_0x1b0218){return function(_0x178e5c){if(!_0x178e5c){_0x3ebf22[_0xd904('0x22')](0x194);}return _0x178e5c;};}function handleError(_0x253bda,_0x136464){_0x136464=_0x136464||0x1f4;return function(_0x366393){logger['error'](_0x366393['stack']);if(_0x366393[_0xd904('0x23')]){delete _0x366393[_0xd904('0x23')];}_0x253bda[_0xd904('0x15')](_0x136464)['send'](_0x366393);};}exports[_0xd904('0x24')]=function(_0x4a53b3,_0x54ee62){var _0x393fe0={},_0x374472={},_0x104d8b={'count':0x0,'rows':[]};var _0x335dbc=_[_0xd904('0x25')](db[_0xd904('0x26')][_0xd904('0x27')],function(_0x562cc7){return{'name':_0x562cc7[_0xd904('0x28')],'type':_0x562cc7[_0xd904('0x29')][_0xd904('0x2a')]};});_0x374472[_0xd904('0x2b')]=_['map'](_0x335dbc,_0xd904('0x23'));_0x374472[_0xd904('0x2c')]=_[_0xd904('0x2d')](_0x4a53b3[_0xd904('0x2c')]);_0x374472[_0xd904('0x2e')]=_['intersection'](_0x374472[_0xd904('0x2b')],_0x374472[_0xd904('0x2c')]);_0x393fe0['attributes']=_[_0xd904('0x2f')](_0x374472['model'],qs['fields'](_0x4a53b3[_0xd904('0x2c')][_0xd904('0x30')]));_0x393fe0[_0xd904('0x31')]=_0x393fe0[_0xd904('0x31')]['length']?_0x393fe0[_0xd904('0x31')]:_0x374472['model'];if(!_0x4a53b3[_0xd904('0x2c')][_0xd904('0x32')](_0xd904('0x33'))){_0x393fe0[_0xd904('0x18')]=qs[_0xd904('0x18')](_0x4a53b3[_0xd904('0x2c')][_0xd904('0x18')]);_0x393fe0[_0xd904('0x17')]=qs[_0xd904('0x17')](_0x4a53b3[_0xd904('0x2c')][_0xd904('0x17')]);}_0x393fe0[_0xd904('0x34')]=qs['sort'](_0x4a53b3['query']['sort']);_0x393fe0['where']=qs[_0xd904('0x2e')](_[_0xd904('0x35')](_0x4a53b3['query'],_0x374472['filters']),_0x335dbc);if(_0x4a53b3['query']['filter']){_0x393fe0[_0xd904('0x36')]=_[_0xd904('0x37')](_0x393fe0[_0xd904('0x36')],{'$or':_[_0xd904('0x25')](_0x335dbc,function(_0x2a68a0){if(_0x2a68a0[_0xd904('0x29')]!==_0xd904('0x38')){var _0x30baaf={};_0x30baaf[_0x2a68a0['name']]={'$like':'%'+_0x4a53b3[_0xd904('0x2c')][_0xd904('0x39')]+'%'};return _0x30baaf;}})});}_0x393fe0=_['merge']({},_0x393fe0,_0x4a53b3[_0xd904('0x3a')]);var _0x4affde={'where':_0x393fe0[_0xd904('0x36')]};return db[_0xd904('0x26')][_0xd904('0x19')](_0x4affde)[_0xd904('0x21')](function(_0xd8c43f){_0x104d8b[_0xd904('0x19')]=_0xd8c43f;if(_0x4a53b3[_0xd904('0x2c')][_0xd904('0x3b')]){_0x393fe0['include']=[{'all':!![]}];}return db[_0xd904('0x26')]['findAll'](_0x393fe0);})[_0xd904('0x21')](function(_0x2f8219){_0x104d8b[_0xd904('0x3c')]=_0x2f8219;return _0x104d8b;})[_0xd904('0x21')](respondWithFilteredResult(_0x54ee62,_0x393fe0))[_0xd904('0x3d')](handleError(_0x54ee62,null));};exports[_0xd904('0x3e')]=function(_0x2b6585,_0x5ef08c){var _0x143094={'raw':!![],'where':{'id':_0x2b6585[_0xd904('0x3f')]['id']}},_0x2787a0={};_0x2787a0[_0xd904('0x2b')]=_['keys'](db[_0xd904('0x26')][_0xd904('0x27')]);_0x2787a0['query']=_[_0xd904('0x2d')](_0x2b6585[_0xd904('0x2c')]);_0x2787a0[_0xd904('0x2e')]=_[_0xd904('0x2f')](_0x2787a0[_0xd904('0x2b')],_0x2787a0[_0xd904('0x2c')]);_0x143094['attributes']=_[_0xd904('0x2f')](_0x2787a0[_0xd904('0x2b')],qs[_0xd904('0x30')](_0x2b6585[_0xd904('0x2c')]['fields']));_0x143094[_0xd904('0x31')]=_0x143094[_0xd904('0x31')][_0xd904('0x40')]?_0x143094[_0xd904('0x31')]:_0x2787a0[_0xd904('0x2b')];if(_0x2b6585['query'][_0xd904('0x3b')]){_0x143094[_0xd904('0x41')]=[{'all':!![]}];}_0x143094=_['merge']({},_0x143094,_0x2b6585[_0xd904('0x3a')]);return db['SugarcrmField'][_0xd904('0x42')](_0x143094)['then'](handleEntityNotFound(_0x5ef08c,null))[_0xd904('0x21')](respondWithResult(_0x5ef08c,null))[_0xd904('0x3d')](handleError(_0x5ef08c,null));};exports[_0xd904('0x43')]=function(_0x15b1de,_0x5c4fa3){return db[_0xd904('0x26')][_0xd904('0x43')](_0x15b1de['body'],{})['then'](respondWithResult(_0x5c4fa3,0xc9))[_0xd904('0x3d')](handleError(_0x5c4fa3,null));};exports['update']=function(_0x18983f,_0x103914){if(_0x18983f[_0xd904('0x44')]['id']){delete _0x18983f[_0xd904('0x44')]['id'];}return db[_0xd904('0x26')][_0xd904('0x42')]({'where':{'id':_0x18983f['params']['id']}})[_0xd904('0x21')](handleEntityNotFound(_0x103914,null))['then'](saveUpdates(_0x18983f[_0xd904('0x44')],null))[_0xd904('0x21')](respondWithResult(_0x103914,null))[_0xd904('0x3d')](handleError(_0x103914,null));};exports[_0xd904('0x20')]=function(_0x4dd7d7,_0x47b3f5){return db[_0xd904('0x26')]['find']({'where':{'id':_0x4dd7d7[_0xd904('0x3f')]['id']}})[_0xd904('0x21')](handleEntityNotFound(_0x47b3f5,null))[_0xd904('0x21')](removeEntity(_0x47b3f5,null))[_0xd904('0x3d')](handleError(_0x47b3f5,null));}; \ No newline at end of file +var _0x3f56=['then','stack','name','index','SugarcrmField','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','update'];(function(_0x2a0e80,_0x379250){var _0x5a3500=function(_0x59248f){while(--_0x59248f){_0x2a0e80['push'](_0x2a0e80['shift']());}};_0x5a3500(++_0x379250);}(_0x3f56,0xb0));var _0x63f5=function(_0xc296f2,_0x18d9e3){_0xc296f2=_0xc296f2-0x0;var _0x58336b=_0x3f56[_0xc296f2];return _0x58336b;};'use strict';var emlformat=require(_0x63f5('0x0'));var rimraf=require(_0x63f5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x63f5('0x2'));var rp=require(_0x63f5('0x3'));var moment=require('moment');var BPromise=require(_0x63f5('0x4'));var Mustache=require(_0x63f5('0x5'));var util=require(_0x63f5('0x6'));var path=require(_0x63f5('0x7'));var sox=require(_0x63f5('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x63f5('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x63f5('0xa'));var deskjs=require(_0x63f5('0xb'));var toCsv=require(_0x63f5('0xc'));var querystring=require(_0x63f5('0xd'));var Papa=require('papaparse');var Redis=require(_0x63f5('0xe'));var authService=require(_0x63f5('0xf'));var qs=require(_0x63f5('0x10'));var as=require(_0x63f5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x63f5('0x12'));var utils=require(_0x63f5('0x13'));var config=require(_0x63f5('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x63f5('0x15'))['db'];function respondWithStatusCode(_0x3d0b0a,_0x593805){_0x593805=_0x593805||0xcc;return function(_0x13d179){if(_0x13d179){return _0x3d0b0a[_0x63f5('0x16')](_0x593805);}return _0x3d0b0a['status'](_0x593805)[_0x63f5('0x17')]();};}function respondWithResult(_0x155e2e,_0x13f2b0){_0x13f2b0=_0x13f2b0||0xc8;return function(_0x569787){if(_0x569787){return _0x155e2e[_0x63f5('0x18')](_0x13f2b0)['json'](_0x569787);}};}function respondWithFilteredResult(_0x192429,_0x4802de){return function(_0x26e3c5){if(_0x26e3c5){var _0x8fa3b3=typeof _0x4802de[_0x63f5('0x19')]===_0x63f5('0x1a')&&typeof _0x4802de[_0x63f5('0x1b')]===_0x63f5('0x1a');var _0x26bc41=_0x26e3c5[_0x63f5('0x1c')];var _0x3c557e=_0x8fa3b3?0x0:_0x4802de[_0x63f5('0x19')];var _0x14de36=_0x8fa3b3?_0x26e3c5[_0x63f5('0x1c')]:_0x4802de['offset']+_0x4802de[_0x63f5('0x1b')];var _0x573a65;if(_0x14de36>=_0x26bc41){_0x14de36=_0x26bc41;_0x573a65=0xc8;}else{_0x573a65=0xce;}_0x192429[_0x63f5('0x18')](_0x573a65);return _0x192429[_0x63f5('0x1d')]('Content-Range',_0x3c557e+'-'+_0x14de36+'/'+_0x26bc41)[_0x63f5('0x1e')](_0x26e3c5);}return null;};}function patchUpdates(_0x16614f){return function(_0x25efa2){try{jsonpatch[_0x63f5('0x1f')](_0x25efa2,_0x16614f,!![]);}catch(_0xe81f27){return BPromise[_0x63f5('0x20')](_0xe81f27);}return _0x25efa2['save']();};}function saveUpdates(_0xdfa2c2,_0x2430b1){return function(_0x2c17c5){if(_0x2c17c5){return _0x2c17c5[_0x63f5('0x21')](_0xdfa2c2)['then'](function(_0x1983dd){return _0x1983dd;});}return null;};}function removeEntity(_0x24b5d3,_0x4521d4){return function(_0x5b1339){if(_0x5b1339){return _0x5b1339['destroy']()[_0x63f5('0x22')](function(){_0x24b5d3[_0x63f5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c0c2c,_0x1baaf5){return function(_0x59c1e9){if(!_0x59c1e9){_0x2c0c2c[_0x63f5('0x16')](0x194);}return _0x59c1e9;};}function handleError(_0x592b81,_0x40382c){_0x40382c=_0x40382c||0x1f4;return function(_0x2b90bb){logger['error'](_0x2b90bb[_0x63f5('0x23')]);if(_0x2b90bb[_0x63f5('0x24')]){delete _0x2b90bb[_0x63f5('0x24')];}_0x592b81['status'](_0x40382c)['send'](_0x2b90bb);};}exports[_0x63f5('0x25')]=function(_0x34924b,_0x2b9323){var _0x29d126={},_0x3db3c9={},_0x5f3c36={'count':0x0,'rows':[]};var _0x562604=_['map'](db[_0x63f5('0x26')][_0x63f5('0x27')],function(_0x3b12a1){return{'name':_0x3b12a1[_0x63f5('0x28')],'type':_0x3b12a1[_0x63f5('0x29')]['key']};});_0x3db3c9[_0x63f5('0x2a')]=_[_0x63f5('0x2b')](_0x562604,_0x63f5('0x24'));_0x3db3c9[_0x63f5('0x2c')]=_[_0x63f5('0x2d')](_0x34924b[_0x63f5('0x2c')]);_0x3db3c9[_0x63f5('0x2e')]=_[_0x63f5('0x2f')](_0x3db3c9[_0x63f5('0x2a')],_0x3db3c9[_0x63f5('0x2c')]);_0x29d126[_0x63f5('0x30')]=_[_0x63f5('0x2f')](_0x3db3c9[_0x63f5('0x2a')],qs[_0x63f5('0x31')](_0x34924b[_0x63f5('0x2c')][_0x63f5('0x31')]));_0x29d126['attributes']=_0x29d126[_0x63f5('0x30')][_0x63f5('0x32')]?_0x29d126['attributes']:_0x3db3c9[_0x63f5('0x2a')];if(!_0x34924b[_0x63f5('0x2c')][_0x63f5('0x33')]('nolimit')){_0x29d126[_0x63f5('0x1b')]=qs['limit'](_0x34924b[_0x63f5('0x2c')]['limit']);_0x29d126['offset']=qs[_0x63f5('0x19')](_0x34924b['query'][_0x63f5('0x19')]);}_0x29d126[_0x63f5('0x34')]=qs[_0x63f5('0x35')](_0x34924b[_0x63f5('0x2c')][_0x63f5('0x35')]);_0x29d126[_0x63f5('0x36')]=qs['filters'](_[_0x63f5('0x37')](_0x34924b['query'],_0x3db3c9[_0x63f5('0x2e')]),_0x562604);if(_0x34924b[_0x63f5('0x2c')]['filter']){_0x29d126[_0x63f5('0x36')]=_[_0x63f5('0x38')](_0x29d126['where'],{'$or':_[_0x63f5('0x2b')](_0x562604,function(_0x496086){if(_0x496086[_0x63f5('0x29')]!==_0x63f5('0x39')){var _0x18c90d={};_0x18c90d[_0x496086[_0x63f5('0x24')]]={'$like':'%'+_0x34924b['query'][_0x63f5('0x3a')]+'%'};return _0x18c90d;}})});}_0x29d126=_[_0x63f5('0x38')]({},_0x29d126,_0x34924b[_0x63f5('0x3b')]);var _0x2eb339={'where':_0x29d126[_0x63f5('0x36')]};return db['SugarcrmField'][_0x63f5('0x1c')](_0x2eb339)[_0x63f5('0x22')](function(_0x507099){_0x5f3c36[_0x63f5('0x1c')]=_0x507099;if(_0x34924b[_0x63f5('0x2c')][_0x63f5('0x3c')]){_0x29d126[_0x63f5('0x3d')]=[{'all':!![]}];}return db[_0x63f5('0x26')]['findAll'](_0x29d126);})[_0x63f5('0x22')](function(_0x2ae478){_0x5f3c36[_0x63f5('0x3e')]=_0x2ae478;return _0x5f3c36;})['then'](respondWithFilteredResult(_0x2b9323,_0x29d126))[_0x63f5('0x3f')](handleError(_0x2b9323,null));};exports[_0x63f5('0x40')]=function(_0x40d784,_0x48c67c){var _0x3a6498={'raw':!![],'where':{'id':_0x40d784[_0x63f5('0x41')]['id']}},_0x1e15f3={};_0x1e15f3[_0x63f5('0x2a')]=_[_0x63f5('0x2d')](db[_0x63f5('0x26')][_0x63f5('0x27')]);_0x1e15f3[_0x63f5('0x2c')]=_[_0x63f5('0x2d')](_0x40d784['query']);_0x1e15f3[_0x63f5('0x2e')]=_[_0x63f5('0x2f')](_0x1e15f3[_0x63f5('0x2a')],_0x1e15f3[_0x63f5('0x2c')]);_0x3a6498[_0x63f5('0x30')]=_[_0x63f5('0x2f')](_0x1e15f3[_0x63f5('0x2a')],qs[_0x63f5('0x31')](_0x40d784[_0x63f5('0x2c')][_0x63f5('0x31')]));_0x3a6498['attributes']=_0x3a6498['attributes']['length']?_0x3a6498[_0x63f5('0x30')]:_0x1e15f3['model'];if(_0x40d784['query'][_0x63f5('0x3c')]){_0x3a6498[_0x63f5('0x3d')]=[{'all':!![]}];}_0x3a6498=_[_0x63f5('0x38')]({},_0x3a6498,_0x40d784[_0x63f5('0x3b')]);return db[_0x63f5('0x26')][_0x63f5('0x42')](_0x3a6498)['then'](handleEntityNotFound(_0x48c67c,null))['then'](respondWithResult(_0x48c67c,null))[_0x63f5('0x3f')](handleError(_0x48c67c,null));};exports[_0x63f5('0x43')]=function(_0x4e2df5,_0x310b99){return db[_0x63f5('0x26')][_0x63f5('0x43')](_0x4e2df5[_0x63f5('0x44')],{})[_0x63f5('0x22')](respondWithResult(_0x310b99,0xc9))['catch'](handleError(_0x310b99,null));};exports[_0x63f5('0x21')]=function(_0x2a18de,_0x70f663){if(_0x2a18de[_0x63f5('0x44')]['id']){delete _0x2a18de[_0x63f5('0x44')]['id'];}return db[_0x63f5('0x26')][_0x63f5('0x42')]({'where':{'id':_0x2a18de['params']['id']}})[_0x63f5('0x22')](handleEntityNotFound(_0x70f663,null))[_0x63f5('0x22')](saveUpdates(_0x2a18de['body'],null))[_0x63f5('0x22')](respondWithResult(_0x70f663,null))[_0x63f5('0x3f')](handleError(_0x70f663,null));};exports[_0x63f5('0x45')]=function(_0x1be538,_0x4fe350){return db[_0x63f5('0x26')]['find']({'where':{'id':_0x1be538['params']['id']}})[_0x63f5('0x22')](handleEntityNotFound(_0x4fe350,null))[_0x63f5('0x22')](removeEntity(_0x4fe350,null))['catch'](handleError(_0x4fe350,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 34e9ed6..c375057 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 _0x063b=['define','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','../../config/logger','api','moment','bluebird','../../config/environment','./intSugarcrmField.attributes','exports'];(function(_0x590faa,_0x267c23){var _0x4180d7=function(_0x449c4b){while(--_0x449c4b){_0x590faa['push'](_0x590faa['shift']());}};_0x4180d7(++_0x267c23);}(_0x063b,0x159));var _0xb063=function(_0x3be8a9,_0x3bb958){_0x3be8a9=_0x3be8a9-0x0;var _0x426497=_0x063b[_0x3be8a9];return _0x426497;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb063('0x0'))(_0xb063('0x1'));var moment=require(_0xb063('0x2'));var BPromise=require(_0xb063('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb063('0x4'));var attributes=require(_0xb063('0x5'));module[_0xb063('0x6')]=function(_0x5f421b,_0x3e0833){return _0x5f421b[_0xb063('0x7')]('SugarcrmField',attributes,{'tableName':_0xb063('0x8'),'paranoid':![],'indexes':[{'name':_0xb063('0x9'),'fields':['idField',_0xb063('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xac8e=['idField','../../config/logger','api','moment','path','rimraf','../../config/environment','./intSugarcrmField.attributes','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index'];(function(_0x2cda4e,_0x4f97c1){var _0x4731e2=function(_0x1749d3){while(--_0x1749d3){_0x2cda4e['push'](_0x2cda4e['shift']());}};_0x4731e2(++_0x4f97c1);}(_0xac8e,0x12a));var _0xeac8=function(_0x126fe0,_0x121325){_0x126fe0=_0x126fe0-0x0;var _0x53a1f6=_0xac8e[_0x126fe0];return _0x53a1f6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeac8('0x0'))(_0xeac8('0x1'));var moment=require(_0xeac8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeac8('0x3'));var rimraf=require(_0xeac8('0x4'));var config=require(_0xeac8('0x5'));var attributes=require(_0xeac8('0x6'));module['exports']=function(_0x49dba9,_0x2eb32e){return _0x49dba9['define'](_0xeac8('0x7'),attributes,{'tableName':_0xeac8('0x8'),'paranoid':![],'indexes':[{'name':_0xeac8('0x9'),'fields':[_0xeac8('0xa'),'FieldId'],'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 25775c3..2305bc3 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 _0x5a7e=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','lodash','util'];(function(_0x1ffb10,_0x28ce2c){var _0x390ad0=function(_0x1d1c1c){while(--_0x1d1c1c){_0x1ffb10['push'](_0x1ffb10['shift']());}};_0x390ad0(++_0x28ce2c);}(_0x5a7e,0xcd));var _0xe5a7=function(_0x4df224,_0x31c3d6){_0x4df224=_0x4df224-0x0;var _0x3e3bcd=_0x5a7e[_0x4df224];return _0x3e3bcd;};'use strict';var _=require(_0xe5a7('0x0'));var util=require(_0xe5a7('0x1'));var moment=require(_0xe5a7('0x2'));var BPromise=require(_0xe5a7('0x3'));var rs=require(_0xe5a7('0x4'));var fs=require('fs');var Redis=require(_0xe5a7('0x5'));var db=require(_0xe5a7('0x6'))['db'];var utils=require(_0xe5a7('0x7'));var logger=require('../../config/logger')(_0xe5a7('0x8'));var config=require(_0xe5a7('0x9'));var jayson=require(_0xe5a7('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x10e47e,_0x3ac481,_0x25050a){return new BPromise(function(_0x4e799f,_0x1f2e94){return client[_0xe5a7('0xb')](_0x10e47e,_0x25050a)[_0xe5a7('0xc')](function(_0x4e1c46){logger[_0xe5a7('0xd')](_0xe5a7('0xe'),_0x3ac481,'request\x20sent');logger[_0xe5a7('0xf')](_0xe5a7('0x10'),_0x3ac481,'request\x20sent',JSON[_0xe5a7('0x11')](_0x4e1c46));if(_0x4e1c46['error']){if(_0x4e1c46['error'][_0xe5a7('0x12')]===0x1f4){logger[_0xe5a7('0x13')](_0xe5a7('0xe'),_0x3ac481,_0x4e1c46[_0xe5a7('0x13')][_0xe5a7('0x14')]);return _0x1f2e94(_0x4e1c46[_0xe5a7('0x13')]['message']);}logger[_0xe5a7('0x13')](_0xe5a7('0xe'),_0x3ac481,_0x4e1c46[_0xe5a7('0x13')][_0xe5a7('0x14')]);return _0x4e799f(_0x4e1c46['error'][_0xe5a7('0x14')]);}else{logger[_0xe5a7('0xd')](_0xe5a7('0xe'),_0x3ac481,_0xe5a7('0x15'));_0x4e799f(_0x4e1c46[_0xe5a7('0x16')][_0xe5a7('0x14')]);}})['catch'](function(_0xc05619){logger[_0xe5a7('0x13')](_0xe5a7('0xe'),_0x3ac481,_0xc05619);_0x1f2e94(_0xc05619);});});} \ No newline at end of file +var _0x2a3e=['http','then','info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x765c93,_0x3a755b){var _0x36debc=function(_0x4bbfe7){while(--_0x4bbfe7){_0x765c93['push'](_0x765c93['shift']());}};_0x36debc(++_0x3a755b);}(_0x2a3e,0x109));var _0xe2a3=function(_0x88bfa3,_0x95f7c7){_0x88bfa3=_0x88bfa3-0x0;var _0xed5ee6=_0x2a3e[_0x88bfa3];return _0xed5ee6;};'use strict';var _=require(_0xe2a3('0x0'));var util=require(_0xe2a3('0x1'));var moment=require('moment');var BPromise=require(_0xe2a3('0x2'));var rs=require(_0xe2a3('0x3'));var fs=require('fs');var Redis=require(_0xe2a3('0x4'));var db=require(_0xe2a3('0x5'))['db'];var utils=require(_0xe2a3('0x6'));var logger=require(_0xe2a3('0x7'))(_0xe2a3('0x8'));var config=require('../../config/environment');var jayson=require(_0xe2a3('0x9'));var client=jayson[_0xe2a3('0xa')][_0xe2a3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb8e563,_0x14c85a,_0x23cec3){return new BPromise(function(_0x5542f3,_0x557989){return client['request'](_0xb8e563,_0x23cec3)[_0xe2a3('0xc')](function(_0x4a275e){logger[_0xe2a3('0xd')](_0xe2a3('0xe'),_0x14c85a,'request\x20sent');logger[_0xe2a3('0xf')](_0xe2a3('0x10'),_0x14c85a,_0xe2a3('0x11'),JSON[_0xe2a3('0x12')](_0x4a275e));if(_0x4a275e[_0xe2a3('0x13')]){if(_0x4a275e[_0xe2a3('0x13')][_0xe2a3('0x14')]===0x1f4){logger[_0xe2a3('0x13')](_0xe2a3('0xe'),_0x14c85a,_0x4a275e[_0xe2a3('0x13')]['message']);return _0x557989(_0x4a275e[_0xe2a3('0x13')]['message']);}logger[_0xe2a3('0x13')](_0xe2a3('0xe'),_0x14c85a,_0x4a275e[_0xe2a3('0x13')][_0xe2a3('0x15')]);return _0x5542f3(_0x4a275e[_0xe2a3('0x13')]['message']);}else{logger[_0xe2a3('0xd')](_0xe2a3('0xe'),_0x14c85a,_0xe2a3('0x11'));_0x5542f3(_0x4a275e[_0xe2a3('0x16')][_0xe2a3('0x15')]);}})['catch'](function(_0x2f8fb3){logger[_0xe2a3('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x14c85a,_0x2f8fb3);_0x557989(_0x2f8fb3);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 29100e8..0b58a3d 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 _0xa5fd=['post','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/configurations','/:id/fields','getFields'];(function(_0xfd3905,_0x41c8b7){var _0x1fd91d=function(_0x515bb4){while(--_0x515bb4){_0xfd3905['push'](_0xfd3905['shift']());}};_0x1fd91d(++_0x41c8b7);}(_0xa5fd,0x90));var _0xda5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5fd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xda5f('0x0'));var util=require('util');var path=require(_0xda5f('0x1'));var timeout=require(_0xda5f('0x2'));var express=require(_0xda5f('0x3'));var router=express['Router']();var fs_extra=require(_0xda5f('0x4'));var auth=require(_0xda5f('0x5'));var interaction=require(_0xda5f('0x6'));var config=require(_0xda5f('0x7'));var controller=require('./intVtigerAccount.controller');router['get']('/',auth[_0xda5f('0x8')](),controller[_0xda5f('0x9')]);router[_0xda5f('0xa')](_0xda5f('0xb'),auth[_0xda5f('0x8')](),controller[_0xda5f('0xc')]);router['get'](_0xda5f('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0xda5f('0xe'),auth['isAuthenticated'](),controller[_0xda5f('0xf')]);router[_0xda5f('0x10')]('/',auth[_0xda5f('0x8')](),controller['create']);router[_0xda5f('0x10')](_0xda5f('0xd'),auth[_0xda5f('0x8')](),controller['addConfiguration']);router['put'](_0xda5f('0xb'),auth[_0xda5f('0x8')](),controller[_0xda5f('0x11')]);router[_0xda5f('0x12')]('/:id',auth[_0xda5f('0x8')](),controller[_0xda5f('0x13')]);module['exports']=router; \ No newline at end of file +var _0x34e5=['fs-extra','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','post','create','addConfiguration','put','update','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x4a3dce,_0x384a2b){var _0xf7f90c=function(_0x562d87){while(--_0x562d87){_0x4a3dce['push'](_0x4a3dce['shift']());}};_0xf7f90c(++_0x384a2b);}(_0x34e5,0x172));var _0x534e=function(_0x4ffe2e,_0x580ae9){_0x4ffe2e=_0x4ffe2e-0x0;var _0x70fec9=_0x34e5[_0x4ffe2e];return _0x70fec9;};'use strict';var multer=require('multer');var util=require(_0x534e('0x0'));var path=require('path');var timeout=require(_0x534e('0x1'));var express=require(_0x534e('0x2'));var router=express[_0x534e('0x3')]();var fs_extra=require(_0x534e('0x4'));var auth=require(_0x534e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x534e('0x6'));var controller=require(_0x534e('0x7'));router[_0x534e('0x8')]('/',auth[_0x534e('0x9')](),controller[_0x534e('0xa')]);router[_0x534e('0x8')](_0x534e('0xb'),auth['isAuthenticated'](),controller[_0x534e('0xc')]);router[_0x534e('0x8')](_0x534e('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x534e('0x8')]('/:id/fields',auth[_0x534e('0x9')](),controller['getFields']);router[_0x534e('0xe')]('/',auth[_0x534e('0x9')](),controller[_0x534e('0xf')]);router['post'](_0x534e('0xd'),auth[_0x534e('0x9')](),controller[_0x534e('0x10')]);router[_0x534e('0x11')](_0x534e('0xb'),auth['isAuthenticated'](),controller[_0x534e('0x12')]);router[_0x534e('0x13')](_0x534e('0xb'),auth[_0x534e('0x9')](),controller[_0x534e('0x14')]);module[_0x534e('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 323e3ae..1daa0f0 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 _0x1065=['sequelize','exports','STRING','HelpDesk'];(function(_0x434f67,_0x347396){var _0x5bd85e=function(_0x3cc620){while(--_0x3cc620){_0x434f67['push'](_0x434f67['shift']());}};_0x5bd85e(++_0x347396);}(_0x1065,0xec));var _0x5106=function(_0x3dd531,_0xedaa84){_0x3dd531=_0x3dd531-0x0;var _0x299141=_0x1065[_0x3dd531];return _0x299141;};'use strict';var Sequelize=require(_0x5106('0x0'));module[_0x5106('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5106('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5106('0x3')},'remoteUri':{'type':Sequelize[_0x5106('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x5106('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xba95=['sequelize','exports','STRING','HelpDesk'];(function(_0x2379bd,_0x98d1d3){var _0x51bbf1=function(_0x349f48){while(--_0x349f48){_0x2379bd['push'](_0x2379bd['shift']());}};_0x51bbf1(++_0x98d1d3);}(_0xba95,0x1d0));var _0x5ba9=function(_0x25514a,_0x3fb44d){_0x25514a=_0x25514a-0x0;var _0x510193=_0xba95[_0x25514a];return _0x510193;};'use strict';var Sequelize=require(_0x5ba9('0x0'));module[_0x5ba9('0x1')]={'name':{'type':Sequelize[_0x5ba9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5ba9('0x2')]},'username':{'type':Sequelize[_0x5ba9('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x5ba9('0x2')],'allowNull':![],'defaultValue':_0x5ba9('0x3')},'remoteUri':{'type':Sequelize[_0x5ba9('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x5ba9('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 77b2f5b..5e90866 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 _0xea34=['undefined','limit','offset','count','set','Content-Range','apply','save','then','destroy','stack','name','send','map','VtigerAccount','fieldName','model','query','keys','filters','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','merge','options','include','findAll','catch','params','rawAttributes','attributes','includeAll','create','body','update','find','getConfigurations','VtigerConfiguration','length','order','pick','addConfiguration','findOne','Subjects','getSubjects','getDescriptions','VtigerField','Descriptions','getFields','username','description','serverUrl','accessKey','moduleName','remoteUri','slice','substring','lastIndexOf','format','%s/webservice.php','getchallenge','success','POST','login','result','token','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','statusCode','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x4db2e7,_0x10db77){var _0x519ee4=function(_0x3e518c){while(--_0x3e518c){_0x4db2e7['push'](_0x4db2e7['shift']());}};_0x519ee4(++_0x10db77);}(_0xea34,0x14b));var _0x4ea3=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xea34[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0x4ea3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4ea3('0x1'));var jsonpatch=require(_0x4ea3('0x2'));var rp=require('request-promise');var moment=require(_0x4ea3('0x3'));var BPromise=require(_0x4ea3('0x4'));var Mustache=require(_0x4ea3('0x5'));var util=require('util');var path=require(_0x4ea3('0x6'));var sox=require(_0x4ea3('0x7'));var csv=require('to-csv');var ejs=require(_0x4ea3('0x8'));var fs=require('fs');var fs_extra=require(_0x4ea3('0x9'));var _=require(_0x4ea3('0xa'));var squel=require('squel');var crypto=require(_0x4ea3('0xb'));var jsforce=require(_0x4ea3('0xc'));var deskjs=require(_0x4ea3('0xd'));var toCsv=require(_0x4ea3('0xe'));var querystring=require(_0x4ea3('0xf'));var Papa=require(_0x4ea3('0x10'));var Redis=require(_0x4ea3('0x11'));var authService=require(_0x4ea3('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ea3('0x13'));var logger=require(_0x4ea3('0x14'))('api');var utils=require(_0x4ea3('0x15'));var config=require(_0x4ea3('0x16'));var licenseUtil=require(_0x4ea3('0x17'));var db=require(_0x4ea3('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xf08402,_0x2ba550){_0x2ba550=_0x2ba550||0xcc;return function(_0x2ee7d8){if(_0x2ee7d8){return _0xf08402[_0x4ea3('0x19')](_0x2ba550);}return _0xf08402[_0x4ea3('0x1a')](_0x2ba550)[_0x4ea3('0x1b')]();};}function respondWithResult(_0x468bfd,_0x582c8e){_0x582c8e=_0x582c8e||0xc8;return function(_0x2ba0ac){if(_0x2ba0ac){return _0x468bfd[_0x4ea3('0x1a')](_0x582c8e)[_0x4ea3('0x1c')](_0x2ba0ac);}};}function respondWithFilteredResult(_0x32f27f,_0x39df04){return function(_0x1f2fb3){if(_0x1f2fb3){var _0x329708=typeof _0x39df04['offset']===_0x4ea3('0x1d')&&typeof _0x39df04[_0x4ea3('0x1e')]===_0x4ea3('0x1d');var _0x2a7c76=_0x1f2fb3['count'];var _0x47cb2b=_0x329708?0x0:_0x39df04[_0x4ea3('0x1f')];var _0x559335=_0x329708?_0x1f2fb3[_0x4ea3('0x20')]:_0x39df04[_0x4ea3('0x1f')]+_0x39df04[_0x4ea3('0x1e')];var _0x245738;if(_0x559335>=_0x2a7c76){_0x559335=_0x2a7c76;_0x245738=0xc8;}else{_0x245738=0xce;}_0x32f27f[_0x4ea3('0x1a')](_0x245738);return _0x32f27f[_0x4ea3('0x21')](_0x4ea3('0x22'),_0x47cb2b+'-'+_0x559335+'/'+_0x2a7c76)[_0x4ea3('0x1c')](_0x1f2fb3);}return null;};}function patchUpdates(_0x54a4f5){return function(_0x569624){try{jsonpatch[_0x4ea3('0x23')](_0x569624,_0x54a4f5,!![]);}catch(_0x234d02){return BPromise['reject'](_0x234d02);}return _0x569624[_0x4ea3('0x24')]();};}function saveUpdates(_0x453ad2,_0x4e73dc){return function(_0x159935){if(_0x159935){return _0x159935['update'](_0x453ad2)[_0x4ea3('0x25')](function(_0x4b81cf){return _0x4b81cf;});}return null;};}function removeEntity(_0x37cac4,_0xe31c31){return function(_0x1172f7){if(_0x1172f7){return _0x1172f7[_0x4ea3('0x26')]()['then'](function(){_0x37cac4[_0x4ea3('0x1a')](0xcc)[_0x4ea3('0x1b')]();});}};}function handleEntityNotFound(_0x4ca7f7,_0x4eb3a8){return function(_0x40b7b3){if(!_0x40b7b3){_0x4ca7f7[_0x4ea3('0x19')](0x194);}return _0x40b7b3;};}function handleError(_0x38b158,_0x547b7f){_0x547b7f=_0x547b7f||0x1f4;return function(_0x5aae53){logger['error'](_0x5aae53[_0x4ea3('0x27')]);if(_0x5aae53[_0x4ea3('0x28')]){delete _0x5aae53['name'];}_0x38b158[_0x4ea3('0x1a')](_0x547b7f)[_0x4ea3('0x29')](_0x5aae53);};}exports['index']=function(_0x25eb83,_0x4051f4){var _0x1e647f={},_0x5d9984={},_0x639188={'count':0x0,'rows':[]};var _0x30aa4a=_[_0x4ea3('0x2a')](db[_0x4ea3('0x2b')]['rawAttributes'],function(_0xc0967d){return{'name':_0xc0967d[_0x4ea3('0x2c')],'type':_0xc0967d['type']['key']};});_0x5d9984[_0x4ea3('0x2d')]=_[_0x4ea3('0x2a')](_0x30aa4a,_0x4ea3('0x28'));_0x5d9984[_0x4ea3('0x2e')]=_[_0x4ea3('0x2f')](_0x25eb83[_0x4ea3('0x2e')]);_0x5d9984[_0x4ea3('0x30')]=_[_0x4ea3('0x31')](_0x5d9984['model'],_0x5d9984[_0x4ea3('0x2e')]);_0x1e647f['attributes']=_[_0x4ea3('0x31')](_0x5d9984['model'],qs[_0x4ea3('0x32')](_0x25eb83[_0x4ea3('0x2e')][_0x4ea3('0x32')]));_0x1e647f['attributes']=_0x1e647f['attributes']['length']?_0x1e647f['attributes']:_0x5d9984[_0x4ea3('0x2d')];if(!_0x25eb83[_0x4ea3('0x2e')][_0x4ea3('0x33')](_0x4ea3('0x34'))){_0x1e647f[_0x4ea3('0x1e')]=qs[_0x4ea3('0x1e')](_0x25eb83[_0x4ea3('0x2e')][_0x4ea3('0x1e')]);_0x1e647f[_0x4ea3('0x1f')]=qs[_0x4ea3('0x1f')](_0x25eb83['query']['offset']);}_0x1e647f['order']=qs['sort'](_0x25eb83[_0x4ea3('0x2e')][_0x4ea3('0x35')]);_0x1e647f[_0x4ea3('0x36')]=qs[_0x4ea3('0x30')](_['pick'](_0x25eb83[_0x4ea3('0x2e')],_0x5d9984[_0x4ea3('0x30')]),_0x30aa4a);if(_0x25eb83[_0x4ea3('0x2e')][_0x4ea3('0x37')]){_0x1e647f[_0x4ea3('0x36')]=_['merge'](_0x1e647f[_0x4ea3('0x36')],{'$or':_['map'](_0x30aa4a,function(_0x18e38a){if(_0x18e38a[_0x4ea3('0x38')]!==_0x4ea3('0x39')){var _0x287eec={};_0x287eec[_0x18e38a['name']]={'$like':'%'+_0x25eb83[_0x4ea3('0x2e')][_0x4ea3('0x37')]+'%'};return _0x287eec;}})});}_0x1e647f=_[_0x4ea3('0x3a')]({},_0x1e647f,_0x25eb83[_0x4ea3('0x3b')]);var _0x2748cc={'where':_0x1e647f[_0x4ea3('0x36')]};return db[_0x4ea3('0x2b')][_0x4ea3('0x20')](_0x2748cc)['then'](function(_0x212a23){_0x639188[_0x4ea3('0x20')]=_0x212a23;if(_0x25eb83[_0x4ea3('0x2e')]['includeAll']){_0x1e647f[_0x4ea3('0x3c')]=[{'all':!![]}];}return db[_0x4ea3('0x2b')][_0x4ea3('0x3d')](_0x1e647f);})[_0x4ea3('0x25')](function(_0x194ad3){_0x639188['rows']=_0x194ad3;return _0x639188;})[_0x4ea3('0x25')](respondWithFilteredResult(_0x4051f4,_0x1e647f))[_0x4ea3('0x3e')](handleError(_0x4051f4,null));};exports['show']=function(_0x2d54fb,_0x113d9d){var _0x5d0ccf={'raw':![],'where':{'id':_0x2d54fb[_0x4ea3('0x3f')]['id']}},_0x48e31a={};_0x48e31a['model']=_[_0x4ea3('0x2f')](db['VtigerAccount'][_0x4ea3('0x40')]);_0x48e31a[_0x4ea3('0x2e')]=_[_0x4ea3('0x2f')](_0x2d54fb[_0x4ea3('0x2e')]);_0x48e31a[_0x4ea3('0x30')]=_[_0x4ea3('0x31')](_0x48e31a[_0x4ea3('0x2d')],_0x48e31a[_0x4ea3('0x2e')]);_0x5d0ccf[_0x4ea3('0x41')]=_['intersection'](_0x48e31a[_0x4ea3('0x2d')],qs[_0x4ea3('0x32')](_0x2d54fb[_0x4ea3('0x2e')][_0x4ea3('0x32')]));_0x5d0ccf[_0x4ea3('0x41')]=_0x5d0ccf['attributes']['length']?_0x5d0ccf['attributes']:_0x48e31a[_0x4ea3('0x2d')];if(_0x2d54fb[_0x4ea3('0x2e')][_0x4ea3('0x42')]){_0x5d0ccf[_0x4ea3('0x3c')]=[{'all':!![]}];}_0x5d0ccf=_['merge']({},_0x5d0ccf,_0x2d54fb['options']);return db[_0x4ea3('0x2b')]['find'](_0x5d0ccf)[_0x4ea3('0x25')](handleEntityNotFound(_0x113d9d,null))[_0x4ea3('0x25')](respondWithResult(_0x113d9d,null))['catch'](handleError(_0x113d9d,null));};exports[_0x4ea3('0x43')]=function(_0x197c17,_0x5278c8){return db['VtigerAccount'][_0x4ea3('0x43')](_0x197c17[_0x4ea3('0x44')],{})[_0x4ea3('0x25')](respondWithResult(_0x5278c8,0xc9))[_0x4ea3('0x3e')](handleError(_0x5278c8,null));};exports[_0x4ea3('0x45')]=function(_0xd1c210,_0x59d31b){if(_0xd1c210[_0x4ea3('0x44')]['id']){delete _0xd1c210['body']['id'];}return db['VtigerAccount'][_0x4ea3('0x46')]({'where':{'id':_0xd1c210[_0x4ea3('0x3f')]['id']}})[_0x4ea3('0x25')](handleEntityNotFound(_0x59d31b,null))[_0x4ea3('0x25')](saveUpdates(_0xd1c210[_0x4ea3('0x44')],null))['then'](respondWithResult(_0x59d31b,null))[_0x4ea3('0x3e')](handleError(_0x59d31b,null));};exports[_0x4ea3('0x26')]=function(_0x450af3,_0x144815){return db[_0x4ea3('0x2b')][_0x4ea3('0x46')]({'where':{'id':_0x450af3['params']['id']}})[_0x4ea3('0x25')](handleEntityNotFound(_0x144815,null))[_0x4ea3('0x25')](removeEntity(_0x144815,null))[_0x4ea3('0x3e')](handleError(_0x144815,null));};exports[_0x4ea3('0x47')]=function(_0x4f3c6d,_0x36e2e5,_0x2e2dac){var _0x1d72a6={};var _0x349d67={};var _0x4db14a;var _0x2222ce;return db[_0x4ea3('0x2b')]['findOne']({'where':{'id':_0x4f3c6d[_0x4ea3('0x3f')]['id']}})[_0x4ea3('0x25')](handleEntityNotFound(_0x36e2e5,null))[_0x4ea3('0x25')](function(_0x22c1db){if(_0x22c1db){_0x4db14a=_0x22c1db;_0x349d67[_0x4ea3('0x2d')]=_[_0x4ea3('0x2f')](db[_0x4ea3('0x48')][_0x4ea3('0x40')]);_0x349d67[_0x4ea3('0x2e')]=_[_0x4ea3('0x2f')](_0x4f3c6d[_0x4ea3('0x2e')]);_0x349d67['filters']=_[_0x4ea3('0x31')](_0x349d67['model'],_0x349d67[_0x4ea3('0x2e')]);_0x1d72a6['attributes']=_[_0x4ea3('0x31')](_0x349d67[_0x4ea3('0x2d')],qs[_0x4ea3('0x32')](_0x4f3c6d[_0x4ea3('0x2e')][_0x4ea3('0x32')]));_0x1d72a6[_0x4ea3('0x41')]=_0x1d72a6[_0x4ea3('0x41')][_0x4ea3('0x49')]?_0x1d72a6['attributes']:_0x349d67[_0x4ea3('0x2d')];_0x1d72a6[_0x4ea3('0x4a')]=qs[_0x4ea3('0x35')](_0x4f3c6d[_0x4ea3('0x2e')][_0x4ea3('0x35')]);_0x1d72a6['where']=qs[_0x4ea3('0x30')](_[_0x4ea3('0x4b')](_0x4f3c6d[_0x4ea3('0x2e')],_0x349d67[_0x4ea3('0x30')]));if(_0x4f3c6d['query'][_0x4ea3('0x37')]){_0x1d72a6[_0x4ea3('0x36')]=_['merge'](_0x1d72a6[_0x4ea3('0x36')],{'$or':_['map'](_0x1d72a6['attributes'],function(_0x792589){var _0x66bb24={};_0x66bb24[_0x792589]={'$like':'%'+_0x4f3c6d[_0x4ea3('0x2e')][_0x4ea3('0x37')]+'%'};return _0x66bb24;})});}_0x1d72a6=_[_0x4ea3('0x3a')]({},_0x1d72a6,_0x4f3c6d[_0x4ea3('0x3b')]);return _0x4db14a[_0x4ea3('0x47')](_0x1d72a6);}})[_0x4ea3('0x25')](function(_0x2c12c6){if(_0x2c12c6){_0x2222ce=_0x2c12c6['length'];if(!_0x4f3c6d[_0x4ea3('0x2e')]['hasOwnProperty']('nolimit')){_0x1d72a6[_0x4ea3('0x1e')]=qs[_0x4ea3('0x1e')](_0x4f3c6d[_0x4ea3('0x2e')][_0x4ea3('0x1e')]);_0x1d72a6[_0x4ea3('0x1f')]=qs[_0x4ea3('0x1f')](_0x4f3c6d['query'][_0x4ea3('0x1f')]);}return _0x4db14a[_0x4ea3('0x47')](_0x1d72a6);}})[_0x4ea3('0x25')](function(_0x14c0d7){if(_0x14c0d7){return _0x14c0d7?{'count':_0x2222ce,'rows':_0x14c0d7}:null;}})[_0x4ea3('0x25')](respondWithResult(_0x36e2e5,null))['catch'](handleError(_0x36e2e5,null));};exports[_0x4ea3('0x4c')]=function(_0x1ae35f,_0x8b111a,_0x21a2a8){if(_0x1ae35f['body']['id']){delete _0x1ae35f[_0x4ea3('0x44')]['id'];}return db[_0x4ea3('0x2b')][_0x4ea3('0x4d')]({'where':{'id':_0x1ae35f['params']['id']}})['then'](handleEntityNotFound(_0x8b111a,null))['then'](function(_0x2e435d){if(_0x2e435d){_0x1ae35f['body']['AccountId']=_0x2e435d['id'];_0x1ae35f[_0x4ea3('0x44')][_0x4ea3('0x4e')]=integrations[_0x4ea3('0x4f')](_0x1ae35f['body']['channel'],_0x1ae35f[_0x4ea3('0x44')][_0x4ea3('0x38')]);_0x1ae35f[_0x4ea3('0x44')]['Descriptions']=integrations[_0x4ea3('0x50')](_0x1ae35f['body']['channel'],_0x1ae35f['body'][_0x4ea3('0x38')]);return db[_0x4ea3('0x48')]['create'](_0x1ae35f[_0x4ea3('0x44')],{'include':[{'model':db['VtigerField'],'as':_0x4ea3('0x4e')},{'model':db[_0x4ea3('0x51')],'as':_0x4ea3('0x52')}]});}return null;})['then'](respondWithResult(_0x8b111a,null))[_0x4ea3('0x3e')](handleError(_0x8b111a,null));};var md5=require('md5');exports[_0x4ea3('0x53')]=function(_0x5db9a2,_0x2bcc62,_0x5e9604){var _0x1082af=null;var _0x252369=null;var _0x525eab=null;var _0x35f491=null;var _0x9bc524='';return db[_0x4ea3('0x2b')]['findOne']({'where':{'id':_0x5db9a2[_0x4ea3('0x3f')]['id']},'attributes':['id',_0x4ea3('0x28'),_0x4ea3('0x54'),_0x4ea3('0x55'),'moduleName','remoteUri',_0x4ea3('0x56'),_0x4ea3('0x57')]})[_0x4ea3('0x25')](handleEntityNotFound(_0x2bcc62,null))[_0x4ea3('0x25')](function(_0x5cade0){if(_0x5cade0){_0x1082af=_0x5cade0[_0x4ea3('0x54')];_0x252369=_0x5cade0[_0x4ea3('0x57')];_0x525eab=_0x5cade0[_0x4ea3('0x58')];_0x9bc524=_0x5cade0[_0x4ea3('0x59')];var _0x374ed1=_0x9bc524[_0x4ea3('0x5a')](-0x1);if(_0x374ed1==='/'){_0x9bc524=_0x9bc524[_0x4ea3('0x5b')](0x0,_0x9bc524[_0x4ea3('0x5c')](_0x374ed1));}_0x35f491=util[_0x4ea3('0x5d')](_0x4ea3('0x5e'),_0x9bc524);var _0x1d898b={'method':'GET','uri':_0x35f491,'qs':{'operation':_0x4ea3('0x5f'),'username':_0x5cade0['username']},'json':!![]};return rp(_0x1d898b);}})[_0x4ea3('0x25')](function(_0x32a82f){if(_0x32a82f[_0x4ea3('0x60')]){var _0x101777={'method':_0x4ea3('0x61'),'uri':_0x35f491,'form':{'operation':_0x4ea3('0x62'),'username':_0x1082af,'accessKey':md5(_0x32a82f[_0x4ea3('0x63')][_0x4ea3('0x64')]+_0x252369)},'json':!![]};return rp(_0x101777);}})[_0x4ea3('0x25')](function(_0x53f047){if(_0x53f047['success']){var _0x4b9233={'method':'GET','uri':_0x35f491,'qs':{'operation':_0x4ea3('0x65'),'username':_0x1082af,'sessionName':_0x53f047[_0x4ea3('0x63')][_0x4ea3('0x66')],'elementType':_0x525eab},'json':!![]};return rp(_0x4b9233);}})['then'](function(_0x2c4642){if(_0x2c4642[_0x4ea3('0x60')]){var _0x397e48=[_0x4ea3('0x67'),_0x4ea3('0x68'),_0x4ea3('0x69')];_[_0x4ea3('0x6a')](_0x2c4642['result'][_0x4ea3('0x32')],function(_0x1b7259){return _0x397e48[_0x4ea3('0x6b')](_0x1b7259[_0x4ea3('0x38')][_0x4ea3('0x28')]);});_[_0x4ea3('0x6a')](_0x2c4642[_0x4ea3('0x63')][_0x4ea3('0x32')],function(_0x505325){return _0x505325[_0x4ea3('0x6c')]===_0x4ea3('0x6d');});return{'count':_0x2c4642['result']['fields'][_0x4ea3('0x49')],'rows':_[_0x4ea3('0x2a')](_0x2c4642[_0x4ea3('0x63')]['fields'],function(_0x17eda1){return{'id':_0x17eda1[_0x4ea3('0x28')],'name':_0x17eda1[_0x4ea3('0x6e')],'custom':_[_0x4ea3('0x6f')](_0x17eda1[_0x4ea3('0x28')],_0x4ea3('0x70'))?!![]:![],'options':_0x17eda1[_0x4ea3('0x38')][_0x4ea3('0x28')]===_0x4ea3('0x71')&&_0x17eda1['type'][_0x4ea3('0x72')][_0x4ea3('0x49')]>0x0?_[_0x4ea3('0x2a')](_0x17eda1[_0x4ea3('0x38')][_0x4ea3('0x72')],function(_0x47e7e6){return{'name':_0x47e7e6[_0x4ea3('0x6e')],'value':_0x47e7e6['value']};}):[]};})};}})['then'](respondWithResult(_0x2bcc62,null))['catch'](function(_0x18e56a){console[_0x4ea3('0x73')](_0x4ea3('0x74')+_0x18e56a);var _0x12f03c=_0x5db9a2[_0x4ea3('0x2e')][_0x4ea3('0x75')]?0x1f4:_0x18e56a[_0x4ea3('0x76')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x4ea3('0x53'),_0x12f03c,JSON['stringify'](_0x18e56a));delete _0x18e56a[_0x4ea3('0x28')];if(_0x12f03c===0x191){_0x12f03c=0x190;}_0x2bcc62[_0x4ea3('0x1a')](_0x12f03c)['send'](_0x5db9a2['query'][_0x4ea3('0x75')]?{'message':_0x4ea3('0x77'),'statusCode':_0x18e56a[_0x4ea3('0x76')]}:_0x18e56a);});}; \ No newline at end of file +var _0xf9bc=['query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','rows','catch','show','params','include','options','find','create','body','getConfigurations','VtigerConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','VtigerField','Descriptions','md5','findOne','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','GET','success','POST','login','result','token','describe','sessionName','reference','owner','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','statusCode','eml-format','rimraf','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','VtigerAccount','rawAttributes','fieldName','type','key','map'];(function(_0x396907,_0x5ef522){var _0x2a98ea=function(_0x937eab){while(--_0x937eab){_0x396907['push'](_0x396907['shift']());}};_0x2a98ea(++_0x5ef522);}(_0xf9bc,0xbe));var _0xcf9b=function(_0x2b62e7,_0x5ae3b0){_0x2b62e7=_0x2b62e7-0x0;var _0x186a41=_0xf9bc[_0x2b62e7];return _0x186a41;};'use strict';var emlformat=require(_0xcf9b('0x0'));var rimraf=require(_0xcf9b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcf9b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcf9b('0x3'));var Mustache=require(_0xcf9b('0x4'));var util=require('util');var path=require('path');var sox=require(_0xcf9b('0x5'));var csv=require(_0xcf9b('0x6'));var ejs=require(_0xcf9b('0x7'));var fs=require('fs');var fs_extra=require(_0xcf9b('0x8'));var _=require(_0xcf9b('0x9'));var squel=require(_0xcf9b('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcf9b('0xb'));var toCsv=require(_0xcf9b('0x6'));var querystring=require('querystring');var Papa=require(_0xcf9b('0xc'));var Redis=require(_0xcf9b('0xd'));var authService=require(_0xcf9b('0xe'));var qs=require(_0xcf9b('0xf'));var as=require(_0xcf9b('0x10'));var hardwareService=require(_0xcf9b('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcf9b('0x12'))['db'];var integrations=require(_0xcf9b('0x13'));function respondWithStatusCode(_0x1f4463,_0x1050e2){_0x1050e2=_0x1050e2||0xcc;return function(_0x37e474){if(_0x37e474){return _0x1f4463[_0xcf9b('0x14')](_0x1050e2);}return _0x1f4463[_0xcf9b('0x15')](_0x1050e2)[_0xcf9b('0x16')]();};}function respondWithResult(_0x242c78,_0x5744cb){_0x5744cb=_0x5744cb||0xc8;return function(_0x1aa758){if(_0x1aa758){return _0x242c78[_0xcf9b('0x15')](_0x5744cb)['json'](_0x1aa758);}};}function respondWithFilteredResult(_0x22c974,_0x2c0cf1){return function(_0x1a1fab){if(_0x1a1fab){var _0x516639=typeof _0x2c0cf1[_0xcf9b('0x17')]===_0xcf9b('0x18')&&typeof _0x2c0cf1[_0xcf9b('0x19')]===_0xcf9b('0x18');var _0x316547=_0x1a1fab['count'];var _0x5885ac=_0x516639?0x0:_0x2c0cf1['offset'];var _0x1c987a=_0x516639?_0x1a1fab['count']:_0x2c0cf1['offset']+_0x2c0cf1[_0xcf9b('0x19')];var _0x17c1b0;if(_0x1c987a>=_0x316547){_0x1c987a=_0x316547;_0x17c1b0=0xc8;}else{_0x17c1b0=0xce;}_0x22c974[_0xcf9b('0x15')](_0x17c1b0);return _0x22c974[_0xcf9b('0x1a')](_0xcf9b('0x1b'),_0x5885ac+'-'+_0x1c987a+'/'+_0x316547)[_0xcf9b('0x1c')](_0x1a1fab);}return null;};}function patchUpdates(_0x1e1f9c){return function(_0x319cc4){try{jsonpatch[_0xcf9b('0x1d')](_0x319cc4,_0x1e1f9c,!![]);}catch(_0x19ca39){return BPromise[_0xcf9b('0x1e')](_0x19ca39);}return _0x319cc4[_0xcf9b('0x1f')]();};}function saveUpdates(_0x52f52c,_0x37eb40){return function(_0x17ea7b){if(_0x17ea7b){return _0x17ea7b[_0xcf9b('0x20')](_0x52f52c)[_0xcf9b('0x21')](function(_0x308e3c){return _0x308e3c;});}return null;};}function removeEntity(_0xe6cd04,_0x549b7d){return function(_0x337c29){if(_0x337c29){return _0x337c29[_0xcf9b('0x22')]()[_0xcf9b('0x21')](function(){_0xe6cd04[_0xcf9b('0x15')](0xcc)[_0xcf9b('0x16')]();});}};}function handleEntityNotFound(_0x595616,_0x130529){return function(_0x2f4f6b){if(!_0x2f4f6b){_0x595616['sendStatus'](0x194);}return _0x2f4f6b;};}function handleError(_0x31cddf,_0x31afe9){_0x31afe9=_0x31afe9||0x1f4;return function(_0x37e61b){logger[_0xcf9b('0x23')](_0x37e61b[_0xcf9b('0x24')]);if(_0x37e61b[_0xcf9b('0x25')]){delete _0x37e61b[_0xcf9b('0x25')];}_0x31cddf['status'](_0x31afe9)[_0xcf9b('0x26')](_0x37e61b);};}exports[_0xcf9b('0x27')]=function(_0x389163,_0x2d49cf){var _0x36d5e8={},_0x1124e0={},_0x28d683={'count':0x0,'rows':[]};var _0x21bd4c=_['map'](db[_0xcf9b('0x28')][_0xcf9b('0x29')],function(_0x2fea9c){return{'name':_0x2fea9c[_0xcf9b('0x2a')],'type':_0x2fea9c[_0xcf9b('0x2b')][_0xcf9b('0x2c')]};});_0x1124e0['model']=_[_0xcf9b('0x2d')](_0x21bd4c,_0xcf9b('0x25'));_0x1124e0[_0xcf9b('0x2e')]=_[_0xcf9b('0x2f')](_0x389163[_0xcf9b('0x2e')]);_0x1124e0[_0xcf9b('0x30')]=_[_0xcf9b('0x31')](_0x1124e0[_0xcf9b('0x32')],_0x1124e0[_0xcf9b('0x2e')]);_0x36d5e8[_0xcf9b('0x33')]=_[_0xcf9b('0x31')](_0x1124e0[_0xcf9b('0x32')],qs['fields'](_0x389163[_0xcf9b('0x2e')][_0xcf9b('0x34')]));_0x36d5e8[_0xcf9b('0x33')]=_0x36d5e8[_0xcf9b('0x33')][_0xcf9b('0x35')]?_0x36d5e8[_0xcf9b('0x33')]:_0x1124e0[_0xcf9b('0x32')];if(!_0x389163['query'][_0xcf9b('0x36')](_0xcf9b('0x37'))){_0x36d5e8['limit']=qs[_0xcf9b('0x19')](_0x389163[_0xcf9b('0x2e')][_0xcf9b('0x19')]);_0x36d5e8[_0xcf9b('0x17')]=qs[_0xcf9b('0x17')](_0x389163[_0xcf9b('0x2e')][_0xcf9b('0x17')]);}_0x36d5e8[_0xcf9b('0x38')]=qs['sort'](_0x389163[_0xcf9b('0x2e')][_0xcf9b('0x39')]);_0x36d5e8[_0xcf9b('0x3a')]=qs[_0xcf9b('0x30')](_[_0xcf9b('0x3b')](_0x389163['query'],_0x1124e0[_0xcf9b('0x30')]),_0x21bd4c);if(_0x389163[_0xcf9b('0x2e')][_0xcf9b('0x3c')]){_0x36d5e8['where']=_[_0xcf9b('0x3d')](_0x36d5e8[_0xcf9b('0x3a')],{'$or':_['map'](_0x21bd4c,function(_0x4ee2c4){if(_0x4ee2c4[_0xcf9b('0x2b')]!==_0xcf9b('0x3e')){var _0x7b39e8={};_0x7b39e8[_0x4ee2c4['name']]={'$like':'%'+_0x389163['query'][_0xcf9b('0x3c')]+'%'};return _0x7b39e8;}})});}_0x36d5e8=_[_0xcf9b('0x3d')]({},_0x36d5e8,_0x389163['options']);var _0x585096={'where':_0x36d5e8[_0xcf9b('0x3a')]};return db[_0xcf9b('0x28')][_0xcf9b('0x3f')](_0x585096)[_0xcf9b('0x21')](function(_0x2dcd6e){_0x28d683[_0xcf9b('0x3f')]=_0x2dcd6e;if(_0x389163[_0xcf9b('0x2e')][_0xcf9b('0x40')]){_0x36d5e8['include']=[{'all':!![]}];}return db[_0xcf9b('0x28')]['findAll'](_0x36d5e8);})[_0xcf9b('0x21')](function(_0x225da6){_0x28d683[_0xcf9b('0x41')]=_0x225da6;return _0x28d683;})['then'](respondWithFilteredResult(_0x2d49cf,_0x36d5e8))[_0xcf9b('0x42')](handleError(_0x2d49cf,null));};exports[_0xcf9b('0x43')]=function(_0x391276,_0x26394e){var _0xfd5cb3={'raw':![],'where':{'id':_0x391276[_0xcf9b('0x44')]['id']}},_0xd22eda={};_0xd22eda['model']=_[_0xcf9b('0x2f')](db[_0xcf9b('0x28')][_0xcf9b('0x29')]);_0xd22eda[_0xcf9b('0x2e')]=_['keys'](_0x391276[_0xcf9b('0x2e')]);_0xd22eda[_0xcf9b('0x30')]=_[_0xcf9b('0x31')](_0xd22eda[_0xcf9b('0x32')],_0xd22eda['query']);_0xfd5cb3['attributes']=_[_0xcf9b('0x31')](_0xd22eda[_0xcf9b('0x32')],qs[_0xcf9b('0x34')](_0x391276[_0xcf9b('0x2e')][_0xcf9b('0x34')]));_0xfd5cb3[_0xcf9b('0x33')]=_0xfd5cb3[_0xcf9b('0x33')]['length']?_0xfd5cb3['attributes']:_0xd22eda[_0xcf9b('0x32')];if(_0x391276[_0xcf9b('0x2e')][_0xcf9b('0x40')]){_0xfd5cb3[_0xcf9b('0x45')]=[{'all':!![]}];}_0xfd5cb3=_[_0xcf9b('0x3d')]({},_0xfd5cb3,_0x391276[_0xcf9b('0x46')]);return db[_0xcf9b('0x28')][_0xcf9b('0x47')](_0xfd5cb3)[_0xcf9b('0x21')](handleEntityNotFound(_0x26394e,null))[_0xcf9b('0x21')](respondWithResult(_0x26394e,null))[_0xcf9b('0x42')](handleError(_0x26394e,null));};exports[_0xcf9b('0x48')]=function(_0x4a46d9,_0x19a703){return db[_0xcf9b('0x28')][_0xcf9b('0x48')](_0x4a46d9['body'],{})[_0xcf9b('0x21')](respondWithResult(_0x19a703,0xc9))[_0xcf9b('0x42')](handleError(_0x19a703,null));};exports[_0xcf9b('0x20')]=function(_0x305eca,_0x5f3541){if(_0x305eca[_0xcf9b('0x49')]['id']){delete _0x305eca[_0xcf9b('0x49')]['id'];}return db[_0xcf9b('0x28')]['find']({'where':{'id':_0x305eca[_0xcf9b('0x44')]['id']}})[_0xcf9b('0x21')](handleEntityNotFound(_0x5f3541,null))[_0xcf9b('0x21')](saveUpdates(_0x305eca['body'],null))[_0xcf9b('0x21')](respondWithResult(_0x5f3541,null))['catch'](handleError(_0x5f3541,null));};exports[_0xcf9b('0x22')]=function(_0x4895f1,_0x1055a8){return db[_0xcf9b('0x28')][_0xcf9b('0x47')]({'where':{'id':_0x4895f1[_0xcf9b('0x44')]['id']}})[_0xcf9b('0x21')](handleEntityNotFound(_0x1055a8,null))[_0xcf9b('0x21')](removeEntity(_0x1055a8,null))[_0xcf9b('0x42')](handleError(_0x1055a8,null));};exports[_0xcf9b('0x4a')]=function(_0x42fc9b,_0x21f700,_0x32b707){var _0x2f0e75={};var _0x30c83e={};var _0x5f5df8;var _0x4cf92b;return db[_0xcf9b('0x28')]['findOne']({'where':{'id':_0x42fc9b[_0xcf9b('0x44')]['id']}})[_0xcf9b('0x21')](handleEntityNotFound(_0x21f700,null))[_0xcf9b('0x21')](function(_0x1b2f8a){if(_0x1b2f8a){_0x5f5df8=_0x1b2f8a;_0x30c83e['model']=_[_0xcf9b('0x2f')](db[_0xcf9b('0x4b')]['rawAttributes']);_0x30c83e[_0xcf9b('0x2e')]=_[_0xcf9b('0x2f')](_0x42fc9b[_0xcf9b('0x2e')]);_0x30c83e[_0xcf9b('0x30')]=_[_0xcf9b('0x31')](_0x30c83e['model'],_0x30c83e[_0xcf9b('0x2e')]);_0x2f0e75['attributes']=_[_0xcf9b('0x31')](_0x30c83e[_0xcf9b('0x32')],qs['fields'](_0x42fc9b[_0xcf9b('0x2e')]['fields']));_0x2f0e75[_0xcf9b('0x33')]=_0x2f0e75[_0xcf9b('0x33')][_0xcf9b('0x35')]?_0x2f0e75[_0xcf9b('0x33')]:_0x30c83e['model'];_0x2f0e75[_0xcf9b('0x38')]=qs[_0xcf9b('0x39')](_0x42fc9b[_0xcf9b('0x2e')][_0xcf9b('0x39')]);_0x2f0e75['where']=qs[_0xcf9b('0x30')](_[_0xcf9b('0x3b')](_0x42fc9b[_0xcf9b('0x2e')],_0x30c83e['filters']));if(_0x42fc9b[_0xcf9b('0x2e')][_0xcf9b('0x3c')]){_0x2f0e75[_0xcf9b('0x3a')]=_['merge'](_0x2f0e75[_0xcf9b('0x3a')],{'$or':_[_0xcf9b('0x2d')](_0x2f0e75[_0xcf9b('0x33')],function(_0x11d5df){var _0x49363e={};_0x49363e[_0x11d5df]={'$like':'%'+_0x42fc9b[_0xcf9b('0x2e')][_0xcf9b('0x3c')]+'%'};return _0x49363e;})});}_0x2f0e75=_[_0xcf9b('0x3d')]({},_0x2f0e75,_0x42fc9b[_0xcf9b('0x46')]);return _0x5f5df8[_0xcf9b('0x4a')](_0x2f0e75);}})[_0xcf9b('0x21')](function(_0x16649f){if(_0x16649f){_0x4cf92b=_0x16649f[_0xcf9b('0x35')];if(!_0x42fc9b[_0xcf9b('0x2e')][_0xcf9b('0x36')](_0xcf9b('0x37'))){_0x2f0e75[_0xcf9b('0x19')]=qs[_0xcf9b('0x19')](_0x42fc9b[_0xcf9b('0x2e')][_0xcf9b('0x19')]);_0x2f0e75[_0xcf9b('0x17')]=qs['offset'](_0x42fc9b[_0xcf9b('0x2e')]['offset']);}return _0x5f5df8[_0xcf9b('0x4a')](_0x2f0e75);}})['then'](function(_0x514fc6){if(_0x514fc6){return _0x514fc6?{'count':_0x4cf92b,'rows':_0x514fc6}:null;}})[_0xcf9b('0x21')](respondWithResult(_0x21f700,null))[_0xcf9b('0x42')](handleError(_0x21f700,null));};exports[_0xcf9b('0x4c')]=function(_0x3be360,_0x2baf6a,_0x572c59){if(_0x3be360[_0xcf9b('0x49')]['id']){delete _0x3be360[_0xcf9b('0x49')]['id'];}return db[_0xcf9b('0x28')]['findOne']({'where':{'id':_0x3be360[_0xcf9b('0x44')]['id']}})[_0xcf9b('0x21')](handleEntityNotFound(_0x2baf6a,null))[_0xcf9b('0x21')](function(_0x181356){if(_0x181356){_0x3be360['body'][_0xcf9b('0x4d')]=_0x181356['id'];_0x3be360[_0xcf9b('0x49')][_0xcf9b('0x4e')]=integrations[_0xcf9b('0x4f')](_0x3be360[_0xcf9b('0x49')]['channel'],_0x3be360[_0xcf9b('0x49')]['type']);_0x3be360['body']['Descriptions']=integrations['getDescriptions'](_0x3be360['body'][_0xcf9b('0x50')],_0x3be360[_0xcf9b('0x49')][_0xcf9b('0x2b')]);return db[_0xcf9b('0x4b')][_0xcf9b('0x48')](_0x3be360[_0xcf9b('0x49')],{'include':[{'model':db[_0xcf9b('0x51')],'as':_0xcf9b('0x4e')},{'model':db[_0xcf9b('0x51')],'as':_0xcf9b('0x52')}]});}return null;})[_0xcf9b('0x21')](respondWithResult(_0x2baf6a,null))['catch'](handleError(_0x2baf6a,null));};var md5=require(_0xcf9b('0x53'));exports['getFields']=function(_0x275af1,_0x3bbd38,_0x593499){var _0x25e4f3=null;var _0x191e35=null;var _0x3846e7=null;var _0x26e32f=null;var _0x5eec07='';return db['VtigerAccount'][_0xcf9b('0x54')]({'where':{'id':_0x275af1[_0xcf9b('0x44')]['id']},'attributes':['id',_0xcf9b('0x25'),_0xcf9b('0x55'),_0xcf9b('0x56'),_0xcf9b('0x57'),_0xcf9b('0x58'),_0xcf9b('0x59'),_0xcf9b('0x5a')]})[_0xcf9b('0x21')](handleEntityNotFound(_0x3bbd38,null))[_0xcf9b('0x21')](function(_0x25083c){if(_0x25083c){_0x25e4f3=_0x25083c[_0xcf9b('0x55')];_0x191e35=_0x25083c['accessKey'];_0x3846e7=_0x25083c[_0xcf9b('0x57')];_0x5eec07=_0x25083c[_0xcf9b('0x58')];var _0x232fee=_0x5eec07[_0xcf9b('0x5b')](-0x1);if(_0x232fee==='/'){_0x5eec07=_0x5eec07[_0xcf9b('0x5c')](0x0,_0x5eec07['lastIndexOf'](_0x232fee));}_0x26e32f=util['format']('%s/webservice.php',_0x5eec07);var _0x553d0f={'method':_0xcf9b('0x5d'),'uri':_0x26e32f,'qs':{'operation':'getchallenge','username':_0x25083c['username']},'json':!![]};return rp(_0x553d0f);}})['then'](function(_0x2708a7){if(_0x2708a7[_0xcf9b('0x5e')]){var _0x25d2b4={'method':_0xcf9b('0x5f'),'uri':_0x26e32f,'form':{'operation':_0xcf9b('0x60'),'username':_0x25e4f3,'accessKey':md5(_0x2708a7[_0xcf9b('0x61')][_0xcf9b('0x62')]+_0x191e35)},'json':!![]};return rp(_0x25d2b4);}})[_0xcf9b('0x21')](function(_0x28e2f9){if(_0x28e2f9[_0xcf9b('0x5e')]){var _0xdf39a0={'method':_0xcf9b('0x5d'),'uri':_0x26e32f,'qs':{'operation':_0xcf9b('0x63'),'username':_0x25e4f3,'sessionName':_0x28e2f9[_0xcf9b('0x61')][_0xcf9b('0x64')],'elementType':_0x3846e7},'json':!![]};return rp(_0xdf39a0);}})['then'](function(_0x3b43a5){if(_0x3b43a5[_0xcf9b('0x5e')]){var _0x27efe5=['autogenerated',_0xcf9b('0x65'),_0xcf9b('0x66')];_[_0xcf9b('0x67')](_0x3b43a5[_0xcf9b('0x61')][_0xcf9b('0x34')],function(_0x59fbaf){return _0x27efe5['includes'](_0x59fbaf[_0xcf9b('0x2b')][_0xcf9b('0x25')]);});_[_0xcf9b('0x67')](_0x3b43a5[_0xcf9b('0x61')]['fields'],function(_0x343b3c){return _0x343b3c[_0xcf9b('0x68')]===_0xcf9b('0x69');});return{'count':_0x3b43a5[_0xcf9b('0x61')][_0xcf9b('0x34')]['length'],'rows':_[_0xcf9b('0x2d')](_0x3b43a5['result']['fields'],function(_0x4790aa){return{'id':_0x4790aa[_0xcf9b('0x25')],'name':_0x4790aa[_0xcf9b('0x6a')],'custom':_[_0xcf9b('0x6b')](_0x4790aa[_0xcf9b('0x25')],_0xcf9b('0x6c'))?!![]:![],'options':_0x4790aa[_0xcf9b('0x2b')][_0xcf9b('0x25')]===_0xcf9b('0x6d')&&_0x4790aa[_0xcf9b('0x2b')]['picklistValues'][_0xcf9b('0x35')]>0x0?_['map'](_0x4790aa[_0xcf9b('0x2b')][_0xcf9b('0x6e')],function(_0x38cb27){return{'name':_0x38cb27['label'],'value':_0x38cb27['value']};}):[]};})};}})['then'](respondWithResult(_0x3bbd38,null))[_0xcf9b('0x42')](function(_0xf13261){console[_0xcf9b('0x6f')](_0xcf9b('0x70')+_0xf13261);var _0x4b0fe3=_0x275af1[_0xcf9b('0x2e')][_0xcf9b('0x71')]?0x1f4:_0xf13261['statusCode']||0x1f4;logger[_0xcf9b('0x23')](_0xcf9b('0x72'),_0xcf9b('0x73'),_0x4b0fe3,JSON[_0xcf9b('0x74')](_0xf13261));delete _0xf13261[_0xcf9b('0x25')];if(_0x4b0fe3===0x191){_0x4b0fe3=0x190;}_0x3bbd38['status'](_0x4b0fe3)[_0xcf9b('0x26')](_0x275af1[_0xcf9b('0x2e')][_0xcf9b('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0xf13261[_0xcf9b('0x75')]}:_0xf13261);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index b266bae..69e0f3d 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 _0xa52d=['../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','util','../../config/logger','moment','path','rimraf','../../config/environment','./intVtigerAccount.attributes'];(function(_0x41ff52,_0x327e2b){var _0x2e859e=function(_0x49b84c){while(--_0x49b84c){_0x41ff52['push'](_0x41ff52['shift']());}};_0x2e859e(++_0x327e2b);}(_0xa52d,0xad));var _0xda52=function(_0x28b0a1,_0x99bd0a){_0x28b0a1=_0x28b0a1-0x0;var _0x21470c=_0xa52d[_0x28b0a1];return _0x21470c;};'use strict';var _=require('lodash');var util=require(_0xda52('0x0'));var logger=require(_0xda52('0x1'))('api');var moment=require(_0xda52('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xda52('0x3'));var rimraf=require(_0xda52('0x4'));var config=require(_0xda52('0x5'));var attributes=require(_0xda52('0x6'));var integrations=require(_0xda52('0x7'));module[_0xda52('0x8')]=function(_0xda7cd9,_0x208eaf){return _0xda7cd9[_0xda52('0x9')](_0xda52('0xa'),attributes,{'tableName':_0xda52('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5316=['api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x5316,0x1bf));var _0x6531=function(_0x272ea6,_0x3f0673){_0x272ea6=_0x272ea6-0x0;var _0x43ef03=_0x5316[_0x272ea6];return _0x43ef03;};'use strict';var _=require(_0x6531('0x0'));var util=require(_0x6531('0x1'));var logger=require(_0x6531('0x2'))(_0x6531('0x3'));var moment=require(_0x6531('0x4'));var BPromise=require(_0x6531('0x5'));var rp=require(_0x6531('0x6'));var fs=require('fs');var path=require(_0x6531('0x7'));var rimraf=require('rimraf');var config=require(_0x6531('0x8'));var attributes=require(_0x6531('0x9'));var integrations=require(_0x6531('0xa'));module[_0x6531('0xb')]=function(_0x319587,_0x7b9752){return _0x319587[_0x6531('0xc')](_0x6531('0xd'),attributes,{'tableName':_0x6531('0xe'),'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 9338480..cee04a2 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 _0xb58b=['model','map','debug','catch','ShowVtigerAccount','find','where','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','attributes','limit','include'];(function(_0x2085f3,_0x50105b){var _0x384e3c=function(_0x235fa0){while(--_0x235fa0){_0x2085f3['push'](_0x2085f3['shift']());}};_0x384e3c(++_0x50105b);}(_0xb58b,0x1f1));var _0xbb58=function(_0x3e6406,_0x597408){_0x3e6406=_0x3e6406-0x0;var _0x508ec7=_0xb58b[_0x3e6406];return _0x508ec7;};'use strict';var _=require('lodash');var util=require(_0xbb58('0x0'));var moment=require(_0xbb58('0x1'));var BPromise=require(_0xbb58('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb58('0x3'));var db=require(_0xbb58('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb58('0x5'))('rpc');var config=require(_0xbb58('0x6'));var jayson=require(_0xbb58('0x7'));var client=jayson[_0xbb58('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27cbda,_0x323066,_0xe874f2){return new BPromise(function(_0x5d7fe8,_0xd94f1){return client[_0xbb58('0x9')](_0x27cbda,_0xe874f2)[_0xbb58('0xa')](function(_0x36ca50){logger[_0xbb58('0xb')](_0xbb58('0xc'),_0x323066,_0xbb58('0xd'));logger['debug'](_0xbb58('0xe'),_0x323066,'request\x20sent',JSON[_0xbb58('0xf')](_0x36ca50));if(_0x36ca50[_0xbb58('0x10')]){if(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x11')]===0x1f4){logger['error'](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0xd94f1(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}logger[_0xbb58('0x10')](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0x5d7fe8(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x323066,_0xbb58('0xd'));_0x5d7fe8(_0x36ca50[_0xbb58('0x13')][_0xbb58('0x12')]);}})['catch'](function(_0x5edc97){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x323066,_0x5edc97);_0xd94f1(_0x5edc97);});});}exports[_0xbb58('0x14')]=function(_0x3134ea){var _0x48f3e0=this;return new Promise(function(_0xbee66,_0x497653){return db[_0xbb58('0x15')][_0xbb58('0x16')]({'raw':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x18')]===undefined?!![]:![]:!![],'where':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')]['where']||null:null,'attributes':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x19')]||null:null,'limit':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x1a')]||null:null,'include':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x1b')]?_['map'](_0x3134ea[_0xbb58('0x17')]['include'],function(_0x21964d){return{'model':db[_0x21964d[_0xbb58('0x1c')]],'as':_0x21964d['as'],'attributes':_0x21964d[_0xbb58('0x19')],'include':_0x21964d[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x21964d[_0xbb58('0x1b')],function(_0x2d556a){return{'model':db[_0x2d556a[_0xbb58('0x1c')]],'as':_0x2d556a['as'],'attributes':_0x2d556a['attributes'],'include':_0x2d556a[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x2d556a[_0xbb58('0x1b')],function(_0x129094){return{'model':db[_0x129094[_0xbb58('0x1c')]],'as':_0x129094['as'],'attributes':_0x129094[_0xbb58('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbb58('0xa')](function(_0x2ce7c3){logger[_0xbb58('0xb')](_0xbb58('0x14'),_0x3134ea);logger[_0xbb58('0x1e')](_0xbb58('0x14'),_0x3134ea,JSON[_0xbb58('0xf')](_0x2ce7c3));_0xbee66(_0x2ce7c3);})[_0xbb58('0x1f')](function(_0x3559b6){logger['error'](_0xbb58('0x14'),_0x3559b6[_0xbb58('0x12')],_0x3134ea);_0x497653(_0x48f3e0[_0xbb58('0x10')](0x1f4,_0x3559b6[_0xbb58('0x12')]));});});};exports[_0xbb58('0x20')]=function(_0x9d379f){var _0x1ba526=this;return new Promise(function(_0x643e0e,_0x3f8db3){return db['VtigerAccount'][_0xbb58('0x21')]({'raw':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x18')]===undefined?!![]:![]:!![],'where':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x22')]||null:null,'attributes':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x19')]||null:null,'include':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x1b')]?_['map'](_0x9d379f['options']['include'],function(_0x1def9f){return{'model':db[_0x1def9f[_0xbb58('0x1c')]],'as':_0x1def9f['as'],'attributes':_0x1def9f[_0xbb58('0x19')],'include':_0x1def9f[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x1def9f[_0xbb58('0x1b')],function(_0x3093bf){return{'model':db[_0x3093bf[_0xbb58('0x1c')]],'as':_0x3093bf['as'],'attributes':_0x3093bf['attributes'],'include':_0x3093bf[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x3093bf['include'],function(_0x33ec68){return{'model':db[_0x33ec68['model']],'as':_0x33ec68['as'],'attributes':_0x33ec68[_0xbb58('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x86372e){logger[_0xbb58('0xb')]('ShowVtigerAccount',_0x9d379f);logger[_0xbb58('0x1e')](_0xbb58('0x20'),_0x9d379f,JSON[_0xbb58('0xf')](_0x86372e));_0x643e0e(_0x86372e);})[_0xbb58('0x1f')](function(_0x1b86a6){logger[_0xbb58('0x10')](_0xbb58('0x20'),_0x1b86a6[_0xbb58('0x12')],_0x9d379f);_0x3f8db3(_0x1ba526['error'](0x1f4,_0x1b86a6[_0xbb58('0x12')]));});});}; \ No newline at end of file +var _0x5423=['options','raw','where','limit','include','attributes','map','model','then','ShowVtigerAccount','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount','VtigerAccount','findAll'];(function(_0x56fd2e,_0x23ee14){var _0x2d68fe=function(_0x22d300){while(--_0x22d300){_0x56fd2e['push'](_0x56fd2e['shift']());}};_0x2d68fe(++_0x23ee14);}(_0x5423,0xe3));var _0x3542=function(_0xd2286c,_0x304f9d){_0xd2286c=_0xd2286c-0x0;var _0x2519e0=_0x5423[_0xd2286c];return _0x2519e0;};'use strict';var _=require(_0x3542('0x0'));var util=require(_0x3542('0x1'));var moment=require('moment');var BPromise=require(_0x3542('0x2'));var rs=require(_0x3542('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3542('0x4'))['db'];var utils=require(_0x3542('0x5'));var logger=require(_0x3542('0x6'))(_0x3542('0x7'));var config=require('../../config/environment');var jayson=require(_0x3542('0x8'));var client=jayson[_0x3542('0x9')][_0x3542('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29c3fa,_0x2e1a62,_0x55413c){return new BPromise(function(_0x4cdc86,_0xbc51ab){return client[_0x3542('0xb')](_0x29c3fa,_0x55413c)['then'](function(_0x681195){logger[_0x3542('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x2e1a62,_0x3542('0xd'));logger[_0x3542('0xe')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x2e1a62,_0x3542('0xd'),JSON[_0x3542('0xf')](_0x681195));if(_0x681195[_0x3542('0x10')]){if(_0x681195[_0x3542('0x10')][_0x3542('0x11')]===0x1f4){logger[_0x3542('0x10')](_0x3542('0x12'),_0x2e1a62,_0x681195[_0x3542('0x10')][_0x3542('0x13')]);return _0xbc51ab(_0x681195[_0x3542('0x10')][_0x3542('0x13')]);}logger[_0x3542('0x10')](_0x3542('0x12'),_0x2e1a62,_0x681195['error'][_0x3542('0x13')]);return _0x4cdc86(_0x681195['error'][_0x3542('0x13')]);}else{logger[_0x3542('0xc')](_0x3542('0x12'),_0x2e1a62,'request\x20sent');_0x4cdc86(_0x681195[_0x3542('0x14')][_0x3542('0x13')]);}})[_0x3542('0x15')](function(_0x5726af){logger[_0x3542('0x10')](_0x3542('0x12'),_0x2e1a62,_0x5726af);_0xbc51ab(_0x5726af);});});}exports[_0x3542('0x16')]=function(_0x3d5199){var _0x493d95=this;return new Promise(function(_0x32df3f,_0x53d4aa){return db[_0x3542('0x17')][_0x3542('0x18')]({'raw':_0x3d5199['options']?_0x3d5199[_0x3542('0x19')][_0x3542('0x1a')]===undefined?!![]:![]:!![],'where':_0x3d5199[_0x3542('0x19')]?_0x3d5199[_0x3542('0x19')][_0x3542('0x1b')]||null:null,'attributes':_0x3d5199['options']?_0x3d5199['options']['attributes']||null:null,'limit':_0x3d5199[_0x3542('0x19')]?_0x3d5199['options'][_0x3542('0x1c')]||null:null,'include':_0x3d5199['options']?_0x3d5199[_0x3542('0x19')]['include']?_['map'](_0x3d5199[_0x3542('0x19')][_0x3542('0x1d')],function(_0x5ae097){return{'model':db[_0x5ae097['model']],'as':_0x5ae097['as'],'attributes':_0x5ae097[_0x3542('0x1e')],'include':_0x5ae097['include']?_[_0x3542('0x1f')](_0x5ae097[_0x3542('0x1d')],function(_0x1e0723){return{'model':db[_0x1e0723[_0x3542('0x20')]],'as':_0x1e0723['as'],'attributes':_0x1e0723[_0x3542('0x1e')],'include':_0x1e0723[_0x3542('0x1d')]?_[_0x3542('0x1f')](_0x1e0723[_0x3542('0x1d')],function(_0x18dc6c){return{'model':db[_0x18dc6c[_0x3542('0x20')]],'as':_0x18dc6c['as'],'attributes':_0x18dc6c[_0x3542('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3542('0x21')](function(_0x220021){logger[_0x3542('0xc')](_0x3542('0x16'),_0x3d5199);logger[_0x3542('0xe')](_0x3542('0x16'),_0x3d5199,JSON[_0x3542('0xf')](_0x220021));_0x32df3f(_0x220021);})[_0x3542('0x15')](function(_0x5590a2){logger[_0x3542('0x10')](_0x3542('0x16'),_0x5590a2[_0x3542('0x13')],_0x3d5199);_0x53d4aa(_0x493d95['error'](0x1f4,_0x5590a2[_0x3542('0x13')]));});});};exports[_0x3542('0x22')]=function(_0x2e883a){var _0x30b5e8=this;return new Promise(function(_0x5c882f,_0x5a274b){return db[_0x3542('0x17')][_0x3542('0x23')]({'raw':_0x2e883a[_0x3542('0x19')]?_0x2e883a[_0x3542('0x19')][_0x3542('0x1a')]===undefined?!![]:![]:!![],'where':_0x2e883a[_0x3542('0x19')]?_0x2e883a[_0x3542('0x19')]['where']||null:null,'attributes':_0x2e883a['options']?_0x2e883a[_0x3542('0x19')]['attributes']||null:null,'include':_0x2e883a['options']?_0x2e883a[_0x3542('0x19')]['include']?_['map'](_0x2e883a[_0x3542('0x19')][_0x3542('0x1d')],function(_0x1bf178){return{'model':db[_0x1bf178['model']],'as':_0x1bf178['as'],'attributes':_0x1bf178[_0x3542('0x1e')],'include':_0x1bf178['include']?_[_0x3542('0x1f')](_0x1bf178[_0x3542('0x1d')],function(_0x561fd0){return{'model':db[_0x561fd0[_0x3542('0x20')]],'as':_0x561fd0['as'],'attributes':_0x561fd0['attributes'],'include':_0x561fd0[_0x3542('0x1d')]?_[_0x3542('0x1f')](_0x561fd0[_0x3542('0x1d')],function(_0x4cfb8f){return{'model':db[_0x4cfb8f[_0x3542('0x20')]],'as':_0x4cfb8f['as'],'attributes':_0x4cfb8f['attributes']};}):[]};}):[]};}):[]:[]})[_0x3542('0x21')](function(_0x1fe5c6){logger[_0x3542('0xc')](_0x3542('0x22'),_0x2e883a);logger[_0x3542('0xe')](_0x3542('0x22'),_0x2e883a,JSON[_0x3542('0xf')](_0x1fe5c6));_0x5c882f(_0x1fe5c6);})[_0x3542('0x15')](function(_0x110aa8){logger[_0x3542('0x10')](_0x3542('0x22'),_0x110aa8[_0x3542('0x13')],_0x2e883a);_0x5a274b(_0x30b5e8[_0x3542('0x10')](0x1f4,_0x110aa8['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 3e1c6cf..86fbb49 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 _0xd898=['update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x30ecb8,_0x235cde){var _0x2127b8=function(_0x280853){while(--_0x280853){_0x30ecb8['push'](_0x30ecb8['shift']());}};_0x2127b8(++_0x235cde);}(_0xd898,0x8d));var _0x8d89=function(_0x3bc17b,_0x3a3782){_0x3bc17b=_0x3bc17b-0x0;var _0x115843=_0xd898[_0x3bc17b];return _0x115843;};'use strict';var multer=require(_0x8d89('0x0'));var util=require(_0x8d89('0x1'));var path=require(_0x8d89('0x2'));var timeout=require('connect-timeout');var express=require(_0x8d89('0x3'));var router=express[_0x8d89('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8d89('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8d89('0x6'));var controller=require(_0x8d89('0x7'));router['get']('/',auth[_0x8d89('0x8')](),controller[_0x8d89('0x9')]);router[_0x8d89('0xa')](_0x8d89('0xb'),auth[_0x8d89('0x8')](),controller[_0x8d89('0xc')]);router[_0x8d89('0xa')](_0x8d89('0xd'),auth['isAuthenticated'](),controller[_0x8d89('0xe')]);router[_0x8d89('0xa')](_0x8d89('0xf'),auth[_0x8d89('0x8')](),controller[_0x8d89('0x10')]);router[_0x8d89('0xa')](_0x8d89('0x11'),auth[_0x8d89('0x8')](),controller[_0x8d89('0x12')]);router[_0x8d89('0x13')]('/',auth[_0x8d89('0x8')](),controller['create']);router['put'](_0x8d89('0xb'),auth[_0x8d89('0x8')](),controller[_0x8d89('0x14')]);router[_0x8d89('0x15')](_0x8d89('0xb'),auth[_0x8d89('0x8')](),controller[_0x8d89('0x16')]);module['exports']=router; \ No newline at end of file +var _0x7e2f=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','delete','/:id','destroy','exports','path','Router','fs-extra'];(function(_0x5f2af0,_0x279979){var _0x12bff=function(_0x279ddb){while(--_0x279ddb){_0x5f2af0['push'](_0x5f2af0['shift']());}};_0x12bff(++_0x279979);}(_0x7e2f,0x15d));var _0xf7e2=function(_0x30d9bf,_0x359bb6){_0x30d9bf=_0x30d9bf-0x0;var _0x2be61e=_0x7e2f[_0x30d9bf];return _0x2be61e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf7e2('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf7e2('0x1')]();var fs_extra=require(_0xf7e2('0x2'));var auth=require(_0xf7e2('0x3'));var interaction=require(_0xf7e2('0x4'));var config=require(_0xf7e2('0x5'));var controller=require('./intVtigerConfiguration.controller');router[_0xf7e2('0x6')]('/',auth[_0xf7e2('0x7')](),controller[_0xf7e2('0x8')]);router[_0xf7e2('0x6')]('/:id',auth[_0xf7e2('0x7')](),controller[_0xf7e2('0x9')]);router[_0xf7e2('0x6')](_0xf7e2('0xa'),auth[_0xf7e2('0x7')](),controller[_0xf7e2('0xb')]);router[_0xf7e2('0x6')](_0xf7e2('0xc'),auth[_0xf7e2('0x7')](),controller[_0xf7e2('0xd')]);router[_0xf7e2('0x6')](_0xf7e2('0xe'),auth[_0xf7e2('0x7')](),controller[_0xf7e2('0xf')]);router[_0xf7e2('0x10')]('/',auth['isAuthenticated'](),controller[_0xf7e2('0x11')]);router['put']('/:id',auth[_0xf7e2('0x7')](),controller['update']);router[_0xf7e2('0x12')](_0xf7e2('0x13'),auth[_0xf7e2('0x7')](),controller[_0xf7e2('0x14')]);module[_0xf7e2('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 8be3560..158c685 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 _0x3830=['STRING','sequelize','exports'];(function(_0x1d5cfa,_0x57efb0){var _0x19a273=function(_0x2fe3f5){while(--_0x2fe3f5){_0x1d5cfa['push'](_0x1d5cfa['shift']());}};_0x19a273(++_0x57efb0);}(_0x3830,0x7c));var _0x0383=function(_0x39caaa,_0x1f37bc){_0x39caaa=_0x39caaa-0x0;var _0x9b9c7d=_0x3830[_0x39caaa];return _0x9b9c7d;};'use strict';var Sequelize=require(_0x0383('0x0'));module[_0x0383('0x1')]={'name':{'type':Sequelize[_0x0383('0x2')]},'description':{'type':Sequelize[_0x0383('0x2')]}}; \ No newline at end of file +var _0x554b=['STRING','sequelize','exports'];(function(_0x582a0a,_0x3e9d8b){var _0x420349=function(_0x53b05f){while(--_0x53b05f){_0x582a0a['push'](_0x582a0a['shift']());}};_0x420349(++_0x3e9d8b);}(_0x554b,0x16f));var _0xb554=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x554b[_0x3fba9f];return _0x192cf1;};'use strict';var Sequelize=require(_0xb554('0x0'));module[_0xb554('0x1')]={'name':{'type':Sequelize[_0xb554('0x2')]},'description':{'type':Sequelize[_0xb554('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 89864dc..5bfabed 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 _0x9bea=['params','include','find','create','body','findOne','VtigerField','order','hasOwnProperty','getFields','getSubjects','rawAttributes','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','sendStatus','error','stack','name','send','index','map','VtigerConfiguration','fieldName','type','key','query','keys','model','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9bea,0x1f3));var _0xa9be=function(_0xe0c1d2,_0x13dd37){_0xe0c1d2=_0xe0c1d2-0x0;var _0x51d6ef=_0x9bea[_0xe0c1d2];return _0x51d6ef;};'use strict';var emlformat=require(_0xa9be('0x0'));var rimraf=require(_0xa9be('0x1'));var zipdir=require(_0xa9be('0x2'));var jsonpatch=require(_0xa9be('0x3'));var rp=require(_0xa9be('0x4'));var moment=require(_0xa9be('0x5'));var BPromise=require(_0xa9be('0x6'));var Mustache=require('mustache');var util=require(_0xa9be('0x7'));var path=require(_0xa9be('0x8'));var sox=require(_0xa9be('0x9'));var csv=require(_0xa9be('0xa'));var ejs=require(_0xa9be('0xb'));var fs=require('fs');var fs_extra=require(_0xa9be('0xc'));var _=require(_0xa9be('0xd'));var squel=require(_0xa9be('0xe'));var crypto=require('crypto');var jsforce=require(_0xa9be('0xf'));var deskjs=require(_0xa9be('0x10'));var toCsv=require(_0xa9be('0xa'));var querystring=require('querystring');var Papa=require(_0xa9be('0x11'));var Redis=require(_0xa9be('0x12'));var authService=require(_0xa9be('0x13'));var qs=require(_0xa9be('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa9be('0x15'));var utils=require(_0xa9be('0x16'));var config=require(_0xa9be('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa9be('0x18'))['db'];function respondWithStatusCode(_0x4c3ae2,_0x38a4fe){_0x38a4fe=_0x38a4fe||0xcc;return function(_0x3b7344){if(_0x3b7344){return _0x4c3ae2['sendStatus'](_0x38a4fe);}return _0x4c3ae2[_0xa9be('0x19')](_0x38a4fe)[_0xa9be('0x1a')]();};}function respondWithResult(_0x41dbca,_0x1f6f82){_0x1f6f82=_0x1f6f82||0xc8;return function(_0x25b5bc){if(_0x25b5bc){return _0x41dbca['status'](_0x1f6f82)[_0xa9be('0x1b')](_0x25b5bc);}};}function respondWithFilteredResult(_0x1bad16,_0x303999){return function(_0x5c6d08){if(_0x5c6d08){var _0x1b5bb2=typeof _0x303999[_0xa9be('0x1c')]===_0xa9be('0x1d')&&typeof _0x303999[_0xa9be('0x1e')]===_0xa9be('0x1d');var _0x1bfce5=_0x5c6d08[_0xa9be('0x1f')];var _0x40a044=_0x1b5bb2?0x0:_0x303999[_0xa9be('0x1c')];var _0x47e421=_0x1b5bb2?_0x5c6d08['count']:_0x303999['offset']+_0x303999[_0xa9be('0x1e')];var _0x2ee535;if(_0x47e421>=_0x1bfce5){_0x47e421=_0x1bfce5;_0x2ee535=0xc8;}else{_0x2ee535=0xce;}_0x1bad16['status'](_0x2ee535);return _0x1bad16['set'](_0xa9be('0x20'),_0x40a044+'-'+_0x47e421+'/'+_0x1bfce5)[_0xa9be('0x1b')](_0x5c6d08);}return null;};}function patchUpdates(_0x490d06){return function(_0x56fe16){try{jsonpatch['apply'](_0x56fe16,_0x490d06,!![]);}catch(_0xb182f1){return BPromise[_0xa9be('0x21')](_0xb182f1);}return _0x56fe16['save']();};}function saveUpdates(_0x2adeb1,_0x2d02f7){return function(_0x7566c8){if(_0x7566c8){return _0x7566c8[_0xa9be('0x22')](_0x2adeb1)[_0xa9be('0x23')](function(_0x57fcac){return _0x57fcac;});}return null;};}function removeEntity(_0x24bed9,_0x246c1f){return function(_0x422f72){if(_0x422f72){return _0x422f72['destroy']()[_0xa9be('0x23')](function(){_0x24bed9['status'](0xcc)[_0xa9be('0x1a')]();});}};}function handleEntityNotFound(_0xc84101,_0x48156a){return function(_0x40641b){if(!_0x40641b){_0xc84101[_0xa9be('0x24')](0x194);}return _0x40641b;};}function handleError(_0x64ccfb,_0x2a8668){_0x2a8668=_0x2a8668||0x1f4;return function(_0x2b94a6){logger[_0xa9be('0x25')](_0x2b94a6[_0xa9be('0x26')]);if(_0x2b94a6[_0xa9be('0x27')]){delete _0x2b94a6[_0xa9be('0x27')];}_0x64ccfb[_0xa9be('0x19')](_0x2a8668)[_0xa9be('0x28')](_0x2b94a6);};}exports[_0xa9be('0x29')]=function(_0x410486,_0x4a31d2){var _0x51c742={},_0xf25d11={},_0x9c8dd8={'count':0x0,'rows':[]};var _0xd3aba9=_[_0xa9be('0x2a')](db[_0xa9be('0x2b')]['rawAttributes'],function(_0x5e8f78){return{'name':_0x5e8f78[_0xa9be('0x2c')],'type':_0x5e8f78[_0xa9be('0x2d')][_0xa9be('0x2e')]};});_0xf25d11['model']=_[_0xa9be('0x2a')](_0xd3aba9,'name');_0xf25d11[_0xa9be('0x2f')]=_[_0xa9be('0x30')](_0x410486['query']);_0xf25d11['filters']=_['intersection'](_0xf25d11[_0xa9be('0x31')],_0xf25d11[_0xa9be('0x2f')]);_0x51c742['attributes']=_[_0xa9be('0x32')](_0xf25d11[_0xa9be('0x31')],qs[_0xa9be('0x33')](_0x410486[_0xa9be('0x2f')][_0xa9be('0x33')]));_0x51c742[_0xa9be('0x34')]=_0x51c742[_0xa9be('0x34')][_0xa9be('0x35')]?_0x51c742[_0xa9be('0x34')]:_0xf25d11['model'];if(!_0x410486[_0xa9be('0x2f')]['hasOwnProperty'](_0xa9be('0x36'))){_0x51c742[_0xa9be('0x1e')]=qs['limit'](_0x410486[_0xa9be('0x2f')][_0xa9be('0x1e')]);_0x51c742[_0xa9be('0x1c')]=qs['offset'](_0x410486['query']['offset']);}_0x51c742['order']=qs[_0xa9be('0x37')](_0x410486[_0xa9be('0x2f')][_0xa9be('0x37')]);_0x51c742[_0xa9be('0x38')]=qs[_0xa9be('0x39')](_[_0xa9be('0x3a')](_0x410486[_0xa9be('0x2f')],_0xf25d11['filters']),_0xd3aba9);if(_0x410486[_0xa9be('0x2f')][_0xa9be('0x3b')]){_0x51c742['where']=_[_0xa9be('0x3c')](_0x51c742[_0xa9be('0x38')],{'$or':_[_0xa9be('0x2a')](_0xd3aba9,function(_0x327534){if(_0x327534[_0xa9be('0x2d')]!==_0xa9be('0x3d')){var _0x427497={};_0x427497[_0x327534['name']]={'$like':'%'+_0x410486[_0xa9be('0x2f')][_0xa9be('0x3b')]+'%'};return _0x427497;}})});}_0x51c742=_[_0xa9be('0x3c')]({},_0x51c742,_0x410486[_0xa9be('0x3e')]);var _0x416cbf={'where':_0x51c742[_0xa9be('0x38')]};return db['VtigerConfiguration']['count'](_0x416cbf)[_0xa9be('0x23')](function(_0x2a59ee){_0x9c8dd8[_0xa9be('0x1f')]=_0x2a59ee;if(_0x410486[_0xa9be('0x2f')][_0xa9be('0x3f')]){_0x51c742['include']=[{'all':!![]}];}return db['VtigerConfiguration'][_0xa9be('0x40')](_0x51c742);})[_0xa9be('0x23')](function(_0x2cbb01){_0x9c8dd8[_0xa9be('0x41')]=_0x2cbb01;return _0x9c8dd8;})['then'](respondWithFilteredResult(_0x4a31d2,_0x51c742))[_0xa9be('0x42')](handleError(_0x4a31d2,null));};exports[_0xa9be('0x43')]=function(_0xb821de,_0x5a243e){var _0x2aa336={'raw':![],'where':{'id':_0xb821de[_0xa9be('0x44')]['id']}},_0x24499d={};_0x24499d['model']=_[_0xa9be('0x30')](db[_0xa9be('0x2b')]['rawAttributes']);_0x24499d[_0xa9be('0x2f')]=_[_0xa9be('0x30')](_0xb821de['query']);_0x24499d[_0xa9be('0x39')]=_[_0xa9be('0x32')](_0x24499d['model'],_0x24499d[_0xa9be('0x2f')]);_0x2aa336[_0xa9be('0x34')]=_[_0xa9be('0x32')](_0x24499d[_0xa9be('0x31')],qs['fields'](_0xb821de[_0xa9be('0x2f')]['fields']));_0x2aa336[_0xa9be('0x34')]=_0x2aa336['attributes'][_0xa9be('0x35')]?_0x2aa336[_0xa9be('0x34')]:_0x24499d[_0xa9be('0x31')];if(_0xb821de['query'][_0xa9be('0x3f')]){_0x2aa336[_0xa9be('0x45')]=[{'all':!![]}];}_0x2aa336=_[_0xa9be('0x3c')]({},_0x2aa336,_0xb821de[_0xa9be('0x3e')]);return db['VtigerConfiguration'][_0xa9be('0x46')](_0x2aa336)[_0xa9be('0x23')](handleEntityNotFound(_0x5a243e,null))[_0xa9be('0x23')](respondWithResult(_0x5a243e,null))[_0xa9be('0x42')](handleError(_0x5a243e,null));};exports[_0xa9be('0x47')]=function(_0x2008a6,_0x12b18a){return db[_0xa9be('0x2b')][_0xa9be('0x47')](_0x2008a6[_0xa9be('0x48')],{})[_0xa9be('0x23')](respondWithResult(_0x12b18a,0xc9))[_0xa9be('0x42')](handleError(_0x12b18a,null));};exports['update']=function(_0x2259c7,_0x3b81f3){if(_0x2259c7[_0xa9be('0x48')]['id']){delete _0x2259c7[_0xa9be('0x48')]['id'];}return db[_0xa9be('0x2b')]['find']({'where':{'id':_0x2259c7[_0xa9be('0x44')]['id']}})[_0xa9be('0x23')](handleEntityNotFound(_0x3b81f3,null))['then'](saveUpdates(_0x2259c7[_0xa9be('0x48')],null))[_0xa9be('0x23')](respondWithResult(_0x3b81f3,null))[_0xa9be('0x42')](handleError(_0x3b81f3,null));};exports['destroy']=function(_0x2b7120,_0x53ad27){return db['VtigerConfiguration'][_0xa9be('0x46')]({'where':{'id':_0x2b7120[_0xa9be('0x44')]['id']}})[_0xa9be('0x23')](handleEntityNotFound(_0x53ad27,null))[_0xa9be('0x23')](removeEntity(_0x53ad27,null))[_0xa9be('0x42')](handleError(_0x53ad27,null));};exports['getFields']=function(_0x321b8c,_0x10d12a,_0x21f12f){var _0x34a479={};var _0x14bb22={};var _0x4017aa;var _0x4f20cf;return db[_0xa9be('0x2b')][_0xa9be('0x49')]({'where':{'id':_0x321b8c['params']['id']}})[_0xa9be('0x23')](handleEntityNotFound(_0x10d12a,null))['then'](function(_0x45296e){if(_0x45296e){_0x4017aa=_0x45296e;_0x14bb22[_0xa9be('0x31')]=_[_0xa9be('0x30')](db[_0xa9be('0x4a')]['rawAttributes']);_0x14bb22['query']=_[_0xa9be('0x30')](_0x321b8c[_0xa9be('0x2f')]);_0x14bb22['filters']=_[_0xa9be('0x32')](_0x14bb22[_0xa9be('0x31')],_0x14bb22['query']);_0x34a479[_0xa9be('0x34')]=_[_0xa9be('0x32')](_0x14bb22[_0xa9be('0x31')],qs[_0xa9be('0x33')](_0x321b8c['query'][_0xa9be('0x33')]));_0x34a479['attributes']=_0x34a479[_0xa9be('0x34')][_0xa9be('0x35')]?_0x34a479[_0xa9be('0x34')]:_0x14bb22[_0xa9be('0x31')];_0x34a479[_0xa9be('0x4b')]=qs[_0xa9be('0x37')](_0x321b8c[_0xa9be('0x2f')][_0xa9be('0x37')]);_0x34a479[_0xa9be('0x38')]=qs[_0xa9be('0x39')](_[_0xa9be('0x3a')](_0x321b8c['query'],_0x14bb22[_0xa9be('0x39')]));if(_0x321b8c['query'][_0xa9be('0x3b')]){_0x34a479['where']=_['merge'](_0x34a479[_0xa9be('0x38')],{'$or':_[_0xa9be('0x2a')](_0x34a479['attributes'],function(_0x5befcd){var _0x8bfaaf={};_0x8bfaaf[_0x5befcd]={'$like':'%'+_0x321b8c['query'][_0xa9be('0x3b')]+'%'};return _0x8bfaaf;})});}_0x34a479=_[_0xa9be('0x3c')]({},_0x34a479,_0x321b8c['options']);return _0x4017aa['getFields'](_0x34a479);}})[_0xa9be('0x23')](function(_0x4e895e){if(_0x4e895e){_0x4f20cf=_0x4e895e[_0xa9be('0x35')];if(!_0x321b8c[_0xa9be('0x2f')][_0xa9be('0x4c')](_0xa9be('0x36'))){_0x34a479[_0xa9be('0x1e')]=qs[_0xa9be('0x1e')](_0x321b8c[_0xa9be('0x2f')]['limit']);_0x34a479['offset']=qs[_0xa9be('0x1c')](_0x321b8c[_0xa9be('0x2f')][_0xa9be('0x1c')]);}return _0x4017aa[_0xa9be('0x4d')](_0x34a479);}})[_0xa9be('0x23')](function(_0x539329){if(_0x539329){return _0x539329?{'count':_0x4f20cf,'rows':_0x539329}:null;}})[_0xa9be('0x23')](respondWithResult(_0x10d12a,null))[_0xa9be('0x42')](handleError(_0x10d12a,null));};exports[_0xa9be('0x4e')]=function(_0x3eb07b,_0x535257,_0x337b36){var _0x131fed={};var _0xf41489={};var _0x2e1979;var _0x3fd24e;return db[_0xa9be('0x2b')][_0xa9be('0x49')]({'where':{'id':_0x3eb07b[_0xa9be('0x44')]['id']}})[_0xa9be('0x23')](handleEntityNotFound(_0x535257,null))[_0xa9be('0x23')](function(_0x43ae65){if(_0x43ae65){_0x2e1979=_0x43ae65;_0xf41489[_0xa9be('0x31')]=_['keys'](db[_0xa9be('0x4a')]['rawAttributes']);_0xf41489[_0xa9be('0x2f')]=_[_0xa9be('0x30')](_0x3eb07b[_0xa9be('0x2f')]);_0xf41489['filters']=_[_0xa9be('0x32')](_0xf41489[_0xa9be('0x31')],_0xf41489[_0xa9be('0x2f')]);_0x131fed[_0xa9be('0x34')]=_[_0xa9be('0x32')](_0xf41489['model'],qs[_0xa9be('0x33')](_0x3eb07b['query'][_0xa9be('0x33')]));_0x131fed[_0xa9be('0x34')]=_0x131fed[_0xa9be('0x34')]['length']?_0x131fed[_0xa9be('0x34')]:_0xf41489['model'];_0x131fed[_0xa9be('0x4b')]=qs[_0xa9be('0x37')](_0x3eb07b['query'][_0xa9be('0x37')]);_0x131fed['where']=qs[_0xa9be('0x39')](_['pick'](_0x3eb07b[_0xa9be('0x2f')],_0xf41489[_0xa9be('0x39')]));if(_0x3eb07b[_0xa9be('0x2f')]['filter']){_0x131fed[_0xa9be('0x38')]=_[_0xa9be('0x3c')](_0x131fed[_0xa9be('0x38')],{'$or':_[_0xa9be('0x2a')](_0x131fed[_0xa9be('0x34')],function(_0x1a8214){var _0x5bf9a8={};_0x5bf9a8[_0x1a8214]={'$like':'%'+_0x3eb07b[_0xa9be('0x2f')]['filter']+'%'};return _0x5bf9a8;})});}_0x131fed=_[_0xa9be('0x3c')]({},_0x131fed,_0x3eb07b['options']);return _0x2e1979[_0xa9be('0x4e')](_0x131fed);}})['then'](function(_0x157094){if(_0x157094){_0x3fd24e=_0x157094[_0xa9be('0x35')];if(!_0x3eb07b[_0xa9be('0x2f')]['hasOwnProperty'](_0xa9be('0x36'))){_0x131fed['limit']=qs[_0xa9be('0x1e')](_0x3eb07b[_0xa9be('0x2f')]['limit']);_0x131fed['offset']=qs[_0xa9be('0x1c')](_0x3eb07b[_0xa9be('0x2f')][_0xa9be('0x1c')]);}return _0x2e1979[_0xa9be('0x4e')](_0x131fed);}})[_0xa9be('0x23')](function(_0x43af67){if(_0x43af67){return _0x43af67?{'count':_0x3fd24e,'rows':_0x43af67}:null;}})['then'](respondWithResult(_0x535257,null))[_0xa9be('0x42')](handleError(_0x535257,null));};exports['getDescriptions']=function(_0x14dcd0,_0x1a8834,_0x2390f6){var _0x293723={};var _0x21aec5={};var _0x5a8d85;var _0x426a63;return db[_0xa9be('0x2b')][_0xa9be('0x49')]({'where':{'id':_0x14dcd0[_0xa9be('0x44')]['id']}})[_0xa9be('0x23')](handleEntityNotFound(_0x1a8834,null))[_0xa9be('0x23')](function(_0x511b6e){if(_0x511b6e){_0x5a8d85=_0x511b6e;_0x21aec5[_0xa9be('0x31')]=_['keys'](db[_0xa9be('0x4a')][_0xa9be('0x4f')]);_0x21aec5[_0xa9be('0x2f')]=_['keys'](_0x14dcd0[_0xa9be('0x2f')]);_0x21aec5[_0xa9be('0x39')]=_[_0xa9be('0x32')](_0x21aec5[_0xa9be('0x31')],_0x21aec5[_0xa9be('0x2f')]);_0x293723[_0xa9be('0x34')]=_['intersection'](_0x21aec5['model'],qs[_0xa9be('0x33')](_0x14dcd0['query'][_0xa9be('0x33')]));_0x293723[_0xa9be('0x34')]=_0x293723[_0xa9be('0x34')]['length']?_0x293723[_0xa9be('0x34')]:_0x21aec5[_0xa9be('0x31')];_0x293723[_0xa9be('0x4b')]=qs[_0xa9be('0x37')](_0x14dcd0[_0xa9be('0x2f')][_0xa9be('0x37')]);_0x293723[_0xa9be('0x38')]=qs['filters'](_[_0xa9be('0x3a')](_0x14dcd0['query'],_0x21aec5['filters']));if(_0x14dcd0['query'][_0xa9be('0x3b')]){_0x293723[_0xa9be('0x38')]=_[_0xa9be('0x3c')](_0x293723[_0xa9be('0x38')],{'$or':_[_0xa9be('0x2a')](_0x293723[_0xa9be('0x34')],function(_0x536cd9){var _0x2e23ff={};_0x2e23ff[_0x536cd9]={'$like':'%'+_0x14dcd0[_0xa9be('0x2f')][_0xa9be('0x3b')]+'%'};return _0x2e23ff;})});}_0x293723=_['merge']({},_0x293723,_0x14dcd0[_0xa9be('0x3e')]);return _0x5a8d85[_0xa9be('0x50')](_0x293723);}})[_0xa9be('0x23')](function(_0x4390a2){if(_0x4390a2){_0x426a63=_0x4390a2[_0xa9be('0x35')];if(!_0x14dcd0[_0xa9be('0x2f')][_0xa9be('0x4c')](_0xa9be('0x36'))){_0x293723[_0xa9be('0x1e')]=qs['limit'](_0x14dcd0[_0xa9be('0x2f')][_0xa9be('0x1e')]);_0x293723[_0xa9be('0x1c')]=qs[_0xa9be('0x1c')](_0x14dcd0[_0xa9be('0x2f')][_0xa9be('0x1c')]);}return _0x5a8d85['getDescriptions'](_0x293723);}})[_0xa9be('0x23')](function(_0x1b1117){if(_0x1b1117){return _0x1b1117?{'count':_0x426a63,'rows':_0x1b1117}:null;}})[_0xa9be('0x23')](respondWithResult(_0x1a8834,null))['catch'](handleError(_0x1a8834,null));}; \ No newline at end of file +var _0x6cbf=['end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','then','error','stack','send','index','VtigerConfiguration','rawAttributes','fieldName','type','key','model','map','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','options','find','create','body','update','params','destroy','findOne','VtigerField','getFields','getSubjects','getDescriptions','eml-format','zip-dir','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x3365bd,_0x417902){var _0x47665c=function(_0x9a6eb2){while(--_0x9a6eb2){_0x3365bd['push'](_0x3365bd['shift']());}};_0x47665c(++_0x417902);}(_0x6cbf,0x122));var _0xf6cb=function(_0x5d34d4,_0x3dd95a){_0x5d34d4=_0x5d34d4-0x0;var _0x1e4ad4=_0x6cbf[_0x5d34d4];return _0x1e4ad4;};'use strict';var emlformat=require(_0xf6cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf6cb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf6cb('0x2'));var BPromise=require(_0xf6cb('0x3'));var Mustache=require('mustache');var util=require(_0xf6cb('0x4'));var path=require(_0xf6cb('0x5'));var sox=require(_0xf6cb('0x6'));var csv=require('to-csv');var ejs=require(_0xf6cb('0x7'));var fs=require('fs');var fs_extra=require(_0xf6cb('0x8'));var _=require(_0xf6cb('0x9'));var squel=require('squel');var crypto=require(_0xf6cb('0xa'));var jsforce=require(_0xf6cb('0xb'));var deskjs=require(_0xf6cb('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf6cb('0xd'));var authService=require(_0xf6cb('0xe'));var qs=require(_0xf6cb('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf6cb('0x10'))(_0xf6cb('0x11'));var utils=require(_0xf6cb('0x12'));var config=require(_0xf6cb('0x13'));var licenseUtil=require(_0xf6cb('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa3b0d7,_0x8a8f58){_0x8a8f58=_0x8a8f58||0xcc;return function(_0x13790f){if(_0x13790f){return _0xa3b0d7[_0xf6cb('0x15')](_0x8a8f58);}return _0xa3b0d7['status'](_0x8a8f58)[_0xf6cb('0x16')]();};}function respondWithResult(_0x40bbc0,_0x2dfca7){_0x2dfca7=_0x2dfca7||0xc8;return function(_0x148227){if(_0x148227){return _0x40bbc0[_0xf6cb('0x17')](_0x2dfca7)[_0xf6cb('0x18')](_0x148227);}};}function respondWithFilteredResult(_0x230f09,_0x43f461){return function(_0x5e9bdc){if(_0x5e9bdc){var _0x106258=typeof _0x43f461['offset']===_0xf6cb('0x19')&&typeof _0x43f461[_0xf6cb('0x1a')]===_0xf6cb('0x19');var _0x2013b2=_0x5e9bdc['count'];var _0x52980d=_0x106258?0x0:_0x43f461['offset'];var _0x145da2=_0x106258?_0x5e9bdc[_0xf6cb('0x1b')]:_0x43f461[_0xf6cb('0x1c')]+_0x43f461['limit'];var _0x481c99;if(_0x145da2>=_0x2013b2){_0x145da2=_0x2013b2;_0x481c99=0xc8;}else{_0x481c99=0xce;}_0x230f09[_0xf6cb('0x17')](_0x481c99);return _0x230f09['set'](_0xf6cb('0x1d'),_0x52980d+'-'+_0x145da2+'/'+_0x2013b2)['json'](_0x5e9bdc);}return null;};}function patchUpdates(_0x22e715){return function(_0x12e8b7){try{jsonpatch[_0xf6cb('0x1e')](_0x12e8b7,_0x22e715,!![]);}catch(_0x14eb58){return BPromise[_0xf6cb('0x1f')](_0x14eb58);}return _0x12e8b7['save']();};}function saveUpdates(_0x20b593,_0x2dc1e3){return function(_0x1b569e){if(_0x1b569e){return _0x1b569e['update'](_0x20b593)['then'](function(_0x43f1f7){return _0x43f1f7;});}return null;};}function removeEntity(_0x5f0d71,_0x5a3a54){return function(_0x51692f){if(_0x51692f){return _0x51692f['destroy']()[_0xf6cb('0x20')](function(){_0x5f0d71[_0xf6cb('0x17')](0xcc)[_0xf6cb('0x16')]();});}};}function handleEntityNotFound(_0x407e28,_0x2b40f6){return function(_0xda91cc){if(!_0xda91cc){_0x407e28[_0xf6cb('0x15')](0x194);}return _0xda91cc;};}function handleError(_0x17e689,_0x409bdd){_0x409bdd=_0x409bdd||0x1f4;return function(_0x2f5be6){logger[_0xf6cb('0x21')](_0x2f5be6[_0xf6cb('0x22')]);if(_0x2f5be6['name']){delete _0x2f5be6['name'];}_0x17e689[_0xf6cb('0x17')](_0x409bdd)[_0xf6cb('0x23')](_0x2f5be6);};}exports[_0xf6cb('0x24')]=function(_0x2e30e6,_0x3da272){var _0x425ff9={},_0x2ed4a8={},_0x26e822={'count':0x0,'rows':[]};var _0x104dc7=_['map'](db[_0xf6cb('0x25')][_0xf6cb('0x26')],function(_0x362945){return{'name':_0x362945[_0xf6cb('0x27')],'type':_0x362945[_0xf6cb('0x28')][_0xf6cb('0x29')]};});_0x2ed4a8[_0xf6cb('0x2a')]=_[_0xf6cb('0x2b')](_0x104dc7,_0xf6cb('0x2c'));_0x2ed4a8['query']=_[_0xf6cb('0x2d')](_0x2e30e6[_0xf6cb('0x2e')]);_0x2ed4a8[_0xf6cb('0x2f')]=_[_0xf6cb('0x30')](_0x2ed4a8[_0xf6cb('0x2a')],_0x2ed4a8[_0xf6cb('0x2e')]);_0x425ff9[_0xf6cb('0x31')]=_['intersection'](_0x2ed4a8[_0xf6cb('0x2a')],qs[_0xf6cb('0x32')](_0x2e30e6[_0xf6cb('0x2e')][_0xf6cb('0x32')]));_0x425ff9['attributes']=_0x425ff9[_0xf6cb('0x31')][_0xf6cb('0x33')]?_0x425ff9[_0xf6cb('0x31')]:_0x2ed4a8[_0xf6cb('0x2a')];if(!_0x2e30e6[_0xf6cb('0x2e')][_0xf6cb('0x34')](_0xf6cb('0x35'))){_0x425ff9[_0xf6cb('0x1a')]=qs['limit'](_0x2e30e6[_0xf6cb('0x2e')][_0xf6cb('0x1a')]);_0x425ff9['offset']=qs[_0xf6cb('0x1c')](_0x2e30e6['query'][_0xf6cb('0x1c')]);}_0x425ff9[_0xf6cb('0x36')]=qs['sort'](_0x2e30e6[_0xf6cb('0x2e')][_0xf6cb('0x37')]);_0x425ff9[_0xf6cb('0x38')]=qs['filters'](_[_0xf6cb('0x39')](_0x2e30e6[_0xf6cb('0x2e')],_0x2ed4a8['filters']),_0x104dc7);if(_0x2e30e6[_0xf6cb('0x2e')][_0xf6cb('0x3a')]){_0x425ff9[_0xf6cb('0x38')]=_[_0xf6cb('0x3b')](_0x425ff9[_0xf6cb('0x38')],{'$or':_[_0xf6cb('0x2b')](_0x104dc7,function(_0x555290){if(_0x555290[_0xf6cb('0x28')]!==_0xf6cb('0x3c')){var _0x2fe25f={};_0x2fe25f[_0x555290[_0xf6cb('0x2c')]]={'$like':'%'+_0x2e30e6['query'][_0xf6cb('0x3a')]+'%'};return _0x2fe25f;}})});}_0x425ff9=_['merge']({},_0x425ff9,_0x2e30e6['options']);var _0x4f5cbc={'where':_0x425ff9[_0xf6cb('0x38')]};return db[_0xf6cb('0x25')][_0xf6cb('0x1b')](_0x4f5cbc)[_0xf6cb('0x20')](function(_0x5b9c3c){_0x26e822[_0xf6cb('0x1b')]=_0x5b9c3c;if(_0x2e30e6['query'][_0xf6cb('0x3d')]){_0x425ff9[_0xf6cb('0x3e')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0xf6cb('0x3f')](_0x425ff9);})[_0xf6cb('0x20')](function(_0x364e12){_0x26e822['rows']=_0x364e12;return _0x26e822;})[_0xf6cb('0x20')](respondWithFilteredResult(_0x3da272,_0x425ff9))[_0xf6cb('0x40')](handleError(_0x3da272,null));};exports[_0xf6cb('0x41')]=function(_0x382a5a,_0x3f85a0){var _0x1639fa={'raw':![],'where':{'id':_0x382a5a['params']['id']}},_0x13c5de={};_0x13c5de[_0xf6cb('0x2a')]=_[_0xf6cb('0x2d')](db[_0xf6cb('0x25')][_0xf6cb('0x26')]);_0x13c5de[_0xf6cb('0x2e')]=_[_0xf6cb('0x2d')](_0x382a5a['query']);_0x13c5de[_0xf6cb('0x2f')]=_[_0xf6cb('0x30')](_0x13c5de[_0xf6cb('0x2a')],_0x13c5de[_0xf6cb('0x2e')]);_0x1639fa[_0xf6cb('0x31')]=_['intersection'](_0x13c5de['model'],qs[_0xf6cb('0x32')](_0x382a5a[_0xf6cb('0x2e')][_0xf6cb('0x32')]));_0x1639fa[_0xf6cb('0x31')]=_0x1639fa[_0xf6cb('0x31')]['length']?_0x1639fa[_0xf6cb('0x31')]:_0x13c5de[_0xf6cb('0x2a')];if(_0x382a5a[_0xf6cb('0x2e')]['includeAll']){_0x1639fa['include']=[{'all':!![]}];}_0x1639fa=_['merge']({},_0x1639fa,_0x382a5a[_0xf6cb('0x42')]);return db['VtigerConfiguration'][_0xf6cb('0x43')](_0x1639fa)[_0xf6cb('0x20')](handleEntityNotFound(_0x3f85a0,null))['then'](respondWithResult(_0x3f85a0,null))[_0xf6cb('0x40')](handleError(_0x3f85a0,null));};exports[_0xf6cb('0x44')]=function(_0x591303,_0x360ffa){return db[_0xf6cb('0x25')][_0xf6cb('0x44')](_0x591303[_0xf6cb('0x45')],{})[_0xf6cb('0x20')](respondWithResult(_0x360ffa,0xc9))[_0xf6cb('0x40')](handleError(_0x360ffa,null));};exports[_0xf6cb('0x46')]=function(_0x5347d3,_0x5a5f09){if(_0x5347d3[_0xf6cb('0x45')]['id']){delete _0x5347d3[_0xf6cb('0x45')]['id'];}return db[_0xf6cb('0x25')][_0xf6cb('0x43')]({'where':{'id':_0x5347d3[_0xf6cb('0x47')]['id']}})['then'](handleEntityNotFound(_0x5a5f09,null))[_0xf6cb('0x20')](saveUpdates(_0x5347d3[_0xf6cb('0x45')],null))[_0xf6cb('0x20')](respondWithResult(_0x5a5f09,null))[_0xf6cb('0x40')](handleError(_0x5a5f09,null));};exports[_0xf6cb('0x48')]=function(_0x47db41,_0x36aa55){return db[_0xf6cb('0x25')]['find']({'where':{'id':_0x47db41['params']['id']}})[_0xf6cb('0x20')](handleEntityNotFound(_0x36aa55,null))['then'](removeEntity(_0x36aa55,null))[_0xf6cb('0x40')](handleError(_0x36aa55,null));};exports['getFields']=function(_0x4b9502,_0x530e9d,_0x35b7ce){var _0x1d334f={};var _0x1aaac3={};var _0x1a9012;var _0x2629da;return db[_0xf6cb('0x25')][_0xf6cb('0x49')]({'where':{'id':_0x4b9502[_0xf6cb('0x47')]['id']}})[_0xf6cb('0x20')](handleEntityNotFound(_0x530e9d,null))[_0xf6cb('0x20')](function(_0x2fa270){if(_0x2fa270){_0x1a9012=_0x2fa270;_0x1aaac3[_0xf6cb('0x2a')]=_[_0xf6cb('0x2d')](db[_0xf6cb('0x4a')][_0xf6cb('0x26')]);_0x1aaac3['query']=_[_0xf6cb('0x2d')](_0x4b9502[_0xf6cb('0x2e')]);_0x1aaac3[_0xf6cb('0x2f')]=_[_0xf6cb('0x30')](_0x1aaac3[_0xf6cb('0x2a')],_0x1aaac3[_0xf6cb('0x2e')]);_0x1d334f[_0xf6cb('0x31')]=_[_0xf6cb('0x30')](_0x1aaac3[_0xf6cb('0x2a')],qs['fields'](_0x4b9502[_0xf6cb('0x2e')][_0xf6cb('0x32')]));_0x1d334f[_0xf6cb('0x31')]=_0x1d334f[_0xf6cb('0x31')][_0xf6cb('0x33')]?_0x1d334f['attributes']:_0x1aaac3[_0xf6cb('0x2a')];_0x1d334f['order']=qs['sort'](_0x4b9502[_0xf6cb('0x2e')][_0xf6cb('0x37')]);_0x1d334f[_0xf6cb('0x38')]=qs[_0xf6cb('0x2f')](_[_0xf6cb('0x39')](_0x4b9502[_0xf6cb('0x2e')],_0x1aaac3[_0xf6cb('0x2f')]));if(_0x4b9502[_0xf6cb('0x2e')][_0xf6cb('0x3a')]){_0x1d334f[_0xf6cb('0x38')]=_[_0xf6cb('0x3b')](_0x1d334f[_0xf6cb('0x38')],{'$or':_[_0xf6cb('0x2b')](_0x1d334f[_0xf6cb('0x31')],function(_0x418ebe){var _0x3264b1={};_0x3264b1[_0x418ebe]={'$like':'%'+_0x4b9502[_0xf6cb('0x2e')][_0xf6cb('0x3a')]+'%'};return _0x3264b1;})});}_0x1d334f=_['merge']({},_0x1d334f,_0x4b9502[_0xf6cb('0x42')]);return _0x1a9012[_0xf6cb('0x4b')](_0x1d334f);}})[_0xf6cb('0x20')](function(_0x6904f6){if(_0x6904f6){_0x2629da=_0x6904f6[_0xf6cb('0x33')];if(!_0x4b9502['query']['hasOwnProperty']('nolimit')){_0x1d334f[_0xf6cb('0x1a')]=qs[_0xf6cb('0x1a')](_0x4b9502['query']['limit']);_0x1d334f[_0xf6cb('0x1c')]=qs[_0xf6cb('0x1c')](_0x4b9502[_0xf6cb('0x2e')]['offset']);}return _0x1a9012[_0xf6cb('0x4b')](_0x1d334f);}})['then'](function(_0x55f178){if(_0x55f178){return _0x55f178?{'count':_0x2629da,'rows':_0x55f178}:null;}})[_0xf6cb('0x20')](respondWithResult(_0x530e9d,null))[_0xf6cb('0x40')](handleError(_0x530e9d,null));};exports[_0xf6cb('0x4c')]=function(_0x111364,_0x420b24,_0xabe88d){var _0x2c95fa={};var _0x262976={};var _0x2105de;var _0x1959b1;return db[_0xf6cb('0x25')][_0xf6cb('0x49')]({'where':{'id':_0x111364[_0xf6cb('0x47')]['id']}})[_0xf6cb('0x20')](handleEntityNotFound(_0x420b24,null))[_0xf6cb('0x20')](function(_0xe9c16){if(_0xe9c16){_0x2105de=_0xe9c16;_0x262976['model']=_['keys'](db[_0xf6cb('0x4a')][_0xf6cb('0x26')]);_0x262976['query']=_[_0xf6cb('0x2d')](_0x111364['query']);_0x262976[_0xf6cb('0x2f')]=_[_0xf6cb('0x30')](_0x262976[_0xf6cb('0x2a')],_0x262976[_0xf6cb('0x2e')]);_0x2c95fa[_0xf6cb('0x31')]=_['intersection'](_0x262976[_0xf6cb('0x2a')],qs[_0xf6cb('0x32')](_0x111364[_0xf6cb('0x2e')][_0xf6cb('0x32')]));_0x2c95fa[_0xf6cb('0x31')]=_0x2c95fa[_0xf6cb('0x31')][_0xf6cb('0x33')]?_0x2c95fa['attributes']:_0x262976['model'];_0x2c95fa[_0xf6cb('0x36')]=qs[_0xf6cb('0x37')](_0x111364[_0xf6cb('0x2e')][_0xf6cb('0x37')]);_0x2c95fa[_0xf6cb('0x38')]=qs['filters'](_[_0xf6cb('0x39')](_0x111364['query'],_0x262976[_0xf6cb('0x2f')]));if(_0x111364[_0xf6cb('0x2e')]['filter']){_0x2c95fa['where']=_[_0xf6cb('0x3b')](_0x2c95fa[_0xf6cb('0x38')],{'$or':_['map'](_0x2c95fa[_0xf6cb('0x31')],function(_0x40d09e){var _0x325548={};_0x325548[_0x40d09e]={'$like':'%'+_0x111364[_0xf6cb('0x2e')][_0xf6cb('0x3a')]+'%'};return _0x325548;})});}_0x2c95fa=_[_0xf6cb('0x3b')]({},_0x2c95fa,_0x111364['options']);return _0x2105de[_0xf6cb('0x4c')](_0x2c95fa);}})[_0xf6cb('0x20')](function(_0x5e7f77){if(_0x5e7f77){_0x1959b1=_0x5e7f77[_0xf6cb('0x33')];if(!_0x111364[_0xf6cb('0x2e')][_0xf6cb('0x34')](_0xf6cb('0x35'))){_0x2c95fa[_0xf6cb('0x1a')]=qs[_0xf6cb('0x1a')](_0x111364[_0xf6cb('0x2e')][_0xf6cb('0x1a')]);_0x2c95fa['offset']=qs[_0xf6cb('0x1c')](_0x111364['query']['offset']);}return _0x2105de['getSubjects'](_0x2c95fa);}})[_0xf6cb('0x20')](function(_0x888ea2){if(_0x888ea2){return _0x888ea2?{'count':_0x1959b1,'rows':_0x888ea2}:null;}})['then'](respondWithResult(_0x420b24,null))[_0xf6cb('0x40')](handleError(_0x420b24,null));};exports[_0xf6cb('0x4d')]=function(_0x5768c9,_0x5b9d93,_0x257d20){var _0x4aee40={};var _0x5b6d53={};var _0x1ee32b;var _0x345abe;return db[_0xf6cb('0x25')][_0xf6cb('0x49')]({'where':{'id':_0x5768c9[_0xf6cb('0x47')]['id']}})[_0xf6cb('0x20')](handleEntityNotFound(_0x5b9d93,null))[_0xf6cb('0x20')](function(_0x1f5546){if(_0x1f5546){_0x1ee32b=_0x1f5546;_0x5b6d53[_0xf6cb('0x2a')]=_['keys'](db[_0xf6cb('0x4a')]['rawAttributes']);_0x5b6d53[_0xf6cb('0x2e')]=_[_0xf6cb('0x2d')](_0x5768c9[_0xf6cb('0x2e')]);_0x5b6d53[_0xf6cb('0x2f')]=_['intersection'](_0x5b6d53[_0xf6cb('0x2a')],_0x5b6d53['query']);_0x4aee40[_0xf6cb('0x31')]=_['intersection'](_0x5b6d53[_0xf6cb('0x2a')],qs['fields'](_0x5768c9[_0xf6cb('0x2e')][_0xf6cb('0x32')]));_0x4aee40[_0xf6cb('0x31')]=_0x4aee40[_0xf6cb('0x31')][_0xf6cb('0x33')]?_0x4aee40[_0xf6cb('0x31')]:_0x5b6d53[_0xf6cb('0x2a')];_0x4aee40[_0xf6cb('0x36')]=qs[_0xf6cb('0x37')](_0x5768c9['query']['sort']);_0x4aee40[_0xf6cb('0x38')]=qs[_0xf6cb('0x2f')](_[_0xf6cb('0x39')](_0x5768c9['query'],_0x5b6d53[_0xf6cb('0x2f')]));if(_0x5768c9[_0xf6cb('0x2e')][_0xf6cb('0x3a')]){_0x4aee40[_0xf6cb('0x38')]=_[_0xf6cb('0x3b')](_0x4aee40[_0xf6cb('0x38')],{'$or':_[_0xf6cb('0x2b')](_0x4aee40[_0xf6cb('0x31')],function(_0x454f74){var _0x31f6fa={};_0x31f6fa[_0x454f74]={'$like':'%'+_0x5768c9[_0xf6cb('0x2e')]['filter']+'%'};return _0x31f6fa;})});}_0x4aee40=_[_0xf6cb('0x3b')]({},_0x4aee40,_0x5768c9[_0xf6cb('0x42')]);return _0x1ee32b[_0xf6cb('0x4d')](_0x4aee40);}})[_0xf6cb('0x20')](function(_0x4b3411){if(_0x4b3411){_0x345abe=_0x4b3411['length'];if(!_0x5768c9[_0xf6cb('0x2e')][_0xf6cb('0x34')](_0xf6cb('0x35'))){_0x4aee40['limit']=qs[_0xf6cb('0x1a')](_0x5768c9[_0xf6cb('0x2e')][_0xf6cb('0x1a')]);_0x4aee40[_0xf6cb('0x1c')]=qs[_0xf6cb('0x1c')](_0x5768c9[_0xf6cb('0x2e')][_0xf6cb('0x1c')]);}return _0x1ee32b['getDescriptions'](_0x4aee40);}})['then'](function(_0xd2e29){if(_0xd2e29){return _0xd2e29?{'count':_0x345abe,'rows':_0xd2e29}:null;}})[_0xf6cb('0x20')](respondWithResult(_0x5b9d93,null))[_0xf6cb('0x40')](handleError(_0x5b9d93,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 125732e..9862610 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 _0x37c2=['exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0x2d2ae2,_0x4024f3){var _0x145d00=function(_0x2b263d){while(--_0x2b263d){_0x2d2ae2['push'](_0x2d2ae2['shift']());}};_0x145d00(++_0x4024f3);}(_0x37c2,0x9e));var _0x237c=function(_0x29c070,_0x547cee){_0x29c070=_0x29c070-0x0;var _0xbb6586=_0x37c2[_0x29c070];return _0xbb6586;};'use strict';var _=require(_0x237c('0x0'));var util=require(_0x237c('0x1'));var logger=require(_0x237c('0x2'))(_0x237c('0x3'));var moment=require(_0x237c('0x4'));var BPromise=require(_0x237c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x237c('0x6'));var rimraf=require(_0x237c('0x7'));var config=require(_0x237c('0x8'));var attributes=require(_0x237c('0x9'));module[_0x237c('0xa')]=function(_0x156240,_0x30c5b0){return _0x156240[_0x237c('0xb')](_0x237c('0xc'),attributes,{'tableName':_0x237c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d7c=['moment','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','../../config/logger','api'];(function(_0x1b4eee,_0x3f3d2a){var _0x2be98=function(_0x396c76){while(--_0x396c76){_0x1b4eee['push'](_0x1b4eee['shift']());}};_0x2be98(++_0x3f3d2a);}(_0x0d7c,0x106));var _0xc0d7=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x0d7c[_0x20a558];return _0x53d3f7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc0d7('0x0'))(_0xc0d7('0x1'));var moment=require(_0xc0d7('0x2'));var BPromise=require('bluebird');var rp=require(_0xc0d7('0x3'));var fs=require('fs');var path=require(_0xc0d7('0x4'));var rimraf=require(_0xc0d7('0x5'));var config=require(_0xc0d7('0x6'));var attributes=require(_0xc0d7('0x7'));module['exports']=function(_0x485159,_0x3e54c2){return _0x485159[_0xc0d7('0x8')](_0xc0d7('0x9'),attributes,{'tableName':_0xc0d7('0xa'),'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 953e16d..65f5928 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 _0x1a41=['code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0x1a41,0x1e8));var _0x11a4=function(_0x49f1ee,_0xb7693f){_0x49f1ee=_0x49f1ee-0x0;var _0x4070a4=_0x1a41[_0x49f1ee];return _0x4070a4;};'use strict';var _=require(_0x11a4('0x0'));var util=require(_0x11a4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x11a4('0x2'));var fs=require('fs');var Redis=require(_0x11a4('0x3'));var db=require(_0x11a4('0x4'))['db'];var utils=require(_0x11a4('0x5'));var logger=require(_0x11a4('0x6'))(_0x11a4('0x7'));var config=require(_0x11a4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x11a4('0x9')][_0x11a4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fd3ef,_0x2e79de,_0x364f36){return new BPromise(function(_0x529ed4,_0x171bba){return client['request'](_0x2fd3ef,_0x364f36)[_0x11a4('0xb')](function(_0x4be104){logger[_0x11a4('0xc')](_0x11a4('0xd'),_0x2e79de,_0x11a4('0xe'));logger[_0x11a4('0xf')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x2e79de,_0x11a4('0xe'),JSON[_0x11a4('0x10')](_0x4be104));if(_0x4be104[_0x11a4('0x11')]){if(_0x4be104['error'][_0x11a4('0x12')]===0x1f4){logger[_0x11a4('0x11')](_0x11a4('0xd'),_0x2e79de,_0x4be104[_0x11a4('0x11')]['message']);return _0x171bba(_0x4be104[_0x11a4('0x11')]['message']);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x2e79de,_0x4be104[_0x11a4('0x11')][_0x11a4('0x13')]);return _0x529ed4(_0x4be104[_0x11a4('0x11')][_0x11a4('0x13')]);}else{logger['info'](_0x11a4('0xd'),_0x2e79de,_0x11a4('0xe'));_0x529ed4(_0x4be104[_0x11a4('0x14')]['message']);}})[_0x11a4('0x15')](function(_0x4fd0bb){logger[_0x11a4('0x11')](_0x11a4('0xd'),_0x2e79de,_0x4fd0bb);_0x171bba(_0x4fd0bb);});});} \ No newline at end of file +var _0xe718=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','moment'];(function(_0x17bb31,_0x2fc6f8){var _0x505c71=function(_0x5013cf){while(--_0x5013cf){_0x17bb31['push'](_0x17bb31['shift']());}};_0x505c71(++_0x2fc6f8);}(_0xe718,0xa5));var _0x8e71=function(_0x4f35f4,_0x51a8c3){_0x4f35f4=_0x4f35f4-0x0;var _0x2e9a70=_0xe718[_0x4f35f4];return _0x2e9a70;};'use strict';var _=require(_0x8e71('0x0'));var util=require(_0x8e71('0x1'));var moment=require(_0x8e71('0x2'));var BPromise=require(_0x8e71('0x3'));var rs=require(_0x8e71('0x4'));var fs=require('fs');var Redis=require(_0x8e71('0x5'));var db=require(_0x8e71('0x6'))['db'];var utils=require(_0x8e71('0x7'));var logger=require(_0x8e71('0x8'))(_0x8e71('0x9'));var config=require(_0x8e71('0xa'));var jayson=require(_0x8e71('0xb'));var client=jayson['client'][_0x8e71('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9395da,_0x3e5817,_0x34694b){return new BPromise(function(_0x5c61ae,_0x1cb26c){return client['request'](_0x9395da,_0x34694b)[_0x8e71('0xd')](function(_0x3ad187){logger['info'](_0x8e71('0xe'),_0x3e5817,'request\x20sent');logger[_0x8e71('0xf')](_0x8e71('0x10'),_0x3e5817,_0x8e71('0x11'),JSON[_0x8e71('0x12')](_0x3ad187));if(_0x3ad187['error']){if(_0x3ad187[_0x8e71('0x13')]['code']===0x1f4){logger[_0x8e71('0x13')](_0x8e71('0xe'),_0x3e5817,_0x3ad187[_0x8e71('0x13')]['message']);return _0x1cb26c(_0x3ad187['error'][_0x8e71('0x14')]);}logger[_0x8e71('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x3e5817,_0x3ad187[_0x8e71('0x13')][_0x8e71('0x14')]);return _0x5c61ae(_0x3ad187[_0x8e71('0x13')]['message']);}else{logger[_0x8e71('0x15')](_0x8e71('0xe'),_0x3e5817,_0x8e71('0x11'));_0x5c61ae(_0x3ad187[_0x8e71('0x16')]['message']);}})[_0x8e71('0x17')](function(_0x2cbc6b){logger[_0x8e71('0x13')](_0x8e71('0xe'),_0x3e5817,_0x2cbc6b);_0x1cb26c(_0x2cbc6b);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 80393eb..584ef21 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 _0x1cca=['delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','/:id','show','post','create','put','update'];(function(_0x3d73f4,_0x3aec37){var _0x2a71d7=function(_0xd01d09){while(--_0xd01d09){_0x3d73f4['push'](_0x3d73f4['shift']());}};_0x2a71d7(++_0x3aec37);}(_0x1cca,0x17c));var _0xa1cc=function(_0x4b937e,_0x342ddf){_0x4b937e=_0x4b937e-0x0;var _0x169c3c=_0x1cca[_0x4b937e];return _0x169c3c;};'use strict';var multer=require(_0xa1cc('0x0'));var util=require(_0xa1cc('0x1'));var path=require('path');var timeout=require(_0xa1cc('0x2'));var express=require(_0xa1cc('0x3'));var router=express[_0xa1cc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa1cc('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa1cc('0x6'));var controller=require(_0xa1cc('0x7'));router[_0xa1cc('0x8')]('/',auth[_0xa1cc('0x9')](),controller['index']);router[_0xa1cc('0x8')](_0xa1cc('0xa'),auth['isAuthenticated'](),controller[_0xa1cc('0xb')]);router[_0xa1cc('0xc')]('/',auth[_0xa1cc('0x9')](),controller[_0xa1cc('0xd')]);router[_0xa1cc('0xe')](_0xa1cc('0xa'),auth[_0xa1cc('0x9')](),controller[_0xa1cc('0xf')]);router[_0xa1cc('0x10')]('/:id',auth[_0xa1cc('0x9')](),controller[_0xa1cc('0x11')]);module['exports']=router; \ No newline at end of file +var _0x123f=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','create','put','/:id'];(function(_0x35aa37,_0x48d3df){var _0x3a1f43=function(_0x35355b){while(--_0x35355b){_0x35aa37['push'](_0x35aa37['shift']());}};_0x3a1f43(++_0x48d3df);}(_0x123f,0x148));var _0xf123=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x123f[_0x4e9d3c];return _0x2d0825;};'use strict';var multer=require(_0xf123('0x0'));var util=require(_0xf123('0x1'));var path=require(_0xf123('0x2'));var timeout=require(_0xf123('0x3'));var express=require(_0xf123('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf123('0x5'));var interaction=require(_0xf123('0x6'));var config=require(_0xf123('0x7'));var controller=require('./intVtigerField.controller');router[_0xf123('0x8')]('/',auth[_0xf123('0x9')](),controller[_0xf123('0xa')]);router[_0xf123('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xf123('0xb')]);router[_0xf123('0xc')](_0xf123('0xd'),auth['isAuthenticated'](),controller[_0xf123('0xe')]);router[_0xf123('0xf')](_0xf123('0xd'),auth[_0xf123('0x9')](),controller[_0xf123('0x10')]);module[_0xf123('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 3ecfbba..a888769 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 _0xc016=['keyValue','picklist','string','STRING','sequelize','exports','ENUM','variable','customVariable'];(function(_0x9119f3,_0x5364d3){var _0x336cc3=function(_0x3c8cd6){while(--_0x3c8cd6){_0x9119f3['push'](_0x9119f3['shift']());}};_0x336cc3(++_0x5364d3);}(_0xc016,0x112));var _0x6c01=function(_0x2b1a59,_0x1dafa5){_0x2b1a59=_0x2b1a59-0x0;var _0x21a2f2=_0xc016[_0x2b1a59];return _0x21a2f2;};'use strict';var Sequelize=require(_0x6c01('0x0'));module[_0x6c01('0x1')]={'type':{'type':Sequelize[_0x6c01('0x2')]('string',_0x6c01('0x3'),_0x6c01('0x4'),_0x6c01('0x5'),_0x6c01('0x6')),'defaultValue':_0x6c01('0x7')},'content':{'type':Sequelize[_0x6c01('0x8')]},'key':{'type':Sequelize[_0x6c01('0x8')]},'keyType':{'type':Sequelize[_0x6c01('0x2')](_0x6c01('0x7'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x6c01('0x8')]},'idField':{'type':Sequelize[_0x6c01('0x8')]},'nameField':{'type':Sequelize[_0x6c01('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6c01('0x8')]}}; \ No newline at end of file +var _0x9d7b=['STRING','variable','customVariable','BOOLEAN','ENUM','string','keyValue','picklist'];(function(_0x510c60,_0x50247e){var _0x49c4aa=function(_0x3149c7){while(--_0x3149c7){_0x510c60['push'](_0x510c60['shift']());}};_0x49c4aa(++_0x50247e);}(_0x9d7b,0xa4));var _0xb9d7=function(_0x10a8d6,_0x1b7b86){_0x10a8d6=_0x10a8d6-0x0;var _0x54f037=_0x9d7b[_0x10a8d6];return _0x54f037;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xb9d7('0x0')](_0xb9d7('0x1'),'variable','customVariable',_0xb9d7('0x2'),_0xb9d7('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb9d7('0x4')]},'key':{'type':Sequelize[_0xb9d7('0x4')]},'keyType':{'type':Sequelize[_0xb9d7('0x0')](_0xb9d7('0x1'),_0xb9d7('0x5'),_0xb9d7('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb9d7('0x4')]},'nameField':{'type':Sequelize[_0xb9d7('0x4')]},'customField':{'type':Sequelize[_0xb9d7('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb9d7('0x4')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 404e7fb..8cb9845 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 _0x425c=['attributes','intersection','fields','order','sort','where','pick','filter','merge','type','VtigerField','includeAll','findAll','catch','length','include','find','create','body','params','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','json','undefined','count','offset','limit','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters'];(function(_0xb52530,_0x3d9473){var _0x21a602=function(_0x58c10f){while(--_0x58c10f){_0xb52530['push'](_0xb52530['shift']());}};_0x21a602(++_0x3d9473);}(_0x425c,0x163));var _0xc425=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x425c[_0x3e5086];return _0xfeb102;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc425('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc425('0x1'));var rp=require(_0xc425('0x2'));var moment=require('moment');var BPromise=require(_0xc425('0x3'));var Mustache=require('mustache');var util=require(_0xc425('0x4'));var path=require(_0xc425('0x5'));var sox=require(_0xc425('0x6'));var csv=require(_0xc425('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc425('0x8'));var squel=require(_0xc425('0x9'));var crypto=require('crypto');var jsforce=require(_0xc425('0xa'));var deskjs=require(_0xc425('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc425('0xc'));var Papa=require(_0xc425('0xd'));var Redis=require(_0xc425('0xe'));var authService=require(_0xc425('0xf'));var qs=require(_0xc425('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc425('0x11'));var logger=require(_0xc425('0x12'))(_0xc425('0x13'));var utils=require('../../config/utils');var config=require(_0xc425('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42a047,_0xc12d85){_0xc12d85=_0xc12d85||0xcc;return function(_0x58866a){if(_0x58866a){return _0x42a047['sendStatus'](_0xc12d85);}return _0x42a047[_0xc425('0x15')](_0xc12d85)[_0xc425('0x16')]();};}function respondWithResult(_0xc47093,_0x2110e9){_0x2110e9=_0x2110e9||0xc8;return function(_0x59e938){if(_0x59e938){return _0xc47093[_0xc425('0x15')](_0x2110e9)[_0xc425('0x17')](_0x59e938);}};}function respondWithFilteredResult(_0x43214b,_0x322460){return function(_0x29471e){if(_0x29471e){var _0x1f8c72=typeof _0x322460['offset']===_0xc425('0x18')&&typeof _0x322460['limit']===_0xc425('0x18');var _0x29310a=_0x29471e[_0xc425('0x19')];var _0x564f24=_0x1f8c72?0x0:_0x322460[_0xc425('0x1a')];var _0x3ff8cf=_0x1f8c72?_0x29471e['count']:_0x322460[_0xc425('0x1a')]+_0x322460[_0xc425('0x1b')];var _0x5ad486;if(_0x3ff8cf>=_0x29310a){_0x3ff8cf=_0x29310a;_0x5ad486=0xc8;}else{_0x5ad486=0xce;}_0x43214b[_0xc425('0x15')](_0x5ad486);return _0x43214b['set']('Content-Range',_0x564f24+'-'+_0x3ff8cf+'/'+_0x29310a)[_0xc425('0x17')](_0x29471e);}return null;};}function patchUpdates(_0x500fb1){return function(_0x889338){try{jsonpatch[_0xc425('0x1c')](_0x889338,_0x500fb1,!![]);}catch(_0x53f1c0){return BPromise[_0xc425('0x1d')](_0x53f1c0);}return _0x889338[_0xc425('0x1e')]();};}function saveUpdates(_0x337934,_0x53b117){return function(_0x5376d5){if(_0x5376d5){return _0x5376d5[_0xc425('0x1f')](_0x337934)[_0xc425('0x20')](function(_0x28a445){return _0x28a445;});}return null;};}function removeEntity(_0x3befde,_0x4ff4d1){return function(_0x5128a9){if(_0x5128a9){return _0x5128a9[_0xc425('0x21')]()[_0xc425('0x20')](function(){_0x3befde['status'](0xcc)[_0xc425('0x16')]();});}};}function handleEntityNotFound(_0x143b71,_0x587493){return function(_0x3d0bee){if(!_0x3d0bee){_0x143b71[_0xc425('0x22')](0x194);}return _0x3d0bee;};}function handleError(_0xbbe25e,_0x66adeb){_0x66adeb=_0x66adeb||0x1f4;return function(_0xd90d89){logger['error'](_0xd90d89[_0xc425('0x23')]);if(_0xd90d89[_0xc425('0x24')]){delete _0xd90d89[_0xc425('0x24')];}_0xbbe25e[_0xc425('0x15')](_0x66adeb)[_0xc425('0x25')](_0xd90d89);};}exports[_0xc425('0x26')]=function(_0xe96a4c,_0x3c8f89){var _0x291e0f={},_0x32c521={},_0x420c04={'count':0x0,'rows':[]};var _0x3b4248=_[_0xc425('0x27')](db['VtigerField'][_0xc425('0x28')],function(_0x3e6039){return{'name':_0x3e6039[_0xc425('0x29')],'type':_0x3e6039['type'][_0xc425('0x2a')]};});_0x32c521[_0xc425('0x2b')]=_[_0xc425('0x27')](_0x3b4248,_0xc425('0x24'));_0x32c521[_0xc425('0x2c')]=_[_0xc425('0x2d')](_0xe96a4c[_0xc425('0x2c')]);_0x32c521[_0xc425('0x2e')]=_['intersection'](_0x32c521[_0xc425('0x2b')],_0x32c521['query']);_0x291e0f[_0xc425('0x2f')]=_[_0xc425('0x30')](_0x32c521[_0xc425('0x2b')],qs[_0xc425('0x31')](_0xe96a4c['query']['fields']));_0x291e0f[_0xc425('0x2f')]=_0x291e0f['attributes']['length']?_0x291e0f['attributes']:_0x32c521[_0xc425('0x2b')];if(!_0xe96a4c['query']['hasOwnProperty']('nolimit')){_0x291e0f[_0xc425('0x1b')]=qs[_0xc425('0x1b')](_0xe96a4c[_0xc425('0x2c')][_0xc425('0x1b')]);_0x291e0f['offset']=qs[_0xc425('0x1a')](_0xe96a4c['query']['offset']);}_0x291e0f[_0xc425('0x32')]=qs[_0xc425('0x33')](_0xe96a4c[_0xc425('0x2c')][_0xc425('0x33')]);_0x291e0f[_0xc425('0x34')]=qs['filters'](_[_0xc425('0x35')](_0xe96a4c['query'],_0x32c521[_0xc425('0x2e')]),_0x3b4248);if(_0xe96a4c['query'][_0xc425('0x36')]){_0x291e0f[_0xc425('0x34')]=_[_0xc425('0x37')](_0x291e0f[_0xc425('0x34')],{'$or':_[_0xc425('0x27')](_0x3b4248,function(_0x4623cd){if(_0x4623cd[_0xc425('0x38')]!=='VIRTUAL'){var _0x3f696e={};_0x3f696e[_0x4623cd[_0xc425('0x24')]]={'$like':'%'+_0xe96a4c[_0xc425('0x2c')]['filter']+'%'};return _0x3f696e;}})});}_0x291e0f=_[_0xc425('0x37')]({},_0x291e0f,_0xe96a4c['options']);var _0x4f6008={'where':_0x291e0f[_0xc425('0x34')]};return db[_0xc425('0x39')][_0xc425('0x19')](_0x4f6008)[_0xc425('0x20')](function(_0x2fd6cf){_0x420c04[_0xc425('0x19')]=_0x2fd6cf;if(_0xe96a4c['query'][_0xc425('0x3a')]){_0x291e0f['include']=[{'all':!![]}];}return db[_0xc425('0x39')][_0xc425('0x3b')](_0x291e0f);})['then'](function(_0xdee64c){_0x420c04['rows']=_0xdee64c;return _0x420c04;})[_0xc425('0x20')](respondWithFilteredResult(_0x3c8f89,_0x291e0f))[_0xc425('0x3c')](handleError(_0x3c8f89,null));};exports['show']=function(_0x2c2485,_0x14b634){var _0x17fd33={'raw':!![],'where':{'id':_0x2c2485['params']['id']}},_0x4a7404={};_0x4a7404[_0xc425('0x2b')]=_[_0xc425('0x2d')](db[_0xc425('0x39')]['rawAttributes']);_0x4a7404[_0xc425('0x2c')]=_[_0xc425('0x2d')](_0x2c2485[_0xc425('0x2c')]);_0x4a7404[_0xc425('0x2e')]=_[_0xc425('0x30')](_0x4a7404[_0xc425('0x2b')],_0x4a7404['query']);_0x17fd33[_0xc425('0x2f')]=_[_0xc425('0x30')](_0x4a7404[_0xc425('0x2b')],qs[_0xc425('0x31')](_0x2c2485[_0xc425('0x2c')]['fields']));_0x17fd33[_0xc425('0x2f')]=_0x17fd33[_0xc425('0x2f')][_0xc425('0x3d')]?_0x17fd33[_0xc425('0x2f')]:_0x4a7404[_0xc425('0x2b')];if(_0x2c2485[_0xc425('0x2c')][_0xc425('0x3a')]){_0x17fd33[_0xc425('0x3e')]=[{'all':!![]}];}_0x17fd33=_[_0xc425('0x37')]({},_0x17fd33,_0x2c2485['options']);return db[_0xc425('0x39')][_0xc425('0x3f')](_0x17fd33)[_0xc425('0x20')](handleEntityNotFound(_0x14b634,null))[_0xc425('0x20')](respondWithResult(_0x14b634,null))[_0xc425('0x3c')](handleError(_0x14b634,null));};exports[_0xc425('0x40')]=function(_0x10581c,_0x494295){return db[_0xc425('0x39')][_0xc425('0x40')](_0x10581c['body'],{})[_0xc425('0x20')](respondWithResult(_0x494295,0xc9))[_0xc425('0x3c')](handleError(_0x494295,null));};exports[_0xc425('0x1f')]=function(_0x22ec28,_0x54edcb){if(_0x22ec28[_0xc425('0x41')]['id']){delete _0x22ec28['body']['id'];}return db[_0xc425('0x39')][_0xc425('0x3f')]({'where':{'id':_0x22ec28[_0xc425('0x42')]['id']}})['then'](handleEntityNotFound(_0x54edcb,null))[_0xc425('0x20')](saveUpdates(_0x22ec28['body'],null))['then'](respondWithResult(_0x54edcb,null))['catch'](handleError(_0x54edcb,null));};exports[_0xc425('0x21')]=function(_0x4263c3,_0x5630c5){return db['VtigerField'][_0xc425('0x3f')]({'where':{'id':_0x4263c3[_0xc425('0x42')]['id']}})[_0xc425('0x20')](handleEntityNotFound(_0x5630c5,null))[_0xc425('0x20')](removeEntity(_0x5630c5,null))[_0xc425('0x3c')](handleError(_0x5630c5,null));}; \ No newline at end of file +var _0x50dc=['count','limit','Content-Range','save','update','then','sendStatus','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','params','find','create','body','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','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','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined'];(function(_0x5d2421,_0xe829ac){var _0x28f318=function(_0x3332fd){while(--_0x3332fd){_0x5d2421['push'](_0x5d2421['shift']());}};_0x28f318(++_0xe829ac);}(_0x50dc,0xb4));var _0xc50d=function(_0x1bb8be,_0x7fc1ac){_0x1bb8be=_0x1bb8be-0x0;var _0x2549d5=_0x50dc[_0x1bb8be];return _0x2549d5;};'use strict';var emlformat=require(_0xc50d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc50d('0x1'));var jsonpatch=require(_0xc50d('0x2'));var rp=require(_0xc50d('0x3'));var moment=require(_0xc50d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc50d('0x5'));var util=require('util');var path=require(_0xc50d('0x6'));var sox=require(_0xc50d('0x7'));var csv=require(_0xc50d('0x8'));var ejs=require(_0xc50d('0x9'));var fs=require('fs');var fs_extra=require(_0xc50d('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc50d('0xb'));var deskjs=require(_0xc50d('0xc'));var toCsv=require(_0xc50d('0x8'));var querystring=require(_0xc50d('0xd'));var Papa=require(_0xc50d('0xe'));var Redis=require(_0xc50d('0xf'));var authService=require(_0xc50d('0x10'));var qs=require(_0xc50d('0x11'));var as=require(_0xc50d('0x12'));var hardwareService=require(_0xc50d('0x13'));var logger=require(_0xc50d('0x14'))(_0xc50d('0x15'));var utils=require(_0xc50d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc50d('0x17'));var db=require(_0xc50d('0x18'))['db'];function respondWithStatusCode(_0x43cb9f,_0x2b2864){_0x2b2864=_0x2b2864||0xcc;return function(_0x578273){if(_0x578273){return _0x43cb9f['sendStatus'](_0x2b2864);}return _0x43cb9f[_0xc50d('0x19')](_0x2b2864)[_0xc50d('0x1a')]();};}function respondWithResult(_0x887464,_0x431d98){_0x431d98=_0x431d98||0xc8;return function(_0x1c2c27){if(_0x1c2c27){return _0x887464[_0xc50d('0x19')](_0x431d98)[_0xc50d('0x1b')](_0x1c2c27);}};}function respondWithFilteredResult(_0xaa8801,_0x522cc6){return function(_0x531f39){if(_0x531f39){var _0x3f6b60=typeof _0x522cc6[_0xc50d('0x1c')]===_0xc50d('0x1d')&&typeof _0x522cc6['limit']===_0xc50d('0x1d');var _0x113866=_0x531f39[_0xc50d('0x1e')];var _0x7d5da6=_0x3f6b60?0x0:_0x522cc6[_0xc50d('0x1c')];var _0xcc9688=_0x3f6b60?_0x531f39[_0xc50d('0x1e')]:_0x522cc6[_0xc50d('0x1c')]+_0x522cc6[_0xc50d('0x1f')];var _0x3eeaeb;if(_0xcc9688>=_0x113866){_0xcc9688=_0x113866;_0x3eeaeb=0xc8;}else{_0x3eeaeb=0xce;}_0xaa8801[_0xc50d('0x19')](_0x3eeaeb);return _0xaa8801['set'](_0xc50d('0x20'),_0x7d5da6+'-'+_0xcc9688+'/'+_0x113866)[_0xc50d('0x1b')](_0x531f39);}return null;};}function patchUpdates(_0x304c42){return function(_0x48bedb){try{jsonpatch['apply'](_0x48bedb,_0x304c42,!![]);}catch(_0x1bfdba){return BPromise['reject'](_0x1bfdba);}return _0x48bedb[_0xc50d('0x21')]();};}function saveUpdates(_0x2b4044,_0x25a9d6){return function(_0x21c709){if(_0x21c709){return _0x21c709[_0xc50d('0x22')](_0x2b4044)['then'](function(_0x3b1fee){return _0x3b1fee;});}return null;};}function removeEntity(_0x218f09,_0x3193da){return function(_0x4eb6e9){if(_0x4eb6e9){return _0x4eb6e9['destroy']()[_0xc50d('0x23')](function(){_0x218f09[_0xc50d('0x19')](0xcc)[_0xc50d('0x1a')]();});}};}function handleEntityNotFound(_0x5c3aaa,_0x594df1){return function(_0x1e712d){if(!_0x1e712d){_0x5c3aaa[_0xc50d('0x24')](0x194);}return _0x1e712d;};}function handleError(_0x421e8e,_0x6d5d5b){_0x6d5d5b=_0x6d5d5b||0x1f4;return function(_0x275ade){logger[_0xc50d('0x25')](_0x275ade[_0xc50d('0x26')]);if(_0x275ade[_0xc50d('0x27')]){delete _0x275ade[_0xc50d('0x27')];}_0x421e8e['status'](_0x6d5d5b)[_0xc50d('0x28')](_0x275ade);};}exports[_0xc50d('0x29')]=function(_0x42e005,_0x59e513){var _0x4046ea={},_0x170fcc={},_0x4ac403={'count':0x0,'rows':[]};var _0x5ec965=_[_0xc50d('0x2a')](db[_0xc50d('0x2b')][_0xc50d('0x2c')],function(_0x5b2b4b){return{'name':_0x5b2b4b[_0xc50d('0x2d')],'type':_0x5b2b4b[_0xc50d('0x2e')][_0xc50d('0x2f')]};});_0x170fcc[_0xc50d('0x30')]=_[_0xc50d('0x2a')](_0x5ec965,'name');_0x170fcc[_0xc50d('0x31')]=_[_0xc50d('0x32')](_0x42e005[_0xc50d('0x31')]);_0x170fcc['filters']=_[_0xc50d('0x33')](_0x170fcc[_0xc50d('0x30')],_0x170fcc[_0xc50d('0x31')]);_0x4046ea[_0xc50d('0x34')]=_[_0xc50d('0x33')](_0x170fcc['model'],qs[_0xc50d('0x35')](_0x42e005[_0xc50d('0x31')][_0xc50d('0x35')]));_0x4046ea[_0xc50d('0x34')]=_0x4046ea[_0xc50d('0x34')][_0xc50d('0x36')]?_0x4046ea[_0xc50d('0x34')]:_0x170fcc[_0xc50d('0x30')];if(!_0x42e005[_0xc50d('0x31')][_0xc50d('0x37')](_0xc50d('0x38'))){_0x4046ea[_0xc50d('0x1f')]=qs[_0xc50d('0x1f')](_0x42e005[_0xc50d('0x31')][_0xc50d('0x1f')]);_0x4046ea[_0xc50d('0x1c')]=qs['offset'](_0x42e005['query']['offset']);}_0x4046ea['order']=qs['sort'](_0x42e005[_0xc50d('0x31')]['sort']);_0x4046ea[_0xc50d('0x39')]=qs[_0xc50d('0x3a')](_['pick'](_0x42e005['query'],_0x170fcc[_0xc50d('0x3a')]),_0x5ec965);if(_0x42e005[_0xc50d('0x31')][_0xc50d('0x3b')]){_0x4046ea[_0xc50d('0x39')]=_[_0xc50d('0x3c')](_0x4046ea[_0xc50d('0x39')],{'$or':_[_0xc50d('0x2a')](_0x5ec965,function(_0x517878){if(_0x517878[_0xc50d('0x2e')]!==_0xc50d('0x3d')){var _0x538985={};_0x538985[_0x517878[_0xc50d('0x27')]]={'$like':'%'+_0x42e005[_0xc50d('0x31')]['filter']+'%'};return _0x538985;}})});}_0x4046ea=_[_0xc50d('0x3c')]({},_0x4046ea,_0x42e005[_0xc50d('0x3e')]);var _0x4118f5={'where':_0x4046ea[_0xc50d('0x39')]};return db[_0xc50d('0x2b')][_0xc50d('0x1e')](_0x4118f5)[_0xc50d('0x23')](function(_0x1fe97a){_0x4ac403[_0xc50d('0x1e')]=_0x1fe97a;if(_0x42e005['query'][_0xc50d('0x3f')]){_0x4046ea['include']=[{'all':!![]}];}return db[_0xc50d('0x2b')][_0xc50d('0x40')](_0x4046ea);})[_0xc50d('0x23')](function(_0x4bcbfa){_0x4ac403['rows']=_0x4bcbfa;return _0x4ac403;})['then'](respondWithFilteredResult(_0x59e513,_0x4046ea))['catch'](handleError(_0x59e513,null));};exports['show']=function(_0xd440d5,_0x41fad0){var _0x46fac3={'raw':!![],'where':{'id':_0xd440d5[_0xc50d('0x41')]['id']}},_0x3c4a59={};_0x3c4a59[_0xc50d('0x30')]=_[_0xc50d('0x32')](db[_0xc50d('0x2b')]['rawAttributes']);_0x3c4a59[_0xc50d('0x31')]=_['keys'](_0xd440d5[_0xc50d('0x31')]);_0x3c4a59['filters']=_[_0xc50d('0x33')](_0x3c4a59[_0xc50d('0x30')],_0x3c4a59['query']);_0x46fac3[_0xc50d('0x34')]=_[_0xc50d('0x33')](_0x3c4a59[_0xc50d('0x30')],qs[_0xc50d('0x35')](_0xd440d5[_0xc50d('0x31')]['fields']));_0x46fac3[_0xc50d('0x34')]=_0x46fac3['attributes'][_0xc50d('0x36')]?_0x46fac3[_0xc50d('0x34')]:_0x3c4a59[_0xc50d('0x30')];if(_0xd440d5[_0xc50d('0x31')]['includeAll']){_0x46fac3['include']=[{'all':!![]}];}_0x46fac3=_[_0xc50d('0x3c')]({},_0x46fac3,_0xd440d5['options']);return db['VtigerField'][_0xc50d('0x42')](_0x46fac3)[_0xc50d('0x23')](handleEntityNotFound(_0x41fad0,null))[_0xc50d('0x23')](respondWithResult(_0x41fad0,null))['catch'](handleError(_0x41fad0,null));};exports['create']=function(_0x449191,_0x5ee96f){return db[_0xc50d('0x2b')][_0xc50d('0x43')](_0x449191[_0xc50d('0x44')],{})[_0xc50d('0x23')](respondWithResult(_0x5ee96f,0xc9))['catch'](handleError(_0x5ee96f,null));};exports[_0xc50d('0x22')]=function(_0x5b4d37,_0x4c3e13){if(_0x5b4d37['body']['id']){delete _0x5b4d37[_0xc50d('0x44')]['id'];}return db[_0xc50d('0x2b')][_0xc50d('0x42')]({'where':{'id':_0x5b4d37[_0xc50d('0x41')]['id']}})[_0xc50d('0x23')](handleEntityNotFound(_0x4c3e13,null))[_0xc50d('0x23')](saveUpdates(_0x5b4d37[_0xc50d('0x44')],null))[_0xc50d('0x23')](respondWithResult(_0x4c3e13,null))[_0xc50d('0x45')](handleError(_0x4c3e13,null));};exports['destroy']=function(_0x53891c,_0x3cdd6e){return db['VtigerField']['find']({'where':{'id':_0x53891c[_0xc50d('0x41')]['id']}})[_0xc50d('0x23')](handleEntityNotFound(_0x3cdd6e,null))[_0xc50d('0x23')](removeEntity(_0x3cdd6e,null))[_0xc50d('0x45')](handleError(_0x3cdd6e,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 6aa8935..8a707d8 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 _0xbb43=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util'];(function(_0x5d7700,_0x4de584){var _0x5322cc=function(_0x418245){while(--_0x418245){_0x5d7700['push'](_0x5d7700['shift']());}};_0x5322cc(++_0x4de584);}(_0xbb43,0x12e));var _0x3bb4=function(_0x54ccd7,_0x3bc3ce){_0x54ccd7=_0x54ccd7-0x0;var _0x4e667b=_0xbb43[_0x54ccd7];return _0x4e667b;};'use strict';var _=require(_0x3bb4('0x0'));var util=require(_0x3bb4('0x1'));var logger=require('../../config/logger')(_0x3bb4('0x2'));var moment=require(_0x3bb4('0x3'));var BPromise=require(_0x3bb4('0x4'));var rp=require(_0x3bb4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3bb4('0x6'));var config=require(_0x3bb4('0x7'));var attributes=require(_0x3bb4('0x8'));module[_0x3bb4('0x9')]=function(_0x4f6bc5,_0x27048c){return _0x4f6bc5[_0x3bb4('0xa')](_0x3bb4('0xb'),attributes,{'tableName':_0x3bb4('0xc'),'paranoid':![],'indexes':[{'name':_0x3bb4('0xd'),'fields':[_0x3bb4('0xe'),_0x3bb4('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x31f0=['../../config/environment','exports','define','idField','FieldId','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2de0a7,_0x38d3e7){var _0x429437=function(_0x23c148){while(--_0x23c148){_0x2de0a7['push'](_0x2de0a7['shift']());}};_0x429437(++_0x38d3e7);}(_0x31f0,0x185));var _0x031f=function(_0x14f44e,_0x4541a2){_0x14f44e=_0x14f44e-0x0;var _0x157d6d=_0x31f0[_0x14f44e];return _0x157d6d;};'use strict';var _=require('lodash');var util=require(_0x031f('0x0'));var logger=require(_0x031f('0x1'))(_0x031f('0x2'));var moment=require('moment');var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require(_0x031f('0x6'));var config=require(_0x031f('0x7'));var attributes=require('./intVtigerField.attributes');module[_0x031f('0x8')]=function(_0x2fba84,_0x575aa6){return _0x2fba84[_0x031f('0x9')]('VtigerField',attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x031f('0xa'),_0x031f('0xb')],'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 b045512..a9ec3ae 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 _0x56b2=['code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x322016,_0x338bca){var _0x3c0fea=function(_0x2ab703){while(--_0x2ab703){_0x322016['push'](_0x322016['shift']());}};_0x3c0fea(++_0x338bca);}(_0x56b2,0x1d0));var _0x256b=function(_0x1f6d87,_0x42edb6){_0x1f6d87=_0x1f6d87-0x0;var _0x283b0a=_0x56b2[_0x1f6d87];return _0x283b0a;};'use strict';var _=require(_0x256b('0x0'));var util=require('util');var moment=require(_0x256b('0x1'));var BPromise=require('bluebird');var rs=require(_0x256b('0x2'));var fs=require('fs');var Redis=require(_0x256b('0x3'));var db=require(_0x256b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x256b('0x5'))(_0x256b('0x6'));var config=require(_0x256b('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x256b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c09ea,_0x3bfacd,_0x558ed7){return new BPromise(function(_0x3eeff9,_0x45f44a){return client['request'](_0x5c09ea,_0x558ed7)[_0x256b('0x9')](function(_0x3a93aa){logger[_0x256b('0xa')](_0x256b('0xb'),_0x3bfacd,'request\x20sent');logger[_0x256b('0xc')](_0x256b('0xd'),_0x3bfacd,_0x256b('0xe'),JSON['stringify'](_0x3a93aa));if(_0x3a93aa[_0x256b('0xf')]){if(_0x3a93aa['error'][_0x256b('0x10')]===0x1f4){logger[_0x256b('0xf')]('VtigerField,\x20%s,\x20%s',_0x3bfacd,_0x3a93aa[_0x256b('0xf')]['message']);return _0x45f44a(_0x3a93aa[_0x256b('0xf')][_0x256b('0x11')]);}logger[_0x256b('0xf')]('VtigerField,\x20%s,\x20%s',_0x3bfacd,_0x3a93aa[_0x256b('0xf')][_0x256b('0x11')]);return _0x3eeff9(_0x3a93aa[_0x256b('0xf')][_0x256b('0x11')]);}else{logger['info'](_0x256b('0xb'),_0x3bfacd,_0x256b('0xe'));_0x3eeff9(_0x3a93aa[_0x256b('0x12')][_0x256b('0x11')]);}})[_0x256b('0x13')](function(_0x5f1810){logger[_0x256b('0xf')]('VtigerField,\x20%s,\x20%s',_0x3bfacd,_0x5f1810);_0x45f44a(_0x5f1810);});});} \ No newline at end of file +var _0x2768=['then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x2768,0x13f));var _0x8276=function(_0x12b485,_0x529e20){_0x12b485=_0x12b485-0x0;var _0x2efbcf=_0x2768[_0x12b485];return _0x2efbcf;};'use strict';var _=require(_0x8276('0x0'));var util=require(_0x8276('0x1'));var moment=require(_0x8276('0x2'));var BPromise=require(_0x8276('0x3'));var rs=require(_0x8276('0x4'));var fs=require('fs');var Redis=require(_0x8276('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8276('0x6'))('rpc');var config=require(_0x8276('0x7'));var jayson=require(_0x8276('0x8'));var client=jayson[_0x8276('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1248d0,_0x221f35,_0x4ec3b4){return new BPromise(function(_0x52a6ef,_0x464dd3){return client[_0x8276('0xa')](_0x1248d0,_0x4ec3b4)[_0x8276('0xb')](function(_0x20809e){logger[_0x8276('0xc')](_0x8276('0xd'),_0x221f35,_0x8276('0xe'));logger[_0x8276('0xf')](_0x8276('0x10'),_0x221f35,'request\x20sent',JSON[_0x8276('0x11')](_0x20809e));if(_0x20809e['error']){if(_0x20809e['error'][_0x8276('0x12')]===0x1f4){logger[_0x8276('0x13')]('VtigerField,\x20%s,\x20%s',_0x221f35,_0x20809e[_0x8276('0x13')]['message']);return _0x464dd3(_0x20809e[_0x8276('0x13')][_0x8276('0x14')]);}logger['error']('VtigerField,\x20%s,\x20%s',_0x221f35,_0x20809e[_0x8276('0x13')][_0x8276('0x14')]);return _0x52a6ef(_0x20809e['error']['message']);}else{logger[_0x8276('0xc')](_0x8276('0xd'),_0x221f35,_0x8276('0xe'));_0x52a6ef(_0x20809e[_0x8276('0x15')][_0x8276('0x14')]);}})['catch'](function(_0x3ca634){logger[_0x8276('0x13')](_0x8276('0xd'),_0x221f35,_0x3ca634);_0x464dd3(_0x3ca634);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 290ceb6..313ca36 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 _0x5465=['getFields','create','post','addConfiguration','update','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x10bf5d,_0x10a3a9){var _0x27f511=function(_0x209cf3){while(--_0x209cf3){_0x10bf5d['push'](_0x10bf5d['shift']());}};_0x27f511(++_0x10a3a9);}(_0x5465,0x150));var _0x5546=function(_0xa3582e,_0x16ebb7){_0xa3582e=_0xa3582e-0x0;var _0x262a3a=_0x5465[_0xa3582e];return _0x262a3a;};'use strict';var multer=require(_0x5546('0x0'));var util=require(_0x5546('0x1'));var path=require(_0x5546('0x2'));var timeout=require(_0x5546('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5546('0x4'));var interaction=require(_0x5546('0x5'));var config=require(_0x5546('0x6'));var controller=require(_0x5546('0x7'));router[_0x5546('0x8')]('/',auth[_0x5546('0x9')](),controller[_0x5546('0xa')]);router['get'](_0x5546('0xb'),auth[_0x5546('0x9')](),controller[_0x5546('0xc')]);router[_0x5546('0x8')](_0x5546('0xd'),auth['isAuthenticated'](),controller[_0x5546('0xe')]);router[_0x5546('0x8')](_0x5546('0xf'),auth[_0x5546('0x9')](),controller[_0x5546('0x10')]);router['post']('/',auth[_0x5546('0x9')](),controller[_0x5546('0x11')]);router[_0x5546('0x12')](_0x5546('0xd'),auth[_0x5546('0x9')](),controller[_0x5546('0x13')]);router['put']('/:id',auth[_0x5546('0x9')](),controller[_0x5546('0x14')]);router['delete'](_0x5546('0xb'),auth[_0x5546('0x9')](),controller[_0x5546('0x15')]);module['exports']=router; \ No newline at end of file +var _0xbbcd=['index','/:id','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated'];(function(_0x493985,_0xabbee5){var _0x532b94=function(_0x150fbc){while(--_0x150fbc){_0x493985['push'](_0x493985['shift']());}};_0x532b94(++_0xabbee5);}(_0xbbcd,0xa1));var _0xdbbc=function(_0x26c0e0,_0xfe057c){_0x26c0e0=_0x26c0e0-0x0;var _0x4ac795=_0xbbcd[_0x26c0e0];return _0x4ac795;};'use strict';var multer=require(_0xdbbc('0x0'));var util=require(_0xdbbc('0x1'));var path=require(_0xdbbc('0x2'));var timeout=require(_0xdbbc('0x3'));var express=require(_0xdbbc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdbbc('0x5'));var interaction=require(_0xdbbc('0x6'));var config=require('../../config/environment');var controller=require(_0xdbbc('0x7'));router[_0xdbbc('0x8')]('/',auth[_0xdbbc('0x9')](),controller[_0xdbbc('0xa')]);router[_0xdbbc('0x8')](_0xdbbc('0xb'),auth[_0xdbbc('0x9')](),controller['show']);router['get'](_0xdbbc('0xc'),auth[_0xdbbc('0x9')](),controller[_0xdbbc('0xd')]);router[_0xdbbc('0x8')]('/:id/fields',auth[_0xdbbc('0x9')](),controller[_0xdbbc('0xe')]);router[_0xdbbc('0xf')]('/',auth[_0xdbbc('0x9')](),controller[_0xdbbc('0x10')]);router['post']('/:id/configurations',auth[_0xdbbc('0x9')](),controller[_0xdbbc('0x11')]);router[_0xdbbc('0x12')](_0xdbbc('0xb'),auth[_0xdbbc('0x9')](),controller['update']);router['delete'](_0xdbbc('0xb'),auth['isAuthenticated'](),controller['destroy']);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 518173e..56c4cfd 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 _0x14b2=['username','remoteUri','token','password','ENUM','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x44a64f,_0x38475c){var _0x52024b=function(_0x2cd055){while(--_0x2cd055){_0x44a64f['push'](_0x44a64f['shift']());}};_0x52024b(++_0x38475c);}(_0x14b2,0x1a1));var _0x214b=function(_0x42deb8,_0x45e3c6){_0x42deb8=_0x42deb8-0x0;var _0x6a961=_0x14b2[_0x42deb8];return _0x6a961;};'use strict';var Sequelize=require(_0x214b('0x0'));module[_0x214b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x214b('0x2')]},'username':{'type':Sequelize[_0x214b('0x2')],'unique':_0x214b('0x3')},'password':{'type':Sequelize[_0x214b('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x214b('0x2')],'unique':_0x214b('0x4')},'authType':{'type':Sequelize['ENUM']('password',_0x214b('0x5')),'defaultValue':_0x214b('0x6')},'serverUrl':{'type':Sequelize[_0x214b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x214b('0x7')](_0x214b('0x8'),_0x214b('0x9')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x524e=['STRING','username','remoteUri','ENUM','password','newTab','integrationTab'];(function(_0x59f9b5,_0x3e7bbc){var _0x38a78f=function(_0x104a27){while(--_0x104a27){_0x59f9b5['push'](_0x59f9b5['shift']());}};_0x38a78f(++_0x3e7bbc);}(_0x524e,0x15e));var _0xe524=function(_0x147327,_0x61607b){_0x147327=_0x147327-0x0;var _0x5b7720=_0x524e[_0x147327];return _0x5b7720;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe524('0x0')]},'description':{'type':Sequelize[_0xe524('0x0')]},'username':{'type':Sequelize[_0xe524('0x0')],'unique':_0xe524('0x1')},'password':{'type':Sequelize[_0xe524('0x0')]},'token':{'type':Sequelize[_0xe524('0x0')]},'remoteUri':{'type':Sequelize[_0xe524('0x0')],'unique':_0xe524('0x2')},'authType':{'type':Sequelize[_0xe524('0x3')](_0xe524('0x4'),'token'),'defaultValue':_0xe524('0x4')},'serverUrl':{'type':Sequelize[_0xe524('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xe524('0x3')]('integrationTab',_0xe524('0x5')),'defaultValue':_0xe524('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 26718a4..0d99d69 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 _0x0102=['VIRTUAL','options','ZendeskAccount','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','body','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','ZendeskConfiguration','ZendeskField','getFields','password','token','authType','remoteUri','slice','lastIndexOf','format','%s/%s','ticket_fields','headers','%s:%s','toString','base64','Basic\x20%s','%s/token:%s','username','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','remove','includes','title','system_field_options','custom_field_options','test','statusCode','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','sox','to-csv','ejs','fs-extra','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','../../components/integrations/configuration','status','end','offset','undefined','limit','count','json','apply','reject','then','sendStatus','error','stack','name','send','index','map','type','key','query','keys','intersection','model','fields','attributes','length','order','sort','where','pick','filters','filter','merge'];(function(_0x246851,_0x2fdedf){var _0x56c737=function(_0x1a2bc1){while(--_0x1a2bc1){_0x246851['push'](_0x246851['shift']());}};_0x56c737(++_0x2fdedf);}(_0x0102,0x186));var _0x2010=function(_0x40140f,_0x5090ee){_0x40140f=_0x40140f-0x0;var _0xc43e9d=_0x0102[_0x40140f];return _0xc43e9d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2010('0x0'));var zipdir=require(_0x2010('0x1'));var jsonpatch=require(_0x2010('0x2'));var rp=require(_0x2010('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2010('0x4'));var csv=require(_0x2010('0x5'));var ejs=require(_0x2010('0x6'));var fs=require('fs');var fs_extra=require(_0x2010('0x7'));var _=require('lodash');var squel=require(_0x2010('0x8'));var crypto=require('crypto');var jsforce=require(_0x2010('0x9'));var deskjs=require(_0x2010('0xa'));var toCsv=require('to-csv');var querystring=require(_0x2010('0xb'));var Papa=require(_0x2010('0xc'));var Redis=require(_0x2010('0xd'));var authService=require(_0x2010('0xe'));var qs=require(_0x2010('0xf'));var as=require(_0x2010('0x10'));var hardwareService=require(_0x2010('0x11'));var logger=require(_0x2010('0x12'))(_0x2010('0x13'));var utils=require(_0x2010('0x14'));var config=require(_0x2010('0x15'));var licenseUtil=require(_0x2010('0x16'));var db=require(_0x2010('0x17'))['db'];var integrations=require(_0x2010('0x18'));function respondWithStatusCode(_0x3e8624,_0x388991){_0x388991=_0x388991||0xcc;return function(_0x528a38){if(_0x528a38){return _0x3e8624['sendStatus'](_0x388991);}return _0x3e8624[_0x2010('0x19')](_0x388991)[_0x2010('0x1a')]();};}function respondWithResult(_0x2e8ec2,_0x10b587){_0x10b587=_0x10b587||0xc8;return function(_0x32d791){if(_0x32d791){return _0x2e8ec2[_0x2010('0x19')](_0x10b587)['json'](_0x32d791);}};}function respondWithFilteredResult(_0x3195fa,_0x136418){return function(_0x5ad412){if(_0x5ad412){var _0x41e267=typeof _0x136418[_0x2010('0x1b')]===_0x2010('0x1c')&&typeof _0x136418[_0x2010('0x1d')]===_0x2010('0x1c');var _0x11bd28=_0x5ad412[_0x2010('0x1e')];var _0x1476c0=_0x41e267?0x0:_0x136418[_0x2010('0x1b')];var _0x569de2=_0x41e267?_0x5ad412['count']:_0x136418[_0x2010('0x1b')]+_0x136418[_0x2010('0x1d')];var _0x3f9d62;if(_0x569de2>=_0x11bd28){_0x569de2=_0x11bd28;_0x3f9d62=0xc8;}else{_0x3f9d62=0xce;}_0x3195fa[_0x2010('0x19')](_0x3f9d62);return _0x3195fa['set']('Content-Range',_0x1476c0+'-'+_0x569de2+'/'+_0x11bd28)[_0x2010('0x1f')](_0x5ad412);}return null;};}function patchUpdates(_0x171e45){return function(_0x37b51b){try{jsonpatch[_0x2010('0x20')](_0x37b51b,_0x171e45,!![]);}catch(_0x103bbc){return BPromise[_0x2010('0x21')](_0x103bbc);}return _0x37b51b['save']();};}function saveUpdates(_0x3db13d,_0x1cfa57){return function(_0x58ff30){if(_0x58ff30){return _0x58ff30['update'](_0x3db13d)['then'](function(_0x424453){return _0x424453;});}return null;};}function removeEntity(_0x574719,_0x277dcc){return function(_0x5f4233){if(_0x5f4233){return _0x5f4233['destroy']()[_0x2010('0x22')](function(){_0x574719[_0x2010('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x99ebe0,_0x4cff59){return function(_0x2a12ee){if(!_0x2a12ee){_0x99ebe0[_0x2010('0x23')](0x194);}return _0x2a12ee;};}function handleError(_0x3929d9,_0x3dcea4){_0x3dcea4=_0x3dcea4||0x1f4;return function(_0x3c5862){logger[_0x2010('0x24')](_0x3c5862[_0x2010('0x25')]);if(_0x3c5862[_0x2010('0x26')]){delete _0x3c5862[_0x2010('0x26')];}_0x3929d9[_0x2010('0x19')](_0x3dcea4)[_0x2010('0x27')](_0x3c5862);};}exports[_0x2010('0x28')]=function(_0x499cbe,_0x2a4691){var _0x52fe5e={},_0x5b52fb={},_0x147a5a={'count':0x0,'rows':[]};var _0xd16c04=_[_0x2010('0x29')](db['ZendeskAccount']['rawAttributes'],function(_0x136d5f){return{'name':_0x136d5f['fieldName'],'type':_0x136d5f[_0x2010('0x2a')][_0x2010('0x2b')]};});_0x5b52fb['model']=_[_0x2010('0x29')](_0xd16c04,_0x2010('0x26'));_0x5b52fb[_0x2010('0x2c')]=_[_0x2010('0x2d')](_0x499cbe[_0x2010('0x2c')]);_0x5b52fb['filters']=_[_0x2010('0x2e')](_0x5b52fb[_0x2010('0x2f')],_0x5b52fb[_0x2010('0x2c')]);_0x52fe5e['attributes']=_['intersection'](_0x5b52fb[_0x2010('0x2f')],qs[_0x2010('0x30')](_0x499cbe[_0x2010('0x2c')]['fields']));_0x52fe5e['attributes']=_0x52fe5e[_0x2010('0x31')][_0x2010('0x32')]?_0x52fe5e[_0x2010('0x31')]:_0x5b52fb[_0x2010('0x2f')];if(!_0x499cbe[_0x2010('0x2c')]['hasOwnProperty']('nolimit')){_0x52fe5e['limit']=qs[_0x2010('0x1d')](_0x499cbe[_0x2010('0x2c')][_0x2010('0x1d')]);_0x52fe5e['offset']=qs[_0x2010('0x1b')](_0x499cbe[_0x2010('0x2c')][_0x2010('0x1b')]);}_0x52fe5e[_0x2010('0x33')]=qs['sort'](_0x499cbe[_0x2010('0x2c')][_0x2010('0x34')]);_0x52fe5e[_0x2010('0x35')]=qs['filters'](_[_0x2010('0x36')](_0x499cbe['query'],_0x5b52fb[_0x2010('0x37')]),_0xd16c04);if(_0x499cbe[_0x2010('0x2c')][_0x2010('0x38')]){_0x52fe5e[_0x2010('0x35')]=_[_0x2010('0x39')](_0x52fe5e[_0x2010('0x35')],{'$or':_['map'](_0xd16c04,function(_0x1e4460){if(_0x1e4460['type']!==_0x2010('0x3a')){var _0x157c73={};_0x157c73[_0x1e4460[_0x2010('0x26')]]={'$like':'%'+_0x499cbe[_0x2010('0x2c')][_0x2010('0x38')]+'%'};return _0x157c73;}})});}_0x52fe5e=_[_0x2010('0x39')]({},_0x52fe5e,_0x499cbe[_0x2010('0x3b')]);var _0x36ff3e={'where':_0x52fe5e[_0x2010('0x35')]};return db[_0x2010('0x3c')][_0x2010('0x1e')](_0x36ff3e)[_0x2010('0x22')](function(_0x1c2b13){_0x147a5a[_0x2010('0x1e')]=_0x1c2b13;if(_0x499cbe['query']['includeAll']){_0x52fe5e[_0x2010('0x3d')]=[{'all':!![]}];}return db[_0x2010('0x3c')][_0x2010('0x3e')](_0x52fe5e);})[_0x2010('0x22')](function(_0x3d5906){_0x147a5a[_0x2010('0x3f')]=_0x3d5906;return _0x147a5a;})[_0x2010('0x22')](respondWithFilteredResult(_0x2a4691,_0x52fe5e))['catch'](handleError(_0x2a4691,null));};exports[_0x2010('0x40')]=function(_0x578645,_0x27fd64){var _0x3ff496={'raw':![],'where':{'id':_0x578645[_0x2010('0x41')]['id']}},_0x16db82={};_0x16db82[_0x2010('0x2f')]=_['keys'](db[_0x2010('0x3c')][_0x2010('0x42')]);_0x16db82[_0x2010('0x2c')]=_[_0x2010('0x2d')](_0x578645['query']);_0x16db82[_0x2010('0x37')]=_['intersection'](_0x16db82['model'],_0x16db82['query']);_0x3ff496[_0x2010('0x31')]=_[_0x2010('0x2e')](_0x16db82[_0x2010('0x2f')],qs[_0x2010('0x30')](_0x578645[_0x2010('0x2c')][_0x2010('0x30')]));_0x3ff496['attributes']=_0x3ff496[_0x2010('0x31')][_0x2010('0x32')]?_0x3ff496[_0x2010('0x31')]:_0x16db82['model'];if(_0x578645['query'][_0x2010('0x43')]){_0x3ff496['include']=[{'all':!![]}];}_0x3ff496=_[_0x2010('0x39')]({},_0x3ff496,_0x578645[_0x2010('0x3b')]);return db[_0x2010('0x3c')][_0x2010('0x44')](_0x3ff496)['then'](handleEntityNotFound(_0x27fd64,null))[_0x2010('0x22')](respondWithResult(_0x27fd64,null))[_0x2010('0x45')](handleError(_0x27fd64,null));};exports[_0x2010('0x46')]=function(_0x231db7,_0x3ec24c){return db[_0x2010('0x3c')]['create'](_0x231db7[_0x2010('0x47')],{})[_0x2010('0x22')](respondWithResult(_0x3ec24c,0xc9))[_0x2010('0x45')](handleError(_0x3ec24c,null));};exports['update']=function(_0x30e5d0,_0x1dd027){if(_0x30e5d0['body']['id']){delete _0x30e5d0[_0x2010('0x47')]['id'];}return db[_0x2010('0x3c')][_0x2010('0x44')]({'where':{'id':_0x30e5d0[_0x2010('0x41')]['id']}})[_0x2010('0x22')](handleEntityNotFound(_0x1dd027,null))[_0x2010('0x22')](saveUpdates(_0x30e5d0[_0x2010('0x47')],null))[_0x2010('0x22')](respondWithResult(_0x1dd027,null))['catch'](handleError(_0x1dd027,null));};exports['destroy']=function(_0xc9f070,_0xe1721f){return db['ZendeskAccount'][_0x2010('0x44')]({'where':{'id':_0xc9f070[_0x2010('0x41')]['id']}})[_0x2010('0x22')](handleEntityNotFound(_0xe1721f,null))[_0x2010('0x22')](removeEntity(_0xe1721f,null))[_0x2010('0x45')](handleError(_0xe1721f,null));};exports['getConfigurations']=function(_0x5f4e98,_0x3fca06,_0x137452){var _0x4694e7={};var _0x3b89de={};var _0x38e596;var _0x2d8164;return db[_0x2010('0x3c')][_0x2010('0x48')]({'where':{'id':_0x5f4e98[_0x2010('0x41')]['id']}})[_0x2010('0x22')](handleEntityNotFound(_0x3fca06,null))[_0x2010('0x22')](function(_0x5313b5){if(_0x5313b5){_0x38e596=_0x5313b5;_0x3b89de[_0x2010('0x2f')]=_[_0x2010('0x2d')](db['ZendeskConfiguration'][_0x2010('0x42')]);_0x3b89de[_0x2010('0x2c')]=_[_0x2010('0x2d')](_0x5f4e98[_0x2010('0x2c')]);_0x3b89de[_0x2010('0x37')]=_[_0x2010('0x2e')](_0x3b89de[_0x2010('0x2f')],_0x3b89de[_0x2010('0x2c')]);_0x4694e7[_0x2010('0x31')]=_[_0x2010('0x2e')](_0x3b89de[_0x2010('0x2f')],qs[_0x2010('0x30')](_0x5f4e98[_0x2010('0x2c')][_0x2010('0x30')]));_0x4694e7[_0x2010('0x31')]=_0x4694e7[_0x2010('0x31')][_0x2010('0x32')]?_0x4694e7[_0x2010('0x31')]:_0x3b89de[_0x2010('0x2f')];_0x4694e7[_0x2010('0x33')]=qs[_0x2010('0x34')](_0x5f4e98[_0x2010('0x2c')][_0x2010('0x34')]);_0x4694e7['where']=qs[_0x2010('0x37')](_['pick'](_0x5f4e98['query'],_0x3b89de[_0x2010('0x37')]));if(_0x5f4e98[_0x2010('0x2c')]['filter']){_0x4694e7[_0x2010('0x35')]=_[_0x2010('0x39')](_0x4694e7[_0x2010('0x35')],{'$or':_[_0x2010('0x29')](_0x4694e7['attributes'],function(_0x3c6484){var _0x44816e={};_0x44816e[_0x3c6484]={'$like':'%'+_0x5f4e98[_0x2010('0x2c')][_0x2010('0x38')]+'%'};return _0x44816e;})});}_0x4694e7=_['merge']({},_0x4694e7,_0x5f4e98[_0x2010('0x3b')]);return _0x38e596['getConfigurations'](_0x4694e7);}})[_0x2010('0x22')](function(_0x2bc708){if(_0x2bc708){_0x2d8164=_0x2bc708[_0x2010('0x32')];if(!_0x5f4e98[_0x2010('0x2c')]['hasOwnProperty']('nolimit')){_0x4694e7[_0x2010('0x1d')]=qs[_0x2010('0x1d')](_0x5f4e98['query']['limit']);_0x4694e7[_0x2010('0x1b')]=qs[_0x2010('0x1b')](_0x5f4e98[_0x2010('0x2c')][_0x2010('0x1b')]);}return _0x38e596['getConfigurations'](_0x4694e7);}})[_0x2010('0x22')](function(_0x5a2c7e){if(_0x5a2c7e){return _0x5a2c7e?{'count':_0x2d8164,'rows':_0x5a2c7e}:null;}})[_0x2010('0x22')](respondWithResult(_0x3fca06,null))[_0x2010('0x45')](handleError(_0x3fca06,null));};exports[_0x2010('0x49')]=function(_0x1d81e1,_0x4bde43,_0x340882){if(_0x1d81e1[_0x2010('0x47')]['id']){delete _0x1d81e1['body']['id'];}return db[_0x2010('0x3c')][_0x2010('0x48')]({'where':{'id':_0x1d81e1[_0x2010('0x41')]['id']}})[_0x2010('0x22')](handleEntityNotFound(_0x4bde43,null))[_0x2010('0x22')](function(_0x8df400){if(_0x8df400){_0x1d81e1[_0x2010('0x47')][_0x2010('0x4a')]=_0x8df400['id'];_0x1d81e1[_0x2010('0x47')][_0x2010('0x4b')]=integrations[_0x2010('0x4c')](_0x1d81e1[_0x2010('0x47')]['channel'],_0x1d81e1[_0x2010('0x47')][_0x2010('0x2a')]);_0x1d81e1[_0x2010('0x47')]['Descriptions']=integrations['getDescriptions'](_0x1d81e1[_0x2010('0x47')][_0x2010('0x4d')],_0x1d81e1[_0x2010('0x47')][_0x2010('0x2a')]);return db[_0x2010('0x4e')][_0x2010('0x46')](_0x1d81e1['body'],{'include':[{'model':db[_0x2010('0x4f')],'as':_0x2010('0x4b')},{'model':db[_0x2010('0x4f')],'as':'Descriptions'}]});}return null;})[_0x2010('0x22')](respondWithResult(_0x4bde43,null))[_0x2010('0x45')](handleError(_0x4bde43,null));};exports[_0x2010('0x50')]=function(_0x5182b2,_0x20dea1,_0x22f654){var _0x4adc1c='';return db['ZendeskAccount'][_0x2010('0x48')]({'where':{'id':_0x5182b2['params']['id']},'attributes':['id','username',_0x2010('0x51'),_0x2010('0x52'),_0x2010('0x53'),_0x2010('0x54')]})[_0x2010('0x22')](handleEntityNotFound(_0x20dea1,null))[_0x2010('0x22')](function(_0xdf6767){if(_0xdf6767){_0x4adc1c=_0xdf6767[_0x2010('0x54')];var _0xee7084=_0x4adc1c[_0x2010('0x55')](-0x1);if(_0xee7084==='/'){_0x4adc1c=_0x4adc1c['substring'](0x0,_0x4adc1c[_0x2010('0x56')](_0xee7084));}var _0x1c1373={'method':'GET','uri':util[_0x2010('0x57')](_0x2010('0x58'),_0x4adc1c,_0x2010('0x59')),'json':!![]};switch(_0xdf6767[_0x2010('0x53')]){case'password':_0x1c1373[_0x2010('0x5a')]={'Authorization':util[_0x2010('0x57')]('Basic\x20%s',new Buffer(util['format'](_0x2010('0x5b'),_0xdf6767['username'],_0xdf6767[_0x2010('0x51')]))[_0x2010('0x5c')](_0x2010('0x5d')))};break;case _0x2010('0x52'):_0x1c1373[_0x2010('0x5a')]={'Authorization':util[_0x2010('0x57')](_0x2010('0x5e'),new Buffer(util['format'](_0x2010('0x5f'),_0xdf6767[_0x2010('0x60')],_0xdf6767[_0x2010('0x52')]))['toString'](_0x2010('0x5d')))};break;default:throw new db[(_0x2010('0x61'))][(_0x2010('0x62'))](_0x2010('0x63'));}return rp(_0x1c1373);}})[_0x2010('0x22')](function(_0x41c3cc){if(_0x41c3cc){var _0x40885b=[_0x2010('0x64'),'description',_0x2010('0x65'),_0x2010('0x66')];_[_0x2010('0x67')](_0x41c3cc['ticket_fields'],function(_0xb6ba3f){return _0x40885b[_0x2010('0x68')](_0xb6ba3f['type']);});return{'count':_0x41c3cc[_0x2010('0x59')][_0x2010('0x32')],'rows':_[_0x2010('0x29')](_0x41c3cc[_0x2010('0x59')],function(_0x38e733){return{'id':_0x38e733['id'],'name':_0x38e733['position']>0x7?_0x38e733[_0x2010('0x69')]:_0x38e733[_0x2010('0x2a')],'custom':_0x38e733['position']>0x7?!![]:![],'options':_0x38e733[_0x2010('0x6a')]?_0x38e733[_0x2010('0x6a')]:_0x38e733['custom_field_options']?_0x38e733[_0x2010('0x6b')]:[]};})};}})['then'](respondWithResult(_0x20dea1,null))['catch'](function(_0x44e47e){var _0x17f7c5=_0x5182b2[_0x2010('0x2c')][_0x2010('0x6c')]?0x1f4:_0x44e47e[_0x2010('0x6d')]||0x1f4;logger[_0x2010('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0x2010('0x50'),_0x17f7c5,JSON[_0x2010('0x6e')](_0x44e47e));delete _0x44e47e[_0x2010('0x26')];if(_0x17f7c5===0x191){_0x17f7c5=0x190;}_0x20dea1[_0x2010('0x19')](_0x17f7c5)['send'](_0x5182b2[_0x2010('0x2c')]['test']?{'message':_0x2010('0x6f'),'statusCode':_0x44e47e[_0x2010('0x6d')]}:_0x44e47e);});}; \ No newline at end of file +var _0xe511=['getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','ZendeskConfiguration','create','getFields','username','password','authType','remoteUri','substring','format','ticket_fields','headers','Basic\x20%s','%s:%s','toString','token','%s/token:%s','base64','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','system_field_options','custom_field_options','send','test','statusCode','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','update','then','stack','index','fieldName','type','key','model','map','name','query','keys','filters','attributes','intersection','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','ZendeskAccount','includeAll','include','findAll','catch','show','params','rawAttributes','fields','options','body','find','nolimit'];(function(_0x42a2e8,_0x1bbcbb){var _0x2769c4=function(_0x369ca4){while(--_0x369ca4){_0x42a2e8['push'](_0x42a2e8['shift']());}};_0x2769c4(++_0x1bbcbb);}(_0xe511,0x16f));var _0x1e51=function(_0x5261a8,_0x482ee4){_0x5261a8=_0x5261a8-0x0;var _0x48c7de=_0xe511[_0x5261a8];return _0x48c7de;};'use strict';var emlformat=require(_0x1e51('0x0'));var rimraf=require(_0x1e51('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e51('0x2'));var rp=require('request-promise');var moment=require(_0x1e51('0x3'));var BPromise=require(_0x1e51('0x4'));var Mustache=require('mustache');var util=require(_0x1e51('0x5'));var path=require(_0x1e51('0x6'));var sox=require(_0x1e51('0x7'));var csv=require(_0x1e51('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e51('0x9'));var _=require(_0x1e51('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e51('0xb'));var deskjs=require(_0x1e51('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e51('0xd'));var Redis=require(_0x1e51('0xe'));var authService=require(_0x1e51('0xf'));var qs=require(_0x1e51('0x10'));var as=require(_0x1e51('0x11'));var hardwareService=require(_0x1e51('0x12'));var logger=require('../../config/logger')(_0x1e51('0x13'));var utils=require(_0x1e51('0x14'));var config=require(_0x1e51('0x15'));var licenseUtil=require(_0x1e51('0x16'));var db=require(_0x1e51('0x17'))['db'];var integrations=require(_0x1e51('0x18'));function respondWithStatusCode(_0x5544eb,_0x408a77){_0x408a77=_0x408a77||0xcc;return function(_0x102f01){if(_0x102f01){return _0x5544eb[_0x1e51('0x19')](_0x408a77);}return _0x5544eb[_0x1e51('0x1a')](_0x408a77)[_0x1e51('0x1b')]();};}function respondWithResult(_0x32945d,_0x441c70){_0x441c70=_0x441c70||0xc8;return function(_0x467e77){if(_0x467e77){return _0x32945d[_0x1e51('0x1a')](_0x441c70)[_0x1e51('0x1c')](_0x467e77);}};}function respondWithFilteredResult(_0x5a5c07,_0x3b01b7){return function(_0x24db4f){if(_0x24db4f){var _0x4526b4=typeof _0x3b01b7['offset']===_0x1e51('0x1d')&&typeof _0x3b01b7['limit']==='undefined';var _0x1f6f4e=_0x24db4f[_0x1e51('0x1e')];var _0x40ae4c=_0x4526b4?0x0:_0x3b01b7[_0x1e51('0x1f')];var _0x4d1aae=_0x4526b4?_0x24db4f[_0x1e51('0x1e')]:_0x3b01b7['offset']+_0x3b01b7[_0x1e51('0x20')];var _0x4a9272;if(_0x4d1aae>=_0x1f6f4e){_0x4d1aae=_0x1f6f4e;_0x4a9272=0xc8;}else{_0x4a9272=0xce;}_0x5a5c07[_0x1e51('0x1a')](_0x4a9272);return _0x5a5c07[_0x1e51('0x21')](_0x1e51('0x22'),_0x40ae4c+'-'+_0x4d1aae+'/'+_0x1f6f4e)[_0x1e51('0x1c')](_0x24db4f);}return null;};}function patchUpdates(_0x506f40){return function(_0x5223c3){try{jsonpatch['apply'](_0x5223c3,_0x506f40,!![]);}catch(_0x548c32){return BPromise[_0x1e51('0x23')](_0x548c32);}return _0x5223c3['save']();};}function saveUpdates(_0x3f7340,_0x28aacb){return function(_0x415154){if(_0x415154){return _0x415154[_0x1e51('0x24')](_0x3f7340)[_0x1e51('0x25')](function(_0xf9298){return _0xf9298;});}return null;};}function removeEntity(_0x270adf,_0x461d3d){return function(_0x4bcdd3){if(_0x4bcdd3){return _0x4bcdd3['destroy']()[_0x1e51('0x25')](function(){_0x270adf[_0x1e51('0x1a')](0xcc)[_0x1e51('0x1b')]();});}};}function handleEntityNotFound(_0x1386db,_0x505d79){return function(_0x54d031){if(!_0x54d031){_0x1386db['sendStatus'](0x194);}return _0x54d031;};}function handleError(_0x1eb83f,_0x2a1561){_0x2a1561=_0x2a1561||0x1f4;return function(_0x433c2d){logger['error'](_0x433c2d[_0x1e51('0x26')]);if(_0x433c2d['name']){delete _0x433c2d['name'];}_0x1eb83f[_0x1e51('0x1a')](_0x2a1561)['send'](_0x433c2d);};}exports[_0x1e51('0x27')]=function(_0x1eb79f,_0x56722f){var _0x3e6ef2={},_0x10ee23={},_0x71c7af={'count':0x0,'rows':[]};var _0x6862d1=_['map'](db['ZendeskAccount']['rawAttributes'],function(_0x20eb9b){return{'name':_0x20eb9b[_0x1e51('0x28')],'type':_0x20eb9b[_0x1e51('0x29')][_0x1e51('0x2a')]};});_0x10ee23[_0x1e51('0x2b')]=_[_0x1e51('0x2c')](_0x6862d1,_0x1e51('0x2d'));_0x10ee23[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x1eb79f[_0x1e51('0x2e')]);_0x10ee23[_0x1e51('0x30')]=_['intersection'](_0x10ee23[_0x1e51('0x2b')],_0x10ee23[_0x1e51('0x2e')]);_0x3e6ef2[_0x1e51('0x31')]=_[_0x1e51('0x32')](_0x10ee23[_0x1e51('0x2b')],qs['fields'](_0x1eb79f[_0x1e51('0x2e')]['fields']));_0x3e6ef2[_0x1e51('0x31')]=_0x3e6ef2[_0x1e51('0x31')][_0x1e51('0x33')]?_0x3e6ef2['attributes']:_0x10ee23[_0x1e51('0x2b')];if(!_0x1eb79f['query'][_0x1e51('0x34')]('nolimit')){_0x3e6ef2['limit']=qs[_0x1e51('0x20')](_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x20')]);_0x3e6ef2['offset']=qs[_0x1e51('0x1f')](_0x1eb79f['query'][_0x1e51('0x1f')]);}_0x3e6ef2[_0x1e51('0x35')]=qs['sort'](_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x36')]);_0x3e6ef2[_0x1e51('0x37')]=qs[_0x1e51('0x30')](_[_0x1e51('0x38')](_0x1eb79f[_0x1e51('0x2e')],_0x10ee23['filters']),_0x6862d1);if(_0x1eb79f['query'][_0x1e51('0x39')]){_0x3e6ef2['where']=_[_0x1e51('0x3a')](_0x3e6ef2[_0x1e51('0x37')],{'$or':_[_0x1e51('0x2c')](_0x6862d1,function(_0xcfa1d8){if(_0xcfa1d8[_0x1e51('0x29')]!==_0x1e51('0x3b')){var _0x845a62={};_0x845a62[_0xcfa1d8[_0x1e51('0x2d')]]={'$like':'%'+_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x39')]+'%'};return _0x845a62;}})});}_0x3e6ef2=_[_0x1e51('0x3a')]({},_0x3e6ef2,_0x1eb79f['options']);var _0x29a689={'where':_0x3e6ef2['where']};return db[_0x1e51('0x3c')][_0x1e51('0x1e')](_0x29a689)[_0x1e51('0x25')](function(_0x471386){_0x71c7af[_0x1e51('0x1e')]=_0x471386;if(_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x3d')]){_0x3e6ef2[_0x1e51('0x3e')]=[{'all':!![]}];}return db[_0x1e51('0x3c')][_0x1e51('0x3f')](_0x3e6ef2);})[_0x1e51('0x25')](function(_0x5b4b3f){_0x71c7af['rows']=_0x5b4b3f;return _0x71c7af;})[_0x1e51('0x25')](respondWithFilteredResult(_0x56722f,_0x3e6ef2))[_0x1e51('0x40')](handleError(_0x56722f,null));};exports[_0x1e51('0x41')]=function(_0x4650e4,_0x1ef3d3){var _0x1a9e0d={'raw':![],'where':{'id':_0x4650e4[_0x1e51('0x42')]['id']}},_0x25592c={};_0x25592c['model']=_[_0x1e51('0x2f')](db[_0x1e51('0x3c')][_0x1e51('0x43')]);_0x25592c[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x4650e4[_0x1e51('0x2e')]);_0x25592c[_0x1e51('0x30')]=_['intersection'](_0x25592c[_0x1e51('0x2b')],_0x25592c[_0x1e51('0x2e')]);_0x1a9e0d['attributes']=_[_0x1e51('0x32')](_0x25592c[_0x1e51('0x2b')],qs[_0x1e51('0x44')](_0x4650e4['query'][_0x1e51('0x44')]));_0x1a9e0d[_0x1e51('0x31')]=_0x1a9e0d[_0x1e51('0x31')][_0x1e51('0x33')]?_0x1a9e0d[_0x1e51('0x31')]:_0x25592c[_0x1e51('0x2b')];if(_0x4650e4[_0x1e51('0x2e')][_0x1e51('0x3d')]){_0x1a9e0d[_0x1e51('0x3e')]=[{'all':!![]}];}_0x1a9e0d=_['merge']({},_0x1a9e0d,_0x4650e4[_0x1e51('0x45')]);return db[_0x1e51('0x3c')]['find'](_0x1a9e0d)[_0x1e51('0x25')](handleEntityNotFound(_0x1ef3d3,null))[_0x1e51('0x25')](respondWithResult(_0x1ef3d3,null))[_0x1e51('0x40')](handleError(_0x1ef3d3,null));};exports['create']=function(_0x44468a,_0x4634de){return db[_0x1e51('0x3c')]['create'](_0x44468a[_0x1e51('0x46')],{})['then'](respondWithResult(_0x4634de,0xc9))['catch'](handleError(_0x4634de,null));};exports['update']=function(_0x169e6c,_0x2e79ca){if(_0x169e6c['body']['id']){delete _0x169e6c['body']['id'];}return db[_0x1e51('0x3c')][_0x1e51('0x47')]({'where':{'id':_0x169e6c[_0x1e51('0x42')]['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x2e79ca,null))[_0x1e51('0x25')](saveUpdates(_0x169e6c[_0x1e51('0x46')],null))['then'](respondWithResult(_0x2e79ca,null))[_0x1e51('0x40')](handleError(_0x2e79ca,null));};exports['destroy']=function(_0xf6bd35,_0x43589a){return db['ZendeskAccount']['find']({'where':{'id':_0xf6bd35['params']['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x43589a,null))[_0x1e51('0x25')](removeEntity(_0x43589a,null))[_0x1e51('0x40')](handleError(_0x43589a,null));};exports['getConfigurations']=function(_0x2fdee1,_0x1fe669,_0x4226da){var _0x2100d4={};var _0x1ccb55={};var _0x12584c;var _0x32fe1f;return db[_0x1e51('0x3c')]['findOne']({'where':{'id':_0x2fdee1[_0x1e51('0x42')]['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x1fe669,null))[_0x1e51('0x25')](function(_0x213edb){if(_0x213edb){_0x12584c=_0x213edb;_0x1ccb55[_0x1e51('0x2b')]=_[_0x1e51('0x2f')](db['ZendeskConfiguration'][_0x1e51('0x43')]);_0x1ccb55['query']=_['keys'](_0x2fdee1['query']);_0x1ccb55[_0x1e51('0x30')]=_[_0x1e51('0x32')](_0x1ccb55[_0x1e51('0x2b')],_0x1ccb55['query']);_0x2100d4[_0x1e51('0x31')]=_[_0x1e51('0x32')](_0x1ccb55[_0x1e51('0x2b')],qs['fields'](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x44')]));_0x2100d4[_0x1e51('0x31')]=_0x2100d4['attributes'][_0x1e51('0x33')]?_0x2100d4[_0x1e51('0x31')]:_0x1ccb55[_0x1e51('0x2b')];_0x2100d4[_0x1e51('0x35')]=qs[_0x1e51('0x36')](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x36')]);_0x2100d4[_0x1e51('0x37')]=qs['filters'](_[_0x1e51('0x38')](_0x2fdee1[_0x1e51('0x2e')],_0x1ccb55['filters']));if(_0x2fdee1['query']['filter']){_0x2100d4[_0x1e51('0x37')]=_[_0x1e51('0x3a')](_0x2100d4[_0x1e51('0x37')],{'$or':_[_0x1e51('0x2c')](_0x2100d4[_0x1e51('0x31')],function(_0x3c322c){var _0x45b649={};_0x45b649[_0x3c322c]={'$like':'%'+_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x39')]+'%'};return _0x45b649;})});}_0x2100d4=_['merge']({},_0x2100d4,_0x2fdee1['options']);return _0x12584c['getConfigurations'](_0x2100d4);}})[_0x1e51('0x25')](function(_0x4048a4){if(_0x4048a4){_0x32fe1f=_0x4048a4['length'];if(!_0x2fdee1['query'][_0x1e51('0x34')](_0x1e51('0x48'))){_0x2100d4['limit']=qs[_0x1e51('0x20')](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x20')]);_0x2100d4[_0x1e51('0x1f')]=qs[_0x1e51('0x1f')](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x1f')]);}return _0x12584c[_0x1e51('0x49')](_0x2100d4);}})[_0x1e51('0x25')](function(_0x32863f){if(_0x32863f){return _0x32863f?{'count':_0x32fe1f,'rows':_0x32863f}:null;}})['then'](respondWithResult(_0x1fe669,null))[_0x1e51('0x40')](handleError(_0x1fe669,null));};exports[_0x1e51('0x4a')]=function(_0x3657a2,_0x402bbd,_0xc720e2){if(_0x3657a2[_0x1e51('0x46')]['id']){delete _0x3657a2['body']['id'];}return db['ZendeskAccount'][_0x1e51('0x4b')]({'where':{'id':_0x3657a2[_0x1e51('0x42')]['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x402bbd,null))[_0x1e51('0x25')](function(_0x52a439){if(_0x52a439){_0x3657a2['body']['AccountId']=_0x52a439['id'];_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4c')]=integrations[_0x1e51('0x4d')](_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4e')],_0x3657a2['body'][_0x1e51('0x29')]);_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4f')]=integrations['getDescriptions'](_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4e')],_0x3657a2[_0x1e51('0x46')]['type']);return db[_0x1e51('0x50')][_0x1e51('0x51')](_0x3657a2['body'],{'include':[{'model':db['ZendeskField'],'as':_0x1e51('0x4c')},{'model':db['ZendeskField'],'as':_0x1e51('0x4f')}]});}return null;})['then'](respondWithResult(_0x402bbd,null))[_0x1e51('0x40')](handleError(_0x402bbd,null));};exports[_0x1e51('0x52')]=function(_0x35f12e,_0x457e4a,_0x5142ed){var _0x37f3e6='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x35f12e[_0x1e51('0x42')]['id']},'attributes':['id',_0x1e51('0x53'),_0x1e51('0x54'),'token',_0x1e51('0x55'),_0x1e51('0x56')]})[_0x1e51('0x25')](handleEntityNotFound(_0x457e4a,null))[_0x1e51('0x25')](function(_0x5b76ae){if(_0x5b76ae){_0x37f3e6=_0x5b76ae[_0x1e51('0x56')];var _0x5ef17b=_0x37f3e6['slice'](-0x1);if(_0x5ef17b==='/'){_0x37f3e6=_0x37f3e6[_0x1e51('0x57')](0x0,_0x37f3e6['lastIndexOf'](_0x5ef17b));}var _0x35ece9={'method':'GET','uri':util[_0x1e51('0x58')]('%s/%s',_0x37f3e6,_0x1e51('0x59')),'json':!![]};switch(_0x5b76ae[_0x1e51('0x55')]){case'password':_0x35ece9[_0x1e51('0x5a')]={'Authorization':util['format'](_0x1e51('0x5b'),new Buffer(util[_0x1e51('0x58')](_0x1e51('0x5c'),_0x5b76ae[_0x1e51('0x53')],_0x5b76ae[_0x1e51('0x54')]))[_0x1e51('0x5d')]('base64'))};break;case _0x1e51('0x5e'):_0x35ece9['headers']={'Authorization':util['format'](_0x1e51('0x5b'),new Buffer(util[_0x1e51('0x58')](_0x1e51('0x5f'),_0x5b76ae[_0x1e51('0x53')],_0x5b76ae[_0x1e51('0x5e')]))[_0x1e51('0x5d')](_0x1e51('0x60')))};break;default:throw new db['Sequelize'][(_0x1e51('0x61'))](_0x1e51('0x62'));}return rp(_0x35ece9);}})[_0x1e51('0x25')](function(_0x4c6920){if(_0x4c6920){var _0x4da887=[_0x1e51('0x63'),_0x1e51('0x64'),'group',_0x1e51('0x65')];_[_0x1e51('0x66')](_0x4c6920['ticket_fields'],function(_0x5eb939){return _0x4da887[_0x1e51('0x67')](_0x5eb939[_0x1e51('0x29')]);});return{'count':_0x4c6920[_0x1e51('0x59')][_0x1e51('0x33')],'rows':_[_0x1e51('0x2c')](_0x4c6920[_0x1e51('0x59')],function(_0x3718d9){return{'id':_0x3718d9['id'],'name':_0x3718d9['position']>0x7?_0x3718d9['title']:_0x3718d9[_0x1e51('0x29')],'custom':_0x3718d9[_0x1e51('0x68')]>0x7?!![]:![],'options':_0x3718d9['system_field_options']?_0x3718d9[_0x1e51('0x69')]:_0x3718d9[_0x1e51('0x6a')]?_0x3718d9['custom_field_options']:[]};})};}})[_0x1e51('0x25')](respondWithResult(_0x457e4a,null))['catch'](function(_0x34b98f){var _0x561812=_0x35f12e['query']['test']?0x1f4:_0x34b98f['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x1e51('0x52'),_0x561812,JSON['stringify'](_0x34b98f));delete _0x34b98f[_0x1e51('0x2d')];if(_0x561812===0x191){_0x561812=0x190;}_0x457e4a['status'](_0x561812)[_0x1e51('0x6b')](_0x35f12e[_0x1e51('0x2e')][_0x1e51('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x34b98f[_0x1e51('0x6d')]}:_0x34b98f);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 571e8c3..8b6ab5e 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 _0x3dd8=['int_zendesk_accounts','lodash','util','../../config/logger','bluebird','request-promise','rimraf','exports','define','ZendeskAccount'];(function(_0x312359,_0x2c41a4){var _0x306241=function(_0x137026){while(--_0x137026){_0x312359['push'](_0x312359['shift']());}};_0x306241(++_0x2c41a4);}(_0x3dd8,0x1c3));var _0x83dd=function(_0x2e031a,_0x27c856){_0x2e031a=_0x2e031a-0x0;var _0x5249be=_0x3dd8[_0x2e031a];return _0x5249be;};'use strict';var _=require(_0x83dd('0x0'));var util=require(_0x83dd('0x1'));var logger=require(_0x83dd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x83dd('0x3'));var rp=require(_0x83dd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x83dd('0x5'));var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x83dd('0x6')]=function(_0x505c0a,_0x55c63d){return _0x505c0a[_0x83dd('0x7')](_0x83dd('0x8'),attributes,{'tableName':_0x83dd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3dd5=['define','ZendeskAccount','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3dd5,0x9c));var _0x53dd=function(_0xf5b2bc,_0x129b92){_0xf5b2bc=_0xf5b2bc-0x0;var _0x120dd3=_0x3dd5[_0xf5b2bc];return _0x120dd3;};'use strict';var _=require(_0x53dd('0x0'));var util=require(_0x53dd('0x1'));var logger=require(_0x53dd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x53dd('0x3'));var rp=require(_0x53dd('0x4'));var fs=require('fs');var path=require(_0x53dd('0x5'));var rimraf=require('rimraf');var config=require(_0x53dd('0x6'));var attributes=require(_0x53dd('0x7'));var integrations=require(_0x53dd('0x8'));module['exports']=function(_0x4413c1,_0x130e37){return _0x4413c1[_0x53dd('0x9')](_0x53dd('0xa'),attributes,{'tableName':'int_zendesk_accounts','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 e0f8f91..551b603 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 _0xcc76=['ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowZendeskAccount','find','lodash','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','http','request','then','info'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xcc76,0x78));var _0x6cc7=function(_0x4cd4f8,_0x1f7438){_0x4cd4f8=_0x4cd4f8-0x0;var _0x5a736f=_0xcc76[_0x4cd4f8];return _0x5a736f;};'use strict';var _=require(_0x6cc7('0x0'));var util=require('util');var moment=require(_0x6cc7('0x1'));var BPromise=require(_0x6cc7('0x2'));var rs=require(_0x6cc7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6cc7('0x4'));var logger=require('../../config/logger')(_0x6cc7('0x5'));var config=require('../../config/environment');var jayson=require(_0x6cc7('0x6'));var client=jayson[_0x6cc7('0x7')][_0x6cc7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b9f2c,_0x540321,_0x435cdc){return new BPromise(function(_0x1869d2,_0x10c735){return client[_0x6cc7('0x9')](_0x1b9f2c,_0x435cdc)[_0x6cc7('0xa')](function(_0x470819){logger[_0x6cc7('0xb')](_0x6cc7('0xc'),_0x540321,_0x6cc7('0xd'));logger[_0x6cc7('0xe')](_0x6cc7('0xf'),_0x540321,_0x6cc7('0xd'),JSON[_0x6cc7('0x10')](_0x470819));if(_0x470819[_0x6cc7('0x11')]){if(_0x470819['error'][_0x6cc7('0x12')]===0x1f4){logger[_0x6cc7('0x11')](_0x6cc7('0xc'),_0x540321,_0x470819['error'][_0x6cc7('0x13')]);return _0x10c735(_0x470819[_0x6cc7('0x11')][_0x6cc7('0x13')]);}logger[_0x6cc7('0x11')](_0x6cc7('0xc'),_0x540321,_0x470819[_0x6cc7('0x11')]['message']);return _0x1869d2(_0x470819['error']['message']);}else{logger[_0x6cc7('0xb')]('ZendeskAccount,\x20%s,\x20%s',_0x540321,_0x6cc7('0xd'));_0x1869d2(_0x470819['result']['message']);}})['catch'](function(_0x429404){logger[_0x6cc7('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x540321,_0x429404);_0x10c735(_0x429404);});});}exports[_0x6cc7('0x14')]=function(_0x1e0e30){var _0x132932=this;return new Promise(function(_0xb90b75,_0x301b00){return db['ZendeskAccount'][_0x6cc7('0x15')]({'raw':_0x1e0e30[_0x6cc7('0x16')]?_0x1e0e30[_0x6cc7('0x16')][_0x6cc7('0x17')]===undefined?!![]:![]:!![],'where':_0x1e0e30['options']?_0x1e0e30['options'][_0x6cc7('0x18')]||null:null,'attributes':_0x1e0e30[_0x6cc7('0x16')]?_0x1e0e30['options'][_0x6cc7('0x19')]||null:null,'limit':_0x1e0e30[_0x6cc7('0x16')]?_0x1e0e30[_0x6cc7('0x16')][_0x6cc7('0x1a')]||null:null,'include':_0x1e0e30[_0x6cc7('0x16')]?_0x1e0e30['options'][_0x6cc7('0x1b')]?_[_0x6cc7('0x1c')](_0x1e0e30['options']['include'],function(_0x345434){return{'model':db[_0x345434['model']],'as':_0x345434['as'],'attributes':_0x345434[_0x6cc7('0x19')],'include':_0x345434['include']?_[_0x6cc7('0x1c')](_0x345434[_0x6cc7('0x1b')],function(_0x511e10){return{'model':db[_0x511e10[_0x6cc7('0x1d')]],'as':_0x511e10['as'],'attributes':_0x511e10[_0x6cc7('0x19')],'include':_0x511e10[_0x6cc7('0x1b')]?_[_0x6cc7('0x1c')](_0x511e10[_0x6cc7('0x1b')],function(_0x525fa3){return{'model':db[_0x525fa3[_0x6cc7('0x1d')]],'as':_0x525fa3['as'],'attributes':_0x525fa3[_0x6cc7('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6cc7('0xa')](function(_0x3e1d5d){logger[_0x6cc7('0xb')](_0x6cc7('0x14'),_0x1e0e30);logger[_0x6cc7('0xe')](_0x6cc7('0x14'),_0x1e0e30,JSON[_0x6cc7('0x10')](_0x3e1d5d));_0xb90b75(_0x3e1d5d);})[_0x6cc7('0x1e')](function(_0x5eec96){logger['error'](_0x6cc7('0x14'),_0x5eec96[_0x6cc7('0x13')],_0x1e0e30);_0x301b00(_0x132932['error'](0x1f4,_0x5eec96[_0x6cc7('0x13')]));});});};exports[_0x6cc7('0x1f')]=function(_0x5eb7c5){var _0x1cdac3=this;return new Promise(function(_0x5c7676,_0x34af6c){return db['ZendeskAccount'][_0x6cc7('0x20')]({'raw':_0x5eb7c5[_0x6cc7('0x16')]?_0x5eb7c5[_0x6cc7('0x16')][_0x6cc7('0x17')]===undefined?!![]:![]:!![],'where':_0x5eb7c5['options']?_0x5eb7c5[_0x6cc7('0x16')][_0x6cc7('0x18')]||null:null,'attributes':_0x5eb7c5[_0x6cc7('0x16')]?_0x5eb7c5['options'][_0x6cc7('0x19')]||null:null,'include':_0x5eb7c5[_0x6cc7('0x16')]?_0x5eb7c5[_0x6cc7('0x16')]['include']?_[_0x6cc7('0x1c')](_0x5eb7c5[_0x6cc7('0x16')]['include'],function(_0x2a52e5){return{'model':db[_0x2a52e5[_0x6cc7('0x1d')]],'as':_0x2a52e5['as'],'attributes':_0x2a52e5[_0x6cc7('0x19')],'include':_0x2a52e5[_0x6cc7('0x1b')]?_[_0x6cc7('0x1c')](_0x2a52e5[_0x6cc7('0x1b')],function(_0x35cae4){return{'model':db[_0x35cae4[_0x6cc7('0x1d')]],'as':_0x35cae4['as'],'attributes':_0x35cae4[_0x6cc7('0x19')],'include':_0x35cae4[_0x6cc7('0x1b')]?_[_0x6cc7('0x1c')](_0x35cae4[_0x6cc7('0x1b')],function(_0x1fd076){return{'model':db[_0x1fd076[_0x6cc7('0x1d')]],'as':_0x1fd076['as'],'attributes':_0x1fd076[_0x6cc7('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6cc7('0xa')](function(_0x5ef1d2){logger[_0x6cc7('0xb')](_0x6cc7('0x1f'),_0x5eb7c5);logger[_0x6cc7('0xe')](_0x6cc7('0x1f'),_0x5eb7c5,JSON[_0x6cc7('0x10')](_0x5ef1d2));_0x5c7676(_0x5ef1d2);})[_0x6cc7('0x1e')](function(_0x14f353){logger['error'](_0x6cc7('0x1f'),_0x14f353['message'],_0x5eb7c5);_0x34af6c(_0x1cdac3[_0x6cc7('0x11')](0x1f4,_0x14f353[_0x6cc7('0x13')]));});});}; \ No newline at end of file +var _0xbd1f=['ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','limit','include','map','model','find','where','ShowZendeskAccount','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x1012c0,_0x533c37){var _0x402b4a=function(_0x47d60f){while(--_0x47d60f){_0x1012c0['push'](_0x1012c0['shift']());}};_0x402b4a(++_0x533c37);}(_0xbd1f,0x145));var _0xfbd1=function(_0x1b08d4,_0x8a710c){_0x1b08d4=_0x1b08d4-0x0;var _0x9aef3e=_0xbd1f[_0x1b08d4];return _0x9aef3e;};'use strict';var _=require(_0xfbd1('0x0'));var util=require(_0xfbd1('0x1'));var moment=require(_0xfbd1('0x2'));var BPromise=require(_0xfbd1('0x3'));var rs=require(_0xfbd1('0x4'));var fs=require('fs');var Redis=require(_0xfbd1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfbd1('0x6'));var logger=require(_0xfbd1('0x7'))(_0xfbd1('0x8'));var config=require(_0xfbd1('0x9'));var jayson=require(_0xfbd1('0xa'));var client=jayson[_0xfbd1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25cc49,_0x229497,_0x2b6396){return new BPromise(function(_0x1274bd,_0x15b2e2){return client[_0xfbd1('0xc')](_0x25cc49,_0x2b6396)[_0xfbd1('0xd')](function(_0x127c27){logger[_0xfbd1('0xe')](_0xfbd1('0xf'),_0x229497,_0xfbd1('0x10'));logger['debug'](_0xfbd1('0x11'),_0x229497,'request\x20sent',JSON[_0xfbd1('0x12')](_0x127c27));if(_0x127c27['error']){if(_0x127c27[_0xfbd1('0x13')][_0xfbd1('0x14')]===0x1f4){logger['error'](_0xfbd1('0xf'),_0x229497,_0x127c27[_0xfbd1('0x13')][_0xfbd1('0x15')]);return _0x15b2e2(_0x127c27['error']['message']);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x229497,_0x127c27[_0xfbd1('0x13')][_0xfbd1('0x15')]);return _0x1274bd(_0x127c27[_0xfbd1('0x13')][_0xfbd1('0x15')]);}else{logger[_0xfbd1('0xe')](_0xfbd1('0xf'),_0x229497,_0xfbd1('0x10'));_0x1274bd(_0x127c27[_0xfbd1('0x16')][_0xfbd1('0x15')]);}})['catch'](function(_0x449209){logger[_0xfbd1('0x13')](_0xfbd1('0xf'),_0x229497,_0x449209);_0x15b2e2(_0x449209);});});}exports[_0xfbd1('0x17')]=function(_0x5da882){var _0x4e0df0=this;return new Promise(function(_0x543c5b,_0x5c8f65){return db[_0xfbd1('0x18')][_0xfbd1('0x19')]({'raw':_0x5da882[_0xfbd1('0x1a')]?_0x5da882[_0xfbd1('0x1a')][_0xfbd1('0x1b')]===undefined?!![]:![]:!![],'where':_0x5da882[_0xfbd1('0x1a')]?_0x5da882[_0xfbd1('0x1a')]['where']||null:null,'attributes':_0x5da882[_0xfbd1('0x1a')]?_0x5da882['options'][_0xfbd1('0x1c')]||null:null,'limit':_0x5da882['options']?_0x5da882['options'][_0xfbd1('0x1d')]||null:null,'include':_0x5da882['options']?_0x5da882['options'][_0xfbd1('0x1e')]?_[_0xfbd1('0x1f')](_0x5da882[_0xfbd1('0x1a')][_0xfbd1('0x1e')],function(_0x54782a){return{'model':db[_0x54782a[_0xfbd1('0x20')]],'as':_0x54782a['as'],'attributes':_0x54782a['attributes'],'include':_0x54782a[_0xfbd1('0x1e')]?_[_0xfbd1('0x1f')](_0x54782a['include'],function(_0x138efe){return{'model':db[_0x138efe[_0xfbd1('0x20')]],'as':_0x138efe['as'],'attributes':_0x138efe[_0xfbd1('0x1c')],'include':_0x138efe[_0xfbd1('0x1e')]?_[_0xfbd1('0x1f')](_0x138efe[_0xfbd1('0x1e')],function(_0xb1242b){return{'model':db[_0xb1242b[_0xfbd1('0x20')]],'as':_0xb1242b['as'],'attributes':_0xb1242b['attributes']};}):[]};}):[]};}):[]:[]})[_0xfbd1('0xd')](function(_0x42f0ba){logger[_0xfbd1('0xe')](_0xfbd1('0x17'),_0x5da882);logger['debug'](_0xfbd1('0x17'),_0x5da882,JSON['stringify'](_0x42f0ba));_0x543c5b(_0x42f0ba);})['catch'](function(_0x2610f2){logger[_0xfbd1('0x13')](_0xfbd1('0x17'),_0x2610f2[_0xfbd1('0x15')],_0x5da882);_0x5c8f65(_0x4e0df0[_0xfbd1('0x13')](0x1f4,_0x2610f2[_0xfbd1('0x15')]));});});};exports['ShowZendeskAccount']=function(_0x4986af){var _0x55a037=this;return new Promise(function(_0x39effe,_0x3b1003){return db[_0xfbd1('0x18')][_0xfbd1('0x21')]({'raw':_0x4986af[_0xfbd1('0x1a')]?_0x4986af[_0xfbd1('0x1a')][_0xfbd1('0x1b')]===undefined?!![]:![]:!![],'where':_0x4986af[_0xfbd1('0x1a')]?_0x4986af[_0xfbd1('0x1a')][_0xfbd1('0x22')]||null:null,'attributes':_0x4986af[_0xfbd1('0x1a')]?_0x4986af[_0xfbd1('0x1a')][_0xfbd1('0x1c')]||null:null,'include':_0x4986af[_0xfbd1('0x1a')]?_0x4986af[_0xfbd1('0x1a')]['include']?_[_0xfbd1('0x1f')](_0x4986af[_0xfbd1('0x1a')][_0xfbd1('0x1e')],function(_0x34386d){return{'model':db[_0x34386d['model']],'as':_0x34386d['as'],'attributes':_0x34386d['attributes'],'include':_0x34386d[_0xfbd1('0x1e')]?_[_0xfbd1('0x1f')](_0x34386d['include'],function(_0x8f6cf4){return{'model':db[_0x8f6cf4[_0xfbd1('0x20')]],'as':_0x8f6cf4['as'],'attributes':_0x8f6cf4[_0xfbd1('0x1c')],'include':_0x8f6cf4[_0xfbd1('0x1e')]?_[_0xfbd1('0x1f')](_0x8f6cf4[_0xfbd1('0x1e')],function(_0x13f113){return{'model':db[_0x13f113[_0xfbd1('0x20')]],'as':_0x13f113['as'],'attributes':_0x13f113[_0xfbd1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xfbd1('0xd')](function(_0x2c175f){logger[_0xfbd1('0xe')](_0xfbd1('0x23'),_0x4986af);logger[_0xfbd1('0x24')](_0xfbd1('0x23'),_0x4986af,JSON[_0xfbd1('0x12')](_0x2c175f));_0x39effe(_0x2c175f);})[_0xfbd1('0x25')](function(_0x10c6ad){logger[_0xfbd1('0x13')](_0xfbd1('0x23'),_0x10c6ad['message'],_0x4986af);_0x3b1003(_0x55a037[_0xfbd1('0x13')](0x1f4,_0x10c6ad[_0xfbd1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 619c475..bf34d81 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 _0xbaf0=['isAuthenticated','index','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x1f9d53,_0x224330){var _0x531072=function(_0x31ac5f){while(--_0x31ac5f){_0x1f9d53['push'](_0x1f9d53['shift']());}};_0x531072(++_0x224330);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'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('0x9')]('/:id/fields',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0x9')](_0x0baf('0xe'),auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x9')](_0x0baf('0x10'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x11')]);router[_0x0baf('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0x14')]);router['post'](_0x0baf('0x15'),auth['isAuthenticated'](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x18')]);router[_0x0baf('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);module[_0x0baf('0x1b')]=router; \ No newline at end of file +var _0xac4a=['../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','get','show','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4420da,_0x4c65fc){var _0x51f9c3=function(_0x48d702){while(--_0x48d702){_0x4420da['push'](_0x4420da['shift']());}};_0x51f9c3(++_0x4c65fc);}(_0xac4a,0x13f));var _0xaac4=function(_0x1c2398,_0x2aaad8){_0x1c2398=_0x1c2398-0x0;var _0x3883f8=_0xac4a[_0x1c2398];return _0x3883f8;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['get']('/:id/fields',auth[_0xaac4('0x9')](),controller['getFields']);router[_0xaac4('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router[_0xaac4('0xa')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xe')]);router['get']('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);router[_0xaac4('0x10')]('/',auth['isAuthenticated'](),controller[_0xaac4('0x11')]);router[_0xaac4('0x10')]('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0x12')]);router[_0xaac4('0x13')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x15')]);router[_0xaac4('0x16')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x17')]);module[_0xaac4('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index c783741..927b3ad 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 _0xe63d=['sequelize','exports','STRING'];(function(_0x2375e1,_0x3d125a){var _0x2ccc7d=function(_0x343bb6){while(--_0x343bb6){_0x2375e1['push'](_0x2375e1['shift']());}};_0x2ccc7d(++_0x3d125a);}(_0xe63d,0x84));var _0xde63=function(_0x1ff2ec,_0x386e86){_0x1ff2ec=_0x1ff2ec-0x0;var _0x405683=_0xe63d[_0x1ff2ec];return _0x405683;};'use strict';var Sequelize=require(_0xde63('0x0'));module[_0xde63('0x1')]={'name':{'type':Sequelize[_0xde63('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7db7=['STRING','sequelize','exports'];(function(_0x1876dc,_0x362351){var _0x26ee8c=function(_0x523507){while(--_0x523507){_0x1876dc['push'](_0x1876dc['shift']());}};_0x26ee8c(++_0x362351);}(_0x7db7,0x6d));var _0x77db=function(_0x17d00a,_0x4f3752){_0x17d00a=_0x17d00a-0x0;var _0x42ffd0=_0x7db7[_0x17d00a];return _0x42ffd0;};'use strict';var Sequelize=require(_0x77db('0x0'));module[_0x77db('0x1')]={'name':{'type':Sequelize[_0x77db('0x2')]},'description':{'type':Sequelize[_0x77db('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 4c96d36..54425b6 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 _0xd634=['offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','find','create','body','params','ZendeskField','getFields','nolimit','getSubjects','findOne','getDescriptions','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json'];(function(_0x1a7e4b,_0x2fbd40){var _0x37a8fd=function(_0x4eaa73){while(--_0x4eaa73){_0x1a7e4b['push'](_0x1a7e4b['shift']());}};_0x37a8fd(++_0x2fbd40);}(_0xd634,0xdf));var _0x4d63=function(_0x2c3255,_0x4e00ae){_0x2c3255=_0x2c3255-0x0;var _0x282aba=_0xd634[_0x2c3255];return _0x282aba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4d63('0x0'));var zipdir=require(_0x4d63('0x1'));var jsonpatch=require(_0x4d63('0x2'));var rp=require(_0x4d63('0x3'));var moment=require(_0x4d63('0x4'));var BPromise=require(_0x4d63('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4d63('0x6'));var sox=require(_0x4d63('0x7'));var csv=require('to-csv');var ejs=require(_0x4d63('0x8'));var fs=require('fs');var fs_extra=require(_0x4d63('0x9'));var _=require(_0x4d63('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4d63('0xb'));var toCsv=require(_0x4d63('0xc'));var querystring=require(_0x4d63('0xd'));var Papa=require(_0x4d63('0xe'));var Redis=require('ioredis');var authService=require(_0x4d63('0xf'));var qs=require(_0x4d63('0x10'));var as=require(_0x4d63('0x11'));var hardwareService=require(_0x4d63('0x12'));var logger=require(_0x4d63('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4d63('0x14'));var licenseUtil=require(_0x4d63('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4395fa,_0x4714ca){_0x4714ca=_0x4714ca||0xcc;return function(_0x56bbe2){if(_0x56bbe2){return _0x4395fa[_0x4d63('0x16')](_0x4714ca);}return _0x4395fa[_0x4d63('0x17')](_0x4714ca)[_0x4d63('0x18')]();};}function respondWithResult(_0x425b82,_0xb57910){_0xb57910=_0xb57910||0xc8;return function(_0xa9dd90){if(_0xa9dd90){return _0x425b82[_0x4d63('0x17')](_0xb57910)[_0x4d63('0x19')](_0xa9dd90);}};}function respondWithFilteredResult(_0x42be3f,_0x23f3e1){return function(_0x49af86){if(_0x49af86){var _0x725b09=typeof _0x23f3e1[_0x4d63('0x1a')]===_0x4d63('0x1b')&&typeof _0x23f3e1[_0x4d63('0x1c')]===_0x4d63('0x1b');var _0x428ae0=_0x49af86['count'];var _0x125bcd=_0x725b09?0x0:_0x23f3e1[_0x4d63('0x1a')];var _0x574439=_0x725b09?_0x49af86[_0x4d63('0x1d')]:_0x23f3e1[_0x4d63('0x1a')]+_0x23f3e1[_0x4d63('0x1c')];var _0x58f39d;if(_0x574439>=_0x428ae0){_0x574439=_0x428ae0;_0x58f39d=0xc8;}else{_0x58f39d=0xce;}_0x42be3f[_0x4d63('0x17')](_0x58f39d);return _0x42be3f[_0x4d63('0x1e')]('Content-Range',_0x125bcd+'-'+_0x574439+'/'+_0x428ae0)[_0x4d63('0x19')](_0x49af86);}return null;};}function patchUpdates(_0x2b73f7){return function(_0x1978d4){try{jsonpatch[_0x4d63('0x1f')](_0x1978d4,_0x2b73f7,!![]);}catch(_0x6e56c9){return BPromise[_0x4d63('0x20')](_0x6e56c9);}return _0x1978d4[_0x4d63('0x21')]();};}function saveUpdates(_0x153bb9,_0x5bc97f){return function(_0x2d393e){if(_0x2d393e){return _0x2d393e[_0x4d63('0x22')](_0x153bb9)['then'](function(_0x5c0acc){return _0x5c0acc;});}return null;};}function removeEntity(_0x14e6e7,_0x3fe9ee){return function(_0x412cf2){if(_0x412cf2){return _0x412cf2[_0x4d63('0x23')]()[_0x4d63('0x24')](function(){_0x14e6e7[_0x4d63('0x17')](0xcc)[_0x4d63('0x18')]();});}};}function handleEntityNotFound(_0x11d2d8,_0x12f124){return function(_0x52d930){if(!_0x52d930){_0x11d2d8[_0x4d63('0x16')](0x194);}return _0x52d930;};}function handleError(_0x1524eb,_0x54ea36){_0x54ea36=_0x54ea36||0x1f4;return function(_0x2e81d7){logger[_0x4d63('0x25')](_0x2e81d7[_0x4d63('0x26')]);if(_0x2e81d7['name']){delete _0x2e81d7[_0x4d63('0x27')];}_0x1524eb['status'](_0x54ea36)[_0x4d63('0x28')](_0x2e81d7);};}exports[_0x4d63('0x29')]=function(_0x2094c1,_0x1b5e09){var _0x56ff88={},_0x39f214={},_0x4c8536={'count':0x0,'rows':[]};var _0x296ac4=_[_0x4d63('0x2a')](db[_0x4d63('0x2b')][_0x4d63('0x2c')],function(_0x3a01d6){return{'name':_0x3a01d6[_0x4d63('0x2d')],'type':_0x3a01d6[_0x4d63('0x2e')][_0x4d63('0x2f')]};});_0x39f214[_0x4d63('0x30')]=_[_0x4d63('0x2a')](_0x296ac4,_0x4d63('0x27'));_0x39f214[_0x4d63('0x31')]=_[_0x4d63('0x32')](_0x2094c1[_0x4d63('0x31')]);_0x39f214[_0x4d63('0x33')]=_[_0x4d63('0x34')](_0x39f214[_0x4d63('0x30')],_0x39f214[_0x4d63('0x31')]);_0x56ff88[_0x4d63('0x35')]=_[_0x4d63('0x34')](_0x39f214[_0x4d63('0x30')],qs[_0x4d63('0x36')](_0x2094c1[_0x4d63('0x31')][_0x4d63('0x36')]));_0x56ff88[_0x4d63('0x35')]=_0x56ff88[_0x4d63('0x35')][_0x4d63('0x37')]?_0x56ff88[_0x4d63('0x35')]:_0x39f214[_0x4d63('0x30')];if(!_0x2094c1['query'][_0x4d63('0x38')]('nolimit')){_0x56ff88['limit']=qs[_0x4d63('0x1c')](_0x2094c1['query'][_0x4d63('0x1c')]);_0x56ff88[_0x4d63('0x1a')]=qs[_0x4d63('0x1a')](_0x2094c1[_0x4d63('0x31')][_0x4d63('0x1a')]);}_0x56ff88[_0x4d63('0x39')]=qs[_0x4d63('0x3a')](_0x2094c1['query']['sort']);_0x56ff88[_0x4d63('0x3b')]=qs[_0x4d63('0x33')](_[_0x4d63('0x3c')](_0x2094c1[_0x4d63('0x31')],_0x39f214[_0x4d63('0x33')]),_0x296ac4);if(_0x2094c1[_0x4d63('0x31')][_0x4d63('0x3d')]){_0x56ff88[_0x4d63('0x3b')]=_[_0x4d63('0x3e')](_0x56ff88['where'],{'$or':_['map'](_0x296ac4,function(_0x1d4694){if(_0x1d4694[_0x4d63('0x2e')]!==_0x4d63('0x3f')){var _0x4b0cc4={};_0x4b0cc4[_0x1d4694['name']]={'$like':'%'+_0x2094c1[_0x4d63('0x31')][_0x4d63('0x3d')]+'%'};return _0x4b0cc4;}})});}_0x56ff88=_['merge']({},_0x56ff88,_0x2094c1[_0x4d63('0x40')]);var _0x8bb180={'where':_0x56ff88[_0x4d63('0x3b')]};return db['ZendeskConfiguration'][_0x4d63('0x1d')](_0x8bb180)[_0x4d63('0x24')](function(_0x1c8a3c){_0x4c8536['count']=_0x1c8a3c;if(_0x2094c1[_0x4d63('0x31')]['includeAll']){_0x56ff88[_0x4d63('0x41')]=[{'all':!![]}];}return db[_0x4d63('0x2b')][_0x4d63('0x42')](_0x56ff88);})[_0x4d63('0x24')](function(_0x895d89){_0x4c8536[_0x4d63('0x43')]=_0x895d89;return _0x4c8536;})[_0x4d63('0x24')](respondWithFilteredResult(_0x1b5e09,_0x56ff88))[_0x4d63('0x44')](handleError(_0x1b5e09,null));};exports[_0x4d63('0x45')]=function(_0x32d8aa,_0x3cc0ab){var _0x2ec933={'raw':![],'where':{'id':_0x32d8aa['params']['id']}},_0x18a1c9={};_0x18a1c9['model']=_[_0x4d63('0x32')](db[_0x4d63('0x2b')][_0x4d63('0x2c')]);_0x18a1c9['query']=_[_0x4d63('0x32')](_0x32d8aa[_0x4d63('0x31')]);_0x18a1c9[_0x4d63('0x33')]=_[_0x4d63('0x34')](_0x18a1c9[_0x4d63('0x30')],_0x18a1c9[_0x4d63('0x31')]);_0x2ec933[_0x4d63('0x35')]=_[_0x4d63('0x34')](_0x18a1c9[_0x4d63('0x30')],qs['fields'](_0x32d8aa['query']['fields']));_0x2ec933[_0x4d63('0x35')]=_0x2ec933[_0x4d63('0x35')][_0x4d63('0x37')]?_0x2ec933[_0x4d63('0x35')]:_0x18a1c9[_0x4d63('0x30')];if(_0x32d8aa['query']['includeAll']){_0x2ec933[_0x4d63('0x41')]=[{'all':!![]}];}_0x2ec933=_['merge']({},_0x2ec933,_0x32d8aa[_0x4d63('0x40')]);return db[_0x4d63('0x2b')][_0x4d63('0x46')](_0x2ec933)['then'](handleEntityNotFound(_0x3cc0ab,null))['then'](respondWithResult(_0x3cc0ab,null))[_0x4d63('0x44')](handleError(_0x3cc0ab,null));};exports[_0x4d63('0x47')]=function(_0x4fa43b,_0x198d87){return db[_0x4d63('0x2b')][_0x4d63('0x47')](_0x4fa43b[_0x4d63('0x48')],{})[_0x4d63('0x24')](respondWithResult(_0x198d87,0xc9))['catch'](handleError(_0x198d87,null));};exports[_0x4d63('0x22')]=function(_0x42fbc6,_0x14dc80){if(_0x42fbc6[_0x4d63('0x48')]['id']){delete _0x42fbc6[_0x4d63('0x48')]['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x42fbc6['params']['id']}})[_0x4d63('0x24')](handleEntityNotFound(_0x14dc80,null))[_0x4d63('0x24')](saveUpdates(_0x42fbc6[_0x4d63('0x48')],null))[_0x4d63('0x24')](respondWithResult(_0x14dc80,null))[_0x4d63('0x44')](handleError(_0x14dc80,null));};exports[_0x4d63('0x23')]=function(_0x1c1ea4,_0xe70068){return db['ZendeskConfiguration'][_0x4d63('0x46')]({'where':{'id':_0x1c1ea4[_0x4d63('0x49')]['id']}})[_0x4d63('0x24')](handleEntityNotFound(_0xe70068,null))[_0x4d63('0x24')](removeEntity(_0xe70068,null))[_0x4d63('0x44')](handleError(_0xe70068,null));};exports['getFields']=function(_0x1c4bb0,_0xcefdc,_0x550304){var _0x3e5305={};var _0x4ba510={};var _0x393081;var _0x1f9fa4;return db[_0x4d63('0x2b')]['findOne']({'where':{'id':_0x1c4bb0['params']['id']}})[_0x4d63('0x24')](handleEntityNotFound(_0xcefdc,null))[_0x4d63('0x24')](function(_0x2bb6ac){if(_0x2bb6ac){_0x393081=_0x2bb6ac;_0x4ba510['model']=_[_0x4d63('0x32')](db[_0x4d63('0x4a')][_0x4d63('0x2c')]);_0x4ba510['query']=_[_0x4d63('0x32')](_0x1c4bb0['query']);_0x4ba510['filters']=_[_0x4d63('0x34')](_0x4ba510[_0x4d63('0x30')],_0x4ba510[_0x4d63('0x31')]);_0x3e5305[_0x4d63('0x35')]=_[_0x4d63('0x34')](_0x4ba510[_0x4d63('0x30')],qs['fields'](_0x1c4bb0[_0x4d63('0x31')][_0x4d63('0x36')]));_0x3e5305[_0x4d63('0x35')]=_0x3e5305[_0x4d63('0x35')]['length']?_0x3e5305[_0x4d63('0x35')]:_0x4ba510[_0x4d63('0x30')];_0x3e5305[_0x4d63('0x39')]=qs[_0x4d63('0x3a')](_0x1c4bb0[_0x4d63('0x31')][_0x4d63('0x3a')]);_0x3e5305['where']=qs['filters'](_[_0x4d63('0x3c')](_0x1c4bb0[_0x4d63('0x31')],_0x4ba510[_0x4d63('0x33')]));if(_0x1c4bb0[_0x4d63('0x31')][_0x4d63('0x3d')]){_0x3e5305[_0x4d63('0x3b')]=_[_0x4d63('0x3e')](_0x3e5305[_0x4d63('0x3b')],{'$or':_[_0x4d63('0x2a')](_0x3e5305['attributes'],function(_0x3e58f7){var _0x319c32={};_0x319c32[_0x3e58f7]={'$like':'%'+_0x1c4bb0[_0x4d63('0x31')]['filter']+'%'};return _0x319c32;})});}_0x3e5305=_[_0x4d63('0x3e')]({},_0x3e5305,_0x1c4bb0[_0x4d63('0x40')]);return _0x393081[_0x4d63('0x4b')](_0x3e5305);}})['then'](function(_0x3b8933){if(_0x3b8933){_0x1f9fa4=_0x3b8933['length'];if(!_0x1c4bb0[_0x4d63('0x31')][_0x4d63('0x38')](_0x4d63('0x4c'))){_0x3e5305[_0x4d63('0x1c')]=qs[_0x4d63('0x1c')](_0x1c4bb0[_0x4d63('0x31')]['limit']);_0x3e5305['offset']=qs[_0x4d63('0x1a')](_0x1c4bb0[_0x4d63('0x31')][_0x4d63('0x1a')]);}return _0x393081[_0x4d63('0x4b')](_0x3e5305);}})[_0x4d63('0x24')](function(_0x4d3c2f){if(_0x4d3c2f){return _0x4d3c2f?{'count':_0x1f9fa4,'rows':_0x4d3c2f}:null;}})['then'](respondWithResult(_0xcefdc,null))[_0x4d63('0x44')](handleError(_0xcefdc,null));};exports[_0x4d63('0x4d')]=function(_0x120a90,_0x2bd607,_0x390e88){var _0x2555aa={};var _0x1cd170={};var _0x10d3ac;var _0x2dde3a;return db[_0x4d63('0x2b')][_0x4d63('0x4e')]({'where':{'id':_0x120a90['params']['id']}})[_0x4d63('0x24')](handleEntityNotFound(_0x2bd607,null))[_0x4d63('0x24')](function(_0x3f266f){if(_0x3f266f){_0x10d3ac=_0x3f266f;_0x1cd170[_0x4d63('0x30')]=_[_0x4d63('0x32')](db[_0x4d63('0x4a')][_0x4d63('0x2c')]);_0x1cd170[_0x4d63('0x31')]=_[_0x4d63('0x32')](_0x120a90['query']);_0x1cd170[_0x4d63('0x33')]=_[_0x4d63('0x34')](_0x1cd170[_0x4d63('0x30')],_0x1cd170[_0x4d63('0x31')]);_0x2555aa['attributes']=_['intersection'](_0x1cd170['model'],qs[_0x4d63('0x36')](_0x120a90[_0x4d63('0x31')][_0x4d63('0x36')]));_0x2555aa[_0x4d63('0x35')]=_0x2555aa['attributes'][_0x4d63('0x37')]?_0x2555aa[_0x4d63('0x35')]:_0x1cd170[_0x4d63('0x30')];_0x2555aa[_0x4d63('0x39')]=qs['sort'](_0x120a90[_0x4d63('0x31')][_0x4d63('0x3a')]);_0x2555aa[_0x4d63('0x3b')]=qs[_0x4d63('0x33')](_[_0x4d63('0x3c')](_0x120a90[_0x4d63('0x31')],_0x1cd170[_0x4d63('0x33')]));if(_0x120a90[_0x4d63('0x31')][_0x4d63('0x3d')]){_0x2555aa['where']=_[_0x4d63('0x3e')](_0x2555aa[_0x4d63('0x3b')],{'$or':_['map'](_0x2555aa[_0x4d63('0x35')],function(_0x1c87c4){var _0x37f559={};_0x37f559[_0x1c87c4]={'$like':'%'+_0x120a90['query'][_0x4d63('0x3d')]+'%'};return _0x37f559;})});}_0x2555aa=_[_0x4d63('0x3e')]({},_0x2555aa,_0x120a90[_0x4d63('0x40')]);return _0x10d3ac[_0x4d63('0x4d')](_0x2555aa);}})[_0x4d63('0x24')](function(_0xca5c5e){if(_0xca5c5e){_0x2dde3a=_0xca5c5e[_0x4d63('0x37')];if(!_0x120a90['query']['hasOwnProperty'](_0x4d63('0x4c'))){_0x2555aa[_0x4d63('0x1c')]=qs[_0x4d63('0x1c')](_0x120a90[_0x4d63('0x31')][_0x4d63('0x1c')]);_0x2555aa[_0x4d63('0x1a')]=qs[_0x4d63('0x1a')](_0x120a90['query'][_0x4d63('0x1a')]);}return _0x10d3ac['getSubjects'](_0x2555aa);}})[_0x4d63('0x24')](function(_0x1594d0){if(_0x1594d0){return _0x1594d0?{'count':_0x2dde3a,'rows':_0x1594d0}:null;}})[_0x4d63('0x24')](respondWithResult(_0x2bd607,null))[_0x4d63('0x44')](handleError(_0x2bd607,null));};exports['getDescriptions']=function(_0x40ad3b,_0x123ee7,_0x30a040){var _0x475e39={};var _0x1f7490={};var _0x5344b0;var _0x3310db;return db[_0x4d63('0x2b')][_0x4d63('0x4e')]({'where':{'id':_0x40ad3b['params']['id']}})[_0x4d63('0x24')](handleEntityNotFound(_0x123ee7,null))['then'](function(_0x4be0f5){if(_0x4be0f5){_0x5344b0=_0x4be0f5;_0x1f7490[_0x4d63('0x30')]=_[_0x4d63('0x32')](db[_0x4d63('0x4a')][_0x4d63('0x2c')]);_0x1f7490[_0x4d63('0x31')]=_[_0x4d63('0x32')](_0x40ad3b[_0x4d63('0x31')]);_0x1f7490['filters']=_[_0x4d63('0x34')](_0x1f7490[_0x4d63('0x30')],_0x1f7490[_0x4d63('0x31')]);_0x475e39[_0x4d63('0x35')]=_['intersection'](_0x1f7490['model'],qs[_0x4d63('0x36')](_0x40ad3b[_0x4d63('0x31')][_0x4d63('0x36')]));_0x475e39['attributes']=_0x475e39[_0x4d63('0x35')][_0x4d63('0x37')]?_0x475e39[_0x4d63('0x35')]:_0x1f7490[_0x4d63('0x30')];_0x475e39['order']=qs[_0x4d63('0x3a')](_0x40ad3b[_0x4d63('0x31')][_0x4d63('0x3a')]);_0x475e39[_0x4d63('0x3b')]=qs[_0x4d63('0x33')](_[_0x4d63('0x3c')](_0x40ad3b['query'],_0x1f7490[_0x4d63('0x33')]));if(_0x40ad3b['query'][_0x4d63('0x3d')]){_0x475e39['where']=_[_0x4d63('0x3e')](_0x475e39['where'],{'$or':_[_0x4d63('0x2a')](_0x475e39[_0x4d63('0x35')],function(_0x90cdb9){var _0x417571={};_0x417571[_0x90cdb9]={'$like':'%'+_0x40ad3b[_0x4d63('0x31')][_0x4d63('0x3d')]+'%'};return _0x417571;})});}_0x475e39=_[_0x4d63('0x3e')]({},_0x475e39,_0x40ad3b[_0x4d63('0x40')]);return _0x5344b0['getDescriptions'](_0x475e39);}})['then'](function(_0x55a28e){if(_0x55a28e){_0x3310db=_0x55a28e[_0x4d63('0x37')];if(!_0x40ad3b[_0x4d63('0x31')][_0x4d63('0x38')](_0x4d63('0x4c'))){_0x475e39[_0x4d63('0x1c')]=qs[_0x4d63('0x1c')](_0x40ad3b[_0x4d63('0x31')][_0x4d63('0x1c')]);_0x475e39[_0x4d63('0x1a')]=qs[_0x4d63('0x1a')](_0x40ad3b[_0x4d63('0x31')][_0x4d63('0x1a')]);}return _0x5344b0[_0x4d63('0x4f')](_0x475e39);}})[_0x4d63('0x24')](function(_0x3cf6c0){if(_0x3cf6c0){return _0x3cf6c0?{'count':_0x3310db,'rows':_0x3cf6c0}:null;}})['then'](respondWithResult(_0x123ee7,null))[_0x4d63('0x44')](handleError(_0x123ee7,null));};exports['getTags']=function(_0x787db6,_0x298d5c,_0x1eeefe){var _0x2e4de6={};var _0x10d8bc={};var _0xac325;var _0x495ae8;return db[_0x4d63('0x2b')][_0x4d63('0x4e')]({'where':{'id':_0x787db6[_0x4d63('0x49')]['id']}})[_0x4d63('0x24')](handleEntityNotFound(_0x298d5c,null))[_0x4d63('0x24')](function(_0x2a97e2){if(_0x2a97e2){_0xac325=_0x2a97e2;_0x10d8bc[_0x4d63('0x30')]=_[_0x4d63('0x32')](db['Tag']['rawAttributes']);_0x10d8bc[_0x4d63('0x31')]=_[_0x4d63('0x32')](_0x787db6[_0x4d63('0x31')]);_0x10d8bc[_0x4d63('0x33')]=_[_0x4d63('0x34')](_0x10d8bc[_0x4d63('0x30')],_0x10d8bc[_0x4d63('0x31')]);_0x2e4de6[_0x4d63('0x35')]=_[_0x4d63('0x34')](_0x10d8bc[_0x4d63('0x30')],qs[_0x4d63('0x36')](_0x787db6[_0x4d63('0x31')]['fields']));_0x2e4de6['attributes']=_0x2e4de6[_0x4d63('0x35')][_0x4d63('0x37')]?_0x2e4de6[_0x4d63('0x35')]:_0x10d8bc[_0x4d63('0x30')];_0x2e4de6[_0x4d63('0x39')]=qs[_0x4d63('0x3a')](_0x787db6[_0x4d63('0x31')]['sort']);_0x2e4de6[_0x4d63('0x3b')]=qs[_0x4d63('0x33')](_[_0x4d63('0x3c')](_0x787db6[_0x4d63('0x31')],_0x10d8bc['filters']));if(_0x787db6[_0x4d63('0x31')][_0x4d63('0x3d')]){_0x2e4de6[_0x4d63('0x3b')]=_[_0x4d63('0x3e')](_0x2e4de6[_0x4d63('0x3b')],{'$or':_[_0x4d63('0x2a')](_0x2e4de6[_0x4d63('0x35')],function(_0x48fa3f){var _0x15171b={};_0x15171b[_0x48fa3f]={'$like':'%'+_0x787db6[_0x4d63('0x31')][_0x4d63('0x3d')]+'%'};return _0x15171b;})});}_0x2e4de6=_[_0x4d63('0x3e')]({},_0x2e4de6,_0x787db6[_0x4d63('0x40')]);return _0xac325[_0x4d63('0x50')](_0x2e4de6);}})['then'](function(_0x39937e){if(_0x39937e){_0x495ae8=_0x39937e[_0x4d63('0x37')];if(!_0x787db6[_0x4d63('0x31')][_0x4d63('0x38')](_0x4d63('0x4c'))){_0x2e4de6['limit']=qs[_0x4d63('0x1c')](_0x787db6[_0x4d63('0x31')][_0x4d63('0x1c')]);_0x2e4de6[_0x4d63('0x1a')]=qs[_0x4d63('0x1a')](_0x787db6[_0x4d63('0x31')][_0x4d63('0x1a')]);}return _0xac325[_0x4d63('0x50')](_0x2e4de6);}})[_0x4d63('0x24')](function(_0x37ea21){if(_0x37ea21){return _0x37ea21?{'count':_0x495ae8,'rows':_0x37ea21}:null;}})[_0x4d63('0x24')](respondWithResult(_0x298d5c,null))[_0x4d63('0x44')](handleError(_0x298d5c,null));};exports['setTags']=function(_0x229b59,_0x1c698a,_0x4001d5){if(_0x229b59[_0x4d63('0x48')]['id']){delete _0x229b59['body']['id'];}return db[_0x4d63('0x2b')][_0x4d63('0x4e')]({'where':{'id':_0x229b59[_0x4d63('0x49')]['id']}})[_0x4d63('0x24')](handleEntityNotFound(_0x1c698a,null))[_0x4d63('0x24')](function(_0x3ecc54){if(_0x3ecc54){return _0x3ecc54[_0x4d63('0x51')](_0x229b59[_0x4d63('0x48')][_0x4d63('0x52')]||[]);}return null;})[_0x4d63('0x24')](respondWithResult(_0x1c698a,null))[_0x4d63('0x44')](handleError(_0x1c698a,null));}; \ No newline at end of file +var _0x6491=['findAll','rows','catch','show','params','options','find','create','body','findOne','ZendeskField','getFields','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include'];(function(_0x54991c,_0x46081c){var _0x4627f0=function(_0x2519e1){while(--_0x2519e1){_0x54991c['push'](_0x54991c['shift']());}};_0x4627f0(++_0x46081c);}(_0x6491,0x10c));var _0x1649=function(_0x3f18dc,_0x34b11a){_0x3f18dc=_0x3f18dc-0x0;var _0x229829=_0x6491[_0x3f18dc];return _0x229829;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1649('0x0'));var zipdir=require(_0x1649('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1649('0x2'));var BPromise=require(_0x1649('0x3'));var Mustache=require(_0x1649('0x4'));var util=require('util');var path=require(_0x1649('0x5'));var sox=require('sox');var csv=require(_0x1649('0x6'));var ejs=require(_0x1649('0x7'));var fs=require('fs');var fs_extra=require(_0x1649('0x8'));var _=require(_0x1649('0x9'));var squel=require('squel');var crypto=require(_0x1649('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1649('0xb'));var toCsv=require(_0x1649('0x6'));var querystring=require('querystring');var Papa=require(_0x1649('0xc'));var Redis=require(_0x1649('0xd'));var authService=require(_0x1649('0xe'));var qs=require(_0x1649('0xf'));var as=require(_0x1649('0x10'));var hardwareService=require(_0x1649('0x11'));var logger=require('../../config/logger')(_0x1649('0x12'));var utils=require(_0x1649('0x13'));var config=require(_0x1649('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x1649('0x15'))['db'];function respondWithStatusCode(_0x22e3a6,_0x1c1b80){_0x1c1b80=_0x1c1b80||0xcc;return function(_0x1dc6de){if(_0x1dc6de){return _0x22e3a6[_0x1649('0x16')](_0x1c1b80);}return _0x22e3a6[_0x1649('0x17')](_0x1c1b80)['end']();};}function respondWithResult(_0xc7afbf,_0x299e1b){_0x299e1b=_0x299e1b||0xc8;return function(_0x3df220){if(_0x3df220){return _0xc7afbf['status'](_0x299e1b)['json'](_0x3df220);}};}function respondWithFilteredResult(_0x245f4d,_0x36263e){return function(_0x55fd3d){if(_0x55fd3d){var _0x12439b=typeof _0x36263e['offset']===_0x1649('0x18')&&typeof _0x36263e[_0x1649('0x19')]===_0x1649('0x18');var _0x2c33c0=_0x55fd3d[_0x1649('0x1a')];var _0x51054d=_0x12439b?0x0:_0x36263e[_0x1649('0x1b')];var _0x44ae44=_0x12439b?_0x55fd3d['count']:_0x36263e['offset']+_0x36263e[_0x1649('0x19')];var _0x233fd6;if(_0x44ae44>=_0x2c33c0){_0x44ae44=_0x2c33c0;_0x233fd6=0xc8;}else{_0x233fd6=0xce;}_0x245f4d[_0x1649('0x17')](_0x233fd6);return _0x245f4d['set'](_0x1649('0x1c'),_0x51054d+'-'+_0x44ae44+'/'+_0x2c33c0)[_0x1649('0x1d')](_0x55fd3d);}return null;};}function patchUpdates(_0x5a5e30){return function(_0x4e7834){try{jsonpatch[_0x1649('0x1e')](_0x4e7834,_0x5a5e30,!![]);}catch(_0x4f3944){return BPromise[_0x1649('0x1f')](_0x4f3944);}return _0x4e7834[_0x1649('0x20')]();};}function saveUpdates(_0x1e2ec9,_0xd620cc){return function(_0x10fe19){if(_0x10fe19){return _0x10fe19[_0x1649('0x21')](_0x1e2ec9)['then'](function(_0x226527){return _0x226527;});}return null;};}function removeEntity(_0x2ab4c1,_0x1fcbf9){return function(_0x287976){if(_0x287976){return _0x287976[_0x1649('0x22')]()[_0x1649('0x23')](function(){_0x2ab4c1[_0x1649('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe96813,_0x4a7d9c){return function(_0x4b678a){if(!_0x4b678a){_0xe96813['sendStatus'](0x194);}return _0x4b678a;};}function handleError(_0x17ceab,_0x4f41fa){_0x4f41fa=_0x4f41fa||0x1f4;return function(_0x333ca2){logger[_0x1649('0x24')](_0x333ca2[_0x1649('0x25')]);if(_0x333ca2[_0x1649('0x26')]){delete _0x333ca2['name'];}_0x17ceab[_0x1649('0x17')](_0x4f41fa)[_0x1649('0x27')](_0x333ca2);};}exports['index']=function(_0xe89380,_0x40dbb8){var _0x1d654a={},_0xdb5f96={},_0x174fce={'count':0x0,'rows':[]};var _0x54b2af=_['map'](db[_0x1649('0x28')][_0x1649('0x29')],function(_0x3bc125){return{'name':_0x3bc125[_0x1649('0x2a')],'type':_0x3bc125[_0x1649('0x2b')][_0x1649('0x2c')]};});_0xdb5f96[_0x1649('0x2d')]=_[_0x1649('0x2e')](_0x54b2af,_0x1649('0x26'));_0xdb5f96[_0x1649('0x2f')]=_[_0x1649('0x30')](_0xe89380[_0x1649('0x2f')]);_0xdb5f96[_0x1649('0x31')]=_[_0x1649('0x32')](_0xdb5f96[_0x1649('0x2d')],_0xdb5f96['query']);_0x1d654a[_0x1649('0x33')]=_[_0x1649('0x32')](_0xdb5f96['model'],qs['fields'](_0xe89380[_0x1649('0x2f')][_0x1649('0x34')]));_0x1d654a[_0x1649('0x33')]=_0x1d654a['attributes'][_0x1649('0x35')]?_0x1d654a[_0x1649('0x33')]:_0xdb5f96[_0x1649('0x2d')];if(!_0xe89380[_0x1649('0x2f')]['hasOwnProperty'](_0x1649('0x36'))){_0x1d654a[_0x1649('0x19')]=qs[_0x1649('0x19')](_0xe89380[_0x1649('0x2f')][_0x1649('0x19')]);_0x1d654a[_0x1649('0x1b')]=qs[_0x1649('0x1b')](_0xe89380[_0x1649('0x2f')][_0x1649('0x1b')]);}_0x1d654a[_0x1649('0x37')]=qs[_0x1649('0x38')](_0xe89380[_0x1649('0x2f')][_0x1649('0x38')]);_0x1d654a[_0x1649('0x39')]=qs[_0x1649('0x31')](_[_0x1649('0x3a')](_0xe89380['query'],_0xdb5f96[_0x1649('0x31')]),_0x54b2af);if(_0xe89380['query']['filter']){_0x1d654a[_0x1649('0x39')]=_[_0x1649('0x3b')](_0x1d654a[_0x1649('0x39')],{'$or':_[_0x1649('0x2e')](_0x54b2af,function(_0x37e8dc){if(_0x37e8dc[_0x1649('0x2b')]!==_0x1649('0x3c')){var _0x42cfb9={};_0x42cfb9[_0x37e8dc['name']]={'$like':'%'+_0xe89380['query'][_0x1649('0x3d')]+'%'};return _0x42cfb9;}})});}_0x1d654a=_[_0x1649('0x3b')]({},_0x1d654a,_0xe89380['options']);var _0x3bf3ac={'where':_0x1d654a[_0x1649('0x39')]};return db[_0x1649('0x28')][_0x1649('0x1a')](_0x3bf3ac)[_0x1649('0x23')](function(_0x29ae28){_0x174fce['count']=_0x29ae28;if(_0xe89380[_0x1649('0x2f')][_0x1649('0x3e')]){_0x1d654a[_0x1649('0x3f')]=[{'all':!![]}];}return db[_0x1649('0x28')][_0x1649('0x40')](_0x1d654a);})[_0x1649('0x23')](function(_0xdd24c9){_0x174fce[_0x1649('0x41')]=_0xdd24c9;return _0x174fce;})['then'](respondWithFilteredResult(_0x40dbb8,_0x1d654a))[_0x1649('0x42')](handleError(_0x40dbb8,null));};exports[_0x1649('0x43')]=function(_0x52d902,_0x47f987){var _0x25d542={'raw':![],'where':{'id':_0x52d902[_0x1649('0x44')]['id']}},_0x119bbb={};_0x119bbb[_0x1649('0x2d')]=_[_0x1649('0x30')](db[_0x1649('0x28')][_0x1649('0x29')]);_0x119bbb[_0x1649('0x2f')]=_[_0x1649('0x30')](_0x52d902['query']);_0x119bbb[_0x1649('0x31')]=_[_0x1649('0x32')](_0x119bbb[_0x1649('0x2d')],_0x119bbb['query']);_0x25d542[_0x1649('0x33')]=_['intersection'](_0x119bbb[_0x1649('0x2d')],qs[_0x1649('0x34')](_0x52d902[_0x1649('0x2f')][_0x1649('0x34')]));_0x25d542[_0x1649('0x33')]=_0x25d542[_0x1649('0x33')][_0x1649('0x35')]?_0x25d542[_0x1649('0x33')]:_0x119bbb['model'];if(_0x52d902['query'][_0x1649('0x3e')]){_0x25d542[_0x1649('0x3f')]=[{'all':!![]}];}_0x25d542=_[_0x1649('0x3b')]({},_0x25d542,_0x52d902[_0x1649('0x45')]);return db['ZendeskConfiguration'][_0x1649('0x46')](_0x25d542)[_0x1649('0x23')](handleEntityNotFound(_0x47f987,null))[_0x1649('0x23')](respondWithResult(_0x47f987,null))[_0x1649('0x42')](handleError(_0x47f987,null));};exports[_0x1649('0x47')]=function(_0x59aab4,_0x37e0b9){return db[_0x1649('0x28')][_0x1649('0x47')](_0x59aab4[_0x1649('0x48')],{})[_0x1649('0x23')](respondWithResult(_0x37e0b9,0xc9))[_0x1649('0x42')](handleError(_0x37e0b9,null));};exports[_0x1649('0x21')]=function(_0x4f675e,_0x9037a0){if(_0x4f675e[_0x1649('0x48')]['id']){delete _0x4f675e[_0x1649('0x48')]['id'];}return db[_0x1649('0x28')][_0x1649('0x46')]({'where':{'id':_0x4f675e[_0x1649('0x44')]['id']}})['then'](handleEntityNotFound(_0x9037a0,null))[_0x1649('0x23')](saveUpdates(_0x4f675e['body'],null))['then'](respondWithResult(_0x9037a0,null))[_0x1649('0x42')](handleError(_0x9037a0,null));};exports['destroy']=function(_0x394083,_0x1cdcda){return db[_0x1649('0x28')][_0x1649('0x46')]({'where':{'id':_0x394083[_0x1649('0x44')]['id']}})[_0x1649('0x23')](handleEntityNotFound(_0x1cdcda,null))[_0x1649('0x23')](removeEntity(_0x1cdcda,null))[_0x1649('0x42')](handleError(_0x1cdcda,null));};exports['getFields']=function(_0x67a8a2,_0x591daa,_0x54af34){var _0x34c9a9={};var _0x2db366={};var _0x529ef1;var _0x5751da;return db[_0x1649('0x28')][_0x1649('0x49')]({'where':{'id':_0x67a8a2['params']['id']}})[_0x1649('0x23')](handleEntityNotFound(_0x591daa,null))[_0x1649('0x23')](function(_0x202585){if(_0x202585){_0x529ef1=_0x202585;_0x2db366['model']=_[_0x1649('0x30')](db[_0x1649('0x4a')]['rawAttributes']);_0x2db366[_0x1649('0x2f')]=_[_0x1649('0x30')](_0x67a8a2[_0x1649('0x2f')]);_0x2db366[_0x1649('0x31')]=_['intersection'](_0x2db366[_0x1649('0x2d')],_0x2db366[_0x1649('0x2f')]);_0x34c9a9[_0x1649('0x33')]=_['intersection'](_0x2db366[_0x1649('0x2d')],qs[_0x1649('0x34')](_0x67a8a2[_0x1649('0x2f')][_0x1649('0x34')]));_0x34c9a9[_0x1649('0x33')]=_0x34c9a9[_0x1649('0x33')][_0x1649('0x35')]?_0x34c9a9[_0x1649('0x33')]:_0x2db366[_0x1649('0x2d')];_0x34c9a9['order']=qs[_0x1649('0x38')](_0x67a8a2[_0x1649('0x2f')][_0x1649('0x38')]);_0x34c9a9[_0x1649('0x39')]=qs[_0x1649('0x31')](_['pick'](_0x67a8a2[_0x1649('0x2f')],_0x2db366[_0x1649('0x31')]));if(_0x67a8a2['query']['filter']){_0x34c9a9[_0x1649('0x39')]=_['merge'](_0x34c9a9[_0x1649('0x39')],{'$or':_[_0x1649('0x2e')](_0x34c9a9['attributes'],function(_0x4f47a4){var _0x44c1e7={};_0x44c1e7[_0x4f47a4]={'$like':'%'+_0x67a8a2[_0x1649('0x2f')][_0x1649('0x3d')]+'%'};return _0x44c1e7;})});}_0x34c9a9=_[_0x1649('0x3b')]({},_0x34c9a9,_0x67a8a2[_0x1649('0x45')]);return _0x529ef1[_0x1649('0x4b')](_0x34c9a9);}})[_0x1649('0x23')](function(_0x4693ab){if(_0x4693ab){_0x5751da=_0x4693ab[_0x1649('0x35')];if(!_0x67a8a2[_0x1649('0x2f')][_0x1649('0x4c')](_0x1649('0x36'))){_0x34c9a9[_0x1649('0x19')]=qs[_0x1649('0x19')](_0x67a8a2[_0x1649('0x2f')][_0x1649('0x19')]);_0x34c9a9[_0x1649('0x1b')]=qs[_0x1649('0x1b')](_0x67a8a2[_0x1649('0x2f')]['offset']);}return _0x529ef1['getFields'](_0x34c9a9);}})[_0x1649('0x23')](function(_0x5c02e7){if(_0x5c02e7){return _0x5c02e7?{'count':_0x5751da,'rows':_0x5c02e7}:null;}})[_0x1649('0x23')](respondWithResult(_0x591daa,null))[_0x1649('0x42')](handleError(_0x591daa,null));};exports[_0x1649('0x4d')]=function(_0x442b15,_0x226f97,_0x4b7ae5){var _0x1df009={};var _0x518c41={};var _0x20e7fd;var _0x26902c;return db['ZendeskConfiguration'][_0x1649('0x49')]({'where':{'id':_0x442b15[_0x1649('0x44')]['id']}})[_0x1649('0x23')](handleEntityNotFound(_0x226f97,null))['then'](function(_0x461f1b){if(_0x461f1b){_0x20e7fd=_0x461f1b;_0x518c41[_0x1649('0x2d')]=_[_0x1649('0x30')](db[_0x1649('0x4a')][_0x1649('0x29')]);_0x518c41[_0x1649('0x2f')]=_[_0x1649('0x30')](_0x442b15['query']);_0x518c41['filters']=_[_0x1649('0x32')](_0x518c41['model'],_0x518c41[_0x1649('0x2f')]);_0x1df009[_0x1649('0x33')]=_['intersection'](_0x518c41[_0x1649('0x2d')],qs[_0x1649('0x34')](_0x442b15['query']['fields']));_0x1df009[_0x1649('0x33')]=_0x1df009['attributes'][_0x1649('0x35')]?_0x1df009[_0x1649('0x33')]:_0x518c41['model'];_0x1df009['order']=qs['sort'](_0x442b15[_0x1649('0x2f')][_0x1649('0x38')]);_0x1df009[_0x1649('0x39')]=qs[_0x1649('0x31')](_['pick'](_0x442b15['query'],_0x518c41[_0x1649('0x31')]));if(_0x442b15[_0x1649('0x2f')][_0x1649('0x3d')]){_0x1df009[_0x1649('0x39')]=_[_0x1649('0x3b')](_0x1df009[_0x1649('0x39')],{'$or':_[_0x1649('0x2e')](_0x1df009[_0x1649('0x33')],function(_0x514978){var _0x1bc5c0={};_0x1bc5c0[_0x514978]={'$like':'%'+_0x442b15['query'][_0x1649('0x3d')]+'%'};return _0x1bc5c0;})});}_0x1df009=_['merge']({},_0x1df009,_0x442b15[_0x1649('0x45')]);return _0x20e7fd[_0x1649('0x4d')](_0x1df009);}})[_0x1649('0x23')](function(_0x5a92ce){if(_0x5a92ce){_0x26902c=_0x5a92ce[_0x1649('0x35')];if(!_0x442b15[_0x1649('0x2f')][_0x1649('0x4c')]('nolimit')){_0x1df009['limit']=qs[_0x1649('0x19')](_0x442b15[_0x1649('0x2f')]['limit']);_0x1df009[_0x1649('0x1b')]=qs['offset'](_0x442b15[_0x1649('0x2f')][_0x1649('0x1b')]);}return _0x20e7fd[_0x1649('0x4d')](_0x1df009);}})[_0x1649('0x23')](function(_0x3a7272){if(_0x3a7272){return _0x3a7272?{'count':_0x26902c,'rows':_0x3a7272}:null;}})['then'](respondWithResult(_0x226f97,null))[_0x1649('0x42')](handleError(_0x226f97,null));};exports[_0x1649('0x4e')]=function(_0x44aa4b,_0x168962,_0x20d156){var _0x12fda4={};var _0x2b7d65={};var _0x32ac89;var _0x1a0b25;return db[_0x1649('0x28')][_0x1649('0x49')]({'where':{'id':_0x44aa4b[_0x1649('0x44')]['id']}})[_0x1649('0x23')](handleEntityNotFound(_0x168962,null))[_0x1649('0x23')](function(_0xb745b9){if(_0xb745b9){_0x32ac89=_0xb745b9;_0x2b7d65[_0x1649('0x2d')]=_[_0x1649('0x30')](db[_0x1649('0x4a')][_0x1649('0x29')]);_0x2b7d65[_0x1649('0x2f')]=_[_0x1649('0x30')](_0x44aa4b[_0x1649('0x2f')]);_0x2b7d65['filters']=_[_0x1649('0x32')](_0x2b7d65[_0x1649('0x2d')],_0x2b7d65[_0x1649('0x2f')]);_0x12fda4[_0x1649('0x33')]=_[_0x1649('0x32')](_0x2b7d65[_0x1649('0x2d')],qs['fields'](_0x44aa4b[_0x1649('0x2f')][_0x1649('0x34')]));_0x12fda4['attributes']=_0x12fda4[_0x1649('0x33')][_0x1649('0x35')]?_0x12fda4[_0x1649('0x33')]:_0x2b7d65[_0x1649('0x2d')];_0x12fda4[_0x1649('0x37')]=qs[_0x1649('0x38')](_0x44aa4b[_0x1649('0x2f')]['sort']);_0x12fda4[_0x1649('0x39')]=qs[_0x1649('0x31')](_[_0x1649('0x3a')](_0x44aa4b[_0x1649('0x2f')],_0x2b7d65[_0x1649('0x31')]));if(_0x44aa4b[_0x1649('0x2f')][_0x1649('0x3d')]){_0x12fda4[_0x1649('0x39')]=_[_0x1649('0x3b')](_0x12fda4[_0x1649('0x39')],{'$or':_[_0x1649('0x2e')](_0x12fda4[_0x1649('0x33')],function(_0x22ac3f){var _0x204906={};_0x204906[_0x22ac3f]={'$like':'%'+_0x44aa4b['query'][_0x1649('0x3d')]+'%'};return _0x204906;})});}_0x12fda4=_[_0x1649('0x3b')]({},_0x12fda4,_0x44aa4b[_0x1649('0x45')]);return _0x32ac89[_0x1649('0x4e')](_0x12fda4);}})[_0x1649('0x23')](function(_0x162ce6){if(_0x162ce6){_0x1a0b25=_0x162ce6[_0x1649('0x35')];if(!_0x44aa4b[_0x1649('0x2f')][_0x1649('0x4c')](_0x1649('0x36'))){_0x12fda4[_0x1649('0x19')]=qs['limit'](_0x44aa4b[_0x1649('0x2f')]['limit']);_0x12fda4[_0x1649('0x1b')]=qs[_0x1649('0x1b')](_0x44aa4b[_0x1649('0x2f')][_0x1649('0x1b')]);}return _0x32ac89['getDescriptions'](_0x12fda4);}})['then'](function(_0x34a721){if(_0x34a721){return _0x34a721?{'count':_0x1a0b25,'rows':_0x34a721}:null;}})['then'](respondWithResult(_0x168962,null))[_0x1649('0x42')](handleError(_0x168962,null));};exports[_0x1649('0x4f')]=function(_0x4576e9,_0x359230,_0x388543){var _0x444493={};var _0x36bdac={};var _0x182f25;var _0x355600;return db['ZendeskConfiguration'][_0x1649('0x49')]({'where':{'id':_0x4576e9['params']['id']}})[_0x1649('0x23')](handleEntityNotFound(_0x359230,null))['then'](function(_0x5a11cb){if(_0x5a11cb){_0x182f25=_0x5a11cb;_0x36bdac['model']=_[_0x1649('0x30')](db[_0x1649('0x50')]['rawAttributes']);_0x36bdac[_0x1649('0x2f')]=_['keys'](_0x4576e9[_0x1649('0x2f')]);_0x36bdac[_0x1649('0x31')]=_[_0x1649('0x32')](_0x36bdac[_0x1649('0x2d')],_0x36bdac['query']);_0x444493[_0x1649('0x33')]=_[_0x1649('0x32')](_0x36bdac[_0x1649('0x2d')],qs[_0x1649('0x34')](_0x4576e9['query'][_0x1649('0x34')]));_0x444493[_0x1649('0x33')]=_0x444493[_0x1649('0x33')][_0x1649('0x35')]?_0x444493[_0x1649('0x33')]:_0x36bdac[_0x1649('0x2d')];_0x444493[_0x1649('0x37')]=qs[_0x1649('0x38')](_0x4576e9['query'][_0x1649('0x38')]);_0x444493[_0x1649('0x39')]=qs['filters'](_[_0x1649('0x3a')](_0x4576e9[_0x1649('0x2f')],_0x36bdac[_0x1649('0x31')]));if(_0x4576e9[_0x1649('0x2f')][_0x1649('0x3d')]){_0x444493[_0x1649('0x39')]=_[_0x1649('0x3b')](_0x444493['where'],{'$or':_[_0x1649('0x2e')](_0x444493[_0x1649('0x33')],function(_0x4d6015){var _0x3eac0a={};_0x3eac0a[_0x4d6015]={'$like':'%'+_0x4576e9[_0x1649('0x2f')][_0x1649('0x3d')]+'%'};return _0x3eac0a;})});}_0x444493=_[_0x1649('0x3b')]({},_0x444493,_0x4576e9[_0x1649('0x45')]);return _0x182f25[_0x1649('0x4f')](_0x444493);}})[_0x1649('0x23')](function(_0x230384){if(_0x230384){_0x355600=_0x230384[_0x1649('0x35')];if(!_0x4576e9[_0x1649('0x2f')][_0x1649('0x4c')](_0x1649('0x36'))){_0x444493['limit']=qs[_0x1649('0x19')](_0x4576e9['query']['limit']);_0x444493[_0x1649('0x1b')]=qs[_0x1649('0x1b')](_0x4576e9[_0x1649('0x2f')][_0x1649('0x1b')]);}return _0x182f25[_0x1649('0x4f')](_0x444493);}})[_0x1649('0x23')](function(_0x235a0a){if(_0x235a0a){return _0x235a0a?{'count':_0x355600,'rows':_0x235a0a}:null;}})['then'](respondWithResult(_0x359230,null))[_0x1649('0x42')](handleError(_0x359230,null));};exports[_0x1649('0x51')]=function(_0x7cb169,_0x155d7c,_0x3d269d){if(_0x7cb169[_0x1649('0x48')]['id']){delete _0x7cb169[_0x1649('0x48')]['id'];}return db[_0x1649('0x28')]['findOne']({'where':{'id':_0x7cb169[_0x1649('0x44')]['id']}})[_0x1649('0x23')](handleEntityNotFound(_0x155d7c,null))[_0x1649('0x23')](function(_0x103b97){if(_0x103b97){return _0x103b97['setTags'](_0x7cb169['body'][_0x1649('0x52')]||[]);}return null;})[_0x1649('0x23')](respondWithResult(_0x155d7c,null))[_0x1649('0x42')](handleError(_0x155d7c,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 8c4688a..4a3c8b4 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 _0xe820=['exports','define','ZendeskConfiguration','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0x4b7e4f,_0x4cca29){var _0x2dbef4=function(_0x4a5354){while(--_0x4a5354){_0x4b7e4f['push'](_0x4b7e4f['shift']());}};_0x2dbef4(++_0x4cca29);}(_0xe820,0xd2));var _0x0e82=function(_0x43dec2,_0x2173e1){_0x43dec2=_0x43dec2-0x0;var _0x2006dd=_0xe820[_0x43dec2];return _0x2006dd;};'use strict';var _=require(_0x0e82('0x0'));var util=require('util');var logger=require(_0x0e82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0e82('0x2'));var rp=require(_0x0e82('0x3'));var fs=require('fs');var path=require(_0x0e82('0x4'));var rimraf=require('rimraf');var config=require(_0x0e82('0x5'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x0e82('0x6')]=function(_0x105e3c,_0x69e27f){return _0x105e3c[_0x0e82('0x7')](_0x0e82('0x8'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5423=['request-promise','path','rimraf','../../config/environment','exports','define','ZendeskConfiguration','lodash','util','api','moment'];(function(_0x3f35e7,_0x56129c){var _0x325142=function(_0x344ca4){while(--_0x344ca4){_0x3f35e7['push'](_0x3f35e7['shift']());}};_0x325142(++_0x56129c);}(_0x5423,0xe3));var _0x3542=function(_0x3ae689,_0x566fb9){_0x3ae689=_0x3ae689-0x0;var _0x591bf5=_0x5423[_0x3ae689];return _0x591bf5;};'use strict';var _=require(_0x3542('0x0'));var util=require(_0x3542('0x1'));var logger=require('../../config/logger')(_0x3542('0x2'));var moment=require(_0x3542('0x3'));var BPromise=require('bluebird');var rp=require(_0x3542('0x4'));var fs=require('fs');var path=require(_0x3542('0x5'));var rimraf=require(_0x3542('0x6'));var config=require(_0x3542('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x3542('0x8')]=function(_0x2d2ae9,_0x15ee3b){return _0x2d2ae9[_0x3542('0x9')](_0x3542('0xa'),attributes,{'tableName':'int_zendesk_configurations','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 404d8f3..b28b505 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 _0xc993=['client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x3966de,_0x2fd143){var _0x44b513=function(_0x3edb40){while(--_0x3edb40){_0x3966de['push'](_0x3966de['shift']());}};_0x44b513(++_0x2fd143);}(_0xc993,0xc6));var _0x3c99=function(_0x475e68,_0x2552b8){_0x475e68=_0x475e68-0x0;var _0x4ed805=_0xc993[_0x475e68];return _0x4ed805;};'use strict';var _=require(_0x3c99('0x0'));var util=require('util');var moment=require(_0x3c99('0x1'));var BPromise=require('bluebird');var rs=require(_0x3c99('0x2'));var fs=require('fs');var Redis=require(_0x3c99('0x3'));var db=require(_0x3c99('0x4'))['db'];var utils=require(_0x3c99('0x5'));var logger=require(_0x3c99('0x6'))('rpc');var config=require(_0x3c99('0x7'));var jayson=require(_0x3c99('0x8'));var client=jayson[_0x3c99('0x9')][_0x3c99('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49e1dd,_0x2df5ad,_0x30bf3c){return new BPromise(function(_0x1ebae1,_0x1f9d95){return client[_0x3c99('0xb')](_0x49e1dd,_0x30bf3c)[_0x3c99('0xc')](function(_0x5d57ff){logger[_0x3c99('0xd')](_0x3c99('0xe'),_0x2df5ad,'request\x20sent');logger['debug'](_0x3c99('0xf'),_0x2df5ad,_0x3c99('0x10'),JSON[_0x3c99('0x11')](_0x5d57ff));if(_0x5d57ff[_0x3c99('0x12')]){if(_0x5d57ff['error'][_0x3c99('0x13')]===0x1f4){logger[_0x3c99('0x12')](_0x3c99('0xe'),_0x2df5ad,_0x5d57ff[_0x3c99('0x12')][_0x3c99('0x14')]);return _0x1f9d95(_0x5d57ff[_0x3c99('0x12')][_0x3c99('0x14')]);}logger[_0x3c99('0x12')](_0x3c99('0xe'),_0x2df5ad,_0x5d57ff[_0x3c99('0x12')][_0x3c99('0x14')]);return _0x1ebae1(_0x5d57ff['error'][_0x3c99('0x14')]);}else{logger[_0x3c99('0xd')](_0x3c99('0xe'),_0x2df5ad,_0x3c99('0x10'));_0x1ebae1(_0x5d57ff[_0x3c99('0x15')]['message']);}})[_0x3c99('0x16')](function(_0x3c5b72){logger[_0x3c99('0x12')](_0x3c99('0xe'),_0x2df5ad,_0x3c5b72);_0x1f9d95(_0x3c5b72);});});} \ No newline at end of file +var _0x5e8c=['message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1a7ba7,_0x131274){var _0x5619d6=function(_0x4f4623){while(--_0x4f4623){_0x1a7ba7['push'](_0x1a7ba7['shift']());}};_0x5619d6(++_0x131274);}(_0x5e8c,0x8e));var _0xc5e8=function(_0x3aeb7a,_0x2a92a4){_0x3aeb7a=_0x3aeb7a-0x0;var _0x2d79c4=_0x5e8c[_0x3aeb7a];return _0x2d79c4;};'use strict';var _=require(_0xc5e8('0x0'));var util=require(_0xc5e8('0x1'));var moment=require(_0xc5e8('0x2'));var BPromise=require('bluebird');var rs=require(_0xc5e8('0x3'));var fs=require('fs');var Redis=require(_0xc5e8('0x4'));var db=require(_0xc5e8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc5e8('0x6'))(_0xc5e8('0x7'));var config=require(_0xc5e8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc5e8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33ca51,_0x43c0e1,_0x410a70){return new BPromise(function(_0x533526,_0x435762){return client[_0xc5e8('0xa')](_0x33ca51,_0x410a70)[_0xc5e8('0xb')](function(_0xefc8b1){logger['info'](_0xc5e8('0xc'),_0x43c0e1,_0xc5e8('0xd'));logger[_0xc5e8('0xe')](_0xc5e8('0xf'),_0x43c0e1,_0xc5e8('0xd'),JSON[_0xc5e8('0x10')](_0xefc8b1));if(_0xefc8b1[_0xc5e8('0x11')]){if(_0xefc8b1[_0xc5e8('0x11')]['code']===0x1f4){logger[_0xc5e8('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x43c0e1,_0xefc8b1[_0xc5e8('0x11')][_0xc5e8('0x12')]);return _0x435762(_0xefc8b1[_0xc5e8('0x11')][_0xc5e8('0x12')]);}logger[_0xc5e8('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x43c0e1,_0xefc8b1[_0xc5e8('0x11')]['message']);return _0x533526(_0xefc8b1[_0xc5e8('0x11')][_0xc5e8('0x12')]);}else{logger['info'](_0xc5e8('0xc'),_0x43c0e1,_0xc5e8('0xd'));_0x533526(_0xefc8b1[_0xc5e8('0x13')][_0xc5e8('0x12')]);}})['catch'](function(_0x3a73b2){logger[_0xc5e8('0x11')](_0xc5e8('0xc'),_0x43c0e1,_0x3a73b2);_0x435762(_0x3a73b2);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index e1739ac..761e74c 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 _0x03e1=['update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','index','/:id','isAuthenticated','post','put'];(function(_0x8197a7,_0x1f946d){var _0x1c2f28=function(_0x4ad15){while(--_0x4ad15){_0x8197a7['push'](_0x8197a7['shift']());}};_0x1c2f28(++_0x1f946d);}(_0x03e1,0x1e8));var _0x103e=function(_0x5bd490,_0x21fe3b){_0x5bd490=_0x5bd490-0x0;var _0x1fc61f=_0x03e1[_0x5bd490];return _0x1fc61f;};'use strict';var multer=require(_0x103e('0x0'));var util=require(_0x103e('0x1'));var path=require('path');var timeout=require(_0x103e('0x2'));var express=require(_0x103e('0x3'));var router=express[_0x103e('0x4')]();var fs_extra=require(_0x103e('0x5'));var auth=require(_0x103e('0x6'));var interaction=require(_0x103e('0x7'));var config=require(_0x103e('0x8'));var controller=require(_0x103e('0x9'));router[_0x103e('0xa')]('/',auth['isAuthenticated'](),controller[_0x103e('0xb')]);router[_0x103e('0xa')](_0x103e('0xc'),auth[_0x103e('0xd')](),controller['show']);router[_0x103e('0xe')]('/',auth[_0x103e('0xd')](),controller['create']);router[_0x103e('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x103e('0x10')]);router[_0x103e('0x11')](_0x103e('0xc'),auth[_0x103e('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xcc94=['create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','post'];(function(_0x4c3964,_0x186c38){var _0x21530b=function(_0x415d12){while(--_0x415d12){_0x4c3964['push'](_0x4c3964['shift']());}};_0x21530b(++_0x186c38);}(_0xcc94,0x64));var _0x4cc9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcc94[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x4cc9('0x0'));var path=require(_0x4cc9('0x1'));var timeout=require(_0x4cc9('0x2'));var express=require(_0x4cc9('0x3'));var router=express[_0x4cc9('0x4')]();var fs_extra=require(_0x4cc9('0x5'));var auth=require(_0x4cc9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4cc9('0x7'));var controller=require('./intZendeskField.controller');router[_0x4cc9('0x8')]('/',auth['isAuthenticated'](),controller[_0x4cc9('0x9')]);router[_0x4cc9('0x8')](_0x4cc9('0xa'),auth[_0x4cc9('0xb')](),controller[_0x4cc9('0xc')]);router[_0x4cc9('0xd')]('/',auth[_0x4cc9('0xb')](),controller[_0x4cc9('0xe')]);router[_0x4cc9('0xf')](_0x4cc9('0xa'),auth[_0x4cc9('0xb')](),controller[_0x4cc9('0x10')]);router['delete'](_0x4cc9('0xa'),auth[_0x4cc9('0xb')](),controller[_0x4cc9('0x11')]);module[_0x4cc9('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 4f529f0..8b20bd4 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 _0xa238=['variable','sequelize','exports','ENUM','keyValue','picklist','string','STRING'];(function(_0x3cc9d9,_0x69ed38){var _0x1a425d=function(_0x44d109){while(--_0x44d109){_0x3cc9d9['push'](_0x3cc9d9['shift']());}};_0x1a425d(++_0x69ed38);}(_0xa238,0x189));var _0x8a23=function(_0x4447f1,_0x843fda){_0x4447f1=_0x4447f1-0x0;var _0x12f540=_0xa238[_0x4447f1];return _0x12f540;};'use strict';var Sequelize=require(_0x8a23('0x0'));module[_0x8a23('0x1')]={'type':{'type':Sequelize[_0x8a23('0x2')]('string','variable','customVariable',_0x8a23('0x3'),_0x8a23('0x4')),'defaultValue':_0x8a23('0x5')},'content':{'type':Sequelize[_0x8a23('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8a23('0x2')](_0x8a23('0x5'),_0x8a23('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x8a23('0x6')]},'idField':{'type':Sequelize[_0x8a23('0x6')]},'nameField':{'type':Sequelize[_0x8a23('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8a23('0x6')]}}; \ No newline at end of file +var _0xcf76=['keyValue','picklist','STRING','variable','BOOLEAN','ENUM','string','customVariable'];(function(_0x39f6b4,_0x3702da){var _0x3d90c0=function(_0x77b335){while(--_0x77b335){_0x39f6b4['push'](_0x39f6b4['shift']());}};_0x3d90c0(++_0x3702da);}(_0xcf76,0xed));var _0x6cf7=function(_0x31e7b5,_0x531855){_0x31e7b5=_0x31e7b5-0x0;var _0x2d1651=_0xcf76[_0x31e7b5];return _0x2d1651;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x6cf7('0x0')](_0x6cf7('0x1'),'variable',_0x6cf7('0x2'),_0x6cf7('0x3'),_0x6cf7('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6cf7('0x5')]},'key':{'type':Sequelize[_0x6cf7('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0x6cf7('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x6cf7('0x5')]},'idField':{'type':Sequelize[_0x6cf7('0x5')]},'nameField':{'type':Sequelize[_0x6cf7('0x5')]},'customField':{'type':Sequelize[_0x6cf7('0x7')],'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 70f21ce..bb4adaf 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 _0x7b79=['lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','model','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','filters','fields','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra'];(function(_0x17bb31,_0x2fc6f8){var _0x505c71=function(_0x5013cf){while(--_0x5013cf){_0x17bb31['push'](_0x17bb31['shift']());}};_0x505c71(++_0x2fc6f8);}(_0x7b79,0x1b6));var _0x97b7=function(_0x2b53ba,_0x54c027){_0x2b53ba=_0x2b53ba-0x0;var _0x5d933e=_0x7b79[_0x2b53ba];return _0x5d933e;};'use strict';var emlformat=require(_0x97b7('0x0'));var rimraf=require(_0x97b7('0x1'));var zipdir=require(_0x97b7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x97b7('0x3'));var moment=require(_0x97b7('0x4'));var BPromise=require(_0x97b7('0x5'));var Mustache=require(_0x97b7('0x6'));var util=require('util');var path=require(_0x97b7('0x7'));var sox=require(_0x97b7('0x8'));var csv=require(_0x97b7('0x9'));var ejs=require(_0x97b7('0xa'));var fs=require('fs');var fs_extra=require(_0x97b7('0xb'));var _=require(_0x97b7('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x97b7('0x9'));var querystring=require(_0x97b7('0xd'));var Papa=require(_0x97b7('0xe'));var Redis=require(_0x97b7('0xf'));var authService=require(_0x97b7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x97b7('0x11'));var hardwareService=require(_0x97b7('0x12'));var logger=require('../../config/logger')(_0x97b7('0x13'));var utils=require(_0x97b7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x97b7('0x15'));var db=require(_0x97b7('0x16'))['db'];function respondWithStatusCode(_0x17d3b1,_0x54cf0c){_0x54cf0c=_0x54cf0c||0xcc;return function(_0x1c0d09){if(_0x1c0d09){return _0x17d3b1[_0x97b7('0x17')](_0x54cf0c);}return _0x17d3b1[_0x97b7('0x18')](_0x54cf0c)[_0x97b7('0x19')]();};}function respondWithResult(_0x2a8602,_0x3d2dbb){_0x3d2dbb=_0x3d2dbb||0xc8;return function(_0xcd061e){if(_0xcd061e){return _0x2a8602[_0x97b7('0x18')](_0x3d2dbb)['json'](_0xcd061e);}};}function respondWithFilteredResult(_0xcd4293,_0x2f2c45){return function(_0x4914ec){if(_0x4914ec){var _0x3714f0=typeof _0x2f2c45[_0x97b7('0x1a')]===_0x97b7('0x1b')&&typeof _0x2f2c45[_0x97b7('0x1c')]===_0x97b7('0x1b');var _0x535415=_0x4914ec[_0x97b7('0x1d')];var _0x14890a=_0x3714f0?0x0:_0x2f2c45[_0x97b7('0x1a')];var _0x1859aa=_0x3714f0?_0x4914ec[_0x97b7('0x1d')]:_0x2f2c45['offset']+_0x2f2c45['limit'];var _0x1fe50e;if(_0x1859aa>=_0x535415){_0x1859aa=_0x535415;_0x1fe50e=0xc8;}else{_0x1fe50e=0xce;}_0xcd4293[_0x97b7('0x18')](_0x1fe50e);return _0xcd4293[_0x97b7('0x1e')](_0x97b7('0x1f'),_0x14890a+'-'+_0x1859aa+'/'+_0x535415)[_0x97b7('0x20')](_0x4914ec);}return null;};}function patchUpdates(_0x25447f){return function(_0xf3462b){try{jsonpatch[_0x97b7('0x21')](_0xf3462b,_0x25447f,!![]);}catch(_0x1ea827){return BPromise[_0x97b7('0x22')](_0x1ea827);}return _0xf3462b[_0x97b7('0x23')]();};}function saveUpdates(_0x15f129,_0x444fd6){return function(_0x223453){if(_0x223453){return _0x223453[_0x97b7('0x24')](_0x15f129)[_0x97b7('0x25')](function(_0xd85940){return _0xd85940;});}return null;};}function removeEntity(_0x114982,_0x32f2fb){return function(_0x47ef91){if(_0x47ef91){return _0x47ef91[_0x97b7('0x26')]()['then'](function(){_0x114982['status'](0xcc)[_0x97b7('0x19')]();});}};}function handleEntityNotFound(_0x5887af,_0x15ef36){return function(_0x21c0c2){if(!_0x21c0c2){_0x5887af[_0x97b7('0x17')](0x194);}return _0x21c0c2;};}function handleError(_0x79f056,_0x2d07f7){_0x2d07f7=_0x2d07f7||0x1f4;return function(_0x119640){logger[_0x97b7('0x27')](_0x119640[_0x97b7('0x28')]);if(_0x119640[_0x97b7('0x29')]){delete _0x119640['name'];}_0x79f056[_0x97b7('0x18')](_0x2d07f7)[_0x97b7('0x2a')](_0x119640);};}exports[_0x97b7('0x2b')]=function(_0x289035,_0x1d33d5){var _0x2534f6={},_0x39a451={},_0x94ed14={'count':0x0,'rows':[]};var _0x1ff39b=_[_0x97b7('0x2c')](db[_0x97b7('0x2d')][_0x97b7('0x2e')],function(_0x3c96a8){return{'name':_0x3c96a8[_0x97b7('0x2f')],'type':_0x3c96a8['type']['key']};});_0x39a451[_0x97b7('0x30')]=_[_0x97b7('0x2c')](_0x1ff39b,_0x97b7('0x29'));_0x39a451['query']=_[_0x97b7('0x31')](_0x289035[_0x97b7('0x32')]);_0x39a451['filters']=_[_0x97b7('0x33')](_0x39a451['model'],_0x39a451[_0x97b7('0x32')]);_0x2534f6['attributes']=_[_0x97b7('0x33')](_0x39a451[_0x97b7('0x30')],qs['fields'](_0x289035['query']['fields']));_0x2534f6[_0x97b7('0x34')]=_0x2534f6[_0x97b7('0x34')][_0x97b7('0x35')]?_0x2534f6[_0x97b7('0x34')]:_0x39a451[_0x97b7('0x30')];if(!_0x289035[_0x97b7('0x32')][_0x97b7('0x36')](_0x97b7('0x37'))){_0x2534f6[_0x97b7('0x1c')]=qs[_0x97b7('0x1c')](_0x289035[_0x97b7('0x32')][_0x97b7('0x1c')]);_0x2534f6[_0x97b7('0x1a')]=qs[_0x97b7('0x1a')](_0x289035[_0x97b7('0x32')][_0x97b7('0x1a')]);}_0x2534f6[_0x97b7('0x38')]=qs[_0x97b7('0x39')](_0x289035[_0x97b7('0x32')][_0x97b7('0x39')]);_0x2534f6[_0x97b7('0x3a')]=qs['filters'](_['pick'](_0x289035[_0x97b7('0x32')],_0x39a451['filters']),_0x1ff39b);if(_0x289035[_0x97b7('0x32')][_0x97b7('0x3b')]){_0x2534f6[_0x97b7('0x3a')]=_[_0x97b7('0x3c')](_0x2534f6[_0x97b7('0x3a')],{'$or':_['map'](_0x1ff39b,function(_0x53149b){if(_0x53149b[_0x97b7('0x3d')]!==_0x97b7('0x3e')){var _0x1e31c1={};_0x1e31c1[_0x53149b[_0x97b7('0x29')]]={'$like':'%'+_0x289035[_0x97b7('0x32')][_0x97b7('0x3b')]+'%'};return _0x1e31c1;}})});}_0x2534f6=_[_0x97b7('0x3c')]({},_0x2534f6,_0x289035[_0x97b7('0x3f')]);var _0x561268={'where':_0x2534f6[_0x97b7('0x3a')]};return db[_0x97b7('0x2d')][_0x97b7('0x1d')](_0x561268)['then'](function(_0x51c060){_0x94ed14[_0x97b7('0x1d')]=_0x51c060;if(_0x289035[_0x97b7('0x32')][_0x97b7('0x40')]){_0x2534f6[_0x97b7('0x41')]=[{'all':!![]}];}return db[_0x97b7('0x2d')][_0x97b7('0x42')](_0x2534f6);})[_0x97b7('0x25')](function(_0x56b561){_0x94ed14['rows']=_0x56b561;return _0x94ed14;})[_0x97b7('0x25')](respondWithFilteredResult(_0x1d33d5,_0x2534f6))[_0x97b7('0x43')](handleError(_0x1d33d5,null));};exports[_0x97b7('0x44')]=function(_0x22a809,_0x2ba566){var _0x49da28={'raw':!![],'where':{'id':_0x22a809['params']['id']}},_0x20b295={};_0x20b295[_0x97b7('0x30')]=_[_0x97b7('0x31')](db[_0x97b7('0x2d')]['rawAttributes']);_0x20b295['query']=_[_0x97b7('0x31')](_0x22a809['query']);_0x20b295[_0x97b7('0x45')]=_['intersection'](_0x20b295[_0x97b7('0x30')],_0x20b295[_0x97b7('0x32')]);_0x49da28[_0x97b7('0x34')]=_['intersection'](_0x20b295['model'],qs[_0x97b7('0x46')](_0x22a809['query'][_0x97b7('0x46')]));_0x49da28['attributes']=_0x49da28['attributes'][_0x97b7('0x35')]?_0x49da28[_0x97b7('0x34')]:_0x20b295[_0x97b7('0x30')];if(_0x22a809[_0x97b7('0x32')][_0x97b7('0x40')]){_0x49da28['include']=[{'all':!![]}];}_0x49da28=_[_0x97b7('0x3c')]({},_0x49da28,_0x22a809[_0x97b7('0x3f')]);return db['ZendeskField'][_0x97b7('0x47')](_0x49da28)[_0x97b7('0x25')](handleEntityNotFound(_0x2ba566,null))['then'](respondWithResult(_0x2ba566,null))['catch'](handleError(_0x2ba566,null));};exports[_0x97b7('0x48')]=function(_0xa7af48,_0x1493a7){return db[_0x97b7('0x2d')][_0x97b7('0x48')](_0xa7af48['body'],{})[_0x97b7('0x25')](respondWithResult(_0x1493a7,0xc9))[_0x97b7('0x43')](handleError(_0x1493a7,null));};exports[_0x97b7('0x24')]=function(_0x40103d,_0x4ea470){if(_0x40103d[_0x97b7('0x49')]['id']){delete _0x40103d[_0x97b7('0x49')]['id'];}return db['ZendeskField']['find']({'where':{'id':_0x40103d[_0x97b7('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4ea470,null))['then'](saveUpdates(_0x40103d[_0x97b7('0x49')],null))[_0x97b7('0x25')](respondWithResult(_0x4ea470,null))[_0x97b7('0x43')](handleError(_0x4ea470,null));};exports[_0x97b7('0x26')]=function(_0xe9d86e,_0x30c085){return db[_0x97b7('0x2d')][_0x97b7('0x47')]({'where':{'id':_0xe9d86e[_0x97b7('0x4a')]['id']}})[_0x97b7('0x25')](handleEntityNotFound(_0x30c085,null))['then'](removeEntity(_0x30c085,null))[_0x97b7('0x43')](handleError(_0x30c085,null));}; \ No newline at end of file +var _0x4867=['map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','show','params','length','include','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index'];(function(_0x1d2727,_0x7dadd8){var _0x531212=function(_0x2d15aa){while(--_0x2d15aa){_0x1d2727['push'](_0x1d2727['shift']());}};_0x531212(++_0x7dadd8);}(_0x4867,0xc1));var _0x7486=function(_0x639fd7,_0x2d4036){_0x639fd7=_0x639fd7-0x0;var _0x5b5c1a=_0x4867[_0x639fd7];return _0x5b5c1a;};'use strict';var emlformat=require(_0x7486('0x0'));var rimraf=require(_0x7486('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7486('0x2'));var rp=require(_0x7486('0x3'));var moment=require(_0x7486('0x4'));var BPromise=require(_0x7486('0x5'));var Mustache=require('mustache');var util=require(_0x7486('0x6'));var path=require(_0x7486('0x7'));var sox=require(_0x7486('0x8'));var csv=require(_0x7486('0x9'));var ejs=require(_0x7486('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7486('0xb'));var squel=require(_0x7486('0xc'));var crypto=require('crypto');var jsforce=require(_0x7486('0xd'));var deskjs=require(_0x7486('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7486('0xf'));var Papa=require(_0x7486('0x10'));var Redis=require(_0x7486('0x11'));var authService=require(_0x7486('0x12'));var qs=require(_0x7486('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7486('0x14'));var logger=require(_0x7486('0x15'))(_0x7486('0x16'));var utils=require(_0x7486('0x17'));var config=require(_0x7486('0x18'));var licenseUtil=require(_0x7486('0x19'));var db=require(_0x7486('0x1a'))['db'];function respondWithStatusCode(_0xbf10e2,_0x413936){_0x413936=_0x413936||0xcc;return function(_0x46c8d4){if(_0x46c8d4){return _0xbf10e2['sendStatus'](_0x413936);}return _0xbf10e2[_0x7486('0x1b')](_0x413936)[_0x7486('0x1c')]();};}function respondWithResult(_0x4c42e4,_0x681c66){_0x681c66=_0x681c66||0xc8;return function(_0x500510){if(_0x500510){return _0x4c42e4[_0x7486('0x1b')](_0x681c66)[_0x7486('0x1d')](_0x500510);}};}function respondWithFilteredResult(_0x4f1bd8,_0x7f439){return function(_0x21618c){if(_0x21618c){var _0x2075b3=typeof _0x7f439['offset']===_0x7486('0x1e')&&typeof _0x7f439[_0x7486('0x1f')]===_0x7486('0x1e');var _0x492487=_0x21618c[_0x7486('0x20')];var _0x4453ff=_0x2075b3?0x0:_0x7f439['offset'];var _0x5693f1=_0x2075b3?_0x21618c[_0x7486('0x20')]:_0x7f439[_0x7486('0x21')]+_0x7f439[_0x7486('0x1f')];var _0x1635ee;if(_0x5693f1>=_0x492487){_0x5693f1=_0x492487;_0x1635ee=0xc8;}else{_0x1635ee=0xce;}_0x4f1bd8[_0x7486('0x1b')](_0x1635ee);return _0x4f1bd8[_0x7486('0x22')](_0x7486('0x23'),_0x4453ff+'-'+_0x5693f1+'/'+_0x492487)[_0x7486('0x1d')](_0x21618c);}return null;};}function patchUpdates(_0x12d33a){return function(_0x56300c){try{jsonpatch[_0x7486('0x24')](_0x56300c,_0x12d33a,!![]);}catch(_0x1ac971){return BPromise[_0x7486('0x25')](_0x1ac971);}return _0x56300c[_0x7486('0x26')]();};}function saveUpdates(_0x1787ae,_0x4a24e6){return function(_0x3e66be){if(_0x3e66be){return _0x3e66be[_0x7486('0x27')](_0x1787ae)[_0x7486('0x28')](function(_0x511afc){return _0x511afc;});}return null;};}function removeEntity(_0x13cc27,_0x31ab17){return function(_0x374358){if(_0x374358){return _0x374358[_0x7486('0x29')]()[_0x7486('0x28')](function(){_0x13cc27[_0x7486('0x1b')](0xcc)[_0x7486('0x1c')]();});}};}function handleEntityNotFound(_0x5580af,_0x4f1d9f){return function(_0x138f1a){if(!_0x138f1a){_0x5580af[_0x7486('0x2a')](0x194);}return _0x138f1a;};}function handleError(_0x203806,_0x52cd9d){_0x52cd9d=_0x52cd9d||0x1f4;return function(_0x21b77a){logger[_0x7486('0x2b')](_0x21b77a[_0x7486('0x2c')]);if(_0x21b77a['name']){delete _0x21b77a[_0x7486('0x2d')];}_0x203806[_0x7486('0x1b')](_0x52cd9d)['send'](_0x21b77a);};}exports[_0x7486('0x2e')]=function(_0x408f37,_0x4fe6e9){var _0x826729={},_0x6d7a97={},_0x49b72c={'count':0x0,'rows':[]};var _0x420566=_[_0x7486('0x2f')](db[_0x7486('0x30')][_0x7486('0x31')],function(_0x407bc7){return{'name':_0x407bc7[_0x7486('0x32')],'type':_0x407bc7[_0x7486('0x33')][_0x7486('0x34')]};});_0x6d7a97[_0x7486('0x35')]=_[_0x7486('0x2f')](_0x420566,_0x7486('0x2d'));_0x6d7a97[_0x7486('0x36')]=_[_0x7486('0x37')](_0x408f37[_0x7486('0x36')]);_0x6d7a97['filters']=_['intersection'](_0x6d7a97['model'],_0x6d7a97[_0x7486('0x36')]);_0x826729[_0x7486('0x38')]=_[_0x7486('0x39')](_0x6d7a97[_0x7486('0x35')],qs[_0x7486('0x3a')](_0x408f37[_0x7486('0x36')][_0x7486('0x3a')]));_0x826729[_0x7486('0x38')]=_0x826729['attributes']['length']?_0x826729[_0x7486('0x38')]:_0x6d7a97[_0x7486('0x35')];if(!_0x408f37['query'][_0x7486('0x3b')](_0x7486('0x3c'))){_0x826729[_0x7486('0x1f')]=qs['limit'](_0x408f37[_0x7486('0x36')][_0x7486('0x1f')]);_0x826729[_0x7486('0x21')]=qs[_0x7486('0x21')](_0x408f37[_0x7486('0x36')][_0x7486('0x21')]);}_0x826729[_0x7486('0x3d')]=qs[_0x7486('0x3e')](_0x408f37[_0x7486('0x36')]['sort']);_0x826729['where']=qs[_0x7486('0x3f')](_[_0x7486('0x40')](_0x408f37[_0x7486('0x36')],_0x6d7a97['filters']),_0x420566);if(_0x408f37['query'][_0x7486('0x41')]){_0x826729[_0x7486('0x42')]=_[_0x7486('0x43')](_0x826729[_0x7486('0x42')],{'$or':_[_0x7486('0x2f')](_0x420566,function(_0x385b4c){if(_0x385b4c[_0x7486('0x33')]!==_0x7486('0x44')){var _0x2d88b0={};_0x2d88b0[_0x385b4c[_0x7486('0x2d')]]={'$like':'%'+_0x408f37[_0x7486('0x36')][_0x7486('0x41')]+'%'};return _0x2d88b0;}})});}_0x826729=_['merge']({},_0x826729,_0x408f37[_0x7486('0x45')]);var _0x4dd134={'where':_0x826729[_0x7486('0x42')]};return db['ZendeskField'][_0x7486('0x20')](_0x4dd134)[_0x7486('0x28')](function(_0x51c950){_0x49b72c[_0x7486('0x20')]=_0x51c950;if(_0x408f37[_0x7486('0x36')][_0x7486('0x46')]){_0x826729['include']=[{'all':!![]}];}return db[_0x7486('0x30')][_0x7486('0x47')](_0x826729);})[_0x7486('0x28')](function(_0x12c239){_0x49b72c['rows']=_0x12c239;return _0x49b72c;})[_0x7486('0x28')](respondWithFilteredResult(_0x4fe6e9,_0x826729))['catch'](handleError(_0x4fe6e9,null));};exports[_0x7486('0x48')]=function(_0x20ea23,_0xc1a595){var _0x30bb7c={'raw':!![],'where':{'id':_0x20ea23[_0x7486('0x49')]['id']}},_0x13cec4={};_0x13cec4[_0x7486('0x35')]=_[_0x7486('0x37')](db[_0x7486('0x30')]['rawAttributes']);_0x13cec4[_0x7486('0x36')]=_[_0x7486('0x37')](_0x20ea23[_0x7486('0x36')]);_0x13cec4[_0x7486('0x3f')]=_['intersection'](_0x13cec4[_0x7486('0x35')],_0x13cec4[_0x7486('0x36')]);_0x30bb7c[_0x7486('0x38')]=_[_0x7486('0x39')](_0x13cec4[_0x7486('0x35')],qs[_0x7486('0x3a')](_0x20ea23['query'][_0x7486('0x3a')]));_0x30bb7c['attributes']=_0x30bb7c[_0x7486('0x38')][_0x7486('0x4a')]?_0x30bb7c[_0x7486('0x38')]:_0x13cec4['model'];if(_0x20ea23['query'][_0x7486('0x46')]){_0x30bb7c[_0x7486('0x4b')]=[{'all':!![]}];}_0x30bb7c=_[_0x7486('0x43')]({},_0x30bb7c,_0x20ea23[_0x7486('0x45')]);return db[_0x7486('0x30')][_0x7486('0x4c')](_0x30bb7c)[_0x7486('0x28')](handleEntityNotFound(_0xc1a595,null))[_0x7486('0x28')](respondWithResult(_0xc1a595,null))[_0x7486('0x4d')](handleError(_0xc1a595,null));};exports[_0x7486('0x4e')]=function(_0xde5ad3,_0xe567ee){return db[_0x7486('0x30')][_0x7486('0x4e')](_0xde5ad3[_0x7486('0x4f')],{})[_0x7486('0x28')](respondWithResult(_0xe567ee,0xc9))['catch'](handleError(_0xe567ee,null));};exports[_0x7486('0x27')]=function(_0x2ce12f,_0xfe952c){if(_0x2ce12f[_0x7486('0x4f')]['id']){delete _0x2ce12f[_0x7486('0x4f')]['id'];}return db[_0x7486('0x30')][_0x7486('0x4c')]({'where':{'id':_0x2ce12f[_0x7486('0x49')]['id']}})[_0x7486('0x28')](handleEntityNotFound(_0xfe952c,null))['then'](saveUpdates(_0x2ce12f[_0x7486('0x4f')],null))[_0x7486('0x28')](respondWithResult(_0xfe952c,null))[_0x7486('0x4d')](handleError(_0xfe952c,null));};exports[_0x7486('0x29')]=function(_0x3352f7,_0xef1fd7){return db[_0x7486('0x30')][_0x7486('0x4c')]({'where':{'id':_0x3352f7['params']['id']}})[_0x7486('0x28')](handleEntityNotFound(_0xef1fd7,null))[_0x7486('0x28')](removeEntity(_0xef1fd7,null))[_0x7486('0x4d')](handleError(_0xef1fd7,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 58ba813..cffb6d5 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 _0x73eb=['request-promise','path','rimraf','./intZendeskField.attributes','define','int_zendesk_fields','zendesk_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_0x73eb,0x1ba));var _0xb73e=function(_0x14a232,_0x5d103c){_0x14a232=_0x14a232-0x0;var _0x4e3e39=_0x73eb[_0x14a232];return _0x4e3e39;};'use strict';var _=require(_0xb73e('0x0'));var util=require(_0xb73e('0x1'));var logger=require(_0xb73e('0x2'))(_0xb73e('0x3'));var moment=require(_0xb73e('0x4'));var BPromise=require(_0xb73e('0x5'));var rp=require(_0xb73e('0x6'));var fs=require('fs');var path=require(_0xb73e('0x7'));var rimraf=require(_0xb73e('0x8'));var config=require('../../config/environment');var attributes=require(_0xb73e('0x9'));module['exports']=function(_0x2047e8,_0x498b68){return _0x2047e8[_0xb73e('0xa')]('ZendeskField',attributes,{'tableName':_0xb73e('0xb'),'paranoid':![],'indexes':[{'name':_0xb73e('0xc'),'fields':['idField',_0xb73e('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x898b=['exports','int_zendesk_fields','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xf1226a,_0x29a250){var _0x1b8fe7=function(_0x7178a5){while(--_0x7178a5){_0xf1226a['push'](_0xf1226a['shift']());}};_0x1b8fe7(++_0x29a250);}(_0x898b,0x12f));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 logger=require('../../config/logger')(_0xb898('0x2'));var moment=require(_0xb898('0x3'));var BPromise=require(_0xb898('0x4'));var rp=require(_0xb898('0x5'));var fs=require('fs');var path=require(_0xb898('0x6'));var rimraf=require(_0xb898('0x7'));var config=require(_0xb898('0x8'));var attributes=require('./intZendeskField.attributes');module[_0xb898('0x9')]=function(_0x3b0e0c,_0x88bfb2){return _0x3b0e0c['define']('ZendeskField',attributes,{'tableName':_0xb898('0xa'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xb898('0xb'),_0xb898('0xc')],'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 db5b11f..a7fdf30 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 _0xf7e8=['message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0xf7e8,0x1ce));var _0x8f7e=function(_0x4eaa32,_0x3c5d38){_0x4eaa32=_0x4eaa32-0x0;var _0x3cfd8b=_0xf7e8[_0x4eaa32];return _0x3cfd8b;};'use strict';var _=require(_0x8f7e('0x0'));var util=require(_0x8f7e('0x1'));var moment=require(_0x8f7e('0x2'));var BPromise=require(_0x8f7e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f7e('0x4'));var db=require(_0x8f7e('0x5'))['db'];var utils=require(_0x8f7e('0x6'));var logger=require(_0x8f7e('0x7'))(_0x8f7e('0x8'));var config=require('../../config/environment');var jayson=require(_0x8f7e('0x9'));var client=jayson[_0x8f7e('0xa')][_0x8f7e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ebbce,_0x23380b,_0x30e47c){return new BPromise(function(_0x1536aa,_0x1c0335){return client[_0x8f7e('0xc')](_0x4ebbce,_0x30e47c)['then'](function(_0x25178d){logger[_0x8f7e('0xd')](_0x8f7e('0xe'),_0x23380b,'request\x20sent');logger[_0x8f7e('0xf')](_0x8f7e('0x10'),_0x23380b,_0x8f7e('0x11'),JSON[_0x8f7e('0x12')](_0x25178d));if(_0x25178d[_0x8f7e('0x13')]){if(_0x25178d[_0x8f7e('0x13')][_0x8f7e('0x14')]===0x1f4){logger[_0x8f7e('0x13')](_0x8f7e('0xe'),_0x23380b,_0x25178d[_0x8f7e('0x13')][_0x8f7e('0x15')]);return _0x1c0335(_0x25178d['error']['message']);}logger[_0x8f7e('0x13')]('ZendeskField,\x20%s,\x20%s',_0x23380b,_0x25178d[_0x8f7e('0x13')]['message']);return _0x1536aa(_0x25178d['error'][_0x8f7e('0x15')]);}else{logger[_0x8f7e('0xd')](_0x8f7e('0xe'),_0x23380b,_0x8f7e('0x11'));_0x1536aa(_0x25178d['result'][_0x8f7e('0x15')]);}})[_0x8f7e('0x16')](function(_0x269737){logger['error'](_0x8f7e('0xe'),_0x23380b,_0x269737);_0x1c0335(_0x269737);});});} \ No newline at end of file +var _0x747b=['debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x747b,0x105));var _0xb747=function(_0x4d5f37,_0x431410){_0x4d5f37=_0x4d5f37-0x0;var _0x5ef460=_0x747b[_0x4d5f37];return _0x5ef460;};'use strict';var _=require(_0xb747('0x0'));var util=require('util');var moment=require(_0xb747('0x1'));var BPromise=require(_0xb747('0x2'));var rs=require(_0xb747('0x3'));var fs=require('fs');var Redis=require(_0xb747('0x4'));var db=require(_0xb747('0x5'))['db'];var utils=require(_0xb747('0x6'));var logger=require(_0xb747('0x7'))(_0xb747('0x8'));var config=require(_0xb747('0x9'));var jayson=require(_0xb747('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x676ec1,_0x3cddca,_0x53a4e5){return new BPromise(function(_0x52d0b3,_0xb72b15){return client['request'](_0x676ec1,_0x53a4e5)[_0xb747('0xb')](function(_0x551c3c){logger[_0xb747('0xc')](_0xb747('0xd'),_0x3cddca,_0xb747('0xe'));logger[_0xb747('0xf')](_0xb747('0x10'),_0x3cddca,_0xb747('0xe'),JSON[_0xb747('0x11')](_0x551c3c));if(_0x551c3c['error']){if(_0x551c3c['error'][_0xb747('0x12')]===0x1f4){logger['error'](_0xb747('0xd'),_0x3cddca,_0x551c3c[_0xb747('0x13')][_0xb747('0x14')]);return _0xb72b15(_0x551c3c[_0xb747('0x13')]['message']);}logger['error'](_0xb747('0xd'),_0x3cddca,_0x551c3c[_0xb747('0x13')][_0xb747('0x14')]);return _0x52d0b3(_0x551c3c[_0xb747('0x13')]['message']);}else{logger[_0xb747('0xc')](_0xb747('0xd'),_0x3cddca,_0xb747('0xe'));_0x52d0b3(_0x551c3c[_0xb747('0x15')]['message']);}})[_0xb747('0x16')](function(_0x5229a9){logger[_0xb747('0x13')](_0xb747('0xd'),_0x3cddca,_0x5229a9);_0xb72b15(_0x5229a9);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index ebcbb10..4123483 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 _0xa292=['isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index'];(function(_0x36a236,_0x3cc5fc){var _0xa4ab27=function(_0xac60ea){while(--_0xac60ea){_0x36a236['push'](_0x36a236['shift']());}};_0xa4ab27(++_0x3cc5fc);}(_0xa292,0x80));var _0x2a29=function(_0x959591,_0x5aa72b){_0x959591=_0x959591-0x0;var _0xc85623=_0xa292[_0x959591];return _0xc85623;};'use strict';var multer=require(_0x2a29('0x0'));var util=require(_0x2a29('0x1'));var path=require(_0x2a29('0x2'));var timeout=require(_0x2a29('0x3'));var express=require(_0x2a29('0x4'));var router=express[_0x2a29('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2a29('0x6'));var config=require(_0x2a29('0x7'));var controller=require('./intZohoAccount.controller');router[_0x2a29('0x8')]('/',auth['isAuthenticated'](),controller[_0x2a29('0x9')]);router['get']('/:id',auth[_0x2a29('0xa')](),controller['show']);router[_0x2a29('0x8')](_0x2a29('0xb'),auth[_0x2a29('0xa')](),controller[_0x2a29('0xc')]);router[_0x2a29('0x8')](_0x2a29('0xd'),auth[_0x2a29('0xa')](),controller[_0x2a29('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2a29('0xf')]);router[_0x2a29('0x10')](_0x2a29('0xb'),auth[_0x2a29('0xa')](),controller[_0x2a29('0x11')]);router[_0x2a29('0x12')]('/:id',auth[_0x2a29('0xa')](),controller[_0x2a29('0x13')]);router[_0x2a29('0x14')](_0x2a29('0x15'),auth[_0x2a29('0xa')](),controller['destroy']);module[_0x2a29('0x16')]=router; \ No newline at end of file +var _0x5d4e=['get','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','put','/:id','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intZohoAccount.controller','isAuthenticated','index','show'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x5d4e,0xda));var _0xe5d4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5d4e[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xe5d4('0x0'));var util=require(_0xe5d4('0x1'));var path=require(_0xe5d4('0x2'));var timeout=require(_0xe5d4('0x3'));var express=require(_0xe5d4('0x4'));var router=express[_0xe5d4('0x5')]();var fs_extra=require(_0xe5d4('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe5d4('0x7'));var controller=require(_0xe5d4('0x8'));router['get']('/',auth[_0xe5d4('0x9')](),controller[_0xe5d4('0xa')]);router['get']('/:id',auth[_0xe5d4('0x9')](),controller[_0xe5d4('0xb')]);router[_0xe5d4('0xc')](_0xe5d4('0xd'),auth[_0xe5d4('0x9')](),controller['getConfigurations']);router[_0xe5d4('0xc')](_0xe5d4('0xe'),auth['isAuthenticated'](),controller[_0xe5d4('0xf')]);router['post']('/',auth[_0xe5d4('0x9')](),controller[_0xe5d4('0x10')]);router[_0xe5d4('0x11')](_0xe5d4('0xd'),auth[_0xe5d4('0x9')](),controller[_0xe5d4('0x12')]);router[_0xe5d4('0x13')](_0xe5d4('0x14'),auth[_0xe5d4('0x9')](),controller[_0xe5d4('0x15')]);router[_0xe5d4('0x16')](_0xe5d4('0x14'),auth[_0xe5d4('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index c96a29f..75008d8 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 _0xd2ea=['sequelize','exports','STRING'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0xd2ea,0x15f));var _0xad2e=function(_0x2c133b,_0x3a5dc7){_0x2c133b=_0x2c133b-0x0;var _0x339eac=_0xd2ea[_0x2c133b];return _0x339eac;};'use strict';var Sequelize=require(_0xad2e('0x0'));module[_0xad2e('0x1')]={'name':{'type':Sequelize[_0xad2e('0x2')]},'description':{'type':Sequelize[_0xad2e('0x2')]},'host':{'type':Sequelize[_0xad2e('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xad2e('0x2')]},'clientSecret':{'type':Sequelize[_0xad2e('0x2')]},'serverUrl':{'type':Sequelize[_0xad2e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xad2e('0x2')]},'refreshToken':{'type':Sequelize[_0xad2e('0x2')]}}; \ No newline at end of file +var _0xedd9=['exports','STRING'];(function(_0x5da1a1,_0x2c5179){var _0x5c5cb3=function(_0x48b798){while(--_0x48b798){_0x5da1a1['push'](_0x5da1a1['shift']());}};_0x5c5cb3(++_0x2c5179);}(_0xedd9,0xfc));var _0x9edd=function(_0xec3cab,_0x3d89a1){_0xec3cab=_0xec3cab-0x0;var _0x2e4e51=_0xedd9[_0xec3cab];return _0x2e4e51;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'name':{'type':Sequelize[_0x9edd('0x1')]},'description':{'type':Sequelize[_0x9edd('0x1')]},'host':{'type':Sequelize[_0x9edd('0x1')]},'zone':{'type':Sequelize[_0x9edd('0x1')]},'clientId':{'type':Sequelize[_0x9edd('0x1')]},'clientSecret':{'type':Sequelize[_0x9edd('0x1')]},'serverUrl':{'type':Sequelize[_0x9edd('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x9edd('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index c2a1b52..7e4c87a 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 _0xe463=['intersection','model','fields','attributes','length','query','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','create','body','find','params','getConfigurations','findOne','ZohoConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','serverUrl','com','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','message','Owner','Subject','Description','WhoId','Call_Type','remove','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','stringify','Wrong\x20credentials','statusCode','eml-format','zip-dir','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','keys','filters'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe463,0x1cd));var _0x3e46=function(_0x161017,_0x43c140){_0x161017=_0x161017-0x0;var _0xc83ff2=_0xe463[_0x161017];return _0xc83ff2;};'use strict';var emlformat=require(_0x3e46('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3e46('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3e46('0x2'));var moment=require(_0x3e46('0x3'));var BPromise=require(_0x3e46('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3e46('0x5'));var sox=require(_0x3e46('0x6'));var csv=require('to-csv');var ejs=require(_0x3e46('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3e46('0x8'));var squel=require(_0x3e46('0x9'));var crypto=require(_0x3e46('0xa'));var jsforce=require(_0x3e46('0xb'));var deskjs=require(_0x3e46('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3e46('0xd'));var Redis=require(_0x3e46('0xe'));var authService=require(_0x3e46('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3e46('0x10'));var hardwareService=require(_0x3e46('0x11'));var logger=require(_0x3e46('0x12'))(_0x3e46('0x13'));var utils=require(_0x3e46('0x14'));var config=require(_0x3e46('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3e46('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4605d1,_0x6a724b){_0x6a724b=_0x6a724b||0xcc;return function(_0x486ca6){if(_0x486ca6){return _0x4605d1[_0x3e46('0x17')](_0x6a724b);}return _0x4605d1[_0x3e46('0x18')](_0x6a724b)[_0x3e46('0x19')]();};}function respondWithResult(_0x5e7bb0,_0x301427){_0x301427=_0x301427||0xc8;return function(_0x520926){if(_0x520926){return _0x5e7bb0[_0x3e46('0x18')](_0x301427)[_0x3e46('0x1a')](_0x520926);}};}function respondWithFilteredResult(_0x4f2e84,_0x1ab437){return function(_0x4a82b3){if(_0x4a82b3){var _0x5f295f=typeof _0x1ab437[_0x3e46('0x1b')]==='undefined'&&typeof _0x1ab437[_0x3e46('0x1c')]===_0x3e46('0x1d');var _0x2eb192=_0x4a82b3[_0x3e46('0x1e')];var _0x53913a=_0x5f295f?0x0:_0x1ab437[_0x3e46('0x1b')];var _0x32c1bb=_0x5f295f?_0x4a82b3[_0x3e46('0x1e')]:_0x1ab437[_0x3e46('0x1b')]+_0x1ab437['limit'];var _0x4160fb;if(_0x32c1bb>=_0x2eb192){_0x32c1bb=_0x2eb192;_0x4160fb=0xc8;}else{_0x4160fb=0xce;}_0x4f2e84['status'](_0x4160fb);return _0x4f2e84[_0x3e46('0x1f')](_0x3e46('0x20'),_0x53913a+'-'+_0x32c1bb+'/'+_0x2eb192)[_0x3e46('0x1a')](_0x4a82b3);}return null;};}function patchUpdates(_0xeada6e){return function(_0x710f86){try{jsonpatch[_0x3e46('0x21')](_0x710f86,_0xeada6e,!![]);}catch(_0x46f905){return BPromise[_0x3e46('0x22')](_0x46f905);}return _0x710f86[_0x3e46('0x23')]();};}function saveUpdates(_0x5cb3b4,_0x4e8bc5){return function(_0x3f5e00){if(_0x3f5e00){return _0x3f5e00[_0x3e46('0x24')](_0x5cb3b4)['then'](function(_0x4a7913){return _0x4a7913;});}return null;};}function removeEntity(_0x11c2ed,_0x370c37){return function(_0x2fc65c){if(_0x2fc65c){return _0x2fc65c[_0x3e46('0x25')]()[_0x3e46('0x26')](function(){_0x11c2ed[_0x3e46('0x18')](0xcc)[_0x3e46('0x19')]();});}};}function handleEntityNotFound(_0x45d6f5,_0x3e7c6b){return function(_0x4d805c){if(!_0x4d805c){_0x45d6f5['sendStatus'](0x194);}return _0x4d805c;};}function handleError(_0x4e76cb,_0x47d3f3){_0x47d3f3=_0x47d3f3||0x1f4;return function(_0x6c8744){logger[_0x3e46('0x27')](_0x6c8744['stack']);if(_0x6c8744['name']){delete _0x6c8744[_0x3e46('0x28')];}_0x4e76cb['status'](_0x47d3f3)[_0x3e46('0x29')](_0x6c8744);};}exports[_0x3e46('0x2a')]=function(_0xa021d,_0x1ffacf){var _0x13ca7a={},_0x269fec={},_0x2025ec={'count':0x0,'rows':[]};var _0x49d2dc=_[_0x3e46('0x2b')](db[_0x3e46('0x2c')][_0x3e46('0x2d')],function(_0x1689ae){return{'name':_0x1689ae[_0x3e46('0x2e')],'type':_0x1689ae[_0x3e46('0x2f')][_0x3e46('0x30')]};});_0x269fec['model']=_[_0x3e46('0x2b')](_0x49d2dc,_0x3e46('0x28'));_0x269fec['query']=_[_0x3e46('0x31')](_0xa021d['query']);_0x269fec[_0x3e46('0x32')]=_['intersection'](_0x269fec['model'],_0x269fec['query']);_0x13ca7a['attributes']=_[_0x3e46('0x33')](_0x269fec[_0x3e46('0x34')],qs[_0x3e46('0x35')](_0xa021d['query'][_0x3e46('0x35')]));_0x13ca7a[_0x3e46('0x36')]=_0x13ca7a['attributes'][_0x3e46('0x37')]?_0x13ca7a[_0x3e46('0x36')]:_0x269fec[_0x3e46('0x34')];if(!_0xa021d[_0x3e46('0x38')][_0x3e46('0x39')](_0x3e46('0x3a'))){_0x13ca7a[_0x3e46('0x1c')]=qs[_0x3e46('0x1c')](_0xa021d[_0x3e46('0x38')]['limit']);_0x13ca7a[_0x3e46('0x1b')]=qs[_0x3e46('0x1b')](_0xa021d[_0x3e46('0x38')][_0x3e46('0x1b')]);}_0x13ca7a[_0x3e46('0x3b')]=qs[_0x3e46('0x3c')](_0xa021d[_0x3e46('0x38')][_0x3e46('0x3c')]);_0x13ca7a[_0x3e46('0x3d')]=qs[_0x3e46('0x32')](_[_0x3e46('0x3e')](_0xa021d['query'],_0x269fec['filters']),_0x49d2dc);if(_0xa021d[_0x3e46('0x38')][_0x3e46('0x3f')]){_0x13ca7a[_0x3e46('0x3d')]=_[_0x3e46('0x40')](_0x13ca7a[_0x3e46('0x3d')],{'$or':_[_0x3e46('0x2b')](_0x49d2dc,function(_0x59e1f1){if(_0x59e1f1[_0x3e46('0x2f')]!==_0x3e46('0x41')){var _0x546c2e={};_0x546c2e[_0x59e1f1['name']]={'$like':'%'+_0xa021d[_0x3e46('0x38')][_0x3e46('0x3f')]+'%'};return _0x546c2e;}})});}_0x13ca7a=_[_0x3e46('0x40')]({},_0x13ca7a,_0xa021d[_0x3e46('0x42')]);var _0x573f86={'where':_0x13ca7a[_0x3e46('0x3d')]};return db['ZohoAccount'][_0x3e46('0x1e')](_0x573f86)[_0x3e46('0x26')](function(_0x458ef6){_0x2025ec['count']=_0x458ef6;if(_0xa021d[_0x3e46('0x38')][_0x3e46('0x43')]){_0x13ca7a['include']=[{'all':!![]}];}return db[_0x3e46('0x2c')][_0x3e46('0x44')](_0x13ca7a);})[_0x3e46('0x26')](function(_0x206168){_0x2025ec[_0x3e46('0x45')]=_0x206168;return _0x2025ec;})[_0x3e46('0x26')](respondWithFilteredResult(_0x1ffacf,_0x13ca7a))[_0x3e46('0x46')](handleError(_0x1ffacf,null));};exports[_0x3e46('0x47')]=function(_0x2f9698,_0x4cf377){var _0x342b77={'raw':![],'where':{'id':_0x2f9698['params']['id']}},_0x498dbd={};_0x498dbd['model']=_[_0x3e46('0x31')](db[_0x3e46('0x2c')][_0x3e46('0x2d')]);_0x498dbd[_0x3e46('0x38')]=_[_0x3e46('0x31')](_0x2f9698['query']);_0x498dbd[_0x3e46('0x32')]=_[_0x3e46('0x33')](_0x498dbd[_0x3e46('0x34')],_0x498dbd['query']);_0x342b77[_0x3e46('0x36')]=_[_0x3e46('0x33')](_0x498dbd['model'],qs[_0x3e46('0x35')](_0x2f9698[_0x3e46('0x38')][_0x3e46('0x35')]));_0x342b77['attributes']=_0x342b77[_0x3e46('0x36')]['length']?_0x342b77['attributes']:_0x498dbd['model'];if(_0x2f9698[_0x3e46('0x38')][_0x3e46('0x43')]){_0x342b77[_0x3e46('0x48')]=[{'all':!![]}];}_0x342b77=_[_0x3e46('0x40')]({},_0x342b77,_0x2f9698[_0x3e46('0x42')]);return db[_0x3e46('0x2c')]['find'](_0x342b77)['then'](handleEntityNotFound(_0x4cf377,null))[_0x3e46('0x26')](respondWithResult(_0x4cf377,null))[_0x3e46('0x46')](handleError(_0x4cf377,null));};exports[_0x3e46('0x49')]=function(_0x5e22be,_0x20a183){return db[_0x3e46('0x2c')][_0x3e46('0x49')](_0x5e22be['body'],{})[_0x3e46('0x26')](respondWithResult(_0x20a183,0xc9))[_0x3e46('0x46')](handleError(_0x20a183,null));};exports[_0x3e46('0x24')]=function(_0x18a700,_0x212c96){if(_0x18a700[_0x3e46('0x4a')]['id']){delete _0x18a700[_0x3e46('0x4a')]['id'];}return db[_0x3e46('0x2c')]['find']({'where':{'id':_0x18a700['params']['id']}})[_0x3e46('0x26')](handleEntityNotFound(_0x212c96,null))[_0x3e46('0x26')](saveUpdates(_0x18a700[_0x3e46('0x4a')],null))[_0x3e46('0x26')](respondWithResult(_0x212c96,null))[_0x3e46('0x46')](handleError(_0x212c96,null));};exports[_0x3e46('0x25')]=function(_0x11f493,_0x553bfa){return db[_0x3e46('0x2c')][_0x3e46('0x4b')]({'where':{'id':_0x11f493[_0x3e46('0x4c')]['id']}})['then'](handleEntityNotFound(_0x553bfa,null))['then'](removeEntity(_0x553bfa,null))[_0x3e46('0x46')](handleError(_0x553bfa,null));};exports[_0x3e46('0x4d')]=function(_0x1d0162,_0x1087b5,_0x11be6c){var _0x227a45={};var _0x2a3e06={};var _0x4a7c63;var _0x291fb2;return db['ZohoAccount'][_0x3e46('0x4e')]({'where':{'id':_0x1d0162[_0x3e46('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1087b5,null))[_0x3e46('0x26')](function(_0x3cb74b){if(_0x3cb74b){_0x4a7c63=_0x3cb74b;_0x2a3e06[_0x3e46('0x34')]=_[_0x3e46('0x31')](db[_0x3e46('0x4f')][_0x3e46('0x2d')]);_0x2a3e06[_0x3e46('0x38')]=_[_0x3e46('0x31')](_0x1d0162[_0x3e46('0x38')]);_0x2a3e06[_0x3e46('0x32')]=_[_0x3e46('0x33')](_0x2a3e06['model'],_0x2a3e06[_0x3e46('0x38')]);_0x227a45[_0x3e46('0x36')]=_[_0x3e46('0x33')](_0x2a3e06['model'],qs[_0x3e46('0x35')](_0x1d0162[_0x3e46('0x38')][_0x3e46('0x35')]));_0x227a45[_0x3e46('0x36')]=_0x227a45[_0x3e46('0x36')][_0x3e46('0x37')]?_0x227a45['attributes']:_0x2a3e06['model'];_0x227a45[_0x3e46('0x3b')]=qs[_0x3e46('0x3c')](_0x1d0162[_0x3e46('0x38')][_0x3e46('0x3c')]);_0x227a45[_0x3e46('0x3d')]=qs[_0x3e46('0x32')](_[_0x3e46('0x3e')](_0x1d0162[_0x3e46('0x38')],_0x2a3e06['filters']));if(_0x1d0162[_0x3e46('0x38')]['filter']){_0x227a45['where']=_['merge'](_0x227a45[_0x3e46('0x3d')],{'$or':_[_0x3e46('0x2b')](_0x227a45['attributes'],function(_0x8c0702){var _0x5a52b6={};_0x5a52b6[_0x8c0702]={'$like':'%'+_0x1d0162[_0x3e46('0x38')]['filter']+'%'};return _0x5a52b6;})});}_0x227a45=_['merge']({},_0x227a45,_0x1d0162[_0x3e46('0x42')]);return _0x4a7c63[_0x3e46('0x4d')](_0x227a45);}})['then'](function(_0x426d1d){if(_0x426d1d){_0x291fb2=_0x426d1d[_0x3e46('0x37')];if(!_0x1d0162[_0x3e46('0x38')]['hasOwnProperty'](_0x3e46('0x3a'))){_0x227a45['limit']=qs['limit'](_0x1d0162[_0x3e46('0x38')][_0x3e46('0x1c')]);_0x227a45[_0x3e46('0x1b')]=qs[_0x3e46('0x1b')](_0x1d0162[_0x3e46('0x38')]['offset']);}return _0x4a7c63[_0x3e46('0x4d')](_0x227a45);}})['then'](function(_0xaeb535){if(_0xaeb535){return _0xaeb535?{'count':_0x291fb2,'rows':_0xaeb535}:null;}})[_0x3e46('0x26')](respondWithResult(_0x1087b5,null))[_0x3e46('0x46')](handleError(_0x1087b5,null));};exports[_0x3e46('0x50')]=function(_0x152156,_0x4d96a6,_0x3027ee){if(_0x152156[_0x3e46('0x4a')]['id']){delete _0x152156[_0x3e46('0x4a')]['id'];}return db[_0x3e46('0x2c')][_0x3e46('0x4e')]({'where':{'id':_0x152156[_0x3e46('0x4c')]['id']}})[_0x3e46('0x26')](handleEntityNotFound(_0x4d96a6,null))[_0x3e46('0x26')](function(_0x1e4bfc){if(_0x1e4bfc){_0x152156['body'][_0x3e46('0x51')]=_0x1e4bfc['id'];_0x152156['body'][_0x3e46('0x52')]=integrations[_0x3e46('0x53')](_0x152156[_0x3e46('0x4a')][_0x3e46('0x54')],_0x152156[_0x3e46('0x4a')][_0x3e46('0x2f')]);_0x152156[_0x3e46('0x4a')]['Descriptions']=integrations['getDescriptions'](_0x152156[_0x3e46('0x4a')][_0x3e46('0x54')],_0x152156[_0x3e46('0x4a')][_0x3e46('0x2f')]);return db[_0x3e46('0x4f')]['create'](_0x152156['body'],{'include':[{'model':db[_0x3e46('0x55')],'as':_0x3e46('0x52')},{'model':db[_0x3e46('0x55')],'as':_0x3e46('0x56')}]});}return null;})[_0x3e46('0x26')](respondWithResult(_0x4d96a6,null))[_0x3e46('0x46')](handleError(_0x4d96a6,null));};function getAccessToken(_0x30e15a){return new Promise(function(_0x4e2c64,_0x5c40cf){var _0x8e03c6;switch(_0x30e15a[_0x3e46('0x57')]){case'US':_0x8e03c6=_0x3e46('0x58');break;case'AU':_0x8e03c6=_0x3e46('0x59');break;case'EU':_0x8e03c6=_0x3e46('0x5a');break;case'IN':_0x8e03c6=_0x3e46('0x5b');break;case'CN':_0x8e03c6=_0x3e46('0x5c');break;default:_0x8e03c6='https://accounts.zoho.eu';break;}var _0x28b0be={'method':_0x3e46('0x5d'),'uri':_0x8e03c6+_0x3e46('0x5e'),'qs':{'refresh_token':_0x30e15a[_0x3e46('0x5f')],'client_id':_0x30e15a[_0x3e46('0x60')],'client_secret':_0x30e15a[_0x3e46('0x61')],'grant_type':_0x3e46('0x62')},'json':!![]};return rp(_0x28b0be)['then'](function(_0x1ef22b){if(_0x1ef22b[_0x3e46('0x63')]){_0x4e2c64(_0x1ef22b['access_token']);}else{_0x5c40cf('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x142f77){_0x5c40cf(_0x142f77);});});}exports[_0x3e46('0x64')]=function(_0x2d2b7d,_0x1e33ad,_0x2ef610){var _0x414a53,_0x28caa6,_0x15fa56,_0x4ec6b3,_0x321f79;return db[_0x3e46('0x2c')][_0x3e46('0x4e')]({'where':{'id':_0x2d2b7d[_0x3e46('0x4c')]['id']},'attributes':['id',_0x3e46('0x65'),_0x3e46('0x57'),_0x3e46('0x60'),_0x3e46('0x61'),_0x3e46('0x66'),'code','refreshToken']})[_0x3e46('0x26')](handleEntityNotFound(_0x1e33ad,null))[_0x3e46('0x26')](function(_0x360550){_0x321f79=_0x360550;_0x414a53=_0x321f79[_0x3e46('0x65')];_0x28caa6=_0x414a53==='zoho.eu'?'eu':_0x3e46('0x67');_0x15fa56=_0x321f79[_0x3e46('0x66')];var _0x17b93e=_0x15fa56['slice'](-0x1);if(_0x17b93e==='/'||_0x17b93e==='\x5c'||_0x17b93e===':'){_0x15fa56=_0x15fa56['substring'](0x0,_0x15fa56['lastIndexOf'](_0x17b93e));}if(!_0x321f79['refreshToken']){throw new Error(_0x3e46('0x68'));}return getAccessToken(_0x321f79);})['then'](function(_0x1036fd){if(_0x1036fd){return rp({'method':'GET','uri':util[_0x3e46('0x69')](_0x3e46('0x6a'),_0x28caa6),'qs':{'module':_0x3e46('0x6b')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1036fd},'json':!![]});}})[_0x3e46('0x26')](function(_0x42f75d){if(_0x42f75d){if(_0x42f75d[_0x3e46('0x6c')]&&_0x42f75d[_0x3e46('0x6c')][_0x3e46('0x27')]){throw new Error(_0x42f75d[_0x3e46('0x6c')]['error'][_0x3e46('0x6d')]);}var _0x178b53=[];var _0x58df57=[];var _0x253b47=[_0x3e46('0x6e'),_0x3e46('0x6f'),_0x3e46('0x70'),_0x3e46('0x71'),'Call_Duration','Call_Result','Call_Start_Time',_0x3e46('0x72')];_0x58df57=_[_0x3e46('0x73')](_0x42f75d[_0x3e46('0x35')],function(_0x51f9a6){return _0x253b47['includes'](_0x51f9a6[_0x3e46('0x74')]);});for(var _0x5efe1e=0x0;_0x5efe1e<_0x58df57['length'];_0x5efe1e++){if(_0x58df57[_0x5efe1e][_0x3e46('0x75')]===![]){_0x178b53[_0x3e46('0x76')]({'id':_0x58df57[_0x5efe1e]['id'],'name':_0x58df57[_0x5efe1e][_0x3e46('0x77')],'custom':_0x58df57[_0x5efe1e][_0x3e46('0x78')],'options':_0x58df57[_0x5efe1e][_0x3e46('0x79')]===_0x3e46('0x7a')&&_0x58df57[_0x5efe1e][_0x3e46('0x7b')][_0x3e46('0x37')]>-0x1?_['map'](_0x58df57[_0x5efe1e]['pick_list_values'],function(_0x11dd60){return{'name':_0x11dd60,'value':_0x11dd60};}):[]});}}return{'count':_0x178b53[_0x3e46('0x37')],'rows':_0x178b53};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x1e33ad,null))['catch'](function(_0x15649e){var _0x1d3bf3=_0x2d2b7d[_0x3e46('0x38')][_0x3e46('0x7c')]?0x1f4:_0x15649e['statusCode']||0x1f4;logger[_0x3e46('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0x3e46('0x64'),_0x1d3bf3,JSON[_0x3e46('0x7d')](_0x15649e));delete _0x15649e['name'];if(_0x1d3bf3===0x191){_0x1d3bf3=0x190;}_0x1e33ad[_0x3e46('0x18')](_0x1d3bf3)[_0x3e46('0x29')](_0x2d2b7d[_0x3e46('0x38')]['test']?{'message':_0x3e46('0x7e'),'statusCode':_0x15649e[_0x3e46('0x7f')]}:_0x15649e);});}; \ No newline at end of file +var _0x4782=['https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Description','WhoId','Call_Duration','Call_Type','remove','push','display_label','custom_field','data_type','pick_list_values','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','filter','merge','VIRTUAL','include','findAll','catch','show','params','includeAll','options','find','create','body','update','getConfigurations','findOne','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','serverUrl','host','zoho.eu','com','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format'];(function(_0xd0ec46,_0x33e078){var _0x3e5126=function(_0x3672fd){while(--_0x3672fd){_0xd0ec46['push'](_0xd0ec46['shift']());}};_0x3e5126(++_0x33e078);}(_0x4782,0x10d));var _0x2478=function(_0x140920,_0x5464db){_0x140920=_0x140920-0x0;var _0x436ed0=_0x4782[_0x140920];return _0x436ed0;};'use strict';var emlformat=require(_0x2478('0x0'));var rimraf=require(_0x2478('0x1'));var zipdir=require(_0x2478('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2478('0x3'));var moment=require(_0x2478('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x2478('0x5'));var sox=require(_0x2478('0x6'));var csv=require(_0x2478('0x7'));var ejs=require(_0x2478('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2478('0x9'));var squel=require(_0x2478('0xa'));var crypto=require(_0x2478('0xb'));var jsforce=require(_0x2478('0xc'));var deskjs=require(_0x2478('0xd'));var toCsv=require(_0x2478('0x7'));var querystring=require(_0x2478('0xe'));var Papa=require(_0x2478('0xf'));var Redis=require(_0x2478('0x10'));var authService=require(_0x2478('0x11'));var qs=require(_0x2478('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2478('0x13'));var logger=require(_0x2478('0x14'))('api');var utils=require(_0x2478('0x15'));var config=require(_0x2478('0x16'));var licenseUtil=require(_0x2478('0x17'));var db=require(_0x2478('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x762541,_0x498ddf){_0x498ddf=_0x498ddf||0xcc;return function(_0x54da7d){if(_0x54da7d){return _0x762541['sendStatus'](_0x498ddf);}return _0x762541[_0x2478('0x19')](_0x498ddf)[_0x2478('0x1a')]();};}function respondWithResult(_0x4aec89,_0x59da65){_0x59da65=_0x59da65||0xc8;return function(_0x1a881a){if(_0x1a881a){return _0x4aec89[_0x2478('0x19')](_0x59da65)[_0x2478('0x1b')](_0x1a881a);}};}function respondWithFilteredResult(_0x3fbc5c,_0x5a2be1){return function(_0x5669b7){if(_0x5669b7){var _0x5aa27e=typeof _0x5a2be1['offset']===_0x2478('0x1c')&&typeof _0x5a2be1[_0x2478('0x1d')]===_0x2478('0x1c');var _0x483c69=_0x5669b7[_0x2478('0x1e')];var _0x3ff2f3=_0x5aa27e?0x0:_0x5a2be1['offset'];var _0x5bae2f=_0x5aa27e?_0x5669b7['count']:_0x5a2be1[_0x2478('0x1f')]+_0x5a2be1[_0x2478('0x1d')];var _0x492327;if(_0x5bae2f>=_0x483c69){_0x5bae2f=_0x483c69;_0x492327=0xc8;}else{_0x492327=0xce;}_0x3fbc5c[_0x2478('0x19')](_0x492327);return _0x3fbc5c[_0x2478('0x20')](_0x2478('0x21'),_0x3ff2f3+'-'+_0x5bae2f+'/'+_0x483c69)[_0x2478('0x1b')](_0x5669b7);}return null;};}function patchUpdates(_0xf79740){return function(_0x234c77){try{jsonpatch['apply'](_0x234c77,_0xf79740,!![]);}catch(_0x363259){return BPromise[_0x2478('0x22')](_0x363259);}return _0x234c77[_0x2478('0x23')]();};}function saveUpdates(_0x452998,_0x12e63d){return function(_0xee5579){if(_0xee5579){return _0xee5579['update'](_0x452998)[_0x2478('0x24')](function(_0x56b24){return _0x56b24;});}return null;};}function removeEntity(_0xe9f94a,_0x3da1a4){return function(_0x125d40){if(_0x125d40){return _0x125d40[_0x2478('0x25')]()[_0x2478('0x24')](function(){_0xe9f94a[_0x2478('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d8db0,_0x21a5f9){return function(_0x4fb40a){if(!_0x4fb40a){_0x4d8db0[_0x2478('0x26')](0x194);}return _0x4fb40a;};}function handleError(_0x52a506,_0x5f3180){_0x5f3180=_0x5f3180||0x1f4;return function(_0x239a0b){logger[_0x2478('0x27')](_0x239a0b[_0x2478('0x28')]);if(_0x239a0b[_0x2478('0x29')]){delete _0x239a0b[_0x2478('0x29')];}_0x52a506[_0x2478('0x19')](_0x5f3180)[_0x2478('0x2a')](_0x239a0b);};}exports[_0x2478('0x2b')]=function(_0x108055,_0x5cb4c6){var _0xfcf1e0={},_0x489e9a={},_0x39b8dd={'count':0x0,'rows':[]};var _0x4dc8eb=_[_0x2478('0x2c')](db[_0x2478('0x2d')][_0x2478('0x2e')],function(_0x323e82){return{'name':_0x323e82[_0x2478('0x2f')],'type':_0x323e82[_0x2478('0x30')]['key']};});_0x489e9a[_0x2478('0x31')]=_[_0x2478('0x2c')](_0x4dc8eb,_0x2478('0x29'));_0x489e9a[_0x2478('0x32')]=_[_0x2478('0x33')](_0x108055[_0x2478('0x32')]);_0x489e9a['filters']=_[_0x2478('0x34')](_0x489e9a['model'],_0x489e9a[_0x2478('0x32')]);_0xfcf1e0[_0x2478('0x35')]=_[_0x2478('0x34')](_0x489e9a['model'],qs[_0x2478('0x36')](_0x108055[_0x2478('0x32')][_0x2478('0x36')]));_0xfcf1e0[_0x2478('0x35')]=_0xfcf1e0[_0x2478('0x35')][_0x2478('0x37')]?_0xfcf1e0[_0x2478('0x35')]:_0x489e9a[_0x2478('0x31')];if(!_0x108055['query']['hasOwnProperty'](_0x2478('0x38'))){_0xfcf1e0['limit']=qs['limit'](_0x108055[_0x2478('0x32')][_0x2478('0x1d')]);_0xfcf1e0['offset']=qs[_0x2478('0x1f')](_0x108055[_0x2478('0x32')]['offset']);}_0xfcf1e0['order']=qs[_0x2478('0x39')](_0x108055[_0x2478('0x32')]['sort']);_0xfcf1e0[_0x2478('0x3a')]=qs[_0x2478('0x3b')](_['pick'](_0x108055['query'],_0x489e9a[_0x2478('0x3b')]),_0x4dc8eb);if(_0x108055[_0x2478('0x32')][_0x2478('0x3c')]){_0xfcf1e0['where']=_[_0x2478('0x3d')](_0xfcf1e0[_0x2478('0x3a')],{'$or':_[_0x2478('0x2c')](_0x4dc8eb,function(_0x4f48ec){if(_0x4f48ec[_0x2478('0x30')]!==_0x2478('0x3e')){var _0x81e6eb={};_0x81e6eb[_0x4f48ec[_0x2478('0x29')]]={'$like':'%'+_0x108055[_0x2478('0x32')][_0x2478('0x3c')]+'%'};return _0x81e6eb;}})});}_0xfcf1e0=_['merge']({},_0xfcf1e0,_0x108055['options']);var _0x34e02e={'where':_0xfcf1e0[_0x2478('0x3a')]};return db[_0x2478('0x2d')][_0x2478('0x1e')](_0x34e02e)[_0x2478('0x24')](function(_0x510687){_0x39b8dd['count']=_0x510687;if(_0x108055[_0x2478('0x32')]['includeAll']){_0xfcf1e0[_0x2478('0x3f')]=[{'all':!![]}];}return db[_0x2478('0x2d')][_0x2478('0x40')](_0xfcf1e0);})['then'](function(_0x410956){_0x39b8dd['rows']=_0x410956;return _0x39b8dd;})['then'](respondWithFilteredResult(_0x5cb4c6,_0xfcf1e0))[_0x2478('0x41')](handleError(_0x5cb4c6,null));};exports[_0x2478('0x42')]=function(_0x157c43,_0x366370){var _0x3a63ce={'raw':![],'where':{'id':_0x157c43[_0x2478('0x43')]['id']}},_0x35a266={};_0x35a266[_0x2478('0x31')]=_[_0x2478('0x33')](db[_0x2478('0x2d')][_0x2478('0x2e')]);_0x35a266['query']=_[_0x2478('0x33')](_0x157c43[_0x2478('0x32')]);_0x35a266[_0x2478('0x3b')]=_[_0x2478('0x34')](_0x35a266[_0x2478('0x31')],_0x35a266['query']);_0x3a63ce[_0x2478('0x35')]=_[_0x2478('0x34')](_0x35a266[_0x2478('0x31')],qs[_0x2478('0x36')](_0x157c43[_0x2478('0x32')][_0x2478('0x36')]));_0x3a63ce[_0x2478('0x35')]=_0x3a63ce['attributes'][_0x2478('0x37')]?_0x3a63ce[_0x2478('0x35')]:_0x35a266[_0x2478('0x31')];if(_0x157c43['query'][_0x2478('0x44')]){_0x3a63ce[_0x2478('0x3f')]=[{'all':!![]}];}_0x3a63ce=_[_0x2478('0x3d')]({},_0x3a63ce,_0x157c43[_0x2478('0x45')]);return db[_0x2478('0x2d')][_0x2478('0x46')](_0x3a63ce)[_0x2478('0x24')](handleEntityNotFound(_0x366370,null))[_0x2478('0x24')](respondWithResult(_0x366370,null))[_0x2478('0x41')](handleError(_0x366370,null));};exports['create']=function(_0x1cf228,_0x5f334b){return db['ZohoAccount'][_0x2478('0x47')](_0x1cf228[_0x2478('0x48')],{})[_0x2478('0x24')](respondWithResult(_0x5f334b,0xc9))[_0x2478('0x41')](handleError(_0x5f334b,null));};exports[_0x2478('0x49')]=function(_0xc82cd6,_0x1f1231){if(_0xc82cd6[_0x2478('0x48')]['id']){delete _0xc82cd6[_0x2478('0x48')]['id'];}return db['ZohoAccount'][_0x2478('0x46')]({'where':{'id':_0xc82cd6[_0x2478('0x43')]['id']}})['then'](handleEntityNotFound(_0x1f1231,null))['then'](saveUpdates(_0xc82cd6[_0x2478('0x48')],null))[_0x2478('0x24')](respondWithResult(_0x1f1231,null))[_0x2478('0x41')](handleError(_0x1f1231,null));};exports[_0x2478('0x25')]=function(_0x2149cb,_0x2c46bb){return db[_0x2478('0x2d')][_0x2478('0x46')]({'where':{'id':_0x2149cb[_0x2478('0x43')]['id']}})[_0x2478('0x24')](handleEntityNotFound(_0x2c46bb,null))[_0x2478('0x24')](removeEntity(_0x2c46bb,null))['catch'](handleError(_0x2c46bb,null));};exports[_0x2478('0x4a')]=function(_0x1b054c,_0x1afd9c,_0x3d81d7){var _0x2f57eb={};var _0x5c06c8={};var _0x14e7c6;var _0x19ea0c;return db[_0x2478('0x2d')][_0x2478('0x4b')]({'where':{'id':_0x1b054c[_0x2478('0x43')]['id']}})['then'](handleEntityNotFound(_0x1afd9c,null))['then'](function(_0x5d44e0){if(_0x5d44e0){_0x14e7c6=_0x5d44e0;_0x5c06c8[_0x2478('0x31')]=_[_0x2478('0x33')](db['ZohoConfiguration'][_0x2478('0x2e')]);_0x5c06c8[_0x2478('0x32')]=_[_0x2478('0x33')](_0x1b054c['query']);_0x5c06c8['filters']=_[_0x2478('0x34')](_0x5c06c8[_0x2478('0x31')],_0x5c06c8[_0x2478('0x32')]);_0x2f57eb[_0x2478('0x35')]=_['intersection'](_0x5c06c8[_0x2478('0x31')],qs['fields'](_0x1b054c[_0x2478('0x32')]['fields']));_0x2f57eb[_0x2478('0x35')]=_0x2f57eb[_0x2478('0x35')][_0x2478('0x37')]?_0x2f57eb['attributes']:_0x5c06c8[_0x2478('0x31')];_0x2f57eb['order']=qs['sort'](_0x1b054c[_0x2478('0x32')]['sort']);_0x2f57eb[_0x2478('0x3a')]=qs[_0x2478('0x3b')](_[_0x2478('0x4c')](_0x1b054c[_0x2478('0x32')],_0x5c06c8[_0x2478('0x3b')]));if(_0x1b054c['query']['filter']){_0x2f57eb[_0x2478('0x3a')]=_['merge'](_0x2f57eb[_0x2478('0x3a')],{'$or':_['map'](_0x2f57eb['attributes'],function(_0x4ab341){var _0x5bf7c4={};_0x5bf7c4[_0x4ab341]={'$like':'%'+_0x1b054c['query']['filter']+'%'};return _0x5bf7c4;})});}_0x2f57eb=_['merge']({},_0x2f57eb,_0x1b054c[_0x2478('0x45')]);return _0x14e7c6[_0x2478('0x4a')](_0x2f57eb);}})['then'](function(_0x4b5132){if(_0x4b5132){_0x19ea0c=_0x4b5132['length'];if(!_0x1b054c[_0x2478('0x32')]['hasOwnProperty']('nolimit')){_0x2f57eb['limit']=qs['limit'](_0x1b054c[_0x2478('0x32')]['limit']);_0x2f57eb[_0x2478('0x1f')]=qs[_0x2478('0x1f')](_0x1b054c[_0x2478('0x32')][_0x2478('0x1f')]);}return _0x14e7c6[_0x2478('0x4a')](_0x2f57eb);}})[_0x2478('0x24')](function(_0x38c65e){if(_0x38c65e){return _0x38c65e?{'count':_0x19ea0c,'rows':_0x38c65e}:null;}})[_0x2478('0x24')](respondWithResult(_0x1afd9c,null))[_0x2478('0x41')](handleError(_0x1afd9c,null));};exports[_0x2478('0x4d')]=function(_0xabd615,_0x35c293,_0x2e6323){if(_0xabd615[_0x2478('0x48')]['id']){delete _0xabd615[_0x2478('0x48')]['id'];}return db[_0x2478('0x2d')][_0x2478('0x4b')]({'where':{'id':_0xabd615[_0x2478('0x43')]['id']}})['then'](handleEntityNotFound(_0x35c293,null))[_0x2478('0x24')](function(_0x36099d){if(_0x36099d){_0xabd615['body'][_0x2478('0x4e')]=_0x36099d['id'];_0xabd615[_0x2478('0x48')][_0x2478('0x4f')]=integrations[_0x2478('0x50')](_0xabd615[_0x2478('0x48')][_0x2478('0x51')],_0xabd615[_0x2478('0x48')]['type']);_0xabd615['body'][_0x2478('0x52')]=integrations['getDescriptions'](_0xabd615[_0x2478('0x48')][_0x2478('0x51')],_0xabd615['body']['type']);return db[_0x2478('0x53')][_0x2478('0x47')](_0xabd615[_0x2478('0x48')],{'include':[{'model':db[_0x2478('0x54')],'as':_0x2478('0x4f')},{'model':db[_0x2478('0x54')],'as':'Descriptions'}]});}return null;})[_0x2478('0x24')](respondWithResult(_0x35c293,null))['catch'](handleError(_0x35c293,null));};function getAccessToken(_0x298500){return new Promise(function(_0x36799e,_0x148b8e){var _0x38a9f7;switch(_0x298500[_0x2478('0x55')]){case'US':_0x38a9f7=_0x2478('0x56');break;case'AU':_0x38a9f7=_0x2478('0x57');break;case'EU':_0x38a9f7=_0x2478('0x58');break;case'IN':_0x38a9f7='https://accounts.zoho.in';break;case'CN':_0x38a9f7=_0x2478('0x59');break;default:_0x38a9f7=_0x2478('0x58');break;}var _0xf168ab={'method':_0x2478('0x5a'),'uri':_0x38a9f7+_0x2478('0x5b'),'qs':{'refresh_token':_0x298500[_0x2478('0x5c')],'client_id':_0x298500[_0x2478('0x5d')],'client_secret':_0x298500[_0x2478('0x5e')],'grant_type':_0x2478('0x5f')},'json':!![]};return rp(_0xf168ab)[_0x2478('0x24')](function(_0x2b12ab){if(_0x2b12ab[_0x2478('0x60')]){_0x36799e(_0x2b12ab[_0x2478('0x60')]);}else{_0x148b8e('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x2478('0x41')](function(_0x23302a){_0x148b8e(_0x23302a);});});}exports['getFields']=function(_0x1fda86,_0x5c0032,_0x4d0922){var _0x32147d,_0x229344,_0x5e402e,_0x465f46,_0x1b6bae;return db[_0x2478('0x2d')][_0x2478('0x4b')]({'where':{'id':_0x1fda86['params']['id']},'attributes':['id','host',_0x2478('0x55'),_0x2478('0x5d'),_0x2478('0x5e'),_0x2478('0x61'),'code','refreshToken']})[_0x2478('0x24')](handleEntityNotFound(_0x5c0032,null))['then'](function(_0x3d0e4e){_0x1b6bae=_0x3d0e4e;_0x32147d=_0x1b6bae[_0x2478('0x62')];_0x229344=_0x32147d===_0x2478('0x63')?'eu':_0x2478('0x64');_0x5e402e=_0x1b6bae[_0x2478('0x61')];var _0x298f39=_0x5e402e[_0x2478('0x65')](-0x1);if(_0x298f39==='/'||_0x298f39==='\x5c'||_0x298f39===':'){_0x5e402e=_0x5e402e[_0x2478('0x66')](0x0,_0x5e402e['lastIndexOf'](_0x298f39));}if(!_0x1b6bae[_0x2478('0x5c')]){throw new Error(_0x2478('0x67'));}return getAccessToken(_0x1b6bae);})[_0x2478('0x24')](function(_0x35520b){if(_0x35520b){return rp({'method':_0x2478('0x68'),'uri':util[_0x2478('0x69')](_0x2478('0x6a'),_0x229344),'qs':{'module':_0x2478('0x6b')},'headers':{'Authorization':_0x2478('0x6c')+_0x35520b},'json':!![]});}})['then'](function(_0x248782){if(_0x248782){if(_0x248782[_0x2478('0x6d')]&&_0x248782[_0x2478('0x6d')][_0x2478('0x27')]){throw new Error(_0x248782['response']['error'][_0x2478('0x6e')]);}var _0x4403b9=[];var _0x12444a=[];var _0x25bd04=['Owner','Subject',_0x2478('0x6f'),_0x2478('0x70'),_0x2478('0x71'),'Call_Result','Call_Start_Time',_0x2478('0x72')];_0x12444a=_[_0x2478('0x73')](_0x248782[_0x2478('0x36')],function(_0x4d75f8){return _0x25bd04['includes'](_0x4d75f8['api_name']);});for(var _0x3c5fd6=0x0;_0x3c5fd6<_0x12444a[_0x2478('0x37')];_0x3c5fd6++){if(_0x12444a[_0x3c5fd6]['system_mandatory']===![]){_0x4403b9[_0x2478('0x74')]({'id':_0x12444a[_0x3c5fd6]['id'],'name':_0x12444a[_0x3c5fd6][_0x2478('0x75')],'custom':_0x12444a[_0x3c5fd6][_0x2478('0x76')],'options':_0x12444a[_0x3c5fd6][_0x2478('0x77')]==='picklist'&&_0x12444a[_0x3c5fd6][_0x2478('0x78')][_0x2478('0x37')]>-0x1?_['map'](_0x12444a[_0x3c5fd6][_0x2478('0x78')],function(_0x25d47a){return{'name':_0x25d47a,'value':_0x25d47a};}):[]});}}return{'count':_0x4403b9[_0x2478('0x37')],'rows':_0x4403b9};}else{return{'count':0x0,'rows':[]};}})[_0x2478('0x24')](respondWithResult(_0x5c0032,null))[_0x2478('0x41')](function(_0xafc38f){var _0x31429b=_0x1fda86[_0x2478('0x32')][_0x2478('0x79')]?0x1f4:_0xafc38f[_0x2478('0x7a')]||0x1f4;logger[_0x2478('0x27')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x31429b,JSON[_0x2478('0x7b')](_0xafc38f));delete _0xafc38f[_0x2478('0x29')];if(_0x31429b===0x191){_0x31429b=0x190;}_0x5c0032[_0x2478('0x19')](_0x31429b)[_0x2478('0x2a')](_0x1fda86[_0x2478('0x32')][_0x2478('0x79')]?{'message':_0x2478('0x7c'),'statusCode':_0xafc38f[_0x2478('0x7a')]}:_0xafc38f);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index a5beaf6..b961164 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 _0xbd32=['host','serverUrl','slice','substring','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','application/x-www-form-urlencoded','then','parse','refreshToken','refresh_token','info','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','lastIndexOf','authorization_code','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','define','int_zoho_accounts','changed','zone','clientId','clientSecret','code'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xbd32,0x6a));var _0x2bd3=function(_0x13c307,_0x380d64){_0x13c307=_0x13c307-0x0;var _0x495b57=_0xbd32[_0x13c307];return _0x495b57;};'use strict';var _=require(_0x2bd3('0x0'));var util=require('util');var logger=require(_0x2bd3('0x1'))(_0x2bd3('0x2'));var moment=require(_0x2bd3('0x3'));var BPromise=require(_0x2bd3('0x4'));var rp=require(_0x2bd3('0x5'));var fs=require('fs');var path=require(_0x2bd3('0x6'));var rimraf=require(_0x2bd3('0x7'));var config=require('../../config/environment');var attributes=require(_0x2bd3('0x8'));var integrations=require(_0x2bd3('0x9'));module['exports']=function(_0x1ebf6a,_0x3f8b11){return _0x1ebf6a[_0x2bd3('0xa')]('ZohoAccount',attributes,{'tableName':_0x2bd3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4cd2cd,_0x228282,_0x2f3da8){if(_0x4cd2cd[_0x2bd3('0xc')](_0x2bd3('0xd'))||_0x4cd2cd[_0x2bd3('0xc')]('serverUrl')||_0x4cd2cd[_0x2bd3('0xc')](_0x2bd3('0xe'))||_0x4cd2cd['changed'](_0x2bd3('0xf'))||_0x4cd2cd['changed'](_0x2bd3('0x10'))||_0x4cd2cd['changed'](_0x2bd3('0x11'))){var _0x219aa0,_0x354fc3;_0x219aa0=_0x4cd2cd[_0x2bd3('0x12')];var _0x1f3286=_0x219aa0[_0x2bd3('0x13')](-0x1);if(_0x1f3286==='/'||_0x1f3286==='\x5c'||_0x1f3286===':'){_0x219aa0=_0x219aa0[_0x2bd3('0x14')](0x0,_0x219aa0['lastIndexOf'](_0x1f3286));}switch(_0x4cd2cd[_0x2bd3('0xd')]){case'US':_0x354fc3=_0x2bd3('0x15');break;case'AU':_0x354fc3='https://accounts.zoho.com.au';break;case'IN':_0x354fc3=_0x2bd3('0x16');break;case'CN':_0x354fc3=_0x2bd3('0x17');break;default:_0x354fc3=_0x2bd3('0x18');break;}var _0x207f0f={'method':_0x2bd3('0x19'),'uri':_0x354fc3+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x4cd2cd[_0x2bd3('0xe')],'client_secret':_0x4cd2cd[_0x2bd3('0xf')],'redirect_uri':_0x4cd2cd[_0x2bd3('0x12')],'code':_0x4cd2cd[_0x2bd3('0x10')]},'headers':{'Content-Type':_0x2bd3('0x1a')}};return rp(_0x207f0f)[_0x2bd3('0x1b')](function(_0xbfb119){var _0x53a941=JSON[_0x2bd3('0x1c')](_0xbfb119);if(_0x53a941['refresh_token']){_0x4cd2cd[_0x2bd3('0x1d')]=_0x53a941[_0x2bd3('0x1e')];logger[_0x2bd3('0x1f')](util[_0x2bd3('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4cd2cd[_0x2bd3('0x21')],_0x4cd2cd['id']));}else{logger[_0x2bd3('0x22')](util[_0x2bd3('0x20')](_0x2bd3('0x23'),_0x4cd2cd[_0x2bd3('0x21')],_0x4cd2cd['id']),util[_0x2bd3('0x24')](_0x53a941,{'showHidden':![],'depth':null}));}return _0x2f3da8(null,_0x228282);})[_0x2bd3('0x25')](function(_0x239a82){logger['error'](util['format'](_0x2bd3('0x23'),_0x4cd2cd[_0x2bd3('0x21')],_0x4cd2cd['id']),util[_0x2bd3('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x2f3da8(_0x239a82);});}else{return _0x2f3da8(null,_0x228282);}},'beforeUpdate':function(_0x5c0314,_0x574c31,_0x4879d2){if(_0x5c0314[_0x2bd3('0xc')](_0x2bd3('0xd'))||_0x5c0314[_0x2bd3('0xc')](_0x2bd3('0x12'))||_0x5c0314[_0x2bd3('0xc')]('clientId')||_0x5c0314['changed']('clientSecret')||_0x5c0314['changed']('code')||_0x5c0314['changed'](_0x2bd3('0x11'))){var _0x3e958e,_0x2ff143;_0x3e958e=_0x5c0314[_0x2bd3('0x12')];var _0x23792d=_0x3e958e['slice'](-0x1);if(_0x23792d==='/'||_0x23792d==='\x5c'||_0x23792d===':'){_0x3e958e=_0x3e958e[_0x2bd3('0x14')](0x0,_0x3e958e[_0x2bd3('0x26')](_0x23792d));}switch(_0x5c0314['zone']){case'US':_0x2ff143=_0x2bd3('0x15');break;case'AU':_0x2ff143='https://accounts.zoho.com.au';break;case'IN':_0x2ff143=_0x2bd3('0x16');break;case'CN':_0x2ff143=_0x2bd3('0x17');break;default:_0x2ff143=_0x2bd3('0x18');break;}var _0x5afc9d={'method':'POST','uri':_0x2ff143+'/oauth/v2/token','form':{'grant_type':_0x2bd3('0x27'),'client_id':_0x5c0314[_0x2bd3('0xe')],'client_secret':_0x5c0314[_0x2bd3('0xf')],'redirect_uri':_0x5c0314['serverUrl'],'code':_0x5c0314[_0x2bd3('0x10')]},'headers':{'Content-Type':_0x2bd3('0x1a')}};return rp(_0x5afc9d)['then'](function(_0x469cd6){var _0x2c9d44=JSON['parse'](_0x469cd6);if(_0x2c9d44[_0x2bd3('0x1e')]){_0x5c0314[_0x2bd3('0x1d')]=_0x2c9d44[_0x2bd3('0x1e')];logger[_0x2bd3('0x1f')](util['format'](_0x2bd3('0x28'),_0x5c0314[_0x2bd3('0x21')],_0x5c0314['id']));}else{logger['error'](util['format'](_0x2bd3('0x23'),_0x5c0314[_0x2bd3('0x21')],_0x5c0314['id']),util[_0x2bd3('0x24')](_0x2c9d44,{'showHidden':![],'depth':null}));}return _0x4879d2(null,_0x574c31);})['catch'](function(_0x1243c7){logger[_0x2bd3('0x22')](util[_0x2bd3('0x20')](_0x2bd3('0x23'),_0x5c0314[_0x2bd3('0x21')],_0x5c0314['id']),util[_0x2bd3('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x4879d2(_0x1243c7);});}else{return _0x4879d2(null,_0x574c31);}}}});}; \ No newline at end of file +var _0x6b1b=['serverUrl','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','authorization_code','clientId','application/x-www-form-urlencoded','parse','refresh_token','refreshToken','info','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','host','https://accounts.zoho.eu','POST','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','catch','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','int_zoho_accounts','zone','changed','clientSecret','code'];(function(_0x3b711c,_0x4b22dc){var _0x2685f0=function(_0x3b5ba6){while(--_0x3b5ba6){_0x3b711c['push'](_0x3b711c['shift']());}};_0x2685f0(++_0x4b22dc);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x6b1b[_0x34bf97];return _0x292719;};'use strict';var _=require('lodash');var util=require(_0xb6b1('0x0'));var logger=require(_0xb6b1('0x1'))(_0xb6b1('0x2'));var moment=require('moment');var BPromise=require(_0xb6b1('0x3'));var rp=require(_0xb6b1('0x4'));var fs=require('fs');var path=require(_0xb6b1('0x5'));var rimraf=require(_0xb6b1('0x6'));var config=require(_0xb6b1('0x7'));var attributes=require(_0xb6b1('0x8'));var integrations=require(_0xb6b1('0x9'));module[_0xb6b1('0xa')]=function(_0x1ff716,_0x13334e){return _0x1ff716[_0xb6b1('0xb')]('ZohoAccount',attributes,{'tableName':_0xb6b1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x52aa76,_0x4da7d3,_0x463b1d){if(_0x52aa76['changed'](_0xb6b1('0xd'))||_0x52aa76['changed']('serverUrl')||_0x52aa76['changed']('clientId')||_0x52aa76[_0xb6b1('0xe')](_0xb6b1('0xf'))||_0x52aa76['changed'](_0xb6b1('0x10'))||_0x52aa76['changed']('host')){var _0x406dce,_0x2e5256;_0x406dce=_0x52aa76[_0xb6b1('0x11')];var _0x327eee=_0x406dce[_0xb6b1('0x12')](-0x1);if(_0x327eee==='/'||_0x327eee==='\x5c'||_0x327eee===':'){_0x406dce=_0x406dce[_0xb6b1('0x13')](0x0,_0x406dce[_0xb6b1('0x14')](_0x327eee));}switch(_0x52aa76[_0xb6b1('0xd')]){case'US':_0x2e5256=_0xb6b1('0x15');break;case'AU':_0x2e5256=_0xb6b1('0x16');break;case'IN':_0x2e5256=_0xb6b1('0x17');break;case'CN':_0x2e5256=_0xb6b1('0x18');break;default:_0x2e5256='https://accounts.zoho.eu';break;}var _0x57572a={'method':'POST','uri':_0x2e5256+'/oauth/v2/token','form':{'grant_type':_0xb6b1('0x19'),'client_id':_0x52aa76[_0xb6b1('0x1a')],'client_secret':_0x52aa76[_0xb6b1('0xf')],'redirect_uri':_0x52aa76[_0xb6b1('0x11')],'code':_0x52aa76[_0xb6b1('0x10')]},'headers':{'Content-Type':_0xb6b1('0x1b')}};return rp(_0x57572a)['then'](function(_0x581e28){var _0x1bdf63=JSON[_0xb6b1('0x1c')](_0x581e28);if(_0x1bdf63[_0xb6b1('0x1d')]){_0x52aa76[_0xb6b1('0x1e')]=_0x1bdf63[_0xb6b1('0x1d')];logger[_0xb6b1('0x1f')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x52aa76[_0xb6b1('0x20')],_0x52aa76['id']));}else{logger[_0xb6b1('0x21')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x52aa76[_0xb6b1('0x20')],_0x52aa76['id']),util['inspect'](_0x1bdf63,{'showHidden':![],'depth':null}));}return _0x463b1d(null,_0x4da7d3);})['catch'](function(_0x232157){logger[_0xb6b1('0x21')](util[_0xb6b1('0x22')](_0xb6b1('0x23'),_0x52aa76[_0xb6b1('0x20')],_0x52aa76['id']),util[_0xb6b1('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x463b1d(_0x232157);});}else{return _0x463b1d(null,_0x4da7d3);}},'beforeUpdate':function(_0x1eb1b2,_0x3b1ff7,_0x472585){if(_0x1eb1b2[_0xb6b1('0xe')]('zone')||_0x1eb1b2[_0xb6b1('0xe')]('serverUrl')||_0x1eb1b2[_0xb6b1('0xe')]('clientId')||_0x1eb1b2[_0xb6b1('0xe')]('clientSecret')||_0x1eb1b2[_0xb6b1('0xe')](_0xb6b1('0x10'))||_0x1eb1b2[_0xb6b1('0xe')](_0xb6b1('0x25'))){var _0x13e841,_0x188627;_0x13e841=_0x1eb1b2[_0xb6b1('0x11')];var _0xd3c6da=_0x13e841[_0xb6b1('0x12')](-0x1);if(_0xd3c6da==='/'||_0xd3c6da==='\x5c'||_0xd3c6da===':'){_0x13e841=_0x13e841['substring'](0x0,_0x13e841[_0xb6b1('0x14')](_0xd3c6da));}switch(_0x1eb1b2['zone']){case'US':_0x188627=_0xb6b1('0x15');break;case'AU':_0x188627=_0xb6b1('0x16');break;case'IN':_0x188627=_0xb6b1('0x17');break;case'CN':_0x188627=_0xb6b1('0x18');break;default:_0x188627=_0xb6b1('0x26');break;}var _0x12f369={'method':_0xb6b1('0x27'),'uri':_0x188627+'/oauth/v2/token','form':{'grant_type':_0xb6b1('0x19'),'client_id':_0x1eb1b2[_0xb6b1('0x1a')],'client_secret':_0x1eb1b2[_0xb6b1('0xf')],'redirect_uri':_0x1eb1b2['serverUrl'],'code':_0x1eb1b2[_0xb6b1('0x10')]},'headers':{'Content-Type':_0xb6b1('0x1b')}};return rp(_0x12f369)['then'](function(_0x3efb1d){var _0x3e3642=JSON[_0xb6b1('0x1c')](_0x3efb1d);if(_0x3e3642[_0xb6b1('0x1d')]){_0x1eb1b2[_0xb6b1('0x1e')]=_0x3e3642[_0xb6b1('0x1d')];logger['info'](util[_0xb6b1('0x22')](_0xb6b1('0x28'),_0x1eb1b2['name'],_0x1eb1b2['id']));}else{logger[_0xb6b1('0x21')](util['format'](_0xb6b1('0x23'),_0x1eb1b2[_0xb6b1('0x20')],_0x1eb1b2['id']),util[_0xb6b1('0x24')](_0x3e3642,{'showHidden':![],'depth':null}));}return _0x472585(null,_0x3b1ff7);})[_0xb6b1('0x29')](function(_0x127481){logger[_0xb6b1('0x21')](util['format'](_0xb6b1('0x23'),_0x1eb1b2[_0xb6b1('0x20')],_0x1eb1b2['id']),util[_0xb6b1('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x472585(_0x127481);});}else{return _0x472585(null,_0x3b1ff7);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 7a7bd31..f839284 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 _0x4959=['request','then','ZohoAccount,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetZohoAccount','ZohoAccount','options','where','attributes','limit','include','map','model','info','ShowZohoAccount','find','raw','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x37e227,_0x31179f){var _0x16c5de=function(_0x1bb1ba){while(--_0x1bb1ba){_0x37e227['push'](_0x37e227['shift']());}};_0x16c5de(++_0x31179f);}(_0x4959,0x9b));var _0x9495=function(_0x518a68,_0xef1bfd){_0x518a68=_0x518a68-0x0;var _0x699842=_0x4959[_0x518a68];return _0x699842;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9495('0x0'));var BPromise=require(_0x9495('0x1'));var rs=require(_0x9495('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9495('0x3'))['db'];var utils=require(_0x9495('0x4'));var logger=require(_0x9495('0x5'))(_0x9495('0x6'));var config=require('../../config/environment');var jayson=require(_0x9495('0x7'));var client=jayson[_0x9495('0x8')][_0x9495('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21f4e7,_0xd77231,_0x34744d){return new BPromise(function(_0x2a4754,_0x19f08c){return client[_0x9495('0xa')](_0x21f4e7,_0x34744d)[_0x9495('0xb')](function(_0x6b1466){logger['info'](_0x9495('0xc'),_0xd77231,'request\x20sent');logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0xd77231,'request\x20sent',JSON[_0x9495('0xd')](_0x6b1466));if(_0x6b1466[_0x9495('0xe')]){if(_0x6b1466[_0x9495('0xe')][_0x9495('0xf')]===0x1f4){logger[_0x9495('0xe')](_0x9495('0xc'),_0xd77231,_0x6b1466[_0x9495('0xe')][_0x9495('0x10')]);return _0x19f08c(_0x6b1466[_0x9495('0xe')][_0x9495('0x10')]);}logger[_0x9495('0xe')](_0x9495('0xc'),_0xd77231,_0x6b1466[_0x9495('0xe')][_0x9495('0x10')]);return _0x2a4754(_0x6b1466[_0x9495('0xe')][_0x9495('0x10')]);}else{logger['info'](_0x9495('0xc'),_0xd77231,_0x9495('0x11'));_0x2a4754(_0x6b1466[_0x9495('0x12')][_0x9495('0x10')]);}})[_0x9495('0x13')](function(_0x4c1d9d){logger[_0x9495('0xe')](_0x9495('0xc'),_0xd77231,_0x4c1d9d);_0x19f08c(_0x4c1d9d);});});}exports[_0x9495('0x14')]=function(_0x7ca882){var _0x22feb8=this;return new Promise(function(_0x502562,_0x213bab){return db[_0x9495('0x15')]['findAll']({'raw':_0x7ca882['options']?_0x7ca882['options']['raw']===undefined?!![]:![]:!![],'where':_0x7ca882[_0x9495('0x16')]?_0x7ca882[_0x9495('0x16')][_0x9495('0x17')]||null:null,'attributes':_0x7ca882[_0x9495('0x16')]?_0x7ca882[_0x9495('0x16')][_0x9495('0x18')]||null:null,'limit':_0x7ca882[_0x9495('0x16')]?_0x7ca882[_0x9495('0x16')][_0x9495('0x19')]||null:null,'include':_0x7ca882[_0x9495('0x16')]?_0x7ca882['options'][_0x9495('0x1a')]?_[_0x9495('0x1b')](_0x7ca882[_0x9495('0x16')][_0x9495('0x1a')],function(_0x40d9d1){return{'model':db[_0x40d9d1[_0x9495('0x1c')]],'as':_0x40d9d1['as'],'attributes':_0x40d9d1[_0x9495('0x18')],'include':_0x40d9d1[_0x9495('0x1a')]?_[_0x9495('0x1b')](_0x40d9d1['include'],function(_0x224e5e){return{'model':db[_0x224e5e[_0x9495('0x1c')]],'as':_0x224e5e['as'],'attributes':_0x224e5e[_0x9495('0x18')],'include':_0x224e5e[_0x9495('0x1a')]?_[_0x9495('0x1b')](_0x224e5e[_0x9495('0x1a')],function(_0xaa5ab4){return{'model':db[_0xaa5ab4[_0x9495('0x1c')]],'as':_0xaa5ab4['as'],'attributes':_0xaa5ab4['attributes']};}):[]};}):[]};}):[]:[]})[_0x9495('0xb')](function(_0x13b1b6){logger[_0x9495('0x1d')](_0x9495('0x14'),_0x7ca882);logger['debug'](_0x9495('0x14'),_0x7ca882,JSON[_0x9495('0xd')](_0x13b1b6));_0x502562(_0x13b1b6);})[_0x9495('0x13')](function(_0x5f3d6e){logger[_0x9495('0xe')](_0x9495('0x14'),_0x5f3d6e[_0x9495('0x10')],_0x7ca882);_0x213bab(_0x22feb8[_0x9495('0xe')](0x1f4,_0x5f3d6e[_0x9495('0x10')]));});});};exports[_0x9495('0x1e')]=function(_0x4770ed){var _0x5e2d9e=this;return new Promise(function(_0x3f6df9,_0x1d641b){return db[_0x9495('0x15')][_0x9495('0x1f')]({'raw':_0x4770ed[_0x9495('0x16')]?_0x4770ed[_0x9495('0x16')][_0x9495('0x20')]===undefined?!![]:![]:!![],'where':_0x4770ed[_0x9495('0x16')]?_0x4770ed['options'][_0x9495('0x17')]||null:null,'attributes':_0x4770ed['options']?_0x4770ed['options']['attributes']||null:null,'include':_0x4770ed[_0x9495('0x16')]?_0x4770ed[_0x9495('0x16')][_0x9495('0x1a')]?_[_0x9495('0x1b')](_0x4770ed[_0x9495('0x16')][_0x9495('0x1a')],function(_0x3f724e){return{'model':db[_0x3f724e[_0x9495('0x1c')]],'as':_0x3f724e['as'],'attributes':_0x3f724e[_0x9495('0x18')],'include':_0x3f724e[_0x9495('0x1a')]?_[_0x9495('0x1b')](_0x3f724e[_0x9495('0x1a')],function(_0x1e151a){return{'model':db[_0x1e151a['model']],'as':_0x1e151a['as'],'attributes':_0x1e151a[_0x9495('0x18')],'include':_0x1e151a[_0x9495('0x1a')]?_[_0x9495('0x1b')](_0x1e151a[_0x9495('0x1a')],function(_0x312f5c){return{'model':db[_0x312f5c[_0x9495('0x1c')]],'as':_0x312f5c['as'],'attributes':_0x312f5c[_0x9495('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b1650){logger[_0x9495('0x1d')](_0x9495('0x1e'),_0x4770ed);logger['debug'](_0x9495('0x1e'),_0x4770ed,JSON[_0x9495('0xd')](_0x5b1650));_0x3f6df9(_0x5b1650);})['catch'](function(_0x3f053f){logger[_0x9495('0xe')]('ShowZohoAccount',_0x3f053f[_0x9495('0x10')],_0x4770ed);_0x1d641b(_0x5e2d9e[_0x9495('0xe')](0x1f4,_0x3f053f[_0x9495('0x10')]));});});}; \ No newline at end of file +var _0xab95=['jayson/promise','client','request','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','then','stringify','ShowZohoAccount','find','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0xab95,0x1d5));var _0x5ab9=function(_0xf2d050,_0x2b714d){_0xf2d050=_0xf2d050-0x0;var _0x3a8795=_0xab95[_0xf2d050];return _0x3a8795;};'use strict';var _=require(_0x5ab9('0x0'));var util=require(_0x5ab9('0x1'));var moment=require(_0x5ab9('0x2'));var BPromise=require('bluebird');var rs=require(_0x5ab9('0x3'));var fs=require('fs');var Redis=require(_0x5ab9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5ab9('0x5'))(_0x5ab9('0x6'));var config=require('../../config/environment');var jayson=require(_0x5ab9('0x7'));var client=jayson[_0x5ab9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d1ddd,_0x2c4545,_0x49ab04){return new BPromise(function(_0x2fa286,_0x44bd27){return client[_0x5ab9('0x9')](_0x5d1ddd,_0x49ab04)['then'](function(_0x54ea1c){logger[_0x5ab9('0xa')](_0x5ab9('0xb'),_0x2c4545,_0x5ab9('0xc'));logger[_0x5ab9('0xd')](_0x5ab9('0xe'),_0x2c4545,'request\x20sent',JSON['stringify'](_0x54ea1c));if(_0x54ea1c[_0x5ab9('0xf')]){if(_0x54ea1c[_0x5ab9('0xf')]['code']===0x1f4){logger[_0x5ab9('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x2c4545,_0x54ea1c[_0x5ab9('0xf')][_0x5ab9('0x10')]);return _0x44bd27(_0x54ea1c[_0x5ab9('0xf')][_0x5ab9('0x10')]);}logger[_0x5ab9('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x2c4545,_0x54ea1c[_0x5ab9('0xf')][_0x5ab9('0x10')]);return _0x2fa286(_0x54ea1c[_0x5ab9('0xf')]['message']);}else{logger[_0x5ab9('0xa')]('ZohoAccount,\x20%s,\x20%s',_0x2c4545,'request\x20sent');_0x2fa286(_0x54ea1c[_0x5ab9('0x11')][_0x5ab9('0x10')]);}})[_0x5ab9('0x12')](function(_0x3eda14){logger[_0x5ab9('0xf')](_0x5ab9('0xb'),_0x2c4545,_0x3eda14);_0x44bd27(_0x3eda14);});});}exports[_0x5ab9('0x13')]=function(_0x49970d){var _0x123145=this;return new Promise(function(_0x274383,_0x5865ea){return db[_0x5ab9('0x14')][_0x5ab9('0x15')]({'raw':_0x49970d['options']?_0x49970d[_0x5ab9('0x16')][_0x5ab9('0x17')]===undefined?!![]:![]:!![],'where':_0x49970d[_0x5ab9('0x16')]?_0x49970d[_0x5ab9('0x16')][_0x5ab9('0x18')]||null:null,'attributes':_0x49970d[_0x5ab9('0x16')]?_0x49970d[_0x5ab9('0x16')][_0x5ab9('0x19')]||null:null,'limit':_0x49970d[_0x5ab9('0x16')]?_0x49970d[_0x5ab9('0x16')][_0x5ab9('0x1a')]||null:null,'include':_0x49970d[_0x5ab9('0x16')]?_0x49970d['options']['include']?_[_0x5ab9('0x1b')](_0x49970d['options'][_0x5ab9('0x1c')],function(_0xdecd3d){return{'model':db[_0xdecd3d[_0x5ab9('0x1d')]],'as':_0xdecd3d['as'],'attributes':_0xdecd3d[_0x5ab9('0x19')],'include':_0xdecd3d[_0x5ab9('0x1c')]?_[_0x5ab9('0x1b')](_0xdecd3d[_0x5ab9('0x1c')],function(_0x170f2d){return{'model':db[_0x170f2d[_0x5ab9('0x1d')]],'as':_0x170f2d['as'],'attributes':_0x170f2d[_0x5ab9('0x19')],'include':_0x170f2d['include']?_['map'](_0x170f2d[_0x5ab9('0x1c')],function(_0x120c92){return{'model':db[_0x120c92[_0x5ab9('0x1d')]],'as':_0x120c92['as'],'attributes':_0x120c92[_0x5ab9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5ab9('0x1e')](function(_0x3a293f){logger['info'](_0x5ab9('0x13'),_0x49970d);logger[_0x5ab9('0xd')](_0x5ab9('0x13'),_0x49970d,JSON[_0x5ab9('0x1f')](_0x3a293f));_0x274383(_0x3a293f);})[_0x5ab9('0x12')](function(_0x4fccdf){logger[_0x5ab9('0xf')](_0x5ab9('0x13'),_0x4fccdf[_0x5ab9('0x10')],_0x49970d);_0x5865ea(_0x123145[_0x5ab9('0xf')](0x1f4,_0x4fccdf[_0x5ab9('0x10')]));});});};exports[_0x5ab9('0x20')]=function(_0x3da00d){var _0x5da406=this;return new Promise(function(_0x5528b3,_0x2f02e1){return db[_0x5ab9('0x14')][_0x5ab9('0x21')]({'raw':_0x3da00d[_0x5ab9('0x16')]?_0x3da00d[_0x5ab9('0x16')][_0x5ab9('0x17')]===undefined?!![]:![]:!![],'where':_0x3da00d[_0x5ab9('0x16')]?_0x3da00d[_0x5ab9('0x16')][_0x5ab9('0x18')]||null:null,'attributes':_0x3da00d['options']?_0x3da00d[_0x5ab9('0x16')][_0x5ab9('0x19')]||null:null,'include':_0x3da00d[_0x5ab9('0x16')]?_0x3da00d[_0x5ab9('0x16')][_0x5ab9('0x1c')]?_[_0x5ab9('0x1b')](_0x3da00d[_0x5ab9('0x16')][_0x5ab9('0x1c')],function(_0x490d2f){return{'model':db[_0x490d2f[_0x5ab9('0x1d')]],'as':_0x490d2f['as'],'attributes':_0x490d2f[_0x5ab9('0x19')],'include':_0x490d2f[_0x5ab9('0x1c')]?_[_0x5ab9('0x1b')](_0x490d2f[_0x5ab9('0x1c')],function(_0x51808){return{'model':db[_0x51808[_0x5ab9('0x1d')]],'as':_0x51808['as'],'attributes':_0x51808[_0x5ab9('0x19')],'include':_0x51808[_0x5ab9('0x1c')]?_[_0x5ab9('0x1b')](_0x51808[_0x5ab9('0x1c')],function(_0x501c26){return{'model':db[_0x501c26[_0x5ab9('0x1d')]],'as':_0x501c26['as'],'attributes':_0x501c26[_0x5ab9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5ab9('0x1e')](function(_0x51b892){logger[_0x5ab9('0xa')](_0x5ab9('0x20'),_0x3da00d);logger[_0x5ab9('0xd')](_0x5ab9('0x20'),_0x3da00d,JSON[_0x5ab9('0x1f')](_0x51b892));_0x5528b3(_0x51b892);})[_0x5ab9('0x12')](function(_0x89a0){logger[_0x5ab9('0xf')]('ShowZohoAccount',_0x89a0[_0x5ab9('0x10')],_0x3da00d);_0x2f02e1(_0x5da406[_0x5ab9('0xf')](0x1f4,_0x89a0[_0x5ab9('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 422a3fb..36ecc49 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 _0xae6d=['show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','create','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x4eafd8,_0x4aa4aa){var _0x19cda0=function(_0x5bc986){while(--_0x5bc986){_0x4eafd8['push'](_0x4eafd8['shift']());}};_0x19cda0(++_0x4aa4aa);}(_0xae6d,0x1ac));var _0xdae6=function(_0x3fcc20,_0x57c31b){_0x3fcc20=_0x3fcc20-0x0;var _0x15d3ce=_0xae6d[_0x3fcc20];return _0x15d3ce;};'use strict';var multer=require(_0xdae6('0x0'));var util=require(_0xdae6('0x1'));var path=require('path');var timeout=require(_0xdae6('0x2'));var express=require(_0xdae6('0x3'));var router=express[_0xdae6('0x4')]();var fs_extra=require(_0xdae6('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdae6('0x6'));var controller=require(_0xdae6('0x7'));router[_0xdae6('0x8')]('/',auth[_0xdae6('0x9')](),controller[_0xdae6('0xa')]);router[_0xdae6('0x8')](_0xdae6('0xb'),auth[_0xdae6('0x9')](),controller[_0xdae6('0xc')]);router[_0xdae6('0x8')](_0xdae6('0xd'),auth[_0xdae6('0x9')](),controller['getFields']);router[_0xdae6('0x8')](_0xdae6('0xe'),auth[_0xdae6('0x9')](),controller[_0xdae6('0xf')]);router[_0xdae6('0x8')](_0xdae6('0x10'),auth[_0xdae6('0x9')](),controller['getDescriptions']);router[_0xdae6('0x11')]('/',auth[_0xdae6('0x9')](),controller[_0xdae6('0x12')]);router['put'](_0xdae6('0xb'),auth[_0xdae6('0x9')](),controller[_0xdae6('0x13')]);router[_0xdae6('0x14')](_0xdae6('0xb'),auth[_0xdae6('0x9')](),controller[_0xdae6('0x15')]);module['exports']=router; \ No newline at end of file +var _0x159e=['update','delete','destroy','exports','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','put','/:id'];(function(_0x161583,_0x14f575){var _0x23b2bc=function(_0x50bcda){while(--_0x50bcda){_0x161583['push'](_0x161583['shift']());}};_0x23b2bc(++_0x14f575);}(_0x159e,0x138));var _0xe159=function(_0x1ff215,_0x906e09){_0x1ff215=_0x1ff215-0x0;var _0x32a6a4=_0x159e[_0x1ff215];return _0x32a6a4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe159('0x0'));var timeout=require(_0xe159('0x1'));var express=require(_0xe159('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe159('0x3'));var config=require(_0xe159('0x4'));var controller=require(_0xe159('0x5'));router[_0xe159('0x6')]('/',auth[_0xe159('0x7')](),controller[_0xe159('0x8')]);router[_0xe159('0x6')]('/:id',auth[_0xe159('0x7')](),controller[_0xe159('0x9')]);router[_0xe159('0x6')](_0xe159('0xa'),auth[_0xe159('0x7')](),controller[_0xe159('0xb')]);router[_0xe159('0x6')](_0xe159('0xc'),auth['isAuthenticated'](),controller[_0xe159('0xd')]);router[_0xe159('0x6')](_0xe159('0xe'),auth[_0xe159('0x7')](),controller['getDescriptions']);router['post']('/',auth[_0xe159('0x7')](),controller[_0xe159('0xf')]);router[_0xe159('0x10')](_0xe159('0x11'),auth['isAuthenticated'](),controller[_0xe159('0x12')]);router[_0xe159('0x13')]('/:id',auth[_0xe159('0x7')](),controller[_0xe159('0x14')]);module[_0xe159('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 acb1315..f7eadd3 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 _0x659d=['lead','nothing','contact','contact_lead','exports','STRING'];(function(_0x1c3e2d,_0x1c937a){var _0x386f67=function(_0x27570a){while(--_0x27570a){_0x1c3e2d['push'](_0x1c3e2d['shift']());}};_0x386f67(++_0x1c937a);}(_0x659d,0x64));var _0xd659=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0x659d[_0x1bc0ae];return _0x501104;};'use strict';var Sequelize=require('sequelize');module[_0xd659('0x0')]={'name':{'type':Sequelize[_0xd659('0x1')]},'moduleCreate':{'type':Sequelize['ENUM'](_0xd659('0x2'),'contact',_0xd659('0x3')),'defaultValue':_0xd659('0x2')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0xd659('0x4'),_0xd659('0x2')),'defaultValue':_0xd659('0x5')},'description':{'type':Sequelize[_0xd659('0x1')]}}; \ No newline at end of file +var _0xac0a=['contact','nothing','lead','contact_lead','STRING','ENUM'];(function(_0x2a625f,_0x30f4d2){var _0xafe0e2=function(_0x14c283){while(--_0x14c283){_0x2a625f['push'](_0x2a625f['shift']());}};_0xafe0e2(++_0x30f4d2);}(_0xac0a,0x11e));var _0xaac0=function(_0x11f1fd,_0xce95a8){_0x11f1fd=_0x11f1fd-0x0;var _0x2d1215=_0xac0a[_0x11f1fd];return _0x2d1215;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xaac0('0x0')]},'moduleCreate':{'type':Sequelize[_0xaac0('0x1')]('lead',_0xaac0('0x2'),_0xaac0('0x3')),'defaultValue':_0xaac0('0x4')},'moduleSearch':{'type':Sequelize[_0xaac0('0x1')](_0xaac0('0x5'),_0xaac0('0x2'),_0xaac0('0x4')),'defaultValue':_0xaac0('0x5')},'description':{'type':Sequelize[_0xaac0('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index bef6d11..66f3595 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 _0x9a17=['error','name','send','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','params','include','find','create','body','catch','destroy','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','undefined','offset','count','set','Content-Range','apply','reject','save','update','then'];(function(_0x46cf00,_0x457a43){var _0x3974dc=function(_0x4b5d0a){while(--_0x4b5d0a){_0x46cf00['push'](_0x46cf00['shift']());}};_0x3974dc(++_0x457a43);}(_0x9a17,0x124));var _0x79a1=function(_0x43a669,_0x13e07a){_0x43a669=_0x43a669-0x0;var _0x30200a=_0x9a17[_0x43a669];return _0x30200a;};'use strict';var emlformat=require(_0x79a1('0x0'));var rimraf=require(_0x79a1('0x1'));var zipdir=require(_0x79a1('0x2'));var jsonpatch=require(_0x79a1('0x3'));var rp=require(_0x79a1('0x4'));var moment=require(_0x79a1('0x5'));var BPromise=require(_0x79a1('0x6'));var Mustache=require('mustache');var util=require(_0x79a1('0x7'));var path=require(_0x79a1('0x8'));var sox=require(_0x79a1('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x79a1('0xa'));var _=require(_0x79a1('0xb'));var squel=require(_0x79a1('0xc'));var crypto=require(_0x79a1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x79a1('0xe'));var toCsv=require(_0x79a1('0xf'));var querystring=require(_0x79a1('0x10'));var Papa=require(_0x79a1('0x11'));var Redis=require('ioredis');var authService=require(_0x79a1('0x12'));var qs=require(_0x79a1('0x13'));var as=require(_0x79a1('0x14'));var hardwareService=require(_0x79a1('0x15'));var logger=require(_0x79a1('0x16'))(_0x79a1('0x17'));var utils=require(_0x79a1('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x79a1('0x19'));var db=require(_0x79a1('0x1a'))['db'];function respondWithStatusCode(_0x4f6ee5,_0x8a6550){_0x8a6550=_0x8a6550||0xcc;return function(_0x1e5866){if(_0x1e5866){return _0x4f6ee5['sendStatus'](_0x8a6550);}return _0x4f6ee5['status'](_0x8a6550)[_0x79a1('0x1b')]();};}function respondWithResult(_0x1d406d,_0x3d7b9e){_0x3d7b9e=_0x3d7b9e||0xc8;return function(_0x5a76d6){if(_0x5a76d6){return _0x1d406d[_0x79a1('0x1c')](_0x3d7b9e)[_0x79a1('0x1d')](_0x5a76d6);}};}function respondWithFilteredResult(_0x11b6c2,_0xa0ee0){return function(_0x3e01e5){if(_0x3e01e5){var _0x315fec=typeof _0xa0ee0['offset']===_0x79a1('0x1e')&&typeof _0xa0ee0['limit']===_0x79a1('0x1e');var _0x12d05a=_0x3e01e5['count'];var _0x3609dc=_0x315fec?0x0:_0xa0ee0[_0x79a1('0x1f')];var _0x7f3a5b=_0x315fec?_0x3e01e5[_0x79a1('0x20')]:_0xa0ee0['offset']+_0xa0ee0['limit'];var _0x251532;if(_0x7f3a5b>=_0x12d05a){_0x7f3a5b=_0x12d05a;_0x251532=0xc8;}else{_0x251532=0xce;}_0x11b6c2[_0x79a1('0x1c')](_0x251532);return _0x11b6c2[_0x79a1('0x21')](_0x79a1('0x22'),_0x3609dc+'-'+_0x7f3a5b+'/'+_0x12d05a)['json'](_0x3e01e5);}return null;};}function patchUpdates(_0x5c3cd0){return function(_0x33aa32){try{jsonpatch[_0x79a1('0x23')](_0x33aa32,_0x5c3cd0,!![]);}catch(_0x366c23){return BPromise[_0x79a1('0x24')](_0x366c23);}return _0x33aa32[_0x79a1('0x25')]();};}function saveUpdates(_0xa4569b,_0x4f3d50){return function(_0x386a1f){if(_0x386a1f){return _0x386a1f[_0x79a1('0x26')](_0xa4569b)[_0x79a1('0x27')](function(_0x941c72){return _0x941c72;});}return null;};}function removeEntity(_0x23e6e7,_0x45774f){return function(_0x5a258d){if(_0x5a258d){return _0x5a258d['destroy']()[_0x79a1('0x27')](function(){_0x23e6e7[_0x79a1('0x1c')](0xcc)[_0x79a1('0x1b')]();});}};}function handleEntityNotFound(_0x3022e7,_0x42730d){return function(_0x3a5e89){if(!_0x3a5e89){_0x3022e7['sendStatus'](0x194);}return _0x3a5e89;};}function handleError(_0x584964,_0x43641a){_0x43641a=_0x43641a||0x1f4;return function(_0x38e1ea){logger[_0x79a1('0x28')](_0x38e1ea['stack']);if(_0x38e1ea[_0x79a1('0x29')]){delete _0x38e1ea[_0x79a1('0x29')];}_0x584964['status'](_0x43641a)[_0x79a1('0x2a')](_0x38e1ea);};}exports['index']=function(_0xb0a746,_0x2bacd8){var _0x18a672={},_0x28c1f5={},_0x2ad8bf={'count':0x0,'rows':[]};var _0xb664c3=_[_0x79a1('0x2b')](db[_0x79a1('0x2c')][_0x79a1('0x2d')],function(_0x4c5466){return{'name':_0x4c5466[_0x79a1('0x2e')],'type':_0x4c5466[_0x79a1('0x2f')][_0x79a1('0x30')]};});_0x28c1f5[_0x79a1('0x31')]=_[_0x79a1('0x2b')](_0xb664c3,_0x79a1('0x29'));_0x28c1f5['query']=_[_0x79a1('0x32')](_0xb0a746[_0x79a1('0x33')]);_0x28c1f5[_0x79a1('0x34')]=_[_0x79a1('0x35')](_0x28c1f5['model'],_0x28c1f5[_0x79a1('0x33')]);_0x18a672[_0x79a1('0x36')]=_['intersection'](_0x28c1f5['model'],qs[_0x79a1('0x37')](_0xb0a746[_0x79a1('0x33')][_0x79a1('0x37')]));_0x18a672['attributes']=_0x18a672['attributes'][_0x79a1('0x38')]?_0x18a672[_0x79a1('0x36')]:_0x28c1f5[_0x79a1('0x31')];if(!_0xb0a746[_0x79a1('0x33')][_0x79a1('0x39')](_0x79a1('0x3a'))){_0x18a672[_0x79a1('0x3b')]=qs[_0x79a1('0x3b')](_0xb0a746[_0x79a1('0x33')][_0x79a1('0x3b')]);_0x18a672[_0x79a1('0x1f')]=qs[_0x79a1('0x1f')](_0xb0a746[_0x79a1('0x33')][_0x79a1('0x1f')]);}_0x18a672[_0x79a1('0x3c')]=qs[_0x79a1('0x3d')](_0xb0a746[_0x79a1('0x33')][_0x79a1('0x3d')]);_0x18a672[_0x79a1('0x3e')]=qs[_0x79a1('0x34')](_[_0x79a1('0x3f')](_0xb0a746[_0x79a1('0x33')],_0x28c1f5[_0x79a1('0x34')]),_0xb664c3);if(_0xb0a746[_0x79a1('0x33')]['filter']){_0x18a672[_0x79a1('0x3e')]=_[_0x79a1('0x40')](_0x18a672['where'],{'$or':_[_0x79a1('0x2b')](_0xb664c3,function(_0x458701){if(_0x458701[_0x79a1('0x2f')]!==_0x79a1('0x41')){var _0x6fb39f={};_0x6fb39f[_0x458701['name']]={'$like':'%'+_0xb0a746[_0x79a1('0x33')][_0x79a1('0x42')]+'%'};return _0x6fb39f;}})});}_0x18a672=_[_0x79a1('0x40')]({},_0x18a672,_0xb0a746[_0x79a1('0x43')]);var _0x5b700f={'where':_0x18a672[_0x79a1('0x3e')]};return db[_0x79a1('0x2c')][_0x79a1('0x20')](_0x5b700f)['then'](function(_0x29230f){_0x2ad8bf['count']=_0x29230f;if(_0xb0a746[_0x79a1('0x33')][_0x79a1('0x44')]){_0x18a672['include']=[{'all':!![]}];}return db[_0x79a1('0x2c')][_0x79a1('0x45')](_0x18a672);})[_0x79a1('0x27')](function(_0x4e1d6d){_0x2ad8bf[_0x79a1('0x46')]=_0x4e1d6d;return _0x2ad8bf;})[_0x79a1('0x27')](respondWithFilteredResult(_0x2bacd8,_0x18a672))['catch'](handleError(_0x2bacd8,null));};exports['show']=function(_0x531bac,_0x56ad0d){var _0xc5751={'raw':![],'where':{'id':_0x531bac[_0x79a1('0x47')]['id']}},_0x421380={};_0x421380[_0x79a1('0x31')]=_[_0x79a1('0x32')](db[_0x79a1('0x2c')][_0x79a1('0x2d')]);_0x421380[_0x79a1('0x33')]=_['keys'](_0x531bac[_0x79a1('0x33')]);_0x421380[_0x79a1('0x34')]=_[_0x79a1('0x35')](_0x421380[_0x79a1('0x31')],_0x421380[_0x79a1('0x33')]);_0xc5751[_0x79a1('0x36')]=_['intersection'](_0x421380[_0x79a1('0x31')],qs[_0x79a1('0x37')](_0x531bac[_0x79a1('0x33')][_0x79a1('0x37')]));_0xc5751[_0x79a1('0x36')]=_0xc5751['attributes'][_0x79a1('0x38')]?_0xc5751[_0x79a1('0x36')]:_0x421380[_0x79a1('0x31')];if(_0x531bac['query'][_0x79a1('0x44')]){_0xc5751[_0x79a1('0x48')]=[{'all':!![]}];}_0xc5751=_[_0x79a1('0x40')]({},_0xc5751,_0x531bac[_0x79a1('0x43')]);return db[_0x79a1('0x2c')][_0x79a1('0x49')](_0xc5751)[_0x79a1('0x27')](handleEntityNotFound(_0x56ad0d,null))[_0x79a1('0x27')](respondWithResult(_0x56ad0d,null))['catch'](handleError(_0x56ad0d,null));};exports[_0x79a1('0x4a')]=function(_0x33ad49,_0x5d5c93){return db[_0x79a1('0x2c')][_0x79a1('0x4a')](_0x33ad49[_0x79a1('0x4b')],{})['then'](respondWithResult(_0x5d5c93,0xc9))[_0x79a1('0x4c')](handleError(_0x5d5c93,null));};exports[_0x79a1('0x26')]=function(_0x444af1,_0x4db325){if(_0x444af1['body']['id']){delete _0x444af1['body']['id'];}return db[_0x79a1('0x2c')]['find']({'where':{'id':_0x444af1[_0x79a1('0x47')]['id']}})[_0x79a1('0x27')](handleEntityNotFound(_0x4db325,null))[_0x79a1('0x27')](saveUpdates(_0x444af1[_0x79a1('0x4b')],null))['then'](respondWithResult(_0x4db325,null))[_0x79a1('0x4c')](handleError(_0x4db325,null));};exports[_0x79a1('0x4d')]=function(_0x503ec0,_0x30ced8){return db[_0x79a1('0x2c')][_0x79a1('0x49')]({'where':{'id':_0x503ec0['params']['id']}})[_0x79a1('0x27')](handleEntityNotFound(_0x30ced8,null))[_0x79a1('0x27')](removeEntity(_0x30ced8,null))[_0x79a1('0x4c')](handleError(_0x30ced8,null));};exports[_0x79a1('0x4e')]=function(_0x28b8d9,_0x34ec5e,_0x12294c){var _0x431ccd={};var _0x18a46c={};var _0x1a1733;var _0x41e791;return db[_0x79a1('0x2c')][_0x79a1('0x4f')]({'where':{'id':_0x28b8d9[_0x79a1('0x47')]['id']}})[_0x79a1('0x27')](handleEntityNotFound(_0x34ec5e,null))[_0x79a1('0x27')](function(_0x5a80a5){if(_0x5a80a5){_0x1a1733=_0x5a80a5;_0x18a46c[_0x79a1('0x31')]=_[_0x79a1('0x32')](db[_0x79a1('0x50')][_0x79a1('0x2d')]);_0x18a46c['query']=_[_0x79a1('0x32')](_0x28b8d9[_0x79a1('0x33')]);_0x18a46c[_0x79a1('0x34')]=_[_0x79a1('0x35')](_0x18a46c[_0x79a1('0x31')],_0x18a46c[_0x79a1('0x33')]);_0x431ccd[_0x79a1('0x36')]=_[_0x79a1('0x35')](_0x18a46c[_0x79a1('0x31')],qs[_0x79a1('0x37')](_0x28b8d9[_0x79a1('0x33')]['fields']));_0x431ccd['attributes']=_0x431ccd[_0x79a1('0x36')][_0x79a1('0x38')]?_0x431ccd[_0x79a1('0x36')]:_0x18a46c[_0x79a1('0x31')];_0x431ccd['order']=qs[_0x79a1('0x3d')](_0x28b8d9[_0x79a1('0x33')][_0x79a1('0x3d')]);_0x431ccd[_0x79a1('0x3e')]=qs[_0x79a1('0x34')](_[_0x79a1('0x3f')](_0x28b8d9[_0x79a1('0x33')],_0x18a46c[_0x79a1('0x34')]));if(_0x28b8d9['query'][_0x79a1('0x42')]){_0x431ccd['where']=_[_0x79a1('0x40')](_0x431ccd[_0x79a1('0x3e')],{'$or':_[_0x79a1('0x2b')](_0x431ccd[_0x79a1('0x36')],function(_0x2bec0e){var _0xc6c310={};_0xc6c310[_0x2bec0e]={'$like':'%'+_0x28b8d9[_0x79a1('0x33')][_0x79a1('0x42')]+'%'};return _0xc6c310;})});}_0x431ccd=_[_0x79a1('0x40')]({},_0x431ccd,_0x28b8d9[_0x79a1('0x43')]);return _0x1a1733[_0x79a1('0x4e')](_0x431ccd);}})[_0x79a1('0x27')](function(_0x59f500){if(_0x59f500){_0x41e791=_0x59f500['length'];if(!_0x28b8d9[_0x79a1('0x33')][_0x79a1('0x39')]('nolimit')){_0x431ccd[_0x79a1('0x3b')]=qs[_0x79a1('0x3b')](_0x28b8d9['query']['limit']);_0x431ccd['offset']=qs['offset'](_0x28b8d9[_0x79a1('0x33')][_0x79a1('0x1f')]);}return _0x1a1733['getFields'](_0x431ccd);}})[_0x79a1('0x27')](function(_0x5d8cdf){if(_0x5d8cdf){return _0x5d8cdf?{'count':_0x41e791,'rows':_0x5d8cdf}:null;}})[_0x79a1('0x27')](respondWithResult(_0x34ec5e,null))['catch'](handleError(_0x34ec5e,null));};exports['getSubjects']=function(_0x293638,_0x57dc7f,_0x152d64){var _0x4dd82d={};var _0x1c944b={};var _0x48afcb;var _0x458075;return db['ZohoConfiguration'][_0x79a1('0x4f')]({'where':{'id':_0x293638[_0x79a1('0x47')]['id']}})[_0x79a1('0x27')](handleEntityNotFound(_0x57dc7f,null))[_0x79a1('0x27')](function(_0x2317de){if(_0x2317de){_0x48afcb=_0x2317de;_0x1c944b[_0x79a1('0x31')]=_['keys'](db[_0x79a1('0x50')][_0x79a1('0x2d')]);_0x1c944b[_0x79a1('0x33')]=_['keys'](_0x293638[_0x79a1('0x33')]);_0x1c944b[_0x79a1('0x34')]=_[_0x79a1('0x35')](_0x1c944b[_0x79a1('0x31')],_0x1c944b['query']);_0x4dd82d[_0x79a1('0x36')]=_['intersection'](_0x1c944b['model'],qs[_0x79a1('0x37')](_0x293638[_0x79a1('0x33')]['fields']));_0x4dd82d[_0x79a1('0x36')]=_0x4dd82d[_0x79a1('0x36')][_0x79a1('0x38')]?_0x4dd82d[_0x79a1('0x36')]:_0x1c944b['model'];_0x4dd82d[_0x79a1('0x3c')]=qs[_0x79a1('0x3d')](_0x293638[_0x79a1('0x33')][_0x79a1('0x3d')]);_0x4dd82d['where']=qs[_0x79a1('0x34')](_[_0x79a1('0x3f')](_0x293638[_0x79a1('0x33')],_0x1c944b[_0x79a1('0x34')]));if(_0x293638['query'][_0x79a1('0x42')]){_0x4dd82d[_0x79a1('0x3e')]=_[_0x79a1('0x40')](_0x4dd82d[_0x79a1('0x3e')],{'$or':_['map'](_0x4dd82d[_0x79a1('0x36')],function(_0x2b8781){var _0x186f5e={};_0x186f5e[_0x2b8781]={'$like':'%'+_0x293638[_0x79a1('0x33')]['filter']+'%'};return _0x186f5e;})});}_0x4dd82d=_['merge']({},_0x4dd82d,_0x293638[_0x79a1('0x43')]);return _0x48afcb[_0x79a1('0x51')](_0x4dd82d);}})[_0x79a1('0x27')](function(_0x80e7c8){if(_0x80e7c8){_0x458075=_0x80e7c8[_0x79a1('0x38')];if(!_0x293638[_0x79a1('0x33')][_0x79a1('0x39')](_0x79a1('0x3a'))){_0x4dd82d[_0x79a1('0x3b')]=qs['limit'](_0x293638['query'][_0x79a1('0x3b')]);_0x4dd82d[_0x79a1('0x1f')]=qs[_0x79a1('0x1f')](_0x293638[_0x79a1('0x33')][_0x79a1('0x1f')]);}return _0x48afcb[_0x79a1('0x51')](_0x4dd82d);}})[_0x79a1('0x27')](function(_0x193ff2){if(_0x193ff2){return _0x193ff2?{'count':_0x458075,'rows':_0x193ff2}:null;}})[_0x79a1('0x27')](respondWithResult(_0x57dc7f,null))['catch'](handleError(_0x57dc7f,null));};exports[_0x79a1('0x52')]=function(_0x327257,_0x4e17c9,_0x3f0b84){var _0x25c9c6={};var _0x16249b={};var _0x59d582;var _0x2fbd26;return db['ZohoConfiguration'][_0x79a1('0x4f')]({'where':{'id':_0x327257[_0x79a1('0x47')]['id']}})['then'](handleEntityNotFound(_0x4e17c9,null))[_0x79a1('0x27')](function(_0x252330){if(_0x252330){_0x59d582=_0x252330;_0x16249b['model']=_['keys'](db[_0x79a1('0x50')]['rawAttributes']);_0x16249b['query']=_[_0x79a1('0x32')](_0x327257[_0x79a1('0x33')]);_0x16249b['filters']=_[_0x79a1('0x35')](_0x16249b[_0x79a1('0x31')],_0x16249b[_0x79a1('0x33')]);_0x25c9c6[_0x79a1('0x36')]=_[_0x79a1('0x35')](_0x16249b[_0x79a1('0x31')],qs[_0x79a1('0x37')](_0x327257[_0x79a1('0x33')][_0x79a1('0x37')]));_0x25c9c6[_0x79a1('0x36')]=_0x25c9c6['attributes'][_0x79a1('0x38')]?_0x25c9c6[_0x79a1('0x36')]:_0x16249b[_0x79a1('0x31')];_0x25c9c6['order']=qs[_0x79a1('0x3d')](_0x327257[_0x79a1('0x33')][_0x79a1('0x3d')]);_0x25c9c6[_0x79a1('0x3e')]=qs['filters'](_[_0x79a1('0x3f')](_0x327257[_0x79a1('0x33')],_0x16249b['filters']));if(_0x327257[_0x79a1('0x33')]['filter']){_0x25c9c6['where']=_[_0x79a1('0x40')](_0x25c9c6['where'],{'$or':_['map'](_0x25c9c6['attributes'],function(_0x2ca98d){var _0x5d6418={};_0x5d6418[_0x2ca98d]={'$like':'%'+_0x327257[_0x79a1('0x33')][_0x79a1('0x42')]+'%'};return _0x5d6418;})});}_0x25c9c6=_['merge']({},_0x25c9c6,_0x327257[_0x79a1('0x43')]);return _0x59d582['getDescriptions'](_0x25c9c6);}})[_0x79a1('0x27')](function(_0x25972c){if(_0x25972c){_0x2fbd26=_0x25972c[_0x79a1('0x38')];if(!_0x327257[_0x79a1('0x33')][_0x79a1('0x39')](_0x79a1('0x3a'))){_0x25c9c6[_0x79a1('0x3b')]=qs[_0x79a1('0x3b')](_0x327257[_0x79a1('0x33')]['limit']);_0x25c9c6[_0x79a1('0x1f')]=qs[_0x79a1('0x1f')](_0x327257['query'][_0x79a1('0x1f')]);}return _0x59d582[_0x79a1('0x52')](_0x25c9c6);}})[_0x79a1('0x27')](function(_0x199201){if(_0x199201){return _0x199201?{'count':_0x2fbd26,'rows':_0x199201}:null;}})[_0x79a1('0x27')](respondWithResult(_0x4e17c9,null))[_0x79a1('0x4c')](handleError(_0x4e17c9,null));}; \ No newline at end of file +var _0xab32=['length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','update','find','order','options','getFields','getSubjects','findOne','ZohoField','getDescriptions','rimraf','zip-dir','request-promise','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','offset','count','limit','set','Content-Range','apply','save','then','destroy','end','error','stack','name','send','index','map','ZohoConfiguration','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields'];(function(_0x73cf84,_0x57f9c4){var _0x5d9fa0=function(_0x19c302){while(--_0x19c302){_0x73cf84['push'](_0x73cf84['shift']());}};_0x5d9fa0(++_0x57f9c4);}(_0xab32,0xbb));var _0x2ab3=function(_0x337748,_0x402b05){_0x337748=_0x337748-0x0;var _0x3bb03f=_0xab32[_0x337748];return _0x3bb03f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2ab3('0x0'));var zipdir=require(_0x2ab3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2ab3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2ab3('0x3'));var util=require('util');var path=require(_0x2ab3('0x4'));var sox=require(_0x2ab3('0x5'));var csv=require('to-csv');var ejs=require(_0x2ab3('0x6'));var fs=require('fs');var fs_extra=require(_0x2ab3('0x7'));var _=require(_0x2ab3('0x8'));var squel=require('squel');var crypto=require(_0x2ab3('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x2ab3('0xa'));var toCsv=require(_0x2ab3('0xb'));var querystring=require(_0x2ab3('0xc'));var Papa=require(_0x2ab3('0xd'));var Redis=require('ioredis');var authService=require(_0x2ab3('0xe'));var qs=require(_0x2ab3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ab3('0x10'));var logger=require(_0x2ab3('0x11'))(_0x2ab3('0x12'));var utils=require(_0x2ab3('0x13'));var config=require(_0x2ab3('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2ab3('0x15'))['db'];function respondWithStatusCode(_0x455085,_0x5b4027){_0x5b4027=_0x5b4027||0xcc;return function(_0x4346d3){if(_0x4346d3){return _0x455085[_0x2ab3('0x16')](_0x5b4027);}return _0x455085[_0x2ab3('0x17')](_0x5b4027)['end']();};}function respondWithResult(_0x160c3d,_0x39af03){_0x39af03=_0x39af03||0xc8;return function(_0x11c6ee){if(_0x11c6ee){return _0x160c3d[_0x2ab3('0x17')](_0x39af03)[_0x2ab3('0x18')](_0x11c6ee);}};}function respondWithFilteredResult(_0x3372a2,_0x42971e){return function(_0x589f03){if(_0x589f03){var _0x5562c1=typeof _0x42971e['offset']===_0x2ab3('0x19')&&typeof _0x42971e['limit']===_0x2ab3('0x19');var _0x1eaaf6=_0x589f03['count'];var _0x5926f2=_0x5562c1?0x0:_0x42971e[_0x2ab3('0x1a')];var _0x273c15=_0x5562c1?_0x589f03[_0x2ab3('0x1b')]:_0x42971e[_0x2ab3('0x1a')]+_0x42971e[_0x2ab3('0x1c')];var _0x4fb0f8;if(_0x273c15>=_0x1eaaf6){_0x273c15=_0x1eaaf6;_0x4fb0f8=0xc8;}else{_0x4fb0f8=0xce;}_0x3372a2[_0x2ab3('0x17')](_0x4fb0f8);return _0x3372a2[_0x2ab3('0x1d')](_0x2ab3('0x1e'),_0x5926f2+'-'+_0x273c15+'/'+_0x1eaaf6)[_0x2ab3('0x18')](_0x589f03);}return null;};}function patchUpdates(_0x35ff93){return function(_0x1f7794){try{jsonpatch[_0x2ab3('0x1f')](_0x1f7794,_0x35ff93,!![]);}catch(_0x31aea9){return BPromise['reject'](_0x31aea9);}return _0x1f7794[_0x2ab3('0x20')]();};}function saveUpdates(_0x406441,_0x5b594c){return function(_0xbcebba){if(_0xbcebba){return _0xbcebba['update'](_0x406441)[_0x2ab3('0x21')](function(_0x38126b){return _0x38126b;});}return null;};}function removeEntity(_0x14fe94,_0x450105){return function(_0x3501e1){if(_0x3501e1){return _0x3501e1[_0x2ab3('0x22')]()[_0x2ab3('0x21')](function(){_0x14fe94[_0x2ab3('0x17')](0xcc)[_0x2ab3('0x23')]();});}};}function handleEntityNotFound(_0x1a61ea,_0x1418a6){return function(_0x504445){if(!_0x504445){_0x1a61ea[_0x2ab3('0x16')](0x194);}return _0x504445;};}function handleError(_0x424b36,_0x3bdb71){_0x3bdb71=_0x3bdb71||0x1f4;return function(_0xaa1634){logger[_0x2ab3('0x24')](_0xaa1634[_0x2ab3('0x25')]);if(_0xaa1634[_0x2ab3('0x26')]){delete _0xaa1634[_0x2ab3('0x26')];}_0x424b36[_0x2ab3('0x17')](_0x3bdb71)[_0x2ab3('0x27')](_0xaa1634);};}exports[_0x2ab3('0x28')]=function(_0x5d5118,_0x31a58a){var _0x5cd5a1={},_0x97580c={},_0x128b02={'count':0x0,'rows':[]};var _0x7d3746=_[_0x2ab3('0x29')](db[_0x2ab3('0x2a')]['rawAttributes'],function(_0x2d78d7){return{'name':_0x2d78d7[_0x2ab3('0x2b')],'type':_0x2d78d7[_0x2ab3('0x2c')][_0x2ab3('0x2d')]};});_0x97580c['model']=_[_0x2ab3('0x29')](_0x7d3746,_0x2ab3('0x26'));_0x97580c[_0x2ab3('0x2e')]=_[_0x2ab3('0x2f')](_0x5d5118[_0x2ab3('0x2e')]);_0x97580c[_0x2ab3('0x30')]=_[_0x2ab3('0x31')](_0x97580c[_0x2ab3('0x32')],_0x97580c[_0x2ab3('0x2e')]);_0x5cd5a1[_0x2ab3('0x33')]=_[_0x2ab3('0x31')](_0x97580c['model'],qs[_0x2ab3('0x34')](_0x5d5118['query'][_0x2ab3('0x34')]));_0x5cd5a1[_0x2ab3('0x33')]=_0x5cd5a1[_0x2ab3('0x33')][_0x2ab3('0x35')]?_0x5cd5a1[_0x2ab3('0x33')]:_0x97580c[_0x2ab3('0x32')];if(!_0x5d5118[_0x2ab3('0x2e')][_0x2ab3('0x36')](_0x2ab3('0x37'))){_0x5cd5a1[_0x2ab3('0x1c')]=qs[_0x2ab3('0x1c')](_0x5d5118['query'][_0x2ab3('0x1c')]);_0x5cd5a1[_0x2ab3('0x1a')]=qs[_0x2ab3('0x1a')](_0x5d5118['query'][_0x2ab3('0x1a')]);}_0x5cd5a1['order']=qs[_0x2ab3('0x38')](_0x5d5118[_0x2ab3('0x2e')][_0x2ab3('0x38')]);_0x5cd5a1[_0x2ab3('0x39')]=qs['filters'](_[_0x2ab3('0x3a')](_0x5d5118[_0x2ab3('0x2e')],_0x97580c[_0x2ab3('0x30')]),_0x7d3746);if(_0x5d5118[_0x2ab3('0x2e')][_0x2ab3('0x3b')]){_0x5cd5a1[_0x2ab3('0x39')]=_[_0x2ab3('0x3c')](_0x5cd5a1[_0x2ab3('0x39')],{'$or':_[_0x2ab3('0x29')](_0x7d3746,function(_0x10b10c){if(_0x10b10c[_0x2ab3('0x2c')]!=='VIRTUAL'){var _0x98152={};_0x98152[_0x10b10c[_0x2ab3('0x26')]]={'$like':'%'+_0x5d5118['query'][_0x2ab3('0x3b')]+'%'};return _0x98152;}})});}_0x5cd5a1=_['merge']({},_0x5cd5a1,_0x5d5118['options']);var _0x20c375={'where':_0x5cd5a1[_0x2ab3('0x39')]};return db[_0x2ab3('0x2a')]['count'](_0x20c375)[_0x2ab3('0x21')](function(_0x516119){_0x128b02[_0x2ab3('0x1b')]=_0x516119;if(_0x5d5118['query'][_0x2ab3('0x3d')]){_0x5cd5a1[_0x2ab3('0x3e')]=[{'all':!![]}];}return db[_0x2ab3('0x2a')][_0x2ab3('0x3f')](_0x5cd5a1);})[_0x2ab3('0x21')](function(_0x2d0b23){_0x128b02[_0x2ab3('0x40')]=_0x2d0b23;return _0x128b02;})[_0x2ab3('0x21')](respondWithFilteredResult(_0x31a58a,_0x5cd5a1))[_0x2ab3('0x41')](handleError(_0x31a58a,null));};exports[_0x2ab3('0x42')]=function(_0x5e1d91,_0x3140a0){var _0x3a640a={'raw':![],'where':{'id':_0x5e1d91[_0x2ab3('0x43')]['id']}},_0x5ceef5={};_0x5ceef5[_0x2ab3('0x32')]=_[_0x2ab3('0x2f')](db['ZohoConfiguration'][_0x2ab3('0x44')]);_0x5ceef5[_0x2ab3('0x2e')]=_[_0x2ab3('0x2f')](_0x5e1d91[_0x2ab3('0x2e')]);_0x5ceef5[_0x2ab3('0x30')]=_[_0x2ab3('0x31')](_0x5ceef5[_0x2ab3('0x32')],_0x5ceef5['query']);_0x3a640a[_0x2ab3('0x33')]=_[_0x2ab3('0x31')](_0x5ceef5[_0x2ab3('0x32')],qs[_0x2ab3('0x34')](_0x5e1d91[_0x2ab3('0x2e')][_0x2ab3('0x34')]));_0x3a640a['attributes']=_0x3a640a[_0x2ab3('0x33')]['length']?_0x3a640a[_0x2ab3('0x33')]:_0x5ceef5['model'];if(_0x5e1d91[_0x2ab3('0x2e')][_0x2ab3('0x3d')]){_0x3a640a['include']=[{'all':!![]}];}_0x3a640a=_[_0x2ab3('0x3c')]({},_0x3a640a,_0x5e1d91['options']);return db[_0x2ab3('0x2a')]['find'](_0x3a640a)[_0x2ab3('0x21')](handleEntityNotFound(_0x3140a0,null))['then'](respondWithResult(_0x3140a0,null))[_0x2ab3('0x41')](handleError(_0x3140a0,null));};exports['create']=function(_0xae07e,_0x495e54){return db['ZohoConfiguration'][_0x2ab3('0x45')](_0xae07e[_0x2ab3('0x46')],{})[_0x2ab3('0x21')](respondWithResult(_0x495e54,0xc9))[_0x2ab3('0x41')](handleError(_0x495e54,null));};exports[_0x2ab3('0x47')]=function(_0x267cac,_0x1569a1){if(_0x267cac[_0x2ab3('0x46')]['id']){delete _0x267cac['body']['id'];}return db[_0x2ab3('0x2a')][_0x2ab3('0x48')]({'where':{'id':_0x267cac['params']['id']}})[_0x2ab3('0x21')](handleEntityNotFound(_0x1569a1,null))['then'](saveUpdates(_0x267cac[_0x2ab3('0x46')],null))[_0x2ab3('0x21')](respondWithResult(_0x1569a1,null))[_0x2ab3('0x41')](handleError(_0x1569a1,null));};exports[_0x2ab3('0x22')]=function(_0x25aa4d,_0x33ab19){return db[_0x2ab3('0x2a')][_0x2ab3('0x48')]({'where':{'id':_0x25aa4d[_0x2ab3('0x43')]['id']}})[_0x2ab3('0x21')](handleEntityNotFound(_0x33ab19,null))[_0x2ab3('0x21')](removeEntity(_0x33ab19,null))[_0x2ab3('0x41')](handleError(_0x33ab19,null));};exports['getFields']=function(_0x44747a,_0x24168a,_0x3c0c76){var _0x2da6c1={};var _0x30a9ed={};var _0x1b87a8;var _0x4a8146;return db[_0x2ab3('0x2a')]['findOne']({'where':{'id':_0x44747a['params']['id']}})[_0x2ab3('0x21')](handleEntityNotFound(_0x24168a,null))['then'](function(_0x4bb4b6){if(_0x4bb4b6){_0x1b87a8=_0x4bb4b6;_0x30a9ed[_0x2ab3('0x32')]=_[_0x2ab3('0x2f')](db['ZohoField'][_0x2ab3('0x44')]);_0x30a9ed['query']=_[_0x2ab3('0x2f')](_0x44747a['query']);_0x30a9ed[_0x2ab3('0x30')]=_['intersection'](_0x30a9ed[_0x2ab3('0x32')],_0x30a9ed[_0x2ab3('0x2e')]);_0x2da6c1['attributes']=_['intersection'](_0x30a9ed['model'],qs['fields'](_0x44747a[_0x2ab3('0x2e')][_0x2ab3('0x34')]));_0x2da6c1[_0x2ab3('0x33')]=_0x2da6c1[_0x2ab3('0x33')][_0x2ab3('0x35')]?_0x2da6c1['attributes']:_0x30a9ed[_0x2ab3('0x32')];_0x2da6c1[_0x2ab3('0x49')]=qs['sort'](_0x44747a[_0x2ab3('0x2e')]['sort']);_0x2da6c1[_0x2ab3('0x39')]=qs[_0x2ab3('0x30')](_[_0x2ab3('0x3a')](_0x44747a[_0x2ab3('0x2e')],_0x30a9ed[_0x2ab3('0x30')]));if(_0x44747a[_0x2ab3('0x2e')][_0x2ab3('0x3b')]){_0x2da6c1[_0x2ab3('0x39')]=_[_0x2ab3('0x3c')](_0x2da6c1[_0x2ab3('0x39')],{'$or':_['map'](_0x2da6c1['attributes'],function(_0x1f3927){var _0x41c15c={};_0x41c15c[_0x1f3927]={'$like':'%'+_0x44747a[_0x2ab3('0x2e')][_0x2ab3('0x3b')]+'%'};return _0x41c15c;})});}_0x2da6c1=_[_0x2ab3('0x3c')]({},_0x2da6c1,_0x44747a[_0x2ab3('0x4a')]);return _0x1b87a8[_0x2ab3('0x4b')](_0x2da6c1);}})[_0x2ab3('0x21')](function(_0x6cf817){if(_0x6cf817){_0x4a8146=_0x6cf817[_0x2ab3('0x35')];if(!_0x44747a[_0x2ab3('0x2e')][_0x2ab3('0x36')](_0x2ab3('0x37'))){_0x2da6c1['limit']=qs[_0x2ab3('0x1c')](_0x44747a[_0x2ab3('0x2e')][_0x2ab3('0x1c')]);_0x2da6c1[_0x2ab3('0x1a')]=qs[_0x2ab3('0x1a')](_0x44747a[_0x2ab3('0x2e')][_0x2ab3('0x1a')]);}return _0x1b87a8[_0x2ab3('0x4b')](_0x2da6c1);}})[_0x2ab3('0x21')](function(_0xa8ae63){if(_0xa8ae63){return _0xa8ae63?{'count':_0x4a8146,'rows':_0xa8ae63}:null;}})[_0x2ab3('0x21')](respondWithResult(_0x24168a,null))[_0x2ab3('0x41')](handleError(_0x24168a,null));};exports[_0x2ab3('0x4c')]=function(_0x10edb3,_0x216763,_0x338de3){var _0x29ae70={};var _0x202b83={};var _0x1c7739;var _0x2ac3d6;return db[_0x2ab3('0x2a')][_0x2ab3('0x4d')]({'where':{'id':_0x10edb3[_0x2ab3('0x43')]['id']}})['then'](handleEntityNotFound(_0x216763,null))[_0x2ab3('0x21')](function(_0x49c810){if(_0x49c810){_0x1c7739=_0x49c810;_0x202b83[_0x2ab3('0x32')]=_[_0x2ab3('0x2f')](db[_0x2ab3('0x4e')][_0x2ab3('0x44')]);_0x202b83[_0x2ab3('0x2e')]=_[_0x2ab3('0x2f')](_0x10edb3[_0x2ab3('0x2e')]);_0x202b83[_0x2ab3('0x30')]=_[_0x2ab3('0x31')](_0x202b83[_0x2ab3('0x32')],_0x202b83['query']);_0x29ae70['attributes']=_[_0x2ab3('0x31')](_0x202b83[_0x2ab3('0x32')],qs[_0x2ab3('0x34')](_0x10edb3[_0x2ab3('0x2e')][_0x2ab3('0x34')]));_0x29ae70[_0x2ab3('0x33')]=_0x29ae70[_0x2ab3('0x33')]['length']?_0x29ae70[_0x2ab3('0x33')]:_0x202b83[_0x2ab3('0x32')];_0x29ae70[_0x2ab3('0x49')]=qs[_0x2ab3('0x38')](_0x10edb3['query'][_0x2ab3('0x38')]);_0x29ae70[_0x2ab3('0x39')]=qs[_0x2ab3('0x30')](_['pick'](_0x10edb3[_0x2ab3('0x2e')],_0x202b83[_0x2ab3('0x30')]));if(_0x10edb3['query'][_0x2ab3('0x3b')]){_0x29ae70['where']=_[_0x2ab3('0x3c')](_0x29ae70[_0x2ab3('0x39')],{'$or':_[_0x2ab3('0x29')](_0x29ae70[_0x2ab3('0x33')],function(_0x36cea8){var _0x424c11={};_0x424c11[_0x36cea8]={'$like':'%'+_0x10edb3[_0x2ab3('0x2e')]['filter']+'%'};return _0x424c11;})});}_0x29ae70=_[_0x2ab3('0x3c')]({},_0x29ae70,_0x10edb3[_0x2ab3('0x4a')]);return _0x1c7739[_0x2ab3('0x4c')](_0x29ae70);}})[_0x2ab3('0x21')](function(_0x33ef99){if(_0x33ef99){_0x2ac3d6=_0x33ef99[_0x2ab3('0x35')];if(!_0x10edb3[_0x2ab3('0x2e')]['hasOwnProperty']('nolimit')){_0x29ae70[_0x2ab3('0x1c')]=qs[_0x2ab3('0x1c')](_0x10edb3[_0x2ab3('0x2e')][_0x2ab3('0x1c')]);_0x29ae70[_0x2ab3('0x1a')]=qs[_0x2ab3('0x1a')](_0x10edb3[_0x2ab3('0x2e')][_0x2ab3('0x1a')]);}return _0x1c7739['getSubjects'](_0x29ae70);}})[_0x2ab3('0x21')](function(_0x588eef){if(_0x588eef){return _0x588eef?{'count':_0x2ac3d6,'rows':_0x588eef}:null;}})[_0x2ab3('0x21')](respondWithResult(_0x216763,null))[_0x2ab3('0x41')](handleError(_0x216763,null));};exports[_0x2ab3('0x4f')]=function(_0xb7e927,_0x261d09,_0x5a2837){var _0x44d102={};var _0x364ea6={};var _0xe5ed75;var _0x3679ac;return db['ZohoConfiguration'][_0x2ab3('0x4d')]({'where':{'id':_0xb7e927[_0x2ab3('0x43')]['id']}})[_0x2ab3('0x21')](handleEntityNotFound(_0x261d09,null))[_0x2ab3('0x21')](function(_0x1a315b){if(_0x1a315b){_0xe5ed75=_0x1a315b;_0x364ea6[_0x2ab3('0x32')]=_[_0x2ab3('0x2f')](db['ZohoField'][_0x2ab3('0x44')]);_0x364ea6['query']=_[_0x2ab3('0x2f')](_0xb7e927['query']);_0x364ea6[_0x2ab3('0x30')]=_[_0x2ab3('0x31')](_0x364ea6['model'],_0x364ea6[_0x2ab3('0x2e')]);_0x44d102[_0x2ab3('0x33')]=_['intersection'](_0x364ea6[_0x2ab3('0x32')],qs[_0x2ab3('0x34')](_0xb7e927[_0x2ab3('0x2e')][_0x2ab3('0x34')]));_0x44d102[_0x2ab3('0x33')]=_0x44d102[_0x2ab3('0x33')][_0x2ab3('0x35')]?_0x44d102[_0x2ab3('0x33')]:_0x364ea6[_0x2ab3('0x32')];_0x44d102['order']=qs[_0x2ab3('0x38')](_0xb7e927[_0x2ab3('0x2e')][_0x2ab3('0x38')]);_0x44d102['where']=qs[_0x2ab3('0x30')](_['pick'](_0xb7e927['query'],_0x364ea6[_0x2ab3('0x30')]));if(_0xb7e927[_0x2ab3('0x2e')][_0x2ab3('0x3b')]){_0x44d102[_0x2ab3('0x39')]=_[_0x2ab3('0x3c')](_0x44d102[_0x2ab3('0x39')],{'$or':_['map'](_0x44d102[_0x2ab3('0x33')],function(_0x1ede84){var _0x4c29a9={};_0x4c29a9[_0x1ede84]={'$like':'%'+_0xb7e927['query']['filter']+'%'};return _0x4c29a9;})});}_0x44d102=_['merge']({},_0x44d102,_0xb7e927['options']);return _0xe5ed75[_0x2ab3('0x4f')](_0x44d102);}})[_0x2ab3('0x21')](function(_0x53c4c4){if(_0x53c4c4){_0x3679ac=_0x53c4c4[_0x2ab3('0x35')];if(!_0xb7e927['query'][_0x2ab3('0x36')]('nolimit')){_0x44d102['limit']=qs[_0x2ab3('0x1c')](_0xb7e927[_0x2ab3('0x2e')][_0x2ab3('0x1c')]);_0x44d102[_0x2ab3('0x1a')]=qs[_0x2ab3('0x1a')](_0xb7e927[_0x2ab3('0x2e')][_0x2ab3('0x1a')]);}return _0xe5ed75['getDescriptions'](_0x44d102);}})['then'](function(_0x1e9918){if(_0x1e9918){return _0x1e9918?{'count':_0x3679ac,'rows':_0x1e9918}:null;}})[_0x2ab3('0x21')](respondWithResult(_0x261d09,null))[_0x2ab3('0x41')](handleError(_0x261d09,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 4baa64e..2f88ec6 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 _0xb37e=['moment','bluebird','path','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xb37e,0x96));var _0xeb37=function(_0x7be865,_0x3dab14){_0x7be865=_0x7be865-0x0;var _0x1ff086=_0xb37e[_0x7be865];return _0x1ff086;};'use strict';var _=require(_0xeb37('0x0'));var util=require(_0xeb37('0x1'));var logger=require(_0xeb37('0x2'))(_0xeb37('0x3'));var moment=require(_0xeb37('0x4'));var BPromise=require(_0xeb37('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb37('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0xeb37('0x7')]=function(_0x589690,_0x14d305){return _0x589690[_0xeb37('0x8')](_0xeb37('0x9'),attributes,{'tableName':_0xeb37('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2dc4=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','ZohoConfiguration','lodash','util','../../config/logger','api'];(function(_0x33203d,_0x20b154){var _0x2e69f4=function(_0x2ba3e6){while(--_0x2ba3e6){_0x33203d['push'](_0x33203d['shift']());}};_0x2e69f4(++_0x20b154);}(_0x2dc4,0x1ac));var _0x42dc=function(_0x4edcd3,_0x59bcaa){_0x4edcd3=_0x4edcd3-0x0;var _0x3c38dd=_0x2dc4[_0x4edcd3];return _0x3c38dd;};'use strict';var _=require(_0x42dc('0x0'));var util=require(_0x42dc('0x1'));var logger=require(_0x42dc('0x2'))(_0x42dc('0x3'));var moment=require(_0x42dc('0x4'));var BPromise=require(_0x42dc('0x5'));var rp=require(_0x42dc('0x6'));var fs=require('fs');var path=require(_0x42dc('0x7'));var rimraf=require(_0x42dc('0x8'));var config=require(_0x42dc('0x9'));var attributes=require('./intZohoConfiguration.attributes');module[_0x42dc('0xa')]=function(_0x1b6c17,_0x5a5357){return _0x1b6c17['define'](_0x42dc('0xb'),attributes,{'tableName':'int_zoho_configurations','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 8802823..c1908ec 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 _0x499c=['then','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request'];(function(_0x4fa665,_0x1ae12a){var _0x62ccff=function(_0x4f0bb8){while(--_0x4f0bb8){_0x4fa665['push'](_0x4fa665['shift']());}};_0x62ccff(++_0x1ae12a);}(_0x499c,0x199));var _0xc499=function(_0x3259eb,_0xac7843){_0x3259eb=_0x3259eb-0x0;var _0x461ef0=_0x499c[_0x3259eb];return _0x461ef0;};'use strict';var _=require(_0xc499('0x0'));var util=require(_0xc499('0x1'));var moment=require(_0xc499('0x2'));var BPromise=require(_0xc499('0x3'));var rs=require(_0xc499('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc499('0x5'))['db'];var utils=require(_0xc499('0x6'));var logger=require('../../config/logger')(_0xc499('0x7'));var config=require('../../config/environment');var jayson=require(_0xc499('0x8'));var client=jayson[_0xc499('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e868c,_0x3bfd09,_0x42ddf7){return new BPromise(function(_0x4f9011,_0x217dc8){return client[_0xc499('0xa')](_0x2e868c,_0x42ddf7)[_0xc499('0xb')](function(_0x2b9816){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x3bfd09,_0xc499('0xc'));logger['debug'](_0xc499('0xd'),_0x3bfd09,'request\x20sent',JSON[_0xc499('0xe')](_0x2b9816));if(_0x2b9816['error']){if(_0x2b9816[_0xc499('0xf')][_0xc499('0x10')]===0x1f4){logger['error'](_0xc499('0x11'),_0x3bfd09,_0x2b9816[_0xc499('0xf')][_0xc499('0x12')]);return _0x217dc8(_0x2b9816[_0xc499('0xf')][_0xc499('0x12')]);}logger[_0xc499('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x3bfd09,_0x2b9816['error'][_0xc499('0x12')]);return _0x4f9011(_0x2b9816[_0xc499('0xf')][_0xc499('0x12')]);}else{logger[_0xc499('0x13')](_0xc499('0x11'),_0x3bfd09,'request\x20sent');_0x4f9011(_0x2b9816['result'][_0xc499('0x12')]);}})[_0xc499('0x14')](function(_0x14ef82){logger[_0xc499('0xf')](_0xc499('0x11'),_0x3bfd09,_0x14ef82);_0x217dc8(_0x14ef82);});});} \ No newline at end of file +var _0x699c=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x5b8ed9,_0x2c86ad){var _0x15a0a5=function(_0x128cfb){while(--_0x128cfb){_0x5b8ed9['push'](_0x5b8ed9['shift']());}};_0x15a0a5(++_0x2c86ad);}(_0x699c,0xc1));var _0xc699=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x699c[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0xc699('0x0'));var moment=require(_0xc699('0x1'));var BPromise=require(_0xc699('0x2'));var rs=require(_0xc699('0x3'));var fs=require('fs');var Redis=require(_0xc699('0x4'));var db=require(_0xc699('0x5'))['db'];var utils=require(_0xc699('0x6'));var logger=require(_0xc699('0x7'))(_0xc699('0x8'));var config=require(_0xc699('0x9'));var jayson=require(_0xc699('0xa'));var client=jayson[_0xc699('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2eec1c,_0xaf2f34,_0x3ff4ac){return new BPromise(function(_0x1569f3,_0x47252f){return client[_0xc699('0xc')](_0x2eec1c,_0x3ff4ac)[_0xc699('0xd')](function(_0x5aea95){logger[_0xc699('0xe')](_0xc699('0xf'),_0xaf2f34,_0xc699('0x10'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0xaf2f34,_0xc699('0x10'),JSON[_0xc699('0x11')](_0x5aea95));if(_0x5aea95[_0xc699('0x12')]){if(_0x5aea95['error'][_0xc699('0x13')]===0x1f4){logger[_0xc699('0x12')](_0xc699('0xf'),_0xaf2f34,_0x5aea95['error'][_0xc699('0x14')]);return _0x47252f(_0x5aea95[_0xc699('0x12')][_0xc699('0x14')]);}logger[_0xc699('0x12')](_0xc699('0xf'),_0xaf2f34,_0x5aea95['error'][_0xc699('0x14')]);return _0x1569f3(_0x5aea95[_0xc699('0x12')][_0xc699('0x14')]);}else{logger[_0xc699('0xe')](_0xc699('0xf'),_0xaf2f34,_0xc699('0x10'));_0x1569f3(_0x5aea95['result']['message']);}})[_0xc699('0x15')](function(_0x5bc03f){logger['error'](_0xc699('0xf'),_0xaf2f34,_0x5bc03f);_0x47252f(_0x5bc03f);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 74f97e8..24c852b 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 _0x00cc=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','update','delete','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x00cc,0x121));var _0xc00c=function(_0x44f7a2,_0x1ceac1){_0x44f7a2=_0x44f7a2-0x0;var _0x3f1493=_0x00cc[_0x44f7a2];return _0x3f1493;};'use strict';var multer=require(_0xc00c('0x0'));var util=require(_0xc00c('0x1'));var path=require(_0xc00c('0x2'));var timeout=require(_0xc00c('0x3'));var express=require(_0xc00c('0x4'));var router=express[_0xc00c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc00c('0x6'));var interaction=require(_0xc00c('0x7'));var config=require(_0xc00c('0x8'));var controller=require('./intZohoField.controller');router[_0xc00c('0x9')]('/',auth[_0xc00c('0xa')](),controller[_0xc00c('0xb')]);router[_0xc00c('0x9')](_0xc00c('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xc00c('0xd')]('/',auth[_0xc00c('0xa')](),controller['create']);router['put'](_0xc00c('0xc'),auth[_0xc00c('0xa')](),controller[_0xc00c('0xe')]);router[_0xc00c('0xf')]('/:id',auth[_0xc00c('0xa')](),controller['destroy']);module[_0xc00c('0x10')]=router; \ No newline at end of file +var _0x305c=['post','create','put','/:id','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','show'];(function(_0x517aba,_0x4814e5){var _0x246abe=function(_0x36b7a9){while(--_0x36b7a9){_0x517aba['push'](_0x517aba['shift']());}};_0x246abe(++_0x4814e5);}(_0x305c,0x15b));var _0xc305=function(_0x4aa2ec,_0x3d552a){_0x4aa2ec=_0x4aa2ec-0x0;var _0x534708=_0x305c[_0x4aa2ec];return _0x534708;};'use strict';var multer=require('multer');var util=require(_0xc305('0x0'));var path=require(_0xc305('0x1'));var timeout=require(_0xc305('0x2'));var express=require(_0xc305('0x3'));var router=express[_0xc305('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc305('0x5'));var interaction=require(_0xc305('0x6'));var config=require(_0xc305('0x7'));var controller=require(_0xc305('0x8'));router[_0xc305('0x9')]('/',auth[_0xc305('0xa')](),controller[_0xc305('0xb')]);router[_0xc305('0x9')]('/:id',auth[_0xc305('0xa')](),controller[_0xc305('0xc')]);router[_0xc305('0xd')]('/',auth[_0xc305('0xa')](),controller[_0xc305('0xe')]);router[_0xc305('0xf')](_0xc305('0x10'),auth[_0xc305('0xa')](),controller[_0xc305('0x11')]);router['delete'](_0xc305('0x10'),auth['isAuthenticated'](),controller[_0xc305('0x12')]);module[_0xc305('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 476d89a..c18fef3 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 _0x7956=['customVariable','BOOLEAN','exports','ENUM','variable','keyValue','picklist','STRING','string'];(function(_0x714494,_0x13f8b7){var _0xff7918=function(_0x47d55e){while(--_0x47d55e){_0x714494['push'](_0x714494['shift']());}};_0xff7918(++_0x13f8b7);}(_0x7956,0x1a9));var _0x6795=function(_0xf6ede2,_0x25a5c){_0xf6ede2=_0xf6ede2-0x0;var _0x4cce6b=_0x7956[_0xf6ede2];return _0x4cce6b;};'use strict';var Sequelize=require('sequelize');module[_0x6795('0x0')]={'type':{'type':Sequelize[_0x6795('0x1')]('string',_0x6795('0x2'),'customVariable',_0x6795('0x3'),_0x6795('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6795('0x5')]},'key':{'type':Sequelize[_0x6795('0x5')]},'keyType':{'type':Sequelize[_0x6795('0x1')](_0x6795('0x6'),_0x6795('0x2'),_0x6795('0x7'))},'keyContent':{'type':Sequelize[_0x6795('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6795('0x5')]},'customField':{'type':Sequelize[_0x6795('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6795('0x5')]}}; \ No newline at end of file +var _0x75fe=['picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue'];(function(_0x383cc2,_0x395986){var _0x432d6a=function(_0x3852aa){while(--_0x3852aa){_0x383cc2['push'](_0x383cc2['shift']());}};_0x432d6a(++_0x395986);}(_0x75fe,0x7c));var _0xe75f=function(_0x390523,_0x1abdd7){_0x390523=_0x390523-0x0;var _0xc49092=_0x75fe[_0x390523];return _0xc49092;};'use strict';var Sequelize=require(_0xe75f('0x0'));module[_0xe75f('0x1')]={'type':{'type':Sequelize[_0xe75f('0x2')]('string',_0xe75f('0x3'),_0xe75f('0x4'),_0xe75f('0x5'),_0xe75f('0x6')),'defaultValue':_0xe75f('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe75f('0x2')](_0xe75f('0x7'),_0xe75f('0x3'),_0xe75f('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe75f('0x8')]},'nameField':{'type':Sequelize[_0xe75f('0x8')]},'customField':{'type':Sequelize[_0xe75f('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 704f627..a55a1c8 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 _0xcbcd=['merge','VIRTUAL','includeAll','rows','catch','show','params','keys','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','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','count','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter'];(function(_0x5562c7,_0x19b0ea){var _0x244381=function(_0x3fc31e){while(--_0x3fc31e){_0x5562c7['push'](_0x5562c7['shift']());}};_0x244381(++_0x19b0ea);}(_0xcbcd,0x1bb));var _0xdcbc=function(_0x5e1e25,_0xdc1421){_0x5e1e25=_0x5e1e25-0x0;var _0x548e5f=_0xcbcd[_0x5e1e25];return _0x548e5f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdcbc('0x0'));var zipdir=require(_0xdcbc('0x1'));var jsonpatch=require(_0xdcbc('0x2'));var rp=require(_0xdcbc('0x3'));var moment=require(_0xdcbc('0x4'));var BPromise=require(_0xdcbc('0x5'));var Mustache=require('mustache');var util=require(_0xdcbc('0x6'));var path=require(_0xdcbc('0x7'));var sox=require(_0xdcbc('0x8'));var csv=require(_0xdcbc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdcbc('0xa'));var _=require(_0xdcbc('0xb'));var squel=require('squel');var crypto=require(_0xdcbc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xdcbc('0xd'));var toCsv=require(_0xdcbc('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdcbc('0xe'));var authService=require(_0xdcbc('0xf'));var qs=require(_0xdcbc('0x10'));var as=require(_0xdcbc('0x11'));var hardwareService=require(_0xdcbc('0x12'));var logger=require(_0xdcbc('0x13'))(_0xdcbc('0x14'));var utils=require(_0xdcbc('0x15'));var config=require(_0xdcbc('0x16'));var licenseUtil=require(_0xdcbc('0x17'));var db=require(_0xdcbc('0x18'))['db'];function respondWithStatusCode(_0x9791d2,_0x1c8246){_0x1c8246=_0x1c8246||0xcc;return function(_0x5f0a86){if(_0x5f0a86){return _0x9791d2[_0xdcbc('0x19')](_0x1c8246);}return _0x9791d2[_0xdcbc('0x1a')](_0x1c8246)[_0xdcbc('0x1b')]();};}function respondWithResult(_0x1df334,_0x43db4d){_0x43db4d=_0x43db4d||0xc8;return function(_0x541ee7){if(_0x541ee7){return _0x1df334[_0xdcbc('0x1a')](_0x43db4d)[_0xdcbc('0x1c')](_0x541ee7);}};}function respondWithFilteredResult(_0x332753,_0x3f48aa){return function(_0x20c12b){if(_0x20c12b){var _0x37155f=typeof _0x3f48aa[_0xdcbc('0x1d')]===_0xdcbc('0x1e')&&typeof _0x3f48aa['limit']===_0xdcbc('0x1e');var _0x5b21fb=_0x20c12b['count'];var _0x2dc69c=_0x37155f?0x0:_0x3f48aa['offset'];var _0x8a2197=_0x37155f?_0x20c12b[_0xdcbc('0x1f')]:_0x3f48aa[_0xdcbc('0x1d')]+_0x3f48aa[_0xdcbc('0x20')];var _0x26dc7b;if(_0x8a2197>=_0x5b21fb){_0x8a2197=_0x5b21fb;_0x26dc7b=0xc8;}else{_0x26dc7b=0xce;}_0x332753[_0xdcbc('0x1a')](_0x26dc7b);return _0x332753['set'](_0xdcbc('0x21'),_0x2dc69c+'-'+_0x8a2197+'/'+_0x5b21fb)[_0xdcbc('0x1c')](_0x20c12b);}return null;};}function patchUpdates(_0x12e818){return function(_0x220718){try{jsonpatch[_0xdcbc('0x22')](_0x220718,_0x12e818,!![]);}catch(_0x321316){return BPromise[_0xdcbc('0x23')](_0x321316);}return _0x220718['save']();};}function saveUpdates(_0x1cc8db,_0x826c1b){return function(_0x2ac39b){if(_0x2ac39b){return _0x2ac39b[_0xdcbc('0x24')](_0x1cc8db)[_0xdcbc('0x25')](function(_0x4ce2cd){return _0x4ce2cd;});}return null;};}function removeEntity(_0x30cb5a,_0x25b732){return function(_0x38426f){if(_0x38426f){return _0x38426f[_0xdcbc('0x26')]()[_0xdcbc('0x25')](function(){_0x30cb5a[_0xdcbc('0x1a')](0xcc)[_0xdcbc('0x1b')]();});}};}function handleEntityNotFound(_0x1893f6,_0xa839cf){return function(_0x49d260){if(!_0x49d260){_0x1893f6[_0xdcbc('0x19')](0x194);}return _0x49d260;};}function handleError(_0x23538f,_0x31e4ec){_0x31e4ec=_0x31e4ec||0x1f4;return function(_0x9c99f4){logger[_0xdcbc('0x27')](_0x9c99f4[_0xdcbc('0x28')]);if(_0x9c99f4[_0xdcbc('0x29')]){delete _0x9c99f4[_0xdcbc('0x29')];}_0x23538f['status'](_0x31e4ec)['send'](_0x9c99f4);};}exports[_0xdcbc('0x2a')]=function(_0x3da22b,_0x413220){var _0x4df13d={},_0xb2a26e={},_0x1827a3={'count':0x0,'rows':[]};var _0x5d6a49=_[_0xdcbc('0x2b')](db[_0xdcbc('0x2c')][_0xdcbc('0x2d')],function(_0x1d35ea){return{'name':_0x1d35ea[_0xdcbc('0x2e')],'type':_0x1d35ea[_0xdcbc('0x2f')][_0xdcbc('0x30')]};});_0xb2a26e[_0xdcbc('0x31')]=_[_0xdcbc('0x2b')](_0x5d6a49,_0xdcbc('0x29'));_0xb2a26e[_0xdcbc('0x32')]=_['keys'](_0x3da22b[_0xdcbc('0x32')]);_0xb2a26e[_0xdcbc('0x33')]=_[_0xdcbc('0x34')](_0xb2a26e[_0xdcbc('0x31')],_0xb2a26e[_0xdcbc('0x32')]);_0x4df13d['attributes']=_[_0xdcbc('0x34')](_0xb2a26e[_0xdcbc('0x31')],qs['fields'](_0x3da22b[_0xdcbc('0x32')][_0xdcbc('0x35')]));_0x4df13d[_0xdcbc('0x36')]=_0x4df13d['attributes'][_0xdcbc('0x37')]?_0x4df13d[_0xdcbc('0x36')]:_0xb2a26e[_0xdcbc('0x31')];if(!_0x3da22b['query'][_0xdcbc('0x38')]('nolimit')){_0x4df13d[_0xdcbc('0x20')]=qs[_0xdcbc('0x20')](_0x3da22b[_0xdcbc('0x32')]['limit']);_0x4df13d[_0xdcbc('0x1d')]=qs['offset'](_0x3da22b[_0xdcbc('0x32')]['offset']);}_0x4df13d[_0xdcbc('0x39')]=qs[_0xdcbc('0x3a')](_0x3da22b[_0xdcbc('0x32')]['sort']);_0x4df13d[_0xdcbc('0x3b')]=qs['filters'](_['pick'](_0x3da22b[_0xdcbc('0x32')],_0xb2a26e[_0xdcbc('0x33')]),_0x5d6a49);if(_0x3da22b[_0xdcbc('0x32')][_0xdcbc('0x3c')]){_0x4df13d[_0xdcbc('0x3b')]=_[_0xdcbc('0x3d')](_0x4df13d['where'],{'$or':_['map'](_0x5d6a49,function(_0x5c5320){if(_0x5c5320[_0xdcbc('0x2f')]!==_0xdcbc('0x3e')){var _0x1eb413={};_0x1eb413[_0x5c5320[_0xdcbc('0x29')]]={'$like':'%'+_0x3da22b[_0xdcbc('0x32')][_0xdcbc('0x3c')]+'%'};return _0x1eb413;}})});}_0x4df13d=_[_0xdcbc('0x3d')]({},_0x4df13d,_0x3da22b['options']);var _0x3bdb2f={'where':_0x4df13d[_0xdcbc('0x3b')]};return db[_0xdcbc('0x2c')][_0xdcbc('0x1f')](_0x3bdb2f)['then'](function(_0x3ed9c0){_0x1827a3[_0xdcbc('0x1f')]=_0x3ed9c0;if(_0x3da22b[_0xdcbc('0x32')][_0xdcbc('0x3f')]){_0x4df13d['include']=[{'all':!![]}];}return db[_0xdcbc('0x2c')]['findAll'](_0x4df13d);})[_0xdcbc('0x25')](function(_0x4d683a){_0x1827a3[_0xdcbc('0x40')]=_0x4d683a;return _0x1827a3;})['then'](respondWithFilteredResult(_0x413220,_0x4df13d))[_0xdcbc('0x41')](handleError(_0x413220,null));};exports[_0xdcbc('0x42')]=function(_0x5c8d96,_0x4c200a){var _0x44f1b7={'raw':!![],'where':{'id':_0x5c8d96[_0xdcbc('0x43')]['id']}},_0x165610={};_0x165610['model']=_[_0xdcbc('0x44')](db['ZohoField']['rawAttributes']);_0x165610[_0xdcbc('0x32')]=_['keys'](_0x5c8d96['query']);_0x165610[_0xdcbc('0x33')]=_['intersection'](_0x165610['model'],_0x165610['query']);_0x44f1b7[_0xdcbc('0x36')]=_[_0xdcbc('0x34')](_0x165610[_0xdcbc('0x31')],qs[_0xdcbc('0x35')](_0x5c8d96[_0xdcbc('0x32')][_0xdcbc('0x35')]));_0x44f1b7[_0xdcbc('0x36')]=_0x44f1b7[_0xdcbc('0x36')]['length']?_0x44f1b7[_0xdcbc('0x36')]:_0x165610['model'];if(_0x5c8d96['query'][_0xdcbc('0x3f')]){_0x44f1b7['include']=[{'all':!![]}];}_0x44f1b7=_[_0xdcbc('0x3d')]({},_0x44f1b7,_0x5c8d96['options']);return db[_0xdcbc('0x2c')][_0xdcbc('0x45')](_0x44f1b7)[_0xdcbc('0x25')](handleEntityNotFound(_0x4c200a,null))[_0xdcbc('0x25')](respondWithResult(_0x4c200a,null))[_0xdcbc('0x41')](handleError(_0x4c200a,null));};exports[_0xdcbc('0x46')]=function(_0xf19f62,_0x1afcb6){return db[_0xdcbc('0x2c')][_0xdcbc('0x46')](_0xf19f62[_0xdcbc('0x47')],{})[_0xdcbc('0x25')](respondWithResult(_0x1afcb6,0xc9))['catch'](handleError(_0x1afcb6,null));};exports[_0xdcbc('0x24')]=function(_0xdd7402,_0x10b529){if(_0xdd7402[_0xdcbc('0x47')]['id']){delete _0xdd7402[_0xdcbc('0x47')]['id'];}return db[_0xdcbc('0x2c')][_0xdcbc('0x45')]({'where':{'id':_0xdd7402[_0xdcbc('0x43')]['id']}})[_0xdcbc('0x25')](handleEntityNotFound(_0x10b529,null))[_0xdcbc('0x25')](saveUpdates(_0xdd7402[_0xdcbc('0x47')],null))[_0xdcbc('0x25')](respondWithResult(_0x10b529,null))[_0xdcbc('0x41')](handleError(_0x10b529,null));};exports[_0xdcbc('0x26')]=function(_0x6b94ba,_0x4dfcf4){return db[_0xdcbc('0x2c')]['find']({'where':{'id':_0x6b94ba[_0xdcbc('0x43')]['id']}})[_0xdcbc('0x25')](handleEntityNotFound(_0x4dfcf4,null))['then'](removeEntity(_0x4dfcf4,null))[_0xdcbc('0x41')](handleError(_0x4dfcf4,null));}; \ No newline at end of file +var _0x93cc=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','ZohoField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','rows','catch','show','includeAll','find','create','body','params','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x5ad075,_0x169bc2){var _0x1114bd=function(_0x4e3d0d){while(--_0x4e3d0d){_0x5ad075['push'](_0x5ad075['shift']());}};_0x1114bd(++_0x169bc2);}(_0x93cc,0xc7));var _0xc93c=function(_0x4871d7,_0x104a54){_0x4871d7=_0x4871d7-0x0;var _0x25faf0=_0x93cc[_0x4871d7];return _0x25faf0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc93c('0x0'));var rp=require(_0xc93c('0x1'));var moment=require(_0xc93c('0x2'));var BPromise=require(_0xc93c('0x3'));var Mustache=require(_0xc93c('0x4'));var util=require(_0xc93c('0x5'));var path=require('path');var sox=require(_0xc93c('0x6'));var csv=require(_0xc93c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc93c('0x8'));var _=require('lodash');var squel=require(_0xc93c('0x9'));var crypto=require(_0xc93c('0xa'));var jsforce=require(_0xc93c('0xb'));var deskjs=require(_0xc93c('0xc'));var toCsv=require(_0xc93c('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc93c('0xd'));var authService=require(_0xc93c('0xe'));var qs=require(_0xc93c('0xf'));var as=require(_0xc93c('0x10'));var hardwareService=require(_0xc93c('0x11'));var logger=require(_0xc93c('0x12'))(_0xc93c('0x13'));var utils=require(_0xc93c('0x14'));var config=require(_0xc93c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc93c('0x16'))['db'];function respondWithStatusCode(_0x17243b,_0x23b16d){_0x23b16d=_0x23b16d||0xcc;return function(_0x5b2439){if(_0x5b2439){return _0x17243b[_0xc93c('0x17')](_0x23b16d);}return _0x17243b['status'](_0x23b16d)[_0xc93c('0x18')]();};}function respondWithResult(_0x10c37b,_0x1079fc){_0x1079fc=_0x1079fc||0xc8;return function(_0x5a5eaf){if(_0x5a5eaf){return _0x10c37b[_0xc93c('0x19')](_0x1079fc)[_0xc93c('0x1a')](_0x5a5eaf);}};}function respondWithFilteredResult(_0x4f83cb,_0x39480c){return function(_0x38da87){if(_0x38da87){var _0x803ad0=typeof _0x39480c[_0xc93c('0x1b')]===_0xc93c('0x1c')&&typeof _0x39480c['limit']===_0xc93c('0x1c');var _0x14e453=_0x38da87[_0xc93c('0x1d')];var _0x1992ce=_0x803ad0?0x0:_0x39480c[_0xc93c('0x1b')];var _0x465170=_0x803ad0?_0x38da87[_0xc93c('0x1d')]:_0x39480c[_0xc93c('0x1b')]+_0x39480c[_0xc93c('0x1e')];var _0x233760;if(_0x465170>=_0x14e453){_0x465170=_0x14e453;_0x233760=0xc8;}else{_0x233760=0xce;}_0x4f83cb[_0xc93c('0x19')](_0x233760);return _0x4f83cb[_0xc93c('0x1f')](_0xc93c('0x20'),_0x1992ce+'-'+_0x465170+'/'+_0x14e453)[_0xc93c('0x1a')](_0x38da87);}return null;};}function patchUpdates(_0x2d6772){return function(_0x4f6bd9){try{jsonpatch[_0xc93c('0x21')](_0x4f6bd9,_0x2d6772,!![]);}catch(_0x5c2da0){return BPromise[_0xc93c('0x22')](_0x5c2da0);}return _0x4f6bd9[_0xc93c('0x23')]();};}function saveUpdates(_0x138724,_0x1cc7e8){return function(_0x5c1437){if(_0x5c1437){return _0x5c1437[_0xc93c('0x24')](_0x138724)[_0xc93c('0x25')](function(_0x1d58df){return _0x1d58df;});}return null;};}function removeEntity(_0x380d9e,_0x29231b){return function(_0x7c487d){if(_0x7c487d){return _0x7c487d[_0xc93c('0x26')]()[_0xc93c('0x25')](function(){_0x380d9e[_0xc93c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x354823,_0xc04485){return function(_0x16db66){if(!_0x16db66){_0x354823[_0xc93c('0x17')](0x194);}return _0x16db66;};}function handleError(_0x338fab,_0x2cb8fc){_0x2cb8fc=_0x2cb8fc||0x1f4;return function(_0x9efb6a){logger[_0xc93c('0x27')](_0x9efb6a[_0xc93c('0x28')]);if(_0x9efb6a[_0xc93c('0x29')]){delete _0x9efb6a[_0xc93c('0x29')];}_0x338fab[_0xc93c('0x19')](_0x2cb8fc)['send'](_0x9efb6a);};}exports['index']=function(_0x5671c8,_0x4d9af0){var _0x550269={},_0x535c42={},_0x299890={'count':0x0,'rows':[]};var _0x112f82=_[_0xc93c('0x2a')](db[_0xc93c('0x2b')][_0xc93c('0x2c')],function(_0x13d8eb){return{'name':_0x13d8eb[_0xc93c('0x2d')],'type':_0x13d8eb['type'][_0xc93c('0x2e')]};});_0x535c42[_0xc93c('0x2f')]=_[_0xc93c('0x2a')](_0x112f82,'name');_0x535c42[_0xc93c('0x30')]=_[_0xc93c('0x31')](_0x5671c8[_0xc93c('0x30')]);_0x535c42[_0xc93c('0x32')]=_[_0xc93c('0x33')](_0x535c42['model'],_0x535c42[_0xc93c('0x30')]);_0x550269['attributes']=_[_0xc93c('0x33')](_0x535c42[_0xc93c('0x2f')],qs[_0xc93c('0x34')](_0x5671c8[_0xc93c('0x30')]['fields']));_0x550269[_0xc93c('0x35')]=_0x550269[_0xc93c('0x35')][_0xc93c('0x36')]?_0x550269['attributes']:_0x535c42[_0xc93c('0x2f')];if(!_0x5671c8[_0xc93c('0x30')][_0xc93c('0x37')]('nolimit')){_0x550269[_0xc93c('0x1e')]=qs[_0xc93c('0x1e')](_0x5671c8['query']['limit']);_0x550269[_0xc93c('0x1b')]=qs['offset'](_0x5671c8[_0xc93c('0x30')][_0xc93c('0x1b')]);}_0x550269[_0xc93c('0x38')]=qs[_0xc93c('0x39')](_0x5671c8[_0xc93c('0x30')][_0xc93c('0x39')]);_0x550269[_0xc93c('0x3a')]=qs[_0xc93c('0x32')](_[_0xc93c('0x3b')](_0x5671c8[_0xc93c('0x30')],_0x535c42[_0xc93c('0x32')]),_0x112f82);if(_0x5671c8[_0xc93c('0x30')][_0xc93c('0x3c')]){_0x550269['where']=_[_0xc93c('0x3d')](_0x550269['where'],{'$or':_[_0xc93c('0x2a')](_0x112f82,function(_0x1ec3bf){if(_0x1ec3bf[_0xc93c('0x3e')]!==_0xc93c('0x3f')){var _0x8b59ca={};_0x8b59ca[_0x1ec3bf['name']]={'$like':'%'+_0x5671c8['query']['filter']+'%'};return _0x8b59ca;}})});}_0x550269=_[_0xc93c('0x3d')]({},_0x550269,_0x5671c8[_0xc93c('0x40')]);var _0x3f3fa2={'where':_0x550269[_0xc93c('0x3a')]};return db['ZohoField'][_0xc93c('0x1d')](_0x3f3fa2)[_0xc93c('0x25')](function(_0x5bdcd6){_0x299890[_0xc93c('0x1d')]=_0x5bdcd6;if(_0x5671c8['query']['includeAll']){_0x550269['include']=[{'all':!![]}];}return db[_0xc93c('0x2b')]['findAll'](_0x550269);})['then'](function(_0x58038d){_0x299890[_0xc93c('0x41')]=_0x58038d;return _0x299890;})[_0xc93c('0x25')](respondWithFilteredResult(_0x4d9af0,_0x550269))[_0xc93c('0x42')](handleError(_0x4d9af0,null));};exports[_0xc93c('0x43')]=function(_0x12d016,_0x3c4dd7){var _0x3ff83a={'raw':!![],'where':{'id':_0x12d016['params']['id']}},_0x202649={};_0x202649['model']=_[_0xc93c('0x31')](db[_0xc93c('0x2b')][_0xc93c('0x2c')]);_0x202649[_0xc93c('0x30')]=_[_0xc93c('0x31')](_0x12d016['query']);_0x202649[_0xc93c('0x32')]=_[_0xc93c('0x33')](_0x202649['model'],_0x202649[_0xc93c('0x30')]);_0x3ff83a['attributes']=_[_0xc93c('0x33')](_0x202649[_0xc93c('0x2f')],qs[_0xc93c('0x34')](_0x12d016[_0xc93c('0x30')]['fields']));_0x3ff83a[_0xc93c('0x35')]=_0x3ff83a[_0xc93c('0x35')][_0xc93c('0x36')]?_0x3ff83a[_0xc93c('0x35')]:_0x202649[_0xc93c('0x2f')];if(_0x12d016[_0xc93c('0x30')][_0xc93c('0x44')]){_0x3ff83a['include']=[{'all':!![]}];}_0x3ff83a=_[_0xc93c('0x3d')]({},_0x3ff83a,_0x12d016['options']);return db['ZohoField'][_0xc93c('0x45')](_0x3ff83a)[_0xc93c('0x25')](handleEntityNotFound(_0x3c4dd7,null))[_0xc93c('0x25')](respondWithResult(_0x3c4dd7,null))['catch'](handleError(_0x3c4dd7,null));};exports['create']=function(_0x25bd2a,_0x507cd8){return db['ZohoField'][_0xc93c('0x46')](_0x25bd2a[_0xc93c('0x47')],{})[_0xc93c('0x25')](respondWithResult(_0x507cd8,0xc9))[_0xc93c('0x42')](handleError(_0x507cd8,null));};exports[_0xc93c('0x24')]=function(_0x16aff0,_0x23638b){if(_0x16aff0['body']['id']){delete _0x16aff0[_0xc93c('0x47')]['id'];}return db[_0xc93c('0x2b')][_0xc93c('0x45')]({'where':{'id':_0x16aff0[_0xc93c('0x48')]['id']}})['then'](handleEntityNotFound(_0x23638b,null))[_0xc93c('0x25')](saveUpdates(_0x16aff0[_0xc93c('0x47')],null))[_0xc93c('0x25')](respondWithResult(_0x23638b,null))[_0xc93c('0x42')](handleError(_0x23638b,null));};exports[_0xc93c('0x26')]=function(_0x27a20d,_0x8ce294){return db[_0xc93c('0x2b')][_0xc93c('0x45')]({'where':{'id':_0x27a20d[_0xc93c('0x48')]['id']}})[_0xc93c('0x25')](handleEntityNotFound(_0x8ce294,null))[_0xc93c('0x25')](removeEntity(_0x8ce294,null))[_0xc93c('0x42')](handleError(_0x8ce294,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index b1839fa..f5e9207 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 _0x4975=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','lodash'];(function(_0x1dcd8d,_0x10d1ed){var _0x589dfd=function(_0x3802c1){while(--_0x3802c1){_0x1dcd8d['push'](_0x1dcd8d['shift']());}};_0x589dfd(++_0x10d1ed);}(_0x4975,0x86));var _0x5497=function(_0x452be9,_0xc46e68){_0x452be9=_0x452be9-0x0;var _0x42a7c4=_0x4975[_0x452be9];return _0x42a7c4;};'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':['idField',_0x5497('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1967=['bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','util','../../config/logger','api','moment'];(function(_0x590c2f,_0x423f9b){var _0x299c93=function(_0x850e09){while(--_0x850e09){_0x590c2f['push'](_0x590c2f['shift']());}};_0x299c93(++_0x423f9b);}(_0x1967,0x173));var _0x7196=function(_0x1b9cc2,_0x1f3c7e){_0x1b9cc2=_0x1b9cc2-0x0;var _0x1bcb02=_0x1967[_0x1b9cc2];return _0x1bcb02;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var logger=require(_0x7196('0x1'))(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var BPromise=require(_0x7196('0x4'));var rp=require(_0x7196('0x5'));var fs=require('fs');var path=require(_0x7196('0x6'));var rimraf=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var attributes=require(_0x7196('0x9'));module['exports']=function(_0x36b01e,_0x186175){return _0x36b01e[_0x7196('0xa')](_0x7196('0xb'),attributes,{'tableName':_0x7196('0xc'),'paranoid':![],'indexes':[{'name':_0x7196('0xd'),'fields':['idField',_0x7196('0xe')],'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 b505b35..8d62d8b 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 _0xf1cc=['randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xf1cc,0x147));var _0xcf1c=function(_0x265cbe,_0x14044d){_0x265cbe=_0x265cbe-0x0;var _0x1837da=_0xf1cc[_0x265cbe];return _0x1837da;};'use strict';var _=require('lodash');var util=require(_0xcf1c('0x0'));var moment=require(_0xcf1c('0x1'));var BPromise=require(_0xcf1c('0x2'));var rs=require(_0xcf1c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcf1c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcf1c('0x5'));var config=require(_0xcf1c('0x6'));var jayson=require(_0xcf1c('0x7'));var client=jayson[_0xcf1c('0x8')][_0xcf1c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2529ab,_0x480276,_0x32ce4a){return new BPromise(function(_0x51be32,_0x850d6){return client[_0xcf1c('0xa')](_0x2529ab,_0x32ce4a)[_0xcf1c('0xb')](function(_0x362cc0){logger[_0xcf1c('0xc')](_0xcf1c('0xd'),_0x480276,'request\x20sent');logger[_0xcf1c('0xe')](_0xcf1c('0xf'),_0x480276,_0xcf1c('0x10'),JSON[_0xcf1c('0x11')](_0x362cc0));if(_0x362cc0[_0xcf1c('0x12')]){if(_0x362cc0[_0xcf1c('0x12')][_0xcf1c('0x13')]===0x1f4){logger[_0xcf1c('0x12')](_0xcf1c('0xd'),_0x480276,_0x362cc0['error'][_0xcf1c('0x14')]);return _0x850d6(_0x362cc0[_0xcf1c('0x12')]['message']);}logger['error']('ZohoField,\x20%s,\x20%s',_0x480276,_0x362cc0['error'][_0xcf1c('0x14')]);return _0x51be32(_0x362cc0[_0xcf1c('0x12')][_0xcf1c('0x14')]);}else{logger[_0xcf1c('0xc')](_0xcf1c('0xd'),_0x480276,'request\x20sent');_0x51be32(_0x362cc0[_0xcf1c('0x15')]['message']);}})['catch'](function(_0x3e1f73){logger[_0xcf1c('0x12')](_0xcf1c('0xd'),_0x480276,_0x3e1f73);_0x850d6(_0x3e1f73);});});} \ No newline at end of file +var _0x05cc=['jayson/promise','client','http','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x1adb22,_0x260530){var _0x2ebffc=function(_0x590a80){while(--_0x590a80){_0x1adb22['push'](_0x1adb22['shift']());}};_0x2ebffc(++_0x260530);}(_0x05cc,0x1ed));var _0xc05c=function(_0x23b9f8,_0x39b479){_0x23b9f8=_0x23b9f8-0x0;var _0x323ea5=_0x05cc[_0x23b9f8];return _0x323ea5;};'use strict';var _=require(_0xc05c('0x0'));var util=require(_0xc05c('0x1'));var moment=require(_0xc05c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc05c('0x3'))['db'];var utils=require(_0xc05c('0x4'));var logger=require(_0xc05c('0x5'))('rpc');var config=require(_0xc05c('0x6'));var jayson=require(_0xc05c('0x7'));var client=jayson[_0xc05c('0x8')][_0xc05c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x910b61,_0x1dc262,_0x88a958){return new BPromise(function(_0x32e573,_0x31c309){return client['request'](_0x910b61,_0x88a958)['then'](function(_0x4b9b7b){logger[_0xc05c('0xa')](_0xc05c('0xb'),_0x1dc262,_0xc05c('0xc'));logger[_0xc05c('0xd')](_0xc05c('0xe'),_0x1dc262,_0xc05c('0xc'),JSON[_0xc05c('0xf')](_0x4b9b7b));if(_0x4b9b7b['error']){if(_0x4b9b7b[_0xc05c('0x10')]['code']===0x1f4){logger[_0xc05c('0x10')](_0xc05c('0xb'),_0x1dc262,_0x4b9b7b['error']['message']);return _0x31c309(_0x4b9b7b[_0xc05c('0x10')][_0xc05c('0x11')]);}logger['error']('ZohoField,\x20%s,\x20%s',_0x1dc262,_0x4b9b7b['error'][_0xc05c('0x11')]);return _0x32e573(_0x4b9b7b[_0xc05c('0x10')][_0xc05c('0x11')]);}else{logger[_0xc05c('0xa')](_0xc05c('0xb'),_0x1dc262,_0xc05c('0xc'));_0x32e573(_0x4b9b7b[_0xc05c('0x12')]['message']);}})[_0xc05c('0x13')](function(_0x1d80bb){logger[_0xc05c('0x10')](_0xc05c('0xb'),_0x1dc262,_0x1d80bb);_0x31c309(_0x1d80bb);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 7d5c1ed..2bf0fa7 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4de391,_0x193b01){var _0x25d6f0=function(_0x55f3){while(--_0x55f3){_0x4de391['push'](_0x4de391['shift']());}};_0x25d6f0(++_0x193b01);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2fdf82,_0x322e7c){_0x2fdf82=_0x2fdf82-0x0;var _0x2382f5=_0xcb91[_0x2fdf82];return _0x2382f5;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x11d59d,_0x428b23){var _0xb7d17a=function(_0x6a1e1d){while(--_0x6a1e1d){_0x11d59d['push'](_0x11d59d['shift']());}};_0xb7d17a(++_0x428b23);}(_0x70e0,0x17b));var _0x070e=function(_0x459013,_0x4b08bc){_0x459013=_0x459013-0x0;var _0x3889e4=_0x70e0[_0x459013];return _0x3889e4;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index b750ddb..369887a 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 _0x98ab=['unique_name_and_version','STRING','INTEGER','BOOLEAN','state','exports'];(function(_0x15e3d3,_0x7c233a){var _0x1d17b0=function(_0x3d052d){while(--_0x3d052d){_0x15e3d3['push'](_0x15e3d3['shift']());}};_0x1d17b0(++_0x7c233a);}(_0x98ab,0x16d));var _0xb98a=function(_0x2b8ecb,_0x42ec28){_0x2b8ecb=_0x2b8ecb-0x0;var _0x2090ff=_0x98ab[_0x2b8ecb];return _0x2090ff;};'use strict';var Sequelize=require('sequelize');module[_0xb98a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb98a('0x1')},'version':{'type':Sequelize[_0xb98a('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xb98a('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xb98a('0x2')]},'path':{'type':Sequelize[_0xb98a('0x2')]},'type':{'type':Sequelize[_0xb98a('0x2')]},'size':{'type':Sequelize[_0xb98a('0x3')]},'active':{'type':Sequelize[_0xb98a('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0xb98a('0x2')]},'logo':{'type':Sequelize[_0xb98a('0x2')]},'state':{'type':Sequelize[_0xb98a('0x2')],'unique':_0xb98a('0x5')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0xb98a('0x2')]},'remoteUri':{'type':Sequelize[_0xb98a('0x2')]},'link':{'type':Sequelize[_0xb98a('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xfabf=['sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x102c5f,_0x1cfd18){var _0x478d4a=function(_0x399fe8){while(--_0x399fe8){_0x102c5f['push'](_0x102c5f['shift']());}};_0x478d4a(++_0x1cfd18);}(_0xfabf,0x11a));var _0xffab=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfabf[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xffab('0x0'));module[_0xffab('0x1')]={'name':{'type':Sequelize[_0xffab('0x2')],'allowNull':![],'unique':_0xffab('0x3')},'version':{'type':Sequelize[_0xffab('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xffab('0x2')],'defaultValue':_0xffab('0x4')},'filename':{'type':Sequelize[_0xffab('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xffab('0x2')]},'size':{'type':Sequelize[_0xffab('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0xffab('0x2')]},'logo':{'type':Sequelize[_0xffab('0x2')]},'state':{'type':Sequelize[_0xffab('0x2')],'unique':'state'},'description':{'type':Sequelize[_0xffab('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index cf41fbb..39c780c 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 _0x1261=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','Integration','model','map','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filters','where','type','VIRTUAL','filter','merge','options','findAll','rows','params','include','find','create','catch','body','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'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x1261,0x144));var _0x1126=function(_0x33925b,_0x95cfc6){_0x33925b=_0x33925b-0x0;var _0x375e21=_0x1261[_0x33925b];return _0x375e21;};'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'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x34bcf1,_0x566c09){return function(_0x1b07a7){if(!_0x1b07a7){_0x34bcf1[_0x1126('0x18')](0x194);}return _0x1b07a7;};}function handleError(_0x38119d,_0x589725){_0x589725=_0x589725||0x1f4;return function(_0x35eec3){logger[_0x1126('0x26')](_0x35eec3[_0x1126('0x27')]);if(_0x35eec3['name']){delete _0x35eec3['name'];}_0x38119d[_0x1126('0x19')](_0x589725)[_0x1126('0x28')](_0x35eec3);};}exports['index']=function(_0x2fb797,_0x23d2bc){var _0x4a334a={},_0x3fa694={},_0x4bf807={'count':0x0,'rows':[]};var _0xc62460=_['map'](db[_0x1126('0x29')]['rawAttributes'],function(_0x378f4d){return{'name':_0x378f4d['fieldName'],'type':_0x378f4d['type']['key']};});_0x3fa694[_0x1126('0x2a')]=_[_0x1126('0x2b')](_0xc62460,_0x1126('0x2c'));_0x3fa694['query']=_[_0x1126('0x2d')](_0x2fb797[_0x1126('0x2e')]);_0x3fa694['filters']=_[_0x1126('0x2f')](_0x3fa694[_0x1126('0x2a')],_0x3fa694[_0x1126('0x2e')]);_0x4a334a[_0x1126('0x30')]=_['intersection'](_0x3fa694['model'],qs[_0x1126('0x31')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x31')]));_0x4a334a[_0x1126('0x30')]=_0x4a334a['attributes'][_0x1126('0x32')]?_0x4a334a[_0x1126('0x30')]:_0x3fa694[_0x1126('0x2a')];if(!_0x2fb797[_0x1126('0x2e')][_0x1126('0x33')]('nolimit')){_0x4a334a[_0x1126('0x1e')]=qs[_0x1126('0x1e')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1e')]);_0x4a334a['offset']=qs['offset'](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1c')]);}_0x4a334a['order']=qs[_0x1126('0x34')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x34')]);_0x4a334a['where']=qs['filters'](_[_0x1126('0x35')](_0x2fb797[_0x1126('0x2e')],_0x3fa694[_0x1126('0x36')]),_0xc62460);if(_0x2fb797[_0x1126('0x2e')]['filter']){_0x4a334a[_0x1126('0x37')]=_['merge'](_0x4a334a[_0x1126('0x37')],{'$or':_[_0x1126('0x2b')](_0xc62460,function(_0xfa96e0){if(_0xfa96e0[_0x1126('0x38')]!==_0x1126('0x39')){var _0x5746f6={};_0x5746f6[_0xfa96e0[_0x1126('0x2c')]]={'$like':'%'+_0x2fb797[_0x1126('0x2e')][_0x1126('0x3a')]+'%'};return _0x5746f6;}})});}_0x4a334a=_[_0x1126('0x3b')]({},_0x4a334a,_0x2fb797[_0x1126('0x3c')]);var _0x3442b8={'where':_0x4a334a[_0x1126('0x37')]};return db['Integration'][_0x1126('0x1f')](_0x3442b8)[_0x1126('0x25')](function(_0x227a6b){_0x4bf807[_0x1126('0x1f')]=_0x227a6b;if(_0x2fb797[_0x1126('0x2e')]['includeAll']){_0x4a334a['include']=[{'all':!![]}];}return db[_0x1126('0x29')][_0x1126('0x3d')](_0x4a334a);})[_0x1126('0x25')](function(_0x21c38e){_0x4bf807[_0x1126('0x3e')]=_0x21c38e;return _0x4bf807;})[_0x1126('0x25')](respondWithFilteredResult(_0x23d2bc,_0x4a334a))['catch'](handleError(_0x23d2bc,null));};exports['show']=function(_0x4cb1db,_0xb8054e){var _0x5d4194={'raw':![],'where':{'id':_0x4cb1db[_0x1126('0x3f')]['id']}},_0xf84005={};_0xf84005[_0x1126('0x2a')]=_[_0x1126('0x2d')](db['Integration']['rawAttributes']);_0xf84005[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0x4cb1db[_0x1126('0x2e')]);_0xf84005['filters']=_[_0x1126('0x2f')](_0xf84005['model'],_0xf84005[_0x1126('0x2e')]);_0x5d4194['attributes']=_[_0x1126('0x2f')](_0xf84005[_0x1126('0x2a')],qs[_0x1126('0x31')](_0x4cb1db['query'][_0x1126('0x31')]));_0x5d4194[_0x1126('0x30')]=_0x5d4194[_0x1126('0x30')]['length']?_0x5d4194['attributes']:_0xf84005['model'];if(_0x4cb1db[_0x1126('0x2e')]['includeAll']){_0x5d4194[_0x1126('0x40')]=[{'all':!![]}];}_0x5d4194=_['merge']({},_0x5d4194,_0x4cb1db[_0x1126('0x3c')]);return db[_0x1126('0x29')][_0x1126('0x41')](_0x5d4194)[_0x1126('0x25')](handleEntityNotFound(_0xb8054e,null))[_0x1126('0x25')](respondWithResult(_0xb8054e,null))['catch'](handleError(_0xb8054e,null));};exports[_0x1126('0x42')]=function(_0x512f60,_0x5111d3){return db[_0x1126('0x29')][_0x1126('0x42')](_0x512f60['body'],{})[_0x1126('0x25')](respondWithResult(_0x5111d3,0xc9))[_0x1126('0x43')](handleError(_0x5111d3,null));};exports['update']=function(_0x3e4eeb,_0xbdde58){if(_0x3e4eeb[_0x1126('0x44')]['id']){delete _0x3e4eeb['body']['id'];}return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x3e4eeb[_0x1126('0x3f')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0xbdde58,null))[_0x1126('0x25')](saveUpdates(_0x3e4eeb[_0x1126('0x44')],null))[_0x1126('0x25')](respondWithResult(_0xbdde58,null))[_0x1126('0x43')](handleError(_0xbdde58,null));};exports['destroy']=function(_0x1b8b83,_0x5a2287){return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x1b8b83['params']['id']}})['then'](handleEntityNotFound(_0x5a2287,null))[_0x1126('0x25')](removeEntity(_0x5a2287,null))[_0x1126('0x43')](handleError(_0x5a2287,null));}; \ No newline at end of file +var _0xe2fe=['include','catch','show','find','body','params','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','name','send','index','map','Integration','rawAttributes','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];function respondWithStatusCode(_0x346dbc,_0xa13e7b){_0xa13e7b=_0xa13e7b||0xcc;return function(_0x100449){if(_0x100449){return _0x346dbc[_0xee2f('0x11')](_0xa13e7b);}return _0x346dbc[_0xee2f('0x12')](_0xa13e7b)['end']();};}function respondWithResult(_0x3861e6,_0x531c3a){_0x531c3a=_0x531c3a||0xc8;return function(_0x36db10){if(_0x36db10){return _0x3861e6[_0xee2f('0x12')](_0x531c3a)['json'](_0x36db10);}};}function respondWithFilteredResult(_0x445ba8,_0x145241){return function(_0x28b614){if(_0x28b614){var _0x1bbf7d=typeof _0x145241[_0xee2f('0x13')]==='undefined'&&typeof _0x145241[_0xee2f('0x14')]==='undefined';var _0x17d288=_0x28b614[_0xee2f('0x15')];var _0x502eb6=_0x1bbf7d?0x0:_0x145241['offset'];var _0x40b5bc=_0x1bbf7d?_0x28b614['count']:_0x145241[_0xee2f('0x13')]+_0x145241[_0xee2f('0x14')];var _0x28549d;if(_0x40b5bc>=_0x17d288){_0x40b5bc=_0x17d288;_0x28549d=0xc8;}else{_0x28549d=0xce;}_0x445ba8['status'](_0x28549d);return _0x445ba8[_0xee2f('0x16')](_0xee2f('0x17'),_0x502eb6+'-'+_0x40b5bc+'/'+_0x17d288)[_0xee2f('0x18')](_0x28b614);}return null;};}function patchUpdates(_0x21fdf4){return function(_0x3d892d){try{jsonpatch['apply'](_0x3d892d,_0x21fdf4,!![]);}catch(_0x5e73ad){return BPromise[_0xee2f('0x19')](_0x5e73ad);}return _0x3d892d[_0xee2f('0x1a')]();};}function saveUpdates(_0x1ea808,_0x203b2f){return function(_0x472e3b){if(_0x472e3b){return _0x472e3b[_0xee2f('0x1b')](_0x1ea808)[_0xee2f('0x1c')](function(_0x4d68d3){return _0x4d68d3;});}return null;};}function removeEntity(_0x250399,_0x2c47c5){return function(_0x15ceda){if(_0x15ceda){return _0x15ceda[_0xee2f('0x1d')]()[_0xee2f('0x1c')](function(){_0x250399[_0xee2f('0x12')](0xcc)[_0xee2f('0x1e')]();});}};}function handleEntityNotFound(_0x13013f,_0x382174){return function(_0x1e394f){if(!_0x1e394f){_0x13013f[_0xee2f('0x11')](0x194);}return _0x1e394f;};}function handleError(_0x168adc,_0x1c8454){_0x1c8454=_0x1c8454||0x1f4;return function(_0x45c4a0){logger['error'](_0x45c4a0['stack']);if(_0x45c4a0['name']){delete _0x45c4a0[_0xee2f('0x1f')];}_0x168adc[_0xee2f('0x12')](_0x1c8454)[_0xee2f('0x20')](_0x45c4a0);};}exports[_0xee2f('0x21')]=function(_0x892a4e,_0x3737fd){var _0x4d8398={},_0x3d3806={},_0x52e1fa={'count':0x0,'rows':[]};var _0x235697=_[_0xee2f('0x22')](db[_0xee2f('0x23')][_0xee2f('0x24')],function(_0x3ddbe3){return{'name':_0x3ddbe3['fieldName'],'type':_0x3ddbe3[_0xee2f('0x25')][_0xee2f('0x26')]};});_0x3d3806['model']=_['map'](_0x235697,_0xee2f('0x1f'));_0x3d3806['query']=_[_0xee2f('0x27')](_0x892a4e[_0xee2f('0x28')]);_0x3d3806['filters']=_[_0xee2f('0x29')](_0x3d3806['model'],_0x3d3806['query']);_0x4d8398['attributes']=_[_0xee2f('0x29')](_0x3d3806[_0xee2f('0x2a')],qs['fields'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x2b')]));_0x4d8398[_0xee2f('0x2c')]=_0x4d8398[_0xee2f('0x2c')][_0xee2f('0x2d')]?_0x4d8398['attributes']:_0x3d3806[_0xee2f('0x2a')];if(!_0x892a4e['query'][_0xee2f('0x2e')](_0xee2f('0x2f'))){_0x4d8398[_0xee2f('0x14')]=qs['limit'](_0x892a4e[_0xee2f('0x28')]['limit']);_0x4d8398[_0xee2f('0x13')]=qs['offset'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x13')]);}_0x4d8398[_0xee2f('0x30')]=qs[_0xee2f('0x31')](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x31')]);_0x4d8398[_0xee2f('0x32')]=qs[_0xee2f('0x33')](_[_0xee2f('0x34')](_0x892a4e[_0xee2f('0x28')],_0x3d3806[_0xee2f('0x33')]),_0x235697);if(_0x892a4e['query'][_0xee2f('0x35')]){_0x4d8398['where']=_[_0xee2f('0x36')](_0x4d8398[_0xee2f('0x32')],{'$or':_[_0xee2f('0x22')](_0x235697,function(_0x2cbb89){if(_0x2cbb89[_0xee2f('0x25')]!==_0xee2f('0x37')){var _0x694950={};_0x694950[_0x2cbb89[_0xee2f('0x1f')]]={'$like':'%'+_0x892a4e['query']['filter']+'%'};return _0x694950;}})});}_0x4d8398=_['merge']({},_0x4d8398,_0x892a4e[_0xee2f('0x38')]);var _0x5483ae={'where':_0x4d8398[_0xee2f('0x32')]};return db['Integration']['count'](_0x5483ae)['then'](function(_0x58e361){_0x52e1fa[_0xee2f('0x15')]=_0x58e361;if(_0x892a4e[_0xee2f('0x28')][_0xee2f('0x39')]){_0x4d8398[_0xee2f('0x3a')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x4d8398);})[_0xee2f('0x1c')](function(_0x5e12b7){_0x52e1fa['rows']=_0x5e12b7;return _0x52e1fa;})[_0xee2f('0x1c')](respondWithFilteredResult(_0x3737fd,_0x4d8398))[_0xee2f('0x3b')](handleError(_0x3737fd,null));};exports[_0xee2f('0x3c')]=function(_0x54130b,_0x3bc173){var _0x27c447={'raw':![],'where':{'id':_0x54130b['params']['id']}},_0x19bd4d={};_0x19bd4d['model']=_[_0xee2f('0x27')](db[_0xee2f('0x23')][_0xee2f('0x24')]);_0x19bd4d[_0xee2f('0x28')]=_['keys'](_0x54130b[_0xee2f('0x28')]);_0x19bd4d[_0xee2f('0x33')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],_0x19bd4d[_0xee2f('0x28')]);_0x27c447[_0xee2f('0x2c')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],qs[_0xee2f('0x2b')](_0x54130b[_0xee2f('0x28')]['fields']));_0x27c447['attributes']=_0x27c447['attributes']['length']?_0x27c447[_0xee2f('0x2c')]:_0x19bd4d[_0xee2f('0x2a')];if(_0x54130b[_0xee2f('0x28')][_0xee2f('0x39')]){_0x27c447[_0xee2f('0x3a')]=[{'all':!![]}];}_0x27c447=_['merge']({},_0x27c447,_0x54130b[_0xee2f('0x38')]);return db[_0xee2f('0x23')][_0xee2f('0x3d')](_0x27c447)[_0xee2f('0x1c')](handleEntityNotFound(_0x3bc173,null))['then'](respondWithResult(_0x3bc173,null))['catch'](handleError(_0x3bc173,null));};exports['create']=function(_0x1609f0,_0x54cc44){return db['Integration']['create'](_0x1609f0['body'],{})[_0xee2f('0x1c')](respondWithResult(_0x54cc44,0xc9))[_0xee2f('0x3b')](handleError(_0x54cc44,null));};exports[_0xee2f('0x1b')]=function(_0x584383,_0x22506e){if(_0x584383['body']['id']){delete _0x584383[_0xee2f('0x3e')]['id'];}return db[_0xee2f('0x23')][_0xee2f('0x3d')]({'where':{'id':_0x584383[_0xee2f('0x3f')]['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x22506e,null))['then'](saveUpdates(_0x584383['body'],null))[_0xee2f('0x1c')](respondWithResult(_0x22506e,null))['catch'](handleError(_0x22506e,null));};exports[_0xee2f('0x1d')]=function(_0x282e89,_0x1928f8){return db[_0xee2f('0x23')]['find']({'where':{'id':_0x282e89['params']['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x1928f8,null))[_0xee2f('0x1c')](removeEntity(_0x1928f8,null))[_0xee2f('0x3b')](handleError(_0x1928f8,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 9b8b56b..a1de98a 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 _0x7876=['./integration.attributes','define','Integration','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x32254c,_0x1d4934){var _0x43708f=function(_0x377c72){while(--_0x377c72){_0x32254c['push'](_0x32254c['shift']());}};_0x43708f(++_0x1d4934);}(_0x7876,0x1f2));var _0x6787=function(_0x1d3046,_0x8b14e1){_0x1d3046=_0x1d3046-0x0;var _0x3b9b62=_0x7876[_0x1d3046];return _0x3b9b62;};'use strict';var _=require(_0x6787('0x0'));var util=require('util');var logger=require(_0x6787('0x1'))(_0x6787('0x2'));var moment=require(_0x6787('0x3'));var BPromise=require(_0x6787('0x4'));var rp=require(_0x6787('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6787('0x6'));var config=require(_0x6787('0x7'));var attributes=require(_0x6787('0x8'));module['exports']=function(_0x42ca02,_0x327f7d){return _0x42ca02[_0x6787('0x9')](_0x6787('0xa'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4ec=['path','rimraf','../../config/environment','./integration.attributes','define','Integration','integrations','lodash','moment','bluebird','request-promise'];(function(_0x151b55,_0x3a5852){var _0x1cbc4e=function(_0x141e96){while(--_0x141e96){_0x151b55['push'](_0x151b55['shift']());}};_0x1cbc4e(++_0x3a5852);}(_0xf4ec,0x96));var _0xcf4e=function(_0xd16553,_0x2c400f){_0xd16553=_0xd16553-0x0;var _0x35fdd4=_0xf4ec[_0xd16553];return _0x35fdd4;};'use strict';var _=require(_0xcf4e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xcf4e('0x1'));var BPromise=require(_0xcf4e('0x2'));var rp=require(_0xcf4e('0x3'));var fs=require('fs');var path=require(_0xcf4e('0x4'));var rimraf=require(_0xcf4e('0x5'));var config=require(_0xcf4e('0x6'));var attributes=require(_0xcf4e('0x7'));module['exports']=function(_0x1cdfb2,_0x90447c){return _0x1cdfb2[_0xcf4e('0x8')](_0xcf4e('0x9'),attributes,{'tableName':_0xcf4e('0xa'),'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 e0b836f..918c126 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 _0x57ca=['client','http','request','info','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','error','code','Integration,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0xf11a2e,_0x1f91cb){var _0x3fa8aa=function(_0x1a26a8){while(--_0x1a26a8){_0xf11a2e['push'](_0xf11a2e['shift']());}};_0x3fa8aa(++_0x1f91cb);}(_0x57ca,0x108));var _0xa57c=function(_0x4987b4,_0x2a4ad1){_0x4987b4=_0x4987b4-0x0;var _0x2682f5=_0x57ca[_0x4987b4];return _0x2682f5;};'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')]('Integration,\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')]('Integration,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file +var _0x9f0e=['../../config/environment','jayson/promise','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x1828ee,_0x5db35c){var _0x26b4b8=function(_0x2b9065){while(--_0x2b9065){_0x1828ee['push'](_0x1828ee['shift']());}};_0x26b4b8(++_0x5db35c);}(_0x9f0e,0x116));var _0xe9f0=function(_0x1c581d,_0x2cbe7a){_0x1c581d=_0x1c581d-0x0;var _0x4dc2a0=_0x9f0e[_0x1c581d];return _0x4dc2a0;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var moment=require(_0xe9f0('0x2'));var BPromise=require(_0xe9f0('0x3'));var rs=require(_0xe9f0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe9f0('0x5'));var logger=require(_0xe9f0('0x6'))(_0xe9f0('0x7'));var config=require(_0xe9f0('0x8'));var jayson=require(_0xe9f0('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a17b3,_0x167198,_0xe64a79){return new BPromise(function(_0x4be6a6,_0xf4a256){return client[_0xe9f0('0xa')](_0x3a17b3,_0xe64a79)[_0xe9f0('0xb')](function(_0x3386a8){logger[_0xe9f0('0xc')](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));logger[_0xe9f0('0xf')](_0xe9f0('0x10'),_0x167198,'request\x20sent',JSON[_0xe9f0('0x11')](_0x3386a8));if(_0x3386a8[_0xe9f0('0x12')]){if(_0x3386a8[_0xe9f0('0x12')]['code']===0x1f4){logger[_0xe9f0('0x12')]('Integration,\x20%s,\x20%s',_0x167198,_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);return _0xf4a256(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}logger['error'](_0xe9f0('0xd'),_0x167198,_0x3386a8['error'][_0xe9f0('0x13')]);return _0x4be6a6(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}else{logger['info'](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));_0x4be6a6(_0x3386a8[_0xe9f0('0x14')]['message']);}})[_0xe9f0('0x15')](function(_0x1e16e0){logger[_0xe9f0('0x12')](_0xe9f0('0xd'),_0x167198,_0x1e16e0);_0xf4a256(_0x1e16e0);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 8b2de28..5c97a4b 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 _0x2542=['put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x1955da,_0x3daff1){var _0x217810=function(_0x37edf9){while(--_0x37edf9){_0x1955da['push'](_0x1955da['shift']());}};_0x217810(++_0x3daff1);}(_0x2542,0x169));var _0x2254=function(_0x93eeaf,_0x24f92b){_0x93eeaf=_0x93eeaf-0x0;var _0x3d2a7a=_0x2542[_0x93eeaf];return _0x3d2a7a;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2254('0x5'));var interaction=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var controller=require(_0x2254('0x8'));router[_0x2254('0x9')]('/',auth['isAuthenticated'](),controller[_0x2254('0xa')]);router[_0x2254('0x9')](_0x2254('0xb'),auth[_0x2254('0xc')](),controller[_0x2254('0xd')]);router[_0x2254('0x9')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0xf')]);router[_0x2254('0x10')]('/',auth[_0x2254('0xc')](),controller['create']);router[_0x2254('0x11')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0x12')]);router['delete']('/:id',auth[_0x2254('0xc')](),controller[_0x2254('0x13')]);module[_0x2254('0x14')]=router; \ No newline at end of file +var _0xef0f=['update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x522527,_0xef83ce){var _0x1308a7=function(_0x279dbc){while(--_0x279dbc){_0x522527['push'](_0x522527['shift']());}};_0x1308a7(++_0xef83ce);}(_0xef0f,0x168));var _0xfef0=function(_0x2dae9f,_0x4fe0a7){_0x2dae9f=_0x2dae9f-0x0;var _0xf1501c=_0xef0f[_0x2dae9f];return _0xf1501c;};'use strict';var multer=require(_0xfef0('0x0'));var util=require('util');var path=require(_0xfef0('0x1'));var timeout=require(_0xfef0('0x2'));var express=require(_0xfef0('0x3'));var router=express['Router']();var fs_extra=require(_0xfef0('0x4'));var auth=require(_0xfef0('0x5'));var interaction=require(_0xfef0('0x6'));var config=require('../../config/environment');var controller=require(_0xfef0('0x7'));router[_0xfef0('0x8')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0xa')]);router[_0xfef0('0x8')](_0xfef0('0xb'),auth['isAuthenticated'](),controller[_0xfef0('0xc')]);router['get'](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0xe')]);router[_0xfef0('0xf')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0x10')]);router[_0xfef0('0x11')](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x12')]);router[_0xfef0('0x13')](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x14')]);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 3b1b0ce..910d8d7 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 _0xc512=['SENDING','RECEIVED','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT'];(function(_0x1b4c32,_0x341394){var _0x4da345=function(_0x1ac395){while(--_0x1ac395){_0x1b4c32['push'](_0x1b4c32['shift']());}};_0x4da345(++_0x341394);}(_0xc512,0xf2));var _0x2c51=function(_0x51bf91,_0x5340e0){_0x51bf91=_0x51bf91-0x0;var _0x200627=_0xc512[_0x51bf91];return _0x200627;};'use strict';var Sequelize=require('sequelize');module[_0x2c51('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x2c51('0x1')]},'exitStatus':{'type':Sequelize[_0x2c51('0x1')]},'ticketId':{'type':Sequelize[_0x2c51('0x1')]},'integrationId':{'type':Sequelize[_0x2c51('0x2')]},'contacts':{'type':Sequelize[_0x2c51('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2c51('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x2c51('0x1')]},'membername':{'type':Sequelize[_0x2c51('0x1')]},'agentcalledAt':{'type':Sequelize[_0x2c51('0x3')]},'agentconnectAt':{'type':Sequelize[_0x2c51('0x3')]},'holdtime':{'type':Sequelize[_0x2c51('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x2c51('0x3')]},'talktime':{'type':Sequelize[_0x2c51('0x2')]},'agentacw':{'type':Sequelize[_0x2c51('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2c51('0x2')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x2c51('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x2c51('0x3')]},'lastevent':{'type':Sequelize[_0x2c51('0x1')]},'channel':{'type':Sequelize[_0x2c51('0x1')]},'channelstate':{'type':Sequelize[_0x2c51('0x2')]},'channelstatedesc':{'type':Sequelize[_0x2c51('0x1')]},'connectedlinenum':{'type':Sequelize[_0x2c51('0x1')]},'connectedlinename':{'type':Sequelize[_0x2c51('0x1')]},'language':{'type':Sequelize[_0x2c51('0x1')]},'accountcode':{'type':Sequelize[_0x2c51('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x2c51('0x1')]},'priority':{'type':Sequelize[_0x2c51('0x1')]},'destchannel':{'type':Sequelize[_0x2c51('0x1')]},'destchannelstate':{'type':Sequelize[_0x2c51('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x2c51('0x1')]},'destcalleridname':{'type':Sequelize[_0x2c51('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x2c51('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x2c51('0x1')]},'destlanguage':{'type':Sequelize[_0x2c51('0x1')]},'destaccountcode':{'type':Sequelize[_0x2c51('0x1')]},'destcontext':{'type':Sequelize[_0x2c51('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x2c51('0x1')]},'destuniqueid':{'type':Sequelize[_0x2c51('0x1')]},'messageId':{'type':Sequelize[_0x2c51('0x1')]},'inReplyTo':{'type':Sequelize[_0x2c51('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x2c51('0x1')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x2c51('0x5')]},'html':{'type':Sequelize[_0x2c51('0x5')]},'text':{'type':Sequelize[_0x2c51('0x5')]},'status':{'type':Sequelize[_0x2c51('0x6')](_0x2c51('0x7'),_0x2c51('0x8'),_0x2c51('0x9'),'FAILED')},'url':{'type':Sequelize[_0x2c51('0x1')]},'app':{'type':Sequelize[_0x2c51('0x1')]},'appdata':{'type':Sequelize[_0x2c51('0x1')]},'projectId':{'type':Sequelize[_0x2c51('0x2')]}}; \ No newline at end of file +var _0x9bb3=['BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x354d04,_0x2b4aa3){var _0x51eb0b=function(_0x92623){while(--_0x92623){_0x354d04['push'](_0x354d04['shift']());}};_0x51eb0b(++_0x2b4aa3);}(_0x9bb3,0xdf));var _0x39bb=function(_0x1e7922,_0x25b332){_0x1e7922=_0x1e7922-0x0;var _0x2f179d=_0x9bb3[_0x1e7922];return _0x2f179d;};'use strict';var Sequelize=require(_0x39bb('0x0'));module[_0x39bb('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x39bb('0x2')]},'exitStatus':{'type':Sequelize[_0x39bb('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x39bb('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x39bb('0x2')]},'calleridnum':{'type':Sequelize[_0x39bb('0x2')]},'calleridname':{'type':Sequelize[_0x39bb('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x39bb('0x2')]},'agentcalledAt':{'type':Sequelize[_0x39bb('0x4')]},'agentconnectAt':{'type':Sequelize[_0x39bb('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x39bb('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x39bb('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x39bb('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x39bb('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x39bb('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x39bb('0x4')]},'agentdump':{'type':Sequelize[_0x39bb('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x39bb('0x4')]},'lastevent':{'type':Sequelize[_0x39bb('0x2')]},'channel':{'type':Sequelize[_0x39bb('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x39bb('0x2')]},'connectedlinenum':{'type':Sequelize[_0x39bb('0x2')]},'connectedlinename':{'type':Sequelize[_0x39bb('0x2')]},'language':{'type':Sequelize[_0x39bb('0x2')]},'accountcode':{'type':Sequelize[_0x39bb('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x39bb('0x2')]},'priority':{'type':Sequelize[_0x39bb('0x2')]},'destchannel':{'type':Sequelize[_0x39bb('0x2')]},'destchannelstate':{'type':Sequelize[_0x39bb('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x39bb('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x39bb('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x39bb('0x2')]},'destlanguage':{'type':Sequelize[_0x39bb('0x2')]},'destaccountcode':{'type':Sequelize[_0x39bb('0x2')]},'destcontext':{'type':Sequelize[_0x39bb('0x2')]},'destexten':{'type':Sequelize[_0x39bb('0x2')]},'destpriority':{'type':Sequelize[_0x39bb('0x2')]},'destuniqueid':{'type':Sequelize[_0x39bb('0x2')]},'messageId':{'type':Sequelize[_0x39bb('0x2')]},'inReplyTo':{'type':Sequelize[_0x39bb('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x39bb('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x39bb('0x6')]},'html':{'type':Sequelize[_0x39bb('0x6')]},'text':{'type':Sequelize[_0x39bb('0x6')]},'status':{'type':Sequelize[_0x39bb('0x7')](_0x39bb('0x8'),_0x39bb('0x9'),_0x39bb('0xa'),_0x39bb('0xb'))},'url':{'type':Sequelize[_0x39bb('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x39bb('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index c6c0831..be67d2a 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 _0xcc29=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','destroy','then','end','sendStatus','stack','name','send','index','IntegrationReport','rawAttributes','fieldName','type','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','length','options','find','create','body','catch','describe','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x3a19b0,_0x2847a3){var _0x5add50=function(_0x245efd){while(--_0x245efd){_0x3a19b0['push'](_0x3a19b0['shift']());}};_0x5add50(++_0x2847a3);}(_0xcc29,0x1ae));var _0x9cc2=function(_0x1fc80b,_0x98bfe9){_0x1fc80b=_0x1fc80b-0x0;var _0x28da77=_0xcc29[_0x1fc80b];return _0x28da77;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9cc2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9cc2('0x1'));var rp=require(_0x9cc2('0x2'));var moment=require('moment');var BPromise=require(_0x9cc2('0x3'));var Mustache=require(_0x9cc2('0x4'));var util=require(_0x9cc2('0x5'));var path=require(_0x9cc2('0x6'));var sox=require('sox');var csv=require(_0x9cc2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9cc2('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9cc2('0x9'));var jsforce=require(_0x9cc2('0xa'));var deskjs=require(_0x9cc2('0xb'));var toCsv=require(_0x9cc2('0x7'));var querystring=require(_0x9cc2('0xc'));var Papa=require(_0x9cc2('0xd'));var Redis=require(_0x9cc2('0xe'));var authService=require(_0x9cc2('0xf'));var qs=require(_0x9cc2('0x10'));var as=require(_0x9cc2('0x11'));var hardwareService=require(_0x9cc2('0x12'));var logger=require(_0x9cc2('0x13'))(_0x9cc2('0x14'));var utils=require('../../config/utils');var config=require(_0x9cc2('0x15'));var licenseUtil=require(_0x9cc2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x533e62,_0x45ad01){_0x45ad01=_0x45ad01||0xcc;return function(_0x2322c1){if(_0x2322c1){return _0x533e62['sendStatus'](_0x45ad01);}return _0x533e62[_0x9cc2('0x17')](_0x45ad01)['end']();};}function respondWithResult(_0x4a6e19,_0xe5bf33){_0xe5bf33=_0xe5bf33||0xc8;return function(_0x5a40bc){if(_0x5a40bc){return _0x4a6e19[_0x9cc2('0x17')](_0xe5bf33)[_0x9cc2('0x18')](_0x5a40bc);}};}function respondWithFilteredResult(_0x43d532,_0x5a6b8f){return function(_0x452b1c){if(_0x452b1c){var _0x305d03=typeof _0x5a6b8f[_0x9cc2('0x19')]==='undefined'&&typeof _0x5a6b8f[_0x9cc2('0x1a')]===_0x9cc2('0x1b');var _0x383715=_0x452b1c[_0x9cc2('0x1c')];var _0x5ea378=_0x305d03?0x0:_0x5a6b8f[_0x9cc2('0x19')];var _0x44f87f=_0x305d03?_0x452b1c[_0x9cc2('0x1c')]:_0x5a6b8f[_0x9cc2('0x19')]+_0x5a6b8f[_0x9cc2('0x1a')];var _0x503b24;if(_0x44f87f>=_0x383715){_0x44f87f=_0x383715;_0x503b24=0xc8;}else{_0x503b24=0xce;}_0x43d532[_0x9cc2('0x17')](_0x503b24);return _0x43d532[_0x9cc2('0x1d')](_0x9cc2('0x1e'),_0x5ea378+'-'+_0x44f87f+'/'+_0x383715)[_0x9cc2('0x18')](_0x452b1c);}return null;};}function patchUpdates(_0x52a1bb){return function(_0x4598cf){try{jsonpatch['apply'](_0x4598cf,_0x52a1bb,!![]);}catch(_0x56b0f9){return BPromise[_0x9cc2('0x1f')](_0x56b0f9);}return _0x4598cf[_0x9cc2('0x20')]();};}function saveUpdates(_0x3407d0,_0x2e29e9){return function(_0x59fc4e){if(_0x59fc4e){return _0x59fc4e['update'](_0x3407d0)['then'](function(_0x11d683){return _0x11d683;});}return null;};}function removeEntity(_0x26349d,_0x47dec8){return function(_0x176ce1){if(_0x176ce1){return _0x176ce1[_0x9cc2('0x21')]()[_0x9cc2('0x22')](function(){_0x26349d['status'](0xcc)[_0x9cc2('0x23')]();});}};}function handleEntityNotFound(_0x2b3578,_0x47ac15){return function(_0x2b99a3){if(!_0x2b99a3){_0x2b3578[_0x9cc2('0x24')](0x194);}return _0x2b99a3;};}function handleError(_0x2d6a82,_0x29ac45){_0x29ac45=_0x29ac45||0x1f4;return function(_0x1a6b84){logger['error'](_0x1a6b84[_0x9cc2('0x25')]);if(_0x1a6b84[_0x9cc2('0x26')]){delete _0x1a6b84['name'];}_0x2d6a82[_0x9cc2('0x17')](_0x29ac45)[_0x9cc2('0x27')](_0x1a6b84);};}exports[_0x9cc2('0x28')]=function(_0x2849a8,_0x135d3f){var _0x8eeb27={},_0x3fa4c2={},_0x44bbab={'count':0x0,'rows':[]};var _0x27389c=_['map'](db[_0x9cc2('0x29')][_0x9cc2('0x2a')],function(_0x49ec86){return{'name':_0x49ec86[_0x9cc2('0x2b')],'type':_0x49ec86[_0x9cc2('0x2c')]['key']};});_0x3fa4c2[_0x9cc2('0x2d')]=_[_0x9cc2('0x2e')](_0x27389c,'name');_0x3fa4c2['query']=_[_0x9cc2('0x2f')](_0x2849a8[_0x9cc2('0x30')]);_0x3fa4c2['filters']=_[_0x9cc2('0x31')](_0x3fa4c2['model'],_0x3fa4c2['query']);_0x8eeb27[_0x9cc2('0x32')]=_[_0x9cc2('0x31')](_0x3fa4c2[_0x9cc2('0x2d')],qs[_0x9cc2('0x33')](_0x2849a8[_0x9cc2('0x30')][_0x9cc2('0x33')]));_0x8eeb27[_0x9cc2('0x32')]=_0x8eeb27[_0x9cc2('0x32')]['length']?_0x8eeb27['attributes']:_0x3fa4c2['model'];if(!_0x2849a8[_0x9cc2('0x30')][_0x9cc2('0x34')](_0x9cc2('0x35'))){_0x8eeb27[_0x9cc2('0x1a')]=qs[_0x9cc2('0x1a')](_0x2849a8['query'][_0x9cc2('0x1a')]);_0x8eeb27[_0x9cc2('0x19')]=qs[_0x9cc2('0x19')](_0x2849a8['query']['offset']);}_0x8eeb27['order']=qs['sort'](_0x2849a8[_0x9cc2('0x30')][_0x9cc2('0x36')]);_0x8eeb27[_0x9cc2('0x37')]=qs[_0x9cc2('0x38')](_[_0x9cc2('0x39')](_0x2849a8[_0x9cc2('0x30')],_0x3fa4c2[_0x9cc2('0x38')]),_0x27389c);if(_0x2849a8['query'][_0x9cc2('0x3a')]){_0x8eeb27['where']=_[_0x9cc2('0x3b')](_0x8eeb27[_0x9cc2('0x37')],{'$or':_[_0x9cc2('0x2e')](_0x27389c,function(_0x2259e5){if(_0x2259e5[_0x9cc2('0x2c')]!==_0x9cc2('0x3c')){var _0x4877f4={};_0x4877f4[_0x2259e5[_0x9cc2('0x26')]]={'$like':'%'+_0x2849a8[_0x9cc2('0x30')][_0x9cc2('0x3a')]+'%'};return _0x4877f4;}})});}_0x8eeb27=_[_0x9cc2('0x3b')]({},_0x8eeb27,_0x2849a8['options']);var _0x4c4bfa={'where':_0x8eeb27['where']};return db[_0x9cc2('0x29')][_0x9cc2('0x1c')](_0x4c4bfa)[_0x9cc2('0x22')](function(_0x27c056){_0x44bbab[_0x9cc2('0x1c')]=_0x27c056;if(_0x2849a8[_0x9cc2('0x30')][_0x9cc2('0x3d')]){_0x8eeb27[_0x9cc2('0x3e')]=[{'all':!![]}];}return db['IntegrationReport'][_0x9cc2('0x3f')](_0x8eeb27);})[_0x9cc2('0x22')](function(_0x376205){_0x44bbab[_0x9cc2('0x40')]=_0x376205;return _0x44bbab;})[_0x9cc2('0x22')](respondWithFilteredResult(_0x135d3f,_0x8eeb27))['catch'](handleError(_0x135d3f,null));};exports[_0x9cc2('0x41')]=function(_0x4755a3,_0x1f7a2e){var _0x39d417={'raw':![],'where':{'id':_0x4755a3[_0x9cc2('0x42')]['id']}},_0x392b79={};_0x392b79['model']=_[_0x9cc2('0x2f')](db[_0x9cc2('0x29')][_0x9cc2('0x2a')]);_0x392b79[_0x9cc2('0x30')]=_[_0x9cc2('0x2f')](_0x4755a3['query']);_0x392b79[_0x9cc2('0x38')]=_[_0x9cc2('0x31')](_0x392b79[_0x9cc2('0x2d')],_0x392b79[_0x9cc2('0x30')]);_0x39d417[_0x9cc2('0x32')]=_[_0x9cc2('0x31')](_0x392b79[_0x9cc2('0x2d')],qs['fields'](_0x4755a3[_0x9cc2('0x30')][_0x9cc2('0x33')]));_0x39d417[_0x9cc2('0x32')]=_0x39d417[_0x9cc2('0x32')][_0x9cc2('0x43')]?_0x39d417[_0x9cc2('0x32')]:_0x392b79[_0x9cc2('0x2d')];if(_0x4755a3[_0x9cc2('0x30')][_0x9cc2('0x3d')]){_0x39d417['include']=[{'all':!![]}];}_0x39d417=_[_0x9cc2('0x3b')]({},_0x39d417,_0x4755a3[_0x9cc2('0x44')]);return db['IntegrationReport'][_0x9cc2('0x45')](_0x39d417)[_0x9cc2('0x22')](handleEntityNotFound(_0x1f7a2e,null))['then'](respondWithResult(_0x1f7a2e,null))['catch'](handleError(_0x1f7a2e,null));};exports[_0x9cc2('0x46')]=function(_0x86a0f5,_0x32cf11){return db['IntegrationReport']['create'](_0x86a0f5[_0x9cc2('0x47')],{})[_0x9cc2('0x22')](respondWithResult(_0x32cf11,0xc9))['catch'](handleError(_0x32cf11,null));};exports['update']=function(_0x357c26,_0xe79112){if(_0x357c26[_0x9cc2('0x47')]['id']){delete _0x357c26[_0x9cc2('0x47')]['id'];}return db[_0x9cc2('0x29')][_0x9cc2('0x45')]({'where':{'id':_0x357c26['params']['id']}})['then'](handleEntityNotFound(_0xe79112,null))[_0x9cc2('0x22')](saveUpdates(_0x357c26['body'],null))[_0x9cc2('0x22')](respondWithResult(_0xe79112,null))[_0x9cc2('0x48')](handleError(_0xe79112,null));};exports['destroy']=function(_0x2d82d8,_0x257a2a){return db[_0x9cc2('0x29')][_0x9cc2('0x45')]({'where':{'id':_0x2d82d8['params']['id']}})[_0x9cc2('0x22')](handleEntityNotFound(_0x257a2a,null))[_0x9cc2('0x22')](removeEntity(_0x257a2a,null))['catch'](handleError(_0x257a2a,null));};exports[_0x9cc2('0x49')]=function(_0x5cb50e,_0xd6e33b){return db[_0x9cc2('0x29')][_0x9cc2('0x49')]()[_0x9cc2('0x22')](respondWithResult(_0xd6e33b,null))['catch'](handleError(_0xd6e33b,null));}; \ No newline at end of file +var _0xe892=['json','offset','undefined','count','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','keys','filters','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x1f147b,_0x4c2999){var _0x2090d7=function(_0x52d4e4){while(--_0x52d4e4){_0x1f147b['push'](_0x1f147b['shift']());}};_0x2090d7(++_0x4c2999);}(_0xe892,0x7b));var _0x2e89=function(_0x5137c3,_0x417b56){_0x5137c3=_0x5137c3-0x0;var _0x2ce8c9=_0xe892[_0x5137c3];return _0x2ce8c9;};'use strict';var emlformat=require(_0x2e89('0x0'));var rimraf=require(_0x2e89('0x1'));var zipdir=require(_0x2e89('0x2'));var jsonpatch=require(_0x2e89('0x3'));var rp=require(_0x2e89('0x4'));var moment=require(_0x2e89('0x5'));var BPromise=require(_0x2e89('0x6'));var Mustache=require('mustache');var util=require(_0x2e89('0x7'));var path=require(_0x2e89('0x8'));var sox=require(_0x2e89('0x9'));var csv=require('to-csv');var ejs=require(_0x2e89('0xa'));var fs=require('fs');var fs_extra=require(_0x2e89('0xb'));var _=require(_0x2e89('0xc'));var squel=require(_0x2e89('0xd'));var crypto=require(_0x2e89('0xe'));var jsforce=require(_0x2e89('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2e89('0x10'));var querystring=require(_0x2e89('0x11'));var Papa=require(_0x2e89('0x12'));var Redis=require(_0x2e89('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2e89('0x14'));var hardwareService=require(_0x2e89('0x15'));var logger=require(_0x2e89('0x16'))(_0x2e89('0x17'));var utils=require(_0x2e89('0x18'));var config=require(_0x2e89('0x19'));var licenseUtil=require(_0x2e89('0x1a'));var db=require(_0x2e89('0x1b'))['db'];function respondWithStatusCode(_0x14a594,_0x398cb7){_0x398cb7=_0x398cb7||0xcc;return function(_0x1ff3d2){if(_0x1ff3d2){return _0x14a594['sendStatus'](_0x398cb7);}return _0x14a594[_0x2e89('0x1c')](_0x398cb7)['end']();};}function respondWithResult(_0x1a5190,_0x11cba2){_0x11cba2=_0x11cba2||0xc8;return function(_0x355b44){if(_0x355b44){return _0x1a5190[_0x2e89('0x1c')](_0x11cba2)[_0x2e89('0x1d')](_0x355b44);}};}function respondWithFilteredResult(_0x203974,_0x56e645){return function(_0x172299){if(_0x172299){var _0x1a1615=typeof _0x56e645[_0x2e89('0x1e')]==='undefined'&&typeof _0x56e645['limit']===_0x2e89('0x1f');var _0xb2289f=_0x172299[_0x2e89('0x20')];var _0x4dbd80=_0x1a1615?0x0:_0x56e645['offset'];var _0x4818d7=_0x1a1615?_0x172299['count']:_0x56e645[_0x2e89('0x1e')]+_0x56e645['limit'];var _0x27c97c;if(_0x4818d7>=_0xb2289f){_0x4818d7=_0xb2289f;_0x27c97c=0xc8;}else{_0x27c97c=0xce;}_0x203974[_0x2e89('0x1c')](_0x27c97c);return _0x203974['set'](_0x2e89('0x21'),_0x4dbd80+'-'+_0x4818d7+'/'+_0xb2289f)['json'](_0x172299);}return null;};}function patchUpdates(_0x337627){return function(_0x34c0e0){try{jsonpatch['apply'](_0x34c0e0,_0x337627,!![]);}catch(_0x54dcfd){return BPromise[_0x2e89('0x22')](_0x54dcfd);}return _0x34c0e0['save']();};}function saveUpdates(_0x351948,_0x19d181){return function(_0x31ff87){if(_0x31ff87){return _0x31ff87[_0x2e89('0x23')](_0x351948)[_0x2e89('0x24')](function(_0x506fb8){return _0x506fb8;});}return null;};}function removeEntity(_0x2a399e,_0x21c985){return function(_0x2cb71c){if(_0x2cb71c){return _0x2cb71c[_0x2e89('0x25')]()[_0x2e89('0x24')](function(){_0x2a399e[_0x2e89('0x1c')](0xcc)[_0x2e89('0x26')]();});}};}function handleEntityNotFound(_0x52a3fa,_0x338079){return function(_0x3520a6){if(!_0x3520a6){_0x52a3fa['sendStatus'](0x194);}return _0x3520a6;};}function handleError(_0x3d85ad,_0x350189){_0x350189=_0x350189||0x1f4;return function(_0x214b4e){logger[_0x2e89('0x27')](_0x214b4e[_0x2e89('0x28')]);if(_0x214b4e[_0x2e89('0x29')]){delete _0x214b4e[_0x2e89('0x29')];}_0x3d85ad[_0x2e89('0x1c')](_0x350189)[_0x2e89('0x2a')](_0x214b4e);};}exports[_0x2e89('0x2b')]=function(_0x375a84,_0x3344ff){var _0xdf05a7={},_0x26a341={},_0x24ba8f={'count':0x0,'rows':[]};var _0x564f83=_[_0x2e89('0x2c')](db[_0x2e89('0x2d')][_0x2e89('0x2e')],function(_0x53ecbd){return{'name':_0x53ecbd[_0x2e89('0x2f')],'type':_0x53ecbd[_0x2e89('0x30')]['key']};});_0x26a341[_0x2e89('0x31')]=_['map'](_0x564f83,_0x2e89('0x29'));_0x26a341[_0x2e89('0x32')]=_['keys'](_0x375a84[_0x2e89('0x32')]);_0x26a341['filters']=_[_0x2e89('0x33')](_0x26a341[_0x2e89('0x31')],_0x26a341[_0x2e89('0x32')]);_0xdf05a7[_0x2e89('0x34')]=_[_0x2e89('0x33')](_0x26a341[_0x2e89('0x31')],qs[_0x2e89('0x35')](_0x375a84['query'][_0x2e89('0x35')]));_0xdf05a7['attributes']=_0xdf05a7['attributes'][_0x2e89('0x36')]?_0xdf05a7[_0x2e89('0x34')]:_0x26a341['model'];if(!_0x375a84[_0x2e89('0x32')]['hasOwnProperty'](_0x2e89('0x37'))){_0xdf05a7['limit']=qs[_0x2e89('0x38')](_0x375a84['query'][_0x2e89('0x38')]);_0xdf05a7[_0x2e89('0x1e')]=qs['offset'](_0x375a84[_0x2e89('0x32')][_0x2e89('0x1e')]);}_0xdf05a7[_0x2e89('0x39')]=qs[_0x2e89('0x3a')](_0x375a84[_0x2e89('0x32')][_0x2e89('0x3a')]);_0xdf05a7[_0x2e89('0x3b')]=qs['filters'](_[_0x2e89('0x3c')](_0x375a84[_0x2e89('0x32')],_0x26a341['filters']),_0x564f83);if(_0x375a84[_0x2e89('0x32')][_0x2e89('0x3d')]){_0xdf05a7[_0x2e89('0x3b')]=_[_0x2e89('0x3e')](_0xdf05a7['where'],{'$or':_[_0x2e89('0x2c')](_0x564f83,function(_0xfc4a5c){if(_0xfc4a5c[_0x2e89('0x30')]!=='VIRTUAL'){var _0x1fe2ab={};_0x1fe2ab[_0xfc4a5c[_0x2e89('0x29')]]={'$like':'%'+_0x375a84[_0x2e89('0x32')][_0x2e89('0x3d')]+'%'};return _0x1fe2ab;}})});}_0xdf05a7=_[_0x2e89('0x3e')]({},_0xdf05a7,_0x375a84['options']);var _0xd21759={'where':_0xdf05a7[_0x2e89('0x3b')]};return db[_0x2e89('0x2d')][_0x2e89('0x20')](_0xd21759)[_0x2e89('0x24')](function(_0x24c8b4){_0x24ba8f[_0x2e89('0x20')]=_0x24c8b4;if(_0x375a84[_0x2e89('0x32')][_0x2e89('0x3f')]){_0xdf05a7[_0x2e89('0x40')]=[{'all':!![]}];}return db[_0x2e89('0x2d')][_0x2e89('0x41')](_0xdf05a7);})[_0x2e89('0x24')](function(_0x4ed788){_0x24ba8f[_0x2e89('0x42')]=_0x4ed788;return _0x24ba8f;})[_0x2e89('0x24')](respondWithFilteredResult(_0x3344ff,_0xdf05a7))[_0x2e89('0x43')](handleError(_0x3344ff,null));};exports[_0x2e89('0x44')]=function(_0xe7b084,_0x4c93aa){var _0x40e248={'raw':![],'where':{'id':_0xe7b084['params']['id']}},_0x46a5cf={};_0x46a5cf[_0x2e89('0x31')]=_[_0x2e89('0x45')](db[_0x2e89('0x2d')][_0x2e89('0x2e')]);_0x46a5cf[_0x2e89('0x32')]=_[_0x2e89('0x45')](_0xe7b084['query']);_0x46a5cf[_0x2e89('0x46')]=_[_0x2e89('0x33')](_0x46a5cf[_0x2e89('0x31')],_0x46a5cf[_0x2e89('0x32')]);_0x40e248[_0x2e89('0x34')]=_['intersection'](_0x46a5cf[_0x2e89('0x31')],qs[_0x2e89('0x35')](_0xe7b084[_0x2e89('0x32')][_0x2e89('0x35')]));_0x40e248['attributes']=_0x40e248['attributes'][_0x2e89('0x36')]?_0x40e248[_0x2e89('0x34')]:_0x46a5cf['model'];if(_0xe7b084['query'][_0x2e89('0x3f')]){_0x40e248[_0x2e89('0x40')]=[{'all':!![]}];}_0x40e248=_[_0x2e89('0x3e')]({},_0x40e248,_0xe7b084['options']);return db['IntegrationReport'][_0x2e89('0x47')](_0x40e248)[_0x2e89('0x24')](handleEntityNotFound(_0x4c93aa,null))[_0x2e89('0x24')](respondWithResult(_0x4c93aa,null))[_0x2e89('0x43')](handleError(_0x4c93aa,null));};exports[_0x2e89('0x48')]=function(_0x42315d,_0x32cc6d){return db[_0x2e89('0x2d')][_0x2e89('0x48')](_0x42315d[_0x2e89('0x49')],{})[_0x2e89('0x24')](respondWithResult(_0x32cc6d,0xc9))[_0x2e89('0x43')](handleError(_0x32cc6d,null));};exports['update']=function(_0x3445d5,_0x5da081){if(_0x3445d5[_0x2e89('0x49')]['id']){delete _0x3445d5['body']['id'];}return db[_0x2e89('0x2d')][_0x2e89('0x47')]({'where':{'id':_0x3445d5[_0x2e89('0x4a')]['id']}})[_0x2e89('0x24')](handleEntityNotFound(_0x5da081,null))[_0x2e89('0x24')](saveUpdates(_0x3445d5[_0x2e89('0x49')],null))[_0x2e89('0x24')](respondWithResult(_0x5da081,null))[_0x2e89('0x43')](handleError(_0x5da081,null));};exports[_0x2e89('0x25')]=function(_0xc4b10a,_0x1731a2){return db['IntegrationReport'][_0x2e89('0x47')]({'where':{'id':_0xc4b10a['params']['id']}})[_0x2e89('0x24')](handleEntityNotFound(_0x1731a2,null))[_0x2e89('0x24')](removeEntity(_0x1731a2,null))[_0x2e89('0x43')](handleError(_0x1731a2,null));};exports[_0x2e89('0x4b')]=function(_0x46694d,_0x3eb376){return db[_0x2e89('0x2d')]['describe']()['then'](respondWithResult(_0x3eb376,null))[_0x2e89('0x43')](handleError(_0x3eb376,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 7782ee7..96ad0f1 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 _0xfb8c=['request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','util','../../config/logger','api','moment','bluebird'];(function(_0xea9af8,_0x277842){var _0x19ff0b=function(_0x27675a){while(--_0x27675a){_0xea9af8['push'](_0xea9af8['shift']());}};_0x19ff0b(++_0x277842);}(_0xfb8c,0x18e));var _0xcfb8=function(_0x552f93,_0x5a47ce){_0x552f93=_0x552f93-0x0;var _0x1bbbbb=_0xfb8c[_0x552f93];return _0x1bbbbb;};'use strict';var _=require('lodash');var util=require(_0xcfb8('0x0'));var logger=require(_0xcfb8('0x1'))(_0xcfb8('0x2'));var moment=require(_0xcfb8('0x3'));var BPromise=require(_0xcfb8('0x4'));var rp=require(_0xcfb8('0x5'));var fs=require('fs');var path=require(_0xcfb8('0x6'));var rimraf=require(_0xcfb8('0x7'));var config=require(_0xcfb8('0x8'));var attributes=require(_0xcfb8('0x9'));module[_0xcfb8('0xa')]=function(_0x578979,_0x12c8a2){return _0x578979[_0xcfb8('0xb')](_0xcfb8('0xc'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff34=['rimraf','../../config/environment','exports','define','IntegrationReport','report_integration','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xf35672,_0x3833af){var _0x26afcf=function(_0x17132a){while(--_0x17132a){_0xf35672['push'](_0xf35672['shift']());}};_0x26afcf(++_0x3833af);}(_0xff34,0x16e));var _0x4ff3=function(_0x3d4488,_0x1b2b82){_0x3d4488=_0x3d4488-0x0;var _0x4a0548=_0xff34[_0x3d4488];return _0x4a0548;};'use strict';var _=require('lodash');var util=require(_0x4ff3('0x0'));var logger=require(_0x4ff3('0x1'))(_0x4ff3('0x2'));var moment=require(_0x4ff3('0x3'));var BPromise=require(_0x4ff3('0x4'));var rp=require(_0x4ff3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4ff3('0x6'));var config=require(_0x4ff3('0x7'));var attributes=require('./integrationReport.attributes');module[_0x4ff3('0x8')]=function(_0x73a534,_0x417589){return _0x73a534[_0x4ff3('0x9')](_0x4ff3('0xa'),attributes,{'tableName':_0x4ff3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index e848818..6cc0300 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 _0x2542=['info','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x328856,_0x2b5499){var _0x184ffb=function(_0x349fe1){while(--_0x349fe1){_0x328856['push'](_0x328856['shift']());}};_0x184ffb(++_0x2b5499);}(_0x2542,0x169));var _0x2254=function(_0x4a7bf8,_0x56bfe3){_0x4a7bf8=_0x4a7bf8-0x0;var _0x150de7=_0x2542[_0x4a7bf8];return _0x150de7;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file +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(_0x2ffe26,_0x599a50){var _0x111551=function(_0x4799f0){while(--_0x4799f0){_0x2ffe26['push'](_0x2ffe26['shift']());}};_0x111551(++_0x599a50);}(_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 diff --git a/server/api/interval/index.js b/server/api/interval/index.js index fb3c4c2..64737ed 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 _0x7580=['isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','addIntervals','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','./interval.controller','index','get','/:id'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x7580,0x14b));var _0x0758=function(_0x34b9d0,_0x18ea7f){_0x34b9d0=_0x34b9d0-0x0;var _0x9a8cca=_0x7580[_0x34b9d0];return _0x9a8cca;};'use strict';var multer=require('multer');var util=require(_0x0758('0x0'));var path=require('path');var timeout=require(_0x0758('0x1'));var express=require('express');var router=express[_0x0758('0x2')]();var fs_extra=require(_0x0758('0x3'));var auth=require(_0x0758('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0758('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x0758('0x6')]);router[_0x0758('0x7')](_0x0758('0x8'),auth[_0x0758('0x9')](),controller[_0x0758('0xa')]);router[_0x0758('0x7')](_0x0758('0xb'),auth[_0x0758('0x9')](),controller[_0x0758('0xc')]);router[_0x0758('0xd')]('/',auth[_0x0758('0x9')](),controller[_0x0758('0xe')]);router['post'](_0x0758('0xb'),auth[_0x0758('0x9')](),controller['addInterval']);router[_0x0758('0xd')]('/:id/sub_intervals/create_many',auth[_0x0758('0x9')](),controller[_0x0758('0xf')]);router['put'](_0x0758('0x8'),auth['isAuthenticated'](),controller[_0x0758('0x10')]);router[_0x0758('0x11')]('/:id',auth[_0x0758('0x9')](),controller[_0x0758('0x12')]);module[_0x0758('0x13')]=router; \ No newline at end of file +var _0xcd0d=['get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','create','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','delete','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','./interval.controller'];(function(_0x41816c,_0xfa953e){var _0x20c319=function(_0x5d22c9){while(--_0x5d22c9){_0x41816c['push'](_0x41816c['shift']());}};_0x20c319(++_0xfa953e);}(_0xcd0d,0x10a));var _0xdcd0=function(_0x57eebd,_0x561057){_0x57eebd=_0x57eebd-0x0;var _0x343a79=_0xcd0d[_0x57eebd];return _0x343a79;};'use strict';var multer=require(_0xdcd0('0x0'));var util=require(_0xdcd0('0x1'));var path=require(_0xdcd0('0x2'));var timeout=require(_0xdcd0('0x3'));var express=require(_0xdcd0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdcd0('0x5'));var config=require('../../config/environment');var controller=require(_0xdcd0('0x6'));router[_0xdcd0('0x7')]('/',auth[_0xdcd0('0x8')](),controller[_0xdcd0('0x9')]);router[_0xdcd0('0x7')](_0xdcd0('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0xdcd0('0xb'),auth[_0xdcd0('0x8')](),controller[_0xdcd0('0xc')]);router['post']('/',auth[_0xdcd0('0x8')](),controller[_0xdcd0('0xd')]);router[_0xdcd0('0xe')](_0xdcd0('0xb'),auth[_0xdcd0('0x8')](),controller[_0xdcd0('0xf')]);router[_0xdcd0('0xe')](_0xdcd0('0x10'),auth['isAuthenticated'](),controller[_0xdcd0('0x11')]);router[_0xdcd0('0x12')](_0xdcd0('0xa'),auth[_0xdcd0('0x8')](),controller['update']);router[_0xdcd0('0x13')]('/:id',auth[_0xdcd0('0x8')](),controller['destroy']);module[_0xdcd0('0x14')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index ac2a9f9..0469af3 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 _0xb9b0=['STRING','exports'];(function(_0xddb4af,_0x408696){var _0x52ada4=function(_0x31e664){while(--_0x31e664){_0xddb4af['push'](_0xddb4af['shift']());}};_0x52ada4(++_0x408696);}(_0xb9b0,0x67));var _0x0b9b=function(_0x3ed18c,_0x1f8340){_0x3ed18c=_0x3ed18c-0x0;var _0x4d635f=_0xb9b0[_0x3ed18c];return _0x4d635f;};'use strict';var Sequelize=require('sequelize');module[_0x0b9b('0x0')]={'name':{'type':Sequelize[_0x0b9b('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xf095=['STRING','sequelize','exports'];(function(_0x1e3ab7,_0x488c5e){var _0x52be95=function(_0x294fac){while(--_0x294fac){_0x1e3ab7['push'](_0x1e3ab7['shift']());}};_0x52be95(++_0x488c5e);}(_0xf095,0x148));var _0x5f09=function(_0x2b0875,_0x21ff12){_0x2b0875=_0x2b0875-0x0;var _0xedb8d7=_0xf095[_0x2b0875];return _0xedb8d7;};'use strict';var Sequelize=require(_0x5f09('0x0'));module[_0x5f09('0x1')]={'name':{'type':Sequelize[_0x5f09('0x2')]},'description':{'type':Sequelize[_0x5f09('0x2')]},'interval':{'type':Sequelize[_0x5f09('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 246394a..7b586be 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 _0xa2e5=['reject','update','then','UserProfileResource','destroy','sendStatus','error','name','send','map','Interval','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','create','body','user','get','Intervals','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','addIntervals','findOne','sequelize','transaction','bulkCreate','eml-format','zip-dir','request-promise','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','end','status','json','offset','limit','undefined','count','set','Content-Range'];(function(_0x13acc2,_0x26c6b9){var _0x5e4feb=function(_0x1f91a3){while(--_0x1f91a3){_0x13acc2['push'](_0x13acc2['shift']());}};_0x5e4feb(++_0x26c6b9);}(_0xa2e5,0xee));var _0x5a2e=function(_0x18bb54,_0x568517){_0x18bb54=_0x18bb54-0x0;var _0x58acaf=_0xa2e5[_0x18bb54];return _0x58acaf;};'use strict';var emlformat=require(_0x5a2e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5a2e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5a2e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5a2e('0x3'));var util=require(_0x5a2e('0x4'));var path=require(_0x5a2e('0x5'));var sox=require(_0x5a2e('0x6'));var csv=require(_0x5a2e('0x7'));var ejs=require(_0x5a2e('0x8'));var fs=require('fs');var fs_extra=require(_0x5a2e('0x9'));var _=require(_0x5a2e('0xa'));var squel=require('squel');var crypto=require(_0x5a2e('0xb'));var jsforce=require(_0x5a2e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5a2e('0xd'));var Papa=require(_0x5a2e('0xe'));var Redis=require(_0x5a2e('0xf'));var authService=require(_0x5a2e('0x10'));var qs=require(_0x5a2e('0x11'));var as=require(_0x5a2e('0x12'));var hardwareService=require(_0x5a2e('0x13'));var logger=require('../../config/logger')(_0x5a2e('0x14'));var utils=require(_0x5a2e('0x15'));var config=require(_0x5a2e('0x16'));var licenseUtil=require(_0x5a2e('0x17'));var db=require(_0x5a2e('0x18'))['db'];var extensions=require(_0x5a2e('0x19'));function respondWithStatusCode(_0x2bb840,_0x3e3a37){_0x3e3a37=_0x3e3a37||0xcc;return function(_0x5ee3d1){if(_0x5ee3d1){return _0x2bb840['sendStatus'](_0x3e3a37);}return _0x2bb840['status'](_0x3e3a37)[_0x5a2e('0x1a')]();};}function respondWithResult(_0xaa69a1,_0x1fb24b){_0x1fb24b=_0x1fb24b||0xc8;return function(_0x1b345e){if(_0x1b345e){return _0xaa69a1[_0x5a2e('0x1b')](_0x1fb24b)[_0x5a2e('0x1c')](_0x1b345e);}};}function respondWithFilteredResult(_0x5e4225,_0x245895){return function(_0xd91427){if(_0xd91427){var _0x50a3e4=typeof _0x245895[_0x5a2e('0x1d')]==='undefined'&&typeof _0x245895[_0x5a2e('0x1e')]===_0x5a2e('0x1f');var _0x551702=_0xd91427[_0x5a2e('0x20')];var _0x343fa5=_0x50a3e4?0x0:_0x245895[_0x5a2e('0x1d')];var _0x33ab4f=_0x50a3e4?_0xd91427[_0x5a2e('0x20')]:_0x245895[_0x5a2e('0x1d')]+_0x245895[_0x5a2e('0x1e')];var _0x401907;if(_0x33ab4f>=_0x551702){_0x33ab4f=_0x551702;_0x401907=0xc8;}else{_0x401907=0xce;}_0x5e4225[_0x5a2e('0x1b')](_0x401907);return _0x5e4225[_0x5a2e('0x21')](_0x5a2e('0x22'),_0x343fa5+'-'+_0x33ab4f+'/'+_0x551702)['json'](_0xd91427);}return null;};}function patchUpdates(_0x58503c){return function(_0x38e11){try{jsonpatch['apply'](_0x38e11,_0x58503c,!![]);}catch(_0x48e460){return BPromise[_0x5a2e('0x23')](_0x48e460);}return _0x38e11['save']();};}function saveUpdates(_0x1e1f36,_0x33b021){return function(_0x4ca4d2){if(_0x4ca4d2){return _0x4ca4d2[_0x5a2e('0x24')](_0x1e1f36)[_0x5a2e('0x25')](function(_0x444261){return _0x444261;});}return null;};}function removeEntity(_0x2cf0df,_0x24b608){return function(_0x254308){if(_0x254308){return _0x254308['destroy']()[_0x5a2e('0x25')](function(){var _0x333242=_0x254308['get']({'plain':!![]});var _0x446a84='Intervals';return db[_0x5a2e('0x26')][_0x5a2e('0x27')]({'where':{'type':_0x446a84,'resourceId':_0x333242['id']}})[_0x5a2e('0x25')](function(){return _0x254308;});})[_0x5a2e('0x25')](function(){_0x2cf0df['status'](0xcc)[_0x5a2e('0x1a')]();});}};}function handleEntityNotFound(_0x3a75cc,_0x30aadf){return function(_0xadd0dc){if(!_0xadd0dc){_0x3a75cc[_0x5a2e('0x28')](0x194);}return _0xadd0dc;};}function handleError(_0x238e22,_0x41ce15){_0x41ce15=_0x41ce15||0x1f4;return function(_0x540188){logger[_0x5a2e('0x29')](_0x540188['stack']);if(_0x540188[_0x5a2e('0x2a')]){delete _0x540188[_0x5a2e('0x2a')];}_0x238e22['status'](_0x41ce15)[_0x5a2e('0x2b')](_0x540188);};}exports['index']=function(_0x3485a0,_0x1c8ee6){var _0x242413={},_0x350066={},_0x531824={'count':0x0,'rows':[]};var _0x464425=_[_0x5a2e('0x2c')](db[_0x5a2e('0x2d')][_0x5a2e('0x2e')],function(_0x1db78d){return{'name':_0x1db78d[_0x5a2e('0x2f')],'type':_0x1db78d[_0x5a2e('0x30')][_0x5a2e('0x31')]};});_0x350066['model']=_[_0x5a2e('0x2c')](_0x464425,_0x5a2e('0x2a'));_0x350066[_0x5a2e('0x32')]=_[_0x5a2e('0x33')](_0x3485a0['query']);_0x350066[_0x5a2e('0x34')]=_[_0x5a2e('0x35')](_0x350066[_0x5a2e('0x36')],_0x350066[_0x5a2e('0x32')]);_0x242413[_0x5a2e('0x37')]=_[_0x5a2e('0x35')](_0x350066['model'],qs[_0x5a2e('0x38')](_0x3485a0[_0x5a2e('0x32')][_0x5a2e('0x38')]));_0x242413[_0x5a2e('0x37')]=_0x242413[_0x5a2e('0x37')][_0x5a2e('0x39')]?_0x242413['attributes']:_0x350066['model'];if(!_0x3485a0[_0x5a2e('0x32')][_0x5a2e('0x3a')](_0x5a2e('0x3b'))){_0x242413[_0x5a2e('0x1e')]=qs['limit'](_0x3485a0[_0x5a2e('0x32')]['limit']);_0x242413[_0x5a2e('0x1d')]=qs['offset'](_0x3485a0['query']['offset']);}_0x242413[_0x5a2e('0x3c')]=qs['sort'](_0x3485a0[_0x5a2e('0x32')][_0x5a2e('0x3d')]);_0x242413['where']=qs[_0x5a2e('0x34')](_[_0x5a2e('0x3e')](_0x3485a0[_0x5a2e('0x32')],_0x350066[_0x5a2e('0x34')]),_0x464425);if(_0x3485a0[_0x5a2e('0x32')][_0x5a2e('0x3f')]){_0x242413[_0x5a2e('0x40')]=_[_0x5a2e('0x41')](_0x242413[_0x5a2e('0x40')],{'$or':_[_0x5a2e('0x2c')](_0x464425,function(_0x24cdad){if(_0x24cdad[_0x5a2e('0x30')]!==_0x5a2e('0x42')){var _0x39f2a6={};_0x39f2a6[_0x24cdad[_0x5a2e('0x2a')]]={'$like':'%'+_0x3485a0[_0x5a2e('0x32')][_0x5a2e('0x3f')]+'%'};return _0x39f2a6;}})});}_0x242413=_[_0x5a2e('0x41')]({},_0x242413,_0x3485a0['options']);var _0xb61ae7={'where':_0x242413[_0x5a2e('0x40')]};return db[_0x5a2e('0x2d')][_0x5a2e('0x20')](_0xb61ae7)[_0x5a2e('0x25')](function(_0x5a7e3b){_0x531824[_0x5a2e('0x20')]=_0x5a7e3b;if(_0x3485a0[_0x5a2e('0x32')][_0x5a2e('0x43')]){_0x242413[_0x5a2e('0x44')]=[{'all':!![]}];}return db['Interval'][_0x5a2e('0x45')](_0x242413);})[_0x5a2e('0x25')](function(_0x14e298){_0x531824[_0x5a2e('0x46')]=_0x14e298;return _0x531824;})['then'](respondWithFilteredResult(_0x1c8ee6,_0x242413))[_0x5a2e('0x47')](handleError(_0x1c8ee6,null));};exports['show']=function(_0x4c972b,_0x5a48dd){var _0x21a08b={'raw':!![],'where':{'id':_0x4c972b[_0x5a2e('0x48')]['id']}},_0x3e1e87={};_0x3e1e87[_0x5a2e('0x36')]=_['keys'](db['Interval']['rawAttributes']);_0x3e1e87[_0x5a2e('0x32')]=_[_0x5a2e('0x33')](_0x4c972b[_0x5a2e('0x32')]);_0x3e1e87[_0x5a2e('0x34')]=_['intersection'](_0x3e1e87[_0x5a2e('0x36')],_0x3e1e87[_0x5a2e('0x32')]);_0x21a08b[_0x5a2e('0x37')]=_[_0x5a2e('0x35')](_0x3e1e87[_0x5a2e('0x36')],qs[_0x5a2e('0x38')](_0x4c972b['query'][_0x5a2e('0x38')]));_0x21a08b[_0x5a2e('0x37')]=_0x21a08b['attributes']['length']?_0x21a08b['attributes']:_0x3e1e87[_0x5a2e('0x36')];if(_0x4c972b[_0x5a2e('0x32')][_0x5a2e('0x43')]){_0x21a08b[_0x5a2e('0x44')]=[{'all':!![]}];}_0x21a08b=_[_0x5a2e('0x41')]({},_0x21a08b,_0x4c972b[_0x5a2e('0x49')]);return db[_0x5a2e('0x2d')][_0x5a2e('0x4a')](_0x21a08b)[_0x5a2e('0x25')](handleEntityNotFound(_0x5a48dd,null))[_0x5a2e('0x25')](respondWithResult(_0x5a48dd,null))[_0x5a2e('0x47')](handleError(_0x5a48dd,null));};exports[_0x5a2e('0x4b')]=function(_0x34158b,_0x168855){return db[_0x5a2e('0x2d')][_0x5a2e('0x4b')](_0x34158b[_0x5a2e('0x4c')],{})[_0x5a2e('0x25')](function(_0xf3a95e){var _0x4bb077=_0x34158b[_0x5a2e('0x4d')][_0x5a2e('0x4e')]({'plain':!![]});if(!_0x4bb077)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4bb077['role']===_0x5a2e('0x4d')){var _0x3a8230=_0xf3a95e['get']({'plain':!![]});var _0x1df463=_0x5a2e('0x4f');return db[_0x5a2e('0x50')][_0x5a2e('0x4a')]({'where':{'name':_0x1df463,'userProfileId':_0x4bb077['userProfileId']},'raw':!![]})[_0x5a2e('0x25')](function(_0x33dcd3){if(_0x33dcd3&&_0x33dcd3[_0x5a2e('0x51')]===0x0){return db[_0x5a2e('0x26')][_0x5a2e('0x4b')]({'name':_0x3a8230[_0x5a2e('0x2a')],'resourceId':_0x3a8230['id'],'type':_0x33dcd3['name'],'sectionId':_0x33dcd3['id']},{})[_0x5a2e('0x25')](function(){return _0xf3a95e;});}else{return _0xf3a95e;}})[_0x5a2e('0x47')](function(_0x470968){logger['error'](_0x5a2e('0x52'),_0x470968);throw _0x470968;});}return _0xf3a95e;})[_0x5a2e('0x25')](respondWithResult(_0x168855,0xc9))['catch'](handleError(_0x168855,null));};exports[_0x5a2e('0x24')]=function(_0x308bb6,_0x170b51){if(_0x308bb6[_0x5a2e('0x4c')]['id']){delete _0x308bb6['body']['id'];}return db[_0x5a2e('0x2d')][_0x5a2e('0x4a')]({'where':{'id':_0x308bb6[_0x5a2e('0x48')]['id']}})[_0x5a2e('0x25')](handleEntityNotFound(_0x170b51,null))[_0x5a2e('0x25')](saveUpdates(_0x308bb6[_0x5a2e('0x4c')],null))[_0x5a2e('0x25')](respondWithResult(_0x170b51,null))[_0x5a2e('0x47')](handleError(_0x170b51,null));};exports[_0x5a2e('0x27')]=function(_0x445bdf,_0x182b70){return db[_0x5a2e('0x2d')]['find']({'where':{'id':_0x445bdf['params']['id']}})[_0x5a2e('0x25')](handleEntityNotFound(_0x182b70,null))['then'](removeEntity(_0x182b70,null))[_0x5a2e('0x47')](handleError(_0x182b70,null));};exports[_0x5a2e('0x53')]=function(_0x2a0799,_0x142248,_0x1f0478){if(_0x2a0799[_0x5a2e('0x4c')]['id']){delete _0x2a0799['body']['id'];}return db[_0x5a2e('0x2d')][_0x5a2e('0x4a')]({'where':{'id':_0x2a0799[_0x5a2e('0x48')]['id']}})[_0x5a2e('0x25')](handleEntityNotFound(_0x142248,null))[_0x5a2e('0x25')](function(_0x39217a){if(_0x39217a){_0x2a0799[_0x5a2e('0x4c')][_0x5a2e('0x54')]=_0x39217a['id'];return db[_0x5a2e('0x2d')][_0x5a2e('0x4b')](_0x2a0799[_0x5a2e('0x4c')]);}})['then'](respondWithResult(_0x142248,null))['catch'](handleError(_0x142248,null));};exports[_0x5a2e('0x55')]=function(_0x511e13,_0x5eba1f,_0x3663dd){var _0x192e36={};var _0x3b40b3={};var _0x270bb0;var _0x5bc2ee;return db[_0x5a2e('0x2d')]['findOne']({'where':{'id':_0x511e13[_0x5a2e('0x48')]['id']}})[_0x5a2e('0x25')](handleEntityNotFound(_0x5eba1f,null))[_0x5a2e('0x25')](function(_0x145678){if(_0x145678){_0x270bb0=_0x145678;_0x3b40b3[_0x5a2e('0x36')]=_[_0x5a2e('0x33')](db[_0x5a2e('0x2d')][_0x5a2e('0x2e')]);_0x3b40b3[_0x5a2e('0x32')]=_[_0x5a2e('0x33')](_0x511e13['query']);_0x3b40b3[_0x5a2e('0x34')]=_[_0x5a2e('0x35')](_0x3b40b3[_0x5a2e('0x36')],_0x3b40b3[_0x5a2e('0x32')]);_0x192e36[_0x5a2e('0x37')]=_[_0x5a2e('0x35')](_0x3b40b3['model'],qs[_0x5a2e('0x38')](_0x511e13[_0x5a2e('0x32')]['fields']));_0x192e36[_0x5a2e('0x37')]=_0x192e36[_0x5a2e('0x37')][_0x5a2e('0x39')]?_0x192e36['attributes']:_0x3b40b3['model'];_0x192e36['order']=qs[_0x5a2e('0x3d')](_0x511e13[_0x5a2e('0x32')][_0x5a2e('0x3d')]);_0x192e36[_0x5a2e('0x40')]=qs[_0x5a2e('0x34')](_[_0x5a2e('0x3e')](_0x511e13['query'],_0x3b40b3['filters']));if(_0x511e13['query'][_0x5a2e('0x3f')]){_0x192e36[_0x5a2e('0x40')]=_[_0x5a2e('0x41')](_0x192e36[_0x5a2e('0x40')],{'$or':_[_0x5a2e('0x2c')](_0x192e36[_0x5a2e('0x37')],function(_0x5d8413){var _0x389bde={};_0x389bde[_0x5d8413]={'$like':'%'+_0x511e13[_0x5a2e('0x32')][_0x5a2e('0x3f')]+'%'};return _0x389bde;})});}_0x192e36=_[_0x5a2e('0x41')]({},_0x192e36,_0x511e13['options']);return _0x270bb0[_0x5a2e('0x55')](_0x192e36);}})['then'](function(_0x209dc1){if(_0x209dc1){_0x5bc2ee=_0x209dc1['length'];if(!_0x511e13['query'][_0x5a2e('0x3a')]('nolimit')){_0x192e36[_0x5a2e('0x1e')]=qs['limit'](_0x511e13[_0x5a2e('0x32')][_0x5a2e('0x1e')]);_0x192e36[_0x5a2e('0x1d')]=qs[_0x5a2e('0x1d')](_0x511e13['query'][_0x5a2e('0x1d')]);}return _0x270bb0[_0x5a2e('0x55')](_0x192e36);}})[_0x5a2e('0x25')](function(_0x49cbcf){if(_0x49cbcf){return _0x49cbcf?{'count':_0x5bc2ee,'rows':_0x49cbcf}:null;}})[_0x5a2e('0x25')](respondWithResult(_0x5eba1f,null))[_0x5a2e('0x47')](handleError(_0x5eba1f,null));};exports[_0x5a2e('0x56')]=function(_0x80155,_0x5ddd66,_0x1acb7d){return db['Interval'][_0x5a2e('0x57')]({'where':{'id':_0x80155[_0x5a2e('0x48')]['id']}})[_0x5a2e('0x25')](handleEntityNotFound(_0x5ddd66,null))[_0x5a2e('0x25')](function(_0x54071b){if(_0x54071b){return db[_0x5a2e('0x58')][_0x5a2e('0x59')](function(_0x4b3f30){return db[_0x5a2e('0x2d')][_0x5a2e('0x27')]({'where':{'IntervalId':_0x80155[_0x5a2e('0x48')]['id']},'transaction':_0x4b3f30})[_0x5a2e('0x25')](function(_0x555b99){var _0x39f7a8=_[_0x5a2e('0x2c')](_0x80155['body'],function(_0x1ee5c3){delete _0x1ee5c3['id'];_0x1ee5c3[_0x5a2e('0x54')]=_0x80155[_0x5a2e('0x48')]['id'];return _0x1ee5c3;});return db['Interval'][_0x5a2e('0x5a')](_0x39f7a8,{'transaction':_0x4b3f30});});})[_0x5a2e('0x25')](function(){return db[_0x5a2e('0x2d')][_0x5a2e('0x45')]({'where':{'IntervalId':_0x80155[_0x5a2e('0x48')]['id']}});});}})['then'](respondWithResult(_0x5ddd66,null))[_0x5a2e('0x47')](handleError(_0x5ddd66,null));}; \ No newline at end of file +var _0xd39b=['apply','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','nolimit','addIntervals','transaction','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','end','json','undefined','limit','count','offset','set','Content-Range'];(function(_0x470bfb,_0x389787){var _0x2f5d97=function(_0x3431b4){while(--_0x3431b4){_0x470bfb['push'](_0x470bfb['shift']());}};_0x2f5d97(++_0x389787);}(_0xd39b,0x8a));var _0xbd39=function(_0x230076,_0x4ec21f){_0x230076=_0x230076-0x0;var _0x46ff80=_0xd39b[_0x230076];return _0x46ff80;};'use strict';var emlformat=require(_0xbd39('0x0'));var rimraf=require(_0xbd39('0x1'));var zipdir=require(_0xbd39('0x2'));var jsonpatch=require(_0xbd39('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbd39('0x4'));var Mustache=require(_0xbd39('0x5'));var util=require(_0xbd39('0x6'));var path=require('path');var sox=require(_0xbd39('0x7'));var csv=require(_0xbd39('0x8'));var ejs=require(_0xbd39('0x9'));var fs=require('fs');var fs_extra=require(_0xbd39('0xa'));var _=require('lodash');var squel=require(_0xbd39('0xb'));var crypto=require(_0xbd39('0xc'));var jsforce=require(_0xbd39('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbd39('0x8'));var querystring=require(_0xbd39('0xe'));var Papa=require('papaparse');var Redis=require(_0xbd39('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xbd39('0x10'));var as=require(_0xbd39('0x11'));var hardwareService=require(_0xbd39('0x12'));var logger=require('../../config/logger')(_0xbd39('0x13'));var utils=require(_0xbd39('0x14'));var config=require(_0xbd39('0x15'));var licenseUtil=require(_0xbd39('0x16'));var db=require(_0xbd39('0x17'))['db'];var extensions=require(_0xbd39('0x18'));function respondWithStatusCode(_0x11bcb3,_0xa60a2d){_0xa60a2d=_0xa60a2d||0xcc;return function(_0x328b20){if(_0x328b20){return _0x11bcb3['sendStatus'](_0xa60a2d);}return _0x11bcb3[_0xbd39('0x19')](_0xa60a2d)[_0xbd39('0x1a')]();};}function respondWithResult(_0x380e73,_0xface5d){_0xface5d=_0xface5d||0xc8;return function(_0x1fcafa){if(_0x1fcafa){return _0x380e73[_0xbd39('0x19')](_0xface5d)[_0xbd39('0x1b')](_0x1fcafa);}};}function respondWithFilteredResult(_0x3ce9e0,_0x1c11cd){return function(_0x91d834){if(_0x91d834){var _0x1518fb=typeof _0x1c11cd['offset']===_0xbd39('0x1c')&&typeof _0x1c11cd[_0xbd39('0x1d')]==='undefined';var _0x3a644b=_0x91d834[_0xbd39('0x1e')];var _0x4d9d32=_0x1518fb?0x0:_0x1c11cd[_0xbd39('0x1f')];var _0x12f5fc=_0x1518fb?_0x91d834[_0xbd39('0x1e')]:_0x1c11cd[_0xbd39('0x1f')]+_0x1c11cd[_0xbd39('0x1d')];var _0x48d608;if(_0x12f5fc>=_0x3a644b){_0x12f5fc=_0x3a644b;_0x48d608=0xc8;}else{_0x48d608=0xce;}_0x3ce9e0[_0xbd39('0x19')](_0x48d608);return _0x3ce9e0[_0xbd39('0x20')](_0xbd39('0x21'),_0x4d9d32+'-'+_0x12f5fc+'/'+_0x3a644b)[_0xbd39('0x1b')](_0x91d834);}return null;};}function patchUpdates(_0x39a6f3){return function(_0x3ddd90){try{jsonpatch[_0xbd39('0x22')](_0x3ddd90,_0x39a6f3,!![]);}catch(_0x2275a3){return BPromise['reject'](_0x2275a3);}return _0x3ddd90[_0xbd39('0x23')]();};}function saveUpdates(_0x53a181,_0x13b506){return function(_0x393954){if(_0x393954){return _0x393954[_0xbd39('0x24')](_0x53a181)[_0xbd39('0x25')](function(_0x4f493e){return _0x4f493e;});}return null;};}function removeEntity(_0x128df3,_0x1d32b4){return function(_0x238026){if(_0x238026){return _0x238026[_0xbd39('0x26')]()[_0xbd39('0x25')](function(){var _0x32607f=_0x238026['get']({'plain':!![]});var _0x1de180='Intervals';return db[_0xbd39('0x27')][_0xbd39('0x26')]({'where':{'type':_0x1de180,'resourceId':_0x32607f['id']}})[_0xbd39('0x25')](function(){return _0x238026;});})['then'](function(){_0x128df3['status'](0xcc)[_0xbd39('0x1a')]();});}};}function handleEntityNotFound(_0x1a4252,_0x285cf4){return function(_0xe0b71e){if(!_0xe0b71e){_0x1a4252['sendStatus'](0x194);}return _0xe0b71e;};}function handleError(_0x4c9a10,_0x40724d){_0x40724d=_0x40724d||0x1f4;return function(_0x4ecd8a){logger[_0xbd39('0x28')](_0x4ecd8a[_0xbd39('0x29')]);if(_0x4ecd8a[_0xbd39('0x2a')]){delete _0x4ecd8a[_0xbd39('0x2a')];}_0x4c9a10[_0xbd39('0x19')](_0x40724d)[_0xbd39('0x2b')](_0x4ecd8a);};}exports[_0xbd39('0x2c')]=function(_0x3a4323,_0x234f7c){var _0xb2a644={},_0x45782d={},_0x331782={'count':0x0,'rows':[]};var _0x3ff7d7=_[_0xbd39('0x2d')](db[_0xbd39('0x2e')][_0xbd39('0x2f')],function(_0x24089f){return{'name':_0x24089f[_0xbd39('0x30')],'type':_0x24089f[_0xbd39('0x31')]['key']};});_0x45782d['model']=_[_0xbd39('0x2d')](_0x3ff7d7,_0xbd39('0x2a'));_0x45782d[_0xbd39('0x32')]=_[_0xbd39('0x33')](_0x3a4323[_0xbd39('0x32')]);_0x45782d[_0xbd39('0x34')]=_[_0xbd39('0x35')](_0x45782d['model'],_0x45782d[_0xbd39('0x32')]);_0xb2a644[_0xbd39('0x36')]=_[_0xbd39('0x35')](_0x45782d[_0xbd39('0x37')],qs['fields'](_0x3a4323[_0xbd39('0x32')][_0xbd39('0x38')]));_0xb2a644[_0xbd39('0x36')]=_0xb2a644[_0xbd39('0x36')][_0xbd39('0x39')]?_0xb2a644['attributes']:_0x45782d[_0xbd39('0x37')];if(!_0x3a4323[_0xbd39('0x32')][_0xbd39('0x3a')]('nolimit')){_0xb2a644[_0xbd39('0x1d')]=qs[_0xbd39('0x1d')](_0x3a4323[_0xbd39('0x32')][_0xbd39('0x1d')]);_0xb2a644[_0xbd39('0x1f')]=qs['offset'](_0x3a4323[_0xbd39('0x32')]['offset']);}_0xb2a644[_0xbd39('0x3b')]=qs[_0xbd39('0x3c')](_0x3a4323[_0xbd39('0x32')][_0xbd39('0x3c')]);_0xb2a644[_0xbd39('0x3d')]=qs['filters'](_[_0xbd39('0x3e')](_0x3a4323['query'],_0x45782d['filters']),_0x3ff7d7);if(_0x3a4323['query'][_0xbd39('0x3f')]){_0xb2a644[_0xbd39('0x3d')]=_[_0xbd39('0x40')](_0xb2a644['where'],{'$or':_[_0xbd39('0x2d')](_0x3ff7d7,function(_0x1d5afd){if(_0x1d5afd[_0xbd39('0x31')]!==_0xbd39('0x41')){var _0xd14915={};_0xd14915[_0x1d5afd[_0xbd39('0x2a')]]={'$like':'%'+_0x3a4323['query'][_0xbd39('0x3f')]+'%'};return _0xd14915;}})});}_0xb2a644=_[_0xbd39('0x40')]({},_0xb2a644,_0x3a4323[_0xbd39('0x42')]);var _0x462840={'where':_0xb2a644[_0xbd39('0x3d')]};return db[_0xbd39('0x2e')][_0xbd39('0x1e')](_0x462840)[_0xbd39('0x25')](function(_0x5b7b1b){_0x331782[_0xbd39('0x1e')]=_0x5b7b1b;if(_0x3a4323[_0xbd39('0x32')][_0xbd39('0x43')]){_0xb2a644[_0xbd39('0x44')]=[{'all':!![]}];}return db['Interval']['findAll'](_0xb2a644);})[_0xbd39('0x25')](function(_0x2e79a2){_0x331782[_0xbd39('0x45')]=_0x2e79a2;return _0x331782;})[_0xbd39('0x25')](respondWithFilteredResult(_0x234f7c,_0xb2a644))[_0xbd39('0x46')](handleError(_0x234f7c,null));};exports[_0xbd39('0x47')]=function(_0x29005e,_0x49e271){var _0x31958b={'raw':!![],'where':{'id':_0x29005e[_0xbd39('0x48')]['id']}},_0x1bc044={};_0x1bc044[_0xbd39('0x37')]=_[_0xbd39('0x33')](db[_0xbd39('0x2e')][_0xbd39('0x2f')]);_0x1bc044[_0xbd39('0x32')]=_[_0xbd39('0x33')](_0x29005e[_0xbd39('0x32')]);_0x1bc044['filters']=_[_0xbd39('0x35')](_0x1bc044['model'],_0x1bc044[_0xbd39('0x32')]);_0x31958b[_0xbd39('0x36')]=_[_0xbd39('0x35')](_0x1bc044['model'],qs[_0xbd39('0x38')](_0x29005e['query'][_0xbd39('0x38')]));_0x31958b[_0xbd39('0x36')]=_0x31958b[_0xbd39('0x36')][_0xbd39('0x39')]?_0x31958b[_0xbd39('0x36')]:_0x1bc044[_0xbd39('0x37')];if(_0x29005e[_0xbd39('0x32')][_0xbd39('0x43')]){_0x31958b[_0xbd39('0x44')]=[{'all':!![]}];}_0x31958b=_['merge']({},_0x31958b,_0x29005e['options']);return db[_0xbd39('0x2e')][_0xbd39('0x49')](_0x31958b)[_0xbd39('0x25')](handleEntityNotFound(_0x49e271,null))[_0xbd39('0x25')](respondWithResult(_0x49e271,null))[_0xbd39('0x46')](handleError(_0x49e271,null));};exports[_0xbd39('0x4a')]=function(_0x310e21,_0x56180c){return db[_0xbd39('0x2e')][_0xbd39('0x4a')](_0x310e21[_0xbd39('0x4b')],{})[_0xbd39('0x25')](function(_0x11fac7){var _0x346266=_0x310e21[_0xbd39('0x4c')][_0xbd39('0x4d')]({'plain':!![]});if(!_0x346266)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x346266['role']===_0xbd39('0x4c')){var _0x4df143=_0x11fac7['get']({'plain':!![]});var _0x21ec2f='Intervals';return db['UserProfileSection'][_0xbd39('0x49')]({'where':{'name':_0x21ec2f,'userProfileId':_0x346266['userProfileId']},'raw':!![]})[_0xbd39('0x25')](function(_0x1e9be2){if(_0x1e9be2&&_0x1e9be2['autoAssociation']===0x0){return db[_0xbd39('0x27')][_0xbd39('0x4a')]({'name':_0x4df143[_0xbd39('0x2a')],'resourceId':_0x4df143['id'],'type':_0x1e9be2[_0xbd39('0x2a')],'sectionId':_0x1e9be2['id']},{})[_0xbd39('0x25')](function(){return _0x11fac7;});}else{return _0x11fac7;}})['catch'](function(_0x19053f){logger['error'](_0xbd39('0x4e'),_0x19053f);throw _0x19053f;});}return _0x11fac7;})[_0xbd39('0x25')](respondWithResult(_0x56180c,0xc9))['catch'](handleError(_0x56180c,null));};exports['update']=function(_0x29aba2,_0xe26f08){if(_0x29aba2[_0xbd39('0x4b')]['id']){delete _0x29aba2[_0xbd39('0x4b')]['id'];}return db[_0xbd39('0x2e')]['find']({'where':{'id':_0x29aba2[_0xbd39('0x48')]['id']}})[_0xbd39('0x25')](handleEntityNotFound(_0xe26f08,null))['then'](saveUpdates(_0x29aba2[_0xbd39('0x4b')],null))[_0xbd39('0x25')](respondWithResult(_0xe26f08,null))[_0xbd39('0x46')](handleError(_0xe26f08,null));};exports[_0xbd39('0x26')]=function(_0xf6eb3b,_0x3867dd){return db[_0xbd39('0x2e')][_0xbd39('0x49')]({'where':{'id':_0xf6eb3b[_0xbd39('0x48')]['id']}})['then'](handleEntityNotFound(_0x3867dd,null))[_0xbd39('0x25')](removeEntity(_0x3867dd,null))[_0xbd39('0x46')](handleError(_0x3867dd,null));};exports[_0xbd39('0x4f')]=function(_0x140e2c,_0x42583b,_0xb7f482){if(_0x140e2c[_0xbd39('0x4b')]['id']){delete _0x140e2c[_0xbd39('0x4b')]['id'];}return db['Interval'][_0xbd39('0x49')]({'where':{'id':_0x140e2c[_0xbd39('0x48')]['id']}})[_0xbd39('0x25')](handleEntityNotFound(_0x42583b,null))[_0xbd39('0x25')](function(_0x2e74fe){if(_0x2e74fe){_0x140e2c[_0xbd39('0x4b')][_0xbd39('0x50')]=_0x2e74fe['id'];return db[_0xbd39('0x2e')][_0xbd39('0x4a')](_0x140e2c[_0xbd39('0x4b')]);}})[_0xbd39('0x25')](respondWithResult(_0x42583b,null))[_0xbd39('0x46')](handleError(_0x42583b,null));};exports[_0xbd39('0x51')]=function(_0x54ce0c,_0x3811b4,_0x456207){var _0x3cb2f7={};var _0x4ba4f4={};var _0x2099fe;var _0x34dd86;return db[_0xbd39('0x2e')][_0xbd39('0x52')]({'where':{'id':_0x54ce0c[_0xbd39('0x48')]['id']}})[_0xbd39('0x25')](handleEntityNotFound(_0x3811b4,null))[_0xbd39('0x25')](function(_0x3f1d51){if(_0x3f1d51){_0x2099fe=_0x3f1d51;_0x4ba4f4[_0xbd39('0x37')]=_[_0xbd39('0x33')](db[_0xbd39('0x2e')]['rawAttributes']);_0x4ba4f4[_0xbd39('0x32')]=_['keys'](_0x54ce0c[_0xbd39('0x32')]);_0x4ba4f4[_0xbd39('0x34')]=_[_0xbd39('0x35')](_0x4ba4f4[_0xbd39('0x37')],_0x4ba4f4['query']);_0x3cb2f7[_0xbd39('0x36')]=_[_0xbd39('0x35')](_0x4ba4f4[_0xbd39('0x37')],qs[_0xbd39('0x38')](_0x54ce0c[_0xbd39('0x32')]['fields']));_0x3cb2f7[_0xbd39('0x36')]=_0x3cb2f7[_0xbd39('0x36')]['length']?_0x3cb2f7[_0xbd39('0x36')]:_0x4ba4f4[_0xbd39('0x37')];_0x3cb2f7['order']=qs[_0xbd39('0x3c')](_0x54ce0c[_0xbd39('0x32')]['sort']);_0x3cb2f7['where']=qs[_0xbd39('0x34')](_['pick'](_0x54ce0c[_0xbd39('0x32')],_0x4ba4f4[_0xbd39('0x34')]));if(_0x54ce0c[_0xbd39('0x32')]['filter']){_0x3cb2f7[_0xbd39('0x3d')]=_['merge'](_0x3cb2f7['where'],{'$or':_[_0xbd39('0x2d')](_0x3cb2f7[_0xbd39('0x36')],function(_0x33f3c4){var _0x319999={};_0x319999[_0x33f3c4]={'$like':'%'+_0x54ce0c['query'][_0xbd39('0x3f')]+'%'};return _0x319999;})});}_0x3cb2f7=_[_0xbd39('0x40')]({},_0x3cb2f7,_0x54ce0c[_0xbd39('0x42')]);return _0x2099fe[_0xbd39('0x51')](_0x3cb2f7);}})[_0xbd39('0x25')](function(_0x3b2065){if(_0x3b2065){_0x34dd86=_0x3b2065['length'];if(!_0x54ce0c[_0xbd39('0x32')][_0xbd39('0x3a')](_0xbd39('0x53'))){_0x3cb2f7[_0xbd39('0x1d')]=qs[_0xbd39('0x1d')](_0x54ce0c[_0xbd39('0x32')]['limit']);_0x3cb2f7[_0xbd39('0x1f')]=qs[_0xbd39('0x1f')](_0x54ce0c[_0xbd39('0x32')][_0xbd39('0x1f')]);}return _0x2099fe[_0xbd39('0x51')](_0x3cb2f7);}})[_0xbd39('0x25')](function(_0x44925f){if(_0x44925f){return _0x44925f?{'count':_0x34dd86,'rows':_0x44925f}:null;}})[_0xbd39('0x25')](respondWithResult(_0x3811b4,null))[_0xbd39('0x46')](handleError(_0x3811b4,null));};exports[_0xbd39('0x54')]=function(_0x496831,_0x5a46df,_0x348a73){return db[_0xbd39('0x2e')]['findOne']({'where':{'id':_0x496831['params']['id']}})[_0xbd39('0x25')](handleEntityNotFound(_0x5a46df,null))[_0xbd39('0x25')](function(_0xd447e5){if(_0xd447e5){return db['sequelize'][_0xbd39('0x55')](function(_0x46ea0d){return db[_0xbd39('0x2e')][_0xbd39('0x26')]({'where':{'IntervalId':_0x496831[_0xbd39('0x48')]['id']},'transaction':_0x46ea0d})['then'](function(_0x70b210){var _0x5e2f54=_[_0xbd39('0x2d')](_0x496831[_0xbd39('0x4b')],function(_0x1b86e7){delete _0x1b86e7['id'];_0x1b86e7[_0xbd39('0x50')]=_0x496831[_0xbd39('0x48')]['id'];return _0x1b86e7;});return db['Interval']['bulkCreate'](_0x5e2f54,{'transaction':_0x46ea0d});});})[_0xbd39('0x25')](function(){return db['Interval']['findAll']({'where':{'IntervalId':_0x496831[_0xbd39('0x48')]['id']}});});}})[_0xbd39('0x25')](respondWithResult(_0x5a46df,null))[_0xbd39('0x46')](handleError(_0x5a46df,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 4a57060..9456791 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 _0x0082=['map','ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','Interval','tools_intervals','rewrite','interval','string','getIntervals','all'];(function(_0x58736a,_0x5d0121){var _0x4518e2=function(_0x2d9433){while(--_0x2d9433){_0x58736a['push'](_0x58736a['shift']());}};_0x4518e2(++_0x5d0121);}(_0x0082,0x183));var _0x2008=function(_0x431894,_0xc3fb09){_0x431894=_0x431894-0x0;var _0x301052=_0x0082[_0x431894];return _0x301052;};'use strict';var attributes=require(_0x2008('0x0'));var extensions=require(_0x2008('0x1'));var iftime=require(_0x2008('0x2'))[_0x2008('0x3')];module[_0x2008('0x4')]=function(_0x3eaf99){return _0x3eaf99[_0x2008('0x5')](_0x2008('0x6'),attributes,{'tableName':_0x2008('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x20cb3b){extensions[_0x2008('0x8')](_0x3eaf99,_0x20cb3b);},'afterBulkCreate':function(_0x238ca2,_0x53c3b9,_0x3a91f0){_0x3a91f0();extensions[_0x2008('0x8')](_0x3eaf99,_0x238ca2[0x0]);},'afterUpdate':function(_0x4d12fe){extensions[_0x2008('0x8')](_0x3eaf99,_0x4d12fe);},'afterDestroy':function(_0x270a33){extensions[_0x2008('0x8')](_0x3eaf99,_0x270a33);}},'instanceMethods':{'ifTime':function(_0x1a1f52=undefined,_0x3cc0a6=new Date()){if(typeof this[_0x2008('0x9')]===_0x2008('0xa')){return iftime(this[_0x2008('0x9')],_0x1a1f52,_0x3cc0a6);}else{return this[_0x2008('0xb')]()['then'](function(_0xda2e42){return Promise[_0x2008('0xc')](_0xda2e42[_0x2008('0xd')](function(_0x4110b6){return _0x4110b6[_0x2008('0xe')](_0x1a1f52,_0x3cc0a6);}));})['then'](function(_0x3f0206){return _0x3f0206[_0x2008('0xf')](function(_0x2a6f05,_0x97775){return _0x2a6f05||_0x97775;},![]);});}}}});}; \ No newline at end of file +var _0x7639=['rewrite','interval','string','then','all','map','ifTime','reduce','./interval.attributes','../../utils/iftime','exports','define','Interval','tools_intervals'];(function(_0x3c7f1b,_0x43b3d0){var _0x525f59=function(_0x4e5585){while(--_0x4e5585){_0x3c7f1b['push'](_0x3c7f1b['shift']());}};_0x525f59(++_0x43b3d0);}(_0x7639,0x19e));var _0x9763=function(_0x59682f,_0x5d1990){_0x59682f=_0x59682f-0x0;var _0xf5c0dd=_0x7639[_0x59682f];return _0xf5c0dd;};'use strict';var attributes=require(_0x9763('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0x9763('0x1'))['iftime'];module[_0x9763('0x2')]=function(_0x477260){return _0x477260[_0x9763('0x3')](_0x9763('0x4'),attributes,{'tableName':_0x9763('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5be5b5){extensions[_0x9763('0x6')](_0x477260,_0x5be5b5);},'afterBulkCreate':function(_0x2db882,_0x5e0372,_0x41a524){_0x41a524();extensions[_0x9763('0x6')](_0x477260,_0x2db882[0x0]);},'afterUpdate':function(_0x2d7c9f){extensions['rewrite'](_0x477260,_0x2d7c9f);},'afterDestroy':function(_0x153421){extensions['rewrite'](_0x477260,_0x153421);}},'instanceMethods':{'ifTime':function(_0xabac49=undefined,_0x55007f=new Date()){if(typeof this[_0x9763('0x7')]===_0x9763('0x8')){return iftime(this['interval'],_0xabac49,_0x55007f);}else{return this['getIntervals']()[_0x9763('0x9')](function(_0xfd144d){return Promise[_0x9763('0xa')](_0xfd144d[_0x9763('0xb')](function(_0x383175){return _0x383175[_0x9763('0xc')](_0xabac49,_0x55007f);}));})['then'](function(_0x121196){return _0x121196[_0x9763('0xd')](function(_0x56c8a2,_0x54a28d){return _0x56c8a2||_0x54a28d;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 46eeadf..073b0cc 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 _0x4b83=['silly','resolve','reduce','lodash','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','raw','options','where','limit','include','map','model','attributes','then','info','debug','stringify','catch','error','message','ShowInterval','Interval','find','findAll','all','ifTime','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','isArray','intervals','string','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime'];(function(_0x4f738a,_0x3b28fa){var _0x23f5e8=function(_0x5c366a){while(--_0x5c366a){_0x4f738a['push'](_0x4f738a['shift']());}};_0x23f5e8(++_0x3b28fa);}(_0x4b83,0x1e7));var _0x34b8=function(_0x5d37ac,_0x19d434){_0x5d37ac=_0x5d37ac-0x0;var _0x58dd9a=_0x4b83[_0x5d37ac];return _0x58dd9a;};'use strict';var _=require(_0x34b8('0x0'));var util=require('util');var db=require(_0x34b8('0x1'))['db'];var iftime=require(_0x34b8('0x2'))[_0x34b8('0x3')];var logger=require(_0x34b8('0x4'))(_0x34b8('0x5'));exports[_0x34b8('0x6')]=function(_0x3d2ef4){var _0x457d86=this;return new Promise(function(_0x2210ea,_0xc9f670){return db['Interval']['findAll']({'raw':_0x3d2ef4['options']?_0x3d2ef4['options'][_0x34b8('0x7')]===undefined?!![]:![]:!![],'where':_0x3d2ef4[_0x34b8('0x8')]?_0x3d2ef4[_0x34b8('0x8')][_0x34b8('0x9')]||null:null,'attributes':_0x3d2ef4[_0x34b8('0x8')]?_0x3d2ef4[_0x34b8('0x8')]['attributes']||null:null,'limit':_0x3d2ef4[_0x34b8('0x8')]?_0x3d2ef4['options'][_0x34b8('0xa')]||null:null,'include':_0x3d2ef4[_0x34b8('0x8')]?_0x3d2ef4[_0x34b8('0x8')][_0x34b8('0xb')]?_[_0x34b8('0xc')](_0x3d2ef4[_0x34b8('0x8')]['include'],function(_0x2afb14){return{'model':db[_0x2afb14[_0x34b8('0xd')]],'as':_0x2afb14['as'],'attributes':_0x2afb14[_0x34b8('0xe')],'include':_0x2afb14[_0x34b8('0xb')]?_['map'](_0x2afb14[_0x34b8('0xb')],function(_0x451e3c){return{'model':db[_0x451e3c[_0x34b8('0xd')]],'as':_0x451e3c['as'],'attributes':_0x451e3c[_0x34b8('0xe')],'include':_0x451e3c[_0x34b8('0xb')]?_['map'](_0x451e3c[_0x34b8('0xb')],function(_0x2a2d3b){return{'model':db[_0x2a2d3b[_0x34b8('0xd')]],'as':_0x2a2d3b['as'],'attributes':_0x2a2d3b['attributes']};}):[]};}):[]};}):[]:[]})[_0x34b8('0xf')](function(_0x4df845){logger[_0x34b8('0x10')](_0x34b8('0x6'),_0x3d2ef4);logger[_0x34b8('0x11')](_0x34b8('0x6'),_0x3d2ef4,JSON[_0x34b8('0x12')](_0x4df845));_0x2210ea(_0x4df845);})[_0x34b8('0x13')](function(_0x43a621){logger[_0x34b8('0x14')](_0x34b8('0x6'),_0x43a621['message'],_0x3d2ef4);_0xc9f670(_0x457d86[_0x34b8('0x14')](0x1f4,_0x43a621[_0x34b8('0x15')]));});});};exports[_0x34b8('0x16')]=function(_0x2fbf7f){var _0x5a3309=this;return new Promise(function(_0x3bcaec,_0x36cbf4){return db[_0x34b8('0x17')][_0x34b8('0x18')]({'raw':_0x2fbf7f[_0x34b8('0x8')]?_0x2fbf7f[_0x34b8('0x8')][_0x34b8('0x7')]===undefined?!![]:![]:!![],'where':_0x2fbf7f[_0x34b8('0x8')]?_0x2fbf7f[_0x34b8('0x8')][_0x34b8('0x9')]||null:null,'attributes':_0x2fbf7f[_0x34b8('0x8')]?_0x2fbf7f[_0x34b8('0x8')][_0x34b8('0xe')]||null:null,'include':_0x2fbf7f[_0x34b8('0x8')]?_0x2fbf7f[_0x34b8('0x8')]['include']?_['map'](_0x2fbf7f['options']['include'],function(_0x3ac8ec){return{'model':db[_0x3ac8ec[_0x34b8('0xd')]],'as':_0x3ac8ec['as'],'attributes':_0x3ac8ec[_0x34b8('0xe')],'include':_0x3ac8ec[_0x34b8('0xb')]?_['map'](_0x3ac8ec['include'],function(_0x1bd5e9){return{'model':db[_0x1bd5e9[_0x34b8('0xd')]],'as':_0x1bd5e9['as'],'attributes':_0x1bd5e9[_0x34b8('0xe')],'include':_0x1bd5e9[_0x34b8('0xb')]?_[_0x34b8('0xc')](_0x1bd5e9[_0x34b8('0xb')],function(_0x5d89e3){return{'model':db[_0x5d89e3['model']],'as':_0x5d89e3['as'],'attributes':_0x5d89e3[_0x34b8('0xe')]};}):[]};}):[]};}):[]:[]})[_0x34b8('0xf')](function(_0x126b4e){logger['info'](_0x34b8('0x16'),_0x2fbf7f);logger[_0x34b8('0x11')]('ShowInterval',_0x2fbf7f,JSON[_0x34b8('0x12')](_0x126b4e));_0x3bcaec(_0x126b4e);})[_0x34b8('0x13')](function(_0x4a4e32){logger[_0x34b8('0x14')](_0x34b8('0x16'),_0x4a4e32['message'],_0x2fbf7f);_0x36cbf4(_0x5a3309[_0x34b8('0x14')](0x1f4,_0x4a4e32[_0x34b8('0x15')]));});});};function checkArrayOfIntervals(_0x30c3ae,_0x2eea96){var _0x32df4a=[];return db[_0x34b8('0x17')][_0x34b8('0x19')]({'where':{'id':_0x30c3ae}})[_0x34b8('0xf')](function(_0x17e1f1){_0x32df4a=_0x17e1f1;return Promise[_0x34b8('0x1a')](_0x32df4a['map'](function(_0x3a9f18){return _0x3a9f18[_0x34b8('0x1b')](_0x2eea96);}));})['then'](function(_0x1e42f2){var _0x1d7fea=_0x1e42f2['reduce'](function(_0x3519df,_0x3b1a45){return _0x3519df||_0x3b1a45;},![]);logger[_0x34b8('0x10')](util['format'](_0x34b8('0x1c'),_0x32df4a['map'](function(_0x49ddd5){return _0x49ddd5['name'];})[_0x34b8('0x1d')](',\x20'),_0x32df4a[_0x34b8('0xc')](function(_0x2db194){return _0x2db194['id'];})[_0x34b8('0x1d')](',\x20')));return _0x1d7fea;});}function checkSingleInterval(_0x265c69,_0x211d99){return db[_0x34b8('0x17')][_0x34b8('0x1e')](_0x265c69)[_0x34b8('0xf')](function(_0x5e8ca7){if(_0x5e8ca7){logger['info'](util[_0x34b8('0x1f')](_0x34b8('0x20'),_0x5e8ca7['name'],_0x5e8ca7['id']));return _0x5e8ca7[_0x34b8('0x1b')](_0x211d99);}});}exports[_0x34b8('0x21')]=function(_0x45bb49){var _0x3e2acb=_0x45bb49[_0x34b8('0x22')];var _0x13e1e3=Array[_0x34b8('0x23')](_0x45bb49['intervals'])?_0x45bb49[_0x34b8('0x24')]:typeof _0x45bb49[_0x34b8('0x24')]===_0x34b8('0x25')?[_0x45bb49[_0x34b8('0x24')]]:[];var _0x2d98d8=_0x45bb49['timezone']||undefined;var _0xc5bcea=![];if(_0x13e1e3['length']){logger[_0x34b8('0x10')](util[_0x34b8('0x1f')](_0x34b8('0x26'),_0x13e1e3[_0x34b8('0x1d')](';\x20')));}if(_0x2d98d8){logger[_0x34b8('0x10')](util[_0x34b8('0x1f')](_0x34b8('0x27'),_0x2d98d8));}logger[_0x34b8('0x11')](_0x34b8('0x28'),_0xc5bcea);logger[_0x34b8('0x29')](_0x34b8('0x21'),_0x45bb49);return Promise[_0x34b8('0x2a')]()[_0x34b8('0xf')](function(){if(Array['isArray'](_0x3e2acb)){return checkArrayOfIntervals(_0x3e2acb,_0x2d98d8);}else if(_0x3e2acb){return checkSingleInterval(_0x3e2acb,_0x2d98d8);}})[_0x34b8('0xf')](function(_0x38082d){var _0x21825c=_0x13e1e3[_0x34b8('0x2b')](function(_0xa4a8be,_0x1b55fc){return _0xa4a8be||iftime(_0x1b55fc,_0x2d98d8);},![]);_0xc5bcea=_0x38082d||_0x21825c;return _0xc5bcea;})[_0x34b8('0x13')](function(_0x1ecb7d){logger[_0x34b8('0x14')](_0x34b8('0x21'),_0x45bb49,_0x1ecb7d);throw this[_0x34b8('0x14')](0x1f4,_0x1ecb7d['message']);});}; \ No newline at end of file +var _0x3c67=['message','ShowInterval','Interval','map','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','IntervalIftime','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','Iftime','silly','lodash','util','../../config/logger','rpc','GetInterval','findAll','options','raw','where','attributes','limit','include','model','then','info','debug','stringify','catch','error'];(function(_0x166c06,_0x39341e){var _0x265a32=function(_0x24c215){while(--_0x24c215){_0x166c06['push'](_0x166c06['shift']());}};_0x265a32(++_0x39341e);}(_0x3c67,0x125));var _0x73c6=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x3c67[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x73c6('0x0'));var util=require(_0x73c6('0x1'));var db=require('../../mysqldb')['db'];var iftime=require('../../utils/iftime')['iftime'];var logger=require(_0x73c6('0x2'))(_0x73c6('0x3'));exports[_0x73c6('0x4')]=function(_0x3a22c6){var _0x2ef602=this;return new Promise(function(_0x144433,_0x20937b){return db['Interval'][_0x73c6('0x5')]({'raw':_0x3a22c6[_0x73c6('0x6')]?_0x3a22c6[_0x73c6('0x6')][_0x73c6('0x7')]===undefined?!![]:![]:!![],'where':_0x3a22c6[_0x73c6('0x6')]?_0x3a22c6[_0x73c6('0x6')][_0x73c6('0x8')]||null:null,'attributes':_0x3a22c6[_0x73c6('0x6')]?_0x3a22c6['options'][_0x73c6('0x9')]||null:null,'limit':_0x3a22c6[_0x73c6('0x6')]?_0x3a22c6[_0x73c6('0x6')][_0x73c6('0xa')]||null:null,'include':_0x3a22c6[_0x73c6('0x6')]?_0x3a22c6[_0x73c6('0x6')][_0x73c6('0xb')]?_['map'](_0x3a22c6[_0x73c6('0x6')][_0x73c6('0xb')],function(_0x5c0b6f){return{'model':db[_0x5c0b6f['model']],'as':_0x5c0b6f['as'],'attributes':_0x5c0b6f[_0x73c6('0x9')],'include':_0x5c0b6f[_0x73c6('0xb')]?_['map'](_0x5c0b6f[_0x73c6('0xb')],function(_0x4d65ce){return{'model':db[_0x4d65ce[_0x73c6('0xc')]],'as':_0x4d65ce['as'],'attributes':_0x4d65ce[_0x73c6('0x9')],'include':_0x4d65ce[_0x73c6('0xb')]?_['map'](_0x4d65ce[_0x73c6('0xb')],function(_0x1172a7){return{'model':db[_0x1172a7[_0x73c6('0xc')]],'as':_0x1172a7['as'],'attributes':_0x1172a7['attributes']};}):[]};}):[]};}):[]:[]})[_0x73c6('0xd')](function(_0x23a9cd){logger[_0x73c6('0xe')](_0x73c6('0x4'),_0x3a22c6);logger[_0x73c6('0xf')](_0x73c6('0x4'),_0x3a22c6,JSON[_0x73c6('0x10')](_0x23a9cd));_0x144433(_0x23a9cd);})[_0x73c6('0x11')](function(_0x2ce824){logger[_0x73c6('0x12')](_0x73c6('0x4'),_0x2ce824['message'],_0x3a22c6);_0x20937b(_0x2ef602[_0x73c6('0x12')](0x1f4,_0x2ce824[_0x73c6('0x13')]));});});};exports[_0x73c6('0x14')]=function(_0x1d748d){var _0x5d8e18=this;return new Promise(function(_0x1846da,_0x2adb02){return db[_0x73c6('0x15')]['find']({'raw':_0x1d748d['options']?_0x1d748d['options']['raw']===undefined?!![]:![]:!![],'where':_0x1d748d[_0x73c6('0x6')]?_0x1d748d[_0x73c6('0x6')][_0x73c6('0x8')]||null:null,'attributes':_0x1d748d[_0x73c6('0x6')]?_0x1d748d[_0x73c6('0x6')][_0x73c6('0x9')]||null:null,'include':_0x1d748d[_0x73c6('0x6')]?_0x1d748d[_0x73c6('0x6')][_0x73c6('0xb')]?_[_0x73c6('0x16')](_0x1d748d[_0x73c6('0x6')][_0x73c6('0xb')],function(_0x14e1e2){return{'model':db[_0x14e1e2[_0x73c6('0xc')]],'as':_0x14e1e2['as'],'attributes':_0x14e1e2['attributes'],'include':_0x14e1e2['include']?_[_0x73c6('0x16')](_0x14e1e2[_0x73c6('0xb')],function(_0x187242){return{'model':db[_0x187242[_0x73c6('0xc')]],'as':_0x187242['as'],'attributes':_0x187242['attributes'],'include':_0x187242[_0x73c6('0xb')]?_['map'](_0x187242[_0x73c6('0xb')],function(_0x1decd3){return{'model':db[_0x1decd3[_0x73c6('0xc')]],'as':_0x1decd3['as'],'attributes':_0x1decd3[_0x73c6('0x9')]};}):[]};}):[]};}):[]:[]})[_0x73c6('0xd')](function(_0x5b62eb){logger[_0x73c6('0xe')](_0x73c6('0x14'),_0x1d748d);logger[_0x73c6('0xf')](_0x73c6('0x14'),_0x1d748d,JSON[_0x73c6('0x10')](_0x5b62eb));_0x1846da(_0x5b62eb);})[_0x73c6('0x11')](function(_0x27bb64){logger[_0x73c6('0x12')](_0x73c6('0x14'),_0x27bb64[_0x73c6('0x13')],_0x1d748d);_0x2adb02(_0x5d8e18['error'](0x1f4,_0x27bb64[_0x73c6('0x13')]));});});};function checkArrayOfIntervals(_0x374358,_0xc644d9){var _0x14973b=[];return db[_0x73c6('0x15')][_0x73c6('0x5')]({'where':{'id':_0x374358}})['then'](function(_0x2519e6){_0x14973b=_0x2519e6;return Promise['all'](_0x14973b['map'](function(_0x2d8c62){return _0x2d8c62[_0x73c6('0x17')](_0xc644d9);}));})[_0x73c6('0xd')](function(_0x5f5bd8){var _0x213542=_0x5f5bd8[_0x73c6('0x18')](function(_0x405b84,_0xff052){return _0x405b84||_0xff052;},![]);logger['info'](util[_0x73c6('0x19')](_0x73c6('0x1a'),_0x14973b[_0x73c6('0x16')](function(_0x124101){return _0x124101['name'];})[_0x73c6('0x1b')](',\x20'),_0x14973b[_0x73c6('0x16')](function(_0x584712){return _0x584712['id'];})[_0x73c6('0x1b')](',\x20')));return _0x213542;});}function checkSingleInterval(_0xa08e58,_0x376497){return db[_0x73c6('0x15')][_0x73c6('0x1c')](_0xa08e58)['then'](function(_0x47bc8c){if(_0x47bc8c){logger[_0x73c6('0xe')](util[_0x73c6('0x19')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x47bc8c['name'],_0x47bc8c['id']));return _0x47bc8c[_0x73c6('0x17')](_0x376497);}});}exports[_0x73c6('0x1d')]=function(_0x36fafe){var _0x1166b6=_0x36fafe[_0x73c6('0x1e')];var _0x59cc70=Array[_0x73c6('0x1f')](_0x36fafe['intervals'])?_0x36fafe['intervals']:typeof _0x36fafe[_0x73c6('0x20')]===_0x73c6('0x21')?[_0x36fafe[_0x73c6('0x20')]]:[];var _0x1c0a41=_0x36fafe[_0x73c6('0x22')]||undefined;var _0x5877d3=![];if(_0x59cc70[_0x73c6('0x23')]){logger[_0x73c6('0xe')](util[_0x73c6('0x19')](_0x73c6('0x24'),_0x59cc70[_0x73c6('0x1b')](';\x20')));}if(_0x1c0a41){logger[_0x73c6('0xe')](util[_0x73c6('0x19')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x1c0a41));}logger[_0x73c6('0xf')](_0x73c6('0x25'),_0x5877d3);logger[_0x73c6('0x26')](_0x73c6('0x1d'),_0x36fafe);return Promise['resolve']()['then'](function(){if(Array['isArray'](_0x1166b6)){return checkArrayOfIntervals(_0x1166b6,_0x1c0a41);}else if(_0x1166b6){return checkSingleInterval(_0x1166b6,_0x1c0a41);}})[_0x73c6('0xd')](function(_0x112714){var _0x21ae0f=_0x59cc70[_0x73c6('0x18')](function(_0x2c555a,_0x395d9e){return _0x2c555a||iftime(_0x395d9e,_0x1c0a41);},![]);_0x5877d3=_0x112714||_0x21ae0f;return _0x5877d3;})['catch'](function(_0x36b862){logger[_0x73c6('0x12')](_0x73c6('0x1d'),_0x36fafe,_0x36b862);throw this[_0x73c6('0x12')](0x1f4,_0x36b862[_0x73c6('0x13')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 66d088e..b155247 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(_0x2a4026,_0x1a4ae6){var _0x5b841f=function(_0x3b9287){while(--_0x3b9287){_0x2a4026['push'](_0x2a4026['shift']());}};_0x5b841f(++_0x1a4ae6);}(_0xadb5,0xad));var _0x5adb=function(_0x14bfd7,_0x78eb77){_0x14bfd7=_0x14bfd7-0x0;var _0x32256=_0xadb5[_0x14bfd7];return _0x32256;};'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 _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x3a78cb,_0x2fbe77){var _0x3c69db=function(_0x267826){while(--_0x267826){_0x3a78cb['push'](_0x3a78cb['shift']());}};_0x3c69db(++_0x2fbe77);}(_0x2ef3,0xba));var _0x32ef=function(_0xb03adc,_0x3cd9d5){_0xb03adc=_0xb03adc-0x0;var _0x4be717=_0x2ef3[_0xb03adc];return _0x4be717;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 58fe3fd..fe522a7 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 _0xf441=['remoteAddress','socket','connection','bluebird','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','\x20from\x20','description','stringify','issuetype','Bug','customfield_11500','email','fields','customfield_11501','oldToken','customfield_11502','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','toString','base64','request','utf8','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','end','body','headers','x-forwarded-for'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf441,0xda));var _0x1f44=function(_0xdc4996,_0x15bedc){_0xdc4996=_0xdc4996-0x0;var _0x20fbb9=_0xf441[_0xdc4996];return _0x20fbb9;};'use strict';var BPromise=require(_0x1f44('0x0'));var https=require('https');var logger=require(_0x1f44('0x1'))(_0x1f44('0x2'));var USERNAME=_0x1f44('0x3');var PASSWORD=_0x1f44('0x4');function openIssue(_0x2e89f4,_0x104eb7){var _0x43f7c0={'fields':{'project':{'key':_0x2e89f4[_0x1f44('0x5')]||_0x1f44('0x6')},'summary':(_0x2e89f4['summary']||'Report')+_0x1f44('0x7')+_0x2e89f4['ip'],'description':_0x2e89f4[_0x1f44('0x8')]||JSON[_0x1f44('0x9')](_0x2e89f4),'issuetype':{'name':_0x2e89f4[_0x1f44('0xa')]||_0x1f44('0xb')}}};_0x43f7c0['fields'][_0x1f44('0xc')]=_0x2e89f4[_0x1f44('0xd')];_0x43f7c0[_0x1f44('0xe')][_0x1f44('0xf')]=_0x2e89f4[_0x1f44('0x10')];_0x43f7c0['fields'][_0x1f44('0x11')]=_0x2e89f4['newToken'];_0x43f7c0[_0x1f44('0xe')][_0x1f44('0x12')]=_0x2e89f4[_0x1f44('0x13')];_0x43f7c0[_0x1f44('0xe')][_0x1f44('0x14')]=_0x2e89f4[_0x1f44('0x15')];_0x43f7c0[_0x1f44('0xe')][_0x1f44('0x16')]=_0x2e89f4['ip'];var _0x59ed65={'host':_0x1f44('0x17'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x1f44('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0x1f44('0x19'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x1f44('0x1a')](_0x1f44('0x1b'))}};var _0x3fc4b3=JSON['stringify'](_0x43f7c0);var _0x3c6848=https[_0x1f44('0x1c')](_0x59ed65,function(_0x31565b){_0x31565b['setEncoding'](_0x1f44('0x1d'));var _0xe4afb5='';_0x31565b['on']('data',function(_0x45b588){_0xe4afb5+=_0x45b588;});_0x31565b['on']('end',function(){if(_0x104eb7){return _0x104eb7[_0x1f44('0x1e')](_0x31565b[_0x1f44('0x1f')])[_0x1f44('0x20')](JSON[_0x1f44('0x21')](_0xe4afb5));}});});_0x3c6848['on']('error',function(_0x1e243c){if(_0x104eb7){return _0x104eb7[_0x1f44('0x1e')](0x1f4)[_0x1f44('0x20')]({'errors':[{'message':_0x1f44('0x22'),'type':'api.jira'}]});}});_0x3c6848[_0x1f44('0x23')](_0x3fc4b3);_0x3c6848[_0x1f44('0x24')]();}exports['openIssue']=openIssue;exports['send']=function(_0x354be9,_0x3d2d36){_0x354be9[_0x1f44('0x25')]['ip']=_0x354be9[_0x1f44('0x26')][_0x1f44('0x27')]||_0x354be9['connection'][_0x1f44('0x28')]||_0x354be9[_0x1f44('0x29')][_0x1f44('0x28')]||_0x354be9[_0x1f44('0x2a')][_0x1f44('0x29')][_0x1f44('0x28')];return openIssue(_0x354be9[_0x1f44('0x25')],_0x3d2d36);}; \ No newline at end of file +var _0x066b=['description','stringify','issuetype','Bug','fields','customfield_11500','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','toString','base64','setEncoding','utf8','json','parse','error','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','end','openIssue','body','headers','remoteAddress','socket','connection','../../config/logger','api','support','3eAmWpBVP0','key','Report','\x20from\x20'];(function(_0x45a766,_0x3c06ea){var _0x270fbe=function(_0x3cb1ce){while(--_0x3cb1ce){_0x45a766['push'](_0x45a766['shift']());}};_0x270fbe(++_0x3c06ea);}(_0x066b,0x1c7));var _0xb066=function(_0xf950f6,_0x21a7e2){_0xf950f6=_0xf950f6-0x0;var _0x136e49=_0x066b[_0xf950f6];return _0x136e49;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require(_0xb066('0x0'))(_0xb066('0x1'));var USERNAME=_0xb066('0x2');var PASSWORD=_0xb066('0x3');function openIssue(_0x515ccb,_0x8cc328){var _0x36e029={'fields':{'project':{'key':_0x515ccb[_0xb066('0x4')]||'MOTGUI'},'summary':(_0x515ccb['summary']||_0xb066('0x5'))+_0xb066('0x6')+_0x515ccb['ip'],'description':_0x515ccb[_0xb066('0x7')]||JSON[_0xb066('0x8')](_0x515ccb),'issuetype':{'name':_0x515ccb[_0xb066('0x9')]||_0xb066('0xa')}}};_0x36e029[_0xb066('0xb')][_0xb066('0xc')]=_0x515ccb['email'];_0x36e029[_0xb066('0xb')][_0xb066('0xd')]=_0x515ccb['oldToken'];_0x36e029[_0xb066('0xb')][_0xb066('0xe')]=_0x515ccb[_0xb066('0xf')];_0x36e029[_0xb066('0xb')][_0xb066('0x10')]=_0x515ccb[_0xb066('0x11')];_0x36e029[_0xb066('0xb')][_0xb066('0x12')]=_0x515ccb[_0xb066('0x13')];_0x36e029['fields'][_0xb066('0x14')]=_0x515ccb['ip'];var _0x1753e8={'host':_0xb066('0x15'),'port':0x1bb,'path':_0xb066('0x16'),'method':_0xb066('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0xb066('0x18'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xb066('0x19')](_0xb066('0x1a'))}};var _0xbf501a=JSON[_0xb066('0x8')](_0x36e029);var _0x27086f=https['request'](_0x1753e8,function(_0x3be708){_0x3be708[_0xb066('0x1b')](_0xb066('0x1c'));var _0x384771='';_0x3be708['on']('data',function(_0x56ba09){_0x384771+=_0x56ba09;});_0x3be708['on']('end',function(){if(_0x8cc328){return _0x8cc328['status'](_0x3be708['statusCode'])[_0xb066('0x1d')](JSON[_0xb066('0x1e')](_0x384771));}});});_0x27086f['on'](_0xb066('0x1f'),function(_0x3de76d){if(_0x8cc328){return _0x8cc328[_0xb066('0x20')](0x1f4)[_0xb066('0x1d')]({'errors':[{'message':_0xb066('0x21'),'type':_0xb066('0x22')}]});}});_0x27086f['write'](_0xbf501a);_0x27086f[_0xb066('0x23')]();}exports[_0xb066('0x24')]=openIssue;exports['send']=function(_0x59e02c,_0x12e5b8){_0x59e02c[_0xb066('0x25')]['ip']=_0x59e02c[_0xb066('0x26')]['x-forwarded-for']||_0x59e02c['connection'][_0xb066('0x27')]||_0x59e02c[_0xb066('0x28')][_0xb066('0x27')]||_0x59e02c[_0xb066('0x29')][_0xb066('0x28')][_0xb066('0x27')];return openIssue(_0x59e02c[_0xb066('0x25')],_0x12e5b8);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 9d68aa3..48ec6a9 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 _0xcb91=['get','index','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller'];(function(_0x1d31d0,_0x4fdb24){var _0x445ade=function(_0x68f482){while(--_0x68f482){_0x1d31d0['push'](_0x1d31d0['shift']());}};_0x445ade(++_0x4fdb24);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3712e2,_0x32d752){_0x3712e2=_0x3712e2-0x0;var _0x1faff4=_0xcb91[_0x3712e2];return _0x1faff4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0xe')](_0x1cb9('0xb'),auth['isAuthenticated'](),controller[_0x1cb9('0xf')]);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);module['exports']=router; \ No newline at end of file +var _0xa75b=['isAuthenticated','index','/describe','show','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get'];(function(_0x30d2b1,_0x1d50da){var _0x38533a=function(_0x28bf90){while(--_0x28bf90){_0x30d2b1['push'](_0x30d2b1['shift']());}};_0x38533a(++_0x1d50da);}(_0xa75b,0x170));var _0xba75=function(_0x5f7966,_0x1ea1ff){_0x5f7966=_0x5f7966-0x0;var _0x36f5d7=_0xa75b[_0x5f7966];return _0x36f5d7;};'use strict';var multer=require(_0xba75('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xba75('0x1'));var express=require(_0xba75('0x2'));var router=express[_0xba75('0x3')]();var fs_extra=require(_0xba75('0x4'));var auth=require(_0xba75('0x5'));var interaction=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var controller=require(_0xba75('0x8'));router[_0xba75('0x9')]('/',auth[_0xba75('0xa')](),controller[_0xba75('0xb')]);router[_0xba75('0x9')](_0xba75('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xba75('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xba75('0xd')]);router['post']('/',auth[_0xba75('0xa')](),controller[_0xba75('0xe')]);router[_0xba75('0xf')](_0xba75('0x10'),auth[_0xba75('0xa')](),controller[_0xba75('0x11')]);router[_0xba75('0x12')](_0xba75('0x10'),auth[_0xba75('0xa')](),controller[_0xba75('0x13')]);module[_0xba75('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 260328f..afd3baf 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(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x7a54,0x106));var _0x47a5=function(_0x379d98,_0x3e3b27){_0x379d98=_0x379d98-0x0;var _0x435ab2=_0x7a54[_0x379d98];return _0x435ab2;};'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(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x7a54,0x106));var _0x47a5=function(_0x578639,_0x3c6b1d){_0x578639=_0x578639-0x0;var _0x607b07=_0x7a54[_0x578639];return _0x607b07;};'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 cea8195..d21f3e5 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 _0x4873=['lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','name','send','index','rawAttributes','type','key','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','JscriptyAnswerReport','catch','show','model','fields','includeAll','find','create','body','destroy','params','describe','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x4873,0x1df));var _0x3487=function(_0x189363,_0x5e71b9){_0x189363=_0x189363-0x0;var _0xce107d=_0x4873[_0x189363];return _0xce107d;};'use strict';var emlformat=require(_0x3487('0x0'));var rimraf=require(_0x3487('0x1'));var zipdir=require(_0x3487('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3487('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3487('0x4'));var util=require(_0x3487('0x5'));var path=require(_0x3487('0x6'));var sox=require(_0x3487('0x7'));var csv=require(_0x3487('0x8'));var ejs=require(_0x3487('0x9'));var fs=require('fs');var fs_extra=require(_0x3487('0xa'));var _=require(_0x3487('0xb'));var squel=require('squel');var crypto=require(_0x3487('0xc'));var jsforce=require(_0x3487('0xd'));var deskjs=require(_0x3487('0xe'));var toCsv=require(_0x3487('0x8'));var querystring=require(_0x3487('0xf'));var Papa=require('papaparse');var Redis=require(_0x3487('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3487('0x11'));var as=require(_0x3487('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3487('0x13'));var utils=require(_0x3487('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3487('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x557d64,_0x395774){_0x395774=_0x395774||0xcc;return function(_0x1be2e0){if(_0x1be2e0){return _0x557d64[_0x3487('0x16')](_0x395774);}return _0x557d64[_0x3487('0x17')](_0x395774)[_0x3487('0x18')]();};}function respondWithResult(_0x1e468b,_0x4fbd63){_0x4fbd63=_0x4fbd63||0xc8;return function(_0x23ce3b){if(_0x23ce3b){return _0x1e468b[_0x3487('0x17')](_0x4fbd63)[_0x3487('0x19')](_0x23ce3b);}};}function respondWithFilteredResult(_0x4f79f0,_0x156e80){return function(_0x1b19c4){if(_0x1b19c4){var _0x38c0c1=typeof _0x156e80[_0x3487('0x1a')]===_0x3487('0x1b')&&typeof _0x156e80[_0x3487('0x1c')]===_0x3487('0x1b');var _0x32ecde=_0x1b19c4[_0x3487('0x1d')];var _0x2fa630=_0x38c0c1?0x0:_0x156e80[_0x3487('0x1a')];var _0x41795b=_0x38c0c1?_0x1b19c4[_0x3487('0x1d')]:_0x156e80[_0x3487('0x1a')]+_0x156e80['limit'];var _0x320349;if(_0x41795b>=_0x32ecde){_0x41795b=_0x32ecde;_0x320349=0xc8;}else{_0x320349=0xce;}_0x4f79f0['status'](_0x320349);return _0x4f79f0[_0x3487('0x1e')](_0x3487('0x1f'),_0x2fa630+'-'+_0x41795b+'/'+_0x32ecde)[_0x3487('0x19')](_0x1b19c4);}return null;};}function patchUpdates(_0x29546f){return function(_0xd788f8){try{jsonpatch[_0x3487('0x20')](_0xd788f8,_0x29546f,!![]);}catch(_0x479354){return BPromise[_0x3487('0x21')](_0x479354);}return _0xd788f8[_0x3487('0x22')]();};}function saveUpdates(_0x28f8f7,_0x97013d){return function(_0x11437c){if(_0x11437c){return _0x11437c[_0x3487('0x23')](_0x28f8f7)['then'](function(_0x384792){return _0x384792;});}return null;};}function removeEntity(_0x3e63e8,_0x25ed9f){return function(_0x482551){if(_0x482551){return _0x482551['destroy']()[_0x3487('0x24')](function(){_0x3e63e8[_0x3487('0x17')](0xcc)[_0x3487('0x18')]();});}};}function handleEntityNotFound(_0x3a9d76,_0x4c6882){return function(_0x79a183){if(!_0x79a183){_0x3a9d76[_0x3487('0x16')](0x194);}return _0x79a183;};}function handleError(_0x5484f6,_0x1e7126){_0x1e7126=_0x1e7126||0x1f4;return function(_0x3fb245){logger['error'](_0x3fb245['stack']);if(_0x3fb245[_0x3487('0x25')]){delete _0x3fb245[_0x3487('0x25')];}_0x5484f6[_0x3487('0x17')](_0x1e7126)[_0x3487('0x26')](_0x3fb245);};}exports[_0x3487('0x27')]=function(_0x1a02d6,_0x1c5bd6){var _0x38af4a={},_0x25e123={},_0x4dada9={'count':0x0,'rows':[]};var _0x24532a=_['map'](db['JscriptyAnswerReport'][_0x3487('0x28')],function(_0x56ee54){return{'name':_0x56ee54['fieldName'],'type':_0x56ee54[_0x3487('0x29')][_0x3487('0x2a')]};});_0x25e123['model']=_['map'](_0x24532a,_0x3487('0x25'));_0x25e123[_0x3487('0x2b')]=_[_0x3487('0x2c')](_0x1a02d6['query']);_0x25e123[_0x3487('0x2d')]=_['intersection'](_0x25e123['model'],_0x25e123['query']);_0x38af4a[_0x3487('0x2e')]=_[_0x3487('0x2f')](_0x25e123['model'],qs['fields'](_0x1a02d6[_0x3487('0x2b')]['fields']));_0x38af4a['attributes']=_0x38af4a[_0x3487('0x2e')][_0x3487('0x30')]?_0x38af4a[_0x3487('0x2e')]:_0x25e123['model'];if(!_0x1a02d6[_0x3487('0x2b')][_0x3487('0x31')](_0x3487('0x32'))){_0x38af4a[_0x3487('0x1c')]=qs['limit'](_0x1a02d6[_0x3487('0x2b')][_0x3487('0x1c')]);_0x38af4a['offset']=qs[_0x3487('0x1a')](_0x1a02d6[_0x3487('0x2b')][_0x3487('0x1a')]);}_0x38af4a[_0x3487('0x33')]=qs[_0x3487('0x34')](_0x1a02d6[_0x3487('0x2b')][_0x3487('0x34')]);_0x38af4a[_0x3487('0x35')]=qs[_0x3487('0x2d')](_['pick'](_0x1a02d6[_0x3487('0x2b')],_0x25e123[_0x3487('0x2d')]),_0x24532a);if(_0x1a02d6['query']['filter']){_0x38af4a[_0x3487('0x35')]=_[_0x3487('0x36')](_0x38af4a[_0x3487('0x35')],{'$or':_['map'](_0x24532a,function(_0x58006c){if(_0x58006c['type']!==_0x3487('0x37')){var _0x268674={};_0x268674[_0x58006c['name']]={'$like':'%'+_0x1a02d6[_0x3487('0x2b')][_0x3487('0x38')]+'%'};return _0x268674;}})});}_0x38af4a=_[_0x3487('0x36')]({},_0x38af4a,_0x1a02d6[_0x3487('0x39')]);var _0x106393={'where':_0x38af4a[_0x3487('0x35')]};return db[_0x3487('0x3a')][_0x3487('0x1d')](_0x106393)[_0x3487('0x24')](function(_0x565cb2){_0x4dada9[_0x3487('0x1d')]=_0x565cb2;if(_0x1a02d6[_0x3487('0x2b')]['includeAll']){_0x38af4a['include']=[{'all':!![]}];}return db[_0x3487('0x3a')]['findAll'](_0x38af4a);})['then'](function(_0x3eb68c){_0x4dada9['rows']=_0x3eb68c;return _0x4dada9;})['then'](respondWithFilteredResult(_0x1c5bd6,_0x38af4a))[_0x3487('0x3b')](handleError(_0x1c5bd6,null));};exports[_0x3487('0x3c')]=function(_0x58a4c8,_0x51b69c){var _0xc04317={'raw':!![],'where':{'id':_0x58a4c8['params']['id']}},_0x8cd06f={};_0x8cd06f[_0x3487('0x3d')]=_[_0x3487('0x2c')](db['JscriptyAnswerReport'][_0x3487('0x28')]);_0x8cd06f[_0x3487('0x2b')]=_[_0x3487('0x2c')](_0x58a4c8['query']);_0x8cd06f[_0x3487('0x2d')]=_[_0x3487('0x2f')](_0x8cd06f[_0x3487('0x3d')],_0x8cd06f[_0x3487('0x2b')]);_0xc04317[_0x3487('0x2e')]=_[_0x3487('0x2f')](_0x8cd06f[_0x3487('0x3d')],qs[_0x3487('0x3e')](_0x58a4c8['query'][_0x3487('0x3e')]));_0xc04317[_0x3487('0x2e')]=_0xc04317[_0x3487('0x2e')][_0x3487('0x30')]?_0xc04317[_0x3487('0x2e')]:_0x8cd06f[_0x3487('0x3d')];if(_0x58a4c8[_0x3487('0x2b')][_0x3487('0x3f')]){_0xc04317['include']=[{'all':!![]}];}_0xc04317=_['merge']({},_0xc04317,_0x58a4c8[_0x3487('0x39')]);return db[_0x3487('0x3a')][_0x3487('0x40')](_0xc04317)[_0x3487('0x24')](handleEntityNotFound(_0x51b69c,null))['then'](respondWithResult(_0x51b69c,null))['catch'](handleError(_0x51b69c,null));};exports[_0x3487('0x41')]=function(_0x122456,_0x3fe91f){return db[_0x3487('0x3a')][_0x3487('0x41')](_0x122456[_0x3487('0x42')],{})[_0x3487('0x24')](respondWithResult(_0x3fe91f,0xc9))[_0x3487('0x3b')](handleError(_0x3fe91f,null));};exports['update']=function(_0x585a44,_0x320351){if(_0x585a44[_0x3487('0x42')]['id']){delete _0x585a44['body']['id'];}return db[_0x3487('0x3a')]['find']({'where':{'id':_0x585a44['params']['id']}})[_0x3487('0x24')](handleEntityNotFound(_0x320351,null))[_0x3487('0x24')](saveUpdates(_0x585a44['body'],null))[_0x3487('0x24')](respondWithResult(_0x320351,null))[_0x3487('0x3b')](handleError(_0x320351,null));};exports[_0x3487('0x43')]=function(_0x4ab5f8,_0x761f95){return db[_0x3487('0x3a')][_0x3487('0x40')]({'where':{'id':_0x4ab5f8[_0x3487('0x44')]['id']}})['then'](handleEntityNotFound(_0x761f95,null))[_0x3487('0x24')](removeEntity(_0x761f95,null))[_0x3487('0x3b')](handleError(_0x761f95,null));};exports[_0x3487('0x45')]=function(_0x33e826,_0x11125d){return db[_0x3487('0x3a')][_0x3487('0x45')]()['then'](respondWithResult(_0x11125d,null))[_0x3487('0x3b')](handleError(_0x11125d,null));}; \ No newline at end of file +var _0x4813=['offset','limit','Content-Range','apply','save','then','destroy','end','error','stack','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','includeAll','include','rows','show','params','keys','catch','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x4813,0x14e));var _0x3481=function(_0x4a7bd3,_0x3e1e8a){_0x4a7bd3=_0x4a7bd3-0x0;var _0xf0b402=_0x4813[_0x4a7bd3];return _0xf0b402;};'use strict';var emlformat=require(_0x3481('0x0'));var rimraf=require(_0x3481('0x1'));var zipdir=require(_0x3481('0x2'));var jsonpatch=require(_0x3481('0x3'));var rp=require(_0x3481('0x4'));var moment=require(_0x3481('0x5'));var BPromise=require(_0x3481('0x6'));var Mustache=require('mustache');var util=require(_0x3481('0x7'));var path=require(_0x3481('0x8'));var sox=require(_0x3481('0x9'));var csv=require(_0x3481('0xa'));var ejs=require(_0x3481('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3481('0xc'));var crypto=require('crypto');var jsforce=require(_0x3481('0xd'));var deskjs=require(_0x3481('0xe'));var toCsv=require(_0x3481('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3481('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3481('0x10'));var logger=require(_0x3481('0x11'))(_0x3481('0x12'));var utils=require(_0x3481('0x13'));var config=require(_0x3481('0x14'));var licenseUtil=require(_0x3481('0x15'));var db=require(_0x3481('0x16'))['db'];function respondWithStatusCode(_0x3f1376,_0x37cc2b){_0x37cc2b=_0x37cc2b||0xcc;return function(_0x22b89b){if(_0x22b89b){return _0x3f1376[_0x3481('0x17')](_0x37cc2b);}return _0x3f1376[_0x3481('0x18')](_0x37cc2b)['end']();};}function respondWithResult(_0x16358e,_0xb77c75){_0xb77c75=_0xb77c75||0xc8;return function(_0x1bcfad){if(_0x1bcfad){return _0x16358e[_0x3481('0x18')](_0xb77c75)[_0x3481('0x19')](_0x1bcfad);}};}function respondWithFilteredResult(_0x39e581,_0x4a1d09){return function(_0x1bb126){if(_0x1bb126){var _0x41c2aa=typeof _0x4a1d09['offset']==='undefined'&&typeof _0x4a1d09['limit']==='undefined';var _0x4f5d1b=_0x1bb126['count'];var _0x32a315=_0x41c2aa?0x0:_0x4a1d09[_0x3481('0x1a')];var _0x5a8e65=_0x41c2aa?_0x1bb126['count']:_0x4a1d09[_0x3481('0x1a')]+_0x4a1d09[_0x3481('0x1b')];var _0x3b43dc;if(_0x5a8e65>=_0x4f5d1b){_0x5a8e65=_0x4f5d1b;_0x3b43dc=0xc8;}else{_0x3b43dc=0xce;}_0x39e581['status'](_0x3b43dc);return _0x39e581['set'](_0x3481('0x1c'),_0x32a315+'-'+_0x5a8e65+'/'+_0x4f5d1b)[_0x3481('0x19')](_0x1bb126);}return null;};}function patchUpdates(_0x1e0aa0){return function(_0x1ba743){try{jsonpatch[_0x3481('0x1d')](_0x1ba743,_0x1e0aa0,!![]);}catch(_0x4469d4){return BPromise['reject'](_0x4469d4);}return _0x1ba743[_0x3481('0x1e')]();};}function saveUpdates(_0x3cdb98,_0x162305){return function(_0xea1072){if(_0xea1072){return _0xea1072['update'](_0x3cdb98)[_0x3481('0x1f')](function(_0x48eb64){return _0x48eb64;});}return null;};}function removeEntity(_0x2185ba,_0x33c6fa){return function(_0x418a7d){if(_0x418a7d){return _0x418a7d[_0x3481('0x20')]()['then'](function(){_0x2185ba['status'](0xcc)[_0x3481('0x21')]();});}};}function handleEntityNotFound(_0x3e5963,_0x249754){return function(_0x405816){if(!_0x405816){_0x3e5963['sendStatus'](0x194);}return _0x405816;};}function handleError(_0x2e837a,_0x6ce3f3){_0x6ce3f3=_0x6ce3f3||0x1f4;return function(_0x1181e1){logger[_0x3481('0x22')](_0x1181e1[_0x3481('0x23')]);if(_0x1181e1[_0x3481('0x24')]){delete _0x1181e1[_0x3481('0x24')];}_0x2e837a[_0x3481('0x18')](_0x6ce3f3)[_0x3481('0x25')](_0x1181e1);};}exports[_0x3481('0x26')]=function(_0x4a20d5,_0x131363){var _0x4a8492={},_0xdcacba={},_0x1f079a={'count':0x0,'rows':[]};var _0x2864f1=_['map'](db[_0x3481('0x27')][_0x3481('0x28')],function(_0x2df894){return{'name':_0x2df894[_0x3481('0x29')],'type':_0x2df894[_0x3481('0x2a')]['key']};});_0xdcacba[_0x3481('0x2b')]=_[_0x3481('0x2c')](_0x2864f1,_0x3481('0x24'));_0xdcacba[_0x3481('0x2d')]=_['keys'](_0x4a20d5[_0x3481('0x2d')]);_0xdcacba[_0x3481('0x2e')]=_[_0x3481('0x2f')](_0xdcacba[_0x3481('0x2b')],_0xdcacba[_0x3481('0x2d')]);_0x4a8492[_0x3481('0x30')]=_[_0x3481('0x2f')](_0xdcacba[_0x3481('0x2b')],qs['fields'](_0x4a20d5[_0x3481('0x2d')][_0x3481('0x31')]));_0x4a8492[_0x3481('0x30')]=_0x4a8492['attributes'][_0x3481('0x32')]?_0x4a8492['attributes']:_0xdcacba[_0x3481('0x2b')];if(!_0x4a20d5['query'][_0x3481('0x33')]('nolimit')){_0x4a8492[_0x3481('0x1b')]=qs[_0x3481('0x1b')](_0x4a20d5[_0x3481('0x2d')]['limit']);_0x4a8492[_0x3481('0x1a')]=qs['offset'](_0x4a20d5[_0x3481('0x2d')]['offset']);}_0x4a8492[_0x3481('0x34')]=qs[_0x3481('0x35')](_0x4a20d5[_0x3481('0x2d')][_0x3481('0x35')]);_0x4a8492[_0x3481('0x36')]=qs[_0x3481('0x2e')](_[_0x3481('0x37')](_0x4a20d5[_0x3481('0x2d')],_0xdcacba[_0x3481('0x2e')]),_0x2864f1);if(_0x4a20d5['query'][_0x3481('0x38')]){_0x4a8492['where']=_[_0x3481('0x39')](_0x4a8492[_0x3481('0x36')],{'$or':_[_0x3481('0x2c')](_0x2864f1,function(_0x40fd6f){if(_0x40fd6f['type']!=='VIRTUAL'){var _0x2207fb={};_0x2207fb[_0x40fd6f[_0x3481('0x24')]]={'$like':'%'+_0x4a20d5[_0x3481('0x2d')][_0x3481('0x38')]+'%'};return _0x2207fb;}})});}_0x4a8492=_['merge']({},_0x4a8492,_0x4a20d5[_0x3481('0x3a')]);var _0x3c7874={'where':_0x4a8492[_0x3481('0x36')]};return db[_0x3481('0x27')][_0x3481('0x3b')](_0x3c7874)[_0x3481('0x1f')](function(_0x33c33f){_0x1f079a['count']=_0x33c33f;if(_0x4a20d5[_0x3481('0x2d')][_0x3481('0x3c')]){_0x4a8492[_0x3481('0x3d')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x4a8492);})[_0x3481('0x1f')](function(_0x420b8c){_0x1f079a[_0x3481('0x3e')]=_0x420b8c;return _0x1f079a;})['then'](respondWithFilteredResult(_0x131363,_0x4a8492))['catch'](handleError(_0x131363,null));};exports[_0x3481('0x3f')]=function(_0x335292,_0x3fc0e7){var _0xbccc9e={'raw':!![],'where':{'id':_0x335292[_0x3481('0x40')]['id']}},_0x5c4928={};_0x5c4928['model']=_[_0x3481('0x41')](db[_0x3481('0x27')][_0x3481('0x28')]);_0x5c4928[_0x3481('0x2d')]=_['keys'](_0x335292['query']);_0x5c4928['filters']=_['intersection'](_0x5c4928[_0x3481('0x2b')],_0x5c4928[_0x3481('0x2d')]);_0xbccc9e[_0x3481('0x30')]=_[_0x3481('0x2f')](_0x5c4928[_0x3481('0x2b')],qs[_0x3481('0x31')](_0x335292[_0x3481('0x2d')][_0x3481('0x31')]));_0xbccc9e[_0x3481('0x30')]=_0xbccc9e[_0x3481('0x30')][_0x3481('0x32')]?_0xbccc9e['attributes']:_0x5c4928['model'];if(_0x335292[_0x3481('0x2d')][_0x3481('0x3c')]){_0xbccc9e[_0x3481('0x3d')]=[{'all':!![]}];}_0xbccc9e=_[_0x3481('0x39')]({},_0xbccc9e,_0x335292['options']);return db[_0x3481('0x27')]['find'](_0xbccc9e)[_0x3481('0x1f')](handleEntityNotFound(_0x3fc0e7,null))[_0x3481('0x1f')](respondWithResult(_0x3fc0e7,null))[_0x3481('0x42')](handleError(_0x3fc0e7,null));};exports[_0x3481('0x43')]=function(_0x30f54e,_0x50dd72){return db[_0x3481('0x27')]['create'](_0x30f54e[_0x3481('0x44')],{})[_0x3481('0x1f')](respondWithResult(_0x50dd72,0xc9))['catch'](handleError(_0x50dd72,null));};exports[_0x3481('0x45')]=function(_0x54ec34,_0x27e106){if(_0x54ec34[_0x3481('0x44')]['id']){delete _0x54ec34[_0x3481('0x44')]['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x54ec34[_0x3481('0x40')]['id']}})[_0x3481('0x1f')](handleEntityNotFound(_0x27e106,null))[_0x3481('0x1f')](saveUpdates(_0x54ec34[_0x3481('0x44')],null))['then'](respondWithResult(_0x27e106,null))[_0x3481('0x42')](handleError(_0x27e106,null));};exports[_0x3481('0x20')]=function(_0xdd5422,_0x4b7598){return db['JscriptyAnswerReport'][_0x3481('0x46')]({'where':{'id':_0xdd5422[_0x3481('0x40')]['id']}})['then'](handleEntityNotFound(_0x4b7598,null))[_0x3481('0x1f')](removeEntity(_0x4b7598,null))[_0x3481('0x42')](handleError(_0x4b7598,null));};exports[_0x3481('0x47')]=function(_0x222b83,_0x403ba9){return db['JscriptyAnswerReport'][_0x3481('0x47')]()[_0x3481('0x1f')](respondWithResult(_0x403ba9,null))[_0x3481('0x42')](handleError(_0x403ba9,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 303e158..d4d50f2 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 _0xb27e=['define','JscriptyAnswerReport','report_jscripty_answers','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./jscriptyAnswerReport.attributes','exports'];(function(_0x50e540,_0x1bc892){var _0x2755db=function(_0x8b3b2c){while(--_0x8b3b2c){_0x50e540['push'](_0x50e540['shift']());}};_0x2755db(++_0x1bc892);}(_0xb27e,0xff));var _0xeb27=function(_0x177b14,_0x216d9b){_0x177b14=_0x177b14-0x0;var _0x275c61=_0xb27e[_0x177b14];return _0x275c61;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeb27('0x0'))(_0xeb27('0x1'));var moment=require(_0xeb27('0x2'));var BPromise=require(_0xeb27('0x3'));var rp=require(_0xeb27('0x4'));var fs=require('fs');var path=require(_0xeb27('0x5'));var rimraf=require(_0xeb27('0x6'));var config=require('../../config/environment');var attributes=require(_0xeb27('0x7'));module[_0xeb27('0x8')]=function(_0x356be4,_0x37592c){return _0x356be4[_0xeb27('0x9')](_0xeb27('0xa'),attributes,{'tableName':_0xeb27('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02a4=['report_jscripty_answers','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport'];(function(_0x20e127,_0x4f8afb){var _0x4522fc=function(_0x28c32d){while(--_0x28c32d){_0x20e127['push'](_0x20e127['shift']());}};_0x4522fc(++_0x4f8afb);}(_0x02a4,0x146));var _0x402a=function(_0x5c5eb0,_0x550970){_0x5c5eb0=_0x5c5eb0-0x0;var _0x46ab0b=_0x02a4[_0x5c5eb0];return _0x46ab0b;};'use strict';var _=require(_0x402a('0x0'));var util=require(_0x402a('0x1'));var logger=require(_0x402a('0x2'))(_0x402a('0x3'));var moment=require(_0x402a('0x4'));var BPromise=require(_0x402a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x402a('0x6'));var rimraf=require(_0x402a('0x7'));var config=require('../../config/environment');var attributes=require(_0x402a('0x8'));module[_0x402a('0x9')]=function(_0x2b95e3,_0x3c9164){return _0x2b95e3[_0x402a('0xa')](_0x402a('0xb'),attributes,{'tableName':_0x402a('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 147a272..18d7463 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 _0xabb1=['request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0xabb1,0x161));var _0x1abb=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xabb1[_0x346737];return _0x1ade2e;};'use strict';var _=require('lodash');var util=require(_0x1abb('0x0'));var moment=require(_0x1abb('0x1'));var BPromise=require(_0x1abb('0x2'));var rs=require(_0x1abb('0x3'));var fs=require('fs');var Redis=require(_0x1abb('0x4'));var db=require(_0x1abb('0x5'))['db'];var utils=require(_0x1abb('0x6'));var logger=require(_0x1abb('0x7'))('rpc');var config=require(_0x1abb('0x8'));var jayson=require(_0x1abb('0x9'));var client=jayson[_0x1abb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f68b3,_0x598360,_0x4d1a39){return new BPromise(function(_0x4c8457,_0x3e8c50){return client[_0x1abb('0xb')](_0x2f68b3,_0x4d1a39)[_0x1abb('0xc')](function(_0x92627a){logger[_0x1abb('0xd')](_0x1abb('0xe'),_0x598360,_0x1abb('0xf'));logger[_0x1abb('0x10')](_0x1abb('0x11'),_0x598360,'request\x20sent',JSON[_0x1abb('0x12')](_0x92627a));if(_0x92627a['error']){if(_0x92627a[_0x1abb('0x13')]['code']===0x1f4){logger[_0x1abb('0x13')](_0x1abb('0xe'),_0x598360,_0x92627a[_0x1abb('0x13')][_0x1abb('0x14')]);return _0x3e8c50(_0x92627a['error'][_0x1abb('0x14')]);}logger[_0x1abb('0x13')](_0x1abb('0xe'),_0x598360,_0x92627a[_0x1abb('0x13')][_0x1abb('0x14')]);return _0x4c8457(_0x92627a[_0x1abb('0x13')][_0x1abb('0x14')]);}else{logger[_0x1abb('0xd')](_0x1abb('0xe'),_0x598360,_0x1abb('0xf'));_0x4c8457(_0x92627a[_0x1abb('0x15')]['message']);}})[_0x1abb('0x16')](function(_0x4f6a51){logger[_0x1abb('0x13')](_0x1abb('0xe'),_0x598360,_0x4f6a51);_0x3e8c50(_0x4f6a51);});});} \ No newline at end of file +var _0x6c23=['http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client'];(function(_0x36f1ec,_0x2ae8df){var _0x3f1a27=function(_0xcd054){while(--_0xcd054){_0x36f1ec['push'](_0x36f1ec['shift']());}};_0x3f1a27(++_0x2ae8df);}(_0x6c23,0x146));var _0x36c2=function(_0x4020bc,_0x17bcf4){_0x4020bc=_0x4020bc-0x0;var _0x4bdae2=_0x6c23[_0x4020bc];return _0x4bdae2;};'use strict';var _=require(_0x36c2('0x0'));var util=require(_0x36c2('0x1'));var moment=require(_0x36c2('0x2'));var BPromise=require(_0x36c2('0x3'));var rs=require(_0x36c2('0x4'));var fs=require('fs');var Redis=require(_0x36c2('0x5'));var db=require(_0x36c2('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x36c2('0x7'));var config=require('../../config/environment');var jayson=require(_0x36c2('0x8'));var client=jayson[_0x36c2('0x9')][_0x36c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37ffe5,_0x1bcd4b,_0x249a36){return new BPromise(function(_0x23967c,_0x4e39c4){return client[_0x36c2('0xb')](_0x37ffe5,_0x249a36)['then'](function(_0x2d890e){logger[_0x36c2('0xc')](_0x36c2('0xd'),_0x1bcd4b,_0x36c2('0xe'));logger[_0x36c2('0xf')](_0x36c2('0x10'),_0x1bcd4b,'request\x20sent',JSON[_0x36c2('0x11')](_0x2d890e));if(_0x2d890e[_0x36c2('0x12')]){if(_0x2d890e[_0x36c2('0x12')][_0x36c2('0x13')]===0x1f4){logger[_0x36c2('0x12')](_0x36c2('0xd'),_0x1bcd4b,_0x2d890e[_0x36c2('0x12')][_0x36c2('0x14')]);return _0x4e39c4(_0x2d890e[_0x36c2('0x12')][_0x36c2('0x14')]);}logger[_0x36c2('0x12')](_0x36c2('0xd'),_0x1bcd4b,_0x2d890e[_0x36c2('0x12')]['message']);return _0x23967c(_0x2d890e[_0x36c2('0x12')][_0x36c2('0x14')]);}else{logger[_0x36c2('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1bcd4b,_0x36c2('0xe'));_0x23967c(_0x2d890e['result']['message']);}})['catch'](function(_0x29e392){logger[_0x36c2('0x12')](_0x36c2('0xd'),_0x1bcd4b,_0x29e392);_0x4e39c4(_0x29e392);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 1783372..47b421e 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 _0x265f=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','/:id','isAuthenticated','getSessions','/:id/answers','getSummary','post','create','/:id/clone','put','delete','destroy'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x265f,0x121));var _0xf265=function(_0x5b674c,_0xc560b){_0x5b674c=_0x5b674c-0x0;var _0x3da567=_0x265f[_0x5b674c];return _0x3da567;};'use strict';var multer=require(_0xf265('0x0'));var util=require(_0xf265('0x1'));var path=require(_0xf265('0x2'));var timeout=require(_0xf265('0x3'));var express=require(_0xf265('0x4'));var router=express[_0xf265('0x5')]();var fs_extra=require(_0xf265('0x6'));var auth=require(_0xf265('0x7'));var interaction=require(_0xf265('0x8'));var config=require(_0xf265('0x9'));var controller=require(_0xf265('0xa'));router[_0xf265('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf265('0xb')](_0xf265('0xc'),auth[_0xf265('0xd')](),controller['show']);router[_0xf265('0xb')]('/:id/sessions',auth['isAuthenticated'](),controller[_0xf265('0xe')]);router['get'](_0xf265('0xf'),auth[_0xf265('0xd')](),controller['getAnswers']);router[_0xf265('0xb')]('/:id/summary',auth[_0xf265('0xd')](),timeout('30s'),controller[_0xf265('0x10')]);router[_0xf265('0x11')]('/',auth['isAuthenticated'](),controller[_0xf265('0x12')]);router[_0xf265('0x11')](_0xf265('0x13'),auth['isAuthenticated'](),controller['clone']);router[_0xf265('0x14')](_0xf265('0xc'),auth[_0xf265('0xd')](),controller['update']);router[_0xf265('0x15')](_0xf265('0xc'),auth[_0xf265('0xd')](),controller[_0xf265('0x16')]);module[_0xf265('0x17')]=router; \ No newline at end of file +var _0xbd40=['/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','post','create','/:id/clone','clone','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xbd40,0x17a));var _0x0bd4=function(_0x1ecc77,_0x3a29cf){_0x1ecc77=_0x1ecc77-0x0;var _0x459696=_0xbd40[_0x1ecc77];return _0x459696;};'use strict';var multer=require(_0x0bd4('0x0'));var util=require(_0x0bd4('0x1'));var path=require(_0x0bd4('0x2'));var timeout=require(_0x0bd4('0x3'));var express=require(_0x0bd4('0x4'));var router=express[_0x0bd4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0bd4('0x6'));var interaction=require(_0x0bd4('0x7'));var config=require('../../config/environment');var controller=require(_0x0bd4('0x8'));router[_0x0bd4('0x9')]('/',auth[_0x0bd4('0xa')](),controller[_0x0bd4('0xb')]);router[_0x0bd4('0x9')](_0x0bd4('0xc'),auth[_0x0bd4('0xa')](),controller[_0x0bd4('0xd')]);router[_0x0bd4('0x9')](_0x0bd4('0xe'),auth[_0x0bd4('0xa')](),controller[_0x0bd4('0xf')]);router['get'](_0x0bd4('0x10'),auth['isAuthenticated'](),controller[_0x0bd4('0x11')]);router[_0x0bd4('0x9')](_0x0bd4('0x12'),auth[_0x0bd4('0xa')](),timeout(_0x0bd4('0x13')),controller['getSummary']);router[_0x0bd4('0x14')]('/',auth[_0x0bd4('0xa')](),controller[_0x0bd4('0x15')]);router[_0x0bd4('0x14')](_0x0bd4('0x16'),auth['isAuthenticated'](),controller[_0x0bd4('0x17')]);router[_0x0bd4('0x18')](_0x0bd4('0xc'),auth[_0x0bd4('0xa')](),controller[_0x0bd4('0x19')]);router[_0x0bd4('0x1a')](_0x0bd4('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x0bd4('0x1b')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index b5af27e..4bd8b13 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 _0x9a9f=['isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','STRING','name','TEXT','isObjectLike','setDataValue','formData','stringify'];(function(_0x49b720,_0x10e9f2){var _0x290c1b=function(_0x3d056a){while(--_0x3d056a){_0x49b720['push'](_0x49b720['shift']());}};_0x290c1b(++_0x10e9f2);}(_0x9a9f,0xb6));var _0xf9a9=function(_0x455753,_0x247ae2){_0x455753=_0x455753-0x0;var _0x316806=_0x9a9f[_0x455753];return _0x316806;};'use strict';var Sequelize=require(_0xf9a9('0x0'));var _=require(_0xf9a9('0x1'));var util=require(_0xf9a9('0x2'));module['exports']={'name':{'type':Sequelize[_0xf9a9('0x3')],'unique':_0xf9a9('0x4')},'description':{'type':Sequelize[_0xf9a9('0x3')]},'formData':{'type':Sequelize[_0xf9a9('0x5')]('long'),'set':function(_0x5ce2ec){if(_[_0xf9a9('0x6')](_0x5ce2ec)){this[_0xf9a9('0x7')](_0xf9a9('0x8'),JSON[_0xf9a9('0x9')](_0x5ce2ec));}else if(_[_0xf9a9('0xa')](_0x5ce2ec)){this['setDataValue'](_0xf9a9('0x8'),_0x5ce2ec);}else{this[_0xf9a9('0x7')](_0xf9a9('0x8'),util[_0xf9a9('0xb')](_0xf9a9('0xc'),this[_0xf9a9('0xd')](_0xf9a9('0x4'))||'',this[_0xf9a9('0xd')](_0xf9a9('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xf9a9('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5a61=['formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','lodash','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','stringify'];(function(_0x5e8f17,_0x195558){var _0x6f43fd=function(_0x1d4a55){while(--_0x1d4a55){_0x5e8f17['push'](_0x5e8f17['shift']());}};_0x6f43fd(++_0x195558);}(_0x5a61,0x1c5));var _0x15a6=function(_0x132fc8,_0x4f10c0){_0x132fc8=_0x132fc8-0x0;var _0x194b1d=_0x5a61[_0x132fc8];return _0x194b1d;};'use strict';var Sequelize=require('sequelize');var _=require(_0x15a6('0x0'));var util=require('util');module[_0x15a6('0x1')]={'name':{'type':Sequelize[_0x15a6('0x2')],'unique':_0x15a6('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x15a6('0x4')](_0x15a6('0x5')),'set':function(_0x5ac4bf){if(_[_0x15a6('0x6')](_0x5ac4bf)){this[_0x15a6('0x7')]('formData',JSON[_0x15a6('0x8')](_0x5ac4bf));}else if(_['isString'](_0x5ac4bf)){this['setDataValue'](_0x15a6('0x9'),_0x5ac4bf);}else{this[_0x15a6('0x7')](_0x15a6('0x9'),util[_0x15a6('0xa')](_0x15a6('0xb'),this[_0x15a6('0xc')]('name')||'',this[_0x15a6('0xc')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x15a6('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x15a6('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index d0d1f33..4946f5b 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 _0x2964=['indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','push','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','zip-dir','fast-json-patch','request-promise','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','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','get','UserProfileResource','name','send','index','map','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','JscriptyProject','includeAll','include','rows','catch','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Projects','UserProfileSection','userProfileId','omit','updatedAt','createdAt','autoAssociation','update','destroy','findOne','ProjectId','JscriptySessionReport','findAll','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString'];(function(_0x6a5d4b,_0x4f4e6){var _0x1cad4c=function(_0x299be9){while(--_0x299be9){_0x6a5d4b['push'](_0x6a5d4b['shift']());}};_0x1cad4c(++_0x4f4e6);}(_0x2964,0x108));var _0x4296=function(_0x673ec4,_0x274a45){_0x673ec4=_0x673ec4-0x0;var _0xa3e21e=_0x2964[_0x673ec4];return _0xa3e21e;};'use strict';var emlformat=require(_0x4296('0x0'));var rimraf=require(_0x4296('0x1'));var zipdir=require(_0x4296('0x2'));var jsonpatch=require(_0x4296('0x3'));var rp=require(_0x4296('0x4'));var moment=require(_0x4296('0x5'));var BPromise=require(_0x4296('0x6'));var Mustache=require(_0x4296('0x7'));var util=require(_0x4296('0x8'));var path=require('path');var sox=require(_0x4296('0x9'));var csv=require(_0x4296('0xa'));var ejs=require(_0x4296('0xb'));var fs=require('fs');var fs_extra=require(_0x4296('0xc'));var _=require(_0x4296('0xd'));var squel=require(_0x4296('0xe'));var crypto=require('crypto');var jsforce=require(_0x4296('0xf'));var deskjs=require(_0x4296('0x10'));var toCsv=require(_0x4296('0xa'));var querystring=require(_0x4296('0x11'));var Papa=require(_0x4296('0x12'));var Redis=require(_0x4296('0x13'));var authService=require(_0x4296('0x14'));var qs=require(_0x4296('0x15'));var as=require(_0x4296('0x16'));var hardwareService=require(_0x4296('0x17'));var logger=require(_0x4296('0x18'))(_0x4296('0x19'));var utils=require('../../config/utils');var config=require(_0x4296('0x1a'));var licenseUtil=require(_0x4296('0x1b'));var db=require(_0x4296('0x1c'))['db'];function respondWithStatusCode(_0x367c95,_0x23ba5a){_0x23ba5a=_0x23ba5a||0xcc;return function(_0x676674){if(_0x676674){return _0x367c95[_0x4296('0x1d')](_0x23ba5a);}return _0x367c95['status'](_0x23ba5a)[_0x4296('0x1e')]();};}function respondWithResult(_0x350b4b,_0x3574da){_0x3574da=_0x3574da||0xc8;return function(_0x56b6d7){if(_0x56b6d7){return _0x350b4b[_0x4296('0x1f')](_0x3574da)[_0x4296('0x20')](_0x56b6d7);}};}function respondWithFilteredResult(_0x3f4699,_0x53af4b){return function(_0x182910){if(_0x182910){var _0x2e63c4=typeof _0x53af4b[_0x4296('0x21')]==='undefined'&&typeof _0x53af4b[_0x4296('0x22')]===_0x4296('0x23');var _0x8c0539=_0x182910[_0x4296('0x24')];var _0x7a226f=_0x2e63c4?0x0:_0x53af4b['offset'];var _0x2decf5=_0x2e63c4?_0x182910[_0x4296('0x24')]:_0x53af4b[_0x4296('0x21')]+_0x53af4b['limit'];var _0x13f40f;if(_0x2decf5>=_0x8c0539){_0x2decf5=_0x8c0539;_0x13f40f=0xc8;}else{_0x13f40f=0xce;}_0x3f4699[_0x4296('0x1f')](_0x13f40f);return _0x3f4699[_0x4296('0x25')](_0x4296('0x26'),_0x7a226f+'-'+_0x2decf5+'/'+_0x8c0539)[_0x4296('0x20')](_0x182910);}return null;};}function patchUpdates(_0x336894){return function(_0x4ca11f){try{jsonpatch[_0x4296('0x27')](_0x4ca11f,_0x336894,!![]);}catch(_0x2243ee){return BPromise['reject'](_0x2243ee);}return _0x4ca11f[_0x4296('0x28')]();};}function saveUpdates(_0x3de482,_0x257f51){return function(_0x3c899f){if(_0x3c899f){return _0x3c899f['update'](_0x3de482)['then'](function(_0x2fb2b4){return _0x2fb2b4;});}return null;};}function removeEntity(_0x3902b5,_0x4ce761){return function(_0x179e5d){if(_0x179e5d){return _0x179e5d['destroy']()[_0x4296('0x29')](function(){var _0xd620fa=_0x179e5d[_0x4296('0x2a')]({'plain':!![]});var _0x3d2028='Projects';return db[_0x4296('0x2b')]['destroy']({'where':{'type':_0x3d2028,'resourceId':_0xd620fa['id']}})[_0x4296('0x29')](function(){return _0x179e5d;});})['then'](function(){_0x3902b5['status'](0xcc)[_0x4296('0x1e')]();});}};}function handleEntityNotFound(_0x38a83c,_0x2a2903){return function(_0x4ce4ed){if(!_0x4ce4ed){_0x38a83c[_0x4296('0x1d')](0x194);}return _0x4ce4ed;};}function handleError(_0x3aa23e,_0x5015ce){_0x5015ce=_0x5015ce||0x1f4;return function(_0x30fa22){logger['error'](_0x30fa22['stack']);if(_0x30fa22[_0x4296('0x2c')]){delete _0x30fa22[_0x4296('0x2c')];}_0x3aa23e[_0x4296('0x1f')](_0x5015ce)[_0x4296('0x2d')](_0x30fa22);};}exports[_0x4296('0x2e')]=function(_0x2f9dcd,_0x33df03){var _0x9ac120={},_0x599a74={},_0x1a9b51={'count':0x0,'rows':[]};var _0x584ca4=_[_0x4296('0x2f')](db['JscriptyProject']['rawAttributes'],function(_0x1afd71){return{'name':_0x1afd71['fieldName'],'type':_0x1afd71[_0x4296('0x30')][_0x4296('0x31')]};});_0x599a74[_0x4296('0x32')]=_[_0x4296('0x2f')](_0x584ca4,_0x4296('0x2c'));_0x599a74[_0x4296('0x33')]=_[_0x4296('0x34')](_0x2f9dcd[_0x4296('0x33')]);_0x599a74[_0x4296('0x35')]=_[_0x4296('0x36')](_0x599a74[_0x4296('0x32')],_0x599a74['query']);_0x9ac120['attributes']=_[_0x4296('0x36')](_0x599a74[_0x4296('0x32')],qs[_0x4296('0x37')](_0x2f9dcd[_0x4296('0x33')]['fields']));_0x9ac120['attributes']=_0x9ac120[_0x4296('0x38')][_0x4296('0x39')]?_0x9ac120[_0x4296('0x38')]:_0x599a74[_0x4296('0x32')];if(!_0x2f9dcd['query'][_0x4296('0x3a')](_0x4296('0x3b'))){_0x9ac120['limit']=qs['limit'](_0x2f9dcd['query'][_0x4296('0x22')]);_0x9ac120[_0x4296('0x21')]=qs['offset'](_0x2f9dcd[_0x4296('0x33')][_0x4296('0x21')]);}_0x9ac120[_0x4296('0x3c')]=qs[_0x4296('0x3d')](_0x2f9dcd[_0x4296('0x33')][_0x4296('0x3d')]);_0x9ac120[_0x4296('0x3e')]=qs[_0x4296('0x35')](_[_0x4296('0x3f')](_0x2f9dcd[_0x4296('0x33')],_0x599a74[_0x4296('0x35')]),_0x584ca4);if(_0x2f9dcd[_0x4296('0x33')][_0x4296('0x40')]){_0x9ac120['where']=_[_0x4296('0x41')](_0x9ac120[_0x4296('0x3e')],{'$or':_[_0x4296('0x2f')](_0x584ca4,function(_0x2d153c){if(_0x2d153c[_0x4296('0x30')]!==_0x4296('0x42')){var _0x552bdc={};_0x552bdc[_0x2d153c[_0x4296('0x2c')]]={'$like':'%'+_0x2f9dcd[_0x4296('0x33')][_0x4296('0x40')]+'%'};return _0x552bdc;}})});}_0x9ac120=_['merge']({},_0x9ac120,_0x2f9dcd[_0x4296('0x43')]);var _0x53a825={'where':_0x9ac120[_0x4296('0x3e')]};return db[_0x4296('0x44')][_0x4296('0x24')](_0x53a825)[_0x4296('0x29')](function(_0x344eb5){_0x1a9b51[_0x4296('0x24')]=_0x344eb5;if(_0x2f9dcd['query'][_0x4296('0x45')]){_0x9ac120[_0x4296('0x46')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x9ac120);})[_0x4296('0x29')](function(_0x3fffd3){_0x1a9b51[_0x4296('0x47')]=_0x3fffd3;return _0x1a9b51;})[_0x4296('0x29')](respondWithFilteredResult(_0x33df03,_0x9ac120))[_0x4296('0x48')](handleError(_0x33df03,null));};exports['show']=function(_0x504227,_0x456c19){var _0x28a74b={'raw':![],'where':{'id':_0x504227[_0x4296('0x49')]['id']}},_0x2d86a1={};_0x2d86a1[_0x4296('0x32')]=_[_0x4296('0x34')](db[_0x4296('0x44')][_0x4296('0x4a')]);_0x2d86a1[_0x4296('0x33')]=_['keys'](_0x504227[_0x4296('0x33')]);_0x2d86a1[_0x4296('0x35')]=_[_0x4296('0x36')](_0x2d86a1['model'],_0x2d86a1[_0x4296('0x33')]);_0x28a74b[_0x4296('0x38')]=_['intersection'](_0x2d86a1['model'],qs[_0x4296('0x37')](_0x504227[_0x4296('0x33')][_0x4296('0x37')]));_0x28a74b['attributes']=_0x28a74b['attributes']['length']?_0x28a74b[_0x4296('0x38')]:_0x2d86a1[_0x4296('0x32')];if(_0x504227[_0x4296('0x33')]['includeAll']){_0x28a74b['include']=[{'all':!![]}];}_0x28a74b=_[_0x4296('0x41')]({},_0x28a74b,_0x504227[_0x4296('0x43')]);return db[_0x4296('0x44')][_0x4296('0x4b')](_0x28a74b)[_0x4296('0x29')](handleEntityNotFound(_0x456c19,null))[_0x4296('0x29')](respondWithResult(_0x456c19,null))[_0x4296('0x48')](handleError(_0x456c19,null));};exports[_0x4296('0x4c')]=function(_0x598292,_0x419cab){return db[_0x4296('0x44')][_0x4296('0x4c')](_0x598292[_0x4296('0x4d')],{})[_0x4296('0x29')](function(_0x42de58){var _0x5ac423=_0x598292['user']['get']({'plain':!![]});if(!_0x5ac423)throw new Error(_0x4296('0x4e'));if(_0x5ac423[_0x4296('0x4f')]===_0x4296('0x50')){var _0x33a02b=_0x42de58['get']({'plain':!![]});var _0x2ac96d=_0x4296('0x51');return db[_0x4296('0x52')][_0x4296('0x4b')]({'where':{'name':_0x2ac96d,'userProfileId':_0x5ac423[_0x4296('0x53')]},'raw':!![]})[_0x4296('0x29')](function(_0x218136){if(_0x218136&&_0x218136['autoAssociation']===0x0){return db[_0x4296('0x2b')]['create']({'name':_0x33a02b['name'],'resourceId':_0x33a02b['id'],'type':_0x218136[_0x4296('0x2c')],'sectionId':_0x218136['id']},{})[_0x4296('0x29')](function(){return _0x42de58;});}else{return _0x42de58;}})['catch'](function(_0x17e212){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17e212);throw _0x17e212;});}return _0x42de58;})[_0x4296('0x29')](respondWithResult(_0x419cab,0xc9))[_0x4296('0x48')](handleError(_0x419cab,null));};exports['clone']=function(_0x4faac4,_0x4691b4){var _0x2b82b1={'where':{'id':_0x4faac4[_0x4296('0x49')]['id']}},_0x57e01f={};_0x57e01f[_0x4296('0x32')]=_['keys'](db[_0x4296('0x44')][_0x4296('0x4a')]);_0x2b82b1['attributes']=_[_0x4296('0x36')](_0x57e01f[_0x4296('0x32')],qs[_0x4296('0x37')](_0x4faac4[_0x4296('0x33')][_0x4296('0x37')]));_0x2b82b1[_0x4296('0x38')]=_0x2b82b1['attributes'][_0x4296('0x39')]?_0x2b82b1[_0x4296('0x38')]:_0x57e01f[_0x4296('0x32')];if(_0x4faac4[_0x4296('0x33')]['includeAll']){_0x2b82b1['include']=[{'all':!![]}];}_0x2b82b1=_[_0x4296('0x41')]({},_0x2b82b1,_0x4faac4[_0x4296('0x43')]);return db['JscriptyProject'][_0x4296('0x4b')](_0x2b82b1)[_0x4296('0x29')](handleEntityNotFound(_0x4691b4,null))[_0x4296('0x29')](function(_0x45673f){if(_0x45673f){var _0x467a14=_0x45673f['get']({'plain':!![]});_0x467a14=qs[_0x4296('0x54')](_0x467a14,['id','createdAt',_0x4296('0x55')]);_0x4faac4['body']=_[_0x4296('0x54')](_0x4faac4[_0x4296('0x4d')],['id',_0x4296('0x56'),_0x4296('0x55')]);return db[_0x4296('0x44')][_0x4296('0x4c')](_[_0x4296('0x41')](_0x467a14,_0x4faac4[_0x4296('0x4d')]),{'include':_0x4faac4['query'][_0x4296('0x45')]?[{'all':!![]}]:undefined})[_0x4296('0x29')](function(_0x128f96){var _0x40dbcc=_0x4faac4['user'][_0x4296('0x2a')]({'plain':!![]});if(!_0x40dbcc)throw new Error(_0x4296('0x4e'));if(_0x40dbcc[_0x4296('0x4f')]===_0x4296('0x50')){var _0xd84151=_0x128f96[_0x4296('0x2a')]({'plain':!![]});var _0x309389=_0x4296('0x51');return db[_0x4296('0x52')][_0x4296('0x4b')]({'where':{'name':_0x309389,'userProfileId':_0x40dbcc[_0x4296('0x53')]},'raw':!![]})[_0x4296('0x29')](function(_0x3841c1){if(_0x3841c1&&_0x3841c1[_0x4296('0x57')]===0x0){return db[_0x4296('0x2b')]['create']({'name':_0xd84151[_0x4296('0x2c')],'resourceId':_0xd84151['id'],'type':_0x3841c1[_0x4296('0x2c')],'sectionId':_0x3841c1['id']},{})[_0x4296('0x29')](function(){return _0x128f96;});}else{return _0x128f96;}})[_0x4296('0x48')](function(_0x6e3e2e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x6e3e2e);throw _0x6e3e2e;});}return _0x128f96;});}})[_0x4296('0x29')](respondWithResult(_0x4691b4,0xc9))[_0x4296('0x48')](handleError(_0x4691b4,null));};exports[_0x4296('0x58')]=function(_0x24054b,_0x36aee5){if(_0x24054b[_0x4296('0x4d')]['id']){delete _0x24054b[_0x4296('0x4d')]['id'];}return db['JscriptyProject']['find']({'where':{'id':_0x24054b['params']['id']}})[_0x4296('0x29')](handleEntityNotFound(_0x36aee5,null))[_0x4296('0x29')](saveUpdates(_0x24054b[_0x4296('0x4d')],null))['then'](respondWithResult(_0x36aee5,null))[_0x4296('0x48')](handleError(_0x36aee5,null));};exports[_0x4296('0x59')]=function(_0x281628,_0x1753d4){return db['JscriptyProject'][_0x4296('0x4b')]({'where':{'id':_0x281628[_0x4296('0x49')]['id']}})[_0x4296('0x29')](handleEntityNotFound(_0x1753d4,null))['then'](removeEntity(_0x1753d4,null))[_0x4296('0x48')](handleError(_0x1753d4,null));};exports['getSessions']=function(_0x912d9b,_0x538228,_0x5b76e8){var _0x3147da={'raw':!![],'where':{}};var _0x522a45={};var _0x171ffb={'count':0x0,'rows':[]};return db[_0x4296('0x44')][_0x4296('0x5a')]({'where':{'id':_0x912d9b[_0x4296('0x49')]['id']}})[_0x4296('0x29')](handleEntityNotFound(_0x538228,null))[_0x4296('0x29')](function(_0x7984a8){if(_0x7984a8){_0x522a45['model']=_[_0x4296('0x34')](db['JscriptySessionReport'][_0x4296('0x4a')]);_0x522a45['query']=_['keys'](_0x912d9b[_0x4296('0x33')]);_0x522a45['filters']=_[_0x4296('0x36')](_0x522a45['model'],_0x522a45['query']);_0x3147da[_0x4296('0x38')]=_[_0x4296('0x36')](_0x522a45['model'],qs[_0x4296('0x37')](_0x912d9b[_0x4296('0x33')]['fields']));_0x3147da[_0x4296('0x38')]=_0x3147da[_0x4296('0x38')]['length']?_0x3147da[_0x4296('0x38')]:_0x522a45[_0x4296('0x32')];if(!_0x912d9b[_0x4296('0x33')][_0x4296('0x3a')](_0x4296('0x3b'))){_0x3147da[_0x4296('0x22')]=qs['limit'](_0x912d9b[_0x4296('0x33')][_0x4296('0x22')]);_0x3147da[_0x4296('0x21')]=qs[_0x4296('0x21')](_0x912d9b[_0x4296('0x33')][_0x4296('0x21')]);}_0x3147da[_0x4296('0x3c')]=qs['sort'](_0x912d9b[_0x4296('0x33')][_0x4296('0x3d')]);_0x3147da[_0x4296('0x3e')]=qs[_0x4296('0x35')](_[_0x4296('0x3f')](_0x912d9b[_0x4296('0x33')],_0x522a45[_0x4296('0x35')]));_0x3147da[_0x4296('0x3e')][_0x4296('0x5b')]=_0x7984a8['id'];if(_0x912d9b[_0x4296('0x33')][_0x4296('0x40')]){_0x3147da['where']=_[_0x4296('0x41')](_0x3147da[_0x4296('0x3e')],{'$or':_[_0x4296('0x2f')](_0x3147da[_0x4296('0x38')],function(_0x4a901b){var _0x26754f={};_0x26754f[_0x4a901b]={'$like':'%'+_0x912d9b['query'][_0x4296('0x40')]+'%'};return _0x26754f;})});}_0x3147da=_[_0x4296('0x41')]({},_0x3147da,_0x912d9b[_0x4296('0x43')]);return db['JscriptySessionReport']['count']({'where':_0x3147da[_0x4296('0x3e')]})['then'](function(_0x515193){_0x171ffb[_0x4296('0x24')]=_0x515193;if(_0x912d9b[_0x4296('0x33')][_0x4296('0x45')]){_0x3147da[_0x4296('0x46')]=[{'all':!![]}];}return db[_0x4296('0x5c')][_0x4296('0x5d')](_0x3147da);})[_0x4296('0x29')](function(_0x4eea76){_0x171ffb['rows']=_0x4eea76;return _0x171ffb;});}})[_0x4296('0x29')](respondWithFilteredResult(_0x538228,_0x3147da))[_0x4296('0x48')](handleError(_0x538228,null));};exports[_0x4296('0x5e')]=function(_0x8f0bd6,_0x532980,_0x294dc7){var _0x33d0fa={'raw':!![],'where':{}};var _0x21b0e7={};var _0x1dadb6={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x4296('0x5a')]({'where':{'id':_0x8f0bd6[_0x4296('0x49')]['id']}})[_0x4296('0x29')](handleEntityNotFound(_0x532980,null))[_0x4296('0x29')](function(_0x43316b){if(_0x43316b){_0x21b0e7[_0x4296('0x32')]=_[_0x4296('0x34')](db[_0x4296('0x5f')][_0x4296('0x4a')]);_0x21b0e7[_0x4296('0x33')]=_[_0x4296('0x34')](_0x8f0bd6[_0x4296('0x33')]);_0x21b0e7[_0x4296('0x35')]=_[_0x4296('0x36')](_0x21b0e7[_0x4296('0x32')],_0x21b0e7[_0x4296('0x33')]);_0x33d0fa[_0x4296('0x38')]=_[_0x4296('0x36')](_0x21b0e7[_0x4296('0x32')],qs[_0x4296('0x37')](_0x8f0bd6[_0x4296('0x33')][_0x4296('0x37')]));_0x33d0fa['attributes']=_0x33d0fa['attributes']['length']?_0x33d0fa[_0x4296('0x38')]:_0x21b0e7[_0x4296('0x32')];if(!_0x8f0bd6['query'][_0x4296('0x3a')](_0x4296('0x3b'))){_0x33d0fa[_0x4296('0x22')]=qs[_0x4296('0x22')](_0x8f0bd6['query'][_0x4296('0x22')]);_0x33d0fa[_0x4296('0x21')]=qs['offset'](_0x8f0bd6[_0x4296('0x33')][_0x4296('0x21')]);}_0x33d0fa['order']=qs[_0x4296('0x3d')](_0x8f0bd6[_0x4296('0x33')][_0x4296('0x3d')]);_0x33d0fa['where']=qs[_0x4296('0x35')](_[_0x4296('0x3f')](_0x8f0bd6[_0x4296('0x33')],_0x21b0e7[_0x4296('0x35')]));_0x33d0fa[_0x4296('0x3e')]['ProjectId']=_0x43316b['id'];if(_0x8f0bd6[_0x4296('0x33')][_0x4296('0x40')]){_0x33d0fa['where']=_[_0x4296('0x41')](_0x33d0fa[_0x4296('0x3e')],{'$or':_['map'](_0x33d0fa['attributes'],function(_0x12d001){var _0x46a875={};_0x46a875[_0x12d001]={'$like':'%'+_0x8f0bd6['query']['filter']+'%'};return _0x46a875;})});}_0x33d0fa=_[_0x4296('0x41')]({},_0x33d0fa,_0x8f0bd6['options']);return db['JscriptyAnswerReport'][_0x4296('0x24')]({'where':_0x33d0fa['where']})[_0x4296('0x29')](function(_0x5e0cdb){_0x1dadb6[_0x4296('0x24')]=_0x5e0cdb;if(_0x8f0bd6[_0x4296('0x33')]['includeAll']){_0x33d0fa[_0x4296('0x46')]=[{'all':!![]}];}return db[_0x4296('0x5f')][_0x4296('0x5d')](_0x33d0fa);})[_0x4296('0x29')](function(_0x2c4917){_0x1dadb6[_0x4296('0x47')]=_0x2c4917;return _0x1dadb6;});}})[_0x4296('0x29')](respondWithFilteredResult(_0x532980,_0x33d0fa))[_0x4296('0x48')](handleError(_0x532980,null));};function char(_0x3cfdac){return _0x4296('0x60')===typeof _0x3cfdac?String[_0x4296('0x61')]['apply'](null,arguments):_0x3cfdac;}function needsEncapsulation(_0x14b928){return!!_0x14b928&&(_0x14b928[_0x4296('0x62')]()['indexOf'](char(0xd))>=0x0||_0x14b928[_0x4296('0x62')]()[_0x4296('0x63')](char(0xa))>=0x0||_0x14b928[_0x4296('0x62')]()[_0x4296('0x63')](char(0x2c))>=0x0||_0x14b928[_0x4296('0x62')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x158102){var _0x4f0aa3=char(0x22),_0x50fb34='\x5c'+char(0x22),_0x2823d6=_0x158102[_0x4296('0x62')]()[_0x4296('0x64')](new RegExp(_0x4f0aa3,'g'),_0x50fb34);return _0x4f0aa3+_0x2823d6+_0x4f0aa3;}exports[_0x4296('0x65')]=function(_0x834988,_0x34f748,_0x53c8f0){var _0x466c75,_0x58b411;var _0x59fbc3={'where':{'ProjectId':_0x834988[_0x4296('0x49')]['id']}};if(_0x834988[_0x4296('0x33')][_0x4296('0x66')]){_0x59fbc3['where']['starttime']=JSON[_0x4296('0x67')](_0x834988[_0x4296('0x33')]['startTime']);}return db[_0x4296('0x5c')][_0x4296('0x5d')](_0x59fbc3)['then'](handleEntityNotFound(_0x34f748,null))['then'](function(_0x1f7ff8){if(_0x1f7ff8){_0x466c75=_0x1f7ff8;return db[_0x4296('0x68')][_0x4296('0x5d')]({'where':{'SessionId':{'$in':_[_0x4296('0x2f')](_0x466c75,'id')},'ProjectId':_0x834988['params']['id']},'order':_0x4296('0x69')});}})[_0x4296('0x29')](handleEntityNotFound(_0x34f748,null))['then'](function(_0x29f3a7){if(_0x29f3a7){_0x58b411=_0x29f3a7;var _0x4e8540={};for(var _0x1dfd3a=0x0,_0x465ce2=_0x58b411[_0x4296('0x39')];_0x1dfd3a<_0x465ce2;_0x1dfd3a++){if(!_0x4e8540['hasOwnProperty'](_0x58b411[_0x1dfd3a]['questionId'])){_0x4e8540[_0x58b411[_0x1dfd3a][_0x4296('0x6a')]]=needsEncapsulation(_0x58b411[_0x1dfd3a][_0x4296('0x6b')])?encapsulate(_0x58b411[_0x1dfd3a][_0x4296('0x6b')]):_0x58b411[_0x1dfd3a][_0x4296('0x6b')];}}var _0x912ddf=[],_0x3c50dc={};for(var _0x859b54=0x0,_0x4487bc=_0x466c75['length'];_0x859b54<_0x4487bc;_0x859b54++){_0x3c50dc={'ProjectId':_0x834988[_0x4296('0x49')]['id'],'SessionId':_0x466c75[_0x859b54]['id'],'StartTime':moment(_0x466c75[_0x859b54]['starttime'])[_0x4296('0x6c')](_0x4296('0x6d'))};for(var _0x47af12=0x0,_0x14d612=_0x58b411[_0x4296('0x39')];_0x47af12<_0x14d612;_0x47af12++){if(_0x58b411[_0x47af12]['SessionId']==_0x466c75[_0x859b54]['id']&&_0x4e8540[_0x4296('0x3a')](_0x58b411[_0x47af12]['questionId'])){_0x3c50dc[_0x4e8540[_0x58b411[_0x47af12][_0x4296('0x6a')]]]=_0x58b411[_0x47af12][_0x4296('0x6e')];}}for(var _0x4b5fa0 in _0x4e8540){if(!_0x3c50dc[_0x4296('0x3a')](_0x4e8540[_0x4b5fa0])){_0x3c50dc[_0x4e8540[_0x4b5fa0]]=null;}}_0x912ddf[_0x4296('0x6f')](_0x3c50dc);}return _0x912ddf;}})[_0x4296('0x29')](function(_0x404174){if(!_[_0x4296('0x70')](_0x404174)){var _0xb5e199=toCsv(_0x404174);var _0x404703=Date[_0x4296('0x71')]();fs[_0x4296('0x72')](util['format'](_0x4296('0x73'),_0x834988[_0x4296('0x49')]['id'],_0x404703),_0xb5e199);_0x34f748['setHeader'](_0x4296('0x74'),'attachment;\x20filename='+util['format'](_0x4296('0x75'),_0x834988[_0x4296('0x49')]['id'],_0x404703));_0x34f748[_0x4296('0x76')](_0x4296('0x77'),'text/csv');return _0x34f748[_0x4296('0x78')](util[_0x4296('0x6c')](_0x4296('0x73'),_0x834988[_0x4296('0x49')]['id'],_0x404703));}else{return _0x34f748[_0x4296('0x1d')](0xcc);}})['catch'](handleError(_0x34f748,null));}; \ No newline at end of file +var _0xa1aa=['length','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','getSessions','findOne','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','fromCharCode','toString','indexOf','replace','getSummary','starttime','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','hasOwnProperty','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','../../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','limit','count','set','apply','reject','save','update','destroy','then','get','Projects','UserProfileResource','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields'];(function(_0x3a54b0,_0x4a0371){var _0x14cae0=function(_0x574290){while(--_0x574290){_0x3a54b0['push'](_0x3a54b0['shift']());}};_0x14cae0(++_0x4a0371);}(_0xa1aa,0x19b));var _0xaa1a=function(_0x98f101,_0x5301d5){_0x98f101=_0x98f101-0x0;var _0x390883=_0xa1aa[_0x98f101];return _0x390883;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaa1a('0x0'));var zipdir=require(_0xaa1a('0x1'));var jsonpatch=require(_0xaa1a('0x2'));var rp=require(_0xaa1a('0x3'));var moment=require(_0xaa1a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaa1a('0x5'));var path=require(_0xaa1a('0x6'));var sox=require('sox');var csv=require(_0xaa1a('0x7'));var ejs=require(_0xaa1a('0x8'));var fs=require('fs');var fs_extra=require(_0xaa1a('0x9'));var _=require('lodash');var squel=require(_0xaa1a('0xa'));var crypto=require('crypto');var jsforce=require(_0xaa1a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xaa1a('0x7'));var querystring=require(_0xaa1a('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaa1a('0xd'));var qs=require(_0xaa1a('0xe'));var as=require(_0xaa1a('0xf'));var hardwareService=require(_0xaa1a('0x10'));var logger=require('../../config/logger')(_0xaa1a('0x11'));var utils=require(_0xaa1a('0x12'));var config=require(_0xaa1a('0x13'));var licenseUtil=require(_0xaa1a('0x14'));var db=require(_0xaa1a('0x15'))['db'];function respondWithStatusCode(_0x278079,_0x25ae41){_0x25ae41=_0x25ae41||0xcc;return function(_0x2f018d){if(_0x2f018d){return _0x278079[_0xaa1a('0x16')](_0x25ae41);}return _0x278079[_0xaa1a('0x17')](_0x25ae41)['end']();};}function respondWithResult(_0x5b131c,_0x38715a){_0x38715a=_0x38715a||0xc8;return function(_0x3a577f){if(_0x3a577f){return _0x5b131c[_0xaa1a('0x17')](_0x38715a)[_0xaa1a('0x18')](_0x3a577f);}};}function respondWithFilteredResult(_0x43bd93,_0x5da087){return function(_0x90ef70){if(_0x90ef70){var _0x480a27=typeof _0x5da087[_0xaa1a('0x19')]===_0xaa1a('0x1a')&&typeof _0x5da087[_0xaa1a('0x1b')]===_0xaa1a('0x1a');var _0x5ba030=_0x90ef70['count'];var _0x1b3174=_0x480a27?0x0:_0x5da087[_0xaa1a('0x19')];var _0x56ff91=_0x480a27?_0x90ef70[_0xaa1a('0x1c')]:_0x5da087[_0xaa1a('0x19')]+_0x5da087[_0xaa1a('0x1b')];var _0x120080;if(_0x56ff91>=_0x5ba030){_0x56ff91=_0x5ba030;_0x120080=0xc8;}else{_0x120080=0xce;}_0x43bd93[_0xaa1a('0x17')](_0x120080);return _0x43bd93[_0xaa1a('0x1d')]('Content-Range',_0x1b3174+'-'+_0x56ff91+'/'+_0x5ba030)[_0xaa1a('0x18')](_0x90ef70);}return null;};}function patchUpdates(_0x400a06){return function(_0x8586aa){try{jsonpatch[_0xaa1a('0x1e')](_0x8586aa,_0x400a06,!![]);}catch(_0x2c0238){return BPromise[_0xaa1a('0x1f')](_0x2c0238);}return _0x8586aa[_0xaa1a('0x20')]();};}function saveUpdates(_0x5c01b2,_0xa32c54){return function(_0x282f07){if(_0x282f07){return _0x282f07[_0xaa1a('0x21')](_0x5c01b2)['then'](function(_0x262f83){return _0x262f83;});}return null;};}function removeEntity(_0x15b366,_0x583c90){return function(_0x4accdf){if(_0x4accdf){return _0x4accdf[_0xaa1a('0x22')]()[_0xaa1a('0x23')](function(){var _0xd3225b=_0x4accdf[_0xaa1a('0x24')]({'plain':!![]});var _0x582843=_0xaa1a('0x25');return db[_0xaa1a('0x26')]['destroy']({'where':{'type':_0x582843,'resourceId':_0xd3225b['id']}})[_0xaa1a('0x23')](function(){return _0x4accdf;});})[_0xaa1a('0x23')](function(){_0x15b366[_0xaa1a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43688f,_0x2d1c8f){return function(_0x1b1b67){if(!_0x1b1b67){_0x43688f[_0xaa1a('0x16')](0x194);}return _0x1b1b67;};}function handleError(_0x3f29a8,_0x380a5a){_0x380a5a=_0x380a5a||0x1f4;return function(_0x26fdea){logger['error'](_0x26fdea['stack']);if(_0x26fdea['name']){delete _0x26fdea[_0xaa1a('0x27')];}_0x3f29a8[_0xaa1a('0x17')](_0x380a5a)[_0xaa1a('0x28')](_0x26fdea);};}exports[_0xaa1a('0x29')]=function(_0x559050,_0x14a189){var _0x22ba1d={},_0x2767be={},_0x22b4e3={'count':0x0,'rows':[]};var _0x13afce=_[_0xaa1a('0x2a')](db[_0xaa1a('0x2b')][_0xaa1a('0x2c')],function(_0x2a0d68){return{'name':_0x2a0d68[_0xaa1a('0x2d')],'type':_0x2a0d68[_0xaa1a('0x2e')][_0xaa1a('0x2f')]};});_0x2767be[_0xaa1a('0x30')]=_[_0xaa1a('0x2a')](_0x13afce,_0xaa1a('0x27'));_0x2767be['query']=_['keys'](_0x559050[_0xaa1a('0x31')]);_0x2767be['filters']=_[_0xaa1a('0x32')](_0x2767be[_0xaa1a('0x30')],_0x2767be[_0xaa1a('0x31')]);_0x22ba1d[_0xaa1a('0x33')]=_[_0xaa1a('0x32')](_0x2767be[_0xaa1a('0x30')],qs['fields'](_0x559050[_0xaa1a('0x31')][_0xaa1a('0x34')]));_0x22ba1d[_0xaa1a('0x33')]=_0x22ba1d[_0xaa1a('0x33')][_0xaa1a('0x35')]?_0x22ba1d[_0xaa1a('0x33')]:_0x2767be[_0xaa1a('0x30')];if(!_0x559050[_0xaa1a('0x31')]['hasOwnProperty'](_0xaa1a('0x36'))){_0x22ba1d[_0xaa1a('0x1b')]=qs[_0xaa1a('0x1b')](_0x559050[_0xaa1a('0x31')][_0xaa1a('0x1b')]);_0x22ba1d[_0xaa1a('0x19')]=qs[_0xaa1a('0x19')](_0x559050[_0xaa1a('0x31')][_0xaa1a('0x19')]);}_0x22ba1d[_0xaa1a('0x37')]=qs[_0xaa1a('0x38')](_0x559050[_0xaa1a('0x31')][_0xaa1a('0x38')]);_0x22ba1d[_0xaa1a('0x39')]=qs[_0xaa1a('0x3a')](_[_0xaa1a('0x3b')](_0x559050['query'],_0x2767be['filters']),_0x13afce);if(_0x559050[_0xaa1a('0x31')][_0xaa1a('0x3c')]){_0x22ba1d[_0xaa1a('0x39')]=_[_0xaa1a('0x3d')](_0x22ba1d[_0xaa1a('0x39')],{'$or':_[_0xaa1a('0x2a')](_0x13afce,function(_0x48f1b3){if(_0x48f1b3[_0xaa1a('0x2e')]!=='VIRTUAL'){var _0x3da635={};_0x3da635[_0x48f1b3['name']]={'$like':'%'+_0x559050[_0xaa1a('0x31')][_0xaa1a('0x3c')]+'%'};return _0x3da635;}})});}_0x22ba1d=_[_0xaa1a('0x3d')]({},_0x22ba1d,_0x559050[_0xaa1a('0x3e')]);var _0x5f0170={'where':_0x22ba1d['where']};return db[_0xaa1a('0x2b')][_0xaa1a('0x1c')](_0x5f0170)['then'](function(_0x27971e){_0x22b4e3[_0xaa1a('0x1c')]=_0x27971e;if(_0x559050['query']['includeAll']){_0x22ba1d[_0xaa1a('0x3f')]=[{'all':!![]}];}return db['JscriptyProject'][_0xaa1a('0x40')](_0x22ba1d);})[_0xaa1a('0x23')](function(_0x30011d){_0x22b4e3[_0xaa1a('0x41')]=_0x30011d;return _0x22b4e3;})[_0xaa1a('0x23')](respondWithFilteredResult(_0x14a189,_0x22ba1d))[_0xaa1a('0x42')](handleError(_0x14a189,null));};exports['show']=function(_0x54f7bd,_0x4a2a49){var _0x5ce7f1={'raw':![],'where':{'id':_0x54f7bd['params']['id']}},_0x27fcfd={};_0x27fcfd[_0xaa1a('0x30')]=_[_0xaa1a('0x43')](db[_0xaa1a('0x2b')][_0xaa1a('0x2c')]);_0x27fcfd[_0xaa1a('0x31')]=_[_0xaa1a('0x43')](_0x54f7bd[_0xaa1a('0x31')]);_0x27fcfd[_0xaa1a('0x3a')]=_[_0xaa1a('0x32')](_0x27fcfd[_0xaa1a('0x30')],_0x27fcfd[_0xaa1a('0x31')]);_0x5ce7f1['attributes']=_[_0xaa1a('0x32')](_0x27fcfd[_0xaa1a('0x30')],qs[_0xaa1a('0x34')](_0x54f7bd['query'][_0xaa1a('0x34')]));_0x5ce7f1['attributes']=_0x5ce7f1[_0xaa1a('0x33')][_0xaa1a('0x35')]?_0x5ce7f1[_0xaa1a('0x33')]:_0x27fcfd[_0xaa1a('0x30')];if(_0x54f7bd['query'][_0xaa1a('0x44')]){_0x5ce7f1[_0xaa1a('0x3f')]=[{'all':!![]}];}_0x5ce7f1=_[_0xaa1a('0x3d')]({},_0x5ce7f1,_0x54f7bd[_0xaa1a('0x3e')]);return db[_0xaa1a('0x2b')][_0xaa1a('0x45')](_0x5ce7f1)[_0xaa1a('0x23')](handleEntityNotFound(_0x4a2a49,null))[_0xaa1a('0x23')](respondWithResult(_0x4a2a49,null))[_0xaa1a('0x42')](handleError(_0x4a2a49,null));};exports['create']=function(_0x9a63c0,_0x4327b9){return db[_0xaa1a('0x2b')][_0xaa1a('0x46')](_0x9a63c0[_0xaa1a('0x47')],{})[_0xaa1a('0x23')](function(_0x1aad3a){var _0x3a19be=_0x9a63c0[_0xaa1a('0x48')][_0xaa1a('0x24')]({'plain':!![]});if(!_0x3a19be)throw new Error(_0xaa1a('0x49'));if(_0x3a19be[_0xaa1a('0x4a')]===_0xaa1a('0x48')){var _0x169e85=_0x1aad3a[_0xaa1a('0x24')]({'plain':!![]});var _0x42c5e5=_0xaa1a('0x25');return db[_0xaa1a('0x4b')]['find']({'where':{'name':_0x42c5e5,'userProfileId':_0x3a19be[_0xaa1a('0x4c')]},'raw':!![]})[_0xaa1a('0x23')](function(_0x1b0596){if(_0x1b0596&&_0x1b0596['autoAssociation']===0x0){return db['UserProfileResource'][_0xaa1a('0x46')]({'name':_0x169e85['name'],'resourceId':_0x169e85['id'],'type':_0x1b0596[_0xaa1a('0x27')],'sectionId':_0x1b0596['id']},{})['then'](function(){return _0x1aad3a;});}else{return _0x1aad3a;}})[_0xaa1a('0x42')](function(_0x5bad29){logger[_0xaa1a('0x4d')](_0xaa1a('0x4e'),_0x5bad29);throw _0x5bad29;});}return _0x1aad3a;})[_0xaa1a('0x23')](respondWithResult(_0x4327b9,0xc9))[_0xaa1a('0x42')](handleError(_0x4327b9,null));};exports[_0xaa1a('0x4f')]=function(_0x4fc334,_0x57550d){var _0x4cd226={'where':{'id':_0x4fc334[_0xaa1a('0x50')]['id']}},_0x2ce080={};_0x2ce080[_0xaa1a('0x30')]=_['keys'](db[_0xaa1a('0x2b')][_0xaa1a('0x2c')]);_0x4cd226['attributes']=_['intersection'](_0x2ce080[_0xaa1a('0x30')],qs[_0xaa1a('0x34')](_0x4fc334[_0xaa1a('0x31')][_0xaa1a('0x34')]));_0x4cd226[_0xaa1a('0x33')]=_0x4cd226[_0xaa1a('0x33')][_0xaa1a('0x35')]?_0x4cd226[_0xaa1a('0x33')]:_0x2ce080[_0xaa1a('0x30')];if(_0x4fc334[_0xaa1a('0x31')][_0xaa1a('0x44')]){_0x4cd226[_0xaa1a('0x3f')]=[{'all':!![]}];}_0x4cd226=_['merge']({},_0x4cd226,_0x4fc334[_0xaa1a('0x3e')]);return db['JscriptyProject'][_0xaa1a('0x45')](_0x4cd226)[_0xaa1a('0x23')](handleEntityNotFound(_0x57550d,null))['then'](function(_0x55ad1f){if(_0x55ad1f){var _0xc0cbb8=_0x55ad1f['get']({'plain':!![]});_0xc0cbb8=qs[_0xaa1a('0x51')](_0xc0cbb8,['id',_0xaa1a('0x52'),_0xaa1a('0x53')]);_0x4fc334[_0xaa1a('0x47')]=_[_0xaa1a('0x51')](_0x4fc334[_0xaa1a('0x47')],['id',_0xaa1a('0x52'),_0xaa1a('0x53')]);return db['JscriptyProject'][_0xaa1a('0x46')](_[_0xaa1a('0x3d')](_0xc0cbb8,_0x4fc334['body']),{'include':_0x4fc334[_0xaa1a('0x31')][_0xaa1a('0x44')]?[{'all':!![]}]:undefined})[_0xaa1a('0x23')](function(_0x27aa45){var _0x1c5550=_0x4fc334[_0xaa1a('0x48')]['get']({'plain':!![]});if(!_0x1c5550)throw new Error(_0xaa1a('0x49'));if(_0x1c5550[_0xaa1a('0x4a')]===_0xaa1a('0x48')){var _0x48ce6f=_0x27aa45['get']({'plain':!![]});var _0x43ce51=_0xaa1a('0x25');return db[_0xaa1a('0x4b')]['find']({'where':{'name':_0x43ce51,'userProfileId':_0x1c5550['userProfileId']},'raw':!![]})[_0xaa1a('0x23')](function(_0x37f941){if(_0x37f941&&_0x37f941['autoAssociation']===0x0){return db[_0xaa1a('0x26')][_0xaa1a('0x46')]({'name':_0x48ce6f[_0xaa1a('0x27')],'resourceId':_0x48ce6f['id'],'type':_0x37f941[_0xaa1a('0x27')],'sectionId':_0x37f941['id']},{})[_0xaa1a('0x23')](function(){return _0x27aa45;});}else{return _0x27aa45;}})[_0xaa1a('0x42')](function(_0x50732e){logger[_0xaa1a('0x4d')](_0xaa1a('0x4e'),_0x50732e);throw _0x50732e;});}return _0x27aa45;});}})[_0xaa1a('0x23')](respondWithResult(_0x57550d,0xc9))[_0xaa1a('0x42')](handleError(_0x57550d,null));};exports[_0xaa1a('0x21')]=function(_0x40d6a9,_0x1b2c53){if(_0x40d6a9['body']['id']){delete _0x40d6a9[_0xaa1a('0x47')]['id'];}return db['JscriptyProject'][_0xaa1a('0x45')]({'where':{'id':_0x40d6a9[_0xaa1a('0x50')]['id']}})['then'](handleEntityNotFound(_0x1b2c53,null))[_0xaa1a('0x23')](saveUpdates(_0x40d6a9[_0xaa1a('0x47')],null))[_0xaa1a('0x23')](respondWithResult(_0x1b2c53,null))[_0xaa1a('0x42')](handleError(_0x1b2c53,null));};exports[_0xaa1a('0x22')]=function(_0x2d0476,_0x16c704){return db[_0xaa1a('0x2b')][_0xaa1a('0x45')]({'where':{'id':_0x2d0476[_0xaa1a('0x50')]['id']}})[_0xaa1a('0x23')](handleEntityNotFound(_0x16c704,null))[_0xaa1a('0x23')](removeEntity(_0x16c704,null))[_0xaa1a('0x42')](handleError(_0x16c704,null));};exports[_0xaa1a('0x54')]=function(_0x234c53,_0x57f8a1,_0x4b88b0){var _0xec75db={'raw':!![],'where':{}};var _0xba71f7={};var _0x2d038c={'count':0x0,'rows':[]};return db[_0xaa1a('0x2b')][_0xaa1a('0x55')]({'where':{'id':_0x234c53[_0xaa1a('0x50')]['id']}})[_0xaa1a('0x23')](handleEntityNotFound(_0x57f8a1,null))[_0xaa1a('0x23')](function(_0x5942d4){if(_0x5942d4){_0xba71f7[_0xaa1a('0x30')]=_[_0xaa1a('0x43')](db['JscriptySessionReport']['rawAttributes']);_0xba71f7[_0xaa1a('0x31')]=_[_0xaa1a('0x43')](_0x234c53[_0xaa1a('0x31')]);_0xba71f7[_0xaa1a('0x3a')]=_[_0xaa1a('0x32')](_0xba71f7[_0xaa1a('0x30')],_0xba71f7[_0xaa1a('0x31')]);_0xec75db[_0xaa1a('0x33')]=_[_0xaa1a('0x32')](_0xba71f7[_0xaa1a('0x30')],qs[_0xaa1a('0x34')](_0x234c53[_0xaa1a('0x31')][_0xaa1a('0x34')]));_0xec75db[_0xaa1a('0x33')]=_0xec75db[_0xaa1a('0x33')][_0xaa1a('0x35')]?_0xec75db[_0xaa1a('0x33')]:_0xba71f7[_0xaa1a('0x30')];if(!_0x234c53[_0xaa1a('0x31')]['hasOwnProperty'](_0xaa1a('0x36'))){_0xec75db[_0xaa1a('0x1b')]=qs[_0xaa1a('0x1b')](_0x234c53[_0xaa1a('0x31')]['limit']);_0xec75db[_0xaa1a('0x19')]=qs[_0xaa1a('0x19')](_0x234c53[_0xaa1a('0x31')][_0xaa1a('0x19')]);}_0xec75db[_0xaa1a('0x37')]=qs[_0xaa1a('0x38')](_0x234c53[_0xaa1a('0x31')][_0xaa1a('0x38')]);_0xec75db[_0xaa1a('0x39')]=qs['filters'](_[_0xaa1a('0x3b')](_0x234c53[_0xaa1a('0x31')],_0xba71f7['filters']));_0xec75db['where'][_0xaa1a('0x56')]=_0x5942d4['id'];if(_0x234c53[_0xaa1a('0x31')][_0xaa1a('0x3c')]){_0xec75db[_0xaa1a('0x39')]=_[_0xaa1a('0x3d')](_0xec75db[_0xaa1a('0x39')],{'$or':_[_0xaa1a('0x2a')](_0xec75db['attributes'],function(_0x14ed12){var _0x5ac42e={};_0x5ac42e[_0x14ed12]={'$like':'%'+_0x234c53[_0xaa1a('0x31')][_0xaa1a('0x3c')]+'%'};return _0x5ac42e;})});}_0xec75db=_['merge']({},_0xec75db,_0x234c53['options']);return db['JscriptySessionReport'][_0xaa1a('0x1c')]({'where':_0xec75db['where']})[_0xaa1a('0x23')](function(_0x573b33){_0x2d038c[_0xaa1a('0x1c')]=_0x573b33;if(_0x234c53['query'][_0xaa1a('0x44')]){_0xec75db[_0xaa1a('0x3f')]=[{'all':!![]}];}return db[_0xaa1a('0x57')]['findAll'](_0xec75db);})['then'](function(_0x1f3682){_0x2d038c[_0xaa1a('0x41')]=_0x1f3682;return _0x2d038c;});}})[_0xaa1a('0x23')](respondWithFilteredResult(_0x57f8a1,_0xec75db))[_0xaa1a('0x42')](handleError(_0x57f8a1,null));};exports[_0xaa1a('0x58')]=function(_0x21d6b3,_0x1223be,_0x26f73f){var _0x409aa2={'raw':!![],'where':{}};var _0x1dfbc1={};var _0xb4a868={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xaa1a('0x55')]({'where':{'id':_0x21d6b3[_0xaa1a('0x50')]['id']}})[_0xaa1a('0x23')](handleEntityNotFound(_0x1223be,null))[_0xaa1a('0x23')](function(_0x35c539){if(_0x35c539){_0x1dfbc1['model']=_[_0xaa1a('0x43')](db[_0xaa1a('0x59')]['rawAttributes']);_0x1dfbc1['query']=_['keys'](_0x21d6b3[_0xaa1a('0x31')]);_0x1dfbc1[_0xaa1a('0x3a')]=_[_0xaa1a('0x32')](_0x1dfbc1['model'],_0x1dfbc1[_0xaa1a('0x31')]);_0x409aa2['attributes']=_['intersection'](_0x1dfbc1[_0xaa1a('0x30')],qs[_0xaa1a('0x34')](_0x21d6b3[_0xaa1a('0x31')][_0xaa1a('0x34')]));_0x409aa2['attributes']=_0x409aa2[_0xaa1a('0x33')]['length']?_0x409aa2[_0xaa1a('0x33')]:_0x1dfbc1[_0xaa1a('0x30')];if(!_0x21d6b3[_0xaa1a('0x31')]['hasOwnProperty'](_0xaa1a('0x36'))){_0x409aa2[_0xaa1a('0x1b')]=qs[_0xaa1a('0x1b')](_0x21d6b3['query']['limit']);_0x409aa2['offset']=qs[_0xaa1a('0x19')](_0x21d6b3[_0xaa1a('0x31')][_0xaa1a('0x19')]);}_0x409aa2[_0xaa1a('0x37')]=qs[_0xaa1a('0x38')](_0x21d6b3[_0xaa1a('0x31')][_0xaa1a('0x38')]);_0x409aa2['where']=qs[_0xaa1a('0x3a')](_[_0xaa1a('0x3b')](_0x21d6b3[_0xaa1a('0x31')],_0x1dfbc1[_0xaa1a('0x3a')]));_0x409aa2[_0xaa1a('0x39')][_0xaa1a('0x56')]=_0x35c539['id'];if(_0x21d6b3['query']['filter']){_0x409aa2['where']=_[_0xaa1a('0x3d')](_0x409aa2[_0xaa1a('0x39')],{'$or':_[_0xaa1a('0x2a')](_0x409aa2[_0xaa1a('0x33')],function(_0x23ee8c){var _0x9fcf4b={};_0x9fcf4b[_0x23ee8c]={'$like':'%'+_0x21d6b3[_0xaa1a('0x31')][_0xaa1a('0x3c')]+'%'};return _0x9fcf4b;})});}_0x409aa2=_['merge']({},_0x409aa2,_0x21d6b3[_0xaa1a('0x3e')]);return db[_0xaa1a('0x59')]['count']({'where':_0x409aa2[_0xaa1a('0x39')]})[_0xaa1a('0x23')](function(_0x984c47){_0xb4a868['count']=_0x984c47;if(_0x21d6b3[_0xaa1a('0x31')]['includeAll']){_0x409aa2['include']=[{'all':!![]}];}return db[_0xaa1a('0x59')][_0xaa1a('0x40')](_0x409aa2);})[_0xaa1a('0x23')](function(_0x82bd71){_0xb4a868[_0xaa1a('0x41')]=_0x82bd71;return _0xb4a868;});}})[_0xaa1a('0x23')](respondWithFilteredResult(_0x1223be,_0x409aa2))[_0xaa1a('0x42')](handleError(_0x1223be,null));};function char(_0x5eaea4){return'number'===typeof _0x5eaea4?String[_0xaa1a('0x5a')][_0xaa1a('0x1e')](null,arguments):_0x5eaea4;}function needsEncapsulation(_0x589d75){return!!_0x589d75&&(_0x589d75[_0xaa1a('0x5b')]()[_0xaa1a('0x5c')](char(0xd))>=0x0||_0x589d75[_0xaa1a('0x5b')]()[_0xaa1a('0x5c')](char(0xa))>=0x0||_0x589d75[_0xaa1a('0x5b')]()[_0xaa1a('0x5c')](char(0x2c))>=0x0||_0x589d75[_0xaa1a('0x5b')]()[_0xaa1a('0x5c')](char(0x22))>=0x0);}function encapsulate(_0x3917cb){var _0x2d8990=char(0x22),_0x2f0a51='\x5c'+char(0x22),_0x4a3349=_0x3917cb[_0xaa1a('0x5b')]()[_0xaa1a('0x5d')](new RegExp(_0x2d8990,'g'),_0x2f0a51);return _0x2d8990+_0x4a3349+_0x2d8990;}exports[_0xaa1a('0x5e')]=function(_0x3e89a4,_0x110b9b,_0x4389fb){var _0xa2bd51,_0x2f2ee0;var _0x5d56bd={'where':{'ProjectId':_0x3e89a4['params']['id']}};if(_0x3e89a4[_0xaa1a('0x31')]['startTime']){_0x5d56bd[_0xaa1a('0x39')][_0xaa1a('0x5f')]=JSON['parse'](_0x3e89a4[_0xaa1a('0x31')][_0xaa1a('0x60')]);}return db[_0xaa1a('0x57')][_0xaa1a('0x40')](_0x5d56bd)[_0xaa1a('0x23')](handleEntityNotFound(_0x110b9b,null))[_0xaa1a('0x23')](function(_0x44dfdd){if(_0x44dfdd){_0xa2bd51=_0x44dfdd;return db[_0xaa1a('0x61')][_0xaa1a('0x40')]({'where':{'SessionId':{'$in':_[_0xaa1a('0x2a')](_0xa2bd51,'id')},'ProjectId':_0x3e89a4['params']['id']},'order':_0xaa1a('0x62')});}})[_0xaa1a('0x23')](handleEntityNotFound(_0x110b9b,null))['then'](function(_0x4f3ef9){if(_0x4f3ef9){_0x2f2ee0=_0x4f3ef9;var _0x30a781={};for(var _0x4b5d8d=0x0,_0x46e198=_0x2f2ee0['length'];_0x4b5d8d<_0x46e198;_0x4b5d8d++){if(!_0x30a781['hasOwnProperty'](_0x2f2ee0[_0x4b5d8d][_0xaa1a('0x63')])){_0x30a781[_0x2f2ee0[_0x4b5d8d]['questionId']]=needsEncapsulation(_0x2f2ee0[_0x4b5d8d]['question'])?encapsulate(_0x2f2ee0[_0x4b5d8d][_0xaa1a('0x64')]):_0x2f2ee0[_0x4b5d8d][_0xaa1a('0x64')];}}var _0x142abc=[],_0x440c6f={};for(var _0x1ecc6f=0x0,_0x26df16=_0xa2bd51[_0xaa1a('0x35')];_0x1ecc6f<_0x26df16;_0x1ecc6f++){_0x440c6f={'ProjectId':_0x3e89a4[_0xaa1a('0x50')]['id'],'SessionId':_0xa2bd51[_0x1ecc6f]['id'],'StartTime':moment(_0xa2bd51[_0x1ecc6f][_0xaa1a('0x5f')])[_0xaa1a('0x65')](_0xaa1a('0x66'))};for(var _0x248c7f=0x0,_0xa23325=_0x2f2ee0[_0xaa1a('0x35')];_0x248c7f<_0xa23325;_0x248c7f++){if(_0x2f2ee0[_0x248c7f][_0xaa1a('0x67')]==_0xa2bd51[_0x1ecc6f]['id']&&_0x30a781['hasOwnProperty'](_0x2f2ee0[_0x248c7f][_0xaa1a('0x63')])){_0x440c6f[_0x30a781[_0x2f2ee0[_0x248c7f][_0xaa1a('0x63')]]]=_0x2f2ee0[_0x248c7f][_0xaa1a('0x68')];}}for(var _0x443ecb in _0x30a781){if(!_0x440c6f[_0xaa1a('0x69')](_0x30a781[_0x443ecb])){_0x440c6f[_0x30a781[_0x443ecb]]=null;}}_0x142abc['push'](_0x440c6f);}return _0x142abc;}})[_0xaa1a('0x23')](function(_0x46ed30){if(!_[_0xaa1a('0x6a')](_0x46ed30)){var _0x5f2347=toCsv(_0x46ed30);var _0x3f4cba=Date[_0xaa1a('0x6b')]();fs[_0xaa1a('0x6c')](util['format'](_0xaa1a('0x6d'),_0x3e89a4[_0xaa1a('0x50')]['id'],_0x3f4cba),_0x5f2347);_0x110b9b[_0xaa1a('0x6e')]('Content-disposition',_0xaa1a('0x6f')+util[_0xaa1a('0x65')](_0xaa1a('0x70'),_0x3e89a4[_0xaa1a('0x50')]['id'],_0x3f4cba));_0x110b9b['setHeader'](_0xaa1a('0x71'),_0xaa1a('0x72'));return _0x110b9b[_0xaa1a('0x73')](util[_0xaa1a('0x65')](_0xaa1a('0x6d'),_0x3e89a4['params']['id'],_0x3f4cba));}else{return _0x110b9b[_0xaa1a('0x16')](0xcc);}})[_0xaa1a('0x42')](handleError(_0x110b9b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index f1866fc..b418f4a 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 _0xafdd=['request-promise','path','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x379d1c,_0x57d0f9){var _0x7c2dc0=function(_0x5f296a){while(--_0x5f296a){_0x379d1c['push'](_0x379d1c['shift']());}};_0x7c2dc0(++_0x57d0f9);}(_0xafdd,0x19a));var _0xdafd=function(_0x36154a,_0x2cf98c){_0x36154a=_0x36154a-0x0;var _0x61104e=_0xafdd[_0x36154a];return _0x61104e;};'use strict';var _=require(_0xdafd('0x0'));var util=require(_0xdafd('0x1'));var logger=require(_0xdafd('0x2'))(_0xdafd('0x3'));var moment=require(_0xdafd('0x4'));var BPromise=require(_0xdafd('0x5'));var rp=require(_0xdafd('0x6'));var fs=require('fs');var path=require(_0xdafd('0x7'));var rimraf=require('rimraf');var config=require(_0xdafd('0x8'));var attributes=require(_0xdafd('0x9'));module[_0xdafd('0xa')]=function(_0x37f05a,_0xfa4ad6){return _0x37f05a[_0xdafd('0xb')](_0xdafd('0xc'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89fe=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','jscripty_projects','lodash'];(function(_0x4074d5,_0xa57194){var _0x502cfe=function(_0x345efa){while(--_0x345efa){_0x4074d5['push'](_0x4074d5['shift']());}};_0x502cfe(++_0xa57194);}(_0x89fe,0x83));var _0xe89f=function(_0x394338,_0x751fd7){_0x394338=_0x394338-0x0;var _0x1ecdb0=_0x89fe[_0x394338];return _0x1ecdb0;};'use strict';var _=require(_0xe89f('0x0'));var util=require(_0xe89f('0x1'));var logger=require(_0xe89f('0x2'))(_0xe89f('0x3'));var moment=require('moment');var BPromise=require(_0xe89f('0x4'));var rp=require(_0xe89f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe89f('0x6'));var config=require(_0xe89f('0x7'));var attributes=require(_0xe89f('0x8'));module[_0xe89f('0x9')]=function(_0x2e61cf,_0x2d5020){return _0x2e61cf[_0xe89f('0xa')]('JscriptyProject',attributes,{'tableName':_0xe89f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 0defed9..28699d5 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x6f8972,_0x343da7){var _0x5677d9=function(_0x5eb51f){while(--_0x5eb51f){_0x6f8972['push'](_0x6f8972['shift']());}};_0x5677d9(++_0x343da7);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +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(_0x52ad9f,_0x341f8f){var _0x30314a=function(_0x450e35){while(--_0x450e35){_0x52ad9f['push'](_0x52ad9f['shift']());}};_0x30314a(++_0x341f8f);}(_0xe706,0xa3));var _0x6e70=function(_0x59ad89,_0x41cdbd){_0x59ad89=_0x59ad89-0x0;var _0x463e97=_0xe706[_0x59ad89];return _0x463e97;};'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 diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 1f9f8a0..b887b7e 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 _0xa404=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa404,0x102));var _0x4a40=function(_0x1c41e1,_0x12e0b1){_0x1c41e1=_0x1c41e1-0x0;var _0x34233f=_0xa404[_0x1c41e1];return _0x34233f;};'use strict';var multer=require('multer');var util=require(_0x4a40('0x0'));var path=require(_0x4a40('0x1'));var timeout=require(_0x4a40('0x2'));var express=require(_0x4a40('0x3'));var router=express[_0x4a40('0x4')]();var fs_extra=require(_0x4a40('0x5'));var auth=require(_0x4a40('0x6'));var interaction=require(_0x4a40('0x7'));var config=require(_0x4a40('0x8'));var controller=require('./jscriptyQuestionReport.controller');router[_0x4a40('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4a40('0x9')]('/describe',auth[_0x4a40('0xa')](),controller['describe']);router[_0x4a40('0x9')](_0x4a40('0xb'),auth[_0x4a40('0xa')](),controller[_0x4a40('0xc')]);router[_0x4a40('0xd')]('/',auth[_0x4a40('0xa')](),controller[_0x4a40('0xe')]);router[_0x4a40('0xf')]('/:id',auth[_0x4a40('0xa')](),controller['update']);router[_0x4a40('0x10')]('/:id',auth[_0x4a40('0xa')](),controller[_0x4a40('0x11')]);module[_0x4a40('0x12')]=router; \ No newline at end of file +var _0xd706=['Router','../../config/environment','get','index','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd706,0x68));var _0x6d70=function(_0xe14ad1,_0x226e04){_0xe14ad1=_0xe14ad1-0x0;var _0x17ac04=_0xd706[_0xe14ad1];return _0x17ac04;};'use strict';var multer=require(_0x6d70('0x0'));var util=require('util');var path=require(_0x6d70('0x1'));var timeout=require(_0x6d70('0x2'));var express=require(_0x6d70('0x3'));var router=express[_0x6d70('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6d70('0x5'));var controller=require('./jscriptyQuestionReport.controller');router[_0x6d70('0x6')]('/',auth['isAuthenticated'](),controller[_0x6d70('0x7')]);router[_0x6d70('0x6')]('/describe',auth[_0x6d70('0x8')](),controller[_0x6d70('0x9')]);router[_0x6d70('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x6d70('0xa')]);router[_0x6d70('0xb')]('/',auth[_0x6d70('0x8')](),controller[_0x6d70('0xc')]);router[_0x6d70('0xd')](_0x6d70('0xe'),auth[_0x6d70('0x8')](),controller[_0x6d70('0xf')]);router[_0x6d70('0x10')](_0x6d70('0xe'),auth[_0x6d70('0x8')](),controller[_0x6d70('0x11')]);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 32786f6..81ab805 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(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x7a54,0x106));var _0x47a5=function(_0x9b7f4,_0x2bd290){_0x9b7f4=_0x9b7f4-0x0;var _0x3cbc94=_0x7a54[_0x9b7f4];return _0x3cbc94;};'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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7a54,0x106));var _0x47a5=function(_0x3d203a,_0x82c581){_0x3d203a=_0x3d203a-0x0;var _0x25c2ea=_0x7a54[_0x3d203a];return _0x25c2ea;};'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 9e4c5c0..79b8e53 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 _0xa17e=['findAll','catch','params','fields','includeAll','options','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','include'];(function(_0x36b154,_0x53620a){var _0x518e21=function(_0x46b04c){while(--_0x46b04c){_0x36b154['push'](_0x36b154['shift']());}};_0x518e21(++_0x53620a);}(_0xa17e,0xf2));var _0xea17=function(_0x456807,_0x165dcf){_0x456807=_0x456807-0x0;var _0x15afb3=_0xa17e[_0x456807];return _0x15afb3;};'use strict';var emlformat=require(_0xea17('0x0'));var rimraf=require(_0xea17('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xea17('0x2'));var rp=require(_0xea17('0x3'));var moment=require('moment');var BPromise=require(_0xea17('0x4'));var Mustache=require(_0xea17('0x5'));var util=require(_0xea17('0x6'));var path=require('path');var sox=require(_0xea17('0x7'));var csv=require(_0xea17('0x8'));var ejs=require(_0xea17('0x9'));var fs=require('fs');var fs_extra=require(_0xea17('0xa'));var _=require(_0xea17('0xb'));var squel=require(_0xea17('0xc'));var crypto=require('crypto');var jsforce=require(_0xea17('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xea17('0x8'));var querystring=require(_0xea17('0xe'));var Papa=require(_0xea17('0xf'));var Redis=require(_0xea17('0x10'));var authService=require(_0xea17('0x11'));var qs=require(_0xea17('0x12'));var as=require(_0xea17('0x13'));var hardwareService=require(_0xea17('0x14'));var logger=require(_0xea17('0x15'))(_0xea17('0x16'));var utils=require('../../config/utils');var config=require(_0xea17('0x17'));var licenseUtil=require(_0xea17('0x18'));var db=require(_0xea17('0x19'))['db'];function respondWithStatusCode(_0x3a51da,_0x1055a1){_0x1055a1=_0x1055a1||0xcc;return function(_0x203bb2){if(_0x203bb2){return _0x3a51da[_0xea17('0x1a')](_0x1055a1);}return _0x3a51da[_0xea17('0x1b')](_0x1055a1)[_0xea17('0x1c')]();};}function respondWithResult(_0x5bdf03,_0x287660){_0x287660=_0x287660||0xc8;return function(_0x52dbc5){if(_0x52dbc5){return _0x5bdf03[_0xea17('0x1b')](_0x287660)[_0xea17('0x1d')](_0x52dbc5);}};}function respondWithFilteredResult(_0x5b44b1,_0x3b545e){return function(_0x45be24){if(_0x45be24){var _0x357364=typeof _0x3b545e[_0xea17('0x1e')]===_0xea17('0x1f')&&typeof _0x3b545e[_0xea17('0x20')]===_0xea17('0x1f');var _0x5a4916=_0x45be24[_0xea17('0x21')];var _0x437b15=_0x357364?0x0:_0x3b545e['offset'];var _0xbadb40=_0x357364?_0x45be24[_0xea17('0x21')]:_0x3b545e[_0xea17('0x1e')]+_0x3b545e[_0xea17('0x20')];var _0x2f4cca;if(_0xbadb40>=_0x5a4916){_0xbadb40=_0x5a4916;_0x2f4cca=0xc8;}else{_0x2f4cca=0xce;}_0x5b44b1[_0xea17('0x1b')](_0x2f4cca);return _0x5b44b1[_0xea17('0x22')](_0xea17('0x23'),_0x437b15+'-'+_0xbadb40+'/'+_0x5a4916)[_0xea17('0x1d')](_0x45be24);}return null;};}function patchUpdates(_0x353f5e){return function(_0x444198){try{jsonpatch[_0xea17('0x24')](_0x444198,_0x353f5e,!![]);}catch(_0x8bbcfe){return BPromise[_0xea17('0x25')](_0x8bbcfe);}return _0x444198[_0xea17('0x26')]();};}function saveUpdates(_0x5e141e,_0x342388){return function(_0x12b87b){if(_0x12b87b){return _0x12b87b[_0xea17('0x27')](_0x5e141e)[_0xea17('0x28')](function(_0x28b9f0){return _0x28b9f0;});}return null;};}function removeEntity(_0x1194b0,_0x247e91){return function(_0x2ac11b){if(_0x2ac11b){return _0x2ac11b['destroy']()[_0xea17('0x28')](function(){_0x1194b0[_0xea17('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x311305,_0xd04c5b){return function(_0x281936){if(!_0x281936){_0x311305[_0xea17('0x1a')](0x194);}return _0x281936;};}function handleError(_0x46951b,_0x4b18e6){_0x4b18e6=_0x4b18e6||0x1f4;return function(_0x55c36c){logger['error'](_0x55c36c[_0xea17('0x29')]);if(_0x55c36c[_0xea17('0x2a')]){delete _0x55c36c[_0xea17('0x2a')];}_0x46951b['status'](_0x4b18e6)[_0xea17('0x2b')](_0x55c36c);};}exports[_0xea17('0x2c')]=function(_0x425972,_0x3619f7){var _0xc32d61={},_0x102299={},_0x4b0af5={'count':0x0,'rows':[]};var _0xd05c04=_[_0xea17('0x2d')](db[_0xea17('0x2e')][_0xea17('0x2f')],function(_0x44aaf3){return{'name':_0x44aaf3['fieldName'],'type':_0x44aaf3[_0xea17('0x30')][_0xea17('0x31')]};});_0x102299[_0xea17('0x32')]=_['map'](_0xd05c04,_0xea17('0x2a'));_0x102299[_0xea17('0x33')]=_[_0xea17('0x34')](_0x425972[_0xea17('0x33')]);_0x102299['filters']=_[_0xea17('0x35')](_0x102299[_0xea17('0x32')],_0x102299[_0xea17('0x33')]);_0xc32d61[_0xea17('0x36')]=_[_0xea17('0x35')](_0x102299[_0xea17('0x32')],qs['fields'](_0x425972[_0xea17('0x33')]['fields']));_0xc32d61['attributes']=_0xc32d61['attributes'][_0xea17('0x37')]?_0xc32d61[_0xea17('0x36')]:_0x102299[_0xea17('0x32')];if(!_0x425972[_0xea17('0x33')][_0xea17('0x38')]('nolimit')){_0xc32d61['limit']=qs['limit'](_0x425972['query']['limit']);_0xc32d61[_0xea17('0x1e')]=qs['offset'](_0x425972[_0xea17('0x33')]['offset']);}_0xc32d61[_0xea17('0x39')]=qs[_0xea17('0x3a')](_0x425972[_0xea17('0x33')][_0xea17('0x3a')]);_0xc32d61[_0xea17('0x3b')]=qs['filters'](_[_0xea17('0x3c')](_0x425972[_0xea17('0x33')],_0x102299[_0xea17('0x3d')]),_0xd05c04);if(_0x425972[_0xea17('0x33')][_0xea17('0x3e')]){_0xc32d61['where']=_[_0xea17('0x3f')](_0xc32d61[_0xea17('0x3b')],{'$or':_[_0xea17('0x2d')](_0xd05c04,function(_0xea0404){if(_0xea0404['type']!==_0xea17('0x40')){var _0x3dbd5d={};_0x3dbd5d[_0xea0404[_0xea17('0x2a')]]={'$like':'%'+_0x425972[_0xea17('0x33')][_0xea17('0x3e')]+'%'};return _0x3dbd5d;}})});}_0xc32d61=_[_0xea17('0x3f')]({},_0xc32d61,_0x425972['options']);var _0xdb5ecc={'where':_0xc32d61[_0xea17('0x3b')]};return db['JscriptyQuestionReport'][_0xea17('0x21')](_0xdb5ecc)['then'](function(_0x78cae2){_0x4b0af5[_0xea17('0x21')]=_0x78cae2;if(_0x425972[_0xea17('0x33')]['includeAll']){_0xc32d61[_0xea17('0x41')]=[{'all':!![]}];}return db[_0xea17('0x2e')][_0xea17('0x42')](_0xc32d61);})[_0xea17('0x28')](function(_0x1ad746){_0x4b0af5['rows']=_0x1ad746;return _0x4b0af5;})['then'](respondWithFilteredResult(_0x3619f7,_0xc32d61))[_0xea17('0x43')](handleError(_0x3619f7,null));};exports['show']=function(_0xb5300,_0x1cbef8){var _0x190140={'raw':!![],'where':{'id':_0xb5300[_0xea17('0x44')]['id']}},_0x269a0c={};_0x269a0c['model']=_['keys'](db[_0xea17('0x2e')]['rawAttributes']);_0x269a0c['query']=_[_0xea17('0x34')](_0xb5300[_0xea17('0x33')]);_0x269a0c['filters']=_['intersection'](_0x269a0c[_0xea17('0x32')],_0x269a0c[_0xea17('0x33')]);_0x190140['attributes']=_['intersection'](_0x269a0c['model'],qs[_0xea17('0x45')](_0xb5300[_0xea17('0x33')][_0xea17('0x45')]));_0x190140[_0xea17('0x36')]=_0x190140[_0xea17('0x36')]['length']?_0x190140[_0xea17('0x36')]:_0x269a0c[_0xea17('0x32')];if(_0xb5300[_0xea17('0x33')][_0xea17('0x46')]){_0x190140[_0xea17('0x41')]=[{'all':!![]}];}_0x190140=_[_0xea17('0x3f')]({},_0x190140,_0xb5300[_0xea17('0x47')]);return db[_0xea17('0x2e')][_0xea17('0x48')](_0x190140)['then'](handleEntityNotFound(_0x1cbef8,null))['then'](respondWithResult(_0x1cbef8,null))[_0xea17('0x43')](handleError(_0x1cbef8,null));};exports[_0xea17('0x49')]=function(_0xc6e6a8,_0x37ba06){return db[_0xea17('0x2e')][_0xea17('0x49')](_0xc6e6a8['body'],{})[_0xea17('0x28')](respondWithResult(_0x37ba06,0xc9))['catch'](handleError(_0x37ba06,null));};exports[_0xea17('0x27')]=function(_0x2bf638,_0x31c58b){if(_0x2bf638[_0xea17('0x4a')]['id']){delete _0x2bf638[_0xea17('0x4a')]['id'];}return db[_0xea17('0x2e')][_0xea17('0x48')]({'where':{'id':_0x2bf638['params']['id']}})[_0xea17('0x28')](handleEntityNotFound(_0x31c58b,null))[_0xea17('0x28')](saveUpdates(_0x2bf638[_0xea17('0x4a')],null))[_0xea17('0x28')](respondWithResult(_0x31c58b,null))[_0xea17('0x43')](handleError(_0x31c58b,null));};exports[_0xea17('0x4b')]=function(_0x56c97d,_0x3f2769){return db[_0xea17('0x2e')]['find']({'where':{'id':_0x56c97d[_0xea17('0x44')]['id']}})[_0xea17('0x28')](handleEntityNotFound(_0x3f2769,null))[_0xea17('0x28')](removeEntity(_0x3f2769,null))[_0xea17('0x43')](handleError(_0x3f2769,null));};exports['describe']=function(_0x560279,_0x268c1f){return db['JscriptyQuestionReport'][_0xea17('0x4c')]()['then'](respondWithResult(_0x268c1f,null))['catch'](handleError(_0x268c1f,null));}; \ No newline at end of file +var _0x9d23=['VIRTUAL','merge','options','include','findAll','catch','params','includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','update','then','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter'];(function(_0x1a0daa,_0x2a4634){var _0x1dbe15=function(_0xa8ab22){while(--_0xa8ab22){_0x1a0daa['push'](_0x1a0daa['shift']());}};_0x1dbe15(++_0x2a4634);}(_0x9d23,0x1c8));var _0x39d2=function(_0x583527,_0x2291f8){_0x583527=_0x583527-0x0;var _0x5a9964=_0x9d23[_0x583527];return _0x5a9964;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x39d2('0x0'));var zipdir=require(_0x39d2('0x1'));var jsonpatch=require(_0x39d2('0x2'));var rp=require(_0x39d2('0x3'));var moment=require(_0x39d2('0x4'));var BPromise=require(_0x39d2('0x5'));var Mustache=require(_0x39d2('0x6'));var util=require(_0x39d2('0x7'));var path=require(_0x39d2('0x8'));var sox=require(_0x39d2('0x9'));var csv=require(_0x39d2('0xa'));var ejs=require(_0x39d2('0xb'));var fs=require('fs');var fs_extra=require(_0x39d2('0xc'));var _=require('lodash');var squel=require(_0x39d2('0xd'));var crypto=require('crypto');var jsforce=require(_0x39d2('0xe'));var deskjs=require(_0x39d2('0xf'));var toCsv=require(_0x39d2('0xa'));var querystring=require(_0x39d2('0x10'));var Papa=require(_0x39d2('0x11'));var Redis=require(_0x39d2('0x12'));var authService=require(_0x39d2('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x39d2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x39d2('0x15'))(_0x39d2('0x16'));var utils=require(_0x39d2('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x39d2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bee82,_0x55ed4c){_0x55ed4c=_0x55ed4c||0xcc;return function(_0x2facbb){if(_0x2facbb){return _0x2bee82[_0x39d2('0x19')](_0x55ed4c);}return _0x2bee82[_0x39d2('0x1a')](_0x55ed4c)[_0x39d2('0x1b')]();};}function respondWithResult(_0x28eae2,_0x13ec23){_0x13ec23=_0x13ec23||0xc8;return function(_0xdec44){if(_0xdec44){return _0x28eae2[_0x39d2('0x1a')](_0x13ec23)[_0x39d2('0x1c')](_0xdec44);}};}function respondWithFilteredResult(_0xe2cf5f,_0xedb1ec){return function(_0x3a9ce9){if(_0x3a9ce9){var _0x5271b7=typeof _0xedb1ec['offset']===_0x39d2('0x1d')&&typeof _0xedb1ec[_0x39d2('0x1e')]==='undefined';var _0x444e02=_0x3a9ce9[_0x39d2('0x1f')];var _0x3eeab0=_0x5271b7?0x0:_0xedb1ec[_0x39d2('0x20')];var _0x1a4095=_0x5271b7?_0x3a9ce9[_0x39d2('0x1f')]:_0xedb1ec[_0x39d2('0x20')]+_0xedb1ec[_0x39d2('0x1e')];var _0x3f70e7;if(_0x1a4095>=_0x444e02){_0x1a4095=_0x444e02;_0x3f70e7=0xc8;}else{_0x3f70e7=0xce;}_0xe2cf5f['status'](_0x3f70e7);return _0xe2cf5f['set'](_0x39d2('0x21'),_0x3eeab0+'-'+_0x1a4095+'/'+_0x444e02)[_0x39d2('0x1c')](_0x3a9ce9);}return null;};}function patchUpdates(_0x3b7ace){return function(_0xb4c0b){try{jsonpatch['apply'](_0xb4c0b,_0x3b7ace,!![]);}catch(_0x11208f){return BPromise[_0x39d2('0x22')](_0x11208f);}return _0xb4c0b['save']();};}function saveUpdates(_0x3fbca6,_0xc98931){return function(_0x12af35){if(_0x12af35){return _0x12af35[_0x39d2('0x23')](_0x3fbca6)['then'](function(_0x47eb13){return _0x47eb13;});}return null;};}function removeEntity(_0x1ee2e8,_0x298934){return function(_0x36d085){if(_0x36d085){return _0x36d085['destroy']()[_0x39d2('0x24')](function(){_0x1ee2e8[_0x39d2('0x1a')](0xcc)[_0x39d2('0x1b')]();});}};}function handleEntityNotFound(_0x8f8a37,_0x138b40){return function(_0xdf6147){if(!_0xdf6147){_0x8f8a37[_0x39d2('0x19')](0x194);}return _0xdf6147;};}function handleError(_0x43a4a3,_0x2e288b){_0x2e288b=_0x2e288b||0x1f4;return function(_0xd4c5b3){logger[_0x39d2('0x25')](_0xd4c5b3[_0x39d2('0x26')]);if(_0xd4c5b3[_0x39d2('0x27')]){delete _0xd4c5b3['name'];}_0x43a4a3['status'](_0x2e288b)[_0x39d2('0x28')](_0xd4c5b3);};}exports[_0x39d2('0x29')]=function(_0x139812,_0x56f845){var _0x27a4a8={},_0x485551={},_0x400fbf={'count':0x0,'rows':[]};var _0xafbd58=_[_0x39d2('0x2a')](db[_0x39d2('0x2b')][_0x39d2('0x2c')],function(_0x10a098){return{'name':_0x10a098[_0x39d2('0x2d')],'type':_0x10a098[_0x39d2('0x2e')][_0x39d2('0x2f')]};});_0x485551[_0x39d2('0x30')]=_[_0x39d2('0x2a')](_0xafbd58,_0x39d2('0x27'));_0x485551[_0x39d2('0x31')]=_[_0x39d2('0x32')](_0x139812[_0x39d2('0x31')]);_0x485551[_0x39d2('0x33')]=_[_0x39d2('0x34')](_0x485551[_0x39d2('0x30')],_0x485551[_0x39d2('0x31')]);_0x27a4a8[_0x39d2('0x35')]=_[_0x39d2('0x34')](_0x485551[_0x39d2('0x30')],qs[_0x39d2('0x36')](_0x139812[_0x39d2('0x31')][_0x39d2('0x36')]));_0x27a4a8['attributes']=_0x27a4a8['attributes'][_0x39d2('0x37')]?_0x27a4a8[_0x39d2('0x35')]:_0x485551[_0x39d2('0x30')];if(!_0x139812[_0x39d2('0x31')][_0x39d2('0x38')]('nolimit')){_0x27a4a8['limit']=qs[_0x39d2('0x1e')](_0x139812[_0x39d2('0x31')][_0x39d2('0x1e')]);_0x27a4a8[_0x39d2('0x20')]=qs[_0x39d2('0x20')](_0x139812[_0x39d2('0x31')][_0x39d2('0x20')]);}_0x27a4a8[_0x39d2('0x39')]=qs[_0x39d2('0x3a')](_0x139812['query'][_0x39d2('0x3a')]);_0x27a4a8[_0x39d2('0x3b')]=qs[_0x39d2('0x33')](_[_0x39d2('0x3c')](_0x139812[_0x39d2('0x31')],_0x485551[_0x39d2('0x33')]),_0xafbd58);if(_0x139812['query'][_0x39d2('0x3d')]){_0x27a4a8[_0x39d2('0x3b')]=_['merge'](_0x27a4a8[_0x39d2('0x3b')],{'$or':_[_0x39d2('0x2a')](_0xafbd58,function(_0x87dc2c){if(_0x87dc2c[_0x39d2('0x2e')]!==_0x39d2('0x3e')){var _0x5df52a={};_0x5df52a[_0x87dc2c[_0x39d2('0x27')]]={'$like':'%'+_0x139812['query'][_0x39d2('0x3d')]+'%'};return _0x5df52a;}})});}_0x27a4a8=_[_0x39d2('0x3f')]({},_0x27a4a8,_0x139812[_0x39d2('0x40')]);var _0x7eddec={'where':_0x27a4a8['where']};return db[_0x39d2('0x2b')][_0x39d2('0x1f')](_0x7eddec)[_0x39d2('0x24')](function(_0x182ee8){_0x400fbf['count']=_0x182ee8;if(_0x139812[_0x39d2('0x31')]['includeAll']){_0x27a4a8[_0x39d2('0x41')]=[{'all':!![]}];}return db[_0x39d2('0x2b')][_0x39d2('0x42')](_0x27a4a8);})['then'](function(_0x4c50e1){_0x400fbf['rows']=_0x4c50e1;return _0x400fbf;})[_0x39d2('0x24')](respondWithFilteredResult(_0x56f845,_0x27a4a8))[_0x39d2('0x43')](handleError(_0x56f845,null));};exports['show']=function(_0x179af6,_0x5a0fc0){var _0x3a6854={'raw':!![],'where':{'id':_0x179af6[_0x39d2('0x44')]['id']}},_0x215863={};_0x215863[_0x39d2('0x30')]=_[_0x39d2('0x32')](db[_0x39d2('0x2b')][_0x39d2('0x2c')]);_0x215863[_0x39d2('0x31')]=_['keys'](_0x179af6['query']);_0x215863[_0x39d2('0x33')]=_[_0x39d2('0x34')](_0x215863[_0x39d2('0x30')],_0x215863[_0x39d2('0x31')]);_0x3a6854[_0x39d2('0x35')]=_['intersection'](_0x215863['model'],qs[_0x39d2('0x36')](_0x179af6[_0x39d2('0x31')]['fields']));_0x3a6854[_0x39d2('0x35')]=_0x3a6854[_0x39d2('0x35')][_0x39d2('0x37')]?_0x3a6854[_0x39d2('0x35')]:_0x215863[_0x39d2('0x30')];if(_0x179af6[_0x39d2('0x31')][_0x39d2('0x45')]){_0x3a6854[_0x39d2('0x41')]=[{'all':!![]}];}_0x3a6854=_['merge']({},_0x3a6854,_0x179af6[_0x39d2('0x40')]);return db[_0x39d2('0x2b')][_0x39d2('0x46')](_0x3a6854)[_0x39d2('0x24')](handleEntityNotFound(_0x5a0fc0,null))[_0x39d2('0x24')](respondWithResult(_0x5a0fc0,null))['catch'](handleError(_0x5a0fc0,null));};exports[_0x39d2('0x47')]=function(_0x24abe4,_0xb77474){return db[_0x39d2('0x2b')][_0x39d2('0x47')](_0x24abe4[_0x39d2('0x48')],{})[_0x39d2('0x24')](respondWithResult(_0xb77474,0xc9))[_0x39d2('0x43')](handleError(_0xb77474,null));};exports[_0x39d2('0x23')]=function(_0x54f4eb,_0x384b2c){if(_0x54f4eb['body']['id']){delete _0x54f4eb['body']['id'];}return db['JscriptyQuestionReport'][_0x39d2('0x46')]({'where':{'id':_0x54f4eb['params']['id']}})[_0x39d2('0x24')](handleEntityNotFound(_0x384b2c,null))['then'](saveUpdates(_0x54f4eb[_0x39d2('0x48')],null))['then'](respondWithResult(_0x384b2c,null))[_0x39d2('0x43')](handleError(_0x384b2c,null));};exports['destroy']=function(_0xae88cf,_0x9661bd){return db[_0x39d2('0x2b')]['find']({'where':{'id':_0xae88cf[_0x39d2('0x44')]['id']}})['then'](handleEntityNotFound(_0x9661bd,null))[_0x39d2('0x24')](removeEntity(_0x9661bd,null))[_0x39d2('0x43')](handleError(_0x9661bd,null));};exports[_0x39d2('0x49')]=function(_0xc11d4b,_0xcc6e9a){return db[_0x39d2('0x2b')]['describe']()[_0x39d2('0x24')](respondWithResult(_0xcc6e9a,null))['catch'](handleError(_0xcc6e9a,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index ce6186f..a82bc6e 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 _0x3ffc=['rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2f1b55,_0xc81e02){var _0x423a51=function(_0x5c4ecc){while(--_0x5c4ecc){_0x2f1b55['push'](_0x2f1b55['shift']());}};_0x423a51(++_0xc81e02);}(_0x3ffc,0x1a6));var _0xc3ff=function(_0x4ec805,_0x3b8515){_0x4ec805=_0x4ec805-0x0;var _0x386805=_0x3ffc[_0x4ec805];return _0x386805;};'use strict';var _=require(_0xc3ff('0x0'));var util=require('util');var logger=require(_0xc3ff('0x1'))(_0xc3ff('0x2'));var moment=require(_0xc3ff('0x3'));var BPromise=require(_0xc3ff('0x4'));var rp=require(_0xc3ff('0x5'));var fs=require('fs');var path=require(_0xc3ff('0x6'));var rimraf=require(_0xc3ff('0x7'));var config=require(_0xc3ff('0x8'));var attributes=require(_0xc3ff('0x9'));module[_0xc3ff('0xa')]=function(_0x2d062f,_0x61c14a){return _0x2d062f[_0xc3ff('0xb')]('JscriptyQuestionReport',attributes,{'tableName':_0xc3ff('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf79c=['exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes'];(function(_0x3ad9db,_0xfa978f){var _0x4d5339=function(_0x3c02b1){while(--_0x3c02b1){_0x3ad9db['push'](_0x3ad9db['shift']());}};_0x4d5339(++_0xfa978f);}(_0xf79c,0x18a));var _0xcf79=function(_0x4fdb98,_0x1fef46){_0x4fdb98=_0x4fdb98-0x0;var _0x4d6a91=_0xf79c[_0x4fdb98];return _0x4d6a91;};'use strict';var _=require(_0xcf79('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcf79('0x1'));var moment=require(_0xcf79('0x2'));var BPromise=require(_0xcf79('0x3'));var rp=require(_0xcf79('0x4'));var fs=require('fs');var path=require(_0xcf79('0x5'));var rimraf=require(_0xcf79('0x6'));var config=require(_0xcf79('0x7'));var attributes=require(_0xcf79('0x8'));module[_0xcf79('0x9')]=function(_0x459c37,_0x3b103c){return _0x459c37[_0xcf79('0xa')](_0xcf79('0xb'),attributes,{'tableName':_0xcf79('0xc'),'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 8bd0863..32d5b84 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 _0x112c=['debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent'];(function(_0x42351a,_0x1ac026){var _0x429224=function(_0x3602e9){while(--_0x3602e9){_0x42351a['push'](_0x42351a['shift']());}};_0x429224(++_0x1ac026);}(_0x112c,0x165));var _0xc112=function(_0x4fab85,_0x3fb6af){_0x4fab85=_0x4fab85-0x0;var _0x399b0f=_0x112c[_0x4fab85];return _0x399b0f;};'use strict';var _=require(_0xc112('0x0'));var util=require(_0xc112('0x1'));var moment=require(_0xc112('0x2'));var BPromise=require(_0xc112('0x3'));var rs=require(_0xc112('0x4'));var fs=require('fs');var Redis=require(_0xc112('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc112('0x6'));var logger=require(_0xc112('0x7'))(_0xc112('0x8'));var config=require(_0xc112('0x9'));var jayson=require(_0xc112('0xa'));var client=jayson[_0xc112('0xb')][_0xc112('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xffd99f,_0x2ce6d8,_0x5d1559){return new BPromise(function(_0x1bfde7,_0x148860){return client[_0xc112('0xd')](_0xffd99f,_0x5d1559)[_0xc112('0xe')](function(_0x33b923){logger[_0xc112('0xf')](_0xc112('0x10'),_0x2ce6d8,_0xc112('0x11'));logger[_0xc112('0x12')](_0xc112('0x13'),_0x2ce6d8,_0xc112('0x11'),JSON[_0xc112('0x14')](_0x33b923));if(_0x33b923[_0xc112('0x15')]){if(_0x33b923['error'][_0xc112('0x16')]===0x1f4){logger[_0xc112('0x15')](_0xc112('0x10'),_0x2ce6d8,_0x33b923[_0xc112('0x15')][_0xc112('0x17')]);return _0x148860(_0x33b923[_0xc112('0x15')]['message']);}logger[_0xc112('0x15')](_0xc112('0x10'),_0x2ce6d8,_0x33b923[_0xc112('0x15')][_0xc112('0x17')]);return _0x1bfde7(_0x33b923['error'][_0xc112('0x17')]);}else{logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x2ce6d8,_0xc112('0x11'));_0x1bfde7(_0x33b923[_0xc112('0x18')][_0xc112('0x17')]);}})['catch'](function(_0x3770d5){logger[_0xc112('0x15')](_0xc112('0x10'),_0x2ce6d8,_0x3770d5);_0x148860(_0x3770d5);});});} \ No newline at end of file +var _0xfecc=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfecc,0x178));var _0xcfec=function(_0x5230f7,_0x3c0f16){_0x5230f7=_0x5230f7-0x0;var _0xd25a76=_0xfecc[_0x5230f7];return _0xd25a76;};'use strict';var _=require('lodash');var util=require(_0xcfec('0x0'));var moment=require(_0xcfec('0x1'));var BPromise=require(_0xcfec('0x2'));var rs=require(_0xcfec('0x3'));var fs=require('fs');var Redis=require(_0xcfec('0x4'));var db=require(_0xcfec('0x5'))['db'];var utils=require(_0xcfec('0x6'));var logger=require(_0xcfec('0x7'))(_0xcfec('0x8'));var config=require('../../config/environment');var jayson=require(_0xcfec('0x9'));var client=jayson[_0xcfec('0xa')][_0xcfec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x184513,_0x22dd65,_0x32ac2d){return new BPromise(function(_0x35b6b6,_0x1115ab){return client[_0xcfec('0xc')](_0x184513,_0x32ac2d)['then'](function(_0x117579){logger[_0xcfec('0xd')](_0xcfec('0xe'),_0x22dd65,_0xcfec('0xf'));logger[_0xcfec('0x10')](_0xcfec('0x11'),_0x22dd65,_0xcfec('0xf'),JSON[_0xcfec('0x12')](_0x117579));if(_0x117579[_0xcfec('0x13')]){if(_0x117579[_0xcfec('0x13')]['code']===0x1f4){logger[_0xcfec('0x13')](_0xcfec('0xe'),_0x22dd65,_0x117579[_0xcfec('0x13')][_0xcfec('0x14')]);return _0x1115ab(_0x117579['error'][_0xcfec('0x14')]);}logger['error'](_0xcfec('0xe'),_0x22dd65,_0x117579[_0xcfec('0x13')][_0xcfec('0x14')]);return _0x35b6b6(_0x117579['error'][_0xcfec('0x14')]);}else{logger[_0xcfec('0xd')](_0xcfec('0xe'),_0x22dd65,_0xcfec('0xf'));_0x35b6b6(_0x117579['result'][_0xcfec('0x14')]);}})['catch'](function(_0x4ce1bb){logger[_0xcfec('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x22dd65,_0x4ce1bb);_0x1115ab(_0x4ce1bb);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 125b64f..e938599 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 _0xca0d=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','getQuestions','post','/:id','update','destroy','util','path','connect-timeout','express','Router'];(function(_0xe9ed1,_0x2209ee){var _0x468c7d=function(_0x7bd2db){while(--_0x7bd2db){_0xe9ed1['push'](_0xe9ed1['shift']());}};_0x468c7d(++_0x2209ee);}(_0xca0d,0x1e9));var _0xdca0=function(_0x2d33b9,_0xc280bb){_0x2d33b9=_0x2d33b9-0x0;var _0x4e12d6=_0xca0d[_0x2d33b9];return _0x4e12d6;};'use strict';var multer=require('multer');var util=require(_0xdca0('0x0'));var path=require(_0xdca0('0x1'));var timeout=require(_0xdca0('0x2'));var express=require(_0xdca0('0x3'));var router=express[_0xdca0('0x4')]();var fs_extra=require(_0xdca0('0x5'));var auth=require(_0xdca0('0x6'));var interaction=require(_0xdca0('0x7'));var config=require(_0xdca0('0x8'));var controller=require('./jscriptySessionReport.controller');router[_0xdca0('0x9')]('/',auth[_0xdca0('0xa')](),controller[_0xdca0('0xb')]);router[_0xdca0('0x9')](_0xdca0('0xc'),auth['isAuthenticated'](),controller[_0xdca0('0xd')]);router[_0xdca0('0x9')]('/:id',auth[_0xdca0('0xa')](),controller['show']);router[_0xdca0('0x9')]('/:id/questions',auth['isAuthenticated'](),controller[_0xdca0('0xe')]);router[_0xdca0('0xf')]('/',auth[_0xdca0('0xa')](),controller['create']);router['put'](_0xdca0('0x10'),auth[_0xdca0('0xa')](),controller[_0xdca0('0x11')]);router['delete'](_0xdca0('0x10'),auth['isAuthenticated'](),controller[_0xdca0('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe190=['./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/questions','getQuestions','create','put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xe190,0x1db));var _0x0e19=function(_0x357aa8,_0x3630a5){_0x357aa8=_0x357aa8-0x0;var _0x2e8fad=_0xe190[_0x357aa8];return _0x2e8fad;};'use strict';var multer=require(_0x0e19('0x0'));var util=require(_0x0e19('0x1'));var path=require(_0x0e19('0x2'));var timeout=require('connect-timeout');var express=require(_0x0e19('0x3'));var router=express['Router']();var fs_extra=require(_0x0e19('0x4'));var auth=require(_0x0e19('0x5'));var interaction=require(_0x0e19('0x6'));var config=require(_0x0e19('0x7'));var controller=require(_0x0e19('0x8'));router[_0x0e19('0x9')]('/',auth[_0x0e19('0xa')](),controller[_0x0e19('0xb')]);router['get'](_0x0e19('0xc'),auth[_0x0e19('0xa')](),controller['describe']);router[_0x0e19('0x9')](_0x0e19('0xd'),auth[_0x0e19('0xa')](),controller[_0x0e19('0xe')]);router[_0x0e19('0x9')](_0x0e19('0xf'),auth[_0x0e19('0xa')](),controller[_0x0e19('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0e19('0x11')]);router[_0x0e19('0x12')](_0x0e19('0xd'),auth[_0x0e19('0xa')](),controller[_0x0e19('0x13')]);router[_0x0e19('0x14')](_0x0e19('0xd'),auth[_0x0e19('0xa')](),controller[_0x0e19('0x15')]);module[_0x0e19('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index f8326ee..b081ed5 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 _0x6370=['moment','sequelize','DATE','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN'];(function(_0x4b899d,_0xaa6efe){var _0x1e791b=function(_0x5aad95){while(--_0x5aad95){_0x4b899d['push'](_0x4b899d['shift']());}};_0x1e791b(++_0xaa6efe);}(_0x6370,0x99));var _0x0637=function(_0x50b634,_0x1a9974){_0x50b634=_0x50b634-0x0;var _0xcbb832=_0x6370[_0x50b634];return _0xcbb832;};'use strict';var moment=require(_0x0637('0x0'));var Sequelize=require(_0x0637('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x0637('0x2')],'set':function(_0x2e5fca){this[_0x0637('0x3')]('starttime',_0x2e5fca);this[_0x0637('0x3')](_0x0637('0x4'),moment()[_0x0637('0x5')](_0x0637('0x6')));}},'endtime':{'type':Sequelize[_0x0637('0x2')]},'membername':{'type':Sequelize[_0x0637('0x7')]},'projectname':{'type':Sequelize[_0x0637('0x7')]},'queue':{'type':Sequelize[_0x0637('0x7')]},'uniqueid':{'type':Sequelize[_0x0637('0x7')]},'calleridname':{'type':Sequelize[_0x0637('0x7')]},'calleridnum':{'type':Sequelize[_0x0637('0x7')]},'completed':{'type':Sequelize[_0x0637('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x1cc8=['DATE','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize'];(function(_0x1c0991,_0x4f22d2){var _0x5034de=function(_0x520f49){while(--_0x520f49){_0x1c0991['push'](_0x1c0991['shift']());}};_0x5034de(++_0x4f22d2);}(_0x1cc8,0x7e));var _0x81cc=function(_0x4096ff,_0x1315e7){_0x4096ff=_0x4096ff-0x0;var _0x2d65b3=_0x1cc8[_0x4096ff];return _0x2d65b3;};'use strict';var moment=require(_0x81cc('0x0'));var Sequelize=require(_0x81cc('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x81cc('0x2')],'set':function(_0x12014e){this['setDataValue']('starttime',_0x12014e);this['setDataValue'](_0x81cc('0x3'),moment()[_0x81cc('0x4')](_0x81cc('0x5')));}},'endtime':{'type':Sequelize[_0x81cc('0x2')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x81cc('0x6')]},'queue':{'type':Sequelize[_0x81cc('0x6')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x81cc('0x6')]},'completed':{'type':Sequelize[_0x81cc('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 12748c4..07c95c1 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 _0x77c3=['rows','rimraf','zip-dir','moment','mustache','util','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','json','offset','undefined','limit','count','status','set','apply','reject','save','update','destroy','then','end','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','JscriptySessionReport','include','findAll','params','length','includeAll','find','catch','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty'];(function(_0xcd7bba,_0x2e3c48){var _0xe0e52d=function(_0x22fcf9){while(--_0x22fcf9){_0xcd7bba['push'](_0xcd7bba['shift']());}};_0xe0e52d(++_0x2e3c48);}(_0x77c3,0x17d));var _0x377c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x77c3[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x377c('0x0'));var zipdir=require(_0x377c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x377c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x377c('0x3'));var util=require(_0x377c('0x4'));var path=require('path');var sox=require(_0x377c('0x5'));var csv=require(_0x377c('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x377c('0x7'));var _=require('lodash');var squel=require(_0x377c('0x8'));var crypto=require(_0x377c('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x377c('0xa'));var toCsv=require(_0x377c('0x6'));var querystring=require(_0x377c('0xb'));var Papa=require(_0x377c('0xc'));var Redis=require(_0x377c('0xd'));var authService=require(_0x377c('0xe'));var qs=require(_0x377c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x377c('0x10'));var logger=require('../../config/logger')(_0x377c('0x11'));var utils=require(_0x377c('0x12'));var config=require(_0x377c('0x13'));var licenseUtil=require(_0x377c('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x343849,_0x1066b6){_0x1066b6=_0x1066b6||0xcc;return function(_0x12b760){if(_0x12b760){return _0x343849[_0x377c('0x15')](_0x1066b6);}return _0x343849['status'](_0x1066b6)['end']();};}function respondWithResult(_0x5742d9,_0x123e58){_0x123e58=_0x123e58||0xc8;return function(_0x5d906c){if(_0x5d906c){return _0x5742d9['status'](_0x123e58)[_0x377c('0x16')](_0x5d906c);}};}function respondWithFilteredResult(_0x5e45ba,_0x38b4fb){return function(_0x482b46){if(_0x482b46){var _0x533633=typeof _0x38b4fb[_0x377c('0x17')]===_0x377c('0x18')&&typeof _0x38b4fb[_0x377c('0x19')]==='undefined';var _0x40ab1f=_0x482b46[_0x377c('0x1a')];var _0xeb4c61=_0x533633?0x0:_0x38b4fb[_0x377c('0x17')];var _0x59fc2f=_0x533633?_0x482b46[_0x377c('0x1a')]:_0x38b4fb['offset']+_0x38b4fb['limit'];var _0xf6256a;if(_0x59fc2f>=_0x40ab1f){_0x59fc2f=_0x40ab1f;_0xf6256a=0xc8;}else{_0xf6256a=0xce;}_0x5e45ba[_0x377c('0x1b')](_0xf6256a);return _0x5e45ba[_0x377c('0x1c')]('Content-Range',_0xeb4c61+'-'+_0x59fc2f+'/'+_0x40ab1f)[_0x377c('0x16')](_0x482b46);}return null;};}function patchUpdates(_0x1a6e88){return function(_0x2e67b7){try{jsonpatch[_0x377c('0x1d')](_0x2e67b7,_0x1a6e88,!![]);}catch(_0x1b6d99){return BPromise[_0x377c('0x1e')](_0x1b6d99);}return _0x2e67b7[_0x377c('0x1f')]();};}function saveUpdates(_0x55eeff,_0x3a6b1a){return function(_0x4d1558){if(_0x4d1558){return _0x4d1558[_0x377c('0x20')](_0x55eeff)['then'](function(_0x84c619){return _0x84c619;});}return null;};}function removeEntity(_0x49256b,_0x58e833){return function(_0x545bf9){if(_0x545bf9){return _0x545bf9[_0x377c('0x21')]()[_0x377c('0x22')](function(){_0x49256b['status'](0xcc)[_0x377c('0x23')]();});}};}function handleEntityNotFound(_0x2139e5,_0x44b698){return function(_0x3a2682){if(!_0x3a2682){_0x2139e5[_0x377c('0x15')](0x194);}return _0x3a2682;};}function handleError(_0x2f1447,_0x3853e2){_0x3853e2=_0x3853e2||0x1f4;return function(_0x91d3b){logger[_0x377c('0x24')](_0x91d3b[_0x377c('0x25')]);if(_0x91d3b[_0x377c('0x26')]){delete _0x91d3b['name'];}_0x2f1447['status'](_0x3853e2)['send'](_0x91d3b);};}exports[_0x377c('0x27')]=function(_0x3f6593,_0x501386){var _0x326b2a={},_0xc4a4cb={},_0x51c2f7={'count':0x0,'rows':[]};var _0xe2d1d1=_['map'](db['JscriptySessionReport'][_0x377c('0x28')],function(_0x5c963e){return{'name':_0x5c963e[_0x377c('0x29')],'type':_0x5c963e[_0x377c('0x2a')][_0x377c('0x2b')]};});_0xc4a4cb[_0x377c('0x2c')]=_[_0x377c('0x2d')](_0xe2d1d1,_0x377c('0x26'));_0xc4a4cb[_0x377c('0x2e')]=_[_0x377c('0x2f')](_0x3f6593[_0x377c('0x2e')]);_0xc4a4cb[_0x377c('0x30')]=_[_0x377c('0x31')](_0xc4a4cb['model'],_0xc4a4cb[_0x377c('0x2e')]);_0x326b2a[_0x377c('0x32')]=_['intersection'](_0xc4a4cb['model'],qs[_0x377c('0x33')](_0x3f6593[_0x377c('0x2e')][_0x377c('0x33')]));_0x326b2a[_0x377c('0x32')]=_0x326b2a[_0x377c('0x32')]['length']?_0x326b2a['attributes']:_0xc4a4cb[_0x377c('0x2c')];if(!_0x3f6593[_0x377c('0x2e')]['hasOwnProperty'](_0x377c('0x34'))){_0x326b2a[_0x377c('0x19')]=qs[_0x377c('0x19')](_0x3f6593['query'][_0x377c('0x19')]);_0x326b2a[_0x377c('0x17')]=qs[_0x377c('0x17')](_0x3f6593[_0x377c('0x2e')][_0x377c('0x17')]);}_0x326b2a[_0x377c('0x35')]=qs['sort'](_0x3f6593[_0x377c('0x2e')][_0x377c('0x36')]);_0x326b2a[_0x377c('0x37')]=qs[_0x377c('0x30')](_[_0x377c('0x38')](_0x3f6593[_0x377c('0x2e')],_0xc4a4cb['filters']),_0xe2d1d1);if(_0x3f6593[_0x377c('0x2e')][_0x377c('0x39')]){_0x326b2a[_0x377c('0x37')]=_[_0x377c('0x3a')](_0x326b2a[_0x377c('0x37')],{'$or':_[_0x377c('0x2d')](_0xe2d1d1,function(_0x51bb98){if(_0x51bb98[_0x377c('0x2a')]!=='VIRTUAL'){var _0x2cc15b={};_0x2cc15b[_0x51bb98[_0x377c('0x26')]]={'$like':'%'+_0x3f6593[_0x377c('0x2e')][_0x377c('0x39')]+'%'};return _0x2cc15b;}})});}_0x326b2a=_[_0x377c('0x3a')]({},_0x326b2a,_0x3f6593[_0x377c('0x3b')]);var _0x531069={'where':_0x326b2a[_0x377c('0x37')]};return db[_0x377c('0x3c')][_0x377c('0x1a')](_0x531069)[_0x377c('0x22')](function(_0xfc163f){_0x51c2f7[_0x377c('0x1a')]=_0xfc163f;if(_0x3f6593['query']['includeAll']){_0x326b2a[_0x377c('0x3d')]=[{'all':!![]}];}return db[_0x377c('0x3c')][_0x377c('0x3e')](_0x326b2a);})[_0x377c('0x22')](function(_0x2903e8){_0x51c2f7['rows']=_0x2903e8;return _0x51c2f7;})[_0x377c('0x22')](respondWithFilteredResult(_0x501386,_0x326b2a))['catch'](handleError(_0x501386,null));};exports['show']=function(_0x35e2ad,_0x5bda4c){var _0x5a1538={'raw':!![],'where':{'id':_0x35e2ad[_0x377c('0x3f')]['id']}},_0x50e007={};_0x50e007['model']=_['keys'](db[_0x377c('0x3c')][_0x377c('0x28')]);_0x50e007[_0x377c('0x2e')]=_[_0x377c('0x2f')](_0x35e2ad['query']);_0x50e007['filters']=_[_0x377c('0x31')](_0x50e007[_0x377c('0x2c')],_0x50e007[_0x377c('0x2e')]);_0x5a1538['attributes']=_['intersection'](_0x50e007[_0x377c('0x2c')],qs[_0x377c('0x33')](_0x35e2ad[_0x377c('0x2e')][_0x377c('0x33')]));_0x5a1538[_0x377c('0x32')]=_0x5a1538['attributes'][_0x377c('0x40')]?_0x5a1538[_0x377c('0x32')]:_0x50e007[_0x377c('0x2c')];if(_0x35e2ad[_0x377c('0x2e')][_0x377c('0x41')]){_0x5a1538['include']=[{'all':!![]}];}_0x5a1538=_[_0x377c('0x3a')]({},_0x5a1538,_0x35e2ad[_0x377c('0x3b')]);return db[_0x377c('0x3c')][_0x377c('0x42')](_0x5a1538)[_0x377c('0x22')](handleEntityNotFound(_0x5bda4c,null))[_0x377c('0x22')](respondWithResult(_0x5bda4c,null))[_0x377c('0x43')](handleError(_0x5bda4c,null));};exports[_0x377c('0x44')]=function(_0x1d4fab,_0x40da36){return db[_0x377c('0x3c')]['create'](_0x1d4fab[_0x377c('0x45')],{})[_0x377c('0x22')](respondWithResult(_0x40da36,0xc9))[_0x377c('0x43')](handleError(_0x40da36,null));};exports[_0x377c('0x20')]=function(_0x3e2263,_0x18a15d){if(_0x3e2263[_0x377c('0x45')]['id']){delete _0x3e2263[_0x377c('0x45')]['id'];}return db[_0x377c('0x3c')][_0x377c('0x42')]({'where':{'id':_0x3e2263[_0x377c('0x3f')]['id']}})['then'](handleEntityNotFound(_0x18a15d,null))['then'](saveUpdates(_0x3e2263[_0x377c('0x45')],null))['then'](respondWithResult(_0x18a15d,null))['catch'](handleError(_0x18a15d,null));};exports[_0x377c('0x21')]=function(_0x1212b9,_0x5b8409){return db[_0x377c('0x3c')][_0x377c('0x42')]({'where':{'id':_0x1212b9[_0x377c('0x3f')]['id']}})[_0x377c('0x22')](handleEntityNotFound(_0x5b8409,null))[_0x377c('0x22')](removeEntity(_0x5b8409,null))[_0x377c('0x43')](handleError(_0x5b8409,null));};exports[_0x377c('0x46')]=function(_0x20f5de,_0x1d3a43){return db['JscriptySessionReport']['describe']()['then'](respondWithResult(_0x1d3a43,null))[_0x377c('0x43')](handleError(_0x1d3a43,null));};exports[_0x377c('0x47')]=function(_0x5b61cb,_0x16f5be,_0x3269c9){var _0x312a67={'raw':!![],'where':{}};var _0x3f8e76={};var _0x4800c4={'count':0x0,'rows':[]};return db[_0x377c('0x3c')][_0x377c('0x48')]({'where':{'id':_0x5b61cb[_0x377c('0x3f')]['id']}})[_0x377c('0x22')](handleEntityNotFound(_0x16f5be,null))['then'](function(_0x4f7a75){if(_0x4f7a75){_0x3f8e76[_0x377c('0x2c')]=_[_0x377c('0x2f')](db[_0x377c('0x49')][_0x377c('0x28')]);_0x3f8e76[_0x377c('0x2e')]=_[_0x377c('0x2f')](_0x5b61cb[_0x377c('0x2e')]);_0x3f8e76[_0x377c('0x30')]=_['intersection'](_0x3f8e76[_0x377c('0x2c')],_0x3f8e76[_0x377c('0x2e')]);_0x312a67['attributes']=_['intersection'](_0x3f8e76[_0x377c('0x2c')],qs[_0x377c('0x33')](_0x5b61cb['query']['fields']));_0x312a67[_0x377c('0x32')]=_0x312a67[_0x377c('0x32')]['length']?_0x312a67[_0x377c('0x32')]:_0x3f8e76[_0x377c('0x2c')];if(!_0x5b61cb['query'][_0x377c('0x4a')](_0x377c('0x34'))){_0x312a67[_0x377c('0x19')]=qs[_0x377c('0x19')](_0x5b61cb[_0x377c('0x2e')][_0x377c('0x19')]);_0x312a67['offset']=qs[_0x377c('0x17')](_0x5b61cb[_0x377c('0x2e')][_0x377c('0x17')]);}_0x312a67[_0x377c('0x35')]=qs[_0x377c('0x36')](_0x5b61cb[_0x377c('0x2e')][_0x377c('0x36')]);_0x312a67['where']=qs[_0x377c('0x30')](_[_0x377c('0x38')](_0x5b61cb[_0x377c('0x2e')],_0x3f8e76['filters']));_0x312a67['where']['SessionId']=_0x4f7a75['id'];if(_0x5b61cb[_0x377c('0x2e')]['filter']){_0x312a67['where']=_[_0x377c('0x3a')](_0x312a67[_0x377c('0x37')],{'$or':_['map'](_0x312a67[_0x377c('0x32')],function(_0x3718f7){var _0x10ca13={};_0x10ca13[_0x3718f7]={'$like':'%'+_0x5b61cb[_0x377c('0x2e')]['filter']+'%'};return _0x10ca13;})});}_0x312a67=_[_0x377c('0x3a')]({},_0x312a67,_0x5b61cb[_0x377c('0x3b')]);return db[_0x377c('0x49')][_0x377c('0x1a')]({'where':_0x312a67['where']})[_0x377c('0x22')](function(_0x257b6e){_0x4800c4[_0x377c('0x1a')]=_0x257b6e;if(_0x5b61cb[_0x377c('0x2e')][_0x377c('0x41')]){_0x312a67['include']=[{'all':!![]}];}return db[_0x377c('0x49')]['findAll'](_0x312a67);})[_0x377c('0x22')](function(_0x1d0bc0){_0x4800c4[_0x377c('0x4b')]=_0x1d0bc0;return _0x4800c4;});}})[_0x377c('0x22')](respondWithFilteredResult(_0x16f5be,_0x312a67))[_0x377c('0x43')](handleError(_0x16f5be,null));}; \ No newline at end of file +var _0xc92f=['key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','length','include','find','create','body','catch','describe','getQuestions','pick','SessionId','JscriptyQuestionReport','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','update','then','destroy','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type'];(function(_0xd2dd48,_0x1a985){var _0x3853db=function(_0x2cfb39){while(--_0x2cfb39){_0xd2dd48['push'](_0xd2dd48['shift']());}};_0x3853db(++_0x1a985);}(_0xc92f,0x14d));var _0xfc92=function(_0x432f51,_0x227811){_0x432f51=_0x432f51-0x0;var _0x2c9cbf=_0xc92f[_0x432f51];return _0x2c9cbf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfc92('0x0'));var zipdir=require(_0xfc92('0x1'));var jsonpatch=require(_0xfc92('0x2'));var rp=require(_0xfc92('0x3'));var moment=require(_0xfc92('0x4'));var BPromise=require(_0xfc92('0x5'));var Mustache=require(_0xfc92('0x6'));var util=require(_0xfc92('0x7'));var path=require('path');var sox=require(_0xfc92('0x8'));var csv=require(_0xfc92('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfc92('0xa'));var _=require(_0xfc92('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfc92('0x9'));var querystring=require(_0xfc92('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfc92('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xfc92('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc92('0xf'))(_0xfc92('0x10'));var utils=require(_0xfc92('0x11'));var config=require(_0xfc92('0x12'));var licenseUtil=require(_0xfc92('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ce7de,_0x1890c3){_0x1890c3=_0x1890c3||0xcc;return function(_0x14ce72){if(_0x14ce72){return _0x3ce7de[_0xfc92('0x14')](_0x1890c3);}return _0x3ce7de[_0xfc92('0x15')](_0x1890c3)[_0xfc92('0x16')]();};}function respondWithResult(_0x2db74e,_0x10caab){_0x10caab=_0x10caab||0xc8;return function(_0x459fc1){if(_0x459fc1){return _0x2db74e[_0xfc92('0x15')](_0x10caab)['json'](_0x459fc1);}};}function respondWithFilteredResult(_0x4e4ff4,_0x4ca166){return function(_0x2613e6){if(_0x2613e6){var _0xfbe350=typeof _0x4ca166[_0xfc92('0x17')]===_0xfc92('0x18')&&typeof _0x4ca166[_0xfc92('0x19')]===_0xfc92('0x18');var _0x2b13ce=_0x2613e6['count'];var _0x423fde=_0xfbe350?0x0:_0x4ca166['offset'];var _0x52009a=_0xfbe350?_0x2613e6[_0xfc92('0x1a')]:_0x4ca166[_0xfc92('0x17')]+_0x4ca166[_0xfc92('0x19')];var _0x584ab5;if(_0x52009a>=_0x2b13ce){_0x52009a=_0x2b13ce;_0x584ab5=0xc8;}else{_0x584ab5=0xce;}_0x4e4ff4[_0xfc92('0x15')](_0x584ab5);return _0x4e4ff4[_0xfc92('0x1b')]('Content-Range',_0x423fde+'-'+_0x52009a+'/'+_0x2b13ce)['json'](_0x2613e6);}return null;};}function patchUpdates(_0x2cea9e){return function(_0x424ab1){try{jsonpatch[_0xfc92('0x1c')](_0x424ab1,_0x2cea9e,!![]);}catch(_0x40bf3c){return BPromise[_0xfc92('0x1d')](_0x40bf3c);}return _0x424ab1['save']();};}function saveUpdates(_0x4de6cc,_0x1d190d){return function(_0x1c2415){if(_0x1c2415){return _0x1c2415[_0xfc92('0x1e')](_0x4de6cc)[_0xfc92('0x1f')](function(_0x58b58c){return _0x58b58c;});}return null;};}function removeEntity(_0x465801,_0x498688){return function(_0x448e46){if(_0x448e46){return _0x448e46[_0xfc92('0x20')]()['then'](function(){_0x465801['status'](0xcc)[_0xfc92('0x16')]();});}};}function handleEntityNotFound(_0x1d5215,_0x3ab153){return function(_0x1d2502){if(!_0x1d2502){_0x1d5215[_0xfc92('0x14')](0x194);}return _0x1d2502;};}function handleError(_0x122f31,_0x5895f5){_0x5895f5=_0x5895f5||0x1f4;return function(_0x1adc85){logger['error'](_0x1adc85[_0xfc92('0x21')]);if(_0x1adc85[_0xfc92('0x22')]){delete _0x1adc85[_0xfc92('0x22')];}_0x122f31['status'](_0x5895f5)[_0xfc92('0x23')](_0x1adc85);};}exports[_0xfc92('0x24')]=function(_0x2f976b,_0x2db305){var _0x5f2a21={},_0x37cdc9={},_0x31d0ea={'count':0x0,'rows':[]};var _0x573fa6=_[_0xfc92('0x25')](db[_0xfc92('0x26')][_0xfc92('0x27')],function(_0x1ed343){return{'name':_0x1ed343[_0xfc92('0x28')],'type':_0x1ed343[_0xfc92('0x29')][_0xfc92('0x2a')]};});_0x37cdc9[_0xfc92('0x2b')]=_[_0xfc92('0x25')](_0x573fa6,_0xfc92('0x22'));_0x37cdc9[_0xfc92('0x2c')]=_[_0xfc92('0x2d')](_0x2f976b[_0xfc92('0x2c')]);_0x37cdc9[_0xfc92('0x2e')]=_[_0xfc92('0x2f')](_0x37cdc9['model'],_0x37cdc9[_0xfc92('0x2c')]);_0x5f2a21['attributes']=_['intersection'](_0x37cdc9[_0xfc92('0x2b')],qs[_0xfc92('0x30')](_0x2f976b[_0xfc92('0x2c')]['fields']));_0x5f2a21[_0xfc92('0x31')]=_0x5f2a21[_0xfc92('0x31')]['length']?_0x5f2a21[_0xfc92('0x31')]:_0x37cdc9[_0xfc92('0x2b')];if(!_0x2f976b[_0xfc92('0x2c')][_0xfc92('0x32')](_0xfc92('0x33'))){_0x5f2a21[_0xfc92('0x19')]=qs[_0xfc92('0x19')](_0x2f976b[_0xfc92('0x2c')][_0xfc92('0x19')]);_0x5f2a21[_0xfc92('0x17')]=qs[_0xfc92('0x17')](_0x2f976b[_0xfc92('0x2c')][_0xfc92('0x17')]);}_0x5f2a21[_0xfc92('0x34')]=qs[_0xfc92('0x35')](_0x2f976b[_0xfc92('0x2c')][_0xfc92('0x35')]);_0x5f2a21[_0xfc92('0x36')]=qs[_0xfc92('0x2e')](_['pick'](_0x2f976b['query'],_0x37cdc9[_0xfc92('0x2e')]),_0x573fa6);if(_0x2f976b['query'][_0xfc92('0x37')]){_0x5f2a21['where']=_[_0xfc92('0x38')](_0x5f2a21[_0xfc92('0x36')],{'$or':_[_0xfc92('0x25')](_0x573fa6,function(_0x577442){if(_0x577442['type']!==_0xfc92('0x39')){var _0x2b86e4={};_0x2b86e4[_0x577442[_0xfc92('0x22')]]={'$like':'%'+_0x2f976b[_0xfc92('0x2c')][_0xfc92('0x37')]+'%'};return _0x2b86e4;}})});}_0x5f2a21=_[_0xfc92('0x38')]({},_0x5f2a21,_0x2f976b[_0xfc92('0x3a')]);var _0x15c298={'where':_0x5f2a21[_0xfc92('0x36')]};return db[_0xfc92('0x26')][_0xfc92('0x1a')](_0x15c298)[_0xfc92('0x1f')](function(_0x493a86){_0x31d0ea[_0xfc92('0x1a')]=_0x493a86;if(_0x2f976b[_0xfc92('0x2c')][_0xfc92('0x3b')]){_0x5f2a21['include']=[{'all':!![]}];}return db[_0xfc92('0x26')][_0xfc92('0x3c')](_0x5f2a21);})[_0xfc92('0x1f')](function(_0x1d931c){_0x31d0ea[_0xfc92('0x3d')]=_0x1d931c;return _0x31d0ea;})[_0xfc92('0x1f')](respondWithFilteredResult(_0x2db305,_0x5f2a21))['catch'](handleError(_0x2db305,null));};exports[_0xfc92('0x3e')]=function(_0x2536ce,_0x5bc36a){var _0x2296ed={'raw':!![],'where':{'id':_0x2536ce[_0xfc92('0x3f')]['id']}},_0x3cfd8a={};_0x3cfd8a[_0xfc92('0x2b')]=_['keys'](db[_0xfc92('0x26')][_0xfc92('0x27')]);_0x3cfd8a[_0xfc92('0x2c')]=_[_0xfc92('0x2d')](_0x2536ce[_0xfc92('0x2c')]);_0x3cfd8a[_0xfc92('0x2e')]=_[_0xfc92('0x2f')](_0x3cfd8a['model'],_0x3cfd8a[_0xfc92('0x2c')]);_0x2296ed[_0xfc92('0x31')]=_[_0xfc92('0x2f')](_0x3cfd8a[_0xfc92('0x2b')],qs['fields'](_0x2536ce['query']['fields']));_0x2296ed[_0xfc92('0x31')]=_0x2296ed['attributes'][_0xfc92('0x40')]?_0x2296ed[_0xfc92('0x31')]:_0x3cfd8a[_0xfc92('0x2b')];if(_0x2536ce[_0xfc92('0x2c')][_0xfc92('0x3b')]){_0x2296ed[_0xfc92('0x41')]=[{'all':!![]}];}_0x2296ed=_[_0xfc92('0x38')]({},_0x2296ed,_0x2536ce[_0xfc92('0x3a')]);return db[_0xfc92('0x26')][_0xfc92('0x42')](_0x2296ed)[_0xfc92('0x1f')](handleEntityNotFound(_0x5bc36a,null))[_0xfc92('0x1f')](respondWithResult(_0x5bc36a,null))['catch'](handleError(_0x5bc36a,null));};exports[_0xfc92('0x43')]=function(_0x2a428f,_0x3e2180){return db[_0xfc92('0x26')][_0xfc92('0x43')](_0x2a428f[_0xfc92('0x44')],{})[_0xfc92('0x1f')](respondWithResult(_0x3e2180,0xc9))['catch'](handleError(_0x3e2180,null));};exports[_0xfc92('0x1e')]=function(_0x5bd612,_0x5846d6){if(_0x5bd612[_0xfc92('0x44')]['id']){delete _0x5bd612[_0xfc92('0x44')]['id'];}return db['JscriptySessionReport'][_0xfc92('0x42')]({'where':{'id':_0x5bd612['params']['id']}})[_0xfc92('0x1f')](handleEntityNotFound(_0x5846d6,null))[_0xfc92('0x1f')](saveUpdates(_0x5bd612[_0xfc92('0x44')],null))[_0xfc92('0x1f')](respondWithResult(_0x5846d6,null))[_0xfc92('0x45')](handleError(_0x5846d6,null));};exports[_0xfc92('0x20')]=function(_0x5d3c5f,_0x117ed8){return db[_0xfc92('0x26')][_0xfc92('0x42')]({'where':{'id':_0x5d3c5f['params']['id']}})[_0xfc92('0x1f')](handleEntityNotFound(_0x117ed8,null))[_0xfc92('0x1f')](removeEntity(_0x117ed8,null))[_0xfc92('0x45')](handleError(_0x117ed8,null));};exports[_0xfc92('0x46')]=function(_0x1709b1,_0x4df3b3){return db[_0xfc92('0x26')][_0xfc92('0x46')]()[_0xfc92('0x1f')](respondWithResult(_0x4df3b3,null))['catch'](handleError(_0x4df3b3,null));};exports[_0xfc92('0x47')]=function(_0x2579db,_0x186cf6,_0x26d4cb){var _0x54c1e6={'raw':!![],'where':{}};var _0x19a30f={};var _0x30faed={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x2579db['params']['id']}})['then'](handleEntityNotFound(_0x186cf6,null))['then'](function(_0x5f4dfa){if(_0x5f4dfa){_0x19a30f['model']=_[_0xfc92('0x2d')](db['JscriptyQuestionReport']['rawAttributes']);_0x19a30f[_0xfc92('0x2c')]=_[_0xfc92('0x2d')](_0x2579db['query']);_0x19a30f[_0xfc92('0x2e')]=_[_0xfc92('0x2f')](_0x19a30f[_0xfc92('0x2b')],_0x19a30f['query']);_0x54c1e6['attributes']=_[_0xfc92('0x2f')](_0x19a30f['model'],qs['fields'](_0x2579db[_0xfc92('0x2c')][_0xfc92('0x30')]));_0x54c1e6['attributes']=_0x54c1e6[_0xfc92('0x31')][_0xfc92('0x40')]?_0x54c1e6[_0xfc92('0x31')]:_0x19a30f[_0xfc92('0x2b')];if(!_0x2579db[_0xfc92('0x2c')][_0xfc92('0x32')](_0xfc92('0x33'))){_0x54c1e6['limit']=qs[_0xfc92('0x19')](_0x2579db[_0xfc92('0x2c')][_0xfc92('0x19')]);_0x54c1e6[_0xfc92('0x17')]=qs[_0xfc92('0x17')](_0x2579db[_0xfc92('0x2c')][_0xfc92('0x17')]);}_0x54c1e6['order']=qs[_0xfc92('0x35')](_0x2579db[_0xfc92('0x2c')][_0xfc92('0x35')]);_0x54c1e6[_0xfc92('0x36')]=qs[_0xfc92('0x2e')](_[_0xfc92('0x48')](_0x2579db['query'],_0x19a30f['filters']));_0x54c1e6[_0xfc92('0x36')][_0xfc92('0x49')]=_0x5f4dfa['id'];if(_0x2579db['query']['filter']){_0x54c1e6[_0xfc92('0x36')]=_[_0xfc92('0x38')](_0x54c1e6[_0xfc92('0x36')],{'$or':_[_0xfc92('0x25')](_0x54c1e6['attributes'],function(_0x38e15e){var _0x3eecf5={};_0x3eecf5[_0x38e15e]={'$like':'%'+_0x2579db[_0xfc92('0x2c')][_0xfc92('0x37')]+'%'};return _0x3eecf5;})});}_0x54c1e6=_['merge']({},_0x54c1e6,_0x2579db[_0xfc92('0x3a')]);return db[_0xfc92('0x4a')][_0xfc92('0x1a')]({'where':_0x54c1e6[_0xfc92('0x36')]})[_0xfc92('0x1f')](function(_0x52615d){_0x30faed[_0xfc92('0x1a')]=_0x52615d;if(_0x2579db[_0xfc92('0x2c')]['includeAll']){_0x54c1e6['include']=[{'all':!![]}];}return db[_0xfc92('0x4a')][_0xfc92('0x3c')](_0x54c1e6);})[_0xfc92('0x1f')](function(_0x3c1ac1){_0x30faed[_0xfc92('0x3d')]=_0x3c1ac1;return _0x30faed;});}})['then'](respondWithFilteredResult(_0x186cf6,_0x54c1e6))[_0xfc92('0x45')](handleError(_0x186cf6,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index eb2506d..2ebd165 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(_0x13ca32,_0x2bf3fb){var _0x5c6fdd=function(_0x5c0449){while(--_0x5c0449){_0x13ca32['push'](_0x13ca32['shift']());}};_0x5c6fdd(++_0x2bf3fb);}(_0x5496,0x175));var _0x6549=function(_0x18a9f7,_0x23e2a7){_0x18a9f7=_0x18a9f7-0x0;var _0x75dede=_0x5496[_0x18a9f7];return _0x75dede;};'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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions','lodash','util'];(function(_0x54e0ce,_0xc469c8){var _0x1e6d82=function(_0x557f13){while(--_0x557f13){_0x54e0ce['push'](_0x54e0ce['shift']());}};_0x1e6d82(++_0xc469c8);}(_0x7a54,0x106));var _0x47a5=function(_0x5a0887,_0x1b7763){_0x5a0887=_0x5a0887-0x0;var _0x143447=_0x7a54[_0x5a0887];return _0x143447;};'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/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index f31f626..8888997 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x582628,_0x45dc5d){var _0x4dfea5=function(_0x2ed090){while(--_0x2ed090){_0x582628['push'](_0x582628['shift']());}};_0x4dfea5(++_0x45dc5d);}(_0xadb5,0xad));var _0x5adb=function(_0x260d38,_0x4f8f12){_0x260d38=_0x260d38-0x0;var _0x2cc7d7=_0xadb5[_0x260d38];return _0x2cc7d7;};'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']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x0424=['request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x0424,0x159));var _0x4042=function(_0xa72345,_0x1fd304){_0xa72345=_0xa72345-0x0;var _0xbc82fb=_0x0424[_0xa72345];return _0xbc82fb;};'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')]('JscriptySessionReport,\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);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 45f2ec6..d70daec 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 _0xd8f3=['./license.controller','index','/:id','isAuthenticated','update','get','/download_log_file','downloadLogFile','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xd8f3,0xc4));var _0x3d8f=function(_0x34f4db,_0x1cbb42){_0x34f4db=_0x34f4db-0x0;var _0x501a68=_0xd8f3[_0x34f4db];return _0x501a68;};'use strict';var multer=require(_0x3d8f('0x0'));var util=require(_0x3d8f('0x1'));var path=require(_0x3d8f('0x2'));var timeout=require(_0x3d8f('0x3'));var express=require(_0x3d8f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3d8f('0x5'));var interaction=require(_0x3d8f('0x6'));var config=require(_0x3d8f('0x7'));var controller=require(_0x3d8f('0x8'));router['get']('/',controller[_0x3d8f('0x9')]);router['put'](_0x3d8f('0xa'),auth[_0x3d8f('0xb')](),controller[_0x3d8f('0xc')]);router[_0x3d8f('0xd')](_0x3d8f('0xe'),auth['isAuthenticated'](),controller[_0x3d8f('0xf')]);module[_0x3d8f('0x10')]=router; \ No newline at end of file +var _0xd81e=['../../components/auth/service','../../components/interaction/service','get','index','put','/:id','update','/download_log_file','exports','util','path','express','Router'];(function(_0x291a6f,_0x30087e){var _0x2a7921=function(_0x2d2f5b){while(--_0x2d2f5b){_0x291a6f['push'](_0x291a6f['shift']());}};_0x2a7921(++_0x30087e);}(_0xd81e,0x11a));var _0xed81=function(_0x513af4,_0x221bfe){_0x513af4=_0x513af4-0x0;var _0x1da002=_0xd81e[_0x513af4];return _0x1da002;};'use strict';var multer=require('multer');var util=require(_0xed81('0x0'));var path=require(_0xed81('0x1'));var timeout=require('connect-timeout');var express=require(_0xed81('0x2'));var router=express[_0xed81('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xed81('0x4'));var interaction=require(_0xed81('0x5'));var config=require('../../config/environment');var controller=require('./license.controller');router[_0xed81('0x6')]('/',controller[_0xed81('0x7')]);router[_0xed81('0x8')](_0xed81('0x9'),auth['isAuthenticated'](),controller[_0xed81('0xa')]);router[_0xed81('0x6')](_0xed81('0xb'),auth['isAuthenticated'](),controller['downloadLogFile']);module[_0xed81('0xc')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 2c91647..1f2f2d3 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 _0xfb3b=['exports','TEXT','STRING','sequelize'];(function(_0x1dc474,_0x1ecc88){var _0xfcd4fd=function(_0x550281){while(--_0x550281){_0x1dc474['push'](_0x1dc474['shift']());}};_0xfcd4fd(++_0x1ecc88);}(_0xfb3b,0x1af));var _0xbfb3=function(_0x395e33,_0x3eb06f){_0x395e33=_0x395e33-0x0;var _0x3094d8=_0xfb3b[_0x395e33];return _0x3094d8;};'use strict';var Sequelize=require(_0xbfb3('0x0'));module[_0xbfb3('0x1')]={'license':{'type':Sequelize[_0xbfb3('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xbfb3('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x1407=['exports','TEXT','STRING','INTEGER'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1407,0x1c0));var _0x7140=function(_0x169b7a,_0xccd19){_0x169b7a=_0x169b7a-0x0;var _0x37e2e5=_0x1407[_0x169b7a];return _0x37e2e5;};'use strict';var Sequelize=require('sequelize');module[_0x7140('0x0')]={'license':{'type':Sequelize[_0x7140('0x1')]},'data1':{'type':Sequelize[_0x7140('0x2')]},'data2':{'type':Sequelize[_0x7140('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x7140('0x3')],'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 a2f9d5f..3dc37c5 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 _0xff2f=['key','demo','downloadLogFile','license-info.log','join','/var','xcally','setHeader','Content-disposition','attachment;\x20filename=','text/plain','download','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','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','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','model','keys','License','rawAttributes','query','filters','intersection','fields','attributes','length','options','getLicense','catch','body','get','checkLicense'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xff2f,0x9e));var _0xfff2=function(_0x1eb7b7,_0x3cc652){_0x1eb7b7=_0x1eb7b7-0x0;var _0x509dba=_0xff2f[_0x1eb7b7];return _0x509dba;};'use strict';var emlformat=require(_0xfff2('0x0'));var rimraf=require(_0xfff2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfff2('0x2'));var rp=require(_0xfff2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfff2('0x4'));var util=require(_0xfff2('0x5'));var path=require(_0xfff2('0x6'));var sox=require(_0xfff2('0x7'));var csv=require('to-csv');var ejs=require(_0xfff2('0x8'));var fs=require('fs');var fs_extra=require(_0xfff2('0x9'));var _=require(_0xfff2('0xa'));var squel=require('squel');var crypto=require(_0xfff2('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfff2('0xc'));var Papa=require(_0xfff2('0xd'));var Redis=require(_0xfff2('0xe'));var authService=require(_0xfff2('0xf'));var qs=require(_0xfff2('0x10'));var as=require(_0xfff2('0x11'));var hardwareService=require(_0xfff2('0x12'));var logger=require(_0xfff2('0x13'))(_0xfff2('0x14'));var utils=require(_0xfff2('0x15'));var config=require(_0xfff2('0x16'));var licenseUtil=require(_0xfff2('0x17'));var db=require(_0xfff2('0x18'))['db'];function respondWithStatusCode(_0x1e54af,_0x5b19d7){_0x5b19d7=_0x5b19d7||0xcc;return function(_0x32fd3f){if(_0x32fd3f){return _0x1e54af[_0xfff2('0x19')](_0x5b19d7);}return _0x1e54af[_0xfff2('0x1a')](_0x5b19d7)[_0xfff2('0x1b')]();};}function respondWithResult(_0x352450,_0x2ab9c8){_0x2ab9c8=_0x2ab9c8||0xc8;return function(_0x2f538c){if(_0x2f538c){return _0x352450[_0xfff2('0x1a')](_0x2ab9c8)[_0xfff2('0x1c')](_0x2f538c);}};}function respondWithFilteredResult(_0x907f51,_0x5f0861){return function(_0x145179){if(_0x145179){var _0x5e2d34=typeof _0x5f0861[_0xfff2('0x1d')]===_0xfff2('0x1e')&&typeof _0x5f0861[_0xfff2('0x1f')]===_0xfff2('0x1e');var _0x36aefb=_0x145179['count'];var _0x3ace04=_0x5e2d34?0x0:_0x5f0861['offset'];var _0xa3a0c8=_0x5e2d34?_0x145179[_0xfff2('0x20')]:_0x5f0861[_0xfff2('0x1d')]+_0x5f0861['limit'];var _0x4bd165;if(_0xa3a0c8>=_0x36aefb){_0xa3a0c8=_0x36aefb;_0x4bd165=0xc8;}else{_0x4bd165=0xce;}_0x907f51['status'](_0x4bd165);return _0x907f51[_0xfff2('0x21')](_0xfff2('0x22'),_0x3ace04+'-'+_0xa3a0c8+'/'+_0x36aefb)['json'](_0x145179);}return null;};}function patchUpdates(_0x33a7b9){return function(_0x4be5c8){try{jsonpatch[_0xfff2('0x23')](_0x4be5c8,_0x33a7b9,!![]);}catch(_0x19c3ce){return BPromise[_0xfff2('0x24')](_0x19c3ce);}return _0x4be5c8[_0xfff2('0x25')]();};}function saveUpdates(_0x210ea8,_0xf89ab8){return function(_0x2621a6){if(_0x2621a6){return _0x2621a6[_0xfff2('0x26')](_0x210ea8)[_0xfff2('0x27')](function(_0x510975){return _0x510975;});}return null;};}function removeEntity(_0x13397d,_0x370bb9){return function(_0x547a59){if(_0x547a59){return _0x547a59[_0xfff2('0x28')]()[_0xfff2('0x27')](function(){_0x13397d[_0xfff2('0x1a')](0xcc)[_0xfff2('0x1b')]();});}};}function handleEntityNotFound(_0x1ffa74,_0x543e0f){return function(_0x173cf8){if(!_0x173cf8){_0x1ffa74['sendStatus'](0x194);}return _0x173cf8;};}function handleError(_0x1fdae8,_0x4e69f9){_0x4e69f9=_0x4e69f9||0x1f4;return function(_0x1c0db5){logger[_0xfff2('0x29')](_0x1c0db5[_0xfff2('0x2a')]);if(_0x1c0db5[_0xfff2('0x2b')]){delete _0x1c0db5['name'];}_0x1fdae8[_0xfff2('0x1a')](_0x4e69f9)[_0xfff2('0x2c')](_0x1c0db5);};}var utilLicense=require(_0xfff2('0x17'));exports['index']=function(_0xeced54,_0x47c884){var _0xce3e5d={'raw':!![],'where':{'id':0x1}},_0xea41e2={};_0xea41e2[_0xfff2('0x2d')]=_[_0xfff2('0x2e')](db[_0xfff2('0x2f')][_0xfff2('0x30')]);_0xea41e2[_0xfff2('0x31')]=_[_0xfff2('0x2e')](_0xeced54[_0xfff2('0x31')]);_0xea41e2[_0xfff2('0x32')]=_[_0xfff2('0x33')](_0xea41e2[_0xfff2('0x2d')],_0xea41e2[_0xfff2('0x31')]);_0xce3e5d['attributes']=_[_0xfff2('0x33')](_0xea41e2['model'],qs[_0xfff2('0x34')](_0xeced54['query'][_0xfff2('0x34')]));_0xce3e5d[_0xfff2('0x35')]=_0xce3e5d[_0xfff2('0x35')][_0xfff2('0x36')]?_0xce3e5d[_0xfff2('0x35')]:_0xea41e2['model'];_0xce3e5d=_['merge']({},_0xce3e5d,_0xeced54[_0xfff2('0x37')]);return utilLicense[_0xfff2('0x38')](_0xce3e5d)['then'](respondWithResult(_0x47c884,null))[_0xfff2('0x39')](handleError(_0x47c884,null));};exports[_0xfff2('0x26')]=function(_0x3ce5a9,_0x171499){if(_0x3ce5a9[_0xfff2('0x3a')]['id']){delete _0x3ce5a9['body']['id'];}return db[_0xfff2('0x2f')]['find']({'where':{'id':_0x3ce5a9['params']['id']}})['then'](handleEntityNotFound(_0x171499,null))[_0xfff2('0x27')](function(_0x49284e){var _0x277ac4=_0x49284e[_0xfff2('0x3b')]({'plain':!![]});return utilLicense[_0xfff2('0x3c')](_0x277ac4,_0x3ce5a9[_0xfff2('0x3a')][_0xfff2('0x3d')]);})[_0xfff2('0x27')](function(_0x90d8c2){if(!_0x90d8c2[_0xfff2('0x3e')]){return saveUpdates(_0x3ce5a9[_0xfff2('0x3a')],null);}return _0x90d8c2;})['then'](respondWithResult(_0x171499,null))['catch'](handleError(_0x171499,null));};exports[_0xfff2('0x3f')]=function(_0x2c063a,_0x52eb10){var _0x23d76f=_0xfff2('0x40');var _0x440abe=path[_0xfff2('0x41')](_0xfff2('0x42'),'log',_0xfff2('0x43'),_0x23d76f);_0x52eb10[_0xfff2('0x44')](_0xfff2('0x45'),_0xfff2('0x46')+_0x23d76f);_0x52eb10[_0xfff2('0x21')]('Content-Type',_0xfff2('0x47'));_0x52eb10[_0xfff2('0x48')](_0x440abe);}; \ No newline at end of file +var _0x206d=['intersection','model','attributes','fields','length','merge','getLicense','catch','body','find','params','get','demo','downloadLogFile','license-info.log','join','log','xcally','Content-disposition','attachment;\x20filename=','set','Content-Type','download','eml-format','zip-dir','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','update','then','destroy','error','stack','name','send','License','rawAttributes','keys','query','filters'];(function(_0xb39b52,_0xf60442){var _0x1051bd=function(_0x54bad6){while(--_0x54bad6){_0xb39b52['push'](_0xb39b52['shift']());}};_0x1051bd(++_0xf60442);}(_0x206d,0x1e5));var _0xd206=function(_0x21c170,_0x5684b8){_0x21c170=_0x21c170-0x0;var _0x1d2b6d=_0x206d[_0x21c170];return _0x1d2b6d;};'use strict';var emlformat=require(_0xd206('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd206('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd206('0x2'));var BPromise=require(_0xd206('0x3'));var Mustache=require('mustache');var util=require(_0xd206('0x4'));var path=require(_0xd206('0x5'));var sox=require('sox');var csv=require(_0xd206('0x6'));var ejs=require(_0xd206('0x7'));var fs=require('fs');var fs_extra=require(_0xd206('0x8'));var _=require('lodash');var squel=require(_0xd206('0x9'));var crypto=require(_0xd206('0xa'));var jsforce=require(_0xd206('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xd206('0x6'));var querystring=require(_0xd206('0xc'));var Papa=require('papaparse');var Redis=require(_0xd206('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd206('0xe'));var logger=require(_0xd206('0xf'))(_0xd206('0x10'));var utils=require(_0xd206('0x11'));var config=require(_0xd206('0x12'));var licenseUtil=require(_0xd206('0x13'));var db=require(_0xd206('0x14'))['db'];function respondWithStatusCode(_0x1f368a,_0x1092ca){_0x1092ca=_0x1092ca||0xcc;return function(_0x374d9c){if(_0x374d9c){return _0x1f368a[_0xd206('0x15')](_0x1092ca);}return _0x1f368a[_0xd206('0x16')](_0x1092ca)[_0xd206('0x17')]();};}function respondWithResult(_0x58145a,_0x3d1953){_0x3d1953=_0x3d1953||0xc8;return function(_0x5389c0){if(_0x5389c0){return _0x58145a[_0xd206('0x16')](_0x3d1953)[_0xd206('0x18')](_0x5389c0);}};}function respondWithFilteredResult(_0xeba083,_0x2b53a3){return function(_0x1d8094){if(_0x1d8094){var _0x2c045b=typeof _0x2b53a3[_0xd206('0x19')]===_0xd206('0x1a')&&typeof _0x2b53a3[_0xd206('0x1b')]===_0xd206('0x1a');var _0x37c1c2=_0x1d8094['count'];var _0x209470=_0x2c045b?0x0:_0x2b53a3[_0xd206('0x19')];var _0x560a35=_0x2c045b?_0x1d8094[_0xd206('0x1c')]:_0x2b53a3[_0xd206('0x19')]+_0x2b53a3[_0xd206('0x1b')];var _0x5af916;if(_0x560a35>=_0x37c1c2){_0x560a35=_0x37c1c2;_0x5af916=0xc8;}else{_0x5af916=0xce;}_0xeba083[_0xd206('0x16')](_0x5af916);return _0xeba083['set']('Content-Range',_0x209470+'-'+_0x560a35+'/'+_0x37c1c2)['json'](_0x1d8094);}return null;};}function patchUpdates(_0x46df5){return function(_0x2e014e){try{jsonpatch[_0xd206('0x1d')](_0x2e014e,_0x46df5,!![]);}catch(_0x4f02f4){return BPromise['reject'](_0x4f02f4);}return _0x2e014e[_0xd206('0x1e')]();};}function saveUpdates(_0x445952,_0x54a8f1){return function(_0x507ce5){if(_0x507ce5){return _0x507ce5[_0xd206('0x1f')](_0x445952)[_0xd206('0x20')](function(_0x1db21b){return _0x1db21b;});}return null;};}function removeEntity(_0x3a5ea0,_0x1e86e0){return function(_0x59e43f){if(_0x59e43f){return _0x59e43f[_0xd206('0x21')]()['then'](function(){_0x3a5ea0[_0xd206('0x16')](0xcc)[_0xd206('0x17')]();});}};}function handleEntityNotFound(_0x1b244e,_0x10df7c){return function(_0x3221a2){if(!_0x3221a2){_0x1b244e[_0xd206('0x15')](0x194);}return _0x3221a2;};}function handleError(_0x255291,_0x3f36dc){_0x3f36dc=_0x3f36dc||0x1f4;return function(_0x4cd053){logger[_0xd206('0x22')](_0x4cd053[_0xd206('0x23')]);if(_0x4cd053['name']){delete _0x4cd053[_0xd206('0x24')];}_0x255291['status'](_0x3f36dc)[_0xd206('0x25')](_0x4cd053);};}var utilLicense=require(_0xd206('0x13'));exports['index']=function(_0x8fc4cb,_0x3dafb0){var _0x32f91e={'raw':!![],'where':{'id':0x1}},_0x258ad8={};_0x258ad8['model']=_['keys'](db[_0xd206('0x26')][_0xd206('0x27')]);_0x258ad8['query']=_[_0xd206('0x28')](_0x8fc4cb[_0xd206('0x29')]);_0x258ad8[_0xd206('0x2a')]=_[_0xd206('0x2b')](_0x258ad8[_0xd206('0x2c')],_0x258ad8[_0xd206('0x29')]);_0x32f91e[_0xd206('0x2d')]=_['intersection'](_0x258ad8['model'],qs[_0xd206('0x2e')](_0x8fc4cb[_0xd206('0x29')][_0xd206('0x2e')]));_0x32f91e[_0xd206('0x2d')]=_0x32f91e[_0xd206('0x2d')][_0xd206('0x2f')]?_0x32f91e[_0xd206('0x2d')]:_0x258ad8['model'];_0x32f91e=_[_0xd206('0x30')]({},_0x32f91e,_0x8fc4cb['options']);return utilLicense[_0xd206('0x31')](_0x32f91e)[_0xd206('0x20')](respondWithResult(_0x3dafb0,null))[_0xd206('0x32')](handleError(_0x3dafb0,null));};exports['update']=function(_0x2fc300,_0x3401b0){if(_0x2fc300[_0xd206('0x33')]['id']){delete _0x2fc300[_0xd206('0x33')]['id'];}return db['License'][_0xd206('0x34')]({'where':{'id':_0x2fc300[_0xd206('0x35')]['id']}})['then'](handleEntityNotFound(_0x3401b0,null))[_0xd206('0x20')](function(_0x1cb469){var _0x5dc135=_0x1cb469[_0xd206('0x36')]({'plain':!![]});return utilLicense['checkLicense'](_0x5dc135,_0x2fc300['body']['key']);})[_0xd206('0x20')](function(_0x3fd95e){if(!_0x3fd95e[_0xd206('0x37')]){return saveUpdates(_0x2fc300['body'],null);}return _0x3fd95e;})[_0xd206('0x20')](respondWithResult(_0x3401b0,null))[_0xd206('0x32')](handleError(_0x3401b0,null));};exports[_0xd206('0x38')]=function(_0x59a682,_0x3d86ea){var _0x3e8fb7=_0xd206('0x39');var _0x2ce300=path[_0xd206('0x3a')]('/var',_0xd206('0x3b'),_0xd206('0x3c'),_0x3e8fb7);_0x3d86ea['setHeader'](_0xd206('0x3d'),_0xd206('0x3e')+_0x3e8fb7);_0x3d86ea[_0xd206('0x3f')](_0xd206('0x40'),'text/plain');_0x3d86ea[_0xd206('0x41')](_0x2ce300);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index b43b5ea..d064bcb 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 _0x54de=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./license.attributes','exports','define','License'];(function(_0x42d22a,_0xf11dd4){var _0x173c1b=function(_0x2fb329){while(--_0x2fb329){_0x42d22a['push'](_0x42d22a['shift']());}};_0x173c1b(++_0xf11dd4);}(_0x54de,0x18c));var _0xe54d=function(_0x28a71e,_0x1cb610){_0x28a71e=_0x28a71e-0x0;var _0x3afe2c=_0x54de[_0x28a71e];return _0x3afe2c;};'use strict';var _=require(_0xe54d('0x0'));var util=require(_0xe54d('0x1'));var logger=require(_0xe54d('0x2'))(_0xe54d('0x3'));var moment=require(_0xe54d('0x4'));var BPromise=require('bluebird');var rp=require(_0xe54d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe54d('0x6'));var config=require(_0xe54d('0x7'));var attributes=require(_0xe54d('0x8'));module[_0xe54d('0x9')]=function(_0x569090,_0x21a1ad){return _0x569090[_0xe54d('0xa')](_0xe54d('0xb'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80fa=['License','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define'];(function(_0x47bb05,_0x43aa27){var _0x4a33f0=function(_0x212620){while(--_0x212620){_0x47bb05['push'](_0x47bb05['shift']());}};_0x4a33f0(++_0x43aa27);}(_0x80fa,0xf8));var _0xa80f=function(_0x5d8d2b,_0x4f1fc9){_0x5d8d2b=_0x5d8d2b-0x0;var _0x134489=_0x80fa[_0x5d8d2b];return _0x134489;};'use strict';var _=require(_0xa80f('0x0'));var util=require('util');var logger=require(_0xa80f('0x1'))(_0xa80f('0x2'));var moment=require(_0xa80f('0x3'));var BPromise=require(_0xa80f('0x4'));var rp=require(_0xa80f('0x5'));var fs=require('fs');var path=require(_0xa80f('0x6'));var rimraf=require(_0xa80f('0x7'));var config=require(_0xa80f('0x8'));var attributes=require(_0xa80f('0x9'));module[_0xa80f('0xa')]=function(_0x21b20d,_0x142917){return _0x21b20d[_0xa80f('0xb')](_0xa80f('0xc'),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 0d33a87..e01b31a 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 _0x56ee=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','debug','stringify','error'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x56ee,0xf6));var _0xe56e=function(_0x25e109,_0x6ab24c){_0x25e109=_0x25e109-0x0;var _0xc0f7d6=_0x56ee[_0x25e109];return _0xc0f7d6;};'use strict';var _=require(_0xe56e('0x0'));var util=require(_0xe56e('0x1'));var moment=require(_0xe56e('0x2'));var BPromise=require(_0xe56e('0x3'));var rs=require(_0xe56e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe56e('0x5'))['db'];var utils=require(_0xe56e('0x6'));var logger=require(_0xe56e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe56e('0x8'));var client=jayson[_0xe56e('0x9')][_0xe56e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a3edb,_0x24a75a,_0x2de207){return new BPromise(function(_0x1055bb,_0x264bdc){return client[_0xe56e('0xb')](_0x3a3edb,_0x2de207)[_0xe56e('0xc')](function(_0x44a081){logger[_0xe56e('0xd')](_0xe56e('0xe'),_0x24a75a,'request\x20sent');logger[_0xe56e('0xf')]('License,\x20%s,\x20%s,\x20%s',_0x24a75a,'request\x20sent',JSON[_0xe56e('0x10')](_0x44a081));if(_0x44a081[_0xe56e('0x11')]){if(_0x44a081[_0xe56e('0x11')][_0xe56e('0x12')]===0x1f4){logger[_0xe56e('0x11')](_0xe56e('0xe'),_0x24a75a,_0x44a081[_0xe56e('0x11')][_0xe56e('0x13')]);return _0x264bdc(_0x44a081[_0xe56e('0x11')][_0xe56e('0x13')]);}logger['error']('License,\x20%s,\x20%s',_0x24a75a,_0x44a081[_0xe56e('0x11')]['message']);return _0x1055bb(_0x44a081['error'][_0xe56e('0x13')]);}else{logger[_0xe56e('0xd')](_0xe56e('0xe'),_0x24a75a,'request\x20sent');_0x1055bb(_0x44a081[_0xe56e('0x14')][_0xe56e('0x13')]);}})[_0xe56e('0x15')](function(_0x4b3032){logger[_0xe56e('0x11')](_0xe56e('0xe'),_0x24a75a,_0x4b3032);_0x264bdc(_0x4b3032);});});} \ No newline at end of file +var _0xb8d3=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x3185a0,_0x4ac61a){var _0x15260e=function(_0x46b5b4){while(--_0x46b5b4){_0x3185a0['push'](_0x3185a0['shift']());}};_0x15260e(++_0x4ac61a);}(_0xb8d3,0x7a));var _0x3b8d=function(_0x20c59f,_0x583d0a){_0x20c59f=_0x20c59f-0x0;var _0x2b6df8=_0xb8d3[_0x20c59f];return _0x2b6df8;};'use strict';var _=require(_0x3b8d('0x0'));var util=require(_0x3b8d('0x1'));var moment=require(_0x3b8d('0x2'));var BPromise=require(_0x3b8d('0x3'));var rs=require(_0x3b8d('0x4'));var fs=require('fs');var Redis=require(_0x3b8d('0x5'));var db=require(_0x3b8d('0x6'))['db'];var utils=require(_0x3b8d('0x7'));var logger=require('../../config/logger')(_0x3b8d('0x8'));var config=require('../../config/environment');var jayson=require(_0x3b8d('0x9'));var client=jayson[_0x3b8d('0xa')][_0x3b8d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x132efc,_0x113d36,_0x22f541){return new BPromise(function(_0x4129a2,_0x152276){return client[_0x3b8d('0xc')](_0x132efc,_0x22f541)[_0x3b8d('0xd')](function(_0x477d80){logger[_0x3b8d('0xe')](_0x3b8d('0xf'),_0x113d36,_0x3b8d('0x10'));logger[_0x3b8d('0x11')](_0x3b8d('0x12'),_0x113d36,'request\x20sent',JSON[_0x3b8d('0x13')](_0x477d80));if(_0x477d80[_0x3b8d('0x14')]){if(_0x477d80[_0x3b8d('0x14')][_0x3b8d('0x15')]===0x1f4){logger[_0x3b8d('0x14')](_0x3b8d('0xf'),_0x113d36,_0x477d80[_0x3b8d('0x14')][_0x3b8d('0x16')]);return _0x152276(_0x477d80[_0x3b8d('0x14')][_0x3b8d('0x16')]);}logger[_0x3b8d('0x14')](_0x3b8d('0xf'),_0x113d36,_0x477d80[_0x3b8d('0x14')]['message']);return _0x4129a2(_0x477d80[_0x3b8d('0x14')][_0x3b8d('0x16')]);}else{logger[_0x3b8d('0xe')](_0x3b8d('0xf'),_0x113d36,_0x3b8d('0x10'));_0x4129a2(_0x477d80[_0x3b8d('0x17')]['message']);}})[_0x3b8d('0x18')](function(_0x152e4d){logger[_0x3b8d('0x14')](_0x3b8d('0xf'),_0x113d36,_0x152e4d);_0x152276(_0x152e4d);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 6a58c34..2da7147 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 _0x3a92=['/:id/applications','addApplications','/:id/send','send','put','update','delete','removeAnswers','removeImap','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','getAnswers','/:id/in_servers','getImap','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','create','addImap','/:id/out_servers','addSmtp','addInteraction'];(function(_0x47eb10,_0x18c02e){var _0x3cbf8c=function(_0x431170){while(--_0x431170){_0x47eb10['push'](_0x47eb10['shift']());}};_0x3cbf8c(++_0x18c02e);}(_0x3a92,0xa4));var _0x23a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a92[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x23a9('0x0'));var util=require(_0x23a9('0x1'));var path=require(_0x23a9('0x2'));var timeout=require(_0x23a9('0x3'));var express=require('express');var router=express[_0x23a9('0x4')]();var fs_extra=require(_0x23a9('0x5'));var auth=require(_0x23a9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x23a9('0x7'));var controller=require(_0x23a9('0x8'));router[_0x23a9('0x9')]('/',auth[_0x23a9('0xa')](),controller[_0x23a9('0xb')]);router['get'](_0x23a9('0xc'),auth[_0x23a9('0xa')](),controller[_0x23a9('0xd')]);router[_0x23a9('0x9')](_0x23a9('0xe'),auth[_0x23a9('0xa')](),controller[_0x23a9('0xf')]);router['get']('/:id/dispositions',auth[_0x23a9('0xa')](),controller[_0x23a9('0x10')]);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x23a9('0x11')]);router[_0x23a9('0x9')](_0x23a9('0x12'),auth[_0x23a9('0xa')](),controller[_0x23a9('0x13')]);router[_0x23a9('0x9')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x23a9('0x14')]);router[_0x23a9('0x9')](_0x23a9('0x15'),auth[_0x23a9('0xa')](),controller[_0x23a9('0x16')]);router[_0x23a9('0x9')]('/:id/applications',auth['isAuthenticated'](),controller[_0x23a9('0x17')]);router[_0x23a9('0x9')](_0x23a9('0x18'),auth[_0x23a9('0xa')](),controller[_0x23a9('0x19')]);router[_0x23a9('0x9')](_0x23a9('0x1a'),auth['isAuthenticated'](),controller[_0x23a9('0x1b')]);router[_0x23a9('0x9')](_0x23a9('0x1c'),auth[_0x23a9('0xa')](),controller[_0x23a9('0x1d')]);router[_0x23a9('0x1e')](_0x23a9('0x1f'),auth[_0x23a9('0xa')](),controller[_0x23a9('0x20')]);router[_0x23a9('0x1e')](_0x23a9('0x21'),auth[_0x23a9('0xa')](),controller[_0x23a9('0x22')]);router['post']('/',auth[_0x23a9('0xa')](),controller[_0x23a9('0x23')]);router[_0x23a9('0x1e')]('/:id/in_servers',auth[_0x23a9('0xa')](),controller[_0x23a9('0x24')]);router[_0x23a9('0x1e')](_0x23a9('0x25'),auth['isAuthenticated'](),controller[_0x23a9('0x26')]);router['post'](_0x23a9('0x15'),auth[_0x23a9('0xa')](),controller[_0x23a9('0x27')]);router[_0x23a9('0x1e')](_0x23a9('0x28'),auth[_0x23a9('0xa')](),controller[_0x23a9('0x29')]);router['post'](_0x23a9('0x2a'),auth['isAuthenticated'](),controller[_0x23a9('0x2b')]);router['post'](_0x23a9('0x1c'),auth[_0x23a9('0xa')](),controller['addAgents']);router[_0x23a9('0x2c')]('/:id',auth[_0x23a9('0xa')](),controller[_0x23a9('0x2d')]);router[_0x23a9('0x2e')]('/:id/dispositions',auth[_0x23a9('0xa')](),controller['removeDispositions']);router[_0x23a9('0x2e')](_0x23a9('0x21'),auth[_0x23a9('0xa')](),controller[_0x23a9('0x2f')]);router['delete'](_0x23a9('0x12'),auth[_0x23a9('0xa')](),controller[_0x23a9('0x30')]);router[_0x23a9('0x2e')]('/:id/out_servers',auth[_0x23a9('0xa')](),controller['removeSmtp']);router[_0x23a9('0x2e')](_0x23a9('0xe'),auth['isAuthenticated'](),controller[_0x23a9('0x31')]);router[_0x23a9('0x2e')](_0x23a9('0x1c'),auth[_0x23a9('0xa')](),controller['removeAgents']);module[_0x23a9('0x32')]=router; \ No newline at end of file +var _0x416c=['post','addDisposition','/:id/canned_answers','addAnswer','create','addSmtp','addInteraction','/:id/applications','send','addAgents','put','update','/:id/dispositions','delete','removeSmtp','destroy','removeAgents','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','index','get','/describe','isAuthenticated','describe','/:id','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/messages','getMessages','/:id/verify','/:id/users','getAgents'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x416c,0x1b0));var _0xc416=function(_0x2bc837,_0x2c4ad5){_0x2bc837=_0x2bc837-0x0;var _0x50b3a3=_0x416c[_0x2bc837];return _0x50b3a3;};'use strict';var multer=require(_0xc416('0x0'));var util=require(_0xc416('0x1'));var path=require(_0xc416('0x2'));var timeout=require('connect-timeout');var express=require(_0xc416('0x3'));var router=express['Router']();var fs_extra=require(_0xc416('0x4'));var auth=require(_0xc416('0x5'));var interaction=require(_0xc416('0x6'));var config=require(_0xc416('0x7'));var controller=require(_0xc416('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xc416('0x9')]);router[_0xc416('0xa')](_0xc416('0xb'),auth[_0xc416('0xc')](),controller[_0xc416('0xd')]);router['get'](_0xc416('0xe'),auth[_0xc416('0xc')](),controller['show']);router[_0xc416('0xa')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xc416('0xf')]);router['get']('/:id/canned_answers',auth[_0xc416('0xc')](),controller[_0xc416('0x10')]);router[_0xc416('0xa')](_0xc416('0x11'),auth[_0xc416('0xc')](),controller[_0xc416('0x12')]);router[_0xc416('0xa')](_0xc416('0x13'),auth[_0xc416('0xc')](),controller[_0xc416('0x14')]);router['get'](_0xc416('0x15'),auth['isAuthenticated'](),controller[_0xc416('0x16')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0xc416('0xa')](_0xc416('0x17'),auth['isAuthenticated'](),controller[_0xc416('0x18')]);router[_0xc416('0xa')](_0xc416('0x19'),auth[_0xc416('0xc')](),controller['verifySmtp']);router[_0xc416('0xa')](_0xc416('0x1a'),auth['isAuthenticated'](),controller[_0xc416('0x1b')]);router[_0xc416('0x1c')]('/:id/dispositions',auth[_0xc416('0xc')](),controller[_0xc416('0x1d')]);router['post'](_0xc416('0x1e'),auth[_0xc416('0xc')](),controller[_0xc416('0x1f')]);router['post']('/',auth[_0xc416('0xc')](),controller[_0xc416('0x20')]);router[_0xc416('0x1c')](_0xc416('0x11'),auth[_0xc416('0xc')](),controller['addImap']);router['post'](_0xc416('0x13'),auth[_0xc416('0xc')](),controller[_0xc416('0x21')]);router['post']('/:id/interactions',auth[_0xc416('0xc')](),controller[_0xc416('0x22')]);router[_0xc416('0x1c')](_0xc416('0x23'),auth[_0xc416('0xc')](),controller['addApplications']);router['post']('/:id/send',auth[_0xc416('0xc')](),controller[_0xc416('0x24')]);router['post']('/:id/users',auth[_0xc416('0xc')](),controller[_0xc416('0x25')]);router[_0xc416('0x26')](_0xc416('0xe'),auth[_0xc416('0xc')](),controller[_0xc416('0x27')]);router['delete'](_0xc416('0x28'),auth[_0xc416('0xc')](),controller['removeDispositions']);router[_0xc416('0x29')](_0xc416('0x1e'),auth[_0xc416('0xc')](),controller['removeAnswers']);router[_0xc416('0x29')]('/:id/in_servers',auth[_0xc416('0xc')](),controller['removeImap']);router['delete'](_0xc416('0x13'),auth[_0xc416('0xc')](),controller[_0xc416('0x2a')]);router['delete']('/:id',auth[_0xc416('0xc')](),controller[_0xc416('0x2b')]);router[_0xc416('0x29')](_0xc416('0x1a'),auth[_0xc416('0xc')](),controller[_0xc416('0x2c')]);module[_0xc416('0x2d')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 92235a2..d35e369 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 _0x1c2e=['UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','ENUM','gmail','hotmail','outlook365','getDataValue','custom','provider','sequelize','exports','STRING','BOOLEAN','TEXT','INTEGER'];(function(_0xa30766,_0x6f613e){var _0x24e780=function(_0x3d58fb){while(--_0x3d58fb){_0xa30766['push'](_0xa30766['shift']());}};_0x24e780(++_0x6f613e);}(_0x1c2e,0x1aa));var _0xe1c2=function(_0x4e364d,_0x845bf6){_0x4e364d=_0x4e364d-0x0;var _0x96d48e=_0x1c2e[_0x4e364d];return _0x96d48e;};'use strict';var Sequelize=require(_0xe1c2('0x0'));module[_0xe1c2('0x1')]={'description':{'type':Sequelize[_0xe1c2('0x2')]},'name':{'type':Sequelize[_0xe1c2('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xe1c2('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xe1c2('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xe1c2('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xe1c2('0x4')]},'markAsUnread':{'type':Sequelize[_0xe1c2('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xe1c2('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xe1c2('0x5')](0x2)[_0xe1c2('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xe1c2('0x4')],'defaultValue':function(){return _0xe1c2('0x7');}},'notificationSound':{'type':Sequelize[_0xe1c2('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe1c2('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe1c2('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe1c2('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe1c2('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe1c2('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0xe1c2('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xe1c2('0x3')],'defaultValue':![],'comment':_0xe1c2('0x9'),'set':function(_0x1a4508){if(!_0x1a4508)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xe1c2('0xa')]('mandatoryDisposition',_0x1a4508);}},'provider':{'type':Sequelize[_0xe1c2('0xb')](_0xe1c2('0xc'),_0xe1c2('0xd'),'yahoo',_0xe1c2('0xe')),'defaultValue':null,'get':function(){var _0x53ee39=this[_0xe1c2('0xf')]('provider');return _0x53ee39||_0xe1c2('0x10');},'set':function(_0x1e7bf1){if(_0x1e7bf1===_0xe1c2('0x10')){_0x1e7bf1=null;}return this['setDataValue'](_0xe1c2('0x11'),_0x1e7bf1);}}}; \ No newline at end of file +var _0x4026=['gmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','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','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM'];(function(_0x356312,_0x4e93b7){var _0x1b1055=function(_0x224f96){while(--_0x224f96){_0x356312['push'](_0x356312['shift']());}};_0x1b1055(++_0x4e93b7);}(_0x4026,0x1bb));var _0x6402=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4026[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6402('0x0'));module[_0x6402('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x6402('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x6402('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x6402('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x6402('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x6402('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x6402('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x6402('0x2')],'allowNull':![],'defaultValue':_0x6402('0x4')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x6402('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6402('0x6');}},'notificationSound':{'type':Sequelize[_0x6402('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6402('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6402('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6402('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6402('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x6402('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x228805){if(!_0x228805)this[_0x6402('0x9')](_0x6402('0xa'),null);this[_0x6402('0x9')](_0x6402('0xb'),_0x228805);}},'provider':{'type':Sequelize[_0x6402('0xc')](_0x6402('0xd'),'hotmail',_0x6402('0xe'),_0x6402('0xf')),'defaultValue':null,'get':function(){var _0x23e50e=this[_0x6402('0x10')](_0x6402('0x11'));return _0x23e50e||_0x6402('0x12');},'set':function(_0x457e06){if(_0x457e06===_0x6402('0x12')){_0x457e06=null;}return this[_0x6402('0x9')]('provider',_0x457e06);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index bdac3bc..49d06c7 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 _0x8af6=['type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','MailAccount','include','findAll','rows','show','MailServerOut','mandatoryDispositionPause','rawAttributes','includeAll','find','body','provider','custom','params','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','findOne','removeDispositions','ids','addAnswer','CannedAnswer','create','getAnswers','removeAnswers','email','isNil','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','CmContact','Contact','User','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','MailApplication','findAndCountAll','priority','finally','send','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','sendMail','List\x20not\x20found','ListId','messageId','subject','attach','out','Interaction','Messages','verifySmtp','getSmtpOptions','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','path','lodash','../../components/parsers/qs','api','redis','defaults','localhost','./mailAccount.socket','jayson/promise','http','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','Content-Range','update','then','destroy','get','end','stack','name','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','password','modernAuthentication','CloudProviderId','pass','host','port','secure','service','username','authentication','Imap','Smtp','MailServerIn','Pause','map','fieldName'];(function(_0x2a2d6f,_0x161240){var _0x586744=function(_0x2607c0){while(--_0x2607c0){_0x2a2d6f['push'](_0x2a2d6f['shift']());}};_0x586744(++_0x161240);}(_0x8af6,0x13b));var _0x68af=function(_0x382059,_0x976e90){_0x382059=_0x382059-0x0;var _0x64bab6=_0x8af6[_0x382059];return _0x64bab6;};'use strict';var moment=require(_0x68af('0x0'));var BPromise=require(_0x68af('0x1'));var util=require('util');var path=require(_0x68af('0x2'));var _=require(_0x68af('0x3'));var juice=require('juice');var Redis=require('ioredis');var qs=require(_0x68af('0x4'));var logger=require('../../config/logger')(_0x68af('0x5'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x68af('0x6')]=_[_0x68af('0x7')](config[_0x68af('0x6')],{'host':_0x68af('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x68af('0x6')]));require(_0x68af('0x9'))['register'](socket);var jayson=require(_0x68af('0xa'));var client=jayson['client'][_0x68af('0xb')]({'port':0x232b});function respondWithRpcPromise(_0x1f4402,_0x2a3cf7,_0x7bb1e5,_0x5c5d28){return new BPromise(function(_0x2d0b4e,_0x2a66a9){var _0x4642c1=_0x5c5d28||client;return _0x4642c1['request'](_0x1f4402,_0x7bb1e5)['then'](function(_0x47db90){logger[_0x68af('0xc')](_0x68af('0xd'),_0x2a3cf7,_0x68af('0xe'));logger[_0x68af('0xf')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x2a3cf7,_0x68af('0xe'),JSON['stringify'](_0x47db90));if(_0x47db90[_0x68af('0x10')]){if(_0x47db90[_0x68af('0x10')][_0x68af('0x11')]===0x1f4){logger[_0x68af('0x10')](_0x68af('0xd'),_0x2a3cf7,_0x47db90[_0x68af('0x10')][_0x68af('0x12')]);return _0x2a66a9(_0x47db90[_0x68af('0x10')]['message']);}logger[_0x68af('0x10')](_0x68af('0xd'),_0x2a3cf7,_0x47db90[_0x68af('0x10')]['message']);return _0x2d0b4e(_0x47db90[_0x68af('0x10')]['message']);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x2a3cf7,_0x68af('0xe'));_0x2d0b4e(_0x47db90[_0x68af('0x13')][_0x68af('0x12')]);}})[_0x68af('0x14')](function(_0x4b5e58){logger[_0x68af('0x10')](_0x68af('0xd'),_0x2a3cf7,_0x4b5e58);_0x2a66a9(_0x4b5e58);});});}function respondWithStatusCode(_0x5526d2,_0x247dd4){_0x247dd4=_0x247dd4||0xcc;return function(_0x408e02){if(_0x408e02){return _0x5526d2[_0x68af('0x15')](_0x247dd4);}return _0x5526d2[_0x68af('0x16')](_0x247dd4)['end']();};}function respondWithResult(_0x4a610f,_0x4dec77){_0x4dec77=_0x4dec77||0xc8;return function(_0x5ee4e3){if(_0x5ee4e3){return _0x4a610f[_0x68af('0x16')](_0x4dec77)[_0x68af('0x17')](_0x5ee4e3);}};}function respondWithFilteredResult(_0x371c13,_0x2cf8a0){return function(_0x337e47){if(_0x337e47){var _0x17fe2f=typeof _0x2cf8a0[_0x68af('0x18')]==='undefined'&&typeof _0x2cf8a0[_0x68af('0x19')]===_0x68af('0x1a');var _0x758da0=_0x337e47[_0x68af('0x1b')];var _0x31131a=_0x17fe2f?0x0:_0x2cf8a0['offset'];var _0x168199=_0x17fe2f?_0x337e47[_0x68af('0x1b')]:_0x2cf8a0[_0x68af('0x18')]+_0x2cf8a0[_0x68af('0x19')];var _0x1c209d;if(_0x168199>=_0x758da0){_0x168199=_0x758da0;_0x1c209d=0xc8;}else{_0x1c209d=0xce;}_0x371c13['status'](_0x1c209d);return _0x371c13['set'](_0x68af('0x1c'),_0x31131a+'-'+_0x168199+'/'+_0x758da0)[_0x68af('0x17')](_0x337e47);}return null;};}function saveUpdates(_0x56e75e){return function(_0x10ec06){if(_0x10ec06){return _0x10ec06[_0x68af('0x1d')](_0x56e75e)[_0x68af('0x1e')](function(_0x3722cb){return _0x3722cb;});}return null;};}function removeEntity(_0x4fbb84){return function(_0x4b6510){if(_0x4b6510){return _0x4b6510[_0x68af('0x1f')]()[_0x68af('0x1e')](function(){var _0x59f5c7=_0x4b6510[_0x68af('0x20')]({'plain':!![]});var _0x2be0b1='MailAccounts';return db['UserProfileResource'][_0x68af('0x1f')]({'where':{'type':_0x2be0b1,'resourceId':_0x59f5c7['id']}})[_0x68af('0x1e')](function(){return _0x4b6510;});})[_0x68af('0x1e')](function(){_0x4fbb84[_0x68af('0x16')](0xcc)[_0x68af('0x21')]();});}};}function handleEntityNotFound(_0xd7b8e1){return function(_0x5859f1){if(!_0x5859f1){_0xd7b8e1['sendStatus'](0x194);}return _0x5859f1;};}function handleError(_0xcca090,_0x35403e){_0x35403e=_0x35403e||0x1f4;return function(_0x26f936){logger[_0x68af('0x10')](_0x26f936[_0x68af('0x22')]);if(_0x26f936[_0x68af('0x23')]){delete _0x26f936['name'];}_0xcca090['status'](_0x35403e)['send'](_0x26f936);};}function getImapHost(_0x2ba404){switch(_0x2ba404){case _0x68af('0x24'):return _0x68af('0x25');case _0x68af('0x26'):return _0x68af('0x27');case _0x68af('0x28'):return _0x68af('0x29');case'outlook365':return'outlook.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x2ba404);}function getSmtpHost(_0x3a5e31){switch(_0x3a5e31){case _0x68af('0x24'):return _0x68af('0x2a');case'yahoo':return _0x68af('0x2b');case _0x68af('0x28'):return _0x68af('0x2c');case'outlook365':return _0x68af('0x2d');}throw new Error('Unknown\x20email\x20service\x20provider',_0x3a5e31);}function getAuthenticationOptions(_0x3f093a,_0x3269d3){var _0x1532cb={};var _0x3ff86d={};if(_0x3f093a){_0x1532cb[_0x68af('0x2e')]=_0x3ff86d[_0x68af('0x2e')]=_0x3269d3['username'];_0x1532cb['password']=_0x3ff86d['pass']=_0x3269d3[_0x68af('0x2f')];if(_0x3269d3[_0x68af('0x30')]){_0x1532cb[_0x68af('0x30')]=_0x3ff86d[_0x68af('0x30')]=!![];_0x1532cb[_0x68af('0x31')]=_0x3ff86d[_0x68af('0x31')]=_0x3269d3['CloudProviderId'];_0x1532cb[_0x68af('0x2f')]=_0x3ff86d[_0x68af('0x32')]=null;}else{_0x1532cb[_0x68af('0x31')]=_0x3ff86d[_0x68af('0x31')]=null;}_0x1532cb[_0x68af('0x33')]=getImapHost(_0x3f093a);_0x1532cb[_0x68af('0x34')]=0x3e1;_0x3ff86d[_0x68af('0x33')]=getSmtpHost(_0x3f093a);_0x3ff86d[_0x68af('0x34')]=0x24b;_0x3ff86d[_0x68af('0x35')]=![];_0x1532cb[_0x68af('0x36')]=_0x3ff86d[_0x68af('0x36')]=null;}else{if(_0x3269d3['authentication']){_0x1532cb[_0x68af('0x2e')]=_0x3ff86d[_0x68af('0x2e')]=_0x3269d3[_0x68af('0x37')];_0x1532cb[_0x68af('0x2f')]=_0x3ff86d['pass']=_0x3269d3['password'];}else{_0x1532cb['authentication']=_0x3ff86d[_0x68af('0x38')]=![];_0x1532cb[_0x68af('0x2e')]=_0x3ff86d['user']=null;_0x1532cb[_0x68af('0x2f')]=_0x3ff86d['pass']=null;}_0x1532cb['host']=_0x3269d3[_0x68af('0x39')]['host'];_0x1532cb['port']=_0x3269d3['Imap'][_0x68af('0x34')];_0x3ff86d[_0x68af('0x33')]=_0x3269d3[_0x68af('0x3a')][_0x68af('0x33')];_0x3ff86d[_0x68af('0x34')]=_0x3269d3[_0x68af('0x3a')][_0x68af('0x34')];}return{'Imap':_0x1532cb,'Smtp':_0x3ff86d};}exports['index']=function(_0x39173c,_0x25b3c9){var _0x366837={'include':[{'model':db[_0x68af('0x3b')],'as':_0x68af('0x39')},{'model':db['MailServerOut'],'as':_0x68af('0x3a')},{'model':db[_0x68af('0x3c')],'as':'mandatoryDispositionPause'}]},_0x4ad311={},_0xc6ded9={'count':0x0,'rows':[]};var _0x4dd24f=_[_0x68af('0x3d')](db['MailAccount']['rawAttributes'],function(_0x2b40a4){return{'name':_0x2b40a4[_0x68af('0x3e')],'type':_0x2b40a4[_0x68af('0x3f')][_0x68af('0x40')]};});_0x4ad311['model']=_[_0x68af('0x3d')](_0x4dd24f,_0x68af('0x23'));_0x4ad311[_0x68af('0x41')]=_[_0x68af('0x42')](_0x39173c['query']);_0x4ad311[_0x68af('0x43')]=_[_0x68af('0x44')](_0x4ad311[_0x68af('0x45')],_0x4ad311['query']);_0x366837['attributes']=_[_0x68af('0x44')](_0x4ad311[_0x68af('0x45')],qs[_0x68af('0x46')](_0x39173c[_0x68af('0x41')][_0x68af('0x46')]));_0x366837[_0x68af('0x47')]=_0x366837[_0x68af('0x47')][_0x68af('0x48')]?_0x366837[_0x68af('0x47')]:_0x4ad311['model'];if(!_0x39173c[_0x68af('0x41')][_0x68af('0x49')](_0x68af('0x4a'))){_0x366837['limit']=qs[_0x68af('0x19')](_0x39173c[_0x68af('0x41')]['limit']);_0x366837[_0x68af('0x18')]=qs['offset'](_0x39173c[_0x68af('0x41')][_0x68af('0x18')]);}_0x366837[_0x68af('0x4b')]=qs[_0x68af('0x4c')](_0x39173c['query'][_0x68af('0x4c')]);_0x366837['where']=qs[_0x68af('0x43')](_[_0x68af('0x4d')](_0x39173c['query'],_0x4ad311[_0x68af('0x43')]),_0x4dd24f);if(_0x39173c[_0x68af('0x41')][_0x68af('0x4e')]){_0x366837['where']=_[_0x68af('0x4f')](_0x366837[_0x68af('0x50')],{'$or':_[_0x68af('0x3d')](_0x4dd24f,function(_0x1ddc97){if(_0x1ddc97['type']!==_0x68af('0x51')){var _0x4ceddf={};_0x4ceddf[_0x1ddc97[_0x68af('0x23')]]={'$like':'%'+_0x39173c[_0x68af('0x41')]['filter']+'%'};return _0x4ceddf;}})});}_0x366837=_[_0x68af('0x4f')]({},_0x366837,_0x39173c[_0x68af('0x52')]);var _0xd963bb={'where':_0x366837[_0x68af('0x50')]};return db[_0x68af('0x53')]['count'](_0xd963bb)['then'](function(_0x5bab97){_0xc6ded9[_0x68af('0x1b')]=_0x5bab97;if(_0x39173c[_0x68af('0x41')]['includeAll']){_0x366837[_0x68af('0x54')]=[{'all':!![]}];}return db[_0x68af('0x53')][_0x68af('0x55')](_0x366837);})[_0x68af('0x1e')](function(_0xe665){_0xc6ded9[_0x68af('0x56')]=_0xe665;return _0xc6ded9;})[_0x68af('0x1e')](respondWithFilteredResult(_0x25b3c9,_0x366837))[_0x68af('0x14')](handleError(_0x25b3c9,null));};exports[_0x68af('0x57')]=function(_0x38fd04,_0x5464fd){var _0x1297e3={'raw':![],'where':{'id':_0x38fd04['params']['id']},'include':[{'model':db[_0x68af('0x3b')],'as':_0x68af('0x39')},{'model':db[_0x68af('0x58')],'as':_0x68af('0x3a')},{'model':db['Pause'],'as':_0x68af('0x59')}]},_0x28f183={};_0x28f183[_0x68af('0x45')]=_[_0x68af('0x42')](db[_0x68af('0x53')][_0x68af('0x5a')]);_0x28f183['query']=_['keys'](_0x38fd04[_0x68af('0x41')]);_0x28f183['filters']=_[_0x68af('0x44')](_0x28f183[_0x68af('0x45')],_0x28f183['query']);_0x1297e3['attributes']=_[_0x68af('0x44')](_0x28f183[_0x68af('0x45')],qs[_0x68af('0x46')](_0x38fd04[_0x68af('0x41')][_0x68af('0x46')]));_0x1297e3['attributes']=_0x1297e3[_0x68af('0x47')][_0x68af('0x48')]?_0x1297e3[_0x68af('0x47')]:_0x28f183[_0x68af('0x45')];if(_0x38fd04[_0x68af('0x41')][_0x68af('0x5b')]){_0x1297e3['include']=[{'all':!![]}];}_0x1297e3=_[_0x68af('0x4f')]({},_0x1297e3,_0x38fd04['options']);return db[_0x68af('0x53')][_0x68af('0x5c')](_0x1297e3)[_0x68af('0x1e')](handleEntityNotFound(_0x5464fd,null))[_0x68af('0x1e')](respondWithResult(_0x5464fd,null))['catch'](handleError(_0x5464fd,null));};exports[_0x68af('0x1d')]=function(_0x86d05d,_0x5d85f1){if(_0x86d05d[_0x68af('0x5d')]['id']){delete _0x86d05d[_0x68af('0x5d')]['id'];}var _0x3ba824=_0x86d05d[_0x68af('0x5d')][_0x68af('0x5e')]===_0x68af('0x5f')?null:_0x86d05d[_0x68af('0x5d')][_0x68af('0x5e')];var _0x4636be=_0x86d05d['body'][_0x68af('0x39')]||{};var _0x31d8e8=_0x86d05d[_0x68af('0x5d')]['Smtp']||{};if(_0x3ba824){_0x4636be[_0x68af('0x33')]=getImapHost(_0x3ba824);_0x4636be['port']=0x3e1;_0x31d8e8[_0x68af('0x33')]=getSmtpHost(_0x3ba824);_0x31d8e8[_0x68af('0x34')]=0x24b;_0x31d8e8['secure']=![];}if(_0x31d8e8['modernAuthentication']){_0x31d8e8['secure']=![];}else{_0x31d8e8[_0x68af('0x31')]=null;}if(!_0x4636be['modernAuthentication'])_0x4636be[_0x68af('0x31')]=null;_0x86d05d['body'][_0x68af('0x39')]=_0x4636be;_0x86d05d['body'][_0x68af('0x3a')]=_0x31d8e8;return db[_0x68af('0x53')][_0x68af('0x5c')]({'where':{'id':_0x86d05d[_0x68af('0x60')]['id']},'include':[{'model':db[_0x68af('0x3b')],'as':_0x68af('0x39')},{'model':db[_0x68af('0x58')],'as':'Smtp'},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x68af('0x1e')](handleEntityNotFound(_0x5d85f1,null))[_0x68af('0x1e')](function(_0x4b4fe4){if(!_0x4b4fe4)throw new Error(_0x68af('0x61'));if(_0x4b4fe4[_0x68af('0x36')])delete _0x86d05d[_0x68af('0x5d')]['Imap'];return _0x4b4fe4;})[_0x68af('0x1e')](saveUpdates(_0x86d05d[_0x68af('0x5d')],null))[_0x68af('0x1e')](function(_0x21481e){if(!_0x86d05d['body']['Imap'])return _0x21481e;return db[_0x68af('0x3b')][_0x68af('0x1d')](_0x86d05d[_0x68af('0x5d')][_0x68af('0x39')],{'where':{'MailAccountId':_0x21481e['id']}})[_0x68af('0x1e')](function(){return _0x21481e;});})[_0x68af('0x1e')](function(_0x3f3a61){if(!_0x86d05d[_0x68af('0x5d')][_0x68af('0x3a')])return _0x3f3a61;return db[_0x68af('0x58')]['update'](_0x86d05d[_0x68af('0x5d')]['Smtp'],{'where':{'MailAccountId':_0x3f3a61['id']}})['then'](function(){return _0x3f3a61;});})[_0x68af('0x1e')](respondWithResult(_0x5d85f1,null))['catch'](handleError(_0x5d85f1,null));};exports[_0x68af('0x62')]=function(_0x2efeec,_0xd3b80b){return db['MailAccount']['describe']()[_0x68af('0x1e')](respondWithResult(_0xd3b80b,null))['catch'](handleError(_0xd3b80b,null));};exports[_0x68af('0x63')]=function(_0x1fa8a6,_0x5d9761){if(_0x1fa8a6[_0x68af('0x5d')]['id']){delete _0x1fa8a6[_0x68af('0x5d')]['id'];}return db[_0x68af('0x53')][_0x68af('0x5c')]({'where':{'id':_0x1fa8a6[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x5d9761,null))[_0x68af('0x1e')](function(_0x18703c){if(_0x18703c){_0x1fa8a6[_0x68af('0x5d')][_0x68af('0x64')]=_0x18703c['id'];return db[_0x68af('0x65')]['create'](_0x1fa8a6[_0x68af('0x5d')]);}})['then'](respondWithResult(_0x5d9761,null))[_0x68af('0x14')](handleError(_0x5d9761,null));};exports['getDispositions']=function(_0x22004d,_0x27533d){var _0x2f41f8={'raw':![],'where':{}};var _0x27f1eb={};var _0x46f7b={'count':0x0,'rows':[]};return db[_0x68af('0x53')][_0x68af('0x66')]({'where':{'id':_0x22004d[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x27533d,null))[_0x68af('0x1e')](function(_0xe43b39){if(_0xe43b39){_0x27f1eb['model']=_[_0x68af('0x42')](db[_0x68af('0x65')][_0x68af('0x5a')]);_0x27f1eb[_0x68af('0x41')]=_['keys'](_0x22004d[_0x68af('0x41')]);_0x27f1eb[_0x68af('0x43')]=_[_0x68af('0x44')](_0x27f1eb['model'],_0x27f1eb[_0x68af('0x41')]);_0x2f41f8['attributes']=_[_0x68af('0x44')](_0x27f1eb[_0x68af('0x45')],qs['fields'](_0x22004d[_0x68af('0x41')][_0x68af('0x46')]));_0x2f41f8[_0x68af('0x47')]=_0x2f41f8[_0x68af('0x47')][_0x68af('0x48')]?_0x2f41f8[_0x68af('0x47')]:_0x27f1eb[_0x68af('0x45')];if(!_0x22004d['query'][_0x68af('0x49')]('nolimit')){_0x2f41f8['limit']=qs[_0x68af('0x19')](_0x22004d[_0x68af('0x41')][_0x68af('0x19')]);_0x2f41f8['offset']=qs['offset'](_0x22004d[_0x68af('0x41')][_0x68af('0x18')]);}_0x2f41f8[_0x68af('0x4b')]=qs['sort'](_0x22004d['query'][_0x68af('0x4c')]);_0x2f41f8[_0x68af('0x50')]=qs[_0x68af('0x43')](_[_0x68af('0x4d')](_0x22004d[_0x68af('0x41')],_0x27f1eb['filters']));_0x2f41f8['where'][_0x68af('0x64')]=_0xe43b39['id'];if(_0x22004d[_0x68af('0x41')][_0x68af('0x4e')]){_0x2f41f8[_0x68af('0x50')]=_[_0x68af('0x4f')](_0x2f41f8['where'],{'$or':_['map'](_0x2f41f8[_0x68af('0x47')],function(_0x310734){var _0x366595={};_0x366595[_0x310734]={'$like':'%'+_0x22004d[_0x68af('0x41')]['filter']+'%'};return _0x366595;})});}_0x2f41f8=_[_0x68af('0x4f')]({},_0x2f41f8,_0x22004d['options']);return db[_0x68af('0x65')]['count']({'where':_0x2f41f8[_0x68af('0x50')]})[_0x68af('0x1e')](function(_0x1ebea4){_0x46f7b[_0x68af('0x1b')]=_0x1ebea4;if(_0x22004d[_0x68af('0x41')][_0x68af('0x5b')]){_0x2f41f8['include']=[{'all':!![]}];}return db[_0x68af('0x65')][_0x68af('0x55')](_0x2f41f8);})['then'](function(_0x14dabc){_0x46f7b[_0x68af('0x56')]=_0x14dabc;return _0x46f7b;});}})[_0x68af('0x1e')](respondWithFilteredResult(_0x27533d,_0x2f41f8))['catch'](handleError(_0x27533d,null));};exports[_0x68af('0x67')]=function(_0x3da817,_0xe7bbd5){return db[_0x68af('0x53')][_0x68af('0x5c')]({'where':{'id':_0x3da817[_0x68af('0x60')]['id']}})['then'](handleEntityNotFound(_0xe7bbd5,null))[_0x68af('0x1e')](function(_0x4a275d){if(_0x4a275d){return _0x4a275d['removeDispositions'](_0x3da817[_0x68af('0x41')][_0x68af('0x68')]);}})[_0x68af('0x1e')](respondWithStatusCode(_0xe7bbd5,null))[_0x68af('0x14')](handleError(_0xe7bbd5,null));};exports[_0x68af('0x69')]=function(_0x2629f1,_0x4f0726){if(_0x2629f1[_0x68af('0x5d')]['id']){delete _0x2629f1['body']['id'];}return db[_0x68af('0x53')]['find']({'where':{'id':_0x2629f1[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x4f0726,null))[_0x68af('0x1e')](function(_0x318a94){if(_0x318a94){_0x2629f1[_0x68af('0x5d')][_0x68af('0x64')]=_0x318a94['id'];return db[_0x68af('0x6a')][_0x68af('0x6b')](_0x2629f1[_0x68af('0x5d')]);}})[_0x68af('0x1e')](respondWithResult(_0x4f0726,null))[_0x68af('0x14')](handleError(_0x4f0726,null));};exports[_0x68af('0x6c')]=function(_0x516464,_0x1ffbc5){var _0x492b90={'raw':![],'where':{}};var _0x7f8b59={};var _0x4cf038={'count':0x0,'rows':[]};return db[_0x68af('0x53')][_0x68af('0x66')]({'where':{'id':_0x516464[_0x68af('0x60')]['id']}})['then'](handleEntityNotFound(_0x1ffbc5,null))['then'](function(_0x16fd06){if(_0x16fd06){_0x7f8b59[_0x68af('0x45')]=_[_0x68af('0x42')](db[_0x68af('0x6a')][_0x68af('0x5a')]);_0x7f8b59[_0x68af('0x41')]=_['keys'](_0x516464[_0x68af('0x41')]);_0x7f8b59['filters']=_[_0x68af('0x44')](_0x7f8b59[_0x68af('0x45')],_0x7f8b59[_0x68af('0x41')]);_0x492b90['attributes']=_['intersection'](_0x7f8b59[_0x68af('0x45')],qs['fields'](_0x516464[_0x68af('0x41')][_0x68af('0x46')]));_0x492b90['attributes']=_0x492b90[_0x68af('0x47')]['length']?_0x492b90['attributes']:_0x7f8b59[_0x68af('0x45')];if(!_0x516464['query']['hasOwnProperty'](_0x68af('0x4a'))){_0x492b90['limit']=qs[_0x68af('0x19')](_0x516464[_0x68af('0x41')][_0x68af('0x19')]);_0x492b90[_0x68af('0x18')]=qs[_0x68af('0x18')](_0x516464[_0x68af('0x41')][_0x68af('0x18')]);}_0x492b90[_0x68af('0x4b')]=qs['sort'](_0x516464[_0x68af('0x41')][_0x68af('0x4c')]);_0x492b90[_0x68af('0x50')]=qs['filters'](_[_0x68af('0x4d')](_0x516464[_0x68af('0x41')],_0x7f8b59['filters']));_0x492b90[_0x68af('0x50')][_0x68af('0x64')]=_0x16fd06['id'];if(_0x516464[_0x68af('0x41')][_0x68af('0x4e')]){_0x492b90[_0x68af('0x50')]=_['merge'](_0x492b90['where'],{'$or':_[_0x68af('0x3d')](_0x492b90[_0x68af('0x47')],function(_0x40c0da){var _0x3097a5={};_0x3097a5[_0x40c0da]={'$like':'%'+_0x516464[_0x68af('0x41')][_0x68af('0x4e')]+'%'};return _0x3097a5;})});}_0x492b90=_['merge']({},_0x492b90,_0x516464[_0x68af('0x52')]);return db[_0x68af('0x6a')][_0x68af('0x1b')]({'where':_0x492b90[_0x68af('0x50')]})[_0x68af('0x1e')](function(_0x44b026){_0x4cf038[_0x68af('0x1b')]=_0x44b026;if(_0x516464[_0x68af('0x41')][_0x68af('0x5b')]){_0x492b90[_0x68af('0x54')]=[{'all':!![]}];}return db[_0x68af('0x6a')]['findAll'](_0x492b90);})['then'](function(_0x34da9f){_0x4cf038['rows']=_0x34da9f;return _0x4cf038;});}})[_0x68af('0x1e')](respondWithFilteredResult(_0x1ffbc5,_0x492b90))[_0x68af('0x14')](handleError(_0x1ffbc5,null));};exports[_0x68af('0x6d')]=function(_0x3375ff,_0x2ab51b){return db[_0x68af('0x53')][_0x68af('0x5c')]({'where':{'id':_0x3375ff[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x2ab51b,null))[_0x68af('0x1e')](function(_0x307846){if(_0x307846){return _0x307846[_0x68af('0x6d')](_0x3375ff[_0x68af('0x41')]['ids']);}})[_0x68af('0x1e')](respondWithStatusCode(_0x2ab51b,null))['catch'](handleError(_0x2ab51b,null));};exports[_0x68af('0x6b')]=function(_0x3ee1f9,_0x3b4cb7){var _0x76f4b5={'name':_0x3ee1f9[_0x68af('0x5d')][_0x68af('0x23')],'key':_0x3ee1f9[_0x68af('0x5d')][_0x68af('0x40')],'provider':_0x3ee1f9[_0x68af('0x5d')][_0x68af('0x5e')]==='custom'?null:_0x3ee1f9[_0x68af('0x5d')][_0x68af('0x5e')],'email':_0x3ee1f9[_0x68af('0x5d')][_0x68af('0x6e')],'ListId':_0x3ee1f9[_0x68af('0x5d')]['ListId'],'active':!_[_0x68af('0x6f')](_0x3ee1f9['body']['active'])?_0x3ee1f9[_0x68af('0x5d')]['active']:!![],'description':_0x3ee1f9[_0x68af('0x5d')][_0x68af('0x70')]||null};var _0x344f28=getAuthenticationOptions(_0x76f4b5[_0x68af('0x5e')],_0x3ee1f9[_0x68af('0x5d')]);_0x76f4b5[_0x68af('0x39')]=_0x344f28['Imap'];_0x76f4b5['Smtp']=_0x344f28[_0x68af('0x3a')];return db['MailAccount']['create'](_0x76f4b5,{'include':[{'model':db[_0x68af('0x58')],'as':_0x68af('0x3a')},{'model':db['MailServerIn'],'as':_0x68af('0x39')}]})['then'](function(_0x2cfa66){var _0x4dd07b=_0x3ee1f9[_0x68af('0x2e')][_0x68af('0x20')]({'plain':!![]});if(!_0x4dd07b)throw new Error(_0x68af('0x71'));if(_0x4dd07b['role']===_0x68af('0x2e')){var _0x407f4e=_0x2cfa66['get']({'plain':!![]});return db['UserProfileSection'][_0x68af('0x5c')]({'where':{'name':'MailAccounts','userProfileId':_0x4dd07b['userProfileId']},'raw':!![]})['then'](function(_0x23366e){if(_0x23366e&&_0x23366e[_0x68af('0x72')]===0x0){return db[_0x68af('0x73')]['create']({'name':_0x407f4e[_0x68af('0x23')],'resourceId':_0x407f4e['id'],'type':_0x23366e['name'],'sectionId':_0x23366e['id']},{})[_0x68af('0x1e')](function(){return _0x2cfa66;});}else{return _0x2cfa66;}})[_0x68af('0x14')](function(_0x100268){logger[_0x68af('0x10')](_0x68af('0x74'),_0x100268);throw _0x100268;});}return _0x2cfa66;})[_0x68af('0x1e')](respondWithResult(_0x3b4cb7,0xc9))[_0x68af('0x14')](handleError(_0x3b4cb7,null));};exports[_0x68af('0x75')]=function(_0x22af90,_0x5c42c6){return db[_0x68af('0x53')][_0x68af('0x66')]({'where':{'id':_0x22af90[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x5c42c6,null))['then'](function(_0x654466){if(_0x654466){return _0x654466[_0x68af('0x75')]();}return null;})[_0x68af('0x1e')](respondWithResult(_0x5c42c6,null))[_0x68af('0x14')](handleError(_0x5c42c6,null));};exports[_0x68af('0x76')]=function(_0x45f221,_0x213148){if(_0x45f221[_0x68af('0x5d')]['id']){delete _0x45f221[_0x68af('0x5d')]['id'];}return db[_0x68af('0x53')][_0x68af('0x5c')]({'where':{'id':_0x45f221[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x213148,null))['then'](function(_0x27f58f){if(_0x27f58f){_0x45f221['body'][_0x68af('0x64')]=_0x27f58f['id'];return db[_0x68af('0x3b')][_0x68af('0x6b')](_0x45f221[_0x68af('0x5d')]);}})['then'](respondWithResult(_0x213148,null))[_0x68af('0x14')](handleError(_0x213148,null));};exports[_0x68af('0x77')]=function(_0x38fe63,_0x2b2369){return db[_0x68af('0x53')]['findOne']({'where':{'id':_0x38fe63['params']['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x2b2369,null))[_0x68af('0x1e')](function(_0x10783e){if(_0x10783e){return _0x10783e[_0x68af('0x78')](null);}return null;})['then'](respondWithStatusCode(_0x2b2369,null))[_0x68af('0x14')](handleError(_0x2b2369,null));};exports[_0x68af('0x79')]=function(_0x4c3692,_0x2b4cc9){return db['MailAccount']['findOne']({'where':{'id':_0x4c3692[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x2b4cc9,null))[_0x68af('0x1e')](function(_0xfb9d22){if(_0xfb9d22){return _0xfb9d22[_0x68af('0x79')]();}return null;})[_0x68af('0x1e')](respondWithResult(_0x2b4cc9,null))[_0x68af('0x14')](handleError(_0x2b4cc9,null));};exports['addSmtp']=function(_0x261cb9,_0x7355fd){if(_0x261cb9[_0x68af('0x5d')]['id']){delete _0x261cb9['body']['id'];}return db[_0x68af('0x53')][_0x68af('0x5c')]({'where':{'id':_0x261cb9[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x7355fd,null))[_0x68af('0x1e')](function(_0x14b4f5){if(_0x14b4f5){_0x261cb9['body'][_0x68af('0x64')]=_0x14b4f5['id'];return db[_0x68af('0x58')]['create'](_0x261cb9[_0x68af('0x5d')]);}})[_0x68af('0x1e')](respondWithResult(_0x7355fd,null))[_0x68af('0x14')](handleError(_0x7355fd,null));};exports[_0x68af('0x7a')]=function(_0x308277,_0x493310){return db[_0x68af('0x53')][_0x68af('0x66')]({'where':{'id':_0x308277[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x493310,null))['then'](function(_0x26f294){if(_0x26f294){return _0x26f294[_0x68af('0x7b')](null);}return null;})['then'](respondWithStatusCode(_0x493310,null))[_0x68af('0x14')](handleError(_0x493310,null));};exports['addInteraction']=function(_0x195686,_0x4921d4){return db[_0x68af('0x7c')][_0x68af('0x5c')]({'where':{'id':_0x195686[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x4921d4,null))[_0x68af('0x1e')](function(_0xc70409){if(_0xc70409){return _0xc70409[_0x68af('0x7d')](_0x195686['body'][_0x68af('0x68')],_[_0x68af('0x7e')](_0x195686[_0x68af('0x5d')],[_0x68af('0x68'),'id'])||{});}})['then'](respondWithResult(_0x4921d4,null))[_0x68af('0x14')](handleError(_0x4921d4,null));};exports['getInteractions']=function(_0x501142,_0x203500){var _0x335a54={'raw':![],'where':{}};var _0xda12a5={};var _0x4c38e7={'count':0x0,'rows':[]};return db[_0x68af('0x53')]['findOne']({'where':{'id':_0x501142[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x203500,null))[_0x68af('0x1e')](function(_0x26f531){if(_0x26f531){_0xda12a5[_0x68af('0x45')]=_[_0x68af('0x42')](db[_0x68af('0x7c')][_0x68af('0x5a')]);_0xda12a5[_0x68af('0x41')]=_['keys'](_0x501142[_0x68af('0x41')]);_0xda12a5[_0x68af('0x43')]=_[_0x68af('0x44')](_0xda12a5[_0x68af('0x45')],_0xda12a5[_0x68af('0x41')]);_0x335a54[_0x68af('0x47')]=_[_0x68af('0x44')](_0xda12a5[_0x68af('0x45')],qs[_0x68af('0x46')](_0x501142[_0x68af('0x41')]['fields']));_0x335a54[_0x68af('0x47')]=_0x335a54[_0x68af('0x47')][_0x68af('0x48')]?_0x335a54[_0x68af('0x47')]:_0xda12a5['model'];if(!_0x501142[_0x68af('0x41')][_0x68af('0x49')](_0x68af('0x4a'))){_0x335a54[_0x68af('0x19')]=qs[_0x68af('0x19')](_0x501142[_0x68af('0x41')][_0x68af('0x19')]);_0x335a54[_0x68af('0x18')]=qs[_0x68af('0x18')](_0x501142[_0x68af('0x41')]['offset']);}_0x335a54[_0x68af('0x4b')]=qs[_0x68af('0x4c')](_0x501142[_0x68af('0x41')][_0x68af('0x4c')]);_0x335a54[_0x68af('0x50')]=qs[_0x68af('0x43')](_[_0x68af('0x4d')](_0x501142['query'],_0xda12a5[_0x68af('0x43')]));_0x335a54['where']['MailAccountId']=_0x26f531['id'];if(_0x501142['query'][_0x68af('0x4e')]){_0x335a54[_0x68af('0x50')]=_['merge'](_0x335a54[_0x68af('0x50')],{'$or':_[_0x68af('0x3d')](_0x335a54[_0x68af('0x47')],function(_0x33e2a9){var _0x37deb8={};_0x37deb8[_0x33e2a9]={'$like':'%'+_0x501142[_0x68af('0x41')]['filter']+'%'};return _0x37deb8;})});}_0x335a54=_[_0x68af('0x4f')]({},_0x335a54,_0x501142[_0x68af('0x52')]);return db[_0x68af('0x7c')][_0x68af('0x1b')]({'where':_0x335a54[_0x68af('0x50')]})[_0x68af('0x1e')](function(_0x35eaf4){_0x4c38e7['count']=_0x35eaf4;if(_0x501142[_0x68af('0x41')]['includeAll']){_0x335a54[_0x68af('0x54')]=[{'model':db[_0x68af('0x7f')],'as':_0x68af('0x80'),'required':![]},{'model':db[_0x68af('0x81')],'as':'Owner','attributes':['name',_0x68af('0x82'),_0x68af('0x83')],'required':![]},{'model':db['Tag'],'as':_0x68af('0x84'),'attributes':['id',_0x68af('0x23'),_0x68af('0x85')],'where':_0x501142[_0x68af('0x41')][_0x68af('0x86')]?{'id':_0x501142['query']['tag']}:undefined,'required':_0x501142[_0x68af('0x41')][_0x68af('0x86')]?!![]:![]}];}return db[_0x68af('0x7c')][_0x68af('0x55')](_0x335a54);})['then'](function(_0x1d7c1a){_0x4c38e7['rows']=_0x1d7c1a;return _0x4c38e7;});}})['then'](respondWithFilteredResult(_0x203500,_0x335a54))['catch'](handleError(_0x203500,null));};exports[_0x68af('0x87')]=function addApplications(_0x590ea5,_0x1570e8){var _0xe0228c=_0x590ea5[_0x68af('0x60')]['id'];var _0x968a59=_0x590ea5[_0x68af('0x5d')];var _0x5abcf3=0xc8;var _0x487408=null;return db[_0x68af('0x88')][_0x68af('0x89')]({'isolationLevel':db[_0x68af('0x88')][_0x68af('0x8a')]['ISOLATION_LEVELS'][_0x68af('0x8b')]},function(_0x74e3e){return db['MailAccount']['findOne']({'where':{'id':_0xe0228c},'transaction':_0x74e3e})['then'](function(_0x1378cf){if(_0x1378cf){return db[_0x68af('0x8c')]['destroy']({'where':{'MailAccountId':_0xe0228c},'transaction':_0x74e3e})[_0x68af('0x1e')](function(){var _0x2bea79=_['map'](_0x968a59,function(_0x4dfbba){_0x4dfbba[_0x68af('0x64')]=_0xe0228c;return _0x4dfbba;});return db['MailApplication']['bulkCreate'](_0x2bea79,{'transaction':_0x74e3e});});}else{_0x5abcf3=0x194;_0x487408=[];}});})[_0x68af('0x1e')](function(){if(_0x5abcf3!==0x194){return db[_0x68af('0x8c')][_0x68af('0x8d')]({'where':{'MailAccountId':_0xe0228c},'order':_0x68af('0x8e')})[_0x68af('0x1e')](function(_0x418bc0){_0x487408=_0x418bc0;});}})[_0x68af('0x14')](function(_0x3c03fd){_0x5abcf3=0x1f4;logger[_0x68af('0x10')](_0x3c03fd[_0x68af('0x22')]);if(_0x3c03fd[_0x68af('0x23')]){delete _0x3c03fd[_0x68af('0x23')];}_0x487408=_0x3c03fd;})[_0x68af('0x8f')](function(){if(_0x487408===null){_0x1570e8[_0x68af('0x15')](_0x5abcf3);}else{if(_0x5abcf3===0x1f4){_0x1570e8['status'](_0x5abcf3)[_0x68af('0x90')](_0x487408);}else{_0x1570e8[_0x68af('0x16')](_0x5abcf3)[_0x68af('0x17')](_0x487408);}}});};exports[_0x68af('0x91')]=function(_0x413c85,_0x575be5){var _0x107a64={};var _0x94dabd={};var _0x21af5f;var _0x4bd40b;return db[_0x68af('0x53')][_0x68af('0x66')]({'where':{'id':_0x413c85[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x575be5,null))['then'](function(_0x13f39d){if(_0x13f39d){_0x21af5f=_0x13f39d;_0x94dabd[_0x68af('0x45')]=_[_0x68af('0x42')](db[_0x68af('0x8c')][_0x68af('0x5a')]);_0x94dabd['query']=_[_0x68af('0x42')](_0x413c85[_0x68af('0x41')]);_0x94dabd['filters']=_[_0x68af('0x44')](_0x94dabd[_0x68af('0x45')],_0x94dabd['query']);_0x107a64[_0x68af('0x47')]=_['intersection'](_0x94dabd[_0x68af('0x45')],qs[_0x68af('0x46')](_0x413c85[_0x68af('0x41')][_0x68af('0x46')]));_0x107a64[_0x68af('0x47')]=_0x107a64[_0x68af('0x47')]['length']?_0x107a64[_0x68af('0x47')]:_0x94dabd[_0x68af('0x45')];_0x107a64[_0x68af('0x4b')]=qs[_0x68af('0x4c')](_0x413c85[_0x68af('0x41')][_0x68af('0x4c')]);_0x107a64[_0x68af('0x50')]=qs[_0x68af('0x43')](_[_0x68af('0x4d')](_0x413c85[_0x68af('0x41')],_0x94dabd[_0x68af('0x43')]));if(_0x413c85['query']['filter']){_0x107a64[_0x68af('0x50')]=_[_0x68af('0x4f')](_0x107a64[_0x68af('0x50')],{'$or':_[_0x68af('0x3d')](_0x107a64[_0x68af('0x47')],function(_0x20dad5){var _0x3e40bb={};_0x3e40bb[_0x20dad5]={'$like':'%'+_0x413c85[_0x68af('0x41')][_0x68af('0x4e')]+'%'};return _0x3e40bb;})});}_0x107a64=_[_0x68af('0x4f')]({},_0x107a64,_0x413c85[_0x68af('0x52')]);return _0x21af5f['getApplications'](_0x107a64);}})['then'](function(_0x80911){if(_0x80911){_0x4bd40b=_0x80911[_0x68af('0x48')];if(!_0x413c85[_0x68af('0x41')][_0x68af('0x49')](_0x68af('0x4a'))){_0x107a64[_0x68af('0x19')]=qs['limit'](_0x413c85[_0x68af('0x41')][_0x68af('0x19')]);_0x107a64[_0x68af('0x18')]=qs[_0x68af('0x18')](_0x413c85[_0x68af('0x41')]['offset']);}return _0x21af5f[_0x68af('0x91')](_0x107a64);}})['then'](function(_0x1d5604){if(_0x1d5604){return _0x1d5604?{'count':_0x4bd40b,'rows':_0x1d5604}:null;}})[_0x68af('0x1e')](respondWithResult(_0x575be5,null))[_0x68af('0x14')](handleError(_0x575be5,null));};exports[_0x68af('0x92')]=function(_0x2d867e,_0x1b6179){var _0xd52d07={'raw':!![],'where':{}};var _0x5773f9={};var _0x25702c={'count':0x0,'rows':[]};return db[_0x68af('0x53')][_0x68af('0x66')]({'where':{'id':_0x2d867e[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x1b6179,null))[_0x68af('0x1e')](function(_0xa71319){if(_0xa71319){_0x5773f9['model']=_['keys'](db['MailMessage'][_0x68af('0x5a')]);_0x5773f9[_0x68af('0x41')]=_[_0x68af('0x42')](_0x2d867e[_0x68af('0x41')]);_0x5773f9[_0x68af('0x43')]=_[_0x68af('0x44')](_0x5773f9[_0x68af('0x45')],_0x5773f9[_0x68af('0x41')]);_0xd52d07[_0x68af('0x47')]=_[_0x68af('0x44')](_0x5773f9['model'],qs['fields'](_0x2d867e[_0x68af('0x41')][_0x68af('0x46')]));_0xd52d07['attributes']=_0xd52d07['attributes'][_0x68af('0x48')]?_0xd52d07[_0x68af('0x47')]:_0x5773f9['model'];if(!_0x2d867e[_0x68af('0x41')][_0x68af('0x49')](_0x68af('0x4a'))){_0xd52d07[_0x68af('0x19')]=qs[_0x68af('0x19')](_0x2d867e[_0x68af('0x41')]['limit']);_0xd52d07['offset']=qs[_0x68af('0x18')](_0x2d867e[_0x68af('0x41')][_0x68af('0x18')]);}_0xd52d07[_0x68af('0x4b')]=qs[_0x68af('0x4c')](_0x2d867e[_0x68af('0x41')][_0x68af('0x4c')]);_0xd52d07[_0x68af('0x50')]=qs[_0x68af('0x43')](_['pick'](_0x2d867e['query'],_0x5773f9[_0x68af('0x43')]));_0xd52d07[_0x68af('0x50')][_0x68af('0x64')]=_0xa71319['id'];if(_0x2d867e[_0x68af('0x41')][_0x68af('0x4e')]){_0xd52d07[_0x68af('0x50')]=_[_0x68af('0x4f')](_0xd52d07[_0x68af('0x50')],{'$or':_[_0x68af('0x3d')](_0xd52d07[_0x68af('0x47')],function(_0x445107){var _0x192a21={};_0x192a21[_0x445107]={'$like':'%'+_0x2d867e[_0x68af('0x41')]['filter']+'%'};return _0x192a21;})});}if(_0x2d867e[_0x68af('0x41')][_0x68af('0x93')]){var _0x2a8b1a=_0x2d867e[_0x68af('0x41')][_0x68af('0x93')][_0x68af('0x94')](',');var _0x526a2f={};_0x526a2f[_0x2a8b1a[0x0]]={'$gte':moment(_0x2a8b1a[0x1])[_0x68af('0x95')](_0x68af('0x96'))};_0xd52d07[_0x68af('0x50')]=_[_0x68af('0x4f')](_0xd52d07[_0x68af('0x50')],_0x526a2f);}_0xd52d07=_['merge']({},_0xd52d07,_0x2d867e[_0x68af('0x52')]);return db[_0x68af('0x97')][_0x68af('0x1b')]({'where':_0xd52d07[_0x68af('0x50')]})['then'](function(_0x7c8eb7){_0x25702c['count']=_0x7c8eb7;if(_0x2d867e[_0x68af('0x41')]['includeAll']){_0xd52d07[_0x68af('0x54')]=[{'all':!![]}];}return db[_0x68af('0x97')][_0x68af('0x55')](_0xd52d07);})['then'](function(_0x8054bb){if(_0x2d867e['query'][_0x68af('0x98')]==='true'){for(var _0x4c5b6c=0x0;_0x4c5b6c<_0x8054bb[_0x68af('0x48')];_0x4c5b6c++){_0x8054bb[_0x4c5b6c]['body']=juice(_0x8054bb[_0x4c5b6c][_0x68af('0x5d')]);}}_0x25702c[_0x68af('0x56')]=_0x8054bb;return _0x25702c;});}})[_0x68af('0x1e')](respondWithFilteredResult(_0x1b6179,_0xd52d07))[_0x68af('0x14')](handleError(_0x1b6179,null));};exports['send']=function(_0x84d35f,_0x64a0e6){var _0x556b37,_0x2099aa={},_0x46c42a;if(_0x84d35f['body']['to']){_0x46c42a=_0x84d35f[_0x68af('0x5d')]['to'][_0x68af('0x94')](',')[0x0];}return db[_0x68af('0x53')]['find']({'where':{'id':_0x84d35f[_0x68af('0x60')]['id']},'include':[{'model':db[_0x68af('0x99')],'as':_0x68af('0x9a'),'include':[{'model':db[_0x68af('0x7f')],'as':_0x68af('0x9b'),'where':{'email':_0x46c42a},'limit':0x1,'order':[[_0x68af('0x9c'),_0x68af('0x9d')]]}]},{'model':db[_0x68af('0x58')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x68af('0x9e')],'as':_0x68af('0x9e'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x64a0e6,null))[_0x68af('0x1e')](function(_0x17c6d8){if(!_0x17c6d8)return;_0x556b37=_0x17c6d8;if(!_0x17c6d8['Smtp'])throw new Error(_0x68af('0x9f'));if(_['isNil'](_0x84d35f[_0x68af('0x5d')][_0x68af('0xa0')])){_0x84d35f['body'][_0x68af('0xa0')]=util[_0x68af('0x95')](_0x68af('0xa1'),_0x17c6d8[_0x68af('0x23')],_0x17c6d8[_0x68af('0x6e')]||_0x17c6d8[_0x68af('0x3a')][_0x68af('0x2e')]);}if(_0x84d35f[_0x68af('0x5d')][_0x68af('0xa2')]&&_0x84d35f[_0x68af('0x5d')]['attachments']['length']){for(var _0x4e2c7b=0x0;_0x4e2c7b<_0x84d35f['body'][_0x68af('0xa2')][_0x68af('0x48')];_0x4e2c7b+=0x1){_0x84d35f[_0x68af('0x5d')][_0x68af('0xa2')][_0x4e2c7b]={'filename':_0x84d35f['body'][_0x68af('0xa2')][_0x4e2c7b][_0x68af('0x23')],'path':path[_0x68af('0xa3')](config[_0x68af('0xa4')],_0x68af('0xa5'),_0x84d35f[_0x68af('0x5d')]['attachments'][_0x4e2c7b][_0x68af('0xa6')])};}}var _0x4b4d14=_0x17c6d8['getSmtpOptions']();return respondWithRpcPromise('SendMail',_0x68af('0xa7'),{'account':_0x4b4d14,'message':_0x84d35f[_0x68af('0x5d')]});})[_0x68af('0x1e')](function(_0x4dacf8){if(!_0x4dacf8)return;_0x2099aa=_0x4dacf8;if(!_0x556b37[_0x68af('0x9a')])throw new Error(_0x68af('0xa8'));if(_0x556b37[_0x68af('0x9a')][_0x68af('0x9b')]['length'])return _0x556b37['List'][_0x68af('0x9b')][0x0];return db[_0x68af('0x7f')]['create'](_[_0x68af('0x7')](_0x84d35f[_0x68af('0x5d')],{'firstName':_0x84d35f['body']['to'],'email':_0x84d35f['body']['to'],'phone':_0x84d35f[_0x68af('0x5d')]['to'],'ListId':_0x556b37[_0x68af('0xa9')]}));})[_0x68af('0x1e')](function(_0x323503){if(!_0x323503)return;var _0x1759f2={'UserId':_0x84d35f[_0x68af('0x2e')]['id'],'ContactId':_0x323503['id'],'MailAccountId':_0x556b37['id'],'inReplyTo':_0x2099aa[_0x68af('0xaa')],'to':_0x84d35f[_0x68af('0x5d')]['from'],'cc':_0x84d35f['body']['cc'],'subject':_0x84d35f[_0x68af('0x5d')][_0x68af('0xab')],'attach':_0x84d35f[_0x68af('0x5d')][_0x68af('0xac')],'firstMsgDirection':_0x68af('0xad'),'lastMsgAt':moment()[_0x68af('0x95')](_0x68af('0x96')),'lastMsgDirection':_0x68af('0xad'),'Messages':[_[_0x68af('0x4f')](_0x84d35f[_0x68af('0x5d')],{'messageId':_0x2099aa[_0x68af('0xaa')],'sentAt':moment()[_0x68af('0x95')](_0x68af('0x96')),'read':!![],'MailAccountId':_0x556b37['id'],'UserId':_0x84d35f['user']['id'],'ContactId':_0x323503['id']})]};if(_0x84d35f[_0x68af('0x5d')][_0x68af('0xae')]){_0x1759f2=_[_0x68af('0x4f')](_0x1759f2,_0x84d35f[_0x68af('0x5d')][_0x68af('0xae')]);}return db[_0x68af('0x7c')]['create'](_0x1759f2,{'include':[{'model':db[_0x68af('0x97')],'as':_0x68af('0xaf')}]});})[_0x68af('0x1e')](respondWithResult(_0x64a0e6,null))[_0x68af('0x14')](handleError(_0x64a0e6,null));};exports[_0x68af('0xb0')]=function(_0x3a3089,_0x1186e7){return db['MailAccount'][_0x68af('0x5c')]({'where':{'id':_0x3a3089['params']['id']},'include':[{'model':db[_0x68af('0x58')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x68af('0x9e')],'as':'CloudProvider','raw':!![]}]}]})[_0x68af('0x1e')](handleEntityNotFound(_0x1186e7,null))[_0x68af('0x1e')](function(_0x1bd704){if(!_0x1bd704[_0x68af('0x3a')])return;var _0x5a4d22=_0x1bd704[_0x68af('0xb1')]();return respondWithRpcPromise(_0x68af('0xb2'),'verifySmtp',{'account':_0x5a4d22});})[_0x68af('0x1e')](respondWithResult(_0x1186e7,null))[_0x68af('0x14')](handleError(_0x1186e7,null));};exports[_0x68af('0x1f')]=function(_0x462a71,_0x38405d){return db[_0x68af('0x53')][_0x68af('0x5c')]({'where':{'id':_0x462a71[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x38405d,null))[_0x68af('0x1e')](function(_0x152176){if(_0x152176&&_0x152176[_0x68af('0x36')]){throw new db[(_0x68af('0xb3'))][(_0x68af('0xb4'))](_0x68af('0xb5'));}return _0x152176;})[_0x68af('0x1e')](removeEntity(_0x38405d,null))['catch'](handleError(_0x38405d,null));};exports[_0x68af('0xb6')]=function(_0x5520d7,_0x149a68){return db[_0x68af('0x53')][_0x68af('0x5c')]({'where':{'id':_0x5520d7[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x149a68,null))['then'](function(_0x2fb118){if(_0x2fb118){return _0x2fb118[_0x68af('0xb6')](_0x5520d7[_0x68af('0x5d')][_0x68af('0x68')],_[_0x68af('0x7e')](_0x5520d7['body'],[_0x68af('0x68'),'id'])||{})['spread'](function(_0x5478ed){for(var _0x32ff28=0x0;_0x32ff28<_0x5520d7[_0x68af('0x5d')][_0x68af('0x68')]['length'];_0x32ff28+=0x1){socket[_0x68af('0xb7')](_0x68af('0xb8'),{'UserId':Number(_0x5520d7[_0x68af('0x5d')][_0x68af('0x68')][_0x32ff28]),'MailAccountId':Number(_0x5520d7[_0x68af('0x60')]['id'])});}return _0x5478ed;});}})[_0x68af('0x1e')](respondWithResult(_0x149a68,null))[_0x68af('0x14')](handleError(_0x149a68,null));};exports[_0x68af('0xb9')]=function(_0x1cf053,_0x423564){return db[_0x68af('0x53')][_0x68af('0x5c')]({'where':{'id':_0x1cf053['params']['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x423564,null))[_0x68af('0x1e')](function(_0x10e93e){if(_0x10e93e){return _0x10e93e[_0x68af('0xb9')](_0x1cf053[_0x68af('0x41')]['ids'])[_0x68af('0x1e')](function(){if(_[_0x68af('0xba')](_0x1cf053[_0x68af('0x41')][_0x68af('0x68')])){for(var _0x43127f=0x0;_0x43127f<_0x1cf053[_0x68af('0x41')][_0x68af('0x68')][_0x68af('0x48')];_0x43127f+=0x1){socket[_0x68af('0xb7')](_0x68af('0xbb'),{'UserId':Number(_0x1cf053[_0x68af('0x41')][_0x68af('0x68')][_0x43127f]),'MailAccountId':Number(_0x1cf053[_0x68af('0x60')]['id'])});}}else{socket[_0x68af('0xb7')]('userMailAccount:remove',{'UserId':Number(_0x1cf053[_0x68af('0x41')][_0x68af('0x68')]),'MailAccountId':Number(_0x1cf053['params']['id'])});}});}})[_0x68af('0x1e')](respondWithStatusCode(_0x423564,null))['catch'](handleError(_0x423564,null));};exports['getAgents']=function(_0x3ba766,_0xccac38){var _0x1c5670={};var _0x21b426={};var _0x209ddd;var _0x630318;return db[_0x68af('0x53')]['findOne']({'where':{'id':_0x3ba766[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0xccac38,null))[_0x68af('0x1e')](function(_0x3bbf0a){if(_0x3bbf0a){_0x209ddd=_0x3bbf0a;_0x21b426[_0x68af('0x45')]=_[_0x68af('0x42')](db[_0x68af('0x81')][_0x68af('0x5a')]);_0x21b426[_0x68af('0x41')]=_[_0x68af('0x42')](_0x3ba766[_0x68af('0x41')]);_0x21b426[_0x68af('0x43')]=_['intersection'](_0x21b426[_0x68af('0x45')],_0x21b426[_0x68af('0x41')]);_0x1c5670[_0x68af('0x47')]=_[_0x68af('0x44')](_0x21b426[_0x68af('0x45')],qs[_0x68af('0x46')](_0x3ba766[_0x68af('0x41')][_0x68af('0x46')]));_0x1c5670['attributes']=_0x1c5670['attributes'][_0x68af('0x48')]?_0x1c5670[_0x68af('0x47')]:_0x21b426[_0x68af('0x45')];_0x1c5670[_0x68af('0x4b')]=qs['sort'](_0x3ba766[_0x68af('0x41')][_0x68af('0x4c')]);_0x1c5670[_0x68af('0x50')]=qs['filters'](_[_0x68af('0x4d')](_0x3ba766['query'],_0x21b426[_0x68af('0x43')]));if(_0x3ba766[_0x68af('0x41')][_0x68af('0x4e')]){_0x1c5670['where']=_[_0x68af('0x4f')](_0x1c5670[_0x68af('0x50')],{'$or':_[_0x68af('0x3d')](_0x1c5670[_0x68af('0x47')],function(_0x2673ea){var _0x21f8ac={};_0x21f8ac[_0x2673ea]={'$like':'%'+_0x3ba766[_0x68af('0x41')][_0x68af('0x4e')]+'%'};return _0x21f8ac;})});}_0x1c5670=_[_0x68af('0x4f')]({},_0x1c5670,_0x3ba766[_0x68af('0x52')]);return _0x209ddd[_0x68af('0xbc')](_0x1c5670);}})[_0x68af('0x1e')](function(_0x2b2667){if(_0x2b2667){_0x630318=_0x2b2667[_0x68af('0x48')];if(!_0x3ba766[_0x68af('0x41')]['hasOwnProperty'](_0x68af('0x4a'))){_0x1c5670[_0x68af('0x19')]=qs[_0x68af('0x19')](_0x3ba766[_0x68af('0x41')][_0x68af('0x19')]);_0x1c5670['offset']=qs[_0x68af('0x18')](_0x3ba766[_0x68af('0x41')]['offset']);}return _0x209ddd['getAgents'](_0x1c5670);}})['then'](function(_0x5c72b0){if(_0x5c72b0){return _0x5c72b0?{'count':_0x630318,'rows':_0x5c72b0}:null;}})['then'](respondWithResult(_0xccac38,null))[_0x68af('0x14')](handleError(_0xccac38,null));}; \ No newline at end of file +var _0x82e0=['addInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','READ_COMMITTED','MailApplication','priority','finally','sendStatus','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','email','attachments','root','server/files/attachments','getSmtpOptions','SendMail','sendMail','subject','attach','out','messageId','Interaction','Messages','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','User','bluebird','util','path','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','client','http','then','MailAccount,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','result','catch','status','end','json','undefined','limit','count','offset','Content-Range','update','get','UserProfileResource','destroy','stack','name','send','yahoo','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','gmail','smtp.mail.yahoo.com','smtp-mail.outlook.com','user','password','modernAuthentication','CloudProviderId','host','port','secure','service','username','authentication','pass','Imap','Smtp','index','MailServerIn','MailServerOut','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','options','findAll','show','MailAccount','include','body','provider','Pause','Mail\x20Account\x20not\x20found','describe','addDisposition','params','MailAccountId','Disposition','create','findOne','merge','includeAll','rows','removeDispositions','find','ids','addAnswer','CannedAnswer','removeAnswers','custom','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','getImap','removeImap','getSmtp','addSmtp','removeSmtp','MailInteraction'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x82e0,0x1c1));var _0x082e=function(_0x58b66e,_0x55a3d6){_0x58b66e=_0x58b66e-0x0;var _0x245660=_0x82e0[_0x58b66e];return _0x245660;};'use strict';var moment=require('moment');var BPromise=require(_0x082e('0x0'));var util=require(_0x082e('0x1'));var path=require(_0x082e('0x2'));var _=require('lodash');var juice=require('juice');var Redis=require(_0x082e('0x3'));var qs=require(_0x082e('0x4'));var logger=require(_0x082e('0x5'))(_0x082e('0x6'));var config=require(_0x082e('0x7'));var db=require(_0x082e('0x8'))['db'];config[_0x082e('0x9')]=_[_0x082e('0xa')](config[_0x082e('0x9')],{'host':_0x082e('0xb'),'port':0x18eb});var socket=require(_0x082e('0xc'))(new Redis(config['redis']));require(_0x082e('0xd'))[_0x082e('0xe')](socket);var jayson=require('jayson/promise');var client=jayson[_0x082e('0xf')][_0x082e('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x571091,_0x5bbfa6,_0x28040f,_0x25b92a){return new BPromise(function(_0x3bc585,_0x41e64a){var _0x256671=_0x25b92a||client;return _0x256671['request'](_0x571091,_0x28040f)[_0x082e('0x11')](function(_0x405384){logger['info'](_0x082e('0x12'),_0x5bbfa6,'request\x20sent');logger[_0x082e('0x13')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x5bbfa6,'request\x20sent',JSON[_0x082e('0x14')](_0x405384));if(_0x405384[_0x082e('0x15')]){if(_0x405384[_0x082e('0x15')][_0x082e('0x16')]===0x1f4){logger[_0x082e('0x15')](_0x082e('0x12'),_0x5bbfa6,_0x405384[_0x082e('0x15')]['message']);return _0x41e64a(_0x405384[_0x082e('0x15')][_0x082e('0x17')]);}logger[_0x082e('0x15')](_0x082e('0x12'),_0x5bbfa6,_0x405384[_0x082e('0x15')][_0x082e('0x17')]);return _0x3bc585(_0x405384[_0x082e('0x15')][_0x082e('0x17')]);}else{logger[_0x082e('0x18')](_0x082e('0x12'),_0x5bbfa6,_0x082e('0x19'));_0x3bc585(_0x405384[_0x082e('0x1a')][_0x082e('0x17')]);}})[_0x082e('0x1b')](function(_0x41cb63){logger[_0x082e('0x15')]('MailAccount,\x20%s,\x20%s',_0x5bbfa6,_0x41cb63);_0x41e64a(_0x41cb63);});});}function respondWithStatusCode(_0x2194e0,_0x2f4495){_0x2f4495=_0x2f4495||0xcc;return function(_0x3fa815){if(_0x3fa815){return _0x2194e0['sendStatus'](_0x2f4495);}return _0x2194e0[_0x082e('0x1c')](_0x2f4495)[_0x082e('0x1d')]();};}function respondWithResult(_0x11c5da,_0x26542b){_0x26542b=_0x26542b||0xc8;return function(_0xcc007){if(_0xcc007){return _0x11c5da[_0x082e('0x1c')](_0x26542b)[_0x082e('0x1e')](_0xcc007);}};}function respondWithFilteredResult(_0xd37fda,_0x33a38a){return function(_0x27907a){if(_0x27907a){var _0x3e76d7=typeof _0x33a38a['offset']===_0x082e('0x1f')&&typeof _0x33a38a[_0x082e('0x20')]===_0x082e('0x1f');var _0x2df307=_0x27907a[_0x082e('0x21')];var _0x343037=_0x3e76d7?0x0:_0x33a38a[_0x082e('0x22')];var _0x5403d3=_0x3e76d7?_0x27907a['count']:_0x33a38a[_0x082e('0x22')]+_0x33a38a[_0x082e('0x20')];var _0xe75fc0;if(_0x5403d3>=_0x2df307){_0x5403d3=_0x2df307;_0xe75fc0=0xc8;}else{_0xe75fc0=0xce;}_0xd37fda[_0x082e('0x1c')](_0xe75fc0);return _0xd37fda['set'](_0x082e('0x23'),_0x343037+'-'+_0x5403d3+'/'+_0x2df307)[_0x082e('0x1e')](_0x27907a);}return null;};}function saveUpdates(_0x13c36f){return function(_0x57806d){if(_0x57806d){return _0x57806d[_0x082e('0x24')](_0x13c36f)[_0x082e('0x11')](function(_0x5e7024){return _0x5e7024;});}return null;};}function removeEntity(_0xc9f61f){return function(_0x5e7008){if(_0x5e7008){return _0x5e7008['destroy']()['then'](function(){var _0x189e3a=_0x5e7008[_0x082e('0x25')]({'plain':!![]});var _0xe4b303='MailAccounts';return db[_0x082e('0x26')][_0x082e('0x27')]({'where':{'type':_0xe4b303,'resourceId':_0x189e3a['id']}})[_0x082e('0x11')](function(){return _0x5e7008;});})[_0x082e('0x11')](function(){_0xc9f61f[_0x082e('0x1c')](0xcc)[_0x082e('0x1d')]();});}};}function handleEntityNotFound(_0x48c78b){return function(_0x3b6c57){if(!_0x3b6c57){_0x48c78b['sendStatus'](0x194);}return _0x3b6c57;};}function handleError(_0x197b11,_0x3c4aff){_0x3c4aff=_0x3c4aff||0x1f4;return function(_0x182ddc){logger[_0x082e('0x15')](_0x182ddc[_0x082e('0x28')]);if(_0x182ddc['name']){delete _0x182ddc[_0x082e('0x29')];}_0x197b11[_0x082e('0x1c')](_0x3c4aff)[_0x082e('0x2a')](_0x182ddc);};}function getImapHost(_0x2259be){switch(_0x2259be){case'gmail':return'imap.gmail.com';case _0x082e('0x2b'):return _0x082e('0x2c');case _0x082e('0x2d'):return'imap-mail.outlook.com';case _0x082e('0x2e'):return _0x082e('0x2f');}throw new Error(_0x082e('0x30'),_0x2259be);}function getSmtpHost(_0x4fa189){switch(_0x4fa189){case _0x082e('0x31'):return'smtp.gmail.com';case _0x082e('0x2b'):return _0x082e('0x32');case _0x082e('0x2d'):return _0x082e('0x33');case _0x082e('0x2e'):return'smtp.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x4fa189);}function getAuthenticationOptions(_0x103585,_0x3835fa){var _0x2b3fc7={};var _0x1ec3f6={};if(_0x103585){_0x2b3fc7[_0x082e('0x34')]=_0x1ec3f6[_0x082e('0x34')]=_0x3835fa['username'];_0x2b3fc7[_0x082e('0x35')]=_0x1ec3f6['pass']=_0x3835fa[_0x082e('0x35')];if(_0x3835fa[_0x082e('0x36')]){_0x2b3fc7[_0x082e('0x36')]=_0x1ec3f6[_0x082e('0x36')]=!![];_0x2b3fc7['CloudProviderId']=_0x1ec3f6[_0x082e('0x37')]=_0x3835fa[_0x082e('0x37')];_0x2b3fc7[_0x082e('0x35')]=_0x1ec3f6['pass']=null;}else{_0x2b3fc7[_0x082e('0x37')]=_0x1ec3f6[_0x082e('0x37')]=null;}_0x2b3fc7[_0x082e('0x38')]=getImapHost(_0x103585);_0x2b3fc7[_0x082e('0x39')]=0x3e1;_0x1ec3f6[_0x082e('0x38')]=getSmtpHost(_0x103585);_0x1ec3f6[_0x082e('0x39')]=0x24b;_0x1ec3f6[_0x082e('0x3a')]=![];_0x2b3fc7[_0x082e('0x3b')]=_0x1ec3f6[_0x082e('0x3b')]=null;}else{if(_0x3835fa['authentication']){_0x2b3fc7[_0x082e('0x34')]=_0x1ec3f6[_0x082e('0x34')]=_0x3835fa[_0x082e('0x3c')];_0x2b3fc7['password']=_0x1ec3f6['pass']=_0x3835fa[_0x082e('0x35')];}else{_0x2b3fc7['authentication']=_0x1ec3f6[_0x082e('0x3d')]=![];_0x2b3fc7[_0x082e('0x34')]=_0x1ec3f6[_0x082e('0x34')]=null;_0x2b3fc7[_0x082e('0x35')]=_0x1ec3f6[_0x082e('0x3e')]=null;}_0x2b3fc7[_0x082e('0x38')]=_0x3835fa[_0x082e('0x3f')][_0x082e('0x38')];_0x2b3fc7[_0x082e('0x39')]=_0x3835fa['Imap'][_0x082e('0x39')];_0x1ec3f6[_0x082e('0x38')]=_0x3835fa['Smtp']['host'];_0x1ec3f6['port']=_0x3835fa[_0x082e('0x40')][_0x082e('0x39')];}return{'Imap':_0x2b3fc7,'Smtp':_0x1ec3f6};}exports[_0x082e('0x41')]=function(_0x210055,_0x598545){var _0x3acd31={'include':[{'model':db[_0x082e('0x42')],'as':'Imap'},{'model':db[_0x082e('0x43')],'as':_0x082e('0x40')},{'model':db['Pause'],'as':_0x082e('0x44')}]},_0x58bc39={},_0x51e32e={'count':0x0,'rows':[]};var _0x2f7674=_[_0x082e('0x45')](db['MailAccount'][_0x082e('0x46')],function(_0x2cccdd){return{'name':_0x2cccdd[_0x082e('0x47')],'type':_0x2cccdd[_0x082e('0x48')][_0x082e('0x49')]};});_0x58bc39[_0x082e('0x4a')]=_['map'](_0x2f7674,'name');_0x58bc39[_0x082e('0x4b')]=_[_0x082e('0x4c')](_0x210055[_0x082e('0x4b')]);_0x58bc39['filters']=_[_0x082e('0x4d')](_0x58bc39['model'],_0x58bc39[_0x082e('0x4b')]);_0x3acd31[_0x082e('0x4e')]=_[_0x082e('0x4d')](_0x58bc39[_0x082e('0x4a')],qs['fields'](_0x210055[_0x082e('0x4b')][_0x082e('0x4f')]));_0x3acd31[_0x082e('0x4e')]=_0x3acd31[_0x082e('0x4e')][_0x082e('0x50')]?_0x3acd31['attributes']:_0x58bc39[_0x082e('0x4a')];if(!_0x210055[_0x082e('0x4b')][_0x082e('0x51')](_0x082e('0x52'))){_0x3acd31[_0x082e('0x20')]=qs[_0x082e('0x20')](_0x210055[_0x082e('0x4b')][_0x082e('0x20')]);_0x3acd31['offset']=qs[_0x082e('0x22')](_0x210055[_0x082e('0x4b')][_0x082e('0x22')]);}_0x3acd31[_0x082e('0x53')]=qs[_0x082e('0x54')](_0x210055['query'][_0x082e('0x54')]);_0x3acd31[_0x082e('0x55')]=qs[_0x082e('0x56')](_[_0x082e('0x57')](_0x210055[_0x082e('0x4b')],_0x58bc39[_0x082e('0x56')]),_0x2f7674);if(_0x210055['query']['filter']){_0x3acd31[_0x082e('0x55')]=_['merge'](_0x3acd31['where'],{'$or':_[_0x082e('0x45')](_0x2f7674,function(_0x4da68c){if(_0x4da68c[_0x082e('0x48')]!==_0x082e('0x58')){var _0x3921d7={};_0x3921d7[_0x4da68c[_0x082e('0x29')]]={'$like':'%'+_0x210055['query'][_0x082e('0x59')]+'%'};return _0x3921d7;}})});}_0x3acd31=_['merge']({},_0x3acd31,_0x210055[_0x082e('0x5a')]);var _0x4ea343={'where':_0x3acd31[_0x082e('0x55')]};return db['MailAccount'][_0x082e('0x21')](_0x4ea343)[_0x082e('0x11')](function(_0x20ba83){_0x51e32e[_0x082e('0x21')]=_0x20ba83;if(_0x210055[_0x082e('0x4b')]['includeAll']){_0x3acd31['include']=[{'all':!![]}];}return db['MailAccount'][_0x082e('0x5b')](_0x3acd31);})[_0x082e('0x11')](function(_0xd7b0aa){_0x51e32e['rows']=_0xd7b0aa;return _0x51e32e;})[_0x082e('0x11')](respondWithFilteredResult(_0x598545,_0x3acd31))['catch'](handleError(_0x598545,null));};exports[_0x082e('0x5c')]=function(_0x5e06f9,_0x538d2e){var _0x38764f={'raw':![],'where':{'id':_0x5e06f9['params']['id']},'include':[{'model':db[_0x082e('0x42')],'as':_0x082e('0x3f')},{'model':db[_0x082e('0x43')],'as':_0x082e('0x40')},{'model':db['Pause'],'as':_0x082e('0x44')}]},_0x1a33b4={};_0x1a33b4[_0x082e('0x4a')]=_[_0x082e('0x4c')](db[_0x082e('0x5d')][_0x082e('0x46')]);_0x1a33b4[_0x082e('0x4b')]=_[_0x082e('0x4c')](_0x5e06f9[_0x082e('0x4b')]);_0x1a33b4[_0x082e('0x56')]=_[_0x082e('0x4d')](_0x1a33b4['model'],_0x1a33b4[_0x082e('0x4b')]);_0x38764f[_0x082e('0x4e')]=_[_0x082e('0x4d')](_0x1a33b4[_0x082e('0x4a')],qs[_0x082e('0x4f')](_0x5e06f9['query'][_0x082e('0x4f')]));_0x38764f['attributes']=_0x38764f[_0x082e('0x4e')]['length']?_0x38764f['attributes']:_0x1a33b4[_0x082e('0x4a')];if(_0x5e06f9[_0x082e('0x4b')]['includeAll']){_0x38764f[_0x082e('0x5e')]=[{'all':!![]}];}_0x38764f=_['merge']({},_0x38764f,_0x5e06f9[_0x082e('0x5a')]);return db[_0x082e('0x5d')]['find'](_0x38764f)['then'](handleEntityNotFound(_0x538d2e,null))[_0x082e('0x11')](respondWithResult(_0x538d2e,null))[_0x082e('0x1b')](handleError(_0x538d2e,null));};exports['update']=function(_0x29eef5,_0x4c7ec5){if(_0x29eef5[_0x082e('0x5f')]['id']){delete _0x29eef5[_0x082e('0x5f')]['id'];}var _0x34c289=_0x29eef5['body'][_0x082e('0x60')]==='custom'?null:_0x29eef5['body'][_0x082e('0x60')];var _0x19199c=_0x29eef5[_0x082e('0x5f')][_0x082e('0x3f')]||{};var _0x386f47=_0x29eef5[_0x082e('0x5f')][_0x082e('0x40')]||{};if(_0x34c289){_0x19199c[_0x082e('0x38')]=getImapHost(_0x34c289);_0x19199c[_0x082e('0x39')]=0x3e1;_0x386f47[_0x082e('0x38')]=getSmtpHost(_0x34c289);_0x386f47[_0x082e('0x39')]=0x24b;_0x386f47[_0x082e('0x3a')]=![];}if(_0x386f47[_0x082e('0x36')]){_0x386f47['secure']=![];}else{_0x386f47[_0x082e('0x37')]=null;}if(!_0x19199c['modernAuthentication'])_0x19199c[_0x082e('0x37')]=null;_0x29eef5['body']['Imap']=_0x19199c;_0x29eef5[_0x082e('0x5f')]['Smtp']=_0x386f47;return db[_0x082e('0x5d')]['find']({'where':{'id':_0x29eef5['params']['id']},'include':[{'model':db[_0x082e('0x42')],'as':_0x082e('0x3f')},{'model':db[_0x082e('0x43')],'as':_0x082e('0x40')},{'model':db[_0x082e('0x61')],'as':_0x082e('0x44')}]})[_0x082e('0x11')](handleEntityNotFound(_0x4c7ec5,null))[_0x082e('0x11')](function(_0x1a9607){if(!_0x1a9607)throw new Error(_0x082e('0x62'));if(_0x1a9607[_0x082e('0x3b')])delete _0x29eef5[_0x082e('0x5f')][_0x082e('0x3f')];return _0x1a9607;})[_0x082e('0x11')](saveUpdates(_0x29eef5['body'],null))['then'](function(_0x51499a){if(!_0x29eef5[_0x082e('0x5f')][_0x082e('0x3f')])return _0x51499a;return db[_0x082e('0x42')]['update'](_0x29eef5[_0x082e('0x5f')][_0x082e('0x3f')],{'where':{'MailAccountId':_0x51499a['id']}})[_0x082e('0x11')](function(){return _0x51499a;});})['then'](function(_0x2b2f45){if(!_0x29eef5[_0x082e('0x5f')][_0x082e('0x40')])return _0x2b2f45;return db[_0x082e('0x43')][_0x082e('0x24')](_0x29eef5[_0x082e('0x5f')]['Smtp'],{'where':{'MailAccountId':_0x2b2f45['id']}})[_0x082e('0x11')](function(){return _0x2b2f45;});})['then'](respondWithResult(_0x4c7ec5,null))[_0x082e('0x1b')](handleError(_0x4c7ec5,null));};exports[_0x082e('0x63')]=function(_0x4d8ebb,_0x87849b){return db['MailAccount'][_0x082e('0x63')]()[_0x082e('0x11')](respondWithResult(_0x87849b,null))['catch'](handleError(_0x87849b,null));};exports[_0x082e('0x64')]=function(_0x530896,_0x6024c5){if(_0x530896[_0x082e('0x5f')]['id']){delete _0x530896[_0x082e('0x5f')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x530896[_0x082e('0x65')]['id']}})[_0x082e('0x11')](handleEntityNotFound(_0x6024c5,null))[_0x082e('0x11')](function(_0x3d3775){if(_0x3d3775){_0x530896[_0x082e('0x5f')][_0x082e('0x66')]=_0x3d3775['id'];return db[_0x082e('0x67')][_0x082e('0x68')](_0x530896[_0x082e('0x5f')]);}})[_0x082e('0x11')](respondWithResult(_0x6024c5,null))[_0x082e('0x1b')](handleError(_0x6024c5,null));};exports['getDispositions']=function(_0x28ce62,_0x2d9bdd){var _0x4e126b={'raw':![],'where':{}};var _0xa16934={};var _0x2507d5={'count':0x0,'rows':[]};return db['MailAccount'][_0x082e('0x69')]({'where':{'id':_0x28ce62[_0x082e('0x65')]['id']}})[_0x082e('0x11')](handleEntityNotFound(_0x2d9bdd,null))['then'](function(_0x19419d){if(_0x19419d){_0xa16934[_0x082e('0x4a')]=_[_0x082e('0x4c')](db[_0x082e('0x67')][_0x082e('0x46')]);_0xa16934[_0x082e('0x4b')]=_[_0x082e('0x4c')](_0x28ce62['query']);_0xa16934[_0x082e('0x56')]=_[_0x082e('0x4d')](_0xa16934[_0x082e('0x4a')],_0xa16934[_0x082e('0x4b')]);_0x4e126b[_0x082e('0x4e')]=_[_0x082e('0x4d')](_0xa16934[_0x082e('0x4a')],qs[_0x082e('0x4f')](_0x28ce62[_0x082e('0x4b')][_0x082e('0x4f')]));_0x4e126b[_0x082e('0x4e')]=_0x4e126b['attributes'][_0x082e('0x50')]?_0x4e126b[_0x082e('0x4e')]:_0xa16934[_0x082e('0x4a')];if(!_0x28ce62[_0x082e('0x4b')][_0x082e('0x51')]('nolimit')){_0x4e126b['limit']=qs[_0x082e('0x20')](_0x28ce62[_0x082e('0x4b')][_0x082e('0x20')]);_0x4e126b['offset']=qs['offset'](_0x28ce62['query'][_0x082e('0x22')]);}_0x4e126b['order']=qs[_0x082e('0x54')](_0x28ce62[_0x082e('0x4b')]['sort']);_0x4e126b['where']=qs[_0x082e('0x56')](_[_0x082e('0x57')](_0x28ce62[_0x082e('0x4b')],_0xa16934[_0x082e('0x56')]));_0x4e126b[_0x082e('0x55')][_0x082e('0x66')]=_0x19419d['id'];if(_0x28ce62[_0x082e('0x4b')][_0x082e('0x59')]){_0x4e126b[_0x082e('0x55')]=_[_0x082e('0x6a')](_0x4e126b[_0x082e('0x55')],{'$or':_[_0x082e('0x45')](_0x4e126b['attributes'],function(_0x5ab6f6){var _0x500b86={};_0x500b86[_0x5ab6f6]={'$like':'%'+_0x28ce62[_0x082e('0x4b')][_0x082e('0x59')]+'%'};return _0x500b86;})});}_0x4e126b=_[_0x082e('0x6a')]({},_0x4e126b,_0x28ce62[_0x082e('0x5a')]);return db[_0x082e('0x67')][_0x082e('0x21')]({'where':_0x4e126b[_0x082e('0x55')]})[_0x082e('0x11')](function(_0xd5ca15){_0x2507d5[_0x082e('0x21')]=_0xd5ca15;if(_0x28ce62[_0x082e('0x4b')][_0x082e('0x6b')]){_0x4e126b[_0x082e('0x5e')]=[{'all':!![]}];}return db[_0x082e('0x67')][_0x082e('0x5b')](_0x4e126b);})[_0x082e('0x11')](function(_0x434bed){_0x2507d5[_0x082e('0x6c')]=_0x434bed;return _0x2507d5;});}})[_0x082e('0x11')](respondWithFilteredResult(_0x2d9bdd,_0x4e126b))[_0x082e('0x1b')](handleError(_0x2d9bdd,null));};exports[_0x082e('0x6d')]=function(_0x11ba9e,_0x2e5585){return db[_0x082e('0x5d')][_0x082e('0x6e')]({'where':{'id':_0x11ba9e[_0x082e('0x65')]['id']}})[_0x082e('0x11')](handleEntityNotFound(_0x2e5585,null))['then'](function(_0x435b4d){if(_0x435b4d){return _0x435b4d[_0x082e('0x6d')](_0x11ba9e['query'][_0x082e('0x6f')]);}})[_0x082e('0x11')](respondWithStatusCode(_0x2e5585,null))[_0x082e('0x1b')](handleError(_0x2e5585,null));};exports[_0x082e('0x70')]=function(_0x253c10,_0x3ed7b6){if(_0x253c10['body']['id']){delete _0x253c10[_0x082e('0x5f')]['id'];}return db[_0x082e('0x5d')][_0x082e('0x6e')]({'where':{'id':_0x253c10[_0x082e('0x65')]['id']}})[_0x082e('0x11')](handleEntityNotFound(_0x3ed7b6,null))['then'](function(_0x439748){if(_0x439748){_0x253c10[_0x082e('0x5f')]['MailAccountId']=_0x439748['id'];return db[_0x082e('0x71')][_0x082e('0x68')](_0x253c10[_0x082e('0x5f')]);}})[_0x082e('0x11')](respondWithResult(_0x3ed7b6,null))[_0x082e('0x1b')](handleError(_0x3ed7b6,null));};exports['getAnswers']=function(_0x543ffe,_0x42fb7f){var _0x27d5a4={'raw':![],'where':{}};var _0x4b11bb={};var _0x268edf={'count':0x0,'rows':[]};return db[_0x082e('0x5d')][_0x082e('0x69')]({'where':{'id':_0x543ffe['params']['id']}})[_0x082e('0x11')](handleEntityNotFound(_0x42fb7f,null))[_0x082e('0x11')](function(_0x47e8c9){if(_0x47e8c9){_0x4b11bb[_0x082e('0x4a')]=_[_0x082e('0x4c')](db[_0x082e('0x71')][_0x082e('0x46')]);_0x4b11bb[_0x082e('0x4b')]=_['keys'](_0x543ffe[_0x082e('0x4b')]);_0x4b11bb[_0x082e('0x56')]=_[_0x082e('0x4d')](_0x4b11bb['model'],_0x4b11bb[_0x082e('0x4b')]);_0x27d5a4[_0x082e('0x4e')]=_['intersection'](_0x4b11bb[_0x082e('0x4a')],qs[_0x082e('0x4f')](_0x543ffe[_0x082e('0x4b')][_0x082e('0x4f')]));_0x27d5a4[_0x082e('0x4e')]=_0x27d5a4[_0x082e('0x4e')][_0x082e('0x50')]?_0x27d5a4[_0x082e('0x4e')]:_0x4b11bb[_0x082e('0x4a')];if(!_0x543ffe['query'][_0x082e('0x51')](_0x082e('0x52'))){_0x27d5a4['limit']=qs[_0x082e('0x20')](_0x543ffe[_0x082e('0x4b')]['limit']);_0x27d5a4[_0x082e('0x22')]=qs[_0x082e('0x22')](_0x543ffe[_0x082e('0x4b')][_0x082e('0x22')]);}_0x27d5a4['order']=qs[_0x082e('0x54')](_0x543ffe['query']['sort']);_0x27d5a4['where']=qs[_0x082e('0x56')](_[_0x082e('0x57')](_0x543ffe['query'],_0x4b11bb[_0x082e('0x56')]));_0x27d5a4[_0x082e('0x55')]['MailAccountId']=_0x47e8c9['id'];if(_0x543ffe[_0x082e('0x4b')][_0x082e('0x59')]){_0x27d5a4[_0x082e('0x55')]=_[_0x082e('0x6a')](_0x27d5a4[_0x082e('0x55')],{'$or':_[_0x082e('0x45')](_0x27d5a4[_0x082e('0x4e')],function(_0x461f2f){var _0x44f641={};_0x44f641[_0x461f2f]={'$like':'%'+_0x543ffe[_0x082e('0x4b')]['filter']+'%'};return _0x44f641;})});}_0x27d5a4=_[_0x082e('0x6a')]({},_0x27d5a4,_0x543ffe[_0x082e('0x5a')]);return db[_0x082e('0x71')][_0x082e('0x21')]({'where':_0x27d5a4[_0x082e('0x55')]})['then'](function(_0x23edb8){_0x268edf[_0x082e('0x21')]=_0x23edb8;if(_0x543ffe[_0x082e('0x4b')][_0x082e('0x6b')]){_0x27d5a4['include']=[{'all':!![]}];}return db[_0x082e('0x71')][_0x082e('0x5b')](_0x27d5a4);})[_0x082e('0x11')](function(_0xf12511){_0x268edf[_0x082e('0x6c')]=_0xf12511;return _0x268edf;});}})[_0x082e('0x11')](respondWithFilteredResult(_0x42fb7f,_0x27d5a4))[_0x082e('0x1b')](handleError(_0x42fb7f,null));};exports[_0x082e('0x72')]=function(_0x1194d8,_0x17f875){return db['MailAccount']['find']({'where':{'id':_0x1194d8[_0x082e('0x65')]['id']}})[_0x082e('0x11')](handleEntityNotFound(_0x17f875,null))['then'](function(_0x3c75b3){if(_0x3c75b3){return _0x3c75b3[_0x082e('0x72')](_0x1194d8[_0x082e('0x4b')]['ids']);}})['then'](respondWithStatusCode(_0x17f875,null))[_0x082e('0x1b')](handleError(_0x17f875,null));};exports['create']=function(_0x252ada,_0x2ebf11){var _0x227527={'name':_0x252ada[_0x082e('0x5f')][_0x082e('0x29')],'key':_0x252ada[_0x082e('0x5f')]['key'],'provider':_0x252ada[_0x082e('0x5f')]['provider']===_0x082e('0x73')?null:_0x252ada[_0x082e('0x5f')][_0x082e('0x60')],'email':_0x252ada['body']['email'],'ListId':_0x252ada[_0x082e('0x5f')]['ListId'],'active':!_[_0x082e('0x74')](_0x252ada['body'][_0x082e('0x75')])?_0x252ada[_0x082e('0x5f')][_0x082e('0x75')]:!![],'description':_0x252ada[_0x082e('0x5f')][_0x082e('0x76')]||null};var _0x3c3a92=getAuthenticationOptions(_0x227527[_0x082e('0x60')],_0x252ada[_0x082e('0x5f')]);_0x227527[_0x082e('0x3f')]=_0x3c3a92['Imap'];_0x227527['Smtp']=_0x3c3a92[_0x082e('0x40')];return db[_0x082e('0x5d')][_0x082e('0x68')](_0x227527,{'include':[{'model':db[_0x082e('0x43')],'as':_0x082e('0x40')},{'model':db[_0x082e('0x42')],'as':_0x082e('0x3f')}]})[_0x082e('0x11')](function(_0xc58f4f){var _0x4a121e=_0x252ada[_0x082e('0x34')][_0x082e('0x25')]({'plain':!![]});if(!_0x4a121e)throw new Error(_0x082e('0x77'));if(_0x4a121e[_0x082e('0x78')]===_0x082e('0x34')){var _0x5c8ca4=_0xc58f4f['get']({'plain':!![]});return db[_0x082e('0x79')]['find']({'where':{'name':'MailAccounts','userProfileId':_0x4a121e[_0x082e('0x7a')]},'raw':!![]})[_0x082e('0x11')](function(_0x4a0d1a){if(_0x4a0d1a&&_0x4a0d1a[_0x082e('0x7b')]===0x0){return db[_0x082e('0x26')][_0x082e('0x68')]({'name':_0x5c8ca4[_0x082e('0x29')],'resourceId':_0x5c8ca4['id'],'type':_0x4a0d1a[_0x082e('0x29')],'sectionId':_0x4a0d1a['id']},{})['then'](function(){return _0xc58f4f;});}else{return _0xc58f4f;}})[_0x082e('0x1b')](function(_0x3755f1){logger[_0x082e('0x15')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3755f1);throw _0x3755f1;});}return _0xc58f4f;})['then'](respondWithResult(_0x2ebf11,0xc9))[_0x082e('0x1b')](handleError(_0x2ebf11,null));};exports[_0x082e('0x7c')]=function(_0x1bb8fd,_0x5c26a6){return db['MailAccount']['findOne']({'where':{'id':_0x1bb8fd[_0x082e('0x65')]['id']}})[_0x082e('0x11')](handleEntityNotFound(_0x5c26a6,null))['then'](function(_0x5da90e){if(_0x5da90e){return _0x5da90e['getImap']();}return null;})[_0x082e('0x11')](respondWithResult(_0x5c26a6,null))[_0x082e('0x1b')](handleError(_0x5c26a6,null));};exports['addImap']=function(_0x472471,_0x5f432f){if(_0x472471['body']['id']){delete _0x472471['body']['id'];}return db['MailAccount'][_0x082e('0x6e')]({'where':{'id':_0x472471['params']['id']}})['then'](handleEntityNotFound(_0x5f432f,null))[_0x082e('0x11')](function(_0x373696){if(_0x373696){_0x472471[_0x082e('0x5f')][_0x082e('0x66')]=_0x373696['id'];return db[_0x082e('0x42')][_0x082e('0x68')](_0x472471['body']);}})[_0x082e('0x11')](respondWithResult(_0x5f432f,null))[_0x082e('0x1b')](handleError(_0x5f432f,null));};exports[_0x082e('0x7d')]=function(_0x2bec44,_0x1fbb01){return db['MailAccount']['findOne']({'where':{'id':_0x2bec44['params']['id']}})[_0x082e('0x11')](handleEntityNotFound(_0x1fbb01,null))[_0x082e('0x11')](function(_0x589613){if(_0x589613){return _0x589613['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x1fbb01,null))[_0x082e('0x1b')](handleError(_0x1fbb01,null));};exports[_0x082e('0x7e')]=function(_0x327cbe,_0x20bb89){return db[_0x082e('0x5d')][_0x082e('0x69')]({'where':{'id':_0x327cbe[_0x082e('0x65')]['id']}})[_0x082e('0x11')](handleEntityNotFound(_0x20bb89,null))[_0x082e('0x11')](function(_0x3c89b7){if(_0x3c89b7){return _0x3c89b7[_0x082e('0x7e')]();}return null;})[_0x082e('0x11')](respondWithResult(_0x20bb89,null))[_0x082e('0x1b')](handleError(_0x20bb89,null));};exports[_0x082e('0x7f')]=function(_0x3c1774,_0x2c4a42){if(_0x3c1774[_0x082e('0x5f')]['id']){delete _0x3c1774[_0x082e('0x5f')]['id'];}return db[_0x082e('0x5d')][_0x082e('0x6e')]({'where':{'id':_0x3c1774['params']['id']}})['then'](handleEntityNotFound(_0x2c4a42,null))[_0x082e('0x11')](function(_0x5b8ff7){if(_0x5b8ff7){_0x3c1774[_0x082e('0x5f')][_0x082e('0x66')]=_0x5b8ff7['id'];return db[_0x082e('0x43')][_0x082e('0x68')](_0x3c1774['body']);}})[_0x082e('0x11')](respondWithResult(_0x2c4a42,null))[_0x082e('0x1b')](handleError(_0x2c4a42,null));};exports[_0x082e('0x80')]=function(_0x195766,_0x5a7edb){return db[_0x082e('0x5d')][_0x082e('0x69')]({'where':{'id':_0x195766[_0x082e('0x65')]['id']}})['then'](handleEntityNotFound(_0x5a7edb,null))['then'](function(_0x590aef){if(_0x590aef){return _0x590aef['setSmtp'](null);}return null;})[_0x082e('0x11')](respondWithStatusCode(_0x5a7edb,null))[_0x082e('0x1b')](handleError(_0x5a7edb,null));};exports['addInteraction']=function(_0x12d0d9,_0x4cfe30){return db[_0x082e('0x81')]['find']({'where':{'id':_0x12d0d9[_0x082e('0x65')]['id']}})[_0x082e('0x11')](handleEntityNotFound(_0x4cfe30,null))[_0x082e('0x11')](function(_0x2cc0d1){if(_0x2cc0d1){return _0x2cc0d1[_0x082e('0x82')](_0x12d0d9[_0x082e('0x5f')][_0x082e('0x6f')],_[_0x082e('0x83')](_0x12d0d9[_0x082e('0x5f')],[_0x082e('0x6f'),'id'])||{});}})[_0x082e('0x11')](respondWithResult(_0x4cfe30,null))[_0x082e('0x1b')](handleError(_0x4cfe30,null));};exports[_0x082e('0x84')]=function(_0x409721,_0x19ddbc){var _0x148959={'raw':![],'where':{}};var _0x388ea9={};var _0x363c89={'count':0x0,'rows':[]};return db[_0x082e('0x5d')]['findOne']({'where':{'id':_0x409721[_0x082e('0x65')]['id']}})[_0x082e('0x11')](handleEntityNotFound(_0x19ddbc,null))['then'](function(_0x57466c){if(_0x57466c){_0x388ea9['model']=_['keys'](db['MailInteraction'][_0x082e('0x46')]);_0x388ea9[_0x082e('0x4b')]=_[_0x082e('0x4c')](_0x409721[_0x082e('0x4b')]);_0x388ea9['filters']=_[_0x082e('0x4d')](_0x388ea9[_0x082e('0x4a')],_0x388ea9[_0x082e('0x4b')]);_0x148959['attributes']=_[_0x082e('0x4d')](_0x388ea9[_0x082e('0x4a')],qs['fields'](_0x409721[_0x082e('0x4b')][_0x082e('0x4f')]));_0x148959[_0x082e('0x4e')]=_0x148959[_0x082e('0x4e')][_0x082e('0x50')]?_0x148959[_0x082e('0x4e')]:_0x388ea9[_0x082e('0x4a')];if(!_0x409721['query'][_0x082e('0x51')](_0x082e('0x52'))){_0x148959[_0x082e('0x20')]=qs[_0x082e('0x20')](_0x409721[_0x082e('0x4b')][_0x082e('0x20')]);_0x148959[_0x082e('0x22')]=qs[_0x082e('0x22')](_0x409721[_0x082e('0x4b')][_0x082e('0x22')]);}_0x148959[_0x082e('0x53')]=qs[_0x082e('0x54')](_0x409721['query'][_0x082e('0x54')]);_0x148959[_0x082e('0x55')]=qs[_0x082e('0x56')](_[_0x082e('0x57')](_0x409721['query'],_0x388ea9[_0x082e('0x56')]));_0x148959[_0x082e('0x55')]['MailAccountId']=_0x57466c['id'];if(_0x409721[_0x082e('0x4b')]['filter']){_0x148959[_0x082e('0x55')]=_['merge'](_0x148959['where'],{'$or':_['map'](_0x148959[_0x082e('0x4e')],function(_0x220791){var _0x20574c={};_0x20574c[_0x220791]={'$like':'%'+_0x409721['query']['filter']+'%'};return _0x20574c;})});}_0x148959=_[_0x082e('0x6a')]({},_0x148959,_0x409721[_0x082e('0x5a')]);return db[_0x082e('0x81')][_0x082e('0x21')]({'where':_0x148959['where']})[_0x082e('0x11')](function(_0x52ed07){_0x363c89['count']=_0x52ed07;if(_0x409721['query'][_0x082e('0x6b')]){_0x148959[_0x082e('0x5e')]=[{'model':db[_0x082e('0x85')],'as':_0x082e('0x86'),'required':![]},{'model':db['User'],'as':_0x082e('0x87'),'attributes':[_0x082e('0x29'),_0x082e('0x88'),_0x082e('0x89')],'required':![]},{'model':db[_0x082e('0x8a')],'as':'Tags','attributes':['id',_0x082e('0x29'),_0x082e('0x8b')],'where':_0x409721[_0x082e('0x4b')][_0x082e('0x8c')]?{'id':_0x409721[_0x082e('0x4b')]['tag']}:undefined,'required':_0x409721[_0x082e('0x4b')][_0x082e('0x8c')]?!![]:![]}];}return db[_0x082e('0x81')][_0x082e('0x5b')](_0x148959);})[_0x082e('0x11')](function(_0x1e482b){_0x363c89['rows']=_0x1e482b;return _0x363c89;});}})[_0x082e('0x11')](respondWithFilteredResult(_0x19ddbc,_0x148959))[_0x082e('0x1b')](handleError(_0x19ddbc,null));};exports[_0x082e('0x8d')]=function addApplications(_0x1d6dd0,_0x24a390){var _0x2b363b=_0x1d6dd0[_0x082e('0x65')]['id'];var _0x977b11=_0x1d6dd0[_0x082e('0x5f')];var _0x2d7583=0xc8;var _0x5b636a=null;return db[_0x082e('0x8e')][_0x082e('0x8f')]({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS'][_0x082e('0x90')]},function(_0x1789bc){return db['MailAccount'][_0x082e('0x69')]({'where':{'id':_0x2b363b},'transaction':_0x1789bc})[_0x082e('0x11')](function(_0x57acf5){if(_0x57acf5){return db[_0x082e('0x91')][_0x082e('0x27')]({'where':{'MailAccountId':_0x2b363b},'transaction':_0x1789bc})[_0x082e('0x11')](function(){var _0x4014db=_[_0x082e('0x45')](_0x977b11,function(_0x1a0d59){_0x1a0d59['MailAccountId']=_0x2b363b;return _0x1a0d59;});return db[_0x082e('0x91')]['bulkCreate'](_0x4014db,{'transaction':_0x1789bc});});}else{_0x2d7583=0x194;_0x5b636a=[];}});})[_0x082e('0x11')](function(){if(_0x2d7583!==0x194){return db[_0x082e('0x91')]['findAndCountAll']({'where':{'MailAccountId':_0x2b363b},'order':_0x082e('0x92')})['then'](function(_0x5e7f1d){_0x5b636a=_0x5e7f1d;});}})[_0x082e('0x1b')](function(_0x24fba8){_0x2d7583=0x1f4;logger[_0x082e('0x15')](_0x24fba8[_0x082e('0x28')]);if(_0x24fba8[_0x082e('0x29')]){delete _0x24fba8['name'];}_0x5b636a=_0x24fba8;})[_0x082e('0x93')](function(){if(_0x5b636a===null){_0x24a390[_0x082e('0x94')](_0x2d7583);}else{if(_0x2d7583===0x1f4){_0x24a390[_0x082e('0x1c')](_0x2d7583)[_0x082e('0x2a')](_0x5b636a);}else{_0x24a390[_0x082e('0x1c')](_0x2d7583)[_0x082e('0x1e')](_0x5b636a);}}});};exports['getApplications']=function(_0x6718f1,_0x262cc3){var _0x30007e={};var _0x8e9ac7={};var _0x52ccc7;var _0x3f6d1b;return db[_0x082e('0x5d')][_0x082e('0x69')]({'where':{'id':_0x6718f1[_0x082e('0x65')]['id']}})[_0x082e('0x11')](handleEntityNotFound(_0x262cc3,null))[_0x082e('0x11')](function(_0x1ab51c){if(_0x1ab51c){_0x52ccc7=_0x1ab51c;_0x8e9ac7['model']=_[_0x082e('0x4c')](db[_0x082e('0x91')][_0x082e('0x46')]);_0x8e9ac7[_0x082e('0x4b')]=_[_0x082e('0x4c')](_0x6718f1[_0x082e('0x4b')]);_0x8e9ac7['filters']=_['intersection'](_0x8e9ac7[_0x082e('0x4a')],_0x8e9ac7['query']);_0x30007e[_0x082e('0x4e')]=_[_0x082e('0x4d')](_0x8e9ac7[_0x082e('0x4a')],qs[_0x082e('0x4f')](_0x6718f1['query'][_0x082e('0x4f')]));_0x30007e['attributes']=_0x30007e['attributes'][_0x082e('0x50')]?_0x30007e[_0x082e('0x4e')]:_0x8e9ac7[_0x082e('0x4a')];_0x30007e['order']=qs[_0x082e('0x54')](_0x6718f1[_0x082e('0x4b')][_0x082e('0x54')]);_0x30007e[_0x082e('0x55')]=qs[_0x082e('0x56')](_[_0x082e('0x57')](_0x6718f1[_0x082e('0x4b')],_0x8e9ac7[_0x082e('0x56')]));if(_0x6718f1[_0x082e('0x4b')][_0x082e('0x59')]){_0x30007e[_0x082e('0x55')]=_[_0x082e('0x6a')](_0x30007e['where'],{'$or':_[_0x082e('0x45')](_0x30007e[_0x082e('0x4e')],function(_0x65ff2c){var _0x3b12a8={};_0x3b12a8[_0x65ff2c]={'$like':'%'+_0x6718f1[_0x082e('0x4b')][_0x082e('0x59')]+'%'};return _0x3b12a8;})});}_0x30007e=_[_0x082e('0x6a')]({},_0x30007e,_0x6718f1[_0x082e('0x5a')]);return _0x52ccc7[_0x082e('0x95')](_0x30007e);}})[_0x082e('0x11')](function(_0x2c35b9){if(_0x2c35b9){_0x3f6d1b=_0x2c35b9[_0x082e('0x50')];if(!_0x6718f1[_0x082e('0x4b')]['hasOwnProperty'](_0x082e('0x52'))){_0x30007e[_0x082e('0x20')]=qs['limit'](_0x6718f1[_0x082e('0x4b')]['limit']);_0x30007e['offset']=qs['offset'](_0x6718f1[_0x082e('0x4b')][_0x082e('0x22')]);}return _0x52ccc7[_0x082e('0x95')](_0x30007e);}})[_0x082e('0x11')](function(_0x1704bc){if(_0x1704bc){return _0x1704bc?{'count':_0x3f6d1b,'rows':_0x1704bc}:null;}})[_0x082e('0x11')](respondWithResult(_0x262cc3,null))[_0x082e('0x1b')](handleError(_0x262cc3,null));};exports[_0x082e('0x96')]=function(_0x13d0ea,_0x1b99ba){var _0x3c56bc={'raw':!![],'where':{}};var _0x27d1d8={};var _0xdb3f23={'count':0x0,'rows':[]};return db[_0x082e('0x5d')][_0x082e('0x69')]({'where':{'id':_0x13d0ea[_0x082e('0x65')]['id']}})['then'](handleEntityNotFound(_0x1b99ba,null))[_0x082e('0x11')](function(_0x52fa00){if(_0x52fa00){_0x27d1d8[_0x082e('0x4a')]=_[_0x082e('0x4c')](db['MailMessage'][_0x082e('0x46')]);_0x27d1d8[_0x082e('0x4b')]=_[_0x082e('0x4c')](_0x13d0ea[_0x082e('0x4b')]);_0x27d1d8[_0x082e('0x56')]=_[_0x082e('0x4d')](_0x27d1d8[_0x082e('0x4a')],_0x27d1d8[_0x082e('0x4b')]);_0x3c56bc[_0x082e('0x4e')]=_[_0x082e('0x4d')](_0x27d1d8[_0x082e('0x4a')],qs[_0x082e('0x4f')](_0x13d0ea[_0x082e('0x4b')][_0x082e('0x4f')]));_0x3c56bc[_0x082e('0x4e')]=_0x3c56bc[_0x082e('0x4e')][_0x082e('0x50')]?_0x3c56bc[_0x082e('0x4e')]:_0x27d1d8['model'];if(!_0x13d0ea[_0x082e('0x4b')][_0x082e('0x51')]('nolimit')){_0x3c56bc['limit']=qs[_0x082e('0x20')](_0x13d0ea[_0x082e('0x4b')][_0x082e('0x20')]);_0x3c56bc[_0x082e('0x22')]=qs['offset'](_0x13d0ea['query'][_0x082e('0x22')]);}_0x3c56bc[_0x082e('0x53')]=qs['sort'](_0x13d0ea[_0x082e('0x4b')][_0x082e('0x54')]);_0x3c56bc[_0x082e('0x55')]=qs['filters'](_[_0x082e('0x57')](_0x13d0ea[_0x082e('0x4b')],_0x27d1d8[_0x082e('0x56')]));_0x3c56bc[_0x082e('0x55')][_0x082e('0x66')]=_0x52fa00['id'];if(_0x13d0ea[_0x082e('0x4b')]['filter']){_0x3c56bc['where']=_['merge'](_0x3c56bc['where'],{'$or':_[_0x082e('0x45')](_0x3c56bc['attributes'],function(_0x4b93c0){var _0x44b646={};_0x44b646[_0x4b93c0]={'$like':'%'+_0x13d0ea[_0x082e('0x4b')][_0x082e('0x59')]+'%'};return _0x44b646;})});}if(_0x13d0ea[_0x082e('0x4b')][_0x082e('0x97')]){var _0x48b582=_0x13d0ea[_0x082e('0x4b')][_0x082e('0x97')][_0x082e('0x98')](',');var _0x1e8fcc={};_0x1e8fcc[_0x48b582[0x0]]={'$gte':moment(_0x48b582[0x1])[_0x082e('0x99')](_0x082e('0x9a'))};_0x3c56bc[_0x082e('0x55')]=_['merge'](_0x3c56bc['where'],_0x1e8fcc);}_0x3c56bc=_[_0x082e('0x6a')]({},_0x3c56bc,_0x13d0ea[_0x082e('0x5a')]);return db[_0x082e('0x9b')][_0x082e('0x21')]({'where':_0x3c56bc[_0x082e('0x55')]})[_0x082e('0x11')](function(_0x141a08){_0xdb3f23[_0x082e('0x21')]=_0x141a08;if(_0x13d0ea[_0x082e('0x4b')][_0x082e('0x6b')]){_0x3c56bc[_0x082e('0x5e')]=[{'all':!![]}];}return db[_0x082e('0x9b')]['findAll'](_0x3c56bc);})[_0x082e('0x11')](function(_0xc140fe){if(_0x13d0ea[_0x082e('0x4b')][_0x082e('0x9c')]===_0x082e('0x9d')){for(var _0xa6f1d1=0x0;_0xa6f1d1<_0xc140fe[_0x082e('0x50')];_0xa6f1d1++){_0xc140fe[_0xa6f1d1][_0x082e('0x5f')]=juice(_0xc140fe[_0xa6f1d1][_0x082e('0x5f')]);}}_0xdb3f23['rows']=_0xc140fe;return _0xdb3f23;});}})['then'](respondWithFilteredResult(_0x1b99ba,_0x3c56bc))[_0x082e('0x1b')](handleError(_0x1b99ba,null));};exports[_0x082e('0x2a')]=function(_0x2606b3,_0x3b51cd){var _0x2cb79d,_0x32dc24={},_0x3490be;if(_0x2606b3[_0x082e('0x5f')]['to']){_0x3490be=_0x2606b3[_0x082e('0x5f')]['to'][_0x082e('0x98')](',')[0x0];}return db[_0x082e('0x5d')][_0x082e('0x6e')]({'where':{'id':_0x2606b3['params']['id']},'include':[{'model':db[_0x082e('0x9e')],'as':_0x082e('0x9f'),'include':[{'model':db[_0x082e('0x85')],'as':_0x082e('0xa0'),'where':{'email':_0x3490be},'limit':0x1,'order':[[_0x082e('0xa1'),_0x082e('0xa2')]]}]},{'model':db['MailServerOut'],'as':_0x082e('0x40'),'raw':!![],'include':[{'model':db[_0x082e('0xa3')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x3b51cd,null))[_0x082e('0x11')](function(_0x43fe3c){if(!_0x43fe3c)return;_0x2cb79d=_0x43fe3c;if(!_0x43fe3c[_0x082e('0x40')])throw new Error(_0x082e('0xa4'));if(_[_0x082e('0x74')](_0x2606b3[_0x082e('0x5f')][_0x082e('0xa5')])){_0x2606b3[_0x082e('0x5f')][_0x082e('0xa5')]=util[_0x082e('0x99')](_0x082e('0xa6'),_0x43fe3c[_0x082e('0x29')],_0x43fe3c[_0x082e('0xa7')]||_0x43fe3c[_0x082e('0x40')][_0x082e('0x34')]);}if(_0x2606b3[_0x082e('0x5f')]['attachments']&&_0x2606b3[_0x082e('0x5f')][_0x082e('0xa8')][_0x082e('0x50')]){for(var _0x4d6740=0x0;_0x4d6740<_0x2606b3['body'][_0x082e('0xa8')][_0x082e('0x50')];_0x4d6740+=0x1){_0x2606b3[_0x082e('0x5f')][_0x082e('0xa8')][_0x4d6740]={'filename':_0x2606b3['body'][_0x082e('0xa8')][_0x4d6740][_0x082e('0x29')],'path':path['join'](config[_0x082e('0xa9')],_0x082e('0xaa'),_0x2606b3[_0x082e('0x5f')][_0x082e('0xa8')][_0x4d6740]['basename'])};}}var _0x227989=_0x43fe3c[_0x082e('0xab')]();return respondWithRpcPromise(_0x082e('0xac'),_0x082e('0xad'),{'account':_0x227989,'message':_0x2606b3['body']});})[_0x082e('0x11')](function(_0x11217f){if(!_0x11217f)return;_0x32dc24=_0x11217f;if(!_0x2cb79d[_0x082e('0x9f')])throw new Error('List\x20not\x20found');if(_0x2cb79d[_0x082e('0x9f')][_0x082e('0xa0')][_0x082e('0x50')])return _0x2cb79d[_0x082e('0x9f')][_0x082e('0xa0')][0x0];return db[_0x082e('0x85')]['create'](_[_0x082e('0xa')](_0x2606b3[_0x082e('0x5f')],{'firstName':_0x2606b3['body']['to'],'email':_0x2606b3['body']['to'],'phone':_0x2606b3[_0x082e('0x5f')]['to'],'ListId':_0x2cb79d['ListId']}));})[_0x082e('0x11')](function(_0x6eef03){if(!_0x6eef03)return;var _0x598a24={'UserId':_0x2606b3[_0x082e('0x34')]['id'],'ContactId':_0x6eef03['id'],'MailAccountId':_0x2cb79d['id'],'inReplyTo':_0x32dc24['messageId'],'to':_0x2606b3[_0x082e('0x5f')][_0x082e('0xa5')],'cc':_0x2606b3[_0x082e('0x5f')]['cc'],'subject':_0x2606b3[_0x082e('0x5f')][_0x082e('0xae')],'attach':_0x2606b3[_0x082e('0x5f')][_0x082e('0xaf')],'firstMsgDirection':'out','lastMsgAt':moment()['format'](_0x082e('0x9a')),'lastMsgDirection':_0x082e('0xb0'),'Messages':[_[_0x082e('0x6a')](_0x2606b3[_0x082e('0x5f')],{'messageId':_0x32dc24[_0x082e('0xb1')],'sentAt':moment()[_0x082e('0x99')](_0x082e('0x9a')),'read':!![],'MailAccountId':_0x2cb79d['id'],'UserId':_0x2606b3[_0x082e('0x34')]['id'],'ContactId':_0x6eef03['id']})]};if(_0x2606b3[_0x082e('0x5f')][_0x082e('0xb2')]){_0x598a24=_[_0x082e('0x6a')](_0x598a24,_0x2606b3['body'][_0x082e('0xb2')]);}return db['MailInteraction'][_0x082e('0x68')](_0x598a24,{'include':[{'model':db['MailMessage'],'as':_0x082e('0xb3')}]});})[_0x082e('0x11')](respondWithResult(_0x3b51cd,null))['catch'](handleError(_0x3b51cd,null));};exports['verifySmtp']=function(_0x5d24f2,_0x3fca4c){return db['MailAccount'][_0x082e('0x6e')]({'where':{'id':_0x5d24f2[_0x082e('0x65')]['id']},'include':[{'model':db[_0x082e('0x43')],'as':_0x082e('0x40'),'raw':!![],'include':[{'model':db[_0x082e('0xa3')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x3fca4c,null))[_0x082e('0x11')](function(_0x31e6ee){if(!_0x31e6ee[_0x082e('0x40')])return;var _0x33b87b=_0x31e6ee[_0x082e('0xab')]();return respondWithRpcPromise(_0x082e('0xb4'),'verifySmtp',{'account':_0x33b87b});})[_0x082e('0x11')](respondWithResult(_0x3fca4c,null))['catch'](handleError(_0x3fca4c,null));};exports[_0x082e('0x27')]=function(_0x3a1ad5,_0x208e15){return db[_0x082e('0x5d')]['find']({'where':{'id':_0x3a1ad5['params']['id']}})['then'](handleEntityNotFound(_0x208e15,null))[_0x082e('0x11')](function(_0xee0eda){if(_0xee0eda&&_0xee0eda[_0x082e('0x3b')]){throw new db[(_0x082e('0xb5'))][(_0x082e('0xb6'))](_0x082e('0xb7'));}return _0xee0eda;})['then'](removeEntity(_0x208e15,null))[_0x082e('0x1b')](handleError(_0x208e15,null));};exports['addAgents']=function(_0x39c26b,_0x591fcb){return db['MailAccount'][_0x082e('0x6e')]({'where':{'id':_0x39c26b['params']['id']}})[_0x082e('0x11')](handleEntityNotFound(_0x591fcb,null))['then'](function(_0x23ce99){if(_0x23ce99){return _0x23ce99[_0x082e('0xb8')](_0x39c26b[_0x082e('0x5f')]['ids'],_[_0x082e('0x83')](_0x39c26b[_0x082e('0x5f')],[_0x082e('0x6f'),'id'])||{})[_0x082e('0xb9')](function(_0x22f2f8){for(var _0x210a20=0x0;_0x210a20<_0x39c26b[_0x082e('0x5f')][_0x082e('0x6f')]['length'];_0x210a20+=0x1){socket[_0x082e('0xba')](_0x082e('0xbb'),{'UserId':Number(_0x39c26b[_0x082e('0x5f')][_0x082e('0x6f')][_0x210a20]),'MailAccountId':Number(_0x39c26b[_0x082e('0x65')]['id'])});}return _0x22f2f8;});}})[_0x082e('0x11')](respondWithResult(_0x591fcb,null))[_0x082e('0x1b')](handleError(_0x591fcb,null));};exports[_0x082e('0xbc')]=function(_0x36bb91,_0x5e2d17){return db['MailAccount'][_0x082e('0x6e')]({'where':{'id':_0x36bb91['params']['id']}})[_0x082e('0x11')](handleEntityNotFound(_0x5e2d17,null))[_0x082e('0x11')](function(_0x387529){if(_0x387529){return _0x387529[_0x082e('0xbc')](_0x36bb91[_0x082e('0x4b')][_0x082e('0x6f')])[_0x082e('0x11')](function(){if(_[_0x082e('0xbd')](_0x36bb91[_0x082e('0x4b')][_0x082e('0x6f')])){for(var _0x4abc15=0x0;_0x4abc15<_0x36bb91[_0x082e('0x4b')][_0x082e('0x6f')]['length'];_0x4abc15+=0x1){socket['emit'](_0x082e('0xbe'),{'UserId':Number(_0x36bb91[_0x082e('0x4b')]['ids'][_0x4abc15]),'MailAccountId':Number(_0x36bb91[_0x082e('0x65')]['id'])});}}else{socket[_0x082e('0xba')](_0x082e('0xbe'),{'UserId':Number(_0x36bb91[_0x082e('0x4b')]['ids']),'MailAccountId':Number(_0x36bb91[_0x082e('0x65')]['id'])});}});}})[_0x082e('0x11')](respondWithStatusCode(_0x5e2d17,null))['catch'](handleError(_0x5e2d17,null));};exports[_0x082e('0xbf')]=function(_0x244820,_0x33e52e){var _0x1bbdcb={};var _0x4f1155={};var _0xf7bc15;var _0x404732;return db['MailAccount']['findOne']({'where':{'id':_0x244820[_0x082e('0x65')]['id']}})[_0x082e('0x11')](handleEntityNotFound(_0x33e52e,null))[_0x082e('0x11')](function(_0xa22d89){if(_0xa22d89){_0xf7bc15=_0xa22d89;_0x4f1155[_0x082e('0x4a')]=_[_0x082e('0x4c')](db[_0x082e('0xc0')][_0x082e('0x46')]);_0x4f1155['query']=_[_0x082e('0x4c')](_0x244820['query']);_0x4f1155[_0x082e('0x56')]=_['intersection'](_0x4f1155[_0x082e('0x4a')],_0x4f1155[_0x082e('0x4b')]);_0x1bbdcb[_0x082e('0x4e')]=_[_0x082e('0x4d')](_0x4f1155[_0x082e('0x4a')],qs[_0x082e('0x4f')](_0x244820['query'][_0x082e('0x4f')]));_0x1bbdcb[_0x082e('0x4e')]=_0x1bbdcb[_0x082e('0x4e')]['length']?_0x1bbdcb[_0x082e('0x4e')]:_0x4f1155[_0x082e('0x4a')];_0x1bbdcb['order']=qs[_0x082e('0x54')](_0x244820['query']['sort']);_0x1bbdcb[_0x082e('0x55')]=qs[_0x082e('0x56')](_[_0x082e('0x57')](_0x244820[_0x082e('0x4b')],_0x4f1155[_0x082e('0x56')]));if(_0x244820[_0x082e('0x4b')][_0x082e('0x59')]){_0x1bbdcb[_0x082e('0x55')]=_[_0x082e('0x6a')](_0x1bbdcb[_0x082e('0x55')],{'$or':_[_0x082e('0x45')](_0x1bbdcb[_0x082e('0x4e')],function(_0x2f3df1){var _0x1844c3={};_0x1844c3[_0x2f3df1]={'$like':'%'+_0x244820['query'][_0x082e('0x59')]+'%'};return _0x1844c3;})});}_0x1bbdcb=_[_0x082e('0x6a')]({},_0x1bbdcb,_0x244820['options']);return _0xf7bc15[_0x082e('0xbf')](_0x1bbdcb);}})[_0x082e('0x11')](function(_0x2a14ee){if(_0x2a14ee){_0x404732=_0x2a14ee['length'];if(!_0x244820['query'][_0x082e('0x51')]('nolimit')){_0x1bbdcb[_0x082e('0x20')]=qs[_0x082e('0x20')](_0x244820[_0x082e('0x4b')][_0x082e('0x20')]);_0x1bbdcb[_0x082e('0x22')]=qs[_0x082e('0x22')](_0x244820['query']['offset']);}return _0xf7bc15[_0x082e('0xbf')](_0x1bbdcb);}})[_0x082e('0x11')](function(_0x3e95da){if(_0x3e95da){return _0x3e95da?{'count':_0x404732,'rows':_0x3e95da}:null;}})[_0x082e('0x11')](respondWithResult(_0x33e52e,null))[_0x082e('0x1b')](handleError(_0x33e52e,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 4fccdc4..25fff70 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 _0x620b=['../../mysqldb','MailAccount','emit','hook','exports','events'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x620b,0x167));var _0xb620=function(_0x1aa689,_0x4ddd88){_0x1aa689=_0x1aa689-0x0;var _0x3839a8=_0x620b[_0x1aa689];return _0x3839a8;};'use strict';var EventEmitter=require(_0xb620('0x0'));var MailAccount=require(_0xb620('0x1'))['db'][_0xb620('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1b4a54){return function(_0x4f7e01,_0x1b9eda,_0x54bf79){MailAccountEvents['emit'](_0x1b4a54+':'+_0x4f7e01['id'],_0x4f7e01);MailAccountEvents[_0xb620('0x3')](_0x1b4a54,_0x4f7e01);_0x54bf79(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0xb620('0x4')](e,emitEvent(event));}}module[_0xb620('0x5')]=MailAccountEvents; \ No newline at end of file +var _0xe683=['exports','events','../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit','hook'];(function(_0x33b271,_0x350f85){var _0x19e353=function(_0x547b75){while(--_0x547b75){_0x33b271['push'](_0x33b271['shift']());}};_0x19e353(++_0x350f85);}(_0xe683,0x1d7));var _0x3e68=function(_0x2198f9,_0x9754b2){_0x2198f9=_0x2198f9-0x0;var _0x5ae31e=_0xe683[_0x2198f9];return _0x5ae31e;};'use strict';var EventEmitter=require(_0x3e68('0x0'));var MailAccount=require(_0x3e68('0x1'))['db'][_0x3e68('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x3e68('0x3')](0x0);var events={'afterCreate':_0x3e68('0x4'),'afterUpdate':_0x3e68('0x5'),'afterDestroy':_0x3e68('0x6')};function emitEvent(_0x691762){return function(_0x30a2a1,_0x4fe031,_0x512275){MailAccountEvents[_0x3e68('0x7')](_0x691762+':'+_0x30a2a1['id'],_0x30a2a1);MailAccountEvents[_0x3e68('0x7')](_0x691762,_0x30a2a1);_0x512275(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x3e68('0x8')](e,emitEvent(event));}}module[_0x3e68('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 3722c73..7e3b811 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 _0x6494=['MailAccount','mail_accounts','provider','custom','port','secure','Smtp','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','user','CloudProvider','data5','auth','pass','./mailAccount.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6494,0x185));var _0x4649=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6494[_0x20a584];return _0x4b41a8;};'use strict';var attributes=require(_0x4649('0x0'));module[_0x4649('0x1')]=function(_0x321fb4){return _0x321fb4['define'](_0x4649('0x2'),attributes,{'tableName':_0x4649('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x3e51d4=this;var _0x52be4a={'id':_0x3e51d4['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3e51d4[_0x4649('0x4')]!==_0x4649('0x5')){_0x52be4a['service']=_0x3e51d4[_0x4649('0x4')];}else{_0x52be4a['host']=_0x3e51d4['Smtp']['host'];_0x52be4a[_0x4649('0x6')]=_0x3e51d4['Smtp'][_0x4649('0x6')];_0x52be4a[_0x4649('0x7')]=_0x3e51d4[_0x4649('0x8')][_0x4649('0x7')];}if(_0x3e51d4[_0x4649('0x8')][_0x4649('0x9')]){if(_0x3e51d4[_0x4649('0x8')][_0x4649('0xa')]){if(!_0x3e51d4[_0x4649('0x8')]['CloudProvider'])throw new Error(_0x4649('0xb'));_0x52be4a['auth']={'type':'OAuth2','user':_0x3e51d4[_0x4649('0x8')][_0x4649('0xc')],'accessToken':_0x3e51d4[_0x4649('0x8')][_0x4649('0xd')][_0x4649('0xe')]};}else{_0x52be4a[_0x4649('0xf')]={'user':_0x3e51d4['Smtp']['user'],'pass':_0x3e51d4[_0x4649('0x8')][_0x4649('0x10')]};}}return _0x52be4a;}}});}; \ No newline at end of file +var _0x7592=['service','Smtp','host','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','pass','./mailAccount.attributes','exports','define','mail_accounts','provider','custom'];(function(_0x1de88e,_0x2fa517){var _0x12ac65=function(_0x25988b){while(--_0x25988b){_0x1de88e['push'](_0x1de88e['shift']());}};_0x12ac65(++_0x2fa517);}(_0x7592,0x19e));var _0x2759=function(_0x372515,_0xdd11f){_0x372515=_0x372515-0x0;var _0xa3bf4e=_0x7592[_0x372515];return _0xa3bf4e;};'use strict';var attributes=require(_0x2759('0x0'));module[_0x2759('0x1')]=function(_0x219e69){return _0x219e69[_0x2759('0x2')]('MailAccount',attributes,{'tableName':_0x2759('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x4a212c=this;var _0x37eef8={'id':_0x4a212c['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4a212c[_0x2759('0x4')]!==_0x2759('0x5')){_0x37eef8[_0x2759('0x6')]=_0x4a212c['provider'];}else{_0x37eef8['host']=_0x4a212c[_0x2759('0x7')][_0x2759('0x8')];_0x37eef8['port']=_0x4a212c[_0x2759('0x7')][_0x2759('0x9')];_0x37eef8[_0x2759('0xa')]=_0x4a212c[_0x2759('0x7')]['secure'];}if(_0x4a212c['Smtp'][_0x2759('0xb')]){if(_0x4a212c[_0x2759('0x7')][_0x2759('0xc')]){if(!_0x4a212c[_0x2759('0x7')][_0x2759('0xd')])throw new Error(_0x2759('0xe'));_0x37eef8[_0x2759('0xf')]={'type':_0x2759('0x10'),'user':_0x4a212c['Smtp'][_0x2759('0x11')],'accessToken':_0x4a212c['Smtp'][_0x2759('0xd')][_0x2759('0x12')]};}else{_0x37eef8[_0x2759('0xf')]={'user':_0x4a212c[_0x2759('0x7')][_0x2759('0x11')],'pass':_0x4a212c[_0x2759('0x7')][_0x2759('0x13')]};}}return _0x37eef8;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index f684828..0804378 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 _0x3c17=['findAll','options','raw','attributes','limit','include','model','map','ShowMailAccount','where','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','difference','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','from','find','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','omit','applications','list','asc','close','autoclose','length','CmContact','contact','messageId','generate','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','subject','format','interaction','created','attachments','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','User','name','UserId','waitForTheAssignedAgent','*,*,*,*','queueId','MailQueue','waitForTheAssignedQueue','Start','startRouting','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetMailAccount','MailAccount'];(function(_0x25c4f6,_0x1d79a6){var _0x1279a7=function(_0x50102f){while(--_0x50102f){_0x25c4f6['push'](_0x25c4f6['shift']());}};_0x1279a7(++_0x1d79a6);}(_0x3c17,0x1a1));var _0x73c1=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x3c17[_0x31cb5f];return _0x586042;};'use strict';var _=require(_0x73c1('0x0'));var moment=require('moment');var BPromise=require(_0x73c1('0x1'));var rs=require('randomstring');var Redis=require(_0x73c1('0x2'));var db=require(_0x73c1('0x3'))['db'];var logger=require(_0x73c1('0x4'))('rpc');var config=require(_0x73c1('0x5'));var jayson=require(_0x73c1('0x6'));var client=jayson[_0x73c1('0x7')][_0x73c1('0x8')]({'port':0x232c});config['redis']=_[_0x73c1('0x9')](config['redis'],{'host':_0x73c1('0xa'),'port':0x18eb});var socket=require(_0x73c1('0xb'))(new Redis(config[_0x73c1('0xc')]));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0x176227,_0x2eb6fe,_0x400875){return new BPromise(function(_0x16c774,_0x2b2578){return client[_0x73c1('0xd')](_0x176227,_0x400875)[_0x73c1('0xe')](function(_0x4e5bc6){logger['info'](_0x73c1('0xf'),_0x2eb6fe,_0x73c1('0x10'));logger[_0x73c1('0x11')](_0x73c1('0x12'),_0x2eb6fe,'request\x20sent',JSON[_0x73c1('0x13')](_0x4e5bc6));if(_0x4e5bc6['error']){if(_0x4e5bc6[_0x73c1('0x14')]['code']===0x1f4){logger[_0x73c1('0x14')](_0x73c1('0xf'),_0x2eb6fe,_0x4e5bc6['error']['message']);return _0x2b2578(_0x4e5bc6[_0x73c1('0x14')]['message']);}logger[_0x73c1('0x14')]('MailAccount,\x20%s,\x20%s',_0x2eb6fe,_0x4e5bc6[_0x73c1('0x14')]['message']);return _0x16c774(_0x4e5bc6[_0x73c1('0x14')][_0x73c1('0x15')]);}else{logger[_0x73c1('0x16')](_0x73c1('0xf'),_0x2eb6fe,_0x73c1('0x10'));_0x16c774(_0x4e5bc6[_0x73c1('0x17')][_0x73c1('0x15')]);}})[_0x73c1('0x18')](function(_0x1ce19e){logger['error'](_0x73c1('0xf'),_0x2eb6fe,_0x1ce19e);_0x2b2578(_0x1ce19e);});});}exports[_0x73c1('0x19')]=function(_0x28df60){var _0x121bef=this;return new Promise(function(_0x4b1b94,_0x3fbaea){return db[_0x73c1('0x1a')][_0x73c1('0x1b')]({'raw':_0x28df60[_0x73c1('0x1c')]?_0x28df60[_0x73c1('0x1c')][_0x73c1('0x1d')]===undefined?!![]:![]:!![],'where':_0x28df60[_0x73c1('0x1c')]?_0x28df60[_0x73c1('0x1c')]['where']||null:null,'attributes':_0x28df60[_0x73c1('0x1c')]?_0x28df60[_0x73c1('0x1c')][_0x73c1('0x1e')]||null:null,'limit':_0x28df60['options']?_0x28df60[_0x73c1('0x1c')][_0x73c1('0x1f')]||null:null,'include':_0x28df60[_0x73c1('0x1c')]?_0x28df60[_0x73c1('0x1c')][_0x73c1('0x20')]?_['map'](_0x28df60[_0x73c1('0x1c')]['include'],function(_0x54feeb){return{'model':db[_0x54feeb[_0x73c1('0x21')]],'as':_0x54feeb['as'],'attributes':_0x54feeb[_0x73c1('0x1e')],'include':_0x54feeb[_0x73c1('0x20')]?_[_0x73c1('0x22')](_0x54feeb[_0x73c1('0x20')],function(_0x30ec73){return{'model':db[_0x30ec73[_0x73c1('0x21')]],'as':_0x30ec73['as'],'attributes':_0x30ec73[_0x73c1('0x1e')],'include':_0x30ec73[_0x73c1('0x20')]?_[_0x73c1('0x22')](_0x30ec73[_0x73c1('0x20')],function(_0x460b69){return{'model':db[_0x460b69[_0x73c1('0x21')]],'as':_0x460b69['as'],'attributes':_0x460b69[_0x73c1('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b2996){logger[_0x73c1('0x16')](_0x73c1('0x19'),_0x28df60);logger[_0x73c1('0x11')](_0x73c1('0x19'),_0x28df60,JSON[_0x73c1('0x13')](_0x2b2996));_0x4b1b94(_0x2b2996);})[_0x73c1('0x18')](function(_0x45c411){logger[_0x73c1('0x14')]('GetMailAccount',_0x45c411['message'],_0x28df60);_0x3fbaea(_0x121bef[_0x73c1('0x14')](0x1f4,_0x45c411[_0x73c1('0x15')]));});});};exports[_0x73c1('0x23')]=function(_0x2a9ff8){var _0x52a05e=this;return new Promise(function(_0x3e54b2,_0x11432d){return db[_0x73c1('0x1a')]['find']({'raw':_0x2a9ff8[_0x73c1('0x1c')]?_0x2a9ff8[_0x73c1('0x1c')][_0x73c1('0x1d')]===undefined?!![]:![]:!![],'where':_0x2a9ff8[_0x73c1('0x1c')]?_0x2a9ff8[_0x73c1('0x1c')][_0x73c1('0x24')]||null:null,'attributes':_0x2a9ff8['options']?_0x2a9ff8[_0x73c1('0x1c')][_0x73c1('0x1e')]||null:null,'include':_0x2a9ff8[_0x73c1('0x1c')]?_0x2a9ff8[_0x73c1('0x1c')][_0x73c1('0x20')]?_[_0x73c1('0x22')](_0x2a9ff8[_0x73c1('0x1c')][_0x73c1('0x20')],function(_0x3103ec){return{'model':db[_0x3103ec[_0x73c1('0x21')]],'as':_0x3103ec['as'],'attributes':_0x3103ec['attributes'],'include':_0x3103ec[_0x73c1('0x20')]?_['map'](_0x3103ec[_0x73c1('0x20')],function(_0x25e2f6){return{'model':db[_0x25e2f6[_0x73c1('0x21')]],'as':_0x25e2f6['as'],'attributes':_0x25e2f6[_0x73c1('0x1e')],'include':_0x25e2f6['include']?_['map'](_0x25e2f6['include'],function(_0x26ab79){return{'model':db[_0x26ab79['model']],'as':_0x26ab79['as'],'attributes':_0x26ab79[_0x73c1('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x73c1('0xe')](function(_0x2dcdc4){if(_0x2a9ff8[_0x73c1('0x1c')][_0x73c1('0x25')]===!![])_0x2dcdc4[_0x73c1('0x26')](_0x73c1('0x27'),_0x2dcdc4[_0x73c1('0x28')]());logger[_0x73c1('0x16')](_0x73c1('0x23'),_0x2a9ff8);logger[_0x73c1('0x11')]('ShowMailAccount',_0x2a9ff8,JSON[_0x73c1('0x13')](_0x2dcdc4));_0x3e54b2(_0x2dcdc4);})[_0x73c1('0x18')](function(_0x4728e2){logger[_0x73c1('0x14')](_0x73c1('0x23'),_0x4728e2[_0x73c1('0x15')],_0x2a9ff8);_0x11432d(_0x52a05e['error'](0x1f4,_0x4728e2[_0x73c1('0x15')]));});});};exports[_0x73c1('0x29')]=function(_0x3c6b35){var _0x2411bb=this;return new Promise(function(_0x21feb9,_0x20668f){var _0x4d87fb={'body':_0x3c6b35[_0x73c1('0x2a')],'channel':'mail'};var _0x3fdc4f=_[_0x73c1('0x2b')](_['keys'](db['CmContact'][_0x73c1('0x2c')]),[_0x73c1('0x2d'),_0x73c1('0x2e'),_0x73c1('0x2f'),_0x73c1('0x30')]);var _0x282b73=![];if(_0x3c6b35['body']['id']){delete _0x3c6b35['body']['id'];}if(_[_0x73c1('0x31')](_0x3c6b35[_0x73c1('0x2a')]['from'])){return _0x20668f(_0x2411bb['error'](0x1f4,_0x73c1('0x32')));}if(_['isNil'](_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x2a')])||_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x2a')]===''){return _0x20668f(_0x2411bb[_0x73c1('0x14')](0x1f4,_0x73c1('0x33')));}if(_[_0x73c1('0x31')](_0x3c6b35[_0x73c1('0x2a')]['mapKey'])){return _0x20668f(_0x2411bb['error'](0x1f4,_0x73c1('0x34')+_0x3fdc4f));}if(!_[_0x73c1('0x35')](_0x3fdc4f,_0x3c6b35[_0x73c1('0x2a')]['mapKey'])){return _0x20668f(_0x2411bb[_0x73c1('0x14')](0x1f4,_0x73c1('0x36')+_0x3fdc4f));}var _0x3c504d={};_0x3c504d[_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x37')]]=_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x38')];return db[_0x73c1('0x1a')][_0x73c1('0x39')]({'where':{'id':_0x3c6b35[_0x73c1('0x3a')]['id']},'include':[{'model':db[_0x73c1('0x3b')],'as':_0x73c1('0x3c'),'include':[{'model':db['CmContact'],'as':_0x73c1('0x3d'),'where':_0x3c504d,'limit':0x1,'order':[['updatedAt',_0x73c1('0x3e')]]}]},{'model':db[_0x73c1('0x3f')],'as':_0x73c1('0x40')},{'model':db[_0x73c1('0x41')],'as':_0x73c1('0x42'),'include':[{'model':db[_0x73c1('0x43')],'as':'CloudProvider'}]}]})[_0x73c1('0xe')](function(_0x2ccd11){if(_0x2ccd11&&_0x2ccd11[_0x73c1('0x3c')]){var _0x4c1f5f=_0x2ccd11[_0x73c1('0x44')]({'plain':!![]});_0x4d87fb[_0x73c1('0x3a')]=_[_0x73c1('0x45')](_0x4c1f5f,[_0x73c1('0x40'),_0x73c1('0x3c')]);_0x4d87fb[_0x73c1('0x3a')][_0x73c1('0x27')]=_0x2ccd11[_0x73c1('0x28')]();_0x4d87fb[_0x73c1('0x46')]=_0x4c1f5f['Applications'];_0x4d87fb[_0x73c1('0x47')]=_0x4c1f5f['List'];_0x4d87fb['applications']=_['orderBy'](_0x4d87fb['applications'],['priority'],[_0x73c1('0x48')]);if(_0x4d87fb['account']&&_0x4d87fb[_0x73c1('0x3a')]['autoclose']){_0x4d87fb['applications']['push']({'id':0x0,'priority':_0x4d87fb[_0x73c1('0x46')]['length']+0x1,'app':_0x73c1('0x49'),'appdata':_0x73c1('0x4a'),'interval':'*,*,*,*'});}if(_0x4d87fb[_0x73c1('0x3a')][_0x73c1('0x40')]){delete _0x4d87fb[_0x73c1('0x3a')][_0x73c1('0x40')];}if(_0x4d87fb[_0x73c1('0x3a')][_0x73c1('0x3c')]){delete _0x4d87fb[_0x73c1('0x3a')][_0x73c1('0x3c')];}if(_0x4c1f5f[_0x73c1('0x3c')][_0x73c1('0x3d')][_0x73c1('0x4b')]){return _0x4c1f5f[_0x73c1('0x3c')][_0x73c1('0x3d')][0x0];}var _0x2cb41b=_[_0x73c1('0x9')](_0x3c6b35[_0x73c1('0x2a')],{'firstName':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x38')],'ListId':_0x4c1f5f[_0x73c1('0x30')]});_0x2cb41b[_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x37')]]=_0x3c6b35['body']['from'];return db[_0x73c1('0x4c')]['create'](_0x2cb41b);}else{throw new Error('List\x20not\x20found');}})[_0x73c1('0xe')](function(_0x854ef6){_0x4d87fb[_0x73c1('0x4d')]=_0x854ef6;if(_0x854ef6){if(!_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')][_0x73c1('0x4e')]){_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')][_0x73c1('0x4e')]=rs[_0x73c1('0x4f')]()+'\x20'+_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')]['from'];}var _0x385817={'ContactId':_0x854ef6['id'],'MailAccountId':_0x3c6b35[_0x73c1('0x3a')]['id'],'inReplyTo':_0x3c6b35[_0x73c1('0x2a')]['message'][_0x73c1('0x4e')],'to':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')]['from'],'cc':_0x3c6b35['body']['message']['cc'],'subject':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')]['subject'],'attach':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')][_0x73c1('0x50')],'lastMsgAt':moment()['format'](_0x73c1('0x51')),'lastMsgDirection':'in'};return db[_0x73c1('0x52')][_0x73c1('0x39')]({'where':{'closed':![],'MailAccountId':_0x3c6b35[_0x73c1('0x3a')]['id']},'include':[{'model':db[_0x73c1('0x53')],'as':_0x73c1('0x54'),'attributes':[_0x73c1('0x4e')],'where':{'messageId':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')][_0x73c1('0x55')]}}]})[_0x73c1('0xe')](function(_0x1575f4){if(_0x1575f4){return[_0x1575f4,![]];}return db[_0x73c1('0x52')]['create'](_0x385817)[_0x73c1('0xe')](function(_0x5517e3){return[_0x5517e3,!![]];});});}else{throw new Error(_0x73c1('0x56'));}})[_0x73c1('0x57')](function(_0x595086,_0x2295c5){if(_0x595086){_0x282b73=_0x2295c5;if(!_0x2295c5){return _0x595086[_0x73c1('0x58')]({'inReplyTo':_0x3c6b35['body'][_0x73c1('0x15')]['messageId'],'to':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')][_0x73c1('0x38')],'cc':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')]['cc'],'subject':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')][_0x73c1('0x59')],'attach':_0x595086[_0x73c1('0x50')]?_0x595086[_0x73c1('0x50')]:_0x3c6b35['body'][_0x73c1('0x15')][_0x73c1('0x50')],'substatus':null,'substatusAt':moment()[_0x73c1('0x5a')](_0x73c1('0x51')),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x595086;}}})[_0x73c1('0xe')](function(_0x466f4d){_0x4d87fb[_0x73c1('0x5b')]=_0x466f4d[_0x73c1('0x44')]({'plain':!![]});_0x4d87fb[_0x73c1('0x5b')][_0x73c1('0x5c')]=_0x282b73;return db[_0x73c1('0x53')]['create']({'body':_0x3c6b35[_0x73c1('0x2a')]['body'],'MailAccountId':_0x3c6b35[_0x73c1('0x3a')]['id'],'MailInteractionId':_0x466f4d['id'],'direction':'in','ContactId':_0x4d87fb[_0x73c1('0x4d')]['id'],'messageId':_0x3c6b35['body'][_0x73c1('0x15')][_0x73c1('0x4e')],'from':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')]['from'],'to':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')]['to'],'cc':_0x3c6b35['body']['message']['cc'],'subject':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')]['subject'],'attach':_0x3c6b35['body'][_0x73c1('0x15')][_0x73c1('0x50')],'Attachments':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')][_0x73c1('0x5d')],'originTo':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')]['originTo'],'originCc':_0x3c6b35['body'][_0x73c1('0x15')][_0x73c1('0x5e')],'bcc':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')]['bcc'],'ChatWebsiteId':_0x3c6b35['body'][_0x73c1('0x15')][_0x73c1('0x5f')]||null,'originChannel':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')][_0x73c1('0x60')]||_0x73c1('0x61'),'ChatOfflineMessageId':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')][_0x73c1('0x62')]||null},{'include':[{'model':db[_0x73c1('0x63')],'as':_0x73c1('0x64')}]});})[_0x73c1('0xe')](function(_0xa8ed18){_0x4d87fb[_0x73c1('0x15')]=_0xa8ed18;if(!_0x4d87fb[_0x73c1('0x5b')]['UserId']){return;}return db[_0x73c1('0x65')]['find']({'attributes':['id',_0x73c1('0x66')],'where':{'id':_0x4d87fb['interaction'][_0x73c1('0x67')]}});})[_0x73c1('0xe')](function(_0x3ae4d7){if(_0x3ae4d7){_0x4d87fb[_0x73c1('0x46')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3ae4d7[_0x73c1('0x66')]+','+(_0x4d87fb[_0x73c1('0x3a')][_0x73c1('0x68')]||0xa),'interval':_0x73c1('0x69')});}if(!_0x4d87fb[_0x73c1('0x5b')][_0x73c1('0x6a')]){return;}return db[_0x73c1('0x6b')][_0x73c1('0x39')]({'attributes':['id',_0x73c1('0x66')],'where':{'id':_0x4d87fb['interaction'][_0x73c1('0x6a')]}});})[_0x73c1('0xe')](function(_0x281310){if(_0x281310){_0x4d87fb[_0x73c1('0x46')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x281310[_0x73c1('0x66')]+','+(_0x4d87fb[_0x73c1('0x3a')][_0x73c1('0x6c')]||0x12c),'interval':_0x73c1('0x69')});}return respondWithRpcPromise(_0x73c1('0x6d'),_0x73c1('0x6e'),_0x4d87fb);})[_0x73c1('0xe')](function(_0x5458e1){_0x21feb9(_0x5458e1);})[_0x73c1('0x18')](function(_0x1040b4){_0x20668f(_0x2411bb[_0x73c1('0x14')](0x1f4,_0x1040b4[_0x73c1('0x15')]));});});}; \ No newline at end of file +var _0xae30=['asc','autoclose','push','length','*,*,*,*','from','create','List\x20not\x20found','contact','messageId','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','spread','update','attach','interaction','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','Attachment','UserId','User','name','unshift','agent','waitForTheAssignedAgent','MailQueue','queueId','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','info','MailAccount,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','GetMailAccount','options','raw','where','limit','include','model','attributes','map','then','debug','ShowMailAccount','MailAccount','find','smtp','setDataValue','getSmtpOptions','NotifyMailAccount','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','body','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','account','omit','applications','list','orderBy','priority'];(function(_0x1e42eb,_0xa7cde){var _0x44e37b=function(_0x3e1227){while(--_0x3e1227){_0x1e42eb['push'](_0x1e42eb['shift']());}};_0x44e37b(++_0xa7cde);}(_0xae30,0x10a));var _0x0ae3=function(_0x48c841,_0x27374a){_0x48c841=_0x48c841-0x0;var _0x22c86f=_0xae30[_0x48c841];return _0x22c86f;};'use strict';var _=require(_0x0ae3('0x0'));var moment=require(_0x0ae3('0x1'));var BPromise=require(_0x0ae3('0x2'));var rs=require('randomstring');var Redis=require(_0x0ae3('0x3'));var db=require(_0x0ae3('0x4'))['db'];var logger=require(_0x0ae3('0x5'))(_0x0ae3('0x6'));var config=require('../../config/environment');var jayson=require(_0x0ae3('0x7'));var client=jayson[_0x0ae3('0x8')][_0x0ae3('0x9')]({'port':0x232c});config[_0x0ae3('0xa')]=_[_0x0ae3('0xb')](config[_0x0ae3('0xa')],{'host':_0x0ae3('0xc'),'port':0x18eb});var socket=require(_0x0ae3('0xd'))(new Redis(config[_0x0ae3('0xa')]));require(_0x0ae3('0xe'))[_0x0ae3('0xf')](socket);function respondWithRpcPromise(_0x22566f,_0x32ca2c,_0x49e0a5){return new BPromise(function(_0x98ab46,_0xee8a4c){return client['request'](_0x22566f,_0x49e0a5)['then'](function(_0x59cf73){logger[_0x0ae3('0x10')](_0x0ae3('0x11'),_0x32ca2c,_0x0ae3('0x12'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x32ca2c,_0x0ae3('0x12'),JSON[_0x0ae3('0x13')](_0x59cf73));if(_0x59cf73['error']){if(_0x59cf73['error'][_0x0ae3('0x14')]===0x1f4){logger['error'](_0x0ae3('0x11'),_0x32ca2c,_0x59cf73[_0x0ae3('0x15')][_0x0ae3('0x16')]);return _0xee8a4c(_0x59cf73[_0x0ae3('0x15')][_0x0ae3('0x16')]);}logger[_0x0ae3('0x15')](_0x0ae3('0x11'),_0x32ca2c,_0x59cf73['error'][_0x0ae3('0x16')]);return _0x98ab46(_0x59cf73['error'][_0x0ae3('0x16')]);}else{logger[_0x0ae3('0x10')](_0x0ae3('0x11'),_0x32ca2c,_0x0ae3('0x12'));_0x98ab46(_0x59cf73[_0x0ae3('0x17')][_0x0ae3('0x16')]);}})[_0x0ae3('0x18')](function(_0x1bf406){logger[_0x0ae3('0x15')]('MailAccount,\x20%s,\x20%s',_0x32ca2c,_0x1bf406);_0xee8a4c(_0x1bf406);});});}exports[_0x0ae3('0x19')]=function(_0x4b8949){var _0x49d4b7=this;return new Promise(function(_0x571135,_0x4ac074){return db['MailAccount']['findAll']({'raw':_0x4b8949['options']?_0x4b8949[_0x0ae3('0x1a')][_0x0ae3('0x1b')]===undefined?!![]:![]:!![],'where':_0x4b8949[_0x0ae3('0x1a')]?_0x4b8949['options'][_0x0ae3('0x1c')]||null:null,'attributes':_0x4b8949['options']?_0x4b8949[_0x0ae3('0x1a')]['attributes']||null:null,'limit':_0x4b8949['options']?_0x4b8949['options'][_0x0ae3('0x1d')]||null:null,'include':_0x4b8949[_0x0ae3('0x1a')]?_0x4b8949[_0x0ae3('0x1a')]['include']?_['map'](_0x4b8949[_0x0ae3('0x1a')][_0x0ae3('0x1e')],function(_0x5a76e5){return{'model':db[_0x5a76e5[_0x0ae3('0x1f')]],'as':_0x5a76e5['as'],'attributes':_0x5a76e5[_0x0ae3('0x20')],'include':_0x5a76e5[_0x0ae3('0x1e')]?_['map'](_0x5a76e5[_0x0ae3('0x1e')],function(_0x1f9cde){return{'model':db[_0x1f9cde[_0x0ae3('0x1f')]],'as':_0x1f9cde['as'],'attributes':_0x1f9cde['attributes'],'include':_0x1f9cde[_0x0ae3('0x1e')]?_[_0x0ae3('0x21')](_0x1f9cde[_0x0ae3('0x1e')],function(_0x59a265){return{'model':db[_0x59a265[_0x0ae3('0x1f')]],'as':_0x59a265['as'],'attributes':_0x59a265[_0x0ae3('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0ae3('0x22')](function(_0x152876){logger[_0x0ae3('0x10')](_0x0ae3('0x19'),_0x4b8949);logger[_0x0ae3('0x23')](_0x0ae3('0x19'),_0x4b8949,JSON[_0x0ae3('0x13')](_0x152876));_0x571135(_0x152876);})[_0x0ae3('0x18')](function(_0x4032f4){logger[_0x0ae3('0x15')](_0x0ae3('0x19'),_0x4032f4[_0x0ae3('0x16')],_0x4b8949);_0x4ac074(_0x49d4b7[_0x0ae3('0x15')](0x1f4,_0x4032f4['message']));});});};exports[_0x0ae3('0x24')]=function(_0x25ec0d){var _0x34480d=this;return new Promise(function(_0x39886e,_0x5243da){return db[_0x0ae3('0x25')][_0x0ae3('0x26')]({'raw':_0x25ec0d[_0x0ae3('0x1a')]?_0x25ec0d[_0x0ae3('0x1a')][_0x0ae3('0x1b')]===undefined?!![]:![]:!![],'where':_0x25ec0d[_0x0ae3('0x1a')]?_0x25ec0d['options'][_0x0ae3('0x1c')]||null:null,'attributes':_0x25ec0d[_0x0ae3('0x1a')]?_0x25ec0d[_0x0ae3('0x1a')][_0x0ae3('0x20')]||null:null,'include':_0x25ec0d[_0x0ae3('0x1a')]?_0x25ec0d[_0x0ae3('0x1a')][_0x0ae3('0x1e')]?_['map'](_0x25ec0d['options'][_0x0ae3('0x1e')],function(_0x45ac7d){return{'model':db[_0x45ac7d[_0x0ae3('0x1f')]],'as':_0x45ac7d['as'],'attributes':_0x45ac7d['attributes'],'include':_0x45ac7d['include']?_[_0x0ae3('0x21')](_0x45ac7d[_0x0ae3('0x1e')],function(_0x1ef996){return{'model':db[_0x1ef996[_0x0ae3('0x1f')]],'as':_0x1ef996['as'],'attributes':_0x1ef996[_0x0ae3('0x20')],'include':_0x1ef996[_0x0ae3('0x1e')]?_[_0x0ae3('0x21')](_0x1ef996['include'],function(_0x1453aa){return{'model':db[_0x1453aa[_0x0ae3('0x1f')]],'as':_0x1453aa['as'],'attributes':_0x1453aa[_0x0ae3('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c7adf){if(_0x25ec0d['options'][_0x0ae3('0x27')]===!![])_0x4c7adf[_0x0ae3('0x28')]('smtpOptions',_0x4c7adf[_0x0ae3('0x29')]());logger[_0x0ae3('0x10')](_0x0ae3('0x24'),_0x25ec0d);logger['debug'](_0x0ae3('0x24'),_0x25ec0d,JSON['stringify'](_0x4c7adf));_0x39886e(_0x4c7adf);})[_0x0ae3('0x18')](function(_0x1626e1){logger['error'](_0x0ae3('0x24'),_0x1626e1[_0x0ae3('0x16')],_0x25ec0d);_0x5243da(_0x34480d[_0x0ae3('0x15')](0x1f4,_0x1626e1[_0x0ae3('0x16')]));});});};exports[_0x0ae3('0x2a')]=function(_0x53eda3){var _0x5298aa=this;return new Promise(function(_0x2e95e5,_0x334163){var _0x5c6874={'body':_0x53eda3['body'],'channel':'mail'};var _0x5b006c=_[_0x0ae3('0x2b')](_[_0x0ae3('0x2c')](db[_0x0ae3('0x2d')][_0x0ae3('0x2e')]),[_0x0ae3('0x2f'),_0x0ae3('0x30'),_0x0ae3('0x31'),_0x0ae3('0x32')]);var _0x2cfc16=![];if(_0x53eda3[_0x0ae3('0x33')]['id']){delete _0x53eda3['body']['id'];}if(_[_0x0ae3('0x34')](_0x53eda3[_0x0ae3('0x33')]['from'])){return _0x334163(_0x5298aa[_0x0ae3('0x15')](0x1f4,_0x0ae3('0x35')));}if(_[_0x0ae3('0x34')](_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x33')])||_0x53eda3['body'][_0x0ae3('0x33')]===''){return _0x334163(_0x5298aa[_0x0ae3('0x15')](0x1f4,_0x0ae3('0x36')));}if(_[_0x0ae3('0x34')](_0x53eda3['body'][_0x0ae3('0x37')])){return _0x334163(_0x5298aa[_0x0ae3('0x15')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5b006c));}if(!_[_0x0ae3('0x38')](_0x5b006c,_0x53eda3[_0x0ae3('0x33')]['mapKey'])){return _0x334163(_0x5298aa['error'](0x1f4,_0x0ae3('0x39')+_0x5b006c));}var _0x21b49f={};_0x21b49f[_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x37')]]=_0x53eda3[_0x0ae3('0x33')]['from'];return db['MailAccount'][_0x0ae3('0x26')]({'where':{'id':_0x53eda3['account']['id']},'include':[{'model':db[_0x0ae3('0x3a')],'as':_0x0ae3('0x3b'),'include':[{'model':db['CmContact'],'as':_0x0ae3('0x3c'),'where':_0x21b49f,'limit':0x1,'order':[[_0x0ae3('0x30'),'DESC']]}]},{'model':db[_0x0ae3('0x3d')],'as':_0x0ae3('0x3e')},{'model':db[_0x0ae3('0x3f')],'as':_0x0ae3('0x40'),'include':[{'model':db[_0x0ae3('0x41')],'as':'CloudProvider'}]}]})[_0x0ae3('0x22')](function(_0x53393b){if(_0x53393b&&_0x53393b[_0x0ae3('0x3b')]){var _0x25310c=_0x53393b[_0x0ae3('0x42')]({'plain':!![]});_0x5c6874[_0x0ae3('0x43')]=_[_0x0ae3('0x44')](_0x25310c,[_0x0ae3('0x3e'),_0x0ae3('0x3b')]);_0x5c6874[_0x0ae3('0x43')]['smtpOptions']=_0x53393b[_0x0ae3('0x29')]();_0x5c6874[_0x0ae3('0x45')]=_0x25310c[_0x0ae3('0x3e')];_0x5c6874[_0x0ae3('0x46')]=_0x25310c[_0x0ae3('0x3b')];_0x5c6874[_0x0ae3('0x45')]=_[_0x0ae3('0x47')](_0x5c6874[_0x0ae3('0x45')],[_0x0ae3('0x48')],[_0x0ae3('0x49')]);if(_0x5c6874[_0x0ae3('0x43')]&&_0x5c6874['account'][_0x0ae3('0x4a')]){_0x5c6874['applications'][_0x0ae3('0x4b')]({'id':0x0,'priority':_0x5c6874[_0x0ae3('0x45')][_0x0ae3('0x4c')]+0x1,'app':'close','appdata':'autoclose','interval':_0x0ae3('0x4d')});}if(_0x5c6874['account'][_0x0ae3('0x3e')]){delete _0x5c6874['account'][_0x0ae3('0x3e')];}if(_0x5c6874[_0x0ae3('0x43')]['List']){delete _0x5c6874[_0x0ae3('0x43')][_0x0ae3('0x3b')];}if(_0x25310c[_0x0ae3('0x3b')][_0x0ae3('0x3c')][_0x0ae3('0x4c')]){return _0x25310c['List'][_0x0ae3('0x3c')][0x0];}var _0x4596b5=_['defaults'](_0x53eda3[_0x0ae3('0x33')],{'firstName':_0x53eda3[_0x0ae3('0x33')]['from'],'ListId':_0x25310c[_0x0ae3('0x32')]});_0x4596b5[_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x37')]]=_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x4e')];return db['CmContact'][_0x0ae3('0x4f')](_0x4596b5);}else{throw new Error(_0x0ae3('0x50'));}})[_0x0ae3('0x22')](function(_0x3d554c){_0x5c6874[_0x0ae3('0x51')]=_0x3d554c;if(_0x3d554c){if(!_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')]['messageId']){_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x52')]=rs['generate']()+'\x20'+_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x4e')];}var _0x3794df={'ContactId':_0x3d554c['id'],'MailAccountId':_0x53eda3[_0x0ae3('0x43')]['id'],'inReplyTo':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')]['messageId'],'to':_0x53eda3[_0x0ae3('0x33')]['message']['from'],'cc':_0x53eda3['body'][_0x0ae3('0x16')]['cc'],'subject':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x53')],'attach':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')]['attach'],'lastMsgAt':moment()[_0x0ae3('0x54')](_0x0ae3('0x55')),'lastMsgDirection':'in'};return db[_0x0ae3('0x56')][_0x0ae3('0x26')]({'where':{'closed':![],'MailAccountId':_0x53eda3[_0x0ae3('0x43')]['id']},'include':[{'model':db['MailMessage'],'as':_0x0ae3('0x57'),'attributes':[_0x0ae3('0x52')],'where':{'messageId':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x58')]}}]})[_0x0ae3('0x22')](function(_0x4f5e27){if(_0x4f5e27){return[_0x4f5e27,![]];}return db['MailInteraction']['create'](_0x3794df)[_0x0ae3('0x22')](function(_0xd07bf7){return[_0xd07bf7,!![]];});});}else{throw new Error(_0x0ae3('0x59'));}})[_0x0ae3('0x5a')](function(_0x4c3808,_0x2f80f2){if(_0x4c3808){_0x2cfc16=_0x2f80f2;if(!_0x2f80f2){return _0x4c3808[_0x0ae3('0x5b')]({'inReplyTo':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x52')],'to':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x4e')],'cc':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')]['cc'],'subject':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x53')],'attach':_0x4c3808['attach']?_0x4c3808[_0x0ae3('0x5c')]:_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x5c')],'substatus':null,'substatusAt':moment()[_0x0ae3('0x54')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x0ae3('0x54')](_0x0ae3('0x55')),'lastMsgDirection':'in'});}else{return _0x4c3808;}}})[_0x0ae3('0x22')](function(_0x5bc332){_0x5c6874[_0x0ae3('0x5d')]=_0x5bc332[_0x0ae3('0x42')]({'plain':!![]});_0x5c6874[_0x0ae3('0x5d')]['created']=_0x2cfc16;return db['MailMessage'][_0x0ae3('0x4f')]({'body':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x33')],'MailAccountId':_0x53eda3['account']['id'],'MailInteractionId':_0x5bc332['id'],'direction':'in','ContactId':_0x5c6874['contact']['id'],'messageId':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x52')],'from':_0x53eda3['body'][_0x0ae3('0x16')]['from'],'to':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')]['to'],'cc':_0x53eda3['body'][_0x0ae3('0x16')]['cc'],'subject':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x53')],'attach':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x5c')],'Attachments':_0x53eda3[_0x0ae3('0x33')]['message'][_0x0ae3('0x5e')],'originTo':_0x53eda3[_0x0ae3('0x33')]['message'][_0x0ae3('0x5f')],'originCc':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x60')],'bcc':_0x53eda3[_0x0ae3('0x33')]['message'][_0x0ae3('0x61')],'ChatWebsiteId':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x62')]||null,'originChannel':_0x53eda3['body'][_0x0ae3('0x16')][_0x0ae3('0x63')]||_0x0ae3('0x64'),'ChatOfflineMessageId':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x0ae3('0x65')],'as':'Attachments'}]});})['then'](function(_0x284dbe){_0x5c6874[_0x0ae3('0x16')]=_0x284dbe;if(!_0x5c6874[_0x0ae3('0x5d')][_0x0ae3('0x66')]){return;}return db[_0x0ae3('0x67')]['find']({'attributes':['id',_0x0ae3('0x68')],'where':{'id':_0x5c6874[_0x0ae3('0x5d')][_0x0ae3('0x66')]}});})[_0x0ae3('0x22')](function(_0x1b94d6){if(_0x1b94d6){_0x5c6874[_0x0ae3('0x45')][_0x0ae3('0x69')]({'id':0x0,'priority':0x0,'app':_0x0ae3('0x6a'),'appdata':_0x1b94d6[_0x0ae3('0x68')]+','+(_0x5c6874[_0x0ae3('0x43')][_0x0ae3('0x6b')]||0xa),'interval':_0x0ae3('0x4d')});}if(!_0x5c6874[_0x0ae3('0x5d')]['queueId']){return;}return db[_0x0ae3('0x6c')][_0x0ae3('0x26')]({'attributes':['id',_0x0ae3('0x68')],'where':{'id':_0x5c6874['interaction'][_0x0ae3('0x6d')]}});})[_0x0ae3('0x22')](function(_0x535ebd){if(_0x535ebd){_0x5c6874[_0x0ae3('0x45')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x535ebd[_0x0ae3('0x68')]+','+(_0x5c6874[_0x0ae3('0x43')][_0x0ae3('0x6e')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x0ae3('0x6f'),_0x0ae3('0x70'),_0x5c6874);})[_0x0ae3('0x22')](function(_0x5d4f97){_0x2e95e5(_0x5d4f97);})['catch'](function(_0x21d3d1){_0x334163(_0x5298aa['error'](0x1f4,_0x21d3d1['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index f8bbcec..c9d472c 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 _0x95a7=['length','./mailAccount.events','save','update','removeListener'];(function(_0x5ccbb8,_0x35cbe3){var _0x318270=function(_0x5cc118){while(--_0x5cc118){_0x5ccbb8['push'](_0x5ccbb8['shift']());}};_0x318270(++_0x35cbe3);}(_0x95a7,0x6a));var _0x795a=function(_0x1e0414,_0x2f755a){_0x1e0414=_0x1e0414-0x0;var _0x84b43=_0x95a7[_0x1e0414];return _0x84b43;};'use strict';var MailAccountEvents=require(_0x795a('0x0'));var events=[_0x795a('0x1'),'remove',_0x795a('0x2')];function createListener(_0x232e15,_0x203a1a){return function(_0x43da53){_0x203a1a['emit'](_0x232e15,_0x43da53);};}function removeListener(_0x16d402,_0x2a87c8){return function(){MailAccountEvents[_0x795a('0x3')](_0x16d402,_0x2a87c8);};}exports['register']=function(_0x1d922d){for(var _0x289f4a=0x0,_0x4de856=events[_0x795a('0x4')];_0x289f4a<_0x4de856;_0x289f4a++){var _0x10da2f=events[_0x289f4a];var _0x559391=createListener('mailAccount:'+_0x10da2f,_0x1d922d);MailAccountEvents['on'](_0x10da2f,_0x559391);}}; \ No newline at end of file +var _0x8aac=['save','remove','update','removeListener','register','length','mailAccount:','./mailAccount.events'];(function(_0x5bf18d,_0x264c55){var _0x1d6cc0=function(_0x2d69d9){while(--_0x2d69d9){_0x5bf18d['push'](_0x5bf18d['shift']());}};_0x1d6cc0(++_0x264c55);}(_0x8aac,0x6f));var _0xc8aa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8aac[_0x3dd15e];return _0x231fd0;};'use strict';var MailAccountEvents=require(_0xc8aa('0x0'));var events=[_0xc8aa('0x1'),_0xc8aa('0x2'),_0xc8aa('0x3')];function createListener(_0x49ec7d,_0x308d24){return function(_0xecafb2){_0x308d24['emit'](_0x49ec7d,_0xecafb2);};}function removeListener(_0x352cdf,_0x8fd3b2){return function(){MailAccountEvents[_0xc8aa('0x4')](_0x352cdf,_0x8fd3b2);};}exports[_0xc8aa('0x5')]=function(_0x4975be){for(var _0x54e1b3=0x0,_0x3862b4=events[_0xc8aa('0x6')];_0x54e1b3<_0x3862b4;_0x54e1b3++){var _0x2f5666=events[_0x54e1b3];var _0x33f5df=createListener(_0xc8aa('0x7')+_0x2f5666,_0x4975be);MailAccountEvents['on'](_0x2f5666,_0x33f5df);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index d0aa0f9..a8fbb1e 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 _0x6feb=['isAuthenticated','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','show'];(function(_0x2c3498,_0x42ec6d){var _0x5d005c=function(_0x2c7609){while(--_0x2c7609){_0x2c3498['push'](_0x2c3498['shift']());}};_0x5d005c(++_0x42ec6d);}(_0x6feb,0x19d));var _0xb6fe=function(_0x4be874,_0x399f04){_0x4be874=_0x4be874-0x0;var _0x147c2a=_0x6feb[_0x4be874];return _0x147c2a;};'use strict';var multer=require('multer');var util=require(_0xb6fe('0x0'));var path=require(_0xb6fe('0x1'));var timeout=require(_0xb6fe('0x2'));var express=require(_0xb6fe('0x3'));var router=express[_0xb6fe('0x4')]();var fs_extra=require(_0xb6fe('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb6fe('0x6'));var config=require(_0xb6fe('0x7'));var controller=require(_0xb6fe('0x8'));router[_0xb6fe('0x9')](_0xb6fe('0xa'),auth['isAuthenticated'](),controller[_0xb6fe('0xb')]);router['put'](_0xb6fe('0xa'),auth[_0xb6fe('0xc')](),controller[_0xb6fe('0xd')]);router[_0xb6fe('0xe')](_0xb6fe('0xa'),auth[_0xb6fe('0xc')](),controller[_0xb6fe('0xf')]);module[_0xb6fe('0x10')]=router; \ No newline at end of file +var _0x351e=['/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailApplication.controller','get','isAuthenticated','put'];(function(_0x5bcef5,_0x935d6d){var _0x2f2e6d=function(_0x13c029){while(--_0x13c029){_0x5bcef5['push'](_0x5bcef5['shift']());}};_0x2f2e6d(++_0x935d6d);}(_0x351e,0x115));var _0xe351=function(_0x56222e,_0x48569f){_0x56222e=_0x56222e-0x0;var _0x373b78=_0x351e[_0x56222e];return _0x373b78;};'use strict';var multer=require(_0xe351('0x0'));var util=require(_0xe351('0x1'));var path=require(_0xe351('0x2'));var timeout=require('connect-timeout');var express=require(_0xe351('0x3'));var router=express[_0xe351('0x4')]();var fs_extra=require(_0xe351('0x5'));var auth=require(_0xe351('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe351('0x7'));var controller=require(_0xe351('0x8'));router[_0xe351('0x9')]('/:id',auth[_0xe351('0xa')](),controller['show']);router[_0xe351('0xb')](_0xe351('0xc'),auth[_0xe351('0xa')](),controller[_0xe351('0xd')]);router[_0xe351('0xe')](_0xe351('0xc'),auth['isAuthenticated'](),controller[_0xe351('0xf')]);module[_0xe351('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 65943e9..1a4a713 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 _0x8d97=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0xdbd4f7,_0x4e3bdd){var _0x5c3f9d=function(_0xa7a35a){while(--_0xa7a35a){_0xdbd4f7['push'](_0xdbd4f7['shift']());}};_0x5c3f9d(++_0x4e3bdd);}(_0x8d97,0x1d4));var _0x78d9=function(_0x3b9791,_0x468e33){_0x3b9791=_0x3b9791-0x0;var _0x18da41=_0x8d97[_0x3b9791];return _0x18da41;};'use strict';var Sequelize=require(_0x78d9('0x0'));module[_0x78d9('0x1')]={'priority':{'type':Sequelize[_0x78d9('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x78d9('0x3')],'allowNull':![],'defaultValue':_0x78d9('0x4')},'appdata':{'type':Sequelize[_0x78d9('0x5')]()},'description':{'type':Sequelize[_0x78d9('0x3')]},'interval':{'type':Sequelize[_0x78d9('0x3')],'defaultValue':_0x78d9('0x6')}}; \ No newline at end of file +var _0xaa93=['*,*,*,*','INTEGER','STRING','noop','TEXT'];(function(_0x26d26f,_0x5ddc55){var _0x142a27=function(_0x22b742){while(--_0x22b742){_0x26d26f['push'](_0x26d26f['shift']());}};_0x142a27(++_0x5ddc55);}(_0xaa93,0x1d7));var _0x3aa9=function(_0x586094,_0x40e039){_0x586094=_0x586094-0x0;var _0x4d4457=_0xaa93[_0x586094];return _0x4d4457;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x3aa9('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x3aa9('0x1')],'allowNull':![],'defaultValue':_0x3aa9('0x2')},'appdata':{'type':Sequelize[_0x3aa9('0x3')]()},'description':{'type':Sequelize[_0x3aa9('0x1')]},'interval':{'type':Sequelize[_0x3aa9('0x1')],'defaultValue':_0x3aa9('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 8d13748..43d9506 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 _0xe706=['limit','count','offset','set','Content-Range','json','apply','save','update','then','end','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','body','catch','destroy','eml-format','rimraf','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined'];(function(_0x285fff,_0x4fb54f){var _0x44e78f=function(_0x1b64c8){while(--_0x1b64c8){_0x285fff['push'](_0x285fff['shift']());}};_0x44e78f(++_0x4fb54f);}(_0xe706,0xa3));var _0x6e70=function(_0x4e65cd,_0x13674b){_0x4e65cd=_0x4e65cd-0x0;var _0x524a1c=_0xe706[_0x4e65cd];return _0x524a1c;};'use strict';var emlformat=require(_0x6e70('0x0'));var rimraf=require(_0x6e70('0x1'));var zipdir=require(_0x6e70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e70('0x3'));var moment=require(_0x6e70('0x4'));var BPromise=require(_0x6e70('0x5'));var Mustache=require(_0x6e70('0x6'));var util=require(_0x6e70('0x7'));var path=require(_0x6e70('0x8'));var sox=require(_0x6e70('0x9'));var csv=require(_0x6e70('0xa'));var ejs=require(_0x6e70('0xb'));var fs=require('fs');var fs_extra=require(_0x6e70('0xc'));var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xa'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var licenseUtil=require(_0x6e70('0x1b'));var db=require(_0x6e70('0x1c'))['db'];function respondWithStatusCode(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xcc;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x1d')](_0x3b38f3);}return _0x27dd9b[_0x6e70('0x1e')](_0x3b38f3)['end']();};}function respondWithResult(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0xc8;return function(_0x257e81){if(_0x257e81){return _0x52737e['status'](_0x48bc72)['json'](_0x257e81);}};}function respondWithFilteredResult(_0x304716,_0x22c50c){return function(_0x5d9263){if(_0x5d9263){var _0x24f3ac=typeof _0x22c50c['offset']===_0x6e70('0x1f')&&typeof _0x22c50c[_0x6e70('0x20')]==='undefined';var _0x49029f=_0x5d9263[_0x6e70('0x21')];var _0x5ea7a5=_0x24f3ac?0x0:_0x22c50c[_0x6e70('0x22')];var _0x173afe=_0x24f3ac?_0x5d9263['count']:_0x22c50c['offset']+_0x22c50c[_0x6e70('0x20')];var _0x208e21;if(_0x173afe>=_0x49029f){_0x173afe=_0x49029f;_0x208e21=0xc8;}else{_0x208e21=0xce;}_0x304716[_0x6e70('0x1e')](_0x208e21);return _0x304716[_0x6e70('0x23')](_0x6e70('0x24'),_0x5ea7a5+'-'+_0x173afe+'/'+_0x49029f)[_0x6e70('0x25')](_0x5d9263);}return null;};}function patchUpdates(_0x1b2453){return function(_0x44a49f){try{jsonpatch[_0x6e70('0x26')](_0x44a49f,_0x1b2453,!![]);}catch(_0xb29a2a){return BPromise['reject'](_0xb29a2a);}return _0x44a49f[_0x6e70('0x27')]();};}function saveUpdates(_0x344b65,_0x27b294){return function(_0x502b2d){if(_0x502b2d){return _0x502b2d[_0x6e70('0x28')](_0x344b65)[_0x6e70('0x29')](function(_0x3337a6){return _0x3337a6;});}return null;};}function removeEntity(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(_0x538b9c){return _0x538b9c['destroy']()['then'](function(){_0x50da2c[_0x6e70('0x1e')](0xcc)[_0x6e70('0x2a')]();});}};}function handleEntityNotFound(_0x51d292,_0x3ecdf1){return function(_0x1196ed){if(!_0x1196ed){_0x51d292['sendStatus'](0x194);}return _0x1196ed;};}function handleError(_0x338ad6,_0x67fb43){_0x67fb43=_0x67fb43||0x1f4;return function(_0x2bb231){logger['error'](_0x2bb231['stack']);if(_0x2bb231[_0x6e70('0x2b')]){delete _0x2bb231[_0x6e70('0x2b')];}_0x338ad6[_0x6e70('0x1e')](_0x67fb43)[_0x6e70('0x2c')](_0x2bb231);};}exports[_0x6e70('0x2d')]=function(_0x5d772a,_0x1952ea){var _0x406f29={'raw':!![],'where':{'id':_0x5d772a[_0x6e70('0x2e')]['id']}},_0xecf336={};_0xecf336[_0x6e70('0x2f')]=_[_0x6e70('0x30')](db[_0x6e70('0x31')][_0x6e70('0x32')]);_0xecf336[_0x6e70('0x33')]=_[_0x6e70('0x30')](_0x5d772a['query']);_0xecf336[_0x6e70('0x34')]=_['intersection'](_0xecf336[_0x6e70('0x2f')],_0xecf336['query']);_0x406f29[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0xecf336[_0x6e70('0x2f')],qs['fields'](_0x5d772a[_0x6e70('0x33')][_0x6e70('0x37')]));_0x406f29['attributes']=_0x406f29[_0x6e70('0x35')][_0x6e70('0x38')]?_0x406f29['attributes']:_0xecf336[_0x6e70('0x2f')];if(_0x5d772a[_0x6e70('0x33')][_0x6e70('0x39')]){_0x406f29[_0x6e70('0x3a')]=[{'all':!![]}];}_0x406f29=_[_0x6e70('0x3b')]({},_0x406f29,_0x5d772a[_0x6e70('0x3c')]);return db[_0x6e70('0x31')][_0x6e70('0x3d')](_0x406f29)[_0x6e70('0x29')](handleEntityNotFound(_0x1952ea,null))[_0x6e70('0x29')](respondWithResult(_0x1952ea,null))['catch'](handleError(_0x1952ea,null));};exports[_0x6e70('0x28')]=function(_0x4795a0,_0x23cd1a){if(_0x4795a0[_0x6e70('0x3e')]['id']){delete _0x4795a0[_0x6e70('0x3e')]['id'];}return db[_0x6e70('0x31')][_0x6e70('0x3d')]({'where':{'id':_0x4795a0[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x23cd1a,null))[_0x6e70('0x29')](saveUpdates(_0x4795a0[_0x6e70('0x3e')],null))[_0x6e70('0x29')](respondWithResult(_0x23cd1a,null))[_0x6e70('0x3f')](handleError(_0x23cd1a,null));};exports[_0x6e70('0x40')]=function(_0x5594d3,_0x501b53){return db['MailApplication']['find']({'where':{'id':_0x5594d3[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x501b53,null))[_0x6e70('0x29')](removeEntity(_0x501b53,null))[_0x6e70('0x3f')](handleError(_0x501b53,null));}; \ No newline at end of file +var _0x9c44=['Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','merge','options','find','then','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x56f3d4,_0xfc65dd){var _0x2c7ef0=function(_0x587024){while(--_0x587024){_0x56f3d4['push'](_0x56f3d4['shift']());}};_0x2c7ef0(++_0xfc65dd);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={'raw':!![],'where':{'id':_0x5987ae[_0x49c4('0x29')]['id']}},_0x46e04d={};_0x46e04d[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](db[_0x49c4('0x2c')][_0x49c4('0x2d')]);_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2b')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d['filters']=_['intersection'](_0x46e04d['model'],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x2f')]=_[_0x49c4('0x30')](_0x46e04d[_0x49c4('0x2a')],qs[_0x49c4('0x31')](_0x5987ae['query'][_0x49c4('0x31')]));_0x2b2793[_0x49c4('0x2f')]=_0x2b2793[_0x49c4('0x2f')][_0x49c4('0x32')]?_0x2b2793['attributes']:_0x46e04d['model'];if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x33')]){_0x2b2793[_0x49c4('0x34')]=[{'all':!![]}];}_0x2b2793=_[_0x49c4('0x35')]({},_0x2b2793,_0x5987ae[_0x49c4('0x36')]);return db['MailApplication'][_0x49c4('0x37')](_0x2b2793)[_0x49c4('0x38')](handleEntityNotFound(_0x889909,null))[_0x49c4('0x38')](respondWithResult(_0x889909,null))['catch'](handleError(_0x889909,null));};exports['update']=function(_0x85dce2,_0x1991e9){if(_0x85dce2[_0x49c4('0x39')]['id']){delete _0x85dce2[_0x49c4('0x39')]['id'];}return db[_0x49c4('0x2c')][_0x49c4('0x37')]({'where':{'id':_0x85dce2[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x1991e9,null))[_0x49c4('0x38')](saveUpdates(_0x85dce2['body'],null))[_0x49c4('0x38')](respondWithResult(_0x1991e9,null))['catch'](handleError(_0x1991e9,null));};exports[_0x49c4('0x23')]=function(_0x349791,_0x2625a6){return db[_0x49c4('0x2c')]['find']({'where':{'id':_0x349791[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x2625a6,null))[_0x49c4('0x38')](removeEntity(_0x2625a6,null))['catch'](handleError(_0x2625a6,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index dec2a6f..6b370e2 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 _0x0c2d=['exports','define','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','rimraf','./mailApplication.attributes'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x0c2d,0x171));var _0xd0c2=function(_0x47d706,_0x47d085){_0x47d706=_0x47d706-0x0;var _0x5904b2=_0x0c2d[_0x47d706];return _0x5904b2;};'use strict';var _=require(_0xd0c2('0x0'));var util=require(_0xd0c2('0x1'));var logger=require(_0xd0c2('0x2'))(_0xd0c2('0x3'));var moment=require(_0xd0c2('0x4'));var BPromise=require(_0xd0c2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd0c2('0x6'));var config=require('../../config/environment');var attributes=require(_0xd0c2('0x7'));module[_0xd0c2('0x8')]=function(_0x25a552,_0x10c27b){return _0x25a552[_0xd0c2('0x9')]('MailApplication',attributes,{'tableName':_0xd0c2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd0c2('0xb'),'collate':_0xd0c2('0xc')});}; \ No newline at end of file +var _0xd334=['mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailApplication'];(function(_0x5f3b30,_0x10400b){var _0x2584b2=function(_0x2eb82f){while(--_0x2eb82f){_0x5f3b30['push'](_0x5f3b30['shift']());}};_0x2584b2(++_0x10400b);}(_0xd334,0x1a7));var _0x4d33=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xd334[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0x4d33('0x0'));var util=require(_0x4d33('0x1'));var logger=require('../../config/logger')(_0x4d33('0x2'));var moment=require(_0x4d33('0x3'));var BPromise=require(_0x4d33('0x4'));var rp=require(_0x4d33('0x5'));var fs=require('fs');var path=require(_0x4d33('0x6'));var rimraf=require(_0x4d33('0x7'));var config=require(_0x4d33('0x8'));var attributes=require('./mailApplication.attributes');module[_0x4d33('0x9')]=function(_0x5b94cc,_0x5da95b){return _0x5b94cc[_0x4d33('0xa')](_0x4d33('0xb'),attributes,{'tableName':_0x4d33('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4d33('0xd'),'collate':_0x4d33('0xe')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 7ace2a6..4503358 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 _0xb5a6=['../../config/logger','jayson/promise','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','options','attributes','limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x444c10,_0x1aa154){var _0x3b49c5=function(_0x726f53){while(--_0x726f53){_0x444c10['push'](_0x444c10['shift']());}};_0x3b49c5(++_0x1aa154);}(_0xb5a6,0x159));var _0x6b5a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xb5a6[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x6b5a('0x0'));var util=require(_0x6b5a('0x1'));var moment=require('moment');var BPromise=require(_0x6b5a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b5a('0x3'));var db=require(_0x6b5a('0x4'))['db'];var utils=require(_0x6b5a('0x5'));var logger=require(_0x6b5a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6b5a('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x13761c,_0x592a84,_0x240081){return new BPromise(function(_0x15e0c6,_0x391d67){return client[_0x6b5a('0x8')](_0x13761c,_0x240081)[_0x6b5a('0x9')](function(_0x1af2f0){logger[_0x6b5a('0xa')](_0x6b5a('0xb'),_0x592a84,_0x6b5a('0xc'));logger[_0x6b5a('0xd')](_0x6b5a('0xe'),_0x592a84,_0x6b5a('0xc'),JSON[_0x6b5a('0xf')](_0x1af2f0));if(_0x1af2f0[_0x6b5a('0x10')]){if(_0x1af2f0[_0x6b5a('0x10')][_0x6b5a('0x11')]===0x1f4){logger[_0x6b5a('0x10')](_0x6b5a('0xb'),_0x592a84,_0x1af2f0['error'][_0x6b5a('0x12')]);return _0x391d67(_0x1af2f0[_0x6b5a('0x10')][_0x6b5a('0x12')]);}logger['error'](_0x6b5a('0xb'),_0x592a84,_0x1af2f0[_0x6b5a('0x10')]['message']);return _0x15e0c6(_0x1af2f0['error'][_0x6b5a('0x12')]);}else{logger[_0x6b5a('0xa')](_0x6b5a('0xb'),_0x592a84,_0x6b5a('0xc'));_0x15e0c6(_0x1af2f0[_0x6b5a('0x13')][_0x6b5a('0x12')]);}})[_0x6b5a('0x14')](function(_0x4c70f8){logger[_0x6b5a('0x10')](_0x6b5a('0xb'),_0x592a84,_0x4c70f8);_0x391d67(_0x4c70f8);});});}exports[_0x6b5a('0x15')]=function(_0x40d29a){var _0x10bba3=this;return new Promise(function(_0x26a6c6,_0x260946){return db[_0x6b5a('0x16')][_0x6b5a('0x17')](_0x40d29a['body'],{'raw':_0x40d29a[_0x6b5a('0x18')]?_0x40d29a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40d29a[_0x6b5a('0x18')]?_0x40d29a[_0x6b5a('0x18')]['where']||null:null,'attributes':_0x40d29a['options']?_0x40d29a[_0x6b5a('0x18')][_0x6b5a('0x19')]||null:null,'limit':_0x40d29a[_0x6b5a('0x18')]?_0x40d29a[_0x6b5a('0x18')][_0x6b5a('0x1a')]||null:null})['then'](function(_0x505a74){logger[_0x6b5a('0xa')](_0x6b5a('0x15'),_0x40d29a);logger['debug'](_0x6b5a('0x15'),_0x40d29a,JSON[_0x6b5a('0xf')](_0x505a74));_0x26a6c6(_0x505a74);})['catch'](function(_0x1642c5){logger[_0x6b5a('0x10')]('UpdateMailApplication',_0x1642c5['message'],_0x40d29a);_0x260946(_0x10bba3[_0x6b5a('0x10')](0x1f4,_0x1642c5[_0x6b5a('0x12')]));});});}; \ No newline at end of file +var _0x136a=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','request\x20sent','debug','stringify','error','code','MailApplication,\x20%s,\x20%s','message','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','limit','then'];(function(_0x418fd2,_0x18ae8b){var _0x49ebee=function(_0x1d990c){while(--_0x1d990c){_0x418fd2['push'](_0x418fd2['shift']());}};_0x49ebee(++_0x18ae8b);}(_0x136a,0x196));var _0xa136=function(_0x423268,_0x2ba81d){_0x423268=_0x423268-0x0;var _0x1dc336=_0x136a[_0x423268];return _0x1dc336;};'use strict';var _=require(_0xa136('0x0'));var util=require('util');var moment=require(_0xa136('0x1'));var BPromise=require(_0xa136('0x2'));var rs=require(_0xa136('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa136('0x4'))['db'];var utils=require(_0xa136('0x5'));var logger=require(_0xa136('0x6'))(_0xa136('0x7'));var config=require('../../config/environment');var jayson=require(_0xa136('0x8'));var client=jayson['client'][_0xa136('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30d64e,_0x3da4b1,_0x57124e){return new BPromise(function(_0x21bd51,_0x3fdea7){return client[_0xa136('0xa')](_0x30d64e,_0x57124e)['then'](function(_0x2a2b2c){logger[_0xa136('0xb')]('MailApplication,\x20%s,\x20%s',_0x3da4b1,_0xa136('0xc'));logger[_0xa136('0xd')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x3da4b1,'request\x20sent',JSON[_0xa136('0xe')](_0x2a2b2c));if(_0x2a2b2c[_0xa136('0xf')]){if(_0x2a2b2c[_0xa136('0xf')][_0xa136('0x10')]===0x1f4){logger['error'](_0xa136('0x11'),_0x3da4b1,_0x2a2b2c[_0xa136('0xf')][_0xa136('0x12')]);return _0x3fdea7(_0x2a2b2c[_0xa136('0xf')][_0xa136('0x12')]);}logger[_0xa136('0xf')]('MailApplication,\x20%s,\x20%s',_0x3da4b1,_0x2a2b2c[_0xa136('0xf')][_0xa136('0x12')]);return _0x21bd51(_0x2a2b2c[_0xa136('0xf')][_0xa136('0x12')]);}else{logger[_0xa136('0xb')]('MailApplication,\x20%s,\x20%s',_0x3da4b1,_0xa136('0xc'));_0x21bd51(_0x2a2b2c['result']['message']);}})[_0xa136('0x13')](function(_0x3764f4){logger[_0xa136('0xf')](_0xa136('0x11'),_0x3da4b1,_0x3764f4);_0x3fdea7(_0x3764f4);});});}exports[_0xa136('0x14')]=function(_0x479cf8){var _0x154b7f=this;return new Promise(function(_0xedebe4,_0x5ee62f){return db[_0xa136('0x15')][_0xa136('0x16')](_0x479cf8[_0xa136('0x17')],{'raw':_0x479cf8[_0xa136('0x18')]?_0x479cf8['options'][_0xa136('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x479cf8[_0xa136('0x18')]?_0x479cf8[_0xa136('0x18')][_0xa136('0x1a')]||null:null,'attributes':_0x479cf8[_0xa136('0x18')]?_0x479cf8[_0xa136('0x18')]['attributes']||null:null,'limit':_0x479cf8[_0xa136('0x18')]?_0x479cf8[_0xa136('0x18')][_0xa136('0x1b')]||null:null})[_0xa136('0x1c')](function(_0x2a8b69){logger['info'](_0xa136('0x14'),_0x479cf8);logger[_0xa136('0xd')](_0xa136('0x14'),_0x479cf8,JSON[_0xa136('0xe')](_0x2a8b69));_0xedebe4(_0x2a8b69);})[_0xa136('0x13')](function(_0x54febf){logger[_0xa136('0xf')](_0xa136('0x14'),_0x54febf[_0xa136('0x12')],_0x479cf8);_0x5ee62f(_0x154b7f[_0xa136('0xf')](0x1f4,_0x54febf[_0xa136('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 3728820..f9bbf36 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 _0x4bb2=['express','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','update','delete','mailinteraction:destroy','removeTags','exports'];(function(_0x4ee698,_0x4b588f){var _0x503343=function(_0x385a5){while(--_0x385a5){_0x4ee698['push'](_0x4ee698['shift']());}};_0x503343(++_0x4b588f);}(_0x4bb2,0xa2));var _0x24bb=function(_0x25efe3,_0x3cf34a){_0x25efe3=_0x25efe3-0x0;var _0x4249d0=_0x4bb2[_0x25efe3];return _0x4249d0;};'use strict';var express=require(_0x24bb('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x24bb('0x1'));var controller=require(_0x24bb('0x2'));router['get']('/',auth[_0x24bb('0x3')](),controller['index']);router[_0x24bb('0x4')](_0x24bb('0x5'),auth[_0x24bb('0x3')](),controller[_0x24bb('0x6')]);router['get'](_0x24bb('0x7'),auth[_0x24bb('0x3')](),controller[_0x24bb('0x8')]);router[_0x24bb('0x4')](_0x24bb('0x9'),auth[_0x24bb('0x3')](),controller[_0x24bb('0xa')]);router[_0x24bb('0x4')](_0x24bb('0xb'),auth['isAuthenticated'](),controller[_0x24bb('0xc')]);router['post']('/',auth[_0x24bb('0x3')](),controller[_0x24bb('0xd')]);router[_0x24bb('0xe')]('/:id/messages',auth['isAuthenticated'](),controller[_0x24bb('0xf')]);router[_0x24bb('0xe')](_0x24bb('0x10'),auth[_0x24bb('0x3')](),interaction[_0x24bb('0x11')](_0x24bb('0x12'),_0x24bb('0x13')),controller[_0x24bb('0x14')]);router[_0x24bb('0x15')](_0x24bb('0x7'),auth[_0x24bb('0x3')](),interaction['tracked'](_0x24bb('0x12'),'mailinteraction:update'),controller[_0x24bb('0x16')]);router[_0x24bb('0x17')](_0x24bb('0x7'),auth[_0x24bb('0x3')](),interaction[_0x24bb('0x11')]('mail',_0x24bb('0x18')),controller['destroy']);router['delete'](_0x24bb('0x10'),auth[_0x24bb('0x3')](),controller[_0x24bb('0x19')]);module[_0x24bb('0x1a')]=router; \ No newline at end of file +var _0x9883=['tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','Router','./mailInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','/:id/tags'];(function(_0x3a4924,_0x33d2dd){var _0xbc226d=function(_0x25212f){while(--_0x25212f){_0x3a4924['push'](_0x3a4924['shift']());}};_0xbc226d(++_0x33d2dd);}(_0x9883,0x8d));var _0x3988=function(_0x5cd572,_0x452ec8){_0x5cd572=_0x5cd572-0x0;var _0x447a65=_0x9883[_0x5cd572];return _0x447a65;};'use strict';var express=require(_0x3988('0x0'));var router=express[_0x3988('0x1')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var controller=require(_0x3988('0x2'));router[_0x3988('0x3')]('/',auth['isAuthenticated'](),controller[_0x3988('0x4')]);router[_0x3988('0x3')](_0x3988('0x5'),auth[_0x3988('0x6')](),controller[_0x3988('0x7')]);router[_0x3988('0x3')](_0x3988('0x8'),auth[_0x3988('0x6')](),controller[_0x3988('0x9')]);router[_0x3988('0x3')](_0x3988('0xa'),auth['isAuthenticated'](),controller[_0x3988('0xb')]);router[_0x3988('0x3')](_0x3988('0xc'),auth[_0x3988('0x6')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x3988('0xd')]('/:id/messages',auth[_0x3988('0x6')](),controller['addMessage']);router[_0x3988('0xd')](_0x3988('0xe'),auth[_0x3988('0x6')](),interaction[_0x3988('0xf')](_0x3988('0x10'),_0x3988('0x11')),controller[_0x3988('0x12')]);router[_0x3988('0x13')](_0x3988('0x8'),auth[_0x3988('0x6')](),interaction[_0x3988('0xf')](_0x3988('0x10'),_0x3988('0x14')),controller['update']);router[_0x3988('0x15')](_0x3988('0x8'),auth['isAuthenticated'](),interaction[_0x3988('0xf')](_0x3988('0x10'),_0x3988('0x16')),controller[_0x3988('0x17')]);router[_0x3988('0x15')](_0x3988('0xe'),auth['isAuthenticated'](),controller[_0x3988('0x18')]);module[_0x3988('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 0ff85f4..472d806 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 _0x388c=['DATE','STRING','TEXT','out','ENUM','INTEGER','sequelize','BOOLEAN'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x388c,0x8e));var _0xc388=function(_0x39941c,_0x4ad1bb){_0x39941c=_0x39941c-0x0;var _0x52d9c7=_0x388c[_0x39941c];return _0x52d9c7;};'use strict';var Sequelize=require(_0xc388('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0xc388('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc388('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc388('0x3')]},'thirdDisposition':{'type':Sequelize[_0xc388('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xc388('0x4')]('long')},'subject':{'type':Sequelize[_0xc388('0x4')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xc388('0x2')]},'substatus':{'type':Sequelize[_0xc388('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xc388('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xc388('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc388('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xc388('0x6')]('in',_0xc388('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xc388('0x7')]}}; \ No newline at end of file +var _0x64d4=['BOOLEAN','DATE','STRING','TEXT','ENUM','out','INTEGER','sequelize','iconv','exports'];(function(_0xf74b3a,_0x5244a2){var _0x476154=function(_0x55d5bb){while(--_0x55d5bb){_0xf74b3a['push'](_0xf74b3a['shift']());}};_0x476154(++_0x5244a2);}(_0x64d4,0x1a1));var _0x464d=function(_0x3a0d4b,_0x5bcf1a){_0x3a0d4b=_0x3a0d4b-0x0;var _0x4f3fdf=_0x64d4[_0x3a0d4b];return _0x4f3fdf;};'use strict';var Sequelize=require(_0x464d('0x0'));var iconv=require(_0x464d('0x1'));module[_0x464d('0x2')]={'closed':{'type':Sequelize[_0x464d('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x464d('0x4')]},'disposition':{'type':Sequelize[_0x464d('0x5')]},'secondDisposition':{'type':Sequelize[_0x464d('0x5')]},'thirdDisposition':{'type':Sequelize[_0x464d('0x5')]},'note':{'type':Sequelize[_0x464d('0x5')]},'inReplyTo':{'type':Sequelize[_0x464d('0x5')](0x1fe)},'to':{'type':Sequelize[_0x464d('0x5')]},'cc':{'type':Sequelize[_0x464d('0x6')]('long')},'subject':{'type':Sequelize[_0x464d('0x6')]()},'attach':{'type':Sequelize[_0x464d('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x464d('0x4')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x464d('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x464d('0x7')]('in',_0x464d('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x464d('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x464d('0x7')]('in',_0x464d('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x464d('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x464d('0x9')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 767ee47..959f32a 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 _0x325f=['existsSync','name','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','moment','bluebird','util','path','lodash','juice','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','end','error','stack','send','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','query','user','catch','show','params','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','MailMessage','ids','getMessages','findOne','keys','hasOwnProperty','sort','where','pick','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','true','rows','setTags','omit','spread','Tag','color','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','createdAt','get','mkdirSync','each','from','missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename'];(function(_0x11bce2,_0x322e2a){var _0x1993a4=function(_0x4deacf){while(--_0x4deacf){_0x11bce2['push'](_0x11bce2['shift']());}};_0x1993a4(++_0x322e2a);}(_0x325f,0x1cf));var _0xf325=function(_0x4b997a,_0x5e9fcd){_0x4b997a=_0x4b997a-0x0;var _0x58fd5d=_0x325f[_0x4b997a];return _0x58fd5d;};'use strict';var emlformat=require(_0xf325('0x0'));var rimraf=require(_0xf325('0x1'));var zipdir=require('zip-dir');var moment=require(_0xf325('0x2'));var BPromise=require(_0xf325('0x3'));var util=require(_0xf325('0x4'));var path=require(_0xf325('0x5'));var fs=require('fs');var _=require(_0xf325('0x6'));var juice=require(_0xf325('0x7'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0xf325('0x8'));var logger=require(_0xf325('0x9'))(_0xf325('0xa'));var config=require(_0xf325('0xb'));var db=require(_0xf325('0xc'))['db'];var htmlEntities=require('html-entities');config[_0xf325('0xd')]=_['defaults'](config[_0xf325('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xf325('0xe'))(new Redis(config[_0xf325('0xd')]));require(_0xf325('0xf'))[_0xf325('0x10')](socket);function respondWithStatusCode(_0x3c98e7,_0x437083){_0x437083=_0x437083||0xcc;return function(_0x3b482e){if(_0x3b482e){return _0x3c98e7[_0xf325('0x11')](_0x437083);}return _0x3c98e7['status'](_0x437083)['end']();};}function respondWithResult(_0x4bec88,_0x35e2f3){_0x35e2f3=_0x35e2f3||0xc8;return function(_0x45ece9){if(_0x45ece9){return _0x4bec88[_0xf325('0x12')](_0x35e2f3)[_0xf325('0x13')](_0x45ece9);}};}function respondWithFilteredResult(_0x5cb832,_0x39841d){return function(_0x3fc35e){if(_0x3fc35e){var _0x4dc784=typeof _0x39841d['offset']===_0xf325('0x14')&&typeof _0x39841d[_0xf325('0x15')]===_0xf325('0x14');var _0xafe9a8=_0x3fc35e[_0xf325('0x16')];var _0x239593=_0x4dc784?0x0:_0x39841d[_0xf325('0x17')];var _0x238d82=_0x4dc784?_0x3fc35e[_0xf325('0x16')]:_0x39841d[_0xf325('0x17')]+_0x39841d['limit'];var _0x5ae61e;if(_0x238d82>=_0xafe9a8){_0x238d82=_0xafe9a8;_0x5ae61e=0xc8;}else{_0x5ae61e=0xce;}_0x5cb832['status'](_0x5ae61e);return _0x5cb832[_0xf325('0x18')](_0xf325('0x19'),_0x239593+'-'+_0x238d82+'/'+_0xafe9a8)[_0xf325('0x13')](_0x3fc35e);}return null;};}function saveUpdates(_0xc28ed9){return function(_0x3f90f0){if(_0x3f90f0){return _0x3f90f0[_0xf325('0x1a')](_0xc28ed9)[_0xf325('0x1b')](function(_0x4926e6){return _0x4926e6;});}return null;};}function removeEntity(_0x1b5ac9){return function(_0x52ce14){if(_0x52ce14){return _0x52ce14[_0xf325('0x1c')]()[_0xf325('0x1b')](function(){_0x1b5ac9['status'](0xcc)[_0xf325('0x1d')]();});}};}function handleEntityNotFound(_0x18b960){return function(_0x958224){if(!_0x958224){_0x18b960[_0xf325('0x11')](0x194);}return _0x958224;};}function handleError(_0x2617bf,_0x148bac){_0x148bac=_0x148bac||0x1f4;return function(_0x3c6dcc){logger[_0xf325('0x1e')](_0x3c6dcc[_0xf325('0x1f')]);if(_0x3c6dcc['name']){delete _0x3c6dcc['name'];}_0x2617bf['status'](_0x148bac)[_0xf325('0x20')](_0x3c6dcc);};}exports['index']=function(_0x5cd274,_0x12a681){var _0x5bd192={};var _0x33c1ce=_[_0xf325('0x21')](db[_0xf325('0x22')][_0xf325('0x23')],function(_0x4451e9){return{'name':_0x4451e9[_0xf325('0x24')],'type':_0x4451e9[_0xf325('0x25')][_0xf325('0x26')]};});_0x5bd192=qs[_0xf325('0x27')](_0x33c1ce,_0x5cd274);return interaction['findAll']('mail',_0x5cd274[_0xf325('0x28')],_0x5cd274[_0xf325('0x29')],_0x5bd192,_0x33c1ce)[_0xf325('0x1b')](respondWithFilteredResult(_0x12a681,_0x5bd192))[_0xf325('0x2a')](handleError(_0x12a681,null));};exports[_0xf325('0x2b')]=function(_0x41b0cb,_0x172df9){var _0x432eaa={'raw':![],'where':{'id':_0x41b0cb[_0xf325('0x2c')]['id']}},_0x4863a9={};_0x4863a9['model']=_['keys'](db[_0xf325('0x22')][_0xf325('0x23')]);_0x4863a9[_0xf325('0x28')]=_['keys'](_0x41b0cb['query']);_0x4863a9[_0xf325('0x2d')]=_[_0xf325('0x2e')](_0x4863a9[_0xf325('0x2f')],_0x4863a9[_0xf325('0x28')]);_0x432eaa[_0xf325('0x30')]=_['intersection'](_0x4863a9[_0xf325('0x2f')],qs['fields'](_0x41b0cb['query'][_0xf325('0x31')]));_0x432eaa['attributes']=_0x432eaa[_0xf325('0x30')][_0xf325('0x32')]?_0x432eaa[_0xf325('0x30')]:_0x4863a9['model'];if(_0x41b0cb[_0xf325('0x28')][_0xf325('0x33')]){_0x432eaa[_0xf325('0x34')]=[{'all':!![]}];}_0x432eaa=_[_0xf325('0x35')]({},_0x432eaa,_0x41b0cb[_0xf325('0x36')]);return db[_0xf325('0x22')][_0xf325('0x37')](_0x432eaa)[_0xf325('0x1b')](handleEntityNotFound(_0x172df9,null))['then'](respondWithResult(_0x172df9,null))['catch'](handleError(_0x172df9,null));};exports[_0xf325('0x38')]=function(_0x5d45e7,_0x43a040){return db[_0xf325('0x22')][_0xf325('0x38')](_0x5d45e7[_0xf325('0x39')],{})[_0xf325('0x1b')](respondWithResult(_0x43a040,0xc9))[_0xf325('0x2a')](handleError(_0x43a040,null));};exports[_0xf325('0x1a')]=function(_0x3c0121,_0x22438a){if(_0x3c0121[_0xf325('0x39')]['id']){delete _0x3c0121['body']['id'];}return db[_0xf325('0x22')][_0xf325('0x37')]({'where':{'id':_0x3c0121['params']['id']}})[_0xf325('0x1b')](handleEntityNotFound(_0x22438a,null))[_0xf325('0x1b')](saveUpdates(_0x3c0121[_0xf325('0x39')],null))[_0xf325('0x1b')](respondWithResult(_0x22438a,null))[_0xf325('0x2a')](handleError(_0x22438a,null));};exports[_0xf325('0x1c')]=function(_0x3ff533,_0x3df746){return db['MailInteraction'][_0xf325('0x37')]({'where':{'id':_0x3ff533['params']['id']}})[_0xf325('0x1b')](handleEntityNotFound(_0x3df746,null))[_0xf325('0x1b')](removeEntity(_0x3df746,null))[_0xf325('0x2a')](handleError(_0x3df746,null));};exports[_0xf325('0x3a')]=function(_0x2f3c3f,_0x2cb9d0){return db['MailInteraction']['describe']()[_0xf325('0x1b')](respondWithResult(_0x2cb9d0,null))[_0xf325('0x2a')](handleError(_0x2cb9d0,null));};exports[_0xf325('0x3b')]=function(_0x261dc2,_0x4a3c77){return db[_0xf325('0x3c')][_0xf325('0x37')]({'where':{'id':_0x261dc2[_0xf325('0x2c')]['id']}})[_0xf325('0x1b')](handleEntityNotFound(_0x4a3c77,null))[_0xf325('0x1b')](function(_0x5697c4){if(_0x5697c4){return _0x5697c4[_0xf325('0x3b')](_0x261dc2[_0xf325('0x39')][_0xf325('0x3d')],_['omit'](_0x261dc2['body'],[_0xf325('0x3d'),'id'])||{});}})[_0xf325('0x1b')](respondWithResult(_0x4a3c77,null))[_0xf325('0x2a')](handleError(_0x4a3c77,null));};exports[_0xf325('0x3e')]=function(_0x5c585f,_0x8e0730){var _0x15491a={'raw':![],'where':{}};var _0x2bd178={};var _0x453068={'count':0x0,'rows':[]};return db[_0xf325('0x22')][_0xf325('0x3f')]({'where':{'id':_0x5c585f[_0xf325('0x2c')]['id']}})[_0xf325('0x1b')](handleEntityNotFound(_0x8e0730,null))[_0xf325('0x1b')](function(_0x2731a5){if(_0x2731a5){_0x2bd178['model']=_[_0xf325('0x40')](db[_0xf325('0x3c')][_0xf325('0x23')]);_0x2bd178['query']=_[_0xf325('0x40')](_0x5c585f[_0xf325('0x28')]);_0x2bd178[_0xf325('0x2d')]=_[_0xf325('0x2e')](_0x2bd178[_0xf325('0x2f')],_0x2bd178[_0xf325('0x28')]);_0x15491a[_0xf325('0x30')]=_[_0xf325('0x2e')](_0x2bd178[_0xf325('0x2f')],qs[_0xf325('0x31')](_0x5c585f[_0xf325('0x28')][_0xf325('0x31')]));_0x15491a['attributes']=_0x15491a['attributes'][_0xf325('0x32')]?_0x15491a[_0xf325('0x30')]:_0x2bd178[_0xf325('0x2f')];if(!_0x5c585f[_0xf325('0x28')][_0xf325('0x41')]('nolimit')){_0x15491a['limit']=qs[_0xf325('0x15')](_0x5c585f[_0xf325('0x28')]['limit']);_0x15491a[_0xf325('0x17')]=qs['offset'](_0x5c585f['query'][_0xf325('0x17')]);}_0x15491a['order']=qs[_0xf325('0x42')](_0x5c585f['query'][_0xf325('0x42')]);_0x15491a[_0xf325('0x43')]=qs[_0xf325('0x2d')](_[_0xf325('0x44')](_0x5c585f[_0xf325('0x28')],_0x2bd178[_0xf325('0x2d')]));_0x15491a[_0xf325('0x43')][_0xf325('0x45')]=_0x2731a5['id'];if(_0x5c585f['query'][_0xf325('0x46')]){_0x15491a[_0xf325('0x43')]=_[_0xf325('0x35')](_0x15491a[_0xf325('0x43')],{'$or':_['map'](_0x15491a[_0xf325('0x30')],function(_0x1bad6d){var _0x177fee={};_0x177fee[_0x1bad6d]={'$like':'%'+_0x5c585f[_0xf325('0x28')]['filter']+'%'};return _0x177fee;})});}if(_0x5c585f[_0xf325('0x28')][_0xf325('0x47')]){var _0x5e7b15=_0x5c585f[_0xf325('0x28')][_0xf325('0x47')][_0xf325('0x48')](',');var _0x585d71={};_0x585d71[_0x5e7b15[0x0]]={'$gte':moment(_0x5e7b15[0x1])[_0xf325('0x49')](_0xf325('0x4a'))};_0x15491a[_0xf325('0x43')]=_[_0xf325('0x35')](_0x15491a[_0xf325('0x43')],_0x585d71);}_0x15491a=_[_0xf325('0x35')]({},_0x15491a,_0x5c585f['options']);return db[_0xf325('0x3c')][_0xf325('0x16')]({'where':_0x15491a[_0xf325('0x43')]})[_0xf325('0x1b')](function(_0x1c8066){_0x453068['count']=_0x1c8066;if(_0x5c585f[_0xf325('0x28')]['includeAll']){_0x15491a[_0xf325('0x34')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x15491a);})['then'](function(_0x3cd4da){if(_0x5c585f['query']['inlineCss']===_0xf325('0x4b')){for(var _0x1b8ec7=0x0;_0x1b8ec7<_0x3cd4da[_0xf325('0x32')];_0x1b8ec7++){_0x3cd4da[_0x1b8ec7]['body']=juice(_0x3cd4da[_0x1b8ec7]['body']);}}_0x453068[_0xf325('0x4c')]=_0x3cd4da;return _0x453068;});}})[_0xf325('0x1b')](respondWithFilteredResult(_0x8e0730,_0x15491a))['catch'](handleError(_0x8e0730,null));};exports['addTags']=function(_0xe8c662,_0x14b76d){return db['MailInteraction'][_0xf325('0x37')]({'where':{'id':_0xe8c662[_0xf325('0x2c')]['id']}})[_0xf325('0x1b')](handleEntityNotFound(_0x14b76d,null))['then'](function(_0x41aea7){if(_0x41aea7){return _0x41aea7[_0xf325('0x4d')](_0xe8c662['body'][_0xf325('0x3d')],_[_0xf325('0x4e')](_0xe8c662[_0xf325('0x39')],[_0xf325('0x3d'),'id'])||{})[_0xf325('0x4f')](function(){return db[_0xf325('0x50')]['findAll']({'attributes':['id','name',_0xf325('0x51')],'where':{'id':_0xe8c662[_0xf325('0x39')]['ids']}});})['then'](function(_0x5de9fa){socket['emit'](_0xf325('0x52'),{'id':Number(_0xe8c662['params']['id']),'tags':_0x5de9fa||[]});return{'id':Number(_0xe8c662[_0xf325('0x2c')]['id']),'tags':_0x5de9fa||[]};});}})[_0xf325('0x1b')](respondWithResult(_0x14b76d,null))[_0xf325('0x2a')](handleError(_0x14b76d,null));};exports[_0xf325('0x53')]=function(_0x273988,_0x5c0a79){return db['MailInteraction']['find']({'where':{'id':_0x273988['params']['id']}})[_0xf325('0x1b')](handleEntityNotFound(_0x5c0a79,null))[_0xf325('0x1b')](function(_0x31a5c2){if(_0x31a5c2){return _0x31a5c2[_0xf325('0x53')](_0x273988[_0xf325('0x28')]['ids']);}})['then'](respondWithStatusCode(_0x5c0a79,null))['catch'](handleError(_0x5c0a79,null));};exports[_0xf325('0x54')]=function(_0x406dd3,_0x366913){var _0x5ceba1=moment()[_0xf325('0x55')]()[_0xf325('0x56')]();var _0x2fa1ad=path[_0xf325('0x57')](config[_0xf325('0x58')],_0xf325('0x59'),_0xf325('0x5a'),'tmp');var _0x33148f=path[_0xf325('0x57')](config[_0xf325('0x58')],_0xf325('0x59'),'files',_0xf325('0x5b'));var _0x12faac=path[_0xf325('0x57')](_0x2fa1ad,_0x5ceba1);var _0x5034e0=util[_0xf325('0x49')](_0xf325('0x5c'),_0x406dd3['params']['id'],_0x5ceba1);var _0x27461f=path['join'](_0x2fa1ad,_0x5034e0);var _0x2bdebf=[];if(_0x406dd3['query'][_0xf325('0x5b')]){_0x2bdebf['push']({'model':db[_0xf325('0x5d')],'as':_0xf325('0x5e'),'raw':!![]});}var _0xaf1f7e=[{'model':db[_0xf325('0x3c')],'as':_0xf325('0x5f'),'attributes':['id',_0xf325('0x39'),'from','to','cc',_0xf325('0x60'),_0xf325('0x61'),_0xf325('0x62')],'where':{'secret':![]},'order':qs[_0xf325('0x42')]('id'),'include':_0x2bdebf}];return db['MailInteraction'][_0xf325('0x37')]({'where':{'id':_0x406dd3[_0xf325('0x2c')]['id']},'include':_0xaf1f7e})[_0xf325('0x1b')](handleEntityNotFound(_0x366913,null))[_0xf325('0x1b')](function(_0x1ed173){if(_0x1ed173&&_0x1ed173[_0xf325('0x5f')]){var _0x3a5aa5=_0x1ed173[_0xf325('0x63')]({'plain':!![]});fs[_0xf325('0x64')](_0x12faac);return BPromise[_0xf325('0x65')](_0x3a5aa5[_0xf325('0x5f')],function(_0x2d522f,_0x1bb37b){var _0x2d9518={'from':_0x2d522f[_0xf325('0x66')],'to':_0x2d522f['to']||_0xf325('0x67'),'subject':_0x2d522f[_0xf325('0x61')],'html':htmlEntities['decode'](_0x2d522f[_0xf325('0x39')]),'headers':{'Date':moment(_0x2d522f['createdAt'])[_0xf325('0x49')](_0xf325('0x68'))},'attachments':[]};if(_0x2d522f['cc']){_0x2d9518['headers']['Cc']=_0x2d522f['cc'];}if(_0x2d522f[_0xf325('0x60')]){_0x2d9518[_0xf325('0x69')]['Bcc']=_0x2d522f[_0xf325('0x60')];}return new BPromise(function(_0x5f2dcd,_0x4f6e38){if(_0x2d522f[_0xf325('0x5e')]){for(var _0x4a0fa7=0x0;_0x4a0fa7<_0x2d522f[_0xf325('0x5e')][_0xf325('0x32')];_0x4a0fa7++){var _0x1b3cfe=_0x2d522f['Attachments'][_0x4a0fa7];var _0x11e900=path[_0xf325('0x57')](_0x33148f,_0x1b3cfe[_0xf325('0x6a')]);if(fs[_0xf325('0x6b')](_0x11e900)){_0x2d9518[_0xf325('0x5b')]['push']({'name':_0x1b3cfe[_0xf325('0x6c')],'contentType':_0x1b3cfe['type'],'data':fs[_0xf325('0x6d')](_0x11e900)});}}}emlformat[_0xf325('0x6e')](_0x2d9518,function(_0x3da042,_0x11704f){if(_0x3da042)return _0x4f6e38(_0x3da042);fs[_0xf325('0x6f')](path['join'](_0x12faac,util[_0xf325('0x49')](_0xf325('0x70'),_0x1bb37b)),_0x11704f);return _0x5f2dcd(_0x11704f);});});})['then'](function(){return new BPromise(function(_0x5c6d27,_0x186640){zipdir(_0x12faac,{'saveTo':_0x27461f},function(_0xb42986,_0x3c616d){if(_0xb42986)return _0x186640(_0xb42986);return _0x5c6d27(_0x3c616d);});})[_0xf325('0x1b')](function(){return new BPromise(function(_0x1a4d2e,_0x599fa7){rimraf(_0x12faac,function(_0x3bebdd){if(_0x3bebdd)_0x599fa7(_0x3bebdd);return _0x1a4d2e();});});})[_0xf325('0x1b')](function(){return _0x366913[_0xf325('0x54')](_0x27461f,_0x5034e0,function(_0x2e0863){if(!_0x2e0863)fs[_0xf325('0x71')](_0x27461f);});});});}else{return _0x366913[_0xf325('0x11')](0xc8);}})[_0xf325('0x2a')](handleError(_0x366913,null));}; \ No newline at end of file +var _0xb60a=['from','decode','headers','Bcc','basename','existsSync','attachments','readFileSync','writeFileSync','message%d.eml','eml-format','rimraf','zip-dir','bluebird','path','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../mysqldb','html-entities','redis','localhost','./mailInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','key','getOptions','findAll','mail','query','catch','show','model','keys','intersection','attributes','fields','length','include','options','MailInteraction','body','params','find','addMessage','MailMessage','ids','omit','getMessages','filters','hasOwnProperty','nolimit','order','sort','pick','where','MailInteractionId','filter','$gte','split','merge','includeAll','true','rows','Tag','emit','removeTags','download','unix','toString','root','server','files','tmp','join','format','transcript-%d-%s.zip','push','Attachments','Messages','bcc','subject','createdAt','get','mkdirSync','each'];(function(_0x3dbcf7,_0x1e72e2){var _0x10ac80=function(_0x38a169){while(--_0x38a169){_0x3dbcf7['push'](_0x3dbcf7['shift']());}};_0x10ac80(++_0x1e72e2);}(_0xb60a,0x1b6));var _0xab60=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xb60a[_0x2d7f0e];return _0x110b07;};'use strict';var emlformat=require(_0xab60('0x0'));var rimraf=require(_0xab60('0x1'));var zipdir=require(_0xab60('0x2'));var moment=require('moment');var BPromise=require(_0xab60('0x3'));var util=require('util');var path=require(_0xab60('0x4'));var fs=require('fs');var _=require(_0xab60('0x5'));var juice=require('juice');var Redis=require(_0xab60('0x6'));var interaction=require(_0xab60('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0xab60('0x8'))(_0xab60('0x9'));var config=require('../../config/environment');var db=require(_0xab60('0xa'))['db'];var htmlEntities=require(_0xab60('0xb'));config[_0xab60('0xc')]=_['defaults'](config[_0xab60('0xc')],{'host':_0xab60('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xab60('0xe'))[_0xab60('0xf')](socket);function respondWithStatusCode(_0x44b12c,_0x2004b9){_0x2004b9=_0x2004b9||0xcc;return function(_0x3b6be3){if(_0x3b6be3){return _0x44b12c[_0xab60('0x10')](_0x2004b9);}return _0x44b12c[_0xab60('0x11')](_0x2004b9)[_0xab60('0x12')]();};}function respondWithResult(_0xcc7fe0,_0x23cb63){_0x23cb63=_0x23cb63||0xc8;return function(_0x3930a4){if(_0x3930a4){return _0xcc7fe0[_0xab60('0x11')](_0x23cb63)['json'](_0x3930a4);}};}function respondWithFilteredResult(_0x3f77e9,_0xc9b1ce){return function(_0x33a446){if(_0x33a446){var _0xeea5e2=typeof _0xc9b1ce[_0xab60('0x13')]===_0xab60('0x14')&&typeof _0xc9b1ce[_0xab60('0x15')]==='undefined';var _0x5af438=_0x33a446[_0xab60('0x16')];var _0x5af819=_0xeea5e2?0x0:_0xc9b1ce['offset'];var _0x3ac229=_0xeea5e2?_0x33a446[_0xab60('0x16')]:_0xc9b1ce[_0xab60('0x13')]+_0xc9b1ce[_0xab60('0x15')];var _0x3eeda2;if(_0x3ac229>=_0x5af438){_0x3ac229=_0x5af438;_0x3eeda2=0xc8;}else{_0x3eeda2=0xce;}_0x3f77e9[_0xab60('0x11')](_0x3eeda2);return _0x3f77e9[_0xab60('0x17')](_0xab60('0x18'),_0x5af819+'-'+_0x3ac229+'/'+_0x5af438)[_0xab60('0x19')](_0x33a446);}return null;};}function saveUpdates(_0x1a14fb){return function(_0x3e84f5){if(_0x3e84f5){return _0x3e84f5[_0xab60('0x1a')](_0x1a14fb)[_0xab60('0x1b')](function(_0x41d42f){return _0x41d42f;});}return null;};}function removeEntity(_0x5f02bb){return function(_0x31209e){if(_0x31209e){return _0x31209e[_0xab60('0x1c')]()[_0xab60('0x1b')](function(){_0x5f02bb[_0xab60('0x11')](0xcc)[_0xab60('0x12')]();});}};}function handleEntityNotFound(_0x2785b7){return function(_0x49bb72){if(!_0x49bb72){_0x2785b7['sendStatus'](0x194);}return _0x49bb72;};}function handleError(_0x55fc6a,_0x5bcf7e){_0x5bcf7e=_0x5bcf7e||0x1f4;return function(_0x35147d){logger[_0xab60('0x1d')](_0x35147d[_0xab60('0x1e')]);if(_0x35147d[_0xab60('0x1f')]){delete _0x35147d[_0xab60('0x1f')];}_0x55fc6a[_0xab60('0x11')](_0x5bcf7e)['send'](_0x35147d);};}exports['index']=function(_0x30d70a,_0x387b45){var _0x278dba={};var _0x589d2f=_[_0xab60('0x20')](db['MailInteraction'][_0xab60('0x21')],function(_0xd26c59){return{'name':_0xd26c59[_0xab60('0x22')],'type':_0xd26c59[_0xab60('0x23')][_0xab60('0x24')]};});_0x278dba=qs[_0xab60('0x25')](_0x589d2f,_0x30d70a);return interaction[_0xab60('0x26')](_0xab60('0x27'),_0x30d70a[_0xab60('0x28')],_0x30d70a['user'],_0x278dba,_0x589d2f)[_0xab60('0x1b')](respondWithFilteredResult(_0x387b45,_0x278dba))[_0xab60('0x29')](handleError(_0x387b45,null));};exports[_0xab60('0x2a')]=function(_0x244f93,_0x3751ff){var _0x4f284c={'raw':![],'where':{'id':_0x244f93['params']['id']}},_0x9df8ec={};_0x9df8ec[_0xab60('0x2b')]=_['keys'](db['MailInteraction'][_0xab60('0x21')]);_0x9df8ec[_0xab60('0x28')]=_[_0xab60('0x2c')](_0x244f93[_0xab60('0x28')]);_0x9df8ec['filters']=_[_0xab60('0x2d')](_0x9df8ec[_0xab60('0x2b')],_0x9df8ec[_0xab60('0x28')]);_0x4f284c[_0xab60('0x2e')]=_[_0xab60('0x2d')](_0x9df8ec[_0xab60('0x2b')],qs[_0xab60('0x2f')](_0x244f93[_0xab60('0x28')]['fields']));_0x4f284c[_0xab60('0x2e')]=_0x4f284c[_0xab60('0x2e')][_0xab60('0x30')]?_0x4f284c[_0xab60('0x2e')]:_0x9df8ec[_0xab60('0x2b')];if(_0x244f93['query']['includeAll']){_0x4f284c[_0xab60('0x31')]=[{'all':!![]}];}_0x4f284c=_['merge']({},_0x4f284c,_0x244f93[_0xab60('0x32')]);return db[_0xab60('0x33')]['find'](_0x4f284c)['then'](handleEntityNotFound(_0x3751ff,null))[_0xab60('0x1b')](respondWithResult(_0x3751ff,null))[_0xab60('0x29')](handleError(_0x3751ff,null));};exports['create']=function(_0x558f29,_0x3a5c18){return db[_0xab60('0x33')]['create'](_0x558f29[_0xab60('0x34')],{})[_0xab60('0x1b')](respondWithResult(_0x3a5c18,0xc9))['catch'](handleError(_0x3a5c18,null));};exports[_0xab60('0x1a')]=function(_0x109ecb,_0x2f6e7f){if(_0x109ecb[_0xab60('0x34')]['id']){delete _0x109ecb[_0xab60('0x34')]['id'];}return db[_0xab60('0x33')]['find']({'where':{'id':_0x109ecb[_0xab60('0x35')]['id']}})[_0xab60('0x1b')](handleEntityNotFound(_0x2f6e7f,null))[_0xab60('0x1b')](saveUpdates(_0x109ecb['body'],null))[_0xab60('0x1b')](respondWithResult(_0x2f6e7f,null))[_0xab60('0x29')](handleError(_0x2f6e7f,null));};exports[_0xab60('0x1c')]=function(_0x57a53a,_0x3192cd){return db['MailInteraction'][_0xab60('0x36')]({'where':{'id':_0x57a53a[_0xab60('0x35')]['id']}})[_0xab60('0x1b')](handleEntityNotFound(_0x3192cd,null))[_0xab60('0x1b')](removeEntity(_0x3192cd,null))[_0xab60('0x29')](handleError(_0x3192cd,null));};exports['describe']=function(_0x44f2a6,_0x2dc886){return db[_0xab60('0x33')]['describe']()[_0xab60('0x1b')](respondWithResult(_0x2dc886,null))[_0xab60('0x29')](handleError(_0x2dc886,null));};exports[_0xab60('0x37')]=function(_0x1e0ad3,_0x117b2a){return db[_0xab60('0x38')][_0xab60('0x36')]({'where':{'id':_0x1e0ad3[_0xab60('0x35')]['id']}})[_0xab60('0x1b')](handleEntityNotFound(_0x117b2a,null))[_0xab60('0x1b')](function(_0x4440f3){if(_0x4440f3){return _0x4440f3[_0xab60('0x37')](_0x1e0ad3[_0xab60('0x34')][_0xab60('0x39')],_[_0xab60('0x3a')](_0x1e0ad3[_0xab60('0x34')],[_0xab60('0x39'),'id'])||{});}})['then'](respondWithResult(_0x117b2a,null))[_0xab60('0x29')](handleError(_0x117b2a,null));};exports[_0xab60('0x3b')]=function(_0xc0e4bd,_0x374469){var _0x58fffd={'raw':![],'where':{}};var _0x4eb7be={};var _0x3100d2={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0xc0e4bd[_0xab60('0x35')]['id']}})[_0xab60('0x1b')](handleEntityNotFound(_0x374469,null))[_0xab60('0x1b')](function(_0x24d0ba){if(_0x24d0ba){_0x4eb7be['model']=_[_0xab60('0x2c')](db[_0xab60('0x38')]['rawAttributes']);_0x4eb7be[_0xab60('0x28')]=_['keys'](_0xc0e4bd['query']);_0x4eb7be[_0xab60('0x3c')]=_['intersection'](_0x4eb7be['model'],_0x4eb7be[_0xab60('0x28')]);_0x58fffd[_0xab60('0x2e')]=_[_0xab60('0x2d')](_0x4eb7be[_0xab60('0x2b')],qs[_0xab60('0x2f')](_0xc0e4bd[_0xab60('0x28')]['fields']));_0x58fffd[_0xab60('0x2e')]=_0x58fffd['attributes']['length']?_0x58fffd[_0xab60('0x2e')]:_0x4eb7be[_0xab60('0x2b')];if(!_0xc0e4bd[_0xab60('0x28')][_0xab60('0x3d')](_0xab60('0x3e'))){_0x58fffd[_0xab60('0x15')]=qs[_0xab60('0x15')](_0xc0e4bd[_0xab60('0x28')]['limit']);_0x58fffd[_0xab60('0x13')]=qs['offset'](_0xc0e4bd[_0xab60('0x28')]['offset']);}_0x58fffd[_0xab60('0x3f')]=qs[_0xab60('0x40')](_0xc0e4bd[_0xab60('0x28')][_0xab60('0x40')]);_0x58fffd['where']=qs['filters'](_[_0xab60('0x41')](_0xc0e4bd['query'],_0x4eb7be[_0xab60('0x3c')]));_0x58fffd[_0xab60('0x42')][_0xab60('0x43')]=_0x24d0ba['id'];if(_0xc0e4bd[_0xab60('0x28')][_0xab60('0x44')]){_0x58fffd['where']=_['merge'](_0x58fffd[_0xab60('0x42')],{'$or':_[_0xab60('0x20')](_0x58fffd['attributes'],function(_0x36aab9){var _0x529f46={};_0x529f46[_0x36aab9]={'$like':'%'+_0xc0e4bd['query'][_0xab60('0x44')]+'%'};return _0x529f46;})});}if(_0xc0e4bd[_0xab60('0x28')][_0xab60('0x45')]){var _0x288997=_0xc0e4bd[_0xab60('0x28')][_0xab60('0x45')][_0xab60('0x46')](',');var _0x1d9d06={};_0x1d9d06[_0x288997[0x0]]={'$gte':moment(_0x288997[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x58fffd[_0xab60('0x42')]=_['merge'](_0x58fffd[_0xab60('0x42')],_0x1d9d06);}_0x58fffd=_[_0xab60('0x47')]({},_0x58fffd,_0xc0e4bd[_0xab60('0x32')]);return db[_0xab60('0x38')]['count']({'where':_0x58fffd[_0xab60('0x42')]})[_0xab60('0x1b')](function(_0x1e598e){_0x3100d2[_0xab60('0x16')]=_0x1e598e;if(_0xc0e4bd['query'][_0xab60('0x48')]){_0x58fffd[_0xab60('0x31')]=[{'all':!![]}];}return db['MailMessage'][_0xab60('0x26')](_0x58fffd);})[_0xab60('0x1b')](function(_0x362941){if(_0xc0e4bd[_0xab60('0x28')]['inlineCss']===_0xab60('0x49')){for(var _0x364473=0x0;_0x364473<_0x362941[_0xab60('0x30')];_0x364473++){_0x362941[_0x364473][_0xab60('0x34')]=juice(_0x362941[_0x364473][_0xab60('0x34')]);}}_0x3100d2[_0xab60('0x4a')]=_0x362941;return _0x3100d2;});}})[_0xab60('0x1b')](respondWithFilteredResult(_0x374469,_0x58fffd))[_0xab60('0x29')](handleError(_0x374469,null));};exports['addTags']=function(_0x2c9707,_0xe464ef){return db[_0xab60('0x33')][_0xab60('0x36')]({'where':{'id':_0x2c9707['params']['id']}})[_0xab60('0x1b')](handleEntityNotFound(_0xe464ef,null))[_0xab60('0x1b')](function(_0xeacb41){if(_0xeacb41){return _0xeacb41['setTags'](_0x2c9707[_0xab60('0x34')][_0xab60('0x39')],_[_0xab60('0x3a')](_0x2c9707['body'],[_0xab60('0x39'),'id'])||{})['spread'](function(){return db[_0xab60('0x4b')]['findAll']({'attributes':['id',_0xab60('0x1f'),'color'],'where':{'id':_0x2c9707[_0xab60('0x34')][_0xab60('0x39')]}});})[_0xab60('0x1b')](function(_0x5a6a27){socket[_0xab60('0x4c')]('mailInteractionTags:save',{'id':Number(_0x2c9707[_0xab60('0x35')]['id']),'tags':_0x5a6a27||[]});return{'id':Number(_0x2c9707['params']['id']),'tags':_0x5a6a27||[]};});}})[_0xab60('0x1b')](respondWithResult(_0xe464ef,null))['catch'](handleError(_0xe464ef,null));};exports[_0xab60('0x4d')]=function(_0x4bd068,_0x18db98){return db['MailInteraction'][_0xab60('0x36')]({'where':{'id':_0x4bd068[_0xab60('0x35')]['id']}})[_0xab60('0x1b')](handleEntityNotFound(_0x18db98,null))['then'](function(_0x43cc27){if(_0x43cc27){return _0x43cc27[_0xab60('0x4d')](_0x4bd068['query'][_0xab60('0x39')]);}})['then'](respondWithStatusCode(_0x18db98,null))[_0xab60('0x29')](handleError(_0x18db98,null));};exports[_0xab60('0x4e')]=function(_0x580a4d,_0x59e30){var _0x5709ce=moment()[_0xab60('0x4f')]()[_0xab60('0x50')]();var _0x1d4dcb=path['join'](config[_0xab60('0x51')],_0xab60('0x52'),_0xab60('0x53'),_0xab60('0x54'));var _0x4b9dad=path[_0xab60('0x55')](config[_0xab60('0x51')],_0xab60('0x52'),_0xab60('0x53'),'attachments');var _0x4989c8=path[_0xab60('0x55')](_0x1d4dcb,_0x5709ce);var _0x2eb211=util[_0xab60('0x56')](_0xab60('0x57'),_0x580a4d[_0xab60('0x35')]['id'],_0x5709ce);var _0x216ec3=path['join'](_0x1d4dcb,_0x2eb211);var _0x59c50d=[];if(_0x580a4d['query']['attachments']){_0x59c50d[_0xab60('0x58')]({'model':db['Attachment'],'as':_0xab60('0x59'),'raw':!![]});}var _0x429853=[{'model':db[_0xab60('0x38')],'as':_0xab60('0x5a'),'attributes':['id','body','from','to','cc',_0xab60('0x5b'),_0xab60('0x5c'),_0xab60('0x5d')],'where':{'secret':![]},'order':qs[_0xab60('0x40')]('id'),'include':_0x59c50d}];return db[_0xab60('0x33')][_0xab60('0x36')]({'where':{'id':_0x580a4d[_0xab60('0x35')]['id']},'include':_0x429853})[_0xab60('0x1b')](handleEntityNotFound(_0x59e30,null))['then'](function(_0x386677){if(_0x386677&&_0x386677['Messages']){var _0x5245f7=_0x386677[_0xab60('0x5e')]({'plain':!![]});fs[_0xab60('0x5f')](_0x4989c8);return BPromise[_0xab60('0x60')](_0x5245f7[_0xab60('0x5a')],function(_0x48857f,_0x52a7a3){var _0x6e5262={'from':_0x48857f[_0xab60('0x61')],'to':_0x48857f['to']||'missing.recipient@your.company.com','subject':_0x48857f['subject'],'html':htmlEntities[_0xab60('0x62')](_0x48857f[_0xab60('0x34')]),'headers':{'Date':moment(_0x48857f[_0xab60('0x5d')])[_0xab60('0x56')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x48857f['cc']){_0x6e5262['headers']['Cc']=_0x48857f['cc'];}if(_0x48857f['bcc']){_0x6e5262[_0xab60('0x63')][_0xab60('0x64')]=_0x48857f[_0xab60('0x5b')];}return new BPromise(function(_0x45ee43,_0x5230d8){if(_0x48857f[_0xab60('0x59')]){for(var _0xf8c5e1=0x0;_0xf8c5e1<_0x48857f[_0xab60('0x59')]['length'];_0xf8c5e1++){var _0x40e899=_0x48857f['Attachments'][_0xf8c5e1];var _0x449398=path[_0xab60('0x55')](_0x4b9dad,_0x40e899[_0xab60('0x65')]);if(fs[_0xab60('0x66')](_0x449398)){_0x6e5262[_0xab60('0x67')][_0xab60('0x58')]({'name':_0x40e899[_0xab60('0x1f')],'contentType':_0x40e899['type'],'data':fs[_0xab60('0x68')](_0x449398)});}}}emlformat['build'](_0x6e5262,function(_0x341593,_0x364040){if(_0x341593)return _0x5230d8(_0x341593);fs[_0xab60('0x69')](path[_0xab60('0x55')](_0x4989c8,util['format'](_0xab60('0x6a'),_0x52a7a3)),_0x364040);return _0x45ee43(_0x364040);});});})['then'](function(){return new BPromise(function(_0x3ff6b2,_0x4034e8){zipdir(_0x4989c8,{'saveTo':_0x216ec3},function(_0x146198,_0x2dbede){if(_0x146198)return _0x4034e8(_0x146198);return _0x3ff6b2(_0x2dbede);});})['then'](function(){return new BPromise(function(_0x14e927,_0x1d8f82){rimraf(_0x4989c8,function(_0x35433a){if(_0x35433a)_0x1d8f82(_0x35433a);return _0x14e927();});});})[_0xab60('0x1b')](function(){return _0x59e30[_0xab60('0x4e')](_0x216ec3,_0x2eb211,function(_0x147c10){if(!_0x147c10)fs['unlinkSync'](_0x216ec3);});});});}else{return _0x59e30[_0xab60('0x10')](0xc8);}})['catch'](handleError(_0x59e30,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 6d4e2d1..df59e6c 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 _0x8563=['update','remove','setDataValue','Users','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','save'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x8563,0xdb));var _0x3856=function(_0x17898e,_0x107361){_0x17898e=_0x17898e-0x0;var _0x79d444=_0x8563[_0x17898e];return _0x79d444;};'use strict';var EventEmitter=require(_0x3856('0x0'));var MailInteraction=require(_0x3856('0x1'))['db'][_0x3856('0x2')];var MailMessage=require(_0x3856('0x1'))['db'][_0x3856('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3856('0x4'),'afterUpdate':_0x3856('0x5'),'afterDestroy':_0x3856('0x6')};function emitEvent(_0x461e88){return function(_0x45ef21,_0x2cc0ca,_0x2d95e3){_0x45ef21['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x294a5f){_0x45ef21[_0x3856('0x7')](_0x3856('0x8'),_0x294a5f['map'](function(_0x5a8117){return{'id':_0x5a8117['id']};}));return MailMessage[_0x3856('0x9')]({'where':{'MailInteractionId':_0x45ef21['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x358bcc){_0x45ef21['setDataValue'](_0x3856('0xa'),_0x358bcc[_0x3856('0xb')]);MailInteractionEvents[_0x3856('0xc')](_0x461e88+':'+_0x45ef21['id'],_0x45ef21);MailInteractionEvents[_0x3856('0xc')](_0x461e88,_0x45ef21);_0x2d95e3(null);})['catch'](_0x2d95e3(null));};}for(var e in events){if(events[_0x3856('0xd')](e)){var event=events[e];MailInteraction[_0x3856('0xe')](e,emitEvent(event));}}module[_0x3856('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0x776b=['../../mysqldb','MailInteraction','MailMessage','save','update','remove','then','map','length','emit','hook','events'];(function(_0x1cf220,_0x3cd6b3){var _0x37364f=function(_0x8f135f){while(--_0x8f135f){_0x1cf220['push'](_0x1cf220['shift']());}};_0x37364f(++_0x3cd6b3);}(_0x776b,0x12b));var _0xb776=function(_0x465436,_0x5f2ccd){_0x465436=_0x465436-0x0;var _0x2d15fd=_0x776b[_0x465436];return _0x2d15fd;};'use strict';var EventEmitter=require(_0xb776('0x0'));var MailInteraction=require(_0xb776('0x1'))['db'][_0xb776('0x2')];var MailMessage=require(_0xb776('0x1'))['db'][_0xb776('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb776('0x4'),'afterUpdate':_0xb776('0x5'),'afterDestroy':_0xb776('0x6')};function emitEvent(_0x480a73){return function(_0x24d47c,_0x451ec8,_0x384a96){_0x24d47c['getUsers']({'attributes':['id'],'raw':!![]})[_0xb776('0x7')](function(_0x3bbdf1){_0x24d47c['setDataValue']('Users',_0x3bbdf1[_0xb776('0x8')](function(_0x3d920b){return{'id':_0x3d920b['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x24d47c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb776('0x7')](function(_0x55ddb7){_0x24d47c['setDataValue']('unreadMessages',_0x55ddb7[_0xb776('0x9')]);MailInteractionEvents[_0xb776('0xa')](_0x480a73+':'+_0x24d47c['id'],_0x24d47c);MailInteractionEvents['emit'](_0x480a73,_0x24d47c);_0x384a96(null);})['catch'](_0x384a96(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xb776('0xb')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index eb53d14..f7c0365 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 _0x5b46=['get','MailMessage','update','then','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','fti_mail_interactions','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','substatusAt','models'];(function(_0x33f671,_0xbb4c5d){var _0xb14a7a=function(_0x540913){while(--_0x540913){_0x33f671['push'](_0x33f671['shift']());}};_0xb14a7a(++_0xbb4c5d);}(_0x5b46,0x149));var _0x65b4=function(_0x184f4a,_0x5922e8){_0x184f4a=_0x184f4a-0x0;var _0x340fba=_0x5b46[_0x184f4a];return _0x340fba;};'use strict';var _=require(_0x65b4('0x0'));var util=require(_0x65b4('0x1'));var logger=require(_0x65b4('0x2'))(_0x65b4('0x3'));var moment=require(_0x65b4('0x4'));var BPromise=require(_0x65b4('0x5'));var rp=require(_0x65b4('0x6'));var fs=require('fs');var path=require(_0x65b4('0x7'));var rimraf=require(_0x65b4('0x8'));var config=require(_0x65b4('0x9'));var attributes=require(_0x65b4('0xa'));module[_0x65b4('0xb')]=function(_0x33608f,_0x2ac6f8){return _0x33608f[_0x65b4('0xc')]('MailInteraction',attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x65b4('0xd'),'fields':['subject','to'],'type':_0x65b4('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x261131,_0xfa0ca3,_0xb604a7){if(_0x261131[_0x65b4('0xf')]){_0x261131['substatusAt']=moment()[_0x65b4('0x10')](_0x65b4('0x11'));}if(_0x261131['closed']){_0x261131[_0x65b4('0x12')]=moment()[_0x65b4('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0xb604a7(null,_0xfa0ca3);},'beforeUpdate':function(_0x331540,_0x2cdfd8,_0x21c3b0){if(_0x331540[_0x65b4('0x13')](_0x65b4('0xf'))){_0x331540[_0x65b4('0x14')]=_0x331540[_0x65b4('0xf')]?moment()[_0x65b4('0x10')](_0x65b4('0x11')):null;}if(_0x331540[_0x65b4('0x13')]('closed')){_0x331540[_0x65b4('0x12')]=moment()[_0x65b4('0x10')](_0x65b4('0x11'));_0x331540[_0x65b4('0xf')]=null;_0x331540['substatusAt']=null;}_0x21c3b0(null,_0x331540);},'afterUpdate':function(_0x412270,_0x5d34bd,_0x353e4b){var _0x559412=_0x33608f[_0x65b4('0x15')];var _0x3f5a76=_0x412270[_0x65b4('0x16')]({'plain':!![]});if(_0x3f5a76['closed']){return _0x559412[_0x65b4('0x17')][_0x65b4('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x3f5a76['id']}})[_0x65b4('0x19')](function(){_0x353e4b();})['catch'](function(_0x5073b3){_0x353e4b(_0x5073b3);});}else{_0x353e4b();}}},'charset':_0x65b4('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xdcda=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','closed','substatus','models','get','then','catch','lodash','util'];(function(_0x498108,_0x5e0c70){var _0x1c7059=function(_0x34927a){while(--_0x34927a){_0x498108['push'](_0x498108['shift']());}};_0x1c7059(++_0x5e0c70);}(_0xdcda,0x19e));var _0xadcd=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xdcda[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xadcd('0x0'));var util=require(_0xadcd('0x1'));var logger=require(_0xadcd('0x2'))('api');var moment=require('moment');var BPromise=require(_0xadcd('0x3'));var rp=require(_0xadcd('0x4'));var fs=require('fs');var path=require(_0xadcd('0x5'));var rimraf=require(_0xadcd('0x6'));var config=require(_0xadcd('0x7'));var attributes=require(_0xadcd('0x8'));module['exports']=function(_0x5b1c65,_0x5c1a70){return _0x5b1c65[_0xadcd('0x9')](_0xadcd('0xa'),attributes,{'tableName':_0xadcd('0xb'),'paranoid':![],'indexes':[{'name':_0xadcd('0xc'),'fields':[_0xadcd('0xd'),'to'],'type':_0xadcd('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x47def0,_0x358d2e,_0x162243){if(_0x47def0['substatus']){_0x47def0[_0xadcd('0xf')]=moment()[_0xadcd('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x47def0['closed']){_0x47def0[_0xadcd('0x11')]=moment()[_0xadcd('0x10')](_0xadcd('0x12'));}_0x162243(null,_0x358d2e);},'beforeUpdate':function(_0x4f771b,_0x5007c1,_0x27d738){if(_0x4f771b[_0xadcd('0x13')]('substatus')){_0x4f771b['substatusAt']=_0x4f771b['substatus']?moment()['format'](_0xadcd('0x12')):null;}if(_0x4f771b[_0xadcd('0x13')](_0xadcd('0x14'))){_0x4f771b[_0xadcd('0x11')]=moment()[_0xadcd('0x10')](_0xadcd('0x12'));_0x4f771b[_0xadcd('0x15')]=null;_0x4f771b[_0xadcd('0xf')]=null;}_0x27d738(null,_0x4f771b);},'afterUpdate':function(_0x2854ea,_0x3ad6ec,_0x9c0979){var _0x103345=_0x5b1c65[_0xadcd('0x16')];var _0x3aed6c=_0x2854ea[_0xadcd('0x17')]({'plain':!![]});if(_0x3aed6c[_0xadcd('0x14')]){return _0x103345['MailMessage']['update']({'read':!![]},{'where':{'MailInteractionId':_0x3aed6c['id']}})[_0xadcd('0x18')](function(){_0x9c0979();})[_0xadcd('0x19')](function(_0xcde201){_0x9c0979(_0xcde201);});}else{_0x9c0979();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index cdec2a2..7255a00 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 _0x69a0=['../../config/logger','jayson/promise','client','http','defaults','redis','localhost','./mailInteraction.socket','register','request','then','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','MailInteraction','body','options','raw','where','attributes','limit','UpdateMailInteraction','stringify','ids','omit','spread','AddTags','lodash','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1570a9,_0x83a6b){var _0x2af35c=function(_0x5da49d){while(--_0x5da49d){_0x1570a9['push'](_0x1570a9['shift']());}};_0x2af35c(++_0x83a6b);}(_0x69a0,0x181));var _0x069a=function(_0x338c58,_0x125310){_0x338c58=_0x338c58-0x0;var _0x2112d4=_0x69a0[_0x338c58];return _0x2112d4;};'use strict';var _=require(_0x069a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x069a('0x1'));var fs=require('fs');var Redis=require(_0x069a('0x2'));var db=require(_0x069a('0x3'))['db'];var utils=require(_0x069a('0x4'));var logger=require(_0x069a('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x069a('0x6'));var client=jayson[_0x069a('0x7')][_0x069a('0x8')]({'port':0x232a});config['redis']=_[_0x069a('0x9')](config[_0x069a('0xa')],{'host':_0x069a('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x069a('0xa')]));require(_0x069a('0xc'))[_0x069a('0xd')](socket);function respondWithRpcPromise(_0x405114,_0x12aa2b,_0x2ce22c){return new BPromise(function(_0x4548af,_0x1de0ba){return client[_0x069a('0xe')](_0x405114,_0x2ce22c)[_0x069a('0xf')](function(_0x4c0480){logger[_0x069a('0x10')]('MailInteraction,\x20%s,\x20%s',_0x12aa2b,_0x069a('0x11'));logger[_0x069a('0x12')](_0x069a('0x13'),_0x12aa2b,_0x069a('0x11'),JSON['stringify'](_0x4c0480));if(_0x4c0480['error']){if(_0x4c0480[_0x069a('0x14')][_0x069a('0x15')]===0x1f4){logger[_0x069a('0x14')](_0x069a('0x16'),_0x12aa2b,_0x4c0480[_0x069a('0x14')][_0x069a('0x17')]);return _0x1de0ba(_0x4c0480[_0x069a('0x14')][_0x069a('0x17')]);}logger[_0x069a('0x14')](_0x069a('0x16'),_0x12aa2b,_0x4c0480[_0x069a('0x14')][_0x069a('0x17')]);return _0x4548af(_0x4c0480['error']['message']);}else{logger[_0x069a('0x10')](_0x069a('0x16'),_0x12aa2b,_0x069a('0x11'));_0x4548af(_0x4c0480[_0x069a('0x18')][_0x069a('0x17')]);}})[_0x069a('0x19')](function(_0x333aa3){logger[_0x069a('0x14')](_0x069a('0x16'),_0x12aa2b,_0x333aa3);_0x1de0ba(_0x333aa3);});});}exports['UpdateMailInteraction']=function(_0x63ca6a){var _0x49ef46=this;return new Promise(function(_0xd92ac,_0xd69a3){return db[_0x069a('0x1a')]['update'](_0x63ca6a[_0x069a('0x1b')],{'raw':_0x63ca6a['options']?_0x63ca6a[_0x069a('0x1c')][_0x069a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x63ca6a[_0x069a('0x1c')]?_0x63ca6a[_0x069a('0x1c')][_0x069a('0x1e')]||null:null,'attributes':_0x63ca6a['options']?_0x63ca6a[_0x069a('0x1c')][_0x069a('0x1f')]||null:null,'limit':_0x63ca6a[_0x069a('0x1c')]?_0x63ca6a[_0x069a('0x1c')][_0x069a('0x20')]||null:null})['then'](function(_0x4a14e6){logger[_0x069a('0x10')](_0x069a('0x21'),_0x63ca6a);logger[_0x069a('0x12')](_0x069a('0x21'),_0x63ca6a,JSON[_0x069a('0x22')](_0x4a14e6));_0xd92ac(_0x4a14e6);})[_0x069a('0x19')](function(_0xc8d40d){logger['error'](_0x069a('0x21'),_0xc8d40d[_0x069a('0x17')],_0x63ca6a);_0xd69a3(_0x49ef46[_0x069a('0x14')](0x1f4,_0xc8d40d[_0x069a('0x17')]));});});};exports['AddTagsToMailInteraction']=function(_0x34926c){return new Promise(function(_0x1207b4,_0x37d88a){return db['MailInteraction']['find']({'where':_0x34926c[_0x069a('0x1c')]?_0x34926c['options'][_0x069a('0x1e')]||null:null})[_0x069a('0xf')](function(_0x4d61e4){if(_0x4d61e4){return _0x4d61e4['addTags'](_0x34926c[_0x069a('0x1b')][_0x069a('0x23')],_[_0x069a('0x24')](_0x34926c[_0x069a('0x1b')],[_0x069a('0x23'),'id'])||{});}})[_0x069a('0x25')](function(_0x16f0f7){logger['info'](_0x069a('0x26'),_0x34926c);logger[_0x069a('0x12')](_0x069a('0x26'),_0x34926c,JSON['stringify'](_0x16f0f7));_0x1207b4(_0x16f0f7);})[_0x069a('0x19')](function(_0x421c0d){logger[_0x069a('0x14')](_0x069a('0x26'),_0x421c0d[_0x069a('0x17')],_0x34926c);_0x37d88a(_this[_0x069a('0x14')](0x1f4,_0x421c0d[_0x069a('0x17')]));});});}; \ No newline at end of file +var _0xcb95=['code','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','raw','options','attributes','limit','stringify','find','omit','ids','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x5a0bfa,_0x15771f){var _0x32babf=function(_0x34bf55){while(--_0x34bf55){_0x5a0bfa['push'](_0x5a0bfa['shift']());}};_0x32babf(++_0x15771f);}(_0xcb95,0xb5));var _0x5cb9=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xcb95[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x5cb9('0x0'));var util=require(_0x5cb9('0x1'));var moment=require(_0x5cb9('0x2'));var BPromise=require('bluebird');var rs=require(_0x5cb9('0x3'));var fs=require('fs');var Redis=require(_0x5cb9('0x4'));var db=require(_0x5cb9('0x5'))['db'];var utils=require(_0x5cb9('0x6'));var logger=require(_0x5cb9('0x7'))(_0x5cb9('0x8'));var config=require('../../config/environment');var jayson=require(_0x5cb9('0x9'));var client=jayson[_0x5cb9('0xa')]['http']({'port':0x232a});config[_0x5cb9('0xb')]=_[_0x5cb9('0xc')](config[_0x5cb9('0xb')],{'host':_0x5cb9('0xd'),'port':0x18eb});var socket=require(_0x5cb9('0xe'))(new Redis(config[_0x5cb9('0xb')]));require(_0x5cb9('0xf'))[_0x5cb9('0x10')](socket);function respondWithRpcPromise(_0xe0d19b,_0x45b51f,_0x38b4e1){return new BPromise(function(_0x9a629e,_0x472547){return client[_0x5cb9('0x11')](_0xe0d19b,_0x38b4e1)[_0x5cb9('0x12')](function(_0x306c1b){logger[_0x5cb9('0x13')](_0x5cb9('0x14'),_0x45b51f,_0x5cb9('0x15'));logger[_0x5cb9('0x16')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x45b51f,_0x5cb9('0x15'),JSON['stringify'](_0x306c1b));if(_0x306c1b['error']){if(_0x306c1b[_0x5cb9('0x17')][_0x5cb9('0x18')]===0x1f4){logger[_0x5cb9('0x17')](_0x5cb9('0x14'),_0x45b51f,_0x306c1b['error'][_0x5cb9('0x19')]);return _0x472547(_0x306c1b[_0x5cb9('0x17')][_0x5cb9('0x19')]);}logger['error'](_0x5cb9('0x14'),_0x45b51f,_0x306c1b['error'][_0x5cb9('0x19')]);return _0x9a629e(_0x306c1b['error']['message']);}else{logger['info'](_0x5cb9('0x14'),_0x45b51f,_0x5cb9('0x15'));_0x9a629e(_0x306c1b[_0x5cb9('0x1a')]['message']);}})[_0x5cb9('0x1b')](function(_0x27b9d1){logger['error']('MailInteraction,\x20%s,\x20%s',_0x45b51f,_0x27b9d1);_0x472547(_0x27b9d1);});});}exports[_0x5cb9('0x1c')]=function(_0x53eb54){var _0x1b9306=this;return new Promise(function(_0x1efa79,_0x45b837){return db[_0x5cb9('0x1d')][_0x5cb9('0x1e')](_0x53eb54[_0x5cb9('0x1f')],{'raw':_0x53eb54['options']?_0x53eb54['options'][_0x5cb9('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53eb54[_0x5cb9('0x21')]?_0x53eb54['options']['where']||null:null,'attributes':_0x53eb54[_0x5cb9('0x21')]?_0x53eb54['options'][_0x5cb9('0x22')]||null:null,'limit':_0x53eb54[_0x5cb9('0x21')]?_0x53eb54[_0x5cb9('0x21')][_0x5cb9('0x23')]||null:null})[_0x5cb9('0x12')](function(_0x2222fc){logger['info'](_0x5cb9('0x1c'),_0x53eb54);logger[_0x5cb9('0x16')]('UpdateMailInteraction',_0x53eb54,JSON[_0x5cb9('0x24')](_0x2222fc));_0x1efa79(_0x2222fc);})[_0x5cb9('0x1b')](function(_0x347d16){logger[_0x5cb9('0x17')](_0x5cb9('0x1c'),_0x347d16['message'],_0x53eb54);_0x45b837(_0x1b9306[_0x5cb9('0x17')](0x1f4,_0x347d16[_0x5cb9('0x19')]));});});};exports['AddTagsToMailInteraction']=function(_0x2c5e3f){return new Promise(function(_0x4b49f5,_0x15d8c2){return db[_0x5cb9('0x1d')][_0x5cb9('0x25')]({'where':_0x2c5e3f[_0x5cb9('0x21')]?_0x2c5e3f[_0x5cb9('0x21')]['where']||null:null})[_0x5cb9('0x12')](function(_0x5d0857){if(_0x5d0857){return _0x5d0857['addTags'](_0x2c5e3f[_0x5cb9('0x1f')]['ids'],_[_0x5cb9('0x26')](_0x2c5e3f[_0x5cb9('0x1f')],[_0x5cb9('0x27'),'id'])||{});}})['spread'](function(_0x352342){logger[_0x5cb9('0x13')](_0x5cb9('0x28'),_0x2c5e3f);logger[_0x5cb9('0x16')](_0x5cb9('0x28'),_0x2c5e3f,JSON[_0x5cb9('0x24')](_0x352342));_0x4b49f5(_0x352342);})[_0x5cb9('0x1b')](function(_0x245eae){logger[_0x5cb9('0x17')](_0x5cb9('0x28'),_0x245eae[_0x5cb9('0x19')],_0x2c5e3f);_0x15d8c2(_this['error'](0x1f4,_0x245eae[_0x5cb9('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index da4c111..7248451 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 _0x7dde=['./mailInteraction.events','save','register','length','mailInteraction:'];(function(_0x1bee7d,_0x346017){var _0x1d7881=function(_0x1000a6){while(--_0x1000a6){_0x1bee7d['push'](_0x1bee7d['shift']());}};_0x1d7881(++_0x346017);}(_0x7dde,0xf5));var _0xe7dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dde[_0x3dd15e];return _0x231fd0;};'use strict';var MailInteractionEvents=require(_0xe7dd('0x0'));var events=[_0xe7dd('0x1'),'remove','update'];function createListener(_0x577888,_0x24c96b){return function(_0x48bef1){_0x24c96b['emit'](_0x577888,_0x48bef1);};}function removeListener(_0x5625e3,_0x4aa08e){return function(){MailInteractionEvents['removeListener'](_0x5625e3,_0x4aa08e);};}exports[_0xe7dd('0x2')]=function(_0xf7269a){for(var _0x368a43=0x0,_0xe757ee=events[_0xe7dd('0x3')];_0x368a43<_0xe757ee;_0x368a43++){var _0x345e05=events[_0x368a43];var _0x5d55ae=createListener(_0xe7dd('0x4')+_0x345e05,_0xf7269a);MailInteractionEvents['on'](_0x345e05,_0x5d55ae);}}; \ No newline at end of file +var _0x1f53=['update','length','./mailInteraction.events','save','remove'];(function(_0x145f59,_0x3c0e1f){var _0x3c98cc=function(_0x5c0950){while(--_0x5c0950){_0x145f59['push'](_0x145f59['shift']());}};_0x3c98cc(++_0x3c0e1f);}(_0x1f53,0x16a));var _0x31f5=function(_0x37617e,_0x32c88c){_0x37617e=_0x37617e-0x0;var _0x41db69=_0x1f53[_0x37617e];return _0x41db69;};'use strict';var MailInteractionEvents=require(_0x31f5('0x0'));var events=[_0x31f5('0x1'),_0x31f5('0x2'),_0x31f5('0x3')];function createListener(_0x49540d,_0x2201db){return function(_0x306538){_0x2201db['emit'](_0x49540d,_0x306538);};}function removeListener(_0x3330c2,_0x8ec072){return function(){MailInteractionEvents['removeListener'](_0x3330c2,_0x8ec072);};}exports['register']=function(_0x52aa95){for(var _0x402ea6=0x0,_0x40ded6=events[_0x31f5('0x4')];_0x402ea6<_0x40ded6;_0x402ea6++){var _0x58c14=events[_0x402ea6];var _0x536527=createListener('mailInteraction:'+_0x58c14,_0x52aa95);MailInteractionEvents['on'](_0x58c14,_0x536527);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index 2c9cafb..e03822a 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x496e=['exports','Router','../../components/auth/service','./mailInteractionHasTag.controller','get'];(function(_0x11a379,_0x572c80){var _0xc53c9f=function(_0x4fc488){while(--_0x4fc488){_0x11a379['push'](_0x11a379['shift']());}};_0xc53c9f(++_0x572c80);}(_0x496e,0x1a0));var _0xe496=function(_0x721e19,_0x4e57c0){_0x721e19=_0x721e19-0x0;var _0x159cfd=_0x496e[_0x721e19];return _0x159cfd;};'use strict';var express=require('express');var router=express[_0xe496('0x0')]();var auth=require(_0xe496('0x1'));var controller=require(_0xe496('0x2'));router[_0xe496('0x3')]('/describe',auth['isAuthenticated'](),controller['describe']);module[_0xe496('0x4')]=router; \ No newline at end of file +var _0x543b=['../../components/auth/service','get','/describe','isAuthenticated','exports','express','Router'];(function(_0x508e7a,_0x57e8bc){var _0x54df90=function(_0x4cbb3c){while(--_0x4cbb3c){_0x508e7a['push'](_0x508e7a['shift']());}};_0x54df90(++_0x57e8bc);}(_0x543b,0x18d));var _0xb543=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x543b[_0x2dafbe];return _0x58a45a;};'use strict';var express=require(_0xb543('0x0'));var router=express[_0xb543('0x1')]();var auth=require(_0xb543('0x2'));var controller=require('./mailInteractionHasTag.controller');router[_0xb543('0x3')](_0xb543('0x4'),auth[_0xb543('0x5')](),controller['describe']);module[_0xb543('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index baa6070..779fca8 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x28d860,_0x37b892){var _0x516d56=function(_0x3d3a0e){while(--_0x3d3a0e){_0x28d860['push'](_0x28d860['shift']());}};_0x516d56(++_0x37b892);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x18e899,_0x50cd42){var _0x3ae0dd=function(_0x2d89b0){while(--_0x2d89b0){_0x18e899['push'](_0x18e899['shift']());}};_0x3ae0dd(++_0x50cd42);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index 835c7d8..48d8556 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3df0=['exports','INTEGER'];(function(_0x162218,_0x10fd02){var _0x3b3b9a=function(_0x358cbe){while(--_0x358cbe){_0x162218['push'](_0x162218['shift']());}};_0x3b3b9a(++_0x10fd02);}(_0x3df0,0x116));var _0x03df=function(_0x3d4d54,_0xc9b2db){_0x3d4d54=_0x3d4d54-0x0;var _0x4c2878=_0x3df0[_0x3d4d54];return _0x4c2878;};'use strict';var Sequelize=require('sequelize');module[_0x03df('0x0')]={'MailInteractionId':{'type':Sequelize[_0x03df('0x1')],'primaryKey':!![]},'TagId':{'type':Sequelize['INTEGER'],'defaultValue':null}}; \ No newline at end of file +var _0x24a4=['INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x24a4,0x67));var _0x424a=function(_0x74b615,_0x300db4){_0x74b615=_0x74b615-0x0;var _0x149321=_0x24a4[_0x74b615];return _0x149321;};'use strict';var Sequelize=require(_0x424a('0x0'));module[_0x424a('0x1')]={'MailInteractionId':{'type':Sequelize[_0x424a('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize['INTEGER'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index b5485d8..71509e8 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x235c=['mail_interaction_has_tags','MailInteractionHasTag'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x235c,0x1e7));var _0xc235=function(_0x3162e3,_0x1753b7){_0x3162e3=_0x3162e3-0x0;var _0x38c9b5=_0x235c[_0x3162e3];return _0x38c9b5;};'use strict';var attributes=require('./mailInteractionHasTag');module['exports']=function(_0x425e43){return _0x425e43['define'](_0xc235('0x0'),attributes,{'tableName':_0xc235('0x1'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1de8=['define','mail_interaction_has_tags','./mailInteractionHasTag'];(function(_0x360916,_0x4ed563){var _0x7f9f83=function(_0x287741){while(--_0x287741){_0x360916['push'](_0x360916['shift']());}};_0x7f9f83(++_0x4ed563);}(_0x1de8,0x10a));var _0x81de=function(_0xf80b3,_0x25d5f3){_0xf80b3=_0xf80b3-0x0;var _0x10c489=_0x1de8[_0xf80b3];return _0x10c489;};'use strict';var attributes=require(_0x81de('0x0'));module['exports']=function(_0x20a3c6){return _0x20a3c6[_0x81de('0x1')]('MailInteractionHasTag',attributes,{'tableName':_0x81de('0x2'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 5d41c03..3d050d3 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 _0x1cf6=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','tracked','mailmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','destroy','exports'];(function(_0x5cd395,_0x507285){var _0x141227=function(_0x5893fe){while(--_0x5893fe){_0x5cd395['push'](_0x5cd395['shift']());}};_0x141227(++_0x507285);}(_0x1cf6,0x1a4));var _0x61cf=function(_0x447ede,_0xbad733){_0x447ede=_0x447ede-0x0;var _0xe684f7=_0x1cf6[_0x447ede];return _0xe684f7;};'use strict';var multer=require('multer');var util=require(_0x61cf('0x0'));var path=require(_0x61cf('0x1'));var timeout=require(_0x61cf('0x2'));var express=require(_0x61cf('0x3'));var router=express[_0x61cf('0x4')]();var fs_extra=require(_0x61cf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x61cf('0x6'));var config=require(_0x61cf('0x7'));var controller=require(_0x61cf('0x8'));router[_0x61cf('0x9')]('/',auth[_0x61cf('0xa')](),controller[_0x61cf('0xb')]);router[_0x61cf('0x9')](_0x61cf('0xc'),auth[_0x61cf('0xa')](),controller[_0x61cf('0xd')]);router[_0x61cf('0x9')](_0x61cf('0xe'),auth[_0x61cf('0xa')](),controller[_0x61cf('0xf')]);router[_0x61cf('0x9')](_0x61cf('0x10'),auth['isAuthenticated'](),controller[_0x61cf('0x11')]);router['post']('/',auth[_0x61cf('0xa')](),interaction[_0x61cf('0x12')]('mail',_0x61cf('0x13')),controller[_0x61cf('0x14')]);router[_0x61cf('0x15')](_0x61cf('0xe'),auth[_0x61cf('0xa')](),controller['update']);router['put'](_0x61cf('0x16'),auth[_0x61cf('0xa')](),controller[_0x61cf('0x17')]);router[_0x61cf('0x15')](_0x61cf('0x18'),auth[_0x61cf('0xa')](),controller[_0x61cf('0x19')]);router['delete'](_0x61cf('0xe'),auth[_0x61cf('0xa')](),controller[_0x61cf('0x1a')]);module[_0x61cf('0x1b')]=router; \ No newline at end of file +var _0x042a=['put','/:id/accept','accept','/:id/reject','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','isAuthenticated','describe','/:id','show','get','post','tracked','mail','mailmessage:create'];(function(_0x159b40,_0x323562){var _0x543c1f=function(_0x499676){while(--_0x499676){_0x159b40['push'](_0x159b40['shift']());}};_0x543c1f(++_0x323562);}(_0x042a,0x1ce));var _0xa042=function(_0x49fc97,_0x191334){_0x49fc97=_0x49fc97-0x0;var _0x7a531a=_0x042a[_0x49fc97];return _0x7a531a;};'use strict';var multer=require(_0xa042('0x0'));var util=require(_0xa042('0x1'));var path=require(_0xa042('0x2'));var timeout=require(_0xa042('0x3'));var express=require('express');var router=express[_0xa042('0x4')]();var fs_extra=require(_0xa042('0x5'));var auth=require(_0xa042('0x6'));var interaction=require(_0xa042('0x7'));var config=require('../../config/environment');var controller=require(_0xa042('0x8'));router['get']('/',auth[_0xa042('0x9')](),controller['index']);router['get']('/describe',auth[_0xa042('0x9')](),controller[_0xa042('0xa')]);router['get'](_0xa042('0xb'),auth[_0xa042('0x9')](),controller[_0xa042('0xc')]);router[_0xa042('0xd')]('/:id/download',auth[_0xa042('0x9')](),controller['download']);router[_0xa042('0xe')]('/',auth[_0xa042('0x9')](),interaction[_0xa042('0xf')](_0xa042('0x10'),_0xa042('0x11')),controller['create']);router['put'](_0xa042('0xb'),auth[_0xa042('0x9')](),controller['update']);router[_0xa042('0x12')](_0xa042('0x13'),auth[_0xa042('0x9')](),controller[_0xa042('0x14')]);router[_0xa042('0x12')](_0xa042('0x15'),auth['isAuthenticated'](),controller['reject']);router[_0xa042('0x16')](_0xa042('0xb'),auth[_0xa042('0x9')](),controller[_0xa042('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 1f51828..4f2cfa0 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 _0x8c50=['Chat','lodash','exports','long','TEXT','medium','BOOLEAN','ENUM','out','DATE','INTEGER','Email'];(function(_0x29d6e6,_0x264220){var _0xc75ff0=function(_0x214f6b){while(--_0x214f6b){_0x29d6e6['push'](_0x29d6e6['shift']());}};_0xc75ff0(++_0x264220);}(_0x8c50,0xcd));var _0x08c5=function(_0x21a3ee,_0x44d9ad){_0x21a3ee=_0x21a3ee-0x0;var _0x3f20fb=_0x8c50[_0x21a3ee];return _0x3f20fb;};'use strict';var Sequelize=require('sequelize');var _=require(_0x08c5('0x0'));module[_0x08c5('0x1')]={'body':{'type':Sequelize['TEXT'](_0x08c5('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x08c5('0x3')](_0x08c5('0x4'))},'read':{'type':Sequelize[_0x08c5('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x08c5('0x6')]('in','out'),'defaultValue':_0x08c5('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x08c5('0x3')](_0x08c5('0x2'))},'cc':{'type':Sequelize['TEXT'](_0x08c5('0x2'))},'bcc':{'type':Sequelize['TEXT'](_0x08c5('0x2'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x08c5('0x8')]},'attach':{'type':Sequelize[_0x08c5('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x08c5('0x8')]},'originTo':{'type':Sequelize[_0x08c5('0x3')](_0x08c5('0x2'))},'originCc':{'type':Sequelize[_0x08c5('0x3')](_0x08c5('0x2'))},'originChannel':{'type':Sequelize[_0x08c5('0x6')](_0x08c5('0xa'),_0x08c5('0xb')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0xf0ba=['long','medium','ENUM','out','STRING','DATE','INTEGER','BOOLEAN','Chat','Email','sequelize','lodash','exports','TEXT'];(function(_0x1af1dc,_0x1ee272){var _0x218c76=function(_0x514dc4){while(--_0x514dc4){_0x1af1dc['push'](_0x1af1dc['shift']());}};_0x218c76(++_0x1ee272);}(_0xf0ba,0x7a));var _0xaf0b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf0ba[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xaf0b('0x0'));var _=require(_0xaf0b('0x1'));module[_0xaf0b('0x2')]={'body':{'type':Sequelize[_0xaf0b('0x3')](_0xaf0b('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xaf0b('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xaf0b('0x6')]('in',_0xaf0b('0x7')),'defaultValue':_0xaf0b('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xaf0b('0x8')](0x1fe)},'from':{'type':Sequelize[_0xaf0b('0x8')]},'to':{'type':Sequelize[_0xaf0b('0x3')](_0xaf0b('0x4'))},'cc':{'type':Sequelize[_0xaf0b('0x3')](_0xaf0b('0x4'))},'bcc':{'type':Sequelize[_0xaf0b('0x3')](_0xaf0b('0x4'))},'subject':{'type':Sequelize[_0xaf0b('0x3')]},'sentAt':{'type':Sequelize[_0xaf0b('0x9')]},'attach':{'type':Sequelize[_0xaf0b('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xaf0b('0xb')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xaf0b('0x9')]},'originTo':{'type':Sequelize[_0xaf0b('0x3')](_0xaf0b('0x4'))},'originCc':{'type':Sequelize[_0xaf0b('0x3')]('long')},'originChannel':{'type':Sequelize[_0xaf0b('0x6')]('Email',_0xaf0b('0xc')),'defaultValue':_0xaf0b('0xd'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index cfed7e7..3bbef59 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 _0xeacd=['offset','set','Content-Range','json','update','end','sendStatus','name','send','index','MailMessage','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','params','rawAttributes','body','find','destroy','describe','create','direction','out','secret','split','findOne','MailAccountId','List','CmContact','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','basename','Contacts','ListId','List\x20not\x20found','SendMail','sendMail','YYYY-MM-DD\x20HH:mm:ss','stringify','mail','readAt','UserId','agent','get','MailInteraction','isNil','read1stAt','format','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','channel','event','accept','fromString','EventManager','reject','MailInteractionId','info','role','SIP/%s','motionChannel','rejectmessage','unix','toString','root','files','server','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','writeFileSync','download','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','redis','defaults','socket.io-emitter','./mailMessage.socket','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','undefined','limit'];(function(_0x24f326,_0x616a7){var _0x488e2d=function(_0x293d9a){while(--_0x293d9a){_0x24f326['push'](_0x24f326['shift']());}};_0x488e2d(++_0x616a7);}(_0xeacd,0x1ba));var _0xdeac=function(_0x4d3b24,_0x32d325){_0x4d3b24=_0x4d3b24-0x0;var _0x45eab1=_0xeacd[_0x4d3b24];return _0x45eab1;};'use strict';var emlformat=require('eml-format');var moment=require(_0xdeac('0x0'));var BPromise=require(_0xdeac('0x1'));var util=require(_0xdeac('0x2'));var path=require(_0xdeac('0x3'));var fs=require('fs');var _=require(_0xdeac('0x4'));var Redis=require(_0xdeac('0x5'));var htmlToText=require(_0xdeac('0x6'));var qs=require(_0xdeac('0x7'));var logger=require(_0xdeac('0x8'))(_0xdeac('0x9'));var interaction_log=require(_0xdeac('0x8'))(_0xdeac('0xa'));var config=require(_0xdeac('0xb'));var db=require('../../mysqldb')['db'];config[_0xdeac('0xc')]=_[_0xdeac('0xd')](config[_0xdeac('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdeac('0xe'))(new Redis(config['redis']));var htmlEntities=require('html-entities');require(_0xdeac('0xf'))['register'](socket);var jayson=require(_0xdeac('0x10'));var client=jayson[_0xdeac('0x11')][_0xdeac('0x12')]({'port':0x232c});var client9003=jayson[_0xdeac('0x11')][_0xdeac('0x12')]({'port':0x232b});var client9002=jayson['client'][_0xdeac('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x28c77a,_0x4a2075,_0x13ffe6,_0x55e4e8){return new BPromise(function(_0x572152,_0x25a204){var _0x44bdf8=_0x55e4e8||client;return _0x44bdf8[_0xdeac('0x13')](_0x28c77a,_0x13ffe6)[_0xdeac('0x14')](function(_0x21b7fd){logger['info'](_0xdeac('0x15'),_0x4a2075,_0xdeac('0x16'));logger[_0xdeac('0x17')](_0xdeac('0x18'),_0x4a2075,_0xdeac('0x16'),JSON['stringify'](_0x21b7fd));if(_0x21b7fd[_0xdeac('0x19')]){if(_0x21b7fd[_0xdeac('0x19')]['code']===0x1f4){logger[_0xdeac('0x19')](_0xdeac('0x15'),_0x4a2075,_0x21b7fd['error']['message']);return _0x25a204(_0x21b7fd[_0xdeac('0x19')][_0xdeac('0x1a')]);}logger[_0xdeac('0x19')](_0xdeac('0x15'),_0x4a2075,_0x21b7fd['error']['message']);return _0x572152(_0x21b7fd[_0xdeac('0x19')][_0xdeac('0x1a')]);}else{logger['info'](_0xdeac('0x15'),_0x4a2075,'request\x20sent');_0x572152(_0x21b7fd[_0xdeac('0x1b')]['message']);}})[_0xdeac('0x1c')](function(_0x2ffa8a){logger[_0xdeac('0x19')](_0xdeac('0x15'),_0x4a2075,_0x2ffa8a);_0x25a204(_0x2ffa8a);});});}function respondWithResult(_0x4bac0c,_0x4fa84d){_0x4fa84d=_0x4fa84d||0xc8;return function(_0x3e3132){if(_0x3e3132){return _0x4bac0c[_0xdeac('0x1d')](_0x4fa84d)['json'](_0x3e3132);}};}function respondWithFilteredResult(_0x15f68c,_0x1b7c13){return function(_0x1af216){if(_0x1af216){var _0x2f2f4b=typeof _0x1b7c13['offset']===_0xdeac('0x1e')&&typeof _0x1b7c13[_0xdeac('0x1f')]===_0xdeac('0x1e');var _0x1c06ba=_0x1af216['count'];var _0x28219e=_0x2f2f4b?0x0:_0x1b7c13['offset'];var _0x5a090c=_0x2f2f4b?_0x1af216['count']:_0x1b7c13[_0xdeac('0x20')]+_0x1b7c13['limit'];var _0x426bb4;if(_0x5a090c>=_0x1c06ba){_0x5a090c=_0x1c06ba;_0x426bb4=0xc8;}else{_0x426bb4=0xce;}_0x15f68c['status'](_0x426bb4);return _0x15f68c[_0xdeac('0x21')](_0xdeac('0x22'),_0x28219e+'-'+_0x5a090c+'/'+_0x1c06ba)[_0xdeac('0x23')](_0x1af216);}return null;};}function saveUpdates(_0x4bb600){return function(_0x3d197b){if(_0x3d197b){return _0x3d197b[_0xdeac('0x24')](_0x4bb600)[_0xdeac('0x14')](function(_0x30b410){return _0x30b410;});}return null;};}function removeEntity(_0xd4d4f2){return function(_0x4f03a1){if(_0x4f03a1){return _0x4f03a1['destroy']()[_0xdeac('0x14')](function(){_0xd4d4f2[_0xdeac('0x1d')](0xcc)[_0xdeac('0x25')]();});}};}function handleEntityNotFound(_0x3f888c){return function(_0x3a73b8){if(!_0x3a73b8){_0x3f888c[_0xdeac('0x26')](0x194);}return _0x3a73b8;};}function handleError(_0x128327,_0x4e4983){_0x4e4983=_0x4e4983||0x1f4;return function(_0x24f91c){logger[_0xdeac('0x19')](_0x24f91c['stack']);if(_0x24f91c[_0xdeac('0x27')]){delete _0x24f91c[_0xdeac('0x27')];}_0x128327[_0xdeac('0x1d')](_0x4e4983)[_0xdeac('0x28')](_0x24f91c);};}exports[_0xdeac('0x29')]=function(_0x2a6e70,_0x452908){var _0x1af247={},_0xa85030={},_0x1fc446={'count':0x0,'rows':[]};var _0x4b52d4=_['map'](db[_0xdeac('0x2a')]['rawAttributes'],function(_0x31650a){return{'name':_0x31650a[_0xdeac('0x2b')],'type':_0x31650a['type']['key']};});_0xa85030[_0xdeac('0x2c')]=_[_0xdeac('0x2d')](_0x4b52d4,_0xdeac('0x27'));_0xa85030[_0xdeac('0x2e')]=_[_0xdeac('0x2f')](_0x2a6e70[_0xdeac('0x2e')]);_0xa85030[_0xdeac('0x30')]=_[_0xdeac('0x31')](_0xa85030[_0xdeac('0x2c')],_0xa85030[_0xdeac('0x2e')]);_0x1af247[_0xdeac('0x32')]=_[_0xdeac('0x31')](_0xa85030[_0xdeac('0x2c')],qs[_0xdeac('0x33')](_0x2a6e70[_0xdeac('0x2e')][_0xdeac('0x33')]));_0x1af247[_0xdeac('0x32')]=_0x1af247['attributes'][_0xdeac('0x34')]?_0x1af247[_0xdeac('0x32')]:_0xa85030['model'];if(!_0x2a6e70[_0xdeac('0x2e')][_0xdeac('0x35')](_0xdeac('0x36'))){_0x1af247[_0xdeac('0x1f')]=qs[_0xdeac('0x1f')](_0x2a6e70[_0xdeac('0x2e')]['limit']);_0x1af247['offset']=qs[_0xdeac('0x20')](_0x2a6e70['query'][_0xdeac('0x20')]);}_0x1af247['order']=qs[_0xdeac('0x37')](_0x2a6e70['query'][_0xdeac('0x37')]);_0x1af247[_0xdeac('0x38')]=qs['filters'](_[_0xdeac('0x39')](_0x2a6e70['query'],_0xa85030['filters']),_0x4b52d4);if(_0x2a6e70[_0xdeac('0x2e')][_0xdeac('0x3a')]){_0x1af247[_0xdeac('0x38')]=_['merge'](_0x1af247[_0xdeac('0x38')],{'$or':_[_0xdeac('0x2d')](_0x4b52d4,function(_0xae45cd){if(_0xae45cd[_0xdeac('0x3b')]!==_0xdeac('0x3c')){var _0xf4c716={};_0xf4c716[_0xae45cd[_0xdeac('0x27')]]={'$like':'%'+_0x2a6e70[_0xdeac('0x2e')][_0xdeac('0x3a')]+'%'};return _0xf4c716;}})});}_0x1af247=_[_0xdeac('0x3d')]({},_0x1af247,_0x2a6e70[_0xdeac('0x3e')]);var _0x190640={'where':_0x1af247[_0xdeac('0x38')]};return db['MailMessage']['count'](_0x190640)[_0xdeac('0x14')](function(_0x147906){_0x1fc446[_0xdeac('0x3f')]=_0x147906;if(_0x2a6e70['query'][_0xdeac('0x40')]){_0x1af247[_0xdeac('0x41')]=[{'all':!![]}];}return db[_0xdeac('0x2a')][_0xdeac('0x42')](_0x1af247);})['then'](function(_0x4a0f2a){_0x1fc446[_0xdeac('0x43')]=_0x4a0f2a;return _0x1fc446;})[_0xdeac('0x14')](respondWithFilteredResult(_0x452908,_0x1af247))[_0xdeac('0x1c')](handleError(_0x452908,null));};exports[_0xdeac('0x44')]=function(_0x1539a4,_0x21e2c4){var _0x19fc50={'raw':!![],'where':{'id':_0x1539a4[_0xdeac('0x45')]['id']}},_0x2b8ffb={};_0x2b8ffb[_0xdeac('0x2c')]=_[_0xdeac('0x2f')](db[_0xdeac('0x2a')][_0xdeac('0x46')]);_0x2b8ffb[_0xdeac('0x2e')]=_[_0xdeac('0x2f')](_0x1539a4['query']);_0x2b8ffb[_0xdeac('0x30')]=_[_0xdeac('0x31')](_0x2b8ffb[_0xdeac('0x2c')],_0x2b8ffb['query']);_0x19fc50[_0xdeac('0x32')]=_['intersection'](_0x2b8ffb['model'],qs[_0xdeac('0x33')](_0x1539a4['query'][_0xdeac('0x33')]));_0x19fc50[_0xdeac('0x32')]=_0x19fc50[_0xdeac('0x32')][_0xdeac('0x34')]?_0x19fc50['attributes']:_0x2b8ffb[_0xdeac('0x2c')];if(_0x1539a4[_0xdeac('0x2e')][_0xdeac('0x40')]){_0x19fc50[_0xdeac('0x41')]=[{'all':!![]}];}_0x19fc50=_[_0xdeac('0x3d')]({},_0x19fc50,_0x1539a4['options']);return db[_0xdeac('0x2a')]['find'](_0x19fc50)[_0xdeac('0x14')](handleEntityNotFound(_0x21e2c4,null))[_0xdeac('0x14')](respondWithResult(_0x21e2c4,null))['catch'](handleError(_0x21e2c4,null));};exports[_0xdeac('0x24')]=function(_0x5f454c,_0x35e2a8){if(_0x5f454c[_0xdeac('0x47')]['id']){delete _0x5f454c[_0xdeac('0x47')]['id'];}return db['MailMessage'][_0xdeac('0x48')]({'where':{'id':_0x5f454c['params']['id']}})[_0xdeac('0x14')](handleEntityNotFound(_0x35e2a8,null))['then'](saveUpdates(_0x5f454c[_0xdeac('0x47')],null))[_0xdeac('0x14')](respondWithResult(_0x35e2a8,null))[_0xdeac('0x1c')](handleError(_0x35e2a8,null));};exports[_0xdeac('0x49')]=function(_0x59e024,_0x59d919){return db[_0xdeac('0x2a')][_0xdeac('0x48')]({'where':{'id':_0x59e024['params']['id']}})[_0xdeac('0x14')](handleEntityNotFound(_0x59d919,null))[_0xdeac('0x14')](removeEntity(_0x59d919,null))['catch'](handleError(_0x59d919,null));};exports['describe']=function(_0x406da3,_0x3ca2d8){return db[_0xdeac('0x2a')][_0xdeac('0x4a')]()[_0xdeac('0x14')](respondWithResult(_0x3ca2d8,null))[_0xdeac('0x1c')](handleError(_0x3ca2d8,null));};exports[_0xdeac('0x4b')]=function(_0x439abe,_0x25881f){return db[_0xdeac('0x2a')][_0xdeac('0x4b')](_0x439abe[_0xdeac('0x47')])[_0xdeac('0x14')](function(_0x5d4ab9){if(_0x5d4ab9){if(_0x5d4ab9[_0xdeac('0x4c')]===_0xdeac('0x4d')&&!_0x5d4ab9[_0xdeac('0x4e')]){var _0x32b549,_0x38259b,_0x360fdc;if(_0x439abe['body']['to']){_0x38259b=_0x439abe['body']['to'][_0xdeac('0x4f')](',')[0x0];}return db['MailAccount'][_0xdeac('0x50')]({'where':{'id':_0x5d4ab9[_0xdeac('0x51')]},'include':[{'model':db['CmList'],'as':_0xdeac('0x52'),'include':[{'model':db[_0xdeac('0x53')],'as':'Contacts','where':{'email':_0x38259b},'limit':0x1,'order':[[_0xdeac('0x54'),_0xdeac('0x55')]]}]},{'model':db[_0xdeac('0x56')],'as':_0xdeac('0x57'),'raw':!![],'include':[{'model':db[_0xdeac('0x58')],'as':_0xdeac('0x58'),'raw':!![]}]}]})[_0xdeac('0x14')](function(_0x58e216){_0x32b549=_0x58e216;if(!_0x32b549||!_0x32b549[_0xdeac('0x57')])return;var _0x3ffc4d=_0x32b549[_0xdeac('0x59')]();if(_0x439abe[_0xdeac('0x47')][_0xdeac('0x5a')]&&_0x439abe['body'][_0xdeac('0x5a')][_0xdeac('0x34')]){for(var _0x53650b=0x0;_0x53650b<_0x439abe['body']['attachments']['length'];_0x53650b+=0x1){_0x439abe['body'][_0xdeac('0x5a')][_0x53650b]={'filename':_0x439abe['body'][_0xdeac('0x5a')][_0x53650b]['name'],'path':path[_0xdeac('0x5b')](config['root'],_0xdeac('0x5c'),_0x439abe['body'][_0xdeac('0x5a')][_0x53650b][_0xdeac('0x5d')])};}}_0x360fdc={'account':_0x3ffc4d,'message':_0x439abe['body']};return;})[_0xdeac('0x14')](function(){if(_0x32b549[_0xdeac('0x52')]){if(_0x32b549[_0xdeac('0x52')][_0xdeac('0x5e')][_0xdeac('0x34')]){return _0x32b549[_0xdeac('0x52')]['Contacts'][0x0];}else{return db[_0xdeac('0x53')]['create'](_['defaults'](_0x439abe[_0xdeac('0x47')],{'firstName':_0x439abe[_0xdeac('0x47')]['to'],'email':_0x439abe[_0xdeac('0x47')]['to'],'phone':_0x439abe['body']['to'],'ListId':_0x32b549[_0xdeac('0x5f')]}));}}else{throw new Error(_0xdeac('0x60'));}})[_0xdeac('0x14')](function(){if(_0x360fdc){return respondWithRpcPromise(_0xdeac('0x61'),_0xdeac('0x62'),_0x360fdc,client9003)[_0xdeac('0x14')](function(_0x33e21d){return _0x5d4ab9[_0xdeac('0x24')]({'read':!![],'messageId':_0x33e21d['messageId'],'sentAt':moment()['format'](_0xdeac('0x63'))});})[_0xdeac('0x1c')](function(_0x32e8ac){logger[_0xdeac('0x19')]('%s',JSON[_0xdeac('0x64')](_0x32e8ac));return _0x5d4ab9;});}return _0x5d4ab9;});}return _0x5d4ab9;}})[_0xdeac('0x14')](respondWithResult(_0x25881f,0xc9))[_0xdeac('0x1c')](handleError(_0x25881f,null));};exports['accept']=function(_0x56d056,_0x2cafc2){var _0x1bb2aa={'agent':{},'channel':_0xdeac('0x65')};if(_0x56d056[_0xdeac('0x47')]['id']){delete _0x56d056[_0xdeac('0x47')]['id'];}_0x56d056[_0xdeac('0x47')]['read']=!![];_0x56d056[_0xdeac('0x47')][_0xdeac('0x66')]=moment()['format'](_0xdeac('0x63'));_0x56d056[_0xdeac('0x47')][_0xdeac('0x67')]=_0x56d056[_0xdeac('0x47')][_0xdeac('0x67')]||_0x56d056['user']['id'];_0x1bb2aa[_0xdeac('0x68')]['id']=_0x56d056[_0xdeac('0x47')][_0xdeac('0x67')];return db[_0xdeac('0x2a')]['find']({'where':{'id':_0x56d056[_0xdeac('0x45')]['id'],'UserId':null}})[_0xdeac('0x14')](handleEntityNotFound(_0x2cafc2,null))[_0xdeac('0x14')](saveUpdates(_0x56d056['body'],null))[_0xdeac('0x14')](function(_0x581d7d){if(_0x581d7d){_0x1bb2aa['message']=_0x581d7d[_0xdeac('0x69')]({'plain':!![]});return db[_0xdeac('0x6a')][_0xdeac('0x48')]({'where':{'id':_0x581d7d['MailInteractionId']}});}return null;})[_0xdeac('0x14')](handleEntityNotFound(_0x2cafc2,null))[_0xdeac('0x14')](function(_0x1675b5){if(_0x1675b5){return _0x1675b5[_0xdeac('0x24')]({'UserId':_0x56d056[_0xdeac('0x47')][_0xdeac('0x67')],'read1stAt':_[_0xdeac('0x6b')](_0x1675b5[_0xdeac('0x6c')])?moment()[_0xdeac('0x6d')](_0xdeac('0x63')):undefined});}return null;})[_0xdeac('0x14')](function(_0x1f6577){if(_0x1f6577){_0x1bb2aa[_0xdeac('0x6e')]=_0x1f6577['get']({'plain':!![]});interaction_log['info'](_0xdeac('0x6f'),_0x56d056[_0xdeac('0x70')]['id'],_0x56d056[_0xdeac('0x70')][_0xdeac('0x27')],_0x56d056[_0xdeac('0x70')]['role'],_0x1bb2aa[_0xdeac('0x6e')]['id'],_0x56d056[_0xdeac('0x47')]?JSON[_0xdeac('0x64')](_0x56d056[_0xdeac('0x47')]):_0xdeac('0x71'));return respondWithRpcPromise(_0xdeac('0x72'),'acceptMessage',_0x1bb2aa);}return null;})[_0xdeac('0x14')](function(_0xe1f5f9){var _0x3920d9=_0xdeac('0x73')+_0xe1f5f9['message'][_0xdeac('0x74')];return db['sequelize'][_0xdeac('0x2e')](_0x3920d9,{'type':db['Sequelize'][_0xdeac('0x75')][_0xdeac('0x76')],'raw':!![]})['then'](function(_0x5b9121){return _0x5b9121;});})[_0xdeac('0x14')](function(_0x242e11){if(_0x242e11){_0x1bb2aa[_0xdeac('0x1a')][_0xdeac('0x77')]=_0x242e11[0x0];if(!_0x56d056[_0xdeac('0x47')][_0xdeac('0x67')])return;return db[_0xdeac('0x78')]['find']({'where':{'id':_0x56d056['body'][_0xdeac('0x67')],'role':_0xdeac('0x68')},'attributes':['id',_0xdeac('0x27'),_0xdeac('0x79'),_0xdeac('0x7a'),'internal'],'raw':!![]});}return null;})['then'](function(_0x354613){if(!_0x354613)return null;_0x1bb2aa[_0xdeac('0x1a')][_0xdeac('0x68')]=_0x354613;return _0x1bb2aa;})[_0xdeac('0x14')](function(_0x27bbe8){if(_0x27bbe8){if(_0x56d056[_0xdeac('0x47')][_0xdeac('0x7b')]){_0x1bb2aa[_0xdeac('0x1a')][_0xdeac('0x7c')]=util[_0xdeac('0x6d')]('SIP/%s',_0x56d056[_0xdeac('0x70')][_0xdeac('0x27')]);_0x1bb2aa[_0xdeac('0x1a')][_0xdeac('0x7d')]=_0x1bb2aa[_0xdeac('0x7d')];_0x1bb2aa[_0xdeac('0x1a')]['motionChannel']=_0x1bb2aa[_0xdeac('0x7d')];_0x1bb2aa[_0xdeac('0x1a')][_0xdeac('0x7e')]=_0xdeac('0x7f');_0x1bb2aa[_0xdeac('0x1a')][_0xdeac('0x47')]=htmlToText[_0xdeac('0x80')](_0x1bb2aa[_0xdeac('0x1a')][_0xdeac('0x47')]);return respondWithRpcPromise(_0xdeac('0x81'),'EventManager',{'event':'acceptmessage','message':_0x1bb2aa[_0xdeac('0x1a')]},client9002)[_0xdeac('0x14')](function(){return _0x1bb2aa;});}return _0x1bb2aa;}return null;})[_0xdeac('0x14')](respondWithResult(_0x2cafc2,null))[_0xdeac('0x1c')](handleError(_0x2cafc2,null));};exports[_0xdeac('0x82')]=function(_0x1f008f,_0x3b1a24){var _0x58143b={'agent':{},'channel':_0xdeac('0x65')};if(_0x1f008f[_0xdeac('0x47')]['id']){delete _0x1f008f[_0xdeac('0x47')]['id'];}_0x1f008f[_0xdeac('0x47')][_0xdeac('0x67')]=_0x1f008f['body'][_0xdeac('0x67')]||_0x1f008f['user']['id'];_0x58143b[_0xdeac('0x68')]['id']=_0x1f008f['body'][_0xdeac('0x67')];return db[_0xdeac('0x2a')][_0xdeac('0x48')]({'where':{'id':_0x1f008f[_0xdeac('0x45')]['id'],'UserId':null}})[_0xdeac('0x14')](handleEntityNotFound(_0x3b1a24,null))[_0xdeac('0x14')](function(_0x59d486){if(_0x59d486){_0x58143b[_0xdeac('0x1a')]=_0x59d486[_0xdeac('0x69')]({'plain':!![]});return db['MailInteraction'][_0xdeac('0x48')]({'where':{'id':_0x59d486[_0xdeac('0x83')]}});}return null;})[_0xdeac('0x14')](handleEntityNotFound(_0x3b1a24,null))['then'](function(_0x1a317f){if(_0x1a317f){_0x58143b[_0xdeac('0x6e')]=_0x1a317f['get']({'plain':!![]});interaction_log[_0xdeac('0x84')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1f008f[_0xdeac('0x70')]['id'],_0x1f008f[_0xdeac('0x70')][_0xdeac('0x27')],_0x1f008f[_0xdeac('0x70')][_0xdeac('0x85')],_0x58143b[_0xdeac('0x6e')]['id'],_0x1f008f[_0xdeac('0x47')]?JSON[_0xdeac('0x64')](_0x1f008f[_0xdeac('0x47')]):_0xdeac('0x71'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x58143b);}return null;})[_0xdeac('0x14')](function(_0x38668d){var _0x2e076e=_0xdeac('0x73')+_0x38668d['message'][_0xdeac('0x74')];return db['sequelize'][_0xdeac('0x2e')](_0x2e076e,{'type':db['Sequelize'][_0xdeac('0x75')][_0xdeac('0x76')],'raw':!![]})[_0xdeac('0x14')](function(_0x66fad3){return _0x66fad3;});})[_0xdeac('0x14')](function(_0x5d2b57){if(_0x5d2b57){_0x58143b[_0xdeac('0x1a')][_0xdeac('0x77')]=_0x5d2b57[0x0];if(!_0x1f008f[_0xdeac('0x47')][_0xdeac('0x67')])return;return db['User'][_0xdeac('0x48')]({'where':{'id':_0x1f008f['body'][_0xdeac('0x67')],'role':_0xdeac('0x68')},'attributes':['id',_0xdeac('0x27'),_0xdeac('0x79'),_0xdeac('0x7a'),'internal'],'raw':!![]});}return null;})[_0xdeac('0x14')](function(_0x11a68e){if(!_0x11a68e)return null;_0x58143b['message'][_0xdeac('0x68')]=_0x11a68e;return _0x58143b;})[_0xdeac('0x14')](function(_0x1cbddb){if(_0x1cbddb){_0x1cbddb[_0xdeac('0x1a')][_0xdeac('0x7c')]=util[_0xdeac('0x6d')](_0xdeac('0x86'),_0x1f008f[_0xdeac('0x70')][_0xdeac('0x27')]);_0x1cbddb[_0xdeac('0x1a')][_0xdeac('0x7d')]=_0x58143b[_0xdeac('0x7d')];_0x1cbddb[_0xdeac('0x1a')][_0xdeac('0x87')]=_0x58143b[_0xdeac('0x7d')];_0x1cbddb[_0xdeac('0x1a')][_0xdeac('0x7e')]='reject';_0x1cbddb[_0xdeac('0x1a')][_0xdeac('0x47')]=htmlToText[_0xdeac('0x80')](_0x58143b['message']['body']);respondWithRpcPromise(_0xdeac('0x81'),'EventManager',{'event':_0xdeac('0x88'),'message':_0x1cbddb[_0xdeac('0x1a')]},client9002);return _0x58143b;}return null;})['then'](respondWithResult(_0x3b1a24,null))[_0xdeac('0x1c')](handleError(_0x3b1a24,null));};exports['download']=function(_0x14716b,_0x3c5977){var _0x3c1880=moment()[_0xdeac('0x89')]()[_0xdeac('0x8a')]();var _0x3ee31e=path[_0xdeac('0x5b')](config[_0xdeac('0x8b')],'server',_0xdeac('0x8c'),'tmp');var _0x398192=path['join'](config[_0xdeac('0x8b')],_0xdeac('0x8d'),_0xdeac('0x8c'),_0xdeac('0x5a'));var _0x187f8f=util[_0xdeac('0x6d')](_0xdeac('0x8e'),_0x3c1880);return db[_0xdeac('0x2a')][_0xdeac('0x48')]({'where':{'id':_0x14716b['params']['id']},'attributes':['id',_0xdeac('0x47'),_0xdeac('0x8f'),'to','cc',_0xdeac('0x90'),_0xdeac('0x91'),_0xdeac('0x92')],'include':_0x14716b[_0xdeac('0x2e')][_0xdeac('0x5a')]?[{'model':db[_0xdeac('0x93')],'as':_0xdeac('0x94')}]:undefined})[_0xdeac('0x14')](handleEntityNotFound(_0x3c5977,null))['then'](function(_0x47acba){if(_0x47acba){var _0x1cd69e=_0x47acba;var _0x5326df={'from':_0x1cd69e[_0xdeac('0x8f')],'to':_0x1cd69e['to'],'subject':_0x1cd69e[_0xdeac('0x91')],'html':htmlEntities[_0xdeac('0x95')](_0x1cd69e[_0xdeac('0x47')]),'headers':{'Date':moment(_0x1cd69e[_0xdeac('0x92')])[_0xdeac('0x6d')](_0xdeac('0x96'))},'attachments':[]};if(_0x47acba['cc']){_0x5326df[_0xdeac('0x97')]['Cc']=_0x47acba['cc'];}if(_0x47acba[_0xdeac('0x90')]){_0x5326df[_0xdeac('0x97')][_0xdeac('0x98')]=_0x47acba[_0xdeac('0x90')];}return new BPromise(function(_0x38940c,_0x47f3b1){if(_0x47acba[_0xdeac('0x94')]){for(var _0x30e1eb=0x0;_0x30e1eb<_0x47acba[_0xdeac('0x94')][_0xdeac('0x34')];_0x30e1eb++){var _0x21227e=_0x47acba[_0xdeac('0x94')][_0x30e1eb];var _0x452995=path[_0xdeac('0x5b')](_0x398192,_0x21227e[_0xdeac('0x5d')]);if(fs[_0xdeac('0x99')](_0x452995)){_0x5326df[_0xdeac('0x5a')][_0xdeac('0x9a')]({'name':_0x21227e[_0xdeac('0x27')],'contentType':_0x21227e[_0xdeac('0x3b')],'data':fs[_0xdeac('0x9b')](_0x452995)});}}}emlformat['build'](_0x5326df,function(_0x3b1362,_0x9702b6){if(_0x3b1362)return _0x47f3b1(_0x3b1362);fs[_0xdeac('0x9c')](path['join'](_0x3ee31e,_0x187f8f),_0x9702b6);return _0x38940c(_0x9702b6);});});}})[_0xdeac('0x14')](function(_0x3608fe){if(_0x3608fe){return _0x3c5977[_0xdeac('0x9d')](path[_0xdeac('0x5b')](_0x3ee31e,_0x187f8f),_0x187f8f,function(_0x2f0e50){if(!_0x2f0e50)fs['unlinkSync'](path[_0xdeac('0x5b')](_0x3ee31e,_0x187f8f));});}})[_0xdeac('0x1c')](handleError(_0x3c5977,null));}; \ No newline at end of file +var _0x7915=['name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','body','describe','create','secret','split','MailAccount','findOne','MailAccountId','CmList','CmContact','Contacts','updatedAt','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','basename','List','List\x20not\x20found','SendMail','messageId','format','accept','mail','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','MailInteraction','MailInteractionId','read1stAt','interaction','get','info','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','agent','fullname','internal','manual','SIP/%s','channel','event','fromString','EventManager','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','ContactId','User','email','motionChannel','rejectmessage','download','unix','toString','server','files','tmp','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','offset','undefined','count','limit','set','json','update','destroy','end','sendStatus','stack','index','map','MailMessage','rawAttributes','fieldName','type','model'];(function(_0x297a0e,_0x1f8aca){var _0x3a46b2=function(_0x3b3430){while(--_0x3b3430){_0x297a0e['push'](_0x297a0e['shift']());}};_0x3a46b2(++_0x1f8aca);}(_0x7915,0x108));var _0x5791=function(_0x29a0c8,_0x311cc4){_0x29a0c8=_0x29a0c8-0x0;var _0x529fc9=_0x7915[_0x29a0c8];return _0x529fc9;};'use strict';var emlformat=require(_0x5791('0x0'));var moment=require(_0x5791('0x1'));var BPromise=require(_0x5791('0x2'));var util=require(_0x5791('0x3'));var path=require(_0x5791('0x4'));var fs=require('fs');var _=require(_0x5791('0x5'));var Redis=require(_0x5791('0x6'));var htmlToText=require(_0x5791('0x7'));var qs=require(_0x5791('0x8'));var logger=require(_0x5791('0x9'))(_0x5791('0xa'));var interaction_log=require('../../config/logger')('mail-interactions');var config=require(_0x5791('0xb'));var db=require('../../mysqldb')['db'];config[_0x5791('0xc')]=_[_0x5791('0xd')](config[_0x5791('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x5791('0xe'))(new Redis(config[_0x5791('0xc')]));var htmlEntities=require('html-entities');require(_0x5791('0xf'))[_0x5791('0x10')](socket);var jayson=require(_0x5791('0x11'));var client=jayson[_0x5791('0x12')][_0x5791('0x13')]({'port':0x232c});var client9003=jayson[_0x5791('0x12')][_0x5791('0x13')]({'port':0x232b});var client9002=jayson[_0x5791('0x12')][_0x5791('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x5e4d6a,_0x58d8c7,_0x1fba10,_0x504ea9){return new BPromise(function(_0x325624,_0x47b01a){var _0x339dd0=_0x504ea9||client;return _0x339dd0[_0x5791('0x14')](_0x5e4d6a,_0x1fba10)[_0x5791('0x15')](function(_0x5b10f9){logger['info'](_0x5791('0x16'),_0x58d8c7,'request\x20sent');logger[_0x5791('0x17')](_0x5791('0x18'),_0x58d8c7,_0x5791('0x19'),JSON[_0x5791('0x1a')](_0x5b10f9));if(_0x5b10f9[_0x5791('0x1b')]){if(_0x5b10f9[_0x5791('0x1b')]['code']===0x1f4){logger[_0x5791('0x1b')](_0x5791('0x16'),_0x58d8c7,_0x5b10f9[_0x5791('0x1b')][_0x5791('0x1c')]);return _0x47b01a(_0x5b10f9[_0x5791('0x1b')]['message']);}logger[_0x5791('0x1b')](_0x5791('0x16'),_0x58d8c7,_0x5b10f9[_0x5791('0x1b')]['message']);return _0x325624(_0x5b10f9[_0x5791('0x1b')][_0x5791('0x1c')]);}else{logger['info'](_0x5791('0x16'),_0x58d8c7,_0x5791('0x19'));_0x325624(_0x5b10f9[_0x5791('0x1d')][_0x5791('0x1c')]);}})[_0x5791('0x1e')](function(_0x11ab82){logger[_0x5791('0x1b')]('MailMessage,\x20%s,\x20%s',_0x58d8c7,_0x11ab82);_0x47b01a(_0x11ab82);});});}function respondWithResult(_0x2d9c7f,_0x21a6cf){_0x21a6cf=_0x21a6cf||0xc8;return function(_0x5228b9){if(_0x5228b9){return _0x2d9c7f[_0x5791('0x1f')](_0x21a6cf)['json'](_0x5228b9);}};}function respondWithFilteredResult(_0x406771,_0x320019){return function(_0x2dcf91){if(_0x2dcf91){var _0x769f01=typeof _0x320019[_0x5791('0x20')]===_0x5791('0x21')&&typeof _0x320019['limit']===_0x5791('0x21');var _0x198365=_0x2dcf91[_0x5791('0x22')];var _0x4c4750=_0x769f01?0x0:_0x320019[_0x5791('0x20')];var _0x6b79f3=_0x769f01?_0x2dcf91[_0x5791('0x22')]:_0x320019[_0x5791('0x20')]+_0x320019[_0x5791('0x23')];var _0x1639d1;if(_0x6b79f3>=_0x198365){_0x6b79f3=_0x198365;_0x1639d1=0xc8;}else{_0x1639d1=0xce;}_0x406771[_0x5791('0x1f')](_0x1639d1);return _0x406771[_0x5791('0x24')]('Content-Range',_0x4c4750+'-'+_0x6b79f3+'/'+_0x198365)[_0x5791('0x25')](_0x2dcf91);}return null;};}function saveUpdates(_0x1ffca6){return function(_0x568098){if(_0x568098){return _0x568098[_0x5791('0x26')](_0x1ffca6)[_0x5791('0x15')](function(_0x4751d6){return _0x4751d6;});}return null;};}function removeEntity(_0x45f1ee){return function(_0x5eafbb){if(_0x5eafbb){return _0x5eafbb[_0x5791('0x27')]()[_0x5791('0x15')](function(){_0x45f1ee[_0x5791('0x1f')](0xcc)[_0x5791('0x28')]();});}};}function handleEntityNotFound(_0x42ddb3){return function(_0x46da8e){if(!_0x46da8e){_0x42ddb3[_0x5791('0x29')](0x194);}return _0x46da8e;};}function handleError(_0xd53a49,_0x11e194){_0x11e194=_0x11e194||0x1f4;return function(_0x197f46){logger[_0x5791('0x1b')](_0x197f46[_0x5791('0x2a')]);if(_0x197f46['name']){delete _0x197f46['name'];}_0xd53a49[_0x5791('0x1f')](_0x11e194)['send'](_0x197f46);};}exports[_0x5791('0x2b')]=function(_0x454e8d,_0x3a232){var _0x35f95c={},_0x2aad08={},_0x5a01d8={'count':0x0,'rows':[]};var _0x1eeb47=_[_0x5791('0x2c')](db[_0x5791('0x2d')][_0x5791('0x2e')],function(_0x1dded2){return{'name':_0x1dded2[_0x5791('0x2f')],'type':_0x1dded2[_0x5791('0x30')]['key']};});_0x2aad08[_0x5791('0x31')]=_[_0x5791('0x2c')](_0x1eeb47,_0x5791('0x32'));_0x2aad08[_0x5791('0x33')]=_[_0x5791('0x34')](_0x454e8d[_0x5791('0x33')]);_0x2aad08[_0x5791('0x35')]=_[_0x5791('0x36')](_0x2aad08[_0x5791('0x31')],_0x2aad08['query']);_0x35f95c[_0x5791('0x37')]=_[_0x5791('0x36')](_0x2aad08[_0x5791('0x31')],qs[_0x5791('0x38')](_0x454e8d[_0x5791('0x33')][_0x5791('0x38')]));_0x35f95c['attributes']=_0x35f95c[_0x5791('0x37')][_0x5791('0x39')]?_0x35f95c[_0x5791('0x37')]:_0x2aad08[_0x5791('0x31')];if(!_0x454e8d[_0x5791('0x33')]['hasOwnProperty'](_0x5791('0x3a'))){_0x35f95c[_0x5791('0x23')]=qs[_0x5791('0x23')](_0x454e8d[_0x5791('0x33')][_0x5791('0x23')]);_0x35f95c[_0x5791('0x20')]=qs[_0x5791('0x20')](_0x454e8d[_0x5791('0x33')][_0x5791('0x20')]);}_0x35f95c[_0x5791('0x3b')]=qs[_0x5791('0x3c')](_0x454e8d['query'][_0x5791('0x3c')]);_0x35f95c[_0x5791('0x3d')]=qs[_0x5791('0x35')](_[_0x5791('0x3e')](_0x454e8d['query'],_0x2aad08['filters']),_0x1eeb47);if(_0x454e8d[_0x5791('0x33')][_0x5791('0x3f')]){_0x35f95c[_0x5791('0x3d')]=_[_0x5791('0x40')](_0x35f95c[_0x5791('0x3d')],{'$or':_[_0x5791('0x2c')](_0x1eeb47,function(_0xf3fa56){if(_0xf3fa56[_0x5791('0x30')]!==_0x5791('0x41')){var _0x25609a={};_0x25609a[_0xf3fa56[_0x5791('0x32')]]={'$like':'%'+_0x454e8d[_0x5791('0x33')][_0x5791('0x3f')]+'%'};return _0x25609a;}})});}_0x35f95c=_[_0x5791('0x40')]({},_0x35f95c,_0x454e8d[_0x5791('0x42')]);var _0x499343={'where':_0x35f95c[_0x5791('0x3d')]};return db[_0x5791('0x2d')][_0x5791('0x22')](_0x499343)[_0x5791('0x15')](function(_0x41ef1f){_0x5a01d8['count']=_0x41ef1f;if(_0x454e8d[_0x5791('0x33')]['includeAll']){_0x35f95c[_0x5791('0x43')]=[{'all':!![]}];}return db[_0x5791('0x2d')][_0x5791('0x44')](_0x35f95c);})[_0x5791('0x15')](function(_0x16075f){_0x5a01d8[_0x5791('0x45')]=_0x16075f;return _0x5a01d8;})[_0x5791('0x15')](respondWithFilteredResult(_0x3a232,_0x35f95c))[_0x5791('0x1e')](handleError(_0x3a232,null));};exports[_0x5791('0x46')]=function(_0x54c962,_0x5d095a){var _0x5b5ac6={'raw':!![],'where':{'id':_0x54c962[_0x5791('0x47')]['id']}},_0x4367db={};_0x4367db[_0x5791('0x31')]=_['keys'](db[_0x5791('0x2d')][_0x5791('0x2e')]);_0x4367db[_0x5791('0x33')]=_[_0x5791('0x34')](_0x54c962[_0x5791('0x33')]);_0x4367db[_0x5791('0x35')]=_['intersection'](_0x4367db[_0x5791('0x31')],_0x4367db[_0x5791('0x33')]);_0x5b5ac6[_0x5791('0x37')]=_['intersection'](_0x4367db['model'],qs[_0x5791('0x38')](_0x54c962[_0x5791('0x33')][_0x5791('0x38')]));_0x5b5ac6['attributes']=_0x5b5ac6['attributes'][_0x5791('0x39')]?_0x5b5ac6[_0x5791('0x37')]:_0x4367db[_0x5791('0x31')];if(_0x54c962[_0x5791('0x33')][_0x5791('0x48')]){_0x5b5ac6['include']=[{'all':!![]}];}_0x5b5ac6=_[_0x5791('0x40')]({},_0x5b5ac6,_0x54c962['options']);return db[_0x5791('0x2d')][_0x5791('0x49')](_0x5b5ac6)[_0x5791('0x15')](handleEntityNotFound(_0x5d095a,null))[_0x5791('0x15')](respondWithResult(_0x5d095a,null))[_0x5791('0x1e')](handleError(_0x5d095a,null));};exports[_0x5791('0x26')]=function(_0x2da0c0,_0x619bc4){if(_0x2da0c0[_0x5791('0x4a')]['id']){delete _0x2da0c0[_0x5791('0x4a')]['id'];}return db[_0x5791('0x2d')][_0x5791('0x49')]({'where':{'id':_0x2da0c0[_0x5791('0x47')]['id']}})[_0x5791('0x15')](handleEntityNotFound(_0x619bc4,null))['then'](saveUpdates(_0x2da0c0['body'],null))[_0x5791('0x15')](respondWithResult(_0x619bc4,null))['catch'](handleError(_0x619bc4,null));};exports[_0x5791('0x27')]=function(_0x2cebfa,_0x50a7c9){return db[_0x5791('0x2d')][_0x5791('0x49')]({'where':{'id':_0x2cebfa[_0x5791('0x47')]['id']}})[_0x5791('0x15')](handleEntityNotFound(_0x50a7c9,null))['then'](removeEntity(_0x50a7c9,null))[_0x5791('0x1e')](handleError(_0x50a7c9,null));};exports['describe']=function(_0x299df3,_0x5b3c8c){return db['MailMessage'][_0x5791('0x4b')]()[_0x5791('0x15')](respondWithResult(_0x5b3c8c,null))[_0x5791('0x1e')](handleError(_0x5b3c8c,null));};exports['create']=function(_0x5b24a5,_0x511905){return db['MailMessage'][_0x5791('0x4c')](_0x5b24a5[_0x5791('0x4a')])['then'](function(_0x373c47){if(_0x373c47){if(_0x373c47['direction']==='out'&&!_0x373c47[_0x5791('0x4d')]){var _0x10fc00,_0x33b687,_0xf7598d;if(_0x5b24a5[_0x5791('0x4a')]['to']){_0x33b687=_0x5b24a5['body']['to'][_0x5791('0x4e')](',')[0x0];}return db[_0x5791('0x4f')][_0x5791('0x50')]({'where':{'id':_0x373c47[_0x5791('0x51')]},'include':[{'model':db[_0x5791('0x52')],'as':'List','include':[{'model':db[_0x5791('0x53')],'as':_0x5791('0x54'),'where':{'email':_0x33b687},'limit':0x1,'order':[[_0x5791('0x55'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0x5791('0x56'),'raw':!![],'include':[{'model':db[_0x5791('0x57')],'as':_0x5791('0x57'),'raw':!![]}]}]})[_0x5791('0x15')](function(_0x14df6b){_0x10fc00=_0x14df6b;if(!_0x10fc00||!_0x10fc00[_0x5791('0x56')])return;var _0x55c5b7=_0x10fc00[_0x5791('0x58')]();if(_0x5b24a5[_0x5791('0x4a')][_0x5791('0x59')]&&_0x5b24a5[_0x5791('0x4a')][_0x5791('0x59')]['length']){for(var _0x228751=0x0;_0x228751<_0x5b24a5[_0x5791('0x4a')][_0x5791('0x59')][_0x5791('0x39')];_0x228751+=0x1){_0x5b24a5['body']['attachments'][_0x228751]={'filename':_0x5b24a5['body'][_0x5791('0x59')][_0x228751][_0x5791('0x32')],'path':path[_0x5791('0x5a')](config[_0x5791('0x5b')],'server/files/attachments',_0x5b24a5['body'][_0x5791('0x59')][_0x228751][_0x5791('0x5c')])};}}_0xf7598d={'account':_0x55c5b7,'message':_0x5b24a5[_0x5791('0x4a')]};return;})[_0x5791('0x15')](function(){if(_0x10fc00[_0x5791('0x5d')]){if(_0x10fc00[_0x5791('0x5d')][_0x5791('0x54')][_0x5791('0x39')]){return _0x10fc00[_0x5791('0x5d')][_0x5791('0x54')][0x0];}else{return db[_0x5791('0x53')][_0x5791('0x4c')](_[_0x5791('0xd')](_0x5b24a5[_0x5791('0x4a')],{'firstName':_0x5b24a5['body']['to'],'email':_0x5b24a5['body']['to'],'phone':_0x5b24a5[_0x5791('0x4a')]['to'],'ListId':_0x10fc00['ListId']}));}}else{throw new Error(_0x5791('0x5e'));}})[_0x5791('0x15')](function(){if(_0xf7598d){return respondWithRpcPromise(_0x5791('0x5f'),'sendMail',_0xf7598d,client9003)['then'](function(_0x3edadc){return _0x373c47[_0x5791('0x26')]({'read':!![],'messageId':_0x3edadc[_0x5791('0x60')],'sentAt':moment()[_0x5791('0x61')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x5791('0x1e')](function(_0x1e61aa){logger[_0x5791('0x1b')]('%s',JSON[_0x5791('0x1a')](_0x1e61aa));return _0x373c47;});}return _0x373c47;});}return _0x373c47;}})[_0x5791('0x15')](respondWithResult(_0x511905,0xc9))[_0x5791('0x1e')](handleError(_0x511905,null));};exports[_0x5791('0x62')]=function(_0x1e7b74,_0x390e27){var _0x2a02b3={'agent':{},'channel':_0x5791('0x63')};if(_0x1e7b74[_0x5791('0x4a')]['id']){delete _0x1e7b74['body']['id'];}_0x1e7b74[_0x5791('0x4a')][_0x5791('0x64')]=!![];_0x1e7b74['body'][_0x5791('0x65')]=moment()[_0x5791('0x61')](_0x5791('0x66'));_0x1e7b74[_0x5791('0x4a')][_0x5791('0x67')]=_0x1e7b74[_0x5791('0x4a')][_0x5791('0x67')]||_0x1e7b74[_0x5791('0x68')]['id'];_0x2a02b3['agent']['id']=_0x1e7b74[_0x5791('0x4a')][_0x5791('0x67')];return db['MailMessage'][_0x5791('0x49')]({'where':{'id':_0x1e7b74[_0x5791('0x47')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x390e27,null))[_0x5791('0x15')](saveUpdates(_0x1e7b74[_0x5791('0x4a')],null))[_0x5791('0x15')](function(_0x451f75){if(_0x451f75){_0x2a02b3[_0x5791('0x1c')]=_0x451f75['get']({'plain':!![]});return db[_0x5791('0x69')]['find']({'where':{'id':_0x451f75[_0x5791('0x6a')]}});}return null;})[_0x5791('0x15')](handleEntityNotFound(_0x390e27,null))[_0x5791('0x15')](function(_0x27d860){if(_0x27d860){return _0x27d860[_0x5791('0x26')]({'UserId':_0x1e7b74[_0x5791('0x4a')]['UserId'],'read1stAt':_['isNil'](_0x27d860[_0x5791('0x6b')])?moment()[_0x5791('0x61')](_0x5791('0x66')):undefined});}return null;})[_0x5791('0x15')](function(_0x3b4127){if(_0x3b4127){_0x2a02b3[_0x5791('0x6c')]=_0x3b4127[_0x5791('0x6d')]({'plain':!![]});interaction_log[_0x5791('0x6e')](_0x5791('0x6f'),_0x1e7b74['user']['id'],_0x1e7b74[_0x5791('0x68')][_0x5791('0x32')],_0x1e7b74[_0x5791('0x68')][_0x5791('0x70')],_0x2a02b3[_0x5791('0x6c')]['id'],_0x1e7b74[_0x5791('0x4a')]?JSON[_0x5791('0x1a')](_0x1e7b74[_0x5791('0x4a')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x2a02b3);}return null;})['then'](function(_0x42e924){var _0x1debb2=_0x5791('0x71')+_0x42e924[_0x5791('0x1c')]['ContactId'];return db[_0x5791('0x72')][_0x5791('0x33')](_0x1debb2,{'type':db['Sequelize'][_0x5791('0x73')][_0x5791('0x74')],'raw':!![]})[_0x5791('0x15')](function(_0x42e295){return _0x42e295;});})[_0x5791('0x15')](function(_0x399f44){if(_0x399f44){_0x2a02b3[_0x5791('0x1c')]['contact']=_0x399f44[0x0];if(!_0x1e7b74[_0x5791('0x4a')][_0x5791('0x67')])return;return db['User'][_0x5791('0x49')]({'where':{'id':_0x1e7b74['body'][_0x5791('0x67')],'role':_0x5791('0x75')},'attributes':['id',_0x5791('0x32'),_0x5791('0x76'),'email',_0x5791('0x77')],'raw':!![]});}return null;})[_0x5791('0x15')](function(_0x5284e6){if(!_0x5284e6)return null;_0x2a02b3[_0x5791('0x1c')]['agent']=_0x5284e6;return _0x2a02b3;})[_0x5791('0x15')](function(_0x22a0db){if(_0x22a0db){if(_0x1e7b74['body'][_0x5791('0x78')]){_0x2a02b3['message']['interface']=util[_0x5791('0x61')](_0x5791('0x79'),_0x1e7b74[_0x5791('0x68')][_0x5791('0x32')]);_0x2a02b3[_0x5791('0x1c')][_0x5791('0x7a')]=_0x2a02b3[_0x5791('0x7a')];_0x2a02b3[_0x5791('0x1c')]['motionChannel']=_0x2a02b3[_0x5791('0x7a')];_0x2a02b3[_0x5791('0x1c')][_0x5791('0x7b')]='accept';_0x2a02b3[_0x5791('0x1c')][_0x5791('0x4a')]=htmlToText[_0x5791('0x7c')](_0x2a02b3[_0x5791('0x1c')][_0x5791('0x4a')]);return respondWithRpcPromise(_0x5791('0x7d'),_0x5791('0x7d'),{'event':'acceptmessage','message':_0x2a02b3[_0x5791('0x1c')]},client9002)['then'](function(){return _0x2a02b3;});}return _0x2a02b3;}return null;})[_0x5791('0x15')](respondWithResult(_0x390e27,null))[_0x5791('0x1e')](handleError(_0x390e27,null));};exports[_0x5791('0x7e')]=function(_0x4f5e82,_0x1a2840){var _0x1a1b80={'agent':{},'channel':_0x5791('0x63')};if(_0x4f5e82[_0x5791('0x4a')]['id']){delete _0x4f5e82[_0x5791('0x4a')]['id'];}_0x4f5e82[_0x5791('0x4a')][_0x5791('0x67')]=_0x4f5e82['body'][_0x5791('0x67')]||_0x4f5e82[_0x5791('0x68')]['id'];_0x1a1b80[_0x5791('0x75')]['id']=_0x4f5e82[_0x5791('0x4a')][_0x5791('0x67')];return db[_0x5791('0x2d')][_0x5791('0x49')]({'where':{'id':_0x4f5e82[_0x5791('0x47')]['id'],'UserId':null}})[_0x5791('0x15')](handleEntityNotFound(_0x1a2840,null))[_0x5791('0x15')](function(_0x405a22){if(_0x405a22){_0x1a1b80[_0x5791('0x1c')]=_0x405a22['get']({'plain':!![]});return db[_0x5791('0x69')][_0x5791('0x49')]({'where':{'id':_0x405a22[_0x5791('0x6a')]}});}return null;})[_0x5791('0x15')](handleEntityNotFound(_0x1a2840,null))[_0x5791('0x15')](function(_0x262600){if(_0x262600){_0x1a1b80[_0x5791('0x6c')]=_0x262600['get']({'plain':!![]});interaction_log['info'](_0x5791('0x7f'),_0x4f5e82[_0x5791('0x68')]['id'],_0x4f5e82[_0x5791('0x68')][_0x5791('0x32')],_0x4f5e82['user']['role'],_0x1a1b80['interaction']['id'],_0x4f5e82[_0x5791('0x4a')]?JSON['stringify'](_0x4f5e82['body']):_0x5791('0x80'));return respondWithRpcPromise(_0x5791('0x81'),_0x5791('0x82'),_0x1a1b80);}return null;})[_0x5791('0x15')](function(_0x31b7a2){var _0x3fc3f7='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x31b7a2['message'][_0x5791('0x83')];return db[_0x5791('0x72')][_0x5791('0x33')](_0x3fc3f7,{'type':db['Sequelize'][_0x5791('0x73')][_0x5791('0x74')],'raw':!![]})[_0x5791('0x15')](function(_0x3587ad){return _0x3587ad;});})[_0x5791('0x15')](function(_0x2820e1){if(_0x2820e1){_0x1a1b80[_0x5791('0x1c')]['contact']=_0x2820e1[0x0];if(!_0x4f5e82[_0x5791('0x4a')][_0x5791('0x67')])return;return db[_0x5791('0x84')][_0x5791('0x49')]({'where':{'id':_0x4f5e82[_0x5791('0x4a')][_0x5791('0x67')],'role':'agent'},'attributes':['id',_0x5791('0x32'),'fullname',_0x5791('0x85'),_0x5791('0x77')],'raw':!![]});}return null;})[_0x5791('0x15')](function(_0x186992){if(!_0x186992)return null;_0x1a1b80[_0x5791('0x1c')][_0x5791('0x75')]=_0x186992;return _0x1a1b80;})[_0x5791('0x15')](function(_0x3f0ba7){if(_0x3f0ba7){_0x3f0ba7[_0x5791('0x1c')]['interface']=util[_0x5791('0x61')]('SIP/%s',_0x4f5e82['user'][_0x5791('0x32')]);_0x3f0ba7[_0x5791('0x1c')][_0x5791('0x7a')]=_0x1a1b80[_0x5791('0x7a')];_0x3f0ba7[_0x5791('0x1c')][_0x5791('0x86')]=_0x1a1b80[_0x5791('0x7a')];_0x3f0ba7[_0x5791('0x1c')][_0x5791('0x7b')]=_0x5791('0x7e');_0x3f0ba7[_0x5791('0x1c')][_0x5791('0x4a')]=htmlToText[_0x5791('0x7c')](_0x1a1b80[_0x5791('0x1c')][_0x5791('0x4a')]);respondWithRpcPromise(_0x5791('0x7d'),'EventManager',{'event':_0x5791('0x87'),'message':_0x3f0ba7[_0x5791('0x1c')]},client9002);return _0x1a1b80;}return null;})[_0x5791('0x15')](respondWithResult(_0x1a2840,null))['catch'](handleError(_0x1a2840,null));};exports[_0x5791('0x88')]=function(_0x10c7d7,_0x1743c8){var _0x3df279=moment()[_0x5791('0x89')]()[_0x5791('0x8a')]();var _0x25f4c7=path[_0x5791('0x5a')](config[_0x5791('0x5b')],_0x5791('0x8b'),_0x5791('0x8c'),_0x5791('0x8d'));var _0x432b8d=path[_0x5791('0x5a')](config[_0x5791('0x5b')],_0x5791('0x8b'),_0x5791('0x8c'),_0x5791('0x59'));var _0xb410af=util[_0x5791('0x61')]('message-%s.eml',_0x3df279);return db[_0x5791('0x2d')]['find']({'where':{'id':_0x10c7d7['params']['id']},'attributes':['id','body',_0x5791('0x8e'),'to','cc',_0x5791('0x8f'),_0x5791('0x90'),_0x5791('0x91')],'include':_0x10c7d7[_0x5791('0x33')][_0x5791('0x59')]?[{'model':db[_0x5791('0x92')],'as':_0x5791('0x93')}]:undefined})['then'](handleEntityNotFound(_0x1743c8,null))[_0x5791('0x15')](function(_0x1a2091){if(_0x1a2091){var _0xda0a77=_0x1a2091;var _0x267dbc={'from':_0xda0a77[_0x5791('0x8e')],'to':_0xda0a77['to'],'subject':_0xda0a77[_0x5791('0x90')],'html':htmlEntities[_0x5791('0x94')](_0xda0a77['body']),'headers':{'Date':moment(_0xda0a77['createdAt'])[_0x5791('0x61')](_0x5791('0x95'))},'attachments':[]};if(_0x1a2091['cc']){_0x267dbc['headers']['Cc']=_0x1a2091['cc'];}if(_0x1a2091[_0x5791('0x8f')]){_0x267dbc[_0x5791('0x96')]['Bcc']=_0x1a2091[_0x5791('0x8f')];}return new BPromise(function(_0xbc5a6b,_0x5ed0bc){if(_0x1a2091[_0x5791('0x93')]){for(var _0x3bd50f=0x0;_0x3bd50f<_0x1a2091[_0x5791('0x93')][_0x5791('0x39')];_0x3bd50f++){var _0xe6c8f8=_0x1a2091[_0x5791('0x93')][_0x3bd50f];var _0x455776=path[_0x5791('0x5a')](_0x432b8d,_0xe6c8f8[_0x5791('0x5c')]);if(fs[_0x5791('0x97')](_0x455776)){_0x267dbc[_0x5791('0x59')][_0x5791('0x98')]({'name':_0xe6c8f8[_0x5791('0x32')],'contentType':_0xe6c8f8['type'],'data':fs[_0x5791('0x99')](_0x455776)});}}}emlformat[_0x5791('0x9a')](_0x267dbc,function(_0x760619,_0x29e09c){if(_0x760619)return _0x5ed0bc(_0x760619);fs[_0x5791('0x9b')](path[_0x5791('0x5a')](_0x25f4c7,_0xb410af),_0x29e09c);return _0xbc5a6b(_0x29e09c);});});}})[_0x5791('0x15')](function(_0x59a4f9){if(_0x59a4f9){return _0x1743c8[_0x5791('0x88')](path[_0x5791('0x5a')](_0x25f4c7,_0xb410af),_0xb410af,function(_0x37dc75){if(!_0x37dc75)fs[_0x5791('0x9c')](path[_0x5791('0x5a')](_0x25f4c7,_0xb410af));});}})[_0x5791('0x1e')](handleError(_0x1743c8,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index ec5301d..14c580e 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 _0x6a86=['emit','hook','../../mysqldb','MailMessage','setMaxListeners','save','update'];(function(_0x2c3255,_0x4e00ae){var _0x282aba=function(_0x5721d5){while(--_0x5721d5){_0x2c3255['push'](_0x2c3255['shift']());}};_0x282aba(++_0x4e00ae);}(_0x6a86,0x183));var _0x66a8=function(_0x1f45e2,_0x22a2c9){_0x1f45e2=_0x1f45e2-0x0;var _0x423083=_0x6a86[_0x1f45e2];return _0x423083;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x66a8('0x0'))['db'][_0x66a8('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x66a8('0x2')](0x0);var events={'afterCreate':_0x66a8('0x3'),'afterUpdate':_0x66a8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2a8992){return function(_0x3d3476,_0x39f826,_0x3d6f57){MailMessageEvents[_0x66a8('0x5')](_0x2a8992+':'+_0x3d3476['id'],_0x3d3476);MailMessageEvents[_0x66a8('0x5')](_0x2a8992,_0x3d3476);_0x3d6f57(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x66a8('0x6')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0xb093=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','remove'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb093,0x1ec));var _0x3b09=function(_0x44aeaf,_0x2cd541){_0x44aeaf=_0x44aeaf-0x0;var _0x318a2e=_0xb093[_0x44aeaf];return _0x318a2e;};'use strict';var EventEmitter=require(_0x3b09('0x0'));var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x3b09('0x1')](0x0);var events={'afterCreate':_0x3b09('0x2'),'afterUpdate':'update','afterDestroy':_0x3b09('0x3')};function emitEvent(_0x2383bb){return function(_0x90fcad,_0x16ce87,_0x21832b){MailMessageEvents['emit'](_0x2383bb+':'+_0x90fcad['id'],_0x90fcad);MailMessageEvents[_0x3b09('0x4')](_0x2383bb,_0x90fcad);_0x21832b(null);};}for(var e in events){if(events[_0x3b09('0x5')](e)){var event=events[e];MailMessage[_0x3b09('0x6')](e,emitEvent(event));}}module[_0x3b09('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 914f8f0..e4b2b7b 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 _0x4e3c=['models','get','toLowerCase','out','secret','isNil','MailInteraction','findOne','then','update','createdAt','direction','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','FULLTEXT','body'];(function(_0x4f4e2e,_0x3e9028){var _0x44393b=function(_0x1cd757){while(--_0x1cd757){_0x4f4e2e['push'](_0x4f4e2e['shift']());}};_0x44393b(++_0x3e9028);}(_0x4e3c,0x159));var _0xc4e3=function(_0x5d09d9,_0x181abf){_0x5d09d9=_0x5d09d9-0x0;var _0x7ce182=_0x4e3c[_0x5d09d9];return _0x7ce182;};'use strict';var _=require(_0xc4e3('0x0'));var util=require(_0xc4e3('0x1'));var logger=require(_0xc4e3('0x2'))(_0xc4e3('0x3'));var moment=require(_0xc4e3('0x4'));var BPromise=require(_0xc4e3('0x5'));var rp=require(_0xc4e3('0x6'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xc4e3('0x7'));var rimraf=require(_0xc4e3('0x8'));var config=require('../../config/environment');var attributes=require(_0xc4e3('0x9'));module[_0xc4e3('0xa')]=function(_0x3e19df,_0x572698){return _0x3e19df[_0xc4e3('0xb')](_0xc4e3('0xc'),attributes,{'tableName':_0xc4e3('0xd'),'paranoid':![],'indexes':[{'name':_0xc4e3('0xe'),'fields':[_0xc4e3('0xe')]},{'name':_0xc4e3('0xf'),'fields':['plainBody','subject'],'type':_0xc4e3('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x41a591,_0x43603e,_0x37389e){if(_0x41a591[_0xc4e3('0x11')]){_0x41a591['plainBody']=htmlToText['fromString'](_0x41a591['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x37389e(null,_0x43603e);},'afterCreate':function(_0x4badca,_0x35c686,_0x48c906){var _0x51b98c=_0x3e19df[_0xc4e3('0x12')];var _0x1a0342=_0x4badca[_0xc4e3('0x13')]({'plain':!![]});if(_0x1a0342['direction']['toLowerCase']()==='in'||_0x1a0342['direction'][_0xc4e3('0x14')]()===_0xc4e3('0x15')&&!_0x1a0342[_0xc4e3('0x16')]&&!_[_0xc4e3('0x17')](_0x1a0342['UserId'])){_0x51b98c[_0xc4e3('0x18')][_0xc4e3('0x19')]({'where':{'id':_0x1a0342['MailInteractionId']}})[_0xc4e3('0x1a')](function(_0x206a1b){if(_0x206a1b){_0x206a1b[_0xc4e3('0x1b')]({'lastMsgAt':_0x1a0342[_0xc4e3('0x1c')],'lastMsgDirection':_0x1a0342[_0xc4e3('0x1d')]['toLowerCase']()});}})[_0xc4e3('0x1e')](function(_0x266ba7){console['error'](_0x266ba7);});}_0x48c906();}},'charset':_0xc4e3('0x1f'),'collate':_0xc4e3('0x20')});}; \ No newline at end of file +var _0x424f=['body','get','direction','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','toLowerCase','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','html-to-text','rimraf','../../config/environment','exports','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT'];(function(_0x5f3828,_0xfca3ce){var _0x42b9c5=function(_0x43e497){while(--_0x43e497){_0x5f3828['push'](_0x5f3828['shift']());}};_0x42b9c5(++_0xfca3ce);}(_0x424f,0x9e));var _0xf424=function(_0x2977d3,_0x1769ca){_0x2977d3=_0x2977d3-0x0;var _0x234a81=_0x424f[_0x2977d3];return _0x234a81;};'use strict';var _=require(_0xf424('0x0'));var util=require(_0xf424('0x1'));var logger=require('../../config/logger')(_0xf424('0x2'));var moment=require(_0xf424('0x3'));var BPromise=require(_0xf424('0x4'));var rp=require(_0xf424('0x5'));var htmlToText=require(_0xf424('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf424('0x7'));var config=require(_0xf424('0x8'));var attributes=require('./mailMessage.attributes');module[_0xf424('0x9')]=function(_0x1607c6,_0x56ebd8){return _0x1607c6['define'](_0xf424('0xa'),attributes,{'tableName':_0xf424('0xb'),'paranoid':![],'indexes':[{'name':_0xf424('0xc'),'fields':['messageId']},{'name':_0xf424('0xd'),'fields':[_0xf424('0xe'),_0xf424('0xf')],'type':_0xf424('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2468c6,_0x4114bd,_0xd8c860){if(_0x2468c6[_0xf424('0x11')]){_0x2468c6[_0xf424('0xe')]=htmlToText['fromString'](_0x2468c6[_0xf424('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xd8c860(null,_0x4114bd);},'afterCreate':function(_0x3b1aba,_0x21607d,_0x374784){var _0xca677c=_0x1607c6['models'];var _0x125912=_0x3b1aba[_0xf424('0x12')]({'plain':!![]});if(_0x125912[_0xf424('0x13')]['toLowerCase']()==='in'||_0x125912[_0xf424('0x13')]['toLowerCase']()===_0xf424('0x14')&&!_0x125912[_0xf424('0x15')]&&!_[_0xf424('0x16')](_0x125912[_0xf424('0x17')])){_0xca677c[_0xf424('0x18')][_0xf424('0x19')]({'where':{'id':_0x125912[_0xf424('0x1a')]}})[_0xf424('0x1b')](function(_0x1f5c03){if(_0x1f5c03){_0x1f5c03[_0xf424('0x1c')]({'lastMsgAt':_0x125912[_0xf424('0x1d')],'lastMsgDirection':_0x125912[_0xf424('0x13')][_0xf424('0x1e')]()});}})[_0xf424('0x1f')](function(_0x1ec9d1){console[_0xf424('0x20')](_0x1ec9d1);});}_0x374784();}},'charset':_0xf424('0x21'),'collate':_0xf424('0x22')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 462dca6..b6f4bd7 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 _0xdd4f=['request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s'];(function(_0x303064,_0x12f0c2){var _0x5a1d3d=function(_0x5b9d81){while(--_0x5b9d81){_0x303064['push'](_0x303064['shift']());}};_0x5a1d3d(++_0x12f0c2);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x3cf92f,_0x16172b){_0x3cf92f=_0x3cf92f-0x0;var _0x5a82f4=_0xdd4f[_0x3cf92f];return _0x5a82f4;};'use strict';var _=require(_0xfdd4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfdd4('0x1'));var fs=require('fs');var Redis=require(_0xfdd4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfdd4('0x3'));var logger=require(_0xfdd4('0x4'))(_0xfdd4('0x5'));var config=require('../../config/environment');var jayson=require(_0xfdd4('0x6'));var client=jayson[_0xfdd4('0x7')][_0xfdd4('0x8')]({'port':0x232a});config[_0xfdd4('0x9')]=_[_0xfdd4('0xa')](config['redis'],{'host':_0xfdd4('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfdd4('0x9')]));require(_0xfdd4('0xc'))[_0xfdd4('0xd')](socket);function respondWithRpcPromise(_0x4ee02f,_0x3d06c9,_0x4b4f1d){return new BPromise(function(_0x27a9f3,_0x3ce77a){return client[_0xfdd4('0xe')](_0x4ee02f,_0x4b4f1d)[_0xfdd4('0xf')](function(_0x35e22d){logger[_0xfdd4('0x10')](_0xfdd4('0x11'),_0x3d06c9,_0xfdd4('0x12'));logger[_0xfdd4('0x13')](_0xfdd4('0x14'),_0x3d06c9,_0xfdd4('0x12'),JSON['stringify'](_0x35e22d));if(_0x35e22d[_0xfdd4('0x15')]){if(_0x35e22d[_0xfdd4('0x15')][_0xfdd4('0x16')]===0x1f4){logger['error'](_0xfdd4('0x11'),_0x3d06c9,_0x35e22d['error'][_0xfdd4('0x17')]);return _0x3ce77a(_0x35e22d[_0xfdd4('0x15')][_0xfdd4('0x17')]);}logger[_0xfdd4('0x15')](_0xfdd4('0x11'),_0x3d06c9,_0x35e22d['error']['message']);return _0x27a9f3(_0x35e22d['error'][_0xfdd4('0x17')]);}else{logger[_0xfdd4('0x10')](_0xfdd4('0x11'),_0x3d06c9,_0xfdd4('0x12'));_0x27a9f3(_0x35e22d[_0xfdd4('0x18')][_0xfdd4('0x17')]);}})[_0xfdd4('0x19')](function(_0x2ffd5f){logger[_0xfdd4('0x15')]('MailMessage,\x20%s,\x20%s',_0x3d06c9,_0x2ffd5f);_0x3ce77a(_0x2ffd5f);});});}exports[_0xfdd4('0x1a')]=function(_0x3e8eac){var _0x2dc51c=this;return new Promise(function(_0x36e611,_0x1454f1){return db[_0xfdd4('0x1b')][_0xfdd4('0x1c')](_0x3e8eac[_0xfdd4('0x1d')],{'raw':_0x3e8eac['options']?_0x3e8eac[_0xfdd4('0x1e')][_0xfdd4('0x1f')]===undefined?!![]:![]:!![]})[_0xfdd4('0xf')](function(_0x16e81b){logger[_0xfdd4('0x10')](_0xfdd4('0x1a'),_0x3e8eac);logger[_0xfdd4('0x13')](_0xfdd4('0x1a'),_0x3e8eac,JSON['stringify'](_0x16e81b));_0x36e611(_0x16e81b);})[_0xfdd4('0x19')](function(_0x1112e8){logger[_0xfdd4('0x15')]('CreateMailMessage',_0x1112e8[_0xfdd4('0x17')],_0x3e8eac);_0x1454f1(_0x2dc51c[_0xfdd4('0x15')](0x1f4,_0x1112e8[_0xfdd4('0x17')]));});});}; \ No newline at end of file +var _0x6cb4=['result','catch','CreateMailMessage','MailMessage','create','body','options','raw','info','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','MailMessage,\x20%s,\x20%s','message'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6cb4,0xff));var _0x46cb=function(_0x24095d,_0x47d7d9){_0x24095d=_0x24095d-0x0;var _0x1db544=_0x6cb4[_0x24095d];return _0x1db544;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var moment=require(_0x46cb('0x2'));var BPromise=require(_0x46cb('0x3'));var rs=require(_0x46cb('0x4'));var fs=require('fs');var Redis=require(_0x46cb('0x5'));var db=require(_0x46cb('0x6'))['db'];var utils=require(_0x46cb('0x7'));var logger=require(_0x46cb('0x8'))('rpc');var config=require(_0x46cb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x46cb('0xa')]['http']({'port':0x232a});config[_0x46cb('0xb')]=_[_0x46cb('0xc')](config[_0x46cb('0xb')],{'host':_0x46cb('0xd'),'port':0x18eb});var socket=require(_0x46cb('0xe'))(new Redis(config[_0x46cb('0xb')]));require('./mailMessage.socket')[_0x46cb('0xf')](socket);function respondWithRpcPromise(_0x34f9e9,_0x48101c,_0x206f10){return new BPromise(function(_0x106a87,_0x4a60b2){return client[_0x46cb('0x10')](_0x34f9e9,_0x206f10)[_0x46cb('0x11')](function(_0x570cfd){logger['info']('MailMessage,\x20%s,\x20%s',_0x48101c,_0x46cb('0x12'));logger[_0x46cb('0x13')](_0x46cb('0x14'),_0x48101c,_0x46cb('0x12'),JSON['stringify'](_0x570cfd));if(_0x570cfd[_0x46cb('0x15')]){if(_0x570cfd[_0x46cb('0x15')][_0x46cb('0x16')]===0x1f4){logger[_0x46cb('0x15')](_0x46cb('0x17'),_0x48101c,_0x570cfd[_0x46cb('0x15')][_0x46cb('0x18')]);return _0x4a60b2(_0x570cfd[_0x46cb('0x15')][_0x46cb('0x18')]);}logger[_0x46cb('0x15')](_0x46cb('0x17'),_0x48101c,_0x570cfd['error'][_0x46cb('0x18')]);return _0x106a87(_0x570cfd['error'][_0x46cb('0x18')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x48101c,'request\x20sent');_0x106a87(_0x570cfd[_0x46cb('0x19')][_0x46cb('0x18')]);}})[_0x46cb('0x1a')](function(_0xcc8e2){logger[_0x46cb('0x15')](_0x46cb('0x17'),_0x48101c,_0xcc8e2);_0x4a60b2(_0xcc8e2);});});}exports[_0x46cb('0x1b')]=function(_0x32e9fe){var _0x90cd50=this;return new Promise(function(_0xfc9064,_0x149483){return db[_0x46cb('0x1c')][_0x46cb('0x1d')](_0x32e9fe[_0x46cb('0x1e')],{'raw':_0x32e9fe[_0x46cb('0x1f')]?_0x32e9fe[_0x46cb('0x1f')][_0x46cb('0x20')]===undefined?!![]:![]:!![]})[_0x46cb('0x11')](function(_0x41ecd2){logger[_0x46cb('0x21')](_0x46cb('0x1b'),_0x32e9fe);logger[_0x46cb('0x13')](_0x46cb('0x1b'),_0x32e9fe,JSON[_0x46cb('0x22')](_0x41ecd2));_0xfc9064(_0x41ecd2);})[_0x46cb('0x1a')](function(_0x5a1338){logger['error'](_0x46cb('0x1b'),_0x5a1338[_0x46cb('0x18')],_0x32e9fe);_0x149483(_0x90cd50[_0x46cb('0x15')](0x1f4,_0x5a1338[_0x46cb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 010725b..413834e 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 _0xc92c=['removeListener','register','mailMessage:','./mailMessage.events','save','remove','emit'];(function(_0x350aaa,_0x267dbe){var _0xb03443=function(_0x156ab2){while(--_0x156ab2){_0x350aaa['push'](_0x350aaa['shift']());}};_0xb03443(++_0x267dbe);}(_0xc92c,0x176));var _0xcc92=function(_0x508af2,_0xdb8ab4){_0x508af2=_0x508af2-0x0;var _0x2add9b=_0xc92c[_0x508af2];return _0x2add9b;};'use strict';var MailMessageEvents=require(_0xcc92('0x0'));var events=[_0xcc92('0x1'),_0xcc92('0x2'),'update'];function createListener(_0x3d233a,_0xb4cb3b){return function(_0x502e19){_0xb4cb3b[_0xcc92('0x3')](_0x3d233a,_0x502e19);};}function removeListener(_0x371c1e,_0x353503){return function(){MailMessageEvents[_0xcc92('0x4')](_0x371c1e,_0x353503);};}exports[_0xcc92('0x5')]=function(_0x1fbefa){for(var _0x598bfb=0x0,_0x20aab7=events['length'];_0x598bfb<_0x20aab7;_0x598bfb++){var _0x3c4ddb=events[_0x598bfb];var _0x16a898=createListener(_0xcc92('0x6')+_0x3c4ddb,_0x1fbefa);MailMessageEvents['on'](_0x3c4ddb,_0x16a898);}}; \ No newline at end of file +var _0x201d=['./mailMessage.events','remove','update','emit','removeListener','length'];(function(_0x2bc68a,_0x1e9ba1){var _0x5673e7=function(_0x3e0403){while(--_0x3e0403){_0x2bc68a['push'](_0x2bc68a['shift']());}};_0x5673e7(++_0x1e9ba1);}(_0x201d,0xd2));var _0xd201=function(_0x1ab2b5,_0x4a44fb){_0x1ab2b5=_0x1ab2b5-0x0;var _0x225e0d=_0x201d[_0x1ab2b5];return _0x225e0d;};'use strict';var MailMessageEvents=require(_0xd201('0x0'));var events=['save',_0xd201('0x1'),_0xd201('0x2')];function createListener(_0x488730,_0x4b2389){return function(_0x5b57b9){_0x4b2389[_0xd201('0x3')](_0x488730,_0x5b57b9);};}function removeListener(_0x2db87d,_0x59c714){return function(){MailMessageEvents[_0xd201('0x4')](_0x2db87d,_0x59c714);};}exports['register']=function(_0xb1427d){for(var _0x586714=0x0,_0x2614d4=events[_0xd201('0x5')];_0x586714<_0x2614d4;_0x586714++){var _0x2d2b3e=events[_0x586714];var _0x4e6b41=createListener('mailMessage:'+_0x2d2b3e,_0xb1427d);MailMessageEvents['on'](_0x2d2b3e,_0x4e6b41);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index cd6c08d..a8bb6f5 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 _0x19d7=['/:id/users','post','create','addTeams','delete','removeTeams','removeAgents','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','isAuthenticated','index','get','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams'];(function(_0x5c8b19,_0x47d79a){var _0x2ff0cd=function(_0x3c1f53){while(--_0x3c1f53){_0x5c8b19['push'](_0x5c8b19['shift']());}};_0x2ff0cd(++_0x47d79a);}(_0x19d7,0x126));var _0x719d=function(_0x88735b,_0x416173){_0x88735b=_0x88735b-0x0;var _0x36ed4b=_0x19d7[_0x88735b];return _0x36ed4b;};'use strict';var multer=require(_0x719d('0x0'));var util=require(_0x719d('0x1'));var path=require(_0x719d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x719d('0x3')]();var fs_extra=require(_0x719d('0x4'));var auth=require(_0x719d('0x5'));var interaction=require(_0x719d('0x6'));var config=require('../../config/environment');var controller=require(_0x719d('0x7'));router['get']('/',auth[_0x719d('0x8')](),controller[_0x719d('0x9')]);router[_0x719d('0xa')](_0x719d('0xb'),auth[_0x719d('0x8')](),controller[_0x719d('0xc')]);router[_0x719d('0xa')]('/:id',auth[_0x719d('0x8')](),controller[_0x719d('0xd')]);router[_0x719d('0xa')](_0x719d('0xe'),auth[_0x719d('0x8')](),controller[_0x719d('0xf')]);router[_0x719d('0xa')](_0x719d('0x10'),auth['isAuthenticated'](),controller[_0x719d('0x11')]);router[_0x719d('0xa')](_0x719d('0x12'),auth[_0x719d('0x8')](),controller['getAgents']);router[_0x719d('0x13')]('/',auth[_0x719d('0x8')](),controller[_0x719d('0x14')]);router[_0x719d('0x13')]('/:id/teams',auth[_0x719d('0x8')](),controller[_0x719d('0x15')]);router[_0x719d('0x13')](_0x719d('0x12'),auth[_0x719d('0x8')](),controller['addAgents']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x719d('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x719d('0x16')](_0x719d('0x10'),auth[_0x719d('0x8')](),controller[_0x719d('0x17')]);router['delete'](_0x719d('0x12'),auth[_0x719d('0x8')](),controller[_0x719d('0x18')]);module[_0x719d('0x19')]=router; \ No newline at end of file +var _0x1c0c=['removeTeams','removeAgents','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','/:id','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete'];(function(_0x55e67b,_0x57fbed){var _0x4b71c2=function(_0x2bc5ac){while(--_0x2bc5ac){_0x55e67b['push'](_0x55e67b['shift']());}};_0x4b71c2(++_0x57fbed);}(_0x1c0c,0x137));var _0xc1c0=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x1c0c[_0x2df507];return _0x1f7167;};'use strict';var multer=require('multer');var util=require(_0xc1c0('0x0'));var path=require(_0xc1c0('0x1'));var timeout=require(_0xc1c0('0x2'));var express=require('express');var router=express[_0xc1c0('0x3')]();var fs_extra=require(_0xc1c0('0x4'));var auth=require(_0xc1c0('0x5'));var interaction=require(_0xc1c0('0x6'));var config=require(_0xc1c0('0x7'));var controller=require(_0xc1c0('0x8'));router[_0xc1c0('0x9')]('/',auth[_0xc1c0('0xa')](),controller[_0xc1c0('0xb')]);router[_0xc1c0('0x9')](_0xc1c0('0xc'),auth[_0xc1c0('0xa')](),controller['describe']);router['get'](_0xc1c0('0xd'),auth[_0xc1c0('0xa')](),controller['show']);router[_0xc1c0('0x9')]('/:id/members',auth[_0xc1c0('0xa')](),controller[_0xc1c0('0xe')]);router[_0xc1c0('0x9')](_0xc1c0('0xf'),auth[_0xc1c0('0xa')](),controller[_0xc1c0('0x10')]);router[_0xc1c0('0x9')](_0xc1c0('0x11'),auth[_0xc1c0('0xa')](),controller[_0xc1c0('0x12')]);router[_0xc1c0('0x13')]('/',auth[_0xc1c0('0xa')](),controller[_0xc1c0('0x14')]);router[_0xc1c0('0x13')]('/:id/teams',auth['isAuthenticated'](),controller[_0xc1c0('0x15')]);router[_0xc1c0('0x13')](_0xc1c0('0x11'),auth['isAuthenticated'](),controller[_0xc1c0('0x16')]);router['put'](_0xc1c0('0xd'),auth['isAuthenticated'](),controller[_0xc1c0('0x17')]);router[_0xc1c0('0x18')]('/:id',auth[_0xc1c0('0xa')](),controller['destroy']);router['delete'](_0xc1c0('0xf'),auth[_0xc1c0('0xa')](),controller[_0xc1c0('0x19')]);router[_0xc1c0('0x18')](_0xc1c0('0x11'),auth[_0xc1c0('0xa')](),controller[_0xc1c0('0x1a')]);module[_0xc1c0('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 44bafb8..322cc3e 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 _0x7a74=['roundrobin','sequelize','exports','STRING','name','ENUM','beepall'];(function(_0x281a38,_0x20fe7d){var _0x11ad45=function(_0x48d84e){while(--_0x48d84e){_0x281a38['push'](_0x281a38['shift']());}};_0x11ad45(++_0x20fe7d);}(_0x7a74,0xf6));var _0x47a7=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x7a74[_0x49ca18];return _0x145d54;};'use strict';var Sequelize=require(_0x47a7('0x0'));module[_0x47a7('0x1')]={'name':{'type':Sequelize[_0x47a7('0x2')],'unique':_0x47a7('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x47a7('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x47a7('0x4')]('rrmemory',_0x47a7('0x5'),_0x47a7('0x6'))}}; \ No newline at end of file +var _0x527c=['STRING','name','ENUM','rrmemory','sequelize','exports'];(function(_0xda6ad1,_0x5f09e3){var _0xedc3a5=function(_0x5459d7){while(--_0x5459d7){_0xda6ad1['push'](_0xda6ad1['shift']());}};_0xedc3a5(++_0x5f09e3);}(_0x527c,0xe2));var _0xc527=function(_0x44976e,_0x311385){_0x44976e=_0x44976e-0x0;var _0x4852b2=_0x527c[_0x44976e];return _0x4852b2;};'use strict';var Sequelize=require(_0xc527('0x0'));module[_0xc527('0x1')]={'name':{'type':Sequelize[_0xc527('0x2')],'unique':_0xc527('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc527('0x4')](_0xc527('0x5'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 19f5221..718ecf3 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 _0x6cfc=['filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','nolimit','order','sort','pick','MailQueueId','filter','findAll','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','mailPause','getTeams','Team','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','spread','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','status','end','json','undefined','count','offset','limit','Content-Range','update','then','destroy','MailQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','key','getOptions','where','include','rows','catch','show','params','model','keys','query'];(function(_0x567703,_0x4b1cfa){var _0x1cd94a=function(_0x25dcfe){while(--_0x25dcfe){_0x567703['push'](_0x567703['shift']());}};_0x1cd94a(++_0x4b1cfa);}(_0x6cfc,0x142));var _0xc6cf=function(_0x1fc4e2,_0x493c3b){_0x1fc4e2=_0x1fc4e2-0x0;var _0x2ba184=_0x6cfc[_0x1fc4e2];return _0x2ba184;};'use strict';var BPromise=require(_0xc6cf('0x0'));var util=require('util');var _=require(_0xc6cf('0x1'));var squel=require(_0xc6cf('0x2'));var Redis=require(_0xc6cf('0x3'));var qs=require(_0xc6cf('0x4'));var logger=require('../../config/logger')(_0xc6cf('0x5'));var config=require(_0xc6cf('0x6'));var db=require(_0xc6cf('0x7'))['db'];config[_0xc6cf('0x8')]=_[_0xc6cf('0x9')](config[_0xc6cf('0x8')],{'host':_0xc6cf('0xa'),'port':0x18eb});var socket=require(_0xc6cf('0xb'))(new Redis(config[_0xc6cf('0x8')]));require(_0xc6cf('0xc'))['register'](socket);function respondWithStatusCode(_0x4302a9,_0x565a9d){_0x565a9d=_0x565a9d||0xcc;return function(_0x5294a8){if(_0x5294a8){return _0x4302a9['sendStatus'](_0x565a9d);}return _0x4302a9[_0xc6cf('0xd')](_0x565a9d)[_0xc6cf('0xe')]();};}function respondWithResult(_0x3a75a6,_0x53ed83){_0x53ed83=_0x53ed83||0xc8;return function(_0xdca71){if(_0xdca71){return _0x3a75a6[_0xc6cf('0xd')](_0x53ed83)[_0xc6cf('0xf')](_0xdca71);}};}function respondWithFilteredResult(_0x1c4f52,_0x34ff2b){return function(_0x35a0c6){if(_0x35a0c6){var _0x40795e=typeof _0x34ff2b['offset']===_0xc6cf('0x10')&&typeof _0x34ff2b['limit']===_0xc6cf('0x10');var _0x5bd7bd=_0x35a0c6[_0xc6cf('0x11')];var _0x5cbf39=_0x40795e?0x0:_0x34ff2b['offset'];var _0x5c6824=_0x40795e?_0x35a0c6['count']:_0x34ff2b[_0xc6cf('0x12')]+_0x34ff2b[_0xc6cf('0x13')];var _0x4a7108;if(_0x5c6824>=_0x5bd7bd){_0x5c6824=_0x5bd7bd;_0x4a7108=0xc8;}else{_0x4a7108=0xce;}_0x1c4f52[_0xc6cf('0xd')](_0x4a7108);return _0x1c4f52['set'](_0xc6cf('0x14'),_0x5cbf39+'-'+_0x5c6824+'/'+_0x5bd7bd)[_0xc6cf('0xf')](_0x35a0c6);}return null;};}function saveUpdates(_0x3a8954){return function(_0x8f421d){if(_0x8f421d){return _0x8f421d[_0xc6cf('0x15')](_0x3a8954)[_0xc6cf('0x16')](function(_0x2ef534){return _0x2ef534;});}return null;};}function removeEntity(_0x528ee6){return function(_0xf0d7bc){if(_0xf0d7bc){return _0xf0d7bc[_0xc6cf('0x17')]()[_0xc6cf('0x16')](function(){var _0x997f1e=_0xf0d7bc['get']({'plain':!![]});var _0x35c1f1=_0xc6cf('0x18');return db[_0xc6cf('0x19')][_0xc6cf('0x17')]({'where':{'type':_0x35c1f1,'resourceId':_0x997f1e['id']}})[_0xc6cf('0x16')](function(){return _0xf0d7bc;});})[_0xc6cf('0x16')](function(){_0x528ee6[_0xc6cf('0xd')](0xcc)[_0xc6cf('0xe')]();});}};}function handleEntityNotFound(_0x33f1ac){return function(_0x4a1919){if(!_0x4a1919){_0x33f1ac[_0xc6cf('0x1a')](0x194);}return _0x4a1919;};}function handleError(_0x2d1348,_0x26a302){_0x26a302=_0x26a302||0x1f4;return function(_0xdbabd0){logger[_0xc6cf('0x1b')](_0xdbabd0[_0xc6cf('0x1c')]);if(_0xdbabd0[_0xc6cf('0x1d')]){delete _0xdbabd0[_0xc6cf('0x1d')];}_0x2d1348[_0xc6cf('0xd')](_0x26a302)[_0xc6cf('0x1e')](_0xdbabd0);};}exports[_0xc6cf('0x1f')]=function(_0x3561cb,_0x4df727){var _0x356043={};var _0x41a4ec={'count':0x0,'rows':[]};var _0x5b13bf=_[_0xc6cf('0x20')](db[_0xc6cf('0x21')][_0xc6cf('0x22')],function(_0x10fc33){return{'name':_0x10fc33[_0xc6cf('0x23')],'type':_0x10fc33['type'][_0xc6cf('0x24')]};});_0x356043=qs[_0xc6cf('0x25')](_0x5b13bf,_0x3561cb);var _0x25c296={'where':_0x356043[_0xc6cf('0x26')]};return db[_0xc6cf('0x21')][_0xc6cf('0x11')](_0x25c296)[_0xc6cf('0x16')](function(_0x3ba061){_0x41a4ec[_0xc6cf('0x11')]=_0x3ba061;_0x356043[_0xc6cf('0x27')]=qs[_0xc6cf('0x27')](_0x3561cb['query']);return db[_0xc6cf('0x21')]['findAll'](_0x356043);})[_0xc6cf('0x16')](function(_0xb3387a){_0x41a4ec[_0xc6cf('0x28')]=_0xb3387a;return _0x41a4ec;})[_0xc6cf('0x16')](respondWithFilteredResult(_0x4df727,_0x356043))[_0xc6cf('0x29')](handleError(_0x4df727,null));};exports[_0xc6cf('0x2a')]=function(_0x45832f,_0x51d062){var _0x579c3f={'raw':!![],'where':{'id':_0x45832f[_0xc6cf('0x2b')]['id']}},_0x4ebd56={};_0x4ebd56[_0xc6cf('0x2c')]=_[_0xc6cf('0x2d')](db['MailQueue'][_0xc6cf('0x22')]);_0x4ebd56[_0xc6cf('0x2e')]=_[_0xc6cf('0x2d')](_0x45832f[_0xc6cf('0x2e')]);_0x4ebd56[_0xc6cf('0x2f')]=_[_0xc6cf('0x30')](_0x4ebd56[_0xc6cf('0x2c')],_0x4ebd56[_0xc6cf('0x2e')]);_0x579c3f[_0xc6cf('0x31')]=_['intersection'](_0x4ebd56[_0xc6cf('0x2c')],qs[_0xc6cf('0x32')](_0x45832f['query']['fields']));_0x579c3f[_0xc6cf('0x31')]=_0x579c3f['attributes'][_0xc6cf('0x33')]?_0x579c3f[_0xc6cf('0x31')]:_0x4ebd56['model'];if(_0x45832f[_0xc6cf('0x2e')][_0xc6cf('0x34')]){_0x579c3f['include']=[{'all':!![]}];}_0x579c3f=_[_0xc6cf('0x35')]({},_0x579c3f,_0x45832f[_0xc6cf('0x36')]);return db[_0xc6cf('0x21')][_0xc6cf('0x37')](_0x579c3f)[_0xc6cf('0x16')](handleEntityNotFound(_0x51d062,null))['then'](respondWithResult(_0x51d062,null))[_0xc6cf('0x29')](handleError(_0x51d062,null));};exports[_0xc6cf('0x38')]=function(_0x11d5ec,_0x1db36c){return db[_0xc6cf('0x21')][_0xc6cf('0x38')](_0x11d5ec['body'],{})[_0xc6cf('0x16')](function(_0x29a2a9){var _0xff78d8=_0x11d5ec['user']['get']({'plain':!![]});if(!_0xff78d8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xff78d8['role']===_0xc6cf('0x39')){var _0x54fa84=_0x29a2a9[_0xc6cf('0x3a')]({'plain':!![]});var _0x410858=_0xc6cf('0x18');return db[_0xc6cf('0x3b')][_0xc6cf('0x37')]({'where':{'name':_0x410858,'userProfileId':_0xff78d8[_0xc6cf('0x3c')]},'raw':!![]})[_0xc6cf('0x16')](function(_0x3d0a7b){if(_0x3d0a7b&&_0x3d0a7b[_0xc6cf('0x3d')]===0x0){return db['UserProfileResource'][_0xc6cf('0x38')]({'name':_0x54fa84['name'],'resourceId':_0x54fa84['id'],'type':_0x3d0a7b[_0xc6cf('0x1d')],'sectionId':_0x3d0a7b['id']},{})[_0xc6cf('0x16')](function(){return _0x29a2a9;});}else{return _0x29a2a9;}})[_0xc6cf('0x29')](function(_0x4d1d87){logger['error'](_0xc6cf('0x3e'),_0x4d1d87);throw _0x4d1d87;});}return _0x29a2a9;})[_0xc6cf('0x16')](respondWithResult(_0x1db36c,0xc9))['catch'](handleError(_0x1db36c,null));};exports[_0xc6cf('0x15')]=function(_0x4100da,_0x115161){if(_0x4100da[_0xc6cf('0x3f')]['id']){delete _0x4100da[_0xc6cf('0x3f')]['id'];}return db[_0xc6cf('0x21')][_0xc6cf('0x37')]({'where':{'id':_0x4100da[_0xc6cf('0x2b')]['id']}})[_0xc6cf('0x16')](handleEntityNotFound(_0x115161,null))[_0xc6cf('0x16')](saveUpdates(_0x4100da[_0xc6cf('0x3f')],null))['then'](respondWithResult(_0x115161,null))[_0xc6cf('0x29')](handleError(_0x115161,null));};exports[_0xc6cf('0x17')]=function(_0x59225b,_0x474c7d){return db['MailQueue'][_0xc6cf('0x37')]({'where':{'id':_0x59225b[_0xc6cf('0x2b')]['id']}})['then'](handleEntityNotFound(_0x474c7d,null))[_0xc6cf('0x16')](removeEntity(_0x474c7d,null))['catch'](handleError(_0x474c7d,null));};exports['describe']=function(_0x354893,_0x216718){return db['MailQueue'][_0xc6cf('0x40')]()[_0xc6cf('0x16')](respondWithResult(_0x216718,null))[_0xc6cf('0x29')](handleError(_0x216718,null));};exports[_0xc6cf('0x41')]=function(_0x3b6e9f,_0x1d5fcd){var _0x514396={'raw':!![],'where':{}},_0x5bdfbf={},_0x353b0d;return db['MailQueue'][_0xc6cf('0x42')]({'where':{'id':_0x3b6e9f['params']['id']}})[_0xc6cf('0x16')](handleEntityNotFound(_0x1d5fcd,null))['then'](function(_0x4de440){if(_0x4de440){_0x353b0d=_0x4de440[_0xc6cf('0x3a')]({'plain':!![]});_0x5bdfbf['model']=_[_0xc6cf('0x2d')](db[_0xc6cf('0x43')][_0xc6cf('0x22')]);_0x5bdfbf[_0xc6cf('0x2e')]=_[_0xc6cf('0x2d')](_0x3b6e9f[_0xc6cf('0x2e')]);_0x5bdfbf[_0xc6cf('0x2f')]=_['intersection'](_0x5bdfbf[_0xc6cf('0x2c')],_0x5bdfbf[_0xc6cf('0x2e')]);_0x514396[_0xc6cf('0x31')]=_[_0xc6cf('0x30')](_0x5bdfbf[_0xc6cf('0x2c')],qs[_0xc6cf('0x32')](_0x3b6e9f['query'][_0xc6cf('0x32')]));_0x514396[_0xc6cf('0x31')]=_0x514396[_0xc6cf('0x31')][_0xc6cf('0x33')]?_0x514396[_0xc6cf('0x31')]:_0x5bdfbf[_0xc6cf('0x2c')];if(!_0x3b6e9f[_0xc6cf('0x2e')][_0xc6cf('0x44')](_0xc6cf('0x45'))){_0x514396[_0xc6cf('0x13')]=qs[_0xc6cf('0x13')](_0x3b6e9f['query'][_0xc6cf('0x13')]);_0x514396[_0xc6cf('0x12')]=qs[_0xc6cf('0x12')](_0x3b6e9f[_0xc6cf('0x2e')][_0xc6cf('0x12')]);}_0x514396[_0xc6cf('0x46')]=qs[_0xc6cf('0x47')](_0x3b6e9f['query'][_0xc6cf('0x47')]);_0x514396[_0xc6cf('0x26')]=qs['filters'](_[_0xc6cf('0x48')](_0x3b6e9f[_0xc6cf('0x2e')],_0x5bdfbf['filters']));_0x514396[_0xc6cf('0x26')][_0xc6cf('0x49')]=_0x4de440['id'];if(_0x3b6e9f[_0xc6cf('0x2e')][_0xc6cf('0x4a')]){_0x514396[_0xc6cf('0x26')]=_[_0xc6cf('0x35')](_0x514396[_0xc6cf('0x26')],{'$or':_['map'](_0x514396[_0xc6cf('0x31')],function(_0x3322d8){var _0x4f076a={};_0x4f076a[_0x3322d8]={'$like':'%'+_0x3b6e9f['query'][_0xc6cf('0x4a')]+'%'};return _0x4f076a;})});}_0x514396=_['merge']({},_0x514396,_0x3b6e9f[_0xc6cf('0x36')]);return db[_0xc6cf('0x43')][_0xc6cf('0x4b')](_0x514396);}})[_0xc6cf('0x16')](function(_0x316172){if(_0x316172){return db[_0xc6cf('0x4c')][_0xc6cf('0x4d')]({'where':{'id':_[_0xc6cf('0x20')](_0x316172,_0xc6cf('0x4e')),'role':_0xc6cf('0x4f')},'attributes':['id',_0xc6cf('0x1d'),'mailPause',_0xc6cf('0x50'),_0xc6cf('0x51')]});}})['then'](function(_0x8db913){if(_0x8db913){return{'count':_0x8db913['count'],'rows':_['map'](_0x8db913['rows'],function(_0x455c73){return{'membername':_0x455c73[_0xc6cf('0x1d')],'UserId':_0x455c73['id'],'queue_name':_0x353b0d[_0xc6cf('0x1d')],'MailQueueId':_0x353b0d['id'],'interface':util[_0xc6cf('0x52')](_0xc6cf('0x53'),'SIP',_0x455c73[_0xc6cf('0x1d')]),'penalty':0x0,'paused':_0x455c73[_0xc6cf('0x54')],'createdAt':_0x455c73['createdAt'],'updatedAt':_0x455c73[_0xc6cf('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc6cf('0x16')](respondWithFilteredResult(_0x1d5fcd,_0x514396))['catch'](handleError(_0x1d5fcd,null));};exports[_0xc6cf('0x55')]=function(_0x22e8e2,_0x52d019){var _0x224edb={};var _0x4f2ae5={};var _0x1ebd80;var _0x3c0e81;return db['MailQueue']['findOne']({'where':{'id':_0x22e8e2[_0xc6cf('0x2b')]['id']}})['then'](handleEntityNotFound(_0x52d019,null))['then'](function(_0x4f9bb3){if(_0x4f9bb3){_0x1ebd80=_0x4f9bb3;_0x4f2ae5[_0xc6cf('0x2c')]=_[_0xc6cf('0x2d')](db[_0xc6cf('0x56')][_0xc6cf('0x22')]);_0x4f2ae5[_0xc6cf('0x2e')]=_[_0xc6cf('0x2d')](_0x22e8e2['query']);_0x4f2ae5['filters']=_[_0xc6cf('0x30')](_0x4f2ae5[_0xc6cf('0x2c')],_0x4f2ae5[_0xc6cf('0x2e')]);_0x224edb[_0xc6cf('0x31')]=_[_0xc6cf('0x30')](_0x4f2ae5[_0xc6cf('0x2c')],qs[_0xc6cf('0x32')](_0x22e8e2[_0xc6cf('0x2e')][_0xc6cf('0x32')]));_0x224edb['attributes']=_0x224edb[_0xc6cf('0x31')]['length']?_0x224edb['attributes']:_0x4f2ae5[_0xc6cf('0x2c')];_0x224edb[_0xc6cf('0x46')]=qs[_0xc6cf('0x47')](_0x22e8e2['query'][_0xc6cf('0x47')]);_0x224edb[_0xc6cf('0x26')]=qs[_0xc6cf('0x2f')](_[_0xc6cf('0x48')](_0x22e8e2[_0xc6cf('0x2e')],_0x4f2ae5[_0xc6cf('0x2f')]));if(_0x22e8e2[_0xc6cf('0x2e')][_0xc6cf('0x4a')]){_0x224edb[_0xc6cf('0x26')]=_[_0xc6cf('0x35')](_0x224edb[_0xc6cf('0x26')],{'$or':_[_0xc6cf('0x20')](_0x224edb[_0xc6cf('0x31')],function(_0x5db79d){var _0x474182={};_0x474182[_0x5db79d]={'$like':'%'+_0x22e8e2[_0xc6cf('0x2e')]['filter']+'%'};return _0x474182;})});}_0x224edb=_[_0xc6cf('0x35')]({},_0x224edb,_0x22e8e2[_0xc6cf('0x36')]);return _0x1ebd80[_0xc6cf('0x55')](_0x224edb);}})[_0xc6cf('0x16')](function(_0xd1905c){if(_0xd1905c){_0x3c0e81=_0xd1905c[_0xc6cf('0x33')];if(!_0x22e8e2[_0xc6cf('0x2e')][_0xc6cf('0x44')](_0xc6cf('0x45'))){_0x224edb['limit']=qs[_0xc6cf('0x13')](_0x22e8e2[_0xc6cf('0x2e')][_0xc6cf('0x13')]);_0x224edb[_0xc6cf('0x12')]=qs[_0xc6cf('0x12')](_0x22e8e2[_0xc6cf('0x2e')][_0xc6cf('0x12')]);}return _0x1ebd80[_0xc6cf('0x55')](_0x224edb);}})[_0xc6cf('0x16')](function(_0x54b4c0){if(_0x54b4c0){return _0x54b4c0?{'count':_0x3c0e81,'rows':_0x54b4c0}:null;}})['then'](respondWithResult(_0x52d019,null))[_0xc6cf('0x29')](handleError(_0x52d019,null));};exports[_0xc6cf('0x57')]=function(_0x5b39a9,_0x1f9095){var _0xe04770=_0x5b39a9['body'][_0xc6cf('0x58')];return db[_0xc6cf('0x56')]['findAll']({'where':{'id':_0xe04770},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc6cf('0x59'),'attributes':['id',_0xc6cf('0x1d'),_0xc6cf('0x5a'),'voicePause',_0xc6cf('0x5b')],'raw':!![]}]})['then'](function(_0x44dce6){if(_0x44dce6){var _0x303851=_[_0xc6cf('0x5c')](_0x44dce6,function(_0x4f44e1){var _0x5e7169=_0x4f44e1['get']({'plain':!![]});return _0x5e7169[_0xc6cf('0x59')];});return db[_0xc6cf('0x21')][_0xc6cf('0x37')]({'where':{'id':_0x5b39a9[_0xc6cf('0x2b')]['id']}})[_0xc6cf('0x16')](function(_0x53e834){return db[_0xc6cf('0x5d')][_0xc6cf('0x5e')](function(_0x4efb71){return _0x53e834[_0xc6cf('0x57')](_0xe04770,{'transaction':_0x4efb71})[_0xc6cf('0x16')](function(){return BPromise[_0xc6cf('0x5f')](_0x303851,function(_0x1cad81){return db['UserMailQueue'][_0xc6cf('0x60')]({'where':{'UserId':_0x1cad81['id'],'MailQueueId':_0x5b39a9[_0xc6cf('0x2b')]['id']},'transaction':_0x4efb71});});})[_0xc6cf('0x16')](function(){_0x303851[_0xc6cf('0x61')](function(_0x37092e){socket[_0xc6cf('0x62')](_0xc6cf('0x63'),{'UserId':_0x37092e['id'],'MailQueueId':_0x53e834['id']});});});});});}})[_0xc6cf('0x16')](respondWithStatusCode(_0x1f9095,null))[_0xc6cf('0x29')](handleError(_0x1f9095,null));};exports[_0xc6cf('0x64')]=function(_0x57a9f6,_0x46df6e){return db[_0xc6cf('0x56')][_0xc6cf('0x4b')]({'where':{'id':_0x57a9f6[_0xc6cf('0x2e')][_0xc6cf('0x58')]},'attributes':['id'],'include':[{'model':db[_0xc6cf('0x4c')],'as':_0xc6cf('0x59'),'attributes':['id'],'raw':!![]}]})[_0xc6cf('0x16')](handleEntityNotFound(_0x46df6e,null))[_0xc6cf('0x16')](function(_0x1f41d3){var _0x40b5a9=_['map'](_0x1f41d3,'id');var _0x3affd0=[];var _0x2799ea=[];var _0x5af6d0=squel[_0xc6cf('0x65')]();_0x5af6d0['field']('tq.TeamId')['from']('team_has_mail_queues','tq')[_0xc6cf('0x66')](_0xc6cf('0x67'),'ut',_0xc6cf('0x68'))['where'](_0xc6cf('0x69'),_0x57a9f6['params']['id']);for(var _0x468aa6=0x0;_0x468aa6<_0x1f41d3[_0xc6cf('0x33')];_0x468aa6+=0x1){let _0x31045e=_0x1f41d3[_0x468aa6];for(var _0x2d9643=0x0;_0x2d9643<_0x31045e[_0xc6cf('0x59')][_0xc6cf('0x33')];_0x2d9643+=0x1){let _0x181edd=_0x31045e[_0xc6cf('0x59')][_0x2d9643];var _0x449856=_0x5af6d0[_0xc6cf('0x6a')]();_0x449856[_0xc6cf('0x26')](_0xc6cf('0x6b'),_0x181edd['id']);_0x2799ea[_0xc6cf('0x6c')](db[_0xc6cf('0x5d')][_0xc6cf('0x2e')](_0x449856['toString'](),{'type':db['sequelize'][_0xc6cf('0x6d')]['SELECT']})[_0xc6cf('0x16')](function(_0x38daad){if(_0x38daad[_0xc6cf('0x33')]===0x1){return _0x181edd['id'];}else{var _0x42ef25=_[_0xc6cf('0x6e')](_[_0xc6cf('0x20')](_0x38daad,_0xc6cf('0x6f')),function(_0x22aad4){return _[_0xc6cf('0x70')](_0x40b5a9,_0x22aad4);});if(_0x42ef25){return _0x181edd['id'];}}}));}}return BPromise[_0xc6cf('0x71')](_0x2799ea)['then'](function(_0x401d94){_0x3affd0=_(_0x3affd0)[_0xc6cf('0x72')](_0x401d94)[_0xc6cf('0x73')]()[_0xc6cf('0x74')]();return db[_0xc6cf('0x21')][_0xc6cf('0x37')]({'where':{'id':_0x57a9f6[_0xc6cf('0x2b')]['id']}})['then'](function(_0x24677c){return db[_0xc6cf('0x5d')][_0xc6cf('0x5e')](function(_0x3a5c1e){return _0x24677c[_0xc6cf('0x64')](_0x57a9f6[_0xc6cf('0x2e')]['ids'],{'transaction':_0x3a5c1e})[_0xc6cf('0x16')](function(){if(!_[_0xc6cf('0x75')](_0x3affd0)){return _0x24677c[_0xc6cf('0x76')](_0x3affd0,{'transaction':_0x3a5c1e});}})[_0xc6cf('0x16')](function(){_0x3affd0['forEach'](function(_0x2a5f0e){socket[_0xc6cf('0x62')](_0xc6cf('0x77'),{'UserId':_0x2a5f0e,'MailQueueId':_0x24677c['id']});});});});});});})['then'](respondWithStatusCode(_0x46df6e,null))[_0xc6cf('0x29')](handleError(_0x46df6e,null));};exports[_0xc6cf('0x78')]=function(_0x5db3f2,_0x3c059e){return db['MailQueue']['find']({'where':{'id':_0x5db3f2[_0xc6cf('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3c059e,null))[_0xc6cf('0x16')](function(_0xa83bed){if(_0xa83bed){return _0xa83bed['addAgents'](_0x5db3f2[_0xc6cf('0x3f')][_0xc6cf('0x58')],_['omit'](_0x5db3f2['body'],[_0xc6cf('0x58'),'id'])||{})[_0xc6cf('0x79')](function(_0x25fb21){for(var _0x27b118=0x0;_0x27b118<_0x5db3f2[_0xc6cf('0x3f')][_0xc6cf('0x58')][_0xc6cf('0x33')];_0x27b118+=0x1){socket[_0xc6cf('0x62')](_0xc6cf('0x63'),{'UserId':Number(_0x5db3f2[_0xc6cf('0x3f')][_0xc6cf('0x58')][_0x27b118]),'MailQueueId':Number(_0x5db3f2[_0xc6cf('0x2b')]['id'])});}return _0x25fb21;});}})[_0xc6cf('0x16')](respondWithResult(_0x3c059e,null))[_0xc6cf('0x29')](handleError(_0x3c059e,null));};exports[_0xc6cf('0x76')]=function(_0x5ac47f,_0x351544){return db[_0xc6cf('0x21')][_0xc6cf('0x37')]({'where':{'id':_0x5ac47f[_0xc6cf('0x2b')]['id']}})[_0xc6cf('0x16')](handleEntityNotFound(_0x351544,null))['then'](function(_0x586b7c){if(_0x586b7c){return _0x586b7c[_0xc6cf('0x76')](_0x5ac47f[_0xc6cf('0x2e')][_0xc6cf('0x58')])['then'](function(){if(_['isArray'](_0x5ac47f[_0xc6cf('0x2e')][_0xc6cf('0x58')])){for(var _0x2f325f=0x0;_0x2f325f<_0x5ac47f[_0xc6cf('0x2e')][_0xc6cf('0x58')][_0xc6cf('0x33')];_0x2f325f+=0x1){socket[_0xc6cf('0x62')](_0xc6cf('0x77'),{'UserId':Number(_0x5ac47f[_0xc6cf('0x2e')][_0xc6cf('0x58')][_0x2f325f]),'MailQueueId':Number(_0x5ac47f[_0xc6cf('0x2b')]['id'])});}}else{socket[_0xc6cf('0x62')](_0xc6cf('0x77'),{'UserId':Number(_0x5ac47f[_0xc6cf('0x2e')][_0xc6cf('0x58')]),'MailQueueId':Number(_0x5ac47f['params']['id'])});}});}})[_0xc6cf('0x16')](respondWithStatusCode(_0x351544,null))['catch'](handleError(_0x351544,null));};exports[_0xc6cf('0x7a')]=function(_0x2acb93,_0x17eafd){var _0x4b7cea={};var _0x3e8b86={};var _0x580407;var _0x30a771;return db[_0xc6cf('0x21')][_0xc6cf('0x42')]({'where':{'id':_0x2acb93[_0xc6cf('0x2b')]['id']}})['then'](handleEntityNotFound(_0x17eafd,null))['then'](function(_0x261d6f){if(_0x261d6f){_0x580407=_0x261d6f;_0x3e8b86[_0xc6cf('0x2c')]=_[_0xc6cf('0x2d')](db['User']['rawAttributes']);_0x3e8b86['query']=_[_0xc6cf('0x2d')](_0x2acb93['query']);_0x3e8b86['filters']=_['intersection'](_0x3e8b86[_0xc6cf('0x2c')],_0x3e8b86['query']);_0x4b7cea['attributes']=_['intersection'](_0x3e8b86[_0xc6cf('0x2c')],qs[_0xc6cf('0x32')](_0x2acb93[_0xc6cf('0x2e')][_0xc6cf('0x32')]));_0x4b7cea[_0xc6cf('0x31')]=_0x4b7cea['attributes'][_0xc6cf('0x33')]?_0x4b7cea[_0xc6cf('0x31')]:_0x3e8b86['model'];_0x4b7cea[_0xc6cf('0x46')]=qs[_0xc6cf('0x47')](_0x2acb93[_0xc6cf('0x2e')][_0xc6cf('0x47')]);_0x4b7cea['where']=qs[_0xc6cf('0x2f')](_[_0xc6cf('0x48')](_0x2acb93['query'],_0x3e8b86[_0xc6cf('0x2f')]));if(_0x2acb93[_0xc6cf('0x2e')][_0xc6cf('0x4a')]){_0x4b7cea[_0xc6cf('0x26')]=_[_0xc6cf('0x35')](_0x4b7cea[_0xc6cf('0x26')],{'$or':_[_0xc6cf('0x20')](_0x4b7cea[_0xc6cf('0x31')],function(_0x106c51){var _0x1616d3={};_0x1616d3[_0x106c51]={'$like':'%'+_0x2acb93[_0xc6cf('0x2e')][_0xc6cf('0x4a')]+'%'};return _0x1616d3;})});}_0x4b7cea=_[_0xc6cf('0x35')]({},_0x4b7cea,_0x2acb93[_0xc6cf('0x36')]);return _0x580407[_0xc6cf('0x7a')](_0x4b7cea);}})[_0xc6cf('0x16')](function(_0x2be094){if(_0x2be094){_0x30a771=_0x2be094[_0xc6cf('0x33')];if(!_0x2acb93[_0xc6cf('0x2e')][_0xc6cf('0x44')](_0xc6cf('0x45'))){_0x4b7cea[_0xc6cf('0x13')]=qs[_0xc6cf('0x13')](_0x2acb93['query']['limit']);_0x4b7cea[_0xc6cf('0x12')]=qs[_0xc6cf('0x12')](_0x2acb93[_0xc6cf('0x2e')]['offset']);}return _0x580407[_0xc6cf('0x7a')](_0x4b7cea);}})[_0xc6cf('0x16')](function(_0x4eb176){if(_0x4eb176){return _0x4eb176?{'count':_0x30a771,'rows':_0x4eb176}:null;}})[_0xc6cf('0x16')](respondWithResult(_0x17eafd,null))['catch'](handleError(_0x17eafd,null));}; \ No newline at end of file +var _0x969a=['where','include','findAll','rows','catch','show','model','keys','query','filters','attributes','fields','length','merge','options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','describe','getMembers','findOne','UserMailQueue','intersection','nolimit','sort','MailQueueId','filter','map','User','findAndCountAll','UserId','mailPause','updatedAt','createdAt','format','SIP','getTeams','Team','order','hasOwnProperty','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','all','union','value','removeTeams','isEmpty','removeAgents','addAgents','spread','userMailQueue:remove','getAgents','pick','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','get','MailQueues','UserProfileResource','end','error','stack','name','send','index','MailQueue','rawAttributes','type','key','getOptions'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x969a,0x14d));var _0xa969=function(_0x558b7a,_0x893a98){_0x558b7a=_0x558b7a-0x0;var _0xf90999=_0x969a[_0x558b7a];return _0xf90999;};'use strict';var BPromise=require(_0xa969('0x0'));var util=require(_0xa969('0x1'));var _=require(_0xa969('0x2'));var squel=require(_0xa969('0x3'));var Redis=require(_0xa969('0x4'));var qs=require(_0xa969('0x5'));var logger=require('../../config/logger')(_0xa969('0x6'));var config=require(_0xa969('0x7'));var db=require(_0xa969('0x8'))['db'];config[_0xa969('0x9')]=_[_0xa969('0xa')](config[_0xa969('0x9')],{'host':_0xa969('0xb'),'port':0x18eb});var socket=require(_0xa969('0xc'))(new Redis(config[_0xa969('0x9')]));require('./mailQueue.socket')[_0xa969('0xd')](socket);function respondWithStatusCode(_0x263898,_0x4a8afd){_0x4a8afd=_0x4a8afd||0xcc;return function(_0x598403){if(_0x598403){return _0x263898[_0xa969('0xe')](_0x4a8afd);}return _0x263898[_0xa969('0xf')](_0x4a8afd)['end']();};}function respondWithResult(_0x1d7f95,_0x45b52a){_0x45b52a=_0x45b52a||0xc8;return function(_0x4554fb){if(_0x4554fb){return _0x1d7f95[_0xa969('0xf')](_0x45b52a)[_0xa969('0x10')](_0x4554fb);}};}function respondWithFilteredResult(_0x4d1886,_0x272493){return function(_0x5df5ac){if(_0x5df5ac){var _0x365626=typeof _0x272493[_0xa969('0x11')]===_0xa969('0x12')&&typeof _0x272493[_0xa969('0x13')]===_0xa969('0x12');var _0xc6f70d=_0x5df5ac[_0xa969('0x14')];var _0x49c5ba=_0x365626?0x0:_0x272493[_0xa969('0x11')];var _0x4d75a7=_0x365626?_0x5df5ac['count']:_0x272493[_0xa969('0x11')]+_0x272493[_0xa969('0x13')];var _0xa3250f;if(_0x4d75a7>=_0xc6f70d){_0x4d75a7=_0xc6f70d;_0xa3250f=0xc8;}else{_0xa3250f=0xce;}_0x4d1886[_0xa969('0xf')](_0xa3250f);return _0x4d1886[_0xa969('0x15')](_0xa969('0x16'),_0x49c5ba+'-'+_0x4d75a7+'/'+_0xc6f70d)[_0xa969('0x10')](_0x5df5ac);}return null;};}function saveUpdates(_0x26430d){return function(_0x51c463){if(_0x51c463){return _0x51c463[_0xa969('0x17')](_0x26430d)[_0xa969('0x18')](function(_0x4f1d3d){return _0x4f1d3d;});}return null;};}function removeEntity(_0xe2eb38){return function(_0x3f1d79){if(_0x3f1d79){return _0x3f1d79['destroy']()[_0xa969('0x18')](function(){var _0x11c0ba=_0x3f1d79[_0xa969('0x19')]({'plain':!![]});var _0x222eed=_0xa969('0x1a');return db[_0xa969('0x1b')]['destroy']({'where':{'type':_0x222eed,'resourceId':_0x11c0ba['id']}})[_0xa969('0x18')](function(){return _0x3f1d79;});})[_0xa969('0x18')](function(){_0xe2eb38[_0xa969('0xf')](0xcc)[_0xa969('0x1c')]();});}};}function handleEntityNotFound(_0x5db8f7){return function(_0xc3831a){if(!_0xc3831a){_0x5db8f7[_0xa969('0xe')](0x194);}return _0xc3831a;};}function handleError(_0x50af7d,_0x2b914d){_0x2b914d=_0x2b914d||0x1f4;return function(_0x3144f9){logger[_0xa969('0x1d')](_0x3144f9[_0xa969('0x1e')]);if(_0x3144f9[_0xa969('0x1f')]){delete _0x3144f9[_0xa969('0x1f')];}_0x50af7d[_0xa969('0xf')](_0x2b914d)[_0xa969('0x20')](_0x3144f9);};}exports[_0xa969('0x21')]=function(_0x51d9d6,_0x4e7d0f){var _0x3121c9={};var _0x393f9b={'count':0x0,'rows':[]};var _0x180c4d=_['map'](db[_0xa969('0x22')][_0xa969('0x23')],function(_0x4ce0b1){return{'name':_0x4ce0b1['fieldName'],'type':_0x4ce0b1[_0xa969('0x24')][_0xa969('0x25')]};});_0x3121c9=qs[_0xa969('0x26')](_0x180c4d,_0x51d9d6);var _0x48aa9e={'where':_0x3121c9[_0xa969('0x27')]};return db['MailQueue'][_0xa969('0x14')](_0x48aa9e)['then'](function(_0x894592){_0x393f9b[_0xa969('0x14')]=_0x894592;_0x3121c9[_0xa969('0x28')]=qs[_0xa969('0x28')](_0x51d9d6['query']);return db[_0xa969('0x22')][_0xa969('0x29')](_0x3121c9);})[_0xa969('0x18')](function(_0x42d066){_0x393f9b[_0xa969('0x2a')]=_0x42d066;return _0x393f9b;})[_0xa969('0x18')](respondWithFilteredResult(_0x4e7d0f,_0x3121c9))[_0xa969('0x2b')](handleError(_0x4e7d0f,null));};exports[_0xa969('0x2c')]=function(_0x17e131,_0x3e81d8){var _0x3de327={'raw':!![],'where':{'id':_0x17e131['params']['id']}},_0x3e64ec={};_0x3e64ec[_0xa969('0x2d')]=_[_0xa969('0x2e')](db['MailQueue']['rawAttributes']);_0x3e64ec[_0xa969('0x2f')]=_[_0xa969('0x2e')](_0x17e131[_0xa969('0x2f')]);_0x3e64ec[_0xa969('0x30')]=_['intersection'](_0x3e64ec[_0xa969('0x2d')],_0x3e64ec[_0xa969('0x2f')]);_0x3de327[_0xa969('0x31')]=_['intersection'](_0x3e64ec['model'],qs[_0xa969('0x32')](_0x17e131[_0xa969('0x2f')][_0xa969('0x32')]));_0x3de327[_0xa969('0x31')]=_0x3de327[_0xa969('0x31')][_0xa969('0x33')]?_0x3de327[_0xa969('0x31')]:_0x3e64ec[_0xa969('0x2d')];if(_0x17e131[_0xa969('0x2f')]['includeAll']){_0x3de327[_0xa969('0x28')]=[{'all':!![]}];}_0x3de327=_[_0xa969('0x34')]({},_0x3de327,_0x17e131[_0xa969('0x35')]);return db[_0xa969('0x22')][_0xa969('0x36')](_0x3de327)[_0xa969('0x18')](handleEntityNotFound(_0x3e81d8,null))['then'](respondWithResult(_0x3e81d8,null))[_0xa969('0x2b')](handleError(_0x3e81d8,null));};exports[_0xa969('0x37')]=function(_0x4a6392,_0xe4a6c7){return db[_0xa969('0x22')]['create'](_0x4a6392[_0xa969('0x38')],{})[_0xa969('0x18')](function(_0x344dd0){var _0x4c6766=_0x4a6392[_0xa969('0x39')][_0xa969('0x19')]({'plain':!![]});if(!_0x4c6766)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c6766['role']==='user'){var _0x3c2912=_0x344dd0[_0xa969('0x19')]({'plain':!![]});var _0x257a0a=_0xa969('0x1a');return db[_0xa969('0x3a')][_0xa969('0x36')]({'where':{'name':_0x257a0a,'userProfileId':_0x4c6766[_0xa969('0x3b')]},'raw':!![]})[_0xa969('0x18')](function(_0x538606){if(_0x538606&&_0x538606[_0xa969('0x3c')]===0x0){return db['UserProfileResource'][_0xa969('0x37')]({'name':_0x3c2912[_0xa969('0x1f')],'resourceId':_0x3c2912['id'],'type':_0x538606[_0xa969('0x1f')],'sectionId':_0x538606['id']},{})['then'](function(){return _0x344dd0;});}else{return _0x344dd0;}})[_0xa969('0x2b')](function(_0x46b591){logger[_0xa969('0x1d')](_0xa969('0x3d'),_0x46b591);throw _0x46b591;});}return _0x344dd0;})[_0xa969('0x18')](respondWithResult(_0xe4a6c7,0xc9))[_0xa969('0x2b')](handleError(_0xe4a6c7,null));};exports[_0xa969('0x17')]=function(_0x50ef74,_0xfa5152){if(_0x50ef74[_0xa969('0x38')]['id']){delete _0x50ef74['body']['id'];}return db[_0xa969('0x22')][_0xa969('0x36')]({'where':{'id':_0x50ef74[_0xa969('0x3e')]['id']}})[_0xa969('0x18')](handleEntityNotFound(_0xfa5152,null))[_0xa969('0x18')](saveUpdates(_0x50ef74['body'],null))[_0xa969('0x18')](respondWithResult(_0xfa5152,null))['catch'](handleError(_0xfa5152,null));};exports[_0xa969('0x3f')]=function(_0x350fee,_0x1dc8b4){return db[_0xa969('0x22')][_0xa969('0x36')]({'where':{'id':_0x350fee[_0xa969('0x3e')]['id']}})[_0xa969('0x18')](handleEntityNotFound(_0x1dc8b4,null))[_0xa969('0x18')](removeEntity(_0x1dc8b4,null))[_0xa969('0x2b')](handleError(_0x1dc8b4,null));};exports[_0xa969('0x40')]=function(_0x351103,_0x8079bc){return db[_0xa969('0x22')][_0xa969('0x40')]()['then'](respondWithResult(_0x8079bc,null))[_0xa969('0x2b')](handleError(_0x8079bc,null));};exports[_0xa969('0x41')]=function(_0x4dd1a6,_0x5d0b6f){var _0x3cdd60={'raw':!![],'where':{}},_0x322050={},_0x471c19;return db[_0xa969('0x22')][_0xa969('0x42')]({'where':{'id':_0x4dd1a6['params']['id']}})[_0xa969('0x18')](handleEntityNotFound(_0x5d0b6f,null))[_0xa969('0x18')](function(_0x3a7649){if(_0x3a7649){_0x471c19=_0x3a7649[_0xa969('0x19')]({'plain':!![]});_0x322050[_0xa969('0x2d')]=_['keys'](db[_0xa969('0x43')]['rawAttributes']);_0x322050[_0xa969('0x2f')]=_[_0xa969('0x2e')](_0x4dd1a6[_0xa969('0x2f')]);_0x322050['filters']=_['intersection'](_0x322050[_0xa969('0x2d')],_0x322050['query']);_0x3cdd60[_0xa969('0x31')]=_[_0xa969('0x44')](_0x322050[_0xa969('0x2d')],qs[_0xa969('0x32')](_0x4dd1a6['query'][_0xa969('0x32')]));_0x3cdd60[_0xa969('0x31')]=_0x3cdd60[_0xa969('0x31')][_0xa969('0x33')]?_0x3cdd60[_0xa969('0x31')]:_0x322050[_0xa969('0x2d')];if(!_0x4dd1a6[_0xa969('0x2f')]['hasOwnProperty'](_0xa969('0x45'))){_0x3cdd60[_0xa969('0x13')]=qs[_0xa969('0x13')](_0x4dd1a6[_0xa969('0x2f')][_0xa969('0x13')]);_0x3cdd60[_0xa969('0x11')]=qs['offset'](_0x4dd1a6['query']['offset']);}_0x3cdd60['order']=qs[_0xa969('0x46')](_0x4dd1a6['query'][_0xa969('0x46')]);_0x3cdd60[_0xa969('0x27')]=qs[_0xa969('0x30')](_['pick'](_0x4dd1a6['query'],_0x322050[_0xa969('0x30')]));_0x3cdd60[_0xa969('0x27')][_0xa969('0x47')]=_0x3a7649['id'];if(_0x4dd1a6[_0xa969('0x2f')][_0xa969('0x48')]){_0x3cdd60[_0xa969('0x27')]=_[_0xa969('0x34')](_0x3cdd60[_0xa969('0x27')],{'$or':_[_0xa969('0x49')](_0x3cdd60[_0xa969('0x31')],function(_0x32b73c){var _0x1f2c3f={};_0x1f2c3f[_0x32b73c]={'$like':'%'+_0x4dd1a6[_0xa969('0x2f')]['filter']+'%'};return _0x1f2c3f;})});}_0x3cdd60=_[_0xa969('0x34')]({},_0x3cdd60,_0x4dd1a6[_0xa969('0x35')]);return db[_0xa969('0x43')][_0xa969('0x29')](_0x3cdd60);}})[_0xa969('0x18')](function(_0x162be1){if(_0x162be1){return db[_0xa969('0x4a')][_0xa969('0x4b')]({'where':{'id':_[_0xa969('0x49')](_0x162be1,_0xa969('0x4c')),'role':'agent'},'attributes':['id',_0xa969('0x1f'),_0xa969('0x4d'),_0xa969('0x4e'),_0xa969('0x4f')]});}})[_0xa969('0x18')](function(_0x2a25a5){if(_0x2a25a5){return{'count':_0x2a25a5['count'],'rows':_[_0xa969('0x49')](_0x2a25a5[_0xa969('0x2a')],function(_0x457500){return{'membername':_0x457500[_0xa969('0x1f')],'UserId':_0x457500['id'],'queue_name':_0x471c19['name'],'MailQueueId':_0x471c19['id'],'interface':util[_0xa969('0x50')]('%s/%s',_0xa969('0x51'),_0x457500[_0xa969('0x1f')]),'penalty':0x0,'paused':_0x457500['mailPause'],'createdAt':_0x457500['createdAt'],'updatedAt':_0x457500[_0xa969('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa969('0x18')](respondWithFilteredResult(_0x5d0b6f,_0x3cdd60))[_0xa969('0x2b')](handleError(_0x5d0b6f,null));};exports[_0xa969('0x52')]=function(_0x441dc6,_0x10d307){var _0x2c4151={};var _0x497661={};var _0x389393;var _0x2632d8;return db[_0xa969('0x22')][_0xa969('0x42')]({'where':{'id':_0x441dc6[_0xa969('0x3e')]['id']}})[_0xa969('0x18')](handleEntityNotFound(_0x10d307,null))[_0xa969('0x18')](function(_0x4d2708){if(_0x4d2708){_0x389393=_0x4d2708;_0x497661['model']=_['keys'](db[_0xa969('0x53')][_0xa969('0x23')]);_0x497661['query']=_[_0xa969('0x2e')](_0x441dc6[_0xa969('0x2f')]);_0x497661[_0xa969('0x30')]=_['intersection'](_0x497661['model'],_0x497661[_0xa969('0x2f')]);_0x2c4151['attributes']=_[_0xa969('0x44')](_0x497661[_0xa969('0x2d')],qs[_0xa969('0x32')](_0x441dc6[_0xa969('0x2f')]['fields']));_0x2c4151[_0xa969('0x31')]=_0x2c4151[_0xa969('0x31')][_0xa969('0x33')]?_0x2c4151[_0xa969('0x31')]:_0x497661['model'];_0x2c4151[_0xa969('0x54')]=qs[_0xa969('0x46')](_0x441dc6[_0xa969('0x2f')][_0xa969('0x46')]);_0x2c4151[_0xa969('0x27')]=qs[_0xa969('0x30')](_['pick'](_0x441dc6[_0xa969('0x2f')],_0x497661[_0xa969('0x30')]));if(_0x441dc6[_0xa969('0x2f')][_0xa969('0x48')]){_0x2c4151[_0xa969('0x27')]=_[_0xa969('0x34')](_0x2c4151['where'],{'$or':_['map'](_0x2c4151[_0xa969('0x31')],function(_0x5b9bdb){var _0x2a8207={};_0x2a8207[_0x5b9bdb]={'$like':'%'+_0x441dc6['query']['filter']+'%'};return _0x2a8207;})});}_0x2c4151=_['merge']({},_0x2c4151,_0x441dc6['options']);return _0x389393[_0xa969('0x52')](_0x2c4151);}})['then'](function(_0x589eb2){if(_0x589eb2){_0x2632d8=_0x589eb2[_0xa969('0x33')];if(!_0x441dc6['query'][_0xa969('0x55')]('nolimit')){_0x2c4151[_0xa969('0x13')]=qs[_0xa969('0x13')](_0x441dc6['query'][_0xa969('0x13')]);_0x2c4151[_0xa969('0x11')]=qs['offset'](_0x441dc6[_0xa969('0x2f')][_0xa969('0x11')]);}return _0x389393[_0xa969('0x52')](_0x2c4151);}})['then'](function(_0x49b0b9){if(_0x49b0b9){return _0x49b0b9?{'count':_0x2632d8,'rows':_0x49b0b9}:null;}})[_0xa969('0x18')](respondWithResult(_0x10d307,null))['catch'](handleError(_0x10d307,null));};exports[_0xa969('0x56')]=function(_0x459bce,_0x2ed210){var _0x215c94=_0x459bce['body'][_0xa969('0x57')];return db[_0xa969('0x53')][_0xa969('0x29')]({'where':{'id':_0x215c94},'attributes':['id'],'include':[{'model':db[_0xa969('0x4a')],'as':_0xa969('0x58'),'attributes':['id','name',_0xa969('0x59'),_0xa969('0x5a'),_0xa969('0x5b')],'raw':!![]}]})[_0xa969('0x18')](function(_0x45f27b){if(_0x45f27b){var _0x46b416=_[_0xa969('0x5c')](_0x45f27b,function(_0x524e1d){var _0x34d8cc=_0x524e1d[_0xa969('0x19')]({'plain':!![]});return _0x34d8cc[_0xa969('0x58')];});return db['MailQueue']['find']({'where':{'id':_0x459bce[_0xa969('0x3e')]['id']}})[_0xa969('0x18')](function(_0x30c4b5){return db[_0xa969('0x5d')][_0xa969('0x5e')](function(_0x23d1d8){return _0x30c4b5['addTeams'](_0x215c94,{'transaction':_0x23d1d8})['then'](function(){return BPromise[_0xa969('0x5f')](_0x46b416,function(_0x2ce597){return db[_0xa969('0x43')][_0xa969('0x60')]({'where':{'UserId':_0x2ce597['id'],'MailQueueId':_0x459bce[_0xa969('0x3e')]['id']},'transaction':_0x23d1d8});});})[_0xa969('0x18')](function(){_0x46b416[_0xa969('0x61')](function(_0x25741e){socket[_0xa969('0x62')]('userMailQueue:save',{'UserId':_0x25741e['id'],'MailQueueId':_0x30c4b5['id']});});});});});}})[_0xa969('0x18')](respondWithStatusCode(_0x2ed210,null))[_0xa969('0x2b')](handleError(_0x2ed210,null));};exports['removeTeams']=function(_0x1076b0,_0x3b0eff){return db[_0xa969('0x53')][_0xa969('0x29')]({'where':{'id':_0x1076b0['query'][_0xa969('0x57')]},'attributes':['id'],'include':[{'model':db[_0xa969('0x4a')],'as':_0xa969('0x58'),'attributes':['id'],'raw':!![]}]})[_0xa969('0x18')](handleEntityNotFound(_0x3b0eff,null))[_0xa969('0x18')](function(_0x36fef3){var _0xf77488=_[_0xa969('0x49')](_0x36fef3,'id');var _0x58376c=[];var _0x5c459a=[];var _0x430490=squel['select']();_0x430490[_0xa969('0x63')](_0xa969('0x64'))[_0xa969('0x65')](_0xa969('0x66'),'tq')[_0xa969('0x67')](_0xa969('0x68'),'ut',_0xa969('0x69'))[_0xa969('0x27')](_0xa969('0x6a'),_0x1076b0[_0xa969('0x3e')]['id']);for(var _0x119c12=0x0;_0x119c12<_0x36fef3[_0xa969('0x33')];_0x119c12+=0x1){let _0x521d7f=_0x36fef3[_0x119c12];for(var _0x2199c0=0x0;_0x2199c0<_0x521d7f[_0xa969('0x58')][_0xa969('0x33')];_0x2199c0+=0x1){let _0x33fc79=_0x521d7f[_0xa969('0x58')][_0x2199c0];var _0x5ee500=_0x430490[_0xa969('0x6b')]();_0x5ee500['where']('ut.UserId\x20=\x20?',_0x33fc79['id']);_0x5c459a['push'](db[_0xa969('0x5d')]['query'](_0x5ee500[_0xa969('0x6c')](),{'type':db[_0xa969('0x5d')][_0xa969('0x6d')][_0xa969('0x6e')]})[_0xa969('0x18')](function(_0x48567f){if(_0x48567f[_0xa969('0x33')]===0x1){return _0x33fc79['id'];}else{var _0xf24efc=_[_0xa969('0x6f')](_[_0xa969('0x49')](_0x48567f,_0xa969('0x70')),function(_0x303a60){return _['includes'](_0xf77488,_0x303a60);});if(_0xf24efc){return _0x33fc79['id'];}}}));}}return BPromise[_0xa969('0x71')](_0x5c459a)[_0xa969('0x18')](function(_0x4c95c0){_0x58376c=_(_0x58376c)[_0xa969('0x72')](_0x4c95c0)['compact']()[_0xa969('0x73')]();return db[_0xa969('0x22')][_0xa969('0x36')]({'where':{'id':_0x1076b0[_0xa969('0x3e')]['id']}})[_0xa969('0x18')](function(_0x1a3cc7){return db[_0xa969('0x5d')][_0xa969('0x5e')](function(_0x3ab1ed){return _0x1a3cc7[_0xa969('0x74')](_0x1076b0[_0xa969('0x2f')][_0xa969('0x57')],{'transaction':_0x3ab1ed})[_0xa969('0x18')](function(){if(!_[_0xa969('0x75')](_0x58376c)){return _0x1a3cc7[_0xa969('0x76')](_0x58376c,{'transaction':_0x3ab1ed});}})[_0xa969('0x18')](function(){_0x58376c[_0xa969('0x61')](function(_0x3850b6){socket[_0xa969('0x62')]('userMailQueue:remove',{'UserId':_0x3850b6,'MailQueueId':_0x1a3cc7['id']});});});});});});})[_0xa969('0x18')](respondWithStatusCode(_0x3b0eff,null))['catch'](handleError(_0x3b0eff,null));};exports[_0xa969('0x77')]=function(_0xae931a,_0x25a94e){return db[_0xa969('0x22')][_0xa969('0x36')]({'where':{'id':_0xae931a[_0xa969('0x3e')]['id']}})[_0xa969('0x18')](handleEntityNotFound(_0x25a94e,null))[_0xa969('0x18')](function(_0xcc5ec2){if(_0xcc5ec2){return _0xcc5ec2[_0xa969('0x77')](_0xae931a['body'][_0xa969('0x57')],_['omit'](_0xae931a[_0xa969('0x38')],[_0xa969('0x57'),'id'])||{})[_0xa969('0x78')](function(_0x2ec891){for(var _0x1d6118=0x0;_0x1d6118<_0xae931a[_0xa969('0x38')][_0xa969('0x57')]['length'];_0x1d6118+=0x1){socket['emit']('userMailQueue:save',{'UserId':Number(_0xae931a[_0xa969('0x38')]['ids'][_0x1d6118]),'MailQueueId':Number(_0xae931a[_0xa969('0x3e')]['id'])});}return _0x2ec891;});}})[_0xa969('0x18')](respondWithResult(_0x25a94e,null))[_0xa969('0x2b')](handleError(_0x25a94e,null));};exports[_0xa969('0x76')]=function(_0x2b51d6,_0x194b0f){return db[_0xa969('0x22')][_0xa969('0x36')]({'where':{'id':_0x2b51d6['params']['id']}})['then'](handleEntityNotFound(_0x194b0f,null))[_0xa969('0x18')](function(_0x282f66){if(_0x282f66){return _0x282f66[_0xa969('0x76')](_0x2b51d6['query'][_0xa969('0x57')])[_0xa969('0x18')](function(){if(_['isArray'](_0x2b51d6[_0xa969('0x2f')][_0xa969('0x57')])){for(var _0x723435=0x0;_0x723435<_0x2b51d6[_0xa969('0x2f')][_0xa969('0x57')][_0xa969('0x33')];_0x723435+=0x1){socket['emit'](_0xa969('0x79'),{'UserId':Number(_0x2b51d6['query']['ids'][_0x723435]),'MailQueueId':Number(_0x2b51d6[_0xa969('0x3e')]['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x2b51d6[_0xa969('0x2f')]['ids']),'MailQueueId':Number(_0x2b51d6[_0xa969('0x3e')]['id'])});}});}})[_0xa969('0x18')](respondWithStatusCode(_0x194b0f,null))[_0xa969('0x2b')](handleError(_0x194b0f,null));};exports[_0xa969('0x7a')]=function(_0x262722,_0x120242){var _0x342ae6={};var _0x222032={};var _0x399220;var _0x2879e0;return db[_0xa969('0x22')][_0xa969('0x42')]({'where':{'id':_0x262722[_0xa969('0x3e')]['id']}})[_0xa969('0x18')](handleEntityNotFound(_0x120242,null))[_0xa969('0x18')](function(_0x22a33c){if(_0x22a33c){_0x399220=_0x22a33c;_0x222032['model']=_['keys'](db['User']['rawAttributes']);_0x222032[_0xa969('0x2f')]=_[_0xa969('0x2e')](_0x262722[_0xa969('0x2f')]);_0x222032['filters']=_[_0xa969('0x44')](_0x222032[_0xa969('0x2d')],_0x222032[_0xa969('0x2f')]);_0x342ae6[_0xa969('0x31')]=_[_0xa969('0x44')](_0x222032[_0xa969('0x2d')],qs['fields'](_0x262722[_0xa969('0x2f')][_0xa969('0x32')]));_0x342ae6[_0xa969('0x31')]=_0x342ae6[_0xa969('0x31')][_0xa969('0x33')]?_0x342ae6['attributes']:_0x222032[_0xa969('0x2d')];_0x342ae6[_0xa969('0x54')]=qs[_0xa969('0x46')](_0x262722[_0xa969('0x2f')][_0xa969('0x46')]);_0x342ae6[_0xa969('0x27')]=qs['filters'](_[_0xa969('0x7b')](_0x262722['query'],_0x222032['filters']));if(_0x262722[_0xa969('0x2f')][_0xa969('0x48')]){_0x342ae6[_0xa969('0x27')]=_['merge'](_0x342ae6[_0xa969('0x27')],{'$or':_[_0xa969('0x49')](_0x342ae6[_0xa969('0x31')],function(_0x281a50){var _0x1d2b37={};_0x1d2b37[_0x281a50]={'$like':'%'+_0x262722[_0xa969('0x2f')][_0xa969('0x48')]+'%'};return _0x1d2b37;})});}_0x342ae6=_[_0xa969('0x34')]({},_0x342ae6,_0x262722[_0xa969('0x35')]);return _0x399220[_0xa969('0x7a')](_0x342ae6);}})[_0xa969('0x18')](function(_0x55b1f3){if(_0x55b1f3){_0x2879e0=_0x55b1f3[_0xa969('0x33')];if(!_0x262722[_0xa969('0x2f')][_0xa969('0x55')](_0xa969('0x45'))){_0x342ae6[_0xa969('0x13')]=qs[_0xa969('0x13')](_0x262722[_0xa969('0x2f')]['limit']);_0x342ae6[_0xa969('0x11')]=qs[_0xa969('0x11')](_0x262722['query'][_0xa969('0x11')]);}return _0x399220[_0xa969('0x7a')](_0x342ae6);}})['then'](function(_0x18ce50){if(_0x18ce50){return _0x18ce50?{'count':_0x2879e0,'rows':_0x18ce50}:null;}})[_0xa969('0x18')](respondWithResult(_0x120242,null))[_0xa969('0x2b')](handleError(_0x120242,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 21abed1..63e28e6 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 _0x6de5=['save','update','remove','emit','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x3ef2d5,_0x423d46){var _0x2fefb2=function(_0x54f82f){while(--_0x54f82f){_0x3ef2d5['push'](_0x3ef2d5['shift']());}};_0x2fefb2(++_0x423d46);}(_0x6de5,0x1b4));var _0x56de=function(_0x182cbc,_0x341d97){_0x182cbc=_0x182cbc-0x0;var _0x3bb31d=_0x6de5[_0x182cbc];return _0x3bb31d;};'use strict';var EventEmitter=require(_0x56de('0x0'));var MailQueue=require(_0x56de('0x1'))['db'][_0x56de('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x56de('0x3')](0x0);var events={'afterCreate':_0x56de('0x4'),'afterUpdate':_0x56de('0x5'),'afterDestroy':_0x56de('0x6')};function emitEvent(_0x4d32e5){return function(_0x5dd0ac,_0x23c53f,_0x96367b){MailQueueEvents[_0x56de('0x7')](_0x4d32e5+':'+_0x5dd0ac['id'],_0x5dd0ac);MailQueueEvents[_0x56de('0x7')](_0x4d32e5,_0x5dd0ac);_0x96367b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x56de('0x8')](e,emitEvent(event));}}module[_0x56de('0x9')]=MailQueueEvents; \ No newline at end of file +var _0x1fe0=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x4b91c4,_0x23f35f){var _0x25cb80=function(_0x48e283){while(--_0x48e283){_0x4b91c4['push'](_0x4b91c4['shift']());}};_0x25cb80(++_0x23f35f);}(_0x1fe0,0x1d3));var _0x01fe=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x1fe0[_0x4c445a];return _0x2f611c;};'use strict';var EventEmitter=require(_0x01fe('0x0'));var MailQueue=require(_0x01fe('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x01fe('0x2')](0x0);var events={'afterCreate':_0x01fe('0x3'),'afterUpdate':_0x01fe('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1d75f5){return function(_0x339094,_0x1dc39a,_0xf52bc7){MailQueueEvents['emit'](_0x1d75f5+':'+_0x339094['id'],_0x339094);MailQueueEvents['emit'](_0x1d75f5,_0x339094);_0xf52bc7(null);};}for(var e in events){if(events[_0x01fe('0x5')](e)){var event=events[e];MailQueue[_0x01fe('0x6')](e,emitEvent(event));}}module[_0x01fe('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 074184e..0ec3e6a 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 _0x49fd=['rimraf','../../config/environment','./mailQueue.attributes','MailQueue','mail_queues','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x49fd,0x9f));var _0xd49f=function(_0x47d64f,_0x1a69b6){_0x47d64f=_0x47d64f-0x0;var _0x142e4c=_0x49fd[_0x47d64f];return _0x142e4c;};'use strict';var _=require(_0xd49f('0x0'));var util=require(_0xd49f('0x1'));var logger=require(_0xd49f('0x2'))('api');var moment=require(_0xd49f('0x3'));var BPromise=require(_0xd49f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd49f('0x5'));var rimraf=require(_0xd49f('0x6'));var config=require(_0xd49f('0x7'));var attributes=require(_0xd49f('0x8'));module['exports']=function(_0x370092,_0x1f2821){return _0x370092['define'](_0xd49f('0x9'),attributes,{'tableName':_0xd49f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb048=['moment','bluebird','request-promise','path','../../config/environment','exports','define','MailQueue','util','../../config/logger','api'];(function(_0x3c78e7,_0x19a615){var _0x46c763=function(_0x5484a1){while(--_0x5484a1){_0x3c78e7['push'](_0x3c78e7['shift']());}};_0x46c763(++_0x19a615);}(_0xb048,0x152));var _0x8b04=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb048[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x8b04('0x0'));var logger=require(_0x8b04('0x1'))(_0x8b04('0x2'));var moment=require(_0x8b04('0x3'));var BPromise=require(_0x8b04('0x4'));var rp=require(_0x8b04('0x5'));var fs=require('fs');var path=require(_0x8b04('0x6'));var rimraf=require('rimraf');var config=require(_0x8b04('0x7'));var attributes=require('./mailQueue.attributes');module[_0x8b04('0x8')]=function(_0x2073b4,_0x1e5f63){return _0x2073b4[_0x8b04('0x9')](_0x8b04('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 67cdfb6..64758f0 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 _0x7008=['request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','result','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','info','GetMailQueue','debug','find','ShowMailQueue','catch','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then'];(function(_0x108a64,_0x2c86b1){var _0x495fa5=function(_0x3b37ea){while(--_0x3b37ea){_0x108a64['push'](_0x108a64['shift']());}};_0x495fa5(++_0x2c86b1);}(_0x7008,0x1ec));var _0x8700=function(_0x6959b7,_0x9b0a33){_0x6959b7=_0x6959b7-0x0;var _0x2057e9=_0x7008[_0x6959b7];return _0x2057e9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8700('0x0'));var BPromise=require('bluebird');var rs=require(_0x8700('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8700('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x8700('0x3'))(_0x8700('0x4'));var config=require('../../config/environment');var jayson=require(_0x8700('0x5'));var client=jayson[_0x8700('0x6')][_0x8700('0x7')]({'port':0x232a});config[_0x8700('0x8')]=_['defaults'](config[_0x8700('0x8')],{'host':_0x8700('0x9'),'port':0x18eb});var socket=require(_0x8700('0xa'))(new Redis(config[_0x8700('0x8')]));require(_0x8700('0xb'))[_0x8700('0xc')](socket);function respondWithRpcPromise(_0x5d3dde,_0x488e49,_0xfd483e){return new BPromise(function(_0x3e91a1,_0x39cf33){return client[_0x8700('0xd')](_0x5d3dde,_0xfd483e)[_0x8700('0xe')](function(_0x3dea95){logger['info']('MailQueue,\x20%s,\x20%s',_0x488e49,_0x8700('0xf'));logger['debug'](_0x8700('0x10'),_0x488e49,_0x8700('0xf'),JSON[_0x8700('0x11')](_0x3dea95));if(_0x3dea95[_0x8700('0x12')]){if(_0x3dea95[_0x8700('0x12')][_0x8700('0x13')]===0x1f4){logger[_0x8700('0x12')](_0x8700('0x14'),_0x488e49,_0x3dea95[_0x8700('0x12')][_0x8700('0x15')]);return _0x39cf33(_0x3dea95['error'][_0x8700('0x15')]);}logger[_0x8700('0x12')](_0x8700('0x14'),_0x488e49,_0x3dea95[_0x8700('0x12')][_0x8700('0x15')]);return _0x3e91a1(_0x3dea95[_0x8700('0x12')][_0x8700('0x15')]);}else{logger['info'](_0x8700('0x14'),_0x488e49,_0x8700('0xf'));_0x3e91a1(_0x3dea95[_0x8700('0x16')][_0x8700('0x15')]);}})['catch'](function(_0x18eb68){logger['error'](_0x8700('0x14'),_0x488e49,_0x18eb68);_0x39cf33(_0x18eb68);});});}exports['GetMailQueue']=function(_0x2511fd){var _0x565009=this;return new Promise(function(_0x1fb611,_0x4125a2){return db[_0x8700('0x17')][_0x8700('0x18')]({'raw':_0x2511fd[_0x8700('0x19')]?_0x2511fd[_0x8700('0x19')][_0x8700('0x1a')]===undefined?!![]:![]:!![],'where':_0x2511fd[_0x8700('0x19')]?_0x2511fd[_0x8700('0x19')][_0x8700('0x1b')]||null:null,'attributes':_0x2511fd['options']?_0x2511fd['options'][_0x8700('0x1c')]||null:null,'limit':_0x2511fd[_0x8700('0x19')]?_0x2511fd[_0x8700('0x19')][_0x8700('0x1d')]||null:null,'include':_0x2511fd[_0x8700('0x19')]?_0x2511fd[_0x8700('0x19')][_0x8700('0x1e')]?_['map'](_0x2511fd[_0x8700('0x19')][_0x8700('0x1e')],function(_0x25bc66){return{'model':db[_0x25bc66['model']],'as':_0x25bc66['as'],'attributes':_0x25bc66[_0x8700('0x1c')],'include':_0x25bc66[_0x8700('0x1e')]?_[_0x8700('0x1f')](_0x25bc66[_0x8700('0x1e')],function(_0x463b9c){return{'model':db[_0x463b9c[_0x8700('0x20')]],'as':_0x463b9c['as'],'attributes':_0x463b9c[_0x8700('0x1c')],'include':_0x463b9c['include']?_[_0x8700('0x1f')](_0x463b9c['include'],function(_0x33bc74){return{'model':db[_0x33bc74[_0x8700('0x20')]],'as':_0x33bc74['as'],'attributes':_0x33bc74['attributes']};}):[]};}):[]};}):[]:[]})[_0x8700('0xe')](function(_0x4d4624){logger[_0x8700('0x21')](_0x8700('0x22'),_0x2511fd);logger[_0x8700('0x23')](_0x8700('0x22'),_0x2511fd,JSON[_0x8700('0x11')](_0x4d4624));_0x1fb611(_0x4d4624);})['catch'](function(_0x57827a){logger[_0x8700('0x12')](_0x8700('0x22'),_0x57827a[_0x8700('0x15')],_0x2511fd);_0x4125a2(_0x565009['error'](0x1f4,_0x57827a['message']));});});};exports['ShowMailQueue']=function(_0x14c2cb){var _0x353dd2=this;return new Promise(function(_0xc9bffc,_0x5a06a6){return db[_0x8700('0x17')][_0x8700('0x24')]({'raw':_0x14c2cb[_0x8700('0x19')]?_0x14c2cb[_0x8700('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x14c2cb[_0x8700('0x19')]?_0x14c2cb[_0x8700('0x19')]['where']||null:null,'attributes':_0x14c2cb[_0x8700('0x19')]?_0x14c2cb[_0x8700('0x19')][_0x8700('0x1c')]||null:null,'include':_0x14c2cb['options']?_0x14c2cb[_0x8700('0x19')][_0x8700('0x1e')]?_[_0x8700('0x1f')](_0x14c2cb[_0x8700('0x19')]['include'],function(_0x770fe1){return{'model':db[_0x770fe1[_0x8700('0x20')]],'as':_0x770fe1['as'],'attributes':_0x770fe1[_0x8700('0x1c')],'include':_0x770fe1[_0x8700('0x1e')]?_['map'](_0x770fe1[_0x8700('0x1e')],function(_0x28920e){return{'model':db[_0x28920e[_0x8700('0x20')]],'as':_0x28920e['as'],'attributes':_0x28920e[_0x8700('0x1c')],'include':_0x28920e['include']?_['map'](_0x28920e[_0x8700('0x1e')],function(_0x28c70c){return{'model':db[_0x28c70c[_0x8700('0x20')]],'as':_0x28c70c['as'],'attributes':_0x28c70c[_0x8700('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8700('0xe')](function(_0x1ee304){logger[_0x8700('0x21')](_0x8700('0x25'),_0x14c2cb);logger[_0x8700('0x23')]('ShowMailQueue',_0x14c2cb,JSON[_0x8700('0x11')](_0x1ee304));_0xc9bffc(_0x1ee304);})[_0x8700('0x26')](function(_0x3e8225){logger['error']('ShowMailQueue',_0x3e8225['message'],_0x14c2cb);_0x5a06a6(_0x353dd2[_0x8700('0x12')](0x1f4,_0x3e8225['message']));});});}; \ No newline at end of file +var _0xd136=['../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./mailQueue.socket','register','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','find','ShowMailQueue','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x30de33,_0x1ad09d){var _0x37d532=function(_0xb09f98){while(--_0xb09f98){_0x30de33['push'](_0x30de33['shift']());}};_0x37d532(++_0x1ad09d);}(_0xd136,0x94));var _0x6d13=function(_0x15e7ff,_0x13c3bc){_0x15e7ff=_0x15e7ff-0x0;var _0x7d2345=_0xd136[_0x15e7ff];return _0x7d2345;};'use strict';var _=require('lodash');var util=require(_0x6d13('0x0'));var moment=require(_0x6d13('0x1'));var BPromise=require('bluebird');var rs=require(_0x6d13('0x2'));var fs=require('fs');var Redis=require(_0x6d13('0x3'));var db=require(_0x6d13('0x4'))['db'];var utils=require(_0x6d13('0x5'));var logger=require(_0x6d13('0x6'))(_0x6d13('0x7'));var config=require(_0x6d13('0x8'));var jayson=require(_0x6d13('0x9'));var client=jayson[_0x6d13('0xa')]['http']({'port':0x232a});config[_0x6d13('0xb')]=_[_0x6d13('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6d13('0xd'))(new Redis(config[_0x6d13('0xb')]));require(_0x6d13('0xe'))[_0x6d13('0xf')](socket);function respondWithRpcPromise(_0x5c8282,_0x4f494b,_0x1a3613){return new BPromise(function(_0x600fa9,_0x1cf1e1){return client['request'](_0x5c8282,_0x1a3613)['then'](function(_0x1c4992){logger[_0x6d13('0x10')](_0x6d13('0x11'),_0x4f494b,'request\x20sent');logger[_0x6d13('0x12')](_0x6d13('0x13'),_0x4f494b,_0x6d13('0x14'),JSON[_0x6d13('0x15')](_0x1c4992));if(_0x1c4992['error']){if(_0x1c4992['error']['code']===0x1f4){logger[_0x6d13('0x16')](_0x6d13('0x11'),_0x4f494b,_0x1c4992[_0x6d13('0x16')][_0x6d13('0x17')]);return _0x1cf1e1(_0x1c4992[_0x6d13('0x16')]['message']);}logger[_0x6d13('0x16')](_0x6d13('0x11'),_0x4f494b,_0x1c4992[_0x6d13('0x16')][_0x6d13('0x17')]);return _0x600fa9(_0x1c4992[_0x6d13('0x16')][_0x6d13('0x17')]);}else{logger[_0x6d13('0x10')](_0x6d13('0x11'),_0x4f494b,_0x6d13('0x14'));_0x600fa9(_0x1c4992['result'][_0x6d13('0x17')]);}})[_0x6d13('0x18')](function(_0x78eef7){logger[_0x6d13('0x16')](_0x6d13('0x11'),_0x4f494b,_0x78eef7);_0x1cf1e1(_0x78eef7);});});}exports[_0x6d13('0x19')]=function(_0x1daeb2){var _0x9f04de=this;return new Promise(function(_0x40ca19,_0x427bb8){return db[_0x6d13('0x1a')][_0x6d13('0x1b')]({'raw':_0x1daeb2[_0x6d13('0x1c')]?_0x1daeb2[_0x6d13('0x1c')][_0x6d13('0x1d')]===undefined?!![]:![]:!![],'where':_0x1daeb2[_0x6d13('0x1c')]?_0x1daeb2['options'][_0x6d13('0x1e')]||null:null,'attributes':_0x1daeb2['options']?_0x1daeb2[_0x6d13('0x1c')][_0x6d13('0x1f')]||null:null,'limit':_0x1daeb2[_0x6d13('0x1c')]?_0x1daeb2['options'][_0x6d13('0x20')]||null:null,'include':_0x1daeb2[_0x6d13('0x1c')]?_0x1daeb2[_0x6d13('0x1c')][_0x6d13('0x21')]?_[_0x6d13('0x22')](_0x1daeb2[_0x6d13('0x1c')][_0x6d13('0x21')],function(_0x821eea){return{'model':db[_0x821eea['model']],'as':_0x821eea['as'],'attributes':_0x821eea[_0x6d13('0x1f')],'include':_0x821eea['include']?_['map'](_0x821eea[_0x6d13('0x21')],function(_0x588c40){return{'model':db[_0x588c40[_0x6d13('0x23')]],'as':_0x588c40['as'],'attributes':_0x588c40[_0x6d13('0x1f')],'include':_0x588c40[_0x6d13('0x21')]?_['map'](_0x588c40[_0x6d13('0x21')],function(_0xd469b6){return{'model':db[_0xd469b6['model']],'as':_0xd469b6['as'],'attributes':_0xd469b6[_0x6d13('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6d13('0x24')](function(_0xb82395){logger[_0x6d13('0x10')](_0x6d13('0x19'),_0x1daeb2);logger[_0x6d13('0x12')](_0x6d13('0x19'),_0x1daeb2,JSON[_0x6d13('0x15')](_0xb82395));_0x40ca19(_0xb82395);})['catch'](function(_0x3857f9){logger[_0x6d13('0x16')]('GetMailQueue',_0x3857f9[_0x6d13('0x17')],_0x1daeb2);_0x427bb8(_0x9f04de[_0x6d13('0x16')](0x1f4,_0x3857f9[_0x6d13('0x17')]));});});};exports['ShowMailQueue']=function(_0xc5f9ef){var _0x42b8ed=this;return new Promise(function(_0x2fd8b1,_0xc8435e){return db[_0x6d13('0x1a')][_0x6d13('0x25')]({'raw':_0xc5f9ef[_0x6d13('0x1c')]?_0xc5f9ef['options'][_0x6d13('0x1d')]===undefined?!![]:![]:!![],'where':_0xc5f9ef['options']?_0xc5f9ef[_0x6d13('0x1c')][_0x6d13('0x1e')]||null:null,'attributes':_0xc5f9ef[_0x6d13('0x1c')]?_0xc5f9ef[_0x6d13('0x1c')][_0x6d13('0x1f')]||null:null,'include':_0xc5f9ef[_0x6d13('0x1c')]?_0xc5f9ef['options']['include']?_[_0x6d13('0x22')](_0xc5f9ef[_0x6d13('0x1c')][_0x6d13('0x21')],function(_0x29aa5a){return{'model':db[_0x29aa5a[_0x6d13('0x23')]],'as':_0x29aa5a['as'],'attributes':_0x29aa5a[_0x6d13('0x1f')],'include':_0x29aa5a['include']?_[_0x6d13('0x22')](_0x29aa5a[_0x6d13('0x21')],function(_0x2f348e){return{'model':db[_0x2f348e[_0x6d13('0x23')]],'as':_0x2f348e['as'],'attributes':_0x2f348e[_0x6d13('0x1f')],'include':_0x2f348e[_0x6d13('0x21')]?_[_0x6d13('0x22')](_0x2f348e[_0x6d13('0x21')],function(_0x3cdff2){return{'model':db[_0x3cdff2[_0x6d13('0x23')]],'as':_0x3cdff2['as'],'attributes':_0x3cdff2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x452e69){logger['info']('ShowMailQueue',_0xc5f9ef);logger[_0x6d13('0x12')](_0x6d13('0x26'),_0xc5f9ef,JSON[_0x6d13('0x15')](_0x452e69));_0x2fd8b1(_0x452e69);})['catch'](function(_0x598a16){logger[_0x6d13('0x16')](_0x6d13('0x26'),_0x598a16['message'],_0xc5f9ef);_0xc8435e(_0x42b8ed[_0x6d13('0x16')](0x1f4,_0x598a16['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 0c3a4f8..30ca0a4 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 _0xcce8=['length','./mailQueue.events','save','remove','update','emit','register'];(function(_0x5ceb6f,_0x28522e){var _0x5aa54f=function(_0x92f843){while(--_0x92f843){_0x5ceb6f['push'](_0x5ceb6f['shift']());}};_0x5aa54f(++_0x28522e);}(_0xcce8,0x1a5));var _0x8cce=function(_0x5208df,_0x2e3e19){_0x5208df=_0x5208df-0x0;var _0x1e0ee7=_0xcce8[_0x5208df];return _0x1e0ee7;};'use strict';var MailQueueEvents=require(_0x8cce('0x0'));var events=[_0x8cce('0x1'),_0x8cce('0x2'),_0x8cce('0x3')];function createListener(_0x67fcf1,_0x445acd){return function(_0x1ce3fb){_0x445acd[_0x8cce('0x4')](_0x67fcf1,_0x1ce3fb);};}function removeListener(_0x323aac,_0x2d8b95){return function(){MailQueueEvents['removeListener'](_0x323aac,_0x2d8b95);};}exports[_0x8cce('0x5')]=function(_0x30554a){for(var _0x2a008a=0x0,_0xca15a9=events[_0x8cce('0x6')];_0x2a008a<_0xca15a9;_0x2a008a++){var _0x1421b3=events[_0x2a008a];var _0x5244e1=createListener('mailQueue:'+_0x1421b3,_0x30554a);MailQueueEvents['on'](_0x1421b3,_0x5244e1);}}; \ No newline at end of file +var _0xff30=['save','remove','update','emit','removeListener','register','length','mailQueue:','./mailQueue.events'];(function(_0x4863cc,_0x4ec662){var _0x382694=function(_0x43c1e1){while(--_0x43c1e1){_0x4863cc['push'](_0x4863cc['shift']());}};_0x382694(++_0x4ec662);}(_0xff30,0x104));var _0x0ff3=function(_0x29b9cd,_0x46434d){_0x29b9cd=_0x29b9cd-0x0;var _0x58dbf5=_0xff30[_0x29b9cd];return _0x58dbf5;};'use strict';var MailQueueEvents=require(_0x0ff3('0x0'));var events=[_0x0ff3('0x1'),_0x0ff3('0x2'),_0x0ff3('0x3')];function createListener(_0x3ae1d2,_0x199320){return function(_0xbd9ab6){_0x199320[_0x0ff3('0x4')](_0x3ae1d2,_0xbd9ab6);};}function removeListener(_0x409be5,_0x3c92c2){return function(){MailQueueEvents[_0x0ff3('0x5')](_0x409be5,_0x3c92c2);};}exports[_0x0ff3('0x6')]=function(_0x32e864){for(var _0x2696ba=0x0,_0x4398b3=events[_0x0ff3('0x7')];_0x2696ba<_0x4398b3;_0x2696ba++){var _0x572085=events[_0x2696ba];var _0x3599e1=createListener(_0x0ff3('0x8')+_0x572085,_0x32e864);MailQueueEvents['on'](_0x572085,_0x3599e1);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 295060f..d60ffe1 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 _0x7f89=['isAuthenticated','index','/describe','describe','show','create','/:id','update','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get'];(function(_0x12742e,_0x43f6fa){var _0x173452=function(_0x500743){while(--_0x500743){_0x12742e['push'](_0x12742e['shift']());}};_0x173452(++_0x43f6fa);}(_0x7f89,0x13a));var _0x97f8=function(_0x491468,_0x42f169){_0x491468=_0x491468-0x0;var _0x5b8c22=_0x7f89[_0x491468];return _0x5b8c22;};'use strict';var multer=require('multer');var util=require(_0x97f8('0x0'));var path=require(_0x97f8('0x1'));var timeout=require(_0x97f8('0x2'));var express=require(_0x97f8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x97f8('0x4'));var interaction=require(_0x97f8('0x5'));var config=require(_0x97f8('0x6'));var controller=require(_0x97f8('0x7'));router[_0x97f8('0x8')]('/',auth[_0x97f8('0x9')](),controller[_0x97f8('0xa')]);router[_0x97f8('0x8')](_0x97f8('0xb'),auth['isAuthenticated'](),controller[_0x97f8('0xc')]);router[_0x97f8('0x8')]('/:id',auth[_0x97f8('0x9')](),controller[_0x97f8('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x97f8('0xe')]);router['put'](_0x97f8('0xf'),auth[_0x97f8('0x9')](),controller[_0x97f8('0x10')]);router['delete'](_0x97f8('0xf'),auth['isAuthenticated'](),controller[_0x97f8('0x11')]);module[_0x97f8('0x12')]=router; \ No newline at end of file +var _0x3e42=['connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','describe','post','create','put','/:id','delete','exports','multer','util','path'];(function(_0x27b3b,_0x2f09d0){var _0x4e1850=function(_0x18e507){while(--_0x18e507){_0x27b3b['push'](_0x27b3b['shift']());}};_0x4e1850(++_0x2f09d0);}(_0x3e42,0x195));var _0x23e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e42[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x23e4('0x0'));var util=require(_0x23e4('0x1'));var path=require(_0x23e4('0x2'));var timeout=require(_0x23e4('0x3'));var express=require(_0x23e4('0x4'));var router=express[_0x23e4('0x5')]();var fs_extra=require(_0x23e4('0x6'));var auth=require(_0x23e4('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router[_0x23e4('0x8')]('/',auth[_0x23e4('0x9')](),controller['index']);router[_0x23e4('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x23e4('0xa')]);router['get']('/:id',auth[_0x23e4('0x9')](),controller['show']);router[_0x23e4('0xb')]('/',auth[_0x23e4('0x9')](),controller[_0x23e4('0xc')]);router[_0x23e4('0xd')](_0x23e4('0xe'),auth[_0x23e4('0x9')](),controller['update']);router[_0x23e4('0xf')](_0x23e4('0xe'),auth[_0x23e4('0x9')](),controller['destroy']);module[_0x23e4('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index cc465c0..b1db8b5 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 _0x00a8=['exports','STRING','DATE','moment'];(function(_0x2f48cd,_0x46a75a){var _0x193ae2=function(_0x253c01){while(--_0x253c01){_0x2f48cd['push'](_0x2f48cd['shift']());}};_0x193ae2(++_0x46a75a);}(_0x00a8,0xb3));var _0x800a=function(_0xfc97c2,_0x1232ea){_0xfc97c2=_0xfc97c2-0x0;var _0x10811e=_0x00a8[_0xfc97c2];return _0x10811e;};'use strict';var moment=require(_0x800a('0x0'));var Sequelize=require('sequelize');module[_0x800a('0x1')]={'uniqueid':{'type':Sequelize[_0x800a('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x800a('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x800a('0x3')]},'acceptAt':{'type':Sequelize[_0x800a('0x3')]},'exitAt':{'type':Sequelize[_0x800a('0x3')]},'reason':{'type':Sequelize[_0x800a('0x2')]}}; \ No newline at end of file +var _0xe5ba=['DATE','moment','exports'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xe5ba,0x106));var _0xae5b=function(_0x3b90ca,_0x28d075){_0x3b90ca=_0x3b90ca-0x0;var _0x15052b=_0xe5ba[_0x3b90ca];return _0x15052b;};'use strict';var moment=require(_0xae5b('0x0'));var Sequelize=require('sequelize');module[_0xae5b('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xae5b('0x2')]},'leaveAt':{'type':Sequelize[_0xae5b('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xae5b('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index b10decd..2292209 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 _0x4bd3=['reject','save','destroy','then','error','name','send','index','map','MailQueueReport','fieldName','type','key','query','keys','intersection','model','attributes','length','nolimit','order','sort','filters','where','VIRTUAL','filter','options','includeAll','show','params','include','catch','create','update','body','find','describe','eml-format','zip-dir','fast-json-patch','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x235cda,_0x18afdc){var _0x5d2cb8=function(_0x9f077d){while(--_0x9f077d){_0x235cda['push'](_0x235cda['shift']());}};_0x5d2cb8(++_0x18afdc);}(_0x4bd3,0x174));var _0x34bd=function(_0x593763,_0x342291){_0x593763=_0x593763-0x0;var _0x2b42e9=_0x4bd3[_0x593763];return _0x2b42e9;};'use strict';var emlformat=require(_0x34bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x34bd('0x1'));var jsonpatch=require(_0x34bd('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x34bd('0x3'));var util=require(_0x34bd('0x4'));var path=require(_0x34bd('0x5'));var sox=require('sox');var csv=require(_0x34bd('0x6'));var ejs=require(_0x34bd('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x34bd('0x8'));var squel=require(_0x34bd('0x9'));var crypto=require('crypto');var jsforce=require(_0x34bd('0xa'));var deskjs=require(_0x34bd('0xb'));var toCsv=require(_0x34bd('0x6'));var querystring=require(_0x34bd('0xc'));var Papa=require(_0x34bd('0xd'));var Redis=require(_0x34bd('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x34bd('0xf'));var as=require(_0x34bd('0x10'));var hardwareService=require(_0x34bd('0x11'));var logger=require(_0x34bd('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x34bd('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x275d80,_0x1f19b9){_0x1f19b9=_0x1f19b9||0xcc;return function(_0x282af4){if(_0x282af4){return _0x275d80[_0x34bd('0x14')](_0x1f19b9);}return _0x275d80[_0x34bd('0x15')](_0x1f19b9)[_0x34bd('0x16')]();};}function respondWithResult(_0x4134ee,_0x236f6b){_0x236f6b=_0x236f6b||0xc8;return function(_0xf6d2f2){if(_0xf6d2f2){return _0x4134ee['status'](_0x236f6b)[_0x34bd('0x17')](_0xf6d2f2);}};}function respondWithFilteredResult(_0x4d4955,_0x4e3886){return function(_0x6638ed){if(_0x6638ed){var _0x30b3f2=typeof _0x4e3886[_0x34bd('0x18')]===_0x34bd('0x19')&&typeof _0x4e3886[_0x34bd('0x1a')]===_0x34bd('0x19');var _0xd39d72=_0x6638ed[_0x34bd('0x1b')];var _0x3b4bf8=_0x30b3f2?0x0:_0x4e3886[_0x34bd('0x18')];var _0x4b5ebb=_0x30b3f2?_0x6638ed['count']:_0x4e3886[_0x34bd('0x18')]+_0x4e3886[_0x34bd('0x1a')];var _0x265e70;if(_0x4b5ebb>=_0xd39d72){_0x4b5ebb=_0xd39d72;_0x265e70=0xc8;}else{_0x265e70=0xce;}_0x4d4955[_0x34bd('0x15')](_0x265e70);return _0x4d4955[_0x34bd('0x1c')](_0x34bd('0x1d'),_0x3b4bf8+'-'+_0x4b5ebb+'/'+_0xd39d72)[_0x34bd('0x17')](_0x6638ed);}return null;};}function patchUpdates(_0x3d5f76){return function(_0x130bd0){try{jsonpatch['apply'](_0x130bd0,_0x3d5f76,!![]);}catch(_0x15c0d1){return BPromise[_0x34bd('0x1e')](_0x15c0d1);}return _0x130bd0[_0x34bd('0x1f')]();};}function saveUpdates(_0x14254b,_0x463224){return function(_0x5e0c06){if(_0x5e0c06){return _0x5e0c06['update'](_0x14254b)['then'](function(_0x4edf84){return _0x4edf84;});}return null;};}function removeEntity(_0x3dafe8,_0x503a60){return function(_0x10fc4b){if(_0x10fc4b){return _0x10fc4b[_0x34bd('0x20')]()[_0x34bd('0x21')](function(){_0x3dafe8['status'](0xcc)[_0x34bd('0x16')]();});}};}function handleEntityNotFound(_0x14479a,_0x4f0dff){return function(_0x457006){if(!_0x457006){_0x14479a['sendStatus'](0x194);}return _0x457006;};}function handleError(_0x29bda8,_0xb256e8){_0xb256e8=_0xb256e8||0x1f4;return function(_0x264c94){logger[_0x34bd('0x22')](_0x264c94['stack']);if(_0x264c94[_0x34bd('0x23')]){delete _0x264c94[_0x34bd('0x23')];}_0x29bda8['status'](_0xb256e8)[_0x34bd('0x24')](_0x264c94);};}exports[_0x34bd('0x25')]=function(_0x16581f,_0x3f675c){var _0x26b8e7={},_0x4500c8={},_0x177d43={'count':0x0,'rows':[]};var _0x58b431=_[_0x34bd('0x26')](db[_0x34bd('0x27')]['rawAttributes'],function(_0x5d1662){return{'name':_0x5d1662[_0x34bd('0x28')],'type':_0x5d1662[_0x34bd('0x29')][_0x34bd('0x2a')]};});_0x4500c8['model']=_['map'](_0x58b431,_0x34bd('0x23'));_0x4500c8[_0x34bd('0x2b')]=_[_0x34bd('0x2c')](_0x16581f[_0x34bd('0x2b')]);_0x4500c8['filters']=_[_0x34bd('0x2d')](_0x4500c8[_0x34bd('0x2e')],_0x4500c8[_0x34bd('0x2b')]);_0x26b8e7[_0x34bd('0x2f')]=_[_0x34bd('0x2d')](_0x4500c8[_0x34bd('0x2e')],qs['fields'](_0x16581f[_0x34bd('0x2b')]['fields']));_0x26b8e7[_0x34bd('0x2f')]=_0x26b8e7[_0x34bd('0x2f')][_0x34bd('0x30')]?_0x26b8e7['attributes']:_0x4500c8[_0x34bd('0x2e')];if(!_0x16581f[_0x34bd('0x2b')]['hasOwnProperty'](_0x34bd('0x31'))){_0x26b8e7[_0x34bd('0x1a')]=qs[_0x34bd('0x1a')](_0x16581f['query'][_0x34bd('0x1a')]);_0x26b8e7[_0x34bd('0x18')]=qs['offset'](_0x16581f[_0x34bd('0x2b')][_0x34bd('0x18')]);}_0x26b8e7[_0x34bd('0x32')]=qs[_0x34bd('0x33')](_0x16581f[_0x34bd('0x2b')][_0x34bd('0x33')]);_0x26b8e7['where']=qs['filters'](_['pick'](_0x16581f[_0x34bd('0x2b')],_0x4500c8[_0x34bd('0x34')]),_0x58b431);if(_0x16581f['query']['filter']){_0x26b8e7[_0x34bd('0x35')]=_['merge'](_0x26b8e7['where'],{'$or':_[_0x34bd('0x26')](_0x58b431,function(_0xb5a456){if(_0xb5a456[_0x34bd('0x29')]!==_0x34bd('0x36')){var _0x2af1af={};_0x2af1af[_0xb5a456['name']]={'$like':'%'+_0x16581f['query'][_0x34bd('0x37')]+'%'};return _0x2af1af;}})});}_0x26b8e7=_['merge']({},_0x26b8e7,_0x16581f[_0x34bd('0x38')]);var _0x2c9b7a={'where':_0x26b8e7[_0x34bd('0x35')]};return db[_0x34bd('0x27')][_0x34bd('0x1b')](_0x2c9b7a)['then'](function(_0x282297){_0x177d43[_0x34bd('0x1b')]=_0x282297;if(_0x16581f[_0x34bd('0x2b')][_0x34bd('0x39')]){_0x26b8e7['include']=[{'all':!![]}];}return db[_0x34bd('0x27')]['findAll'](_0x26b8e7);})[_0x34bd('0x21')](function(_0x560282){_0x177d43['rows']=_0x560282;return _0x177d43;})[_0x34bd('0x21')](respondWithFilteredResult(_0x3f675c,_0x26b8e7))['catch'](handleError(_0x3f675c,null));};exports[_0x34bd('0x3a')]=function(_0x3d3b96,_0x18e9f6){var _0x42a424={'raw':!![],'where':{'id':_0x3d3b96[_0x34bd('0x3b')]['id']}},_0x26d73e={};_0x26d73e[_0x34bd('0x2e')]=_['keys'](db['MailQueueReport']['rawAttributes']);_0x26d73e[_0x34bd('0x2b')]=_[_0x34bd('0x2c')](_0x3d3b96[_0x34bd('0x2b')]);_0x26d73e[_0x34bd('0x34')]=_['intersection'](_0x26d73e[_0x34bd('0x2e')],_0x26d73e[_0x34bd('0x2b')]);_0x42a424[_0x34bd('0x2f')]=_[_0x34bd('0x2d')](_0x26d73e[_0x34bd('0x2e')],qs['fields'](_0x3d3b96[_0x34bd('0x2b')]['fields']));_0x42a424['attributes']=_0x42a424[_0x34bd('0x2f')]['length']?_0x42a424[_0x34bd('0x2f')]:_0x26d73e[_0x34bd('0x2e')];if(_0x3d3b96[_0x34bd('0x2b')][_0x34bd('0x39')]){_0x42a424[_0x34bd('0x3c')]=[{'all':!![]}];}_0x42a424=_['merge']({},_0x42a424,_0x3d3b96['options']);return db[_0x34bd('0x27')]['find'](_0x42a424)[_0x34bd('0x21')](handleEntityNotFound(_0x18e9f6,null))[_0x34bd('0x21')](respondWithResult(_0x18e9f6,null))[_0x34bd('0x3d')](handleError(_0x18e9f6,null));};exports['create']=function(_0x4ad00c,_0x4f96dd){return db['MailQueueReport'][_0x34bd('0x3e')](_0x4ad00c['body'],{})[_0x34bd('0x21')](respondWithResult(_0x4f96dd,0xc9))['catch'](handleError(_0x4f96dd,null));};exports[_0x34bd('0x3f')]=function(_0x1d01d7,_0x1fa341){if(_0x1d01d7[_0x34bd('0x40')]['id']){delete _0x1d01d7[_0x34bd('0x40')]['id'];}return db['MailQueueReport'][_0x34bd('0x41')]({'where':{'id':_0x1d01d7[_0x34bd('0x3b')]['id']}})[_0x34bd('0x21')](handleEntityNotFound(_0x1fa341,null))[_0x34bd('0x21')](saveUpdates(_0x1d01d7[_0x34bd('0x40')],null))['then'](respondWithResult(_0x1fa341,null))[_0x34bd('0x3d')](handleError(_0x1fa341,null));};exports[_0x34bd('0x20')]=function(_0x5bcce5,_0x1fc735){return db[_0x34bd('0x27')]['find']({'where':{'id':_0x5bcce5['params']['id']}})[_0x34bd('0x21')](handleEntityNotFound(_0x1fc735,null))['then'](removeEntity(_0x1fc735,null))['catch'](handleError(_0x1fc735,null));};exports[_0x34bd('0x42')]=function(_0x5df6a5,_0x556ce8){return db['MailQueueReport']['describe']()['then'](respondWithResult(_0x556ce8,null))[_0x34bd('0x3d')](handleError(_0x556ce8,null));}; \ No newline at end of file +var _0x6050=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','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','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','name','send','index','map','MailQueueReport','rawAttributes','type','key','model','query','keys'];(function(_0x1d32d7,_0x15e7d7){var _0x3f460e=function(_0x534709){while(--_0x534709){_0x1d32d7['push'](_0x1d32d7['shift']());}};_0x3f460e(++_0x15e7d7);}(_0x6050,0x196));var _0x0605=function(_0x532620,_0x474aea){_0x532620=_0x532620-0x0;var _0xadeaec=_0x6050[_0x532620];return _0xadeaec;};'use strict';var emlformat=require(_0x0605('0x0'));var rimraf=require(_0x0605('0x1'));var zipdir=require(_0x0605('0x2'));var jsonpatch=require(_0x0605('0x3'));var rp=require(_0x0605('0x4'));var moment=require(_0x0605('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0605('0x6'));var util=require(_0x0605('0x7'));var path=require(_0x0605('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0605('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0605('0xa'));var deskjs=require(_0x0605('0xb'));var toCsv=require(_0x0605('0xc'));var querystring=require(_0x0605('0xd'));var Papa=require(_0x0605('0xe'));var Redis=require('ioredis');var authService=require(_0x0605('0xf'));var qs=require(_0x0605('0x10'));var as=require(_0x0605('0x11'));var hardwareService=require(_0x0605('0x12'));var logger=require(_0x0605('0x13'))(_0x0605('0x14'));var utils=require(_0x0605('0x15'));var config=require(_0x0605('0x16'));var licenseUtil=require(_0x0605('0x17'));var db=require(_0x0605('0x18'))['db'];function respondWithStatusCode(_0xd22e35,_0x39e288){_0x39e288=_0x39e288||0xcc;return function(_0x34c9e6){if(_0x34c9e6){return _0xd22e35[_0x0605('0x19')](_0x39e288);}return _0xd22e35[_0x0605('0x1a')](_0x39e288)[_0x0605('0x1b')]();};}function respondWithResult(_0x169a70,_0x65a20b){_0x65a20b=_0x65a20b||0xc8;return function(_0x1b944f){if(_0x1b944f){return _0x169a70['status'](_0x65a20b)[_0x0605('0x1c')](_0x1b944f);}};}function respondWithFilteredResult(_0x1a802b,_0x4993ab){return function(_0x5ce56a){if(_0x5ce56a){var _0x4eefe9=typeof _0x4993ab[_0x0605('0x1d')]===_0x0605('0x1e')&&typeof _0x4993ab[_0x0605('0x1f')]===_0x0605('0x1e');var _0xefc557=_0x5ce56a[_0x0605('0x20')];var _0x2b7b5a=_0x4eefe9?0x0:_0x4993ab[_0x0605('0x1d')];var _0x193520=_0x4eefe9?_0x5ce56a[_0x0605('0x20')]:_0x4993ab[_0x0605('0x1d')]+_0x4993ab[_0x0605('0x1f')];var _0x2e2204;if(_0x193520>=_0xefc557){_0x193520=_0xefc557;_0x2e2204=0xc8;}else{_0x2e2204=0xce;}_0x1a802b[_0x0605('0x1a')](_0x2e2204);return _0x1a802b['set'](_0x0605('0x21'),_0x2b7b5a+'-'+_0x193520+'/'+_0xefc557)[_0x0605('0x1c')](_0x5ce56a);}return null;};}function patchUpdates(_0x430f28){return function(_0x443326){try{jsonpatch[_0x0605('0x22')](_0x443326,_0x430f28,!![]);}catch(_0x90b2e1){return BPromise[_0x0605('0x23')](_0x90b2e1);}return _0x443326[_0x0605('0x24')]();};}function saveUpdates(_0x226ef5,_0x5b0d44){return function(_0xc334b8){if(_0xc334b8){return _0xc334b8['update'](_0x226ef5)[_0x0605('0x25')](function(_0x118e9c){return _0x118e9c;});}return null;};}function removeEntity(_0x110098,_0xf182c4){return function(_0x10c575){if(_0x10c575){return _0x10c575[_0x0605('0x26')]()[_0x0605('0x25')](function(){_0x110098[_0x0605('0x1a')](0xcc)[_0x0605('0x1b')]();});}};}function handleEntityNotFound(_0x2896d7,_0x9f2833){return function(_0x1c3722){if(!_0x1c3722){_0x2896d7['sendStatus'](0x194);}return _0x1c3722;};}function handleError(_0x6bc204,_0x3c8e36){_0x3c8e36=_0x3c8e36||0x1f4;return function(_0x4b1e0c){logger['error'](_0x4b1e0c['stack']);if(_0x4b1e0c[_0x0605('0x27')]){delete _0x4b1e0c[_0x0605('0x27')];}_0x6bc204[_0x0605('0x1a')](_0x3c8e36)[_0x0605('0x28')](_0x4b1e0c);};}exports[_0x0605('0x29')]=function(_0x4554df,_0x4e32ef){var _0x34f25d={},_0x5daef6={},_0xa836f2={'count':0x0,'rows':[]};var _0x3640b9=_[_0x0605('0x2a')](db[_0x0605('0x2b')][_0x0605('0x2c')],function(_0x352dd6){return{'name':_0x352dd6['fieldName'],'type':_0x352dd6[_0x0605('0x2d')][_0x0605('0x2e')]};});_0x5daef6[_0x0605('0x2f')]=_[_0x0605('0x2a')](_0x3640b9,_0x0605('0x27'));_0x5daef6[_0x0605('0x30')]=_[_0x0605('0x31')](_0x4554df[_0x0605('0x30')]);_0x5daef6[_0x0605('0x32')]=_[_0x0605('0x33')](_0x5daef6[_0x0605('0x2f')],_0x5daef6[_0x0605('0x30')]);_0x34f25d[_0x0605('0x34')]=_[_0x0605('0x33')](_0x5daef6[_0x0605('0x2f')],qs[_0x0605('0x35')](_0x4554df[_0x0605('0x30')][_0x0605('0x35')]));_0x34f25d[_0x0605('0x34')]=_0x34f25d[_0x0605('0x34')][_0x0605('0x36')]?_0x34f25d[_0x0605('0x34')]:_0x5daef6[_0x0605('0x2f')];if(!_0x4554df[_0x0605('0x30')][_0x0605('0x37')](_0x0605('0x38'))){_0x34f25d[_0x0605('0x1f')]=qs['limit'](_0x4554df[_0x0605('0x30')][_0x0605('0x1f')]);_0x34f25d['offset']=qs[_0x0605('0x1d')](_0x4554df[_0x0605('0x30')]['offset']);}_0x34f25d[_0x0605('0x39')]=qs[_0x0605('0x3a')](_0x4554df[_0x0605('0x30')][_0x0605('0x3a')]);_0x34f25d[_0x0605('0x3b')]=qs[_0x0605('0x32')](_['pick'](_0x4554df['query'],_0x5daef6[_0x0605('0x32')]),_0x3640b9);if(_0x4554df[_0x0605('0x30')][_0x0605('0x3c')]){_0x34f25d['where']=_[_0x0605('0x3d')](_0x34f25d['where'],{'$or':_[_0x0605('0x2a')](_0x3640b9,function(_0x1e98f6){if(_0x1e98f6[_0x0605('0x2d')]!==_0x0605('0x3e')){var _0x42f7ce={};_0x42f7ce[_0x1e98f6[_0x0605('0x27')]]={'$like':'%'+_0x4554df[_0x0605('0x30')][_0x0605('0x3c')]+'%'};return _0x42f7ce;}})});}_0x34f25d=_[_0x0605('0x3d')]({},_0x34f25d,_0x4554df[_0x0605('0x3f')]);var _0x57aa15={'where':_0x34f25d[_0x0605('0x3b')]};return db['MailQueueReport'][_0x0605('0x20')](_0x57aa15)[_0x0605('0x25')](function(_0x45787e){_0xa836f2['count']=_0x45787e;if(_0x4554df['query'][_0x0605('0x40')]){_0x34f25d['include']=[{'all':!![]}];}return db[_0x0605('0x2b')][_0x0605('0x41')](_0x34f25d);})[_0x0605('0x25')](function(_0x3de34a){_0xa836f2[_0x0605('0x42')]=_0x3de34a;return _0xa836f2;})[_0x0605('0x25')](respondWithFilteredResult(_0x4e32ef,_0x34f25d))[_0x0605('0x43')](handleError(_0x4e32ef,null));};exports[_0x0605('0x44')]=function(_0x3fa553,_0x10bb36){var _0x18d3ce={'raw':!![],'where':{'id':_0x3fa553[_0x0605('0x45')]['id']}},_0x3616a3={};_0x3616a3['model']=_['keys'](db[_0x0605('0x2b')]['rawAttributes']);_0x3616a3[_0x0605('0x30')]=_[_0x0605('0x31')](_0x3fa553['query']);_0x3616a3[_0x0605('0x32')]=_[_0x0605('0x33')](_0x3616a3['model'],_0x3616a3[_0x0605('0x30')]);_0x18d3ce[_0x0605('0x34')]=_['intersection'](_0x3616a3[_0x0605('0x2f')],qs[_0x0605('0x35')](_0x3fa553['query'][_0x0605('0x35')]));_0x18d3ce['attributes']=_0x18d3ce['attributes'][_0x0605('0x36')]?_0x18d3ce[_0x0605('0x34')]:_0x3616a3[_0x0605('0x2f')];if(_0x3fa553[_0x0605('0x30')][_0x0605('0x40')]){_0x18d3ce[_0x0605('0x46')]=[{'all':!![]}];}_0x18d3ce=_[_0x0605('0x3d')]({},_0x18d3ce,_0x3fa553[_0x0605('0x3f')]);return db['MailQueueReport'][_0x0605('0x47')](_0x18d3ce)[_0x0605('0x25')](handleEntityNotFound(_0x10bb36,null))[_0x0605('0x25')](respondWithResult(_0x10bb36,null))['catch'](handleError(_0x10bb36,null));};exports[_0x0605('0x48')]=function(_0x1fb70b,_0x45cc1a){return db[_0x0605('0x2b')][_0x0605('0x48')](_0x1fb70b[_0x0605('0x49')],{})[_0x0605('0x25')](respondWithResult(_0x45cc1a,0xc9))[_0x0605('0x43')](handleError(_0x45cc1a,null));};exports[_0x0605('0x4a')]=function(_0x4bc55e,_0x3c597c){if(_0x4bc55e[_0x0605('0x49')]['id']){delete _0x4bc55e[_0x0605('0x49')]['id'];}return db[_0x0605('0x2b')][_0x0605('0x47')]({'where':{'id':_0x4bc55e[_0x0605('0x45')]['id']}})[_0x0605('0x25')](handleEntityNotFound(_0x3c597c,null))[_0x0605('0x25')](saveUpdates(_0x4bc55e[_0x0605('0x49')],null))[_0x0605('0x25')](respondWithResult(_0x3c597c,null))['catch'](handleError(_0x3c597c,null));};exports['destroy']=function(_0x4876c7,_0x2687a8){return db[_0x0605('0x2b')][_0x0605('0x47')]({'where':{'id':_0x4876c7[_0x0605('0x45')]['id']}})[_0x0605('0x25')](handleEntityNotFound(_0x2687a8,null))[_0x0605('0x25')](removeEntity(_0x2687a8,null))['catch'](handleError(_0x2687a8,null));};exports[_0x0605('0x4b')]=function(_0x286485,_0x184232){return db[_0x0605('0x2b')]['describe']()[_0x0605('0x25')](respondWithResult(_0x184232,null))[_0x0605('0x43')](handleError(_0x184232,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index ef91312..362fdce 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 _0x4364=['MailQueueReport','uniqueid','lodash','moment','bluebird','path','../../config/environment','./mailQueueReport.attributes','exports','define'];(function(_0x5cf93c,_0x2b5075){var _0x56aa24=function(_0x20b2ee){while(--_0x20b2ee){_0x5cf93c['push'](_0x5cf93c['shift']());}};_0x56aa24(++_0x2b5075);}(_0x4364,0x1b0));var _0x4436=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x4364[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0x4436('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4436('0x1'));var BPromise=require(_0x4436('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4436('0x3'));var rimraf=require('rimraf');var config=require(_0x4436('0x4'));var attributes=require(_0x4436('0x5'));module[_0x4436('0x6')]=function(_0x2cd47e,_0x23713d){return _0x2cd47e[_0x4436('0x7')](_0x4436('0x8'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x4436('0x9'),'fields':[_0x4436('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x76a8=['../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x1b3f22,_0x50adb9){var _0x5e459c=function(_0x2715ca){while(--_0x2715ca){_0x1b3f22['push'](_0x1b3f22['shift']());}};_0x5e459c(++_0x50adb9);}(_0x76a8,0x1e7));var _0x876a=function(_0x515c2e,_0x5963b8){_0x515c2e=_0x515c2e-0x0;var _0x38f065=_0x76a8[_0x515c2e];return _0x38f065;};'use strict';var _=require(_0x876a('0x0'));var util=require(_0x876a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x876a('0x2'));var BPromise=require(_0x876a('0x3'));var rp=require(_0x876a('0x4'));var fs=require('fs');var path=require(_0x876a('0x5'));var rimraf=require(_0x876a('0x6'));var config=require(_0x876a('0x7'));var attributes=require(_0x876a('0x8'));module[_0x876a('0x9')]=function(_0x51fad1,_0xf39a10){return _0x51fad1[_0x876a('0xa')](_0x876a('0xb'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x876a('0xc'),'fields':[_0x876a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 25f6bd3..0370e87 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 _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0x51d908,_0x5ec571){var _0x452914=function(_0x25da37){while(--_0x25da37){_0x51d908['push'](_0x51d908['shift']());}};_0x452914(++_0x5ec571);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1b8b95,_0x3ea343){_0x1b8b95=_0x1b8b95-0x0;var _0x3657ae=_0x5f2f[_0x1b8b95];return _0x3657ae;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateMailQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateMailQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['message']));});});}; \ 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(_0xee7b66,_0xfddff){var _0x1d6f52=function(_0x588a02){while(--_0x588a02){_0xee7b66['push'](_0xee7b66['shift']());}};_0x1d6f52(++_0xfddff);}(_0xadb5,0xad));var _0x5adb=function(_0x90dade,_0x4d38cc){_0x90dade=_0x90dade-0x0;var _0x1a082c=_0xadb5[_0x90dade];return _0x1a082c;};'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 e5b797a..dc573ac 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4a0ebf,_0x55ba40){var _0x181f1e=function(_0x3e421f){while(--_0x3e421f){_0x4a0ebf['push'](_0x4a0ebf['shift']());}};_0x181f1e(++_0x55ba40);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('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(_0x191366,_0x40a440){var _0x17056c=function(_0x5ae8df){while(--_0x5ae8df){_0x191366['push'](_0x191366['shift']());}};_0x17056c(++_0x40a440);}(_0xe706,0xa3));var _0x6e70=function(_0x3c3b51,_0xe90b55){_0x3c3b51=_0x3c3b51-0x0;var _0x303246=_0xe706[_0x3c3b51];return _0x303246;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 2be8e59..a27d3d6 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 _0x448d=['BOOLEAN','INBOX','INTEGER','sequelize','exports','STRING'];(function(_0x587dc0,_0x2a409f){var _0x4abb3e=function(_0x3fdcec){while(--_0x3fdcec){_0x587dc0['push'](_0x587dc0['shift']());}};_0x4abb3e(++_0x2a409f);}(_0x448d,0xf9));var _0xd448=function(_0x7da20d,_0x47bb37){_0x7da20d=_0x7da20d-0x0;var _0x36eb6b=_0x448d[_0x7da20d];return _0x36eb6b;};'use strict';var Sequelize=require(_0xd448('0x0'));module[_0xd448('0x1')]={'description':{'type':Sequelize[_0xd448('0x2')]},'host':{'type':Sequelize[_0xd448('0x2')]},'authentication':{'type':Sequelize[_0xd448('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xd448('0x2')]},'password':{'type':Sequelize[_0xd448('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0xd448('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xd448('0x4')},'connTimeout':{'type':Sequelize[_0xd448('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xd448('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xbc4c=['INTEGER','INBOX','sequelize','exports','STRING','BOOLEAN'];(function(_0x5dd1ea,_0x499246){var _0x3f6d42=function(_0x23c68b){while(--_0x23c68b){_0x5dd1ea['push'](_0x5dd1ea['shift']());}};_0x3f6d42(++_0x499246);}(_0xbc4c,0x1b2));var _0xcbc4=function(_0x483d8b,_0x526c52){_0x483d8b=_0x483d8b-0x0;var _0x6500f1=_0xbc4c[_0x483d8b];return _0x6500f1;};'use strict';var Sequelize=require(_0xcbc4('0x0'));module[_0xcbc4('0x1')]={'description':{'type':Sequelize[_0xcbc4('0x2')]},'host':{'type':Sequelize[_0xcbc4('0x2')]},'authentication':{'type':Sequelize[_0xcbc4('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xcbc4('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xcbc4('0x4')]},'tls':{'type':Sequelize[_0xcbc4('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xcbc4('0x2')],'defaultValue':_0xcbc4('0x5')},'connTimeout':{'type':Sequelize[_0xcbc4('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xcbc4('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xcbc4('0x2')]},'modernAuthentication':{'type':Sequelize[_0xcbc4('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 850fff7..acc60cf 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 _0xef1b=['bluebird','request-promise','path','rimraf','exports','define','MailServerIn','mail_servers_in','lodash','../../config/logger','api','moment'];(function(_0x5eced5,_0x3443d0){var _0x17af0c=function(_0x5ae2bc){while(--_0x5ae2bc){_0x5eced5['push'](_0x5eced5['shift']());}};_0x17af0c(++_0x3443d0);}(_0xef1b,0x80));var _0xbef1=function(_0x59445c,_0x225a42){_0x59445c=_0x59445c-0x0;var _0x40bb98=_0xef1b[_0x59445c];return _0x40bb98;};'use strict';var _=require(_0xbef1('0x0'));var util=require('util');var logger=require(_0xbef1('0x1'))(_0xbef1('0x2'));var moment=require(_0xbef1('0x3'));var BPromise=require(_0xbef1('0x4'));var rp=require(_0xbef1('0x5'));var fs=require('fs');var path=require(_0xbef1('0x6'));var rimraf=require(_0xbef1('0x7'));var config=require('../../config/environment');var attributes=require('./mailServerIn.attributes');module[_0xbef1('0x8')]=function(_0x548e25,_0x7f7467){return _0x548e25[_0xbef1('0x9')](_0xbef1('0xa'),attributes,{'tableName':_0xbef1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8272=['bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment'];(function(_0x3ddd79,_0xc755b9){var _0x328de8=function(_0x55407f){while(--_0x55407f){_0x3ddd79['push'](_0x3ddd79['shift']());}};_0x328de8(++_0xc755b9);}(_0x8272,0xcb));var _0x2827=function(_0x331d3d,_0x32d9b1){_0x331d3d=_0x331d3d-0x0;var _0x300dc5=_0x8272[_0x331d3d];return _0x300dc5;};'use strict';var _=require(_0x2827('0x0'));var util=require(_0x2827('0x1'));var logger=require(_0x2827('0x2'))(_0x2827('0x3'));var moment=require(_0x2827('0x4'));var BPromise=require(_0x2827('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2827('0x6'));var rimraf=require(_0x2827('0x7'));var config=require(_0x2827('0x8'));var attributes=require(_0x2827('0x9'));module['exports']=function(_0x3b22c1,_0x27f795){return _0x3b22c1[_0x2827('0xa')](_0x2827('0xb'),attributes,{'tableName':_0x2827('0xc'),'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 5645085..1e2320f 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 _0x979e=['message','result','GetMailServerIn','MailServerIn','options','raw','where','attributes','limit','map','include','model','then','stringify','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x979e,0x17a));var _0xe979=function(_0x254111,_0x291f54){_0x254111=_0x254111-0x0;var _0x36c9ed=_0x979e[_0x254111];return _0x36c9ed;};'use strict';var _=require(_0xe979('0x0'));var util=require(_0xe979('0x1'));var moment=require('moment');var BPromise=require(_0xe979('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe979('0x3'))['db'];var utils=require(_0xe979('0x4'));var logger=require(_0xe979('0x5'))(_0xe979('0x6'));var config=require(_0xe979('0x7'));var jayson=require(_0xe979('0x8'));var client=jayson[_0xe979('0x9')][_0xe979('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2024ce,_0x10b854,_0x56fccd){return new BPromise(function(_0x64dd06,_0x24d817){return client['request'](_0x2024ce,_0x56fccd)['then'](function(_0x123352){logger[_0xe979('0xb')](_0xe979('0xc'),_0x10b854,'request\x20sent');logger[_0xe979('0xd')](_0xe979('0xe'),_0x10b854,_0xe979('0xf'),JSON['stringify'](_0x123352));if(_0x123352[_0xe979('0x10')]){if(_0x123352[_0xe979('0x10')][_0xe979('0x11')]===0x1f4){logger['error'](_0xe979('0xc'),_0x10b854,_0x123352[_0xe979('0x10')][_0xe979('0x12')]);return _0x24d817(_0x123352['error'][_0xe979('0x12')]);}logger['error'](_0xe979('0xc'),_0x10b854,_0x123352[_0xe979('0x10')]['message']);return _0x64dd06(_0x123352[_0xe979('0x10')][_0xe979('0x12')]);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x10b854,_0xe979('0xf'));_0x64dd06(_0x123352[_0xe979('0x13')][_0xe979('0x12')]);}})['catch'](function(_0x53d9f4){logger[_0xe979('0x10')](_0xe979('0xc'),_0x10b854,_0x53d9f4);_0x24d817(_0x53d9f4);});});}exports[_0xe979('0x14')]=function(_0x3e3c76){var _0x3ebb66=this;return new Promise(function(_0x499f4b,_0x322ad4){return db[_0xe979('0x15')]['findAll']({'raw':_0x3e3c76[_0xe979('0x16')]?_0x3e3c76[_0xe979('0x16')][_0xe979('0x17')]===undefined?!![]:![]:!![],'where':_0x3e3c76[_0xe979('0x16')]?_0x3e3c76[_0xe979('0x16')][_0xe979('0x18')]||null:null,'attributes':_0x3e3c76[_0xe979('0x16')]?_0x3e3c76[_0xe979('0x16')][_0xe979('0x19')]||null:null,'limit':_0x3e3c76[_0xe979('0x16')]?_0x3e3c76[_0xe979('0x16')][_0xe979('0x1a')]||null:null,'include':_0x3e3c76['options']?_0x3e3c76[_0xe979('0x16')]['include']?_[_0xe979('0x1b')](_0x3e3c76['options'][_0xe979('0x1c')],function(_0x1b7825){return{'model':db[_0x1b7825['model']],'as':_0x1b7825['as'],'attributes':_0x1b7825[_0xe979('0x19')],'include':_0x1b7825[_0xe979('0x1c')]?_[_0xe979('0x1b')](_0x1b7825[_0xe979('0x1c')],function(_0x37d5d8){return{'model':db[_0x37d5d8['model']],'as':_0x37d5d8['as'],'attributes':_0x37d5d8[_0xe979('0x19')],'include':_0x37d5d8[_0xe979('0x1c')]?_[_0xe979('0x1b')](_0x37d5d8[_0xe979('0x1c')],function(_0x787aa6){return{'model':db[_0x787aa6[_0xe979('0x1d')]],'as':_0x787aa6['as'],'attributes':_0x787aa6[_0xe979('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe979('0x1e')](function(_0x5631cf){logger[_0xe979('0xb')](_0xe979('0x14'),_0x3e3c76);logger[_0xe979('0xd')]('GetMailServerIn',_0x3e3c76,JSON[_0xe979('0x1f')](_0x5631cf));_0x499f4b(_0x5631cf);})[_0xe979('0x20')](function(_0x4c03a9){logger[_0xe979('0x10')](_0xe979('0x14'),_0x4c03a9[_0xe979('0x12')],_0x3e3c76);_0x322ad4(_0x3ebb66[_0xe979('0x10')](0x1f4,_0x4c03a9[_0xe979('0x12')]));});});}; \ No newline at end of file +var _0x5c88=['model','then','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','MailServerIn,\x20%s,\x20%s','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetMailServerIn','MailServerIn','options','raw','where','attributes','include','map'];(function(_0x37f2f9,_0x662e94){var _0x1b3e97=function(_0x2a1ac3){while(--_0x2a1ac3){_0x37f2f9['push'](_0x37f2f9['shift']());}};_0x1b3e97(++_0x662e94);}(_0x5c88,0x158));var _0x85c8=function(_0xf3e628,_0x193d6e){_0xf3e628=_0xf3e628-0x0;var _0x14d86c=_0x5c88[_0xf3e628];return _0x14d86c;};'use strict';var _=require(_0x85c8('0x0'));var util=require(_0x85c8('0x1'));var moment=require('moment');var BPromise=require(_0x85c8('0x2'));var rs=require(_0x85c8('0x3'));var fs=require('fs');var Redis=require(_0x85c8('0x4'));var db=require(_0x85c8('0x5'))['db'];var utils=require(_0x85c8('0x6'));var logger=require(_0x85c8('0x7'))(_0x85c8('0x8'));var config=require('../../config/environment');var jayson=require(_0x85c8('0x9'));var client=jayson['client'][_0x85c8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ef6cd,_0x18f023,_0x43029f){return new BPromise(function(_0x2a8ce6,_0x35e0b5){return client[_0x85c8('0xb')](_0x3ef6cd,_0x43029f)['then'](function(_0x193acc){logger[_0x85c8('0xc')](_0x85c8('0xd'),_0x18f023,'request\x20sent');logger['debug'](_0x85c8('0xe'),_0x18f023,_0x85c8('0xf'),JSON[_0x85c8('0x10')](_0x193acc));if(_0x193acc[_0x85c8('0x11')]){if(_0x193acc[_0x85c8('0x11')]['code']===0x1f4){logger['error'](_0x85c8('0xd'),_0x18f023,_0x193acc['error'][_0x85c8('0x12')]);return _0x35e0b5(_0x193acc['error'][_0x85c8('0x12')]);}logger[_0x85c8('0x11')]('MailServerIn,\x20%s,\x20%s',_0x18f023,_0x193acc[_0x85c8('0x11')][_0x85c8('0x12')]);return _0x2a8ce6(_0x193acc[_0x85c8('0x11')][_0x85c8('0x12')]);}else{logger[_0x85c8('0xc')](_0x85c8('0xd'),_0x18f023,'request\x20sent');_0x2a8ce6(_0x193acc['result'][_0x85c8('0x12')]);}})[_0x85c8('0x13')](function(_0x25f7ef){logger[_0x85c8('0x11')](_0x85c8('0xd'),_0x18f023,_0x25f7ef);_0x35e0b5(_0x25f7ef);});});}exports[_0x85c8('0x14')]=function(_0x1b310f){var _0x400dc0=this;return new Promise(function(_0x311fd7,_0x55ed86){return db[_0x85c8('0x15')]['findAll']({'raw':_0x1b310f[_0x85c8('0x16')]?_0x1b310f[_0x85c8('0x16')][_0x85c8('0x17')]===undefined?!![]:![]:!![],'where':_0x1b310f[_0x85c8('0x16')]?_0x1b310f[_0x85c8('0x16')][_0x85c8('0x18')]||null:null,'attributes':_0x1b310f[_0x85c8('0x16')]?_0x1b310f[_0x85c8('0x16')][_0x85c8('0x19')]||null:null,'limit':_0x1b310f[_0x85c8('0x16')]?_0x1b310f['options']['limit']||null:null,'include':_0x1b310f[_0x85c8('0x16')]?_0x1b310f['options'][_0x85c8('0x1a')]?_[_0x85c8('0x1b')](_0x1b310f['options'][_0x85c8('0x1a')],function(_0x2d9f5d){return{'model':db[_0x2d9f5d[_0x85c8('0x1c')]],'as':_0x2d9f5d['as'],'attributes':_0x2d9f5d['attributes'],'include':_0x2d9f5d['include']?_[_0x85c8('0x1b')](_0x2d9f5d['include'],function(_0x4a4cef){return{'model':db[_0x4a4cef[_0x85c8('0x1c')]],'as':_0x4a4cef['as'],'attributes':_0x4a4cef[_0x85c8('0x19')],'include':_0x4a4cef[_0x85c8('0x1a')]?_['map'](_0x4a4cef[_0x85c8('0x1a')],function(_0x1bec22){return{'model':db[_0x1bec22[_0x85c8('0x1c')]],'as':_0x1bec22['as'],'attributes':_0x1bec22[_0x85c8('0x19')]};}):[]};}):[]};}):[]:[]})[_0x85c8('0x1d')](function(_0x238da9){logger['info'](_0x85c8('0x14'),_0x1b310f);logger[_0x85c8('0x1e')](_0x85c8('0x14'),_0x1b310f,JSON[_0x85c8('0x10')](_0x238da9));_0x311fd7(_0x238da9);})[_0x85c8('0x13')](function(_0x1b91e3){logger[_0x85c8('0x11')](_0x85c8('0x14'),_0x1b91e3['message'],_0x1b310f);_0x55ed86(_0x400dc0[_0x85c8('0x11')](0x1f4,_0x1b91e3[_0x85c8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index e996340..9e2c586 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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +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(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x7a54,0x106));var _0x47a5=function(_0x427e7b,_0x5678d7){_0x427e7b=_0x427e7b-0x0;var _0x3ff770=_0x7a54[_0x427e7b];return _0x3ff770;};'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 3b710ee..759d661 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 _0xc788=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x4e8d24,_0x80f7ad){var _0x52f58b=function(_0x51a5fa){while(--_0x51a5fa){_0x4e8d24['push'](_0x4e8d24['shift']());}};_0x52f58b(++_0x80f7ad);}(_0xc788,0xc4));var _0x8c78=function(_0x1b70e3,_0x3a15b1){_0x1b70e3=_0x1b70e3-0x0;var _0x1452ab=_0xc788[_0x1b70e3];return _0x1452ab;};'use strict';var Sequelize=require(_0x8c78('0x0'));module[_0x8c78('0x1')]={'description':{'type':Sequelize[_0x8c78('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x8c78('0x2')]},'port':{'type':Sequelize[_0x8c78('0x3')]},'secure':{'type':Sequelize[_0x8c78('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x8c78('0x2')]},'authentication':{'type':Sequelize[_0x8c78('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xb7e7=['BOOLEAN','sequelize','STRING','INTEGER'];(function(_0x36eaac,_0x39d076){var _0x475282=function(_0x3f1e2c){while(--_0x3f1e2c){_0x36eaac['push'](_0x36eaac['shift']());}};_0x475282(++_0x39d076);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xb7e7[_0x5c9307];return _0x373e29;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'description':{'type':Sequelize[_0x7b7e('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x7b7e('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x7b7e('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x7b7e('0x1')]},'authentication':{'type':Sequelize[_0x7b7e('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x7b7e('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index fddcccc..82f9ebc 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 _0x212f=['show','params','keys','merge','create','body','find','destroy','rimraf','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save','update','then','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','options','includeAll','include','findAll','catch'];(function(_0x2c5388,_0x27a87f){var _0x2e040a=function(_0xbd9998){while(--_0xbd9998){_0x2c5388['push'](_0x2c5388['shift']());}};_0x2e040a(++_0x27a87f);}(_0x212f,0x1b2));var _0xf212=function(_0x59ba2b,_0x95b584){_0x59ba2b=_0x59ba2b-0x0;var _0x2e5f42=_0x212f[_0x59ba2b];return _0x2e5f42;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf212('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf212('0x1'));var moment=require(_0xf212('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf212('0x3'));var path=require(_0xf212('0x4'));var sox=require('sox');var csv=require(_0xf212('0x5'));var ejs=require(_0xf212('0x6'));var fs=require('fs');var fs_extra=require(_0xf212('0x7'));var _=require('lodash');var squel=require(_0xf212('0x8'));var crypto=require(_0xf212('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xf212('0xa'));var toCsv=require(_0xf212('0x5'));var querystring=require(_0xf212('0xb'));var Papa=require('papaparse');var Redis=require(_0xf212('0xc'));var authService=require(_0xf212('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xf212('0xe'));var hardwareService=require(_0xf212('0xf'));var logger=require(_0xf212('0x10'))(_0xf212('0x11'));var utils=require('../../config/utils');var config=require(_0xf212('0x12'));var licenseUtil=require(_0xf212('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c6c4b,_0x3af5ca){_0x3af5ca=_0x3af5ca||0xcc;return function(_0x6ef2b9){if(_0x6ef2b9){return _0x3c6c4b[_0xf212('0x14')](_0x3af5ca);}return _0x3c6c4b['status'](_0x3af5ca)[_0xf212('0x15')]();};}function respondWithResult(_0x3df562,_0x5b0341){_0x5b0341=_0x5b0341||0xc8;return function(_0x3cd776){if(_0x3cd776){return _0x3df562[_0xf212('0x16')](_0x5b0341)[_0xf212('0x17')](_0x3cd776);}};}function respondWithFilteredResult(_0x21cb71,_0x711210){return function(_0x515e63){if(_0x515e63){var _0x33cd4a=typeof _0x711210[_0xf212('0x18')]===_0xf212('0x19')&&typeof _0x711210[_0xf212('0x1a')]===_0xf212('0x19');var _0x2cfff1=_0x515e63[_0xf212('0x1b')];var _0x3fad78=_0x33cd4a?0x0:_0x711210[_0xf212('0x18')];var _0x48e28f=_0x33cd4a?_0x515e63[_0xf212('0x1b')]:_0x711210[_0xf212('0x18')]+_0x711210[_0xf212('0x1a')];var _0x1afc73;if(_0x48e28f>=_0x2cfff1){_0x48e28f=_0x2cfff1;_0x1afc73=0xc8;}else{_0x1afc73=0xce;}_0x21cb71[_0xf212('0x16')](_0x1afc73);return _0x21cb71['set']('Content-Range',_0x3fad78+'-'+_0x48e28f+'/'+_0x2cfff1)['json'](_0x515e63);}return null;};}function patchUpdates(_0x49c812){return function(_0x210e1b){try{jsonpatch[_0xf212('0x1c')](_0x210e1b,_0x49c812,!![]);}catch(_0x26be7c){return BPromise[_0xf212('0x1d')](_0x26be7c);}return _0x210e1b[_0xf212('0x1e')]();};}function saveUpdates(_0x56d883,_0xbe0c89){return function(_0x3b3d3d){if(_0x3b3d3d){return _0x3b3d3d[_0xf212('0x1f')](_0x56d883)['then'](function(_0x37e3db){return _0x37e3db;});}return null;};}function removeEntity(_0x1f65d0,_0xa7892e){return function(_0x164223){if(_0x164223){return _0x164223['destroy']()[_0xf212('0x20')](function(){_0x1f65d0[_0xf212('0x16')](0xcc)[_0xf212('0x15')]();});}};}function handleEntityNotFound(_0x7d25cd,_0x239965){return function(_0x2c4db5){if(!_0x2c4db5){_0x7d25cd['sendStatus'](0x194);}return _0x2c4db5;};}function handleError(_0x114285,_0x1e6e5a){_0x1e6e5a=_0x1e6e5a||0x1f4;return function(_0x48fb2b){logger[_0xf212('0x21')](_0x48fb2b[_0xf212('0x22')]);if(_0x48fb2b[_0xf212('0x23')]){delete _0x48fb2b[_0xf212('0x23')];}_0x114285[_0xf212('0x16')](_0x1e6e5a)[_0xf212('0x24')](_0x48fb2b);};}exports[_0xf212('0x25')]=function(_0x3c67c4,_0x5d4a59){var _0x5d1526={},_0x595dd7={},_0x35ea8b={'count':0x0,'rows':[]};var _0x215093=_[_0xf212('0x26')](db[_0xf212('0x27')][_0xf212('0x28')],function(_0x1d1b8b){return{'name':_0x1d1b8b[_0xf212('0x29')],'type':_0x1d1b8b[_0xf212('0x2a')][_0xf212('0x2b')]};});_0x595dd7[_0xf212('0x2c')]=_[_0xf212('0x26')](_0x215093,_0xf212('0x23'));_0x595dd7['query']=_['keys'](_0x3c67c4[_0xf212('0x2d')]);_0x595dd7[_0xf212('0x2e')]=_[_0xf212('0x2f')](_0x595dd7['model'],_0x595dd7[_0xf212('0x2d')]);_0x5d1526[_0xf212('0x30')]=_[_0xf212('0x2f')](_0x595dd7[_0xf212('0x2c')],qs[_0xf212('0x31')](_0x3c67c4['query'][_0xf212('0x31')]));_0x5d1526[_0xf212('0x30')]=_0x5d1526['attributes'][_0xf212('0x32')]?_0x5d1526[_0xf212('0x30')]:_0x595dd7[_0xf212('0x2c')];if(!_0x3c67c4['query'][_0xf212('0x33')](_0xf212('0x34'))){_0x5d1526[_0xf212('0x1a')]=qs['limit'](_0x3c67c4[_0xf212('0x2d')][_0xf212('0x1a')]);_0x5d1526[_0xf212('0x18')]=qs['offset'](_0x3c67c4[_0xf212('0x2d')][_0xf212('0x18')]);}_0x5d1526[_0xf212('0x35')]=qs[_0xf212('0x36')](_0x3c67c4[_0xf212('0x2d')][_0xf212('0x36')]);_0x5d1526['where']=qs['filters'](_[_0xf212('0x37')](_0x3c67c4[_0xf212('0x2d')],_0x595dd7[_0xf212('0x2e')]),_0x215093);if(_0x3c67c4['query'][_0xf212('0x38')]){_0x5d1526[_0xf212('0x39')]=_['merge'](_0x5d1526[_0xf212('0x39')],{'$or':_[_0xf212('0x26')](_0x215093,function(_0x48945c){if(_0x48945c[_0xf212('0x2a')]!=='VIRTUAL'){var _0x1fc92f={};_0x1fc92f[_0x48945c[_0xf212('0x23')]]={'$like':'%'+_0x3c67c4[_0xf212('0x2d')][_0xf212('0x38')]+'%'};return _0x1fc92f;}})});}_0x5d1526=_['merge']({},_0x5d1526,_0x3c67c4[_0xf212('0x3a')]);var _0x343ccb={'where':_0x5d1526[_0xf212('0x39')]};return db[_0xf212('0x27')][_0xf212('0x1b')](_0x343ccb)[_0xf212('0x20')](function(_0xa66f0a){_0x35ea8b[_0xf212('0x1b')]=_0xa66f0a;if(_0x3c67c4[_0xf212('0x2d')][_0xf212('0x3b')]){_0x5d1526[_0xf212('0x3c')]=[{'all':!![]}];}return db['MailServerOut'][_0xf212('0x3d')](_0x5d1526);})[_0xf212('0x20')](function(_0x3d1631){_0x35ea8b['rows']=_0x3d1631;return _0x35ea8b;})['then'](respondWithFilteredResult(_0x5d4a59,_0x5d1526))[_0xf212('0x3e')](handleError(_0x5d4a59,null));};exports[_0xf212('0x3f')]=function(_0x2846a1,_0x28adae){var _0x32dcc3={'raw':!![],'where':{'id':_0x2846a1[_0xf212('0x40')]['id']}},_0x153f71={};_0x153f71[_0xf212('0x2c')]=_[_0xf212('0x41')](db[_0xf212('0x27')][_0xf212('0x28')]);_0x153f71[_0xf212('0x2d')]=_[_0xf212('0x41')](_0x2846a1[_0xf212('0x2d')]);_0x153f71[_0xf212('0x2e')]=_[_0xf212('0x2f')](_0x153f71[_0xf212('0x2c')],_0x153f71['query']);_0x32dcc3[_0xf212('0x30')]=_['intersection'](_0x153f71[_0xf212('0x2c')],qs[_0xf212('0x31')](_0x2846a1[_0xf212('0x2d')][_0xf212('0x31')]));_0x32dcc3[_0xf212('0x30')]=_0x32dcc3[_0xf212('0x30')][_0xf212('0x32')]?_0x32dcc3[_0xf212('0x30')]:_0x153f71[_0xf212('0x2c')];if(_0x2846a1[_0xf212('0x2d')]['includeAll']){_0x32dcc3[_0xf212('0x3c')]=[{'all':!![]}];}_0x32dcc3=_[_0xf212('0x42')]({},_0x32dcc3,_0x2846a1['options']);return db['MailServerOut']['find'](_0x32dcc3)['then'](handleEntityNotFound(_0x28adae,null))[_0xf212('0x20')](respondWithResult(_0x28adae,null))[_0xf212('0x3e')](handleError(_0x28adae,null));};exports[_0xf212('0x43')]=function(_0x4e2dbb,_0x31ef82){return db[_0xf212('0x27')][_0xf212('0x43')](_0x4e2dbb[_0xf212('0x44')],{})['then'](respondWithResult(_0x31ef82,0xc9))[_0xf212('0x3e')](handleError(_0x31ef82,null));};exports[_0xf212('0x1f')]=function(_0x174f4c,_0x3d217c){if(_0x174f4c[_0xf212('0x44')]['id']){delete _0x174f4c['body']['id'];}return db[_0xf212('0x27')][_0xf212('0x45')]({'where':{'id':_0x174f4c[_0xf212('0x40')]['id']}})[_0xf212('0x20')](handleEntityNotFound(_0x3d217c,null))[_0xf212('0x20')](saveUpdates(_0x174f4c[_0xf212('0x44')],null))[_0xf212('0x20')](respondWithResult(_0x3d217c,null))['catch'](handleError(_0x3d217c,null));};exports[_0xf212('0x46')]=function(_0x154f55,_0x1b0cdd){return db[_0xf212('0x27')]['find']({'where':{'id':_0x154f55[_0xf212('0x40')]['id']}})['then'](handleEntityNotFound(_0x1b0cdd,null))[_0xf212('0x20')](removeEntity(_0x1b0cdd,null))[_0xf212('0x3e')](handleError(_0x1b0cdd,null));}; \ No newline at end of file +var _0xd6b1=['includeAll','find','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','index','map','MailServerOut','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','include','rows','catch','show','params'];(function(_0x10f23a,_0xa95e22){var _0x239593=function(_0x177b66){while(--_0x177b66){_0x10f23a['push'](_0x10f23a['shift']());}};_0x239593(++_0xa95e22);}(_0xd6b1,0xdf));var _0x1d6b=function(_0x1f69ae,_0x47884e){_0x1f69ae=_0x1f69ae-0x0;var _0x1074dc=_0xd6b1[_0x1f69ae];return _0x1074dc;};'use strict';var emlformat=require(_0x1d6b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1d6b('0x1'));var jsonpatch=require(_0x1d6b('0x2'));var rp=require(_0x1d6b('0x3'));var moment=require(_0x1d6b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1d6b('0x5'));var util=require(_0x1d6b('0x6'));var path=require(_0x1d6b('0x7'));var sox=require(_0x1d6b('0x8'));var csv=require(_0x1d6b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1d6b('0xa'));var _=require(_0x1d6b('0xb'));var squel=require(_0x1d6b('0xc'));var crypto=require(_0x1d6b('0xd'));var jsforce=require(_0x1d6b('0xe'));var deskjs=require(_0x1d6b('0xf'));var toCsv=require(_0x1d6b('0x9'));var querystring=require('querystring');var Papa=require(_0x1d6b('0x10'));var Redis=require(_0x1d6b('0x11'));var authService=require(_0x1d6b('0x12'));var qs=require(_0x1d6b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d6b('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1d6b('0x15'));var config=require(_0x1d6b('0x16'));var licenseUtil=require(_0x1d6b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x488d4b,_0x5c57db){_0x5c57db=_0x5c57db||0xcc;return function(_0x38333a){if(_0x38333a){return _0x488d4b[_0x1d6b('0x18')](_0x5c57db);}return _0x488d4b[_0x1d6b('0x19')](_0x5c57db)[_0x1d6b('0x1a')]();};}function respondWithResult(_0x39bf21,_0x53e455){_0x53e455=_0x53e455||0xc8;return function(_0x17cdcc){if(_0x17cdcc){return _0x39bf21[_0x1d6b('0x19')](_0x53e455)[_0x1d6b('0x1b')](_0x17cdcc);}};}function respondWithFilteredResult(_0x55c313,_0x99dd0c){return function(_0x4b34f7){if(_0x4b34f7){var _0x53d2d0=typeof _0x99dd0c[_0x1d6b('0x1c')]===_0x1d6b('0x1d')&&typeof _0x99dd0c[_0x1d6b('0x1e')]===_0x1d6b('0x1d');var _0x1634e3=_0x4b34f7[_0x1d6b('0x1f')];var _0x189e76=_0x53d2d0?0x0:_0x99dd0c[_0x1d6b('0x1c')];var _0xef01a4=_0x53d2d0?_0x4b34f7['count']:_0x99dd0c[_0x1d6b('0x1c')]+_0x99dd0c[_0x1d6b('0x1e')];var _0xde31d9;if(_0xef01a4>=_0x1634e3){_0xef01a4=_0x1634e3;_0xde31d9=0xc8;}else{_0xde31d9=0xce;}_0x55c313[_0x1d6b('0x19')](_0xde31d9);return _0x55c313[_0x1d6b('0x20')](_0x1d6b('0x21'),_0x189e76+'-'+_0xef01a4+'/'+_0x1634e3)[_0x1d6b('0x1b')](_0x4b34f7);}return null;};}function patchUpdates(_0x5eed1c){return function(_0x497225){try{jsonpatch[_0x1d6b('0x22')](_0x497225,_0x5eed1c,!![]);}catch(_0x906f9b){return BPromise[_0x1d6b('0x23')](_0x906f9b);}return _0x497225[_0x1d6b('0x24')]();};}function saveUpdates(_0x1c45d5,_0x583219){return function(_0x1a9f9c){if(_0x1a9f9c){return _0x1a9f9c['update'](_0x1c45d5)[_0x1d6b('0x25')](function(_0x4b9d62){return _0x4b9d62;});}return null;};}function removeEntity(_0xe94d8d,_0x59cc6b){return function(_0x809651){if(_0x809651){return _0x809651['destroy']()[_0x1d6b('0x25')](function(){_0xe94d8d[_0x1d6b('0x19')](0xcc)[_0x1d6b('0x1a')]();});}};}function handleEntityNotFound(_0x40093d,_0x23d3dc){return function(_0x27fa72){if(!_0x27fa72){_0x40093d['sendStatus'](0x194);}return _0x27fa72;};}function handleError(_0x2b4c7f,_0x21b7e9){_0x21b7e9=_0x21b7e9||0x1f4;return function(_0x923683){logger['error'](_0x923683[_0x1d6b('0x26')]);if(_0x923683[_0x1d6b('0x27')]){delete _0x923683[_0x1d6b('0x27')];}_0x2b4c7f[_0x1d6b('0x19')](_0x21b7e9)['send'](_0x923683);};}exports[_0x1d6b('0x28')]=function(_0x152619,_0x2d502e){var _0x2bc46f={},_0x5f31bc={},_0xf863d5={'count':0x0,'rows':[]};var _0x4279e8=_[_0x1d6b('0x29')](db[_0x1d6b('0x2a')][_0x1d6b('0x2b')],function(_0x5515d6){return{'name':_0x5515d6[_0x1d6b('0x2c')],'type':_0x5515d6['type'][_0x1d6b('0x2d')]};});_0x5f31bc[_0x1d6b('0x2e')]=_['map'](_0x4279e8,_0x1d6b('0x27'));_0x5f31bc[_0x1d6b('0x2f')]=_[_0x1d6b('0x30')](_0x152619[_0x1d6b('0x2f')]);_0x5f31bc[_0x1d6b('0x31')]=_['intersection'](_0x5f31bc[_0x1d6b('0x2e')],_0x5f31bc[_0x1d6b('0x2f')]);_0x2bc46f[_0x1d6b('0x32')]=_[_0x1d6b('0x33')](_0x5f31bc[_0x1d6b('0x2e')],qs[_0x1d6b('0x34')](_0x152619[_0x1d6b('0x2f')][_0x1d6b('0x34')]));_0x2bc46f[_0x1d6b('0x32')]=_0x2bc46f[_0x1d6b('0x32')][_0x1d6b('0x35')]?_0x2bc46f[_0x1d6b('0x32')]:_0x5f31bc[_0x1d6b('0x2e')];if(!_0x152619['query'][_0x1d6b('0x36')](_0x1d6b('0x37'))){_0x2bc46f['limit']=qs[_0x1d6b('0x1e')](_0x152619[_0x1d6b('0x2f')][_0x1d6b('0x1e')]);_0x2bc46f[_0x1d6b('0x1c')]=qs[_0x1d6b('0x1c')](_0x152619[_0x1d6b('0x2f')][_0x1d6b('0x1c')]);}_0x2bc46f[_0x1d6b('0x38')]=qs[_0x1d6b('0x39')](_0x152619[_0x1d6b('0x2f')][_0x1d6b('0x39')]);_0x2bc46f[_0x1d6b('0x3a')]=qs['filters'](_[_0x1d6b('0x3b')](_0x152619[_0x1d6b('0x2f')],_0x5f31bc[_0x1d6b('0x31')]),_0x4279e8);if(_0x152619['query']['filter']){_0x2bc46f[_0x1d6b('0x3a')]=_[_0x1d6b('0x3c')](_0x2bc46f[_0x1d6b('0x3a')],{'$or':_[_0x1d6b('0x29')](_0x4279e8,function(_0x5ab40c){if(_0x5ab40c[_0x1d6b('0x3d')]!=='VIRTUAL'){var _0x48c10a={};_0x48c10a[_0x5ab40c[_0x1d6b('0x27')]]={'$like':'%'+_0x152619[_0x1d6b('0x2f')][_0x1d6b('0x3e')]+'%'};return _0x48c10a;}})});}_0x2bc46f=_['merge']({},_0x2bc46f,_0x152619[_0x1d6b('0x3f')]);var _0x1f45a8={'where':_0x2bc46f[_0x1d6b('0x3a')]};return db[_0x1d6b('0x2a')][_0x1d6b('0x1f')](_0x1f45a8)[_0x1d6b('0x25')](function(_0x4ee312){_0xf863d5[_0x1d6b('0x1f')]=_0x4ee312;if(_0x152619[_0x1d6b('0x2f')]['includeAll']){_0x2bc46f[_0x1d6b('0x40')]=[{'all':!![]}];}return db[_0x1d6b('0x2a')]['findAll'](_0x2bc46f);})['then'](function(_0x44f429){_0xf863d5[_0x1d6b('0x41')]=_0x44f429;return _0xf863d5;})[_0x1d6b('0x25')](respondWithFilteredResult(_0x2d502e,_0x2bc46f))[_0x1d6b('0x42')](handleError(_0x2d502e,null));};exports[_0x1d6b('0x43')]=function(_0xf6d3d6,_0xd475b8){var _0x289f4d={'raw':!![],'where':{'id':_0xf6d3d6[_0x1d6b('0x44')]['id']}},_0x49724f={};_0x49724f[_0x1d6b('0x2e')]=_['keys'](db[_0x1d6b('0x2a')][_0x1d6b('0x2b')]);_0x49724f['query']=_[_0x1d6b('0x30')](_0xf6d3d6[_0x1d6b('0x2f')]);_0x49724f[_0x1d6b('0x31')]=_[_0x1d6b('0x33')](_0x49724f[_0x1d6b('0x2e')],_0x49724f[_0x1d6b('0x2f')]);_0x289f4d[_0x1d6b('0x32')]=_[_0x1d6b('0x33')](_0x49724f[_0x1d6b('0x2e')],qs['fields'](_0xf6d3d6[_0x1d6b('0x2f')][_0x1d6b('0x34')]));_0x289f4d['attributes']=_0x289f4d[_0x1d6b('0x32')][_0x1d6b('0x35')]?_0x289f4d[_0x1d6b('0x32')]:_0x49724f['model'];if(_0xf6d3d6['query'][_0x1d6b('0x45')]){_0x289f4d['include']=[{'all':!![]}];}_0x289f4d=_[_0x1d6b('0x3c')]({},_0x289f4d,_0xf6d3d6['options']);return db['MailServerOut'][_0x1d6b('0x46')](_0x289f4d)['then'](handleEntityNotFound(_0xd475b8,null))['then'](respondWithResult(_0xd475b8,null))[_0x1d6b('0x42')](handleError(_0xd475b8,null));};exports['create']=function(_0x19bf02,_0x53eb6a){return db[_0x1d6b('0x2a')]['create'](_0x19bf02[_0x1d6b('0x47')],{})['then'](respondWithResult(_0x53eb6a,0xc9))[_0x1d6b('0x42')](handleError(_0x53eb6a,null));};exports['update']=function(_0x11e90,_0x3350b6){if(_0x11e90['body']['id']){delete _0x11e90[_0x1d6b('0x47')]['id'];}return db[_0x1d6b('0x2a')][_0x1d6b('0x46')]({'where':{'id':_0x11e90[_0x1d6b('0x44')]['id']}})[_0x1d6b('0x25')](handleEntityNotFound(_0x3350b6,null))[_0x1d6b('0x25')](saveUpdates(_0x11e90['body'],null))[_0x1d6b('0x25')](respondWithResult(_0x3350b6,null))['catch'](handleError(_0x3350b6,null));};exports[_0x1d6b('0x48')]=function(_0x2d433f,_0x573250){return db[_0x1d6b('0x2a')][_0x1d6b('0x46')]({'where':{'id':_0x2d433f[_0x1d6b('0x44')]['id']}})[_0x1d6b('0x25')](handleEntityNotFound(_0x573250,null))['then'](removeEntity(_0x573250,null))[_0x1d6b('0x42')](handleError(_0x573250,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index a549e8a..fd1097a 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 _0x614b=['moment','bluebird','path','../../config/environment','./mailServerOut.attributes','exports','MailServerOut','mail_servers_out','lodash','util'];(function(_0x382826,_0x163563){var _0x1dc986=function(_0x52e873){while(--_0x52e873){_0x382826['push'](_0x382826['shift']());}};_0x1dc986(++_0x163563);}(_0x614b,0xd0));var _0xb614=function(_0x212e93,_0x2ac33d){_0x212e93=_0x212e93-0x0;var _0x2d270c=_0x614b[_0x212e93];return _0x2d270c;};'use strict';var _=require(_0xb614('0x0'));var util=require(_0xb614('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb614('0x2'));var BPromise=require(_0xb614('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb614('0x4'));var rimraf=require('rimraf');var config=require(_0xb614('0x5'));var attributes=require(_0xb614('0x6'));module[_0xb614('0x7')]=function(_0x33890f,_0x495dce){return _0x33890f['define'](_0xb614('0x8'),attributes,{'tableName':_0xb614('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc867=['bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','MailServerOut','mail_servers_out','lodash','api'];(function(_0x2d08e1,_0x4f0f49){var _0x4e3398=function(_0x81d28e){while(--_0x81d28e){_0x2d08e1['push'](_0x2d08e1['shift']());}};_0x4e3398(++_0x4f0f49);}(_0xc867,0x127));var _0x7c86=function(_0x59df91,_0x12bb7e){_0x59df91=_0x59df91-0x0;var _0xdd4c=_0xc867[_0x59df91];return _0xdd4c;};'use strict';var _=require(_0x7c86('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7c86('0x1'));var moment=require('moment');var BPromise=require(_0x7c86('0x2'));var rp=require(_0x7c86('0x3'));var fs=require('fs');var path=require(_0x7c86('0x4'));var rimraf=require(_0x7c86('0x5'));var config=require(_0x7c86('0x6'));var attributes=require(_0x7c86('0x7'));module[_0x7c86('0x8')]=function(_0x54af83,_0x126ead){return _0x54af83['define'](_0x7c86('0x9'),attributes,{'tableName':_0x7c86('0xa'),'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 aeacd9b..5279b08 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 _0x7a54=['info','MailServerOut,\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(_0x30812e,_0x43c1bb){_0x30812e=_0x30812e-0x0;var _0x5e27bd=_0x7a54[_0x30812e];return _0x5e27bd;};'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')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0xff6e43,_0x2d5f5d){var _0x230742=function(_0x27eeab){while(--_0x27eeab){_0xff6e43['push'](_0xff6e43['shift']());}};_0x230742(++_0x2d5f5d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xc4aa[_0x1b2ff7];return _0x31656a;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 2a9c022..44d9a2f 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 _0xa430=['/describe','isAuthenticated','describe','/:id','show','create','update','delete','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','get','index'];(function(_0x1aa54a,_0x26265d){var _0x550f30=function(_0x3df959){while(--_0x3df959){_0x1aa54a['push'](_0x1aa54a['shift']());}};_0x550f30(++_0x26265d);}(_0xa430,0x12a));var _0x0a43=function(_0x165788,_0x3f0645){_0x165788=_0x165788-0x0;var _0x267137=_0xa430[_0x165788];return _0x267137;};'use strict';var multer=require(_0x0a43('0x0'));var util=require(_0x0a43('0x1'));var path=require(_0x0a43('0x2'));var timeout=require(_0x0a43('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0a43('0x4'));var config=require(_0x0a43('0x5'));var controller=require('./mailSubstatus.controller');router[_0x0a43('0x6')]('/',auth['isAuthenticated'](),controller[_0x0a43('0x7')]);router[_0x0a43('0x6')](_0x0a43('0x8'),auth[_0x0a43('0x9')](),controller[_0x0a43('0xa')]);router[_0x0a43('0x6')](_0x0a43('0xb'),auth[_0x0a43('0x9')](),controller[_0x0a43('0xc')]);router['post']('/',auth[_0x0a43('0x9')](),controller[_0x0a43('0xd')]);router['put']('/:id',auth[_0x0a43('0x9')](),controller[_0x0a43('0xe')]);router[_0x0a43('0xf')](_0x0a43('0xb'),auth[_0x0a43('0x9')](),controller['destroy']);module[_0x0a43('0x10')]=router; \ No newline at end of file +var _0x92e5=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','/describe','isAuthenticated','show','post','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0xb1de54,_0x2a118a){var _0x299cde=function(_0x48ce0c){while(--_0x48ce0c){_0xb1de54['push'](_0xb1de54['shift']());}};_0x299cde(++_0x2a118a);}(_0x92e5,0x1b3));var _0x592e=function(_0x2fdd8f,_0x28a3a2){_0x2fdd8f=_0x2fdd8f-0x0;var _0x188db6=_0x92e5[_0x2fdd8f];return _0x188db6;};'use strict';var multer=require(_0x592e('0x0'));var util=require('util');var path=require(_0x592e('0x1'));var timeout=require(_0x592e('0x2'));var express=require(_0x592e('0x3'));var router=express[_0x592e('0x4')]();var fs_extra=require(_0x592e('0x5'));var auth=require(_0x592e('0x6'));var interaction=require(_0x592e('0x7'));var config=require(_0x592e('0x8'));var controller=require(_0x592e('0x9'));router[_0x592e('0xa')]('/',auth['isAuthenticated'](),controller[_0x592e('0xb')]);router['get'](_0x592e('0xc'),auth[_0x592e('0xd')](),controller['describe']);router[_0x592e('0xa')]('/:id',auth[_0x592e('0xd')](),controller[_0x592e('0xe')]);router[_0x592e('0xf')]('/',auth[_0x592e('0xd')](),controller['create']);router[_0x592e('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x592e('0x11')]);router[_0x592e('0x12')](_0x592e('0x13'),auth[_0x592e('0xd')](),controller[_0x592e('0x14')]);module[_0x592e('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 66dacb2..a3f97d9 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 _0x0295=['sequelize','name'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x0295,0x1f0));var _0x5029=function(_0x562cd7,_0x5ae8e7){_0x562cd7=_0x562cd7-0x0;var _0x30f50d=_0x0295[_0x562cd7];return _0x30f50d;};'use strict';var Sequelize=require(_0x5029('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x5029('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6c7b=['STRING','sequelize'];(function(_0x36ea83,_0x391794){var _0xae2d52=function(_0x2188cf){while(--_0x2188cf){_0x36ea83['push'](_0x36ea83['shift']());}};_0xae2d52(++_0x391794);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x546013,_0x225096){_0x546013=_0x546013-0x0;var _0x16b3aa=_0x6c7b[_0x546013];return _0x16b3aa;};'use strict';var Sequelize=require(_0xb6c7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb6c7('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 5554ab7..69a81cb 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 _0xfaaf=['VIRTUAL','options','MailSubstatus','include','findAll','rows','catch','show','params','rawAttributes','keys','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','error','name','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xfaaf,0x128));var _0xffaa=function(_0x500611,_0x179481){_0x500611=_0x500611-0x0;var _0x379d32=_0xfaaf[_0x500611];return _0x379d32;};'use strict';var emlformat=require(_0xffaa('0x0'));var rimraf=require(_0xffaa('0x1'));var zipdir=require(_0xffaa('0x2'));var jsonpatch=require(_0xffaa('0x3'));var rp=require(_0xffaa('0x4'));var moment=require(_0xffaa('0x5'));var BPromise=require(_0xffaa('0x6'));var Mustache=require(_0xffaa('0x7'));var util=require('util');var path=require(_0xffaa('0x8'));var sox=require(_0xffaa('0x9'));var csv=require(_0xffaa('0xa'));var ejs=require(_0xffaa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xffaa('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xffaa('0xa'));var querystring=require(_0xffaa('0xd'));var Papa=require(_0xffaa('0xe'));var Redis=require('ioredis');var authService=require(_0xffaa('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xffaa('0x10'));var logger=require('../../config/logger')(_0xffaa('0x11'));var utils=require(_0xffaa('0x12'));var config=require(_0xffaa('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xffaa('0x14'))['db'];function respondWithStatusCode(_0x2b4e51,_0x1ab564){_0x1ab564=_0x1ab564||0xcc;return function(_0x23d73c){if(_0x23d73c){return _0x2b4e51['sendStatus'](_0x1ab564);}return _0x2b4e51[_0xffaa('0x15')](_0x1ab564)[_0xffaa('0x16')]();};}function respondWithResult(_0x5476aa,_0x4bae62){_0x4bae62=_0x4bae62||0xc8;return function(_0x2cb444){if(_0x2cb444){return _0x5476aa[_0xffaa('0x15')](_0x4bae62)[_0xffaa('0x17')](_0x2cb444);}};}function respondWithFilteredResult(_0x59a892,_0x3540c3){return function(_0x4e10e6){if(_0x4e10e6){var _0x3c0266=typeof _0x3540c3['offset']===_0xffaa('0x18')&&typeof _0x3540c3[_0xffaa('0x19')]===_0xffaa('0x18');var _0x45d819=_0x4e10e6['count'];var _0x3be695=_0x3c0266?0x0:_0x3540c3[_0xffaa('0x1a')];var _0x3328ba=_0x3c0266?_0x4e10e6[_0xffaa('0x1b')]:_0x3540c3['offset']+_0x3540c3[_0xffaa('0x19')];var _0x2b8e50;if(_0x3328ba>=_0x45d819){_0x3328ba=_0x45d819;_0x2b8e50=0xc8;}else{_0x2b8e50=0xce;}_0x59a892[_0xffaa('0x15')](_0x2b8e50);return _0x59a892[_0xffaa('0x1c')](_0xffaa('0x1d'),_0x3be695+'-'+_0x3328ba+'/'+_0x45d819)[_0xffaa('0x17')](_0x4e10e6);}return null;};}function patchUpdates(_0x521c1e){return function(_0x36e9a1){try{jsonpatch[_0xffaa('0x1e')](_0x36e9a1,_0x521c1e,!![]);}catch(_0x163763){return BPromise['reject'](_0x163763);}return _0x36e9a1[_0xffaa('0x1f')]();};}function saveUpdates(_0x190adf,_0x4dbe76){return function(_0x42051c){if(_0x42051c){return _0x42051c[_0xffaa('0x20')](_0x190adf)[_0xffaa('0x21')](function(_0x20a5f8){return _0x20a5f8;});}return null;};}function removeEntity(_0x4f0ce1,_0x3d09e8){return function(_0x447023){if(_0x447023){return _0x447023[_0xffaa('0x22')]()['then'](function(){_0x4f0ce1[_0xffaa('0x15')](0xcc)[_0xffaa('0x16')]();});}};}function handleEntityNotFound(_0xc07791,_0x289de7){return function(_0x16b3e8){if(!_0x16b3e8){_0xc07791['sendStatus'](0x194);}return _0x16b3e8;};}function handleError(_0x5ee4a6,_0x1cdd39){_0x1cdd39=_0x1cdd39||0x1f4;return function(_0x17aa7f){logger[_0xffaa('0x23')](_0x17aa7f['stack']);if(_0x17aa7f[_0xffaa('0x24')]){delete _0x17aa7f[_0xffaa('0x24')];}_0x5ee4a6['status'](_0x1cdd39)['send'](_0x17aa7f);};}exports['index']=function(_0x268aa6,_0x1b6637){var _0x8ae849={},_0x415f44={},_0x5f54bf={'count':0x0,'rows':[]};var _0x486765=_[_0xffaa('0x25')](db['MailSubstatus']['rawAttributes'],function(_0x345469){return{'name':_0x345469[_0xffaa('0x26')],'type':_0x345469[_0xffaa('0x27')][_0xffaa('0x28')]};});_0x415f44[_0xffaa('0x29')]=_['map'](_0x486765,_0xffaa('0x24'));_0x415f44[_0xffaa('0x2a')]=_['keys'](_0x268aa6['query']);_0x415f44[_0xffaa('0x2b')]=_[_0xffaa('0x2c')](_0x415f44[_0xffaa('0x29')],_0x415f44['query']);_0x8ae849[_0xffaa('0x2d')]=_[_0xffaa('0x2c')](_0x415f44[_0xffaa('0x29')],qs[_0xffaa('0x2e')](_0x268aa6['query'][_0xffaa('0x2e')]));_0x8ae849[_0xffaa('0x2d')]=_0x8ae849[_0xffaa('0x2d')]['length']?_0x8ae849['attributes']:_0x415f44[_0xffaa('0x29')];if(!_0x268aa6[_0xffaa('0x2a')]['hasOwnProperty'](_0xffaa('0x2f'))){_0x8ae849[_0xffaa('0x19')]=qs['limit'](_0x268aa6[_0xffaa('0x2a')][_0xffaa('0x19')]);_0x8ae849['offset']=qs[_0xffaa('0x1a')](_0x268aa6[_0xffaa('0x2a')][_0xffaa('0x1a')]);}_0x8ae849[_0xffaa('0x30')]=qs[_0xffaa('0x31')](_0x268aa6[_0xffaa('0x2a')][_0xffaa('0x31')]);_0x8ae849[_0xffaa('0x32')]=qs[_0xffaa('0x2b')](_[_0xffaa('0x33')](_0x268aa6['query'],_0x415f44[_0xffaa('0x2b')]),_0x486765);if(_0x268aa6[_0xffaa('0x2a')][_0xffaa('0x34')]){_0x8ae849[_0xffaa('0x32')]=_[_0xffaa('0x35')](_0x8ae849['where'],{'$or':_[_0xffaa('0x25')](_0x486765,function(_0x1bbcfb){if(_0x1bbcfb[_0xffaa('0x27')]!==_0xffaa('0x36')){var _0x120508={};_0x120508[_0x1bbcfb[_0xffaa('0x24')]]={'$like':'%'+_0x268aa6[_0xffaa('0x2a')][_0xffaa('0x34')]+'%'};return _0x120508;}})});}_0x8ae849=_[_0xffaa('0x35')]({},_0x8ae849,_0x268aa6[_0xffaa('0x37')]);var _0x2956ac={'where':_0x8ae849['where']};return db[_0xffaa('0x38')][_0xffaa('0x1b')](_0x2956ac)[_0xffaa('0x21')](function(_0x36e4a4){_0x5f54bf[_0xffaa('0x1b')]=_0x36e4a4;if(_0x268aa6[_0xffaa('0x2a')]['includeAll']){_0x8ae849[_0xffaa('0x39')]=[{'all':!![]}];}return db[_0xffaa('0x38')][_0xffaa('0x3a')](_0x8ae849);})[_0xffaa('0x21')](function(_0x92ff44){_0x5f54bf[_0xffaa('0x3b')]=_0x92ff44;return _0x5f54bf;})['then'](respondWithFilteredResult(_0x1b6637,_0x8ae849))[_0xffaa('0x3c')](handleError(_0x1b6637,null));};exports[_0xffaa('0x3d')]=function(_0x458cd3,_0x4192b3){var _0x4ccb4e={'raw':!![],'where':{'id':_0x458cd3[_0xffaa('0x3e')]['id']}},_0x3534f1={};_0x3534f1[_0xffaa('0x29')]=_['keys'](db[_0xffaa('0x38')][_0xffaa('0x3f')]);_0x3534f1[_0xffaa('0x2a')]=_[_0xffaa('0x40')](_0x458cd3['query']);_0x3534f1[_0xffaa('0x2b')]=_[_0xffaa('0x2c')](_0x3534f1[_0xffaa('0x29')],_0x3534f1[_0xffaa('0x2a')]);_0x4ccb4e[_0xffaa('0x2d')]=_['intersection'](_0x3534f1[_0xffaa('0x29')],qs[_0xffaa('0x2e')](_0x458cd3[_0xffaa('0x2a')][_0xffaa('0x2e')]));_0x4ccb4e[_0xffaa('0x2d')]=_0x4ccb4e[_0xffaa('0x2d')]['length']?_0x4ccb4e['attributes']:_0x3534f1[_0xffaa('0x29')];if(_0x458cd3['query'][_0xffaa('0x41')]){_0x4ccb4e['include']=[{'all':!![]}];}_0x4ccb4e=_[_0xffaa('0x35')]({},_0x4ccb4e,_0x458cd3[_0xffaa('0x37')]);return db[_0xffaa('0x38')]['find'](_0x4ccb4e)[_0xffaa('0x21')](handleEntityNotFound(_0x4192b3,null))[_0xffaa('0x21')](respondWithResult(_0x4192b3,null))[_0xffaa('0x3c')](handleError(_0x4192b3,null));};exports[_0xffaa('0x42')]=function(_0x587276,_0x48fc6e){return db['MailSubstatus'][_0xffaa('0x42')](_0x587276[_0xffaa('0x43')],{})[_0xffaa('0x21')](respondWithResult(_0x48fc6e,0xc9))[_0xffaa('0x3c')](handleError(_0x48fc6e,null));};exports[_0xffaa('0x20')]=function(_0xa2c4ae,_0x4a6b4a){if(_0xa2c4ae[_0xffaa('0x43')]['id']){delete _0xa2c4ae[_0xffaa('0x43')]['id'];}return db[_0xffaa('0x38')][_0xffaa('0x44')]({'where':{'id':_0xa2c4ae[_0xffaa('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4a6b4a,null))[_0xffaa('0x21')](saveUpdates(_0xa2c4ae['body'],null))[_0xffaa('0x21')](respondWithResult(_0x4a6b4a,null))[_0xffaa('0x3c')](handleError(_0x4a6b4a,null));};exports[_0xffaa('0x22')]=function(_0x33fbad,_0x4d0769){return db[_0xffaa('0x38')]['find']({'where':{'id':_0x33fbad[_0xffaa('0x3e')]['id']}})[_0xffaa('0x21')](handleEntityNotFound(_0x4d0769,null))[_0xffaa('0x21')](removeEntity(_0x4d0769,null))[_0xffaa('0x3c')](handleError(_0x4d0769,null));};exports[_0xffaa('0x45')]=function(_0x3e2f52,_0x482ca8){return db[_0xffaa('0x38')][_0xffaa('0x45')]()[_0xffaa('0x21')](respondWithResult(_0x482ca8,null))['catch'](handleError(_0x482ca8,null));}; \ No newline at end of file +var _0x4364=['params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','stack','name','send','map','MailSubstatus','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','show'];(function(_0x10f62e,_0x303234){var _0x3e032a=function(_0x2d1502){while(--_0x2d1502){_0x10f62e['push'](_0x10f62e['shift']());}};_0x3e032a(++_0x303234);}(_0x4364,0x12f));var _0x4436=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x4364[_0x311c35];return _0x5cc50c;};'use strict';var emlformat=require(_0x4436('0x0'));var rimraf=require(_0x4436('0x1'));var zipdir=require(_0x4436('0x2'));var jsonpatch=require(_0x4436('0x3'));var rp=require(_0x4436('0x4'));var moment=require(_0x4436('0x5'));var BPromise=require(_0x4436('0x6'));var Mustache=require('mustache');var util=require(_0x4436('0x7'));var path=require(_0x4436('0x8'));var sox=require('sox');var csv=require(_0x4436('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4436('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4436('0xb'));var jsforce=require(_0x4436('0xc'));var deskjs=require(_0x4436('0xd'));var toCsv=require(_0x4436('0x9'));var querystring=require(_0x4436('0xe'));var Papa=require('papaparse');var Redis=require(_0x4436('0xf'));var authService=require(_0x4436('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4436('0x11'));var hardwareService=require(_0x4436('0x12'));var logger=require(_0x4436('0x13'))(_0x4436('0x14'));var utils=require(_0x4436('0x15'));var config=require(_0x4436('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4436('0x17'))['db'];function respondWithStatusCode(_0x4ae071,_0x5a0f20){_0x5a0f20=_0x5a0f20||0xcc;return function(_0x2378e9){if(_0x2378e9){return _0x4ae071[_0x4436('0x18')](_0x5a0f20);}return _0x4ae071[_0x4436('0x19')](_0x5a0f20)[_0x4436('0x1a')]();};}function respondWithResult(_0x1ee873,_0x488e60){_0x488e60=_0x488e60||0xc8;return function(_0x4d2ae7){if(_0x4d2ae7){return _0x1ee873['status'](_0x488e60)[_0x4436('0x1b')](_0x4d2ae7);}};}function respondWithFilteredResult(_0x5958ca,_0x29501c){return function(_0x9c7f60){if(_0x9c7f60){var _0xd6ec5f=typeof _0x29501c[_0x4436('0x1c')]===_0x4436('0x1d')&&typeof _0x29501c[_0x4436('0x1e')]==='undefined';var _0x3c404c=_0x9c7f60[_0x4436('0x1f')];var _0x57bd5c=_0xd6ec5f?0x0:_0x29501c['offset'];var _0x509d1f=_0xd6ec5f?_0x9c7f60[_0x4436('0x1f')]:_0x29501c[_0x4436('0x1c')]+_0x29501c[_0x4436('0x1e')];var _0x4d3ea7;if(_0x509d1f>=_0x3c404c){_0x509d1f=_0x3c404c;_0x4d3ea7=0xc8;}else{_0x4d3ea7=0xce;}_0x5958ca['status'](_0x4d3ea7);return _0x5958ca[_0x4436('0x20')](_0x4436('0x21'),_0x57bd5c+'-'+_0x509d1f+'/'+_0x3c404c)[_0x4436('0x1b')](_0x9c7f60);}return null;};}function patchUpdates(_0x7b12b7){return function(_0x8aa1f){try{jsonpatch[_0x4436('0x22')](_0x8aa1f,_0x7b12b7,!![]);}catch(_0x31ed87){return BPromise[_0x4436('0x23')](_0x31ed87);}return _0x8aa1f[_0x4436('0x24')]();};}function saveUpdates(_0x599e65,_0x15dfaf){return function(_0x53323a){if(_0x53323a){return _0x53323a['update'](_0x599e65)['then'](function(_0x4cddda){return _0x4cddda;});}return null;};}function removeEntity(_0x74df5,_0x4f7adb){return function(_0x349663){if(_0x349663){return _0x349663[_0x4436('0x25')]()[_0x4436('0x26')](function(){_0x74df5[_0x4436('0x19')](0xcc)[_0x4436('0x1a')]();});}};}function handleEntityNotFound(_0x22f033,_0x2d66f8){return function(_0x47b16c){if(!_0x47b16c){_0x22f033[_0x4436('0x18')](0x194);}return _0x47b16c;};}function handleError(_0x49e654,_0x483ca0){_0x483ca0=_0x483ca0||0x1f4;return function(_0xe48176){logger['error'](_0xe48176[_0x4436('0x27')]);if(_0xe48176[_0x4436('0x28')]){delete _0xe48176[_0x4436('0x28')];}_0x49e654['status'](_0x483ca0)[_0x4436('0x29')](_0xe48176);};}exports['index']=function(_0x4bb94d,_0x370c5c){var _0x14513c={},_0x13ce6b={},_0x371323={'count':0x0,'rows':[]};var _0x5cf72f=_[_0x4436('0x2a')](db[_0x4436('0x2b')][_0x4436('0x2c')],function(_0x2bcfa4){return{'name':_0x2bcfa4[_0x4436('0x2d')],'type':_0x2bcfa4['type'][_0x4436('0x2e')]};});_0x13ce6b[_0x4436('0x2f')]=_[_0x4436('0x2a')](_0x5cf72f,'name');_0x13ce6b['query']=_['keys'](_0x4bb94d[_0x4436('0x30')]);_0x13ce6b[_0x4436('0x31')]=_[_0x4436('0x32')](_0x13ce6b[_0x4436('0x2f')],_0x13ce6b['query']);_0x14513c['attributes']=_[_0x4436('0x32')](_0x13ce6b['model'],qs['fields'](_0x4bb94d['query'][_0x4436('0x33')]));_0x14513c[_0x4436('0x34')]=_0x14513c['attributes'][_0x4436('0x35')]?_0x14513c[_0x4436('0x34')]:_0x13ce6b[_0x4436('0x2f')];if(!_0x4bb94d[_0x4436('0x30')][_0x4436('0x36')](_0x4436('0x37'))){_0x14513c[_0x4436('0x1e')]=qs[_0x4436('0x1e')](_0x4bb94d[_0x4436('0x30')][_0x4436('0x1e')]);_0x14513c['offset']=qs[_0x4436('0x1c')](_0x4bb94d[_0x4436('0x30')][_0x4436('0x1c')]);}_0x14513c['order']=qs[_0x4436('0x38')](_0x4bb94d[_0x4436('0x30')][_0x4436('0x38')]);_0x14513c['where']=qs[_0x4436('0x31')](_[_0x4436('0x39')](_0x4bb94d['query'],_0x13ce6b['filters']),_0x5cf72f);if(_0x4bb94d[_0x4436('0x30')][_0x4436('0x3a')]){_0x14513c['where']=_[_0x4436('0x3b')](_0x14513c['where'],{'$or':_[_0x4436('0x2a')](_0x5cf72f,function(_0x11c6fa){if(_0x11c6fa[_0x4436('0x3c')]!==_0x4436('0x3d')){var _0x1937fb={};_0x1937fb[_0x11c6fa['name']]={'$like':'%'+_0x4bb94d[_0x4436('0x30')][_0x4436('0x3a')]+'%'};return _0x1937fb;}})});}_0x14513c=_['merge']({},_0x14513c,_0x4bb94d[_0x4436('0x3e')]);var _0x34fe79={'where':_0x14513c['where']};return db['MailSubstatus'][_0x4436('0x1f')](_0x34fe79)[_0x4436('0x26')](function(_0x55f50e){_0x371323['count']=_0x55f50e;if(_0x4bb94d[_0x4436('0x30')][_0x4436('0x3f')]){_0x14513c['include']=[{'all':!![]}];}return db[_0x4436('0x2b')][_0x4436('0x40')](_0x14513c);})[_0x4436('0x26')](function(_0x8e5948){_0x371323['rows']=_0x8e5948;return _0x371323;})[_0x4436('0x26')](respondWithFilteredResult(_0x370c5c,_0x14513c))[_0x4436('0x41')](handleError(_0x370c5c,null));};exports[_0x4436('0x42')]=function(_0x6854ba,_0x3d937a){var _0x11ceda={'raw':!![],'where':{'id':_0x6854ba[_0x4436('0x43')]['id']}},_0x470699={};_0x470699['model']=_[_0x4436('0x44')](db[_0x4436('0x2b')]['rawAttributes']);_0x470699[_0x4436('0x30')]=_[_0x4436('0x44')](_0x6854ba['query']);_0x470699[_0x4436('0x31')]=_['intersection'](_0x470699[_0x4436('0x2f')],_0x470699[_0x4436('0x30')]);_0x11ceda[_0x4436('0x34')]=_[_0x4436('0x32')](_0x470699['model'],qs[_0x4436('0x33')](_0x6854ba[_0x4436('0x30')]['fields']));_0x11ceda['attributes']=_0x11ceda[_0x4436('0x34')][_0x4436('0x35')]?_0x11ceda[_0x4436('0x34')]:_0x470699[_0x4436('0x2f')];if(_0x6854ba[_0x4436('0x30')]['includeAll']){_0x11ceda[_0x4436('0x45')]=[{'all':!![]}];}_0x11ceda=_[_0x4436('0x3b')]({},_0x11ceda,_0x6854ba[_0x4436('0x3e')]);return db[_0x4436('0x2b')][_0x4436('0x46')](_0x11ceda)['then'](handleEntityNotFound(_0x3d937a,null))[_0x4436('0x26')](respondWithResult(_0x3d937a,null))[_0x4436('0x41')](handleError(_0x3d937a,null));};exports[_0x4436('0x47')]=function(_0x24a2d4,_0x27f580){return db[_0x4436('0x2b')][_0x4436('0x47')](_0x24a2d4['body'],{})['then'](respondWithResult(_0x27f580,0xc9))['catch'](handleError(_0x27f580,null));};exports['update']=function(_0x44b527,_0x3b1013){if(_0x44b527[_0x4436('0x48')]['id']){delete _0x44b527[_0x4436('0x48')]['id'];}return db[_0x4436('0x2b')][_0x4436('0x46')]({'where':{'id':_0x44b527[_0x4436('0x43')]['id']}})[_0x4436('0x26')](handleEntityNotFound(_0x3b1013,null))[_0x4436('0x26')](saveUpdates(_0x44b527['body'],null))['then'](respondWithResult(_0x3b1013,null))[_0x4436('0x41')](handleError(_0x3b1013,null));};exports['destroy']=function(_0x230640,_0x5118bf){return db[_0x4436('0x2b')][_0x4436('0x46')]({'where':{'id':_0x230640[_0x4436('0x43')]['id']}})[_0x4436('0x26')](handleEntityNotFound(_0x5118bf,null))[_0x4436('0x26')](removeEntity(_0x5118bf,null))[_0x4436('0x41')](handleError(_0x5118bf,null));};exports[_0x4436('0x49')]=function(_0x4dc3ad,_0x466aac){return db[_0x4436('0x2b')][_0x4436('0x49')]()[_0x4436('0x26')](respondWithResult(_0x466aac,null))[_0x4436('0x41')](handleError(_0x466aac,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index ad0e6fe..e97d9a2 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 _0x6cd5=['exports','events','MailSubstatus','setMaxListeners','emit','hasOwnProperty','hook'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x6cd5,0xfd));var _0x56cd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6cd5[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x56cd('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0x56cd('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x56cd('0x2')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x5cfe9d){return function(_0xcb3338,_0x77cd91,_0x440f1a){MailSubstatusEvents[_0x56cd('0x3')](_0x5cfe9d+':'+_0xcb3338['id'],_0xcb3338);MailSubstatusEvents['emit'](_0x5cfe9d,_0xcb3338);_0x440f1a(null);};}for(var e in events){if(events[_0x56cd('0x4')](e)){var event=events[e];MailSubstatus[_0x56cd('0x5')](e,emitEvent(event));}}module[_0x56cd('0x6')]=MailSubstatusEvents; \ No newline at end of file +var _0x80ef=['update','hook','exports','MailSubstatus','setMaxListeners'];(function(_0xeb4155,_0x587bdd){var _0x511b5c=function(_0x279d7d){while(--_0x279d7d){_0xeb4155['push'](_0xeb4155['shift']());}};_0x511b5c(++_0x587bdd);}(_0x80ef,0x102));var _0xf80e=function(_0x365261,_0x58fea7){_0x365261=_0x365261-0x0;var _0x296d84=_0x80ef[_0x365261];return _0x296d84;};'use strict';var EventEmitter=require('events');var MailSubstatus=require('../../mysqldb')['db'][_0xf80e('0x0')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xf80e('0x1')](0x0);var events={'afterUpdate':_0xf80e('0x2')};function emitEvent(_0x4ce59a){return function(_0xdb34d3,_0x5d7cd6,_0x23d8c5){MailSubstatusEvents['emit'](_0x4ce59a+':'+_0xdb34d3['id'],_0xdb34d3);MailSubstatusEvents['emit'](_0x4ce59a,_0xdb34d3);_0x23d8c5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0xf80e('0x3')](e,emitEvent(event));}}module[_0xf80e('0x4')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 7f51f78..692c618 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 _0x5f23=['mailSubstatus','name','then','catch','./mailSubstatus.attributes','exports','define','mail_substatuses','Condition','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f23,0x7c));var _0x35f2=function(_0x355da5,_0x210f7a){_0x355da5=_0x355da5-0x0;var _0x4cd60d=_0x5f23[_0x355da5];return _0x4cd60d;};'use strict';var attributes=require(_0x35f2('0x0'));module[_0x35f2('0x1')]=function(_0x2cd0f3){var _0xb8aaf=_0x2cd0f3['models'];return _0x2cd0f3[_0x35f2('0x2')]('MailSubstatus',attributes,{'tableName':_0x35f2('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x19e704,_0x404767,_0x2cc58a){return _0xb8aaf[_0x35f2('0x4')][_0x35f2('0x5')]({'value':_0x19e704['name']},{'where':{'field':_0x35f2('0x6'),'value':_0x19e704['_previousDataValues'][_0x35f2('0x7')]}})[_0x35f2('0x8')](function(){_0x2cc58a();})[_0x35f2('0x9')](function(_0xb2b4dc){_0x2cc58a(_0xb2b4dc);});}}});}; \ No newline at end of file +var _0x3cb6=['MailSubstatus','mail_substatuses','Condition','name','_previousDataValues','catch','./mailSubstatus.attributes','exports','models','define'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3cb6,0x7e));var _0x63cb=function(_0x57c79f,_0xdfe47d){_0x57c79f=_0x57c79f-0x0;var _0x1840d1=_0x3cb6[_0x57c79f];return _0x1840d1;};'use strict';var attributes=require(_0x63cb('0x0'));module[_0x63cb('0x1')]=function(_0x5a838d){var _0x3e0cf8=_0x5a838d[_0x63cb('0x2')];return _0x5a838d[_0x63cb('0x3')](_0x63cb('0x4'),attributes,{'tableName':_0x63cb('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x588c99,_0x4661d9,_0x4df0fa){return _0x3e0cf8[_0x63cb('0x6')]['update']({'value':_0x588c99[_0x63cb('0x7')]},{'where':{'field':'mailSubstatus','value':_0x588c99[_0x63cb('0x8')][_0x63cb('0x7')]}})['then'](function(){_0x4df0fa();})[_0x63cb('0x9')](function(_0x3ef997){_0x4df0fa(_0x3ef997);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index c80b0db..e609f10 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 _0xdb4d=['then','info','MailSubstatus,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request'];(function(_0x44e08d,_0x8cb7bc){var _0x1763b6=function(_0x3622b3){while(--_0x3622b3){_0x44e08d['push'](_0x44e08d['shift']());}};_0x1763b6(++_0x8cb7bc);}(_0xdb4d,0x1d7));var _0xddb4=function(_0x5b5db7,_0x19263d){_0x5b5db7=_0x5b5db7-0x0;var _0x1f4f6c=_0xdb4d[_0x5b5db7];return _0x1f4f6c;};'use strict';var _=require(_0xddb4('0x0'));var util=require(_0xddb4('0x1'));var moment=require(_0xddb4('0x2'));var BPromise=require(_0xddb4('0x3'));var rs=require(_0xddb4('0x4'));var fs=require('fs');var Redis=require(_0xddb4('0x5'));var db=require(_0xddb4('0x6'))['db'];var utils=require(_0xddb4('0x7'));var logger=require(_0xddb4('0x8'))('rpc');var config=require(_0xddb4('0x9'));var jayson=require(_0xddb4('0xa'));var client=jayson[_0xddb4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xef8f1c,_0x526e79,_0xfdc205){return new BPromise(function(_0x4a08a7,_0x1a94bd){return client[_0xddb4('0xc')](_0xef8f1c,_0xfdc205)[_0xddb4('0xd')](function(_0x334656){logger[_0xddb4('0xe')](_0xddb4('0xf'),_0x526e79,'request\x20sent');logger[_0xddb4('0x10')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x526e79,_0xddb4('0x11'),JSON['stringify'](_0x334656));if(_0x334656['error']){if(_0x334656[_0xddb4('0x12')]['code']===0x1f4){logger[_0xddb4('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x526e79,_0x334656[_0xddb4('0x12')][_0xddb4('0x13')]);return _0x1a94bd(_0x334656[_0xddb4('0x12')][_0xddb4('0x13')]);}logger[_0xddb4('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x526e79,_0x334656[_0xddb4('0x12')][_0xddb4('0x13')]);return _0x4a08a7(_0x334656[_0xddb4('0x12')][_0xddb4('0x13')]);}else{logger[_0xddb4('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x526e79,_0xddb4('0x11'));_0x4a08a7(_0x334656[_0xddb4('0x14')][_0xddb4('0x13')]);}})[_0xddb4('0x15')](function(_0x255025){logger[_0xddb4('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x526e79,_0x255025);_0x1a94bd(_0x255025);});});} \ No newline at end of file +var _0xef37=['rpc','../../config/environment','client','http','request','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x23ff36,_0x1b551f){var _0x7e1b0c=function(_0x4c8b4c){while(--_0x4c8b4c){_0x23ff36['push'](_0x23ff36['shift']());}};_0x7e1b0c(++_0x1b551f);}(_0xef37,0x92));var _0x7ef3=function(_0x4c852c,_0x3114a1){_0x4c852c=_0x4c852c-0x0;var _0x2e3b3f=_0xef37[_0x4c852c];return _0x2e3b3f;};'use strict';var _=require(_0x7ef3('0x0'));var util=require('util');var moment=require(_0x7ef3('0x1'));var BPromise=require(_0x7ef3('0x2'));var rs=require(_0x7ef3('0x3'));var fs=require('fs');var Redis=require(_0x7ef3('0x4'));var db=require(_0x7ef3('0x5'))['db'];var utils=require(_0x7ef3('0x6'));var logger=require(_0x7ef3('0x7'))(_0x7ef3('0x8'));var config=require(_0x7ef3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7ef3('0xa')][_0x7ef3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x115120,_0x4f2eba,_0x261fc8){return new BPromise(function(_0x5b1daa,_0x25f7aa){return client[_0x7ef3('0xc')](_0x115120,_0x261fc8)['then'](function(_0x28aefb){logger[_0x7ef3('0xd')](_0x7ef3('0xe'),_0x4f2eba,'request\x20sent');logger[_0x7ef3('0xf')](_0x7ef3('0x10'),_0x4f2eba,_0x7ef3('0x11'),JSON['stringify'](_0x28aefb));if(_0x28aefb[_0x7ef3('0x12')]){if(_0x28aefb[_0x7ef3('0x12')]['code']===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x4f2eba,_0x28aefb[_0x7ef3('0x12')]['message']);return _0x25f7aa(_0x28aefb['error'][_0x7ef3('0x13')]);}logger['error'](_0x7ef3('0xe'),_0x4f2eba,_0x28aefb[_0x7ef3('0x12')][_0x7ef3('0x13')]);return _0x5b1daa(_0x28aefb[_0x7ef3('0x12')][_0x7ef3('0x13')]);}else{logger[_0x7ef3('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x4f2eba,_0x7ef3('0x11'));_0x5b1daa(_0x28aefb[_0x7ef3('0x14')]['message']);}})[_0x7ef3('0x15')](function(_0x431122){logger['error'](_0x7ef3('0xe'),_0x4f2eba,_0x431122);_0x25f7aa(_0x431122);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index adecca5..ac57ba3 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 _0x94ab=['/:id','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','show','post','create'];(function(_0x3279bb,_0x4cbaee){var _0x29a01b=function(_0x251303){while(--_0x251303){_0x3279bb['push'](_0x3279bb['shift']());}};_0x29a01b(++_0x4cbaee);}(_0x94ab,0x9b));var _0xb94a=function(_0x41e19f,_0x1c6491){_0x41e19f=_0x41e19f-0x0;var _0x2acfa2=_0x94ab[_0x41e19f];return _0x2acfa2;};'use strict';var multer=require('multer');var util=require(_0xb94a('0x0'));var path=require(_0xb94a('0x1'));var timeout=require(_0xb94a('0x2'));var express=require(_0xb94a('0x3'));var router=express[_0xb94a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb94a('0x5'));var interaction=require(_0xb94a('0x6'));var config=require(_0xb94a('0x7'));var controller=require('./mailTransferReport.controller');router['get']('/',auth[_0xb94a('0x8')](),controller[_0xb94a('0x9')]);router['get'](_0xb94a('0xa'),auth[_0xb94a('0x8')](),controller[_0xb94a('0xb')]);router[_0xb94a('0xc')]('/:id',auth[_0xb94a('0x8')](),controller[_0xb94a('0xd')]);router[_0xb94a('0xe')]('/',auth[_0xb94a('0x8')](),controller[_0xb94a('0xf')]);router['put'](_0xb94a('0x10'),auth[_0xb94a('0x8')](),controller['update']);router[_0xb94a('0x11')](_0xb94a('0x10'),auth[_0xb94a('0x8')](),controller[_0xb94a('0x12')]);module['exports']=router; \ No newline at end of file +var _0xbbe2=['Router','../../components/auth/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','update','delete','exports','multer','util','path','express'];(function(_0x488b2f,_0x402d3d){var _0x1a5280=function(_0xc53d0e){while(--_0xc53d0e){_0x488b2f['push'](_0x488b2f['shift']());}};_0x1a5280(++_0x402d3d);}(_0xbbe2,0x176));var _0x2bbe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbe2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2bbe('0x0'));var util=require(_0x2bbe('0x1'));var path=require(_0x2bbe('0x2'));var timeout=require('connect-timeout');var express=require(_0x2bbe('0x3'));var router=express[_0x2bbe('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2bbe('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2bbe('0x6'));var controller=require(_0x2bbe('0x7'));router['get']('/',auth[_0x2bbe('0x8')](),controller[_0x2bbe('0x9')]);router[_0x2bbe('0xa')](_0x2bbe('0xb'),auth[_0x2bbe('0x8')](),controller[_0x2bbe('0xc')]);router[_0x2bbe('0xa')](_0x2bbe('0xd'),auth[_0x2bbe('0x8')](),controller['show']);router[_0x2bbe('0xe')]('/',auth[_0x2bbe('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2bbe('0xf')]);router[_0x2bbe('0x10')]('/:id',auth[_0x2bbe('0x8')](),controller['destroy']);module[_0x2bbe('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 6aeff9b..db805a8 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x57314d,_0x3d168e){var _0x5cd6e4=function(_0x251f46){while(--_0x251f46){_0x57314d['push'](_0x57314d['shift']());}};_0x5cd6e4(++_0x3d168e);}(_0x00bb,0x1d8));var _0xb00b=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x00bb[_0x311c35];return _0x5cc50c;};'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 _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x363245,_0x1b02bf){var _0x5738e2=function(_0x260d42){while(--_0x260d42){_0x363245['push'](_0x363245['shift']());}};_0x5738e2(++_0x1b02bf);}(_0xe706,0xa3));var _0x6e70=function(_0x28578d,_0xcf5cf0){_0x28578d=_0x28578d-0x0;var _0x524826=_0xe706[_0x28578d];return _0x524826;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 9ab660e..bf4f50d 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 _0x952f=['name','send','index','type','key','model','map','query','keys','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','MailTransferReport','rawAttributes','intersection','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy'];(function(_0x349edb,_0x2fc4b1){var _0x517f7e=function(_0x57397f){while(--_0x57397f){_0x349edb['push'](_0x349edb['shift']());}};_0x517f7e(++_0x2fc4b1);}(_0x952f,0x1d5));var _0xf952=function(_0x911353,_0x1648ed){_0x911353=_0x911353-0x0;var _0x2f05fa=_0x952f[_0x911353];return _0x2f05fa;};'use strict';var emlformat=require(_0xf952('0x0'));var rimraf=require(_0xf952('0x1'));var zipdir=require(_0xf952('0x2'));var jsonpatch=require(_0xf952('0x3'));var rp=require(_0xf952('0x4'));var moment=require(_0xf952('0x5'));var BPromise=require(_0xf952('0x6'));var Mustache=require(_0xf952('0x7'));var util=require('util');var path=require(_0xf952('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf952('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf952('0xa'));var crypto=require(_0xf952('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf952('0xc'));var Papa=require(_0xf952('0xd'));var Redis=require('ioredis');var authService=require(_0xf952('0xe'));var qs=require(_0xf952('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf952('0x10'));var logger=require('../../config/logger')(_0xf952('0x11'));var utils=require(_0xf952('0x12'));var config=require(_0xf952('0x13'));var licenseUtil=require(_0xf952('0x14'));var db=require(_0xf952('0x15'))['db'];function respondWithStatusCode(_0x13b7e4,_0x1ae068){_0x1ae068=_0x1ae068||0xcc;return function(_0x534182){if(_0x534182){return _0x13b7e4[_0xf952('0x16')](_0x1ae068);}return _0x13b7e4[_0xf952('0x17')](_0x1ae068)['end']();};}function respondWithResult(_0x547f86,_0x2cf1a5){_0x2cf1a5=_0x2cf1a5||0xc8;return function(_0x507a8e){if(_0x507a8e){return _0x547f86['status'](_0x2cf1a5)[_0xf952('0x18')](_0x507a8e);}};}function respondWithFilteredResult(_0xc56462,_0x1988f8){return function(_0x527b52){if(_0x527b52){var _0x1aa9c7=typeof _0x1988f8['offset']===_0xf952('0x19')&&typeof _0x1988f8[_0xf952('0x1a')]===_0xf952('0x19');var _0x5544db=_0x527b52[_0xf952('0x1b')];var _0x32ddae=_0x1aa9c7?0x0:_0x1988f8['offset'];var _0x384388=_0x1aa9c7?_0x527b52[_0xf952('0x1b')]:_0x1988f8[_0xf952('0x1c')]+_0x1988f8[_0xf952('0x1a')];var _0x2bced4;if(_0x384388>=_0x5544db){_0x384388=_0x5544db;_0x2bced4=0xc8;}else{_0x2bced4=0xce;}_0xc56462[_0xf952('0x17')](_0x2bced4);return _0xc56462[_0xf952('0x1d')](_0xf952('0x1e'),_0x32ddae+'-'+_0x384388+'/'+_0x5544db)[_0xf952('0x18')](_0x527b52);}return null;};}function patchUpdates(_0x125805){return function(_0x560c6b){try{jsonpatch[_0xf952('0x1f')](_0x560c6b,_0x125805,!![]);}catch(_0x9db693){return BPromise['reject'](_0x9db693);}return _0x560c6b[_0xf952('0x20')]();};}function saveUpdates(_0x5dcb5d,_0x34a0e4){return function(_0x476dc1){if(_0x476dc1){return _0x476dc1['update'](_0x5dcb5d)[_0xf952('0x21')](function(_0x55ab55){return _0x55ab55;});}return null;};}function removeEntity(_0x223d4e,_0x48a437){return function(_0x398a29){if(_0x398a29){return _0x398a29[_0xf952('0x22')]()['then'](function(){_0x223d4e[_0xf952('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b188a,_0x3d662b){return function(_0x1c608d){if(!_0x1c608d){_0x3b188a[_0xf952('0x16')](0x194);}return _0x1c608d;};}function handleError(_0x3c7f0e,_0x2c0b32){_0x2c0b32=_0x2c0b32||0x1f4;return function(_0x19d92a){logger['error'](_0x19d92a['stack']);if(_0x19d92a[_0xf952('0x23')]){delete _0x19d92a[_0xf952('0x23')];}_0x3c7f0e[_0xf952('0x17')](_0x2c0b32)[_0xf952('0x24')](_0x19d92a);};}exports[_0xf952('0x25')]=function(_0x1d2b09,_0x16c028){var _0x45e64f={},_0x27a26c={},_0x1b1854={'count':0x0,'rows':[]};var _0x2e8c14=_['map'](db['MailTransferReport']['rawAttributes'],function(_0x50b8b6){return{'name':_0x50b8b6['fieldName'],'type':_0x50b8b6[_0xf952('0x26')][_0xf952('0x27')]};});_0x27a26c[_0xf952('0x28')]=_[_0xf952('0x29')](_0x2e8c14,_0xf952('0x23'));_0x27a26c[_0xf952('0x2a')]=_[_0xf952('0x2b')](_0x1d2b09[_0xf952('0x2a')]);_0x27a26c['filters']=_['intersection'](_0x27a26c[_0xf952('0x28')],_0x27a26c[_0xf952('0x2a')]);_0x45e64f[_0xf952('0x2c')]=_['intersection'](_0x27a26c[_0xf952('0x28')],qs[_0xf952('0x2d')](_0x1d2b09[_0xf952('0x2a')]['fields']));_0x45e64f[_0xf952('0x2c')]=_0x45e64f[_0xf952('0x2c')]['length']?_0x45e64f[_0xf952('0x2c')]:_0x27a26c['model'];if(!_0x1d2b09[_0xf952('0x2a')][_0xf952('0x2e')](_0xf952('0x2f'))){_0x45e64f['limit']=qs[_0xf952('0x1a')](_0x1d2b09[_0xf952('0x2a')]['limit']);_0x45e64f[_0xf952('0x1c')]=qs[_0xf952('0x1c')](_0x1d2b09['query']['offset']);}_0x45e64f[_0xf952('0x30')]=qs[_0xf952('0x31')](_0x1d2b09[_0xf952('0x2a')]['sort']);_0x45e64f[_0xf952('0x32')]=qs[_0xf952('0x33')](_[_0xf952('0x34')](_0x1d2b09[_0xf952('0x2a')],_0x27a26c[_0xf952('0x33')]),_0x2e8c14);if(_0x1d2b09[_0xf952('0x2a')][_0xf952('0x35')]){_0x45e64f[_0xf952('0x32')]=_[_0xf952('0x36')](_0x45e64f[_0xf952('0x32')],{'$or':_[_0xf952('0x29')](_0x2e8c14,function(_0x3cf222){if(_0x3cf222['type']!==_0xf952('0x37')){var _0x2650fc={};_0x2650fc[_0x3cf222['name']]={'$like':'%'+_0x1d2b09[_0xf952('0x2a')][_0xf952('0x35')]+'%'};return _0x2650fc;}})});}_0x45e64f=_[_0xf952('0x36')]({},_0x45e64f,_0x1d2b09[_0xf952('0x38')]);var _0x528319={'where':_0x45e64f[_0xf952('0x32')]};return db['MailTransferReport']['count'](_0x528319)[_0xf952('0x21')](function(_0x2af800){_0x1b1854[_0xf952('0x1b')]=_0x2af800;if(_0x1d2b09[_0xf952('0x2a')][_0xf952('0x39')]){_0x45e64f[_0xf952('0x3a')]=[{'all':!![]}];}return db['MailTransferReport'][_0xf952('0x3b')](_0x45e64f);})[_0xf952('0x21')](function(_0x19f927){_0x1b1854[_0xf952('0x3c')]=_0x19f927;return _0x1b1854;})['then'](respondWithFilteredResult(_0x16c028,_0x45e64f))[_0xf952('0x3d')](handleError(_0x16c028,null));};exports[_0xf952('0x3e')]=function(_0x59c401,_0x34ac4a){var _0xf146bf={'raw':!![],'where':{'id':_0x59c401['params']['id']}},_0x4650a0={};_0x4650a0[_0xf952('0x28')]=_[_0xf952('0x2b')](db[_0xf952('0x3f')][_0xf952('0x40')]);_0x4650a0[_0xf952('0x2a')]=_[_0xf952('0x2b')](_0x59c401[_0xf952('0x2a')]);_0x4650a0[_0xf952('0x33')]=_[_0xf952('0x41')](_0x4650a0[_0xf952('0x28')],_0x4650a0['query']);_0xf146bf['attributes']=_['intersection'](_0x4650a0['model'],qs[_0xf952('0x2d')](_0x59c401['query'][_0xf952('0x2d')]));_0xf146bf[_0xf952('0x2c')]=_0xf146bf[_0xf952('0x2c')]['length']?_0xf146bf[_0xf952('0x2c')]:_0x4650a0[_0xf952('0x28')];if(_0x59c401[_0xf952('0x2a')][_0xf952('0x39')]){_0xf146bf[_0xf952('0x3a')]=[{'all':!![]}];}_0xf146bf=_[_0xf952('0x36')]({},_0xf146bf,_0x59c401[_0xf952('0x38')]);return db[_0xf952('0x3f')][_0xf952('0x42')](_0xf146bf)[_0xf952('0x21')](handleEntityNotFound(_0x34ac4a,null))[_0xf952('0x21')](respondWithResult(_0x34ac4a,null))[_0xf952('0x3d')](handleError(_0x34ac4a,null));};exports[_0xf952('0x43')]=function(_0xa45ff8,_0x24a60c){return db[_0xf952('0x3f')][_0xf952('0x43')](_0xa45ff8[_0xf952('0x44')],{})[_0xf952('0x21')](respondWithResult(_0x24a60c,0xc9))['catch'](handleError(_0x24a60c,null));};exports[_0xf952('0x45')]=function(_0x590e78,_0x34984c){if(_0x590e78[_0xf952('0x44')]['id']){delete _0x590e78[_0xf952('0x44')]['id'];}return db[_0xf952('0x3f')]['find']({'where':{'id':_0x590e78['params']['id']}})[_0xf952('0x21')](handleEntityNotFound(_0x34984c,null))['then'](saveUpdates(_0x590e78[_0xf952('0x44')],null))[_0xf952('0x21')](respondWithResult(_0x34984c,null))[_0xf952('0x3d')](handleError(_0x34984c,null));};exports[_0xf952('0x22')]=function(_0x345c39,_0x56a9ca){return db[_0xf952('0x3f')][_0xf952('0x42')]({'where':{'id':_0x345c39[_0xf952('0x46')]['id']}})[_0xf952('0x21')](handleEntityNotFound(_0x56a9ca,null))[_0xf952('0x21')](removeEntity(_0x56a9ca,null))[_0xf952('0x3d')](handleError(_0x56a9ca,null));};exports[_0xf952('0x47')]=function(_0x5e0a84,_0x5a068d){return db[_0xf952('0x3f')][_0xf952('0x47')]()['then'](respondWithResult(_0x5a068d,null))[_0xf952('0x3d')](handleError(_0x5a068d,null));}; \ No newline at end of file +var _0x0a0c=['send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','MailTransferReport','includeAll','include','findAll','catch','show','params','length','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','reject','save','then','error','stack','name'];(function(_0x3c2fff,_0x32610b){var _0x1580c5=function(_0x16c2ec){while(--_0x16c2ec){_0x3c2fff['push'](_0x3c2fff['shift']());}};_0x1580c5(++_0x32610b);}(_0x0a0c,0x1df));var _0xc0a0=function(_0x41a07f,_0x2f06fb){_0x41a07f=_0x41a07f-0x0;var _0x2de0ed=_0x0a0c[_0x41a07f];return _0x2de0ed;};'use strict';var emlformat=require(_0xc0a0('0x0'));var rimraf=require(_0xc0a0('0x1'));var zipdir=require(_0xc0a0('0x2'));var jsonpatch=require(_0xc0a0('0x3'));var rp=require('request-promise');var moment=require(_0xc0a0('0x4'));var BPromise=require(_0xc0a0('0x5'));var Mustache=require(_0xc0a0('0x6'));var util=require(_0xc0a0('0x7'));var path=require(_0xc0a0('0x8'));var sox=require(_0xc0a0('0x9'));var csv=require(_0xc0a0('0xa'));var ejs=require(_0xc0a0('0xb'));var fs=require('fs');var fs_extra=require(_0xc0a0('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc0a0('0xd'));var jsforce=require(_0xc0a0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc0a0('0xa'));var querystring=require(_0xc0a0('0xf'));var Papa=require(_0xc0a0('0x10'));var Redis=require(_0xc0a0('0x11'));var authService=require(_0xc0a0('0x12'));var qs=require(_0xc0a0('0x13'));var as=require(_0xc0a0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc0a0('0x15'));var licenseUtil=require(_0xc0a0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3781cf,_0xe3425e){_0xe3425e=_0xe3425e||0xcc;return function(_0x30e754){if(_0x30e754){return _0x3781cf[_0xc0a0('0x17')](_0xe3425e);}return _0x3781cf[_0xc0a0('0x18')](_0xe3425e)[_0xc0a0('0x19')]();};}function respondWithResult(_0x58904a,_0x129c73){_0x129c73=_0x129c73||0xc8;return function(_0x39b5bc){if(_0x39b5bc){return _0x58904a['status'](_0x129c73)['json'](_0x39b5bc);}};}function respondWithFilteredResult(_0x4f84f4,_0x9c03de){return function(_0x9577c3){if(_0x9577c3){var _0x3c9ffa=typeof _0x9c03de['offset']===_0xc0a0('0x1a')&&typeof _0x9c03de[_0xc0a0('0x1b')]===_0xc0a0('0x1a');var _0x2f4b0c=_0x9577c3['count'];var _0x150f4a=_0x3c9ffa?0x0:_0x9c03de[_0xc0a0('0x1c')];var _0x4dff3e=_0x3c9ffa?_0x9577c3[_0xc0a0('0x1d')]:_0x9c03de['offset']+_0x9c03de['limit'];var _0x5db9cc;if(_0x4dff3e>=_0x2f4b0c){_0x4dff3e=_0x2f4b0c;_0x5db9cc=0xc8;}else{_0x5db9cc=0xce;}_0x4f84f4[_0xc0a0('0x18')](_0x5db9cc);return _0x4f84f4[_0xc0a0('0x1e')](_0xc0a0('0x1f'),_0x150f4a+'-'+_0x4dff3e+'/'+_0x2f4b0c)[_0xc0a0('0x20')](_0x9577c3);}return null;};}function patchUpdates(_0x4988ec){return function(_0x30a9e9){try{jsonpatch['apply'](_0x30a9e9,_0x4988ec,!![]);}catch(_0x1cbeab){return BPromise[_0xc0a0('0x21')](_0x1cbeab);}return _0x30a9e9[_0xc0a0('0x22')]();};}function saveUpdates(_0x382669,_0x38125a){return function(_0x2b47cc){if(_0x2b47cc){return _0x2b47cc['update'](_0x382669)[_0xc0a0('0x23')](function(_0x11aad4){return _0x11aad4;});}return null;};}function removeEntity(_0x52dafa,_0x45c550){return function(_0x39a0f0){if(_0x39a0f0){return _0x39a0f0['destroy']()['then'](function(){_0x52dafa[_0xc0a0('0x18')](0xcc)[_0xc0a0('0x19')]();});}};}function handleEntityNotFound(_0x5b3e46,_0x231f41){return function(_0x455798){if(!_0x455798){_0x5b3e46[_0xc0a0('0x17')](0x194);}return _0x455798;};}function handleError(_0xca00c2,_0x144dd2){_0x144dd2=_0x144dd2||0x1f4;return function(_0x2b5185){logger[_0xc0a0('0x24')](_0x2b5185[_0xc0a0('0x25')]);if(_0x2b5185[_0xc0a0('0x26')]){delete _0x2b5185[_0xc0a0('0x26')];}_0xca00c2[_0xc0a0('0x18')](_0x144dd2)[_0xc0a0('0x27')](_0x2b5185);};}exports['index']=function(_0x38fc7f,_0x3cc2dd){var _0x57408e={},_0x341c90={},_0x6fa3f9={'count':0x0,'rows':[]};var _0x595ef5=_[_0xc0a0('0x28')](db['MailTransferReport'][_0xc0a0('0x29')],function(_0x5f5927){return{'name':_0x5f5927[_0xc0a0('0x2a')],'type':_0x5f5927[_0xc0a0('0x2b')][_0xc0a0('0x2c')]};});_0x341c90[_0xc0a0('0x2d')]=_[_0xc0a0('0x28')](_0x595ef5,_0xc0a0('0x26'));_0x341c90[_0xc0a0('0x2e')]=_[_0xc0a0('0x2f')](_0x38fc7f[_0xc0a0('0x2e')]);_0x341c90[_0xc0a0('0x30')]=_[_0xc0a0('0x31')](_0x341c90[_0xc0a0('0x2d')],_0x341c90[_0xc0a0('0x2e')]);_0x57408e[_0xc0a0('0x32')]=_[_0xc0a0('0x31')](_0x341c90['model'],qs[_0xc0a0('0x33')](_0x38fc7f[_0xc0a0('0x2e')][_0xc0a0('0x33')]));_0x57408e['attributes']=_0x57408e['attributes']['length']?_0x57408e[_0xc0a0('0x32')]:_0x341c90[_0xc0a0('0x2d')];if(!_0x38fc7f[_0xc0a0('0x2e')][_0xc0a0('0x34')]('nolimit')){_0x57408e['limit']=qs[_0xc0a0('0x1b')](_0x38fc7f[_0xc0a0('0x2e')][_0xc0a0('0x1b')]);_0x57408e[_0xc0a0('0x1c')]=qs['offset'](_0x38fc7f[_0xc0a0('0x2e')][_0xc0a0('0x1c')]);}_0x57408e[_0xc0a0('0x35')]=qs[_0xc0a0('0x36')](_0x38fc7f[_0xc0a0('0x2e')][_0xc0a0('0x36')]);_0x57408e['where']=qs['filters'](_[_0xc0a0('0x37')](_0x38fc7f[_0xc0a0('0x2e')],_0x341c90[_0xc0a0('0x30')]),_0x595ef5);if(_0x38fc7f['query'][_0xc0a0('0x38')]){_0x57408e['where']=_[_0xc0a0('0x39')](_0x57408e[_0xc0a0('0x3a')],{'$or':_[_0xc0a0('0x28')](_0x595ef5,function(_0x2c9f2f){if(_0x2c9f2f['type']!==_0xc0a0('0x3b')){var _0x2a2d4b={};_0x2a2d4b[_0x2c9f2f[_0xc0a0('0x26')]]={'$like':'%'+_0x38fc7f[_0xc0a0('0x2e')][_0xc0a0('0x38')]+'%'};return _0x2a2d4b;}})});}_0x57408e=_['merge']({},_0x57408e,_0x38fc7f[_0xc0a0('0x3c')]);var _0x24437d={'where':_0x57408e['where']};return db[_0xc0a0('0x3d')][_0xc0a0('0x1d')](_0x24437d)['then'](function(_0x43d4ba){_0x6fa3f9[_0xc0a0('0x1d')]=_0x43d4ba;if(_0x38fc7f['query'][_0xc0a0('0x3e')]){_0x57408e[_0xc0a0('0x3f')]=[{'all':!![]}];}return db['MailTransferReport'][_0xc0a0('0x40')](_0x57408e);})[_0xc0a0('0x23')](function(_0x5d95b8){_0x6fa3f9['rows']=_0x5d95b8;return _0x6fa3f9;})[_0xc0a0('0x23')](respondWithFilteredResult(_0x3cc2dd,_0x57408e))[_0xc0a0('0x41')](handleError(_0x3cc2dd,null));};exports[_0xc0a0('0x42')]=function(_0x210bb3,_0xe49c33){var _0x51f8b0={'raw':!![],'where':{'id':_0x210bb3[_0xc0a0('0x43')]['id']}},_0x5de3c8={};_0x5de3c8[_0xc0a0('0x2d')]=_[_0xc0a0('0x2f')](db[_0xc0a0('0x3d')][_0xc0a0('0x29')]);_0x5de3c8['query']=_[_0xc0a0('0x2f')](_0x210bb3[_0xc0a0('0x2e')]);_0x5de3c8[_0xc0a0('0x30')]=_['intersection'](_0x5de3c8[_0xc0a0('0x2d')],_0x5de3c8[_0xc0a0('0x2e')]);_0x51f8b0['attributes']=_[_0xc0a0('0x31')](_0x5de3c8['model'],qs[_0xc0a0('0x33')](_0x210bb3[_0xc0a0('0x2e')][_0xc0a0('0x33')]));_0x51f8b0[_0xc0a0('0x32')]=_0x51f8b0[_0xc0a0('0x32')][_0xc0a0('0x44')]?_0x51f8b0['attributes']:_0x5de3c8[_0xc0a0('0x2d')];if(_0x210bb3['query'][_0xc0a0('0x3e')]){_0x51f8b0[_0xc0a0('0x3f')]=[{'all':!![]}];}_0x51f8b0=_[_0xc0a0('0x39')]({},_0x51f8b0,_0x210bb3[_0xc0a0('0x3c')]);return db[_0xc0a0('0x3d')][_0xc0a0('0x45')](_0x51f8b0)['then'](handleEntityNotFound(_0xe49c33,null))[_0xc0a0('0x23')](respondWithResult(_0xe49c33,null))['catch'](handleError(_0xe49c33,null));};exports[_0xc0a0('0x46')]=function(_0x2e4b2e,_0x49ac9e){return db[_0xc0a0('0x3d')][_0xc0a0('0x46')](_0x2e4b2e['body'],{})['then'](respondWithResult(_0x49ac9e,0xc9))[_0xc0a0('0x41')](handleError(_0x49ac9e,null));};exports[_0xc0a0('0x47')]=function(_0x2791c0,_0x272dff){if(_0x2791c0[_0xc0a0('0x48')]['id']){delete _0x2791c0[_0xc0a0('0x48')]['id'];}return db[_0xc0a0('0x3d')]['find']({'where':{'id':_0x2791c0['params']['id']}})['then'](handleEntityNotFound(_0x272dff,null))[_0xc0a0('0x23')](saveUpdates(_0x2791c0[_0xc0a0('0x48')],null))[_0xc0a0('0x23')](respondWithResult(_0x272dff,null))[_0xc0a0('0x41')](handleError(_0x272dff,null));};exports['destroy']=function(_0x20be46,_0x55931d){return db[_0xc0a0('0x3d')]['find']({'where':{'id':_0x20be46[_0xc0a0('0x43')]['id']}})[_0xc0a0('0x23')](handleEntityNotFound(_0x55931d,null))[_0xc0a0('0x23')](removeEntity(_0x55931d,null))[_0xc0a0('0x41')](handleError(_0x55931d,null));};exports['describe']=function(_0x498d87,_0x2de31e){return db[_0xc0a0('0x3d')][_0xc0a0('0x49')]()[_0xc0a0('0x23')](respondWithResult(_0x2de31e,null))[_0xc0a0('0x41')](handleError(_0x2de31e,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index b4afb7b..2494da7 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 _0x0207=['../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x5e9d79,_0x14c3a7){var _0x329563=function(_0x4e957e){while(--_0x4e957e){_0x5e9d79['push'](_0x5e9d79['shift']());}};_0x329563(++_0x14c3a7);}(_0x0207,0x162));var _0x7020=function(_0xc91d20,_0x5712f6){_0xc91d20=_0xc91d20-0x0;var _0x46d8ca=_0x0207[_0xc91d20];return _0x46d8ca;};'use strict';var _=require('lodash');var util=require(_0x7020('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x7020('0x1'));var BPromise=require(_0x7020('0x2'));var rp=require(_0x7020('0x3'));var fs=require('fs');var path=require(_0x7020('0x4'));var rimraf=require(_0x7020('0x5'));var config=require(_0x7020('0x6'));var attributes=require(_0x7020('0x7'));module['exports']=function(_0x5074d7,_0x38c320){return _0x5074d7[_0x7020('0x8')](_0x7020('0x9'),attributes,{'tableName':_0x7020('0xa'),'paranoid':![],'indexes':[{'name':_0x7020('0xb'),'fields':[_0x7020('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeed7=['define','MailTransferReport','uniqueid','../../config/logger','api','bluebird','request-promise','path','rimraf','./mailTransferReport.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeed7,0xdf));var _0x7eed=function(_0x5005f8,_0x4e9a49){_0x5005f8=_0x5005f8-0x0;var _0x101a4f=_0xeed7[_0x5005f8];return _0x101a4f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7eed('0x0'))(_0x7eed('0x1'));var moment=require('moment');var BPromise=require(_0x7eed('0x2'));var rp=require(_0x7eed('0x3'));var fs=require('fs');var path=require(_0x7eed('0x4'));var rimraf=require(_0x7eed('0x5'));var config=require('../../config/environment');var attributes=require(_0x7eed('0x6'));module[_0x7eed('0x7')]=function(_0x5975af,_0x307a00){return _0x5975af[_0x7eed('0x8')](_0x7eed('0x9'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7eed('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 03a1cb4..265f169 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 _0xebd0=['../../config/logger','rpc','jayson/promise','client','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x229317,_0x42d0db){var _0x5378d7=function(_0x5b78ad){while(--_0x5b78ad){_0x229317['push'](_0x229317['shift']());}};_0x5378d7(++_0x42d0db);}(_0xebd0,0x149));var _0x0ebd=function(_0x42b5a3,_0x2205df){_0x42b5a3=_0x42b5a3-0x0;var _0x144123=_0xebd0[_0x42b5a3];return _0x144123;};'use strict';var _=require(_0x0ebd('0x0'));var util=require(_0x0ebd('0x1'));var moment=require(_0x0ebd('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ebd('0x3'));var fs=require('fs');var Redis=require(_0x0ebd('0x4'));var db=require(_0x0ebd('0x5'))['db'];var utils=require(_0x0ebd('0x6'));var logger=require(_0x0ebd('0x7'))(_0x0ebd('0x8'));var config=require('../../config/environment');var jayson=require(_0x0ebd('0x9'));var client=jayson[_0x0ebd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20f3eb,_0x3037d1,_0xd91292){return new BPromise(function(_0x4a48d1,_0x4df660){return client[_0x0ebd('0xb')](_0x20f3eb,_0xd91292)[_0x0ebd('0xc')](function(_0x4e7a9b){logger[_0x0ebd('0xd')](_0x0ebd('0xe'),_0x3037d1,_0x0ebd('0xf'));logger[_0x0ebd('0x10')](_0x0ebd('0x11'),_0x3037d1,_0x0ebd('0xf'),JSON[_0x0ebd('0x12')](_0x4e7a9b));if(_0x4e7a9b[_0x0ebd('0x13')]){if(_0x4e7a9b[_0x0ebd('0x13')][_0x0ebd('0x14')]===0x1f4){logger[_0x0ebd('0x13')](_0x0ebd('0xe'),_0x3037d1,_0x4e7a9b[_0x0ebd('0x13')]['message']);return _0x4df660(_0x4e7a9b['error'][_0x0ebd('0x15')]);}logger[_0x0ebd('0x13')](_0x0ebd('0xe'),_0x3037d1,_0x4e7a9b[_0x0ebd('0x13')][_0x0ebd('0x15')]);return _0x4a48d1(_0x4e7a9b[_0x0ebd('0x13')][_0x0ebd('0x15')]);}else{logger[_0x0ebd('0xd')](_0x0ebd('0xe'),_0x3037d1,_0x0ebd('0xf'));_0x4a48d1(_0x4e7a9b[_0x0ebd('0x16')][_0x0ebd('0x15')]);}})[_0x0ebd('0x17')](function(_0x2f34f8){logger['error'](_0x0ebd('0xe'),_0x3037d1,_0x2f34f8);_0x4df660(_0x2f34f8);});});} \ No newline at end of file +var _0x4d7a=['rpc','jayson/promise','request','then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','ioredis','../../config/utils','../../config/logger'];(function(_0x536d9d,_0x3cf1d3){var _0x54a2f2=function(_0x5a1a3c){while(--_0x5a1a3c){_0x536d9d['push'](_0x536d9d['shift']());}};_0x54a2f2(++_0x3cf1d3);}(_0x4d7a,0xb9));var _0xa4d7=function(_0x461ed7,_0x392272){_0x461ed7=_0x461ed7-0x0;var _0x4cc0b0=_0x4d7a[_0x461ed7];return _0x4cc0b0;};'use strict';var _=require(_0xa4d7('0x0'));var util=require(_0xa4d7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa4d7('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa4d7('0x3'));var logger=require(_0xa4d7('0x4'))(_0xa4d7('0x5'));var config=require('../../config/environment');var jayson=require(_0xa4d7('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2b5a86,_0x59959a,_0x1a9334){return new BPromise(function(_0x446d03,_0x513647){return client[_0xa4d7('0x7')](_0x2b5a86,_0x1a9334)[_0xa4d7('0x8')](function(_0x230e52){logger[_0xa4d7('0x9')](_0xa4d7('0xa'),_0x59959a,'request\x20sent');logger[_0xa4d7('0xb')](_0xa4d7('0xc'),_0x59959a,_0xa4d7('0xd'),JSON['stringify'](_0x230e52));if(_0x230e52[_0xa4d7('0xe')]){if(_0x230e52[_0xa4d7('0xe')][_0xa4d7('0xf')]===0x1f4){logger[_0xa4d7('0xe')](_0xa4d7('0xa'),_0x59959a,_0x230e52['error']['message']);return _0x513647(_0x230e52[_0xa4d7('0xe')][_0xa4d7('0x10')]);}logger[_0xa4d7('0xe')](_0xa4d7('0xa'),_0x59959a,_0x230e52[_0xa4d7('0xe')]['message']);return _0x446d03(_0x230e52[_0xa4d7('0xe')][_0xa4d7('0x10')]);}else{logger[_0xa4d7('0x9')](_0xa4d7('0xa'),_0x59959a,_0xa4d7('0xd'));_0x446d03(_0x230e52[_0xa4d7('0x11')][_0xa4d7('0x10')]);}})[_0xa4d7('0x12')](function(_0x28e0e6){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x59959a,_0x28e0e6);_0x513647(_0x28e0e6);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 6beedd4..006390f 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 _0x3fe6=['describe','/:id','show','create','put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe'];(function(_0x37b3e5,_0x33b516){var _0x207f20=function(_0x5237fa){while(--_0x5237fa){_0x37b3e5['push'](_0x37b3e5['shift']());}};_0x207f20(++_0x33b516);}(_0x3fe6,0x15e));var _0x63fe=function(_0x2c1aa8,_0x3e0609){_0x2c1aa8=_0x2c1aa8-0x0;var _0x4019f5=_0x3fe6[_0x2c1aa8];return _0x4019f5;};'use strict';var multer=require(_0x63fe('0x0'));var util=require(_0x63fe('0x1'));var path=require(_0x63fe('0x2'));var timeout=require('connect-timeout');var express=require(_0x63fe('0x3'));var router=express[_0x63fe('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x63fe('0x5'));var interaction=require(_0x63fe('0x6'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0x63fe('0x7')]('/',auth[_0x63fe('0x8')](),controller['index']);router[_0x63fe('0x7')](_0x63fe('0x9'),auth['isAuthenticated'](),controller[_0x63fe('0xa')]);router[_0x63fe('0x7')](_0x63fe('0xb'),auth[_0x63fe('0x8')](),controller[_0x63fe('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x63fe('0xd')]);router[_0x63fe('0xe')]('/:id',auth[_0x63fe('0x8')](),controller[_0x63fe('0xf')]);router[_0x63fe('0x10')](_0x63fe('0xb'),auth[_0x63fe('0x8')](),controller['destroy']);module[_0x63fe('0x11')]=router; \ No newline at end of file +var _0xdf41=['put','/:id','update','destroy','exports','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','post'];(function(_0x59f1e6,_0xda13c5){var _0x2aada5=function(_0x5bf12c){while(--_0x5bf12c){_0x59f1e6['push'](_0x59f1e6['shift']());}};_0x2aada5(++_0xda13c5);}(_0xdf41,0x175));var _0x1df4=function(_0x4c917b,_0x405703){_0x4c917b=_0x4c917b-0x0;var _0x1a7329=_0xdf41[_0x4c917b];return _0x1a7329;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1df4('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1df4('0x1'));var auth=require(_0x1df4('0x2'));var interaction=require(_0x1df4('0x3'));var config=require(_0x1df4('0x4'));var controller=require('./memberReport.controller');router[_0x1df4('0x5')]('/',auth[_0x1df4('0x6')](),controller[_0x1df4('0x7')]);router[_0x1df4('0x5')](_0x1df4('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x1df4('0x5')]('/:id',auth[_0x1df4('0x6')](),controller[_0x1df4('0x9')]);router[_0x1df4('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1df4('0xb')](_0x1df4('0xc'),auth[_0x1df4('0x6')](),controller[_0x1df4('0xd')]);router['delete'](_0x1df4('0xc'),auth['isAuthenticated'](),controller[_0x1df4('0xe')]);module[_0x1df4('0xf')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index a4c9797..c954fd0 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 _0x79fe=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','exitAt','setDataValue','duration'];(function(_0x591cfd,_0x501204){var _0x4d0100=function(_0xb9ff0c){while(--_0xb9ff0c){_0x591cfd['push'](_0x591cfd['shift']());}};_0x4d0100(++_0x501204);}(_0x79fe,0xa6));var _0xe79f=function(_0x4d2e94,_0x38e9d0){_0x4d2e94=_0x4d2e94-0x0;var _0x46a397=_0x79fe[_0x4d2e94];return _0x46a397;};'use strict';var Sequelize=require(_0xe79f('0x0'));var moment=require(_0xe79f('0x1'));module[_0xe79f('0x2')]={'channel':{'type':Sequelize[_0xe79f('0x3')]},'membername':{'type':Sequelize[_0xe79f('0x3')]},'interface':{'type':Sequelize[_0xe79f('0x3')]},'type':{'type':Sequelize[_0xe79f('0x3')],'defaultValue':_0xe79f('0x4'),'comment':_0xe79f('0x5')},'duration':{'type':Sequelize[_0xe79f('0x6')]},'enterAt':{'type':Sequelize[_0xe79f('0x7')]},'exitAt':{'type':Sequelize[_0xe79f('0x7')],'set':function(_0x3228fc){var _0xd9c20a=moment(_0x3228fc);var _0x4448dd=moment(this[_0xe79f('0x8')](_0xe79f('0x9')));var _0xebbf89=_0xd9c20a[_0xe79f('0xa')](_0x4448dd,'seconds');this['setDataValue'](_0xe79f('0xb'),_0x3228fc);this[_0xe79f('0xc')](_0xe79f('0xd'),_0xebbf89>=0x0?_0xebbf89:null);}},'data1':{'type':Sequelize[_0xe79f('0x3')],'comment':_0xe79f('0xe')},'data2':{'type':Sequelize['STRING'],'comment':_0xe79f('0xf')},'data3':{'type':Sequelize['STRING'],'comment':_0xe79f('0x10')},'data4':{'type':Sequelize[_0xe79f('0x3')],'comment':_0xe79f('0x11')},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xe79f('0x3')]}}; \ No newline at end of file +var _0x507f=['duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','seconds','exitAt','setDataValue'];(function(_0x532d78,_0x25b6a8){var _0x5990c4=function(_0x3f23fe){while(--_0x3f23fe){_0x532d78['push'](_0x532d78['shift']());}};_0x5990c4(++_0x25b6a8);}(_0x507f,0x6b));var _0xf507=function(_0x3fdf9d,_0x242c31){_0x3fdf9d=_0x3fdf9d-0x0;var _0x555e1f=_0x507f[_0x3fdf9d];return _0x555e1f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf507('0x0'));module[_0xf507('0x1')]={'channel':{'type':Sequelize[_0xf507('0x2')]},'membername':{'type':Sequelize[_0xf507('0x2')]},'interface':{'type':Sequelize[_0xf507('0x2')]},'type':{'type':Sequelize[_0xf507('0x2')],'defaultValue':_0xf507('0x3'),'comment':_0xf507('0x4')},'duration':{'type':Sequelize[_0xf507('0x5')]},'enterAt':{'type':Sequelize[_0xf507('0x6')]},'exitAt':{'type':Sequelize[_0xf507('0x6')],'set':function(_0x7a05d5){var _0x57f039=moment(_0x7a05d5);var _0x1dcc84=moment(this[_0xf507('0x7')](_0xf507('0x8')));var _0x5068bd=_0x57f039['diff'](_0x1dcc84,_0xf507('0x9'));this['setDataValue'](_0xf507('0xa'),_0x7a05d5);this[_0xf507('0xb')](_0xf507('0xc'),_0x5068bd>=0x0?_0x5068bd:null);}},'data1':{'type':Sequelize[_0xf507('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xf507('0x2')],'comment':_0xf507('0xd')},'data3':{'type':Sequelize[_0xf507('0x2')],'comment':_0xf507('0xe')},'data4':{'type':Sequelize[_0xf507('0x2')],'comment':_0xf507('0xf')},'data5':{'type':Sequelize[_0xf507('0x2')],'comment':_0xf507('0x10')},'role':{'type':Sequelize[_0xf507('0x2')]},'internal':{'type':Sequelize[_0xf507('0x5')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index b4ef954..a819629 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(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0x34e8,0x12c));var _0x834e=function(_0x549375,_0x520ca6){_0x549375=_0x549375-0x0;var _0x166f3f=_0x34e8[_0x549375];return _0x166f3f;};'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 _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xedd9,0xfc));var _0x9edd=function(_0x195a3b,_0x3b6193){_0x195a3b=_0x195a3b-0x0;var _0x29f57d=_0xedd9[_0x195a3b];return _0x29f57d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 42c846e..08ec8a7 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 _0x9505=['report_member','membername_interface','membername','interface','lodash','util','api','moment','bluebird','request-promise','path','./memberReport.attributes','exports'];(function(_0xf77fa6,_0x4c9df8){var _0x5bd317=function(_0x4af34a){while(--_0x4af34a){_0xf77fa6['push'](_0xf77fa6['shift']());}};_0x5bd317(++_0x4c9df8);}(_0x9505,0x1e5));var _0x5950=function(_0x5319d7,_0x17479d){_0x5319d7=_0x5319d7-0x0;var _0x2b3c51=_0x9505[_0x5319d7];return _0x2b3c51;};'use strict';var _=require(_0x5950('0x0'));var util=require(_0x5950('0x1'));var logger=require('../../config/logger')(_0x5950('0x2'));var moment=require(_0x5950('0x3'));var BPromise=require(_0x5950('0x4'));var rp=require(_0x5950('0x5'));var fs=require('fs');var path=require(_0x5950('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5950('0x7'));module[_0x5950('0x8')]=function(_0x3ac153,_0x3a5973){return _0x3ac153['define']('MemberReport',attributes,{'tableName':_0x5950('0x9'),'paranoid':![],'indexes':[{'name':_0x5950('0xa'),'fields':[_0x5950('0xb'),_0x5950('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x29dd=['define','MemberReport','report_member','membername','interface','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./memberReport.attributes','exports'];(function(_0x23bd95,_0x2247c3){var _0x385bb2=function(_0x2ace34){while(--_0x2ace34){_0x23bd95['push'](_0x23bd95['shift']());}};_0x385bb2(++_0x2247c3);}(_0x29dd,0x1d3));var _0xd29d=function(_0x315908,_0x76e8d8){_0x315908=_0x315908-0x0;var _0xd186c5=_0x29dd[_0x315908];return _0xd186c5;};'use strict';var _=require('lodash');var util=require(_0xd29d('0x0'));var logger=require(_0xd29d('0x1'))('api');var moment=require(_0xd29d('0x2'));var BPromise=require(_0xd29d('0x3'));var rp=require(_0xd29d('0x4'));var fs=require('fs');var path=require(_0xd29d('0x5'));var rimraf=require('rimraf');var config=require(_0xd29d('0x6'));var attributes=require(_0xd29d('0x7'));module[_0xd29d('0x8')]=function(_0x176588,_0x52b7f8){return _0x176588[_0xd29d('0x9')](_0xd29d('0xa'),attributes,{'tableName':_0xd29d('0xb'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xd29d('0xc'),_0xd29d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 69bf29b..e553b34 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 _0xdf70=['request','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetMemberReport','MemberReport','options','where','limit','include','map','model','attributes','body','raw','CreateMemberReport','update','UpdateMemberReport','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x4f240d,_0x13a89a){var _0x5b92cc=function(_0x33fb91){while(--_0x33fb91){_0x4f240d['push'](_0x4f240d['shift']());}};_0x5b92cc(++_0x13a89a);}(_0xdf70,0x86));var _0x0df7=function(_0x31c798,_0x2f1872){_0x31c798=_0x31c798-0x0;var _0x5e508d=_0xdf70[_0x31c798];return _0x5e508d;};'use strict';var _=require(_0x0df7('0x0'));var util=require(_0x0df7('0x1'));var moment=require(_0x0df7('0x2'));var BPromise=require('bluebird');var rs=require(_0x0df7('0x3'));var fs=require('fs');var Redis=require(_0x0df7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0df7('0x5'));var logger=require('../../config/logger')(_0x0df7('0x6'));var config=require(_0x0df7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0df7('0x8')][_0x0df7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42090d,_0x5c1a5b,_0x1f1680){return new BPromise(function(_0x392337,_0x44c4fb){return client[_0x0df7('0xa')](_0x42090d,_0x1f1680)[_0x0df7('0xb')](function(_0x411e73){logger['info'](_0x0df7('0xc'),_0x5c1a5b,_0x0df7('0xd'));logger[_0x0df7('0xe')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x5c1a5b,_0x0df7('0xd'),JSON[_0x0df7('0xf')](_0x411e73));if(_0x411e73[_0x0df7('0x10')]){if(_0x411e73['error'][_0x0df7('0x11')]===0x1f4){logger[_0x0df7('0x10')](_0x0df7('0xc'),_0x5c1a5b,_0x411e73['error'][_0x0df7('0x12')]);return _0x44c4fb(_0x411e73['error']['message']);}logger[_0x0df7('0x10')](_0x0df7('0xc'),_0x5c1a5b,_0x411e73[_0x0df7('0x10')][_0x0df7('0x12')]);return _0x392337(_0x411e73['error'][_0x0df7('0x12')]);}else{logger[_0x0df7('0x13')](_0x0df7('0xc'),_0x5c1a5b,_0x0df7('0xd'));_0x392337(_0x411e73[_0x0df7('0x14')]['message']);}})[_0x0df7('0x15')](function(_0x4161d1){logger['error'](_0x0df7('0xc'),_0x5c1a5b,_0x4161d1);_0x44c4fb(_0x4161d1);});});}exports[_0x0df7('0x16')]=function(_0xffad67){var _0x124582=this;return new Promise(function(_0x32b3bd,_0x29ac87){return db[_0x0df7('0x17')]['findAll']({'raw':_0xffad67[_0x0df7('0x18')]?_0xffad67[_0x0df7('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xffad67[_0x0df7('0x18')]?_0xffad67['options'][_0x0df7('0x19')]||null:null,'attributes':_0xffad67[_0x0df7('0x18')]?_0xffad67[_0x0df7('0x18')]['attributes']||null:null,'limit':_0xffad67['options']?_0xffad67[_0x0df7('0x18')][_0x0df7('0x1a')]||null:null,'include':_0xffad67[_0x0df7('0x18')]?_0xffad67['options'][_0x0df7('0x1b')]?_[_0x0df7('0x1c')](_0xffad67[_0x0df7('0x18')]['include'],function(_0x462cad){return{'model':db[_0x462cad[_0x0df7('0x1d')]],'as':_0x462cad['as'],'attributes':_0x462cad['attributes'],'include':_0x462cad[_0x0df7('0x1b')]?_[_0x0df7('0x1c')](_0x462cad[_0x0df7('0x1b')],function(_0x23f064){return{'model':db[_0x23f064['model']],'as':_0x23f064['as'],'attributes':_0x23f064[_0x0df7('0x1e')],'include':_0x23f064[_0x0df7('0x1b')]?_[_0x0df7('0x1c')](_0x23f064['include'],function(_0xd7b64b){return{'model':db[_0xd7b64b[_0x0df7('0x1d')]],'as':_0xd7b64b['as'],'attributes':_0xd7b64b['attributes']};}):[]};}):[]};}):[]:[]})[_0x0df7('0xb')](function(_0x4a6241){logger[_0x0df7('0x13')]('GetMemberReport',_0xffad67);logger[_0x0df7('0xe')](_0x0df7('0x16'),_0xffad67,JSON[_0x0df7('0xf')](_0x4a6241));_0x32b3bd(_0x4a6241);})[_0x0df7('0x15')](function(_0x1b5ce0){logger[_0x0df7('0x10')](_0x0df7('0x16'),_0x1b5ce0[_0x0df7('0x12')],_0xffad67);_0x29ac87(_0x124582[_0x0df7('0x10')](0x1f4,_0x1b5ce0[_0x0df7('0x12')]));});});};exports['CreateMemberReport']=function(_0x14d31c){var _0x1e88a9=this;return new Promise(function(_0x2f7ada,_0x19d002){return db[_0x0df7('0x17')]['create'](_0x14d31c[_0x0df7('0x1f')],{'raw':_0x14d31c[_0x0df7('0x18')]?_0x14d31c[_0x0df7('0x18')][_0x0df7('0x20')]===undefined?!![]:![]:!![]})[_0x0df7('0xb')](function(_0x14f399){logger[_0x0df7('0x13')](_0x0df7('0x21'),_0x14d31c);logger[_0x0df7('0xe')](_0x0df7('0x21'),_0x14d31c,JSON[_0x0df7('0xf')](_0x14f399));_0x2f7ada(_0x14f399);})[_0x0df7('0x15')](function(_0x4cd5d8){logger[_0x0df7('0x10')]('CreateMemberReport',_0x4cd5d8[_0x0df7('0x12')],_0x14d31c);_0x19d002(_0x1e88a9['error'](0x1f4,_0x4cd5d8[_0x0df7('0x12')]));});});};exports['UpdateMemberReport']=function(_0x4122ec){var _0x3cf43e=this;return new Promise(function(_0x371d5b,_0x47a9e3){return db[_0x0df7('0x17')][_0x0df7('0x22')](_0x4122ec[_0x0df7('0x1f')],{'raw':_0x4122ec[_0x0df7('0x18')]?_0x4122ec[_0x0df7('0x18')][_0x0df7('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4122ec[_0x0df7('0x18')]?_0x4122ec['options']['where']||null:null,'attributes':_0x4122ec['options']?_0x4122ec['options']['attributes']||null:null,'limit':_0x4122ec[_0x0df7('0x18')]?_0x4122ec['options']['limit']||null:null})['then'](function(_0x374dc1){logger[_0x0df7('0x13')](_0x0df7('0x23'),_0x4122ec);logger[_0x0df7('0xe')](_0x0df7('0x23'),_0x4122ec,JSON['stringify'](_0x374dc1));_0x371d5b(_0x374dc1);})[_0x0df7('0x15')](function(_0x29f940){logger['error'](_0x0df7('0x23'),_0x29f940[_0x0df7('0x12')],_0x4122ec);_0x47a9e3(_0x3cf43e[_0x0df7('0x10')](0x1f4,_0x29f940[_0x0df7('0x12')]));});});}; \ No newline at end of file +var _0x37cc=['http','request','then','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result','catch','findAll','options','raw','attributes','include','map','model','GetMemberReport','CreateMemberReport','MemberReport','body','UpdateMemberReport','update','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5ad00b,_0x22c334){var _0x2aab79=function(_0x999352){while(--_0x999352){_0x5ad00b['push'](_0x5ad00b['shift']());}};_0x2aab79(++_0x22c334);}(_0x37cc,0x185));var _0xc37c=function(_0x303251,_0x1cb467){_0x303251=_0x303251-0x0;var _0x558942=_0x37cc[_0x303251];return _0x558942;};'use strict';var _=require(_0xc37c('0x0'));var util=require(_0xc37c('0x1'));var moment=require(_0xc37c('0x2'));var BPromise=require(_0xc37c('0x3'));var rs=require(_0xc37c('0x4'));var fs=require('fs');var Redis=require(_0xc37c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc37c('0x6'))(_0xc37c('0x7'));var config=require(_0xc37c('0x8'));var jayson=require(_0xc37c('0x9'));var client=jayson[_0xc37c('0xa')][_0xc37c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd8f098,_0x1eaa97,_0x3c5c63){return new BPromise(function(_0x483c8d,_0x15a756){return client[_0xc37c('0xc')](_0xd8f098,_0x3c5c63)[_0xc37c('0xd')](function(_0x3526b5){logger[_0xc37c('0xe')]('MemberReport,\x20%s,\x20%s',_0x1eaa97,_0xc37c('0xf'));logger[_0xc37c('0x10')](_0xc37c('0x11'),_0x1eaa97,_0xc37c('0xf'),JSON[_0xc37c('0x12')](_0x3526b5));if(_0x3526b5[_0xc37c('0x13')]){if(_0x3526b5[_0xc37c('0x13')][_0xc37c('0x14')]===0x1f4){logger[_0xc37c('0x13')](_0xc37c('0x15'),_0x1eaa97,_0x3526b5[_0xc37c('0x13')]['message']);return _0x15a756(_0x3526b5['error'][_0xc37c('0x16')]);}logger[_0xc37c('0x13')](_0xc37c('0x15'),_0x1eaa97,_0x3526b5[_0xc37c('0x13')][_0xc37c('0x16')]);return _0x483c8d(_0x3526b5[_0xc37c('0x13')]['message']);}else{logger[_0xc37c('0xe')]('MemberReport,\x20%s,\x20%s',_0x1eaa97,_0xc37c('0xf'));_0x483c8d(_0x3526b5[_0xc37c('0x17')][_0xc37c('0x16')]);}})[_0xc37c('0x18')](function(_0x674ccf){logger['error']('MemberReport,\x20%s,\x20%s',_0x1eaa97,_0x674ccf);_0x15a756(_0x674ccf);});});}exports['GetMemberReport']=function(_0x2d6129){var _0x5c7bd2=this;return new Promise(function(_0x370c2f,_0x1f8679){return db['MemberReport'][_0xc37c('0x19')]({'raw':_0x2d6129[_0xc37c('0x1a')]?_0x2d6129[_0xc37c('0x1a')][_0xc37c('0x1b')]===undefined?!![]:![]:!![],'where':_0x2d6129['options']?_0x2d6129[_0xc37c('0x1a')]['where']||null:null,'attributes':_0x2d6129[_0xc37c('0x1a')]?_0x2d6129[_0xc37c('0x1a')][_0xc37c('0x1c')]||null:null,'limit':_0x2d6129[_0xc37c('0x1a')]?_0x2d6129[_0xc37c('0x1a')]['limit']||null:null,'include':_0x2d6129[_0xc37c('0x1a')]?_0x2d6129[_0xc37c('0x1a')][_0xc37c('0x1d')]?_[_0xc37c('0x1e')](_0x2d6129[_0xc37c('0x1a')][_0xc37c('0x1d')],function(_0x15a392){return{'model':db[_0x15a392[_0xc37c('0x1f')]],'as':_0x15a392['as'],'attributes':_0x15a392[_0xc37c('0x1c')],'include':_0x15a392[_0xc37c('0x1d')]?_[_0xc37c('0x1e')](_0x15a392[_0xc37c('0x1d')],function(_0x3076fc){return{'model':db[_0x3076fc['model']],'as':_0x3076fc['as'],'attributes':_0x3076fc[_0xc37c('0x1c')],'include':_0x3076fc[_0xc37c('0x1d')]?_[_0xc37c('0x1e')](_0x3076fc[_0xc37c('0x1d')],function(_0x53f062){return{'model':db[_0x53f062[_0xc37c('0x1f')]],'as':_0x53f062['as'],'attributes':_0x53f062[_0xc37c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc37c('0xd')](function(_0xbd5d3a){logger[_0xc37c('0xe')](_0xc37c('0x20'),_0x2d6129);logger[_0xc37c('0x10')](_0xc37c('0x20'),_0x2d6129,JSON['stringify'](_0xbd5d3a));_0x370c2f(_0xbd5d3a);})[_0xc37c('0x18')](function(_0x466094){logger[_0xc37c('0x13')](_0xc37c('0x20'),_0x466094[_0xc37c('0x16')],_0x2d6129);_0x1f8679(_0x5c7bd2[_0xc37c('0x13')](0x1f4,_0x466094[_0xc37c('0x16')]));});});};exports[_0xc37c('0x21')]=function(_0x2c59df){var _0x472d58=this;return new Promise(function(_0x224641,_0x169b27){return db[_0xc37c('0x22')]['create'](_0x2c59df[_0xc37c('0x23')],{'raw':_0x2c59df[_0xc37c('0x1a')]?_0x2c59df['options']['raw']===undefined?!![]:![]:!![]})[_0xc37c('0xd')](function(_0x3b9ac4){logger[_0xc37c('0xe')]('CreateMemberReport',_0x2c59df);logger[_0xc37c('0x10')]('CreateMemberReport',_0x2c59df,JSON[_0xc37c('0x12')](_0x3b9ac4));_0x224641(_0x3b9ac4);})[_0xc37c('0x18')](function(_0x58429b){logger[_0xc37c('0x13')](_0xc37c('0x21'),_0x58429b[_0xc37c('0x16')],_0x2c59df);_0x169b27(_0x472d58[_0xc37c('0x13')](0x1f4,_0x58429b[_0xc37c('0x16')]));});});};exports[_0xc37c('0x24')]=function(_0x445f07){var _0x5432fe=this;return new Promise(function(_0x5142bd,_0xef4b6c){return db[_0xc37c('0x22')][_0xc37c('0x25')](_0x445f07[_0xc37c('0x23')],{'raw':_0x445f07['options']?_0x445f07[_0xc37c('0x1a')][_0xc37c('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x445f07[_0xc37c('0x1a')]?_0x445f07['options'][_0xc37c('0x26')]||null:null,'attributes':_0x445f07[_0xc37c('0x1a')]?_0x445f07['options'][_0xc37c('0x1c')]||null:null,'limit':_0x445f07[_0xc37c('0x1a')]?_0x445f07['options'][_0xc37c('0x27')]||null:null})[_0xc37c('0xd')](function(_0x17dd56){logger[_0xc37c('0xe')](_0xc37c('0x24'),_0x445f07);logger[_0xc37c('0x10')](_0xc37c('0x24'),_0x445f07,JSON[_0xc37c('0x12')](_0x17dd56));_0x5142bd(_0x17dd56);})[_0xc37c('0x18')](function(_0x188f2c){logger[_0xc37c('0x13')](_0xc37c('0x24'),_0x188f2c[_0xc37c('0x16')],_0x445f07);_0xef4b6c(_0x5432fe[_0xc37c('0x13')](0x1f4,_0x188f2c[_0xc37c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 470e602..823820f 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 _0x8f5d=['express','fs-extra','../../components/auth/service','../../config/environment','./migration.controller','get','index','exports','multer','path','connect-timeout'];(function(_0x2f3b86,_0x1fffad){var _0x9741a0=function(_0x654b64){while(--_0x654b64){_0x2f3b86['push'](_0x2f3b86['shift']());}};_0x9741a0(++_0x1fffad);}(_0x8f5d,0xb8));var _0xd8f5=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x8f5d[_0x565ed7];return _0x183ad7;};'use strict';var multer=require(_0xd8f5('0x0'));var util=require('util');var path=require(_0xd8f5('0x1'));var timeout=require(_0xd8f5('0x2'));var express=require(_0xd8f5('0x3'));var router=express['Router']();var fs_extra=require(_0xd8f5('0x4'));var auth=require(_0xd8f5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd8f5('0x6'));var controller=require(_0xd8f5('0x7'));router[_0xd8f5('0x8')]('/',controller[_0xd8f5('0x9')]);module[_0xd8f5('0xa')]=router; \ No newline at end of file +var _0x8876=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./migration.controller','get'];(function(_0xa5a920,_0x2d8772){var _0x596618=function(_0x5eab42){while(--_0x5eab42){_0xa5a920['push'](_0xa5a920['shift']());}};_0x596618(++_0x2d8772);}(_0x8876,0xa0));var _0x6887=function(_0x224090,_0x38f7e4){_0x224090=_0x224090-0x0;var _0xd97361=_0x8876[_0x224090];return _0xd97361;};'use strict';var multer=require('multer');var util=require(_0x6887('0x0'));var path=require(_0x6887('0x1'));var timeout=require(_0x6887('0x2'));var express=require(_0x6887('0x3'));var router=express[_0x6887('0x4')]();var fs_extra=require(_0x6887('0x5'));var auth=require(_0x6887('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6887('0x7'));var controller=require(_0x6887('0x8'));router[_0x6887('0x9')]('/',controller['index']);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 3e669ff..e159088 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 _0x4fd1=['sequelize','exports','version'];(function(_0x7870ff,_0x21c985){var _0x5d66d6=function(_0x411e71){while(--_0x411e71){_0x7870ff['push'](_0x7870ff['shift']());}};_0x5d66d6(++_0x21c985);}(_0x4fd1,0x1ce));var _0x14fd=function(_0x37e466,_0x4a096e){_0x37e466=_0x37e466-0x0;var _0x2007f7=_0x4fd1[_0x37e466];return _0x2007f7;};'use strict';var Sequelize=require(_0x14fd('0x0'));module[_0x14fd('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x14fd('0x2')}}; \ No newline at end of file +var _0x10fa=['sequelize','exports','STRING','version'];(function(_0x28b9fa,_0x25f40a){var _0x1beb5d=function(_0x56dc14){while(--_0x56dc14){_0x28b9fa['push'](_0x28b9fa['shift']());}};_0x1beb5d(++_0x25f40a);}(_0x10fa,0x144));var _0xa10f=function(_0x46e087,_0x3d199a){_0x46e087=_0x46e087-0x0;var _0x57f4ce=_0x10fa[_0x46e087];return _0x57f4ce;};'use strict';var Sequelize=require(_0xa10f('0x0'));module[_0xa10f('0x1')]={'version':{'type':Sequelize[_0xa10f('0x2')],'unique':_0xa10f('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 1a519be..1ade541 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 _0x5d10=['includeAll','include','rows','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options'];(function(_0x12be00,_0x9eb6a1){var _0x591d3d=function(_0x2df653){while(--_0x2df653){_0x12be00['push'](_0x12be00['shift']());}};_0x591d3d(++_0x9eb6a1);}(_0x5d10,0x8c));var _0x05d1=function(_0x1cb825,_0x909dc6){_0x1cb825=_0x1cb825-0x0;var _0x596088=_0x5d10[_0x1cb825];return _0x596088;};'use strict';var emlformat=require(_0x05d1('0x0'));var rimraf=require(_0x05d1('0x1'));var zipdir=require(_0x05d1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x05d1('0x3'));var moment=require(_0x05d1('0x4'));var BPromise=require(_0x05d1('0x5'));var Mustache=require(_0x05d1('0x6'));var util=require(_0x05d1('0x7'));var path=require('path');var sox=require(_0x05d1('0x8'));var csv=require(_0x05d1('0x9'));var ejs=require(_0x05d1('0xa'));var fs=require('fs');var fs_extra=require(_0x05d1('0xb'));var _=require(_0x05d1('0xc'));var squel=require(_0x05d1('0xd'));var crypto=require(_0x05d1('0xe'));var jsforce=require(_0x05d1('0xf'));var deskjs=require(_0x05d1('0x10'));var toCsv=require(_0x05d1('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x05d1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x05d1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x05d1('0x13'));var logger=require(_0x05d1('0x14'))(_0x05d1('0x15'));var utils=require(_0x05d1('0x16'));var config=require(_0x05d1('0x17'));var licenseUtil=require(_0x05d1('0x18'));var db=require(_0x05d1('0x19'))['db'];function respondWithStatusCode(_0x22700f,_0x50f50f){_0x50f50f=_0x50f50f||0xcc;return function(_0x60f64c){if(_0x60f64c){return _0x22700f[_0x05d1('0x1a')](_0x50f50f);}return _0x22700f[_0x05d1('0x1b')](_0x50f50f)[_0x05d1('0x1c')]();};}function respondWithResult(_0x4f2c25,_0x3d1dd8){_0x3d1dd8=_0x3d1dd8||0xc8;return function(_0x4a4f97){if(_0x4a4f97){return _0x4f2c25['status'](_0x3d1dd8)['json'](_0x4a4f97);}};}function respondWithFilteredResult(_0x33e51a,_0x44b13e){return function(_0x3769f7){if(_0x3769f7){var _0x248a01=typeof _0x44b13e[_0x05d1('0x1d')]==='undefined'&&typeof _0x44b13e[_0x05d1('0x1e')]===_0x05d1('0x1f');var _0x3f690c=_0x3769f7[_0x05d1('0x20')];var _0x3598fc=_0x248a01?0x0:_0x44b13e[_0x05d1('0x1d')];var _0x2cb212=_0x248a01?_0x3769f7[_0x05d1('0x20')]:_0x44b13e[_0x05d1('0x1d')]+_0x44b13e['limit'];var _0x34dc41;if(_0x2cb212>=_0x3f690c){_0x2cb212=_0x3f690c;_0x34dc41=0xc8;}else{_0x34dc41=0xce;}_0x33e51a[_0x05d1('0x1b')](_0x34dc41);return _0x33e51a['set'](_0x05d1('0x21'),_0x3598fc+'-'+_0x2cb212+'/'+_0x3f690c)['json'](_0x3769f7);}return null;};}function patchUpdates(_0x1e8bb7){return function(_0x12e17a){try{jsonpatch[_0x05d1('0x22')](_0x12e17a,_0x1e8bb7,!![]);}catch(_0x577a99){return BPromise[_0x05d1('0x23')](_0x577a99);}return _0x12e17a['save']();};}function saveUpdates(_0x2f96c5,_0x5b21ad){return function(_0x4c64c3){if(_0x4c64c3){return _0x4c64c3['update'](_0x2f96c5)[_0x05d1('0x24')](function(_0x1c615a){return _0x1c615a;});}return null;};}function removeEntity(_0x331726,_0x514e51){return function(_0x10ecd8){if(_0x10ecd8){return _0x10ecd8[_0x05d1('0x25')]()[_0x05d1('0x24')](function(){_0x331726[_0x05d1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33a656,_0x1ba352){return function(_0x7ea5b7){if(!_0x7ea5b7){_0x33a656[_0x05d1('0x1a')](0x194);}return _0x7ea5b7;};}function handleError(_0x76480b,_0x2d3050){_0x2d3050=_0x2d3050||0x1f4;return function(_0x12806){logger[_0x05d1('0x26')](_0x12806[_0x05d1('0x27')]);if(_0x12806['name']){delete _0x12806[_0x05d1('0x28')];}_0x76480b[_0x05d1('0x1b')](_0x2d3050)[_0x05d1('0x29')](_0x12806);};}exports[_0x05d1('0x2a')]=function(_0x5441b5,_0x127db5){var _0x38beef={},_0x4ecece={},_0x2d4b62={'count':0x0,'rows':[]};var _0x5ae2f3=_[_0x05d1('0x2b')](db[_0x05d1('0x2c')][_0x05d1('0x2d')],function(_0x5a086c){return{'name':_0x5a086c[_0x05d1('0x2e')],'type':_0x5a086c['type'][_0x05d1('0x2f')]};});_0x4ecece[_0x05d1('0x30')]=_[_0x05d1('0x2b')](_0x5ae2f3,_0x05d1('0x28'));_0x4ecece[_0x05d1('0x31')]=_[_0x05d1('0x32')](_0x5441b5[_0x05d1('0x31')]);_0x4ecece[_0x05d1('0x33')]=_[_0x05d1('0x34')](_0x4ecece['model'],_0x4ecece[_0x05d1('0x31')]);_0x38beef[_0x05d1('0x35')]=_[_0x05d1('0x34')](_0x4ecece[_0x05d1('0x30')],qs['fields'](_0x5441b5[_0x05d1('0x31')]['fields']));_0x38beef['attributes']=_0x38beef[_0x05d1('0x35')]['length']?_0x38beef[_0x05d1('0x35')]:_0x4ecece[_0x05d1('0x30')];if(!_0x5441b5[_0x05d1('0x31')][_0x05d1('0x36')](_0x05d1('0x37'))){_0x38beef[_0x05d1('0x1e')]=qs[_0x05d1('0x1e')](_0x5441b5[_0x05d1('0x31')]['limit']);_0x38beef[_0x05d1('0x1d')]=qs[_0x05d1('0x1d')](_0x5441b5[_0x05d1('0x31')][_0x05d1('0x1d')]);}_0x38beef[_0x05d1('0x38')]=qs[_0x05d1('0x39')](_0x5441b5['query']['sort']);_0x38beef[_0x05d1('0x3a')]=qs[_0x05d1('0x33')](_['pick'](_0x5441b5['query'],_0x4ecece[_0x05d1('0x33')]),_0x5ae2f3);if(_0x5441b5['query']['filter']){_0x38beef[_0x05d1('0x3a')]=_['merge'](_0x38beef['where'],{'$or':_[_0x05d1('0x2b')](_0x5ae2f3,function(_0x20e646){if(_0x20e646[_0x05d1('0x3b')]!==_0x05d1('0x3c')){var _0x257c5d={};_0x257c5d[_0x20e646[_0x05d1('0x28')]]={'$like':'%'+_0x5441b5[_0x05d1('0x31')][_0x05d1('0x3d')]+'%'};return _0x257c5d;}})});}_0x38beef=_[_0x05d1('0x3e')]({},_0x38beef,_0x5441b5[_0x05d1('0x3f')]);var _0x56d481={'where':_0x38beef[_0x05d1('0x3a')]};return db[_0x05d1('0x2c')][_0x05d1('0x20')](_0x56d481)[_0x05d1('0x24')](function(_0x4599b4){_0x2d4b62[_0x05d1('0x20')]=_0x4599b4;if(_0x5441b5[_0x05d1('0x31')][_0x05d1('0x40')]){_0x38beef[_0x05d1('0x41')]=[{'all':!![]}];}return db['Migration']['findAll'](_0x38beef);})['then'](function(_0x2cd57d){_0x2d4b62[_0x05d1('0x42')]=_0x2cd57d;return _0x2d4b62;})['then'](respondWithFilteredResult(_0x127db5,_0x38beef))[_0x05d1('0x43')](handleError(_0x127db5,null));}; \ No newline at end of file +var _0xe83d=['error','name','send','Migration','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','sendStatus'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0xe83d,0x1b4));var _0xde83=function(_0x2c57f4,_0x264787){_0x2c57f4=_0x2c57f4-0x0;var _0x36752b=_0xe83d[_0x2c57f4];return _0x36752b;};'use strict';var emlformat=require(_0xde83('0x0'));var rimraf=require(_0xde83('0x1'));var zipdir=require(_0xde83('0x2'));var jsonpatch=require(_0xde83('0x3'));var rp=require(_0xde83('0x4'));var moment=require('moment');var BPromise=require(_0xde83('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xde83('0x6'));var sox=require('sox');var csv=require(_0xde83('0x7'));var ejs=require(_0xde83('0x8'));var fs=require('fs');var fs_extra=require(_0xde83('0x9'));var _=require(_0xde83('0xa'));var squel=require(_0xde83('0xb'));var crypto=require('crypto');var jsforce=require(_0xde83('0xc'));var deskjs=require(_0xde83('0xd'));var toCsv=require('to-csv');var querystring=require(_0xde83('0xe'));var Papa=require(_0xde83('0xf'));var Redis=require(_0xde83('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xde83('0x11'));var as=require(_0xde83('0x12'));var hardwareService=require(_0xde83('0x13'));var logger=require(_0xde83('0x14'))('api');var utils=require(_0xde83('0x15'));var config=require(_0xde83('0x16'));var licenseUtil=require(_0xde83('0x17'));var db=require(_0xde83('0x18'))['db'];function respondWithStatusCode(_0x5af0b8,_0x1cf9e6){_0x1cf9e6=_0x1cf9e6||0xcc;return function(_0x5e262a){if(_0x5e262a){return _0x5af0b8['sendStatus'](_0x1cf9e6);}return _0x5af0b8[_0xde83('0x19')](_0x1cf9e6)[_0xde83('0x1a')]();};}function respondWithResult(_0x1259fa,_0x25bcdd){_0x25bcdd=_0x25bcdd||0xc8;return function(_0x1afc19){if(_0x1afc19){return _0x1259fa[_0xde83('0x19')](_0x25bcdd)[_0xde83('0x1b')](_0x1afc19);}};}function respondWithFilteredResult(_0x5a01ea,_0x47e1b4){return function(_0x3b15b2){if(_0x3b15b2){var _0x1ae1e0=typeof _0x47e1b4['offset']===_0xde83('0x1c')&&typeof _0x47e1b4[_0xde83('0x1d')]===_0xde83('0x1c');var _0x1422b7=_0x3b15b2[_0xde83('0x1e')];var _0x1e2285=_0x1ae1e0?0x0:_0x47e1b4['offset'];var _0x464cf1=_0x1ae1e0?_0x3b15b2[_0xde83('0x1e')]:_0x47e1b4[_0xde83('0x1f')]+_0x47e1b4['limit'];var _0x1cb142;if(_0x464cf1>=_0x1422b7){_0x464cf1=_0x1422b7;_0x1cb142=0xc8;}else{_0x1cb142=0xce;}_0x5a01ea[_0xde83('0x19')](_0x1cb142);return _0x5a01ea[_0xde83('0x20')](_0xde83('0x21'),_0x1e2285+'-'+_0x464cf1+'/'+_0x1422b7)[_0xde83('0x1b')](_0x3b15b2);}return null;};}function patchUpdates(_0x2d9691){return function(_0x32a557){try{jsonpatch[_0xde83('0x22')](_0x32a557,_0x2d9691,!![]);}catch(_0x5bec98){return BPromise[_0xde83('0x23')](_0x5bec98);}return _0x32a557[_0xde83('0x24')]();};}function saveUpdates(_0x469983,_0x2e2ab8){return function(_0xda5f26){if(_0xda5f26){return _0xda5f26['update'](_0x469983)[_0xde83('0x25')](function(_0x2b4972){return _0x2b4972;});}return null;};}function removeEntity(_0xe216d6,_0x1acca0){return function(_0x46d0d3){if(_0x46d0d3){return _0x46d0d3[_0xde83('0x26')]()[_0xde83('0x25')](function(){_0xe216d6[_0xde83('0x19')](0xcc)[_0xde83('0x1a')]();});}};}function handleEntityNotFound(_0x5c755c,_0x50f983){return function(_0x7e8012){if(!_0x7e8012){_0x5c755c[_0xde83('0x27')](0x194);}return _0x7e8012;};}function handleError(_0x2d3ee,_0x4c0de9){_0x4c0de9=_0x4c0de9||0x1f4;return function(_0x26b02a){logger[_0xde83('0x28')](_0x26b02a['stack']);if(_0x26b02a[_0xde83('0x29')]){delete _0x26b02a[_0xde83('0x29')];}_0x2d3ee[_0xde83('0x19')](_0x4c0de9)[_0xde83('0x2a')](_0x26b02a);};}exports['index']=function(_0x369396,_0x11437f){var _0x5bb3c7={},_0x2c2285={},_0x2d6dbd={'count':0x0,'rows':[]};var _0x3dd0b7=_['map'](db[_0xde83('0x2b')][_0xde83('0x2c')],function(_0x5115cc){return{'name':_0x5115cc[_0xde83('0x2d')],'type':_0x5115cc[_0xde83('0x2e')]['key']};});_0x2c2285[_0xde83('0x2f')]=_[_0xde83('0x30')](_0x3dd0b7,_0xde83('0x29'));_0x2c2285[_0xde83('0x31')]=_['keys'](_0x369396[_0xde83('0x31')]);_0x2c2285[_0xde83('0x32')]=_[_0xde83('0x33')](_0x2c2285[_0xde83('0x2f')],_0x2c2285[_0xde83('0x31')]);_0x5bb3c7[_0xde83('0x34')]=_['intersection'](_0x2c2285['model'],qs['fields'](_0x369396['query'][_0xde83('0x35')]));_0x5bb3c7[_0xde83('0x34')]=_0x5bb3c7['attributes'][_0xde83('0x36')]?_0x5bb3c7['attributes']:_0x2c2285[_0xde83('0x2f')];if(!_0x369396[_0xde83('0x31')][_0xde83('0x37')](_0xde83('0x38'))){_0x5bb3c7[_0xde83('0x1d')]=qs['limit'](_0x369396[_0xde83('0x31')]['limit']);_0x5bb3c7['offset']=qs[_0xde83('0x1f')](_0x369396[_0xde83('0x31')][_0xde83('0x1f')]);}_0x5bb3c7[_0xde83('0x39')]=qs[_0xde83('0x3a')](_0x369396['query'][_0xde83('0x3a')]);_0x5bb3c7[_0xde83('0x3b')]=qs['filters'](_[_0xde83('0x3c')](_0x369396[_0xde83('0x31')],_0x2c2285[_0xde83('0x32')]),_0x3dd0b7);if(_0x369396['query'][_0xde83('0x3d')]){_0x5bb3c7[_0xde83('0x3b')]=_[_0xde83('0x3e')](_0x5bb3c7[_0xde83('0x3b')],{'$or':_[_0xde83('0x30')](_0x3dd0b7,function(_0x2191e2){if(_0x2191e2[_0xde83('0x2e')]!==_0xde83('0x3f')){var _0x5819ac={};_0x5819ac[_0x2191e2[_0xde83('0x29')]]={'$like':'%'+_0x369396[_0xde83('0x31')][_0xde83('0x3d')]+'%'};return _0x5819ac;}})});}_0x5bb3c7=_['merge']({},_0x5bb3c7,_0x369396['options']);var _0xe36e11={'where':_0x5bb3c7[_0xde83('0x3b')]};return db[_0xde83('0x2b')]['count'](_0xe36e11)[_0xde83('0x25')](function(_0x182a4c){_0x2d6dbd['count']=_0x182a4c;if(_0x369396[_0xde83('0x31')][_0xde83('0x40')]){_0x5bb3c7['include']=[{'all':!![]}];}return db[_0xde83('0x2b')][_0xde83('0x41')](_0x5bb3c7);})[_0xde83('0x25')](function(_0x3998c2){_0x2d6dbd[_0xde83('0x42')]=_0x3998c2;return _0x2d6dbd;})[_0xde83('0x25')](respondWithFilteredResult(_0x11437f,_0x5bb3c7))[_0xde83('0x43')](handleError(_0x11437f,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index a4fbbef..6b2ae73 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 _0x1c16=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','Migration','../../config/logger'];(function(_0x2bcc84,_0x11ede9){var _0x4e0c74=function(_0x1196c7){while(--_0x1196c7){_0x2bcc84['push'](_0x2bcc84['shift']());}};_0x4e0c74(++_0x11ede9);}(_0x1c16,0x1d5));var _0x61c1=function(_0x20e555,_0x40aea6){_0x20e555=_0x20e555-0x0;var _0x182077=_0x1c16[_0x20e555];return _0x182077;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x61c1('0x0'))(_0x61c1('0x1'));var moment=require(_0x61c1('0x2'));var BPromise=require(_0x61c1('0x3'));var rp=require(_0x61c1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x61c1('0x5'));var config=require(_0x61c1('0x6'));var attributes=require('./migration.attributes');module[_0x61c1('0x7')]=function(_0x136f70,_0x1cef43){return _0x136f70[_0x61c1('0x8')](_0x61c1('0x9'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8dbc=['rimraf','./migration.attributes','exports','define','migrations','util','../../config/logger','api'];(function(_0x51e347,_0x1b565a){var _0x49ab46=function(_0x5962cf){while(--_0x5962cf){_0x51e347['push'](_0x51e347['shift']());}};_0x49ab46(++_0x1b565a);}(_0x8dbc,0x105));var _0xc8db=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x8dbc[_0x1d9aa0];return _0x226868;};'use strict';var _=require('lodash');var util=require(_0xc8db('0x0'));var logger=require(_0xc8db('0x1'))(_0xc8db('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc8db('0x3'));var config=require('../../config/environment');var attributes=require(_0xc8db('0x4'));module[_0xc8db('0x5')]=function(_0xad015,_0x3bf7b8){return _0xad015[_0xc8db('0x6')]('Migration',attributes,{'tableName':_0xc8db('0x7'),'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 4927ef7..7bbe927 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 _0xb575=['bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0x22369a,_0x100d86){var _0x5d0ae9=function(_0x4c97e7){while(--_0x4c97e7){_0x22369a['push'](_0x22369a['shift']());}};_0x5d0ae9(++_0x100d86);}(_0xb575,0xda));var _0x5b57=function(_0x1c26e7,_0x39c7d6){_0x1c26e7=_0x1c26e7-0x0;var _0x3b5dfe=_0xb575[_0x1c26e7];return _0x3b5dfe;};'use strict';var _=require(_0x5b57('0x0'));var util=require(_0x5b57('0x1'));var moment=require('moment');var BPromise=require(_0x5b57('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5b57('0x3'));var logger=require(_0x5b57('0x4'))('rpc');var config=require(_0x5b57('0x5'));var jayson=require(_0x5b57('0x6'));var client=jayson[_0x5b57('0x7')][_0x5b57('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x672beb,_0x5d223d,_0x4232d0){return new BPromise(function(_0x5dd0c7,_0x2f9789){return client[_0x5b57('0x9')](_0x672beb,_0x4232d0)[_0x5b57('0xa')](function(_0x49ce3a){logger[_0x5b57('0xb')](_0x5b57('0xc'),_0x5d223d,_0x5b57('0xd'));logger['debug'](_0x5b57('0xe'),_0x5d223d,_0x5b57('0xd'),JSON['stringify'](_0x49ce3a));if(_0x49ce3a['error']){if(_0x49ce3a[_0x5b57('0xf')][_0x5b57('0x10')]===0x1f4){logger[_0x5b57('0xf')](_0x5b57('0xc'),_0x5d223d,_0x49ce3a[_0x5b57('0xf')][_0x5b57('0x11')]);return _0x2f9789(_0x49ce3a[_0x5b57('0xf')][_0x5b57('0x11')]);}logger[_0x5b57('0xf')](_0x5b57('0xc'),_0x5d223d,_0x49ce3a['error'][_0x5b57('0x11')]);return _0x5dd0c7(_0x49ce3a[_0x5b57('0xf')][_0x5b57('0x11')]);}else{logger['info'](_0x5b57('0xc'),_0x5d223d,_0x5b57('0xd'));_0x5dd0c7(_0x49ce3a[_0x5b57('0x12')][_0x5b57('0x11')]);}})[_0x5b57('0x13')](function(_0x1e7cc0){logger[_0x5b57('0xf')](_0x5b57('0xc'),_0x5d223d,_0x1e7cc0);_0x2f9789(_0x1e7cc0);});});} \ No newline at end of file +var _0xd110=['error','code','message','Migration,\x20%s,\x20%s','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5c177d,_0x53103d){var _0x17337a=function(_0x7974d2){while(--_0x7974d2){_0x5c177d['push'](_0x5c177d['shift']());}};_0x17337a(++_0x53103d);}(_0xd110,0x1e8));var _0x0d11=function(_0x57f8fd,_0x74c327){_0x57f8fd=_0x57f8fd-0x0;var _0x4fa11f=_0xd110[_0x57f8fd];return _0x4fa11f;};'use strict';var _=require(_0x0d11('0x0'));var util=require(_0x0d11('0x1'));var moment=require(_0x0d11('0x2'));var BPromise=require('bluebird');var rs=require(_0x0d11('0x3'));var fs=require('fs');var Redis=require(_0x0d11('0x4'));var db=require(_0x0d11('0x5'))['db'];var utils=require(_0x0d11('0x6'));var logger=require(_0x0d11('0x7'))(_0x0d11('0x8'));var config=require(_0x0d11('0x9'));var jayson=require(_0x0d11('0xa'));var client=jayson['client'][_0x0d11('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a889c,_0x33c46e,_0x4f3f3f){return new BPromise(function(_0x47a493,_0x3f9f5a){return client[_0x0d11('0xc')](_0x5a889c,_0x4f3f3f)[_0x0d11('0xd')](function(_0x4c6a59){logger[_0x0d11('0xe')]('Migration,\x20%s,\x20%s',_0x33c46e,_0x0d11('0xf'));logger['debug'](_0x0d11('0x10'),_0x33c46e,_0x0d11('0xf'),JSON[_0x0d11('0x11')](_0x4c6a59));if(_0x4c6a59[_0x0d11('0x12')]){if(_0x4c6a59['error'][_0x0d11('0x13')]===0x1f4){logger[_0x0d11('0x12')]('Migration,\x20%s,\x20%s',_0x33c46e,_0x4c6a59[_0x0d11('0x12')][_0x0d11('0x14')]);return _0x3f9f5a(_0x4c6a59[_0x0d11('0x12')]['message']);}logger[_0x0d11('0x12')](_0x0d11('0x15'),_0x33c46e,_0x4c6a59['error'][_0x0d11('0x14')]);return _0x47a493(_0x4c6a59[_0x0d11('0x12')][_0x0d11('0x14')]);}else{logger[_0x0d11('0xe')](_0x0d11('0x15'),_0x33c46e,'request\x20sent');_0x47a493(_0x4c6a59['result'][_0x0d11('0x14')]);}})['catch'](function(_0x46aa4f){logger[_0x0d11('0x12')]('Migration,\x20%s,\x20%s',_0x33c46e,_0x46aa4f);_0x3f9f5a(_0x46aa4f);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 8bcd5f4..bd3b642 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 _0xb5bf=['update','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','index','/:id','isAuthenticated','show','post'];(function(_0x3f8743,_0x33973f){var _0x1f844c=function(_0x568841){while(--_0x568841){_0x3f8743['push'](_0x3f8743['shift']());}};_0x1f844c(++_0x33973f);}(_0xb5bf,0x1d7));var _0xfb5b=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xb5bf[_0x2235bf];return _0x4c3a64;};'use strict';var multer=require(_0xfb5b('0x0'));var util=require(_0xfb5b('0x1'));var path=require(_0xfb5b('0x2'));var timeout=require('connect-timeout');var express=require(_0xfb5b('0x3'));var router=express['Router']();var fs_extra=require(_0xfb5b('0x4'));var auth=require(_0xfb5b('0x5'));var interaction=require(_0xfb5b('0x6'));var config=require(_0xfb5b('0x7'));var controller=require(_0xfb5b('0x8'));router[_0xfb5b('0x9')]('/',auth['isAuthenticated'](),controller[_0xfb5b('0xa')]);router[_0xfb5b('0x9')](_0xfb5b('0xb'),auth[_0xfb5b('0xc')](),controller[_0xfb5b('0xd')]);router[_0xfb5b('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xfb5b('0xb'),auth['isAuthenticated'](),controller[_0xfb5b('0xf')]);router['delete']('/:id',auth[_0xfb5b('0xc')](),controller[_0xfb5b('0x10')]);module[_0xfb5b('0x11')]=router; \ No newline at end of file +var _0x9bd9=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./network.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports'];(function(_0x4ccfc6,_0x611f5d){var _0x47792e=function(_0x5afc7c){while(--_0x5afc7c){_0x4ccfc6['push'](_0x4ccfc6['shift']());}};_0x47792e(++_0x611f5d);}(_0x9bd9,0x1a4));var _0x99bd=function(_0x40c043,_0x1d064e){_0x40c043=_0x40c043-0x0;var _0x5c2c8d=_0x9bd9[_0x40c043];return _0x5c2c8d;};'use strict';var multer=require(_0x99bd('0x0'));var util=require(_0x99bd('0x1'));var path=require(_0x99bd('0x2'));var timeout=require(_0x99bd('0x3'));var express=require(_0x99bd('0x4'));var router=express[_0x99bd('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x99bd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x99bd('0x7'));var controller=require(_0x99bd('0x8'));router['get']('/',auth[_0x99bd('0x9')](),controller[_0x99bd('0xa')]);router[_0x99bd('0xb')](_0x99bd('0xc'),auth[_0x99bd('0x9')](),controller[_0x99bd('0xd')]);router[_0x99bd('0xe')]('/',auth[_0x99bd('0x9')](),controller[_0x99bd('0xf')]);router[_0x99bd('0x10')](_0x99bd('0xc'),auth[_0x99bd('0x9')](),controller[_0x99bd('0x11')]);router[_0x99bd('0x12')]('/:id',auth[_0x99bd('0x9')](),controller['destroy']);module[_0x99bd('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index c19e700..83643ef 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 _0x882f=['externip','stun','turn','STRING','sequelize','ENUM'];(function(_0x12966b,_0x30d9b9){var _0x5c7b4b=function(_0x4d6609){while(--_0x4d6609){_0x12966b['push'](_0x12966b['shift']());}};_0x5c7b4b(++_0x30d9b9);}(_0x882f,0xee));var _0xf882=function(_0x508acd,_0x852c77){_0x508acd=_0x508acd-0x0;var _0x4e8524=_0x882f[_0x508acd];return _0x4e8524;};'use strict';var Sequelize=require(_0xf882('0x0'));module['exports']={'type':{'type':Sequelize[_0xf882('0x1')]('localnet',_0xf882('0x2'),_0xf882('0x3'),_0xf882('0x4'))},'value':{'type':Sequelize[_0xf882('0x5')]},'username':{'type':Sequelize[_0xf882('0x5')]},'password':{'type':Sequelize[_0xf882('0x5')]}}; \ No newline at end of file +var _0x4541=['turn','STRING','exports','stun'];(function(_0x5a9776,_0x4b5ab3){var _0x454edb=function(_0x4116ae){while(--_0x4116ae){_0x5a9776['push'](_0x5a9776['shift']());}};_0x454edb(++_0x4b5ab3);}(_0x4541,0xfe));var _0x1454=function(_0x2f46f5,_0x1fe332){_0x2f46f5=_0x2f46f5-0x0;var _0x30a2bd=_0x4541[_0x2f46f5];return _0x30a2bd;};'use strict';var Sequelize=require('sequelize');module[_0x1454('0x0')]={'type':{'type':Sequelize['ENUM']('localnet','externip',_0x1454('0x1'),_0x1454('0x2'))},'value':{'type':Sequelize[_0x1454('0x3')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index cb58fd4..61d9468 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 _0x5ab2=['/etc/asterisk/stun_xcally.conf','lodash','../../components/parsers/qs','api','jayson/promise','client','http','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','offset','limit','undefined','count','set','Content-Range','json','update','destroy','end','stack','name','send','index','map','Network','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','findAll','then','rows','show','params','length','include','find','create','body','type','toUpperCase','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','res_stun_monitor.so','TURN','readFileSync','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so'];(function(_0x309051,_0x8c0738){var _0x37f311=function(_0x1540e2){while(--_0x1540e2){_0x309051['push'](_0x309051['shift']());}};_0x37f311(++_0x8c0738);}(_0x5ab2,0x1ed));var _0x25ab=function(_0x23f624,_0x43bce3){_0x23f624=_0x23f624-0x0;var _0x4bf6f9=_0x5ab2[_0x23f624];return _0x4bf6f9;};'use strict';var util=require('util');var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x25ab('0x0'));var qs=require(_0x25ab('0x1'));var logger=require('../../config/logger')(_0x25ab('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x25ab('0x3'));var client=jayson[_0x25ab('0x4')][_0x25ab('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x436d82,_0x41c00e,_0x366be5,_0x411d44){return new Promise(function(_0x31b2fd,_0x3be0cf){var _0xb90c7e=_0x411d44||client;return _0xb90c7e['request'](_0x436d82,_0x366be5)['then'](function(_0x4ed0a6){logger[_0x25ab('0x6')](_0x25ab('0x7'),_0x41c00e,'request\x20sent');logger[_0x25ab('0x8')](_0x25ab('0x9'),_0x41c00e,_0x25ab('0xa'),JSON[_0x25ab('0xb')](_0x4ed0a6));if(_0x4ed0a6[_0x25ab('0xc')]){if(_0x4ed0a6[_0x25ab('0xc')][_0x25ab('0xd')]===0x1f4){logger[_0x25ab('0xc')](_0x25ab('0x7'),_0x41c00e,_0x4ed0a6[_0x25ab('0xc')][_0x25ab('0xe')]);return _0x3be0cf(_0x4ed0a6[_0x25ab('0xc')][_0x25ab('0xe')]);}logger['error'](_0x25ab('0x7'),_0x41c00e,_0x4ed0a6[_0x25ab('0xc')]['message']);return _0x31b2fd(_0x4ed0a6[_0x25ab('0xc')][_0x25ab('0xe')]);}else{logger['info'](_0x25ab('0x7'),_0x41c00e,_0x25ab('0xa'));_0x31b2fd(_0x4ed0a6[_0x25ab('0xf')]['message']);}})[_0x25ab('0x10')](function(_0x126bb7){logger['error']('Network,\x20%s,\x20%s',_0x41c00e,_0x126bb7);_0x3be0cf(_0x126bb7);});});}function respondWithResult(_0x4d2929,_0x4b8101){_0x4b8101=_0x4b8101||0xc8;return function(_0x2ad2d6){if(_0x2ad2d6){return _0x4d2929[_0x25ab('0x11')](_0x4b8101)['json'](_0x2ad2d6);}};}function respondWithFilteredResult(_0x21d156,_0x4b95fd){return function(_0x1883be){if(_0x1883be){var _0x26d2d8=typeof _0x4b95fd[_0x25ab('0x12')]==='undefined'&&typeof _0x4b95fd[_0x25ab('0x13')]===_0x25ab('0x14');var _0x39dae1=_0x1883be[_0x25ab('0x15')];var _0x448ae8=_0x26d2d8?0x0:_0x4b95fd['offset'];var _0x2fca5f=_0x26d2d8?_0x1883be[_0x25ab('0x15')]:_0x4b95fd[_0x25ab('0x12')]+_0x4b95fd['limit'];var _0x1f629f;if(_0x2fca5f>=_0x39dae1){_0x2fca5f=_0x39dae1;_0x1f629f=0xc8;}else{_0x1f629f=0xce;}_0x21d156['status'](_0x1f629f);return _0x21d156[_0x25ab('0x16')](_0x25ab('0x17'),_0x448ae8+'-'+_0x2fca5f+'/'+_0x39dae1)[_0x25ab('0x18')](_0x1883be);}return null;};}function saveUpdates(_0x5d070f){return function(_0x540a11){if(_0x540a11){return _0x540a11[_0x25ab('0x19')](_0x5d070f)['then'](function(_0x1286c6){return _0x1286c6;});}return null;};}function removeEntity(_0x4c4887){return function(_0xa42724){if(_0xa42724){return _0xa42724[_0x25ab('0x1a')]()['then'](function(){_0x4c4887[_0x25ab('0x11')](0xcc)[_0x25ab('0x1b')]();});}};}function handleEntityNotFound(_0x1a343c){return function(_0x32ba1d){if(!_0x32ba1d){_0x1a343c['sendStatus'](0x194);}return _0x32ba1d;};}function handleError(_0x2f95c3,_0x2d6430){_0x2d6430=_0x2d6430||0x1f4;return function(_0x218171){logger[_0x25ab('0xc')](_0x218171[_0x25ab('0x1c')]);if(_0x218171[_0x25ab('0x1d')]){delete _0x218171[_0x25ab('0x1d')];}_0x2f95c3[_0x25ab('0x11')](_0x2d6430)[_0x25ab('0x1e')](_0x218171);};}exports[_0x25ab('0x1f')]=function(_0x3f3471,_0x39c2fc){var _0x18cd36={},_0x1a9597={},_0x4ee8fe={'count':0x0,'rows':[]};var _0x2e72d2=_[_0x25ab('0x20')](db[_0x25ab('0x21')][_0x25ab('0x22')],function(_0x14347d){return{'name':_0x14347d['fieldName'],'type':_0x14347d['type'][_0x25ab('0x23')]};});_0x1a9597[_0x25ab('0x24')]=_[_0x25ab('0x20')](_0x2e72d2,_0x25ab('0x1d'));_0x1a9597[_0x25ab('0x25')]=_[_0x25ab('0x26')](_0x3f3471[_0x25ab('0x25')]);_0x1a9597[_0x25ab('0x27')]=_[_0x25ab('0x28')](_0x1a9597['model'],_0x1a9597[_0x25ab('0x25')]);_0x18cd36['attributes']=_[_0x25ab('0x28')](_0x1a9597[_0x25ab('0x24')],qs[_0x25ab('0x29')](_0x3f3471[_0x25ab('0x25')][_0x25ab('0x29')]));_0x18cd36[_0x25ab('0x2a')]=_0x18cd36[_0x25ab('0x2a')]['length']?_0x18cd36[_0x25ab('0x2a')]:_0x1a9597[_0x25ab('0x24')];if(!_0x3f3471[_0x25ab('0x25')]['hasOwnProperty'](_0x25ab('0x2b'))){_0x18cd36['limit']=qs[_0x25ab('0x13')](_0x3f3471['query']['limit']);_0x18cd36[_0x25ab('0x12')]=qs[_0x25ab('0x12')](_0x3f3471[_0x25ab('0x25')]['offset']);}_0x18cd36['order']=qs[_0x25ab('0x2c')](_0x3f3471[_0x25ab('0x25')][_0x25ab('0x2c')]);_0x18cd36['where']=qs[_0x25ab('0x27')](_[_0x25ab('0x2d')](_0x3f3471[_0x25ab('0x25')],_0x1a9597[_0x25ab('0x27')]),_0x2e72d2);if(_0x3f3471['query']['filter']){_0x18cd36[_0x25ab('0x2e')]=_[_0x25ab('0x2f')](_0x18cd36[_0x25ab('0x2e')],{'$or':_[_0x25ab('0x20')](_0x2e72d2,function(_0x4f7dd9){if(_0x4f7dd9['type']!==_0x25ab('0x30')){var _0x1acbd0={};_0x1acbd0[_0x4f7dd9[_0x25ab('0x1d')]]={'$like':'%'+_0x3f3471[_0x25ab('0x25')][_0x25ab('0x31')]+'%'};return _0x1acbd0;}})});}_0x18cd36=_[_0x25ab('0x2f')]({},_0x18cd36,_0x3f3471[_0x25ab('0x32')]);var _0x24b19f={'where':_0x18cd36[_0x25ab('0x2e')]};return db['Network'][_0x25ab('0x15')](_0x24b19f)['then'](function(_0x31e959){_0x4ee8fe['count']=_0x31e959;if(_0x3f3471[_0x25ab('0x25')]['includeAll']){_0x18cd36['include']=[{'all':!![]}];}return db['Network'][_0x25ab('0x33')](_0x18cd36);})[_0x25ab('0x34')](function(_0x308ea2){_0x4ee8fe[_0x25ab('0x35')]=_0x308ea2;return _0x4ee8fe;})[_0x25ab('0x34')](respondWithFilteredResult(_0x39c2fc,_0x18cd36))[_0x25ab('0x10')](handleError(_0x39c2fc,null));};exports[_0x25ab('0x36')]=function(_0x201218,_0x194b8b){var _0x329741={'raw':!![],'where':{'id':_0x201218[_0x25ab('0x37')]['id']}},_0x1af5a2={};_0x1af5a2['model']=_[_0x25ab('0x26')](db[_0x25ab('0x21')][_0x25ab('0x22')]);_0x1af5a2[_0x25ab('0x25')]=_[_0x25ab('0x26')](_0x201218[_0x25ab('0x25')]);_0x1af5a2['filters']=_[_0x25ab('0x28')](_0x1af5a2[_0x25ab('0x24')],_0x1af5a2[_0x25ab('0x25')]);_0x329741[_0x25ab('0x2a')]=_['intersection'](_0x1af5a2[_0x25ab('0x24')],qs['fields'](_0x201218[_0x25ab('0x25')][_0x25ab('0x29')]));_0x329741['attributes']=_0x329741[_0x25ab('0x2a')][_0x25ab('0x38')]?_0x329741[_0x25ab('0x2a')]:_0x1af5a2[_0x25ab('0x24')];if(_0x201218['query']['includeAll']){_0x329741[_0x25ab('0x39')]=[{'all':!![]}];}_0x329741=_[_0x25ab('0x2f')]({},_0x329741,_0x201218[_0x25ab('0x32')]);return db[_0x25ab('0x21')][_0x25ab('0x3a')](_0x329741)[_0x25ab('0x34')](handleEntityNotFound(_0x194b8b,null))[_0x25ab('0x34')](respondWithResult(_0x194b8b,null))[_0x25ab('0x10')](handleError(_0x194b8b,null));};exports[_0x25ab('0x3b')]=function(_0x9a360b,_0x2abd29){var _0x4757b7;return db[_0x25ab('0x21')]['create'](_0x9a360b[_0x25ab('0x3c')],{'raw':!![]})['then'](function(_0x16da21){_0x4757b7=_0x16da21;return db[_0x25ab('0x21')][_0x25ab('0x33')]({'where':{'type':_0x9a360b[_0x25ab('0x3c')][_0x25ab('0x3d')]},'raw':!![]});})[_0x25ab('0x34')](function(_0x4a20b7){if(_0x4757b7[_0x25ab('0x3d')][_0x25ab('0x3e')]()==_0x25ab('0x3f')){var _0x45dad4=fs['readFileSync'](path[_0x25ab('0x40')](config[_0x25ab('0x41')],_0x25ab('0x42')),_0x25ab('0x43'));var _0x15fd73=ejs['render'](_0x45dad4,{'networks':_0x4a20b7||[]});fs[_0x25ab('0x44')]('/etc/asterisk/stun_xcally.conf',_0x15fd73);return respondWithRpcPromise('Reload',_0x25ab('0x3b'),{'module':_0x25ab('0x45')});}else if(_0x4757b7[_0x25ab('0x3d')][_0x25ab('0x3e')]()==_0x25ab('0x46')){var _0x16f8e6=fs[_0x25ab('0x47')](path[_0x25ab('0x40')](config['root'],_0x25ab('0x48')),_0x25ab('0x43'));var _0x5a62a6=ejs[_0x25ab('0x49')](_0x16f8e6,{'networks':_0x4a20b7||[]});fs[_0x25ab('0x44')](_0x25ab('0x4a'),_0x5a62a6);return respondWithRpcPromise(_0x25ab('0x4b'),_0x25ab('0x3b'),{'module':'res_stun_monitor.so'});}else{var _0x47cc9b=fs[_0x25ab('0x47')](path[_0x25ab('0x40')](config[_0x25ab('0x41')],_0x25ab('0x4c')),'utf8');var _0x4728eb=ejs[_0x25ab('0x49')](_0x47cc9b,{'networks':_0x4a20b7||[]});fs[_0x25ab('0x44')](util[_0x25ab('0x4d')](_0x25ab('0x4e'),_0x9a360b[_0x25ab('0x3c')]['type'][_0x25ab('0x4f')]()),_0x4728eb);return respondWithRpcPromise('Reload','create',{'module':_0x25ab('0x50')});}})[_0x25ab('0x34')](function(){return _0x4757b7;})[_0x25ab('0x34')](respondWithResult(_0x2abd29,0xc9))[_0x25ab('0x10')](handleError(_0x2abd29,null));};exports[_0x25ab('0x19')]=function(_0x34500d,_0x17fbcd){var _0x5ba929;return db['Network']['find']({'where':{'id':_0x34500d[_0x25ab('0x37')]['id']}})['then'](handleEntityNotFound(_0x17fbcd,null))[_0x25ab('0x34')](saveUpdates(_0x34500d[_0x25ab('0x3c')],null))[_0x25ab('0x34')](function(_0x33cf16){if(_0x33cf16){_0x5ba929=_0x33cf16;return db['Network']['findAll']({'where':{'type':_0x5ba929[_0x25ab('0x3d')]},'raw':!![]});}return null;})[_0x25ab('0x34')](function(_0x311e2e){if(_0x5ba929['type'][_0x25ab('0x3e')]()=='STUN'){var _0x37bbcd=fs[_0x25ab('0x47')](path[_0x25ab('0x40')](config[_0x25ab('0x41')],_0x25ab('0x42')),_0x25ab('0x43'));var _0x4c99ac=ejs[_0x25ab('0x49')](_0x37bbcd,{'networks':_0x311e2e||[]});fs['writeFileSync'](_0x25ab('0x51'),_0x4c99ac);return respondWithRpcPromise(_0x25ab('0x4b'),_0x25ab('0x19'),{'module':_0x25ab('0x45')});}else if(_0x5ba929[_0x25ab('0x3d')]['toUpperCase']()==_0x25ab('0x46')){var _0x343dfe=fs[_0x25ab('0x47')](path[_0x25ab('0x40')](config[_0x25ab('0x41')],_0x25ab('0x48')),_0x25ab('0x43'));var _0x4a4513=ejs[_0x25ab('0x49')](_0x343dfe,{'networks':_0x311e2e||[]});fs[_0x25ab('0x44')](_0x25ab('0x4a'),_0x4a4513);return respondWithRpcPromise(_0x25ab('0x4b'),_0x25ab('0x19'),{'module':'res_stun_monitor.so'});}else{var _0xaa9a82=fs[_0x25ab('0x47')](path[_0x25ab('0x40')](config[_0x25ab('0x41')],_0x25ab('0x4c')),_0x25ab('0x43'));var _0x1506b8=ejs[_0x25ab('0x49')](_0xaa9a82,{'networks':_0x311e2e||[]});fs[_0x25ab('0x44')](util[_0x25ab('0x4d')](_0x25ab('0x4e'),_0x34500d['body'][_0x25ab('0x3d')][_0x25ab('0x4f')]()),_0x1506b8);return respondWithRpcPromise(_0x25ab('0x4b'),_0x25ab('0x19'),{'module':_0x25ab('0x50')});}})[_0x25ab('0x34')](function(_0x1f710d){if(_0x1f710d){return _0x5ba929;}return null;})[_0x25ab('0x34')](respondWithResult(_0x17fbcd,null))[_0x25ab('0x10')](handleError(_0x17fbcd,null));};exports[_0x25ab('0x1a')]=function(_0x7f876f,_0x33d9d0){var _0x2c4e8c;return db[_0x25ab('0x21')][_0x25ab('0x3a')]({'where':{'id':_0x7f876f['params']['id']}})['then'](function(_0x89aa6){_0x2c4e8c=_0x89aa6;return _0x89aa6;})[_0x25ab('0x34')](handleEntityNotFound(_0x33d9d0,null))[_0x25ab('0x34')](removeEntity(_0x33d9d0,null))[_0x25ab('0x34')](function(){if(_0x2c4e8c){return db['Network'][_0x25ab('0x33')]({'where':{'type':_0x2c4e8c[_0x25ab('0x3d')]},'raw':!![]});}})['then'](function(_0x5475ff){if(_0x2c4e8c[_0x25ab('0x3d')]['toUpperCase']()==_0x25ab('0x3f')){var _0x588e01=fs['readFileSync'](path[_0x25ab('0x40')](config[_0x25ab('0x41')],_0x25ab('0x42')),_0x25ab('0x43'));var _0x286eee=ejs[_0x25ab('0x49')](_0x588e01,{'networks':_0x5475ff||[]});fs[_0x25ab('0x44')](_0x25ab('0x51'),_0x286eee);return respondWithRpcPromise(_0x25ab('0x4b'),_0x25ab('0x1a'),{'module':'res_stun_monitor.so'});}else if(_0x2c4e8c[_0x25ab('0x3d')][_0x25ab('0x3e')]()==_0x25ab('0x46')){var _0x33f97b=fs['readFileSync'](path[_0x25ab('0x40')](config[_0x25ab('0x41')],_0x25ab('0x48')),_0x25ab('0x43'));var _0x3d668a=ejs[_0x25ab('0x49')](_0x33f97b,{'networks':_0x5475ff||[]});fs[_0x25ab('0x44')](_0x25ab('0x4a'),_0x3d668a);return respondWithRpcPromise('Reload',_0x25ab('0x1a'),{'module':'res_stun_monitor.so'});}else{var _0x453f77=fs[_0x25ab('0x47')](path[_0x25ab('0x40')](config[_0x25ab('0x41')],_0x25ab('0x4c')),'utf8');var _0x96e00=ejs['render'](_0x453f77,{'networks':_0x5475ff||[]});fs['writeFileSync'](util[_0x25ab('0x4d')]('/etc/asterisk/sip_xcally_%s.conf',_0x2c4e8c[_0x25ab('0x3d')][_0x25ab('0x4f')]()),_0x96e00);return respondWithRpcPromise(_0x25ab('0x4b'),_0x25ab('0x1a'),{'module':'chan_sip.so'});}})[_0x25ab('0x10')](handleError(_0x33d9d0,null));}; \ No newline at end of file +var _0x194d=['key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','findAll','catch','show','params','rawAttributes','find','create','body','toUpperCase','readFileSync','join','server/files/templates/stun_multiple.ejs','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','root','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','render','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','STUN','toLowerCase','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','json','offset','undefined','count','limit','set','Content-Range','update','destroy','status','sendStatus','name','index','map','Network','fieldName'];(function(_0x469979,_0x42131f){var _0x443035=function(_0x1ae2df){while(--_0x1ae2df){_0x469979['push'](_0x469979['shift']());}};_0x443035(++_0x42131f);}(_0x194d,0x7f));var _0xd194=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x194d[_0xb0f7c3];return _0x28ea68;};'use strict';var util=require(_0xd194('0x0'));var path=require(_0xd194('0x1'));var ejs=require(_0xd194('0x2'));var fs=require('fs');var _=require(_0xd194('0x3'));var qs=require(_0xd194('0x4'));var logger=require(_0xd194('0x5'))('api');var config=require(_0xd194('0x6'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd194('0x7'));var client=jayson[_0xd194('0x8')][_0xd194('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14867e,_0x2f52dc,_0x570781,_0x3a9e12){return new Promise(function(_0x2172bf,_0x264f09){var _0x1b107d=_0x3a9e12||client;return _0x1b107d['request'](_0x14867e,_0x570781)[_0xd194('0xa')](function(_0x1677de){logger[_0xd194('0xb')](_0xd194('0xc'),_0x2f52dc,'request\x20sent');logger[_0xd194('0xd')](_0xd194('0xe'),_0x2f52dc,_0xd194('0xf'),JSON[_0xd194('0x10')](_0x1677de));if(_0x1677de[_0xd194('0x11')]){if(_0x1677de[_0xd194('0x11')][_0xd194('0x12')]===0x1f4){logger[_0xd194('0x11')]('Network,\x20%s,\x20%s',_0x2f52dc,_0x1677de['error'][_0xd194('0x13')]);return _0x264f09(_0x1677de[_0xd194('0x11')][_0xd194('0x13')]);}logger[_0xd194('0x11')](_0xd194('0xc'),_0x2f52dc,_0x1677de['error']['message']);return _0x2172bf(_0x1677de[_0xd194('0x11')][_0xd194('0x13')]);}else{logger[_0xd194('0xb')](_0xd194('0xc'),_0x2f52dc,_0xd194('0xf'));_0x2172bf(_0x1677de[_0xd194('0x14')][_0xd194('0x13')]);}})['catch'](function(_0x40046d){logger[_0xd194('0x11')](_0xd194('0xc'),_0x2f52dc,_0x40046d);_0x264f09(_0x40046d);});});}function respondWithResult(_0x5bd7aa,_0xd2fd57){_0xd2fd57=_0xd2fd57||0xc8;return function(_0x5b42c4){if(_0x5b42c4){return _0x5bd7aa['status'](_0xd2fd57)[_0xd194('0x15')](_0x5b42c4);}};}function respondWithFilteredResult(_0x3d6d3b,_0x4c14d0){return function(_0x7a3a2c){if(_0x7a3a2c){var _0x3799e9=typeof _0x4c14d0[_0xd194('0x16')]==='undefined'&&typeof _0x4c14d0['limit']===_0xd194('0x17');var _0x491f3f=_0x7a3a2c[_0xd194('0x18')];var _0x399202=_0x3799e9?0x0:_0x4c14d0['offset'];var _0x3c31fc=_0x3799e9?_0x7a3a2c[_0xd194('0x18')]:_0x4c14d0['offset']+_0x4c14d0[_0xd194('0x19')];var _0x599760;if(_0x3c31fc>=_0x491f3f){_0x3c31fc=_0x491f3f;_0x599760=0xc8;}else{_0x599760=0xce;}_0x3d6d3b['status'](_0x599760);return _0x3d6d3b[_0xd194('0x1a')](_0xd194('0x1b'),_0x399202+'-'+_0x3c31fc+'/'+_0x491f3f)[_0xd194('0x15')](_0x7a3a2c);}return null;};}function saveUpdates(_0x443d03){return function(_0x5808e9){if(_0x5808e9){return _0x5808e9[_0xd194('0x1c')](_0x443d03)[_0xd194('0xa')](function(_0x66cd7c){return _0x66cd7c;});}return null;};}function removeEntity(_0x10f499){return function(_0xe0190d){if(_0xe0190d){return _0xe0190d[_0xd194('0x1d')]()['then'](function(){_0x10f499[_0xd194('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2acc67){return function(_0x328d02){if(!_0x328d02){_0x2acc67[_0xd194('0x1f')](0x194);}return _0x328d02;};}function handleError(_0x3157ad,_0x28b745){_0x28b745=_0x28b745||0x1f4;return function(_0x2942e5){logger[_0xd194('0x11')](_0x2942e5['stack']);if(_0x2942e5[_0xd194('0x20')]){delete _0x2942e5[_0xd194('0x20')];}_0x3157ad['status'](_0x28b745)['send'](_0x2942e5);};}exports[_0xd194('0x21')]=function(_0x30d869,_0x128f6a){var _0x57b27e={},_0x165de3={},_0x4b9b99={'count':0x0,'rows':[]};var _0x279957=_[_0xd194('0x22')](db[_0xd194('0x23')]['rawAttributes'],function(_0x45c0ef){return{'name':_0x45c0ef[_0xd194('0x24')],'type':_0x45c0ef['type'][_0xd194('0x25')]};});_0x165de3[_0xd194('0x26')]=_[_0xd194('0x22')](_0x279957,_0xd194('0x20'));_0x165de3[_0xd194('0x27')]=_[_0xd194('0x28')](_0x30d869[_0xd194('0x27')]);_0x165de3[_0xd194('0x29')]=_[_0xd194('0x2a')](_0x165de3[_0xd194('0x26')],_0x165de3[_0xd194('0x27')]);_0x57b27e[_0xd194('0x2b')]=_['intersection'](_0x165de3['model'],qs['fields'](_0x30d869[_0xd194('0x27')][_0xd194('0x2c')]));_0x57b27e[_0xd194('0x2b')]=_0x57b27e['attributes']['length']?_0x57b27e['attributes']:_0x165de3[_0xd194('0x26')];if(!_0x30d869[_0xd194('0x27')][_0xd194('0x2d')](_0xd194('0x2e'))){_0x57b27e['limit']=qs[_0xd194('0x19')](_0x30d869[_0xd194('0x27')][_0xd194('0x19')]);_0x57b27e[_0xd194('0x16')]=qs[_0xd194('0x16')](_0x30d869[_0xd194('0x27')]['offset']);}_0x57b27e['order']=qs[_0xd194('0x2f')](_0x30d869[_0xd194('0x27')]['sort']);_0x57b27e[_0xd194('0x30')]=qs['filters'](_[_0xd194('0x31')](_0x30d869[_0xd194('0x27')],_0x165de3[_0xd194('0x29')]),_0x279957);if(_0x30d869[_0xd194('0x27')][_0xd194('0x32')]){_0x57b27e[_0xd194('0x30')]=_[_0xd194('0x33')](_0x57b27e[_0xd194('0x30')],{'$or':_['map'](_0x279957,function(_0x2b6da0){if(_0x2b6da0[_0xd194('0x34')]!=='VIRTUAL'){var _0x37d036={};_0x37d036[_0x2b6da0['name']]={'$like':'%'+_0x30d869[_0xd194('0x27')][_0xd194('0x32')]+'%'};return _0x37d036;}})});}_0x57b27e=_[_0xd194('0x33')]({},_0x57b27e,_0x30d869[_0xd194('0x35')]);var _0x3b47af={'where':_0x57b27e[_0xd194('0x30')]};return db[_0xd194('0x23')]['count'](_0x3b47af)['then'](function(_0xfc62c8){_0x4b9b99[_0xd194('0x18')]=_0xfc62c8;if(_0x30d869['query']['includeAll']){_0x57b27e['include']=[{'all':!![]}];}return db[_0xd194('0x23')][_0xd194('0x36')](_0x57b27e);})[_0xd194('0xa')](function(_0x3694ac){_0x4b9b99['rows']=_0x3694ac;return _0x4b9b99;})['then'](respondWithFilteredResult(_0x128f6a,_0x57b27e))[_0xd194('0x37')](handleError(_0x128f6a,null));};exports[_0xd194('0x38')]=function(_0x598ca1,_0x29c006){var _0x3d2655={'raw':!![],'where':{'id':_0x598ca1[_0xd194('0x39')]['id']}},_0x2c6449={};_0x2c6449[_0xd194('0x26')]=_[_0xd194('0x28')](db['Network'][_0xd194('0x3a')]);_0x2c6449[_0xd194('0x27')]=_[_0xd194('0x28')](_0x598ca1[_0xd194('0x27')]);_0x2c6449['filters']=_[_0xd194('0x2a')](_0x2c6449[_0xd194('0x26')],_0x2c6449[_0xd194('0x27')]);_0x3d2655[_0xd194('0x2b')]=_[_0xd194('0x2a')](_0x2c6449[_0xd194('0x26')],qs[_0xd194('0x2c')](_0x598ca1['query']['fields']));_0x3d2655[_0xd194('0x2b')]=_0x3d2655[_0xd194('0x2b')]['length']?_0x3d2655[_0xd194('0x2b')]:_0x2c6449[_0xd194('0x26')];if(_0x598ca1[_0xd194('0x27')]['includeAll']){_0x3d2655['include']=[{'all':!![]}];}_0x3d2655=_['merge']({},_0x3d2655,_0x598ca1[_0xd194('0x35')]);return db['Network'][_0xd194('0x3b')](_0x3d2655)[_0xd194('0xa')](handleEntityNotFound(_0x29c006,null))['then'](respondWithResult(_0x29c006,null))['catch'](handleError(_0x29c006,null));};exports[_0xd194('0x3c')]=function(_0x5cacaa,_0x7676b8){var _0x6186a3;return db['Network'][_0xd194('0x3c')](_0x5cacaa[_0xd194('0x3d')],{'raw':!![]})['then'](function(_0x29b250){_0x6186a3=_0x29b250;return db[_0xd194('0x23')][_0xd194('0x36')]({'where':{'type':_0x5cacaa[_0xd194('0x3d')][_0xd194('0x34')]},'raw':!![]});})[_0xd194('0xa')](function(_0x4bcd26){if(_0x6186a3[_0xd194('0x34')][_0xd194('0x3e')]()=='STUN'){var _0x1a6e67=fs[_0xd194('0x3f')](path[_0xd194('0x40')](config['root'],_0xd194('0x41')),'utf8');var _0x3ce455=ejs['render'](_0x1a6e67,{'networks':_0x4bcd26||[]});fs[_0xd194('0x42')](_0xd194('0x43'),_0x3ce455);return respondWithRpcPromise(_0xd194('0x44'),_0xd194('0x3c'),{'module':_0xd194('0x45')});}else if(_0x6186a3['type'][_0xd194('0x3e')]()==_0xd194('0x46')){var _0x343913=fs[_0xd194('0x3f')](path[_0xd194('0x40')](config[_0xd194('0x47')],_0xd194('0x48')),_0xd194('0x49'));var _0x207d25=ejs['render'](_0x343913,{'networks':_0x4bcd26||[]});fs[_0xd194('0x42')](_0xd194('0x4a'),_0x207d25);return respondWithRpcPromise('Reload',_0xd194('0x3c'),{'module':'res_stun_monitor.so'});}else{var _0x32d67f=fs[_0xd194('0x3f')](path[_0xd194('0x40')](config[_0xd194('0x47')],_0xd194('0x4b')),_0xd194('0x49'));var _0x2d4f21=ejs[_0xd194('0x4c')](_0x32d67f,{'networks':_0x4bcd26||[]});fs[_0xd194('0x42')](util[_0xd194('0x4d')](_0xd194('0x4e'),_0x5cacaa[_0xd194('0x3d')][_0xd194('0x34')]['toLowerCase']()),_0x2d4f21);return respondWithRpcPromise(_0xd194('0x44'),_0xd194('0x3c'),{'module':_0xd194('0x4f')});}})[_0xd194('0xa')](function(){return _0x6186a3;})[_0xd194('0xa')](respondWithResult(_0x7676b8,0xc9))['catch'](handleError(_0x7676b8,null));};exports[_0xd194('0x1c')]=function(_0x17235c,_0x1d18c2){var _0x43c171;return db[_0xd194('0x23')][_0xd194('0x3b')]({'where':{'id':_0x17235c[_0xd194('0x39')]['id']}})[_0xd194('0xa')](handleEntityNotFound(_0x1d18c2,null))[_0xd194('0xa')](saveUpdates(_0x17235c['body'],null))['then'](function(_0x4b3e9b){if(_0x4b3e9b){_0x43c171=_0x4b3e9b;return db['Network'][_0xd194('0x36')]({'where':{'type':_0x43c171[_0xd194('0x34')]},'raw':!![]});}return null;})['then'](function(_0x7b2cc){if(_0x43c171['type'][_0xd194('0x3e')]()==_0xd194('0x50')){var _0x297ef3=fs[_0xd194('0x3f')](path['join'](config[_0xd194('0x47')],_0xd194('0x41')),_0xd194('0x49'));var _0xec1a=ejs[_0xd194('0x4c')](_0x297ef3,{'networks':_0x7b2cc||[]});fs[_0xd194('0x42')](_0xd194('0x43'),_0xec1a);return respondWithRpcPromise(_0xd194('0x44'),_0xd194('0x1c'),{'module':_0xd194('0x45')});}else if(_0x43c171[_0xd194('0x34')]['toUpperCase']()==_0xd194('0x46')){var _0x36480e=fs[_0xd194('0x3f')](path['join'](config[_0xd194('0x47')],_0xd194('0x48')),_0xd194('0x49'));var _0x12760e=ejs[_0xd194('0x4c')](_0x36480e,{'networks':_0x7b2cc||[]});fs[_0xd194('0x42')](_0xd194('0x4a'),_0x12760e);return respondWithRpcPromise('Reload',_0xd194('0x1c'),{'module':'res_stun_monitor.so'});}else{var _0x102d0a=fs[_0xd194('0x3f')](path['join'](config['root'],'server/files/templates/network.ejs'),_0xd194('0x49'));var _0x3b9cbd=ejs[_0xd194('0x4c')](_0x102d0a,{'networks':_0x7b2cc||[]});fs[_0xd194('0x42')](util[_0xd194('0x4d')](_0xd194('0x4e'),_0x17235c['body'][_0xd194('0x34')][_0xd194('0x51')]()),_0x3b9cbd);return respondWithRpcPromise(_0xd194('0x44'),'update',{'module':_0xd194('0x4f')});}})['then'](function(_0x26453c){if(_0x26453c){return _0x43c171;}return null;})[_0xd194('0xa')](respondWithResult(_0x1d18c2,null))[_0xd194('0x37')](handleError(_0x1d18c2,null));};exports[_0xd194('0x1d')]=function(_0x4a37b6,_0x2f1d02){var _0x5d1469;return db['Network']['find']({'where':{'id':_0x4a37b6[_0xd194('0x39')]['id']}})[_0xd194('0xa')](function(_0x14088b){_0x5d1469=_0x14088b;return _0x14088b;})[_0xd194('0xa')](handleEntityNotFound(_0x2f1d02,null))[_0xd194('0xa')](removeEntity(_0x2f1d02,null))[_0xd194('0xa')](function(){if(_0x5d1469){return db[_0xd194('0x23')][_0xd194('0x36')]({'where':{'type':_0x5d1469[_0xd194('0x34')]},'raw':!![]});}})[_0xd194('0xa')](function(_0x411b46){if(_0x5d1469['type']['toUpperCase']()==_0xd194('0x50')){var _0x225a1c=fs[_0xd194('0x3f')](path[_0xd194('0x40')](config[_0xd194('0x47')],'server/files/templates/stun_multiple.ejs'),_0xd194('0x49'));var _0x1a5444=ejs[_0xd194('0x4c')](_0x225a1c,{'networks':_0x411b46||[]});fs[_0xd194('0x42')](_0xd194('0x43'),_0x1a5444);return respondWithRpcPromise(_0xd194('0x44'),_0xd194('0x1d'),{'module':_0xd194('0x45')});}else if(_0x5d1469['type'][_0xd194('0x3e')]()==_0xd194('0x46')){var _0x1427b0=fs[_0xd194('0x3f')](path[_0xd194('0x40')](config[_0xd194('0x47')],_0xd194('0x48')),_0xd194('0x49'));var _0x2abfdc=ejs['render'](_0x1427b0,{'networks':_0x411b46||[]});fs[_0xd194('0x42')](_0xd194('0x4a'),_0x2abfdc);return respondWithRpcPromise(_0xd194('0x44'),_0xd194('0x1d'),{'module':_0xd194('0x45')});}else{var _0x58c4dd=fs[_0xd194('0x3f')](path[_0xd194('0x40')](config['root'],'server/files/templates/network.ejs'),_0xd194('0x49'));var _0x4eece0=ejs[_0xd194('0x4c')](_0x58c4dd,{'networks':_0x411b46||[]});fs[_0xd194('0x42')](util[_0xd194('0x4d')](_0xd194('0x4e'),_0x5d1469[_0xd194('0x34')]['toLowerCase']()),_0x4eece0);return respondWithRpcPromise(_0xd194('0x44'),_0xd194('0x1d'),{'module':_0xd194('0x4f')});}})[_0xd194('0x37')](handleError(_0x2f1d02,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 5ab3f2b..6256350 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 _0xd87e=['moment','bluebird','path','../../config/environment','./network.attributes','Network','network','lodash','util','api'];(function(_0x9212a2,_0x241265){var _0x514fb8=function(_0x63c840){while(--_0x63c840){_0x9212a2['push'](_0x9212a2['shift']());}};_0x514fb8(++_0x241265);}(_0xd87e,0x1bf));var _0xed87=function(_0x3b64ae,_0x2c4e93){_0x3b64ae=_0x3b64ae-0x0;var _0x1506b8=_0xd87e[_0x3b64ae];return _0x1506b8;};'use strict';var _=require(_0xed87('0x0'));var util=require(_0xed87('0x1'));var logger=require('../../config/logger')(_0xed87('0x2'));var moment=require(_0xed87('0x3'));var BPromise=require(_0xed87('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xed87('0x5'));var rimraf=require('rimraf');var config=require(_0xed87('0x6'));var attributes=require(_0xed87('0x7'));module['exports']=function(_0x17adfe,_0x589fb9){return _0x17adfe['define'](_0xed87('0x8'),attributes,{'tableName':_0xed87('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6d8=['../../config/logger','moment','request-promise','../../config/environment','./network.attributes','exports','define','Network','lodash'];(function(_0x18a1c6,_0x4c0130){var _0x1f088d=function(_0x440dbc){while(--_0x440dbc){_0x18a1c6['push'](_0x18a1c6['shift']());}};_0x1f088d(++_0x4c0130);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x2bdcfd,_0x32697d){_0x2bdcfd=_0x2bdcfd-0x0;var _0x53a635=_0xc6d8[_0x2bdcfd];return _0x53a635;};'use strict';var _=require(_0x8c6d('0x0'));var util=require('util');var logger=require(_0x8c6d('0x1'))('api');var moment=require(_0x8c6d('0x2'));var BPromise=require('bluebird');var rp=require(_0x8c6d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8c6d('0x4'));var attributes=require(_0x8c6d('0x5'));module[_0x8c6d('0x6')]=function(_0x4f5e8f,_0x3c265c){return _0x4f5e8f[_0x8c6d('0x7')](_0x8c6d('0x8'),attributes,{'tableName':'network','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 a56afb5..c3233a3 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x4f60d9,_0x3da5dc){_0x4f60d9=_0x4f60d9-0x0;var _0x5f99a0=_0x7a54[_0x4f60d9];return _0x5f99a0;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _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(_0x593758,_0x3f9dde){var _0x4d1cb3=function(_0x1c35bb){while(--_0x1c35bb){_0x593758['push'](_0x593758['shift']());}};_0x4d1cb3(++_0x3f9dde);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 302d5ac..dc20618 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 _0xd7d1=['update','destroy','delete','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getAnswers','/:id/applications','getApplications','getInteractions','getAgents','post','create','/:id/canned_answers','addAnswer','notify','addApplications','/:id/users','addAgents','send','put'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0xa49f66,_0x160622){_0xa49f66=_0xa49f66-0x0;var _0x568ccf=_0xd7d1[_0xa49f66];return _0x568ccf;};'use strict';var multer=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var path=require(_0x1d7d('0x2'));var timeout=require(_0x1d7d('0x3'));var express=require(_0x1d7d('0x4'));var router=express[_0x1d7d('0x5')]();var fs_extra=require(_0x1d7d('0x6'));var auth=require(_0x1d7d('0x7'));var interaction=require(_0x1d7d('0x8'));var config=require(_0x1d7d('0x9'));var controller=require(_0x1d7d('0xa'));router[_0x1d7d('0xb')]('/',auth[_0x1d7d('0xc')](),controller['index']);router[_0x1d7d('0xb')](_0x1d7d('0xd'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0xe')]);router[_0x1d7d('0xb')](_0x1d7d('0xf'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x10')]);router[_0x1d7d('0xb')](_0x1d7d('0x11'),auth[_0x1d7d('0xc')](),controller['getDispositions']);router[_0x1d7d('0xb')]('/:id/canned_answers',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x12')]);router[_0x1d7d('0xb')](_0x1d7d('0x13'),auth['isAuthenticated'](),controller[_0x1d7d('0x14')]);router['get']('/:id/interactions',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x15')]);router['get']('/:id/users',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x16')]);router[_0x1d7d('0x17')]('/',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x18')]);router['post'](_0x1d7d('0x11'),auth[_0x1d7d('0xc')](),controller['addDisposition']);router[_0x1d7d('0x17')](_0x1d7d('0x19'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x1a')]);router[_0x1d7d('0x17')]('/:id/notify',controller[_0x1d7d('0x1b')]);router[_0x1d7d('0x17')]('/:id/applications',auth['isAuthenticated'](),controller[_0x1d7d('0x1c')]);router[_0x1d7d('0x17')](_0x1d7d('0x1d'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x1e')]);router[_0x1d7d('0x17')]('/:id/send',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x1f')]);router[_0x1d7d('0x20')]('/:id',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x21')]);router['delete']('/:id',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x22')]);router[_0x1d7d('0x23')]('/:id/dispositions',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x24')]);router[_0x1d7d('0x23')](_0x1d7d('0x19'),auth['isAuthenticated'](),controller[_0x1d7d('0x25')]);router[_0x1d7d('0x23')]('/:id/users',auth['isAuthenticated'](),controller[_0x1d7d('0x26')]);module['exports']=router; \ No newline at end of file +var _0x36ee=['removeDispositions','removeAnswers','removeAgents','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','post','create','addDisposition','/:id/notify','addApplications','addAgents','/:id/send','send','put','delete','destroy'];(function(_0x221a85,_0x1eaa37){var _0x5c58fb=function(_0x1f85f7){while(--_0x1f85f7){_0x221a85['push'](_0x221a85['shift']());}};_0x5c58fb(++_0x1eaa37);}(_0x36ee,0xe8));var _0xe36e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x36ee[_0x397e5f];return _0x5302b8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36e('0x0'));var timeout=require('connect-timeout');var express=require(_0xe36e('0x1'));var router=express[_0xe36e('0x2')]();var fs_extra=require(_0xe36e('0x3'));var auth=require(_0xe36e('0x4'));var interaction=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var controller=require(_0xe36e('0x7'));router[_0xe36e('0x8')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0xa')]);router[_0xe36e('0x8')](_0xe36e('0xb'),auth['isAuthenticated'](),controller[_0xe36e('0xc')]);router['get'](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller[_0xe36e('0xe')]);router['get'](_0xe36e('0xf'),auth['isAuthenticated'](),controller[_0xe36e('0x10')]);router[_0xe36e('0x8')](_0xe36e('0x11'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x12')]);router[_0xe36e('0x8')](_0xe36e('0x13'),auth[_0xe36e('0x9')](),controller['getApplications']);router[_0xe36e('0x8')](_0xe36e('0x14'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x15')]);router['get'](_0xe36e('0x16'),auth['isAuthenticated'](),controller['getAgents']);router[_0xe36e('0x17')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0x18')]);router[_0xe36e('0x17')](_0xe36e('0xf'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x19')]);router[_0xe36e('0x17')](_0xe36e('0x11'),auth[_0xe36e('0x9')](),controller['addAnswer']);router[_0xe36e('0x17')](_0xe36e('0x1a'),controller['notify']);router[_0xe36e('0x17')]('/:id/applications',auth[_0xe36e('0x9')](),controller[_0xe36e('0x1b')]);router['post'](_0xe36e('0x16'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x1c')]);router['post'](_0xe36e('0x1d'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x1e')]);router[_0xe36e('0x1f')](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller['update']);router[_0xe36e('0x20')](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x21')]);router[_0xe36e('0x20')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xe36e('0x22')]);router[_0xe36e('0x20')](_0xe36e('0x11'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x23')]);router[_0xe36e('0x20')](_0xe36e('0x16'),auth['isAuthenticated'](),controller[_0xe36e('0x24')]);module[_0xe36e('0x25')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 74fa974..d580cb5 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 _0x8342=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','name','STRING'];(function(_0x4da034,_0x1d3b8e){var _0xe3577d=function(_0x58f825){while(--_0x58f825){_0x4da034['push'](_0x4da034['shift']());}};_0xe3577d(++_0x1d3b8e);}(_0x8342,0x1d0));var _0x2834=function(_0x290b68,_0x1f82af){_0x290b68=_0x290b68-0x0;var _0x2f23af=_0x8342[_0x290b68];return _0x2f23af;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x2834('0x0'));module[_0x2834('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2834('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x2834('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x2834('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x2834('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x2834('0x4')],'defaultValue':function(){return _0x2834('0x5');}},'notificationSound':{'type':Sequelize[_0x2834('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2834('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2834('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x2834('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2834('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2834('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2834('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2834('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x2834('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4c0bf3){if(!_0x4c0bf3)this[_0x2834('0x9')](_0x2834('0xa'),null);this[_0x2834('0x9')](_0x2834('0xb'),_0x4c0bf3);}}}; \ No newline at end of file +var _0x50df=['STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring'];(function(_0x436d8b,_0x49215f){var _0x38e777=function(_0x4ddafc){while(--_0x4ddafc){_0x436d8b['push'](_0x436d8b['shift']());}};_0x38e777(++_0x49215f);}(_0x50df,0xca));var _0xf50d=function(_0x26cdd8,_0x3c3136){_0x26cdd8=_0x26cdd8-0x0;var _0x4687aa=_0x50df[_0x26cdd8];return _0x4687aa;};'use strict';var Sequelize=require(_0xf50d('0x0'));var rs=require(_0xf50d('0x1'));module['exports']={'name':{'type':Sequelize[_0xf50d('0x2')],'unique':_0xf50d('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xf50d('0x4')]();}},'replyUri':{'type':Sequelize[_0xf50d('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xf50d('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xf50d('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf50d('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xf50d('0x2')]},'queueTransfer':{'type':Sequelize[_0xf50d('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf50d('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf50d('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xf50d('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xf50d('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x12a140){if(!_0x12a140)this[_0xf50d('0x9')](_0xf50d('0xa'),null);this[_0xf50d('0x9')](_0xf50d('0xb'),_0x12a140);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index c832958..504447c 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 _0x67d1=['*,*,*,*','User','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','priority','finally','send','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','getAgents','CmList','out','OpenchannelMessage','Messages','dataValues','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','OpenchannelAccounts','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','Pause','keys','intersection','length','options','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','openchannel','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','asc','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','lastName','messageId','interaction','created','autoclose','push','unmanaged'];(function(_0x1a9fe4,_0x2771e6){var _0x59fb68=function(_0x3cfbc0){while(--_0x3cfbc0){_0x1a9fe4['push'](_0x1a9fe4['shift']());}};_0x59fb68(++_0x2771e6);}(_0x67d1,0xf1));var _0x167d=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x67d1[_0x7e2eb0];return _0xd92de4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x167d('0x0'));var zipdir=require(_0x167d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x167d('0x2'));var moment=require(_0x167d('0x3'));var BPromise=require(_0x167d('0x4'));var Mustache=require(_0x167d('0x5'));var util=require('util');var path=require(_0x167d('0x6'));var sox=require(_0x167d('0x7'));var csv=require(_0x167d('0x8'));var ejs=require(_0x167d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x167d('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x167d('0xb'));var deskjs=require(_0x167d('0xc'));var toCsv=require(_0x167d('0x8'));var querystring=require(_0x167d('0xd'));var Papa=require(_0x167d('0xe'));var Redis=require(_0x167d('0xf'));var authService=require(_0x167d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x167d('0x11'));var hardwareService=require(_0x167d('0x12'));var logger=require(_0x167d('0x13'))(_0x167d('0x14'));var utils=require(_0x167d('0x15'));var config=require(_0x167d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x167d('0x17'))['db'];config['redis']=_[_0x167d('0x18')](config[_0x167d('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x167d('0x1a'))(new Redis(config[_0x167d('0x19')]));require(_0x167d('0x1b'))[_0x167d('0x1c')](socket);var jayson=require(_0x167d('0x1d'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x167d('0x1e')][_0x167d('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x9752ed,_0x5191bc,_0xdaeefe,_0x47ee94){return new BPromise(function(_0x43fd94,_0x4f056b){var _0xc35ee9=_0x47ee94||client;return _0xc35ee9[_0x167d('0x20')](_0x9752ed,_0xdaeefe)[_0x167d('0x21')](function(_0x49e343){logger[_0x167d('0x22')](_0x167d('0x23'),_0x5191bc,_0x167d('0x24'));logger['debug'](_0x167d('0x25'),_0x5191bc,_0x167d('0x24'),JSON[_0x167d('0x26')](_0x49e343));if(_0x49e343[_0x167d('0x27')]){if(_0x49e343[_0x167d('0x27')][_0x167d('0x28')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x5191bc,_0x49e343[_0x167d('0x27')]['message']);return _0x4f056b(_0x49e343[_0x167d('0x27')][_0x167d('0x29')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x5191bc,_0x49e343[_0x167d('0x27')][_0x167d('0x29')]);return _0x43fd94(_0x49e343[_0x167d('0x27')][_0x167d('0x29')]);}else{logger['info'](_0x167d('0x23'),_0x5191bc,_0x167d('0x24'));_0x43fd94(_0x49e343[_0x167d('0x2a')][_0x167d('0x29')]);}})['catch'](function(_0x36fda8){logger[_0x167d('0x27')](_0x167d('0x23'),_0x5191bc,_0x36fda8);_0x4f056b(_0x36fda8);});});}function respondWithStatusCode(_0x3b1ad3,_0x4530eb){_0x4530eb=_0x4530eb||0xcc;return function(_0x4f09ab){if(_0x4f09ab){return _0x3b1ad3[_0x167d('0x2b')](_0x4530eb);}return _0x3b1ad3['status'](_0x4530eb)[_0x167d('0x2c')]();};}function respondWithResult(_0x143a31,_0x3d5b1c){_0x3d5b1c=_0x3d5b1c||0xc8;return function(_0xb531ce){if(_0xb531ce){return _0x143a31[_0x167d('0x2d')](_0x3d5b1c)[_0x167d('0x2e')](_0xb531ce);}};}function respondWithFilteredResult(_0x581fea,_0x276e1d){return function(_0x481e18){if(_0x481e18){var _0x382851=typeof _0x276e1d[_0x167d('0x2f')]==='undefined'&&typeof _0x276e1d[_0x167d('0x30')]===_0x167d('0x31');var _0x510d13=_0x481e18[_0x167d('0x32')];var _0x5dafc5=_0x382851?0x0:_0x276e1d[_0x167d('0x2f')];var _0x1ab301=_0x382851?_0x481e18[_0x167d('0x32')]:_0x276e1d[_0x167d('0x2f')]+_0x276e1d['limit'];var _0x511118;if(_0x1ab301>=_0x510d13){_0x1ab301=_0x510d13;_0x511118=0xc8;}else{_0x511118=0xce;}_0x581fea[_0x167d('0x2d')](_0x511118);return _0x581fea[_0x167d('0x33')](_0x167d('0x34'),_0x5dafc5+'-'+_0x1ab301+'/'+_0x510d13)[_0x167d('0x2e')](_0x481e18);}return null;};}function patchUpdates(_0x56a230){return function(_0x5d08b0){try{jsonpatch['apply'](_0x5d08b0,_0x56a230,!![]);}catch(_0x287a24){return BPromise[_0x167d('0x35')](_0x287a24);}return _0x5d08b0['save']();};}function saveUpdates(_0x1d1ae0,_0x598912){return function(_0x3d15d3){if(_0x3d15d3){return _0x3d15d3[_0x167d('0x36')](_0x1d1ae0)[_0x167d('0x21')](function(_0x4d7031){return _0x4d7031;});}return null;};}function removeEntity(_0x6fd6dd,_0xaf739c){return function(_0xf0ff0d){if(_0xf0ff0d){return _0xf0ff0d[_0x167d('0x37')]()['then'](function(){var _0x232328=_0xf0ff0d['get']({'plain':!![]});var _0x2f9a9d=_0x167d('0x38');return db[_0x167d('0x39')][_0x167d('0x37')]({'where':{'type':_0x2f9a9d,'resourceId':_0x232328['id']}})[_0x167d('0x21')](function(){return _0xf0ff0d;});})['then'](function(){_0x6fd6dd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x841298,_0x316c06){return function(_0x1df4b4){if(!_0x1df4b4){_0x841298[_0x167d('0x2b')](0x194);}return _0x1df4b4;};}function handleError(_0x2a1723,_0xcb3217){_0xcb3217=_0xcb3217||0x1f4;return function(_0x16fac2){logger[_0x167d('0x27')](_0x16fac2[_0x167d('0x3a')]);if(_0x16fac2[_0x167d('0x3b')]){delete _0x16fac2['name'];}_0x2a1723[_0x167d('0x2d')](_0xcb3217)['send'](_0x16fac2);};}exports[_0x167d('0x3c')]=function(_0xa3ef44,_0x183a4e){var _0x1b6b52={'include':[{'model':db['Pause'],'as':_0x167d('0x3d')}]},_0x2e8c7c={},_0x2c39c7={'count':0x0,'rows':[]};var _0xee6f7a=_[_0x167d('0x3e')](db[_0x167d('0x3f')][_0x167d('0x40')],function(_0x1048d3){return{'name':_0x1048d3[_0x167d('0x41')],'type':_0x1048d3[_0x167d('0x42')]['key']};});_0x2e8c7c[_0x167d('0x43')]=_[_0x167d('0x3e')](_0xee6f7a,_0x167d('0x3b'));_0x2e8c7c[_0x167d('0x44')]=_['keys'](_0xa3ef44[_0x167d('0x44')]);_0x2e8c7c[_0x167d('0x45')]=_['intersection'](_0x2e8c7c['model'],_0x2e8c7c[_0x167d('0x44')]);_0x1b6b52[_0x167d('0x46')]=_['intersection'](_0x2e8c7c[_0x167d('0x43')],qs['fields'](_0xa3ef44[_0x167d('0x44')][_0x167d('0x47')]));_0x1b6b52['attributes']=_0x1b6b52[_0x167d('0x46')]['length']?_0x1b6b52[_0x167d('0x46')]:_0x2e8c7c[_0x167d('0x43')];if(!_0xa3ef44[_0x167d('0x44')][_0x167d('0x48')](_0x167d('0x49'))){_0x1b6b52[_0x167d('0x30')]=qs[_0x167d('0x30')](_0xa3ef44[_0x167d('0x44')][_0x167d('0x30')]);_0x1b6b52[_0x167d('0x2f')]=qs['offset'](_0xa3ef44[_0x167d('0x44')][_0x167d('0x2f')]);}_0x1b6b52[_0x167d('0x4a')]=qs[_0x167d('0x4b')](_0xa3ef44[_0x167d('0x44')][_0x167d('0x4b')]);_0x1b6b52[_0x167d('0x4c')]=qs[_0x167d('0x45')](_[_0x167d('0x4d')](_0xa3ef44[_0x167d('0x44')],_0x2e8c7c[_0x167d('0x45')]),_0xee6f7a);if(_0xa3ef44[_0x167d('0x44')][_0x167d('0x4e')]){_0x1b6b52['where']=_[_0x167d('0x4f')](_0x1b6b52[_0x167d('0x4c')],{'$or':_[_0x167d('0x3e')](_0xee6f7a,function(_0x258a94){if(_0x258a94[_0x167d('0x42')]!==_0x167d('0x50')){var _0x4a94ec={};_0x4a94ec[_0x258a94['name']]={'$like':'%'+_0xa3ef44[_0x167d('0x44')]['filter']+'%'};return _0x4a94ec;}})});}_0x1b6b52=_[_0x167d('0x4f')]({},_0x1b6b52,_0xa3ef44['options']);var _0x10e1b9={'where':_0x1b6b52[_0x167d('0x4c')]};return db[_0x167d('0x3f')][_0x167d('0x32')](_0x10e1b9)[_0x167d('0x21')](function(_0x390e4f){_0x2c39c7[_0x167d('0x32')]=_0x390e4f;if(_0xa3ef44['query'][_0x167d('0x51')]){_0x1b6b52[_0x167d('0x52')]=[{'all':!![]}];}return db[_0x167d('0x3f')][_0x167d('0x53')](_0x1b6b52);})['then'](function(_0x3b5797){_0x2c39c7[_0x167d('0x54')]=_0x3b5797;return _0x2c39c7;})[_0x167d('0x21')](respondWithFilteredResult(_0x183a4e,_0x1b6b52))[_0x167d('0x55')](handleError(_0x183a4e,null));};exports[_0x167d('0x56')]=function(_0x2afd3c,_0x2cb32b){var _0x1cb5d8={'raw':![],'where':{'id':_0x2afd3c[_0x167d('0x57')]['id']},'include':[{'model':db[_0x167d('0x58')],'as':_0x167d('0x3d')}]},_0x216221={};_0x216221[_0x167d('0x43')]=_[_0x167d('0x59')](db[_0x167d('0x3f')][_0x167d('0x40')]);_0x216221[_0x167d('0x44')]=_['keys'](_0x2afd3c[_0x167d('0x44')]);_0x216221[_0x167d('0x45')]=_['intersection'](_0x216221[_0x167d('0x43')],_0x216221[_0x167d('0x44')]);_0x1cb5d8[_0x167d('0x46')]=_[_0x167d('0x5a')](_0x216221[_0x167d('0x43')],qs[_0x167d('0x47')](_0x2afd3c[_0x167d('0x44')]['fields']));_0x1cb5d8[_0x167d('0x46')]=_0x1cb5d8[_0x167d('0x46')][_0x167d('0x5b')]?_0x1cb5d8[_0x167d('0x46')]:_0x216221[_0x167d('0x43')];if(_0x2afd3c['query'][_0x167d('0x51')]){_0x1cb5d8[_0x167d('0x52')]=[{'all':!![]}];}_0x1cb5d8=_['merge']({},_0x1cb5d8,_0x2afd3c[_0x167d('0x5c')]);return db[_0x167d('0x3f')][_0x167d('0x5d')](_0x1cb5d8)[_0x167d('0x21')](handleEntityNotFound(_0x2cb32b,null))[_0x167d('0x21')](respondWithResult(_0x2cb32b,null))[_0x167d('0x55')](handleError(_0x2cb32b,null));};exports[_0x167d('0x5e')]=function(_0x2a7ebb,_0x375ca4){return db['OpenchannelAccount'][_0x167d('0x5e')](_0x2a7ebb['body'],{})[_0x167d('0x21')](function(_0x2ddcb6){var _0x51e87e=_0x2a7ebb['user'][_0x167d('0x5f')]({'plain':!![]});if(!_0x51e87e)throw new Error(_0x167d('0x60'));if(_0x51e87e['role']===_0x167d('0x61')){var _0x52b2e5=_0x2ddcb6[_0x167d('0x5f')]({'plain':!![]});var _0x28cd07=_0x167d('0x38');return db[_0x167d('0x62')][_0x167d('0x5d')]({'where':{'name':_0x28cd07,'userProfileId':_0x51e87e[_0x167d('0x63')]},'raw':!![]})['then'](function(_0x425f8f){if(_0x425f8f&&_0x425f8f[_0x167d('0x64')]===0x0){return db[_0x167d('0x39')][_0x167d('0x5e')]({'name':_0x52b2e5[_0x167d('0x3b')],'resourceId':_0x52b2e5['id'],'type':_0x425f8f['name'],'sectionId':_0x425f8f['id']},{})['then'](function(){return _0x2ddcb6;});}else{return _0x2ddcb6;}})[_0x167d('0x55')](function(_0x26475a){logger[_0x167d('0x27')](_0x167d('0x65'),_0x26475a);throw _0x26475a;});}return _0x2ddcb6;})[_0x167d('0x21')](respondWithResult(_0x375ca4,0xc9))[_0x167d('0x55')](handleError(_0x375ca4,null));};exports['update']=function(_0xc86e2,_0x2cec70){if(_0xc86e2[_0x167d('0x66')]['id']){delete _0xc86e2[_0x167d('0x66')]['id'];}return db[_0x167d('0x3f')][_0x167d('0x5d')]({'where':{'id':_0xc86e2[_0x167d('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x167d('0x3d')}]})[_0x167d('0x21')](handleEntityNotFound(_0x2cec70,null))[_0x167d('0x21')](saveUpdates(_0xc86e2[_0x167d('0x66')],null))['then'](respondWithResult(_0x2cec70,null))[_0x167d('0x55')](handleError(_0x2cec70,null));};exports[_0x167d('0x37')]=function(_0x53c2da,_0x1a1598){return db[_0x167d('0x3f')][_0x167d('0x5d')]({'where':{'id':_0x53c2da[_0x167d('0x57')]['id']}})[_0x167d('0x21')](handleEntityNotFound(_0x1a1598,null))['then'](removeEntity(_0x1a1598,null))[_0x167d('0x55')](handleError(_0x1a1598,null));};exports['describe']=function(_0x2dc53d,_0x42b194){return db[_0x167d('0x3f')]['describe']()[_0x167d('0x21')](respondWithResult(_0x42b194,null))[_0x167d('0x55')](handleError(_0x42b194,null));};exports[_0x167d('0x67')]=function(_0x4370ff,_0x106d77,_0x37cf06){if(_0x4370ff[_0x167d('0x66')]['id']){delete _0x4370ff[_0x167d('0x66')]['id'];}return db[_0x167d('0x3f')][_0x167d('0x5d')]({'where':{'id':_0x4370ff['params']['id']}})['then'](handleEntityNotFound(_0x106d77,null))[_0x167d('0x21')](function(_0x1745ed){if(_0x1745ed){_0x4370ff[_0x167d('0x66')][_0x167d('0x68')]=_0x1745ed['id'];return db[_0x167d('0x69')][_0x167d('0x5e')](_0x4370ff[_0x167d('0x66')]);}})[_0x167d('0x21')](respondWithResult(_0x106d77,null))[_0x167d('0x55')](handleError(_0x106d77,null));};exports[_0x167d('0x6a')]=function(_0x5b9e22,_0x59ee26,_0x18c1df){var _0x3aac77={'raw':![],'where':{}};var _0x25f79e={};var _0x556bf5={'count':0x0,'rows':[]};return db[_0x167d('0x3f')][_0x167d('0x6b')]({'where':{'id':_0x5b9e22['params']['id']}})['then'](handleEntityNotFound(_0x59ee26,null))[_0x167d('0x21')](function(_0x21b941){if(_0x21b941){_0x25f79e[_0x167d('0x43')]=_['keys'](db[_0x167d('0x69')][_0x167d('0x40')]);_0x25f79e[_0x167d('0x44')]=_[_0x167d('0x59')](_0x5b9e22[_0x167d('0x44')]);_0x25f79e[_0x167d('0x45')]=_[_0x167d('0x5a')](_0x25f79e[_0x167d('0x43')],_0x25f79e[_0x167d('0x44')]);_0x3aac77[_0x167d('0x46')]=_['intersection'](_0x25f79e['model'],qs[_0x167d('0x47')](_0x5b9e22[_0x167d('0x44')][_0x167d('0x47')]));_0x3aac77[_0x167d('0x46')]=_0x3aac77[_0x167d('0x46')][_0x167d('0x5b')]?_0x3aac77[_0x167d('0x46')]:_0x25f79e[_0x167d('0x43')];if(!_0x5b9e22[_0x167d('0x44')][_0x167d('0x48')](_0x167d('0x49'))){_0x3aac77[_0x167d('0x30')]=qs['limit'](_0x5b9e22[_0x167d('0x44')][_0x167d('0x30')]);_0x3aac77[_0x167d('0x2f')]=qs[_0x167d('0x2f')](_0x5b9e22[_0x167d('0x44')][_0x167d('0x2f')]);}_0x3aac77[_0x167d('0x4a')]=qs[_0x167d('0x4b')](_0x5b9e22['query']['sort']);_0x3aac77[_0x167d('0x4c')]=qs[_0x167d('0x45')](_[_0x167d('0x4d')](_0x5b9e22[_0x167d('0x44')],_0x25f79e[_0x167d('0x45')]));_0x3aac77[_0x167d('0x4c')][_0x167d('0x68')]=_0x21b941['id'];if(_0x5b9e22[_0x167d('0x44')][_0x167d('0x4e')]){_0x3aac77[_0x167d('0x4c')]=_['merge'](_0x3aac77[_0x167d('0x4c')],{'$or':_['map'](_0x3aac77[_0x167d('0x46')],function(_0x4957f5){var _0x449a97={};_0x449a97[_0x4957f5]={'$like':'%'+_0x5b9e22[_0x167d('0x44')]['filter']+'%'};return _0x449a97;})});}_0x3aac77=_['merge']({},_0x3aac77,_0x5b9e22[_0x167d('0x5c')]);return db[_0x167d('0x69')]['count']({'where':_0x3aac77['where']})[_0x167d('0x21')](function(_0x1aa2c2){_0x556bf5[_0x167d('0x32')]=_0x1aa2c2;if(_0x5b9e22[_0x167d('0x44')][_0x167d('0x51')]){_0x3aac77[_0x167d('0x52')]=[{'all':!![]}];}return db[_0x167d('0x69')][_0x167d('0x53')](_0x3aac77);})['then'](function(_0x3f8b23){_0x556bf5[_0x167d('0x54')]=_0x3f8b23;return _0x556bf5;});}})[_0x167d('0x21')](respondWithFilteredResult(_0x59ee26,_0x3aac77))['catch'](handleError(_0x59ee26,null));};exports[_0x167d('0x6c')]=function(_0x5724e0,_0x577a7f,_0x1924bb){return db[_0x167d('0x3f')][_0x167d('0x5d')]({'where':{'id':_0x5724e0[_0x167d('0x57')]['id']}})[_0x167d('0x21')](handleEntityNotFound(_0x577a7f,null))[_0x167d('0x21')](function(_0x358d55){if(_0x358d55){return _0x358d55['removeDispositions'](_0x5724e0[_0x167d('0x44')]['ids']);}})['then'](respondWithStatusCode(_0x577a7f,null))[_0x167d('0x55')](handleError(_0x577a7f,null));};exports[_0x167d('0x6d')]=function(_0x2e775f,_0x1d5f82,_0x7b5ae4){if(_0x2e775f[_0x167d('0x66')]['id']){delete _0x2e775f[_0x167d('0x66')]['id'];}return db['OpenchannelAccount'][_0x167d('0x5d')]({'where':{'id':_0x2e775f['params']['id']}})[_0x167d('0x21')](handleEntityNotFound(_0x1d5f82,null))[_0x167d('0x21')](function(_0x340d7b){if(_0x340d7b){_0x2e775f[_0x167d('0x66')][_0x167d('0x68')]=_0x340d7b['id'];return db[_0x167d('0x6e')]['create'](_0x2e775f[_0x167d('0x66')]);}})['then'](respondWithResult(_0x1d5f82,null))[_0x167d('0x55')](handleError(_0x1d5f82,null));};exports[_0x167d('0x6f')]=function(_0x2e48a7,_0x418d8c,_0xd25798){var _0x35f399={'raw':![],'where':{}};var _0x3bcb2d={};var _0x55ddb6={'count':0x0,'rows':[]};return db[_0x167d('0x3f')][_0x167d('0x6b')]({'where':{'id':_0x2e48a7[_0x167d('0x57')]['id']}})[_0x167d('0x21')](handleEntityNotFound(_0x418d8c,null))['then'](function(_0x3bbcee){if(_0x3bbcee){_0x3bcb2d[_0x167d('0x43')]=_['keys'](db['CannedAnswer'][_0x167d('0x40')]);_0x3bcb2d['query']=_['keys'](_0x2e48a7[_0x167d('0x44')]);_0x3bcb2d['filters']=_[_0x167d('0x5a')](_0x3bcb2d['model'],_0x3bcb2d[_0x167d('0x44')]);_0x35f399[_0x167d('0x46')]=_['intersection'](_0x3bcb2d[_0x167d('0x43')],qs[_0x167d('0x47')](_0x2e48a7[_0x167d('0x44')][_0x167d('0x47')]));_0x35f399[_0x167d('0x46')]=_0x35f399[_0x167d('0x46')][_0x167d('0x5b')]?_0x35f399[_0x167d('0x46')]:_0x3bcb2d['model'];if(!_0x2e48a7[_0x167d('0x44')]['hasOwnProperty'](_0x167d('0x49'))){_0x35f399[_0x167d('0x30')]=qs['limit'](_0x2e48a7[_0x167d('0x44')][_0x167d('0x30')]);_0x35f399[_0x167d('0x2f')]=qs['offset'](_0x2e48a7['query']['offset']);}_0x35f399[_0x167d('0x4a')]=qs[_0x167d('0x4b')](_0x2e48a7[_0x167d('0x44')][_0x167d('0x4b')]);_0x35f399['where']=qs[_0x167d('0x45')](_[_0x167d('0x4d')](_0x2e48a7[_0x167d('0x44')],_0x3bcb2d['filters']));_0x35f399[_0x167d('0x4c')][_0x167d('0x68')]=_0x3bbcee['id'];if(_0x2e48a7['query']['filter']){_0x35f399['where']=_[_0x167d('0x4f')](_0x35f399['where'],{'$or':_[_0x167d('0x3e')](_0x35f399['attributes'],function(_0xdcd0f6){var _0x306aee={};_0x306aee[_0xdcd0f6]={'$like':'%'+_0x2e48a7[_0x167d('0x44')][_0x167d('0x4e')]+'%'};return _0x306aee;})});}_0x35f399=_[_0x167d('0x4f')]({},_0x35f399,_0x2e48a7[_0x167d('0x5c')]);return db[_0x167d('0x6e')][_0x167d('0x32')]({'where':_0x35f399[_0x167d('0x4c')]})[_0x167d('0x21')](function(_0x3f55a5){_0x55ddb6[_0x167d('0x32')]=_0x3f55a5;if(_0x2e48a7[_0x167d('0x44')][_0x167d('0x51')]){_0x35f399[_0x167d('0x52')]=[{'all':!![]}];}return db[_0x167d('0x6e')]['findAll'](_0x35f399);})[_0x167d('0x21')](function(_0x480068){_0x55ddb6[_0x167d('0x54')]=_0x480068;return _0x55ddb6;});}})['then'](respondWithFilteredResult(_0x418d8c,_0x35f399))['catch'](handleError(_0x418d8c,null));};exports['removeAnswers']=function(_0x110f26,_0x359dab,_0x2a2f50){return db[_0x167d('0x3f')][_0x167d('0x5d')]({'where':{'id':_0x110f26['params']['id']}})['then'](handleEntityNotFound(_0x359dab,null))[_0x167d('0x21')](function(_0x30f482){if(_0x30f482){return _0x30f482[_0x167d('0x70')](_0x110f26[_0x167d('0x44')][_0x167d('0x71')]);}})[_0x167d('0x21')](respondWithStatusCode(_0x359dab,null))[_0x167d('0x55')](handleError(_0x359dab,null));};exports[_0x167d('0x72')]=function(_0x533fa5,_0x377c38,_0x36dff7){var _0x3ad5bf={'body':_0x533fa5[_0x167d('0x66')],'channel':_0x167d('0x73')};var _0x492176=[];var _0x33508f=[];var _0x4b0522={};var _0x533b48=![];return db[_0x167d('0x74')][_0x167d('0x75')]()[_0x167d('0x21')](function(_0x4518f0){if(!_0x4518f0){throw new db['Sequelize'][(_0x167d('0x76'))](_0x167d('0x77'));}_0x492176=_[_0x167d('0x78')](_['keys'](_0x4518f0),[_0x167d('0x79'),_0x167d('0x7a')]);_0x33508f=_[_0x167d('0x78')](_[_0x167d('0x59')](_0x4518f0),['createdAt','updatedAt',_0x167d('0x7b'),_0x167d('0x7c')]);if(_0x533fa5[_0x167d('0x66')]['id']){delete _0x533fa5[_0x167d('0x66')]['id'];}if(_[_0x167d('0x7d')](_0x533fa5[_0x167d('0x66')][_0x167d('0x7e')])){throw new db[(_0x167d('0x7f'))][(_0x167d('0x76'))](_0x167d('0x80'));}if(_[_0x167d('0x7d')](_0x533fa5[_0x167d('0x66')][_0x167d('0x66')])||_0x533fa5[_0x167d('0x66')]['body']===''){throw new db[(_0x167d('0x7f'))][(_0x167d('0x76'))](_0x167d('0x81'));}if(_['isNil'](_0x533fa5[_0x167d('0x66')][_0x167d('0x82')])){throw new db['Sequelize'][(_0x167d('0x76'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x33508f);}if(!_[_0x167d('0x83')](_0x33508f,_0x533fa5[_0x167d('0x66')]['mapKey'])){throw new db[(_0x167d('0x7f'))][(_0x167d('0x76'))](_0x167d('0x84')+_0x33508f);}_0x4b0522[_0x533fa5[_0x167d('0x66')]['mapKey']]=_0x533fa5['body'][_0x167d('0x7e')];})[_0x167d('0x21')](function(){return db['OpenchannelAccount'][_0x167d('0x5d')]({'where':{'id':_0x533fa5[_0x167d('0x57')]['id']},'include':[{'model':db['CmList'],'as':_0x167d('0x85'),'include':[{'model':db[_0x167d('0x74')],'as':_0x167d('0x86'),'where':_0x4b0522,'limit':0x1,'order':[[_0x167d('0x7a'),_0x167d('0x87')]]}]},{'model':db[_0x167d('0x88')],'as':_0x167d('0x89')}]});})[_0x167d('0x21')](handleEntityNotFound(_0x377c38,null))[_0x167d('0x21')](function(_0x2c19dc){if(_0x2c19dc&&_0x2c19dc[_0x167d('0x85')]){_0x3ad5bf[_0x167d('0x8a')]=_0x2c19dc;_0x3ad5bf[_0x167d('0x8b')]=_0x2c19dc[_0x167d('0x89')];_0x3ad5bf[_0x167d('0x8c')]=_0x2c19dc[_0x167d('0x85')];_0x3ad5bf[_0x167d('0x8b')]=_[_0x167d('0x8d')](_0x3ad5bf[_0x167d('0x8b')],['priority'],[_0x167d('0x8e')]);if(_0x3ad5bf[_0x167d('0x8a')]['Applications']){delete _0x3ad5bf[_0x167d('0x8a')][_0x167d('0x89')];}if(_0x3ad5bf[_0x167d('0x8a')][_0x167d('0x85')]&&_0x3ad5bf['account'][_0x167d('0x85')][_0x167d('0x86')]['length']){return _0x3ad5bf['account'][_0x167d('0x85')][_0x167d('0x86')][0x0];}var _0x584afa=_[_0x167d('0x18')](_0x533fa5[_0x167d('0x66')],{'firstName':_0x533fa5[_0x167d('0x66')]['from'],'ListId':_0x2c19dc[_0x167d('0x7c')]});_0x584afa[_0x533fa5[_0x167d('0x66')][_0x167d('0x82')]]=_0x533fa5[_0x167d('0x66')][_0x167d('0x7e')];return db[_0x167d('0x74')]['create'](_0x584afa,{'fields':_0x492176,'raw':!![]});}})[_0x167d('0x21')](handleEntityNotFound(_0x377c38,null))[_0x167d('0x21')](function(_0x2bad69){_0x3ad5bf[_0x167d('0x8f')]=_0x2bad69;if(_0x2bad69){var _0x5163d0={'ContactId':_0x2bad69['id'],'OpenchannelAccountId':_0x533fa5[_0x167d('0x57')]['id'],'from':(_0x2bad69[_0x167d('0x90')]||'')+'\x20'+(_0x2bad69['lastName']||'')};var _0x441163={'OpenchannelAccountId':_0x533fa5[_0x167d('0x57')]['id'],'closed':![]};if(_0x533fa5[_0x167d('0x66')][_0x167d('0x91')]){_0x441163['threadId']=_0x533fa5[_0x167d('0x66')]['threadId'];return db[_0x167d('0x92')][_0x167d('0x5d')]({'where':_0x441163})['then'](function(_0x55e0df){if(_0x55e0df){return[_0x55e0df,![]];}_0x5163d0['threadId']=_0x533fa5['body']['threadId'];_0x5163d0[_0x167d('0x93')]=_0x533fa5[_0x167d('0x66')]['externalUrl'];return db[_0x167d('0x92')][_0x167d('0x5e')](_0x5163d0)[_0x167d('0x21')](function(_0x29bcd5){return[_0x29bcd5,!![]];});});}else{_0x441163['threadId']=null;}_0x441163[_0x167d('0x94')]=_0x2bad69['id'];return db[_0x167d('0x92')]['find']({'where':_0x441163})[_0x167d('0x21')](function(_0x73f554){if(_0x73f554){return[_0x73f554,![]];}return db[_0x167d('0x92')][_0x167d('0x5e')](_0x5163d0)[_0x167d('0x21')](function(_0x2b26f0){return[_0x2b26f0,!![]];});});}})[_0x167d('0x95')](function(_0x3289d0,_0x5f46e0){if(_0x3289d0){_0x533b48=_0x5f46e0;if(!_0x5f46e0){var _0x139d4c={'from':(_0x3ad5bf[_0x167d('0x8f')][_0x167d('0x90')]||'')+'\x20'+(_0x3ad5bf[_0x167d('0x8f')][_0x167d('0x96')]||'')};if(_0x533fa5[_0x167d('0x66')]['threadId']&&_0x533fa5[_0x167d('0x66')][_0x167d('0x97')]&&_0x533fa5[_0x167d('0x66')][_0x167d('0x91')]!=_0x533fa5[_0x167d('0x66')][_0x167d('0x97')]){_0x139d4c[_0x167d('0x91')]=_0x533fa5['body'][_0x167d('0x97')];}return _0x3289d0[_0x167d('0x36')](_0x139d4c);}else{return _0x3289d0;}}})[_0x167d('0x21')](function(_0x3802bc){_0x3ad5bf[_0x167d('0x98')]=_0x3802bc[_0x167d('0x5f')]({'plain':!![]});_0x3ad5bf['interaction'][_0x167d('0x99')]=_0x533b48;if(_0x3ad5bf[_0x167d('0x98')][_0x167d('0x99')]){if(_0x3ad5bf['account'][_0x167d('0x9a')]){_0x3ad5bf[_0x167d('0x8b')][_0x167d('0x9b')]({'id':0x0,'priority':_0x3ad5bf[_0x167d('0x8b')]['length']+0x1,'app':'close','appdata':_0x167d('0x9c'),'interval':_0x167d('0x9d')});}}return db['OpenchannelMessage'][_0x167d('0x5e')]({'body':_0x533fa5['body'][_0x167d('0x66')],'OpenchannelAccountId':_0x533fa5[_0x167d('0x57')]['id'],'OpenchannelInteractionId':_0x3802bc['id'],'direction':'in','ContactId':_0x3ad5bf[_0x167d('0x8f')]['id'],'AttachmentId':_0x533fa5['body']['AttachmentId']});})['then'](function(_0x367c1a){_0x3ad5bf[_0x167d('0x29')]=_0x367c1a;if(!_0x3ad5bf[_0x167d('0x98')]['UserId'])return;return db[_0x167d('0x9e')][_0x167d('0x5d')]({'attributes':['id','name'],'where':{'id':_0x3ad5bf[_0x167d('0x98')]['UserId']}});})['then'](function(_0x14b8ad){if(_0x14b8ad){_0x3ad5bf[_0x167d('0x8b')][_0x167d('0x9f')]({'id':0x0,'priority':0x0,'app':_0x167d('0xa0'),'appdata':_0x14b8ad['name']+','+(_0x3ad5bf[_0x167d('0x8a')][_0x167d('0xa1')]||0xa),'interval':_0x167d('0x9d')});}if(!_0x3ad5bf[_0x167d('0x98')][_0x167d('0xa2')])return;return db[_0x167d('0xa3')][_0x167d('0x5d')]({'attributes':['id',_0x167d('0x3b')],'where':{'id':_0x3ad5bf[_0x167d('0x98')][_0x167d('0xa2')]}});})['then'](function(_0x2e3e85){if(_0x2e3e85){_0x3ad5bf['applications'][_0x167d('0x9f')]({'id':0x0,'priority':0x1,'app':_0x167d('0xa4'),'appdata':_0x2e3e85[_0x167d('0x3b')]+','+(_0x3ad5bf['account'][_0x167d('0xa5')]||0x12c),'interval':_0x167d('0x9d')});}return respondWithRpcPromise(_0x167d('0xa6'),_0x167d('0xa7'),_0x3ad5bf);})[_0x167d('0x21')](function(_0xb84580){respondWithRpcPromise(_0x167d('0xa8'),_0x167d('0xa8'),{'event':_0x167d('0x72'),'message':_0xb84580},client9002);return _0xb84580;})[_0x167d('0x21')](respondWithResult(_0x377c38,null))['catch'](handleError(_0x377c38,null));};exports[_0x167d('0xa9')]=function(_0x32fd95,_0x3666f2){var _0x45293a=_0x32fd95[_0x167d('0x57')]['id'];var _0x2e21b=_0x32fd95[_0x167d('0x66')];var _0x5e4c02=0xc8;var _0x14a53a=null;return db[_0x167d('0xaa')][_0x167d('0xab')]({'isolationLevel':db[_0x167d('0xaa')][_0x167d('0xac')][_0x167d('0xad')][_0x167d('0xae')]},function(_0x5e8c43){return db[_0x167d('0x3f')][_0x167d('0x6b')]({'where':{'id':_0x45293a},'transaction':_0x5e8c43})['then'](function(_0x105f63){if(_0x105f63){return db[_0x167d('0x88')][_0x167d('0x37')]({'where':{'OpenchannelAccountId':_0x45293a},'transaction':_0x5e8c43})[_0x167d('0x21')](function(){var _0x4a1ca3=_[_0x167d('0x3e')](_0x2e21b,function(_0x70f681){_0x70f681[_0x167d('0x68')]=_0x45293a;return _0x70f681;});return db[_0x167d('0x88')]['bulkCreate'](_0x4a1ca3,{'transaction':_0x5e8c43});});}else{_0x5e4c02=0x194;_0x14a53a=[];}});})[_0x167d('0x21')](function(){if(_0x5e4c02!==0x194){return db['OpenchannelApplication'][_0x167d('0xaf')]({'where':{'OpenchannelAccountId':_0x45293a},'order':_0x167d('0xb0')})[_0x167d('0x21')](function(_0x1aceb0){_0x14a53a=_0x1aceb0;});}})[_0x167d('0x55')](function(_0x4c6484){_0x5e4c02=0x1f4;logger[_0x167d('0x27')](_0x4c6484[_0x167d('0x3a')]);if(_0x4c6484[_0x167d('0x3b')]){delete _0x4c6484[_0x167d('0x3b')];}_0x14a53a=_0x4c6484;})[_0x167d('0xb1')](function(){if(_0x14a53a===null){_0x3666f2[_0x167d('0x2b')](_0x5e4c02);}else{if(_0x5e4c02===0x1f4){_0x3666f2['status'](_0x5e4c02)[_0x167d('0xb2')](_0x14a53a);}else{_0x3666f2[_0x167d('0x2d')](_0x5e4c02)['json'](_0x14a53a);}}});};exports[_0x167d('0xb3')]=function(_0x5b5002,_0xabdd4e,_0x255fb1){var _0x3df0bf={};var _0x4af6e4={};var _0x6d0578;var _0x312ff6;return db['OpenchannelAccount'][_0x167d('0x6b')]({'where':{'id':_0x5b5002[_0x167d('0x57')]['id']}})['then'](handleEntityNotFound(_0xabdd4e,null))[_0x167d('0x21')](function(_0x38c6df){if(_0x38c6df){_0x6d0578=_0x38c6df;_0x4af6e4[_0x167d('0x43')]=_[_0x167d('0x59')](db[_0x167d('0x88')][_0x167d('0x40')]);_0x4af6e4['query']=_[_0x167d('0x59')](_0x5b5002[_0x167d('0x44')]);_0x4af6e4['filters']=_[_0x167d('0x5a')](_0x4af6e4['model'],_0x4af6e4[_0x167d('0x44')]);_0x3df0bf['attributes']=_[_0x167d('0x5a')](_0x4af6e4[_0x167d('0x43')],qs[_0x167d('0x47')](_0x5b5002[_0x167d('0x44')][_0x167d('0x47')]));_0x3df0bf[_0x167d('0x46')]=_0x3df0bf[_0x167d('0x46')]['length']?_0x3df0bf['attributes']:_0x4af6e4[_0x167d('0x43')];_0x3df0bf[_0x167d('0x4a')]=qs[_0x167d('0x4b')](_0x5b5002[_0x167d('0x44')][_0x167d('0x4b')]);_0x3df0bf[_0x167d('0x4c')]=qs[_0x167d('0x45')](_['pick'](_0x5b5002['query'],_0x4af6e4[_0x167d('0x45')]));if(_0x5b5002[_0x167d('0x44')][_0x167d('0x4e')]){_0x3df0bf[_0x167d('0x4c')]=_[_0x167d('0x4f')](_0x3df0bf[_0x167d('0x4c')],{'$or':_[_0x167d('0x3e')](_0x3df0bf[_0x167d('0x46')],function(_0x26954d){var _0x5b7649={};_0x5b7649[_0x26954d]={'$like':'%'+_0x5b5002[_0x167d('0x44')]['filter']+'%'};return _0x5b7649;})});}_0x3df0bf=_['merge']({},_0x3df0bf,_0x5b5002[_0x167d('0x5c')]);return _0x6d0578[_0x167d('0xb3')](_0x3df0bf);}})[_0x167d('0x21')](function(_0x2882cf){if(_0x2882cf){_0x312ff6=_0x2882cf[_0x167d('0x5b')];if(!_0x5b5002['query'][_0x167d('0x48')](_0x167d('0x49'))){_0x3df0bf[_0x167d('0x30')]=qs[_0x167d('0x30')](_0x5b5002[_0x167d('0x44')][_0x167d('0x30')]);_0x3df0bf[_0x167d('0x2f')]=qs[_0x167d('0x2f')](_0x5b5002['query'][_0x167d('0x2f')]);}return _0x6d0578[_0x167d('0xb3')](_0x3df0bf);}})[_0x167d('0x21')](function(_0x1fe657){if(_0x1fe657){return _0x1fe657?{'count':_0x312ff6,'rows':_0x1fe657}:null;}})[_0x167d('0x21')](respondWithResult(_0xabdd4e,null))[_0x167d('0x55')](handleError(_0xabdd4e,null));};exports[_0x167d('0xb4')]=function(_0x5a7db7,_0x17d09b,_0x5ad587){var _0xf8072f={'raw':![],'where':{}};var _0x129cb1={};var _0x19b3a3={'count':0x0,'rows':[]};return db[_0x167d('0x3f')]['findOne']({'where':{'id':_0x5a7db7[_0x167d('0x57')]['id']}})[_0x167d('0x21')](handleEntityNotFound(_0x17d09b,null))[_0x167d('0x21')](function(_0x16ae8c){if(_0x16ae8c){_0x129cb1[_0x167d('0x43')]=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x129cb1[_0x167d('0x44')]=_[_0x167d('0x59')](_0x5a7db7[_0x167d('0x44')]);_0x129cb1[_0x167d('0x45')]=_[_0x167d('0x5a')](_0x129cb1[_0x167d('0x43')],_0x129cb1[_0x167d('0x44')]);_0xf8072f[_0x167d('0x46')]=_[_0x167d('0x5a')](_0x129cb1[_0x167d('0x43')],qs[_0x167d('0x47')](_0x5a7db7['query']['fields']));_0xf8072f[_0x167d('0x46')]=_0xf8072f['attributes']['length']?_0xf8072f['attributes']:_0x129cb1[_0x167d('0x43')];if(!_0x5a7db7[_0x167d('0x44')][_0x167d('0x48')](_0x167d('0x49'))){_0xf8072f['limit']=qs[_0x167d('0x30')](_0x5a7db7[_0x167d('0x44')]['limit']);_0xf8072f[_0x167d('0x2f')]=qs[_0x167d('0x2f')](_0x5a7db7['query'][_0x167d('0x2f')]);}_0xf8072f[_0x167d('0x4a')]=qs['sort'](_0x5a7db7[_0x167d('0x44')][_0x167d('0x4b')]);_0xf8072f[_0x167d('0x4c')]=qs['filters'](_[_0x167d('0x4d')](_0x5a7db7['query'],_0x129cb1[_0x167d('0x45')]));_0xf8072f[_0x167d('0x4c')][_0x167d('0x68')]=_0x16ae8c['id'];if(_0x5a7db7[_0x167d('0x44')]['filter']){_0xf8072f[_0x167d('0x4c')]=_[_0x167d('0x4f')](_0xf8072f[_0x167d('0x4c')],{'$or':_[_0x167d('0x3e')](_0xf8072f['attributes'],function(_0x261faa){var _0x5bf95e={};_0x5bf95e[_0x261faa]={'$like':'%'+_0x5a7db7[_0x167d('0x44')][_0x167d('0x4e')]+'%'};return _0x5bf95e;})});}_0xf8072f=_['merge']({},_0xf8072f,_0x5a7db7['options']);return db['OpenchannelInteraction'][_0x167d('0x32')]({'where':_0xf8072f[_0x167d('0x4c')]})[_0x167d('0x21')](function(_0x1b3ece){_0x19b3a3[_0x167d('0x32')]=_0x1b3ece;if(_0x5a7db7[_0x167d('0x44')][_0x167d('0x51')]){_0xf8072f[_0x167d('0x52')]=[{'model':db[_0x167d('0x74')],'as':_0x167d('0xb5'),'required':![]},{'model':db[_0x167d('0x9e')],'as':_0x167d('0xb6'),'attributes':[_0x167d('0x3b'),_0x167d('0xb7'),_0x167d('0xb8')],'required':![]},{'model':db['Tag'],'as':_0x167d('0xb9'),'attributes':['id',_0x167d('0x3b'),_0x167d('0xba')],'where':_0x5a7db7[_0x167d('0x44')]['tag']?{'id':_0x5a7db7[_0x167d('0x44')]['tag']}:undefined,'required':_0x5a7db7[_0x167d('0x44')][_0x167d('0xbb')]?!![]:![]}];}return db[_0x167d('0x92')][_0x167d('0x53')](_0xf8072f);})['then'](function(_0xefe99c){_0x19b3a3['rows']=_0xefe99c;return _0x19b3a3;});}})['then'](respondWithFilteredResult(_0x17d09b,_0xf8072f))['catch'](handleError(_0x17d09b,null));};exports[_0x167d('0xbc')]=function(_0x430f1c,_0x45c412,_0x13bc4e){return db[_0x167d('0x3f')][_0x167d('0x5d')]({'where':{'id':_0x430f1c['params']['id']}})[_0x167d('0x21')](handleEntityNotFound(_0x45c412,null))['then'](function(_0x2ca645){if(_0x2ca645){return _0x2ca645[_0x167d('0xbc')](_0x430f1c[_0x167d('0x66')][_0x167d('0x71')],_[_0x167d('0xbd')](_0x430f1c[_0x167d('0x66')],[_0x167d('0x71'),'id'])||{})['spread'](function(_0x2a443c){for(var _0x3714eb=0x0;_0x3714eb<_0x430f1c['body']['ids']['length'];_0x3714eb+=0x1){socket[_0x167d('0xbe')]('userOpenchannelAccount:save',{'UserId':Number(_0x430f1c[_0x167d('0x66')][_0x167d('0x71')][_0x3714eb]),'OpenchannelAccountId':Number(_0x430f1c[_0x167d('0x57')]['id'])});}return _0x2a443c;});}})[_0x167d('0x21')](respondWithResult(_0x45c412,null))[_0x167d('0x55')](handleError(_0x45c412,null));};exports['removeAgents']=function(_0x2bf911,_0x3208d3,_0x4c8bd9){return db['OpenchannelAccount'][_0x167d('0x5d')]({'where':{'id':_0x2bf911[_0x167d('0x57')]['id']}})[_0x167d('0x21')](handleEntityNotFound(_0x3208d3,null))[_0x167d('0x21')](function(_0x306d35){if(_0x306d35){return _0x306d35[_0x167d('0xbf')](_0x2bf911[_0x167d('0x44')]['ids'])[_0x167d('0x21')](function(){if(_[_0x167d('0xc0')](_0x2bf911[_0x167d('0x44')][_0x167d('0x71')])){for(var _0x515c41=0x0;_0x515c41<_0x2bf911['query']['ids'][_0x167d('0x5b')];_0x515c41+=0x1){socket[_0x167d('0xbe')]('userOpenchannelAccount:remove',{'UserId':Number(_0x2bf911['query']['ids'][_0x515c41]),'OpenchannelAccountId':Number(_0x2bf911[_0x167d('0x57')]['id'])});}}else{socket[_0x167d('0xbe')]('userOpenchannelAccount:remove',{'UserId':Number(_0x2bf911[_0x167d('0x44')][_0x167d('0x71')]),'OpenchannelAccountId':Number(_0x2bf911[_0x167d('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x3208d3,null))['catch'](handleError(_0x3208d3,null));};exports[_0x167d('0xc1')]=function(_0x21cab2,_0x163758,_0x27f61e){var _0x57f405={};var _0x3994b3={};var _0x10dd42;var _0x231578;return db[_0x167d('0x3f')][_0x167d('0x6b')]({'where':{'id':_0x21cab2['params']['id']}})[_0x167d('0x21')](handleEntityNotFound(_0x163758,null))['then'](function(_0x1a66b1){if(_0x1a66b1){_0x10dd42=_0x1a66b1;_0x3994b3[_0x167d('0x43')]=_['keys'](db[_0x167d('0x9e')][_0x167d('0x40')]);_0x3994b3[_0x167d('0x44')]=_[_0x167d('0x59')](_0x21cab2[_0x167d('0x44')]);_0x3994b3[_0x167d('0x45')]=_['intersection'](_0x3994b3[_0x167d('0x43')],_0x3994b3[_0x167d('0x44')]);_0x57f405[_0x167d('0x46')]=_['intersection'](_0x3994b3[_0x167d('0x43')],qs[_0x167d('0x47')](_0x21cab2[_0x167d('0x44')]['fields']));_0x57f405[_0x167d('0x46')]=_0x57f405[_0x167d('0x46')]['length']?_0x57f405[_0x167d('0x46')]:_0x3994b3['model'];_0x57f405[_0x167d('0x4a')]=qs[_0x167d('0x4b')](_0x21cab2[_0x167d('0x44')]['sort']);_0x57f405[_0x167d('0x4c')]=qs[_0x167d('0x45')](_[_0x167d('0x4d')](_0x21cab2[_0x167d('0x44')],_0x3994b3[_0x167d('0x45')]));if(_0x21cab2[_0x167d('0x44')][_0x167d('0x4e')]){_0x57f405[_0x167d('0x4c')]=_[_0x167d('0x4f')](_0x57f405[_0x167d('0x4c')],{'$or':_[_0x167d('0x3e')](_0x57f405['attributes'],function(_0x2d7bf1){var _0x2a4ed1={};_0x2a4ed1[_0x2d7bf1]={'$like':'%'+_0x21cab2[_0x167d('0x44')][_0x167d('0x4e')]+'%'};return _0x2a4ed1;})});}_0x57f405=_[_0x167d('0x4f')]({},_0x57f405,_0x21cab2[_0x167d('0x5c')]);return _0x10dd42[_0x167d('0xc1')](_0x57f405);}})['then'](function(_0xa8c5b){if(_0xa8c5b){_0x231578=_0xa8c5b[_0x167d('0x5b')];if(!_0x21cab2['query'][_0x167d('0x48')](_0x167d('0x49'))){_0x57f405['limit']=qs[_0x167d('0x30')](_0x21cab2[_0x167d('0x44')][_0x167d('0x30')]);_0x57f405[_0x167d('0x2f')]=qs[_0x167d('0x2f')](_0x21cab2[_0x167d('0x44')][_0x167d('0x2f')]);}return _0x10dd42[_0x167d('0xc1')](_0x57f405);}})[_0x167d('0x21')](function(_0x9924b9){if(_0x9924b9){return _0x9924b9?{'count':_0x231578,'rows':_0x9924b9}:null;}})[_0x167d('0x21')](respondWithResult(_0x163758,null))[_0x167d('0x55')](handleError(_0x163758,null));};exports[_0x167d('0xb2')]=function(_0x152300,_0x4b3359,_0x383346){var _0x204c0a,_0x5504cf,_0x23f172;if(_[_0x167d('0x7d')](_0x152300[_0x167d('0x66')][_0x167d('0x66')])||_0x152300['body'][_0x167d('0x66')]===''){throw new db[(_0x167d('0x7f'))]['ValidationError'](_0x167d('0x81'));}if(_[_0x167d('0x7d')](_0x152300[_0x167d('0x66')]['to'])){}_0x204c0a=_0x152300[_0x167d('0x66')]['to'];return db[_0x167d('0x3f')]['findOne']({'where':{'id':_0x152300[_0x167d('0x57')]['id']}})[_0x167d('0x21')](handleEntityNotFound(_0x4b3359,null))[_0x167d('0x21')](function(_0xb63874){if(_0xb63874){return db[_0x167d('0x3f')]['find']({'where':{'id':_0xb63874['id']},'include':[{'model':db[_0x167d('0xc2')],'as':_0x167d('0x85'),'include':[{'model':db[_0x167d('0x74')],'as':_0x167d('0x86'),'where':{[_0xb63874['mapKey']]:_0x204c0a},'limit':0x1,'order':[[_0x167d('0x7a'),_0x167d('0x87')]]}]}]})[_0x167d('0x21')](handleEntityNotFound(_0x4b3359,null))[_0x167d('0x21')](function(_0x14d008){if(_0x14d008&&_0x14d008['List']){_0x5504cf=_0x14d008[_0x167d('0x5f')]({'plain':!![]});if(_0x5504cf[_0x167d('0x85')]&&_0x5504cf['List'][_0x167d('0x86')]['length']){return _0x5504cf['List'][_0x167d('0x86')][0x0];}return db[_0x167d('0x74')][_0x167d('0x5e')](_['defaults'](_0x152300['body'],{'firstName':_0x204c0a,[_0x14d008[_0x167d('0x82')]]:_0x204c0a,'phone':_0x204c0a,'ListId':_0x5504cf[_0x167d('0x7c')]}));}})[_0x167d('0x21')](handleEntityNotFound(_0x4b3359,null))[_0x167d('0x21')](function(_0x5837d4){if(_0x5837d4){_0x23f172=_0x5837d4;return db[_0x167d('0x92')][_0x167d('0x5d')]({'where':{'ContactId':_0x23f172['id'],'closed':![],'OpenchannelAccountId':_0x5504cf['id']}})['then'](function(_0x1116ed){if(_0x1116ed){return[_0x1116ed,![]];}return db[_0x167d('0x92')][_0x167d('0x5e')]({'UserId':_0x152300[_0x167d('0x61')]['id'],'ContactId':_0x23f172['id'],'OpenchannelAccountId':_0x5504cf['id'],'lastMsgDirection':_0x167d('0xc3'),'firstMsgDirection':_0x167d('0xc3'),'Messages':[_[_0x167d('0x4f')](_0x152300[_0x167d('0x66')],{'read':![],'body':_0x152300[_0x167d('0x66')][_0x167d('0x66')],'OpenchannelAccountId':_0x5504cf['id'],'UserId':_0x152300[_0x167d('0x61')]['id'],'ContactId':_0x23f172['id']})]},{'include':[{'model':db[_0x167d('0xc4')],'as':_0x167d('0xc5')}]})['then'](function(_0x1abafa){return[_0x1abafa,!![]];});});}})[_0x167d('0x95')](function(_0x1f1c0b,_0x3116f5){if(_0x3116f5){return _0x1f1c0b;}return db[_0x167d('0xc4')]['create'](_[_0x167d('0x4f')](_0x152300['body'],{'read':![],'body':_0x152300[_0x167d('0x66')][_0x167d('0x66')],'OpenchannelAccountId':_0x5504cf['id'],'OpenchannelInteractionId':_0x1f1c0b['id'],'UserId':_0x152300['user']['id'],'ContactId':_0x23f172['id']}))['then'](function(_0xe1348c){_0x1f1c0b[_0x167d('0xc6')][_0x167d('0xc5')]=[];_0x1f1c0b['dataValues'][_0x167d('0xc5')]['push'](_0xe1348c[_0x167d('0xc6')]);return _0x1f1c0b;});});}})[_0x167d('0x21')](respondWithResult(_0x4b3359,null))['catch'](handleError(_0x4b3359,null));}; \ No newline at end of file +var _0xc359=['OpenchannelAccountId','getDispositions','findOne','Disposition','rawAttributes','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','notify','openchannel','CmContact','Sequelize','updatedAt','difference','createdAt','CompanyId','isNil','from','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','List','OpenchannelApplication','Applications','account','list','orderBy','applications','asc','Contacts','threadId','externalUrl','OpenchannelInteraction','ContactId','contact','firstName','lastName','messageId','interaction','created','autoclose','close','*,*,*,*','OpenchannelMessage','UserId','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','sequelize','Transaction','READ_COMMITTED','findAndCountAll','priority','finally','send','getApplications','getInteractions','Contact','User','Owner','internal','Tag','Tags','color','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','DESC','ListId','dataValues','Messages','push','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','index','Pause','OpenchannelAccount','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','rows','show','params','mandatoryDispositionPause','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition'];(function(_0x2bdd83,_0x313bcd){var _0xe70e72=function(_0x512e1c){while(--_0x512e1c){_0x2bdd83['push'](_0x2bdd83['shift']());}};_0xe70e72(++_0x313bcd);}(_0xc359,0x1d9));var _0x9c35=function(_0x3f6426,_0x12cbf9){_0x3f6426=_0x3f6426-0x0;var _0x25d790=_0xc359[_0x3f6426];return _0x25d790;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9c35('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9c35('0x1'));var rp=require(_0x9c35('0x2'));var moment=require(_0x9c35('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9c35('0x4'));var util=require('util');var path=require(_0x9c35('0x5'));var sox=require('sox');var csv=require(_0x9c35('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9c35('0x7'));var jsforce=require(_0x9c35('0x8'));var deskjs=require(_0x9c35('0x9'));var toCsv=require(_0x9c35('0x6'));var querystring=require(_0x9c35('0xa'));var Papa=require(_0x9c35('0xb'));var Redis=require('ioredis');var authService=require(_0x9c35('0xc'));var qs=require(_0x9c35('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9c35('0xe'));var utils=require('../../config/utils');var config=require(_0x9c35('0xf'));var licenseUtil=require(_0x9c35('0x10'));var db=require(_0x9c35('0x11'))['db'];config['redis']=_[_0x9c35('0x12')](config[_0x9c35('0x13')],{'host':_0x9c35('0x14'),'port':0x18eb});var socket=require(_0x9c35('0x15'))(new Redis(config[_0x9c35('0x13')]));require('./openchannelAccount.socket')[_0x9c35('0x16')](socket);var jayson=require(_0x9c35('0x17'));var client=jayson[_0x9c35('0x18')][_0x9c35('0x19')]({'port':0x232c});var client9002=jayson[_0x9c35('0x18')][_0x9c35('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x9e7d2d,_0x77588e,_0x34b72d,_0x2b2c2b){return new BPromise(function(_0x387dd7,_0x2e8ec1){var _0x1ef1d8=_0x2b2c2b||client;return _0x1ef1d8[_0x9c35('0x1a')](_0x9e7d2d,_0x34b72d)[_0x9c35('0x1b')](function(_0x4cbeb6){logger[_0x9c35('0x1c')](_0x9c35('0x1d'),_0x77588e,_0x9c35('0x1e'));logger[_0x9c35('0x1f')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x77588e,_0x9c35('0x1e'),JSON[_0x9c35('0x20')](_0x4cbeb6));if(_0x4cbeb6[_0x9c35('0x21')]){if(_0x4cbeb6[_0x9c35('0x21')][_0x9c35('0x22')]===0x1f4){logger['error'](_0x9c35('0x1d'),_0x77588e,_0x4cbeb6['error'][_0x9c35('0x23')]);return _0x2e8ec1(_0x4cbeb6[_0x9c35('0x21')][_0x9c35('0x23')]);}logger[_0x9c35('0x21')](_0x9c35('0x1d'),_0x77588e,_0x4cbeb6[_0x9c35('0x21')][_0x9c35('0x23')]);return _0x387dd7(_0x4cbeb6['error']['message']);}else{logger[_0x9c35('0x1c')](_0x9c35('0x1d'),_0x77588e,_0x9c35('0x1e'));_0x387dd7(_0x4cbeb6[_0x9c35('0x24')]['message']);}})[_0x9c35('0x25')](function(_0x578e00){logger[_0x9c35('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x77588e,_0x578e00);_0x2e8ec1(_0x578e00);});});}function respondWithStatusCode(_0x5d924a,_0x39cd10){_0x39cd10=_0x39cd10||0xcc;return function(_0xaf9e58){if(_0xaf9e58){return _0x5d924a[_0x9c35('0x26')](_0x39cd10);}return _0x5d924a['status'](_0x39cd10)[_0x9c35('0x27')]();};}function respondWithResult(_0x55cd82,_0x16cc31){_0x16cc31=_0x16cc31||0xc8;return function(_0x2a0954){if(_0x2a0954){return _0x55cd82[_0x9c35('0x28')](_0x16cc31)[_0x9c35('0x29')](_0x2a0954);}};}function respondWithFilteredResult(_0x4525c9,_0x4f272a){return function(_0x4593e3){if(_0x4593e3){var _0x16e8dd=typeof _0x4f272a['offset']===_0x9c35('0x2a')&&typeof _0x4f272a[_0x9c35('0x2b')]===_0x9c35('0x2a');var _0x45766e=_0x4593e3[_0x9c35('0x2c')];var _0x4cb625=_0x16e8dd?0x0:_0x4f272a[_0x9c35('0x2d')];var _0xd9c6b3=_0x16e8dd?_0x4593e3[_0x9c35('0x2c')]:_0x4f272a[_0x9c35('0x2d')]+_0x4f272a[_0x9c35('0x2b')];var _0x2b5341;if(_0xd9c6b3>=_0x45766e){_0xd9c6b3=_0x45766e;_0x2b5341=0xc8;}else{_0x2b5341=0xce;}_0x4525c9['status'](_0x2b5341);return _0x4525c9[_0x9c35('0x2e')]('Content-Range',_0x4cb625+'-'+_0xd9c6b3+'/'+_0x45766e)[_0x9c35('0x29')](_0x4593e3);}return null;};}function patchUpdates(_0x2e3cd8){return function(_0xb89c8c){try{jsonpatch[_0x9c35('0x2f')](_0xb89c8c,_0x2e3cd8,!![]);}catch(_0x462306){return BPromise['reject'](_0x462306);}return _0xb89c8c[_0x9c35('0x30')]();};}function saveUpdates(_0x182701,_0x4986a9){return function(_0x49cefb){if(_0x49cefb){return _0x49cefb[_0x9c35('0x31')](_0x182701)['then'](function(_0x560b74){return _0x560b74;});}return null;};}function removeEntity(_0x4d20f7,_0x42c748){return function(_0x2b5c69){if(_0x2b5c69){return _0x2b5c69[_0x9c35('0x32')]()[_0x9c35('0x1b')](function(){var _0x232e97=_0x2b5c69[_0x9c35('0x33')]({'plain':!![]});var _0x56b64b=_0x9c35('0x34');return db[_0x9c35('0x35')][_0x9c35('0x32')]({'where':{'type':_0x56b64b,'resourceId':_0x232e97['id']}})[_0x9c35('0x1b')](function(){return _0x2b5c69;});})['then'](function(){_0x4d20f7[_0x9c35('0x28')](0xcc)[_0x9c35('0x27')]();});}};}function handleEntityNotFound(_0x2aacb8,_0x7397f6){return function(_0x2867b8){if(!_0x2867b8){_0x2aacb8[_0x9c35('0x26')](0x194);}return _0x2867b8;};}function handleError(_0x316e10,_0x5628e7){_0x5628e7=_0x5628e7||0x1f4;return function(_0x535edd){logger['error'](_0x535edd[_0x9c35('0x36')]);if(_0x535edd['name']){delete _0x535edd[_0x9c35('0x37')];}_0x316e10['status'](_0x5628e7)['send'](_0x535edd);};}exports[_0x9c35('0x38')]=function(_0x431df0,_0x20f06e){var _0x282694={'include':[{'model':db[_0x9c35('0x39')],'as':'mandatoryDispositionPause'}]},_0x33ad72={},_0x17bace={'count':0x0,'rows':[]};var _0x289222=_['map'](db[_0x9c35('0x3a')]['rawAttributes'],function(_0x5a7bbe){return{'name':_0x5a7bbe['fieldName'],'type':_0x5a7bbe['type'][_0x9c35('0x3b')]};});_0x33ad72[_0x9c35('0x3c')]=_[_0x9c35('0x3d')](_0x289222,_0x9c35('0x37'));_0x33ad72['query']=_[_0x9c35('0x3e')](_0x431df0[_0x9c35('0x3f')]);_0x33ad72[_0x9c35('0x40')]=_['intersection'](_0x33ad72[_0x9c35('0x3c')],_0x33ad72[_0x9c35('0x3f')]);_0x282694[_0x9c35('0x41')]=_[_0x9c35('0x42')](_0x33ad72[_0x9c35('0x3c')],qs[_0x9c35('0x43')](_0x431df0[_0x9c35('0x3f')][_0x9c35('0x43')]));_0x282694[_0x9c35('0x41')]=_0x282694[_0x9c35('0x41')][_0x9c35('0x44')]?_0x282694['attributes']:_0x33ad72[_0x9c35('0x3c')];if(!_0x431df0[_0x9c35('0x3f')][_0x9c35('0x45')](_0x9c35('0x46'))){_0x282694[_0x9c35('0x2b')]=qs[_0x9c35('0x2b')](_0x431df0[_0x9c35('0x3f')][_0x9c35('0x2b')]);_0x282694[_0x9c35('0x2d')]=qs[_0x9c35('0x2d')](_0x431df0[_0x9c35('0x3f')][_0x9c35('0x2d')]);}_0x282694[_0x9c35('0x47')]=qs[_0x9c35('0x48')](_0x431df0[_0x9c35('0x3f')][_0x9c35('0x48')]);_0x282694[_0x9c35('0x49')]=qs[_0x9c35('0x40')](_[_0x9c35('0x4a')](_0x431df0[_0x9c35('0x3f')],_0x33ad72[_0x9c35('0x40')]),_0x289222);if(_0x431df0[_0x9c35('0x3f')]['filter']){_0x282694[_0x9c35('0x49')]=_['merge'](_0x282694[_0x9c35('0x49')],{'$or':_[_0x9c35('0x3d')](_0x289222,function(_0x25c72b){if(_0x25c72b['type']!==_0x9c35('0x4b')){var _0x1d24ae={};_0x1d24ae[_0x25c72b[_0x9c35('0x37')]]={'$like':'%'+_0x431df0['query'][_0x9c35('0x4c')]+'%'};return _0x1d24ae;}})});}_0x282694=_[_0x9c35('0x4d')]({},_0x282694,_0x431df0['options']);var _0x1972dc={'where':_0x282694['where']};return db[_0x9c35('0x3a')][_0x9c35('0x2c')](_0x1972dc)[_0x9c35('0x1b')](function(_0x471e4d){_0x17bace[_0x9c35('0x2c')]=_0x471e4d;if(_0x431df0[_0x9c35('0x3f')][_0x9c35('0x4e')]){_0x282694[_0x9c35('0x4f')]=[{'all':!![]}];}return db[_0x9c35('0x3a')]['findAll'](_0x282694);})[_0x9c35('0x1b')](function(_0x257d9c){_0x17bace[_0x9c35('0x50')]=_0x257d9c;return _0x17bace;})['then'](respondWithFilteredResult(_0x20f06e,_0x282694))['catch'](handleError(_0x20f06e,null));};exports[_0x9c35('0x51')]=function(_0x18727f,_0x51a9f0){var _0x153080={'raw':![],'where':{'id':_0x18727f[_0x9c35('0x52')]['id']},'include':[{'model':db[_0x9c35('0x39')],'as':_0x9c35('0x53')}]},_0x2bd32c={};_0x2bd32c[_0x9c35('0x3c')]=_['keys'](db[_0x9c35('0x3a')]['rawAttributes']);_0x2bd32c[_0x9c35('0x3f')]=_[_0x9c35('0x3e')](_0x18727f[_0x9c35('0x3f')]);_0x2bd32c['filters']=_[_0x9c35('0x42')](_0x2bd32c[_0x9c35('0x3c')],_0x2bd32c[_0x9c35('0x3f')]);_0x153080[_0x9c35('0x41')]=_[_0x9c35('0x42')](_0x2bd32c[_0x9c35('0x3c')],qs['fields'](_0x18727f['query'][_0x9c35('0x43')]));_0x153080[_0x9c35('0x41')]=_0x153080[_0x9c35('0x41')]['length']?_0x153080[_0x9c35('0x41')]:_0x2bd32c[_0x9c35('0x3c')];if(_0x18727f[_0x9c35('0x3f')][_0x9c35('0x4e')]){_0x153080[_0x9c35('0x4f')]=[{'all':!![]}];}_0x153080=_[_0x9c35('0x4d')]({},_0x153080,_0x18727f[_0x9c35('0x54')]);return db['OpenchannelAccount']['find'](_0x153080)[_0x9c35('0x1b')](handleEntityNotFound(_0x51a9f0,null))[_0x9c35('0x1b')](respondWithResult(_0x51a9f0,null))['catch'](handleError(_0x51a9f0,null));};exports[_0x9c35('0x55')]=function(_0x45a840,_0x7e4488){return db[_0x9c35('0x3a')][_0x9c35('0x55')](_0x45a840[_0x9c35('0x56')],{})[_0x9c35('0x1b')](function(_0x2a882e){var _0x1458f1=_0x45a840[_0x9c35('0x57')][_0x9c35('0x33')]({'plain':!![]});if(!_0x1458f1)throw new Error(_0x9c35('0x58'));if(_0x1458f1[_0x9c35('0x59')]===_0x9c35('0x57')){var _0x1effb=_0x2a882e[_0x9c35('0x33')]({'plain':!![]});var _0x29fec1=_0x9c35('0x34');return db[_0x9c35('0x5a')][_0x9c35('0x5b')]({'where':{'name':_0x29fec1,'userProfileId':_0x1458f1[_0x9c35('0x5c')]},'raw':!![]})[_0x9c35('0x1b')](function(_0x2092d4){if(_0x2092d4&&_0x2092d4[_0x9c35('0x5d')]===0x0){return db[_0x9c35('0x35')][_0x9c35('0x55')]({'name':_0x1effb[_0x9c35('0x37')],'resourceId':_0x1effb['id'],'type':_0x2092d4['name'],'sectionId':_0x2092d4['id']},{})[_0x9c35('0x1b')](function(){return _0x2a882e;});}else{return _0x2a882e;}})[_0x9c35('0x25')](function(_0x1bf387){logger['error'](_0x9c35('0x5e'),_0x1bf387);throw _0x1bf387;});}return _0x2a882e;})['then'](respondWithResult(_0x7e4488,0xc9))[_0x9c35('0x25')](handleError(_0x7e4488,null));};exports[_0x9c35('0x31')]=function(_0x3e4b5f,_0x46d60d){if(_0x3e4b5f[_0x9c35('0x56')]['id']){delete _0x3e4b5f[_0x9c35('0x56')]['id'];}return db['OpenchannelAccount'][_0x9c35('0x5b')]({'where':{'id':_0x3e4b5f[_0x9c35('0x52')]['id']},'include':[{'model':db[_0x9c35('0x39')],'as':_0x9c35('0x53')}]})['then'](handleEntityNotFound(_0x46d60d,null))[_0x9c35('0x1b')](saveUpdates(_0x3e4b5f[_0x9c35('0x56')],null))['then'](respondWithResult(_0x46d60d,null))['catch'](handleError(_0x46d60d,null));};exports[_0x9c35('0x32')]=function(_0x2e8dbe,_0x42ffc7){return db[_0x9c35('0x3a')][_0x9c35('0x5b')]({'where':{'id':_0x2e8dbe[_0x9c35('0x52')]['id']}})[_0x9c35('0x1b')](handleEntityNotFound(_0x42ffc7,null))[_0x9c35('0x1b')](removeEntity(_0x42ffc7,null))['catch'](handleError(_0x42ffc7,null));};exports[_0x9c35('0x5f')]=function(_0x4c4fad,_0xc815e){return db[_0x9c35('0x3a')][_0x9c35('0x5f')]()['then'](respondWithResult(_0xc815e,null))[_0x9c35('0x25')](handleError(_0xc815e,null));};exports[_0x9c35('0x60')]=function(_0x54566e,_0x29526d,_0x15e244){if(_0x54566e[_0x9c35('0x56')]['id']){delete _0x54566e['body']['id'];}return db[_0x9c35('0x3a')][_0x9c35('0x5b')]({'where':{'id':_0x54566e[_0x9c35('0x52')]['id']}})['then'](handleEntityNotFound(_0x29526d,null))[_0x9c35('0x1b')](function(_0x313fb6){if(_0x313fb6){_0x54566e[_0x9c35('0x56')][_0x9c35('0x61')]=_0x313fb6['id'];return db['Disposition'][_0x9c35('0x55')](_0x54566e[_0x9c35('0x56')]);}})[_0x9c35('0x1b')](respondWithResult(_0x29526d,null))[_0x9c35('0x25')](handleError(_0x29526d,null));};exports[_0x9c35('0x62')]=function(_0x19c7ca,_0x321631,_0x3901fb){var _0x2a2ff3={'raw':![],'where':{}};var _0x584da1={};var _0x2b0397={'count':0x0,'rows':[]};return db[_0x9c35('0x3a')][_0x9c35('0x63')]({'where':{'id':_0x19c7ca[_0x9c35('0x52')]['id']}})['then'](handleEntityNotFound(_0x321631,null))['then'](function(_0x1d5397){if(_0x1d5397){_0x584da1[_0x9c35('0x3c')]=_['keys'](db[_0x9c35('0x64')][_0x9c35('0x65')]);_0x584da1[_0x9c35('0x3f')]=_[_0x9c35('0x3e')](_0x19c7ca[_0x9c35('0x3f')]);_0x584da1['filters']=_[_0x9c35('0x42')](_0x584da1['model'],_0x584da1[_0x9c35('0x3f')]);_0x2a2ff3[_0x9c35('0x41')]=_[_0x9c35('0x42')](_0x584da1[_0x9c35('0x3c')],qs[_0x9c35('0x43')](_0x19c7ca[_0x9c35('0x3f')][_0x9c35('0x43')]));_0x2a2ff3['attributes']=_0x2a2ff3[_0x9c35('0x41')][_0x9c35('0x44')]?_0x2a2ff3[_0x9c35('0x41')]:_0x584da1[_0x9c35('0x3c')];if(!_0x19c7ca[_0x9c35('0x3f')][_0x9c35('0x45')](_0x9c35('0x46'))){_0x2a2ff3['limit']=qs['limit'](_0x19c7ca[_0x9c35('0x3f')][_0x9c35('0x2b')]);_0x2a2ff3[_0x9c35('0x2d')]=qs[_0x9c35('0x2d')](_0x19c7ca[_0x9c35('0x3f')][_0x9c35('0x2d')]);}_0x2a2ff3[_0x9c35('0x47')]=qs[_0x9c35('0x48')](_0x19c7ca['query'][_0x9c35('0x48')]);_0x2a2ff3[_0x9c35('0x49')]=qs[_0x9c35('0x40')](_[_0x9c35('0x4a')](_0x19c7ca[_0x9c35('0x3f')],_0x584da1['filters']));_0x2a2ff3['where'][_0x9c35('0x61')]=_0x1d5397['id'];if(_0x19c7ca[_0x9c35('0x3f')][_0x9c35('0x4c')]){_0x2a2ff3[_0x9c35('0x49')]=_[_0x9c35('0x4d')](_0x2a2ff3[_0x9c35('0x49')],{'$or':_[_0x9c35('0x3d')](_0x2a2ff3['attributes'],function(_0x1c5201){var _0x306eab={};_0x306eab[_0x1c5201]={'$like':'%'+_0x19c7ca[_0x9c35('0x3f')][_0x9c35('0x4c')]+'%'};return _0x306eab;})});}_0x2a2ff3=_[_0x9c35('0x4d')]({},_0x2a2ff3,_0x19c7ca[_0x9c35('0x54')]);return db[_0x9c35('0x64')]['count']({'where':_0x2a2ff3['where']})[_0x9c35('0x1b')](function(_0x1499db){_0x2b0397[_0x9c35('0x2c')]=_0x1499db;if(_0x19c7ca[_0x9c35('0x3f')]['includeAll']){_0x2a2ff3[_0x9c35('0x4f')]=[{'all':!![]}];}return db[_0x9c35('0x64')][_0x9c35('0x66')](_0x2a2ff3);})[_0x9c35('0x1b')](function(_0x5dac6c){_0x2b0397[_0x9c35('0x50')]=_0x5dac6c;return _0x2b0397;});}})['then'](respondWithFilteredResult(_0x321631,_0x2a2ff3))[_0x9c35('0x25')](handleError(_0x321631,null));};exports[_0x9c35('0x67')]=function(_0x5da53d,_0x220ef6,_0x1acd45){return db[_0x9c35('0x3a')][_0x9c35('0x5b')]({'where':{'id':_0x5da53d[_0x9c35('0x52')]['id']}})['then'](handleEntityNotFound(_0x220ef6,null))[_0x9c35('0x1b')](function(_0x1310fe){if(_0x1310fe){return _0x1310fe[_0x9c35('0x67')](_0x5da53d[_0x9c35('0x3f')][_0x9c35('0x68')]);}})[_0x9c35('0x1b')](respondWithStatusCode(_0x220ef6,null))[_0x9c35('0x25')](handleError(_0x220ef6,null));};exports[_0x9c35('0x69')]=function(_0x23f0e3,_0xc8dabc,_0x3d4fe6){if(_0x23f0e3[_0x9c35('0x56')]['id']){delete _0x23f0e3[_0x9c35('0x56')]['id'];}return db[_0x9c35('0x3a')][_0x9c35('0x5b')]({'where':{'id':_0x23f0e3['params']['id']}})[_0x9c35('0x1b')](handleEntityNotFound(_0xc8dabc,null))[_0x9c35('0x1b')](function(_0x4e86dd){if(_0x4e86dd){_0x23f0e3[_0x9c35('0x56')][_0x9c35('0x61')]=_0x4e86dd['id'];return db[_0x9c35('0x6a')][_0x9c35('0x55')](_0x23f0e3[_0x9c35('0x56')]);}})['then'](respondWithResult(_0xc8dabc,null))[_0x9c35('0x25')](handleError(_0xc8dabc,null));};exports[_0x9c35('0x6b')]=function(_0x5e622a,_0x4af8c7,_0x4c1f79){var _0x89b86c={'raw':![],'where':{}};var _0x2bdfd0={};var _0x49e20b={'count':0x0,'rows':[]};return db[_0x9c35('0x3a')][_0x9c35('0x63')]({'where':{'id':_0x5e622a[_0x9c35('0x52')]['id']}})['then'](handleEntityNotFound(_0x4af8c7,null))[_0x9c35('0x1b')](function(_0x268b54){if(_0x268b54){_0x2bdfd0[_0x9c35('0x3c')]=_['keys'](db[_0x9c35('0x6a')][_0x9c35('0x65')]);_0x2bdfd0[_0x9c35('0x3f')]=_['keys'](_0x5e622a[_0x9c35('0x3f')]);_0x2bdfd0[_0x9c35('0x40')]=_[_0x9c35('0x42')](_0x2bdfd0[_0x9c35('0x3c')],_0x2bdfd0[_0x9c35('0x3f')]);_0x89b86c['attributes']=_[_0x9c35('0x42')](_0x2bdfd0['model'],qs[_0x9c35('0x43')](_0x5e622a[_0x9c35('0x3f')][_0x9c35('0x43')]));_0x89b86c[_0x9c35('0x41')]=_0x89b86c['attributes']['length']?_0x89b86c[_0x9c35('0x41')]:_0x2bdfd0[_0x9c35('0x3c')];if(!_0x5e622a[_0x9c35('0x3f')][_0x9c35('0x45')]('nolimit')){_0x89b86c[_0x9c35('0x2b')]=qs[_0x9c35('0x2b')](_0x5e622a[_0x9c35('0x3f')]['limit']);_0x89b86c[_0x9c35('0x2d')]=qs[_0x9c35('0x2d')](_0x5e622a[_0x9c35('0x3f')][_0x9c35('0x2d')]);}_0x89b86c[_0x9c35('0x47')]=qs[_0x9c35('0x48')](_0x5e622a[_0x9c35('0x3f')]['sort']);_0x89b86c[_0x9c35('0x49')]=qs[_0x9c35('0x40')](_[_0x9c35('0x4a')](_0x5e622a[_0x9c35('0x3f')],_0x2bdfd0[_0x9c35('0x40')]));_0x89b86c[_0x9c35('0x49')][_0x9c35('0x61')]=_0x268b54['id'];if(_0x5e622a[_0x9c35('0x3f')][_0x9c35('0x4c')]){_0x89b86c['where']=_[_0x9c35('0x4d')](_0x89b86c[_0x9c35('0x49')],{'$or':_[_0x9c35('0x3d')](_0x89b86c[_0x9c35('0x41')],function(_0x2203c1){var _0x2513d0={};_0x2513d0[_0x2203c1]={'$like':'%'+_0x5e622a[_0x9c35('0x3f')][_0x9c35('0x4c')]+'%'};return _0x2513d0;})});}_0x89b86c=_[_0x9c35('0x4d')]({},_0x89b86c,_0x5e622a[_0x9c35('0x54')]);return db[_0x9c35('0x6a')][_0x9c35('0x2c')]({'where':_0x89b86c[_0x9c35('0x49')]})[_0x9c35('0x1b')](function(_0x35a905){_0x49e20b[_0x9c35('0x2c')]=_0x35a905;if(_0x5e622a[_0x9c35('0x3f')][_0x9c35('0x4e')]){_0x89b86c[_0x9c35('0x4f')]=[{'all':!![]}];}return db[_0x9c35('0x6a')][_0x9c35('0x66')](_0x89b86c);})[_0x9c35('0x1b')](function(_0x417c27){_0x49e20b[_0x9c35('0x50')]=_0x417c27;return _0x49e20b;});}})[_0x9c35('0x1b')](respondWithFilteredResult(_0x4af8c7,_0x89b86c))[_0x9c35('0x25')](handleError(_0x4af8c7,null));};exports['removeAnswers']=function(_0x6e456a,_0x3de11c,_0x39630e){return db[_0x9c35('0x3a')][_0x9c35('0x5b')]({'where':{'id':_0x6e456a['params']['id']}})[_0x9c35('0x1b')](handleEntityNotFound(_0x3de11c,null))[_0x9c35('0x1b')](function(_0x503e51){if(_0x503e51){return _0x503e51['removeAnswers'](_0x6e456a[_0x9c35('0x3f')][_0x9c35('0x68')]);}})['then'](respondWithStatusCode(_0x3de11c,null))[_0x9c35('0x25')](handleError(_0x3de11c,null));};exports[_0x9c35('0x6c')]=function(_0x47d131,_0x3b5696,_0x22e0f6){var _0x4838d9={'body':_0x47d131[_0x9c35('0x56')],'channel':_0x9c35('0x6d')};var _0x4b742d=[];var _0x200bfa=[];var _0x213f08={};var _0x3d17bc=![];return db[_0x9c35('0x6e')][_0x9c35('0x5f')]()['then'](function(_0x4aece8){if(!_0x4aece8){throw new db[(_0x9c35('0x6f'))]['ValidationError']('no\x20available\x20attributes');}_0x4b742d=_['difference'](_['keys'](_0x4aece8),['createdAt',_0x9c35('0x70')]);_0x200bfa=_[_0x9c35('0x71')](_[_0x9c35('0x3e')](_0x4aece8),[_0x9c35('0x72'),_0x9c35('0x70'),_0x9c35('0x73'),'ListId']);if(_0x47d131[_0x9c35('0x56')]['id']){delete _0x47d131[_0x9c35('0x56')]['id'];}if(_[_0x9c35('0x74')](_0x47d131[_0x9c35('0x56')][_0x9c35('0x75')])){throw new db[(_0x9c35('0x6f'))]['ValidationError'](_0x9c35('0x76'));}if(_[_0x9c35('0x74')](_0x47d131[_0x9c35('0x56')][_0x9c35('0x56')])||_0x47d131[_0x9c35('0x56')][_0x9c35('0x56')]===''){throw new db[(_0x9c35('0x6f'))][(_0x9c35('0x77'))](_0x9c35('0x78'));}if(_[_0x9c35('0x74')](_0x47d131[_0x9c35('0x56')][_0x9c35('0x79')])){throw new db['Sequelize'][(_0x9c35('0x77'))](_0x9c35('0x7a')+_0x200bfa);}if(!_[_0x9c35('0x7b')](_0x200bfa,_0x47d131['body'][_0x9c35('0x79')])){throw new db[(_0x9c35('0x6f'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x200bfa);}_0x213f08[_0x47d131[_0x9c35('0x56')][_0x9c35('0x79')]]=_0x47d131['body'][_0x9c35('0x75')];})[_0x9c35('0x1b')](function(){return db[_0x9c35('0x3a')][_0x9c35('0x5b')]({'where':{'id':_0x47d131[_0x9c35('0x52')]['id']},'include':[{'model':db['CmList'],'as':_0x9c35('0x7c'),'include':[{'model':db[_0x9c35('0x6e')],'as':'Contacts','where':_0x213f08,'limit':0x1,'order':[[_0x9c35('0x70'),'DESC']]}]},{'model':db[_0x9c35('0x7d')],'as':_0x9c35('0x7e')}]});})[_0x9c35('0x1b')](handleEntityNotFound(_0x3b5696,null))[_0x9c35('0x1b')](function(_0x224f38){if(_0x224f38&&_0x224f38[_0x9c35('0x7c')]){_0x4838d9[_0x9c35('0x7f')]=_0x224f38;_0x4838d9['applications']=_0x224f38[_0x9c35('0x7e')];_0x4838d9[_0x9c35('0x80')]=_0x224f38['List'];_0x4838d9['applications']=_[_0x9c35('0x81')](_0x4838d9[_0x9c35('0x82')],['priority'],[_0x9c35('0x83')]);if(_0x4838d9[_0x9c35('0x7f')][_0x9c35('0x7e')]){delete _0x4838d9[_0x9c35('0x7f')][_0x9c35('0x7e')];}if(_0x4838d9[_0x9c35('0x7f')][_0x9c35('0x7c')]&&_0x4838d9[_0x9c35('0x7f')]['List'][_0x9c35('0x84')]['length']){return _0x4838d9['account'][_0x9c35('0x7c')][_0x9c35('0x84')][0x0];}var _0x3861ab=_['defaults'](_0x47d131['body'],{'firstName':_0x47d131[_0x9c35('0x56')]['from'],'ListId':_0x224f38['ListId']});_0x3861ab[_0x47d131[_0x9c35('0x56')][_0x9c35('0x79')]]=_0x47d131[_0x9c35('0x56')][_0x9c35('0x75')];return db[_0x9c35('0x6e')]['create'](_0x3861ab,{'fields':_0x4b742d,'raw':!![]});}})[_0x9c35('0x1b')](handleEntityNotFound(_0x3b5696,null))[_0x9c35('0x1b')](function(_0x2e6afb){_0x4838d9['contact']=_0x2e6afb;if(_0x2e6afb){var _0x3ec29f={'ContactId':_0x2e6afb['id'],'OpenchannelAccountId':_0x47d131[_0x9c35('0x52')]['id'],'from':(_0x2e6afb['firstName']||'')+'\x20'+(_0x2e6afb['lastName']||'')};var _0x485967={'OpenchannelAccountId':_0x47d131[_0x9c35('0x52')]['id'],'closed':![]};if(_0x47d131[_0x9c35('0x56')][_0x9c35('0x85')]){_0x485967['threadId']=_0x47d131[_0x9c35('0x56')][_0x9c35('0x85')];return db['OpenchannelInteraction'][_0x9c35('0x5b')]({'where':_0x485967})[_0x9c35('0x1b')](function(_0xbea90f){if(_0xbea90f){return[_0xbea90f,![]];}_0x3ec29f['threadId']=_0x47d131[_0x9c35('0x56')][_0x9c35('0x85')];_0x3ec29f['externalUrl']=_0x47d131[_0x9c35('0x56')][_0x9c35('0x86')];return db[_0x9c35('0x87')][_0x9c35('0x55')](_0x3ec29f)[_0x9c35('0x1b')](function(_0x598b39){return[_0x598b39,!![]];});});}else{_0x485967[_0x9c35('0x85')]=null;}_0x485967[_0x9c35('0x88')]=_0x2e6afb['id'];return db[_0x9c35('0x87')][_0x9c35('0x5b')]({'where':_0x485967})[_0x9c35('0x1b')](function(_0x57252c){if(_0x57252c){return[_0x57252c,![]];}return db['OpenchannelInteraction'][_0x9c35('0x55')](_0x3ec29f)[_0x9c35('0x1b')](function(_0x3562ed){return[_0x3562ed,!![]];});});}})['spread'](function(_0x1b6d9e,_0xc097f2){if(_0x1b6d9e){_0x3d17bc=_0xc097f2;if(!_0xc097f2){var _0x245860={'from':(_0x4838d9[_0x9c35('0x89')][_0x9c35('0x8a')]||'')+'\x20'+(_0x4838d9[_0x9c35('0x89')][_0x9c35('0x8b')]||'')};if(_0x47d131['body'][_0x9c35('0x85')]&&_0x47d131['body'][_0x9c35('0x8c')]&&_0x47d131['body']['threadId']!=_0x47d131[_0x9c35('0x56')][_0x9c35('0x8c')]){_0x245860[_0x9c35('0x85')]=_0x47d131[_0x9c35('0x56')][_0x9c35('0x8c')];}return _0x1b6d9e[_0x9c35('0x31')](_0x245860);}else{return _0x1b6d9e;}}})[_0x9c35('0x1b')](function(_0x42ee39){_0x4838d9['interaction']=_0x42ee39['get']({'plain':!![]});_0x4838d9[_0x9c35('0x8d')][_0x9c35('0x8e')]=_0x3d17bc;if(_0x4838d9[_0x9c35('0x8d')][_0x9c35('0x8e')]){if(_0x4838d9['account'][_0x9c35('0x8f')]){_0x4838d9['applications']['push']({'id':0x0,'priority':_0x4838d9['applications'][_0x9c35('0x44')]+0x1,'app':_0x9c35('0x90'),'appdata':'unmanaged','interval':_0x9c35('0x91')});}}return db[_0x9c35('0x92')][_0x9c35('0x55')]({'body':_0x47d131[_0x9c35('0x56')]['body'],'OpenchannelAccountId':_0x47d131[_0x9c35('0x52')]['id'],'OpenchannelInteractionId':_0x42ee39['id'],'direction':'in','ContactId':_0x4838d9[_0x9c35('0x89')]['id'],'AttachmentId':_0x47d131[_0x9c35('0x56')]['AttachmentId']});})[_0x9c35('0x1b')](function(_0x59331f){_0x4838d9[_0x9c35('0x23')]=_0x59331f;if(!_0x4838d9[_0x9c35('0x8d')]['UserId'])return;return db['User'][_0x9c35('0x5b')]({'attributes':['id',_0x9c35('0x37')],'where':{'id':_0x4838d9[_0x9c35('0x8d')][_0x9c35('0x93')]}});})['then'](function(_0x1e7a3e){if(_0x1e7a3e){_0x4838d9[_0x9c35('0x82')][_0x9c35('0x94')]({'id':0x0,'priority':0x0,'app':_0x9c35('0x95'),'appdata':_0x1e7a3e[_0x9c35('0x37')]+','+(_0x4838d9['account'][_0x9c35('0x96')]||0xa),'interval':_0x9c35('0x91')});}if(!_0x4838d9[_0x9c35('0x8d')][_0x9c35('0x97')])return;return db[_0x9c35('0x98')][_0x9c35('0x5b')]({'attributes':['id',_0x9c35('0x37')],'where':{'id':_0x4838d9['interaction'][_0x9c35('0x97')]}});})[_0x9c35('0x1b')](function(_0x4ac0d9){if(_0x4ac0d9){_0x4838d9['applications'][_0x9c35('0x94')]({'id':0x0,'priority':0x1,'app':_0x9c35('0x99'),'appdata':_0x4ac0d9['name']+','+(_0x4838d9['account'][_0x9c35('0x9a')]||0x12c),'interval':_0x9c35('0x91')});}return respondWithRpcPromise(_0x9c35('0x9b'),_0x9c35('0x9c'),_0x4838d9);})['then'](function(_0x12b18d){respondWithRpcPromise('EventManager',_0x9c35('0x9d'),{'event':'notify','message':_0x12b18d},client9002);return _0x12b18d;})['then'](respondWithResult(_0x3b5696,null))[_0x9c35('0x25')](handleError(_0x3b5696,null));};exports['addApplications']=function(_0x20a997,_0x3d0645){var _0x2d7f70=_0x20a997[_0x9c35('0x52')]['id'];var _0x2f3ddd=_0x20a997['body'];var _0x1b910c=0xc8;var _0x108214=null;return db[_0x9c35('0x9e')]['transaction']({'isolationLevel':db['sequelize'][_0x9c35('0x9f')]['ISOLATION_LEVELS'][_0x9c35('0xa0')]},function(_0x475152){return db[_0x9c35('0x3a')][_0x9c35('0x63')]({'where':{'id':_0x2d7f70},'transaction':_0x475152})['then'](function(_0x29385f){if(_0x29385f){return db[_0x9c35('0x7d')][_0x9c35('0x32')]({'where':{'OpenchannelAccountId':_0x2d7f70},'transaction':_0x475152})[_0x9c35('0x1b')](function(){var _0x4a7bd7=_[_0x9c35('0x3d')](_0x2f3ddd,function(_0x3675f1){_0x3675f1[_0x9c35('0x61')]=_0x2d7f70;return _0x3675f1;});return db[_0x9c35('0x7d')]['bulkCreate'](_0x4a7bd7,{'transaction':_0x475152});});}else{_0x1b910c=0x194;_0x108214=[];}});})[_0x9c35('0x1b')](function(){if(_0x1b910c!==0x194){return db['OpenchannelApplication'][_0x9c35('0xa1')]({'where':{'OpenchannelAccountId':_0x2d7f70},'order':_0x9c35('0xa2')})[_0x9c35('0x1b')](function(_0x573688){_0x108214=_0x573688;});}})['catch'](function(_0x2f3805){_0x1b910c=0x1f4;logger['error'](_0x2f3805['stack']);if(_0x2f3805[_0x9c35('0x37')]){delete _0x2f3805['name'];}_0x108214=_0x2f3805;})[_0x9c35('0xa3')](function(){if(_0x108214===null){_0x3d0645['sendStatus'](_0x1b910c);}else{if(_0x1b910c===0x1f4){_0x3d0645['status'](_0x1b910c)[_0x9c35('0xa4')](_0x108214);}else{_0x3d0645['status'](_0x1b910c)['json'](_0x108214);}}});};exports[_0x9c35('0xa5')]=function(_0x51ecee,_0x59d9fa,_0x4c0c0f){var _0x31c5c1={};var _0x547bc1={};var _0x11eecb;var _0x299557;return db[_0x9c35('0x3a')][_0x9c35('0x63')]({'where':{'id':_0x51ecee[_0x9c35('0x52')]['id']}})['then'](handleEntityNotFound(_0x59d9fa,null))[_0x9c35('0x1b')](function(_0x4b8aa6){if(_0x4b8aa6){_0x11eecb=_0x4b8aa6;_0x547bc1[_0x9c35('0x3c')]=_['keys'](db[_0x9c35('0x7d')][_0x9c35('0x65')]);_0x547bc1[_0x9c35('0x3f')]=_[_0x9c35('0x3e')](_0x51ecee[_0x9c35('0x3f')]);_0x547bc1[_0x9c35('0x40')]=_['intersection'](_0x547bc1[_0x9c35('0x3c')],_0x547bc1[_0x9c35('0x3f')]);_0x31c5c1[_0x9c35('0x41')]=_[_0x9c35('0x42')](_0x547bc1[_0x9c35('0x3c')],qs[_0x9c35('0x43')](_0x51ecee[_0x9c35('0x3f')][_0x9c35('0x43')]));_0x31c5c1['attributes']=_0x31c5c1[_0x9c35('0x41')][_0x9c35('0x44')]?_0x31c5c1[_0x9c35('0x41')]:_0x547bc1['model'];_0x31c5c1[_0x9c35('0x47')]=qs['sort'](_0x51ecee[_0x9c35('0x3f')][_0x9c35('0x48')]);_0x31c5c1[_0x9c35('0x49')]=qs[_0x9c35('0x40')](_['pick'](_0x51ecee[_0x9c35('0x3f')],_0x547bc1['filters']));if(_0x51ecee[_0x9c35('0x3f')][_0x9c35('0x4c')]){_0x31c5c1[_0x9c35('0x49')]=_[_0x9c35('0x4d')](_0x31c5c1[_0x9c35('0x49')],{'$or':_[_0x9c35('0x3d')](_0x31c5c1[_0x9c35('0x41')],function(_0x45aa89){var _0x559a1={};_0x559a1[_0x45aa89]={'$like':'%'+_0x51ecee[_0x9c35('0x3f')]['filter']+'%'};return _0x559a1;})});}_0x31c5c1=_[_0x9c35('0x4d')]({},_0x31c5c1,_0x51ecee[_0x9c35('0x54')]);return _0x11eecb[_0x9c35('0xa5')](_0x31c5c1);}})[_0x9c35('0x1b')](function(_0x1ff233){if(_0x1ff233){_0x299557=_0x1ff233['length'];if(!_0x51ecee['query'][_0x9c35('0x45')](_0x9c35('0x46'))){_0x31c5c1['limit']=qs[_0x9c35('0x2b')](_0x51ecee[_0x9c35('0x3f')][_0x9c35('0x2b')]);_0x31c5c1['offset']=qs[_0x9c35('0x2d')](_0x51ecee[_0x9c35('0x3f')][_0x9c35('0x2d')]);}return _0x11eecb[_0x9c35('0xa5')](_0x31c5c1);}})[_0x9c35('0x1b')](function(_0x1eee44){if(_0x1eee44){return _0x1eee44?{'count':_0x299557,'rows':_0x1eee44}:null;}})[_0x9c35('0x1b')](respondWithResult(_0x59d9fa,null))['catch'](handleError(_0x59d9fa,null));};exports[_0x9c35('0xa6')]=function(_0x52e2ed,_0x218bdf,_0x368050){var _0x3538e4={'raw':![],'where':{}};var _0x1c14ff={};var _0x8ede7b={'count':0x0,'rows':[]};return db[_0x9c35('0x3a')]['findOne']({'where':{'id':_0x52e2ed[_0x9c35('0x52')]['id']}})[_0x9c35('0x1b')](handleEntityNotFound(_0x218bdf,null))['then'](function(_0x4bb572){if(_0x4bb572){_0x1c14ff[_0x9c35('0x3c')]=_[_0x9c35('0x3e')](db[_0x9c35('0x87')]['rawAttributes']);_0x1c14ff['query']=_[_0x9c35('0x3e')](_0x52e2ed[_0x9c35('0x3f')]);_0x1c14ff[_0x9c35('0x40')]=_[_0x9c35('0x42')](_0x1c14ff['model'],_0x1c14ff[_0x9c35('0x3f')]);_0x3538e4['attributes']=_[_0x9c35('0x42')](_0x1c14ff[_0x9c35('0x3c')],qs[_0x9c35('0x43')](_0x52e2ed[_0x9c35('0x3f')][_0x9c35('0x43')]));_0x3538e4['attributes']=_0x3538e4[_0x9c35('0x41')][_0x9c35('0x44')]?_0x3538e4['attributes']:_0x1c14ff['model'];if(!_0x52e2ed['query'][_0x9c35('0x45')]('nolimit')){_0x3538e4[_0x9c35('0x2b')]=qs[_0x9c35('0x2b')](_0x52e2ed[_0x9c35('0x3f')][_0x9c35('0x2b')]);_0x3538e4[_0x9c35('0x2d')]=qs[_0x9c35('0x2d')](_0x52e2ed['query']['offset']);}_0x3538e4[_0x9c35('0x47')]=qs['sort'](_0x52e2ed[_0x9c35('0x3f')][_0x9c35('0x48')]);_0x3538e4[_0x9c35('0x49')]=qs[_0x9c35('0x40')](_[_0x9c35('0x4a')](_0x52e2ed[_0x9c35('0x3f')],_0x1c14ff[_0x9c35('0x40')]));_0x3538e4['where'][_0x9c35('0x61')]=_0x4bb572['id'];if(_0x52e2ed[_0x9c35('0x3f')]['filter']){_0x3538e4[_0x9c35('0x49')]=_['merge'](_0x3538e4['where'],{'$or':_[_0x9c35('0x3d')](_0x3538e4['attributes'],function(_0x3eaef6){var _0x402746={};_0x402746[_0x3eaef6]={'$like':'%'+_0x52e2ed['query'][_0x9c35('0x4c')]+'%'};return _0x402746;})});}_0x3538e4=_[_0x9c35('0x4d')]({},_0x3538e4,_0x52e2ed['options']);return db[_0x9c35('0x87')]['count']({'where':_0x3538e4[_0x9c35('0x49')]})[_0x9c35('0x1b')](function(_0x213bb6){_0x8ede7b[_0x9c35('0x2c')]=_0x213bb6;if(_0x52e2ed[_0x9c35('0x3f')]['includeAll']){_0x3538e4['include']=[{'model':db[_0x9c35('0x6e')],'as':_0x9c35('0xa7'),'required':![]},{'model':db[_0x9c35('0xa8')],'as':_0x9c35('0xa9'),'attributes':[_0x9c35('0x37'),'fullname',_0x9c35('0xaa')],'required':![]},{'model':db[_0x9c35('0xab')],'as':_0x9c35('0xac'),'attributes':['id',_0x9c35('0x37'),_0x9c35('0xad')],'where':_0x52e2ed[_0x9c35('0x3f')][_0x9c35('0xae')]?{'id':_0x52e2ed[_0x9c35('0x3f')][_0x9c35('0xae')]}:undefined,'required':_0x52e2ed[_0x9c35('0x3f')][_0x9c35('0xae')]?!![]:![]}];}return db[_0x9c35('0x87')]['findAll'](_0x3538e4);})[_0x9c35('0x1b')](function(_0x500b8a){_0x8ede7b['rows']=_0x500b8a;return _0x8ede7b;});}})[_0x9c35('0x1b')](respondWithFilteredResult(_0x218bdf,_0x3538e4))[_0x9c35('0x25')](handleError(_0x218bdf,null));};exports[_0x9c35('0xaf')]=function(_0x1e2820,_0x23b6fc,_0x503503){return db[_0x9c35('0x3a')]['find']({'where':{'id':_0x1e2820[_0x9c35('0x52')]['id']}})[_0x9c35('0x1b')](handleEntityNotFound(_0x23b6fc,null))[_0x9c35('0x1b')](function(_0x5e6fbb){if(_0x5e6fbb){return _0x5e6fbb[_0x9c35('0xaf')](_0x1e2820['body'][_0x9c35('0x68')],_[_0x9c35('0xb0')](_0x1e2820[_0x9c35('0x56')],['ids','id'])||{})[_0x9c35('0xb1')](function(_0x38e6b5){for(var _0x1df432=0x0;_0x1df432<_0x1e2820[_0x9c35('0x56')]['ids'][_0x9c35('0x44')];_0x1df432+=0x1){socket[_0x9c35('0xb2')](_0x9c35('0xb3'),{'UserId':Number(_0x1e2820[_0x9c35('0x56')][_0x9c35('0x68')][_0x1df432]),'OpenchannelAccountId':Number(_0x1e2820[_0x9c35('0x52')]['id'])});}return _0x38e6b5;});}})['then'](respondWithResult(_0x23b6fc,null))['catch'](handleError(_0x23b6fc,null));};exports[_0x9c35('0xb4')]=function(_0x295295,_0x4c8127,_0x1a0381){return db[_0x9c35('0x3a')]['find']({'where':{'id':_0x295295[_0x9c35('0x52')]['id']}})['then'](handleEntityNotFound(_0x4c8127,null))['then'](function(_0xd76890){if(_0xd76890){return _0xd76890['removeAgents'](_0x295295[_0x9c35('0x3f')]['ids'])[_0x9c35('0x1b')](function(){if(_[_0x9c35('0xb5')](_0x295295[_0x9c35('0x3f')][_0x9c35('0x68')])){for(var _0x133fdc=0x0;_0x133fdc<_0x295295[_0x9c35('0x3f')][_0x9c35('0x68')][_0x9c35('0x44')];_0x133fdc+=0x1){socket['emit'](_0x9c35('0xb6'),{'UserId':Number(_0x295295[_0x9c35('0x3f')]['ids'][_0x133fdc]),'OpenchannelAccountId':Number(_0x295295[_0x9c35('0x52')]['id'])});}}else{socket[_0x9c35('0xb2')](_0x9c35('0xb6'),{'UserId':Number(_0x295295[_0x9c35('0x3f')][_0x9c35('0x68')]),'OpenchannelAccountId':Number(_0x295295[_0x9c35('0x52')]['id'])});}});}})['then'](respondWithStatusCode(_0x4c8127,null))[_0x9c35('0x25')](handleError(_0x4c8127,null));};exports[_0x9c35('0xb7')]=function(_0x37bf9b,_0x4b6a39,_0x5ac86d){var _0x5885c0={};var _0x5bf3d4={};var _0x225c8b;var _0x452cc4;return db[_0x9c35('0x3a')][_0x9c35('0x63')]({'where':{'id':_0x37bf9b[_0x9c35('0x52')]['id']}})[_0x9c35('0x1b')](handleEntityNotFound(_0x4b6a39,null))[_0x9c35('0x1b')](function(_0x3b07dd){if(_0x3b07dd){_0x225c8b=_0x3b07dd;_0x5bf3d4[_0x9c35('0x3c')]=_[_0x9c35('0x3e')](db['User'][_0x9c35('0x65')]);_0x5bf3d4[_0x9c35('0x3f')]=_[_0x9c35('0x3e')](_0x37bf9b[_0x9c35('0x3f')]);_0x5bf3d4['filters']=_['intersection'](_0x5bf3d4[_0x9c35('0x3c')],_0x5bf3d4[_0x9c35('0x3f')]);_0x5885c0[_0x9c35('0x41')]=_[_0x9c35('0x42')](_0x5bf3d4[_0x9c35('0x3c')],qs[_0x9c35('0x43')](_0x37bf9b[_0x9c35('0x3f')][_0x9c35('0x43')]));_0x5885c0['attributes']=_0x5885c0[_0x9c35('0x41')]['length']?_0x5885c0['attributes']:_0x5bf3d4[_0x9c35('0x3c')];_0x5885c0[_0x9c35('0x47')]=qs[_0x9c35('0x48')](_0x37bf9b[_0x9c35('0x3f')]['sort']);_0x5885c0[_0x9c35('0x49')]=qs[_0x9c35('0x40')](_['pick'](_0x37bf9b[_0x9c35('0x3f')],_0x5bf3d4['filters']));if(_0x37bf9b[_0x9c35('0x3f')][_0x9c35('0x4c')]){_0x5885c0['where']=_[_0x9c35('0x4d')](_0x5885c0[_0x9c35('0x49')],{'$or':_[_0x9c35('0x3d')](_0x5885c0['attributes'],function(_0x280fe1){var _0x18bd17={};_0x18bd17[_0x280fe1]={'$like':'%'+_0x37bf9b[_0x9c35('0x3f')]['filter']+'%'};return _0x18bd17;})});}_0x5885c0=_['merge']({},_0x5885c0,_0x37bf9b[_0x9c35('0x54')]);return _0x225c8b['getAgents'](_0x5885c0);}})[_0x9c35('0x1b')](function(_0xe1d3c8){if(_0xe1d3c8){_0x452cc4=_0xe1d3c8['length'];if(!_0x37bf9b['query'][_0x9c35('0x45')]('nolimit')){_0x5885c0[_0x9c35('0x2b')]=qs[_0x9c35('0x2b')](_0x37bf9b[_0x9c35('0x3f')][_0x9c35('0x2b')]);_0x5885c0[_0x9c35('0x2d')]=qs[_0x9c35('0x2d')](_0x37bf9b[_0x9c35('0x3f')][_0x9c35('0x2d')]);}return _0x225c8b['getAgents'](_0x5885c0);}})[_0x9c35('0x1b')](function(_0x47c152){if(_0x47c152){return _0x47c152?{'count':_0x452cc4,'rows':_0x47c152}:null;}})['then'](respondWithResult(_0x4b6a39,null))['catch'](handleError(_0x4b6a39,null));};exports[_0x9c35('0xa4')]=function(_0x1887f2,_0x6337ef,_0x31765d){var _0x3d7ad5,_0x39f68b,_0x21f150;if(_[_0x9c35('0x74')](_0x1887f2['body'][_0x9c35('0x56')])||_0x1887f2[_0x9c35('0x56')]['body']===''){throw new db[(_0x9c35('0x6f'))][(_0x9c35('0x77'))](_0x9c35('0x78'));}if(_[_0x9c35('0x74')](_0x1887f2['body']['to'])){}_0x3d7ad5=_0x1887f2[_0x9c35('0x56')]['to'];return db[_0x9c35('0x3a')][_0x9c35('0x63')]({'where':{'id':_0x1887f2[_0x9c35('0x52')]['id']}})['then'](handleEntityNotFound(_0x6337ef,null))[_0x9c35('0x1b')](function(_0x2ae44a){if(_0x2ae44a){return db[_0x9c35('0x3a')][_0x9c35('0x5b')]({'where':{'id':_0x2ae44a['id']},'include':[{'model':db[_0x9c35('0xb8')],'as':_0x9c35('0x7c'),'include':[{'model':db[_0x9c35('0x6e')],'as':'Contacts','where':{[_0x2ae44a[_0x9c35('0x79')]]:_0x3d7ad5},'limit':0x1,'order':[['updatedAt',_0x9c35('0xb9')]]}]}]})[_0x9c35('0x1b')](handleEntityNotFound(_0x6337ef,null))['then'](function(_0x38baab){if(_0x38baab&&_0x38baab[_0x9c35('0x7c')]){_0x39f68b=_0x38baab[_0x9c35('0x33')]({'plain':!![]});if(_0x39f68b[_0x9c35('0x7c')]&&_0x39f68b[_0x9c35('0x7c')][_0x9c35('0x84')][_0x9c35('0x44')]){return _0x39f68b[_0x9c35('0x7c')][_0x9c35('0x84')][0x0];}return db[_0x9c35('0x6e')]['create'](_[_0x9c35('0x12')](_0x1887f2[_0x9c35('0x56')],{'firstName':_0x3d7ad5,[_0x38baab[_0x9c35('0x79')]]:_0x3d7ad5,'phone':_0x3d7ad5,'ListId':_0x39f68b[_0x9c35('0xba')]}));}})['then'](handleEntityNotFound(_0x6337ef,null))[_0x9c35('0x1b')](function(_0x261c59){if(_0x261c59){_0x21f150=_0x261c59;return db['OpenchannelInteraction'][_0x9c35('0x5b')]({'where':{'ContactId':_0x21f150['id'],'closed':![],'OpenchannelAccountId':_0x39f68b['id']}})[_0x9c35('0x1b')](function(_0x8cd158){if(_0x8cd158){return[_0x8cd158,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x1887f2[_0x9c35('0x57')]['id'],'ContactId':_0x21f150['id'],'OpenchannelAccountId':_0x39f68b['id'],'lastMsgDirection':'out','firstMsgDirection':'out','Messages':[_[_0x9c35('0x4d')](_0x1887f2[_0x9c35('0x56')],{'read':![],'body':_0x1887f2['body']['body'],'OpenchannelAccountId':_0x39f68b['id'],'UserId':_0x1887f2[_0x9c35('0x57')]['id'],'ContactId':_0x21f150['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})[_0x9c35('0x1b')](function(_0x2042c6){return[_0x2042c6,!![]];});});}})[_0x9c35('0xb1')](function(_0x248208,_0x446092){if(_0x446092){return _0x248208;}return db[_0x9c35('0x92')]['create'](_[_0x9c35('0x4d')](_0x1887f2[_0x9c35('0x56')],{'read':![],'body':_0x1887f2[_0x9c35('0x56')][_0x9c35('0x56')],'OpenchannelAccountId':_0x39f68b['id'],'OpenchannelInteractionId':_0x248208['id'],'UserId':_0x1887f2[_0x9c35('0x57')]['id'],'ContactId':_0x21f150['id']}))[_0x9c35('0x1b')](function(_0x2f4454){_0x248208[_0x9c35('0xbb')][_0x9c35('0xbc')]=[];_0x248208[_0x9c35('0xbb')][_0x9c35('0xbc')][_0x9c35('0xbd')](_0x2f4454[_0x9c35('0xbb')]);return _0x248208;});});}})[_0x9c35('0x1b')](respondWithResult(_0x6337ef,null))['catch'](handleError(_0x6337ef,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 3f0608f..72b104c 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 _0xf109=['OpenchannelAccount','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x8fa30,_0x1a67f7){var _0x1721d3=function(_0x4bbdf3){while(--_0x4bbdf3){_0x8fa30['push'](_0x8fa30['shift']());}};_0x1721d3(++_0x1a67f7);}(_0xf109,0xce));var _0x9f10=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xf109[_0x36c5b0];return _0xf19333;};'use strict';var EventEmitter=require(_0x9f10('0x0'));var OpenchannelAccount=require(_0x9f10('0x1'))['db'][_0x9f10('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9f10('0x3')};function emitEvent(_0x74f517){return function(_0x74d0ee,_0x26f01c,_0x4027f4){OpenchannelAccountEvents[_0x9f10('0x4')](_0x74f517+':'+_0x74d0ee['id'],_0x74d0ee);OpenchannelAccountEvents[_0x9f10('0x4')](_0x74f517,_0x74d0ee);_0x4027f4(null);};}for(var e in events){if(events[_0x9f10('0x5')](e)){var event=events[e];OpenchannelAccount[_0x9f10('0x6')](e,emitEvent(event));}}module[_0x9f10('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x9bde=['exports','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x40ff4e,_0x50a4a3){var _0x2ea887=function(_0x3a177b){while(--_0x3a177b){_0x40ff4e['push'](_0x40ff4e['shift']());}};_0x2ea887(++_0x50a4a3);}(_0x9bde,0xe1));var _0xe9bd=function(_0x7d5120,_0x422539){_0x7d5120=_0x7d5120-0x0;var _0x47f5c6=_0x9bde[_0x7d5120];return _0x47f5c6;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xe9bd('0x0'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xe9bd('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe9bd('0x2'),'afterDestroy':_0xe9bd('0x3')};function emitEvent(_0x131f6a){return function(_0x1c1b34,_0x10822d,_0x1a4d14){OpenchannelAccountEvents[_0xe9bd('0x4')](_0x131f6a+':'+_0x1c1b34['id'],_0x1c1b34);OpenchannelAccountEvents['emit'](_0x131f6a,_0x1c1b34);_0x1a4d14(null);};}for(var e in events){if(events[_0xe9bd('0x5')](e)){var event=events[e];OpenchannelAccount[_0xe9bd('0x6')](e,emitEvent(event));}}module[_0xe9bd('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index e09c036..135d531 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(_0x3cb6d1,_0x1067f6){var _0x385ee7=function(_0x29d4d5){while(--_0x29d4d5){_0x3cb6d1['push'](_0x3cb6d1['shift']());}};_0x385ee7(++_0x1067f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x11026a,_0x2fa1f2){var _0xaf0cd1=function(_0x54f0dc){while(--_0x54f0dc){_0x11026a['push'](_0x11026a['shift']());}};_0xaf0cd1(++_0x2fa1f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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 b1408c3..b4f512f 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 _0x2884=['randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird'];(function(_0x2e067a,_0xab528c){var _0xc64976=function(_0x53a98e){while(--_0x53a98e){_0x2e067a['push'](_0x2e067a['shift']());}};_0xc64976(++_0xab528c);}(_0x2884,0x1eb));var _0x4288=function(_0x1ac002,_0x1f8b3d){_0x1ac002=_0x1ac002-0x0;var _0x5118d5=_0x2884[_0x1ac002];return _0x5118d5;};'use strict';var _=require(_0x4288('0x0'));var util=require('util');var moment=require(_0x4288('0x1'));var BPromise=require(_0x4288('0x2'));var rs=require(_0x4288('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4288('0x4'))['db'];var utils=require(_0x4288('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4288('0x6'));var jayson=require(_0x4288('0x7'));var client=jayson[_0x4288('0x8')]['http']({'port':0x232a});config['redis']=_[_0x4288('0x9')](config['redis'],{'host':_0x4288('0xa'),'port':0x18eb});var socket=require(_0x4288('0xb'))(new Redis(config['redis']));require(_0x4288('0xc'))[_0x4288('0xd')](socket);function respondWithRpcPromise(_0x41794a,_0x55c9ee,_0x55a4f7){return new BPromise(function(_0x5c0e2d,_0x42a234){return client[_0x4288('0xe')](_0x41794a,_0x55a4f7)[_0x4288('0xf')](function(_0x2445eb){logger[_0x4288('0x10')](_0x4288('0x11'),_0x55c9ee,'request\x20sent');logger[_0x4288('0x12')](_0x4288('0x13'),_0x55c9ee,_0x4288('0x14'),JSON[_0x4288('0x15')](_0x2445eb));if(_0x2445eb['error']){if(_0x2445eb[_0x4288('0x16')][_0x4288('0x17')]===0x1f4){logger['error'](_0x4288('0x11'),_0x55c9ee,_0x2445eb['error'][_0x4288('0x18')]);return _0x42a234(_0x2445eb['error'][_0x4288('0x18')]);}logger[_0x4288('0x16')](_0x4288('0x11'),_0x55c9ee,_0x2445eb[_0x4288('0x16')][_0x4288('0x18')]);return _0x5c0e2d(_0x2445eb[_0x4288('0x16')][_0x4288('0x18')]);}else{logger[_0x4288('0x10')](_0x4288('0x11'),_0x55c9ee,'request\x20sent');_0x5c0e2d(_0x2445eb[_0x4288('0x19')][_0x4288('0x18')]);}})['catch'](function(_0x479d52){logger['error'](_0x4288('0x11'),_0x55c9ee,_0x479d52);_0x42a234(_0x479d52);});});} \ No newline at end of file +var _0x153f=['localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis'];(function(_0x47da2f,_0x2ad213){var _0x2a8826=function(_0x1ba094){while(--_0x1ba094){_0x47da2f['push'](_0x47da2f['shift']());}};_0x2a8826(++_0x2ad213);}(_0x153f,0x15b));var _0xf153=function(_0x150da2,_0x1df19d){_0x150da2=_0x150da2-0x0;var _0x44ac94=_0x153f[_0x150da2];return _0x44ac94;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var moment=require(_0xf153('0x2'));var BPromise=require(_0xf153('0x3'));var rs=require(_0xf153('0x4'));var fs=require('fs');var Redis=require(_0xf153('0x5'));var db=require(_0xf153('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf153('0x7'))('rpc');var config=require(_0xf153('0x8'));var jayson=require(_0xf153('0x9'));var client=jayson[_0xf153('0xa')][_0xf153('0xb')]({'port':0x232a});config[_0xf153('0xc')]=_['defaults'](config[_0xf153('0xc')],{'host':_0xf153('0xd'),'port':0x18eb});var socket=require(_0xf153('0xe'))(new Redis(config[_0xf153('0xc')]));require(_0xf153('0xf'))[_0xf153('0x10')](socket);function respondWithRpcPromise(_0x44845c,_0x15a18b,_0x4f84b){return new BPromise(function(_0xeaccb0,_0x5c8ae9){return client[_0xf153('0x11')](_0x44845c,_0x4f84b)[_0xf153('0x12')](function(_0x2bea70){logger['info'](_0xf153('0x13'),_0x15a18b,_0xf153('0x14'));logger[_0xf153('0x15')](_0xf153('0x16'),_0x15a18b,_0xf153('0x14'),JSON[_0xf153('0x17')](_0x2bea70));if(_0x2bea70[_0xf153('0x18')]){if(_0x2bea70[_0xf153('0x18')][_0xf153('0x19')]===0x1f4){logger['error'](_0xf153('0x13'),_0x15a18b,_0x2bea70[_0xf153('0x18')][_0xf153('0x1a')]);return _0x5c8ae9(_0x2bea70[_0xf153('0x18')][_0xf153('0x1a')]);}logger[_0xf153('0x18')](_0xf153('0x13'),_0x15a18b,_0x2bea70[_0xf153('0x18')]['message']);return _0xeaccb0(_0x2bea70[_0xf153('0x18')]['message']);}else{logger[_0xf153('0x1b')](_0xf153('0x13'),_0x15a18b,_0xf153('0x14'));_0xeaccb0(_0x2bea70[_0xf153('0x1c')]['message']);}})[_0xf153('0x1d')](function(_0x19122e){logger[_0xf153('0x18')](_0xf153('0x13'),_0x15a18b,_0x19122e);_0x5c8ae9(_0x19122e);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 48d8a19..5781b1a 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 _0x24cd=['update','emit','removeListener','length','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x14016f,_0x3edf9e){var _0x575dbc=function(_0x3e0a86){while(--_0x3e0a86){_0x14016f['push'](_0x14016f['shift']());}};_0x575dbc(++_0x3edf9e);}(_0x24cd,0x83));var _0xd24c=function(_0x5854c7,_0x3eb302){_0x5854c7=_0x5854c7-0x0;var _0x43b5b2=_0x24cd[_0x5854c7];return _0x43b5b2;};'use strict';var OpenchannelAccountEvents=require(_0xd24c('0x0'));var events=[_0xd24c('0x1'),'remove',_0xd24c('0x2')];function createListener(_0x4fcd89,_0x282e8f){return function(_0x30398b){_0x282e8f[_0xd24c('0x3')](_0x4fcd89,_0x30398b);};}function removeListener(_0x4d515c,_0x21a58c){return function(){OpenchannelAccountEvents[_0xd24c('0x4')](_0x4d515c,_0x21a58c);};}exports['register']=function(_0x1c30fc){for(var _0x2721be=0x0,_0x2a432a=events[_0xd24c('0x5')];_0x2721be<_0x2a432a;_0x2721be++){var _0x3d4d20=events[_0x2721be];var _0x411706=createListener(_0xd24c('0x6')+_0x3d4d20,_0x1c30fc);OpenchannelAccountEvents['on'](_0x3d4d20,_0x411706);}}; \ No newline at end of file +var _0x18e0=['openchannelAccount:','save','update','emit','removeListener','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x18e0,0xa2));var _0x018e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x18e0[_0x59ee6f];return _0x4c0979;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x018e('0x0'),'remove',_0x018e('0x1')];function createListener(_0x110f22,_0x356418){return function(_0x4d12a5){_0x356418[_0x018e('0x2')](_0x110f22,_0x4d12a5);};}function removeListener(_0x4e570f,_0x504293){return function(){OpenchannelAccountEvents[_0x018e('0x3')](_0x4e570f,_0x504293);};}exports[_0x018e('0x4')]=function(_0x1b90dd){for(var _0x50450b=0x0,_0x5b6638=events[_0x018e('0x5')];_0x50450b<_0x5b6638;_0x50450b++){var _0x24e838=events[_0x50450b];var _0x5b2267=createListener(_0x018e('0x6')+_0x24e838,_0x1b90dd);OpenchannelAccountEvents['on'](_0x24e838,_0x5b2267);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 9c61b07..3b9542c 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 _0xa67a=['post','create','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x485a38,_0x20dc6b){var _0x49f5c3=function(_0x5e9f05){while(--_0x5e9f05){_0x485a38['push'](_0x485a38['shift']());}};_0x49f5c3(++_0x20dc6b);}(_0xa67a,0xca));var _0xaa67=function(_0x24eaa5,_0xdfc98f){_0x24eaa5=_0x24eaa5-0x0;var _0x1bfacc=_0xa67a[_0x24eaa5];return _0x1bfacc;};'use strict';var multer=require(_0xaa67('0x0'));var util=require(_0xaa67('0x1'));var path=require('path');var timeout=require(_0xaa67('0x2'));var express=require('express');var router=express[_0xaa67('0x3')]();var fs_extra=require(_0xaa67('0x4'));var auth=require(_0xaa67('0x5'));var interaction=require(_0xaa67('0x6'));var config=require(_0xaa67('0x7'));var controller=require(_0xaa67('0x8'));router[_0xaa67('0x9')]('/',auth[_0xaa67('0xa')](),controller[_0xaa67('0xb')]);router['get'](_0xaa67('0xc'),auth['isAuthenticated'](),controller[_0xaa67('0xd')]);router[_0xaa67('0xe')]('/',auth['isAuthenticated'](),controller[_0xaa67('0xf')]);router['put'](_0xaa67('0xc'),auth[_0xaa67('0xa')](),controller['update']);router[_0xaa67('0x10')]('/:id',auth[_0xaa67('0xa')](),controller[_0xaa67('0x11')]);module['exports']=router; \ No newline at end of file +var _0x2763=['update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x2ac87c,_0x1b07b4){var _0x41a0b5=function(_0x390729){while(--_0x390729){_0x2ac87c['push'](_0x2ac87c['shift']());}};_0x41a0b5(++_0x1b07b4);}(_0x2763,0x16b));var _0x3276=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2763[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x3276('0x0'));var path=require(_0x3276('0x1'));var timeout=require(_0x3276('0x2'));var express=require(_0x3276('0x3'));var router=express[_0x3276('0x4')]();var fs_extra=require(_0x3276('0x5'));var auth=require(_0x3276('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3276('0x7'));var controller=require(_0x3276('0x8'));router[_0x3276('0x9')]('/',auth[_0x3276('0xa')](),controller[_0x3276('0xb')]);router[_0x3276('0x9')](_0x3276('0xc'),auth[_0x3276('0xa')](),controller[_0x3276('0xd')]);router[_0x3276('0xe')]('/',auth[_0x3276('0xa')](),controller[_0x3276('0xf')]);router[_0x3276('0x10')](_0x3276('0xc'),auth[_0x3276('0xa')](),controller[_0x3276('0x11')]);router['delete']('/:id',auth[_0x3276('0xa')](),controller[_0x3276('0x12')]);module[_0x3276('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index e26ead6..168ad91 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 _0x45df=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x135bc7,_0x54923a){var _0x3d3d54=function(_0x2117df){while(--_0x2117df){_0x135bc7['push'](_0x135bc7['shift']());}};_0x3d3d54(++_0x54923a);}(_0x45df,0x196));var _0xf45d=function(_0x3bb866,_0xba7019){_0x3bb866=_0x3bb866-0x0;var _0x2e7e75=_0x45df[_0x3bb866];return _0x2e7e75;};'use strict';var Sequelize=require(_0xf45d('0x0'));module[_0xf45d('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf45d('0x2')],'allowNull':![],'defaultValue':_0xf45d('0x3')},'appdata':{'type':Sequelize[_0xf45d('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf45d('0x2')],'defaultValue':_0xf45d('0x5')}}; \ No newline at end of file +var _0xf377=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xf377,0xf2));var _0x7f37=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0xf377[_0x5416db];return _0x243e35;};'use strict';var Sequelize=require(_0x7f37('0x0'));module[_0x7f37('0x1')]={'priority':{'type':Sequelize[_0x7f37('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7f37('0x3')],'allowNull':![],'defaultValue':_0x7f37('0x4')},'appdata':{'type':Sequelize[_0x7f37('0x5')]()},'description':{'type':Sequelize[_0x7f37('0x3')]},'interval':{'type':Sequelize[_0x7f37('0x3')],'defaultValue':_0x7f37('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index a529b35..533624b 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 _0x06df=['find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','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/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','send','index','OpenchannelApplication','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','includeAll','include','findAll','catch','show','params'];(function(_0x147e76,_0xb1d526){var _0x3100b7=function(_0x436f36){while(--_0x436f36){_0x147e76['push'](_0x147e76['shift']());}};_0x3100b7(++_0xb1d526);}(_0x06df,0x184));var _0xf06d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x06df[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xf06d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf06d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf06d('0x2'));var moment=require(_0xf06d('0x3'));var BPromise=require(_0xf06d('0x4'));var Mustache=require('mustache');var util=require(_0xf06d('0x5'));var path=require(_0xf06d('0x6'));var sox=require(_0xf06d('0x7'));var csv=require(_0xf06d('0x8'));var ejs=require(_0xf06d('0x9'));var fs=require('fs');var fs_extra=require(_0xf06d('0xa'));var _=require('lodash');var squel=require(_0xf06d('0xb'));var crypto=require(_0xf06d('0xc'));var jsforce=require(_0xf06d('0xd'));var deskjs=require(_0xf06d('0xe'));var toCsv=require(_0xf06d('0x8'));var querystring=require(_0xf06d('0xf'));var Papa=require(_0xf06d('0x10'));var Redis=require('ioredis');var authService=require(_0xf06d('0x11'));var qs=require(_0xf06d('0x12'));var as=require(_0xf06d('0x13'));var hardwareService=require(_0xf06d('0x14'));var logger=require(_0xf06d('0x15'))(_0xf06d('0x16'));var utils=require('../../config/utils');var config=require(_0xf06d('0x17'));var licenseUtil=require(_0xf06d('0x18'));var db=require(_0xf06d('0x19'))['db'];function respondWithStatusCode(_0x5aa756,_0x2e10b7){_0x2e10b7=_0x2e10b7||0xcc;return function(_0x541039){if(_0x541039){return _0x5aa756['sendStatus'](_0x2e10b7);}return _0x5aa756[_0xf06d('0x1a')](_0x2e10b7)['end']();};}function respondWithResult(_0x27f6eb,_0x1f85c4){_0x1f85c4=_0x1f85c4||0xc8;return function(_0x344fff){if(_0x344fff){return _0x27f6eb[_0xf06d('0x1a')](_0x1f85c4)['json'](_0x344fff);}};}function respondWithFilteredResult(_0x292bac,_0x4ecdd4){return function(_0x45cdd6){if(_0x45cdd6){var _0x4c633a=typeof _0x4ecdd4[_0xf06d('0x1b')]===_0xf06d('0x1c')&&typeof _0x4ecdd4[_0xf06d('0x1d')]===_0xf06d('0x1c');var _0x3dfba8=_0x45cdd6[_0xf06d('0x1e')];var _0x410ccd=_0x4c633a?0x0:_0x4ecdd4[_0xf06d('0x1b')];var _0x24b511=_0x4c633a?_0x45cdd6[_0xf06d('0x1e')]:_0x4ecdd4[_0xf06d('0x1b')]+_0x4ecdd4['limit'];var _0x5c4619;if(_0x24b511>=_0x3dfba8){_0x24b511=_0x3dfba8;_0x5c4619=0xc8;}else{_0x5c4619=0xce;}_0x292bac[_0xf06d('0x1a')](_0x5c4619);return _0x292bac[_0xf06d('0x1f')](_0xf06d('0x20'),_0x410ccd+'-'+_0x24b511+'/'+_0x3dfba8)['json'](_0x45cdd6);}return null;};}function patchUpdates(_0x2f88ca){return function(_0x376279){try{jsonpatch[_0xf06d('0x21')](_0x376279,_0x2f88ca,!![]);}catch(_0x7d3762){return BPromise[_0xf06d('0x22')](_0x7d3762);}return _0x376279[_0xf06d('0x23')]();};}function saveUpdates(_0x17c83d,_0x42755e){return function(_0x338fe2){if(_0x338fe2){return _0x338fe2[_0xf06d('0x24')](_0x17c83d)[_0xf06d('0x25')](function(_0x963555){return _0x963555;});}return null;};}function removeEntity(_0x4b36e6,_0x290f70){return function(_0x3abc1d){if(_0x3abc1d){return _0x3abc1d[_0xf06d('0x26')]()[_0xf06d('0x25')](function(){_0x4b36e6[_0xf06d('0x1a')](0xcc)[_0xf06d('0x27')]();});}};}function handleEntityNotFound(_0x5a9521,_0x86cfe){return function(_0x5879a5){if(!_0x5879a5){_0x5a9521[_0xf06d('0x28')](0x194);}return _0x5879a5;};}function handleError(_0x222bf7,_0x4ab523){_0x4ab523=_0x4ab523||0x1f4;return function(_0x136978){logger[_0xf06d('0x29')](_0x136978[_0xf06d('0x2a')]);if(_0x136978['name']){delete _0x136978['name'];}_0x222bf7['status'](_0x4ab523)[_0xf06d('0x2b')](_0x136978);};}exports[_0xf06d('0x2c')]=function(_0x29e56a,_0x346ecf){var _0x476534={},_0x182674={},_0x3a612c={'count':0x0,'rows':[]};var _0x6ecf20=_['map'](db[_0xf06d('0x2d')][_0xf06d('0x2e')],function(_0x3fabcb){return{'name':_0x3fabcb[_0xf06d('0x2f')],'type':_0x3fabcb[_0xf06d('0x30')][_0xf06d('0x31')]};});_0x182674[_0xf06d('0x32')]=_['map'](_0x6ecf20,_0xf06d('0x33'));_0x182674[_0xf06d('0x34')]=_[_0xf06d('0x35')](_0x29e56a[_0xf06d('0x34')]);_0x182674[_0xf06d('0x36')]=_[_0xf06d('0x37')](_0x182674[_0xf06d('0x32')],_0x182674[_0xf06d('0x34')]);_0x476534[_0xf06d('0x38')]=_[_0xf06d('0x37')](_0x182674['model'],qs[_0xf06d('0x39')](_0x29e56a['query'][_0xf06d('0x39')]));_0x476534['attributes']=_0x476534[_0xf06d('0x38')][_0xf06d('0x3a')]?_0x476534[_0xf06d('0x38')]:_0x182674['model'];if(!_0x29e56a[_0xf06d('0x34')][_0xf06d('0x3b')](_0xf06d('0x3c'))){_0x476534['limit']=qs[_0xf06d('0x1d')](_0x29e56a[_0xf06d('0x34')]['limit']);_0x476534[_0xf06d('0x1b')]=qs[_0xf06d('0x1b')](_0x29e56a['query'][_0xf06d('0x1b')]);}_0x476534[_0xf06d('0x3d')]=qs[_0xf06d('0x3e')](_0x29e56a[_0xf06d('0x34')][_0xf06d('0x3e')]);_0x476534[_0xf06d('0x3f')]=qs[_0xf06d('0x36')](_['pick'](_0x29e56a[_0xf06d('0x34')],_0x182674[_0xf06d('0x36')]),_0x6ecf20);if(_0x29e56a['query'][_0xf06d('0x40')]){_0x476534[_0xf06d('0x3f')]=_[_0xf06d('0x41')](_0x476534[_0xf06d('0x3f')],{'$or':_[_0xf06d('0x42')](_0x6ecf20,function(_0x5f560d){if(_0x5f560d[_0xf06d('0x30')]!==_0xf06d('0x43')){var _0x3d913b={};_0x3d913b[_0x5f560d[_0xf06d('0x33')]]={'$like':'%'+_0x29e56a[_0xf06d('0x34')][_0xf06d('0x40')]+'%'};return _0x3d913b;}})});}_0x476534=_[_0xf06d('0x41')]({},_0x476534,_0x29e56a['options']);var _0x5615f2={'where':_0x476534[_0xf06d('0x3f')]};return db[_0xf06d('0x2d')][_0xf06d('0x1e')](_0x5615f2)[_0xf06d('0x25')](function(_0xead1c5){_0x3a612c['count']=_0xead1c5;if(_0x29e56a['query'][_0xf06d('0x44')]){_0x476534[_0xf06d('0x45')]=[{'all':!![]}];}return db[_0xf06d('0x2d')][_0xf06d('0x46')](_0x476534);})[_0xf06d('0x25')](function(_0x434762){_0x3a612c['rows']=_0x434762;return _0x3a612c;})[_0xf06d('0x25')](respondWithFilteredResult(_0x346ecf,_0x476534))[_0xf06d('0x47')](handleError(_0x346ecf,null));};exports[_0xf06d('0x48')]=function(_0x5ec2a5,_0xacb17e){var _0x1e3ece={'raw':!![],'where':{'id':_0x5ec2a5[_0xf06d('0x49')]['id']}},_0x5b8705={};_0x5b8705['model']=_[_0xf06d('0x35')](db[_0xf06d('0x2d')][_0xf06d('0x2e')]);_0x5b8705[_0xf06d('0x34')]=_[_0xf06d('0x35')](_0x5ec2a5[_0xf06d('0x34')]);_0x5b8705[_0xf06d('0x36')]=_[_0xf06d('0x37')](_0x5b8705[_0xf06d('0x32')],_0x5b8705[_0xf06d('0x34')]);_0x1e3ece['attributes']=_[_0xf06d('0x37')](_0x5b8705['model'],qs['fields'](_0x5ec2a5[_0xf06d('0x34')]['fields']));_0x1e3ece[_0xf06d('0x38')]=_0x1e3ece['attributes'][_0xf06d('0x3a')]?_0x1e3ece[_0xf06d('0x38')]:_0x5b8705[_0xf06d('0x32')];if(_0x5ec2a5[_0xf06d('0x34')][_0xf06d('0x44')]){_0x1e3ece[_0xf06d('0x45')]=[{'all':!![]}];}_0x1e3ece=_['merge']({},_0x1e3ece,_0x5ec2a5['options']);return db['OpenchannelApplication'][_0xf06d('0x4a')](_0x1e3ece)[_0xf06d('0x25')](handleEntityNotFound(_0xacb17e,null))[_0xf06d('0x25')](respondWithResult(_0xacb17e,null))[_0xf06d('0x47')](handleError(_0xacb17e,null));};exports['create']=function(_0x4cafd6,_0x22d42f){return db[_0xf06d('0x2d')][_0xf06d('0x4b')](_0x4cafd6['body'],{})[_0xf06d('0x25')](respondWithResult(_0x22d42f,0xc9))[_0xf06d('0x47')](handleError(_0x22d42f,null));};exports[_0xf06d('0x24')]=function(_0x283d48,_0x3f0c9e){if(_0x283d48[_0xf06d('0x4c')]['id']){delete _0x283d48[_0xf06d('0x4c')]['id'];}return db[_0xf06d('0x2d')]['find']({'where':{'id':_0x283d48['params']['id']}})['then'](handleEntityNotFound(_0x3f0c9e,null))[_0xf06d('0x25')](saveUpdates(_0x283d48[_0xf06d('0x4c')],null))[_0xf06d('0x25')](respondWithResult(_0x3f0c9e,null))[_0xf06d('0x47')](handleError(_0x3f0c9e,null));};exports['destroy']=function(_0x12d86a,_0xc18519){return db[_0xf06d('0x2d')][_0xf06d('0x4a')]({'where':{'id':_0x12d86a['params']['id']}})[_0xf06d('0x25')](handleEntityNotFound(_0xc18519,null))[_0xf06d('0x25')](removeEntity(_0xc18519,null))['catch'](handleError(_0xc18519,null));}; \ No newline at end of file +var _0x0194=['fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','status','sendStatus','error','stack','name','map','rawAttributes','fieldName','type','key','model','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','OpenchannelApplication','includeAll','include','findAll','rows','catch','params','keys','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox'];(function(_0x4cc8a9,_0x294eaf){var _0x3213c4=function(_0x4c19d5){while(--_0x4c19d5){_0x4cc8a9['push'](_0x4cc8a9['shift']());}};_0x3213c4(++_0x294eaf);}(_0x0194,0x118));var _0x4019=function(_0x103ead,_0x247665){_0x103ead=_0x103ead-0x0;var _0x5dbce0=_0x0194[_0x103ead];return _0x5dbce0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4019('0x0'));var zipdir=require(_0x4019('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4019('0x2'));var moment=require(_0x4019('0x3'));var BPromise=require(_0x4019('0x4'));var Mustache=require('mustache');var util=require(_0x4019('0x5'));var path=require(_0x4019('0x6'));var sox=require(_0x4019('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4019('0x8'));var _=require('lodash');var squel=require(_0x4019('0x9'));var crypto=require(_0x4019('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4019('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4019('0xc'));var Papa=require(_0x4019('0xd'));var Redis=require(_0x4019('0xe'));var authService=require(_0x4019('0xf'));var qs=require(_0x4019('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4019('0x11'));var logger=require(_0x4019('0x12'))(_0x4019('0x13'));var utils=require(_0x4019('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4019('0x15'));var db=require(_0x4019('0x16'))['db'];function respondWithStatusCode(_0xa5320,_0x58a9fa){_0x58a9fa=_0x58a9fa||0xcc;return function(_0x1cf063){if(_0x1cf063){return _0xa5320['sendStatus'](_0x58a9fa);}return _0xa5320['status'](_0x58a9fa)[_0x4019('0x17')]();};}function respondWithResult(_0x549e39,_0xbc9fb1){_0xbc9fb1=_0xbc9fb1||0xc8;return function(_0x379edc){if(_0x379edc){return _0x549e39['status'](_0xbc9fb1)[_0x4019('0x18')](_0x379edc);}};}function respondWithFilteredResult(_0x4cad18,_0x42f324){return function(_0x10be7c){if(_0x10be7c){var _0xda5113=typeof _0x42f324[_0x4019('0x19')]===_0x4019('0x1a')&&typeof _0x42f324[_0x4019('0x1b')]===_0x4019('0x1a');var _0x4844e8=_0x10be7c[_0x4019('0x1c')];var _0x3e6be4=_0xda5113?0x0:_0x42f324['offset'];var _0x4e31d3=_0xda5113?_0x10be7c[_0x4019('0x1c')]:_0x42f324[_0x4019('0x19')]+_0x42f324[_0x4019('0x1b')];var _0x4c766d;if(_0x4e31d3>=_0x4844e8){_0x4e31d3=_0x4844e8;_0x4c766d=0xc8;}else{_0x4c766d=0xce;}_0x4cad18['status'](_0x4c766d);return _0x4cad18[_0x4019('0x1d')]('Content-Range',_0x3e6be4+'-'+_0x4e31d3+'/'+_0x4844e8)[_0x4019('0x18')](_0x10be7c);}return null;};}function patchUpdates(_0x4667b1){return function(_0x54e74e){try{jsonpatch[_0x4019('0x1e')](_0x54e74e,_0x4667b1,!![]);}catch(_0x4e8979){return BPromise[_0x4019('0x1f')](_0x4e8979);}return _0x54e74e[_0x4019('0x20')]();};}function saveUpdates(_0x34a88b,_0x37810b){return function(_0x2dee4f){if(_0x2dee4f){return _0x2dee4f[_0x4019('0x21')](_0x34a88b)[_0x4019('0x22')](function(_0x21bbe6){return _0x21bbe6;});}return null;};}function removeEntity(_0x59db67,_0x43283a){return function(_0x46a6bb){if(_0x46a6bb){return _0x46a6bb[_0x4019('0x23')]()[_0x4019('0x22')](function(){_0x59db67[_0x4019('0x24')](0xcc)[_0x4019('0x17')]();});}};}function handleEntityNotFound(_0x5dd323,_0x5de046){return function(_0x4c8799){if(!_0x4c8799){_0x5dd323[_0x4019('0x25')](0x194);}return _0x4c8799;};}function handleError(_0xaec018,_0xe6689){_0xe6689=_0xe6689||0x1f4;return function(_0x4d4b81){logger[_0x4019('0x26')](_0x4d4b81[_0x4019('0x27')]);if(_0x4d4b81[_0x4019('0x28')]){delete _0x4d4b81[_0x4019('0x28')];}_0xaec018[_0x4019('0x24')](_0xe6689)['send'](_0x4d4b81);};}exports['index']=function(_0x422955,_0x505018){var _0x2c98ce={},_0x49b9eb={},_0x4b3efd={'count':0x0,'rows':[]};var _0x36360c=_[_0x4019('0x29')](db['OpenchannelApplication'][_0x4019('0x2a')],function(_0xc54cdf){return{'name':_0xc54cdf[_0x4019('0x2b')],'type':_0xc54cdf[_0x4019('0x2c')][_0x4019('0x2d')]};});_0x49b9eb[_0x4019('0x2e')]=_[_0x4019('0x29')](_0x36360c,_0x4019('0x28'));_0x49b9eb['query']=_['keys'](_0x422955['query']);_0x49b9eb[_0x4019('0x2f')]=_[_0x4019('0x30')](_0x49b9eb[_0x4019('0x2e')],_0x49b9eb['query']);_0x2c98ce[_0x4019('0x31')]=_['intersection'](_0x49b9eb['model'],qs[_0x4019('0x32')](_0x422955[_0x4019('0x33')][_0x4019('0x32')]));_0x2c98ce[_0x4019('0x31')]=_0x2c98ce[_0x4019('0x31')][_0x4019('0x34')]?_0x2c98ce[_0x4019('0x31')]:_0x49b9eb[_0x4019('0x2e')];if(!_0x422955[_0x4019('0x33')][_0x4019('0x35')](_0x4019('0x36'))){_0x2c98ce['limit']=qs[_0x4019('0x1b')](_0x422955[_0x4019('0x33')][_0x4019('0x1b')]);_0x2c98ce['offset']=qs[_0x4019('0x19')](_0x422955[_0x4019('0x33')]['offset']);}_0x2c98ce['order']=qs['sort'](_0x422955[_0x4019('0x33')][_0x4019('0x37')]);_0x2c98ce[_0x4019('0x38')]=qs[_0x4019('0x2f')](_['pick'](_0x422955[_0x4019('0x33')],_0x49b9eb[_0x4019('0x2f')]),_0x36360c);if(_0x422955['query'][_0x4019('0x39')]){_0x2c98ce[_0x4019('0x38')]=_['merge'](_0x2c98ce['where'],{'$or':_[_0x4019('0x29')](_0x36360c,function(_0x103382){if(_0x103382[_0x4019('0x2c')]!==_0x4019('0x3a')){var _0x57ee30={};_0x57ee30[_0x103382[_0x4019('0x28')]]={'$like':'%'+_0x422955[_0x4019('0x33')][_0x4019('0x39')]+'%'};return _0x57ee30;}})});}_0x2c98ce=_[_0x4019('0x3b')]({},_0x2c98ce,_0x422955[_0x4019('0x3c')]);var _0x217235={'where':_0x2c98ce[_0x4019('0x38')]};return db[_0x4019('0x3d')][_0x4019('0x1c')](_0x217235)[_0x4019('0x22')](function(_0x4b5bb1){_0x4b3efd[_0x4019('0x1c')]=_0x4b5bb1;if(_0x422955[_0x4019('0x33')][_0x4019('0x3e')]){_0x2c98ce[_0x4019('0x3f')]=[{'all':!![]}];}return db[_0x4019('0x3d')][_0x4019('0x40')](_0x2c98ce);})[_0x4019('0x22')](function(_0x39332a){_0x4b3efd[_0x4019('0x41')]=_0x39332a;return _0x4b3efd;})[_0x4019('0x22')](respondWithFilteredResult(_0x505018,_0x2c98ce))[_0x4019('0x42')](handleError(_0x505018,null));};exports['show']=function(_0xa50913,_0x297e0a){var _0x24fa6a={'raw':!![],'where':{'id':_0xa50913[_0x4019('0x43')]['id']}},_0x2293eb={};_0x2293eb['model']=_['keys'](db['OpenchannelApplication'][_0x4019('0x2a')]);_0x2293eb[_0x4019('0x33')]=_[_0x4019('0x44')](_0xa50913[_0x4019('0x33')]);_0x2293eb[_0x4019('0x2f')]=_['intersection'](_0x2293eb['model'],_0x2293eb[_0x4019('0x33')]);_0x24fa6a[_0x4019('0x31')]=_['intersection'](_0x2293eb[_0x4019('0x2e')],qs[_0x4019('0x32')](_0xa50913['query'][_0x4019('0x32')]));_0x24fa6a[_0x4019('0x31')]=_0x24fa6a[_0x4019('0x31')][_0x4019('0x34')]?_0x24fa6a[_0x4019('0x31')]:_0x2293eb['model'];if(_0xa50913[_0x4019('0x33')][_0x4019('0x3e')]){_0x24fa6a['include']=[{'all':!![]}];}_0x24fa6a=_[_0x4019('0x3b')]({},_0x24fa6a,_0xa50913[_0x4019('0x3c')]);return db[_0x4019('0x3d')][_0x4019('0x45')](_0x24fa6a)[_0x4019('0x22')](handleEntityNotFound(_0x297e0a,null))['then'](respondWithResult(_0x297e0a,null))[_0x4019('0x42')](handleError(_0x297e0a,null));};exports[_0x4019('0x46')]=function(_0x43f031,_0x579502){return db['OpenchannelApplication'][_0x4019('0x46')](_0x43f031[_0x4019('0x47')],{})[_0x4019('0x22')](respondWithResult(_0x579502,0xc9))[_0x4019('0x42')](handleError(_0x579502,null));};exports['update']=function(_0x3f896b,_0x162090){if(_0x3f896b[_0x4019('0x47')]['id']){delete _0x3f896b[_0x4019('0x47')]['id'];}return db[_0x4019('0x3d')][_0x4019('0x45')]({'where':{'id':_0x3f896b[_0x4019('0x43')]['id']}})[_0x4019('0x22')](handleEntityNotFound(_0x162090,null))['then'](saveUpdates(_0x3f896b['body'],null))[_0x4019('0x22')](respondWithResult(_0x162090,null))[_0x4019('0x42')](handleError(_0x162090,null));};exports[_0x4019('0x23')]=function(_0x44ae2f,_0x4784e3){return db['OpenchannelApplication']['find']({'where':{'id':_0x44ae2f['params']['id']}})[_0x4019('0x22')](handleEntityNotFound(_0x4784e3,null))[_0x4019('0x22')](removeEntity(_0x4784e3,null))['catch'](handleError(_0x4784e3,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index e63327f..075d893 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 _0xa7d2=['api','moment','bluebird','path','rimraf','../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','lodash','../../config/logger'];(function(_0xddba19,_0x38e101){var _0x1b28e7=function(_0x49727d){while(--_0x49727d){_0xddba19['push'](_0xddba19['shift']());}};_0x1b28e7(++_0x38e101);}(_0xa7d2,0xae));var _0x2a7d=function(_0x229b30,_0x9d98eb){_0x229b30=_0x229b30-0x0;var _0x1d8669=_0xa7d2[_0x229b30];return _0x1d8669;};'use strict';var _=require(_0x2a7d('0x0'));var util=require('util');var logger=require(_0x2a7d('0x1'))(_0x2a7d('0x2'));var moment=require(_0x2a7d('0x3'));var BPromise=require(_0x2a7d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2a7d('0x5'));var rimraf=require(_0x2a7d('0x6'));var config=require(_0x2a7d('0x7'));var attributes=require(_0x2a7d('0x8'));module['exports']=function(_0x4731b9,_0x2113a2){return _0x4731b9[_0x2a7d('0x9')](_0x2a7d('0xa'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x00fe=['util','api','moment','request-promise','path','../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x4bf5ed,_0x56ac49){var _0x11d562=function(_0x1b67fc){while(--_0x1b67fc){_0x4bf5ed['push'](_0x4bf5ed['shift']());}};_0x11d562(++_0x56ac49);}(_0x00fe,0xef));var _0xe00f=function(_0x337a10,_0x5191c7){_0x337a10=_0x337a10-0x0;var _0x575f98=_0x00fe[_0x337a10];return _0x575f98;};'use strict';var _=require(_0xe00f('0x0'));var util=require(_0xe00f('0x1'));var logger=require('../../config/logger')(_0xe00f('0x2'));var moment=require(_0xe00f('0x3'));var BPromise=require('bluebird');var rp=require(_0xe00f('0x4'));var fs=require('fs');var path=require(_0xe00f('0x5'));var rimraf=require('rimraf');var config=require(_0xe00f('0x6'));var attributes=require(_0xe00f('0x7'));module['exports']=function(_0x300ca9,_0x1f064e){return _0x300ca9[_0xe00f('0x8')](_0xe00f('0x9'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe00f('0xa'),'collate':_0xe00f('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 82f6379..ab3024c 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 _0x482b=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','attributes','limit','debug','catch','util','moment','randomstring','ioredis'];(function(_0x4f5a1e,_0x5da98c){var _0x12fcd2=function(_0x5e8964){while(--_0x5e8964){_0x4f5a1e['push'](_0x4f5a1e['shift']());}};_0x12fcd2(++_0x5da98c);}(_0x482b,0x164));var _0xb482=function(_0x4ec1be,_0x50beed){_0x4ec1be=_0x4ec1be-0x0;var _0x35125b=_0x482b[_0x4ec1be];return _0x35125b;};'use strict';var _=require('lodash');var util=require(_0xb482('0x0'));var moment=require(_0xb482('0x1'));var BPromise=require('bluebird');var rs=require(_0xb482('0x2'));var fs=require('fs');var Redis=require(_0xb482('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb482('0x4'));var config=require(_0xb482('0x5'));var jayson=require(_0xb482('0x6'));var client=jayson[_0xb482('0x7')][_0xb482('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x244a3a,_0x1d0ba,_0x3cb3a1){return new BPromise(function(_0x54a290,_0x4ba0f0){return client[_0xb482('0x9')](_0x244a3a,_0x3cb3a1)[_0xb482('0xa')](function(_0x48a1f9){logger[_0xb482('0xb')](_0xb482('0xc'),_0x1d0ba,_0xb482('0xd'));logger['debug'](_0xb482('0xe'),_0x1d0ba,_0xb482('0xd'),JSON[_0xb482('0xf')](_0x48a1f9));if(_0x48a1f9[_0xb482('0x10')]){if(_0x48a1f9[_0xb482('0x10')][_0xb482('0x11')]===0x1f4){logger[_0xb482('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x1d0ba,_0x48a1f9[_0xb482('0x10')]['message']);return _0x4ba0f0(_0x48a1f9['error'][_0xb482('0x12')]);}logger[_0xb482('0x10')](_0xb482('0xc'),_0x1d0ba,_0x48a1f9[_0xb482('0x10')][_0xb482('0x12')]);return _0x54a290(_0x48a1f9[_0xb482('0x10')][_0xb482('0x12')]);}else{logger[_0xb482('0xb')](_0xb482('0xc'),_0x1d0ba,_0xb482('0xd'));_0x54a290(_0x48a1f9[_0xb482('0x13')]['message']);}})['catch'](function(_0x31d097){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x1d0ba,_0x31d097);_0x4ba0f0(_0x31d097);});});}exports[_0xb482('0x14')]=function(_0x237c3a){var _0x192a5e=this;return new Promise(function(_0x5b0d47,_0x4e7828){return db[_0xb482('0x15')][_0xb482('0x16')](_0x237c3a[_0xb482('0x17')],{'raw':_0x237c3a[_0xb482('0x18')]?_0x237c3a[_0xb482('0x18')][_0xb482('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x237c3a['options']?_0x237c3a[_0xb482('0x18')]['where']||null:null,'attributes':_0x237c3a[_0xb482('0x18')]?_0x237c3a[_0xb482('0x18')][_0xb482('0x1a')]||null:null,'limit':_0x237c3a[_0xb482('0x18')]?_0x237c3a[_0xb482('0x18')][_0xb482('0x1b')]||null:null})['then'](function(_0xa6ddb2){logger[_0xb482('0xb')](_0xb482('0x14'),_0x237c3a);logger[_0xb482('0x1c')](_0xb482('0x14'),_0x237c3a,JSON[_0xb482('0xf')](_0xa6ddb2));_0x5b0d47(_0xa6ddb2);})[_0xb482('0x1d')](function(_0x530823){logger[_0xb482('0x10')](_0xb482('0x14'),_0x530823[_0xb482('0x12')],_0x237c3a);_0x4e7828(_0x192a5e[_0xb482('0x10')](0x1f4,_0x530823[_0xb482('0x12')]));});});}; \ No newline at end of file +var _0x0640=['body','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication','update'];(function(_0x11e942,_0x17c666){var _0xde6892=function(_0x2a09a9){while(--_0x2a09a9){_0x11e942['push'](_0x11e942['shift']());}};_0xde6892(++_0x17c666);}(_0x0640,0x18c));var _0x0064=function(_0x3f87a9,_0x25003d){_0x3f87a9=_0x3f87a9-0x0;var _0x2e4625=_0x0640[_0x3f87a9];return _0x2e4625;};'use strict';var _=require(_0x0064('0x0'));var util=require(_0x0064('0x1'));var moment=require(_0x0064('0x2'));var BPromise=require(_0x0064('0x3'));var rs=require(_0x0064('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0064('0x5'));var logger=require(_0x0064('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0064('0x7'));var client=jayson[_0x0064('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55b9c7,_0x5294be,_0xd66f7e){return new BPromise(function(_0xdd186a,_0xa5724){return client[_0x0064('0x9')](_0x55b9c7,_0xd66f7e)[_0x0064('0xa')](function(_0x37f91e){logger[_0x0064('0xb')](_0x0064('0xc'),_0x5294be,_0x0064('0xd'));logger[_0x0064('0xe')](_0x0064('0xf'),_0x5294be,_0x0064('0xd'),JSON[_0x0064('0x10')](_0x37f91e));if(_0x37f91e['error']){if(_0x37f91e[_0x0064('0x11')][_0x0064('0x12')]===0x1f4){logger[_0x0064('0x11')](_0x0064('0xc'),_0x5294be,_0x37f91e['error'][_0x0064('0x13')]);return _0xa5724(_0x37f91e['error']['message']);}logger[_0x0064('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x5294be,_0x37f91e[_0x0064('0x11')][_0x0064('0x13')]);return _0xdd186a(_0x37f91e[_0x0064('0x11')][_0x0064('0x13')]);}else{logger[_0x0064('0xb')](_0x0064('0xc'),_0x5294be,_0x0064('0xd'));_0xdd186a(_0x37f91e[_0x0064('0x14')]['message']);}})[_0x0064('0x15')](function(_0x2e1693){logger[_0x0064('0x11')](_0x0064('0xc'),_0x5294be,_0x2e1693);_0xa5724(_0x2e1693);});});}exports[_0x0064('0x16')]=function(_0x1415d9){var _0xfe3cb=this;return new Promise(function(_0x437954,_0x2e2858){return db['OpenchannelApplication'][_0x0064('0x17')](_0x1415d9[_0x0064('0x18')],{'raw':_0x1415d9['options']?_0x1415d9[_0x0064('0x19')][_0x0064('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1415d9[_0x0064('0x19')]?_0x1415d9[_0x0064('0x19')][_0x0064('0x1b')]||null:null,'attributes':_0x1415d9['options']?_0x1415d9[_0x0064('0x19')][_0x0064('0x1c')]||null:null,'limit':_0x1415d9[_0x0064('0x19')]?_0x1415d9[_0x0064('0x19')][_0x0064('0x1d')]||null:null})[_0x0064('0xa')](function(_0x54182e){logger[_0x0064('0xb')]('UpdateOpenchannelApplication',_0x1415d9);logger['debug']('UpdateOpenchannelApplication',_0x1415d9,JSON[_0x0064('0x10')](_0x54182e));_0x437954(_0x54182e);})[_0x0064('0x15')](function(_0x957d81){logger['error'](_0x0064('0x16'),_0x957d81[_0x0064('0x13')],_0x1415d9);_0x2e2858(_0xfe3cb['error'](0x1f4,_0x957d81[_0x0064('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index d767429..f7c8057 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 _0xb935=['post','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download'];(function(_0x261a16,_0x21ea02){var _0x201b83=function(_0x17c167){while(--_0x17c167){_0x261a16['push'](_0x261a16['shift']());}};_0x201b83(++_0x21ea02);}(_0xb935,0xfb));var _0x5b93=function(_0x2504d5,_0x24b6d9){_0x2504d5=_0x2504d5-0x0;var _0x22de78=_0xb935[_0x2504d5];return _0x22de78;};'use strict';var multer=require(_0x5b93('0x0'));var util=require(_0x5b93('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5b93('0x2'));var router=express[_0x5b93('0x3')]();var fs_extra=require(_0x5b93('0x4'));var auth=require(_0x5b93('0x5'));var interaction=require(_0x5b93('0x6'));var config=require(_0x5b93('0x7'));var controller=require(_0x5b93('0x8'));router[_0x5b93('0x9')]('/',auth[_0x5b93('0xa')](),controller[_0x5b93('0xb')]);router[_0x5b93('0x9')](_0x5b93('0xc'),auth[_0x5b93('0xa')](),controller[_0x5b93('0xd')]);router[_0x5b93('0x9')](_0x5b93('0xe'),auth[_0x5b93('0xa')](),controller[_0x5b93('0xf')]);router[_0x5b93('0x9')](_0x5b93('0x10'),auth[_0x5b93('0xa')](),controller[_0x5b93('0x11')]);router[_0x5b93('0x9')](_0x5b93('0x12'),auth[_0x5b93('0xa')](),controller['download']);router[_0x5b93('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5b93('0x13')]('/:id/messages',auth['isAuthenticated'](),controller[_0x5b93('0x14')]);router[_0x5b93('0x13')](_0x5b93('0x15'),auth[_0x5b93('0xa')](),interaction[_0x5b93('0x16')]('openchannel',_0x5b93('0x17')),controller[_0x5b93('0x18')]);router[_0x5b93('0x19')](_0x5b93('0xe'),auth[_0x5b93('0xa')](),interaction[_0x5b93('0x16')]('openchannel',_0x5b93('0x1a')),controller['update']);router[_0x5b93('0x1b')](_0x5b93('0xe'),auth[_0x5b93('0xa')](),interaction[_0x5b93('0x16')]('openchannel','openchannelinteraction:destroy'),controller[_0x5b93('0x1c')]);router[_0x5b93('0x1b')](_0x5b93('0x15'),auth[_0x5b93('0xa')](),controller['removeTags']);module[_0x5b93('0x1d')]=router; \ No newline at end of file +var _0xaf1c=['download','create','post','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','openchannelinteraction:update','update','delete','destroy','removeTags','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download'];(function(_0x5d2443,_0x416eca){var _0x472451=function(_0x4571dc){while(--_0x4571dc){_0x5d2443['push'](_0x5d2443['shift']());}};_0x472451(++_0x416eca);}(_0xaf1c,0x6b));var _0xcaf1=function(_0xe2732b,_0x123f23){_0xe2732b=_0xe2732b-0x0;var _0x117451=_0xaf1c[_0xe2732b];return _0x117451;};'use strict';var multer=require(_0xcaf1('0x0'));var util=require(_0xcaf1('0x1'));var path=require('path');var timeout=require(_0xcaf1('0x2'));var express=require('express');var router=express[_0xcaf1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xcaf1('0x4'));var interaction=require(_0xcaf1('0x5'));var config=require(_0xcaf1('0x6'));var controller=require(_0xcaf1('0x7'));router[_0xcaf1('0x8')]('/',auth[_0xcaf1('0x9')](),controller['index']);router['get'](_0xcaf1('0xa'),auth['isAuthenticated'](),controller[_0xcaf1('0xb')]);router[_0xcaf1('0x8')](_0xcaf1('0xc'),auth[_0xcaf1('0x9')](),controller[_0xcaf1('0xd')]);router['get'](_0xcaf1('0xe'),auth[_0xcaf1('0x9')](),controller[_0xcaf1('0xf')]);router[_0xcaf1('0x8')](_0xcaf1('0x10'),auth[_0xcaf1('0x9')](),controller[_0xcaf1('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcaf1('0x12')]);router[_0xcaf1('0x13')](_0xcaf1('0xe'),auth[_0xcaf1('0x9')](),controller['addMessage']);router[_0xcaf1('0x13')](_0xcaf1('0x14'),auth[_0xcaf1('0x9')](),interaction[_0xcaf1('0x15')](_0xcaf1('0x16'),_0xcaf1('0x17')),controller[_0xcaf1('0x18')]);router['put']('/:id',auth[_0xcaf1('0x9')](),interaction[_0xcaf1('0x15')](_0xcaf1('0x16'),_0xcaf1('0x19')),controller[_0xcaf1('0x1a')]);router[_0xcaf1('0x1b')](_0xcaf1('0xc'),auth[_0xcaf1('0x9')](),interaction[_0xcaf1('0x15')](_0xcaf1('0x16'),'openchannelinteraction:destroy'),controller[_0xcaf1('0x1c')]);router[_0xcaf1('0x1b')](_0xcaf1('0x14'),auth['isAuthenticated'](),controller[_0xcaf1('0x1d')]);module[_0xcaf1('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index b565603..8e82a46 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 _0xd3a8=['INTEGER','sequelize','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x52461e,_0x29427e){var _0x2df8f3=function(_0xd13f27){while(--_0xd13f27){_0x52461e['push'](_0x52461e['shift']());}};_0x2df8f3(++_0x29427e);}(_0xd3a8,0x135));var _0x8d3a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xd3a8[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require(_0x8d3a('0x0'));module['exports']={'closed':{'type':Sequelize[_0x8d3a('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8d3a('0x2')]},'disposition':{'type':Sequelize[_0x8d3a('0x3')]},'secondDisposition':{'type':Sequelize[_0x8d3a('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x8d3a('0x3')]},'read1stAt':{'type':Sequelize[_0x8d3a('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x8d3a('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x8d3a('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x8d3a('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x8d3a('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x8d3a('0x6')]}}; \ No newline at end of file +var _0x5480=['ENUM','out','sequelize','exports','BOOLEAN','STRING','DATE'];(function(_0x2e3545,_0x20a6ec){var _0xcf18f=function(_0x3c85dd){while(--_0x3c85dd){_0x2e3545['push'](_0x2e3545['shift']());}};_0xcf18f(++_0x20a6ec);}(_0x5480,0x18a));var _0x0548=function(_0x576e2b,_0x328953){_0x576e2b=_0x576e2b-0x0;var _0x46461a=_0x5480[_0x576e2b];return _0x46461a;};'use strict';var Sequelize=require(_0x0548('0x0'));module[_0x0548('0x1')]={'closed':{'type':Sequelize[_0x0548('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x0548('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0548('0x3')]},'read1stAt':{'type':Sequelize[_0x0548('0x4')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x0548('0x3')]},'lastMsgAt':{'type':Sequelize[_0x0548('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x0548('0x5')]('in',_0x0548('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x0548('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x0548('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 17ee687..33766b3 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 _0xbf6d=['removeTags','download','toString','join','root','server','files','tmp','attachments','push','User','fullname','CmContact','Contact','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Owner','mkdirSync','Openchannel','Account','closed','closedAt','disposition','threadId','existsSync','pipe','createWriteStream','YYYY-MM-DD\x20HH:mm:ss','out','System','firstName','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','unlinkSync','zip-dir','moment','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','stack','name','map','rawAttributes','fieldName','key','getOptions','findAll','user','catch','query','type','from','params','model','keys','OpenchannelInteraction','intersection','fields','attributes','length','includeAll','include','options','find','create','body','describe','OpenchannelMessage','addMessage','ids','getMessages','findOne','filters','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','merge','$gte','split','format','rows','addTags','setTags','omit','Tag','color','openchannelInteractionTags:save'];(function(_0x599d4b,_0x1fc5e0){var _0x3ec5d0=function(_0x411950){while(--_0x411950){_0x599d4b['push'](_0x599d4b['shift']());}};_0x3ec5d0(++_0x1fc5e0);}(_0xbf6d,0xa9));var _0xdbf6=function(_0x139a23,_0x184a3f){_0x139a23=_0x139a23-0x0;var _0x4da424=_0xbf6d[_0x139a23];return _0x4da424;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xdbf6('0x0'));var moment=require(_0xdbf6('0x1'));var util=require(_0xdbf6('0x2'));var path=require('path');var ejs=require(_0xdbf6('0x3'));var fs=require('fs');var _=require(_0xdbf6('0x4'));var Redis=require(_0xdbf6('0x5'));var interaction=require(_0xdbf6('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0xdbf6('0x7'));var logger=require(_0xdbf6('0x8'))('api');var config=require(_0xdbf6('0x9'));var db=require(_0xdbf6('0xa'))['db'];config[_0xdbf6('0xb')]=_[_0xdbf6('0xc')](config[_0xdbf6('0xb')],{'host':_0xdbf6('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdbf6('0xb')]));require(_0xdbf6('0xe'))['register'](socket);function respondWithStatusCode(_0xb595d8,_0x293356){_0x293356=_0x293356||0xcc;return function(_0x5c030f){if(_0x5c030f){return _0xb595d8[_0xdbf6('0xf')](_0x293356);}return _0xb595d8[_0xdbf6('0x10')](_0x293356)[_0xdbf6('0x11')]();};}function respondWithResult(_0x35af19,_0x4a208f){_0x4a208f=_0x4a208f||0xc8;return function(_0x30af0f){if(_0x30af0f){return _0x35af19[_0xdbf6('0x10')](_0x4a208f)[_0xdbf6('0x12')](_0x30af0f);}};}function respondWithFilteredResult(_0x366a12,_0x4d4066){return function(_0x5f7c7b){if(_0x5f7c7b){var _0x3f5305=typeof _0x4d4066[_0xdbf6('0x13')]===_0xdbf6('0x14')&&typeof _0x4d4066[_0xdbf6('0x15')]===_0xdbf6('0x14');var _0x4cd5e3=_0x5f7c7b[_0xdbf6('0x16')];var _0x45b60a=_0x3f5305?0x0:_0x4d4066['offset'];var _0x441054=_0x3f5305?_0x5f7c7b[_0xdbf6('0x16')]:_0x4d4066[_0xdbf6('0x13')]+_0x4d4066[_0xdbf6('0x15')];var _0x4208ec;if(_0x441054>=_0x4cd5e3){_0x441054=_0x4cd5e3;_0x4208ec=0xc8;}else{_0x4208ec=0xce;}_0x366a12['status'](_0x4208ec);return _0x366a12['set'](_0xdbf6('0x17'),_0x45b60a+'-'+_0x441054+'/'+_0x4cd5e3)[_0xdbf6('0x12')](_0x5f7c7b);}return null;};}function saveUpdates(_0x1113fd){return function(_0x4ab2ec){if(_0x4ab2ec){return _0x4ab2ec[_0xdbf6('0x18')](_0x1113fd)[_0xdbf6('0x19')](function(_0x31f106){return _0x31f106;});}return null;};}function removeEntity(_0x5999b7){return function(_0x1b7485){if(_0x1b7485){return _0x1b7485[_0xdbf6('0x1a')]()[_0xdbf6('0x19')](function(){_0x5999b7[_0xdbf6('0x10')](0xcc)[_0xdbf6('0x11')]();});}};}function handleEntityNotFound(_0x14a5a3){return function(_0x162ecc){if(!_0x162ecc){_0x14a5a3['sendStatus'](0x194);}return _0x162ecc;};}function handleError(_0x3d36ad,_0x2bcf14){_0x2bcf14=_0x2bcf14||0x1f4;return function(_0x30e852){logger[_0xdbf6('0x1b')](_0x30e852[_0xdbf6('0x1c')]);if(_0x30e852[_0xdbf6('0x1d')]){delete _0x30e852[_0xdbf6('0x1d')];}_0x3d36ad[_0xdbf6('0x10')](_0x2bcf14)['send'](_0x30e852);};}exports['index']=function(_0x317f60,_0x4371e5){var _0x5100fd={};var _0x38f606=_[_0xdbf6('0x1e')](db['OpenchannelInteraction'][_0xdbf6('0x1f')],function(_0x70454e){return{'name':_0x70454e[_0xdbf6('0x20')],'type':_0x70454e['type'][_0xdbf6('0x21')]};});_0x5100fd=qs[_0xdbf6('0x22')](_0x38f606,_0x317f60);return interaction[_0xdbf6('0x23')]('openchannel',_0x317f60['query'],_0x317f60[_0xdbf6('0x24')],_0x5100fd,_0x38f606)[_0xdbf6('0x19')](respondWithFilteredResult(_0x4371e5,_0x5100fd))[_0xdbf6('0x25')](handleError(_0x4371e5,null));};exports['show']=function(_0x6bf304,_0x2462a2){var _0x3d564d={};if(_0x6bf304[_0xdbf6('0x26')][_0xdbf6('0x27')]&&_0x6bf304[_0xdbf6('0x26')][_0xdbf6('0x27')]===_0xdbf6('0x28')){_0x3d564d[_0xdbf6('0x28')]=_0x6bf304[_0xdbf6('0x29')]['id'];}else{_0x3d564d['id']=_0x6bf304[_0xdbf6('0x29')]['id'];}var _0x4dd052={'raw':![],'where':_0x3d564d},_0x3799bb={};_0x3799bb[_0xdbf6('0x2a')]=_[_0xdbf6('0x2b')](db[_0xdbf6('0x2c')][_0xdbf6('0x1f')]);_0x3799bb['query']=_[_0xdbf6('0x2b')](_0x6bf304[_0xdbf6('0x26')]);_0x3799bb['filters']=_[_0xdbf6('0x2d')](_0x3799bb['model'],_0x3799bb['query']);_0x4dd052['attributes']=_[_0xdbf6('0x2d')](_0x3799bb[_0xdbf6('0x2a')],qs['fields'](_0x6bf304[_0xdbf6('0x26')][_0xdbf6('0x2e')]));_0x4dd052['attributes']=_0x4dd052[_0xdbf6('0x2f')][_0xdbf6('0x30')]?_0x4dd052[_0xdbf6('0x2f')]:_0x3799bb[_0xdbf6('0x2a')];if(_0x6bf304[_0xdbf6('0x26')][_0xdbf6('0x31')]){_0x4dd052[_0xdbf6('0x32')]=[{'all':!![]}];}_0x4dd052=_['merge']({},_0x4dd052,_0x6bf304[_0xdbf6('0x33')]);return db[_0xdbf6('0x2c')][_0xdbf6('0x34')](_0x4dd052)[_0xdbf6('0x19')](handleEntityNotFound(_0x2462a2,null))['then'](respondWithResult(_0x2462a2,null))['catch'](handleError(_0x2462a2,null));};exports[_0xdbf6('0x35')]=function(_0xee1c60,_0x17f069){return db[_0xdbf6('0x2c')][_0xdbf6('0x35')](_0xee1c60[_0xdbf6('0x36')],{})[_0xdbf6('0x19')](respondWithResult(_0x17f069,0xc9))[_0xdbf6('0x25')](handleError(_0x17f069,null));};exports[_0xdbf6('0x18')]=function(_0x1046cb,_0x3a3ac2){if(_0x1046cb[_0xdbf6('0x36')]['id']){delete _0x1046cb[_0xdbf6('0x36')]['id'];}return db[_0xdbf6('0x2c')][_0xdbf6('0x34')]({'where':{'id':_0x1046cb['params']['id']}})[_0xdbf6('0x19')](handleEntityNotFound(_0x3a3ac2,null))[_0xdbf6('0x19')](saveUpdates(_0x1046cb[_0xdbf6('0x36')],null))[_0xdbf6('0x19')](respondWithResult(_0x3a3ac2,null))[_0xdbf6('0x25')](handleError(_0x3a3ac2,null));};exports[_0xdbf6('0x1a')]=function(_0x3bca39,_0x397d52){return db['OpenchannelInteraction']['find']({'where':{'id':_0x3bca39[_0xdbf6('0x29')]['id']}})[_0xdbf6('0x19')](handleEntityNotFound(_0x397d52,null))[_0xdbf6('0x19')](removeEntity(_0x397d52,null))[_0xdbf6('0x25')](handleError(_0x397d52,null));};exports[_0xdbf6('0x37')]=function(_0x2e7df8,_0x1965cf){return db[_0xdbf6('0x2c')][_0xdbf6('0x37')]()[_0xdbf6('0x19')](respondWithResult(_0x1965cf,null))[_0xdbf6('0x25')](handleError(_0x1965cf,null));};exports['addMessage']=function(_0x5cfc45,_0x5ee4c4){return db[_0xdbf6('0x38')][_0xdbf6('0x34')]({'where':{'id':_0x5cfc45[_0xdbf6('0x29')]['id']}})[_0xdbf6('0x19')](handleEntityNotFound(_0x5ee4c4,null))[_0xdbf6('0x19')](function(_0x37025c){if(_0x37025c){return _0x37025c[_0xdbf6('0x39')](_0x5cfc45['body'][_0xdbf6('0x3a')],_['omit'](_0x5cfc45['body'],[_0xdbf6('0x3a'),'id'])||{});}})[_0xdbf6('0x19')](respondWithResult(_0x5ee4c4,null))[_0xdbf6('0x25')](handleError(_0x5ee4c4,null));};exports[_0xdbf6('0x3b')]=function(_0x4b90a9,_0x56b3b4){var _0x4f17f9={'raw':![],'where':{}};var _0x5605fa={};var _0x3c5697={'count':0x0,'rows':[]};return db[_0xdbf6('0x2c')][_0xdbf6('0x3c')]({'where':{'id':_0x4b90a9['params']['id']}})[_0xdbf6('0x19')](handleEntityNotFound(_0x56b3b4,null))[_0xdbf6('0x19')](function(_0xc57f2){if(_0xc57f2){_0x5605fa[_0xdbf6('0x2a')]=_[_0xdbf6('0x2b')](db[_0xdbf6('0x38')][_0xdbf6('0x1f')]);_0x5605fa[_0xdbf6('0x26')]=_[_0xdbf6('0x2b')](_0x4b90a9[_0xdbf6('0x26')]);_0x5605fa[_0xdbf6('0x3d')]=_[_0xdbf6('0x2d')](_0x5605fa[_0xdbf6('0x2a')],_0x5605fa[_0xdbf6('0x26')]);_0x4f17f9[_0xdbf6('0x2f')]=_[_0xdbf6('0x2d')](_0x5605fa[_0xdbf6('0x2a')],qs[_0xdbf6('0x2e')](_0x4b90a9[_0xdbf6('0x26')][_0xdbf6('0x2e')]));_0x4f17f9[_0xdbf6('0x2f')]=_0x4f17f9[_0xdbf6('0x2f')][_0xdbf6('0x30')]?_0x4f17f9[_0xdbf6('0x2f')]:_0x5605fa[_0xdbf6('0x2a')];if(!_0x4b90a9[_0xdbf6('0x26')][_0xdbf6('0x3e')](_0xdbf6('0x3f'))){_0x4f17f9['limit']=qs[_0xdbf6('0x15')](_0x4b90a9['query'][_0xdbf6('0x15')]);_0x4f17f9[_0xdbf6('0x13')]=qs[_0xdbf6('0x13')](_0x4b90a9['query']['offset']);}_0x4f17f9[_0xdbf6('0x40')]=qs[_0xdbf6('0x41')](_0x4b90a9[_0xdbf6('0x26')][_0xdbf6('0x41')]);_0x4f17f9[_0xdbf6('0x42')]=qs['filters'](_[_0xdbf6('0x43')](_0x4b90a9[_0xdbf6('0x26')],_0x5605fa['filters']));_0x4f17f9[_0xdbf6('0x42')][_0xdbf6('0x44')]=_0xc57f2['id'];if(_0x4b90a9[_0xdbf6('0x26')][_0xdbf6('0x45')]){_0x4f17f9[_0xdbf6('0x42')]=_[_0xdbf6('0x46')](_0x4f17f9['where'],{'$or':_[_0xdbf6('0x1e')](_0x4f17f9['attributes'],function(_0x27d7d6){var _0x2185c3={};_0x2185c3[_0x27d7d6]={'$like':'%'+_0x4b90a9[_0xdbf6('0x26')][_0xdbf6('0x45')]+'%'};return _0x2185c3;})});}if(_0x4b90a9[_0xdbf6('0x26')][_0xdbf6('0x47')]){var _0x47bae5=_0x4b90a9['query']['$gte'][_0xdbf6('0x48')](',');var _0x579757={};_0x579757[_0x47bae5[0x0]]={'$gte':moment(_0x47bae5[0x1])[_0xdbf6('0x49')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4f17f9[_0xdbf6('0x42')]=_[_0xdbf6('0x46')](_0x4f17f9[_0xdbf6('0x42')],_0x579757);}_0x4f17f9=_[_0xdbf6('0x46')]({},_0x4f17f9,_0x4b90a9[_0xdbf6('0x33')]);return db['OpenchannelMessage'][_0xdbf6('0x16')]({'where':_0x4f17f9[_0xdbf6('0x42')]})['then'](function(_0xfef98a){_0x3c5697[_0xdbf6('0x16')]=_0xfef98a;if(_0x4b90a9['query'][_0xdbf6('0x31')]){_0x4f17f9[_0xdbf6('0x32')]=[{'all':!![]}];}return db[_0xdbf6('0x38')][_0xdbf6('0x23')](_0x4f17f9);})[_0xdbf6('0x19')](function(_0x428a2e){_0x3c5697[_0xdbf6('0x4a')]=_0x428a2e;return _0x3c5697;});}})[_0xdbf6('0x19')](respondWithFilteredResult(_0x56b3b4,_0x4f17f9))[_0xdbf6('0x25')](handleError(_0x56b3b4,null));};exports[_0xdbf6('0x4b')]=function(_0x104c58,_0x19a4e9){return db[_0xdbf6('0x2c')][_0xdbf6('0x34')]({'where':{'id':_0x104c58[_0xdbf6('0x29')]['id']}})[_0xdbf6('0x19')](handleEntityNotFound(_0x19a4e9,null))[_0xdbf6('0x19')](function(_0x3b45ec){if(_0x3b45ec){return _0x3b45ec[_0xdbf6('0x4c')](_0x104c58[_0xdbf6('0x36')][_0xdbf6('0x3a')],_[_0xdbf6('0x4d')](_0x104c58[_0xdbf6('0x36')],[_0xdbf6('0x3a'),'id'])||{})['spread'](function(){return db[_0xdbf6('0x4e')]['findAll']({'attributes':['id',_0xdbf6('0x1d'),_0xdbf6('0x4f')],'where':{'id':_0x104c58['body']['ids']}});})['then'](function(_0x2dff46){socket['emit'](_0xdbf6('0x50'),{'id':Number(_0x104c58[_0xdbf6('0x29')]['id']),'tags':_0x2dff46||[]});return{'id':Number(_0x104c58[_0xdbf6('0x29')]['id']),'tags':_0x2dff46||[]};});}})[_0xdbf6('0x19')](respondWithResult(_0x19a4e9,null))[_0xdbf6('0x25')](handleError(_0x19a4e9,null));};exports['removeTags']=function(_0x18fc6d,_0x281dc4){return db[_0xdbf6('0x2c')][_0xdbf6('0x34')]({'where':{'id':_0x18fc6d[_0xdbf6('0x29')]['id']}})[_0xdbf6('0x19')](handleEntityNotFound(_0x281dc4,null))['then'](function(_0x28647e){if(_0x28647e){return _0x28647e[_0xdbf6('0x51')](_0x18fc6d[_0xdbf6('0x26')][_0xdbf6('0x3a')]);}})[_0xdbf6('0x19')](respondWithStatusCode(_0x281dc4,null))[_0xdbf6('0x25')](handleError(_0x281dc4,null));};exports[_0xdbf6('0x52')]=function(_0x498e58,_0x35216b){var _0x58963a=moment()['unix']()[_0xdbf6('0x53')]();var _0x3a818a=path[_0xdbf6('0x54')](config[_0xdbf6('0x55')],_0xdbf6('0x56'),_0xdbf6('0x57'),_0xdbf6('0x58'));var _0x37a3fb=path[_0xdbf6('0x54')](config['root'],_0xdbf6('0x56'),_0xdbf6('0x57'),_0xdbf6('0x59'));var _0xbae957=path[_0xdbf6('0x54')](_0x3a818a,_0x58963a);var _0x5f1a99=util[_0xdbf6('0x49')]('transcript-%d-%s.zip',_0x498e58[_0xdbf6('0x29')]['id'],_0x58963a);var _0x517399=path[_0xdbf6('0x54')](_0x3a818a,_0x5f1a99);var _0x1a910a=[];_0x1a910a[_0xdbf6('0x5a')]({'model':db[_0xdbf6('0x5b')],'as':_0xdbf6('0x5b'),'attributes':['id',_0xdbf6('0x5c')],'raw':!![]});_0x1a910a['push']({'model':db[_0xdbf6('0x5d')],'as':_0xdbf6('0x5e'),'attributes':['id','firstName',_0xdbf6('0x5f')],'raw':!![]});if(_0x498e58[_0xdbf6('0x26')][_0xdbf6('0x59')]){_0x1a910a[_0xdbf6('0x5a')]({'model':db[_0xdbf6('0x60')],'as':_0xdbf6('0x60'),'raw':!![]});}var _0x516eda=[{'model':db[_0xdbf6('0x38')],'as':_0xdbf6('0x61'),'attributes':['id',_0xdbf6('0x36'),_0xdbf6('0x62'),_0xdbf6('0x63'),_0xdbf6('0x64'),_0xdbf6('0x65')],'include':_0x1a910a}];_0x516eda[_0xdbf6('0x5a')]({'model':db[_0xdbf6('0x66')],'as':'Account','attributes':['id','name']});_0x516eda['push']({'model':db[_0xdbf6('0x5b')],'as':_0xdbf6('0x67'),'attributes':['id',_0xdbf6('0x5c')]});return db[_0xdbf6('0x2c')]['find']({'where':{'id':_0x498e58[_0xdbf6('0x29')]['id']},'include':_0x516eda})['then'](handleEntityNotFound(_0x35216b,null))['then'](function(_0x5e8d08){if(_0x5e8d08){var _0x2599a1=_0x5e8d08['get']({'plain':!![]});fs[_0xdbf6('0x68')](_0xbae957);var _0x5202d4={'channel':_0xdbf6('0x69'),'account':_0x2599a1[_0xdbf6('0x6a')][_0xdbf6('0x1d')],'agent':_0x2599a1[_0xdbf6('0x67')]?_0x2599a1['Owner']['fullname']:'N.A.','createdAt':moment(_0x2599a1[_0xdbf6('0x62')])[_0xdbf6('0x49')]('YYYY-MM-DD\x20HH:mm:ss')[_0xdbf6('0x53')](),'closedAt':_0x2599a1[_0xdbf6('0x6b')]?moment(_0x2599a1[_0xdbf6('0x6c')])[_0xdbf6('0x49')]('YYYY-MM-DD\x20HH:mm:ss')[_0xdbf6('0x53')]():'','disposition':_0x2599a1[_0xdbf6('0x6d')],'visibility':_0x2599a1[_0xdbf6('0x6e')]?'Public':'Private','messages':_(_0x2599a1[_0xdbf6('0x61')])['filter']({'secret':![]})[_0xdbf6('0x1e')](function(_0x221463){if(_0x221463[_0xdbf6('0x60')]){var _0x45f8ea=path[_0xdbf6('0x54')](_0x37a3fb,_0x221463['Attachment']['basename']);if(fs[_0xdbf6('0x6f')](_0x45f8ea)){fs['createReadStream'](_0x45f8ea)[_0xdbf6('0x70')](fs[_0xdbf6('0x71')](path[_0xdbf6('0x54')](_0xbae957,_0x221463[_0xdbf6('0x60')]['basename'])));}}return{'date':moment(_0x221463[_0xdbf6('0x62')])[_0xdbf6('0x49')](_0xdbf6('0x72'))[_0xdbf6('0x53')](),'sender':_0x221463[_0xdbf6('0x63')]===_0xdbf6('0x73')?_0x221463['User']?_0x221463['User'][_0xdbf6('0x5c')]:_0xdbf6('0x74'):_0x221463[_0xdbf6('0x5e')][_0xdbf6('0x75')]+(_0x221463['Contact'][_0xdbf6('0x5f')]?'\x20'+_0x221463[_0xdbf6('0x5e')]['lastName']:''),'body':_0x221463[_0xdbf6('0x60')]?_0x221463[_0xdbf6('0x60')]['basename']:_0x221463[_0xdbf6('0x36')],'direction':_0x221463[_0xdbf6('0x63')]===_0xdbf6('0x73')?'A':'C','secret':_0x221463[_0xdbf6('0x64')],'read':_0x221463['read'],'attachment':_0x221463[_0xdbf6('0x60')]};})[_0xdbf6('0x76')]()};return ejs[_0xdbf6('0x77')](path['join'](config[_0xdbf6('0x55')],_0xdbf6('0x56'),_0xdbf6('0x78'),_0xdbf6('0x79')),{'interaction':_0x5202d4})[_0xdbf6('0x19')](function(_0x5b365f){var _0x5d4a84=path['join'](_0xbae957,_0xdbf6('0x7a')+_0x2599a1['id']+'-'+_0x58963a+_0xdbf6('0x7b'));var _0x76a59f={'path':_0x5d4a84,'channel':_0xdbf6('0x69'),'interactionId':_0x2599a1['id']};return pdf['createPdfFromHTML'](_0x5b365f,_0x76a59f);})['then'](function(){return new Promise(function(_0x4a1ee2,_0x2b990b){zipdir(_0xbae957,{'saveTo':_0x517399},function(_0x246fb6,_0x29e468){if(_0x246fb6)return _0x2b990b(_0x246fb6);return _0x4a1ee2(_0x29e468);});})[_0xdbf6('0x19')](function(){return new Promise(function(_0x28c04b,_0x402de5){rimraf(_0xbae957,function(_0x522003){if(_0x522003)_0x402de5(_0x522003);return _0x28c04b();});});})[_0xdbf6('0x19')](function(){return _0x35216b['download'](_0x517399,_0x5f1a99,function(_0x38979d){if(_0x38979d){logger[_0xdbf6('0x1b')]('Unable\x20to\x20delete\x20zip\x20file',_0x38979d);}else{fs[_0xdbf6('0x7c')](_0x517399);}});});});}else{return _0x35216b[_0xdbf6('0xf')](0xc8);}})[_0xdbf6('0x25')](handleError(_0x35216b,null));}; \ No newline at end of file +var _0x4cfc=['end','json','offset','undefined','count','limit','set','Content-Range','update','then','error','stack','name','send','index','map','OpenchannelInteraction','fieldName','type','key','getOptions','findAll','openchannel','query','user','catch','show','from','params','keys','rawAttributes','filters','intersection','attributes','model','fields','include','merge','find','create','body','describe','addMessage','ids','getMessages','findOne','OpenchannelMessage','length','hasOwnProperty','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','rows','addTags','spread','Tag','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','push','User','CmContact','Attachment','Messages','createdAt','secret','read','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','fullname','N.A.','toString','closed','closedAt','disposition','threadId','Public','Private','existsSync','pipe','createWriteStream','basename','direction','System','firstName','Contact','lastName','out','value','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','zip-dir','moment','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../mysqldb','redis','defaults','localhost','register','sendStatus','status'];(function(_0x29ad84,_0x2bc09c){var _0x2be7c5=function(_0x9f1728){while(--_0x9f1728){_0x29ad84['push'](_0x29ad84['shift']());}};_0x2be7c5(++_0x2bc09c);}(_0x4cfc,0x74));var _0xc4cf=function(_0x1ffa1c,_0x331699){_0x1ffa1c=_0x1ffa1c-0x0;var _0x26d2c3=_0x4cfc[_0x1ffa1c];return _0x26d2c3;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xc4cf('0x0'));var moment=require(_0xc4cf('0x1'));var util=require('util');var path=require(_0xc4cf('0x2'));var ejs=require(_0xc4cf('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xc4cf('0x4'));var interaction=require(_0xc4cf('0x5'));var qs=require(_0xc4cf('0x6'));var pdf=require(_0xc4cf('0x7'));var logger=require('../../config/logger')(_0xc4cf('0x8'));var config=require('../../config/environment');var db=require(_0xc4cf('0x9'))['db'];config[_0xc4cf('0xa')]=_[_0xc4cf('0xb')](config[_0xc4cf('0xa')],{'host':_0xc4cf('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc4cf('0xa')]));require('./openchannelInteraction.socket')[_0xc4cf('0xd')](socket);function respondWithStatusCode(_0x30cbb2,_0x29c4f7){_0x29c4f7=_0x29c4f7||0xcc;return function(_0x3b79a7){if(_0x3b79a7){return _0x30cbb2[_0xc4cf('0xe')](_0x29c4f7);}return _0x30cbb2[_0xc4cf('0xf')](_0x29c4f7)[_0xc4cf('0x10')]();};}function respondWithResult(_0x4a5ec2,_0x4efee7){_0x4efee7=_0x4efee7||0xc8;return function(_0xa95a0a){if(_0xa95a0a){return _0x4a5ec2[_0xc4cf('0xf')](_0x4efee7)[_0xc4cf('0x11')](_0xa95a0a);}};}function respondWithFilteredResult(_0x49d7f9,_0x21bb9a){return function(_0x7ce925){if(_0x7ce925){var _0x54845a=typeof _0x21bb9a[_0xc4cf('0x12')]==='undefined'&&typeof _0x21bb9a['limit']===_0xc4cf('0x13');var _0x3f6ce9=_0x7ce925[_0xc4cf('0x14')];var _0x558a8a=_0x54845a?0x0:_0x21bb9a[_0xc4cf('0x12')];var _0x2ccf96=_0x54845a?_0x7ce925[_0xc4cf('0x14')]:_0x21bb9a[_0xc4cf('0x12')]+_0x21bb9a[_0xc4cf('0x15')];var _0x507cc0;if(_0x2ccf96>=_0x3f6ce9){_0x2ccf96=_0x3f6ce9;_0x507cc0=0xc8;}else{_0x507cc0=0xce;}_0x49d7f9[_0xc4cf('0xf')](_0x507cc0);return _0x49d7f9[_0xc4cf('0x16')](_0xc4cf('0x17'),_0x558a8a+'-'+_0x2ccf96+'/'+_0x3f6ce9)['json'](_0x7ce925);}return null;};}function saveUpdates(_0x25b119){return function(_0x4de813){if(_0x4de813){return _0x4de813[_0xc4cf('0x18')](_0x25b119)[_0xc4cf('0x19')](function(_0x395c90){return _0x395c90;});}return null;};}function removeEntity(_0x196843){return function(_0x3a01cb){if(_0x3a01cb){return _0x3a01cb['destroy']()[_0xc4cf('0x19')](function(){_0x196843[_0xc4cf('0xf')](0xcc)[_0xc4cf('0x10')]();});}};}function handleEntityNotFound(_0x16845c){return function(_0x458a1d){if(!_0x458a1d){_0x16845c[_0xc4cf('0xe')](0x194);}return _0x458a1d;};}function handleError(_0x1f066f,_0x3530ca){_0x3530ca=_0x3530ca||0x1f4;return function(_0x41a3b9){logger[_0xc4cf('0x1a')](_0x41a3b9[_0xc4cf('0x1b')]);if(_0x41a3b9[_0xc4cf('0x1c')]){delete _0x41a3b9[_0xc4cf('0x1c')];}_0x1f066f[_0xc4cf('0xf')](_0x3530ca)[_0xc4cf('0x1d')](_0x41a3b9);};}exports[_0xc4cf('0x1e')]=function(_0x3e389c,_0x77c2a3){var _0x161b88={};var _0x55bd7a=_[_0xc4cf('0x1f')](db[_0xc4cf('0x20')]['rawAttributes'],function(_0x2e1793){return{'name':_0x2e1793[_0xc4cf('0x21')],'type':_0x2e1793[_0xc4cf('0x22')][_0xc4cf('0x23')]};});_0x161b88=qs[_0xc4cf('0x24')](_0x55bd7a,_0x3e389c);return interaction[_0xc4cf('0x25')](_0xc4cf('0x26'),_0x3e389c[_0xc4cf('0x27')],_0x3e389c[_0xc4cf('0x28')],_0x161b88,_0x55bd7a)[_0xc4cf('0x19')](respondWithFilteredResult(_0x77c2a3,_0x161b88))[_0xc4cf('0x29')](handleError(_0x77c2a3,null));};exports[_0xc4cf('0x2a')]=function(_0x150aed,_0x4a2a0c){var _0x55d32b={};if(_0x150aed[_0xc4cf('0x27')]['type']&&_0x150aed[_0xc4cf('0x27')][_0xc4cf('0x22')]===_0xc4cf('0x2b')){_0x55d32b[_0xc4cf('0x2b')]=_0x150aed[_0xc4cf('0x2c')]['id'];}else{_0x55d32b['id']=_0x150aed[_0xc4cf('0x2c')]['id'];}var _0x3cf781={'raw':![],'where':_0x55d32b},_0x16aafc={};_0x16aafc['model']=_[_0xc4cf('0x2d')](db[_0xc4cf('0x20')][_0xc4cf('0x2e')]);_0x16aafc['query']=_[_0xc4cf('0x2d')](_0x150aed[_0xc4cf('0x27')]);_0x16aafc[_0xc4cf('0x2f')]=_[_0xc4cf('0x30')](_0x16aafc['model'],_0x16aafc['query']);_0x3cf781[_0xc4cf('0x31')]=_['intersection'](_0x16aafc[_0xc4cf('0x32')],qs[_0xc4cf('0x33')](_0x150aed[_0xc4cf('0x27')]['fields']));_0x3cf781[_0xc4cf('0x31')]=_0x3cf781[_0xc4cf('0x31')]['length']?_0x3cf781[_0xc4cf('0x31')]:_0x16aafc['model'];if(_0x150aed[_0xc4cf('0x27')]['includeAll']){_0x3cf781[_0xc4cf('0x34')]=[{'all':!![]}];}_0x3cf781=_[_0xc4cf('0x35')]({},_0x3cf781,_0x150aed['options']);return db[_0xc4cf('0x20')][_0xc4cf('0x36')](_0x3cf781)['then'](handleEntityNotFound(_0x4a2a0c,null))['then'](respondWithResult(_0x4a2a0c,null))[_0xc4cf('0x29')](handleError(_0x4a2a0c,null));};exports[_0xc4cf('0x37')]=function(_0x2b286a,_0x52d66d){return db[_0xc4cf('0x20')][_0xc4cf('0x37')](_0x2b286a[_0xc4cf('0x38')],{})['then'](respondWithResult(_0x52d66d,0xc9))[_0xc4cf('0x29')](handleError(_0x52d66d,null));};exports[_0xc4cf('0x18')]=function(_0x5a1943,_0x401527){if(_0x5a1943['body']['id']){delete _0x5a1943['body']['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x5a1943[_0xc4cf('0x2c')]['id']}})[_0xc4cf('0x19')](handleEntityNotFound(_0x401527,null))[_0xc4cf('0x19')](saveUpdates(_0x5a1943[_0xc4cf('0x38')],null))[_0xc4cf('0x19')](respondWithResult(_0x401527,null))[_0xc4cf('0x29')](handleError(_0x401527,null));};exports['destroy']=function(_0x568f0e,_0x34a650){return db['OpenchannelInteraction'][_0xc4cf('0x36')]({'where':{'id':_0x568f0e[_0xc4cf('0x2c')]['id']}})[_0xc4cf('0x19')](handleEntityNotFound(_0x34a650,null))['then'](removeEntity(_0x34a650,null))['catch'](handleError(_0x34a650,null));};exports[_0xc4cf('0x39')]=function(_0x3bf133,_0x1933dc){return db[_0xc4cf('0x20')][_0xc4cf('0x39')]()[_0xc4cf('0x19')](respondWithResult(_0x1933dc,null))['catch'](handleError(_0x1933dc,null));};exports[_0xc4cf('0x3a')]=function(_0xca64c6,_0x21a07d){return db['OpenchannelMessage'][_0xc4cf('0x36')]({'where':{'id':_0xca64c6['params']['id']}})['then'](handleEntityNotFound(_0x21a07d,null))[_0xc4cf('0x19')](function(_0x5bb933){if(_0x5bb933){return _0x5bb933[_0xc4cf('0x3a')](_0xca64c6['body'][_0xc4cf('0x3b')],_['omit'](_0xca64c6['body'],['ids','id'])||{});}})[_0xc4cf('0x19')](respondWithResult(_0x21a07d,null))[_0xc4cf('0x29')](handleError(_0x21a07d,null));};exports[_0xc4cf('0x3c')]=function(_0x11fcb1,_0x38d584){var _0x29b2ff={'raw':![],'where':{}};var _0xaa6dd={};var _0x4b6ca7={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xc4cf('0x3d')]({'where':{'id':_0x11fcb1[_0xc4cf('0x2c')]['id']}})['then'](handleEntityNotFound(_0x38d584,null))[_0xc4cf('0x19')](function(_0x263bdf){if(_0x263bdf){_0xaa6dd[_0xc4cf('0x32')]=_[_0xc4cf('0x2d')](db[_0xc4cf('0x3e')][_0xc4cf('0x2e')]);_0xaa6dd[_0xc4cf('0x27')]=_['keys'](_0x11fcb1[_0xc4cf('0x27')]);_0xaa6dd[_0xc4cf('0x2f')]=_['intersection'](_0xaa6dd[_0xc4cf('0x32')],_0xaa6dd[_0xc4cf('0x27')]);_0x29b2ff['attributes']=_[_0xc4cf('0x30')](_0xaa6dd[_0xc4cf('0x32')],qs[_0xc4cf('0x33')](_0x11fcb1[_0xc4cf('0x27')][_0xc4cf('0x33')]));_0x29b2ff['attributes']=_0x29b2ff['attributes'][_0xc4cf('0x3f')]?_0x29b2ff[_0xc4cf('0x31')]:_0xaa6dd['model'];if(!_0x11fcb1[_0xc4cf('0x27')][_0xc4cf('0x40')]('nolimit')){_0x29b2ff[_0xc4cf('0x15')]=qs['limit'](_0x11fcb1['query']['limit']);_0x29b2ff[_0xc4cf('0x12')]=qs[_0xc4cf('0x12')](_0x11fcb1['query'][_0xc4cf('0x12')]);}_0x29b2ff['order']=qs[_0xc4cf('0x41')](_0x11fcb1[_0xc4cf('0x27')][_0xc4cf('0x41')]);_0x29b2ff[_0xc4cf('0x42')]=qs[_0xc4cf('0x2f')](_[_0xc4cf('0x43')](_0x11fcb1['query'],_0xaa6dd[_0xc4cf('0x2f')]));_0x29b2ff[_0xc4cf('0x42')][_0xc4cf('0x44')]=_0x263bdf['id'];if(_0x11fcb1[_0xc4cf('0x27')][_0xc4cf('0x45')]){_0x29b2ff['where']=_[_0xc4cf('0x35')](_0x29b2ff['where'],{'$or':_[_0xc4cf('0x1f')](_0x29b2ff[_0xc4cf('0x31')],function(_0x551a69){var _0x4f78da={};_0x4f78da[_0x551a69]={'$like':'%'+_0x11fcb1[_0xc4cf('0x27')][_0xc4cf('0x45')]+'%'};return _0x4f78da;})});}if(_0x11fcb1[_0xc4cf('0x27')][_0xc4cf('0x46')]){var _0x2ae70f=_0x11fcb1['query'][_0xc4cf('0x46')][_0xc4cf('0x47')](',');var _0x293325={};_0x293325[_0x2ae70f[0x0]]={'$gte':moment(_0x2ae70f[0x1])[_0xc4cf('0x48')](_0xc4cf('0x49'))};_0x29b2ff[_0xc4cf('0x42')]=_[_0xc4cf('0x35')](_0x29b2ff['where'],_0x293325);}_0x29b2ff=_['merge']({},_0x29b2ff,_0x11fcb1[_0xc4cf('0x4a')]);return db[_0xc4cf('0x3e')][_0xc4cf('0x14')]({'where':_0x29b2ff[_0xc4cf('0x42')]})[_0xc4cf('0x19')](function(_0x1e1a8f){_0x4b6ca7[_0xc4cf('0x14')]=_0x1e1a8f;if(_0x11fcb1[_0xc4cf('0x27')][_0xc4cf('0x4b')]){_0x29b2ff[_0xc4cf('0x34')]=[{'all':!![]}];}return db[_0xc4cf('0x3e')][_0xc4cf('0x25')](_0x29b2ff);})[_0xc4cf('0x19')](function(_0x16da7a){_0x4b6ca7[_0xc4cf('0x4c')]=_0x16da7a;return _0x4b6ca7;});}})[_0xc4cf('0x19')](respondWithFilteredResult(_0x38d584,_0x29b2ff))[_0xc4cf('0x29')](handleError(_0x38d584,null));};exports[_0xc4cf('0x4d')]=function(_0x53e4cd,_0x3f660d){return db[_0xc4cf('0x20')][_0xc4cf('0x36')]({'where':{'id':_0x53e4cd[_0xc4cf('0x2c')]['id']}})[_0xc4cf('0x19')](handleEntityNotFound(_0x3f660d,null))[_0xc4cf('0x19')](function(_0x3328aa){if(_0x3328aa){return _0x3328aa['setTags'](_0x53e4cd[_0xc4cf('0x38')][_0xc4cf('0x3b')],_['omit'](_0x53e4cd[_0xc4cf('0x38')],[_0xc4cf('0x3b'),'id'])||{})[_0xc4cf('0x4e')](function(){return db[_0xc4cf('0x4f')]['findAll']({'attributes':['id',_0xc4cf('0x1c'),'color'],'where':{'id':_0x53e4cd[_0xc4cf('0x38')][_0xc4cf('0x3b')]}});})[_0xc4cf('0x19')](function(_0x59838b){socket[_0xc4cf('0x50')](_0xc4cf('0x51'),{'id':Number(_0x53e4cd['params']['id']),'tags':_0x59838b||[]});return{'id':Number(_0x53e4cd[_0xc4cf('0x2c')]['id']),'tags':_0x59838b||[]};});}})['then'](respondWithResult(_0x3f660d,null))[_0xc4cf('0x29')](handleError(_0x3f660d,null));};exports[_0xc4cf('0x52')]=function(_0x3ed6d6,_0x5b7eb5){return db['OpenchannelInteraction']['find']({'where':{'id':_0x3ed6d6[_0xc4cf('0x2c')]['id']}})[_0xc4cf('0x19')](handleEntityNotFound(_0x5b7eb5,null))[_0xc4cf('0x19')](function(_0x21dc94){if(_0x21dc94){return _0x21dc94['removeTags'](_0x3ed6d6[_0xc4cf('0x27')][_0xc4cf('0x3b')]);}})[_0xc4cf('0x19')](respondWithStatusCode(_0x5b7eb5,null))['catch'](handleError(_0x5b7eb5,null));};exports[_0xc4cf('0x53')]=function(_0x1381c6,_0x577c41){var _0x2a8f9c=moment()[_0xc4cf('0x54')]()['toString']();var _0x320db0=path[_0xc4cf('0x55')](config[_0xc4cf('0x56')],_0xc4cf('0x57'),_0xc4cf('0x58'),_0xc4cf('0x59'));var _0x56c6b8=path[_0xc4cf('0x55')](config[_0xc4cf('0x56')],_0xc4cf('0x57'),_0xc4cf('0x58'),_0xc4cf('0x5a'));var _0x14d22a=path[_0xc4cf('0x55')](_0x320db0,_0x2a8f9c);var _0x898caa=util['format']('transcript-%d-%s.zip',_0x1381c6['params']['id'],_0x2a8f9c);var _0xb2a6ec=path[_0xc4cf('0x55')](_0x320db0,_0x898caa);var _0x4fb166=[];_0x4fb166[_0xc4cf('0x5b')]({'model':db[_0xc4cf('0x5c')],'as':_0xc4cf('0x5c'),'attributes':['id','fullname'],'raw':!![]});_0x4fb166['push']({'model':db[_0xc4cf('0x5d')],'as':'Contact','attributes':['id','firstName','lastName'],'raw':!![]});if(_0x1381c6['query'][_0xc4cf('0x5a')]){_0x4fb166[_0xc4cf('0x5b')]({'model':db[_0xc4cf('0x5e')],'as':_0xc4cf('0x5e'),'raw':!![]});}var _0x41bf57=[{'model':db['OpenchannelMessage'],'as':_0xc4cf('0x5f'),'attributes':['id',_0xc4cf('0x38'),_0xc4cf('0x60'),'direction',_0xc4cf('0x61'),_0xc4cf('0x62')],'include':_0x4fb166}];_0x41bf57[_0xc4cf('0x5b')]({'model':db[_0xc4cf('0x63')],'as':_0xc4cf('0x64'),'attributes':['id',_0xc4cf('0x1c')]});_0x41bf57['push']({'model':db[_0xc4cf('0x5c')],'as':_0xc4cf('0x65'),'attributes':['id','fullname']});return db[_0xc4cf('0x20')][_0xc4cf('0x36')]({'where':{'id':_0x1381c6[_0xc4cf('0x2c')]['id']},'include':_0x41bf57})['then'](handleEntityNotFound(_0x577c41,null))[_0xc4cf('0x19')](function(_0x4832fb){if(_0x4832fb){var _0x53f299=_0x4832fb[_0xc4cf('0x66')]({'plain':!![]});fs[_0xc4cf('0x67')](_0x14d22a);var _0x413b9b={'channel':_0xc4cf('0x68'),'account':_0x53f299[_0xc4cf('0x64')][_0xc4cf('0x1c')],'agent':_0x53f299[_0xc4cf('0x65')]?_0x53f299[_0xc4cf('0x65')][_0xc4cf('0x69')]:_0xc4cf('0x6a'),'createdAt':moment(_0x53f299[_0xc4cf('0x60')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xc4cf('0x6b')](),'closedAt':_0x53f299[_0xc4cf('0x6c')]?moment(_0x53f299[_0xc4cf('0x6d')])[_0xc4cf('0x48')](_0xc4cf('0x49'))[_0xc4cf('0x6b')]():'','disposition':_0x53f299[_0xc4cf('0x6e')],'visibility':_0x53f299[_0xc4cf('0x6f')]?_0xc4cf('0x70'):_0xc4cf('0x71'),'messages':_(_0x53f299[_0xc4cf('0x5f')])[_0xc4cf('0x45')]({'secret':![]})[_0xc4cf('0x1f')](function(_0x15eea9){if(_0x15eea9[_0xc4cf('0x5e')]){var _0x626827=path['join'](_0x56c6b8,_0x15eea9[_0xc4cf('0x5e')]['basename']);if(fs[_0xc4cf('0x72')](_0x626827)){fs['createReadStream'](_0x626827)[_0xc4cf('0x73')](fs[_0xc4cf('0x74')](path[_0xc4cf('0x55')](_0x14d22a,_0x15eea9[_0xc4cf('0x5e')][_0xc4cf('0x75')])));}}return{'date':moment(_0x15eea9['createdAt'])[_0xc4cf('0x48')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc4cf('0x6b')](),'sender':_0x15eea9[_0xc4cf('0x76')]==='out'?_0x15eea9[_0xc4cf('0x5c')]?_0x15eea9[_0xc4cf('0x5c')][_0xc4cf('0x69')]:_0xc4cf('0x77'):_0x15eea9['Contact'][_0xc4cf('0x78')]+(_0x15eea9[_0xc4cf('0x79')][_0xc4cf('0x7a')]?'\x20'+_0x15eea9[_0xc4cf('0x79')]['lastName']:''),'body':_0x15eea9[_0xc4cf('0x5e')]?_0x15eea9[_0xc4cf('0x5e')]['basename']:_0x15eea9[_0xc4cf('0x38')],'direction':_0x15eea9['direction']===_0xc4cf('0x7b')?'A':'C','secret':_0x15eea9[_0xc4cf('0x61')],'read':_0x15eea9[_0xc4cf('0x62')],'attachment':_0x15eea9[_0xc4cf('0x5e')]};})[_0xc4cf('0x7c')]()};return ejs[_0xc4cf('0x7d')](path[_0xc4cf('0x55')](config[_0xc4cf('0x56')],'server',_0xc4cf('0x7e'),_0xc4cf('0x7f')),{'interaction':_0x413b9b})['then'](function(_0x509214){var _0x177efa=path[_0xc4cf('0x55')](_0x14d22a,'transcript-'+_0x53f299['id']+'-'+_0x2a8f9c+_0xc4cf('0x80'));var _0x4c27b4={'path':_0x177efa,'channel':_0xc4cf('0x68'),'interactionId':_0x53f299['id']};return pdf[_0xc4cf('0x81')](_0x509214,_0x4c27b4);})[_0xc4cf('0x19')](function(){return new Promise(function(_0x3b5875,_0x320209){zipdir(_0x14d22a,{'saveTo':_0xb2a6ec},function(_0x2b3af4,_0x119987){if(_0x2b3af4)return _0x320209(_0x2b3af4);return _0x3b5875(_0x119987);});})[_0xc4cf('0x19')](function(){return new Promise(function(_0x245902,_0x4ca209){rimraf(_0x14d22a,function(_0x34057d){if(_0x34057d)_0x4ca209(_0x34057d);return _0x245902();});});})['then'](function(){return _0x577c41[_0xc4cf('0x53')](_0xb2a6ec,_0x898caa,function(_0x51dceb){if(_0x51dceb){logger[_0xc4cf('0x1a')](_0xc4cf('0x82'),_0x51dceb);}else{fs[_0xc4cf('0x83')](_0xb2a6ec);}});});});}else{return _0x577c41[_0xc4cf('0xe')](0xc8);}})[_0xc4cf('0x29')](handleError(_0x577c41,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 8034d4b..35b9b5f 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 _0xcd8b=['remove','getUsers','then','setDataValue','map','unreadMessages','length','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcd8b,0xea));var _0xbcd8=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xcd8b[_0x2c91e9];return _0x13f0ff;};'use strict';var EventEmitter=require(_0xbcd8('0x0'));var OpenchannelInteraction=require(_0xbcd8('0x1'))['db'][_0xbcd8('0x2')];var OpenchannelMessage=require(_0xbcd8('0x1'))['db'][_0xbcd8('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xbcd8('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbcd8('0x5'),'afterDestroy':_0xbcd8('0x6')};function emitEvent(_0x2fbac9){return function(_0x5754d2,_0x15c1b7,_0x3faad2){_0x5754d2[_0xbcd8('0x7')]({'attributes':['id'],'raw':!![]})[_0xbcd8('0x8')](function(_0x4dbb3d){_0x5754d2[_0xbcd8('0x9')]('Users',_0x4dbb3d[_0xbcd8('0xa')](function(_0x297928){return{'id':_0x297928['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x5754d2['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbcd8('0x8')](function(_0x4335b1){_0x5754d2['setDataValue'](_0xbcd8('0xb'),_0x4335b1[_0xbcd8('0xc')]);OpenchannelInteractionEvents[_0xbcd8('0xd')](_0x2fbac9+':'+_0x5754d2['id'],_0x5754d2);OpenchannelInteractionEvents[_0xbcd8('0xd')](_0x2fbac9,_0x5754d2);_0x3faad2(null);})['catch'](_0x3faad2(null));};}for(var e in events){if(events[_0xbcd8('0xe')](e)){var event=events[e];OpenchannelInteraction[_0xbcd8('0xf')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x9930=['hasOwnProperty','hook','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','findAll','length','emit','catch'];(function(_0x557a30,_0x433df5){var _0x2bf5f6=function(_0x5b9171){while(--_0x5b9171){_0x557a30['push'](_0x557a30['shift']());}};_0x2bf5f6(++_0x433df5);}(_0x9930,0x146));var _0x0993=function(_0x2ad441,_0x1a10aa){_0x2ad441=_0x2ad441-0x0;var _0x131a12=_0x9930[_0x2ad441];return _0x131a12;};'use strict';var EventEmitter=require(_0x0993('0x0'));var OpenchannelInteraction=require(_0x0993('0x1'))['db'][_0x0993('0x2')];var OpenchannelMessage=require(_0x0993('0x1'))['db'][_0x0993('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x0993('0x4')](0x0);var events={'afterCreate':_0x0993('0x5'),'afterUpdate':_0x0993('0x6'),'afterDestroy':_0x0993('0x7')};function emitEvent(_0x50517d){return function(_0x492c17,_0x3d65e3,_0x4b14ef){_0x492c17['getUsers']({'attributes':['id'],'raw':!![]})[_0x0993('0x8')](function(_0x2997c6){_0x492c17[_0x0993('0x9')](_0x0993('0xa'),_0x2997c6[_0x0993('0xb')](function(_0x27fdab){return{'id':_0x27fdab['id']};}));return OpenchannelMessage[_0x0993('0xc')]({'where':{'OpenchannelInteractionId':_0x492c17['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0993('0x8')](function(_0x414bcb){_0x492c17[_0x0993('0x9')]('unreadMessages',_0x414bcb[_0x0993('0xd')]);OpenchannelInteractionEvents[_0x0993('0xe')](_0x50517d+':'+_0x492c17['id'],_0x492c17);OpenchannelInteractionEvents[_0x0993('0xe')](_0x50517d,_0x492c17);_0x4b14ef(null);})[_0x0993('0xf')](_0x4b14ef(null));};}for(var e in events){if(events[_0x0993('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x0993('0x11')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 9de9bc2..9c04646 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 _0xacbd=['closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelInteraction.attributes','utf8mb4','utf8mb4_unicode_ci','changed'];(function(_0x30630a,_0x4f6bac){var _0x230c6f=function(_0x11cff7){while(--_0x11cff7){_0x30630a['push'](_0x30630a['shift']());}};_0x230c6f(++_0x4f6bac);}(_0xacbd,0x8a));var _0xdacb=function(_0x9f4df,_0x5ad149){_0x9f4df=_0x9f4df-0x0;var _0x4a79a3=_0xacbd[_0x9f4df];return _0x4a79a3;};'use strict';var _=require(_0xdacb('0x0'));var util=require('util');var logger=require(_0xdacb('0x1'))(_0xdacb('0x2'));var moment=require(_0xdacb('0x3'));var BPromise=require(_0xdacb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdacb('0x5'));var rimraf=require(_0xdacb('0x6'));var config=require(_0xdacb('0x7'));var attributes=require(_0xdacb('0x8'));module['exports']=function(_0x5d736c,_0x3f80e1){return _0x5d736c['define']('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdacb('0x9'),'collate':_0xdacb('0xa'),'hooks':{'beforeUpdate':function(_0x3de344,_0x53ea30,_0x4f8f96){if(_0x3de344[_0xdacb('0xb')](_0xdacb('0xc'))){_0x3de344[_0xdacb('0xd')]=moment()['format'](_0xdacb('0xe'));}_0x4f8f96(null,_0x3de344);}}});}; \ No newline at end of file +var _0x6647=['moment','bluebird','request-promise','../../config/environment','exports','define','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api'];(function(_0x4982e9,_0xf6d6ba){var _0x363a1d=function(_0x598f5e){while(--_0x598f5e){_0x4982e9['push'](_0x4982e9['shift']());}};_0x363a1d(++_0xf6d6ba);}(_0x6647,0xa2));var _0x7664=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6647[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x7664('0x0'));var logger=require(_0x7664('0x1'))(_0x7664('0x2'));var moment=require(_0x7664('0x3'));var BPromise=require(_0x7664('0x4'));var rp=require(_0x7664('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7664('0x6'));var attributes=require('./openchannelInteraction.attributes');module[_0x7664('0x7')]=function(_0x1efe13,_0x14aad8){return _0x1efe13[_0x7664('0x8')](_0x7664('0x9'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7664('0xa'),'collate':_0x7664('0xb'),'hooks':{'beforeUpdate':function(_0x2ca594,_0x1dc73b,_0x4259b1){if(_0x2ca594['changed']('closed')){_0x2ca594[_0x7664('0xc')]=moment()[_0x7664('0xd')](_0x7664('0xe'));}_0x4259b1(null,_0x2ca594);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 1bab8f3..1abe4f5 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 _0xbed9=['code','message','UpdateOpenchannelInteraction','OpenchannelInteraction','options','raw','where','attributes','limit','AddTagsToOpenchannelInteraction','find','addTags','body','ids','omit','AddTags','catch','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelInteraction.socket','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x7043ca,_0x4bf9e4){var _0x40376b=function(_0x54095a){while(--_0x54095a){_0x7043ca['push'](_0x7043ca['shift']());}};_0x40376b(++_0x4bf9e4);}(_0xbed9,0x129));var _0x9bed=function(_0x476157,_0x1d310b){_0x476157=_0x476157-0x0;var _0x171d27=_0xbed9[_0x476157];return _0x171d27;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9bed('0x0'));var fs=require('fs');var Redis=require(_0x9bed('0x1'));var db=require(_0x9bed('0x2'))['db'];var utils=require(_0x9bed('0x3'));var logger=require(_0x9bed('0x4'))(_0x9bed('0x5'));var config=require(_0x9bed('0x6'));var jayson=require(_0x9bed('0x7'));var client=jayson[_0x9bed('0x8')][_0x9bed('0x9')]({'port':0x232a});config[_0x9bed('0xa')]=_[_0x9bed('0xb')](config['redis'],{'host':_0x9bed('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9bed('0xa')]));require(_0x9bed('0xd'))['register'](socket);function respondWithRpcPromise(_0x1b96b6,_0x1ad402,_0x3a1dfd){return new BPromise(function(_0x3ff6fa,_0x4a356){return client[_0x9bed('0xe')](_0x1b96b6,_0x3a1dfd)[_0x9bed('0xf')](function(_0xa6c404){logger[_0x9bed('0x10')](_0x9bed('0x11'),_0x1ad402,_0x9bed('0x12'));logger[_0x9bed('0x13')](_0x9bed('0x14'),_0x1ad402,_0x9bed('0x12'),JSON[_0x9bed('0x15')](_0xa6c404));if(_0xa6c404[_0x9bed('0x16')]){if(_0xa6c404[_0x9bed('0x16')][_0x9bed('0x17')]===0x1f4){logger[_0x9bed('0x16')](_0x9bed('0x11'),_0x1ad402,_0xa6c404[_0x9bed('0x16')]['message']);return _0x4a356(_0xa6c404[_0x9bed('0x16')]['message']);}logger[_0x9bed('0x16')](_0x9bed('0x11'),_0x1ad402,_0xa6c404[_0x9bed('0x16')][_0x9bed('0x18')]);return _0x3ff6fa(_0xa6c404[_0x9bed('0x16')][_0x9bed('0x18')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x1ad402,'request\x20sent');_0x3ff6fa(_0xa6c404['result'][_0x9bed('0x18')]);}})['catch'](function(_0x36c6b1){logger[_0x9bed('0x16')](_0x9bed('0x11'),_0x1ad402,_0x36c6b1);_0x4a356(_0x36c6b1);});});}exports[_0x9bed('0x19')]=function(_0x58dda6){var _0x2c94cd=this;return new Promise(function(_0x2d6744,_0x567ec4){return db[_0x9bed('0x1a')]['update'](_0x58dda6['body'],{'raw':_0x58dda6[_0x9bed('0x1b')]?_0x58dda6[_0x9bed('0x1b')][_0x9bed('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58dda6[_0x9bed('0x1b')]?_0x58dda6[_0x9bed('0x1b')][_0x9bed('0x1d')]||null:null,'attributes':_0x58dda6[_0x9bed('0x1b')]?_0x58dda6['options'][_0x9bed('0x1e')]||null:null,'limit':_0x58dda6['options']?_0x58dda6[_0x9bed('0x1b')][_0x9bed('0x1f')]||null:null})[_0x9bed('0xf')](function(_0x153bd8){logger[_0x9bed('0x10')]('UpdateOpenchannelInteraction',_0x58dda6);logger[_0x9bed('0x13')](_0x9bed('0x19'),_0x58dda6,JSON[_0x9bed('0x15')](_0x153bd8));_0x2d6744(_0x153bd8);})['catch'](function(_0x4c75f6){logger[_0x9bed('0x16')](_0x9bed('0x19'),_0x4c75f6['message'],_0x58dda6);_0x567ec4(_0x2c94cd['error'](0x1f4,_0x4c75f6[_0x9bed('0x18')]));});});};exports[_0x9bed('0x20')]=function(_0x4c8884){return new Promise(function(_0x1f12f2,_0x706d9d){return db[_0x9bed('0x1a')][_0x9bed('0x21')]({'where':_0x4c8884['options']?_0x4c8884[_0x9bed('0x1b')][_0x9bed('0x1d')]||null:null})['then'](function(_0x12c56e){if(_0x12c56e){return _0x12c56e[_0x9bed('0x22')](_0x4c8884[_0x9bed('0x23')][_0x9bed('0x24')],_[_0x9bed('0x25')](_0x4c8884[_0x9bed('0x23')],[_0x9bed('0x24'),'id'])||{});}})['spread'](function(_0xdf6752){logger['info'](_0x9bed('0x26'),_0x4c8884);logger[_0x9bed('0x13')](_0x9bed('0x26'),_0x4c8884,JSON['stringify'](_0xdf6752));_0x1f12f2(_0xdf6752);})[_0x9bed('0x27')](function(_0x5c0e60){logger['error']('AddTags',_0x5c0e60[_0x9bed('0x18')],_0x4c8884);_0x706d9d(_this[_0x9bed('0x16')](0x1f4,_0x5c0e60[_0x9bed('0x18')]));});});}; \ No newline at end of file +var _0x5938=['message','OpenchannelInteraction,\x20%s,\x20%s','result','OpenchannelInteraction','update','options','raw','attributes','limit','then','UpdateOpenchannelInteraction','catch','AddTagsToOpenchannelInteraction','find','where','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','./openchannelInteraction.socket','register','request','info','request\x20sent','debug','stringify','error','code'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5938,0x175));var _0x8593=function(_0x12d204,_0x207f13){_0x12d204=_0x12d204-0x0;var _0x429203=_0x5938[_0x12d204];return _0x429203;};'use strict';var _=require(_0x8593('0x0'));var util=require(_0x8593('0x1'));var moment=require(_0x8593('0x2'));var BPromise=require(_0x8593('0x3'));var rs=require(_0x8593('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8593('0x5'))['db'];var utils=require(_0x8593('0x6'));var logger=require(_0x8593('0x7'))(_0x8593('0x8'));var config=require('../../config/environment');var jayson=require(_0x8593('0x9'));var client=jayson['client'][_0x8593('0xa')]({'port':0x232a});config[_0x8593('0xb')]=_[_0x8593('0xc')](config['redis'],{'host':_0x8593('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8593('0xe'))[_0x8593('0xf')](socket);function respondWithRpcPromise(_0x13fd6e,_0x51dbe5,_0x4c92bd){return new BPromise(function(_0x595f74,_0x3843f7){return client[_0x8593('0x10')](_0x13fd6e,_0x4c92bd)['then'](function(_0x3d34f5){logger[_0x8593('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0x51dbe5,_0x8593('0x12'));logger[_0x8593('0x13')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x51dbe5,_0x8593('0x12'),JSON[_0x8593('0x14')](_0x3d34f5));if(_0x3d34f5['error']){if(_0x3d34f5[_0x8593('0x15')][_0x8593('0x16')]===0x1f4){logger[_0x8593('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x51dbe5,_0x3d34f5[_0x8593('0x15')]['message']);return _0x3843f7(_0x3d34f5['error'][_0x8593('0x17')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x51dbe5,_0x3d34f5[_0x8593('0x15')][_0x8593('0x17')]);return _0x595f74(_0x3d34f5[_0x8593('0x15')][_0x8593('0x17')]);}else{logger['info'](_0x8593('0x18'),_0x51dbe5,_0x8593('0x12'));_0x595f74(_0x3d34f5[_0x8593('0x19')]['message']);}})['catch'](function(_0x243f52){logger[_0x8593('0x15')](_0x8593('0x18'),_0x51dbe5,_0x243f52);_0x3843f7(_0x243f52);});});}exports['UpdateOpenchannelInteraction']=function(_0x110497){var _0x3ace4d=this;return new Promise(function(_0x574ed6,_0x360e26){return db[_0x8593('0x1a')][_0x8593('0x1b')](_0x110497['body'],{'raw':_0x110497['options']?_0x110497[_0x8593('0x1c')][_0x8593('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x110497[_0x8593('0x1c')]?_0x110497[_0x8593('0x1c')]['where']||null:null,'attributes':_0x110497[_0x8593('0x1c')]?_0x110497[_0x8593('0x1c')][_0x8593('0x1e')]||null:null,'limit':_0x110497[_0x8593('0x1c')]?_0x110497[_0x8593('0x1c')][_0x8593('0x1f')]||null:null})[_0x8593('0x20')](function(_0x368280){logger[_0x8593('0x11')](_0x8593('0x21'),_0x110497);logger[_0x8593('0x13')](_0x8593('0x21'),_0x110497,JSON[_0x8593('0x14')](_0x368280));_0x574ed6(_0x368280);})[_0x8593('0x22')](function(_0x9e441c){logger[_0x8593('0x15')](_0x8593('0x21'),_0x9e441c[_0x8593('0x17')],_0x110497);_0x360e26(_0x3ace4d[_0x8593('0x15')](0x1f4,_0x9e441c[_0x8593('0x17')]));});});};exports[_0x8593('0x23')]=function(_0x3e8de5){return new Promise(function(_0x3c7abb,_0x2f98c2){return db[_0x8593('0x1a')][_0x8593('0x24')]({'where':_0x3e8de5[_0x8593('0x1c')]?_0x3e8de5[_0x8593('0x1c')][_0x8593('0x25')]||null:null})[_0x8593('0x20')](function(_0x117d82){if(_0x117d82){return _0x117d82[_0x8593('0x26')](_0x3e8de5[_0x8593('0x27')][_0x8593('0x28')],_[_0x8593('0x29')](_0x3e8de5[_0x8593('0x27')],['ids','id'])||{});}})[_0x8593('0x2a')](function(_0x577823){logger[_0x8593('0x11')](_0x8593('0x2b'),_0x3e8de5);logger[_0x8593('0x13')](_0x8593('0x2b'),_0x3e8de5,JSON[_0x8593('0x14')](_0x577823));_0x3c7abb(_0x577823);})[_0x8593('0x22')](function(_0x2bffdf){logger[_0x8593('0x15')]('AddTags',_0x2bffdf[_0x8593('0x17')],_0x3e8de5);_0x2f98c2(_this[_0x8593('0x15')](0x1f4,_0x2bffdf[_0x8593('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 588f9cd..e64349a 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 _0x0ee1=['register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit','removeListener'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x0ee1,0x1ce));var _0x10ee=function(_0x937379,_0x4688a0){_0x937379=_0x937379-0x0;var _0x465709=_0x0ee1[_0x937379];return _0x465709;};'use strict';var OpenchannelInteractionEvents=require(_0x10ee('0x0'));var events=[_0x10ee('0x1'),_0x10ee('0x2'),_0x10ee('0x3')];function createListener(_0x349dda,_0x21d5ae){return function(_0x9fc829){_0x21d5ae[_0x10ee('0x4')](_0x349dda,_0x9fc829);};}function removeListener(_0x509db4,_0xf84d38){return function(){OpenchannelInteractionEvents[_0x10ee('0x5')](_0x509db4,_0xf84d38);};}exports[_0x10ee('0x6')]=function(_0x52ac1c){for(var _0x1b8bd7=0x0,_0x1b756d=events[_0x10ee('0x7')];_0x1b8bd7<_0x1b756d;_0x1b8bd7++){var _0x11b09e=events[_0x1b8bd7];var _0x3e8beb=createListener(_0x10ee('0x8')+_0x11b09e,_0x52ac1c);OpenchannelInteractionEvents['on'](_0x11b09e,_0x3e8beb);}}; \ No newline at end of file +var _0xaf79=['length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update'];(function(_0x5ac55e,_0x5c3ed6){var _0x4c4129=function(_0x5ed53c){while(--_0x5ed53c){_0x5ac55e['push'](_0x5ac55e['shift']());}};_0x4c4129(++_0x5c3ed6);}(_0xaf79,0xc2));var _0x9af7=function(_0x8d33b5,_0x256e21){_0x8d33b5=_0x8d33b5-0x0;var _0x3e2ed7=_0xaf79[_0x8d33b5];return _0x3e2ed7;};'use strict';var OpenchannelInteractionEvents=require(_0x9af7('0x0'));var events=[_0x9af7('0x1'),_0x9af7('0x2'),_0x9af7('0x3')];function createListener(_0x148317,_0x48a1d1){return function(_0x55ae37){_0x48a1d1['emit'](_0x148317,_0x55ae37);};}function removeListener(_0x331dcc,_0x5e2e41){return function(){OpenchannelInteractionEvents['removeListener'](_0x331dcc,_0x5e2e41);};}exports['register']=function(_0x5bb8ff){for(var _0x45fb52=0x0,_0x167957=events[_0x9af7('0x4')];_0x45fb52<_0x167957;_0x45fb52++){var _0x2082d3=events[_0x45fb52];var _0x18edeb=createListener(_0x9af7('0x5')+_0x2082d3,_0x5bb8ff);OpenchannelInteractionEvents['on'](_0x2082d3,_0x18edeb);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 62dbcc1..ffb2f08 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 _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0xe3b60f,_0x457142){var _0x2ab617=function(_0x31921e){while(--_0x31921e){_0xe3b60f['push'](_0xe3b60f['shift']());}};_0x2ab617(++_0x457142);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file +var _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x2e1906,_0xa281e9){var _0x3ea10e=function(_0x19749){while(--_0x19749){_0x2e1906['push'](_0x2e1906['shift']());}};_0x3ea10e(++_0xa281e9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0xcb91[_0x622035];return _0x326cf2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 82c3f37..4dffd21 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 _0xc04a=['STRING','sequelize','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0x179243,_0x5ecdd6){var _0x2777ad=function(_0x45bb52){while(--_0x45bb52){_0x179243['push'](_0x179243['shift']());}};_0x2777ad(++_0x5ecdd6);}(_0xc04a,0x12e));var _0xac04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc04a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xac04('0x0'));module['exports']={'body':{'type':Sequelize[_0xac04('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xac04('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xac04('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xac04('0x3')]('in','out'),'defaultValue':_0xac04('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xac04('0x5')]},'providerName':{'type':Sequelize[_0xac04('0x6')]},'providerResponse':{'type':Sequelize[_0xac04('0x1')]}}; \ No newline at end of file +var _0x0fd9=['DATE','STRING','exports','TEXT','medium','BOOLEAN','out'];(function(_0x53f29b,_0x22cf73){var _0x18b486=function(_0x4db84d){while(--_0x4db84d){_0x53f29b['push'](_0x53f29b['shift']());}};_0x18b486(++_0x22cf73);}(_0x0fd9,0xa3));var _0x90fd=function(_0x15942a,_0x13b58c){_0x15942a=_0x15942a-0x0;var _0x36a9fb=_0x0fd9[_0x15942a];return _0x36a9fb;};'use strict';var Sequelize=require('sequelize');module[_0x90fd('0x0')]={'body':{'type':Sequelize[_0x90fd('0x1')](_0x90fd('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x90fd('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x90fd('0x4')),'defaultValue':_0x90fd('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x90fd('0x5')]},'providerName':{'type':Sequelize[_0x90fd('0x6')]},'providerResponse':{'type':Sequelize[_0x90fd('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 4b6457b..087a2ca 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 _0xd9d9=['UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','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','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','ContactId','User','reject','rejectmessage','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','http','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','stack','name','send','index','map','OpenchannelMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','update','describe','openchannel-interactions','readAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x233f66,_0x38ead8){var _0x24c124=function(_0x5a6c44){while(--_0x5a6c44){_0x233f66['push'](_0x233f66['shift']());}};_0x24c124(++_0x38ead8);}(_0xd9d9,0x11d));var _0x9d9d=function(_0x2c1f96,_0x3331ab){_0x2c1f96=_0x2c1f96-0x0;var _0x2b25e4=_0xd9d9[_0x2c1f96];return _0x2b25e4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9d9d('0x0'));var zipdir=require(_0x9d9d('0x1'));var jsonpatch=require(_0x9d9d('0x2'));var rp=require(_0x9d9d('0x3'));var moment=require(_0x9d9d('0x4'));var BPromise=require(_0x9d9d('0x5'));var Mustache=require(_0x9d9d('0x6'));var util=require(_0x9d9d('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x9d9d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9d9d('0x9'));var _=require('lodash');var squel=require(_0x9d9d('0xa'));var crypto=require(_0x9d9d('0xb'));var jsforce=require(_0x9d9d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9d9d('0x8'));var querystring=require(_0x9d9d('0xd'));var Papa=require(_0x9d9d('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9d9d('0xf'));var as=require(_0x9d9d('0x10'));var hardwareService=require(_0x9d9d('0x11'));var logger=require('../../config/logger')(_0x9d9d('0x12'));var utils=require('../../config/utils');var config=require(_0x9d9d('0x13'));var licenseUtil=require(_0x9d9d('0x14'));var db=require('../../mysqldb')['db'];config[_0x9d9d('0x15')]=_['defaults'](config['redis'],{'host':_0x9d9d('0x16'),'port':0x18eb});var socket=require(_0x9d9d('0x17'))(new Redis(config['redis']));require(_0x9d9d('0x18'))[_0x9d9d('0x19')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x9d9d('0x1a')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x500adc,_0x367ab0,_0x48e3d2,_0x3297fd){return new BPromise(function(_0x2a4e1e,_0x3c2dab){var _0x27bbb3=_0x3297fd||client;return _0x27bbb3['request'](_0x500adc,_0x48e3d2)[_0x9d9d('0x1b')](function(_0x7825d4){logger[_0x9d9d('0x1c')](_0x9d9d('0x1d'),_0x367ab0,_0x9d9d('0x1e'));logger['debug'](_0x9d9d('0x1f'),_0x367ab0,_0x9d9d('0x1e'),JSON[_0x9d9d('0x20')](_0x7825d4));if(_0x7825d4[_0x9d9d('0x21')]){if(_0x7825d4[_0x9d9d('0x21')][_0x9d9d('0x22')]===0x1f4){logger[_0x9d9d('0x21')](_0x9d9d('0x1d'),_0x367ab0,_0x7825d4[_0x9d9d('0x21')][_0x9d9d('0x23')]);return _0x3c2dab(_0x7825d4[_0x9d9d('0x21')][_0x9d9d('0x23')]);}logger[_0x9d9d('0x21')](_0x9d9d('0x1d'),_0x367ab0,_0x7825d4[_0x9d9d('0x21')][_0x9d9d('0x23')]);return _0x2a4e1e(_0x7825d4[_0x9d9d('0x21')][_0x9d9d('0x23')]);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x367ab0,_0x9d9d('0x1e'));_0x2a4e1e(_0x7825d4['result'][_0x9d9d('0x23')]);}})['catch'](function(_0x1c3348){logger[_0x9d9d('0x21')](_0x9d9d('0x1d'),_0x367ab0,_0x1c3348);_0x3c2dab(_0x1c3348);});});}function respondWithStatusCode(_0x15af17,_0x101a48){_0x101a48=_0x101a48||0xcc;return function(_0x2649f3){if(_0x2649f3){return _0x15af17[_0x9d9d('0x24')](_0x101a48);}return _0x15af17[_0x9d9d('0x25')](_0x101a48)[_0x9d9d('0x26')]();};}function respondWithResult(_0x25798b,_0x4d0f68){_0x4d0f68=_0x4d0f68||0xc8;return function(_0x4ae8eb){if(_0x4ae8eb){return _0x25798b[_0x9d9d('0x25')](_0x4d0f68)[_0x9d9d('0x27')](_0x4ae8eb);}};}function respondWithFilteredResult(_0x181e0a,_0x4d168d){return function(_0x37e7cb){if(_0x37e7cb){var _0x54920c=typeof _0x4d168d[_0x9d9d('0x28')]===_0x9d9d('0x29')&&typeof _0x4d168d[_0x9d9d('0x2a')]===_0x9d9d('0x29');var _0x1c8d20=_0x37e7cb[_0x9d9d('0x2b')];var _0x543288=_0x54920c?0x0:_0x4d168d[_0x9d9d('0x28')];var _0x206efb=_0x54920c?_0x37e7cb[_0x9d9d('0x2b')]:_0x4d168d[_0x9d9d('0x28')]+_0x4d168d[_0x9d9d('0x2a')];var _0x357beb;if(_0x206efb>=_0x1c8d20){_0x206efb=_0x1c8d20;_0x357beb=0xc8;}else{_0x357beb=0xce;}_0x181e0a[_0x9d9d('0x25')](_0x357beb);return _0x181e0a[_0x9d9d('0x2c')](_0x9d9d('0x2d'),_0x543288+'-'+_0x206efb+'/'+_0x1c8d20)['json'](_0x37e7cb);}return null;};}function patchUpdates(_0x128876){return function(_0x5ad38f){try{jsonpatch[_0x9d9d('0x2e')](_0x5ad38f,_0x128876,!![]);}catch(_0x233ab2){return BPromise['reject'](_0x233ab2);}return _0x5ad38f[_0x9d9d('0x2f')]();};}function saveUpdates(_0x1031ff,_0x21d855){return function(_0x2b308f){if(_0x2b308f){return _0x2b308f['update'](_0x1031ff)[_0x9d9d('0x1b')](function(_0x497399){return _0x497399;});}return null;};}function removeEntity(_0x1ed1ff,_0x342e85){return function(_0x4b03cb){if(_0x4b03cb){return _0x4b03cb[_0x9d9d('0x30')]()[_0x9d9d('0x1b')](function(){_0x1ed1ff[_0x9d9d('0x25')](0xcc)[_0x9d9d('0x26')]();});}};}function handleEntityNotFound(_0x1c6288,_0x44f26a){return function(_0x205610){if(!_0x205610){_0x1c6288[_0x9d9d('0x24')](0x194);}return _0x205610;};}function handleError(_0x175e38,_0x45362f){_0x45362f=_0x45362f||0x1f4;return function(_0x11d2eb){logger['error'](_0x11d2eb[_0x9d9d('0x31')]);if(_0x11d2eb[_0x9d9d('0x32')]){delete _0x11d2eb[_0x9d9d('0x32')];}_0x175e38[_0x9d9d('0x25')](_0x45362f)[_0x9d9d('0x33')](_0x11d2eb);};}exports[_0x9d9d('0x34')]=function(_0x58be7e,_0x257aea){var _0x2fc589={},_0x2a2cab={},_0x177310={'count':0x0,'rows':[]};var _0x1331e=_[_0x9d9d('0x35')](db[_0x9d9d('0x36')]['rawAttributes'],function(_0x4b8cfa){return{'name':_0x4b8cfa[_0x9d9d('0x37')],'type':_0x4b8cfa[_0x9d9d('0x38')][_0x9d9d('0x39')]};});_0x2a2cab[_0x9d9d('0x3a')]=_['map'](_0x1331e,_0x9d9d('0x32'));_0x2a2cab[_0x9d9d('0x3b')]=_[_0x9d9d('0x3c')](_0x58be7e['query']);_0x2a2cab[_0x9d9d('0x3d')]=_[_0x9d9d('0x3e')](_0x2a2cab[_0x9d9d('0x3a')],_0x2a2cab['query']);_0x2fc589[_0x9d9d('0x3f')]=_[_0x9d9d('0x3e')](_0x2a2cab[_0x9d9d('0x3a')],qs[_0x9d9d('0x40')](_0x58be7e[_0x9d9d('0x3b')][_0x9d9d('0x40')]));_0x2fc589['attributes']=_0x2fc589[_0x9d9d('0x3f')]['length']?_0x2fc589[_0x9d9d('0x3f')]:_0x2a2cab['model'];if(!_0x58be7e[_0x9d9d('0x3b')][_0x9d9d('0x41')](_0x9d9d('0x42'))){_0x2fc589[_0x9d9d('0x2a')]=qs[_0x9d9d('0x2a')](_0x58be7e['query']['limit']);_0x2fc589[_0x9d9d('0x28')]=qs[_0x9d9d('0x28')](_0x58be7e[_0x9d9d('0x3b')][_0x9d9d('0x28')]);}_0x2fc589['order']=qs['sort'](_0x58be7e['query']['sort']);_0x2fc589[_0x9d9d('0x43')]=qs['filters'](_[_0x9d9d('0x44')](_0x58be7e[_0x9d9d('0x3b')],_0x2a2cab['filters']),_0x1331e);if(_0x58be7e[_0x9d9d('0x3b')][_0x9d9d('0x45')]){_0x2fc589[_0x9d9d('0x43')]=_['merge'](_0x2fc589[_0x9d9d('0x43')],{'$or':_[_0x9d9d('0x35')](_0x1331e,function(_0x1dbb7e){if(_0x1dbb7e[_0x9d9d('0x38')]!==_0x9d9d('0x46')){var _0x29a405={};_0x29a405[_0x1dbb7e[_0x9d9d('0x32')]]={'$like':'%'+_0x58be7e[_0x9d9d('0x3b')][_0x9d9d('0x45')]+'%'};return _0x29a405;}})});}_0x2fc589=_[_0x9d9d('0x47')]({},_0x2fc589,_0x58be7e[_0x9d9d('0x48')]);var _0x58f032={'where':_0x2fc589['where']};return db['OpenchannelMessage'][_0x9d9d('0x2b')](_0x58f032)[_0x9d9d('0x1b')](function(_0x5f144c){_0x177310[_0x9d9d('0x2b')]=_0x5f144c;if(_0x58be7e[_0x9d9d('0x3b')]['includeAll']){_0x2fc589[_0x9d9d('0x49')]=[{'all':!![]}];}return db[_0x9d9d('0x36')][_0x9d9d('0x4a')](_0x2fc589);})[_0x9d9d('0x1b')](function(_0x435a37){_0x177310[_0x9d9d('0x4b')]=_0x435a37;return _0x177310;})[_0x9d9d('0x1b')](respondWithFilteredResult(_0x257aea,_0x2fc589))[_0x9d9d('0x4c')](handleError(_0x257aea,null));};exports[_0x9d9d('0x4d')]=function(_0x20ec1a,_0x2845da){var _0x407755={'raw':!![],'where':{'id':_0x20ec1a[_0x9d9d('0x4e')]['id']}},_0x190a4e={};_0x190a4e[_0x9d9d('0x3a')]=_[_0x9d9d('0x3c')](db[_0x9d9d('0x36')][_0x9d9d('0x4f')]);_0x190a4e['query']=_['keys'](_0x20ec1a[_0x9d9d('0x3b')]);_0x190a4e[_0x9d9d('0x3d')]=_[_0x9d9d('0x3e')](_0x190a4e[_0x9d9d('0x3a')],_0x190a4e[_0x9d9d('0x3b')]);_0x407755[_0x9d9d('0x3f')]=_[_0x9d9d('0x3e')](_0x190a4e['model'],qs['fields'](_0x20ec1a[_0x9d9d('0x3b')]['fields']));_0x407755['attributes']=_0x407755[_0x9d9d('0x3f')]['length']?_0x407755[_0x9d9d('0x3f')]:_0x190a4e[_0x9d9d('0x3a')];if(_0x20ec1a[_0x9d9d('0x3b')][_0x9d9d('0x50')]){_0x407755['include']=[{'all':!![]}];}_0x407755=_[_0x9d9d('0x47')]({},_0x407755,_0x20ec1a[_0x9d9d('0x48')]);return db[_0x9d9d('0x36')][_0x9d9d('0x51')](_0x407755)[_0x9d9d('0x1b')](handleEntityNotFound(_0x2845da,null))['then'](respondWithResult(_0x2845da,null))[_0x9d9d('0x4c')](handleError(_0x2845da,null));};exports[_0x9d9d('0x52')]=function(_0x10c551,_0x2f8d1f){return db[_0x9d9d('0x36')][_0x9d9d('0x52')](_0x10c551[_0x9d9d('0x53')],{})[_0x9d9d('0x1b')](respondWithResult(_0x2f8d1f,0xc9))['catch'](handleError(_0x2f8d1f,null));};exports[_0x9d9d('0x54')]=function(_0x284b6a,_0xc57434){if(_0x284b6a[_0x9d9d('0x53')]['id']){delete _0x284b6a[_0x9d9d('0x53')]['id'];}return db[_0x9d9d('0x36')][_0x9d9d('0x51')]({'where':{'id':_0x284b6a[_0x9d9d('0x4e')]['id']}})['then'](handleEntityNotFound(_0xc57434,null))[_0x9d9d('0x1b')](saveUpdates(_0x284b6a['body'],null))['then'](respondWithResult(_0xc57434,null))[_0x9d9d('0x4c')](handleError(_0xc57434,null));};exports['destroy']=function(_0x464040,_0xcf98cb){return db[_0x9d9d('0x36')][_0x9d9d('0x51')]({'where':{'id':_0x464040['params']['id']}})[_0x9d9d('0x1b')](handleEntityNotFound(_0xcf98cb,null))[_0x9d9d('0x1b')](removeEntity(_0xcf98cb,null))[_0x9d9d('0x4c')](handleError(_0xcf98cb,null));};exports[_0x9d9d('0x55')]=function(_0x5cec2c,_0xd44f18){return db[_0x9d9d('0x36')][_0x9d9d('0x55')]()[_0x9d9d('0x1b')](respondWithResult(_0xd44f18,null))['catch'](handleError(_0xd44f18,null));};var interaction_log=require('../../config/logger')(_0x9d9d('0x56'));exports['accept']=function(_0x1fdb9d,_0x39f824,_0x1e88aa){var _0x582ba1={'agent':{},'channel':'openchannel'};if(_0x1fdb9d['body']['id']){delete _0x1fdb9d[_0x9d9d('0x53')]['id'];}_0x1fdb9d['body']['read']=!![];_0x1fdb9d[_0x9d9d('0x53')][_0x9d9d('0x57')]=moment()[_0x9d9d('0x58')](_0x9d9d('0x59'));_0x1fdb9d[_0x9d9d('0x53')][_0x9d9d('0x5a')]=_0x1fdb9d['body']['UserId']||_0x1fdb9d[_0x9d9d('0x5b')]['id'];_0x582ba1[_0x9d9d('0x5c')]['id']=_0x1fdb9d['body'][_0x9d9d('0x5a')];return db['OpenchannelMessage'][_0x9d9d('0x51')]({'where':{'id':_0x1fdb9d[_0x9d9d('0x4e')]['id'],'UserId':null}})[_0x9d9d('0x1b')](handleEntityNotFound(_0x39f824,null))[_0x9d9d('0x1b')](saveUpdates(_0x1fdb9d[_0x9d9d('0x53')],null))[_0x9d9d('0x1b')](function(_0x307d6a){if(_0x307d6a){_0x582ba1[_0x9d9d('0x23')]=_0x307d6a[_0x9d9d('0x5d')]({'plain':!![]});return db[_0x9d9d('0x5e')][_0x9d9d('0x51')]({'where':{'id':_0x307d6a[_0x9d9d('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x39f824,null))['then'](function(_0x8f63dd){if(_0x8f63dd){return _0x8f63dd['update']({'UserId':_0x1fdb9d['body']['UserId'],'read1stAt':_['isNil'](_0x8f63dd[_0x9d9d('0x60')])?moment()[_0x9d9d('0x58')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x9d9d('0x1b')](function(_0x14eb8c){if(_0x14eb8c){_0x582ba1[_0x9d9d('0x61')]=_0x14eb8c[_0x9d9d('0x5d')]({'plain':!![]});interaction_log['info'](_0x9d9d('0x62'),_0x1fdb9d[_0x9d9d('0x5b')]['id'],_0x1fdb9d[_0x9d9d('0x5b')][_0x9d9d('0x32')],_0x1fdb9d[_0x9d9d('0x5b')][_0x9d9d('0x63')],_0x582ba1[_0x9d9d('0x61')]['id'],_0x1fdb9d[_0x9d9d('0x53')]?JSON[_0x9d9d('0x20')](_0x1fdb9d[_0x9d9d('0x53')]):_0x9d9d('0x64'));return respondWithRpcPromise(_0x9d9d('0x65'),_0x9d9d('0x66'),_0x582ba1);}return null;})[_0x9d9d('0x1b')](function(_0x208278){var _0x12de57=_0x9d9d('0x67')+_0x208278['message']['ContactId'];return db[_0x9d9d('0x68')][_0x9d9d('0x3b')](_0x12de57,{'type':db[_0x9d9d('0x69')][_0x9d9d('0x6a')][_0x9d9d('0x6b')],'raw':!![]})[_0x9d9d('0x1b')](function(_0x4c3bc6){return _0x4c3bc6;});})['then'](function(_0x26ce81){if(_0x26ce81){_0x582ba1[_0x9d9d('0x23')][_0x9d9d('0x6c')]=_0x26ce81[0x0];if(!_0x1fdb9d[_0x9d9d('0x53')][_0x9d9d('0x5a')])return;return db['User'][_0x9d9d('0x51')]({'where':{'id':_0x1fdb9d[_0x9d9d('0x53')][_0x9d9d('0x5a')],'role':_0x9d9d('0x5c')},'attributes':['id',_0x9d9d('0x32'),_0x9d9d('0x6d'),_0x9d9d('0x6e'),'internal'],'raw':!![]});}return null;})[_0x9d9d('0x1b')](function(_0xdb8d24){if(!_0xdb8d24)return null;_0x582ba1[_0x9d9d('0x23')][_0x9d9d('0x5c')]=_0xdb8d24;return _0x582ba1;})['then'](function(_0x14abe8){if(_0x14abe8){if(_0x1fdb9d[_0x9d9d('0x53')][_0x9d9d('0x6f')]){_0x582ba1[_0x9d9d('0x23')][_0x9d9d('0x70')]=util['format'](_0x9d9d('0x71'),_0x1fdb9d['user']['name']);_0x582ba1[_0x9d9d('0x23')]['channel']=_0x582ba1[_0x9d9d('0x72')];_0x582ba1['message'][_0x9d9d('0x73')]=_0x582ba1[_0x9d9d('0x72')];_0x582ba1['message'][_0x9d9d('0x74')]='accept';return respondWithRpcPromise(_0x9d9d('0x75'),_0x9d9d('0x75'),{'event':'acceptmessage','message':_0x582ba1[_0x9d9d('0x23')]},client9002)[_0x9d9d('0x1b')](function(){return _0x582ba1;});}return _0x582ba1;}return null;})[_0x9d9d('0x1b')](respondWithResult(_0x39f824,null))[_0x9d9d('0x4c')](handleError(_0x39f824,null));};var interaction_log=require('../../config/logger')(_0x9d9d('0x56'));exports['reject']=function(_0x3208bc,_0x45a36a,_0x44a979){var _0x2b366f={'agent':{},'channel':_0x9d9d('0x76')};if(_0x3208bc[_0x9d9d('0x53')]['id']){delete _0x3208bc[_0x9d9d('0x53')]['id'];}_0x3208bc['body']['UserId']=_0x3208bc[_0x9d9d('0x53')][_0x9d9d('0x5a')]||_0x3208bc[_0x9d9d('0x5b')]['id'];_0x2b366f[_0x9d9d('0x5c')]['id']=_0x3208bc[_0x9d9d('0x53')]['UserId'];return db[_0x9d9d('0x36')][_0x9d9d('0x51')]({'where':{'id':_0x3208bc['params']['id'],'UserId':null}})[_0x9d9d('0x1b')](handleEntityNotFound(_0x45a36a,null))['then'](function(_0x3eb513){if(_0x3eb513){_0x2b366f[_0x9d9d('0x23')]=_0x3eb513[_0x9d9d('0x5d')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x3eb513['OpenchannelInteractionId']}});}return null;})[_0x9d9d('0x1b')](handleEntityNotFound(_0x45a36a,null))[_0x9d9d('0x1b')](function(_0x503804){if(_0x503804){_0x2b366f[_0x9d9d('0x61')]=_0x503804[_0x9d9d('0x5d')]({'plain':!![]});interaction_log[_0x9d9d('0x1c')](_0x9d9d('0x77'),_0x3208bc[_0x9d9d('0x5b')]['id'],_0x3208bc[_0x9d9d('0x5b')]['name'],_0x3208bc[_0x9d9d('0x5b')][_0x9d9d('0x63')],_0x2b366f[_0x9d9d('0x61')]['id'],_0x3208bc[_0x9d9d('0x53')]?JSON[_0x9d9d('0x20')](_0x3208bc['body']):_0x9d9d('0x64'));return respondWithRpcPromise(_0x9d9d('0x78'),'rejectMessage',_0x2b366f);}return null;})[_0x9d9d('0x1b')](function(_0x26ccd6){var _0x197e82=_0x9d9d('0x67')+_0x26ccd6[_0x9d9d('0x23')][_0x9d9d('0x79')];return db[_0x9d9d('0x68')][_0x9d9d('0x3b')](_0x197e82,{'type':db[_0x9d9d('0x69')][_0x9d9d('0x6a')][_0x9d9d('0x6b')],'raw':!![]})['then'](function(_0x3f8576){return _0x3f8576;});})[_0x9d9d('0x1b')](function(_0x410c66){if(_0x410c66){_0x2b366f[_0x9d9d('0x23')][_0x9d9d('0x6c')]=_0x410c66[0x0];if(!_0x3208bc[_0x9d9d('0x53')]['UserId'])return;return db[_0x9d9d('0x7a')][_0x9d9d('0x51')]({'where':{'id':_0x3208bc[_0x9d9d('0x53')]['UserId'],'role':'agent'},'attributes':['id',_0x9d9d('0x32'),_0x9d9d('0x6d'),_0x9d9d('0x6e'),'internal'],'raw':!![]});}return null;})[_0x9d9d('0x1b')](function(_0x489915){if(!_0x489915)return null;_0x2b366f[_0x9d9d('0x23')]['agent']=_0x489915;return _0x2b366f;})[_0x9d9d('0x1b')](function(_0x38df11){if(_0x38df11){_0x38df11[_0x9d9d('0x23')][_0x9d9d('0x70')]=util[_0x9d9d('0x58')](_0x9d9d('0x71'),_0x3208bc['user']['name']);_0x38df11[_0x9d9d('0x23')][_0x9d9d('0x72')]=_0x2b366f['channel'];_0x38df11[_0x9d9d('0x23')][_0x9d9d('0x73')]=_0x2b366f[_0x9d9d('0x72')];_0x38df11['message'][_0x9d9d('0x74')]=_0x9d9d('0x7b');respondWithRpcPromise(_0x9d9d('0x75'),_0x9d9d('0x75'),{'event':_0x9d9d('0x7c'),'message':_0x38df11[_0x9d9d('0x23')]},client9002);return _0x2b366f;}return null;})[_0x9d9d('0x1b')](respondWithResult(_0x45a36a,null))[_0x9d9d('0x4c')](handleError(_0x45a36a,null));}; \ No newline at end of file +var _0x7a72=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','include','rows','catch','show','includeAll','options','find','create','update','body','params','openchannel-interactions','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','OpenchannelInteraction','isNil','read1stAt','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','interaction','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','fullname','email','internal','agent','manual','interface','channel','EventManager','acceptmessage','OpenchannelInteractionId','null','RejectMessage','User','motionChannel','event','rejectmessage','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','socket.io-emitter','register','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','destroy','name','send','index','OpenchannelMessage','rawAttributes','fieldName','type','model','map'];(function(_0x1ee9a1,_0x5f1434){var _0x21270f=function(_0x303251){while(--_0x303251){_0x1ee9a1['push'](_0x1ee9a1['shift']());}};_0x21270f(++_0x5f1434);}(_0x7a72,0xbe));var _0x27a7=function(_0x25291c,_0x161dd6){_0x25291c=_0x25291c-0x0;var _0x3b6190=_0x7a72[_0x25291c];return _0x3b6190;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27a7('0x0'));var zipdir=require(_0x27a7('0x1'));var jsonpatch=require(_0x27a7('0x2'));var rp=require(_0x27a7('0x3'));var moment=require(_0x27a7('0x4'));var BPromise=require(_0x27a7('0x5'));var Mustache=require(_0x27a7('0x6'));var util=require(_0x27a7('0x7'));var path=require('path');var sox=require(_0x27a7('0x8'));var csv=require(_0x27a7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x27a7('0xa'));var _=require(_0x27a7('0xb'));var squel=require(_0x27a7('0xc'));var crypto=require(_0x27a7('0xd'));var jsforce=require(_0x27a7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x27a7('0x9'));var querystring=require(_0x27a7('0xf'));var Papa=require('papaparse');var Redis=require(_0x27a7('0x10'));var authService=require(_0x27a7('0x11'));var qs=require(_0x27a7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x27a7('0x13'));var logger=require(_0x27a7('0x14'))(_0x27a7('0x15'));var utils=require(_0x27a7('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x27a7('0x17'))['db'];config['redis']=_[_0x27a7('0x18')](config[_0x27a7('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x27a7('0x1a'))(new Redis(config[_0x27a7('0x19')]));require('./openchannelMessage.socket')[_0x27a7('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x27a7('0x1c')][_0x27a7('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x27a7('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0xe383e5,_0x2c34c4,_0x239442,_0x3cd96f){return new BPromise(function(_0x32d892,_0x25f1ac){var _0x392e89=_0x3cd96f||client;return _0x392e89[_0x27a7('0x1e')](_0xe383e5,_0x239442)[_0x27a7('0x1f')](function(_0x2098b2){logger[_0x27a7('0x20')](_0x27a7('0x21'),_0x2c34c4,_0x27a7('0x22'));logger[_0x27a7('0x23')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x2c34c4,_0x27a7('0x22'),JSON['stringify'](_0x2098b2));if(_0x2098b2['error']){if(_0x2098b2[_0x27a7('0x24')][_0x27a7('0x25')]===0x1f4){logger[_0x27a7('0x24')](_0x27a7('0x21'),_0x2c34c4,_0x2098b2['error'][_0x27a7('0x26')]);return _0x25f1ac(_0x2098b2['error'][_0x27a7('0x26')]);}logger[_0x27a7('0x24')](_0x27a7('0x21'),_0x2c34c4,_0x2098b2[_0x27a7('0x24')][_0x27a7('0x26')]);return _0x32d892(_0x2098b2['error'][_0x27a7('0x26')]);}else{logger[_0x27a7('0x20')](_0x27a7('0x21'),_0x2c34c4,_0x27a7('0x22'));_0x32d892(_0x2098b2[_0x27a7('0x27')][_0x27a7('0x26')]);}})['catch'](function(_0x45a3bf){logger[_0x27a7('0x24')](_0x27a7('0x21'),_0x2c34c4,_0x45a3bf);_0x25f1ac(_0x45a3bf);});});}function respondWithStatusCode(_0x3cde03,_0x49b0fc){_0x49b0fc=_0x49b0fc||0xcc;return function(_0x4c1ea2){if(_0x4c1ea2){return _0x3cde03[_0x27a7('0x28')](_0x49b0fc);}return _0x3cde03[_0x27a7('0x29')](_0x49b0fc)[_0x27a7('0x2a')]();};}function respondWithResult(_0x55dda5,_0xe26e8f){_0xe26e8f=_0xe26e8f||0xc8;return function(_0x5b732f){if(_0x5b732f){return _0x55dda5[_0x27a7('0x29')](_0xe26e8f)['json'](_0x5b732f);}};}function respondWithFilteredResult(_0x26009a,_0x597f1f){return function(_0x3f166c){if(_0x3f166c){var _0x55d8e2=typeof _0x597f1f[_0x27a7('0x2b')]===_0x27a7('0x2c')&&typeof _0x597f1f[_0x27a7('0x2d')]===_0x27a7('0x2c');var _0x12bd47=_0x3f166c[_0x27a7('0x2e')];var _0x18e19c=_0x55d8e2?0x0:_0x597f1f['offset'];var _0x40b5e7=_0x55d8e2?_0x3f166c[_0x27a7('0x2e')]:_0x597f1f[_0x27a7('0x2b')]+_0x597f1f[_0x27a7('0x2d')];var _0x27dba1;if(_0x40b5e7>=_0x12bd47){_0x40b5e7=_0x12bd47;_0x27dba1=0xc8;}else{_0x27dba1=0xce;}_0x26009a[_0x27a7('0x29')](_0x27dba1);return _0x26009a[_0x27a7('0x2f')](_0x27a7('0x30'),_0x18e19c+'-'+_0x40b5e7+'/'+_0x12bd47)[_0x27a7('0x31')](_0x3f166c);}return null;};}function patchUpdates(_0x449e86){return function(_0x34f1ce){try{jsonpatch[_0x27a7('0x32')](_0x34f1ce,_0x449e86,!![]);}catch(_0x24cf4f){return BPromise[_0x27a7('0x33')](_0x24cf4f);}return _0x34f1ce['save']();};}function saveUpdates(_0x2c10dd,_0x4f6e08){return function(_0x16fd06){if(_0x16fd06){return _0x16fd06['update'](_0x2c10dd)[_0x27a7('0x1f')](function(_0xb69632){return _0xb69632;});}return null;};}function removeEntity(_0x1b2c36,_0x1dc256){return function(_0x206699){if(_0x206699){return _0x206699[_0x27a7('0x34')]()[_0x27a7('0x1f')](function(){_0x1b2c36['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d8661,_0x5e218c){return function(_0x303255){if(!_0x303255){_0x3d8661[_0x27a7('0x28')](0x194);}return _0x303255;};}function handleError(_0x3bc72b,_0x1a0850){_0x1a0850=_0x1a0850||0x1f4;return function(_0x49b67c){logger[_0x27a7('0x24')](_0x49b67c['stack']);if(_0x49b67c['name']){delete _0x49b67c[_0x27a7('0x35')];}_0x3bc72b[_0x27a7('0x29')](_0x1a0850)[_0x27a7('0x36')](_0x49b67c);};}exports[_0x27a7('0x37')]=function(_0x563b4c,_0x2cd93a){var _0x1650c2={},_0x3a7f49={},_0x11f9fc={'count':0x0,'rows':[]};var _0x1ae5db=_['map'](db[_0x27a7('0x38')][_0x27a7('0x39')],function(_0x44acc3){return{'name':_0x44acc3[_0x27a7('0x3a')],'type':_0x44acc3[_0x27a7('0x3b')]['key']};});_0x3a7f49[_0x27a7('0x3c')]=_[_0x27a7('0x3d')](_0x1ae5db,'name');_0x3a7f49[_0x27a7('0x3e')]=_[_0x27a7('0x3f')](_0x563b4c[_0x27a7('0x3e')]);_0x3a7f49[_0x27a7('0x40')]=_[_0x27a7('0x41')](_0x3a7f49[_0x27a7('0x3c')],_0x3a7f49[_0x27a7('0x3e')]);_0x1650c2[_0x27a7('0x42')]=_[_0x27a7('0x41')](_0x3a7f49[_0x27a7('0x3c')],qs[_0x27a7('0x43')](_0x563b4c[_0x27a7('0x3e')]['fields']));_0x1650c2['attributes']=_0x1650c2[_0x27a7('0x42')][_0x27a7('0x44')]?_0x1650c2[_0x27a7('0x42')]:_0x3a7f49['model'];if(!_0x563b4c[_0x27a7('0x3e')][_0x27a7('0x45')](_0x27a7('0x46'))){_0x1650c2[_0x27a7('0x2d')]=qs[_0x27a7('0x2d')](_0x563b4c[_0x27a7('0x3e')][_0x27a7('0x2d')]);_0x1650c2[_0x27a7('0x2b')]=qs[_0x27a7('0x2b')](_0x563b4c[_0x27a7('0x3e')][_0x27a7('0x2b')]);}_0x1650c2[_0x27a7('0x47')]=qs[_0x27a7('0x48')](_0x563b4c[_0x27a7('0x3e')][_0x27a7('0x48')]);_0x1650c2['where']=qs['filters'](_[_0x27a7('0x49')](_0x563b4c['query'],_0x3a7f49[_0x27a7('0x40')]),_0x1ae5db);if(_0x563b4c[_0x27a7('0x3e')][_0x27a7('0x4a')]){_0x1650c2['where']=_[_0x27a7('0x4b')](_0x1650c2[_0x27a7('0x4c')],{'$or':_[_0x27a7('0x3d')](_0x1ae5db,function(_0x6e6283){if(_0x6e6283[_0x27a7('0x3b')]!=='VIRTUAL'){var _0x426f98={};_0x426f98[_0x6e6283[_0x27a7('0x35')]]={'$like':'%'+_0x563b4c[_0x27a7('0x3e')][_0x27a7('0x4a')]+'%'};return _0x426f98;}})});}_0x1650c2=_[_0x27a7('0x4b')]({},_0x1650c2,_0x563b4c['options']);var _0x151b95={'where':_0x1650c2[_0x27a7('0x4c')]};return db[_0x27a7('0x38')][_0x27a7('0x2e')](_0x151b95)['then'](function(_0x4009b2){_0x11f9fc[_0x27a7('0x2e')]=_0x4009b2;if(_0x563b4c[_0x27a7('0x3e')]['includeAll']){_0x1650c2[_0x27a7('0x4d')]=[{'all':!![]}];}return db[_0x27a7('0x38')]['findAll'](_0x1650c2);})['then'](function(_0x44b695){_0x11f9fc[_0x27a7('0x4e')]=_0x44b695;return _0x11f9fc;})[_0x27a7('0x1f')](respondWithFilteredResult(_0x2cd93a,_0x1650c2))[_0x27a7('0x4f')](handleError(_0x2cd93a,null));};exports[_0x27a7('0x50')]=function(_0x45df95,_0x4e3d1c){var _0x25684f={'raw':!![],'where':{'id':_0x45df95['params']['id']}},_0x43c0b5={};_0x43c0b5[_0x27a7('0x3c')]=_[_0x27a7('0x3f')](db[_0x27a7('0x38')][_0x27a7('0x39')]);_0x43c0b5['query']=_[_0x27a7('0x3f')](_0x45df95['query']);_0x43c0b5[_0x27a7('0x40')]=_[_0x27a7('0x41')](_0x43c0b5['model'],_0x43c0b5[_0x27a7('0x3e')]);_0x25684f['attributes']=_[_0x27a7('0x41')](_0x43c0b5[_0x27a7('0x3c')],qs['fields'](_0x45df95[_0x27a7('0x3e')][_0x27a7('0x43')]));_0x25684f[_0x27a7('0x42')]=_0x25684f[_0x27a7('0x42')][_0x27a7('0x44')]?_0x25684f[_0x27a7('0x42')]:_0x43c0b5[_0x27a7('0x3c')];if(_0x45df95[_0x27a7('0x3e')][_0x27a7('0x51')]){_0x25684f['include']=[{'all':!![]}];}_0x25684f=_[_0x27a7('0x4b')]({},_0x25684f,_0x45df95[_0x27a7('0x52')]);return db[_0x27a7('0x38')][_0x27a7('0x53')](_0x25684f)['then'](handleEntityNotFound(_0x4e3d1c,null))[_0x27a7('0x1f')](respondWithResult(_0x4e3d1c,null))['catch'](handleError(_0x4e3d1c,null));};exports[_0x27a7('0x54')]=function(_0x154351,_0x245dd4){return db['OpenchannelMessage'][_0x27a7('0x54')](_0x154351['body'],{})[_0x27a7('0x1f')](respondWithResult(_0x245dd4,0xc9))[_0x27a7('0x4f')](handleError(_0x245dd4,null));};exports[_0x27a7('0x55')]=function(_0x504688,_0x1652d5){if(_0x504688['body']['id']){delete _0x504688[_0x27a7('0x56')]['id'];}return db[_0x27a7('0x38')][_0x27a7('0x53')]({'where':{'id':_0x504688[_0x27a7('0x57')]['id']}})[_0x27a7('0x1f')](handleEntityNotFound(_0x1652d5,null))[_0x27a7('0x1f')](saveUpdates(_0x504688[_0x27a7('0x56')],null))[_0x27a7('0x1f')](respondWithResult(_0x1652d5,null))[_0x27a7('0x4f')](handleError(_0x1652d5,null));};exports[_0x27a7('0x34')]=function(_0x528218,_0x5ab275){return db['OpenchannelMessage'][_0x27a7('0x53')]({'where':{'id':_0x528218[_0x27a7('0x57')]['id']}})[_0x27a7('0x1f')](handleEntityNotFound(_0x5ab275,null))[_0x27a7('0x1f')](removeEntity(_0x5ab275,null))['catch'](handleError(_0x5ab275,null));};exports['describe']=function(_0x3b3c70,_0x155b26){return db[_0x27a7('0x38')]['describe']()[_0x27a7('0x1f')](respondWithResult(_0x155b26,null))[_0x27a7('0x4f')](handleError(_0x155b26,null));};var interaction_log=require(_0x27a7('0x14'))(_0x27a7('0x58'));exports['accept']=function(_0x29c270,_0x4dfa16,_0x100c9b){var _0x24276c={'agent':{},'channel':_0x27a7('0x59')};if(_0x29c270['body']['id']){delete _0x29c270[_0x27a7('0x56')]['id'];}_0x29c270[_0x27a7('0x56')]['read']=!![];_0x29c270[_0x27a7('0x56')][_0x27a7('0x5a')]=moment()[_0x27a7('0x5b')](_0x27a7('0x5c'));_0x29c270[_0x27a7('0x56')][_0x27a7('0x5d')]=_0x29c270['body'][_0x27a7('0x5d')]||_0x29c270['user']['id'];_0x24276c['agent']['id']=_0x29c270['body']['UserId'];return db[_0x27a7('0x38')]['find']({'where':{'id':_0x29c270[_0x27a7('0x57')]['id'],'UserId':null}})[_0x27a7('0x1f')](handleEntityNotFound(_0x4dfa16,null))[_0x27a7('0x1f')](saveUpdates(_0x29c270[_0x27a7('0x56')],null))[_0x27a7('0x1f')](function(_0xeb62fb){if(_0xeb62fb){_0x24276c['message']=_0xeb62fb[_0x27a7('0x5e')]({'plain':!![]});return db[_0x27a7('0x5f')][_0x27a7('0x53')]({'where':{'id':_0xeb62fb['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4dfa16,null))[_0x27a7('0x1f')](function(_0x4fdf89){if(_0x4fdf89){return _0x4fdf89[_0x27a7('0x55')]({'UserId':_0x29c270['body'][_0x27a7('0x5d')],'read1stAt':_[_0x27a7('0x60')](_0x4fdf89[_0x27a7('0x61')])?moment()[_0x27a7('0x5b')](_0x27a7('0x5c')):undefined});}return null;})['then'](function(_0x16ef5e){if(_0x16ef5e){_0x24276c['interaction']=_0x16ef5e['get']({'plain':!![]});interaction_log[_0x27a7('0x20')](_0x27a7('0x62'),_0x29c270[_0x27a7('0x63')]['id'],_0x29c270['user'][_0x27a7('0x35')],_0x29c270[_0x27a7('0x63')]['role'],_0x24276c[_0x27a7('0x64')]['id'],_0x29c270[_0x27a7('0x56')]?JSON[_0x27a7('0x65')](_0x29c270[_0x27a7('0x56')]):'null');return respondWithRpcPromise(_0x27a7('0x66'),_0x27a7('0x67'),_0x24276c);}return null;})[_0x27a7('0x1f')](function(_0x45d6c5){var _0xa922be=_0x27a7('0x68')+_0x45d6c5[_0x27a7('0x26')][_0x27a7('0x69')];return db[_0x27a7('0x6a')][_0x27a7('0x3e')](_0xa922be,{'type':db[_0x27a7('0x6b')]['QueryTypes'][_0x27a7('0x6c')],'raw':!![]})[_0x27a7('0x1f')](function(_0x18f47b){return _0x18f47b;});})[_0x27a7('0x1f')](function(_0x197056){if(_0x197056){_0x24276c[_0x27a7('0x26')][_0x27a7('0x6d')]=_0x197056[0x0];if(!_0x29c270[_0x27a7('0x56')][_0x27a7('0x5d')])return;return db['User'][_0x27a7('0x53')]({'where':{'id':_0x29c270[_0x27a7('0x56')][_0x27a7('0x5d')],'role':'agent'},'attributes':['id','name',_0x27a7('0x6e'),_0x27a7('0x6f'),_0x27a7('0x70')],'raw':!![]});}return null;})[_0x27a7('0x1f')](function(_0x3da6bf){if(!_0x3da6bf)return null;_0x24276c['message'][_0x27a7('0x71')]=_0x3da6bf;return _0x24276c;})[_0x27a7('0x1f')](function(_0x355b17){if(_0x355b17){if(_0x29c270['body'][_0x27a7('0x72')]){_0x24276c[_0x27a7('0x26')][_0x27a7('0x73')]=util[_0x27a7('0x5b')]('SIP/%s',_0x29c270['user'][_0x27a7('0x35')]);_0x24276c[_0x27a7('0x26')][_0x27a7('0x74')]=_0x24276c[_0x27a7('0x74')];_0x24276c['message']['motionChannel']=_0x24276c[_0x27a7('0x74')];_0x24276c['message']['event']='accept';return respondWithRpcPromise('EventManager',_0x27a7('0x75'),{'event':_0x27a7('0x76'),'message':_0x24276c['message']},client9002)[_0x27a7('0x1f')](function(){return _0x24276c;});}return _0x24276c;}return null;})['then'](respondWithResult(_0x4dfa16,null))[_0x27a7('0x4f')](handleError(_0x4dfa16,null));};var interaction_log=require(_0x27a7('0x14'))(_0x27a7('0x58'));exports['reject']=function(_0xe13ab7,_0x1fa1c0,_0x1cc1ae){var _0x1b852d={'agent':{},'channel':_0x27a7('0x59')};if(_0xe13ab7[_0x27a7('0x56')]['id']){delete _0xe13ab7[_0x27a7('0x56')]['id'];}_0xe13ab7[_0x27a7('0x56')][_0x27a7('0x5d')]=_0xe13ab7[_0x27a7('0x56')]['UserId']||_0xe13ab7[_0x27a7('0x63')]['id'];_0x1b852d[_0x27a7('0x71')]['id']=_0xe13ab7['body'][_0x27a7('0x5d')];return db[_0x27a7('0x38')]['find']({'where':{'id':_0xe13ab7[_0x27a7('0x57')]['id'],'UserId':null}})[_0x27a7('0x1f')](handleEntityNotFound(_0x1fa1c0,null))[_0x27a7('0x1f')](function(_0x231e1b){if(_0x231e1b){_0x1b852d[_0x27a7('0x26')]=_0x231e1b['get']({'plain':!![]});return db[_0x27a7('0x5f')][_0x27a7('0x53')]({'where':{'id':_0x231e1b[_0x27a7('0x77')]}});}return null;})[_0x27a7('0x1f')](handleEntityNotFound(_0x1fa1c0,null))[_0x27a7('0x1f')](function(_0x5c1b85){if(_0x5c1b85){_0x1b852d[_0x27a7('0x64')]=_0x5c1b85[_0x27a7('0x5e')]({'plain':!![]});interaction_log[_0x27a7('0x20')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xe13ab7[_0x27a7('0x63')]['id'],_0xe13ab7['user'][_0x27a7('0x35')],_0xe13ab7[_0x27a7('0x63')]['role'],_0x1b852d[_0x27a7('0x64')]['id'],_0xe13ab7[_0x27a7('0x56')]?JSON['stringify'](_0xe13ab7['body']):_0x27a7('0x78'));return respondWithRpcPromise(_0x27a7('0x79'),'rejectMessage',_0x1b852d);}return null;})['then'](function(_0x461d52){var _0x5b9b72=_0x27a7('0x68')+_0x461d52['message'][_0x27a7('0x69')];return db[_0x27a7('0x6a')][_0x27a7('0x3e')](_0x5b9b72,{'type':db[_0x27a7('0x6b')]['QueryTypes'][_0x27a7('0x6c')],'raw':!![]})['then'](function(_0x96d43c){return _0x96d43c;});})[_0x27a7('0x1f')](function(_0x7a809f){if(_0x7a809f){_0x1b852d[_0x27a7('0x26')][_0x27a7('0x6d')]=_0x7a809f[0x0];if(!_0xe13ab7[_0x27a7('0x56')][_0x27a7('0x5d')])return;return db[_0x27a7('0x7a')][_0x27a7('0x53')]({'where':{'id':_0xe13ab7[_0x27a7('0x56')]['UserId'],'role':'agent'},'attributes':['id',_0x27a7('0x35'),_0x27a7('0x6e'),_0x27a7('0x6f'),_0x27a7('0x70')],'raw':!![]});}return null;})[_0x27a7('0x1f')](function(_0xcf60c2){if(!_0xcf60c2)return null;_0x1b852d[_0x27a7('0x26')][_0x27a7('0x71')]=_0xcf60c2;return _0x1b852d;})[_0x27a7('0x1f')](function(_0x30a2c7){if(_0x30a2c7){_0x30a2c7[_0x27a7('0x26')]['interface']=util[_0x27a7('0x5b')]('SIP/%s',_0xe13ab7['user'][_0x27a7('0x35')]);_0x30a2c7[_0x27a7('0x26')][_0x27a7('0x74')]=_0x1b852d[_0x27a7('0x74')];_0x30a2c7['message'][_0x27a7('0x7b')]=_0x1b852d[_0x27a7('0x74')];_0x30a2c7['message'][_0x27a7('0x7c')]=_0x27a7('0x33');respondWithRpcPromise(_0x27a7('0x75'),'EventManager',{'event':_0x27a7('0x7d'),'message':_0x30a2c7[_0x27a7('0x26')]},client9002);return _0x1b852d;}return null;})[_0x27a7('0x1f')](respondWithResult(_0x1fa1c0,null))[_0x27a7('0x4f')](handleError(_0x1fa1c0,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index f9faffc..82b1443 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 _0x0d38=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage'];(function(_0x340c13,_0x595d66){var _0x5a7d96=function(_0x250118){while(--_0x250118){_0x340c13['push'](_0x340c13['shift']());}};_0x5a7d96(++_0x595d66);}(_0x0d38,0x186));var _0x80d3=function(_0x188dec,_0x4fa5c6){_0x188dec=_0x188dec-0x0;var _0x185e41=_0x0d38[_0x188dec];return _0x185e41;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x80d3('0x0'))['db'][_0x80d3('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x80d3('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x80d3('0x3')};function emitEvent(_0x2c1f52){return function(_0x2885ae,_0x140a2c,_0x18a6e4){OpenchannelMessageEvents['emit'](_0x2c1f52+':'+_0x2885ae['id'],_0x2885ae);OpenchannelMessageEvents[_0x80d3('0x4')](_0x2c1f52,_0x2885ae);_0x18a6e4(null);};}for(var e in events){if(events[_0x80d3('0x5')](e)){var event=events[e];OpenchannelMessage[_0x80d3('0x6')](e,emitEvent(event));}}module[_0x80d3('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x733e=['setMaxListeners','save','update','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x733e,0xb6));var _0xe733=function(_0x299784,_0xb0918f){_0x299784=_0x299784-0x0;var _0x5ab008=_0x733e[_0x299784];return _0x5ab008;};'use strict';var EventEmitter=require(_0xe733('0x0'));var OpenchannelMessage=require(_0xe733('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xe733('0x2')](0x0);var events={'afterCreate':_0xe733('0x3'),'afterUpdate':_0xe733('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1a0418){return function(_0x516d56,_0xc8c956,_0x7a0f9e){OpenchannelMessageEvents[_0xe733('0x5')](_0x1a0418+':'+_0x516d56['id'],_0x516d56);OpenchannelMessageEvents[_0xe733('0x5')](_0x1a0418,_0x516d56);_0x7a0f9e(null);};}for(var e in events){if(events[_0xe733('0x6')](e)){var event=events[e];OpenchannelMessage[_0xe733('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 7b07ade..2bf9dbd 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 _0x1ee7=['error','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','secret','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','length','Interaction','omit','replyUri','method','GET','POST','threadId'];(function(_0x33c37c,_0x271910){var _0x443c9f=function(_0x54c3e0){while(--_0x54c3e0){_0x33c37c['push'](_0x33c37c['shift']());}};_0x443c9f(++_0x271910);}(_0x1ee7,0xa0));var _0x71ee=function(_0x1d8831,_0x4f280c){_0x1d8831=_0x1d8831-0x0;var _0xfdc5f9=_0x1ee7[_0x1d8831];return _0xfdc5f9;};'use strict';var _=require(_0x71ee('0x0'));var util=require(_0x71ee('0x1'));var logger=require('../../config/logger')(_0x71ee('0x2'));var moment=require(_0x71ee('0x3'));var BPromise=require(_0x71ee('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x71ee('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x71ee('0x6'));module[_0x71ee('0x7')]=function(_0x5e4b39,_0x518adf){return _0x5e4b39[_0x71ee('0x8')]('OpenchannelMessage',attributes,{'tableName':_0x71ee('0x9'),'paranoid':![],'indexes':[{'name':_0x71ee('0xa'),'fields':[_0x71ee('0xb')],'type':_0x71ee('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x11eefa,_0x3250ca,_0x57fa03){var _0x52d4f1=_0x5e4b39[_0x71ee('0xd')];var _0x45d861=_0x11eefa[_0x71ee('0xe')]({'plain':!![]});if(_0x45d861[_0x71ee('0xf')][_0x71ee('0x10')]()==='in'||_0x45d861[_0x71ee('0xf')][_0x71ee('0x10')]()===_0x71ee('0x11')&&!_0x45d861['secret']&&!_[_0x71ee('0x12')](_0x45d861[_0x71ee('0x13')])){_0x52d4f1[_0x71ee('0x14')][_0x71ee('0x15')]({'where':{'id':_0x45d861[_0x71ee('0x16')]}})[_0x71ee('0x17')](function(_0x49b21b){if(_0x49b21b){_0x49b21b[_0x71ee('0x18')]({'lastMsgAt':_0x45d861[_0x71ee('0x19')],'lastMsgDirection':_0x45d861[_0x71ee('0xf')][_0x71ee('0x10')]()});}})[_0x71ee('0x1a')](function(_0x524940){console['error'](_0x524940);});}if(_0x45d861[_0x71ee('0xf')]===_0x71ee('0x11')&&!_0x45d861[_0x71ee('0x1b')]){var _0xe33d45;_0x52d4f1[_0x71ee('0x1c')][_0x71ee('0x1d')]()[_0x71ee('0x17')](function(_0x2c7ba8){return _0x52d4f1[_0x71ee('0x1e')][_0x71ee('0x1f')]({'where':{'id':_0x45d861[_0x71ee('0x20')]},'include':[{'model':_0x52d4f1[_0x71ee('0x14')],'as':_0x71ee('0x21'),'where':{'id':_0x45d861[_0x71ee('0x16')]},'limit':0x1,'include':[{'model':_0x52d4f1['CmContact'],'as':_0x71ee('0x22'),'attributes':_[_0x71ee('0x23')](_0x2c7ba8)}]}]});})[_0x71ee('0x17')](function(_0x37bbf1){_0xe33d45=_0x37bbf1[_0x71ee('0xe')]({'plain':!![]});if(_0xe33d45&&_0xe33d45['replyUri']){logger[_0x71ee('0x24')](_0x71ee('0x25'),_0x71ee('0x26'),util[_0x71ee('0x27')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x45d861['id'],_0xe33d45['replyUri']));if(_0xe33d45[_0x71ee('0x21')]&&_0xe33d45[_0x71ee('0x21')][_0x71ee('0x28')]){_0x45d861[_0x71ee('0x29')]=_[_0x71ee('0x2a')](_0xe33d45['Interactions'][0x0],_0x71ee('0x22'));_0x45d861[_0x71ee('0x22')]=_0xe33d45[_0x71ee('0x21')][0x0][_0x71ee('0x22')];}var _0x3250ca={'method':'POST','uri':encodeURI(_0xe33d45[_0x71ee('0x2b')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3250ca[_0x71ee('0x2c')]){case _0x71ee('0x2d'):_0x3250ca['qs']=_0x45d861;break;case _0x71ee('0x2e'):_0x3250ca[_0x71ee('0xb')]=_0x45d861;break;}return rp(_0x3250ca)['then'](function(_0x329d11){logger[_0x71ee('0x24')](_0x71ee('0x25'),'afterCreate',util[_0x71ee('0x27')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x45d861['id'],_0xe33d45['replyUri']));if(_0x329d11['body'][_0x71ee('0x2f')]&&_0x329d11[_0x71ee('0xb')][_0x71ee('0x2f')]!=_0x45d861[_0x71ee('0x29')]['threadId']){return _0x52d4f1[_0x71ee('0x14')][_0x71ee('0x18')]({'threadId':_0x329d11['body'][_0x71ee('0x2f')]},{'where':{'id':_0x45d861[_0x71ee('0x29')]['id']}});}else{return;}})[_0x71ee('0x17')](function(){return _0x11eefa[_0x71ee('0x18')]({'read':!![]});})['catch'](function(_0x4acf22){logger[_0x71ee('0x30')](_0x71ee('0x25'),_0x71ee('0x26'),util['inspect'](_0x4acf22,{'showHidden':![],'depth':null}));_0x57fa03();});}else{_0x57fa03();}})[_0x71ee('0x31')](function(){_0x57fa03();});}else{_0x57fa03();}}},'charset':_0x71ee('0x32'),'collate':_0x71ee('0x33')});}; \ No newline at end of file +var _0x29fd=['out','secret','UserId','OpenchannelInteraction','findOne','then','update','createdAt','catch','CmContact','describe','OpenchannelAccountId','OpenchannelInteractionId','Contact','keys','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','POST','GET','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','body','threadId','error','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','./openchannelMessage.attributes','exports','define','OpenchannelMessage','models','direction','toLowerCase'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x29fd,0xdd));var _0xd29f=function(_0x187afa,_0x33f591){_0x187afa=_0x187afa-0x0;var _0x18194c=_0x29fd[_0x187afa];return _0x18194c;};'use strict';var _=require(_0xd29f('0x0'));var util=require(_0xd29f('0x1'));var logger=require(_0xd29f('0x2'))('api');var moment=require(_0xd29f('0x3'));var BPromise=require(_0xd29f('0x4'));var rp=require(_0xd29f('0x5'));var fs=require('fs');var path=require(_0xd29f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd29f('0x7'));module[_0xd29f('0x8')]=function(_0x2d81db,_0x23396b){return _0x2d81db[_0xd29f('0x9')](_0xd29f('0xa'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3727a7,_0x1af75b,_0xdb876c){var _0x458374=_0x2d81db[_0xd29f('0xb')];var _0x490f75=_0x3727a7['get']({'plain':!![]});if(_0x490f75[_0xd29f('0xc')][_0xd29f('0xd')]()==='in'||_0x490f75[_0xd29f('0xc')]['toLowerCase']()===_0xd29f('0xe')&&!_0x490f75[_0xd29f('0xf')]&&!_['isNil'](_0x490f75[_0xd29f('0x10')])){_0x458374[_0xd29f('0x11')][_0xd29f('0x12')]({'where':{'id':_0x490f75['OpenchannelInteractionId']}})[_0xd29f('0x13')](function(_0x446a71){if(_0x446a71){_0x446a71[_0xd29f('0x14')]({'lastMsgAt':_0x490f75[_0xd29f('0x15')],'lastMsgDirection':_0x490f75['direction'][_0xd29f('0xd')]()});}})[_0xd29f('0x16')](function(_0x63773c){console['error'](_0x63773c);});}if(_0x490f75['direction']===_0xd29f('0xe')&&!_0x490f75[_0xd29f('0xf')]){var _0x391d2e;_0x458374[_0xd29f('0x17')][_0xd29f('0x18')]()['then'](function(_0x248f3e){return _0x458374['OpenchannelAccount']['find']({'where':{'id':_0x490f75[_0xd29f('0x19')]},'include':[{'model':_0x458374['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x490f75[_0xd29f('0x1a')]},'limit':0x1,'include':[{'model':_0x458374['CmContact'],'as':_0xd29f('0x1b'),'attributes':_[_0xd29f('0x1c')](_0x248f3e)}]}]});})[_0xd29f('0x13')](function(_0x1bd446){_0x391d2e=_0x1bd446[_0xd29f('0x1d')]({'plain':!![]});if(_0x391d2e&&_0x391d2e[_0xd29f('0x1e')]){logger[_0xd29f('0x1f')](_0xd29f('0x20'),'afterCreate',util[_0xd29f('0x21')](_0xd29f('0x22'),_0x490f75['id'],_0x391d2e[_0xd29f('0x1e')]));if(_0x391d2e['Interactions']&&_0x391d2e[_0xd29f('0x23')][_0xd29f('0x24')]){_0x490f75[_0xd29f('0x25')]=_['omit'](_0x391d2e['Interactions'][0x0],'Contact');_0x490f75[_0xd29f('0x1b')]=_0x391d2e[_0xd29f('0x23')][0x0][_0xd29f('0x1b')];}var _0x1af75b={'method':_0xd29f('0x26'),'uri':encodeURI(_0x391d2e[_0xd29f('0x1e')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1af75b['method']){case _0xd29f('0x27'):_0x1af75b['qs']=_0x490f75;break;case'POST':_0x1af75b['body']=_0x490f75;break;}return rp(_0x1af75b)['then'](function(_0x86aac8){logger[_0xd29f('0x1f')](_0xd29f('0x20'),_0xd29f('0x28'),util[_0xd29f('0x21')](_0xd29f('0x29'),_0x490f75['id'],_0x391d2e[_0xd29f('0x1e')]));if(_0x86aac8[_0xd29f('0x2a')][_0xd29f('0x2b')]&&_0x86aac8[_0xd29f('0x2a')][_0xd29f('0x2b')]!=_0x490f75[_0xd29f('0x25')]['threadId']){return _0x458374[_0xd29f('0x11')]['update']({'threadId':_0x86aac8[_0xd29f('0x2a')][_0xd29f('0x2b')]},{'where':{'id':_0x490f75['Interaction']['id']}});}else{return;}})['then'](function(){return _0x3727a7['update']({'read':!![]});})[_0xd29f('0x16')](function(_0x307ff1){logger[_0xd29f('0x2c')](_0xd29f('0x20'),_0xd29f('0x28'),util['inspect'](_0x307ff1,{'showHidden':![],'depth':null}));_0xdb876c();});}else{_0xdb876c();}})[_0xd29f('0x2d')](function(){_0xdb876c();});}else{_0xdb876c();}}},'charset':'utf8mb4','collate':_0xd29f('0x2e')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index e00a21e..09e609a 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 _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x1df77b,_0x14950c){var _0x990a48=function(_0xa8f8ea){while(--_0xa8f8ea){_0x1df77b['push'](_0x1df77b['shift']());}};_0x990a48(++_0x14950c);}(_0x7a54,0x106));var _0x47a5=function(_0x2270d0,_0x482194){_0x2270d0=_0x2270d0-0x0;var _0x32856a=_0x7a54[_0x2270d0];return _0x32856a;};'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});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ 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(_0x4e16e9,_0x13769a){var _0x4c5f41=function(_0x315b71){while(--_0x315b71){_0x4e16e9['push'](_0x4e16e9['shift']());}};_0x4c5f41(++_0x13769a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'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 ff7c2b9..751c400 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 _0xa381=['openchannelMessage:','./openchannelMessage.events','save','removeListener','register'];(function(_0x42efbe,_0xe47a8c){var _0x4b242d=function(_0xd8ec40){while(--_0xd8ec40){_0x42efbe['push'](_0x42efbe['shift']());}};_0x4b242d(++_0xe47a8c);}(_0xa381,0x79));var _0x1a38=function(_0x1a0557,_0x2a0db7){_0x1a0557=_0x1a0557-0x0;var _0x1ad015=_0xa381[_0x1a0557];return _0x1ad015;};'use strict';var OpenchannelMessageEvents=require(_0x1a38('0x0'));var events=[_0x1a38('0x1'),'remove','update'];function createListener(_0x41cdc2,_0xe2d8b3){return function(_0x2a069e){_0xe2d8b3['emit'](_0x41cdc2,_0x2a069e);};}function removeListener(_0x2a4353,_0x6cbf3){return function(){OpenchannelMessageEvents[_0x1a38('0x2')](_0x2a4353,_0x6cbf3);};}exports[_0x1a38('0x3')]=function(_0x4bb44f){for(var _0x411f6a=0x0,_0x569e9f=events['length'];_0x411f6a<_0x569e9f;_0x411f6a++){var _0x3d12f8=events[_0x411f6a];var _0x4df1db=createListener(_0x1a38('0x4')+_0x3d12f8,_0x4bb44f);OpenchannelMessageEvents['on'](_0x3d12f8,_0x4df1db);}}; \ No newline at end of file +var _0xb04c=['remove','register','length','save'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xb04c,0x1b7));var _0xcb04=function(_0x13f416,_0x1b3157){_0x13f416=_0x13f416-0x0;var _0x20bd1f=_0xb04c[_0x13f416];return _0x20bd1f;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xcb04('0x0'),_0xcb04('0x1'),'update'];function createListener(_0x293637,_0xa387b){return function(_0x56022a){_0xa387b['emit'](_0x293637,_0x56022a);};}function removeListener(_0x59fe05,_0x52b545){return function(){OpenchannelMessageEvents['removeListener'](_0x59fe05,_0x52b545);};}exports[_0xcb04('0x2')]=function(_0x35a67a){for(var _0x4fcabb=0x0,_0x2ac503=events[_0xcb04('0x3')];_0x4fcabb<_0x2ac503;_0x4fcabb++){var _0x10ec59=events[_0x4fcabb];var _0x38faff=createListener('openchannelMessage:'+_0x10ec59,_0x35a67a);OpenchannelMessageEvents['on'](_0x10ec59,_0x38faff);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 28344f8..ae3bc2c 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 _0xe6d6=['delete','destroy','/:id/teams','removeTeams','/:id/users','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','/:id','/:id/members','getMembers','getTeams','getAgents','post','create','addAgents','update'];(function(_0x78409a,_0x15cdd1){var _0xabcc52=function(_0x374020){while(--_0x374020){_0x78409a['push'](_0x78409a['shift']());}};_0xabcc52(++_0x15cdd1);}(_0xe6d6,0xf7));var _0x6e6d=function(_0x41a60b,_0xc398d){_0x41a60b=_0x41a60b-0x0;var _0x10c95a=_0xe6d6[_0x41a60b];return _0x10c95a;};'use strict';var multer=require('multer');var util=require(_0x6e6d('0x0'));var path=require(_0x6e6d('0x1'));var timeout=require(_0x6e6d('0x2'));var express=require(_0x6e6d('0x3'));var router=express[_0x6e6d('0x4')]();var fs_extra=require(_0x6e6d('0x5'));var auth=require(_0x6e6d('0x6'));var interaction=require(_0x6e6d('0x7'));var config=require(_0x6e6d('0x8'));var controller=require(_0x6e6d('0x9'));router[_0x6e6d('0xa')]('/',auth[_0x6e6d('0xb')](),controller[_0x6e6d('0xc')]);router[_0x6e6d('0xa')](_0x6e6d('0xd'),auth[_0x6e6d('0xb')](),controller['describe']);router[_0x6e6d('0xa')](_0x6e6d('0xe'),auth[_0x6e6d('0xb')](),controller['show']);router[_0x6e6d('0xa')](_0x6e6d('0xf'),auth[_0x6e6d('0xb')](),controller[_0x6e6d('0x10')]);router[_0x6e6d('0xa')]('/:id/teams',auth['isAuthenticated'](),controller[_0x6e6d('0x11')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x6e6d('0x12')]);router[_0x6e6d('0x13')]('/',auth['isAuthenticated'](),controller[_0x6e6d('0x14')]);router['post']('/:id/teams',auth[_0x6e6d('0xb')](),controller['addTeams']);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x6e6d('0x15')]);router['put']('/:id',auth[_0x6e6d('0xb')](),controller[_0x6e6d('0x16')]);router[_0x6e6d('0x17')](_0x6e6d('0xe'),auth[_0x6e6d('0xb')](),controller[_0x6e6d('0x18')]);router[_0x6e6d('0x17')](_0x6e6d('0x19'),auth[_0x6e6d('0xb')](),controller[_0x6e6d('0x1a')]);router['delete'](_0x6e6d('0x1b'),auth[_0x6e6d('0xb')](),controller[_0x6e6d('0x1c')]);module[_0x6e6d('0x1d')]=router; \ No newline at end of file +var _0x803c=['describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index'];(function(_0x43df8b,_0x163b58){var _0x3268fd=function(_0x190e88){while(--_0x190e88){_0x43df8b['push'](_0x43df8b['shift']());}};_0x3268fd(++_0x163b58);}(_0x803c,0x11f));var _0xc803=function(_0x13cb8f,_0xa54aad){_0x13cb8f=_0x13cb8f-0x0;var _0x264c61=_0x803c[_0x13cb8f];return _0x264c61;};'use strict';var multer=require(_0xc803('0x0'));var util=require(_0xc803('0x1'));var path=require('path');var timeout=require(_0xc803('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc803('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xc803('0x4'));var config=require(_0xc803('0x5'));var controller=require(_0xc803('0x6'));router[_0xc803('0x7')]('/',auth[_0xc803('0x8')](),controller[_0xc803('0x9')]);router['get']('/describe',auth[_0xc803('0x8')](),controller[_0xc803('0xa')]);router['get'](_0xc803('0xb'),auth['isAuthenticated'](),controller[_0xc803('0xc')]);router[_0xc803('0x7')]('/:id/members',auth[_0xc803('0x8')](),controller[_0xc803('0xd')]);router[_0xc803('0x7')](_0xc803('0xe'),auth[_0xc803('0x8')](),controller[_0xc803('0xf')]);router[_0xc803('0x7')](_0xc803('0x10'),auth[_0xc803('0x8')](),controller[_0xc803('0x11')]);router[_0xc803('0x12')]('/',auth[_0xc803('0x8')](),controller[_0xc803('0x13')]);router[_0xc803('0x12')](_0xc803('0xe'),auth[_0xc803('0x8')](),controller['addTeams']);router['post'](_0xc803('0x10'),auth[_0xc803('0x8')](),controller[_0xc803('0x14')]);router['put']('/:id',auth[_0xc803('0x8')](),controller[_0xc803('0x15')]);router['delete'](_0xc803('0xb'),auth['isAuthenticated'](),controller[_0xc803('0x16')]);router[_0xc803('0x17')]('/:id/teams',auth[_0xc803('0x8')](),controller[_0xc803('0x18')]);router[_0xc803('0x17')](_0xc803('0x10'),auth[_0xc803('0x8')](),controller[_0xc803('0x19')]);module[_0xc803('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 4af1a8b..dca8962 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 _0xd875=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','name','STRING'];(function(_0x36d91c,_0x1cccf0){var _0x3f64c4=function(_0x5dd5d9){while(--_0x5dd5d9){_0x36d91c['push'](_0x36d91c['shift']());}};_0x3f64c4(++_0x1cccf0);}(_0xd875,0x175));var _0x5d87=function(_0x53c552,_0x129587){_0x53c552=_0x53c552-0x0;var _0x599000=_0xd875[_0x53c552];return _0x599000;};'use strict';var Sequelize=require(_0x5d87('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x5d87('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5d87('0x2')]},'timeout':{'type':Sequelize[_0x5d87('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5d87('0x4')](_0x5d87('0x5'),_0x5d87('0x6'),_0x5d87('0x7'))}}; \ No newline at end of file +var _0x07f9=['beepall','sequelize','exports','STRING','name','ENUM'];(function(_0x5c1345,_0x40116e){var _0x1c070d=function(_0x1e862f){while(--_0x1e862f){_0x5c1345['push'](_0x5c1345['shift']());}};_0x1c070d(++_0x40116e);}(_0x07f9,0x1db));var _0x907f=function(_0x4c8c22,_0x166929){_0x4c8c22=_0x4c8c22-0x0;var _0x1aa308=_0x07f9[_0x4c8c22];return _0x1aa308;};'use strict';var Sequelize=require(_0x907f('0x0'));module[_0x907f('0x1')]={'name':{'type':Sequelize[_0x907f('0x2')],'unique':_0x907f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x907f('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x907f('0x4')]('rrmemory',_0x907f('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index dcb9873..15715cc 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 _0xac12=['../../mysqldb','defaults','redis','./openchannelQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','OpenchannelQueues','UserProfileResource','stack','name','send','index','map','fieldName','type','key','getOptions','OpenchannelQueue','include','query','findAll','catch','show','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','nolimit','order','sort','OpenchannelQueueId','where','filter','User','findAndCountAll','UserId','createdAt','rows','format','%s/%s','SIP','getTeams','Team','pick','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','isArray','getAgents','bluebird','util','squel','../../components/parsers/qs','../../config/logger'];(function(_0x2f0bf1,_0x183ef1){var _0xf1df38=function(_0x56982a){while(--_0x56982a){_0x2f0bf1['push'](_0x2f0bf1['shift']());}};_0xf1df38(++_0x183ef1);}(_0xac12,0x163));var _0x2ac1=function(_0x3dca19,_0x47442b){_0x3dca19=_0x3dca19-0x0;var _0x58947d=_0xac12[_0x3dca19];return _0x58947d;};'use strict';var BPromise=require(_0x2ac1('0x0'));var util=require(_0x2ac1('0x1'));var _=require('lodash');var squel=require(_0x2ac1('0x2'));var Redis=require('ioredis');var qs=require(_0x2ac1('0x3'));var logger=require(_0x2ac1('0x4'))('api');var config=require('../../config/environment');var db=require(_0x2ac1('0x5'))['db'];config['redis']=_[_0x2ac1('0x6')](config[_0x2ac1('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2ac1('0x7')]));require(_0x2ac1('0x8'))[_0x2ac1('0x9')](socket);function respondWithStatusCode(_0x59c170,_0x21b06c){_0x21b06c=_0x21b06c||0xcc;return function(_0x2fb2bd){if(_0x2fb2bd){return _0x59c170['sendStatus'](_0x21b06c);}return _0x59c170[_0x2ac1('0xa')](_0x21b06c)[_0x2ac1('0xb')]();};}function respondWithResult(_0x53dec1,_0x3e8251){_0x3e8251=_0x3e8251||0xc8;return function(_0x132730){if(_0x132730){return _0x53dec1[_0x2ac1('0xa')](_0x3e8251)[_0x2ac1('0xc')](_0x132730);}};}function respondWithFilteredResult(_0x35b798,_0x67e0c4){return function(_0x5a3c93){if(_0x5a3c93){var _0x3cbdbd=typeof _0x67e0c4[_0x2ac1('0xd')]===_0x2ac1('0xe')&&typeof _0x67e0c4[_0x2ac1('0xf')]===_0x2ac1('0xe');var _0x34618a=_0x5a3c93[_0x2ac1('0x10')];var _0x34f40a=_0x3cbdbd?0x0:_0x67e0c4[_0x2ac1('0xd')];var _0x28e421=_0x3cbdbd?_0x5a3c93['count']:_0x67e0c4[_0x2ac1('0xd')]+_0x67e0c4[_0x2ac1('0xf')];var _0xe35c59;if(_0x28e421>=_0x34618a){_0x28e421=_0x34618a;_0xe35c59=0xc8;}else{_0xe35c59=0xce;}_0x35b798[_0x2ac1('0xa')](_0xe35c59);return _0x35b798[_0x2ac1('0x11')](_0x2ac1('0x12'),_0x34f40a+'-'+_0x28e421+'/'+_0x34618a)[_0x2ac1('0xc')](_0x5a3c93);}return null;};}function saveUpdates(_0x184eff){return function(_0x191020){if(_0x191020){return _0x191020[_0x2ac1('0x13')](_0x184eff)[_0x2ac1('0x14')](function(_0x146978){return _0x146978;});}return null;};}function removeEntity(_0xf2dec6){return function(_0x38656f){if(_0x38656f){return _0x38656f[_0x2ac1('0x15')]()[_0x2ac1('0x14')](function(){var _0xeea7ee=_0x38656f['get']({'plain':!![]});var _0x130949=_0x2ac1('0x16');return db[_0x2ac1('0x17')][_0x2ac1('0x15')]({'where':{'type':_0x130949,'resourceId':_0xeea7ee['id']}})[_0x2ac1('0x14')](function(){return _0x38656f;});})[_0x2ac1('0x14')](function(){_0xf2dec6[_0x2ac1('0xa')](0xcc)[_0x2ac1('0xb')]();});}};}function handleEntityNotFound(_0x305714){return function(_0x372cb2){if(!_0x372cb2){_0x305714['sendStatus'](0x194);}return _0x372cb2;};}function handleError(_0x419de9,_0x96ad2a){_0x96ad2a=_0x96ad2a||0x1f4;return function(_0x20ef3b){logger['error'](_0x20ef3b[_0x2ac1('0x18')]);if(_0x20ef3b['name']){delete _0x20ef3b[_0x2ac1('0x19')];}_0x419de9[_0x2ac1('0xa')](_0x96ad2a)[_0x2ac1('0x1a')](_0x20ef3b);};}exports[_0x2ac1('0x1b')]=function(_0x52f168,_0x4e94cf){var _0x44927f={};var _0x1172bf={'count':0x0,'rows':[]};var _0x51c5e0=_[_0x2ac1('0x1c')](db['OpenchannelQueue']['rawAttributes'],function(_0x222b26){return{'name':_0x222b26[_0x2ac1('0x1d')],'type':_0x222b26[_0x2ac1('0x1e')][_0x2ac1('0x1f')]};});_0x44927f=qs[_0x2ac1('0x20')](_0x51c5e0,_0x52f168);var _0x411db6={'where':_0x44927f['where']};return db[_0x2ac1('0x21')]['count'](_0x411db6)[_0x2ac1('0x14')](function(_0x84aa94){_0x1172bf[_0x2ac1('0x10')]=_0x84aa94;_0x44927f[_0x2ac1('0x22')]=qs[_0x2ac1('0x22')](_0x52f168[_0x2ac1('0x23')]);return db[_0x2ac1('0x21')][_0x2ac1('0x24')](_0x44927f);})['then'](function(_0x9cd847){_0x1172bf['rows']=_0x9cd847;return _0x1172bf;})[_0x2ac1('0x14')](respondWithFilteredResult(_0x4e94cf,_0x44927f))[_0x2ac1('0x25')](handleError(_0x4e94cf,null));};exports[_0x2ac1('0x26')]=function(_0x2b8076,_0x47c94f){var _0x46c338={'raw':!![],'where':{'id':_0x2b8076[_0x2ac1('0x27')]['id']}},_0x24b997={};_0x24b997[_0x2ac1('0x28')]=_[_0x2ac1('0x29')](db['OpenchannelQueue'][_0x2ac1('0x2a')]);_0x24b997[_0x2ac1('0x23')]=_['keys'](_0x2b8076[_0x2ac1('0x23')]);_0x24b997[_0x2ac1('0x2b')]=_[_0x2ac1('0x2c')](_0x24b997[_0x2ac1('0x28')],_0x24b997[_0x2ac1('0x23')]);_0x46c338[_0x2ac1('0x2d')]=_[_0x2ac1('0x2c')](_0x24b997['model'],qs['fields'](_0x2b8076[_0x2ac1('0x23')][_0x2ac1('0x2e')]));_0x46c338[_0x2ac1('0x2d')]=_0x46c338[_0x2ac1('0x2d')][_0x2ac1('0x2f')]?_0x46c338[_0x2ac1('0x2d')]:_0x24b997[_0x2ac1('0x28')];if(_0x2b8076[_0x2ac1('0x23')][_0x2ac1('0x30')]){_0x46c338[_0x2ac1('0x22')]=[{'all':!![]}];}_0x46c338=_[_0x2ac1('0x31')]({},_0x46c338,_0x2b8076[_0x2ac1('0x32')]);return db['OpenchannelQueue'][_0x2ac1('0x33')](_0x46c338)[_0x2ac1('0x14')](handleEntityNotFound(_0x47c94f,null))[_0x2ac1('0x14')](respondWithResult(_0x47c94f,null))[_0x2ac1('0x25')](handleError(_0x47c94f,null));};exports[_0x2ac1('0x34')]=function(_0x4b62d5,_0x5d9c7a){return db[_0x2ac1('0x21')][_0x2ac1('0x34')](_0x4b62d5[_0x2ac1('0x35')],{})[_0x2ac1('0x14')](function(_0x398166){var _0x34583c=_0x4b62d5[_0x2ac1('0x36')][_0x2ac1('0x37')]({'plain':!![]});if(!_0x34583c)throw new Error(_0x2ac1('0x38'));if(_0x34583c['role']===_0x2ac1('0x36')){var _0x163de9=_0x398166[_0x2ac1('0x37')]({'plain':!![]});var _0x2d182a=_0x2ac1('0x16');return db[_0x2ac1('0x39')][_0x2ac1('0x33')]({'where':{'name':_0x2d182a,'userProfileId':_0x34583c[_0x2ac1('0x3a')]},'raw':!![]})[_0x2ac1('0x14')](function(_0x5e509e){if(_0x5e509e&&_0x5e509e['autoAssociation']===0x0){return db[_0x2ac1('0x17')][_0x2ac1('0x34')]({'name':_0x163de9['name'],'resourceId':_0x163de9['id'],'type':_0x5e509e['name'],'sectionId':_0x5e509e['id']},{})['then'](function(){return _0x398166;});}else{return _0x398166;}})[_0x2ac1('0x25')](function(_0x428b06){logger['error'](_0x2ac1('0x3b'),_0x428b06);throw _0x428b06;});}return _0x398166;})[_0x2ac1('0x14')](respondWithResult(_0x5d9c7a,0xc9))[_0x2ac1('0x25')](handleError(_0x5d9c7a,null));};exports[_0x2ac1('0x13')]=function(_0x4ca8e0,_0x212409){if(_0x4ca8e0[_0x2ac1('0x35')]['id']){delete _0x4ca8e0[_0x2ac1('0x35')]['id'];}return db[_0x2ac1('0x21')][_0x2ac1('0x33')]({'where':{'id':_0x4ca8e0[_0x2ac1('0x27')]['id']}})[_0x2ac1('0x14')](handleEntityNotFound(_0x212409,null))[_0x2ac1('0x14')](saveUpdates(_0x4ca8e0['body'],null))['then'](respondWithResult(_0x212409,null))[_0x2ac1('0x25')](handleError(_0x212409,null));};exports[_0x2ac1('0x15')]=function(_0x695f67,_0x2c9f30){return db[_0x2ac1('0x21')]['find']({'where':{'id':_0x695f67[_0x2ac1('0x27')]['id']}})['then'](handleEntityNotFound(_0x2c9f30,null))[_0x2ac1('0x14')](removeEntity(_0x2c9f30,null))[_0x2ac1('0x25')](handleError(_0x2c9f30,null));};exports['describe']=function(_0x2cc94d,_0x5022c8){return db[_0x2ac1('0x21')][_0x2ac1('0x3c')]()['then'](respondWithResult(_0x5022c8,null))[_0x2ac1('0x25')](handleError(_0x5022c8,null));};exports[_0x2ac1('0x3d')]=function(_0x4e3a72,_0x456195){var _0x461ba7={'raw':!![],'where':{}},_0x257ae8={},_0x118c67;return db[_0x2ac1('0x21')][_0x2ac1('0x3e')]({'where':{'id':_0x4e3a72[_0x2ac1('0x27')]['id']}})['then'](handleEntityNotFound(_0x456195,null))[_0x2ac1('0x14')](function(_0x4beb92){if(_0x4beb92){_0x118c67=_0x4beb92[_0x2ac1('0x37')]({'plain':!![]});_0x257ae8['model']=_['keys'](db[_0x2ac1('0x3f')]['rawAttributes']);_0x257ae8[_0x2ac1('0x23')]=_['keys'](_0x4e3a72[_0x2ac1('0x23')]);_0x257ae8[_0x2ac1('0x2b')]=_[_0x2ac1('0x2c')](_0x257ae8[_0x2ac1('0x28')],_0x257ae8[_0x2ac1('0x23')]);_0x461ba7[_0x2ac1('0x2d')]=_['intersection'](_0x257ae8[_0x2ac1('0x28')],qs[_0x2ac1('0x2e')](_0x4e3a72[_0x2ac1('0x23')][_0x2ac1('0x2e')]));_0x461ba7[_0x2ac1('0x2d')]=_0x461ba7[_0x2ac1('0x2d')]['length']?_0x461ba7[_0x2ac1('0x2d')]:_0x257ae8[_0x2ac1('0x28')];if(!_0x4e3a72['query'][_0x2ac1('0x40')](_0x2ac1('0x41'))){_0x461ba7[_0x2ac1('0xf')]=qs[_0x2ac1('0xf')](_0x4e3a72[_0x2ac1('0x23')]['limit']);_0x461ba7['offset']=qs[_0x2ac1('0xd')](_0x4e3a72['query'][_0x2ac1('0xd')]);}_0x461ba7[_0x2ac1('0x42')]=qs[_0x2ac1('0x43')](_0x4e3a72['query'][_0x2ac1('0x43')]);_0x461ba7['where']=qs[_0x2ac1('0x2b')](_['pick'](_0x4e3a72['query'],_0x257ae8['filters']));_0x461ba7['where'][_0x2ac1('0x44')]=_0x4beb92['id'];if(_0x4e3a72['query']['filter']){_0x461ba7[_0x2ac1('0x45')]=_['merge'](_0x461ba7[_0x2ac1('0x45')],{'$or':_[_0x2ac1('0x1c')](_0x461ba7[_0x2ac1('0x2d')],function(_0x38daef){var _0x3acbcd={};_0x3acbcd[_0x38daef]={'$like':'%'+_0x4e3a72[_0x2ac1('0x23')][_0x2ac1('0x46')]+'%'};return _0x3acbcd;})});}_0x461ba7=_[_0x2ac1('0x31')]({},_0x461ba7,_0x4e3a72[_0x2ac1('0x32')]);return db[_0x2ac1('0x3f')][_0x2ac1('0x24')](_0x461ba7);}})[_0x2ac1('0x14')](function(_0x28cd66){if(_0x28cd66){return db[_0x2ac1('0x47')][_0x2ac1('0x48')]({'where':{'id':_['map'](_0x28cd66,_0x2ac1('0x49')),'role':'agent'},'attributes':['id','name','openchannelPause','updatedAt',_0x2ac1('0x4a')]});}})[_0x2ac1('0x14')](function(_0x109270){if(_0x109270){return{'count':_0x109270[_0x2ac1('0x10')],'rows':_[_0x2ac1('0x1c')](_0x109270[_0x2ac1('0x4b')],function(_0x1c6b34){return{'membername':_0x1c6b34[_0x2ac1('0x19')],'UserId':_0x1c6b34['id'],'queue_name':_0x118c67['name'],'OpenchannelQueueId':_0x118c67['id'],'interface':util[_0x2ac1('0x4c')](_0x2ac1('0x4d'),_0x2ac1('0x4e'),_0x1c6b34['name']),'penalty':0x0,'paused':_0x1c6b34['openchannelPause'],'createdAt':_0x1c6b34[_0x2ac1('0x4a')],'updatedAt':_0x1c6b34['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x456195,_0x461ba7))['catch'](handleError(_0x456195,null));};exports[_0x2ac1('0x4f')]=function(_0x3092fc,_0x43bd5f){var _0x5a0709={};var _0x15c731={};var _0x2eb581;var _0x5d2fae;return db[_0x2ac1('0x21')][_0x2ac1('0x3e')]({'where':{'id':_0x3092fc['params']['id']}})[_0x2ac1('0x14')](handleEntityNotFound(_0x43bd5f,null))['then'](function(_0xab4885){if(_0xab4885){_0x2eb581=_0xab4885;_0x15c731[_0x2ac1('0x28')]=_[_0x2ac1('0x29')](db[_0x2ac1('0x50')]['rawAttributes']);_0x15c731[_0x2ac1('0x23')]=_[_0x2ac1('0x29')](_0x3092fc[_0x2ac1('0x23')]);_0x15c731[_0x2ac1('0x2b')]=_['intersection'](_0x15c731[_0x2ac1('0x28')],_0x15c731['query']);_0x5a0709[_0x2ac1('0x2d')]=_[_0x2ac1('0x2c')](_0x15c731[_0x2ac1('0x28')],qs[_0x2ac1('0x2e')](_0x3092fc[_0x2ac1('0x23')][_0x2ac1('0x2e')]));_0x5a0709[_0x2ac1('0x2d')]=_0x5a0709[_0x2ac1('0x2d')][_0x2ac1('0x2f')]?_0x5a0709[_0x2ac1('0x2d')]:_0x15c731[_0x2ac1('0x28')];_0x5a0709['order']=qs[_0x2ac1('0x43')](_0x3092fc[_0x2ac1('0x23')]['sort']);_0x5a0709[_0x2ac1('0x45')]=qs[_0x2ac1('0x2b')](_[_0x2ac1('0x51')](_0x3092fc[_0x2ac1('0x23')],_0x15c731['filters']));if(_0x3092fc['query'][_0x2ac1('0x46')]){_0x5a0709[_0x2ac1('0x45')]=_[_0x2ac1('0x31')](_0x5a0709['where'],{'$or':_['map'](_0x5a0709['attributes'],function(_0xcea8df){var _0x3623fa={};_0x3623fa[_0xcea8df]={'$like':'%'+_0x3092fc['query'][_0x2ac1('0x46')]+'%'};return _0x3623fa;})});}_0x5a0709=_[_0x2ac1('0x31')]({},_0x5a0709,_0x3092fc[_0x2ac1('0x32')]);return _0x2eb581[_0x2ac1('0x4f')](_0x5a0709);}})[_0x2ac1('0x14')](function(_0x2b54df){if(_0x2b54df){_0x5d2fae=_0x2b54df[_0x2ac1('0x2f')];if(!_0x3092fc[_0x2ac1('0x23')]['hasOwnProperty'](_0x2ac1('0x41'))){_0x5a0709['limit']=qs[_0x2ac1('0xf')](_0x3092fc['query'][_0x2ac1('0xf')]);_0x5a0709[_0x2ac1('0xd')]=qs[_0x2ac1('0xd')](_0x3092fc[_0x2ac1('0x23')][_0x2ac1('0xd')]);}return _0x2eb581[_0x2ac1('0x4f')](_0x5a0709);}})[_0x2ac1('0x14')](function(_0x1d307e){if(_0x1d307e){return _0x1d307e?{'count':_0x5d2fae,'rows':_0x1d307e}:null;}})[_0x2ac1('0x14')](respondWithResult(_0x43bd5f,null))[_0x2ac1('0x25')](handleError(_0x43bd5f,null));};exports[_0x2ac1('0x52')]=function(_0x10a29e,_0x11a295){var _0xa7b2ab=_0x10a29e['body'][_0x2ac1('0x53')];return db[_0x2ac1('0x50')][_0x2ac1('0x24')]({'where':{'id':_0xa7b2ab},'attributes':['id'],'include':[{'model':db[_0x2ac1('0x47')],'as':_0x2ac1('0x54'),'attributes':['id',_0x2ac1('0x19'),_0x2ac1('0x55'),_0x2ac1('0x56'),_0x2ac1('0x57')],'raw':!![]}]})[_0x2ac1('0x14')](function(_0x369d93){if(_0x369d93){var _0x3470d7=_['flatMap'](_0x369d93,function(_0x46bc13){var _0x3e550a=_0x46bc13[_0x2ac1('0x37')]({'plain':!![]});return _0x3e550a[_0x2ac1('0x54')];});return db[_0x2ac1('0x21')][_0x2ac1('0x33')]({'where':{'id':_0x10a29e[_0x2ac1('0x27')]['id']}})[_0x2ac1('0x14')](function(_0x27cb6f){return db[_0x2ac1('0x58')][_0x2ac1('0x59')](function(_0xa590){return _0x27cb6f[_0x2ac1('0x52')](_0xa7b2ab,{'transaction':_0xa590})[_0x2ac1('0x14')](function(){return BPromise[_0x2ac1('0x5a')](_0x3470d7,function(_0x17dc35){return db['UserOpenchannelQueue'][_0x2ac1('0x5b')]({'where':{'UserId':_0x17dc35['id'],'OpenchannelQueueId':_0x10a29e['params']['id']},'transaction':_0xa590});});})[_0x2ac1('0x14')](function(){_0x3470d7[_0x2ac1('0x5c')](function(_0x186227){socket[_0x2ac1('0x5d')]('userOpenchannelQueue:save',{'UserId':_0x186227['id'],'OpenchannelQueueId':_0x27cb6f['id']});});});});});}})[_0x2ac1('0x14')](respondWithStatusCode(_0x11a295,null))[_0x2ac1('0x25')](handleError(_0x11a295,null));};exports[_0x2ac1('0x5e')]=function(_0x1b3123,_0x21a84c){return db['Team'][_0x2ac1('0x24')]({'where':{'id':_0x1b3123['query'][_0x2ac1('0x53')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2ac1('0x54'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x21a84c,null))[_0x2ac1('0x14')](function(_0x2d4877){var _0x92651b=_[_0x2ac1('0x1c')](_0x2d4877,'id');var _0xbfa9db=[];var _0x5f0998=[];var _0x5ee4ff=squel['select']();_0x5ee4ff['field'](_0x2ac1('0x5f'))[_0x2ac1('0x60')](_0x2ac1('0x61'),'tq')[_0x2ac1('0x62')]('user_has_teams','ut',_0x2ac1('0x63'))[_0x2ac1('0x45')](_0x2ac1('0x64'),_0x1b3123[_0x2ac1('0x27')]['id']);for(var _0x173f27=0x0;_0x173f27<_0x2d4877[_0x2ac1('0x2f')];_0x173f27+=0x1){let _0x588e9e=_0x2d4877[_0x173f27];for(var _0x234de8=0x0;_0x234de8<_0x588e9e[_0x2ac1('0x54')][_0x2ac1('0x2f')];_0x234de8+=0x1){let _0x1c2345=_0x588e9e[_0x2ac1('0x54')][_0x234de8];var _0x31d158=_0x5ee4ff[_0x2ac1('0x65')]();_0x31d158[_0x2ac1('0x45')](_0x2ac1('0x66'),_0x1c2345['id']);_0x5f0998[_0x2ac1('0x67')](db[_0x2ac1('0x58')][_0x2ac1('0x23')](_0x31d158[_0x2ac1('0x68')](),{'type':db[_0x2ac1('0x58')]['QueryTypes']['SELECT']})['then'](function(_0x4bddb4){if(_0x4bddb4[_0x2ac1('0x2f')]===0x1){return _0x1c2345['id'];}else{var _0x30940a=_[_0x2ac1('0x69')](_[_0x2ac1('0x1c')](_0x4bddb4,_0x2ac1('0x6a')),function(_0x434ddc){return _[_0x2ac1('0x6b')](_0x92651b,_0x434ddc);});if(_0x30940a){return _0x1c2345['id'];}}}));}}return BPromise['all'](_0x5f0998)[_0x2ac1('0x14')](function(_0x3854de){_0xbfa9db=_(_0xbfa9db)[_0x2ac1('0x6c')](_0x3854de)[_0x2ac1('0x6d')]()[_0x2ac1('0x6e')]();return db['OpenchannelQueue'][_0x2ac1('0x33')]({'where':{'id':_0x1b3123[_0x2ac1('0x27')]['id']}})[_0x2ac1('0x14')](function(_0x4ae7e1){return db[_0x2ac1('0x58')][_0x2ac1('0x59')](function(_0x335599){return _0x4ae7e1[_0x2ac1('0x5e')](_0x1b3123[_0x2ac1('0x23')][_0x2ac1('0x53')],{'transaction':_0x335599})[_0x2ac1('0x14')](function(){if(!_[_0x2ac1('0x6f')](_0xbfa9db)){return _0x4ae7e1[_0x2ac1('0x70')](_0xbfa9db,{'transaction':_0x335599});}})[_0x2ac1('0x14')](function(){_0xbfa9db[_0x2ac1('0x5c')](function(_0x4dee56){socket['emit'](_0x2ac1('0x71'),{'UserId':_0x4dee56,'OpenchannelQueueId':_0x4ae7e1['id']});});});});});});})['then'](respondWithStatusCode(_0x21a84c,null))[_0x2ac1('0x25')](handleError(_0x21a84c,null));};exports[_0x2ac1('0x72')]=function(_0xbc504b,_0x383930){return db['OpenchannelQueue'][_0x2ac1('0x33')]({'where':{'id':_0xbc504b[_0x2ac1('0x27')]['id']}})[_0x2ac1('0x14')](handleEntityNotFound(_0x383930,null))[_0x2ac1('0x14')](function(_0x7e9be5){if(_0x7e9be5){return _0x7e9be5[_0x2ac1('0x72')](_0xbc504b[_0x2ac1('0x35')]['ids'],_[_0x2ac1('0x73')](_0xbc504b[_0x2ac1('0x35')],[_0x2ac1('0x53'),'id'])||{})[_0x2ac1('0x74')](function(_0x4f0a5b){for(var _0x384688=0x0;_0x384688<_0xbc504b[_0x2ac1('0x35')][_0x2ac1('0x53')][_0x2ac1('0x2f')];_0x384688+=0x1){socket[_0x2ac1('0x5d')](_0x2ac1('0x75'),{'UserId':Number(_0xbc504b[_0x2ac1('0x35')][_0x2ac1('0x53')][_0x384688]),'OpenchannelQueueId':Number(_0xbc504b[_0x2ac1('0x27')]['id'])});}return _0x4f0a5b;});}})[_0x2ac1('0x14')](respondWithResult(_0x383930,null))['catch'](handleError(_0x383930,null));};exports[_0x2ac1('0x70')]=function(_0x343e6,_0x5a6a2b){return db[_0x2ac1('0x21')]['find']({'where':{'id':_0x343e6[_0x2ac1('0x27')]['id']}})[_0x2ac1('0x14')](handleEntityNotFound(_0x5a6a2b,null))['then'](function(_0x3967b4){if(_0x3967b4){return _0x3967b4['removeAgents'](_0x343e6[_0x2ac1('0x23')]['ids'])[_0x2ac1('0x14')](function(){if(_[_0x2ac1('0x76')](_0x343e6['query']['ids'])){for(var _0x2e12ec=0x0;_0x2e12ec<_0x343e6[_0x2ac1('0x23')][_0x2ac1('0x53')][_0x2ac1('0x2f')];_0x2e12ec+=0x1){socket[_0x2ac1('0x5d')]('userOpenchannelQueue:remove',{'UserId':Number(_0x343e6[_0x2ac1('0x23')][_0x2ac1('0x53')][_0x2e12ec]),'OpenchannelQueueId':Number(_0x343e6[_0x2ac1('0x27')]['id'])});}}else{socket[_0x2ac1('0x5d')](_0x2ac1('0x71'),{'UserId':Number(_0x343e6[_0x2ac1('0x23')][_0x2ac1('0x53')]),'OpenchannelQueueId':Number(_0x343e6['params']['id'])});}});}})[_0x2ac1('0x14')](respondWithStatusCode(_0x5a6a2b,null))['catch'](handleError(_0x5a6a2b,null));};exports[_0x2ac1('0x77')]=function(_0x570159,_0x2bda7f){var _0x34d70f={};var _0x2b0932={};var _0x3ee955;var _0x19c314;return db[_0x2ac1('0x21')][_0x2ac1('0x3e')]({'where':{'id':_0x570159[_0x2ac1('0x27')]['id']}})[_0x2ac1('0x14')](handleEntityNotFound(_0x2bda7f,null))[_0x2ac1('0x14')](function(_0x34e7d4){if(_0x34e7d4){_0x3ee955=_0x34e7d4;_0x2b0932['model']=_[_0x2ac1('0x29')](db[_0x2ac1('0x47')]['rawAttributes']);_0x2b0932['query']=_[_0x2ac1('0x29')](_0x570159[_0x2ac1('0x23')]);_0x2b0932[_0x2ac1('0x2b')]=_[_0x2ac1('0x2c')](_0x2b0932['model'],_0x2b0932[_0x2ac1('0x23')]);_0x34d70f[_0x2ac1('0x2d')]=_[_0x2ac1('0x2c')](_0x2b0932[_0x2ac1('0x28')],qs[_0x2ac1('0x2e')](_0x570159['query'][_0x2ac1('0x2e')]));_0x34d70f[_0x2ac1('0x2d')]=_0x34d70f[_0x2ac1('0x2d')][_0x2ac1('0x2f')]?_0x34d70f[_0x2ac1('0x2d')]:_0x2b0932['model'];_0x34d70f['order']=qs[_0x2ac1('0x43')](_0x570159[_0x2ac1('0x23')][_0x2ac1('0x43')]);_0x34d70f['where']=qs['filters'](_['pick'](_0x570159[_0x2ac1('0x23')],_0x2b0932['filters']));if(_0x570159[_0x2ac1('0x23')]['filter']){_0x34d70f[_0x2ac1('0x45')]=_['merge'](_0x34d70f[_0x2ac1('0x45')],{'$or':_[_0x2ac1('0x1c')](_0x34d70f[_0x2ac1('0x2d')],function(_0x175260){var _0x503dba={};_0x503dba[_0x175260]={'$like':'%'+_0x570159[_0x2ac1('0x23')]['filter']+'%'};return _0x503dba;})});}_0x34d70f=_[_0x2ac1('0x31')]({},_0x34d70f,_0x570159[_0x2ac1('0x32')]);return _0x3ee955['getAgents'](_0x34d70f);}})[_0x2ac1('0x14')](function(_0x90268b){if(_0x90268b){_0x19c314=_0x90268b[_0x2ac1('0x2f')];if(!_0x570159['query']['hasOwnProperty'](_0x2ac1('0x41'))){_0x34d70f[_0x2ac1('0xf')]=qs[_0x2ac1('0xf')](_0x570159[_0x2ac1('0x23')][_0x2ac1('0xf')]);_0x34d70f['offset']=qs[_0x2ac1('0xd')](_0x570159[_0x2ac1('0x23')][_0x2ac1('0xd')]);}return _0x3ee955[_0x2ac1('0x77')](_0x34d70f);}})[_0x2ac1('0x14')](function(_0x4f9de5){if(_0x4f9de5){return _0x4f9de5?{'count':_0x19c314,'rows':_0x4f9de5}:null;}})[_0x2ac1('0x14')](respondWithResult(_0x2bda7f,null))[_0x2ac1('0x25')](handleError(_0x2bda7f,null));}; \ No newline at end of file +var _0xb541=['get','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','getOptions','include','rows','params','keys','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','order','sort','pick','where','OpenchannelQueueId','filter','findAll','User','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','nolimit','addTeams','Team','Agents','online','interface','flatMap','sequelize','transaction','each','forEach','ids','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','toString','SELECT','includes','all','compact','value','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','emit','userOpenchannelQueue:save','isArray','getAgents','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','register','sendStatus','status','end','json','offset','undefined','limit','count','update','then','destroy'];(function(_0x382afe,_0x531424){var _0x1ff212=function(_0x463654){while(--_0x463654){_0x382afe['push'](_0x382afe['shift']());}};_0x1ff212(++_0x531424);}(_0xb541,0x1bc));var _0x1b54=function(_0x3cbf81,_0x4f0512){_0x3cbf81=_0x3cbf81-0x0;var _0x5a25c8=_0xb541[_0x3cbf81];return _0x5a25c8;};'use strict';var BPromise=require(_0x1b54('0x0'));var util=require('util');var _=require(_0x1b54('0x1'));var squel=require('squel');var Redis=require(_0x1b54('0x2'));var qs=require(_0x1b54('0x3'));var logger=require(_0x1b54('0x4'))(_0x1b54('0x5'));var config=require(_0x1b54('0x6'));var db=require('../../mysqldb')['db'];config[_0x1b54('0x7')]=_['defaults'](config[_0x1b54('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1b54('0x7')]));require('./openchannelQueue.socket')[_0x1b54('0x8')](socket);function respondWithStatusCode(_0x64f4d8,_0x495d40){_0x495d40=_0x495d40||0xcc;return function(_0x433cb7){if(_0x433cb7){return _0x64f4d8[_0x1b54('0x9')](_0x495d40);}return _0x64f4d8[_0x1b54('0xa')](_0x495d40)[_0x1b54('0xb')]();};}function respondWithResult(_0x14aef5,_0x152b9d){_0x152b9d=_0x152b9d||0xc8;return function(_0x1fe0e4){if(_0x1fe0e4){return _0x14aef5[_0x1b54('0xa')](_0x152b9d)[_0x1b54('0xc')](_0x1fe0e4);}};}function respondWithFilteredResult(_0x3185f6,_0x59ed98){return function(_0x320e8f){if(_0x320e8f){var _0x5267fa=typeof _0x59ed98[_0x1b54('0xd')]===_0x1b54('0xe')&&typeof _0x59ed98[_0x1b54('0xf')]===_0x1b54('0xe');var _0x1b00f6=_0x320e8f[_0x1b54('0x10')];var _0x441795=_0x5267fa?0x0:_0x59ed98[_0x1b54('0xd')];var _0x43e430=_0x5267fa?_0x320e8f[_0x1b54('0x10')]:_0x59ed98['offset']+_0x59ed98[_0x1b54('0xf')];var _0xa2ffa9;if(_0x43e430>=_0x1b00f6){_0x43e430=_0x1b00f6;_0xa2ffa9=0xc8;}else{_0xa2ffa9=0xce;}_0x3185f6[_0x1b54('0xa')](_0xa2ffa9);return _0x3185f6['set']('Content-Range',_0x441795+'-'+_0x43e430+'/'+_0x1b00f6)['json'](_0x320e8f);}return null;};}function saveUpdates(_0x59ad61){return function(_0x58b7c4){if(_0x58b7c4){return _0x58b7c4[_0x1b54('0x11')](_0x59ad61)[_0x1b54('0x12')](function(_0x145183){return _0x145183;});}return null;};}function removeEntity(_0xfe96c6){return function(_0xecbac2){if(_0xecbac2){return _0xecbac2[_0x1b54('0x13')]()[_0x1b54('0x12')](function(){var _0x5d9713=_0xecbac2[_0x1b54('0x14')]({'plain':!![]});var _0x2a68aa=_0x1b54('0x15');return db[_0x1b54('0x16')][_0x1b54('0x13')]({'where':{'type':_0x2a68aa,'resourceId':_0x5d9713['id']}})['then'](function(){return _0xecbac2;});})[_0x1b54('0x12')](function(){_0xfe96c6[_0x1b54('0xa')](0xcc)[_0x1b54('0xb')]();});}};}function handleEntityNotFound(_0x2fcf5c){return function(_0x47cfd2){if(!_0x47cfd2){_0x2fcf5c[_0x1b54('0x9')](0x194);}return _0x47cfd2;};}function handleError(_0x442b2e,_0x2dd358){_0x2dd358=_0x2dd358||0x1f4;return function(_0xbac7d){logger[_0x1b54('0x17')](_0xbac7d[_0x1b54('0x18')]);if(_0xbac7d[_0x1b54('0x19')]){delete _0xbac7d[_0x1b54('0x19')];}_0x442b2e['status'](_0x2dd358)[_0x1b54('0x1a')](_0xbac7d);};}exports[_0x1b54('0x1b')]=function(_0x4555e4,_0x4fed7f){var _0x3ca077={};var _0x671416={'count':0x0,'rows':[]};var _0x24fcf9=_[_0x1b54('0x1c')](db[_0x1b54('0x1d')][_0x1b54('0x1e')],function(_0x371190){return{'name':_0x371190[_0x1b54('0x1f')],'type':_0x371190[_0x1b54('0x20')]['key']};});_0x3ca077=qs[_0x1b54('0x21')](_0x24fcf9,_0x4555e4);var _0xad4a61={'where':_0x3ca077['where']};return db[_0x1b54('0x1d')]['count'](_0xad4a61)[_0x1b54('0x12')](function(_0xc4302){_0x671416[_0x1b54('0x10')]=_0xc4302;_0x3ca077[_0x1b54('0x22')]=qs[_0x1b54('0x22')](_0x4555e4['query']);return db[_0x1b54('0x1d')]['findAll'](_0x3ca077);})['then'](function(_0x1a5e87){_0x671416[_0x1b54('0x23')]=_0x1a5e87;return _0x671416;})[_0x1b54('0x12')](respondWithFilteredResult(_0x4fed7f,_0x3ca077))['catch'](handleError(_0x4fed7f,null));};exports['show']=function(_0x4b59c8,_0x40b651){var _0x5d0957={'raw':!![],'where':{'id':_0x4b59c8[_0x1b54('0x24')]['id']}},_0x5bf52b={};_0x5bf52b['model']=_[_0x1b54('0x25')](db['OpenchannelQueue']['rawAttributes']);_0x5bf52b[_0x1b54('0x26')]=_[_0x1b54('0x25')](_0x4b59c8['query']);_0x5bf52b[_0x1b54('0x27')]=_[_0x1b54('0x28')](_0x5bf52b[_0x1b54('0x29')],_0x5bf52b['query']);_0x5d0957[_0x1b54('0x2a')]=_[_0x1b54('0x28')](_0x5bf52b[_0x1b54('0x29')],qs['fields'](_0x4b59c8['query'][_0x1b54('0x2b')]));_0x5d0957[_0x1b54('0x2a')]=_0x5d0957[_0x1b54('0x2a')][_0x1b54('0x2c')]?_0x5d0957['attributes']:_0x5bf52b[_0x1b54('0x29')];if(_0x4b59c8[_0x1b54('0x26')][_0x1b54('0x2d')]){_0x5d0957['include']=[{'all':!![]}];}_0x5d0957=_[_0x1b54('0x2e')]({},_0x5d0957,_0x4b59c8[_0x1b54('0x2f')]);return db[_0x1b54('0x1d')][_0x1b54('0x30')](_0x5d0957)['then'](handleEntityNotFound(_0x40b651,null))[_0x1b54('0x12')](respondWithResult(_0x40b651,null))[_0x1b54('0x31')](handleError(_0x40b651,null));};exports[_0x1b54('0x32')]=function(_0x9eec32,_0x563f39){return db['OpenchannelQueue'][_0x1b54('0x32')](_0x9eec32[_0x1b54('0x33')],{})['then'](function(_0x44a7c5){var _0x5ce881=_0x9eec32['user'][_0x1b54('0x14')]({'plain':!![]});if(!_0x5ce881)throw new Error(_0x1b54('0x34'));if(_0x5ce881[_0x1b54('0x35')]==='user'){var _0x52170e=_0x44a7c5[_0x1b54('0x14')]({'plain':!![]});var _0x49845d=_0x1b54('0x15');return db['UserProfileSection'][_0x1b54('0x30')]({'where':{'name':_0x49845d,'userProfileId':_0x5ce881[_0x1b54('0x36')]},'raw':!![]})[_0x1b54('0x12')](function(_0x5a3096){if(_0x5a3096&&_0x5a3096[_0x1b54('0x37')]===0x0){return db[_0x1b54('0x16')][_0x1b54('0x32')]({'name':_0x52170e[_0x1b54('0x19')],'resourceId':_0x52170e['id'],'type':_0x5a3096['name'],'sectionId':_0x5a3096['id']},{})[_0x1b54('0x12')](function(){return _0x44a7c5;});}else{return _0x44a7c5;}})[_0x1b54('0x31')](function(_0x4aedf1){logger[_0x1b54('0x17')](_0x1b54('0x38'),_0x4aedf1);throw _0x4aedf1;});}return _0x44a7c5;})['then'](respondWithResult(_0x563f39,0xc9))[_0x1b54('0x31')](handleError(_0x563f39,null));};exports[_0x1b54('0x11')]=function(_0xffd493,_0x23b0fb){if(_0xffd493['body']['id']){delete _0xffd493['body']['id'];}return db[_0x1b54('0x1d')]['find']({'where':{'id':_0xffd493[_0x1b54('0x24')]['id']}})[_0x1b54('0x12')](handleEntityNotFound(_0x23b0fb,null))[_0x1b54('0x12')](saveUpdates(_0xffd493[_0x1b54('0x33')],null))[_0x1b54('0x12')](respondWithResult(_0x23b0fb,null))[_0x1b54('0x31')](handleError(_0x23b0fb,null));};exports[_0x1b54('0x13')]=function(_0x521ce9,_0x398f48){return db['OpenchannelQueue'][_0x1b54('0x30')]({'where':{'id':_0x521ce9[_0x1b54('0x24')]['id']}})[_0x1b54('0x12')](handleEntityNotFound(_0x398f48,null))[_0x1b54('0x12')](removeEntity(_0x398f48,null))['catch'](handleError(_0x398f48,null));};exports[_0x1b54('0x39')]=function(_0x5ddc69,_0x161a72){return db[_0x1b54('0x1d')][_0x1b54('0x39')]()['then'](respondWithResult(_0x161a72,null))[_0x1b54('0x31')](handleError(_0x161a72,null));};exports[_0x1b54('0x3a')]=function(_0x487b93,_0x2f973c){var _0x4c8f21={'raw':!![],'where':{}},_0x5626ee={},_0x39a226;return db['OpenchannelQueue'][_0x1b54('0x3b')]({'where':{'id':_0x487b93[_0x1b54('0x24')]['id']}})[_0x1b54('0x12')](handleEntityNotFound(_0x2f973c,null))[_0x1b54('0x12')](function(_0x41c11b){if(_0x41c11b){_0x39a226=_0x41c11b[_0x1b54('0x14')]({'plain':!![]});_0x5626ee[_0x1b54('0x29')]=_[_0x1b54('0x25')](db[_0x1b54('0x3c')][_0x1b54('0x1e')]);_0x5626ee[_0x1b54('0x26')]=_[_0x1b54('0x25')](_0x487b93[_0x1b54('0x26')]);_0x5626ee['filters']=_['intersection'](_0x5626ee['model'],_0x5626ee[_0x1b54('0x26')]);_0x4c8f21[_0x1b54('0x2a')]=_[_0x1b54('0x28')](_0x5626ee[_0x1b54('0x29')],qs[_0x1b54('0x2b')](_0x487b93[_0x1b54('0x26')][_0x1b54('0x2b')]));_0x4c8f21[_0x1b54('0x2a')]=_0x4c8f21[_0x1b54('0x2a')][_0x1b54('0x2c')]?_0x4c8f21[_0x1b54('0x2a')]:_0x5626ee[_0x1b54('0x29')];if(!_0x487b93[_0x1b54('0x26')][_0x1b54('0x3d')]('nolimit')){_0x4c8f21[_0x1b54('0xf')]=qs[_0x1b54('0xf')](_0x487b93[_0x1b54('0x26')]['limit']);_0x4c8f21['offset']=qs[_0x1b54('0xd')](_0x487b93['query'][_0x1b54('0xd')]);}_0x4c8f21[_0x1b54('0x3e')]=qs[_0x1b54('0x3f')](_0x487b93[_0x1b54('0x26')][_0x1b54('0x3f')]);_0x4c8f21['where']=qs[_0x1b54('0x27')](_[_0x1b54('0x40')](_0x487b93[_0x1b54('0x26')],_0x5626ee['filters']));_0x4c8f21[_0x1b54('0x41')][_0x1b54('0x42')]=_0x41c11b['id'];if(_0x487b93[_0x1b54('0x26')][_0x1b54('0x43')]){_0x4c8f21[_0x1b54('0x41')]=_['merge'](_0x4c8f21[_0x1b54('0x41')],{'$or':_['map'](_0x4c8f21[_0x1b54('0x2a')],function(_0x23f8fa){var _0x150bb0={};_0x150bb0[_0x23f8fa]={'$like':'%'+_0x487b93[_0x1b54('0x26')][_0x1b54('0x43')]+'%'};return _0x150bb0;})});}_0x4c8f21=_[_0x1b54('0x2e')]({},_0x4c8f21,_0x487b93['options']);return db[_0x1b54('0x3c')][_0x1b54('0x44')](_0x4c8f21);}})[_0x1b54('0x12')](function(_0x3c268d){if(_0x3c268d){return db[_0x1b54('0x45')][_0x1b54('0x46')]({'where':{'id':_[_0x1b54('0x1c')](_0x3c268d,'UserId'),'role':_0x1b54('0x47')},'attributes':['id',_0x1b54('0x19'),_0x1b54('0x48'),_0x1b54('0x49'),_0x1b54('0x4a')]});}})[_0x1b54('0x12')](function(_0x45c042){if(_0x45c042){return{'count':_0x45c042[_0x1b54('0x10')],'rows':_[_0x1b54('0x1c')](_0x45c042[_0x1b54('0x23')],function(_0x178b0d){return{'membername':_0x178b0d[_0x1b54('0x19')],'UserId':_0x178b0d['id'],'queue_name':_0x39a226[_0x1b54('0x19')],'OpenchannelQueueId':_0x39a226['id'],'interface':util[_0x1b54('0x4b')](_0x1b54('0x4c'),_0x1b54('0x4d'),_0x178b0d[_0x1b54('0x19')]),'penalty':0x0,'paused':_0x178b0d['openchannelPause'],'createdAt':_0x178b0d[_0x1b54('0x4a')],'updatedAt':_0x178b0d[_0x1b54('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1b54('0x12')](respondWithFilteredResult(_0x2f973c,_0x4c8f21))[_0x1b54('0x31')](handleError(_0x2f973c,null));};exports['getTeams']=function(_0x22cbae,_0x410245){var _0x197f95={};var _0x1f047c={};var _0xeea8a7;var _0xc857e8;return db[_0x1b54('0x1d')][_0x1b54('0x3b')]({'where':{'id':_0x22cbae['params']['id']}})[_0x1b54('0x12')](handleEntityNotFound(_0x410245,null))[_0x1b54('0x12')](function(_0x3339c0){if(_0x3339c0){_0xeea8a7=_0x3339c0;_0x1f047c['model']=_[_0x1b54('0x25')](db['Team'][_0x1b54('0x1e')]);_0x1f047c[_0x1b54('0x26')]=_[_0x1b54('0x25')](_0x22cbae['query']);_0x1f047c['filters']=_[_0x1b54('0x28')](_0x1f047c[_0x1b54('0x29')],_0x1f047c[_0x1b54('0x26')]);_0x197f95[_0x1b54('0x2a')]=_[_0x1b54('0x28')](_0x1f047c[_0x1b54('0x29')],qs[_0x1b54('0x2b')](_0x22cbae[_0x1b54('0x26')][_0x1b54('0x2b')]));_0x197f95['attributes']=_0x197f95[_0x1b54('0x2a')][_0x1b54('0x2c')]?_0x197f95['attributes']:_0x1f047c[_0x1b54('0x29')];_0x197f95[_0x1b54('0x3e')]=qs[_0x1b54('0x3f')](_0x22cbae[_0x1b54('0x26')][_0x1b54('0x3f')]);_0x197f95['where']=qs[_0x1b54('0x27')](_[_0x1b54('0x40')](_0x22cbae[_0x1b54('0x26')],_0x1f047c[_0x1b54('0x27')]));if(_0x22cbae[_0x1b54('0x26')][_0x1b54('0x43')]){_0x197f95[_0x1b54('0x41')]=_['merge'](_0x197f95[_0x1b54('0x41')],{'$or':_[_0x1b54('0x1c')](_0x197f95[_0x1b54('0x2a')],function(_0x6b760c){var _0xd0f30b={};_0xd0f30b[_0x6b760c]={'$like':'%'+_0x22cbae[_0x1b54('0x26')]['filter']+'%'};return _0xd0f30b;})});}_0x197f95=_[_0x1b54('0x2e')]({},_0x197f95,_0x22cbae[_0x1b54('0x2f')]);return _0xeea8a7[_0x1b54('0x4e')](_0x197f95);}})[_0x1b54('0x12')](function(_0x448d42){if(_0x448d42){_0xc857e8=_0x448d42[_0x1b54('0x2c')];if(!_0x22cbae[_0x1b54('0x26')][_0x1b54('0x3d')](_0x1b54('0x4f'))){_0x197f95[_0x1b54('0xf')]=qs[_0x1b54('0xf')](_0x22cbae[_0x1b54('0x26')][_0x1b54('0xf')]);_0x197f95[_0x1b54('0xd')]=qs[_0x1b54('0xd')](_0x22cbae[_0x1b54('0x26')][_0x1b54('0xd')]);}return _0xeea8a7[_0x1b54('0x4e')](_0x197f95);}})[_0x1b54('0x12')](function(_0x36e1ac){if(_0x36e1ac){return _0x36e1ac?{'count':_0xc857e8,'rows':_0x36e1ac}:null;}})[_0x1b54('0x12')](respondWithResult(_0x410245,null))[_0x1b54('0x31')](handleError(_0x410245,null));};exports[_0x1b54('0x50')]=function(_0x4c1d69,_0x15c656){var _0x1278fc=_0x4c1d69[_0x1b54('0x33')]['ids'];return db[_0x1b54('0x51')][_0x1b54('0x44')]({'where':{'id':_0x1278fc},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1b54('0x52'),'attributes':['id',_0x1b54('0x19'),_0x1b54('0x53'),'voicePause',_0x1b54('0x54')],'raw':!![]}]})[_0x1b54('0x12')](function(_0x5b0dd3){if(_0x5b0dd3){var _0x498788=_[_0x1b54('0x55')](_0x5b0dd3,function(_0x370577){var _0x41fbe9=_0x370577['get']({'plain':!![]});return _0x41fbe9[_0x1b54('0x52')];});return db[_0x1b54('0x1d')][_0x1b54('0x30')]({'where':{'id':_0x4c1d69[_0x1b54('0x24')]['id']}})[_0x1b54('0x12')](function(_0x30b749){return db[_0x1b54('0x56')][_0x1b54('0x57')](function(_0x7b9f91){return _0x30b749[_0x1b54('0x50')](_0x1278fc,{'transaction':_0x7b9f91})[_0x1b54('0x12')](function(){return BPromise[_0x1b54('0x58')](_0x498788,function(_0x5098e9){return db[_0x1b54('0x3c')]['findOrCreate']({'where':{'UserId':_0x5098e9['id'],'OpenchannelQueueId':_0x4c1d69['params']['id']},'transaction':_0x7b9f91});});})[_0x1b54('0x12')](function(){_0x498788[_0x1b54('0x59')](function(_0x2daab3){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x2daab3['id'],'OpenchannelQueueId':_0x30b749['id']});});});});});}})[_0x1b54('0x12')](respondWithStatusCode(_0x15c656,null))['catch'](handleError(_0x15c656,null));};exports['removeTeams']=function(_0xcf16c4,_0x5128dc){return db[_0x1b54('0x51')][_0x1b54('0x44')]({'where':{'id':_0xcf16c4[_0x1b54('0x26')][_0x1b54('0x5a')]},'attributes':['id'],'include':[{'model':db[_0x1b54('0x45')],'as':_0x1b54('0x52'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5128dc,null))['then'](function(_0x47911f){var _0x145906=_[_0x1b54('0x1c')](_0x47911f,'id');var _0x5c1c96=[];var _0x4af2ad=[];var _0x17ea45=squel[_0x1b54('0x5b')]();_0x17ea45[_0x1b54('0x5c')](_0x1b54('0x5d'))[_0x1b54('0x5e')](_0x1b54('0x5f'),'tq')[_0x1b54('0x60')](_0x1b54('0x61'),'ut',_0x1b54('0x62'))[_0x1b54('0x41')](_0x1b54('0x63'),_0xcf16c4[_0x1b54('0x24')]['id']);for(var _0x50b095=0x0;_0x50b095<_0x47911f['length'];_0x50b095+=0x1){let _0x2f39da=_0x47911f[_0x50b095];for(var _0x8873e0=0x0;_0x8873e0<_0x2f39da[_0x1b54('0x52')]['length'];_0x8873e0+=0x1){let _0x3ad6ef=_0x2f39da[_0x1b54('0x52')][_0x8873e0];var _0x74f160=_0x17ea45[_0x1b54('0x64')]();_0x74f160['where']('ut.UserId\x20=\x20?',_0x3ad6ef['id']);_0x4af2ad['push'](db['sequelize'][_0x1b54('0x26')](_0x74f160[_0x1b54('0x65')](),{'type':db[_0x1b54('0x56')]['QueryTypes'][_0x1b54('0x66')]})[_0x1b54('0x12')](function(_0x507321){if(_0x507321[_0x1b54('0x2c')]===0x1){return _0x3ad6ef['id'];}else{var _0x2a76ca=_['every'](_['map'](_0x507321,'TeamId'),function(_0x2b79a3){return _[_0x1b54('0x67')](_0x145906,_0x2b79a3);});if(_0x2a76ca){return _0x3ad6ef['id'];}}}));}}return BPromise[_0x1b54('0x68')](_0x4af2ad)[_0x1b54('0x12')](function(_0x26cd6a){_0x5c1c96=_(_0x5c1c96)['union'](_0x26cd6a)[_0x1b54('0x69')]()[_0x1b54('0x6a')]();return db['OpenchannelQueue']['find']({'where':{'id':_0xcf16c4[_0x1b54('0x24')]['id']}})[_0x1b54('0x12')](function(_0xbf2806){return db[_0x1b54('0x56')][_0x1b54('0x57')](function(_0x1d17f1){return _0xbf2806[_0x1b54('0x6b')](_0xcf16c4[_0x1b54('0x26')][_0x1b54('0x5a')],{'transaction':_0x1d17f1})[_0x1b54('0x12')](function(){if(!_[_0x1b54('0x6c')](_0x5c1c96)){return _0xbf2806[_0x1b54('0x6d')](_0x5c1c96,{'transaction':_0x1d17f1});}})['then'](function(){_0x5c1c96[_0x1b54('0x59')](function(_0x4da3cf){socket['emit'](_0x1b54('0x6e'),{'UserId':_0x4da3cf,'OpenchannelQueueId':_0xbf2806['id']});});});});});});})[_0x1b54('0x12')](respondWithStatusCode(_0x5128dc,null))[_0x1b54('0x31')](handleError(_0x5128dc,null));};exports[_0x1b54('0x6f')]=function(_0x1b3116,_0x35093d){return db[_0x1b54('0x1d')][_0x1b54('0x30')]({'where':{'id':_0x1b3116[_0x1b54('0x24')]['id']}})['then'](handleEntityNotFound(_0x35093d,null))[_0x1b54('0x12')](function(_0x2442cc){if(_0x2442cc){return _0x2442cc[_0x1b54('0x6f')](_0x1b3116[_0x1b54('0x33')][_0x1b54('0x5a')],_['omit'](_0x1b3116[_0x1b54('0x33')],['ids','id'])||{})['spread'](function(_0x1d7a36){for(var _0xe9ff3=0x0;_0xe9ff3<_0x1b3116['body']['ids'][_0x1b54('0x2c')];_0xe9ff3+=0x1){socket[_0x1b54('0x70')](_0x1b54('0x71'),{'UserId':Number(_0x1b3116[_0x1b54('0x33')][_0x1b54('0x5a')][_0xe9ff3]),'OpenchannelQueueId':Number(_0x1b3116[_0x1b54('0x24')]['id'])});}return _0x1d7a36;});}})[_0x1b54('0x12')](respondWithResult(_0x35093d,null))[_0x1b54('0x31')](handleError(_0x35093d,null));};exports[_0x1b54('0x6d')]=function(_0x49b1db,_0x53c43c){return db[_0x1b54('0x1d')][_0x1b54('0x30')]({'where':{'id':_0x49b1db['params']['id']}})['then'](handleEntityNotFound(_0x53c43c,null))[_0x1b54('0x12')](function(_0x5b20c4){if(_0x5b20c4){return _0x5b20c4[_0x1b54('0x6d')](_0x49b1db[_0x1b54('0x26')][_0x1b54('0x5a')])['then'](function(){if(_[_0x1b54('0x72')](_0x49b1db[_0x1b54('0x26')][_0x1b54('0x5a')])){for(var _0x293e92=0x0;_0x293e92<_0x49b1db['query'][_0x1b54('0x5a')][_0x1b54('0x2c')];_0x293e92+=0x1){socket[_0x1b54('0x70')]('userOpenchannelQueue:remove',{'UserId':Number(_0x49b1db[_0x1b54('0x26')][_0x1b54('0x5a')][_0x293e92]),'OpenchannelQueueId':Number(_0x49b1db[_0x1b54('0x24')]['id'])});}}else{socket['emit'](_0x1b54('0x6e'),{'UserId':Number(_0x49b1db[_0x1b54('0x26')][_0x1b54('0x5a')]),'OpenchannelQueueId':Number(_0x49b1db[_0x1b54('0x24')]['id'])});}});}})[_0x1b54('0x12')](respondWithStatusCode(_0x53c43c,null))[_0x1b54('0x31')](handleError(_0x53c43c,null));};exports['getAgents']=function(_0x5df6c2,_0x2b20ca){var _0x4175f0={};var _0x516b79={};var _0x4f6b2a;var _0x3c7ca4;return db[_0x1b54('0x1d')][_0x1b54('0x3b')]({'where':{'id':_0x5df6c2[_0x1b54('0x24')]['id']}})['then'](handleEntityNotFound(_0x2b20ca,null))[_0x1b54('0x12')](function(_0x4f178e){if(_0x4f178e){_0x4f6b2a=_0x4f178e;_0x516b79[_0x1b54('0x29')]=_['keys'](db[_0x1b54('0x45')]['rawAttributes']);_0x516b79[_0x1b54('0x26')]=_[_0x1b54('0x25')](_0x5df6c2['query']);_0x516b79[_0x1b54('0x27')]=_[_0x1b54('0x28')](_0x516b79['model'],_0x516b79[_0x1b54('0x26')]);_0x4175f0[_0x1b54('0x2a')]=_[_0x1b54('0x28')](_0x516b79[_0x1b54('0x29')],qs['fields'](_0x5df6c2['query'][_0x1b54('0x2b')]));_0x4175f0[_0x1b54('0x2a')]=_0x4175f0[_0x1b54('0x2a')][_0x1b54('0x2c')]?_0x4175f0['attributes']:_0x516b79[_0x1b54('0x29')];_0x4175f0['order']=qs['sort'](_0x5df6c2[_0x1b54('0x26')][_0x1b54('0x3f')]);_0x4175f0[_0x1b54('0x41')]=qs[_0x1b54('0x27')](_[_0x1b54('0x40')](_0x5df6c2[_0x1b54('0x26')],_0x516b79[_0x1b54('0x27')]));if(_0x5df6c2[_0x1b54('0x26')][_0x1b54('0x43')]){_0x4175f0[_0x1b54('0x41')]=_[_0x1b54('0x2e')](_0x4175f0[_0x1b54('0x41')],{'$or':_[_0x1b54('0x1c')](_0x4175f0[_0x1b54('0x2a')],function(_0x383d63){var _0x35011b={};_0x35011b[_0x383d63]={'$like':'%'+_0x5df6c2['query'][_0x1b54('0x43')]+'%'};return _0x35011b;})});}_0x4175f0=_[_0x1b54('0x2e')]({},_0x4175f0,_0x5df6c2[_0x1b54('0x2f')]);return _0x4f6b2a[_0x1b54('0x73')](_0x4175f0);}})['then'](function(_0x2b4e6b){if(_0x2b4e6b){_0x3c7ca4=_0x2b4e6b['length'];if(!_0x5df6c2[_0x1b54('0x26')][_0x1b54('0x3d')](_0x1b54('0x4f'))){_0x4175f0[_0x1b54('0xf')]=qs[_0x1b54('0xf')](_0x5df6c2[_0x1b54('0x26')][_0x1b54('0xf')]);_0x4175f0[_0x1b54('0xd')]=qs['offset'](_0x5df6c2[_0x1b54('0x26')][_0x1b54('0xd')]);}return _0x4f6b2a[_0x1b54('0x73')](_0x4175f0);}})['then'](function(_0x4ed101){if(_0x4ed101){return _0x4ed101?{'count':_0x3c7ca4,'rows':_0x4ed101}:null;}})[_0x1b54('0x12')](respondWithResult(_0x2b20ca,null))[_0x1b54('0x31')](handleError(_0x2b20ca,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 45e5345..b13a99f 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 _0xa76e=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','save','update','remove'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa76e,0x180));var _0xea76=function(_0x454018,_0x46e33a){_0x454018=_0x454018-0x0;var _0x24697d=_0xa76e[_0x454018];return _0x24697d;};'use strict';var EventEmitter=require(_0xea76('0x0'));var OpenchannelQueue=require(_0xea76('0x1'))['db'][_0xea76('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xea76('0x3'),'afterUpdate':_0xea76('0x4'),'afterDestroy':_0xea76('0x5')};function emitEvent(_0x40118c){return function(_0x214177,_0x364cbb,_0x4f9e3b){OpenchannelQueueEvents['emit'](_0x40118c+':'+_0x214177['id'],_0x214177);OpenchannelQueueEvents[_0xea76('0x6')](_0x40118c,_0x214177);_0x4f9e3b(null);};}for(var e in events){if(events[_0xea76('0x7')](e)){var event=events[e];OpenchannelQueue[_0xea76('0x8')](e,emitEvent(event));}}module[_0xea76('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xdf22=['update','emit','hook','exports','events','../../mysqldb','OpenchannelQueue'];(function(_0x3e3724,_0x56eccf){var _0x4de33e=function(_0x595294){while(--_0x595294){_0x3e3724['push'](_0x3e3724['shift']());}};_0x4de33e(++_0x56eccf);}(_0xdf22,0x7b));var _0x2df2=function(_0x257f68,_0x28cd3d){_0x257f68=_0x257f68-0x0;var _0x1b1437=_0xdf22[_0x257f68];return _0x1b1437;};'use strict';var EventEmitter=require(_0x2df2('0x0'));var OpenchannelQueue=require(_0x2df2('0x1'))['db'][_0x2df2('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x2df2('0x3'),'afterDestroy':'remove'};function emitEvent(_0x57c1bd){return function(_0x2a4c65,_0x3ad36f,_0x14c2c0){OpenchannelQueueEvents[_0x2df2('0x4')](_0x57c1bd+':'+_0x2a4c65['id'],_0x2a4c65);OpenchannelQueueEvents[_0x2df2('0x4')](_0x57c1bd,_0x2a4c65);_0x14c2c0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x2df2('0x5')](e,emitEvent(event));}}module[_0x2df2('0x6')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index e30f7a3..8b8241b 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 _0x7d80=['moment','bluebird','request-promise','path','../../config/environment','./openchannelQueue.attributes','exports','OpenchannelQueue','openchannel_queues','lodash','../../config/logger'];(function(_0x55cc58,_0x5ce0af){var _0x26062e=function(_0x59e29d){while(--_0x59e29d){_0x55cc58['push'](_0x55cc58['shift']());}};_0x26062e(++_0x5ce0af);}(_0x7d80,0x17f));var _0x07d8=function(_0x489b2a,_0xf9db5){_0x489b2a=_0x489b2a-0x0;var _0xf3a6ae=_0x7d80[_0x489b2a];return _0xf3a6ae;};'use strict';var _=require(_0x07d8('0x0'));var util=require('util');var logger=require(_0x07d8('0x1'))('api');var moment=require(_0x07d8('0x2'));var BPromise=require(_0x07d8('0x3'));var rp=require(_0x07d8('0x4'));var fs=require('fs');var path=require(_0x07d8('0x5'));var rimraf=require('rimraf');var config=require(_0x07d8('0x6'));var attributes=require(_0x07d8('0x7'));module[_0x07d8('0x8')]=function(_0xc22002,_0xb137){return _0xc22002['define'](_0x07d8('0x9'),attributes,{'tableName':_0x07d8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x798e=['../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xb05b44,_0x2839da){var _0x1a7b4a=function(_0x42749e){while(--_0x42749e){_0xb05b44['push'](_0xb05b44['shift']());}};_0x1a7b4a(++_0x2839da);}(_0x798e,0x92));var _0xe798=function(_0x4a135a,_0x42f38f){_0x4a135a=_0x4a135a-0x0;var _0x493f78=_0x798e[_0x4a135a];return _0x493f78;};'use strict';var _=require(_0xe798('0x0'));var util=require(_0xe798('0x1'));var logger=require(_0xe798('0x2'))(_0xe798('0x3'));var moment=require(_0xe798('0x4'));var BPromise=require(_0xe798('0x5'));var rp=require(_0xe798('0x6'));var fs=require('fs');var path=require(_0xe798('0x7'));var rimraf=require('rimraf');var config=require(_0xe798('0x8'));var attributes=require(_0xe798('0x9'));module[_0xe798('0xa')]=function(_0x2147d6,_0x2d57a3){return _0x2147d6[_0xe798('0xb')](_0xe798('0xc'),attributes,{'tableName':_0xe798('0xd'),'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 f4a1159..52d690a 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 _0x1d04=['where','limit','include','model','attributes','map','ShowOpenchannelQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./openchannelQueue.socket','register','then','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options'];(function(_0x1a84b1,_0x3ca6d8){var _0x161938=function(_0x44e888){while(--_0x44e888){_0x1a84b1['push'](_0x1a84b1['shift']());}};_0x161938(++_0x3ca6d8);}(_0x1d04,0xfe));var _0x41d0=function(_0x2c90c1,_0x446eda){_0x2c90c1=_0x2c90c1-0x0;var _0xcb55d4=_0x1d04[_0x2c90c1];return _0xcb55d4;};'use strict';var _=require(_0x41d0('0x0'));var util=require('util');var moment=require(_0x41d0('0x1'));var BPromise=require(_0x41d0('0x2'));var rs=require(_0x41d0('0x3'));var fs=require('fs');var Redis=require(_0x41d0('0x4'));var db=require(_0x41d0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x41d0('0x6'));var config=require(_0x41d0('0x7'));var jayson=require(_0x41d0('0x8'));var client=jayson[_0x41d0('0x9')][_0x41d0('0xa')]({'port':0x232a});config['redis']=_[_0x41d0('0xb')](config['redis'],{'host':_0x41d0('0xc'),'port':0x18eb});var socket=require(_0x41d0('0xd'))(new Redis(config[_0x41d0('0xe')]));require(_0x41d0('0xf'))[_0x41d0('0x10')](socket);function respondWithRpcPromise(_0x1119e9,_0x506084,_0x4ccf0a){return new BPromise(function(_0x5e9128,_0x1b916a){return client['request'](_0x1119e9,_0x4ccf0a)[_0x41d0('0x11')](function(_0x454afc){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x506084,_0x41d0('0x12'));logger[_0x41d0('0x13')](_0x41d0('0x14'),_0x506084,_0x41d0('0x12'),JSON[_0x41d0('0x15')](_0x454afc));if(_0x454afc[_0x41d0('0x16')]){if(_0x454afc[_0x41d0('0x16')][_0x41d0('0x17')]===0x1f4){logger[_0x41d0('0x16')](_0x41d0('0x18'),_0x506084,_0x454afc[_0x41d0('0x16')]['message']);return _0x1b916a(_0x454afc[_0x41d0('0x16')][_0x41d0('0x19')]);}logger[_0x41d0('0x16')](_0x41d0('0x18'),_0x506084,_0x454afc['error'][_0x41d0('0x19')]);return _0x5e9128(_0x454afc[_0x41d0('0x16')]['message']);}else{logger[_0x41d0('0x1a')](_0x41d0('0x18'),_0x506084,_0x41d0('0x12'));_0x5e9128(_0x454afc[_0x41d0('0x1b')][_0x41d0('0x19')]);}})[_0x41d0('0x1c')](function(_0x3ae575){logger[_0x41d0('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x506084,_0x3ae575);_0x1b916a(_0x3ae575);});});}exports[_0x41d0('0x1d')]=function(_0x277cd6){var _0x1bcd92=this;return new Promise(function(_0x32e9f5,_0x34a31d){return db[_0x41d0('0x1e')][_0x41d0('0x1f')]({'raw':_0x277cd6[_0x41d0('0x20')]?_0x277cd6[_0x41d0('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x277cd6[_0x41d0('0x20')]?_0x277cd6[_0x41d0('0x20')][_0x41d0('0x21')]||null:null,'attributes':_0x277cd6[_0x41d0('0x20')]?_0x277cd6[_0x41d0('0x20')]['attributes']||null:null,'limit':_0x277cd6[_0x41d0('0x20')]?_0x277cd6[_0x41d0('0x20')][_0x41d0('0x22')]||null:null,'include':_0x277cd6['options']?_0x277cd6['options']['include']?_['map'](_0x277cd6['options'][_0x41d0('0x23')],function(_0x4e9991){return{'model':db[_0x4e9991[_0x41d0('0x24')]],'as':_0x4e9991['as'],'attributes':_0x4e9991[_0x41d0('0x25')],'include':_0x4e9991['include']?_[_0x41d0('0x26')](_0x4e9991['include'],function(_0x285564){return{'model':db[_0x285564['model']],'as':_0x285564['as'],'attributes':_0x285564[_0x41d0('0x25')],'include':_0x285564[_0x41d0('0x23')]?_[_0x41d0('0x26')](_0x285564[_0x41d0('0x23')],function(_0x257e7c){return{'model':db[_0x257e7c['model']],'as':_0x257e7c['as'],'attributes':_0x257e7c['attributes']};}):[]};}):[]};}):[]:[]})[_0x41d0('0x11')](function(_0x573077){logger[_0x41d0('0x1a')](_0x41d0('0x1d'),_0x277cd6);logger[_0x41d0('0x13')](_0x41d0('0x1d'),_0x277cd6,JSON[_0x41d0('0x15')](_0x573077));_0x32e9f5(_0x573077);})[_0x41d0('0x1c')](function(_0x396559){logger[_0x41d0('0x16')](_0x41d0('0x1d'),_0x396559[_0x41d0('0x19')],_0x277cd6);_0x34a31d(_0x1bcd92['error'](0x1f4,_0x396559[_0x41d0('0x19')]));});});};exports[_0x41d0('0x27')]=function(_0xcb19d2){var _0x3b36ab=this;return new Promise(function(_0x250499,_0x5ca06d){return db[_0x41d0('0x1e')][_0x41d0('0x28')]({'raw':_0xcb19d2[_0x41d0('0x20')]?_0xcb19d2['options']['raw']===undefined?!![]:![]:!![],'where':_0xcb19d2[_0x41d0('0x20')]?_0xcb19d2[_0x41d0('0x20')][_0x41d0('0x21')]||null:null,'attributes':_0xcb19d2[_0x41d0('0x20')]?_0xcb19d2['options'][_0x41d0('0x25')]||null:null,'include':_0xcb19d2[_0x41d0('0x20')]?_0xcb19d2[_0x41d0('0x20')][_0x41d0('0x23')]?_[_0x41d0('0x26')](_0xcb19d2[_0x41d0('0x20')]['include'],function(_0x481c61){return{'model':db[_0x481c61[_0x41d0('0x24')]],'as':_0x481c61['as'],'attributes':_0x481c61[_0x41d0('0x25')],'include':_0x481c61['include']?_['map'](_0x481c61[_0x41d0('0x23')],function(_0x118e58){return{'model':db[_0x118e58['model']],'as':_0x118e58['as'],'attributes':_0x118e58[_0x41d0('0x25')],'include':_0x118e58['include']?_[_0x41d0('0x26')](_0x118e58['include'],function(_0x32d7a4){return{'model':db[_0x32d7a4[_0x41d0('0x24')]],'as':_0x32d7a4['as'],'attributes':_0x32d7a4[_0x41d0('0x25')]};}):[]};}):[]};}):[]:[]})[_0x41d0('0x11')](function(_0xfbfaf7){logger[_0x41d0('0x1a')](_0x41d0('0x27'),_0xcb19d2);logger[_0x41d0('0x13')](_0x41d0('0x27'),_0xcb19d2,JSON['stringify'](_0xfbfaf7));_0x250499(_0xfbfaf7);})[_0x41d0('0x1c')](function(_0x34c03a){logger[_0x41d0('0x16')]('ShowOpenchannelQueue',_0x34c03a[_0x41d0('0x19')],_0xcb19d2);_0x5ca06d(_0x3b36ab[_0x41d0('0x16')](0x1f4,_0x34c03a[_0x41d0('0x19')]));});});}; \ No newline at end of file +var _0x8793=['result','GetOpenchannelQueue','OpenchannelQueue','findAll','raw','options','where','attributes','limit','include','map','model','catch','ShowOpenchannelQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x5d0a06,_0x2f8043){var _0x2350ca=function(_0xcda60d){while(--_0xcda60d){_0x5d0a06['push'](_0x5d0a06['shift']());}};_0x2350ca(++_0x2f8043);}(_0x8793,0x89));var _0x3879=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x8793[_0xe73080];return _0x12cbc4;};'use strict';var _=require(_0x3879('0x0'));var util=require(_0x3879('0x1'));var moment=require(_0x3879('0x2'));var BPromise=require(_0x3879('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3879('0x4'));var db=require(_0x3879('0x5'))['db'];var utils=require(_0x3879('0x6'));var logger=require(_0x3879('0x7'))('rpc');var config=require(_0x3879('0x8'));var jayson=require(_0x3879('0x9'));var client=jayson[_0x3879('0xa')][_0x3879('0xb')]({'port':0x232a});config[_0x3879('0xc')]=_[_0x3879('0xd')](config['redis'],{'host':_0x3879('0xe'),'port':0x18eb});var socket=require(_0x3879('0xf'))(new Redis(config[_0x3879('0xc')]));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x525122,_0x49bd95,_0x504d81){return new BPromise(function(_0x3ce151,_0x40867f){return client[_0x3879('0x10')](_0x525122,_0x504d81)[_0x3879('0x11')](function(_0x9279f7){logger['info'](_0x3879('0x12'),_0x49bd95,'request\x20sent');logger[_0x3879('0x13')](_0x3879('0x14'),_0x49bd95,_0x3879('0x15'),JSON[_0x3879('0x16')](_0x9279f7));if(_0x9279f7[_0x3879('0x17')]){if(_0x9279f7['error'][_0x3879('0x18')]===0x1f4){logger[_0x3879('0x17')](_0x3879('0x12'),_0x49bd95,_0x9279f7[_0x3879('0x17')][_0x3879('0x19')]);return _0x40867f(_0x9279f7[_0x3879('0x17')][_0x3879('0x19')]);}logger[_0x3879('0x17')](_0x3879('0x12'),_0x49bd95,_0x9279f7[_0x3879('0x17')]['message']);return _0x3ce151(_0x9279f7[_0x3879('0x17')][_0x3879('0x19')]);}else{logger[_0x3879('0x1a')](_0x3879('0x12'),_0x49bd95,_0x3879('0x15'));_0x3ce151(_0x9279f7[_0x3879('0x1b')]['message']);}})['catch'](function(_0xb02018){logger['error'](_0x3879('0x12'),_0x49bd95,_0xb02018);_0x40867f(_0xb02018);});});}exports[_0x3879('0x1c')]=function(_0xc4ab96){var _0x2e1a22=this;return new Promise(function(_0x2df870,_0x5147c0){return db[_0x3879('0x1d')][_0x3879('0x1e')]({'raw':_0xc4ab96['options']?_0xc4ab96['options'][_0x3879('0x1f')]===undefined?!![]:![]:!![],'where':_0xc4ab96['options']?_0xc4ab96[_0x3879('0x20')][_0x3879('0x21')]||null:null,'attributes':_0xc4ab96['options']?_0xc4ab96['options'][_0x3879('0x22')]||null:null,'limit':_0xc4ab96['options']?_0xc4ab96[_0x3879('0x20')][_0x3879('0x23')]||null:null,'include':_0xc4ab96[_0x3879('0x20')]?_0xc4ab96[_0x3879('0x20')][_0x3879('0x24')]?_[_0x3879('0x25')](_0xc4ab96[_0x3879('0x20')][_0x3879('0x24')],function(_0x29882c){return{'model':db[_0x29882c[_0x3879('0x26')]],'as':_0x29882c['as'],'attributes':_0x29882c[_0x3879('0x22')],'include':_0x29882c['include']?_[_0x3879('0x25')](_0x29882c[_0x3879('0x24')],function(_0x25f0ba){return{'model':db[_0x25f0ba[_0x3879('0x26')]],'as':_0x25f0ba['as'],'attributes':_0x25f0ba[_0x3879('0x22')],'include':_0x25f0ba['include']?_[_0x3879('0x25')](_0x25f0ba[_0x3879('0x24')],function(_0x1740f5){return{'model':db[_0x1740f5[_0x3879('0x26')]],'as':_0x1740f5['as'],'attributes':_0x1740f5['attributes']};}):[]};}):[]};}):[]:[]})[_0x3879('0x11')](function(_0x10d038){logger[_0x3879('0x1a')]('GetOpenchannelQueue',_0xc4ab96);logger[_0x3879('0x13')](_0x3879('0x1c'),_0xc4ab96,JSON['stringify'](_0x10d038));_0x2df870(_0x10d038);})[_0x3879('0x27')](function(_0x39afa5){logger[_0x3879('0x17')](_0x3879('0x1c'),_0x39afa5['message'],_0xc4ab96);_0x5147c0(_0x2e1a22[_0x3879('0x17')](0x1f4,_0x39afa5[_0x3879('0x19')]));});});};exports['ShowOpenchannelQueue']=function(_0x1d1762){var _0x39673b=this;return new Promise(function(_0x5f113d,_0x4e977f){return db[_0x3879('0x1d')]['find']({'raw':_0x1d1762['options']?_0x1d1762[_0x3879('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x1d1762[_0x3879('0x20')]?_0x1d1762[_0x3879('0x20')][_0x3879('0x21')]||null:null,'attributes':_0x1d1762[_0x3879('0x20')]?_0x1d1762[_0x3879('0x20')][_0x3879('0x22')]||null:null,'include':_0x1d1762[_0x3879('0x20')]?_0x1d1762[_0x3879('0x20')][_0x3879('0x24')]?_[_0x3879('0x25')](_0x1d1762[_0x3879('0x20')][_0x3879('0x24')],function(_0x2090e0){return{'model':db[_0x2090e0[_0x3879('0x26')]],'as':_0x2090e0['as'],'attributes':_0x2090e0[_0x3879('0x22')],'include':_0x2090e0['include']?_[_0x3879('0x25')](_0x2090e0[_0x3879('0x24')],function(_0x431121){return{'model':db[_0x431121['model']],'as':_0x431121['as'],'attributes':_0x431121[_0x3879('0x22')],'include':_0x431121[_0x3879('0x24')]?_['map'](_0x431121[_0x3879('0x24')],function(_0x2f3cf0){return{'model':db[_0x2f3cf0[_0x3879('0x26')]],'as':_0x2f3cf0['as'],'attributes':_0x2f3cf0[_0x3879('0x22')]};}):[]};}):[]};}):[]:[]})[_0x3879('0x11')](function(_0x1b805f){logger[_0x3879('0x1a')](_0x3879('0x28'),_0x1d1762);logger[_0x3879('0x13')](_0x3879('0x28'),_0x1d1762,JSON[_0x3879('0x16')](_0x1b805f));_0x5f113d(_0x1b805f);})[_0x3879('0x27')](function(_0x270245){logger['error'](_0x3879('0x28'),_0x270245['message'],_0x1d1762);_0x4e977f(_0x39673b['error'](0x1f4,_0x270245['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 2542045..c97de3c 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 _0x52e0=['emit','removeListener','register','openchannelQueue:','./openchannelQueue.events','remove'];(function(_0x245f38,_0x50b39b){var _0x2e54ce=function(_0x32608c){while(--_0x32608c){_0x245f38['push'](_0x245f38['shift']());}};_0x2e54ce(++_0x50b39b);}(_0x52e0,0x10c));var _0x052e=function(_0x503a0c,_0xbc78c5){_0x503a0c=_0x503a0c-0x0;var _0x3b2e83=_0x52e0[_0x503a0c];return _0x3b2e83;};'use strict';var OpenchannelQueueEvents=require(_0x052e('0x0'));var events=['save',_0x052e('0x1'),'update'];function createListener(_0x57ae26,_0xe646eb){return function(_0x317e5a){_0xe646eb[_0x052e('0x2')](_0x57ae26,_0x317e5a);};}function removeListener(_0x5cbb93,_0x231bb4){return function(){OpenchannelQueueEvents[_0x052e('0x3')](_0x5cbb93,_0x231bb4);};}exports[_0x052e('0x4')]=function(_0x5db18c){for(var _0x108b2e=0x0,_0x23c29c=events['length'];_0x108b2e<_0x23c29c;_0x108b2e++){var _0x4792df=events[_0x108b2e];var _0x52831e=createListener(_0x052e('0x5')+_0x4792df,_0x5db18c);OpenchannelQueueEvents['on'](_0x4792df,_0x52831e);}}; \ No newline at end of file +var _0x9d5c=['save','removeListener','length','./openchannelQueue.events'];(function(_0x5ba1ef,_0x121ef4){var _0xb3f9a8=function(_0x5398eb){while(--_0x5398eb){_0x5ba1ef['push'](_0x5ba1ef['shift']());}};_0xb3f9a8(++_0x121ef4);}(_0x9d5c,0x67));var _0xc9d5=function(_0x2903f8,_0x444a03){_0x2903f8=_0x2903f8-0x0;var _0x4d757f=_0x9d5c[_0x2903f8];return _0x4d757f;};'use strict';var OpenchannelQueueEvents=require(_0xc9d5('0x0'));var events=[_0xc9d5('0x1'),'remove','update'];function createListener(_0x27fb2c,_0x17dcf2){return function(_0x56d733){_0x17dcf2['emit'](_0x27fb2c,_0x56d733);};}function removeListener(_0x19b892,_0x4bf4ff){return function(){OpenchannelQueueEvents[_0xc9d5('0x2')](_0x19b892,_0x4bf4ff);};}exports['register']=function(_0x17e5c6){for(var _0x210932=0x0,_0x112210=events[_0xc9d5('0x3')];_0x210932<_0x112210;_0x210932++){var _0x154ff4=events[_0x210932];var _0x1db574=createListener('openchannelQueue:'+_0x154ff4,_0x17e5c6);OpenchannelQueueEvents['on'](_0x154ff4,_0x1db574);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index ee9bbf9..0d91af6 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 _0xce75=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','create','put','update','delete','destroy'];(function(_0x246651,_0x358d99){var _0x1bbd82=function(_0x1eb811){while(--_0x1eb811){_0x246651['push'](_0x246651['shift']());}};_0x1bbd82(++_0x358d99);}(_0xce75,0x7e));var _0x5ce7=function(_0x4c8f2d,_0x10045d){_0x4c8f2d=_0x4c8f2d-0x0;var _0x134602=_0xce75[_0x4c8f2d];return _0x134602;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5ce7('0x0'));var timeout=require(_0x5ce7('0x1'));var express=require('express');var router=express[_0x5ce7('0x2')]();var fs_extra=require(_0x5ce7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5ce7('0x4'));var config=require(_0x5ce7('0x5'));var controller=require(_0x5ce7('0x6'));router[_0x5ce7('0x7')]('/',auth['isAuthenticated'](),controller[_0x5ce7('0x8')]);router[_0x5ce7('0x7')](_0x5ce7('0x9'),auth[_0x5ce7('0xa')](),controller[_0x5ce7('0xb')]);router[_0x5ce7('0x7')](_0x5ce7('0xc'),auth[_0x5ce7('0xa')](),controller['show']);router['post']('/',auth[_0x5ce7('0xa')](),controller[_0x5ce7('0xd')]);router[_0x5ce7('0xe')](_0x5ce7('0xc'),auth[_0x5ce7('0xa')](),controller[_0x5ce7('0xf')]);router[_0x5ce7('0x10')](_0x5ce7('0xc'),auth['isAuthenticated'](),controller[_0x5ce7('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4022=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','get','describe','/:id','show','post','update','delete','exports','util'];(function(_0x26721d,_0x448ba5){var _0x1035c5=function(_0x1c1b86){while(--_0x1c1b86){_0x26721d['push'](_0x26721d['shift']());}};_0x1035c5(++_0x448ba5);}(_0x4022,0xed));var _0x2402=function(_0x3590fc,_0x26e447){_0x3590fc=_0x3590fc-0x0;var _0x429de2=_0x4022[_0x3590fc];return _0x429de2;};'use strict';var multer=require('multer');var util=require(_0x2402('0x0'));var path=require(_0x2402('0x1'));var timeout=require(_0x2402('0x2'));var express=require(_0x2402('0x3'));var router=express['Router']();var fs_extra=require(_0x2402('0x4'));var auth=require(_0x2402('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2402('0x6'));var controller=require(_0x2402('0x7'));router['get']('/',auth[_0x2402('0x8')](),controller['index']);router[_0x2402('0x9')]('/describe',auth[_0x2402('0x8')](),controller[_0x2402('0xa')]);router['get'](_0x2402('0xb'),auth[_0x2402('0x8')](),controller[_0x2402('0xc')]);router[_0x2402('0xd')]('/',auth[_0x2402('0x8')](),controller['create']);router['put'](_0x2402('0xb'),auth[_0x2402('0x8')](),controller[_0x2402('0xe')]);router[_0x2402('0xf')](_0x2402('0xb'),auth[_0x2402('0x8')](),controller['destroy']);module[_0x2402('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index facb7a6..9931f46 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 _0xed8e=['exports','STRING','DATE','moment','sequelize'];(function(_0x221466,_0x48420b){var _0x3c2231=function(_0x396193){while(--_0x396193){_0x221466['push'](_0x221466['shift']());}};_0x3c2231(++_0x48420b);}(_0xed8e,0x14d));var _0xeed8=function(_0x545519,_0x1a2c19){_0x545519=_0x545519-0x0;var _0x2fdf94=_0xed8e[_0x545519];return _0x2fdf94;};'use strict';var moment=require(_0xeed8('0x0'));var Sequelize=require(_0xeed8('0x1'));module[_0xeed8('0x2')]={'uniqueid':{'type':Sequelize[_0xeed8('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xeed8('0x3')]},'joinAt':{'type':Sequelize[_0xeed8('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xeed8('0x4')]},'exitAt':{'type':Sequelize[_0xeed8('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd84d=['DATE','moment','exports','STRING'];(function(_0x89097f,_0x565dfb){var _0x233f38=function(_0x2c9b2a){while(--_0x2c9b2a){_0x89097f['push'](_0x89097f['shift']());}};_0x233f38(++_0x565dfb);}(_0xd84d,0x69));var _0xdd84=function(_0x1d1ebd,_0x55b797){_0x1d1ebd=_0x1d1ebd-0x0;var _0xdc271c=_0xd84d[_0x1d1ebd];return _0xdc271c;};'use strict';var moment=require(_0xdd84('0x0'));var Sequelize=require('sequelize');module[_0xdd84('0x1')]={'uniqueid':{'type':Sequelize[_0xdd84('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xdd84('0x2')]},'joinAt':{'type':Sequelize[_0xdd84('0x3')]},'leaveAt':{'type':Sequelize[_0xdd84('0x3')]},'acceptAt':{'type':Sequelize[_0xdd84('0x3')]},'exitAt':{'type':Sequelize[_0xdd84('0x3')]},'reason':{'type':Sequelize[_0xdd84('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 5aaeabc..edf4f0b 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 _0xa582=['type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','length','create','body','find','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','map','OpenchannelQueueReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter'];(function(_0x4b4f24,_0x5654a8){var _0x1c13d4=function(_0x4940bf){while(--_0x4940bf){_0x4b4f24['push'](_0x4b4f24['shift']());}};_0x1c13d4(++_0x5654a8);}(_0xa582,0xa1));var _0x2a58=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xa582[_0x7e2eb0];return _0xd92de4;};'use strict';var emlformat=require(_0x2a58('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2a58('0x1'));var jsonpatch=require(_0x2a58('0x2'));var rp=require(_0x2a58('0x3'));var moment=require(_0x2a58('0x4'));var BPromise=require(_0x2a58('0x5'));var Mustache=require('mustache');var util=require(_0x2a58('0x6'));var path=require('path');var sox=require(_0x2a58('0x7'));var csv=require(_0x2a58('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2a58('0x9'));var _=require(_0x2a58('0xa'));var squel=require('squel');var crypto=require(_0x2a58('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2a58('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2a58('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2a58('0xe'));var hardwareService=require(_0x2a58('0xf'));var logger=require(_0x2a58('0x10'))(_0x2a58('0x11'));var utils=require(_0x2a58('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x2a58('0x13'));var db=require(_0x2a58('0x14'))['db'];function respondWithStatusCode(_0x44b1d6,_0xa40db7){_0xa40db7=_0xa40db7||0xcc;return function(_0x1bf8f7){if(_0x1bf8f7){return _0x44b1d6[_0x2a58('0x15')](_0xa40db7);}return _0x44b1d6['status'](_0xa40db7)[_0x2a58('0x16')]();};}function respondWithResult(_0x40dfc8,_0x5658a2){_0x5658a2=_0x5658a2||0xc8;return function(_0x5dc21f){if(_0x5dc21f){return _0x40dfc8[_0x2a58('0x17')](_0x5658a2)[_0x2a58('0x18')](_0x5dc21f);}};}function respondWithFilteredResult(_0x38882d,_0x1a70ef){return function(_0x4c992d){if(_0x4c992d){var _0x10195e=typeof _0x1a70ef[_0x2a58('0x19')]==='undefined'&&typeof _0x1a70ef[_0x2a58('0x1a')]===_0x2a58('0x1b');var _0x49ed47=_0x4c992d[_0x2a58('0x1c')];var _0x269129=_0x10195e?0x0:_0x1a70ef['offset'];var _0x54ec34=_0x10195e?_0x4c992d['count']:_0x1a70ef[_0x2a58('0x19')]+_0x1a70ef[_0x2a58('0x1a')];var _0x779dca;if(_0x54ec34>=_0x49ed47){_0x54ec34=_0x49ed47;_0x779dca=0xc8;}else{_0x779dca=0xce;}_0x38882d[_0x2a58('0x17')](_0x779dca);return _0x38882d[_0x2a58('0x1d')](_0x2a58('0x1e'),_0x269129+'-'+_0x54ec34+'/'+_0x49ed47)[_0x2a58('0x18')](_0x4c992d);}return null;};}function patchUpdates(_0x21f3ad){return function(_0x47808b){try{jsonpatch[_0x2a58('0x1f')](_0x47808b,_0x21f3ad,!![]);}catch(_0x85e98e){return BPromise[_0x2a58('0x20')](_0x85e98e);}return _0x47808b[_0x2a58('0x21')]();};}function saveUpdates(_0x44068e,_0x42b04e){return function(_0x1514c5){if(_0x1514c5){return _0x1514c5[_0x2a58('0x22')](_0x44068e)[_0x2a58('0x23')](function(_0x15ef75){return _0x15ef75;});}return null;};}function removeEntity(_0x4639ee,_0x13bea2){return function(_0xb26a04){if(_0xb26a04){return _0xb26a04[_0x2a58('0x24')]()[_0x2a58('0x23')](function(){_0x4639ee[_0x2a58('0x17')](0xcc)[_0x2a58('0x16')]();});}};}function handleEntityNotFound(_0xf88ebc,_0x221717){return function(_0x3d51b3){if(!_0x3d51b3){_0xf88ebc['sendStatus'](0x194);}return _0x3d51b3;};}function handleError(_0x342142,_0x329f7c){_0x329f7c=_0x329f7c||0x1f4;return function(_0x5f0f61){logger['error'](_0x5f0f61[_0x2a58('0x25')]);if(_0x5f0f61[_0x2a58('0x26')]){delete _0x5f0f61[_0x2a58('0x26')];}_0x342142[_0x2a58('0x17')](_0x329f7c)['send'](_0x5f0f61);};}exports['index']=function(_0x2e7602,_0x4bab56){var _0x5ce202={},_0x30abe3={},_0x16513c={'count':0x0,'rows':[]};var _0x497b0e=_[_0x2a58('0x27')](db[_0x2a58('0x28')][_0x2a58('0x29')],function(_0x407cdd){return{'name':_0x407cdd[_0x2a58('0x2a')],'type':_0x407cdd['type'][_0x2a58('0x2b')]};});_0x30abe3[_0x2a58('0x2c')]=_[_0x2a58('0x27')](_0x497b0e,_0x2a58('0x26'));_0x30abe3[_0x2a58('0x2d')]=_[_0x2a58('0x2e')](_0x2e7602[_0x2a58('0x2d')]);_0x30abe3['filters']=_[_0x2a58('0x2f')](_0x30abe3[_0x2a58('0x2c')],_0x30abe3[_0x2a58('0x2d')]);_0x5ce202[_0x2a58('0x30')]=_[_0x2a58('0x2f')](_0x30abe3[_0x2a58('0x2c')],qs['fields'](_0x2e7602[_0x2a58('0x2d')][_0x2a58('0x31')]));_0x5ce202['attributes']=_0x5ce202[_0x2a58('0x30')]['length']?_0x5ce202[_0x2a58('0x30')]:_0x30abe3[_0x2a58('0x2c')];if(!_0x2e7602[_0x2a58('0x2d')][_0x2a58('0x32')](_0x2a58('0x33'))){_0x5ce202[_0x2a58('0x1a')]=qs[_0x2a58('0x1a')](_0x2e7602[_0x2a58('0x2d')][_0x2a58('0x1a')]);_0x5ce202[_0x2a58('0x19')]=qs['offset'](_0x2e7602[_0x2a58('0x2d')][_0x2a58('0x19')]);}_0x5ce202[_0x2a58('0x34')]=qs[_0x2a58('0x35')](_0x2e7602[_0x2a58('0x2d')][_0x2a58('0x35')]);_0x5ce202[_0x2a58('0x36')]=qs[_0x2a58('0x37')](_[_0x2a58('0x38')](_0x2e7602[_0x2a58('0x2d')],_0x30abe3[_0x2a58('0x37')]),_0x497b0e);if(_0x2e7602[_0x2a58('0x2d')][_0x2a58('0x39')]){_0x5ce202['where']=_['merge'](_0x5ce202['where'],{'$or':_[_0x2a58('0x27')](_0x497b0e,function(_0x1199a1){if(_0x1199a1[_0x2a58('0x3a')]!==_0x2a58('0x3b')){var _0x2ae72a={};_0x2ae72a[_0x1199a1[_0x2a58('0x26')]]={'$like':'%'+_0x2e7602[_0x2a58('0x2d')][_0x2a58('0x39')]+'%'};return _0x2ae72a;}})});}_0x5ce202=_[_0x2a58('0x3c')]({},_0x5ce202,_0x2e7602[_0x2a58('0x3d')]);var _0x23932f={'where':_0x5ce202['where']};return db[_0x2a58('0x28')]['count'](_0x23932f)[_0x2a58('0x23')](function(_0x39d2df){_0x16513c[_0x2a58('0x1c')]=_0x39d2df;if(_0x2e7602[_0x2a58('0x2d')][_0x2a58('0x3e')]){_0x5ce202[_0x2a58('0x3f')]=[{'all':!![]}];}return db[_0x2a58('0x28')][_0x2a58('0x40')](_0x5ce202);})['then'](function(_0x442f03){_0x16513c['rows']=_0x442f03;return _0x16513c;})['then'](respondWithFilteredResult(_0x4bab56,_0x5ce202))[_0x2a58('0x41')](handleError(_0x4bab56,null));};exports[_0x2a58('0x42')]=function(_0x57ca85,_0xc7f79a){var _0x4fb61f={'raw':!![],'where':{'id':_0x57ca85['params']['id']}},_0x5f4797={};_0x5f4797[_0x2a58('0x2c')]=_[_0x2a58('0x2e')](db['OpenchannelQueueReport'][_0x2a58('0x29')]);_0x5f4797[_0x2a58('0x2d')]=_[_0x2a58('0x2e')](_0x57ca85['query']);_0x5f4797['filters']=_[_0x2a58('0x2f')](_0x5f4797['model'],_0x5f4797['query']);_0x4fb61f['attributes']=_[_0x2a58('0x2f')](_0x5f4797[_0x2a58('0x2c')],qs[_0x2a58('0x31')](_0x57ca85['query'][_0x2a58('0x31')]));_0x4fb61f[_0x2a58('0x30')]=_0x4fb61f['attributes'][_0x2a58('0x43')]?_0x4fb61f[_0x2a58('0x30')]:_0x5f4797[_0x2a58('0x2c')];if(_0x57ca85[_0x2a58('0x2d')][_0x2a58('0x3e')]){_0x4fb61f[_0x2a58('0x3f')]=[{'all':!![]}];}_0x4fb61f=_['merge']({},_0x4fb61f,_0x57ca85[_0x2a58('0x3d')]);return db[_0x2a58('0x28')]['find'](_0x4fb61f)[_0x2a58('0x23')](handleEntityNotFound(_0xc7f79a,null))[_0x2a58('0x23')](respondWithResult(_0xc7f79a,null))[_0x2a58('0x41')](handleError(_0xc7f79a,null));};exports[_0x2a58('0x44')]=function(_0x312662,_0x203df7){return db['OpenchannelQueueReport'][_0x2a58('0x44')](_0x312662[_0x2a58('0x45')],{})[_0x2a58('0x23')](respondWithResult(_0x203df7,0xc9))['catch'](handleError(_0x203df7,null));};exports['update']=function(_0x4483d0,_0x37ffb6){if(_0x4483d0[_0x2a58('0x45')]['id']){delete _0x4483d0[_0x2a58('0x45')]['id'];}return db[_0x2a58('0x28')]['find']({'where':{'id':_0x4483d0['params']['id']}})['then'](handleEntityNotFound(_0x37ffb6,null))['then'](saveUpdates(_0x4483d0[_0x2a58('0x45')],null))[_0x2a58('0x23')](respondWithResult(_0x37ffb6,null))[_0x2a58('0x41')](handleError(_0x37ffb6,null));};exports[_0x2a58('0x24')]=function(_0x4a6ed2,_0x91855f){return db[_0x2a58('0x28')][_0x2a58('0x46')]({'where':{'id':_0x4a6ed2[_0x2a58('0x47')]['id']}})[_0x2a58('0x23')](handleEntityNotFound(_0x91855f,null))[_0x2a58('0x23')](removeEntity(_0x91855f,null))[_0x2a58('0x41')](handleError(_0x91855f,null));};exports[_0x2a58('0x48')]=function(_0x38b2db,_0x47e9be){return db[_0x2a58('0x28')]['describe']()['then'](respondWithResult(_0x47e9be,null))[_0x2a58('0x41')](handleError(_0x47e9be,null));}; \ No newline at end of file +var _0xa308=['where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','options','create','body','find','describe','eml-format','fast-json-patch','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','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','status','offset','undefined','count','Content-Range','apply','update','then','destroy','end','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','limit','order','filters','pick','filter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa308,0x171));var _0x8a30=function(_0x21f931,_0x598b2d){_0x21f931=_0x21f931-0x0;var _0x3f083c=_0xa308[_0x21f931];return _0x3f083c;};'use strict';var emlformat=require(_0x8a30('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8a30('0x1'));var rp=require('request-promise');var moment=require(_0x8a30('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8a30('0x3'));var util=require(_0x8a30('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x8a30('0x5'));var ejs=require(_0x8a30('0x6'));var fs=require('fs');var fs_extra=require(_0x8a30('0x7'));var _=require(_0x8a30('0x8'));var squel=require(_0x8a30('0x9'));var crypto=require(_0x8a30('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8a30('0xb'));var toCsv=require(_0x8a30('0x5'));var querystring=require(_0x8a30('0xc'));var Papa=require(_0x8a30('0xd'));var Redis=require(_0x8a30('0xe'));var authService=require(_0x8a30('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8a30('0x10'));var hardwareService=require(_0x8a30('0x11'));var logger=require(_0x8a30('0x12'))(_0x8a30('0x13'));var utils=require(_0x8a30('0x14'));var config=require(_0x8a30('0x15'));var licenseUtil=require(_0x8a30('0x16'));var db=require(_0x8a30('0x17'))['db'];function respondWithStatusCode(_0x4d3fc9,_0x625631){_0x625631=_0x625631||0xcc;return function(_0x28684d){if(_0x28684d){return _0x4d3fc9['sendStatus'](_0x625631);}return _0x4d3fc9['status'](_0x625631)['end']();};}function respondWithResult(_0x1555f6,_0x1d77e3){_0x1d77e3=_0x1d77e3||0xc8;return function(_0x1eb1d5){if(_0x1eb1d5){return _0x1555f6[_0x8a30('0x18')](_0x1d77e3)['json'](_0x1eb1d5);}};}function respondWithFilteredResult(_0x435c33,_0x2a8c60){return function(_0x234db9){if(_0x234db9){var _0xcd841b=typeof _0x2a8c60[_0x8a30('0x19')]===_0x8a30('0x1a')&&typeof _0x2a8c60['limit']===_0x8a30('0x1a');var _0x152d40=_0x234db9[_0x8a30('0x1b')];var _0x5edf3d=_0xcd841b?0x0:_0x2a8c60[_0x8a30('0x19')];var _0x5d794b=_0xcd841b?_0x234db9[_0x8a30('0x1b')]:_0x2a8c60[_0x8a30('0x19')]+_0x2a8c60['limit'];var _0x20b3e1;if(_0x5d794b>=_0x152d40){_0x5d794b=_0x152d40;_0x20b3e1=0xc8;}else{_0x20b3e1=0xce;}_0x435c33['status'](_0x20b3e1);return _0x435c33['set'](_0x8a30('0x1c'),_0x5edf3d+'-'+_0x5d794b+'/'+_0x152d40)['json'](_0x234db9);}return null;};}function patchUpdates(_0xe59490){return function(_0x5aa807){try{jsonpatch[_0x8a30('0x1d')](_0x5aa807,_0xe59490,!![]);}catch(_0x32ee26){return BPromise['reject'](_0x32ee26);}return _0x5aa807['save']();};}function saveUpdates(_0x365843,_0x4ee057){return function(_0x1a3ca0){if(_0x1a3ca0){return _0x1a3ca0[_0x8a30('0x1e')](_0x365843)[_0x8a30('0x1f')](function(_0x157175){return _0x157175;});}return null;};}function removeEntity(_0x29966e,_0x318018){return function(_0x111311){if(_0x111311){return _0x111311[_0x8a30('0x20')]()[_0x8a30('0x1f')](function(){_0x29966e[_0x8a30('0x18')](0xcc)[_0x8a30('0x21')]();});}};}function handleEntityNotFound(_0x591258,_0x2d0735){return function(_0x3e08c0){if(!_0x3e08c0){_0x591258['sendStatus'](0x194);}return _0x3e08c0;};}function handleError(_0x3573b6,_0x5e366d){_0x5e366d=_0x5e366d||0x1f4;return function(_0x39a780){logger[_0x8a30('0x22')](_0x39a780[_0x8a30('0x23')]);if(_0x39a780[_0x8a30('0x24')]){delete _0x39a780[_0x8a30('0x24')];}_0x3573b6[_0x8a30('0x18')](_0x5e366d)[_0x8a30('0x25')](_0x39a780);};}exports[_0x8a30('0x26')]=function(_0x9115c4,_0x4754db){var _0x5a59c5={},_0x4bbc6b={},_0x166145={'count':0x0,'rows':[]};var _0x127d36=_[_0x8a30('0x27')](db[_0x8a30('0x28')][_0x8a30('0x29')],function(_0x4b2c9b){return{'name':_0x4b2c9b[_0x8a30('0x2a')],'type':_0x4b2c9b[_0x8a30('0x2b')][_0x8a30('0x2c')]};});_0x4bbc6b[_0x8a30('0x2d')]=_[_0x8a30('0x27')](_0x127d36,'name');_0x4bbc6b[_0x8a30('0x2e')]=_[_0x8a30('0x2f')](_0x9115c4['query']);_0x4bbc6b['filters']=_[_0x8a30('0x30')](_0x4bbc6b['model'],_0x4bbc6b['query']);_0x5a59c5[_0x8a30('0x31')]=_['intersection'](_0x4bbc6b['model'],qs[_0x8a30('0x32')](_0x9115c4[_0x8a30('0x2e')][_0x8a30('0x32')]));_0x5a59c5[_0x8a30('0x31')]=_0x5a59c5[_0x8a30('0x31')][_0x8a30('0x33')]?_0x5a59c5[_0x8a30('0x31')]:_0x4bbc6b[_0x8a30('0x2d')];if(!_0x9115c4[_0x8a30('0x2e')]['hasOwnProperty']('nolimit')){_0x5a59c5['limit']=qs[_0x8a30('0x34')](_0x9115c4['query'][_0x8a30('0x34')]);_0x5a59c5[_0x8a30('0x19')]=qs[_0x8a30('0x19')](_0x9115c4[_0x8a30('0x2e')][_0x8a30('0x19')]);}_0x5a59c5[_0x8a30('0x35')]=qs['sort'](_0x9115c4[_0x8a30('0x2e')]['sort']);_0x5a59c5['where']=qs[_0x8a30('0x36')](_[_0x8a30('0x37')](_0x9115c4['query'],_0x4bbc6b[_0x8a30('0x36')]),_0x127d36);if(_0x9115c4[_0x8a30('0x2e')][_0x8a30('0x38')]){_0x5a59c5[_0x8a30('0x39')]=_[_0x8a30('0x3a')](_0x5a59c5[_0x8a30('0x39')],{'$or':_[_0x8a30('0x27')](_0x127d36,function(_0x261d45){if(_0x261d45[_0x8a30('0x2b')]!==_0x8a30('0x3b')){var _0x1a0be2={};_0x1a0be2[_0x261d45['name']]={'$like':'%'+_0x9115c4[_0x8a30('0x2e')][_0x8a30('0x38')]+'%'};return _0x1a0be2;}})});}_0x5a59c5=_[_0x8a30('0x3a')]({},_0x5a59c5,_0x9115c4['options']);var _0x25bdc4={'where':_0x5a59c5[_0x8a30('0x39')]};return db[_0x8a30('0x28')]['count'](_0x25bdc4)[_0x8a30('0x1f')](function(_0xd15e2f){_0x166145[_0x8a30('0x1b')]=_0xd15e2f;if(_0x9115c4['query'][_0x8a30('0x3c')]){_0x5a59c5['include']=[{'all':!![]}];}return db[_0x8a30('0x28')][_0x8a30('0x3d')](_0x5a59c5);})[_0x8a30('0x1f')](function(_0x524ffe){_0x166145[_0x8a30('0x3e')]=_0x524ffe;return _0x166145;})[_0x8a30('0x1f')](respondWithFilteredResult(_0x4754db,_0x5a59c5))[_0x8a30('0x3f')](handleError(_0x4754db,null));};exports[_0x8a30('0x40')]=function(_0x3fe7bc,_0x191441){var _0x28effe={'raw':!![],'where':{'id':_0x3fe7bc[_0x8a30('0x41')]['id']}},_0x51e5c3={};_0x51e5c3[_0x8a30('0x2d')]=_[_0x8a30('0x2f')](db[_0x8a30('0x28')][_0x8a30('0x29')]);_0x51e5c3[_0x8a30('0x2e')]=_['keys'](_0x3fe7bc[_0x8a30('0x2e')]);_0x51e5c3[_0x8a30('0x36')]=_[_0x8a30('0x30')](_0x51e5c3[_0x8a30('0x2d')],_0x51e5c3[_0x8a30('0x2e')]);_0x28effe[_0x8a30('0x31')]=_[_0x8a30('0x30')](_0x51e5c3[_0x8a30('0x2d')],qs[_0x8a30('0x32')](_0x3fe7bc['query'][_0x8a30('0x32')]));_0x28effe[_0x8a30('0x31')]=_0x28effe[_0x8a30('0x31')][_0x8a30('0x33')]?_0x28effe[_0x8a30('0x31')]:_0x51e5c3[_0x8a30('0x2d')];if(_0x3fe7bc[_0x8a30('0x2e')][_0x8a30('0x3c')]){_0x28effe['include']=[{'all':!![]}];}_0x28effe=_[_0x8a30('0x3a')]({},_0x28effe,_0x3fe7bc[_0x8a30('0x42')]);return db['OpenchannelQueueReport']['find'](_0x28effe)['then'](handleEntityNotFound(_0x191441,null))[_0x8a30('0x1f')](respondWithResult(_0x191441,null))[_0x8a30('0x3f')](handleError(_0x191441,null));};exports[_0x8a30('0x43')]=function(_0x2caa5b,_0x4bdb76){return db['OpenchannelQueueReport']['create'](_0x2caa5b[_0x8a30('0x44')],{})[_0x8a30('0x1f')](respondWithResult(_0x4bdb76,0xc9))[_0x8a30('0x3f')](handleError(_0x4bdb76,null));};exports[_0x8a30('0x1e')]=function(_0x17d8b2,_0x47ab9f){if(_0x17d8b2[_0x8a30('0x44')]['id']){delete _0x17d8b2[_0x8a30('0x44')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x17d8b2['params']['id']}})[_0x8a30('0x1f')](handleEntityNotFound(_0x47ab9f,null))[_0x8a30('0x1f')](saveUpdates(_0x17d8b2[_0x8a30('0x44')],null))['then'](respondWithResult(_0x47ab9f,null))[_0x8a30('0x3f')](handleError(_0x47ab9f,null));};exports[_0x8a30('0x20')]=function(_0x4c800d,_0x54a6c0){return db[_0x8a30('0x28')][_0x8a30('0x45')]({'where':{'id':_0x4c800d[_0x8a30('0x41')]['id']}})[_0x8a30('0x1f')](handleEntityNotFound(_0x54a6c0,null))[_0x8a30('0x1f')](removeEntity(_0x54a6c0,null))[_0x8a30('0x3f')](handleError(_0x54a6c0,null));};exports[_0x8a30('0x46')]=function(_0x3aefb7,_0xc9e511){return db[_0x8a30('0x28')][_0x8a30('0x46')]()[_0x8a30('0x1f')](respondWithResult(_0xc9e511,null))[_0x8a30('0x3f')](handleError(_0xc9e511,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 19003bb..96eb263 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 _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x54458e,_0x10c0eb){var _0x153788=function(_0x1ab866){while(--_0x1ab866){_0x54458e['push'](_0x54458e['shift']());}};_0x153788(++_0x10c0eb);}(_0x1261,0x144));var _0x1126=function(_0x4fa665,_0x1ae12a){_0x4fa665=_0x4fa665-0x0;var _0x62ccff=_0x1261[_0x4fa665];return _0x62ccff;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x96f74c,_0xfc30a4){var _0x379222=function(_0x1bbde9){while(--_0x1bbde9){_0x96f74c['push'](_0x96f74c['shift']());}};_0x379222(++_0xfc30a4);}(_0x814b,0x1a2));var _0xb814=function(_0x17823f,_0xffd807){_0x17823f=_0x17823f-0x0;var _0x51fc21=_0x814b[_0x17823f];return _0x51fc21;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 3569b7e..cf96425 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 _0x34b7=['create','body','options','raw','then','UpdateOpenchannelQueueReport','update','where','attributes','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport'];(function(_0x29291b,_0x25c06c){var _0xd53329=function(_0x27044e){while(--_0x27044e){_0x29291b['push'](_0x29291b['shift']());}};_0xd53329(++_0x25c06c);}(_0x34b7,0x196));var _0x734b=function(_0x3cc751,_0x38b8ff){_0x3cc751=_0x3cc751-0x0;var _0x3956a2=_0x34b7[_0x3cc751];return _0x3956a2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x734b('0x0'));var BPromise=require(_0x734b('0x1'));var rs=require(_0x734b('0x2'));var fs=require('fs');var Redis=require(_0x734b('0x3'));var db=require(_0x734b('0x4'))['db'];var utils=require(_0x734b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x734b('0x6'));var jayson=require(_0x734b('0x7'));var client=jayson[_0x734b('0x8')][_0x734b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28918a,_0x35d685,_0x58e2f1){return new BPromise(function(_0x1eb803,_0x2e7932){return client['request'](_0x28918a,_0x58e2f1)['then'](function(_0x5f4b3a){logger[_0x734b('0xa')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x35d685,_0x734b('0xb'));logger[_0x734b('0xc')](_0x734b('0xd'),_0x35d685,_0x734b('0xb'),JSON[_0x734b('0xe')](_0x5f4b3a));if(_0x5f4b3a[_0x734b('0xf')]){if(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x10')]===0x1f4){logger[_0x734b('0xf')](_0x734b('0x11'),_0x35d685,_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);return _0x2e7932(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);}logger['error'](_0x734b('0x11'),_0x35d685,_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);return _0x1eb803(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);}else{logger[_0x734b('0xa')](_0x734b('0x11'),_0x35d685,_0x734b('0xb'));_0x1eb803(_0x5f4b3a[_0x734b('0x13')][_0x734b('0x12')]);}})[_0x734b('0x14')](function(_0x4d2d23){logger[_0x734b('0xf')](_0x734b('0x11'),_0x35d685,_0x4d2d23);_0x2e7932(_0x4d2d23);});});}exports[_0x734b('0x15')]=function(_0x5edbe9){var _0x4d3b9c=this;return new Promise(function(_0x56a95c,_0xcd12a1){return db[_0x734b('0x16')][_0x734b('0x17')](_0x5edbe9[_0x734b('0x18')],{'raw':_0x5edbe9[_0x734b('0x19')]?_0x5edbe9[_0x734b('0x19')][_0x734b('0x1a')]===undefined?!![]:![]:!![]})[_0x734b('0x1b')](function(_0x67eed){logger[_0x734b('0xa')](_0x734b('0x15'),_0x5edbe9);logger[_0x734b('0xc')](_0x734b('0x15'),_0x5edbe9,JSON[_0x734b('0xe')](_0x67eed));_0x56a95c(_0x67eed);})['catch'](function(_0x1e4dcc){logger[_0x734b('0xf')]('CreateOpenchannelQueueReport',_0x1e4dcc[_0x734b('0x12')],_0x5edbe9);_0xcd12a1(_0x4d3b9c[_0x734b('0xf')](0x1f4,_0x1e4dcc[_0x734b('0x12')]));});});};exports[_0x734b('0x1c')]=function(_0x46d432){var _0x26d118=this;return new Promise(function(_0x26eccf,_0x104fff){return db[_0x734b('0x16')][_0x734b('0x1d')](_0x46d432[_0x734b('0x18')],{'raw':_0x46d432[_0x734b('0x19')]?_0x46d432[_0x734b('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46d432['options']?_0x46d432[_0x734b('0x19')][_0x734b('0x1e')]||null:null,'attributes':_0x46d432['options']?_0x46d432[_0x734b('0x19')][_0x734b('0x1f')]||null:null,'limit':_0x46d432[_0x734b('0x19')]?_0x46d432[_0x734b('0x19')][_0x734b('0x20')]||null:null})[_0x734b('0x1b')](function(_0x3ba39c){logger['info'](_0x734b('0x1c'),_0x46d432);logger[_0x734b('0xc')](_0x734b('0x1c'),_0x46d432,JSON[_0x734b('0xe')](_0x3ba39c));_0x26eccf(_0x3ba39c);})[_0x734b('0x14')](function(_0x427c36){logger[_0x734b('0xf')](_0x734b('0x1c'),_0x427c36[_0x734b('0x12')],_0x46d432);_0x104fff(_0x26d118[_0x734b('0xf')](0x1f4,_0x427c36['message']));});});}; \ No newline at end of file +var _0xfcbb=['body','raw','where','attributes','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','UpdateOpenchannelQueueReport','update'];(function(_0x398483,_0x2cbf55){var _0xe1b3d5=function(_0x38623b){while(--_0x38623b){_0x398483['push'](_0x398483['shift']());}};_0xe1b3d5(++_0x2cbf55);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x18f54a,_0x3af323){_0x18f54a=_0x18f54a-0x0;var _0x154f3f=_0xfcbb[_0x18f54a];return _0x154f3f;};'use strict';var _=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var moment=require(_0xbfcb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfcb('0x3'));var db=require(_0xbfcb('0x4'))['db'];var utils=require(_0xbfcb('0x5'));var logger=require(_0xbfcb('0x6'))(_0xbfcb('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbfcb('0x8')][_0xbfcb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8d4e6a,_0x2df839,_0x288ee5){return new BPromise(function(_0x2f875c,_0x49717b){return client['request'](_0x8d4e6a,_0x288ee5)[_0xbfcb('0xa')](function(_0x331173){logger[_0xbfcb('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2df839,_0xbfcb('0xc'));logger[_0xbfcb('0xd')](_0xbfcb('0xe'),_0x2df839,_0xbfcb('0xc'),JSON[_0xbfcb('0xf')](_0x331173));if(_0x331173[_0xbfcb('0x10')]){if(_0x331173['error'][_0xbfcb('0x11')]===0x1f4){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')]['message']);return _0x49717b(_0x331173[_0xbfcb('0x10')]['message']);}logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);return _0x2f875c(_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);}else{logger[_0xbfcb('0xb')](_0xbfcb('0x12'),_0x2df839,_0xbfcb('0xc'));_0x2f875c(_0x331173[_0xbfcb('0x14')][_0xbfcb('0x13')]);}})[_0xbfcb('0x15')](function(_0x26f335){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x26f335);_0x49717b(_0x26f335);});});}exports[_0xbfcb('0x16')]=function(_0xba1d6){var _0x38689e=this;return new Promise(function(_0x3404aa,_0x46b8d2){return db[_0xbfcb('0x17')][_0xbfcb('0x18')](_0xba1d6['body'],{'raw':_0xba1d6[_0xbfcb('0x19')]?_0xba1d6[_0xbfcb('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xbfcb('0xa')](function(_0x1a7225){logger['info']('CreateOpenchannelQueueReport',_0xba1d6);logger[_0xbfcb('0xd')](_0xbfcb('0x16'),_0xba1d6,JSON[_0xbfcb('0xf')](_0x1a7225));_0x3404aa(_0x1a7225);})[_0xbfcb('0x15')](function(_0x1c5924){logger['error'](_0xbfcb('0x16'),_0x1c5924[_0xbfcb('0x13')],_0xba1d6);_0x46b8d2(_0x38689e[_0xbfcb('0x10')](0x1f4,_0x1c5924[_0xbfcb('0x13')]));});});};exports[_0xbfcb('0x1a')]=function(_0x19616c){var _0x69c8e9=this;return new Promise(function(_0x14e43c,_0x11f6f7){return db[_0xbfcb('0x17')][_0xbfcb('0x1b')](_0x19616c[_0xbfcb('0x1c')],{'raw':_0x19616c[_0xbfcb('0x19')]?_0x19616c[_0xbfcb('0x19')][_0xbfcb('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19616c[_0xbfcb('0x19')]?_0x19616c['options'][_0xbfcb('0x1e')]||null:null,'attributes':_0x19616c[_0xbfcb('0x19')]?_0x19616c['options'][_0xbfcb('0x1f')]||null:null,'limit':_0x19616c[_0xbfcb('0x19')]?_0x19616c[_0xbfcb('0x19')][_0xbfcb('0x20')]||null:null})[_0xbfcb('0xa')](function(_0x3542e9){logger[_0xbfcb('0xb')](_0xbfcb('0x1a'),_0x19616c);logger[_0xbfcb('0xd')](_0xbfcb('0x1a'),_0x19616c,JSON['stringify'](_0x3542e9));_0x14e43c(_0x3542e9);})[_0xbfcb('0x15')](function(_0x3aa3cd){logger[_0xbfcb('0x10')](_0xbfcb('0x1a'),_0x3aa3cd[_0xbfcb('0x13')],_0x19616c);_0x11f6f7(_0x69c8e9[_0xbfcb('0x10')](0x1f4,_0x3aa3cd[_0xbfcb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index df0799b..f805992 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 _0x1126=['delete','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','index','describe','/:id','isAuthenticated','show','post','update'];(function(_0x39f097,_0x17116b){var _0x544f6a=function(_0x457caf){while(--_0x457caf){_0x39f097['push'](_0x39f097['shift']());}};_0x544f6a(++_0x17116b);}(_0x1126,0xed));var _0x6112=function(_0x1181f3,_0xf81baa){_0x1181f3=_0x1181f3-0x0;var _0x37abb6=_0x1126[_0x1181f3];return _0x37abb6;};'use strict';var multer=require(_0x6112('0x0'));var util=require(_0x6112('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6112('0x2'));var router=express['Router']();var fs_extra=require(_0x6112('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6112('0x4'));var config=require(_0x6112('0x5'));var controller=require(_0x6112('0x6'));router[_0x6112('0x7')]('/',auth['isAuthenticated'](),controller[_0x6112('0x8')]);router[_0x6112('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x6112('0x9')]);router[_0x6112('0x7')](_0x6112('0xa'),auth[_0x6112('0xb')](),controller[_0x6112('0xc')]);router[_0x6112('0xd')]('/',auth[_0x6112('0xb')](),controller['create']);router['put'](_0x6112('0xa'),auth[_0x6112('0xb')](),controller[_0x6112('0xe')]);router[_0x6112('0xf')](_0x6112('0xa'),auth[_0x6112('0xb')](),controller[_0x6112('0x10')]);module[_0x6112('0x11')]=router; \ No newline at end of file +var _0x64d2=['get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','path','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelTransferReport.controller'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x64d2,0x162));var _0x264d=function(_0x59db19,_0x30c1c6){_0x59db19=_0x59db19-0x0;var _0x5f0f09=_0x64d2[_0x59db19];return _0x5f0f09;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x264d('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x264d('0x1')]();var fs_extra=require(_0x264d('0x2'));var auth=require(_0x264d('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x264d('0x4'));var controller=require(_0x264d('0x5'));router[_0x264d('0x6')]('/',auth[_0x264d('0x7')](),controller[_0x264d('0x8')]);router[_0x264d('0x6')](_0x264d('0x9'),auth[_0x264d('0x7')](),controller[_0x264d('0xa')]);router[_0x264d('0x6')](_0x264d('0xb'),auth[_0x264d('0x7')](),controller['show']);router[_0x264d('0xc')]('/',auth[_0x264d('0x7')](),controller[_0x264d('0xd')]);router[_0x264d('0xe')](_0x264d('0xb'),auth[_0x264d('0x7')](),controller[_0x264d('0xf')]);router[_0x264d('0x10')](_0x264d('0xb'),auth[_0x264d('0x7')](),controller[_0x264d('0x11')]);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 bebbe4a..5d7d67f 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x20a21c,_0x1f66f8){var _0x5459e6=function(_0x30b917){while(--_0x30b917){_0x20a21c['push'](_0x20a21c['shift']());}};_0x5459e6(++_0x1f66f8);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x56ee15,_0x1effd1){_0x56ee15=_0x56ee15-0x0;var _0x94991f=_0xf3cd[_0x56ee15];return _0x94991f;};'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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0xe7625d,_0x4dc922){var _0x31c7c9=function(_0x7c3531){while(--_0x7c3531){_0xe7625d['push'](_0xe7625d['shift']());}};_0x31c7c9(++_0x4dc922);}(_0x70e0,0x17b));var _0x070e=function(_0x357f44,_0x3eb92c){_0x357f44=_0x357f44-0x0;var _0x2c86da=_0x70e0[_0x357f44];return _0x2c86da;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index d04b493..9670db3 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 _0x432f=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','update','describe','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','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','limit','count','set','reject','then','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query'];(function(_0x5b46e9,_0xa28a59){var _0x2b1d78=function(_0x441885){while(--_0x441885){_0x5b46e9['push'](_0x5b46e9['shift']());}};_0x2b1d78(++_0xa28a59);}(_0x432f,0xaf));var _0xf432=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x432f[_0x56482c];return _0x5aae7a;};'use strict';var emlformat=require(_0xf432('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf432('0x1'));var jsonpatch=require(_0xf432('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf432('0x3'));var Mustache=require('mustache');var util=require(_0xf432('0x4'));var path=require(_0xf432('0x5'));var sox=require(_0xf432('0x6'));var csv=require(_0xf432('0x7'));var ejs=require(_0xf432('0x8'));var fs=require('fs');var fs_extra=require(_0xf432('0x9'));var _=require('lodash');var squel=require(_0xf432('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf432('0xb'));var toCsv=require(_0xf432('0x7'));var querystring=require(_0xf432('0xc'));var Papa=require(_0xf432('0xd'));var Redis=require(_0xf432('0xe'));var authService=require(_0xf432('0xf'));var qs=require(_0xf432('0x10'));var as=require(_0xf432('0x11'));var hardwareService=require(_0xf432('0x12'));var logger=require(_0xf432('0x13'))(_0xf432('0x14'));var utils=require('../../config/utils');var config=require(_0xf432('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b3f56,_0x4db4f7){_0x4db4f7=_0x4db4f7||0xcc;return function(_0x415e02){if(_0x415e02){return _0x1b3f56[_0xf432('0x16')](_0x4db4f7);}return _0x1b3f56[_0xf432('0x17')](_0x4db4f7)[_0xf432('0x18')]();};}function respondWithResult(_0x1c2bdd,_0x2621a4){_0x2621a4=_0x2621a4||0xc8;return function(_0x7c89cd){if(_0x7c89cd){return _0x1c2bdd[_0xf432('0x17')](_0x2621a4)[_0xf432('0x19')](_0x7c89cd);}};}function respondWithFilteredResult(_0x205088,_0x2ba0d9){return function(_0x55ecc0){if(_0x55ecc0){var _0x3bd97e=typeof _0x2ba0d9[_0xf432('0x1a')]===_0xf432('0x1b')&&typeof _0x2ba0d9[_0xf432('0x1c')]===_0xf432('0x1b');var _0xce18cd=_0x55ecc0[_0xf432('0x1d')];var _0x30ef7c=_0x3bd97e?0x0:_0x2ba0d9[_0xf432('0x1a')];var _0x32bf74=_0x3bd97e?_0x55ecc0[_0xf432('0x1d')]:_0x2ba0d9[_0xf432('0x1a')]+_0x2ba0d9[_0xf432('0x1c')];var _0x2436fd;if(_0x32bf74>=_0xce18cd){_0x32bf74=_0xce18cd;_0x2436fd=0xc8;}else{_0x2436fd=0xce;}_0x205088['status'](_0x2436fd);return _0x205088[_0xf432('0x1e')]('Content-Range',_0x30ef7c+'-'+_0x32bf74+'/'+_0xce18cd)[_0xf432('0x19')](_0x55ecc0);}return null;};}function patchUpdates(_0x4ea224){return function(_0x5376d2){try{jsonpatch['apply'](_0x5376d2,_0x4ea224,!![]);}catch(_0x279e0e){return BPromise[_0xf432('0x1f')](_0x279e0e);}return _0x5376d2['save']();};}function saveUpdates(_0x26f66b,_0x10bb73){return function(_0x5b7f38){if(_0x5b7f38){return _0x5b7f38['update'](_0x26f66b)[_0xf432('0x20')](function(_0x2e3fda){return _0x2e3fda;});}return null;};}function removeEntity(_0x304ff4,_0x3d47ca){return function(_0xb93b5d){if(_0xb93b5d){return _0xb93b5d[_0xf432('0x21')]()[_0xf432('0x20')](function(){_0x304ff4[_0xf432('0x17')](0xcc)[_0xf432('0x18')]();});}};}function handleEntityNotFound(_0x26fa79,_0x58f8b8){return function(_0x3b3ab5){if(!_0x3b3ab5){_0x26fa79[_0xf432('0x16')](0x194);}return _0x3b3ab5;};}function handleError(_0xba4b47,_0x3692b5){_0x3692b5=_0x3692b5||0x1f4;return function(_0x5aa288){logger[_0xf432('0x22')](_0x5aa288[_0xf432('0x23')]);if(_0x5aa288[_0xf432('0x24')]){delete _0x5aa288[_0xf432('0x24')];}_0xba4b47[_0xf432('0x17')](_0x3692b5)[_0xf432('0x25')](_0x5aa288);};}exports[_0xf432('0x26')]=function(_0x58260f,_0x18bee9){var _0x22355a={},_0x4c8188={},_0x372a94={'count':0x0,'rows':[]};var _0x4db524=_[_0xf432('0x27')](db[_0xf432('0x28')][_0xf432('0x29')],function(_0x291bf6){return{'name':_0x291bf6[_0xf432('0x2a')],'type':_0x291bf6[_0xf432('0x2b')][_0xf432('0x2c')]};});_0x4c8188[_0xf432('0x2d')]=_[_0xf432('0x27')](_0x4db524,_0xf432('0x24'));_0x4c8188[_0xf432('0x2e')]=_[_0xf432('0x2f')](_0x58260f['query']);_0x4c8188[_0xf432('0x30')]=_[_0xf432('0x31')](_0x4c8188[_0xf432('0x2d')],_0x4c8188[_0xf432('0x2e')]);_0x22355a[_0xf432('0x32')]=_['intersection'](_0x4c8188[_0xf432('0x2d')],qs[_0xf432('0x33')](_0x58260f[_0xf432('0x2e')][_0xf432('0x33')]));_0x22355a[_0xf432('0x32')]=_0x22355a[_0xf432('0x32')][_0xf432('0x34')]?_0x22355a[_0xf432('0x32')]:_0x4c8188['model'];if(!_0x58260f[_0xf432('0x2e')][_0xf432('0x35')](_0xf432('0x36'))){_0x22355a['limit']=qs['limit'](_0x58260f[_0xf432('0x2e')][_0xf432('0x1c')]);_0x22355a['offset']=qs['offset'](_0x58260f[_0xf432('0x2e')]['offset']);}_0x22355a[_0xf432('0x37')]=qs['sort'](_0x58260f[_0xf432('0x2e')]['sort']);_0x22355a['where']=qs[_0xf432('0x30')](_[_0xf432('0x38')](_0x58260f[_0xf432('0x2e')],_0x4c8188[_0xf432('0x30')]),_0x4db524);if(_0x58260f[_0xf432('0x2e')][_0xf432('0x39')]){_0x22355a[_0xf432('0x3a')]=_[_0xf432('0x3b')](_0x22355a['where'],{'$or':_['map'](_0x4db524,function(_0x31a79e){if(_0x31a79e[_0xf432('0x2b')]!==_0xf432('0x3c')){var _0x536546={};_0x536546[_0x31a79e['name']]={'$like':'%'+_0x58260f[_0xf432('0x2e')][_0xf432('0x39')]+'%'};return _0x536546;}})});}_0x22355a=_[_0xf432('0x3b')]({},_0x22355a,_0x58260f['options']);var _0x579053={'where':_0x22355a['where']};return db['OpenchannelTransferReport']['count'](_0x579053)[_0xf432('0x20')](function(_0x56f2b7){_0x372a94[_0xf432('0x1d')]=_0x56f2b7;if(_0x58260f[_0xf432('0x2e')][_0xf432('0x3d')]){_0x22355a[_0xf432('0x3e')]=[{'all':!![]}];}return db[_0xf432('0x28')][_0xf432('0x3f')](_0x22355a);})[_0xf432('0x20')](function(_0x4cf2da){_0x372a94[_0xf432('0x40')]=_0x4cf2da;return _0x372a94;})[_0xf432('0x20')](respondWithFilteredResult(_0x18bee9,_0x22355a))['catch'](handleError(_0x18bee9,null));};exports[_0xf432('0x41')]=function(_0x241552,_0x51b93a){var _0x3d55f9={'raw':!![],'where':{'id':_0x241552[_0xf432('0x42')]['id']}},_0x2964de={};_0x2964de[_0xf432('0x2d')]=_[_0xf432('0x2f')](db['OpenchannelTransferReport'][_0xf432('0x29')]);_0x2964de[_0xf432('0x2e')]=_[_0xf432('0x2f')](_0x241552[_0xf432('0x2e')]);_0x2964de[_0xf432('0x30')]=_[_0xf432('0x31')](_0x2964de[_0xf432('0x2d')],_0x2964de[_0xf432('0x2e')]);_0x3d55f9[_0xf432('0x32')]=_['intersection'](_0x2964de['model'],qs[_0xf432('0x33')](_0x241552[_0xf432('0x2e')][_0xf432('0x33')]));_0x3d55f9[_0xf432('0x32')]=_0x3d55f9['attributes'][_0xf432('0x34')]?_0x3d55f9[_0xf432('0x32')]:_0x2964de[_0xf432('0x2d')];if(_0x241552[_0xf432('0x2e')]['includeAll']){_0x3d55f9['include']=[{'all':!![]}];}_0x3d55f9=_[_0xf432('0x3b')]({},_0x3d55f9,_0x241552[_0xf432('0x43')]);return db['OpenchannelTransferReport'][_0xf432('0x44')](_0x3d55f9)[_0xf432('0x20')](handleEntityNotFound(_0x51b93a,null))[_0xf432('0x20')](respondWithResult(_0x51b93a,null))[_0xf432('0x45')](handleError(_0x51b93a,null));};exports[_0xf432('0x46')]=function(_0x222da2,_0x1ba45c){return db['OpenchannelTransferReport'][_0xf432('0x46')](_0x222da2[_0xf432('0x47')],{})[_0xf432('0x20')](respondWithResult(_0x1ba45c,0xc9))['catch'](handleError(_0x1ba45c,null));};exports[_0xf432('0x48')]=function(_0x5d4d1f,_0x329557){if(_0x5d4d1f[_0xf432('0x47')]['id']){delete _0x5d4d1f[_0xf432('0x47')]['id'];}return db[_0xf432('0x28')][_0xf432('0x44')]({'where':{'id':_0x5d4d1f[_0xf432('0x42')]['id']}})[_0xf432('0x20')](handleEntityNotFound(_0x329557,null))[_0xf432('0x20')](saveUpdates(_0x5d4d1f[_0xf432('0x47')],null))[_0xf432('0x20')](respondWithResult(_0x329557,null))[_0xf432('0x45')](handleError(_0x329557,null));};exports['destroy']=function(_0x2a4ba8,_0x42db21){return db[_0xf432('0x28')][_0xf432('0x44')]({'where':{'id':_0x2a4ba8['params']['id']}})[_0xf432('0x20')](handleEntityNotFound(_0x42db21,null))[_0xf432('0x20')](removeEntity(_0x42db21,null))['catch'](handleError(_0x42db21,null));};exports[_0xf432('0x49')]=function(_0x83808d,_0x5b5ee2){return db[_0xf432('0x28')][_0xf432('0x49')]()[_0xf432('0x20')](respondWithResult(_0x5b5ee2,null))['catch'](handleError(_0x5b5ee2,null));}; \ No newline at end of file +var _0xd9c4=['apply','reject','save','then','destroy','error','stack','name','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x32b750,_0x2e914a){var _0x1cc809=function(_0x33f598){while(--_0x33f598){_0x32b750['push'](_0x32b750['shift']());}};_0x1cc809(++_0x2e914a);}(_0xd9c4,0x162));var _0x4d9c=function(_0x26b8b5,_0xf5c2c1){_0x26b8b5=_0x26b8b5-0x0;var _0x2150a9=_0xd9c4[_0x26b8b5];return _0x2150a9;};'use strict';var emlformat=require(_0x4d9c('0x0'));var rimraf=require(_0x4d9c('0x1'));var zipdir=require(_0x4d9c('0x2'));var jsonpatch=require(_0x4d9c('0x3'));var rp=require(_0x4d9c('0x4'));var moment=require(_0x4d9c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4d9c('0x6'));var path=require('path');var sox=require(_0x4d9c('0x7'));var csv=require(_0x4d9c('0x8'));var ejs=require(_0x4d9c('0x9'));var fs=require('fs');var fs_extra=require(_0x4d9c('0xa'));var _=require('lodash');var squel=require(_0x4d9c('0xb'));var crypto=require(_0x4d9c('0xc'));var jsforce=require(_0x4d9c('0xd'));var deskjs=require(_0x4d9c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4d9c('0xf'));var Papa=require(_0x4d9c('0x10'));var Redis=require(_0x4d9c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4d9c('0x12'));var as=require(_0x4d9c('0x13'));var hardwareService=require(_0x4d9c('0x14'));var logger=require(_0x4d9c('0x15'))(_0x4d9c('0x16'));var utils=require('../../config/utils');var config=require(_0x4d9c('0x17'));var licenseUtil=require(_0x4d9c('0x18'));var db=require(_0x4d9c('0x19'))['db'];function respondWithStatusCode(_0x26c04b,_0x4cc37a){_0x4cc37a=_0x4cc37a||0xcc;return function(_0xb1d6e5){if(_0xb1d6e5){return _0x26c04b[_0x4d9c('0x1a')](_0x4cc37a);}return _0x26c04b[_0x4d9c('0x1b')](_0x4cc37a)[_0x4d9c('0x1c')]();};}function respondWithResult(_0x3d9216,_0x26ff44){_0x26ff44=_0x26ff44||0xc8;return function(_0x4b2d44){if(_0x4b2d44){return _0x3d9216[_0x4d9c('0x1b')](_0x26ff44)[_0x4d9c('0x1d')](_0x4b2d44);}};}function respondWithFilteredResult(_0x3bb994,_0x2c7159){return function(_0x1b2ca5){if(_0x1b2ca5){var _0x1c8de5=typeof _0x2c7159[_0x4d9c('0x1e')]===_0x4d9c('0x1f')&&typeof _0x2c7159[_0x4d9c('0x20')]===_0x4d9c('0x1f');var _0x28cd54=_0x1b2ca5[_0x4d9c('0x21')];var _0x88e413=_0x1c8de5?0x0:_0x2c7159[_0x4d9c('0x1e')];var _0x4cdcd8=_0x1c8de5?_0x1b2ca5['count']:_0x2c7159[_0x4d9c('0x1e')]+_0x2c7159['limit'];var _0x5f19be;if(_0x4cdcd8>=_0x28cd54){_0x4cdcd8=_0x28cd54;_0x5f19be=0xc8;}else{_0x5f19be=0xce;}_0x3bb994[_0x4d9c('0x1b')](_0x5f19be);return _0x3bb994[_0x4d9c('0x22')](_0x4d9c('0x23'),_0x88e413+'-'+_0x4cdcd8+'/'+_0x28cd54)[_0x4d9c('0x1d')](_0x1b2ca5);}return null;};}function patchUpdates(_0x5181f7){return function(_0x41a578){try{jsonpatch[_0x4d9c('0x24')](_0x41a578,_0x5181f7,!![]);}catch(_0x1f84e9){return BPromise[_0x4d9c('0x25')](_0x1f84e9);}return _0x41a578[_0x4d9c('0x26')]();};}function saveUpdates(_0x35afd6,_0x5889c0){return function(_0x3c24d1){if(_0x3c24d1){return _0x3c24d1['update'](_0x35afd6)[_0x4d9c('0x27')](function(_0x2b5ffa){return _0x2b5ffa;});}return null;};}function removeEntity(_0x4b2021,_0x267d61){return function(_0x4f3faf){if(_0x4f3faf){return _0x4f3faf[_0x4d9c('0x28')]()[_0x4d9c('0x27')](function(){_0x4b2021['status'](0xcc)[_0x4d9c('0x1c')]();});}};}function handleEntityNotFound(_0x249e47,_0x2fb7ed){return function(_0x44feda){if(!_0x44feda){_0x249e47[_0x4d9c('0x1a')](0x194);}return _0x44feda;};}function handleError(_0x5ba8f4,_0x483c0f){_0x483c0f=_0x483c0f||0x1f4;return function(_0x108dc6){logger[_0x4d9c('0x29')](_0x108dc6[_0x4d9c('0x2a')]);if(_0x108dc6[_0x4d9c('0x2b')]){delete _0x108dc6['name'];}_0x5ba8f4[_0x4d9c('0x1b')](_0x483c0f)['send'](_0x108dc6);};}exports[_0x4d9c('0x2c')]=function(_0x4fc99c,_0x5751df){var _0x491c77={},_0x498754={},_0x4de3fc={'count':0x0,'rows':[]};var _0x4edb49=_[_0x4d9c('0x2d')](db[_0x4d9c('0x2e')][_0x4d9c('0x2f')],function(_0x5ee995){return{'name':_0x5ee995[_0x4d9c('0x30')],'type':_0x5ee995[_0x4d9c('0x31')][_0x4d9c('0x32')]};});_0x498754['model']=_[_0x4d9c('0x2d')](_0x4edb49,_0x4d9c('0x2b'));_0x498754['query']=_[_0x4d9c('0x33')](_0x4fc99c[_0x4d9c('0x34')]);_0x498754['filters']=_[_0x4d9c('0x35')](_0x498754[_0x4d9c('0x36')],_0x498754['query']);_0x491c77['attributes']=_[_0x4d9c('0x35')](_0x498754[_0x4d9c('0x36')],qs[_0x4d9c('0x37')](_0x4fc99c[_0x4d9c('0x34')]['fields']));_0x491c77['attributes']=_0x491c77[_0x4d9c('0x38')][_0x4d9c('0x39')]?_0x491c77[_0x4d9c('0x38')]:_0x498754[_0x4d9c('0x36')];if(!_0x4fc99c[_0x4d9c('0x34')][_0x4d9c('0x3a')]('nolimit')){_0x491c77['limit']=qs['limit'](_0x4fc99c['query']['limit']);_0x491c77[_0x4d9c('0x1e')]=qs[_0x4d9c('0x1e')](_0x4fc99c['query'][_0x4d9c('0x1e')]);}_0x491c77[_0x4d9c('0x3b')]=qs[_0x4d9c('0x3c')](_0x4fc99c['query'][_0x4d9c('0x3c')]);_0x491c77[_0x4d9c('0x3d')]=qs[_0x4d9c('0x3e')](_['pick'](_0x4fc99c[_0x4d9c('0x34')],_0x498754['filters']),_0x4edb49);if(_0x4fc99c[_0x4d9c('0x34')][_0x4d9c('0x3f')]){_0x491c77[_0x4d9c('0x3d')]=_['merge'](_0x491c77[_0x4d9c('0x3d')],{'$or':_['map'](_0x4edb49,function(_0x611b96){if(_0x611b96[_0x4d9c('0x31')]!==_0x4d9c('0x40')){var _0x29a98e={};_0x29a98e[_0x611b96[_0x4d9c('0x2b')]]={'$like':'%'+_0x4fc99c['query']['filter']+'%'};return _0x29a98e;}})});}_0x491c77=_[_0x4d9c('0x41')]({},_0x491c77,_0x4fc99c['options']);var _0x871969={'where':_0x491c77[_0x4d9c('0x3d')]};return db[_0x4d9c('0x2e')][_0x4d9c('0x21')](_0x871969)[_0x4d9c('0x27')](function(_0x44fff1){_0x4de3fc[_0x4d9c('0x21')]=_0x44fff1;if(_0x4fc99c[_0x4d9c('0x34')][_0x4d9c('0x42')]){_0x491c77[_0x4d9c('0x43')]=[{'all':!![]}];}return db[_0x4d9c('0x2e')][_0x4d9c('0x44')](_0x491c77);})[_0x4d9c('0x27')](function(_0x4e98b2){_0x4de3fc[_0x4d9c('0x45')]=_0x4e98b2;return _0x4de3fc;})[_0x4d9c('0x27')](respondWithFilteredResult(_0x5751df,_0x491c77))[_0x4d9c('0x46')](handleError(_0x5751df,null));};exports[_0x4d9c('0x47')]=function(_0x25f465,_0x2695c7){var _0x19f0e6={'raw':!![],'where':{'id':_0x25f465[_0x4d9c('0x48')]['id']}},_0x2a024e={};_0x2a024e[_0x4d9c('0x36')]=_[_0x4d9c('0x33')](db[_0x4d9c('0x2e')]['rawAttributes']);_0x2a024e['query']=_[_0x4d9c('0x33')](_0x25f465[_0x4d9c('0x34')]);_0x2a024e[_0x4d9c('0x3e')]=_[_0x4d9c('0x35')](_0x2a024e[_0x4d9c('0x36')],_0x2a024e[_0x4d9c('0x34')]);_0x19f0e6[_0x4d9c('0x38')]=_[_0x4d9c('0x35')](_0x2a024e[_0x4d9c('0x36')],qs['fields'](_0x25f465[_0x4d9c('0x34')][_0x4d9c('0x37')]));_0x19f0e6[_0x4d9c('0x38')]=_0x19f0e6[_0x4d9c('0x38')][_0x4d9c('0x39')]?_0x19f0e6[_0x4d9c('0x38')]:_0x2a024e[_0x4d9c('0x36')];if(_0x25f465[_0x4d9c('0x34')][_0x4d9c('0x42')]){_0x19f0e6[_0x4d9c('0x43')]=[{'all':!![]}];}_0x19f0e6=_[_0x4d9c('0x41')]({},_0x19f0e6,_0x25f465['options']);return db[_0x4d9c('0x2e')]['find'](_0x19f0e6)['then'](handleEntityNotFound(_0x2695c7,null))[_0x4d9c('0x27')](respondWithResult(_0x2695c7,null))['catch'](handleError(_0x2695c7,null));};exports['create']=function(_0x453145,_0x3e79f4){return db[_0x4d9c('0x2e')][_0x4d9c('0x49')](_0x453145[_0x4d9c('0x4a')],{})['then'](respondWithResult(_0x3e79f4,0xc9))[_0x4d9c('0x46')](handleError(_0x3e79f4,null));};exports[_0x4d9c('0x4b')]=function(_0x519e49,_0x57a81c){if(_0x519e49[_0x4d9c('0x4a')]['id']){delete _0x519e49['body']['id'];}return db[_0x4d9c('0x2e')][_0x4d9c('0x4c')]({'where':{'id':_0x519e49['params']['id']}})['then'](handleEntityNotFound(_0x57a81c,null))[_0x4d9c('0x27')](saveUpdates(_0x519e49[_0x4d9c('0x4a')],null))['then'](respondWithResult(_0x57a81c,null))[_0x4d9c('0x46')](handleError(_0x57a81c,null));};exports[_0x4d9c('0x28')]=function(_0x1fc56f,_0x13cebe){return db[_0x4d9c('0x2e')][_0x4d9c('0x4c')]({'where':{'id':_0x1fc56f['params']['id']}})[_0x4d9c('0x27')](handleEntityNotFound(_0x13cebe,null))[_0x4d9c('0x27')](removeEntity(_0x13cebe,null))[_0x4d9c('0x46')](handleError(_0x13cebe,null));};exports[_0x4d9c('0x4d')]=function(_0xedc1e8,_0x2c9b01){return db['OpenchannelTransferReport'][_0x4d9c('0x4d')]()[_0x4d9c('0x27')](respondWithResult(_0x2c9b01,null))[_0x4d9c('0x46')](handleError(_0x2c9b01,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 62a07f7..9846cd3 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 _0xf0c7=['exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./openchannelTransferReport.attributes'];(function(_0x13bc1e,_0x15ebe7){var _0x51454b=function(_0x19e89a){while(--_0x19e89a){_0x13bc1e['push'](_0x13bc1e['shift']());}};_0x51454b(++_0x15ebe7);}(_0xf0c7,0x1cc));var _0x7f0c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf0c7[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x7f0c('0x0'));var logger=require(_0x7f0c('0x1'))(_0x7f0c('0x2'));var moment=require('moment');var BPromise=require(_0x7f0c('0x3'));var rp=require(_0x7f0c('0x4'));var fs=require('fs');var path=require(_0x7f0c('0x5'));var rimraf=require('rimraf');var config=require(_0x7f0c('0x6'));var attributes=require(_0x7f0c('0x7'));module[_0x7f0c('0x8')]=function(_0xb4cc9,_0x305a36){return _0xb4cc9['define'](_0x7f0c('0x9'),attributes,{'tableName':_0x7f0c('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7f0c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaae7=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport'];(function(_0x36bfdd,_0x425a87){var _0x2f60c0=function(_0x384135){while(--_0x384135){_0x36bfdd['push'](_0x36bfdd['shift']());}};_0x2f60c0(++_0x425a87);}(_0xaae7,0x175));var _0x7aae=function(_0x1f4193,_0x12e139){_0x1f4193=_0x1f4193-0x0;var _0x36019f=_0xaae7[_0x1f4193];return _0x36019f;};'use strict';var _=require(_0x7aae('0x0'));var util=require(_0x7aae('0x1'));var logger=require(_0x7aae('0x2'))(_0x7aae('0x3'));var moment=require(_0x7aae('0x4'));var BPromise=require(_0x7aae('0x5'));var rp=require(_0x7aae('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7aae('0x7'));var config=require('../../config/environment');var attributes=require(_0x7aae('0x8'));module[_0x7aae('0x9')]=function(_0x548597,_0x53e24a){return _0x548597['define'](_0x7aae('0xa'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x7aae('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 7b0d903..fa6b601 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 _0x5785=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x5d4ca7,_0x19113b){var _0x3efc03=function(_0x59675b){while(--_0x59675b){_0x5d4ca7['push'](_0x5d4ca7['shift']());}};_0x3efc03(++_0x19113b);}(_0x5785,0x119));var _0x5578=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x5785[_0x220f3f];return _0x1f170e;};'use strict';var _=require(_0x5578('0x0'));var util=require(_0x5578('0x1'));var moment=require(_0x5578('0x2'));var BPromise=require(_0x5578('0x3'));var rs=require(_0x5578('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5578('0x5'))['db'];var utils=require(_0x5578('0x6'));var logger=require(_0x5578('0x7'))(_0x5578('0x8'));var config=require(_0x5578('0x9'));var jayson=require(_0x5578('0xa'));var client=jayson[_0x5578('0xb')][_0x5578('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x464ab2,_0x287860,_0x545581){return new BPromise(function(_0x520bbf,_0x3d37dc){return client[_0x5578('0xd')](_0x464ab2,_0x545581)['then'](function(_0x433ed0){logger['info'](_0x5578('0xe'),_0x287860,'request\x20sent');logger[_0x5578('0xf')](_0x5578('0x10'),_0x287860,_0x5578('0x11'),JSON['stringify'](_0x433ed0));if(_0x433ed0['error']){if(_0x433ed0[_0x5578('0x12')][_0x5578('0x13')]===0x1f4){logger[_0x5578('0x12')](_0x5578('0xe'),_0x287860,_0x433ed0[_0x5578('0x12')][_0x5578('0x14')]);return _0x3d37dc(_0x433ed0[_0x5578('0x12')][_0x5578('0x14')]);}logger[_0x5578('0x12')](_0x5578('0xe'),_0x287860,_0x433ed0['error'][_0x5578('0x14')]);return _0x520bbf(_0x433ed0[_0x5578('0x12')][_0x5578('0x14')]);}else{logger[_0x5578('0x15')](_0x5578('0xe'),_0x287860,_0x5578('0x11'));_0x520bbf(_0x433ed0[_0x5578('0x16')][_0x5578('0x14')]);}})[_0x5578('0x17')](function(_0xc9c5a4){logger['error'](_0x5578('0xe'),_0x287860,_0xc9c5a4);_0x3d37dc(_0xc9c5a4);});});} \ No newline at end of file +var _0xa7e6=['stringify','error','OpenchannelTransferReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa7e6,0x74));var _0x6a7e=function(_0x148073,_0x37dbaa){_0x148073=_0x148073-0x0;var _0x30ba58=_0xa7e6[_0x148073];return _0x30ba58;};'use strict';var _=require(_0x6a7e('0x0'));var util=require(_0x6a7e('0x1'));var moment=require(_0x6a7e('0x2'));var BPromise=require(_0x6a7e('0x3'));var rs=require(_0x6a7e('0x4'));var fs=require('fs');var Redis=require(_0x6a7e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6a7e('0x6'));var logger=require(_0x6a7e('0x7'))(_0x6a7e('0x8'));var config=require(_0x6a7e('0x9'));var jayson=require(_0x6a7e('0xa'));var client=jayson['client'][_0x6a7e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16249d,_0x37165d,_0x342c96){return new BPromise(function(_0x45e92e,_0x3f3f2f){return client[_0x6a7e('0xc')](_0x16249d,_0x342c96)[_0x6a7e('0xd')](function(_0xdaa33d){logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x37165d,'request\x20sent');logger['debug'](_0x6a7e('0xe'),_0x37165d,_0x6a7e('0xf'),JSON[_0x6a7e('0x10')](_0xdaa33d));if(_0xdaa33d[_0x6a7e('0x11')]){if(_0xdaa33d[_0x6a7e('0x11')]['code']===0x1f4){logger[_0x6a7e('0x11')](_0x6a7e('0x12'),_0x37165d,_0xdaa33d['error']['message']);return _0x3f3f2f(_0xdaa33d[_0x6a7e('0x11')][_0x6a7e('0x13')]);}logger[_0x6a7e('0x11')](_0x6a7e('0x12'),_0x37165d,_0xdaa33d['error'][_0x6a7e('0x13')]);return _0x45e92e(_0xdaa33d[_0x6a7e('0x11')][_0x6a7e('0x13')]);}else{logger[_0x6a7e('0x14')](_0x6a7e('0x12'),_0x37165d,'request\x20sent');_0x45e92e(_0xdaa33d[_0x6a7e('0x15')]['message']);}})['catch'](function(_0x454561){logger['error'](_0x6a7e('0x12'),_0x37165d,_0x454561);_0x3f3f2f(_0x454561);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index a92afe3..843232c 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 _0x1a1a=['../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','update','exports','multer','express','Router','fs-extra','../../components/auth/service'];(function(_0x411fac,_0xe650f9){var _0x4ef169=function(_0x1031c2){while(--_0x1031c2){_0x411fac['push'](_0x411fac['shift']());}};_0x4ef169(++_0xe650f9);}(_0x1a1a,0xb6));var _0xa1a1=function(_0x571c6b,_0x10fbbe){_0x571c6b=_0x571c6b-0x0;var _0x1a0d06=_0x1a1a[_0x571c6b];return _0x1a0d06;};'use strict';var multer=require(_0xa1a1('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa1a1('0x1'));var router=express[_0xa1a1('0x2')]();var fs_extra=require(_0xa1a1('0x3'));var auth=require(_0xa1a1('0x4'));var interaction=require(_0xa1a1('0x5'));var config=require(_0xa1a1('0x6'));var controller=require(_0xa1a1('0x7'));router[_0xa1a1('0x8')]('/',auth[_0xa1a1('0x9')](),controller[_0xa1a1('0xa')]);router['get'](_0xa1a1('0xb'),auth[_0xa1a1('0x9')](),controller[_0xa1a1('0xc')]);router[_0xa1a1('0xd')]('/',auth['isAuthenticated'](),controller[_0xa1a1('0xe')]);router['put'](_0xa1a1('0xb'),auth[_0xa1a1('0x9')](),controller[_0xa1a1('0xf')]);router['delete'](_0xa1a1('0xb'),auth[_0xa1a1('0x9')](),controller['destroy']);module[_0xa1a1('0x10')]=router; \ No newline at end of file +var _0xa11d=['index','/:id','isAuthenticated','show','post','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get'];(function(_0x12fe66,_0x28e2e9){var _0xff4bd9=function(_0x236074){while(--_0x236074){_0x12fe66['push'](_0x12fe66['shift']());}};_0xff4bd9(++_0x28e2e9);}(_0xa11d,0xd1));var _0xda11=function(_0x5cc2dc,_0x527ac3){_0x5cc2dc=_0x5cc2dc-0x0;var _0x32b6a8=_0xa11d[_0x5cc2dc];return _0x32b6a8;};'use strict';var multer=require(_0xda11('0x0'));var util=require(_0xda11('0x1'));var path=require(_0xda11('0x2'));var timeout=require('connect-timeout');var express=require(_0xda11('0x3'));var router=express[_0xda11('0x4')]();var fs_extra=require(_0xda11('0x5'));var auth=require(_0xda11('0x6'));var interaction=require(_0xda11('0x7'));var config=require(_0xda11('0x8'));var controller=require(_0xda11('0x9'));router[_0xda11('0xa')]('/',auth['isAuthenticated'](),controller[_0xda11('0xb')]);router[_0xda11('0xa')](_0xda11('0xc'),auth[_0xda11('0xd')](),controller[_0xda11('0xe')]);router[_0xda11('0xf')]('/',auth[_0xda11('0xd')](),controller['create']);router[_0xda11('0x10')](_0xda11('0xc'),auth[_0xda11('0xd')](),controller['update']);router[_0xda11('0x11')](_0xda11('0xc'),auth[_0xda11('0xd')](),controller[_0xda11('0x12')]);module[_0xda11('0x13')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 66e7b08..ebd5005 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 _0xe07a=['exports','STRING','sequelize'];(function(_0x14d233,_0x4289f7){var _0x2d4c76=function(_0x29ef14){while(--_0x29ef14){_0x14d233['push'](_0x14d233['shift']());}};_0x2d4c76(++_0x4289f7);}(_0xe07a,0x11c));var _0xae07=function(_0x44df50,_0x46e433){_0x44df50=_0x44df50-0x0;var _0x429548=_0xe07a[_0x44df50];return _0x429548;};'use strict';var Sequelize=require(_0xae07('0x0'));module[_0xae07('0x1')]={'name':{'type':Sequelize[_0xae07('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xae07('0x2')]}}; \ No newline at end of file +var _0x4873=['STRING','name'];(function(_0x1ec9c1,_0x33e417){var _0x49670b=function(_0x4a4b22){while(--_0x4a4b22){_0x1ec9c1['push'](_0x1ec9c1['shift']());}};_0x49670b(++_0x33e417);}(_0x4873,0x115));var _0x3487=function(_0x171411,_0x5e84f4){_0x171411=_0x171411-0x0;var _0x16a760=_0x4873[_0x171411];return _0x16a760;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x3487('0x0'),'allowNull':![]},'description':{'type':Sequelize[_0x3487('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 6240b33..a68bcb5 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 _0x4556=['Pause','rawAttributes','key','model','map','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','catch','intersection','fields','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Pauses','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','sendStatus','error','stack','name','send'];(function(_0x339137,_0x46f7a8){var _0x2e705e=function(_0x3826a0){while(--_0x3826a0){_0x339137['push'](_0x339137['shift']());}};_0x2e705e(++_0x46f7a8);}(_0x4556,0x166));var _0x6455=function(_0x3fd418,_0xba63e6){_0x3fd418=_0x3fd418-0x0;var _0x1c0036=_0x4556[_0x3fd418];return _0x1c0036;};'use strict';var emlformat=require(_0x6455('0x0'));var rimraf=require(_0x6455('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6455('0x2'));var rp=require(_0x6455('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6455('0x4'));var util=require(_0x6455('0x5'));var path=require(_0x6455('0x6'));var sox=require(_0x6455('0x7'));var csv=require('to-csv');var ejs=require(_0x6455('0x8'));var fs=require('fs');var fs_extra=require(_0x6455('0x9'));var _=require(_0x6455('0xa'));var squel=require(_0x6455('0xb'));var crypto=require('crypto');var jsforce=require(_0x6455('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6455('0xd'));var Redis=require(_0x6455('0xe'));var authService=require(_0x6455('0xf'));var qs=require(_0x6455('0x10'));var as=require(_0x6455('0x11'));var hardwareService=require(_0x6455('0x12'));var logger=require(_0x6455('0x13'))(_0x6455('0x14'));var utils=require('../../config/utils');var config=require(_0x6455('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6455('0x16'))['db'];function respondWithStatusCode(_0x21554e,_0x500416){_0x500416=_0x500416||0xcc;return function(_0x2e63ed){if(_0x2e63ed){return _0x21554e['sendStatus'](_0x500416);}return _0x21554e['status'](_0x500416)['end']();};}function respondWithResult(_0x202c8a,_0x3e1ab9){_0x3e1ab9=_0x3e1ab9||0xc8;return function(_0x2b4cf1){if(_0x2b4cf1){return _0x202c8a[_0x6455('0x17')](_0x3e1ab9)['json'](_0x2b4cf1);}};}function respondWithFilteredResult(_0x3ad20a,_0x576077){return function(_0x170845){if(_0x170845){var _0xa3a1bc=typeof _0x576077['offset']===_0x6455('0x18')&&typeof _0x576077[_0x6455('0x19')]==='undefined';var _0x1f0e3b=_0x170845['count'];var _0x42be81=_0xa3a1bc?0x0:_0x576077[_0x6455('0x1a')];var _0x1dbcd9=_0xa3a1bc?_0x170845[_0x6455('0x1b')]:_0x576077[_0x6455('0x1a')]+_0x576077[_0x6455('0x19')];var _0x40ddd7;if(_0x1dbcd9>=_0x1f0e3b){_0x1dbcd9=_0x1f0e3b;_0x40ddd7=0xc8;}else{_0x40ddd7=0xce;}_0x3ad20a[_0x6455('0x17')](_0x40ddd7);return _0x3ad20a[_0x6455('0x1c')](_0x6455('0x1d'),_0x42be81+'-'+_0x1dbcd9+'/'+_0x1f0e3b)['json'](_0x170845);}return null;};}function patchUpdates(_0x5b2691){return function(_0x3b90c0){try{jsonpatch[_0x6455('0x1e')](_0x3b90c0,_0x5b2691,!![]);}catch(_0x4425a0){return BPromise['reject'](_0x4425a0);}return _0x3b90c0[_0x6455('0x1f')]();};}function saveUpdates(_0x4fa387,_0x4937bc){return function(_0x4cbc9a){if(_0x4cbc9a){return _0x4cbc9a[_0x6455('0x20')](_0x4fa387)[_0x6455('0x21')](function(_0x9661a5){return _0x9661a5;});}return null;};}function removeEntity(_0x5eff3d,_0x2bee05){return function(_0x12a81a){if(_0x12a81a){return _0x12a81a['destroy']()[_0x6455('0x21')](function(){var _0x5423eb=_0x12a81a[_0x6455('0x22')]({'plain':!![]});var _0x5dd842='Pauses';return db[_0x6455('0x23')][_0x6455('0x24')]({'where':{'type':_0x5dd842,'resourceId':_0x5423eb['id']}})['then'](function(){return _0x12a81a;});})[_0x6455('0x21')](function(){_0x5eff3d[_0x6455('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2eb42f,_0x4a6a1b){return function(_0x2255c3){if(!_0x2255c3){_0x2eb42f[_0x6455('0x25')](0x194);}return _0x2255c3;};}function handleError(_0x2f214d,_0x504187){_0x504187=_0x504187||0x1f4;return function(_0x6932f1){logger[_0x6455('0x26')](_0x6932f1[_0x6455('0x27')]);if(_0x6932f1[_0x6455('0x28')]){delete _0x6932f1[_0x6455('0x28')];}_0x2f214d['status'](_0x504187)[_0x6455('0x29')](_0x6932f1);};}exports['index']=function(_0x4fffbb,_0x381519){var _0x2a5ca2={},_0x448653={},_0x4503b1={'count':0x0,'rows':[]};var _0x5c2030=_['map'](db[_0x6455('0x2a')][_0x6455('0x2b')],function(_0x1a16cd){return{'name':_0x1a16cd['fieldName'],'type':_0x1a16cd['type'][_0x6455('0x2c')]};});_0x448653[_0x6455('0x2d')]=_[_0x6455('0x2e')](_0x5c2030,'name');_0x448653[_0x6455('0x2f')]=_[_0x6455('0x30')](_0x4fffbb[_0x6455('0x2f')]);_0x448653[_0x6455('0x31')]=_['intersection'](_0x448653[_0x6455('0x2d')],_0x448653[_0x6455('0x2f')]);_0x2a5ca2['attributes']=_['intersection'](_0x448653['model'],qs['fields'](_0x4fffbb[_0x6455('0x2f')]['fields']));_0x2a5ca2[_0x6455('0x32')]=_0x2a5ca2[_0x6455('0x32')][_0x6455('0x33')]?_0x2a5ca2['attributes']:_0x448653[_0x6455('0x2d')];if(!_0x4fffbb[_0x6455('0x2f')][_0x6455('0x34')](_0x6455('0x35'))){_0x2a5ca2[_0x6455('0x19')]=qs['limit'](_0x4fffbb['query'][_0x6455('0x19')]);_0x2a5ca2['offset']=qs[_0x6455('0x1a')](_0x4fffbb[_0x6455('0x2f')][_0x6455('0x1a')]);}_0x2a5ca2[_0x6455('0x36')]=qs[_0x6455('0x37')](_0x4fffbb[_0x6455('0x2f')][_0x6455('0x37')]);_0x2a5ca2[_0x6455('0x38')]=qs[_0x6455('0x31')](_[_0x6455('0x39')](_0x4fffbb['query'],_0x448653[_0x6455('0x31')]),_0x5c2030);if(_0x4fffbb[_0x6455('0x2f')][_0x6455('0x3a')]){_0x2a5ca2[_0x6455('0x38')]=_[_0x6455('0x3b')](_0x2a5ca2[_0x6455('0x38')],{'$or':_[_0x6455('0x2e')](_0x5c2030,function(_0x1916f5){if(_0x1916f5[_0x6455('0x3c')]!==_0x6455('0x3d')){var _0x538548={};_0x538548[_0x1916f5['name']]={'$like':'%'+_0x4fffbb['query']['filter']+'%'};return _0x538548;}})});}_0x2a5ca2=_[_0x6455('0x3b')]({},_0x2a5ca2,_0x4fffbb['options']);var _0x294cd8={'where':_0x2a5ca2['where']};return db[_0x6455('0x2a')][_0x6455('0x1b')](_0x294cd8)['then'](function(_0x327b6a){_0x4503b1['count']=_0x327b6a;if(_0x4fffbb['query'][_0x6455('0x3e')]){_0x2a5ca2[_0x6455('0x3f')]=[{'all':!![]}];}return db[_0x6455('0x2a')][_0x6455('0x40')](_0x2a5ca2);})[_0x6455('0x21')](function(_0x1e99d1){_0x4503b1['rows']=_0x1e99d1;return _0x4503b1;})[_0x6455('0x21')](respondWithFilteredResult(_0x381519,_0x2a5ca2))[_0x6455('0x41')](handleError(_0x381519,null));};exports['show']=function(_0xd8537b,_0x21c9c5){var _0x447abc={'raw':!![],'where':{'id':_0xd8537b['params']['id']}},_0x58cbf4={};_0x58cbf4[_0x6455('0x2d')]=_[_0x6455('0x30')](db[_0x6455('0x2a')]['rawAttributes']);_0x58cbf4[_0x6455('0x2f')]=_[_0x6455('0x30')](_0xd8537b[_0x6455('0x2f')]);_0x58cbf4[_0x6455('0x31')]=_['intersection'](_0x58cbf4[_0x6455('0x2d')],_0x58cbf4[_0x6455('0x2f')]);_0x447abc[_0x6455('0x32')]=_[_0x6455('0x42')](_0x58cbf4[_0x6455('0x2d')],qs[_0x6455('0x43')](_0xd8537b[_0x6455('0x2f')]['fields']));_0x447abc[_0x6455('0x32')]=_0x447abc[_0x6455('0x32')][_0x6455('0x33')]?_0x447abc['attributes']:_0x58cbf4[_0x6455('0x2d')];if(_0xd8537b['query'][_0x6455('0x3e')]){_0x447abc[_0x6455('0x3f')]=[{'all':!![]}];}_0x447abc=_['merge']({},_0x447abc,_0xd8537b[_0x6455('0x44')]);return db['Pause']['find'](_0x447abc)[_0x6455('0x21')](handleEntityNotFound(_0x21c9c5,null))[_0x6455('0x21')](respondWithResult(_0x21c9c5,null))[_0x6455('0x41')](handleError(_0x21c9c5,null));};exports[_0x6455('0x45')]=function(_0x504c6f,_0x507344){return db[_0x6455('0x2a')][_0x6455('0x45')](_0x504c6f['body'],{})[_0x6455('0x21')](function(_0x2a2bbc){var _0x347898=_0x504c6f[_0x6455('0x46')][_0x6455('0x22')]({'plain':!![]});if(!_0x347898)throw new Error(_0x6455('0x47'));if(_0x347898['role']===_0x6455('0x46')){var _0x3b4de6=_0x2a2bbc['get']({'plain':!![]});var _0x23029e=_0x6455('0x48');return db[_0x6455('0x49')]['find']({'where':{'name':_0x23029e,'userProfileId':_0x347898[_0x6455('0x4a')]},'raw':!![]})[_0x6455('0x21')](function(_0x531d95){if(_0x531d95&&_0x531d95[_0x6455('0x4b')]===0x0){return db[_0x6455('0x23')]['create']({'name':_0x3b4de6[_0x6455('0x28')],'resourceId':_0x3b4de6['id'],'type':_0x531d95[_0x6455('0x28')],'sectionId':_0x531d95['id']},{})[_0x6455('0x21')](function(){return _0x2a2bbc;});}else{return _0x2a2bbc;}})[_0x6455('0x41')](function(_0x113e4a){logger[_0x6455('0x26')](_0x6455('0x4c'),_0x113e4a);throw _0x113e4a;});}return _0x2a2bbc;})['then'](respondWithResult(_0x507344,0xc9))[_0x6455('0x41')](handleError(_0x507344,null));};exports[_0x6455('0x20')]=function(_0x3232e5,_0x5e494b){if(_0x3232e5[_0x6455('0x4d')]['id']){delete _0x3232e5['body']['id'];}return db[_0x6455('0x2a')][_0x6455('0x4e')]({'where':{'id':_0x3232e5[_0x6455('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5e494b,null))['then'](saveUpdates(_0x3232e5[_0x6455('0x4d')],null))['then'](respondWithResult(_0x5e494b,null))[_0x6455('0x41')](handleError(_0x5e494b,null));};exports[_0x6455('0x24')]=function(_0x540119,_0x40baf6){return db[_0x6455('0x2a')][_0x6455('0x4e')]({'where':{'id':_0x540119[_0x6455('0x4f')]['id']}})[_0x6455('0x21')](handleEntityNotFound(_0x40baf6,null))[_0x6455('0x21')](removeEntity(_0x40baf6,null))[_0x6455('0x41')](handleError(_0x40baf6,null));}; \ No newline at end of file +var _0x73b6=['sendStatus','error','stack','name','send','index','map','Pause','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','UserProfileSection','find','userProfileId','autoAssociation','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','UserProfileResource'];(function(_0x2de020,_0x252df0){var _0x182b7c=function(_0xcbcdaa){while(--_0xcbcdaa){_0x2de020['push'](_0x2de020['shift']());}};_0x182b7c(++_0x252df0);}(_0x73b6,0x12b));var _0x673b=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x73b6[_0x1ddedd];return _0xa3e1ac;};'use strict';var emlformat=require(_0x673b('0x0'));var rimraf=require(_0x673b('0x1'));var zipdir=require(_0x673b('0x2'));var jsonpatch=require(_0x673b('0x3'));var rp=require('request-promise');var moment=require(_0x673b('0x4'));var BPromise=require(_0x673b('0x5'));var Mustache=require(_0x673b('0x6'));var util=require(_0x673b('0x7'));var path=require('path');var sox=require(_0x673b('0x8'));var csv=require('to-csv');var ejs=require(_0x673b('0x9'));var fs=require('fs');var fs_extra=require(_0x673b('0xa'));var _=require(_0x673b('0xb'));var squel=require(_0x673b('0xc'));var crypto=require(_0x673b('0xd'));var jsforce=require(_0x673b('0xe'));var deskjs=require(_0x673b('0xf'));var toCsv=require('to-csv');var querystring=require(_0x673b('0x10'));var Papa=require(_0x673b('0x11'));var Redis=require(_0x673b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x673b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x673b('0x14'))('api');var utils=require(_0x673b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x673b('0x16'));var db=require(_0x673b('0x17'))['db'];function respondWithStatusCode(_0x544f26,_0x1d4a6e){_0x1d4a6e=_0x1d4a6e||0xcc;return function(_0x72aca){if(_0x72aca){return _0x544f26['sendStatus'](_0x1d4a6e);}return _0x544f26[_0x673b('0x18')](_0x1d4a6e)[_0x673b('0x19')]();};}function respondWithResult(_0x2cca21,_0x57e94a){_0x57e94a=_0x57e94a||0xc8;return function(_0x391f77){if(_0x391f77){return _0x2cca21['status'](_0x57e94a)[_0x673b('0x1a')](_0x391f77);}};}function respondWithFilteredResult(_0x4ef797,_0x2e3a20){return function(_0x590287){if(_0x590287){var _0x28f1d7=typeof _0x2e3a20['offset']===_0x673b('0x1b')&&typeof _0x2e3a20[_0x673b('0x1c')]==='undefined';var _0xd94540=_0x590287[_0x673b('0x1d')];var _0x50dd99=_0x28f1d7?0x0:_0x2e3a20[_0x673b('0x1e')];var _0x53ff74=_0x28f1d7?_0x590287[_0x673b('0x1d')]:_0x2e3a20[_0x673b('0x1e')]+_0x2e3a20[_0x673b('0x1c')];var _0x2ddaba;if(_0x53ff74>=_0xd94540){_0x53ff74=_0xd94540;_0x2ddaba=0xc8;}else{_0x2ddaba=0xce;}_0x4ef797[_0x673b('0x18')](_0x2ddaba);return _0x4ef797[_0x673b('0x1f')](_0x673b('0x20'),_0x50dd99+'-'+_0x53ff74+'/'+_0xd94540)[_0x673b('0x1a')](_0x590287);}return null;};}function patchUpdates(_0x36c6aa){return function(_0x2c87a2){try{jsonpatch[_0x673b('0x21')](_0x2c87a2,_0x36c6aa,!![]);}catch(_0x4137a9){return BPromise['reject'](_0x4137a9);}return _0x2c87a2[_0x673b('0x22')]();};}function saveUpdates(_0x2eb5f5,_0x193f79){return function(_0x57c986){if(_0x57c986){return _0x57c986['update'](_0x2eb5f5)[_0x673b('0x23')](function(_0x352d5d){return _0x352d5d;});}return null;};}function removeEntity(_0x350969,_0x59a725){return function(_0x2eca4b){if(_0x2eca4b){return _0x2eca4b['destroy']()[_0x673b('0x23')](function(){var _0x26878f=_0x2eca4b['get']({'plain':!![]});var _0x2a2833='Pauses';return db[_0x673b('0x24')]['destroy']({'where':{'type':_0x2a2833,'resourceId':_0x26878f['id']}})[_0x673b('0x23')](function(){return _0x2eca4b;});})[_0x673b('0x23')](function(){_0x350969['status'](0xcc)[_0x673b('0x19')]();});}};}function handleEntityNotFound(_0x5c357e,_0x46ec68){return function(_0x1452a8){if(!_0x1452a8){_0x5c357e[_0x673b('0x25')](0x194);}return _0x1452a8;};}function handleError(_0x39fdd0,_0xea30d){_0xea30d=_0xea30d||0x1f4;return function(_0x767996){logger[_0x673b('0x26')](_0x767996[_0x673b('0x27')]);if(_0x767996[_0x673b('0x28')]){delete _0x767996[_0x673b('0x28')];}_0x39fdd0['status'](_0xea30d)[_0x673b('0x29')](_0x767996);};}exports[_0x673b('0x2a')]=function(_0x430fb2,_0x245b32){var _0x4254cc={},_0x44e7c2={},_0x154dd6={'count':0x0,'rows':[]};var _0x5bc1a8=_[_0x673b('0x2b')](db[_0x673b('0x2c')]['rawAttributes'],function(_0x35b449){return{'name':_0x35b449['fieldName'],'type':_0x35b449[_0x673b('0x2d')][_0x673b('0x2e')]};});_0x44e7c2['model']=_[_0x673b('0x2b')](_0x5bc1a8,_0x673b('0x28'));_0x44e7c2[_0x673b('0x2f')]=_[_0x673b('0x30')](_0x430fb2[_0x673b('0x2f')]);_0x44e7c2['filters']=_[_0x673b('0x31')](_0x44e7c2[_0x673b('0x32')],_0x44e7c2['query']);_0x4254cc[_0x673b('0x33')]=_[_0x673b('0x31')](_0x44e7c2['model'],qs[_0x673b('0x34')](_0x430fb2[_0x673b('0x2f')][_0x673b('0x34')]));_0x4254cc[_0x673b('0x33')]=_0x4254cc[_0x673b('0x33')][_0x673b('0x35')]?_0x4254cc[_0x673b('0x33')]:_0x44e7c2[_0x673b('0x32')];if(!_0x430fb2[_0x673b('0x2f')][_0x673b('0x36')](_0x673b('0x37'))){_0x4254cc['limit']=qs['limit'](_0x430fb2['query']['limit']);_0x4254cc[_0x673b('0x1e')]=qs['offset'](_0x430fb2[_0x673b('0x2f')]['offset']);}_0x4254cc[_0x673b('0x38')]=qs[_0x673b('0x39')](_0x430fb2['query'][_0x673b('0x39')]);_0x4254cc[_0x673b('0x3a')]=qs[_0x673b('0x3b')](_[_0x673b('0x3c')](_0x430fb2[_0x673b('0x2f')],_0x44e7c2[_0x673b('0x3b')]),_0x5bc1a8);if(_0x430fb2[_0x673b('0x2f')]['filter']){_0x4254cc['where']=_[_0x673b('0x3d')](_0x4254cc[_0x673b('0x3a')],{'$or':_['map'](_0x5bc1a8,function(_0x2c8359){if(_0x2c8359['type']!=='VIRTUAL'){var _0x307c3e={};_0x307c3e[_0x2c8359[_0x673b('0x28')]]={'$like':'%'+_0x430fb2[_0x673b('0x2f')][_0x673b('0x3e')]+'%'};return _0x307c3e;}})});}_0x4254cc=_[_0x673b('0x3d')]({},_0x4254cc,_0x430fb2['options']);var _0x2352b6={'where':_0x4254cc[_0x673b('0x3a')]};return db['Pause'][_0x673b('0x1d')](_0x2352b6)[_0x673b('0x23')](function(_0x9955dd){_0x154dd6[_0x673b('0x1d')]=_0x9955dd;if(_0x430fb2[_0x673b('0x2f')][_0x673b('0x3f')]){_0x4254cc[_0x673b('0x40')]=[{'all':!![]}];}return db['Pause'][_0x673b('0x41')](_0x4254cc);})[_0x673b('0x23')](function(_0x3e1db0){_0x154dd6[_0x673b('0x42')]=_0x3e1db0;return _0x154dd6;})['then'](respondWithFilteredResult(_0x245b32,_0x4254cc))[_0x673b('0x43')](handleError(_0x245b32,null));};exports[_0x673b('0x44')]=function(_0x2ddea8,_0x5b101b){var _0x1a1e46={'raw':!![],'where':{'id':_0x2ddea8[_0x673b('0x45')]['id']}},_0x262a61={};_0x262a61['model']=_[_0x673b('0x30')](db[_0x673b('0x2c')][_0x673b('0x46')]);_0x262a61[_0x673b('0x2f')]=_[_0x673b('0x30')](_0x2ddea8[_0x673b('0x2f')]);_0x262a61['filters']=_[_0x673b('0x31')](_0x262a61['model'],_0x262a61[_0x673b('0x2f')]);_0x1a1e46['attributes']=_[_0x673b('0x31')](_0x262a61[_0x673b('0x32')],qs['fields'](_0x2ddea8[_0x673b('0x2f')][_0x673b('0x34')]));_0x1a1e46[_0x673b('0x33')]=_0x1a1e46[_0x673b('0x33')][_0x673b('0x35')]?_0x1a1e46[_0x673b('0x33')]:_0x262a61['model'];if(_0x2ddea8[_0x673b('0x2f')][_0x673b('0x3f')]){_0x1a1e46[_0x673b('0x40')]=[{'all':!![]}];}_0x1a1e46=_['merge']({},_0x1a1e46,_0x2ddea8[_0x673b('0x47')]);return db[_0x673b('0x2c')]['find'](_0x1a1e46)['then'](handleEntityNotFound(_0x5b101b,null))[_0x673b('0x23')](respondWithResult(_0x5b101b,null))['catch'](handleError(_0x5b101b,null));};exports[_0x673b('0x48')]=function(_0x461737,_0x335ce2){return db[_0x673b('0x2c')]['create'](_0x461737[_0x673b('0x49')],{})['then'](function(_0x5b76f0){var _0x5ca2a2=_0x461737[_0x673b('0x4a')][_0x673b('0x4b')]({'plain':!![]});if(!_0x5ca2a2)throw new Error(_0x673b('0x4c'));if(_0x5ca2a2[_0x673b('0x4d')]==='user'){var _0x2cfee5=_0x5b76f0[_0x673b('0x4b')]({'plain':!![]});var _0x9ef32d=_0x673b('0x4e');return db[_0x673b('0x4f')][_0x673b('0x50')]({'where':{'name':_0x9ef32d,'userProfileId':_0x5ca2a2[_0x673b('0x51')]},'raw':!![]})['then'](function(_0x2f4844){if(_0x2f4844&&_0x2f4844[_0x673b('0x52')]===0x0){return db[_0x673b('0x24')][_0x673b('0x48')]({'name':_0x2cfee5[_0x673b('0x28')],'resourceId':_0x2cfee5['id'],'type':_0x2f4844['name'],'sectionId':_0x2f4844['id']},{})[_0x673b('0x23')](function(){return _0x5b76f0;});}else{return _0x5b76f0;}})[_0x673b('0x43')](function(_0x3e0617){logger[_0x673b('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e0617);throw _0x3e0617;});}return _0x5b76f0;})[_0x673b('0x23')](respondWithResult(_0x335ce2,0xc9))[_0x673b('0x43')](handleError(_0x335ce2,null));};exports['update']=function(_0x28b52a,_0x3cfd28){if(_0x28b52a['body']['id']){delete _0x28b52a[_0x673b('0x49')]['id'];}return db[_0x673b('0x2c')][_0x673b('0x50')]({'where':{'id':_0x28b52a[_0x673b('0x45')]['id']}})[_0x673b('0x23')](handleEntityNotFound(_0x3cfd28,null))[_0x673b('0x23')](saveUpdates(_0x28b52a['body'],null))[_0x673b('0x23')](respondWithResult(_0x3cfd28,null))['catch'](handleError(_0x3cfd28,null));};exports[_0x673b('0x53')]=function(_0x2a11e5,_0xe1f3f){return db[_0x673b('0x2c')]['find']({'where':{'id':_0x2a11e5[_0x673b('0x45')]['id']}})[_0x673b('0x23')](handleEntityNotFound(_0xe1f3f,null))['then'](removeEntity(_0xe1f3f,null))[_0x673b('0x43')](handleError(_0xe1f3f,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index dc80dd1..dd5bc98 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['define','Pause','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0x284ae4,_0x246a17){var _0x5f10ca=function(_0x2fcf58){while(--_0x2fcf58){_0x284ae4['push'](_0x284ae4['shift']());}};_0x5f10ca(++_0x246a17);}(_0x814b,0x1a2));var _0xb814=function(_0x40b3f2,_0x2c4f5f){_0x40b3f2=_0x40b3f2-0x0;var _0x4ce90c=_0x814b[_0x40b3f2];return _0x4ce90c;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['bluebird','path','../../config/environment','./pause.attributes','define','Pause','lodash','util','../../config/logger','api','moment'];(function(_0x1b413e,_0x296e12){var _0x53d567=function(_0x39c108){while(--_0x39c108){_0x1b413e['push'](_0x1b413e['shift']());}};_0x53d567(++_0x296e12);}(_0x53ec,0x192));var _0xc53e=function(_0x3cff6c,_0x107a6c){_0x3cff6c=_0x3cff6c-0x0;var _0x442fb7=_0x53ec[_0x3cff6c];return _0x442fb7;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 93bc509..1a03d0c 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(_0x59957e,_0x4825a1){var _0x36967e=function(_0x2ba5dc){while(--_0x2ba5dc){_0x59957e['push'](_0x59957e['shift']());}};_0x36967e(++_0x4825a1);}(_0xb10b,0x12a));var _0xbb10=function(_0xd0e677,_0x42939d){_0xd0e677=_0xd0e677-0x0;var _0x18aeb9=_0xb10b[_0xd0e677];return _0x18aeb9;};'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(_0x319244,_0xacc207){var _0x4b0640=function(_0x473f8d){while(--_0x473f8d){_0x319244['push'](_0x319244['shift']());}};_0x4b0640(++_0xacc207);}(_0x7a54,0x106));var _0x47a5=function(_0x4a057b,_0x594e41){_0x4a057b=_0x4a057b-0x0;var _0x3d1b00=_0x7a54[_0x4a057b];return _0x3d1b00;};'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 af15836..ead01eb 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 _0x9b9b=['single','file','webhookPost','put','delete','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','/:id/download','download','root','server/files/plugins','originalname','format','basename','extname','now','post'];(function(_0x193394,_0x77e174){var _0x576e1b=function(_0x2f71b5){while(--_0x2f71b5){_0x193394['push'](_0x193394['shift']());}};_0x576e1b(++_0x77e174);}(_0x9b9b,0x114));var _0xb9b9=function(_0x406e9f,_0x49adee){_0x406e9f=_0x406e9f-0x0;var _0x500565=_0x9b9b[_0x406e9f];return _0x500565;};'use strict';var multer=require('multer');var util=require(_0xb9b9('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb9b9('0x1'));var router=express[_0xb9b9('0x2')]();var fs_extra=require(_0xb9b9('0x3'));var auth=require(_0xb9b9('0x4'));var interaction=require(_0xb9b9('0x5'));var config=require(_0xb9b9('0x6'));var controller=require(_0xb9b9('0x7'));router[_0xb9b9('0x8')]('/',auth[_0xb9b9('0x9')](),controller[_0xb9b9('0xa')]);router[_0xb9b9('0x8')](_0xb9b9('0xb'),controller[_0xb9b9('0xc')]);router[_0xb9b9('0x8')](_0xb9b9('0xd'),auth[_0xb9b9('0x9')](),controller['show']);router['get'](_0xb9b9('0xe'),auth[_0xb9b9('0x9')](),controller[_0xb9b9('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3949d0,_0x3b6bb9,_0x1122bb){_0x1122bb(null,path['join'](config[_0xb9b9('0x10')],_0xb9b9('0x11')));},'filename':function(_0xbc5a42,_0x26fa04,_0x230fea){_0x26fa04[_0xb9b9('0x12')]=_0x26fa04['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x230fea(null,util[_0xb9b9('0x13')]('%s-%s%s',path[_0xb9b9('0x14')](_0x26fa04['originalname'],path[_0xb9b9('0x15')](_0x26fa04[_0xb9b9('0x12')])),Date[_0xb9b9('0x16')](),path[_0xb9b9('0x15')](_0x26fa04[_0xb9b9('0x12')])));}})});router[_0xb9b9('0x17')]('/',upload[_0xb9b9('0x18')](_0xb9b9('0x19')),controller['upload']);router[_0xb9b9('0x17')]('/webhook',controller[_0xb9b9('0x1a')]);router[_0xb9b9('0x1b')](_0xb9b9('0xd'),auth[_0xb9b9('0x9')](),controller['update']);router[_0xb9b9('0x1c')](_0xb9b9('0xd'),auth[_0xb9b9('0x9')](),controller[_0xb9b9('0x1c')]);module[_0xb9b9('0x1d')]=router; \ No newline at end of file +var _0x9bde=['exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','webhookGet','/:id','isAuthenticated','show','/:id/download','diskStorage','join','root','server/files/plugins','originalname','replace','format','extname','now','post','file','upload','webhookPost','put','delete'];(function(_0x5a3bd8,_0x197e06){var _0x29de1a=function(_0x2c3eae){while(--_0x2c3eae){_0x5a3bd8['push'](_0x5a3bd8['shift']());}};_0x29de1a(++_0x197e06);}(_0x9bde,0xe1));var _0xe9bd=function(_0x42d91a,_0x36906e){_0x42d91a=_0x42d91a-0x0;var _0x3d335d=_0x9bde[_0x42d91a];return _0x3d335d;};'use strict';var multer=require('multer');var util=require(_0xe9bd('0x0'));var path=require('path');var timeout=require(_0xe9bd('0x1'));var express=require('express');var router=express[_0xe9bd('0x2')]();var fs_extra=require(_0xe9bd('0x3'));var auth=require(_0xe9bd('0x4'));var interaction=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var controller=require(_0xe9bd('0x7'));router[_0xe9bd('0x8')]('/',auth['isAuthenticated'](),controller[_0xe9bd('0x9')]);router[_0xe9bd('0x8')](_0xe9bd('0xa'),controller[_0xe9bd('0xb')]);router[_0xe9bd('0x8')](_0xe9bd('0xc'),auth[_0xe9bd('0xd')](),controller[_0xe9bd('0xe')]);router[_0xe9bd('0x8')](_0xe9bd('0xf'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0xe9bd('0x10')]({'destination':function(_0x145521,_0x2601ac,_0x581ab9){_0x581ab9(null,path[_0xe9bd('0x11')](config[_0xe9bd('0x12')],_0xe9bd('0x13')));},'filename':function(_0x141587,_0x5e022a,_0x2c1d98){_0x5e022a['originalname']=_0x5e022a[_0xe9bd('0x14')][_0xe9bd('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2c1d98(null,util[_0xe9bd('0x16')]('%s-%s%s',path['basename'](_0x5e022a[_0xe9bd('0x14')],path[_0xe9bd('0x17')](_0x5e022a[_0xe9bd('0x14')])),Date[_0xe9bd('0x18')](),path[_0xe9bd('0x17')](_0x5e022a[_0xe9bd('0x14')])));}})});router[_0xe9bd('0x19')]('/',upload['single'](_0xe9bd('0x1a')),controller[_0xe9bd('0x1b')]);router[_0xe9bd('0x19')]('/webhook',controller[_0xe9bd('0x1c')]);router[_0xe9bd('0x1d')](_0xe9bd('0xc'),auth[_0xe9bd('0xd')](),controller['update']);router[_0xe9bd('0x1e')]('/:id',auth[_0xe9bd('0xd')](),controller['delete']);module[_0xe9bd('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 506bea2..ea91a59 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 _0xe8ac=['ENUM','TEXT','STRING','adminOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports'];(function(_0xe52d09,_0x33a6a8){var _0x16cc71=function(_0x1c1672){while(--_0x1c1672){_0xe52d09['push'](_0xe52d09['shift']());}};_0x16cc71(++_0x33a6a8);}(_0xe8ac,0x87));var _0xce8a=function(_0x5d5bdf,_0x4e7500){_0x5d5bdf=_0x5d5bdf-0x0;var _0x30a40c=_0xe8ac[_0x5d5bdf];return _0x30a40c;};'use strict';var Sequelize=require('sequelize');module[_0xce8a('0x0')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xce8a('0x1')]('html','script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xce8a('0x2')]},'path':{'type':Sequelize[_0xce8a('0x3')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0xce8a('0x4'),'agentOnly',_0xce8a('0x5'),_0xce8a('0x6')),'defaultValue':_0xce8a('0x5'),'comment':_0xce8a('0x7')},'icon':{'type':Sequelize[_0xce8a('0x3')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xce8a('0x3')]},'scriptName':{'type':Sequelize[_0xce8a('0x3')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x76d2=['agentOnly','always','never','sequelize','exports','STRING','ENUM','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'];(function(_0x81dcac,_0x8ff7db){var _0xc7803b=function(_0x499b29){while(--_0x499b29){_0x81dcac['push'](_0x81dcac['shift']());}};_0xc7803b(++_0x8ff7db);}(_0x76d2,0x162));var _0x276d=function(_0x5b76fe,_0x156f0f){_0x5b76fe=_0x5b76fe-0x0;var _0x54ed48=_0x76d2[_0x5b76fe];return _0x54ed48;};'use strict';var Sequelize=require(_0x276d('0x0'));module[_0x276d('0x1')]={'name':{'type':Sequelize[_0x276d('0x2')]},'type':{'type':Sequelize[_0x276d('0x3')]('html',_0x276d('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x276d('0x5')]},'path':{'type':Sequelize[_0x276d('0x2')],'comment':_0x276d('0x6')},'active':{'type':Sequelize[_0x276d('0x7')],'defaultValue':0x0,'comment':_0x276d('0x8')},'sidebar':{'type':Sequelize['ENUM'](_0x276d('0x9'),_0x276d('0xa'),_0x276d('0xb'),_0x276d('0xc')),'defaultValue':_0x276d('0xb'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x276d('0x2')]},'adminUrl':{'type':Sequelize[_0x276d('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x276d('0x2')]},'scriptPath':{'type':Sequelize[_0x276d('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index b513a6e..1af0135 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 _0x5d28=['Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','admin','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','test','role','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Plugins','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','headers','content-type','set','statusCode','webhookPost','%s%s','content-length','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','Plugin','includeAll','include','findAll','rows','catch','show','find','download','params','join','server/files/plugins','format','%s.zip','basename','zip','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','root','dirname','node_modules/**/*','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info'];(function(_0x38a8b2,_0x2d6fa2){var _0x1b5a91=function(_0x3b9afb){while(--_0x3b9afb){_0x38a8b2['push'](_0x38a8b2['shift']());}};_0x1b5a91(++_0x2d6fa2);}(_0x5d28,0xe7));var _0x85d2=function(_0x255b5a,_0x3e0296){_0x255b5a=_0x255b5a-0x0;var _0x308f03=_0x5d28[_0x255b5a];return _0x308f03;};'use strict';var emlformat=require(_0x85d2('0x0'));var rimraf=require(_0x85d2('0x1'));var zipdir=require(_0x85d2('0x2'));var jsonpatch=require(_0x85d2('0x3'));var rp=require(_0x85d2('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x85d2('0x5'));var util=require(_0x85d2('0x6'));var path=require(_0x85d2('0x7'));var sox=require(_0x85d2('0x8'));var csv=require(_0x85d2('0x9'));var ejs=require(_0x85d2('0xa'));var fs=require('fs');var fs_extra=require(_0x85d2('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x85d2('0xc'));var jsforce=require(_0x85d2('0xd'));var deskjs=require(_0x85d2('0xe'));var toCsv=require(_0x85d2('0x9'));var querystring=require(_0x85d2('0xf'));var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require(_0x85d2('0x10'));var Redis=require(_0x85d2('0x11'));var authService=require(_0x85d2('0x12'));var qs=require(_0x85d2('0x13'));var as=require(_0x85d2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x85d2('0x15'));var config=require(_0x85d2('0x16'));var licenseUtil=require(_0x85d2('0x17'));var db=require(_0x85d2('0x18'))['db'];config[_0x85d2('0x19')]=_['defaults'](config[_0x85d2('0x19')],{'host':_0x85d2('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x85d2('0x19')]));require('./plugin.socket')[_0x85d2('0x1b')](socket);function respondWithStatusCode(_0x4e1856,_0x1560d4){_0x1560d4=_0x1560d4||0xcc;return function(_0x301f1c){if(_0x301f1c){return _0x4e1856[_0x85d2('0x1c')](_0x1560d4);}return _0x4e1856[_0x85d2('0x1d')](_0x1560d4)[_0x85d2('0x1e')]();};}function respondWithResult(_0x4ebf37,_0x3a4b58){_0x3a4b58=_0x3a4b58||0xc8;return function(_0x286907){if(_0x286907){return _0x4ebf37[_0x85d2('0x1d')](_0x3a4b58)['json'](_0x286907);}};}function respondWithFilteredResult(_0x1183c5,_0x102f93){return function(_0x9d5ebd){if(_0x9d5ebd){var _0x1b66a2=typeof _0x102f93[_0x85d2('0x1f')]===_0x85d2('0x20')&&typeof _0x102f93[_0x85d2('0x21')]===_0x85d2('0x20');var _0x10a974=_0x9d5ebd[_0x85d2('0x22')];var _0x55f3e3=_0x1b66a2?0x0:_0x102f93[_0x85d2('0x1f')];var _0x1b097f=_0x1b66a2?_0x9d5ebd[_0x85d2('0x22')]:_0x102f93[_0x85d2('0x1f')]+_0x102f93['limit'];var _0x5b9e12;if(_0x1b097f>=_0x10a974){_0x1b097f=_0x10a974;_0x5b9e12=0xc8;}else{_0x5b9e12=0xce;}_0x1183c5['status'](_0x5b9e12);return _0x1183c5['set'](_0x85d2('0x23'),_0x55f3e3+'-'+_0x1b097f+'/'+_0x10a974)[_0x85d2('0x24')](_0x9d5ebd);}return null;};}function patchUpdates(_0x9ea8fa){return function(_0x517990){try{jsonpatch[_0x85d2('0x25')](_0x517990,_0x9ea8fa,!![]);}catch(_0x33d312){return BPromise[_0x85d2('0x26')](_0x33d312);}return _0x517990[_0x85d2('0x27')]();};}function saveUpdates(_0x5c62bd,_0x40fafe){return function(_0x50f440){if(_0x50f440){return _0x50f440[_0x85d2('0x28')](_0x5c62bd)[_0x85d2('0x29')](function(_0x46644d){return _0x46644d;});}return null;};}function removeEntity(_0x168d23,_0x34cedb){return function(_0x52846d){if(_0x52846d){return _0x52846d['destroy']()[_0x85d2('0x29')](function(){var _0x2775d2=_0x52846d[_0x85d2('0x2a')]({'plain':!![]});var _0x3abde6='Plugins';return db[_0x85d2('0x2b')][_0x85d2('0x2c')]({'where':{'type':_0x3abde6,'resourceId':_0x2775d2['id']}})[_0x85d2('0x29')](function(){return _0x52846d;});})[_0x85d2('0x29')](function(){_0x168d23[_0x85d2('0x1d')](0xcc)[_0x85d2('0x1e')]();});}};}function handleEntityNotFound(_0x51ea31,_0x21fc7d){return function(_0x154255){if(!_0x154255){_0x51ea31['sendStatus'](0x194);}return _0x154255;};}function handleError(_0x2fafdf,_0x12db52){_0x12db52=_0x12db52||0x1f4;return function(_0xac5365){logger[_0x85d2('0x2d')](_0xac5365[_0x85d2('0x2e')]);if(_0xac5365['name']){delete _0xac5365[_0x85d2('0x2f')];}_0x2fafdf['status'](_0x12db52)[_0x85d2('0x30')](_0xac5365);};}exports[_0x85d2('0x31')]=function(_0x1b96bc,_0x3f55b6){var _0x41823a={},_0x2bd1e3={},_0x3393b2={'count':0x0,'rows':[]};var _0x3a5274=_[_0x85d2('0x32')](db['Plugin'][_0x85d2('0x33')],function(_0x6c4807){return{'name':_0x6c4807[_0x85d2('0x34')],'type':_0x6c4807[_0x85d2('0x35')]['key']};});_0x2bd1e3['model']=_[_0x85d2('0x32')](_0x3a5274,_0x85d2('0x2f'));_0x2bd1e3['query']=_[_0x85d2('0x36')](_0x1b96bc[_0x85d2('0x37')]);_0x2bd1e3[_0x85d2('0x38')]=_[_0x85d2('0x39')](_0x2bd1e3[_0x85d2('0x3a')],_0x2bd1e3[_0x85d2('0x37')]);_0x41823a[_0x85d2('0x3b')]=_[_0x85d2('0x39')](_0x2bd1e3[_0x85d2('0x3a')],qs[_0x85d2('0x3c')](_0x1b96bc['query'][_0x85d2('0x3c')]));_0x41823a[_0x85d2('0x3b')]=_0x41823a[_0x85d2('0x3b')][_0x85d2('0x3d')]?_0x41823a[_0x85d2('0x3b')]:_0x2bd1e3[_0x85d2('0x3a')];if(!_0x1b96bc['query'][_0x85d2('0x3e')](_0x85d2('0x3f'))){_0x41823a[_0x85d2('0x21')]=qs[_0x85d2('0x21')](_0x1b96bc[_0x85d2('0x37')]['limit']);_0x41823a[_0x85d2('0x1f')]=qs['offset'](_0x1b96bc['query'][_0x85d2('0x1f')]);}_0x41823a[_0x85d2('0x40')]=qs[_0x85d2('0x41')](_0x1b96bc[_0x85d2('0x37')][_0x85d2('0x41')]);_0x41823a['where']=qs[_0x85d2('0x38')](_[_0x85d2('0x42')](_0x1b96bc[_0x85d2('0x37')],_0x2bd1e3[_0x85d2('0x38')]),_0x3a5274);if(_0x1b96bc[_0x85d2('0x37')][_0x85d2('0x43')]){_0x41823a[_0x85d2('0x44')]=_['merge'](_0x41823a['where'],{'$or':_[_0x85d2('0x32')](_0x3a5274,function(_0x23d2bf){if(_0x23d2bf[_0x85d2('0x35')]!==_0x85d2('0x45')){var _0x465fa2={};_0x465fa2[_0x23d2bf['name']]={'$like':'%'+_0x1b96bc['query'][_0x85d2('0x43')]+'%'};return _0x465fa2;}})});}_0x41823a=_[_0x85d2('0x46')]({},_0x41823a,_0x1b96bc[_0x85d2('0x47')]);var _0x4cf881={'where':_0x41823a['where']};return db[_0x85d2('0x48')][_0x85d2('0x22')](_0x4cf881)[_0x85d2('0x29')](function(_0x350916){_0x3393b2[_0x85d2('0x22')]=_0x350916;if(_0x1b96bc[_0x85d2('0x37')][_0x85d2('0x49')]){_0x41823a[_0x85d2('0x4a')]=[{'all':!![]}];}return db[_0x85d2('0x48')][_0x85d2('0x4b')](_0x41823a);})[_0x85d2('0x29')](function(_0x48022b){_0x3393b2[_0x85d2('0x4c')]=_0x48022b;return _0x3393b2;})[_0x85d2('0x29')](respondWithFilteredResult(_0x3f55b6,_0x41823a))[_0x85d2('0x4d')](handleError(_0x3f55b6,null));};exports[_0x85d2('0x4e')]=function(_0x20d57e,_0x5daad6){var _0xea9cdb={'raw':!![],'where':{'id':_0x20d57e['params']['id']}},_0x1e5c4c={};_0x1e5c4c[_0x85d2('0x3a')]=_['keys'](db['Plugin'][_0x85d2('0x33')]);_0x1e5c4c['query']=_[_0x85d2('0x36')](_0x20d57e[_0x85d2('0x37')]);_0x1e5c4c['filters']=_[_0x85d2('0x39')](_0x1e5c4c[_0x85d2('0x3a')],_0x1e5c4c[_0x85d2('0x37')]);_0xea9cdb['attributes']=_['intersection'](_0x1e5c4c[_0x85d2('0x3a')],qs['fields'](_0x20d57e[_0x85d2('0x37')][_0x85d2('0x3c')]));_0xea9cdb['attributes']=_0xea9cdb[_0x85d2('0x3b')][_0x85d2('0x3d')]?_0xea9cdb[_0x85d2('0x3b')]:_0x1e5c4c[_0x85d2('0x3a')];if(_0x20d57e[_0x85d2('0x37')][_0x85d2('0x49')]){_0xea9cdb[_0x85d2('0x4a')]=[{'all':!![]}];}_0xea9cdb=_[_0x85d2('0x46')]({},_0xea9cdb,_0x20d57e['options']);return db[_0x85d2('0x48')][_0x85d2('0x4f')](_0xea9cdb)[_0x85d2('0x29')](handleEntityNotFound(_0x5daad6,null))[_0x85d2('0x29')](respondWithResult(_0x5daad6,null))[_0x85d2('0x4d')](handleError(_0x5daad6,null));};exports[_0x85d2('0x50')]=function(_0x14fec3,_0x1b7297,_0x17f0ab){return db['Plugin']['find']({'where':{'id':_0x14fec3[_0x85d2('0x51')]['id']},'attributes':[_0x85d2('0x2f'),'path'],'raw':!![]})[_0x85d2('0x29')](handleEntityNotFound(_0x1b7297,null))[_0x85d2('0x29')](function(_0x22a006){if(_0x22a006){var _0x4a8b7f=path[_0x85d2('0x52')](config['root'],_0x85d2('0x53'),util[_0x85d2('0x54')](_0x85d2('0x55'),path[_0x85d2('0x56')](_0x22a006['path'])));var _0x3d2aa2=fs['createWriteStream'](_0x4a8b7f);var _0x5c7cbb=archiver(_0x85d2('0x57'),{'zlib':{'level':0x9}});_0x5c7cbb['on'](_0x85d2('0x58'),function(_0x366829){if(_0x366829[_0x85d2('0x59')]===_0x85d2('0x5a')){logger[_0x85d2('0x2d')](_0x366829);}else{throw new db['Sequelize'][(_0x85d2('0x5b'))](_0x85d2('0x5c'));}});_0x5c7cbb['on'](_0x85d2('0x2d'),function(_0x1313fd){throw new db[(_0x85d2('0x5d'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x5c7cbb[_0x85d2('0x5e')](_0x3d2aa2);_0x5c7cbb['glob']('**/*',{'cwd':path[_0x85d2('0x52')](config[_0x85d2('0x5f')],_0x85d2('0x53'),path[_0x85d2('0x60')](_0x22a006[_0x85d2('0x7')])),'ignore':[path[_0x85d2('0x52')](path[_0x85d2('0x56')](_0x22a006[_0x85d2('0x7')]),_0x85d2('0x61')),path[_0x85d2('0x52')](path[_0x85d2('0x56')](_0x22a006['path']),'attachments/**/*')],'nodir':!![]})['finalize']();_0x3d2aa2['on'](_0x85d2('0x62'),function(){if(!fs[_0x85d2('0x63')](_0x4a8b7f)){throw new db[(_0x85d2('0x5d'))][(_0x85d2('0x5b'))](_0x85d2('0x64'));}return _0x1b7297['download'](_0x4a8b7f,util[_0x85d2('0x54')](_0x85d2('0x55'),path[_0x85d2('0x56')](_0x22a006['path'])),function(_0x42762f){if(_0x42762f){throw new db[(_0x85d2('0x5d'))][(_0x85d2('0x5b'))](_0x85d2('0x65'));}fs[_0x85d2('0x66')](_0x4a8b7f);logger['info'](_0x85d2('0x67'));logger[_0x85d2('0x68')](_0x85d2('0x69'));});});}return null;})['catch'](handleError(_0x1b7297,null));};exports['upload']=function(_0x259036,_0x5f162f,_0x2bd05c){var _0x3c2c9a=path['basename'](_0x259036[_0x85d2('0x6a')][_0x85d2('0x6b')],path[_0x85d2('0x6c')](_0x259036['file'][_0x85d2('0x6b')]));var _0xff49c3=path[_0x85d2('0x52')](config['root'],_0x85d2('0x53'),_0x259036[_0x85d2('0x6a')][_0x85d2('0x6b')]);var _0xbd1d30=path[_0x85d2('0x52')](config[_0x85d2('0x5f')],'server/files/plugins',_0x3c2c9a);logger[_0x85d2('0x68')](_0x85d2('0x6d'),_0xff49c3);logger[_0x85d2('0x68')](_0x85d2('0x6e'),_0xbd1d30);try{fs[_0x85d2('0x6f')](_0xff49c3,parseInt('0777',0x8));extract(_0xff49c3,{'dir':_0xbd1d30},function(_0x3bf7ca){if(_0x3bf7ca){logger[_0x85d2('0x2d')](_0x3bf7ca);handleError(_0x3bf7ca,!![]);};var _0x40282c=fs[_0x85d2('0x70')](_0xbd1d30);if(_0x40282c[_0x85d2('0x3d')]>0x1){removeReferences(_0xff49c3,_0xbd1d30);logger[_0x85d2('0x2d')](_0x85d2('0x71'));return _0x2bd05c(new Error(_0x85d2('0x71')));}var _0x59f79e=fs['lstatSync'](path['join'](_0xbd1d30,_0x40282c[0x0]));if(_0x59f79e[_0x85d2('0x72')]()){removeReferences(_0xff49c3,_0xbd1d30);logger[_0x85d2('0x2d')](_0x85d2('0x71'));return _0x2bd05c(new Error(_0x85d2('0x71')));}if(_0x59f79e[_0x85d2('0x73')]()){var _0x27c02e=fs[_0x85d2('0x70')](path[_0x85d2('0x52')](_0xbd1d30,_0x40282c[0x0]));if(_0x27c02e[_0x85d2('0x3d')]===0x0){removeReferences(_0xff49c3,_0xbd1d30);logger[_0x85d2('0x2d')](_0x85d2('0x71'));return _0x2bd05c(new Error(_0x85d2('0x71')));}var _0x5874a9=_0x27c02e['some'](function(_0x589249){return _0x589249===_0x85d2('0x74');});if(!_0x5874a9){return _0x2bd05c(new Error(_0x85d2('0x75')));}var _0x770945=fs['readFileSync'](path[_0x85d2('0x52')](_0xbd1d30,_0x40282c[0x0],_0x85d2('0x74')));var _0x461821=JSON['parse'](_0x770945);if('undefined'==typeof _0x461821['name']){return _0x2bd05c(new Error(_0x85d2('0x76')));}if('undefined'==typeof _0x461821[_0x85d2('0x35')]){return _0x2bd05c(new Error(_0x85d2('0x77')));}if(_0x85d2('0x20')==typeof _0x461821[_0x85d2('0x78')]){return _0x2bd05c(new Error(_0x85d2('0x79')));}if(_0x85d2('0x20')==typeof _0x461821[_0x85d2('0x7a')]){return _0x2bd05c(new Error(_0x85d2('0x7b')));}if(_0x461821['type']===_0x85d2('0x7c')){if('undefined'==typeof _0x461821[_0x85d2('0x7a')][_0x85d2('0x7d')]){return _0x2bd05c(new Error(_0x85d2('0x7e')));}if(_0x85d2('0x20')==typeof _0x461821['parameters']['views']['admin']&&_0x85d2('0x20')==typeof _0x461821[_0x85d2('0x7a')][_0x85d2('0x7d')]['agent']){return _0x2bd05c(new Error(_0x85d2('0x7f')));}}else if(_0x461821[_0x85d2('0x35')]===_0x85d2('0x80')){if('undefined'==typeof _0x461821[_0x85d2('0x7a')][_0x85d2('0x81')]){return _0x2bd05c(new Error(_0x85d2('0x82')));}if(_0x85d2('0x20')==typeof _0x461821[_0x85d2('0x7a')][_0x85d2('0x83')]){return _0x2bd05c(new Error(_0x85d2('0x84')));}}else{return _0x2bd05c(new Error(_0x85d2('0x85')));}var _0x50ecdf=_0x461821[_0x85d2('0x2f')];var _0x4d12a2=_0x461821[_0x85d2('0x86')];var _0x5ea993=_0x461821['type'];var _0x32085b=_0x461821[_0x85d2('0x87')]?_0x461821[_0x85d2('0x87')]:_0x85d2('0x88');var _0x346ac2=_0x461821[_0x85d2('0x89')]?_0x461821[_0x85d2('0x89')]:'icon-apps';var _0x5aff00='';var _0x31d466='';var _0x481223='';var _0x1132cc='';var _0x33a57c=_0x461821[_0x85d2('0x78')];if(_0x5ea993===_0x85d2('0x7c')){if(_0x85d2('0x20')!=typeof _0x461821[_0x85d2('0x7a')][_0x85d2('0x7d')][_0x85d2('0x8a')]){var _0x313ca9=_0x461821[_0x85d2('0x7a')][_0x85d2('0x7d')][_0x85d2('0x8a')];if(!/^(f|ht)tps?:\/\//i['test'](_0x313ca9)){_0x5aff00=path['join'](_0x85d2('0x8b'),_0x3c2c9a,_0x40282c[0x0],_0x313ca9);}else{_0x5aff00=_0x313ca9;}}else{logger[_0x85d2('0x68')](_0x85d2('0x8c'));}if('undefined'!=typeof _0x461821[_0x85d2('0x7a')][_0x85d2('0x7d')][_0x85d2('0x8d')]){var _0x1a3bb0=_0x461821[_0x85d2('0x7a')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0x85d2('0x8e')](_0x1a3bb0)){_0x31d466=path[_0x85d2('0x52')](_0x85d2('0x8b'),_0x3c2c9a,_0x40282c[0x0],_0x1a3bb0);}else{_0x31d466=_0x1a3bb0;}}else{logger[_0x85d2('0x68')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x5ea993===_0x85d2('0x80')){_0x481223=_0x461821[_0x85d2('0x7a')][_0x85d2('0x81')];_0x1132cc=_0x461821[_0x85d2('0x7a')][_0x85d2('0x83')];if('undefined'!=typeof _0x461821[_0x85d2('0x7a')][_0x85d2('0x7d')]){if(_0x85d2('0x20')!=typeof _0x461821[_0x85d2('0x7a')]['views'][_0x85d2('0x8a')]){var _0x313ca9=_0x461821[_0x85d2('0x7a')]['views'][_0x85d2('0x8a')];if(!/^(f|ht)tps?:\/\//i[_0x85d2('0x8e')](_0x313ca9)){_0x5aff00=path[_0x85d2('0x52')](_0x85d2('0x8b'),_0x3c2c9a,_0x40282c[0x0],_0x313ca9);}else{_0x5aff00=_0x313ca9;}}if(_0x85d2('0x20')!=typeof _0x461821[_0x85d2('0x7a')][_0x85d2('0x7d')][_0x85d2('0x8d')]){var _0x1a3bb0=_0x461821[_0x85d2('0x7a')][_0x85d2('0x7d')][_0x85d2('0x8d')];if(!/^(f|ht)tps?:\/\//i[_0x85d2('0x8e')](_0x1a3bb0)){_0x31d466=path[_0x85d2('0x52')](_0x85d2('0x8b'),_0x3c2c9a,_0x40282c[0x0],_0x1a3bb0);}else{_0x31d466=_0x1a3bb0;}}}}var _0x2e65ac={'name':_0x50ecdf,'description':_0x4d12a2,'path':path[_0x85d2('0x52')](_0x3c2c9a,_0x40282c[0x0]),'type':_0x5ea993,'sidebar':_0x32085b,'icon':_0x346ac2,'adminUrl':_0x5aff00,'agentUrl':_0x31d466,'scriptName':_0x481223,'scriptPath':_0x1132cc,'version':_0x33a57c};removeReferences(_0xff49c3,null);return db[_0x85d2('0x48')]['create'](_0x2e65ac)[_0x85d2('0x29')](function(_0x5c062a){var _0x38e00c={'role':_0x259036['body'][_0x85d2('0x8f')],'userProfileId':_0x259036[_0x85d2('0x90')]['userProfileId']};if(!_0x38e00c)throw new Error(_0x85d2('0x91'));if(_0x38e00c[_0x85d2('0x8f')]===_0x85d2('0x92')){var _0x527783=_0x5c062a[_0x85d2('0x2a')]({'plain':!![]});return db['UserProfileSection'][_0x85d2('0x4f')]({'where':{'name':_0x85d2('0x93'),'userProfileId':_0x38e00c[_0x85d2('0x94')]},'raw':!![]})[_0x85d2('0x29')](function(_0x527fe1){if(_0x527fe1&&_0x527fe1[_0x85d2('0x95')]===0x0){return db[_0x85d2('0x2b')][_0x85d2('0x96')]({'name':_0x527783['name'],'resourceId':_0x527783['id'],'type':_0x527fe1[_0x85d2('0x2f')],'sectionId':_0x527fe1['id']},{})[_0x85d2('0x29')](function(){return _0x5c062a;});}else{return _0x5c062a;}})[_0x85d2('0x4d')](function(_0x21c5a5){logger[_0x85d2('0x2d')](_0x85d2('0x97'),_0x21c5a5);throw _0x21c5a5;});}return _0x5c062a;})['then'](respondWithResult(_0x5f162f,null))['catch'](handleError(_0x5f162f,null));}});}catch(_0x2003ad){_0x5f162f[_0x85d2('0x1d')](0x1f4)[_0x85d2('0x30')](_0x2003ad);}};function removeReferences(_0x52a991,_0x288b58){try{if(_0x52a991){fs[_0x85d2('0x66')](_0x52a991);logger[_0x85d2('0x68')]('Zip\x20archive\x20removed');}if(_0x288b58){rimraf(_0x288b58,function(){});logger[_0x85d2('0x68')](_0x85d2('0x98'));}}catch(_0x4145f3){logger[_0x85d2('0x2d')](_0x4145f3);}}exports['update']=function(_0x22f265,_0x5793f8,_0x5184d9){return db['Plugin']['find']({'where':{'id':_0x22f265[_0x85d2('0x51')]['id']}})[_0x85d2('0x29')](handleEntityNotFound(_0x5793f8,null))[_0x85d2('0x29')](saveUpdates(_0x22f265['body'],null))[_0x85d2('0x29')](respondWithResult(_0x5793f8,null))['catch'](handleError(_0x5793f8,null));};exports[_0x85d2('0x99')]=function(_0x331e7d,_0x2c621b,_0x4199f8){return db[_0x85d2('0x48')][_0x85d2('0x4f')]({'where':{'id':_0x331e7d[_0x85d2('0x51')]['id']}})[_0x85d2('0x29')](function(_0x232e15){if(_0x232e15){return _0x232e15[_0x85d2('0x2c')]();}})['then'](function(_0x4e8fbb){rimraf(path[_0x85d2('0x52')](config[_0x85d2('0x5f')],_0x85d2('0x53'),path['dirname'](_0x4e8fbb[_0x85d2('0x7')])),function(){});return _0x4e8fbb;})[_0x85d2('0x29')](handleEntityNotFound(_0x2c621b,null))[_0x85d2('0x29')](respondWithStatusCode(_0x2c621b,null))[_0x85d2('0x4d')](handleError(_0x2c621b,null));};exports[_0x85d2('0x9a')]=function(_0x14b92e,_0x3a2709,_0x1bf7c2){return BPromise['resolve']()[_0x85d2('0x29')](function(){if(!_0x14b92e[_0x85d2('0x37')][_0x85d2('0x7')]){throw new Error(_0x85d2('0x9b'));}if(!_0x14b92e[_0x85d2('0x37')][_0x85d2('0x9c')]){throw new Error(_0x85d2('0x9d'));}var _0x491258=_0x14b92e[_0x85d2('0x37')][_0x85d2('0x9e')]?_0x14b92e[_0x85d2('0x37')]['hostname']+':'+_0x14b92e[_0x85d2('0x37')][_0x85d2('0x9c')]:'http://localhost:'+_0x14b92e[_0x85d2('0x37')]['port'];var _0x33c1db=_0x14b92e['query'][_0x85d2('0x24')]?_0x14b92e[_0x85d2('0x37')][_0x85d2('0x24')]:!![];var _0x560260=_0x14b92e['query']['encoding']?_0x14b92e[_0x85d2('0x37')][_0x85d2('0x9f')]:null;var _0x327ceb={'method':_0x14b92e[_0x85d2('0xa0')],'uri':util[_0x85d2('0x54')]('%s%s',_0x491258,_0x14b92e[_0x85d2('0x37')]['path']),'json':_0x33c1db,'resolveWithFullResponse':!![],'encoding':_0x560260,'qs':_0x14b92e[_0x85d2('0x37')]};if(_0x14b92e[_0x85d2('0xa1')]){_0x327ceb[_0x85d2('0xa1')]=_0x14b92e['headers'];if(_0x327ceb[_0x85d2('0xa1')]['content-length']){delete _0x327ceb['headers']['content-length'];}}if(_0x327ceb[_0x85d2('0xa1')][_0x85d2('0xa2')]){delete _0x327ceb[_0x85d2('0xa1')][_0x85d2('0xa2')];}return rp(_0x327ceb);})['then'](function(_0x3cf279){if(_0x3cf279){_0x3a2709[_0x85d2('0xa3')](_0x3cf279[_0x85d2('0xa1')]);logger[_0x85d2('0x68')](_0x3cf279[_0x85d2('0x90')]);if(_['endsWith'](_0x14b92e[_0x85d2('0x37')][_0x85d2('0x7')],_0x85d2('0x50'))&&_0x3cf279['statusCode']==0x1f4){return _0x3a2709[_0x85d2('0x1c')](_0x3cf279[_0x85d2('0xa4')]);}else{return _0x3a2709['status'](_0x3cf279[_0x85d2('0xa4')])[_0x85d2('0x30')](_0x3cf279['body']);}}else{return _0x3a2709['sendStatus'](0xc8);}})[_0x85d2('0x4d')](handleError(_0x3a2709,null));};exports[_0x85d2('0xa5')]=function(_0x8c6084,_0x5f1508,_0x55ff83){return BPromise['resolve']()[_0x85d2('0x29')](function(){if(!_0x8c6084['query'][_0x85d2('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x8c6084[_0x85d2('0x37')][_0x85d2('0x9c')]){throw new Error(_0x85d2('0x9d'));}var _0x4fe8a9=_0x8c6084[_0x85d2('0x37')][_0x85d2('0x9e')]?_0x8c6084[_0x85d2('0x37')]['hostname']+':'+_0x8c6084[_0x85d2('0x37')][_0x85d2('0x9c')]:'http://localhost:'+_0x8c6084['query'][_0x85d2('0x9c')];var _0x1be963=_0x8c6084[_0x85d2('0x37')][_0x85d2('0x24')]?_0x8c6084[_0x85d2('0x37')][_0x85d2('0x24')]:!![];var _0x3572d9=_0x8c6084[_0x85d2('0x37')]['encoding']?_0x8c6084[_0x85d2('0x37')][_0x85d2('0x9f')]:null;var _0x21761d={'method':_0x8c6084[_0x85d2('0xa0')],'uri':util[_0x85d2('0x54')](_0x85d2('0xa6'),_0x4fe8a9,_0x8c6084['query'][_0x85d2('0x7')]),'json':_0x1be963,'resolveWithFullResponse':!![],'encoding':_0x3572d9,'body':_0x8c6084['body']};if(_0x8c6084['headers']){_0x21761d[_0x85d2('0xa1')]=_0x8c6084[_0x85d2('0xa1')];if(_0x21761d[_0x85d2('0xa1')][_0x85d2('0xa7')]){delete _0x21761d[_0x85d2('0xa1')][_0x85d2('0xa7')];}}if(_0x21761d[_0x85d2('0xa1')][_0x85d2('0xa2')]){delete _0x21761d[_0x85d2('0xa1')][_0x85d2('0xa2')];}return rp(_0x21761d);})[_0x85d2('0x29')](function(_0x2defc7){if(_0x2defc7){_0x5f1508[_0x85d2('0xa3')](_0x2defc7[_0x85d2('0xa1')]);logger[_0x85d2('0x68')](_0x2defc7[_0x85d2('0x90')]);return _0x5f1508[_0x85d2('0x1d')](_0x2defc7[_0x85d2('0xa4')])[_0x85d2('0x30')](_0x2defc7[_0x85d2('0x90')]);}else{return _0x5f1508['sendStatus'](0xc8);}})['catch'](handleError(_0x5f1508,null));}; \ No newline at end of file +var _0x4b69=['Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','statusCode','webhookPost','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','get','UserProfileResource','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','Plugin','findAll','rows','catch','params','intersection','download','find','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','Error','pipe','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','html','test','Warning:\x20admin\x20view\x20not\x20specified','agent','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Plugins','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0xd307d9,_0x50e8e0){var _0x209bf8=function(_0x335069){while(--_0x335069){_0xd307d9['push'](_0xd307d9['shift']());}};_0x209bf8(++_0x50e8e0);}(_0x4b69,0x167));var _0x94b6=function(_0x421e73,_0x2d3fdc){_0x421e73=_0x421e73-0x0;var _0x2f71ec=_0x4b69[_0x421e73];return _0x2f71ec;};'use strict';var emlformat=require(_0x94b6('0x0'));var rimraf=require(_0x94b6('0x1'));var zipdir=require(_0x94b6('0x2'));var jsonpatch=require(_0x94b6('0x3'));var rp=require('request-promise');var moment=require(_0x94b6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x94b6('0x5'));var util=require('util');var path=require(_0x94b6('0x6'));var sox=require(_0x94b6('0x7'));var csv=require(_0x94b6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x94b6('0x9'));var _=require(_0x94b6('0xa'));var squel=require('squel');var crypto=require(_0x94b6('0xb'));var jsforce=require(_0x94b6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x94b6('0x8'));var querystring=require(_0x94b6('0xd'));var Papa=require(_0x94b6('0xe'));var extract=require('extract-zip');var rimraf=require(_0x94b6('0x1'));var archiver=require(_0x94b6('0xf'));var Redis=require(_0x94b6('0x10'));var authService=require(_0x94b6('0x11'));var qs=require(_0x94b6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x94b6('0x13'));var logger=require(_0x94b6('0x14'))(_0x94b6('0x15'));var utils=require('../../config/utils');var config=require(_0x94b6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x94b6('0x17'))['db'];config[_0x94b6('0x18')]=_[_0x94b6('0x19')](config[_0x94b6('0x18')],{'host':_0x94b6('0x1a'),'port':0x18eb});var socket=require(_0x94b6('0x1b'))(new Redis(config[_0x94b6('0x18')]));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0x388a42,_0x1a058f){_0x1a058f=_0x1a058f||0xcc;return function(_0x417684){if(_0x417684){return _0x388a42[_0x94b6('0x1c')](_0x1a058f);}return _0x388a42[_0x94b6('0x1d')](_0x1a058f)[_0x94b6('0x1e')]();};}function respondWithResult(_0x56dfd6,_0x1c0dac){_0x1c0dac=_0x1c0dac||0xc8;return function(_0xee926c){if(_0xee926c){return _0x56dfd6['status'](_0x1c0dac)[_0x94b6('0x1f')](_0xee926c);}};}function respondWithFilteredResult(_0x5d8da6,_0x468d89){return function(_0xc48750){if(_0xc48750){var _0x562789=typeof _0x468d89['offset']===_0x94b6('0x20')&&typeof _0x468d89[_0x94b6('0x21')]===_0x94b6('0x20');var _0xfb7fad=_0xc48750[_0x94b6('0x22')];var _0x16803d=_0x562789?0x0:_0x468d89[_0x94b6('0x23')];var _0x2de390=_0x562789?_0xc48750[_0x94b6('0x22')]:_0x468d89[_0x94b6('0x23')]+_0x468d89[_0x94b6('0x21')];var _0x11be18;if(_0x2de390>=_0xfb7fad){_0x2de390=_0xfb7fad;_0x11be18=0xc8;}else{_0x11be18=0xce;}_0x5d8da6[_0x94b6('0x1d')](_0x11be18);return _0x5d8da6['set'](_0x94b6('0x24'),_0x16803d+'-'+_0x2de390+'/'+_0xfb7fad)['json'](_0xc48750);}return null;};}function patchUpdates(_0xa1db5a){return function(_0xc2ce2f){try{jsonpatch[_0x94b6('0x25')](_0xc2ce2f,_0xa1db5a,!![]);}catch(_0x218666){return BPromise[_0x94b6('0x26')](_0x218666);}return _0xc2ce2f['save']();};}function saveUpdates(_0x24e331,_0x1f5ed4){return function(_0x50ddb6){if(_0x50ddb6){return _0x50ddb6[_0x94b6('0x27')](_0x24e331)[_0x94b6('0x28')](function(_0x4adff0){return _0x4adff0;});}return null;};}function removeEntity(_0x347bef,_0x4673b9){return function(_0x3006e5){if(_0x3006e5){return _0x3006e5['destroy']()[_0x94b6('0x28')](function(){var _0x429619=_0x3006e5[_0x94b6('0x29')]({'plain':!![]});var _0x77aabe='Plugins';return db[_0x94b6('0x2a')][_0x94b6('0x2b')]({'where':{'type':_0x77aabe,'resourceId':_0x429619['id']}})['then'](function(){return _0x3006e5;});})[_0x94b6('0x28')](function(){_0x347bef[_0x94b6('0x1d')](0xcc)[_0x94b6('0x1e')]();});}};}function handleEntityNotFound(_0x5e2397,_0x1580fa){return function(_0x342fac){if(!_0x342fac){_0x5e2397[_0x94b6('0x1c')](0x194);}return _0x342fac;};}function handleError(_0x20a0b6,_0x26bb5c){_0x26bb5c=_0x26bb5c||0x1f4;return function(_0x41073c){logger[_0x94b6('0x2c')](_0x41073c[_0x94b6('0x2d')]);if(_0x41073c[_0x94b6('0x2e')]){delete _0x41073c['name'];}_0x20a0b6[_0x94b6('0x1d')](_0x26bb5c)[_0x94b6('0x2f')](_0x41073c);};}exports['index']=function(_0x1ad588,_0x1db019){var _0x368561={},_0x3107c1={},_0x33822e={'count':0x0,'rows':[]};var _0x503f20=_[_0x94b6('0x30')](db['Plugin'][_0x94b6('0x31')],function(_0x7077ed){return{'name':_0x7077ed[_0x94b6('0x32')],'type':_0x7077ed[_0x94b6('0x33')][_0x94b6('0x34')]};});_0x3107c1['model']=_[_0x94b6('0x30')](_0x503f20,_0x94b6('0x2e'));_0x3107c1[_0x94b6('0x35')]=_[_0x94b6('0x36')](_0x1ad588[_0x94b6('0x35')]);_0x3107c1['filters']=_['intersection'](_0x3107c1[_0x94b6('0x37')],_0x3107c1['query']);_0x368561[_0x94b6('0x38')]=_['intersection'](_0x3107c1[_0x94b6('0x37')],qs[_0x94b6('0x39')](_0x1ad588[_0x94b6('0x35')][_0x94b6('0x39')]));_0x368561[_0x94b6('0x38')]=_0x368561['attributes'][_0x94b6('0x3a')]?_0x368561[_0x94b6('0x38')]:_0x3107c1[_0x94b6('0x37')];if(!_0x1ad588[_0x94b6('0x35')][_0x94b6('0x3b')](_0x94b6('0x3c'))){_0x368561[_0x94b6('0x21')]=qs[_0x94b6('0x21')](_0x1ad588[_0x94b6('0x35')][_0x94b6('0x21')]);_0x368561[_0x94b6('0x23')]=qs[_0x94b6('0x23')](_0x1ad588[_0x94b6('0x35')]['offset']);}_0x368561[_0x94b6('0x3d')]=qs[_0x94b6('0x3e')](_0x1ad588['query'][_0x94b6('0x3e')]);_0x368561[_0x94b6('0x3f')]=qs[_0x94b6('0x40')](_[_0x94b6('0x41')](_0x1ad588[_0x94b6('0x35')],_0x3107c1[_0x94b6('0x40')]),_0x503f20);if(_0x1ad588[_0x94b6('0x35')]['filter']){_0x368561[_0x94b6('0x3f')]=_[_0x94b6('0x42')](_0x368561['where'],{'$or':_[_0x94b6('0x30')](_0x503f20,function(_0x4d87ce){if(_0x4d87ce[_0x94b6('0x33')]!==_0x94b6('0x43')){var _0xbadfd6={};_0xbadfd6[_0x4d87ce['name']]={'$like':'%'+_0x1ad588[_0x94b6('0x35')][_0x94b6('0x44')]+'%'};return _0xbadfd6;}})});}_0x368561=_[_0x94b6('0x42')]({},_0x368561,_0x1ad588[_0x94b6('0x45')]);var _0x52a38b={'where':_0x368561[_0x94b6('0x3f')]};return db['Plugin'][_0x94b6('0x22')](_0x52a38b)[_0x94b6('0x28')](function(_0x53e290){_0x33822e[_0x94b6('0x22')]=_0x53e290;if(_0x1ad588[_0x94b6('0x35')][_0x94b6('0x46')]){_0x368561[_0x94b6('0x47')]=[{'all':!![]}];}return db[_0x94b6('0x48')][_0x94b6('0x49')](_0x368561);})[_0x94b6('0x28')](function(_0x5b6e0c){_0x33822e[_0x94b6('0x4a')]=_0x5b6e0c;return _0x33822e;})[_0x94b6('0x28')](respondWithFilteredResult(_0x1db019,_0x368561))[_0x94b6('0x4b')](handleError(_0x1db019,null));};exports['show']=function(_0xdc4715,_0x272263){var _0x16d499={'raw':!![],'where':{'id':_0xdc4715[_0x94b6('0x4c')]['id']}},_0x1c0ad4={};_0x1c0ad4['model']=_[_0x94b6('0x36')](db[_0x94b6('0x48')][_0x94b6('0x31')]);_0x1c0ad4['query']=_['keys'](_0xdc4715['query']);_0x1c0ad4[_0x94b6('0x40')]=_[_0x94b6('0x4d')](_0x1c0ad4[_0x94b6('0x37')],_0x1c0ad4[_0x94b6('0x35')]);_0x16d499['attributes']=_['intersection'](_0x1c0ad4['model'],qs[_0x94b6('0x39')](_0xdc4715[_0x94b6('0x35')][_0x94b6('0x39')]));_0x16d499[_0x94b6('0x38')]=_0x16d499[_0x94b6('0x38')][_0x94b6('0x3a')]?_0x16d499[_0x94b6('0x38')]:_0x1c0ad4[_0x94b6('0x37')];if(_0xdc4715[_0x94b6('0x35')][_0x94b6('0x46')]){_0x16d499[_0x94b6('0x47')]=[{'all':!![]}];}_0x16d499=_['merge']({},_0x16d499,_0xdc4715['options']);return db['Plugin']['find'](_0x16d499)[_0x94b6('0x28')](handleEntityNotFound(_0x272263,null))[_0x94b6('0x28')](respondWithResult(_0x272263,null))[_0x94b6('0x4b')](handleError(_0x272263,null));};exports[_0x94b6('0x4e')]=function(_0x28e959,_0x13001d,_0x179952){return db[_0x94b6('0x48')][_0x94b6('0x4f')]({'where':{'id':_0x28e959[_0x94b6('0x4c')]['id']},'attributes':[_0x94b6('0x2e'),_0x94b6('0x6')],'raw':!![]})[_0x94b6('0x28')](handleEntityNotFound(_0x13001d,null))[_0x94b6('0x28')](function(_0x367982){if(_0x367982){var _0x12b8c1=path[_0x94b6('0x50')](config[_0x94b6('0x51')],_0x94b6('0x52'),util[_0x94b6('0x53')](_0x94b6('0x54'),path[_0x94b6('0x55')](_0x367982[_0x94b6('0x6')])));var _0x33e94d=fs[_0x94b6('0x56')](_0x12b8c1);var _0x3f09b9=archiver(_0x94b6('0x57'),{'zlib':{'level':0x9}});_0x3f09b9['on'](_0x94b6('0x58'),function(_0x34acd5){if(_0x34acd5[_0x94b6('0x59')]===_0x94b6('0x5a')){logger[_0x94b6('0x2c')](_0x34acd5);}else{throw new db['Sequelize']['Error'](_0x94b6('0x5b'));}});_0x3f09b9['on'](_0x94b6('0x2c'),function(_0x263061){throw new db[(_0x94b6('0x5c'))][(_0x94b6('0x5d'))](_0x94b6('0x5b'));});_0x3f09b9[_0x94b6('0x5e')](_0x33e94d);_0x3f09b9['glob'](_0x94b6('0x5f'),{'cwd':path[_0x94b6('0x50')](config[_0x94b6('0x51')],_0x94b6('0x52'),path[_0x94b6('0x60')](_0x367982[_0x94b6('0x6')])),'ignore':[path[_0x94b6('0x50')](path[_0x94b6('0x55')](_0x367982[_0x94b6('0x6')]),_0x94b6('0x61')),path[_0x94b6('0x50')](path[_0x94b6('0x55')](_0x367982[_0x94b6('0x6')]),_0x94b6('0x62'))],'nodir':!![]})[_0x94b6('0x63')]();_0x33e94d['on'](_0x94b6('0x64'),function(){if(!fs['existsSync'](_0x12b8c1)){throw new db['Sequelize'][(_0x94b6('0x5d'))]('Plugin\x20not\x20found');}return _0x13001d[_0x94b6('0x4e')](_0x12b8c1,util[_0x94b6('0x53')]('%s.zip',path[_0x94b6('0x55')](_0x367982[_0x94b6('0x6')])),function(_0x2e2cce){if(_0x2e2cce){throw new db[(_0x94b6('0x5c'))][(_0x94b6('0x5d'))](_0x94b6('0x65'));}fs[_0x94b6('0x66')](_0x12b8c1);logger['info'](_0x94b6('0x67'));logger[_0x94b6('0x68')](_0x94b6('0x69'));});});}return null;})[_0x94b6('0x4b')](handleError(_0x13001d,null));};exports['upload']=function(_0x2f8352,_0x1338d4,_0x3dfb52){var _0x5e6bcf=path[_0x94b6('0x55')](_0x2f8352['file'][_0x94b6('0x6a')],path[_0x94b6('0x6b')](_0x2f8352[_0x94b6('0x6c')][_0x94b6('0x6a')]));var _0x5c009f=path[_0x94b6('0x50')](config[_0x94b6('0x51')],_0x94b6('0x52'),_0x2f8352[_0x94b6('0x6c')]['filename']);var _0x5a7ecc=path[_0x94b6('0x50')](config[_0x94b6('0x51')],'server/files/plugins',_0x5e6bcf);logger[_0x94b6('0x68')](_0x94b6('0x6d'),_0x5c009f);logger[_0x94b6('0x68')]('Plugin\x20upload\x20destination:\x20%s',_0x5a7ecc);try{fs['chmodSync'](_0x5c009f,parseInt(_0x94b6('0x6e'),0x8));extract(_0x5c009f,{'dir':_0x5a7ecc},function(_0x4032c8){if(_0x4032c8){logger[_0x94b6('0x2c')](_0x4032c8);handleError(_0x4032c8,!![]);};var _0x4501b4=fs[_0x94b6('0x6f')](_0x5a7ecc);if(_0x4501b4['length']>0x1){removeReferences(_0x5c009f,_0x5a7ecc);logger[_0x94b6('0x2c')](_0x94b6('0x70'));return _0x3dfb52(new Error(_0x94b6('0x70')));}var _0x36dd92=fs[_0x94b6('0x71')](path['join'](_0x5a7ecc,_0x4501b4[0x0]));if(_0x36dd92[_0x94b6('0x72')]()){removeReferences(_0x5c009f,_0x5a7ecc);logger[_0x94b6('0x2c')]('Invalid\x20plugin\x20structure');return _0x3dfb52(new Error('Invalid\x20plugin\x20structure'));}if(_0x36dd92[_0x94b6('0x73')]()){var _0x5cbe85=fs[_0x94b6('0x6f')](path['join'](_0x5a7ecc,_0x4501b4[0x0]));if(_0x5cbe85[_0x94b6('0x3a')]===0x0){removeReferences(_0x5c009f,_0x5a7ecc);logger[_0x94b6('0x2c')]('Invalid\x20plugin\x20structure');return _0x3dfb52(new Error('Invalid\x20plugin\x20structure'));}var _0x3be058=_0x5cbe85['some'](function(_0x4023ac){return _0x4023ac===_0x94b6('0x74');});if(!_0x3be058){return _0x3dfb52(new Error(_0x94b6('0x75')));}var _0x1d28e8=fs[_0x94b6('0x76')](path[_0x94b6('0x50')](_0x5a7ecc,_0x4501b4[0x0],'manifest.json'));var _0x412530=JSON[_0x94b6('0x77')](_0x1d28e8);if(_0x94b6('0x20')==typeof _0x412530[_0x94b6('0x2e')]){return _0x3dfb52(new Error(_0x94b6('0x78')));}if(_0x94b6('0x20')==typeof _0x412530[_0x94b6('0x33')]){return _0x3dfb52(new Error(_0x94b6('0x79')));}if(_0x94b6('0x20')==typeof _0x412530[_0x94b6('0x7a')]){return _0x3dfb52(new Error(_0x94b6('0x7b')));}if(_0x94b6('0x20')==typeof _0x412530['parameters']){return _0x3dfb52(new Error(_0x94b6('0x7c')));}if(_0x412530['type']==='html'){if(_0x94b6('0x20')==typeof _0x412530[_0x94b6('0x7d')][_0x94b6('0x7e')]){return _0x3dfb52(new Error(_0x94b6('0x7f')));}if(_0x94b6('0x20')==typeof _0x412530[_0x94b6('0x7d')][_0x94b6('0x7e')][_0x94b6('0x80')]&&_0x94b6('0x20')==typeof _0x412530[_0x94b6('0x7d')]['views']['agent']){return _0x3dfb52(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x412530['type']===_0x94b6('0x81')){if(_0x94b6('0x20')==typeof _0x412530[_0x94b6('0x7d')][_0x94b6('0x82')]){return _0x3dfb52(new Error(_0x94b6('0x83')));}if(_0x94b6('0x20')==typeof _0x412530[_0x94b6('0x7d')][_0x94b6('0x84')]){return _0x3dfb52(new Error(_0x94b6('0x85')));}}else{return _0x3dfb52(new Error(_0x94b6('0x86')));}var _0x3f580a=_0x412530[_0x94b6('0x2e')];var _0x220b6b=_0x412530[_0x94b6('0x87')];var _0xdf57bc=_0x412530[_0x94b6('0x33')];var _0x55cf24=_0x412530[_0x94b6('0x88')]?_0x412530[_0x94b6('0x88')]:'always';var _0x3f3bad=_0x412530[_0x94b6('0x89')]?_0x412530[_0x94b6('0x89')]:'icon-apps';var _0x4b76d0='';var _0x6b4c9f='';var _0x98bb63='';var _0x55077e='';var _0x154cab=_0x412530['version'];if(_0xdf57bc===_0x94b6('0x8a')){if(_0x94b6('0x20')!=typeof _0x412530[_0x94b6('0x7d')]['views'][_0x94b6('0x80')]){var _0x344454=_0x412530[_0x94b6('0x7d')][_0x94b6('0x7e')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x94b6('0x8b')](_0x344454)){_0x4b76d0=path[_0x94b6('0x50')]('plugins',_0x5e6bcf,_0x4501b4[0x0],_0x344454);}else{_0x4b76d0=_0x344454;}}else{logger[_0x94b6('0x68')](_0x94b6('0x8c'));}if('undefined'!=typeof _0x412530[_0x94b6('0x7d')][_0x94b6('0x7e')][_0x94b6('0x8d')]){var _0x2be677=_0x412530[_0x94b6('0x7d')][_0x94b6('0x7e')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x94b6('0x8b')](_0x2be677)){_0x6b4c9f=path[_0x94b6('0x50')](_0x94b6('0x8e'),_0x5e6bcf,_0x4501b4[0x0],_0x2be677);}else{_0x6b4c9f=_0x2be677;}}else{logger[_0x94b6('0x68')](_0x94b6('0x8f'));}}else if(_0xdf57bc===_0x94b6('0x81')){_0x98bb63=_0x412530['parameters']['scriptName'];_0x55077e=_0x412530[_0x94b6('0x7d')][_0x94b6('0x84')];if(_0x94b6('0x20')!=typeof _0x412530[_0x94b6('0x7d')][_0x94b6('0x7e')]){if(_0x94b6('0x20')!=typeof _0x412530[_0x94b6('0x7d')][_0x94b6('0x7e')][_0x94b6('0x80')]){var _0x344454=_0x412530[_0x94b6('0x7d')][_0x94b6('0x7e')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x94b6('0x8b')](_0x344454)){_0x4b76d0=path[_0x94b6('0x50')]('plugins',_0x5e6bcf,_0x4501b4[0x0],_0x344454);}else{_0x4b76d0=_0x344454;}}if('undefined'!=typeof _0x412530[_0x94b6('0x7d')][_0x94b6('0x7e')]['agent']){var _0x2be677=_0x412530[_0x94b6('0x7d')][_0x94b6('0x7e')][_0x94b6('0x8d')];if(!/^(f|ht)tps?:\/\//i[_0x94b6('0x8b')](_0x2be677)){_0x6b4c9f=path[_0x94b6('0x50')](_0x94b6('0x8e'),_0x5e6bcf,_0x4501b4[0x0],_0x2be677);}else{_0x6b4c9f=_0x2be677;}}}}var _0x438d98={'name':_0x3f580a,'description':_0x220b6b,'path':path[_0x94b6('0x50')](_0x5e6bcf,_0x4501b4[0x0]),'type':_0xdf57bc,'sidebar':_0x55cf24,'icon':_0x3f3bad,'adminUrl':_0x4b76d0,'agentUrl':_0x6b4c9f,'scriptName':_0x98bb63,'scriptPath':_0x55077e,'version':_0x154cab};removeReferences(_0x5c009f,null);return db['Plugin'][_0x94b6('0x90')](_0x438d98)[_0x94b6('0x28')](function(_0x2eb565){var _0x202ae8={'role':_0x2f8352[_0x94b6('0x91')][_0x94b6('0x92')],'userProfileId':_0x2f8352['body']['userProfileId']};if(!_0x202ae8)throw new Error(_0x94b6('0x93'));if(_0x202ae8[_0x94b6('0x92')]===_0x94b6('0x94')){var _0x54be98=_0x2eb565['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x94b6('0x95'),'userProfileId':_0x202ae8['userProfileId']},'raw':!![]})[_0x94b6('0x28')](function(_0x54e2c7){if(_0x54e2c7&&_0x54e2c7['autoAssociation']===0x0){return db[_0x94b6('0x2a')][_0x94b6('0x90')]({'name':_0x54be98[_0x94b6('0x2e')],'resourceId':_0x54be98['id'],'type':_0x54e2c7[_0x94b6('0x2e')],'sectionId':_0x54e2c7['id']},{})[_0x94b6('0x28')](function(){return _0x2eb565;});}else{return _0x2eb565;}})[_0x94b6('0x4b')](function(_0x488cc3){logger[_0x94b6('0x2c')](_0x94b6('0x96'),_0x488cc3);throw _0x488cc3;});}return _0x2eb565;})[_0x94b6('0x28')](respondWithResult(_0x1338d4,null))[_0x94b6('0x4b')](handleError(_0x1338d4,null));}});}catch(_0x231a29){_0x1338d4['status'](0x1f4)['send'](_0x231a29);}};function removeReferences(_0x3b4af7,_0x30b84a){try{if(_0x3b4af7){fs[_0x94b6('0x66')](_0x3b4af7);logger[_0x94b6('0x68')](_0x94b6('0x97'));}if(_0x30b84a){rimraf(_0x30b84a,function(){});logger[_0x94b6('0x68')](_0x94b6('0x98'));}}catch(_0x3fbb06){logger[_0x94b6('0x2c')](_0x3fbb06);}}exports[_0x94b6('0x27')]=function(_0x15dd8b,_0x3fd061,_0x5258ff){return db['Plugin'][_0x94b6('0x4f')]({'where':{'id':_0x15dd8b[_0x94b6('0x4c')]['id']}})[_0x94b6('0x28')](handleEntityNotFound(_0x3fd061,null))[_0x94b6('0x28')](saveUpdates(_0x15dd8b[_0x94b6('0x91')],null))['then'](respondWithResult(_0x3fd061,null))[_0x94b6('0x4b')](handleError(_0x3fd061,null));};exports[_0x94b6('0x99')]=function(_0x429005,_0xa41b25,_0x2f6718){return db['Plugin'][_0x94b6('0x4f')]({'where':{'id':_0x429005[_0x94b6('0x4c')]['id']}})['then'](function(_0x1bf523){if(_0x1bf523){return _0x1bf523['destroy']();}})[_0x94b6('0x28')](function(_0x7f75c3){rimraf(path['join'](config[_0x94b6('0x51')],'server/files/plugins',path['dirname'](_0x7f75c3[_0x94b6('0x6')])),function(){});return _0x7f75c3;})[_0x94b6('0x28')](handleEntityNotFound(_0xa41b25,null))[_0x94b6('0x28')](respondWithStatusCode(_0xa41b25,null))[_0x94b6('0x4b')](handleError(_0xa41b25,null));};exports[_0x94b6('0x9a')]=function(_0x581af1,_0x1dc93e,_0x4c2cc8){return BPromise[_0x94b6('0x9b')]()[_0x94b6('0x28')](function(){if(!_0x581af1[_0x94b6('0x35')][_0x94b6('0x6')]){throw new Error(_0x94b6('0x9c'));}if(!_0x581af1[_0x94b6('0x35')]['port']){throw new Error(_0x94b6('0x9d'));}var _0x327a6f=_0x581af1['query']['hostname']?_0x581af1[_0x94b6('0x35')][_0x94b6('0x9e')]+':'+_0x581af1[_0x94b6('0x35')][_0x94b6('0x9f')]:_0x94b6('0xa0')+_0x581af1[_0x94b6('0x35')]['port'];var _0x145657=_0x581af1['query']['json']?_0x581af1[_0x94b6('0x35')][_0x94b6('0x1f')]:!![];var _0x464802=_0x581af1[_0x94b6('0x35')][_0x94b6('0xa1')]?_0x581af1[_0x94b6('0x35')]['encoding']:null;var _0x3a2635={'method':_0x581af1[_0x94b6('0xa2')],'uri':util[_0x94b6('0x53')](_0x94b6('0xa3'),_0x327a6f,_0x581af1[_0x94b6('0x35')][_0x94b6('0x6')]),'json':_0x145657,'resolveWithFullResponse':!![],'encoding':_0x464802,'qs':_0x581af1[_0x94b6('0x35')]};if(_0x581af1[_0x94b6('0xa4')]){_0x3a2635['headers']=_0x581af1[_0x94b6('0xa4')];if(_0x3a2635['headers'][_0x94b6('0xa5')]){delete _0x3a2635[_0x94b6('0xa4')]['content-length'];}}if(_0x3a2635[_0x94b6('0xa4')]['content-type']){delete _0x3a2635[_0x94b6('0xa4')][_0x94b6('0xa6')];}return rp(_0x3a2635);})[_0x94b6('0x28')](function(_0x48afa4){if(_0x48afa4){_0x1dc93e[_0x94b6('0xa7')](_0x48afa4['headers']);logger[_0x94b6('0x68')](_0x48afa4['body']);if(_['endsWith'](_0x581af1[_0x94b6('0x35')]['path'],_0x94b6('0x4e'))&&_0x48afa4[_0x94b6('0xa8')]==0x1f4){return _0x1dc93e[_0x94b6('0x1c')](_0x48afa4[_0x94b6('0xa8')]);}else{return _0x1dc93e['status'](_0x48afa4[_0x94b6('0xa8')])[_0x94b6('0x2f')](_0x48afa4[_0x94b6('0x91')]);}}else{return _0x1dc93e[_0x94b6('0x1c')](0xc8);}})['catch'](handleError(_0x1dc93e,null));};exports[_0x94b6('0xa9')]=function(_0xed08e5,_0x2fbe68,_0x19082d){return BPromise[_0x94b6('0x9b')]()['then'](function(){if(!_0xed08e5[_0x94b6('0x35')][_0x94b6('0x6')]){throw new Error(_0x94b6('0x9c'));}if(!_0xed08e5[_0x94b6('0x35')]['port']){throw new Error(_0x94b6('0x9d'));}var _0x4d9bd7=_0xed08e5[_0x94b6('0x35')][_0x94b6('0x9e')]?_0xed08e5[_0x94b6('0x35')][_0x94b6('0x9e')]+':'+_0xed08e5[_0x94b6('0x35')]['port']:'http://localhost:'+_0xed08e5['query'][_0x94b6('0x9f')];var _0x2d45c1=_0xed08e5[_0x94b6('0x35')][_0x94b6('0x1f')]?_0xed08e5['query'][_0x94b6('0x1f')]:!![];var _0x223375=_0xed08e5[_0x94b6('0x35')][_0x94b6('0xa1')]?_0xed08e5[_0x94b6('0x35')][_0x94b6('0xa1')]:null;var _0x186f54={'method':_0xed08e5[_0x94b6('0xa2')],'uri':util[_0x94b6('0x53')]('%s%s',_0x4d9bd7,_0xed08e5[_0x94b6('0x35')]['path']),'json':_0x2d45c1,'resolveWithFullResponse':!![],'encoding':_0x223375,'body':_0xed08e5[_0x94b6('0x91')]};if(_0xed08e5[_0x94b6('0xa4')]){_0x186f54[_0x94b6('0xa4')]=_0xed08e5[_0x94b6('0xa4')];if(_0x186f54[_0x94b6('0xa4')][_0x94b6('0xa5')]){delete _0x186f54[_0x94b6('0xa4')][_0x94b6('0xa5')];}}if(_0x186f54['headers'][_0x94b6('0xa6')]){delete _0x186f54[_0x94b6('0xa4')][_0x94b6('0xa6')];}return rp(_0x186f54);})[_0x94b6('0x28')](function(_0x44aff0){if(_0x44aff0){_0x2fbe68[_0x94b6('0xa7')](_0x44aff0[_0x94b6('0xa4')]);logger[_0x94b6('0x68')](_0x44aff0[_0x94b6('0x91')]);return _0x2fbe68[_0x94b6('0x1d')](_0x44aff0[_0x94b6('0xa8')])['send'](_0x44aff0[_0x94b6('0x91')]);}else{return _0x2fbe68[_0x94b6('0x1c')](0xc8);}})[_0x94b6('0x4b')](handleError(_0x2fbe68,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 1143586..7b5549c 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 _0xc627=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','Plugin','setMaxListeners'];(function(_0x59322f,_0x4f19e9){var _0x5d623e=function(_0x2f0d9f){while(--_0x2f0d9f){_0x59322f['push'](_0x59322f['shift']());}};_0x5d623e(++_0x4f19e9);}(_0xc627,0x14a));var _0x7c62=function(_0x507c8d,_0x54f59b){_0x507c8d=_0x507c8d-0x0;var _0x6052ec=_0xc627[_0x507c8d];return _0x6052ec;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x7c62('0x0'))['db'][_0x7c62('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x7c62('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7c62('0x3'),'afterDestroy':_0x7c62('0x4')};function emitEvent(_0x2f79e5){return function(_0x313d80,_0x121766,_0x35859a){PluginEvents[_0x7c62('0x5')](_0x2f79e5+':'+_0x313d80['id'],_0x313d80);PluginEvents[_0x7c62('0x5')](_0x2f79e5,_0x313d80);_0x35859a(null);};}for(var e in events){if(events[_0x7c62('0x6')](e)){var event=events[e];Plugin[_0x7c62('0x7')](e,emitEvent(event));}}module[_0x7c62('0x8')]=PluginEvents; \ No newline at end of file +var _0x21cd=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners'];(function(_0x2c1dcd,_0x350452){var _0x158ce5=function(_0x5c1c57){while(--_0x5c1c57){_0x2c1dcd['push'](_0x2c1dcd['shift']());}};_0x158ce5(++_0x350452);}(_0x21cd,0x6a));var _0xd21c=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x21cd[_0x199572];return _0x13cfa3;};'use strict';var EventEmitter=require(_0xd21c('0x0'));var Plugin=require(_0xd21c('0x1'))['db'][_0xd21c('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xd21c('0x3')](0x0);var events={'afterCreate':_0xd21c('0x4'),'afterUpdate':_0xd21c('0x5'),'afterDestroy':_0xd21c('0x6')};function emitEvent(_0xd67178){return function(_0x4122cb,_0x53e0b2,_0x5902fc){PluginEvents[_0xd21c('0x7')](_0xd67178+':'+_0x4122cb['id'],_0x4122cb);PluginEvents[_0xd21c('0x7')](_0xd67178,_0x4122cb);_0x5902fc(null);};}for(var e in events){if(events[_0xd21c('0x8')](e)){var event=events[e];Plugin[_0xd21c('0x9')](e,emitEvent(event));}}module[_0xd21c('0xa')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 37d6979..f973ec4 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 _0xda8b=['request-promise','path','rimraf','../../config/environment','exports','define','plugins','lodash','util','moment','bluebird'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xda8b,0x96));var _0xbda8=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xda8b[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0xbda8('0x0'));var util=require(_0xbda8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbda8('0x2'));var BPromise=require(_0xbda8('0x3'));var rp=require(_0xbda8('0x4'));var fs=require('fs');var path=require(_0xbda8('0x5'));var rimraf=require(_0xbda8('0x6'));var config=require(_0xbda8('0x7'));var attributes=require('./plugin.attributes');module[_0xbda8('0x8')]=function(_0x5c1361,_0x5d0dbe){return _0x5c1361[_0xbda8('0x9')]('Plugin',attributes,{'tableName':_0xbda8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdfb4=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','util','../../config/logger'];(function(_0x3313c5,_0x1c3309){var _0x45923a=function(_0x280ccf){while(--_0x280ccf){_0x3313c5['push'](_0x3313c5['shift']());}};_0x45923a(++_0x1c3309);}(_0xdfb4,0x169));var _0x4dfb=function(_0x3dc8b9,_0xe3d669){_0x3dc8b9=_0x3dc8b9-0x0;var _0x27918f=_0xdfb4[_0x3dc8b9];return _0x27918f;};'use strict';var _=require(_0x4dfb('0x0'));var util=require(_0x4dfb('0x1'));var logger=require(_0x4dfb('0x2'))(_0x4dfb('0x3'));var moment=require(_0x4dfb('0x4'));var BPromise=require(_0x4dfb('0x5'));var rp=require(_0x4dfb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4dfb('0x7'));var config=require(_0x4dfb('0x8'));var attributes=require(_0x4dfb('0x9'));module[_0x4dfb('0xa')]=function(_0xe2ec60,_0x169f07){return _0xe2ec60[_0x4dfb('0xb')](_0x4dfb('0xc'),attributes,{'tableName':_0x4dfb('0xd'),'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 aba7f37..2bffd05 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 _0xc6e4=['error','code','message','request\x20sent','result','catch','Plugin','create','options','raw','then','CreatePlugin','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','socket.io-emitter','redis','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','stringify'];(function(_0x28269a,_0x48ffe2){var _0x3f3c6d=function(_0x2004ae){while(--_0x2004ae){_0x28269a['push'](_0x28269a['shift']());}};_0x3f3c6d(++_0x48ffe2);}(_0xc6e4,0x1a5));var _0x4c6e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc6e4[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x4c6e('0x0'));var util=require('util');var moment=require(_0x4c6e('0x1'));var BPromise=require(_0x4c6e('0x2'));var rs=require(_0x4c6e('0x3'));var fs=require('fs');var Redis=require(_0x4c6e('0x4'));var db=require(_0x4c6e('0x5'))['db'];var utils=require(_0x4c6e('0x6'));var logger=require(_0x4c6e('0x7'))(_0x4c6e('0x8'));var config=require(_0x4c6e('0x9'));var jayson=require(_0x4c6e('0xa'));var client=jayson[_0x4c6e('0xb')]['http']({'port':0x232a});config['redis']=_[_0x4c6e('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4c6e('0xd'))(new Redis(config[_0x4c6e('0xe')]));require(_0x4c6e('0xf'))[_0x4c6e('0x10')](socket);function respondWithRpcPromise(_0x37cb98,_0x561dbf,_0x3dbf48){return new BPromise(function(_0xb58fe9,_0xc8ab78){return client[_0x4c6e('0x11')](_0x37cb98,_0x3dbf48)['then'](function(_0x16615b){logger[_0x4c6e('0x12')](_0x4c6e('0x13'),_0x561dbf,'request\x20sent');logger['debug']('Plugin,\x20%s,\x20%s,\x20%s',_0x561dbf,'request\x20sent',JSON[_0x4c6e('0x14')](_0x16615b));if(_0x16615b[_0x4c6e('0x15')]){if(_0x16615b[_0x4c6e('0x15')][_0x4c6e('0x16')]===0x1f4){logger[_0x4c6e('0x15')](_0x4c6e('0x13'),_0x561dbf,_0x16615b[_0x4c6e('0x15')][_0x4c6e('0x17')]);return _0xc8ab78(_0x16615b['error']['message']);}logger[_0x4c6e('0x15')](_0x4c6e('0x13'),_0x561dbf,_0x16615b[_0x4c6e('0x15')][_0x4c6e('0x17')]);return _0xb58fe9(_0x16615b[_0x4c6e('0x15')][_0x4c6e('0x17')]);}else{logger[_0x4c6e('0x12')](_0x4c6e('0x13'),_0x561dbf,_0x4c6e('0x18'));_0xb58fe9(_0x16615b[_0x4c6e('0x19')][_0x4c6e('0x17')]);}})[_0x4c6e('0x1a')](function(_0x377abe){logger['error'](_0x4c6e('0x13'),_0x561dbf,_0x377abe);_0xc8ab78(_0x377abe);});});}exports['CreatePlugin']=function(_0x4ed15e){var _0x24ce03=this;return new Promise(function(_0x2f2a5c,_0x33d617){return db[_0x4c6e('0x1b')][_0x4c6e('0x1c')](_0x4ed15e['body'],{'raw':_0x4ed15e[_0x4c6e('0x1d')]?_0x4ed15e[_0x4c6e('0x1d')][_0x4c6e('0x1e')]===undefined?!![]:![]:!![]})[_0x4c6e('0x1f')](function(_0x91901f){logger[_0x4c6e('0x12')](_0x4c6e('0x20'),_0x4ed15e);logger[_0x4c6e('0x21')](_0x4c6e('0x20'),_0x4ed15e,JSON[_0x4c6e('0x14')](_0x91901f));_0x2f2a5c(_0x91901f);})[_0x4c6e('0x1a')](function(_0x290933){logger[_0x4c6e('0x15')](_0x4c6e('0x20'),_0x290933[_0x4c6e('0x17')],_0x4ed15e);_0x33d617(_0x24ce03[_0x4c6e('0x15')](0x1f4,_0x290933[_0x4c6e('0x17')]));});});}; \ No newline at end of file +var _0xfc45=['socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','CreatePlugin','create','body','options','raw','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis'];(function(_0x4dc763,_0x1b7936){var _0x529a48=function(_0x248a40){while(--_0x248a40){_0x4dc763['push'](_0x4dc763['shift']());}};_0x529a48(++_0x1b7936);}(_0xfc45,0x7e));var _0x5fc4=function(_0x500c24,_0x320f94){_0x500c24=_0x500c24-0x0;var _0xd5b6e6=_0xfc45[_0x500c24];return _0xd5b6e6;};'use strict';var _=require(_0x5fc4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5fc4('0x1'));var fs=require('fs');var Redis=require(_0x5fc4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5fc4('0x3'));var logger=require(_0x5fc4('0x4'))(_0x5fc4('0x5'));var config=require(_0x5fc4('0x6'));var jayson=require(_0x5fc4('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x5fc4('0x8')]=_['defaults'](config[_0x5fc4('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x5fc4('0x9'))(new Redis(config['redis']));require(_0x5fc4('0xa'))[_0x5fc4('0xb')](socket);function respondWithRpcPromise(_0x48f7db,_0x192e3b,_0x140298){return new BPromise(function(_0x11c11e,_0x2f0c1f){return client[_0x5fc4('0xc')](_0x48f7db,_0x140298)[_0x5fc4('0xd')](function(_0x1d32c8){logger[_0x5fc4('0xe')](_0x5fc4('0xf'),_0x192e3b,_0x5fc4('0x10'));logger[_0x5fc4('0x11')](_0x5fc4('0x12'),_0x192e3b,'request\x20sent',JSON['stringify'](_0x1d32c8));if(_0x1d32c8[_0x5fc4('0x13')]){if(_0x1d32c8[_0x5fc4('0x13')][_0x5fc4('0x14')]===0x1f4){logger[_0x5fc4('0x13')](_0x5fc4('0xf'),_0x192e3b,_0x1d32c8[_0x5fc4('0x13')][_0x5fc4('0x15')]);return _0x2f0c1f(_0x1d32c8[_0x5fc4('0x13')][_0x5fc4('0x15')]);}logger[_0x5fc4('0x13')](_0x5fc4('0xf'),_0x192e3b,_0x1d32c8[_0x5fc4('0x13')][_0x5fc4('0x15')]);return _0x11c11e(_0x1d32c8[_0x5fc4('0x13')]['message']);}else{logger['info'](_0x5fc4('0xf'),_0x192e3b,_0x5fc4('0x10'));_0x11c11e(_0x1d32c8['result'][_0x5fc4('0x15')]);}})['catch'](function(_0x25ec3e){logger[_0x5fc4('0x13')]('Plugin,\x20%s,\x20%s',_0x192e3b,_0x25ec3e);_0x2f0c1f(_0x25ec3e);});});}exports[_0x5fc4('0x16')]=function(_0x37d449){var _0x2e3483=this;return new Promise(function(_0x2b874a,_0x2f0437){return db['Plugin'][_0x5fc4('0x17')](_0x37d449[_0x5fc4('0x18')],{'raw':_0x37d449[_0x5fc4('0x19')]?_0x37d449['options'][_0x5fc4('0x1a')]===undefined?!![]:![]:!![]})[_0x5fc4('0xd')](function(_0x1f142d){logger['info'](_0x5fc4('0x16'),_0x37d449);logger[_0x5fc4('0x11')]('CreatePlugin',_0x37d449,JSON['stringify'](_0x1f142d));_0x2b874a(_0x1f142d);})['catch'](function(_0xee4389){logger[_0x5fc4('0x13')](_0x5fc4('0x16'),_0xee4389[_0x5fc4('0x15')],_0x37d449);_0x2f0437(_0x2e3483[_0x5fc4('0x13')](0x1f4,_0xee4389[_0x5fc4('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 9eab2ed..5998bb7 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 _0x8445=['remove','update','emit','register','plugin:','./plugin.events','save'];(function(_0x4af835,_0x2d5645){var _0x3e3c19=function(_0x5eed0c){while(--_0x5eed0c){_0x4af835['push'](_0x4af835['shift']());}};_0x3e3c19(++_0x2d5645);}(_0x8445,0x1c5));var _0x5844=function(_0xc1c93f,_0x1fba71){_0xc1c93f=_0xc1c93f-0x0;var _0x3f81cb=_0x8445[_0xc1c93f];return _0x3f81cb;};'use strict';var PluginEvents=require(_0x5844('0x0'));var events=[_0x5844('0x1'),_0x5844('0x2'),_0x5844('0x3')];function createListener(_0x34a2a1,_0x2d0b8a){return function(_0x4d8e81){_0x2d0b8a[_0x5844('0x4')](_0x34a2a1,_0x4d8e81);};}function removeListener(_0x4ef246,_0x5cfb72){return function(){PluginEvents['removeListener'](_0x4ef246,_0x5cfb72);};}exports[_0x5844('0x5')]=function(_0x40d0cf){for(var _0x7c16b9=0x0,_0x4fb984=events['length'];_0x7c16b9<_0x4fb984;_0x7c16b9++){var _0x3c5a51=events[_0x7c16b9];var _0x540e5b=createListener(_0x5844('0x6')+_0x3c5a51,_0x40d0cf);PluginEvents['on'](_0x3c5a51,_0x540e5b);}}; \ No newline at end of file +var _0x80b3=['./plugin.events','save','remove','removeListener','length','plugin:'];(function(_0x5d9ceb,_0x1a49f5){var _0x33ce82=function(_0x583915){while(--_0x583915){_0x5d9ceb['push'](_0x5d9ceb['shift']());}};_0x33ce82(++_0x1a49f5);}(_0x80b3,0x138));var _0x380b=function(_0x24c4b5,_0x3528cc){_0x24c4b5=_0x24c4b5-0x0;var _0x2184f8=_0x80b3[_0x24c4b5];return _0x2184f8;};'use strict';var PluginEvents=require(_0x380b('0x0'));var events=[_0x380b('0x1'),_0x380b('0x2'),'update'];function createListener(_0x1479bb,_0x58e904){return function(_0x4f0bb1){_0x58e904['emit'](_0x1479bb,_0x4f0bb1);};}function removeListener(_0x5e7501,_0x52951c){return function(){PluginEvents[_0x380b('0x3')](_0x5e7501,_0x52951c);};}exports['register']=function(_0x15f7cf){for(var _0x2a033f=0x0,_0x3d22e7=events[_0x380b('0x4')];_0x2a033f<_0x3d22e7;_0x2a033f++){var _0xd0eaff=events[_0x2a033f];var _0x34a977=createListener(_0x380b('0x5')+_0xd0eaff,_0x15f7cf);PluginEvents['on'](_0xd0eaff,_0x34a977);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 963b405..4ca140e 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(_0x47e906,_0x4febba){var _0x5704d2=function(_0x300997){while(--_0x300997){_0x47e906['push'](_0x47e906['shift']());}};_0x5704d2(++_0x4febba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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(_0x5cf21a,_0x8aff91){var _0x2e8647=function(_0x35c70a){while(--_0x35c70a){_0x5cf21a['push'](_0x5cf21a['shift']());}};_0x2e8647(++_0x8aff91);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 e4f7b4a..87d8b5a 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 _0x68fc=['join','../../files/plugins','script','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','restart','stop','Unknown\x20status','destroy','lodash','../../config/pm2','../../config/logger','child_process','bluebird','sendStatus','json','error','stack','name','status','send','npm\x20install','info','index','then','reject','express','motion2','catch','show','describe','params','create','body'];(function(_0x2631f2,_0x44e391){var _0x389ebf=function(_0x17fea3){while(--_0x17fea3){_0x2631f2['push'](_0x2631f2['shift']());}};_0x389ebf(++_0x44e391);}(_0x68fc,0xa5));var _0xc68f=function(_0x3e46bc,_0x2cc5d2){_0x3e46bc=_0x3e46bc-0x0;var _0x253db8=_0x68fc[_0x3e46bc];return _0x253db8;};'use strict';var _=require(_0xc68f('0x0'));var pm2=require(_0xc68f('0x1'));var logger=require(_0xc68f('0x2'))('api');var path=require('path');var exec=require(_0xc68f('0x3'))['exec'];var BPromise=require(_0xc68f('0x4'));function handleEntityNotFound(_0x593648,_0x5899ea){return function(_0x3b2744){if(!_0x3b2744){_0x593648[_0xc68f('0x5')](0x194);;}return _0x3b2744;};}function respondWithResult(_0x1c6df9,_0x363cdf){_0x363cdf=_0x363cdf||0xc8;return function(_0x4fcce4){if(_0x4fcce4){return _0x1c6df9['status'](_0x363cdf)[_0xc68f('0x6')](_0x4fcce4);}return null;};}function handleError(_0x2bf3fd,_0x370977){_0x370977=_0x370977||0x1f4;return function(_0x17aaaa){logger[_0xc68f('0x7')](_0x17aaaa[_0xc68f('0x8')]);if(_0x17aaaa[_0xc68f('0x9')]){delete _0x17aaaa[_0xc68f('0x9')];}_0x2bf3fd[_0xc68f('0xa')](_0x370977)[_0xc68f('0xb')](_0x17aaaa);};}function execChildProcess(){return new BPromise(function(_0x5777f9,_0x3b1a43){exec(_0xc68f('0xc'),function(_0x1f2758,_0x1d4ae4,_0x2f0694){logger[_0xc68f('0xd')](_0x1d4ae4);logger[_0xc68f('0xd')](_0x2f0694);if(_0x1f2758){logger[_0xc68f('0x7')](_0x1f2758);return _0x3b1a43(_0x1f2758);}return _0x5777f9(_0x1d4ae4);});});}exports[_0xc68f('0xe')]=function(_0x4112df,_0x31fb86){return pm2['list']()[_0xc68f('0xf')](function(_0x90ccbd){if(_0x90ccbd){var _0x2b1d30=_[_0xc68f('0x10')](_0x90ccbd,function(_0x286ed4){return _0x286ed4[_0xc68f('0x9')]===_0xc68f('0x11')||_0x286ed4[_0xc68f('0x9')]===_0xc68f('0x12');});return{'rows':_0x2b1d30,'count':_0x2b1d30['length']};}return null;})['then'](respondWithResult(_0x31fb86,null))[_0xc68f('0x13')](handleError(_0x31fb86,null));};exports[_0xc68f('0x14')]=function(_0x171eea,_0x3714f7){return pm2[_0xc68f('0x15')](_0x171eea[_0xc68f('0x16')]['id'])['then'](respondWithResult(_0x3714f7,null))[_0xc68f('0xf')](handleEntityNotFound(_0x3714f7,null))[_0xc68f('0x13')](handleError(_0x3714f7,null));};exports[_0xc68f('0x17')]=function(_0x2c058c,_0x5068fd){if(_0x2c058c[_0xc68f('0x18')][_0xc68f('0x9')]&&_0x2c058c[_0xc68f('0x18')]['script']){var _0xcc11a3=path[_0xc68f('0x19')](__dirname,_0xc68f('0x1a'),_0x2c058c['body'][_0xc68f('0x1b')]);var _0x1daac5=process[_0xc68f('0x1c')]();process[_0xc68f('0x1d')](path[_0xc68f('0x1e')](_0xcc11a3));return execChildProcess()[_0xc68f('0xf')](function(_0x2412a9){process['chdir'](_0x1daac5);return pm2[_0xc68f('0x1f')]({'name':_0x2c058c[_0xc68f('0x18')]['name'],'script':_0xcc11a3});})[_0xc68f('0xf')](function(_0x8399e6){pm2[_0xc68f('0x20')]();return _0x8399e6[0x0];})[_0xc68f('0xf')](respondWithResult(_0x5068fd,0xc9))[_0xc68f('0x13')](handleError(_0x5068fd,null));}else{return _0x5068fd['status'](0x1f4)[_0xc68f('0xb')]({'message':_0xc68f('0x21')});}};exports['update']=function(_0x38b935,_0x27e5b8){if(_0x38b935['body']['id']){delete _0x38b935[_0xc68f('0x18')]['id'];}var _0xdde47e={'online':_0xc68f('0x22'),'stopped':_0xc68f('0x23')};if(_0xdde47e['hasOwnProperty'](_0x38b935[_0xc68f('0x18')][_0xc68f('0xa')])){return pm2[_0xdde47e[_0x38b935[_0xc68f('0x18')][_0xc68f('0xa')]]](_0x38b935[_0xc68f('0x16')]['id'])[_0xc68f('0xf')](respondWithResult(_0x27e5b8,0xc8))[_0xc68f('0x13')](handleError(_0x27e5b8,null));}else{return _0x27e5b8[_0xc68f('0xa')](0x1f4)['send']({'message':_0xc68f('0x24')});}};exports[_0xc68f('0x25')]=function(_0x4b64da,_0x323677){if(_0x4b64da[_0xc68f('0x18')]['id']){delete _0x4b64da[_0xc68f('0x18')]['id'];}if(_0x4b64da[_0xc68f('0x16')]['id']){return pm2['delete'](_0x4b64da[_0xc68f('0x16')]['id'])[_0xc68f('0xf')](function(_0x56a82e){pm2[_0xc68f('0x20')]();return _0x56a82e[0x0];})[_0xc68f('0xf')](respondWithResult(_0x323677,null))[_0xc68f('0x13')](handleError(_0x323677,null));}else{return _0x323677[_0xc68f('0xa')](0x1f4)[_0xc68f('0xb')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x0102=['length','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','destroy','delete','../../config/pm2','../../config/logger','api','path','sendStatus','status','error','stack','name','send','npm\x20install','info','index','list','then','reject','express'];(function(_0x30407d,_0x2e1c35){var _0x3ffa6e=function(_0x2ee44b){while(--_0x2ee44b){_0x30407d['push'](_0x30407d['shift']());}};_0x3ffa6e(++_0x2e1c35);}(_0x0102,0x186));var _0x2010=function(_0x546ae2,_0x42a38a){_0x546ae2=_0x546ae2-0x0;var _0x1acfbb=_0x0102[_0x546ae2];return _0x1acfbb;};'use strict';var _=require('lodash');var pm2=require(_0x2010('0x0'));var logger=require(_0x2010('0x1'))(_0x2010('0x2'));var path=require(_0x2010('0x3'));var exec=require('child_process')['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0x4e30b3,_0x59082d){return function(_0x22e49f){if(!_0x22e49f){_0x4e30b3[_0x2010('0x4')](0x194);;}return _0x22e49f;};}function respondWithResult(_0x130725,_0x304264){_0x304264=_0x304264||0xc8;return function(_0x4eeb67){if(_0x4eeb67){return _0x130725[_0x2010('0x5')](_0x304264)['json'](_0x4eeb67);}return null;};}function handleError(_0x4728c0,_0x160e41){_0x160e41=_0x160e41||0x1f4;return function(_0x48dd91){logger[_0x2010('0x6')](_0x48dd91[_0x2010('0x7')]);if(_0x48dd91[_0x2010('0x8')]){delete _0x48dd91[_0x2010('0x8')];}_0x4728c0[_0x2010('0x5')](_0x160e41)[_0x2010('0x9')](_0x48dd91);};}function execChildProcess(){return new BPromise(function(_0x289ad4,_0x466c71){exec(_0x2010('0xa'),function(_0x39a821,_0x1d3b39,_0x32fe2e){logger[_0x2010('0xb')](_0x1d3b39);logger[_0x2010('0xb')](_0x32fe2e);if(_0x39a821){logger[_0x2010('0x6')](_0x39a821);return _0x466c71(_0x39a821);}return _0x289ad4(_0x1d3b39);});});}exports[_0x2010('0xc')]=function(_0x528a38,_0x579340){return pm2[_0x2010('0xd')]()[_0x2010('0xe')](function(_0x2e8ec2){if(_0x2e8ec2){var _0x10b587=_[_0x2010('0xf')](_0x2e8ec2,function(_0x335be4){return _0x335be4['name']===_0x2010('0x10')||_0x335be4[_0x2010('0x8')]==='motion2';});return{'rows':_0x10b587,'count':_0x10b587[_0x2010('0x11')]};}return null;})[_0x2010('0xe')](respondWithResult(_0x579340,null))[_0x2010('0x12')](handleError(_0x579340,null));};exports[_0x2010('0x13')]=function(_0x2d0bf2,_0x11bd28){return pm2[_0x2010('0x14')](_0x2d0bf2[_0x2010('0x15')]['id'])[_0x2010('0xe')](respondWithResult(_0x11bd28,null))['then'](handleEntityNotFound(_0x11bd28,null))['catch'](handleError(_0x11bd28,null));};exports[_0x2010('0x16')]=function(_0x38a15a,_0x3f9d62){if(_0x38a15a[_0x2010('0x17')]['name']&&_0x38a15a['body'][_0x2010('0x18')]){var _0x171e45=path[_0x2010('0x19')](__dirname,_0x2010('0x1a'),_0x38a15a[_0x2010('0x17')][_0x2010('0x18')]);var _0x4f621c=process[_0x2010('0x1b')]();process[_0x2010('0x1c')](path['dirname'](_0x171e45));return execChildProcess()['then'](function(_0x50aecc){process[_0x2010('0x1c')](_0x4f621c);return pm2['start']({'name':_0x38a15a[_0x2010('0x17')]['name'],'script':_0x171e45});})['then'](function(_0xdb57be){pm2[_0x2010('0x1d')]();return _0xdb57be[0x0];})['then'](respondWithResult(_0x3f9d62,0xc9))[_0x2010('0x12')](handleError(_0x3f9d62,null));}else{return _0x3f9d62['status'](0x1f4)[_0x2010('0x9')]({'message':_0x2010('0x1e')});}};exports[_0x2010('0x1f')]=function(_0x3dcea4,_0x3c5862){if(_0x3dcea4[_0x2010('0x17')]['id']){delete _0x3dcea4[_0x2010('0x17')]['id'];}var _0x3eb4dc={'online':_0x2010('0x20'),'stopped':_0x2010('0x21')};if(_0x3eb4dc[_0x2010('0x22')](_0x3dcea4[_0x2010('0x17')]['status'])){return pm2[_0x3eb4dc[_0x3dcea4[_0x2010('0x17')]['status']]](_0x3dcea4[_0x2010('0x15')]['id'])[_0x2010('0xe')](respondWithResult(_0x3c5862,0xc8))[_0x2010('0x12')](handleError(_0x3c5862,null));}else{return _0x3c5862[_0x2010('0x5')](0x1f4)['send']({'message':'Unknown\x20status'});}};exports[_0x2010('0x23')]=function(_0x48d9f2,_0x2839f2){if(_0x48d9f2[_0x2010('0x17')]['id']){delete _0x48d9f2['body']['id'];}if(_0x48d9f2[_0x2010('0x15')]['id']){return pm2[_0x2010('0x24')](_0x48d9f2[_0x2010('0x15')]['id'])[_0x2010('0xe')](function(_0x692ddc){pm2['dump']();return _0x692ddc[0x0];})[_0x2010('0xe')](respondWithResult(_0x2839f2,null))[_0x2010('0x12')](handleError(_0x2839f2,null));}else{return _0x2839f2[_0x2010('0x5')](0x1f4)['send']({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index bb1f93a..0d40c48 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 _0xdeff=['getQueues','exports','express','Router','./realtime.controller','/agents','isAuthenticated','getAgents','get'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0xdeff,0x1d6));var _0xfdef=function(_0x2a390b,_0xf49f9b){_0x2a390b=_0x2a390b-0x0;var _0x5df10a=_0xdeff[_0x2a390b];return _0x5df10a;};'use strict';var express=require(_0xfdef('0x0'));var router=express[_0xfdef('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xfdef('0x2'));router['get'](_0xfdef('0x3'),auth[_0xfdef('0x4')](),controller[_0xfdef('0x5')]);router[_0xfdef('0x6')]('/queues',auth[_0xfdef('0x4')](),controller[_0xfdef('0x7')]);module[_0xfdef('0x8')]=router; \ No newline at end of file +var _0xf0fb=['exports','express','Router','../../components/auth/service','get','getAgents','/queues','isAuthenticated','getQueues'];(function(_0x36c894,_0x4bd853){var _0x13fd9c=function(_0x1da8c6){while(--_0x1da8c6){_0x36c894['push'](_0x36c894['shift']());}};_0x13fd9c(++_0x4bd853);}(_0xf0fb,0x13c));var _0xbf0f=function(_0x58b44a,_0x1a7aa6){_0x58b44a=_0x58b44a-0x0;var _0xd6779d=_0xf0fb[_0x58b44a];return _0xd6779d;};'use strict';var express=require(_0xbf0f('0x0'));var router=express[_0xbf0f('0x1')]();var auth=require(_0xbf0f('0x2'));var controller=require('./realtime.controller');router[_0xbf0f('0x3')]('/agents',auth['isAuthenticated'](),controller[_0xbf0f('0x4')]);router['get'](_0xbf0f('0x5'),auth[_0xbf0f('0x6')](),controller[_0xbf0f('0x7')]);module[_0xbf0f('0x8')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 2505f6c..9a9445c 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 _0xe7da=['dialActive','dialMethod','QueueCampaigns','startCase','Queues','filter','util','../../components/realtime/agents','../../components/realtime/queues','../../config/utils','../../mysqldb','APIBadRequestError','../../errors/api','offset','limit','undefined','count','status','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','isValidChannel','channel','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','then','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','length','push','sequelize','literal','forEach','Pause','where','merge','user','userProfileId','Agents','online','assign','omit','UserProfile','getResources','findAndCountAll','find','filterAgentAttributes','getAgentStatus','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','format','Queue','name','voice','outbound'];(function(_0x516510,_0x529cef){var _0x1dfde4=function(_0x7cb6d){while(--_0x7cb6d){_0x516510['push'](_0x516510['shift']());}};_0x1dfde4(++_0x529cef);}(_0xe7da,0x114));var _0xae7d=function(_0x5d89cb,_0x8129b4){_0x5d89cb=_0x5d89cb-0x0;var _0x47e564=_0xe7da[_0x5d89cb];return _0x47e564;};'use strict';var _=require('lodash');var util=require(_0xae7d('0x0'));var rta=require(_0xae7d('0x1'));var rtq=require(_0xae7d('0x2'));var qs=require('../../components/parsers/qs');var utils=require(_0xae7d('0x3'));var db=require(_0xae7d('0x4'))['db'];var APIBadRequestError=require('../../errors/api')[_0xae7d('0x5')];var APIHandleError=require(_0xae7d('0x6'))['handleError'];function respondWithFilteredResult(_0x9cee67,_0x5c17aa){return function(_0x3c33a8){if(_0x3c33a8){var _0x44db22=typeof _0x5c17aa[_0xae7d('0x7')]==='undefined'&&typeof _0x5c17aa[_0xae7d('0x8')]===_0xae7d('0x9');var _0x500e8e=_0x3c33a8[_0xae7d('0xa')];var _0x32796d=_0x44db22?0x0:_0x5c17aa[_0xae7d('0x7')];var _0x248fbb=_0x44db22?_0x3c33a8['count']:_0x5c17aa['offset']+_0x5c17aa[_0xae7d('0x8')];var _0x47c529;if(_0x248fbb>=_0x500e8e){_0x248fbb=_0x500e8e;_0x47c529=0xc8;}else{_0x47c529=0xce;}_0x9cee67[_0xae7d('0xb')](_0x47c529);return _0x9cee67[_0xae7d('0xc')](_0xae7d('0xd'),_0x32796d+'-'+_0x248fbb+'/'+_0x500e8e)[_0xae7d('0xe')](_0x3c33a8);}return null;};}exports[_0xae7d('0xf')]=function(_0x5f54e7,_0x406a5a){var _0x383ecc={'count':0x0,'rows':[]};var _0x34d023={};var _0x48bbd8;var _0x5d7168=utils[_0xae7d('0x10')]();var _0xe1416;var _0x1c28d5;var _0x593618=_0x5f54e7[_0xae7d('0x11')][_0xae7d('0x12')];var _0x4d53c4=_0x5f54e7[_0xae7d('0x11')][_0xae7d('0x13')];var _0x42fff0=_0x5f54e7[_0xae7d('0x11')][_0xae7d('0x14')];var _0x9a8a22=_0x4d53c4===_0xae7d('0x15')||_0x4d53c4===_0xae7d('0x16')?!![]:![];var _0x1418d7=[];var _0x39116b;var _0x3a9584;Promise[_0xae7d('0x17')]()['then'](function(){if(_0x5f54e7[_0xae7d('0x11')]['channel']){if(!utils[_0xae7d('0x18')](_0x5f54e7['query'][_0xae7d('0x19')])){throw new APIBadRequestError(util['format'](_0xae7d('0x1a'),_0x5f54e7[_0xae7d('0x11')][_0xae7d('0x19')]));}_0x48bbd8=_0x5f54e7[_0xae7d('0x11')][_0xae7d('0x19')][_0xae7d('0x1b')]();}if(!_0x5f54e7[_0xae7d('0x11')][_0xae7d('0x1c')]||!_0x5f54e7['query'][_0xae7d('0x1c')]['includes'](_0xae7d('0x1d'))){_0x5f54e7[_0xae7d('0x11')]['sort']=rta[_0xae7d('0x1e')](_0x5f54e7[_0xae7d('0x11')][_0xae7d('0x1c')]);return;}var _0x5b1bd2=rta[_0xae7d('0x1f')](_0x5f54e7['query'][_0xae7d('0x1c')]);_0x5f54e7['query'][_0xae7d('0x1c')]=_0x5b1bd2[_0xae7d('0x20')][_0xae7d('0x21')](',');_0x39116b=_0x5b1bd2[_0xae7d('0x22')];})[_0xae7d('0x23')](function(){if(!_0x593618){return[];}return rta[_0xae7d('0x24')](_0x593618,_0x48bbd8);})[_0xae7d('0x23')](function(_0x249559){_0x1418d7=_0x249559;return rta[_0xae7d('0x25')]();})[_0xae7d('0x23')](function(_0x2512bf){_0x1c28d5=_0x2512bf[_0xae7d('0x26')];if((!_0x4d53c4||_0x9a8a22)&&!_0x39116b){return _0x1418d7;}if(_0x39116b&&!_0x4d53c4){return rta[_0xae7d('0x27')](_0x1c28d5,_0x1418d7,_0x39116b);}else{return rta[_0xae7d('0x28')](_0x1c28d5,_0x1418d7,_0x4d53c4);}})[_0xae7d('0x23')](function(_0x3d1059){_0x1418d7=_0x3d1059;var _0x56738f=![];if(_0x1418d7['length']===0x0){if(_0x593618||_0x4d53c4){_0x56738f=!![];}if(_0x9a8a22){_0x56738f=![];}}if(_0x56738f){return _0x383ecc;}var _0x1cb2c5=_[_0xae7d('0x29')](db[_0xae7d('0x2a')][_0xae7d('0x2b')],function(_0xcc73ca){return{'name':_0xcc73ca[_0xae7d('0x2c')],'type':_0xcc73ca[_0xae7d('0x2d')][_0xae7d('0x2e')]};});_0x5f54e7[_0xae7d('0x11')][_0xae7d('0x2f')]=_0xae7d('0x30');_0x34d023=qs[_0xae7d('0x31')](_0x1cb2c5,_0x5f54e7);_0x34d023[_0xae7d('0x32')]=!![];var _0xead536=[];if(_0x1418d7[_0xae7d('0x33')]>0x0){_0xead536[_0xae7d('0x34')]({'id':{'$in':_0x1418d7}});if(_0x39116b&&!_0x4d53c4){_0x3a9584=[db[_0xae7d('0x35')][_0xae7d('0x36')]('FIELD(id,'+_0x1418d7+')')];_0x34d023[_0xae7d('0x22')]=_0x3a9584;}}if(_0x9a8a22){_0x5d7168[_0xae7d('0x37')](function(_0x289638){var _0x576594=!![];if(_0x4d53c4===_0xae7d('0x16')&&_0x48bbd8!==_0x289638){_0x576594=![];}_0xead536['push']({[_0x289638+_0xae7d('0x38')]:_0x576594});});if(_0x42fff0){_0xead536['push']({'pauseType':_0x42fff0});}}else if(_0x4d53c4){_0x5d7168[_0xae7d('0x37')](function(_0x91a6ae){_0xead536[_0xae7d('0x34')]({[_0x91a6ae+_0xae7d('0x38')]:![]});});}_0x34d023[_0xae7d('0x39')]=_[_0xae7d('0x3a')](_0x34d023[_0xae7d('0x39')],{'$and':_0xead536});if(_0x5f54e7['user'][_0xae7d('0x2f')]==='user'){var _0x1f42ae={'params':{'id':_0x5f54e7[_0xae7d('0x3b')][_0xae7d('0x3c')]},'query':{'section':_0xae7d('0x3d'),'role':_0xae7d('0x30'),'raw':!![],'ids':_0x1418d7,'customSorting':_0x3a9584}};if(_0x5f54e7['query']['online']){_0x1f42ae[_0xae7d('0x11')][_0xae7d('0x3e')]=!![];}if(_0x9a8a22){_0x1f42ae[_0xae7d('0x11')]['extraQueryConditions']=_0xead536;}_0x1f42ae['query']=Object[_0xae7d('0x3f')](_0x1f42ae[_0xae7d('0x11')],_[_0xae7d('0x40')](_0x5f54e7['query'],'id'));return db[_0xae7d('0x41')][_0xae7d('0x42')](_0x1f42ae);}return db[_0xae7d('0x2a')][_0xae7d('0x43')](_0x34d023);})[_0xae7d('0x23')](function(_0x4f8de1){_0x383ecc[_0xae7d('0xa')]=_0x4f8de1[_0xae7d('0xa')];_0xe1416=_0x4f8de1[_0xae7d('0x26')];return _0xe1416[_0xae7d('0x29')](function(_0x4f7887){var _0xe47d27=_[_0xae7d('0x44')](_0x1c28d5,['id',_0x4f7887['id']]);if(_0xe47d27){var _0x3d361d=rta[_0xae7d('0x45')](_0xe47d27);_['merge'](_0x4f7887,_0x3d361d);}_0x4f7887[_0xae7d('0x1d')]=rta[_0xae7d('0x46')](_0x4f7887);if(_0x4f7887[_0xae7d('0x1d')]['includes'](_0xae7d('0x15'))){_0x5d7168[_0xae7d('0x37')](function(_0x5d8a76){if(_0x4f7887[_0x5d8a76+_0xae7d('0x38')]){if(_0x5d8a76==='voice'){if(_0x4f7887[_0xae7d('0x47')]!==_0xae7d('0x48')){_0x4f7887['voiceStatus']='pause';}}else{_0x4f7887[_0x5d8a76+_0xae7d('0x49')]=_0xae7d('0x15');}}});}return _0x4f7887;});})[_0xae7d('0x23')](function(_0x5bde9f){if(!_0x39116b||_0x3a9584){return _0x5bde9f;}return rta[_0xae7d('0x4a')](_0x5bde9f,_0x39116b);})[_0xae7d('0x23')](function(_0x6c900b){var _0x355b5=rta[_0xae7d('0x4b')]();_0x383ecc[_0xae7d('0x26')]=_0x6c900b[_0xae7d('0x29')](function(_0x588585){return _[_0xae7d('0x4c')](_0x588585,_0x355b5);});return _0x383ecc;})[_0xae7d('0x23')](respondWithFilteredResult(_0x406a5a,_0x34d023))[_0xae7d('0x4d')](APIHandleError(_0x406a5a));};exports[_0xae7d('0x4e')]=function(_0x23ce29,_0x51b36c){var _0x330f00={'count':0x0,'rows':[]};var _0x20b484={};var _0x45591f;var _0xe76da0;var _0x4afe22;Promise[_0xae7d('0x17')]()['then'](function(){if(_0x23ce29['query']['channel']){if(!utils[_0xae7d('0x18')](_0x23ce29[_0xae7d('0x11')][_0xae7d('0x19')])){throw new APIBadRequestError(util[_0xae7d('0x4f')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x23ce29[_0xae7d('0x11')]['channel']));}_0x45591f=_0x23ce29[_0xae7d('0x11')][_0xae7d('0x19')][_0xae7d('0x1b')]();}var _0x4707e9=_['startCase'](_0x45591f)+_0xae7d('0x50');var _0x104e14=_['map'](db[_0x4707e9][_0xae7d('0x2b')],function(_0x31ac9b){return{'name':_0x31ac9b[_0xae7d('0x2c')],'type':_0x31ac9b['type'][_0xae7d('0x2e')]};});if(!_0x23ce29[_0xae7d('0x11')][_0xae7d('0x20')]){var _0x16a40e=['id',_0xae7d('0x51')];if(_0x45591f===_0xae7d('0x52')){_0x16a40e[_0xae7d('0x34')](_0xae7d('0x2d'));if(_0x23ce29[_0xae7d('0x11')][_0xae7d('0x2d')]===_0xae7d('0x53')){_0x16a40e['push']([_0xae7d('0x54'),_0xae7d('0x55')]);}}_0x23ce29[_0xae7d('0x11')][_0xae7d('0x20')]=_0x16a40e[_0xae7d('0x21')](',');}_0x20b484=qs[_0xae7d('0x31')](_0x104e14,_0x23ce29);if(_0x23ce29[_0xae7d('0x3b')][_0xae7d('0x2f')]===_0xae7d('0x3b')){var _0x8583ac={'params':{'id':_0x23ce29[_0xae7d('0x3b')][_0xae7d('0x3c')]},'query':{'section':_0x45591f===_0xae7d('0x52')&&_0x23ce29[_0xae7d('0x11')]['type']===_0xae7d('0x53')?_0xae7d('0x56'):_[_0xae7d('0x57')](_0x45591f)+_0xae7d('0x58'),'type':_0x23ce29['query'][_0xae7d('0x2d')],'nolimit':!![],'sort':'name','filter':_0x23ce29[_0xae7d('0x11')][_0xae7d('0x59')]}};_0x8583ac[_0xae7d('0x11')]=Object[_0xae7d('0x3f')](_0x8583ac['query'],_0x23ce29[_0xae7d('0x11')]);delete _0x8583ac['query']['id'];return db[_0xae7d('0x41')][_0xae7d('0x42')](_0x8583ac);}return db[_0x4707e9][_0xae7d('0x43')](_0x20b484);})[_0xae7d('0x23')](function(_0x214a1a){_0x330f00['count']=_0x214a1a[_0xae7d('0xa')];_0xe76da0=_0x214a1a[_0xae7d('0x26')];return rtq['getRealtimeQueues'](_0x23ce29,_0x45591f);})['then'](function(_0x3a7e12){_0x4afe22=_0x3a7e12[_0xae7d('0x26')];return rtq['initializeQueues'](_0xe76da0,_0x4afe22,_0x45591f,_0x23ce29[_0xae7d('0x11')][_0xae7d('0x2d')]);})['then'](function(_0x158839){_0x330f00[_0xae7d('0x26')]=_0x158839;return _0x330f00;})[_0xae7d('0x23')](respondWithFilteredResult(_0x51b36c,_0x20b484))[_0xae7d('0x4d')](APIHandleError(_0x51b36c));}; \ No newline at end of file +var _0x22d3=['initializeQueues','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../errors/api','APIBadRequestError','undefined','limit','count','offset','status','set','Content-Range','json','getChannels','query','pauseTypeFilter','resolve','then','channel','isValidChannel','format','toLowerCase','sort','includes','globalStatus','validateSortParameter','fields','order','getAgentIdsByQueues','rows','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','push','sequelize','literal','FIELD(id,','forEach','*pause','Pause','where','user','userProfileId','Agents','omit','UserProfile','getResources','findAndCountAll','find','merge','getAgentStatus','pause','voice','voiceStatus','talking','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','Channel\x20parameter\x20%s\x20is\x20invalid','startCase','Queue','name','outbound','dialActive','join','Queues','assign','getRealtimeQueues'];(function(_0x280c21,_0x2ad997){var _0x1897bb=function(_0x410f07){while(--_0x410f07){_0x280c21['push'](_0x280c21['shift']());}};_0x1897bb(++_0x2ad997);}(_0x22d3,0xa3));var _0x322d=function(_0x5400b,_0x55943a){_0x5400b=_0x5400b-0x0;var _0x36a39b=_0x22d3[_0x5400b];return _0x36a39b;};'use strict';var _=require('lodash');var util=require(_0x322d('0x0'));var rta=require(_0x322d('0x1'));var rtq=require(_0x322d('0x2'));var qs=require(_0x322d('0x3'));var utils=require(_0x322d('0x4'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x322d('0x5'))[_0x322d('0x6')];var APIHandleError=require(_0x322d('0x5'))['handleError'];function respondWithFilteredResult(_0x3fdb61,_0xcce6b5){return function(_0x110697){if(_0x110697){var _0x2a0e1b=typeof _0xcce6b5['offset']===_0x322d('0x7')&&typeof _0xcce6b5[_0x322d('0x8')]===_0x322d('0x7');var _0x4f5135=_0x110697[_0x322d('0x9')];var _0x15e7ee=_0x2a0e1b?0x0:_0xcce6b5['offset'];var _0x1cddc7=_0x2a0e1b?_0x110697[_0x322d('0x9')]:_0xcce6b5[_0x322d('0xa')]+_0xcce6b5[_0x322d('0x8')];var _0x5d540f;if(_0x1cddc7>=_0x4f5135){_0x1cddc7=_0x4f5135;_0x5d540f=0xc8;}else{_0x5d540f=0xce;}_0x3fdb61[_0x322d('0xb')](_0x5d540f);return _0x3fdb61[_0x322d('0xc')](_0x322d('0xd'),_0x15e7ee+'-'+_0x1cddc7+'/'+_0x4f5135)[_0x322d('0xe')](_0x110697);}return null;};}exports['getAgents']=function(_0x2fe8ed,_0x3e1c78){var _0x30614a={'count':0x0,'rows':[]};var _0x43ba18={};var _0x4d655d;var _0x1dfc7b=utils[_0x322d('0xf')]();var _0x39c1d7;var _0xc292c8;var _0x42211f=_0x2fe8ed['query']['globalQueueFilter'];var _0x52f200=_0x2fe8ed[_0x322d('0x10')]['globalStatusFilter'];var _0x172386=_0x2fe8ed[_0x322d('0x10')][_0x322d('0x11')];var _0x16b7f6=_0x52f200==='pause'||_0x52f200==='*pause'?!![]:![];var _0x312c4c=[];var _0x510c20;var _0x594734;Promise[_0x322d('0x12')]()[_0x322d('0x13')](function(){if(_0x2fe8ed[_0x322d('0x10')][_0x322d('0x14')]){if(!utils[_0x322d('0x15')](_0x2fe8ed['query'][_0x322d('0x14')])){throw new APIBadRequestError(util[_0x322d('0x16')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x2fe8ed[_0x322d('0x10')]['channel']));}_0x4d655d=_0x2fe8ed[_0x322d('0x10')][_0x322d('0x14')][_0x322d('0x17')]();}if(!_0x2fe8ed['query'][_0x322d('0x18')]||!_0x2fe8ed[_0x322d('0x10')][_0x322d('0x18')][_0x322d('0x19')](_0x322d('0x1a'))){_0x2fe8ed[_0x322d('0x10')][_0x322d('0x18')]=rta[_0x322d('0x1b')](_0x2fe8ed['query'][_0x322d('0x18')]);return;}var _0x50e9f0=rta['getUpdatedSortOptions'](_0x2fe8ed['query'][_0x322d('0x18')]);_0x2fe8ed['query'][_0x322d('0x18')]=_0x50e9f0[_0x322d('0x1c')]['join'](',');_0x510c20=_0x50e9f0[_0x322d('0x1d')];})[_0x322d('0x13')](function(){if(!_0x42211f){return[];}return rta[_0x322d('0x1e')](_0x42211f,_0x4d655d);})[_0x322d('0x13')](function(_0x300728){_0x312c4c=_0x300728;return rta['getRealtimeAgents']();})[_0x322d('0x13')](function(_0x4c1a2b){_0xc292c8=_0x4c1a2b[_0x322d('0x1f')];if((!_0x52f200||_0x16b7f6)&&!_0x510c20){return _0x312c4c;}if(_0x510c20&&!_0x52f200){return rta['getSortedAgentsIdsByStatus'](_0xc292c8,_0x312c4c,_0x510c20);}else{return rta[_0x322d('0x20')](_0xc292c8,_0x312c4c,_0x52f200);}})[_0x322d('0x13')](function(_0x40a364){_0x312c4c=_0x40a364;var _0x262ae4=![];if(_0x312c4c[_0x322d('0x21')]===0x0){if(_0x42211f||_0x52f200){_0x262ae4=!![];}if(_0x16b7f6){_0x262ae4=![];}}if(_0x262ae4){return _0x30614a;}var _0x416452=_[_0x322d('0x22')](db[_0x322d('0x23')][_0x322d('0x24')],function(_0x5802d0){return{'name':_0x5802d0[_0x322d('0x25')],'type':_0x5802d0[_0x322d('0x26')][_0x322d('0x27')]};});_0x2fe8ed[_0x322d('0x10')][_0x322d('0x28')]=_0x322d('0x29');_0x43ba18=qs[_0x322d('0x2a')](_0x416452,_0x2fe8ed);_0x43ba18['raw']=!![];var _0x1ae2c3=[];if(_0x312c4c[_0x322d('0x21')]>0x0){_0x1ae2c3[_0x322d('0x2b')]({'id':{'$in':_0x312c4c}});if(_0x510c20&&!_0x52f200){_0x594734=[db[_0x322d('0x2c')][_0x322d('0x2d')](_0x322d('0x2e')+_0x312c4c+')')];_0x43ba18['order']=_0x594734;}}if(_0x16b7f6){_0x1dfc7b[_0x322d('0x2f')](function(_0x5806a8){var _0x3529d6=!![];if(_0x52f200===_0x322d('0x30')&&_0x4d655d!==_0x5806a8){_0x3529d6=![];}_0x1ae2c3[_0x322d('0x2b')]({[_0x5806a8+_0x322d('0x31')]:_0x3529d6});});if(_0x172386){_0x1ae2c3[_0x322d('0x2b')]({'pauseType':_0x172386});}}else if(_0x52f200){_0x1dfc7b[_0x322d('0x2f')](function(_0x4d3465){_0x1ae2c3[_0x322d('0x2b')]({[_0x4d3465+_0x322d('0x31')]:![]});});}_0x43ba18['where']=_['merge'](_0x43ba18[_0x322d('0x32')],{'$and':_0x1ae2c3});if(_0x2fe8ed[_0x322d('0x33')][_0x322d('0x28')]===_0x322d('0x33')){var _0x190240={'params':{'id':_0x2fe8ed[_0x322d('0x33')][_0x322d('0x34')]},'query':{'section':_0x322d('0x35'),'role':_0x322d('0x29'),'raw':!![],'ids':_0x312c4c,'customSorting':_0x594734}};if(_0x2fe8ed[_0x322d('0x10')]['online']){_0x190240[_0x322d('0x10')]['online']=!![];}if(_0x16b7f6){_0x190240['query']['extraQueryConditions']=_0x1ae2c3;}_0x190240[_0x322d('0x10')]=Object['assign'](_0x190240[_0x322d('0x10')],_[_0x322d('0x36')](_0x2fe8ed['query'],'id'));return db[_0x322d('0x37')][_0x322d('0x38')](_0x190240);}return db[_0x322d('0x23')][_0x322d('0x39')](_0x43ba18);})[_0x322d('0x13')](function(_0x26c54d){_0x30614a[_0x322d('0x9')]=_0x26c54d[_0x322d('0x9')];_0x39c1d7=_0x26c54d[_0x322d('0x1f')];return _0x39c1d7[_0x322d('0x22')](function(_0x2bb746){var _0x79a9f0=_[_0x322d('0x3a')](_0xc292c8,['id',_0x2bb746['id']]);if(_0x79a9f0){var _0x542e04=rta['filterAgentAttributes'](_0x79a9f0);_[_0x322d('0x3b')](_0x2bb746,_0x542e04);}_0x2bb746['globalStatus']=rta[_0x322d('0x3c')](_0x2bb746);if(_0x2bb746[_0x322d('0x1a')][_0x322d('0x19')](_0x322d('0x3d'))){_0x1dfc7b['forEach'](function(_0x5dcfdc){if(_0x2bb746[_0x5dcfdc+'Pause']){if(_0x5dcfdc===_0x322d('0x3e')){if(_0x2bb746[_0x322d('0x3f')]!==_0x322d('0x40')){_0x2bb746[_0x322d('0x3f')]=_0x322d('0x3d');}}else{_0x2bb746[_0x5dcfdc+'Status']=_0x322d('0x3d');}}});}return _0x2bb746;});})[_0x322d('0x13')](function(_0x349275){if(!_0x510c20||_0x594734){return _0x349275;}return rta[_0x322d('0x41')](_0x349275,_0x510c20);})['then'](function(_0x4da1d6){var _0x5b1bb0=rta[_0x322d('0x42')]();_0x30614a['rows']=_0x4da1d6[_0x322d('0x22')](function(_0x48ac11){return _[_0x322d('0x43')](_0x48ac11,_0x5b1bb0);});return _0x30614a;})[_0x322d('0x13')](respondWithFilteredResult(_0x3e1c78,_0x43ba18))[_0x322d('0x44')](APIHandleError(_0x3e1c78));};exports[_0x322d('0x45')]=function(_0x1424f3,_0x23fc64){var _0x539b5b={'count':0x0,'rows':[]};var _0x57a5d5={};var _0x369cbc;var _0x155b7e;var _0x2724ea;Promise[_0x322d('0x12')]()['then'](function(){if(_0x1424f3['query'][_0x322d('0x14')]){if(!utils[_0x322d('0x15')](_0x1424f3[_0x322d('0x10')][_0x322d('0x14')])){throw new APIBadRequestError(util[_0x322d('0x16')](_0x322d('0x46'),_0x1424f3[_0x322d('0x10')]['channel']));}_0x369cbc=_0x1424f3[_0x322d('0x10')]['channel'][_0x322d('0x17')]();}var _0x319f65=_[_0x322d('0x47')](_0x369cbc)+_0x322d('0x48');var _0x31c1b2=_[_0x322d('0x22')](db[_0x319f65][_0x322d('0x24')],function(_0x160e05){return{'name':_0x160e05[_0x322d('0x25')],'type':_0x160e05[_0x322d('0x26')][_0x322d('0x27')]};});if(!_0x1424f3[_0x322d('0x10')][_0x322d('0x1c')]){var _0x2ab1fc=['id',_0x322d('0x49')];if(_0x369cbc===_0x322d('0x3e')){_0x2ab1fc[_0x322d('0x2b')]('type');if(_0x1424f3['query'][_0x322d('0x26')]===_0x322d('0x4a')){_0x2ab1fc['push']([_0x322d('0x4b'),'dialMethod']);}}_0x1424f3[_0x322d('0x10')][_0x322d('0x1c')]=_0x2ab1fc[_0x322d('0x4c')](',');}_0x57a5d5=qs[_0x322d('0x2a')](_0x31c1b2,_0x1424f3);if(_0x1424f3[_0x322d('0x33')][_0x322d('0x28')]===_0x322d('0x33')){var _0x409034={'params':{'id':_0x1424f3[_0x322d('0x33')][_0x322d('0x34')]},'query':{'section':_0x369cbc==='voice'&&_0x1424f3[_0x322d('0x10')]['type']===_0x322d('0x4a')?'QueueCampaigns':_['startCase'](_0x369cbc)+_0x322d('0x4d'),'type':_0x1424f3['query'][_0x322d('0x26')],'nolimit':!![],'sort':_0x322d('0x49'),'filter':_0x1424f3[_0x322d('0x10')]['filter']}};_0x409034[_0x322d('0x10')]=Object[_0x322d('0x4e')](_0x409034['query'],_0x1424f3[_0x322d('0x10')]);delete _0x409034[_0x322d('0x10')]['id'];return db[_0x322d('0x37')][_0x322d('0x38')](_0x409034);}return db[_0x319f65][_0x322d('0x39')](_0x57a5d5);})[_0x322d('0x13')](function(_0x4b49ff){_0x539b5b[_0x322d('0x9')]=_0x4b49ff[_0x322d('0x9')];_0x155b7e=_0x4b49ff[_0x322d('0x1f')];return rtq[_0x322d('0x4f')](_0x1424f3,_0x369cbc);})[_0x322d('0x13')](function(_0x2969af){_0x2724ea=_0x2969af[_0x322d('0x1f')];return rtq[_0x322d('0x50')](_0x155b7e,_0x2724ea,_0x369cbc,_0x1424f3[_0x322d('0x10')][_0x322d('0x26')]);})[_0x322d('0x13')](function(_0x342b57){_0x539b5b['rows']=_0x342b57;return _0x539b5b;})['then'](respondWithFilteredResult(_0x23fc64,_0x57a5d5))[_0x322d('0x44')](APIHandleError(_0x23fc64));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 4099f4d..5abb66c 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2b91c4,_0x3f45f3){var _0x49b634=function(_0x5e0aa2){while(--_0x5e0aa2){_0x2b91c4['push'](_0x2b91c4['shift']());}};_0x49b634(++_0x3f45f3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1b5aea,_0x1afe6f){_0x1b5aea=_0x1b5aea-0x0;var _0x51cae9=_0xcb91[_0x1b5aea];return _0x51cae9;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x44dc73,_0xe28876){var _0x30639a=function(_0x406391){while(--_0x406391){_0x44dc73['push'](_0x44dc73['shift']());}};_0x30639a(++_0xe28876);}(_0xedd9,0xfc));var _0x9edd=function(_0x27db19,_0x41debc){_0x27db19=_0x27db19-0x0;var _0x437fa8=_0xedd9[_0x27db19];return _0x437fa8;};'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 9e026aa..86c35b9 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 _0x90b1=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x4a64a6,_0x8d107e){var _0x399583=function(_0x186a2a){while(--_0x186a2a){_0x4a64a6['push'](_0x4a64a6['shift']());}};_0x399583(++_0x8d107e);}(_0x90b1,0x1bb));var _0x190b=function(_0x1a0557,_0x2a0db7){_0x1a0557=_0x1a0557-0x0;var _0x1ad015=_0x90b1[_0x1a0557];return _0x1ad015;};'use strict';var Sequelize=require(_0x190b('0x0'));module[_0x190b('0x1')]={'state':{'type':Sequelize[_0x190b('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x190b('0x3')]},'starttime':{'type':Sequelize[_0x190b('0x4')]},'responsetime':{'type':Sequelize[_0x190b('0x4')]},'ringtime':{'type':Sequelize[_0x190b('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2e65=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x44c974,_0x1bcfde){var _0x5214c6=function(_0x10aad5){while(--_0x10aad5){_0x44c974['push'](_0x44c974['shift']());}};_0x5214c6(++_0x1bcfde);}(_0x2e65,0x193));var _0x52e6=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0x2e65[_0x310504];return _0x5b36d0;};'use strict';var Sequelize=require(_0x52e6('0x0'));module[_0x52e6('0x1')]={'state':{'type':Sequelize[_0x52e6('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x52e6('0x3')]},'scheduledat':{'type':Sequelize[_0x52e6('0x4')]},'uniqueid':{'type':Sequelize[_0x52e6('0x3')]},'starttime':{'type':Sequelize[_0x52e6('0x4')]},'responsetime':{'type':Sequelize[_0x52e6('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x52e6('0x3')]},'campaigntype':{'type':Sequelize[_0x52e6('0x3')]},'membername':{'type':Sequelize[_0x52e6('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index cd4887a..acf782c 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 _0x45ed=['path','../../config/environment','./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview','lodash','util','api','moment','bluebird'];(function(_0x398a08,_0x1c53e9){var _0x250703=function(_0x14f64e){while(--_0x14f64e){_0x398a08['push'](_0x398a08['shift']());}};_0x250703(++_0x1c53e9);}(_0x45ed,0x1df));var _0xd45e=function(_0x5c9e08,_0x14a8e6){_0x5c9e08=_0x5c9e08-0x0;var _0x502e01=_0x45ed[_0x5c9e08];return _0x502e01;};'use strict';var _=require(_0xd45e('0x0'));var util=require(_0xd45e('0x1'));var logger=require('../../config/logger')(_0xd45e('0x2'));var moment=require(_0xd45e('0x3'));var BPromise=require(_0xd45e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd45e('0x5'));var rimraf=require('rimraf');var config=require(_0xd45e('0x6'));var attributes=require(_0xd45e('0x7'));module['exports']=function(_0xb0105,_0x3a09b9){return _0xb0105[_0xd45e('0x8')](_0xd45e('0x9'),attributes,{'tableName':_0xd45e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x723d=['moment','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x723d,0x15d));var _0xd723=function(_0x425561,_0x3a4598){_0x425561=_0x425561-0x0;var _0x303b28=_0x723d[_0x425561];return _0x303b28;};'use strict';var _=require('lodash');var util=require(_0xd723('0x0'));var logger=require(_0xd723('0x1'))(_0xd723('0x2'));var moment=require(_0xd723('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd723('0x4'));var rimraf=require(_0xd723('0x5'));var config=require(_0xd723('0x6'));var attributes=require(_0xd723('0x7'));module[_0xd723('0x8')]=function(_0x3a483e,_0xdb3e76){return _0x3a483e['define'](_0xd723('0x9'),attributes,{'tableName':_0xd723('0xa'),'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 f6f9aee..cbfb229 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 _0x5238=['jayson/promise','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','body','options','raw','CreateReportAgentPreview','stringify','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x5982e2,_0x2b1f34){var _0x2d7f1b=function(_0x1614e1){while(--_0x1614e1){_0x5982e2['push'](_0x5982e2['shift']());}};_0x2d7f1b(++_0x2b1f34);}(_0x5238,0x198));var _0x8523=function(_0x4b05b6,_0x230371){_0x4b05b6=_0x4b05b6-0x0;var _0x17f96b=_0x5238[_0x4b05b6];return _0x17f96b;};'use strict';var _=require('lodash');var util=require(_0x8523('0x0'));var moment=require(_0x8523('0x1'));var BPromise=require(_0x8523('0x2'));var rs=require(_0x8523('0x3'));var fs=require('fs');var Redis=require(_0x8523('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8523('0x5'));var logger=require(_0x8523('0x6'))('rpc');var config=require(_0x8523('0x7'));var jayson=require(_0x8523('0x8'));var client=jayson['client'][_0x8523('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b50aa,_0x2124ee,_0x4677be){return new BPromise(function(_0x2b664f,_0x2ca71f){return client[_0x8523('0xa')](_0x1b50aa,_0x4677be)[_0x8523('0xb')](function(_0x22d14b){logger[_0x8523('0xc')](_0x8523('0xd'),_0x2124ee,_0x8523('0xe'));logger[_0x8523('0xf')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x2124ee,_0x8523('0xe'),JSON['stringify'](_0x22d14b));if(_0x22d14b[_0x8523('0x10')]){if(_0x22d14b['error'][_0x8523('0x11')]===0x1f4){logger[_0x8523('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x2124ee,_0x22d14b[_0x8523('0x10')]['message']);return _0x2ca71f(_0x22d14b['error']['message']);}logger['error'](_0x8523('0xd'),_0x2124ee,_0x22d14b[_0x8523('0x10')][_0x8523('0x12')]);return _0x2b664f(_0x22d14b['error'][_0x8523('0x12')]);}else{logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x2124ee,_0x8523('0xe'));_0x2b664f(_0x22d14b[_0x8523('0x13')][_0x8523('0x12')]);}})[_0x8523('0x14')](function(_0x1eb8bb){logger[_0x8523('0x10')](_0x8523('0xd'),_0x2124ee,_0x1eb8bb);_0x2ca71f(_0x1eb8bb);});});}exports['CreateReportAgentPreview']=function(_0x1a9557){var _0xbccc64=this;return new Promise(function(_0x532c8e,_0x226dbb){return db['ReportAgentPreview']['create'](_0x1a9557[_0x8523('0x15')],{'raw':_0x1a9557[_0x8523('0x16')]?_0x1a9557['options'][_0x8523('0x17')]===undefined?!![]:![]:!![]})[_0x8523('0xb')](function(_0x2a9e5c){logger[_0x8523('0xc')](_0x8523('0x18'),_0x1a9557);logger[_0x8523('0xf')](_0x8523('0x18'),_0x1a9557,JSON[_0x8523('0x19')](_0x2a9e5c));_0x532c8e(_0x2a9e5c);})['catch'](function(_0xb26cdb){logger[_0x8523('0x10')](_0x8523('0x18'),_0xb26cdb['message'],_0x1a9557);_0x226dbb(_0xbccc64[_0x8523('0x10')](0x1f4,_0xb26cdb[_0x8523('0x12')]));});});}; \ No newline at end of file +var _0xbacf=['rpc','../../config/environment','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateReportAgentPreview','ReportAgentPreview','create','options','raw','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5a68c8,_0x19c1e9){var _0x408fd4=function(_0x4018bf){while(--_0x4018bf){_0x5a68c8['push'](_0x5a68c8['shift']());}};_0x408fd4(++_0x19c1e9);}(_0xbacf,0x1de));var _0xfbac=function(_0x352d28,_0x444033){_0x352d28=_0x352d28-0x0;var _0x387d7e=_0xbacf[_0x352d28];return _0x387d7e;};'use strict';var _=require('lodash');var util=require(_0xfbac('0x0'));var moment=require(_0xfbac('0x1'));var BPromise=require(_0xfbac('0x2'));var rs=require(_0xfbac('0x3'));var fs=require('fs');var Redis=require(_0xfbac('0x4'));var db=require(_0xfbac('0x5'))['db'];var utils=require(_0xfbac('0x6'));var logger=require(_0xfbac('0x7'))(_0xfbac('0x8'));var config=require(_0xfbac('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xfbac('0xa')][_0xfbac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x108129,_0x251da9,_0x4e92f9){return new BPromise(function(_0x28c7ab,_0x2ebafa){return client[_0xfbac('0xc')](_0x108129,_0x4e92f9)[_0xfbac('0xd')](function(_0x307ee7){logger[_0xfbac('0xe')](_0xfbac('0xf'),_0x251da9,_0xfbac('0x10'));logger['debug']('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x251da9,_0xfbac('0x10'),JSON[_0xfbac('0x11')](_0x307ee7));if(_0x307ee7[_0xfbac('0x12')]){if(_0x307ee7[_0xfbac('0x12')]['code']===0x1f4){logger['error'](_0xfbac('0xf'),_0x251da9,_0x307ee7['error'][_0xfbac('0x13')]);return _0x2ebafa(_0x307ee7[_0xfbac('0x12')][_0xfbac('0x13')]);}logger[_0xfbac('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x251da9,_0x307ee7[_0xfbac('0x12')][_0xfbac('0x13')]);return _0x28c7ab(_0x307ee7[_0xfbac('0x12')]['message']);}else{logger[_0xfbac('0xe')](_0xfbac('0xf'),_0x251da9,_0xfbac('0x10'));_0x28c7ab(_0x307ee7[_0xfbac('0x14')][_0xfbac('0x13')]);}})['catch'](function(_0x479b58){logger[_0xfbac('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x251da9,_0x479b58);_0x2ebafa(_0x479b58);});});}exports[_0xfbac('0x15')]=function(_0x5ce971){var _0x2cacc6=this;return new Promise(function(_0x3ee68b,_0x29d43d){return db[_0xfbac('0x16')][_0xfbac('0x17')](_0x5ce971['body'],{'raw':_0x5ce971[_0xfbac('0x18')]?_0x5ce971[_0xfbac('0x18')][_0xfbac('0x19')]===undefined?!![]:![]:!![]})[_0xfbac('0xd')](function(_0x5d9616){logger[_0xfbac('0xe')](_0xfbac('0x15'),_0x5ce971);logger[_0xfbac('0x1a')](_0xfbac('0x15'),_0x5ce971,JSON['stringify'](_0x5d9616));_0x3ee68b(_0x5d9616);})['catch'](function(_0x24ab7c){logger['error']('CreateReportAgentPreview',_0x24ab7c['message'],_0x5ce971);_0x29d43d(_0x2cacc6[_0xfbac('0x12')](0x1f4,_0x24ab7c[_0xfbac('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 3d17523..9a22cd2 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 _0xc29e=['/outbound','agents','agentCapacity','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id','showMailQueues','queueNotify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','path','Router','../../components/auth/service','./rpc.controller','/voice/channels','get','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','faxQueues','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue'];(function(_0x4704e1,_0x159a76){var _0x334d38=function(_0x531d02){while(--_0x531d02){_0x4704e1['push'](_0x4704e1['shift']());}};_0x334d38(++_0x159a76);}(_0xc29e,0x70));var _0xec29=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xc29e[_0x513aa5];return _0x1a1a7c;};'use strict';var multer=require(_0xec29('0x0'));var util=require(_0xec29('0x1'));var path=require(_0xec29('0x2'));var express=require('express');var router=express[_0xec29('0x3')]();var auth=require(_0xec29('0x4'));var controller=require(_0xec29('0x5'));router['get'](_0xec29('0x6'),auth['isAuthenticated'](),controller['voiceChannels']);router[_0xec29('0x7')](_0xec29('0x8'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0xec29('0x7')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xec29('0x9')](),controller[_0xec29('0xa')]);router[_0xec29('0x7')]('/voice/queues',auth['isAuthenticated'](),controller[_0xec29('0xb')]);router[_0xec29('0x7')](_0xec29('0xc'),auth['isAuthenticated'](),controller[_0xec29('0xd')]);router['get'](_0xec29('0xe'),auth[_0xec29('0x9')](),controller[_0xec29('0xf')]);router[_0xec29('0x7')]('/mail/accounts',auth[_0xec29('0x9')](),controller[_0xec29('0x10')]);router[_0xec29('0x7')](_0xec29('0x11'),auth[_0xec29('0x9')](),controller[_0xec29('0x12')]);router[_0xec29('0x7')]('/sms/queues',auth[_0xec29('0x9')](),controller[_0xec29('0x13')]);router[_0xec29('0x7')](_0xec29('0x14'),auth[_0xec29('0x9')](),controller['whatsappQueues']);router[_0xec29('0x7')]('/fax/queues',auth['isAuthenticated'](),controller[_0xec29('0x15')]);router[_0xec29('0x7')]('/voice/queues/preview/:id',auth[_0xec29('0x9')](),controller['voiceQueuesPreview']);router['get']('/voice/queues/channels',auth[_0xec29('0x9')](),controller[_0xec29('0x16')]);router[_0xec29('0x7')](_0xec29('0x17'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router['get']('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0xec29('0x18')]);router['get'](_0xec29('0x19'),auth[_0xec29('0x9')](),controller['voiceQueuesChannelRedirect']);router[_0xec29('0x7')](_0xec29('0x1a'),auth[_0xec29('0x9')](),controller[_0xec29('0x1b')]);router[_0xec29('0x1c')](_0xec29('0x1a'),auth[_0xec29('0x9')](),controller[_0xec29('0x1d')]);router['get'](_0xec29('0x1e'),auth['isAuthenticated'](),controller['outbound']);router[_0xec29('0x7')]('/outbound/channels',auth[_0xec29('0x9')](),controller['outboundChannels']);router[_0xec29('0x7')]('/agents',auth[_0xec29('0x9')](),controller[_0xec29('0x1f')]);router[_0xec29('0x1c')]('/agents/:id/capacity',auth[_0xec29('0x9')](),controller[_0xec29('0x20')]);router[_0xec29('0x7')]('/telephones',auth['isAuthenticated'](),controller[_0xec29('0x21')]);router[_0xec29('0x7')](_0xec29('0x22'),auth[_0xec29('0x9')](),controller[_0xec29('0x23')]);router['get'](_0xec29('0x24'),auth[_0xec29('0x9')](),controller[_0xec29('0x25')]);router[_0xec29('0x7')](_0xec29('0x26'),auth[_0xec29('0x9')](),controller[_0xec29('0x27')]);router[_0xec29('0x7')](_0xec29('0x28'),auth[_0xec29('0x9')](),controller['chatQueuesWaitingInteractions']);router[_0xec29('0x7')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xec29('0x29')]);router[_0xec29('0x7')](_0xec29('0x2a'),auth[_0xec29('0x9')](),controller[_0xec29('0x2b')]);router['get'](_0xec29('0x2c'),auth[_0xec29('0x9')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0xec29('0x7')](_0xec29('0x2d'),auth[_0xec29('0x9')](),controller['smsQueuesWaitingInteractions']);router['get'](_0xec29('0x2e'),auth[_0xec29('0x9')](),controller[_0xec29('0x2f')]);router[_0xec29('0x7')](_0xec29('0x30'),auth[_0xec29('0x9')](),controller[_0xec29('0x31')]);router[_0xec29('0x32')]('/mail/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify']('mail'));router[_0xec29('0x7')](_0xec29('0x33'),auth[_0xec29('0x9')](),controller[_0xec29('0x34')]);router['post']('/chat/queues/:id/notify',auth[_0xec29('0x9')](),controller[_0xec29('0x35')](_0xec29('0x36')));router[_0xec29('0x7')](_0xec29('0x37'),auth['isAuthenticated'](),controller[_0xec29('0x38')]);router[_0xec29('0x32')](_0xec29('0x39'),auth[_0xec29('0x9')](),controller[_0xec29('0x35')]('fax'));router[_0xec29('0x7')](_0xec29('0x3a'),auth[_0xec29('0x9')](),controller[_0xec29('0x3b')]);router[_0xec29('0x32')](_0xec29('0x3c'),auth['isAuthenticated'](),controller[_0xec29('0x35')]('openchannel'));router[_0xec29('0x7')](_0xec29('0x3d'),auth[_0xec29('0x9')](),controller[_0xec29('0x3e')]);router[_0xec29('0x32')](_0xec29('0x3f'),auth['isAuthenticated'](),controller[_0xec29('0x35')](_0xec29('0x40')));router[_0xec29('0x32')](_0xec29('0x41'),auth[_0xec29('0x9')](),controller[_0xec29('0x35')]('whatsapp'));router[_0xec29('0x7')]('/sms/queues/:id',auth[_0xec29('0x9')](),controller[_0xec29('0x42')]);router[_0xec29('0x7')](_0xec29('0x43'),auth[_0xec29('0x9')](),controller[_0xec29('0x44')]);router[_0xec29('0x32')](_0xec29('0x45'),auth['isAuthenticated'](),controller[_0xec29('0x46')]);module['exports']=router; \ No newline at end of file +var _0xf87a=['/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','agentNotify','exports','express','Router','./rpc.controller','get','/voice/channels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailAccounts','openchannelQueues','smsQueues','whatsappQueues','/fax/queues','faxQueues'];(function(_0x58e45a,_0x24915d){var _0x451162=function(_0x4efaf9){while(--_0x4efaf9){_0x58e45a['push'](_0x58e45a['shift']());}};_0x451162(++_0x24915d);}(_0xf87a,0x8b));var _0xaf87=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xf87a[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require(_0xaf87('0x0'));var router=express[_0xaf87('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xaf87('0x2'));router[_0xaf87('0x3')](_0xaf87('0x4'),auth['isAuthenticated'](),controller['voiceChannels']);router['get'](_0xaf87('0x5'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x7')]);router[_0xaf87('0x3')](_0xaf87('0x8'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x9')]);router['get'](_0xaf87('0xa'),auth[_0xaf87('0x6')](),controller[_0xaf87('0xb')]);router[_0xaf87('0x3')](_0xaf87('0xc'),auth[_0xaf87('0x6')](),controller[_0xaf87('0xd')]);router[_0xaf87('0x3')](_0xaf87('0xe'),auth[_0xaf87('0x6')](),controller['mailQueues']);router['get']('/mail/accounts',auth['isAuthenticated'](),controller[_0xaf87('0xf')]);router[_0xaf87('0x3')]('/openchannel/queues',auth[_0xaf87('0x6')](),controller[_0xaf87('0x10')]);router['get']('/sms/queues',auth['isAuthenticated'](),controller[_0xaf87('0x11')]);router[_0xaf87('0x3')]('/whatsapp/queues',auth['isAuthenticated'](),controller[_0xaf87('0x12')]);router[_0xaf87('0x3')](_0xaf87('0x13'),auth['isAuthenticated'](),controller[_0xaf87('0x14')]);router[_0xaf87('0x3')](_0xaf87('0x15'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x16')]);router[_0xaf87('0x3')]('/voice/queues/channels',auth[_0xaf87('0x6')](),controller['voiceQueuesChannels']);router[_0xaf87('0x3')](_0xaf87('0x17'),auth[_0xaf87('0x6')](),controller['voiceQueuesChannel']);router['get'](_0xaf87('0x18'),auth[_0xaf87('0x6')](),controller['voiceQueuesChannelHangup']);router['get'](_0xaf87('0x19'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x1a')]);router[_0xaf87('0x3')](_0xaf87('0x1b'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x1c')]);router[_0xaf87('0x1d')]('/voice/queues/:id',auth[_0xaf87('0x6')](),controller[_0xaf87('0x1e')]);router[_0xaf87('0x3')](_0xaf87('0x1f'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x20')]);router['get'](_0xaf87('0x21'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x22')]);router[_0xaf87('0x3')](_0xaf87('0x23'),auth['isAuthenticated'](),controller[_0xaf87('0x24')]);router['put'](_0xaf87('0x25'),auth['isAuthenticated'](),controller['agentCapacity']);router[_0xaf87('0x3')]('/telephones',auth['isAuthenticated'](),controller[_0xaf87('0x26')]);router[_0xaf87('0x3')]('/trunks',auth[_0xaf87('0x6')](),controller[_0xaf87('0x27')]);router[_0xaf87('0x3')](_0xaf87('0x28'),auth['isAuthenticated'](),controller[_0xaf87('0x29')]);router[_0xaf87('0x3')](_0xaf87('0x2a'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x2b')]);router[_0xaf87('0x3')](_0xaf87('0x2c'),auth['isAuthenticated'](),controller[_0xaf87('0x2d')]);router['get']('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xaf87('0x2e')]);router[_0xaf87('0x3')](_0xaf87('0x2f'),auth[_0xaf87('0x6')](),controller['openchannelQueuesWaitingInteractions']);router['get'](_0xaf87('0x30'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x31')]);router[_0xaf87('0x3')](_0xaf87('0x32'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x33')]);router[_0xaf87('0x3')](_0xaf87('0x34'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x35')]);router[_0xaf87('0x3')](_0xaf87('0x36'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x37')]);router[_0xaf87('0x38')](_0xaf87('0x39'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x3a')](_0xaf87('0x3b')));router['get'](_0xaf87('0x3c'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x3d')]);router[_0xaf87('0x38')](_0xaf87('0x3e'),auth['isAuthenticated'](),controller['queueNotify'](_0xaf87('0x3f')));router['get'](_0xaf87('0x40'),auth['isAuthenticated'](),controller[_0xaf87('0x41')]);router[_0xaf87('0x38')](_0xaf87('0x42'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x3a')](_0xaf87('0x43')));router[_0xaf87('0x3')]('/fax/queues/:id',auth[_0xaf87('0x6')](),controller[_0xaf87('0x44')]);router[_0xaf87('0x38')](_0xaf87('0x45'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x3a')](_0xaf87('0x46')));router[_0xaf87('0x3')](_0xaf87('0x47'),auth['isAuthenticated'](),controller[_0xaf87('0x48')]);router[_0xaf87('0x38')]('/sms/queues/:id/notify',auth[_0xaf87('0x6')](),controller['queueNotify'](_0xaf87('0x49')));router[_0xaf87('0x38')](_0xaf87('0x4a'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x3a')]('whatsapp'));router[_0xaf87('0x3')](_0xaf87('0x4b'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x4c')]);router[_0xaf87('0x3')](_0xaf87('0x4d'),auth[_0xaf87('0x6')](),controller['showWhatsappQueues']);router[_0xaf87('0x38')]('/agents/:id/notify',auth[_0xaf87('0x6')](),controller[_0xaf87('0x4e')]);module[_0xaf87('0x4f')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 5305817..0fa7120 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 _0xbaf0=['MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','value','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','Agent\x20not\x20found','InteractionId','agentTransferTimeout','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','status','sendStatus','stack','name','isNil','rows','voiceChannels','VoiceChannels','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','mailQueuesWaitingInteractions'];(function(_0x705a26,_0x514596){var _0x3132df=function(_0x21b28f){while(--_0x21b28f){_0x705a26['push'](_0x705a26['shift']());}};_0x3132df(++_0x514596);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var BPromise=require('bluebird');var moment=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var db=require(_0x0baf('0x3'))['db'];var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232a});var mailClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232b});var routingClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){var _0x5f20aa=_0x1d0a0d?_0x1d0a0d:amiClient;return _0x5f20aa[_0x0baf('0x8')](_0x1a10b1,_0x2dcaac)[_0x0baf('0x9')](function(_0x465528){if(_0x465528[_0x0baf('0xa')]){if(_0x465528[_0x0baf('0xa')][_0x0baf('0xb')]===0x1f4){return _0x11b947(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}return _0x5f5030(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}else{_0x5f5030(_0x465528[_0x0baf('0xd')]);}})['catch'](function(_0x5a53e2){_0x11b947(_0x5a53e2);});});}function respondWithResult(_0x465dd7,_0xe4378c){_0xe4378c=_0xe4378c||0xc8;return function(_0x5db689){if(_0x5db689){return _0x465dd7[_0x0baf('0xe')](_0xe4378c)['json'](_0x5db689);}return _0x465dd7[_0x0baf('0xf')](0x194);};}function handleError(_0x49e44b,_0x1c76a8){_0x1c76a8=_0x1c76a8||0x1f4;return function(_0x1f50c3){logger[_0x0baf('0xa')](_0x1f50c3[_0x0baf('0x10')]);if(_0x1f50c3[_0x0baf('0x11')]){delete _0x1f50c3[_0x0baf('0x11')];}_0x49e44b['status'](_0x1c76a8)['send'](_0x1f50c3);};}function findById(_0x2312c7){return function(_0x38395b){if(!_[_0x0baf('0x12')](_0x2312c7)&&!_[_0x0baf('0x12')](_0x38395b)&&!_[_0x0baf('0x12')](_0x38395b[_0x0baf('0x13')])){return _['find'](_0x38395b[_0x0baf('0x13')],function(_0xfbecec){return _0xfbecec['id']==_0x2312c7;});}return null;};}exports[_0x0baf('0x14')]=function(_0x3e9cb4,_0x47070d){return respondWithRpcPromise(_0x0baf('0x15'),_0x3e9cb4['query'])['then'](respondWithResult(_0x47070d,null))[_0x0baf('0x16')](handleError(_0x47070d,null));};exports[_0x0baf('0x17')]=function(_0x32e839,_0x1848e8){return respondWithRpcPromise(_0x0baf('0x18'),_[_0x0baf('0x19')](_0x32e839[_0x0baf('0x1a')],_0x32e839[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1848e8,null))[_0x0baf('0x16')](handleError(_0x1848e8,null));};exports['voiceChannelStopMixMonitor']=function(_0x334bd6,_0x482522){return respondWithRpcPromise(_0x0baf('0x1c'),_['merge'](_0x334bd6['query'],_0x334bd6[_0x0baf('0x1b')]))['then'](respondWithResult(_0x482522,null))['catch'](handleError(_0x482522,null));};exports[_0x0baf('0x1d')]=function(_0x27b59c,_0x34e264){return respondWithRpcPromise(_0x0baf('0x1e'),_0x27b59c[_0x0baf('0x1a')])['then'](respondWithResult(_0x34e264,null))[_0x0baf('0x16')](handleError(_0x34e264,null));};exports[_0x0baf('0x1f')]=function(_0x1ca35a,_0x366e71){return respondWithRpcPromise(_0x0baf('0x1e'),_0x1ca35a[_0x0baf('0x1a')])[_0x0baf('0x9')](findById(_0x1ca35a['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x366e71,null))[_0x0baf('0x16')](handleError(_0x366e71,null));};exports[_0x0baf('0x20')]=function(_0x265915,_0x55c715){return respondWithRpcPromise(_0x0baf('0x21'),_[_0x0baf('0x19')](_0x265915['body'],_0x265915[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x55c715,null))[_0x0baf('0x16')](handleError(_0x55c715,null));};exports[_0x0baf('0x22')]=function(_0xd14f0f,_0x366924){return respondWithRpcPromise(_0x0baf('0x23'),_['merge'](_0xd14f0f[_0x0baf('0x1a')],_0xd14f0f[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x366924,null))[_0x0baf('0x16')](handleError(_0x366924,null));};exports[_0x0baf('0x24')]=function(_0x275ea1,_0x2fc983){return respondWithRpcPromise(_0x0baf('0x25'),_0x275ea1[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x2fc983,null))[_0x0baf('0x16')](handleError(_0x2fc983,null));};exports[_0x0baf('0x26')]=function(_0x45294a,_0x3a3353){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0baf('0x19')](_0x45294a['query'],_0x45294a[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x3a3353,null))[_0x0baf('0x16')](handleError(_0x3a3353,null));};exports[_0x0baf('0x27')]=function(_0x5300a5,_0x1a2b03){return respondWithRpcPromise(_0x0baf('0x28'),_['merge'](_0x5300a5[_0x0baf('0x1a')],_0x5300a5[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1a2b03,null))[_0x0baf('0x16')](handleError(_0x1a2b03,null));};exports[_0x0baf('0x29')]=function(_0x1b0991,_0xe03d82){return respondWithRpcPromise(_0x0baf('0x2a'),_['merge'](_0x1b0991[_0x0baf('0x1a')],_0x1b0991[_0x0baf('0x1b')]))['then'](respondWithResult(_0xe03d82,null))[_0x0baf('0x16')](handleError(_0xe03d82,null));};exports['outbound']=function(_0x5c545f,_0x11bc49){return respondWithRpcPromise(_0x0baf('0x2b'),_0x5c545f['query'])['then'](respondWithResult(_0x11bc49,null))[_0x0baf('0x16')](handleError(_0x11bc49,null));};exports[_0x0baf('0x2c')]=function(_0x3412bc,_0xb2d9ab){return respondWithRpcPromise(_0x0baf('0x2d'),_0x3412bc[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0xb2d9ab,null))[_0x0baf('0x16')](handleError(_0xb2d9ab,null));};exports[_0x0baf('0x2e')]=function(_0x36c6d2,_0x200864){var _0x148540;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2[_0x0baf('0x1a')])['then'](function(_0x3573ce){_0x148540=_0x3573ce;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2['query'],routingClient);})[_0x0baf('0x9')](function(_0x324369){return _[_0x0baf('0x19')]({},_0x324369,_0x148540);})[_0x0baf('0x9')](respondWithResult(_0x200864,null))[_0x0baf('0x16')](handleError(_0x200864,null));};exports[_0x0baf('0x30')]=function(_0x57b581,_0x23ad34){if(_0x57b581[_0x0baf('0x31')]&&_0x57b581['body'][_0x0baf('0x32')]&&_0x57b581[_0x0baf('0x33')]&&_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]){for(var _0x504031 in _0x57b581[_0x0baf('0x31')][_0x0baf('0x32')]){if(_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x0baf('0x34')](_0x504031)){db[_0x0baf('0x35')][_0x0baf('0x36')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':_0x0baf('0x37'),'exitAt':null,'uniqueid':_0x57b581['body'][_0x0baf('0x32')][_0x504031]&&_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')]?{'$notIn':_0x57b581[_0x0baf('0x31')]['interaction'][_0x504031]}:{'$ne':null}}})[_0x0baf('0x9')](function(_0x310240){var _0x27c3ee=moment()[_0x0baf('0x39')](_0x0baf('0x3a'));for(var _0x54ed41=0x0,_0x2a0924=_0x310240[_0x0baf('0x38')];_0x54ed41<_0x2a0924;_0x54ed41+=0x1){_0x310240[_0x54ed41][_0x0baf('0x3b')]({'exitAt':_0x27c3ee});}});for(var _0x1522b0=0x0;_0x1522b0<_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')];_0x1522b0+=0x1){db['MemberReport'][_0x0baf('0x3c')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':'INTERACTION','uniqueid':_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x1522b0],'exitAt':null},'defaults':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'interface':_[_0x0baf('0x12')](_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')])?util['format'](_0x0baf('0x3e'),_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]):_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')],'type':_0x0baf('0x37'),'enterAt':moment()[_0x0baf('0x39')](_0x0baf('0x3a')),'role':_0x0baf('0x3f'),'internal':_0x57b581[_0x0baf('0x33')][_0x0baf('0x40')],'uniqueid':_0x57b581['body']['interaction'][_0x504031][_0x1522b0]}});}}}}return respondWithRpcPromise(_0x0baf('0x41'),{'id':_0x57b581[_0x0baf('0x1b')]['id'],'capacity':_0x57b581[_0x0baf('0x31')][_0x0baf('0x42')]},routingClient)[_0x0baf('0x9')](respondWithResult(_0x23ad34,null))[_0x0baf('0x16')](handleError(_0x23ad34,null));};exports[_0x0baf('0x43')]=function(_0x4b492c,_0x3fe534){return respondWithRpcPromise(_0x0baf('0x44'),_0x4b492c[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x3fe534,null))[_0x0baf('0x16')](handleError(_0x3fe534,null));};exports[_0x0baf('0x45')]=function(_0x5e1849,_0x3eebe5){return respondWithRpcPromise('Trunks',_0x5e1849[_0x0baf('0x1a')])['then'](respondWithResult(_0x3eebe5,null))[_0x0baf('0x16')](handleError(_0x3eebe5,null));};exports['campaigns']=function(_0x35b1a5,_0x4c035b){return respondWithRpcPromise(_0x0baf('0x46'),_0x35b1a5[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x4c035b,null))[_0x0baf('0x16')](handleError(_0x4c035b,null));};exports[_0x0baf('0x47')]=function(_0x576475,_0x21f179){return respondWithRpcPromise(_0x0baf('0x48'),_0x576475[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21f179,null))[_0x0baf('0x16')](handleError(_0x21f179,null));};exports[_0x0baf('0x49')]=function(_0x480834,_0x402f4d){return respondWithRpcPromise(_0x0baf('0x48'),_0x480834[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x480834[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x402f4d,null))[_0x0baf('0x16')](handleError(_0x402f4d,null));};exports['mailQueues']=function(_0x48e855,_0x23f6ea){return respondWithRpcPromise(_0x0baf('0x4a'),_0x48e855[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x23f6ea,null))[_0x0baf('0x16')](handleError(_0x23f6ea,null));};exports[_0x0baf('0x4b')]=function(_0xaa4293,_0x14a667){return respondWithRpcPromise(_0x0baf('0x4a'),_0xaa4293['query'],routingClient)[_0x0baf('0x9')](findById(_0xaa4293[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x14a667,null))[_0x0baf('0x16')](handleError(_0x14a667,null));};exports[_0x0baf('0x4c')]=function(_0xebfc0c,_0x26f5c9){return respondWithRpcPromise('MailAccounts',_0xebfc0c[_0x0baf('0x1a')],mailClient)[_0x0baf('0x9')](respondWithResult(_0x26f5c9,null))[_0x0baf('0x16')](handleError(_0x26f5c9,null));};exports[_0x0baf('0x4d')]=function(_0x1c7d88,_0x1a6d22){return respondWithRpcPromise(_0x0baf('0x4e'),_0x1c7d88[_0x0baf('0x1a')],routingClient)['then'](respondWithResult(_0x1a6d22,null))[_0x0baf('0x16')](handleError(_0x1a6d22,null));};exports['showOpenchannelQueues']=function(_0x3c00e7,_0x5f2fbe){return respondWithRpcPromise('OpenchannelQueues',_0x3c00e7[_0x0baf('0x1a')],routingClient)['then'](findById(_0x3c00e7[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x5f2fbe,null))['catch'](handleError(_0x5f2fbe,null));};exports[_0x0baf('0x4f')]=function(_0xfb6708,_0x156572){return respondWithRpcPromise('SmsQueues',_0xfb6708['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x156572,null))[_0x0baf('0x16')](handleError(_0x156572,null));};exports[_0x0baf('0x50')]=function(_0x7f49e,_0x784e1a){return respondWithRpcPromise('SmsQueues',_0x7f49e[_0x0baf('0x1a')],routingClient)['then'](findById(_0x7f49e['params']['id']))['then'](respondWithResult(_0x784e1a,null))[_0x0baf('0x16')](handleError(_0x784e1a,null));};exports['whatsappQueues']=function(_0x4946d4,_0x11a81e){return respondWithRpcPromise(_0x0baf('0x51'),_0x4946d4[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x11a81e,null))[_0x0baf('0x16')](handleError(_0x11a81e,null));};exports[_0x0baf('0x52')]=function(_0x4c05d6,_0xec3b32){return respondWithRpcPromise(_0x0baf('0x51'),_0x4c05d6[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x4c05d6[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0xec3b32,null))['catch'](handleError(_0xec3b32,null));};exports[_0x0baf('0x53')]=function(_0x468363,_0x29fd46){return respondWithRpcPromise('FaxQueues',_0x468363[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x29fd46,null))[_0x0baf('0x16')](handleError(_0x29fd46,null));};exports[_0x0baf('0x54')]=function(_0x125906,_0x27a959){return respondWithRpcPromise(_0x0baf('0x55'),_0x125906['query'],routingClient)['then'](findById(_0x125906['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x27a959,null))[_0x0baf('0x16')](handleError(_0x27a959,null));};exports[_0x0baf('0x56')]=function(_0x12b9b5,_0x3e65d4){return respondWithRpcPromise(_0x0baf('0x57'),_0x12b9b5['query'])['then'](respondWithResult(_0x3e65d4,null))[_0x0baf('0x16')](handleError(_0x3e65d4,null));};exports['chatQueuesWaitingInteractions']=function(_0x22cd07,_0x3e9b79){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x22cd07[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x3e9b79,null))[_0x0baf('0x16')](handleError(_0x3e9b79,null));};exports[_0x0baf('0x58')]=function(_0x115ff5,_0x33a5af){return respondWithRpcPromise(_0x0baf('0x59'),_0x115ff5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x33a5af,null))['catch'](handleError(_0x33a5af,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x58a079,_0x493784){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x58a079[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x493784,null))[_0x0baf('0x16')](handleError(_0x493784,null));};exports[_0x0baf('0x5a')]=function(_0x5093f5,_0x1be7f2){return respondWithRpcPromise(_0x0baf('0x5b'),_0x5093f5['query'],routingClient)['then'](function(_0x43aecd){if(_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')]!==undefined){var _0x442e5f=_(_0x43aecd[_0x0baf('0x13')])[_0x0baf('0x5d')]([_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')],_0x5093f5['params']['id']])[_0x0baf('0x5e')](_0x0baf('0x5f'))['uniq']()[_0x0baf('0x60')]();return _0x43aecd[_0x0baf('0x13')]['filter'](function(_0x97d385){return _0x442e5f[_0x0baf('0x61')](_0x97d385[_0x0baf('0x5f')])>-0x1;});}else{return _0x43aecd[_0x0baf('0x13')][_0x0baf('0x5d')](function(_0x4fc5af){return _0x4fc5af['queue_id']===parseInt(_0x5093f5[_0x0baf('0x1b')]['id']);});}})[_0x0baf('0x9')](respondWithResult(_0x1be7f2,null))['catch'](handleError(_0x1be7f2,null));};exports[_0x0baf('0x62')]=function(_0x59dad5,_0x21ad25){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x59dad5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21ad25,null))[_0x0baf('0x16')](handleError(_0x21ad25,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3c2bc1,_0x5008c5){return respondWithRpcPromise(_0x0baf('0x63'),_0x3c2bc1[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x5008c5,null))[_0x0baf('0x16')](handleError(_0x5008c5,null));};exports[_0x0baf('0x64')]=function(_0x52e845,_0x866e6e){return respondWithRpcPromise(_0x0baf('0x65'),_0x52e845['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x866e6e,null))[_0x0baf('0x16')](handleError(_0x866e6e,null));};exports[_0x0baf('0x66')]=function(_0x379c54){return function(_0x1cbbcc,_0x250df2){var _0xa4fd1b,_0x1cda78;var _0x44ef57=_[_0x0baf('0x67')](_0x379c54);var _0x3b7abf=_0x379c54===_0x0baf('0x68')?'Website':'Account';return db[_0x44ef57+_0x0baf('0x69')][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1cbbcc[_0x0baf('0x1b')]['id']}})['then'](function(_0x507783){if(_[_0x0baf('0x12')](_0x507783)){throw new Error(_0x44ef57+_0x0baf('0x6b'));}_0xa4fd1b=_0x507783;return db[_0x44ef57+_0x0baf('0x6c')][_0x0baf('0x6a')]({'where':{'id':_0x1cbbcc[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x44ef57+_0x0baf('0x6e')],'as':_0x0baf('0x6e')},{'model':db[_0x44ef57+_0x3b7abf],'as':_0x0baf('0x6f')}]});})['then'](function(_0x1590a5){if(_[_0x0baf('0x12')](_0x1590a5)){throw new Error(_0x44ef57+_0x0baf('0x70'));}_0x1cda78=_0x1590a5;return _0x1590a5[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5d26e6={'uniqueid':_0x379c54+'.'+_0x1cda78['id']+'.'+_0x1cda78['Interaction']['id'],'FromUserId':_0x1cbbcc[_0x0baf('0x33')]['id'],'type':_0x0baf('0x72')};_0x5d26e6[_0x44ef57+'MessageId']=_0x1cda78['id'];_0x5d26e6[_0x44ef57+'InteractionId']=_0x1cda78[_0x0baf('0x6e')]['id'];_0x5d26e6[_0x0baf('0x73')+_0x44ef57+_0x3b7abf+'Id']=_0x1cda78['Account']['id'];_0x5d26e6['To'+_0x44ef57+_0x0baf('0x74')]=_0xa4fd1b['id'];return db[_0x44ef57+_0x0baf('0x75')][_0x0baf('0x76')](_0x5d26e6);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x379c54,'interaction':_0x1cda78[_0x0baf('0x6e')],'message':_0x1cda78,'account':_0x1cda78[_0x0baf('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0baf('0x72'),'appdata':_0xa4fd1b[_0x0baf('0x11')]+','+(_0x1cda78[_0x0baf('0x6f')][_0x0baf('0x78')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x250df2,null))[_0x0baf('0x16')](handleError(_0x250df2,null));};};exports[_0x0baf('0x7a')]=function(_0x1e1adb,_0x3bd15b){var _0x3c37b4,_0x195303;if(_['isNil'](_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x7b')])){throw new Error(_0x0baf('0x7c'));}var _0x457ae8=_0x1e1adb[_0x0baf('0x31')]['channel'];var _0x3761b5=_[_0x0baf('0x67')](_0x457ae8);var _0x2eae1b=_0x457ae8===_0x0baf('0x68')?_0x0baf('0x7d'):'Account';return db['User'][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1e1adb['params']['id'],'role':_0x0baf('0x3f')}})['then'](function(_0x32d8b6){if(_[_0x0baf('0x12')](_0x32d8b6)){throw new Error(_0x0baf('0x7e'));}_0x3c37b4=_0x32d8b6;return db[_0x3761b5+_0x0baf('0x6c')]['findOne']({'where':{'id':_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x3761b5+_0x0baf('0x6e')],'as':'Interaction'},{'model':db[_0x3761b5+_0x2eae1b],'as':'Account'}]});})['then'](function(_0x4d4884){if(_[_0x0baf('0x12')](_0x4d4884)){throw new Error(_0x3761b5+_0x0baf('0x70'));}_0x195303=_0x4d4884;return _0x4d4884[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0baf('0x9')](function(){var _0x597830={'uniqueid':_0x457ae8+'.'+_0x195303['id']+'.'+_0x195303[_0x0baf('0x6e')]['id'],'FromUserId':_0x1e1adb[_0x0baf('0x33')]['id'],'type':_0x0baf('0x3f'),'ToUserId':_0x3c37b4['id']};_0x597830[_0x3761b5+'MessageId']=_0x195303['id'];_0x597830[_0x3761b5+_0x0baf('0x7f')]=_0x195303[_0x0baf('0x6e')]['id'];_0x597830['From'+_0x3761b5+_0x2eae1b+'Id']=_0x195303[_0x0baf('0x6f')]['id'];return db[_0x3761b5+'TransferReport'][_0x0baf('0x76')](_0x597830);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x457ae8,'interaction':_0x195303[_0x0baf('0x6e')],'message':_0x195303,'account':_0x195303['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x3c37b4[_0x0baf('0x11')]+','+(_0x195303['Account'][_0x0baf('0x80')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})[_0x0baf('0x9')](respondWithResult(_0x3bd15b,null))[_0x0baf('0x16')](handleError(_0x3bd15b,null));}; \ No newline at end of file +var _0xe706=['indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','update','queue','MessageId','InteractionId','TransferReport','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq'];(function(_0x7ea75c,_0x309442){var _0x46c5e5=function(_0x572626){while(--_0x572626){_0x7ea75c['push'](_0x7ea75c['shift']());}};_0x46c5e5(++_0x309442);}(_0xe706,0xa3));var _0x6e70=function(_0x350258,_0x4e0a50){_0x350258=_0x350258-0x0;var _0x3714b3=_0xe706[_0x350258];return _0x3714b3;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 71d236a..73a161e 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 _0x6869=['/:id/run','run','post','create','put','/:id','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','show'];(function(_0x390ef6,_0x1d401c){var _0x2fdaac=function(_0x692ab7){while(--_0x692ab7){_0x390ef6['push'](_0x390ef6['shift']());}};_0x2fdaac(++_0x1d401c);}(_0x6869,0xab));var _0x9686=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x6869[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x9686('0x0'));var util=require(_0x9686('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9686('0x2'));var router=express[_0x9686('0x3')]();var fs_extra=require(_0x9686('0x4'));var auth=require(_0x9686('0x5'));var interaction=require(_0x9686('0x6'));var config=require(_0x9686('0x7'));var controller=require(_0x9686('0x8'));router[_0x9686('0x9')]('/',auth[_0x9686('0xa')](),controller[_0x9686('0xb')]);router['get']('/:id',auth[_0x9686('0xa')](),controller[_0x9686('0xc')]);router[_0x9686('0x9')](_0x9686('0xd'),auth[_0x9686('0xa')](),controller[_0x9686('0xe')]);router[_0x9686('0xf')]('/',auth['isAuthenticated'](),controller[_0x9686('0x10')]);router[_0x9686('0x11')](_0x9686('0x12'),auth['isAuthenticated'](),controller[_0x9686('0x13')]);router[_0x9686('0x14')](_0x9686('0x12'),auth['isAuthenticated'](),controller[_0x9686('0x15')]);module[_0x9686('0x16')]=router; \ No newline at end of file +var _0xa918=['../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','index','/:id','isAuthenticated','show','/:id/run','run','create','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0x20e81e,_0x2ad41f){var _0x3e6654=function(_0x3f2904){while(--_0x3f2904){_0x20e81e['push'](_0x20e81e['shift']());}};_0x3e6654(++_0x2ad41f);}(_0xa918,0x1d1));var _0x8a91=function(_0x546000,_0x3459f2){_0x546000=_0x546000-0x0;var _0x780c08=_0xa918[_0x546000];return _0x780c08;};'use strict';var multer=require('multer');var util=require(_0x8a91('0x0'));var path=require(_0x8a91('0x1'));var timeout=require(_0x8a91('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8a91('0x3'));var interaction=require(_0x8a91('0x4'));var config=require(_0x8a91('0x5'));var controller=require(_0x8a91('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x8a91('0x7')]);router['get'](_0x8a91('0x8'),auth[_0x8a91('0x9')](),controller[_0x8a91('0xa')]);router['get'](_0x8a91('0xb'),auth[_0x8a91('0x9')](),controller[_0x8a91('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8a91('0xd')]);router[_0x8a91('0xe')](_0x8a91('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x8a91('0xf')](_0x8a91('0x8'),auth['isAuthenticated'](),controller[_0x8a91('0x10')]);module[_0x8a91('0x11')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 0160f0e..d55813d 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 _0xe384=['pdf','xlsx','csv','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','hours','minutes'];(function(_0x54d84b,_0x3ab478){var _0x34fce4=function(_0x3e564f){while(--_0x3e564f){_0x54d84b['push'](_0x54d84b['shift']());}};_0x34fce4(++_0x3ab478);}(_0xe384,0x1e6));var _0x4e38=function(_0x495dec,_0x16242e){_0x495dec=_0x495dec-0x0;var _0x248e69=_0xe384[_0x495dec];return _0x248e69;};'use strict';var Sequelize=require(_0x4e38('0x0'));module[_0x4e38('0x1')]={'name':{'type':Sequelize[_0x4e38('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x4e38('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x4e38('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x4e38('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x4e38('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x4e38('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x4e38('0x6')](_0x4e38('0x7'),_0x4e38('0x8'),_0x4e38('0x9'),_0x4e38('0xa'),_0x4e38('0xb'),_0x4e38('0xc'),_0x4e38('0xd')),'allowNull':![],'defaultValue':_0x4e38('0xb')},'output':{'type':Sequelize['ENUM']('csv',_0x4e38('0xe'),_0x4e38('0xf')),'allowNull':![],'defaultValue':_0x4e38('0x10')},'type':{'type':Sequelize['ENUM'](_0x4e38('0x11'),_0x4e38('0x12')),'allowNull':![],'defaultValue':_0x4e38('0x11')},'sendMail':{'type':Sequelize[_0x4e38('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x4e38('0x2')]},'cc':{'type':Sequelize[_0x4e38('0x13')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x4e38('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6cdd=['weeks','days','hours','minutes','csv','pdf','ENUM','default','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','years','quarters','months'];(function(_0x15ca1a,_0x30fc82){var _0x507626=function(_0x14c9bc){while(--_0x14c9bc){_0x15ca1a['push'](_0x15ca1a['shift']());}};_0x507626(++_0x30fc82);}(_0x6cdd,0x1ac));var _0xd6cd=function(_0x47101c,_0x3665e8){_0x47101c=_0x47101c-0x0;var _0x132d33=_0x6cdd[_0x47101c];return _0x132d33;};'use strict';var Sequelize=require(_0xd6cd('0x0'));module[_0xd6cd('0x1')]={'name':{'type':Sequelize[_0xd6cd('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd6cd('0x2')]},'active':{'type':Sequelize[_0xd6cd('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xd6cd('0x2')],'allowNull':![],'defaultValue':_0xd6cd('0x4')},'startAt':{'type':Sequelize[_0xd6cd('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xd6cd('0x6'),_0xd6cd('0x7'),_0xd6cd('0x8'),_0xd6cd('0x9'),_0xd6cd('0xa'),_0xd6cd('0xb'),_0xd6cd('0xc')),'allowNull':![],'defaultValue':_0xd6cd('0xa')},'output':{'type':Sequelize['ENUM'](_0xd6cd('0xd'),_0xd6cd('0xe'),'xlsx'),'allowNull':![],'defaultValue':_0xd6cd('0xd')},'type':{'type':Sequelize[_0xd6cd('0xf')]('custom',_0xd6cd('0x10')),'allowNull':![],'defaultValue':_0xd6cd('0x11')},'sendMail':{'type':Sequelize[_0xd6cd('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xd6cd('0x2')]},'cc':{'type':Sequelize[_0xd6cd('0x12')]},'bcc':{'type':Sequelize[_0xd6cd('0x12')]},'sendIfEmpty':{'type':Sequelize[_0xd6cd('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 159c292..0d733fb 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 _0xd2b6=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','get','Scheduler','UserProfileResource','error','stack','index','map','rawAttributes','type','model','name','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','Schedule','includeAll','findAll','rows','catch','show','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','run','../../config/schedule','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x5890ef,_0x5502b1){var _0xdb00f1=function(_0x3d53a8){while(--_0x3d53a8){_0x5890ef['push'](_0x5890ef['shift']());}};_0xdb00f1(++_0x5502b1);}(_0xd2b6,0x94));var _0x6d2b=function(_0x36393b,_0x35252a){_0x36393b=_0x36393b-0x0;var _0xb397e6=_0xd2b6[_0x36393b];return _0xb397e6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6d2b('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6d2b('0x1'));var moment=require('moment');var BPromise=require(_0x6d2b('0x2'));var Mustache=require('mustache');var util=require(_0x6d2b('0x3'));var path=require(_0x6d2b('0x4'));var sox=require('sox');var csv=require(_0x6d2b('0x5'));var ejs=require(_0x6d2b('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6d2b('0x7'));var squel=require(_0x6d2b('0x8'));var crypto=require(_0x6d2b('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x6d2b('0xa'));var toCsv=require(_0x6d2b('0x5'));var querystring=require(_0x6d2b('0xb'));var Papa=require(_0x6d2b('0xc'));var Redis=require('ioredis');var authService=require(_0x6d2b('0xd'));var qs=require(_0x6d2b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6d2b('0xf'));var logger=require(_0x6d2b('0x10'))(_0x6d2b('0x11'));var utils=require(_0x6d2b('0x12'));var config=require(_0x6d2b('0x13'));var licenseUtil=require(_0x6d2b('0x14'));var db=require(_0x6d2b('0x15'))['db'];function respondWithStatusCode(_0x250618,_0x5c7449){_0x5c7449=_0x5c7449||0xcc;return function(_0x2c5551){if(_0x2c5551){return _0x250618[_0x6d2b('0x16')](_0x5c7449);}return _0x250618[_0x6d2b('0x17')](_0x5c7449)[_0x6d2b('0x18')]();};}function respondWithResult(_0x347b1b,_0x40df14){_0x40df14=_0x40df14||0xc8;return function(_0x34bd8e){if(_0x34bd8e){return _0x347b1b['status'](_0x40df14)['json'](_0x34bd8e);}};}function respondWithFilteredResult(_0x49e1e8,_0x403095){return function(_0x5e8dcd){if(_0x5e8dcd){var _0x207c4d=typeof _0x403095['offset']===_0x6d2b('0x19')&&typeof _0x403095['limit']===_0x6d2b('0x19');var _0x79c360=_0x5e8dcd[_0x6d2b('0x1a')];var _0xe535e6=_0x207c4d?0x0:_0x403095[_0x6d2b('0x1b')];var _0x205879=_0x207c4d?_0x5e8dcd['count']:_0x403095[_0x6d2b('0x1b')]+_0x403095['limit'];var _0x355027;if(_0x205879>=_0x79c360){_0x205879=_0x79c360;_0x355027=0xc8;}else{_0x355027=0xce;}_0x49e1e8[_0x6d2b('0x17')](_0x355027);return _0x49e1e8[_0x6d2b('0x1c')](_0x6d2b('0x1d'),_0xe535e6+'-'+_0x205879+'/'+_0x79c360)[_0x6d2b('0x1e')](_0x5e8dcd);}return null;};}function patchUpdates(_0x32dac5){return function(_0xe2c71e){try{jsonpatch[_0x6d2b('0x1f')](_0xe2c71e,_0x32dac5,!![]);}catch(_0x3b93b7){return BPromise[_0x6d2b('0x20')](_0x3b93b7);}return _0xe2c71e[_0x6d2b('0x21')]();};}function saveUpdates(_0x226364,_0xb06714){return function(_0x41872b){if(_0x41872b){return _0x41872b['update'](_0x226364)[_0x6d2b('0x22')](function(_0x1faac1){return _0x1faac1;});}return null;};}function removeEntity(_0x95b3f,_0x593370){return function(_0x2bd584){if(_0x2bd584){return _0x2bd584[_0x6d2b('0x23')]()[_0x6d2b('0x22')](function(){var _0x26a1bf=_0x2bd584[_0x6d2b('0x24')]({'plain':!![]});var _0x92f4ff=_0x6d2b('0x25');return db[_0x6d2b('0x26')][_0x6d2b('0x23')]({'where':{'type':_0x92f4ff,'resourceId':_0x26a1bf['id']}})[_0x6d2b('0x22')](function(){return _0x2bd584;});})[_0x6d2b('0x22')](function(){_0x95b3f[_0x6d2b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x475dd3,_0x2c0ffb){return function(_0x14ba53){if(!_0x14ba53){_0x475dd3[_0x6d2b('0x16')](0x194);}return _0x14ba53;};}function handleError(_0x71a54b,_0x59bf28){_0x59bf28=_0x59bf28||0x1f4;return function(_0x34a73e){logger[_0x6d2b('0x27')](_0x34a73e[_0x6d2b('0x28')]);if(_0x34a73e['name']){delete _0x34a73e['name'];}_0x71a54b[_0x6d2b('0x17')](_0x59bf28)['send'](_0x34a73e);};}exports[_0x6d2b('0x29')]=function(_0x3ab668,_0x6779d8){var _0x10ded3={},_0x48258e={},_0x287d76={'count':0x0,'rows':[]};var _0x228444=_[_0x6d2b('0x2a')](db['Schedule'][_0x6d2b('0x2b')],function(_0xea4dda){return{'name':_0xea4dda['fieldName'],'type':_0xea4dda[_0x6d2b('0x2c')]['key']};});_0x48258e[_0x6d2b('0x2d')]=_[_0x6d2b('0x2a')](_0x228444,_0x6d2b('0x2e'));_0x48258e[_0x6d2b('0x2f')]=_[_0x6d2b('0x30')](_0x3ab668[_0x6d2b('0x2f')]);_0x48258e[_0x6d2b('0x31')]=_[_0x6d2b('0x32')](_0x48258e[_0x6d2b('0x2d')],_0x48258e[_0x6d2b('0x2f')]);_0x10ded3['attributes']=_[_0x6d2b('0x32')](_0x48258e[_0x6d2b('0x2d')],qs[_0x6d2b('0x33')](_0x3ab668[_0x6d2b('0x2f')][_0x6d2b('0x33')]));_0x10ded3['attributes']=_0x10ded3['attributes'][_0x6d2b('0x34')]?_0x10ded3[_0x6d2b('0x35')]:_0x48258e[_0x6d2b('0x2d')];if(!_0x3ab668[_0x6d2b('0x2f')][_0x6d2b('0x36')](_0x6d2b('0x37'))){_0x10ded3[_0x6d2b('0x38')]=qs[_0x6d2b('0x38')](_0x3ab668[_0x6d2b('0x2f')][_0x6d2b('0x38')]);_0x10ded3[_0x6d2b('0x1b')]=qs[_0x6d2b('0x1b')](_0x3ab668[_0x6d2b('0x2f')][_0x6d2b('0x1b')]);}_0x10ded3[_0x6d2b('0x39')]=qs[_0x6d2b('0x3a')](_0x3ab668[_0x6d2b('0x2f')][_0x6d2b('0x3a')]);_0x10ded3[_0x6d2b('0x3b')]=qs[_0x6d2b('0x31')](_['pick'](_0x3ab668[_0x6d2b('0x2f')],_0x48258e[_0x6d2b('0x31')]),_0x228444);if(_0x3ab668['query'][_0x6d2b('0x3c')]){_0x10ded3[_0x6d2b('0x3b')]=_[_0x6d2b('0x3d')](_0x10ded3[_0x6d2b('0x3b')],{'$or':_[_0x6d2b('0x2a')](_0x228444,function(_0x171104){if(_0x171104['type']!=='VIRTUAL'){var _0x1086c6={};_0x1086c6[_0x171104[_0x6d2b('0x2e')]]={'$like':'%'+_0x3ab668[_0x6d2b('0x2f')][_0x6d2b('0x3c')]+'%'};return _0x1086c6;}})});}_0x10ded3=_[_0x6d2b('0x3d')]({},_0x10ded3,_0x3ab668[_0x6d2b('0x3e')]);var _0x52898={'where':_0x10ded3['where']};return db[_0x6d2b('0x3f')]['count'](_0x52898)[_0x6d2b('0x22')](function(_0x5d4ab6){_0x287d76[_0x6d2b('0x1a')]=_0x5d4ab6;if(_0x3ab668[_0x6d2b('0x2f')][_0x6d2b('0x40')]){_0x10ded3['include']=[{'all':!![]}];}return db[_0x6d2b('0x3f')][_0x6d2b('0x41')](_0x10ded3);})['then'](function(_0x2ee311){_0x287d76[_0x6d2b('0x42')]=_0x2ee311;return _0x287d76;})[_0x6d2b('0x22')](respondWithFilteredResult(_0x6779d8,_0x10ded3))[_0x6d2b('0x43')](handleError(_0x6779d8,null));};exports[_0x6d2b('0x44')]=function(_0x5a6717,_0xc81dac){var _0x2237b1={'raw':![],'where':{'id':_0x5a6717['params']['id']}},_0x754ca5={};_0x754ca5[_0x6d2b('0x2d')]=_['keys'](db[_0x6d2b('0x3f')][_0x6d2b('0x2b')]);_0x754ca5[_0x6d2b('0x2f')]=_[_0x6d2b('0x30')](_0x5a6717['query']);_0x754ca5[_0x6d2b('0x31')]=_['intersection'](_0x754ca5[_0x6d2b('0x2d')],_0x754ca5[_0x6d2b('0x2f')]);_0x2237b1[_0x6d2b('0x35')]=_['intersection'](_0x754ca5[_0x6d2b('0x2d')],qs[_0x6d2b('0x33')](_0x5a6717[_0x6d2b('0x2f')]['fields']));_0x2237b1['attributes']=_0x2237b1[_0x6d2b('0x35')][_0x6d2b('0x34')]?_0x2237b1[_0x6d2b('0x35')]:_0x754ca5[_0x6d2b('0x2d')];if(_0x5a6717[_0x6d2b('0x2f')][_0x6d2b('0x40')]){_0x2237b1[_0x6d2b('0x45')]=[{'all':!![]}];}_0x2237b1=_[_0x6d2b('0x3d')]({},_0x2237b1,_0x5a6717[_0x6d2b('0x3e')]);return db[_0x6d2b('0x3f')][_0x6d2b('0x46')](_0x2237b1)['then'](handleEntityNotFound(_0xc81dac,null))[_0x6d2b('0x22')](respondWithResult(_0xc81dac,null))[_0x6d2b('0x43')](handleError(_0xc81dac,null));};exports[_0x6d2b('0x47')]=function(_0x33b0f4,_0x913210){return db[_0x6d2b('0x3f')][_0x6d2b('0x47')](_0x33b0f4[_0x6d2b('0x48')],{})[_0x6d2b('0x22')](function(_0xaa4167){var _0x3f0530=_0x33b0f4[_0x6d2b('0x49')]['get']({'plain':!![]});if(!_0x3f0530)throw new Error(_0x6d2b('0x4a'));if(_0x3f0530['role']===_0x6d2b('0x49')){var _0x47ccb7=_0xaa4167[_0x6d2b('0x24')]({'plain':!![]});var _0x48a02e=_0x6d2b('0x25');return db[_0x6d2b('0x4b')][_0x6d2b('0x46')]({'where':{'name':_0x48a02e,'userProfileId':_0x3f0530['userProfileId']},'raw':!![]})[_0x6d2b('0x22')](function(_0x2abac7){if(_0x2abac7&&_0x2abac7[_0x6d2b('0x4c')]===0x0){return db['UserProfileResource'][_0x6d2b('0x47')]({'name':_0x47ccb7[_0x6d2b('0x2e')],'resourceId':_0x47ccb7['id'],'type':_0x2abac7[_0x6d2b('0x2e')],'sectionId':_0x2abac7['id']},{})[_0x6d2b('0x22')](function(){return _0xaa4167;});}else{return _0xaa4167;}})['catch'](function(_0x4263ba){logger['error'](_0x6d2b('0x4d'),_0x4263ba);throw _0x4263ba;});}return _0xaa4167;})['then'](respondWithResult(_0x913210,0xc9))[_0x6d2b('0x43')](handleError(_0x913210,null));};exports[_0x6d2b('0x4e')]=function(_0x1001dd,_0x2ae143){if(_0x1001dd[_0x6d2b('0x48')]['id']){delete _0x1001dd[_0x6d2b('0x48')]['id'];}return db[_0x6d2b('0x3f')]['find']({'where':{'id':_0x1001dd[_0x6d2b('0x4f')]['id']}})[_0x6d2b('0x22')](handleEntityNotFound(_0x2ae143,null))[_0x6d2b('0x22')](saveUpdates(_0x1001dd[_0x6d2b('0x48')],null))['then'](respondWithResult(_0x2ae143,null))[_0x6d2b('0x43')](handleError(_0x2ae143,null));};exports[_0x6d2b('0x23')]=function(_0x198a69,_0x4b2cc3){return db[_0x6d2b('0x3f')][_0x6d2b('0x46')]({'where':{'id':_0x198a69[_0x6d2b('0x4f')]['id']}})[_0x6d2b('0x22')](handleEntityNotFound(_0x4b2cc3,null))[_0x6d2b('0x22')](removeEntity(_0x4b2cc3,null))[_0x6d2b('0x43')](handleError(_0x4b2cc3,null));};exports[_0x6d2b('0x50')]=function(_0x51fd0e,_0xb77f9c,_0x2cc10e){var _0x5a1c4c=require(_0x6d2b('0x51'));return db['Schedule'][_0x6d2b('0x46')]({'where':{'id':_0x51fd0e[_0x6d2b('0x4f')]['id']},'raw':!![]})[_0x6d2b('0x22')](handleEntityNotFound(_0xb77f9c,null))['then'](function(){_0x5a1c4c[_0x6d2b('0x50')](_0x51fd0e[_0x6d2b('0x4f')]['id']);})[_0x6d2b('0x22')](respondWithStatusCode(_0xb77f9c,null))[_0x6d2b('0x43')](handleError(_0xb77f9c,null));}; \ No newline at end of file +var _0xb688=['intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','Schedule','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','run','../../config/schedule','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','set','apply','reject','save','then','destroy','get','Scheduler','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb688,0x1e2));var _0x8b68=function(_0x329dcb,_0x2f243b){_0x329dcb=_0x329dcb-0x0;var _0x29f90e=_0xb688[_0x329dcb];return _0x29f90e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8b68('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8b68('0x1'));var moment=require(_0x8b68('0x2'));var BPromise=require(_0x8b68('0x3'));var Mustache=require(_0x8b68('0x4'));var util=require(_0x8b68('0x5'));var path=require(_0x8b68('0x6'));var sox=require(_0x8b68('0x7'));var csv=require(_0x8b68('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b68('0x9'));var _=require(_0x8b68('0xa'));var squel=require(_0x8b68('0xb'));var crypto=require(_0x8b68('0xc'));var jsforce=require(_0x8b68('0xd'));var deskjs=require(_0x8b68('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8b68('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8b68('0x10'));var qs=require(_0x8b68('0x11'));var as=require(_0x8b68('0x12'));var hardwareService=require(_0x8b68('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x8b68('0x14'));var config=require(_0x8b68('0x15'));var licenseUtil=require(_0x8b68('0x16'));var db=require(_0x8b68('0x17'))['db'];function respondWithStatusCode(_0x209d12,_0x41703b){_0x41703b=_0x41703b||0xcc;return function(_0x1ea2ac){if(_0x1ea2ac){return _0x209d12[_0x8b68('0x18')](_0x41703b);}return _0x209d12['status'](_0x41703b)[_0x8b68('0x19')]();};}function respondWithResult(_0x2bb5c0,_0x3551d3){_0x3551d3=_0x3551d3||0xc8;return function(_0x319729){if(_0x319729){return _0x2bb5c0['status'](_0x3551d3)[_0x8b68('0x1a')](_0x319729);}};}function respondWithFilteredResult(_0x29e265,_0x5a1804){return function(_0x8b5d0d){if(_0x8b5d0d){var _0x380237=typeof _0x5a1804['offset']===_0x8b68('0x1b')&&typeof _0x5a1804[_0x8b68('0x1c')]===_0x8b68('0x1b');var _0x583b19=_0x8b5d0d[_0x8b68('0x1d')];var _0x55e72f=_0x380237?0x0:_0x5a1804['offset'];var _0x22d1ca=_0x380237?_0x8b5d0d[_0x8b68('0x1d')]:_0x5a1804[_0x8b68('0x1e')]+_0x5a1804[_0x8b68('0x1c')];var _0x5bab3c;if(_0x22d1ca>=_0x583b19){_0x22d1ca=_0x583b19;_0x5bab3c=0xc8;}else{_0x5bab3c=0xce;}_0x29e265[_0x8b68('0x1f')](_0x5bab3c);return _0x29e265[_0x8b68('0x20')]('Content-Range',_0x55e72f+'-'+_0x22d1ca+'/'+_0x583b19)[_0x8b68('0x1a')](_0x8b5d0d);}return null;};}function patchUpdates(_0x4fa503){return function(_0x43ba5a){try{jsonpatch[_0x8b68('0x21')](_0x43ba5a,_0x4fa503,!![]);}catch(_0x43a316){return BPromise[_0x8b68('0x22')](_0x43a316);}return _0x43ba5a[_0x8b68('0x23')]();};}function saveUpdates(_0x384549,_0x17593f){return function(_0x588160){if(_0x588160){return _0x588160['update'](_0x384549)[_0x8b68('0x24')](function(_0x27188d){return _0x27188d;});}return null;};}function removeEntity(_0x314b4e,_0x6dd26b){return function(_0x46811d){if(_0x46811d){return _0x46811d[_0x8b68('0x25')]()[_0x8b68('0x24')](function(){var _0xaa50ce=_0x46811d[_0x8b68('0x26')]({'plain':!![]});var _0x2cd78a=_0x8b68('0x27');return db['UserProfileResource'][_0x8b68('0x25')]({'where':{'type':_0x2cd78a,'resourceId':_0xaa50ce['id']}})[_0x8b68('0x24')](function(){return _0x46811d;});})[_0x8b68('0x24')](function(){_0x314b4e[_0x8b68('0x1f')](0xcc)[_0x8b68('0x19')]();});}};}function handleEntityNotFound(_0x263775,_0x35e821){return function(_0x85c952){if(!_0x85c952){_0x263775[_0x8b68('0x18')](0x194);}return _0x85c952;};}function handleError(_0x1140da,_0x551488){_0x551488=_0x551488||0x1f4;return function(_0x57c8f2){logger[_0x8b68('0x28')](_0x57c8f2[_0x8b68('0x29')]);if(_0x57c8f2[_0x8b68('0x2a')]){delete _0x57c8f2[_0x8b68('0x2a')];}_0x1140da['status'](_0x551488)[_0x8b68('0x2b')](_0x57c8f2);};}exports[_0x8b68('0x2c')]=function(_0x2b8b47,_0x12cc2c){var _0x597d65={},_0x4c0ef3={},_0x423c02={'count':0x0,'rows':[]};var _0x22b167=_['map'](db['Schedule'][_0x8b68('0x2d')],function(_0x517cac){return{'name':_0x517cac[_0x8b68('0x2e')],'type':_0x517cac[_0x8b68('0x2f')][_0x8b68('0x30')]};});_0x4c0ef3['model']=_[_0x8b68('0x31')](_0x22b167,_0x8b68('0x2a'));_0x4c0ef3[_0x8b68('0x32')]=_[_0x8b68('0x33')](_0x2b8b47[_0x8b68('0x32')]);_0x4c0ef3['filters']=_[_0x8b68('0x34')](_0x4c0ef3[_0x8b68('0x35')],_0x4c0ef3[_0x8b68('0x32')]);_0x597d65['attributes']=_[_0x8b68('0x34')](_0x4c0ef3[_0x8b68('0x35')],qs[_0x8b68('0x36')](_0x2b8b47[_0x8b68('0x32')][_0x8b68('0x36')]));_0x597d65[_0x8b68('0x37')]=_0x597d65['attributes'][_0x8b68('0x38')]?_0x597d65[_0x8b68('0x37')]:_0x4c0ef3[_0x8b68('0x35')];if(!_0x2b8b47[_0x8b68('0x32')][_0x8b68('0x39')](_0x8b68('0x3a'))){_0x597d65[_0x8b68('0x1c')]=qs[_0x8b68('0x1c')](_0x2b8b47[_0x8b68('0x32')]['limit']);_0x597d65[_0x8b68('0x1e')]=qs[_0x8b68('0x1e')](_0x2b8b47[_0x8b68('0x32')][_0x8b68('0x1e')]);}_0x597d65[_0x8b68('0x3b')]=qs[_0x8b68('0x3c')](_0x2b8b47['query'][_0x8b68('0x3c')]);_0x597d65[_0x8b68('0x3d')]=qs['filters'](_[_0x8b68('0x3e')](_0x2b8b47[_0x8b68('0x32')],_0x4c0ef3[_0x8b68('0x3f')]),_0x22b167);if(_0x2b8b47[_0x8b68('0x32')][_0x8b68('0x40')]){_0x597d65['where']=_['merge'](_0x597d65['where'],{'$or':_['map'](_0x22b167,function(_0x1f0c67){if(_0x1f0c67[_0x8b68('0x2f')]!==_0x8b68('0x41')){var _0x4f93c4={};_0x4f93c4[_0x1f0c67[_0x8b68('0x2a')]]={'$like':'%'+_0x2b8b47[_0x8b68('0x32')][_0x8b68('0x40')]+'%'};return _0x4f93c4;}})});}_0x597d65=_[_0x8b68('0x42')]({},_0x597d65,_0x2b8b47[_0x8b68('0x43')]);var _0x257881={'where':_0x597d65['where']};return db[_0x8b68('0x44')][_0x8b68('0x1d')](_0x257881)['then'](function(_0x5d3929){_0x423c02[_0x8b68('0x1d')]=_0x5d3929;if(_0x2b8b47[_0x8b68('0x32')][_0x8b68('0x45')]){_0x597d65[_0x8b68('0x46')]=[{'all':!![]}];}return db[_0x8b68('0x44')][_0x8b68('0x47')](_0x597d65);})[_0x8b68('0x24')](function(_0x4798e3){_0x423c02[_0x8b68('0x48')]=_0x4798e3;return _0x423c02;})[_0x8b68('0x24')](respondWithFilteredResult(_0x12cc2c,_0x597d65))[_0x8b68('0x49')](handleError(_0x12cc2c,null));};exports['show']=function(_0x323e8a,_0x43b051){var _0x15a866={'raw':![],'where':{'id':_0x323e8a[_0x8b68('0x4a')]['id']}},_0x383ebf={};_0x383ebf[_0x8b68('0x35')]=_[_0x8b68('0x33')](db[_0x8b68('0x44')][_0x8b68('0x2d')]);_0x383ebf[_0x8b68('0x32')]=_[_0x8b68('0x33')](_0x323e8a[_0x8b68('0x32')]);_0x383ebf[_0x8b68('0x3f')]=_[_0x8b68('0x34')](_0x383ebf[_0x8b68('0x35')],_0x383ebf[_0x8b68('0x32')]);_0x15a866[_0x8b68('0x37')]=_[_0x8b68('0x34')](_0x383ebf['model'],qs['fields'](_0x323e8a['query'][_0x8b68('0x36')]));_0x15a866[_0x8b68('0x37')]=_0x15a866[_0x8b68('0x37')]['length']?_0x15a866['attributes']:_0x383ebf[_0x8b68('0x35')];if(_0x323e8a[_0x8b68('0x32')][_0x8b68('0x45')]){_0x15a866[_0x8b68('0x46')]=[{'all':!![]}];}_0x15a866=_[_0x8b68('0x42')]({},_0x15a866,_0x323e8a[_0x8b68('0x43')]);return db['Schedule'][_0x8b68('0x4b')](_0x15a866)['then'](handleEntityNotFound(_0x43b051,null))[_0x8b68('0x24')](respondWithResult(_0x43b051,null))['catch'](handleError(_0x43b051,null));};exports[_0x8b68('0x4c')]=function(_0x4456a2,_0x5b53ed){return db['Schedule'][_0x8b68('0x4c')](_0x4456a2[_0x8b68('0x4d')],{})[_0x8b68('0x24')](function(_0x12b182){var _0x4110c8=_0x4456a2[_0x8b68('0x4e')][_0x8b68('0x26')]({'plain':!![]});if(!_0x4110c8)throw new Error(_0x8b68('0x4f'));if(_0x4110c8[_0x8b68('0x50')]===_0x8b68('0x4e')){var _0xd4821=_0x12b182[_0x8b68('0x26')]({'plain':!![]});var _0x52dcd6='Scheduler';return db[_0x8b68('0x51')][_0x8b68('0x4b')]({'where':{'name':_0x52dcd6,'userProfileId':_0x4110c8[_0x8b68('0x52')]},'raw':!![]})[_0x8b68('0x24')](function(_0x51bd78){if(_0x51bd78&&_0x51bd78[_0x8b68('0x53')]===0x0){return db[_0x8b68('0x54')][_0x8b68('0x4c')]({'name':_0xd4821[_0x8b68('0x2a')],'resourceId':_0xd4821['id'],'type':_0x51bd78[_0x8b68('0x2a')],'sectionId':_0x51bd78['id']},{})['then'](function(){return _0x12b182;});}else{return _0x12b182;}})[_0x8b68('0x49')](function(_0x4be254){logger[_0x8b68('0x28')](_0x8b68('0x55'),_0x4be254);throw _0x4be254;});}return _0x12b182;})[_0x8b68('0x24')](respondWithResult(_0x5b53ed,0xc9))[_0x8b68('0x49')](handleError(_0x5b53ed,null));};exports[_0x8b68('0x56')]=function(_0x70db9c,_0x3ee58e){if(_0x70db9c[_0x8b68('0x4d')]['id']){delete _0x70db9c['body']['id'];}return db[_0x8b68('0x44')][_0x8b68('0x4b')]({'where':{'id':_0x70db9c[_0x8b68('0x4a')]['id']}})[_0x8b68('0x24')](handleEntityNotFound(_0x3ee58e,null))[_0x8b68('0x24')](saveUpdates(_0x70db9c[_0x8b68('0x4d')],null))[_0x8b68('0x24')](respondWithResult(_0x3ee58e,null))['catch'](handleError(_0x3ee58e,null));};exports[_0x8b68('0x25')]=function(_0x43be92,_0x498c25){return db['Schedule'][_0x8b68('0x4b')]({'where':{'id':_0x43be92[_0x8b68('0x4a')]['id']}})[_0x8b68('0x24')](handleEntityNotFound(_0x498c25,null))[_0x8b68('0x24')](removeEntity(_0x498c25,null))[_0x8b68('0x49')](handleError(_0x498c25,null));};exports[_0x8b68('0x57')]=function(_0x2d8537,_0xbf546a,_0x180394){var _0x258a6c=require(_0x8b68('0x58'));return db['Schedule'][_0x8b68('0x4b')]({'where':{'id':_0x2d8537[_0x8b68('0x4a')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0xbf546a,null))['then'](function(){_0x258a6c[_0x8b68('0x57')](_0x2d8537[_0x8b68('0x4a')]['id']);})['then'](respondWithStatusCode(_0xbf546a,null))[_0x8b68('0x49')](handleError(_0xbf546a,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index aa6d189..438beac 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 _0xdf2c=['rimraf','../../config/environment','./schedule.attributes','exports','define','tools_schedules','lodash','../../config/logger','api','bluebird','path'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xdf2c,0x15b));var _0xcdf2=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xdf2c[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xcdf2('0x0'));var util=require('util');var logger=require(_0xcdf2('0x1'))(_0xcdf2('0x2'));var moment=require('moment');var BPromise=require(_0xcdf2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcdf2('0x4'));var rimraf=require(_0xcdf2('0x5'));var config=require(_0xcdf2('0x6'));var attributes=require(_0xcdf2('0x7'));module[_0xcdf2('0x8')]=function(_0x3b3b63,_0x30cf14){return _0x3b3b63[_0xcdf2('0x9')]('Schedule',attributes,{'tableName':_0xcdf2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x281b=['rimraf','./schedule.attributes','exports','define','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4ce187,_0x4467e5){var _0x2796c1=function(_0x48cb5f){while(--_0x48cb5f){_0x4ce187['push'](_0x4ce187['shift']());}};_0x2796c1(++_0x4467e5);}(_0x281b,0x94));var _0xb281=function(_0x54c583,_0xf8c8cb){_0x54c583=_0x54c583-0x0;var _0x14d514=_0x281b[_0x54c583];return _0x14d514;};'use strict';var _=require(_0xb281('0x0'));var util=require(_0xb281('0x1'));var logger=require(_0xb281('0x2'))(_0xb281('0x3'));var moment=require(_0xb281('0x4'));var BPromise=require(_0xb281('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb281('0x6'));var config=require('../../config/environment');var attributes=require(_0xb281('0x7'));module[_0xb281('0x8')]=function(_0x594386,_0x15edf3){return _0x594386[_0xb281('0x9')]('Schedule',attributes,{'tableName':_0xb281('0xa'),'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 bc19be9..be2a82d 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 _0x3961=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','request\x20sent','error','code','message','Schedule,\x20%s,\x20%s','result','util','moment','bluebird'];(function(_0x4be8ba,_0x5d10ba){var _0x1af822=function(_0x40ed8a){while(--_0x40ed8a){_0x4be8ba['push'](_0x4be8ba['shift']());}};_0x1af822(++_0x5d10ba);}(_0x3961,0x15d));var _0x1396=function(_0x4eb7e6,_0x451464){_0x4eb7e6=_0x4eb7e6-0x0;var _0x3cf508=_0x3961[_0x4eb7e6];return _0x3cf508;};'use strict';var _=require('lodash');var util=require(_0x1396('0x0'));var moment=require(_0x1396('0x1'));var BPromise=require(_0x1396('0x2'));var rs=require(_0x1396('0x3'));var fs=require('fs');var Redis=require(_0x1396('0x4'));var db=require(_0x1396('0x5'))['db'];var utils=require(_0x1396('0x6'));var logger=require(_0x1396('0x7'))(_0x1396('0x8'));var config=require('../../config/environment');var jayson=require(_0x1396('0x9'));var client=jayson[_0x1396('0xa')][_0x1396('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24961b,_0x503176,_0x4b2bb1){return new BPromise(function(_0x14798c,_0x37d7e6){return client[_0x1396('0xc')](_0x24961b,_0x4b2bb1)[_0x1396('0xd')](function(_0x319b6a){logger[_0x1396('0xe')]('Schedule,\x20%s,\x20%s',_0x503176,'request\x20sent');logger[_0x1396('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x503176,_0x1396('0x10'),JSON['stringify'](_0x319b6a));if(_0x319b6a['error']){if(_0x319b6a[_0x1396('0x11')][_0x1396('0x12')]===0x1f4){logger[_0x1396('0x11')]('Schedule,\x20%s,\x20%s',_0x503176,_0x319b6a[_0x1396('0x11')][_0x1396('0x13')]);return _0x37d7e6(_0x319b6a[_0x1396('0x11')][_0x1396('0x13')]);}logger[_0x1396('0x11')](_0x1396('0x14'),_0x503176,_0x319b6a[_0x1396('0x11')][_0x1396('0x13')]);return _0x14798c(_0x319b6a[_0x1396('0x11')][_0x1396('0x13')]);}else{logger[_0x1396('0xe')]('Schedule,\x20%s,\x20%s',_0x503176,_0x1396('0x10'));_0x14798c(_0x319b6a[_0x1396('0x15')][_0x1396('0x13')]);}})['catch'](function(_0x4a8290){logger[_0x1396('0x11')]('Schedule,\x20%s,\x20%s',_0x503176,_0x4a8290);_0x37d7e6(_0x4a8290);});});} \ No newline at end of file +var _0x2c8a=['message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','error'];(function(_0x6f68bb,_0xbf80b2){var _0xc680c2=function(_0x1dca8a){while(--_0x1dca8a){_0x6f68bb['push'](_0x6f68bb['shift']());}};_0xc680c2(++_0xbf80b2);}(_0x2c8a,0x191));var _0xa2c8=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x2c8a[_0x1969a7];return _0x3d665f;};'use strict';var _=require('lodash');var util=require(_0xa2c8('0x0'));var moment=require(_0xa2c8('0x1'));var BPromise=require(_0xa2c8('0x2'));var rs=require(_0xa2c8('0x3'));var fs=require('fs');var Redis=require(_0xa2c8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa2c8('0x5'));var logger=require(_0xa2c8('0x6'))(_0xa2c8('0x7'));var config=require(_0xa2c8('0x8'));var jayson=require(_0xa2c8('0x9'));var client=jayson[_0xa2c8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43aca7,_0x30bb7c,_0x27c87e){return new BPromise(function(_0x12e7fb,_0x4ce17e){return client['request'](_0x43aca7,_0x27c87e)[_0xa2c8('0xb')](function(_0xa95baa){logger[_0xa2c8('0xc')](_0xa2c8('0xd'),_0x30bb7c,_0xa2c8('0xe'));logger['debug'](_0xa2c8('0xf'),_0x30bb7c,'request\x20sent',JSON['stringify'](_0xa95baa));if(_0xa95baa['error']){if(_0xa95baa[_0xa2c8('0x10')]['code']===0x1f4){logger[_0xa2c8('0x10')](_0xa2c8('0xd'),_0x30bb7c,_0xa95baa['error'][_0xa2c8('0x11')]);return _0x4ce17e(_0xa95baa['error'][_0xa2c8('0x11')]);}logger[_0xa2c8('0x10')](_0xa2c8('0xd'),_0x30bb7c,_0xa95baa[_0xa2c8('0x10')]['message']);return _0x12e7fb(_0xa95baa[_0xa2c8('0x10')][_0xa2c8('0x11')]);}else{logger[_0xa2c8('0xc')](_0xa2c8('0xd'),_0x30bb7c,'request\x20sent');_0x12e7fb(_0xa95baa['result'][_0xa2c8('0x11')]);}})[_0xa2c8('0x12')](function(_0x28ce86){logger[_0xa2c8('0x10')](_0xa2c8('0xd'),_0x30bb7c,_0x28ce86);_0x4ce17e(_0x28ce86);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index b35c7ad..62d0e73 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 _0xc9c7=['../../config/environment','./screenRecording.controller','get','isAuthenticated','describe','/:id','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x42b661,_0x5de688){var _0xc9e134=function(_0x5ae345){while(--_0x5ae345){_0x42b661['push'](_0x42b661['shift']());}};_0xc9e134(++_0x5de688);}(_0xc9c7,0x101));var _0x7c9c=function(_0x38f15b,_0x8badc4){_0x38f15b=_0x38f15b-0x0;var _0x579f57=_0xc9c7[_0x38f15b];return _0x579f57;};'use strict';var multer=require(_0x7c9c('0x0'));var util=require(_0x7c9c('0x1'));var path=require(_0x7c9c('0x2'));var timeout=require(_0x7c9c('0x3'));var express=require(_0x7c9c('0x4'));var router=express['Router']();var fs_extra=require(_0x7c9c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7c9c('0x6'));var config=require(_0x7c9c('0x7'));var controller=require(_0x7c9c('0x8'));router[_0x7c9c('0x9')]('/',auth[_0x7c9c('0xa')](),controller['index']);router[_0x7c9c('0x9')]('/describe',auth[_0x7c9c('0xa')](),controller[_0x7c9c('0xb')]);router[_0x7c9c('0x9')](_0x7c9c('0xc'),auth[_0x7c9c('0xa')](),controller['show']);router['get'](_0x7c9c('0xd'),auth['isAuthenticated'](),controller[_0x7c9c('0xe')]);router[_0x7c9c('0xf')]('/',auth[_0x7c9c('0xa')](),controller[_0x7c9c('0x10')]);router[_0x7c9c('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x7c9c('0x12')]);router[_0x7c9c('0x13')](_0x7c9c('0xc'),auth[_0x7c9c('0xa')](),controller[_0x7c9c('0x14')]);module[_0x7c9c('0x15')]=router; \ No newline at end of file +var _0x424b=['/:id/download','download','post','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get','isAuthenticated','/describe','/:id','show'];(function(_0x4c8439,_0x2003e8){var _0x3aeab6=function(_0x49fb03){while(--_0x49fb03){_0x4c8439['push'](_0x4c8439['shift']());}};_0x3aeab6(++_0x2003e8);}(_0x424b,0x70));var _0xb424=function(_0x2b6eae,_0xd45fa9){_0x2b6eae=_0x2b6eae-0x0;var _0x2ed981=_0x424b[_0x2b6eae];return _0x2ed981;};'use strict';var multer=require(_0xb424('0x0'));var util=require(_0xb424('0x1'));var path=require('path');var timeout=require(_0xb424('0x2'));var express=require(_0xb424('0x3'));var router=express[_0xb424('0x4')]();var fs_extra=require(_0xb424('0x5'));var auth=require(_0xb424('0x6'));var interaction=require(_0xb424('0x7'));var config=require('../../config/environment');var controller=require(_0xb424('0x8'));router[_0xb424('0x9')]('/',auth[_0xb424('0xa')](),controller['index']);router['get'](_0xb424('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xb424('0x9')](_0xb424('0xc'),auth[_0xb424('0xa')](),controller[_0xb424('0xd')]);router['get'](_0xb424('0xe'),auth[_0xb424('0xa')](),controller[_0xb424('0xf')]);router[_0xb424('0x10')]('/',auth[_0xb424('0xa')](),controller['create']);router[_0xb424('0x11')](_0xb424('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xb424('0x12')](_0xb424('0xc'),auth[_0xb424('0xa')](),controller[_0xb424('0x13')]);module[_0xb424('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 748969a..874fefe 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 _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(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x57b7,0x160));var _0x757b=function(_0x14e363,_0x7d1071){_0x14e363=_0x14e363-0x0;var _0x2c07a3=_0x57b7[_0x14e363];return _0x2c07a3;};'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 +var _0xb515=['path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','subtract','closedAt','duration','DATE','MM-DD-YYYY\x20HH:mm','toString','format','createdAt','updatedAt','sequelize'];(function(_0x3a675b,_0x4e5df2){var _0x2e7f72=function(_0x30749c){while(--_0x30749c){_0x3a675b['push'](_0x3a675b['shift']());}};_0x2e7f72(++_0x4e5df2);}(_0xb515,0x1b8));var _0x5b51=function(_0x4179e2,_0xf2dbb){_0x4179e2=_0x4179e2-0x0;var _0x24cb50=_0xb515[_0x4179e2];return _0x24cb50;};'use strict';var Sequelize=require(_0x5b51('0x0'));var moment=require('moment');var path=require(_0x5b51('0x1'));var config=require(_0x5b51('0x2'));module[_0x5b51('0x3')]={'format':{'type':Sequelize[_0x5b51('0x4')],'get':function(){return this[_0x5b51('0x5')](_0x5b51('0x6'))?path[_0x5b51('0x7')](this[_0x5b51('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x5b51('0x8')]},'channel':{'type':Sequelize[_0x5b51('0x8')]},'value':{'type':Sequelize[_0x5b51('0x8')],'set':function(_0x293d82){var _0x396b3f=_0x293d82[_0x5b51('0x9')](/\\/g,'/');this[_0x5b51('0xa')](_0x5b51('0x6'),_0x396b3f);}},'rating':{'type':Sequelize[_0x5b51('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x5b51('0xb')],'set':function(_0x1085e6){this[_0x5b51('0xa')]('startedAt',moment()[_0x5b51('0xc')](_0x1085e6,'ms'));this[_0x5b51('0xa')](_0x5b51('0xd'),moment());this[_0x5b51('0xa')](_0x5b51('0xe'),_0x1085e6);}},'startedAt':{'type':Sequelize[_0x5b51('0xf')],'get':function(){return moment(this['getDataValue']('startedAt'))['format'](_0x5b51('0x10'))[_0x5b51('0x11')]();}},'closedAt':{'type':Sequelize[_0x5b51('0xf')],'get':function(){return moment(this[_0x5b51('0x5')]('closedAt'))[_0x5b51('0x12')](_0x5b51('0x10'))[_0x5b51('0x11')]();}},'createdAt':{'type':Sequelize[_0x5b51('0xf')],'get':function(){return moment(this[_0x5b51('0x5')](_0x5b51('0x13')))[_0x5b51('0x12')](_0x5b51('0x10'))[_0x5b51('0x11')]();}},'updatedAt':{'type':Sequelize[_0x5b51('0xf')],'get':function(){return moment(this[_0x5b51('0x5')](_0x5b51('0x14')))['format'](_0x5b51('0x10'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 3e575ae..e31d912 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 _0x4b84=['query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','ScreenRecording','includeAll','include','findAll','rows','show','params','find','catch','create','body','duration','createdAt','closedAt','value','download','uniqueid','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','join','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','send','Not\x20found','isNil','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','request-promise','mustache','util','path','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','rawAttributes','fieldName','type','key','model','differenceBy','map','format'];(function(_0x2a975f,_0x1c5652){var _0x543a3d=function(_0x467f1c){while(--_0x467f1c){_0x2a975f['push'](_0x2a975f['shift']());}};_0x543a3d(++_0x1c5652);}(_0x4b84,0x1cc));var _0x44b8=function(_0x32c012,_0xe3c576){_0x32c012=_0x32c012-0x0;var _0x48562e=_0x4b84[_0x32c012];return _0x48562e;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];function respondWithStatusCode(_0x4301a6,_0x4bcc43){_0x4bcc43=_0x4bcc43||0xcc;return function(_0x194230){if(_0x194230){return _0x4301a6['sendStatus'](_0x4bcc43);}return _0x4301a6[_0x44b8('0x14')](_0x4bcc43)[_0x44b8('0x15')]();};}function respondWithResult(_0x4df670,_0x63e8f6){_0x63e8f6=_0x63e8f6||0xc8;return function(_0x4be54c){if(_0x4be54c){return _0x4df670['status'](_0x63e8f6)[_0x44b8('0x16')](_0x4be54c);}};}function respondWithFilteredResult(_0x2af0ad,_0x1722da){return function(_0x41ab46){if(_0x41ab46){var _0x5e52f2=typeof _0x1722da['offset']==='undefined'&&typeof _0x1722da[_0x44b8('0x17')]==='undefined';var _0x28ef36=_0x41ab46[_0x44b8('0x18')];var _0x55e258=_0x5e52f2?0x0:_0x1722da[_0x44b8('0x19')];var _0xe3de8f=_0x5e52f2?_0x41ab46['count']:_0x1722da[_0x44b8('0x19')]+_0x1722da[_0x44b8('0x17')];var _0x4b600f;if(_0xe3de8f>=_0x28ef36){_0xe3de8f=_0x28ef36;_0x4b600f=0xc8;}else{_0x4b600f=0xce;}_0x2af0ad[_0x44b8('0x14')](_0x4b600f);return _0x2af0ad[_0x44b8('0x1a')](_0x44b8('0x1b'),_0x55e258+'-'+_0xe3de8f+'/'+_0x28ef36)[_0x44b8('0x16')](_0x41ab46);}return null;};}function patchUpdates(_0x102ef9){return function(_0x369c09){try{jsonpatch[_0x44b8('0x1c')](_0x369c09,_0x102ef9,!![]);}catch(_0x9b0536){return BPromise[_0x44b8('0x1d')](_0x9b0536);}return _0x369c09[_0x44b8('0x1e')]();};}function saveUpdates(_0x1d642b,_0x14996c){return function(_0x48327e){if(_0x48327e){return _0x48327e[_0x44b8('0x1f')](_0x1d642b)[_0x44b8('0x20')](function(_0x416b34){return _0x416b34;});}return null;};}function removeEntity(_0x1418db,_0x305a5c){return function(_0x51a34a){if(_0x51a34a){return _0x51a34a[_0x44b8('0x21')]()['then'](function(){_0x1418db[_0x44b8('0x14')](0xcc)[_0x44b8('0x15')]();});}};}function handleEntityNotFound(_0x25a0c1,_0x47689e){return function(_0x230a3d){if(!_0x230a3d){_0x25a0c1['sendStatus'](0x194);}return _0x230a3d;};}function handleError(_0x474f01,_0x502acf){_0x502acf=_0x502acf||0x1f4;return function(_0x41d673){logger[_0x44b8('0x22')](_0x41d673['stack']);if(_0x41d673[_0x44b8('0x23')]){delete _0x41d673[_0x44b8('0x23')];}_0x474f01[_0x44b8('0x14')](_0x502acf)['send'](_0x41d673);};}exports[_0x44b8('0x24')]=function(_0x242342,_0x53d9c7){var _0x2e0174={},_0x4a182d={},_0xfb0028={'count':0x0,'rows':[]};var _0x5a544c=_['map'](db['ScreenRecording'][_0x44b8('0x25')],function(_0x29b18d){return{'name':_0x29b18d[_0x44b8('0x26')],'type':_0x29b18d[_0x44b8('0x27')][_0x44b8('0x28')]};});_0x4a182d[_0x44b8('0x29')]=_[_0x44b8('0x2a')](_[_0x44b8('0x2b')](_0x5a544c,_0x44b8('0x23')),[_0x44b8('0x2c')]);_0x4a182d[_0x44b8('0x2d')]=_[_0x44b8('0x2e')](_0x242342[_0x44b8('0x2d')]);_0x4a182d['filters']=_[_0x44b8('0x2f')](_0x4a182d['model'],_0x4a182d[_0x44b8('0x2d')]);_0x2e0174[_0x44b8('0x30')]=_[_0x44b8('0x2f')](_0x4a182d[_0x44b8('0x29')],qs[_0x44b8('0x31')](_0x242342['query'][_0x44b8('0x31')]));_0x2e0174[_0x44b8('0x30')]=_0x2e0174[_0x44b8('0x30')][_0x44b8('0x32')]?_0x2e0174[_0x44b8('0x30')]:_0x4a182d['model'];if(!_0x242342[_0x44b8('0x2d')][_0x44b8('0x33')](_0x44b8('0x34'))){_0x2e0174[_0x44b8('0x17')]=qs[_0x44b8('0x17')](_0x242342[_0x44b8('0x2d')][_0x44b8('0x17')]);_0x2e0174[_0x44b8('0x19')]=qs[_0x44b8('0x19')](_0x242342[_0x44b8('0x2d')][_0x44b8('0x19')]);}_0x2e0174[_0x44b8('0x35')]=qs[_0x44b8('0x36')](_0x242342[_0x44b8('0x2d')][_0x44b8('0x36')]);_0x2e0174[_0x44b8('0x37')]=qs[_0x44b8('0x38')](_[_0x44b8('0x39')](_0x242342[_0x44b8('0x2d')],_0x4a182d[_0x44b8('0x38')]),_0x5a544c);if(_0x242342[_0x44b8('0x2d')][_0x44b8('0x3a')]){_0x2e0174['where']=_[_0x44b8('0x3b')](_0x2e0174[_0x44b8('0x37')],{'$or':_['map'](_0x5a544c,function(_0x25688b){if(_0x25688b[_0x44b8('0x27')]!==_0x44b8('0x3c')){var _0x332c2b={};_0x332c2b[_0x25688b['name']]={'$like':'%'+_0x242342[_0x44b8('0x2d')][_0x44b8('0x3a')]+'%'};return _0x332c2b;}})});}_0x2e0174=_[_0x44b8('0x3b')]({},_0x2e0174,_0x242342[_0x44b8('0x3d')]);var _0x9cb2a={'where':_0x2e0174[_0x44b8('0x37')]};return db[_0x44b8('0x3e')][_0x44b8('0x18')](_0x9cb2a)[_0x44b8('0x20')](function(_0x3d1be1){_0xfb0028[_0x44b8('0x18')]=_0x3d1be1;if(_0x242342[_0x44b8('0x2d')][_0x44b8('0x3f')]){_0x2e0174[_0x44b8('0x40')]=[{'all':!![]}];}return db[_0x44b8('0x3e')][_0x44b8('0x41')](_0x2e0174);})['then'](function(_0x12a0a4){_0xfb0028[_0x44b8('0x42')]=_0x12a0a4;return _0xfb0028;})[_0x44b8('0x20')](respondWithFilteredResult(_0x53d9c7,_0x2e0174))['catch'](handleError(_0x53d9c7,null));};exports[_0x44b8('0x43')]=function(_0x1054c5,_0x229cc9){var _0x585a16={'raw':![],'where':{'id':_0x1054c5[_0x44b8('0x44')]['id']}},_0xbad4bb={};_0xbad4bb[_0x44b8('0x29')]=_[_0x44b8('0x2e')](db[_0x44b8('0x3e')]['rawAttributes']);_0xbad4bb['query']=_[_0x44b8('0x2e')](_0x1054c5[_0x44b8('0x2d')]);_0xbad4bb[_0x44b8('0x38')]=_[_0x44b8('0x2f')](_0xbad4bb[_0x44b8('0x29')],_0xbad4bb[_0x44b8('0x2d')]);_0x585a16[_0x44b8('0x30')]=_[_0x44b8('0x2f')](_0xbad4bb[_0x44b8('0x29')],qs[_0x44b8('0x31')](_0x1054c5[_0x44b8('0x2d')][_0x44b8('0x31')]));_0x585a16[_0x44b8('0x30')]=_0x585a16[_0x44b8('0x30')][_0x44b8('0x32')]?_0x585a16[_0x44b8('0x30')]:_0xbad4bb[_0x44b8('0x29')];if(_0x1054c5[_0x44b8('0x2d')][_0x44b8('0x3f')]){_0x585a16['include']=[{'all':!![]}];}_0x585a16=_['merge']({},_0x585a16,_0x1054c5[_0x44b8('0x3d')]);return db[_0x44b8('0x3e')][_0x44b8('0x45')](_0x585a16)[_0x44b8('0x20')](handleEntityNotFound(_0x229cc9,null))[_0x44b8('0x20')](respondWithResult(_0x229cc9,null))[_0x44b8('0x46')](handleError(_0x229cc9,null));};exports[_0x44b8('0x47')]=function(_0x4fe73f,_0x156070){return db['ScreenRecording'][_0x44b8('0x47')](_0x4fe73f[_0x44b8('0x48')],{})[_0x44b8('0x20')](respondWithResult(_0x156070,0xc9))[_0x44b8('0x46')](handleError(_0x156070,null));};exports[_0x44b8('0x1f')]=function(_0x35ca19,_0x491600){if(_0x35ca19[_0x44b8('0x48')]['id']){delete _0x35ca19[_0x44b8('0x48')]['id'];}delete _0x35ca19[_0x44b8('0x48')][_0x44b8('0x49')];delete _0x35ca19['body'][_0x44b8('0x4a')];delete _0x35ca19[_0x44b8('0x48')][_0x44b8('0x4b')];delete _0x35ca19[_0x44b8('0x48')][_0x44b8('0x4c')];return db[_0x44b8('0x3e')]['find']({'where':{'id':_0x35ca19[_0x44b8('0x44')]['id']}})[_0x44b8('0x20')](handleEntityNotFound(_0x491600,null))[_0x44b8('0x20')](saveUpdates(_0x35ca19[_0x44b8('0x48')],null))[_0x44b8('0x20')](respondWithResult(_0x491600,null))['catch'](handleError(_0x491600,null));};exports['describe']=function(_0x2516fc,_0x4eb344){return db[_0x44b8('0x3e')]['describe']()[_0x44b8('0x20')](respondWithResult(_0x4eb344,null))[_0x44b8('0x46')](handleError(_0x4eb344,null));};exports[_0x44b8('0x4d')]=function(_0x15f4c6,_0x2fa6b4,_0x32f588){var _0xdc67e8=require('../../components/encryptor');var _0x3ad278=![];var _0x37b2c2={};if(_0x15f4c6[_0x44b8('0x2d')]['type']&&_0x15f4c6[_0x44b8('0x2d')][_0x44b8('0x27')]===_0x44b8('0x4e')){_0x37b2c2[_0x44b8('0x4e')]=_0x15f4c6['params']['id'];}else{_0x37b2c2['id']=_0x15f4c6[_0x44b8('0x44')]['id'];}return db[_0x44b8('0x3e')]['find']({'where':_0x37b2c2,'attributes':['id',_0x44b8('0x4c')],'raw':!![]})[_0x44b8('0x20')](handleEntityNotFound(_0x2fa6b4,null))[_0x44b8('0x20')](function(_0x3df6aa){if(_0x3df6aa){var _0xe86e34=path['join'](config['root'],_0x44b8('0x4f'),_0x3df6aa[_0x44b8('0x4c')]);var _0xa30834=util[_0x44b8('0x2c')](_0x44b8('0x50'),_0xe86e34);if(fs[_0x44b8('0x51')](_0xa30834)){_0x3ad278=!![];return _0xdc67e8[_0x44b8('0x52')](_0xa30834,_0xe86e34,config[_0x44b8('0x53')][_0x44b8('0x54')])[_0x44b8('0x20')](function(){return _0x3df6aa;});}return _0x3df6aa;}})[_0x44b8('0x20')](function(_0x3f7576){if(_0x3f7576){var _0x5af3e6=path[_0x44b8('0x55')](config[_0x44b8('0x56')],_0x44b8('0x4f'),_0x3f7576[_0x44b8('0x4c')]);if(!fs[_0x44b8('0x51')](_0x5af3e6)){throw new db[(_0x44b8('0x57'))][(_0x44b8('0x58'))](_0x44b8('0x59'));}if(_0x3f7576[_0x44b8('0x5a')]){return _0x2fa6b4[_0x44b8('0x4d')](_0x5af3e6,_0x3f7576[_0x44b8('0x5a')]+path[_0x44b8('0x5b')](_0x5af3e6),function(){if(_0x3ad278){fs[_0x44b8('0x5c')](_0x5af3e6);}});}else{return _0x2fa6b4[_0x44b8('0x4d')](_0x5af3e6,function(_0x2250bb){if(_0x3ad278){fs[_0x44b8('0x5c')](_0x5af3e6);}});}}})[_0x44b8('0x46')](function(_0x20e563){if(_0x20e563['message']===_0x44b8('0x59')){_0x2fa6b4[_0x44b8('0x14')](0x194)[_0x44b8('0x5d')](_0x44b8('0x5e'));}else{return handleError(_0x2fa6b4,null);}});};exports[_0x44b8('0x21')]=function(_0x29ed5d,_0x2ecf65){return db['ScreenRecording'][_0x44b8('0x45')]({'where':{'id':_0x29ed5d[_0x44b8('0x44')]['id']}})['then'](function(_0x2a95f6){if(_[_0x44b8('0x5f')](_0x2a95f6)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2a95f6;})[_0x44b8('0x20')](function(_0x454fe6){var _0x370618=path['join'](config[_0x44b8('0x56')],'server/files/screen_recordings',_0x454fe6[_0x44b8('0x4c')]);logger['info'](_0x44b8('0x60'),_0x370618);if(!_[_0x44b8('0x5f')](_0x454fe6[_0x44b8('0x4c')])&&fs[_0x44b8('0x51')](_0x370618)){logger[_0x44b8('0x61')](_0x44b8('0x62')+_0x370618+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x44b8('0x63')](_0x370618);}_0x370618=_0x370618+'.cypher';if(!_[_0x44b8('0x5f')](_0x454fe6[_0x44b8('0x4c')])&&fs['existsSync'](_0x370618)){logger[_0x44b8('0x61')](_0x44b8('0x62')+_0x370618+_0x44b8('0x64'));fs[_0x44b8('0x63')](_0x370618);}return _0x454fe6;})[_0x44b8('0x20')](function(_0x3774fe){if(!_0x3774fe)throw new InternalError();return _0x3774fe[_0x44b8('0x21')]();})[_0x44b8('0x20')](function(){_0x2ecf65[_0x44b8('0x14')](0xcc)[_0x44b8('0x15')]();})[_0x44b8('0x46')](handleError(_0x2ecf65,null));}; \ No newline at end of file +var _0x55ca=['sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','ScreenRecording','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','createdAt','closedAt','value','describe','download','../../components/encryptor','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','moment','bluebird','util','path'];(function(_0x184bc5,_0x494653){var _0x4ac5e4=function(_0x3bfc7d){while(--_0x3bfc7d){_0x184bc5['push'](_0x184bc5['shift']());}};_0x4ac5e4(++_0x494653);}(_0x55ca,0x126));var _0xa55c=function(_0x43762c,_0x48ff0f){_0x43762c=_0x43762c-0x0;var _0x4a85e0=_0x55ca[_0x43762c];return _0x4a85e0;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x2d')](_['map'](_0x201941,_0xa55c('0x25')),[_0xa55c('0x2e')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x906caa[_0xa55c('0x2f')]);_0x22f6b6[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2f')]);_0x1377b0[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x22f6b6['model'],qs['fields'](_0x906caa[_0xa55c('0x2f')][_0xa55c('0x34')]));_0x1377b0['attributes']=_0x1377b0[_0xa55c('0x33')][_0xa55c('0x35')]?_0x1377b0[_0xa55c('0x33')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2f')][_0xa55c('0x36')](_0xa55c('0x37'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa['query']['limit']);_0x1377b0['offset']=qs[_0xa55c('0x1a')](_0x906caa[_0xa55c('0x2f')][_0xa55c('0x1a')]);}_0x1377b0['order']=qs[_0xa55c('0x38')](_0x906caa['query'][_0xa55c('0x38')]);_0x1377b0['where']=qs[_0xa55c('0x31')](_[_0xa55c('0x39')](_0x906caa[_0xa55c('0x2f')],_0x22f6b6['filters']),_0x201941);if(_0x906caa[_0xa55c('0x2f')][_0xa55c('0x3a')]){_0x1377b0['where']=_[_0xa55c('0x3b')](_0x1377b0[_0xa55c('0x3c')],{'$or':_['map'](_0x201941,function(_0x529ff8){if(_0x529ff8[_0xa55c('0x2a')]!=='VIRTUAL'){var _0x1e75dc={};_0x1e75dc[_0x529ff8[_0xa55c('0x25')]]={'$like':'%'+_0x906caa['query']['filter']+'%'};return _0x1e75dc;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x3b3308={'where':_0x1377b0[_0xa55c('0x3c')]};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x3b3308)[_0xa55c('0x20')](function(_0x56d17c){_0x1b8388[_0xa55c('0x1d')]=_0x56d17c;if(_0x906caa[_0xa55c('0x2f')][_0xa55c('0x3d')]){_0x1377b0[_0xa55c('0x3e')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0x1377b0);})['then'](function(_0x386e34){_0x1b8388['rows']=_0x386e34;return _0x1b8388;})['then'](respondWithFilteredResult(_0x5d940d,_0x1377b0))[_0xa55c('0x40')](handleError(_0x5d940d,null));};exports[_0xa55c('0x41')]=function(_0x496920,_0x2bd98b){var _0x508bd3={'raw':![],'where':{'id':_0x496920[_0xa55c('0x42')]['id']}},_0x5f25f7={};_0x5f25f7[_0xa55c('0x2c')]=_[_0xa55c('0x30')](db['ScreenRecording'][_0xa55c('0x43')]);_0x5f25f7[_0xa55c('0x2f')]=_['keys'](_0x496920[_0xa55c('0x2f')]);_0x5f25f7['filters']=_[_0xa55c('0x32')](_0x5f25f7[_0xa55c('0x2c')],_0x5f25f7['query']);_0x508bd3[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x5f25f7['model'],qs[_0xa55c('0x34')](_0x496920[_0xa55c('0x2f')][_0xa55c('0x34')]));_0x508bd3['attributes']=_0x508bd3[_0xa55c('0x33')]['length']?_0x508bd3[_0xa55c('0x33')]:_0x5f25f7[_0xa55c('0x2c')];if(_0x496920[_0xa55c('0x2f')]['includeAll']){_0x508bd3[_0xa55c('0x3e')]=[{'all':!![]}];}_0x508bd3=_[_0xa55c('0x3b')]({},_0x508bd3,_0x496920['options']);return db[_0xa55c('0x29')][_0xa55c('0x44')](_0x508bd3)['then'](handleEntityNotFound(_0x2bd98b,null))[_0xa55c('0x20')](respondWithResult(_0x2bd98b,null))[_0xa55c('0x40')](handleError(_0x2bd98b,null));};exports['create']=function(_0x46f839,_0x81cee8){return db[_0xa55c('0x29')][_0xa55c('0x45')](_0x46f839['body'],{})[_0xa55c('0x20')](respondWithResult(_0x81cee8,0xc9))['catch'](handleError(_0x81cee8,null));};exports[_0xa55c('0x1f')]=function(_0x213100,_0x194a79){if(_0x213100['body']['id']){delete _0x213100[_0xa55c('0x46')]['id'];}delete _0x213100[_0xa55c('0x46')]['duration'];delete _0x213100[_0xa55c('0x46')][_0xa55c('0x47')];delete _0x213100[_0xa55c('0x46')][_0xa55c('0x48')];delete _0x213100[_0xa55c('0x46')][_0xa55c('0x49')];return db[_0xa55c('0x29')][_0xa55c('0x44')]({'where':{'id':_0x213100[_0xa55c('0x42')]['id']}})[_0xa55c('0x20')](handleEntityNotFound(_0x194a79,null))['then'](saveUpdates(_0x213100[_0xa55c('0x46')],null))[_0xa55c('0x20')](respondWithResult(_0x194a79,null))[_0xa55c('0x40')](handleError(_0x194a79,null));};exports['describe']=function(_0x4c3095,_0x35bf0a){return db['ScreenRecording'][_0xa55c('0x4a')]()['then'](respondWithResult(_0x35bf0a,null))[_0xa55c('0x40')](handleError(_0x35bf0a,null));};exports[_0xa55c('0x4b')]=function(_0x181802,_0x3f9313,_0x2ecf79){var _0x5b1cf3=require(_0xa55c('0x4c'));var _0x4607ca=![];var _0x4b85cc={};if(_0x181802[_0xa55c('0x2f')][_0xa55c('0x2a')]&&_0x181802[_0xa55c('0x2f')][_0xa55c('0x2a')]==='uniqueid'){_0x4b85cc['uniqueid']=_0x181802[_0xa55c('0x42')]['id'];}else{_0x4b85cc['id']=_0x181802[_0xa55c('0x42')]['id'];}return db[_0xa55c('0x29')][_0xa55c('0x44')]({'where':_0x4b85cc,'attributes':['id','value'],'raw':!![]})[_0xa55c('0x20')](handleEntityNotFound(_0x3f9313,null))['then'](function(_0x2742e4){if(_0x2742e4){var _0x437ced=path[_0xa55c('0x4d')](config[_0xa55c('0x4e')],_0xa55c('0x4f'),_0x2742e4['value']);var _0x1cb73b=util['format'](_0xa55c('0x50'),_0x437ced);if(fs[_0xa55c('0x51')](_0x1cb73b)){_0x4607ca=!![];return _0x5b1cf3[_0xa55c('0x52')](_0x1cb73b,_0x437ced,config[_0xa55c('0x53')][_0xa55c('0x54')])[_0xa55c('0x20')](function(){return _0x2742e4;});}return _0x2742e4;}})[_0xa55c('0x20')](function(_0x53e2be){if(_0x53e2be){var _0x450567=path[_0xa55c('0x4d')](config[_0xa55c('0x4e')],_0xa55c('0x4f'),_0x53e2be[_0xa55c('0x49')]);if(!fs['existsSync'](_0x450567)){throw new db[(_0xa55c('0x55'))][(_0xa55c('0x56'))](_0xa55c('0x57'));}if(_0x53e2be[_0xa55c('0x58')]){return _0x3f9313[_0xa55c('0x4b')](_0x450567,_0x53e2be['filename']+path[_0xa55c('0x59')](_0x450567),function(){if(_0x4607ca){fs[_0xa55c('0x5a')](_0x450567);}});}else{return _0x3f9313[_0xa55c('0x4b')](_0x450567,function(_0x16d9b2){if(_0x4607ca){fs[_0xa55c('0x5a')](_0x450567);}});}}})['catch'](function(_0x419fc3){if(_0x419fc3['message']===_0xa55c('0x57')){_0x3f9313['status'](0x194)[_0xa55c('0x26')]('Not\x20found');}else{return handleError(_0x3f9313,null);}});};exports[_0xa55c('0x5b')]=function(_0x1333da,_0x21d6b4){return db[_0xa55c('0x29')][_0xa55c('0x44')]({'where':{'id':_0x1333da[_0xa55c('0x42')]['id']}})[_0xa55c('0x20')](function(_0x2f2226){if(_[_0xa55c('0x5c')](_0x2f2226)){throw new ReferenceError(_0xa55c('0x5d'));}return _0x2f2226;})['then'](function(_0x150a07){var _0x311bb9=path['join'](config[_0xa55c('0x4e')],_0xa55c('0x4f'),_0x150a07[_0xa55c('0x49')]);logger[_0xa55c('0x5e')](_0xa55c('0x5f'),_0x311bb9);if(!_[_0xa55c('0x5c')](_0x150a07[_0xa55c('0x49')])&&fs[_0xa55c('0x51')](_0x311bb9)){logger['info'](_0xa55c('0x60')+_0x311bb9+_0xa55c('0x61'));fs[_0xa55c('0x62')](_0x311bb9);}_0x311bb9=_0x311bb9+_0xa55c('0x63');if(!_[_0xa55c('0x5c')](_0x150a07[_0xa55c('0x49')])&&fs[_0xa55c('0x51')](_0x311bb9)){logger[_0xa55c('0x5e')](_0xa55c('0x60')+_0x311bb9+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xa55c('0x62')](_0x311bb9);}return _0x150a07;})[_0xa55c('0x20')](function(_0x40c56a){if(!_0x40c56a)throw new InternalError();return _0x40c56a[_0xa55c('0x5b')]();})[_0xa55c('0x20')](function(){_0x21d6b4[_0xa55c('0x18')](0xcc)[_0xa55c('0x21')]();})[_0xa55c('0x40')](handleError(_0x21d6b4,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 150e815..e8129b6 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 _0xbb0b=['bluebird','request-promise','path','rimraf','./screenRecording.attributes','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb0b,0xb1));var _0xbbb0=function(_0x3fb2b4,_0x274e23){_0x3fb2b4=_0x3fb2b4-0x0;var _0x526434=_0xbb0b[_0x3fb2b4];return _0x526434;};'use strict';var _=require(_0xbbb0('0x0'));var util=require(_0xbbb0('0x1'));var logger=require(_0xbbb0('0x2'))(_0xbbb0('0x3'));var moment=require(_0xbbb0('0x4'));var BPromise=require(_0xbbb0('0x5'));var rp=require(_0xbbb0('0x6'));var fs=require('fs');var path=require(_0xbbb0('0x7'));var rimraf=require(_0xbbb0('0x8'));var config=require('../../config/environment');var attributes=require(_0xbbb0('0x9'));module['exports']=function(_0x7d23ca,_0x5e4cba){return _0x7d23ca[_0xbbb0('0xa')](_0xbbb0('0xb'),attributes,{'tableName':_0xbbb0('0xc'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xbbb0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe83d=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util'];(function(_0x110596,_0x1faae7){var _0x51fef2=function(_0x443662){while(--_0x443662){_0x110596['push'](_0x110596['shift']());}};_0x51fef2(++_0x1faae7);}(_0xe83d,0xfa));var _0xde83=function(_0xca2782,_0x4b4860){_0xca2782=_0xca2782-0x0;var _0x1e30be=_0xe83d[_0xca2782];return _0x1e30be;};'use strict';var _=require(_0xde83('0x0'));var util=require(_0xde83('0x1'));var logger=require(_0xde83('0x2'))(_0xde83('0x3'));var moment=require('moment');var BPromise=require(_0xde83('0x4'));var rp=require(_0xde83('0x5'));var fs=require('fs');var path=require(_0xde83('0x6'));var rimraf=require(_0xde83('0x7'));var config=require(_0xde83('0x8'));var attributes=require('./screenRecording.attributes');module[_0xde83('0x9')]=function(_0x6e7812,_0x316bfb){return _0x6e7812[_0xde83('0xa')](_0xde83('0xb'),attributes,{'tableName':_0xde83('0xc'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xde83('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index aeb3576..baec663 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 _0xcc83=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','ScreenRecording,\x20%s,\x20%s','message','result'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xcc83,0x161));var _0x3cc8=function(_0x2012a5,_0x3465e4){_0x2012a5=_0x2012a5-0x0;var _0x21bdf6=_0xcc83[_0x2012a5];return _0x21bdf6;};'use strict';var _=require(_0x3cc8('0x0'));var util=require(_0x3cc8('0x1'));var moment=require(_0x3cc8('0x2'));var BPromise=require(_0x3cc8('0x3'));var rs=require(_0x3cc8('0x4'));var fs=require('fs');var Redis=require(_0x3cc8('0x5'));var db=require(_0x3cc8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3cc8('0x7'))(_0x3cc8('0x8'));var config=require(_0x3cc8('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dc136,_0x247669,_0x37f0b5){return new BPromise(function(_0x5aed78,_0x59f526){return client[_0x3cc8('0xa')](_0x3dc136,_0x37f0b5)['then'](function(_0x245180){logger[_0x3cc8('0xb')]('ScreenRecording,\x20%s,\x20%s',_0x247669,_0x3cc8('0xc'));logger[_0x3cc8('0xd')](_0x3cc8('0xe'),_0x247669,'request\x20sent',JSON[_0x3cc8('0xf')](_0x245180));if(_0x245180[_0x3cc8('0x10')]){if(_0x245180[_0x3cc8('0x10')][_0x3cc8('0x11')]===0x1f4){logger[_0x3cc8('0x10')](_0x3cc8('0x12'),_0x247669,_0x245180[_0x3cc8('0x10')]['message']);return _0x59f526(_0x245180['error'][_0x3cc8('0x13')]);}logger[_0x3cc8('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x247669,_0x245180[_0x3cc8('0x10')][_0x3cc8('0x13')]);return _0x5aed78(_0x245180[_0x3cc8('0x10')][_0x3cc8('0x13')]);}else{logger['info']('ScreenRecording,\x20%s,\x20%s',_0x247669,_0x3cc8('0xc'));_0x5aed78(_0x245180[_0x3cc8('0x14')]['message']);}})[_0x3cc8('0x15')](function(_0x2873d9){logger[_0x3cc8('0x10')](_0x3cc8('0x12'),_0x247669,_0x2873d9);_0x59f526(_0x2873d9);});});} \ No newline at end of file +var _0x5031=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util'];(function(_0x122354,_0x5bba72){var _0xb68790=function(_0x539fda){while(--_0x539fda){_0x122354['push'](_0x122354['shift']());}};_0xb68790(++_0x5bba72);}(_0x5031,0xaf));var _0x1503=function(_0xac7c29,_0x3374f4){_0xac7c29=_0xac7c29-0x0;var _0x4b5ce8=_0x5031[_0xac7c29];return _0x4b5ce8;};'use strict';var _=require('lodash');var util=require(_0x1503('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1503('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1503('0x2'))['db'];var utils=require(_0x1503('0x3'));var logger=require(_0x1503('0x4'))(_0x1503('0x5'));var config=require(_0x1503('0x6'));var jayson=require(_0x1503('0x7'));var client=jayson[_0x1503('0x8')][_0x1503('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x382adc,_0x328542,_0x30a871){return new BPromise(function(_0xfc39c6,_0x427470){return client[_0x1503('0xa')](_0x382adc,_0x30a871)[_0x1503('0xb')](function(_0x2cf23e){logger[_0x1503('0xc')](_0x1503('0xd'),_0x328542,'request\x20sent');logger[_0x1503('0xe')](_0x1503('0xf'),_0x328542,_0x1503('0x10'),JSON[_0x1503('0x11')](_0x2cf23e));if(_0x2cf23e[_0x1503('0x12')]){if(_0x2cf23e['error'][_0x1503('0x13')]===0x1f4){logger[_0x1503('0x12')](_0x1503('0xd'),_0x328542,_0x2cf23e[_0x1503('0x12')][_0x1503('0x14')]);return _0x427470(_0x2cf23e[_0x1503('0x12')]['message']);}logger[_0x1503('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x328542,_0x2cf23e[_0x1503('0x12')][_0x1503('0x14')]);return _0xfc39c6(_0x2cf23e['error']['message']);}else{logger[_0x1503('0xc')](_0x1503('0xd'),_0x328542,'request\x20sent');_0xfc39c6(_0x2cf23e[_0x1503('0x15')][_0x1503('0x14')]);}})['catch'](function(_0x3c9de1){logger['error'](_0x1503('0xd'),_0x328542,_0x3c9de1);_0x427470(_0x3c9de1);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 15d3edc..874e8ed 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 _0x0963=['diskStorage','join','root','format','%s%s','logo','extname','originalname','post','single','file','server/files/images/logos/','logologin','addLogoLogin','preferred','favicon','addFavicon','update','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','./setting.controller','get','isAuthenticated','index','/now','/:id','/:id/logo','getLogo','/:id/logo_login','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon'];(function(_0x163f1f,_0x24762b){var _0x2e5b9c=function(_0x140dfa){while(--_0x140dfa){_0x163f1f['push'](_0x163f1f['shift']());}};_0x2e5b9c(++_0x24762b);}(_0x0963,0x142));var _0x3096=function(_0x368682,_0x56698f){_0x368682=_0x368682-0x0;var _0x2bc428=_0x0963[_0x368682];return _0x2bc428;};'use strict';var multer=require(_0x3096('0x0'));var util=require(_0x3096('0x1'));var path=require('path');var timeout=require(_0x3096('0x2'));var express=require(_0x3096('0x3'));var router=express['Router']();var fs_extra=require(_0x3096('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3096('0x5'));var config=require('../../config/environment');var controller=require(_0x3096('0x6'));router[_0x3096('0x7')]('/',auth[_0x3096('0x8')](),controller[_0x3096('0x9')]);router[_0x3096('0x7')](_0x3096('0xa'),controller['getDate']);router['get'](_0x3096('0xb'),controller['show']);router[_0x3096('0x7')](_0x3096('0xc'),controller[_0x3096('0xd')]);router[_0x3096('0x7')](_0x3096('0xe'),controller['getLogoLogin']);router['get'](_0x3096('0xf'),controller['gdpr']);router[_0x3096('0x7')](_0x3096('0x10'),controller[_0x3096('0x11')]);router['get'](_0x3096('0x12'),controller[_0x3096('0x13')]);var upload=multer({'storage':multer[_0x3096('0x14')]({'destination':function(_0x6f316d,_0x1d507d,_0x3116be){_0x3116be(null,path[_0x3096('0x15')](config[_0x3096('0x16')],'server/files/images/logos/'));},'filename':function(_0x5e0554,_0x2e77e9,_0x517dec){_0x517dec(null,util[_0x3096('0x17')](_0x3096('0x18'),_0x3096('0x19'),path[_0x3096('0x1a')](_0x2e77e9[_0x3096('0x1b')])));}})});router[_0x3096('0x1c')]('/:id/logo',upload[_0x3096('0x1d')](_0x3096('0x1e')),controller['addLogo']);var upload=multer({'storage':multer[_0x3096('0x14')]({'destination':function(_0x4962c5,_0x54db25,_0x131bb5){_0x131bb5(null,path[_0x3096('0x15')](config[_0x3096('0x16')],_0x3096('0x1f')));},'filename':function(_0x170741,_0x4be5fe,_0x4e550c){_0x4e550c(null,util[_0x3096('0x17')](_0x3096('0x18'),_0x3096('0x20'),path[_0x3096('0x1a')](_0x4be5fe[_0x3096('0x1b')])));}})});router['post'](_0x3096('0xe'),upload[_0x3096('0x1d')](_0x3096('0x1e')),controller[_0x3096('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5a0092,_0x7ea605,_0x182fc4){_0x182fc4(null,path[_0x3096('0x15')](config[_0x3096('0x16')],'server/files/images/logos/'));},'filename':function(_0x2dc8ab,_0x2eb3ad,_0xeb14b8){_0xeb14b8(null,util[_0x3096('0x17')](_0x3096('0x18'),_0x3096('0x22'),path[_0x3096('0x1a')](_0x2eb3ad[_0x3096('0x1b')])));}})});router['post'](_0x3096('0x10'),upload[_0x3096('0x1d')]('file'),controller['addPreferred']);var upload=multer({'storage':multer[_0x3096('0x14')]({'destination':function(_0x3d76c2,_0x4b877c,_0x2f7a86){_0x2f7a86(null,path[_0x3096('0x15')](config[_0x3096('0x16')],'server/files/images/logos/'));},'filename':function(_0x3c2690,_0x2a4a86,_0x1340dd){_0x1340dd(null,util[_0x3096('0x17')]('%s%s',_0x3096('0x23'),path[_0x3096('0x1a')](_0x2a4a86['originalname'])));}})});router[_0x3096('0x1c')](_0x3096('0x12'),upload['single'](_0x3096('0x1e')),controller[_0x3096('0x24')]);router['put'](_0x3096('0xb'),auth[_0x3096('0x8')](),controller[_0x3096('0x25')]);module['exports']=router; \ No newline at end of file +var _0x6694=['format','%s%s','logo','extname','post','single','file','addLogo','logologin','originalname','/:id/logo_login','preferred','put','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/'];(function(_0x4315c6,_0x4b9296){var _0x36b60b=function(_0x302d0d){while(--_0x302d0d){_0x4315c6['push'](_0x4315c6['shift']());}};_0x36b60b(++_0x4b9296);}(_0x6694,0x1f3));var _0x4669=function(_0x403981,_0x5164d8){_0x403981=_0x403981-0x0;var _0x2f8df6=_0x6694[_0x403981];return _0x2f8df6;};'use strict';var multer=require('multer');var util=require(_0x4669('0x0'));var path=require(_0x4669('0x1'));var timeout=require(_0x4669('0x2'));var express=require(_0x4669('0x3'));var router=express[_0x4669('0x4')]();var fs_extra=require(_0x4669('0x5'));var auth=require(_0x4669('0x6'));var interaction=require(_0x4669('0x7'));var config=require(_0x4669('0x8'));var controller=require(_0x4669('0x9'));router[_0x4669('0xa')]('/',auth[_0x4669('0xb')](),controller[_0x4669('0xc')]);router[_0x4669('0xa')](_0x4669('0xd'),controller[_0x4669('0xe')]);router['get'](_0x4669('0xf'),controller[_0x4669('0x10')]);router[_0x4669('0xa')](_0x4669('0x11'),controller[_0x4669('0x12')]);router[_0x4669('0xa')]('/:id/logo_login',controller[_0x4669('0x13')]);router[_0x4669('0xa')](_0x4669('0x14'),controller['gdpr']);router[_0x4669('0xa')](_0x4669('0x15'),controller[_0x4669('0x16')]);router[_0x4669('0xa')](_0x4669('0x17'),controller[_0x4669('0x18')]);var upload=multer({'storage':multer[_0x4669('0x19')]({'destination':function(_0x295958,_0x470e75,_0x3d8a65){_0x3d8a65(null,path[_0x4669('0x1a')](config[_0x4669('0x1b')],_0x4669('0x1c')));},'filename':function(_0x2113d0,_0x2b0d94,_0x39488b){_0x39488b(null,util[_0x4669('0x1d')](_0x4669('0x1e'),_0x4669('0x1f'),path[_0x4669('0x20')](_0x2b0d94['originalname'])));}})});router[_0x4669('0x21')](_0x4669('0x11'),upload[_0x4669('0x22')](_0x4669('0x23')),controller[_0x4669('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2a1f4c,_0x2b124a,_0x409781){_0x409781(null,path['join'](config[_0x4669('0x1b')],_0x4669('0x1c')));},'filename':function(_0x5df35a,_0x2676e2,_0x21d9f9){_0x21d9f9(null,util[_0x4669('0x1d')](_0x4669('0x1e'),_0x4669('0x25'),path['extname'](_0x2676e2[_0x4669('0x26')])));}})});router['post'](_0x4669('0x27'),upload[_0x4669('0x22')](_0x4669('0x23')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x4669('0x19')]({'destination':function(_0x362117,_0x5a0ad4,_0x1330e8){_0x1330e8(null,path[_0x4669('0x1a')](config[_0x4669('0x1b')],_0x4669('0x1c')));},'filename':function(_0x29b0ba,_0x287297,_0x436494){_0x436494(null,util[_0x4669('0x1d')]('%s%s',_0x4669('0x28'),path['extname'](_0x287297[_0x4669('0x26')])));}})});router[_0x4669('0x21')](_0x4669('0x15'),upload['single']('file'),controller['addPreferred']);var upload=multer({'storage':multer[_0x4669('0x19')]({'destination':function(_0x28f3ce,_0x11db8c,_0x3a61f7){_0x3a61f7(null,path[_0x4669('0x1a')](config[_0x4669('0x1b')],_0x4669('0x1c')));},'filename':function(_0x52183d,_0x5c5814,_0x574dd5){_0x574dd5(null,util[_0x4669('0x1d')](_0x4669('0x1e'),'favicon',path[_0x4669('0x20')](_0x5c5814['originalname'])));}})});router['post'](_0x4669('0x17'),upload[_0x4669('0x22')](_0x4669('0x23')),controller['addFavicon']);router[_0x4669('0x29')](_0x4669('0xf'),auth[_0x4669('0xb')](),controller[_0x4669('0x2a')]);module[_0x4669('0x2b')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index c74b8c5..8b2822d 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 _0xe124=['min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','INTEGER','min_internal'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xe124,0xa0));var _0x4e12=function(_0x3351b7,_0x448982){_0x3351b7=_0x3351b7-0x0;var _0x44a44f=_0xe124[_0x3351b7];return _0x44a44f;};'use strict';var Sequelize=require('sequelize');module['exports']={'min_internal':{'type':Sequelize[_0x4e12('0x0')](0xb),'unique':_0x4e12('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x4e12('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x4e12('0x0')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x4e12('0x3')],'defaultValue':_0x4e12('0x4')},'logo':{'type':Sequelize[_0x4e12('0x3')]},'defaultLogo':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x4e12('0x3')]},'turnaddr':{'type':Sequelize[_0x4e12('0x3')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x4e12('0x3')]},'pageTitle':{'type':Sequelize[_0x4e12('0x3')]},'defaultPageTitle':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x4e12('0x0')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x4e12('0x3')],'defaultValue':_0x4e12('0x6')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x4e12('0x0')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x4e12('0x0')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x4e12('0x3')],'defaultValue':_0x4e12('0x7')},'chatTimeout':{'type':Sequelize[_0x4e12('0x0')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x4e12('0x3')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x4e12('0x3')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x4e12('0x3')]},'defaultFavicon':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x4e12('0x0')]},'transcribeRegion':{'type':Sequelize[_0x4e12('0x3')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x4e12('0x0')]},'sentimentRegion':{'type':Sequelize[_0x4e12('0x3')]},'language':{'type':Sequelize[_0x4e12('0x3')]},'bucket':{'type':Sequelize[_0x4e12('0x3')]},'googleSsoEnabled':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x4e12('0x0')](0x2)[_0x4e12('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x4e12('0x0')](0x2)[_0x4e12('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x4e12('0x0')](0x2)[_0x4e12('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x4e12('0x0')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x4e12('0x0')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x4e12('0x0')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x4e12('0x0')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x4e12('0x0')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x4e12('0x0')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x4e12('0x0')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0xfb23=['min_internal','INTEGER','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports'];(function(_0x2093e3,_0x8eb650){var _0x841d6=function(_0x2b386b){while(--_0x2b386b){_0x2093e3['push'](_0x2093e3['shift']());}};_0x841d6(++_0x8eb650);}(_0xfb23,0x102));var _0x3fb2=function(_0x3b3fae,_0x522f53){_0x3b3fae=_0x3b3fae-0x0;var _0x10b2f0=_0xfb23[_0x3b3fae];return _0x10b2f0;};'use strict';var Sequelize=require(_0x3fb2('0x0'));module[_0x3fb2('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x3fb2('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x3fb2('0x3')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x3fb2('0x4')},'logo':{'type':Sequelize[_0x3fb2('0x5')]},'defaultLogo':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x3fb2('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x3fb2('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x3fb2('0x5')]},'turnaddr':{'type':Sequelize[_0x3fb2('0x5')]},'turnusername':{'type':Sequelize[_0x3fb2('0x5')]},'turnpassword':{'type':Sequelize[_0x3fb2('0x5')]},'pageTitle':{'type':Sequelize[_0x3fb2('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x3fb2('0x3')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x3fb2('0x5')],'defaultValue':_0x3fb2('0x7')},'enableEmailPreview':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x3fb2('0x3')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x3fb2('0x8')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x3fb2('0x5')]},'defaultPreferred':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x3fb2('0x3')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x3fb2('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x3fb2('0x3')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x3fb2('0x3')]},'transcribeRegion':{'type':Sequelize[_0x3fb2('0x5')]},'sentiment':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x3fb2('0x3')]},'sentimentRegion':{'type':Sequelize[_0x3fb2('0x5')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x3fb2('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x3fb2('0x3')](0x2)[_0x3fb2('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x3fb2('0x3')](0x2)[_0x3fb2('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x3fb2('0x3')](0x2)[_0x3fb2('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x3fb2('0x3')](0x2)[_0x3fb2('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x3fb2('0x3')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x3fb2('0x3')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x3fb2('0x3')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x3fb2('0x3')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x3fb2('0x3')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':![]},'limitTabs':{'type':Sequelize['INTEGER'],'defaultValue':0x14},'filterFullName':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index a00cacb..fd6c01f 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 _0x4e8e=['preferred','defaultLogo','defaultLoginLogo','defaultPreferred','logo','existsSync','join','root','toLower','default_logo.svg','default','custom','Sequelize','ValidationError','upperFirst','\x20not\x20found','download','getLogoLogin','defaultFavicon','default_loginLogo.svg','securePassword','default_preferred.png','addFavicon','favicon','default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','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','jayson/promise','client','http','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','then','stack','name','send','index','rawAttributes','fieldName','type','model','map','keys','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','Setting','includeAll','include','findAll','show','params','intersection','options','find','body','filename','file','addLogoLogin','loginLogo','server/files/images/logos','getLicense'];(function(_0x10170b,_0x67f13c){var _0x13b147=function(_0x49c38e){while(--_0x49c38e){_0x10170b['push'](_0x10170b['shift']());}};_0x13b147(++_0x67f13c);}(_0x4e8e,0x95));var _0xe4e8=function(_0x2674c4,_0x165702){_0x2674c4=_0x2674c4-0x0;var _0x10f9c9=_0x4e8e[_0x2674c4];return _0x10f9c9;};'use strict';var emlformat=require(_0xe4e8('0x0'));var rimraf=require(_0xe4e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe4e8('0x2'));var moment=require(_0xe4e8('0x3'));var BPromise=require(_0xe4e8('0x4'));var Mustache=require(_0xe4e8('0x5'));var util=require('util');var path=require(_0xe4e8('0x6'));var sox=require(_0xe4e8('0x7'));var csv=require(_0xe4e8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe4e8('0x9'));var _=require(_0xe4e8('0xa'));var squel=require(_0xe4e8('0xb'));var crypto=require(_0xe4e8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe4e8('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe4e8('0xe'));var Papa=require(_0xe4e8('0xf'));var Redis=require(_0xe4e8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe4e8('0x11'));var as=require(_0xe4e8('0x12'));var hardwareService=require(_0xe4e8('0x13'));var logger=require(_0xe4e8('0x14'))(_0xe4e8('0x15'));var utils=require(_0xe4e8('0x16'));var config=require(_0xe4e8('0x17'));var licenseUtil=require(_0xe4e8('0x18'));var db=require(_0xe4e8('0x19'))['db'];var jayson=require(_0xe4e8('0x1a'));var client=jayson[_0xe4e8('0x1b')][_0xe4e8('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2f8a43,_0x5ba8ea,_0x30750d,_0x522d39){return new BPromise(function(_0x291488,_0x12ecc0){var _0x8ccbed=_0x522d39||client;return _0x8ccbed['request'](_0x2f8a43,_0x30750d)['then'](function(_0x413aec){logger['info'](_0xe4e8('0x1d'),_0x5ba8ea,'request\x20sent');logger[_0xe4e8('0x1e')](_0xe4e8('0x1f'),_0x5ba8ea,_0xe4e8('0x20'),JSON[_0xe4e8('0x21')](_0x413aec));if(_0x413aec[_0xe4e8('0x22')]){if(_0x413aec['error'][_0xe4e8('0x23')]===0x1f4){logger[_0xe4e8('0x22')](_0xe4e8('0x1d'),_0x5ba8ea,_0x413aec['error'][_0xe4e8('0x24')]);return _0x12ecc0(_0x413aec[_0xe4e8('0x22')][_0xe4e8('0x24')]);}logger[_0xe4e8('0x22')](_0xe4e8('0x1d'),_0x5ba8ea,_0x413aec[_0xe4e8('0x22')][_0xe4e8('0x24')]);return _0x291488(_0x413aec[_0xe4e8('0x22')]['message']);}else{logger[_0xe4e8('0x25')](_0xe4e8('0x1d'),_0x5ba8ea,_0xe4e8('0x20'));_0x291488(_0x413aec['result'][_0xe4e8('0x24')]);}})[_0xe4e8('0x26')](function(_0x4ca479){logger['error'](_0xe4e8('0x1d'),_0x5ba8ea,_0x4ca479);_0x12ecc0(_0x4ca479);});});}function respondWithStatusCode(_0x2e010f,_0x4292af){_0x4292af=_0x4292af||0xcc;return function(_0x1ed3e6){if(_0x1ed3e6){return _0x2e010f[_0xe4e8('0x27')](_0x4292af);}return _0x2e010f[_0xe4e8('0x28')](_0x4292af)['end']();};}function respondWithResult(_0x478c5f,_0x1c26d8){_0x1c26d8=_0x1c26d8||0xc8;return function(_0x54952f){if(_0x54952f){return _0x478c5f[_0xe4e8('0x28')](_0x1c26d8)[_0xe4e8('0x29')](_0x54952f);}};}function respondWithFilteredResult(_0x1e6bcb,_0xb7deb){return function(_0x457b3e){if(_0x457b3e){var _0x32be1e=typeof _0xb7deb[_0xe4e8('0x2a')]===_0xe4e8('0x2b')&&typeof _0xb7deb[_0xe4e8('0x2c')]===_0xe4e8('0x2b');var _0x1174c5=_0x457b3e['count'];var _0x3553d=_0x32be1e?0x0:_0xb7deb['offset'];var _0x13db82=_0x32be1e?_0x457b3e[_0xe4e8('0x2d')]:_0xb7deb[_0xe4e8('0x2a')]+_0xb7deb[_0xe4e8('0x2c')];var _0x3084e9;if(_0x13db82>=_0x1174c5){_0x13db82=_0x1174c5;_0x3084e9=0xc8;}else{_0x3084e9=0xce;}_0x1e6bcb[_0xe4e8('0x28')](_0x3084e9);return _0x1e6bcb[_0xe4e8('0x2e')](_0xe4e8('0x2f'),_0x3553d+'-'+_0x13db82+'/'+_0x1174c5)[_0xe4e8('0x29')](_0x457b3e);}return null;};}function patchUpdates(_0x455c92){return function(_0x36e3c0){try{jsonpatch['apply'](_0x36e3c0,_0x455c92,!![]);}catch(_0x5a6811){return BPromise[_0xe4e8('0x30')](_0x5a6811);}return _0x36e3c0['save']();};}function saveUpdates(_0x25f58a,_0x2de6bf){return function(_0x425d22){if(_0x425d22){return _0x425d22[_0xe4e8('0x31')](_0x25f58a)['then'](function(_0x39af87){return _0x39af87;});}return null;};}function removeEntity(_0x29acf1,_0xd70b97){return function(_0x34ea19){if(_0x34ea19){return _0x34ea19[_0xe4e8('0x32')]()[_0xe4e8('0x33')](function(){_0x29acf1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x158f82,_0xb0046f){return function(_0x4a4bf4){if(!_0x4a4bf4){_0x158f82['sendStatus'](0x194);}return _0x4a4bf4;};}function handleError(_0x491d64,_0x459ad1){_0x459ad1=_0x459ad1||0x1f4;return function(_0xb59928){logger['error'](_0xb59928[_0xe4e8('0x34')]);if(_0xb59928[_0xe4e8('0x35')]){delete _0xb59928[_0xe4e8('0x35')];}_0x491d64[_0xe4e8('0x28')](_0x459ad1)[_0xe4e8('0x36')](_0xb59928);};}exports[_0xe4e8('0x37')]=function(_0x489f4c,_0xcc7bc4){var _0x5f5633={},_0x1ce25b={},_0x61b72c={'count':0x0,'rows':[]};var _0x33ca17=_['map'](db['Setting'][_0xe4e8('0x38')],function(_0xf7b4af){return{'name':_0xf7b4af[_0xe4e8('0x39')],'type':_0xf7b4af[_0xe4e8('0x3a')]['key']};});_0x1ce25b[_0xe4e8('0x3b')]=_[_0xe4e8('0x3c')](_0x33ca17,_0xe4e8('0x35'));_0x1ce25b['query']=_[_0xe4e8('0x3d')](_0x489f4c[_0xe4e8('0x3e')]);_0x1ce25b['filters']=_['intersection'](_0x1ce25b[_0xe4e8('0x3b')],_0x1ce25b[_0xe4e8('0x3e')]);_0x5f5633[_0xe4e8('0x3f')]=_['intersection'](_0x1ce25b['model'],qs[_0xe4e8('0x40')](_0x489f4c[_0xe4e8('0x3e')][_0xe4e8('0x40')]));_0x5f5633[_0xe4e8('0x3f')]=_0x5f5633[_0xe4e8('0x3f')][_0xe4e8('0x41')]?_0x5f5633[_0xe4e8('0x3f')]:_0x1ce25b['model'];if(!_0x489f4c[_0xe4e8('0x3e')][_0xe4e8('0x42')](_0xe4e8('0x43'))){_0x5f5633[_0xe4e8('0x2c')]=qs[_0xe4e8('0x2c')](_0x489f4c['query'][_0xe4e8('0x2c')]);_0x5f5633[_0xe4e8('0x2a')]=qs[_0xe4e8('0x2a')](_0x489f4c['query'][_0xe4e8('0x2a')]);}_0x5f5633[_0xe4e8('0x44')]=qs['sort'](_0x489f4c['query'][_0xe4e8('0x45')]);_0x5f5633[_0xe4e8('0x46')]=qs[_0xe4e8('0x47')](_[_0xe4e8('0x48')](_0x489f4c['query'],_0x1ce25b['filters']),_0x33ca17);if(_0x489f4c[_0xe4e8('0x3e')][_0xe4e8('0x49')]){_0x5f5633[_0xe4e8('0x46')]=_[_0xe4e8('0x4a')](_0x5f5633['where'],{'$or':_[_0xe4e8('0x3c')](_0x33ca17,function(_0x2789a0){if(_0x2789a0[_0xe4e8('0x3a')]!=='VIRTUAL'){var _0x548e60={};_0x548e60[_0x2789a0[_0xe4e8('0x35')]]={'$like':'%'+_0x489f4c[_0xe4e8('0x3e')][_0xe4e8('0x49')]+'%'};return _0x548e60;}})});}_0x5f5633=_[_0xe4e8('0x4a')]({},_0x5f5633,_0x489f4c['options']);var _0x132c31={'where':_0x5f5633[_0xe4e8('0x46')]};return db[_0xe4e8('0x4b')][_0xe4e8('0x2d')](_0x132c31)[_0xe4e8('0x33')](function(_0x142aae){_0x61b72c[_0xe4e8('0x2d')]=_0x142aae;if(_0x489f4c[_0xe4e8('0x3e')][_0xe4e8('0x4c')]){_0x5f5633[_0xe4e8('0x4d')]=[{'all':!![]}];}return db['Setting'][_0xe4e8('0x4e')](_0x5f5633);})[_0xe4e8('0x33')](function(_0x1023d0){_0x61b72c['rows']=_0x1023d0;return _0x61b72c;})[_0xe4e8('0x33')](respondWithFilteredResult(_0xcc7bc4,_0x5f5633))[_0xe4e8('0x26')](handleError(_0xcc7bc4,null));};exports[_0xe4e8('0x4f')]=function(_0x3f4efa,_0x81a9f9){var _0x19ff10={'raw':![],'where':{'id':_0x3f4efa[_0xe4e8('0x50')]['id']}},_0x59c95c={};_0x59c95c[_0xe4e8('0x3b')]=_[_0xe4e8('0x3d')](db[_0xe4e8('0x4b')][_0xe4e8('0x38')]);_0x59c95c[_0xe4e8('0x3e')]=_[_0xe4e8('0x3d')](_0x3f4efa[_0xe4e8('0x3e')]);_0x59c95c[_0xe4e8('0x47')]=_[_0xe4e8('0x51')](_0x59c95c[_0xe4e8('0x3b')],_0x59c95c[_0xe4e8('0x3e')]);_0x19ff10[_0xe4e8('0x3f')]=_[_0xe4e8('0x51')](_0x59c95c[_0xe4e8('0x3b')],qs['fields'](_0x3f4efa[_0xe4e8('0x3e')][_0xe4e8('0x40')]));_0x19ff10['attributes']=_0x19ff10[_0xe4e8('0x3f')][_0xe4e8('0x41')]?_0x19ff10[_0xe4e8('0x3f')]:_0x59c95c[_0xe4e8('0x3b')];if(_0x3f4efa['query'][_0xe4e8('0x4c')]){_0x19ff10[_0xe4e8('0x4d')]=[{'all':!![]}];}_0x19ff10=_['merge']({},_0x19ff10,_0x3f4efa[_0xe4e8('0x52')]);return db[_0xe4e8('0x4b')][_0xe4e8('0x53')](_0x19ff10)[_0xe4e8('0x33')](handleEntityNotFound(_0x81a9f9,null))[_0xe4e8('0x33')](respondWithResult(_0x81a9f9,null))[_0xe4e8('0x26')](handleError(_0x81a9f9,null));};exports[_0xe4e8('0x31')]=function(_0x7f603,_0x51e27f){if(_0x7f603[_0xe4e8('0x54')]['id']){delete _0x7f603[_0xe4e8('0x54')]['id'];}return db[_0xe4e8('0x4b')][_0xe4e8('0x53')]({'where':{'id':_0x7f603[_0xe4e8('0x50')]['id']}})[_0xe4e8('0x33')](handleEntityNotFound(_0x51e27f,null))[_0xe4e8('0x33')](saveUpdates(_0x7f603[_0xe4e8('0x54')],null))[_0xe4e8('0x33')](respondWithResult(_0x51e27f,null))[_0xe4e8('0x26')](handleError(_0x51e27f,null));};exports['addLogo']=function(_0x4d0540,_0x40d20d,_0x5ea2fd){if(_0x4d0540['file']&&_0x4d0540['file'][_0xe4e8('0x55')]){_0x4d0540['body']['logo']=_0x4d0540[_0xe4e8('0x56')][_0xe4e8('0x55')];}return db[_0xe4e8('0x4b')][_0xe4e8('0x53')]({'where':{'id':_0x4d0540['params']['id']}})['then'](handleEntityNotFound(_0x40d20d,null))[_0xe4e8('0x33')](saveUpdates(_0x4d0540[_0xe4e8('0x54')],null))[_0xe4e8('0x33')](respondWithResult(_0x40d20d,null))[_0xe4e8('0x26')](handleError(_0x40d20d,null));};exports[_0xe4e8('0x57')]=function(_0x3caa2f,_0x143a24,_0x235474){if(_0x3caa2f[_0xe4e8('0x56')]&&_0x3caa2f['file'][_0xe4e8('0x55')]){_0x3caa2f[_0xe4e8('0x54')][_0xe4e8('0x58')]=_0x3caa2f['file'][_0xe4e8('0x55')];}return db[_0xe4e8('0x4b')][_0xe4e8('0x53')]({'where':{'id':_0x3caa2f['params']['id']}})[_0xe4e8('0x33')](handleEntityNotFound(_0x143a24,null))[_0xe4e8('0x33')](saveUpdates(_0x3caa2f[_0xe4e8('0x54')],null))['then'](respondWithResult(_0x143a24,null))[_0xe4e8('0x26')](handleError(_0x143a24,null));};var utilLicense=require(_0xe4e8('0x18'));exports['getLogo']=function(_0x40d251,_0x1b2f64,_0x5982fe){var _0x3eb620=_0xe4e8('0x59');var _0x3e66a3={'custom':![]};return utilLicense[_0xe4e8('0x5a')]()['then'](function(_0x51d0c3){if(_0x51d0c3){_0x3e66a3=_0x51d0c3;}return db[_0xe4e8('0x4b')]['find']({'where':{'id':_0x40d251[_0xe4e8('0x50')]['id']},'attributes':['logo','loginLogo',_0xe4e8('0x5b'),'favicon',_0xe4e8('0x5c'),_0xe4e8('0x5d'),_0xe4e8('0x5e'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x1b2f64,null))[_0xe4e8('0x33')](function(_0x34dea9){if(_0x34dea9){var _0x5a7733=_0x34dea9[_0xe4e8('0x5f')]&&fs[_0xe4e8('0x60')](path[_0xe4e8('0x61')](config[_0xe4e8('0x62')],_0x3eb620,_['toLower'](_0x34dea9['logo'])))?path['join'](config[_0xe4e8('0x62')],_0x3eb620,_['toLower'](_0x34dea9[_0xe4e8('0x5f')])):path[_0xe4e8('0x61')](config[_0xe4e8('0x62')],_0x3eb620,_[_0xe4e8('0x63')](_0xe4e8('0x64')));var _0x3a1308=_0xe4e8('0x65')+_['upperFirst'](_0xe4e8('0x5f'));if(_0x34dea9[_0x3a1308]||!_0x3e66a3[_0xe4e8('0x66')]){_0x5a7733=path['join'](config['root'],_0x3eb620,_[_0xe4e8('0x63')](_0xe4e8('0x64')));}if(!fs['existsSync'](_0x5a7733)){throw new db[(_0xe4e8('0x67'))][(_0xe4e8('0x68'))](_[_0xe4e8('0x69')](_0xe4e8('0x5f'))+_0xe4e8('0x6a'));}return _0x1b2f64[_0xe4e8('0x6b')](_0x5a7733);}})[_0xe4e8('0x26')](handleError(_0x1b2f64,null));};var utilLicense=require(_0xe4e8('0x18'));exports[_0xe4e8('0x6c')]=function(_0x5d095b,_0x3e0144,_0x5cffd5){var _0x50aa03=_0xe4e8('0x59');var _0xad8396={'custom':![]};return utilLicense[_0xe4e8('0x5a')]()[_0xe4e8('0x33')](function(_0x5df30c){if(_0x5df30c){_0xad8396=_0x5df30c;}return db[_0xe4e8('0x4b')][_0xe4e8('0x53')]({'where':{'id':_0x5d095b[_0xe4e8('0x50')]['id']},'attributes':[_0xe4e8('0x5f'),_0xe4e8('0x58'),'preferred','favicon',_0xe4e8('0x5c'),_0xe4e8('0x5d'),'defaultPreferred',_0xe4e8('0x6d')],'raw':!![]});})[_0xe4e8('0x33')](handleEntityNotFound(_0x3e0144,null))[_0xe4e8('0x33')](function(_0x41b87b){if(_0x41b87b){var _0x51f7b7=_0x41b87b[_0xe4e8('0x58')]&&fs[_0xe4e8('0x60')](path[_0xe4e8('0x61')](config[_0xe4e8('0x62')],_0x50aa03,_[_0xe4e8('0x63')](_0x41b87b['loginLogo'])))?path['join'](config[_0xe4e8('0x62')],_0x50aa03,_[_0xe4e8('0x63')](_0x41b87b[_0xe4e8('0x58')])):path[_0xe4e8('0x61')](config[_0xe4e8('0x62')],_0x50aa03,_['toLower']('default_loginLogo.svg'));var _0x10d8e2=_0xe4e8('0x65')+_[_0xe4e8('0x69')](_0xe4e8('0x58'));if(_0x41b87b[_0x10d8e2]||!_0xad8396['custom']){_0x51f7b7=path[_0xe4e8('0x61')](config[_0xe4e8('0x62')],_0x50aa03,_[_0xe4e8('0x63')](_0xe4e8('0x6e')));}if(!fs['existsSync'](_0x51f7b7)){throw new db['Sequelize'][(_0xe4e8('0x68'))](_[_0xe4e8('0x69')]('loginLogo')+_0xe4e8('0x6a'));}return _0x3e0144[_0xe4e8('0x6b')](_0x51f7b7);}})[_0xe4e8('0x26')](handleError(_0x3e0144,null));};exports['gdpr']=function(_0x24db93,_0x4b91bd){return db[_0xe4e8('0x4b')][_0xe4e8('0x53')]({'where':{'id':_0x24db93[_0xe4e8('0x50')]['id']},'attributes':[_0xe4e8('0x6f')]})['then'](respondWithResult(_0x4b91bd,null))['catch'](handleError(_0x4b91bd,null));};exports['addPreferred']=function(_0x52539f,_0x10ac9d,_0x2710e4){if(_0x52539f[_0xe4e8('0x56')]&&_0x52539f['file'][_0xe4e8('0x55')]){_0x52539f['body'][_0xe4e8('0x5b')]=_0x52539f[_0xe4e8('0x56')][_0xe4e8('0x55')];}return db['Setting'][_0xe4e8('0x53')]({'where':{'id':_0x52539f[_0xe4e8('0x50')]['id']}})[_0xe4e8('0x33')](handleEntityNotFound(_0x10ac9d,null))['then'](saveUpdates(_0x52539f[_0xe4e8('0x54')],null))[_0xe4e8('0x33')](respondWithResult(_0x10ac9d,null))[_0xe4e8('0x26')](handleError(_0x10ac9d,null));};var utilLicense=require(_0xe4e8('0x18'));exports['getPreferred']=function(_0x2221e4,_0x21eff5,_0x50f55f){var _0x4275cc=_0xe4e8('0x59');var _0x587088={'custom':![]};return utilLicense['getLicense']()[_0xe4e8('0x33')](function(_0x532c56){if(_0x532c56){_0x587088=_0x532c56;}return db['Setting']['find']({'where':{'id':_0x2221e4['params']['id']},'attributes':[_0xe4e8('0x5f'),_0xe4e8('0x58'),'preferred','favicon','defaultLogo',_0xe4e8('0x5d'),'defaultPreferred',_0xe4e8('0x6d')],'raw':!![]});})['then'](handleEntityNotFound(_0x21eff5,null))['then'](function(_0x256924){if(_0x256924){var _0x707e56=_0x256924[_0xe4e8('0x5b')]&&fs[_0xe4e8('0x60')](path[_0xe4e8('0x61')](config[_0xe4e8('0x62')],_0x4275cc,_['toLower'](_0x256924[_0xe4e8('0x5b')])))?path[_0xe4e8('0x61')](config[_0xe4e8('0x62')],_0x4275cc,_[_0xe4e8('0x63')](_0x256924['preferred'])):path['join'](config[_0xe4e8('0x62')],_0x4275cc,_[_0xe4e8('0x63')](_0xe4e8('0x70')));var _0x1ed7da='default'+_['upperFirst'](_0xe4e8('0x5b'));if(_0x256924[_0x1ed7da]||!_0x587088['custom']||!_0x587088[_0xe4e8('0x5b')]){_0x707e56=path[_0xe4e8('0x61')](config[_0xe4e8('0x62')],_0x4275cc,_['toLower'](_0xe4e8('0x70')));}if(!fs[_0xe4e8('0x60')](_0x707e56)){throw new db[(_0xe4e8('0x67'))][(_0xe4e8('0x68'))](_[_0xe4e8('0x69')](_0xe4e8('0x5b'))+_0xe4e8('0x6a'));}return _0x21eff5[_0xe4e8('0x6b')](_0x707e56);}})['catch'](handleError(_0x21eff5,null));};exports[_0xe4e8('0x71')]=function(_0x493d9c,_0x31031e,_0x485324){if(_0x493d9c[_0xe4e8('0x56')]&&_0x493d9c[_0xe4e8('0x56')]['filename']){_0x493d9c[_0xe4e8('0x54')][_0xe4e8('0x72')]=_0x493d9c['file']['filename'];}return db[_0xe4e8('0x4b')]['find']({'where':{'id':_0x493d9c[_0xe4e8('0x50')]['id']}})['then'](handleEntityNotFound(_0x31031e,null))[_0xe4e8('0x33')](saveUpdates(_0x493d9c[_0xe4e8('0x54')],null))[_0xe4e8('0x33')](respondWithResult(_0x31031e,null))[_0xe4e8('0x26')](handleError(_0x31031e,null));};var utilLicense=require(_0xe4e8('0x18'));exports['getFavicon']=function(_0x3043a8,_0x2d9091,_0xad2c4a){var _0x49d9e4=_0xe4e8('0x59');var _0x2290a5={'custom':![]};return utilLicense[_0xe4e8('0x5a')]()[_0xe4e8('0x33')](function(_0x335c41){if(_0x335c41){_0x2290a5=_0x335c41;}return db[_0xe4e8('0x4b')][_0xe4e8('0x53')]({'where':{'id':_0x3043a8[_0xe4e8('0x50')]['id']},'attributes':[_0xe4e8('0x5f'),_0xe4e8('0x58'),_0xe4e8('0x5b'),_0xe4e8('0x72'),_0xe4e8('0x5c'),_0xe4e8('0x5d'),_0xe4e8('0x5e'),_0xe4e8('0x6d')],'raw':!![]});})[_0xe4e8('0x33')](handleEntityNotFound(_0x2d9091,null))[_0xe4e8('0x33')](function(_0x435499){if(_0x435499){var _0x6db895=_0x435499[_0xe4e8('0x72')]&&fs[_0xe4e8('0x60')](path['join'](config[_0xe4e8('0x62')],_0x49d9e4,_['toLower'](_0x435499[_0xe4e8('0x72')])))?path['join'](config['root'],_0x49d9e4,_[_0xe4e8('0x63')](_0x435499[_0xe4e8('0x72')])):path[_0xe4e8('0x61')](config['root'],_0x49d9e4,_['toLower'](_0xe4e8('0x73')));var _0x545840=_0xe4e8('0x65')+_[_0xe4e8('0x69')](_0xe4e8('0x72'));if(_0x435499[_0x545840]||!_0x2290a5[_0xe4e8('0x66')]){_0x6db895=path[_0xe4e8('0x61')](config[_0xe4e8('0x62')],_0x49d9e4,_[_0xe4e8('0x63')](_0xe4e8('0x73')));}if(!fs['existsSync'](_0x6db895)){throw new db[(_0xe4e8('0x67'))][(_0xe4e8('0x68'))](_['upperFirst'](_0xe4e8('0x72'))+'\x20not\x20found');}return _0x2d9091[_0xe4e8('0x6b')](_0x6db895);}})[_0xe4e8('0x26')](handleError(_0x2d9091,null));};exports['getDate']=function(_0x4c2efb,_0x118cd9){var _0x727943={'offset':moment()[_0xe4e8('0x74')]()};_0x727943[_0xe4e8('0x75')]=moment()[_0xe4e8('0x74')](_0x727943[_0xe4e8('0x2a')])[_0xe4e8('0x76')](_0xe4e8('0x77'));return _0x118cd9['status'](0xc8)[_0xe4e8('0x36')](_0x727943);}; \ No newline at end of file +var _0x6361=['bluebird','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','save','then','destroy','name','index','Setting','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','map','VIRTUAL','count','includeAll','include','findAll','rows','show','params','keys','rawAttributes','update','body','find','file','filename','addLogoLogin','loginLogo','getLogo','getLicense','logo','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','default_logo.svg','default','custom','Sequelize','ValidationError','upperFirst','download','getLogoLogin','server/files/images/logos','defaultLogo','root','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6361,0x76));var _0x1636=function(_0xbf689f,_0x37264a){_0xbf689f=_0xbf689f-0x0;var _0x5a11db=_0x6361[_0xbf689f];return _0x5a11db;};'use strict';var emlformat=require(_0x1636('0x0'));var rimraf=require(_0x1636('0x1'));var zipdir=require(_0x1636('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1636('0x3'));var moment=require(_0x1636('0x4'));var BPromise=require(_0x1636('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1636('0x6'));var ejs=require(_0x1636('0x7'));var fs=require('fs');var fs_extra=require(_0x1636('0x8'));var _=require(_0x1636('0x9'));var squel=require('squel');var crypto=require(_0x1636('0xa'));var jsforce=require(_0x1636('0xb'));var deskjs=require(_0x1636('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1636('0xd'));var Papa=require(_0x1636('0xe'));var Redis=require('ioredis');var authService=require(_0x1636('0xf'));var qs=require(_0x1636('0x10'));var as=require(_0x1636('0x11'));var hardwareService=require(_0x1636('0x12'));var logger=require('../../config/logger')(_0x1636('0x13'));var utils=require('../../config/utils');var config=require(_0x1636('0x14'));var licenseUtil=require(_0x1636('0x15'));var db=require(_0x1636('0x16'))['db'];var jayson=require(_0x1636('0x17'));var client=jayson['client'][_0x1636('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x53c163,_0x1ce42c,_0x364ae7,_0x4ad504){return new BPromise(function(_0xa8cdc1,_0x100838){var _0x1ab416=_0x4ad504||client;return _0x1ab416[_0x1636('0x19')](_0x53c163,_0x364ae7)['then'](function(_0x5d101f){logger[_0x1636('0x1a')]('Setting,\x20%s,\x20%s',_0x1ce42c,_0x1636('0x1b'));logger[_0x1636('0x1c')](_0x1636('0x1d'),_0x1ce42c,_0x1636('0x1b'),JSON[_0x1636('0x1e')](_0x5d101f));if(_0x5d101f[_0x1636('0x1f')]){if(_0x5d101f[_0x1636('0x1f')][_0x1636('0x20')]===0x1f4){logger[_0x1636('0x1f')](_0x1636('0x21'),_0x1ce42c,_0x5d101f[_0x1636('0x1f')][_0x1636('0x22')]);return _0x100838(_0x5d101f[_0x1636('0x1f')][_0x1636('0x22')]);}logger['error'](_0x1636('0x21'),_0x1ce42c,_0x5d101f[_0x1636('0x1f')][_0x1636('0x22')]);return _0xa8cdc1(_0x5d101f[_0x1636('0x1f')][_0x1636('0x22')]);}else{logger['info'](_0x1636('0x21'),_0x1ce42c,_0x1636('0x1b'));_0xa8cdc1(_0x5d101f[_0x1636('0x23')][_0x1636('0x22')]);}})[_0x1636('0x24')](function(_0x130d37){logger[_0x1636('0x1f')](_0x1636('0x21'),_0x1ce42c,_0x130d37);_0x100838(_0x130d37);});});}function respondWithStatusCode(_0xeab834,_0x269e3c){_0x269e3c=_0x269e3c||0xcc;return function(_0x406a16){if(_0x406a16){return _0xeab834[_0x1636('0x25')](_0x269e3c);}return _0xeab834[_0x1636('0x26')](_0x269e3c)[_0x1636('0x27')]();};}function respondWithResult(_0x5dc240,_0x1e734e){_0x1e734e=_0x1e734e||0xc8;return function(_0x38de60){if(_0x38de60){return _0x5dc240[_0x1636('0x26')](_0x1e734e)[_0x1636('0x28')](_0x38de60);}};}function respondWithFilteredResult(_0x28878a,_0x4c50bb){return function(_0x309b34){if(_0x309b34){var _0x33eb37=typeof _0x4c50bb[_0x1636('0x29')]===_0x1636('0x2a')&&typeof _0x4c50bb[_0x1636('0x2b')]===_0x1636('0x2a');var _0x32d826=_0x309b34['count'];var _0x21c1eb=_0x33eb37?0x0:_0x4c50bb[_0x1636('0x29')];var _0x6709ef=_0x33eb37?_0x309b34['count']:_0x4c50bb[_0x1636('0x29')]+_0x4c50bb[_0x1636('0x2b')];var _0x2e9253;if(_0x6709ef>=_0x32d826){_0x6709ef=_0x32d826;_0x2e9253=0xc8;}else{_0x2e9253=0xce;}_0x28878a[_0x1636('0x26')](_0x2e9253);return _0x28878a['set'](_0x1636('0x2c'),_0x21c1eb+'-'+_0x6709ef+'/'+_0x32d826)[_0x1636('0x28')](_0x309b34);}return null;};}function patchUpdates(_0x1eb1fd){return function(_0x3bb687){try{jsonpatch[_0x1636('0x2d')](_0x3bb687,_0x1eb1fd,!![]);}catch(_0x440bba){return BPromise['reject'](_0x440bba);}return _0x3bb687[_0x1636('0x2e')]();};}function saveUpdates(_0x47fa22,_0xc4b6ac){return function(_0x175fbb){if(_0x175fbb){return _0x175fbb['update'](_0x47fa22)[_0x1636('0x2f')](function(_0x2dbc61){return _0x2dbc61;});}return null;};}function removeEntity(_0x3fea4f,_0x4dd653){return function(_0x253b3a){if(_0x253b3a){return _0x253b3a[_0x1636('0x30')]()[_0x1636('0x2f')](function(){_0x3fea4f[_0x1636('0x26')](0xcc)[_0x1636('0x27')]();});}};}function handleEntityNotFound(_0x5e0bad,_0x17a4ad){return function(_0x1de9b8){if(!_0x1de9b8){_0x5e0bad[_0x1636('0x25')](0x194);}return _0x1de9b8;};}function handleError(_0x4cd99e,_0x166042){_0x166042=_0x166042||0x1f4;return function(_0x4a83fe){logger[_0x1636('0x1f')](_0x4a83fe['stack']);if(_0x4a83fe[_0x1636('0x31')]){delete _0x4a83fe['name'];}_0x4cd99e['status'](_0x166042)['send'](_0x4a83fe);};}exports[_0x1636('0x32')]=function(_0x49a200,_0x28ce38){var _0x397360={},_0x2a2217={},_0x4c5b49={'count':0x0,'rows':[]};var _0xd84808=_['map'](db[_0x1636('0x33')]['rawAttributes'],function(_0x25a6ff){return{'name':_0x25a6ff[_0x1636('0x34')],'type':_0x25a6ff[_0x1636('0x35')][_0x1636('0x36')]};});_0x2a2217[_0x1636('0x37')]=_['map'](_0xd84808,_0x1636('0x31'));_0x2a2217[_0x1636('0x38')]=_['keys'](_0x49a200['query']);_0x2a2217[_0x1636('0x39')]=_[_0x1636('0x3a')](_0x2a2217['model'],_0x2a2217[_0x1636('0x38')]);_0x397360[_0x1636('0x3b')]=_[_0x1636('0x3a')](_0x2a2217[_0x1636('0x37')],qs[_0x1636('0x3c')](_0x49a200['query'][_0x1636('0x3c')]));_0x397360[_0x1636('0x3b')]=_0x397360['attributes'][_0x1636('0x3d')]?_0x397360[_0x1636('0x3b')]:_0x2a2217['model'];if(!_0x49a200[_0x1636('0x38')]['hasOwnProperty'](_0x1636('0x3e'))){_0x397360[_0x1636('0x2b')]=qs[_0x1636('0x2b')](_0x49a200['query'][_0x1636('0x2b')]);_0x397360[_0x1636('0x29')]=qs[_0x1636('0x29')](_0x49a200[_0x1636('0x38')][_0x1636('0x29')]);}_0x397360[_0x1636('0x3f')]=qs[_0x1636('0x40')](_0x49a200[_0x1636('0x38')][_0x1636('0x40')]);_0x397360[_0x1636('0x41')]=qs[_0x1636('0x39')](_['pick'](_0x49a200['query'],_0x2a2217['filters']),_0xd84808);if(_0x49a200[_0x1636('0x38')][_0x1636('0x42')]){_0x397360[_0x1636('0x41')]=_[_0x1636('0x43')](_0x397360[_0x1636('0x41')],{'$or':_[_0x1636('0x44')](_0xd84808,function(_0x1901a2){if(_0x1901a2['type']!==_0x1636('0x45')){var _0x26a562={};_0x26a562[_0x1901a2['name']]={'$like':'%'+_0x49a200['query'][_0x1636('0x42')]+'%'};return _0x26a562;}})});}_0x397360=_[_0x1636('0x43')]({},_0x397360,_0x49a200['options']);var _0x26bade={'where':_0x397360['where']};return db[_0x1636('0x33')][_0x1636('0x46')](_0x26bade)[_0x1636('0x2f')](function(_0x5371fa){_0x4c5b49[_0x1636('0x46')]=_0x5371fa;if(_0x49a200[_0x1636('0x38')][_0x1636('0x47')]){_0x397360[_0x1636('0x48')]=[{'all':!![]}];}return db[_0x1636('0x33')][_0x1636('0x49')](_0x397360);})[_0x1636('0x2f')](function(_0x1a79c5){_0x4c5b49[_0x1636('0x4a')]=_0x1a79c5;return _0x4c5b49;})['then'](respondWithFilteredResult(_0x28ce38,_0x397360))[_0x1636('0x24')](handleError(_0x28ce38,null));};exports[_0x1636('0x4b')]=function(_0x14126f,_0x4a3ba6){var _0x55bb38={'raw':![],'where':{'id':_0x14126f[_0x1636('0x4c')]['id']}},_0x674026={};_0x674026[_0x1636('0x37')]=_[_0x1636('0x4d')](db[_0x1636('0x33')][_0x1636('0x4e')]);_0x674026['query']=_[_0x1636('0x4d')](_0x14126f[_0x1636('0x38')]);_0x674026[_0x1636('0x39')]=_[_0x1636('0x3a')](_0x674026['model'],_0x674026[_0x1636('0x38')]);_0x55bb38[_0x1636('0x3b')]=_[_0x1636('0x3a')](_0x674026['model'],qs[_0x1636('0x3c')](_0x14126f[_0x1636('0x38')]['fields']));_0x55bb38[_0x1636('0x3b')]=_0x55bb38[_0x1636('0x3b')]['length']?_0x55bb38[_0x1636('0x3b')]:_0x674026[_0x1636('0x37')];if(_0x14126f['query'][_0x1636('0x47')]){_0x55bb38['include']=[{'all':!![]}];}_0x55bb38=_[_0x1636('0x43')]({},_0x55bb38,_0x14126f['options']);return db[_0x1636('0x33')]['find'](_0x55bb38)[_0x1636('0x2f')](handleEntityNotFound(_0x4a3ba6,null))['then'](respondWithResult(_0x4a3ba6,null))[_0x1636('0x24')](handleError(_0x4a3ba6,null));};exports[_0x1636('0x4f')]=function(_0x5538d0,_0x295c05){if(_0x5538d0[_0x1636('0x50')]['id']){delete _0x5538d0[_0x1636('0x50')]['id'];}return db[_0x1636('0x33')][_0x1636('0x51')]({'where':{'id':_0x5538d0[_0x1636('0x4c')]['id']}})[_0x1636('0x2f')](handleEntityNotFound(_0x295c05,null))['then'](saveUpdates(_0x5538d0[_0x1636('0x50')],null))[_0x1636('0x2f')](respondWithResult(_0x295c05,null))[_0x1636('0x24')](handleError(_0x295c05,null));};exports['addLogo']=function(_0x3f87e2,_0x21f6bd,_0x429f4e){if(_0x3f87e2[_0x1636('0x52')]&&_0x3f87e2[_0x1636('0x52')][_0x1636('0x53')]){_0x3f87e2[_0x1636('0x50')]['logo']=_0x3f87e2[_0x1636('0x52')][_0x1636('0x53')];}return db[_0x1636('0x33')][_0x1636('0x51')]({'where':{'id':_0x3f87e2['params']['id']}})[_0x1636('0x2f')](handleEntityNotFound(_0x21f6bd,null))[_0x1636('0x2f')](saveUpdates(_0x3f87e2['body'],null))[_0x1636('0x2f')](respondWithResult(_0x21f6bd,null))[_0x1636('0x24')](handleError(_0x21f6bd,null));};exports[_0x1636('0x54')]=function(_0x444457,_0x495a1e,_0x25d5e3){if(_0x444457[_0x1636('0x52')]&&_0x444457[_0x1636('0x52')][_0x1636('0x53')]){_0x444457[_0x1636('0x50')][_0x1636('0x55')]=_0x444457['file']['filename'];}return db[_0x1636('0x33')][_0x1636('0x51')]({'where':{'id':_0x444457['params']['id']}})['then'](handleEntityNotFound(_0x495a1e,null))[_0x1636('0x2f')](saveUpdates(_0x444457[_0x1636('0x50')],null))[_0x1636('0x2f')](respondWithResult(_0x495a1e,null))[_0x1636('0x24')](handleError(_0x495a1e,null));};var utilLicense=require(_0x1636('0x15'));exports[_0x1636('0x56')]=function(_0x17c43a,_0x2f1c31,_0x5abf9c){var _0x736aa2='server/files/images/logos';var _0x176a9f={'custom':![]};return utilLicense[_0x1636('0x57')]()[_0x1636('0x2f')](function(_0x1fc3e3){if(_0x1fc3e3){_0x176a9f=_0x1fc3e3;}return db[_0x1636('0x33')]['find']({'where':{'id':_0x17c43a[_0x1636('0x4c')]['id']},'attributes':[_0x1636('0x58'),'loginLogo',_0x1636('0x59'),_0x1636('0x5a'),'defaultLogo',_0x1636('0x5b'),_0x1636('0x5c'),_0x1636('0x5d')],'raw':!![]});})[_0x1636('0x2f')](handleEntityNotFound(_0x2f1c31,null))['then'](function(_0x215f06){if(_0x215f06){var _0x467435=_0x215f06['logo']&&fs[_0x1636('0x5e')](path[_0x1636('0x5f')](config['root'],_0x736aa2,_[_0x1636('0x60')](_0x215f06[_0x1636('0x58')])))?path[_0x1636('0x5f')](config['root'],_0x736aa2,_[_0x1636('0x60')](_0x215f06[_0x1636('0x58')])):path[_0x1636('0x5f')](config['root'],_0x736aa2,_[_0x1636('0x60')](_0x1636('0x61')));var _0x26d13a=_0x1636('0x62')+_['upperFirst'](_0x1636('0x58'));if(_0x215f06[_0x26d13a]||!_0x176a9f[_0x1636('0x63')]){_0x467435=path[_0x1636('0x5f')](config['root'],_0x736aa2,_[_0x1636('0x60')]('default_logo.svg'));}if(!fs['existsSync'](_0x467435)){throw new db[(_0x1636('0x64'))][(_0x1636('0x65'))](_[_0x1636('0x66')](_0x1636('0x58'))+'\x20not\x20found');}return _0x2f1c31[_0x1636('0x67')](_0x467435);}})[_0x1636('0x24')](handleError(_0x2f1c31,null));};var utilLicense=require(_0x1636('0x15'));exports[_0x1636('0x68')]=function(_0x3877de,_0x56c829,_0xb0aba1){var _0x3623df=_0x1636('0x69');var _0x24cde6={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x290799){if(_0x290799){_0x24cde6=_0x290799;}return db[_0x1636('0x33')][_0x1636('0x51')]({'where':{'id':_0x3877de[_0x1636('0x4c')]['id']},'attributes':[_0x1636('0x58'),_0x1636('0x55'),_0x1636('0x59'),_0x1636('0x5a'),_0x1636('0x6a'),_0x1636('0x5b'),_0x1636('0x5c'),_0x1636('0x5d')],'raw':!![]});})[_0x1636('0x2f')](handleEntityNotFound(_0x56c829,null))[_0x1636('0x2f')](function(_0x2dc471){if(_0x2dc471){var _0x2eea41=_0x2dc471[_0x1636('0x55')]&&fs[_0x1636('0x5e')](path[_0x1636('0x5f')](config[_0x1636('0x6b')],_0x3623df,_['toLower'](_0x2dc471['loginLogo'])))?path[_0x1636('0x5f')](config[_0x1636('0x6b')],_0x3623df,_[_0x1636('0x60')](_0x2dc471['loginLogo'])):path[_0x1636('0x5f')](config[_0x1636('0x6b')],_0x3623df,_[_0x1636('0x60')](_0x1636('0x6c')));var _0x283ce0=_0x1636('0x62')+_['upperFirst'](_0x1636('0x55'));if(_0x2dc471[_0x283ce0]||!_0x24cde6[_0x1636('0x63')]){_0x2eea41=path[_0x1636('0x5f')](config['root'],_0x3623df,_[_0x1636('0x60')]('default_loginLogo.svg'));}if(!fs[_0x1636('0x5e')](_0x2eea41)){throw new db[(_0x1636('0x64'))][(_0x1636('0x65'))](_[_0x1636('0x66')](_0x1636('0x55'))+'\x20not\x20found');}return _0x56c829[_0x1636('0x67')](_0x2eea41);}})['catch'](handleError(_0x56c829,null));};exports[_0x1636('0x6d')]=function(_0x86ba34,_0xbad0d6){return db['Setting'][_0x1636('0x51')]({'where':{'id':_0x86ba34[_0x1636('0x4c')]['id']},'attributes':[_0x1636('0x6e')]})[_0x1636('0x2f')](respondWithResult(_0xbad0d6,null))['catch'](handleError(_0xbad0d6,null));};exports[_0x1636('0x6f')]=function(_0x164e3b,_0x77eaa3,_0x1d99b5){if(_0x164e3b['file']&&_0x164e3b[_0x1636('0x52')][_0x1636('0x53')]){_0x164e3b['body'][_0x1636('0x59')]=_0x164e3b[_0x1636('0x52')][_0x1636('0x53')];}return db[_0x1636('0x33')][_0x1636('0x51')]({'where':{'id':_0x164e3b['params']['id']}})['then'](handleEntityNotFound(_0x77eaa3,null))[_0x1636('0x2f')](saveUpdates(_0x164e3b[_0x1636('0x50')],null))['then'](respondWithResult(_0x77eaa3,null))['catch'](handleError(_0x77eaa3,null));};var utilLicense=require(_0x1636('0x15'));exports[_0x1636('0x70')]=function(_0x3afa1f,_0x1ae210,_0x5b5248){var _0x47250a='server/files/images/logos';var _0x3d46f4={'custom':![]};return utilLicense[_0x1636('0x57')]()[_0x1636('0x2f')](function(_0x228765){if(_0x228765){_0x3d46f4=_0x228765;}return db['Setting'][_0x1636('0x51')]({'where':{'id':_0x3afa1f['params']['id']},'attributes':[_0x1636('0x58'),_0x1636('0x55'),_0x1636('0x59'),'favicon',_0x1636('0x6a'),_0x1636('0x5b'),'defaultPreferred',_0x1636('0x5d')],'raw':!![]});})[_0x1636('0x2f')](handleEntityNotFound(_0x1ae210,null))[_0x1636('0x2f')](function(_0x431ff0){if(_0x431ff0){var _0x13ce2e=_0x431ff0[_0x1636('0x59')]&&fs['existsSync'](path['join'](config[_0x1636('0x6b')],_0x47250a,_[_0x1636('0x60')](_0x431ff0[_0x1636('0x59')])))?path[_0x1636('0x5f')](config['root'],_0x47250a,_['toLower'](_0x431ff0[_0x1636('0x59')])):path[_0x1636('0x5f')](config[_0x1636('0x6b')],_0x47250a,_[_0x1636('0x60')]('default_preferred.png'));var _0xae7dc7=_0x1636('0x62')+_[_0x1636('0x66')](_0x1636('0x59'));if(_0x431ff0[_0xae7dc7]||!_0x3d46f4[_0x1636('0x63')]||!_0x3d46f4['preferred']){_0x13ce2e=path[_0x1636('0x5f')](config[_0x1636('0x6b')],_0x47250a,_[_0x1636('0x60')](_0x1636('0x71')));}if(!fs[_0x1636('0x5e')](_0x13ce2e)){throw new db[(_0x1636('0x64'))]['ValidationError'](_[_0x1636('0x66')](_0x1636('0x59'))+'\x20not\x20found');}return _0x1ae210[_0x1636('0x67')](_0x13ce2e);}})[_0x1636('0x24')](handleError(_0x1ae210,null));};exports[_0x1636('0x72')]=function(_0x5db155,_0x3275e6,_0x4edcb4){if(_0x5db155[_0x1636('0x52')]&&_0x5db155[_0x1636('0x52')][_0x1636('0x53')]){_0x5db155[_0x1636('0x50')][_0x1636('0x5a')]=_0x5db155[_0x1636('0x52')][_0x1636('0x53')];}return db['Setting'][_0x1636('0x51')]({'where':{'id':_0x5db155[_0x1636('0x4c')]['id']}})[_0x1636('0x2f')](handleEntityNotFound(_0x3275e6,null))[_0x1636('0x2f')](saveUpdates(_0x5db155[_0x1636('0x50')],null))[_0x1636('0x2f')](respondWithResult(_0x3275e6,null))[_0x1636('0x24')](handleError(_0x3275e6,null));};var utilLicense=require('../../config/license/util');exports[_0x1636('0x73')]=function(_0x156e4c,_0x52a586,_0x4ae546){var _0x87c73b='server/files/images/logos';var _0x4a40bf={'custom':![]};return utilLicense['getLicense']()[_0x1636('0x2f')](function(_0x4adfca){if(_0x4adfca){_0x4a40bf=_0x4adfca;}return db[_0x1636('0x33')][_0x1636('0x51')]({'where':{'id':_0x156e4c['params']['id']},'attributes':[_0x1636('0x58'),_0x1636('0x55'),_0x1636('0x59'),_0x1636('0x5a'),_0x1636('0x6a'),_0x1636('0x5b'),_0x1636('0x5c'),_0x1636('0x5d')],'raw':!![]});})[_0x1636('0x2f')](handleEntityNotFound(_0x52a586,null))[_0x1636('0x2f')](function(_0x224135){if(_0x224135){var _0x3cd641=_0x224135[_0x1636('0x5a')]&&fs[_0x1636('0x5e')](path[_0x1636('0x5f')](config[_0x1636('0x6b')],_0x87c73b,_[_0x1636('0x60')](_0x224135[_0x1636('0x5a')])))?path['join'](config[_0x1636('0x6b')],_0x87c73b,_[_0x1636('0x60')](_0x224135[_0x1636('0x5a')])):path[_0x1636('0x5f')](config['root'],_0x87c73b,_[_0x1636('0x60')](_0x1636('0x74')));var _0x58e608=_0x1636('0x62')+_[_0x1636('0x66')](_0x1636('0x5a'));if(_0x224135[_0x58e608]||!_0x4a40bf['custom']){_0x3cd641=path['join'](config['root'],_0x87c73b,_[_0x1636('0x60')](_0x1636('0x74')));}if(!fs['existsSync'](_0x3cd641)){throw new db[(_0x1636('0x64'))][(_0x1636('0x65'))](_[_0x1636('0x66')](_0x1636('0x5a'))+'\x20not\x20found');}return _0x52a586[_0x1636('0x67')](_0x3cd641);}})['catch'](handleError(_0x52a586,null));};exports[_0x1636('0x75')]=function(_0x171aa1,_0x165dec){var _0x4acd37={'offset':moment()[_0x1636('0x76')]()};_0x4acd37[_0x1636('0x77')]=moment()['utcOffset'](_0x4acd37[_0x1636('0x29')])[_0x1636('0x78')](_0x1636('0x79'));return _0x165dec['status'](0xc8)[_0x1636('0x7a')](_0x4acd37);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 2e514cf..468c340 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(_0x292f93,_0x2c6e8e){var _0x5a94b1=function(_0x25735e){while(--_0x25735e){_0x292f93['push'](_0x292f93['shift']());}};_0x5a94b1(++_0x2c6e8e);}(_0x55ca,0x126));var _0xa55c=function(_0x432b47,_0x24d3b7){_0x432b47=_0x432b47-0x0;var _0xb74e85=_0x55ca[_0x432b47];return _0xb74e85;};'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 _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0xb452c1,_0x5a289a){var _0x2af79d=function(_0x3a0ddc){while(--_0x3a0ddc){_0xb452c1['push'](_0xb452c1['shift']());}};_0x2af79d(++_0x5a289a);}(_0xe14b,0x93));var _0xbe14=function(_0x3922c1,_0x3992f1){_0x3922c1=_0x3922c1-0x0;var _0x48e08a=_0xe14b[_0x3922c1];return _0x48e08a;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 687699b..efe96d4 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 _0x6d2e=['result','Setting','find','options','include','model','attributes','map','then','ShowSetting','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5a6294,_0x2312b0){var _0x3e153f=function(_0xd8539){while(--_0xd8539){_0x5a6294['push'](_0x5a6294['shift']());}};_0x3e153f(++_0x2312b0);}(_0x6d2e,0x18a));var _0xe6d2=function(_0x5979e7,_0x2a8391){_0x5979e7=_0x5979e7-0x0;var _0x5b08be=_0x6d2e[_0x5979e7];return _0x5b08be;};'use strict';var _=require(_0xe6d2('0x0'));var util=require(_0xe6d2('0x1'));var moment=require(_0xe6d2('0x2'));var BPromise=require(_0xe6d2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe6d2('0x4'));var db=require(_0xe6d2('0x5'))['db'];var utils=require(_0xe6d2('0x6'));var logger=require(_0xe6d2('0x7'))(_0xe6d2('0x8'));var config=require('../../config/environment');var jayson=require(_0xe6d2('0x9'));var client=jayson[_0xe6d2('0xa')][_0xe6d2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dbd52,_0x438093,_0x56d52c){return new BPromise(function(_0x56c127,_0x2754d5){return client[_0xe6d2('0xc')](_0x5dbd52,_0x56d52c)['then'](function(_0x127503){logger[_0xe6d2('0xd')](_0xe6d2('0xe'),_0x438093,_0xe6d2('0xf'));logger[_0xe6d2('0x10')](_0xe6d2('0x11'),_0x438093,_0xe6d2('0xf'),JSON[_0xe6d2('0x12')](_0x127503));if(_0x127503[_0xe6d2('0x13')]){if(_0x127503[_0xe6d2('0x13')][_0xe6d2('0x14')]===0x1f4){logger[_0xe6d2('0x13')](_0xe6d2('0xe'),_0x438093,_0x127503['error'][_0xe6d2('0x15')]);return _0x2754d5(_0x127503[_0xe6d2('0x13')][_0xe6d2('0x15')]);}logger['error'](_0xe6d2('0xe'),_0x438093,_0x127503['error'][_0xe6d2('0x15')]);return _0x56c127(_0x127503[_0xe6d2('0x13')]['message']);}else{logger[_0xe6d2('0xd')](_0xe6d2('0xe'),_0x438093,_0xe6d2('0xf'));_0x56c127(_0x127503[_0xe6d2('0x16')][_0xe6d2('0x15')]);}})['catch'](function(_0x1123f9){logger['error'](_0xe6d2('0xe'),_0x438093,_0x1123f9);_0x2754d5(_0x1123f9);});});}exports['ShowSetting']=function(_0x2cbbca){var _0x23a96b=this;return new Promise(function(_0x1353f4,_0x1ec7e1){return db[_0xe6d2('0x17')][_0xe6d2('0x18')]({'raw':_0x2cbbca[_0xe6d2('0x19')]?_0x2cbbca[_0xe6d2('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2cbbca[_0xe6d2('0x19')]?_0x2cbbca[_0xe6d2('0x19')]['where']||null:null,'attributes':_0x2cbbca[_0xe6d2('0x19')]?_0x2cbbca['options']['attributes']||null:null,'include':_0x2cbbca[_0xe6d2('0x19')]?_0x2cbbca['options'][_0xe6d2('0x1a')]?_['map'](_0x2cbbca[_0xe6d2('0x19')][_0xe6d2('0x1a')],function(_0x5e8659){return{'model':db[_0x5e8659[_0xe6d2('0x1b')]],'as':_0x5e8659['as'],'attributes':_0x5e8659[_0xe6d2('0x1c')],'include':_0x5e8659['include']?_[_0xe6d2('0x1d')](_0x5e8659[_0xe6d2('0x1a')],function(_0x4d8f75){return{'model':db[_0x4d8f75[_0xe6d2('0x1b')]],'as':_0x4d8f75['as'],'attributes':_0x4d8f75[_0xe6d2('0x1c')],'include':_0x4d8f75[_0xe6d2('0x1a')]?_[_0xe6d2('0x1d')](_0x4d8f75[_0xe6d2('0x1a')],function(_0x4f1e5d){return{'model':db[_0x4f1e5d['model']],'as':_0x4f1e5d['as'],'attributes':_0x4f1e5d[_0xe6d2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe6d2('0x1e')](function(_0x16b878){logger[_0xe6d2('0xd')](_0xe6d2('0x1f'),_0x2cbbca);logger[_0xe6d2('0x10')](_0xe6d2('0x1f'),_0x2cbbca,JSON[_0xe6d2('0x12')](_0x16b878));_0x1353f4(_0x16b878);})['catch'](function(_0x18b464){logger[_0xe6d2('0x13')](_0xe6d2('0x1f'),_0x18b464['message'],_0x2cbbca);_0x1ec7e1(_0x23a96b[_0xe6d2('0x13')](0x1f4,_0x18b464[_0xe6d2('0x15')]));});});}; \ No newline at end of file +var _0xdd28=['raw','options','include','model','attributes','map','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','ShowSetting','find'];(function(_0x2a2fa2,_0x549c2b){var _0x3eff7b=function(_0x276dbb){while(--_0x276dbb){_0x2a2fa2['push'](_0x2a2fa2['shift']());}};_0x3eff7b(++_0x549c2b);}(_0xdd28,0x14a));var _0x8dd2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd28[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8dd2('0x0'));var util=require(_0x8dd2('0x1'));var moment=require(_0x8dd2('0x2'));var BPromise=require('bluebird');var rs=require(_0x8dd2('0x3'));var fs=require('fs');var Redis=require(_0x8dd2('0x4'));var db=require(_0x8dd2('0x5'))['db'];var utils=require(_0x8dd2('0x6'));var logger=require('../../config/logger')(_0x8dd2('0x7'));var config=require(_0x8dd2('0x8'));var jayson=require(_0x8dd2('0x9'));var client=jayson[_0x8dd2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e8961,_0x5421f1,_0x10173d){return new BPromise(function(_0x2a64c3,_0x241898){return client[_0x8dd2('0xb')](_0x2e8961,_0x10173d)[_0x8dd2('0xc')](function(_0x2e7bd5){logger['info'](_0x8dd2('0xd'),_0x5421f1,_0x8dd2('0xe'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x5421f1,'request\x20sent',JSON[_0x8dd2('0xf')](_0x2e7bd5));if(_0x2e7bd5[_0x8dd2('0x10')]){if(_0x2e7bd5[_0x8dd2('0x10')]['code']===0x1f4){logger[_0x8dd2('0x10')](_0x8dd2('0xd'),_0x5421f1,_0x2e7bd5[_0x8dd2('0x10')][_0x8dd2('0x11')]);return _0x241898(_0x2e7bd5[_0x8dd2('0x10')]['message']);}logger['error'](_0x8dd2('0xd'),_0x5421f1,_0x2e7bd5['error'][_0x8dd2('0x11')]);return _0x2a64c3(_0x2e7bd5[_0x8dd2('0x10')]['message']);}else{logger[_0x8dd2('0x12')]('Setting,\x20%s,\x20%s',_0x5421f1,_0x8dd2('0xe'));_0x2a64c3(_0x2e7bd5['result'][_0x8dd2('0x11')]);}})['catch'](function(_0x2cadc0){logger['error']('Setting,\x20%s,\x20%s',_0x5421f1,_0x2cadc0);_0x241898(_0x2cadc0);});});}exports[_0x8dd2('0x13')]=function(_0x94aa69){var _0x3fc196=this;return new Promise(function(_0x465807,_0x52ab44){return db['Setting'][_0x8dd2('0x14')]({'raw':_0x94aa69['options']?_0x94aa69['options'][_0x8dd2('0x15')]===undefined?!![]:![]:!![],'where':_0x94aa69[_0x8dd2('0x16')]?_0x94aa69['options']['where']||null:null,'attributes':_0x94aa69[_0x8dd2('0x16')]?_0x94aa69['options']['attributes']||null:null,'include':_0x94aa69[_0x8dd2('0x16')]?_0x94aa69[_0x8dd2('0x16')][_0x8dd2('0x17')]?_['map'](_0x94aa69[_0x8dd2('0x16')][_0x8dd2('0x17')],function(_0x2a2170){return{'model':db[_0x2a2170[_0x8dd2('0x18')]],'as':_0x2a2170['as'],'attributes':_0x2a2170[_0x8dd2('0x19')],'include':_0x2a2170[_0x8dd2('0x17')]?_[_0x8dd2('0x1a')](_0x2a2170[_0x8dd2('0x17')],function(_0x29e467){return{'model':db[_0x29e467[_0x8dd2('0x18')]],'as':_0x29e467['as'],'attributes':_0x29e467['attributes'],'include':_0x29e467[_0x8dd2('0x17')]?_['map'](_0x29e467[_0x8dd2('0x17')],function(_0x1e0767){return{'model':db[_0x1e0767['model']],'as':_0x1e0767['as'],'attributes':_0x1e0767[_0x8dd2('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8dd2('0xc')](function(_0xfbb7d9){logger[_0x8dd2('0x12')](_0x8dd2('0x13'),_0x94aa69);logger['debug'](_0x8dd2('0x13'),_0x94aa69,JSON['stringify'](_0xfbb7d9));_0x465807(_0xfbb7d9);})['catch'](function(_0x815aeb){logger['error'](_0x8dd2('0x13'),_0x815aeb[_0x8dd2('0x11')],_0x94aa69);_0x52ab44(_0x3fc196['error'](0x1f4,_0x815aeb[_0x8dd2('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 740eafb..d19a2a4 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x5267c4,_0x4cbeb3){var _0x2fa640=function(_0x136d80){while(--_0x136d80){_0x5267c4['push'](_0x5267c4['shift']());}};_0x2fa640(++_0x4cbeb3);}(_0x7a54,0x106));var _0x47a5=function(_0x58a6e0,_0x1648b5){_0x58a6e0=_0x58a6e0-0x0;var _0x90cca0=_0x7a54[_0x58a6e0];return _0x90cca0;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file +var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x25f3e3,_0x207891){var _0xa89b6d=function(_0xa51f2){while(--_0xa51f2){_0x25f3e3['push'](_0x25f3e3['shift']());}};_0xa89b6d(++_0x207891);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 752c67b..62cb409 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 _0x9d0a=['generate','ENUM','twilio','skebby','plivo','clickatell','bandwidth','infobip','intelepeer','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','setDataValue','mandatoryDisposition','sequelize','STRING','name'];(function(_0x243530,_0x21dede){var _0x2fe74e=function(_0x3fcd51){while(--_0x3fcd51){_0x243530['push'](_0x243530['shift']());}};_0x2fe74e(++_0x21dede);}(_0x9d0a,0xa8));var _0xa9d0=function(_0x2e1af3,_0x2a077b){_0x2e1af3=_0x2e1af3-0x0;var _0x4150cd=_0x9d0a[_0x2e1af3];return _0x4150cd;};'use strict';var Sequelize=require(_0xa9d0('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xa9d0('0x1')],'unique':_0xa9d0('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xa9d0('0x1')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xa9d0('0x1')],'defaultValue':function(){return rs[_0xa9d0('0x3')]();}},'phone':{'type':Sequelize[_0xa9d0('0x1')]},'type':{'type':Sequelize[_0xa9d0('0x4')](_0xa9d0('0x5'),_0xa9d0('0x6'),'connectel','clicksend',_0xa9d0('0x7'),_0xa9d0('0x8'),_0xa9d0('0x9'),'csc',_0xa9d0('0xa'),_0xa9d0('0xb'))},'accountSid':{'type':Sequelize[_0xa9d0('0x1')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xa9d0('0x1')]},'password':{'type':Sequelize[_0xa9d0('0x1')]},'apiKey':{'type':Sequelize[_0xa9d0('0x1')]},'applicationId':{'type':Sequelize[_0xa9d0('0x1')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xa9d0('0x1')]},'deliveryReport':{'type':Sequelize[_0xa9d0('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0xa9d0('0x1')]},'notificationTemplate':{'type':Sequelize[_0xa9d0('0xd')],'defaultValue':function(){return _0xa9d0('0xe');}},'notificationSound':{'type':Sequelize[_0xa9d0('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa9d0('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa9d0('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa9d0('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa9d0('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa9d0('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xa9d0('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa9d0('0xf')],'comment':_0xa9d0('0x10')},'mandatoryDisposition':{'type':Sequelize[_0xa9d0('0xc')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3d4103){if(!_0x3d4103)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xa9d0('0x11')](_0xa9d0('0x12'),_0x3d4103);}}}; \ No newline at end of file +var _0x1573=['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','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM','twilio','skebby','connectel','clicksend','clickatell','bandwidth','infobip','intelepeer','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1573,0x7b));var _0x3157=function(_0x6bb814,_0x17196b){_0x6bb814=_0x6bb814-0x0;var _0x3c4bf6=_0x1573[_0x6bb814];return _0x3c4bf6;};'use strict';var Sequelize=require(_0x3157('0x0'));var rs=require(_0x3157('0x1'));module[_0x3157('0x2')]={'name':{'type':Sequelize[_0x3157('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x3157('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x3157('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x3157('0x3')],'defaultValue':function(){return rs[_0x3157('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3157('0x5')](_0x3157('0x6'),_0x3157('0x7'),_0x3157('0x8'),_0x3157('0x9'),'plivo',_0x3157('0xa'),_0x3157('0xb'),'csc',_0x3157('0xc'),_0x3157('0xd'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x3157('0x3')]},'authToken':{'type':Sequelize[_0x3157('0x3')]},'smsMethod':{'type':Sequelize[_0x3157('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x3157('0x3')]},'password':{'type':Sequelize[_0x3157('0x3')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x3157('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x3157('0x3')]},'deliveryReport':{'type':Sequelize[_0x3157('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x3157('0x3')]},'notificationTemplate':{'type':Sequelize[_0x3157('0xf')],'defaultValue':function(){return _0x3157('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3157('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x3157('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3157('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3157('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3157('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3157('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x3157('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3157('0x11')],'comment':_0x3157('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x3157('0xe')],'defaultValue':![],'comment':_0x3157('0x13'),'set':function(_0x39b285){if(!_0x39b285)this[_0x3157('0x14')](_0x3157('0x15'),null);this[_0x3157('0x14')](_0x3157('0x16'),_0x39b285);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index f5319fe..6e00e8d 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 _0x098e=['DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','intelepeer','DELIVRD','ACCEPTD','statusGet','state','message-id','addAgents','emit','userSmsAccount:save','removeAgents','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','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','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','SmsAccount','fieldName','type','model','map','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','mandatoryDispositionPause','rawAttributes','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','order','removeAnswers','SmsApplication','Applications','account','orderBy','priority','CmContact','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','From','messageId','skebby','text','connectel','clicksend','message_id','Text','MessageUUID','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','bandwidth','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','ValidationError','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','omit','Contacts','contact','spread','interaction','created','autoclose','applications','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','waitForTheAssignedQueue','startRouting','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','sequelize','transaction','ISOLATION_LEVELS','bulkCreate','finally','getApplications','getInteractions','findOne','SmsInteraction','Contact','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','user','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','infobip','groupName'];(function(_0x5bbc71,_0x154d40){var _0x3fd157=function(_0x4d6fcb){while(--_0x4d6fcb){_0x5bbc71['push'](_0x5bbc71['shift']());}};_0x3fd157(++_0x154d40);}(_0x098e,0xf7));var _0xe098=function(_0x5da21d,_0x1d8d3a){_0x5da21d=_0x5da21d-0x0;var _0x41dac=_0x098e[_0x5da21d];return _0x41dac;};'use strict';var emlformat=require(_0xe098('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe098('0x1'));var jsonpatch=require(_0xe098('0x2'));var rp=require(_0xe098('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe098('0x4'));var util=require(_0xe098('0x5'));var path=require('path');var sox=require(_0xe098('0x6'));var csv=require('to-csv');var ejs=require(_0xe098('0x7'));var fs=require('fs');var fs_extra=require(_0xe098('0x8'));var _=require(_0xe098('0x9'));var squel=require(_0xe098('0xa'));var crypto=require(_0xe098('0xb'));var jsforce=require(_0xe098('0xc'));var deskjs=require(_0xe098('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe098('0xe'));var Redis=require(_0xe098('0xf'));var authService=require(_0xe098('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe098('0x11'));var hardwareService=require(_0xe098('0x12'));var logger=require(_0xe098('0x13'))('api');var utils=require(_0xe098('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe098('0x15'))['db'];config[_0xe098('0x16')]=_[_0xe098('0x17')](config[_0xe098('0x16')],{'host':_0xe098('0x18'),'port':0x18eb});var socket=require(_0xe098('0x19'))(new Redis(config[_0xe098('0x16')]));require(_0xe098('0x1a'))[_0xe098('0x1b')](socket);var jayson=require(_0xe098('0x1c'));var client=jayson[_0xe098('0x1d')][_0xe098('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x2cc3d0,_0x597954,_0x3a32c3,_0x3e222c){return new BPromise(function(_0x3d3643,_0x15a683){var _0x58bc3d=_0x3e222c||client;return _0x58bc3d['request'](_0x2cc3d0,_0x3a32c3)[_0xe098('0x1f')](function(_0x198ee8){logger[_0xe098('0x20')](_0xe098('0x21'),_0x597954,_0xe098('0x22'));logger[_0xe098('0x23')](_0xe098('0x24'),_0x597954,'request\x20sent',JSON[_0xe098('0x25')](_0x198ee8));if(_0x198ee8[_0xe098('0x26')]){if(_0x198ee8['error'][_0xe098('0x27')]===0x1f4){logger[_0xe098('0x26')](_0xe098('0x21'),_0x597954,_0x198ee8[_0xe098('0x26')][_0xe098('0x28')]);return _0x15a683(_0x198ee8[_0xe098('0x26')][_0xe098('0x28')]);}logger[_0xe098('0x26')](_0xe098('0x21'),_0x597954,_0x198ee8[_0xe098('0x26')]['message']);return _0x3d3643(_0x198ee8[_0xe098('0x26')][_0xe098('0x28')]);}else{logger[_0xe098('0x20')](_0xe098('0x21'),_0x597954,_0xe098('0x22'));_0x3d3643(_0x198ee8[_0xe098('0x29')]['message']);}})[_0xe098('0x2a')](function(_0x5afa97){logger[_0xe098('0x26')]('SmsAccount,\x20%s,\x20%s',_0x597954,_0x5afa97);_0x15a683(_0x5afa97);});});}function respondWithStatusCode(_0x499ff8,_0x7de6f7){_0x7de6f7=_0x7de6f7||0xcc;return function(_0x4ef4c0){if(_0x4ef4c0){return _0x499ff8[_0xe098('0x2b')](_0x7de6f7);}return _0x499ff8[_0xe098('0x2c')](_0x7de6f7)[_0xe098('0x2d')]();};}function respondWithResult(_0x48c922,_0x13641c){_0x13641c=_0x13641c||0xc8;return function(_0x12554a){if(_0x12554a){return _0x48c922[_0xe098('0x2c')](_0x13641c)[_0xe098('0x2e')](_0x12554a);}};}function respondWithFilteredResult(_0x41590f,_0x3d0dc9){return function(_0x5205b1){if(_0x5205b1){var _0xaa3ffe=typeof _0x3d0dc9['offset']===_0xe098('0x2f')&&typeof _0x3d0dc9[_0xe098('0x30')]===_0xe098('0x2f');var _0xe13f01=_0x5205b1[_0xe098('0x31')];var _0x5b099f=_0xaa3ffe?0x0:_0x3d0dc9[_0xe098('0x32')];var _0x128c7c=_0xaa3ffe?_0x5205b1[_0xe098('0x31')]:_0x3d0dc9[_0xe098('0x32')]+_0x3d0dc9[_0xe098('0x30')];var _0x165a9c;if(_0x128c7c>=_0xe13f01){_0x128c7c=_0xe13f01;_0x165a9c=0xc8;}else{_0x165a9c=0xce;}_0x41590f[_0xe098('0x2c')](_0x165a9c);return _0x41590f[_0xe098('0x33')](_0xe098('0x34'),_0x5b099f+'-'+_0x128c7c+'/'+_0xe13f01)[_0xe098('0x2e')](_0x5205b1);}return null;};}function patchUpdates(_0x413f10){return function(_0x27b4dd){try{jsonpatch[_0xe098('0x35')](_0x27b4dd,_0x413f10,!![]);}catch(_0x29f192){return BPromise[_0xe098('0x36')](_0x29f192);}return _0x27b4dd['save']();};}function saveUpdates(_0x1df7b8,_0x3beff4){return function(_0x490918){if(_0x490918){return _0x490918[_0xe098('0x37')](_0x1df7b8)[_0xe098('0x1f')](function(_0x1b3b66){return _0x1b3b66;});}return null;};}function removeEntity(_0x2f1ccd,_0x2e7652){return function(_0x2a5db8){if(_0x2a5db8){return _0x2a5db8[_0xe098('0x38')]()['then'](function(){var _0x3c8e85=_0x2a5db8[_0xe098('0x39')]({'plain':!![]});var _0x545866='SmsAccounts';return db[_0xe098('0x3a')][_0xe098('0x38')]({'where':{'type':_0x545866,'resourceId':_0x3c8e85['id']}})['then'](function(){return _0x2a5db8;});})[_0xe098('0x1f')](function(){_0x2f1ccd[_0xe098('0x2c')](0xcc)[_0xe098('0x2d')]();});}};}function handleEntityNotFound(_0x1de555,_0x50e085){return function(_0x5a3fec){if(!_0x5a3fec){_0x1de555[_0xe098('0x2b')](0x194);}return _0x5a3fec;};}function handleError(_0x2280d9,_0x490ef9){_0x490ef9=_0x490ef9||0x1f4;return function(_0x3c133d){logger[_0xe098('0x26')](_0x3c133d[_0xe098('0x3b')]);if(_0x3c133d[_0xe098('0x3c')]){delete _0x3c133d[_0xe098('0x3c')];}_0x2280d9['status'](_0x490ef9)[_0xe098('0x3d')](_0x3c133d);};}exports[_0xe098('0x3e')]=function(_0x38e9fc,_0x1333f5){var _0x3441af={'include':[{'model':db[_0xe098('0x3f')],'as':'mandatoryDispositionPause'}]},_0xc52d={},_0x2a87f7={'count':0x0,'rows':[]};var _0x247930=_['map'](db[_0xe098('0x40')]['rawAttributes'],function(_0x5823fd){return{'name':_0x5823fd[_0xe098('0x41')],'type':_0x5823fd[_0xe098('0x42')]['key']};});_0xc52d[_0xe098('0x43')]=_[_0xe098('0x44')](_0x247930,_0xe098('0x3c'));_0xc52d['query']=_[_0xe098('0x45')](_0x38e9fc['query']);_0xc52d['filters']=_['intersection'](_0xc52d[_0xe098('0x43')],_0xc52d[_0xe098('0x46')]);_0x3441af[_0xe098('0x47')]=_[_0xe098('0x48')](_0xc52d['model'],qs[_0xe098('0x49')](_0x38e9fc[_0xe098('0x46')][_0xe098('0x49')]));_0x3441af[_0xe098('0x47')]=_0x3441af['attributes'][_0xe098('0x4a')]?_0x3441af['attributes']:_0xc52d['model'];if(!_0x38e9fc[_0xe098('0x46')][_0xe098('0x4b')](_0xe098('0x4c'))){_0x3441af[_0xe098('0x30')]=qs[_0xe098('0x30')](_0x38e9fc[_0xe098('0x46')][_0xe098('0x30')]);_0x3441af[_0xe098('0x32')]=qs[_0xe098('0x32')](_0x38e9fc[_0xe098('0x46')][_0xe098('0x32')]);}_0x3441af['order']=qs[_0xe098('0x4d')](_0x38e9fc[_0xe098('0x46')]['sort']);_0x3441af[_0xe098('0x4e')]=qs[_0xe098('0x4f')](_[_0xe098('0x50')](_0x38e9fc['query'],_0xc52d[_0xe098('0x4f')]),_0x247930);if(_0x38e9fc[_0xe098('0x46')][_0xe098('0x51')]){_0x3441af[_0xe098('0x4e')]=_[_0xe098('0x52')](_0x3441af[_0xe098('0x4e')],{'$or':_[_0xe098('0x44')](_0x247930,function(_0x53e49b){if(_0x53e49b[_0xe098('0x42')]!==_0xe098('0x53')){var _0x38483a={};_0x38483a[_0x53e49b[_0xe098('0x3c')]]={'$like':'%'+_0x38e9fc['query'][_0xe098('0x51')]+'%'};return _0x38483a;}})});}_0x3441af=_[_0xe098('0x52')]({},_0x3441af,_0x38e9fc[_0xe098('0x54')]);var _0x4e1219={'where':_0x3441af['where']};return db[_0xe098('0x40')]['count'](_0x4e1219)[_0xe098('0x1f')](function(_0x4799b7){_0x2a87f7['count']=_0x4799b7;if(_0x38e9fc[_0xe098('0x46')][_0xe098('0x55')]){_0x3441af['include']=[{'all':!![]}];}return db['SmsAccount'][_0xe098('0x56')](_0x3441af);})[_0xe098('0x1f')](function(_0x42d974){_0x2a87f7[_0xe098('0x57')]=_0x42d974;return _0x2a87f7;})[_0xe098('0x1f')](respondWithFilteredResult(_0x1333f5,_0x3441af))[_0xe098('0x2a')](handleError(_0x1333f5,null));};exports[_0xe098('0x58')]=function(_0x904f66,_0x289f52){var _0x8d6398={'raw':![],'where':{'id':_0x904f66[_0xe098('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0xe098('0x5a')}]},_0x3bd67d={};_0x3bd67d[_0xe098('0x43')]=_[_0xe098('0x45')](db[_0xe098('0x40')][_0xe098('0x5b')]);_0x3bd67d[_0xe098('0x46')]=_['keys'](_0x904f66[_0xe098('0x46')]);_0x3bd67d[_0xe098('0x4f')]=_[_0xe098('0x48')](_0x3bd67d[_0xe098('0x43')],_0x3bd67d['query']);_0x8d6398[_0xe098('0x47')]=_['intersection'](_0x3bd67d['model'],qs['fields'](_0x904f66[_0xe098('0x46')]['fields']));_0x8d6398[_0xe098('0x47')]=_0x8d6398[_0xe098('0x47')][_0xe098('0x4a')]?_0x8d6398[_0xe098('0x47')]:_0x3bd67d[_0xe098('0x43')];if(_0x904f66[_0xe098('0x46')][_0xe098('0x55')]){_0x8d6398[_0xe098('0x5c')]=[{'all':!![]}];}_0x8d6398=_[_0xe098('0x52')]({},_0x8d6398,_0x904f66['options']);return db[_0xe098('0x40')][_0xe098('0x5d')](_0x8d6398)['then'](handleEntityNotFound(_0x289f52,null))['then'](respondWithResult(_0x289f52,null))['catch'](handleError(_0x289f52,null));};exports[_0xe098('0x5e')]=function(_0x2627c9,_0x187658){return db[_0xe098('0x40')][_0xe098('0x5e')](_0x2627c9[_0xe098('0x5f')],{})['then'](function(_0x1681bf){var _0x9454dc=_0x2627c9['user']['get']({'plain':!![]});if(!_0x9454dc)throw new Error(_0xe098('0x60'));if(_0x9454dc[_0xe098('0x61')]==='user'){var _0x45edc3=_0x1681bf[_0xe098('0x39')]({'plain':!![]});var _0x5d85e8='SmsAccounts';return db[_0xe098('0x62')]['find']({'where':{'name':_0x5d85e8,'userProfileId':_0x9454dc[_0xe098('0x63')]},'raw':!![]})['then'](function(_0x101bf9){if(_0x101bf9&&_0x101bf9[_0xe098('0x64')]===0x0){return db[_0xe098('0x3a')][_0xe098('0x5e')]({'name':_0x45edc3[_0xe098('0x3c')],'resourceId':_0x45edc3['id'],'type':_0x101bf9[_0xe098('0x3c')],'sectionId':_0x101bf9['id']},{})[_0xe098('0x1f')](function(){return _0x1681bf;});}else{return _0x1681bf;}})[_0xe098('0x2a')](function(_0x44c09e){logger[_0xe098('0x26')](_0xe098('0x65'),_0x44c09e);throw _0x44c09e;});}return _0x1681bf;})[_0xe098('0x1f')](respondWithResult(_0x187658,0xc9))[_0xe098('0x2a')](handleError(_0x187658,null));};exports[_0xe098('0x37')]=function(_0x53f6aa,_0x227a3c){if(_0x53f6aa[_0xe098('0x5f')]['id']){delete _0x53f6aa['body']['id'];}return db[_0xe098('0x40')]['find']({'where':{'id':_0x53f6aa[_0xe098('0x59')]['id']},'include':[{'model':db[_0xe098('0x3f')],'as':_0xe098('0x5a')}]})[_0xe098('0x1f')](handleEntityNotFound(_0x227a3c,null))[_0xe098('0x1f')](saveUpdates(_0x53f6aa[_0xe098('0x5f')],null))[_0xe098('0x1f')](respondWithResult(_0x227a3c,null))['catch'](handleError(_0x227a3c,null));};exports['destroy']=function(_0x557e9b,_0x4213d8){return db[_0xe098('0x40')][_0xe098('0x5d')]({'where':{'id':_0x557e9b['params']['id']}})[_0xe098('0x1f')](handleEntityNotFound(_0x4213d8,null))[_0xe098('0x1f')](removeEntity(_0x4213d8,null))[_0xe098('0x2a')](handleError(_0x4213d8,null));};exports[_0xe098('0x66')]=function(_0x35c007,_0x3575e7){return db[_0xe098('0x40')]['describe']()[_0xe098('0x1f')](respondWithResult(_0x3575e7,null))[_0xe098('0x2a')](handleError(_0x3575e7,null));};exports[_0xe098('0x67')]=function(_0x13cbdc,_0x2a33c6,_0x2efd9c){if(_0x13cbdc['body']['id']){delete _0x13cbdc['body']['id'];}return db[_0xe098('0x40')][_0xe098('0x5d')]({'where':{'id':_0x13cbdc[_0xe098('0x59')]['id']}})[_0xe098('0x1f')](handleEntityNotFound(_0x2a33c6,null))['then'](function(_0x3f49af){if(_0x3f49af){_0x13cbdc['body'][_0xe098('0x68')]=_0x3f49af['id'];return db[_0xe098('0x69')][_0xe098('0x5e')](_0x13cbdc[_0xe098('0x5f')]);}})['then'](respondWithResult(_0x2a33c6,null))[_0xe098('0x2a')](handleError(_0x2a33c6,null));};exports[_0xe098('0x6a')]=function(_0xdf1b19,_0x44e42a,_0x18b549){var _0x44c680={'raw':![],'where':{}};var _0x1cf077={};var _0x5520b3={'count':0x0,'rows':[]};return db[_0xe098('0x40')]['findOne']({'where':{'id':_0xdf1b19['params']['id']}})['then'](handleEntityNotFound(_0x44e42a,null))['then'](function(_0x47821e){if(_0x47821e){_0x1cf077[_0xe098('0x43')]=_['keys'](db[_0xe098('0x69')][_0xe098('0x5b')]);_0x1cf077['query']=_[_0xe098('0x45')](_0xdf1b19[_0xe098('0x46')]);_0x1cf077[_0xe098('0x4f')]=_[_0xe098('0x48')](_0x1cf077['model'],_0x1cf077[_0xe098('0x46')]);_0x44c680[_0xe098('0x47')]=_[_0xe098('0x48')](_0x1cf077[_0xe098('0x43')],qs['fields'](_0xdf1b19[_0xe098('0x46')][_0xe098('0x49')]));_0x44c680[_0xe098('0x47')]=_0x44c680[_0xe098('0x47')]['length']?_0x44c680[_0xe098('0x47')]:_0x1cf077['model'];if(!_0xdf1b19[_0xe098('0x46')]['hasOwnProperty'](_0xe098('0x4c'))){_0x44c680[_0xe098('0x30')]=qs[_0xe098('0x30')](_0xdf1b19[_0xe098('0x46')][_0xe098('0x30')]);_0x44c680[_0xe098('0x32')]=qs[_0xe098('0x32')](_0xdf1b19[_0xe098('0x46')][_0xe098('0x32')]);}_0x44c680['order']=qs[_0xe098('0x4d')](_0xdf1b19['query'][_0xe098('0x4d')]);_0x44c680[_0xe098('0x4e')]=qs[_0xe098('0x4f')](_[_0xe098('0x50')](_0xdf1b19[_0xe098('0x46')],_0x1cf077['filters']));_0x44c680[_0xe098('0x4e')]['SmsAccountId']=_0x47821e['id'];if(_0xdf1b19['query']['filter']){_0x44c680[_0xe098('0x4e')]=_[_0xe098('0x52')](_0x44c680['where'],{'$or':_['map'](_0x44c680[_0xe098('0x47')],function(_0x413bf3){var _0x4ecbcc={};_0x4ecbcc[_0x413bf3]={'$like':'%'+_0xdf1b19['query']['filter']+'%'};return _0x4ecbcc;})});}_0x44c680=_[_0xe098('0x52')]({},_0x44c680,_0xdf1b19[_0xe098('0x54')]);return db[_0xe098('0x69')][_0xe098('0x31')]({'where':_0x44c680[_0xe098('0x4e')]})[_0xe098('0x1f')](function(_0x19277c){_0x5520b3[_0xe098('0x31')]=_0x19277c;if(_0xdf1b19[_0xe098('0x46')][_0xe098('0x55')]){_0x44c680['include']=[{'all':!![]}];}return db[_0xe098('0x69')][_0xe098('0x56')](_0x44c680);})[_0xe098('0x1f')](function(_0x4016b0){_0x5520b3[_0xe098('0x57')]=_0x4016b0;return _0x5520b3;});}})[_0xe098('0x1f')](respondWithFilteredResult(_0x44e42a,_0x44c680))[_0xe098('0x2a')](handleError(_0x44e42a,null));};exports['removeDispositions']=function(_0x357444,_0x2f9a9a,_0x33322a){return db[_0xe098('0x40')]['find']({'where':{'id':_0x357444[_0xe098('0x59')]['id']}})[_0xe098('0x1f')](handleEntityNotFound(_0x2f9a9a,null))['then'](function(_0x284b79){if(_0x284b79){return _0x284b79[_0xe098('0x6b')](_0x357444[_0xe098('0x46')][_0xe098('0x6c')]);}})['then'](respondWithStatusCode(_0x2f9a9a,null))['catch'](handleError(_0x2f9a9a,null));};exports[_0xe098('0x6d')]=function(_0x8d462a,_0x220fb2,_0x294f2e){if(_0x8d462a['body']['id']){delete _0x8d462a[_0xe098('0x5f')]['id'];}return db['SmsAccount'][_0xe098('0x5d')]({'where':{'id':_0x8d462a['params']['id']}})[_0xe098('0x1f')](handleEntityNotFound(_0x220fb2,null))[_0xe098('0x1f')](function(_0x570ed0){if(_0x570ed0){_0x8d462a[_0xe098('0x5f')][_0xe098('0x68')]=_0x570ed0['id'];return db['CannedAnswer']['create'](_0x8d462a[_0xe098('0x5f')]);}})[_0xe098('0x1f')](respondWithResult(_0x220fb2,null))[_0xe098('0x2a')](handleError(_0x220fb2,null));};exports['getAnswers']=function(_0x371b91,_0x1019ac,_0x1e69ad){var _0x22a1ed={'raw':![],'where':{}};var _0x4eb3c0={};var _0x578824={'count':0x0,'rows':[]};return db[_0xe098('0x40')]['findOne']({'where':{'id':_0x371b91[_0xe098('0x59')]['id']}})[_0xe098('0x1f')](handleEntityNotFound(_0x1019ac,null))[_0xe098('0x1f')](function(_0x7273db){if(_0x7273db){_0x4eb3c0[_0xe098('0x43')]=_[_0xe098('0x45')](db[_0xe098('0x6e')][_0xe098('0x5b')]);_0x4eb3c0[_0xe098('0x46')]=_[_0xe098('0x45')](_0x371b91[_0xe098('0x46')]);_0x4eb3c0[_0xe098('0x4f')]=_['intersection'](_0x4eb3c0[_0xe098('0x43')],_0x4eb3c0['query']);_0x22a1ed[_0xe098('0x47')]=_['intersection'](_0x4eb3c0[_0xe098('0x43')],qs['fields'](_0x371b91[_0xe098('0x46')][_0xe098('0x49')]));_0x22a1ed[_0xe098('0x47')]=_0x22a1ed[_0xe098('0x47')][_0xe098('0x4a')]?_0x22a1ed['attributes']:_0x4eb3c0[_0xe098('0x43')];if(!_0x371b91[_0xe098('0x46')][_0xe098('0x4b')](_0xe098('0x4c'))){_0x22a1ed[_0xe098('0x30')]=qs[_0xe098('0x30')](_0x371b91[_0xe098('0x46')][_0xe098('0x30')]);_0x22a1ed['offset']=qs['offset'](_0x371b91['query'][_0xe098('0x32')]);}_0x22a1ed[_0xe098('0x6f')]=qs[_0xe098('0x4d')](_0x371b91['query'][_0xe098('0x4d')]);_0x22a1ed[_0xe098('0x4e')]=qs[_0xe098('0x4f')](_[_0xe098('0x50')](_0x371b91[_0xe098('0x46')],_0x4eb3c0[_0xe098('0x4f')]));_0x22a1ed['where'][_0xe098('0x68')]=_0x7273db['id'];if(_0x371b91[_0xe098('0x46')][_0xe098('0x51')]){_0x22a1ed[_0xe098('0x4e')]=_[_0xe098('0x52')](_0x22a1ed['where'],{'$or':_['map'](_0x22a1ed[_0xe098('0x47')],function(_0x240433){var _0x354ae9={};_0x354ae9[_0x240433]={'$like':'%'+_0x371b91[_0xe098('0x46')][_0xe098('0x51')]+'%'};return _0x354ae9;})});}_0x22a1ed=_[_0xe098('0x52')]({},_0x22a1ed,_0x371b91[_0xe098('0x54')]);return db[_0xe098('0x6e')][_0xe098('0x31')]({'where':_0x22a1ed['where']})[_0xe098('0x1f')](function(_0xe334f9){_0x578824[_0xe098('0x31')]=_0xe334f9;if(_0x371b91[_0xe098('0x46')][_0xe098('0x55')]){_0x22a1ed['include']=[{'all':!![]}];}return db[_0xe098('0x6e')][_0xe098('0x56')](_0x22a1ed);})[_0xe098('0x1f')](function(_0x1d6e36){_0x578824[_0xe098('0x57')]=_0x1d6e36;return _0x578824;});}})['then'](respondWithFilteredResult(_0x1019ac,_0x22a1ed))[_0xe098('0x2a')](handleError(_0x1019ac,null));};exports['removeAnswers']=function(_0x5436c7,_0x275086,_0xb0c965){return db[_0xe098('0x40')][_0xe098('0x5d')]({'where':{'id':_0x5436c7[_0xe098('0x59')]['id']}})[_0xe098('0x1f')](handleEntityNotFound(_0x275086,null))[_0xe098('0x1f')](function(_0x116218){if(_0x116218){return _0x116218[_0xe098('0x70')](_0x5436c7['query'][_0xe098('0x6c')]);}})[_0xe098('0x1f')](respondWithStatusCode(_0x275086,null))[_0xe098('0x2a')](handleError(_0x275086,null));};exports['notify']=function(_0x4d8275,_0x9036b1,_0x1eaf93){var _0x1e0b7a={'channel':'sms'};var _0x55ba50=[];var _0x3e88b5=[];var _0x4e0a28={};return db[_0xe098('0x40')][_0xe098('0x5d')]({'where':{'id':_0x4d8275[_0xe098('0x59')]['id']},'include':[{'model':db[_0xe098('0x71')],'as':_0xe098('0x72')}]})[_0xe098('0x1f')](handleEntityNotFound(_0x9036b1,null))[_0xe098('0x1f')](function(_0x2059e9){_0x1e0b7a[_0xe098('0x73')]=_0x2059e9;_0x1e0b7a['applications']=_[_0xe098('0x74')](_0x2059e9['Applications'],[_0xe098('0x75')],['asc']);if(_0x1e0b7a[_0xe098('0x73')][_0xe098('0x72')]){delete _0x1e0b7a['account']['Applications'];}return db[_0xe098('0x76')][_0xe098('0x66')]();})[_0xe098('0x1f')](function(_0x361980){if(!_0x361980){throw new db[(_0xe098('0x77'))]['ValidationError']('no\x20available\x20attributes');}_0x55ba50=_[_0xe098('0x78')](_[_0xe098('0x45')](_0x361980),[_0xe098('0x79'),_0xe098('0x7a')]);_0x3e88b5=_['difference'](_[_0xe098('0x45')](_0x361980),[_0xe098('0x79'),_0xe098('0x7a'),_0xe098('0x7b'),_0xe098('0x7c')]);_0x1e0b7a[_0xe098('0x5f')]={'mapKey':'mobile'};if(_0x1e0b7a[_0xe098('0x73')][_0xe098('0x42')]){switch(_0x1e0b7a[_0xe098('0x73')][_0xe098('0x42')]){case _0xe098('0x7d'):_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x7e')]=_0x4d8275['body'][_0xe098('0x7f')];_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x5f')]=_0x4d8275[_0xe098('0x5f')]['Body'];_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x80')]=_0x4d8275[_0xe098('0x5f')]['MessageSid'];break;case _0xe098('0x81'):_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x7e')]='+'+_0x4d8275[_0xe098('0x5f')]['sender'];_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x5f')]=_0x4d8275[_0xe098('0x5f')][_0xe098('0x82')];break;case _0xe098('0x83'):_0x1e0b7a['body'][_0xe098('0x7e')]=_0x4d8275[_0xe098('0x5f')][_0xe098('0x7e')];_0x1e0b7a['body']['body']=_0x4d8275[_0xe098('0x5f')][_0xe098('0x28')];break;case _0xe098('0x84'):_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x7e')]=_0x4d8275[_0xe098('0x5f')]['from'];_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x5f')]=_0x4d8275[_0xe098('0x5f')][_0xe098('0x5f')];_0x1e0b7a[_0xe098('0x5f')]['messageId']=_0x4d8275['body'][_0xe098('0x85')];break;case'plivo':_0x1e0b7a['body'][_0xe098('0x7e')]=_0x4d8275[_0xe098('0x5f')][_0xe098('0x7f')];_0x1e0b7a[_0xe098('0x5f')]['body']=_0x4d8275[_0xe098('0x5f')][_0xe098('0x86')];_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x80')]=_0x4d8275['body'][_0xe098('0x87')];break;case'infobip':_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x7e')]='+'+_0x4d8275[_0xe098('0x5f')][_0xe098('0x88')][0x0][_0xe098('0x7e')];_0x1e0b7a[_0xe098('0x5f')]['body']=_0x4d8275[_0xe098('0x5f')][_0xe098('0x88')][0x0][_0xe098('0x82')];_0x1e0b7a['body'][_0xe098('0x80')]=_0x4d8275[_0xe098('0x5f')]['results'][0x0][_0xe098('0x80')];break;case _0xe098('0x89'):_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x7e')]=_0x4d8275['body'][_0xe098('0x8a')];_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x5f')]=_0x4d8275[_0xe098('0x5f')][_0xe098('0x8b')][_0xe098('0x28')];break;case _0xe098('0x8c'):_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x7e')]=_0x4d8275[_0xe098('0x5f')][_0xe098('0x8d')];_0x1e0b7a[_0xe098('0x5f')]['body']=_0x4d8275[_0xe098('0x5f')][_0xe098('0x82')];_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x80')]=_0x4d8275[_0xe098('0x5f')]['replyMessageId'];break;case _0xe098('0x8e'):_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x80')]=_0x4d8275[_0xe098('0x5f')][0x0][_0xe098('0x28')]['id'];_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x7e')]=_0x4d8275[_0xe098('0x5f')][0x0]['message']['from'];_0x1e0b7a[_0xe098('0x5f')]['body']=_0x4d8275[_0xe098('0x5f')][0x0][_0xe098('0x28')][_0xe098('0x82')];break;case'intelepeer':_0x1e0b7a[_0xe098('0x5f')]['from']=_0x4d8275[_0xe098('0x5f')]['from'];_0x1e0b7a[_0xe098('0x5f')]['body']=_0x4d8275['body'][_0xe098('0x28')];_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x80')]=_0x4d8275[_0xe098('0x5f')]['refid'];break;}}if(_0x1e0b7a[_0xe098('0x5f')]['id']){delete _0x1e0b7a[_0xe098('0x5f')]['id'];}if(_[_0xe098('0x8f')](_0x1e0b7a[_0xe098('0x5f')]['from'])){throw new db[(_0xe098('0x77'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xe098('0x8f')](_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x5f')])||_0x1e0b7a['body'][_0xe098('0x5f')]===''){throw new db[(_0xe098('0x77'))]['ValidationError'](_0xe098('0x90'));}if(_['isNil'](_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x91')])){throw new db[(_0xe098('0x77'))][(_0xe098('0x92'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3e88b5);}if(!_[_0xe098('0x93')](_0x3e88b5,_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x91')])){throw new db[(_0xe098('0x77'))][(_0xe098('0x92'))](_0xe098('0x94')+_0x3e88b5);}_0x4e0a28[_0x1e0b7a['body'][_0xe098('0x91')]]=_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x7e')];return db[_0xe098('0x95')]['find']({'where':{'id':_0x1e0b7a[_0xe098('0x73')][_0xe098('0x7c')]},'include':[{'model':db[_0xe098('0x76')],'as':'Contacts','where':_0x4e0a28,'limit':0x1,'order':[[_0xe098('0x7a'),_0xe098('0x96')]]}]});})[_0xe098('0x1f')](handleEntityNotFound(_0x9036b1,null))[_0xe098('0x1f')](function(_0x41823d){if(_0x41823d){_0x1e0b7a[_0xe098('0x97')]=_[_0xe098('0x98')](_0x41823d,[_0xe098('0x99')]);if(_0x41823d['Contacts'][_0xe098('0x4a')]){return _0x41823d[_0xe098('0x99')][0x0];}var _0x4ad4f2=_['defaults'](_0x1e0b7a[_0xe098('0x5f')],{'firstName':_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x7e')],'ListId':_0x41823d['id']});_0x4ad4f2[_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x91')]]=_0x1e0b7a[_0xe098('0x5f')]['from'];return db['CmContact'][_0xe098('0x5e')](_0x4ad4f2,{'fields':_0x55ba50,'raw':!![]});}})[_0xe098('0x1f')](handleEntityNotFound(_0x9036b1,null))[_0xe098('0x1f')](function(_0x2445e4){if(_0x2445e4){_0x1e0b7a[_0xe098('0x9a')]=_0x2445e4;var _0x4258b9={'ContactId':_0x2445e4['id'],'phone':_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x7e')],'SmsAccountId':_0x4d8275[_0xe098('0x59')]['id']};var _0x27b7c1={'ContactId':_0x2445e4['id'],'SmsAccountId':_0x4d8275[_0xe098('0x59')]['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x27b7c1})[_0xe098('0x1f')](function(_0x273f84){if(_0x273f84){return[_0x273f84,![]];}return db['SmsInteraction']['create'](_0x4258b9)['then'](function(_0x5af233){return[_0x5af233,!![]];});});}})[_0xe098('0x9b')](function(_0x2fa1ec,_0x813d2a){_0x1e0b7a[_0xe098('0x9c')]=_0x2fa1ec[_0xe098('0x39')]({'plain':!![]});_0x1e0b7a[_0xe098('0x9c')][_0xe098('0x9d')]=![];if(_0x813d2a){if(_0x1e0b7a[_0xe098('0x73')][_0xe098('0x9e')]){_0x1e0b7a[_0xe098('0x9f')]['push']({'id':0x0,'priority':_0x1e0b7a[_0xe098('0x9f')][_0xe098('0x4a')]+0x1,'app':_0xe098('0xa0'),'appdata':_0xe098('0xa1'),'interval':_0xe098('0xa2')});}_0x1e0b7a[_0xe098('0x9c')][_0xe098('0x9d')]=!![];}return db[_0xe098('0xa3')][_0xe098('0x5e')]({'phone':_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x7e')],'messageId':_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x80')],'body':_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x5f')],'SmsAccountId':_0x4d8275[_0xe098('0x59')]['id'],'SmsInteractionId':_0x2fa1ec['id'],'direction':'in','ContactId':_0x2fa1ec[_0xe098('0xa4')],'AttachmentId':_0x1e0b7a[_0xe098('0x5f')][_0xe098('0xa5')]});})[_0xe098('0x1f')](function(_0x8912cb){_0x1e0b7a[_0xe098('0x28')]=_0x8912cb;if(!_0x1e0b7a[_0xe098('0x9c')][_0xe098('0xa6')])return;return db[_0xe098('0xa7')]['find']({'attributes':['id',_0xe098('0x3c')],'where':{'id':_0x1e0b7a[_0xe098('0x9c')][_0xe098('0xa6')]}});})[_0xe098('0x1f')](function(_0x4135c0){if(_0x4135c0){_0x1e0b7a[_0xe098('0x9f')][_0xe098('0xa8')]({'id':0x0,'priority':0x0,'app':_0xe098('0xa9'),'appdata':_0x4135c0[_0xe098('0x3c')]+','+(_0x1e0b7a[_0xe098('0x73')][_0xe098('0xaa')]||0xa),'interval':_0xe098('0xa2')});}if(!_0x1e0b7a[_0xe098('0x9c')][_0xe098('0xab')])return;return db[_0xe098('0xac')][_0xe098('0x5d')]({'attributes':['id',_0xe098('0x3c')],'where':{'id':_0x1e0b7a[_0xe098('0x9c')]['queueId']}});})[_0xe098('0x1f')](function(_0x22f01d){if(_0x22f01d){_0x1e0b7a[_0xe098('0x9f')][_0xe098('0xa8')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x22f01d[_0xe098('0x3c')]+','+(_0x1e0b7a[_0xe098('0x73')][_0xe098('0xad')]||0x12c),'interval':_0xe098('0xa2')});}return respondWithRpcPromise('Start',_0xe098('0xae'),_0x1e0b7a);})['then'](function(_0x56e5a8){if(_0x56e5a8){var _0x5147bb=0xc8;var _0x4826d4='receiveMessage';logger[_0xe098('0x20')](_0xe098('0x24'),_0x4826d4,_0x5147bb,_0xe098('0xaf'));logger[_0xe098('0x23')](_0xe098('0xb0'),_0x4826d4,_0x5147bb,_0xe098('0xaf'),JSON['stringify'](_0x56e5a8));if(_0x1e0b7a['account'][_0xe098('0x42')]===_0xe098('0x7d')){return _0x9036b1[_0xe098('0x2c')](_0x5147bb)[_0xe098('0x33')](_0xe098('0xb1'),_0xe098('0xb2'))[_0xe098('0x3d')](_0xe098('0xb3'));}else{return _0x9036b1[_0xe098('0x2c')](_0x5147bb)[_0xe098('0x2e')](_0x56e5a8);}}})[_0xe098('0x2a')](handleError(_0x9036b1,null));};exports['addApplications']=function(_0x42e38d,_0x590d09){var _0x1b50ae=_0x42e38d['params']['id'];var _0x59740d=_0x42e38d[_0xe098('0x5f')];var _0x486d33=0xc8;var _0x2e3e1d=null;return db[_0xe098('0xb4')][_0xe098('0xb5')]({'isolationLevel':db['sequelize']['Transaction'][_0xe098('0xb6')]['READ_COMMITTED']},function(_0x1d9dcf){return db[_0xe098('0x40')]['findOne']({'where':{'id':_0x1b50ae},'transaction':_0x1d9dcf})['then'](function(_0x3117ba){if(_0x3117ba){return db[_0xe098('0x71')][_0xe098('0x38')]({'where':{'SmsAccountId':_0x1b50ae},'transaction':_0x1d9dcf})[_0xe098('0x1f')](function(){var _0x293697=_['map'](_0x59740d,function(_0x5afd65){_0x5afd65['SmsAccountId']=_0x1b50ae;return _0x5afd65;});return db[_0xe098('0x71')][_0xe098('0xb7')](_0x293697,{'transaction':_0x1d9dcf});});}else{_0x486d33=0x194;_0x2e3e1d=[];}});})['then'](function(){if(_0x486d33!==0x194){return db[_0xe098('0x71')]['findAndCountAll']({'where':{'SmsAccountId':_0x1b50ae},'order':_0xe098('0x75')})['then'](function(_0xf2a72e){_0x2e3e1d=_0xf2a72e;});}})[_0xe098('0x2a')](function(_0x3f9516){_0x486d33=0x1f4;logger[_0xe098('0x26')](_0x3f9516[_0xe098('0x3b')]);if(_0x3f9516[_0xe098('0x3c')]){delete _0x3f9516[_0xe098('0x3c')];}_0x2e3e1d=_0x3f9516;})[_0xe098('0xb8')](function(){if(_0x2e3e1d===null){_0x590d09['sendStatus'](_0x486d33);}else{if(_0x486d33===0x1f4){_0x590d09[_0xe098('0x2c')](_0x486d33)[_0xe098('0x3d')](_0x2e3e1d);}else{_0x590d09[_0xe098('0x2c')](_0x486d33)[_0xe098('0x2e')](_0x2e3e1d);}}});};exports[_0xe098('0xb9')]=function(_0x5ab97f,_0x53f7a7,_0x4ccb44){var _0x4cac44={};var _0x5352c9={};var _0x5a9e1e;var _0x2becca;return db[_0xe098('0x40')]['findOne']({'where':{'id':_0x5ab97f[_0xe098('0x59')]['id']}})[_0xe098('0x1f')](handleEntityNotFound(_0x53f7a7,null))['then'](function(_0x47d8c7){if(_0x47d8c7){_0x5a9e1e=_0x47d8c7;_0x5352c9[_0xe098('0x43')]=_[_0xe098('0x45')](db[_0xe098('0x71')][_0xe098('0x5b')]);_0x5352c9['query']=_[_0xe098('0x45')](_0x5ab97f['query']);_0x5352c9[_0xe098('0x4f')]=_[_0xe098('0x48')](_0x5352c9[_0xe098('0x43')],_0x5352c9[_0xe098('0x46')]);_0x4cac44[_0xe098('0x47')]=_['intersection'](_0x5352c9['model'],qs[_0xe098('0x49')](_0x5ab97f['query'][_0xe098('0x49')]));_0x4cac44['attributes']=_0x4cac44[_0xe098('0x47')][_0xe098('0x4a')]?_0x4cac44['attributes']:_0x5352c9[_0xe098('0x43')];_0x4cac44[_0xe098('0x6f')]=qs[_0xe098('0x4d')](_0x5ab97f['query']['sort']);_0x4cac44[_0xe098('0x4e')]=qs[_0xe098('0x4f')](_[_0xe098('0x50')](_0x5ab97f[_0xe098('0x46')],_0x5352c9[_0xe098('0x4f')]));if(_0x5ab97f[_0xe098('0x46')][_0xe098('0x51')]){_0x4cac44[_0xe098('0x4e')]=_[_0xe098('0x52')](_0x4cac44['where'],{'$or':_[_0xe098('0x44')](_0x4cac44['attributes'],function(_0x2c9120){var _0x463b2f={};_0x463b2f[_0x2c9120]={'$like':'%'+_0x5ab97f['query'][_0xe098('0x51')]+'%'};return _0x463b2f;})});}_0x4cac44=_[_0xe098('0x52')]({},_0x4cac44,_0x5ab97f[_0xe098('0x54')]);return _0x5a9e1e[_0xe098('0xb9')](_0x4cac44);}})['then'](function(_0x5c678b){if(_0x5c678b){_0x2becca=_0x5c678b['length'];if(!_0x5ab97f['query'][_0xe098('0x4b')](_0xe098('0x4c'))){_0x4cac44[_0xe098('0x30')]=qs[_0xe098('0x30')](_0x5ab97f[_0xe098('0x46')][_0xe098('0x30')]);_0x4cac44[_0xe098('0x32')]=qs[_0xe098('0x32')](_0x5ab97f[_0xe098('0x46')]['offset']);}return _0x5a9e1e[_0xe098('0xb9')](_0x4cac44);}})[_0xe098('0x1f')](function(_0x1b1132){if(_0x1b1132){return _0x1b1132?{'count':_0x2becca,'rows':_0x1b1132}:null;}})[_0xe098('0x1f')](respondWithResult(_0x53f7a7,null))['catch'](handleError(_0x53f7a7,null));};exports[_0xe098('0xba')]=function(_0x348217,_0x13f03c,_0x2f398e){var _0x243667={'raw':![],'where':{}};var _0x55f756={};var _0xaa0339={'count':0x0,'rows':[]};return db[_0xe098('0x40')][_0xe098('0xbb')]({'where':{'id':_0x348217['params']['id']}})[_0xe098('0x1f')](handleEntityNotFound(_0x13f03c,null))[_0xe098('0x1f')](function(_0x3063a3){if(_0x3063a3){_0x55f756[_0xe098('0x43')]=_[_0xe098('0x45')](db[_0xe098('0xbc')][_0xe098('0x5b')]);_0x55f756[_0xe098('0x46')]=_[_0xe098('0x45')](_0x348217[_0xe098('0x46')]);_0x55f756[_0xe098('0x4f')]=_[_0xe098('0x48')](_0x55f756[_0xe098('0x43')],_0x55f756[_0xe098('0x46')]);_0x243667[_0xe098('0x47')]=_[_0xe098('0x48')](_0x55f756[_0xe098('0x43')],qs['fields'](_0x348217[_0xe098('0x46')][_0xe098('0x49')]));_0x243667[_0xe098('0x47')]=_0x243667[_0xe098('0x47')][_0xe098('0x4a')]?_0x243667[_0xe098('0x47')]:_0x55f756[_0xe098('0x43')];if(!_0x348217[_0xe098('0x46')][_0xe098('0x4b')]('nolimit')){_0x243667[_0xe098('0x30')]=qs['limit'](_0x348217['query'][_0xe098('0x30')]);_0x243667[_0xe098('0x32')]=qs[_0xe098('0x32')](_0x348217[_0xe098('0x46')]['offset']);}_0x243667['order']=qs['sort'](_0x348217['query'][_0xe098('0x4d')]);_0x243667['where']=qs['filters'](_[_0xe098('0x50')](_0x348217[_0xe098('0x46')],_0x55f756[_0xe098('0x4f')]));_0x243667[_0xe098('0x4e')][_0xe098('0x68')]=_0x3063a3['id'];if(_0x348217[_0xe098('0x46')][_0xe098('0x51')]){_0x243667[_0xe098('0x4e')]=_[_0xe098('0x52')](_0x243667[_0xe098('0x4e')],{'$or':_[_0xe098('0x44')](_0x243667[_0xe098('0x47')],function(_0x4203d5){var _0x8e108d={};_0x8e108d[_0x4203d5]={'$like':'%'+_0x348217[_0xe098('0x46')][_0xe098('0x51')]+'%'};return _0x8e108d;})});}_0x243667=_[_0xe098('0x52')]({},_0x243667,_0x348217[_0xe098('0x54')]);return db[_0xe098('0xbc')]['count']({'where':_0x243667['where']})[_0xe098('0x1f')](function(_0x11ef24){_0xaa0339[_0xe098('0x31')]=_0x11ef24;if(_0x348217[_0xe098('0x46')][_0xe098('0x55')]){_0x243667[_0xe098('0x5c')]=[{'model':db[_0xe098('0x76')],'as':_0xe098('0xbd'),'required':![]},{'model':db[_0xe098('0xa7')],'as':_0xe098('0xbe'),'attributes':['name',_0xe098('0xbf'),_0xe098('0xc0')],'required':![]},{'model':db[_0xe098('0xc1')],'as':_0xe098('0xc2'),'attributes':['id',_0xe098('0x3c'),_0xe098('0xc3')],'where':_0x348217[_0xe098('0x46')]['tag']?{'id':_0x348217[_0xe098('0x46')]['tag']}:undefined,'required':_0x348217[_0xe098('0x46')][_0xe098('0xc4')]?!![]:![]}];}return db[_0xe098('0xbc')][_0xe098('0x56')](_0x243667);})[_0xe098('0x1f')](function(_0x325b7d){_0xaa0339['rows']=_0x325b7d;return _0xaa0339;});}})[_0xe098('0x1f')](respondWithFilteredResult(_0x13f03c,_0x243667))[_0xe098('0x2a')](handleError(_0x13f03c,null));};exports['send']=function(_0x3247b5,_0x2fd047,_0x512c60){var _0x1af5f2,_0x59c3c9,_0x58ce43;if(_[_0xe098('0x8f')](_0x3247b5[_0xe098('0x5f')]['body'])||_0x3247b5['body']['body']===''){throw new db[(_0xe098('0x77'))]['ValidationError'](_0xe098('0x90'));}if(_['isNil'](_0x3247b5[_0xe098('0x5f')]['to'])){throw new db[(_0xe098('0x77'))][(_0xe098('0x92'))](_0xe098('0xc5'));}_0x1af5f2=_0x3247b5[_0xe098('0x5f')]['to'];return db[_0xe098('0x40')][_0xe098('0x5d')]({'where':{'id':_0x3247b5[_0xe098('0x59')]['id']},'include':[{'model':db[_0xe098('0x95')],'as':'List','include':[{'model':db[_0xe098('0x76')],'as':'Contacts','where':{'mobile':_0x1af5f2},'limit':0x1,'order':[['updatedAt',_0xe098('0x96')]]}]}]})[_0xe098('0x1f')](handleEntityNotFound(_0x2fd047,null))['then'](function(_0x18b739){if(_0x18b739&&_0x18b739[_0xe098('0xc6')]){_0x59c3c9=_0x18b739[_0xe098('0x39')]({'plain':!![]});if(_0x59c3c9[_0xe098('0xc6')]&&_0x59c3c9[_0xe098('0xc6')][_0xe098('0x99')][_0xe098('0x4a')]){return _0x59c3c9[_0xe098('0xc6')]['Contacts'][0x0];}return db['CmContact'][_0xe098('0x5e')](_[_0xe098('0x17')](_0x3247b5['body'],{'firstName':_0x1af5f2,'mobile':_0x1af5f2,'phone':_0x1af5f2,'ListId':_0x59c3c9['ListId']}));}})[_0xe098('0x1f')](handleEntityNotFound(_0x2fd047,null))[_0xe098('0x1f')](function(_0x1b4bf9){if(_0x1b4bf9){_0x58ce43=_0x1b4bf9;return db[_0xe098('0xbc')][_0xe098('0x5d')]({'where':{'ContactId':_0x58ce43['id'],'closed':![],'SmsAccountId':_0x59c3c9['id']}})[_0xe098('0x1f')](function(_0x7f42d7){if(_0x7f42d7){return[_0x7f42d7,![]];}return db['SmsInteraction'][_0xe098('0x5e')]({'UserId':_0x3247b5[_0xe098('0xc7')]['id'],'ContactId':_0x58ce43['id'],'SmsAccountId':_0x59c3c9['id'],'phone':_0x1af5f2,'firstMsgDirection':_0xe098('0xc8'),'Messages':[_['merge'](_0x3247b5[_0xe098('0x5f')],{'read':![],'body':_0x3247b5[_0xe098('0x5f')][_0xe098('0x5f')],'phone':_0x1af5f2,'SmsAccountId':_0x59c3c9['id'],'UserId':_0x3247b5[_0xe098('0xc7')]['id'],'ContactId':_0x58ce43['id']})]},{'include':[{'model':db[_0xe098('0xa3')],'as':'Messages'}]})[_0xe098('0x1f')](function(_0x57773d){return[_0x57773d,!![]];});});}})[_0xe098('0x9b')](function(_0x1ede64,_0x4c3251){if(_0x4c3251){return _0x1ede64;}return db[_0xe098('0xa3')][_0xe098('0x5e')](_[_0xe098('0x52')](_0x3247b5['body'],{'read':![],'body':_0x3247b5['body'][_0xe098('0x5f')],'phone':_0x1af5f2,'SmsAccountId':_0x59c3c9['id'],'SmsInteractionId':_0x1ede64['id'],'UserId':_0x3247b5['user']['id'],'ContactId':_0x58ce43['id']}))[_0xe098('0x1f')](function(_0x407552){_0x1ede64['dataValues'][_0xe098('0xc9')]=[];_0x1ede64[_0xe098('0xca')]['Messages']['push'](_0x407552[_0xe098('0xca')]);return _0x1ede64;});})['then'](respondWithResult(_0x2fd047,null))[_0xe098('0x2a')](handleError(_0x2fd047,null));};exports['status']=function(_0x666c75,_0x497b84,_0x4c9475){if(_0x666c75[_0xe098('0x5f')]['id']){delete _0x666c75['body']['id'];}var _0x566fe4,_0x24a3cb,_0x1af6ca;return db[_0xe098('0x40')]['find']({'where':{'id':_0x666c75[_0xe098('0x59')]['id']}})[_0xe098('0x1f')](handleEntityNotFound(_0x497b84,null))[_0xe098('0x1f')](function(_0x1bd027){if(_0x1bd027){_0x1af6ca=_0x1bd027;logger[_0xe098('0x23')](_0xe098('0x24'),_0xe098('0x2c'),_0xe098('0xcb'),_0x1bd027[_0xe098('0x42')],util[_0xe098('0xcc')](_0x666c75[_0xe098('0x5f')],{'showHidden':![],'depth':null}));switch(_0x1bd027[_0xe098('0x42')]){case _0xe098('0x81'):if(_0x666c75[_0xe098('0x5f')]['skebby_dispatch_id']&&_0x666c75[_0xe098('0x5f')]['status']){_0x24a3cb=_0x666c75[_0xe098('0x5f')][_0xe098('0x2c')];return db[_0xe098('0xa3')][_0xe098('0x5d')]({'where':{'messageId':_0x666c75['body'][_0xe098('0xcd')]}});}break;case'connectel':if(_0x666c75[_0xe098('0x5f')]['requestid']&&_0x666c75['body'][_0xe098('0xce')]){_0x24a3cb=_0x666c75['body'][_0xe098('0xce')];return db[_0xe098('0xa3')][_0xe098('0x5d')]({'where':{'messageId':_0x666c75[_0xe098('0x5f')][_0xe098('0xcf')]}});}break;case _0xe098('0x84'):if(_0x666c75[_0xe098('0x5f')][_0xe098('0x85')]&&_0x666c75['body'][_0xe098('0xd0')]){_0x24a3cb=_0x666c75[_0xe098('0x5f')][_0xe098('0xd0')];return db[_0xe098('0xa3')][_0xe098('0x5d')]({'where':{'messageId':_0x666c75[_0xe098('0x5f')]['message_id']}});}break;case _0xe098('0xd1'):var _0x1668f3=_0x666c75[_0xe098('0x5f')][_0xe098('0x88')][0x0];if(_0x1668f3[_0xe098('0x80')]&&_0x1668f3[_0xe098('0x2c')][_0xe098('0xd2')]===_0xe098('0xd3')){_0x24a3cb=_0x1668f3['status'][_0xe098('0xd2')];return db['SmsMessage'][_0xe098('0x5d')]({'where':{'messageId':_0x1668f3[_0xe098('0x80')]}});}break;case'clickatell':if(_0x666c75[_0xe098('0x5f')][_0xe098('0x80')]&&_0x666c75[_0xe098('0x5f')][_0xe098('0x2c')]){_0x24a3cb=_0x666c75[_0xe098('0x5f')][_0xe098('0x2c')];return db[_0xe098('0xa3')]['find']({'where':{'messageId':_0x666c75['body'][_0xe098('0x80')]}});}break;case'bandwidth':if(_0x666c75[_0xe098('0x5f')][0x0][_0xe098('0x28')]['id']){_0x24a3cb=_0x666c75[_0xe098('0x5f')][0x0][_0xe098('0x42')];return db['SmsMessage'][_0xe098('0x5d')]({'where':{'messageId':_0x666c75['body'][0x0][_0xe098('0x28')]['id']}});}break;case'intelepeer':if(_0x666c75[_0xe098('0x5f')][_0xe098('0xd4')]&&_0x666c75['body'][_0xe098('0x2c')]){_0x24a3cb=_0x666c75[_0xe098('0x5f')][_0xe098('0x2c')];return db[_0xe098('0xa3')]['find']({'where':{'messageId':_0x666c75[_0xe098('0x5f')][_0xe098('0xd4')]}});}break;}}})['then'](handleEntityNotFound(_0x497b84,null))[_0xe098('0x1f')](function(_0x4ddcc0){if(_0x4ddcc0){_0x566fe4=_0x4ddcc0;switch(_0x1af6ca[_0xe098('0x42')]){case'skebby':if(_0x24a3cb===_0xe098('0xd3')){return _0x566fe4[_0xe098('0x37')]({'read':!![]});}else{logger[_0xe098('0x26')](_0xe098('0x24'),_0xe098('0x2c'),_0xe098('0x81'),util[_0xe098('0xcc')](_0x666c75[_0xe098('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xe098('0x83'):if(_0x24a3cb==='1'){return _0x566fe4[_0xe098('0x37')]({'read':!![]});}else{logger[_0xe098('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','skebby',util[_0xe098('0xcc')](_0x666c75[_0xe098('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xe098('0x84'):if(!_0x666c75[_0xe098('0x5f')][_0xe098('0xd5')]&&_0x24a3cb>=0xc8&&_0x24a3cb<=0xce){return _0x566fe4['update']({'read':!![]});}else{logger[_0xe098('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','clicksend',util[_0xe098('0xcc')](_0x666c75[_0xe098('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xe098('0xd1'):var _0x546697=_0x666c75[_0xe098('0x5f')][_0xe098('0x88')][0x0];if(_0x546697['status'][_0xe098('0xd2')]===_0xe098('0xd3')){return _0x566fe4['update']({'read':!![]});}else{logger[_0xe098('0x26')](_0xe098('0x24'),_0xe098('0x2c'),'infobip',util[_0xe098('0xcc')](_0x666c75[_0xe098('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xe098('0x8c'):if(_0x24a3cb==_0xe098('0xd6')||_0x24a3cb==_0xe098('0xd7')){return _0x566fe4['update']({'read':!![]});}else{logger[_0xe098('0x26')](_0xe098('0x24'),_0xe098('0x2c'),_0xe098('0x8c'),util[_0xe098('0xcc')](_0x666c75[_0xe098('0x5f')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x24a3cb==_0xe098('0xd8')){return _0x566fe4['update']({'read':!![]});}else{logger[_0xe098('0x26')](_0xe098('0x24'),_0xe098('0x2c'),_0xe098('0x8e'),util[_0xe098('0xcc')](_0x666c75['body'],{'showHidden':![],'depth':null}));}break;case _0xe098('0xd9'):if(_0x24a3cb===_0xe098('0xda')||_0x24a3cb===_0xe098('0xdb')){return _0x566fe4[_0xe098('0x37')]({'read':!![]});}else{logger[_0xe098('0x26')](_0xe098('0x24'),'status',_0xe098('0xd9'),util['inspect'](_0x666c75[_0xe098('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x566fe4;}})['then'](respondWithResult(_0x497b84,null))[_0xe098('0x2a')](handleError(_0x497b84,null));};exports[_0xe098('0xdc')]=function(_0x5a23f2,_0x32366c,_0x1780fb){var _0xdd42da,_0x127f52,_0x173096;return db['SmsAccount'][_0xe098('0x5d')]({'where':{'id':_0x5a23f2['params']['id']}})[_0xe098('0x1f')](handleEntityNotFound(_0x32366c,null))['then'](function(_0x35119d){if(_0x35119d){_0x173096=_0x35119d;logger[_0xe098('0x23')](_0xe098('0x24'),'status',_0xe098('0xcb'),_0x35119d[_0xe098('0x42')],util[_0xe098('0xcc')](_0x5a23f2[_0xe098('0x46')],{'showHidden':![],'depth':null}));switch(_0x35119d[_0xe098('0x42')]){case _0xe098('0x89'):if(_0x5a23f2[_0xe098('0x46')]['message-id']&&_0x5a23f2[_0xe098('0x46')][_0xe098('0xdd')]){_0x127f52=_0x5a23f2[_0xe098('0x46')][_0xe098('0xdd')];return db[_0xe098('0xa3')]['find']({'where':{'messageId':_0x5a23f2[_0xe098('0x46')][_0xe098('0xde')]}});}break;}}})['then'](handleEntityNotFound(_0x32366c,null))['then'](function(_0x7f3d8e){if(_0x7f3d8e){_0xdd42da=_0x7f3d8e;switch(_0x173096[_0xe098('0x42')]){case _0xe098('0x89'):if(_0x127f52==='2'||_0x127f52==='6'){return _0xdd42da['update']({'read':!![]});}else{logger[_0xe098('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe098('0x2c'),_0xe098('0x89'),util['inspect'](_0x5a23f2['query'],{'showHidden':![],'depth':null}));};break;}return _0xdd42da;}})['then'](respondWithResult(_0x32366c,null))['catch'](handleError(_0x32366c,null));};exports[_0xe098('0xdf')]=function(_0x47e453,_0x234c67,_0x2e38ad){return db[_0xe098('0x40')][_0xe098('0x5d')]({'where':{'id':_0x47e453[_0xe098('0x59')]['id']}})['then'](handleEntityNotFound(_0x234c67,null))[_0xe098('0x1f')](function(_0x56f2c7){if(_0x56f2c7){return _0x56f2c7['addAgents'](_0x47e453['body'][_0xe098('0x6c')],_[_0xe098('0x98')](_0x47e453[_0xe098('0x5f')],[_0xe098('0x6c'),'id'])||{})[_0xe098('0x9b')](function(_0x1062d9){for(var _0x3424be=0x0;_0x3424be<_0x47e453[_0xe098('0x5f')][_0xe098('0x6c')]['length'];_0x3424be+=0x1){socket[_0xe098('0xe0')](_0xe098('0xe1'),{'UserId':Number(_0x47e453[_0xe098('0x5f')][_0xe098('0x6c')][_0x3424be]),'SmsAccountId':Number(_0x47e453[_0xe098('0x59')]['id'])});}return _0x1062d9;});}})[_0xe098('0x1f')](respondWithResult(_0x234c67,null))[_0xe098('0x2a')](handleError(_0x234c67,null));};exports[_0xe098('0xe2')]=function(_0x57baee,_0x38b9bd,_0x3905da){return db['SmsAccount'][_0xe098('0x5d')]({'where':{'id':_0x57baee[_0xe098('0x59')]['id']}})[_0xe098('0x1f')](handleEntityNotFound(_0x38b9bd,null))['then'](function(_0xbf39dc){if(_0xbf39dc){return _0xbf39dc[_0xe098('0xe2')](_0x57baee[_0xe098('0x46')][_0xe098('0x6c')])[_0xe098('0x1f')](function(){if(_[_0xe098('0xe3')](_0x57baee[_0xe098('0x46')][_0xe098('0x6c')])){for(var _0x358671=0x0;_0x358671<_0x57baee[_0xe098('0x46')]['ids'][_0xe098('0x4a')];_0x358671+=0x1){socket[_0xe098('0xe0')]('userSmsAccount:remove',{'UserId':Number(_0x57baee['query'][_0xe098('0x6c')][_0x358671]),'SmsAccountId':Number(_0x57baee[_0xe098('0x59')]['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x57baee['query'][_0xe098('0x6c')]),'SmsAccountId':Number(_0x57baee[_0xe098('0x59')]['id'])});}});}})[_0xe098('0x1f')](respondWithStatusCode(_0x38b9bd,null))[_0xe098('0x2a')](handleError(_0x38b9bd,null));};exports[_0xe098('0xe4')]=function(_0x572e32,_0x363ae3,_0x138e1c){var _0x333975={};var _0x498496={};var _0x356344;var _0x44128b;return db[_0xe098('0x40')][_0xe098('0xbb')]({'where':{'id':_0x572e32['params']['id']}})[_0xe098('0x1f')](handleEntityNotFound(_0x363ae3,null))['then'](function(_0x8a0d39){if(_0x8a0d39){_0x356344=_0x8a0d39;_0x498496[_0xe098('0x43')]=_[_0xe098('0x45')](db[_0xe098('0xa7')]['rawAttributes']);_0x498496[_0xe098('0x46')]=_[_0xe098('0x45')](_0x572e32['query']);_0x498496[_0xe098('0x4f')]=_[_0xe098('0x48')](_0x498496[_0xe098('0x43')],_0x498496['query']);_0x333975[_0xe098('0x47')]=_[_0xe098('0x48')](_0x498496[_0xe098('0x43')],qs[_0xe098('0x49')](_0x572e32['query'][_0xe098('0x49')]));_0x333975[_0xe098('0x47')]=_0x333975[_0xe098('0x47')][_0xe098('0x4a')]?_0x333975['attributes']:_0x498496[_0xe098('0x43')];_0x333975[_0xe098('0x6f')]=qs[_0xe098('0x4d')](_0x572e32[_0xe098('0x46')][_0xe098('0x4d')]);_0x333975[_0xe098('0x4e')]=qs['filters'](_['pick'](_0x572e32[_0xe098('0x46')],_0x498496[_0xe098('0x4f')]));if(_0x572e32['query'][_0xe098('0x51')]){_0x333975[_0xe098('0x4e')]=_[_0xe098('0x52')](_0x333975[_0xe098('0x4e')],{'$or':_[_0xe098('0x44')](_0x333975[_0xe098('0x47')],function(_0x3b5e57){var _0x11a7d9={};_0x11a7d9[_0x3b5e57]={'$like':'%'+_0x572e32['query'][_0xe098('0x51')]+'%'};return _0x11a7d9;})});}_0x333975=_[_0xe098('0x52')]({},_0x333975,_0x572e32[_0xe098('0x54')]);return _0x356344[_0xe098('0xe4')](_0x333975);}})[_0xe098('0x1f')](function(_0x1e53d6){if(_0x1e53d6){_0x44128b=_0x1e53d6[_0xe098('0x4a')];if(!_0x572e32[_0xe098('0x46')]['hasOwnProperty'](_0xe098('0x4c'))){_0x333975[_0xe098('0x30')]=qs[_0xe098('0x30')](_0x572e32[_0xe098('0x46')][_0xe098('0x30')]);_0x333975[_0xe098('0x32')]=qs['offset'](_0x572e32[_0xe098('0x46')][_0xe098('0x32')]);}return _0x356344['getAgents'](_0x333975);}})[_0xe098('0x1f')](function(_0x4c5885){if(_0x4c5885){return _0x4c5885?{'count':_0x44128b,'rows':_0x4c5885}:null;}})[_0xe098('0x1f')](respondWithResult(_0x363ae3,null))[_0xe098('0x2a')](handleError(_0x363ae3,null));}; \ No newline at end of file +var _0xdbcc=['twilio','set','Content-Type','text/xml','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','getInteractions','Contact','Owner','fullname','color','tag','to\x20is\x20mandatory','List','out','Messages','SmsMessage','dataValues','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','DELIVERED','groupName','clickatell','redif','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','then','info','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','SmsAccount,\x20%s,\x20%s','message','result','sendStatus','status','undefined','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','fieldName','type','key','keys','query','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','findAll','rows','show','params','rawAttributes','model','includeAll','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','SmsAccountId','Disposition','getDispositions','findOne','include','removeDispositions','ids','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','notify','sms','SmsApplication','account','applications','orderBy','Applications','priority','CmContact','Sequelize','ValidationError','createdAt','updatedAt','difference','CompanyId','ListId','from','From','MessageSid','skebby','sender','clicksend','messageId','message_id','plivo','MessageUUID','infobip','results','text','csc','segmentedMessage','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','Contacts','DESC','list','omit','SmsInteraction','interaction','created','autoclose','push','close','*,*,*,*','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','queue','Start','startRouting','receiveMessage','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','stringify'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0xdbcc,0x115));var _0xcdbc=function(_0x306796,_0x3117d5){_0x306796=_0x306796-0x0;var _0x20804e=_0xdbcc[_0x306796];return _0x20804e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcdbc('0x0'));var zipdir=require(_0xcdbc('0x1'));var jsonpatch=require(_0xcdbc('0x2'));var rp=require(_0xcdbc('0x3'));var moment=require(_0xcdbc('0x4'));var BPromise=require(_0xcdbc('0x5'));var Mustache=require(_0xcdbc('0x6'));var util=require(_0xcdbc('0x7'));var path=require(_0xcdbc('0x8'));var sox=require(_0xcdbc('0x9'));var csv=require(_0xcdbc('0xa'));var ejs=require(_0xcdbc('0xb'));var fs=require('fs');var fs_extra=require(_0xcdbc('0xc'));var _=require('lodash');var squel=require(_0xcdbc('0xd'));var crypto=require(_0xcdbc('0xe'));var jsforce=require(_0xcdbc('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xcdbc('0xa'));var querystring=require(_0xcdbc('0x10'));var Papa=require(_0xcdbc('0x11'));var Redis=require(_0xcdbc('0x12'));var authService=require(_0xcdbc('0x13'));var qs=require(_0xcdbc('0x14'));var as=require(_0xcdbc('0x15'));var hardwareService=require(_0xcdbc('0x16'));var logger=require('../../config/logger')(_0xcdbc('0x17'));var utils=require('../../config/utils');var config=require(_0xcdbc('0x18'));var licenseUtil=require(_0xcdbc('0x19'));var db=require('../../mysqldb')['db'];config[_0xcdbc('0x1a')]=_[_0xcdbc('0x1b')](config[_0xcdbc('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xcdbc('0x1c'))(new Redis(config[_0xcdbc('0x1a')]));require(_0xcdbc('0x1d'))[_0xcdbc('0x1e')](socket);var jayson=require(_0xcdbc('0x1f'));var client=jayson['client'][_0xcdbc('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x4e957b,_0x75f0a0,_0x3a21bb,_0x1f6646){return new BPromise(function(_0x4c8ef2,_0x290b0b){var _0x460f93=_0x1f6646||client;return _0x460f93['request'](_0x4e957b,_0x3a21bb)[_0xcdbc('0x21')](function(_0x25dd4b){logger[_0xcdbc('0x22')]('SmsAccount,\x20%s,\x20%s',_0x75f0a0,_0xcdbc('0x23'));logger['debug'](_0xcdbc('0x24'),_0x75f0a0,_0xcdbc('0x23'),JSON['stringify'](_0x25dd4b));if(_0x25dd4b['error']){if(_0x25dd4b[_0xcdbc('0x25')][_0xcdbc('0x26')]===0x1f4){logger['error'](_0xcdbc('0x27'),_0x75f0a0,_0x25dd4b[_0xcdbc('0x25')]['message']);return _0x290b0b(_0x25dd4b['error'][_0xcdbc('0x28')]);}logger['error'](_0xcdbc('0x27'),_0x75f0a0,_0x25dd4b[_0xcdbc('0x25')]['message']);return _0x4c8ef2(_0x25dd4b[_0xcdbc('0x25')]['message']);}else{logger[_0xcdbc('0x22')](_0xcdbc('0x27'),_0x75f0a0,'request\x20sent');_0x4c8ef2(_0x25dd4b[_0xcdbc('0x29')]['message']);}})['catch'](function(_0x391ad3){logger[_0xcdbc('0x25')](_0xcdbc('0x27'),_0x75f0a0,_0x391ad3);_0x290b0b(_0x391ad3);});});}function respondWithStatusCode(_0xcb9189,_0x44d3ca){_0x44d3ca=_0x44d3ca||0xcc;return function(_0x3bf5b8){if(_0x3bf5b8){return _0xcb9189[_0xcdbc('0x2a')](_0x44d3ca);}return _0xcb9189[_0xcdbc('0x2b')](_0x44d3ca)['end']();};}function respondWithResult(_0x57c2bd,_0x1bff0a){_0x1bff0a=_0x1bff0a||0xc8;return function(_0x4ff2f9){if(_0x4ff2f9){return _0x57c2bd[_0xcdbc('0x2b')](_0x1bff0a)['json'](_0x4ff2f9);}};}function respondWithFilteredResult(_0x5bfa32,_0x4454f4){return function(_0x42f64e){if(_0x42f64e){var _0x56bbd3=typeof _0x4454f4['offset']===_0xcdbc('0x2c')&&typeof _0x4454f4['limit']==='undefined';var _0x3b4407=_0x42f64e[_0xcdbc('0x2d')];var _0x291489=_0x56bbd3?0x0:_0x4454f4[_0xcdbc('0x2e')];var _0x4bbc77=_0x56bbd3?_0x42f64e[_0xcdbc('0x2d')]:_0x4454f4[_0xcdbc('0x2e')]+_0x4454f4[_0xcdbc('0x2f')];var _0x567db7;if(_0x4bbc77>=_0x3b4407){_0x4bbc77=_0x3b4407;_0x567db7=0xc8;}else{_0x567db7=0xce;}_0x5bfa32[_0xcdbc('0x2b')](_0x567db7);return _0x5bfa32['set'](_0xcdbc('0x30'),_0x291489+'-'+_0x4bbc77+'/'+_0x3b4407)[_0xcdbc('0x31')](_0x42f64e);}return null;};}function patchUpdates(_0x2ef680){return function(_0x26eb6f){try{jsonpatch[_0xcdbc('0x32')](_0x26eb6f,_0x2ef680,!![]);}catch(_0x4cb483){return BPromise[_0xcdbc('0x33')](_0x4cb483);}return _0x26eb6f[_0xcdbc('0x34')]();};}function saveUpdates(_0x541a70,_0x3f364a){return function(_0x110990){if(_0x110990){return _0x110990[_0xcdbc('0x35')](_0x541a70)[_0xcdbc('0x21')](function(_0x10755a){return _0x10755a;});}return null;};}function removeEntity(_0x1f2911,_0x553e3f){return function(_0x1da7e9){if(_0x1da7e9){return _0x1da7e9[_0xcdbc('0x36')]()['then'](function(){var _0x2b029b=_0x1da7e9[_0xcdbc('0x37')]({'plain':!![]});var _0xc8affa=_0xcdbc('0x38');return db[_0xcdbc('0x39')][_0xcdbc('0x36')]({'where':{'type':_0xc8affa,'resourceId':_0x2b029b['id']}})[_0xcdbc('0x21')](function(){return _0x1da7e9;});})[_0xcdbc('0x21')](function(){_0x1f2911[_0xcdbc('0x2b')](0xcc)[_0xcdbc('0x3a')]();});}};}function handleEntityNotFound(_0x3f4101,_0x59dacf){return function(_0x1ac7cc){if(!_0x1ac7cc){_0x3f4101[_0xcdbc('0x2a')](0x194);}return _0x1ac7cc;};}function handleError(_0x37055a,_0x76cf79){_0x76cf79=_0x76cf79||0x1f4;return function(_0x49260a){logger['error'](_0x49260a[_0xcdbc('0x3b')]);if(_0x49260a[_0xcdbc('0x3c')]){delete _0x49260a[_0xcdbc('0x3c')];}_0x37055a[_0xcdbc('0x2b')](_0x76cf79)[_0xcdbc('0x3d')](_0x49260a);};}exports[_0xcdbc('0x3e')]=function(_0x51395e,_0xb8e327){var _0x3f2ff1={'include':[{'model':db[_0xcdbc('0x3f')],'as':_0xcdbc('0x40')}]},_0x28b511={},_0x12eb13={'count':0x0,'rows':[]};var _0x53d5af=_[_0xcdbc('0x41')](db[_0xcdbc('0x42')]['rawAttributes'],function(_0x4dd9ae){return{'name':_0x4dd9ae[_0xcdbc('0x43')],'type':_0x4dd9ae[_0xcdbc('0x44')][_0xcdbc('0x45')]};});_0x28b511['model']=_[_0xcdbc('0x41')](_0x53d5af,_0xcdbc('0x3c'));_0x28b511['query']=_[_0xcdbc('0x46')](_0x51395e[_0xcdbc('0x47')]);_0x28b511['filters']=_[_0xcdbc('0x48')](_0x28b511['model'],_0x28b511['query']);_0x3f2ff1[_0xcdbc('0x49')]=_['intersection'](_0x28b511['model'],qs[_0xcdbc('0x4a')](_0x51395e[_0xcdbc('0x47')][_0xcdbc('0x4a')]));_0x3f2ff1[_0xcdbc('0x49')]=_0x3f2ff1['attributes'][_0xcdbc('0x4b')]?_0x3f2ff1[_0xcdbc('0x49')]:_0x28b511['model'];if(!_0x51395e[_0xcdbc('0x47')]['hasOwnProperty'](_0xcdbc('0x4c'))){_0x3f2ff1[_0xcdbc('0x2f')]=qs[_0xcdbc('0x2f')](_0x51395e[_0xcdbc('0x47')][_0xcdbc('0x2f')]);_0x3f2ff1[_0xcdbc('0x2e')]=qs[_0xcdbc('0x2e')](_0x51395e[_0xcdbc('0x47')][_0xcdbc('0x2e')]);}_0x3f2ff1[_0xcdbc('0x4d')]=qs[_0xcdbc('0x4e')](_0x51395e['query']['sort']);_0x3f2ff1['where']=qs[_0xcdbc('0x4f')](_[_0xcdbc('0x50')](_0x51395e[_0xcdbc('0x47')],_0x28b511[_0xcdbc('0x4f')]),_0x53d5af);if(_0x51395e[_0xcdbc('0x47')][_0xcdbc('0x51')]){_0x3f2ff1[_0xcdbc('0x52')]=_[_0xcdbc('0x53')](_0x3f2ff1['where'],{'$or':_['map'](_0x53d5af,function(_0x5bb2bd){if(_0x5bb2bd[_0xcdbc('0x44')]!==_0xcdbc('0x54')){var _0x4e9064={};_0x4e9064[_0x5bb2bd['name']]={'$like':'%'+_0x51395e[_0xcdbc('0x47')][_0xcdbc('0x51')]+'%'};return _0x4e9064;}})});}_0x3f2ff1=_['merge']({},_0x3f2ff1,_0x51395e[_0xcdbc('0x55')]);var _0x275d19={'where':_0x3f2ff1[_0xcdbc('0x52')]};return db['SmsAccount'][_0xcdbc('0x2d')](_0x275d19)[_0xcdbc('0x21')](function(_0x224fcf){_0x12eb13[_0xcdbc('0x2d')]=_0x224fcf;if(_0x51395e[_0xcdbc('0x47')]['includeAll']){_0x3f2ff1['include']=[{'all':!![]}];}return db[_0xcdbc('0x42')][_0xcdbc('0x56')](_0x3f2ff1);})['then'](function(_0x3971aa){_0x12eb13[_0xcdbc('0x57')]=_0x3971aa;return _0x12eb13;})[_0xcdbc('0x21')](respondWithFilteredResult(_0xb8e327,_0x3f2ff1))['catch'](handleError(_0xb8e327,null));};exports[_0xcdbc('0x58')]=function(_0x1a4619,_0x3e6014){var _0x563894={'raw':![],'where':{'id':_0x1a4619[_0xcdbc('0x59')]['id']},'include':[{'model':db[_0xcdbc('0x3f')],'as':_0xcdbc('0x40')}]},_0x524810={};_0x524810['model']=_[_0xcdbc('0x46')](db[_0xcdbc('0x42')][_0xcdbc('0x5a')]);_0x524810['query']=_[_0xcdbc('0x46')](_0x1a4619[_0xcdbc('0x47')]);_0x524810['filters']=_[_0xcdbc('0x48')](_0x524810[_0xcdbc('0x5b')],_0x524810[_0xcdbc('0x47')]);_0x563894[_0xcdbc('0x49')]=_[_0xcdbc('0x48')](_0x524810[_0xcdbc('0x5b')],qs['fields'](_0x1a4619[_0xcdbc('0x47')]['fields']));_0x563894['attributes']=_0x563894['attributes'][_0xcdbc('0x4b')]?_0x563894[_0xcdbc('0x49')]:_0x524810[_0xcdbc('0x5b')];if(_0x1a4619[_0xcdbc('0x47')][_0xcdbc('0x5c')]){_0x563894['include']=[{'all':!![]}];}_0x563894=_[_0xcdbc('0x53')]({},_0x563894,_0x1a4619[_0xcdbc('0x55')]);return db['SmsAccount'][_0xcdbc('0x5d')](_0x563894)[_0xcdbc('0x21')](handleEntityNotFound(_0x3e6014,null))[_0xcdbc('0x21')](respondWithResult(_0x3e6014,null))[_0xcdbc('0x5e')](handleError(_0x3e6014,null));};exports[_0xcdbc('0x5f')]=function(_0x1dd031,_0x5d4f99){return db[_0xcdbc('0x42')][_0xcdbc('0x5f')](_0x1dd031['body'],{})[_0xcdbc('0x21')](function(_0x3e43cb){var _0x21bf8f=_0x1dd031[_0xcdbc('0x60')]['get']({'plain':!![]});if(!_0x21bf8f)throw new Error(_0xcdbc('0x61'));if(_0x21bf8f[_0xcdbc('0x62')]===_0xcdbc('0x60')){var _0x513a92=_0x3e43cb[_0xcdbc('0x37')]({'plain':!![]});var _0x54fff1=_0xcdbc('0x38');return db[_0xcdbc('0x63')][_0xcdbc('0x5d')]({'where':{'name':_0x54fff1,'userProfileId':_0x21bf8f[_0xcdbc('0x64')]},'raw':!![]})[_0xcdbc('0x21')](function(_0xae9de8){if(_0xae9de8&&_0xae9de8[_0xcdbc('0x65')]===0x0){return db['UserProfileResource'][_0xcdbc('0x5f')]({'name':_0x513a92[_0xcdbc('0x3c')],'resourceId':_0x513a92['id'],'type':_0xae9de8[_0xcdbc('0x3c')],'sectionId':_0xae9de8['id']},{})[_0xcdbc('0x21')](function(){return _0x3e43cb;});}else{return _0x3e43cb;}})[_0xcdbc('0x5e')](function(_0x273d57){logger[_0xcdbc('0x25')](_0xcdbc('0x66'),_0x273d57);throw _0x273d57;});}return _0x3e43cb;})[_0xcdbc('0x21')](respondWithResult(_0x5d4f99,0xc9))[_0xcdbc('0x5e')](handleError(_0x5d4f99,null));};exports[_0xcdbc('0x35')]=function(_0x3ce06a,_0x1a64b7){if(_0x3ce06a[_0xcdbc('0x67')]['id']){delete _0x3ce06a[_0xcdbc('0x67')]['id'];}return db[_0xcdbc('0x42')][_0xcdbc('0x5d')]({'where':{'id':_0x3ce06a[_0xcdbc('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0xcdbc('0x40')}]})[_0xcdbc('0x21')](handleEntityNotFound(_0x1a64b7,null))[_0xcdbc('0x21')](saveUpdates(_0x3ce06a[_0xcdbc('0x67')],null))[_0xcdbc('0x21')](respondWithResult(_0x1a64b7,null))[_0xcdbc('0x5e')](handleError(_0x1a64b7,null));};exports[_0xcdbc('0x36')]=function(_0x546f25,_0x5b1f95){return db[_0xcdbc('0x42')][_0xcdbc('0x5d')]({'where':{'id':_0x546f25['params']['id']}})[_0xcdbc('0x21')](handleEntityNotFound(_0x5b1f95,null))[_0xcdbc('0x21')](removeEntity(_0x5b1f95,null))['catch'](handleError(_0x5b1f95,null));};exports[_0xcdbc('0x68')]=function(_0x300617,_0x24ae98){return db[_0xcdbc('0x42')]['describe']()[_0xcdbc('0x21')](respondWithResult(_0x24ae98,null))['catch'](handleError(_0x24ae98,null));};exports['addDisposition']=function(_0x275626,_0x26e305,_0xf9da7f){if(_0x275626[_0xcdbc('0x67')]['id']){delete _0x275626[_0xcdbc('0x67')]['id'];}return db[_0xcdbc('0x42')][_0xcdbc('0x5d')]({'where':{'id':_0x275626[_0xcdbc('0x59')]['id']}})['then'](handleEntityNotFound(_0x26e305,null))[_0xcdbc('0x21')](function(_0x36b495){if(_0x36b495){_0x275626[_0xcdbc('0x67')][_0xcdbc('0x69')]=_0x36b495['id'];return db[_0xcdbc('0x6a')][_0xcdbc('0x5f')](_0x275626[_0xcdbc('0x67')]);}})[_0xcdbc('0x21')](respondWithResult(_0x26e305,null))[_0xcdbc('0x5e')](handleError(_0x26e305,null));};exports[_0xcdbc('0x6b')]=function(_0xdf8091,_0x22a43a,_0x20427d){var _0x55c79e={'raw':![],'where':{}};var _0x2bbe2e={};var _0x2cbfb1={'count':0x0,'rows':[]};return db[_0xcdbc('0x42')][_0xcdbc('0x6c')]({'where':{'id':_0xdf8091[_0xcdbc('0x59')]['id']}})[_0xcdbc('0x21')](handleEntityNotFound(_0x22a43a,null))[_0xcdbc('0x21')](function(_0x32a848){if(_0x32a848){_0x2bbe2e[_0xcdbc('0x5b')]=_['keys'](db[_0xcdbc('0x6a')][_0xcdbc('0x5a')]);_0x2bbe2e[_0xcdbc('0x47')]=_['keys'](_0xdf8091[_0xcdbc('0x47')]);_0x2bbe2e['filters']=_[_0xcdbc('0x48')](_0x2bbe2e['model'],_0x2bbe2e[_0xcdbc('0x47')]);_0x55c79e[_0xcdbc('0x49')]=_['intersection'](_0x2bbe2e['model'],qs[_0xcdbc('0x4a')](_0xdf8091['query'][_0xcdbc('0x4a')]));_0x55c79e['attributes']=_0x55c79e[_0xcdbc('0x49')][_0xcdbc('0x4b')]?_0x55c79e['attributes']:_0x2bbe2e['model'];if(!_0xdf8091[_0xcdbc('0x47')]['hasOwnProperty'](_0xcdbc('0x4c'))){_0x55c79e[_0xcdbc('0x2f')]=qs[_0xcdbc('0x2f')](_0xdf8091[_0xcdbc('0x47')][_0xcdbc('0x2f')]);_0x55c79e[_0xcdbc('0x2e')]=qs[_0xcdbc('0x2e')](_0xdf8091[_0xcdbc('0x47')][_0xcdbc('0x2e')]);}_0x55c79e[_0xcdbc('0x4d')]=qs[_0xcdbc('0x4e')](_0xdf8091[_0xcdbc('0x47')]['sort']);_0x55c79e[_0xcdbc('0x52')]=qs[_0xcdbc('0x4f')](_[_0xcdbc('0x50')](_0xdf8091[_0xcdbc('0x47')],_0x2bbe2e['filters']));_0x55c79e[_0xcdbc('0x52')][_0xcdbc('0x69')]=_0x32a848['id'];if(_0xdf8091[_0xcdbc('0x47')][_0xcdbc('0x51')]){_0x55c79e[_0xcdbc('0x52')]=_[_0xcdbc('0x53')](_0x55c79e[_0xcdbc('0x52')],{'$or':_['map'](_0x55c79e[_0xcdbc('0x49')],function(_0x2a8aa2){var _0x2ac811={};_0x2ac811[_0x2a8aa2]={'$like':'%'+_0xdf8091[_0xcdbc('0x47')][_0xcdbc('0x51')]+'%'};return _0x2ac811;})});}_0x55c79e=_[_0xcdbc('0x53')]({},_0x55c79e,_0xdf8091[_0xcdbc('0x55')]);return db[_0xcdbc('0x6a')][_0xcdbc('0x2d')]({'where':_0x55c79e['where']})['then'](function(_0x52c82d){_0x2cbfb1[_0xcdbc('0x2d')]=_0x52c82d;if(_0xdf8091[_0xcdbc('0x47')]['includeAll']){_0x55c79e[_0xcdbc('0x6d')]=[{'all':!![]}];}return db[_0xcdbc('0x6a')][_0xcdbc('0x56')](_0x55c79e);})['then'](function(_0xe09cf2){_0x2cbfb1['rows']=_0xe09cf2;return _0x2cbfb1;});}})[_0xcdbc('0x21')](respondWithFilteredResult(_0x22a43a,_0x55c79e))[_0xcdbc('0x5e')](handleError(_0x22a43a,null));};exports[_0xcdbc('0x6e')]=function(_0x1a0d35,_0x11dfdf,_0x4482ae){return db[_0xcdbc('0x42')]['find']({'where':{'id':_0x1a0d35[_0xcdbc('0x59')]['id']}})[_0xcdbc('0x21')](handleEntityNotFound(_0x11dfdf,null))[_0xcdbc('0x21')](function(_0xc295e1){if(_0xc295e1){return _0xc295e1['removeDispositions'](_0x1a0d35[_0xcdbc('0x47')][_0xcdbc('0x6f')]);}})['then'](respondWithStatusCode(_0x11dfdf,null))[_0xcdbc('0x5e')](handleError(_0x11dfdf,null));};exports['addAnswer']=function(_0x28498f,_0x4cf3a7,_0x5d68f9){if(_0x28498f[_0xcdbc('0x67')]['id']){delete _0x28498f[_0xcdbc('0x67')]['id'];}return db[_0xcdbc('0x42')]['find']({'where':{'id':_0x28498f[_0xcdbc('0x59')]['id']}})[_0xcdbc('0x21')](handleEntityNotFound(_0x4cf3a7,null))[_0xcdbc('0x21')](function(_0x272a42){if(_0x272a42){_0x28498f[_0xcdbc('0x67')][_0xcdbc('0x69')]=_0x272a42['id'];return db[_0xcdbc('0x70')][_0xcdbc('0x5f')](_0x28498f[_0xcdbc('0x67')]);}})[_0xcdbc('0x21')](respondWithResult(_0x4cf3a7,null))[_0xcdbc('0x5e')](handleError(_0x4cf3a7,null));};exports[_0xcdbc('0x71')]=function(_0x331a31,_0x4c421e,_0x1b87bf){var _0x3e91c9={'raw':![],'where':{}};var _0x1956c0={};var _0x38719b={'count':0x0,'rows':[]};return db[_0xcdbc('0x42')][_0xcdbc('0x6c')]({'where':{'id':_0x331a31[_0xcdbc('0x59')]['id']}})[_0xcdbc('0x21')](handleEntityNotFound(_0x4c421e,null))[_0xcdbc('0x21')](function(_0x2a9f29){if(_0x2a9f29){_0x1956c0[_0xcdbc('0x5b')]=_[_0xcdbc('0x46')](db[_0xcdbc('0x70')][_0xcdbc('0x5a')]);_0x1956c0[_0xcdbc('0x47')]=_[_0xcdbc('0x46')](_0x331a31[_0xcdbc('0x47')]);_0x1956c0['filters']=_[_0xcdbc('0x48')](_0x1956c0['model'],_0x1956c0['query']);_0x3e91c9[_0xcdbc('0x49')]=_[_0xcdbc('0x48')](_0x1956c0[_0xcdbc('0x5b')],qs[_0xcdbc('0x4a')](_0x331a31[_0xcdbc('0x47')]['fields']));_0x3e91c9['attributes']=_0x3e91c9['attributes'][_0xcdbc('0x4b')]?_0x3e91c9[_0xcdbc('0x49')]:_0x1956c0[_0xcdbc('0x5b')];if(!_0x331a31['query'][_0xcdbc('0x72')](_0xcdbc('0x4c'))){_0x3e91c9['limit']=qs[_0xcdbc('0x2f')](_0x331a31[_0xcdbc('0x47')]['limit']);_0x3e91c9[_0xcdbc('0x2e')]=qs[_0xcdbc('0x2e')](_0x331a31[_0xcdbc('0x47')][_0xcdbc('0x2e')]);}_0x3e91c9[_0xcdbc('0x4d')]=qs['sort'](_0x331a31[_0xcdbc('0x47')][_0xcdbc('0x4e')]);_0x3e91c9[_0xcdbc('0x52')]=qs[_0xcdbc('0x4f')](_['pick'](_0x331a31['query'],_0x1956c0[_0xcdbc('0x4f')]));_0x3e91c9[_0xcdbc('0x52')][_0xcdbc('0x69')]=_0x2a9f29['id'];if(_0x331a31[_0xcdbc('0x47')]['filter']){_0x3e91c9['where']=_[_0xcdbc('0x53')](_0x3e91c9[_0xcdbc('0x52')],{'$or':_[_0xcdbc('0x41')](_0x3e91c9['attributes'],function(_0x390f72){var _0x5d7251={};_0x5d7251[_0x390f72]={'$like':'%'+_0x331a31[_0xcdbc('0x47')][_0xcdbc('0x51')]+'%'};return _0x5d7251;})});}_0x3e91c9=_[_0xcdbc('0x53')]({},_0x3e91c9,_0x331a31[_0xcdbc('0x55')]);return db[_0xcdbc('0x70')][_0xcdbc('0x2d')]({'where':_0x3e91c9[_0xcdbc('0x52')]})[_0xcdbc('0x21')](function(_0x56ed39){_0x38719b['count']=_0x56ed39;if(_0x331a31[_0xcdbc('0x47')]['includeAll']){_0x3e91c9[_0xcdbc('0x6d')]=[{'all':!![]}];}return db[_0xcdbc('0x70')]['findAll'](_0x3e91c9);})['then'](function(_0x1cdae0){_0x38719b[_0xcdbc('0x57')]=_0x1cdae0;return _0x38719b;});}})[_0xcdbc('0x21')](respondWithFilteredResult(_0x4c421e,_0x3e91c9))[_0xcdbc('0x5e')](handleError(_0x4c421e,null));};exports[_0xcdbc('0x73')]=function(_0x4c933b,_0x27d18f,_0x171ba2){return db['SmsAccount'][_0xcdbc('0x5d')]({'where':{'id':_0x4c933b[_0xcdbc('0x59')]['id']}})[_0xcdbc('0x21')](handleEntityNotFound(_0x27d18f,null))[_0xcdbc('0x21')](function(_0x50090b){if(_0x50090b){return _0x50090b[_0xcdbc('0x73')](_0x4c933b['query']['ids']);}})[_0xcdbc('0x21')](respondWithStatusCode(_0x27d18f,null))[_0xcdbc('0x5e')](handleError(_0x27d18f,null));};exports[_0xcdbc('0x74')]=function(_0x5704dd,_0x2c4407,_0x357c){var _0x59e039={'channel':_0xcdbc('0x75')};var _0x42a053=[];var _0x5dfeca=[];var _0x8d7e4c={};return db[_0xcdbc('0x42')][_0xcdbc('0x5d')]({'where':{'id':_0x5704dd['params']['id']},'include':[{'model':db[_0xcdbc('0x76')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x2c4407,null))[_0xcdbc('0x21')](function(_0x10622f){_0x59e039[_0xcdbc('0x77')]=_0x10622f;_0x59e039[_0xcdbc('0x78')]=_[_0xcdbc('0x79')](_0x10622f[_0xcdbc('0x7a')],[_0xcdbc('0x7b')],['asc']);if(_0x59e039['account'][_0xcdbc('0x7a')]){delete _0x59e039[_0xcdbc('0x77')][_0xcdbc('0x7a')];}return db[_0xcdbc('0x7c')]['describe']();})[_0xcdbc('0x21')](function(_0x123237){if(!_0x123237){throw new db[(_0xcdbc('0x7d'))][(_0xcdbc('0x7e'))]('no\x20available\x20attributes');}_0x42a053=_['difference'](_[_0xcdbc('0x46')](_0x123237),[_0xcdbc('0x7f'),_0xcdbc('0x80')]);_0x5dfeca=_[_0xcdbc('0x81')](_[_0xcdbc('0x46')](_0x123237),['createdAt',_0xcdbc('0x80'),_0xcdbc('0x82'),_0xcdbc('0x83')]);_0x59e039['body']={'mapKey':'mobile'};if(_0x59e039[_0xcdbc('0x77')][_0xcdbc('0x44')]){switch(_0x59e039[_0xcdbc('0x77')]['type']){case'twilio':_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x84')]=_0x5704dd[_0xcdbc('0x67')][_0xcdbc('0x85')];_0x59e039[_0xcdbc('0x67')]['body']=_0x5704dd['body']['Body'];_0x59e039['body']['messageId']=_0x5704dd[_0xcdbc('0x67')][_0xcdbc('0x86')];break;case _0xcdbc('0x87'):_0x59e039[_0xcdbc('0x67')]['from']='+'+_0x5704dd[_0xcdbc('0x67')][_0xcdbc('0x88')];_0x59e039['body'][_0xcdbc('0x67')]=_0x5704dd[_0xcdbc('0x67')]['text'];break;case'connectel':_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x84')]=_0x5704dd['body'][_0xcdbc('0x84')];_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x67')]=_0x5704dd[_0xcdbc('0x67')][_0xcdbc('0x28')];break;case _0xcdbc('0x89'):_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x84')]=_0x5704dd[_0xcdbc('0x67')][_0xcdbc('0x84')];_0x59e039[_0xcdbc('0x67')]['body']=_0x5704dd[_0xcdbc('0x67')]['body'];_0x59e039['body'][_0xcdbc('0x8a')]=_0x5704dd[_0xcdbc('0x67')][_0xcdbc('0x8b')];break;case _0xcdbc('0x8c'):_0x59e039['body'][_0xcdbc('0x84')]=_0x5704dd[_0xcdbc('0x67')][_0xcdbc('0x85')];_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x67')]=_0x5704dd[_0xcdbc('0x67')]['Text'];_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x8a')]=_0x5704dd[_0xcdbc('0x67')][_0xcdbc('0x8d')];break;case _0xcdbc('0x8e'):_0x59e039['body'][_0xcdbc('0x84')]='+'+_0x5704dd[_0xcdbc('0x67')][_0xcdbc('0x8f')][0x0][_0xcdbc('0x84')];_0x59e039['body'][_0xcdbc('0x67')]=_0x5704dd['body'][_0xcdbc('0x8f')][0x0][_0xcdbc('0x90')];_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x8a')]=_0x5704dd[_0xcdbc('0x67')][_0xcdbc('0x8f')][0x0][_0xcdbc('0x8a')];break;case _0xcdbc('0x91'):_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x84')]=_0x5704dd[_0xcdbc('0x67')]['originatingAddress'];_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x67')]=_0x5704dd['body'][_0xcdbc('0x92')][_0xcdbc('0x28')];break;case'clickatell':_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x84')]=_0x5704dd['body']['fromNumber'];_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x67')]=_0x5704dd['body'][_0xcdbc('0x90')];_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x8a')]=_0x5704dd['body'][_0xcdbc('0x93')];break;case _0xcdbc('0x94'):_0x59e039['body']['messageId']=_0x5704dd[_0xcdbc('0x67')][0x0]['message']['id'];_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x84')]=_0x5704dd['body'][0x0]['message'][_0xcdbc('0x84')];_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x67')]=_0x5704dd[_0xcdbc('0x67')][0x0][_0xcdbc('0x28')]['text'];break;case _0xcdbc('0x95'):_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x84')]=_0x5704dd[_0xcdbc('0x67')][_0xcdbc('0x84')];_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x67')]=_0x5704dd['body']['message'];_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x8a')]=_0x5704dd[_0xcdbc('0x67')][_0xcdbc('0x96')];break;}}if(_0x59e039['body']['id']){delete _0x59e039['body']['id'];}if(_[_0xcdbc('0x97')](_0x59e039[_0xcdbc('0x67')]['from'])){throw new db[(_0xcdbc('0x7d'))][(_0xcdbc('0x7e'))](_0xcdbc('0x98'));}if(_['isNil'](_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x67')])||_0x59e039['body'][_0xcdbc('0x67')]===''){throw new db[(_0xcdbc('0x7d'))][(_0xcdbc('0x7e'))](_0xcdbc('0x99'));}if(_[_0xcdbc('0x97')](_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x9a')])){throw new db[(_0xcdbc('0x7d'))][(_0xcdbc('0x7e'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5dfeca);}if(!_[_0xcdbc('0x9b')](_0x5dfeca,_0x59e039['body']['mapKey'])){throw new db[(_0xcdbc('0x7d'))][(_0xcdbc('0x7e'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5dfeca);}_0x8d7e4c[_0x59e039[_0xcdbc('0x67')]['mapKey']]=_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x84')];return db[_0xcdbc('0x9c')]['find']({'where':{'id':_0x59e039[_0xcdbc('0x77')][_0xcdbc('0x83')]},'include':[{'model':db[_0xcdbc('0x7c')],'as':_0xcdbc('0x9d'),'where':_0x8d7e4c,'limit':0x1,'order':[['updatedAt',_0xcdbc('0x9e')]]}]});})[_0xcdbc('0x21')](handleEntityNotFound(_0x2c4407,null))['then'](function(_0x3b52fc){if(_0x3b52fc){_0x59e039[_0xcdbc('0x9f')]=_[_0xcdbc('0xa0')](_0x3b52fc,['Contacts']);if(_0x3b52fc[_0xcdbc('0x9d')]['length']){return _0x3b52fc[_0xcdbc('0x9d')][0x0];}var _0x54ac8f=_[_0xcdbc('0x1b')](_0x59e039[_0xcdbc('0x67')],{'firstName':_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x84')],'ListId':_0x3b52fc['id']});_0x54ac8f[_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x9a')]]=_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x84')];return db[_0xcdbc('0x7c')][_0xcdbc('0x5f')](_0x54ac8f,{'fields':_0x42a053,'raw':!![]});}})[_0xcdbc('0x21')](handleEntityNotFound(_0x2c4407,null))[_0xcdbc('0x21')](function(_0x4ca1a8){if(_0x4ca1a8){_0x59e039['contact']=_0x4ca1a8;var _0x2d9c81={'ContactId':_0x4ca1a8['id'],'phone':_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x84')],'SmsAccountId':_0x5704dd[_0xcdbc('0x59')]['id']};var _0x94d561={'ContactId':_0x4ca1a8['id'],'SmsAccountId':_0x5704dd[_0xcdbc('0x59')]['id'],'closed':![]};return db[_0xcdbc('0xa1')]['find']({'where':_0x94d561})[_0xcdbc('0x21')](function(_0x389228){if(_0x389228){return[_0x389228,![]];}return db[_0xcdbc('0xa1')][_0xcdbc('0x5f')](_0x2d9c81)[_0xcdbc('0x21')](function(_0x2a4adc){return[_0x2a4adc,!![]];});});}})['spread'](function(_0x105c37,_0x3be347){_0x59e039['interaction']=_0x105c37[_0xcdbc('0x37')]({'plain':!![]});_0x59e039[_0xcdbc('0xa2')][_0xcdbc('0xa3')]=![];if(_0x3be347){if(_0x59e039[_0xcdbc('0x77')][_0xcdbc('0xa4')]){_0x59e039[_0xcdbc('0x78')][_0xcdbc('0xa5')]({'id':0x0,'priority':_0x59e039['applications'][_0xcdbc('0x4b')]+0x1,'app':_0xcdbc('0xa6'),'appdata':'unmanaged','interval':_0xcdbc('0xa7')});}_0x59e039[_0xcdbc('0xa2')]['created']=!![];}return db['SmsMessage'][_0xcdbc('0x5f')]({'phone':_0x59e039['body'][_0xcdbc('0x84')],'messageId':_0x59e039[_0xcdbc('0x67')]['messageId'],'body':_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x67')],'SmsAccountId':_0x5704dd[_0xcdbc('0x59')]['id'],'SmsInteractionId':_0x105c37['id'],'direction':'in','ContactId':_0x105c37[_0xcdbc('0xa8')],'AttachmentId':_0x59e039['body'][_0xcdbc('0xa9')]});})['then'](function(_0x59a522){_0x59e039[_0xcdbc('0x28')]=_0x59a522;if(!_0x59e039[_0xcdbc('0xa2')][_0xcdbc('0xaa')])return;return db[_0xcdbc('0xab')][_0xcdbc('0x5d')]({'attributes':['id','name'],'where':{'id':_0x59e039[_0xcdbc('0xa2')][_0xcdbc('0xaa')]}});})[_0xcdbc('0x21')](function(_0x2ee1e0){if(_0x2ee1e0){_0x59e039[_0xcdbc('0x78')][_0xcdbc('0xac')]({'id':0x0,'priority':0x0,'app':_0xcdbc('0xad'),'appdata':_0x2ee1e0[_0xcdbc('0x3c')]+','+(_0x59e039[_0xcdbc('0x77')][_0xcdbc('0xae')]||0xa),'interval':_0xcdbc('0xa7')});}if(!_0x59e039[_0xcdbc('0xa2')][_0xcdbc('0xaf')])return;return db[_0xcdbc('0xb0')][_0xcdbc('0x5d')]({'attributes':['id',_0xcdbc('0x3c')],'where':{'id':_0x59e039['interaction']['queueId']}});})[_0xcdbc('0x21')](function(_0x3ab0d2){if(_0x3ab0d2){_0x59e039['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0xcdbc('0xb1'),'appdata':_0x3ab0d2['name']+','+(_0x59e039['account']['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xcdbc('0xb2'),_0xcdbc('0xb3'),_0x59e039);})['then'](function(_0x69e00e){if(_0x69e00e){var _0x1a82df=0xc8;var _0x3385ca=_0xcdbc('0xb4');logger[_0xcdbc('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3385ca,_0x1a82df,'entity\x20found');logger[_0xcdbc('0xb5')](_0xcdbc('0xb6'),_0x3385ca,_0x1a82df,_0xcdbc('0xb7'),JSON[_0xcdbc('0xb8')](_0x69e00e));if(_0x59e039['account'][_0xcdbc('0x44')]===_0xcdbc('0xb9')){return _0x2c4407[_0xcdbc('0x2b')](_0x1a82df)[_0xcdbc('0xba')](_0xcdbc('0xbb'),_0xcdbc('0xbc'))['send']('\x0a');}else{return _0x2c4407[_0xcdbc('0x2b')](_0x1a82df)[_0xcdbc('0x31')](_0x69e00e);}}})[_0xcdbc('0x5e')](handleError(_0x2c4407,null));};exports['addApplications']=function(_0x41419a,_0x2e7122){var _0x522d7b=_0x41419a[_0xcdbc('0x59')]['id'];var _0x522058=_0x41419a[_0xcdbc('0x67')];var _0x429f18=0xc8;var _0x52081e=null;return db[_0xcdbc('0xbd')][_0xcdbc('0xbe')]({'isolationLevel':db[_0xcdbc('0xbd')][_0xcdbc('0xbf')][_0xcdbc('0xc0')][_0xcdbc('0xc1')]},function(_0xcc51f8){return db['SmsAccount'][_0xcdbc('0x6c')]({'where':{'id':_0x522d7b},'transaction':_0xcc51f8})[_0xcdbc('0x21')](function(_0x263646){if(_0x263646){return db[_0xcdbc('0x76')]['destroy']({'where':{'SmsAccountId':_0x522d7b},'transaction':_0xcc51f8})['then'](function(){var _0x253910=_[_0xcdbc('0x41')](_0x522058,function(_0x5bc0fa){_0x5bc0fa[_0xcdbc('0x69')]=_0x522d7b;return _0x5bc0fa;});return db[_0xcdbc('0x76')][_0xcdbc('0xc2')](_0x253910,{'transaction':_0xcc51f8});});}else{_0x429f18=0x194;_0x52081e=[];}});})[_0xcdbc('0x21')](function(){if(_0x429f18!==0x194){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x522d7b},'order':'priority'})[_0xcdbc('0x21')](function(_0x5a48ec){_0x52081e=_0x5a48ec;});}})[_0xcdbc('0x5e')](function(_0x1f3554){_0x429f18=0x1f4;logger['error'](_0x1f3554[_0xcdbc('0x3b')]);if(_0x1f3554['name']){delete _0x1f3554[_0xcdbc('0x3c')];}_0x52081e=_0x1f3554;})[_0xcdbc('0xc3')](function(){if(_0x52081e===null){_0x2e7122[_0xcdbc('0x2a')](_0x429f18);}else{if(_0x429f18===0x1f4){_0x2e7122[_0xcdbc('0x2b')](_0x429f18)[_0xcdbc('0x3d')](_0x52081e);}else{_0x2e7122[_0xcdbc('0x2b')](_0x429f18)[_0xcdbc('0x31')](_0x52081e);}}});};exports[_0xcdbc('0xc4')]=function(_0x599b93,_0x4b6d43,_0xa4f118){var _0x4d75d1={};var _0x8d806a={};var _0x41eb12;var _0x51f76f;return db[_0xcdbc('0x42')][_0xcdbc('0x6c')]({'where':{'id':_0x599b93['params']['id']}})[_0xcdbc('0x21')](handleEntityNotFound(_0x4b6d43,null))[_0xcdbc('0x21')](function(_0x4ea2a4){if(_0x4ea2a4){_0x41eb12=_0x4ea2a4;_0x8d806a['model']=_[_0xcdbc('0x46')](db[_0xcdbc('0x76')][_0xcdbc('0x5a')]);_0x8d806a[_0xcdbc('0x47')]=_['keys'](_0x599b93[_0xcdbc('0x47')]);_0x8d806a['filters']=_[_0xcdbc('0x48')](_0x8d806a[_0xcdbc('0x5b')],_0x8d806a['query']);_0x4d75d1[_0xcdbc('0x49')]=_[_0xcdbc('0x48')](_0x8d806a[_0xcdbc('0x5b')],qs[_0xcdbc('0x4a')](_0x599b93[_0xcdbc('0x47')][_0xcdbc('0x4a')]));_0x4d75d1[_0xcdbc('0x49')]=_0x4d75d1[_0xcdbc('0x49')][_0xcdbc('0x4b')]?_0x4d75d1[_0xcdbc('0x49')]:_0x8d806a['model'];_0x4d75d1[_0xcdbc('0x4d')]=qs[_0xcdbc('0x4e')](_0x599b93[_0xcdbc('0x47')][_0xcdbc('0x4e')]);_0x4d75d1['where']=qs[_0xcdbc('0x4f')](_[_0xcdbc('0x50')](_0x599b93[_0xcdbc('0x47')],_0x8d806a[_0xcdbc('0x4f')]));if(_0x599b93[_0xcdbc('0x47')]['filter']){_0x4d75d1[_0xcdbc('0x52')]=_[_0xcdbc('0x53')](_0x4d75d1['where'],{'$or':_[_0xcdbc('0x41')](_0x4d75d1['attributes'],function(_0x31e6ce){var _0x366975={};_0x366975[_0x31e6ce]={'$like':'%'+_0x599b93[_0xcdbc('0x47')][_0xcdbc('0x51')]+'%'};return _0x366975;})});}_0x4d75d1=_[_0xcdbc('0x53')]({},_0x4d75d1,_0x599b93['options']);return _0x41eb12[_0xcdbc('0xc4')](_0x4d75d1);}})[_0xcdbc('0x21')](function(_0x5dabb8){if(_0x5dabb8){_0x51f76f=_0x5dabb8['length'];if(!_0x599b93['query'][_0xcdbc('0x72')](_0xcdbc('0x4c'))){_0x4d75d1['limit']=qs['limit'](_0x599b93['query'][_0xcdbc('0x2f')]);_0x4d75d1[_0xcdbc('0x2e')]=qs[_0xcdbc('0x2e')](_0x599b93[_0xcdbc('0x47')]['offset']);}return _0x41eb12[_0xcdbc('0xc4')](_0x4d75d1);}})[_0xcdbc('0x21')](function(_0xa995a2){if(_0xa995a2){return _0xa995a2?{'count':_0x51f76f,'rows':_0xa995a2}:null;}})[_0xcdbc('0x21')](respondWithResult(_0x4b6d43,null))['catch'](handleError(_0x4b6d43,null));};exports[_0xcdbc('0xc5')]=function(_0x49bb32,_0x321291,_0x1efd6c){var _0x20fa6b={'raw':![],'where':{}};var _0x3b9cae={};var _0x27ed07={'count':0x0,'rows':[]};return db['SmsAccount'][_0xcdbc('0x6c')]({'where':{'id':_0x49bb32['params']['id']}})['then'](handleEntityNotFound(_0x321291,null))['then'](function(_0x42e8e8){if(_0x42e8e8){_0x3b9cae['model']=_[_0xcdbc('0x46')](db[_0xcdbc('0xa1')][_0xcdbc('0x5a')]);_0x3b9cae['query']=_['keys'](_0x49bb32['query']);_0x3b9cae[_0xcdbc('0x4f')]=_[_0xcdbc('0x48')](_0x3b9cae[_0xcdbc('0x5b')],_0x3b9cae[_0xcdbc('0x47')]);_0x20fa6b[_0xcdbc('0x49')]=_['intersection'](_0x3b9cae[_0xcdbc('0x5b')],qs[_0xcdbc('0x4a')](_0x49bb32['query']['fields']));_0x20fa6b['attributes']=_0x20fa6b['attributes'][_0xcdbc('0x4b')]?_0x20fa6b[_0xcdbc('0x49')]:_0x3b9cae[_0xcdbc('0x5b')];if(!_0x49bb32[_0xcdbc('0x47')][_0xcdbc('0x72')](_0xcdbc('0x4c'))){_0x20fa6b[_0xcdbc('0x2f')]=qs[_0xcdbc('0x2f')](_0x49bb32[_0xcdbc('0x47')][_0xcdbc('0x2f')]);_0x20fa6b[_0xcdbc('0x2e')]=qs[_0xcdbc('0x2e')](_0x49bb32[_0xcdbc('0x47')]['offset']);}_0x20fa6b['order']=qs[_0xcdbc('0x4e')](_0x49bb32['query']['sort']);_0x20fa6b['where']=qs[_0xcdbc('0x4f')](_[_0xcdbc('0x50')](_0x49bb32['query'],_0x3b9cae[_0xcdbc('0x4f')]));_0x20fa6b[_0xcdbc('0x52')][_0xcdbc('0x69')]=_0x42e8e8['id'];if(_0x49bb32[_0xcdbc('0x47')][_0xcdbc('0x51')]){_0x20fa6b['where']=_['merge'](_0x20fa6b[_0xcdbc('0x52')],{'$or':_[_0xcdbc('0x41')](_0x20fa6b[_0xcdbc('0x49')],function(_0x56c076){var _0x27930f={};_0x27930f[_0x56c076]={'$like':'%'+_0x49bb32[_0xcdbc('0x47')][_0xcdbc('0x51')]+'%'};return _0x27930f;})});}_0x20fa6b=_[_0xcdbc('0x53')]({},_0x20fa6b,_0x49bb32[_0xcdbc('0x55')]);return db[_0xcdbc('0xa1')][_0xcdbc('0x2d')]({'where':_0x20fa6b[_0xcdbc('0x52')]})[_0xcdbc('0x21')](function(_0x588f6c){_0x27ed07['count']=_0x588f6c;if(_0x49bb32[_0xcdbc('0x47')]['includeAll']){_0x20fa6b[_0xcdbc('0x6d')]=[{'model':db['CmContact'],'as':_0xcdbc('0xc6'),'required':![]},{'model':db[_0xcdbc('0xab')],'as':_0xcdbc('0xc7'),'attributes':[_0xcdbc('0x3c'),_0xcdbc('0xc8'),'internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0xcdbc('0xc9')],'where':_0x49bb32[_0xcdbc('0x47')][_0xcdbc('0xca')]?{'id':_0x49bb32[_0xcdbc('0x47')]['tag']}:undefined,'required':_0x49bb32[_0xcdbc('0x47')][_0xcdbc('0xca')]?!![]:![]}];}return db[_0xcdbc('0xa1')][_0xcdbc('0x56')](_0x20fa6b);})[_0xcdbc('0x21')](function(_0x50e708){_0x27ed07[_0xcdbc('0x57')]=_0x50e708;return _0x27ed07;});}})[_0xcdbc('0x21')](respondWithFilteredResult(_0x321291,_0x20fa6b))[_0xcdbc('0x5e')](handleError(_0x321291,null));};exports['send']=function(_0xbcb0b7,_0x4554a8,_0x1d5680){var _0x3eab1b,_0x5a1b42,_0xeec346;if(_[_0xcdbc('0x97')](_0xbcb0b7[_0xcdbc('0x67')][_0xcdbc('0x67')])||_0xbcb0b7[_0xcdbc('0x67')][_0xcdbc('0x67')]===''){throw new db['Sequelize'][(_0xcdbc('0x7e'))](_0xcdbc('0x99'));}if(_[_0xcdbc('0x97')](_0xbcb0b7['body']['to'])){throw new db[(_0xcdbc('0x7d'))][(_0xcdbc('0x7e'))](_0xcdbc('0xcb'));}_0x3eab1b=_0xbcb0b7['body']['to'];return db[_0xcdbc('0x42')]['find']({'where':{'id':_0xbcb0b7['params']['id']},'include':[{'model':db[_0xcdbc('0x9c')],'as':_0xcdbc('0xcc'),'include':[{'model':db[_0xcdbc('0x7c')],'as':_0xcdbc('0x9d'),'where':{'mobile':_0x3eab1b},'limit':0x1,'order':[['updatedAt',_0xcdbc('0x9e')]]}]}]})['then'](handleEntityNotFound(_0x4554a8,null))[_0xcdbc('0x21')](function(_0x6abc2a){if(_0x6abc2a&&_0x6abc2a[_0xcdbc('0xcc')]){_0x5a1b42=_0x6abc2a[_0xcdbc('0x37')]({'plain':!![]});if(_0x5a1b42[_0xcdbc('0xcc')]&&_0x5a1b42[_0xcdbc('0xcc')]['Contacts'][_0xcdbc('0x4b')]){return _0x5a1b42[_0xcdbc('0xcc')][_0xcdbc('0x9d')][0x0];}return db['CmContact'][_0xcdbc('0x5f')](_[_0xcdbc('0x1b')](_0xbcb0b7['body'],{'firstName':_0x3eab1b,'mobile':_0x3eab1b,'phone':_0x3eab1b,'ListId':_0x5a1b42[_0xcdbc('0x83')]}));}})[_0xcdbc('0x21')](handleEntityNotFound(_0x4554a8,null))['then'](function(_0x1943e5){if(_0x1943e5){_0xeec346=_0x1943e5;return db['SmsInteraction'][_0xcdbc('0x5d')]({'where':{'ContactId':_0xeec346['id'],'closed':![],'SmsAccountId':_0x5a1b42['id']}})[_0xcdbc('0x21')](function(_0x1d90c7){if(_0x1d90c7){return[_0x1d90c7,![]];}return db[_0xcdbc('0xa1')][_0xcdbc('0x5f')]({'UserId':_0xbcb0b7['user']['id'],'ContactId':_0xeec346['id'],'SmsAccountId':_0x5a1b42['id'],'phone':_0x3eab1b,'firstMsgDirection':_0xcdbc('0xcd'),'Messages':[_['merge'](_0xbcb0b7[_0xcdbc('0x67')],{'read':![],'body':_0xbcb0b7['body']['body'],'phone':_0x3eab1b,'SmsAccountId':_0x5a1b42['id'],'UserId':_0xbcb0b7[_0xcdbc('0x60')]['id'],'ContactId':_0xeec346['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xcdbc('0xce')}]})['then'](function(_0x5abb81){return[_0x5abb81,!![]];});});}})['spread'](function(_0x1f024a,_0x439a51){if(_0x439a51){return _0x1f024a;}return db[_0xcdbc('0xcf')][_0xcdbc('0x5f')](_[_0xcdbc('0x53')](_0xbcb0b7[_0xcdbc('0x67')],{'read':![],'body':_0xbcb0b7[_0xcdbc('0x67')][_0xcdbc('0x67')],'phone':_0x3eab1b,'SmsAccountId':_0x5a1b42['id'],'SmsInteractionId':_0x1f024a['id'],'UserId':_0xbcb0b7[_0xcdbc('0x60')]['id'],'ContactId':_0xeec346['id']}))[_0xcdbc('0x21')](function(_0x3154da){_0x1f024a['dataValues']['Messages']=[];_0x1f024a['dataValues'][_0xcdbc('0xce')][_0xcdbc('0xa5')](_0x3154da[_0xcdbc('0xd0')]);return _0x1f024a;});})[_0xcdbc('0x21')](respondWithResult(_0x4554a8,null))[_0xcdbc('0x5e')](handleError(_0x4554a8,null));};exports[_0xcdbc('0x2b')]=function(_0x5e72ed,_0x950e4c,_0x3ea148){if(_0x5e72ed[_0xcdbc('0x67')]['id']){delete _0x5e72ed['body']['id'];}var _0x297752,_0xa30171,_0x512fff;return db[_0xcdbc('0x42')]['find']({'where':{'id':_0x5e72ed[_0xcdbc('0x59')]['id']}})[_0xcdbc('0x21')](handleEntityNotFound(_0x950e4c,null))['then'](function(_0x34513d){if(_0x34513d){_0x512fff=_0x34513d;logger['debug'](_0xcdbc('0x24'),_0xcdbc('0x2b'),'received\x20delivery\x20report\x20from',_0x34513d[_0xcdbc('0x44')],util[_0xcdbc('0xd1')](_0x5e72ed['body'],{'showHidden':![],'depth':null}));switch(_0x34513d[_0xcdbc('0x44')]){case _0xcdbc('0x87'):if(_0x5e72ed['body'][_0xcdbc('0xd2')]&&_0x5e72ed[_0xcdbc('0x67')]['status']){_0xa30171=_0x5e72ed[_0xcdbc('0x67')]['status'];return db[_0xcdbc('0xcf')]['find']({'where':{'messageId':_0x5e72ed['body'][_0xcdbc('0xd2')]}});}break;case _0xcdbc('0xd3'):if(_0x5e72ed['body'][_0xcdbc('0xd4')]&&_0x5e72ed[_0xcdbc('0x67')][_0xcdbc('0xd5')]){_0xa30171=_0x5e72ed[_0xcdbc('0x67')][_0xcdbc('0xd5')];return db[_0xcdbc('0xcf')][_0xcdbc('0x5d')]({'where':{'messageId':_0x5e72ed[_0xcdbc('0x67')][_0xcdbc('0xd4')]}});}break;case _0xcdbc('0x89'):if(_0x5e72ed[_0xcdbc('0x67')][_0xcdbc('0x8b')]&&_0x5e72ed['body']['status_code']){_0xa30171=_0x5e72ed[_0xcdbc('0x67')][_0xcdbc('0xd6')];return db[_0xcdbc('0xcf')][_0xcdbc('0x5d')]({'where':{'messageId':_0x5e72ed['body'][_0xcdbc('0x8b')]}});}break;case _0xcdbc('0x8e'):var _0xcd687f=_0x5e72ed['body'][_0xcdbc('0x8f')][0x0];if(_0xcd687f[_0xcdbc('0x8a')]&&_0xcd687f[_0xcdbc('0x2b')]['groupName']===_0xcdbc('0xd7')){_0xa30171=_0xcd687f[_0xcdbc('0x2b')][_0xcdbc('0xd8')];return db[_0xcdbc('0xcf')][_0xcdbc('0x5d')]({'where':{'messageId':_0xcd687f[_0xcdbc('0x8a')]}});}break;case _0xcdbc('0xd9'):if(_0x5e72ed[_0xcdbc('0x67')]['messageId']&&_0x5e72ed['body'][_0xcdbc('0x2b')]){_0xa30171=_0x5e72ed[_0xcdbc('0x67')][_0xcdbc('0x2b')];return db[_0xcdbc('0xcf')]['find']({'where':{'messageId':_0x5e72ed['body'][_0xcdbc('0x8a')]}});}break;case'bandwidth':if(_0x5e72ed[_0xcdbc('0x67')][0x0]['message']['id']){_0xa30171=_0x5e72ed[_0xcdbc('0x67')][0x0][_0xcdbc('0x44')];return db['SmsMessage'][_0xcdbc('0x5d')]({'where':{'messageId':_0x5e72ed[_0xcdbc('0x67')][0x0][_0xcdbc('0x28')]['id']}});}break;case _0xcdbc('0x95'):if(_0x5e72ed[_0xcdbc('0x67')][_0xcdbc('0xda')]&&_0x5e72ed[_0xcdbc('0x67')]['status']){_0xa30171=_0x5e72ed['body'][_0xcdbc('0x2b')];return db[_0xcdbc('0xcf')][_0xcdbc('0x5d')]({'where':{'messageId':_0x5e72ed[_0xcdbc('0x67')][_0xcdbc('0xda')]}});}break;}}})[_0xcdbc('0x21')](handleEntityNotFound(_0x950e4c,null))[_0xcdbc('0x21')](function(_0x5d1dd9){if(_0x5d1dd9){_0x297752=_0x5d1dd9;switch(_0x512fff[_0xcdbc('0x44')]){case _0xcdbc('0x87'):if(_0xa30171===_0xcdbc('0xd7')){return _0x297752['update']({'read':!![]});}else{logger[_0xcdbc('0x25')](_0xcdbc('0x24'),_0xcdbc('0x2b'),_0xcdbc('0x87'),util[_0xcdbc('0xd1')](_0x5e72ed['body'],{'showHidden':![],'depth':null}));}break;case _0xcdbc('0xd3'):if(_0xa30171==='1'){return _0x297752[_0xcdbc('0x35')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xcdbc('0x2b'),_0xcdbc('0x87'),util[_0xcdbc('0xd1')](_0x5e72ed[_0xcdbc('0x67')],{'showHidden':![],'depth':null}));}break;case _0xcdbc('0x89'):if(!_0x5e72ed['body']['error_code']&&_0xa30171>=0xc8&&_0xa30171<=0xce){return _0x297752['update']({'read':!![]});}else{logger[_0xcdbc('0x25')](_0xcdbc('0x24'),_0xcdbc('0x2b'),_0xcdbc('0x89'),util[_0xcdbc('0xd1')](_0x5e72ed[_0xcdbc('0x67')],{'showHidden':![],'depth':null}));}break;case _0xcdbc('0x8e'):var _0x1d7133=_0x5e72ed[_0xcdbc('0x67')]['results'][0x0];if(_0x1d7133[_0xcdbc('0x2b')]['groupName']===_0xcdbc('0xd7')){return _0x297752['update']({'read':!![]});}else{logger[_0xcdbc('0x25')](_0xcdbc('0x24'),'status','infobip',util['inspect'](_0x5e72ed[_0xcdbc('0x67')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0xa30171=='DELIVERED_TO_GATEWAY'||_0xa30171==_0xcdbc('0xdb')){return _0x297752['update']({'read':!![]});}else{logger[_0xcdbc('0x25')](_0xcdbc('0x24'),'status','clickatell',util[_0xcdbc('0xd1')](_0x5e72ed[_0xcdbc('0x67')],{'showHidden':![],'depth':null}));}break;case _0xcdbc('0x94'):if(_0xa30171=='message-delivered'){return _0x297752[_0xcdbc('0x35')]({'read':!![]});}else{logger['error'](_0xcdbc('0x24'),_0xcdbc('0x2b'),_0xcdbc('0x94'),util[_0xcdbc('0xd1')](_0x5e72ed[_0xcdbc('0x67')],{'showHidden':![],'depth':null}));}break;case _0xcdbc('0x95'):if(_0xa30171===_0xcdbc('0xdc')||_0xa30171===_0xcdbc('0xdd')){return _0x297752[_0xcdbc('0x35')]({'read':!![]});}else{logger['error'](_0xcdbc('0x24'),_0xcdbc('0x2b'),_0xcdbc('0x95'),util[_0xcdbc('0xd1')](_0x5e72ed[_0xcdbc('0x67')],{'showHidden':![],'depth':null}));}break;}return _0x297752;}})[_0xcdbc('0x21')](respondWithResult(_0x950e4c,null))[_0xcdbc('0x5e')](handleError(_0x950e4c,null));};exports[_0xcdbc('0xde')]=function(_0x544c8d,_0x50098e,_0x4110de){var _0x5bd3f4,_0x380815,_0x31390b;return db['SmsAccount'][_0xcdbc('0x5d')]({'where':{'id':_0x544c8d[_0xcdbc('0x59')]['id']}})[_0xcdbc('0x21')](handleEntityNotFound(_0x50098e,null))[_0xcdbc('0x21')](function(_0x35fa4b){if(_0x35fa4b){_0x31390b=_0x35fa4b;logger[_0xcdbc('0xb5')](_0xcdbc('0x24'),_0xcdbc('0x2b'),'received\x20delivery\x20report\x20from',_0x35fa4b[_0xcdbc('0x44')],util[_0xcdbc('0xd1')](_0x544c8d[_0xcdbc('0x47')],{'showHidden':![],'depth':null}));switch(_0x35fa4b[_0xcdbc('0x44')]){case'csc':if(_0x544c8d[_0xcdbc('0x47')][_0xcdbc('0xdf')]&&_0x544c8d[_0xcdbc('0x47')][_0xcdbc('0xe0')]){_0x380815=_0x544c8d['query']['state'];return db[_0xcdbc('0xcf')][_0xcdbc('0x5d')]({'where':{'messageId':_0x544c8d[_0xcdbc('0x47')][_0xcdbc('0xdf')]}});}break;}}})[_0xcdbc('0x21')](handleEntityNotFound(_0x50098e,null))[_0xcdbc('0x21')](function(_0x42987f){if(_0x42987f){_0x5bd3f4=_0x42987f;switch(_0x31390b[_0xcdbc('0x44')]){case _0xcdbc('0x91'):if(_0x380815==='2'||_0x380815==='6'){return _0x5bd3f4[_0xcdbc('0x35')]({'read':!![]});}else{logger['error'](_0xcdbc('0x24'),'status',_0xcdbc('0x91'),util[_0xcdbc('0xd1')](_0x544c8d['query'],{'showHidden':![],'depth':null}));};break;}return _0x5bd3f4;}})[_0xcdbc('0x21')](respondWithResult(_0x50098e,null))[_0xcdbc('0x5e')](handleError(_0x50098e,null));};exports[_0xcdbc('0xe1')]=function(_0x4d859b,_0x28acb9,_0x144670){return db[_0xcdbc('0x42')][_0xcdbc('0x5d')]({'where':{'id':_0x4d859b[_0xcdbc('0x59')]['id']}})['then'](handleEntityNotFound(_0x28acb9,null))['then'](function(_0x4cdfec){if(_0x4cdfec){return _0x4cdfec[_0xcdbc('0xe1')](_0x4d859b[_0xcdbc('0x67')][_0xcdbc('0x6f')],_[_0xcdbc('0xa0')](_0x4d859b[_0xcdbc('0x67')],[_0xcdbc('0x6f'),'id'])||{})['spread'](function(_0x42c619){for(var _0x186aaa=0x0;_0x186aaa<_0x4d859b[_0xcdbc('0x67')][_0xcdbc('0x6f')]['length'];_0x186aaa+=0x1){socket[_0xcdbc('0xe2')](_0xcdbc('0xe3'),{'UserId':Number(_0x4d859b['body'][_0xcdbc('0x6f')][_0x186aaa]),'SmsAccountId':Number(_0x4d859b[_0xcdbc('0x59')]['id'])});}return _0x42c619;});}})[_0xcdbc('0x21')](respondWithResult(_0x28acb9,null))[_0xcdbc('0x5e')](handleError(_0x28acb9,null));};exports['removeAgents']=function(_0x1239a0,_0x3493fa,_0x5b9d2a){return db[_0xcdbc('0x42')]['find']({'where':{'id':_0x1239a0[_0xcdbc('0x59')]['id']}})[_0xcdbc('0x21')](handleEntityNotFound(_0x3493fa,null))[_0xcdbc('0x21')](function(_0x119361){if(_0x119361){return _0x119361['removeAgents'](_0x1239a0['query'][_0xcdbc('0x6f')])['then'](function(){if(_[_0xcdbc('0xe4')](_0x1239a0[_0xcdbc('0x47')][_0xcdbc('0x6f')])){for(var _0x2ae061=0x0;_0x2ae061<_0x1239a0[_0xcdbc('0x47')][_0xcdbc('0x6f')][_0xcdbc('0x4b')];_0x2ae061+=0x1){socket[_0xcdbc('0xe2')]('userSmsAccount:remove',{'UserId':Number(_0x1239a0['query'][_0xcdbc('0x6f')][_0x2ae061]),'SmsAccountId':Number(_0x1239a0[_0xcdbc('0x59')]['id'])});}}else{socket[_0xcdbc('0xe2')](_0xcdbc('0xe5'),{'UserId':Number(_0x1239a0[_0xcdbc('0x47')][_0xcdbc('0x6f')]),'SmsAccountId':Number(_0x1239a0['params']['id'])});}});}})[_0xcdbc('0x21')](respondWithStatusCode(_0x3493fa,null))[_0xcdbc('0x5e')](handleError(_0x3493fa,null));};exports['getAgents']=function(_0x2500b3,_0x356de6,_0xe3ebed){var _0x32d975={};var _0x4c5638={};var _0x1cb468;var _0x43d451;return db[_0xcdbc('0x42')][_0xcdbc('0x6c')]({'where':{'id':_0x2500b3[_0xcdbc('0x59')]['id']}})[_0xcdbc('0x21')](handleEntityNotFound(_0x356de6,null))['then'](function(_0x43bdfb){if(_0x43bdfb){_0x1cb468=_0x43bdfb;_0x4c5638[_0xcdbc('0x5b')]=_[_0xcdbc('0x46')](db['User']['rawAttributes']);_0x4c5638[_0xcdbc('0x47')]=_['keys'](_0x2500b3[_0xcdbc('0x47')]);_0x4c5638[_0xcdbc('0x4f')]=_['intersection'](_0x4c5638['model'],_0x4c5638[_0xcdbc('0x47')]);_0x32d975[_0xcdbc('0x49')]=_[_0xcdbc('0x48')](_0x4c5638[_0xcdbc('0x5b')],qs[_0xcdbc('0x4a')](_0x2500b3[_0xcdbc('0x47')][_0xcdbc('0x4a')]));_0x32d975[_0xcdbc('0x49')]=_0x32d975[_0xcdbc('0x49')][_0xcdbc('0x4b')]?_0x32d975[_0xcdbc('0x49')]:_0x4c5638[_0xcdbc('0x5b')];_0x32d975['order']=qs[_0xcdbc('0x4e')](_0x2500b3['query']['sort']);_0x32d975[_0xcdbc('0x52')]=qs[_0xcdbc('0x4f')](_[_0xcdbc('0x50')](_0x2500b3[_0xcdbc('0x47')],_0x4c5638['filters']));if(_0x2500b3['query']['filter']){_0x32d975['where']=_['merge'](_0x32d975[_0xcdbc('0x52')],{'$or':_[_0xcdbc('0x41')](_0x32d975['attributes'],function(_0xc94826){var _0x2f724f={};_0x2f724f[_0xc94826]={'$like':'%'+_0x2500b3['query'][_0xcdbc('0x51')]+'%'};return _0x2f724f;})});}_0x32d975=_[_0xcdbc('0x53')]({},_0x32d975,_0x2500b3[_0xcdbc('0x55')]);return _0x1cb468['getAgents'](_0x32d975);}})['then'](function(_0x73271f){if(_0x73271f){_0x43d451=_0x73271f['length'];if(!_0x2500b3[_0xcdbc('0x47')]['hasOwnProperty'](_0xcdbc('0x4c'))){_0x32d975[_0xcdbc('0x2f')]=qs[_0xcdbc('0x2f')](_0x2500b3[_0xcdbc('0x47')]['limit']);_0x32d975[_0xcdbc('0x2e')]=qs[_0xcdbc('0x2e')](_0x2500b3[_0xcdbc('0x47')][_0xcdbc('0x2e')]);}return _0x1cb468[_0xcdbc('0xe6')](_0x32d975);}})[_0xcdbc('0x21')](function(_0x192d8f){if(_0x192d8f){return _0x192d8f?{'count':_0x43d451,'rows':_0x192d8f}:null;}})[_0xcdbc('0x21')](respondWithResult(_0x356de6,null))[_0xcdbc('0x5e')](handleError(_0x356de6,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 3ebc0df..5262269 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 _0xd228=['events','SmsAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2f63a3,_0x23453d){var _0x2b2a22=function(_0x5b1357){while(--_0x5b1357){_0x2f63a3['push'](_0x2f63a3['shift']());}};_0x2b2a22(++_0x23453d);}(_0xd228,0x1c2));var _0x8d22=function(_0x35b87c,_0x166a8c){_0x35b87c=_0x35b87c-0x0;var _0x24795b=_0xd228[_0x35b87c];return _0x24795b;};'use strict';var EventEmitter=require(_0x8d22('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x8d22('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x8d22('0x2')](0x0);var events={'afterCreate':_0x8d22('0x3'),'afterUpdate':_0x8d22('0x4'),'afterDestroy':_0x8d22('0x5')};function emitEvent(_0x4b5fce){return function(_0x11702e,_0x41bb65,_0x5b1f16){SmsAccountEvents[_0x8d22('0x6')](_0x4b5fce+':'+_0x11702e['id'],_0x11702e);SmsAccountEvents[_0x8d22('0x6')](_0x4b5fce,_0x11702e);_0x5b1f16(null);};}for(var e in events){if(events[_0x8d22('0x7')](e)){var event=events[e];SmsAccount[_0x8d22('0x8')](e,emitEvent(event));}}module[_0x8d22('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0x09a0=['SmsAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x38f38c,_0x31a4f4){var _0x13ab65=function(_0x485281){while(--_0x485281){_0x38f38c['push'](_0x38f38c['shift']());}};_0x13ab65(++_0x31a4f4);}(_0x09a0,0x8e));var _0x009a=function(_0x5c822e,_0x47f1ad){_0x5c822e=_0x5c822e-0x0;var _0x1ee4bc=_0x09a0[_0x5c822e];return _0x1ee4bc;};'use strict';var EventEmitter=require(_0x009a('0x0'));var SmsAccount=require(_0x009a('0x1'))['db'][_0x009a('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x009a('0x3')](0x0);var events={'afterCreate':_0x009a('0x4'),'afterUpdate':_0x009a('0x5'),'afterDestroy':_0x009a('0x6')};function emitEvent(_0x1bbb6e){return function(_0x1cba50,_0x4dc931,_0x2d3403){SmsAccountEvents[_0x009a('0x7')](_0x1bbb6e+':'+_0x1cba50['id'],_0x1cba50);SmsAccountEvents[_0x009a('0x7')](_0x1bbb6e,_0x1cba50);_0x2d3403(null);};}for(var e in events){if(events[_0x009a('0x8')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 8618638..d99334e 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 _0x13ac=['api','moment','bluebird','request-promise','path','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','lodash','util'];(function(_0x2122da,_0x3e0d3b){var _0x4b8adc=function(_0x44d842){while(--_0x44d842){_0x2122da['push'](_0x2122da['shift']());}};_0x4b8adc(++_0x3e0d3b);}(_0x13ac,0xfa));var _0xc13a=function(_0x511457,_0x1d891c){_0x511457=_0x511457-0x0;var _0x29d138=_0x13ac[_0x511457];return _0x29d138;};'use strict';var _=require(_0xc13a('0x0'));var util=require(_0xc13a('0x1'));var logger=require('../../config/logger')(_0xc13a('0x2'));var moment=require(_0xc13a('0x3'));var BPromise=require(_0xc13a('0x4'));var rp=require(_0xc13a('0x5'));var fs=require('fs');var path=require(_0xc13a('0x6'));var rimraf=require('rimraf');var config=require(_0xc13a('0x7'));var attributes=require(_0xc13a('0x8'));module[_0xc13a('0x9')]=function(_0x289d4d,_0xd8f7af){return _0x289d4d[_0xc13a('0xa')](_0xc13a('0xb'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfadd=['request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','define','lodash','util','bluebird'];(function(_0xf80b3,_0x25d5f3){var _0x10c489=function(_0x3c5aee){while(--_0x3c5aee){_0xf80b3['push'](_0xf80b3['shift']());}};_0x10c489(++_0x25d5f3);}(_0xfadd,0x1a4));var _0xdfad=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfadd[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xdfad('0x0'));var util=require(_0xdfad('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xdfad('0x2'));var rp=require(_0xdfad('0x3'));var fs=require('fs');var path=require(_0xdfad('0x4'));var rimraf=require(_0xdfad('0x5'));var config=require(_0xdfad('0x6'));var attributes=require(_0xdfad('0x7'));module['exports']=function(_0x14ce85,_0x1a17fe){return _0x14ce85[_0xdfad('0x8')]('SmsAccount',attributes,{'tableName':'sms_accounts','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 580d54c..1876978 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 _0xc5b3=['bluebird','randomstring','ioredis','../../config/logger','client','http','redis','defaults','socket.io-emitter','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','include','model','attributes','lodash','util'];(function(_0x163f5d,_0x2b8dea){var _0x80de1e=function(_0x4bf8dc){while(--_0x4bf8dc){_0x163f5d['push'](_0x163f5d['shift']());}};_0x80de1e(++_0x2b8dea);}(_0xc5b3,0xa3));var _0x3c5b=function(_0x50cd41,_0x4874a7){_0x50cd41=_0x50cd41-0x0;var _0x399475=_0xc5b3[_0x50cd41];return _0x399475;};'use strict';var _=require(_0x3c5b('0x0'));var util=require(_0x3c5b('0x1'));var moment=require('moment');var BPromise=require(_0x3c5b('0x2'));var rs=require(_0x3c5b('0x3'));var fs=require('fs');var Redis=require(_0x3c5b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3c5b('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3c5b('0x6')][_0x3c5b('0x7')]({'port':0x232a});config[_0x3c5b('0x8')]=_[_0x3c5b('0x9')](config[_0x3c5b('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x3c5b('0xa'))(new Redis(config[_0x3c5b('0x8')]));require(_0x3c5b('0xb'))[_0x3c5b('0xc')](socket);function respondWithRpcPromise(_0x320641,_0x2948e3,_0x56f7d1){return new BPromise(function(_0x3af39f,_0x59b196){return client['request'](_0x320641,_0x56f7d1)[_0x3c5b('0xd')](function(_0x26a080){logger[_0x3c5b('0xe')](_0x3c5b('0xf'),_0x2948e3,_0x3c5b('0x10'));logger[_0x3c5b('0x11')](_0x3c5b('0x12'),_0x2948e3,_0x3c5b('0x10'),JSON[_0x3c5b('0x13')](_0x26a080));if(_0x26a080[_0x3c5b('0x14')]){if(_0x26a080[_0x3c5b('0x14')][_0x3c5b('0x15')]===0x1f4){logger[_0x3c5b('0x14')](_0x3c5b('0xf'),_0x2948e3,_0x26a080['error'][_0x3c5b('0x16')]);return _0x59b196(_0x26a080[_0x3c5b('0x14')][_0x3c5b('0x16')]);}logger[_0x3c5b('0x14')]('SmsAccount,\x20%s,\x20%s',_0x2948e3,_0x26a080[_0x3c5b('0x14')]['message']);return _0x3af39f(_0x26a080[_0x3c5b('0x14')][_0x3c5b('0x16')]);}else{logger[_0x3c5b('0xe')](_0x3c5b('0xf'),_0x2948e3,_0x3c5b('0x10'));_0x3af39f(_0x26a080['result'][_0x3c5b('0x16')]);}})[_0x3c5b('0x17')](function(_0xf3ea8e){logger[_0x3c5b('0x14')]('SmsAccount,\x20%s,\x20%s',_0x2948e3,_0xf3ea8e);_0x59b196(_0xf3ea8e);});});}exports[_0x3c5b('0x18')]=function(_0x57d10a){var _0x1c1f36=this;return new Promise(function(_0x24420a,_0x11e415){return db[_0x3c5b('0x19')][_0x3c5b('0x1a')]({'raw':_0x57d10a[_0x3c5b('0x1b')]?_0x57d10a[_0x3c5b('0x1b')][_0x3c5b('0x1c')]===undefined?!![]:![]:!![],'where':_0x57d10a[_0x3c5b('0x1b')]?_0x57d10a[_0x3c5b('0x1b')][_0x3c5b('0x1d')]||null:null,'attributes':_0x57d10a['options']?_0x57d10a[_0x3c5b('0x1b')]['attributes']||null:null,'include':_0x57d10a['options']?_0x57d10a[_0x3c5b('0x1b')][_0x3c5b('0x1e')]?_['map'](_0x57d10a[_0x3c5b('0x1b')][_0x3c5b('0x1e')],function(_0x2ae4a2){return{'model':db[_0x2ae4a2[_0x3c5b('0x1f')]],'as':_0x2ae4a2['as'],'attributes':_0x2ae4a2[_0x3c5b('0x20')],'include':_0x2ae4a2[_0x3c5b('0x1e')]?_['map'](_0x2ae4a2[_0x3c5b('0x1e')],function(_0x2a0f59){return{'model':db[_0x2a0f59[_0x3c5b('0x1f')]],'as':_0x2a0f59['as'],'attributes':_0x2a0f59[_0x3c5b('0x20')],'include':_0x2a0f59['include']?_['map'](_0x2a0f59['include'],function(_0x3fba50){return{'model':db[_0x3fba50['model']],'as':_0x3fba50['as'],'attributes':_0x3fba50[_0x3c5b('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2de444){logger[_0x3c5b('0xe')]('ShowSmsAccount',_0x57d10a);logger[_0x3c5b('0x11')](_0x3c5b('0x18'),_0x57d10a,JSON[_0x3c5b('0x13')](_0x2de444));_0x24420a(_0x2de444);})[_0x3c5b('0x17')](function(_0x1210f1){logger[_0x3c5b('0x14')](_0x3c5b('0x18'),_0x1210f1['message'],_0x57d10a);_0x11e415(_0x1c1f36['error'](0x1f4,_0x1210f1[_0x3c5b('0x16')]));});});}; \ No newline at end of file +var _0x677a=['info','ShowSmsAccount','find','options','raw','where','attributes','include','model','map','stringify','catch','lodash','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x677a,0xbb));var _0xa677=function(_0x37a150,_0x5404b0){_0x37a150=_0x37a150-0x0;var _0x15d8ab=_0x677a[_0x37a150];return _0x15d8ab;};'use strict';var _=require(_0xa677('0x0'));var util=require(_0xa677('0x1'));var moment=require(_0xa677('0x2'));var BPromise=require(_0xa677('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa677('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa677('0x5'));var config=require(_0xa677('0x6'));var jayson=require(_0xa677('0x7'));var client=jayson[_0xa677('0x8')][_0xa677('0x9')]({'port':0x232a});config[_0xa677('0xa')]=_[_0xa677('0xb')](config[_0xa677('0xa')],{'host':_0xa677('0xc'),'port':0x18eb});var socket=require(_0xa677('0xd'))(new Redis(config['redis']));require(_0xa677('0xe'))[_0xa677('0xf')](socket);function respondWithRpcPromise(_0x2a851c,_0x4a6ba9,_0x48546f){return new BPromise(function(_0x6dd9df,_0xb46c91){return client['request'](_0x2a851c,_0x48546f)['then'](function(_0x133c60){logger['info'](_0xa677('0x10'),_0x4a6ba9,'request\x20sent');logger[_0xa677('0x11')](_0xa677('0x12'),_0x4a6ba9,_0xa677('0x13'),JSON['stringify'](_0x133c60));if(_0x133c60['error']){if(_0x133c60[_0xa677('0x14')][_0xa677('0x15')]===0x1f4){logger[_0xa677('0x14')](_0xa677('0x10'),_0x4a6ba9,_0x133c60[_0xa677('0x14')][_0xa677('0x16')]);return _0xb46c91(_0x133c60[_0xa677('0x14')]['message']);}logger[_0xa677('0x14')](_0xa677('0x10'),_0x4a6ba9,_0x133c60[_0xa677('0x14')]['message']);return _0x6dd9df(_0x133c60['error'][_0xa677('0x16')]);}else{logger[_0xa677('0x17')](_0xa677('0x10'),_0x4a6ba9,'request\x20sent');_0x6dd9df(_0x133c60['result']['message']);}})['catch'](function(_0x18fb0b){logger[_0xa677('0x14')](_0xa677('0x10'),_0x4a6ba9,_0x18fb0b);_0xb46c91(_0x18fb0b);});});}exports[_0xa677('0x18')]=function(_0xfe3fe6){var _0x138964=this;return new Promise(function(_0xae1835,_0x41cade){return db['SmsAccount'][_0xa677('0x19')]({'raw':_0xfe3fe6[_0xa677('0x1a')]?_0xfe3fe6[_0xa677('0x1a')][_0xa677('0x1b')]===undefined?!![]:![]:!![],'where':_0xfe3fe6[_0xa677('0x1a')]?_0xfe3fe6[_0xa677('0x1a')][_0xa677('0x1c')]||null:null,'attributes':_0xfe3fe6[_0xa677('0x1a')]?_0xfe3fe6[_0xa677('0x1a')][_0xa677('0x1d')]||null:null,'include':_0xfe3fe6['options']?_0xfe3fe6[_0xa677('0x1a')][_0xa677('0x1e')]?_['map'](_0xfe3fe6['options'][_0xa677('0x1e')],function(_0x37f861){return{'model':db[_0x37f861[_0xa677('0x1f')]],'as':_0x37f861['as'],'attributes':_0x37f861[_0xa677('0x1d')],'include':_0x37f861['include']?_[_0xa677('0x20')](_0x37f861[_0xa677('0x1e')],function(_0x4337c6){return{'model':db[_0x4337c6[_0xa677('0x1f')]],'as':_0x4337c6['as'],'attributes':_0x4337c6['attributes'],'include':_0x4337c6['include']?_[_0xa677('0x20')](_0x4337c6[_0xa677('0x1e')],function(_0x718aa8){return{'model':db[_0x718aa8[_0xa677('0x1f')]],'as':_0x718aa8['as'],'attributes':_0x718aa8[_0xa677('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x6b8cc8){logger['info'](_0xa677('0x18'),_0xfe3fe6);logger[_0xa677('0x11')](_0xa677('0x18'),_0xfe3fe6,JSON[_0xa677('0x21')](_0x6b8cc8));_0xae1835(_0x6b8cc8);})[_0xa677('0x22')](function(_0x1e285b){logger[_0xa677('0x14')](_0xa677('0x18'),_0x1e285b['message'],_0xfe3fe6);_0x41cade(_0x138964[_0xa677('0x14')](0x1f4,_0x1e285b[_0xa677('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 4735303..6daa4db 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 84a1c89..dae3f02 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 _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x519ea7,_0x26a415){var _0x2b5043=function(_0x180324){while(--_0x180324){_0x519ea7['push'](_0x519ea7['shift']());}};_0x2b5043(++_0x26a415);}(_0x34e8,0x12c));var _0x834e=function(_0x4c8439,_0x503791){_0x4c8439=_0x4c8439-0x0;var _0x16597e=_0x34e8[_0x4c8439];return _0x16597e;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file +var _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x60dd1c,_0x384166){var _0xba1c5b=function(_0x3311f4){while(--_0x3311f4){_0x60dd1c['push'](_0x60dd1c['shift']());}};_0xba1c5b(++_0x384166);}(_0x55ca,0x126));var _0xa55c=function(_0x32ee50,_0x564493){_0x32ee50=_0x32ee50-0x0;var _0x12a1b3=_0x55ca[_0x32ee50];return _0x12a1b3;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 733ed95..51ec6d0 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 _0x064b=['TEXT','sequelize','exports','STRING','noop'];(function(_0xff66e3,_0x5083e3){var _0xa45719=function(_0x2d31ee){while(--_0x2d31ee){_0xff66e3['push'](_0xff66e3['shift']());}};_0xa45719(++_0x5083e3);}(_0x064b,0xa6));var _0xb064=function(_0x46622b,_0x39c3ef){_0x46622b=_0x46622b-0x0;var _0x3835eb=_0x064b[_0x46622b];return _0x3835eb;};'use strict';var Sequelize=require(_0xb064('0x0'));module[_0xb064('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb064('0x2')],'allowNull':![],'defaultValue':_0xb064('0x3')},'appdata':{'type':Sequelize[_0xb064('0x4')]()},'description':{'type':Sequelize[_0xb064('0x2')]},'interval':{'type':Sequelize[_0xb064('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x2e98=['STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x459dcd,_0x4ff703){var _0x1fbb32=function(_0xab9cc){while(--_0xab9cc){_0x459dcd['push'](_0x459dcd['shift']());}};_0x1fbb32(++_0x4ff703);}(_0x2e98,0x110));var _0x82e9=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x2e98[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x82e9('0x0'));module[_0x82e9('0x1')]={'priority':{'type':Sequelize[_0x82e9('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x82e9('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x82e9('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x82e9('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 00abf68..7cbe50b 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 _0xc860=['include','rows','catch','show','params','rawAttributes','fields','length','options','create','update','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','name','send','index','SmsApplication','fieldName','model','map','query','keys','intersection','attributes','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc860,0x17a));var _0x0c86=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xc860[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x0c86('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0c86('0x1'));var jsonpatch=require(_0x0c86('0x2'));var rp=require(_0x0c86('0x3'));var moment=require(_0x0c86('0x4'));var BPromise=require(_0x0c86('0x5'));var Mustache=require(_0x0c86('0x6'));var util=require(_0x0c86('0x7'));var path=require(_0x0c86('0x8'));var sox=require(_0x0c86('0x9'));var csv=require(_0x0c86('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0c86('0xb'));var _=require(_0x0c86('0xc'));var squel=require(_0x0c86('0xd'));var crypto=require('crypto');var jsforce=require(_0x0c86('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0c86('0xa'));var querystring=require(_0x0c86('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0c86('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0c86('0x11'));var hardwareService=require(_0x0c86('0x12'));var logger=require(_0x0c86('0x13'))(_0x0c86('0x14'));var utils=require(_0x0c86('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0c86('0x16'));var db=require(_0x0c86('0x17'))['db'];function respondWithStatusCode(_0x18cbba,_0x5e8bc9){_0x5e8bc9=_0x5e8bc9||0xcc;return function(_0x4fc106){if(_0x4fc106){return _0x18cbba[_0x0c86('0x18')](_0x5e8bc9);}return _0x18cbba[_0x0c86('0x19')](_0x5e8bc9)[_0x0c86('0x1a')]();};}function respondWithResult(_0x5e87dd,_0x5b716b){_0x5b716b=_0x5b716b||0xc8;return function(_0xad8a2a){if(_0xad8a2a){return _0x5e87dd['status'](_0x5b716b)[_0x0c86('0x1b')](_0xad8a2a);}};}function respondWithFilteredResult(_0x17f071,_0x5a76cb){return function(_0x3450b1){if(_0x3450b1){var _0x4311c1=typeof _0x5a76cb[_0x0c86('0x1c')]===_0x0c86('0x1d')&&typeof _0x5a76cb[_0x0c86('0x1e')]==='undefined';var _0x567af7=_0x3450b1[_0x0c86('0x1f')];var _0x16f64b=_0x4311c1?0x0:_0x5a76cb['offset'];var _0x458f45=_0x4311c1?_0x3450b1['count']:_0x5a76cb[_0x0c86('0x1c')]+_0x5a76cb[_0x0c86('0x1e')];var _0x102ebe;if(_0x458f45>=_0x567af7){_0x458f45=_0x567af7;_0x102ebe=0xc8;}else{_0x102ebe=0xce;}_0x17f071[_0x0c86('0x19')](_0x102ebe);return _0x17f071[_0x0c86('0x20')]('Content-Range',_0x16f64b+'-'+_0x458f45+'/'+_0x567af7)[_0x0c86('0x1b')](_0x3450b1);}return null;};}function patchUpdates(_0xa94106){return function(_0x8e7aa2){try{jsonpatch[_0x0c86('0x21')](_0x8e7aa2,_0xa94106,!![]);}catch(_0x1fd0ae){return BPromise[_0x0c86('0x22')](_0x1fd0ae);}return _0x8e7aa2[_0x0c86('0x23')]();};}function saveUpdates(_0x114d98,_0x56f032){return function(_0x312c98){if(_0x312c98){return _0x312c98['update'](_0x114d98)[_0x0c86('0x24')](function(_0x3ed6ed){return _0x3ed6ed;});}return null;};}function removeEntity(_0x145904,_0x59fb50){return function(_0xcc818d){if(_0xcc818d){return _0xcc818d[_0x0c86('0x25')]()[_0x0c86('0x24')](function(){_0x145904[_0x0c86('0x19')](0xcc)[_0x0c86('0x1a')]();});}};}function handleEntityNotFound(_0x2805ba,_0x5cfb46){return function(_0x4ab593){if(!_0x4ab593){_0x2805ba[_0x0c86('0x18')](0x194);}return _0x4ab593;};}function handleError(_0x134d18,_0x1e3cb4){_0x1e3cb4=_0x1e3cb4||0x1f4;return function(_0x279c94){logger[_0x0c86('0x26')](_0x279c94['stack']);if(_0x279c94[_0x0c86('0x27')]){delete _0x279c94[_0x0c86('0x27')];}_0x134d18[_0x0c86('0x19')](_0x1e3cb4)[_0x0c86('0x28')](_0x279c94);};}exports[_0x0c86('0x29')]=function(_0x19f682,_0x20efe5){var _0x54fe6f={},_0x4fbeb6={},_0x1d55e2={'count':0x0,'rows':[]};var _0x40df82=_['map'](db[_0x0c86('0x2a')]['rawAttributes'],function(_0x296b71){return{'name':_0x296b71[_0x0c86('0x2b')],'type':_0x296b71['type']['key']};});_0x4fbeb6[_0x0c86('0x2c')]=_[_0x0c86('0x2d')](_0x40df82,_0x0c86('0x27'));_0x4fbeb6[_0x0c86('0x2e')]=_[_0x0c86('0x2f')](_0x19f682[_0x0c86('0x2e')]);_0x4fbeb6['filters']=_[_0x0c86('0x30')](_0x4fbeb6[_0x0c86('0x2c')],_0x4fbeb6['query']);_0x54fe6f[_0x0c86('0x31')]=_[_0x0c86('0x30')](_0x4fbeb6[_0x0c86('0x2c')],qs['fields'](_0x19f682[_0x0c86('0x2e')]['fields']));_0x54fe6f['attributes']=_0x54fe6f['attributes']['length']?_0x54fe6f[_0x0c86('0x31')]:_0x4fbeb6['model'];if(!_0x19f682[_0x0c86('0x2e')]['hasOwnProperty'](_0x0c86('0x32'))){_0x54fe6f[_0x0c86('0x1e')]=qs[_0x0c86('0x1e')](_0x19f682[_0x0c86('0x2e')][_0x0c86('0x1e')]);_0x54fe6f[_0x0c86('0x1c')]=qs[_0x0c86('0x1c')](_0x19f682[_0x0c86('0x2e')][_0x0c86('0x1c')]);}_0x54fe6f[_0x0c86('0x33')]=qs[_0x0c86('0x34')](_0x19f682[_0x0c86('0x2e')][_0x0c86('0x34')]);_0x54fe6f[_0x0c86('0x35')]=qs[_0x0c86('0x36')](_[_0x0c86('0x37')](_0x19f682[_0x0c86('0x2e')],_0x4fbeb6[_0x0c86('0x36')]),_0x40df82);if(_0x19f682[_0x0c86('0x2e')][_0x0c86('0x38')]){_0x54fe6f[_0x0c86('0x35')]=_[_0x0c86('0x39')](_0x54fe6f[_0x0c86('0x35')],{'$or':_[_0x0c86('0x2d')](_0x40df82,function(_0x1e209a){if(_0x1e209a[_0x0c86('0x3a')]!==_0x0c86('0x3b')){var _0x3365d8={};_0x3365d8[_0x1e209a[_0x0c86('0x27')]]={'$like':'%'+_0x19f682[_0x0c86('0x2e')][_0x0c86('0x38')]+'%'};return _0x3365d8;}})});}_0x54fe6f=_[_0x0c86('0x39')]({},_0x54fe6f,_0x19f682['options']);var _0x4874eb={'where':_0x54fe6f['where']};return db[_0x0c86('0x2a')][_0x0c86('0x1f')](_0x4874eb)[_0x0c86('0x24')](function(_0x44410b){_0x1d55e2['count']=_0x44410b;if(_0x19f682['query']['includeAll']){_0x54fe6f[_0x0c86('0x3c')]=[{'all':!![]}];}return db[_0x0c86('0x2a')]['findAll'](_0x54fe6f);})[_0x0c86('0x24')](function(_0x6fa5c3){_0x1d55e2[_0x0c86('0x3d')]=_0x6fa5c3;return _0x1d55e2;})[_0x0c86('0x24')](respondWithFilteredResult(_0x20efe5,_0x54fe6f))[_0x0c86('0x3e')](handleError(_0x20efe5,null));};exports[_0x0c86('0x3f')]=function(_0x443298,_0x1c2d0f){var _0x321b36={'raw':!![],'where':{'id':_0x443298[_0x0c86('0x40')]['id']}},_0x428f0c={};_0x428f0c['model']=_['keys'](db['SmsApplication'][_0x0c86('0x41')]);_0x428f0c[_0x0c86('0x2e')]=_[_0x0c86('0x2f')](_0x443298[_0x0c86('0x2e')]);_0x428f0c[_0x0c86('0x36')]=_['intersection'](_0x428f0c[_0x0c86('0x2c')],_0x428f0c[_0x0c86('0x2e')]);_0x321b36['attributes']=_['intersection'](_0x428f0c[_0x0c86('0x2c')],qs['fields'](_0x443298[_0x0c86('0x2e')][_0x0c86('0x42')]));_0x321b36[_0x0c86('0x31')]=_0x321b36[_0x0c86('0x31')][_0x0c86('0x43')]?_0x321b36[_0x0c86('0x31')]:_0x428f0c[_0x0c86('0x2c')];if(_0x443298[_0x0c86('0x2e')]['includeAll']){_0x321b36['include']=[{'all':!![]}];}_0x321b36=_[_0x0c86('0x39')]({},_0x321b36,_0x443298[_0x0c86('0x44')]);return db['SmsApplication']['find'](_0x321b36)[_0x0c86('0x24')](handleEntityNotFound(_0x1c2d0f,null))[_0x0c86('0x24')](respondWithResult(_0x1c2d0f,null))['catch'](handleError(_0x1c2d0f,null));};exports[_0x0c86('0x45')]=function(_0x5603a4,_0x5654c5){return db['SmsApplication'][_0x0c86('0x45')](_0x5603a4['body'],{})[_0x0c86('0x24')](respondWithResult(_0x5654c5,0xc9))[_0x0c86('0x3e')](handleError(_0x5654c5,null));};exports[_0x0c86('0x46')]=function(_0x1b88c3,_0x20515b){if(_0x1b88c3[_0x0c86('0x47')]['id']){delete _0x1b88c3[_0x0c86('0x47')]['id'];}return db[_0x0c86('0x2a')][_0x0c86('0x48')]({'where':{'id':_0x1b88c3[_0x0c86('0x40')]['id']}})[_0x0c86('0x24')](handleEntityNotFound(_0x20515b,null))[_0x0c86('0x24')](saveUpdates(_0x1b88c3['body'],null))['then'](respondWithResult(_0x20515b,null))[_0x0c86('0x3e')](handleError(_0x20515b,null));};exports[_0x0c86('0x25')]=function(_0x19bd1e,_0xcfbfc6){return db['SmsApplication'][_0x0c86('0x48')]({'where':{'id':_0x19bd1e['params']['id']}})[_0x0c86('0x24')](handleEntityNotFound(_0xcfbfc6,null))['then'](removeEntity(_0xcfbfc6,null))['catch'](handleError(_0xcfbfc6,null));}; \ No newline at end of file +var _0x77fb=['squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','update','then','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra'];(function(_0x24fcfd,_0x73ed5b){var _0x27107c=function(_0x4e66e5){while(--_0x4e66e5){_0x24fcfd['push'](_0x24fcfd['shift']());}};_0x27107c(++_0x73ed5b);}(_0x77fb,0xdf));var _0xb77f=function(_0x27fe47,_0x1d5375){_0x27fe47=_0x27fe47-0x0;var _0x2d3a66=_0x77fb[_0x27fe47];return _0x2d3a66;};'use strict';var emlformat=require(_0xb77f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb77f('0x1'));var jsonpatch=require(_0xb77f('0x2'));var rp=require(_0xb77f('0x3'));var moment=require(_0xb77f('0x4'));var BPromise=require(_0xb77f('0x5'));var Mustache=require(_0xb77f('0x6'));var util=require(_0xb77f('0x7'));var path=require(_0xb77f('0x8'));var sox=require(_0xb77f('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb77f('0xa'));var _=require('lodash');var squel=require(_0xb77f('0xb'));var crypto=require(_0xb77f('0xc'));var jsforce=require(_0xb77f('0xd'));var deskjs=require(_0xb77f('0xe'));var toCsv=require(_0xb77f('0xf'));var querystring=require(_0xb77f('0x10'));var Papa=require(_0xb77f('0x11'));var Redis=require(_0xb77f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb77f('0x13'));var as=require(_0xb77f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb77f('0x15'))('api');var utils=require(_0xb77f('0x16'));var config=require(_0xb77f('0x17'));var licenseUtil=require(_0xb77f('0x18'));var db=require(_0xb77f('0x19'))['db'];function respondWithStatusCode(_0x40758c,_0x4468e7){_0x4468e7=_0x4468e7||0xcc;return function(_0x13ca49){if(_0x13ca49){return _0x40758c[_0xb77f('0x1a')](_0x4468e7);}return _0x40758c[_0xb77f('0x1b')](_0x4468e7)[_0xb77f('0x1c')]();};}function respondWithResult(_0x3fa37b,_0x23d75b){_0x23d75b=_0x23d75b||0xc8;return function(_0x5d022b){if(_0x5d022b){return _0x3fa37b['status'](_0x23d75b)[_0xb77f('0x1d')](_0x5d022b);}};}function respondWithFilteredResult(_0x29c5a0,_0x51359e){return function(_0x108f03){if(_0x108f03){var _0x21bb5a=typeof _0x51359e[_0xb77f('0x1e')]==='undefined'&&typeof _0x51359e['limit']===_0xb77f('0x1f');var _0x50a816=_0x108f03[_0xb77f('0x20')];var _0x5d0a89=_0x21bb5a?0x0:_0x51359e['offset'];var _0x5f1065=_0x21bb5a?_0x108f03['count']:_0x51359e[_0xb77f('0x1e')]+_0x51359e[_0xb77f('0x21')];var _0x49444c;if(_0x5f1065>=_0x50a816){_0x5f1065=_0x50a816;_0x49444c=0xc8;}else{_0x49444c=0xce;}_0x29c5a0[_0xb77f('0x1b')](_0x49444c);return _0x29c5a0['set'](_0xb77f('0x22'),_0x5d0a89+'-'+_0x5f1065+'/'+_0x50a816)[_0xb77f('0x1d')](_0x108f03);}return null;};}function patchUpdates(_0x37cce7){return function(_0x3a27f0){try{jsonpatch[_0xb77f('0x23')](_0x3a27f0,_0x37cce7,!![]);}catch(_0x70777e){return BPromise['reject'](_0x70777e);}return _0x3a27f0['save']();};}function saveUpdates(_0x49c737,_0x34d4b8){return function(_0xa61dd0){if(_0xa61dd0){return _0xa61dd0[_0xb77f('0x24')](_0x49c737)[_0xb77f('0x25')](function(_0x3f19c2){return _0x3f19c2;});}return null;};}function removeEntity(_0x39d67d,_0x3e5589){return function(_0x13e599){if(_0x13e599){return _0x13e599['destroy']()[_0xb77f('0x25')](function(){_0x39d67d[_0xb77f('0x1b')](0xcc)[_0xb77f('0x1c')]();});}};}function handleEntityNotFound(_0x3c14c4,_0x1bcf43){return function(_0x22d81c){if(!_0x22d81c){_0x3c14c4[_0xb77f('0x1a')](0x194);}return _0x22d81c;};}function handleError(_0x57ee16,_0x212e41){_0x212e41=_0x212e41||0x1f4;return function(_0x407cc7){logger[_0xb77f('0x26')](_0x407cc7[_0xb77f('0x27')]);if(_0x407cc7[_0xb77f('0x28')]){delete _0x407cc7[_0xb77f('0x28')];}_0x57ee16['status'](_0x212e41)[_0xb77f('0x29')](_0x407cc7);};}exports[_0xb77f('0x2a')]=function(_0x3893b2,_0x19e27f){var _0x671ca5={},_0x224cb3={},_0x6f5b34={'count':0x0,'rows':[]};var _0x4cd9cb=_[_0xb77f('0x2b')](db[_0xb77f('0x2c')][_0xb77f('0x2d')],function(_0x1b5d96){return{'name':_0x1b5d96[_0xb77f('0x2e')],'type':_0x1b5d96[_0xb77f('0x2f')][_0xb77f('0x30')]};});_0x224cb3[_0xb77f('0x31')]=_[_0xb77f('0x2b')](_0x4cd9cb,'name');_0x224cb3['query']=_['keys'](_0x3893b2['query']);_0x224cb3[_0xb77f('0x32')]=_[_0xb77f('0x33')](_0x224cb3[_0xb77f('0x31')],_0x224cb3[_0xb77f('0x34')]);_0x671ca5[_0xb77f('0x35')]=_[_0xb77f('0x33')](_0x224cb3[_0xb77f('0x31')],qs[_0xb77f('0x36')](_0x3893b2['query'][_0xb77f('0x36')]));_0x671ca5[_0xb77f('0x35')]=_0x671ca5[_0xb77f('0x35')][_0xb77f('0x37')]?_0x671ca5['attributes']:_0x224cb3['model'];if(!_0x3893b2[_0xb77f('0x34')][_0xb77f('0x38')](_0xb77f('0x39'))){_0x671ca5[_0xb77f('0x21')]=qs['limit'](_0x3893b2[_0xb77f('0x34')][_0xb77f('0x21')]);_0x671ca5[_0xb77f('0x1e')]=qs[_0xb77f('0x1e')](_0x3893b2[_0xb77f('0x34')]['offset']);}_0x671ca5[_0xb77f('0x3a')]=qs['sort'](_0x3893b2[_0xb77f('0x34')][_0xb77f('0x3b')]);_0x671ca5[_0xb77f('0x3c')]=qs[_0xb77f('0x32')](_[_0xb77f('0x3d')](_0x3893b2[_0xb77f('0x34')],_0x224cb3[_0xb77f('0x32')]),_0x4cd9cb);if(_0x3893b2[_0xb77f('0x34')][_0xb77f('0x3e')]){_0x671ca5[_0xb77f('0x3c')]=_[_0xb77f('0x3f')](_0x671ca5[_0xb77f('0x3c')],{'$or':_['map'](_0x4cd9cb,function(_0x1730df){if(_0x1730df[_0xb77f('0x2f')]!==_0xb77f('0x40')){var _0xf4605a={};_0xf4605a[_0x1730df[_0xb77f('0x28')]]={'$like':'%'+_0x3893b2['query'][_0xb77f('0x3e')]+'%'};return _0xf4605a;}})});}_0x671ca5=_[_0xb77f('0x3f')]({},_0x671ca5,_0x3893b2[_0xb77f('0x41')]);var _0x1369cb={'where':_0x671ca5['where']};return db[_0xb77f('0x2c')]['count'](_0x1369cb)[_0xb77f('0x25')](function(_0xb1e20b){_0x6f5b34['count']=_0xb1e20b;if(_0x3893b2[_0xb77f('0x34')][_0xb77f('0x42')]){_0x671ca5[_0xb77f('0x43')]=[{'all':!![]}];}return db[_0xb77f('0x2c')][_0xb77f('0x44')](_0x671ca5);})[_0xb77f('0x25')](function(_0x371fcf){_0x6f5b34[_0xb77f('0x45')]=_0x371fcf;return _0x6f5b34;})[_0xb77f('0x25')](respondWithFilteredResult(_0x19e27f,_0x671ca5))['catch'](handleError(_0x19e27f,null));};exports[_0xb77f('0x46')]=function(_0x40d630,_0x44d48d){var _0x5d96cd={'raw':!![],'where':{'id':_0x40d630[_0xb77f('0x47')]['id']}},_0x1b29bb={};_0x1b29bb[_0xb77f('0x31')]=_['keys'](db['SmsApplication'][_0xb77f('0x2d')]);_0x1b29bb['query']=_[_0xb77f('0x48')](_0x40d630[_0xb77f('0x34')]);_0x1b29bb['filters']=_['intersection'](_0x1b29bb[_0xb77f('0x31')],_0x1b29bb[_0xb77f('0x34')]);_0x5d96cd[_0xb77f('0x35')]=_[_0xb77f('0x33')](_0x1b29bb['model'],qs['fields'](_0x40d630[_0xb77f('0x34')][_0xb77f('0x36')]));_0x5d96cd[_0xb77f('0x35')]=_0x5d96cd[_0xb77f('0x35')][_0xb77f('0x37')]?_0x5d96cd[_0xb77f('0x35')]:_0x1b29bb[_0xb77f('0x31')];if(_0x40d630[_0xb77f('0x34')][_0xb77f('0x42')]){_0x5d96cd[_0xb77f('0x43')]=[{'all':!![]}];}_0x5d96cd=_[_0xb77f('0x3f')]({},_0x5d96cd,_0x40d630[_0xb77f('0x41')]);return db[_0xb77f('0x2c')][_0xb77f('0x49')](_0x5d96cd)[_0xb77f('0x25')](handleEntityNotFound(_0x44d48d,null))[_0xb77f('0x25')](respondWithResult(_0x44d48d,null))[_0xb77f('0x4a')](handleError(_0x44d48d,null));};exports[_0xb77f('0x4b')]=function(_0x95c9fd,_0x6aec){return db[_0xb77f('0x2c')][_0xb77f('0x4b')](_0x95c9fd[_0xb77f('0x4c')],{})['then'](respondWithResult(_0x6aec,0xc9))[_0xb77f('0x4a')](handleError(_0x6aec,null));};exports[_0xb77f('0x24')]=function(_0x1148ff,_0x4a67b9){if(_0x1148ff['body']['id']){delete _0x1148ff[_0xb77f('0x4c')]['id'];}return db[_0xb77f('0x2c')]['find']({'where':{'id':_0x1148ff['params']['id']}})['then'](handleEntityNotFound(_0x4a67b9,null))[_0xb77f('0x25')](saveUpdates(_0x1148ff[_0xb77f('0x4c')],null))[_0xb77f('0x25')](respondWithResult(_0x4a67b9,null))[_0xb77f('0x4a')](handleError(_0x4a67b9,null));};exports[_0xb77f('0x4d')]=function(_0x2e6e84,_0x55cccb){return db[_0xb77f('0x2c')][_0xb77f('0x49')]({'where':{'id':_0x2e6e84[_0xb77f('0x47')]['id']}})[_0xb77f('0x25')](handleEntityNotFound(_0x55cccb,null))[_0xb77f('0x25')](removeEntity(_0x55cccb,null))[_0xb77f('0x4a')](handleError(_0x55cccb,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 844ad26..9a86e5e 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 _0x8cbe=['api','moment','bluebird','request-promise','path','./smsApplication.attributes','exports','define','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x55017f,_0x177712){var _0x5e9af9=function(_0x48b096){while(--_0x48b096){_0x55017f['push'](_0x55017f['shift']());}};_0x5e9af9(++_0x177712);}(_0x8cbe,0x1a1));var _0xe8cb=function(_0x103b63,_0x57e863){_0x103b63=_0x103b63-0x0;var _0x72de84=_0x8cbe[_0x103b63];return _0x72de84;};'use strict';var _=require(_0xe8cb('0x0'));var util=require(_0xe8cb('0x1'));var logger=require(_0xe8cb('0x2'))(_0xe8cb('0x3'));var moment=require(_0xe8cb('0x4'));var BPromise=require(_0xe8cb('0x5'));var rp=require(_0xe8cb('0x6'));var fs=require('fs');var path=require(_0xe8cb('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe8cb('0x8'));module[_0xe8cb('0x9')]=function(_0x4f6590,_0x239ef0){return _0x4f6590[_0xe8cb('0xa')]('SmsApplication',attributes,{'tableName':_0xe8cb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe8cb('0xc'),'collate':_0xe8cb('0xd')});}; \ No newline at end of file +var _0xf79f=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment'];(function(_0x2fff83,_0x29d5fe){var _0xa2a722=function(_0x18b6b0){while(--_0x18b6b0){_0x2fff83['push'](_0x2fff83['shift']());}};_0xa2a722(++_0x29d5fe);}(_0xf79f,0x182));var _0xff79=function(_0x96b6a,_0x12471d){_0x96b6a=_0x96b6a-0x0;var _0x3e16f3=_0xf79f[_0x96b6a];return _0x3e16f3;};'use strict';var _=require('lodash');var util=require(_0xff79('0x0'));var logger=require(_0xff79('0x1'))(_0xff79('0x2'));var moment=require(_0xff79('0x3'));var BPromise=require(_0xff79('0x4'));var rp=require(_0xff79('0x5'));var fs=require('fs');var path=require(_0xff79('0x6'));var rimraf=require(_0xff79('0x7'));var config=require(_0xff79('0x8'));var attributes=require('./smsApplication.attributes');module[_0xff79('0x9')]=function(_0x10accc,_0x342ded){return _0x10accc[_0xff79('0xa')](_0xff79('0xb'),attributes,{'tableName':_0xff79('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xff79('0xd'),'collate':_0xff79('0xe')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 0ba42a1..f32ce99 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 _0x39d2=['SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3c4322,_0x145a37){var _0x225310=function(_0x51a0a2){while(--_0x51a0a2){_0x3c4322['push'](_0x3c4322['shift']());}};_0x225310(++_0x145a37);}(_0x39d2,0xf5));var _0x239d=function(_0x10df18,_0x13338c){_0x10df18=_0x10df18-0x0;var _0x1f9a1d=_0x39d2[_0x10df18];return _0x1f9a1d;};'use strict';var _=require(_0x239d('0x0'));var util=require('util');var moment=require(_0x239d('0x1'));var BPromise=require(_0x239d('0x2'));var rs=require(_0x239d('0x3'));var fs=require('fs');var Redis=require(_0x239d('0x4'));var db=require(_0x239d('0x5'))['db'];var utils=require(_0x239d('0x6'));var logger=require(_0x239d('0x7'))(_0x239d('0x8'));var config=require(_0x239d('0x9'));var jayson=require(_0x239d('0xa'));var client=jayson[_0x239d('0xb')][_0x239d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1f0947,_0x53d457,_0x262efe){return new BPromise(function(_0x2a6811,_0x3f9948){return client[_0x239d('0xd')](_0x1f0947,_0x262efe)[_0x239d('0xe')](function(_0x3d7f32){logger[_0x239d('0xf')](_0x239d('0x10'),_0x53d457,_0x239d('0x11'));logger[_0x239d('0x12')](_0x239d('0x13'),_0x53d457,_0x239d('0x11'),JSON[_0x239d('0x14')](_0x3d7f32));if(_0x3d7f32[_0x239d('0x15')]){if(_0x3d7f32[_0x239d('0x15')]['code']===0x1f4){logger['error'](_0x239d('0x10'),_0x53d457,_0x3d7f32[_0x239d('0x15')][_0x239d('0x16')]);return _0x3f9948(_0x3d7f32[_0x239d('0x15')][_0x239d('0x16')]);}logger[_0x239d('0x15')](_0x239d('0x10'),_0x53d457,_0x3d7f32[_0x239d('0x15')][_0x239d('0x16')]);return _0x2a6811(_0x3d7f32['error'][_0x239d('0x16')]);}else{logger[_0x239d('0xf')](_0x239d('0x10'),_0x53d457,_0x239d('0x11'));_0x2a6811(_0x3d7f32[_0x239d('0x17')]['message']);}})['catch'](function(_0x141582){logger['error'](_0x239d('0x10'),_0x53d457,_0x141582);_0x3f9948(_0x141582);});});} \ No newline at end of file +var _0x9541=['http','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','result','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9541,0xb3));var _0x1954=function(_0x43642d,_0x25b89f){_0x43642d=_0x43642d-0x0;var _0x2fc586=_0x9541[_0x43642d];return _0x2fc586;};'use strict';var _=require(_0x1954('0x0'));var util=require(_0x1954('0x1'));var moment=require(_0x1954('0x2'));var BPromise=require(_0x1954('0x3'));var rs=require(_0x1954('0x4'));var fs=require('fs');var Redis=require(_0x1954('0x5'));var db=require(_0x1954('0x6'))['db'];var utils=require(_0x1954('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x1954('0x8'));var jayson=require(_0x1954('0x9'));var client=jayson['client'][_0x1954('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21ceca,_0x30beea,_0x2ccff8){return new BPromise(function(_0xda7a2f,_0xa7a784){return client['request'](_0x21ceca,_0x2ccff8)[_0x1954('0xb')](function(_0x2f2c4b){logger[_0x1954('0xc')](_0x1954('0xd'),_0x30beea,_0x1954('0xe'));logger[_0x1954('0xf')](_0x1954('0x10'),_0x30beea,_0x1954('0xe'),JSON['stringify'](_0x2f2c4b));if(_0x2f2c4b[_0x1954('0x11')]){if(_0x2f2c4b[_0x1954('0x11')]['code']===0x1f4){logger[_0x1954('0x11')]('SmsApplication,\x20%s,\x20%s',_0x30beea,_0x2f2c4b[_0x1954('0x11')]['message']);return _0xa7a784(_0x2f2c4b['error']['message']);}logger[_0x1954('0x11')](_0x1954('0xd'),_0x30beea,_0x2f2c4b[_0x1954('0x11')]['message']);return _0xda7a2f(_0x2f2c4b[_0x1954('0x11')]['message']);}else{logger['info'](_0x1954('0xd'),_0x30beea,_0x1954('0xe'));_0xda7a2f(_0x2f2c4b[_0x1954('0x12')][_0x1954('0x13')]);}})[_0x1954('0x14')](function(_0x37f4fc){logger[_0x1954('0x11')](_0x1954('0xd'),_0x30beea,_0x37f4fc);_0xa7a784(_0x37f4fc);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 553eea1..73745f5 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 _0x757a=['smsinteraction:update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','post','tracked','sms','smsinteraction:addtags','addTags','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x757a,0xde));var _0xa757=function(_0x394685,_0x4c4820){_0x394685=_0x394685-0x0;var _0x25054c=_0x757a[_0x394685];return _0x25054c;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/describe',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['show']);router[_0xa757('0x7')](_0xa757('0xc'),auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0x7')](_0xa757('0xe'),auth[_0xa757('0x9')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xa757('0xc'),auth['isAuthenticated'](),controller['addMessage']);router[_0xa757('0xf')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xa757('0x10')](_0xa757('0x11'),_0xa757('0x12')),controller[_0xa757('0x13')]);router[_0xa757('0x14')](_0xa757('0xb'),auth[_0xa757('0x9')](),interaction[_0xa757('0x10')](_0xa757('0x11'),_0xa757('0x15')),controller['update']);router[_0xa757('0x16')](_0xa757('0xb'),auth[_0xa757('0x9')](),interaction['tracked']('sms',_0xa757('0x17')),controller[_0xa757('0x18')]);router[_0xa757('0x16')](_0xa757('0x19'),auth[_0xa757('0x9')](),controller[_0xa757('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x9354=['/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0xd2e988,_0x3c642e){var _0x2ccd3b=function(_0x217238){while(--_0x217238){_0xd2e988['push'](_0xd2e988['shift']());}};_0x2ccd3b(++_0x3c642e);}(_0x9354,0x96));var _0x4935=function(_0x25ede0,_0x29dc39){_0x25ede0=_0x25ede0-0x0;var _0x16fc37=_0x9354[_0x25ede0];return _0x16fc37;};'use strict';var multer=require('multer');var util=require(_0x4935('0x0'));var path=require(_0x4935('0x1'));var timeout=require('connect-timeout');var express=require(_0x4935('0x2'));var router=express[_0x4935('0x3')]();var fs_extra=require(_0x4935('0x4'));var auth=require(_0x4935('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4935('0x6'));var controller=require(_0x4935('0x7'));router[_0x4935('0x8')]('/',auth[_0x4935('0x9')](),controller[_0x4935('0xa')]);router[_0x4935('0x8')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xc')]);router['get'](_0x4935('0xd'),auth['isAuthenticated'](),controller[_0x4935('0xe')]);router[_0x4935('0x8')](_0x4935('0xf'),auth[_0x4935('0x9')](),controller[_0x4935('0x10')]);router[_0x4935('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x4935('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4935('0x12')]);router[_0x4935('0x13')](_0x4935('0xf'),auth[_0x4935('0x9')](),controller[_0x4935('0x14')]);router[_0x4935('0x13')](_0x4935('0x15'),auth[_0x4935('0x9')](),interaction[_0x4935('0x16')](_0x4935('0x17'),_0x4935('0x18')),controller[_0x4935('0x19')]);router[_0x4935('0x1a')](_0x4935('0xd'),auth[_0x4935('0x9')](),interaction[_0x4935('0x16')]('sms',_0x4935('0x1b')),controller[_0x4935('0x1c')]);router[_0x4935('0x1d')](_0x4935('0xd'),auth[_0x4935('0x9')](),interaction[_0x4935('0x16')]('sms',_0x4935('0x1e')),controller[_0x4935('0x1f')]);router['delete'](_0x4935('0x15'),auth[_0x4935('0x9')](),controller[_0x4935('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index fb5cf26..fefde82 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 _0x3870=['exports','DATE','STRING','ENUM','out','BOOLEAN','sequelize','moment'];(function(_0x1dc493,_0x4ca11a){var _0x49fe7e=function(_0x4c9b64){while(--_0x4c9b64){_0x1dc493['push'](_0x1dc493['shift']());}};_0x49fe7e(++_0x4ca11a);}(_0x3870,0x146));var _0x0387=function(_0x4634dc,_0x400d5f){_0x4634dc=_0x4634dc-0x0;var _0x51321e=_0x3870[_0x4634dc];return _0x51321e;};'use strict';var Sequelize=require(_0x0387('0x0'));var moment=require(_0x0387('0x1'));module[_0x0387('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0387('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x0387('0x4')]},'thirdDisposition':{'type':Sequelize[_0x0387('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0387('0x4')]},'read1stAt':{'type':Sequelize[_0x0387('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0387('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0387('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x0387('0x5')]('in',_0x0387('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0387('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xde1e=['STRING','ENUM','out','INTEGER','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x49a6f3,_0x346c12){var _0x166e04=function(_0x2047c7){while(--_0x2047c7){_0x49a6f3['push'](_0x49a6f3['shift']());}};_0x166e04(++_0x346c12);}(_0xde1e,0x9d));var _0xede1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xde1e[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xede1('0x0'));var moment=require(_0xede1('0x1'));module[_0xede1('0x2')]={'closed':{'type':Sequelize[_0xede1('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xede1('0x4')]},'disposition':{'type':Sequelize[_0xede1('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xede1('0x5')]},'note':{'type':Sequelize[_0xede1('0x5')]},'phone':{'type':Sequelize[_0xede1('0x5')]},'read1stAt':{'type':Sequelize[_0xede1('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xede1('0x6')]('in',_0xede1('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xede1('0x6')]('in',_0xede1('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xede1('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xede1('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 999e56f..c7060c6 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 _0x6122=['format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','Tag','color','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName','direction','read','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','createdAt','closedAt','Messages','out','System','secret','value','renderFile','views','transcript-','.pdf','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','SmsInteraction','rawAttributes','type','getOptions','findAll','sms','query','show','model','keys','filters','intersection','fields','attributes','length','includeAll','include','options','find','create','body','catch','params','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','merge','filter','$gte','split'];(function(_0x30f68b,_0xfa973){var _0x140739=function(_0x44e025){while(--_0x44e025){_0x30f68b['push'](_0x30f68b['shift']());}};_0x140739(++_0xfa973);}(_0x6122,0xaa));var _0x2612=function(_0x10c4f9,_0x100fb4){_0x10c4f9=_0x10c4f9-0x0;var _0x522b09=_0x6122[_0x10c4f9];return _0x522b09;};'use strict';var rimraf=require(_0x2612('0x0'));var zipdir=require(_0x2612('0x1'));var moment=require(_0x2612('0x2'));var BPromise=require(_0x2612('0x3'));var util=require(_0x2612('0x4'));var path=require('path');var ejs=require(_0x2612('0x5'));var fs=require('fs');var _=require(_0x2612('0x6'));var Redis=require('ioredis');var interaction=require(_0x2612('0x7'));var qs=require(_0x2612('0x8'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x2612('0x9'));var config=require(_0x2612('0xa'));var db=require(_0x2612('0xb'))['db'];config[_0x2612('0xc')]=_[_0x2612('0xd')](config[_0x2612('0xc')],{'host':_0x2612('0xe'),'port':0x18eb});var socket=require(_0x2612('0xf'))(new Redis(config['redis']));require('./smsInteraction.socket')[_0x2612('0x10')](socket);function respondWithStatusCode(_0x4a618b,_0x57a862){_0x57a862=_0x57a862||0xcc;return function(_0x50f313){if(_0x50f313){return _0x4a618b[_0x2612('0x11')](_0x57a862);}return _0x4a618b[_0x2612('0x12')](_0x57a862)['end']();};}function respondWithResult(_0x16afce,_0x190bbb){_0x190bbb=_0x190bbb||0xc8;return function(_0x231c71){if(_0x231c71){return _0x16afce[_0x2612('0x12')](_0x190bbb)[_0x2612('0x13')](_0x231c71);}};}function respondWithFilteredResult(_0x54d21a,_0x38ec1b){return function(_0x570f8d){if(_0x570f8d){var _0x38f2c9=typeof _0x38ec1b['offset']===_0x2612('0x14')&&typeof _0x38ec1b[_0x2612('0x15')]===_0x2612('0x14');var _0x5f509a=_0x570f8d[_0x2612('0x16')];var _0x4240b7=_0x38f2c9?0x0:_0x38ec1b[_0x2612('0x17')];var _0xd1eead=_0x38f2c9?_0x570f8d[_0x2612('0x16')]:_0x38ec1b[_0x2612('0x17')]+_0x38ec1b[_0x2612('0x15')];var _0x3cfaa6;if(_0xd1eead>=_0x5f509a){_0xd1eead=_0x5f509a;_0x3cfaa6=0xc8;}else{_0x3cfaa6=0xce;}_0x54d21a[_0x2612('0x12')](_0x3cfaa6);return _0x54d21a[_0x2612('0x18')](_0x2612('0x19'),_0x4240b7+'-'+_0xd1eead+'/'+_0x5f509a)['json'](_0x570f8d);}return null;};}function saveUpdates(_0x763776){return function(_0x10a278){if(_0x10a278){return _0x10a278[_0x2612('0x1a')](_0x763776)[_0x2612('0x1b')](function(_0xf0f042){return _0xf0f042;});}return null;};}function removeEntity(_0x55b1ce){return function(_0x19c1ad){if(_0x19c1ad){return _0x19c1ad[_0x2612('0x1c')]()['then'](function(){_0x55b1ce[_0x2612('0x12')](0xcc)[_0x2612('0x1d')]();});}};}function handleEntityNotFound(_0x5caad7){return function(_0x180d62){if(!_0x180d62){_0x5caad7['sendStatus'](0x194);}return _0x180d62;};}function handleError(_0x179c77,_0x9c076f){_0x9c076f=_0x9c076f||0x1f4;return function(_0x20b8f2){logger['error'](_0x20b8f2[_0x2612('0x1e')]);if(_0x20b8f2[_0x2612('0x1f')]){delete _0x20b8f2[_0x2612('0x1f')];}_0x179c77[_0x2612('0x12')](_0x9c076f)[_0x2612('0x20')](_0x20b8f2);};}exports[_0x2612('0x21')]=function(_0x52a164,_0x2db678){var _0x31707c={};var _0x4556ba=_[_0x2612('0x22')](db[_0x2612('0x23')][_0x2612('0x24')],function(_0x2cceab){return{'name':_0x2cceab['fieldName'],'type':_0x2cceab[_0x2612('0x25')]['key']};});_0x31707c=qs[_0x2612('0x26')](_0x4556ba,_0x52a164);return interaction[_0x2612('0x27')](_0x2612('0x28'),_0x52a164[_0x2612('0x29')],_0x52a164['user'],_0x31707c,_0x4556ba)[_0x2612('0x1b')](respondWithFilteredResult(_0x2db678,_0x31707c))['catch'](handleError(_0x2db678,null));};exports[_0x2612('0x2a')]=function(_0xa2657f,_0x1aede1){var _0x54161d={'raw':![],'where':{'id':_0xa2657f['params']['id']}},_0x18f2d2={};_0x18f2d2[_0x2612('0x2b')]=_[_0x2612('0x2c')](db[_0x2612('0x23')][_0x2612('0x24')]);_0x18f2d2[_0x2612('0x29')]=_['keys'](_0xa2657f[_0x2612('0x29')]);_0x18f2d2[_0x2612('0x2d')]=_[_0x2612('0x2e')](_0x18f2d2['model'],_0x18f2d2[_0x2612('0x29')]);_0x54161d['attributes']=_[_0x2612('0x2e')](_0x18f2d2[_0x2612('0x2b')],qs[_0x2612('0x2f')](_0xa2657f['query'][_0x2612('0x2f')]));_0x54161d['attributes']=_0x54161d[_0x2612('0x30')][_0x2612('0x31')]?_0x54161d[_0x2612('0x30')]:_0x18f2d2[_0x2612('0x2b')];if(_0xa2657f[_0x2612('0x29')][_0x2612('0x32')]){_0x54161d[_0x2612('0x33')]=[{'all':!![]}];}_0x54161d=_['merge']({},_0x54161d,_0xa2657f[_0x2612('0x34')]);return db[_0x2612('0x23')][_0x2612('0x35')](_0x54161d)[_0x2612('0x1b')](handleEntityNotFound(_0x1aede1,null))['then'](respondWithResult(_0x1aede1,null))['catch'](handleError(_0x1aede1,null));};exports[_0x2612('0x36')]=function(_0x501df7,_0x3b99ab){return db[_0x2612('0x23')][_0x2612('0x36')](_0x501df7[_0x2612('0x37')],{})['then'](respondWithResult(_0x3b99ab,0xc9))[_0x2612('0x38')](handleError(_0x3b99ab,null));};exports[_0x2612('0x1a')]=function(_0x25aee2,_0x20e0c2){if(_0x25aee2[_0x2612('0x37')]['id']){delete _0x25aee2[_0x2612('0x37')]['id'];}return db[_0x2612('0x23')][_0x2612('0x35')]({'where':{'id':_0x25aee2[_0x2612('0x39')]['id']}})[_0x2612('0x1b')](handleEntityNotFound(_0x20e0c2,null))[_0x2612('0x1b')](saveUpdates(_0x25aee2[_0x2612('0x37')],null))[_0x2612('0x1b')](respondWithResult(_0x20e0c2,null))[_0x2612('0x38')](handleError(_0x20e0c2,null));};exports[_0x2612('0x1c')]=function(_0x1e4b78,_0x13412f){return db['SmsInteraction'][_0x2612('0x35')]({'where':{'id':_0x1e4b78[_0x2612('0x39')]['id']}})['then'](handleEntityNotFound(_0x13412f,null))[_0x2612('0x1b')](removeEntity(_0x13412f,null))['catch'](handleError(_0x13412f,null));};exports['describe']=function(_0x20e7e9,_0x2efaef){return db[_0x2612('0x23')][_0x2612('0x3a')]()[_0x2612('0x1b')](respondWithResult(_0x2efaef,null))[_0x2612('0x38')](handleError(_0x2efaef,null));};exports[_0x2612('0x3b')]=function(_0x1e60d6,_0x4633af){return db[_0x2612('0x3c')][_0x2612('0x35')]({'where':{'id':_0x1e60d6[_0x2612('0x39')]['id']}})['then'](handleEntityNotFound(_0x4633af,null))[_0x2612('0x1b')](function(_0x4b0741){if(_0x4b0741){return _0x4b0741[_0x2612('0x3b')](_0x1e60d6[_0x2612('0x37')][_0x2612('0x3d')],_[_0x2612('0x3e')](_0x1e60d6[_0x2612('0x37')],['ids','id'])||{});}})['then'](respondWithResult(_0x4633af,null))['catch'](handleError(_0x4633af,null));};exports[_0x2612('0x3f')]=function(_0x25c856,_0x125256){var _0x473cdc={'raw':![],'where':{}};var _0x526fb1={};var _0x1691a3={'count':0x0,'rows':[]};return db[_0x2612('0x23')][_0x2612('0x40')]({'where':{'id':_0x25c856[_0x2612('0x39')]['id']}})[_0x2612('0x1b')](handleEntityNotFound(_0x125256,null))[_0x2612('0x1b')](function(_0x2c7e04){if(_0x2c7e04){_0x526fb1[_0x2612('0x2b')]=_[_0x2612('0x2c')](db[_0x2612('0x3c')][_0x2612('0x24')]);_0x526fb1[_0x2612('0x29')]=_[_0x2612('0x2c')](_0x25c856[_0x2612('0x29')]);_0x526fb1[_0x2612('0x2d')]=_[_0x2612('0x2e')](_0x526fb1[_0x2612('0x2b')],_0x526fb1[_0x2612('0x29')]);_0x473cdc[_0x2612('0x30')]=_['intersection'](_0x526fb1[_0x2612('0x2b')],qs[_0x2612('0x2f')](_0x25c856['query'][_0x2612('0x2f')]));_0x473cdc['attributes']=_0x473cdc[_0x2612('0x30')][_0x2612('0x31')]?_0x473cdc[_0x2612('0x30')]:_0x526fb1[_0x2612('0x2b')];if(!_0x25c856[_0x2612('0x29')][_0x2612('0x41')](_0x2612('0x42'))){_0x473cdc[_0x2612('0x15')]=qs[_0x2612('0x15')](_0x25c856['query'][_0x2612('0x15')]);_0x473cdc[_0x2612('0x17')]=qs[_0x2612('0x17')](_0x25c856[_0x2612('0x29')][_0x2612('0x17')]);}_0x473cdc[_0x2612('0x43')]=qs[_0x2612('0x44')](_0x25c856[_0x2612('0x29')][_0x2612('0x44')]);_0x473cdc[_0x2612('0x45')]=qs[_0x2612('0x2d')](_[_0x2612('0x46')](_0x25c856[_0x2612('0x29')],_0x526fb1['filters']));_0x473cdc[_0x2612('0x45')][_0x2612('0x47')]=_0x2c7e04['id'];if(_0x25c856[_0x2612('0x29')]['filter']){_0x473cdc[_0x2612('0x45')]=_[_0x2612('0x48')](_0x473cdc['where'],{'$or':_[_0x2612('0x22')](_0x473cdc['attributes'],function(_0x2d542f){var _0x546012={};_0x546012[_0x2d542f]={'$like':'%'+_0x25c856[_0x2612('0x29')][_0x2612('0x49')]+'%'};return _0x546012;})});}if(_0x25c856['query'][_0x2612('0x4a')]){var _0x10aee2=_0x25c856[_0x2612('0x29')][_0x2612('0x4a')][_0x2612('0x4b')](',');var _0xe5a212={};_0xe5a212[_0x10aee2[0x0]]={'$gte':moment(_0x10aee2[0x1])[_0x2612('0x4c')](_0x2612('0x4d'))};_0x473cdc[_0x2612('0x45')]=_[_0x2612('0x48')](_0x473cdc[_0x2612('0x45')],_0xe5a212);}_0x473cdc=_['merge']({},_0x473cdc,_0x25c856[_0x2612('0x34')]);return db[_0x2612('0x3c')][_0x2612('0x16')]({'where':_0x473cdc[_0x2612('0x45')]})['then'](function(_0x375bf2){_0x1691a3['count']=_0x375bf2;if(_0x25c856[_0x2612('0x29')][_0x2612('0x32')]){_0x473cdc[_0x2612('0x33')]=[{'all':!![]}];}return db[_0x2612('0x3c')][_0x2612('0x27')](_0x473cdc);})[_0x2612('0x1b')](function(_0x3bfe91){_0x1691a3[_0x2612('0x4e')]=_0x3bfe91;return _0x1691a3;});}})['then'](respondWithFilteredResult(_0x125256,_0x473cdc))[_0x2612('0x38')](handleError(_0x125256,null));};exports[_0x2612('0x4f')]=function(_0x180ad5,_0x26cf6b){return db[_0x2612('0x23')][_0x2612('0x35')]({'where':{'id':_0x180ad5['params']['id']}})[_0x2612('0x1b')](handleEntityNotFound(_0x26cf6b,null))[_0x2612('0x1b')](function(_0x3364ca){if(_0x3364ca){return _0x3364ca[_0x2612('0x50')](_0x180ad5[_0x2612('0x37')][_0x2612('0x3d')],_['omit'](_0x180ad5[_0x2612('0x37')],[_0x2612('0x3d'),'id'])||{})['spread'](function(){return db[_0x2612('0x51')][_0x2612('0x27')]({'attributes':['id',_0x2612('0x1f'),_0x2612('0x52')],'where':{'id':_0x180ad5[_0x2612('0x37')][_0x2612('0x3d')]}});})['then'](function(_0x22a051){socket['emit'](_0x2612('0x53'),{'id':Number(_0x180ad5['params']['id']),'tags':_0x22a051||[]});return{'id':Number(_0x180ad5[_0x2612('0x39')]['id']),'tags':_0x22a051||[]};});}})[_0x2612('0x1b')](respondWithResult(_0x26cf6b,null))[_0x2612('0x38')](handleError(_0x26cf6b,null));};exports['removeTags']=function(_0x55f9c6,_0x1d9720){return db['SmsInteraction'][_0x2612('0x35')]({'where':{'id':_0x55f9c6[_0x2612('0x39')]['id']}})[_0x2612('0x1b')](handleEntityNotFound(_0x1d9720,null))[_0x2612('0x1b')](function(_0x2bb2d2){if(_0x2bb2d2){return _0x2bb2d2[_0x2612('0x54')](_0x55f9c6[_0x2612('0x29')][_0x2612('0x3d')]);}})[_0x2612('0x1b')](respondWithStatusCode(_0x1d9720,null))[_0x2612('0x38')](handleError(_0x1d9720,null));};exports[_0x2612('0x55')]=function(_0x447747,_0x261914){var _0x5d74b7=moment()[_0x2612('0x56')]()[_0x2612('0x57')]();var _0x2fed09=path[_0x2612('0x58')](config[_0x2612('0x59')],_0x2612('0x5a'),_0x2612('0x5b'),_0x2612('0x5c'));var _0x614dd2=path['join'](_0x2fed09,_0x5d74b7);var _0x44ee83=util[_0x2612('0x4c')](_0x2612('0x5d'),_0x447747['params']['id'],_0x5d74b7);var _0x3b3617=path[_0x2612('0x58')](_0x2fed09,_0x44ee83);var _0x5ab064=[];_0x5ab064[_0x2612('0x5e')]({'model':db[_0x2612('0x5f')],'as':_0x2612('0x5f'),'attributes':['id',_0x2612('0x60')],'raw':!![]});_0x5ab064[_0x2612('0x5e')]({'model':db['CmContact'],'as':_0x2612('0x61'),'attributes':['id',_0x2612('0x62'),_0x2612('0x63')],'raw':!![]});var _0x518b38=[{'model':db[_0x2612('0x3c')],'as':'Messages','attributes':['id',_0x2612('0x37'),'createdAt',_0x2612('0x64'),'secret',_0x2612('0x65')],'include':_0x5ab064}];_0x518b38['push']({'model':db[_0x2612('0x66')],'as':_0x2612('0x67'),'attributes':['id','name']});_0x518b38[_0x2612('0x5e')]({'model':db[_0x2612('0x5f')],'as':_0x2612('0x68'),'attributes':['id',_0x2612('0x60')]});return db[_0x2612('0x23')][_0x2612('0x35')]({'where':{'id':_0x447747[_0x2612('0x39')]['id']},'include':_0x518b38})[_0x2612('0x1b')](handleEntityNotFound(_0x261914,null))[_0x2612('0x1b')](function(_0x196f49){if(_0x196f49){var _0x5ed122=_0x196f49[_0x2612('0x69')]({'plain':!![]});fs[_0x2612('0x6a')](_0x614dd2);var _0x11ff30={'channel':_0x2612('0x6b'),'account':_0x5ed122[_0x2612('0x67')][_0x2612('0x1f')],'agent':_0x5ed122[_0x2612('0x68')]?_0x5ed122[_0x2612('0x68')][_0x2612('0x60')]:_0x2612('0x6c'),'createdAt':moment(_0x5ed122[_0x2612('0x6d')])[_0x2612('0x4c')](_0x2612('0x4d'))[_0x2612('0x57')](),'closedAt':_0x5ed122['closed']?moment(_0x5ed122[_0x2612('0x6e')])[_0x2612('0x4c')](_0x2612('0x4d'))[_0x2612('0x57')]():'','disposition':_0x5ed122['disposition'],'messages':_(_0x5ed122[_0x2612('0x6f')])[_0x2612('0x49')]({'secret':![]})[_0x2612('0x22')](function(_0x246e2e){return{'date':moment(_0x246e2e[_0x2612('0x6d')])[_0x2612('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2612('0x57')](),'sender':_0x246e2e[_0x2612('0x64')]===_0x2612('0x70')?_0x246e2e['User']?_0x246e2e['User'][_0x2612('0x60')]:_0x2612('0x71'):_0x246e2e[_0x2612('0x61')][_0x2612('0x62')]+(_0x246e2e['Contact'][_0x2612('0x63')]?'\x20'+_0x246e2e[_0x2612('0x61')]['lastName']:''),'body':_0x246e2e['body'],'direction':_0x246e2e[_0x2612('0x64')]===_0x2612('0x70')?'A':'C','secret':_0x246e2e[_0x2612('0x72')],'read':_0x246e2e[_0x2612('0x65')]};})[_0x2612('0x73')]()};return ejs[_0x2612('0x74')](path[_0x2612('0x58')](config['root'],'server',_0x2612('0x75'),'downloadInteraction.ejs'),{'interaction':_0x11ff30})['then'](function(_0x5128e6){var _0x3a588d=path[_0x2612('0x58')](_0x614dd2,_0x2612('0x76')+_0x5ed122['id']+'-'+_0x5d74b7+_0x2612('0x77'));var _0x51b2e8={'path':_0x3a588d,'channel':_0x2612('0x6b'),'interactionId':_0x5ed122['id']};return pdf['createPdfFromHTML'](_0x5128e6,_0x51b2e8);})[_0x2612('0x1b')](function(){return new BPromise(function(_0x436575,_0x21137e){zipdir(_0x614dd2,{'saveTo':_0x3b3617},function(_0x21a9f3,_0x5f1dbf){if(_0x21a9f3)return _0x21137e(_0x21a9f3);return _0x436575(_0x5f1dbf);});})[_0x2612('0x1b')](function(){return new BPromise(function(_0x387253,_0x42bbee){rimraf(_0x614dd2,function(_0x14f6a4){if(_0x14f6a4)_0x42bbee(_0x14f6a4);return _0x387253();});});})[_0x2612('0x1b')](function(){return _0x261914[_0x2612('0x55')](_0x3b3617,_0x44ee83,function(_0x285d7c){if(_0x285d7c){console[_0x2612('0x78')](_0x2612('0x79'),_0x285d7c);}else{fs[_0x2612('0x7a')](_0x3b3617);}});});});}else{return _0x261914[_0x2612('0x11')](0xc8);}})['catch'](handleError(_0x261914,null));}; \ No newline at end of file +var _0xd481=['SmsInteractionId','filter','merge','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','Tag','findAll','color','emit','smsInteractionTags:save','download','unix','join','root','server','files','format','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','lastName','Messages','createdAt','direction','secret','read','fullname','Owner','N.A.','closed','closedAt','toString','disposition','out','value','renderFile','views','downloadInteraction.ejs','.pdf','Sms','createPdfFromHTML','log','err','unlinkSync','zip-dir','moment','util','path','lodash','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','./smsInteraction.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','sms','query','catch','params','model','keys','SmsInteraction','filters','intersection','attributes','fields','length','includeAll','include','options','find','create','body','describe','SmsMessage','ids','getMessages','findOne','nolimit','order','sort','where','pick'];(function(_0x1aebd7,_0x4618ff){var _0x2a238a=function(_0x6091ea){while(--_0x6091ea){_0x1aebd7['push'](_0x1aebd7['shift']());}};_0x2a238a(++_0x4618ff);}(_0xd481,0x197));var _0x1d48=function(_0x33cb6f,_0x5d7ad5){_0x33cb6f=_0x33cb6f-0x0;var _0x554831=_0xd481[_0x33cb6f];return _0x554831;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x1d48('0x0'));var moment=require(_0x1d48('0x1'));var BPromise=require('bluebird');var util=require(_0x1d48('0x2'));var path=require(_0x1d48('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1d48('0x4'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0x1d48('0x5'));var logger=require(_0x1d48('0x6'))(_0x1d48('0x7'));var config=require(_0x1d48('0x8'));var db=require(_0x1d48('0x9'))['db'];config['redis']=_[_0x1d48('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1d48('0xb'))[_0x1d48('0xc')](socket);function respondWithStatusCode(_0x387bb2,_0x4d8a92){_0x4d8a92=_0x4d8a92||0xcc;return function(_0x3053aa){if(_0x3053aa){return _0x387bb2[_0x1d48('0xd')](_0x4d8a92);}return _0x387bb2['status'](_0x4d8a92)['end']();};}function respondWithResult(_0x76cfa4,_0x3ec3f5){_0x3ec3f5=_0x3ec3f5||0xc8;return function(_0x443105){if(_0x443105){return _0x76cfa4[_0x1d48('0xe')](_0x3ec3f5)[_0x1d48('0xf')](_0x443105);}};}function respondWithFilteredResult(_0x307736,_0x5d3d7d){return function(_0x46c4a7){if(_0x46c4a7){var _0x12a30e=typeof _0x5d3d7d['offset']===_0x1d48('0x10')&&typeof _0x5d3d7d[_0x1d48('0x11')]===_0x1d48('0x10');var _0x517dd5=_0x46c4a7[_0x1d48('0x12')];var _0x49fa1b=_0x12a30e?0x0:_0x5d3d7d[_0x1d48('0x13')];var _0x411b54=_0x12a30e?_0x46c4a7[_0x1d48('0x12')]:_0x5d3d7d['offset']+_0x5d3d7d[_0x1d48('0x11')];var _0x2598e2;if(_0x411b54>=_0x517dd5){_0x411b54=_0x517dd5;_0x2598e2=0xc8;}else{_0x2598e2=0xce;}_0x307736['status'](_0x2598e2);return _0x307736[_0x1d48('0x14')](_0x1d48('0x15'),_0x49fa1b+'-'+_0x411b54+'/'+_0x517dd5)[_0x1d48('0xf')](_0x46c4a7);}return null;};}function saveUpdates(_0x196d52){return function(_0x3d7e0b){if(_0x3d7e0b){return _0x3d7e0b[_0x1d48('0x16')](_0x196d52)[_0x1d48('0x17')](function(_0x51842b){return _0x51842b;});}return null;};}function removeEntity(_0x2a26a3){return function(_0x305e78){if(_0x305e78){return _0x305e78[_0x1d48('0x18')]()['then'](function(){_0x2a26a3[_0x1d48('0xe')](0xcc)[_0x1d48('0x19')]();});}};}function handleEntityNotFound(_0x27c7fc){return function(_0x242852){if(!_0x242852){_0x27c7fc[_0x1d48('0xd')](0x194);}return _0x242852;};}function handleError(_0x33b59e,_0x304ba7){_0x304ba7=_0x304ba7||0x1f4;return function(_0x54e5e4){logger[_0x1d48('0x1a')](_0x54e5e4[_0x1d48('0x1b')]);if(_0x54e5e4[_0x1d48('0x1c')]){delete _0x54e5e4['name'];}_0x33b59e[_0x1d48('0xe')](_0x304ba7)[_0x1d48('0x1d')](_0x54e5e4);};}exports[_0x1d48('0x1e')]=function(_0x293fd4,_0x181fa){var _0x291ddf={};var _0x27b38a=_[_0x1d48('0x1f')](db['SmsInteraction'][_0x1d48('0x20')],function(_0x36edf4){return{'name':_0x36edf4[_0x1d48('0x21')],'type':_0x36edf4[_0x1d48('0x22')][_0x1d48('0x23')]};});_0x291ddf=qs[_0x1d48('0x24')](_0x27b38a,_0x293fd4);return interaction['findAll'](_0x1d48('0x25'),_0x293fd4[_0x1d48('0x26')],_0x293fd4['user'],_0x291ddf,_0x27b38a)['then'](respondWithFilteredResult(_0x181fa,_0x291ddf))[_0x1d48('0x27')](handleError(_0x181fa,null));};exports['show']=function(_0x3d71f1,_0x338904){var _0x5ccd3a={'raw':![],'where':{'id':_0x3d71f1[_0x1d48('0x28')]['id']}},_0x2f0448={};_0x2f0448[_0x1d48('0x29')]=_[_0x1d48('0x2a')](db[_0x1d48('0x2b')]['rawAttributes']);_0x2f0448['query']=_['keys'](_0x3d71f1['query']);_0x2f0448[_0x1d48('0x2c')]=_[_0x1d48('0x2d')](_0x2f0448[_0x1d48('0x29')],_0x2f0448['query']);_0x5ccd3a[_0x1d48('0x2e')]=_[_0x1d48('0x2d')](_0x2f0448[_0x1d48('0x29')],qs['fields'](_0x3d71f1[_0x1d48('0x26')][_0x1d48('0x2f')]));_0x5ccd3a['attributes']=_0x5ccd3a[_0x1d48('0x2e')][_0x1d48('0x30')]?_0x5ccd3a[_0x1d48('0x2e')]:_0x2f0448[_0x1d48('0x29')];if(_0x3d71f1[_0x1d48('0x26')][_0x1d48('0x31')]){_0x5ccd3a[_0x1d48('0x32')]=[{'all':!![]}];}_0x5ccd3a=_['merge']({},_0x5ccd3a,_0x3d71f1[_0x1d48('0x33')]);return db[_0x1d48('0x2b')][_0x1d48('0x34')](_0x5ccd3a)[_0x1d48('0x17')](handleEntityNotFound(_0x338904,null))[_0x1d48('0x17')](respondWithResult(_0x338904,null))[_0x1d48('0x27')](handleError(_0x338904,null));};exports[_0x1d48('0x35')]=function(_0x3a07b4,_0x33c5c7){return db['SmsInteraction'][_0x1d48('0x35')](_0x3a07b4[_0x1d48('0x36')],{})['then'](respondWithResult(_0x33c5c7,0xc9))[_0x1d48('0x27')](handleError(_0x33c5c7,null));};exports[_0x1d48('0x16')]=function(_0x17ce13,_0x13f24d){if(_0x17ce13[_0x1d48('0x36')]['id']){delete _0x17ce13[_0x1d48('0x36')]['id'];}return db[_0x1d48('0x2b')][_0x1d48('0x34')]({'where':{'id':_0x17ce13[_0x1d48('0x28')]['id']}})['then'](handleEntityNotFound(_0x13f24d,null))[_0x1d48('0x17')](saveUpdates(_0x17ce13[_0x1d48('0x36')],null))[_0x1d48('0x17')](respondWithResult(_0x13f24d,null))[_0x1d48('0x27')](handleError(_0x13f24d,null));};exports[_0x1d48('0x18')]=function(_0x55aa0c,_0x4dd352){return db[_0x1d48('0x2b')][_0x1d48('0x34')]({'where':{'id':_0x55aa0c['params']['id']}})['then'](handleEntityNotFound(_0x4dd352,null))['then'](removeEntity(_0x4dd352,null))[_0x1d48('0x27')](handleError(_0x4dd352,null));};exports['describe']=function(_0x16b160,_0x122382){return db['SmsInteraction'][_0x1d48('0x37')]()[_0x1d48('0x17')](respondWithResult(_0x122382,null))[_0x1d48('0x27')](handleError(_0x122382,null));};exports['addMessage']=function(_0x29d67f,_0x47d52a){return db[_0x1d48('0x38')]['find']({'where':{'id':_0x29d67f[_0x1d48('0x28')]['id']}})['then'](handleEntityNotFound(_0x47d52a,null))[_0x1d48('0x17')](function(_0x61104d){if(_0x61104d){return _0x61104d['addMessage'](_0x29d67f[_0x1d48('0x36')]['ids'],_['omit'](_0x29d67f['body'],[_0x1d48('0x39'),'id'])||{});}})[_0x1d48('0x17')](respondWithResult(_0x47d52a,null))[_0x1d48('0x27')](handleError(_0x47d52a,null));};exports[_0x1d48('0x3a')]=function(_0x2a62cd,_0x5d8ce9){var _0x11f15c={'raw':![],'where':{}};var _0x165c15={};var _0x2c59e5={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x1d48('0x3b')]({'where':{'id':_0x2a62cd[_0x1d48('0x28')]['id']}})[_0x1d48('0x17')](handleEntityNotFound(_0x5d8ce9,null))[_0x1d48('0x17')](function(_0x12cec7){if(_0x12cec7){_0x165c15['model']=_['keys'](db[_0x1d48('0x38')]['rawAttributes']);_0x165c15['query']=_[_0x1d48('0x2a')](_0x2a62cd[_0x1d48('0x26')]);_0x165c15[_0x1d48('0x2c')]=_[_0x1d48('0x2d')](_0x165c15[_0x1d48('0x29')],_0x165c15[_0x1d48('0x26')]);_0x11f15c[_0x1d48('0x2e')]=_[_0x1d48('0x2d')](_0x165c15['model'],qs['fields'](_0x2a62cd['query']['fields']));_0x11f15c['attributes']=_0x11f15c['attributes'][_0x1d48('0x30')]?_0x11f15c[_0x1d48('0x2e')]:_0x165c15[_0x1d48('0x29')];if(!_0x2a62cd['query']['hasOwnProperty'](_0x1d48('0x3c'))){_0x11f15c['limit']=qs[_0x1d48('0x11')](_0x2a62cd[_0x1d48('0x26')][_0x1d48('0x11')]);_0x11f15c[_0x1d48('0x13')]=qs[_0x1d48('0x13')](_0x2a62cd[_0x1d48('0x26')][_0x1d48('0x13')]);}_0x11f15c[_0x1d48('0x3d')]=qs['sort'](_0x2a62cd['query'][_0x1d48('0x3e')]);_0x11f15c[_0x1d48('0x3f')]=qs[_0x1d48('0x2c')](_[_0x1d48('0x40')](_0x2a62cd[_0x1d48('0x26')],_0x165c15[_0x1d48('0x2c')]));_0x11f15c['where'][_0x1d48('0x41')]=_0x12cec7['id'];if(_0x2a62cd[_0x1d48('0x26')][_0x1d48('0x42')]){_0x11f15c[_0x1d48('0x3f')]=_[_0x1d48('0x43')](_0x11f15c[_0x1d48('0x3f')],{'$or':_[_0x1d48('0x1f')](_0x11f15c['attributes'],function(_0x5db571){var _0x51ede5={};_0x51ede5[_0x5db571]={'$like':'%'+_0x2a62cd['query'][_0x1d48('0x42')]+'%'};return _0x51ede5;})});}if(_0x2a62cd[_0x1d48('0x26')]['$gte']){var _0x43dbca=_0x2a62cd[_0x1d48('0x26')][_0x1d48('0x44')][_0x1d48('0x45')](',');var _0x129d74={};_0x129d74[_0x43dbca[0x0]]={'$gte':moment(_0x43dbca[0x1])['format'](_0x1d48('0x46'))};_0x11f15c[_0x1d48('0x3f')]=_[_0x1d48('0x43')](_0x11f15c[_0x1d48('0x3f')],_0x129d74);}_0x11f15c=_[_0x1d48('0x43')]({},_0x11f15c,_0x2a62cd[_0x1d48('0x33')]);return db[_0x1d48('0x38')][_0x1d48('0x12')]({'where':_0x11f15c[_0x1d48('0x3f')]})['then'](function(_0x144773){_0x2c59e5[_0x1d48('0x12')]=_0x144773;if(_0x2a62cd[_0x1d48('0x26')][_0x1d48('0x31')]){_0x11f15c[_0x1d48('0x32')]=[{'all':!![]}];}return db[_0x1d48('0x38')]['findAll'](_0x11f15c);})['then'](function(_0x4931bb){_0x2c59e5[_0x1d48('0x47')]=_0x4931bb;return _0x2c59e5;});}})[_0x1d48('0x17')](respondWithFilteredResult(_0x5d8ce9,_0x11f15c))[_0x1d48('0x27')](handleError(_0x5d8ce9,null));};exports[_0x1d48('0x48')]=function(_0x3eaa99,_0xdfcecc){return db['SmsInteraction']['find']({'where':{'id':_0x3eaa99[_0x1d48('0x28')]['id']}})[_0x1d48('0x17')](handleEntityNotFound(_0xdfcecc,null))[_0x1d48('0x17')](function(_0x186858){if(_0x186858){return _0x186858[_0x1d48('0x49')](_0x3eaa99['body'][_0x1d48('0x39')],_[_0x1d48('0x4a')](_0x3eaa99[_0x1d48('0x36')],['ids','id'])||{})[_0x1d48('0x4b')](function(){return db[_0x1d48('0x4c')][_0x1d48('0x4d')]({'attributes':['id',_0x1d48('0x1c'),_0x1d48('0x4e')],'where':{'id':_0x3eaa99[_0x1d48('0x36')][_0x1d48('0x39')]}});})['then'](function(_0x2813f3){socket[_0x1d48('0x4f')](_0x1d48('0x50'),{'id':Number(_0x3eaa99[_0x1d48('0x28')]['id']),'tags':_0x2813f3||[]});return{'id':Number(_0x3eaa99['params']['id']),'tags':_0x2813f3||[]};});}})[_0x1d48('0x17')](respondWithResult(_0xdfcecc,null))[_0x1d48('0x27')](handleError(_0xdfcecc,null));};exports['removeTags']=function(_0xbda1f7,_0x13952b){return db[_0x1d48('0x2b')][_0x1d48('0x34')]({'where':{'id':_0xbda1f7[_0x1d48('0x28')]['id']}})[_0x1d48('0x17')](handleEntityNotFound(_0x13952b,null))[_0x1d48('0x17')](function(_0x5ec9e2){if(_0x5ec9e2){return _0x5ec9e2['removeTags'](_0xbda1f7[_0x1d48('0x26')][_0x1d48('0x39')]);}})['then'](respondWithStatusCode(_0x13952b,null))[_0x1d48('0x27')](handleError(_0x13952b,null));};exports[_0x1d48('0x51')]=function(_0x128adc,_0x45c754){var _0x4c7452=moment()[_0x1d48('0x52')]()['toString']();var _0x33e00d=path[_0x1d48('0x53')](config[_0x1d48('0x54')],_0x1d48('0x55'),_0x1d48('0x56'),'tmp');var _0x476aa8=path[_0x1d48('0x53')](_0x33e00d,_0x4c7452);var _0xf12fc0=util[_0x1d48('0x57')](_0x1d48('0x58'),_0x128adc['params']['id'],_0x4c7452);var _0x361884=path[_0x1d48('0x53')](_0x33e00d,_0xf12fc0);var _0x2ee32e=[];_0x2ee32e[_0x1d48('0x59')]({'model':db[_0x1d48('0x5a')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x2ee32e[_0x1d48('0x59')]({'model':db[_0x1d48('0x5b')],'as':_0x1d48('0x5c'),'attributes':['id',_0x1d48('0x5d'),_0x1d48('0x5e')],'raw':!![]});var _0x383473=[{'model':db[_0x1d48('0x38')],'as':_0x1d48('0x5f'),'attributes':['id','body',_0x1d48('0x60'),_0x1d48('0x61'),_0x1d48('0x62'),_0x1d48('0x63')],'include':_0x2ee32e}];_0x383473['push']({'model':db['SmsAccount'],'as':'Account','attributes':['id',_0x1d48('0x1c')]});_0x383473['push']({'model':db[_0x1d48('0x5a')],'as':'Owner','attributes':['id',_0x1d48('0x64')]});return db['SmsInteraction'][_0x1d48('0x34')]({'where':{'id':_0x128adc[_0x1d48('0x28')]['id']},'include':_0x383473})[_0x1d48('0x17')](handleEntityNotFound(_0x45c754,null))[_0x1d48('0x17')](function(_0x4c9eb2){if(_0x4c9eb2){var _0x58fce0=_0x4c9eb2['get']({'plain':!![]});fs['mkdirSync'](_0x476aa8);var _0x9bd4a4={'channel':'Sms','account':_0x58fce0['Account']['name'],'agent':_0x58fce0[_0x1d48('0x65')]?_0x58fce0[_0x1d48('0x65')]['fullname']:_0x1d48('0x66'),'createdAt':moment(_0x58fce0[_0x1d48('0x60')])[_0x1d48('0x57')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x58fce0[_0x1d48('0x67')]?moment(_0x58fce0[_0x1d48('0x68')])['format'](_0x1d48('0x46'))[_0x1d48('0x69')]():'','disposition':_0x58fce0[_0x1d48('0x6a')],'messages':_(_0x58fce0[_0x1d48('0x5f')])['filter']({'secret':![]})[_0x1d48('0x1f')](function(_0x8eba81){return{'date':moment(_0x8eba81[_0x1d48('0x60')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x1d48('0x69')](),'sender':_0x8eba81[_0x1d48('0x61')]===_0x1d48('0x6b')?_0x8eba81['User']?_0x8eba81[_0x1d48('0x5a')][_0x1d48('0x64')]:'System':_0x8eba81[_0x1d48('0x5c')]['firstName']+(_0x8eba81[_0x1d48('0x5c')]['lastName']?'\x20'+_0x8eba81['Contact'][_0x1d48('0x5e')]:''),'body':_0x8eba81['body'],'direction':_0x8eba81[_0x1d48('0x61')]===_0x1d48('0x6b')?'A':'C','secret':_0x8eba81['secret'],'read':_0x8eba81[_0x1d48('0x63')]};})[_0x1d48('0x6c')]()};return ejs[_0x1d48('0x6d')](path[_0x1d48('0x53')](config[_0x1d48('0x54')],'server',_0x1d48('0x6e'),_0x1d48('0x6f')),{'interaction':_0x9bd4a4})[_0x1d48('0x17')](function(_0x4582ad){var _0x5b3704=path[_0x1d48('0x53')](_0x476aa8,'transcript-'+_0x58fce0['id']+'-'+_0x4c7452+_0x1d48('0x70'));var _0x567e18={'path':_0x5b3704,'channel':_0x1d48('0x71'),'interactionId':_0x58fce0['id']};return pdf[_0x1d48('0x72')](_0x4582ad,_0x567e18);})[_0x1d48('0x17')](function(){return new BPromise(function(_0x5cbdea,_0x326c08){zipdir(_0x476aa8,{'saveTo':_0x361884},function(_0x88de1b,_0x58ca0a){if(_0x88de1b)return _0x326c08(_0x88de1b);return _0x5cbdea(_0x58ca0a);});})[_0x1d48('0x17')](function(){return new BPromise(function(_0x333abc,_0x40ff5d){rimraf(_0x476aa8,function(_0x3373c8){if(_0x3373c8)_0x40ff5d(_0x3373c8);return _0x333abc();});});})[_0x1d48('0x17')](function(){return _0x45c754[_0x1d48('0x51')](_0x361884,_0xf12fc0,function(_0x312398){if(_0x312398){console[_0x1d48('0x73')](_0x1d48('0x74'),_0x312398);}else{fs[_0x1d48('0x75')](_0x361884);}});});});}else{return _0x45c754[_0x1d48('0xd')](0xc8);}})[_0x1d48('0x27')](handleError(_0x45c754,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index ec53142..7339478 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 _0x28f2=['update','remove','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','SmsMessage','save'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x28f2,0x193));var _0x228f=function(_0x4e41de,_0x2e18c8){_0x4e41de=_0x4e41de-0x0;var _0x400904=_0x28f2[_0x4e41de];return _0x400904;};'use strict';var EventEmitter=require(_0x228f('0x0'));var SmsInteraction=require(_0x228f('0x1'))['db'][_0x228f('0x2')];var SmsMessage=require(_0x228f('0x1'))['db'][_0x228f('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x228f('0x4'),'afterUpdate':_0x228f('0x5'),'afterDestroy':_0x228f('0x6')};function emitEvent(_0x4303c3){return function(_0x2bb7d7,_0x3439f5,_0x32c5c3){_0x2bb7d7['getUsers']({'attributes':['id'],'raw':!![]})[_0x228f('0x7')](function(_0x4a4a44){_0x2bb7d7[_0x228f('0x8')](_0x228f('0x9'),_0x4a4a44[_0x228f('0xa')](function(_0x5f406c){return{'id':_0x5f406c['id']};}));return SmsMessage[_0x228f('0xb')]({'where':{'SmsInteractionId':_0x2bb7d7['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x212c90){_0x2bb7d7[_0x228f('0x8')]('unreadMessages',_0x212c90[_0x228f('0xc')]);SmsInteractionEvents[_0x228f('0xd')](_0x4303c3+':'+_0x2bb7d7['id'],_0x2bb7d7);SmsInteractionEvents[_0x228f('0xd')](_0x4303c3,_0x2bb7d7);_0x32c5c3(null);})[_0x228f('0xe')](_0x32c5c3(null));};}for(var e in events){if(events[_0x228f('0xf')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x228f('0x10')]=SmsInteractionEvents; \ No newline at end of file +var _0x9f0e=['unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','SmsInteraction','SmsMessage','update','remove','then','setDataValue','map','findAll'];(function(_0x342465,_0x3aa51b){var _0x4a4da7=function(_0x1047e1){while(--_0x1047e1){_0x342465['push'](_0x342465['shift']());}};_0x4a4da7(++_0x3aa51b);}(_0x9f0e,0x116));var _0xe9f0=function(_0x268b6b,_0x22994a){_0x268b6b=_0x268b6b-0x0;var _0x3cd483=_0x9f0e[_0x268b6b];return _0x3cd483;};'use strict';var EventEmitter=require(_0xe9f0('0x0'));var SmsInteraction=require(_0xe9f0('0x1'))['db'][_0xe9f0('0x2')];var SmsMessage=require(_0xe9f0('0x1'))['db'][_0xe9f0('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe9f0('0x4'),'afterDestroy':_0xe9f0('0x5')};function emitEvent(_0x3c589d){return function(_0x202d69,_0x1eed45,_0x50313d){_0x202d69['getUsers']({'attributes':['id'],'raw':!![]})[_0xe9f0('0x6')](function(_0x167198){_0x202d69[_0xe9f0('0x7')]('Users',_0x167198[_0xe9f0('0x8')](function(_0x335b82){return{'id':_0x335b82['id']};}));return SmsMessage[_0xe9f0('0x9')]({'where':{'SmsInteractionId':_0x202d69['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe9f0('0x6')](function(_0xa523c0){_0x202d69[_0xe9f0('0x7')](_0xe9f0('0xa'),_0xa523c0[_0xe9f0('0xb')]);SmsInteractionEvents[_0xe9f0('0xc')](_0x3c589d+':'+_0x202d69['id'],_0x202d69);SmsInteractionEvents['emit'](_0x3c589d,_0x202d69);_0x50313d(null);})[_0xe9f0('0xd')](_0x50313d(null));};}for(var e in events){if(events[_0xe9f0('0xe')](e)){var event=events[e];SmsInteraction[_0xe9f0('0xf')](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 d2dbf1f..8fa1853 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 _0xf5e6=['./smsInteraction.attributes','exports','sms_interactions','changed','closed','closedAt','format','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5484b1,_0x2bd562){var _0x43e83f=function(_0x186c4e){while(--_0x186c4e){_0x5484b1['push'](_0x5484b1['shift']());}};_0x43e83f(++_0x2bd562);}(_0xf5e6,0x97));var _0x6f5e=function(_0x1acc21,_0x323e67){_0x1acc21=_0x1acc21-0x0;var _0x16031a=_0xf5e6[_0x1acc21];return _0x16031a;};'use strict';var _=require(_0x6f5e('0x0'));var util=require(_0x6f5e('0x1'));var logger=require(_0x6f5e('0x2'))(_0x6f5e('0x3'));var moment=require(_0x6f5e('0x4'));var BPromise=require(_0x6f5e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f5e('0x6'));var rimraf=require(_0x6f5e('0x7'));var config=require(_0x6f5e('0x8'));var attributes=require(_0x6f5e('0x9'));module[_0x6f5e('0xa')]=function(_0x218eac,_0x516cd5){return _0x218eac['define']('SmsInteraction',attributes,{'tableName':_0x6f5e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xf51f16,_0x41b2ab,_0x25317e){if(_0xf51f16[_0x6f5e('0xc')](_0x6f5e('0xd'))){_0xf51f16[_0x6f5e('0xe')]=moment()[_0x6f5e('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x25317e(null,_0xf51f16);}}});}; \ No newline at end of file +var _0xe31c=['YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','request-promise','path','rimraf','./smsInteraction.attributes','exports','define','SmsInteraction','changed','closed','format'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe31c,0x1dd));var _0xce31=function(_0x5f2a55,_0x1c9e68){_0x5f2a55=_0x5f2a55-0x0;var _0x25fb9e=_0xe31c[_0x5f2a55];return _0x25fb9e;};'use strict';var _=require('lodash');var util=require(_0xce31('0x0'));var logger=require(_0xce31('0x1'))('api');var moment=require(_0xce31('0x2'));var BPromise=require('bluebird');var rp=require(_0xce31('0x3'));var fs=require('fs');var path=require(_0xce31('0x4'));var rimraf=require(_0xce31('0x5'));var config=require('../../config/environment');var attributes=require(_0xce31('0x6'));module[_0xce31('0x7')]=function(_0x3a2e9a,_0x2d23e6){return _0x3a2e9a[_0xce31('0x8')](_0xce31('0x9'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x8f429a,_0x1004ed,_0x2b8f84){if(_0x8f429a[_0xce31('0xa')](_0xce31('0xb'))){_0x8f429a['closedAt']=moment()[_0xce31('0xc')](_0xce31('0xd'));}_0x2b8f84(null,_0x8f429a);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index d1781f4..6c53e58 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 _0x67a2=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./smsInteraction.socket','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','attributes','find','addTags','omit','ids','spread','AddTags','lodash','util','moment','randomstring'];(function(_0x152b4f,_0x2fdc9b){var _0x13e49a=function(_0x4fe84b){while(--_0x4fe84b){_0x152b4f['push'](_0x152b4f['shift']());}};_0x13e49a(++_0x2fdc9b);}(_0x67a2,0x12c));var _0x267a=function(_0x13aa7e,_0x775d0e){_0x13aa7e=_0x13aa7e-0x0;var _0x387b57=_0x67a2[_0x13aa7e];return _0x387b57;};'use strict';var _=require(_0x267a('0x0'));var util=require(_0x267a('0x1'));var moment=require(_0x267a('0x2'));var BPromise=require('bluebird');var rs=require(_0x267a('0x3'));var fs=require('fs');var Redis=require(_0x267a('0x4'));var db=require(_0x267a('0x5'))['db'];var utils=require(_0x267a('0x6'));var logger=require('../../config/logger')(_0x267a('0x7'));var config=require(_0x267a('0x8'));var jayson=require(_0x267a('0x9'));var client=jayson['client'][_0x267a('0xa')]({'port':0x232a});config[_0x267a('0xb')]=_['defaults'](config[_0x267a('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x267a('0xc'))(new Redis(config[_0x267a('0xb')]));require(_0x267a('0xd'))['register'](socket);function respondWithRpcPromise(_0x4cf8e1,_0x2775a3,_0x2c0cc8){return new BPromise(function(_0x4a1928,_0x3c315f){return client['request'](_0x4cf8e1,_0x2c0cc8)[_0x267a('0xe')](function(_0x57111b){logger[_0x267a('0xf')](_0x267a('0x10'),_0x2775a3,_0x267a('0x11'));logger[_0x267a('0x12')](_0x267a('0x13'),_0x2775a3,_0x267a('0x11'),JSON[_0x267a('0x14')](_0x57111b));if(_0x57111b['error']){if(_0x57111b['error'][_0x267a('0x15')]===0x1f4){logger['error'](_0x267a('0x10'),_0x2775a3,_0x57111b[_0x267a('0x16')][_0x267a('0x17')]);return _0x3c315f(_0x57111b[_0x267a('0x16')][_0x267a('0x17')]);}logger[_0x267a('0x16')](_0x267a('0x10'),_0x2775a3,_0x57111b[_0x267a('0x16')][_0x267a('0x17')]);return _0x4a1928(_0x57111b[_0x267a('0x16')][_0x267a('0x17')]);}else{logger['info'](_0x267a('0x10'),_0x2775a3,_0x267a('0x11'));_0x4a1928(_0x57111b[_0x267a('0x18')][_0x267a('0x17')]);}})[_0x267a('0x19')](function(_0x4bba4a){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x2775a3,_0x4bba4a);_0x3c315f(_0x4bba4a);});});}exports[_0x267a('0x1a')]=function(_0x42b80c){var _0x579895=this;return new Promise(function(_0x1912ad,_0x4a9714){return db[_0x267a('0x1b')]['update'](_0x42b80c[_0x267a('0x1c')],{'raw':_0x42b80c['options']?_0x42b80c[_0x267a('0x1d')][_0x267a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42b80c[_0x267a('0x1d')]?_0x42b80c[_0x267a('0x1d')]['where']||null:null,'attributes':_0x42b80c[_0x267a('0x1d')]?_0x42b80c['options'][_0x267a('0x1f')]||null:null,'limit':_0x42b80c[_0x267a('0x1d')]?_0x42b80c[_0x267a('0x1d')]['limit']||null:null})[_0x267a('0xe')](function(_0x15fb50){logger[_0x267a('0xf')](_0x267a('0x1a'),_0x42b80c);logger['debug']('UpdateSmsInteraction',_0x42b80c,JSON['stringify'](_0x15fb50));_0x1912ad(_0x15fb50);})[_0x267a('0x19')](function(_0x316ed1){logger[_0x267a('0x16')](_0x267a('0x1a'),_0x316ed1[_0x267a('0x17')],_0x42b80c);_0x4a9714(_0x579895[_0x267a('0x16')](0x1f4,_0x316ed1['message']));});});};exports['AddTagsToSmsInteraction']=function(_0x5554b8){return new Promise(function(_0x3bf7cc,_0x56afcd){return db[_0x267a('0x1b')][_0x267a('0x20')]({'where':_0x5554b8[_0x267a('0x1d')]?_0x5554b8['options']['where']||null:null})[_0x267a('0xe')](function(_0x4b2d6b){if(_0x4b2d6b){return _0x4b2d6b[_0x267a('0x21')](_0x5554b8[_0x267a('0x1c')]['ids'],_[_0x267a('0x22')](_0x5554b8[_0x267a('0x1c')],[_0x267a('0x23'),'id'])||{});}})[_0x267a('0x24')](function(_0x315490){logger['info'](_0x267a('0x25'),_0x5554b8);logger['debug']('AddTags',_0x5554b8,JSON[_0x267a('0x14')](_0x315490));_0x3bf7cc(_0x315490);})['catch'](function(_0x1ece20){logger[_0x267a('0x16')](_0x267a('0x25'),_0x1ece20[_0x267a('0x17')],_0x5554b8);_0x56afcd(_this[_0x267a('0x16')](0x1f4,_0x1ece20[_0x267a('0x17')]));});});}; \ No newline at end of file +var _0x9dfd=['error','code','message','SmsInteraction,\x20%s,\x20%s','result','catch','UpdateSmsInteraction','update','options','where','attributes','limit','AddTagsToSmsInteraction','find','addTags','body','omit','spread','AddTags','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9dfd,0x1cb));var _0xd9df=function(_0x5ecc2d,_0x1f94de){_0x5ecc2d=_0x5ecc2d-0x0;var _0x585a86=_0x9dfd[_0x5ecc2d];return _0x585a86;};'use strict';var _=require('lodash');var util=require(_0xd9df('0x0'));var moment=require(_0xd9df('0x1'));var BPromise=require('bluebird');var rs=require(_0xd9df('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9df('0x3'))['db'];var utils=require(_0xd9df('0x4'));var logger=require('../../config/logger')(_0xd9df('0x5'));var config=require(_0xd9df('0x6'));var jayson=require(_0xd9df('0x7'));var client=jayson[_0xd9df('0x8')][_0xd9df('0x9')]({'port':0x232a});config[_0xd9df('0xa')]=_[_0xd9df('0xb')](config[_0xd9df('0xa')],{'host':_0xd9df('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd9df('0xa')]));require('./smsInteraction.socket')[_0xd9df('0xd')](socket);function respondWithRpcPromise(_0x339eea,_0x503f90,_0x3aabe5){return new BPromise(function(_0x4b7a18,_0x8b81b4){return client[_0xd9df('0xe')](_0x339eea,_0x3aabe5)[_0xd9df('0xf')](function(_0x4a9760){logger[_0xd9df('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x503f90,_0xd9df('0x11'));logger[_0xd9df('0x12')](_0xd9df('0x13'),_0x503f90,_0xd9df('0x11'),JSON[_0xd9df('0x14')](_0x4a9760));if(_0x4a9760[_0xd9df('0x15')]){if(_0x4a9760[_0xd9df('0x15')][_0xd9df('0x16')]===0x1f4){logger[_0xd9df('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x503f90,_0x4a9760[_0xd9df('0x15')][_0xd9df('0x17')]);return _0x8b81b4(_0x4a9760['error'][_0xd9df('0x17')]);}logger[_0xd9df('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x503f90,_0x4a9760['error'][_0xd9df('0x17')]);return _0x4b7a18(_0x4a9760[_0xd9df('0x15')][_0xd9df('0x17')]);}else{logger[_0xd9df('0x10')](_0xd9df('0x18'),_0x503f90,_0xd9df('0x11'));_0x4b7a18(_0x4a9760[_0xd9df('0x19')][_0xd9df('0x17')]);}})[_0xd9df('0x1a')](function(_0x448648){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x503f90,_0x448648);_0x8b81b4(_0x448648);});});}exports[_0xd9df('0x1b')]=function(_0x5ccbb4){var _0x32b311=this;return new Promise(function(_0x4a2217,_0x4505df){return db['SmsInteraction'][_0xd9df('0x1c')](_0x5ccbb4['body'],{'raw':_0x5ccbb4[_0xd9df('0x1d')]?_0x5ccbb4['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ccbb4[_0xd9df('0x1d')]?_0x5ccbb4[_0xd9df('0x1d')][_0xd9df('0x1e')]||null:null,'attributes':_0x5ccbb4[_0xd9df('0x1d')]?_0x5ccbb4[_0xd9df('0x1d')][_0xd9df('0x1f')]||null:null,'limit':_0x5ccbb4[_0xd9df('0x1d')]?_0x5ccbb4[_0xd9df('0x1d')][_0xd9df('0x20')]||null:null})[_0xd9df('0xf')](function(_0x18fde8){logger[_0xd9df('0x10')](_0xd9df('0x1b'),_0x5ccbb4);logger[_0xd9df('0x12')](_0xd9df('0x1b'),_0x5ccbb4,JSON['stringify'](_0x18fde8));_0x4a2217(_0x18fde8);})[_0xd9df('0x1a')](function(_0x2ea7c4){logger[_0xd9df('0x15')](_0xd9df('0x1b'),_0x2ea7c4[_0xd9df('0x17')],_0x5ccbb4);_0x4505df(_0x32b311[_0xd9df('0x15')](0x1f4,_0x2ea7c4[_0xd9df('0x17')]));});});};exports[_0xd9df('0x21')]=function(_0x4a667b){return new Promise(function(_0x5e9263,_0x393141){return db['SmsInteraction'][_0xd9df('0x22')]({'where':_0x4a667b[_0xd9df('0x1d')]?_0x4a667b[_0xd9df('0x1d')]['where']||null:null})[_0xd9df('0xf')](function(_0x371fbe){if(_0x371fbe){return _0x371fbe[_0xd9df('0x23')](_0x4a667b[_0xd9df('0x24')]['ids'],_[_0xd9df('0x25')](_0x4a667b['body'],['ids','id'])||{});}})[_0xd9df('0x26')](function(_0x14b8b9){logger['info'](_0xd9df('0x27'),_0x4a667b);logger[_0xd9df('0x12')]('AddTags',_0x4a667b,JSON['stringify'](_0x14b8b9));_0x5e9263(_0x14b8b9);})[_0xd9df('0x1a')](function(_0x4d7573){logger[_0xd9df('0x15')](_0xd9df('0x27'),_0x4d7573[_0xd9df('0x17')],_0x4a667b);_0x393141(_this[_0xd9df('0x15')](0x1f4,_0x4d7573[_0xd9df('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 18f3c23..e1402e0 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 _0xb786=['register','smsInteraction:','./smsInteraction.events','save','remove','update','removeListener'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xb786,0x80));var _0x6b78=function(_0x42ecc9,_0xcd4e01){_0x42ecc9=_0x42ecc9-0x0;var _0x988bce=_0xb786[_0x42ecc9];return _0x988bce;};'use strict';var SmsInteractionEvents=require(_0x6b78('0x0'));var events=[_0x6b78('0x1'),_0x6b78('0x2'),_0x6b78('0x3')];function createListener(_0x312edb,_0x4a505b){return function(_0x142448){_0x4a505b['emit'](_0x312edb,_0x142448);};}function removeListener(_0x4ced84,_0x7924ab){return function(){SmsInteractionEvents[_0x6b78('0x4')](_0x4ced84,_0x7924ab);};}exports[_0x6b78('0x5')]=function(_0x2b4c13){for(var _0x160485=0x0,_0x50f93e=events['length'];_0x160485<_0x50f93e;_0x160485++){var _0x30ded2=events[_0x160485];var _0x4d04d7=createListener(_0x6b78('0x6')+_0x30ded2,_0x2b4c13);SmsInteractionEvents['on'](_0x30ded2,_0x4d04d7);}}; \ No newline at end of file +var _0xe5ba=['save','remove','update','emit','removeListener','register','length','smsInteraction:','./smsInteraction.events'];(function(_0x3f4891,_0x4e6f62){var _0x54f2d8=function(_0x2b11ee){while(--_0x2b11ee){_0x3f4891['push'](_0x3f4891['shift']());}};_0x54f2d8(++_0x4e6f62);}(_0xe5ba,0x167));var _0xae5b=function(_0x5c0f70,_0x5b700b){_0x5c0f70=_0x5c0f70-0x0;var _0x3fa4d0=_0xe5ba[_0x5c0f70];return _0x3fa4d0;};'use strict';var SmsInteractionEvents=require(_0xae5b('0x0'));var events=[_0xae5b('0x1'),_0xae5b('0x2'),_0xae5b('0x3')];function createListener(_0x2fb3d4,_0x5052c3){return function(_0x477207){_0x5052c3[_0xae5b('0x4')](_0x2fb3d4,_0x477207);};}function removeListener(_0x5ca46d,_0x2e6c84){return function(){SmsInteractionEvents[_0xae5b('0x5')](_0x5ca46d,_0x2e6c84);};}exports[_0xae5b('0x6')]=function(_0x1fdc4e){for(var _0x7acecf=0x0,_0x735671=events[_0xae5b('0x7')];_0x7acecf<_0x735671;_0x7acecf++){var _0x4dec60=events[_0x7acecf];var _0x55fb82=createListener(_0xae5b('0x8')+_0x4dec60,_0x1fdc4e);SmsInteractionEvents['on'](_0x4dec60,_0x55fb82);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 6d23a60..fb76b0e 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 _0x2ef8=['index','/describe','describe','/:id','show','tracked','sms','smsmessage:create','create','post','/:id/status','status','put','/:id/accept','accept','/:id/reject','reject','delete','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4b7dfb,_0xbbed3e){var _0x1392df=function(_0x3d7f8a){while(--_0x3d7f8a){_0x4b7dfb['push'](_0x4b7dfb['shift']());}};_0x1392df(++_0xbbed3e);}(_0x2ef8,0x162));var _0x82ef=function(_0x4adf06,_0x23beb5){_0x4adf06=_0x4adf06-0x0;var _0x42d1eb=_0x2ef8[_0x4adf06];return _0x42d1eb;};'use strict';var multer=require('multer');var util=require(_0x82ef('0x0'));var path=require(_0x82ef('0x1'));var timeout=require('connect-timeout');var express=require(_0x82ef('0x2'));var router=express[_0x82ef('0x3')]();var fs_extra=require(_0x82ef('0x4'));var auth=require(_0x82ef('0x5'));var interaction=require(_0x82ef('0x6'));var config=require(_0x82ef('0x7'));var controller=require('./smsMessage.controller');router[_0x82ef('0x8')]('/',auth[_0x82ef('0x9')](),controller[_0x82ef('0xa')]);router[_0x82ef('0x8')](_0x82ef('0xb'),auth[_0x82ef('0x9')](),controller[_0x82ef('0xc')]);router[_0x82ef('0x8')](_0x82ef('0xd'),auth[_0x82ef('0x9')](),controller[_0x82ef('0xe')]);router['post']('/',auth[_0x82ef('0x9')](),interaction[_0x82ef('0xf')](_0x82ef('0x10'),_0x82ef('0x11')),controller[_0x82ef('0x12')]);router[_0x82ef('0x13')](_0x82ef('0x14'),controller[_0x82ef('0x15')]);router[_0x82ef('0x16')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x82ef('0x16')](_0x82ef('0x17'),auth['isAuthenticated'](),controller[_0x82ef('0x18')]);router[_0x82ef('0x16')](_0x82ef('0x19'),auth[_0x82ef('0x9')](),controller[_0x82ef('0x1a')]);router[_0x82ef('0x1b')](_0x82ef('0xd'),auth[_0x82ef('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6a5f=['tracked','sms','smsmessage:create','create','/:id/status','status','update','put','/:id/reject','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','post'];(function(_0x5b5c45,_0x199467){var _0x2cd0dd=function(_0x3f3266){while(--_0x3f3266){_0x5b5c45['push'](_0x5b5c45['shift']());}};_0x2cd0dd(++_0x199467);}(_0x6a5f,0xbb));var _0xf6a5=function(_0x32cc68,_0x5d2b21){_0x32cc68=_0x32cc68-0x0;var _0x472ab1=_0x6a5f[_0x32cc68];return _0x472ab1;};'use strict';var multer=require(_0xf6a5('0x0'));var util=require(_0xf6a5('0x1'));var path=require('path');var timeout=require(_0xf6a5('0x2'));var express=require(_0xf6a5('0x3'));var router=express['Router']();var fs_extra=require(_0xf6a5('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf6a5('0x5'));var controller=require('./smsMessage.controller');router['get']('/',auth[_0xf6a5('0x6')](),controller['index']);router[_0xf6a5('0x7')](_0xf6a5('0x8'),auth[_0xf6a5('0x6')](),controller[_0xf6a5('0x9')]);router[_0xf6a5('0x7')](_0xf6a5('0xa'),auth[_0xf6a5('0x6')](),controller[_0xf6a5('0xb')]);router[_0xf6a5('0xc')]('/',auth['isAuthenticated'](),interaction[_0xf6a5('0xd')](_0xf6a5('0xe'),_0xf6a5('0xf')),controller[_0xf6a5('0x10')]);router[_0xf6a5('0xc')](_0xf6a5('0x11'),controller[_0xf6a5('0x12')]);router['put'](_0xf6a5('0xa'),auth[_0xf6a5('0x6')](),controller[_0xf6a5('0x13')]);router[_0xf6a5('0x14')]('/:id/accept',auth[_0xf6a5('0x6')](),controller['accept']);router['put'](_0xf6a5('0x15'),auth[_0xf6a5('0x6')](),controller['reject']);router[_0xf6a5('0x16')](_0xf6a5('0xa'),auth[_0xf6a5('0x6')](),controller[_0xf6a5('0x17')]);module[_0xf6a5('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 41ea5d7..6ddf290 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 _0x8dfa=['exports','TEXT','medium','BOOLEAN','out','STRING','DATE'];(function(_0x2b2ed8,_0x67088a){var _0x363324=function(_0x4fc8a0){while(--_0x4fc8a0){_0x2b2ed8['push'](_0x2b2ed8['shift']());}};_0x363324(++_0x67088a);}(_0x8dfa,0x118));var _0xa8df=function(_0x120376,_0x571898){_0x120376=_0x120376-0x0;var _0x28c529=_0x8dfa[_0x120376];return _0x28c529;};'use strict';var Sequelize=require('sequelize');module[_0xa8df('0x0')]={'body':{'type':Sequelize[_0xa8df('0x1')](_0xa8df('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa8df('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa8df('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xa8df('0x5')]},'readAt':{'type':Sequelize[_0xa8df('0x6')]},'secret':{'type':Sequelize[_0xa8df('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xa8df('0x1')]}}; \ No newline at end of file +var _0xe574=['sequelize','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x2bcc5e,_0x503321){var _0x51df66=function(_0x5cd7e6){while(--_0x5cd7e6){_0x2bcc5e['push'](_0x2bcc5e['shift']());}};_0x51df66(++_0x503321);}(_0xe574,0x100));var _0x4e57=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xe574[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0x4e57('0x0'));module['exports']={'body':{'type':Sequelize[_0x4e57('0x1')](_0x4e57('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x4e57('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4e57('0x4')]('in',_0x4e57('0x5')),'defaultValue':_0x4e57('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x4e57('0x6')](0xbe)},'phone':{'type':Sequelize[_0x4e57('0x6')]},'readAt':{'type':Sequelize[_0x4e57('0x7')]},'secret':{'type':Sequelize[_0x4e57('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x4e57('0x6')]},'providerResponse':{'type':Sequelize[_0x4e57('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 210ea2d..345a34e 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 _0x9a2a=['SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','MessageUUID','indexOf','Status','plivio','results','groupName','DELIVERED','infobip','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','lodash','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','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','SmsMessage','findAll','rows','params','include','find','create','body','sms-interactions','accept','read','readAt','UserId','get','SmsInteraction','SmsInteractionId','update','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','rejectmessage','SmsAccount'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9a2a,0xa7));var _0xa9a2=function(_0x263b4c,_0x2820bf){_0x263b4c=_0x263b4c-0x0;var _0x149bb1=_0x9a2a[_0x263b4c];return _0x149bb1;};'use strict';var emlformat=require(_0xa9a2('0x0'));var rimraf=require(_0xa9a2('0x1'));var zipdir=require(_0xa9a2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa9a2('0x3'));var Mustache=require(_0xa9a2('0x4'));var util=require(_0xa9a2('0x5'));var path=require(_0xa9a2('0x6'));var sox=require(_0xa9a2('0x7'));var csv=require(_0xa9a2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa9a2('0x9'));var squel=require(_0xa9a2('0xa'));var crypto=require(_0xa9a2('0xb'));var jsforce=require(_0xa9a2('0xc'));var deskjs=require(_0xa9a2('0xd'));var toCsv=require(_0xa9a2('0x8'));var querystring=require(_0xa9a2('0xe'));var Papa=require(_0xa9a2('0xf'));var Redis=require(_0xa9a2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa9a2('0x11'));var as=require(_0xa9a2('0x12'));var hardwareService=require(_0xa9a2('0x13'));var logger=require(_0xa9a2('0x14'))(_0xa9a2('0x15'));var utils=require(_0xa9a2('0x16'));var config=require(_0xa9a2('0x17'));var licenseUtil=require(_0xa9a2('0x18'));var db=require(_0xa9a2('0x19'))['db'];config[_0xa9a2('0x1a')]=_['defaults'](config[_0xa9a2('0x1a')],{'host':_0xa9a2('0x1b'),'port':0x18eb});var socket=require(_0xa9a2('0x1c'))(new Redis(config[_0xa9a2('0x1a')]));require(_0xa9a2('0x1d'))[_0xa9a2('0x1e')](socket);var jayson=require(_0xa9a2('0x1f'));var client=jayson[_0xa9a2('0x20')][_0xa9a2('0x21')]({'port':0x232c});var client9002=jayson[_0xa9a2('0x20')][_0xa9a2('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x9a2b5f,_0x1c2ae9,_0x47fec4,_0x20037e){return new BPromise(function(_0xbb6546,_0x232665){var _0x44cfb7=_0x20037e||client;return _0x44cfb7[_0xa9a2('0x22')](_0x9a2b5f,_0x47fec4)[_0xa9a2('0x23')](function(_0x4e3f13){logger[_0xa9a2('0x24')](_0xa9a2('0x25'),_0x1c2ae9,_0xa9a2('0x26'));logger[_0xa9a2('0x27')](_0xa9a2('0x28'),_0x1c2ae9,_0xa9a2('0x26'),JSON[_0xa9a2('0x29')](_0x4e3f13));if(_0x4e3f13[_0xa9a2('0x2a')]){if(_0x4e3f13[_0xa9a2('0x2a')]['code']===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x1c2ae9,_0x4e3f13[_0xa9a2('0x2a')][_0xa9a2('0x2b')]);return _0x232665(_0x4e3f13[_0xa9a2('0x2a')]['message']);}logger[_0xa9a2('0x2a')]('SmsMessage,\x20%s,\x20%s',_0x1c2ae9,_0x4e3f13['error'][_0xa9a2('0x2b')]);return _0xbb6546(_0x4e3f13['error'][_0xa9a2('0x2b')]);}else{logger[_0xa9a2('0x24')]('SmsMessage,\x20%s,\x20%s',_0x1c2ae9,_0xa9a2('0x26'));_0xbb6546(_0x4e3f13[_0xa9a2('0x2c')][_0xa9a2('0x2b')]);}})[_0xa9a2('0x2d')](function(_0x21078c){logger['error'](_0xa9a2('0x25'),_0x1c2ae9,_0x21078c);_0x232665(_0x21078c);});});}function respondWithStatusCode(_0x2ab71,_0x512010){_0x512010=_0x512010||0xcc;return function(_0x41391f){if(_0x41391f){return _0x2ab71[_0xa9a2('0x2e')](_0x512010);}return _0x2ab71[_0xa9a2('0x2f')](_0x512010)[_0xa9a2('0x30')]();};}function respondWithResult(_0x3fd6e0,_0x52d7e3){_0x52d7e3=_0x52d7e3||0xc8;return function(_0x287c53){if(_0x287c53){return _0x3fd6e0['status'](_0x52d7e3)[_0xa9a2('0x31')](_0x287c53);}};}function respondWithFilteredResult(_0x56d01b,_0x4bb549){return function(_0x56f120){if(_0x56f120){var _0x4b2d65=typeof _0x4bb549['offset']===_0xa9a2('0x32')&&typeof _0x4bb549[_0xa9a2('0x33')]===_0xa9a2('0x32');var _0x3da3ca=_0x56f120[_0xa9a2('0x34')];var _0x34e754=_0x4b2d65?0x0:_0x4bb549[_0xa9a2('0x35')];var _0x3c035c=_0x4b2d65?_0x56f120['count']:_0x4bb549[_0xa9a2('0x35')]+_0x4bb549[_0xa9a2('0x33')];var _0x41ca6e;if(_0x3c035c>=_0x3da3ca){_0x3c035c=_0x3da3ca;_0x41ca6e=0xc8;}else{_0x41ca6e=0xce;}_0x56d01b[_0xa9a2('0x2f')](_0x41ca6e);return _0x56d01b[_0xa9a2('0x36')](_0xa9a2('0x37'),_0x34e754+'-'+_0x3c035c+'/'+_0x3da3ca)[_0xa9a2('0x31')](_0x56f120);}return null;};}function patchUpdates(_0x487bb0){return function(_0x13a3ce){try{jsonpatch[_0xa9a2('0x38')](_0x13a3ce,_0x487bb0,!![]);}catch(_0x358bb9){return BPromise[_0xa9a2('0x39')](_0x358bb9);}return _0x13a3ce[_0xa9a2('0x3a')]();};}function saveUpdates(_0x55fe73,_0x33a9f7){return function(_0x40e307){if(_0x40e307){return _0x40e307['update'](_0x55fe73)['then'](function(_0x13ea5e){return _0x13ea5e;});}return null;};}function removeEntity(_0x1b9e8c,_0x41b4a7){return function(_0x106914){if(_0x106914){return _0x106914[_0xa9a2('0x3b')]()['then'](function(){_0x1b9e8c[_0xa9a2('0x2f')](0xcc)[_0xa9a2('0x30')]();});}};}function handleEntityNotFound(_0x21f818,_0x5a2183){return function(_0x2d7f9a){if(!_0x2d7f9a){_0x21f818[_0xa9a2('0x2e')](0x194);}return _0x2d7f9a;};}function handleError(_0xb96fe,_0x539881){_0x539881=_0x539881||0x1f4;return function(_0x2580f2){logger[_0xa9a2('0x2a')](_0x2580f2[_0xa9a2('0x3c')]);if(_0x2580f2[_0xa9a2('0x3d')]){delete _0x2580f2[_0xa9a2('0x3d')];}_0xb96fe[_0xa9a2('0x2f')](_0x539881)[_0xa9a2('0x3e')](_0x2580f2);};}exports[_0xa9a2('0x3f')]=function(_0x152c6f,_0xe22d8c){var _0x87e99b={},_0x199469={},_0x38b3c2={'count':0x0,'rows':[]};var _0x1ef9f0=_['map'](db['SmsMessage'][_0xa9a2('0x40')],function(_0x13b6fc){return{'name':_0x13b6fc[_0xa9a2('0x41')],'type':_0x13b6fc[_0xa9a2('0x42')]['key']};});_0x199469[_0xa9a2('0x43')]=_[_0xa9a2('0x44')](_0x1ef9f0,_0xa9a2('0x3d'));_0x199469[_0xa9a2('0x45')]=_[_0xa9a2('0x46')](_0x152c6f['query']);_0x199469[_0xa9a2('0x47')]=_[_0xa9a2('0x48')](_0x199469[_0xa9a2('0x43')],_0x199469['query']);_0x87e99b['attributes']=_[_0xa9a2('0x48')](_0x199469['model'],qs[_0xa9a2('0x49')](_0x152c6f[_0xa9a2('0x45')][_0xa9a2('0x49')]));_0x87e99b[_0xa9a2('0x4a')]=_0x87e99b[_0xa9a2('0x4a')][_0xa9a2('0x4b')]?_0x87e99b[_0xa9a2('0x4a')]:_0x199469[_0xa9a2('0x43')];if(!_0x152c6f[_0xa9a2('0x45')][_0xa9a2('0x4c')](_0xa9a2('0x4d'))){_0x87e99b['limit']=qs[_0xa9a2('0x33')](_0x152c6f[_0xa9a2('0x45')][_0xa9a2('0x33')]);_0x87e99b[_0xa9a2('0x35')]=qs[_0xa9a2('0x35')](_0x152c6f[_0xa9a2('0x45')][_0xa9a2('0x35')]);}_0x87e99b[_0xa9a2('0x4e')]=qs[_0xa9a2('0x4f')](_0x152c6f[_0xa9a2('0x45')]['sort']);_0x87e99b[_0xa9a2('0x50')]=qs[_0xa9a2('0x47')](_['pick'](_0x152c6f[_0xa9a2('0x45')],_0x199469[_0xa9a2('0x47')]),_0x1ef9f0);if(_0x152c6f['query'][_0xa9a2('0x51')]){_0x87e99b[_0xa9a2('0x50')]=_['merge'](_0x87e99b[_0xa9a2('0x50')],{'$or':_['map'](_0x1ef9f0,function(_0x550ed6){if(_0x550ed6[_0xa9a2('0x42')]!==_0xa9a2('0x52')){var _0x3140de={};_0x3140de[_0x550ed6[_0xa9a2('0x3d')]]={'$like':'%'+_0x152c6f[_0xa9a2('0x45')][_0xa9a2('0x51')]+'%'};return _0x3140de;}})});}_0x87e99b=_[_0xa9a2('0x53')]({},_0x87e99b,_0x152c6f[_0xa9a2('0x54')]);var _0x3a0934={'where':_0x87e99b[_0xa9a2('0x50')]};return db['SmsMessage'][_0xa9a2('0x34')](_0x3a0934)[_0xa9a2('0x23')](function(_0x523c8e){_0x38b3c2['count']=_0x523c8e;if(_0x152c6f[_0xa9a2('0x45')]['includeAll']){_0x87e99b['include']=[{'all':!![]}];}return db[_0xa9a2('0x55')][_0xa9a2('0x56')](_0x87e99b);})[_0xa9a2('0x23')](function(_0x381cae){_0x38b3c2[_0xa9a2('0x57')]=_0x381cae;return _0x38b3c2;})[_0xa9a2('0x23')](respondWithFilteredResult(_0xe22d8c,_0x87e99b))[_0xa9a2('0x2d')](handleError(_0xe22d8c,null));};exports['show']=function(_0x1c5549,_0x1f8742){var _0x4cb57e={'raw':!![],'where':{'id':_0x1c5549[_0xa9a2('0x58')]['id']}},_0x25a5dd={};_0x25a5dd['model']=_[_0xa9a2('0x46')](db[_0xa9a2('0x55')][_0xa9a2('0x40')]);_0x25a5dd['query']=_[_0xa9a2('0x46')](_0x1c5549['query']);_0x25a5dd['filters']=_[_0xa9a2('0x48')](_0x25a5dd[_0xa9a2('0x43')],_0x25a5dd[_0xa9a2('0x45')]);_0x4cb57e['attributes']=_[_0xa9a2('0x48')](_0x25a5dd[_0xa9a2('0x43')],qs[_0xa9a2('0x49')](_0x1c5549[_0xa9a2('0x45')]['fields']));_0x4cb57e[_0xa9a2('0x4a')]=_0x4cb57e['attributes'][_0xa9a2('0x4b')]?_0x4cb57e[_0xa9a2('0x4a')]:_0x25a5dd['model'];if(_0x1c5549['query']['includeAll']){_0x4cb57e[_0xa9a2('0x59')]=[{'all':!![]}];}_0x4cb57e=_[_0xa9a2('0x53')]({},_0x4cb57e,_0x1c5549['options']);return db[_0xa9a2('0x55')][_0xa9a2('0x5a')](_0x4cb57e)[_0xa9a2('0x23')](handleEntityNotFound(_0x1f8742,null))[_0xa9a2('0x23')](respondWithResult(_0x1f8742,null))[_0xa9a2('0x2d')](handleError(_0x1f8742,null));};exports[_0xa9a2('0x5b')]=function(_0x11a0d0,_0x19486b){return db[_0xa9a2('0x55')][_0xa9a2('0x5b')](_0x11a0d0[_0xa9a2('0x5c')],{})[_0xa9a2('0x23')](respondWithResult(_0x19486b,0xc9))['catch'](handleError(_0x19486b,null));};exports['update']=function(_0x21071f,_0x4c7f02){if(_0x21071f[_0xa9a2('0x5c')]['id']){delete _0x21071f[_0xa9a2('0x5c')]['id'];}return db[_0xa9a2('0x55')][_0xa9a2('0x5a')]({'where':{'id':_0x21071f[_0xa9a2('0x58')]['id']}})[_0xa9a2('0x23')](handleEntityNotFound(_0x4c7f02,null))[_0xa9a2('0x23')](saveUpdates(_0x21071f[_0xa9a2('0x5c')],null))['then'](respondWithResult(_0x4c7f02,null))[_0xa9a2('0x2d')](handleError(_0x4c7f02,null));};exports['destroy']=function(_0x1a3f4b,_0x411b27){return db[_0xa9a2('0x55')][_0xa9a2('0x5a')]({'where':{'id':_0x1a3f4b[_0xa9a2('0x58')]['id']}})[_0xa9a2('0x23')](handleEntityNotFound(_0x411b27,null))['then'](removeEntity(_0x411b27,null))[_0xa9a2('0x2d')](handleError(_0x411b27,null));};exports['describe']=function(_0x55dba8,_0x42cbf8){return db[_0xa9a2('0x55')]['describe']()[_0xa9a2('0x23')](respondWithResult(_0x42cbf8,null))[_0xa9a2('0x2d')](handleError(_0x42cbf8,null));};var interaction_log=require(_0xa9a2('0x14'))(_0xa9a2('0x5d'));exports[_0xa9a2('0x5e')]=function(_0x199276,_0x13a62a,_0x4e2acc){var _0x3d76c3={'agent':{},'channel':'sms'};if(_0x199276['body']['id']){delete _0x199276[_0xa9a2('0x5c')]['id'];}_0x199276[_0xa9a2('0x5c')][_0xa9a2('0x5f')]=!![];_0x199276[_0xa9a2('0x5c')][_0xa9a2('0x60')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x199276[_0xa9a2('0x5c')][_0xa9a2('0x61')]=_0x199276['body'][_0xa9a2('0x61')]||_0x199276['user']['id'];_0x3d76c3['agent']['id']=_0x199276[_0xa9a2('0x5c')][_0xa9a2('0x61')];return db['SmsMessage'][_0xa9a2('0x5a')]({'where':{'id':_0x199276[_0xa9a2('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x13a62a,null))['then'](saveUpdates(_0x199276[_0xa9a2('0x5c')],null))[_0xa9a2('0x23')](function(_0x2143de){if(_0x2143de){_0x3d76c3[_0xa9a2('0x2b')]=_0x2143de[_0xa9a2('0x62')]({'plain':!![]});return db[_0xa9a2('0x63')][_0xa9a2('0x5a')]({'where':{'id':_0x2143de[_0xa9a2('0x64')]}});}return null;})[_0xa9a2('0x23')](handleEntityNotFound(_0x13a62a,null))[_0xa9a2('0x23')](function(_0x231c2e){if(_0x231c2e){return _0x231c2e[_0xa9a2('0x65')]({'UserId':_0x199276[_0xa9a2('0x5c')][_0xa9a2('0x61')],'read1stAt':_[_0xa9a2('0x66')](_0x231c2e[_0xa9a2('0x67')])?moment()[_0xa9a2('0x68')](_0xa9a2('0x69')):undefined});}return null;})['then'](function(_0x1571b3){if(_0x1571b3){_0x3d76c3[_0xa9a2('0x6a')]=_0x1571b3[_0xa9a2('0x62')]({'plain':!![]});interaction_log[_0xa9a2('0x24')](_0xa9a2('0x6b'),_0x199276['user']['id'],_0x199276[_0xa9a2('0x6c')][_0xa9a2('0x3d')],_0x199276[_0xa9a2('0x6c')][_0xa9a2('0x6d')],_0x3d76c3[_0xa9a2('0x6a')]['id'],_0x199276[_0xa9a2('0x5c')]?JSON[_0xa9a2('0x29')](_0x199276[_0xa9a2('0x5c')]):_0xa9a2('0x6e'));return respondWithRpcPromise(_0xa9a2('0x6f'),_0xa9a2('0x70'),_0x3d76c3);}return null;})[_0xa9a2('0x23')](function(_0x291992){var _0x147db1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x291992['message'][_0xa9a2('0x71')];return db['sequelize'][_0xa9a2('0x45')](_0x147db1,{'type':db[_0xa9a2('0x72')][_0xa9a2('0x73')][_0xa9a2('0x74')],'raw':!![]})['then'](function(_0x32ff1c){return _0x32ff1c;});})['then'](function(_0x424561){if(_0x424561){_0x3d76c3[_0xa9a2('0x2b')][_0xa9a2('0x75')]=_0x424561[0x0];if(!_0x199276[_0xa9a2('0x5c')][_0xa9a2('0x61')])return;return db[_0xa9a2('0x76')][_0xa9a2('0x5a')]({'where':{'id':_0x199276[_0xa9a2('0x5c')][_0xa9a2('0x61')],'role':_0xa9a2('0x77')},'attributes':['id',_0xa9a2('0x3d'),_0xa9a2('0x78'),_0xa9a2('0x79'),_0xa9a2('0x7a')],'raw':!![]});}return null;})[_0xa9a2('0x23')](function(_0x55b897){if(!_0x55b897)return null;_0x3d76c3[_0xa9a2('0x2b')][_0xa9a2('0x77')]=_0x55b897;return _0x3d76c3;})['then'](function(_0x27d40d){if(_0x27d40d){if(_0x199276[_0xa9a2('0x5c')][_0xa9a2('0x7b')]){_0x3d76c3[_0xa9a2('0x2b')][_0xa9a2('0x7c')]=util[_0xa9a2('0x68')](_0xa9a2('0x7d'),_0x199276['user']['name']);_0x3d76c3[_0xa9a2('0x2b')][_0xa9a2('0x7e')]=_0x3d76c3['channel'];_0x3d76c3['message'][_0xa9a2('0x7f')]=_0x3d76c3['channel'];_0x3d76c3[_0xa9a2('0x2b')]['event']=_0xa9a2('0x5e');return respondWithRpcPromise(_0xa9a2('0x80'),_0xa9a2('0x80'),{'event':'acceptmessage','message':_0x3d76c3[_0xa9a2('0x2b')]},client9002)[_0xa9a2('0x23')](function(){return _0x3d76c3;});}return _0x3d76c3;}return null;})[_0xa9a2('0x23')](respondWithResult(_0x13a62a,null))[_0xa9a2('0x2d')](handleError(_0x13a62a,null));};var interaction_log=require(_0xa9a2('0x14'))('sms-interactions');exports[_0xa9a2('0x39')]=function(_0x3aed96,_0x6bf49c,_0xf6a22c){var _0x79971d={'agent':{},'channel':_0xa9a2('0x81')};if(_0x3aed96[_0xa9a2('0x5c')]['id']){delete _0x3aed96['body']['id'];}_0x3aed96[_0xa9a2('0x5c')][_0xa9a2('0x61')]=_0x3aed96[_0xa9a2('0x5c')][_0xa9a2('0x61')]||_0x3aed96[_0xa9a2('0x6c')]['id'];_0x79971d['agent']['id']=_0x3aed96[_0xa9a2('0x5c')][_0xa9a2('0x61')];return db[_0xa9a2('0x55')]['find']({'where':{'id':_0x3aed96[_0xa9a2('0x58')]['id'],'UserId':null}})[_0xa9a2('0x23')](handleEntityNotFound(_0x6bf49c,null))[_0xa9a2('0x23')](function(_0x11dcb1){if(_0x11dcb1){_0x79971d[_0xa9a2('0x2b')]=_0x11dcb1[_0xa9a2('0x62')]({'plain':!![]});return db[_0xa9a2('0x63')][_0xa9a2('0x5a')]({'where':{'id':_0x11dcb1[_0xa9a2('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x6bf49c,null))[_0xa9a2('0x23')](function(_0x4a7336){if(_0x4a7336){_0x79971d[_0xa9a2('0x6a')]=_0x4a7336['get']({'plain':!![]});interaction_log[_0xa9a2('0x24')](_0xa9a2('0x82'),_0x3aed96[_0xa9a2('0x6c')]['id'],_0x3aed96[_0xa9a2('0x6c')][_0xa9a2('0x3d')],_0x3aed96[_0xa9a2('0x6c')][_0xa9a2('0x6d')],_0x79971d['interaction']['id'],_0x3aed96[_0xa9a2('0x5c')]?JSON['stringify'](_0x3aed96[_0xa9a2('0x5c')]):_0xa9a2('0x6e'));return respondWithRpcPromise(_0xa9a2('0x83'),_0xa9a2('0x84'),_0x79971d);}return null;})[_0xa9a2('0x23')](function(_0x1bc670){var _0x4b7c20=_0xa9a2('0x85')+_0x1bc670['message'][_0xa9a2('0x71')];return db[_0xa9a2('0x86')]['query'](_0x4b7c20,{'type':db['Sequelize']['QueryTypes'][_0xa9a2('0x74')],'raw':!![]})[_0xa9a2('0x23')](function(_0x4d57aa){return _0x4d57aa;});})[_0xa9a2('0x23')](function(_0x3ecb47){if(_0x3ecb47){_0x79971d['message'][_0xa9a2('0x75')]=_0x3ecb47[0x0];if(!_0x3aed96['body'][_0xa9a2('0x61')])return;return db[_0xa9a2('0x76')][_0xa9a2('0x5a')]({'where':{'id':_0x3aed96[_0xa9a2('0x5c')][_0xa9a2('0x61')],'role':_0xa9a2('0x77')},'attributes':['id',_0xa9a2('0x3d'),'fullname',_0xa9a2('0x79'),_0xa9a2('0x7a')],'raw':!![]});}return null;})[_0xa9a2('0x23')](function(_0x20cbf8){if(!_0x20cbf8)return null;_0x79971d[_0xa9a2('0x2b')][_0xa9a2('0x77')]=_0x20cbf8;return _0x79971d;})[_0xa9a2('0x23')](function(_0x1b19f9){if(_0x1b19f9){_0x1b19f9[_0xa9a2('0x2b')][_0xa9a2('0x7c')]=util[_0xa9a2('0x68')](_0xa9a2('0x7d'),_0x3aed96['user'][_0xa9a2('0x3d')]);_0x1b19f9['message'][_0xa9a2('0x7e')]=_0x79971d[_0xa9a2('0x7e')];_0x1b19f9['message']['motionChannel']=_0x79971d[_0xa9a2('0x7e')];_0x1b19f9[_0xa9a2('0x2b')]['event']='reject';respondWithRpcPromise('EventManager',_0xa9a2('0x80'),{'event':_0xa9a2('0x87'),'message':_0x1b19f9[_0xa9a2('0x2b')]},client9002);return _0x79971d;}return null;})[_0xa9a2('0x23')](respondWithResult(_0x6bf49c,null))['catch'](handleError(_0x6bf49c,null));};exports['status']=function(_0x78055c,_0x3a0f59,_0x3f6d5c){if(_0x78055c['body']['id']){delete _0x78055c[_0xa9a2('0x5c')]['id'];}var _0x1cc54c;return db[_0xa9a2('0x55')]['find']({'where':{'id':_0x78055c[_0xa9a2('0x58')]['id']}})['then'](handleEntityNotFound(_0x3a0f59,null))[_0xa9a2('0x23')](function(_0x374a5d){if(_0x374a5d){_0x1cc54c=_0x374a5d;return db[_0xa9a2('0x88')][_0xa9a2('0x5a')]({'where':{'id':_0x374a5d[_0xa9a2('0x89')]}});}})[_0xa9a2('0x23')](handleEntityNotFound(_0x3a0f59,null))[_0xa9a2('0x23')](function(_0x71191f){if(_0x71191f){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa9a2('0x2f'),_0xa9a2('0x8a'),_0x71191f['type'],util['inspect'](_0x78055c[_0xa9a2('0x5c')],{'showHidden':![],'depth':null}));switch(_0x71191f['type']){case _0xa9a2('0x8b'):if(_0x78055c[_0xa9a2('0x5c')][_0xa9a2('0x8c')]&&_0x78055c[_0xa9a2('0x5c')][_0xa9a2('0x8c')]===_0x1cc54c[_0xa9a2('0x8d')]){return _0x1cc54c[_0xa9a2('0x65')]({'read':!![]});}else{logger[_0xa9a2('0x2a')](_0xa9a2('0x8e'),'status',_0xa9a2('0x8b'),util[_0xa9a2('0x8f')](_0x78055c[_0xa9a2('0x5c')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x78055c[_0xa9a2('0x5c')]['MessageUUID']&&_0x78055c['body'][_0xa9a2('0x90')]===_0x1cc54c['messageId']&&_[_0xa9a2('0x91')](['sent','delivered'],_0x78055c[_0xa9a2('0x5c')][_0xa9a2('0x92')])>=0x0){return _0x1cc54c[_0xa9a2('0x65')]({'read':!![]});}else{logger['error'](_0xa9a2('0x8e'),_0xa9a2('0x2f'),_0xa9a2('0x93'),util[_0xa9a2('0x8f')](_0x78055c[_0xa9a2('0x5c')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x3eb16f=_0x78055c['body'][_0xa9a2('0x94')][0x0];if(_0x3eb16f['status'][_0xa9a2('0x95')]===_0xa9a2('0x96')){return _0x1cc54c['update']({'read':!![]});}else{logger[_0xa9a2('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xa9a2('0x97'),util['inspect'](_0x78055c[_0xa9a2('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x1cc54c;}})[_0xa9a2('0x23')](respondWithResult(_0x3a0f59,null))[_0xa9a2('0x2d')](handleError(_0x3a0f59,null));}; \ No newline at end of file +var _0x3c8e=['path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','SmsMessage','rawAttributes','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','params','length','include','options','find','create','body','describe','sms-interactions','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','isNil','read1stAt','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','fullname','email','internal','manual','SIP/%s','channel','motionChannel','EventManager','acceptmessage','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','event','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','MessageUUID','indexOf','sent','Status','plivio','infobip','results','DELIVERED','eml-format','rimraf','request-promise','moment','bluebird','util'];(function(_0x458c79,_0x1a183a){var _0x4a15ea=function(_0x17c789){while(--_0x17c789){_0x458c79['push'](_0x458c79['shift']());}};_0x4a15ea(++_0x1a183a);}(_0x3c8e,0x89));var _0xe3c8=function(_0x4ed7b6,_0x4ec70b){_0x4ed7b6=_0x4ed7b6-0x0;var _0x2f0a6b=_0x3c8e[_0x4ed7b6];return _0x2f0a6b;};'use strict';var emlformat=require(_0xe3c8('0x0'));var rimraf=require(_0xe3c8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe3c8('0x2'));var moment=require(_0xe3c8('0x3'));var BPromise=require(_0xe3c8('0x4'));var Mustache=require('mustache');var util=require(_0xe3c8('0x5'));var path=require(_0xe3c8('0x6'));var sox=require(_0xe3c8('0x7'));var csv=require(_0xe3c8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe3c8('0x9'));var _=require(_0xe3c8('0xa'));var squel=require(_0xe3c8('0xb'));var crypto=require(_0xe3c8('0xc'));var jsforce=require(_0xe3c8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe3c8('0x8'));var querystring=require('querystring');var Papa=require(_0xe3c8('0xe'));var Redis=require(_0xe3c8('0xf'));var authService=require(_0xe3c8('0x10'));var qs=require(_0xe3c8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3c8('0x12'));var logger=require(_0xe3c8('0x13'))(_0xe3c8('0x14'));var utils=require('../../config/utils');var config=require(_0xe3c8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe3c8('0x16'))['db'];config['redis']=_['defaults'](config[_0xe3c8('0x17')],{'host':_0xe3c8('0x18'),'port':0x18eb});var socket=require(_0xe3c8('0x19'))(new Redis(config['redis']));require(_0xe3c8('0x1a'))[_0xe3c8('0x1b')](socket);var jayson=require(_0xe3c8('0x1c'));var client=jayson[_0xe3c8('0x1d')][_0xe3c8('0x1e')]({'port':0x232c});var client9002=jayson[_0xe3c8('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b7c91,_0x138dc8,_0x599149,_0x7b146b){return new BPromise(function(_0x10d57b,_0x17e26c){var _0x4d94de=_0x7b146b||client;return _0x4d94de[_0xe3c8('0x1f')](_0x2b7c91,_0x599149)[_0xe3c8('0x20')](function(_0x36d454){logger[_0xe3c8('0x21')](_0xe3c8('0x22'),_0x138dc8,_0xe3c8('0x23'));logger[_0xe3c8('0x24')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x138dc8,_0xe3c8('0x23'),JSON[_0xe3c8('0x25')](_0x36d454));if(_0x36d454[_0xe3c8('0x26')]){if(_0x36d454[_0xe3c8('0x26')][_0xe3c8('0x27')]===0x1f4){logger[_0xe3c8('0x26')]('SmsMessage,\x20%s,\x20%s',_0x138dc8,_0x36d454[_0xe3c8('0x26')][_0xe3c8('0x28')]);return _0x17e26c(_0x36d454['error'][_0xe3c8('0x28')]);}logger[_0xe3c8('0x26')]('SmsMessage,\x20%s,\x20%s',_0x138dc8,_0x36d454[_0xe3c8('0x26')][_0xe3c8('0x28')]);return _0x10d57b(_0x36d454['error'][_0xe3c8('0x28')]);}else{logger[_0xe3c8('0x21')](_0xe3c8('0x22'),_0x138dc8,_0xe3c8('0x23'));_0x10d57b(_0x36d454[_0xe3c8('0x29')]['message']);}})[_0xe3c8('0x2a')](function(_0x50a2ce){logger['error']('SmsMessage,\x20%s,\x20%s',_0x138dc8,_0x50a2ce);_0x17e26c(_0x50a2ce);});});}function respondWithStatusCode(_0xf2f111,_0x4f2d7f){_0x4f2d7f=_0x4f2d7f||0xcc;return function(_0x350134){if(_0x350134){return _0xf2f111[_0xe3c8('0x2b')](_0x4f2d7f);}return _0xf2f111['status'](_0x4f2d7f)[_0xe3c8('0x2c')]();};}function respondWithResult(_0x4c6933,_0x2941c2){_0x2941c2=_0x2941c2||0xc8;return function(_0x1b6ed3){if(_0x1b6ed3){return _0x4c6933[_0xe3c8('0x2d')](_0x2941c2)[_0xe3c8('0x2e')](_0x1b6ed3);}};}function respondWithFilteredResult(_0xca96ed,_0x182d57){return function(_0x9d9e45){if(_0x9d9e45){var _0x497448=typeof _0x182d57['offset']===_0xe3c8('0x2f')&&typeof _0x182d57[_0xe3c8('0x30')]===_0xe3c8('0x2f');var _0x564b86=_0x9d9e45[_0xe3c8('0x31')];var _0x266399=_0x497448?0x0:_0x182d57[_0xe3c8('0x32')];var _0x1d5da7=_0x497448?_0x9d9e45['count']:_0x182d57[_0xe3c8('0x32')]+_0x182d57['limit'];var _0x364fa3;if(_0x1d5da7>=_0x564b86){_0x1d5da7=_0x564b86;_0x364fa3=0xc8;}else{_0x364fa3=0xce;}_0xca96ed[_0xe3c8('0x2d')](_0x364fa3);return _0xca96ed[_0xe3c8('0x33')](_0xe3c8('0x34'),_0x266399+'-'+_0x1d5da7+'/'+_0x564b86)['json'](_0x9d9e45);}return null;};}function patchUpdates(_0x2dbaa3){return function(_0xb0e545){try{jsonpatch[_0xe3c8('0x35')](_0xb0e545,_0x2dbaa3,!![]);}catch(_0x4bfd46){return BPromise[_0xe3c8('0x36')](_0x4bfd46);}return _0xb0e545[_0xe3c8('0x37')]();};}function saveUpdates(_0x111fd6,_0x461d76){return function(_0x1a1645){if(_0x1a1645){return _0x1a1645[_0xe3c8('0x38')](_0x111fd6)['then'](function(_0x257277){return _0x257277;});}return null;};}function removeEntity(_0x5c6103,_0x3d36d5){return function(_0x2f789e){if(_0x2f789e){return _0x2f789e[_0xe3c8('0x39')]()[_0xe3c8('0x20')](function(){_0x5c6103[_0xe3c8('0x2d')](0xcc)[_0xe3c8('0x2c')]();});}};}function handleEntityNotFound(_0x973a85,_0x212bb9){return function(_0x553991){if(!_0x553991){_0x973a85[_0xe3c8('0x2b')](0x194);}return _0x553991;};}function handleError(_0x47cb7c,_0x5b8378){_0x5b8378=_0x5b8378||0x1f4;return function(_0x3ce1f9){logger[_0xe3c8('0x26')](_0x3ce1f9[_0xe3c8('0x3a')]);if(_0x3ce1f9[_0xe3c8('0x3b')]){delete _0x3ce1f9['name'];}_0x47cb7c[_0xe3c8('0x2d')](_0x5b8378)['send'](_0x3ce1f9);};}exports[_0xe3c8('0x3c')]=function(_0x4138c2,_0x436b37){var _0x3f01fb={},_0x308a74={},_0x543d70={'count':0x0,'rows':[]};var _0x257c02=_[_0xe3c8('0x3d')](db[_0xe3c8('0x3e')][_0xe3c8('0x3f')],function(_0x1efb42){return{'name':_0x1efb42['fieldName'],'type':_0x1efb42['type'][_0xe3c8('0x40')]};});_0x308a74[_0xe3c8('0x41')]=_[_0xe3c8('0x3d')](_0x257c02,_0xe3c8('0x3b'));_0x308a74['query']=_[_0xe3c8('0x42')](_0x4138c2['query']);_0x308a74[_0xe3c8('0x43')]=_[_0xe3c8('0x44')](_0x308a74[_0xe3c8('0x41')],_0x308a74['query']);_0x3f01fb[_0xe3c8('0x45')]=_[_0xe3c8('0x44')](_0x308a74[_0xe3c8('0x41')],qs[_0xe3c8('0x46')](_0x4138c2[_0xe3c8('0x47')][_0xe3c8('0x46')]));_0x3f01fb[_0xe3c8('0x45')]=_0x3f01fb['attributes']['length']?_0x3f01fb[_0xe3c8('0x45')]:_0x308a74['model'];if(!_0x4138c2[_0xe3c8('0x47')][_0xe3c8('0x48')](_0xe3c8('0x49'))){_0x3f01fb[_0xe3c8('0x30')]=qs[_0xe3c8('0x30')](_0x4138c2[_0xe3c8('0x47')]['limit']);_0x3f01fb[_0xe3c8('0x32')]=qs[_0xe3c8('0x32')](_0x4138c2[_0xe3c8('0x47')][_0xe3c8('0x32')]);}_0x3f01fb['order']=qs['sort'](_0x4138c2['query']['sort']);_0x3f01fb[_0xe3c8('0x4a')]=qs[_0xe3c8('0x43')](_[_0xe3c8('0x4b')](_0x4138c2['query'],_0x308a74['filters']),_0x257c02);if(_0x4138c2[_0xe3c8('0x47')][_0xe3c8('0x4c')]){_0x3f01fb[_0xe3c8('0x4a')]=_[_0xe3c8('0x4d')](_0x3f01fb[_0xe3c8('0x4a')],{'$or':_[_0xe3c8('0x3d')](_0x257c02,function(_0x44cd90){if(_0x44cd90['type']!==_0xe3c8('0x4e')){var _0x1edd00={};_0x1edd00[_0x44cd90[_0xe3c8('0x3b')]]={'$like':'%'+_0x4138c2[_0xe3c8('0x47')][_0xe3c8('0x4c')]+'%'};return _0x1edd00;}})});}_0x3f01fb=_[_0xe3c8('0x4d')]({},_0x3f01fb,_0x4138c2['options']);var _0x76ec9d={'where':_0x3f01fb[_0xe3c8('0x4a')]};return db['SmsMessage']['count'](_0x76ec9d)[_0xe3c8('0x20')](function(_0x335c81){_0x543d70['count']=_0x335c81;if(_0x4138c2[_0xe3c8('0x47')][_0xe3c8('0x4f')]){_0x3f01fb['include']=[{'all':!![]}];}return db[_0xe3c8('0x3e')][_0xe3c8('0x50')](_0x3f01fb);})[_0xe3c8('0x20')](function(_0x16ed1f){_0x543d70[_0xe3c8('0x51')]=_0x16ed1f;return _0x543d70;})[_0xe3c8('0x20')](respondWithFilteredResult(_0x436b37,_0x3f01fb))[_0xe3c8('0x2a')](handleError(_0x436b37,null));};exports['show']=function(_0x5e8352,_0x34ebc8){var _0x405a09={'raw':!![],'where':{'id':_0x5e8352[_0xe3c8('0x52')]['id']}},_0xcd39a={};_0xcd39a[_0xe3c8('0x41')]=_['keys'](db[_0xe3c8('0x3e')][_0xe3c8('0x3f')]);_0xcd39a[_0xe3c8('0x47')]=_[_0xe3c8('0x42')](_0x5e8352[_0xe3c8('0x47')]);_0xcd39a[_0xe3c8('0x43')]=_['intersection'](_0xcd39a[_0xe3c8('0x41')],_0xcd39a[_0xe3c8('0x47')]);_0x405a09[_0xe3c8('0x45')]=_[_0xe3c8('0x44')](_0xcd39a[_0xe3c8('0x41')],qs['fields'](_0x5e8352['query'][_0xe3c8('0x46')]));_0x405a09[_0xe3c8('0x45')]=_0x405a09[_0xe3c8('0x45')][_0xe3c8('0x53')]?_0x405a09[_0xe3c8('0x45')]:_0xcd39a[_0xe3c8('0x41')];if(_0x5e8352[_0xe3c8('0x47')][_0xe3c8('0x4f')]){_0x405a09[_0xe3c8('0x54')]=[{'all':!![]}];}_0x405a09=_['merge']({},_0x405a09,_0x5e8352[_0xe3c8('0x55')]);return db[_0xe3c8('0x3e')][_0xe3c8('0x56')](_0x405a09)['then'](handleEntityNotFound(_0x34ebc8,null))['then'](respondWithResult(_0x34ebc8,null))['catch'](handleError(_0x34ebc8,null));};exports[_0xe3c8('0x57')]=function(_0x1ecdc0,_0x4bebd9){return db[_0xe3c8('0x3e')][_0xe3c8('0x57')](_0x1ecdc0['body'],{})['then'](respondWithResult(_0x4bebd9,0xc9))['catch'](handleError(_0x4bebd9,null));};exports['update']=function(_0x4d6301,_0x3798a7){if(_0x4d6301['body']['id']){delete _0x4d6301[_0xe3c8('0x58')]['id'];}return db[_0xe3c8('0x3e')][_0xe3c8('0x56')]({'where':{'id':_0x4d6301[_0xe3c8('0x52')]['id']}})[_0xe3c8('0x20')](handleEntityNotFound(_0x3798a7,null))[_0xe3c8('0x20')](saveUpdates(_0x4d6301[_0xe3c8('0x58')],null))['then'](respondWithResult(_0x3798a7,null))[_0xe3c8('0x2a')](handleError(_0x3798a7,null));};exports[_0xe3c8('0x39')]=function(_0x35d903,_0xdb2ac1){return db['SmsMessage'][_0xe3c8('0x56')]({'where':{'id':_0x35d903[_0xe3c8('0x52')]['id']}})[_0xe3c8('0x20')](handleEntityNotFound(_0xdb2ac1,null))[_0xe3c8('0x20')](removeEntity(_0xdb2ac1,null))[_0xe3c8('0x2a')](handleError(_0xdb2ac1,null));};exports['describe']=function(_0x4b3289,_0x34ba49){return db[_0xe3c8('0x3e')][_0xe3c8('0x59')]()['then'](respondWithResult(_0x34ba49,null))[_0xe3c8('0x2a')](handleError(_0x34ba49,null));};var interaction_log=require(_0xe3c8('0x13'))(_0xe3c8('0x5a'));exports['accept']=function(_0x2a9685,_0x5f58cb,_0x7333da){var _0x227a6e={'agent':{},'channel':_0xe3c8('0x5b')};if(_0x2a9685[_0xe3c8('0x58')]['id']){delete _0x2a9685['body']['id'];}_0x2a9685[_0xe3c8('0x58')][_0xe3c8('0x5c')]=!![];_0x2a9685[_0xe3c8('0x58')][_0xe3c8('0x5d')]=moment()[_0xe3c8('0x5e')](_0xe3c8('0x5f'));_0x2a9685[_0xe3c8('0x58')]['UserId']=_0x2a9685[_0xe3c8('0x58')][_0xe3c8('0x60')]||_0x2a9685[_0xe3c8('0x61')]['id'];_0x227a6e[_0xe3c8('0x62')]['id']=_0x2a9685[_0xe3c8('0x58')]['UserId'];return db[_0xe3c8('0x3e')][_0xe3c8('0x56')]({'where':{'id':_0x2a9685[_0xe3c8('0x52')]['id'],'UserId':null}})[_0xe3c8('0x20')](handleEntityNotFound(_0x5f58cb,null))['then'](saveUpdates(_0x2a9685[_0xe3c8('0x58')],null))[_0xe3c8('0x20')](function(_0x372257){if(_0x372257){_0x227a6e[_0xe3c8('0x28')]=_0x372257[_0xe3c8('0x63')]({'plain':!![]});return db[_0xe3c8('0x64')][_0xe3c8('0x56')]({'where':{'id':_0x372257['SmsInteractionId']}});}return null;})[_0xe3c8('0x20')](handleEntityNotFound(_0x5f58cb,null))[_0xe3c8('0x20')](function(_0x526947){if(_0x526947){return _0x526947[_0xe3c8('0x38')]({'UserId':_0x2a9685[_0xe3c8('0x58')]['UserId'],'read1stAt':_[_0xe3c8('0x65')](_0x526947[_0xe3c8('0x66')])?moment()['format'](_0xe3c8('0x5f')):undefined});}return null;})[_0xe3c8('0x20')](function(_0x2f9451){if(_0x2f9451){_0x227a6e[_0xe3c8('0x67')]=_0x2f9451['get']({'plain':!![]});interaction_log[_0xe3c8('0x21')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2a9685[_0xe3c8('0x61')]['id'],_0x2a9685[_0xe3c8('0x61')][_0xe3c8('0x3b')],_0x2a9685[_0xe3c8('0x61')]['role'],_0x227a6e[_0xe3c8('0x67')]['id'],_0x2a9685[_0xe3c8('0x58')]?JSON['stringify'](_0x2a9685[_0xe3c8('0x58')]):_0xe3c8('0x68'));return respondWithRpcPromise('AcceptMessage',_0xe3c8('0x69'),_0x227a6e);}return null;})[_0xe3c8('0x20')](function(_0x41cae0){var _0x5a61b3=_0xe3c8('0x6a')+_0x41cae0['message']['ContactId'];return db[_0xe3c8('0x6b')][_0xe3c8('0x47')](_0x5a61b3,{'type':db[_0xe3c8('0x6c')]['QueryTypes'][_0xe3c8('0x6d')],'raw':!![]})[_0xe3c8('0x20')](function(_0x17fa4b){return _0x17fa4b;});})['then'](function(_0x4de14c){if(_0x4de14c){_0x227a6e[_0xe3c8('0x28')][_0xe3c8('0x6e')]=_0x4de14c[0x0];if(!_0x2a9685['body'][_0xe3c8('0x60')])return;return db['User']['find']({'where':{'id':_0x2a9685[_0xe3c8('0x58')][_0xe3c8('0x60')],'role':_0xe3c8('0x62')},'attributes':['id',_0xe3c8('0x3b'),_0xe3c8('0x6f'),_0xe3c8('0x70'),_0xe3c8('0x71')],'raw':!![]});}return null;})[_0xe3c8('0x20')](function(_0x966021){if(!_0x966021)return null;_0x227a6e['message'][_0xe3c8('0x62')]=_0x966021;return _0x227a6e;})['then'](function(_0x2500e7){if(_0x2500e7){if(_0x2a9685[_0xe3c8('0x58')][_0xe3c8('0x72')]){_0x227a6e['message']['interface']=util[_0xe3c8('0x5e')](_0xe3c8('0x73'),_0x2a9685[_0xe3c8('0x61')][_0xe3c8('0x3b')]);_0x227a6e[_0xe3c8('0x28')][_0xe3c8('0x74')]=_0x227a6e[_0xe3c8('0x74')];_0x227a6e['message'][_0xe3c8('0x75')]=_0x227a6e['channel'];_0x227a6e['message']['event']='accept';return respondWithRpcPromise(_0xe3c8('0x76'),_0xe3c8('0x76'),{'event':_0xe3c8('0x77'),'message':_0x227a6e[_0xe3c8('0x28')]},client9002)[_0xe3c8('0x20')](function(){return _0x227a6e;});}return _0x227a6e;}return null;})[_0xe3c8('0x20')](respondWithResult(_0x5f58cb,null))[_0xe3c8('0x2a')](handleError(_0x5f58cb,null));};var interaction_log=require(_0xe3c8('0x13'))(_0xe3c8('0x5a'));exports[_0xe3c8('0x36')]=function(_0x1021f,_0x2d0eca,_0xa2aafa){var _0x563f74={'agent':{},'channel':'sms'};if(_0x1021f[_0xe3c8('0x58')]['id']){delete _0x1021f[_0xe3c8('0x58')]['id'];}_0x1021f[_0xe3c8('0x58')][_0xe3c8('0x60')]=_0x1021f[_0xe3c8('0x58')][_0xe3c8('0x60')]||_0x1021f[_0xe3c8('0x61')]['id'];_0x563f74[_0xe3c8('0x62')]['id']=_0x1021f[_0xe3c8('0x58')][_0xe3c8('0x60')];return db['SmsMessage'][_0xe3c8('0x56')]({'where':{'id':_0x1021f[_0xe3c8('0x52')]['id'],'UserId':null}})[_0xe3c8('0x20')](handleEntityNotFound(_0x2d0eca,null))[_0xe3c8('0x20')](function(_0x3588){if(_0x3588){_0x563f74['message']=_0x3588[_0xe3c8('0x63')]({'plain':!![]});return db[_0xe3c8('0x64')]['find']({'where':{'id':_0x3588[_0xe3c8('0x78')]}});}return null;})[_0xe3c8('0x20')](handleEntityNotFound(_0x2d0eca,null))[_0xe3c8('0x20')](function(_0x221aa0){if(_0x221aa0){_0x563f74[_0xe3c8('0x67')]=_0x221aa0[_0xe3c8('0x63')]({'plain':!![]});interaction_log[_0xe3c8('0x21')](_0xe3c8('0x79'),_0x1021f['user']['id'],_0x1021f['user'][_0xe3c8('0x3b')],_0x1021f[_0xe3c8('0x61')]['role'],_0x563f74['interaction']['id'],_0x1021f[_0xe3c8('0x58')]?JSON[_0xe3c8('0x25')](_0x1021f['body']):_0xe3c8('0x68'));return respondWithRpcPromise(_0xe3c8('0x7a'),_0xe3c8('0x7b'),_0x563f74);}return null;})[_0xe3c8('0x20')](function(_0x5e4846){var _0x5cffb1=_0xe3c8('0x6a')+_0x5e4846[_0xe3c8('0x28')][_0xe3c8('0x7c')];return db[_0xe3c8('0x6b')][_0xe3c8('0x47')](_0x5cffb1,{'type':db[_0xe3c8('0x6c')]['QueryTypes'][_0xe3c8('0x6d')],'raw':!![]})[_0xe3c8('0x20')](function(_0x5061b4){return _0x5061b4;});})[_0xe3c8('0x20')](function(_0x114eec){if(_0x114eec){_0x563f74[_0xe3c8('0x28')][_0xe3c8('0x6e')]=_0x114eec[0x0];if(!_0x1021f['body'][_0xe3c8('0x60')])return;return db['User']['find']({'where':{'id':_0x1021f[_0xe3c8('0x58')]['UserId'],'role':'agent'},'attributes':['id',_0xe3c8('0x3b'),_0xe3c8('0x6f'),_0xe3c8('0x70'),_0xe3c8('0x71')],'raw':!![]});}return null;})[_0xe3c8('0x20')](function(_0x492a57){if(!_0x492a57)return null;_0x563f74['message']['agent']=_0x492a57;return _0x563f74;})[_0xe3c8('0x20')](function(_0x3c054a){if(_0x3c054a){_0x3c054a[_0xe3c8('0x28')]['interface']=util[_0xe3c8('0x5e')](_0xe3c8('0x73'),_0x1021f['user']['name']);_0x3c054a['message'][_0xe3c8('0x74')]=_0x563f74[_0xe3c8('0x74')];_0x3c054a['message']['motionChannel']=_0x563f74[_0xe3c8('0x74')];_0x3c054a[_0xe3c8('0x28')][_0xe3c8('0x7d')]=_0xe3c8('0x36');respondWithRpcPromise(_0xe3c8('0x76'),_0xe3c8('0x76'),{'event':_0xe3c8('0x7e'),'message':_0x3c054a[_0xe3c8('0x28')]},client9002);return _0x563f74;}return null;})['then'](respondWithResult(_0x2d0eca,null))[_0xe3c8('0x2a')](handleError(_0x2d0eca,null));};exports[_0xe3c8('0x2d')]=function(_0x5c744c,_0x2b1b24,_0x30d9fc){if(_0x5c744c[_0xe3c8('0x58')]['id']){delete _0x5c744c[_0xe3c8('0x58')]['id'];}var _0x2fc79f;return db['SmsMessage'][_0xe3c8('0x56')]({'where':{'id':_0x5c744c[_0xe3c8('0x52')]['id']}})['then'](handleEntityNotFound(_0x2b1b24,null))['then'](function(_0x1e64df){if(_0x1e64df){_0x2fc79f=_0x1e64df;return db[_0xe3c8('0x7f')][_0xe3c8('0x56')]({'where':{'id':_0x1e64df[_0xe3c8('0x80')]}});}})[_0xe3c8('0x20')](handleEntityNotFound(_0x2b1b24,null))[_0xe3c8('0x20')](function(_0x55d91f){if(_0x55d91f){logger[_0xe3c8('0x24')](_0xe3c8('0x81'),_0xe3c8('0x2d'),'received\x20delivery\x20report\x20from',_0x55d91f['type'],util['inspect'](_0x5c744c[_0xe3c8('0x58')],{'showHidden':![],'depth':null}));switch(_0x55d91f['type']){case _0xe3c8('0x82'):if(_0x5c744c[_0xe3c8('0x58')][_0xe3c8('0x83')]&&_0x5c744c[_0xe3c8('0x58')][_0xe3c8('0x83')]===_0x2fc79f[_0xe3c8('0x84')]){return _0x2fc79f['update']({'read':!![]});}else{logger['error'](_0xe3c8('0x85'),'status',_0xe3c8('0x82'),util[_0xe3c8('0x86')](_0x5c744c[_0xe3c8('0x58')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x5c744c[_0xe3c8('0x58')]['MessageUUID']&&_0x5c744c[_0xe3c8('0x58')][_0xe3c8('0x87')]===_0x2fc79f[_0xe3c8('0x84')]&&_[_0xe3c8('0x88')]([_0xe3c8('0x89'),'delivered'],_0x5c744c['body'][_0xe3c8('0x8a')])>=0x0){return _0x2fc79f[_0xe3c8('0x38')]({'read':!![]});}else{logger['error'](_0xe3c8('0x85'),_0xe3c8('0x2d'),_0xe3c8('0x8b'),util[_0xe3c8('0x86')](_0x5c744c[_0xe3c8('0x58')],{'showHidden':![],'depth':null}));}break;case _0xe3c8('0x8c'):var _0x4305a5=_0x5c744c[_0xe3c8('0x58')][_0xe3c8('0x8d')][0x0];if(_0x4305a5['status']['groupName']===_0xe3c8('0x8e')){return _0x2fc79f[_0xe3c8('0x38')]({'read':!![]});}else{logger[_0xe3c8('0x26')](_0xe3c8('0x85'),'status','infobip',util[_0xe3c8('0x86')](_0x5c744c[_0xe3c8('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x2fc79f;}})[_0xe3c8('0x20')](respondWithResult(_0x2b1b24,null))[_0xe3c8('0x2a')](handleError(_0x2b1b24,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 1c6cf72..f4bea1b 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 _0x8097=['remove','emit','hasOwnProperty','events','../../mysqldb','SmsMessage','save'];(function(_0x59c32a,_0x3665ea){var _0x4c4751=function(_0x75ce32){while(--_0x75ce32){_0x59c32a['push'](_0x59c32a['shift']());}};_0x4c4751(++_0x3665ea);}(_0x8097,0x1f4));var _0x7809=function(_0xe1ad28,_0x182f9b){_0xe1ad28=_0xe1ad28-0x0;var _0x36894c=_0x8097[_0xe1ad28];return _0x36894c;};'use strict';var EventEmitter=require(_0x7809('0x0'));var SmsMessage=require(_0x7809('0x1'))['db'][_0x7809('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7809('0x3'),'afterUpdate':'update','afterDestroy':_0x7809('0x4')};function emitEvent(_0xa744a8){return function(_0x236ea5,_0x27ec66,_0x560721){SmsMessageEvents['emit'](_0xa744a8+':'+_0x236ea5['id'],_0x236ea5);SmsMessageEvents[_0x7809('0x5')](_0xa744a8,_0x236ea5);_0x560721(null);};}for(var e in events){if(events[_0x7809('0x6')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x2136=['hook','exports','events','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0xeb8b1c,_0x59fee9){var _0x37fb25=function(_0x171691){while(--_0x171691){_0xeb8b1c['push'](_0xeb8b1c['shift']());}};_0x37fb25(++_0x59fee9);}(_0x2136,0x9b));var _0x6213=function(_0x4671a5,_0x1db5f4){_0x4671a5=_0x4671a5-0x0;var _0x12f1ac=_0x2136[_0x4671a5];return _0x12f1ac;};'use strict';var EventEmitter=require(_0x6213('0x0'));var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x6213('0x1')](0x0);var events={'afterCreate':_0x6213('0x2'),'afterUpdate':_0x6213('0x3'),'afterDestroy':_0x6213('0x4')};function emitEvent(_0x5e1dc8){return function(_0x12a800,_0x31e56c,_0x2f6315){SmsMessageEvents[_0x6213('0x5')](_0x5e1dc8+':'+_0x12a800['id'],_0x12a800);SmsMessageEvents[_0x6213('0x5')](_0x5e1dc8,_0x12a800);_0x2f6315(null);};}for(var e in events){if(events[_0x6213('0x6')](e)){var event=events[e];SmsMessage[_0x6213('0x7')](e,emitEvent(event));}}module[_0x6213('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index b53374a..fc2f466 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 _0x68d5=['createHash','md5','signature=','/external/get/send.php?','id_sms','csc','clickatell','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','intelepeer','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','isNil','findOne','SmsInteractionId','then','catch','error','SmsAccount','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','update','afterCreate','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','GET','split','POST','user_key','total_sent','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','message_id','clickSend','authId','format','https://api.plivo.com/v1/Account/%s/Message/','toString','plivo','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','token','infobip','crypto','apiKey','login','text','timestamp','keys','sort','length'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x68d5,0xff));var _0x568d=function(_0x16b703,_0x41d9b4){_0x16b703=_0x16b703-0x0;var _0x416d9b=_0x68d5[_0x16b703];return _0x416d9b;};'use strict';var _=require('lodash');var util=require(_0x568d('0x0'));var logger=require(_0x568d('0x1'))(_0x568d('0x2'));var moment=require(_0x568d('0x3'));var BPromise=require(_0x568d('0x4'));var rp=require(_0x568d('0x5'));var fs=require('fs');var path=require(_0x568d('0x6'));var rimraf=require(_0x568d('0x7'));var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module['exports']=function(_0x4f89a4,_0x3eacb0){return _0x4f89a4[_0x568d('0x8')]('SmsMessage',attributes,{'tableName':_0x568d('0x9'),'paranoid':![],'indexes':[{'name':_0x568d('0xa'),'fields':[_0x568d('0xa')]},{'name':_0x568d('0xb'),'fields':[_0x568d('0xc')],'type':_0x568d('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5f2d0d,_0x28cea3,_0x8672b){var _0x595998=_0x4f89a4[_0x568d('0xe')];var _0x21d6cc=_0x5f2d0d[_0x568d('0xf')]({'plain':!![]});if(_0x21d6cc[_0x568d('0x10')][_0x568d('0x11')]()==='in'||_0x21d6cc[_0x568d('0x10')][_0x568d('0x11')]()===_0x568d('0x12')&&!_0x21d6cc[_0x568d('0x13')]&&!_['isNil'](_0x21d6cc[_0x568d('0x14')])&&!_[_0x568d('0x15')](_0x21d6cc['SmsInteractionId'])){_0x595998['SmsInteraction'][_0x568d('0x16')]({'where':{'id':_0x21d6cc[_0x568d('0x17')]}})[_0x568d('0x18')](function(_0x3c20e8){if(_0x3c20e8){_0x3c20e8['update']({'lastMsgAt':_0x21d6cc['createdAt'],'lastMsgDirection':_0x21d6cc[_0x568d('0x10')][_0x568d('0x11')]()});}})[_0x568d('0x19')](function(_0x36c820){console[_0x568d('0x1a')](_0x36c820);});}if(_0x21d6cc['direction']===_0x568d('0x12')&&!_0x21d6cc[_0x568d('0x13')]){var _0x5ec3f7;_0x595998[_0x568d('0x1b')]['find']({'where':{'id':_0x21d6cc['SmsAccountId']},'raw':!![]})['then'](function(_0x55fc37){_0x5ec3f7=_0x55fc37;if(_0x5ec3f7&&_0x5ec3f7['type']){switch(_0x5ec3f7[_0x568d('0x1c')]){case'twilio':var _0x47d8ed=require(_0x568d('0x1d'));if(_0x5ec3f7[_0x568d('0x1e')]&&_0x5ec3f7[_0x568d('0x1f')]&&_0x5ec3f7[_0x568d('0x20')]){var _0x2a2fee=new _0x47d8ed(_0x5ec3f7[_0x568d('0x1e')],_0x5ec3f7[_0x568d('0x1f')]);_0x2a2fee[_0x568d('0x21')][_0x568d('0x22')]({'body':_0x21d6cc[_0x568d('0xc')],'to':_0x21d6cc[_0x568d('0x20')],'from':_0x5ec3f7[_0x568d('0x20')],'statusCallback':_0x5ec3f7[_0x568d('0x23')]+_0x568d('0x24')+_0x21d6cc['id']+_0x568d('0x25')+_0x5ec3f7['token']})[_0x568d('0x18')](function(_0x24c757){if(_0x24c757['sid']){return _0x5f2d0d[_0x568d('0x26')]({'messageId':_0x24c757['sid']});}})[_0x568d('0x19')](function(_0x4aa6a9){logger[_0x568d('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x568d('0x27'),_0x568d('0x1d'),util['inspect'](_0x4aa6a9,{'showHidden':![],'depth':null}));});}else{logger[_0x568d('0x1a')](_0x568d('0x28'),_0x568d('0x27'),_0x568d('0x1d'),_0x568d('0x29'));}break;case _0x568d('0x2a'):var _0x3ca8d9=_0x568d('0x2b');if(_0x5ec3f7[_0x568d('0x2c')]&&_0x5ec3f7[_0x568d('0x2d')]){var _0x22cb06={'recipient':[_0x21d6cc[_0x568d('0x20')]],'message':_0x21d6cc[_0x568d('0xc')],'message_type':_0x5ec3f7[_0x568d('0x2e')]};if(_0x5ec3f7[_0x568d('0x2e')]&&_0x5ec3f7[_0x568d('0x2e')]!=='SI'){_0x22cb06[_0x568d('0x2f')]=_0x5ec3f7[_0x568d('0x20')];}var _0x3c453b={'url':_0x3ca8d9+_0x568d('0x30')+_0x5ec3f7[_0x568d('0x2c')]+'&password='+_0x5ec3f7[_0x568d('0x2d')],'method':_0x568d('0x31')};rp(_0x3c453b)['then'](function(_0x36f19b){var _0x2f33da=_0x36f19b[_0x568d('0x32')](';');var _0x295dca={'user_key':_0x2f33da[0x0],'session_key':_0x2f33da[0x1]};_0x3c453b={'url':_0x3ca8d9+'sms','method':_0x568d('0x33'),'headers':{'user_key':_0x295dca[_0x568d('0x34')],'Session_key':_0x295dca['session_key']},'json':!![],'body':_0x22cb06};return rp(_0x3c453b);})[_0x568d('0x18')](function(_0x1e79e2){if(_0x1e79e2[_0x568d('0x35')]>=0x1){var _0x4dbf91={'messageId':_0x1e79e2[_0x568d('0x36')]};if(_0x5ec3f7['smsMethod']!=='GP'||!_0x5ec3f7[_0x568d('0x37')]){_0x4dbf91[_0x568d('0x38')]=!![];}return _0x5f2d0d[_0x568d('0x26')](_0x4dbf91);}else{return logger[_0x568d('0x1a')](_0x568d('0x28'),'afterCreate',_0x568d('0x2a'),util['inspect'](_0x1e79e2,{'showHidden':![],'depth':null}));}})[_0x568d('0x19')](function(_0x503eed){return logger[_0x568d('0x1a')](_0x568d('0x28'),_0x568d('0x27'),_0x568d('0x2a'),util[_0x568d('0x39')](_0x503eed,{'showHidden':![],'depth':null}));});}else{logger[_0x568d('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x568d('0x27'),'skebby',_0x568d('0x3a'));}break;case _0x568d('0x3b'):if(_0x5ec3f7['authToken']){var _0x3052ed={'recipient':_0x21d6cc['phone'],'message':_0x21d6cc[_0x568d('0xc')],'sender':_0x5ec3f7[_0x568d('0x3c')]||_0x5ec3f7['phone'],'authorization':_0x5ec3f7[_0x568d('0x1f')]};var _0x28cea3={'method':_0x568d('0x33'),'uri':_0x568d('0x3d'),'body':_0x3052ed,'json':!![]};rp(_0x28cea3)[_0x568d('0x18')](function(_0x2cb04e){var _0x4437d2={'messageId':_0x2cb04e[_0x568d('0x3e')]};if(!_0x5ec3f7['deliveryReport']){_0x4437d2['read']=!![];}return _0x5f2d0d[_0x568d('0x26')](_0x4437d2);})[_0x568d('0x19')](function(_0x3b3697){logger[_0x568d('0x1a')](_0x568d('0x28'),_0x568d('0x27'),_0x568d('0x3b'),util[_0x568d('0x39')](_0x3b3697,{'showHidden':![],'depth':null}));});}else{logger[_0x568d('0x1a')](_0x568d('0x28'),_0x568d('0x27'),_0x568d('0x3b'),_0x568d('0x3f'));}break;case _0x568d('0x40'):if(_0x5ec3f7[_0x568d('0x2c')]&&_0x5ec3f7['password']){var _0x3052ed={'messages':[{'source':_0x568d('0x41'),'to':_0x21d6cc[_0x568d('0x20')],'body':_0x21d6cc[_0x568d('0xc')],'from':_0x5ec3f7[_0x568d('0x3c')]||_0x5ec3f7[_0x568d('0x20')]}]};var _0xda7873=util['format'](_0x568d('0x42'),_0x5ec3f7[_0x568d('0x2c')],_0x5ec3f7[_0x568d('0x2d')]);var _0x28cea3={'method':_0x568d('0x33'),'uri':_0x568d('0x43'),'body':_0x3052ed,'headers':{'Authorization':util['format'](_0x568d('0x44'),new Buffer(_0xda7873)['toString'](_0x568d('0x45')))},'json':!![]};rp(_0x28cea3)[_0x568d('0x18')](function(_0x2a07d6){if(_0x2a07d6[_0x568d('0x46')]>=0xc8&&_0x2a07d6[_0x568d('0x46')]<=0xce){if(_0x2a07d6[_0x568d('0x47')]&&_0x2a07d6[_0x568d('0x47')][_0x568d('0x48')]>0x0){var _0x14eef5=_[_0x568d('0x49')](_0x2a07d6['data'][_0x568d('0x21')]);var _0x8389bd={'messageId':_0x14eef5[_0x568d('0x4a')]};if(!_0x5ec3f7['deliveryReport']){_0x8389bd[_0x568d('0x38')]=!![];}return _0x5f2d0d['update'](_0x8389bd);}else{logger[_0x568d('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickSend',util[_0x568d('0x39')](_0x2a07d6,{'showHidden':![],'depth':null}));}}else{logger[_0x568d('0x1a')](_0x568d('0x28'),_0x568d('0x27'),_0x568d('0x4b'),util['inspect'](_0x2a07d6,{'showHidden':![],'depth':null}));}})[_0x568d('0x19')](function(_0x291e49){logger[_0x568d('0x1a')](_0x568d('0x28'),_0x568d('0x27'),_0x568d('0x4b'),util[_0x568d('0x39')](_0x291e49,{'showHidden':![],'depth':null}));});}else{logger[_0x568d('0x1a')](_0x568d('0x28'),_0x568d('0x27'),_0x568d('0x4b'),_0x568d('0x3a'));}break;case'plivo':if(_0x5ec3f7[_0x568d('0x4c')]&&_0x5ec3f7[_0x568d('0x1f')]){var _0x3052ed={'dst':_0x21d6cc[_0x568d('0x20')],'text':_0x21d6cc['body'],'src':_0x5ec3f7[_0x568d('0x3c')]||_0x5ec3f7[_0x568d('0x20')],'url':_0x5ec3f7[_0x568d('0x23')]+'/api/sms/messages/'+_0x21d6cc['id']+'/status?token='+_0x5ec3f7['token']};var _0xda7873=util[_0x568d('0x4d')](_0x568d('0x42'),_0x5ec3f7[_0x568d('0x4c')],_0x5ec3f7[_0x568d('0x1f')]);var _0x28cea3={'method':'POST','uri':util[_0x568d('0x4d')](_0x568d('0x4e'),_0x5ec3f7[_0x568d('0x4c')]),'body':_0x3052ed,'headers':{'Authorization':util[_0x568d('0x4d')](_0x568d('0x44'),new Buffer(_0xda7873)[_0x568d('0x4f')](_0x568d('0x45')))},'json':!![]};rp(_0x28cea3)['then'](function(_0x51cdf1){var _0x1e76a9={'messageId':_0x51cdf1['message_uuid'][0x0]};return _0x5f2d0d[_0x568d('0x26')](_0x1e76a9);})[_0x568d('0x19')](function(_0x58454b){logger[_0x568d('0x1a')](_0x568d('0x28'),'afterCreate','plivo',util[_0x568d('0x39')](_0x58454b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x568d('0x28'),'afterCreate',_0x568d('0x50'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x5ec3f7[_0x568d('0x2c')]&&_0x5ec3f7['password']){if(_0x5ec3f7[_0x568d('0x51')]){var _0x7c3632={'method':_0x568d('0x33'),'uri':_0x5ec3f7[_0x568d('0x51')]+_0x568d('0x52'),'body':{'username':_0x5ec3f7[_0x568d('0x2c')],'password':_0x5ec3f7['password']},'json':!![]};return rp(_0x7c3632)[_0x568d('0x18')](function(_0x1f02f3){var _0x4e0f89={'method':_0x568d('0x33'),'uri':_0x5ec3f7['baseUrl']+_0x568d('0x53'),'body':{'messages':[{'from':_0x5ec3f7['phone'],'destinations':[{'to':_0x21d6cc[_0x568d('0x20')]}],'text':_0x21d6cc[_0x568d('0xc')],'notifyUrl':_0x5ec3f7['remote']+'/api/sms/messages/'+_0x21d6cc['id']+_0x568d('0x25')+_0x5ec3f7['token'],'notifyContentType':_0x568d('0x54'),'callbackData':_0x5ec3f7[_0x568d('0x20')]+';'+_0x21d6cc[_0x568d('0xc')]}]},'headers':{'Authorization':_0x568d('0x55')+_0x1f02f3[_0x568d('0x56')]},'json':!![]};return rp(_0x4e0f89)['then'](function(_0x1c8c7c){if(_0x1c8c7c[_0x568d('0x21')]){var _0xd8331a={'messageId':_0x1c8c7c[_0x568d('0x21')][0x0][_0x568d('0xa')]};if(!_0x5ec3f7[_0x568d('0x37')]){_0xd8331a[_0x568d('0x38')]=!![];}return _0x5f2d0d['update'](_0xd8331a);}else{return logger[_0x568d('0x1a')](_0x568d('0x28'),'afterCreate',_0x568d('0x57'),util[_0x568d('0x39')](_0x1c8c7c,{'showHidden':![],'depth':null}));}});})[_0x568d('0x19')](function(_0xbe763c){return logger[_0x568d('0x1a')](_0x568d('0x28'),_0x568d('0x27'),_0x568d('0x57'),util[_0x568d('0x39')](_0xbe763c,{'showHidden':![],'depth':null}));});}else{logger[_0x568d('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x568d('0x27'),_0x568d('0x57'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x568d('0x1a')](_0x568d('0x28'),_0x568d('0x27'),'infobip','Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0x493cc5=require(_0x568d('0x58'));if(_0x5ec3f7[_0x568d('0x59')]){var _0x16f5eb={};_0x16f5eb[_0x568d('0x5a')]=_0x5ec3f7[_0x568d('0x2c')];_0x16f5eb[_0x568d('0x20')]=_0x21d6cc[_0x568d('0x20')];_0x16f5eb[_0x568d('0x2f')]=_0x5ec3f7[_0x568d('0x20')];_0x16f5eb[_0x568d('0x5b')]=_0x21d6cc[_0x568d('0xc')];_0x16f5eb[_0x568d('0x5c')]=+new Date();var _0x3365cf='';var _0x21135f='';var _0x32ebff=Object[_0x568d('0x5d')](_0x16f5eb);_0x32ebff[_0x568d('0x5e')]();for(var _0x5e978e=0x0;_0x5e978e<_0x32ebff[_0x568d('0x5f')];_0x5e978e++){if(_0x3365cf!=''){_0x3365cf+='&';}_0x3365cf+=_0x32ebff[_0x5e978e]+'='+encodeURIComponent(_0x16f5eb[_0x32ebff[_0x5e978e]]);_0x21135f+=_0x16f5eb[_0x32ebff[_0x5e978e]];}_0x21135f+=_0x5ec3f7['apiKey'];_0x21135f=_0x493cc5[_0x568d('0x60')](_0x568d('0x61'))[_0x568d('0x26')](_0x21135f)['digest']('hex');if(_0x3365cf!==''){_0x3365cf+='&';}_0x3365cf+=_0x568d('0x62')+_0x21135f;var _0x3c453b={'method':_0x568d('0x31'),'uri':_0x5ec3f7['baseUrl']+_0x568d('0x63')+_0x3365cf,'json':!![]};return rp(_0x3c453b)['then'](function(_0x11a17f){var _0x48a795=Object[_0x568d('0x5d')](_0x11a17f);if(_0x11a17f[_0x48a795[0x0]][_0x568d('0x1a')]&&parseInt(_0x11a17f[_0x48a795[0x0]]['error'])===0x0){var _0x20ab53={'messageId':_0x11a17f[_0x48a795[0x0]][_0x568d('0x64')]};if(!_0x5ec3f7[_0x568d('0x37')]){_0x20ab53[_0x568d('0x38')]=!![];}return _0x5f2d0d[_0x568d('0x26')](_0x20ab53);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x568d('0x65'),util[_0x568d('0x39')](_0x11a17f[_0x568d('0x1a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x237d5b){return logger[_0x568d('0x1a')](_0x568d('0x28'),'afterCreate','csc',util[_0x568d('0x39')](_0x237d5b,{'showHidden':![],'depth':null}));});}else{logger[_0x568d('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x568d('0x27'),'csc','Missing\x20parameters:\x20apiKey');}break;case _0x568d('0x66'):if(_0x5ec3f7[_0x568d('0x59')]){var _0x25d00b={'method':'POST','uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x5ec3f7[_0x568d('0x59')]},'body':{'content':_0x21d6cc['body'],'to':[_0x21d6cc[_0x568d('0x20')]],'from':_0x5ec3f7['phone'],'binary':![],'clientMessageId':'uuid','charset':_0x568d('0x67')},'json':!![]};rp(_0x25d00b)[_0x568d('0x18')](function(_0x327e60){if(!_0x327e60['error']){var _0x33d3c7={'messageId':_0x327e60[_0x568d('0x21')][0x0][_0x568d('0x68')]};if(!_0x5ec3f7[_0x568d('0x37')]){_0x33d3c7[_0x568d('0x38')]=!![];}return _0x5f2d0d[_0x568d('0x26')](_0x33d3c7);}else{return logger['error'](_0x568d('0x28'),'afterCreate',_0x568d('0x66'),util['inspect'](_0x327e60['error'],{'showHidden':![],'depth':null}));}})[_0x568d('0x19')](function(_0x15cc2c){return logger['error'](_0x568d('0x28'),_0x568d('0x27'),_0x568d('0x66'),util[_0x568d('0x39')](_0x15cc2c,{'showHidden':![],'depth':null}));});}else{logger[_0x568d('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickatell','Missing\x20parameters:\x20apiKey');}break;case _0x568d('0x69'):if(_0x5ec3f7['username']&&_0x5ec3f7['password']){var _0xda7873=util[_0x568d('0x4d')](_0x568d('0x42'),_0x5ec3f7[_0x568d('0x2c')],_0x5ec3f7[_0x568d('0x2d')]);var _0x28cea3={'method':'POST','uri':_0x568d('0x6a')+_0x5ec3f7[_0x568d('0x6b')]+'/messages','body':{'to':[_0x21d6cc['phone']],'text':_0x21d6cc['body'],'from':_0x5ec3f7[_0x568d('0x20')],'applicationId':_0x5ec3f7['applicationId']},'headers':{'Authorization':util[_0x568d('0x4d')](_0x568d('0x44'),new Buffer(_0xda7873)[_0x568d('0x4f')](_0x568d('0x45')))},'json':!![]};rp(_0x28cea3)['then'](function(_0x5e65e7){if(_0x5e65e7['id']){var _0x24a6c4={'messageId':_0x5e65e7['id']};return _0x5f2d0d[_0x568d('0x26')](_0x24a6c4);}else{logger[_0x568d('0x1a')](_0x568d('0x28'),_0x568d('0x27'),_0x568d('0x69'),util[_0x568d('0x39')](_0x5e65e7,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1bf1c5){logger[_0x568d('0x1a')](_0x568d('0x28'),_0x568d('0x27'),'bandwidth',util[_0x568d('0x39')](_0x1bf1c5,{'showHidden':![],'depth':null}));});}else{logger[_0x568d('0x1a')](_0x568d('0x28'),_0x568d('0x27'),_0x568d('0x69'),_0x568d('0x3a'));}break;case'intelepeer':if(_0x5ec3f7[_0x568d('0x59')]){var _0x8bb453={};var _0x3c453b={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x568d('0x6c')+_0x5ec3f7[_0x568d('0x59')],'Content-Type':_0x568d('0x54')},'body':{'from':_0x5ec3f7[_0x568d('0x20')],'to':_0x21d6cc[_0x568d('0x20')],'text':_0x21d6cc[_0x568d('0xc')]},'json':!![]};return rp(_0x3c453b)[_0x568d('0x18')](function(_0x418561){if(_0x418561[_0x568d('0x6d')]==0xca){_0x8bb453['message']=_0x418561;var _0x797c42={'method':_0x568d('0x33'),'uri':_0x568d('0x6e'),'headers':{'Authorization':_0x568d('0x6c')+_0x5ec3f7[_0x568d('0x59')],'Content-Type':_0x568d('0x54')},'body':{'refid':_0x8bb453[_0x568d('0x6f')][_0x568d('0x70')]},'json':!![]};return rp(_0x797c42)[_0x568d('0x18')](function(_0x403553){_0x8bb453['status']=_0x403553;var _0x779e1={'messageId':_0x8bb453[_0x568d('0x6f')]['refid'],'read':!![]};return _0x5f2d0d[_0x568d('0x26')](_0x779e1);});}else{return logger[_0x568d('0x1a')](_0x568d('0x28'),_0x568d('0x27'),_0x568d('0x71'),util['inspect'](_0x418561,{'showHidden':![],'depth':null}));}})[_0x568d('0x19')](function(_0x1016fc){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x568d('0x27'),_0x568d('0x71'),util[_0x568d('0x39')](_0x1016fc,{'showHidden':![],'depth':null}));});}else{return logger[_0x568d('0x1a')](_0x568d('0x28'),_0x568d('0x27'),_0x568d('0x71'),'Token\x20not\x20received');}break;}}})[_0x568d('0x72')](function(){_0x8672b();});}else{_0x8672b();}}},'charset':_0x568d('0x73'),'collate':_0x568d('0x74')});}; \ No newline at end of file +var _0xe83d=['inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','password','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','read','SmsMessage,\x20%s,\x20%s,\x20%s','catch','Missing\x20parameters:\x20username,\x20password','deliveryReport','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString','%s:%s','https://rest.clicksend.com/v3/sms/send','format','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','infobip','baseUrl','/auth/1/session','application/json','Missing\x20parameters:\x20base_url','csc','crypto','login','text','sort','length','apiKey','createHash','digest','hex','signature=','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4_unicode_ci','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','isNil','SmsInteractionId','SmsInteraction','findOne','then','update','error','SmsAccount','find','SmsAccountId','type','twilio','authToken','phone','accountSid','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','afterCreate'];(function(_0x412342,_0x180734){var _0x3e62cb=function(_0x501fc6){while(--_0x501fc6){_0x412342['push'](_0x412342['shift']());}};_0x3e62cb(++_0x180734);}(_0xe83d,0x1c6));var _0xde83=function(_0x5ce324,_0x43174f){_0x5ce324=_0x5ce324-0x0;var _0x158e15=_0xe83d[_0x5ce324];return _0x158e15;};'use strict';var _=require(_0xde83('0x0'));var util=require(_0xde83('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xde83('0x2'));var BPromise=require('bluebird');var rp=require(_0xde83('0x3'));var fs=require('fs');var path=require(_0xde83('0x4'));var rimraf=require(_0xde83('0x5'));var config=require(_0xde83('0x6'));var attributes=require(_0xde83('0x7'));module[_0xde83('0x8')]=function(_0x4b884e,_0x179c16){return _0x4b884e[_0xde83('0x9')](_0xde83('0xa'),attributes,{'tableName':_0xde83('0xb'),'paranoid':![],'indexes':[{'name':_0xde83('0xc'),'fields':['messageId']},{'name':_0xde83('0xd'),'fields':[_0xde83('0xe')],'type':_0xde83('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2fb742,_0x3e46c8,_0x47a011){var _0x5cc909=_0x4b884e[_0xde83('0x10')];var _0x1d31a7=_0x2fb742[_0xde83('0x11')]({'plain':!![]});if(_0x1d31a7[_0xde83('0x12')][_0xde83('0x13')]()==='in'||_0x1d31a7[_0xde83('0x12')]['toLowerCase']()===_0xde83('0x14')&&!_0x1d31a7[_0xde83('0x15')]&&!_['isNil'](_0x1d31a7[_0xde83('0x16')])&&!_[_0xde83('0x17')](_0x1d31a7[_0xde83('0x18')])){_0x5cc909[_0xde83('0x19')][_0xde83('0x1a')]({'where':{'id':_0x1d31a7['SmsInteractionId']}})[_0xde83('0x1b')](function(_0x3d83d4){if(_0x3d83d4){_0x3d83d4[_0xde83('0x1c')]({'lastMsgAt':_0x1d31a7['createdAt'],'lastMsgDirection':_0x1d31a7[_0xde83('0x12')][_0xde83('0x13')]()});}})['catch'](function(_0x1a4023){console[_0xde83('0x1d')](_0x1a4023);});}if(_0x1d31a7[_0xde83('0x12')]==='out'&&!_0x1d31a7[_0xde83('0x15')]){var _0x4f9d4f;_0x5cc909[_0xde83('0x1e')][_0xde83('0x1f')]({'where':{'id':_0x1d31a7[_0xde83('0x20')]},'raw':!![]})['then'](function(_0x10ce92){_0x4f9d4f=_0x10ce92;if(_0x4f9d4f&&_0x4f9d4f[_0xde83('0x21')]){switch(_0x4f9d4f['type']){case'twilio':var _0x472ee7=require(_0xde83('0x22'));if(_0x4f9d4f['accountSid']&&_0x4f9d4f[_0xde83('0x23')]&&_0x4f9d4f[_0xde83('0x24')]){var _0x4e1fa5=new _0x472ee7(_0x4f9d4f[_0xde83('0x25')],_0x4f9d4f[_0xde83('0x23')]);_0x4e1fa5[_0xde83('0x26')][_0xde83('0x27')]({'body':_0x1d31a7[_0xde83('0xe')],'to':_0x1d31a7[_0xde83('0x24')],'from':_0x4f9d4f['phone'],'statusCallback':_0x4f9d4f[_0xde83('0x28')]+_0xde83('0x29')+_0x1d31a7['id']+_0xde83('0x2a')+_0x4f9d4f[_0xde83('0x2b')]})[_0xde83('0x1b')](function(_0x80c975){if(_0x80c975[_0xde83('0x2c')]){return _0x2fb742['update']({'messageId':_0x80c975['sid']});}})['catch'](function(_0x583e6e){logger[_0xde83('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xde83('0x2d'),_0xde83('0x22'),util[_0xde83('0x2e')](_0x583e6e,{'showHidden':![],'depth':null}));});}else{logger[_0xde83('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xde83('0x2d'),_0xde83('0x22'),_0xde83('0x2f'));}break;case _0xde83('0x30'):var _0x1a4dd0=_0xde83('0x31');if(_0x4f9d4f[_0xde83('0x32')]&&_0x4f9d4f['password']){var _0x16143c={'recipient':[_0x1d31a7['phone']],'message':_0x1d31a7['body'],'message_type':_0x4f9d4f[_0xde83('0x33')]};if(_0x4f9d4f[_0xde83('0x33')]&&_0x4f9d4f[_0xde83('0x33')]!=='SI'){_0x16143c[_0xde83('0x34')]=_0x4f9d4f[_0xde83('0x24')];}var _0x3a162={'url':_0x1a4dd0+_0xde83('0x35')+_0x4f9d4f['username']+'&password='+_0x4f9d4f[_0xde83('0x36')],'method':_0xde83('0x37')};rp(_0x3a162)['then'](function(_0x3fa279){var _0x24df7e=_0x3fa279[_0xde83('0x38')](';');var _0x32be69={'user_key':_0x24df7e[0x0],'session_key':_0x24df7e[0x1]};_0x3a162={'url':_0x1a4dd0+_0xde83('0x39'),'method':_0xde83('0x3a'),'headers':{'user_key':_0x32be69[_0xde83('0x3b')],'Session_key':_0x32be69[_0xde83('0x3c')]},'json':!![],'body':_0x16143c};return rp(_0x3a162);})[_0xde83('0x1b')](function(_0x43da1a){if(_0x43da1a[_0xde83('0x3d')]>=0x1){var _0xb4b99a={'messageId':_0x43da1a[_0xde83('0x3e')]};if(_0x4f9d4f[_0xde83('0x33')]!=='GP'||!_0x4f9d4f['deliveryReport']){_0xb4b99a[_0xde83('0x3f')]=!![];}return _0x2fb742[_0xde83('0x1c')](_0xb4b99a);}else{return logger[_0xde83('0x1d')](_0xde83('0x40'),_0xde83('0x2d'),'skebby',util[_0xde83('0x2e')](_0x43da1a,{'showHidden':![],'depth':null}));}})[_0xde83('0x41')](function(_0x416783){return logger[_0xde83('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xde83('0x2d'),_0xde83('0x30'),util['inspect'](_0x416783,{'showHidden':![],'depth':null}));});}else{logger[_0xde83('0x1d')](_0xde83('0x40'),_0xde83('0x2d'),_0xde83('0x30'),_0xde83('0x42'));}break;case'connectel':if(_0x4f9d4f['authToken']){var _0x563603={'recipient':_0x1d31a7[_0xde83('0x24')],'message':_0x1d31a7[_0xde83('0xe')],'sender':_0x4f9d4f['senderString']||_0x4f9d4f[_0xde83('0x24')],'authorization':_0x4f9d4f[_0xde83('0x23')]};var _0x3e46c8={'method':_0xde83('0x3a'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x563603,'json':!![]};rp(_0x3e46c8)[_0xde83('0x1b')](function(_0x4b4e17){var _0x48dfd3={'messageId':_0x4b4e17['requestid']};if(!_0x4f9d4f[_0xde83('0x43')]){_0x48dfd3['read']=!![];}return _0x2fb742['update'](_0x48dfd3);})[_0xde83('0x41')](function(_0x41446a){logger[_0xde83('0x1d')](_0xde83('0x40'),_0xde83('0x2d'),_0xde83('0x44'),util[_0xde83('0x2e')](_0x41446a,{'showHidden':![],'depth':null}));});}else{logger[_0xde83('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','connectel',_0xde83('0x45'));}break;case _0xde83('0x46'):if(_0x4f9d4f[_0xde83('0x32')]&&_0x4f9d4f[_0xde83('0x36')]){var _0x563603={'messages':[{'source':_0xde83('0x47'),'to':_0x1d31a7[_0xde83('0x24')],'body':_0x1d31a7[_0xde83('0xe')],'from':_0x4f9d4f[_0xde83('0x48')]||_0x4f9d4f[_0xde83('0x24')]}]};var _0x4cab0c=util['format'](_0xde83('0x49'),_0x4f9d4f[_0xde83('0x32')],_0x4f9d4f[_0xde83('0x36')]);var _0x3e46c8={'method':_0xde83('0x3a'),'uri':_0xde83('0x4a'),'body':_0x563603,'headers':{'Authorization':util[_0xde83('0x4b')]('Basic\x20%s',new Buffer(_0x4cab0c)[_0xde83('0x4c')](_0xde83('0x4d')))},'json':!![]};rp(_0x3e46c8)[_0xde83('0x1b')](function(_0x3c370c){if(_0x3c370c[_0xde83('0x4e')]>=0xc8&&_0x3c370c[_0xde83('0x4e')]<=0xce){if(_0x3c370c[_0xde83('0x4f')]&&_0x3c370c[_0xde83('0x4f')][_0xde83('0x50')]>0x0){var _0x4d9373=_[_0xde83('0x51')](_0x3c370c[_0xde83('0x4f')]['messages']);var _0x14075a={'messageId':_0x4d9373[_0xde83('0x52')]};if(!_0x4f9d4f[_0xde83('0x43')]){_0x14075a[_0xde83('0x3f')]=!![];}return _0x2fb742['update'](_0x14075a);}else{logger[_0xde83('0x1d')](_0xde83('0x40'),_0xde83('0x2d'),'clickSend',util[_0xde83('0x2e')](_0x3c370c,{'showHidden':![],'depth':null}));}}else{logger[_0xde83('0x1d')](_0xde83('0x40'),_0xde83('0x2d'),'clickSend',util[_0xde83('0x2e')](_0x3c370c,{'showHidden':![],'depth':null}));}})['catch'](function(_0x531139){logger['error'](_0xde83('0x40'),_0xde83('0x2d'),_0xde83('0x53'),util[_0xde83('0x2e')](_0x531139,{'showHidden':![],'depth':null}));});}else{logger[_0xde83('0x1d')](_0xde83('0x40'),_0xde83('0x2d'),_0xde83('0x53'),_0xde83('0x42'));}break;case _0xde83('0x54'):if(_0x4f9d4f[_0xde83('0x55')]&&_0x4f9d4f['authToken']){var _0x563603={'dst':_0x1d31a7[_0xde83('0x24')],'text':_0x1d31a7['body'],'src':_0x4f9d4f[_0xde83('0x48')]||_0x4f9d4f[_0xde83('0x24')],'url':_0x4f9d4f[_0xde83('0x28')]+_0xde83('0x29')+_0x1d31a7['id']+_0xde83('0x2a')+_0x4f9d4f[_0xde83('0x2b')]};var _0x4cab0c=util['format'](_0xde83('0x49'),_0x4f9d4f[_0xde83('0x55')],_0x4f9d4f[_0xde83('0x23')]);var _0x3e46c8={'method':_0xde83('0x3a'),'uri':util[_0xde83('0x4b')](_0xde83('0x56'),_0x4f9d4f[_0xde83('0x55')]),'body':_0x563603,'headers':{'Authorization':util['format'](_0xde83('0x57'),new Buffer(_0x4cab0c)[_0xde83('0x4c')]('base64'))},'json':!![]};rp(_0x3e46c8)[_0xde83('0x1b')](function(_0x1a909e){var _0x583176={'messageId':_0x1a909e['message_uuid'][0x0]};return _0x2fb742[_0xde83('0x1c')](_0x583176);})[_0xde83('0x41')](function(_0x59e2f8){logger[_0xde83('0x1d')](_0xde83('0x40'),_0xde83('0x2d'),_0xde83('0x54'),util['inspect'](_0x59e2f8,{'showHidden':![],'depth':null}));});}else{logger[_0xde83('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xde83('0x2d'),'plivo','Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xde83('0x58'):if(_0x4f9d4f['username']&&_0x4f9d4f[_0xde83('0x36')]){if(_0x4f9d4f[_0xde83('0x59')]){var _0x47da8a={'method':_0xde83('0x3a'),'uri':_0x4f9d4f['baseUrl']+_0xde83('0x5a'),'body':{'username':_0x4f9d4f['username'],'password':_0x4f9d4f[_0xde83('0x36')]},'json':!![]};return rp(_0x47da8a)['then'](function(_0x434724){var _0x4842af={'method':'POST','uri':_0x4f9d4f[_0xde83('0x59')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x4f9d4f['phone'],'destinations':[{'to':_0x1d31a7[_0xde83('0x24')]}],'text':_0x1d31a7[_0xde83('0xe')],'notifyUrl':_0x4f9d4f[_0xde83('0x28')]+_0xde83('0x29')+_0x1d31a7['id']+_0xde83('0x2a')+_0x4f9d4f[_0xde83('0x2b')],'notifyContentType':_0xde83('0x5b'),'callbackData':_0x4f9d4f[_0xde83('0x24')]+';'+_0x1d31a7[_0xde83('0xe')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x434724[_0xde83('0x2b')]},'json':!![]};return rp(_0x4842af)['then'](function(_0x3ad3c7){if(_0x3ad3c7[_0xde83('0x26')]){var _0x231878={'messageId':_0x3ad3c7['messages'][0x0][_0xde83('0xc')]};if(!_0x4f9d4f[_0xde83('0x43')]){_0x231878[_0xde83('0x3f')]=!![];}return _0x2fb742['update'](_0x231878);}else{return logger[_0xde83('0x1d')](_0xde83('0x40'),_0xde83('0x2d'),_0xde83('0x58'),util['inspect'](_0x3ad3c7,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x31d00a){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xde83('0x2d'),_0xde83('0x58'),util['inspect'](_0x31d00a,{'showHidden':![],'depth':null}));});}else{logger[_0xde83('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xde83('0x2d'),_0xde83('0x58'),_0xde83('0x5c'));}}else{logger['error'](_0xde83('0x40'),_0xde83('0x2d'),'infobip',_0xde83('0x42'));}break;case _0xde83('0x5d'):var _0x484a61=require(_0xde83('0x5e'));if(_0x4f9d4f['apiKey']){var _0x1dc59e={};_0x1dc59e[_0xde83('0x5f')]=_0x4f9d4f['username'];_0x1dc59e[_0xde83('0x24')]=_0x1d31a7[_0xde83('0x24')];_0x1dc59e['sender']=_0x4f9d4f[_0xde83('0x24')];_0x1dc59e[_0xde83('0x60')]=_0x1d31a7[_0xde83('0xe')];_0x1dc59e['timestamp']=+new Date();var _0x23566e='';var _0x5154cf='';var _0x31a62a=Object['keys'](_0x1dc59e);_0x31a62a[_0xde83('0x61')]();for(var _0x380bd1=0x0;_0x380bd1<_0x31a62a[_0xde83('0x62')];_0x380bd1++){if(_0x23566e!=''){_0x23566e+='&';}_0x23566e+=_0x31a62a[_0x380bd1]+'='+encodeURIComponent(_0x1dc59e[_0x31a62a[_0x380bd1]]);_0x5154cf+=_0x1dc59e[_0x31a62a[_0x380bd1]];}_0x5154cf+=_0x4f9d4f[_0xde83('0x63')];_0x5154cf=_0x484a61[_0xde83('0x64')]('md5')[_0xde83('0x1c')](_0x5154cf)[_0xde83('0x65')](_0xde83('0x66'));if(_0x23566e!==''){_0x23566e+='&';}_0x23566e+=_0xde83('0x67')+_0x5154cf;var _0x3a162={'method':'GET','uri':_0x4f9d4f[_0xde83('0x59')]+'/external/get/send.php?'+_0x23566e,'json':!![]};return rp(_0x3a162)[_0xde83('0x1b')](function(_0x3efcb5){var _0x2b3496=Object[_0xde83('0x68')](_0x3efcb5);if(_0x3efcb5[_0x2b3496[0x0]][_0xde83('0x1d')]&&parseInt(_0x3efcb5[_0x2b3496[0x0]][_0xde83('0x1d')])===0x0){var _0x117996={'messageId':_0x3efcb5[_0x2b3496[0x0]][_0xde83('0x69')]};if(!_0x4f9d4f['deliveryReport']){_0x117996[_0xde83('0x3f')]=!![];}return _0x2fb742['update'](_0x117996);}else{return logger[_0xde83('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xde83('0x2d'),'csc',util[_0xde83('0x2e')](_0x3efcb5['error'],{'showHidden':![],'depth':null}));}})[_0xde83('0x41')](function(_0x10f448){return logger['error'](_0xde83('0x40'),_0xde83('0x2d'),'csc',util[_0xde83('0x2e')](_0x10f448,{'showHidden':![],'depth':null}));});}else{logger[_0xde83('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xde83('0x2d'),_0xde83('0x5d'),_0xde83('0x6a'));}break;case _0xde83('0x6b'):if(_0x4f9d4f[_0xde83('0x63')]){var _0x363671={'method':_0xde83('0x3a'),'uri':_0xde83('0x6c'),'headers':{'Authorization':_0x4f9d4f['apiKey']},'body':{'content':_0x1d31a7[_0xde83('0xe')],'to':[_0x1d31a7[_0xde83('0x24')]],'from':_0x4f9d4f[_0xde83('0x24')],'binary':![],'clientMessageId':_0xde83('0x6d'),'charset':'UTF-8'},'json':!![]};rp(_0x363671)[_0xde83('0x1b')](function(_0x5eb986){if(!_0x5eb986['error']){var _0x2e69e5={'messageId':_0x5eb986['messages'][0x0][_0xde83('0x6e')]};if(!_0x4f9d4f[_0xde83('0x43')]){_0x2e69e5[_0xde83('0x3f')]=!![];}return _0x2fb742[_0xde83('0x1c')](_0x2e69e5);}else{return logger[_0xde83('0x1d')](_0xde83('0x40'),'afterCreate','clickatell',util['inspect'](_0x5eb986[_0xde83('0x1d')],{'showHidden':![],'depth':null}));}})[_0xde83('0x41')](function(_0x43778d){return logger[_0xde83('0x1d')](_0xde83('0x40'),_0xde83('0x2d'),_0xde83('0x6b'),util['inspect'](_0x43778d,{'showHidden':![],'depth':null}));});}else{logger[_0xde83('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xde83('0x2d'),_0xde83('0x6b'),_0xde83('0x6a'));}break;case _0xde83('0x6f'):if(_0x4f9d4f['username']&&_0x4f9d4f[_0xde83('0x36')]){var _0x4cab0c=util[_0xde83('0x4b')](_0xde83('0x49'),_0x4f9d4f[_0xde83('0x32')],_0x4f9d4f[_0xde83('0x36')]);var _0x3e46c8={'method':_0xde83('0x3a'),'uri':_0xde83('0x70')+_0x4f9d4f[_0xde83('0x71')]+_0xde83('0x72'),'body':{'to':[_0x1d31a7[_0xde83('0x24')]],'text':_0x1d31a7['body'],'from':_0x4f9d4f[_0xde83('0x24')],'applicationId':_0x4f9d4f['applicationId']},'headers':{'Authorization':util[_0xde83('0x4b')](_0xde83('0x57'),new Buffer(_0x4cab0c)[_0xde83('0x4c')](_0xde83('0x4d')))},'json':!![]};rp(_0x3e46c8)[_0xde83('0x1b')](function(_0x928029){if(_0x928029['id']){var _0x17dc29={'messageId':_0x928029['id']};return _0x2fb742['update'](_0x17dc29);}else{logger[_0xde83('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xde83('0x2d'),_0xde83('0x6f'),util['inspect'](_0x928029,{'showHidden':![],'depth':null}));}})[_0xde83('0x41')](function(_0x2c372){logger[_0xde83('0x1d')](_0xde83('0x40'),_0xde83('0x2d'),_0xde83('0x6f'),util[_0xde83('0x2e')](_0x2c372,{'showHidden':![],'depth':null}));});}else{logger[_0xde83('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xde83('0x6f'),_0xde83('0x42'));}break;case'intelepeer':if(_0x4f9d4f[_0xde83('0x63')]){var _0x5959bc={};var _0x3a162={'method':_0xde83('0x3a'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xde83('0x73')+_0x4f9d4f[_0xde83('0x63')],'Content-Type':_0xde83('0x5b')},'body':{'from':_0x4f9d4f[_0xde83('0x24')],'to':_0x1d31a7['phone'],'text':_0x1d31a7['body']},'json':!![]};return rp(_0x3a162)[_0xde83('0x1b')](function(_0x43db23){if(_0x43db23[_0xde83('0x74')]==0xca){_0x5959bc[_0xde83('0x75')]=_0x43db23;var _0x4819f0={'method':_0xde83('0x3a'),'uri':_0xde83('0x76'),'headers':{'Authorization':_0xde83('0x73')+_0x4f9d4f[_0xde83('0x63')],'Content-Type':'application/json'},'body':{'refid':_0x5959bc[_0xde83('0x75')][_0xde83('0x77')]},'json':!![]};return rp(_0x4819f0)[_0xde83('0x1b')](function(_0x563977){_0x5959bc[_0xde83('0x78')]=_0x563977;var _0x58c8b5={'messageId':_0x5959bc[_0xde83('0x75')][_0xde83('0x77')],'read':!![]};return _0x2fb742['update'](_0x58c8b5);});}else{return logger[_0xde83('0x1d')](_0xde83('0x40'),'afterCreate',_0xde83('0x79'),util[_0xde83('0x2e')](_0x43db23,{'showHidden':![],'depth':null}));}})[_0xde83('0x41')](function(_0x1356f9){return logger[_0xde83('0x1d')](_0xde83('0x40'),_0xde83('0x2d'),_0xde83('0x79'),util[_0xde83('0x2e')](_0x1356f9,{'showHidden':![],'depth':null}));});}else{return logger[_0xde83('0x1d')](_0xde83('0x40'),_0xde83('0x2d'),_0xde83('0x79'),_0xde83('0x7a'));}break;}}})[_0xde83('0x7b')](function(){_0x47a011();});}else{_0x47a011();}}},'charset':'utf8mb4','collate':_0xde83('0x7c')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 79fca38..55a4296 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 _0x040c=['request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','SmsMessage,\x20%s,\x20%s','message','result','CreateSmsMessage','SmsMessage','body','options','raw','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsMessage.socket','register','request','info'];(function(_0x36ad8f,_0x3b8166){var _0x5ac926=function(_0x3b32df){while(--_0x3b32df){_0x36ad8f['push'](_0x36ad8f['shift']());}};_0x5ac926(++_0x3b8166);}(_0x040c,0x71));var _0xc040=function(_0x385cda,_0x3083dc){_0x385cda=_0x385cda-0x0;var _0x3b95b8=_0x040c[_0x385cda];return _0x3b95b8;};'use strict';var _=require(_0xc040('0x0'));var util=require(_0xc040('0x1'));var moment=require(_0xc040('0x2'));var BPromise=require(_0xc040('0x3'));var rs=require(_0xc040('0x4'));var fs=require('fs');var Redis=require(_0xc040('0x5'));var db=require(_0xc040('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc040('0x7'));var config=require(_0xc040('0x8'));var jayson=require(_0xc040('0x9'));var client=jayson[_0xc040('0xa')][_0xc040('0xb')]({'port':0x232a});config[_0xc040('0xc')]=_[_0xc040('0xd')](config[_0xc040('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xc040('0xe'))(new Redis(config[_0xc040('0xc')]));require(_0xc040('0xf'))[_0xc040('0x10')](socket);function respondWithRpcPromise(_0x31b145,_0x179bf2,_0x314be3){return new BPromise(function(_0x5ebffa,_0x4f079e){return client[_0xc040('0x11')](_0x31b145,_0x314be3)['then'](function(_0x8fdf6f){logger[_0xc040('0x12')]('SmsMessage,\x20%s,\x20%s',_0x179bf2,_0xc040('0x13'));logger['debug'](_0xc040('0x14'),_0x179bf2,_0xc040('0x13'),JSON[_0xc040('0x15')](_0x8fdf6f));if(_0x8fdf6f[_0xc040('0x16')]){if(_0x8fdf6f[_0xc040('0x16')]['code']===0x1f4){logger[_0xc040('0x16')](_0xc040('0x17'),_0x179bf2,_0x8fdf6f[_0xc040('0x16')][_0xc040('0x18')]);return _0x4f079e(_0x8fdf6f[_0xc040('0x16')][_0xc040('0x18')]);}logger[_0xc040('0x16')](_0xc040('0x17'),_0x179bf2,_0x8fdf6f[_0xc040('0x16')][_0xc040('0x18')]);return _0x5ebffa(_0x8fdf6f['error'][_0xc040('0x18')]);}else{logger[_0xc040('0x12')](_0xc040('0x17'),_0x179bf2,_0xc040('0x13'));_0x5ebffa(_0x8fdf6f[_0xc040('0x19')][_0xc040('0x18')]);}})['catch'](function(_0x27dc76){logger[_0xc040('0x16')]('SmsMessage,\x20%s,\x20%s',_0x179bf2,_0x27dc76);_0x4f079e(_0x27dc76);});});}exports[_0xc040('0x1a')]=function(_0x4769e0){var _0x864471=this;return new Promise(function(_0x1f0871,_0x549f17){return db[_0xc040('0x1b')]['create'](_0x4769e0[_0xc040('0x1c')],{'raw':_0x4769e0[_0xc040('0x1d')]?_0x4769e0['options'][_0xc040('0x1e')]===undefined?!![]:![]:!![]})[_0xc040('0x1f')](function(_0x150a6b){logger['info'](_0xc040('0x1a'),_0x4769e0);logger[_0xc040('0x20')](_0xc040('0x1a'),_0x4769e0,JSON[_0xc040('0x15')](_0x150a6b));_0x1f0871(_0x150a6b);})['catch'](function(_0x1df018){logger[_0xc040('0x16')]('CreateSmsMessage',_0x1df018['message'],_0x4769e0);_0x549f17(_0x864471[_0xc040('0x16')](0x1f4,_0x1df018[_0xc040('0x18')]));});});}; \ No newline at end of file +var _0x34cf=['redis','defaults','localhost','socket.io-emitter','register','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','options','raw','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2fd641,_0xb2cde){var _0x423198=function(_0x26bccf){while(--_0x26bccf){_0x2fd641['push'](_0x2fd641['shift']());}};_0x423198(++_0xb2cde);}(_0x34cf,0x1b5));var _0xf34c=function(_0xfc3272,_0x5b017f){_0xfc3272=_0xfc3272-0x0;var _0x133dbe=_0x34cf[_0xfc3272];return _0x133dbe;};'use strict';var _=require('lodash');var util=require(_0xf34c('0x0'));var moment=require(_0xf34c('0x1'));var BPromise=require('bluebird');var rs=require(_0xf34c('0x2'));var fs=require('fs');var Redis=require(_0xf34c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf34c('0x4'));var logger=require(_0xf34c('0x5'))(_0xf34c('0x6'));var config=require(_0xf34c('0x7'));var jayson=require(_0xf34c('0x8'));var client=jayson[_0xf34c('0x9')][_0xf34c('0xa')]({'port':0x232a});config[_0xf34c('0xb')]=_[_0xf34c('0xc')](config[_0xf34c('0xb')],{'host':_0xf34c('0xd'),'port':0x18eb});var socket=require(_0xf34c('0xe'))(new Redis(config['redis']));require('./smsMessage.socket')[_0xf34c('0xf')](socket);function respondWithRpcPromise(_0x4fca7d,_0x369a7b,_0x5aa7f9){return new BPromise(function(_0x14cf09,_0x3e36db){return client[_0xf34c('0x10')](_0x4fca7d,_0x5aa7f9)[_0xf34c('0x11')](function(_0x636d4a){logger[_0xf34c('0x12')](_0xf34c('0x13'),_0x369a7b,_0xf34c('0x14'));logger[_0xf34c('0x15')](_0xf34c('0x16'),_0x369a7b,_0xf34c('0x14'),JSON[_0xf34c('0x17')](_0x636d4a));if(_0x636d4a['error']){if(_0x636d4a[_0xf34c('0x18')][_0xf34c('0x19')]===0x1f4){logger[_0xf34c('0x18')](_0xf34c('0x13'),_0x369a7b,_0x636d4a[_0xf34c('0x18')]['message']);return _0x3e36db(_0x636d4a[_0xf34c('0x18')]['message']);}logger[_0xf34c('0x18')]('SmsMessage,\x20%s,\x20%s',_0x369a7b,_0x636d4a[_0xf34c('0x18')][_0xf34c('0x1a')]);return _0x14cf09(_0x636d4a[_0xf34c('0x18')]['message']);}else{logger[_0xf34c('0x12')](_0xf34c('0x13'),_0x369a7b,_0xf34c('0x14'));_0x14cf09(_0x636d4a[_0xf34c('0x1b')][_0xf34c('0x1a')]);}})[_0xf34c('0x1c')](function(_0x21c9ca){logger[_0xf34c('0x18')](_0xf34c('0x13'),_0x369a7b,_0x21c9ca);_0x3e36db(_0x21c9ca);});});}exports[_0xf34c('0x1d')]=function(_0x41b413){var _0x4a758f=this;return new Promise(function(_0x15b5b6,_0x6a9223){return db['SmsMessage']['create'](_0x41b413['body'],{'raw':_0x41b413[_0xf34c('0x1e')]?_0x41b413[_0xf34c('0x1e')][_0xf34c('0x1f')]===undefined?!![]:![]:!![]})[_0xf34c('0x11')](function(_0x5a0bdd){logger[_0xf34c('0x12')]('CreateSmsMessage',_0x41b413);logger['debug'](_0xf34c('0x1d'),_0x41b413,JSON[_0xf34c('0x17')](_0x5a0bdd));_0x15b5b6(_0x5a0bdd);})[_0xf34c('0x1c')](function(_0x5cd640){logger['error']('CreateSmsMessage',_0x5cd640[_0xf34c('0x1a')],_0x41b413);_0x6a9223(_0x4a758f['error'](0x1f4,_0x5cd640['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index ab104d3..f8b8b36 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 _0x8559=['save','remove','update','removeListener','register','length','smsMessage:'];(function(_0x2d5a8e,_0x333734){var _0x3d97f8=function(_0x41b763){while(--_0x41b763){_0x2d5a8e['push'](_0x2d5a8e['shift']());}};_0x3d97f8(++_0x333734);}(_0x8559,0x1ce));var _0x9855=function(_0x210d72,_0x382495){_0x210d72=_0x210d72-0x0;var _0x4e1aad=_0x8559[_0x210d72];return _0x4e1aad;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x9855('0x0'),_0x9855('0x1'),_0x9855('0x2')];function createListener(_0x2ee6dc,_0x4fd834){return function(_0x2fccea){_0x4fd834['emit'](_0x2ee6dc,_0x2fccea);};}function removeListener(_0x17ed6b,_0x1ed268){return function(){SmsMessageEvents[_0x9855('0x3')](_0x17ed6b,_0x1ed268);};}exports[_0x9855('0x4')]=function(_0x49c7ad){for(var _0xed24d2=0x0,_0x1fb049=events[_0x9855('0x5')];_0xed24d2<_0x1fb049;_0xed24d2++){var _0x5ccb85=events[_0xed24d2];var _0x560b07=createListener(_0x9855('0x6')+_0x5ccb85,_0x49c7ad);SmsMessageEvents['on'](_0x5ccb85,_0x560b07);}}; \ No newline at end of file +var _0xafc2=['smsMessage:','./smsMessage.events','save','update','emit','removeListener','register','length'];(function(_0x5651ef,_0x4fd99a){var _0x392fba=function(_0x14c7dd){while(--_0x14c7dd){_0x5651ef['push'](_0x5651ef['shift']());}};_0x392fba(++_0x4fd99a);}(_0xafc2,0x1d9));var _0x2afc=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xafc2[_0x1facfa];return _0x9ec701;};'use strict';var SmsMessageEvents=require(_0x2afc('0x0'));var events=[_0x2afc('0x1'),'remove',_0x2afc('0x2')];function createListener(_0x282d25,_0xae9eb9){return function(_0x48782e){_0xae9eb9[_0x2afc('0x3')](_0x282d25,_0x48782e);};}function removeListener(_0x406811,_0x525e4c){return function(){SmsMessageEvents[_0x2afc('0x4')](_0x406811,_0x525e4c);};}exports[_0x2afc('0x5')]=function(_0x36c90a){for(var _0x59307b=0x0,_0x5ed165=events[_0x2afc('0x6')];_0x59307b<_0x5ed165;_0x59307b++){var _0x1cb860=events[_0x59307b];var _0x5320c7=createListener(_0x2afc('0x7')+_0x1cb860,_0x36c90a);SmsMessageEvents['on'](_0x1cb860,_0x5320c7);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index e9bed27..b125f8c 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 _0x1717=['create','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post'];(function(_0x153e94,_0x8fb2f6){var _0x36b6a7=function(_0x46fac9){while(--_0x46fac9){_0x153e94['push'](_0x153e94['shift']());}};_0x36b6a7(++_0x8fb2f6);}(_0x1717,0x75));var _0x7171=function(_0xf4666e,_0x571140){_0xf4666e=_0xf4666e-0x0;var _0x1853f1=_0x1717[_0xf4666e];return _0x1853f1;};'use strict';var multer=require(_0x7171('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7171('0x1'));var router=express[_0x7171('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x7171('0x3'));var interaction=require(_0x7171('0x4'));var config=require(_0x7171('0x5'));var controller=require('./smsQueue.controller');router[_0x7171('0x6')]('/',auth[_0x7171('0x7')](),controller['index']);router[_0x7171('0x6')](_0x7171('0x8'),auth[_0x7171('0x7')](),controller['describe']);router['get'](_0x7171('0x9'),auth[_0x7171('0x7')](),controller[_0x7171('0xa')]);router['get'](_0x7171('0xb'),auth[_0x7171('0x7')](),controller[_0x7171('0xc')]);router[_0x7171('0x6')](_0x7171('0xd'),auth[_0x7171('0x7')](),controller[_0x7171('0xe')]);router['get'](_0x7171('0xf'),auth[_0x7171('0x7')](),controller[_0x7171('0x10')]);router[_0x7171('0x11')]('/',auth[_0x7171('0x7')](),controller[_0x7171('0x12')]);router[_0x7171('0x11')](_0x7171('0xd'),auth[_0x7171('0x7')](),controller[_0x7171('0x13')]);router[_0x7171('0x11')](_0x7171('0xf'),auth[_0x7171('0x7')](),controller[_0x7171('0x14')]);router[_0x7171('0x15')](_0x7171('0x9'),auth[_0x7171('0x7')](),controller['update']);router[_0x7171('0x16')](_0x7171('0x9'),auth[_0x7171('0x7')](),controller[_0x7171('0x17')]);router[_0x7171('0x16')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7171('0x18')]);router['delete'](_0x7171('0xf'),auth[_0x7171('0x7')](),controller[_0x7171('0x19')]);module[_0x7171('0x1a')]=router; \ No newline at end of file +var _0x7daf=['/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','update','delete','removeTeams','removeAgents','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index'];(function(_0x349c20,_0x43850e){var _0x1fca2a=function(_0x3db1a3){while(--_0x3db1a3){_0x349c20['push'](_0x349c20['shift']());}};_0x1fca2a(++_0x43850e);}(_0x7daf,0x15b));var _0xf7da=function(_0x25a04e,_0x435456){_0x25a04e=_0x25a04e-0x0;var _0x195480=_0x7daf[_0x25a04e];return _0x195480;};'use strict';var multer=require('multer');var util=require(_0xf7da('0x0'));var path=require(_0xf7da('0x1'));var timeout=require(_0xf7da('0x2'));var express=require(_0xf7da('0x3'));var router=express[_0xf7da('0x4')]();var fs_extra=require(_0xf7da('0x5'));var auth=require(_0xf7da('0x6'));var interaction=require(_0xf7da('0x7'));var config=require(_0xf7da('0x8'));var controller=require(_0xf7da('0x9'));router[_0xf7da('0xa')]('/',auth[_0xf7da('0xb')](),controller[_0xf7da('0xc')]);router['get'](_0xf7da('0xd'),auth[_0xf7da('0xb')](),controller['describe']);router[_0xf7da('0xa')](_0xf7da('0xe'),auth[_0xf7da('0xb')](),controller[_0xf7da('0xf')]);router['get'](_0xf7da('0x10'),auth[_0xf7da('0xb')](),controller[_0xf7da('0x11')]);router['get'](_0xf7da('0x12'),auth['isAuthenticated'](),controller[_0xf7da('0x13')]);router[_0xf7da('0xa')](_0xf7da('0x14'),auth[_0xf7da('0xb')](),controller[_0xf7da('0x15')]);router[_0xf7da('0x16')]('/',auth[_0xf7da('0xb')](),controller[_0xf7da('0x17')]);router['post'](_0xf7da('0x12'),auth[_0xf7da('0xb')](),controller['addTeams']);router[_0xf7da('0x16')](_0xf7da('0x14'),auth[_0xf7da('0xb')](),controller[_0xf7da('0x18')]);router[_0xf7da('0x19')](_0xf7da('0xe'),auth[_0xf7da('0xb')](),controller[_0xf7da('0x1a')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xf7da('0x1b')](_0xf7da('0x12'),auth[_0xf7da('0xb')](),controller[_0xf7da('0x1c')]);router[_0xf7da('0x1b')](_0xf7da('0x14'),auth[_0xf7da('0xb')](),controller[_0xf7da('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 10f1cd2..34732e6 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 _0xd516=['INTEGER','ENUM','beepall','sequelize','exports','STRING'];(function(_0x235983,_0xd22673){var _0x538b67=function(_0x1f1546){while(--_0x1f1546){_0x235983['push'](_0x235983['shift']());}};_0x538b67(++_0xd22673);}(_0xd516,0x18f));var _0x6d51=function(_0x63848a,_0x3de459){_0x63848a=_0x63848a-0x0;var _0x3ad2fc=_0xd516[_0x63848a];return _0x3ad2fc;};'use strict';var Sequelize=require(_0x6d51('0x0'));module[_0x6d51('0x1')]={'name':{'type':Sequelize[_0x6d51('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6d51('0x2')]},'timeout':{'type':Sequelize[_0x6d51('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6d51('0x4')]('rrmemory',_0x6d51('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x9d93=['INTEGER','ENUM','rrmemory','roundrobin','exports','name','STRING'];(function(_0x2e57d1,_0x4fae3a){var _0x2bb271=function(_0x129321){while(--_0x129321){_0x2e57d1['push'](_0x2e57d1['shift']());}};_0x2bb271(++_0x4fae3a);}(_0x9d93,0x1e0));var _0x39d9=function(_0x9d6c46,_0x412f52){_0x9d6c46=_0x9d6c46-0x0;var _0x4a3250=_0x9d93[_0x9d6c46];return _0x4a3250;};'use strict';var Sequelize=require('sequelize');module[_0x39d9('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x39d9('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x39d9('0x2')]},'timeout':{'type':Sequelize[_0x39d9('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x39d9('0x4')](_0x39d9('0x5'),'beepall',_0x39d9('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index b5c355c..939fc6d 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 _0x5f66=['show','params','model','keys','intersection','attributes','fields','includeAll','merge','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','rawAttributes','filters','hasOwnProperty','order','sort','pick','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','length','filter','nolimit','ids','Team','Agents','interface','flatMap','sequelize','transaction','addTeams','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','includes','all','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','findOne','getAgents','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','./smsQueue.socket','register','end','json','offset','limit','undefined','count','status','update','then','UserProfileResource','destroy','sendStatus','stack','name','send','index','fieldName','key','getOptions','where','SmsQueue','include','query','findAll','catch'];(function(_0x3a9a6a,_0x51afcd){var _0xc860c8=function(_0x4578b6){while(--_0x4578b6){_0x3a9a6a['push'](_0x3a9a6a['shift']());}};_0xc860c8(++_0x51afcd);}(_0x5f66,0x1a0));var _0x65f6=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5f66[_0x13d07a];return _0x5ee0ee;};'use strict';var BPromise=require('bluebird');var util=require(_0x65f6('0x0'));var _=require('lodash');var squel=require(_0x65f6('0x1'));var Redis=require(_0x65f6('0x2'));var qs=require(_0x65f6('0x3'));var logger=require(_0x65f6('0x4'))(_0x65f6('0x5'));var config=require('../../config/environment');var db=require(_0x65f6('0x6'))['db'];config['redis']=_[_0x65f6('0x7')](config[_0x65f6('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65f6('0x8')]));require(_0x65f6('0x9'))[_0x65f6('0xa')](socket);function respondWithStatusCode(_0x8f6451,_0xc44c70){_0xc44c70=_0xc44c70||0xcc;return function(_0x14f4c7){if(_0x14f4c7){return _0x8f6451['sendStatus'](_0xc44c70);}return _0x8f6451['status'](_0xc44c70)[_0x65f6('0xb')]();};}function respondWithResult(_0x2f6d5b,_0x264647){_0x264647=_0x264647||0xc8;return function(_0x25c416){if(_0x25c416){return _0x2f6d5b['status'](_0x264647)[_0x65f6('0xc')](_0x25c416);}};}function respondWithFilteredResult(_0x571436,_0x497cf3){return function(_0x2d2dfa){if(_0x2d2dfa){var _0x576875=typeof _0x497cf3[_0x65f6('0xd')]==='undefined'&&typeof _0x497cf3[_0x65f6('0xe')]===_0x65f6('0xf');var _0x2c4ee5=_0x2d2dfa[_0x65f6('0x10')];var _0x369f96=_0x576875?0x0:_0x497cf3[_0x65f6('0xd')];var _0x44144b=_0x576875?_0x2d2dfa[_0x65f6('0x10')]:_0x497cf3[_0x65f6('0xd')]+_0x497cf3[_0x65f6('0xe')];var _0x59154e;if(_0x44144b>=_0x2c4ee5){_0x44144b=_0x2c4ee5;_0x59154e=0xc8;}else{_0x59154e=0xce;}_0x571436[_0x65f6('0x11')](_0x59154e);return _0x571436['set']('Content-Range',_0x369f96+'-'+_0x44144b+'/'+_0x2c4ee5)[_0x65f6('0xc')](_0x2d2dfa);}return null;};}function saveUpdates(_0x5c69f8){return function(_0x37330d){if(_0x37330d){return _0x37330d[_0x65f6('0x12')](_0x5c69f8)[_0x65f6('0x13')](function(_0x1f974c){return _0x1f974c;});}return null;};}function removeEntity(_0xc8660c){return function(_0x18380e){if(_0x18380e){return _0x18380e['destroy']()['then'](function(){var _0x2d538c=_0x18380e['get']({'plain':!![]});var _0x4c81f3='SmsQueues';return db[_0x65f6('0x14')][_0x65f6('0x15')]({'where':{'type':_0x4c81f3,'resourceId':_0x2d538c['id']}})['then'](function(){return _0x18380e;});})[_0x65f6('0x13')](function(){_0xc8660c[_0x65f6('0x11')](0xcc)[_0x65f6('0xb')]();});}};}function handleEntityNotFound(_0x3876ed){return function(_0x219ab2){if(!_0x219ab2){_0x3876ed[_0x65f6('0x16')](0x194);}return _0x219ab2;};}function handleError(_0x581374,_0x197a49){_0x197a49=_0x197a49||0x1f4;return function(_0x4bb39e){logger['error'](_0x4bb39e[_0x65f6('0x17')]);if(_0x4bb39e[_0x65f6('0x18')]){delete _0x4bb39e['name'];}_0x581374[_0x65f6('0x11')](_0x197a49)[_0x65f6('0x19')](_0x4bb39e);};}exports[_0x65f6('0x1a')]=function(_0x2774a1,_0x4f5a69){var _0x9d7bb0={};var _0x59ea32={'count':0x0,'rows':[]};var _0x20a161=_['map'](db['SmsQueue']['rawAttributes'],function(_0x29abdb){return{'name':_0x29abdb[_0x65f6('0x1b')],'type':_0x29abdb['type'][_0x65f6('0x1c')]};});_0x9d7bb0=qs[_0x65f6('0x1d')](_0x20a161,_0x2774a1);var _0x52277c={'where':_0x9d7bb0[_0x65f6('0x1e')]};return db[_0x65f6('0x1f')][_0x65f6('0x10')](_0x52277c)['then'](function(_0x4ac04b){_0x59ea32['count']=_0x4ac04b;_0x9d7bb0[_0x65f6('0x20')]=qs[_0x65f6('0x20')](_0x2774a1[_0x65f6('0x21')]);return db[_0x65f6('0x1f')][_0x65f6('0x22')](_0x9d7bb0);})[_0x65f6('0x13')](function(_0x144e55){_0x59ea32['rows']=_0x144e55;return _0x59ea32;})['then'](respondWithFilteredResult(_0x4f5a69,_0x9d7bb0))[_0x65f6('0x23')](handleError(_0x4f5a69,null));};exports[_0x65f6('0x24')]=function(_0x5878bc,_0x4e50c0){var _0x10b368={'raw':!![],'where':{'id':_0x5878bc[_0x65f6('0x25')]['id']}},_0x1ce43c={};_0x1ce43c[_0x65f6('0x26')]=_[_0x65f6('0x27')](db[_0x65f6('0x1f')]['rawAttributes']);_0x1ce43c[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x5878bc[_0x65f6('0x21')]);_0x1ce43c['filters']=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],_0x1ce43c[_0x65f6('0x21')]);_0x10b368[_0x65f6('0x29')]=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],qs['fields'](_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x10b368['attributes']=_0x10b368[_0x65f6('0x29')]['length']?_0x10b368[_0x65f6('0x29')]:_0x1ce43c['model'];if(_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2b')]){_0x10b368['include']=[{'all':!![]}];}_0x10b368=_[_0x65f6('0x2c')]({},_0x10b368,_0x5878bc[_0x65f6('0x2d')]);return db[_0x65f6('0x1f')]['find'](_0x10b368)['then'](handleEntityNotFound(_0x4e50c0,null))[_0x65f6('0x13')](respondWithResult(_0x4e50c0,null))['catch'](handleError(_0x4e50c0,null));};exports[_0x65f6('0x2e')]=function(_0x4e6653,_0x22d760){return db[_0x65f6('0x1f')]['create'](_0x4e6653[_0x65f6('0x2f')],{})['then'](function(_0x5edd04){var _0x71b16b=_0x4e6653[_0x65f6('0x30')][_0x65f6('0x31')]({'plain':!![]});if(!_0x71b16b)throw new Error(_0x65f6('0x32'));if(_0x71b16b[_0x65f6('0x33')]===_0x65f6('0x30')){var _0x1a55da=_0x5edd04[_0x65f6('0x31')]({'plain':!![]});var _0x4f933b=_0x65f6('0x34');return db['UserProfileSection'][_0x65f6('0x35')]({'where':{'name':_0x4f933b,'userProfileId':_0x71b16b[_0x65f6('0x36')]},'raw':!![]})[_0x65f6('0x13')](function(_0x2ea7f7){if(_0x2ea7f7&&_0x2ea7f7['autoAssociation']===0x0){return db[_0x65f6('0x14')][_0x65f6('0x2e')]({'name':_0x1a55da[_0x65f6('0x18')],'resourceId':_0x1a55da['id'],'type':_0x2ea7f7[_0x65f6('0x18')],'sectionId':_0x2ea7f7['id']},{})[_0x65f6('0x13')](function(){return _0x5edd04;});}else{return _0x5edd04;}})[_0x65f6('0x23')](function(_0xed4c96){logger[_0x65f6('0x37')](_0x65f6('0x38'),_0xed4c96);throw _0xed4c96;});}return _0x5edd04;})['then'](respondWithResult(_0x22d760,0xc9))[_0x65f6('0x23')](handleError(_0x22d760,null));};exports[_0x65f6('0x12')]=function(_0x377ae5,_0x181798){if(_0x377ae5[_0x65f6('0x2f')]['id']){delete _0x377ae5[_0x65f6('0x2f')]['id'];}return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x377ae5[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x181798,null))[_0x65f6('0x13')](saveUpdates(_0x377ae5[_0x65f6('0x2f')],null))[_0x65f6('0x13')](respondWithResult(_0x181798,null))[_0x65f6('0x23')](handleError(_0x181798,null));};exports[_0x65f6('0x15')]=function(_0x2cb38d,_0x5119ee){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x2cb38d[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x5119ee,null))['then'](removeEntity(_0x5119ee,null))[_0x65f6('0x23')](handleError(_0x5119ee,null));};exports[_0x65f6('0x39')]=function(_0x2b01eb,_0x5e69b4){return db[_0x65f6('0x1f')][_0x65f6('0x39')]()[_0x65f6('0x13')](respondWithResult(_0x5e69b4,null))[_0x65f6('0x23')](handleError(_0x5e69b4,null));};exports['getMembers']=function(_0x2ec114,_0x512527){var _0x3f1baa={'raw':!![],'where':{}},_0x6968b={},_0x577c93;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x2ec114[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x512527,null))[_0x65f6('0x13')](function(_0xc0db01){if(_0xc0db01){_0x577c93=_0xc0db01[_0x65f6('0x31')]({'plain':!![]});_0x6968b[_0x65f6('0x26')]=_['keys'](db['UserSmsQueue'][_0x65f6('0x3a')]);_0x6968b[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x2ec114[_0x65f6('0x21')]);_0x6968b[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x6968b[_0x65f6('0x26')],_0x6968b[_0x65f6('0x21')]);_0x3f1baa[_0x65f6('0x29')]=_['intersection'](_0x6968b[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x2ec114[_0x65f6('0x21')]['fields']));_0x3f1baa[_0x65f6('0x29')]=_0x3f1baa[_0x65f6('0x29')]['length']?_0x3f1baa[_0x65f6('0x29')]:_0x6968b[_0x65f6('0x26')];if(!_0x2ec114['query'][_0x65f6('0x3c')]('nolimit')){_0x3f1baa[_0x65f6('0xe')]=qs[_0x65f6('0xe')](_0x2ec114[_0x65f6('0x21')]['limit']);_0x3f1baa[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x2ec114['query'][_0x65f6('0xd')]);}_0x3f1baa[_0x65f6('0x3d')]=qs['sort'](_0x2ec114[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x3f1baa[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x2ec114[_0x65f6('0x21')],_0x6968b[_0x65f6('0x3b')]));_0x3f1baa[_0x65f6('0x1e')]['SmsQueueId']=_0xc0db01['id'];if(_0x2ec114['query']['filter']){_0x3f1baa[_0x65f6('0x1e')]=_[_0x65f6('0x2c')](_0x3f1baa[_0x65f6('0x1e')],{'$or':_[_0x65f6('0x40')](_0x3f1baa['attributes'],function(_0x183c08){var _0x2032b9={};_0x2032b9[_0x183c08]={'$like':'%'+_0x2ec114[_0x65f6('0x21')]['filter']+'%'};return _0x2032b9;})});}_0x3f1baa=_[_0x65f6('0x2c')]({},_0x3f1baa,_0x2ec114[_0x65f6('0x2d')]);return db[_0x65f6('0x41')]['findAll'](_0x3f1baa);}})['then'](function(_0x1d337d){if(_0x1d337d){return db[_0x65f6('0x42')][_0x65f6('0x43')]({'where':{'id':_[_0x65f6('0x40')](_0x1d337d,_0x65f6('0x44')),'role':_0x65f6('0x45')},'attributes':['id',_0x65f6('0x18'),_0x65f6('0x46'),_0x65f6('0x47'),_0x65f6('0x48')]});}})[_0x65f6('0x13')](function(_0x141fcc){if(_0x141fcc){return{'count':_0x141fcc[_0x65f6('0x10')],'rows':_[_0x65f6('0x40')](_0x141fcc['rows'],function(_0x47610a){return{'membername':_0x47610a[_0x65f6('0x18')],'UserId':_0x47610a['id'],'queue_name':_0x577c93[_0x65f6('0x18')],'SmsQueueId':_0x577c93['id'],'interface':util['format'](_0x65f6('0x49'),_0x65f6('0x4a'),_0x47610a[_0x65f6('0x18')]),'penalty':0x0,'paused':_0x47610a[_0x65f6('0x46')],'createdAt':_0x47610a['createdAt'],'updatedAt':_0x47610a[_0x65f6('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x65f6('0x13')](respondWithFilteredResult(_0x512527,_0x3f1baa))[_0x65f6('0x23')](handleError(_0x512527,null));};exports[_0x65f6('0x4b')]=function(_0x553ff0,_0x2923ff){var _0x2fc20f={};var _0x5c55e4={};var _0x28682b;var _0x26481e;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x553ff0[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x2923ff,null))[_0x65f6('0x13')](function(_0x3c23e3){if(_0x3c23e3){_0x28682b=_0x3c23e3;_0x5c55e4[_0x65f6('0x26')]=_[_0x65f6('0x27')](db['Team']['rawAttributes']);_0x5c55e4['query']=_[_0x65f6('0x27')](_0x553ff0[_0x65f6('0x21')]);_0x5c55e4[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],_0x5c55e4[_0x65f6('0x21')]);_0x2fc20f['attributes']=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],qs['fields'](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x2fc20f[_0x65f6('0x29')]=_0x2fc20f['attributes'][_0x65f6('0x4c')]?_0x2fc20f[_0x65f6('0x29')]:_0x5c55e4['model'];_0x2fc20f[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x2fc20f[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x553ff0['query'],_0x5c55e4['filters']));if(_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x2fc20f['where']=_[_0x65f6('0x2c')](_0x2fc20f['where'],{'$or':_[_0x65f6('0x40')](_0x2fc20f['attributes'],function(_0x440df1){var _0xdc8989={};_0xdc8989[_0x440df1]={'$like':'%'+_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0xdc8989;})});}_0x2fc20f=_[_0x65f6('0x2c')]({},_0x2fc20f,_0x553ff0[_0x65f6('0x2d')]);return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})[_0x65f6('0x13')](function(_0x2405a7){if(_0x2405a7){_0x26481e=_0x2405a7['length'];if(!_0x553ff0['query'][_0x65f6('0x3c')](_0x65f6('0x4e'))){_0x2fc20f[_0x65f6('0xe')]=qs['limit'](_0x553ff0['query'][_0x65f6('0xe')]);_0x2fc20f[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0xd')]);}return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})['then'](function(_0x4f42ae){if(_0x4f42ae){return _0x4f42ae?{'count':_0x26481e,'rows':_0x4f42ae}:null;}})[_0x65f6('0x13')](respondWithResult(_0x2923ff,null))[_0x65f6('0x23')](handleError(_0x2923ff,null));};exports['addTeams']=function(_0x219bf8,_0x4a8b60){var _0x254e9f=_0x219bf8[_0x65f6('0x2f')][_0x65f6('0x4f')];return db[_0x65f6('0x50')]['findAll']({'where':{'id':_0x254e9f},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id',_0x65f6('0x18'),'online','voicePause',_0x65f6('0x52')],'raw':!![]}]})['then'](function(_0x305967){if(_0x305967){var _0xf6de=_[_0x65f6('0x53')](_0x305967,function(_0x354b90){var _0x512776=_0x354b90['get']({'plain':!![]});return _0x512776['Agents'];});return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x219bf8[_0x65f6('0x25')]['id']}})['then'](function(_0x46cbde){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x49cee2){return _0x46cbde[_0x65f6('0x56')](_0x254e9f,{'transaction':_0x49cee2})[_0x65f6('0x13')](function(){return BPromise['each'](_0xf6de,function(_0x758e80){return db[_0x65f6('0x41')]['findOrCreate']({'where':{'UserId':_0x758e80['id'],'SmsQueueId':_0x219bf8[_0x65f6('0x25')]['id']},'transaction':_0x49cee2});});})['then'](function(){_0xf6de[_0x65f6('0x57')](function(_0x55ea91){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':_0x55ea91['id'],'SmsQueueId':_0x46cbde['id']});});});});});}})['then'](respondWithStatusCode(_0x4a8b60,null))[_0x65f6('0x23')](handleError(_0x4a8b60,null));};exports[_0x65f6('0x5a')]=function(_0x2a700b,_0x299b85){return db[_0x65f6('0x50')][_0x65f6('0x22')]({'where':{'id':_0x2a700b[_0x65f6('0x21')][_0x65f6('0x4f')]},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id'],'raw':!![]}]})[_0x65f6('0x13')](handleEntityNotFound(_0x299b85,null))['then'](function(_0x10a661){var _0x1cf1bd=_[_0x65f6('0x40')](_0x10a661,'id');var _0x219e42=[];var _0x5694f9=[];var _0x453080=squel[_0x65f6('0x5b')]();_0x453080['field'](_0x65f6('0x5c'))['from'](_0x65f6('0x5d'),'tq')['join'](_0x65f6('0x5e'),'ut',_0x65f6('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x2a700b[_0x65f6('0x25')]['id']);for(var _0x413c21=0x0;_0x413c21<_0x10a661['length'];_0x413c21+=0x1){let _0x2d86c8=_0x10a661[_0x413c21];for(var _0x3b3bd5=0x0;_0x3b3bd5<_0x2d86c8[_0x65f6('0x51')]['length'];_0x3b3bd5+=0x1){let _0x1348ec=_0x2d86c8[_0x65f6('0x51')][_0x3b3bd5];var _0x5889dc=_0x453080[_0x65f6('0x60')]();_0x5889dc['where'](_0x65f6('0x61'),_0x1348ec['id']);_0x5694f9['push'](db['sequelize'][_0x65f6('0x21')](_0x5889dc[_0x65f6('0x62')](),{'type':db[_0x65f6('0x54')][_0x65f6('0x63')][_0x65f6('0x64')]})[_0x65f6('0x13')](function(_0x1ac46f){if(_0x1ac46f[_0x65f6('0x4c')]===0x1){return _0x1348ec['id'];}else{var _0x4d66fe=_['every'](_[_0x65f6('0x40')](_0x1ac46f,'TeamId'),function(_0x1ee28a){return _[_0x65f6('0x65')](_0x1cf1bd,_0x1ee28a);});if(_0x4d66fe){return _0x1348ec['id'];}}}));}}return BPromise[_0x65f6('0x66')](_0x5694f9)[_0x65f6('0x13')](function(_0x43127b){_0x219e42=_(_0x219e42)['union'](_0x43127b)[_0x65f6('0x67')]()[_0x65f6('0x68')]();return db[_0x65f6('0x1f')]['find']({'where':{'id':_0x2a700b[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](function(_0x4254c2){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x16bf93){return _0x4254c2['removeTeams'](_0x2a700b['query'][_0x65f6('0x4f')],{'transaction':_0x16bf93})[_0x65f6('0x13')](function(){if(!_[_0x65f6('0x69')](_0x219e42)){return _0x4254c2[_0x65f6('0x6a')](_0x219e42,{'transaction':_0x16bf93});}})['then'](function(){_0x219e42['forEach'](function(_0x336076){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':_0x336076,'SmsQueueId':_0x4254c2['id']});});});});});});})[_0x65f6('0x13')](respondWithStatusCode(_0x299b85,null))[_0x65f6('0x23')](handleError(_0x299b85,null));};exports[_0x65f6('0x6c')]=function(_0x5daaf4,_0x4d607a){return db['SmsQueue'][_0x65f6('0x35')]({'where':{'id':_0x5daaf4[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x4d607a,null))[_0x65f6('0x13')](function(_0x53b11c){if(_0x53b11c){return _0x53b11c['addAgents'](_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')],_['omit'](_0x5daaf4[_0x65f6('0x2f')],['ids','id'])||{})[_0x65f6('0x6d')](function(_0x4f3ef8){for(var _0x3a30ed=0x0;_0x3a30ed<_0x5daaf4[_0x65f6('0x2f')]['ids'][_0x65f6('0x4c')];_0x3a30ed+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':Number(_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')][_0x3a30ed]),'SmsQueueId':Number(_0x5daaf4[_0x65f6('0x25')]['id'])});}return _0x4f3ef8;});}})['then'](respondWithResult(_0x4d607a,null))[_0x65f6('0x23')](handleError(_0x4d607a,null));};exports['removeAgents']=function(_0x24495c,_0x56336a){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x24495c[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x56336a,null))['then'](function(_0x2b6f98){if(_0x2b6f98){return _0x2b6f98[_0x65f6('0x6a')](_0x24495c[_0x65f6('0x21')]['ids'])['then'](function(){if(_[_0x65f6('0x6e')](_0x24495c[_0x65f6('0x21')]['ids'])){for(var _0x180cde=0x0;_0x180cde<_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]['length'];_0x180cde+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':Number(_0x24495c['query'][_0x65f6('0x4f')][_0x180cde]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}}else{socket[_0x65f6('0x58')]('userSmsQueue:remove',{'UserId':Number(_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}});}})['then'](respondWithStatusCode(_0x56336a,null))[_0x65f6('0x23')](handleError(_0x56336a,null));};exports['getAgents']=function(_0x1beaa7,_0x87a9e4){var _0x31ec61={};var _0x22be6e={};var _0x29b2de;var _0x430fb8;return db['SmsQueue'][_0x65f6('0x6f')]({'where':{'id':_0x1beaa7[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x87a9e4,null))[_0x65f6('0x13')](function(_0x207d15){if(_0x207d15){_0x29b2de=_0x207d15;_0x22be6e['model']=_['keys'](db['User'][_0x65f6('0x3a')]);_0x22be6e[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x1beaa7['query']);_0x22be6e[_0x65f6('0x3b')]=_['intersection'](_0x22be6e['model'],_0x22be6e[_0x65f6('0x21')]);_0x31ec61[_0x65f6('0x29')]=_['intersection'](_0x22be6e[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x31ec61[_0x65f6('0x29')]=_0x31ec61[_0x65f6('0x29')][_0x65f6('0x4c')]?_0x31ec61[_0x65f6('0x29')]:_0x22be6e[_0x65f6('0x26')];_0x31ec61[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x1beaa7[_0x65f6('0x21')]['sort']);_0x31ec61[_0x65f6('0x1e')]=qs['filters'](_['pick'](_0x1beaa7[_0x65f6('0x21')],_0x22be6e[_0x65f6('0x3b')]));if(_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x31ec61['where']=_[_0x65f6('0x2c')](_0x31ec61['where'],{'$or':_['map'](_0x31ec61[_0x65f6('0x29')],function(_0x99fe6e){var _0x1a7e52={};_0x1a7e52[_0x99fe6e]={'$like':'%'+_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0x1a7e52;})});}_0x31ec61=_[_0x65f6('0x2c')]({},_0x31ec61,_0x1beaa7['options']);return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})['then'](function(_0x1ef2a0){if(_0x1ef2a0){_0x430fb8=_0x1ef2a0[_0x65f6('0x4c')];if(!_0x1beaa7[_0x65f6('0x21')]['hasOwnProperty'](_0x65f6('0x4e'))){_0x31ec61['limit']=qs['limit'](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0xe')]);_0x31ec61[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x1beaa7[_0x65f6('0x21')]['offset']);}return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})[_0x65f6('0x13')](function(_0x3bebe3){if(_0x3bebe3){return _0x3bebe3?{'count':_0x430fb8,'rows':_0x3bebe3}:null;}})[_0x65f6('0x13')](respondWithResult(_0x87a9e4,null))['catch'](handleError(_0x87a9e4,null));}; \ No newline at end of file +var _0x7a54=['transaction','addTeams','each','findOrCreate','userSmsQueue:save','removeTeams','Team','select','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','QueryTypes','SELECT','every','includes','all','compact','isEmpty','forEach','userSmsQueue:remove','addAgents','omit','emit','removeAgents','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','status','end','json','offset','undefined','count','set','Content-Range','update','destroy','then','get','SmsQueues','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','SmsQueue','include','rows','catch','show','params','model','query','intersection','fields','attributes','includeAll','merge','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','limit','order','sort','filters','pick','filter','User','UserId','createdAt','format','%s/%s','smsPause','getTeams','keys','nolimit','ids','findAll','Agents','online','voicePause','interface','flatMap','sequelize'];(function(_0x6cc929,_0x4aa47a){var _0x596529=function(_0x350aca){while(--_0x350aca){_0x6cc929['push'](_0x6cc929['shift']());}};_0x596529(++_0x4aa47a);}(_0x7a54,0x106));var _0x47a5=function(_0x19eb61,_0x37c430){_0x19eb61=_0x19eb61-0x0;var _0x460c4c=_0x7a54[_0x19eb61];return _0x460c4c;};'use strict';var BPromise=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var squel=require('squel');var Redis=require(_0x47a5('0x3'));var qs=require(_0x47a5('0x4'));var logger=require('../../config/logger')(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var db=require(_0x47a5('0x7'))['db'];config[_0x47a5('0x8')]=_[_0x47a5('0x9')](config['redis'],{'host':_0x47a5('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a5('0x8')]));require(_0x47a5('0xb'))['register'](socket);function respondWithStatusCode(_0x194fb0,_0x5077f3){_0x5077f3=_0x5077f3||0xcc;return function(_0x5d90b3){if(_0x5d90b3){return _0x194fb0['sendStatus'](_0x5077f3);}return _0x194fb0[_0x47a5('0xc')](_0x5077f3)[_0x47a5('0xd')]();};}function respondWithResult(_0x5e31dd,_0x2eb0dd){_0x2eb0dd=_0x2eb0dd||0xc8;return function(_0x49e844){if(_0x49e844){return _0x5e31dd['status'](_0x2eb0dd)[_0x47a5('0xe')](_0x49e844);}};}function respondWithFilteredResult(_0x69e4d4,_0x2f399b){return function(_0x250fad){if(_0x250fad){var _0xd612dd=typeof _0x2f399b[_0x47a5('0xf')]===_0x47a5('0x10')&&typeof _0x2f399b['limit']===_0x47a5('0x10');var _0x221b54=_0x250fad[_0x47a5('0x11')];var _0x711793=_0xd612dd?0x0:_0x2f399b[_0x47a5('0xf')];var _0x620ee9=_0xd612dd?_0x250fad[_0x47a5('0x11')]:_0x2f399b[_0x47a5('0xf')]+_0x2f399b['limit'];var _0x362359;if(_0x620ee9>=_0x221b54){_0x620ee9=_0x221b54;_0x362359=0xc8;}else{_0x362359=0xce;}_0x69e4d4[_0x47a5('0xc')](_0x362359);return _0x69e4d4[_0x47a5('0x12')](_0x47a5('0x13'),_0x711793+'-'+_0x620ee9+'/'+_0x221b54)[_0x47a5('0xe')](_0x250fad);}return null;};}function saveUpdates(_0x574af6){return function(_0x549de3){if(_0x549de3){return _0x549de3[_0x47a5('0x14')](_0x574af6)['then'](function(_0x5247fd){return _0x5247fd;});}return null;};}function removeEntity(_0x423a81){return function(_0xaf70a6){if(_0xaf70a6){return _0xaf70a6[_0x47a5('0x15')]()[_0x47a5('0x16')](function(){var _0x477b1d=_0xaf70a6[_0x47a5('0x17')]({'plain':!![]});var _0x2763d6=_0x47a5('0x18');return db[_0x47a5('0x19')]['destroy']({'where':{'type':_0x2763d6,'resourceId':_0x477b1d['id']}})[_0x47a5('0x16')](function(){return _0xaf70a6;});})[_0x47a5('0x16')](function(){_0x423a81['status'](0xcc)[_0x47a5('0xd')]();});}};}function handleEntityNotFound(_0x1f03f7){return function(_0x36874d){if(!_0x36874d){_0x1f03f7['sendStatus'](0x194);}return _0x36874d;};}function handleError(_0xb8ae6c,_0x2f142b){_0x2f142b=_0x2f142b||0x1f4;return function(_0x23db32){logger[_0x47a5('0x1a')](_0x23db32['stack']);if(_0x23db32[_0x47a5('0x1b')]){delete _0x23db32[_0x47a5('0x1b')];}_0xb8ae6c['status'](_0x2f142b)[_0x47a5('0x1c')](_0x23db32);};}exports[_0x47a5('0x1d')]=function(_0x4437f1,_0x129ce5){var _0x3abd6a={};var _0x50bf17={'count':0x0,'rows':[]};var _0x53078a=_[_0x47a5('0x1e')](db['SmsQueue'][_0x47a5('0x1f')],function(_0x5b6c4e){return{'name':_0x5b6c4e[_0x47a5('0x20')],'type':_0x5b6c4e[_0x47a5('0x21')][_0x47a5('0x22')]};});_0x3abd6a=qs[_0x47a5('0x23')](_0x53078a,_0x4437f1);var _0x21f296={'where':_0x3abd6a[_0x47a5('0x24')]};return db[_0x47a5('0x25')][_0x47a5('0x11')](_0x21f296)[_0x47a5('0x16')](function(_0x361bfa){_0x50bf17[_0x47a5('0x11')]=_0x361bfa;_0x3abd6a[_0x47a5('0x26')]=qs[_0x47a5('0x26')](_0x4437f1['query']);return db[_0x47a5('0x25')]['findAll'](_0x3abd6a);})[_0x47a5('0x16')](function(_0x9ac908){_0x50bf17[_0x47a5('0x27')]=_0x9ac908;return _0x50bf17;})['then'](respondWithFilteredResult(_0x129ce5,_0x3abd6a))[_0x47a5('0x28')](handleError(_0x129ce5,null));};exports[_0x47a5('0x29')]=function(_0x39b50b,_0x1f1c68){var _0x51cc81={'raw':!![],'where':{'id':_0x39b50b[_0x47a5('0x2a')]['id']}},_0x50d875={};_0x50d875[_0x47a5('0x2b')]=_['keys'](db['SmsQueue'][_0x47a5('0x1f')]);_0x50d875[_0x47a5('0x2c')]=_['keys'](_0x39b50b[_0x47a5('0x2c')]);_0x50d875['filters']=_[_0x47a5('0x2d')](_0x50d875[_0x47a5('0x2b')],_0x50d875['query']);_0x51cc81['attributes']=_[_0x47a5('0x2d')](_0x50d875['model'],qs[_0x47a5('0x2e')](_0x39b50b[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x51cc81['attributes']=_0x51cc81[_0x47a5('0x2f')]['length']?_0x51cc81['attributes']:_0x50d875[_0x47a5('0x2b')];if(_0x39b50b['query'][_0x47a5('0x30')]){_0x51cc81['include']=[{'all':!![]}];}_0x51cc81=_[_0x47a5('0x31')]({},_0x51cc81,_0x39b50b[_0x47a5('0x32')]);return db[_0x47a5('0x25')][_0x47a5('0x33')](_0x51cc81)[_0x47a5('0x16')](handleEntityNotFound(_0x1f1c68,null))[_0x47a5('0x16')](respondWithResult(_0x1f1c68,null))[_0x47a5('0x28')](handleError(_0x1f1c68,null));};exports[_0x47a5('0x34')]=function(_0x1a0d23,_0x4caed5){return db[_0x47a5('0x25')][_0x47a5('0x34')](_0x1a0d23['body'],{})[_0x47a5('0x16')](function(_0x2bf53d){var _0x1d4348=_0x1a0d23['user'][_0x47a5('0x17')]({'plain':!![]});if(!_0x1d4348)throw new Error(_0x47a5('0x35'));if(_0x1d4348['role']===_0x47a5('0x36')){var _0x19218a=_0x2bf53d['get']({'plain':!![]});var _0x55c5eb='SmsQueues';return db[_0x47a5('0x37')]['find']({'where':{'name':_0x55c5eb,'userProfileId':_0x1d4348[_0x47a5('0x38')]},'raw':!![]})[_0x47a5('0x16')](function(_0x301a85){if(_0x301a85&&_0x301a85[_0x47a5('0x39')]===0x0){return db[_0x47a5('0x19')][_0x47a5('0x34')]({'name':_0x19218a[_0x47a5('0x1b')],'resourceId':_0x19218a['id'],'type':_0x301a85[_0x47a5('0x1b')],'sectionId':_0x301a85['id']},{})[_0x47a5('0x16')](function(){return _0x2bf53d;});}else{return _0x2bf53d;}})[_0x47a5('0x28')](function(_0x280500){logger[_0x47a5('0x1a')](_0x47a5('0x3a'),_0x280500);throw _0x280500;});}return _0x2bf53d;})['then'](respondWithResult(_0x4caed5,0xc9))[_0x47a5('0x28')](handleError(_0x4caed5,null));};exports[_0x47a5('0x14')]=function(_0x331474,_0x23bd8d){if(_0x331474['body']['id']){delete _0x331474[_0x47a5('0x3b')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x331474['params']['id']}})['then'](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x16')](saveUpdates(_0x331474['body'],null))[_0x47a5('0x16')](respondWithResult(_0x23bd8d,null))[_0x47a5('0x28')](handleError(_0x23bd8d,null));};exports[_0x47a5('0x15')]=function(_0x494526,_0x3805fd){return db[_0x47a5('0x25')]['find']({'where':{'id':_0x494526['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3805fd,null))['then'](removeEntity(_0x3805fd,null))[_0x47a5('0x28')](handleError(_0x3805fd,null));};exports[_0x47a5('0x3c')]=function(_0x188614,_0xd75ca3){return db[_0x47a5('0x25')][_0x47a5('0x3c')]()[_0x47a5('0x16')](respondWithResult(_0xd75ca3,null))[_0x47a5('0x28')](handleError(_0xd75ca3,null));};exports[_0x47a5('0x3d')]=function(_0x162fa0,_0x24ecb1){var _0x3c3ebf={'raw':!![],'where':{}},_0xe28d76={},_0x3574d4;return db[_0x47a5('0x25')][_0x47a5('0x3e')]({'where':{'id':_0x162fa0['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x24ecb1,null))[_0x47a5('0x16')](function(_0x49eab1){if(_0x49eab1){_0x3574d4=_0x49eab1['get']({'plain':!![]});_0xe28d76[_0x47a5('0x2b')]=_['keys'](db[_0x47a5('0x3f')][_0x47a5('0x1f')]);_0xe28d76['query']=_['keys'](_0x162fa0[_0x47a5('0x2c')]);_0xe28d76['filters']=_[_0x47a5('0x2d')](_0xe28d76[_0x47a5('0x2b')],_0xe28d76[_0x47a5('0x2c')]);_0x3c3ebf[_0x47a5('0x2f')]=_[_0x47a5('0x2d')](_0xe28d76[_0x47a5('0x2b')],qs[_0x47a5('0x2e')](_0x162fa0['query']['fields']));_0x3c3ebf[_0x47a5('0x2f')]=_0x3c3ebf[_0x47a5('0x2f')][_0x47a5('0x40')]?_0x3c3ebf[_0x47a5('0x2f')]:_0xe28d76[_0x47a5('0x2b')];if(!_0x162fa0[_0x47a5('0x2c')][_0x47a5('0x41')]('nolimit')){_0x3c3ebf[_0x47a5('0x42')]=qs[_0x47a5('0x42')](_0x162fa0[_0x47a5('0x2c')]['limit']);_0x3c3ebf[_0x47a5('0xf')]=qs['offset'](_0x162fa0[_0x47a5('0x2c')][_0x47a5('0xf')]);}_0x3c3ebf[_0x47a5('0x43')]=qs[_0x47a5('0x44')](_0x162fa0['query'][_0x47a5('0x44')]);_0x3c3ebf[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_[_0x47a5('0x46')](_0x162fa0[_0x47a5('0x2c')],_0xe28d76[_0x47a5('0x45')]));_0x3c3ebf[_0x47a5('0x24')]['SmsQueueId']=_0x49eab1['id'];if(_0x162fa0[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x3c3ebf[_0x47a5('0x24')]=_[_0x47a5('0x31')](_0x3c3ebf[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x3c3ebf['attributes'],function(_0x1ad6a9){var _0x245a15={};_0x245a15[_0x1ad6a9]={'$like':'%'+_0x162fa0[_0x47a5('0x2c')]['filter']+'%'};return _0x245a15;})});}_0x3c3ebf=_[_0x47a5('0x31')]({},_0x3c3ebf,_0x162fa0[_0x47a5('0x32')]);return db[_0x47a5('0x3f')]['findAll'](_0x3c3ebf);}})['then'](function(_0x274e38){if(_0x274e38){return db[_0x47a5('0x48')]['findAndCountAll']({'where':{'id':_['map'](_0x274e38,_0x47a5('0x49')),'role':'agent'},'attributes':['id',_0x47a5('0x1b'),'smsPause','updatedAt',_0x47a5('0x4a')]});}})[_0x47a5('0x16')](function(_0x53eedf){if(_0x53eedf){return{'count':_0x53eedf[_0x47a5('0x11')],'rows':_[_0x47a5('0x1e')](_0x53eedf['rows'],function(_0x5b6127){return{'membername':_0x5b6127[_0x47a5('0x1b')],'UserId':_0x5b6127['id'],'queue_name':_0x3574d4[_0x47a5('0x1b')],'SmsQueueId':_0x3574d4['id'],'interface':util[_0x47a5('0x4b')](_0x47a5('0x4c'),'SIP',_0x5b6127[_0x47a5('0x1b')]),'penalty':0x0,'paused':_0x5b6127[_0x47a5('0x4d')],'createdAt':_0x5b6127[_0x47a5('0x4a')],'updatedAt':_0x5b6127['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x47a5('0x16')](respondWithFilteredResult(_0x24ecb1,_0x3c3ebf))['catch'](handleError(_0x24ecb1,null));};exports[_0x47a5('0x4e')]=function(_0x470da6,_0x943a15){var _0x1c485b={};var _0x3603b7={};var _0x4966af;var _0x144af9;return db['SmsQueue']['findOne']({'where':{'id':_0x470da6['params']['id']}})['then'](handleEntityNotFound(_0x943a15,null))[_0x47a5('0x16')](function(_0x6cd4ea){if(_0x6cd4ea){_0x4966af=_0x6cd4ea;_0x3603b7[_0x47a5('0x2b')]=_['keys'](db['Team'][_0x47a5('0x1f')]);_0x3603b7[_0x47a5('0x2c')]=_[_0x47a5('0x4f')](_0x470da6[_0x47a5('0x2c')]);_0x3603b7[_0x47a5('0x45')]=_['intersection'](_0x3603b7[_0x47a5('0x2b')],_0x3603b7['query']);_0x1c485b[_0x47a5('0x2f')]=_[_0x47a5('0x2d')](_0x3603b7['model'],qs[_0x47a5('0x2e')](_0x470da6[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x1c485b[_0x47a5('0x2f')]=_0x1c485b[_0x47a5('0x2f')][_0x47a5('0x40')]?_0x1c485b[_0x47a5('0x2f')]:_0x3603b7[_0x47a5('0x2b')];_0x1c485b['order']=qs[_0x47a5('0x44')](_0x470da6[_0x47a5('0x2c')][_0x47a5('0x44')]);_0x1c485b[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_['pick'](_0x470da6[_0x47a5('0x2c')],_0x3603b7[_0x47a5('0x45')]));if(_0x470da6[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x1c485b[_0x47a5('0x24')]=_[_0x47a5('0x31')](_0x1c485b[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x1c485b[_0x47a5('0x2f')],function(_0x44cb90){var _0x1d56f3={};_0x1d56f3[_0x44cb90]={'$like':'%'+_0x470da6[_0x47a5('0x2c')][_0x47a5('0x47')]+'%'};return _0x1d56f3;})});}_0x1c485b=_[_0x47a5('0x31')]({},_0x1c485b,_0x470da6[_0x47a5('0x32')]);return _0x4966af['getTeams'](_0x1c485b);}})[_0x47a5('0x16')](function(_0x284fb8){if(_0x284fb8){_0x144af9=_0x284fb8[_0x47a5('0x40')];if(!_0x470da6['query'][_0x47a5('0x41')](_0x47a5('0x50'))){_0x1c485b[_0x47a5('0x42')]=qs[_0x47a5('0x42')](_0x470da6['query'][_0x47a5('0x42')]);_0x1c485b['offset']=qs[_0x47a5('0xf')](_0x470da6['query'][_0x47a5('0xf')]);}return _0x4966af['getTeams'](_0x1c485b);}})[_0x47a5('0x16')](function(_0x2f27c3){if(_0x2f27c3){return _0x2f27c3?{'count':_0x144af9,'rows':_0x2f27c3}:null;}})[_0x47a5('0x16')](respondWithResult(_0x943a15,null))['catch'](handleError(_0x943a15,null));};exports['addTeams']=function(_0x4b8084,_0x4164a3){var _0x2b1303=_0x4b8084[_0x47a5('0x3b')][_0x47a5('0x51')];return db['Team'][_0x47a5('0x52')]({'where':{'id':_0x2b1303},'attributes':['id'],'include':[{'model':db[_0x47a5('0x48')],'as':_0x47a5('0x53'),'attributes':['id',_0x47a5('0x1b'),_0x47a5('0x54'),_0x47a5('0x55'),_0x47a5('0x56')],'raw':!![]}]})[_0x47a5('0x16')](function(_0x4618a0){if(_0x4618a0){var _0xc69a68=_[_0x47a5('0x57')](_0x4618a0,function(_0x463e5e){var _0x49d3dc=_0x463e5e[_0x47a5('0x17')]({'plain':!![]});return _0x49d3dc['Agents'];});return db[_0x47a5('0x25')][_0x47a5('0x33')]({'where':{'id':_0x4b8084[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](function(_0x40e584){return db[_0x47a5('0x58')][_0x47a5('0x59')](function(_0x448981){return _0x40e584[_0x47a5('0x5a')](_0x2b1303,{'transaction':_0x448981})[_0x47a5('0x16')](function(){return BPromise[_0x47a5('0x5b')](_0xc69a68,function(_0x1f07ac){return db[_0x47a5('0x3f')][_0x47a5('0x5c')]({'where':{'UserId':_0x1f07ac['id'],'SmsQueueId':_0x4b8084[_0x47a5('0x2a')]['id']},'transaction':_0x448981});});})['then'](function(){_0xc69a68['forEach'](function(_0x5ccc89){socket['emit'](_0x47a5('0x5d'),{'UserId':_0x5ccc89['id'],'SmsQueueId':_0x40e584['id']});});});});});}})[_0x47a5('0x16')](respondWithStatusCode(_0x4164a3,null))['catch'](handleError(_0x4164a3,null));};exports[_0x47a5('0x5e')]=function(_0x44dda2,_0x1baa5a){return db[_0x47a5('0x5f')][_0x47a5('0x52')]({'where':{'id':_0x44dda2[_0x47a5('0x2c')][_0x47a5('0x51')]},'attributes':['id'],'include':[{'model':db[_0x47a5('0x48')],'as':_0x47a5('0x53'),'attributes':['id'],'raw':!![]}]})[_0x47a5('0x16')](handleEntityNotFound(_0x1baa5a,null))[_0x47a5('0x16')](function(_0x5e5f16){var _0x18fa31=_[_0x47a5('0x1e')](_0x5e5f16,'id');var _0x420671=[];var _0x4f35ff=[];var _0x340846=squel[_0x47a5('0x60')]();_0x340846[_0x47a5('0x61')]('tq.TeamId')[_0x47a5('0x62')]('team_has_sms_queues','tq')['join'](_0x47a5('0x63'),'ut',_0x47a5('0x64'))[_0x47a5('0x24')](_0x47a5('0x65'),_0x44dda2[_0x47a5('0x2a')]['id']);for(var _0xea50f3=0x0;_0xea50f3<_0x5e5f16['length'];_0xea50f3+=0x1){let _0x592322=_0x5e5f16[_0xea50f3];for(var _0x3e0dbd=0x0;_0x3e0dbd<_0x592322['Agents'][_0x47a5('0x40')];_0x3e0dbd+=0x1){let _0x3fffd1=_0x592322[_0x47a5('0x53')][_0x3e0dbd];var _0xb16bdd=_0x340846['clone']();_0xb16bdd[_0x47a5('0x24')]('ut.UserId\x20=\x20?',_0x3fffd1['id']);_0x4f35ff['push'](db[_0x47a5('0x58')][_0x47a5('0x2c')](_0xb16bdd['toString'](),{'type':db[_0x47a5('0x58')][_0x47a5('0x66')][_0x47a5('0x67')]})['then'](function(_0x280372){if(_0x280372['length']===0x1){return _0x3fffd1['id'];}else{var _0x2307da=_[_0x47a5('0x68')](_[_0x47a5('0x1e')](_0x280372,'TeamId'),function(_0x2e0af1){return _[_0x47a5('0x69')](_0x18fa31,_0x2e0af1);});if(_0x2307da){return _0x3fffd1['id'];}}}));}}return BPromise[_0x47a5('0x6a')](_0x4f35ff)['then'](function(_0x3525e7){_0x420671=_(_0x420671)['union'](_0x3525e7)[_0x47a5('0x6b')]()['value']();return db[_0x47a5('0x25')][_0x47a5('0x33')]({'where':{'id':_0x44dda2[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](function(_0x51738b){return db[_0x47a5('0x58')][_0x47a5('0x59')](function(_0x23c393){return _0x51738b[_0x47a5('0x5e')](_0x44dda2[_0x47a5('0x2c')]['ids'],{'transaction':_0x23c393})['then'](function(){if(!_[_0x47a5('0x6c')](_0x420671)){return _0x51738b['removeAgents'](_0x420671,{'transaction':_0x23c393});}})[_0x47a5('0x16')](function(){_0x420671[_0x47a5('0x6d')](function(_0x216402){socket['emit'](_0x47a5('0x6e'),{'UserId':_0x216402,'SmsQueueId':_0x51738b['id']});});});});});});})[_0x47a5('0x16')](respondWithStatusCode(_0x1baa5a,null))['catch'](handleError(_0x1baa5a,null));};exports[_0x47a5('0x6f')]=function(_0x8a9dea,_0x19acfa){return db[_0x47a5('0x25')]['find']({'where':{'id':_0x8a9dea['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x19acfa,null))[_0x47a5('0x16')](function(_0x48e7f3){if(_0x48e7f3){return _0x48e7f3[_0x47a5('0x6f')](_0x8a9dea[_0x47a5('0x3b')]['ids'],_[_0x47a5('0x70')](_0x8a9dea[_0x47a5('0x3b')],[_0x47a5('0x51'),'id'])||{})['spread'](function(_0x3f2ad9){for(var _0x59b4a5=0x0;_0x59b4a5<_0x8a9dea[_0x47a5('0x3b')]['ids'][_0x47a5('0x40')];_0x59b4a5+=0x1){socket[_0x47a5('0x71')]('userSmsQueue:save',{'UserId':Number(_0x8a9dea[_0x47a5('0x3b')]['ids'][_0x59b4a5]),'SmsQueueId':Number(_0x8a9dea[_0x47a5('0x2a')]['id'])});}return _0x3f2ad9;});}})[_0x47a5('0x16')](respondWithResult(_0x19acfa,null))[_0x47a5('0x28')](handleError(_0x19acfa,null));};exports[_0x47a5('0x72')]=function(_0x49b76a,_0x3eb5c1){return db['SmsQueue']['find']({'where':{'id':_0x49b76a[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3eb5c1,null))[_0x47a5('0x16')](function(_0x96fb22){if(_0x96fb22){return _0x96fb22[_0x47a5('0x72')](_0x49b76a['query'][_0x47a5('0x51')])[_0x47a5('0x16')](function(){if(_[_0x47a5('0x73')](_0x49b76a[_0x47a5('0x2c')]['ids'])){for(var _0x240db9=0x0;_0x240db9<_0x49b76a['query'][_0x47a5('0x51')][_0x47a5('0x40')];_0x240db9+=0x1){socket[_0x47a5('0x71')](_0x47a5('0x6e'),{'UserId':Number(_0x49b76a[_0x47a5('0x2c')][_0x47a5('0x51')][_0x240db9]),'SmsQueueId':Number(_0x49b76a[_0x47a5('0x2a')]['id'])});}}else{socket[_0x47a5('0x71')](_0x47a5('0x6e'),{'UserId':Number(_0x49b76a['query'][_0x47a5('0x51')]),'SmsQueueId':Number(_0x49b76a[_0x47a5('0x2a')]['id'])});}});}})['then'](respondWithStatusCode(_0x3eb5c1,null))[_0x47a5('0x28')](handleError(_0x3eb5c1,null));};exports[_0x47a5('0x74')]=function(_0x6d6a5,_0x5b85cd){var _0x4bf1f5={};var _0x126bb1={};var _0x3d7371;var _0x47fbb6;return db['SmsQueue'][_0x47a5('0x3e')]({'where':{'id':_0x6d6a5[_0x47a5('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5b85cd,null))[_0x47a5('0x16')](function(_0x269ff6){if(_0x269ff6){_0x3d7371=_0x269ff6;_0x126bb1['model']=_[_0x47a5('0x4f')](db[_0x47a5('0x48')][_0x47a5('0x1f')]);_0x126bb1[_0x47a5('0x2c')]=_[_0x47a5('0x4f')](_0x6d6a5[_0x47a5('0x2c')]);_0x126bb1['filters']=_['intersection'](_0x126bb1['model'],_0x126bb1[_0x47a5('0x2c')]);_0x4bf1f5[_0x47a5('0x2f')]=_['intersection'](_0x126bb1[_0x47a5('0x2b')],qs[_0x47a5('0x2e')](_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x4bf1f5[_0x47a5('0x2f')]=_0x4bf1f5['attributes'][_0x47a5('0x40')]?_0x4bf1f5['attributes']:_0x126bb1['model'];_0x4bf1f5['order']=qs[_0x47a5('0x44')](_0x6d6a5['query'][_0x47a5('0x44')]);_0x4bf1f5[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_['pick'](_0x6d6a5[_0x47a5('0x2c')],_0x126bb1[_0x47a5('0x45')]));if(_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x4bf1f5[_0x47a5('0x24')]=_['merge'](_0x4bf1f5[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x4bf1f5['attributes'],function(_0x42ba59){var _0x419870={};_0x419870[_0x42ba59]={'$like':'%'+_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x47')]+'%'};return _0x419870;})});}_0x4bf1f5=_[_0x47a5('0x31')]({},_0x4bf1f5,_0x6d6a5[_0x47a5('0x32')]);return _0x3d7371['getAgents'](_0x4bf1f5);}})[_0x47a5('0x16')](function(_0x2e418d){if(_0x2e418d){_0x47fbb6=_0x2e418d['length'];if(!_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x41')](_0x47a5('0x50'))){_0x4bf1f5[_0x47a5('0x42')]=qs['limit'](_0x6d6a5['query']['limit']);_0x4bf1f5['offset']=qs[_0x47a5('0xf')](_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0xf')]);}return _0x3d7371[_0x47a5('0x74')](_0x4bf1f5);}})[_0x47a5('0x16')](function(_0x6bc37b){if(_0x6bc37b){return _0x6bc37b?{'count':_0x47fbb6,'rows':_0x6bc37b}:null;}})[_0x47a5('0x16')](respondWithResult(_0x5b85cd,null))[_0x47a5('0x28')](handleError(_0x5b85cd,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index dfd288b..3abb8d2 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 _0xb5cf=['SmsQueue','setMaxListeners','update','emit','hook','events','../../mysqldb'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xb5cf,0x194));var _0xfb5c=function(_0xd1f83b,_0xc10512){_0xd1f83b=_0xd1f83b-0x0;var _0x548b09=_0xb5cf[_0xd1f83b];return _0x548b09;};'use strict';var EventEmitter=require(_0xfb5c('0x0'));var SmsQueue=require(_0xfb5c('0x1'))['db'][_0xfb5c('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xfb5c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfb5c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x14a5fe){return function(_0x570805,_0x2b7a0b,_0x18562b){SmsQueueEvents[_0xfb5c('0x5')](_0x14a5fe+':'+_0x570805['id'],_0x570805);SmsQueueEvents['emit'](_0x14a5fe,_0x570805);_0x18562b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xfb5c('0x6')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x5fa6=['hasOwnProperty','exports','events','../../mysqldb','SmsQueue','setMaxListeners','update','remove','emit'];(function(_0x5aff85,_0x1c6a3c){var _0x1b57f4=function(_0x41d38b){while(--_0x41d38b){_0x5aff85['push'](_0x5aff85['shift']());}};_0x1b57f4(++_0x1c6a3c);}(_0x5fa6,0xc8));var _0x65fa=function(_0x4d8764,_0xd13d7b){_0x4d8764=_0x4d8764-0x0;var _0x4e0b49=_0x5fa6[_0x4d8764];return _0x4e0b49;};'use strict';var EventEmitter=require(_0x65fa('0x0'));var SmsQueue=require(_0x65fa('0x1'))['db'][_0x65fa('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x65fa('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x65fa('0x4'),'afterDestroy':_0x65fa('0x5')};function emitEvent(_0x2c9b13){return function(_0x1cbf2e,_0xd2c928,_0x447f99){SmsQueueEvents[_0x65fa('0x6')](_0x2c9b13+':'+_0x1cbf2e['id'],_0x1cbf2e);SmsQueueEvents[_0x65fa('0x6')](_0x2c9b13,_0x1cbf2e);_0x447f99(null);};}for(var e in events){if(events[_0x65fa('0x7')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x65fa('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 f794c18..3d1b44b 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 _0xe1a8=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue'];(function(_0x5a563f,_0xf738a9){var _0x1bda27=function(_0x3fbd53){while(--_0x3fbd53){_0x5a563f['push'](_0x5a563f['shift']());}};_0x1bda27(++_0xf738a9);}(_0xe1a8,0x104));var _0x8e1a=function(_0x10b09b,_0x221f46){_0x10b09b=_0x10b09b-0x0;var _0x5774c0=_0xe1a8[_0x10b09b];return _0x5774c0;};'use strict';var _=require(_0x8e1a('0x0'));var util=require(_0x8e1a('0x1'));var logger=require(_0x8e1a('0x2'))(_0x8e1a('0x3'));var moment=require('moment');var BPromise=require(_0x8e1a('0x4'));var rp=require(_0x8e1a('0x5'));var fs=require('fs');var path=require(_0x8e1a('0x6'));var rimraf=require(_0x8e1a('0x7'));var config=require(_0x8e1a('0x8'));var attributes=require(_0x8e1a('0x9'));module[_0x8e1a('0xa')]=function(_0x53ac9e,_0x28a89b){return _0x53ac9e[_0x8e1a('0xb')](_0x8e1a('0xc'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x328e=['SmsQueue','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x328e,0x18d));var _0xe328=function(_0x176a70,_0x38f5c7){_0x176a70=_0x176a70-0x0;var _0x429666=_0x328e[_0x176a70];return _0x429666;};'use strict';var _=require(_0xe328('0x0'));var util=require(_0xe328('0x1'));var logger=require('../../config/logger')(_0xe328('0x2'));var moment=require(_0xe328('0x3'));var BPromise=require('bluebird');var rp=require(_0xe328('0x4'));var fs=require('fs');var path=require(_0xe328('0x5'));var rimraf=require(_0xe328('0x6'));var config=require(_0xe328('0x7'));var attributes=require(_0xe328('0x8'));module[_0xe328('0x9')]=function(_0xbd4fc6,_0x9ca2c1){return _0xbd4fc6[_0xe328('0xa')](_0xe328('0xb'),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 bfd979d..ed9d3fd 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 _0x6509=['rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','raw','options','limit','map','include','attributes','model','debug','ShowSmsQueue','find','where','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x29d320,_0x3ce348){var _0x1288eb=function(_0x38d638){while(--_0x38d638){_0x29d320['push'](_0x29d320['shift']());}};_0x1288eb(++_0x3ce348);}(_0x6509,0x7a));var _0x9650=function(_0xed4881,_0x45771c){_0xed4881=_0xed4881-0x0;var _0x7fcbd5=_0x6509[_0xed4881];return _0x7fcbd5;};'use strict';var _=require(_0x9650('0x0'));var util=require(_0x9650('0x1'));var moment=require(_0x9650('0x2'));var BPromise=require(_0x9650('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9650('0x4'))['db'];var utils=require(_0x9650('0x5'));var logger=require(_0x9650('0x6'))(_0x9650('0x7'));var config=require(_0x9650('0x8'));var jayson=require(_0x9650('0x9'));var client=jayson[_0x9650('0xa')]['http']({'port':0x232a});config[_0x9650('0xb')]=_[_0x9650('0xc')](config['redis'],{'host':_0x9650('0xd'),'port':0x18eb});var socket=require(_0x9650('0xe'))(new Redis(config['redis']));require(_0x9650('0xf'))[_0x9650('0x10')](socket);function respondWithRpcPromise(_0x5baa84,_0xcd343,_0x24cfc5){return new BPromise(function(_0x4bb7d8,_0xbb5020){return client[_0x9650('0x11')](_0x5baa84,_0x24cfc5)[_0x9650('0x12')](function(_0x200eba){logger[_0x9650('0x13')](_0x9650('0x14'),_0xcd343,_0x9650('0x15'));logger['debug'](_0x9650('0x16'),_0xcd343,'request\x20sent',JSON[_0x9650('0x17')](_0x200eba));if(_0x200eba['error']){if(_0x200eba[_0x9650('0x18')][_0x9650('0x19')]===0x1f4){logger[_0x9650('0x18')]('SmsQueue,\x20%s,\x20%s',_0xcd343,_0x200eba[_0x9650('0x18')][_0x9650('0x1a')]);return _0xbb5020(_0x200eba[_0x9650('0x18')][_0x9650('0x1a')]);}logger[_0x9650('0x18')](_0x9650('0x14'),_0xcd343,_0x200eba['error']['message']);return _0x4bb7d8(_0x200eba[_0x9650('0x18')][_0x9650('0x1a')]);}else{logger[_0x9650('0x13')](_0x9650('0x14'),_0xcd343,'request\x20sent');_0x4bb7d8(_0x200eba[_0x9650('0x1b')][_0x9650('0x1a')]);}})[_0x9650('0x1c')](function(_0x2dfd83){logger[_0x9650('0x18')](_0x9650('0x14'),_0xcd343,_0x2dfd83);_0xbb5020(_0x2dfd83);});});}exports[_0x9650('0x1d')]=function(_0x6f0564){var _0x3bf0bd=this;return new Promise(function(_0x1eb36f,_0x41fc0e){return db[_0x9650('0x1e')][_0x9650('0x1f')]({'raw':_0x6f0564['options']?_0x6f0564['options'][_0x9650('0x20')]===undefined?!![]:![]:!![],'where':_0x6f0564[_0x9650('0x21')]?_0x6f0564[_0x9650('0x21')]['where']||null:null,'attributes':_0x6f0564[_0x9650('0x21')]?_0x6f0564[_0x9650('0x21')]['attributes']||null:null,'limit':_0x6f0564[_0x9650('0x21')]?_0x6f0564[_0x9650('0x21')][_0x9650('0x22')]||null:null,'include':_0x6f0564[_0x9650('0x21')]?_0x6f0564[_0x9650('0x21')]['include']?_[_0x9650('0x23')](_0x6f0564[_0x9650('0x21')][_0x9650('0x24')],function(_0x60394d){return{'model':db[_0x60394d['model']],'as':_0x60394d['as'],'attributes':_0x60394d[_0x9650('0x25')],'include':_0x60394d['include']?_['map'](_0x60394d[_0x9650('0x24')],function(_0x1aa11c){return{'model':db[_0x1aa11c['model']],'as':_0x1aa11c['as'],'attributes':_0x1aa11c['attributes'],'include':_0x1aa11c['include']?_[_0x9650('0x23')](_0x1aa11c['include'],function(_0x31c36c){return{'model':db[_0x31c36c[_0x9650('0x26')]],'as':_0x31c36c['as'],'attributes':_0x31c36c['attributes']};}):[]};}):[]};}):[]:[]})[_0x9650('0x12')](function(_0x2e5844){logger['info'](_0x9650('0x1d'),_0x6f0564);logger[_0x9650('0x27')](_0x9650('0x1d'),_0x6f0564,JSON[_0x9650('0x17')](_0x2e5844));_0x1eb36f(_0x2e5844);})[_0x9650('0x1c')](function(_0x11a435){logger[_0x9650('0x18')](_0x9650('0x1d'),_0x11a435['message'],_0x6f0564);_0x41fc0e(_0x3bf0bd[_0x9650('0x18')](0x1f4,_0x11a435['message']));});});};exports[_0x9650('0x28')]=function(_0x3827d0){var _0xd41365=this;return new Promise(function(_0x1d24b9,_0x976395){return db[_0x9650('0x1e')][_0x9650('0x29')]({'raw':_0x3827d0['options']?_0x3827d0[_0x9650('0x21')][_0x9650('0x20')]===undefined?!![]:![]:!![],'where':_0x3827d0[_0x9650('0x21')]?_0x3827d0[_0x9650('0x21')][_0x9650('0x2a')]||null:null,'attributes':_0x3827d0['options']?_0x3827d0[_0x9650('0x21')][_0x9650('0x25')]||null:null,'include':_0x3827d0[_0x9650('0x21')]?_0x3827d0['options'][_0x9650('0x24')]?_[_0x9650('0x23')](_0x3827d0[_0x9650('0x21')][_0x9650('0x24')],function(_0x2872e2){return{'model':db[_0x2872e2[_0x9650('0x26')]],'as':_0x2872e2['as'],'attributes':_0x2872e2[_0x9650('0x25')],'include':_0x2872e2[_0x9650('0x24')]?_[_0x9650('0x23')](_0x2872e2[_0x9650('0x24')],function(_0x502512){return{'model':db[_0x502512[_0x9650('0x26')]],'as':_0x502512['as'],'attributes':_0x502512[_0x9650('0x25')],'include':_0x502512['include']?_[_0x9650('0x23')](_0x502512[_0x9650('0x24')],function(_0x5d2037){return{'model':db[_0x5d2037[_0x9650('0x26')]],'as':_0x5d2037['as'],'attributes':_0x5d2037[_0x9650('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50f498){logger[_0x9650('0x13')](_0x9650('0x28'),_0x3827d0);logger[_0x9650('0x27')](_0x9650('0x28'),_0x3827d0,JSON['stringify'](_0x50f498));_0x1d24b9(_0x50f498);})[_0x9650('0x1c')](function(_0x2adde2){logger[_0x9650('0x18')]('ShowSmsQueue',_0x2adde2[_0x9650('0x1a')],_0x3827d0);_0x976395(_0xd41365[_0x9650('0x18')](0x1f4,_0x2adde2['message']));});});}; \ No newline at end of file +var _0x92f6=['info','result','catch','SmsQueue','findAll','options','where','attributes','map','include','model','GetSmsQueue','stringify','ShowSmsQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','SmsQueue,\x20%s,\x20%s','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x92f6,0x1f0));var _0x692f=function(_0x1e46e3,_0x35df6a){_0x1e46e3=_0x1e46e3-0x0;var _0x3e31c4=_0x92f6[_0x1e46e3];return _0x3e31c4;};'use strict';var _=require(_0x692f('0x0'));var util=require(_0x692f('0x1'));var moment=require(_0x692f('0x2'));var BPromise=require(_0x692f('0x3'));var rs=require(_0x692f('0x4'));var fs=require('fs');var Redis=require(_0x692f('0x5'));var db=require(_0x692f('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x692f('0x7'));var config=require(_0x692f('0x8'));var jayson=require(_0x692f('0x9'));var client=jayson[_0x692f('0xa')][_0x692f('0xb')]({'port':0x232a});config[_0x692f('0xc')]=_[_0x692f('0xd')](config[_0x692f('0xc')],{'host':_0x692f('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x692f('0xc')]));require('./smsQueue.socket')[_0x692f('0xf')](socket);function respondWithRpcPromise(_0x39f94c,_0x581309,_0x37fe8b){return new BPromise(function(_0xc0abd8,_0x2d4956){return client[_0x692f('0x10')](_0x39f94c,_0x37fe8b)[_0x692f('0x11')](function(_0x474cf0){logger['info']('SmsQueue,\x20%s,\x20%s',_0x581309,_0x692f('0x12'));logger[_0x692f('0x13')](_0x692f('0x14'),_0x581309,_0x692f('0x12'),JSON['stringify'](_0x474cf0));if(_0x474cf0[_0x692f('0x15')]){if(_0x474cf0[_0x692f('0x15')]['code']===0x1f4){logger[_0x692f('0x15')](_0x692f('0x16'),_0x581309,_0x474cf0[_0x692f('0x15')][_0x692f('0x17')]);return _0x2d4956(_0x474cf0[_0x692f('0x15')][_0x692f('0x17')]);}logger[_0x692f('0x15')](_0x692f('0x16'),_0x581309,_0x474cf0[_0x692f('0x15')][_0x692f('0x17')]);return _0xc0abd8(_0x474cf0['error'][_0x692f('0x17')]);}else{logger[_0x692f('0x18')](_0x692f('0x16'),_0x581309,'request\x20sent');_0xc0abd8(_0x474cf0[_0x692f('0x19')][_0x692f('0x17')]);}})[_0x692f('0x1a')](function(_0x2cd9cb){logger[_0x692f('0x15')](_0x692f('0x16'),_0x581309,_0x2cd9cb);_0x2d4956(_0x2cd9cb);});});}exports['GetSmsQueue']=function(_0x22b08d){var _0x198f7b=this;return new Promise(function(_0x19ab03,_0x61934){return db[_0x692f('0x1b')][_0x692f('0x1c')]({'raw':_0x22b08d['options']?_0x22b08d[_0x692f('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x22b08d[_0x692f('0x1d')]?_0x22b08d['options'][_0x692f('0x1e')]||null:null,'attributes':_0x22b08d['options']?_0x22b08d[_0x692f('0x1d')][_0x692f('0x1f')]||null:null,'limit':_0x22b08d[_0x692f('0x1d')]?_0x22b08d[_0x692f('0x1d')]['limit']||null:null,'include':_0x22b08d[_0x692f('0x1d')]?_0x22b08d[_0x692f('0x1d')]['include']?_[_0x692f('0x20')](_0x22b08d[_0x692f('0x1d')][_0x692f('0x21')],function(_0x13b715){return{'model':db[_0x13b715[_0x692f('0x22')]],'as':_0x13b715['as'],'attributes':_0x13b715[_0x692f('0x1f')],'include':_0x13b715[_0x692f('0x21')]?_[_0x692f('0x20')](_0x13b715[_0x692f('0x21')],function(_0x4fda70){return{'model':db[_0x4fda70[_0x692f('0x22')]],'as':_0x4fda70['as'],'attributes':_0x4fda70[_0x692f('0x1f')],'include':_0x4fda70[_0x692f('0x21')]?_[_0x692f('0x20')](_0x4fda70[_0x692f('0x21')],function(_0x40a578){return{'model':db[_0x40a578['model']],'as':_0x40a578['as'],'attributes':_0x40a578[_0x692f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x692f('0x11')](function(_0x547c84){logger['info'](_0x692f('0x23'),_0x22b08d);logger[_0x692f('0x13')](_0x692f('0x23'),_0x22b08d,JSON[_0x692f('0x24')](_0x547c84));_0x19ab03(_0x547c84);})['catch'](function(_0x4a8001){logger[_0x692f('0x15')](_0x692f('0x23'),_0x4a8001[_0x692f('0x17')],_0x22b08d);_0x61934(_0x198f7b['error'](0x1f4,_0x4a8001[_0x692f('0x17')]));});});};exports[_0x692f('0x25')]=function(_0x44407b){var _0x120aec=this;return new Promise(function(_0x24923b,_0x2a89f8){return db[_0x692f('0x1b')][_0x692f('0x26')]({'raw':_0x44407b[_0x692f('0x1d')]?_0x44407b['options'][_0x692f('0x27')]===undefined?!![]:![]:!![],'where':_0x44407b[_0x692f('0x1d')]?_0x44407b['options'][_0x692f('0x1e')]||null:null,'attributes':_0x44407b['options']?_0x44407b[_0x692f('0x1d')][_0x692f('0x1f')]||null:null,'include':_0x44407b[_0x692f('0x1d')]?_0x44407b['options']['include']?_['map'](_0x44407b[_0x692f('0x1d')][_0x692f('0x21')],function(_0x4d03b9){return{'model':db[_0x4d03b9[_0x692f('0x22')]],'as':_0x4d03b9['as'],'attributes':_0x4d03b9[_0x692f('0x1f')],'include':_0x4d03b9[_0x692f('0x21')]?_['map'](_0x4d03b9[_0x692f('0x21')],function(_0x4a2cad){return{'model':db[_0x4a2cad['model']],'as':_0x4a2cad['as'],'attributes':_0x4a2cad[_0x692f('0x1f')],'include':_0x4a2cad[_0x692f('0x21')]?_[_0x692f('0x20')](_0x4a2cad['include'],function(_0x124251){return{'model':db[_0x124251['model']],'as':_0x124251['as'],'attributes':_0x124251['attributes']};}):[]};}):[]};}):[]:[]})[_0x692f('0x11')](function(_0x39dfcb){logger[_0x692f('0x18')](_0x692f('0x25'),_0x44407b);logger[_0x692f('0x13')](_0x692f('0x25'),_0x44407b,JSON[_0x692f('0x24')](_0x39dfcb));_0x24923b(_0x39dfcb);})[_0x692f('0x1a')](function(_0x1bef49){logger['error'](_0x692f('0x25'),_0x1bef49['message'],_0x44407b);_0x2a89f8(_0x120aec[_0x692f('0x15')](0x1f4,_0x1bef49['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 562effb..74e50dc 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 _0x2c11=['remove','update','removeListener','register','length','./smsQueue.events','save'];(function(_0x238329,_0x248dae){var _0xed1a10=function(_0xb77bef){while(--_0xb77bef){_0x238329['push'](_0x238329['shift']());}};_0xed1a10(++_0x248dae);}(_0x2c11,0x1da));var _0x12c1=function(_0x3d48b8,_0x286558){_0x3d48b8=_0x3d48b8-0x0;var _0x29be7e=_0x2c11[_0x3d48b8];return _0x29be7e;};'use strict';var SmsQueueEvents=require(_0x12c1('0x0'));var events=[_0x12c1('0x1'),_0x12c1('0x2'),_0x12c1('0x3')];function createListener(_0x39d32b,_0x3364a8){return function(_0x38fcb4){_0x3364a8['emit'](_0x39d32b,_0x38fcb4);};}function removeListener(_0xe4b450,_0x28147c){return function(){SmsQueueEvents[_0x12c1('0x4')](_0xe4b450,_0x28147c);};}exports[_0x12c1('0x5')]=function(_0x1fc16c){for(var _0x2b0df3=0x0,_0x8c2e33=events[_0x12c1('0x6')];_0x2b0df3<_0x8c2e33;_0x2b0df3++){var _0x2acf0e=events[_0x2b0df3];var _0x53f400=createListener('smsQueue:'+_0x2acf0e,_0x1fc16c);SmsQueueEvents['on'](_0x2acf0e,_0x53f400);}}; \ No newline at end of file +var _0xcbe0=['length','smsQueue:','./smsQueue.events','remove','update','emit','register'];(function(_0x4e0f5e,_0x4168c4){var _0x45de30=function(_0x139cde){while(--_0x139cde){_0x4e0f5e['push'](_0x4e0f5e['shift']());}};_0x45de30(++_0x4168c4);}(_0xcbe0,0x121));var _0x0cbe=function(_0x1f1e31,_0x27b5c3){_0x1f1e31=_0x1f1e31-0x0;var _0x229b56=_0xcbe0[_0x1f1e31];return _0x229b56;};'use strict';var SmsQueueEvents=require(_0x0cbe('0x0'));var events=['save',_0x0cbe('0x1'),_0x0cbe('0x2')];function createListener(_0x144076,_0x710d19){return function(_0x2cae8d){_0x710d19[_0x0cbe('0x3')](_0x144076,_0x2cae8d);};}function removeListener(_0x9cc946,_0x401867){return function(){SmsQueueEvents['removeListener'](_0x9cc946,_0x401867);};}exports[_0x0cbe('0x4')]=function(_0x240b67){for(var _0x2ee903=0x0,_0x49865e=events[_0x0cbe('0x5')];_0x2ee903<_0x49865e;_0x2ee903++){var _0x4ebf25=events[_0x2ee903];var _0x501e08=createListener(_0x0cbe('0x6')+_0x4ebf25,_0x240b67);SmsQueueEvents['on'](_0x4ebf25,_0x501e08);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index c0c0f21..dab1d47 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 _0xbeba=['post','create','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x11407c,_0x1d4209){var _0x5326b0=function(_0x423be8){while(--_0x423be8){_0x11407c['push'](_0x11407c['shift']());}};_0x5326b0(++_0x1d4209);}(_0xbeba,0x64));var _0xabeb=function(_0x175b84,_0xe53ff4){_0x175b84=_0x175b84-0x0;var _0x183820=_0xbeba[_0x175b84];return _0x183820;};'use strict';var multer=require(_0xabeb('0x0'));var util=require(_0xabeb('0x1'));var path=require('path');var timeout=require(_0xabeb('0x2'));var express=require(_0xabeb('0x3'));var router=express[_0xabeb('0x4')]();var fs_extra=require(_0xabeb('0x5'));var auth=require(_0xabeb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xabeb('0x7'));var controller=require(_0xabeb('0x8'));router[_0xabeb('0x9')]('/',auth[_0xabeb('0xa')](),controller[_0xabeb('0xb')]);router[_0xabeb('0x9')](_0xabeb('0xc'),auth[_0xabeb('0xa')](),controller['describe']);router['get'](_0xabeb('0xd'),auth[_0xabeb('0xa')](),controller['show']);router[_0xabeb('0xe')]('/',auth[_0xabeb('0xa')](),controller[_0xabeb('0xf')]);router['put'](_0xabeb('0xd'),auth[_0xabeb('0xa')](),controller['update']);router[_0xabeb('0x10')](_0xabeb('0xd'),auth[_0xabeb('0xa')](),controller[_0xabeb('0x11')]);module[_0xabeb('0x12')]=router; \ No newline at end of file +var _0xe260=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','post','create','put','delete','destroy'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe260,0x94));var _0x0e26=function(_0x153ca5,_0x18e039){_0x153ca5=_0x153ca5-0x0;var _0x18807a=_0xe260[_0x153ca5];return _0x18807a;};'use strict';var multer=require(_0x0e26('0x0'));var util=require('util');var path=require(_0x0e26('0x1'));var timeout=require(_0x0e26('0x2'));var express=require(_0x0e26('0x3'));var router=express[_0x0e26('0x4')]();var fs_extra=require(_0x0e26('0x5'));var auth=require(_0x0e26('0x6'));var interaction=require(_0x0e26('0x7'));var config=require(_0x0e26('0x8'));var controller=require(_0x0e26('0x9'));router[_0x0e26('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0e26('0xa')](_0x0e26('0xb'),auth[_0x0e26('0xc')](),controller[_0x0e26('0xd')]);router[_0x0e26('0xa')](_0x0e26('0xe'),auth[_0x0e26('0xc')](),controller['show']);router[_0x0e26('0xf')]('/',auth['isAuthenticated'](),controller[_0x0e26('0x10')]);router[_0x0e26('0x11')](_0x0e26('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x0e26('0x12')](_0x0e26('0xe'),auth['isAuthenticated'](),controller[_0x0e26('0x13')]);module[_0x0e26('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 51aee23..f3ed7af 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 _0x07b4=['DATE','STRING'];(function(_0x3ff524,_0x2c3e99){var _0x4ab46d=function(_0x3290c6){while(--_0x3290c6){_0x3ff524['push'](_0x3ff524['shift']());}};_0x4ab46d(++_0x2c3e99);}(_0x07b4,0x1c9));var _0x407b=function(_0x4f700a,_0xe7874b){_0x4f700a=_0x4f700a-0x0;var _0x546071=_0x07b4[_0x4f700a];return _0x546071;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x407b('0x0')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x407b('0x1')]},'leaveAt':{'type':Sequelize[_0x407b('0x1')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x407b('0x1')]},'reason':{'type':Sequelize[_0x407b('0x0')]}}; \ No newline at end of file +var _0x7a7d=['moment','sequelize','exports','STRING','DATE'];(function(_0x5e4d7a,_0x474456){var _0x446c84=function(_0x254e70){while(--_0x254e70){_0x5e4d7a['push'](_0x5e4d7a['shift']());}};_0x446c84(++_0x474456);}(_0x7a7d,0x109));var _0xd7a7=function(_0x282b8f,_0x12fe0b){_0x282b8f=_0x282b8f-0x0;var _0x3ed0ac=_0x7a7d[_0x282b8f];return _0x3ed0ac;};'use strict';var moment=require(_0xd7a7('0x0'));var Sequelize=require(_0xd7a7('0x1'));module[_0xd7a7('0x2')]={'uniqueid':{'type':Sequelize[_0xd7a7('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xd7a7('0x4')]},'leaveAt':{'type':Sequelize[_0xd7a7('0x4')]},'acceptAt':{'type':Sequelize[_0xd7a7('0x4')]},'exitAt':{'type':Sequelize[_0xd7a7('0x4')]},'reason':{'type':Sequelize[_0xd7a7('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index f68dde0..4325926 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 _0x3307=['api','../../config/utils','../../config/environment','../../config/license/util','status','offset','undefined','limit','set','Content-Range','json','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','count','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x558f9f,_0x2036ca){var _0x4fa18b=function(_0x1b8c4a){while(--_0x1b8c4a){_0x558f9f['push'](_0x558f9f['shift']());}};_0x4fa18b(++_0x2036ca);}(_0x3307,0x172));var _0x7330=function(_0x3044ef,_0x2dbc29){_0x3044ef=_0x3044ef-0x0;var _0x5db5e0=_0x3307[_0x3044ef];return _0x5db5e0;};'use strict';var emlformat=require(_0x7330('0x0'));var rimraf=require(_0x7330('0x1'));var zipdir=require(_0x7330('0x2'));var jsonpatch=require(_0x7330('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7330('0x4'));var Mustache=require(_0x7330('0x5'));var util=require(_0x7330('0x6'));var path=require(_0x7330('0x7'));var sox=require(_0x7330('0x8'));var csv=require(_0x7330('0x9'));var ejs=require(_0x7330('0xa'));var fs=require('fs');var fs_extra=require(_0x7330('0xb'));var _=require(_0x7330('0xc'));var squel=require(_0x7330('0xd'));var crypto=require(_0x7330('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7330('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7330('0x10'));var Redis=require(_0x7330('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7330('0x12'));var as=require(_0x7330('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7330('0x14'));var utils=require(_0x7330('0x15'));var config=require(_0x7330('0x16'));var licenseUtil=require(_0x7330('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1294a2,_0xa7ab79){_0xa7ab79=_0xa7ab79||0xcc;return function(_0x12e639){if(_0x12e639){return _0x1294a2['sendStatus'](_0xa7ab79);}return _0x1294a2[_0x7330('0x18')](_0xa7ab79)['end']();};}function respondWithResult(_0x5a0c56,_0x4247ca){_0x4247ca=_0x4247ca||0xc8;return function(_0x2872c4){if(_0x2872c4){return _0x5a0c56['status'](_0x4247ca)['json'](_0x2872c4);}};}function respondWithFilteredResult(_0x42c860,_0x37d626){return function(_0x1ddf93){if(_0x1ddf93){var _0x2f6736=typeof _0x37d626[_0x7330('0x19')]===_0x7330('0x1a')&&typeof _0x37d626[_0x7330('0x1b')]===_0x7330('0x1a');var _0x10899d=_0x1ddf93['count'];var _0x9fc78a=_0x2f6736?0x0:_0x37d626[_0x7330('0x19')];var _0x3cbb8e=_0x2f6736?_0x1ddf93['count']:_0x37d626[_0x7330('0x19')]+_0x37d626[_0x7330('0x1b')];var _0x1b6be6;if(_0x3cbb8e>=_0x10899d){_0x3cbb8e=_0x10899d;_0x1b6be6=0xc8;}else{_0x1b6be6=0xce;}_0x42c860[_0x7330('0x18')](_0x1b6be6);return _0x42c860[_0x7330('0x1c')](_0x7330('0x1d'),_0x9fc78a+'-'+_0x3cbb8e+'/'+_0x10899d)[_0x7330('0x1e')](_0x1ddf93);}return null;};}function patchUpdates(_0x1c141d){return function(_0x2301b0){try{jsonpatch['apply'](_0x2301b0,_0x1c141d,!![]);}catch(_0x2df487){return BPromise[_0x7330('0x1f')](_0x2df487);}return _0x2301b0[_0x7330('0x20')]();};}function saveUpdates(_0x27d6c7,_0x17cfe4){return function(_0x4fd068){if(_0x4fd068){return _0x4fd068[_0x7330('0x21')](_0x27d6c7)[_0x7330('0x22')](function(_0x37130d){return _0x37130d;});}return null;};}function removeEntity(_0x56a26f,_0x4060c4){return function(_0x51c827){if(_0x51c827){return _0x51c827[_0x7330('0x23')]()[_0x7330('0x22')](function(){_0x56a26f[_0x7330('0x18')](0xcc)[_0x7330('0x24')]();});}};}function handleEntityNotFound(_0x16310b,_0x2fd588){return function(_0x5baba8){if(!_0x5baba8){_0x16310b[_0x7330('0x25')](0x194);}return _0x5baba8;};}function handleError(_0x87ded7,_0x45fc8e){_0x45fc8e=_0x45fc8e||0x1f4;return function(_0x3c70c4){logger[_0x7330('0x26')](_0x3c70c4[_0x7330('0x27')]);if(_0x3c70c4[_0x7330('0x28')]){delete _0x3c70c4['name'];}_0x87ded7[_0x7330('0x18')](_0x45fc8e)[_0x7330('0x29')](_0x3c70c4);};}exports[_0x7330('0x2a')]=function(_0x1f6383,_0x26ebb1){var _0x381eb4={},_0x38d2d0={},_0x318811={'count':0x0,'rows':[]};var _0x47642c=_[_0x7330('0x2b')](db[_0x7330('0x2c')][_0x7330('0x2d')],function(_0x7df792){return{'name':_0x7df792[_0x7330('0x2e')],'type':_0x7df792['type'][_0x7330('0x2f')]};});_0x38d2d0[_0x7330('0x30')]=_['map'](_0x47642c,_0x7330('0x28'));_0x38d2d0[_0x7330('0x31')]=_[_0x7330('0x32')](_0x1f6383['query']);_0x38d2d0[_0x7330('0x33')]=_[_0x7330('0x34')](_0x38d2d0['model'],_0x38d2d0['query']);_0x381eb4['attributes']=_[_0x7330('0x34')](_0x38d2d0[_0x7330('0x30')],qs[_0x7330('0x35')](_0x1f6383['query'][_0x7330('0x35')]));_0x381eb4[_0x7330('0x36')]=_0x381eb4['attributes'][_0x7330('0x37')]?_0x381eb4[_0x7330('0x36')]:_0x38d2d0[_0x7330('0x30')];if(!_0x1f6383[_0x7330('0x31')][_0x7330('0x38')](_0x7330('0x39'))){_0x381eb4[_0x7330('0x1b')]=qs[_0x7330('0x1b')](_0x1f6383[_0x7330('0x31')]['limit']);_0x381eb4[_0x7330('0x19')]=qs[_0x7330('0x19')](_0x1f6383['query'][_0x7330('0x19')]);}_0x381eb4[_0x7330('0x3a')]=qs[_0x7330('0x3b')](_0x1f6383['query'][_0x7330('0x3b')]);_0x381eb4['where']=qs[_0x7330('0x33')](_[_0x7330('0x3c')](_0x1f6383['query'],_0x38d2d0[_0x7330('0x33')]),_0x47642c);if(_0x1f6383[_0x7330('0x31')][_0x7330('0x3d')]){_0x381eb4['where']=_['merge'](_0x381eb4[_0x7330('0x3e')],{'$or':_[_0x7330('0x2b')](_0x47642c,function(_0x1dd76c){if(_0x1dd76c['type']!==_0x7330('0x3f')){var _0x508b53={};_0x508b53[_0x1dd76c[_0x7330('0x28')]]={'$like':'%'+_0x1f6383['query'][_0x7330('0x3d')]+'%'};return _0x508b53;}})});}_0x381eb4=_[_0x7330('0x40')]({},_0x381eb4,_0x1f6383['options']);var _0x201ca4={'where':_0x381eb4[_0x7330('0x3e')]};return db[_0x7330('0x2c')][_0x7330('0x41')](_0x201ca4)['then'](function(_0x101ae5){_0x318811[_0x7330('0x41')]=_0x101ae5;if(_0x1f6383[_0x7330('0x31')][_0x7330('0x42')]){_0x381eb4[_0x7330('0x43')]=[{'all':!![]}];}return db[_0x7330('0x2c')][_0x7330('0x44')](_0x381eb4);})[_0x7330('0x22')](function(_0x496ebf){_0x318811[_0x7330('0x45')]=_0x496ebf;return _0x318811;})[_0x7330('0x22')](respondWithFilteredResult(_0x26ebb1,_0x381eb4))[_0x7330('0x46')](handleError(_0x26ebb1,null));};exports[_0x7330('0x47')]=function(_0x176b9d,_0x5707bd){var _0x27e4a2={'raw':!![],'where':{'id':_0x176b9d[_0x7330('0x48')]['id']}},_0x37e2c4={};_0x37e2c4[_0x7330('0x30')]=_[_0x7330('0x32')](db[_0x7330('0x2c')]['rawAttributes']);_0x37e2c4[_0x7330('0x31')]=_[_0x7330('0x32')](_0x176b9d[_0x7330('0x31')]);_0x37e2c4['filters']=_[_0x7330('0x34')](_0x37e2c4[_0x7330('0x30')],_0x37e2c4[_0x7330('0x31')]);_0x27e4a2[_0x7330('0x36')]=_['intersection'](_0x37e2c4['model'],qs[_0x7330('0x35')](_0x176b9d['query'][_0x7330('0x35')]));_0x27e4a2[_0x7330('0x36')]=_0x27e4a2[_0x7330('0x36')]['length']?_0x27e4a2[_0x7330('0x36')]:_0x37e2c4[_0x7330('0x30')];if(_0x176b9d[_0x7330('0x31')][_0x7330('0x42')]){_0x27e4a2[_0x7330('0x43')]=[{'all':!![]}];}_0x27e4a2=_[_0x7330('0x40')]({},_0x27e4a2,_0x176b9d[_0x7330('0x49')]);return db['SmsQueueReport'][_0x7330('0x4a')](_0x27e4a2)[_0x7330('0x22')](handleEntityNotFound(_0x5707bd,null))[_0x7330('0x22')](respondWithResult(_0x5707bd,null))[_0x7330('0x46')](handleError(_0x5707bd,null));};exports[_0x7330('0x4b')]=function(_0x1e9a2c,_0x374cc0){return db[_0x7330('0x2c')][_0x7330('0x4b')](_0x1e9a2c['body'],{})[_0x7330('0x22')](respondWithResult(_0x374cc0,0xc9))[_0x7330('0x46')](handleError(_0x374cc0,null));};exports['update']=function(_0x76b96c,_0x27dcea){if(_0x76b96c[_0x7330('0x4c')]['id']){delete _0x76b96c[_0x7330('0x4c')]['id'];}return db[_0x7330('0x2c')][_0x7330('0x4a')]({'where':{'id':_0x76b96c[_0x7330('0x48')]['id']}})['then'](handleEntityNotFound(_0x27dcea,null))[_0x7330('0x22')](saveUpdates(_0x76b96c[_0x7330('0x4c')],null))['then'](respondWithResult(_0x27dcea,null))[_0x7330('0x46')](handleError(_0x27dcea,null));};exports['destroy']=function(_0x405f4f,_0x1b6701){return db['SmsQueueReport'][_0x7330('0x4a')]({'where':{'id':_0x405f4f[_0x7330('0x48')]['id']}})['then'](handleEntityNotFound(_0x1b6701,null))[_0x7330('0x22')](removeEntity(_0x1b6701,null))[_0x7330('0x46')](handleError(_0x1b6701,null));};exports[_0x7330('0x4d')]=function(_0x33561a,_0x5aa0b8){return db[_0x7330('0x2c')][_0x7330('0x4d')]()['then'](respondWithResult(_0x5aa0b8,null))[_0x7330('0x46')](handleError(_0x5aa0b8,null));}; \ No newline at end of file +var _0x5df9=['hasOwnProperty','order','sort','where','VIRTUAL','filter','options','includeAll','include','keys','merge','find','catch','create','body','params','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','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','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','destroy','then','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length'];(function(_0x22c90b,_0x51db33){var _0x5e1e21=function(_0x2195bd){while(--_0x2195bd){_0x22c90b['push'](_0x22c90b['shift']());}};_0x5e1e21(++_0x51db33);}(_0x5df9,0xf2));var _0x95df=function(_0x1d0961,_0x14699e){_0x1d0961=_0x1d0961-0x0;var _0x43d633=_0x5df9[_0x1d0961];return _0x43d633;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x95df('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x95df('0x1'));var rp=require(_0x95df('0x2'));var moment=require(_0x95df('0x3'));var BPromise=require(_0x95df('0x4'));var Mustache=require(_0x95df('0x5'));var util=require(_0x95df('0x6'));var path=require('path');var sox=require(_0x95df('0x7'));var csv=require(_0x95df('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x95df('0x9'));var _=require(_0x95df('0xa'));var squel=require(_0x95df('0xb'));var crypto=require(_0x95df('0xc'));var jsforce=require(_0x95df('0xd'));var deskjs=require(_0x95df('0xe'));var toCsv=require('to-csv');var querystring=require(_0x95df('0xf'));var Papa=require(_0x95df('0x10'));var Redis=require('ioredis');var authService=require(_0x95df('0x11'));var qs=require(_0x95df('0x12'));var as=require(_0x95df('0x13'));var hardwareService=require(_0x95df('0x14'));var logger=require(_0x95df('0x15'))(_0x95df('0x16'));var utils=require(_0x95df('0x17'));var config=require(_0x95df('0x18'));var licenseUtil=require(_0x95df('0x19'));var db=require(_0x95df('0x1a'))['db'];function respondWithStatusCode(_0x20ce23,_0x146827){_0x146827=_0x146827||0xcc;return function(_0x834b6c){if(_0x834b6c){return _0x20ce23[_0x95df('0x1b')](_0x146827);}return _0x20ce23[_0x95df('0x1c')](_0x146827)[_0x95df('0x1d')]();};}function respondWithResult(_0x399cb6,_0x24f345){_0x24f345=_0x24f345||0xc8;return function(_0x2fd0a4){if(_0x2fd0a4){return _0x399cb6[_0x95df('0x1c')](_0x24f345)['json'](_0x2fd0a4);}};}function respondWithFilteredResult(_0x2dedf9,_0xaa20cb){return function(_0x3b9238){if(_0x3b9238){var _0xc60430=typeof _0xaa20cb[_0x95df('0x1e')]===_0x95df('0x1f')&&typeof _0xaa20cb[_0x95df('0x20')]===_0x95df('0x1f');var _0x24792e=_0x3b9238[_0x95df('0x21')];var _0x4d0b64=_0xc60430?0x0:_0xaa20cb[_0x95df('0x1e')];var _0xcdf164=_0xc60430?_0x3b9238[_0x95df('0x21')]:_0xaa20cb['offset']+_0xaa20cb[_0x95df('0x20')];var _0xec7c0a;if(_0xcdf164>=_0x24792e){_0xcdf164=_0x24792e;_0xec7c0a=0xc8;}else{_0xec7c0a=0xce;}_0x2dedf9[_0x95df('0x1c')](_0xec7c0a);return _0x2dedf9['set'](_0x95df('0x22'),_0x4d0b64+'-'+_0xcdf164+'/'+_0x24792e)[_0x95df('0x23')](_0x3b9238);}return null;};}function patchUpdates(_0x52bbf6){return function(_0x18c97a){try{jsonpatch[_0x95df('0x24')](_0x18c97a,_0x52bbf6,!![]);}catch(_0x237c70){return BPromise[_0x95df('0x25')](_0x237c70);}return _0x18c97a[_0x95df('0x26')]();};}function saveUpdates(_0x48229b,_0x45c052){return function(_0x27922d){if(_0x27922d){return _0x27922d[_0x95df('0x27')](_0x48229b)['then'](function(_0x4095ee){return _0x4095ee;});}return null;};}function removeEntity(_0x481201,_0x3018ad){return function(_0x213983){if(_0x213983){return _0x213983[_0x95df('0x28')]()[_0x95df('0x29')](function(){_0x481201[_0x95df('0x1c')](0xcc)[_0x95df('0x1d')]();});}};}function handleEntityNotFound(_0x4757f1,_0x11e3e5){return function(_0x21daae){if(!_0x21daae){_0x4757f1[_0x95df('0x1b')](0x194);}return _0x21daae;};}function handleError(_0x4cd84e,_0x379067){_0x379067=_0x379067||0x1f4;return function(_0x4c50e4){logger['error'](_0x4c50e4['stack']);if(_0x4c50e4['name']){delete _0x4c50e4[_0x95df('0x2a')];}_0x4cd84e[_0x95df('0x1c')](_0x379067)[_0x95df('0x2b')](_0x4c50e4);};}exports[_0x95df('0x2c')]=function(_0x37fbbc,_0x2204c7){var _0x24b8ed={},_0x29c7bc={},_0x73783f={'count':0x0,'rows':[]};var _0x316ab1=_[_0x95df('0x2d')](db[_0x95df('0x2e')][_0x95df('0x2f')],function(_0x5196d0){return{'name':_0x5196d0[_0x95df('0x30')],'type':_0x5196d0[_0x95df('0x31')][_0x95df('0x32')]};});_0x29c7bc['model']=_[_0x95df('0x2d')](_0x316ab1,_0x95df('0x2a'));_0x29c7bc['query']=_['keys'](_0x37fbbc[_0x95df('0x33')]);_0x29c7bc[_0x95df('0x34')]=_[_0x95df('0x35')](_0x29c7bc[_0x95df('0x36')],_0x29c7bc[_0x95df('0x33')]);_0x24b8ed[_0x95df('0x37')]=_['intersection'](_0x29c7bc[_0x95df('0x36')],qs[_0x95df('0x38')](_0x37fbbc[_0x95df('0x33')][_0x95df('0x38')]));_0x24b8ed['attributes']=_0x24b8ed['attributes'][_0x95df('0x39')]?_0x24b8ed[_0x95df('0x37')]:_0x29c7bc[_0x95df('0x36')];if(!_0x37fbbc[_0x95df('0x33')][_0x95df('0x3a')]('nolimit')){_0x24b8ed['limit']=qs['limit'](_0x37fbbc[_0x95df('0x33')]['limit']);_0x24b8ed['offset']=qs[_0x95df('0x1e')](_0x37fbbc[_0x95df('0x33')][_0x95df('0x1e')]);}_0x24b8ed[_0x95df('0x3b')]=qs[_0x95df('0x3c')](_0x37fbbc[_0x95df('0x33')][_0x95df('0x3c')]);_0x24b8ed['where']=qs[_0x95df('0x34')](_['pick'](_0x37fbbc['query'],_0x29c7bc[_0x95df('0x34')]),_0x316ab1);if(_0x37fbbc[_0x95df('0x33')]['filter']){_0x24b8ed[_0x95df('0x3d')]=_['merge'](_0x24b8ed['where'],{'$or':_[_0x95df('0x2d')](_0x316ab1,function(_0x201c57){if(_0x201c57[_0x95df('0x31')]!==_0x95df('0x3e')){var _0x357372={};_0x357372[_0x201c57[_0x95df('0x2a')]]={'$like':'%'+_0x37fbbc[_0x95df('0x33')][_0x95df('0x3f')]+'%'};return _0x357372;}})});}_0x24b8ed=_['merge']({},_0x24b8ed,_0x37fbbc[_0x95df('0x40')]);var _0x3a0801={'where':_0x24b8ed['where']};return db[_0x95df('0x2e')][_0x95df('0x21')](_0x3a0801)['then'](function(_0x5cc5ef){_0x73783f['count']=_0x5cc5ef;if(_0x37fbbc[_0x95df('0x33')][_0x95df('0x41')]){_0x24b8ed[_0x95df('0x42')]=[{'all':!![]}];}return db[_0x95df('0x2e')]['findAll'](_0x24b8ed);})[_0x95df('0x29')](function(_0x2b44bc){_0x73783f['rows']=_0x2b44bc;return _0x73783f;})['then'](respondWithFilteredResult(_0x2204c7,_0x24b8ed))['catch'](handleError(_0x2204c7,null));};exports['show']=function(_0x1b4178,_0x40abba){var _0x2edd67={'raw':!![],'where':{'id':_0x1b4178['params']['id']}},_0x26e70e={};_0x26e70e[_0x95df('0x36')]=_['keys'](db[_0x95df('0x2e')]['rawAttributes']);_0x26e70e[_0x95df('0x33')]=_[_0x95df('0x43')](_0x1b4178[_0x95df('0x33')]);_0x26e70e['filters']=_[_0x95df('0x35')](_0x26e70e[_0x95df('0x36')],_0x26e70e['query']);_0x2edd67[_0x95df('0x37')]=_[_0x95df('0x35')](_0x26e70e['model'],qs['fields'](_0x1b4178[_0x95df('0x33')][_0x95df('0x38')]));_0x2edd67[_0x95df('0x37')]=_0x2edd67[_0x95df('0x37')][_0x95df('0x39')]?_0x2edd67[_0x95df('0x37')]:_0x26e70e[_0x95df('0x36')];if(_0x1b4178[_0x95df('0x33')][_0x95df('0x41')]){_0x2edd67['include']=[{'all':!![]}];}_0x2edd67=_[_0x95df('0x44')]({},_0x2edd67,_0x1b4178[_0x95df('0x40')]);return db[_0x95df('0x2e')][_0x95df('0x45')](_0x2edd67)[_0x95df('0x29')](handleEntityNotFound(_0x40abba,null))[_0x95df('0x29')](respondWithResult(_0x40abba,null))[_0x95df('0x46')](handleError(_0x40abba,null));};exports[_0x95df('0x47')]=function(_0x49dfe9,_0x1adc91){return db[_0x95df('0x2e')]['create'](_0x49dfe9[_0x95df('0x48')],{})['then'](respondWithResult(_0x1adc91,0xc9))[_0x95df('0x46')](handleError(_0x1adc91,null));};exports[_0x95df('0x27')]=function(_0x13c574,_0x447829){if(_0x13c574['body']['id']){delete _0x13c574[_0x95df('0x48')]['id'];}return db[_0x95df('0x2e')][_0x95df('0x45')]({'where':{'id':_0x13c574[_0x95df('0x49')]['id']}})[_0x95df('0x29')](handleEntityNotFound(_0x447829,null))[_0x95df('0x29')](saveUpdates(_0x13c574[_0x95df('0x48')],null))[_0x95df('0x29')](respondWithResult(_0x447829,null))['catch'](handleError(_0x447829,null));};exports[_0x95df('0x28')]=function(_0x33c94f,_0x19dd5e){return db[_0x95df('0x2e')][_0x95df('0x45')]({'where':{'id':_0x33c94f[_0x95df('0x49')]['id']}})[_0x95df('0x29')](handleEntityNotFound(_0x19dd5e,null))['then'](removeEntity(_0x19dd5e,null))[_0x95df('0x46')](handleError(_0x19dd5e,null));};exports[_0x95df('0x4a')]=function(_0xa2d57f,_0x1a46e2){return db[_0x95df('0x2e')][_0x95df('0x4a')]()['then'](respondWithResult(_0x1a46e2,null))[_0x95df('0x46')](handleError(_0x1a46e2,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 7e3daa7..b8066a6 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0xa45395,_0x5579e6){var _0x3c83d2=function(_0x5d013c){while(--_0x5d013c){_0xa45395['push'](_0xa45395['shift']());}};_0x3c83d2(++_0x5579e6);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 14cbadd..8d88691 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 _0xea4d=['../../config/environment','jayson/promise','http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','SmsQueueReport','create','body','options','raw','stringify','CreateSmsQueueReport','update','where','attributes','UpdateSmsQueueReport','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0xea4d,0x1cb));var _0xdea4=function(_0xaa725b,_0x56f47e){_0xaa725b=_0xaa725b-0x0;var _0x212d43=_0xea4d[_0xaa725b];return _0x212d43;};'use strict';var _=require(_0xdea4('0x0'));var util=require('util');var moment=require(_0xdea4('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdea4('0x2'));var db=require(_0xdea4('0x3'))['db'];var utils=require(_0xdea4('0x4'));var logger=require(_0xdea4('0x5'))('rpc');var config=require(_0xdea4('0x6'));var jayson=require(_0xdea4('0x7'));var client=jayson['client'][_0xdea4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1930e5,_0x548091,_0xf32c49){return new BPromise(function(_0x54aec5,_0x1a33f8){return client[_0xdea4('0x9')](_0x1930e5,_0xf32c49)[_0xdea4('0xa')](function(_0x4f4c54){logger['info'](_0xdea4('0xb'),_0x548091,_0xdea4('0xc'));logger[_0xdea4('0xd')](_0xdea4('0xe'),_0x548091,'request\x20sent',JSON['stringify'](_0x4f4c54));if(_0x4f4c54[_0xdea4('0xf')]){if(_0x4f4c54[_0xdea4('0xf')][_0xdea4('0x10')]===0x1f4){logger[_0xdea4('0xf')](_0xdea4('0xb'),_0x548091,_0x4f4c54['error'][_0xdea4('0x11')]);return _0x1a33f8(_0x4f4c54[_0xdea4('0xf')][_0xdea4('0x11')]);}logger[_0xdea4('0xf')](_0xdea4('0xb'),_0x548091,_0x4f4c54[_0xdea4('0xf')][_0xdea4('0x11')]);return _0x54aec5(_0x4f4c54[_0xdea4('0xf')]['message']);}else{logger[_0xdea4('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x548091,_0xdea4('0xc'));_0x54aec5(_0x4f4c54['result'][_0xdea4('0x11')]);}})[_0xdea4('0x13')](function(_0x55d611){logger[_0xdea4('0xf')](_0xdea4('0xb'),_0x548091,_0x55d611);_0x1a33f8(_0x55d611);});});}exports['CreateSmsQueueReport']=function(_0xfb4f86){var _0x15e471=this;return new Promise(function(_0x45e96f,_0x549f78){return db[_0xdea4('0x14')][_0xdea4('0x15')](_0xfb4f86[_0xdea4('0x16')],{'raw':_0xfb4f86[_0xdea4('0x17')]?_0xfb4f86[_0xdea4('0x17')][_0xdea4('0x18')]===undefined?!![]:![]:!![]})[_0xdea4('0xa')](function(_0x34a57a){logger[_0xdea4('0x12')]('CreateSmsQueueReport',_0xfb4f86);logger['debug']('CreateSmsQueueReport',_0xfb4f86,JSON[_0xdea4('0x19')](_0x34a57a));_0x45e96f(_0x34a57a);})[_0xdea4('0x13')](function(_0x259264){logger[_0xdea4('0xf')](_0xdea4('0x1a'),_0x259264['message'],_0xfb4f86);_0x549f78(_0x15e471['error'](0x1f4,_0x259264[_0xdea4('0x11')]));});});};exports['UpdateSmsQueueReport']=function(_0x245349){var _0x590b76=this;return new Promise(function(_0x2ff997,_0x5e8576){return db['SmsQueueReport'][_0xdea4('0x1b')](_0x245349[_0xdea4('0x16')],{'raw':_0x245349[_0xdea4('0x17')]?_0x245349[_0xdea4('0x17')][_0xdea4('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x245349[_0xdea4('0x17')]?_0x245349['options'][_0xdea4('0x1c')]||null:null,'attributes':_0x245349[_0xdea4('0x17')]?_0x245349[_0xdea4('0x17')][_0xdea4('0x1d')]||null:null,'limit':_0x245349[_0xdea4('0x17')]?_0x245349[_0xdea4('0x17')]['limit']||null:null})['then'](function(_0x42f912){logger[_0xdea4('0x12')](_0xdea4('0x1e'),_0x245349);logger[_0xdea4('0xd')](_0xdea4('0x1e'),_0x245349,JSON[_0xdea4('0x19')](_0x42f912));_0x2ff997(_0x42f912);})[_0xdea4('0x13')](function(_0x3eadf7){logger[_0xdea4('0xf')](_0xdea4('0x1e'),_0x3eadf7[_0xdea4('0x11')],_0x245349);_0x5e8576(_0x590b76['error'](0x1f4,_0x3eadf7['message']));});});}; \ No newline at end of file +var _0xdb12=['limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','UpdateSmsQueueReport','where'];(function(_0x5233fd,_0x13b2fc){var _0x1b596b=function(_0x4b71e0){while(--_0x4b71e0){_0x5233fd['push'](_0x5233fd['shift']());}};_0x1b596b(++_0x13b2fc);}(_0xdb12,0x133));var _0x2db1=function(_0x3acee8,_0x5f3924){_0x3acee8=_0x3acee8-0x0;var _0x5046cc=_0xdb12[_0x3acee8];return _0x5046cc;};'use strict';var _=require(_0x2db1('0x0'));var util=require(_0x2db1('0x1'));var moment=require(_0x2db1('0x2'));var BPromise=require(_0x2db1('0x3'));var rs=require(_0x2db1('0x4'));var fs=require('fs');var Redis=require(_0x2db1('0x5'));var db=require(_0x2db1('0x6'))['db'];var utils=require(_0x2db1('0x7'));var logger=require(_0x2db1('0x8'))(_0x2db1('0x9'));var config=require(_0x2db1('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x2db1('0xb')][_0x2db1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41c007,_0x2d87a9,_0x278073){return new BPromise(function(_0x3fecb4,_0xbdef73){return client['request'](_0x41c007,_0x278073)[_0x2db1('0xd')](function(_0x374ed0){logger[_0x2db1('0xe')](_0x2db1('0xf'),_0x2d87a9,'request\x20sent');logger[_0x2db1('0x10')](_0x2db1('0x11'),_0x2d87a9,_0x2db1('0x12'),JSON[_0x2db1('0x13')](_0x374ed0));if(_0x374ed0['error']){if(_0x374ed0[_0x2db1('0x14')][_0x2db1('0x15')]===0x1f4){logger[_0x2db1('0x14')](_0x2db1('0xf'),_0x2d87a9,_0x374ed0['error'][_0x2db1('0x16')]);return _0xbdef73(_0x374ed0[_0x2db1('0x14')]['message']);}logger['error'](_0x2db1('0xf'),_0x2d87a9,_0x374ed0['error']['message']);return _0x3fecb4(_0x374ed0[_0x2db1('0x14')]['message']);}else{logger[_0x2db1('0xe')](_0x2db1('0xf'),_0x2d87a9,'request\x20sent');_0x3fecb4(_0x374ed0[_0x2db1('0x17')][_0x2db1('0x16')]);}})[_0x2db1('0x18')](function(_0x5cf8bf){logger['error'](_0x2db1('0xf'),_0x2d87a9,_0x5cf8bf);_0xbdef73(_0x5cf8bf);});});}exports[_0x2db1('0x19')]=function(_0x40f333){var _0x5a8126=this;return new Promise(function(_0x496419,_0x5ed11f){return db[_0x2db1('0x1a')][_0x2db1('0x1b')](_0x40f333[_0x2db1('0x1c')],{'raw':_0x40f333[_0x2db1('0x1d')]?_0x40f333[_0x2db1('0x1d')][_0x2db1('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x2b7184){logger[_0x2db1('0xe')](_0x2db1('0x19'),_0x40f333);logger['debug'](_0x2db1('0x19'),_0x40f333,JSON[_0x2db1('0x13')](_0x2b7184));_0x496419(_0x2b7184);})['catch'](function(_0xdc0729){logger[_0x2db1('0x14')]('CreateSmsQueueReport',_0xdc0729[_0x2db1('0x16')],_0x40f333);_0x5ed11f(_0x5a8126[_0x2db1('0x14')](0x1f4,_0xdc0729[_0x2db1('0x16')]));});});};exports[_0x2db1('0x1f')]=function(_0x1148b4){var _0x216a20=this;return new Promise(function(_0x21f6d7,_0x238488){return db[_0x2db1('0x1a')]['update'](_0x1148b4['body'],{'raw':_0x1148b4[_0x2db1('0x1d')]?_0x1148b4[_0x2db1('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1148b4[_0x2db1('0x1d')]?_0x1148b4[_0x2db1('0x1d')][_0x2db1('0x20')]||null:null,'attributes':_0x1148b4[_0x2db1('0x1d')]?_0x1148b4['options']['attributes']||null:null,'limit':_0x1148b4['options']?_0x1148b4[_0x2db1('0x1d')][_0x2db1('0x21')]||null:null})['then'](function(_0x4f66c8){logger[_0x2db1('0xe')]('UpdateSmsQueueReport',_0x1148b4);logger['debug'](_0x2db1('0x1f'),_0x1148b4,JSON['stringify'](_0x4f66c8));_0x21f6d7(_0x4f66c8);})['catch'](function(_0x4942ec){logger[_0x2db1('0x14')](_0x2db1('0x1f'),_0x4942ec[_0x2db1('0x16')],_0x1148b4);_0x238488(_0x216a20[_0x2db1('0x14')](0x1f4,_0x4942ec['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 5cca6bf..d005361 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 _0x8819=['show','create','put','update','delete','/:id','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x1a051d,_0x3a017a){var _0x275ccb=function(_0x1290ba){while(--_0x1290ba){_0x1a051d['push'](_0x1a051d['shift']());}};_0x275ccb(++_0x3a017a);}(_0x8819,0x94));var _0x9881=function(_0x173d5c,_0x517f05){_0x173d5c=_0x173d5c-0x0;var _0x62b424=_0x8819[_0x173d5c];return _0x62b424;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9881('0x0'));var timeout=require(_0x9881('0x1'));var express=require(_0x9881('0x2'));var router=express[_0x9881('0x3')]();var fs_extra=require(_0x9881('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9881('0x5'));var config=require(_0x9881('0x6'));var controller=require(_0x9881('0x7'));router[_0x9881('0x8')]('/',auth[_0x9881('0x9')](),controller[_0x9881('0xa')]);router['get'](_0x9881('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x9881('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x9881('0xc')]);router['post']('/',auth[_0x9881('0x9')](),controller[_0x9881('0xd')]);router[_0x9881('0xe')]('/:id',auth[_0x9881('0x9')](),controller[_0x9881('0xf')]);router[_0x9881('0x10')](_0x9881('0x11'),auth['isAuthenticated'](),controller[_0x9881('0x12')]);module[_0x9881('0x13')]=router; \ No newline at end of file +var _0xb647=['get','isAuthenticated','index','/describe','describe','/:id','show','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x48dec4,_0x2284f8){var _0x31d38b=function(_0x1f5cf4){while(--_0x1f5cf4){_0x48dec4['push'](_0x48dec4['shift']());}};_0x31d38b(++_0x2284f8);}(_0xb647,0xdb));var _0x7b64=function(_0xda90d7,_0x2f62f5){_0xda90d7=_0xda90d7-0x0;var _0x520af6=_0xb647[_0xda90d7];return _0x520af6;};'use strict';var multer=require(_0x7b64('0x0'));var util=require(_0x7b64('0x1'));var path=require(_0x7b64('0x2'));var timeout=require(_0x7b64('0x3'));var express=require(_0x7b64('0x4'));var router=express[_0x7b64('0x5')]();var fs_extra=require(_0x7b64('0x6'));var auth=require(_0x7b64('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7b64('0x8'));var controller=require('./smsTransferReport.controller');router[_0x7b64('0x9')]('/',auth[_0x7b64('0xa')](),controller[_0x7b64('0xb')]);router[_0x7b64('0x9')](_0x7b64('0xc'),auth[_0x7b64('0xa')](),controller[_0x7b64('0xd')]);router[_0x7b64('0x9')](_0x7b64('0xe'),auth['isAuthenticated'](),controller[_0x7b64('0xf')]);router['post']('/',auth[_0x7b64('0xa')](),controller['create']);router['put'](_0x7b64('0xe'),auth[_0x7b64('0xa')](),controller['update']);router[_0x7b64('0x10')](_0x7b64('0xe'),auth[_0x7b64('0xa')](),controller[_0x7b64('0x11')]);module[_0x7b64('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 3e2f25d..6bb5166 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x214230,_0x5b95ab){var _0x1544c0=function(_0x5bb5bc){while(--_0x5bb5bc){_0x214230['push'](_0x214230['shift']());}};_0x1544c0(++_0x5b95ab);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x00bb[_0x1ac595];return _0x455fff;};'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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x29c983,_0x18e322){var _0x3c8d10=function(_0x585e75){while(--_0x585e75){_0x29c983['push'](_0x29c983['shift']());}};_0x3c8d10(++_0x18e322);}(_0xedd9,0xfc));var _0x9edd=function(_0x4e7f0c,_0x55e6a7){_0x4e7f0c=_0x4e7f0c-0x0;var _0x19c6b1=_0xedd9[_0x4e7f0c];return _0x19c6b1;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index d310651..1c4bb6a 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 _0x21ff=['reject','update','then','destroy','error','stack','name','send','SmsTransferReport','type','key','map','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x21ff,0xb6));var _0xf21f=function(_0xf34109,_0x380779){_0xf34109=_0xf34109-0x0;var _0x570bfc=_0x21ff[_0xf34109];return _0x570bfc;};'use strict';var emlformat=require(_0xf21f('0x0'));var rimraf=require(_0xf21f('0x1'));var zipdir=require(_0xf21f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf21f('0x3'));var moment=require(_0xf21f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf21f('0x5'));var util=require('util');var path=require(_0xf21f('0x6'));var sox=require(_0xf21f('0x7'));var csv=require('to-csv');var ejs=require(_0xf21f('0x8'));var fs=require('fs');var fs_extra=require(_0xf21f('0x9'));var _=require(_0xf21f('0xa'));var squel=require(_0xf21f('0xb'));var crypto=require(_0xf21f('0xc'));var jsforce=require(_0xf21f('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf21f('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf21f('0xf'));var qs=require(_0xf21f('0x10'));var as=require(_0xf21f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf21f('0x12'))(_0xf21f('0x13'));var utils=require(_0xf21f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf21f('0x15'));var db=require(_0xf21f('0x16'))['db'];function respondWithStatusCode(_0x12c6fb,_0x1137c0){_0x1137c0=_0x1137c0||0xcc;return function(_0x1b4855){if(_0x1b4855){return _0x12c6fb[_0xf21f('0x17')](_0x1137c0);}return _0x12c6fb[_0xf21f('0x18')](_0x1137c0)[_0xf21f('0x19')]();};}function respondWithResult(_0x4b5814,_0x47ba59){_0x47ba59=_0x47ba59||0xc8;return function(_0x41cc52){if(_0x41cc52){return _0x4b5814[_0xf21f('0x18')](_0x47ba59)[_0xf21f('0x1a')](_0x41cc52);}};}function respondWithFilteredResult(_0x1bcf86,_0x226d13){return function(_0x4482b1){if(_0x4482b1){var _0x1c1a75=typeof _0x226d13[_0xf21f('0x1b')]==='undefined'&&typeof _0x226d13[_0xf21f('0x1c')]===_0xf21f('0x1d');var _0x3a882e=_0x4482b1[_0xf21f('0x1e')];var _0x4f4c46=_0x1c1a75?0x0:_0x226d13['offset'];var _0x5dd80c=_0x1c1a75?_0x4482b1['count']:_0x226d13[_0xf21f('0x1b')]+_0x226d13[_0xf21f('0x1c')];var _0x40b8f5;if(_0x5dd80c>=_0x3a882e){_0x5dd80c=_0x3a882e;_0x40b8f5=0xc8;}else{_0x40b8f5=0xce;}_0x1bcf86[_0xf21f('0x18')](_0x40b8f5);return _0x1bcf86[_0xf21f('0x1f')](_0xf21f('0x20'),_0x4f4c46+'-'+_0x5dd80c+'/'+_0x3a882e)[_0xf21f('0x1a')](_0x4482b1);}return null;};}function patchUpdates(_0xf90b71){return function(_0x480411){try{jsonpatch[_0xf21f('0x21')](_0x480411,_0xf90b71,!![]);}catch(_0x3b8a97){return BPromise[_0xf21f('0x22')](_0x3b8a97);}return _0x480411['save']();};}function saveUpdates(_0x300e69,_0x2911ee){return function(_0xdf7e7f){if(_0xdf7e7f){return _0xdf7e7f[_0xf21f('0x23')](_0x300e69)[_0xf21f('0x24')](function(_0x308014){return _0x308014;});}return null;};}function removeEntity(_0x5b622e,_0x306b92){return function(_0x13a0ca){if(_0x13a0ca){return _0x13a0ca[_0xf21f('0x25')]()[_0xf21f('0x24')](function(){_0x5b622e['status'](0xcc)[_0xf21f('0x19')]();});}};}function handleEntityNotFound(_0x4a3d2b,_0x2bcdb0){return function(_0x493e98){if(!_0x493e98){_0x4a3d2b[_0xf21f('0x17')](0x194);}return _0x493e98;};}function handleError(_0x467f01,_0x1a49c6){_0x1a49c6=_0x1a49c6||0x1f4;return function(_0x19606f){logger[_0xf21f('0x26')](_0x19606f[_0xf21f('0x27')]);if(_0x19606f[_0xf21f('0x28')]){delete _0x19606f[_0xf21f('0x28')];}_0x467f01[_0xf21f('0x18')](_0x1a49c6)[_0xf21f('0x29')](_0x19606f);};}exports['index']=function(_0x23746c,_0x56f8dd){var _0xe530a1={},_0x5c2a16={},_0x3e0b3c={'count':0x0,'rows':[]};var _0x1eb0da=_['map'](db[_0xf21f('0x2a')]['rawAttributes'],function(_0x36484b){return{'name':_0x36484b['fieldName'],'type':_0x36484b[_0xf21f('0x2b')][_0xf21f('0x2c')]};});_0x5c2a16['model']=_[_0xf21f('0x2d')](_0x1eb0da,'name');_0x5c2a16[_0xf21f('0x2e')]=_['keys'](_0x23746c['query']);_0x5c2a16[_0xf21f('0x2f')]=_[_0xf21f('0x30')](_0x5c2a16[_0xf21f('0x31')],_0x5c2a16[_0xf21f('0x2e')]);_0xe530a1[_0xf21f('0x32')]=_['intersection'](_0x5c2a16[_0xf21f('0x31')],qs[_0xf21f('0x33')](_0x23746c[_0xf21f('0x2e')][_0xf21f('0x33')]));_0xe530a1['attributes']=_0xe530a1[_0xf21f('0x32')]['length']?_0xe530a1[_0xf21f('0x32')]:_0x5c2a16['model'];if(!_0x23746c[_0xf21f('0x2e')][_0xf21f('0x34')]('nolimit')){_0xe530a1['limit']=qs['limit'](_0x23746c[_0xf21f('0x2e')][_0xf21f('0x1c')]);_0xe530a1['offset']=qs[_0xf21f('0x1b')](_0x23746c[_0xf21f('0x2e')]['offset']);}_0xe530a1[_0xf21f('0x35')]=qs[_0xf21f('0x36')](_0x23746c[_0xf21f('0x2e')][_0xf21f('0x36')]);_0xe530a1[_0xf21f('0x37')]=qs[_0xf21f('0x2f')](_[_0xf21f('0x38')](_0x23746c[_0xf21f('0x2e')],_0x5c2a16[_0xf21f('0x2f')]),_0x1eb0da);if(_0x23746c[_0xf21f('0x2e')]['filter']){_0xe530a1[_0xf21f('0x37')]=_[_0xf21f('0x39')](_0xe530a1[_0xf21f('0x37')],{'$or':_[_0xf21f('0x2d')](_0x1eb0da,function(_0x497206){if(_0x497206[_0xf21f('0x2b')]!==_0xf21f('0x3a')){var _0x23d7b4={};_0x23d7b4[_0x497206['name']]={'$like':'%'+_0x23746c[_0xf21f('0x2e')][_0xf21f('0x3b')]+'%'};return _0x23d7b4;}})});}_0xe530a1=_[_0xf21f('0x39')]({},_0xe530a1,_0x23746c[_0xf21f('0x3c')]);var _0x4ee3bb={'where':_0xe530a1[_0xf21f('0x37')]};return db[_0xf21f('0x2a')][_0xf21f('0x1e')](_0x4ee3bb)[_0xf21f('0x24')](function(_0x12a7ca){_0x3e0b3c[_0xf21f('0x1e')]=_0x12a7ca;if(_0x23746c[_0xf21f('0x2e')]['includeAll']){_0xe530a1[_0xf21f('0x3d')]=[{'all':!![]}];}return db[_0xf21f('0x2a')]['findAll'](_0xe530a1);})[_0xf21f('0x24')](function(_0x23fde5){_0x3e0b3c[_0xf21f('0x3e')]=_0x23fde5;return _0x3e0b3c;})[_0xf21f('0x24')](respondWithFilteredResult(_0x56f8dd,_0xe530a1))[_0xf21f('0x3f')](handleError(_0x56f8dd,null));};exports[_0xf21f('0x40')]=function(_0x2eb1cb,_0x409dda){var _0x1d0626={'raw':!![],'where':{'id':_0x2eb1cb[_0xf21f('0x41')]['id']}},_0x4fcbdf={};_0x4fcbdf[_0xf21f('0x31')]=_['keys'](db[_0xf21f('0x2a')][_0xf21f('0x42')]);_0x4fcbdf[_0xf21f('0x2e')]=_['keys'](_0x2eb1cb['query']);_0x4fcbdf[_0xf21f('0x2f')]=_[_0xf21f('0x30')](_0x4fcbdf['model'],_0x4fcbdf['query']);_0x1d0626['attributes']=_[_0xf21f('0x30')](_0x4fcbdf[_0xf21f('0x31')],qs['fields'](_0x2eb1cb[_0xf21f('0x2e')][_0xf21f('0x33')]));_0x1d0626['attributes']=_0x1d0626['attributes'][_0xf21f('0x43')]?_0x1d0626[_0xf21f('0x32')]:_0x4fcbdf[_0xf21f('0x31')];if(_0x2eb1cb[_0xf21f('0x2e')]['includeAll']){_0x1d0626['include']=[{'all':!![]}];}_0x1d0626=_['merge']({},_0x1d0626,_0x2eb1cb['options']);return db[_0xf21f('0x2a')][_0xf21f('0x44')](_0x1d0626)[_0xf21f('0x24')](handleEntityNotFound(_0x409dda,null))[_0xf21f('0x24')](respondWithResult(_0x409dda,null))[_0xf21f('0x3f')](handleError(_0x409dda,null));};exports[_0xf21f('0x45')]=function(_0xd7da92,_0x4512dc){return db['SmsTransferReport'][_0xf21f('0x45')](_0xd7da92['body'],{})['then'](respondWithResult(_0x4512dc,0xc9))['catch'](handleError(_0x4512dc,null));};exports[_0xf21f('0x23')]=function(_0x2baaea,_0x3d7efa){if(_0x2baaea[_0xf21f('0x46')]['id']){delete _0x2baaea['body']['id'];}return db[_0xf21f('0x2a')][_0xf21f('0x44')]({'where':{'id':_0x2baaea[_0xf21f('0x41')]['id']}})[_0xf21f('0x24')](handleEntityNotFound(_0x3d7efa,null))['then'](saveUpdates(_0x2baaea['body'],null))[_0xf21f('0x24')](respondWithResult(_0x3d7efa,null))[_0xf21f('0x3f')](handleError(_0x3d7efa,null));};exports[_0xf21f('0x25')]=function(_0x2dd01c,_0x4bc638){return db['SmsTransferReport'][_0xf21f('0x44')]({'where':{'id':_0x2dd01c[_0xf21f('0x41')]['id']}})[_0xf21f('0x24')](handleEntityNotFound(_0x4bc638,null))[_0xf21f('0x24')](removeEntity(_0x4bc638,null))[_0xf21f('0x3f')](handleError(_0x4bc638,null));};exports['describe']=function(_0x5e701a,_0x4380cd){return db[_0xf21f('0x2a')][_0xf21f('0x47')]()['then'](respondWithResult(_0x4380cd,null))[_0xf21f('0x3f')](handleError(_0x4380cd,null));}; \ No newline at end of file +var _0xa342=['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/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','SmsTransferReport','rawAttributes','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv'];(function(_0x3427c8,_0x2713c2){var _0x1a90d5=function(_0x356eec){while(--_0x356eec){_0x3427c8['push'](_0x3427c8['shift']());}};_0x1a90d5(++_0x2713c2);}(_0xa342,0x18b));var _0x2a34=function(_0x6fa132,_0x5ccdc5){_0x6fa132=_0x6fa132-0x0;var _0x22c750=_0xa342[_0x6fa132];return _0x22c750;};'use strict';var emlformat=require(_0x2a34('0x0'));var rimraf=require(_0x2a34('0x1'));var zipdir=require(_0x2a34('0x2'));var jsonpatch=require(_0x2a34('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2a34('0x4'));var Mustache=require(_0x2a34('0x5'));var util=require(_0x2a34('0x6'));var path=require(_0x2a34('0x7'));var sox=require(_0x2a34('0x8'));var csv=require(_0x2a34('0x9'));var ejs=require(_0x2a34('0xa'));var fs=require('fs');var fs_extra=require(_0x2a34('0xb'));var _=require('lodash');var squel=require(_0x2a34('0xc'));var crypto=require(_0x2a34('0xd'));var jsforce=require(_0x2a34('0xe'));var deskjs=require(_0x2a34('0xf'));var toCsv=require(_0x2a34('0x9'));var querystring=require(_0x2a34('0x10'));var Papa=require(_0x2a34('0x11'));var Redis=require(_0x2a34('0x12'));var authService=require(_0x2a34('0x13'));var qs=require(_0x2a34('0x14'));var as=require(_0x2a34('0x15'));var hardwareService=require(_0x2a34('0x16'));var logger=require(_0x2a34('0x17'))(_0x2a34('0x18'));var utils=require(_0x2a34('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x2a34('0x1a'));var db=require(_0x2a34('0x1b'))['db'];function respondWithStatusCode(_0x534b94,_0x2c8694){_0x2c8694=_0x2c8694||0xcc;return function(_0x17e6c3){if(_0x17e6c3){return _0x534b94[_0x2a34('0x1c')](_0x2c8694);}return _0x534b94[_0x2a34('0x1d')](_0x2c8694)[_0x2a34('0x1e')]();};}function respondWithResult(_0x36ec52,_0x2c29ab){_0x2c29ab=_0x2c29ab||0xc8;return function(_0x41a7d5){if(_0x41a7d5){return _0x36ec52[_0x2a34('0x1d')](_0x2c29ab)[_0x2a34('0x1f')](_0x41a7d5);}};}function respondWithFilteredResult(_0x412378,_0x231415){return function(_0x22f8e6){if(_0x22f8e6){var _0x3572b8=typeof _0x231415[_0x2a34('0x20')]===_0x2a34('0x21')&&typeof _0x231415['limit']===_0x2a34('0x21');var _0x4f4631=_0x22f8e6[_0x2a34('0x22')];var _0x59b791=_0x3572b8?0x0:_0x231415[_0x2a34('0x20')];var _0x27bbfe=_0x3572b8?_0x22f8e6[_0x2a34('0x22')]:_0x231415[_0x2a34('0x20')]+_0x231415[_0x2a34('0x23')];var _0x54f76b;if(_0x27bbfe>=_0x4f4631){_0x27bbfe=_0x4f4631;_0x54f76b=0xc8;}else{_0x54f76b=0xce;}_0x412378[_0x2a34('0x1d')](_0x54f76b);return _0x412378[_0x2a34('0x24')](_0x2a34('0x25'),_0x59b791+'-'+_0x27bbfe+'/'+_0x4f4631)['json'](_0x22f8e6);}return null;};}function patchUpdates(_0x77980f){return function(_0x97f8){try{jsonpatch[_0x2a34('0x26')](_0x97f8,_0x77980f,!![]);}catch(_0x4828f7){return BPromise[_0x2a34('0x27')](_0x4828f7);}return _0x97f8[_0x2a34('0x28')]();};}function saveUpdates(_0x4a68a7,_0x2750cd){return function(_0x1fcb7){if(_0x1fcb7){return _0x1fcb7[_0x2a34('0x29')](_0x4a68a7)[_0x2a34('0x2a')](function(_0x3c4ac5){return _0x3c4ac5;});}return null;};}function removeEntity(_0x478e73,_0x5467b5){return function(_0x24b248){if(_0x24b248){return _0x24b248[_0x2a34('0x2b')]()['then'](function(){_0x478e73[_0x2a34('0x1d')](0xcc)[_0x2a34('0x1e')]();});}};}function handleEntityNotFound(_0x1a68df,_0x34fa2a){return function(_0x53799b){if(!_0x53799b){_0x1a68df[_0x2a34('0x1c')](0x194);}return _0x53799b;};}function handleError(_0x37113f,_0x4e165d){_0x4e165d=_0x4e165d||0x1f4;return function(_0x548739){logger[_0x2a34('0x2c')](_0x548739[_0x2a34('0x2d')]);if(_0x548739[_0x2a34('0x2e')]){delete _0x548739[_0x2a34('0x2e')];}_0x37113f['status'](_0x4e165d)[_0x2a34('0x2f')](_0x548739);};}exports[_0x2a34('0x30')]=function(_0x3292a4,_0x28613a){var _0x2b603b={},_0x32971c={},_0x39dae5={'count':0x0,'rows':[]};var _0x455cf6=_['map'](db[_0x2a34('0x31')][_0x2a34('0x32')],function(_0x9e0032){return{'name':_0x9e0032['fieldName'],'type':_0x9e0032['type'][_0x2a34('0x33')]};});_0x32971c[_0x2a34('0x34')]=_[_0x2a34('0x35')](_0x455cf6,_0x2a34('0x2e'));_0x32971c[_0x2a34('0x36')]=_[_0x2a34('0x37')](_0x3292a4['query']);_0x32971c['filters']=_['intersection'](_0x32971c['model'],_0x32971c[_0x2a34('0x36')]);_0x2b603b[_0x2a34('0x38')]=_[_0x2a34('0x39')](_0x32971c[_0x2a34('0x34')],qs[_0x2a34('0x3a')](_0x3292a4[_0x2a34('0x36')][_0x2a34('0x3a')]));_0x2b603b[_0x2a34('0x38')]=_0x2b603b['attributes'][_0x2a34('0x3b')]?_0x2b603b['attributes']:_0x32971c[_0x2a34('0x34')];if(!_0x3292a4['query'][_0x2a34('0x3c')](_0x2a34('0x3d'))){_0x2b603b[_0x2a34('0x23')]=qs[_0x2a34('0x23')](_0x3292a4[_0x2a34('0x36')][_0x2a34('0x23')]);_0x2b603b[_0x2a34('0x20')]=qs[_0x2a34('0x20')](_0x3292a4[_0x2a34('0x36')][_0x2a34('0x20')]);}_0x2b603b['order']=qs[_0x2a34('0x3e')](_0x3292a4[_0x2a34('0x36')]['sort']);_0x2b603b[_0x2a34('0x3f')]=qs[_0x2a34('0x40')](_[_0x2a34('0x41')](_0x3292a4[_0x2a34('0x36')],_0x32971c[_0x2a34('0x40')]),_0x455cf6);if(_0x3292a4['query'][_0x2a34('0x42')]){_0x2b603b[_0x2a34('0x3f')]=_[_0x2a34('0x43')](_0x2b603b[_0x2a34('0x3f')],{'$or':_[_0x2a34('0x35')](_0x455cf6,function(_0x2b5d1f){if(_0x2b5d1f['type']!==_0x2a34('0x44')){var _0x4160db={};_0x4160db[_0x2b5d1f[_0x2a34('0x2e')]]={'$like':'%'+_0x3292a4[_0x2a34('0x36')][_0x2a34('0x42')]+'%'};return _0x4160db;}})});}_0x2b603b=_[_0x2a34('0x43')]({},_0x2b603b,_0x3292a4[_0x2a34('0x45')]);var _0x586fa2={'where':_0x2b603b[_0x2a34('0x3f')]};return db['SmsTransferReport'][_0x2a34('0x22')](_0x586fa2)['then'](function(_0x31e811){_0x39dae5[_0x2a34('0x22')]=_0x31e811;if(_0x3292a4[_0x2a34('0x36')]['includeAll']){_0x2b603b[_0x2a34('0x46')]=[{'all':!![]}];}return db[_0x2a34('0x31')][_0x2a34('0x47')](_0x2b603b);})['then'](function(_0x346254){_0x39dae5[_0x2a34('0x48')]=_0x346254;return _0x39dae5;})[_0x2a34('0x2a')](respondWithFilteredResult(_0x28613a,_0x2b603b))[_0x2a34('0x49')](handleError(_0x28613a,null));};exports[_0x2a34('0x4a')]=function(_0x3b78b5,_0x2cdb99){var _0x29878e={'raw':!![],'where':{'id':_0x3b78b5[_0x2a34('0x4b')]['id']}},_0x76b118={};_0x76b118[_0x2a34('0x34')]=_['keys'](db[_0x2a34('0x31')]['rawAttributes']);_0x76b118['query']=_['keys'](_0x3b78b5[_0x2a34('0x36')]);_0x76b118[_0x2a34('0x40')]=_[_0x2a34('0x39')](_0x76b118[_0x2a34('0x34')],_0x76b118['query']);_0x29878e[_0x2a34('0x38')]=_[_0x2a34('0x39')](_0x76b118[_0x2a34('0x34')],qs[_0x2a34('0x3a')](_0x3b78b5[_0x2a34('0x36')][_0x2a34('0x3a')]));_0x29878e[_0x2a34('0x38')]=_0x29878e[_0x2a34('0x38')][_0x2a34('0x3b')]?_0x29878e[_0x2a34('0x38')]:_0x76b118['model'];if(_0x3b78b5[_0x2a34('0x36')][_0x2a34('0x4c')]){_0x29878e[_0x2a34('0x46')]=[{'all':!![]}];}_0x29878e=_['merge']({},_0x29878e,_0x3b78b5[_0x2a34('0x45')]);return db[_0x2a34('0x31')][_0x2a34('0x4d')](_0x29878e)[_0x2a34('0x2a')](handleEntityNotFound(_0x2cdb99,null))['then'](respondWithResult(_0x2cdb99,null))[_0x2a34('0x49')](handleError(_0x2cdb99,null));};exports['create']=function(_0x426ef6,_0x428950){return db[_0x2a34('0x31')][_0x2a34('0x4e')](_0x426ef6[_0x2a34('0x4f')],{})[_0x2a34('0x2a')](respondWithResult(_0x428950,0xc9))[_0x2a34('0x49')](handleError(_0x428950,null));};exports[_0x2a34('0x29')]=function(_0x5fd66a,_0x29b4df){if(_0x5fd66a[_0x2a34('0x4f')]['id']){delete _0x5fd66a['body']['id'];}return db[_0x2a34('0x31')][_0x2a34('0x4d')]({'where':{'id':_0x5fd66a[_0x2a34('0x4b')]['id']}})[_0x2a34('0x2a')](handleEntityNotFound(_0x29b4df,null))[_0x2a34('0x2a')](saveUpdates(_0x5fd66a[_0x2a34('0x4f')],null))[_0x2a34('0x2a')](respondWithResult(_0x29b4df,null))[_0x2a34('0x49')](handleError(_0x29b4df,null));};exports[_0x2a34('0x2b')]=function(_0x2b76df,_0x33e2d4){return db['SmsTransferReport'][_0x2a34('0x4d')]({'where':{'id':_0x2b76df['params']['id']}})['then'](handleEntityNotFound(_0x33e2d4,null))['then'](removeEntity(_0x33e2d4,null))[_0x2a34('0x49')](handleError(_0x33e2d4,null));};exports[_0x2a34('0x50')]=function(_0x2d444b,_0x54d9df){return db[_0x2a34('0x31')]['describe']()[_0x2a34('0x2a')](respondWithResult(_0x54d9df,null))[_0x2a34('0x49')](handleError(_0x54d9df,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 45affd3..fb58f5c 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 _0x359a=['define','SmsTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports'];(function(_0x5619c3,_0x568923){var _0x66cf19=function(_0x3028da){while(--_0x3028da){_0x5619c3['push'](_0x5619c3['shift']());}};_0x66cf19(++_0x568923);}(_0x359a,0x153));var _0xa359=function(_0x496fba,_0x1db6bc){_0x496fba=_0x496fba-0x0;var _0xe3e181=_0x359a[_0x496fba];return _0xe3e181;};'use strict';var _=require(_0xa359('0x0'));var util=require(_0xa359('0x1'));var logger=require(_0xa359('0x2'))(_0xa359('0x3'));var moment=require(_0xa359('0x4'));var BPromise=require('bluebird');var rp=require(_0xa359('0x5'));var fs=require('fs');var path=require(_0xa359('0x6'));var rimraf=require(_0xa359('0x7'));var config=require(_0xa359('0x8'));var attributes=require(_0xa359('0x9'));module[_0xa359('0xa')]=function(_0xbaaeb4,_0x1bd70e){return _0xbaaeb4[_0xa359('0xb')](_0xa359('0xc'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xa359('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb1be=['report_sms_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','SmsTransferReport'];(function(_0x2302a1,_0x4bc33d){var _0x413cae=function(_0x233632){while(--_0x233632){_0x2302a1['push'](_0x2302a1['shift']());}};_0x413cae(++_0x4bc33d);}(_0xb1be,0x1c9));var _0xeb1b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb1be[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xeb1b('0x0'));var util=require(_0xeb1b('0x1'));var logger=require(_0xeb1b('0x2'))('api');var moment=require(_0xeb1b('0x3'));var BPromise=require(_0xeb1b('0x4'));var rp=require(_0xeb1b('0x5'));var fs=require('fs');var path=require(_0xeb1b('0x6'));var rimraf=require(_0xeb1b('0x7'));var config=require(_0xeb1b('0x8'));var attributes=require(_0xeb1b('0x9'));module['exports']=function(_0x11be51,_0x5270c7){return _0x11be51['define'](_0xeb1b('0xa'),attributes,{'tableName':_0xeb1b('0xb'),'paranoid':![],'indexes':[{'name':_0xeb1b('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 8ec2e55..430603e 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 _0x046b=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','util','moment','bluebird'];(function(_0xc70b15,_0x3425e3){var _0x496077=function(_0x57feee){while(--_0x57feee){_0xc70b15['push'](_0xc70b15['shift']());}};_0x496077(++_0x3425e3);}(_0x046b,0x147));var _0xb046=function(_0x564dd7,_0x248174){_0x564dd7=_0x564dd7-0x0;var _0xede844=_0x046b[_0x564dd7];return _0xede844;};'use strict';var _=require('lodash');var util=require(_0xb046('0x0'));var moment=require(_0xb046('0x1'));var BPromise=require(_0xb046('0x2'));var rs=require(_0xb046('0x3'));var fs=require('fs');var Redis=require(_0xb046('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb046('0x5'));var logger=require(_0xb046('0x6'))(_0xb046('0x7'));var config=require(_0xb046('0x8'));var jayson=require(_0xb046('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x13203d,_0x1f00c8,_0x190c9a){return new BPromise(function(_0x308e79,_0x3c0678){return client[_0xb046('0xa')](_0x13203d,_0x190c9a)[_0xb046('0xb')](function(_0x170b66){logger['info'](_0xb046('0xc'),_0x1f00c8,'request\x20sent');logger[_0xb046('0xd')](_0xb046('0xe'),_0x1f00c8,_0xb046('0xf'),JSON[_0xb046('0x10')](_0x170b66));if(_0x170b66[_0xb046('0x11')]){if(_0x170b66['error']['code']===0x1f4){logger['error'](_0xb046('0xc'),_0x1f00c8,_0x170b66[_0xb046('0x11')]['message']);return _0x3c0678(_0x170b66[_0xb046('0x11')]['message']);}logger[_0xb046('0x11')](_0xb046('0xc'),_0x1f00c8,_0x170b66['error'][_0xb046('0x12')]);return _0x308e79(_0x170b66[_0xb046('0x11')][_0xb046('0x12')]);}else{logger[_0xb046('0x13')](_0xb046('0xc'),_0x1f00c8,'request\x20sent');_0x308e79(_0x170b66[_0xb046('0x14')][_0xb046('0x12')]);}})[_0xb046('0x15')](function(_0xa3b910){logger[_0xb046('0x11')](_0xb046('0xc'),_0x1f00c8,_0xa3b910);_0x3c0678(_0xa3b910);});});} \ No newline at end of file +var _0x4b19=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x134afd,_0x276b1a){var _0x5280ab=function(_0x38a079){while(--_0x38a079){_0x134afd['push'](_0x134afd['shift']());}};_0x5280ab(++_0x276b1a);}(_0x4b19,0x195));var _0x94b1=function(_0x770605,_0x55ef0a){_0x770605=_0x770605-0x0;var _0x52dd64=_0x4b19[_0x770605];return _0x52dd64;};'use strict';var _=require(_0x94b1('0x0'));var util=require('util');var moment=require(_0x94b1('0x1'));var BPromise=require(_0x94b1('0x2'));var rs=require(_0x94b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x94b1('0x4'))['db'];var utils=require(_0x94b1('0x5'));var logger=require(_0x94b1('0x6'))('rpc');var config=require(_0x94b1('0x7'));var jayson=require(_0x94b1('0x8'));var client=jayson['client'][_0x94b1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x110a52,_0x4ea1f9,_0x40c69c){return new BPromise(function(_0x201a02,_0xad0a85){return client['request'](_0x110a52,_0x40c69c)[_0x94b1('0xa')](function(_0x4f948b){logger['info'](_0x94b1('0xb'),_0x4ea1f9,_0x94b1('0xc'));logger[_0x94b1('0xd')](_0x94b1('0xe'),_0x4ea1f9,_0x94b1('0xc'),JSON[_0x94b1('0xf')](_0x4f948b));if(_0x4f948b['error']){if(_0x4f948b[_0x94b1('0x10')][_0x94b1('0x11')]===0x1f4){logger[_0x94b1('0x10')](_0x94b1('0xb'),_0x4ea1f9,_0x4f948b['error']['message']);return _0xad0a85(_0x4f948b[_0x94b1('0x10')][_0x94b1('0x12')]);}logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x4ea1f9,_0x4f948b[_0x94b1('0x10')][_0x94b1('0x12')]);return _0x201a02(_0x4f948b['error'][_0x94b1('0x12')]);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x4ea1f9,_0x94b1('0xc'));_0x201a02(_0x4f948b[_0x94b1('0x13')][_0x94b1('0x12')]);}})[_0x94b1('0x14')](function(_0x494138){logger[_0x94b1('0x10')](_0x94b1('0xb'),_0x4ea1f9,_0x494138);_0xad0a85(_0x494138);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index e46fe17..97aacf5 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 _0x6dcd=['create','/:id','delete','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','download','diskStorage','root','server/files/sounds/original/','originalname','replace','basename','now','extname','single','file'];(function(_0x1489cd,_0x3d3a64){var _0x9e63d7=function(_0x81a609){while(--_0x81a609){_0x1489cd['push'](_0x1489cd['shift']());}};_0x9e63d7(++_0x3d3a64);}(_0x6dcd,0x130));var _0xd6dc=function(_0x4b5adf,_0x1c4db4){_0x4b5adf=_0x4b5adf-0x0;var _0x3b2175=_0x6dcd[_0x4b5adf];return _0x3b2175;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd6dc('0x0'));var timeout=require(_0xd6dc('0x1'));var express=require(_0xd6dc('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd6dc('0x3'));var interaction=require(_0xd6dc('0x4'));var config=require(_0xd6dc('0x5'));var controller=require('./sound.controller');router[_0xd6dc('0x6')]('/',auth[_0xd6dc('0x7')](),controller[_0xd6dc('0x8')]);router[_0xd6dc('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xd6dc('0x9')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xd6dc('0xa')]);var upload=multer({'storage':multer[_0xd6dc('0xb')]({'destination':function(_0x3372c8,_0x4f156b,_0x14c4a9){_0x14c4a9(null,path['join'](config[_0xd6dc('0xc')],_0xd6dc('0xd')));},'filename':function(_0x4325dd,_0xf74105,_0x1d418a){_0xf74105[_0xd6dc('0xe')]=_0xf74105['originalname'][_0xd6dc('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1d418a(null,util['format']('%s-%s%s',path[_0xd6dc('0x10')](_0xf74105[_0xd6dc('0xe')],path['extname'](_0xf74105[_0xd6dc('0xe')])),Date[_0xd6dc('0x11')](),path[_0xd6dc('0x12')](_0xf74105['originalname'])));}})});router['post']('/',upload[_0xd6dc('0x13')](_0xd6dc('0x14')),controller[_0xd6dc('0x15')]);router['put'](_0xd6dc('0x16'),auth[_0xd6dc('0x7')](),controller['update']);router[_0xd6dc('0x17')]('/:id',auth[_0xd6dc('0x7')](),controller[_0xd6dc('0x17')]);module[_0xd6dc('0x18')]=router; \ No newline at end of file +var _0x82f5=['originalname','replace','format','basename','now','post','single','file','create','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./sound.controller','get','index','isAuthenticated','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/'];(function(_0x5d7b12,_0x35077c){var _0x208bc0=function(_0x35ca14){while(--_0x35ca14){_0x5d7b12['push'](_0x5d7b12['shift']());}};_0x208bc0(++_0x35077c);}(_0x82f5,0xe6));var _0x582f=function(_0x1f98b1,_0x3140fe){_0x1f98b1=_0x1f98b1-0x0;var _0x58f42b=_0x82f5[_0x1f98b1];return _0x58f42b;};'use strict';var multer=require(_0x582f('0x0'));var util=require(_0x582f('0x1'));var path=require('path');var timeout=require(_0x582f('0x2'));var express=require(_0x582f('0x3'));var router=express[_0x582f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x582f('0x5'));var config=require(_0x582f('0x6'));var controller=require(_0x582f('0x7'));router[_0x582f('0x8')]('/',auth['isAuthenticated'](),controller[_0x582f('0x9')]);router[_0x582f('0x8')]('/:id',auth[_0x582f('0xa')](),controller[_0x582f('0xb')]);router[_0x582f('0x8')](_0x582f('0xc'),auth[_0x582f('0xa')](),controller[_0x582f('0xd')]);var upload=multer({'storage':multer[_0x582f('0xe')]({'destination':function(_0x58e0a8,_0x1e7946,_0xfefcc7){_0xfefcc7(null,path[_0x582f('0xf')](config[_0x582f('0x10')],_0x582f('0x11')));},'filename':function(_0x443cf7,_0x6f3033,_0x46ae8c){_0x6f3033[_0x582f('0x12')]=_0x6f3033[_0x582f('0x12')][_0x582f('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x46ae8c(null,util[_0x582f('0x14')]('%s-%s%s',path[_0x582f('0x15')](_0x6f3033[_0x582f('0x12')],path['extname'](_0x6f3033[_0x582f('0x12')])),Date[_0x582f('0x16')](),path['extname'](_0x6f3033[_0x582f('0x12')])));}})});router[_0x582f('0x17')]('/',upload[_0x582f('0x18')](_0x582f('0x19')),controller[_0x582f('0x1a')]);router['put'](_0x582f('0x1b'),auth[_0x582f('0xa')](),controller[_0x582f('0x1c')]);router[_0x582f('0x1d')](_0x582f('0x1b'),auth[_0x582f('0xa')](),controller[_0x582f('0x1d')]);module[_0x582f('0x1e')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 17c5a1b..f952c57 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 _0xd8c2=['sequelize','STRING','name','FLOAT','BIGINT','INTEGER'];(function(_0x23099a,_0x2b5805){var _0x37d69c=function(_0xd2830e){while(--_0xd2830e){_0x23099a['push'](_0x23099a['shift']());}};_0x37d69c(++_0x2b5805);}(_0xd8c2,0x1bc));var _0x2d8c=function(_0x23ce61,_0x5278a1){_0x23ce61=_0x23ce61-0x0;var _0x2adcb4=_0xd8c2[_0x23ce61];return _0x2adcb4;};'use strict';var Sequelize=require(_0x2d8c('0x0'));module['exports']={'name':{'type':Sequelize[_0x2d8c('0x1')],'unique':_0x2d8c('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x2d8c('0x1')]},'display_name':{'type':Sequelize[_0x2d8c('0x1')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x2d8c('0x1')]},'original_duration':{'type':Sequelize[_0x2d8c('0x3')]},'original_sampleCount':{'type':Sequelize[_0x2d8c('0x4')]},'original_channelCount':{'type':Sequelize[_0x2d8c('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x2d8c('0x5')]},'converted_format':{'type':Sequelize[_0x2d8c('0x1')]},'converted_duration':{'type':Sequelize[_0x2d8c('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x2d8c('0x4')]},'converted_channelCount':{'type':Sequelize[_0x2d8c('0x5')]},'converted_bitRate':{'type':Sequelize[_0x2d8c('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x2d8c('0x5')]}}; \ No newline at end of file +var _0xe343=['sequelize','exports','STRING','FLOAT','BIGINT','INTEGER'];(function(_0x72de3,_0x2ed060){var _0x2a8e6c=function(_0x1b50b0){while(--_0x1b50b0){_0x72de3['push'](_0x72de3['shift']());}};_0x2a8e6c(++_0x2ed060);}(_0xe343,0x90));var _0x3e34=function(_0x368587,_0x1b6554){_0x368587=_0x368587-0x0;var _0x42d33c=_0xe343[_0x368587];return _0x42d33c;};'use strict';var Sequelize=require(_0x3e34('0x0'));module[_0x3e34('0x1')]={'name':{'type':Sequelize[_0x3e34('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x3e34('0x2')]},'display_name':{'type':Sequelize[_0x3e34('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x3e34('0x2')]},'original_format':{'type':Sequelize[_0x3e34('0x2')]},'original_duration':{'type':Sequelize[_0x3e34('0x3')]},'original_sampleCount':{'type':Sequelize[_0x3e34('0x4')]},'original_channelCount':{'type':Sequelize[_0x3e34('0x5')]},'original_bitRate':{'type':Sequelize[_0x3e34('0x4')]},'original_sampleRate':{'type':Sequelize[_0x3e34('0x5')]},'converted_format':{'type':Sequelize[_0x3e34('0x2')]},'converted_duration':{'type':Sequelize[_0x3e34('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x3e34('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x3e34('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x3e34('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 5a35ff9..faf7213 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 _0x58d5=['converted_sampleRate','body','role','userProfileId','user','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','delete','original_format','eml-format','zip-dir','fast-json-patch','request-promise','path','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','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','index','Sound','rawAttributes','fieldName','type','map','keys','filters','intersection','model','query','attributes','fields','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','params','length','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','%s.%s','format','catch','create','basename','file','originalname','filename','extname','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','send','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_bitRate'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x58d5,0x8d));var _0x558d=function(_0x1c1c52,_0x33abfa){_0x1c1c52=_0x1c1c52-0x0;var _0x236178=_0x58d5[_0x1c1c52];return _0x236178;};'use strict';var emlformat=require(_0x558d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x558d('0x1'));var jsonpatch=require(_0x558d('0x2'));var rp=require(_0x558d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x558d('0x4'));var sox=require('sox');var csv=require(_0x558d('0x5'));var ejs=require(_0x558d('0x6'));var fs=require('fs');var fs_extra=require(_0x558d('0x7'));var _=require(_0x558d('0x8'));var squel=require(_0x558d('0x9'));var crypto=require(_0x558d('0xa'));var jsforce=require(_0x558d('0xb'));var deskjs=require(_0x558d('0xc'));var toCsv=require(_0x558d('0x5'));var querystring=require(_0x558d('0xd'));var Papa=require('papaparse');var Redis=require(_0x558d('0xe'));var authService=require(_0x558d('0xf'));var qs=require(_0x558d('0x10'));var as=require(_0x558d('0x11'));var hardwareService=require(_0x558d('0x12'));var logger=require(_0x558d('0x13'))(_0x558d('0x14'));var utils=require(_0x558d('0x15'));var config=require(_0x558d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x558d('0x17'))['db'];function respondWithStatusCode(_0x51644c,_0x4b4a6b){_0x4b4a6b=_0x4b4a6b||0xcc;return function(_0x1104e1){if(_0x1104e1){return _0x51644c[_0x558d('0x18')](_0x4b4a6b);}return _0x51644c[_0x558d('0x19')](_0x4b4a6b)[_0x558d('0x1a')]();};}function respondWithResult(_0x42a91a,_0x4e0051){_0x4e0051=_0x4e0051||0xc8;return function(_0x5cf9e5){if(_0x5cf9e5){return _0x42a91a[_0x558d('0x19')](_0x4e0051)['json'](_0x5cf9e5);}};}function respondWithFilteredResult(_0x2a8644,_0x2e75a0){return function(_0x184656){if(_0x184656){var _0x12cfc8=typeof _0x2e75a0[_0x558d('0x1b')]===_0x558d('0x1c')&&typeof _0x2e75a0[_0x558d('0x1d')]===_0x558d('0x1c');var _0xeababd=_0x184656[_0x558d('0x1e')];var _0x4bf275=_0x12cfc8?0x0:_0x2e75a0[_0x558d('0x1b')];var _0x2d5bc0=_0x12cfc8?_0x184656[_0x558d('0x1e')]:_0x2e75a0[_0x558d('0x1b')]+_0x2e75a0[_0x558d('0x1d')];var _0x146842;if(_0x2d5bc0>=_0xeababd){_0x2d5bc0=_0xeababd;_0x146842=0xc8;}else{_0x146842=0xce;}_0x2a8644[_0x558d('0x19')](_0x146842);return _0x2a8644[_0x558d('0x1f')]('Content-Range',_0x4bf275+'-'+_0x2d5bc0+'/'+_0xeababd)[_0x558d('0x20')](_0x184656);}return null;};}function patchUpdates(_0x4de2cb){return function(_0x288595){try{jsonpatch[_0x558d('0x21')](_0x288595,_0x4de2cb,!![]);}catch(_0x493b05){return BPromise[_0x558d('0x22')](_0x493b05);}return _0x288595['save']();};}function saveUpdates(_0x1915fd,_0x3929c8){return function(_0x5ac20d){if(_0x5ac20d){return _0x5ac20d[_0x558d('0x23')](_0x1915fd)[_0x558d('0x24')](function(_0xa61954){return _0xa61954;});}return null;};}function removeEntity(_0xf54d76,_0x5f4327){return function(_0x111021){if(_0x111021){return _0x111021[_0x558d('0x25')]()[_0x558d('0x24')](function(){var _0x2b4acc=_0x111021[_0x558d('0x26')]({'plain':!![]});var _0x3be533='Sounds';return db[_0x558d('0x27')][_0x558d('0x25')]({'where':{'type':_0x3be533,'resourceId':_0x2b4acc['id']}})['then'](function(){return _0x111021;});})[_0x558d('0x24')](function(){_0xf54d76['status'](0xcc)[_0x558d('0x1a')]();});}};}function handleEntityNotFound(_0x14bae8,_0x545ada){return function(_0x14fcb9){if(!_0x14fcb9){_0x14bae8[_0x558d('0x18')](0x194);}return _0x14fcb9;};}function handleError(_0x4df31b,_0x11ab8c){_0x11ab8c=_0x11ab8c||0x1f4;return function(_0x409871){logger[_0x558d('0x28')](_0x409871[_0x558d('0x29')]);if(_0x409871['name']){delete _0x409871[_0x558d('0x2a')];}_0x4df31b[_0x558d('0x19')](_0x11ab8c)['send'](_0x409871);};}exports[_0x558d('0x2b')]=function(_0x1582de,_0xd513fe){var _0x569c02={},_0xe6b7a2={},_0x484e23={'count':0x0,'rows':[]};var _0x52637e=_['map'](db[_0x558d('0x2c')][_0x558d('0x2d')],function(_0x367cfb){return{'name':_0x367cfb[_0x558d('0x2e')],'type':_0x367cfb[_0x558d('0x2f')]['key']};});_0xe6b7a2['model']=_[_0x558d('0x30')](_0x52637e,_0x558d('0x2a'));_0xe6b7a2['query']=_[_0x558d('0x31')](_0x1582de['query']);_0xe6b7a2[_0x558d('0x32')]=_[_0x558d('0x33')](_0xe6b7a2[_0x558d('0x34')],_0xe6b7a2[_0x558d('0x35')]);_0x569c02[_0x558d('0x36')]=_[_0x558d('0x33')](_0xe6b7a2[_0x558d('0x34')],qs['fields'](_0x1582de[_0x558d('0x35')][_0x558d('0x37')]));_0x569c02[_0x558d('0x36')]=_0x569c02[_0x558d('0x36')]['length']?_0x569c02[_0x558d('0x36')]:_0xe6b7a2[_0x558d('0x34')];if(!_0x1582de['query']['hasOwnProperty'](_0x558d('0x38'))){_0x569c02[_0x558d('0x1d')]=qs[_0x558d('0x1d')](_0x1582de[_0x558d('0x35')]['limit']);_0x569c02[_0x558d('0x1b')]=qs[_0x558d('0x1b')](_0x1582de[_0x558d('0x35')][_0x558d('0x1b')]);}_0x569c02[_0x558d('0x39')]=qs[_0x558d('0x3a')](_0x1582de[_0x558d('0x35')]['sort']);_0x569c02[_0x558d('0x3b')]=qs[_0x558d('0x32')](_['pick'](_0x1582de[_0x558d('0x35')],_0xe6b7a2[_0x558d('0x32')]),_0x52637e);if(_0x1582de[_0x558d('0x35')][_0x558d('0x3c')]){_0x569c02[_0x558d('0x3b')]=_['merge'](_0x569c02[_0x558d('0x3b')],{'$or':_['map'](_0x52637e,function(_0x1171d8){if(_0x1171d8[_0x558d('0x2f')]!==_0x558d('0x3d')){var _0x3c5bfb={};_0x3c5bfb[_0x1171d8[_0x558d('0x2a')]]={'$like':'%'+_0x1582de[_0x558d('0x35')][_0x558d('0x3c')]+'%'};return _0x3c5bfb;}})});}_0x569c02=_[_0x558d('0x3e')]({},_0x569c02,_0x1582de[_0x558d('0x3f')]);var _0x149b05={'where':_0x569c02[_0x558d('0x3b')]};return db[_0x558d('0x2c')][_0x558d('0x1e')](_0x149b05)[_0x558d('0x24')](function(_0xc7b81e){_0x484e23[_0x558d('0x1e')]=_0xc7b81e;if(_0x1582de[_0x558d('0x35')]['includeAll']){_0x569c02[_0x558d('0x40')]=[{'all':!![]}];}return db[_0x558d('0x2c')][_0x558d('0x41')](_0x569c02);})['then'](function(_0xb14871){_0x484e23[_0x558d('0x42')]=_0xb14871;return _0x484e23;})[_0x558d('0x24')](respondWithFilteredResult(_0xd513fe,_0x569c02))['catch'](handleError(_0xd513fe,null));};exports['show']=function(_0x270cc4,_0x39efe4){var _0xdac21f={'raw':!![],'where':{'id':_0x270cc4[_0x558d('0x43')]['id']}},_0xca97df={};_0xca97df['model']=_[_0x558d('0x31')](db[_0x558d('0x2c')][_0x558d('0x2d')]);_0xca97df[_0x558d('0x35')]=_[_0x558d('0x31')](_0x270cc4[_0x558d('0x35')]);_0xca97df['filters']=_[_0x558d('0x33')](_0xca97df[_0x558d('0x34')],_0xca97df[_0x558d('0x35')]);_0xdac21f[_0x558d('0x36')]=_['intersection'](_0xca97df[_0x558d('0x34')],qs[_0x558d('0x37')](_0x270cc4[_0x558d('0x35')][_0x558d('0x37')]));_0xdac21f[_0x558d('0x36')]=_0xdac21f[_0x558d('0x36')][_0x558d('0x44')]?_0xdac21f[_0x558d('0x36')]:_0xca97df[_0x558d('0x34')];if(_0x270cc4[_0x558d('0x35')]['includeAll']){_0xdac21f[_0x558d('0x40')]=[{'all':!![]}];}_0xdac21f=_[_0x558d('0x3e')]({},_0xdac21f,_0x270cc4[_0x558d('0x3f')]);return db[_0x558d('0x2c')][_0x558d('0x45')](_0xdac21f)[_0x558d('0x24')](handleEntityNotFound(_0x39efe4,null))[_0x558d('0x24')](respondWithResult(_0x39efe4,null))['catch'](handleError(_0x39efe4,null));};exports[_0x558d('0x46')]=function(_0x5e3e5e,_0x31aec3,_0x5d87c3){return db[_0x558d('0x2c')][_0x558d('0x45')]({'where':{'id':_0x5e3e5e[_0x558d('0x43')]['id']},'attributes':['name',_0x558d('0x47'),_0x558d('0x48')],'raw':!![]})['then'](handleEntityNotFound(_0x31aec3,null))[_0x558d('0x24')](function(_0x281243){if(_0x281243){if(!fs[_0x558d('0x49')](path[_0x558d('0x4a')](config[_0x558d('0x4b')],_0x558d('0x4c'),_0x281243[_0x558d('0x47')]+'.'+_0x281243['converted_format']))){throw new db[(_0x558d('0x4d'))][(_0x558d('0x4e'))](_0x558d('0x4f'));}return _0x31aec3[_0x558d('0x46')](path['join'](config[_0x558d('0x4b')],_0x558d('0x4c'),util['format'](_0x558d('0x50'),_0x281243['save_name'],_0x281243[_0x558d('0x48')])),util[_0x558d('0x51')](_0x558d('0x50'),_0x281243[_0x558d('0x2a')],_0x281243[_0x558d('0x48')]));}return null;})[_0x558d('0x52')](handleError(_0x31aec3,null));};exports[_0x558d('0x53')]=function(_0x2e946d,_0x1f4e24,_0x50782d){var _0x3ce298={'name':path[_0x558d('0x54')](_0x2e946d[_0x558d('0x55')][_0x558d('0x56')],path['extname'](_0x2e946d[_0x558d('0x55')][_0x558d('0x56')])),'save_name':path['basename'](_0x2e946d[_0x558d('0x55')][_0x558d('0x57')],path[_0x558d('0x58')](_0x2e946d['file']['filename'])),'original_format':path['extname'](_0x2e946d['file']['originalname'])[_0x558d('0x59')](0x1),'converted_format':_0x558d('0x5a')};var _0x179740=path[_0x558d('0x4a')](config[_0x558d('0x4b')],_0x558d('0x5b'),_0x2e946d['file'][_0x558d('0x57')]);var _0x116995=path['join'](config[_0x558d('0x4b')],'server/files/sounds/converted',util['format']('%s.%s',path[_0x558d('0x54')](_0x2e946d['file']['filename'],path[_0x558d('0x58')](_0x2e946d[_0x558d('0x55')][_0x558d('0x57')])),_0x3ce298[_0x558d('0x48')]));logger[_0x558d('0x5c')](_0x558d('0x5d'),_0x179740);logger[_0x558d('0x5c')](_0x558d('0x5e'),_0x116995);try{fs[_0x558d('0x5f')](_0x179740,parseInt(_0x558d('0x60'),0x8));var _0x5bd330=sox[_0x558d('0x61')](_0x179740,_0x116995,{'sampleRate':0x1f40,'format':_0x558d('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5bd330['on'](_0x558d('0x28'),function(_0x32850d){fs[_0x558d('0x62')](_0x179740);_0x1f4e24[_0x558d('0x19')](0x1f4)[_0x558d('0x63')](_0x32850d);});_0x5bd330['on'](_0x558d('0x64'),function(_0x3b3919){_0x3ce298[_0x558d('0x65')]=isNaN(_0x3b3919[_0x558d('0x66')])?null:_0x3b3919[_0x558d('0x66')]*0x3e8;_0x3ce298[_0x558d('0x67')]=isNaN(_0x3b3919[_0x558d('0x68')])?null:_0x3b3919[_0x558d('0x68')];_0x3ce298[_0x558d('0x69')]=isNaN(_0x3b3919[_0x558d('0x6a')])?null:_0x3b3919[_0x558d('0x6a')];_0x3ce298['original_bitRate']=isNaN(_0x3b3919[_0x558d('0x6b')])?null:_0x3b3919[_0x558d('0x6b')];_0x3ce298[_0x558d('0x6c')]=isNaN(_0x3b3919[_0x558d('0x6d')])?null:_0x3b3919[_0x558d('0x6d')];});_0x5bd330['on'](_0x558d('0x6e'),function(_0x3752c2){_0x3ce298[_0x558d('0x6f')]=isNaN(_0x3752c2[_0x558d('0x66')])?null:_0x3752c2[_0x558d('0x66')]*0x3e8;_0x3ce298['converted_sampleCount']=isNaN(_0x3752c2[_0x558d('0x68')])?null:_0x3752c2[_0x558d('0x68')];_0x3ce298['converted_channelCount']=isNaN(_0x3752c2[_0x558d('0x6a')])?null:_0x3752c2[_0x558d('0x6a')];_0x3ce298[_0x558d('0x70')]=isNaN(_0x3752c2[_0x558d('0x6b')])?null:_0x3752c2[_0x558d('0x6b')];_0x3ce298[_0x558d('0x71')]=isNaN(_0x3752c2[_0x558d('0x6d')])?null:_0x3752c2[_0x558d('0x6d')];});_0x5bd330['on'](_0x558d('0x1a'),function(){fs[_0x558d('0x5f')](_0x116995,parseInt(_0x558d('0x60'),0x8));return db[_0x558d('0x2c')]['create'](_0x3ce298)[_0x558d('0x24')](function(_0x55fd36){var _0x444b27={'role':_0x2e946d[_0x558d('0x72')][_0x558d('0x73')],'userProfileId':_0x2e946d[_0x558d('0x72')][_0x558d('0x74')]};if(!_0x444b27)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x444b27['role']===_0x558d('0x75')){var _0x264c46=_0x55fd36[_0x558d('0x26')]({'plain':!![]});return db[_0x558d('0x76')][_0x558d('0x45')]({'where':{'name':_0x558d('0x77'),'userProfileId':_0x444b27[_0x558d('0x74')]},'raw':!![]})['then'](function(_0x34d734){if(_0x34d734&&_0x34d734[_0x558d('0x78')]===0x0){return db['UserProfileResource'][_0x558d('0x53')]({'name':_0x264c46[_0x558d('0x2a')],'resourceId':_0x264c46['id'],'type':_0x34d734['name'],'sectionId':_0x34d734['id']},{})[_0x558d('0x24')](function(){return _0x55fd36;});}else{return _0x55fd36;}})['catch'](function(_0x3cd23e){logger['error'](_0x558d('0x79'),_0x3cd23e);throw _0x3cd23e;});}return _0x55fd36;})[_0x558d('0x24')](respondWithResult(_0x1f4e24,null))[_0x558d('0x52')](handleError(_0x1f4e24,null));});_0x5bd330[_0x558d('0x7a')]();}catch(_0x2f50c4){_0x1f4e24['status'](0x1f4)['send'](_0x2f50c4);}};exports[_0x558d('0x23')]=function(_0x549da1,_0x4e4393,_0x369bb5){return db['Sound']['find']({'where':{'id':_0x549da1[_0x558d('0x43')]['id']}})[_0x558d('0x24')](handleEntityNotFound(_0x4e4393,null))['then'](saveUpdates(_[_0x558d('0x7b')](_0x549da1[_0x558d('0x72')],['name',_0x558d('0x7c')]),null))[_0x558d('0x24')](respondWithResult(_0x4e4393,null))[_0x558d('0x52')](handleError(_0x4e4393,null));};exports[_0x558d('0x7d')]=function(_0x8c1caf,_0xfd9fe9,_0x4cd477){return db[_0x558d('0x2c')][_0x558d('0x45')]({'where':{'id':_0x8c1caf[_0x558d('0x43')]['id']}})[_0x558d('0x24')](function(_0x57ee88){if(_0x57ee88){return _0x57ee88[_0x558d('0x25')]();}})[_0x558d('0x24')](function(_0x495630){var _0x4b6e10=path[_0x558d('0x4a')](config['root'],_0x558d('0x5b'),util[_0x558d('0x51')]('%s.%s',_0x495630[_0x558d('0x47')],_0x495630[_0x558d('0x7e')]));var _0x2e5834=path[_0x558d('0x4a')](config[_0x558d('0x4b')],_0x558d('0x4c'),util['format'](_0x558d('0x50'),_0x495630[_0x558d('0x47')],_0x495630[_0x558d('0x48')]));fs[_0x558d('0x62')](_0x4b6e10);fs[_0x558d('0x62')](_0x2e5834);return _0x495630;})['then'](function(_0x2679f4){if(_0x2679f4){return _0xfd9fe9['status'](0xcc)['end']();}})['then'](handleEntityNotFound(_0xfd9fe9,null))[_0x558d('0x52')](handleError(_0xfd9fe9,null));}; \ No newline at end of file +var _0x461f=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','params','keys','rawAttributes','options','find','download','save_name','converted_format','existsSync','join','server/files/sounds/converted','Sequelize','ValidationError','root','%s.%s','catch','file','originalname','extname','substring','server/files/sounds/original','filename','basename','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','error','unlinkSync','src','original_duration','duration','original_sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','converted_duration','converted_sampleCount','sampleCount','converted_channelCount','converted_bitRate','sampleRate','create','role','userProfileId','UserProfileSection','start','body','delete','original_format','format','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','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','limit','count','set','Content-Range','reject','then','destroy','get','Sounds','end','name','send','index','map','Sound','type','key','model','query'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0x461f,0x1bc));var _0xf461=function(_0x43f136,_0x365817){_0x43f136=_0x43f136-0x0;var _0x531928=_0x461f[_0x43f136];return _0x531928;};'use strict';var emlformat=require(_0xf461('0x0'));var rimraf=require(_0xf461('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf461('0x2'));var rp=require(_0xf461('0x3'));var moment=require(_0xf461('0x4'));var BPromise=require(_0xf461('0x5'));var Mustache=require(_0xf461('0x6'));var util=require(_0xf461('0x7'));var path=require(_0xf461('0x8'));var sox=require(_0xf461('0x9'));var csv=require('to-csv');var ejs=require(_0xf461('0xa'));var fs=require('fs');var fs_extra=require(_0xf461('0xb'));var _=require(_0xf461('0xc'));var squel=require(_0xf461('0xd'));var crypto=require('crypto');var jsforce=require(_0xf461('0xe'));var deskjs=require(_0xf461('0xf'));var toCsv=require(_0xf461('0x10'));var querystring=require(_0xf461('0x11'));var Papa=require(_0xf461('0x12'));var Redis=require('ioredis');var authService=require(_0xf461('0x13'));var qs=require(_0xf461('0x14'));var as=require(_0xf461('0x15'));var hardwareService=require(_0xf461('0x16'));var logger=require('../../config/logger')(_0xf461('0x17'));var utils=require(_0xf461('0x18'));var config=require(_0xf461('0x19'));var licenseUtil=require(_0xf461('0x1a'));var db=require(_0xf461('0x1b'))['db'];function respondWithStatusCode(_0x3142e1,_0x23f80e){_0x23f80e=_0x23f80e||0xcc;return function(_0xca6f59){if(_0xca6f59){return _0x3142e1[_0xf461('0x1c')](_0x23f80e);}return _0x3142e1[_0xf461('0x1d')](_0x23f80e)['end']();};}function respondWithResult(_0x5a26ca,_0x4d7593){_0x4d7593=_0x4d7593||0xc8;return function(_0x132b45){if(_0x132b45){return _0x5a26ca[_0xf461('0x1d')](_0x4d7593)[_0xf461('0x1e')](_0x132b45);}};}function respondWithFilteredResult(_0x56915d,_0x4fed46){return function(_0x5d4ba2){if(_0x5d4ba2){var _0x1c72c3=typeof _0x4fed46[_0xf461('0x1f')]===_0xf461('0x20')&&typeof _0x4fed46[_0xf461('0x21')]===_0xf461('0x20');var _0x5da11f=_0x5d4ba2[_0xf461('0x22')];var _0x3455c0=_0x1c72c3?0x0:_0x4fed46[_0xf461('0x1f')];var _0x58254c=_0x1c72c3?_0x5d4ba2[_0xf461('0x22')]:_0x4fed46[_0xf461('0x1f')]+_0x4fed46[_0xf461('0x21')];var _0x19f4ac;if(_0x58254c>=_0x5da11f){_0x58254c=_0x5da11f;_0x19f4ac=0xc8;}else{_0x19f4ac=0xce;}_0x56915d[_0xf461('0x1d')](_0x19f4ac);return _0x56915d[_0xf461('0x23')](_0xf461('0x24'),_0x3455c0+'-'+_0x58254c+'/'+_0x5da11f)['json'](_0x5d4ba2);}return null;};}function patchUpdates(_0x224546){return function(_0xd33409){try{jsonpatch['apply'](_0xd33409,_0x224546,!![]);}catch(_0x2941be){return BPromise[_0xf461('0x25')](_0x2941be);}return _0xd33409['save']();};}function saveUpdates(_0x539483,_0x3675a7){return function(_0x3d13eb){if(_0x3d13eb){return _0x3d13eb['update'](_0x539483)[_0xf461('0x26')](function(_0x3daca9){return _0x3daca9;});}return null;};}function removeEntity(_0x5d4e60,_0x5c143f){return function(_0x1d8ff9){if(_0x1d8ff9){return _0x1d8ff9[_0xf461('0x27')]()[_0xf461('0x26')](function(){var _0xab3032=_0x1d8ff9[_0xf461('0x28')]({'plain':!![]});var _0xfc3270=_0xf461('0x29');return db['UserProfileResource'][_0xf461('0x27')]({'where':{'type':_0xfc3270,'resourceId':_0xab3032['id']}})[_0xf461('0x26')](function(){return _0x1d8ff9;});})[_0xf461('0x26')](function(){_0x5d4e60[_0xf461('0x1d')](0xcc)[_0xf461('0x2a')]();});}};}function handleEntityNotFound(_0x14e24c,_0x4cc72d){return function(_0x5f542a){if(!_0x5f542a){_0x14e24c[_0xf461('0x1c')](0x194);}return _0x5f542a;};}function handleError(_0x3dd4f2,_0x5b86e1){_0x5b86e1=_0x5b86e1||0x1f4;return function(_0x5b1ccd){logger['error'](_0x5b1ccd['stack']);if(_0x5b1ccd['name']){delete _0x5b1ccd[_0xf461('0x2b')];}_0x3dd4f2[_0xf461('0x1d')](_0x5b86e1)[_0xf461('0x2c')](_0x5b1ccd);};}exports[_0xf461('0x2d')]=function(_0x509a44,_0x1cbd2c){var _0xed277e={},_0x18e41d={},_0x3ba876={'count':0x0,'rows':[]};var _0x260eb2=_[_0xf461('0x2e')](db[_0xf461('0x2f')]['rawAttributes'],function(_0x5d5ac3){return{'name':_0x5d5ac3['fieldName'],'type':_0x5d5ac3[_0xf461('0x30')][_0xf461('0x31')]};});_0x18e41d[_0xf461('0x32')]=_[_0xf461('0x2e')](_0x260eb2,_0xf461('0x2b'));_0x18e41d[_0xf461('0x33')]=_['keys'](_0x509a44[_0xf461('0x33')]);_0x18e41d[_0xf461('0x34')]=_[_0xf461('0x35')](_0x18e41d['model'],_0x18e41d[_0xf461('0x33')]);_0xed277e[_0xf461('0x36')]=_[_0xf461('0x35')](_0x18e41d[_0xf461('0x32')],qs['fields'](_0x509a44['query'][_0xf461('0x37')]));_0xed277e[_0xf461('0x36')]=_0xed277e[_0xf461('0x36')][_0xf461('0x38')]?_0xed277e[_0xf461('0x36')]:_0x18e41d[_0xf461('0x32')];if(!_0x509a44[_0xf461('0x33')][_0xf461('0x39')](_0xf461('0x3a'))){_0xed277e[_0xf461('0x21')]=qs['limit'](_0x509a44[_0xf461('0x33')]['limit']);_0xed277e['offset']=qs[_0xf461('0x1f')](_0x509a44['query'][_0xf461('0x1f')]);}_0xed277e[_0xf461('0x3b')]=qs[_0xf461('0x3c')](_0x509a44[_0xf461('0x33')][_0xf461('0x3c')]);_0xed277e[_0xf461('0x3d')]=qs['filters'](_[_0xf461('0x3e')](_0x509a44[_0xf461('0x33')],_0x18e41d['filters']),_0x260eb2);if(_0x509a44[_0xf461('0x33')][_0xf461('0x3f')]){_0xed277e[_0xf461('0x3d')]=_[_0xf461('0x40')](_0xed277e[_0xf461('0x3d')],{'$or':_['map'](_0x260eb2,function(_0x322ce1){if(_0x322ce1[_0xf461('0x30')]!=='VIRTUAL'){var _0x4ba712={};_0x4ba712[_0x322ce1[_0xf461('0x2b')]]={'$like':'%'+_0x509a44[_0xf461('0x33')][_0xf461('0x3f')]+'%'};return _0x4ba712;}})});}_0xed277e=_[_0xf461('0x40')]({},_0xed277e,_0x509a44['options']);var _0x20b278={'where':_0xed277e[_0xf461('0x3d')]};return db[_0xf461('0x2f')][_0xf461('0x22')](_0x20b278)['then'](function(_0x4f6b24){_0x3ba876['count']=_0x4f6b24;if(_0x509a44['query'][_0xf461('0x41')]){_0xed277e[_0xf461('0x42')]=[{'all':!![]}];}return db['Sound'][_0xf461('0x43')](_0xed277e);})[_0xf461('0x26')](function(_0x44a0d3){_0x3ba876[_0xf461('0x44')]=_0x44a0d3;return _0x3ba876;})['then'](respondWithFilteredResult(_0x1cbd2c,_0xed277e))['catch'](handleError(_0x1cbd2c,null));};exports['show']=function(_0x1dd2ff,_0x4ff7c2){var _0x212d3f={'raw':!![],'where':{'id':_0x1dd2ff[_0xf461('0x45')]['id']}},_0x1a49d4={};_0x1a49d4[_0xf461('0x32')]=_[_0xf461('0x46')](db[_0xf461('0x2f')][_0xf461('0x47')]);_0x1a49d4[_0xf461('0x33')]=_[_0xf461('0x46')](_0x1dd2ff[_0xf461('0x33')]);_0x1a49d4['filters']=_[_0xf461('0x35')](_0x1a49d4['model'],_0x1a49d4[_0xf461('0x33')]);_0x212d3f[_0xf461('0x36')]=_[_0xf461('0x35')](_0x1a49d4[_0xf461('0x32')],qs[_0xf461('0x37')](_0x1dd2ff[_0xf461('0x33')][_0xf461('0x37')]));_0x212d3f[_0xf461('0x36')]=_0x212d3f[_0xf461('0x36')][_0xf461('0x38')]?_0x212d3f['attributes']:_0x1a49d4[_0xf461('0x32')];if(_0x1dd2ff[_0xf461('0x33')][_0xf461('0x41')]){_0x212d3f[_0xf461('0x42')]=[{'all':!![]}];}_0x212d3f=_[_0xf461('0x40')]({},_0x212d3f,_0x1dd2ff[_0xf461('0x48')]);return db[_0xf461('0x2f')][_0xf461('0x49')](_0x212d3f)[_0xf461('0x26')](handleEntityNotFound(_0x4ff7c2,null))[_0xf461('0x26')](respondWithResult(_0x4ff7c2,null))['catch'](handleError(_0x4ff7c2,null));};exports[_0xf461('0x4a')]=function(_0x3dcd36,_0x2b3762,_0x45880e){return db[_0xf461('0x2f')][_0xf461('0x49')]({'where':{'id':_0x3dcd36[_0xf461('0x45')]['id']},'attributes':[_0xf461('0x2b'),_0xf461('0x4b'),_0xf461('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x2b3762,null))[_0xf461('0x26')](function(_0x195fe4){if(_0x195fe4){if(!fs[_0xf461('0x4d')](path[_0xf461('0x4e')](config['root'],_0xf461('0x4f'),_0x195fe4[_0xf461('0x4b')]+'.'+_0x195fe4[_0xf461('0x4c')]))){throw new db[(_0xf461('0x50'))][(_0xf461('0x51'))]('Sound\x20not\x20found');}return _0x2b3762['download'](path[_0xf461('0x4e')](config[_0xf461('0x52')],_0xf461('0x4f'),util['format'](_0xf461('0x53'),_0x195fe4['save_name'],_0x195fe4['converted_format'])),util['format'](_0xf461('0x53'),_0x195fe4[_0xf461('0x2b')],_0x195fe4['converted_format']));}return null;})[_0xf461('0x54')](handleError(_0x2b3762,null));};exports['create']=function(_0x2d5b1e,_0x2380ee,_0x4364c6){var _0x2debd1={'name':path['basename'](_0x2d5b1e[_0xf461('0x55')][_0xf461('0x56')],path[_0xf461('0x57')](_0x2d5b1e[_0xf461('0x55')][_0xf461('0x56')])),'save_name':path['basename'](_0x2d5b1e['file']['filename'],path[_0xf461('0x57')](_0x2d5b1e[_0xf461('0x55')]['filename'])),'original_format':path['extname'](_0x2d5b1e[_0xf461('0x55')][_0xf461('0x56')])[_0xf461('0x58')](0x1),'converted_format':'wav'};var _0x3c50cb=path['join'](config[_0xf461('0x52')],_0xf461('0x59'),_0x2d5b1e['file'][_0xf461('0x5a')]);var _0x1e0df7=path[_0xf461('0x4e')](config[_0xf461('0x52')],_0xf461('0x4f'),util['format']('%s.%s',path[_0xf461('0x5b')](_0x2d5b1e[_0xf461('0x55')][_0xf461('0x5a')],path[_0xf461('0x57')](_0x2d5b1e['file'][_0xf461('0x5a')])),_0x2debd1[_0xf461('0x4c')]));logger[_0xf461('0x5c')](_0xf461('0x5d'),_0x3c50cb);logger[_0xf461('0x5c')](_0xf461('0x5e'),_0x1e0df7);try{fs[_0xf461('0x5f')](_0x3c50cb,parseInt(_0xf461('0x60'),0x8));var _0x408476=sox[_0xf461('0x61')](_0x3c50cb,_0x1e0df7,{'sampleRate':0x1f40,'format':_0xf461('0x62'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x408476['on'](_0xf461('0x63'),function(_0x14fb22){fs[_0xf461('0x64')](_0x3c50cb);_0x2380ee[_0xf461('0x1d')](0x1f4)['send'](_0x14fb22);});_0x408476['on'](_0xf461('0x65'),function(_0x280e4e){_0x2debd1[_0xf461('0x66')]=isNaN(_0x280e4e['duration'])?null:_0x280e4e[_0xf461('0x67')]*0x3e8;_0x2debd1[_0xf461('0x68')]=isNaN(_0x280e4e['sampleCount'])?null:_0x280e4e['sampleCount'];_0x2debd1['original_channelCount']=isNaN(_0x280e4e['channelCount'])?null:_0x280e4e[_0xf461('0x69')];_0x2debd1[_0xf461('0x6a')]=isNaN(_0x280e4e[_0xf461('0x6b')])?null:_0x280e4e[_0xf461('0x6b')];_0x2debd1[_0xf461('0x6c')]=isNaN(_0x280e4e['sampleRate'])?null:_0x280e4e['sampleRate'];});_0x408476['on']('dest',function(_0x2d8ad8){_0x2debd1[_0xf461('0x6d')]=isNaN(_0x2d8ad8[_0xf461('0x67')])?null:_0x2d8ad8[_0xf461('0x67')]*0x3e8;_0x2debd1[_0xf461('0x6e')]=isNaN(_0x2d8ad8[_0xf461('0x6f')])?null:_0x2d8ad8['sampleCount'];_0x2debd1[_0xf461('0x70')]=isNaN(_0x2d8ad8['channelCount'])?null:_0x2d8ad8[_0xf461('0x69')];_0x2debd1[_0xf461('0x71')]=isNaN(_0x2d8ad8[_0xf461('0x6b')])?null:_0x2d8ad8[_0xf461('0x6b')];_0x2debd1['converted_sampleRate']=isNaN(_0x2d8ad8[_0xf461('0x72')])?null:_0x2d8ad8[_0xf461('0x72')];});_0x408476['on'](_0xf461('0x2a'),function(){fs[_0xf461('0x5f')](_0x1e0df7,parseInt(_0xf461('0x60'),0x8));return db[_0xf461('0x2f')][_0xf461('0x73')](_0x2debd1)[_0xf461('0x26')](function(_0x1b66a5){var _0x57c9d8={'role':_0x2d5b1e['body'][_0xf461('0x74')],'userProfileId':_0x2d5b1e['body'][_0xf461('0x75')]};if(!_0x57c9d8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57c9d8[_0xf461('0x74')]==='user'){var _0x237c32=_0x1b66a5[_0xf461('0x28')]({'plain':!![]});return db[_0xf461('0x76')][_0xf461('0x49')]({'where':{'name':_0xf461('0x29'),'userProfileId':_0x57c9d8['userProfileId']},'raw':!![]})[_0xf461('0x26')](function(_0x22c80c){if(_0x22c80c&&_0x22c80c['autoAssociation']===0x0){return db['UserProfileResource'][_0xf461('0x73')]({'name':_0x237c32[_0xf461('0x2b')],'resourceId':_0x237c32['id'],'type':_0x22c80c['name'],'sectionId':_0x22c80c['id']},{})[_0xf461('0x26')](function(){return _0x1b66a5;});}else{return _0x1b66a5;}})[_0xf461('0x54')](function(_0x2ecd8f){logger[_0xf461('0x63')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ecd8f);throw _0x2ecd8f;});}return _0x1b66a5;})[_0xf461('0x26')](respondWithResult(_0x2380ee,null))[_0xf461('0x54')](handleError(_0x2380ee,null));});_0x408476[_0xf461('0x77')]();}catch(_0xab479f){_0x2380ee[_0xf461('0x1d')](0x1f4)[_0xf461('0x2c')](_0xab479f);}};exports['update']=function(_0x4eea77,_0x889d6f,_0x10d900){return db[_0xf461('0x2f')][_0xf461('0x49')]({'where':{'id':_0x4eea77[_0xf461('0x45')]['id']}})[_0xf461('0x26')](handleEntityNotFound(_0x889d6f,null))[_0xf461('0x26')](saveUpdates(_['pick'](_0x4eea77[_0xf461('0x78')],[_0xf461('0x2b'),'description']),null))[_0xf461('0x26')](respondWithResult(_0x889d6f,null))[_0xf461('0x54')](handleError(_0x889d6f,null));};exports[_0xf461('0x79')]=function(_0x1cee72,_0x467b08,_0x5ff02a){return db[_0xf461('0x2f')]['find']({'where':{'id':_0x1cee72[_0xf461('0x45')]['id']}})[_0xf461('0x26')](function(_0x12ac3a){if(_0x12ac3a){return _0x12ac3a[_0xf461('0x27')]();}})['then'](function(_0x1a64c5){var _0x8065ce=path[_0xf461('0x4e')](config[_0xf461('0x52')],'server/files/sounds/original',util['format'](_0xf461('0x53'),_0x1a64c5[_0xf461('0x4b')],_0x1a64c5[_0xf461('0x7a')]));var _0x4d421d=path['join'](config[_0xf461('0x52')],_0xf461('0x4f'),util[_0xf461('0x7b')](_0xf461('0x53'),_0x1a64c5[_0xf461('0x4b')],_0x1a64c5[_0xf461('0x4c')]));fs['unlinkSync'](_0x8065ce);fs[_0xf461('0x64')](_0x4d421d);return _0x1a64c5;})[_0xf461('0x26')](function(_0xf04da2){if(_0xf04da2){return _0x467b08[_0xf461('0x1d')](0xcc)[_0xf461('0x2a')]();}})[_0xf461('0x26')](handleEntityNotFound(_0x467b08,null))[_0xf461('0x54')](handleError(_0x467b08,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 566de36..4cfcd55 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 _0x69bb=['exports','define','Sound','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x69bb,0xb7));var _0xb69b=function(_0x2fd5f1,_0x51a172){_0x2fd5f1=_0x2fd5f1-0x0;var _0x5af6f6=_0x69bb[_0x2fd5f1];return _0x5af6f6;};'use strict';var _=require(_0xb69b('0x0'));var util=require('util');var logger=require(_0xb69b('0x1'))(_0xb69b('0x2'));var moment=require(_0xb69b('0x3'));var BPromise=require(_0xb69b('0x4'));var rp=require(_0xb69b('0x5'));var fs=require('fs');var path=require(_0xb69b('0x6'));var rimraf=require(_0xb69b('0x7'));var config=require(_0xb69b('0x8'));var attributes=require('./sound.attributes');module[_0xb69b('0x9')]=function(_0x1fd029,_0x3272fa){return _0x1fd029[_0xb69b('0xa')](_0xb69b('0xb'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f41=['../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','util','../../config/logger','api','moment','path','rimraf'];(function(_0x546c68,_0x5c0116){var _0x4a2389=function(_0x5aa205){while(--_0x5aa205){_0x546c68['push'](_0x546c68['shift']());}};_0x4a2389(++_0x5c0116);}(_0x9f41,0x96));var _0x19f4=function(_0x12928d,_0x57c359){_0x12928d=_0x12928d-0x0;var _0x1424c7=_0x9f41[_0x12928d];return _0x1424c7;};'use strict';var _=require('lodash');var util=require(_0x19f4('0x0'));var logger=require(_0x19f4('0x1'))(_0x19f4('0x2'));var moment=require(_0x19f4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x19f4('0x4'));var rimraf=require(_0x19f4('0x5'));var config=require(_0x19f4('0x6'));var attributes=require(_0x19f4('0x7'));module[_0x19f4('0x8')]=function(_0xf6379e,_0x37f926){return _0xf6379e[_0x19f4('0x9')](_0x19f4('0xa'),attributes,{'tableName':_0x19f4('0xb'),'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 7af9b64..f373532 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 _0x06cb=['moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Sound','options','attributes','include','map','model','then','ShowSound','debug','lodash','util'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x06cb,0x1a2));var _0xb06c=function(_0x406c79,_0x390730){_0x406c79=_0x406c79-0x0;var _0x2bb9de=_0x06cb[_0x406c79];return _0x2bb9de;};'use strict';var _=require(_0xb06c('0x0'));var util=require(_0xb06c('0x1'));var moment=require(_0xb06c('0x2'));var BPromise=require('bluebird');var rs=require(_0xb06c('0x3'));var fs=require('fs');var Redis=require(_0xb06c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb06c('0x5'));var logger=require('../../config/logger')(_0xb06c('0x6'));var config=require(_0xb06c('0x7'));var jayson=require(_0xb06c('0x8'));var client=jayson[_0xb06c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5dadce,_0x2bf4ca,_0xa8cc25){return new BPromise(function(_0x1c7e58,_0x63e539){return client[_0xb06c('0xa')](_0x5dadce,_0xa8cc25)['then'](function(_0xd8ef00){logger[_0xb06c('0xb')](_0xb06c('0xc'),_0x2bf4ca,_0xb06c('0xd'));logger['debug'](_0xb06c('0xe'),_0x2bf4ca,_0xb06c('0xd'),JSON[_0xb06c('0xf')](_0xd8ef00));if(_0xd8ef00[_0xb06c('0x10')]){if(_0xd8ef00['error'][_0xb06c('0x11')]===0x1f4){logger[_0xb06c('0x10')](_0xb06c('0xc'),_0x2bf4ca,_0xd8ef00['error']['message']);return _0x63e539(_0xd8ef00[_0xb06c('0x10')][_0xb06c('0x12')]);}logger['error'](_0xb06c('0xc'),_0x2bf4ca,_0xd8ef00[_0xb06c('0x10')][_0xb06c('0x12')]);return _0x1c7e58(_0xd8ef00[_0xb06c('0x10')][_0xb06c('0x12')]);}else{logger[_0xb06c('0xb')](_0xb06c('0xc'),_0x2bf4ca,_0xb06c('0xd'));_0x1c7e58(_0xd8ef00[_0xb06c('0x13')][_0xb06c('0x12')]);}})[_0xb06c('0x14')](function(_0x9cabff){logger[_0xb06c('0x10')]('Sound,\x20%s,\x20%s',_0x2bf4ca,_0x9cabff);_0x63e539(_0x9cabff);});});}exports['ShowSound']=function(_0x148379){var _0x4fe9e4=this;return new Promise(function(_0x418fa0,_0x5a39fc){return db[_0xb06c('0x15')]['find']({'raw':_0x148379[_0xb06c('0x16')]?_0x148379[_0xb06c('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x148379['options']?_0x148379[_0xb06c('0x16')]['where']||null:null,'attributes':_0x148379[_0xb06c('0x16')]?_0x148379[_0xb06c('0x16')][_0xb06c('0x17')]||null:null,'include':_0x148379[_0xb06c('0x16')]?_0x148379[_0xb06c('0x16')][_0xb06c('0x18')]?_[_0xb06c('0x19')](_0x148379[_0xb06c('0x16')][_0xb06c('0x18')],function(_0x1b34c1){return{'model':db[_0x1b34c1[_0xb06c('0x1a')]],'as':_0x1b34c1['as'],'attributes':_0x1b34c1[_0xb06c('0x17')],'include':_0x1b34c1[_0xb06c('0x18')]?_[_0xb06c('0x19')](_0x1b34c1['include'],function(_0x50a2fa){return{'model':db[_0x50a2fa[_0xb06c('0x1a')]],'as':_0x50a2fa['as'],'attributes':_0x50a2fa[_0xb06c('0x17')],'include':_0x50a2fa['include']?_['map'](_0x50a2fa['include'],function(_0x58c150){return{'model':db[_0x58c150[_0xb06c('0x1a')]],'as':_0x58c150['as'],'attributes':_0x58c150[_0xb06c('0x17')]};}):[]};}):[]};}):[]:[]})[_0xb06c('0x1b')](function(_0xc9d29d){logger['info'](_0xb06c('0x1c'),_0x148379);logger[_0xb06c('0x1d')](_0xb06c('0x1c'),_0x148379,JSON[_0xb06c('0xf')](_0xc9d29d));_0x418fa0(_0xc9d29d);})[_0xb06c('0x14')](function(_0x44267d){logger[_0xb06c('0x10')]('ShowSound',_0x44267d[_0xb06c('0x12')],_0x148379);_0x5a39fc(_0x4fe9e4[_0xb06c('0x10')](0x1f4,_0x44267d[_0xb06c('0x12')]));});});}; \ No newline at end of file +var _0x0229=['options','raw','where','include','attributes','map','model','catch','ShowSound','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','Sound,\x20%s,\x20%s','result','Sound','find'];(function(_0x56a60a,_0xf4c330){var _0x5c4057=function(_0x5ed7f8){while(--_0x5ed7f8){_0x56a60a['push'](_0x56a60a['shift']());}};_0x5c4057(++_0xf4c330);}(_0x0229,0x1f3));var _0x9022=function(_0x8c482f,_0x454dd7){_0x8c482f=_0x8c482f-0x0;var _0x55aa3d=_0x0229[_0x8c482f];return _0x55aa3d;};'use strict';var _=require(_0x9022('0x0'));var util=require(_0x9022('0x1'));var moment=require(_0x9022('0x2'));var BPromise=require(_0x9022('0x3'));var rs=require(_0x9022('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9022('0x5'))['db'];var utils=require(_0x9022('0x6'));var logger=require(_0x9022('0x7'))(_0x9022('0x8'));var config=require(_0x9022('0x9'));var jayson=require(_0x9022('0xa'));var client=jayson[_0x9022('0xb')][_0x9022('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2236a6,_0x321079,_0x5a3656){return new BPromise(function(_0x1a695f,_0x47b436){return client[_0x9022('0xd')](_0x2236a6,_0x5a3656)[_0x9022('0xe')](function(_0x66ac72){logger[_0x9022('0xf')]('Sound,\x20%s,\x20%s',_0x321079,_0x9022('0x10'));logger[_0x9022('0x11')]('Sound,\x20%s,\x20%s,\x20%s',_0x321079,'request\x20sent',JSON[_0x9022('0x12')](_0x66ac72));if(_0x66ac72[_0x9022('0x13')]){if(_0x66ac72[_0x9022('0x13')][_0x9022('0x14')]===0x1f4){logger[_0x9022('0x13')]('Sound,\x20%s,\x20%s',_0x321079,_0x66ac72[_0x9022('0x13')][_0x9022('0x15')]);return _0x47b436(_0x66ac72['error'][_0x9022('0x15')]);}logger[_0x9022('0x13')](_0x9022('0x16'),_0x321079,_0x66ac72[_0x9022('0x13')][_0x9022('0x15')]);return _0x1a695f(_0x66ac72[_0x9022('0x13')][_0x9022('0x15')]);}else{logger[_0x9022('0xf')](_0x9022('0x16'),_0x321079,_0x9022('0x10'));_0x1a695f(_0x66ac72[_0x9022('0x17')][_0x9022('0x15')]);}})['catch'](function(_0x59daa5){logger[_0x9022('0x13')]('Sound,\x20%s,\x20%s',_0x321079,_0x59daa5);_0x47b436(_0x59daa5);});});}exports['ShowSound']=function(_0x533a8b){var _0x287f16=this;return new Promise(function(_0x5ca683,_0x16f2e8){return db[_0x9022('0x18')][_0x9022('0x19')]({'raw':_0x533a8b[_0x9022('0x1a')]?_0x533a8b['options'][_0x9022('0x1b')]===undefined?!![]:![]:!![],'where':_0x533a8b[_0x9022('0x1a')]?_0x533a8b[_0x9022('0x1a')][_0x9022('0x1c')]||null:null,'attributes':_0x533a8b[_0x9022('0x1a')]?_0x533a8b[_0x9022('0x1a')]['attributes']||null:null,'include':_0x533a8b[_0x9022('0x1a')]?_0x533a8b['options']['include']?_['map'](_0x533a8b[_0x9022('0x1a')][_0x9022('0x1d')],function(_0x3c5c27){return{'model':db[_0x3c5c27['model']],'as':_0x3c5c27['as'],'attributes':_0x3c5c27[_0x9022('0x1e')],'include':_0x3c5c27['include']?_[_0x9022('0x1f')](_0x3c5c27['include'],function(_0x119d4d){return{'model':db[_0x119d4d[_0x9022('0x20')]],'as':_0x119d4d['as'],'attributes':_0x119d4d['attributes'],'include':_0x119d4d[_0x9022('0x1d')]?_[_0x9022('0x1f')](_0x119d4d['include'],function(_0x3c6ab3){return{'model':db[_0x3c6ab3['model']],'as':_0x3c6ab3['as'],'attributes':_0x3c6ab3[_0x9022('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9022('0xe')](function(_0x3f13cc){logger[_0x9022('0xf')]('ShowSound',_0x533a8b);logger['debug']('ShowSound',_0x533a8b,JSON[_0x9022('0x12')](_0x3f13cc));_0x5ca683(_0x3f13cc);})[_0x9022('0x21')](function(_0x4196d9){logger[_0x9022('0x13')](_0x9022('0x22'),_0x4196d9[_0x9022('0x15')],_0x533a8b);_0x16f2e8(_0x287f16['error'](0x1f4,_0x4196d9[_0x9022('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 6ec2ea8..22617fd 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 _0xd8b0=['update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','/:id'];(function(_0x1aa335,_0x13a0c0){var _0x2c63f9=function(_0x393433){while(--_0x393433){_0x1aa335['push'](_0x1aa335['shift']());}};_0x2c63f9(++_0x13a0c0);}(_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('./squareMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['post']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xb')]);router[_0x0d8b('0xc')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xd'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);module['exports']=router; \ No newline at end of file +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(_0x253b37,_0xdb7ae0){var _0x24b147=function(_0x38c58d){while(--_0x38c58d){_0x253b37['push'](_0x253b37['shift']());}};_0x24b147(++_0xdb7ae0);}(_0x2032,0xd9));var _0x2203=function(_0x48a0fd,_0x1bd5ce){_0x48a0fd=_0x48a0fd-0x0;var _0x500845=_0x2032[_0x48a0fd];return _0x500845;};'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 diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 0847714..009ba90 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 _0x098b=['sequelize','STRING','TEXT','medium','ENUM','out'];(function(_0x573114,_0x12b35e){var _0x142aa0=function(_0x276dee){while(--_0x276dee){_0x573114['push'](_0x573114['shift']());}};_0x142aa0(++_0x12b35e);}(_0x098b,0x174));var _0xb098=function(_0x4bfdb1,_0x562289){_0x4bfdb1=_0x4bfdb1-0x0;var _0x543a08=_0x098b[_0x4bfdb1];return _0x543a08;};'use strict';var Sequelize=require(_0xb098('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xb098('0x1')]},'body':{'type':Sequelize[_0xb098('0x2')](_0xb098('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xb098('0x4')]('in','out'),'defaultValue':_0xb098('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xb098('0x2')]}}; \ No newline at end of file +var _0xe58f=['ENUM','out','sequelize','exports','STRING','TEXT'];(function(_0x5159a4,_0x2bf494){var _0x10b8fb=function(_0x2c6351){while(--_0x2c6351){_0x5159a4['push'](_0x5159a4['shift']());}};_0x10b8fb(++_0x2bf494);}(_0xe58f,0x176));var _0xfe58=function(_0xba030e,_0x429125){_0xba030e=_0xba030e-0x0;var _0x4d897c=_0xe58f[_0xba030e];return _0x4d897c;};'use strict';var Sequelize=require(_0xfe58('0x0'));module[_0xfe58('0x1')]={'uniqueid':{'type':Sequelize[_0xfe58('0x2')]},'body':{'type':Sequelize[_0xfe58('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xfe58('0x4')]('in',_0xfe58('0x5')),'defaultValue':_0xfe58('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0xfe58('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 8de6bf5..2e6af31 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 _0x1a95=['eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','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','sendStatus','status','json','undefined','limit','offset','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','index','map','SquareMessage','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','params','length','include','find','create','body'];(function(_0x568051,_0xfeb755){var _0x304aa8=function(_0xe4bd74){while(--_0xe4bd74){_0x568051['push'](_0x568051['shift']());}};_0x304aa8(++_0xfeb755);}(_0x1a95,0x130));var _0x51a9=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1a95[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x51a9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x51a9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x51a9('0x2'));var moment=require(_0x51a9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x51a9('0x4'));var util=require(_0x51a9('0x5'));var path=require(_0x51a9('0x6'));var sox=require(_0x51a9('0x7'));var csv=require(_0x51a9('0x8'));var ejs=require(_0x51a9('0x9'));var fs=require('fs');var fs_extra=require(_0x51a9('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x51a9('0xb'));var jsforce=require(_0x51a9('0xc'));var deskjs=require(_0x51a9('0xd'));var toCsv=require(_0x51a9('0x8'));var querystring=require('querystring');var Papa=require(_0x51a9('0xe'));var Redis=require(_0x51a9('0xf'));var authService=require(_0x51a9('0x10'));var qs=require(_0x51a9('0x11'));var as=require(_0x51a9('0x12'));var hardwareService=require(_0x51a9('0x13'));var logger=require(_0x51a9('0x14'))('api');var utils=require(_0x51a9('0x15'));var config=require(_0x51a9('0x16'));var licenseUtil=require(_0x51a9('0x17'));var db=require(_0x51a9('0x18'))['db'];function respondWithStatusCode(_0x299202,_0x14b5f1){_0x14b5f1=_0x14b5f1||0xcc;return function(_0x37ea3b){if(_0x37ea3b){return _0x299202[_0x51a9('0x19')](_0x14b5f1);}return _0x299202['status'](_0x14b5f1)['end']();};}function respondWithResult(_0x5161a0,_0x4d119f){_0x4d119f=_0x4d119f||0xc8;return function(_0x5cbbf0){if(_0x5cbbf0){return _0x5161a0[_0x51a9('0x1a')](_0x4d119f)[_0x51a9('0x1b')](_0x5cbbf0);}};}function respondWithFilteredResult(_0x1b33fc,_0x445dbc){return function(_0x20150a){if(_0x20150a){var _0x22bd00=typeof _0x445dbc['offset']===_0x51a9('0x1c')&&typeof _0x445dbc[_0x51a9('0x1d')]===_0x51a9('0x1c');var _0x55ead6=_0x20150a['count'];var _0x26b900=_0x22bd00?0x0:_0x445dbc[_0x51a9('0x1e')];var _0x31c02d=_0x22bd00?_0x20150a['count']:_0x445dbc[_0x51a9('0x1e')]+_0x445dbc[_0x51a9('0x1d')];var _0x426a43;if(_0x31c02d>=_0x55ead6){_0x31c02d=_0x55ead6;_0x426a43=0xc8;}else{_0x426a43=0xce;}_0x1b33fc[_0x51a9('0x1a')](_0x426a43);return _0x1b33fc[_0x51a9('0x1f')](_0x51a9('0x20'),_0x26b900+'-'+_0x31c02d+'/'+_0x55ead6)['json'](_0x20150a);}return null;};}function patchUpdates(_0x32e6f1){return function(_0x5e6659){try{jsonpatch[_0x51a9('0x21')](_0x5e6659,_0x32e6f1,!![]);}catch(_0x26a29c){return BPromise[_0x51a9('0x22')](_0x26a29c);}return _0x5e6659['save']();};}function saveUpdates(_0x2c7d38,_0x160a2a){return function(_0x5e6ea8){if(_0x5e6ea8){return _0x5e6ea8[_0x51a9('0x23')](_0x2c7d38)[_0x51a9('0x24')](function(_0x571962){return _0x571962;});}return null;};}function removeEntity(_0x2b5424,_0x36e505){return function(_0x18f177){if(_0x18f177){return _0x18f177[_0x51a9('0x25')]()[_0x51a9('0x24')](function(){_0x2b5424[_0x51a9('0x1a')](0xcc)[_0x51a9('0x26')]();});}};}function handleEntityNotFound(_0x15c3b4,_0x180325){return function(_0x11ff16){if(!_0x11ff16){_0x15c3b4[_0x51a9('0x19')](0x194);}return _0x11ff16;};}function handleError(_0x29fdea,_0x327baf){_0x327baf=_0x327baf||0x1f4;return function(_0x424b68){logger[_0x51a9('0x27')](_0x424b68[_0x51a9('0x28')]);if(_0x424b68[_0x51a9('0x29')]){delete _0x424b68['name'];}_0x29fdea[_0x51a9('0x1a')](_0x327baf)['send'](_0x424b68);};}exports[_0x51a9('0x2a')]=function(_0x4350e0,_0x1d7af8){var _0x231145={},_0x1dad0d={},_0x27c95c={'count':0x0,'rows':[]};var _0x4871c8=_[_0x51a9('0x2b')](db[_0x51a9('0x2c')][_0x51a9('0x2d')],function(_0x258a9b){return{'name':_0x258a9b[_0x51a9('0x2e')],'type':_0x258a9b[_0x51a9('0x2f')]['key']};});_0x1dad0d[_0x51a9('0x30')]=_[_0x51a9('0x2b')](_0x4871c8,_0x51a9('0x29'));_0x1dad0d[_0x51a9('0x31')]=_[_0x51a9('0x32')](_0x4350e0['query']);_0x1dad0d[_0x51a9('0x33')]=_['intersection'](_0x1dad0d[_0x51a9('0x30')],_0x1dad0d['query']);_0x231145[_0x51a9('0x34')]=_[_0x51a9('0x35')](_0x1dad0d[_0x51a9('0x30')],qs[_0x51a9('0x36')](_0x4350e0['query'][_0x51a9('0x36')]));_0x231145[_0x51a9('0x34')]=_0x231145['attributes']['length']?_0x231145[_0x51a9('0x34')]:_0x1dad0d[_0x51a9('0x30')];if(!_0x4350e0[_0x51a9('0x31')][_0x51a9('0x37')](_0x51a9('0x38'))){_0x231145[_0x51a9('0x1d')]=qs[_0x51a9('0x1d')](_0x4350e0['query'][_0x51a9('0x1d')]);_0x231145[_0x51a9('0x1e')]=qs[_0x51a9('0x1e')](_0x4350e0[_0x51a9('0x31')][_0x51a9('0x1e')]);}_0x231145[_0x51a9('0x39')]=qs[_0x51a9('0x3a')](_0x4350e0[_0x51a9('0x31')][_0x51a9('0x3a')]);_0x231145[_0x51a9('0x3b')]=qs['filters'](_[_0x51a9('0x3c')](_0x4350e0[_0x51a9('0x31')],_0x1dad0d['filters']),_0x4871c8);if(_0x4350e0['query'][_0x51a9('0x3d')]){_0x231145[_0x51a9('0x3b')]=_[_0x51a9('0x3e')](_0x231145[_0x51a9('0x3b')],{'$or':_[_0x51a9('0x2b')](_0x4871c8,function(_0x90a613){if(_0x90a613[_0x51a9('0x2f')]!==_0x51a9('0x3f')){var _0x8a1f82={};_0x8a1f82[_0x90a613[_0x51a9('0x29')]]={'$like':'%'+_0x4350e0['query'][_0x51a9('0x3d')]+'%'};return _0x8a1f82;}})});}_0x231145=_[_0x51a9('0x3e')]({},_0x231145,_0x4350e0[_0x51a9('0x40')]);var _0x5ecb29={'where':_0x231145[_0x51a9('0x3b')]};return db['SquareMessage'][_0x51a9('0x41')](_0x5ecb29)[_0x51a9('0x24')](function(_0x30f6b2){_0x27c95c[_0x51a9('0x41')]=_0x30f6b2;if(_0x4350e0[_0x51a9('0x31')][_0x51a9('0x42')]){_0x231145['include']=[{'all':!![]}];}return db['SquareMessage'][_0x51a9('0x43')](_0x231145);})[_0x51a9('0x24')](function(_0x4aaf0f){_0x27c95c[_0x51a9('0x44')]=_0x4aaf0f;return _0x27c95c;})[_0x51a9('0x24')](respondWithFilteredResult(_0x1d7af8,_0x231145))[_0x51a9('0x45')](handleError(_0x1d7af8,null));};exports['show']=function(_0x160367,_0x27147e){var _0x6584e6={'raw':!![],'where':{'id':_0x160367[_0x51a9('0x46')]['id']}},_0x41fca5={};_0x41fca5[_0x51a9('0x30')]=_[_0x51a9('0x32')](db['SquareMessage'][_0x51a9('0x2d')]);_0x41fca5[_0x51a9('0x31')]=_[_0x51a9('0x32')](_0x160367[_0x51a9('0x31')]);_0x41fca5[_0x51a9('0x33')]=_[_0x51a9('0x35')](_0x41fca5[_0x51a9('0x30')],_0x41fca5[_0x51a9('0x31')]);_0x6584e6[_0x51a9('0x34')]=_['intersection'](_0x41fca5[_0x51a9('0x30')],qs[_0x51a9('0x36')](_0x160367[_0x51a9('0x31')][_0x51a9('0x36')]));_0x6584e6['attributes']=_0x6584e6[_0x51a9('0x34')][_0x51a9('0x47')]?_0x6584e6[_0x51a9('0x34')]:_0x41fca5[_0x51a9('0x30')];if(_0x160367[_0x51a9('0x31')][_0x51a9('0x42')]){_0x6584e6[_0x51a9('0x48')]=[{'all':!![]}];}_0x6584e6=_['merge']({},_0x6584e6,_0x160367['options']);return db[_0x51a9('0x2c')][_0x51a9('0x49')](_0x6584e6)[_0x51a9('0x24')](handleEntityNotFound(_0x27147e,null))[_0x51a9('0x24')](respondWithResult(_0x27147e,null))[_0x51a9('0x45')](handleError(_0x27147e,null));};exports[_0x51a9('0x4a')]=function(_0x1ba76b,_0xa7c723){return db['SquareMessage'][_0x51a9('0x4a')](_0x1ba76b[_0x51a9('0x4b')],{})['then'](respondWithResult(_0xa7c723,0xc9))[_0x51a9('0x45')](handleError(_0xa7c723,null));};exports[_0x51a9('0x23')]=function(_0x2ef9ac,_0x5f4e11){if(_0x2ef9ac[_0x51a9('0x4b')]['id']){delete _0x2ef9ac[_0x51a9('0x4b')]['id'];}return db[_0x51a9('0x2c')][_0x51a9('0x49')]({'where':{'id':_0x2ef9ac[_0x51a9('0x46')]['id']}})[_0x51a9('0x24')](handleEntityNotFound(_0x5f4e11,null))[_0x51a9('0x24')](saveUpdates(_0x2ef9ac['body'],null))['then'](respondWithResult(_0x5f4e11,null))[_0x51a9('0x45')](handleError(_0x5f4e11,null));};exports['destroy']=function(_0x2bcbdc,_0x54e608){return db[_0x51a9('0x2c')]['find']({'where':{'id':_0x2bcbdc[_0x51a9('0x46')]['id']}})[_0x51a9('0x24')](handleEntityNotFound(_0x54e608,null))[_0x51a9('0x24')](removeEntity(_0x54e608,null))[_0x51a9('0x45')](handleError(_0x54e608,null));}; \ No newline at end of file +var _0x11c1=['include','findAll','catch','show','params','includeAll','create','body','find','eml-format','zip-dir','fast-json-patch','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareMessage','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options'];(function(_0x1b28e,_0x3837e5){var _0x48856f=function(_0x5d795c){while(--_0x5d795c){_0x1b28e['push'](_0x1b28e['shift']());}};_0x48856f(++_0x3837e5);}(_0x11c1,0x1cb));var _0x111c=function(_0x176595,_0x3c430a){_0x176595=_0x176595-0x0;var _0x446e95=_0x11c1[_0x176595];return _0x446e95;};'use strict';var emlformat=require(_0x111c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x111c('0x1'));var jsonpatch=require(_0x111c('0x2'));var rp=require(_0x111c('0x3'));var moment=require(_0x111c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x111c('0x5'));var util=require(_0x111c('0x6'));var path=require(_0x111c('0x7'));var sox=require(_0x111c('0x8'));var csv=require(_0x111c('0x9'));var ejs=require(_0x111c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x111c('0xb'));var squel=require(_0x111c('0xc'));var crypto=require(_0x111c('0xd'));var jsforce=require(_0x111c('0xe'));var deskjs=require(_0x111c('0xf'));var toCsv=require(_0x111c('0x9'));var querystring=require(_0x111c('0x10'));var Papa=require(_0x111c('0x11'));var Redis=require(_0x111c('0x12'));var authService=require(_0x111c('0x13'));var qs=require(_0x111c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x111c('0x15'));var config=require(_0x111c('0x16'));var licenseUtil=require(_0x111c('0x17'));var db=require(_0x111c('0x18'))['db'];function respondWithStatusCode(_0x161df9,_0x18f728){_0x18f728=_0x18f728||0xcc;return function(_0x37deee){if(_0x37deee){return _0x161df9[_0x111c('0x19')](_0x18f728);}return _0x161df9[_0x111c('0x1a')](_0x18f728)[_0x111c('0x1b')]();};}function respondWithResult(_0x1b0dd5,_0x37a4bd){_0x37a4bd=_0x37a4bd||0xc8;return function(_0x3ad856){if(_0x3ad856){return _0x1b0dd5[_0x111c('0x1a')](_0x37a4bd)[_0x111c('0x1c')](_0x3ad856);}};}function respondWithFilteredResult(_0x412f7e,_0x2d2adb){return function(_0x9e7a7c){if(_0x9e7a7c){var _0x3babf6=typeof _0x2d2adb['offset']==='undefined'&&typeof _0x2d2adb['limit']===_0x111c('0x1d');var _0x4bd3d8=_0x9e7a7c['count'];var _0x198249=_0x3babf6?0x0:_0x2d2adb[_0x111c('0x1e')];var _0x2d54e6=_0x3babf6?_0x9e7a7c[_0x111c('0x1f')]:_0x2d2adb[_0x111c('0x1e')]+_0x2d2adb[_0x111c('0x20')];var _0x5b9171;if(_0x2d54e6>=_0x4bd3d8){_0x2d54e6=_0x4bd3d8;_0x5b9171=0xc8;}else{_0x5b9171=0xce;}_0x412f7e[_0x111c('0x1a')](_0x5b9171);return _0x412f7e[_0x111c('0x21')]('Content-Range',_0x198249+'-'+_0x2d54e6+'/'+_0x4bd3d8)[_0x111c('0x1c')](_0x9e7a7c);}return null;};}function patchUpdates(_0x211de8){return function(_0x1df840){try{jsonpatch['apply'](_0x1df840,_0x211de8,!![]);}catch(_0x39ebe3){return BPromise[_0x111c('0x22')](_0x39ebe3);}return _0x1df840[_0x111c('0x23')]();};}function saveUpdates(_0x54a586,_0x31b236){return function(_0x17d02b){if(_0x17d02b){return _0x17d02b[_0x111c('0x24')](_0x54a586)[_0x111c('0x25')](function(_0x2c4c6b){return _0x2c4c6b;});}return null;};}function removeEntity(_0x3da021,_0xe5b252){return function(_0x3694b5){if(_0x3694b5){return _0x3694b5[_0x111c('0x26')]()['then'](function(){_0x3da021[_0x111c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26b3b8,_0x2576b8){return function(_0x5764b9){if(!_0x5764b9){_0x26b3b8[_0x111c('0x19')](0x194);}return _0x5764b9;};}function handleError(_0x17a9cd,_0x55e7d0){_0x55e7d0=_0x55e7d0||0x1f4;return function(_0x33040d){logger[_0x111c('0x27')](_0x33040d[_0x111c('0x28')]);if(_0x33040d[_0x111c('0x29')]){delete _0x33040d[_0x111c('0x29')];}_0x17a9cd[_0x111c('0x1a')](_0x55e7d0)[_0x111c('0x2a')](_0x33040d);};}exports[_0x111c('0x2b')]=function(_0x46e407,_0x70592b){var _0x5e3047={},_0x40d992={},_0x45bd8c={'count':0x0,'rows':[]};var _0x4c9c67=_[_0x111c('0x2c')](db[_0x111c('0x2d')]['rawAttributes'],function(_0x401138){return{'name':_0x401138[_0x111c('0x2e')],'type':_0x401138['type'][_0x111c('0x2f')]};});_0x40d992['model']=_['map'](_0x4c9c67,_0x111c('0x29'));_0x40d992[_0x111c('0x30')]=_[_0x111c('0x31')](_0x46e407[_0x111c('0x30')]);_0x40d992[_0x111c('0x32')]=_[_0x111c('0x33')](_0x40d992[_0x111c('0x34')],_0x40d992[_0x111c('0x30')]);_0x5e3047[_0x111c('0x35')]=_[_0x111c('0x33')](_0x40d992[_0x111c('0x34')],qs[_0x111c('0x36')](_0x46e407[_0x111c('0x30')]['fields']));_0x5e3047[_0x111c('0x35')]=_0x5e3047[_0x111c('0x35')][_0x111c('0x37')]?_0x5e3047['attributes']:_0x40d992[_0x111c('0x34')];if(!_0x46e407[_0x111c('0x30')][_0x111c('0x38')](_0x111c('0x39'))){_0x5e3047[_0x111c('0x20')]=qs[_0x111c('0x20')](_0x46e407[_0x111c('0x30')]['limit']);_0x5e3047[_0x111c('0x1e')]=qs['offset'](_0x46e407[_0x111c('0x30')][_0x111c('0x1e')]);}_0x5e3047[_0x111c('0x3a')]=qs[_0x111c('0x3b')](_0x46e407['query'][_0x111c('0x3b')]);_0x5e3047['where']=qs[_0x111c('0x32')](_['pick'](_0x46e407[_0x111c('0x30')],_0x40d992[_0x111c('0x32')]),_0x4c9c67);if(_0x46e407[_0x111c('0x30')][_0x111c('0x3c')]){_0x5e3047[_0x111c('0x3d')]=_[_0x111c('0x3e')](_0x5e3047[_0x111c('0x3d')],{'$or':_[_0x111c('0x2c')](_0x4c9c67,function(_0x56fb83){if(_0x56fb83[_0x111c('0x3f')]!==_0x111c('0x40')){var _0x591fe1={};_0x591fe1[_0x56fb83['name']]={'$like':'%'+_0x46e407[_0x111c('0x30')]['filter']+'%'};return _0x591fe1;}})});}_0x5e3047=_['merge']({},_0x5e3047,_0x46e407[_0x111c('0x41')]);var _0x5ffb09={'where':_0x5e3047[_0x111c('0x3d')]};return db[_0x111c('0x2d')][_0x111c('0x1f')](_0x5ffb09)[_0x111c('0x25')](function(_0x167b00){_0x45bd8c[_0x111c('0x1f')]=_0x167b00;if(_0x46e407[_0x111c('0x30')]['includeAll']){_0x5e3047[_0x111c('0x42')]=[{'all':!![]}];}return db[_0x111c('0x2d')][_0x111c('0x43')](_0x5e3047);})['then'](function(_0x354dca){_0x45bd8c['rows']=_0x354dca;return _0x45bd8c;})['then'](respondWithFilteredResult(_0x70592b,_0x5e3047))[_0x111c('0x44')](handleError(_0x70592b,null));};exports[_0x111c('0x45')]=function(_0x10f4f7,_0x22e95b){var _0x38d7a0={'raw':!![],'where':{'id':_0x10f4f7[_0x111c('0x46')]['id']}},_0x1b4e4f={};_0x1b4e4f[_0x111c('0x34')]=_['keys'](db[_0x111c('0x2d')]['rawAttributes']);_0x1b4e4f[_0x111c('0x30')]=_[_0x111c('0x31')](_0x10f4f7[_0x111c('0x30')]);_0x1b4e4f[_0x111c('0x32')]=_[_0x111c('0x33')](_0x1b4e4f['model'],_0x1b4e4f['query']);_0x38d7a0[_0x111c('0x35')]=_[_0x111c('0x33')](_0x1b4e4f[_0x111c('0x34')],qs['fields'](_0x10f4f7['query']['fields']));_0x38d7a0['attributes']=_0x38d7a0[_0x111c('0x35')]['length']?_0x38d7a0['attributes']:_0x1b4e4f['model'];if(_0x10f4f7[_0x111c('0x30')][_0x111c('0x47')]){_0x38d7a0['include']=[{'all':!![]}];}_0x38d7a0=_['merge']({},_0x38d7a0,_0x10f4f7['options']);return db[_0x111c('0x2d')]['find'](_0x38d7a0)[_0x111c('0x25')](handleEntityNotFound(_0x22e95b,null))[_0x111c('0x25')](respondWithResult(_0x22e95b,null))[_0x111c('0x44')](handleError(_0x22e95b,null));};exports[_0x111c('0x48')]=function(_0x2849b6,_0x137ee5){return db['SquareMessage'][_0x111c('0x48')](_0x2849b6[_0x111c('0x49')],{})['then'](respondWithResult(_0x137ee5,0xc9))[_0x111c('0x44')](handleError(_0x137ee5,null));};exports[_0x111c('0x24')]=function(_0x8cad9c,_0x24731d){if(_0x8cad9c[_0x111c('0x49')]['id']){delete _0x8cad9c[_0x111c('0x49')]['id'];}return db[_0x111c('0x2d')][_0x111c('0x4a')]({'where':{'id':_0x8cad9c[_0x111c('0x46')]['id']}})[_0x111c('0x25')](handleEntityNotFound(_0x24731d,null))['then'](saveUpdates(_0x8cad9c['body'],null))[_0x111c('0x25')](respondWithResult(_0x24731d,null))[_0x111c('0x44')](handleError(_0x24731d,null));};exports[_0x111c('0x26')]=function(_0x4288ab,_0x584c6f){return db['SquareMessage'][_0x111c('0x4a')]({'where':{'id':_0x4288ab[_0x111c('0x46')]['id']}})[_0x111c('0x25')](handleEntityNotFound(_0x584c6f,null))[_0x111c('0x25')](removeEntity(_0x584c6f,null))['catch'](handleError(_0x584c6f,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index ac590e4..a460d22 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 _0x9b5a=['../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x561771,_0x554760){var _0x54d16e=function(_0x381c1f){while(--_0x381c1f){_0x561771['push'](_0x561771['shift']());}};_0x54d16e(++_0x554760);}(_0x9b5a,0x88));var _0xa9b5=function(_0x1b5b70,_0xfd0642){_0x1b5b70=_0x1b5b70-0x0;var _0x55fee3=_0x9b5a[_0x1b5b70];return _0x55fee3;};'use strict';var _=require(_0xa9b5('0x0'));var util=require(_0xa9b5('0x1'));var logger=require(_0xa9b5('0x2'))(_0xa9b5('0x3'));var moment=require(_0xa9b5('0x4'));var BPromise=require('bluebird');var rp=require(_0xa9b5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9b5('0x6'));var config=require(_0xa9b5('0x7'));var attributes=require(_0xa9b5('0x8'));module[_0xa9b5('0x9')]=function(_0x6cd92,_0x366c58){return _0x6cd92[_0xa9b5('0xa')](_0xa9b5('0xb'),attributes,{'tableName':_0xa9b5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9226=['moment','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','square_messages','lodash','util'];(function(_0x19a1ae,_0x38a7b9){var _0x32f843=function(_0x5e1a8c){while(--_0x5e1a8c){_0x19a1ae['push'](_0x19a1ae['shift']());}};_0x32f843(++_0x38a7b9);}(_0x9226,0x11e));var _0x6922=function(_0x497c6d,_0x2a18b0){_0x497c6d=_0x497c6d-0x0;var _0x4f440a=_0x9226[_0x497c6d];return _0x4f440a;};'use strict';var _=require(_0x6922('0x0'));var util=require(_0x6922('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6922('0x2'));var BPromise=require('bluebird');var rp=require(_0x6922('0x3'));var fs=require('fs');var path=require(_0x6922('0x4'));var rimraf=require(_0x6922('0x5'));var config=require(_0x6922('0x6'));var attributes=require(_0x6922('0x7'));module['exports']=function(_0x576d6f,_0x1177d5){return _0x576d6f['define']('SquareMessage',attributes,{'tableName':_0x6922('0x8'),'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 e027422..71ff62f 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 _0x5da5=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareMessage,\x20%s,\x20%s','result','catch','CreateSquareMessage','create','body','options','raw','lodash','util','bluebird'];(function(_0x4c7d65,_0x200be2){var _0x18d0a9=function(_0x43770a){while(--_0x43770a){_0x4c7d65['push'](_0x4c7d65['shift']());}};_0x18d0a9(++_0x200be2);}(_0x5da5,0x159));var _0x55da=function(_0x5cbd2b,_0xf71c2e){_0x5cbd2b=_0x5cbd2b-0x0;var _0x5bfbd8=_0x5da5[_0x5cbd2b];return _0x5bfbd8;};'use strict';var _=require(_0x55da('0x0'));var util=require(_0x55da('0x1'));var moment=require('moment');var BPromise=require(_0x55da('0x2'));var rs=require(_0x55da('0x3'));var fs=require('fs');var Redis=require(_0x55da('0x4'));var db=require(_0x55da('0x5'))['db'];var utils=require(_0x55da('0x6'));var logger=require('../../config/logger')(_0x55da('0x7'));var config=require(_0x55da('0x8'));var jayson=require(_0x55da('0x9'));var client=jayson['client'][_0x55da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d34f1,_0x164556,_0x11da0c){return new BPromise(function(_0x276b05,_0x529072){return client[_0x55da('0xb')](_0x1d34f1,_0x11da0c)[_0x55da('0xc')](function(_0x1de10d){logger[_0x55da('0xd')]('SquareMessage,\x20%s,\x20%s',_0x164556,_0x55da('0xe'));logger[_0x55da('0xf')](_0x55da('0x10'),_0x164556,'request\x20sent',JSON[_0x55da('0x11')](_0x1de10d));if(_0x1de10d[_0x55da('0x12')]){if(_0x1de10d[_0x55da('0x12')][_0x55da('0x13')]===0x1f4){logger[_0x55da('0x12')]('SquareMessage,\x20%s,\x20%s',_0x164556,_0x1de10d[_0x55da('0x12')][_0x55da('0x14')]);return _0x529072(_0x1de10d[_0x55da('0x12')]['message']);}logger['error'](_0x55da('0x15'),_0x164556,_0x1de10d[_0x55da('0x12')][_0x55da('0x14')]);return _0x276b05(_0x1de10d[_0x55da('0x12')][_0x55da('0x14')]);}else{logger[_0x55da('0xd')]('SquareMessage,\x20%s,\x20%s',_0x164556,_0x55da('0xe'));_0x276b05(_0x1de10d[_0x55da('0x16')][_0x55da('0x14')]);}})[_0x55da('0x17')](function(_0x4c8860){logger[_0x55da('0x12')]('SquareMessage,\x20%s,\x20%s',_0x164556,_0x4c8860);_0x529072(_0x4c8860);});});}exports[_0x55da('0x18')]=function(_0x586b3e){var _0x3ddcec=this;return new Promise(function(_0x58867b,_0x5ce6db){return db['SquareMessage'][_0x55da('0x19')](_0x586b3e[_0x55da('0x1a')],{'raw':_0x586b3e[_0x55da('0x1b')]?_0x586b3e[_0x55da('0x1b')][_0x55da('0x1c')]===undefined?!![]:![]:!![]})[_0x55da('0xc')](function(_0x3e96c7){logger[_0x55da('0xd')]('CreateSquareMessage',_0x586b3e);logger[_0x55da('0xf')]('CreateSquareMessage',_0x586b3e,JSON['stringify'](_0x3e96c7));_0x58867b(_0x3e96c7);})[_0x55da('0x17')](function(_0x345ca5){logger[_0x55da('0x12')]('CreateSquareMessage',_0x345ca5['message'],_0x586b3e);_0x5ce6db(_0x3ddcec[_0x55da('0x12')](0x1f4,_0x345ca5['message']));});});}; \ No newline at end of file +var _0x621b=['../../config/environment','jayson/promise','client','http','request','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','SquareMessage','create','CreateSquareMessage','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x301064,_0x1985aa){var _0x5bc841=function(_0x57dffc){while(--_0x57dffc){_0x301064['push'](_0x301064['shift']());}};_0x5bc841(++_0x1985aa);}(_0x621b,0x14a));var _0xb621=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x621b[_0x616290];return _0x453879;};'use strict';var _=require(_0xb621('0x0'));var util=require(_0xb621('0x1'));var moment=require(_0xb621('0x2'));var BPromise=require(_0xb621('0x3'));var rs=require(_0xb621('0x4'));var fs=require('fs');var Redis=require(_0xb621('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xb621('0x6'));var jayson=require(_0xb621('0x7'));var client=jayson[_0xb621('0x8')][_0xb621('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d3039,_0x4b300d,_0x84d806){return new BPromise(function(_0x323ec4,_0x49dfcb){return client[_0xb621('0xa')](_0x3d3039,_0x84d806)[_0xb621('0xb')](function(_0x38fced){logger['info'](_0xb621('0xc'),_0x4b300d,_0xb621('0xd'));logger[_0xb621('0xe')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x4b300d,_0xb621('0xd'),JSON['stringify'](_0x38fced));if(_0x38fced[_0xb621('0xf')]){if(_0x38fced[_0xb621('0xf')][_0xb621('0x10')]===0x1f4){logger['error'](_0xb621('0xc'),_0x4b300d,_0x38fced['error'][_0xb621('0x11')]);return _0x49dfcb(_0x38fced[_0xb621('0xf')][_0xb621('0x11')]);}logger[_0xb621('0xf')](_0xb621('0xc'),_0x4b300d,_0x38fced[_0xb621('0xf')][_0xb621('0x11')]);return _0x323ec4(_0x38fced[_0xb621('0xf')]['message']);}else{logger[_0xb621('0x12')]('SquareMessage,\x20%s,\x20%s',_0x4b300d,'request\x20sent');_0x323ec4(_0x38fced[_0xb621('0x13')][_0xb621('0x11')]);}})[_0xb621('0x14')](function(_0xc60c40){logger[_0xb621('0xf')](_0xb621('0xc'),_0x4b300d,_0xc60c40);_0x49dfcb(_0xc60c40);});});}exports['CreateSquareMessage']=function(_0x9522cf){var _0x5f5bfa=this;return new Promise(function(_0x4f33a6,_0x5f2f12){return db[_0xb621('0x15')][_0xb621('0x16')](_0x9522cf['body'],{'raw':_0x9522cf['options']?_0x9522cf['options']['raw']===undefined?!![]:![]:!![]})[_0xb621('0xb')](function(_0x1e64a3){logger['info'](_0xb621('0x17'),_0x9522cf);logger[_0xb621('0xe')](_0xb621('0x17'),_0x9522cf,JSON['stringify'](_0x1e64a3));_0x4f33a6(_0x1e64a3);})[_0xb621('0x14')](function(_0x3e3594){logger['error'](_0xb621('0x17'),_0x3e3594[_0xb621('0x11')],_0x9522cf);_0x5f2f12(_0x5f5bfa[_0xb621('0xf')](0x1f4,_0x3e3594[_0xb621('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 9602546..5ec2b53 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 _0x9b17=['/:id','show','/:id/test','isAuthenticated','15s','test','post','put','update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','index'];(function(_0x3f8f5a,_0x5402a7){var _0x54f222=function(_0x57d2b3){while(--_0x57d2b3){_0x3f8f5a['push'](_0x3f8f5a['shift']());}};_0x54f222(++_0x5402a7);}(_0x9b17,0x198));var _0x79b1=function(_0x34c6a3,_0x3e1a91){_0x34c6a3=_0x34c6a3-0x0;var _0x58fcda=_0x9b17[_0x34c6a3];return _0x58fcda;};'use strict';var multer=require(_0x79b1('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x79b1('0x1'));var router=express[_0x79b1('0x2')]();var fs_extra=require(_0x79b1('0x3'));var auth=require(_0x79b1('0x4'));var interaction=require(_0x79b1('0x5'));var config=require(_0x79b1('0x6'));var controller=require(_0x79b1('0x7'));router[_0x79b1('0x8')]('/',auth['isAuthenticated'](),controller[_0x79b1('0x9')]);router[_0x79b1('0x8')](_0x79b1('0xa'),auth['isAuthenticated'](),controller[_0x79b1('0xb')]);router[_0x79b1('0x8')](_0x79b1('0xc'),auth[_0x79b1('0xd')](),timeout(_0x79b1('0xe')),controller[_0x79b1('0xf')]);router[_0x79b1('0x10')]('/',auth[_0x79b1('0xd')](),controller['create']);router[_0x79b1('0x11')](_0x79b1('0xa'),auth[_0x79b1('0xd')](),controller[_0x79b1('0x12')]);router[_0x79b1('0x13')](_0x79b1('0xa'),auth['isAuthenticated'](),controller[_0x79b1('0x14')]);module[_0x79b1('0x15')]=router; \ No newline at end of file +var _0xc761=['isAuthenticated','show','/:id/test','test','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareOdbc.controller','index','get','/:id'];(function(_0xfa73ac,_0x2a7395){var _0x4e8e14=function(_0x9b5698){while(--_0x9b5698){_0xfa73ac['push'](_0xfa73ac['shift']());}};_0x4e8e14(++_0x2a7395);}(_0xc761,0x1d6));var _0x1c76=function(_0xf33afd,_0x2363b6){_0xf33afd=_0xf33afd-0x0;var _0x5f432a=_0xc761[_0xf33afd];return _0x5f432a;};'use strict';var multer=require(_0x1c76('0x0'));var util=require(_0x1c76('0x1'));var path=require(_0x1c76('0x2'));var timeout=require(_0x1c76('0x3'));var express=require(_0x1c76('0x4'));var router=express[_0x1c76('0x5')]();var fs_extra=require(_0x1c76('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1c76('0x7'));var config=require(_0x1c76('0x8'));var controller=require(_0x1c76('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1c76('0xa')]);router[_0x1c76('0xb')](_0x1c76('0xc'),auth[_0x1c76('0xd')](),controller[_0x1c76('0xe')]);router['get'](_0x1c76('0xf'),auth[_0x1c76('0xd')](),timeout('15s'),controller[_0x1c76('0x10')]);router[_0x1c76('0x11')]('/',auth[_0x1c76('0xd')](),controller[_0x1c76('0x12')]);router[_0x1c76('0x13')](_0x1c76('0xc'),auth[_0x1c76('0xd')](),controller[_0x1c76('0x14')]);router[_0x1c76('0x15')](_0x1c76('0xc'),auth[_0x1c76('0xd')](),controller[_0x1c76('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 f5bc207..e5de8d3 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 _0x7fea=['name','sequelize','exports','STRING'];(function(_0x2356dc,_0x3c198f){var _0x990423=function(_0x3d2ba6){while(--_0x3d2ba6){_0x2356dc['push'](_0x2356dc['shift']());}};_0x990423(++_0x3c198f);}(_0x7fea,0xa9));var _0xa7fe=function(_0x1f11e4,_0x2f78f9){_0x1f11e4=_0x1f11e4-0x0;var _0x3e2184=_0x7fea[_0x1f11e4];return _0x3e2184;};'use strict';var Sequelize=require(_0xa7fe('0x0'));module[_0xa7fe('0x1')]={'name':{'type':Sequelize[_0xa7fe('0x2')],'unique':_0xa7fe('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xa7fe('0x2')]},'description':{'type':Sequelize[_0xa7fe('0x2')]}}; \ No newline at end of file +var _0x24c1=['STRING'];(function(_0x423306,_0x146f5a){var _0x476860=function(_0x4af8c4){while(--_0x4af8c4){_0x423306['push'](_0x423306['shift']());}};_0x476860(++_0x146f5a);}(_0x24c1,0x6f));var _0x124c=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x24c1[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x124c('0x0')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x124c('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index e1a6134..a3f4a5d 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 _0x819b=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit','undefined','count','offset','set','Content-Range','json','apply','destroy','then','get','ODBC','end','error','stack','name','send','index','map','SquareOdbc','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','keys','rawAttributes','fields','includeAll','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','test','dsn','openSync','closeSync','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x819b,0xf9));var _0xb819=function(_0xa087f5,_0x34fd10){_0xa087f5=_0xa087f5-0x0;var _0x4c8806=_0x819b[_0xa087f5];return _0x4c8806;};'use strict';var emlformat=require(_0xb819('0x0'));var rimraf=require(_0xb819('0x1'));var zipdir=require(_0xb819('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb819('0x3'));var BPromise=require(_0xb819('0x4'));var Mustache=require(_0xb819('0x5'));var util=require('util');var path=require(_0xb819('0x6'));var sox=require(_0xb819('0x7'));var csv=require('to-csv');var ejs=require(_0xb819('0x8'));var fs=require('fs');var fs_extra=require(_0xb819('0x9'));var _=require('lodash');var squel=require(_0xb819('0xa'));var crypto=require(_0xb819('0xb'));var jsforce=require(_0xb819('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb819('0xd'));var querystring=require(_0xb819('0xe'));var Papa=require('papaparse');var Redis=require(_0xb819('0xf'));var authService=require(_0xb819('0x10'));var qs=require(_0xb819('0x11'));var as=require(_0xb819('0x12'));var hardwareService=require(_0xb819('0x13'));var logger=require(_0xb819('0x14'))(_0xb819('0x15'));var utils=require(_0xb819('0x16'));var config=require(_0xb819('0x17'));var licenseUtil=require(_0xb819('0x18'));var db=require(_0xb819('0x19'))['db'];function respondWithStatusCode(_0x112a0f,_0x43a9ed){_0x43a9ed=_0x43a9ed||0xcc;return function(_0x4e27bb){if(_0x4e27bb){return _0x112a0f[_0xb819('0x1a')](_0x43a9ed);}return _0x112a0f[_0xb819('0x1b')](_0x43a9ed)['end']();};}function respondWithResult(_0x32f5a,_0x1aebfa){_0x1aebfa=_0x1aebfa||0xc8;return function(_0x5f2d0f){if(_0x5f2d0f){return _0x32f5a['status'](_0x1aebfa)['json'](_0x5f2d0f);}};}function respondWithFilteredResult(_0x2bf57f,_0x5903ea){return function(_0x2266f6){if(_0x2266f6){var _0x526103=typeof _0x5903ea['offset']==='undefined'&&typeof _0x5903ea[_0xb819('0x1c')]===_0xb819('0x1d');var _0x1eb74f=_0x2266f6[_0xb819('0x1e')];var _0x18c385=_0x526103?0x0:_0x5903ea[_0xb819('0x1f')];var _0x5bf6c3=_0x526103?_0x2266f6['count']:_0x5903ea[_0xb819('0x1f')]+_0x5903ea['limit'];var _0x2bbce8;if(_0x5bf6c3>=_0x1eb74f){_0x5bf6c3=_0x1eb74f;_0x2bbce8=0xc8;}else{_0x2bbce8=0xce;}_0x2bf57f[_0xb819('0x1b')](_0x2bbce8);return _0x2bf57f[_0xb819('0x20')](_0xb819('0x21'),_0x18c385+'-'+_0x5bf6c3+'/'+_0x1eb74f)[_0xb819('0x22')](_0x2266f6);}return null;};}function patchUpdates(_0x40ff39){return function(_0x24c088){try{jsonpatch[_0xb819('0x23')](_0x24c088,_0x40ff39,!![]);}catch(_0xa35cc7){return BPromise['reject'](_0xa35cc7);}return _0x24c088['save']();};}function saveUpdates(_0x304bc5,_0x228868){return function(_0x31b7f3){if(_0x31b7f3){return _0x31b7f3['update'](_0x304bc5)['then'](function(_0x840ba){return _0x840ba;});}return null;};}function removeEntity(_0x44e610,_0x42a9df){return function(_0x12f162){if(_0x12f162){return _0x12f162[_0xb819('0x24')]()[_0xb819('0x25')](function(){var _0x1f1079=_0x12f162[_0xb819('0x26')]({'plain':!![]});var _0x8e0003=_0xb819('0x27');return db['UserProfileResource'][_0xb819('0x24')]({'where':{'type':_0x8e0003,'resourceId':_0x1f1079['id']}})[_0xb819('0x25')](function(){return _0x12f162;});})[_0xb819('0x25')](function(){_0x44e610['status'](0xcc)[_0xb819('0x28')]();});}};}function handleEntityNotFound(_0xd854f0,_0x539b42){return function(_0x2ef84f){if(!_0x2ef84f){_0xd854f0[_0xb819('0x1a')](0x194);}return _0x2ef84f;};}function handleError(_0xdf17d0,_0x8e31f9){_0x8e31f9=_0x8e31f9||0x1f4;return function(_0x3c56eb){logger[_0xb819('0x29')](_0x3c56eb[_0xb819('0x2a')]);if(_0x3c56eb[_0xb819('0x2b')]){delete _0x3c56eb[_0xb819('0x2b')];}_0xdf17d0[_0xb819('0x1b')](_0x8e31f9)[_0xb819('0x2c')](_0x3c56eb);};}exports[_0xb819('0x2d')]=function(_0x19e022,_0x19c34f){var _0xe52da2={},_0x56a312={},_0x3f435e={'count':0x0,'rows':[]};var _0x23b101=_[_0xb819('0x2e')](db[_0xb819('0x2f')]['rawAttributes'],function(_0x11619f){return{'name':_0x11619f[_0xb819('0x30')],'type':_0x11619f[_0xb819('0x31')][_0xb819('0x32')]};});_0x56a312[_0xb819('0x33')]=_[_0xb819('0x2e')](_0x23b101,'name');_0x56a312[_0xb819('0x34')]=_['keys'](_0x19e022['query']);_0x56a312[_0xb819('0x35')]=_[_0xb819('0x36')](_0x56a312[_0xb819('0x33')],_0x56a312[_0xb819('0x34')]);_0xe52da2[_0xb819('0x37')]=_[_0xb819('0x36')](_0x56a312[_0xb819('0x33')],qs['fields'](_0x19e022[_0xb819('0x34')]['fields']));_0xe52da2[_0xb819('0x37')]=_0xe52da2['attributes'][_0xb819('0x38')]?_0xe52da2[_0xb819('0x37')]:_0x56a312[_0xb819('0x33')];if(!_0x19e022[_0xb819('0x34')][_0xb819('0x39')](_0xb819('0x3a'))){_0xe52da2[_0xb819('0x1c')]=qs[_0xb819('0x1c')](_0x19e022['query'][_0xb819('0x1c')]);_0xe52da2[_0xb819('0x1f')]=qs[_0xb819('0x1f')](_0x19e022['query'][_0xb819('0x1f')]);}_0xe52da2['order']=qs['sort'](_0x19e022['query']['sort']);_0xe52da2[_0xb819('0x3b')]=qs[_0xb819('0x35')](_[_0xb819('0x3c')](_0x19e022['query'],_0x56a312[_0xb819('0x35')]),_0x23b101);if(_0x19e022[_0xb819('0x34')][_0xb819('0x3d')]){_0xe52da2[_0xb819('0x3b')]=_[_0xb819('0x3e')](_0xe52da2[_0xb819('0x3b')],{'$or':_[_0xb819('0x2e')](_0x23b101,function(_0x103e5c){if(_0x103e5c[_0xb819('0x31')]!==_0xb819('0x3f')){var _0x17ac68={};_0x17ac68[_0x103e5c['name']]={'$like':'%'+_0x19e022[_0xb819('0x34')][_0xb819('0x3d')]+'%'};return _0x17ac68;}})});}_0xe52da2=_[_0xb819('0x3e')]({},_0xe52da2,_0x19e022['options']);var _0x566a77={'where':_0xe52da2[_0xb819('0x3b')]};return db[_0xb819('0x2f')][_0xb819('0x1e')](_0x566a77)['then'](function(_0x40788b){_0x3f435e[_0xb819('0x1e')]=_0x40788b;if(_0x19e022[_0xb819('0x34')]['includeAll']){_0xe52da2[_0xb819('0x40')]=[{'all':!![]}];}return db[_0xb819('0x2f')][_0xb819('0x41')](_0xe52da2);})[_0xb819('0x25')](function(_0x3d7458){_0x3f435e[_0xb819('0x42')]=_0x3d7458;return _0x3f435e;})[_0xb819('0x25')](respondWithFilteredResult(_0x19c34f,_0xe52da2))[_0xb819('0x43')](handleError(_0x19c34f,null));};exports[_0xb819('0x44')]=function(_0x5a6d92,_0x2a4b4a){var _0x62019a={'raw':!![],'where':{'id':_0x5a6d92['params']['id']}},_0x29a625={};_0x29a625['model']=_[_0xb819('0x45')](db[_0xb819('0x2f')][_0xb819('0x46')]);_0x29a625[_0xb819('0x34')]=_[_0xb819('0x45')](_0x5a6d92[_0xb819('0x34')]);_0x29a625[_0xb819('0x35')]=_[_0xb819('0x36')](_0x29a625[_0xb819('0x33')],_0x29a625[_0xb819('0x34')]);_0x62019a[_0xb819('0x37')]=_[_0xb819('0x36')](_0x29a625['model'],qs['fields'](_0x5a6d92[_0xb819('0x34')][_0xb819('0x47')]));_0x62019a['attributes']=_0x62019a[_0xb819('0x37')][_0xb819('0x38')]?_0x62019a[_0xb819('0x37')]:_0x29a625[_0xb819('0x33')];if(_0x5a6d92['query'][_0xb819('0x48')]){_0x62019a[_0xb819('0x40')]=[{'all':!![]}];}_0x62019a=_[_0xb819('0x3e')]({},_0x62019a,_0x5a6d92[_0xb819('0x49')]);return db[_0xb819('0x2f')]['find'](_0x62019a)[_0xb819('0x25')](handleEntityNotFound(_0x2a4b4a,null))[_0xb819('0x25')](respondWithResult(_0x2a4b4a,null))[_0xb819('0x43')](handleError(_0x2a4b4a,null));};exports[_0xb819('0x4a')]=function(_0x2867df,_0x2e5bb7){return db[_0xb819('0x2f')][_0xb819('0x4a')](_0x2867df[_0xb819('0x4b')],{})[_0xb819('0x25')](function(_0x3d70dd){var _0x58d386=_0x2867df['user'][_0xb819('0x26')]({'plain':!![]});if(!_0x58d386)throw new Error(_0xb819('0x4c'));if(_0x58d386[_0xb819('0x4d')]===_0xb819('0x4e')){var _0x16b306=_0x3d70dd[_0xb819('0x26')]({'plain':!![]});var _0x4db54=_0xb819('0x27');return db[_0xb819('0x4f')][_0xb819('0x50')]({'where':{'name':_0x4db54,'userProfileId':_0x58d386['userProfileId']},'raw':!![]})[_0xb819('0x25')](function(_0x3d9544){if(_0x3d9544&&_0x3d9544['autoAssociation']===0x0){return db[_0xb819('0x51')][_0xb819('0x4a')]({'name':_0x16b306['name'],'resourceId':_0x16b306['id'],'type':_0x3d9544['name'],'sectionId':_0x3d9544['id']},{})[_0xb819('0x25')](function(){return _0x3d70dd;});}else{return _0x3d70dd;}})[_0xb819('0x43')](function(_0x58655b){logger[_0xb819('0x29')](_0xb819('0x52'),_0x58655b);throw _0x58655b;});}return _0x3d70dd;})[_0xb819('0x25')](respondWithResult(_0x2e5bb7,0xc9))[_0xb819('0x43')](handleError(_0x2e5bb7,null));};exports[_0xb819('0x53')]=function(_0x141e15,_0x13d822){if(_0x141e15['body']['id']){delete _0x141e15[_0xb819('0x4b')]['id'];}return db['SquareOdbc'][_0xb819('0x50')]({'where':{'id':_0x141e15['params']['id']}})[_0xb819('0x25')](handleEntityNotFound(_0x13d822,null))[_0xb819('0x25')](saveUpdates(_0x141e15[_0xb819('0x4b')],null))[_0xb819('0x25')](respondWithResult(_0x13d822,null))[_0xb819('0x43')](handleError(_0x13d822,null));};exports['destroy']=function(_0x537320,_0x34c401){return db[_0xb819('0x2f')][_0xb819('0x50')]({'where':{'id':_0x537320[_0xb819('0x54')]['id']}})['then'](handleEntityNotFound(_0x34c401,null))['then'](removeEntity(_0x34c401,null))[_0xb819('0x43')](handleError(_0x34c401,null));};exports[_0xb819('0x55')]=function(_0x408db6,_0x16ed20,_0x34a874){var _0x38e6a2;return db['SquareOdbc'][_0xb819('0x50')]({'where':{'id':_0x408db6[_0xb819('0x54')]['id']},'attributes':['id',_0xb819('0x56')]})[_0xb819('0x25')](handleEntityNotFound(_0x16ed20,null))['then'](function(_0x54b50e){if(_0x54b50e){var _0x5c7c2c=require('odbc')();_0x5c7c2c[_0xb819('0x57')](_0x54b50e[_0xb819('0x56')]);_0x5c7c2c[_0xb819('0x58')]();return _0x54b50e;}})[_0xb819('0x25')](respondWithResult(_0x16ed20,null))[_0xb819('0x43')](handleError(_0x16ed20,null));}; \ No newline at end of file +var _0xa058=['rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','get','ODBC','error','name','send','index','map','SquareOdbc','type','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','params','rawAttributes','intersection','includeAll','find','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','eml-format'];(function(_0x3efabd,_0x8cbc81){var _0x3b07e2=function(_0x2a0d3c){while(--_0x2a0d3c){_0x3efabd['push'](_0x3efabd['shift']());}};_0x3b07e2(++_0x8cbc81);}(_0xa058,0x153));var _0x8a05=function(_0x4017b0,_0x4347db){_0x4017b0=_0x4017b0-0x0;var _0x5ed4f7=_0xa058[_0x4017b0];return _0x5ed4f7;};'use strict';var emlformat=require(_0x8a05('0x0'));var rimraf=require(_0x8a05('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8a05('0x2'));var rp=require(_0x8a05('0x3'));var moment=require(_0x8a05('0x4'));var BPromise=require(_0x8a05('0x5'));var Mustache=require(_0x8a05('0x6'));var util=require(_0x8a05('0x7'));var path=require(_0x8a05('0x8'));var sox=require(_0x8a05('0x9'));var csv=require(_0x8a05('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8a05('0xb'));var crypto=require(_0x8a05('0xc'));var jsforce=require(_0x8a05('0xd'));var deskjs=require(_0x8a05('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8a05('0xf'));var Papa=require('papaparse');var Redis=require(_0x8a05('0x10'));var authService=require(_0x8a05('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8a05('0x12'));var hardwareService=require(_0x8a05('0x13'));var logger=require(_0x8a05('0x14'))(_0x8a05('0x15'));var utils=require('../../config/utils');var config=require(_0x8a05('0x16'));var licenseUtil=require(_0x8a05('0x17'));var db=require(_0x8a05('0x18'))['db'];function respondWithStatusCode(_0x444d03,_0x3dd101){_0x3dd101=_0x3dd101||0xcc;return function(_0x320288){if(_0x320288){return _0x444d03[_0x8a05('0x19')](_0x3dd101);}return _0x444d03[_0x8a05('0x1a')](_0x3dd101)['end']();};}function respondWithResult(_0x13da75,_0x292ee){_0x292ee=_0x292ee||0xc8;return function(_0x6e0586){if(_0x6e0586){return _0x13da75[_0x8a05('0x1a')](_0x292ee)[_0x8a05('0x1b')](_0x6e0586);}};}function respondWithFilteredResult(_0x169330,_0x3e11e){return function(_0x2bdab3){if(_0x2bdab3){var _0x13a317=typeof _0x3e11e[_0x8a05('0x1c')]===_0x8a05('0x1d')&&typeof _0x3e11e[_0x8a05('0x1e')]===_0x8a05('0x1d');var _0x4815c9=_0x2bdab3[_0x8a05('0x1f')];var _0x530b4d=_0x13a317?0x0:_0x3e11e[_0x8a05('0x1c')];var _0x17eac0=_0x13a317?_0x2bdab3[_0x8a05('0x1f')]:_0x3e11e[_0x8a05('0x1c')]+_0x3e11e[_0x8a05('0x1e')];var _0x4a700a;if(_0x17eac0>=_0x4815c9){_0x17eac0=_0x4815c9;_0x4a700a=0xc8;}else{_0x4a700a=0xce;}_0x169330[_0x8a05('0x1a')](_0x4a700a);return _0x169330[_0x8a05('0x20')]('Content-Range',_0x530b4d+'-'+_0x17eac0+'/'+_0x4815c9)[_0x8a05('0x1b')](_0x2bdab3);}return null;};}function patchUpdates(_0x9e9f9c){return function(_0x765ffa){try{jsonpatch[_0x8a05('0x21')](_0x765ffa,_0x9e9f9c,!![]);}catch(_0x13bf38){return BPromise[_0x8a05('0x22')](_0x13bf38);}return _0x765ffa[_0x8a05('0x23')]();};}function saveUpdates(_0x1cfb93,_0x543f2e){return function(_0x331311){if(_0x331311){return _0x331311[_0x8a05('0x24')](_0x1cfb93)['then'](function(_0x36c54f){return _0x36c54f;});}return null;};}function removeEntity(_0xeb944d,_0x4d422f){return function(_0x23c59e){if(_0x23c59e){return _0x23c59e[_0x8a05('0x25')]()[_0x8a05('0x26')](function(){var _0x179f45=_0x23c59e[_0x8a05('0x27')]({'plain':!![]});var _0x7d844b=_0x8a05('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x7d844b,'resourceId':_0x179f45['id']}})['then'](function(){return _0x23c59e;});})['then'](function(){_0xeb944d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28b5af,_0x2573ab){return function(_0xcdca48){if(!_0xcdca48){_0x28b5af['sendStatus'](0x194);}return _0xcdca48;};}function handleError(_0x445cf5,_0x5e45e8){_0x5e45e8=_0x5e45e8||0x1f4;return function(_0x5de4fa){logger[_0x8a05('0x29')](_0x5de4fa['stack']);if(_0x5de4fa[_0x8a05('0x2a')]){delete _0x5de4fa[_0x8a05('0x2a')];}_0x445cf5['status'](_0x5e45e8)[_0x8a05('0x2b')](_0x5de4fa);};}exports[_0x8a05('0x2c')]=function(_0x4fa9fc,_0x59a500){var _0xfb2be1={},_0x5111df={},_0x28fd55={'count':0x0,'rows':[]};var _0x44f967=_[_0x8a05('0x2d')](db[_0x8a05('0x2e')]['rawAttributes'],function(_0x404e99){return{'name':_0x404e99['fieldName'],'type':_0x404e99[_0x8a05('0x2f')]['key']};});_0x5111df[_0x8a05('0x30')]=_[_0x8a05('0x2d')](_0x44f967,_0x8a05('0x2a'));_0x5111df[_0x8a05('0x31')]=_[_0x8a05('0x32')](_0x4fa9fc[_0x8a05('0x31')]);_0x5111df['filters']=_['intersection'](_0x5111df[_0x8a05('0x30')],_0x5111df[_0x8a05('0x31')]);_0xfb2be1[_0x8a05('0x33')]=_['intersection'](_0x5111df[_0x8a05('0x30')],qs['fields'](_0x4fa9fc[_0x8a05('0x31')][_0x8a05('0x34')]));_0xfb2be1['attributes']=_0xfb2be1['attributes'][_0x8a05('0x35')]?_0xfb2be1[_0x8a05('0x33')]:_0x5111df[_0x8a05('0x30')];if(!_0x4fa9fc[_0x8a05('0x31')][_0x8a05('0x36')](_0x8a05('0x37'))){_0xfb2be1[_0x8a05('0x1e')]=qs['limit'](_0x4fa9fc[_0x8a05('0x31')][_0x8a05('0x1e')]);_0xfb2be1[_0x8a05('0x1c')]=qs[_0x8a05('0x1c')](_0x4fa9fc['query']['offset']);}_0xfb2be1[_0x8a05('0x38')]=qs[_0x8a05('0x39')](_0x4fa9fc[_0x8a05('0x31')]['sort']);_0xfb2be1['where']=qs[_0x8a05('0x3a')](_[_0x8a05('0x3b')](_0x4fa9fc['query'],_0x5111df[_0x8a05('0x3a')]),_0x44f967);if(_0x4fa9fc[_0x8a05('0x31')][_0x8a05('0x3c')]){_0xfb2be1[_0x8a05('0x3d')]=_['merge'](_0xfb2be1[_0x8a05('0x3d')],{'$or':_[_0x8a05('0x2d')](_0x44f967,function(_0x5a1a30){if(_0x5a1a30[_0x8a05('0x2f')]!==_0x8a05('0x3e')){var _0x3c00ab={};_0x3c00ab[_0x5a1a30[_0x8a05('0x2a')]]={'$like':'%'+_0x4fa9fc[_0x8a05('0x31')][_0x8a05('0x3c')]+'%'};return _0x3c00ab;}})});}_0xfb2be1=_[_0x8a05('0x3f')]({},_0xfb2be1,_0x4fa9fc[_0x8a05('0x40')]);var _0x36f57e={'where':_0xfb2be1['where']};return db['SquareOdbc'][_0x8a05('0x1f')](_0x36f57e)[_0x8a05('0x26')](function(_0x411ac3){_0x28fd55[_0x8a05('0x1f')]=_0x411ac3;if(_0x4fa9fc['query']['includeAll']){_0xfb2be1[_0x8a05('0x41')]=[{'all':!![]}];}return db[_0x8a05('0x2e')][_0x8a05('0x42')](_0xfb2be1);})[_0x8a05('0x26')](function(_0x720696){_0x28fd55[_0x8a05('0x43')]=_0x720696;return _0x28fd55;})[_0x8a05('0x26')](respondWithFilteredResult(_0x59a500,_0xfb2be1))[_0x8a05('0x44')](handleError(_0x59a500,null));};exports['show']=function(_0x2dc3f0,_0x459fdf){var _0x4d34a8={'raw':!![],'where':{'id':_0x2dc3f0[_0x8a05('0x45')]['id']}},_0x1727e1={};_0x1727e1[_0x8a05('0x30')]=_['keys'](db[_0x8a05('0x2e')][_0x8a05('0x46')]);_0x1727e1[_0x8a05('0x31')]=_[_0x8a05('0x32')](_0x2dc3f0[_0x8a05('0x31')]);_0x1727e1[_0x8a05('0x3a')]=_['intersection'](_0x1727e1['model'],_0x1727e1[_0x8a05('0x31')]);_0x4d34a8[_0x8a05('0x33')]=_[_0x8a05('0x47')](_0x1727e1[_0x8a05('0x30')],qs[_0x8a05('0x34')](_0x2dc3f0[_0x8a05('0x31')]['fields']));_0x4d34a8[_0x8a05('0x33')]=_0x4d34a8['attributes'][_0x8a05('0x35')]?_0x4d34a8['attributes']:_0x1727e1['model'];if(_0x2dc3f0[_0x8a05('0x31')][_0x8a05('0x48')]){_0x4d34a8['include']=[{'all':!![]}];}_0x4d34a8=_['merge']({},_0x4d34a8,_0x2dc3f0[_0x8a05('0x40')]);return db[_0x8a05('0x2e')][_0x8a05('0x49')](_0x4d34a8)['then'](handleEntityNotFound(_0x459fdf,null))[_0x8a05('0x26')](respondWithResult(_0x459fdf,null))[_0x8a05('0x44')](handleError(_0x459fdf,null));};exports['create']=function(_0x209c31,_0x224cfd){return db[_0x8a05('0x2e')]['create'](_0x209c31[_0x8a05('0x4a')],{})[_0x8a05('0x26')](function(_0x579946){var _0x4c1651=_0x209c31[_0x8a05('0x4b')][_0x8a05('0x27')]({'plain':!![]});if(!_0x4c1651)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c1651[_0x8a05('0x4c')]===_0x8a05('0x4b')){var _0x3fec88=_0x579946[_0x8a05('0x27')]({'plain':!![]});var _0x4b4278=_0x8a05('0x28');return db[_0x8a05('0x4d')]['find']({'where':{'name':_0x4b4278,'userProfileId':_0x4c1651['userProfileId']},'raw':!![]})[_0x8a05('0x26')](function(_0x475d42){if(_0x475d42&&_0x475d42[_0x8a05('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x3fec88['name'],'resourceId':_0x3fec88['id'],'type':_0x475d42[_0x8a05('0x2a')],'sectionId':_0x475d42['id']},{})['then'](function(){return _0x579946;});}else{return _0x579946;}})[_0x8a05('0x44')](function(_0x3acba2){logger['error'](_0x8a05('0x4f'),_0x3acba2);throw _0x3acba2;});}return _0x579946;})[_0x8a05('0x26')](respondWithResult(_0x224cfd,0xc9))['catch'](handleError(_0x224cfd,null));};exports['update']=function(_0x599750,_0x5b72bf){if(_0x599750[_0x8a05('0x4a')]['id']){delete _0x599750['body']['id'];}return db[_0x8a05('0x2e')]['find']({'where':{'id':_0x599750[_0x8a05('0x45')]['id']}})[_0x8a05('0x26')](handleEntityNotFound(_0x5b72bf,null))[_0x8a05('0x26')](saveUpdates(_0x599750[_0x8a05('0x4a')],null))['then'](respondWithResult(_0x5b72bf,null))[_0x8a05('0x44')](handleError(_0x5b72bf,null));};exports[_0x8a05('0x25')]=function(_0x36444a,_0x5b00b5){return db['SquareOdbc'][_0x8a05('0x49')]({'where':{'id':_0x36444a['params']['id']}})['then'](handleEntityNotFound(_0x5b00b5,null))['then'](removeEntity(_0x5b00b5,null))[_0x8a05('0x44')](handleError(_0x5b00b5,null));};exports[_0x8a05('0x50')]=function(_0xbe7523,_0x1a3b45,_0x5b1920){var _0x55cb37;return db['SquareOdbc']['find']({'where':{'id':_0xbe7523[_0x8a05('0x45')]['id']},'attributes':['id',_0x8a05('0x51')]})[_0x8a05('0x26')](handleEntityNotFound(_0x1a3b45,null))[_0x8a05('0x26')](function(_0x7ed79a){if(_0x7ed79a){var _0xd81803=require(_0x8a05('0x52'))();_0xd81803[_0x8a05('0x53')](_0x7ed79a['dsn']);_0xd81803[_0x8a05('0x54')]();return _0x7ed79a;}})[_0x8a05('0x26')](respondWithResult(_0x1a3b45,null))[_0x8a05('0x44')](handleError(_0x1a3b45,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 9de49fd..a5718d4 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 _0xdc2b=['define','SquareOdbc','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports'];(function(_0xdcebe,_0x4da037){var _0x4c6062=function(_0x5077c4){while(--_0x5077c4){_0xdcebe['push'](_0xdcebe['shift']());}};_0x4c6062(++_0x4da037);}(_0xdc2b,0x77));var _0xbdc2=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xdc2b[_0x38ced4];return _0x547c07;};'use strict';var _=require(_0xbdc2('0x0'));var util=require('util');var logger=require(_0xbdc2('0x1'))(_0xbdc2('0x2'));var moment=require(_0xbdc2('0x3'));var BPromise=require(_0xbdc2('0x4'));var rp=require(_0xbdc2('0x5'));var fs=require('fs');var path=require(_0xbdc2('0x6'));var rimraf=require(_0xbdc2('0x7'));var config=require(_0xbdc2('0x8'));var attributes=require(_0xbdc2('0x9'));module[_0xbdc2('0xa')]=function(_0x134017,_0x3b2e51){return _0x134017[_0xbdc2('0xb')](_0xbdc2('0xc'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1dc9=['request-promise','rimraf','exports','define','square_odbc','util','../../config/logger','api','bluebird'];(function(_0x468378,_0x2c2a05){var _0x4e4d05=function(_0x260df9){while(--_0x260df9){_0x468378['push'](_0x468378['shift']());}};_0x4e4d05(++_0x2c2a05);}(_0x1dc9,0xd4));var _0x91dc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dc9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x91dc('0x0'));var logger=require(_0x91dc('0x1'))(_0x91dc('0x2'));var moment=require('moment');var BPromise=require(_0x91dc('0x3'));var rp=require(_0x91dc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x91dc('0x5'));var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0x91dc('0x6')]=function(_0x1b15bf,_0x5c3ecc){return _0x1b15bf[_0x91dc('0x7')]('SquareOdbc',attributes,{'tableName':_0x91dc('0x8'),'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 d9986d5..7933a1f 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 _0x220b=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','SquareOdbc,\x20%s,\x20%s','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','attributes','map','model','include','debug','lodash','moment'];(function(_0x244c26,_0x4bbc7a){var _0x881ccd=function(_0x5a11f2){while(--_0x5a11f2){_0x244c26['push'](_0x244c26['shift']());}};_0x881ccd(++_0x4bbc7a);}(_0x220b,0x10c));var _0xb220=function(_0x43776a,_0x4eb74c){_0x43776a=_0x43776a-0x0;var _0x18eb8f=_0x220b[_0x43776a];return _0x18eb8f;};'use strict';var _=require(_0xb220('0x0'));var util=require('util');var moment=require(_0xb220('0x1'));var BPromise=require('bluebird');var rs=require(_0xb220('0x2'));var fs=require('fs');var Redis=require(_0xb220('0x3'));var db=require(_0xb220('0x4'))['db'];var utils=require(_0xb220('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb220('0x6'));var jayson=require(_0xb220('0x7'));var client=jayson[_0xb220('0x8')][_0xb220('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b6e93,_0x496492,_0x473636){return new BPromise(function(_0x3b7295,_0x13792c){return client[_0xb220('0xa')](_0x5b6e93,_0x473636)[_0xb220('0xb')](function(_0x5be036){logger[_0xb220('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x496492,_0xb220('0xd'));logger['debug'](_0xb220('0xe'),_0x496492,'request\x20sent',JSON[_0xb220('0xf')](_0x5be036));if(_0x5be036[_0xb220('0x10')]){if(_0x5be036[_0xb220('0x10')]['code']===0x1f4){logger[_0xb220('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x496492,_0x5be036['error'][_0xb220('0x11')]);return _0x13792c(_0x5be036['error'][_0xb220('0x11')]);}logger['error'](_0xb220('0x12'),_0x496492,_0x5be036[_0xb220('0x10')][_0xb220('0x11')]);return _0x3b7295(_0x5be036[_0xb220('0x10')][_0xb220('0x11')]);}else{logger[_0xb220('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x496492,_0xb220('0xd'));_0x3b7295(_0x5be036['result'][_0xb220('0x11')]);}})[_0xb220('0x13')](function(_0x3ce92f){logger['error'](_0xb220('0x12'),_0x496492,_0x3ce92f);_0x13792c(_0x3ce92f);});});}exports[_0xb220('0x14')]=function(_0x4c9387){var _0x2f9b91=this;return new Promise(function(_0x33e51e,_0x325d50){return db[_0xb220('0x15')][_0xb220('0x16')]({'raw':_0x4c9387[_0xb220('0x17')]?_0x4c9387[_0xb220('0x17')][_0xb220('0x18')]===undefined?!![]:![]:!![],'where':_0x4c9387['options']?_0x4c9387[_0xb220('0x17')]['where']||null:null,'attributes':_0x4c9387[_0xb220('0x17')]?_0x4c9387[_0xb220('0x17')][_0xb220('0x19')]||null:null,'include':_0x4c9387[_0xb220('0x17')]?_0x4c9387[_0xb220('0x17')]['include']?_[_0xb220('0x1a')](_0x4c9387[_0xb220('0x17')]['include'],function(_0x4fab60){return{'model':db[_0x4fab60[_0xb220('0x1b')]],'as':_0x4fab60['as'],'attributes':_0x4fab60[_0xb220('0x19')],'include':_0x4fab60['include']?_['map'](_0x4fab60[_0xb220('0x1c')],function(_0x5d2bb6){return{'model':db[_0x5d2bb6[_0xb220('0x1b')]],'as':_0x5d2bb6['as'],'attributes':_0x5d2bb6['attributes'],'include':_0x5d2bb6[_0xb220('0x1c')]?_['map'](_0x5d2bb6[_0xb220('0x1c')],function(_0x2396c1){return{'model':db[_0x2396c1[_0xb220('0x1b')]],'as':_0x2396c1['as'],'attributes':_0x2396c1[_0xb220('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb220('0xb')](function(_0x509313){logger[_0xb220('0xc')](_0xb220('0x14'),_0x4c9387);logger[_0xb220('0x1d')](_0xb220('0x14'),_0x4c9387,JSON['stringify'](_0x509313));_0x33e51e(_0x509313);})[_0xb220('0x13')](function(_0x5e7030){logger[_0xb220('0x10')](_0xb220('0x14'),_0x5e7030['message'],_0x4c9387);_0x325d50(_0x2f9b91['error'](0x1f4,_0x5e7030['message']));});});}; \ No newline at end of file +var _0x1529=['attributes','map','include','model','ShowSquareOdbc','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','find','options','raw'];(function(_0x37db9f,_0x4c93ed){var _0x48fb29=function(_0x5d27a4){while(--_0x5d27a4){_0x37db9f['push'](_0x37db9f['shift']());}};_0x48fb29(++_0x4c93ed);}(_0x1529,0x11c));var _0x9152=function(_0x2f4d41,_0x104d39){_0x2f4d41=_0x2f4d41-0x0;var _0x2197d1=_0x1529[_0x2f4d41];return _0x2197d1;};'use strict';var _=require('lodash');var util=require(_0x9152('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9152('0x1'));var fs=require('fs');var Redis=require(_0x9152('0x2'));var db=require(_0x9152('0x3'))['db'];var utils=require(_0x9152('0x4'));var logger=require(_0x9152('0x5'))(_0x9152('0x6'));var config=require(_0x9152('0x7'));var jayson=require(_0x9152('0x8'));var client=jayson[_0x9152('0x9')][_0x9152('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x132f81,_0x46279d,_0x8fcf36){return new BPromise(function(_0x130aa3,_0xb91fef){return client[_0x9152('0xb')](_0x132f81,_0x8fcf36)[_0x9152('0xc')](function(_0x3131ec){logger[_0x9152('0xd')](_0x9152('0xe'),_0x46279d,_0x9152('0xf'));logger[_0x9152('0x10')](_0x9152('0x11'),_0x46279d,_0x9152('0xf'),JSON[_0x9152('0x12')](_0x3131ec));if(_0x3131ec['error']){if(_0x3131ec[_0x9152('0x13')][_0x9152('0x14')]===0x1f4){logger[_0x9152('0x13')](_0x9152('0xe'),_0x46279d,_0x3131ec[_0x9152('0x13')][_0x9152('0x15')]);return _0xb91fef(_0x3131ec[_0x9152('0x13')][_0x9152('0x15')]);}logger[_0x9152('0x13')](_0x9152('0xe'),_0x46279d,_0x3131ec['error'][_0x9152('0x15')]);return _0x130aa3(_0x3131ec[_0x9152('0x13')][_0x9152('0x15')]);}else{logger[_0x9152('0xd')](_0x9152('0xe'),_0x46279d,_0x9152('0xf'));_0x130aa3(_0x3131ec['result'][_0x9152('0x15')]);}})[_0x9152('0x16')](function(_0x19bdab){logger[_0x9152('0x13')](_0x9152('0xe'),_0x46279d,_0x19bdab);_0xb91fef(_0x19bdab);});});}exports['ShowSquareOdbc']=function(_0xd7d2b0){var _0x4be11d=this;return new Promise(function(_0x50d89b,_0x12822b){return db['SquareOdbc'][_0x9152('0x17')]({'raw':_0xd7d2b0[_0x9152('0x18')]?_0xd7d2b0[_0x9152('0x18')][_0x9152('0x19')]===undefined?!![]:![]:!![],'where':_0xd7d2b0[_0x9152('0x18')]?_0xd7d2b0[_0x9152('0x18')]['where']||null:null,'attributes':_0xd7d2b0['options']?_0xd7d2b0[_0x9152('0x18')][_0x9152('0x1a')]||null:null,'include':_0xd7d2b0[_0x9152('0x18')]?_0xd7d2b0[_0x9152('0x18')]['include']?_[_0x9152('0x1b')](_0xd7d2b0[_0x9152('0x18')][_0x9152('0x1c')],function(_0x18575d){return{'model':db[_0x18575d[_0x9152('0x1d')]],'as':_0x18575d['as'],'attributes':_0x18575d['attributes'],'include':_0x18575d[_0x9152('0x1c')]?_[_0x9152('0x1b')](_0x18575d[_0x9152('0x1c')],function(_0x45c6de){return{'model':db[_0x45c6de['model']],'as':_0x45c6de['as'],'attributes':_0x45c6de['attributes'],'include':_0x45c6de['include']?_[_0x9152('0x1b')](_0x45c6de[_0x9152('0x1c')],function(_0x317562){return{'model':db[_0x317562['model']],'as':_0x317562['as'],'attributes':_0x317562['attributes']};}):[]};}):[]};}):[]:[]})[_0x9152('0xc')](function(_0x1954f7){logger[_0x9152('0xd')](_0x9152('0x1e'),_0xd7d2b0);logger[_0x9152('0x10')]('ShowSquareOdbc',_0xd7d2b0,JSON['stringify'](_0x1954f7));_0x50d89b(_0x1954f7);})[_0x9152('0x16')](function(_0x7e30e2){logger[_0x9152('0x13')](_0x9152('0x1e'),_0x7e30e2['message'],_0xd7d2b0);_0x12822b(_0x4be11d[_0x9152('0x13')](0x1f4,_0x7e30e2[_0x9152('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 3d93885..8ddb3d6 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 _0x8775=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','/:id'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0x8775,0x1e3));var _0x5877=function(_0x56f6c0,_0x37c097){_0x56f6c0=_0x56f6c0-0x0;var _0x249342=_0x8775[_0x56f6c0];return _0x249342;};'use strict';var multer=require(_0x5877('0x0'));var util=require(_0x5877('0x1'));var path=require(_0x5877('0x2'));var timeout=require(_0x5877('0x3'));var express=require('express');var router=express[_0x5877('0x4')]();var fs_extra=require(_0x5877('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5877('0x6'));var controller=require('./squareProject.controller');router[_0x5877('0x7')]('/',auth[_0x5877('0x8')](),controller['index']);router[_0x5877('0x7')](_0x5877('0x9'),auth[_0x5877('0x8')](),controller['show']);router[_0x5877('0xa')]('/',auth[_0x5877('0x8')](),controller[_0x5877('0xb')]);router[_0x5877('0xc')](_0x5877('0x9'),auth[_0x5877('0x8')](),controller[_0x5877('0xd')]);router[_0x5877('0xe')]('/:id',auth[_0x5877('0x8')](),controller[_0x5877('0xf')]);module[_0x5877('0x10')]=router; \ No newline at end of file +var _0x3319=['index','/:id','show','create','put','update','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareProject.controller','get','isAuthenticated'];(function(_0x527a96,_0x4472ae){var _0x39785b=function(_0x5e18a5){while(--_0x5e18a5){_0x527a96['push'](_0x527a96['shift']());}};_0x39785b(++_0x4472ae);}(_0x3319,0x97));var _0x9331=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x3319[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0x9331('0x0'));var util=require(_0x9331('0x1'));var path=require(_0x9331('0x2'));var timeout=require('connect-timeout');var express=require(_0x9331('0x3'));var router=express[_0x9331('0x4')]();var fs_extra=require(_0x9331('0x5'));var auth=require(_0x9331('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9331('0x7'));var controller=require(_0x9331('0x8'));router[_0x9331('0x9')]('/',auth[_0x9331('0xa')](),controller[_0x9331('0xb')]);router[_0x9331('0x9')](_0x9331('0xc'),auth[_0x9331('0xa')](),controller[_0x9331('0xd')]);router['post']('/',auth[_0x9331('0xa')](),controller[_0x9331('0xe')]);router[_0x9331('0xf')](_0x9331('0xc'),auth[_0x9331('0xa')](),controller[_0x9331('0x10')]);router['delete'](_0x9331('0xc'),auth[_0x9331('0xa')](),controller[_0x9331('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index c13e9c7..846d014 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 _0x0a39=['exports','name','STRING','TEXT','BLOB','long','getDataValue','preproduction','production','toString','utf8','DATE','sequelize'];(function(_0x5f0d43,_0x4b5ab9){var _0x4c79f8=function(_0x13f4fa){while(--_0x13f4fa){_0x5f0d43['push'](_0x5f0d43['shift']());}};_0x4c79f8(++_0x4b5ab9);}(_0x0a39,0x144));var _0x90a3=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0a39[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x90a3('0x0'));module[_0x90a3('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x90a3('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x90a3('0x3')]},'notes':{'type':Sequelize[_0x90a3('0x4')]},'preproduction':{'type':Sequelize[_0x90a3('0x5')](_0x90a3('0x6')),'get':function(){if(this[_0x90a3('0x7')](_0x90a3('0x8'))){return this[_0x90a3('0x7')](_0x90a3('0x8'))['toString']('utf8');}}},'production':{'type':Sequelize[_0x90a3('0x5')](_0x90a3('0x6')),'get':function(){if(this['getDataValue']('production')){return this[_0x90a3('0x7')](_0x90a3('0x9'))[_0x90a3('0xa')](_0x90a3('0xb'));}}},'savedAt':{'type':Sequelize[_0x90a3('0xc')]},'publishedAt':{'type':Sequelize[_0x90a3('0xc')]}}; \ No newline at end of file +var _0xe2a7=['preproduction','toString','utf8','production','DATE','sequelize','exports','name','STRING','BLOB','long'];(function(_0x5db5cd,_0x5353af){var _0x5c888a=function(_0x5543d7){while(--_0x5543d7){_0x5db5cd['push'](_0x5db5cd['shift']());}};_0x5c888a(++_0x5353af);}(_0xe2a7,0x12e));var _0x7e2a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2a7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7e2a('0x0'));module[_0x7e2a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7e2a('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x7e2a('0x3')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x7e2a('0x4')](_0x7e2a('0x5')),'get':function(){if(this['getDataValue'](_0x7e2a('0x6'))){return this['getDataValue']('preproduction')[_0x7e2a('0x7')](_0x7e2a('0x8'));}}},'production':{'type':Sequelize[_0x7e2a('0x4')](_0x7e2a('0x5')),'get':function(){if(this['getDataValue'](_0x7e2a('0x9'))){return this['getDataValue'](_0x7e2a('0x9'))[_0x7e2a('0x7')](_0x7e2a('0x8'));}}},'savedAt':{'type':Sequelize[_0x7e2a('0xa')]},'publishedAt':{'type':Sequelize[_0x7e2a('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index d17416c..1a48a1d 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 _0x63cf=['../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','status','json','offset','undefined','limit','count','set','update','then','destroy','get','UserProfileResource','publish','agi','end','sendStatus','error','stack','name','send','index','SquareProject','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','options','includeAll','include','findAll','show','merge','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection','params','production','ioredis','../../components/parsers/qs'];(function(_0x217189,_0x41a001){var _0x4089d2=function(_0x1de9fb){while(--_0x1de9fb){_0x217189['push'](_0x217189['shift']());}};_0x4089d2(++_0x41a001);}(_0x63cf,0x106));var _0xf63c=function(_0x5678b5,_0x1c4aa8){_0x5678b5=_0x5678b5-0x0;var _0x4c09a5=_0x63cf[_0x5678b5];return _0x4c09a5;};'use strict';var _=require('lodash');var Redis=require(_0xf63c('0x0'));var qs=require(_0xf63c('0x1'));var logger=require('../../config/logger')('api');var config=require(_0xf63c('0x2'));var db=require(_0xf63c('0x3'))['db'];config[_0xf63c('0x4')]=_['defaults'](config['redis'],{'host':_0xf63c('0x5'),'port':0x18eb});var socket=require(_0xf63c('0x6'))(new Redis(config[_0xf63c('0x4')]));require('./squareProject.socket')['register'](socket);function respondWithResult(_0x503b1e,_0x29333c){_0x29333c=_0x29333c||0xc8;return function(_0x54d9ff){if(_0x54d9ff){return _0x503b1e[_0xf63c('0x7')](_0x29333c)[_0xf63c('0x8')](_0x54d9ff);}};}function respondWithFilteredResult(_0x35f85f,_0x37f27e){return function(_0x5a5fa1){if(_0x5a5fa1){var _0x16988a=typeof _0x37f27e[_0xf63c('0x9')]===_0xf63c('0xa')&&typeof _0x37f27e[_0xf63c('0xb')]===_0xf63c('0xa');var _0x14cb73=_0x5a5fa1['count'];var _0x405efa=_0x16988a?0x0:_0x37f27e[_0xf63c('0x9')];var _0x1f4975=_0x16988a?_0x5a5fa1[_0xf63c('0xc')]:_0x37f27e['offset']+_0x37f27e[_0xf63c('0xb')];var _0x5372f1;if(_0x1f4975>=_0x14cb73){_0x1f4975=_0x14cb73;_0x5372f1=0xc8;}else{_0x5372f1=0xce;}_0x35f85f[_0xf63c('0x7')](_0x5372f1);return _0x35f85f[_0xf63c('0xd')]('Content-Range',_0x405efa+'-'+_0x1f4975+'/'+_0x14cb73)[_0xf63c('0x8')](_0x5a5fa1);}return null;};}function saveUpdates(_0x34014d){return function(_0x40cd40){if(_0x40cd40){return _0x40cd40[_0xf63c('0xe')](_0x34014d)[_0xf63c('0xf')](function(_0x4af7e2){return _0x4af7e2;});}return null;};}function removeEntity(_0x126f32){return function(_0x5a4e91){if(_0x5a4e91){return _0x5a4e91[_0xf63c('0x10')]()[_0xf63c('0xf')](function(){var _0x3ee013=_0x5a4e91[_0xf63c('0x11')]({'plain':!![]});var _0x254819='SquareProjects';return db[_0xf63c('0x12')][_0xf63c('0x10')]({'where':{'type':_0x254819,'resourceId':_0x3ee013['id']}})[_0xf63c('0xf')](function(){return _0x5a4e91;});})['then'](function(){var _0x5e2483=new Redis(config[_0xf63c('0x4')]);_0x5e2483[_0xf63c('0x13')](_0xf63c('0x14'),JSON['stringify']({'id':_0x5a4e91['id'],'deleted':!![]}));})[_0xf63c('0xf')](function(){_0x126f32[_0xf63c('0x7')](0xcc)[_0xf63c('0x15')]();});}};}function handleEntityNotFound(_0xdcbea8){return function(_0x4a2a3c){if(!_0x4a2a3c){_0xdcbea8[_0xf63c('0x16')](0x194);}return _0x4a2a3c;};}function handleError(_0x42b512,_0x2efae0){_0x2efae0=_0x2efae0||0x1f4;return function(_0x12a97b){logger[_0xf63c('0x17')](_0x12a97b[_0xf63c('0x18')]);if(_0x12a97b[_0xf63c('0x19')]){delete _0x12a97b[_0xf63c('0x19')];}_0x42b512[_0xf63c('0x7')](_0x2efae0)[_0xf63c('0x1a')](_0x12a97b);};}exports[_0xf63c('0x1b')]=function(_0x450ec0,_0x36e9df){var _0x45b870={},_0x5710c9={},_0x26bc39={'count':0x0,'rows':[]};var _0x35459=_['map'](db[_0xf63c('0x1c')][_0xf63c('0x1d')],function(_0x43bc3b){return{'name':_0x43bc3b[_0xf63c('0x1e')],'type':_0x43bc3b['type'][_0xf63c('0x1f')]};});_0x5710c9[_0xf63c('0x20')]=_[_0xf63c('0x21')](_0x35459,_0xf63c('0x19'));_0x5710c9[_0xf63c('0x22')]=_[_0xf63c('0x23')](_0x450ec0[_0xf63c('0x22')]);_0x5710c9[_0xf63c('0x24')]=_[_0xf63c('0x25')](_0x5710c9[_0xf63c('0x20')],_0x5710c9[_0xf63c('0x22')]);_0x45b870['attributes']=_[_0xf63c('0x25')](_0x5710c9[_0xf63c('0x20')],qs[_0xf63c('0x26')](_0x450ec0[_0xf63c('0x22')]['fields']));_0x45b870['attributes']=_0x45b870[_0xf63c('0x27')][_0xf63c('0x28')]?_0x45b870[_0xf63c('0x27')]:_0x5710c9[_0xf63c('0x20')];if(!_0x450ec0[_0xf63c('0x22')][_0xf63c('0x29')](_0xf63c('0x2a'))){_0x45b870[_0xf63c('0xb')]=qs['limit'](_0x450ec0[_0xf63c('0x22')][_0xf63c('0xb')]);_0x45b870[_0xf63c('0x9')]=qs[_0xf63c('0x9')](_0x450ec0[_0xf63c('0x22')][_0xf63c('0x9')]);}_0x45b870[_0xf63c('0x2b')]=qs[_0xf63c('0x2c')](_0x450ec0[_0xf63c('0x22')][_0xf63c('0x2c')]);_0x45b870['where']=qs['filters'](_[_0xf63c('0x2d')](_0x450ec0[_0xf63c('0x22')],_0x5710c9['filters']),_0x35459);if(_0x450ec0['query']['filter']){_0x45b870[_0xf63c('0x2e')]=_['merge'](_0x45b870[_0xf63c('0x2e')],{'$or':_['map'](_0x35459,function(_0xddf4fa){if(_0xddf4fa['type']!==_0xf63c('0x2f')){var _0x532777={};_0x532777[_0xddf4fa[_0xf63c('0x19')]]={'$like':'%'+_0x450ec0[_0xf63c('0x22')][_0xf63c('0x30')]+'%'};return _0x532777;}})});}_0x45b870=_['merge']({},_0x45b870,_0x450ec0[_0xf63c('0x31')]);var _0x3835e1={'where':_0x45b870[_0xf63c('0x2e')]};return db[_0xf63c('0x1c')]['count'](_0x3835e1)[_0xf63c('0xf')](function(_0x2b2f70){_0x26bc39[_0xf63c('0xc')]=_0x2b2f70;if(_0x450ec0[_0xf63c('0x22')][_0xf63c('0x32')]){_0x45b870[_0xf63c('0x33')]=[{'all':!![]}];}return db[_0xf63c('0x1c')][_0xf63c('0x34')](_0x45b870);})[_0xf63c('0xf')](function(_0x5cae0c){_0x26bc39['rows']=_0x5cae0c;return _0x26bc39;})[_0xf63c('0xf')](respondWithFilteredResult(_0x36e9df,_0x45b870))['catch'](handleError(_0x36e9df,null));};exports[_0xf63c('0x35')]=function(_0x39bef8,_0x49647e){var _0x11c84a={'raw':![],'where':{'id':_0x39bef8['params']['id']}},_0x35d548={};_0x35d548[_0xf63c('0x20')]=_[_0xf63c('0x23')](db[_0xf63c('0x1c')][_0xf63c('0x1d')]);_0x35d548[_0xf63c('0x22')]=_[_0xf63c('0x23')](_0x39bef8[_0xf63c('0x22')]);_0x35d548[_0xf63c('0x24')]=_['intersection'](_0x35d548[_0xf63c('0x20')],_0x35d548[_0xf63c('0x22')]);_0x11c84a[_0xf63c('0x27')]=_[_0xf63c('0x25')](_0x35d548[_0xf63c('0x20')],qs[_0xf63c('0x26')](_0x39bef8[_0xf63c('0x22')]['fields']));_0x11c84a[_0xf63c('0x27')]=_0x11c84a[_0xf63c('0x27')][_0xf63c('0x28')]?_0x11c84a[_0xf63c('0x27')]:_0x35d548[_0xf63c('0x20')];if(_0x39bef8['query'][_0xf63c('0x32')]){_0x11c84a[_0xf63c('0x33')]=[{'all':!![]}];}_0x11c84a=_[_0xf63c('0x36')]({},_0x11c84a,_0x39bef8['options']);return db['SquareProject'][_0xf63c('0x37')](_0x11c84a)['then'](handleEntityNotFound(_0x49647e,null))[_0xf63c('0xf')](respondWithResult(_0x49647e,null))[_0xf63c('0x38')](handleError(_0x49647e,null));};exports[_0xf63c('0x39')]=function(_0x541caf,_0xfd1a60){return db[_0xf63c('0x1c')]['create'](_0x541caf[_0xf63c('0x3a')],{})[_0xf63c('0xf')](function(_0x2f8844){var _0x57ccbd=_0x541caf[_0xf63c('0x3b')][_0xf63c('0x11')]({'plain':!![]});if(!_0x57ccbd)throw new Error(_0xf63c('0x3c'));if(_0x57ccbd[_0xf63c('0x3d')]===_0xf63c('0x3b')){var _0x46aabf=_0x2f8844[_0xf63c('0x11')]({'plain':!![]});var _0x5d934b=_0xf63c('0x3e');return db[_0xf63c('0x3f')]['find']({'where':{'name':_0x5d934b,'userProfileId':_0x57ccbd['userProfileId']},'raw':!![]})[_0xf63c('0xf')](function(_0x5491b6){if(_0x5491b6&&_0x5491b6['autoAssociation']===0x0){return db[_0xf63c('0x12')][_0xf63c('0x39')]({'name':_0x46aabf['name'],'resourceId':_0x46aabf['id'],'type':_0x5491b6[_0xf63c('0x19')],'sectionId':_0x5491b6['id']},{})[_0xf63c('0xf')](function(){return _0x2f8844;});}else{return _0x2f8844;}})[_0xf63c('0x38')](function(_0x1390d0){logger[_0xf63c('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1390d0);throw _0x1390d0;});}return _0x2f8844;})[_0xf63c('0xf')](respondWithResult(_0xfd1a60,0xc9))[_0xf63c('0x38')](handleError(_0xfd1a60,null));};exports[_0xf63c('0xe')]=function(_0x34f2ee,_0x100fe8){if(_0x34f2ee[_0xf63c('0x3a')]['id']){delete _0x34f2ee[_0xf63c('0x3a')]['id'];}return db['SquareProject'][_0xf63c('0x37')]({'where':{'id':_0x34f2ee[_0xf63c('0x40')]['id']}})['then'](handleEntityNotFound(_0x100fe8,null))[_0xf63c('0xf')](saveUpdates(_0x34f2ee[_0xf63c('0x3a')],null))[_0xf63c('0xf')](function(_0x58c5da){if(!_0x58c5da)return;var _0x4ef786=_0x58c5da['get']({'plain':!![]});return _0x4ef786;})[_0xf63c('0xf')](function(_0x18a1ad){var _0x3c5e3a=new Redis(config['redis']);_0x3c5e3a[_0xf63c('0x13')]('agi',JSON['stringify'](_['pick'](_0x18a1ad,['id',_0xf63c('0x19'),_0xf63c('0x41')])));return _0x18a1ad;})['then'](respondWithResult(_0x100fe8,null))[_0xf63c('0x38')](handleError(_0x100fe8,null));};exports[_0xf63c('0x10')]=function(_0x535a8c,_0x16c702){return db[_0xf63c('0x1c')]['find']({'where':{'id':_0x535a8c[_0xf63c('0x40')]['id']}})['then'](handleEntityNotFound(_0x16c702,null))[_0xf63c('0xf')](removeEntity(_0x16c702,null))['catch'](handleError(_0x16c702,null));}; \ No newline at end of file +var _0x084e=['update','then','destroy','get','SquareProjects','UserProfileResource','agi','stringify','end','error','stack','send','index','map','type','key','model','name','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','SquareProject','include','findAll','rows','catch','show','params','rawAttributes','fields','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','json','offset','limit','undefined','count','status','set','Content-Range'];(function(_0x1d081e,_0x42b074){var _0x5687e2=function(_0x43be51){while(--_0x43be51){_0x1d081e['push'](_0x1d081e['shift']());}};_0x5687e2(++_0x42b074);}(_0x084e,0x7a));var _0xe084=function(_0x31ed74,_0x96d0de){_0x31ed74=_0x31ed74-0x0;var _0x260f84=_0x084e[_0x31ed74];return _0x260f84;};'use strict';var _=require('lodash');var Redis=require(_0xe084('0x0'));var qs=require(_0xe084('0x1'));var logger=require(_0xe084('0x2'))(_0xe084('0x3'));var config=require(_0xe084('0x4'));var db=require(_0xe084('0x5'))['db'];config[_0xe084('0x6')]=_['defaults'](config[_0xe084('0x6')],{'host':_0xe084('0x7'),'port':0x18eb});var socket=require(_0xe084('0x8'))(new Redis(config[_0xe084('0x6')]));require('./squareProject.socket')[_0xe084('0x9')](socket);function respondWithResult(_0x143494,_0x264a82){_0x264a82=_0x264a82||0xc8;return function(_0x47c06f){if(_0x47c06f){return _0x143494['status'](_0x264a82)[_0xe084('0xa')](_0x47c06f);}};}function respondWithFilteredResult(_0x338e7d,_0x25297d){return function(_0x28c2a8){if(_0x28c2a8){var _0xce10cc=typeof _0x25297d[_0xe084('0xb')]==='undefined'&&typeof _0x25297d[_0xe084('0xc')]===_0xe084('0xd');var _0x626099=_0x28c2a8[_0xe084('0xe')];var _0x1dba6f=_0xce10cc?0x0:_0x25297d['offset'];var _0x71eea2=_0xce10cc?_0x28c2a8[_0xe084('0xe')]:_0x25297d[_0xe084('0xb')]+_0x25297d['limit'];var _0x4f321d;if(_0x71eea2>=_0x626099){_0x71eea2=_0x626099;_0x4f321d=0xc8;}else{_0x4f321d=0xce;}_0x338e7d[_0xe084('0xf')](_0x4f321d);return _0x338e7d[_0xe084('0x10')](_0xe084('0x11'),_0x1dba6f+'-'+_0x71eea2+'/'+_0x626099)['json'](_0x28c2a8);}return null;};}function saveUpdates(_0x406de0){return function(_0x1a6670){if(_0x1a6670){return _0x1a6670[_0xe084('0x12')](_0x406de0)[_0xe084('0x13')](function(_0x3dc130){return _0x3dc130;});}return null;};}function removeEntity(_0x36000c){return function(_0x1a7087){if(_0x1a7087){return _0x1a7087[_0xe084('0x14')]()[_0xe084('0x13')](function(){var _0x57b066=_0x1a7087[_0xe084('0x15')]({'plain':!![]});var _0x2e62a2=_0xe084('0x16');return db[_0xe084('0x17')][_0xe084('0x14')]({'where':{'type':_0x2e62a2,'resourceId':_0x57b066['id']}})[_0xe084('0x13')](function(){return _0x1a7087;});})['then'](function(){var _0xb5f094=new Redis(config[_0xe084('0x6')]);_0xb5f094['publish'](_0xe084('0x18'),JSON[_0xe084('0x19')]({'id':_0x1a7087['id'],'deleted':!![]}));})[_0xe084('0x13')](function(){_0x36000c['status'](0xcc)[_0xe084('0x1a')]();});}};}function handleEntityNotFound(_0x21c7c4){return function(_0x5b128d){if(!_0x5b128d){_0x21c7c4['sendStatus'](0x194);}return _0x5b128d;};}function handleError(_0x4a2dbd,_0x39845a){_0x39845a=_0x39845a||0x1f4;return function(_0x2bad83){logger[_0xe084('0x1b')](_0x2bad83[_0xe084('0x1c')]);if(_0x2bad83['name']){delete _0x2bad83['name'];}_0x4a2dbd[_0xe084('0xf')](_0x39845a)[_0xe084('0x1d')](_0x2bad83);};}exports[_0xe084('0x1e')]=function(_0x2a2963,_0x9f3124){var _0x51963f={},_0xdf0477={},_0x3ff6d5={'count':0x0,'rows':[]};var _0x1c760d=_[_0xe084('0x1f')](db['SquareProject']['rawAttributes'],function(_0x1c0c39){return{'name':_0x1c0c39['fieldName'],'type':_0x1c0c39[_0xe084('0x20')][_0xe084('0x21')]};});_0xdf0477[_0xe084('0x22')]=_[_0xe084('0x1f')](_0x1c760d,_0xe084('0x23'));_0xdf0477[_0xe084('0x24')]=_[_0xe084('0x25')](_0x2a2963[_0xe084('0x24')]);_0xdf0477['filters']=_[_0xe084('0x26')](_0xdf0477['model'],_0xdf0477[_0xe084('0x24')]);_0x51963f[_0xe084('0x27')]=_[_0xe084('0x26')](_0xdf0477[_0xe084('0x22')],qs['fields'](_0x2a2963[_0xe084('0x24')]['fields']));_0x51963f['attributes']=_0x51963f[_0xe084('0x27')][_0xe084('0x28')]?_0x51963f[_0xe084('0x27')]:_0xdf0477['model'];if(!_0x2a2963[_0xe084('0x24')][_0xe084('0x29')](_0xe084('0x2a'))){_0x51963f[_0xe084('0xc')]=qs[_0xe084('0xc')](_0x2a2963['query']['limit']);_0x51963f['offset']=qs['offset'](_0x2a2963['query']['offset']);}_0x51963f[_0xe084('0x2b')]=qs[_0xe084('0x2c')](_0x2a2963[_0xe084('0x24')][_0xe084('0x2c')]);_0x51963f[_0xe084('0x2d')]=qs[_0xe084('0x2e')](_['pick'](_0x2a2963[_0xe084('0x24')],_0xdf0477[_0xe084('0x2e')]),_0x1c760d);if(_0x2a2963[_0xe084('0x24')][_0xe084('0x2f')]){_0x51963f[_0xe084('0x2d')]=_['merge'](_0x51963f[_0xe084('0x2d')],{'$or':_[_0xe084('0x1f')](_0x1c760d,function(_0x416fba){if(_0x416fba[_0xe084('0x20')]!==_0xe084('0x30')){var _0x35d79={};_0x35d79[_0x416fba['name']]={'$like':'%'+_0x2a2963[_0xe084('0x24')][_0xe084('0x2f')]+'%'};return _0x35d79;}})});}_0x51963f=_[_0xe084('0x31')]({},_0x51963f,_0x2a2963[_0xe084('0x32')]);var _0x1595f3={'where':_0x51963f[_0xe084('0x2d')]};return db[_0xe084('0x33')][_0xe084('0xe')](_0x1595f3)[_0xe084('0x13')](function(_0x2e83d4){_0x3ff6d5[_0xe084('0xe')]=_0x2e83d4;if(_0x2a2963[_0xe084('0x24')]['includeAll']){_0x51963f[_0xe084('0x34')]=[{'all':!![]}];}return db['SquareProject'][_0xe084('0x35')](_0x51963f);})[_0xe084('0x13')](function(_0x46a880){_0x3ff6d5[_0xe084('0x36')]=_0x46a880;return _0x3ff6d5;})[_0xe084('0x13')](respondWithFilteredResult(_0x9f3124,_0x51963f))[_0xe084('0x37')](handleError(_0x9f3124,null));};exports[_0xe084('0x38')]=function(_0x50ba8f,_0x43f2b5){var _0x284792={'raw':![],'where':{'id':_0x50ba8f[_0xe084('0x39')]['id']}},_0x83be47={};_0x83be47[_0xe084('0x22')]=_[_0xe084('0x25')](db[_0xe084('0x33')][_0xe084('0x3a')]);_0x83be47[_0xe084('0x24')]=_[_0xe084('0x25')](_0x50ba8f[_0xe084('0x24')]);_0x83be47[_0xe084('0x2e')]=_[_0xe084('0x26')](_0x83be47[_0xe084('0x22')],_0x83be47[_0xe084('0x24')]);_0x284792['attributes']=_['intersection'](_0x83be47[_0xe084('0x22')],qs[_0xe084('0x3b')](_0x50ba8f[_0xe084('0x24')][_0xe084('0x3b')]));_0x284792[_0xe084('0x27')]=_0x284792['attributes'][_0xe084('0x28')]?_0x284792[_0xe084('0x27')]:_0x83be47['model'];if(_0x50ba8f['query']['includeAll']){_0x284792[_0xe084('0x34')]=[{'all':!![]}];}_0x284792=_[_0xe084('0x31')]({},_0x284792,_0x50ba8f['options']);return db[_0xe084('0x33')]['find'](_0x284792)[_0xe084('0x13')](handleEntityNotFound(_0x43f2b5,null))[_0xe084('0x13')](respondWithResult(_0x43f2b5,null))[_0xe084('0x37')](handleError(_0x43f2b5,null));};exports['create']=function(_0x2ec069,_0x1f0ad7){return db['SquareProject'][_0xe084('0x3c')](_0x2ec069[_0xe084('0x3d')],{})[_0xe084('0x13')](function(_0x18614f){var _0x2e66e1=_0x2ec069['user']['get']({'plain':!![]});if(!_0x2e66e1)throw new Error(_0xe084('0x3e'));if(_0x2e66e1[_0xe084('0x3f')]==='user'){var _0x2ab221=_0x18614f[_0xe084('0x15')]({'plain':!![]});var _0x4e95e3=_0xe084('0x16');return db[_0xe084('0x40')][_0xe084('0x41')]({'where':{'name':_0x4e95e3,'userProfileId':_0x2e66e1[_0xe084('0x42')]},'raw':!![]})['then'](function(_0x37bed4){if(_0x37bed4&&_0x37bed4[_0xe084('0x43')]===0x0){return db['UserProfileResource'][_0xe084('0x3c')]({'name':_0x2ab221[_0xe084('0x23')],'resourceId':_0x2ab221['id'],'type':_0x37bed4[_0xe084('0x23')],'sectionId':_0x37bed4['id']},{})[_0xe084('0x13')](function(){return _0x18614f;});}else{return _0x18614f;}})[_0xe084('0x37')](function(_0x6f4a14){logger['error'](_0xe084('0x44'),_0x6f4a14);throw _0x6f4a14;});}return _0x18614f;})[_0xe084('0x13')](respondWithResult(_0x1f0ad7,0xc9))[_0xe084('0x37')](handleError(_0x1f0ad7,null));};exports[_0xe084('0x12')]=function(_0x169f23,_0x517646){if(_0x169f23[_0xe084('0x3d')]['id']){delete _0x169f23['body']['id'];}return db[_0xe084('0x33')][_0xe084('0x41')]({'where':{'id':_0x169f23['params']['id']}})[_0xe084('0x13')](handleEntityNotFound(_0x517646,null))[_0xe084('0x13')](saveUpdates(_0x169f23[_0xe084('0x3d')],null))['then'](function(_0xe678be){if(!_0xe678be)return;var _0x54e827=_0xe678be[_0xe084('0x15')]({'plain':!![]});return _0x54e827;})[_0xe084('0x13')](function(_0x3d8d07){var _0x11d497=new Redis(config[_0xe084('0x6')]);_0x11d497['publish'](_0xe084('0x18'),JSON[_0xe084('0x19')](_[_0xe084('0x45')](_0x3d8d07,['id',_0xe084('0x23'),'production'])));return _0x3d8d07;})['then'](respondWithResult(_0x517646,null))['catch'](handleError(_0x517646,null));};exports['destroy']=function(_0x216fea,_0x131e22){return db[_0xe084('0x33')][_0xe084('0x41')]({'where':{'id':_0x216fea[_0xe084('0x39')]['id']}})[_0xe084('0x13')](handleEntityNotFound(_0x131e22,null))[_0xe084('0x13')](removeEntity(_0x131e22,null))[_0xe084('0x37')](handleError(_0x131e22,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index cc0a3ca..4482d59 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 _0xa923=['save','update','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x2368e4,_0x449a78){var _0x5acaaf=function(_0x22e8a4){while(--_0x22e8a4){_0x2368e4['push'](_0x2368e4['shift']());}};_0x5acaaf(++_0x449a78);}(_0xa923,0x10d));var _0x3a92=function(_0x4e633e,_0x37f662){_0x4e633e=_0x4e633e-0x0;var _0x728373=_0xa923[_0x4e633e];return _0x728373;};'use strict';var EventEmitter=require(_0x3a92('0x0'));var SquareProject=require(_0x3a92('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x3a92('0x2')](0x0);var events={'afterCreate':_0x3a92('0x3'),'afterUpdate':_0x3a92('0x4'),'afterDestroy':'remove'};function emitEvent(_0x141055){return function(_0x55b167,_0x5f0814,_0x5f1616){SquareProjectEvents[_0x3a92('0x5')](_0x141055+':'+_0x55b167['id'],_0x55b167);SquareProjectEvents[_0x3a92('0x5')](_0x141055,_0x55b167);_0x5f1616(null);};}for(var e in events){if(events[_0x3a92('0x6')](e)){var event=events[e];SquareProject[_0x3a92('0x7')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0xe467=['events','../../mysqldb','SquareProject','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x81a08d,_0x44efda){var _0x5acff3=function(_0x2131b9){while(--_0x2131b9){_0x81a08d['push'](_0x81a08d['shift']());}};_0x5acff3(++_0x44efda);}(_0xe467,0xe1));var _0x7e46=function(_0x1a45e3,_0x385589){_0x1a45e3=_0x1a45e3-0x0;var _0x3615f8=_0xe467[_0x1a45e3];return _0x3615f8;};'use strict';var EventEmitter=require(_0x7e46('0x0'));var SquareProject=require(_0x7e46('0x1'))['db'][_0x7e46('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x7e46('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7e46('0x4'),'afterDestroy':_0x7e46('0x5')};function emitEvent(_0x90a463){return function(_0x2f9c7e,_0x4b122d,_0x4b5532){SquareProjectEvents[_0x7e46('0x6')](_0x90a463+':'+_0x2f9c7e['id'],_0x2f9c7e);SquareProjectEvents[_0x7e46('0x6')](_0x90a463,_0x2f9c7e);_0x4b5532(null);};}for(var e in events){if(events[_0x7e46('0x7')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x7e46('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index c602434..3a2e0a3 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 _0x883b=['publishedAt','util','../../config/logger','api','bluebird','path','./squareProject.attributes','exports','define','SquareProject','changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x56e24c,_0x19e1df){var _0x3a7af8=function(_0x1d83bc){while(--_0x1d83bc){_0x56e24c['push'](_0x56e24c['shift']());}};_0x3a7af8(++_0x19e1df);}(_0x883b,0x143));var _0xb883=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x883b[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xb883('0x0'));var logger=require(_0xb883('0x1'))(_0xb883('0x2'));var moment=require('moment');var BPromise=require(_0xb883('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb883('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb883('0x5'));module[_0xb883('0x6')]=function(_0x360847,_0x1f9ba5){return _0x360847[_0xb883('0x7')](_0xb883('0x8'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xe47192,_0x331618,_0xacbbb8){if(_0xe47192[_0xb883('0x9')](_0xb883('0xa'))){_0xe47192['savedAt']=moment()[_0xb883('0xb')](_0xb883('0xc'));}if(_0xe47192[_0xb883('0x9')]('production')){_0xe47192[_0xb883('0xd')]=moment()[_0xb883('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0xacbbb8(null,_0xe47192);}}});}; \ No newline at end of file +var _0x08a6=['../../config/environment','exports','define','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','../../config/logger','bluebird','path'];(function(_0x574394,_0x49d75f){var _0x93a092=function(_0x1bcaf2){while(--_0x1bcaf2){_0x574394['push'](_0x574394['shift']());}};_0x93a092(++_0x49d75f);}(_0x08a6,0x131));var _0x608a=function(_0x4b1bb0,_0x7dc32b){_0x4b1bb0=_0x4b1bb0-0x0;var _0x549407=_0x08a6[_0x4b1bb0];return _0x549407;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x608a('0x0'))('api');var moment=require('moment');var BPromise=require(_0x608a('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x608a('0x2'));var rimraf=require('rimraf');var config=require(_0x608a('0x3'));var attributes=require('./squareProject.attributes');module[_0x608a('0x4')]=function(_0x5c5362,_0x3d8458){return _0x5c5362[_0x608a('0x5')]('SquareProject',attributes,{'tableName':_0x608a('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4d2e12,_0x54dfb9,_0x46375b){if(_0x4d2e12[_0x608a('0x7')](_0x608a('0x8'))){_0x4d2e12[_0x608a('0x9')]=moment()[_0x608a('0xa')](_0x608a('0xb'));}if(_0x4d2e12[_0x608a('0x7')](_0x608a('0xc'))){_0x4d2e12[_0x608a('0xd')]=moment()[_0x608a('0xa')](_0x608a('0xb'));}_0x46375b(null,_0x4d2e12);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 0d25fa0..ae8bb78 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 _0xd952=['limit','map','include','model','then','debug','stringify','catch','error','message','SquareProject','find','raw','ShowSquareProject','lodash','ioredis','../../mysqldb','rpc','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','findAll','options','where','attributes'];(function(_0x4591db,_0x1182cb){var _0x5891ed=function(_0x57eb2e){while(--_0x57eb2e){_0x4591db['push'](_0x4591db['shift']());}};_0x5891ed(++_0x1182cb);}(_0xd952,0x65));var _0x2d95=function(_0x27b3e0,_0x59514e){_0x27b3e0=_0x27b3e0-0x0;var _0x3628a7=_0xd952[_0x27b3e0];return _0x3628a7;};'use strict';var _=require(_0x2d95('0x0'));var Redis=require(_0x2d95('0x1'));var db=require(_0x2d95('0x2'))['db'];var logger=require('../../config/logger')(_0x2d95('0x3'));var config=require('../../config/environment');config[_0x2d95('0x4')]=_[_0x2d95('0x5')](config[_0x2d95('0x4')],{'host':_0x2d95('0x6'),'port':0x18eb});var socket=require(_0x2d95('0x7'))(new Redis(config[_0x2d95('0x4')]));require(_0x2d95('0x8'))[_0x2d95('0x9')](socket);exports[_0x2d95('0xa')]=function(_0x2f1a70){var _0x5e9858=this;return new Promise(function(_0x406d5b,_0x2124ba){return db['SquareProject'][_0x2d95('0xb')]({'raw':_0x2f1a70[_0x2d95('0xc')]?_0x2f1a70['options']['raw']===undefined?!![]:![]:!![],'where':_0x2f1a70[_0x2d95('0xc')]?_0x2f1a70[_0x2d95('0xc')][_0x2d95('0xd')]||null:null,'attributes':_0x2f1a70[_0x2d95('0xc')]?_0x2f1a70[_0x2d95('0xc')][_0x2d95('0xe')]||null:null,'limit':_0x2f1a70[_0x2d95('0xc')]?_0x2f1a70[_0x2d95('0xc')][_0x2d95('0xf')]||null:null,'include':_0x2f1a70['options']?_0x2f1a70['options']['include']?_[_0x2d95('0x10')](_0x2f1a70[_0x2d95('0xc')][_0x2d95('0x11')],function(_0x3d1e5e){return{'model':db[_0x3d1e5e[_0x2d95('0x12')]],'as':_0x3d1e5e['as'],'attributes':_0x3d1e5e['attributes'],'include':_0x3d1e5e[_0x2d95('0x11')]?_[_0x2d95('0x10')](_0x3d1e5e['include'],function(_0x5e3146){return{'model':db[_0x5e3146[_0x2d95('0x12')]],'as':_0x5e3146['as'],'attributes':_0x5e3146[_0x2d95('0xe')],'include':_0x5e3146[_0x2d95('0x11')]?_['map'](_0x5e3146[_0x2d95('0x11')],function(_0x5f27e2){return{'model':db[_0x5f27e2[_0x2d95('0x12')]],'as':_0x5f27e2['as'],'attributes':_0x5f27e2[_0x2d95('0xe')]};}):[]};}):[]};}):[]:[]})[_0x2d95('0x13')](function(_0x459906){logger['info'](_0x2d95('0xa'),_0x2f1a70);logger[_0x2d95('0x14')]('GetSquareProjects',_0x2f1a70,JSON[_0x2d95('0x15')](_0x459906));_0x406d5b(_0x459906);})[_0x2d95('0x16')](function(_0x3ebb47){logger[_0x2d95('0x17')]('GetSquareProjects',_0x3ebb47[_0x2d95('0x18')],_0x2f1a70);_0x2124ba(_0x5e9858[_0x2d95('0x17')](0x1f4,_0x3ebb47['message']));});});};exports['ShowSquareProject']=function(_0x225aa0){var _0x96c299=this;return new Promise(function(_0x47d64e,_0x398ab9){return db[_0x2d95('0x19')][_0x2d95('0x1a')]({'raw':_0x225aa0[_0x2d95('0xc')]?_0x225aa0[_0x2d95('0xc')][_0x2d95('0x1b')]===undefined?!![]:![]:!![],'where':_0x225aa0['options']?_0x225aa0[_0x2d95('0xc')][_0x2d95('0xd')]||null:null,'attributes':_0x225aa0[_0x2d95('0xc')]?_0x225aa0[_0x2d95('0xc')][_0x2d95('0xe')]||null:null,'include':_0x225aa0['options']?_0x225aa0[_0x2d95('0xc')][_0x2d95('0x11')]?_[_0x2d95('0x10')](_0x225aa0['options']['include'],function(_0x1e2ed6){return{'model':db[_0x1e2ed6['model']],'as':_0x1e2ed6['as'],'attributes':_0x1e2ed6[_0x2d95('0xe')],'include':_0x1e2ed6[_0x2d95('0x11')]?_[_0x2d95('0x10')](_0x1e2ed6[_0x2d95('0x11')],function(_0x2c5077){return{'model':db[_0x2c5077[_0x2d95('0x12')]],'as':_0x2c5077['as'],'attributes':_0x2c5077[_0x2d95('0xe')],'include':_0x2c5077[_0x2d95('0x11')]?_[_0x2d95('0x10')](_0x2c5077[_0x2d95('0x11')],function(_0x3276f0){return{'model':db[_0x3276f0[_0x2d95('0x12')]],'as':_0x3276f0['as'],'attributes':_0x3276f0[_0x2d95('0xe')]};}):[]};}):[]};}):[]:[]})[_0x2d95('0x13')](function(_0x4d4b39){logger['info']('ShowSquareProject',_0x225aa0);logger[_0x2d95('0x14')](_0x2d95('0x1c'),_0x225aa0,JSON[_0x2d95('0x15')](_0x4d4b39));_0x47d64e(_0x4d4b39);})[_0x2d95('0x16')](function(_0x1f5923){logger[_0x2d95('0x17')](_0x2d95('0x1c'),_0x1f5923[_0x2d95('0x18')],_0x225aa0);_0x398ab9(_0x96c299[_0x2d95('0x17')](0x1f4,_0x1f5923[_0x2d95('0x18')]));});});}; \ No newline at end of file +var _0x44cc=['attributes','then','info','GetSquareProjects','debug','error','message','ShowSquareProject','raw','stringify','catch','lodash','../../config/logger','rpc','redis','defaults','localhost','./squareProject.socket','register','SquareProject','findAll','options','limit','include','map','model'];(function(_0x277721,_0x46971e){var _0x286051=function(_0x130c98){while(--_0x130c98){_0x277721['push'](_0x277721['shift']());}};_0x286051(++_0x46971e);}(_0x44cc,0x73));var _0xc44c=function(_0xc5225a,_0x3f24fe){_0xc5225a=_0xc5225a-0x0;var _0x36352a=_0x44cc[_0xc5225a];return _0x36352a;};'use strict';var _=require(_0xc44c('0x0'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var logger=require(_0xc44c('0x1'))(_0xc44c('0x2'));var config=require('../../config/environment');config[_0xc44c('0x3')]=_[_0xc44c('0x4')](config[_0xc44c('0x3')],{'host':_0xc44c('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc44c('0x6'))[_0xc44c('0x7')](socket);exports['GetSquareProjects']=function(_0x49ce6a){var _0x55deca=this;return new Promise(function(_0x100cd4,_0x37546a){return db[_0xc44c('0x8')][_0xc44c('0x9')]({'raw':_0x49ce6a[_0xc44c('0xa')]?_0x49ce6a[_0xc44c('0xa')]['raw']===undefined?!![]:![]:!![],'where':_0x49ce6a[_0xc44c('0xa')]?_0x49ce6a['options']['where']||null:null,'attributes':_0x49ce6a[_0xc44c('0xa')]?_0x49ce6a[_0xc44c('0xa')]['attributes']||null:null,'limit':_0x49ce6a[_0xc44c('0xa')]?_0x49ce6a[_0xc44c('0xa')][_0xc44c('0xb')]||null:null,'include':_0x49ce6a[_0xc44c('0xa')]?_0x49ce6a[_0xc44c('0xa')][_0xc44c('0xc')]?_[_0xc44c('0xd')](_0x49ce6a['options'][_0xc44c('0xc')],function(_0x5b9828){return{'model':db[_0x5b9828[_0xc44c('0xe')]],'as':_0x5b9828['as'],'attributes':_0x5b9828[_0xc44c('0xf')],'include':_0x5b9828['include']?_[_0xc44c('0xd')](_0x5b9828['include'],function(_0x3c9c74){return{'model':db[_0x3c9c74[_0xc44c('0xe')]],'as':_0x3c9c74['as'],'attributes':_0x3c9c74[_0xc44c('0xf')],'include':_0x3c9c74[_0xc44c('0xc')]?_[_0xc44c('0xd')](_0x3c9c74[_0xc44c('0xc')],function(_0x280df6){return{'model':db[_0x280df6['model']],'as':_0x280df6['as'],'attributes':_0x280df6[_0xc44c('0xf')]};}):[]};}):[]};}):[]:[]})[_0xc44c('0x10')](function(_0x3e1116){logger[_0xc44c('0x11')](_0xc44c('0x12'),_0x49ce6a);logger[_0xc44c('0x13')]('GetSquareProjects',_0x49ce6a,JSON['stringify'](_0x3e1116));_0x100cd4(_0x3e1116);})['catch'](function(_0x30d75c){logger[_0xc44c('0x14')]('GetSquareProjects',_0x30d75c[_0xc44c('0x15')],_0x49ce6a);_0x37546a(_0x55deca[_0xc44c('0x14')](0x1f4,_0x30d75c[_0xc44c('0x15')]));});});};exports[_0xc44c('0x16')]=function(_0x1f07a7){var _0x2913bc=this;return new Promise(function(_0x30426f,_0x352d21){return db['SquareProject']['find']({'raw':_0x1f07a7[_0xc44c('0xa')]?_0x1f07a7['options'][_0xc44c('0x17')]===undefined?!![]:![]:!![],'where':_0x1f07a7[_0xc44c('0xa')]?_0x1f07a7[_0xc44c('0xa')]['where']||null:null,'attributes':_0x1f07a7['options']?_0x1f07a7[_0xc44c('0xa')][_0xc44c('0xf')]||null:null,'include':_0x1f07a7[_0xc44c('0xa')]?_0x1f07a7['options'][_0xc44c('0xc')]?_['map'](_0x1f07a7[_0xc44c('0xa')][_0xc44c('0xc')],function(_0x225252){return{'model':db[_0x225252['model']],'as':_0x225252['as'],'attributes':_0x225252[_0xc44c('0xf')],'include':_0x225252[_0xc44c('0xc')]?_[_0xc44c('0xd')](_0x225252[_0xc44c('0xc')],function(_0xb2ce7c){return{'model':db[_0xb2ce7c[_0xc44c('0xe')]],'as':_0xb2ce7c['as'],'attributes':_0xb2ce7c[_0xc44c('0xf')],'include':_0xb2ce7c['include']?_[_0xc44c('0xd')](_0xb2ce7c[_0xc44c('0xc')],function(_0x1ba7bc){return{'model':db[_0x1ba7bc[_0xc44c('0xe')]],'as':_0x1ba7bc['as'],'attributes':_0x1ba7bc['attributes']};}):[]};}):[]};}):[]:[]})[_0xc44c('0x10')](function(_0x4f3771){logger['info'](_0xc44c('0x16'),_0x1f07a7);logger['debug']('ShowSquareProject',_0x1f07a7,JSON[_0xc44c('0x18')](_0x4f3771));_0x30426f(_0x4f3771);})[_0xc44c('0x19')](function(_0x57d4f9){logger[_0xc44c('0x14')]('ShowSquareProject',_0x57d4f9[_0xc44c('0x15')],_0x1f07a7);_0x352d21(_0x2913bc[_0xc44c('0x14')](0x1f4,_0x57d4f9[_0xc44c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 17e6a9a..bcb5c81 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 _0x7b1b=['save','remove','removeListener','register','length','./squareProject.events'];(function(_0x21b625,_0x347030){var _0x28df33=function(_0x36fab3){while(--_0x36fab3){_0x21b625['push'](_0x21b625['shift']());}};_0x28df33(++_0x347030);}(_0x7b1b,0xf5));var _0xb7b1=function(_0x20639d,_0x692ef4){_0x20639d=_0x20639d-0x0;var _0x3db57a=_0x7b1b[_0x20639d];return _0x3db57a;};'use strict';var SquareProjectEvents=require(_0xb7b1('0x0'));var events=[_0xb7b1('0x1'),_0xb7b1('0x2'),'update'];function createListener(_0x281f56,_0x580600){return function(_0x54f4aa){_0x580600['emit'](_0x281f56,_0x54f4aa);};}function removeListener(_0x5ed1d2,_0x3049bb){return function(){SquareProjectEvents[_0xb7b1('0x3')](_0x5ed1d2,_0x3049bb);};}exports[_0xb7b1('0x4')]=function(_0x25549c){for(var _0x1da6f5=0x0,_0x2718ff=events[_0xb7b1('0x5')];_0x1da6f5<_0x2718ff;_0x1da6f5++){var _0xfa296b=events[_0x1da6f5];var _0x9a95ab=createListener('squareProject:'+_0xfa296b,_0x25549c);SquareProjectEvents['on'](_0xfa296b,_0x9a95ab);}}; \ No newline at end of file +var _0x0ce4=['squareProject:','./squareProject.events','update','emit','removeListener','register','length'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x0ce4,0x6a));var _0x40ce=function(_0x1ca2e1,_0x10d773){_0x1ca2e1=_0x1ca2e1-0x0;var _0x2d1c34=_0x0ce4[_0x1ca2e1];return _0x2d1c34;};'use strict';var SquareProjectEvents=require(_0x40ce('0x0'));var events=['save','remove',_0x40ce('0x1')];function createListener(_0x4b2bbc,_0x2a6089){return function(_0x3d30bc){_0x2a6089[_0x40ce('0x2')](_0x4b2bbc,_0x3d30bc);};}function removeListener(_0x2250fe,_0x56b89f){return function(){SquareProjectEvents[_0x40ce('0x3')](_0x2250fe,_0x56b89f);};}exports[_0x40ce('0x4')]=function(_0x307fd4){for(var _0x4ccd9f=0x0,_0x3ccba8=events[_0x40ce('0x5')];_0x4ccd9f<_0x3ccba8;_0x4ccd9f++){var _0x559688=events[_0x4ccd9f];var _0x17a4a1=createListener(_0x40ce('0x6')+_0x559688,_0x307fd4);SquareProjectEvents['on'](_0x559688,_0x17a4a1);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 26e8c4d..4ec0fcf 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 _0x1cb9=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put'];(function(_0x5299e8,_0xa74bcc){var _0x279610=function(_0x146716){while(--_0x146716){_0x5299e8['push'](_0x5299e8['shift']());}};_0x279610(++_0xa74bcc);}(_0x1cb9,0x14e));var _0x91cb=function(_0x18d460,_0x275d84){_0x18d460=_0x18d460-0x0;var _0x362859=_0x1cb9[_0x18d460];return _0x362859;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x11')](_0x91cb('0xb'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x13')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0x14')]);module[_0x91cb('0x15')]=router; \ No newline at end of file +var _0x7fbe=['/:id','show','/:id/download','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index'];(function(_0x243d03,_0xedcae7){var _0x3bc936=function(_0x37d43d){while(--_0x37d43d){_0x243d03['push'](_0x243d03['shift']());}};_0x3bc936(++_0xedcae7);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2de9c0,_0x2ae1f2){_0x2de9c0=_0x2de9c0-0x0;var _0x1c4daa=_0x7fbe[_0x2de9c0];return _0x1c4daa;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['download']);router['post']('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x11')]);router[_0xe7fb('0x12')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x13')]);module[_0xe7fb('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 e5d1058..6d5ec20 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 _0xb138=['getDataValue','substring','lastIndexOf','sequelize','exports','STRING'];(function(_0x499e2e,_0x8c3216){var _0x6a14bd=function(_0x1f4696){while(--_0x1f4696){_0x499e2e['push'](_0x499e2e['shift']());}};_0x6a14bd(++_0x8c3216);}(_0xb138,0x1dd));var _0x8b13=function(_0x2ce8e3,_0x34cb6e){_0x2ce8e3=_0x2ce8e3-0x0;var _0x3940ed=_0xb138[_0x2ce8e3];return _0x3940ed;};'use strict';var Sequelize=require(_0x8b13('0x0'));module[_0x8b13('0x1')]={'uniqueid':{'type':Sequelize[_0x8b13('0x2')]},'callerid':{'type':Sequelize[_0x8b13('0x2')]},'calleridname':{'type':Sequelize[_0x8b13('0x2')]},'context':{'type':Sequelize[_0x8b13('0x2')]},'extension':{'type':Sequelize[_0x8b13('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8b13('0x2')]},'dnid':{'type':Sequelize[_0x8b13('0x2')]},'projectName':{'type':Sequelize[_0x8b13('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x8b13('0x2')]},'savePath':{'type':Sequelize[_0x8b13('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x3fdf4d='';var _0x33d1a7=this[_0x8b13('0x3')]('savePath');if(_0x33d1a7){_0x3fdf4d=_0x33d1a7[_0x8b13('0x4')](_0x33d1a7[_0x8b13('0x5')]('.'));}return _0x3fdf4d;}}}; \ No newline at end of file +var _0x2675=['getDataValue','savePath','lastIndexOf','sequelize','STRING','VIRTUAL'];(function(_0x95eba8,_0x128c50){var _0x54f606=function(_0x75bbce){while(--_0x75bbce){_0x95eba8['push'](_0x95eba8['shift']());}};_0x54f606(++_0x128c50);}(_0x2675,0x75));var _0x5267=function(_0x334cbd,_0x47a1ad){_0x334cbd=_0x334cbd-0x0;var _0x48a8ed=_0x2675[_0x334cbd];return _0x48a8ed;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5267('0x1')]},'context':{'type':Sequelize[_0x5267('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5267('0x1')]},'accountcode':{'type':Sequelize[_0x5267('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x5267('0x1')]},'saveName':{'type':Sequelize[_0x5267('0x1')]},'filename':{'type':Sequelize[_0x5267('0x1')]},'savePath':{'type':Sequelize[_0x5267('0x1')]},'format':{'type':Sequelize[_0x5267('0x2')],'get':function(){var _0xc56cd5='';var _0x527c16=this[_0x5267('0x3')](_0x5267('0x4'));if(_0x527c16){_0xc56cd5=_0x527c16['substring'](_0x527c16[_0x5267('0x5')]('.'));}return _0xc56cd5;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 3040b62..0c6c4fe 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 _0x799e=['eml-format','request-promise','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','update','params','download','../../components/encryptor','uniqueid','savePath','%s.cypher','existsSync','recording','Sequelize','SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync'];(function(_0x371648,_0x286805){var _0x5c7980=function(_0x4f4c51){while(--_0x4f4c51){_0x371648['push'](_0x371648['shift']());}};_0x5c7980(++_0x286805);}(_0x799e,0x174));var _0xe799=function(_0x1b0071,_0x35e57e){_0x1b0071=_0x1b0071-0x0;var _0x151840=_0x799e[_0x1b0071];return _0x151840;};'use strict';var emlformat=require(_0xe799('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe799('0x1'));var moment=require('moment');var BPromise=require(_0xe799('0x2'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xe799('0x3'));var csv=require(_0xe799('0x4'));var ejs=require(_0xe799('0x5'));var fs=require('fs');var fs_extra=require(_0xe799('0x6'));var _=require(_0xe799('0x7'));var squel=require(_0xe799('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe799('0x9'));var toCsv=require(_0xe799('0x4'));var querystring=require(_0xe799('0xa'));var Papa=require(_0xe799('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe799('0xc'));var as=require(_0xe799('0xd'));var hardwareService=require(_0xe799('0xe'));var logger=require(_0xe799('0xf'))(_0xe799('0x10'));var utils=require('../../config/utils');var config=require(_0xe799('0x11'));var licenseUtil=require(_0xe799('0x12'));var db=require(_0xe799('0x13'))['db'];function respondWithStatusCode(_0x5b9c83,_0x1ecc71){_0x1ecc71=_0x1ecc71||0xcc;return function(_0x51728e){if(_0x51728e){return _0x5b9c83['sendStatus'](_0x1ecc71);}return _0x5b9c83[_0xe799('0x14')](_0x1ecc71)[_0xe799('0x15')]();};}function respondWithResult(_0x14fe62,_0x58c9d9){_0x58c9d9=_0x58c9d9||0xc8;return function(_0x5c70e2){if(_0x5c70e2){return _0x14fe62[_0xe799('0x14')](_0x58c9d9)[_0xe799('0x16')](_0x5c70e2);}};}function respondWithFilteredResult(_0x5d20a5,_0x4a8025){return function(_0x114ce3){if(_0x114ce3){var _0x588f69=typeof _0x4a8025[_0xe799('0x17')]===_0xe799('0x18')&&typeof _0x4a8025[_0xe799('0x19')]==='undefined';var _0x456494=_0x114ce3['count'];var _0x37e43f=_0x588f69?0x0:_0x4a8025[_0xe799('0x17')];var _0x529a6e=_0x588f69?_0x114ce3[_0xe799('0x1a')]:_0x4a8025[_0xe799('0x17')]+_0x4a8025[_0xe799('0x19')];var _0xb31315;if(_0x529a6e>=_0x456494){_0x529a6e=_0x456494;_0xb31315=0xc8;}else{_0xb31315=0xce;}_0x5d20a5[_0xe799('0x14')](_0xb31315);return _0x5d20a5[_0xe799('0x1b')](_0xe799('0x1c'),_0x37e43f+'-'+_0x529a6e+'/'+_0x456494)[_0xe799('0x16')](_0x114ce3);}return null;};}function patchUpdates(_0x5723fa){return function(_0x6a4bde){try{jsonpatch[_0xe799('0x1d')](_0x6a4bde,_0x5723fa,!![]);}catch(_0x88cf97){return BPromise[_0xe799('0x1e')](_0x88cf97);}return _0x6a4bde[_0xe799('0x1f')]();};}function saveUpdates(_0xcc8d9b,_0x382302){return function(_0x1e5e8f){if(_0x1e5e8f){return _0x1e5e8f['update'](_0xcc8d9b)[_0xe799('0x20')](function(_0x1c1fca){return _0x1c1fca;});}return null;};}function removeEntity(_0xf44cee,_0x2e73ca){return function(_0x5b2e3e){if(_0x5b2e3e){return _0x5b2e3e['destroy']()[_0xe799('0x20')](function(){_0xf44cee[_0xe799('0x14')](0xcc)[_0xe799('0x15')]();});}};}function handleEntityNotFound(_0x1226a2,_0x270feb){return function(_0x4f6bdb){if(!_0x4f6bdb){_0x1226a2['sendStatus'](0x194);}return _0x4f6bdb;};}function handleError(_0x304b0a,_0x45e15b){_0x45e15b=_0x45e15b||0x1f4;return function(_0xd9796){logger[_0xe799('0x21')](_0xd9796[_0xe799('0x22')]);if(_0xd9796[_0xe799('0x23')]){delete _0xd9796[_0xe799('0x23')];}_0x304b0a[_0xe799('0x14')](_0x45e15b)[_0xe799('0x24')](_0xd9796);};}exports[_0xe799('0x25')]=function(_0x2966bb,_0x48290c){var _0x4b190b={},_0x28b328={},_0x5d983a={'count':0x0,'rows':[]};var _0x577a93=_[_0xe799('0x26')](db[_0xe799('0x27')][_0xe799('0x28')],function(_0x580acd){return{'name':_0x580acd[_0xe799('0x29')],'type':_0x580acd[_0xe799('0x2a')][_0xe799('0x2b')]};});_0x28b328[_0xe799('0x2c')]=_[_0xe799('0x26')](_0x577a93,'name');_0x28b328[_0xe799('0x2d')]=_['keys'](_0x2966bb[_0xe799('0x2d')]);_0x28b328[_0xe799('0x2e')]=_['intersection'](_0x28b328[_0xe799('0x2c')],_0x28b328['query']);_0x4b190b[_0xe799('0x2f')]=_[_0xe799('0x30')](_0x28b328['model'],qs[_0xe799('0x31')](_0x2966bb['query'][_0xe799('0x31')]));_0x4b190b[_0xe799('0x2f')]=_0x4b190b['attributes'][_0xe799('0x32')]?_0x4b190b[_0xe799('0x2f')]:_0x28b328[_0xe799('0x2c')];if(!_0x2966bb[_0xe799('0x2d')][_0xe799('0x33')](_0xe799('0x34'))){_0x4b190b[_0xe799('0x19')]=qs[_0xe799('0x19')](_0x2966bb[_0xe799('0x2d')][_0xe799('0x19')]);_0x4b190b[_0xe799('0x17')]=qs['offset'](_0x2966bb['query']['offset']);}_0x4b190b[_0xe799('0x35')]=qs[_0xe799('0x36')](_0x2966bb[_0xe799('0x2d')][_0xe799('0x36')]);_0x4b190b[_0xe799('0x37')]=qs['filters'](_['pick'](_0x2966bb[_0xe799('0x2d')],_0x28b328['filters']),_0x577a93);if(_0x2966bb['query'][_0xe799('0x38')]){_0x4b190b['where']=_['merge'](_0x4b190b['where'],{'$or':_['map'](_0x577a93,function(_0x41ad56){if(_0x41ad56[_0xe799('0x2a')]!==_0xe799('0x39')){var _0x59296b={};_0x59296b[_0x41ad56[_0xe799('0x23')]]={'$like':'%'+_0x2966bb['query'][_0xe799('0x38')]+'%'};return _0x59296b;}})});}_0x4b190b=_[_0xe799('0x3a')]({},_0x4b190b,_0x2966bb['options']);var _0x477e1={'where':_0x4b190b[_0xe799('0x37')]};return db[_0xe799('0x27')][_0xe799('0x1a')](_0x477e1)[_0xe799('0x20')](function(_0x59e6b1){_0x5d983a[_0xe799('0x1a')]=_0x59e6b1;if(_0x2966bb['query'][_0xe799('0x3b')]){_0x4b190b[_0xe799('0x3c')]=[{'all':!![]}];}return db[_0xe799('0x27')][_0xe799('0x3d')](_0x4b190b);})[_0xe799('0x20')](function(_0x230b7c){_0x5d983a[_0xe799('0x3e')]=_0x230b7c;return _0x5d983a;})['then'](respondWithFilteredResult(_0x48290c,_0x4b190b))[_0xe799('0x3f')](handleError(_0x48290c,null));};exports[_0xe799('0x40')]=function(_0x39139d,_0x4f8585){var _0x346b25={'raw':!![],'where':{'id':_0x39139d['params']['id']}},_0x8fa5ab={};_0x8fa5ab[_0xe799('0x2c')]=_[_0xe799('0x41')](db[_0xe799('0x27')][_0xe799('0x28')]);_0x8fa5ab[_0xe799('0x2d')]=_[_0xe799('0x41')](_0x39139d[_0xe799('0x2d')]);_0x8fa5ab[_0xe799('0x2e')]=_[_0xe799('0x30')](_0x8fa5ab['model'],_0x8fa5ab[_0xe799('0x2d')]);_0x346b25[_0xe799('0x2f')]=_[_0xe799('0x30')](_0x8fa5ab[_0xe799('0x2c')],qs[_0xe799('0x31')](_0x39139d[_0xe799('0x2d')]['fields']));_0x346b25[_0xe799('0x2f')]=_0x346b25['attributes'][_0xe799('0x32')]?_0x346b25[_0xe799('0x2f')]:_0x8fa5ab[_0xe799('0x2c')];if(_0x39139d[_0xe799('0x2d')][_0xe799('0x3b')]){_0x346b25[_0xe799('0x3c')]=[{'all':!![]}];}_0x346b25=_[_0xe799('0x3a')]({},_0x346b25,_0x39139d[_0xe799('0x42')]);return db['SquareRecording'][_0xe799('0x43')](_0x346b25)[_0xe799('0x20')](handleEntityNotFound(_0x4f8585,null))[_0xe799('0x20')](respondWithResult(_0x4f8585,null))[_0xe799('0x3f')](handleError(_0x4f8585,null));};exports[_0xe799('0x44')]=function(_0x2ae9e3,_0x7df301){return db[_0xe799('0x27')][_0xe799('0x44')](_0x2ae9e3[_0xe799('0x45')],{})[_0xe799('0x20')](respondWithResult(_0x7df301,0xc9))[_0xe799('0x3f')](handleError(_0x7df301,null));};exports[_0xe799('0x46')]=function(_0x16b11d,_0xb4daa0){if(_0x16b11d[_0xe799('0x45')]['id']){delete _0x16b11d[_0xe799('0x45')]['id'];}return db[_0xe799('0x27')][_0xe799('0x43')]({'where':{'id':_0x16b11d[_0xe799('0x47')]['id']}})[_0xe799('0x20')](handleEntityNotFound(_0xb4daa0,null))[_0xe799('0x20')](saveUpdates(_0x16b11d[_0xe799('0x45')],null))[_0xe799('0x20')](respondWithResult(_0xb4daa0,null))[_0xe799('0x3f')](handleError(_0xb4daa0,null));};exports[_0xe799('0x48')]=function(_0x2ffca6,_0xf94ab0,_0x30f7ce){var _0x5ddd57=require(_0xe799('0x49'));var _0x2f47ee=![];var _0x2ca387={};if(_0x2ffca6[_0xe799('0x2d')][_0xe799('0x2a')]&&_0x2ffca6[_0xe799('0x2d')]['type']===_0xe799('0x4a')){_0x2ca387['uniqueid']=_0x2ffca6[_0xe799('0x47')]['id'];}else{_0x2ca387['id']=_0x2ffca6[_0xe799('0x47')]['id'];}return db['SquareRecording'][_0xe799('0x43')]({'where':_0x2ca387,'attributes':['id',_0xe799('0x4b'),'filename'],'raw':!![]})['then'](handleEntityNotFound(_0xf94ab0,null))['then'](function(_0x2dd987){if(_0x2dd987){var _0x42f00c=_0x2dd987[_0xe799('0x4b')];var _0x4a2a4c=util['format'](_0xe799('0x4c'),_0x42f00c);if(fs[_0xe799('0x4d')](_0x4a2a4c)){_0x2f47ee=!![];return _0x5ddd57['decryptFile'](_0x4a2a4c,_0x42f00c,config['secrets'][_0xe799('0x4e')])['then'](function(){return _0x2dd987;});}return _0x2dd987;}})['then'](function(_0x34e653){if(_0x34e653){var _0x514e51=_0x34e653[_0xe799('0x4b')];if(!fs[_0xe799('0x4d')](_0x514e51)){throw new db[(_0xe799('0x4f'))]['ValidationError'](_0xe799('0x50'));}if(_0x34e653[_0xe799('0x51')]){return _0xf94ab0[_0xe799('0x48')](_0x514e51,_0x34e653[_0xe799('0x51')]+path[_0xe799('0x52')](_0x514e51),function(){if(_0x2f47ee){fs[_0xe799('0x53')](_0x514e51);}});}else{return _0xf94ab0[_0xe799('0x48')](_0x514e51,function(_0x2de113){if(_0x2f47ee){fs[_0xe799('0x53')](_0x514e51);}});}}})[_0xe799('0x3f')](function(_0x58baac){if(_0x58baac[_0xe799('0x54')]==='SquareRecording\x20not\x20found'){_0xf94ab0[_0xe799('0x14')](0x194)[_0xe799('0x24')](_0xe799('0x55'));}else{return handleError(_0xf94ab0,null);}});};exports[_0xe799('0x56')]=function(_0x34c679,_0x14ad01){return db[_0xe799('0x27')][_0xe799('0x43')]({'where':{'id':_0x34c679[_0xe799('0x47')]['id']}})[_0xe799('0x20')](function(_0xa90c08){if(_[_0xe799('0x57')](_0xa90c08)){throw new ReferenceError(_0xe799('0x58'));}return _0xa90c08;})[_0xe799('0x20')](function(_0x3adfe7){var _0x337618=_0x3adfe7[_0xe799('0x4b')];logger[_0xe799('0x59')](_0xe799('0x5a'),_0x337618);if(!_[_0xe799('0x57')](_0x3adfe7[_0xe799('0x4b')])&&fs['existsSync'](_0x337618)){logger['info'](_0xe799('0x5b')+_0x337618+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe799('0x5c')](_0x337618);}_0x337618=_0x337618+'.cypher';if(!_[_0xe799('0x57')](_0x3adfe7[_0xe799('0x4b')])&&fs[_0xe799('0x4d')](_0x337618)){logger[_0xe799('0x59')]('File:\x20\x22'+_0x337618+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x337618);}return _0x3adfe7;})[_0xe799('0x20')](function(_0x2930da){if(!_0x2930da)throw new InternalError();return _0x2930da['destroy']();})['then'](function(){_0x14ad01[_0xe799('0x14')](0xcc)[_0xe799('0x15')]();})['catch'](handleError(_0x14ad01,null));}; \ No newline at end of file +var _0x2db9=['crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','json','apply','save','update','destroy','then','error','stack','name','send','map','SquareRecording','rawAttributes','fieldName','type','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','pick','merge','includeAll','include','findAll','params','options','find','catch','create','body','../../components/encryptor','savePath','filename','%s.cypher','decryptFile','recording','existsSync','ValidationError','download','unlink','message','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x1649fe,_0x5916da){var _0x473a67=function(_0x163cae){while(--_0x163cae){_0x1649fe['push'](_0x1649fe['shift']());}};_0x473a67(++_0x5916da);}(_0x2db9,0x169));var _0x92db=function(_0x4ec077,_0x3b2929){_0x4ec077=_0x4ec077-0x0;var _0x5ace8d=_0x2db9[_0x4ec077];return _0x5ace8d;};'use strict';var emlformat=require(_0x92db('0x0'));var rimraf=require(_0x92db('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x92db('0x2'));var rp=require(_0x92db('0x3'));var moment=require(_0x92db('0x4'));var BPromise=require(_0x92db('0x5'));var Mustache=require(_0x92db('0x6'));var util=require(_0x92db('0x7'));var path=require(_0x92db('0x8'));var sox=require(_0x92db('0x9'));var csv=require(_0x92db('0xa'));var ejs=require(_0x92db('0xb'));var fs=require('fs');var fs_extra=require(_0x92db('0xc'));var _=require(_0x92db('0xd'));var squel=require(_0x92db('0xe'));var crypto=require(_0x92db('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x92db('0x10'));var toCsv=require('to-csv');var querystring=require(_0x92db('0x11'));var Papa=require(_0x92db('0x12'));var Redis=require(_0x92db('0x13'));var authService=require(_0x92db('0x14'));var qs=require(_0x92db('0x15'));var as=require(_0x92db('0x16'));var hardwareService=require(_0x92db('0x17'));var logger=require(_0x92db('0x18'))(_0x92db('0x19'));var utils=require(_0x92db('0x1a'));var config=require(_0x92db('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x92db('0x1c'))['db'];function respondWithStatusCode(_0x440882,_0x51c426){_0x51c426=_0x51c426||0xcc;return function(_0x4bbfa4){if(_0x4bbfa4){return _0x440882[_0x92db('0x1d')](_0x51c426);}return _0x440882[_0x92db('0x1e')](_0x51c426)[_0x92db('0x1f')]();};}function respondWithResult(_0x3effb2,_0x1f1d81){_0x1f1d81=_0x1f1d81||0xc8;return function(_0x18a898){if(_0x18a898){return _0x3effb2[_0x92db('0x1e')](_0x1f1d81)['json'](_0x18a898);}};}function respondWithFilteredResult(_0x4afa3e,_0x3a1f4d){return function(_0x4b8172){if(_0x4b8172){var _0x3748a5=typeof _0x3a1f4d['offset']==='undefined'&&typeof _0x3a1f4d[_0x92db('0x20')]===_0x92db('0x21');var _0x2e8089=_0x4b8172[_0x92db('0x22')];var _0x20ca93=_0x3748a5?0x0:_0x3a1f4d['offset'];var _0x47af2b=_0x3748a5?_0x4b8172[_0x92db('0x22')]:_0x3a1f4d[_0x92db('0x23')]+_0x3a1f4d[_0x92db('0x20')];var _0x163d19;if(_0x47af2b>=_0x2e8089){_0x47af2b=_0x2e8089;_0x163d19=0xc8;}else{_0x163d19=0xce;}_0x4afa3e['status'](_0x163d19);return _0x4afa3e[_0x92db('0x24')]('Content-Range',_0x20ca93+'-'+_0x47af2b+'/'+_0x2e8089)[_0x92db('0x25')](_0x4b8172);}return null;};}function patchUpdates(_0xa0aafc){return function(_0x56fc4c){try{jsonpatch[_0x92db('0x26')](_0x56fc4c,_0xa0aafc,!![]);}catch(_0x36e13f){return BPromise['reject'](_0x36e13f);}return _0x56fc4c[_0x92db('0x27')]();};}function saveUpdates(_0x21ff60,_0x2061b9){return function(_0x1af176){if(_0x1af176){return _0x1af176[_0x92db('0x28')](_0x21ff60)['then'](function(_0x14e3b6){return _0x14e3b6;});}return null;};}function removeEntity(_0x21fc42,_0x540ef3){return function(_0x108735){if(_0x108735){return _0x108735[_0x92db('0x29')]()[_0x92db('0x2a')](function(){_0x21fc42[_0x92db('0x1e')](0xcc)[_0x92db('0x1f')]();});}};}function handleEntityNotFound(_0x896941,_0x398308){return function(_0x389383){if(!_0x389383){_0x896941[_0x92db('0x1d')](0x194);}return _0x389383;};}function handleError(_0x26d8d5,_0x48174c){_0x48174c=_0x48174c||0x1f4;return function(_0x4a4587){logger[_0x92db('0x2b')](_0x4a4587[_0x92db('0x2c')]);if(_0x4a4587[_0x92db('0x2d')]){delete _0x4a4587[_0x92db('0x2d')];}_0x26d8d5['status'](_0x48174c)[_0x92db('0x2e')](_0x4a4587);};}exports['index']=function(_0x282dd6,_0x4bd6ff){var _0x2c560e={},_0x3a9e8e={},_0x29face={'count':0x0,'rows':[]};var _0x4039a8=_[_0x92db('0x2f')](db[_0x92db('0x30')][_0x92db('0x31')],function(_0xbb2631){return{'name':_0xbb2631[_0x92db('0x32')],'type':_0xbb2631[_0x92db('0x33')]['key']};});_0x3a9e8e['model']=_[_0x92db('0x2f')](_0x4039a8,_0x92db('0x2d'));_0x3a9e8e[_0x92db('0x34')]=_[_0x92db('0x35')](_0x282dd6[_0x92db('0x34')]);_0x3a9e8e[_0x92db('0x36')]=_['intersection'](_0x3a9e8e['model'],_0x3a9e8e[_0x92db('0x34')]);_0x2c560e['attributes']=_[_0x92db('0x37')](_0x3a9e8e['model'],qs[_0x92db('0x38')](_0x282dd6[_0x92db('0x34')][_0x92db('0x38')]));_0x2c560e[_0x92db('0x39')]=_0x2c560e[_0x92db('0x39')][_0x92db('0x3a')]?_0x2c560e['attributes']:_0x3a9e8e[_0x92db('0x3b')];if(!_0x282dd6[_0x92db('0x34')][_0x92db('0x3c')](_0x92db('0x3d'))){_0x2c560e['limit']=qs[_0x92db('0x20')](_0x282dd6[_0x92db('0x34')][_0x92db('0x20')]);_0x2c560e[_0x92db('0x23')]=qs[_0x92db('0x23')](_0x282dd6[_0x92db('0x34')][_0x92db('0x23')]);}_0x2c560e[_0x92db('0x3e')]=qs[_0x92db('0x3f')](_0x282dd6['query'][_0x92db('0x3f')]);_0x2c560e[_0x92db('0x40')]=qs[_0x92db('0x36')](_[_0x92db('0x41')](_0x282dd6['query'],_0x3a9e8e[_0x92db('0x36')]),_0x4039a8);if(_0x282dd6['query']['filter']){_0x2c560e[_0x92db('0x40')]=_['merge'](_0x2c560e['where'],{'$or':_[_0x92db('0x2f')](_0x4039a8,function(_0xe9aa0d){if(_0xe9aa0d[_0x92db('0x33')]!=='VIRTUAL'){var _0x4a1fc1={};_0x4a1fc1[_0xe9aa0d[_0x92db('0x2d')]]={'$like':'%'+_0x282dd6['query']['filter']+'%'};return _0x4a1fc1;}})});}_0x2c560e=_[_0x92db('0x42')]({},_0x2c560e,_0x282dd6['options']);var _0x4b38e6={'where':_0x2c560e[_0x92db('0x40')]};return db[_0x92db('0x30')][_0x92db('0x22')](_0x4b38e6)[_0x92db('0x2a')](function(_0x4c03df){_0x29face['count']=_0x4c03df;if(_0x282dd6[_0x92db('0x34')][_0x92db('0x43')]){_0x2c560e[_0x92db('0x44')]=[{'all':!![]}];}return db[_0x92db('0x30')][_0x92db('0x45')](_0x2c560e);})['then'](function(_0x103589){_0x29face['rows']=_0x103589;return _0x29face;})['then'](respondWithFilteredResult(_0x4bd6ff,_0x2c560e))['catch'](handleError(_0x4bd6ff,null));};exports['show']=function(_0x302878,_0x4363d7){var _0x495ae1={'raw':!![],'where':{'id':_0x302878[_0x92db('0x46')]['id']}},_0x395e74={};_0x395e74[_0x92db('0x3b')]=_[_0x92db('0x35')](db[_0x92db('0x30')]['rawAttributes']);_0x395e74[_0x92db('0x34')]=_[_0x92db('0x35')](_0x302878[_0x92db('0x34')]);_0x395e74[_0x92db('0x36')]=_[_0x92db('0x37')](_0x395e74[_0x92db('0x3b')],_0x395e74['query']);_0x495ae1[_0x92db('0x39')]=_[_0x92db('0x37')](_0x395e74['model'],qs[_0x92db('0x38')](_0x302878['query']['fields']));_0x495ae1[_0x92db('0x39')]=_0x495ae1['attributes'][_0x92db('0x3a')]?_0x495ae1['attributes']:_0x395e74[_0x92db('0x3b')];if(_0x302878[_0x92db('0x34')]['includeAll']){_0x495ae1[_0x92db('0x44')]=[{'all':!![]}];}_0x495ae1=_[_0x92db('0x42')]({},_0x495ae1,_0x302878[_0x92db('0x47')]);return db[_0x92db('0x30')][_0x92db('0x48')](_0x495ae1)[_0x92db('0x2a')](handleEntityNotFound(_0x4363d7,null))[_0x92db('0x2a')](respondWithResult(_0x4363d7,null))[_0x92db('0x49')](handleError(_0x4363d7,null));};exports[_0x92db('0x4a')]=function(_0x1c6619,_0x19e204){return db[_0x92db('0x30')][_0x92db('0x4a')](_0x1c6619[_0x92db('0x4b')],{})[_0x92db('0x2a')](respondWithResult(_0x19e204,0xc9))['catch'](handleError(_0x19e204,null));};exports[_0x92db('0x28')]=function(_0x477686,_0x40abeb){if(_0x477686['body']['id']){delete _0x477686[_0x92db('0x4b')]['id'];}return db[_0x92db('0x30')]['find']({'where':{'id':_0x477686[_0x92db('0x46')]['id']}})[_0x92db('0x2a')](handleEntityNotFound(_0x40abeb,null))['then'](saveUpdates(_0x477686[_0x92db('0x4b')],null))[_0x92db('0x2a')](respondWithResult(_0x40abeb,null))[_0x92db('0x49')](handleError(_0x40abeb,null));};exports['download']=function(_0x506531,_0x20a8d2,_0x51f8aa){var _0x393b9b=require(_0x92db('0x4c'));var _0x6c11a=![];var _0x1d482f={};if(_0x506531[_0x92db('0x34')]['type']&&_0x506531[_0x92db('0x34')][_0x92db('0x33')]==='uniqueid'){_0x1d482f['uniqueid']=_0x506531[_0x92db('0x46')]['id'];}else{_0x1d482f['id']=_0x506531[_0x92db('0x46')]['id'];}return db[_0x92db('0x30')][_0x92db('0x48')]({'where':_0x1d482f,'attributes':['id',_0x92db('0x4d'),_0x92db('0x4e')],'raw':!![]})[_0x92db('0x2a')](handleEntityNotFound(_0x20a8d2,null))['then'](function(_0x4b4f1e){if(_0x4b4f1e){var _0x136c36=_0x4b4f1e[_0x92db('0x4d')];var _0x44619d=util['format'](_0x92db('0x4f'),_0x136c36);if(fs['existsSync'](_0x44619d)){_0x6c11a=!![];return _0x393b9b[_0x92db('0x50')](_0x44619d,_0x136c36,config['secrets'][_0x92db('0x51')])[_0x92db('0x2a')](function(){return _0x4b4f1e;});}return _0x4b4f1e;}})[_0x92db('0x2a')](function(_0x1883ad){if(_0x1883ad){var _0x3f9edf=_0x1883ad[_0x92db('0x4d')];if(!fs[_0x92db('0x52')](_0x3f9edf)){throw new db['Sequelize'][(_0x92db('0x53'))]('SquareRecording\x20not\x20found');}if(_0x1883ad[_0x92db('0x4e')]){return _0x20a8d2[_0x92db('0x54')](_0x3f9edf,_0x1883ad['filename']+path['extname'](_0x3f9edf),function(){if(_0x6c11a){fs[_0x92db('0x55')](_0x3f9edf);}});}else{return _0x20a8d2[_0x92db('0x54')](_0x3f9edf,function(_0x5e04ea){if(_0x6c11a){fs['unlink'](_0x3f9edf);}});}}})['catch'](function(_0xbdfac4){if(_0xbdfac4[_0x92db('0x56')]==='SquareRecording\x20not\x20found'){_0x20a8d2[_0x92db('0x1e')](0x194)['send'](_0x92db('0x57'));}else{return handleError(_0x20a8d2,null);}});};exports['destroy']=function(_0x14dd5a,_0x3e570b){return db[_0x92db('0x30')][_0x92db('0x48')]({'where':{'id':_0x14dd5a[_0x92db('0x46')]['id']}})[_0x92db('0x2a')](function(_0x646305){if(_[_0x92db('0x58')](_0x646305)){throw new ReferenceError('Entity\x20not\x20found');}return _0x646305;})[_0x92db('0x2a')](function(_0x305151){var _0x13319b=_0x305151[_0x92db('0x4d')];logger[_0x92db('0x59')]('cancellazione\x20fisica\x20documento\x20%s',_0x13319b);if(!_['isNil'](_0x305151[_0x92db('0x4d')])&&fs[_0x92db('0x52')](_0x13319b)){logger[_0x92db('0x59')](_0x92db('0x5a')+_0x13319b+_0x92db('0x5b'));fs[_0x92db('0x5c')](_0x13319b);}_0x13319b=_0x13319b+_0x92db('0x5d');if(!_[_0x92db('0x58')](_0x305151[_0x92db('0x4d')])&&fs[_0x92db('0x52')](_0x13319b)){logger[_0x92db('0x59')]('File:\x20\x22'+_0x13319b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x13319b);}return _0x305151;})['then'](function(_0x2541b2){if(!_0x2541b2)throw new InternalError();return _0x2541b2[_0x92db('0x29')]();})[_0x92db('0x2a')](function(){_0x3e570b[_0x92db('0x1e')](0xcc)['end']();})[_0x92db('0x49')](handleError(_0x3e570b,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index fe18a3e..33ef983 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 _0x71ab=['exports','define','SquareRecording','square_recordings','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes'];(function(_0x596199,_0x1eb398){var _0x5b98c3=function(_0x3ddb06){while(--_0x3ddb06){_0x596199['push'](_0x596199['shift']());}};_0x5b98c3(++_0x1eb398);}(_0x71ab,0x64));var _0xb71a=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x71ab[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));module[_0xb71a('0x8')]=function(_0x38d931,_0x22c072){return _0x38d931[_0xb71a('0x9')](_0xb71a('0xa'),attributes,{'tableName':_0xb71a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5c1=['bluebird','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','square_recordings','lodash','util','../../config/logger'];(function(_0x3e8285,_0x1ff5e4){var _0xe21112=function(_0xf395cc){while(--_0xf395cc){_0x3e8285['push'](_0x3e8285['shift']());}};_0xe21112(++_0x1ff5e4);}(_0xa5c1,0x19f));var _0x1a5c=function(_0x565012,_0x507412){_0x565012=_0x565012-0x0;var _0x91ebe5=_0xa5c1[_0x565012];return _0x91ebe5;};'use strict';var _=require(_0x1a5c('0x0'));var util=require(_0x1a5c('0x1'));var logger=require(_0x1a5c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1a5c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a5c('0x4'));var rimraf=require(_0x1a5c('0x5'));var config=require(_0x1a5c('0x6'));var attributes=require(_0x1a5c('0x7'));module[_0x1a5c('0x8')]=function(_0x3c3558,_0x4d7377){return _0x3c3558[_0x1a5c('0x9')]('SquareRecording',attributes,{'tableName':_0x1a5c('0xa'),'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 3f79431..e12102b 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 _0x6b63=['jayson/promise','client','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','create','body','options','raw','CreateSquareRecording','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x4b1d35,_0x1627ab){var _0x5d6bb7=function(_0x2f6b4f){while(--_0x2f6b4f){_0x4b1d35['push'](_0x4b1d35['shift']());}};_0x5d6bb7(++_0x1627ab);}(_0x6b63,0x19b));var _0x36b6=function(_0x4c7f56,_0x1c0086){_0x4c7f56=_0x4c7f56-0x0;var _0x4e030c=_0x6b63[_0x4c7f56];return _0x4e030c;};'use strict';var _=require(_0x36b6('0x0'));var util=require('util');var moment=require(_0x36b6('0x1'));var BPromise=require(_0x36b6('0x2'));var rs=require(_0x36b6('0x3'));var fs=require('fs');var Redis=require(_0x36b6('0x4'));var db=require(_0x36b6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x36b6('0x6'))(_0x36b6('0x7'));var config=require(_0x36b6('0x8'));var jayson=require(_0x36b6('0x9'));var client=jayson[_0x36b6('0xa')][_0x36b6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d8d77,_0x30e796,_0xfb11df){return new BPromise(function(_0x44cc1a,_0x104649){return client[_0x36b6('0xc')](_0x4d8d77,_0xfb11df)[_0x36b6('0xd')](function(_0xc4bb7b){logger['info'](_0x36b6('0xe'),_0x30e796,_0x36b6('0xf'));logger[_0x36b6('0x10')](_0x36b6('0x11'),_0x30e796,'request\x20sent',JSON[_0x36b6('0x12')](_0xc4bb7b));if(_0xc4bb7b[_0x36b6('0x13')]){if(_0xc4bb7b['error'][_0x36b6('0x14')]===0x1f4){logger[_0x36b6('0x13')](_0x36b6('0xe'),_0x30e796,_0xc4bb7b[_0x36b6('0x13')]['message']);return _0x104649(_0xc4bb7b[_0x36b6('0x13')]['message']);}logger[_0x36b6('0x13')](_0x36b6('0xe'),_0x30e796,_0xc4bb7b[_0x36b6('0x13')][_0x36b6('0x15')]);return _0x44cc1a(_0xc4bb7b[_0x36b6('0x13')][_0x36b6('0x15')]);}else{logger[_0x36b6('0x16')](_0x36b6('0xe'),_0x30e796,_0x36b6('0xf'));_0x44cc1a(_0xc4bb7b[_0x36b6('0x17')][_0x36b6('0x15')]);}})[_0x36b6('0x18')](function(_0x3eefa8){logger[_0x36b6('0x13')](_0x36b6('0xe'),_0x30e796,_0x3eefa8);_0x104649(_0x3eefa8);});});}exports['CreateSquareRecording']=function(_0x2e8ff0){var _0xc7429a=this;return new Promise(function(_0x357955,_0x3ed596){return db['SquareRecording'][_0x36b6('0x19')](_0x2e8ff0[_0x36b6('0x1a')],{'raw':_0x2e8ff0[_0x36b6('0x1b')]?_0x2e8ff0[_0x36b6('0x1b')][_0x36b6('0x1c')]===undefined?!![]:![]:!![]})[_0x36b6('0xd')](function(_0x3dee91){logger[_0x36b6('0x16')](_0x36b6('0x1d'),_0x2e8ff0);logger['debug'](_0x36b6('0x1d'),_0x2e8ff0,JSON[_0x36b6('0x12')](_0x3dee91));_0x357955(_0x3dee91);})['catch'](function(_0x2f9360){logger[_0x36b6('0x13')](_0x36b6('0x1d'),_0x2f9360['message'],_0x2e8ff0);_0x3ed596(_0xc7429a['error'](0x1f4,_0x2f9360['message']));});});}; \ No newline at end of file +var _0x46e4=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreateSquareRecording','SquareRecording','options','raw','info','lodash','util','moment','bluebird'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x46e4,0xce));var _0x446e=function(_0x57c501,_0x319f03){_0x57c501=_0x57c501-0x0;var _0x4f15ba=_0x46e4[_0x57c501];return _0x4f15ba;};'use strict';var _=require(_0x446e('0x0'));var util=require(_0x446e('0x1'));var moment=require(_0x446e('0x2'));var BPromise=require(_0x446e('0x3'));var rs=require(_0x446e('0x4'));var fs=require('fs');var Redis=require(_0x446e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x446e('0x6'));var logger=require(_0x446e('0x7'))(_0x446e('0x8'));var config=require(_0x446e('0x9'));var jayson=require(_0x446e('0xa'));var client=jayson[_0x446e('0xb')][_0x446e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x50692b,_0x240d85,_0x5c713c){return new BPromise(function(_0x53f333,_0xdd8616){return client[_0x446e('0xd')](_0x50692b,_0x5c713c)[_0x446e('0xe')](function(_0x5ba157){logger['info'](_0x446e('0xf'),_0x240d85,_0x446e('0x10'));logger[_0x446e('0x11')](_0x446e('0x12'),_0x240d85,'request\x20sent',JSON[_0x446e('0x13')](_0x5ba157));if(_0x5ba157['error']){if(_0x5ba157['error'][_0x446e('0x14')]===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x240d85,_0x5ba157[_0x446e('0x15')][_0x446e('0x16')]);return _0xdd8616(_0x5ba157['error'][_0x446e('0x16')]);}logger[_0x446e('0x15')](_0x446e('0xf'),_0x240d85,_0x5ba157[_0x446e('0x15')][_0x446e('0x16')]);return _0x53f333(_0x5ba157[_0x446e('0x15')][_0x446e('0x16')]);}else{logger['info'](_0x446e('0xf'),_0x240d85,'request\x20sent');_0x53f333(_0x5ba157[_0x446e('0x17')][_0x446e('0x16')]);}})[_0x446e('0x18')](function(_0x4f77bf){logger[_0x446e('0x15')]('SquareRecording,\x20%s,\x20%s',_0x240d85,_0x4f77bf);_0xdd8616(_0x4f77bf);});});}exports[_0x446e('0x19')]=function(_0x44f317){var _0x4ca77a=this;return new Promise(function(_0x1efe98,_0x4d717c){return db[_0x446e('0x1a')]['create'](_0x44f317['body'],{'raw':_0x44f317[_0x446e('0x1b')]?_0x44f317[_0x446e('0x1b')][_0x446e('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x4d7d4b){logger[_0x446e('0x1d')](_0x446e('0x19'),_0x44f317);logger[_0x446e('0x11')](_0x446e('0x19'),_0x44f317,JSON[_0x446e('0x13')](_0x4d7d4b));_0x1efe98(_0x4d7d4b);})[_0x446e('0x18')](function(_0x17d3ac){logger[_0x446e('0x15')](_0x446e('0x19'),_0x17d3ac['message'],_0x44f317);_0x4d717c(_0x4ca77a[_0x446e('0x15')](0x1f4,_0x17d3ac[_0x446e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 842e0f2..e5f7220 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(_0x354b22,_0x343f43){var _0x231019=function(_0x584ef9){while(--_0x584ef9){_0x354b22['push'](_0x354b22['shift']());}};_0x231019(++_0x343f43);}(_0xe706,0xa3));var _0x6e70=function(_0x4ed32d,_0x327695){_0x4ed32d=_0x4ed32d-0x0;var _0xf624df=_0xe706[_0x4ed32d];return _0xf624df;};'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 _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(_0x3db622,_0x14e98b){var _0x37d2ee=function(_0x51b487){while(--_0x51b487){_0x3db622['push'](_0x3db622['shift']());}};_0x37d2ee(++_0x14e98b);}(_0xe706,0xa3));var _0x6e70=function(_0x403c57,_0x280a51){_0x403c57=_0x403c57-0x0;var _0x35fa69=_0xe706[_0x403c57];return _0x35fa69;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index e914680..8c0ba5c 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 _0x76aa=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x2773ec,_0x2a5eef){var _0x235e68=function(_0x100f71){while(--_0x100f71){_0x2773ec['push'](_0x2773ec['shift']());}};_0x235e68(++_0x2a5eef);}(_0x76aa,0x131));var _0xa76a=function(_0x2b990c,_0x43cbcd){_0x2b990c=_0x2b990c-0x0;var _0x1b08f8=_0x76aa[_0x2b990c];return _0x1b08f8;};'use strict';var Sequelize=require(_0xa76a('0x0'));module[_0xa76a('0x1')]={'network':{'type':Sequelize[_0xa76a('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xa76a('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa76a('0x2')]},'type':{'type':Sequelize[_0xa76a('0x2')]},'uniqueid':{'type':Sequelize[_0xa76a('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xa76a('0x2')]},'callingpres':{'type':Sequelize[_0xa76a('0x2')]},'callingani2':{'type':Sequelize[_0xa76a('0x2')]},'callington':{'type':Sequelize[_0xa76a('0x2')]},'callingtns':{'type':Sequelize[_0xa76a('0x2')]},'dnid':{'type':Sequelize[_0xa76a('0x2')]},'rdnis':{'type':Sequelize[_0xa76a('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa76a('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa76a('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xa76a('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa76a('0x3')]},'bot':{'type':Sequelize[_0xa76a('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xa3f0=['sequelize','STRING','DATE'];(function(_0x3b794b,_0x325186){var _0x2a9fa3=function(_0x5f3427){while(--_0x5f3427){_0x3b794b['push'](_0x3b794b['shift']());}};_0x2a9fa3(++_0x325186);}(_0xa3f0,0x1ad));var _0x0a3f=function(_0x770f7,_0x3af003){_0x770f7=_0x770f7-0x0;var _0xe797c6=_0xa3f0[_0x770f7];return _0xe797c6;};'use strict';var Sequelize=require(_0x0a3f('0x0'));module['exports']={'network':{'type':Sequelize[_0x0a3f('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x0a3f('0x1')]},'channel':{'type':Sequelize[_0x0a3f('0x1')]},'language':{'type':Sequelize[_0x0a3f('0x1')]},'type':{'type':Sequelize[_0x0a3f('0x1')]},'uniqueid':{'type':Sequelize[_0x0a3f('0x1')]},'version':{'type':Sequelize[_0x0a3f('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0a3f('0x1')]},'callingpres':{'type':Sequelize[_0x0a3f('0x1')]},'callingani2':{'type':Sequelize[_0x0a3f('0x1')]},'callington':{'type':Sequelize[_0x0a3f('0x1')]},'callingtns':{'type':Sequelize[_0x0a3f('0x1')]},'dnid':{'type':Sequelize[_0x0a3f('0x1')]},'rdnis':{'type':Sequelize[_0x0a3f('0x1')]},'context':{'type':Sequelize[_0x0a3f('0x1')]},'extension':{'type':Sequelize[_0x0a3f('0x1')]},'priority':{'type':Sequelize[_0x0a3f('0x1')]},'enhanced':{'type':Sequelize[_0x0a3f('0x1')]},'accountcode':{'type':Sequelize[_0x0a3f('0x1')]},'threadid':{'type':Sequelize[_0x0a3f('0x1')]},'project_name':{'type':Sequelize[_0x0a3f('0x1')]},'joinAt':{'type':Sequelize[_0x0a3f('0x2')]},'leaveAt':{'type':Sequelize[_0x0a3f('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 93fcf25..98ca5b8 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 _0x846f=['lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','reject','save','update','then','destroy','error','stack','name','send','index','SquareReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0x42a829,_0x430ec9){var _0x3159ff=function(_0x30cb9d){while(--_0x30cb9d){_0x42a829['push'](_0x42a829['shift']());}};_0x3159ff(++_0x430ec9);}(_0x846f,0x1b6));var _0xf846=function(_0x89b469,_0x4efc9d){_0x89b469=_0x89b469-0x0;var _0x41fee9=_0x846f[_0x89b469];return _0x41fee9;};'use strict';var emlformat=require(_0xf846('0x0'));var rimraf=require(_0xf846('0x1'));var zipdir=require(_0xf846('0x2'));var jsonpatch=require(_0xf846('0x3'));var rp=require('request-promise');var moment=require(_0xf846('0x4'));var BPromise=require(_0xf846('0x5'));var Mustache=require(_0xf846('0x6'));var util=require(_0xf846('0x7'));var path=require(_0xf846('0x8'));var sox=require('sox');var csv=require(_0xf846('0x9'));var ejs=require(_0xf846('0xa'));var fs=require('fs');var fs_extra=require(_0xf846('0xb'));var _=require(_0xf846('0xc'));var squel=require(_0xf846('0xd'));var crypto=require('crypto');var jsforce=require(_0xf846('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf846('0x9'));var querystring=require(_0xf846('0xf'));var Papa=require(_0xf846('0x10'));var Redis=require(_0xf846('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf846('0x12'));var as=require(_0xf846('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf846('0x14'))(_0xf846('0x15'));var utils=require('../../config/utils');var config=require(_0xf846('0x16'));var licenseUtil=require(_0xf846('0x17'));var db=require(_0xf846('0x18'))['db'];function respondWithStatusCode(_0x2c20eb,_0x8b37a){_0x8b37a=_0x8b37a||0xcc;return function(_0x56a3a8){if(_0x56a3a8){return _0x2c20eb[_0xf846('0x19')](_0x8b37a);}return _0x2c20eb[_0xf846('0x1a')](_0x8b37a)[_0xf846('0x1b')]();};}function respondWithResult(_0x11051d,_0x364af3){_0x364af3=_0x364af3||0xc8;return function(_0xae1cb4){if(_0xae1cb4){return _0x11051d['status'](_0x364af3)[_0xf846('0x1c')](_0xae1cb4);}};}function respondWithFilteredResult(_0x434d96,_0x192dc6){return function(_0x42585d){if(_0x42585d){var _0x1d7bca=typeof _0x192dc6['offset']===_0xf846('0x1d')&&typeof _0x192dc6[_0xf846('0x1e')]==='undefined';var _0x4e9ebe=_0x42585d[_0xf846('0x1f')];var _0x3b0bd9=_0x1d7bca?0x0:_0x192dc6[_0xf846('0x20')];var _0x4d6718=_0x1d7bca?_0x42585d['count']:_0x192dc6['offset']+_0x192dc6[_0xf846('0x1e')];var _0x21f815;if(_0x4d6718>=_0x4e9ebe){_0x4d6718=_0x4e9ebe;_0x21f815=0xc8;}else{_0x21f815=0xce;}_0x434d96[_0xf846('0x1a')](_0x21f815);return _0x434d96['set']('Content-Range',_0x3b0bd9+'-'+_0x4d6718+'/'+_0x4e9ebe)[_0xf846('0x1c')](_0x42585d);}return null;};}function patchUpdates(_0x14340f){return function(_0x3e4628){try{jsonpatch['apply'](_0x3e4628,_0x14340f,!![]);}catch(_0x208b52){return BPromise[_0xf846('0x21')](_0x208b52);}return _0x3e4628[_0xf846('0x22')]();};}function saveUpdates(_0x309f1d,_0x269a79){return function(_0x5471a1){if(_0x5471a1){return _0x5471a1[_0xf846('0x23')](_0x309f1d)[_0xf846('0x24')](function(_0x4baf5b){return _0x4baf5b;});}return null;};}function removeEntity(_0x35359b,_0x56b029){return function(_0x6307bb){if(_0x6307bb){return _0x6307bb[_0xf846('0x25')]()[_0xf846('0x24')](function(){_0x35359b[_0xf846('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c2e3c,_0x38b066){return function(_0x56a04b){if(!_0x56a04b){_0x1c2e3c[_0xf846('0x19')](0x194);}return _0x56a04b;};}function handleError(_0x42fe51,_0x2a5d82){_0x2a5d82=_0x2a5d82||0x1f4;return function(_0x213712){logger[_0xf846('0x26')](_0x213712[_0xf846('0x27')]);if(_0x213712[_0xf846('0x28')]){delete _0x213712[_0xf846('0x28')];}_0x42fe51[_0xf846('0x1a')](_0x2a5d82)[_0xf846('0x29')](_0x213712);};}exports[_0xf846('0x2a')]=function(_0x4c3085,_0x140354){var _0x22f3a3={},_0x50e63f={},_0x3b1354={'count':0x0,'rows':[]};var _0x377a41=_['map'](db[_0xf846('0x2b')][_0xf846('0x2c')],function(_0x25a3ef){return{'name':_0x25a3ef[_0xf846('0x2d')],'type':_0x25a3ef[_0xf846('0x2e')][_0xf846('0x2f')]};});_0x50e63f[_0xf846('0x30')]=_['map'](_0x377a41,_0xf846('0x28'));_0x50e63f['query']=_[_0xf846('0x31')](_0x4c3085[_0xf846('0x32')]);_0x50e63f[_0xf846('0x33')]=_[_0xf846('0x34')](_0x50e63f[_0xf846('0x30')],_0x50e63f['query']);_0x22f3a3[_0xf846('0x35')]=_[_0xf846('0x34')](_0x50e63f['model'],qs[_0xf846('0x36')](_0x4c3085['query'][_0xf846('0x36')]));_0x22f3a3[_0xf846('0x35')]=_0x22f3a3[_0xf846('0x35')][_0xf846('0x37')]?_0x22f3a3['attributes']:_0x50e63f[_0xf846('0x30')];if(!_0x4c3085[_0xf846('0x32')]['hasOwnProperty']('nolimit')){_0x22f3a3[_0xf846('0x1e')]=qs[_0xf846('0x1e')](_0x4c3085[_0xf846('0x32')][_0xf846('0x1e')]);_0x22f3a3[_0xf846('0x20')]=qs[_0xf846('0x20')](_0x4c3085[_0xf846('0x32')]['offset']);}_0x22f3a3[_0xf846('0x38')]=qs['sort'](_0x4c3085[_0xf846('0x32')][_0xf846('0x39')]);_0x22f3a3[_0xf846('0x3a')]=qs[_0xf846('0x33')](_['pick'](_0x4c3085[_0xf846('0x32')],_0x50e63f[_0xf846('0x33')]),_0x377a41);if(_0x4c3085[_0xf846('0x32')][_0xf846('0x3b')]){_0x22f3a3[_0xf846('0x3a')]=_['merge'](_0x22f3a3['where'],{'$or':_[_0xf846('0x3c')](_0x377a41,function(_0x20f4f7){if(_0x20f4f7[_0xf846('0x2e')]!==_0xf846('0x3d')){var _0x145792={};_0x145792[_0x20f4f7[_0xf846('0x28')]]={'$like':'%'+_0x4c3085[_0xf846('0x32')][_0xf846('0x3b')]+'%'};return _0x145792;}})});}_0x22f3a3=_[_0xf846('0x3e')]({},_0x22f3a3,_0x4c3085[_0xf846('0x3f')]);var _0x539432={'where':_0x22f3a3['where']};return db[_0xf846('0x2b')][_0xf846('0x1f')](_0x539432)[_0xf846('0x24')](function(_0x170a49){_0x3b1354['count']=_0x170a49;if(_0x4c3085[_0xf846('0x32')][_0xf846('0x40')]){_0x22f3a3[_0xf846('0x41')]=[{'all':!![]}];}return db[_0xf846('0x2b')][_0xf846('0x42')](_0x22f3a3);})['then'](function(_0x2fdbb1){_0x3b1354[_0xf846('0x43')]=_0x2fdbb1;return _0x3b1354;})[_0xf846('0x24')](respondWithFilteredResult(_0x140354,_0x22f3a3))[_0xf846('0x44')](handleError(_0x140354,null));};exports[_0xf846('0x45')]=function(_0x4e3def,_0x582f20){var _0x49f16a={'raw':!![],'where':{'id':_0x4e3def[_0xf846('0x46')]['id']}},_0x5b7a1c={};_0x5b7a1c[_0xf846('0x30')]=_[_0xf846('0x31')](db[_0xf846('0x2b')][_0xf846('0x2c')]);_0x5b7a1c[_0xf846('0x32')]=_[_0xf846('0x31')](_0x4e3def['query']);_0x5b7a1c[_0xf846('0x33')]=_[_0xf846('0x34')](_0x5b7a1c[_0xf846('0x30')],_0x5b7a1c[_0xf846('0x32')]);_0x49f16a[_0xf846('0x35')]=_[_0xf846('0x34')](_0x5b7a1c[_0xf846('0x30')],qs[_0xf846('0x36')](_0x4e3def['query'][_0xf846('0x36')]));_0x49f16a[_0xf846('0x35')]=_0x49f16a['attributes'][_0xf846('0x37')]?_0x49f16a[_0xf846('0x35')]:_0x5b7a1c[_0xf846('0x30')];if(_0x4e3def[_0xf846('0x32')][_0xf846('0x40')]){_0x49f16a[_0xf846('0x41')]=[{'all':!![]}];}_0x49f16a=_[_0xf846('0x3e')]({},_0x49f16a,_0x4e3def[_0xf846('0x3f')]);return db['SquareReport'][_0xf846('0x47')](_0x49f16a)[_0xf846('0x24')](handleEntityNotFound(_0x582f20,null))[_0xf846('0x24')](respondWithResult(_0x582f20,null))[_0xf846('0x44')](handleError(_0x582f20,null));};exports[_0xf846('0x48')]=function(_0x4cd5e8,_0x4cc62c){return db[_0xf846('0x2b')][_0xf846('0x48')](_0x4cd5e8[_0xf846('0x49')],{})[_0xf846('0x24')](respondWithResult(_0x4cc62c,0xc9))[_0xf846('0x44')](handleError(_0x4cc62c,null));};exports[_0xf846('0x23')]=function(_0x56bd60,_0x249620){if(_0x56bd60['body']['id']){delete _0x56bd60[_0xf846('0x49')]['id'];}return db[_0xf846('0x2b')][_0xf846('0x47')]({'where':{'id':_0x56bd60[_0xf846('0x46')]['id']}})['then'](handleEntityNotFound(_0x249620,null))[_0xf846('0x24')](saveUpdates(_0x56bd60[_0xf846('0x49')],null))['then'](respondWithResult(_0x249620,null))[_0xf846('0x44')](handleError(_0x249620,null));};exports[_0xf846('0x25')]=function(_0x25df6f,_0x20bceb){return db['SquareReport'][_0xf846('0x47')]({'where':{'id':_0x25df6f[_0xf846('0x46')]['id']}})['then'](handleEntityNotFound(_0x20bceb,null))[_0xf846('0x24')](removeEntity(_0x20bceb,null))[_0xf846('0x44')](handleError(_0x20bceb,null));};exports[_0xf846('0x4a')]=function(_0xa507c4,_0x2714dd){return db[_0xf846('0x2b')][_0xf846('0x4a')]()[_0xf846('0x24')](respondWithResult(_0x2714dd,null))['catch'](handleError(_0x2714dd,null));}; \ No newline at end of file +var _0xc6c0=['include','find','catch','create','body','update','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','limit','undefined','count','offset','set','json','apply','reject','save','then','destroy','status','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','rows','show','keys'];(function(_0x1ca846,_0x5e6cdf){var _0x1e523d=function(_0x2cd9a2){while(--_0x2cd9a2){_0x1ca846['push'](_0x1ca846['shift']());}};_0x1e523d(++_0x5e6cdf);}(_0xc6c0,0x1d5));var _0x0c6c=function(_0x2f4c1c,_0x5a3dd4){_0x2f4c1c=_0x2f4c1c-0x0;var _0x25e0f2=_0xc6c0[_0x2f4c1c];return _0x25e0f2;};'use strict';var emlformat=require(_0x0c6c('0x0'));var rimraf=require(_0x0c6c('0x1'));var zipdir=require(_0x0c6c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0c6c('0x3'));var moment=require(_0x0c6c('0x4'));var BPromise=require(_0x0c6c('0x5'));var Mustache=require(_0x0c6c('0x6'));var util=require(_0x0c6c('0x7'));var path=require(_0x0c6c('0x8'));var sox=require(_0x0c6c('0x9'));var csv=require(_0x0c6c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0c6c('0xb'));var _=require(_0x0c6c('0xc'));var squel=require(_0x0c6c('0xd'));var crypto=require(_0x0c6c('0xe'));var jsforce=require(_0x0c6c('0xf'));var deskjs=require(_0x0c6c('0x10'));var toCsv=require(_0x0c6c('0xa'));var querystring=require('querystring');var Papa=require(_0x0c6c('0x11'));var Redis=require(_0x0c6c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0c6c('0x13'));var as=require(_0x0c6c('0x14'));var hardwareService=require(_0x0c6c('0x15'));var logger=require(_0x0c6c('0x16'))(_0x0c6c('0x17'));var utils=require(_0x0c6c('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x0c6c('0x19'));var db=require(_0x0c6c('0x1a'))['db'];function respondWithStatusCode(_0x41b71c,_0x8aef05){_0x8aef05=_0x8aef05||0xcc;return function(_0x321270){if(_0x321270){return _0x41b71c[_0x0c6c('0x1b')](_0x8aef05);}return _0x41b71c['status'](_0x8aef05)[_0x0c6c('0x1c')]();};}function respondWithResult(_0x43ebf0,_0x609683){_0x609683=_0x609683||0xc8;return function(_0x263d4d){if(_0x263d4d){return _0x43ebf0['status'](_0x609683)['json'](_0x263d4d);}};}function respondWithFilteredResult(_0x13926f,_0x3af5cb){return function(_0xfc010a){if(_0xfc010a){var _0x1aa854=typeof _0x3af5cb['offset']==='undefined'&&typeof _0x3af5cb[_0x0c6c('0x1d')]===_0x0c6c('0x1e');var _0x58c9c0=_0xfc010a[_0x0c6c('0x1f')];var _0x323cd0=_0x1aa854?0x0:_0x3af5cb[_0x0c6c('0x20')];var _0xf94bf2=_0x1aa854?_0xfc010a['count']:_0x3af5cb[_0x0c6c('0x20')]+_0x3af5cb[_0x0c6c('0x1d')];var _0x13872e;if(_0xf94bf2>=_0x58c9c0){_0xf94bf2=_0x58c9c0;_0x13872e=0xc8;}else{_0x13872e=0xce;}_0x13926f['status'](_0x13872e);return _0x13926f[_0x0c6c('0x21')]('Content-Range',_0x323cd0+'-'+_0xf94bf2+'/'+_0x58c9c0)[_0x0c6c('0x22')](_0xfc010a);}return null;};}function patchUpdates(_0x1d5d14){return function(_0x16ba2c){try{jsonpatch[_0x0c6c('0x23')](_0x16ba2c,_0x1d5d14,!![]);}catch(_0x570c08){return BPromise[_0x0c6c('0x24')](_0x570c08);}return _0x16ba2c[_0x0c6c('0x25')]();};}function saveUpdates(_0xb871c5,_0x22fa59){return function(_0x39d306){if(_0x39d306){return _0x39d306['update'](_0xb871c5)[_0x0c6c('0x26')](function(_0x341f88){return _0x341f88;});}return null;};}function removeEntity(_0x27e921,_0x3ae3be){return function(_0x40aad7){if(_0x40aad7){return _0x40aad7[_0x0c6c('0x27')]()[_0x0c6c('0x26')](function(){_0x27e921[_0x0c6c('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5816fa,_0x5ccadf){return function(_0x27ce95){if(!_0x27ce95){_0x5816fa[_0x0c6c('0x1b')](0x194);}return _0x27ce95;};}function handleError(_0x359756,_0xfd7777){_0xfd7777=_0xfd7777||0x1f4;return function(_0x31cdbd){logger[_0x0c6c('0x29')](_0x31cdbd[_0x0c6c('0x2a')]);if(_0x31cdbd[_0x0c6c('0x2b')]){delete _0x31cdbd[_0x0c6c('0x2b')];}_0x359756[_0x0c6c('0x28')](_0xfd7777)[_0x0c6c('0x2c')](_0x31cdbd);};}exports[_0x0c6c('0x2d')]=function(_0x58b284,_0x509311){var _0x9e3f89={},_0x1462e7={},_0x27fdfb={'count':0x0,'rows':[]};var _0x5e5a30=_[_0x0c6c('0x2e')](db[_0x0c6c('0x2f')][_0x0c6c('0x30')],function(_0x13797d){return{'name':_0x13797d[_0x0c6c('0x31')],'type':_0x13797d[_0x0c6c('0x32')]['key']};});_0x1462e7[_0x0c6c('0x33')]=_[_0x0c6c('0x2e')](_0x5e5a30,_0x0c6c('0x2b'));_0x1462e7[_0x0c6c('0x34')]=_['keys'](_0x58b284[_0x0c6c('0x34')]);_0x1462e7[_0x0c6c('0x35')]=_[_0x0c6c('0x36')](_0x1462e7['model'],_0x1462e7['query']);_0x9e3f89[_0x0c6c('0x37')]=_['intersection'](_0x1462e7[_0x0c6c('0x33')],qs[_0x0c6c('0x38')](_0x58b284[_0x0c6c('0x34')][_0x0c6c('0x38')]));_0x9e3f89[_0x0c6c('0x37')]=_0x9e3f89[_0x0c6c('0x37')][_0x0c6c('0x39')]?_0x9e3f89[_0x0c6c('0x37')]:_0x1462e7[_0x0c6c('0x33')];if(!_0x58b284[_0x0c6c('0x34')][_0x0c6c('0x3a')](_0x0c6c('0x3b'))){_0x9e3f89[_0x0c6c('0x1d')]=qs[_0x0c6c('0x1d')](_0x58b284[_0x0c6c('0x34')][_0x0c6c('0x1d')]);_0x9e3f89[_0x0c6c('0x20')]=qs[_0x0c6c('0x20')](_0x58b284[_0x0c6c('0x34')][_0x0c6c('0x20')]);}_0x9e3f89[_0x0c6c('0x3c')]=qs[_0x0c6c('0x3d')](_0x58b284['query'][_0x0c6c('0x3d')]);_0x9e3f89[_0x0c6c('0x3e')]=qs[_0x0c6c('0x35')](_['pick'](_0x58b284['query'],_0x1462e7[_0x0c6c('0x35')]),_0x5e5a30);if(_0x58b284['query']['filter']){_0x9e3f89['where']=_[_0x0c6c('0x3f')](_0x9e3f89[_0x0c6c('0x3e')],{'$or':_[_0x0c6c('0x2e')](_0x5e5a30,function(_0x4cb871){if(_0x4cb871[_0x0c6c('0x32')]!==_0x0c6c('0x40')){var _0x42a9cf={};_0x42a9cf[_0x4cb871[_0x0c6c('0x2b')]]={'$like':'%'+_0x58b284[_0x0c6c('0x34')]['filter']+'%'};return _0x42a9cf;}})});}_0x9e3f89=_[_0x0c6c('0x3f')]({},_0x9e3f89,_0x58b284[_0x0c6c('0x41')]);var _0x5dfceb={'where':_0x9e3f89[_0x0c6c('0x3e')]};return db[_0x0c6c('0x2f')]['count'](_0x5dfceb)[_0x0c6c('0x26')](function(_0x262ea6){_0x27fdfb[_0x0c6c('0x1f')]=_0x262ea6;if(_0x58b284[_0x0c6c('0x34')][_0x0c6c('0x42')]){_0x9e3f89['include']=[{'all':!![]}];}return db[_0x0c6c('0x2f')]['findAll'](_0x9e3f89);})[_0x0c6c('0x26')](function(_0x36dac1){_0x27fdfb[_0x0c6c('0x43')]=_0x36dac1;return _0x27fdfb;})[_0x0c6c('0x26')](respondWithFilteredResult(_0x509311,_0x9e3f89))['catch'](handleError(_0x509311,null));};exports[_0x0c6c('0x44')]=function(_0x31d3f2,_0x421e16){var _0x286033={'raw':!![],'where':{'id':_0x31d3f2['params']['id']}},_0x5d3212={};_0x5d3212[_0x0c6c('0x33')]=_['keys'](db[_0x0c6c('0x2f')][_0x0c6c('0x30')]);_0x5d3212[_0x0c6c('0x34')]=_[_0x0c6c('0x45')](_0x31d3f2[_0x0c6c('0x34')]);_0x5d3212[_0x0c6c('0x35')]=_['intersection'](_0x5d3212['model'],_0x5d3212[_0x0c6c('0x34')]);_0x286033['attributes']=_[_0x0c6c('0x36')](_0x5d3212['model'],qs[_0x0c6c('0x38')](_0x31d3f2[_0x0c6c('0x34')]['fields']));_0x286033[_0x0c6c('0x37')]=_0x286033['attributes']['length']?_0x286033['attributes']:_0x5d3212[_0x0c6c('0x33')];if(_0x31d3f2[_0x0c6c('0x34')][_0x0c6c('0x42')]){_0x286033[_0x0c6c('0x46')]=[{'all':!![]}];}_0x286033=_['merge']({},_0x286033,_0x31d3f2[_0x0c6c('0x41')]);return db[_0x0c6c('0x2f')][_0x0c6c('0x47')](_0x286033)[_0x0c6c('0x26')](handleEntityNotFound(_0x421e16,null))[_0x0c6c('0x26')](respondWithResult(_0x421e16,null))[_0x0c6c('0x48')](handleError(_0x421e16,null));};exports[_0x0c6c('0x49')]=function(_0x2f1555,_0x4cd7b7){return db[_0x0c6c('0x2f')][_0x0c6c('0x49')](_0x2f1555[_0x0c6c('0x4a')],{})[_0x0c6c('0x26')](respondWithResult(_0x4cd7b7,0xc9))['catch'](handleError(_0x4cd7b7,null));};exports[_0x0c6c('0x4b')]=function(_0x1added,_0x137b3a){if(_0x1added[_0x0c6c('0x4a')]['id']){delete _0x1added[_0x0c6c('0x4a')]['id'];}return db[_0x0c6c('0x2f')][_0x0c6c('0x47')]({'where':{'id':_0x1added[_0x0c6c('0x4c')]['id']}})[_0x0c6c('0x26')](handleEntityNotFound(_0x137b3a,null))['then'](saveUpdates(_0x1added['body'],null))[_0x0c6c('0x26')](respondWithResult(_0x137b3a,null))[_0x0c6c('0x48')](handleError(_0x137b3a,null));};exports[_0x0c6c('0x27')]=function(_0x204299,_0x32c202){return db[_0x0c6c('0x2f')]['find']({'where':{'id':_0x204299[_0x0c6c('0x4c')]['id']}})[_0x0c6c('0x26')](handleEntityNotFound(_0x32c202,null))[_0x0c6c('0x26')](removeEntity(_0x32c202,null))[_0x0c6c('0x48')](handleError(_0x32c202,null));};exports['describe']=function(_0x5c6f35,_0x18b8eb){return db[_0x0c6c('0x2f')]['describe']()[_0x0c6c('0x26')](respondWithResult(_0x18b8eb,null))[_0x0c6c('0x48')](handleError(_0x18b8eb,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 25b3ddc..1a0149b 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 _0xcbdb=['rimraf','../../config/environment','./squareReport.attributes','define','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2f4363,_0x24a102){var _0x318201=function(_0x4931c4){while(--_0x4931c4){_0x2f4363['push'](_0x2f4363['shift']());}};_0x318201(++_0x24a102);}(_0xcbdb,0x69));var _0xbcbd=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xcbdb[_0x257642];return _0x3d813b;};'use strict';var _=require(_0xbcbd('0x0'));var util=require('util');var logger=require(_0xbcbd('0x1'))(_0xbcbd('0x2'));var moment=require(_0xbcbd('0x3'));var BPromise=require(_0xbcbd('0x4'));var rp=require(_0xbcbd('0x5'));var fs=require('fs');var path=require(_0xbcbd('0x6'));var rimraf=require(_0xbcbd('0x7'));var config=require(_0xbcbd('0x8'));var attributes=require(_0xbcbd('0x9'));module['exports']=function(_0x85408d,_0x20643f){return _0x85408d[_0xbcbd('0xa')]('SquareReport',attributes,{'tableName':_0xbcbd('0xb'),'paranoid':![],'indexes':[{'name':_0xbcbd('0xc'),'fields':[_0xbcbd('0xd'),_0xbcbd('0xe')]},{'name':_0xbcbd('0xf'),'fields':[_0xbcbd('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb805=['path','../../config/environment','./squareReport.attributes','exports','SquareReport','report_square','uniqueid','project_name','leaveAt','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x13f6fe,_0x4864c0){var _0x49aafb=function(_0x61e319){while(--_0x61e319){_0x13f6fe['push'](_0x13f6fe['shift']());}};_0x49aafb(++_0x4864c0);}(_0xb805,0x72));var _0x5b80=function(_0x487252,_0x51cd99){_0x487252=_0x487252-0x0;var _0x472e06=_0xb805[_0x487252];return _0x472e06;};'use strict';var _=require(_0x5b80('0x0'));var util=require('util');var logger=require(_0x5b80('0x1'))(_0x5b80('0x2'));var moment=require(_0x5b80('0x3'));var BPromise=require(_0x5b80('0x4'));var rp=require(_0x5b80('0x5'));var fs=require('fs');var path=require(_0x5b80('0x6'));var rimraf=require('rimraf');var config=require(_0x5b80('0x7'));var attributes=require(_0x5b80('0x8'));module[_0x5b80('0x9')]=function(_0x5159fb,_0x4dcaf5){return _0x5159fb['define'](_0x5b80('0xa'),attributes,{'tableName':_0x5b80('0xb'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x5b80('0xc'),_0x5b80('0xd')]},{'name':_0x5b80('0xe'),'fields':[_0x5b80('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index ef36cc3..195dfaa 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 _0x729c=['raw','CreateSquareReport','catch','SquareReport','update','where','attributes','limit','UpdateSquareReport','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','info','SquareReport,\x20%s,\x20%s','debug','stringify','code','error','message','request\x20sent','create','body','options'];(function(_0x4cdcea,_0x551728){var _0x335949=function(_0x2e1288){while(--_0x2e1288){_0x4cdcea['push'](_0x4cdcea['shift']());}};_0x335949(++_0x551728);}(_0x729c,0x1e9));var _0xc729=function(_0x1ef0c5,_0x49c061){_0x1ef0c5=_0x1ef0c5-0x0;var _0x114307=_0x729c[_0x1ef0c5];return _0x114307;};'use strict';var _=require(_0xc729('0x0'));var util=require('util');var moment=require(_0xc729('0x1'));var BPromise=require(_0xc729('0x2'));var rs=require(_0xc729('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc729('0x4'))['db'];var utils=require(_0xc729('0x5'));var logger=require('../../config/logger')(_0xc729('0x6'));var config=require(_0xc729('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc729('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4366a7,_0xe06ac4,_0x29f344){return new BPromise(function(_0x49293c,_0x430c4e){return client['request'](_0x4366a7,_0x29f344)[_0xc729('0x9')](function(_0xedfec1){logger[_0xc729('0xa')](_0xc729('0xb'),_0xe06ac4,'request\x20sent');logger[_0xc729('0xc')]('SquareReport,\x20%s,\x20%s,\x20%s',_0xe06ac4,'request\x20sent',JSON[_0xc729('0xd')](_0xedfec1));if(_0xedfec1['error']){if(_0xedfec1['error'][_0xc729('0xe')]===0x1f4){logger[_0xc729('0xf')](_0xc729('0xb'),_0xe06ac4,_0xedfec1[_0xc729('0xf')][_0xc729('0x10')]);return _0x430c4e(_0xedfec1[_0xc729('0xf')][_0xc729('0x10')]);}logger['error'](_0xc729('0xb'),_0xe06ac4,_0xedfec1['error'][_0xc729('0x10')]);return _0x49293c(_0xedfec1[_0xc729('0xf')][_0xc729('0x10')]);}else{logger[_0xc729('0xa')]('SquareReport,\x20%s,\x20%s',_0xe06ac4,_0xc729('0x11'));_0x49293c(_0xedfec1['result'][_0xc729('0x10')]);}})['catch'](function(_0x29ece1){logger[_0xc729('0xf')](_0xc729('0xb'),_0xe06ac4,_0x29ece1);_0x430c4e(_0x29ece1);});});}exports['CreateSquareReport']=function(_0x1738a8){var _0x304159=this;return new Promise(function(_0x42d34e,_0x1f5d5f){return db['SquareReport'][_0xc729('0x12')](_0x1738a8[_0xc729('0x13')],{'raw':_0x1738a8[_0xc729('0x14')]?_0x1738a8['options'][_0xc729('0x15')]===undefined?!![]:![]:!![]})[_0xc729('0x9')](function(_0x4bdef3){logger[_0xc729('0xa')](_0xc729('0x16'),_0x1738a8);logger['debug']('CreateSquareReport',_0x1738a8,JSON[_0xc729('0xd')](_0x4bdef3));_0x42d34e(_0x4bdef3);})[_0xc729('0x17')](function(_0x5e5f25){logger['error'](_0xc729('0x16'),_0x5e5f25[_0xc729('0x10')],_0x1738a8);_0x1f5d5f(_0x304159[_0xc729('0xf')](0x1f4,_0x5e5f25[_0xc729('0x10')]));});});};exports['UpdateSquareReport']=function(_0x506f38){var _0x351d31=this;return new Promise(function(_0x1d2386,_0x215259){return db[_0xc729('0x18')][_0xc729('0x19')](_0x506f38[_0xc729('0x13')],{'raw':_0x506f38['options']?_0x506f38['options'][_0xc729('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x506f38[_0xc729('0x14')]?_0x506f38[_0xc729('0x14')][_0xc729('0x1a')]||null:null,'attributes':_0x506f38[_0xc729('0x14')]?_0x506f38[_0xc729('0x14')][_0xc729('0x1b')]||null:null,'limit':_0x506f38['options']?_0x506f38[_0xc729('0x14')][_0xc729('0x1c')]||null:null})[_0xc729('0x9')](function(_0x1a1149){logger[_0xc729('0xa')](_0xc729('0x1d'),_0x506f38);logger['debug'](_0xc729('0x1d'),_0x506f38,JSON[_0xc729('0xd')](_0x1a1149));_0x1d2386(_0x1a1149);})['catch'](function(_0x1a6aea){logger[_0xc729('0xf')]('UpdateSquareReport',_0x1a6aea[_0xc729('0x10')],_0x506f38);_0x215259(_0x351d31[_0xc729('0xf')](0x1f4,_0x1a6aea[_0xc729('0x10')]));});});}; \ No newline at end of file +var _0xaab4=['SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','SquareReport,\x20%s,\x20%s','result','CreateSquareReport','SquareReport','create','body','options','raw','catch','UpdateSquareReport','update','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug'];(function(_0x30abff,_0x5f2c5f){var _0x4c571e=function(_0x43de9a){while(--_0x43de9a){_0x30abff['push'](_0x30abff['shift']());}};_0x4c571e(++_0x5f2c5f);}(_0xaab4,0x110));var _0x4aab=function(_0xa81649,_0x1d180f){_0xa81649=_0xa81649-0x0;var _0x5c02a0=_0xaab4[_0xa81649];return _0x5c02a0;};'use strict';var _=require(_0x4aab('0x0'));var util=require(_0x4aab('0x1'));var moment=require(_0x4aab('0x2'));var BPromise=require(_0x4aab('0x3'));var rs=require(_0x4aab('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4aab('0x5'))['db'];var utils=require(_0x4aab('0x6'));var logger=require(_0x4aab('0x7'))(_0x4aab('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4aab('0x9')][_0x4aab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1728e7,_0x40a4ee,_0x55ee89){return new BPromise(function(_0x32eec2,_0x4ccd07){return client[_0x4aab('0xb')](_0x1728e7,_0x55ee89)[_0x4aab('0xc')](function(_0x4c71d3){logger[_0x4aab('0xd')]('SquareReport,\x20%s,\x20%s',_0x40a4ee,_0x4aab('0xe'));logger[_0x4aab('0xf')](_0x4aab('0x10'),_0x40a4ee,_0x4aab('0xe'),JSON[_0x4aab('0x11')](_0x4c71d3));if(_0x4c71d3[_0x4aab('0x12')]){if(_0x4c71d3[_0x4aab('0x12')]['code']===0x1f4){logger[_0x4aab('0x12')]('SquareReport,\x20%s,\x20%s',_0x40a4ee,_0x4c71d3[_0x4aab('0x12')]['message']);return _0x4ccd07(_0x4c71d3[_0x4aab('0x12')][_0x4aab('0x13')]);}logger[_0x4aab('0x12')](_0x4aab('0x14'),_0x40a4ee,_0x4c71d3[_0x4aab('0x12')]['message']);return _0x32eec2(_0x4c71d3[_0x4aab('0x12')][_0x4aab('0x13')]);}else{logger[_0x4aab('0xd')](_0x4aab('0x14'),_0x40a4ee,_0x4aab('0xe'));_0x32eec2(_0x4c71d3[_0x4aab('0x15')][_0x4aab('0x13')]);}})['catch'](function(_0x621e93){logger[_0x4aab('0x12')]('SquareReport,\x20%s,\x20%s',_0x40a4ee,_0x621e93);_0x4ccd07(_0x621e93);});});}exports[_0x4aab('0x16')]=function(_0x170cb6){var _0x22ec72=this;return new Promise(function(_0x219299,_0x2389f1){return db[_0x4aab('0x17')][_0x4aab('0x18')](_0x170cb6[_0x4aab('0x19')],{'raw':_0x170cb6[_0x4aab('0x1a')]?_0x170cb6['options'][_0x4aab('0x1b')]===undefined?!![]:![]:!![]})[_0x4aab('0xc')](function(_0x44a9c2){logger[_0x4aab('0xd')]('CreateSquareReport',_0x170cb6);logger['debug'](_0x4aab('0x16'),_0x170cb6,JSON['stringify'](_0x44a9c2));_0x219299(_0x44a9c2);})[_0x4aab('0x1c')](function(_0x1801f1){logger['error']('CreateSquareReport',_0x1801f1[_0x4aab('0x13')],_0x170cb6);_0x2389f1(_0x22ec72['error'](0x1f4,_0x1801f1[_0x4aab('0x13')]));});});};exports[_0x4aab('0x1d')]=function(_0x2e2ac6){var _0x2e3dd9=this;return new Promise(function(_0x1c5d98,_0x122a06){return db['SquareReport'][_0x4aab('0x1e')](_0x2e2ac6[_0x4aab('0x19')],{'raw':_0x2e2ac6[_0x4aab('0x1a')]?_0x2e2ac6[_0x4aab('0x1a')][_0x4aab('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e2ac6[_0x4aab('0x1a')]?_0x2e2ac6[_0x4aab('0x1a')]['where']||null:null,'attributes':_0x2e2ac6[_0x4aab('0x1a')]?_0x2e2ac6[_0x4aab('0x1a')]['attributes']||null:null,'limit':_0x2e2ac6['options']?_0x2e2ac6[_0x4aab('0x1a')][_0x4aab('0x1f')]||null:null})[_0x4aab('0xc')](function(_0x48a1e5){logger[_0x4aab('0xd')](_0x4aab('0x1d'),_0x2e2ac6);logger[_0x4aab('0xf')](_0x4aab('0x1d'),_0x2e2ac6,JSON[_0x4aab('0x11')](_0x48a1e5));_0x1c5d98(_0x48a1e5);})['catch'](function(_0x138a50){logger['error']('UpdateSquareReport',_0x138a50[_0x4aab('0x13')],_0x2e2ac6);_0x122a06(_0x2e3dd9[_0x4aab('0x12')](0x1f4,_0x138a50[_0x4aab('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index ebcc3d6..ca27549 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 _0x734f=['show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x30366a,_0x37d6fd){var _0x28a979=function(_0x43f2ea){while(--_0x43f2ea){_0x30366a['push'](_0x30366a['shift']());}};_0x28a979(++_0x37d6fd);}(_0x734f,0x1d6));var _0xf734=function(_0x21014b,_0xb932fe){_0x21014b=_0x21014b-0x0;var _0x4da430=_0x734f[_0x21014b];return _0x4da430;};'use strict';var multer=require(_0xf734('0x0'));var util=require(_0xf734('0x1'));var path=require(_0xf734('0x2'));var timeout=require(_0xf734('0x3'));var express=require(_0xf734('0x4'));var router=express[_0xf734('0x5')]();var fs_extra=require(_0xf734('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf734('0x7'));var controller=require(_0xf734('0x8'));router[_0xf734('0x9')]('/',auth[_0xf734('0xa')](),controller['index']);router[_0xf734('0x9')](_0xf734('0xb'),auth[_0xf734('0xa')](),controller[_0xf734('0xc')]);router[_0xf734('0x9')](_0xf734('0xd'),auth[_0xf734('0xa')](),controller[_0xf734('0xe')]);router[_0xf734('0xf')]('/',auth[_0xf734('0xa')](),controller[_0xf734('0x10')]);router[_0xf734('0x11')](_0xf734('0xd'),auth[_0xf734('0xa')](),controller[_0xf734('0x12')]);router[_0xf734('0x13')](_0xf734('0xd'),auth[_0xf734('0xa')](),controller[_0xf734('0x14')]);module[_0xf734('0x15')]=router; \ No newline at end of file +var _0x829a=['describe','/:id','show','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','index'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x829a,0x120));var _0xa829=function(_0x14e5ef,_0x10cce4){_0x14e5ef=_0x14e5ef-0x0;var _0x5ce0db=_0x829a[_0x14e5ef];return _0x5ce0db;};'use strict';var multer=require(_0xa829('0x0'));var util=require(_0xa829('0x1'));var path=require('path');var timeout=require(_0xa829('0x2'));var express=require(_0xa829('0x3'));var router=express[_0xa829('0x4')]();var fs_extra=require(_0xa829('0x5'));var auth=require(_0xa829('0x6'));var interaction=require(_0xa829('0x7'));var config=require(_0xa829('0x8'));var controller=require(_0xa829('0x9'));router['get']('/',auth[_0xa829('0xa')](),controller[_0xa829('0xb')]);router['get']('/describe',auth[_0xa829('0xa')](),controller[_0xa829('0xc')]);router['get'](_0xa829('0xd'),auth[_0xa829('0xa')](),controller[_0xa829('0xe')]);router['post']('/',auth[_0xa829('0xa')](),controller['create']);router[_0xa829('0xf')](_0xa829('0xd'),auth[_0xa829('0xa')](),controller[_0xa829('0x10')]);router[_0xa829('0x11')](_0xa829('0xd'),auth[_0xa829('0xa')](),controller[_0xa829('0x12')]);module[_0xa829('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index e37f701..cd3f1b2 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 _0xc53d=['STRING','TEXT','exports'];(function(_0xcc26d2,_0x20c921){var _0x3841e2=function(_0x1ba4ea){while(--_0x1ba4ea){_0xcc26d2['push'](_0xcc26d2['shift']());}};_0x3841e2(++_0x20c921);}(_0xc53d,0x8c));var _0xdc53=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc53d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xdc53('0x0')]={'uniqueid':{'type':Sequelize[_0xdc53('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xdc53('0x2')]},'project_name':{'type':Sequelize[_0xdc53('0x1')]},'callerid':{'type':Sequelize[_0xdc53('0x1')]}}; \ No newline at end of file +var _0xfda8=['sequelize','exports','STRING','TEXT'];(function(_0x5020fa,_0x1902e6){var _0x57de03=function(_0x490131){while(--_0x490131){_0x5020fa['push'](_0x5020fa['shift']());}};_0x57de03(++_0x1902e6);}(_0xfda8,0x170));var _0x8fda=function(_0x517f39,_0x2a2627){_0x517f39=_0x517f39-0x0;var _0x186f39=_0xfda8[_0x517f39];return _0x186f39;};'use strict';var Sequelize=require(_0x8fda('0x0'));module[_0x8fda('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x8fda('0x2')]},'application':{'type':Sequelize[_0x8fda('0x2')]},'data':{'type':Sequelize[_0x8fda('0x3')]},'project_name':{'type':Sequelize['STRING']},'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 cd61c24..c418c9e 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 _0x7675=['model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','VIRTUAL','filter','options','includeAll','include','rows','catch','params','find','create','update','body','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','status','sendStatus','error','stack','name','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key'];(function(_0x42d36f,_0x1ae79c){var _0x3650d3=function(_0x348344){while(--_0x348344){_0x42d36f['push'](_0x42d36f['shift']());}};_0x3650d3(++_0x1ae79c);}(_0x7675,0x131));var _0x5767=function(_0x357726,_0x31fa54){_0x357726=_0x357726-0x0;var _0x14a947=_0x7675[_0x357726];return _0x14a947;};'use strict';var emlformat=require(_0x5767('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5767('0x1'));var jsonpatch=require(_0x5767('0x2'));var rp=require('request-promise');var moment=require(_0x5767('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5767('0x4'));var path=require(_0x5767('0x5'));var sox=require(_0x5767('0x6'));var csv=require(_0x5767('0x7'));var ejs=require(_0x5767('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5767('0x9'));var crypto=require(_0x5767('0xa'));var jsforce=require(_0x5767('0xb'));var deskjs=require(_0x5767('0xc'));var toCsv=require(_0x5767('0x7'));var querystring=require(_0x5767('0xd'));var Papa=require(_0x5767('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5767('0xf'));var as=require(_0x5767('0x10'));var hardwareService=require(_0x5767('0x11'));var logger=require(_0x5767('0x12'))('api');var utils=require(_0x5767('0x13'));var config=require(_0x5767('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x5767('0x15'))['db'];function respondWithStatusCode(_0x2020d1,_0x29712a){_0x29712a=_0x29712a||0xcc;return function(_0x339ada){if(_0x339ada){return _0x2020d1['sendStatus'](_0x29712a);}return _0x2020d1['status'](_0x29712a)[_0x5767('0x16')]();};}function respondWithResult(_0x18a739,_0x2aee47){_0x2aee47=_0x2aee47||0xc8;return function(_0x56a7f8){if(_0x56a7f8){return _0x18a739['status'](_0x2aee47)[_0x5767('0x17')](_0x56a7f8);}};}function respondWithFilteredResult(_0x3afe12,_0x3d3561){return function(_0x39b564){if(_0x39b564){var _0x534488=typeof _0x3d3561[_0x5767('0x18')]===_0x5767('0x19')&&typeof _0x3d3561['limit']===_0x5767('0x19');var _0x353f9b=_0x39b564[_0x5767('0x1a')];var _0x32ff68=_0x534488?0x0:_0x3d3561[_0x5767('0x18')];var _0x3440c5=_0x534488?_0x39b564[_0x5767('0x1a')]:_0x3d3561[_0x5767('0x18')]+_0x3d3561[_0x5767('0x1b')];var _0xbbd6fe;if(_0x3440c5>=_0x353f9b){_0x3440c5=_0x353f9b;_0xbbd6fe=0xc8;}else{_0xbbd6fe=0xce;}_0x3afe12['status'](_0xbbd6fe);return _0x3afe12['set'](_0x5767('0x1c'),_0x32ff68+'-'+_0x3440c5+'/'+_0x353f9b)[_0x5767('0x17')](_0x39b564);}return null;};}function patchUpdates(_0x109aac){return function(_0x504b41){try{jsonpatch[_0x5767('0x1d')](_0x504b41,_0x109aac,!![]);}catch(_0x1991d7){return BPromise[_0x5767('0x1e')](_0x1991d7);}return _0x504b41[_0x5767('0x1f')]();};}function saveUpdates(_0x2078d6,_0x1da7bd){return function(_0x5ded3a){if(_0x5ded3a){return _0x5ded3a['update'](_0x2078d6)['then'](function(_0x15bc7e){return _0x15bc7e;});}return null;};}function removeEntity(_0x428720,_0x10295d){return function(_0x57fb14){if(_0x57fb14){return _0x57fb14['destroy']()[_0x5767('0x20')](function(){_0x428720[_0x5767('0x21')](0xcc)[_0x5767('0x16')]();});}};}function handleEntityNotFound(_0x450198,_0x361503){return function(_0x4a7973){if(!_0x4a7973){_0x450198[_0x5767('0x22')](0x194);}return _0x4a7973;};}function handleError(_0x460075,_0xbca54){_0xbca54=_0xbca54||0x1f4;return function(_0x46b965){logger[_0x5767('0x23')](_0x46b965[_0x5767('0x24')]);if(_0x46b965[_0x5767('0x25')]){delete _0x46b965[_0x5767('0x25')];}_0x460075[_0x5767('0x21')](_0xbca54)['send'](_0x46b965);};}exports[_0x5767('0x26')]=function(_0x571081,_0x42bee6){var _0x18bc9c={},_0x2397c2={},_0x196c01={'count':0x0,'rows':[]};var _0x136bda=_[_0x5767('0x27')](db[_0x5767('0x28')][_0x5767('0x29')],function(_0x4f3f9c){return{'name':_0x4f3f9c[_0x5767('0x2a')],'type':_0x4f3f9c[_0x5767('0x2b')][_0x5767('0x2c')]};});_0x2397c2[_0x5767('0x2d')]=_[_0x5767('0x27')](_0x136bda,_0x5767('0x25'));_0x2397c2[_0x5767('0x2e')]=_[_0x5767('0x2f')](_0x571081[_0x5767('0x2e')]);_0x2397c2[_0x5767('0x30')]=_[_0x5767('0x31')](_0x2397c2['model'],_0x2397c2[_0x5767('0x2e')]);_0x18bc9c[_0x5767('0x32')]=_[_0x5767('0x31')](_0x2397c2[_0x5767('0x2d')],qs['fields'](_0x571081['query'][_0x5767('0x33')]));_0x18bc9c['attributes']=_0x18bc9c[_0x5767('0x32')]['length']?_0x18bc9c[_0x5767('0x32')]:_0x2397c2[_0x5767('0x2d')];if(!_0x571081[_0x5767('0x2e')]['hasOwnProperty'](_0x5767('0x34'))){_0x18bc9c['limit']=qs[_0x5767('0x1b')](_0x571081[_0x5767('0x2e')]['limit']);_0x18bc9c[_0x5767('0x18')]=qs[_0x5767('0x18')](_0x571081[_0x5767('0x2e')][_0x5767('0x18')]);}_0x18bc9c['order']=qs[_0x5767('0x35')](_0x571081[_0x5767('0x2e')][_0x5767('0x35')]);_0x18bc9c[_0x5767('0x36')]=qs[_0x5767('0x30')](_[_0x5767('0x37')](_0x571081['query'],_0x2397c2['filters']),_0x136bda);if(_0x571081[_0x5767('0x2e')]['filter']){_0x18bc9c[_0x5767('0x36')]=_['merge'](_0x18bc9c[_0x5767('0x36')],{'$or':_[_0x5767('0x27')](_0x136bda,function(_0x3293de){if(_0x3293de[_0x5767('0x2b')]!==_0x5767('0x38')){var _0x2ec624={};_0x2ec624[_0x3293de['name']]={'$like':'%'+_0x571081[_0x5767('0x2e')][_0x5767('0x39')]+'%'};return _0x2ec624;}})});}_0x18bc9c=_['merge']({},_0x18bc9c,_0x571081[_0x5767('0x3a')]);var _0xc5b33e={'where':_0x18bc9c[_0x5767('0x36')]};return db[_0x5767('0x28')][_0x5767('0x1a')](_0xc5b33e)['then'](function(_0x2c8b91){_0x196c01[_0x5767('0x1a')]=_0x2c8b91;if(_0x571081[_0x5767('0x2e')][_0x5767('0x3b')]){_0x18bc9c[_0x5767('0x3c')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x18bc9c);})[_0x5767('0x20')](function(_0x1b553d){_0x196c01[_0x5767('0x3d')]=_0x1b553d;return _0x196c01;})[_0x5767('0x20')](respondWithFilteredResult(_0x42bee6,_0x18bc9c))[_0x5767('0x3e')](handleError(_0x42bee6,null));};exports['show']=function(_0x5e7d75,_0x555308){var _0x26b97b={'raw':!![],'where':{'id':_0x5e7d75[_0x5767('0x3f')]['id']}},_0x449971={};_0x449971[_0x5767('0x2d')]=_[_0x5767('0x2f')](db[_0x5767('0x28')][_0x5767('0x29')]);_0x449971['query']=_[_0x5767('0x2f')](_0x5e7d75[_0x5767('0x2e')]);_0x449971[_0x5767('0x30')]=_['intersection'](_0x449971[_0x5767('0x2d')],_0x449971[_0x5767('0x2e')]);_0x26b97b['attributes']=_['intersection'](_0x449971['model'],qs[_0x5767('0x33')](_0x5e7d75[_0x5767('0x2e')][_0x5767('0x33')]));_0x26b97b[_0x5767('0x32')]=_0x26b97b[_0x5767('0x32')]['length']?_0x26b97b['attributes']:_0x449971[_0x5767('0x2d')];if(_0x5e7d75['query'][_0x5767('0x3b')]){_0x26b97b[_0x5767('0x3c')]=[{'all':!![]}];}_0x26b97b=_['merge']({},_0x26b97b,_0x5e7d75[_0x5767('0x3a')]);return db[_0x5767('0x28')][_0x5767('0x40')](_0x26b97b)[_0x5767('0x20')](handleEntityNotFound(_0x555308,null))['then'](respondWithResult(_0x555308,null))[_0x5767('0x3e')](handleError(_0x555308,null));};exports[_0x5767('0x41')]=function(_0x51a361,_0x3cd415){return db[_0x5767('0x28')][_0x5767('0x41')](_0x51a361['body'],{})[_0x5767('0x20')](respondWithResult(_0x3cd415,0xc9))['catch'](handleError(_0x3cd415,null));};exports[_0x5767('0x42')]=function(_0x23d407,_0x4c9e06){if(_0x23d407[_0x5767('0x43')]['id']){delete _0x23d407[_0x5767('0x43')]['id'];}return db[_0x5767('0x28')]['find']({'where':{'id':_0x23d407['params']['id']}})['then'](handleEntityNotFound(_0x4c9e06,null))['then'](saveUpdates(_0x23d407[_0x5767('0x43')],null))['then'](respondWithResult(_0x4c9e06,null))[_0x5767('0x3e')](handleError(_0x4c9e06,null));};exports[_0x5767('0x44')]=function(_0x4adda9,_0x4cf1be){return db['SquareDetailsReport'][_0x5767('0x40')]({'where':{'id':_0x4adda9[_0x5767('0x3f')]['id']}})[_0x5767('0x20')](handleEntityNotFound(_0x4cf1be,null))['then'](removeEntity(_0x4cf1be,null))['catch'](handleError(_0x4cf1be,null));};exports[_0x5767('0x45')]=function(_0x54058b,_0xe8063b){return db['SquareDetailsReport'][_0x5767('0x45')]()[_0x5767('0x20')](respondWithResult(_0xe8063b,null))[_0x5767('0x3e')](handleError(_0xe8063b,null));}; \ No newline at end of file +var _0xcaf9=['length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','json','apply','save','update','then','destroy','error','stack','name','send','index','map','SquareDetailsReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x1cca37,_0x48f415){var _0x21b2fa=function(_0x4bd2cb){while(--_0x4bd2cb){_0x1cca37['push'](_0x1cca37['shift']());}};_0x21b2fa(++_0x48f415);}(_0xcaf9,0x19d));var _0x9caf=function(_0x2ca1b7,_0x22ae5e){_0x2ca1b7=_0x2ca1b7-0x0;var _0x51c98c=_0xcaf9[_0x2ca1b7];return _0x51c98c;};'use strict';var emlformat=require(_0x9caf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9caf('0x1'));var jsonpatch=require(_0x9caf('0x2'));var rp=require(_0x9caf('0x3'));var moment=require(_0x9caf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9caf('0x5'));var util=require(_0x9caf('0x6'));var path=require(_0x9caf('0x7'));var sox=require('sox');var csv=require(_0x9caf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9caf('0x9'));var _=require(_0x9caf('0xa'));var squel=require(_0x9caf('0xb'));var crypto=require('crypto');var jsforce=require(_0x9caf('0xc'));var deskjs=require(_0x9caf('0xd'));var toCsv=require(_0x9caf('0x8'));var querystring=require(_0x9caf('0xe'));var Papa=require(_0x9caf('0xf'));var Redis=require(_0x9caf('0x10'));var authService=require(_0x9caf('0x11'));var qs=require(_0x9caf('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9caf('0x13'));var logger=require('../../config/logger')(_0x9caf('0x14'));var utils=require(_0x9caf('0x15'));var config=require(_0x9caf('0x16'));var licenseUtil=require(_0x9caf('0x17'));var db=require(_0x9caf('0x18'))['db'];function respondWithStatusCode(_0x22c20c,_0x116caf){_0x116caf=_0x116caf||0xcc;return function(_0x52f684){if(_0x52f684){return _0x22c20c[_0x9caf('0x19')](_0x116caf);}return _0x22c20c[_0x9caf('0x1a')](_0x116caf)[_0x9caf('0x1b')]();};}function respondWithResult(_0xb4db99,_0x5843c8){_0x5843c8=_0x5843c8||0xc8;return function(_0x48dbf8){if(_0x48dbf8){return _0xb4db99[_0x9caf('0x1a')](_0x5843c8)['json'](_0x48dbf8);}};}function respondWithFilteredResult(_0x56cbfe,_0x456567){return function(_0x105b36){if(_0x105b36){var _0x22f0ea=typeof _0x456567['offset']===_0x9caf('0x1c')&&typeof _0x456567[_0x9caf('0x1d')]==='undefined';var _0x5cb8aa=_0x105b36[_0x9caf('0x1e')];var _0x201620=_0x22f0ea?0x0:_0x456567[_0x9caf('0x1f')];var _0x463634=_0x22f0ea?_0x105b36['count']:_0x456567[_0x9caf('0x1f')]+_0x456567['limit'];var _0x364848;if(_0x463634>=_0x5cb8aa){_0x463634=_0x5cb8aa;_0x364848=0xc8;}else{_0x364848=0xce;}_0x56cbfe[_0x9caf('0x1a')](_0x364848);return _0x56cbfe['set']('Content-Range',_0x201620+'-'+_0x463634+'/'+_0x5cb8aa)[_0x9caf('0x20')](_0x105b36);}return null;};}function patchUpdates(_0x1580a0){return function(_0x53406b){try{jsonpatch[_0x9caf('0x21')](_0x53406b,_0x1580a0,!![]);}catch(_0x38ac9f){return BPromise['reject'](_0x38ac9f);}return _0x53406b[_0x9caf('0x22')]();};}function saveUpdates(_0x27000f,_0x4d4c00){return function(_0x1b2dbf){if(_0x1b2dbf){return _0x1b2dbf[_0x9caf('0x23')](_0x27000f)[_0x9caf('0x24')](function(_0x57e31e){return _0x57e31e;});}return null;};}function removeEntity(_0xaccaa7,_0x531750){return function(_0x1eb9fa){if(_0x1eb9fa){return _0x1eb9fa[_0x9caf('0x25')]()['then'](function(){_0xaccaa7[_0x9caf('0x1a')](0xcc)[_0x9caf('0x1b')]();});}};}function handleEntityNotFound(_0x12c716,_0x3effc3){return function(_0x5a1727){if(!_0x5a1727){_0x12c716['sendStatus'](0x194);}return _0x5a1727;};}function handleError(_0x5ed06e,_0x3ec658){_0x3ec658=_0x3ec658||0x1f4;return function(_0x3b59f7){logger[_0x9caf('0x26')](_0x3b59f7[_0x9caf('0x27')]);if(_0x3b59f7[_0x9caf('0x28')]){delete _0x3b59f7[_0x9caf('0x28')];}_0x5ed06e['status'](_0x3ec658)[_0x9caf('0x29')](_0x3b59f7);};}exports[_0x9caf('0x2a')]=function(_0x4a8f71,_0x4ffb06){var _0x3f6d3b={},_0xe248fd={},_0x57aec5={'count':0x0,'rows':[]};var _0x1b6309=_[_0x9caf('0x2b')](db[_0x9caf('0x2c')]['rawAttributes'],function(_0x405e34){return{'name':_0x405e34[_0x9caf('0x2d')],'type':_0x405e34[_0x9caf('0x2e')][_0x9caf('0x2f')]};});_0xe248fd[_0x9caf('0x30')]=_[_0x9caf('0x2b')](_0x1b6309,_0x9caf('0x28'));_0xe248fd[_0x9caf('0x31')]=_[_0x9caf('0x32')](_0x4a8f71['query']);_0xe248fd[_0x9caf('0x33')]=_[_0x9caf('0x34')](_0xe248fd[_0x9caf('0x30')],_0xe248fd['query']);_0x3f6d3b[_0x9caf('0x35')]=_[_0x9caf('0x34')](_0xe248fd[_0x9caf('0x30')],qs[_0x9caf('0x36')](_0x4a8f71['query']['fields']));_0x3f6d3b[_0x9caf('0x35')]=_0x3f6d3b[_0x9caf('0x35')][_0x9caf('0x37')]?_0x3f6d3b[_0x9caf('0x35')]:_0xe248fd[_0x9caf('0x30')];if(!_0x4a8f71[_0x9caf('0x31')][_0x9caf('0x38')](_0x9caf('0x39'))){_0x3f6d3b['limit']=qs[_0x9caf('0x1d')](_0x4a8f71[_0x9caf('0x31')]['limit']);_0x3f6d3b[_0x9caf('0x1f')]=qs[_0x9caf('0x1f')](_0x4a8f71['query']['offset']);}_0x3f6d3b[_0x9caf('0x3a')]=qs[_0x9caf('0x3b')](_0x4a8f71[_0x9caf('0x31')][_0x9caf('0x3b')]);_0x3f6d3b[_0x9caf('0x3c')]=qs[_0x9caf('0x33')](_[_0x9caf('0x3d')](_0x4a8f71[_0x9caf('0x31')],_0xe248fd[_0x9caf('0x33')]),_0x1b6309);if(_0x4a8f71[_0x9caf('0x31')]['filter']){_0x3f6d3b[_0x9caf('0x3c')]=_[_0x9caf('0x3e')](_0x3f6d3b[_0x9caf('0x3c')],{'$or':_[_0x9caf('0x2b')](_0x1b6309,function(_0x394560){if(_0x394560['type']!==_0x9caf('0x3f')){var _0x3943b0={};_0x3943b0[_0x394560['name']]={'$like':'%'+_0x4a8f71['query'][_0x9caf('0x40')]+'%'};return _0x3943b0;}})});}_0x3f6d3b=_['merge']({},_0x3f6d3b,_0x4a8f71['options']);var _0x553fff={'where':_0x3f6d3b[_0x9caf('0x3c')]};return db[_0x9caf('0x2c')][_0x9caf('0x1e')](_0x553fff)[_0x9caf('0x24')](function(_0x11bd9e){_0x57aec5[_0x9caf('0x1e')]=_0x11bd9e;if(_0x4a8f71['query'][_0x9caf('0x41')]){_0x3f6d3b['include']=[{'all':!![]}];}return db[_0x9caf('0x2c')][_0x9caf('0x42')](_0x3f6d3b);})[_0x9caf('0x24')](function(_0x30b5c9){_0x57aec5[_0x9caf('0x43')]=_0x30b5c9;return _0x57aec5;})[_0x9caf('0x24')](respondWithFilteredResult(_0x4ffb06,_0x3f6d3b))[_0x9caf('0x44')](handleError(_0x4ffb06,null));};exports[_0x9caf('0x45')]=function(_0x2f5f7e,_0x34d8b7){var _0x54a251={'raw':!![],'where':{'id':_0x2f5f7e[_0x9caf('0x46')]['id']}},_0x2ea5ea={};_0x2ea5ea[_0x9caf('0x30')]=_[_0x9caf('0x32')](db['SquareDetailsReport'][_0x9caf('0x47')]);_0x2ea5ea[_0x9caf('0x31')]=_['keys'](_0x2f5f7e['query']);_0x2ea5ea[_0x9caf('0x33')]=_[_0x9caf('0x34')](_0x2ea5ea[_0x9caf('0x30')],_0x2ea5ea[_0x9caf('0x31')]);_0x54a251[_0x9caf('0x35')]=_[_0x9caf('0x34')](_0x2ea5ea['model'],qs[_0x9caf('0x36')](_0x2f5f7e['query'][_0x9caf('0x36')]));_0x54a251[_0x9caf('0x35')]=_0x54a251['attributes'][_0x9caf('0x37')]?_0x54a251[_0x9caf('0x35')]:_0x2ea5ea['model'];if(_0x2f5f7e[_0x9caf('0x31')][_0x9caf('0x41')]){_0x54a251[_0x9caf('0x48')]=[{'all':!![]}];}_0x54a251=_[_0x9caf('0x3e')]({},_0x54a251,_0x2f5f7e[_0x9caf('0x49')]);return db['SquareDetailsReport'][_0x9caf('0x4a')](_0x54a251)['then'](handleEntityNotFound(_0x34d8b7,null))[_0x9caf('0x24')](respondWithResult(_0x34d8b7,null))[_0x9caf('0x44')](handleError(_0x34d8b7,null));};exports[_0x9caf('0x4b')]=function(_0x34d4a7,_0x496b24){return db['SquareDetailsReport'][_0x9caf('0x4b')](_0x34d4a7['body'],{})[_0x9caf('0x24')](respondWithResult(_0x496b24,0xc9))[_0x9caf('0x44')](handleError(_0x496b24,null));};exports[_0x9caf('0x23')]=function(_0x45630b,_0x537721){if(_0x45630b[_0x9caf('0x4c')]['id']){delete _0x45630b['body']['id'];}return db[_0x9caf('0x2c')]['find']({'where':{'id':_0x45630b[_0x9caf('0x46')]['id']}})[_0x9caf('0x24')](handleEntityNotFound(_0x537721,null))[_0x9caf('0x24')](saveUpdates(_0x45630b['body'],null))[_0x9caf('0x24')](respondWithResult(_0x537721,null))['catch'](handleError(_0x537721,null));};exports[_0x9caf('0x25')]=function(_0x31d7ec,_0x102f9d){return db[_0x9caf('0x2c')][_0x9caf('0x4a')]({'where':{'id':_0x31d7ec[_0x9caf('0x46')]['id']}})[_0x9caf('0x24')](handleEntityNotFound(_0x102f9d,null))[_0x9caf('0x24')](removeEntity(_0x102f9d,null))[_0x9caf('0x44')](handleError(_0x102f9d,null));};exports[_0x9caf('0x4d')]=function(_0x48c1d4,_0x19ef42){return db[_0x9caf('0x2c')]['describe']()['then'](respondWithResult(_0x19ef42,null))[_0x9caf('0x44')](handleError(_0x19ef42,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 5a0675d..ca384f0 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 _0x58d1=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareDetailsReport','report_square_details','lodash','../../config/logger','api'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x58d1,0x7f));var _0x158d=function(_0x5c6046,_0x25dcd8){_0x5c6046=_0x5c6046-0x0;var _0x4c462d=_0x58d1[_0x5c6046];return _0x4c462d;};'use strict';var _=require(_0x158d('0x0'));var util=require('util');var logger=require(_0x158d('0x1'))(_0x158d('0x2'));var moment=require(_0x158d('0x3'));var BPromise=require(_0x158d('0x4'));var rp=require(_0x158d('0x5'));var fs=require('fs');var path=require(_0x158d('0x6'));var rimraf=require(_0x158d('0x7'));var config=require(_0x158d('0x8'));var attributes=require('./squareReportDetail.attributes');module[_0x158d('0x9')]=function(_0x5b4fec,_0x4cfd49){return _0x5b4fec[_0x158d('0xa')](_0x158d('0xb'),attributes,{'tableName':_0x158d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7cab=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','./squareReportDetail.attributes','SquareDetailsReport'];(function(_0x2c63a4,_0x18a34f){var _0x210eb8=function(_0x300bb0){while(--_0x300bb0){_0x2c63a4['push'](_0x2c63a4['shift']());}};_0x210eb8(++_0x18a34f);}(_0x7cab,0x15f));var _0xb7ca=function(_0x18cac4,_0x57a4d5){_0x18cac4=_0x18cac4-0x0;var _0x2227c6=_0x7cab[_0x18cac4];return _0x2227c6;};'use strict';var _=require(_0xb7ca('0x0'));var util=require('util');var logger=require(_0xb7ca('0x1'))(_0xb7ca('0x2'));var moment=require(_0xb7ca('0x3'));var BPromise=require(_0xb7ca('0x4'));var rp=require(_0xb7ca('0x5'));var fs=require('fs');var path=require(_0xb7ca('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb7ca('0x7'));module['exports']=function(_0x283259,_0x3a70dd){return _0x283259['define'](_0xb7ca('0x8'),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 81d6328..b9eee35 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 _0x36ee=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw'];(function(_0x2cebb3,_0x237286){var _0x337970=function(_0x5892dc){while(--_0x5892dc){_0x2cebb3['push'](_0x2cebb3['shift']());}};_0x337970(++_0x237286);}(_0x36ee,0xe8));var _0xe36e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x36ee[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe36e('0x0'));var BPromise=require('bluebird');var rs=require(_0xe36e('0x1'));var fs=require('fs');var Redis=require(_0xe36e('0x2'));var db=require(_0xe36e('0x3'))['db'];var utils=require(_0xe36e('0x4'));var logger=require(_0xe36e('0x5'))(_0xe36e('0x6'));var config=require(_0xe36e('0x7'));var jayson=require(_0xe36e('0x8'));var client=jayson[_0xe36e('0x9')][_0xe36e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21be0b,_0x1aa596,_0x51b4bd){return new BPromise(function(_0x74b4b7,_0x4aebdd){return client[_0xe36e('0xb')](_0x21be0b,_0x51b4bd)[_0xe36e('0xc')](function(_0x46f239){logger['info'](_0xe36e('0xd'),_0x1aa596,'request\x20sent');logger[_0xe36e('0xe')](_0xe36e('0xf'),_0x1aa596,_0xe36e('0x10'),JSON[_0xe36e('0x11')](_0x46f239));if(_0x46f239[_0xe36e('0x12')]){if(_0x46f239[_0xe36e('0x12')][_0xe36e('0x13')]===0x1f4){logger[_0xe36e('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x1aa596,_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);return _0x4aebdd(_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);}logger['error'](_0xe36e('0xd'),_0x1aa596,_0x46f239['error']['message']);return _0x74b4b7(_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);}else{logger[_0xe36e('0x15')](_0xe36e('0xd'),_0x1aa596,_0xe36e('0x10'));_0x74b4b7(_0x46f239[_0xe36e('0x16')][_0xe36e('0x14')]);}})[_0xe36e('0x17')](function(_0x387c37){logger[_0xe36e('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x1aa596,_0x387c37);_0x4aebdd(_0x387c37);});});}exports[_0xe36e('0x18')]=function(_0x2184ae){var _0x56c019=this;return new Promise(function(_0x21d9a3,_0x533c06){return db[_0xe36e('0x19')][_0xe36e('0x1a')](_0x2184ae['body'],{'raw':_0x2184ae[_0xe36e('0x1b')]?_0x2184ae[_0xe36e('0x1b')][_0xe36e('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x21e95e){logger[_0xe36e('0x15')](_0xe36e('0x18'),_0x2184ae);logger[_0xe36e('0xe')](_0xe36e('0x18'),_0x2184ae,JSON[_0xe36e('0x11')](_0x21e95e));_0x21d9a3(_0x21e95e);})['catch'](function(_0xd71137){logger[_0xe36e('0x12')](_0xe36e('0x18'),_0xd71137[_0xe36e('0x14')],_0x2184ae);_0x533c06(_0x56c019[_0xe36e('0x12')](0x1f4,_0xd71137['message']));});});}; \ No newline at end of file +var _0xe511=['options','raw','then','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareDetailsReport','SquareDetailsReport','body'];(function(_0x2637ac,_0x377857){var _0x4a5758=function(_0x5d5043){while(--_0x5d5043){_0x2637ac['push'](_0x2637ac['shift']());}};_0x4a5758(++_0x377857);}(_0xe511,0x16f));var _0x1e51=function(_0x31766c,_0x1cd917){_0x31766c=_0x31766c-0x0;var _0x4a19c5=_0xe511[_0x31766c];return _0x4a19c5;};'use strict';var _=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var moment=require('moment');var BPromise=require(_0x1e51('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e51('0x3'));var db=require(_0x1e51('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e51('0x5'))(_0x1e51('0x6'));var config=require(_0x1e51('0x7'));var jayson=require(_0x1e51('0x8'));var client=jayson['client'][_0x1e51('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21ed6b,_0x5c4590,_0x4fa2ba){return new BPromise(function(_0x394ad8,_0x133021){return client['request'](_0x21ed6b,_0x4fa2ba)['then'](function(_0x658941){logger[_0x1e51('0xa')](_0x1e51('0xb'),_0x5c4590,_0x1e51('0xc'));logger[_0x1e51('0xd')](_0x1e51('0xe'),_0x5c4590,'request\x20sent',JSON[_0x1e51('0xf')](_0x658941));if(_0x658941[_0x1e51('0x10')]){if(_0x658941[_0x1e51('0x10')][_0x1e51('0x11')]===0x1f4){logger[_0x1e51('0x10')](_0x1e51('0xb'),_0x5c4590,_0x658941['error'][_0x1e51('0x12')]);return _0x133021(_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);}logger[_0x1e51('0x10')](_0x1e51('0xb'),_0x5c4590,_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);return _0x394ad8(_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);}else{logger[_0x1e51('0xa')]('SquareDetailsReport,\x20%s,\x20%s',_0x5c4590,_0x1e51('0xc'));_0x394ad8(_0x658941[_0x1e51('0x13')][_0x1e51('0x12')]);}})['catch'](function(_0xa3b410){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x5c4590,_0xa3b410);_0x133021(_0xa3b410);});});}exports[_0x1e51('0x14')]=function(_0x27dcad){var _0x40ae4c=this;return new Promise(function(_0x4785a5,_0x4d1aae){return db[_0x1e51('0x15')]['create'](_0x27dcad[_0x1e51('0x16')],{'raw':_0x27dcad['options']?_0x27dcad[_0x1e51('0x17')][_0x1e51('0x18')]===undefined?!![]:![]:!![]})[_0x1e51('0x19')](function(_0x183a95){logger['info']('CreateSquareDetailsReport',_0x27dcad);logger['debug']('CreateSquareDetailsReport',_0x27dcad,JSON[_0x1e51('0xf')](_0x183a95));_0x4785a5(_0x183a95);})['catch'](function(_0x3f7340){logger[_0x1e51('0x10')](_0x1e51('0x14'),_0x3f7340[_0x1e51('0x12')],_0x27dcad);_0x4d1aae(_0x40ae4c[_0x1e51('0x10')](0x1f4,_0x3f7340[_0x1e51('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index f91e755..1aa3afd 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 _0xd4d5=['Router','../../components/auth/service','index','/process/:pid/kill','killProcess','exports'];(function(_0x3358f9,_0x4dc9cc){var _0x23cdcd=function(_0x30c901){while(--_0x30c901){_0x3358f9['push'](_0x3358f9['shift']());}};_0x23cdcd(++_0x4dc9cc);}(_0xd4d5,0x1e6));var _0x5d4d=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xd4d5[_0x4cf98e];return _0x1623ac;};'use strict';var express=require('express');var router=express[_0x5d4d('0x0')]();var auth=require(_0x5d4d('0x1'));var controller=require('./system.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x5d4d('0x2')]);router['get'](_0x5d4d('0x3'),auth['isAuthenticated'](),controller[_0x5d4d('0x4')]);module[_0x5d4d('0x5')]=router; \ No newline at end of file +var _0xe500=['/process/:pid/kill','express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','index'];(function(_0x4ce851,_0x263eea){var _0x126bf1=function(_0x2958a0){while(--_0x2958a0){_0x4ce851['push'](_0x4ce851['shift']());}};_0x126bf1(++_0x263eea);}(_0xe500,0xf9));var _0x0e50=function(_0x1261c2,_0x3ef819){_0x1261c2=_0x1261c2-0x0;var _0x3aabd2=_0xe500[_0x1261c2];return _0x3aabd2;};'use strict';var express=require(_0x0e50('0x0'));var router=express[_0x0e50('0x1')]();var auth=require(_0x0e50('0x2'));var controller=require(_0x0e50('0x3'));router[_0x0e50('0x4')]('/',auth[_0x0e50('0x5')](),controller[_0x0e50('0x6')]);router[_0x0e50('0x4')](_0x0e50('0x7'),auth['isAuthenticated'](),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 535185a..98dd174 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 _0x4d1e=['params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','send','index','getAllData','status','json','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args'];(function(_0x5adc85,_0x4524f1){var _0x350e46=function(_0x541900){while(--_0x541900){_0x5adc85['push'](_0x5adc85['shift']());}};_0x350e46(++_0x4524f1);}(_0x4d1e,0x18e));var _0xe4d1=function(_0x1073ad,_0x44bf0b){_0x1073ad=_0x1073ad-0x0;var _0x528474=_0x4d1e[_0x1073ad];return _0x528474;};'use strict';var info=require(_0xe4d1('0x0'));var exec=require(_0xe4d1('0x1'))['exec'];var logger=require(_0xe4d1('0x2'))('api');var util=require(_0xe4d1('0x3'));var BPromise=require(_0xe4d1('0x4'));var _=require(_0xe4d1('0x5'));function handleError(_0x3fbd85,_0x2e2247,_0x365889){_0x2e2247=_0x2e2247||0x1f4;return function(_0x5a3d4d){logger[_0xe4d1('0x6')](_0xe4d1('0x7'),_0x365889,_0x2e2247,util['inspect'](_0x5a3d4d,{'showHidden':![],'depth':null}));delete _0x5a3d4d[_0xe4d1('0x8')];_0x3fbd85['status'](_0x2e2247)[_0xe4d1('0x9')](_0x5a3d4d);};}exports[_0xe4d1('0xa')]=function(_0x485f09,_0x30e264){return info[_0xe4d1('0xb')]()['then'](function(_0x309731){return _0x30e264[_0xe4d1('0xc')](0xc8)[_0xe4d1('0xd')](_0x309731);})[_0xe4d1('0xe')](function(_0x4d6528){return _0x30e264[_0xe4d1('0xc')](0x1f4)[_0xe4d1('0xd')](_0x4d6528);});};exports[_0xe4d1('0xf')]=function(_0x28ba9a,_0x193466){var _0x2e7ee8=['components/import/cm'];return new BPromise(function(_0x2e3177,_0x4eb976){return exec(util[_0xe4d1('0x10')](_0xe4d1('0x11'),_0x28ba9a[_0xe4d1('0x12')][_0xe4d1('0x13')]),function(_0x430ece,_0x8583bd,_0x5cb13d){if(_0x430ece){return _0x4eb976(_0x430ece);}return _0x2e3177(_0x8583bd);});})['then'](function(_0x26bb2a){var _0x493e1c=![];var _0x53039b=_0x26bb2a[_0xe4d1('0x14')](/\n/);for(var _0x45a613=0x0,_0x208dc4=_0x2e7ee8[_0xe4d1('0x15')];_0x45a613<_0x208dc4,_0x493e1c===![];_0x45a613+=0x1){if(_0x26bb2a[_0xe4d1('0x16')](_0x2e7ee8[_0x45a613])>=0x0){_0x493e1c=!![];}}if(!_0x493e1c){throw new Error(util[_0xe4d1('0x10')](_0xe4d1('0x17'),_0x28ba9a['params']['pid']));}process['kill'](_0x28ba9a[_0xe4d1('0x12')]['pid'],_0xe4d1('0x18'));return _0x193466[_0xe4d1('0xc')](0xc8)[_0xe4d1('0xd')]({'message':util[_0xe4d1('0x10')](_0xe4d1('0x19'),_0x28ba9a[_0xe4d1('0x12')][_0xe4d1('0x13')])});})['catch'](handleError(_0x193466,null,_0xe4d1('0xf')));}; \ No newline at end of file +var _0x8289=['split','length','params','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','exec','api','util','lodash','error','inspect','name','status','send','index','getAllData','then','catch','json','format','pid'];(function(_0x1613d9,_0x2f583e){var _0x1ab5e0=function(_0xbfca35){while(--_0xbfca35){_0x1613d9['push'](_0x1613d9['shift']());}};_0x1ab5e0(++_0x2f583e);}(_0x8289,0x1bb));var _0x9828=function(_0x3b1d66,_0x59476f){_0x3b1d66=_0x3b1d66-0x0;var _0x68ed2d=_0x8289[_0x3b1d66];return _0x68ed2d;};'use strict';var info=require(_0x9828('0x0'));var exec=require('child_process')[_0x9828('0x1')];var logger=require('../../config/logger')(_0x9828('0x2'));var util=require(_0x9828('0x3'));var BPromise=require('bluebird');var _=require(_0x9828('0x4'));function handleError(_0xd2292a,_0x487827,_0x15e5bf){_0x487827=_0x487827||0x1f4;return function(_0x1838a5){logger[_0x9828('0x5')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x15e5bf,_0x487827,util[_0x9828('0x6')](_0x1838a5,{'showHidden':![],'depth':null}));delete _0x1838a5[_0x9828('0x7')];_0xd2292a[_0x9828('0x8')](_0x487827)[_0x9828('0x9')](_0x1838a5);};}exports[_0x9828('0xa')]=function(_0x431a0d,_0x2cf5a4){return info[_0x9828('0xb')]()[_0x9828('0xc')](function(_0x22461e){return _0x2cf5a4[_0x9828('0x8')](0xc8)['json'](_0x22461e);})[_0x9828('0xd')](function(_0x47ef5c){return _0x2cf5a4[_0x9828('0x8')](0x1f4)[_0x9828('0xe')](_0x47ef5c);});};exports['killProcess']=function(_0x35b491,_0x5cadb9){var _0x5a2343=['components/import/cm'];return new BPromise(function(_0x49811c,_0x1f0436){return exec(util[_0x9828('0xf')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x35b491['params'][_0x9828('0x10')]),function(_0x39e704,_0x10c2d6,_0x4ee70d){if(_0x39e704){return _0x1f0436(_0x39e704);}return _0x49811c(_0x10c2d6);});})[_0x9828('0xc')](function(_0x32621d){var _0x44275d=![];var _0x1c7903=_0x32621d[_0x9828('0x11')](/\n/);for(var _0x14fc0d=0x0,_0x19e522=_0x5a2343[_0x9828('0x12')];_0x14fc0d<_0x19e522,_0x44275d===![];_0x14fc0d+=0x1){if(_0x32621d['indexOf'](_0x5a2343[_0x14fc0d])>=0x0){_0x44275d=!![];}}if(!_0x44275d){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x35b491[_0x9828('0x13')][_0x9828('0x10')]));}process[_0x9828('0x14')](_0x35b491[_0x9828('0x13')][_0x9828('0x10')],'SIGINT');return _0x5cadb9['status'](0xc8)[_0x9828('0xe')]({'message':util[_0x9828('0xf')](_0x9828('0x15'),_0x35b491['params'][_0x9828('0x10')])});})[_0x9828('0xd')](handleError(_0x5cadb9,null,_0x9828('0x16')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index ece243a..883a4ee 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 _0x9a19=['delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x45ca8f,_0x3e058b){var _0x447045=function(_0x1133f5){while(--_0x1133f5){_0x45ca8f['push'](_0x45ca8f['shift']());}};_0x447045(++_0x3e058b);}(_0x9a19,0x114));var _0x99a1=function(_0x354164,_0x4c30de){_0x354164=_0x354164-0x0;var _0x5db9a8=_0x9a19[_0x354164];return _0x5db9a8;};'use strict';var multer=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var path=require(_0x99a1('0x2'));var timeout=require('connect-timeout');var express=require(_0x99a1('0x3'));var router=express[_0x99a1('0x4')]();var fs_extra=require(_0x99a1('0x5'));var auth=require(_0x99a1('0x6'));var interaction=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var controller=require(_0x99a1('0x9'));router[_0x99a1('0xa')]('/',auth[_0x99a1('0xb')](),controller[_0x99a1('0xc')]);router[_0x99a1('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x99a1('0xa')](_0x99a1('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x99a1('0xe')]('/',auth[_0x99a1('0xb')](),controller[_0x99a1('0xf')]);router[_0x99a1('0x10')](_0x99a1('0xd'),auth['isAuthenticated'](),controller[_0x99a1('0x11')]);router[_0x99a1('0x12')](_0x99a1('0xd'),auth[_0x99a1('0xb')](),controller[_0x99a1('0x13')]);module[_0x99a1('0x14')]=router; \ No newline at end of file +var _0x99e9=['update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./tag.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put'];(function(_0x1332ef,_0x39f987){var _0x17cef2=function(_0x1b4128){while(--_0x1b4128){_0x1332ef['push'](_0x1332ef['shift']());}};_0x17cef2(++_0x39f987);}(_0x99e9,0xb4));var _0x999e=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x99e9[_0x2aea9e];return _0x430b92;};'use strict';var multer=require('multer');var util=require(_0x999e('0x0'));var path=require(_0x999e('0x1'));var timeout=require(_0x999e('0x2'));var express=require(_0x999e('0x3'));var router=express['Router']();var fs_extra=require(_0x999e('0x4'));var auth=require(_0x999e('0x5'));var interaction=require(_0x999e('0x6'));var config=require('../../config/environment');var controller=require(_0x999e('0x7'));router['get']('/',auth[_0x999e('0x8')](),controller[_0x999e('0x9')]);router[_0x999e('0xa')](_0x999e('0xb'),auth['isAuthenticated'](),controller[_0x999e('0xc')]);router[_0x999e('0xa')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0xe')]);router[_0x999e('0xf')]('/',auth[_0x999e('0x8')](),controller[_0x999e('0x10')]);router[_0x999e('0x11')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0x12')]);router[_0x999e('0x13')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0x14')]);module[_0x999e('0x15')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 31fc0b4..9a09ce0 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 _0x87d9=['STRING','name','#0091EA','sequelize'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x87d9,0x143));var _0x987d=function(_0x6cbe6d,_0x37bba3){_0x6cbe6d=_0x6cbe6d-0x0;var _0x25e1c9=_0x87d9[_0x6cbe6d];return _0x25e1c9;};'use strict';var Sequelize=require(_0x987d('0x0'));module['exports']={'name':{'type':Sequelize[_0x987d('0x1')],'unique':_0x987d('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x987d('0x1')],'defaultValue':_0x987d('0x3')},'description':{'type':Sequelize[_0x987d('0x1')]}}; \ No newline at end of file +var _0x48bc=['STRING','#0091EA','sequelize','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x48bc,0x1b6));var _0xc48b=function(_0x1583e4,_0x4615e2){_0x1583e4=_0x1583e4-0x0;var _0x2e2248=_0x48bc[_0x1583e4];return _0x2e2248;};'use strict';var Sequelize=require(_0xc48b('0x0'));module[_0xc48b('0x1')]={'name':{'type':Sequelize[_0xc48b('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xc48b('0x2')],'defaultValue':_0xc48b('0x3')},'description':{'type':Sequelize[_0xc48b('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index d4810fb..fe62669 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 _0x6a52=['fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','reject','save','then','get','Tags','UserProfileResource','destroy','error','name','send','index','map','rawAttributes','fieldName','type','query','keys','model','attributes','fields','hasOwnProperty','sort','where','filters','pick','filter','merge','Tag','include','findAll','rows','params','intersection','length','includeAll','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x44ab9d,_0x3d060c){var _0x279648=function(_0x1b6d1f){while(--_0x1b6d1f){_0x44ab9d['push'](_0x44ab9d['shift']());}};_0x279648(++_0x3d060c);}(_0x6a52,0x189));var _0x26a5=function(_0x4f3b2d,_0x3bbf46){_0x4f3b2d=_0x4f3b2d-0x0;var _0x3dddfa=_0x6a52[_0x4f3b2d];return _0x3dddfa;};'use strict';var emlformat=require(_0x26a5('0x0'));var rimraf=require(_0x26a5('0x1'));var zipdir=require(_0x26a5('0x2'));var jsonpatch=require(_0x26a5('0x3'));var rp=require(_0x26a5('0x4'));var moment=require(_0x26a5('0x5'));var BPromise=require(_0x26a5('0x6'));var Mustache=require(_0x26a5('0x7'));var util=require(_0x26a5('0x8'));var path=require(_0x26a5('0x9'));var sox=require('sox');var csv=require(_0x26a5('0xa'));var ejs=require(_0x26a5('0xb'));var fs=require('fs');var fs_extra=require(_0x26a5('0xc'));var _=require(_0x26a5('0xd'));var squel=require(_0x26a5('0xe'));var crypto=require('crypto');var jsforce=require(_0x26a5('0xf'));var deskjs=require(_0x26a5('0x10'));var toCsv=require(_0x26a5('0xa'));var querystring=require('querystring');var Papa=require(_0x26a5('0x11'));var Redis=require(_0x26a5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x26a5('0x13'));var as=require(_0x26a5('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x26a5('0x15'))(_0x26a5('0x16'));var utils=require(_0x26a5('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x26a5('0x18'))['db'];function respondWithStatusCode(_0x84763a,_0x44bd0f){_0x44bd0f=_0x44bd0f||0xcc;return function(_0x395dd7){if(_0x395dd7){return _0x84763a[_0x26a5('0x19')](_0x44bd0f);}return _0x84763a['status'](_0x44bd0f)[_0x26a5('0x1a')]();};}function respondWithResult(_0x2c2e52,_0x3d1d0f){_0x3d1d0f=_0x3d1d0f||0xc8;return function(_0x599dd6){if(_0x599dd6){return _0x2c2e52['status'](_0x3d1d0f)[_0x26a5('0x1b')](_0x599dd6);}};}function respondWithFilteredResult(_0x51fb3e,_0x1ce8ac){return function(_0x43a561){if(_0x43a561){var _0x4d7393=typeof _0x1ce8ac[_0x26a5('0x1c')]===_0x26a5('0x1d')&&typeof _0x1ce8ac[_0x26a5('0x1e')]===_0x26a5('0x1d');var _0x3311b8=_0x43a561[_0x26a5('0x1f')];var _0x32e99f=_0x4d7393?0x0:_0x1ce8ac[_0x26a5('0x1c')];var _0x18b06a=_0x4d7393?_0x43a561[_0x26a5('0x1f')]:_0x1ce8ac[_0x26a5('0x1c')]+_0x1ce8ac['limit'];var _0x31baee;if(_0x18b06a>=_0x3311b8){_0x18b06a=_0x3311b8;_0x31baee=0xc8;}else{_0x31baee=0xce;}_0x51fb3e[_0x26a5('0x20')](_0x31baee);return _0x51fb3e['set'](_0x26a5('0x21'),_0x32e99f+'-'+_0x18b06a+'/'+_0x3311b8)[_0x26a5('0x1b')](_0x43a561);}return null;};}function patchUpdates(_0x25b585){return function(_0x1194f2){try{jsonpatch['apply'](_0x1194f2,_0x25b585,!![]);}catch(_0x5ceda5){return BPromise[_0x26a5('0x22')](_0x5ceda5);}return _0x1194f2[_0x26a5('0x23')]();};}function saveUpdates(_0x58b3ed,_0x4b4d37){return function(_0x3a48b8){if(_0x3a48b8){return _0x3a48b8['update'](_0x58b3ed)[_0x26a5('0x24')](function(_0x42ec67){return _0x42ec67;});}return null;};}function removeEntity(_0x3a7694,_0x448504){return function(_0x5828b8){if(_0x5828b8){return _0x5828b8['destroy']()[_0x26a5('0x24')](function(){var _0x5220bd=_0x5828b8[_0x26a5('0x25')]({'plain':!![]});var _0x4325da=_0x26a5('0x26');return db[_0x26a5('0x27')][_0x26a5('0x28')]({'where':{'type':_0x4325da,'resourceId':_0x5220bd['id']}})[_0x26a5('0x24')](function(){return _0x5828b8;});})[_0x26a5('0x24')](function(){_0x3a7694[_0x26a5('0x20')](0xcc)[_0x26a5('0x1a')]();});}};}function handleEntityNotFound(_0x48c0d4,_0x12ae5d){return function(_0x505de2){if(!_0x505de2){_0x48c0d4[_0x26a5('0x19')](0x194);}return _0x505de2;};}function handleError(_0x490431,_0x3d5aaa){_0x3d5aaa=_0x3d5aaa||0x1f4;return function(_0x165654){logger[_0x26a5('0x29')](_0x165654['stack']);if(_0x165654['name']){delete _0x165654[_0x26a5('0x2a')];}_0x490431[_0x26a5('0x20')](_0x3d5aaa)[_0x26a5('0x2b')](_0x165654);};}exports[_0x26a5('0x2c')]=function(_0x4bd187,_0x17509c){var _0x5beb04={},_0x3eafd3={},_0x34a2ac={'count':0x0,'rows':[]};var _0x2f0676=_[_0x26a5('0x2d')](db['Tag'][_0x26a5('0x2e')],function(_0x599ef4){return{'name':_0x599ef4[_0x26a5('0x2f')],'type':_0x599ef4[_0x26a5('0x30')]['key']};});_0x3eafd3['model']=_[_0x26a5('0x2d')](_0x2f0676,_0x26a5('0x2a'));_0x3eafd3[_0x26a5('0x31')]=_[_0x26a5('0x32')](_0x4bd187['query']);_0x3eafd3['filters']=_['intersection'](_0x3eafd3[_0x26a5('0x33')],_0x3eafd3[_0x26a5('0x31')]);_0x5beb04[_0x26a5('0x34')]=_['intersection'](_0x3eafd3[_0x26a5('0x33')],qs[_0x26a5('0x35')](_0x4bd187[_0x26a5('0x31')]['fields']));_0x5beb04[_0x26a5('0x34')]=_0x5beb04[_0x26a5('0x34')]['length']?_0x5beb04['attributes']:_0x3eafd3['model'];if(!_0x4bd187[_0x26a5('0x31')][_0x26a5('0x36')]('nolimit')){_0x5beb04[_0x26a5('0x1e')]=qs[_0x26a5('0x1e')](_0x4bd187['query'][_0x26a5('0x1e')]);_0x5beb04['offset']=qs['offset'](_0x4bd187[_0x26a5('0x31')][_0x26a5('0x1c')]);}_0x5beb04['order']=qs[_0x26a5('0x37')](_0x4bd187['query'][_0x26a5('0x37')]);_0x5beb04[_0x26a5('0x38')]=qs[_0x26a5('0x39')](_[_0x26a5('0x3a')](_0x4bd187[_0x26a5('0x31')],_0x3eafd3[_0x26a5('0x39')]),_0x2f0676);if(_0x4bd187[_0x26a5('0x31')][_0x26a5('0x3b')]){_0x5beb04[_0x26a5('0x38')]=_[_0x26a5('0x3c')](_0x5beb04[_0x26a5('0x38')],{'$or':_[_0x26a5('0x2d')](_0x2f0676,function(_0x150f1b){if(_0x150f1b['type']!=='VIRTUAL'){var _0x308f27={};_0x308f27[_0x150f1b['name']]={'$like':'%'+_0x4bd187[_0x26a5('0x31')][_0x26a5('0x3b')]+'%'};return _0x308f27;}})});}_0x5beb04=_['merge']({},_0x5beb04,_0x4bd187['options']);var _0x1c647a={'where':_0x5beb04[_0x26a5('0x38')]};return db[_0x26a5('0x3d')][_0x26a5('0x1f')](_0x1c647a)[_0x26a5('0x24')](function(_0x581b4c){_0x34a2ac[_0x26a5('0x1f')]=_0x581b4c;if(_0x4bd187[_0x26a5('0x31')]['includeAll']){_0x5beb04[_0x26a5('0x3e')]=[{'all':!![]}];}return db[_0x26a5('0x3d')][_0x26a5('0x3f')](_0x5beb04);})[_0x26a5('0x24')](function(_0x4c4940){_0x34a2ac[_0x26a5('0x40')]=_0x4c4940;return _0x34a2ac;})[_0x26a5('0x24')](respondWithFilteredResult(_0x17509c,_0x5beb04))['catch'](handleError(_0x17509c,null));};exports['show']=function(_0x5931de,_0x1a36b2){var _0x393e8b={'raw':!![],'where':{'id':_0x5931de[_0x26a5('0x41')]['id']}},_0x43556f={};_0x43556f[_0x26a5('0x33')]=_[_0x26a5('0x32')](db[_0x26a5('0x3d')][_0x26a5('0x2e')]);_0x43556f[_0x26a5('0x31')]=_[_0x26a5('0x32')](_0x5931de['query']);_0x43556f[_0x26a5('0x39')]=_['intersection'](_0x43556f[_0x26a5('0x33')],_0x43556f[_0x26a5('0x31')]);_0x393e8b[_0x26a5('0x34')]=_[_0x26a5('0x42')](_0x43556f[_0x26a5('0x33')],qs[_0x26a5('0x35')](_0x5931de[_0x26a5('0x31')][_0x26a5('0x35')]));_0x393e8b[_0x26a5('0x34')]=_0x393e8b[_0x26a5('0x34')][_0x26a5('0x43')]?_0x393e8b['attributes']:_0x43556f['model'];if(_0x5931de[_0x26a5('0x31')][_0x26a5('0x44')]){_0x393e8b[_0x26a5('0x3e')]=[{'all':!![]}];}_0x393e8b=_['merge']({},_0x393e8b,_0x5931de['options']);return db[_0x26a5('0x3d')][_0x26a5('0x45')](_0x393e8b)[_0x26a5('0x24')](handleEntityNotFound(_0x1a36b2,null))['then'](respondWithResult(_0x1a36b2,null))[_0x26a5('0x46')](handleError(_0x1a36b2,null));};exports[_0x26a5('0x47')]=function(_0x134f99,_0x289ea5){return db[_0x26a5('0x3d')][_0x26a5('0x47')](_0x134f99['body'],{})[_0x26a5('0x24')](function(_0x56b600){var _0x1945cc=_0x134f99[_0x26a5('0x48')][_0x26a5('0x25')]({'plain':!![]});if(!_0x1945cc)throw new Error(_0x26a5('0x49'));if(_0x1945cc[_0x26a5('0x4a')]==='user'){var _0x3d94fa=_0x56b600['get']({'plain':!![]});var _0xd23066=_0x26a5('0x26');return db[_0x26a5('0x4b')][_0x26a5('0x45')]({'where':{'name':_0xd23066,'userProfileId':_0x1945cc[_0x26a5('0x4c')]},'raw':!![]})[_0x26a5('0x24')](function(_0x1ff70b){if(_0x1ff70b&&_0x1ff70b['autoAssociation']===0x0){return db[_0x26a5('0x27')][_0x26a5('0x47')]({'name':_0x3d94fa[_0x26a5('0x2a')],'resourceId':_0x3d94fa['id'],'type':_0x1ff70b[_0x26a5('0x2a')],'sectionId':_0x1ff70b['id']},{})[_0x26a5('0x24')](function(){return _0x56b600;});}else{return _0x56b600;}})[_0x26a5('0x46')](function(_0x618177){logger[_0x26a5('0x29')](_0x26a5('0x4d'),_0x618177);throw _0x618177;});}return _0x56b600;})[_0x26a5('0x24')](respondWithResult(_0x289ea5,0xc9))['catch'](handleError(_0x289ea5,null));};exports[_0x26a5('0x4e')]=function(_0x3b3f7e,_0x3f8dfb){if(_0x3b3f7e[_0x26a5('0x4f')]['id']){delete _0x3b3f7e['body']['id'];}return db[_0x26a5('0x3d')]['find']({'where':{'id':_0x3b3f7e['params']['id']}})[_0x26a5('0x24')](handleEntityNotFound(_0x3f8dfb,null))[_0x26a5('0x24')](saveUpdates(_0x3b3f7e[_0x26a5('0x4f')],null))[_0x26a5('0x24')](respondWithResult(_0x3f8dfb,null))['catch'](handleError(_0x3f8dfb,null));};exports['destroy']=function(_0x456f55,_0x2cbbb9){return db[_0x26a5('0x3d')][_0x26a5('0x45')]({'where':{'id':_0x456f55[_0x26a5('0x41')]['id']}})[_0x26a5('0x24')](handleEntityNotFound(_0x2cbbb9,null))[_0x26a5('0x24')](removeEntity(_0x2cbbb9,null))[_0x26a5('0x46')](handleError(_0x2cbbb9,null));};exports[_0x26a5('0x50')]=function(_0x3c1783,_0x21bff5){return db[_0x26a5('0x3d')][_0x26a5('0x50')]()['then'](respondWithResult(_0x21bff5,null))[_0x26a5('0x46')](handleError(_0x21bff5,null));}; \ No newline at end of file +var _0x7a8a=['nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','map','Tag','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x290694,_0x281935){var _0x5a0f2e=function(_0x58d7d4){while(--_0x58d7d4){_0x290694['push'](_0x290694['shift']());}};_0x5a0f2e(++_0x281935);}(_0x7a8a,0x173));var _0xa7a8=function(_0x294ba1,_0x444885){_0x294ba1=_0x294ba1-0x0;var _0x31586d=_0x7a8a[_0x294ba1];return _0x31586d;};'use strict';var emlformat=require(_0xa7a8('0x0'));var rimraf=require(_0xa7a8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa7a8('0x2'));var rp=require(_0xa7a8('0x3'));var moment=require('moment');var BPromise=require(_0xa7a8('0x4'));var Mustache=require('mustache');var util=require(_0xa7a8('0x5'));var path=require(_0xa7a8('0x6'));var sox=require(_0xa7a8('0x7'));var csv=require(_0xa7a8('0x8'));var ejs=require(_0xa7a8('0x9'));var fs=require('fs');var fs_extra=require(_0xa7a8('0xa'));var _=require(_0xa7a8('0xb'));var squel=require(_0xa7a8('0xc'));var crypto=require(_0xa7a8('0xd'));var jsforce=require(_0xa7a8('0xe'));var deskjs=require(_0xa7a8('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa7a8('0x10'));var Papa=require(_0xa7a8('0x11'));var Redis=require('ioredis');var authService=require(_0xa7a8('0x12'));var qs=require(_0xa7a8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa7a8('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xa7a8('0x15'));var config=require(_0xa7a8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa7a8('0x17'))['db'];function respondWithStatusCode(_0x50a639,_0x152482){_0x152482=_0x152482||0xcc;return function(_0x12e02f){if(_0x12e02f){return _0x50a639[_0xa7a8('0x18')](_0x152482);}return _0x50a639[_0xa7a8('0x19')](_0x152482)['end']();};}function respondWithResult(_0x39b319,_0xc7a2ab){_0xc7a2ab=_0xc7a2ab||0xc8;return function(_0x31cf96){if(_0x31cf96){return _0x39b319[_0xa7a8('0x19')](_0xc7a2ab)[_0xa7a8('0x1a')](_0x31cf96);}};}function respondWithFilteredResult(_0x573a84,_0x2f6fae){return function(_0x5b3f36){if(_0x5b3f36){var _0x598989=typeof _0x2f6fae['offset']==='undefined'&&typeof _0x2f6fae[_0xa7a8('0x1b')]===_0xa7a8('0x1c');var _0x169586=_0x5b3f36[_0xa7a8('0x1d')];var _0x37d724=_0x598989?0x0:_0x2f6fae[_0xa7a8('0x1e')];var _0x346d96=_0x598989?_0x5b3f36[_0xa7a8('0x1d')]:_0x2f6fae[_0xa7a8('0x1e')]+_0x2f6fae[_0xa7a8('0x1b')];var _0x40ca84;if(_0x346d96>=_0x169586){_0x346d96=_0x169586;_0x40ca84=0xc8;}else{_0x40ca84=0xce;}_0x573a84[_0xa7a8('0x19')](_0x40ca84);return _0x573a84[_0xa7a8('0x1f')](_0xa7a8('0x20'),_0x37d724+'-'+_0x346d96+'/'+_0x169586)[_0xa7a8('0x1a')](_0x5b3f36);}return null;};}function patchUpdates(_0x507f63){return function(_0x5685c3){try{jsonpatch[_0xa7a8('0x21')](_0x5685c3,_0x507f63,!![]);}catch(_0x52c547){return BPromise[_0xa7a8('0x22')](_0x52c547);}return _0x5685c3['save']();};}function saveUpdates(_0x3ab84e,_0x5dd4e4){return function(_0x5dff6b){if(_0x5dff6b){return _0x5dff6b[_0xa7a8('0x23')](_0x3ab84e)[_0xa7a8('0x24')](function(_0x2176ce){return _0x2176ce;});}return null;};}function removeEntity(_0x3c19e3,_0x4e31b6){return function(_0x2506b0){if(_0x2506b0){return _0x2506b0[_0xa7a8('0x25')]()[_0xa7a8('0x24')](function(){var _0x1c1a00=_0x2506b0[_0xa7a8('0x26')]({'plain':!![]});var _0xe3b9c7='Tags';return db[_0xa7a8('0x27')][_0xa7a8('0x25')]({'where':{'type':_0xe3b9c7,'resourceId':_0x1c1a00['id']}})[_0xa7a8('0x24')](function(){return _0x2506b0;});})['then'](function(){_0x3c19e3[_0xa7a8('0x19')](0xcc)[_0xa7a8('0x28')]();});}};}function handleEntityNotFound(_0x6530d9,_0x41a801){return function(_0x22e9f9){if(!_0x22e9f9){_0x6530d9['sendStatus'](0x194);}return _0x22e9f9;};}function handleError(_0x26ef6e,_0x106289){_0x106289=_0x106289||0x1f4;return function(_0x5be739){logger[_0xa7a8('0x29')](_0x5be739[_0xa7a8('0x2a')]);if(_0x5be739[_0xa7a8('0x2b')]){delete _0x5be739[_0xa7a8('0x2b')];}_0x26ef6e[_0xa7a8('0x19')](_0x106289)[_0xa7a8('0x2c')](_0x5be739);};}exports['index']=function(_0x3707d3,_0xfdc4c7){var _0x2f4430={},_0x3210ea={},_0x4ff2b5={'count':0x0,'rows':[]};var _0x444b09=_[_0xa7a8('0x2d')](db[_0xa7a8('0x2e')][_0xa7a8('0x2f')],function(_0x5ee17c){return{'name':_0x5ee17c[_0xa7a8('0x30')],'type':_0x5ee17c[_0xa7a8('0x31')][_0xa7a8('0x32')]};});_0x3210ea[_0xa7a8('0x33')]=_[_0xa7a8('0x2d')](_0x444b09,_0xa7a8('0x2b'));_0x3210ea[_0xa7a8('0x34')]=_['keys'](_0x3707d3[_0xa7a8('0x34')]);_0x3210ea[_0xa7a8('0x35')]=_[_0xa7a8('0x36')](_0x3210ea[_0xa7a8('0x33')],_0x3210ea['query']);_0x2f4430[_0xa7a8('0x37')]=_[_0xa7a8('0x36')](_0x3210ea[_0xa7a8('0x33')],qs[_0xa7a8('0x38')](_0x3707d3['query'][_0xa7a8('0x38')]));_0x2f4430[_0xa7a8('0x37')]=_0x2f4430[_0xa7a8('0x37')][_0xa7a8('0x39')]?_0x2f4430['attributes']:_0x3210ea[_0xa7a8('0x33')];if(!_0x3707d3[_0xa7a8('0x34')][_0xa7a8('0x3a')](_0xa7a8('0x3b'))){_0x2f4430[_0xa7a8('0x1b')]=qs[_0xa7a8('0x1b')](_0x3707d3[_0xa7a8('0x34')][_0xa7a8('0x1b')]);_0x2f4430[_0xa7a8('0x1e')]=qs[_0xa7a8('0x1e')](_0x3707d3[_0xa7a8('0x34')][_0xa7a8('0x1e')]);}_0x2f4430[_0xa7a8('0x3c')]=qs[_0xa7a8('0x3d')](_0x3707d3[_0xa7a8('0x34')][_0xa7a8('0x3d')]);_0x2f4430[_0xa7a8('0x3e')]=qs[_0xa7a8('0x35')](_['pick'](_0x3707d3[_0xa7a8('0x34')],_0x3210ea[_0xa7a8('0x35')]),_0x444b09);if(_0x3707d3[_0xa7a8('0x34')][_0xa7a8('0x3f')]){_0x2f4430[_0xa7a8('0x3e')]=_[_0xa7a8('0x40')](_0x2f4430[_0xa7a8('0x3e')],{'$or':_['map'](_0x444b09,function(_0x34777e){if(_0x34777e[_0xa7a8('0x31')]!==_0xa7a8('0x41')){var _0x5138e4={};_0x5138e4[_0x34777e['name']]={'$like':'%'+_0x3707d3['query'][_0xa7a8('0x3f')]+'%'};return _0x5138e4;}})});}_0x2f4430=_[_0xa7a8('0x40')]({},_0x2f4430,_0x3707d3[_0xa7a8('0x42')]);var _0x19ba42={'where':_0x2f4430['where']};return db['Tag'][_0xa7a8('0x1d')](_0x19ba42)['then'](function(_0x239fcf){_0x4ff2b5[_0xa7a8('0x1d')]=_0x239fcf;if(_0x3707d3[_0xa7a8('0x34')][_0xa7a8('0x43')]){_0x2f4430[_0xa7a8('0x44')]=[{'all':!![]}];}return db[_0xa7a8('0x2e')][_0xa7a8('0x45')](_0x2f4430);})[_0xa7a8('0x24')](function(_0x5ec863){_0x4ff2b5[_0xa7a8('0x46')]=_0x5ec863;return _0x4ff2b5;})['then'](respondWithFilteredResult(_0xfdc4c7,_0x2f4430))[_0xa7a8('0x47')](handleError(_0xfdc4c7,null));};exports[_0xa7a8('0x48')]=function(_0xc9396c,_0x5aa1d1){var _0x1f00bb={'raw':!![],'where':{'id':_0xc9396c[_0xa7a8('0x49')]['id']}},_0x34c317={};_0x34c317['model']=_[_0xa7a8('0x4a')](db[_0xa7a8('0x2e')][_0xa7a8('0x2f')]);_0x34c317[_0xa7a8('0x34')]=_[_0xa7a8('0x4a')](_0xc9396c[_0xa7a8('0x34')]);_0x34c317[_0xa7a8('0x35')]=_[_0xa7a8('0x36')](_0x34c317['model'],_0x34c317[_0xa7a8('0x34')]);_0x1f00bb[_0xa7a8('0x37')]=_[_0xa7a8('0x36')](_0x34c317[_0xa7a8('0x33')],qs['fields'](_0xc9396c[_0xa7a8('0x34')][_0xa7a8('0x38')]));_0x1f00bb[_0xa7a8('0x37')]=_0x1f00bb[_0xa7a8('0x37')]['length']?_0x1f00bb['attributes']:_0x34c317[_0xa7a8('0x33')];if(_0xc9396c['query'][_0xa7a8('0x43')]){_0x1f00bb[_0xa7a8('0x44')]=[{'all':!![]}];}_0x1f00bb=_['merge']({},_0x1f00bb,_0xc9396c[_0xa7a8('0x42')]);return db[_0xa7a8('0x2e')][_0xa7a8('0x4b')](_0x1f00bb)[_0xa7a8('0x24')](handleEntityNotFound(_0x5aa1d1,null))[_0xa7a8('0x24')](respondWithResult(_0x5aa1d1,null))[_0xa7a8('0x47')](handleError(_0x5aa1d1,null));};exports[_0xa7a8('0x4c')]=function(_0x69aa92,_0x2b62cc){return db[_0xa7a8('0x2e')]['create'](_0x69aa92[_0xa7a8('0x4d')],{})[_0xa7a8('0x24')](function(_0x553b86){var _0x5123c4=_0x69aa92[_0xa7a8('0x4e')][_0xa7a8('0x26')]({'plain':!![]});if(!_0x5123c4)throw new Error(_0xa7a8('0x4f'));if(_0x5123c4[_0xa7a8('0x50')]===_0xa7a8('0x4e')){var _0x6c1272=_0x553b86[_0xa7a8('0x26')]({'plain':!![]});var _0x4af1f6=_0xa7a8('0x51');return db['UserProfileSection'][_0xa7a8('0x4b')]({'where':{'name':_0x4af1f6,'userProfileId':_0x5123c4[_0xa7a8('0x52')]},'raw':!![]})['then'](function(_0x57bf7c){if(_0x57bf7c&&_0x57bf7c[_0xa7a8('0x53')]===0x0){return db[_0xa7a8('0x27')][_0xa7a8('0x4c')]({'name':_0x6c1272[_0xa7a8('0x2b')],'resourceId':_0x6c1272['id'],'type':_0x57bf7c[_0xa7a8('0x2b')],'sectionId':_0x57bf7c['id']},{})[_0xa7a8('0x24')](function(){return _0x553b86;});}else{return _0x553b86;}})[_0xa7a8('0x47')](function(_0x3f5f86){logger['error'](_0xa7a8('0x54'),_0x3f5f86);throw _0x3f5f86;});}return _0x553b86;})[_0xa7a8('0x24')](respondWithResult(_0x2b62cc,0xc9))['catch'](handleError(_0x2b62cc,null));};exports[_0xa7a8('0x23')]=function(_0x2e89da,_0x5a43a6){if(_0x2e89da[_0xa7a8('0x4d')]['id']){delete _0x2e89da[_0xa7a8('0x4d')]['id'];}return db['Tag'][_0xa7a8('0x4b')]({'where':{'id':_0x2e89da[_0xa7a8('0x49')]['id']}})[_0xa7a8('0x24')](handleEntityNotFound(_0x5a43a6,null))[_0xa7a8('0x24')](saveUpdates(_0x2e89da[_0xa7a8('0x4d')],null))[_0xa7a8('0x24')](respondWithResult(_0x5a43a6,null))[_0xa7a8('0x47')](handleError(_0x5a43a6,null));};exports['destroy']=function(_0x1e8ade,_0x275fbb){return db[_0xa7a8('0x2e')][_0xa7a8('0x4b')]({'where':{'id':_0x1e8ade['params']['id']}})[_0xa7a8('0x24')](handleEntityNotFound(_0x275fbb,null))[_0xa7a8('0x24')](removeEntity(_0x275fbb,null))[_0xa7a8('0x47')](handleError(_0x275fbb,null));};exports[_0xa7a8('0x55')]=function(_0x143581,_0x1e7982){return db['Tag'][_0xa7a8('0x55')]()[_0xa7a8('0x24')](respondWithResult(_0x1e7982,null))[_0xa7a8('0x47')](handleError(_0x1e7982,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 78b1c7a..dd9e778 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 _0x628e=['path','./tag.attributes','exports','Tag','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x175e95,_0x593af4){var _0x368446=function(_0x81cedf){while(--_0x81cedf){_0x175e95['push'](_0x175e95['shift']());}};_0x368446(++_0x593af4);}(_0x628e,0xe9));var _0xe628=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x628e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe628('0x0'));var util=require(_0xe628('0x1'));var logger=require(_0xe628('0x2'))(_0xe628('0x3'));var moment=require(_0xe628('0x4'));var BPromise=require(_0xe628('0x5'));var rp=require(_0xe628('0x6'));var fs=require('fs');var path=require(_0xe628('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe628('0x8'));module[_0xe628('0x9')]=function(_0x5047ae,_0x55c28e){return _0x5047ae['define'](_0xe628('0xa'),attributes,{'tableName':_0xe628('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5119=['../../config/environment','tools_tags','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5119,0xc0));var _0x9511=function(_0x334201,_0x39f06f){_0x334201=_0x334201-0x0;var _0x134700=_0x5119[_0x334201];return _0x134700;};'use strict';var _=require(_0x9511('0x0'));var util=require('util');var logger=require(_0x9511('0x1'))(_0x9511('0x2'));var moment=require(_0x9511('0x3'));var BPromise=require(_0x9511('0x4'));var rp=require(_0x9511('0x5'));var fs=require('fs');var path=require(_0x9511('0x6'));var rimraf=require(_0x9511('0x7'));var config=require(_0x9511('0x8'));var attributes=require('./tag.attributes');module['exports']=function(_0x5575b5,_0xda3c1a){return _0x5575b5['define']('Tag',attributes,{'tableName':_0x9511('0x9'),'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 29dc2bb..bc8bf6d 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 _0xbd50=['Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbd50,0x196));var _0x0bd5=function(_0x5a24fc,_0x8d4266){_0x5a24fc=_0x5a24fc-0x0;var _0xe44766=_0xbd50[_0x5a24fc];return _0xe44766;};'use strict';var _=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var moment=require(_0x0bd5('0x2'));var BPromise=require('bluebird');var rs=require(_0x0bd5('0x3'));var fs=require('fs');var Redis=require(_0x0bd5('0x4'));var db=require(_0x0bd5('0x5'))['db'];var utils=require(_0x0bd5('0x6'));var logger=require(_0x0bd5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0bd5('0x8')][_0x0bd5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcc6cfa,_0x2c0db1,_0x1b99f3){return new BPromise(function(_0x5ebe64,_0x47e78d){return client[_0x0bd5('0xa')](_0xcc6cfa,_0x1b99f3)[_0x0bd5('0xb')](function(_0x259f4c){logger['info'](_0x0bd5('0xc'),_0x2c0db1,_0x0bd5('0xd'));logger['debug'](_0x0bd5('0xe'),_0x2c0db1,_0x0bd5('0xd'),JSON['stringify'](_0x259f4c));if(_0x259f4c[_0x0bd5('0xf')]){if(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x10')]===0x1f4){logger['error'](_0x0bd5('0xc'),_0x2c0db1,_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);return _0x47e78d(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);}logger[_0x0bd5('0xf')](_0x0bd5('0xc'),_0x2c0db1,_0x259f4c[_0x0bd5('0xf')]['message']);return _0x5ebe64(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);}else{logger['info'](_0x0bd5('0xc'),_0x2c0db1,_0x0bd5('0xd'));_0x5ebe64(_0x259f4c[_0x0bd5('0x12')][_0x0bd5('0x11')]);}})['catch'](function(_0x14f32c){logger[_0x0bd5('0xf')](_0x0bd5('0xc'),_0x2c0db1,_0x14f32c);_0x47e78d(_0x14f32c);});});} \ No newline at end of file +var _0x207c=['message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error'];(function(_0x1ee211,_0x5dca96){var _0x3d5fc7=function(_0x5d1f32){while(--_0x5d1f32){_0x1ee211['push'](_0x1ee211['shift']());}};_0x3d5fc7(++_0x5dca96);}(_0x207c,0x1e8));var _0xc207=function(_0x251f27,_0x1237bc){_0x251f27=_0x251f27-0x0;var _0x452654=_0x207c[_0x251f27];return _0x452654;};'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});function respondWithRpcPromise(_0x314561,_0x3395e4,_0x59ff6f){return new BPromise(function(_0x25cb97,_0xad159b){return client[_0xc207('0x9')](_0x314561,_0x59ff6f)['then'](function(_0xffae6c){logger[_0xc207('0xa')](_0xc207('0xb'),_0x3395e4,_0xc207('0xc'));logger[_0xc207('0xd')](_0xc207('0xe'),_0x3395e4,'request\x20sent',JSON['stringify'](_0xffae6c));if(_0xffae6c['error']){if(_0xffae6c[_0xc207('0xf')]['code']===0x1f4){logger[_0xc207('0xf')](_0xc207('0xb'),_0x3395e4,_0xffae6c['error'][_0xc207('0x10')]);return _0xad159b(_0xffae6c[_0xc207('0xf')][_0xc207('0x10')]);}logger[_0xc207('0xf')](_0xc207('0xb'),_0x3395e4,_0xffae6c['error'][_0xc207('0x10')]);return _0x25cb97(_0xffae6c[_0xc207('0xf')][_0xc207('0x10')]);}else{logger[_0xc207('0xa')]('Tag,\x20%s,\x20%s',_0x3395e4,'request\x20sent');_0x25cb97(_0xffae6c['result'][_0xc207('0x10')]);}})[_0xc207('0x11')](function(_0x3d9c7b){logger[_0xc207('0xf')]('Tag,\x20%s,\x20%s',_0x3395e4,_0x3d9c7b);_0xad159b(_0x3d9c7b);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 0f6af35..ddbc134 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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 53721bb..2335868 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 _0x0713=['STRING','name'];(function(_0x4bbcc1,_0x594e19){var _0x34435b=function(_0x124582){while(--_0x124582){_0x4bbcc1['push'](_0x4bbcc1['shift']());}};_0x34435b(++_0x594e19);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x46ced5,_0x5dc6f6){var _0x599d5d=function(_0x6fa289){while(--_0x6fa289){_0x46ced5['push'](_0x46ced5['shift']());}};_0x599d5d(++_0x5dc6f6);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 4a5c4e6..3eeb991 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 _0x36d6=['UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','end','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','add','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Sms','Whatsapp','transaction','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','online','voicePause','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','interface','all','UserVoicePrefix','removeAgents','Queue:remove','order','getAgents','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./team.socket','register','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','update','then','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams'];(function(_0x1cfb74,_0x4dbeca){var _0x4ca325=function(_0x4473d6){while(--_0x4473d6){_0x1cfb74['push'](_0x1cfb74['shift']());}};_0x4ca325(++_0x4dbeca);}(_0x36d6,0x18d));var _0x636d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36d6[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x636d('0x0'));var jsonpatch=require(_0x636d('0x1'));var rp=require(_0x636d('0x2'));var moment=require('moment');var BPromise=require(_0x636d('0x3'));var Mustache=require(_0x636d('0x4'));var util=require(_0x636d('0x5'));var path=require(_0x636d('0x6'));var sox=require(_0x636d('0x7'));var csv=require(_0x636d('0x8'));var ejs=require(_0x636d('0x9'));var fs=require('fs');var fs_extra=require(_0x636d('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x636d('0xb'));var jsforce=require(_0x636d('0xc'));var deskjs=require(_0x636d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x636d('0xe'));var Papa=require(_0x636d('0xf'));var Redis=require(_0x636d('0x10'));var authService=require(_0x636d('0x11'));var qs=require(_0x636d('0x12'));var as=require(_0x636d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x636d('0x14'));var config=require(_0x636d('0x15'));var licenseUtil=require(_0x636d('0x16'));var db=require('../../mysqldb')['db'];config[_0x636d('0x17')]=_[_0x636d('0x18')](config['redis'],{'host':_0x636d('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x636d('0x17')]));require(_0x636d('0x1a'))[_0x636d('0x1b')](socket);function respondWithStatusCode(_0x53dab0,_0x2eece7){_0x2eece7=_0x2eece7||0xcc;return function(_0x1a92d9){if(_0x1a92d9){return _0x53dab0[_0x636d('0x1c')](_0x2eece7);}return _0x53dab0[_0x636d('0x1d')](_0x2eece7)['end']();};}function respondWithResult(_0x157c08,_0x1ba9dc){_0x1ba9dc=_0x1ba9dc||0xc8;return function(_0x2a02a){if(_0x2a02a){return _0x157c08[_0x636d('0x1d')](_0x1ba9dc)['json'](_0x2a02a);}};}function respondWithFilteredResult(_0x57c6ff,_0x59e5d4){return function(_0x36e421){if(_0x36e421){var _0x137375=typeof _0x59e5d4[_0x636d('0x1e')]===_0x636d('0x1f')&&typeof _0x59e5d4[_0x636d('0x20')]===_0x636d('0x1f');var _0x1a7a3a=_0x36e421[_0x636d('0x21')];var _0x21c36b=_0x137375?0x0:_0x59e5d4[_0x636d('0x1e')];var _0x1b62d0=_0x137375?_0x36e421[_0x636d('0x21')]:_0x59e5d4[_0x636d('0x1e')]+_0x59e5d4[_0x636d('0x20')];var _0x406cb1;if(_0x1b62d0>=_0x1a7a3a){_0x1b62d0=_0x1a7a3a;_0x406cb1=0xc8;}else{_0x406cb1=0xce;}_0x57c6ff[_0x636d('0x1d')](_0x406cb1);return _0x57c6ff[_0x636d('0x22')]('Content-Range',_0x21c36b+'-'+_0x1b62d0+'/'+_0x1a7a3a)[_0x636d('0x23')](_0x36e421);}return null;};}function patchUpdates(_0x200da4){return function(_0x294188){try{jsonpatch[_0x636d('0x24')](_0x294188,_0x200da4,!![]);}catch(_0x144002){return BPromise[_0x636d('0x25')](_0x144002);}return _0x294188['save']();};}function saveUpdates(_0xd5121d,_0x5d970d){return function(_0x183179){if(_0x183179){return _0x183179[_0x636d('0x26')](_0xd5121d)[_0x636d('0x27')](function(_0x3b785c){return _0x3b785c;});}return null;};}function handleEntityNotFound(_0x463d6b,_0x12816d){return function(_0x347e0d){if(!_0x347e0d){_0x463d6b['sendStatus'](0x194);}return _0x347e0d;};}function handleError(_0x16c719,_0x297738){_0x297738=_0x297738||0x1f4;return function(_0x12372b){logger['error'](_0x12372b[_0x636d('0x28')]);if(_0x12372b[_0x636d('0x29')]){delete _0x12372b['name'];}_0x16c719['status'](_0x297738)[_0x636d('0x2a')](_0x12372b);};}exports[_0x636d('0x2b')]=function(_0x18fb27,_0x4be4db){var _0x437d8e={},_0x53fc6c={},_0x1d2351={'count':0x0,'rows':[]};var _0x5d323b=_[_0x636d('0x2c')](db[_0x636d('0x2d')][_0x636d('0x2e')],function(_0x516765){return{'name':_0x516765[_0x636d('0x2f')],'type':_0x516765[_0x636d('0x30')][_0x636d('0x31')]};});_0x53fc6c[_0x636d('0x32')]=_[_0x636d('0x2c')](_0x5d323b,_0x636d('0x29'));_0x53fc6c[_0x636d('0x33')]=_[_0x636d('0x34')](_0x18fb27[_0x636d('0x33')]);_0x53fc6c[_0x636d('0x35')]=_[_0x636d('0x36')](_0x53fc6c[_0x636d('0x32')],_0x53fc6c['query']);_0x437d8e[_0x636d('0x37')]=_[_0x636d('0x36')](_0x53fc6c[_0x636d('0x32')],qs[_0x636d('0x38')](_0x18fb27['query'][_0x636d('0x38')]));_0x437d8e[_0x636d('0x37')]=_0x437d8e[_0x636d('0x37')][_0x636d('0x39')]?_0x437d8e[_0x636d('0x37')]:_0x53fc6c[_0x636d('0x32')];if(!_0x18fb27['query'][_0x636d('0x3a')](_0x636d('0x3b'))){_0x437d8e[_0x636d('0x20')]=qs[_0x636d('0x20')](_0x18fb27[_0x636d('0x33')][_0x636d('0x20')]);_0x437d8e[_0x636d('0x1e')]=qs['offset'](_0x18fb27[_0x636d('0x33')]['offset']);}_0x437d8e['order']=qs[_0x636d('0x3c')](_0x18fb27[_0x636d('0x33')]['sort']);_0x437d8e[_0x636d('0x3d')]=qs[_0x636d('0x35')](_[_0x636d('0x3e')](_0x18fb27['query'],_0x53fc6c['filters']),_0x5d323b);if(_0x18fb27[_0x636d('0x33')][_0x636d('0x3f')]){_0x437d8e[_0x636d('0x3d')]=_[_0x636d('0x40')](_0x437d8e[_0x636d('0x3d')],{'$or':_[_0x636d('0x2c')](_0x5d323b,function(_0x329a20){if(_0x329a20[_0x636d('0x30')]!==_0x636d('0x41')){var _0x16294e={};_0x16294e[_0x329a20[_0x636d('0x29')]]={'$like':'%'+_0x18fb27['query']['filter']+'%'};return _0x16294e;}})});}_0x437d8e=_['merge']({},_0x437d8e,_0x18fb27[_0x636d('0x42')]);var _0x7257f4={'where':_0x437d8e['where']};return db[_0x636d('0x2d')]['count'](_0x7257f4)[_0x636d('0x27')](function(_0x4f002c){_0x1d2351[_0x636d('0x21')]=_0x4f002c;if(_0x18fb27[_0x636d('0x33')][_0x636d('0x43')]){_0x437d8e[_0x636d('0x44')]=[{'all':!![]}];}return db[_0x636d('0x2d')][_0x636d('0x45')](_0x437d8e);})[_0x636d('0x27')](function(_0x17505c){_0x1d2351['rows']=_0x17505c;return _0x1d2351;})[_0x636d('0x27')](respondWithFilteredResult(_0x4be4db,_0x437d8e))[_0x636d('0x46')](handleError(_0x4be4db,null));};exports[_0x636d('0x47')]=function(_0x4775da,_0x4fa0d3){var _0x1754a8={'raw':![],'where':{'id':_0x4775da[_0x636d('0x48')]['id']}},_0x215a5c={};_0x215a5c[_0x636d('0x32')]=_['keys'](db[_0x636d('0x2d')][_0x636d('0x2e')]);_0x215a5c[_0x636d('0x33')]=_[_0x636d('0x34')](_0x4775da[_0x636d('0x33')]);_0x215a5c['filters']=_[_0x636d('0x36')](_0x215a5c[_0x636d('0x32')],_0x215a5c[_0x636d('0x33')]);_0x1754a8[_0x636d('0x37')]=_[_0x636d('0x36')](_0x215a5c[_0x636d('0x32')],qs[_0x636d('0x38')](_0x4775da['query'][_0x636d('0x38')]));_0x1754a8[_0x636d('0x37')]=_0x1754a8[_0x636d('0x37')][_0x636d('0x39')]?_0x1754a8[_0x636d('0x37')]:_0x215a5c[_0x636d('0x32')];if(_0x4775da['query'][_0x636d('0x43')]){_0x1754a8[_0x636d('0x44')]=[{'all':!![]}];}_0x1754a8=_[_0x636d('0x40')]({},_0x1754a8,_0x4775da['options']);return db[_0x636d('0x2d')]['find'](_0x1754a8)[_0x636d('0x27')](handleEntityNotFound(_0x4fa0d3,null))[_0x636d('0x27')](respondWithResult(_0x4fa0d3,null))['catch'](handleError(_0x4fa0d3,null));};exports[_0x636d('0x49')]=function(_0x103ab2,_0x45255f){return db[_0x636d('0x2d')][_0x636d('0x49')](_0x103ab2[_0x636d('0x4a')],{})[_0x636d('0x27')](function(_0x2496be){var _0x2ed912=_0x103ab2[_0x636d('0x4b')][_0x636d('0x4c')]({'plain':!![]});if(!_0x2ed912)throw new Error(_0x636d('0x4d'));if(_0x2ed912[_0x636d('0x4e')]==='user'){var _0x40cd40=_0x2496be[_0x636d('0x4c')]({'plain':!![]});var _0x583c72=_0x636d('0x4f');return db[_0x636d('0x50')][_0x636d('0x51')]({'where':{'name':_0x583c72,'userProfileId':_0x2ed912[_0x636d('0x52')]},'raw':!![]})['then'](function(_0x5e911d){if(_0x5e911d&&_0x5e911d[_0x636d('0x53')]===0x0){return db[_0x636d('0x54')]['create']({'name':_0x40cd40[_0x636d('0x29')],'resourceId':_0x40cd40['id'],'type':_0x5e911d[_0x636d('0x29')],'sectionId':_0x5e911d['id']},{})[_0x636d('0x27')](function(){return _0x2496be;});}else{return _0x2496be;}})[_0x636d('0x46')](function(_0x401c34){logger[_0x636d('0x55')](_0x636d('0x56'),_0x401c34);throw _0x401c34;});}return _0x2496be;})[_0x636d('0x27')](respondWithResult(_0x45255f,0xc9))[_0x636d('0x46')](handleError(_0x45255f,null));};exports['update']=function(_0x264707,_0x5a1e8e){if(_0x264707['body']['id']){delete _0x264707['body']['id'];}return db[_0x636d('0x2d')][_0x636d('0x51')]({'where':{'id':_0x264707['params']['id']}})[_0x636d('0x27')](handleEntityNotFound(_0x5a1e8e,null))['then'](saveUpdates(_0x264707[_0x636d('0x4a')],null))[_0x636d('0x27')](respondWithResult(_0x5a1e8e,null))[_0x636d('0x46')](handleError(_0x5a1e8e,null));};exports[_0x636d('0x57')]=function(_0x16b9de,_0x2166bf){var _0x2737ae=_0x16b9de['params']['id'];var _0x3e9903=[];return db[_0x636d('0x58')]['transaction'](function(_0x19b565){var _0x5164a5=_0x636d('0x59')+_0x2737ae;return db[_0x636d('0x58')][_0x636d('0x33')](_0x5164a5,{'type':db['Sequelize'][_0x636d('0x5a')][_0x636d('0x5b')],'raw':!![],'transaction':_0x19b565})['then'](function(_0x355e21){_0x3e9903=_['map'](_0x355e21,function(_0x2e423b){return Number(_0x2e423b[_0x636d('0x5c')]);});})['then'](function(){var _0x2e2856=_0x636d('0x5d')+_0x2737ae;return db[_0x636d('0x58')][_0x636d('0x33')](_0x2e2856,{'type':db['Sequelize'][_0x636d('0x5a')][_0x636d('0x5b')],'raw':!![],'transaction':_0x19b565});})[_0x636d('0x27')](function(_0x38401b){var _0x36266a=_[_0x636d('0x2c')](_0x38401b,function(_0x59e55f){return Number(_0x59e55f[_0x636d('0x5e')]);});return db[_0x636d('0x5f')][_0x636d('0x57')]({'where':{'UserId':{'$in':_0x3e9903},'VoiceQueueId':{'$in':_0x36266a}},'transaction':_0x19b565});})[_0x636d('0x27')](function(){var _0x30af05=_0x636d('0x60')+_0x2737ae;return db[_0x636d('0x58')]['query'](_0x30af05,{'type':db[_0x636d('0x61')][_0x636d('0x5a')][_0x636d('0x5b')],'raw':!![],'transaction':_0x19b565});})[_0x636d('0x27')](function(_0x5c4b00){var _0x37de06=_['map'](_0x5c4b00,function(_0x43a1f8){return Number(_0x43a1f8['MailQueueId']);});return db[_0x636d('0x62')][_0x636d('0x57')]({'where':{'UserId':{'$in':_0x3e9903},'MailQueueId':{'$in':_0x37de06}},'transaction':_0x19b565});})[_0x636d('0x27')](function(){var _0x17ac8c=_0x636d('0x63')+_0x2737ae;return db[_0x636d('0x58')][_0x636d('0x33')](_0x17ac8c,{'type':db[_0x636d('0x61')][_0x636d('0x5a')][_0x636d('0x5b')],'raw':!![],'transaction':_0x19b565});})[_0x636d('0x27')](function(_0x3357ba){var _0x4bada0=_[_0x636d('0x2c')](_0x3357ba,function(_0xc199c7){return Number(_0xc199c7[_0x636d('0x64')]);});return db[_0x636d('0x65')][_0x636d('0x57')]({'where':{'UserId':{'$in':_0x3e9903},'SmsQueueId':{'$in':_0x4bada0}},'transaction':_0x19b565});})[_0x636d('0x27')](function(){var _0x3f2fd1=_0x636d('0x66')+_0x2737ae;return db[_0x636d('0x58')][_0x636d('0x33')](_0x3f2fd1,{'type':db[_0x636d('0x61')]['QueryTypes'][_0x636d('0x5b')],'raw':!![],'transaction':_0x19b565});})[_0x636d('0x27')](function(_0x2158d5){var _0x17689f=_[_0x636d('0x2c')](_0x2158d5,function(_0x53e114){return Number(_0x53e114['ChatQueueId']);});return db[_0x636d('0x67')][_0x636d('0x57')]({'where':{'UserId':{'$in':_0x3e9903},'ChatQueueId':{'$in':_0x17689f}},'transaction':_0x19b565});})[_0x636d('0x27')](function(){var _0x11978a='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2737ae;return db[_0x636d('0x58')][_0x636d('0x33')](_0x11978a,{'type':db[_0x636d('0x61')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x19b565});})[_0x636d('0x27')](function(_0x435d85){var _0x507e36=_[_0x636d('0x2c')](_0x435d85,function(_0x596bbf){return Number(_0x596bbf[_0x636d('0x68')]);});return db[_0x636d('0x69')][_0x636d('0x57')]({'where':{'UserId':{'$in':_0x3e9903},'FaxQueueId':{'$in':_0x507e36}},'transaction':_0x19b565});})['then'](function(){var _0x522d98=_0x636d('0x6a')+_0x2737ae;return db['sequelize']['query'](_0x522d98,{'type':db[_0x636d('0x61')][_0x636d('0x5a')][_0x636d('0x5b')],'raw':!![],'transaction':_0x19b565});})['then'](function(_0x1b91d4){var _0x37fabc=_[_0x636d('0x2c')](_0x1b91d4,function(_0x24b0cf){return Number(_0x24b0cf[_0x636d('0x6b')]);});return db[_0x636d('0x6c')][_0x636d('0x57')]({'where':{'UserId':{'$in':_0x3e9903},'OpenchannelQueueId':{'$in':_0x37fabc}},'transaction':_0x19b565});})[_0x636d('0x27')](function(){var _0x2ea76a=_0x636d('0x6d')+_0x2737ae;return db['sequelize'][_0x636d('0x33')](_0x2ea76a,{'type':db[_0x636d('0x61')]['QueryTypes'][_0x636d('0x5b')],'raw':!![],'transaction':_0x19b565});})[_0x636d('0x27')](function(_0x473fa4){var _0x30e188=_[_0x636d('0x2c')](_0x473fa4,function(_0x31e4a8){return Number(_0x31e4a8[_0x636d('0x6e')]);});return db[_0x636d('0x6f')][_0x636d('0x57')]({'where':{'UserId':{'$in':_0x3e9903},'WhatsappQueueId':{'$in':_0x30e188}},'transaction':_0x19b565});})[_0x636d('0x27')](function(){return db[_0x636d('0x70')][_0x636d('0x51')]({'where':{'TeamId':_0x2737ae}});})[_0x636d('0x27')](function(_0x58fa6b){if(_0x58fa6b===null){return;}return db['UserVoicePrefix'][_0x636d('0x57')]({'where':{'UserId':{'$in':_0x3e9903},'VoicePrefixId':_0x58fa6b[_0x636d('0x71')]},'transaction':_0x19b565});})[_0x636d('0x27')](function(){return db['Team']['destroy']({'where':{'id':_0x2737ae},'cascade':!![],'transaction':_0x19b565});})[_0x636d('0x27')](function(_0x4b25ac){if(_0x4b25ac===0x0){_0x2166bf[_0x636d('0x1c')](0x194);}else{return db[_0x636d('0x54')][_0x636d('0x57')]({'where':{'type':_0x636d('0x4f'),'resourceId':_0x2737ae},'cascade':!![],'transaction':_0x19b565})['then'](function(){_0x2166bf['status'](0xcc)[_0x636d('0x72')]();});}})['catch'](function(_0x193ed1){_0x2166bf['status'](0x1f4)['send'](_0x193ed1);});});};exports[_0x636d('0x73')]=function(_0x5b17e7,_0x3f826a,_0x159308){return db['Team'][_0x636d('0x74')]({'where':{'id':_0x5b17e7[_0x636d('0x48')]['id']}})[_0x636d('0x27')](handleEntityNotFound(_0x3f826a,null))[_0x636d('0x27')](function(_0x2c7db3){if(!_0x5b17e7['query'][_0x636d('0x75')]||!utils[_0x636d('0x76')](_0x5b17e7[_0x636d('0x33')]['channel'])){throw new db[(_0x636d('0x61'))][(_0x636d('0x77'))](_0x636d('0x78'));}var _0x2f167c={};var _0x1a777d={};_0x1a777d[_0x636d('0x32')]=_['keys'](db[_[_0x636d('0x79')](_0x5b17e7['query']['channel'][_0x636d('0x7a')]())+_0x636d('0x7b')][_0x636d('0x2e')]);_0x1a777d[_0x636d('0x33')]=_[_0x636d('0x34')](_0x5b17e7['query']);_0x1a777d[_0x636d('0x35')]=_[_0x636d('0x36')](_0x1a777d[_0x636d('0x32')],_0x1a777d[_0x636d('0x33')]);_0x2f167c[_0x636d('0x37')]=_[_0x636d('0x36')](_0x1a777d[_0x636d('0x32')],qs[_0x636d('0x38')](_0x5b17e7[_0x636d('0x33')]['fields']));_0x2f167c[_0x636d('0x37')]=_0x2f167c[_0x636d('0x37')][_0x636d('0x39')]?_0x2f167c[_0x636d('0x37')]:_0x1a777d['model'];_0x2f167c[_0x636d('0x20')]=qs[_0x636d('0x20')](_0x5b17e7[_0x636d('0x33')]['limit']);_0x2f167c['offset']=qs[_0x636d('0x1e')](_0x5b17e7[_0x636d('0x33')][_0x636d('0x1e')]);_0x2f167c['order']=qs['sort'](_0x5b17e7['query'][_0x636d('0x3c')]);_0x2f167c[_0x636d('0x3d')]=qs['filters'](_[_0x636d('0x3e')](_0x5b17e7['query'],_0x1a777d[_0x636d('0x35')]));_0x2f167c=_['merge']({},_0x2f167c,_0x5b17e7[_0x636d('0x42')]);return _0x2c7db3[_0x636d('0x4c')+_[_0x636d('0x79')](_0x5b17e7[_0x636d('0x33')][_0x636d('0x75')][_0x636d('0x7a')]())+_0x636d('0x7c')](_0x2f167c);})[_0x636d('0x27')](respondWithResult(_0x3f826a,null))[_0x636d('0x46')](handleError(_0x3f826a,null));};exports[_0x636d('0x7d')]=function(_0x3cf21b,_0x408b9f,_0x49f261){return db[_0x636d('0x2d')][_0x636d('0x74')]({'where':{'id':_0x3cf21b[_0x636d('0x48')]['id']}})['then'](function(_0x5b757a){if(_0x5b757a){if(!_0x3cf21b[_0x636d('0x4a')][_0x636d('0x75')]||!utils['isValidChannel'](_0x3cf21b[_0x636d('0x4a')]['channel'])){throw new db[(_0x636d('0x61'))]['ValidationError'](_0x636d('0x78'));}return _0x5b757a[_0x636d('0x7e')+_[_0x636d('0x79')](_0x3cf21b[_0x636d('0x4a')][_0x636d('0x75')][_0x636d('0x7a')]())+_0x636d('0x7c')](_0x3cf21b[_0x636d('0x4a')][_0x636d('0x7f')]);}return null;})[_0x636d('0x27')](handleEntityNotFound(_0x408b9f,null))['then'](respondWithStatusCode(_0x408b9f,null))[_0x636d('0x46')](handleError(_0x408b9f,null));};exports[_0x636d('0x80')]=function(_0x351037,_0x582950,_0x1229e7){return db['Team'][_0x636d('0x74')]({'where':{'id':_0x351037[_0x636d('0x48')]['id']}})[_0x636d('0x27')](function(_0x4bacd4){if(_0x4bacd4){if(!_0x351037[_0x636d('0x33')][_0x636d('0x75')]||!utils[_0x636d('0x76')](_0x351037[_0x636d('0x33')][_0x636d('0x75')])){throw new db[(_0x636d('0x61'))]['ValidationError'](_0x636d('0x78'));}return _0x4bacd4[_0x636d('0x81')+_[_0x636d('0x79')](_0x351037[_0x636d('0x33')][_0x636d('0x75')][_0x636d('0x7a')]())+_0x636d('0x7c')](_0x351037[_0x636d('0x33')][_0x636d('0x7f')]);}return null;})[_0x636d('0x27')](handleEntityNotFound(_0x582950,null))[_0x636d('0x27')](respondWithStatusCode(_0x582950,null))[_0x636d('0x46')](handleError(_0x582950,null));};exports[_0x636d('0x82')]=function(_0x2ac484,_0x2cfe38){var _0x4f3303=_[_0x636d('0x83')](_0x2ac484[_0x636d('0x4a')][_0x636d('0x7f')])?_0x2ac484[_0x636d('0x4a')][_0x636d('0x7f')]:[_0x2ac484[_0x636d('0x4a')][_0x636d('0x7f')]];var _0x14f20e=_0x2ac484[_0x636d('0x48')]['id'];return db[_0x636d('0x2d')][_0x636d('0x51')]({'where':{'id':_0x14f20e}})[_0x636d('0x27')](handleEntityNotFound(_0x2cfe38,null))[_0x636d('0x27')](function(_0x3856d4){if(_0x3856d4){var _0x5292b7=[_0x636d('0x84'),_0x636d('0x85'),'Mail',_0x636d('0x86'),'Fax','Openchannel',_0x636d('0x87')];return db[_0x636d('0x58')][_0x636d('0x88')](function(_0xa339c6){var _0x3da73d=_[_0x636d('0x2c')](_0x5292b7,function(_0x313b0a){var _0x3d8918={'attributes':['id',_0x636d('0x29')]};if(_0x313b0a===_0x636d('0x84')){_0x3d8918[_0x636d('0x89')]={'attributes':[_0x636d('0x8a')]};}return _0x3856d4['get'+_0x313b0a+_0x636d('0x7c')](_0x3d8918)['then'](function(_0x38a1d8){var _0x49cd81=_[_0x636d('0x2c')](_0x38a1d8,function(_0x3ae817){var _0x448d48=_[_0x636d('0x2c')](_0x4f3303,function(_0x13cee2){var _0x27e05b={'where':{'UserId':_0x13cee2,[_0x313b0a+_0x636d('0x8b')]:_0x3ae817['id']},'transaction':_0xa339c6};if(_0x313b0a===_0x636d('0x84')){_0x27e05b[_0x636d('0x18')]={'penalty':_0x3ae817[_0x636d('0x8c')][_0x636d('0x8a')]};}return db[_0x636d('0x8d')+_0x313b0a+'Queue'][_0x636d('0x8e')](_0x27e05b)[_0x636d('0x27')](function(){socket[_0x636d('0x8f')]('user'+_0x313b0a+_0x636d('0x90'),{'UserId':_0x13cee2,[_0x313b0a+_0x636d('0x8b')]:_0x3ae817['id']});if(_0x313b0a!=='Voice'){return;}return db[_0x636d('0x8d')]['findAll']({'where':{'id':_0x4f3303,'online':0x1},'attributes':['id',_0x636d('0x29'),_0x636d('0x91'),_0x636d('0x92'),'interface'],'raw':!![]})[_0x636d('0x27')](function(_0x45d36c){var _0x329eaa=_[_0x636d('0x2c')](_0x45d36c,function(_0x44604b){return db[_0x636d('0x93')][_0x636d('0x94')]({'membername':_0x44604b[_0x636d('0x29')],'UserId':_0x44604b['id'],'queue_name':_0x3ae817[_0x636d('0x29')],'VoiceQueueId':_0x3ae817['id'],'interface':_[_0x636d('0x95')](_0x44604b['interface'])?util[_0x636d('0x96')](_0x636d('0x97'),_0x44604b['name']):_0x44604b[_0x636d('0x98')],'paused':_0x44604b['voicePause']||![],'penalty':_0x3ae817[_0x636d('0x8c')][_0x636d('0x8a')]},{'transaction':_0xa339c6});});return Promise[_0x636d('0x99')](_0x329eaa);});});});return Promise[_0x636d('0x99')](_0x448d48);});return Promise[_0x636d('0x99')](_0x49cd81);})[_0x636d('0x27')](function(){return db[_0x636d('0x70')][_0x636d('0x74')]({'where':{'teamId':_0x14f20e}})[_0x636d('0x27')](function(_0x312fdd){if(_0x312fdd){var _0x2f2a29=_[_0x636d('0x2c')](_0x4f3303,function(_0x3d1113){db[_0x636d('0x9a')]['upsert']({'UserId':_0x3d1113,'VoicePrefixId':_0x312fdd[_0x636d('0x71')]});});return Promise[_0x636d('0x99')](_0x2f2a29);}});});});return Promise['all'](_0x3da73d)['then'](function(){return _0x3856d4[_0x636d('0x82')](_0x4f3303,{'transaction':_0xa339c6})['spread'](function(_0x5d26da){return _0x5d26da;});});});}})[_0x636d('0x27')](respondWithResult(_0x2cfe38,null))[_0x636d('0x46')](handleError(_0x2cfe38,null));};exports[_0x636d('0x9b')]=function(_0x4582c4,_0x5f31be){var _0x551fd3=_[_0x636d('0x83')](_0x4582c4[_0x636d('0x33')][_0x636d('0x7f')])?_0x4582c4['query']['ids']:[_0x4582c4[_0x636d('0x33')][_0x636d('0x7f')]];var _0x58243f=_0x4582c4['params']['id'];return db[_0x636d('0x2d')][_0x636d('0x51')]({'where':{'id':_0x58243f}})['then'](handleEntityNotFound(_0x5f31be,null))[_0x636d('0x27')](function(_0x3583a6){if(_0x3583a6){var _0x3fb165=['Voice',_0x636d('0x85'),'Mail',_0x636d('0x86'),'Fax','Openchannel',_0x636d('0x87')];return db[_0x636d('0x58')][_0x636d('0x88')](function(_0x19d169){var _0x1e20c7=_[_0x636d('0x2c')](_0x3fb165,function(_0x43bec3){var _0x34ee2b={'attributes':['id','name']};return _0x3583a6[_0x636d('0x4c')+_0x43bec3+_0x636d('0x7c')](_0x34ee2b)[_0x636d('0x27')](function(_0x11045f){var _0x386cc6=_[_0x636d('0x2c')](_0x11045f,function(_0x47ee9f){return _0x47ee9f['removeAgents'](_0x551fd3,{'transaction':_0x19d169})[_0x636d('0x27')](function(){var _0x2ced96=_[_0x636d('0x2c')](_0x551fd3,function(_0x56426b){socket['emit'](_0x636d('0x4b')+_0x43bec3+_0x636d('0x9c'),{'UserId':Number(_0x56426b),[_0x43bec3+_0x636d('0x8b')]:_0x47ee9f['id']});if(_0x43bec3!=='Voice'){return;}return db[_0x636d('0x93')][_0x636d('0x57')]({'where':{'VoiceQueueId':_0x47ee9f['id'],'UserId':_0x56426b},'transaction':_0x19d169});});return Promise['all'](_0x2ced96);});});return Promise['all'](_0x386cc6);});});return Promise[_0x636d('0x99')](_0x1e20c7)[_0x636d('0x27')](function(){return _0x3583a6[_0x636d('0x9b')](_0x551fd3,{'transaction':_0x19d169});})[_0x636d('0x27')](function(){return db[_0x636d('0x70')][_0x636d('0x74')]({'where':{'teamId':_0x58243f}})[_0x636d('0x27')](function(_0x464621){if(_0x464621){var _0xcb69c7=_[_0x636d('0x2c')](_0x551fd3,function(_0x31aebd){db['UserVoicePrefix'][_0x636d('0x57')]({'where':{'UserId':_0x31aebd,'VoicePrefixId':_0x464621[_0x636d('0x71')]}});});return Promise[_0x636d('0x99')](_0xcb69c7);}});});});}})[_0x636d('0x27')](respondWithStatusCode(_0x5f31be,null))['catch'](handleError(_0x5f31be,null));};exports['getAgents']=function(_0x38c865,_0x449f41,_0x38af14){var _0x478116={};var _0x6e7128={};var _0x907f70;var _0x44040b;return db[_0x636d('0x2d')][_0x636d('0x74')]({'where':{'id':_0x38c865[_0x636d('0x48')]['id']}})[_0x636d('0x27')](handleEntityNotFound(_0x449f41,null))[_0x636d('0x27')](function(_0x37ec8d){if(_0x37ec8d){_0x907f70=_0x37ec8d;_0x6e7128[_0x636d('0x32')]=_['keys'](db[_0x636d('0x8d')][_0x636d('0x2e')]);_0x6e7128['query']=_[_0x636d('0x34')](_0x38c865[_0x636d('0x33')]);_0x6e7128[_0x636d('0x35')]=_[_0x636d('0x36')](_0x6e7128[_0x636d('0x32')],_0x6e7128[_0x636d('0x33')]);_0x478116[_0x636d('0x37')]=_[_0x636d('0x36')](_0x6e7128[_0x636d('0x32')],qs[_0x636d('0x38')](_0x38c865[_0x636d('0x33')]['fields']));_0x478116['attributes']=_0x478116[_0x636d('0x37')][_0x636d('0x39')]?_0x478116['attributes']:_0x6e7128[_0x636d('0x32')];_0x478116[_0x636d('0x9d')]=qs[_0x636d('0x3c')](_0x38c865['query']['sort']);_0x478116[_0x636d('0x3d')]=qs['filters'](_[_0x636d('0x3e')](_0x38c865[_0x636d('0x33')],_0x6e7128[_0x636d('0x35')]));if(_0x38c865[_0x636d('0x33')][_0x636d('0x3f')]){_0x478116[_0x636d('0x3d')]=_['merge'](_0x478116['where'],{'$or':_['map'](_0x478116['attributes'],function(_0x90a345){var _0x3ead15={};_0x3ead15[_0x90a345]={'$like':'%'+_0x38c865[_0x636d('0x33')]['filter']+'%'};return _0x3ead15;})});}_0x478116=_['merge']({},_0x478116,_0x38c865[_0x636d('0x42')]);return _0x907f70[_0x636d('0x9e')](_0x478116);}})[_0x636d('0x27')](function(_0x180143){if(_0x180143){_0x44040b=_0x180143[_0x636d('0x39')];if(!_0x38c865[_0x636d('0x33')][_0x636d('0x3a')](_0x636d('0x3b'))){_0x478116[_0x636d('0x20')]=qs[_0x636d('0x20')](_0x38c865[_0x636d('0x33')]['limit']);_0x478116[_0x636d('0x1e')]=qs[_0x636d('0x1e')](_0x38c865[_0x636d('0x33')]['offset']);}return _0x907f70['getAgents'](_0x478116);}})[_0x636d('0x27')](function(_0x4a16f9){if(_0x4a16f9){return _0x4a16f9?{'count':_0x44040b,'rows':_0x4a16f9}:null;}})[_0x636d('0x27')](respondWithResult(_0x449f41,null))['catch'](handleError(_0x449f41,null));}; \ No newline at end of file +var _0xa936=['../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','end','json','undefined','limit','count','offset','status','Content-Range','reject','save','then','sendStatus','error','stack','name','index','Team','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','catch','body','user','get','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','sequelize','transaction','Sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','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','ChatQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','UserProfileResource','Teams','send','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','toLowerCase','Queue','capitalize','Queues','addQueues','add','ids','removeQueues','remove','addAgents','isArray','Mail','Sms','Fax','Openchannel','Whatsapp','penalty','QueueId','Voice','TeamVoiceQueue','User','online','voicePause','upsert','isNil','interface','SIP/%s','all','UserVoicePrefix','VoicePrefixId','removeAgents','Chat','Queue:remove','UserVoiceQueueRt','getAgents','order','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils'];(function(_0x1c0d0c,_0xb9cecd){var _0x580f29=function(_0x58c1b2){while(--_0x58c1b2){_0x1c0d0c['push'](_0x1c0d0c['shift']());}};_0x580f29(++_0xb9cecd);}(_0xa936,0x1aa));var _0x6a93=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xa936[_0x25e7cb];return _0x375d92;};'use strict';var emlformat=require(_0x6a93('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6a93('0x1'));var rp=require(_0x6a93('0x2'));var moment=require(_0x6a93('0x3'));var BPromise=require(_0x6a93('0x4'));var Mustache=require(_0x6a93('0x5'));var util=require('util');var path=require(_0x6a93('0x6'));var sox=require(_0x6a93('0x7'));var csv=require(_0x6a93('0x8'));var ejs=require(_0x6a93('0x9'));var fs=require('fs');var fs_extra=require(_0x6a93('0xa'));var _=require(_0x6a93('0xb'));var squel=require('squel');var crypto=require(_0x6a93('0xc'));var jsforce=require(_0x6a93('0xd'));var deskjs=require(_0x6a93('0xe'));var toCsv=require(_0x6a93('0x8'));var querystring=require('querystring');var Papa=require(_0x6a93('0xf'));var Redis=require(_0x6a93('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6a93('0x11'));var as=require(_0x6a93('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6a93('0x13'))('api');var utils=require(_0x6a93('0x14'));var config=require(_0x6a93('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6a93('0x16'))['db'];config[_0x6a93('0x17')]=_[_0x6a93('0x18')](config[_0x6a93('0x17')],{'host':_0x6a93('0x19'),'port':0x18eb});var socket=require(_0x6a93('0x1a'))(new Redis(config[_0x6a93('0x17')]));require(_0x6a93('0x1b'))[_0x6a93('0x1c')](socket);function respondWithStatusCode(_0x4963f8,_0x1c08cf){_0x1c08cf=_0x1c08cf||0xcc;return function(_0x18f0c4){if(_0x18f0c4){return _0x4963f8['sendStatus'](_0x1c08cf);}return _0x4963f8['status'](_0x1c08cf)[_0x6a93('0x1d')]();};}function respondWithResult(_0x45c94a,_0x42ae9a){_0x42ae9a=_0x42ae9a||0xc8;return function(_0x29fba9){if(_0x29fba9){return _0x45c94a['status'](_0x42ae9a)[_0x6a93('0x1e')](_0x29fba9);}};}function respondWithFilteredResult(_0x48785c,_0x152ffe){return function(_0x1933cf){if(_0x1933cf){var _0x8b85bc=typeof _0x152ffe['offset']===_0x6a93('0x1f')&&typeof _0x152ffe[_0x6a93('0x20')]===_0x6a93('0x1f');var _0x5dccfd=_0x1933cf[_0x6a93('0x21')];var _0x382f35=_0x8b85bc?0x0:_0x152ffe[_0x6a93('0x22')];var _0x1c4852=_0x8b85bc?_0x1933cf[_0x6a93('0x21')]:_0x152ffe['offset']+_0x152ffe[_0x6a93('0x20')];var _0x63f0c8;if(_0x1c4852>=_0x5dccfd){_0x1c4852=_0x5dccfd;_0x63f0c8=0xc8;}else{_0x63f0c8=0xce;}_0x48785c[_0x6a93('0x23')](_0x63f0c8);return _0x48785c['set'](_0x6a93('0x24'),_0x382f35+'-'+_0x1c4852+'/'+_0x5dccfd)[_0x6a93('0x1e')](_0x1933cf);}return null;};}function patchUpdates(_0x38aa06){return function(_0x58e4ee){try{jsonpatch['apply'](_0x58e4ee,_0x38aa06,!![]);}catch(_0x46bbc6){return BPromise[_0x6a93('0x25')](_0x46bbc6);}return _0x58e4ee[_0x6a93('0x26')]();};}function saveUpdates(_0x17c99b,_0x5efcd0){return function(_0x369d01){if(_0x369d01){return _0x369d01['update'](_0x17c99b)[_0x6a93('0x27')](function(_0x39676f){return _0x39676f;});}return null;};}function handleEntityNotFound(_0x4911f8,_0x5843ca){return function(_0x1020d9){if(!_0x1020d9){_0x4911f8[_0x6a93('0x28')](0x194);}return _0x1020d9;};}function handleError(_0x2c6cab,_0x5f17c7){_0x5f17c7=_0x5f17c7||0x1f4;return function(_0x2a5e93){logger[_0x6a93('0x29')](_0x2a5e93[_0x6a93('0x2a')]);if(_0x2a5e93[_0x6a93('0x2b')]){delete _0x2a5e93['name'];}_0x2c6cab[_0x6a93('0x23')](_0x5f17c7)['send'](_0x2a5e93);};}exports[_0x6a93('0x2c')]=function(_0x2f7e60,_0x26c042){var _0x5ee5ba={},_0x132b31={},_0x109085={'count':0x0,'rows':[]};var _0x5667a2=_['map'](db[_0x6a93('0x2d')][_0x6a93('0x2e')],function(_0x253b9e){return{'name':_0x253b9e[_0x6a93('0x2f')],'type':_0x253b9e[_0x6a93('0x30')][_0x6a93('0x31')]};});_0x132b31[_0x6a93('0x32')]=_[_0x6a93('0x33')](_0x5667a2,_0x6a93('0x2b'));_0x132b31[_0x6a93('0x34')]=_[_0x6a93('0x35')](_0x2f7e60[_0x6a93('0x34')]);_0x132b31[_0x6a93('0x36')]=_[_0x6a93('0x37')](_0x132b31[_0x6a93('0x32')],_0x132b31[_0x6a93('0x34')]);_0x5ee5ba[_0x6a93('0x38')]=_[_0x6a93('0x37')](_0x132b31['model'],qs['fields'](_0x2f7e60[_0x6a93('0x34')][_0x6a93('0x39')]));_0x5ee5ba[_0x6a93('0x38')]=_0x5ee5ba['attributes'][_0x6a93('0x3a')]?_0x5ee5ba[_0x6a93('0x38')]:_0x132b31['model'];if(!_0x2f7e60[_0x6a93('0x34')][_0x6a93('0x3b')](_0x6a93('0x3c'))){_0x5ee5ba[_0x6a93('0x20')]=qs[_0x6a93('0x20')](_0x2f7e60[_0x6a93('0x34')][_0x6a93('0x20')]);_0x5ee5ba['offset']=qs['offset'](_0x2f7e60['query'][_0x6a93('0x22')]);}_0x5ee5ba['order']=qs[_0x6a93('0x3d')](_0x2f7e60[_0x6a93('0x34')][_0x6a93('0x3d')]);_0x5ee5ba[_0x6a93('0x3e')]=qs[_0x6a93('0x36')](_[_0x6a93('0x3f')](_0x2f7e60[_0x6a93('0x34')],_0x132b31[_0x6a93('0x36')]),_0x5667a2);if(_0x2f7e60[_0x6a93('0x34')][_0x6a93('0x40')]){_0x5ee5ba[_0x6a93('0x3e')]=_[_0x6a93('0x41')](_0x5ee5ba[_0x6a93('0x3e')],{'$or':_[_0x6a93('0x33')](_0x5667a2,function(_0x26be72){if(_0x26be72['type']!=='VIRTUAL'){var _0x2f6e48={};_0x2f6e48[_0x26be72[_0x6a93('0x2b')]]={'$like':'%'+_0x2f7e60[_0x6a93('0x34')][_0x6a93('0x40')]+'%'};return _0x2f6e48;}})});}_0x5ee5ba=_[_0x6a93('0x41')]({},_0x5ee5ba,_0x2f7e60[_0x6a93('0x42')]);var _0x320bfc={'where':_0x5ee5ba[_0x6a93('0x3e')]};return db[_0x6a93('0x2d')]['count'](_0x320bfc)[_0x6a93('0x27')](function(_0x3f0248){_0x109085[_0x6a93('0x21')]=_0x3f0248;if(_0x2f7e60[_0x6a93('0x34')][_0x6a93('0x43')]){_0x5ee5ba[_0x6a93('0x44')]=[{'all':!![]}];}return db[_0x6a93('0x2d')][_0x6a93('0x45')](_0x5ee5ba);})['then'](function(_0x31aa43){_0x109085[_0x6a93('0x46')]=_0x31aa43;return _0x109085;})[_0x6a93('0x27')](respondWithFilteredResult(_0x26c042,_0x5ee5ba))['catch'](handleError(_0x26c042,null));};exports[_0x6a93('0x47')]=function(_0x7d75e7,_0x6a92cc){var _0xc2a3e4={'raw':![],'where':{'id':_0x7d75e7[_0x6a93('0x48')]['id']}},_0x50174e={};_0x50174e[_0x6a93('0x32')]=_[_0x6a93('0x35')](db[_0x6a93('0x2d')][_0x6a93('0x2e')]);_0x50174e[_0x6a93('0x34')]=_[_0x6a93('0x35')](_0x7d75e7[_0x6a93('0x34')]);_0x50174e['filters']=_[_0x6a93('0x37')](_0x50174e[_0x6a93('0x32')],_0x50174e[_0x6a93('0x34')]);_0xc2a3e4[_0x6a93('0x38')]=_['intersection'](_0x50174e['model'],qs[_0x6a93('0x39')](_0x7d75e7['query'][_0x6a93('0x39')]));_0xc2a3e4['attributes']=_0xc2a3e4[_0x6a93('0x38')][_0x6a93('0x3a')]?_0xc2a3e4[_0x6a93('0x38')]:_0x50174e[_0x6a93('0x32')];if(_0x7d75e7['query'][_0x6a93('0x43')]){_0xc2a3e4[_0x6a93('0x44')]=[{'all':!![]}];}_0xc2a3e4=_[_0x6a93('0x41')]({},_0xc2a3e4,_0x7d75e7[_0x6a93('0x42')]);return db[_0x6a93('0x2d')]['find'](_0xc2a3e4)['then'](handleEntityNotFound(_0x6a92cc,null))[_0x6a93('0x27')](respondWithResult(_0x6a92cc,null))[_0x6a93('0x49')](handleError(_0x6a92cc,null));};exports['create']=function(_0x363179,_0x3a12eb){return db[_0x6a93('0x2d')]['create'](_0x363179[_0x6a93('0x4a')],{})[_0x6a93('0x27')](function(_0xa7bb62){var _0x5d0927=_0x363179[_0x6a93('0x4b')][_0x6a93('0x4c')]({'plain':!![]});if(!_0x5d0927)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d0927[_0x6a93('0x4d')]===_0x6a93('0x4b')){var _0xc2605b=_0xa7bb62[_0x6a93('0x4c')]({'plain':!![]});var _0x37b16d='Teams';return db[_0x6a93('0x4e')][_0x6a93('0x4f')]({'where':{'name':_0x37b16d,'userProfileId':_0x5d0927['userProfileId']},'raw':!![]})[_0x6a93('0x27')](function(_0xd29131){if(_0xd29131&&_0xd29131[_0x6a93('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0xc2605b['name'],'resourceId':_0xc2605b['id'],'type':_0xd29131[_0x6a93('0x2b')],'sectionId':_0xd29131['id']},{})[_0x6a93('0x27')](function(){return _0xa7bb62;});}else{return _0xa7bb62;}})[_0x6a93('0x49')](function(_0x5303dd){logger[_0x6a93('0x29')](_0x6a93('0x51'),_0x5303dd);throw _0x5303dd;});}return _0xa7bb62;})[_0x6a93('0x27')](respondWithResult(_0x3a12eb,0xc9))[_0x6a93('0x49')](handleError(_0x3a12eb,null));};exports[_0x6a93('0x52')]=function(_0x31935f,_0x13417e){if(_0x31935f[_0x6a93('0x4a')]['id']){delete _0x31935f[_0x6a93('0x4a')]['id'];}return db['Team'][_0x6a93('0x4f')]({'where':{'id':_0x31935f[_0x6a93('0x48')]['id']}})[_0x6a93('0x27')](handleEntityNotFound(_0x13417e,null))[_0x6a93('0x27')](saveUpdates(_0x31935f['body'],null))[_0x6a93('0x27')](respondWithResult(_0x13417e,null))[_0x6a93('0x49')](handleError(_0x13417e,null));};exports[_0x6a93('0x53')]=function(_0x5d0fd2,_0x447ef4){var _0x2c9db6=_0x5d0fd2[_0x6a93('0x48')]['id'];var _0x57cbbf=[];return db[_0x6a93('0x54')][_0x6a93('0x55')](function(_0xfd5f8){var _0x57428e='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x2c9db6;return db[_0x6a93('0x54')][_0x6a93('0x34')](_0x57428e,{'type':db[_0x6a93('0x56')][_0x6a93('0x57')][_0x6a93('0x58')],'raw':!![],'transaction':_0xfd5f8})[_0x6a93('0x27')](function(_0x48a3e0){_0x57cbbf=_[_0x6a93('0x33')](_0x48a3e0,function(_0x527a6a){return Number(_0x527a6a['UserId']);});})[_0x6a93('0x27')](function(){var _0x180f6c=_0x6a93('0x59')+_0x2c9db6;return db[_0x6a93('0x54')][_0x6a93('0x34')](_0x180f6c,{'type':db[_0x6a93('0x56')][_0x6a93('0x57')][_0x6a93('0x58')],'raw':!![],'transaction':_0xfd5f8});})['then'](function(_0x5477ce){var _0x2a9e97=_[_0x6a93('0x33')](_0x5477ce,function(_0x25e261){return Number(_0x25e261[_0x6a93('0x5a')]);});return db[_0x6a93('0x5b')][_0x6a93('0x53')]({'where':{'UserId':{'$in':_0x57cbbf},'VoiceQueueId':{'$in':_0x2a9e97}},'transaction':_0xfd5f8});})[_0x6a93('0x27')](function(){var _0x4e75f0=_0x6a93('0x5c')+_0x2c9db6;return db[_0x6a93('0x54')][_0x6a93('0x34')](_0x4e75f0,{'type':db[_0x6a93('0x56')][_0x6a93('0x57')]['SELECT'],'raw':!![],'transaction':_0xfd5f8});})['then'](function(_0x36ed10){var _0x4f1d40=_[_0x6a93('0x33')](_0x36ed10,function(_0x51966b){return Number(_0x51966b[_0x6a93('0x5d')]);});return db[_0x6a93('0x5e')][_0x6a93('0x53')]({'where':{'UserId':{'$in':_0x57cbbf},'MailQueueId':{'$in':_0x4f1d40}},'transaction':_0xfd5f8});})['then'](function(){var _0x9ade92=_0x6a93('0x5f')+_0x2c9db6;return db[_0x6a93('0x54')][_0x6a93('0x34')](_0x9ade92,{'type':db[_0x6a93('0x56')]['QueryTypes'][_0x6a93('0x58')],'raw':!![],'transaction':_0xfd5f8});})['then'](function(_0x5f0b5e){var _0x442a2d=_['map'](_0x5f0b5e,function(_0x492107){return Number(_0x492107['SmsQueueId']);});return db[_0x6a93('0x60')][_0x6a93('0x53')]({'where':{'UserId':{'$in':_0x57cbbf},'SmsQueueId':{'$in':_0x442a2d}},'transaction':_0xfd5f8});})[_0x6a93('0x27')](function(){var _0x4447a8='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2c9db6;return db[_0x6a93('0x54')]['query'](_0x4447a8,{'type':db[_0x6a93('0x56')][_0x6a93('0x57')][_0x6a93('0x58')],'raw':!![],'transaction':_0xfd5f8});})[_0x6a93('0x27')](function(_0x3af8db){var _0x104a35=_[_0x6a93('0x33')](_0x3af8db,function(_0x329008){return Number(_0x329008[_0x6a93('0x61')]);});return db['UserChatQueue'][_0x6a93('0x53')]({'where':{'UserId':{'$in':_0x57cbbf},'ChatQueueId':{'$in':_0x104a35}},'transaction':_0xfd5f8});})[_0x6a93('0x27')](function(){var _0x565113='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2c9db6;return db[_0x6a93('0x54')][_0x6a93('0x34')](_0x565113,{'type':db[_0x6a93('0x56')][_0x6a93('0x57')][_0x6a93('0x58')],'raw':!![],'transaction':_0xfd5f8});})[_0x6a93('0x27')](function(_0x5fb881){var _0x589d58=_[_0x6a93('0x33')](_0x5fb881,function(_0x45882c){return Number(_0x45882c['FaxQueueId']);});return db['UserFaxQueue'][_0x6a93('0x53')]({'where':{'UserId':{'$in':_0x57cbbf},'FaxQueueId':{'$in':_0x589d58}},'transaction':_0xfd5f8});})[_0x6a93('0x27')](function(){var _0x22d3d7=_0x6a93('0x62')+_0x2c9db6;return db[_0x6a93('0x54')][_0x6a93('0x34')](_0x22d3d7,{'type':db[_0x6a93('0x56')][_0x6a93('0x57')][_0x6a93('0x58')],'raw':!![],'transaction':_0xfd5f8});})[_0x6a93('0x27')](function(_0x41a669){var _0x18d1eb=_['map'](_0x41a669,function(_0x10e6d4){return Number(_0x10e6d4[_0x6a93('0x63')]);});return db[_0x6a93('0x64')][_0x6a93('0x53')]({'where':{'UserId':{'$in':_0x57cbbf},'OpenchannelQueueId':{'$in':_0x18d1eb}},'transaction':_0xfd5f8});})[_0x6a93('0x27')](function(){var _0x799c81=_0x6a93('0x65')+_0x2c9db6;return db[_0x6a93('0x54')]['query'](_0x799c81,{'type':db['Sequelize'][_0x6a93('0x57')][_0x6a93('0x58')],'raw':!![],'transaction':_0xfd5f8});})['then'](function(_0x4af24c){var _0x175b6f=_[_0x6a93('0x33')](_0x4af24c,function(_0xd443a3){return Number(_0xd443a3['WhatsappQueueId']);});return db[_0x6a93('0x66')][_0x6a93('0x53')]({'where':{'UserId':{'$in':_0x57cbbf},'WhatsappQueueId':{'$in':_0x175b6f}},'transaction':_0xfd5f8});})['then'](function(){return db[_0x6a93('0x67')]['find']({'where':{'TeamId':_0x2c9db6}});})[_0x6a93('0x27')](function(_0x6e7477){if(_0x6e7477===null){return;}return db['UserVoicePrefix'][_0x6a93('0x53')]({'where':{'UserId':{'$in':_0x57cbbf},'VoicePrefixId':_0x6e7477['VoicePrefixId']},'transaction':_0xfd5f8});})[_0x6a93('0x27')](function(){return db[_0x6a93('0x2d')][_0x6a93('0x53')]({'where':{'id':_0x2c9db6},'cascade':!![],'transaction':_0xfd5f8});})[_0x6a93('0x27')](function(_0x500416){if(_0x500416===0x0){_0x447ef4[_0x6a93('0x28')](0x194);}else{return db[_0x6a93('0x68')][_0x6a93('0x53')]({'where':{'type':_0x6a93('0x69'),'resourceId':_0x2c9db6},'cascade':!![],'transaction':_0xfd5f8})[_0x6a93('0x27')](function(){_0x447ef4[_0x6a93('0x23')](0xcc)['end']();});}})['catch'](function(_0x1a0b1a){_0x447ef4[_0x6a93('0x23')](0x1f4)[_0x6a93('0x6a')](_0x1a0b1a);});});};exports[_0x6a93('0x6b')]=function(_0x371062,_0x234d91,_0xc65191){return db[_0x6a93('0x2d')][_0x6a93('0x6c')]({'where':{'id':_0x371062[_0x6a93('0x48')]['id']}})['then'](handleEntityNotFound(_0x234d91,null))[_0x6a93('0x27')](function(_0x1e5d07){if(!_0x371062[_0x6a93('0x34')][_0x6a93('0x6d')]||!utils[_0x6a93('0x6e')](_0x371062[_0x6a93('0x34')][_0x6a93('0x6d')])){throw new db['Sequelize'][(_0x6a93('0x6f'))](_0x6a93('0x70'));}var _0x242c7a={};var _0x4bea3a={};_0x4bea3a[_0x6a93('0x32')]=_[_0x6a93('0x35')](db[_['capitalize'](_0x371062[_0x6a93('0x34')][_0x6a93('0x6d')][_0x6a93('0x71')]())+_0x6a93('0x72')][_0x6a93('0x2e')]);_0x4bea3a[_0x6a93('0x34')]=_[_0x6a93('0x35')](_0x371062[_0x6a93('0x34')]);_0x4bea3a[_0x6a93('0x36')]=_[_0x6a93('0x37')](_0x4bea3a[_0x6a93('0x32')],_0x4bea3a[_0x6a93('0x34')]);_0x242c7a['attributes']=_['intersection'](_0x4bea3a[_0x6a93('0x32')],qs[_0x6a93('0x39')](_0x371062[_0x6a93('0x34')][_0x6a93('0x39')]));_0x242c7a[_0x6a93('0x38')]=_0x242c7a[_0x6a93('0x38')]['length']?_0x242c7a[_0x6a93('0x38')]:_0x4bea3a[_0x6a93('0x32')];_0x242c7a[_0x6a93('0x20')]=qs[_0x6a93('0x20')](_0x371062[_0x6a93('0x34')][_0x6a93('0x20')]);_0x242c7a[_0x6a93('0x22')]=qs[_0x6a93('0x22')](_0x371062['query']['offset']);_0x242c7a['order']=qs[_0x6a93('0x3d')](_0x371062['query'][_0x6a93('0x3d')]);_0x242c7a[_0x6a93('0x3e')]=qs['filters'](_[_0x6a93('0x3f')](_0x371062['query'],_0x4bea3a[_0x6a93('0x36')]));_0x242c7a=_[_0x6a93('0x41')]({},_0x242c7a,_0x371062[_0x6a93('0x42')]);return _0x1e5d07[_0x6a93('0x4c')+_[_0x6a93('0x73')](_0x371062[_0x6a93('0x34')][_0x6a93('0x6d')]['toLowerCase']())+_0x6a93('0x74')](_0x242c7a);})[_0x6a93('0x27')](respondWithResult(_0x234d91,null))['catch'](handleError(_0x234d91,null));};exports[_0x6a93('0x75')]=function(_0x218961,_0xafb956,_0x51bbca){return db[_0x6a93('0x2d')][_0x6a93('0x6c')]({'where':{'id':_0x218961[_0x6a93('0x48')]['id']}})[_0x6a93('0x27')](function(_0x4819bd){if(_0x4819bd){if(!_0x218961['body'][_0x6a93('0x6d')]||!utils['isValidChannel'](_0x218961[_0x6a93('0x4a')]['channel'])){throw new db['Sequelize'][(_0x6a93('0x6f'))](_0x6a93('0x70'));}return _0x4819bd[_0x6a93('0x76')+_[_0x6a93('0x73')](_0x218961['body'][_0x6a93('0x6d')][_0x6a93('0x71')]())+_0x6a93('0x74')](_0x218961[_0x6a93('0x4a')][_0x6a93('0x77')]);}return null;})[_0x6a93('0x27')](handleEntityNotFound(_0xafb956,null))[_0x6a93('0x27')](respondWithStatusCode(_0xafb956,null))[_0x6a93('0x49')](handleError(_0xafb956,null));};exports[_0x6a93('0x78')]=function(_0x584950,_0xa146cb,_0x34328f){return db[_0x6a93('0x2d')][_0x6a93('0x6c')]({'where':{'id':_0x584950['params']['id']}})[_0x6a93('0x27')](function(_0x1d56a3){if(_0x1d56a3){if(!_0x584950[_0x6a93('0x34')]['channel']||!utils[_0x6a93('0x6e')](_0x584950['query'][_0x6a93('0x6d')])){throw new db[(_0x6a93('0x56'))][(_0x6a93('0x6f'))](_0x6a93('0x70'));}return _0x1d56a3[_0x6a93('0x79')+_[_0x6a93('0x73')](_0x584950[_0x6a93('0x34')][_0x6a93('0x6d')][_0x6a93('0x71')]())+_0x6a93('0x74')](_0x584950[_0x6a93('0x34')][_0x6a93('0x77')]);}return null;})[_0x6a93('0x27')](handleEntityNotFound(_0xa146cb,null))[_0x6a93('0x27')](respondWithStatusCode(_0xa146cb,null))[_0x6a93('0x49')](handleError(_0xa146cb,null));};exports[_0x6a93('0x7a')]=function(_0x1f9a81,_0x452a3d){var _0x24e000=_[_0x6a93('0x7b')](_0x1f9a81['body'][_0x6a93('0x77')])?_0x1f9a81[_0x6a93('0x4a')][_0x6a93('0x77')]:[_0x1f9a81[_0x6a93('0x4a')]['ids']];var _0x53662e=_0x1f9a81[_0x6a93('0x48')]['id'];return db[_0x6a93('0x2d')][_0x6a93('0x4f')]({'where':{'id':_0x53662e}})['then'](handleEntityNotFound(_0x452a3d,null))[_0x6a93('0x27')](function(_0x18a6a0){if(_0x18a6a0){var _0x483c81=['Voice','Chat',_0x6a93('0x7c'),_0x6a93('0x7d'),_0x6a93('0x7e'),_0x6a93('0x7f'),_0x6a93('0x80')];return db[_0x6a93('0x54')][_0x6a93('0x55')](function(_0x32736d){var _0x581810=_[_0x6a93('0x33')](_0x483c81,function(_0x178846){var _0x5324d6={'attributes':['id',_0x6a93('0x2b')]};if(_0x178846==='Voice'){_0x5324d6['through']={'attributes':[_0x6a93('0x81')]};}return _0x18a6a0[_0x6a93('0x4c')+_0x178846+'Queues'](_0x5324d6)[_0x6a93('0x27')](function(_0xc04c3e){var _0x583e4d=_[_0x6a93('0x33')](_0xc04c3e,function(_0x4f169c){var _0x107dc2=_[_0x6a93('0x33')](_0x24e000,function(_0x239bbb){var _0xe20e9b={'where':{'UserId':_0x239bbb,[_0x178846+_0x6a93('0x82')]:_0x4f169c['id']},'transaction':_0x32736d};if(_0x178846===_0x6a93('0x83')){_0xe20e9b[_0x6a93('0x18')]={'penalty':_0x4f169c[_0x6a93('0x84')][_0x6a93('0x81')]};}return db[_0x6a93('0x85')+_0x178846+'Queue']['findOrCreate'](_0xe20e9b)[_0x6a93('0x27')](function(){socket['emit']('user'+_0x178846+'Queue:save',{'UserId':_0x239bbb,[_0x178846+_0x6a93('0x82')]:_0x4f169c['id']});if(_0x178846!==_0x6a93('0x83')){return;}return db['User'][_0x6a93('0x45')]({'where':{'id':_0x24e000,'online':0x1},'attributes':['id',_0x6a93('0x2b'),_0x6a93('0x86'),_0x6a93('0x87'),'interface'],'raw':!![]})[_0x6a93('0x27')](function(_0x7b023a){var _0x5a1606=_['map'](_0x7b023a,function(_0x5c38dc){return db['UserVoiceQueueRt'][_0x6a93('0x88')]({'membername':_0x5c38dc[_0x6a93('0x2b')],'UserId':_0x5c38dc['id'],'queue_name':_0x4f169c['name'],'VoiceQueueId':_0x4f169c['id'],'interface':_[_0x6a93('0x89')](_0x5c38dc[_0x6a93('0x8a')])?util['format'](_0x6a93('0x8b'),_0x5c38dc[_0x6a93('0x2b')]):_0x5c38dc[_0x6a93('0x8a')],'paused':_0x5c38dc[_0x6a93('0x87')]||![],'penalty':_0x4f169c[_0x6a93('0x84')]['penalty']},{'transaction':_0x32736d});});return Promise['all'](_0x5a1606);});});});return Promise[_0x6a93('0x8c')](_0x107dc2);});return Promise['all'](_0x583e4d);})['then'](function(){return db['TeamVoicePrefix'][_0x6a93('0x6c')]({'where':{'teamId':_0x53662e}})['then'](function(_0x230ce9){if(_0x230ce9){var _0x4c0ede=_[_0x6a93('0x33')](_0x24e000,function(_0x2d3058){db[_0x6a93('0x8d')]['upsert']({'UserId':_0x2d3058,'VoicePrefixId':_0x230ce9[_0x6a93('0x8e')]});});return Promise[_0x6a93('0x8c')](_0x4c0ede);}});});});return Promise[_0x6a93('0x8c')](_0x581810)['then'](function(){return _0x18a6a0[_0x6a93('0x7a')](_0x24e000,{'transaction':_0x32736d})['spread'](function(_0x4caa7c){return _0x4caa7c;});});});}})[_0x6a93('0x27')](respondWithResult(_0x452a3d,null))['catch'](handleError(_0x452a3d,null));};exports[_0x6a93('0x8f')]=function(_0x5a5e6e,_0x113a20){var _0x3e8c2e=_[_0x6a93('0x7b')](_0x5a5e6e[_0x6a93('0x34')][_0x6a93('0x77')])?_0x5a5e6e['query'][_0x6a93('0x77')]:[_0x5a5e6e[_0x6a93('0x34')][_0x6a93('0x77')]];var _0x267f70=_0x5a5e6e[_0x6a93('0x48')]['id'];return db['Team'][_0x6a93('0x4f')]({'where':{'id':_0x267f70}})[_0x6a93('0x27')](handleEntityNotFound(_0x113a20,null))[_0x6a93('0x27')](function(_0x33bc4e){if(_0x33bc4e){var _0xba3b77=[_0x6a93('0x83'),_0x6a93('0x90'),_0x6a93('0x7c'),_0x6a93('0x7d'),_0x6a93('0x7e'),'Openchannel',_0x6a93('0x80')];return db[_0x6a93('0x54')]['transaction'](function(_0x5b9c70){var _0x261933=_['map'](_0xba3b77,function(_0x59b7e4){var _0x47bd62={'attributes':['id',_0x6a93('0x2b')]};return _0x33bc4e[_0x6a93('0x4c')+_0x59b7e4+_0x6a93('0x74')](_0x47bd62)[_0x6a93('0x27')](function(_0xefebb8){var _0xae5ee3=_[_0x6a93('0x33')](_0xefebb8,function(_0x93fbc1){return _0x93fbc1[_0x6a93('0x8f')](_0x3e8c2e,{'transaction':_0x5b9c70})[_0x6a93('0x27')](function(){var _0x22bdb0=_['map'](_0x3e8c2e,function(_0x2d503e){socket['emit'](_0x6a93('0x4b')+_0x59b7e4+_0x6a93('0x91'),{'UserId':Number(_0x2d503e),[_0x59b7e4+_0x6a93('0x82')]:_0x93fbc1['id']});if(_0x59b7e4!==_0x6a93('0x83')){return;}return db[_0x6a93('0x92')][_0x6a93('0x53')]({'where':{'VoiceQueueId':_0x93fbc1['id'],'UserId':_0x2d503e},'transaction':_0x5b9c70});});return Promise['all'](_0x22bdb0);});});return Promise[_0x6a93('0x8c')](_0xae5ee3);});});return Promise['all'](_0x261933)[_0x6a93('0x27')](function(){return _0x33bc4e[_0x6a93('0x8f')](_0x3e8c2e,{'transaction':_0x5b9c70});})['then'](function(){return db[_0x6a93('0x67')][_0x6a93('0x6c')]({'where':{'teamId':_0x267f70}})[_0x6a93('0x27')](function(_0x1c4990){if(_0x1c4990){var _0xa3ee86=_[_0x6a93('0x33')](_0x3e8c2e,function(_0x4e77fa){db[_0x6a93('0x8d')][_0x6a93('0x53')]({'where':{'UserId':_0x4e77fa,'VoicePrefixId':_0x1c4990['VoicePrefixId']}});});return Promise[_0x6a93('0x8c')](_0xa3ee86);}});});});}})['then'](respondWithStatusCode(_0x113a20,null))[_0x6a93('0x49')](handleError(_0x113a20,null));};exports[_0x6a93('0x93')]=function(_0x3bd182,_0x337a15,_0x4f4777){var _0xb964a={};var _0x2406bc={};var _0x4e853a;var _0x17404b;return db[_0x6a93('0x2d')]['findOne']({'where':{'id':_0x3bd182['params']['id']}})['then'](handleEntityNotFound(_0x337a15,null))[_0x6a93('0x27')](function(_0x6e8444){if(_0x6e8444){_0x4e853a=_0x6e8444;_0x2406bc[_0x6a93('0x32')]=_[_0x6a93('0x35')](db[_0x6a93('0x85')]['rawAttributes']);_0x2406bc['query']=_[_0x6a93('0x35')](_0x3bd182[_0x6a93('0x34')]);_0x2406bc[_0x6a93('0x36')]=_[_0x6a93('0x37')](_0x2406bc[_0x6a93('0x32')],_0x2406bc[_0x6a93('0x34')]);_0xb964a['attributes']=_['intersection'](_0x2406bc[_0x6a93('0x32')],qs['fields'](_0x3bd182[_0x6a93('0x34')][_0x6a93('0x39')]));_0xb964a[_0x6a93('0x38')]=_0xb964a[_0x6a93('0x38')][_0x6a93('0x3a')]?_0xb964a[_0x6a93('0x38')]:_0x2406bc[_0x6a93('0x32')];_0xb964a[_0x6a93('0x94')]=qs[_0x6a93('0x3d')](_0x3bd182[_0x6a93('0x34')]['sort']);_0xb964a['where']=qs[_0x6a93('0x36')](_[_0x6a93('0x3f')](_0x3bd182['query'],_0x2406bc['filters']));if(_0x3bd182['query']['filter']){_0xb964a[_0x6a93('0x3e')]=_[_0x6a93('0x41')](_0xb964a[_0x6a93('0x3e')],{'$or':_[_0x6a93('0x33')](_0xb964a[_0x6a93('0x38')],function(_0x30074e){var _0x17eb23={};_0x17eb23[_0x30074e]={'$like':'%'+_0x3bd182[_0x6a93('0x34')][_0x6a93('0x40')]+'%'};return _0x17eb23;})});}_0xb964a=_['merge']({},_0xb964a,_0x3bd182[_0x6a93('0x42')]);return _0x4e853a[_0x6a93('0x93')](_0xb964a);}})[_0x6a93('0x27')](function(_0x2f92e1){if(_0x2f92e1){_0x17404b=_0x2f92e1[_0x6a93('0x3a')];if(!_0x3bd182['query']['hasOwnProperty'](_0x6a93('0x3c'))){_0xb964a['limit']=qs['limit'](_0x3bd182[_0x6a93('0x34')][_0x6a93('0x20')]);_0xb964a[_0x6a93('0x22')]=qs[_0x6a93('0x22')](_0x3bd182['query'][_0x6a93('0x22')]);}return _0x4e853a[_0x6a93('0x93')](_0xb964a);}})[_0x6a93('0x27')](function(_0x36338){if(_0x36338){return _0x36338?{'count':_0x17404b,'rows':_0x36338}:null;}})['then'](respondWithResult(_0x337a15,null))[_0x6a93('0x49')](handleError(_0x337a15,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index b0b5cce..99c2354 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 _0xc401=['hook','exports','events','Team','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x4e618e,_0x55d3a0){var _0x9e8183=function(_0x4d705e){while(--_0x4d705e){_0x4e618e['push'](_0x4e618e['shift']());}};_0x9e8183(++_0x55d3a0);}(_0xc401,0x142));var _0x1c40=function(_0x316a1e,_0x3ab24a){_0x316a1e=_0x316a1e-0x0;var _0x1b57f2=_0xc401[_0x316a1e];return _0x1b57f2;};'use strict';var EventEmitter=require(_0x1c40('0x0'));var Team=require('../../mysqldb')['db'][_0x1c40('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x1c40('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1c40('0x3')};function emitEvent(_0x58580e){return function(_0x11d42d,_0x5c7e35,_0xdce977){TeamEvents[_0x1c40('0x4')](_0x58580e+':'+_0x11d42d['id'],_0x11d42d);TeamEvents['emit'](_0x58580e,_0x11d42d);_0xdce977(null);};}for(var e in events){if(events[_0x1c40('0x5')](e)){var event=events[e];Team[_0x1c40('0x6')](e,emitEvent(event));}}module[_0x1c40('0x7')]=TeamEvents; \ No newline at end of file +var _0x6d89=['events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x5aa7d0,_0x415c23){var _0x18d504=function(_0x3a9e18){while(--_0x3a9e18){_0x5aa7d0['push'](_0x5aa7d0['shift']());}};_0x18d504(++_0x415c23);}(_0x6d89,0x77));var _0x96d8=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x6d89[_0x5d2803];return _0xdcad2c;};'use strict';var EventEmitter=require(_0x96d8('0x0'));var Team=require(_0x96d8('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x96d8('0x2')](0x0);var events={'afterCreate':_0x96d8('0x3'),'afterUpdate':_0x96d8('0x4'),'afterDestroy':_0x96d8('0x5')};function emitEvent(_0x52190d){return function(_0x575594,_0x1d9250,_0x420b61){TeamEvents[_0x96d8('0x6')](_0x52190d+':'+_0x575594['id'],_0x575594);TeamEvents[_0x96d8('0x6')](_0x52190d,_0x575594);_0x420b61(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 73e05cf..fd09b3e 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 _0x897a=['setDataValue','catch','exports','define','Team','teams','Chat','Fax','Mail','Openchannel','Sms','Voice','Whatsapp','resolve','then','all','./team.attributes','get','map'];(function(_0x41d882,_0x5dd16d){var _0x40b59d=function(_0x40b0c5){while(--_0x40b0c5){_0x41d882['push'](_0x41d882['shift']());}};_0x40b59d(++_0x5dd16d);}(_0x897a,0xe1));var _0xa897=function(_0x84e3fb,_0x2929e7){_0x84e3fb=_0x84e3fb-0x0;var _0x485313=_0x897a[_0x84e3fb];return _0x485313;};'use strict';var _=require('lodash');var attributes=require(_0xa897('0x0'));function getQueuesByChannel(_0x6913e7,_0x3af915){var _0x27094f=_0xa897('0x1')+_0x3af915+'Queues';return _0x6913e7[_0x27094f]()['then'](function(_0x4f81a6){return _[_0xa897('0x2')](_0x4f81a6,function(_0x137ce9){_0x137ce9[_0xa897('0x3')]('channel',_0x3af915);return _0x137ce9;});})[_0xa897('0x4')](function(_0x3b219b){throw _0x3b219b;});}module[_0xa897('0x5')]=function(_0x21af60){return _0x21af60[_0xa897('0x6')](_0xa897('0x7'),attributes,{'tableName':_0xa897('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x3f0ade=this;var _0x2307fc=[_0xa897('0x9'),_0xa897('0xa'),_0xa897('0xb'),_0xa897('0xc'),_0xa897('0xd'),_0xa897('0xe'),_0xa897('0xf')];return Promise[_0xa897('0x10')]()[_0xa897('0x11')](function(){var _0x170c91=_[_0xa897('0x2')](_0x2307fc,function(_0xfca6c1){return getQueuesByChannel(_0x3f0ade,_0xfca6c1);});return Promise[_0xa897('0x12')](_0x170c91);})[_0xa897('0x4')](function(_0x7b5979){throw _0x7b5979;});}}});}; \ No newline at end of file +var _0xca0f=['then','map','setDataValue','channel','catch','exports','teams','Chat','Fax','Mail','Openchannel','Sms','Voice','Whatsapp','resolve','all','lodash','./team.attributes','get','Queues'];(function(_0x345caf,_0x59bda5){var _0x4ff6d1=function(_0x35dd55){while(--_0x35dd55){_0x345caf['push'](_0x345caf['shift']());}};_0x4ff6d1(++_0x59bda5);}(_0xca0f,0xb0));var _0xfca0=function(_0x87190a,_0xa068cd){_0x87190a=_0x87190a-0x0;var _0xbe5758=_0xca0f[_0x87190a];return _0xbe5758;};'use strict';var _=require(_0xfca0('0x0'));var attributes=require(_0xfca0('0x1'));function getQueuesByChannel(_0x2e4915,_0x58361f){var _0x13516d=_0xfca0('0x2')+_0x58361f+_0xfca0('0x3');return _0x2e4915[_0x13516d]()[_0xfca0('0x4')](function(_0x575037){return _[_0xfca0('0x5')](_0x575037,function(_0x3760de){_0x3760de[_0xfca0('0x6')](_0xfca0('0x7'),_0x58361f);return _0x3760de;});})[_0xfca0('0x8')](function(_0xab7755){throw _0xab7755;});}module[_0xfca0('0x9')]=function(_0x4c2356){return _0x4c2356['define']('Team',attributes,{'tableName':_0xfca0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x199957=this;var _0x13a540=[_0xfca0('0xb'),_0xfca0('0xc'),_0xfca0('0xd'),_0xfca0('0xe'),_0xfca0('0xf'),_0xfca0('0x10'),_0xfca0('0x11')];return Promise[_0xfca0('0x12')]()[_0xfca0('0x4')](function(){var _0x62357=_[_0xfca0('0x5')](_0x13a540,function(_0x36c902){return getQueuesByChannel(_0x199957,_0x36c902);});return Promise[_0xfca0('0x13')](_0x62357);})[_0xfca0('0x8')](function(_0x29acbd){throw _0x29acbd;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index c0fc8be..f4fd217 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 _0xbfcb=['redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x3937ab,_0x229d4f){var _0x545726=function(_0x5f3854){while(--_0x5f3854){_0x3937ab['push'](_0x3937ab['shift']());}};_0x545726(++_0x229d4f);}(_0xbfcb,0x103));var _0xbbfc=function(_0x467501,_0x5c154b){_0x467501=_0x467501-0x0;var _0x54de17=_0xbfcb[_0x467501];return _0x54de17;};'use strict';var _=require(_0xbbfc('0x0'));var util=require('util');var moment=require(_0xbbfc('0x1'));var BPromise=require(_0xbbfc('0x2'));var rs=require(_0xbbfc('0x3'));var fs=require('fs');var Redis=require(_0xbbfc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbbfc('0x5'));var logger=require(_0xbbfc('0x6'))('rpc');var config=require(_0xbbfc('0x7'));var jayson=require(_0xbbfc('0x8'));var client=jayson[_0xbbfc('0x9')][_0xbbfc('0xa')]({'port':0x232a});config[_0xbbfc('0xb')]=_[_0xbbfc('0xc')](config[_0xbbfc('0xb')],{'host':_0xbbfc('0xd'),'port':0x18eb});var socket=require(_0xbbfc('0xe'))(new Redis(config[_0xbbfc('0xb')]));require(_0xbbfc('0xf'))[_0xbbfc('0x10')](socket);function respondWithRpcPromise(_0x45a66f,_0x55356d,_0x13ac99){return new BPromise(function(_0x167dd0,_0x4545ae){return client[_0xbbfc('0x11')](_0x45a66f,_0x13ac99)[_0xbbfc('0x12')](function(_0xeba2be){logger['info'](_0xbbfc('0x13'),_0x55356d,_0xbbfc('0x14'));logger[_0xbbfc('0x15')](_0xbbfc('0x16'),_0x55356d,_0xbbfc('0x14'),JSON[_0xbbfc('0x17')](_0xeba2be));if(_0xeba2be[_0xbbfc('0x18')]){if(_0xeba2be[_0xbbfc('0x18')]['code']===0x1f4){logger['error'](_0xbbfc('0x13'),_0x55356d,_0xeba2be[_0xbbfc('0x18')]['message']);return _0x4545ae(_0xeba2be['error'][_0xbbfc('0x19')]);}logger[_0xbbfc('0x18')](_0xbbfc('0x13'),_0x55356d,_0xeba2be[_0xbbfc('0x18')][_0xbbfc('0x19')]);return _0x167dd0(_0xeba2be[_0xbbfc('0x18')][_0xbbfc('0x19')]);}else{logger['info']('Team,\x20%s,\x20%s',_0x55356d,_0xbbfc('0x14'));_0x167dd0(_0xeba2be[_0xbbfc('0x1a')][_0xbbfc('0x19')]);}})['catch'](function(_0x3d68f8){logger[_0xbbfc('0x18')]('Team,\x20%s,\x20%s',_0x55356d,_0x3d68f8);_0x4545ae(_0x3d68f8);});});} \ No newline at end of file +var _0x0974=['bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','http','defaults','./team.socket','register','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch'];(function(_0x5a0f53,_0x3cf8a4){var _0x262793=function(_0x7d6caa){while(--_0x7d6caa){_0x5a0f53['push'](_0x5a0f53['shift']());}};_0x262793(++_0x3cf8a4);}(_0x0974,0xb0));var _0x4097=function(_0x216535,_0x4ce86c){_0x216535=_0x216535-0x0;var _0x39984a=_0x0974[_0x216535];return _0x39984a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4097('0x0'));var rs=require(_0x4097('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4097('0x2'))(_0x4097('0x3'));var config=require(_0x4097('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x4097('0x5')][_0x4097('0x6')]({'port':0x232a});config['redis']=_[_0x4097('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4097('0x8'))[_0x4097('0x9')](socket);function respondWithRpcPromise(_0x3b377b,_0x28550a,_0x107328){return new BPromise(function(_0xf4b2df,_0x390e09){return client[_0x4097('0xa')](_0x3b377b,_0x107328)[_0x4097('0xb')](function(_0x1629e2){logger['info'](_0x4097('0xc'),_0x28550a,_0x4097('0xd'));logger[_0x4097('0xe')](_0x4097('0xf'),_0x28550a,_0x4097('0xd'),JSON[_0x4097('0x10')](_0x1629e2));if(_0x1629e2['error']){if(_0x1629e2[_0x4097('0x11')]['code']===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x28550a,_0x1629e2[_0x4097('0x11')][_0x4097('0x12')]);return _0x390e09(_0x1629e2['error'][_0x4097('0x12')]);}logger[_0x4097('0x11')](_0x4097('0xc'),_0x28550a,_0x1629e2[_0x4097('0x11')][_0x4097('0x12')]);return _0xf4b2df(_0x1629e2[_0x4097('0x11')][_0x4097('0x12')]);}else{logger[_0x4097('0x13')](_0x4097('0xc'),_0x28550a,_0x4097('0xd'));_0xf4b2df(_0x1629e2[_0x4097('0x14')][_0x4097('0x12')]);}})[_0x4097('0x15')](function(_0x301157){logger[_0x4097('0x11')](_0x4097('0xc'),_0x28550a,_0x301157);_0x390e09(_0x301157);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index e3fb223..149eb7a 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 _0x2d28=['length','./team.events','save','emit','removeListener'];(function(_0x1617a5,_0x3d5b1f){var _0x255f1d=function(_0x2d3385){while(--_0x2d3385){_0x1617a5['push'](_0x1617a5['shift']());}};_0x255f1d(++_0x3d5b1f);}(_0x2d28,0x1be));var _0x82d2=function(_0x41bdd4,_0x3d5c76){_0x41bdd4=_0x41bdd4-0x0;var _0x5c03a6=_0x2d28[_0x41bdd4];return _0x5c03a6;};'use strict';var TeamEvents=require(_0x82d2('0x0'));var events=[_0x82d2('0x1'),'remove','update'];function createListener(_0x5bc4ff,_0x5f59d5){return function(_0x34e5aa){_0x5f59d5[_0x82d2('0x2')](_0x5bc4ff,_0x34e5aa);};}function removeListener(_0x5f5034,_0x272317){return function(){TeamEvents[_0x82d2('0x3')](_0x5f5034,_0x272317);};}exports['register']=function(_0x463ecf){for(var _0x4b55d2=0x0,_0x4dab01=events[_0x82d2('0x4')];_0x4b55d2<_0x4dab01;_0x4b55d2++){var _0x44b601=events[_0x4b55d2];var _0x37d12d=createListener('team:'+_0x44b601,_0x463ecf);TeamEvents['on'](_0x44b601,_0x37d12d);}}; \ No newline at end of file +var _0x22dd=['./team.events','save','remove','emit','removeListener','register'];(function(_0x41648f,_0x4a8936){var _0x20340a=function(_0x358f29){while(--_0x358f29){_0x41648f['push'](_0x41648f['shift']());}};_0x20340a(++_0x4a8936);}(_0x22dd,0xe4));var _0xd22d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x22dd[_0x3dd15e];return _0x231fd0;};'use strict';var TeamEvents=require(_0xd22d('0x0'));var events=[_0xd22d('0x1'),_0xd22d('0x2'),'update'];function createListener(_0x4f39fe,_0x42ad34){return function(_0x3764ac){_0x42ad34[_0xd22d('0x3')](_0x4f39fe,_0x3764ac);};}function removeListener(_0x166f52,_0x26e4ba){return function(){TeamEvents[_0xd22d('0x4')](_0x166f52,_0x26e4ba);};}exports[_0xd22d('0x5')]=function(_0x2df700){for(var _0x3f4197=0x0,_0x3a466f=events['length'];_0x3f4197<_0x3a466f;_0x3f4197++){var _0x40986a=events[_0x3f4197];var _0x3649df=createListener('team:'+_0x40986a,_0x2df700);TeamEvents['on'](_0x40986a,_0x3649df);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index d468b68..1e1b5ec 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 _0xd86f=['sequelize','exports','INTEGER'];(function(_0x440464,_0xb7afd8){var _0x2f4043=function(_0x40a871){while(--_0x40a871){_0x440464['push'](_0x440464['shift']());}};_0x2f4043(++_0xb7afd8);}(_0xd86f,0xf6));var _0xfd86=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xd86f[_0x599f41];return _0x2e4d58;};'use strict';var Sequelize=require(_0xfd86('0x0'));module[_0xfd86('0x1')]={'TeamId':{'type':Sequelize[_0xfd86('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xfd86('0x2')]}}; \ No newline at end of file +var _0x3cfb=['exports','INTEGER','sequelize'];(function(_0x53a7af,_0x1408a5){var _0x3cc7f6=function(_0x4bf101){while(--_0x4bf101){_0x53a7af['push'](_0x53a7af['shift']());}};_0x3cc7f6(++_0x1408a5);}(_0x3cfb,0x1b8));var _0xb3cf=function(_0x9474c2,_0x47eec9){_0x9474c2=_0x9474c2-0x0;var _0x3ac7b8=_0x3cfb[_0x9474c2];return _0x3ac7b8;};'use strict';var Sequelize=require(_0xb3cf('0x0'));module[_0xb3cf('0x1')]={'TeamId':{'type':Sequelize[_0xb3cf('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xb3cf('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 0e1ce34..59d2b31 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 _0x0936=['request-promise','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x26cc1c,_0x4f6b44){var _0x23d79c=function(_0x4782ad){while(--_0x4782ad){_0x26cc1c['push'](_0x26cc1c['shift']());}};_0x23d79c(++_0x4f6b44);}(_0x0936,0xde));var _0x6093=function(_0x33395e,_0x57bac4){_0x33395e=_0x33395e-0x0;var _0x3d5780=_0x0936[_0x33395e];return _0x3d5780;};'use strict';var _=require(_0x6093('0x0'));var util=require(_0x6093('0x1'));var logger=require(_0x6093('0x2'))(_0x6093('0x3'));var moment=require(_0x6093('0x4'));var BPromise=require(_0x6093('0x5'));var rp=require(_0x6093('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6093('0x7'));var attributes=require(_0x6093('0x8'));module[_0x6093('0x9')]=function(_0x30c8e4,_0x3bd339){return _0x30c8e4[_0x6093('0xa')](_0x6093('0xb'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4959=['team_has_voice_prefixes','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','TeamVoicePrefix'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x4959,0x9b));var _0x9495=function(_0xdc5aa8,_0x4931e0){_0xdc5aa8=_0xdc5aa8-0x0;var _0x328a1a=_0x4959[_0xdc5aa8];return _0x328a1a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9495('0x0'))(_0x9495('0x1'));var moment=require(_0x9495('0x2'));var BPromise=require('bluebird');var rp=require(_0x9495('0x3'));var fs=require('fs');var path=require(_0x9495('0x4'));var rimraf=require(_0x9495('0x5'));var config=require(_0x9495('0x6'));var attributes=require('./teamVoicePrefix.attributes');module[_0x9495('0x7')]=function(_0x2225a0,_0x2c716d){return _0x2225a0[_0x9495('0x8')](_0x9495('0x9'),attributes,{'tableName':_0x9495('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 699ab8f..6ac36db 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1d2adb,_0x34355e){var _0x3602bd=function(_0x22f7fb){while(--_0x22f7fb){_0x1d2adb['push'](_0x1d2adb['shift']());}};_0x3602bd(++_0x34355e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x54edc9,_0x345f01){_0x54edc9=_0x54edc9-0x0;var _0x2ae7a9=_0xcb91[_0x54edc9];return _0x2ae7a9;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5c9008,_0x4bb3a6){var _0x31a5e0=function(_0x3f7f1d){while(--_0x3f7f1d){_0x5c9008['push'](_0x5c9008['shift']());}};_0x31a5e0(++_0x4bb3a6);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 7961cfb..21a16bc 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 _0x7db4=['sequelize','exports','INTEGER'];(function(_0x3bafa7,_0x5067ed){var _0x3ee6d2=function(_0x34bd4e){while(--_0x34bd4e){_0x3bafa7['push'](_0x3bafa7['shift']());}};_0x3ee6d2(++_0x5067ed);}(_0x7db4,0x12f));var _0x47db=function(_0x3412e0,_0x5c4e4f){_0x3412e0=_0x3412e0-0x0;var _0x479b68=_0x7db4[_0x3412e0];return _0x479b68;};'use strict';var Sequelize=require(_0x47db('0x0'));module[_0x47db('0x1')]={'penalty':{'type':Sequelize[_0x47db('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3e51=['INTEGER'];(function(_0x3d122c,_0x7efb42){var _0x339ae1=function(_0x270524){while(--_0x270524){_0x3d122c['push'](_0x3d122c['shift']());}};_0x339ae1(++_0x7efb42);}(_0x3e51,0xa3));var _0x13e5=function(_0x159f86,_0x2a0c48){_0x159f86=_0x159f86-0x0;var _0x134d50=_0x3e51[_0x159f86];return _0x134d50;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x13e5('0x0')],'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 fe4801a..be6a03f 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 _0xac65=['moment','bluebird','request-promise','rimraf','../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger'];(function(_0x18f124,_0x2addb5){var _0x3fd244=function(_0x554152){while(--_0x554152){_0x18f124['push'](_0x18f124['shift']());}};_0x3fd244(++_0x2addb5);}(_0xac65,0x11d));var _0x5ac6=function(_0x186dc6,_0x2ef0cc){_0x186dc6=_0x186dc6-0x0;var _0x199386=_0xac65[_0x186dc6];return _0x199386;};'use strict';var _=require(_0x5ac6('0x0'));var util=require(_0x5ac6('0x1'));var logger=require(_0x5ac6('0x2'))('api');var moment=require(_0x5ac6('0x3'));var BPromise=require(_0x5ac6('0x4'));var rp=require(_0x5ac6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5ac6('0x6'));var config=require(_0x5ac6('0x7'));var attributes=require(_0x5ac6('0x8'));module['exports']=function(_0x2da747,_0x38711d){return _0x2da747[_0x5ac6('0x9')](_0x5ac6('0xa'),attributes,{'tableName':_0x5ac6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0b5=['path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','../../config/logger','api','bluebird','request-promise'];(function(_0x408e38,_0x23cda8){var _0x426b0e=function(_0x8f2898){while(--_0x8f2898){_0x408e38['push'](_0x408e38['shift']());}};_0x426b0e(++_0x23cda8);}(_0xd0b5,0x1b8));var _0x5d0b=function(_0x1b7e63,_0x3ae7d5){_0x1b7e63=_0x1b7e63-0x0;var _0x5335a0=_0xd0b5[_0x1b7e63];return _0x5335a0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5d0b('0x0'))(_0x5d0b('0x1'));var moment=require('moment');var BPromise=require(_0x5d0b('0x2'));var rp=require(_0x5d0b('0x3'));var fs=require('fs');var path=require(_0x5d0b('0x4'));var rimraf=require(_0x5d0b('0x5'));var config=require(_0x5d0b('0x6'));var attributes=require(_0x5d0b('0x7'));module[_0x5d0b('0x8')]=function(_0x41b7c1,_0xd514d0){return _0x41b7c1[_0x5d0b('0x9')](_0x5d0b('0xa'),attributes,{'tableName':_0x5d0b('0xb'),'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 b094540..5e430b8 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 _0x8bd1=['request','then','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','TeamVoiceQueue,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x3ede68,_0x21c013){var _0x2cf761=function(_0x2d7ee0){while(--_0x2d7ee0){_0x3ede68['push'](_0x3ede68['shift']());}};_0x2cf761(++_0x21c013);}(_0x8bd1,0x1da));var _0x18bd=function(_0x5a327a,_0x4407cd){_0x5a327a=_0x5a327a-0x0;var _0x36a54e=_0x8bd1[_0x5a327a];return _0x36a54e;};'use strict';var _=require(_0x18bd('0x0'));var util=require('util');var moment=require(_0x18bd('0x1'));var BPromise=require(_0x18bd('0x2'));var rs=require(_0x18bd('0x3'));var fs=require('fs');var Redis=require(_0x18bd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x18bd('0x5'));var logger=require('../../config/logger')(_0x18bd('0x6'));var config=require(_0x18bd('0x7'));var jayson=require(_0x18bd('0x8'));var client=jayson[_0x18bd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ea0bd,_0x3ecfc9,_0x246cd1){return new BPromise(function(_0x3132df,_0x589025){return client[_0x18bd('0xa')](_0x4ea0bd,_0x246cd1)[_0x18bd('0xb')](function(_0x250068){logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x3ecfc9,'request\x20sent');logger['debug'](_0x18bd('0xc'),_0x3ecfc9,_0x18bd('0xd'),JSON[_0x18bd('0xe')](_0x250068));if(_0x250068['error']){if(_0x250068['error'][_0x18bd('0xf')]===0x1f4){logger[_0x18bd('0x10')](_0x18bd('0x11'),_0x3ecfc9,_0x250068[_0x18bd('0x10')][_0x18bd('0x12')]);return _0x589025(_0x250068[_0x18bd('0x10')][_0x18bd('0x12')]);}logger[_0x18bd('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3ecfc9,_0x250068[_0x18bd('0x10')][_0x18bd('0x12')]);return _0x3132df(_0x250068['error'][_0x18bd('0x12')]);}else{logger[_0x18bd('0x13')](_0x18bd('0x11'),_0x3ecfc9,_0x18bd('0xd'));_0x3132df(_0x250068[_0x18bd('0x14')][_0x18bd('0x12')]);}})[_0x18bd('0x15')](function(_0x8aa99f){logger['error'](_0x18bd('0x11'),_0x3ecfc9,_0x8aa99f);_0x589025(_0x8aa99f);});});} \ No newline at end of file +var _0xb549=['request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xb549,0x164));var _0x9b54=function(_0x8db3ab,_0x797312){_0x8db3ab=_0x8db3ab-0x0;var _0x5814a8=_0xb549[_0x8db3ab];return _0x5814a8;};'use strict';var _=require(_0x9b54('0x0'));var util=require(_0x9b54('0x1'));var moment=require(_0x9b54('0x2'));var BPromise=require(_0x9b54('0x3'));var rs=require(_0x9b54('0x4'));var fs=require('fs');var Redis=require(_0x9b54('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9b54('0x6'));var logger=require(_0x9b54('0x7'))(_0x9b54('0x8'));var config=require(_0x9b54('0x9'));var jayson=require(_0x9b54('0xa'));var client=jayson[_0x9b54('0xb')][_0x9b54('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ca4a1,_0xad9f5d,_0x277695){return new BPromise(function(_0x13bcfd,_0x1d1723){return client[_0x9b54('0xd')](_0x1ca4a1,_0x277695)[_0x9b54('0xe')](function(_0x470578){logger[_0x9b54('0xf')](_0x9b54('0x10'),_0xad9f5d,'request\x20sent');logger[_0x9b54('0x11')](_0x9b54('0x12'),_0xad9f5d,_0x9b54('0x13'),JSON[_0x9b54('0x14')](_0x470578));if(_0x470578[_0x9b54('0x15')]){if(_0x470578[_0x9b54('0x15')]['code']===0x1f4){logger['error'](_0x9b54('0x10'),_0xad9f5d,_0x470578[_0x9b54('0x15')][_0x9b54('0x16')]);return _0x1d1723(_0x470578[_0x9b54('0x15')]['message']);}logger[_0x9b54('0x15')]('TeamVoiceQueue,\x20%s,\x20%s',_0xad9f5d,_0x470578['error'][_0x9b54('0x16')]);return _0x13bcfd(_0x470578['error'][_0x9b54('0x16')]);}else{logger[_0x9b54('0xf')](_0x9b54('0x10'),_0xad9f5d,_0x9b54('0x13'));_0x13bcfd(_0x470578[_0x9b54('0x17')][_0x9b54('0x16')]);}})[_0x9b54('0x18')](function(_0x217b44){logger[_0x9b54('0x15')]('TeamVoiceQueue,\x20%s,\x20%s',_0xad9f5d,_0x217b44);_0x1d1723(_0x217b44);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 095af68..b7c2c30 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 _0x04fa=['destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./template.controller','get','index','/:id','show','delete'];(function(_0x4f8f3b,_0x43281b){var _0x4c250c=function(_0x19a7ff){while(--_0x19a7ff){_0x4f8f3b['push'](_0x4f8f3b['shift']());}};_0x4c250c(++_0x43281b);}(_0x04fa,0x119));var _0xa04f=function(_0xcbf28b,_0xd0c27d){_0xcbf28b=_0xcbf28b-0x0;var _0xb07b0=_0x04fa[_0xcbf28b];return _0xb07b0;};'use strict';var multer=require('multer');var util=require(_0xa04f('0x0'));var path=require(_0xa04f('0x1'));var timeout=require(_0xa04f('0x2'));var express=require(_0xa04f('0x3'));var router=express[_0xa04f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa04f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa04f('0x6'));var controller=require(_0xa04f('0x7'));router[_0xa04f('0x8')]('/',auth['isAuthenticated'](),controller[_0xa04f('0x9')]);router[_0xa04f('0x8')](_0xa04f('0xa'),auth['isAuthenticated'](),controller[_0xa04f('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa04f('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xa04f('0xc')](_0xa04f('0xa'),auth['isAuthenticated'](),controller[_0xa04f('0xd')]);module['exports']=router; \ No newline at end of file +var _0x0a93=['path','express','Router','fs-extra','../../components/auth/service','index','get','show','post','isAuthenticated','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x4476c7,_0x48ed6d){var _0x2c47c5=function(_0x39ad83){while(--_0x39ad83){_0x4476c7['push'](_0x4476c7['shift']());}};_0x2c47c5(++_0x48ed6d);}(_0x0a93,0x6a));var _0x30a9=function(_0xdf3ab6,_0x261eed){_0xdf3ab6=_0xdf3ab6-0x0;var _0x18d630=_0x0a93[_0xdf3ab6];return _0x18d630;};'use strict';var multer=require(_0x30a9('0x0'));var util=require(_0x30a9('0x1'));var path=require(_0x30a9('0x2'));var timeout=require('connect-timeout');var express=require(_0x30a9('0x3'));var router=express[_0x30a9('0x4')]();var fs_extra=require(_0x30a9('0x5'));var auth=require(_0x30a9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./template.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x30a9('0x7')]);router[_0x30a9('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x30a9('0x9')]);router[_0x30a9('0xa')]('/',auth[_0x30a9('0xb')](),controller['create']);router[_0x30a9('0xc')](_0x30a9('0xd'),auth[_0x30a9('0xb')](),controller[_0x30a9('0xe')]);router[_0x30a9('0xf')](_0x30a9('0xd'),auth[_0x30a9('0xb')](),controller[_0x30a9('0x10')]);module[_0x30a9('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 9a53b55..66b232e 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 _0xcf0b=['exports','STRING','TEXT'];(function(_0x1a7a14,_0x5e7a1b){var _0x62b232=function(_0x7afe1f){while(--_0x7afe1f){_0x1a7a14['push'](_0x1a7a14['shift']());}};_0x62b232(++_0x5e7a1b);}(_0xcf0b,0x17d));var _0xbcf0=function(_0x33a389,_0x59f55e){_0x33a389=_0x33a389-0x0;var _0x7785db=_0xcf0b[_0x33a389];return _0x7785db;};'use strict';var Sequelize=require('sequelize');module[_0xbcf0('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbcf0('0x1')]},'html':{'type':Sequelize[_0xbcf0('0x2')]}}; \ No newline at end of file +var _0xdfbc=['sequelize','STRING','TEXT'];(function(_0x39fe49,_0x3b004f){var _0xbfd16f=function(_0x31e03f){while(--_0x31e03f){_0x39fe49['push'](_0x39fe49['shift']());}};_0xbfd16f(++_0x3b004f);}(_0xdfbc,0x1ec));var _0xcdfb=function(_0x3e4ae9,_0x52426d){_0x3e4ae9=_0x3e4ae9-0x0;var _0x59e72e=_0xdfbc[_0x3e4ae9];return _0x59e72e;};'use strict';var Sequelize=require(_0xcdfb('0x0'));module['exports']={'name':{'type':Sequelize[_0xcdfb('0x1')]},'description':{'type':Sequelize[_0xcdfb('0x1')]},'html':{'type':Sequelize[_0xcdfb('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 9341af9..f3f3bf0 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 _0x16db=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','destroy','then','get','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','merge','options','Template','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs'];(function(_0x2ffc46,_0x35ce3c){var _0x1eda8f=function(_0x285344){while(--_0x285344){_0x2ffc46['push'](_0x2ffc46['shift']());}};_0x1eda8f(++_0x35ce3c);}(_0x16db,0x94));var _0xb16d=function(_0x2f82e7,_0x50f448){_0x2f82e7=_0x2f82e7-0x0;var _0x483927=_0x16db[_0x2f82e7];return _0x483927;};'use strict';var emlformat=require(_0xb16d('0x0'));var rimraf=require(_0xb16d('0x1'));var zipdir=require(_0xb16d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb16d('0x3'));var moment=require('moment');var BPromise=require(_0xb16d('0x4'));var Mustache=require(_0xb16d('0x5'));var util=require(_0xb16d('0x6'));var path=require('path');var sox=require(_0xb16d('0x7'));var csv=require(_0xb16d('0x8'));var ejs=require(_0xb16d('0x9'));var fs=require('fs');var fs_extra=require(_0xb16d('0xa'));var _=require(_0xb16d('0xb'));var squel=require(_0xb16d('0xc'));var crypto=require(_0xb16d('0xd'));var jsforce=require(_0xb16d('0xe'));var deskjs=require(_0xb16d('0xf'));var toCsv=require(_0xb16d('0x8'));var querystring=require(_0xb16d('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb16d('0x11'));var as=require(_0xb16d('0x12'));var hardwareService=require(_0xb16d('0x13'));var logger=require(_0xb16d('0x14'))(_0xb16d('0x15'));var utils=require(_0xb16d('0x16'));var config=require(_0xb16d('0x17'));var licenseUtil=require(_0xb16d('0x18'));var db=require(_0xb16d('0x19'))['db'];function respondWithStatusCode(_0x2a783a,_0x41b35f){_0x41b35f=_0x41b35f||0xcc;return function(_0x4e8ac6){if(_0x4e8ac6){return _0x2a783a[_0xb16d('0x1a')](_0x41b35f);}return _0x2a783a[_0xb16d('0x1b')](_0x41b35f)[_0xb16d('0x1c')]();};}function respondWithResult(_0x410bd7,_0x295c5a){_0x295c5a=_0x295c5a||0xc8;return function(_0x436ca4){if(_0x436ca4){return _0x410bd7[_0xb16d('0x1b')](_0x295c5a)[_0xb16d('0x1d')](_0x436ca4);}};}function respondWithFilteredResult(_0x2c8686,_0x5379b0){return function(_0x997b26){if(_0x997b26){var _0x1c31cc=typeof _0x5379b0[_0xb16d('0x1e')]==='undefined'&&typeof _0x5379b0[_0xb16d('0x1f')]===_0xb16d('0x20');var _0x4578a7=_0x997b26[_0xb16d('0x21')];var _0x1803c7=_0x1c31cc?0x0:_0x5379b0['offset'];var _0x223de2=_0x1c31cc?_0x997b26['count']:_0x5379b0[_0xb16d('0x1e')]+_0x5379b0['limit'];var _0x356cb8;if(_0x223de2>=_0x4578a7){_0x223de2=_0x4578a7;_0x356cb8=0xc8;}else{_0x356cb8=0xce;}_0x2c8686[_0xb16d('0x1b')](_0x356cb8);return _0x2c8686['set'](_0xb16d('0x22'),_0x1803c7+'-'+_0x223de2+'/'+_0x4578a7)[_0xb16d('0x1d')](_0x997b26);}return null;};}function patchUpdates(_0x5e6a31){return function(_0x37eb7c){try{jsonpatch[_0xb16d('0x23')](_0x37eb7c,_0x5e6a31,!![]);}catch(_0x4fb404){return BPromise[_0xb16d('0x24')](_0x4fb404);}return _0x37eb7c[_0xb16d('0x25')]();};}function saveUpdates(_0x526403,_0x5eecb0){return function(_0x3c9906){if(_0x3c9906){return _0x3c9906['update'](_0x526403)['then'](function(_0xb8b458){return _0xb8b458;});}return null;};}function removeEntity(_0x32474a,_0x3fdea3){return function(_0x4038c1){if(_0x4038c1){return _0x4038c1[_0xb16d('0x26')]()[_0xb16d('0x27')](function(){var _0x128e46=_0x4038c1[_0xb16d('0x28')]({'plain':!![]});var _0x235e7b='Templates';return db['UserProfileResource'][_0xb16d('0x26')]({'where':{'type':_0x235e7b,'resourceId':_0x128e46['id']}})[_0xb16d('0x27')](function(){return _0x4038c1;});})[_0xb16d('0x27')](function(){_0x32474a[_0xb16d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x170ea0,_0x73029){return function(_0x310d75){if(!_0x310d75){_0x170ea0[_0xb16d('0x1a')](0x194);}return _0x310d75;};}function handleError(_0x342477,_0x211439){_0x211439=_0x211439||0x1f4;return function(_0x1d1b7a){logger[_0xb16d('0x29')](_0x1d1b7a['stack']);if(_0x1d1b7a[_0xb16d('0x2a')]){delete _0x1d1b7a[_0xb16d('0x2a')];}_0x342477[_0xb16d('0x1b')](_0x211439)[_0xb16d('0x2b')](_0x1d1b7a);};}exports[_0xb16d('0x2c')]=function(_0x10a3bd,_0x1fe259){var _0x3b65b8={},_0x22605d={},_0x26177e={'count':0x0,'rows':[]};var _0x5f3f41=_[_0xb16d('0x2d')](db['Template'][_0xb16d('0x2e')],function(_0x2578ea){return{'name':_0x2578ea[_0xb16d('0x2f')],'type':_0x2578ea[_0xb16d('0x30')]['key']};});_0x22605d[_0xb16d('0x31')]=_[_0xb16d('0x2d')](_0x5f3f41,_0xb16d('0x2a'));_0x22605d[_0xb16d('0x32')]=_[_0xb16d('0x33')](_0x10a3bd['query']);_0x22605d[_0xb16d('0x34')]=_[_0xb16d('0x35')](_0x22605d['model'],_0x22605d[_0xb16d('0x32')]);_0x3b65b8[_0xb16d('0x36')]=_[_0xb16d('0x35')](_0x22605d[_0xb16d('0x31')],qs[_0xb16d('0x37')](_0x10a3bd[_0xb16d('0x32')]['fields']));_0x3b65b8[_0xb16d('0x36')]=_0x3b65b8[_0xb16d('0x36')][_0xb16d('0x38')]?_0x3b65b8[_0xb16d('0x36')]:_0x22605d[_0xb16d('0x31')];if(!_0x10a3bd[_0xb16d('0x32')][_0xb16d('0x39')](_0xb16d('0x3a'))){_0x3b65b8[_0xb16d('0x1f')]=qs[_0xb16d('0x1f')](_0x10a3bd['query'][_0xb16d('0x1f')]);_0x3b65b8[_0xb16d('0x1e')]=qs[_0xb16d('0x1e')](_0x10a3bd[_0xb16d('0x32')][_0xb16d('0x1e')]);}_0x3b65b8[_0xb16d('0x3b')]=qs['sort'](_0x10a3bd[_0xb16d('0x32')]['sort']);_0x3b65b8['where']=qs[_0xb16d('0x34')](_[_0xb16d('0x3c')](_0x10a3bd['query'],_0x22605d[_0xb16d('0x34')]),_0x5f3f41);if(_0x10a3bd['query'][_0xb16d('0x3d')]){_0x3b65b8['where']=_['merge'](_0x3b65b8[_0xb16d('0x3e')],{'$or':_[_0xb16d('0x2d')](_0x5f3f41,function(_0xf4d30){if(_0xf4d30[_0xb16d('0x30')]!==_0xb16d('0x3f')){var _0x2bddbe={};_0x2bddbe[_0xf4d30[_0xb16d('0x2a')]]={'$like':'%'+_0x10a3bd[_0xb16d('0x32')][_0xb16d('0x3d')]+'%'};return _0x2bddbe;}})});}_0x3b65b8=_[_0xb16d('0x40')]({},_0x3b65b8,_0x10a3bd[_0xb16d('0x41')]);var _0x377c8a={'where':_0x3b65b8[_0xb16d('0x3e')]};return db[_0xb16d('0x42')][_0xb16d('0x21')](_0x377c8a)[_0xb16d('0x27')](function(_0x1888a3){_0x26177e[_0xb16d('0x21')]=_0x1888a3;if(_0x10a3bd['query'][_0xb16d('0x43')]){_0x3b65b8[_0xb16d('0x44')]=[{'all':!![]}];}return db[_0xb16d('0x42')][_0xb16d('0x45')](_0x3b65b8);})[_0xb16d('0x27')](function(_0x1fc4db){_0x26177e[_0xb16d('0x46')]=_0x1fc4db;return _0x26177e;})['then'](respondWithFilteredResult(_0x1fe259,_0x3b65b8))[_0xb16d('0x47')](handleError(_0x1fe259,null));};exports[_0xb16d('0x48')]=function(_0x58f8d5,_0x59e5ce){var _0x45de38={'raw':!![],'where':{'id':_0x58f8d5[_0xb16d('0x49')]['id']}},_0x2c2e03={};_0x2c2e03[_0xb16d('0x31')]=_[_0xb16d('0x33')](db['Template']['rawAttributes']);_0x2c2e03[_0xb16d('0x32')]=_['keys'](_0x58f8d5[_0xb16d('0x32')]);_0x2c2e03[_0xb16d('0x34')]=_[_0xb16d('0x35')](_0x2c2e03[_0xb16d('0x31')],_0x2c2e03[_0xb16d('0x32')]);_0x45de38[_0xb16d('0x36')]=_['intersection'](_0x2c2e03[_0xb16d('0x31')],qs[_0xb16d('0x37')](_0x58f8d5[_0xb16d('0x32')][_0xb16d('0x37')]));_0x45de38[_0xb16d('0x36')]=_0x45de38[_0xb16d('0x36')][_0xb16d('0x38')]?_0x45de38['attributes']:_0x2c2e03[_0xb16d('0x31')];if(_0x58f8d5[_0xb16d('0x32')][_0xb16d('0x43')]){_0x45de38[_0xb16d('0x44')]=[{'all':!![]}];}_0x45de38=_[_0xb16d('0x40')]({},_0x45de38,_0x58f8d5[_0xb16d('0x41')]);return db['Template']['find'](_0x45de38)['then'](handleEntityNotFound(_0x59e5ce,null))[_0xb16d('0x27')](respondWithResult(_0x59e5ce,null))['catch'](handleError(_0x59e5ce,null));};exports[_0xb16d('0x4a')]=function(_0x1866ef,_0x36337){return db[_0xb16d('0x42')][_0xb16d('0x4a')](_0x1866ef[_0xb16d('0x4b')],{})[_0xb16d('0x27')](function(_0x4e18b1){var _0x4e5e09=_0x1866ef[_0xb16d('0x4c')][_0xb16d('0x28')]({'plain':!![]});if(!_0x4e5e09)throw new Error(_0xb16d('0x4d'));if(_0x4e5e09[_0xb16d('0x4e')]===_0xb16d('0x4c')){var _0x50ae2c=_0x4e18b1[_0xb16d('0x28')]({'plain':!![]});var _0x59002e='Templates';return db[_0xb16d('0x4f')][_0xb16d('0x50')]({'where':{'name':_0x59002e,'userProfileId':_0x4e5e09[_0xb16d('0x51')]},'raw':!![]})[_0xb16d('0x27')](function(_0x3ec0a8){if(_0x3ec0a8&&_0x3ec0a8['autoAssociation']===0x0){return db['UserProfileResource'][_0xb16d('0x4a')]({'name':_0x50ae2c['name'],'resourceId':_0x50ae2c['id'],'type':_0x3ec0a8[_0xb16d('0x2a')],'sectionId':_0x3ec0a8['id']},{})[_0xb16d('0x27')](function(){return _0x4e18b1;});}else{return _0x4e18b1;}})[_0xb16d('0x47')](function(_0x2c673f){logger[_0xb16d('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c673f);throw _0x2c673f;});}return _0x4e18b1;})['then'](respondWithResult(_0x36337,0xc9))['catch'](handleError(_0x36337,null));};exports[_0xb16d('0x52')]=function(_0x1d87ad,_0x53d758){if(_0x1d87ad['body']['id']){delete _0x1d87ad[_0xb16d('0x4b')]['id'];}return db[_0xb16d('0x42')][_0xb16d('0x50')]({'where':{'id':_0x1d87ad[_0xb16d('0x49')]['id']}})[_0xb16d('0x27')](handleEntityNotFound(_0x53d758,null))[_0xb16d('0x27')](saveUpdates(_0x1d87ad[_0xb16d('0x4b')],null))[_0xb16d('0x27')](respondWithResult(_0x53d758,null))[_0xb16d('0x47')](handleError(_0x53d758,null));};exports['destroy']=function(_0x3a7b3f,_0x1f2f6a){return db[_0xb16d('0x42')]['find']({'where':{'id':_0x3a7b3f[_0xb16d('0x49')]['id']}})[_0xb16d('0x27')](handleEntityNotFound(_0x1f2f6a,null))['then'](removeEntity(_0x1f2f6a,null))[_0xb16d('0x47')](handleError(_0x1f2f6a,null));}; \ No newline at end of file +var _0x98e5=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','Templates','sendStatus','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Template','findAll','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','update','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2e6c75,_0x1bdbb7){var _0x13a9ea=function(_0x6ad297){while(--_0x6ad297){_0x2e6c75['push'](_0x2e6c75['shift']());}};_0x13a9ea(++_0x1bdbb7);}(_0x98e5,0x12d));var _0x598e=function(_0x46dd53,_0x16df27){_0x46dd53=_0x46dd53-0x0;var _0x829672=_0x98e5[_0x46dd53];return _0x829672;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x598e('0x0'));var zipdir=require(_0x598e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x598e('0x2'));var moment=require(_0x598e('0x3'));var BPromise=require(_0x598e('0x4'));var Mustache=require(_0x598e('0x5'));var util=require('util');var path=require(_0x598e('0x6'));var sox=require('sox');var csv=require(_0x598e('0x7'));var ejs=require(_0x598e('0x8'));var fs=require('fs');var fs_extra=require(_0x598e('0x9'));var _=require('lodash');var squel=require(_0x598e('0xa'));var crypto=require(_0x598e('0xb'));var jsforce=require(_0x598e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x598e('0x7'));var querystring=require(_0x598e('0xd'));var Papa=require(_0x598e('0xe'));var Redis=require(_0x598e('0xf'));var authService=require(_0x598e('0x10'));var qs=require(_0x598e('0x11'));var as=require(_0x598e('0x12'));var hardwareService=require(_0x598e('0x13'));var logger=require(_0x598e('0x14'))('api');var utils=require(_0x598e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x598e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54901b,_0x16a4fc){_0x16a4fc=_0x16a4fc||0xcc;return function(_0x47556c){if(_0x47556c){return _0x54901b['sendStatus'](_0x16a4fc);}return _0x54901b[_0x598e('0x17')](_0x16a4fc)[_0x598e('0x18')]();};}function respondWithResult(_0x4623e9,_0xe8638){_0xe8638=_0xe8638||0xc8;return function(_0x442dfc){if(_0x442dfc){return _0x4623e9[_0x598e('0x17')](_0xe8638)[_0x598e('0x19')](_0x442dfc);}};}function respondWithFilteredResult(_0x4f4074,_0x5404a2){return function(_0x253385){if(_0x253385){var _0x3a756b=typeof _0x5404a2['offset']===_0x598e('0x1a')&&typeof _0x5404a2['limit']===_0x598e('0x1a');var _0x2b1ab5=_0x253385[_0x598e('0x1b')];var _0x1e1cb9=_0x3a756b?0x0:_0x5404a2['offset'];var _0x55dc11=_0x3a756b?_0x253385[_0x598e('0x1b')]:_0x5404a2[_0x598e('0x1c')]+_0x5404a2[_0x598e('0x1d')];var _0xd6748;if(_0x55dc11>=_0x2b1ab5){_0x55dc11=_0x2b1ab5;_0xd6748=0xc8;}else{_0xd6748=0xce;}_0x4f4074['status'](_0xd6748);return _0x4f4074[_0x598e('0x1e')](_0x598e('0x1f'),_0x1e1cb9+'-'+_0x55dc11+'/'+_0x2b1ab5)[_0x598e('0x19')](_0x253385);}return null;};}function patchUpdates(_0x127751){return function(_0x35f321){try{jsonpatch[_0x598e('0x20')](_0x35f321,_0x127751,!![]);}catch(_0x440716){return BPromise[_0x598e('0x21')](_0x440716);}return _0x35f321[_0x598e('0x22')]();};}function saveUpdates(_0x145d66,_0x126aa7){return function(_0x47ef5f){if(_0x47ef5f){return _0x47ef5f['update'](_0x145d66)[_0x598e('0x23')](function(_0x544f89){return _0x544f89;});}return null;};}function removeEntity(_0xe11703,_0x2434a8){return function(_0x1748bf){if(_0x1748bf){return _0x1748bf[_0x598e('0x24')]()[_0x598e('0x23')](function(){var _0xef6362=_0x1748bf[_0x598e('0x25')]({'plain':!![]});var _0x3984bc=_0x598e('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x3984bc,'resourceId':_0xef6362['id']}})[_0x598e('0x23')](function(){return _0x1748bf;});})['then'](function(){_0xe11703[_0x598e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21d5c7,_0x76949a){return function(_0x3e1d73){if(!_0x3e1d73){_0x21d5c7[_0x598e('0x27')](0x194);}return _0x3e1d73;};}function handleError(_0x27b9a9,_0x27e73b){_0x27e73b=_0x27e73b||0x1f4;return function(_0xe869ef){logger[_0x598e('0x28')](_0xe869ef['stack']);if(_0xe869ef[_0x598e('0x29')]){delete _0xe869ef[_0x598e('0x29')];}_0x27b9a9['status'](_0x27e73b)['send'](_0xe869ef);};}exports[_0x598e('0x2a')]=function(_0x33f7fe,_0x45d47b){var _0x27d501={},_0x55e37b={},_0x1f8ab5={'count':0x0,'rows':[]};var _0x322976=_[_0x598e('0x2b')](db['Template'][_0x598e('0x2c')],function(_0x4c4186){return{'name':_0x4c4186[_0x598e('0x2d')],'type':_0x4c4186[_0x598e('0x2e')][_0x598e('0x2f')]};});_0x55e37b[_0x598e('0x30')]=_[_0x598e('0x2b')](_0x322976,_0x598e('0x29'));_0x55e37b[_0x598e('0x31')]=_[_0x598e('0x32')](_0x33f7fe['query']);_0x55e37b[_0x598e('0x33')]=_[_0x598e('0x34')](_0x55e37b[_0x598e('0x30')],_0x55e37b[_0x598e('0x31')]);_0x27d501[_0x598e('0x35')]=_[_0x598e('0x34')](_0x55e37b[_0x598e('0x30')],qs['fields'](_0x33f7fe[_0x598e('0x31')][_0x598e('0x36')]));_0x27d501[_0x598e('0x35')]=_0x27d501['attributes'][_0x598e('0x37')]?_0x27d501['attributes']:_0x55e37b[_0x598e('0x30')];if(!_0x33f7fe[_0x598e('0x31')][_0x598e('0x38')](_0x598e('0x39'))){_0x27d501['limit']=qs['limit'](_0x33f7fe['query'][_0x598e('0x1d')]);_0x27d501['offset']=qs[_0x598e('0x1c')](_0x33f7fe[_0x598e('0x31')]['offset']);}_0x27d501[_0x598e('0x3a')]=qs[_0x598e('0x3b')](_0x33f7fe[_0x598e('0x31')][_0x598e('0x3b')]);_0x27d501[_0x598e('0x3c')]=qs['filters'](_['pick'](_0x33f7fe['query'],_0x55e37b[_0x598e('0x33')]),_0x322976);if(_0x33f7fe[_0x598e('0x31')][_0x598e('0x3d')]){_0x27d501[_0x598e('0x3c')]=_[_0x598e('0x3e')](_0x27d501[_0x598e('0x3c')],{'$or':_[_0x598e('0x2b')](_0x322976,function(_0x139ef7){if(_0x139ef7['type']!==_0x598e('0x3f')){var _0x1a5c15={};_0x1a5c15[_0x139ef7[_0x598e('0x29')]]={'$like':'%'+_0x33f7fe[_0x598e('0x31')][_0x598e('0x3d')]+'%'};return _0x1a5c15;}})});}_0x27d501=_[_0x598e('0x3e')]({},_0x27d501,_0x33f7fe[_0x598e('0x40')]);var _0x588189={'where':_0x27d501[_0x598e('0x3c')]};return db[_0x598e('0x41')][_0x598e('0x1b')](_0x588189)[_0x598e('0x23')](function(_0x375930){_0x1f8ab5[_0x598e('0x1b')]=_0x375930;if(_0x33f7fe['query']['includeAll']){_0x27d501['include']=[{'all':!![]}];}return db['Template'][_0x598e('0x42')](_0x27d501);})[_0x598e('0x23')](function(_0x2ff064){_0x1f8ab5['rows']=_0x2ff064;return _0x1f8ab5;})[_0x598e('0x23')](respondWithFilteredResult(_0x45d47b,_0x27d501))['catch'](handleError(_0x45d47b,null));};exports[_0x598e('0x43')]=function(_0x3479ae,_0x1cc253){var _0x198067={'raw':!![],'where':{'id':_0x3479ae[_0x598e('0x44')]['id']}},_0x5912a5={};_0x5912a5[_0x598e('0x30')]=_[_0x598e('0x32')](db[_0x598e('0x41')][_0x598e('0x2c')]);_0x5912a5[_0x598e('0x31')]=_[_0x598e('0x32')](_0x3479ae[_0x598e('0x31')]);_0x5912a5[_0x598e('0x33')]=_[_0x598e('0x34')](_0x5912a5['model'],_0x5912a5[_0x598e('0x31')]);_0x198067['attributes']=_[_0x598e('0x34')](_0x5912a5[_0x598e('0x30')],qs[_0x598e('0x36')](_0x3479ae[_0x598e('0x31')][_0x598e('0x36')]));_0x198067[_0x598e('0x35')]=_0x198067[_0x598e('0x35')]['length']?_0x198067['attributes']:_0x5912a5[_0x598e('0x30')];if(_0x3479ae['query']['includeAll']){_0x198067['include']=[{'all':!![]}];}_0x198067=_[_0x598e('0x3e')]({},_0x198067,_0x3479ae[_0x598e('0x40')]);return db[_0x598e('0x41')][_0x598e('0x45')](_0x198067)['then'](handleEntityNotFound(_0x1cc253,null))['then'](respondWithResult(_0x1cc253,null))[_0x598e('0x46')](handleError(_0x1cc253,null));};exports[_0x598e('0x47')]=function(_0x5ce691,_0x3686f2){return db[_0x598e('0x41')][_0x598e('0x47')](_0x5ce691[_0x598e('0x48')],{})[_0x598e('0x23')](function(_0x54eddf){var _0xc9bde9=_0x5ce691[_0x598e('0x49')][_0x598e('0x25')]({'plain':!![]});if(!_0xc9bde9)throw new Error(_0x598e('0x4a'));if(_0xc9bde9[_0x598e('0x4b')]===_0x598e('0x49')){var _0x14a5d4=_0x54eddf[_0x598e('0x25')]({'plain':!![]});var _0x27dbbc='Templates';return db[_0x598e('0x4c')][_0x598e('0x45')]({'where':{'name':_0x27dbbc,'userProfileId':_0xc9bde9[_0x598e('0x4d')]},'raw':!![]})[_0x598e('0x23')](function(_0x4ffe88){if(_0x4ffe88&&_0x4ffe88['autoAssociation']===0x0){return db[_0x598e('0x4e')][_0x598e('0x47')]({'name':_0x14a5d4[_0x598e('0x29')],'resourceId':_0x14a5d4['id'],'type':_0x4ffe88[_0x598e('0x29')],'sectionId':_0x4ffe88['id']},{})[_0x598e('0x23')](function(){return _0x54eddf;});}else{return _0x54eddf;}})[_0x598e('0x46')](function(_0x4d5aa1){logger[_0x598e('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d5aa1);throw _0x4d5aa1;});}return _0x54eddf;})[_0x598e('0x23')](respondWithResult(_0x3686f2,0xc9))['catch'](handleError(_0x3686f2,null));};exports[_0x598e('0x4f')]=function(_0x1f9a32,_0x15e6fc){if(_0x1f9a32[_0x598e('0x48')]['id']){delete _0x1f9a32[_0x598e('0x48')]['id'];}return db[_0x598e('0x41')][_0x598e('0x45')]({'where':{'id':_0x1f9a32['params']['id']}})['then'](handleEntityNotFound(_0x15e6fc,null))[_0x598e('0x23')](saveUpdates(_0x1f9a32[_0x598e('0x48')],null))[_0x598e('0x23')](respondWithResult(_0x15e6fc,null))[_0x598e('0x46')](handleError(_0x15e6fc,null));};exports['destroy']=function(_0x18e7c3,_0x28f4e3){return db[_0x598e('0x41')][_0x598e('0x45')]({'where':{'id':_0x18e7c3['params']['id']}})[_0x598e('0x23')](handleEntityNotFound(_0x28f4e3,null))['then'](removeEntity(_0x28f4e3,null))[_0x598e('0x46')](handleError(_0x28f4e3,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 5032fd9..ed06095 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 _0xc427=['path','rimraf','../../config/environment','./template.attributes','Template','tools_templates','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x23e4b1,_0x5a71dd){var _0x174327=function(_0x2358df){while(--_0x2358df){_0x23e4b1['push'](_0x23e4b1['shift']());}};_0x174327(++_0x5a71dd);}(_0xc427,0x1e6));var _0x7c42=function(_0x18b8c1,_0x10c8af){_0x18b8c1=_0x18b8c1-0x0;var _0x394506=_0xc427[_0x18b8c1];return _0x394506;};'use strict';var _=require(_0x7c42('0x0'));var util=require('util');var logger=require(_0x7c42('0x1'))(_0x7c42('0x2'));var moment=require(_0x7c42('0x3'));var BPromise=require(_0x7c42('0x4'));var rp=require(_0x7c42('0x5'));var fs=require('fs');var path=require(_0x7c42('0x6'));var rimraf=require(_0x7c42('0x7'));var config=require(_0x7c42('0x8'));var attributes=require(_0x7c42('0x9'));module['exports']=function(_0x1dcfc,_0x401ab8){return _0x1dcfc['define'](_0x7c42('0xa'),attributes,{'tableName':_0x7c42('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c5d=['bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','define','Template','tools_templates','lodash','util','../../config/logger','api','moment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7c5d,0xf7));var _0xd7c5=function(_0x2dc6e0,_0x29b460){_0x2dc6e0=_0x2dc6e0-0x0;var _0x42164b=_0x7c5d[_0x2dc6e0];return _0x42164b;};'use strict';var _=require(_0xd7c5('0x0'));var util=require(_0xd7c5('0x1'));var logger=require(_0xd7c5('0x2'))(_0xd7c5('0x3'));var moment=require(_0xd7c5('0x4'));var BPromise=require(_0xd7c5('0x5'));var rp=require(_0xd7c5('0x6'));var fs=require('fs');var path=require(_0xd7c5('0x7'));var rimraf=require(_0xd7c5('0x8'));var config=require(_0xd7c5('0x9'));var attributes=require(_0xd7c5('0xa'));module['exports']=function(_0x3b3d47,_0x49858d){return _0x3b3d47[_0xd7c5('0xb')](_0xd7c5('0xc'),attributes,{'tableName':_0xd7c5('0xd'),'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 766dbe4..d6465e7 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 _0xd44f=['attributes','debug','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTemplate','Template','findAll','options','where','limit','include','map','model'];(function(_0x3517e7,_0x29993e){var _0x491443=function(_0x312a67){while(--_0x312a67){_0x3517e7['push'](_0x3517e7['shift']());}};_0x491443(++_0x29993e);}(_0xd44f,0x1c4));var _0xfd44=function(_0xb38a96,_0xfeb8f0){_0xb38a96=_0xb38a96-0x0;var _0x1a362a=_0xd44f[_0xb38a96];return _0x1a362a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfd44('0x0'));var BPromise=require('bluebird');var rs=require(_0xfd44('0x1'));var fs=require('fs');var Redis=require(_0xfd44('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd44('0x3'));var logger=require(_0xfd44('0x4'))(_0xfd44('0x5'));var config=require('../../config/environment');var jayson=require(_0xfd44('0x6'));var client=jayson[_0xfd44('0x7')][_0xfd44('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x438930,_0x191b12,_0x5f1192){return new BPromise(function(_0x372264,_0x47936b){return client['request'](_0x438930,_0x5f1192)[_0xfd44('0x9')](function(_0x45cdb8){logger[_0xfd44('0xa')](_0xfd44('0xb'),_0x191b12,_0xfd44('0xc'));logger['debug'](_0xfd44('0xd'),_0x191b12,_0xfd44('0xc'),JSON[_0xfd44('0xe')](_0x45cdb8));if(_0x45cdb8[_0xfd44('0xf')]){if(_0x45cdb8[_0xfd44('0xf')][_0xfd44('0x10')]===0x1f4){logger['error'](_0xfd44('0xb'),_0x191b12,_0x45cdb8[_0xfd44('0xf')][_0xfd44('0x11')]);return _0x47936b(_0x45cdb8[_0xfd44('0xf')][_0xfd44('0x11')]);}logger[_0xfd44('0xf')]('Template,\x20%s,\x20%s',_0x191b12,_0x45cdb8[_0xfd44('0xf')][_0xfd44('0x11')]);return _0x372264(_0x45cdb8['error'][_0xfd44('0x11')]);}else{logger['info'](_0xfd44('0xb'),_0x191b12,_0xfd44('0xc'));_0x372264(_0x45cdb8['result']['message']);}})[_0xfd44('0x12')](function(_0x3e8c4f){logger[_0xfd44('0xf')](_0xfd44('0xb'),_0x191b12,_0x3e8c4f);_0x47936b(_0x3e8c4f);});});}exports[_0xfd44('0x13')]=function(_0x4e17ac){var _0x5f4844=this;return new Promise(function(_0x209119,_0xb9c430){return db[_0xfd44('0x14')][_0xfd44('0x15')]({'raw':_0x4e17ac[_0xfd44('0x16')]?_0x4e17ac[_0xfd44('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4e17ac['options']?_0x4e17ac[_0xfd44('0x16')][_0xfd44('0x17')]||null:null,'attributes':_0x4e17ac[_0xfd44('0x16')]?_0x4e17ac[_0xfd44('0x16')]['attributes']||null:null,'limit':_0x4e17ac['options']?_0x4e17ac[_0xfd44('0x16')][_0xfd44('0x18')]||null:null,'include':_0x4e17ac[_0xfd44('0x16')]?_0x4e17ac[_0xfd44('0x16')][_0xfd44('0x19')]?_[_0xfd44('0x1a')](_0x4e17ac[_0xfd44('0x16')][_0xfd44('0x19')],function(_0x1fe3a8){return{'model':db[_0x1fe3a8[_0xfd44('0x1b')]],'as':_0x1fe3a8['as'],'attributes':_0x1fe3a8[_0xfd44('0x1c')],'include':_0x1fe3a8['include']?_[_0xfd44('0x1a')](_0x1fe3a8[_0xfd44('0x19')],function(_0x2fd8c7){return{'model':db[_0x2fd8c7[_0xfd44('0x1b')]],'as':_0x2fd8c7['as'],'attributes':_0x2fd8c7[_0xfd44('0x1c')],'include':_0x2fd8c7[_0xfd44('0x19')]?_[_0xfd44('0x1a')](_0x2fd8c7['include'],function(_0x5b2861){return{'model':db[_0x5b2861['model']],'as':_0x5b2861['as'],'attributes':_0x5b2861[_0xfd44('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x499029){logger[_0xfd44('0xa')](_0xfd44('0x13'),_0x4e17ac);logger[_0xfd44('0x1d')](_0xfd44('0x13'),_0x4e17ac,JSON[_0xfd44('0xe')](_0x499029));_0x209119(_0x499029);})[_0xfd44('0x12')](function(_0xac0e85){logger[_0xfd44('0xf')](_0xfd44('0x13'),_0xac0e85['message'],_0x4e17ac);_0xb9c430(_0x5f4844['error'](0x1f4,_0xac0e85[_0xfd44('0x11')]));});});}; \ No newline at end of file +var _0xebd0=['request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','findAll','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x3ddde9,_0x1a6a2b){var _0xdfb693=function(_0x1c1c20){while(--_0x1c1c20){_0x3ddde9['push'](_0x3ddde9['shift']());}};_0xdfb693(++_0x1a6a2b);}(_0xebd0,0x149));var _0x0ebd=function(_0x56aef4,_0x4eeaba){_0x56aef4=_0x56aef4-0x0;var _0x405f05=_0xebd0[_0x56aef4];return _0x405f05;};'use strict';var _=require(_0x0ebd('0x0'));var util=require(_0x0ebd('0x1'));var moment=require(_0x0ebd('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ebd('0x3'));var fs=require('fs');var Redis=require(_0x0ebd('0x4'));var db=require(_0x0ebd('0x5'))['db'];var utils=require(_0x0ebd('0x6'));var logger=require(_0x0ebd('0x7'))(_0x0ebd('0x8'));var config=require('../../config/environment');var jayson=require(_0x0ebd('0x9'));var client=jayson[_0x0ebd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20f3eb,_0x3037d1,_0xd91292){return new BPromise(function(_0x4a48d1,_0x4df660){return client[_0x0ebd('0xb')](_0x20f3eb,_0xd91292)[_0x0ebd('0xc')](function(_0x4e7a9b){logger[_0x0ebd('0xd')](_0x0ebd('0xe'),_0x3037d1,_0x0ebd('0xf'));logger[_0x0ebd('0x10')](_0x0ebd('0x11'),_0x3037d1,_0x0ebd('0xf'),JSON[_0x0ebd('0x12')](_0x4e7a9b));if(_0x4e7a9b[_0x0ebd('0x13')]){if(_0x4e7a9b[_0x0ebd('0x13')][_0x0ebd('0x14')]===0x1f4){logger[_0x0ebd('0x13')](_0x0ebd('0xe'),_0x3037d1,_0x4e7a9b[_0x0ebd('0x13')]['message']);return _0x4df660(_0x4e7a9b['error'][_0x0ebd('0x15')]);}logger[_0x0ebd('0x13')](_0x0ebd('0xe'),_0x3037d1,_0x4e7a9b[_0x0ebd('0x13')][_0x0ebd('0x15')]);return _0x4a48d1(_0x4e7a9b[_0x0ebd('0x13')][_0x0ebd('0x15')]);}else{logger[_0x0ebd('0xd')](_0x0ebd('0xe'),_0x3037d1,_0x0ebd('0xf'));_0x4a48d1(_0x4e7a9b[_0x0ebd('0x16')][_0x0ebd('0x15')]);}})[_0x0ebd('0x17')](function(_0x2f34f8){logger['error'](_0x0ebd('0xe'),_0x3037d1,_0x2f34f8);_0x4df660(_0x2f34f8);});});}exports[_0x0ebd('0x18')]=function(_0x420d43){var _0xe574ea=this;return new Promise(function(_0xf3c97d,_0x4ac278){return db['Template'][_0x0ebd('0x19')]({'raw':_0x420d43[_0x0ebd('0x1a')]?_0x420d43[_0x0ebd('0x1a')][_0x0ebd('0x1b')]===undefined?!![]:![]:!![],'where':_0x420d43[_0x0ebd('0x1a')]?_0x420d43[_0x0ebd('0x1a')][_0x0ebd('0x1c')]||null:null,'attributes':_0x420d43[_0x0ebd('0x1a')]?_0x420d43['options'][_0x0ebd('0x1d')]||null:null,'limit':_0x420d43[_0x0ebd('0x1a')]?_0x420d43['options'][_0x0ebd('0x1e')]||null:null,'include':_0x420d43['options']?_0x420d43[_0x0ebd('0x1a')][_0x0ebd('0x1f')]?_[_0x0ebd('0x20')](_0x420d43[_0x0ebd('0x1a')][_0x0ebd('0x1f')],function(_0xaf09c2){return{'model':db[_0xaf09c2[_0x0ebd('0x21')]],'as':_0xaf09c2['as'],'attributes':_0xaf09c2[_0x0ebd('0x1d')],'include':_0xaf09c2[_0x0ebd('0x1f')]?_[_0x0ebd('0x20')](_0xaf09c2[_0x0ebd('0x1f')],function(_0x5d1fc8){return{'model':db[_0x5d1fc8[_0x0ebd('0x21')]],'as':_0x5d1fc8['as'],'attributes':_0x5d1fc8['attributes'],'include':_0x5d1fc8[_0x0ebd('0x1f')]?_[_0x0ebd('0x20')](_0x5d1fc8[_0x0ebd('0x1f')],function(_0x29d68e){return{'model':db[_0x29d68e[_0x0ebd('0x21')]],'as':_0x29d68e['as'],'attributes':_0x29d68e['attributes']};}):[]};}):[]};}):[]:[]})[_0x0ebd('0xc')](function(_0x1a6ff1){logger[_0x0ebd('0xd')](_0x0ebd('0x18'),_0x420d43);logger[_0x0ebd('0x10')](_0x0ebd('0x18'),_0x420d43,JSON['stringify'](_0x1a6ff1));_0xf3c97d(_0x1a6ff1);})[_0x0ebd('0x17')](function(_0x50161c){logger[_0x0ebd('0x13')]('GetTemplate',_0x50161c[_0x0ebd('0x15')],_0x420d43);_0x4ac278(_0xe574ea['error'](0x1f4,_0x50161c['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 00d4593..8528e18 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 _0xaa76=['/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','addAction','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./trigger.controller','get','isAuthenticated','index','/:id','/:id/all_conditions','getAllConditions'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xaa76,0xbb));var _0x6aa7=function(_0x2fcb58,_0x9af4b3){_0x2fcb58=_0x2fcb58-0x0;var _0x2bda09=_0xaa76[_0x2fcb58];return _0x2bda09;};'use strict';var multer=require(_0x6aa7('0x0'));var util=require(_0x6aa7('0x1'));var path=require(_0x6aa7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6aa7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6aa7('0x4'));var interaction=require(_0x6aa7('0x5'));var config=require('../../config/environment');var controller=require(_0x6aa7('0x6'));router[_0x6aa7('0x7')]('/',auth[_0x6aa7('0x8')](),controller[_0x6aa7('0x9')]);router[_0x6aa7('0x7')](_0x6aa7('0xa'),auth[_0x6aa7('0x8')](),controller['show']);router['get'](_0x6aa7('0xb'),auth['isAuthenticated'](),controller[_0x6aa7('0xc')]);router['get'](_0x6aa7('0xd'),auth[_0x6aa7('0x8')](),controller[_0x6aa7('0xe')]);router[_0x6aa7('0x7')](_0x6aa7('0xf'),auth[_0x6aa7('0x8')](),controller[_0x6aa7('0x10')]);router[_0x6aa7('0x11')]('/',auth[_0x6aa7('0x8')](),controller[_0x6aa7('0x12')]);router['post']('/:id/all_conditions',auth[_0x6aa7('0x8')](),controller[_0x6aa7('0x13')]);router[_0x6aa7('0x11')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x6aa7('0x14')]);router[_0x6aa7('0x11')](_0x6aa7('0xf'),auth[_0x6aa7('0x8')](),controller[_0x6aa7('0x15')]);router['put'](_0x6aa7('0xa'),auth[_0x6aa7('0x8')](),controller[_0x6aa7('0x16')]);router['delete'](_0x6aa7('0xa'),auth['isAuthenticated'](),controller[_0x6aa7('0x17')]);module[_0x6aa7('0x18')]=router; \ No newline at end of file +var _0x4742=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trigger.controller','isAuthenticated','index','/:id','show','/:id/all_conditions','get','/:id/any_conditions','getAnyConditions','/:id/actions','post','addAllCondition','addAnyCondition','put','update','delete','exports'];(function(_0x31e5cb,_0x2f5adf){var _0x4170df=function(_0x31c53e){while(--_0x31c53e){_0x31e5cb['push'](_0x31e5cb['shift']());}};_0x4170df(++_0x2f5adf);}(_0x4742,0x64));var _0x2474=function(_0x1d8dbb,_0x38fb81){_0x1d8dbb=_0x1d8dbb-0x0;var _0x1d0f6f=_0x4742[_0x1d8dbb];return _0x1d0f6f;};'use strict';var multer=require(_0x2474('0x0'));var util=require(_0x2474('0x1'));var path=require('path');var timeout=require(_0x2474('0x2'));var express=require(_0x2474('0x3'));var router=express[_0x2474('0x4')]();var fs_extra=require(_0x2474('0x5'));var auth=require(_0x2474('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2474('0x7'));var controller=require(_0x2474('0x8'));router['get']('/',auth[_0x2474('0x9')](),controller[_0x2474('0xa')]);router['get'](_0x2474('0xb'),auth['isAuthenticated'](),controller[_0x2474('0xc')]);router['get'](_0x2474('0xd'),auth[_0x2474('0x9')](),controller['getAllConditions']);router[_0x2474('0xe')](_0x2474('0xf'),auth['isAuthenticated'](),controller[_0x2474('0x10')]);router[_0x2474('0xe')](_0x2474('0x11'),auth['isAuthenticated'](),controller['getActions']);router[_0x2474('0x12')]('/',auth[_0x2474('0x9')](),controller['create']);router[_0x2474('0x12')](_0x2474('0xd'),auth[_0x2474('0x9')](),controller[_0x2474('0x13')]);router[_0x2474('0x12')]('/:id/any_conditions',auth[_0x2474('0x9')](),controller[_0x2474('0x14')]);router[_0x2474('0x12')](_0x2474('0x11'),auth[_0x2474('0x9')](),controller['addAction']);router[_0x2474('0x15')](_0x2474('0xb'),auth[_0x2474('0x9')](),controller[_0x2474('0x16')]);router[_0x2474('0x17')]('/:id',auth[_0x2474('0x9')](),controller['destroy']);module[_0x2474('0x18')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 0e0461e..2495702 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 _0xb48c=['STRING','BOOLEAN','sequelize','exports'];(function(_0x52a659,_0x5e3c37){var _0xd10977=function(_0x5a2a8e){while(--_0x5a2a8e){_0x52a659['push'](_0x52a659['shift']());}};_0xd10977(++_0x5e3c37);}(_0xb48c,0x1aa));var _0xcb48=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb48c[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xcb48('0x0'));module[_0xcb48('0x1')]={'name':{'type':Sequelize[_0xcb48('0x2')]},'channel':{'type':Sequelize[_0xcb48('0x2')]},'description':{'type':Sequelize[_0xcb48('0x2')]},'status':{'type':Sequelize[_0xcb48('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xb3d2=['sequelize','exports','STRING','BOOLEAN'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xb3d2,0x140));var _0x2b3d=function(_0x29b382,_0x362495){_0x29b382=_0x29b382-0x0;var _0x160149=_0xb3d2[_0x29b382];return _0x160149;};'use strict';var Sequelize=require(_0x2b3d('0x0'));module[_0x2b3d('0x1')]={'name':{'type':Sequelize[_0x2b3d('0x2')]},'channel':{'type':Sequelize[_0x2b3d('0x2')]},'description':{'type':Sequelize[_0x2b3d('0x2')]},'status':{'type':Sequelize[_0x2b3d('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 9372b82..51e98ad 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 _0xb777=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','destroy','then','UserProfileResource','error','name','send','map','Trigger','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','userProfileId','autoAssociation','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','order','getAnyConditions','addAction','TriggerId','getActions','Action','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x210ba0,_0x48f352){var _0xacf2c9=function(_0x2897d0){while(--_0x2897d0){_0x210ba0['push'](_0x210ba0['shift']());}};_0xacf2c9(++_0x48f352);}(_0xb777,0x1dd));var _0x7b77=function(_0x3566de,_0x1bec4d){_0x3566de=_0x3566de-0x0;var _0x256439=_0xb777[_0x3566de];return _0x256439;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b77('0x0'));var zipdir=require(_0x7b77('0x1'));var jsonpatch=require(_0x7b77('0x2'));var rp=require(_0x7b77('0x3'));var moment=require(_0x7b77('0x4'));var BPromise=require(_0x7b77('0x5'));var Mustache=require('mustache');var util=require(_0x7b77('0x6'));var path=require(_0x7b77('0x7'));var sox=require(_0x7b77('0x8'));var csv=require(_0x7b77('0x9'));var ejs=require(_0x7b77('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b77('0xb'));var squel=require(_0x7b77('0xc'));var crypto=require(_0x7b77('0xd'));var jsforce=require(_0x7b77('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7b77('0x9'));var querystring=require(_0x7b77('0xf'));var Papa=require('papaparse');var Redis=require(_0x7b77('0x10'));var authService=require(_0x7b77('0x11'));var qs=require(_0x7b77('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b77('0x13'));var logger=require(_0x7b77('0x14'))(_0x7b77('0x15'));var utils=require(_0x7b77('0x16'));var config=require(_0x7b77('0x17'));var licenseUtil=require(_0x7b77('0x18'));var db=require(_0x7b77('0x19'))['db'];function respondWithStatusCode(_0x1940ef,_0x75a13){_0x75a13=_0x75a13||0xcc;return function(_0x406519){if(_0x406519){return _0x1940ef[_0x7b77('0x1a')](_0x75a13);}return _0x1940ef[_0x7b77('0x1b')](_0x75a13)[_0x7b77('0x1c')]();};}function respondWithResult(_0x463fab,_0x29d710){_0x29d710=_0x29d710||0xc8;return function(_0x1a95e1){if(_0x1a95e1){return _0x463fab[_0x7b77('0x1b')](_0x29d710)[_0x7b77('0x1d')](_0x1a95e1);}};}function respondWithFilteredResult(_0x535fd4,_0x390d17){return function(_0x574d8b){if(_0x574d8b){var _0x20a8a6=typeof _0x390d17[_0x7b77('0x1e')]===_0x7b77('0x1f')&&typeof _0x390d17['limit']===_0x7b77('0x1f');var _0x48e731=_0x574d8b[_0x7b77('0x20')];var _0x33bd1b=_0x20a8a6?0x0:_0x390d17[_0x7b77('0x1e')];var _0x2de743=_0x20a8a6?_0x574d8b[_0x7b77('0x20')]:_0x390d17[_0x7b77('0x1e')]+_0x390d17['limit'];var _0x4c88d4;if(_0x2de743>=_0x48e731){_0x2de743=_0x48e731;_0x4c88d4=0xc8;}else{_0x4c88d4=0xce;}_0x535fd4[_0x7b77('0x1b')](_0x4c88d4);return _0x535fd4[_0x7b77('0x21')](_0x7b77('0x22'),_0x33bd1b+'-'+_0x2de743+'/'+_0x48e731)['json'](_0x574d8b);}return null;};}function patchUpdates(_0x39fc9c){return function(_0x1e8b53){try{jsonpatch[_0x7b77('0x23')](_0x1e8b53,_0x39fc9c,!![]);}catch(_0x39ed05){return BPromise[_0x7b77('0x24')](_0x39ed05);}return _0x1e8b53[_0x7b77('0x25')]();};}function saveUpdates(_0x1eae20,_0x14da23){return function(_0x16acd9){if(_0x16acd9){return _0x16acd9['update'](_0x1eae20)['then'](function(_0x1e0989){return _0x1e0989;});}return null;};}function removeEntity(_0x2c2993,_0x1d1906){return function(_0x21f0f9){if(_0x21f0f9){return _0x21f0f9[_0x7b77('0x26')]()[_0x7b77('0x27')](function(){var _0x19c3af=_0x21f0f9['get']({'plain':!![]});var _0x3b5382='Triggers';return db[_0x7b77('0x28')]['destroy']({'where':{'type':_0x3b5382,'resourceId':_0x19c3af['id']}})[_0x7b77('0x27')](function(){return _0x21f0f9;});})[_0x7b77('0x27')](function(){_0x2c2993[_0x7b77('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54c6ae,_0x5832fc){return function(_0x521a18){if(!_0x521a18){_0x54c6ae['sendStatus'](0x194);}return _0x521a18;};}function handleError(_0x2e7a31,_0x16d9e1){_0x16d9e1=_0x16d9e1||0x1f4;return function(_0x2c9d06){logger[_0x7b77('0x29')](_0x2c9d06['stack']);if(_0x2c9d06[_0x7b77('0x2a')]){delete _0x2c9d06['name'];}_0x2e7a31[_0x7b77('0x1b')](_0x16d9e1)[_0x7b77('0x2b')](_0x2c9d06);};}exports['index']=function(_0x16836a,_0x172247){var _0x3df4ac={},_0x33d0ee={},_0x1ecc13={'count':0x0,'rows':[]};var _0x241303=_[_0x7b77('0x2c')](db[_0x7b77('0x2d')][_0x7b77('0x2e')],function(_0x12ecbf){return{'name':_0x12ecbf[_0x7b77('0x2f')],'type':_0x12ecbf[_0x7b77('0x30')]['key']};});_0x33d0ee[_0x7b77('0x31')]=_['map'](_0x241303,_0x7b77('0x2a'));_0x33d0ee[_0x7b77('0x32')]=_[_0x7b77('0x33')](_0x16836a[_0x7b77('0x32')]);_0x33d0ee[_0x7b77('0x34')]=_[_0x7b77('0x35')](_0x33d0ee['model'],_0x33d0ee[_0x7b77('0x32')]);_0x3df4ac[_0x7b77('0x36')]=_[_0x7b77('0x35')](_0x33d0ee['model'],qs[_0x7b77('0x37')](_0x16836a['query'][_0x7b77('0x37')]));_0x3df4ac[_0x7b77('0x36')]=_0x3df4ac[_0x7b77('0x36')][_0x7b77('0x38')]?_0x3df4ac[_0x7b77('0x36')]:_0x33d0ee['model'];if(!_0x16836a[_0x7b77('0x32')][_0x7b77('0x39')](_0x7b77('0x3a'))){_0x3df4ac['limit']=qs[_0x7b77('0x3b')](_0x16836a['query'][_0x7b77('0x3b')]);_0x3df4ac[_0x7b77('0x1e')]=qs[_0x7b77('0x1e')](_0x16836a['query'][_0x7b77('0x1e')]);}_0x3df4ac['order']=qs[_0x7b77('0x3c')](_0x16836a[_0x7b77('0x32')][_0x7b77('0x3c')]);_0x3df4ac[_0x7b77('0x3d')]=qs['filters'](_[_0x7b77('0x3e')](_0x16836a[_0x7b77('0x32')],_0x33d0ee['filters']),_0x241303);if(_0x16836a[_0x7b77('0x32')][_0x7b77('0x3f')]){_0x3df4ac['where']=_[_0x7b77('0x40')](_0x3df4ac[_0x7b77('0x3d')],{'$or':_['map'](_0x241303,function(_0x7f08ce){if(_0x7f08ce['type']!==_0x7b77('0x41')){var _0x292d72={};_0x292d72[_0x7f08ce[_0x7b77('0x2a')]]={'$like':'%'+_0x16836a[_0x7b77('0x32')][_0x7b77('0x3f')]+'%'};return _0x292d72;}})});}_0x3df4ac=_[_0x7b77('0x40')]({},_0x3df4ac,_0x16836a['options']);var _0x493e73={'where':_0x3df4ac['where']};return db[_0x7b77('0x2d')]['count'](_0x493e73)[_0x7b77('0x27')](function(_0x52a77b){_0x1ecc13[_0x7b77('0x20')]=_0x52a77b;if(_0x16836a['query'][_0x7b77('0x42')]){_0x3df4ac[_0x7b77('0x43')]=[{'all':!![]}];}return db[_0x7b77('0x2d')][_0x7b77('0x44')](_0x3df4ac);})[_0x7b77('0x27')](function(_0x35c39b){_0x1ecc13[_0x7b77('0x45')]=_0x35c39b;return _0x1ecc13;})[_0x7b77('0x27')](respondWithFilteredResult(_0x172247,_0x3df4ac))['catch'](handleError(_0x172247,null));};exports['show']=function(_0x49471b,_0x967174){var _0x16ab9a={'raw':![],'where':{'id':_0x49471b[_0x7b77('0x46')]['id']}},_0x21208d={};_0x21208d[_0x7b77('0x31')]=_[_0x7b77('0x33')](db[_0x7b77('0x2d')]['rawAttributes']);_0x21208d['query']=_['keys'](_0x49471b[_0x7b77('0x32')]);_0x21208d['filters']=_[_0x7b77('0x35')](_0x21208d[_0x7b77('0x31')],_0x21208d[_0x7b77('0x32')]);_0x16ab9a[_0x7b77('0x36')]=_[_0x7b77('0x35')](_0x21208d[_0x7b77('0x31')],qs[_0x7b77('0x37')](_0x49471b[_0x7b77('0x32')][_0x7b77('0x37')]));_0x16ab9a[_0x7b77('0x36')]=_0x16ab9a[_0x7b77('0x36')]['length']?_0x16ab9a[_0x7b77('0x36')]:_0x21208d[_0x7b77('0x31')];if(_0x49471b[_0x7b77('0x32')]['includeAll']){_0x16ab9a[_0x7b77('0x43')]=[{'all':!![]}];}_0x16ab9a=_[_0x7b77('0x40')]({},_0x16ab9a,_0x49471b[_0x7b77('0x47')]);return db[_0x7b77('0x2d')][_0x7b77('0x48')](_0x16ab9a)['then'](handleEntityNotFound(_0x967174,null))[_0x7b77('0x27')](respondWithResult(_0x967174,null))['catch'](handleError(_0x967174,null));};exports['create']=function(_0x2a93e8,_0x1e5bdd){return db['Trigger']['create'](_0x2a93e8[_0x7b77('0x49')],{})[_0x7b77('0x27')](function(_0x2d9c9c){var _0x4ddf65=_0x2a93e8[_0x7b77('0x4a')][_0x7b77('0x4b')]({'plain':!![]});if(!_0x4ddf65)throw new Error(_0x7b77('0x4c'));if(_0x4ddf65[_0x7b77('0x4d')]===_0x7b77('0x4a')){var _0x58d566=_0x2d9c9c[_0x7b77('0x4b')]({'plain':!![]});var _0x12a556=_0x7b77('0x4e');return db['UserProfileSection'][_0x7b77('0x48')]({'where':{'name':_0x12a556,'userProfileId':_0x4ddf65[_0x7b77('0x4f')]},'raw':!![]})['then'](function(_0x5101ae){if(_0x5101ae&&_0x5101ae[_0x7b77('0x50')]===0x0){return db[_0x7b77('0x28')][_0x7b77('0x51')]({'name':_0x58d566[_0x7b77('0x2a')],'resourceId':_0x58d566['id'],'type':_0x5101ae[_0x7b77('0x2a')],'sectionId':_0x5101ae['id']},{})[_0x7b77('0x27')](function(){return _0x2d9c9c;});}else{return _0x2d9c9c;}})[_0x7b77('0x52')](function(_0x544c62){logger[_0x7b77('0x29')](_0x7b77('0x53'),_0x544c62);throw _0x544c62;});}return _0x2d9c9c;})['then'](respondWithResult(_0x1e5bdd,0xc9))['catch'](handleError(_0x1e5bdd,null));};exports[_0x7b77('0x54')]=function(_0xc64f27,_0xdb4eb){if(_0xc64f27[_0x7b77('0x49')]['id']){delete _0xc64f27[_0x7b77('0x49')]['id'];}return db[_0x7b77('0x2d')][_0x7b77('0x48')]({'where':{'id':_0xc64f27[_0x7b77('0x46')]['id']}})['then'](handleEntityNotFound(_0xdb4eb,null))[_0x7b77('0x27')](saveUpdates(_0xc64f27[_0x7b77('0x49')],null))[_0x7b77('0x27')](respondWithResult(_0xdb4eb,null))[_0x7b77('0x52')](handleError(_0xdb4eb,null));};exports[_0x7b77('0x26')]=function(_0xddf0ce,_0x551281){return db[_0x7b77('0x2d')][_0x7b77('0x48')]({'where':{'id':_0xddf0ce[_0x7b77('0x46')]['id']}})[_0x7b77('0x27')](handleEntityNotFound(_0x551281,null))[_0x7b77('0x27')](removeEntity(_0x551281,null))[_0x7b77('0x52')](handleError(_0x551281,null));};exports['addAllCondition']=function(_0x29e1dd,_0x440c70,_0x3b893f){if(_0x29e1dd['body']['id']){delete _0x29e1dd[_0x7b77('0x49')]['id'];}return db[_0x7b77('0x2d')][_0x7b77('0x48')]({'where':{'id':_0x29e1dd['params']['id']}})[_0x7b77('0x27')](handleEntityNotFound(_0x440c70,null))[_0x7b77('0x27')](function(_0x10f123){if(_0x10f123){_0x29e1dd[_0x7b77('0x49')][_0x7b77('0x55')]=_0x10f123['id'];return db[_0x7b77('0x56')][_0x7b77('0x51')](_0x29e1dd['body']);}})[_0x7b77('0x27')](respondWithResult(_0x440c70,null))['catch'](handleError(_0x440c70,null));};exports[_0x7b77('0x57')]=function(_0x20f8f7,_0x573e33,_0x5887e9){if(_0x20f8f7[_0x7b77('0x49')]['id']){delete _0x20f8f7[_0x7b77('0x49')]['id'];}return db[_0x7b77('0x2d')][_0x7b77('0x48')]({'where':{'id':_0x20f8f7[_0x7b77('0x46')]['id']}})[_0x7b77('0x27')](handleEntityNotFound(_0x573e33,null))[_0x7b77('0x27')](function(_0x49bcaa){if(_0x49bcaa){_0x20f8f7[_0x7b77('0x49')][_0x7b77('0x58')]=_0x49bcaa['id'];return db['Condition']['create'](_0x20f8f7[_0x7b77('0x49')]);}})[_0x7b77('0x27')](respondWithResult(_0x573e33,null))[_0x7b77('0x52')](handleError(_0x573e33,null));};exports[_0x7b77('0x59')]=function(_0x184e6d,_0xb187fe,_0x4be855){var _0x11efc9={};var _0x8a938={};var _0x1127be;var _0x75a117;return db[_0x7b77('0x2d')][_0x7b77('0x5a')]({'where':{'id':_0x184e6d[_0x7b77('0x46')]['id']}})[_0x7b77('0x27')](handleEntityNotFound(_0xb187fe,null))[_0x7b77('0x27')](function(_0x4ebfc1){if(_0x4ebfc1){_0x1127be=_0x4ebfc1;_0x8a938['model']=_[_0x7b77('0x33')](db[_0x7b77('0x56')][_0x7b77('0x2e')]);_0x8a938[_0x7b77('0x32')]=_['keys'](_0x184e6d[_0x7b77('0x32')]);_0x8a938[_0x7b77('0x34')]=_[_0x7b77('0x35')](_0x8a938[_0x7b77('0x31')],_0x8a938[_0x7b77('0x32')]);_0x11efc9[_0x7b77('0x36')]=_['intersection'](_0x8a938[_0x7b77('0x31')],qs[_0x7b77('0x37')](_0x184e6d[_0x7b77('0x32')][_0x7b77('0x37')]));_0x11efc9['attributes']=_0x11efc9['attributes'][_0x7b77('0x38')]?_0x11efc9['attributes']:_0x8a938[_0x7b77('0x31')];_0x11efc9[_0x7b77('0x5b')]=qs[_0x7b77('0x3c')](_0x184e6d['query'][_0x7b77('0x3c')]);_0x11efc9[_0x7b77('0x3d')]=qs[_0x7b77('0x34')](_[_0x7b77('0x3e')](_0x184e6d['query'],_0x8a938[_0x7b77('0x34')]));if(_0x184e6d['query'][_0x7b77('0x3f')]){_0x11efc9[_0x7b77('0x3d')]=_['merge'](_0x11efc9[_0x7b77('0x3d')],{'$or':_[_0x7b77('0x2c')](_0x11efc9['attributes'],function(_0x118aea){var _0x206650={};_0x206650[_0x118aea]={'$like':'%'+_0x184e6d[_0x7b77('0x32')][_0x7b77('0x3f')]+'%'};return _0x206650;})});}_0x11efc9=_['merge']({},_0x11efc9,_0x184e6d[_0x7b77('0x47')]);return _0x1127be[_0x7b77('0x59')](_0x11efc9);}})[_0x7b77('0x27')](function(_0x79c234){if(_0x79c234){_0x75a117=_0x79c234[_0x7b77('0x38')];if(!_0x184e6d['query'][_0x7b77('0x39')](_0x7b77('0x3a'))){_0x11efc9[_0x7b77('0x3b')]=qs[_0x7b77('0x3b')](_0x184e6d[_0x7b77('0x32')][_0x7b77('0x3b')]);_0x11efc9[_0x7b77('0x1e')]=qs['offset'](_0x184e6d[_0x7b77('0x32')]['offset']);}return _0x1127be[_0x7b77('0x59')](_0x11efc9);}})[_0x7b77('0x27')](function(_0x759066){if(_0x759066){return _0x759066?{'count':_0x75a117,'rows':_0x759066}:null;}})['then'](respondWithResult(_0xb187fe,null))[_0x7b77('0x52')](handleError(_0xb187fe,null));};exports[_0x7b77('0x5c')]=function(_0x4719ac,_0x50b004,_0x592042){var _0x2b8dee={};var _0x2f00dd={};var _0x13fd72;var _0x11c657;return db[_0x7b77('0x2d')][_0x7b77('0x5a')]({'where':{'id':_0x4719ac[_0x7b77('0x46')]['id']}})['then'](handleEntityNotFound(_0x50b004,null))[_0x7b77('0x27')](function(_0x4a9b01){if(_0x4a9b01){_0x13fd72=_0x4a9b01;_0x2f00dd['model']=_[_0x7b77('0x33')](db[_0x7b77('0x56')][_0x7b77('0x2e')]);_0x2f00dd[_0x7b77('0x32')]=_['keys'](_0x4719ac['query']);_0x2f00dd['filters']=_[_0x7b77('0x35')](_0x2f00dd['model'],_0x2f00dd[_0x7b77('0x32')]);_0x2b8dee[_0x7b77('0x36')]=_[_0x7b77('0x35')](_0x2f00dd[_0x7b77('0x31')],qs['fields'](_0x4719ac['query']['fields']));_0x2b8dee[_0x7b77('0x36')]=_0x2b8dee[_0x7b77('0x36')]['length']?_0x2b8dee[_0x7b77('0x36')]:_0x2f00dd[_0x7b77('0x31')];_0x2b8dee['order']=qs['sort'](_0x4719ac['query'][_0x7b77('0x3c')]);_0x2b8dee[_0x7b77('0x3d')]=qs[_0x7b77('0x34')](_[_0x7b77('0x3e')](_0x4719ac[_0x7b77('0x32')],_0x2f00dd[_0x7b77('0x34')]));if(_0x4719ac['query'][_0x7b77('0x3f')]){_0x2b8dee[_0x7b77('0x3d')]=_['merge'](_0x2b8dee[_0x7b77('0x3d')],{'$or':_[_0x7b77('0x2c')](_0x2b8dee[_0x7b77('0x36')],function(_0x47742e){var _0xa41cb8={};_0xa41cb8[_0x47742e]={'$like':'%'+_0x4719ac[_0x7b77('0x32')][_0x7b77('0x3f')]+'%'};return _0xa41cb8;})});}_0x2b8dee=_[_0x7b77('0x40')]({},_0x2b8dee,_0x4719ac[_0x7b77('0x47')]);return _0x13fd72[_0x7b77('0x5c')](_0x2b8dee);}})['then'](function(_0x37eb67){if(_0x37eb67){_0x11c657=_0x37eb67[_0x7b77('0x38')];if(!_0x4719ac[_0x7b77('0x32')][_0x7b77('0x39')](_0x7b77('0x3a'))){_0x2b8dee['limit']=qs[_0x7b77('0x3b')](_0x4719ac[_0x7b77('0x32')][_0x7b77('0x3b')]);_0x2b8dee[_0x7b77('0x1e')]=qs[_0x7b77('0x1e')](_0x4719ac[_0x7b77('0x32')][_0x7b77('0x1e')]);}return _0x13fd72[_0x7b77('0x5c')](_0x2b8dee);}})[_0x7b77('0x27')](function(_0x1184f8){if(_0x1184f8){return _0x1184f8?{'count':_0x11c657,'rows':_0x1184f8}:null;}})[_0x7b77('0x27')](respondWithResult(_0x50b004,null))['catch'](handleError(_0x50b004,null));};exports[_0x7b77('0x5d')]=function(_0x47ee2b,_0x27d25c,_0x41e12f){if(_0x47ee2b[_0x7b77('0x49')]['id']){delete _0x47ee2b['body']['id'];}return db[_0x7b77('0x2d')][_0x7b77('0x48')]({'where':{'id':_0x47ee2b[_0x7b77('0x46')]['id']}})[_0x7b77('0x27')](handleEntityNotFound(_0x27d25c,null))[_0x7b77('0x27')](function(_0x474c76){if(_0x474c76){_0x47ee2b['body'][_0x7b77('0x5e')]=_0x474c76['id'];return db['Action'][_0x7b77('0x51')](_0x47ee2b[_0x7b77('0x49')]);}})['then'](respondWithResult(_0x27d25c,null))[_0x7b77('0x52')](handleError(_0x27d25c,null));};exports[_0x7b77('0x5f')]=function(_0xf1ef6f,_0x5e96df,_0x3001ab){var _0x41a34c={};var _0x3f6c7a={};var _0x535bb7;var _0x301bb4;return db['Trigger'][_0x7b77('0x5a')]({'where':{'id':_0xf1ef6f[_0x7b77('0x46')]['id']}})['then'](handleEntityNotFound(_0x5e96df,null))['then'](function(_0x386c00){if(_0x386c00){_0x535bb7=_0x386c00;_0x3f6c7a[_0x7b77('0x31')]=_[_0x7b77('0x33')](db[_0x7b77('0x60')][_0x7b77('0x2e')]);_0x3f6c7a[_0x7b77('0x32')]=_[_0x7b77('0x33')](_0xf1ef6f[_0x7b77('0x32')]);_0x3f6c7a[_0x7b77('0x34')]=_['intersection'](_0x3f6c7a['model'],_0x3f6c7a[_0x7b77('0x32')]);_0x41a34c[_0x7b77('0x36')]=_[_0x7b77('0x35')](_0x3f6c7a[_0x7b77('0x31')],qs[_0x7b77('0x37')](_0xf1ef6f[_0x7b77('0x32')]['fields']));_0x41a34c['attributes']=_0x41a34c['attributes']['length']?_0x41a34c[_0x7b77('0x36')]:_0x3f6c7a[_0x7b77('0x31')];_0x41a34c[_0x7b77('0x5b')]=qs[_0x7b77('0x3c')](_0xf1ef6f[_0x7b77('0x32')][_0x7b77('0x3c')]);_0x41a34c[_0x7b77('0x3d')]=qs[_0x7b77('0x34')](_['pick'](_0xf1ef6f[_0x7b77('0x32')],_0x3f6c7a[_0x7b77('0x34')]));if(_0xf1ef6f[_0x7b77('0x32')][_0x7b77('0x3f')]){_0x41a34c['where']=_[_0x7b77('0x40')](_0x41a34c[_0x7b77('0x3d')],{'$or':_[_0x7b77('0x2c')](_0x41a34c['attributes'],function(_0x8af1cc){var _0x2f4a00={};_0x2f4a00[_0x8af1cc]={'$like':'%'+_0xf1ef6f[_0x7b77('0x32')]['filter']+'%'};return _0x2f4a00;})});}_0x41a34c=_[_0x7b77('0x40')]({},_0x41a34c,_0xf1ef6f[_0x7b77('0x47')]);return _0x535bb7['getActions'](_0x41a34c);}})[_0x7b77('0x27')](function(_0x4171b5){if(_0x4171b5){_0x301bb4=_0x4171b5[_0x7b77('0x38')];if(!_0xf1ef6f[_0x7b77('0x32')][_0x7b77('0x39')](_0x7b77('0x3a'))){_0x41a34c[_0x7b77('0x3b')]=qs[_0x7b77('0x3b')](_0xf1ef6f['query']['limit']);_0x41a34c[_0x7b77('0x1e')]=qs['offset'](_0xf1ef6f['query']['offset']);}return _0x535bb7[_0x7b77('0x5f')](_0x41a34c);}})['then'](function(_0x39044b){if(_0x39044b){return _0x39044b?{'count':_0x301bb4,'rows':_0x39044b}:null;}})[_0x7b77('0x27')](respondWithResult(_0x5e96df,null))[_0x7b77('0x52')](handleError(_0x5e96df,null));}; \ No newline at end of file +var _0xb69a=['to-csv','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','count','Content-Range','reject','update','then','destroy','get','Triggers','UserProfileResource','sendStatus','error','name','send','Trigger','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Condition','addAnyCondition','TriggerAnyId','getAllConditions','filter','getAnyConditions','addAction','TriggerId','findOne','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox'];(function(_0x4fe14d,_0x40b1ac){var _0x54abe3=function(_0x21da5b){while(--_0x21da5b){_0x4fe14d['push'](_0x4fe14d['shift']());}};_0x54abe3(++_0x40b1ac);}(_0xb69a,0xfb));var _0xab69=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xb69a[_0x1a36a5];return _0x746243;};'use strict';var emlformat=require(_0xab69('0x0'));var rimraf=require(_0xab69('0x1'));var zipdir=require(_0xab69('0x2'));var jsonpatch=require(_0xab69('0x3'));var rp=require(_0xab69('0x4'));var moment=require(_0xab69('0x5'));var BPromise=require(_0xab69('0x6'));var Mustache=require(_0xab69('0x7'));var util=require('util');var path=require(_0xab69('0x8'));var sox=require(_0xab69('0x9'));var csv=require(_0xab69('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xab69('0xb'));var _=require('lodash');var squel=require(_0xab69('0xc'));var crypto=require(_0xab69('0xd'));var jsforce=require(_0xab69('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xab69('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xab69('0xf'));var authService=require(_0xab69('0x10'));var qs=require(_0xab69('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xab69('0x12'))(_0xab69('0x13'));var utils=require(_0xab69('0x14'));var config=require(_0xab69('0x15'));var licenseUtil=require(_0xab69('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x78939e,_0x2f1265){_0x2f1265=_0x2f1265||0xcc;return function(_0xe45e4){if(_0xe45e4){return _0x78939e['sendStatus'](_0x2f1265);}return _0x78939e[_0xab69('0x17')](_0x2f1265)[_0xab69('0x18')]();};}function respondWithResult(_0x35d830,_0x2ddb05){_0x2ddb05=_0x2ddb05||0xc8;return function(_0x166a15){if(_0x166a15){return _0x35d830[_0xab69('0x17')](_0x2ddb05)[_0xab69('0x19')](_0x166a15);}};}function respondWithFilteredResult(_0x15a4ba,_0xca263a){return function(_0x5874ad){if(_0x5874ad){var _0x57b5a5=typeof _0xca263a[_0xab69('0x1a')]==='undefined'&&typeof _0xca263a[_0xab69('0x1b')]==='undefined';var _0x55bef0=_0x5874ad['count'];var _0x58fc34=_0x57b5a5?0x0:_0xca263a[_0xab69('0x1a')];var _0x346325=_0x57b5a5?_0x5874ad[_0xab69('0x1c')]:_0xca263a['offset']+_0xca263a[_0xab69('0x1b')];var _0x52ab36;if(_0x346325>=_0x55bef0){_0x346325=_0x55bef0;_0x52ab36=0xc8;}else{_0x52ab36=0xce;}_0x15a4ba[_0xab69('0x17')](_0x52ab36);return _0x15a4ba['set'](_0xab69('0x1d'),_0x58fc34+'-'+_0x346325+'/'+_0x55bef0)[_0xab69('0x19')](_0x5874ad);}return null;};}function patchUpdates(_0x5d7c87){return function(_0x5e3cbb){try{jsonpatch['apply'](_0x5e3cbb,_0x5d7c87,!![]);}catch(_0x5cc22b){return BPromise[_0xab69('0x1e')](_0x5cc22b);}return _0x5e3cbb['save']();};}function saveUpdates(_0x1e478f,_0x292e36){return function(_0x3b7099){if(_0x3b7099){return _0x3b7099[_0xab69('0x1f')](_0x1e478f)[_0xab69('0x20')](function(_0x1fc0c2){return _0x1fc0c2;});}return null;};}function removeEntity(_0x27d439,_0x556651){return function(_0x1281f3){if(_0x1281f3){return _0x1281f3[_0xab69('0x21')]()[_0xab69('0x20')](function(){var _0xd029f7=_0x1281f3[_0xab69('0x22')]({'plain':!![]});var _0x2a867e=_0xab69('0x23');return db[_0xab69('0x24')][_0xab69('0x21')]({'where':{'type':_0x2a867e,'resourceId':_0xd029f7['id']}})['then'](function(){return _0x1281f3;});})[_0xab69('0x20')](function(){_0x27d439[_0xab69('0x17')](0xcc)[_0xab69('0x18')]();});}};}function handleEntityNotFound(_0x1ea074,_0x198eab){return function(_0x266a7f){if(!_0x266a7f){_0x1ea074[_0xab69('0x25')](0x194);}return _0x266a7f;};}function handleError(_0x70348f,_0x455d9b){_0x455d9b=_0x455d9b||0x1f4;return function(_0x5b5a00){logger[_0xab69('0x26')](_0x5b5a00['stack']);if(_0x5b5a00[_0xab69('0x27')]){delete _0x5b5a00[_0xab69('0x27')];}_0x70348f[_0xab69('0x17')](_0x455d9b)[_0xab69('0x28')](_0x5b5a00);};}exports['index']=function(_0x5e7fa3,_0x236abd){var _0x470edf={},_0x4801a5={},_0x13b87f={'count':0x0,'rows':[]};var _0x10fa17=_['map'](db[_0xab69('0x29')][_0xab69('0x2a')],function(_0x3de5df){return{'name':_0x3de5df[_0xab69('0x2b')],'type':_0x3de5df['type'][_0xab69('0x2c')]};});_0x4801a5[_0xab69('0x2d')]=_[_0xab69('0x2e')](_0x10fa17,_0xab69('0x27'));_0x4801a5[_0xab69('0x2f')]=_[_0xab69('0x30')](_0x5e7fa3[_0xab69('0x2f')]);_0x4801a5[_0xab69('0x31')]=_[_0xab69('0x32')](_0x4801a5[_0xab69('0x2d')],_0x4801a5[_0xab69('0x2f')]);_0x470edf['attributes']=_[_0xab69('0x32')](_0x4801a5[_0xab69('0x2d')],qs[_0xab69('0x33')](_0x5e7fa3['query'][_0xab69('0x33')]));_0x470edf[_0xab69('0x34')]=_0x470edf['attributes'][_0xab69('0x35')]?_0x470edf[_0xab69('0x34')]:_0x4801a5[_0xab69('0x2d')];if(!_0x5e7fa3[_0xab69('0x2f')][_0xab69('0x36')](_0xab69('0x37'))){_0x470edf['limit']=qs['limit'](_0x5e7fa3[_0xab69('0x2f')][_0xab69('0x1b')]);_0x470edf[_0xab69('0x1a')]=qs[_0xab69('0x1a')](_0x5e7fa3[_0xab69('0x2f')][_0xab69('0x1a')]);}_0x470edf[_0xab69('0x38')]=qs[_0xab69('0x39')](_0x5e7fa3[_0xab69('0x2f')][_0xab69('0x39')]);_0x470edf[_0xab69('0x3a')]=qs['filters'](_[_0xab69('0x3b')](_0x5e7fa3[_0xab69('0x2f')],_0x4801a5['filters']),_0x10fa17);if(_0x5e7fa3[_0xab69('0x2f')]['filter']){_0x470edf['where']=_[_0xab69('0x3c')](_0x470edf[_0xab69('0x3a')],{'$or':_['map'](_0x10fa17,function(_0x2cbb06){if(_0x2cbb06['type']!==_0xab69('0x3d')){var _0x307fe2={};_0x307fe2[_0x2cbb06[_0xab69('0x27')]]={'$like':'%'+_0x5e7fa3['query']['filter']+'%'};return _0x307fe2;}})});}_0x470edf=_[_0xab69('0x3c')]({},_0x470edf,_0x5e7fa3[_0xab69('0x3e')]);var _0x1831db={'where':_0x470edf[_0xab69('0x3a')]};return db['Trigger']['count'](_0x1831db)[_0xab69('0x20')](function(_0x36852b){_0x13b87f[_0xab69('0x1c')]=_0x36852b;if(_0x5e7fa3['query'][_0xab69('0x3f')]){_0x470edf[_0xab69('0x40')]=[{'all':!![]}];}return db[_0xab69('0x29')]['findAll'](_0x470edf);})['then'](function(_0x5cf197){_0x13b87f['rows']=_0x5cf197;return _0x13b87f;})['then'](respondWithFilteredResult(_0x236abd,_0x470edf))[_0xab69('0x41')](handleError(_0x236abd,null));};exports['show']=function(_0xc449,_0x50d9c2){var _0x52382f={'raw':![],'where':{'id':_0xc449[_0xab69('0x42')]['id']}},_0x5421b8={};_0x5421b8[_0xab69('0x2d')]=_[_0xab69('0x30')](db[_0xab69('0x29')][_0xab69('0x2a')]);_0x5421b8[_0xab69('0x2f')]=_[_0xab69('0x30')](_0xc449[_0xab69('0x2f')]);_0x5421b8[_0xab69('0x31')]=_['intersection'](_0x5421b8['model'],_0x5421b8[_0xab69('0x2f')]);_0x52382f[_0xab69('0x34')]=_[_0xab69('0x32')](_0x5421b8[_0xab69('0x2d')],qs['fields'](_0xc449[_0xab69('0x2f')][_0xab69('0x33')]));_0x52382f['attributes']=_0x52382f[_0xab69('0x34')][_0xab69('0x35')]?_0x52382f[_0xab69('0x34')]:_0x5421b8[_0xab69('0x2d')];if(_0xc449[_0xab69('0x2f')]['includeAll']){_0x52382f[_0xab69('0x40')]=[{'all':!![]}];}_0x52382f=_['merge']({},_0x52382f,_0xc449[_0xab69('0x3e')]);return db[_0xab69('0x29')][_0xab69('0x43')](_0x52382f)[_0xab69('0x20')](handleEntityNotFound(_0x50d9c2,null))[_0xab69('0x20')](respondWithResult(_0x50d9c2,null))['catch'](handleError(_0x50d9c2,null));};exports[_0xab69('0x44')]=function(_0x47c5d4,_0x4e364b){return db[_0xab69('0x29')]['create'](_0x47c5d4[_0xab69('0x45')],{})['then'](function(_0x4cd291){var _0x5563f8=_0x47c5d4[_0xab69('0x46')][_0xab69('0x22')]({'plain':!![]});if(!_0x5563f8)throw new Error(_0xab69('0x47'));if(_0x5563f8[_0xab69('0x48')]==='user'){var _0x251c2f=_0x4cd291[_0xab69('0x22')]({'plain':!![]});var _0x2905e5='Triggers';return db[_0xab69('0x49')][_0xab69('0x43')]({'where':{'name':_0x2905e5,'userProfileId':_0x5563f8[_0xab69('0x4a')]},'raw':!![]})[_0xab69('0x20')](function(_0x34bd75){if(_0x34bd75&&_0x34bd75['autoAssociation']===0x0){return db['UserProfileResource'][_0xab69('0x44')]({'name':_0x251c2f[_0xab69('0x27')],'resourceId':_0x251c2f['id'],'type':_0x34bd75[_0xab69('0x27')],'sectionId':_0x34bd75['id']},{})['then'](function(){return _0x4cd291;});}else{return _0x4cd291;}})[_0xab69('0x41')](function(_0x5e5a8c){logger['error'](_0xab69('0x4b'),_0x5e5a8c);throw _0x5e5a8c;});}return _0x4cd291;})[_0xab69('0x20')](respondWithResult(_0x4e364b,0xc9))[_0xab69('0x41')](handleError(_0x4e364b,null));};exports['update']=function(_0x477b7c,_0x2c871f){if(_0x477b7c[_0xab69('0x45')]['id']){delete _0x477b7c[_0xab69('0x45')]['id'];}return db[_0xab69('0x29')][_0xab69('0x43')]({'where':{'id':_0x477b7c[_0xab69('0x42')]['id']}})[_0xab69('0x20')](handleEntityNotFound(_0x2c871f,null))[_0xab69('0x20')](saveUpdates(_0x477b7c[_0xab69('0x45')],null))[_0xab69('0x20')](respondWithResult(_0x2c871f,null))['catch'](handleError(_0x2c871f,null));};exports[_0xab69('0x21')]=function(_0x6236a4,_0x4c41b5){return db['Trigger'][_0xab69('0x43')]({'where':{'id':_0x6236a4[_0xab69('0x42')]['id']}})[_0xab69('0x20')](handleEntityNotFound(_0x4c41b5,null))[_0xab69('0x20')](removeEntity(_0x4c41b5,null))[_0xab69('0x41')](handleError(_0x4c41b5,null));};exports['addAllCondition']=function(_0x407e71,_0x25b733,_0x200c01){if(_0x407e71[_0xab69('0x45')]['id']){delete _0x407e71[_0xab69('0x45')]['id'];}return db[_0xab69('0x29')][_0xab69('0x43')]({'where':{'id':_0x407e71[_0xab69('0x42')]['id']}})[_0xab69('0x20')](handleEntityNotFound(_0x25b733,null))['then'](function(_0x34c31c){if(_0x34c31c){_0x407e71[_0xab69('0x45')]['TriggerAllId']=_0x34c31c['id'];return db[_0xab69('0x4c')]['create'](_0x407e71[_0xab69('0x45')]);}})[_0xab69('0x20')](respondWithResult(_0x25b733,null))[_0xab69('0x41')](handleError(_0x25b733,null));};exports[_0xab69('0x4d')]=function(_0x30ba1c,_0x3f5c7a,_0x565ae8){if(_0x30ba1c[_0xab69('0x45')]['id']){delete _0x30ba1c[_0xab69('0x45')]['id'];}return db[_0xab69('0x29')][_0xab69('0x43')]({'where':{'id':_0x30ba1c[_0xab69('0x42')]['id']}})['then'](handleEntityNotFound(_0x3f5c7a,null))[_0xab69('0x20')](function(_0x4a5e44){if(_0x4a5e44){_0x30ba1c[_0xab69('0x45')][_0xab69('0x4e')]=_0x4a5e44['id'];return db[_0xab69('0x4c')]['create'](_0x30ba1c[_0xab69('0x45')]);}})['then'](respondWithResult(_0x3f5c7a,null))[_0xab69('0x41')](handleError(_0x3f5c7a,null));};exports[_0xab69('0x4f')]=function(_0x42ff0f,_0x42e3f6,_0x24c98b){var _0x2c2a12={};var _0x529b43={};var _0x3ce414;var _0x239445;return db[_0xab69('0x29')]['findOne']({'where':{'id':_0x42ff0f['params']['id']}})[_0xab69('0x20')](handleEntityNotFound(_0x42e3f6,null))[_0xab69('0x20')](function(_0x49d4c0){if(_0x49d4c0){_0x3ce414=_0x49d4c0;_0x529b43[_0xab69('0x2d')]=_[_0xab69('0x30')](db[_0xab69('0x4c')]['rawAttributes']);_0x529b43[_0xab69('0x2f')]=_[_0xab69('0x30')](_0x42ff0f[_0xab69('0x2f')]);_0x529b43['filters']=_[_0xab69('0x32')](_0x529b43[_0xab69('0x2d')],_0x529b43[_0xab69('0x2f')]);_0x2c2a12['attributes']=_['intersection'](_0x529b43[_0xab69('0x2d')],qs[_0xab69('0x33')](_0x42ff0f[_0xab69('0x2f')][_0xab69('0x33')]));_0x2c2a12[_0xab69('0x34')]=_0x2c2a12[_0xab69('0x34')][_0xab69('0x35')]?_0x2c2a12['attributes']:_0x529b43['model'];_0x2c2a12[_0xab69('0x38')]=qs[_0xab69('0x39')](_0x42ff0f[_0xab69('0x2f')][_0xab69('0x39')]);_0x2c2a12[_0xab69('0x3a')]=qs[_0xab69('0x31')](_[_0xab69('0x3b')](_0x42ff0f[_0xab69('0x2f')],_0x529b43[_0xab69('0x31')]));if(_0x42ff0f['query'][_0xab69('0x50')]){_0x2c2a12['where']=_[_0xab69('0x3c')](_0x2c2a12[_0xab69('0x3a')],{'$or':_[_0xab69('0x2e')](_0x2c2a12[_0xab69('0x34')],function(_0x470962){var _0x54d86e={};_0x54d86e[_0x470962]={'$like':'%'+_0x42ff0f[_0xab69('0x2f')][_0xab69('0x50')]+'%'};return _0x54d86e;})});}_0x2c2a12=_[_0xab69('0x3c')]({},_0x2c2a12,_0x42ff0f['options']);return _0x3ce414[_0xab69('0x4f')](_0x2c2a12);}})['then'](function(_0x40bddc){if(_0x40bddc){_0x239445=_0x40bddc[_0xab69('0x35')];if(!_0x42ff0f[_0xab69('0x2f')]['hasOwnProperty'](_0xab69('0x37'))){_0x2c2a12[_0xab69('0x1b')]=qs['limit'](_0x42ff0f[_0xab69('0x2f')][_0xab69('0x1b')]);_0x2c2a12[_0xab69('0x1a')]=qs['offset'](_0x42ff0f[_0xab69('0x2f')][_0xab69('0x1a')]);}return _0x3ce414[_0xab69('0x4f')](_0x2c2a12);}})[_0xab69('0x20')](function(_0x9c8111){if(_0x9c8111){return _0x9c8111?{'count':_0x239445,'rows':_0x9c8111}:null;}})[_0xab69('0x20')](respondWithResult(_0x42e3f6,null))[_0xab69('0x41')](handleError(_0x42e3f6,null));};exports[_0xab69('0x51')]=function(_0xd6ceac,_0x53e225,_0x353fa2){var _0x465149={};var _0x5bacb5={};var _0x294673;var _0x468502;return db[_0xab69('0x29')]['findOne']({'where':{'id':_0xd6ceac['params']['id']}})['then'](handleEntityNotFound(_0x53e225,null))['then'](function(_0x260ba5){if(_0x260ba5){_0x294673=_0x260ba5;_0x5bacb5['model']=_[_0xab69('0x30')](db[_0xab69('0x4c')][_0xab69('0x2a')]);_0x5bacb5[_0xab69('0x2f')]=_[_0xab69('0x30')](_0xd6ceac['query']);_0x5bacb5['filters']=_[_0xab69('0x32')](_0x5bacb5['model'],_0x5bacb5['query']);_0x465149[_0xab69('0x34')]=_['intersection'](_0x5bacb5[_0xab69('0x2d')],qs['fields'](_0xd6ceac['query']['fields']));_0x465149[_0xab69('0x34')]=_0x465149[_0xab69('0x34')][_0xab69('0x35')]?_0x465149[_0xab69('0x34')]:_0x5bacb5[_0xab69('0x2d')];_0x465149[_0xab69('0x38')]=qs['sort'](_0xd6ceac[_0xab69('0x2f')][_0xab69('0x39')]);_0x465149[_0xab69('0x3a')]=qs[_0xab69('0x31')](_[_0xab69('0x3b')](_0xd6ceac[_0xab69('0x2f')],_0x5bacb5[_0xab69('0x31')]));if(_0xd6ceac[_0xab69('0x2f')][_0xab69('0x50')]){_0x465149[_0xab69('0x3a')]=_[_0xab69('0x3c')](_0x465149[_0xab69('0x3a')],{'$or':_[_0xab69('0x2e')](_0x465149[_0xab69('0x34')],function(_0x7c392f){var _0x47b57e={};_0x47b57e[_0x7c392f]={'$like':'%'+_0xd6ceac[_0xab69('0x2f')][_0xab69('0x50')]+'%'};return _0x47b57e;})});}_0x465149=_[_0xab69('0x3c')]({},_0x465149,_0xd6ceac[_0xab69('0x3e')]);return _0x294673[_0xab69('0x51')](_0x465149);}})[_0xab69('0x20')](function(_0x20e6b1){if(_0x20e6b1){_0x468502=_0x20e6b1[_0xab69('0x35')];if(!_0xd6ceac[_0xab69('0x2f')][_0xab69('0x36')](_0xab69('0x37'))){_0x465149[_0xab69('0x1b')]=qs[_0xab69('0x1b')](_0xd6ceac['query']['limit']);_0x465149['offset']=qs[_0xab69('0x1a')](_0xd6ceac['query']['offset']);}return _0x294673[_0xab69('0x51')](_0x465149);}})[_0xab69('0x20')](function(_0x56ea54){if(_0x56ea54){return _0x56ea54?{'count':_0x468502,'rows':_0x56ea54}:null;}})[_0xab69('0x20')](respondWithResult(_0x53e225,null))[_0xab69('0x41')](handleError(_0x53e225,null));};exports[_0xab69('0x52')]=function(_0x254e63,_0x271ae2,_0x26b4ce){if(_0x254e63[_0xab69('0x45')]['id']){delete _0x254e63[_0xab69('0x45')]['id'];}return db[_0xab69('0x29')][_0xab69('0x43')]({'where':{'id':_0x254e63[_0xab69('0x42')]['id']}})[_0xab69('0x20')](handleEntityNotFound(_0x271ae2,null))[_0xab69('0x20')](function(_0xc8500e){if(_0xc8500e){_0x254e63['body'][_0xab69('0x53')]=_0xc8500e['id'];return db['Action'][_0xab69('0x44')](_0x254e63[_0xab69('0x45')]);}})[_0xab69('0x20')](respondWithResult(_0x271ae2,null))[_0xab69('0x41')](handleError(_0x271ae2,null));};exports['getActions']=function(_0x267b8d,_0x3bc2e8,_0x1253b3){var _0x2fa386={};var _0x210764={};var _0x40872b;var _0x442994;return db[_0xab69('0x29')][_0xab69('0x54')]({'where':{'id':_0x267b8d[_0xab69('0x42')]['id']}})[_0xab69('0x20')](handleEntityNotFound(_0x3bc2e8,null))[_0xab69('0x20')](function(_0x1bee0e){if(_0x1bee0e){_0x40872b=_0x1bee0e;_0x210764[_0xab69('0x2d')]=_[_0xab69('0x30')](db[_0xab69('0x55')][_0xab69('0x2a')]);_0x210764[_0xab69('0x2f')]=_[_0xab69('0x30')](_0x267b8d['query']);_0x210764[_0xab69('0x31')]=_[_0xab69('0x32')](_0x210764[_0xab69('0x2d')],_0x210764[_0xab69('0x2f')]);_0x2fa386[_0xab69('0x34')]=_[_0xab69('0x32')](_0x210764[_0xab69('0x2d')],qs[_0xab69('0x33')](_0x267b8d['query'][_0xab69('0x33')]));_0x2fa386['attributes']=_0x2fa386['attributes'][_0xab69('0x35')]?_0x2fa386['attributes']:_0x210764['model'];_0x2fa386[_0xab69('0x38')]=qs[_0xab69('0x39')](_0x267b8d[_0xab69('0x2f')][_0xab69('0x39')]);_0x2fa386[_0xab69('0x3a')]=qs[_0xab69('0x31')](_[_0xab69('0x3b')](_0x267b8d['query'],_0x210764[_0xab69('0x31')]));if(_0x267b8d[_0xab69('0x2f')][_0xab69('0x50')]){_0x2fa386[_0xab69('0x3a')]=_[_0xab69('0x3c')](_0x2fa386[_0xab69('0x3a')],{'$or':_[_0xab69('0x2e')](_0x2fa386[_0xab69('0x34')],function(_0x3933f9){var _0x36c8df={};_0x36c8df[_0x3933f9]={'$like':'%'+_0x267b8d['query']['filter']+'%'};return _0x36c8df;})});}_0x2fa386=_[_0xab69('0x3c')]({},_0x2fa386,_0x267b8d[_0xab69('0x3e')]);return _0x40872b[_0xab69('0x56')](_0x2fa386);}})[_0xab69('0x20')](function(_0x55f4be){if(_0x55f4be){_0x442994=_0x55f4be[_0xab69('0x35')];if(!_0x267b8d['query'][_0xab69('0x36')](_0xab69('0x37'))){_0x2fa386['limit']=qs['limit'](_0x267b8d[_0xab69('0x2f')][_0xab69('0x1b')]);_0x2fa386[_0xab69('0x1a')]=qs['offset'](_0x267b8d[_0xab69('0x2f')][_0xab69('0x1a')]);}return _0x40872b[_0xab69('0x56')](_0x2fa386);}})['then'](function(_0x5a484b){if(_0x5a484b){return _0x5a484b?{'count':_0x442994,'rows':_0x5a484b}:null;}})[_0xab69('0x20')](respondWithResult(_0x3bc2e8,null))['catch'](handleError(_0x3bc2e8,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 89b1a4e..89e820c 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 _0x68fc=['bluebird','path','./trigger.attributes','exports','tools_triggers','lodash','util','../../config/logger'];(function(_0x2fe2f4,_0x5f1fbc){var _0x3b5a6b=function(_0x3c750e){while(--_0x3c750e){_0x2fe2f4['push'](_0x2fe2f4['shift']());}};_0x3b5a6b(++_0x5f1fbc);}(_0x68fc,0xa5));var _0xc68f=function(_0x506ff0,_0x1d94e5){_0x506ff0=_0x506ff0-0x0;var _0x303439=_0x68fc[_0x506ff0];return _0x303439;};'use strict';var _=require(_0xc68f('0x0'));var util=require(_0xc68f('0x1'));var logger=require(_0xc68f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc68f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc68f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc68f('0x5'));module[_0xc68f('0x6')]=function(_0x1c6df9,_0x363cdf){return _0x1c6df9['define']('Trigger',attributes,{'tableName':_0xc68f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x093a=['Trigger','tools_triggers','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./trigger.attributes','exports','define'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x093a,0x16a));var _0xa093=function(_0x318840,_0x561b1e){_0x318840=_0x318840-0x0;var _0x223da4=_0x093a[_0x318840];return _0x223da4;};'use strict';var _=require('lodash');var util=require(_0xa093('0x0'));var logger=require(_0xa093('0x1'))(_0xa093('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa093('0x3'));var fs=require('fs');var path=require(_0xa093('0x4'));var rimraf=require(_0xa093('0x5'));var config=require(_0xa093('0x6'));var attributes=require(_0xa093('0x7'));module[_0xa093('0x8')]=function(_0x2346f1,_0x145f58){return _0x2346f1[_0xa093('0x9')](_0xa093('0xa'),attributes,{'tableName':_0xa093('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 c7bb756..8b1a824 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 _0x5c4b=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','Trigger,\x20%s,\x20%s','message','result','GetTrigger','Trigger','options','raw','where','attributes','map','include','model','catch','ShowTrigger','find','debug','lodash','util','bluebird'];(function(_0x32aa7c,_0x4280f7){var _0xbbacae=function(_0x556c6f){while(--_0x556c6f){_0x32aa7c['push'](_0x32aa7c['shift']());}};_0xbbacae(++_0x4280f7);}(_0x5c4b,0xbd));var _0xb5c4=function(_0x4950d2,_0xb7909d){_0x4950d2=_0x4950d2-0x0;var _0x6ea4f5=_0x5c4b[_0x4950d2];return _0x6ea4f5;};'use strict';var _=require(_0xb5c4('0x0'));var util=require(_0xb5c4('0x1'));var moment=require('moment');var BPromise=require(_0xb5c4('0x2'));var rs=require(_0xb5c4('0x3'));var fs=require('fs');var Redis=require(_0xb5c4('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb5c4('0x5'))(_0xb5c4('0x6'));var config=require(_0xb5c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb5c4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b8d9d,_0x314ab1,_0x296141){return new BPromise(function(_0x11c283,_0x1d802b){return client[_0xb5c4('0x9')](_0x5b8d9d,_0x296141)[_0xb5c4('0xa')](function(_0x598c46){logger[_0xb5c4('0xb')]('Trigger,\x20%s,\x20%s',_0x314ab1,_0xb5c4('0xc'));logger['debug'](_0xb5c4('0xd'),_0x314ab1,'request\x20sent',JSON[_0xb5c4('0xe')](_0x598c46));if(_0x598c46[_0xb5c4('0xf')]){if(_0x598c46[_0xb5c4('0xf')]['code']===0x1f4){logger[_0xb5c4('0xf')](_0xb5c4('0x10'),_0x314ab1,_0x598c46[_0xb5c4('0xf')]['message']);return _0x1d802b(_0x598c46[_0xb5c4('0xf')][_0xb5c4('0x11')]);}logger[_0xb5c4('0xf')]('Trigger,\x20%s,\x20%s',_0x314ab1,_0x598c46['error'][_0xb5c4('0x11')]);return _0x11c283(_0x598c46['error'][_0xb5c4('0x11')]);}else{logger[_0xb5c4('0xb')](_0xb5c4('0x10'),_0x314ab1,_0xb5c4('0xc'));_0x11c283(_0x598c46[_0xb5c4('0x12')]['message']);}})['catch'](function(_0x4cddae){logger['error'](_0xb5c4('0x10'),_0x314ab1,_0x4cddae);_0x1d802b(_0x4cddae);});});}exports[_0xb5c4('0x13')]=function(_0x2d1ee0){var _0x8d8a8f=this;return new Promise(function(_0x594076,_0x3ad887){return db[_0xb5c4('0x14')]['findAll']({'raw':_0x2d1ee0[_0xb5c4('0x15')]?_0x2d1ee0['options'][_0xb5c4('0x16')]===undefined?!![]:![]:!![],'where':_0x2d1ee0[_0xb5c4('0x15')]?_0x2d1ee0[_0xb5c4('0x15')][_0xb5c4('0x17')]||null:null,'attributes':_0x2d1ee0['options']?_0x2d1ee0[_0xb5c4('0x15')][_0xb5c4('0x18')]||null:null,'limit':_0x2d1ee0['options']?_0x2d1ee0[_0xb5c4('0x15')]['limit']||null:null,'include':_0x2d1ee0[_0xb5c4('0x15')]?_0x2d1ee0[_0xb5c4('0x15')]['include']?_[_0xb5c4('0x19')](_0x2d1ee0['options'][_0xb5c4('0x1a')],function(_0x2b1d32){return{'model':db[_0x2b1d32[_0xb5c4('0x1b')]],'as':_0x2b1d32['as'],'attributes':_0x2b1d32[_0xb5c4('0x18')],'include':_0x2b1d32['include']?_['map'](_0x2b1d32['include'],function(_0x2f7647){return{'model':db[_0x2f7647[_0xb5c4('0x1b')]],'as':_0x2f7647['as'],'attributes':_0x2f7647[_0xb5c4('0x18')],'include':_0x2f7647['include']?_[_0xb5c4('0x19')](_0x2f7647[_0xb5c4('0x1a')],function(_0x47a41b){return{'model':db[_0x47a41b[_0xb5c4('0x1b')]],'as':_0x47a41b['as'],'attributes':_0x47a41b[_0xb5c4('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x417f2f){logger[_0xb5c4('0xb')](_0xb5c4('0x13'),_0x2d1ee0);logger['debug'](_0xb5c4('0x13'),_0x2d1ee0,JSON[_0xb5c4('0xe')](_0x417f2f));_0x594076(_0x417f2f);})[_0xb5c4('0x1c')](function(_0x49bb15){logger[_0xb5c4('0xf')]('GetTrigger',_0x49bb15[_0xb5c4('0x11')],_0x2d1ee0);_0x3ad887(_0x8d8a8f[_0xb5c4('0xf')](0x1f4,_0x49bb15['message']));});});};exports[_0xb5c4('0x1d')]=function(_0x943c0){var _0x5b3663=this;return new Promise(function(_0x554140,_0x1553be){return db[_0xb5c4('0x14')][_0xb5c4('0x1e')]({'raw':_0x943c0[_0xb5c4('0x15')]?_0x943c0[_0xb5c4('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x943c0[_0xb5c4('0x15')]?_0x943c0['options'][_0xb5c4('0x17')]||null:null,'attributes':_0x943c0['options']?_0x943c0[_0xb5c4('0x15')][_0xb5c4('0x18')]||null:null,'include':_0x943c0[_0xb5c4('0x15')]?_0x943c0[_0xb5c4('0x15')][_0xb5c4('0x1a')]?_['map'](_0x943c0[_0xb5c4('0x15')][_0xb5c4('0x1a')],function(_0x105c1d){return{'model':db[_0x105c1d['model']],'as':_0x105c1d['as'],'attributes':_0x105c1d[_0xb5c4('0x18')],'include':_0x105c1d[_0xb5c4('0x1a')]?_[_0xb5c4('0x19')](_0x105c1d[_0xb5c4('0x1a')],function(_0x52d692){return{'model':db[_0x52d692[_0xb5c4('0x1b')]],'as':_0x52d692['as'],'attributes':_0x52d692[_0xb5c4('0x18')],'include':_0x52d692[_0xb5c4('0x1a')]?_[_0xb5c4('0x19')](_0x52d692[_0xb5c4('0x1a')],function(_0x1023ee){return{'model':db[_0x1023ee[_0xb5c4('0x1b')]],'as':_0x1023ee['as'],'attributes':_0x1023ee[_0xb5c4('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f1733){logger['info'](_0xb5c4('0x1d'),_0x943c0);logger[_0xb5c4('0x1f')](_0xb5c4('0x1d'),_0x943c0,JSON['stringify'](_0x2f1733));_0x554140(_0x2f1733);})[_0xb5c4('0x1c')](function(_0x262e5c){logger[_0xb5c4('0xf')](_0xb5c4('0x1d'),_0x262e5c[_0xb5c4('0x11')],_0x943c0);_0x1553be(_0x5b3663['error'](0x1f4,_0x262e5c[_0xb5c4('0x11')]));});});}; \ No newline at end of file +var _0x3e68=['request','info','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','findAll','options','raw','where','attributes','limit','include','model','map','then','ShowTrigger','Trigger','find','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2cb1df,_0x4b439c){var _0x30e674=function(_0x532f8b){while(--_0x532f8b){_0x2cb1df['push'](_0x2cb1df['shift']());}};_0x30e674(++_0x4b439c);}(_0x3e68,0x82));var _0x83e6=function(_0x565fe1,_0x56552a){_0x565fe1=_0x565fe1-0x0;var _0x3bdca5=_0x3e68[_0x565fe1];return _0x3bdca5;};'use strict';var _=require(_0x83e6('0x0'));var util=require(_0x83e6('0x1'));var moment=require(_0x83e6('0x2'));var BPromise=require('bluebird');var rs=require(_0x83e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x83e6('0x4'))(_0x83e6('0x5'));var config=require(_0x83e6('0x6'));var jayson=require(_0x83e6('0x7'));var client=jayson[_0x83e6('0x8')][_0x83e6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d4309,_0x3b48b7,_0x4b2ac7){return new BPromise(function(_0x220aee,_0x1c80b2){return client[_0x83e6('0xa')](_0x4d4309,_0x4b2ac7)['then'](function(_0x2a0d16){logger[_0x83e6('0xb')]('Trigger,\x20%s,\x20%s',_0x3b48b7,'request\x20sent');logger[_0x83e6('0xc')](_0x83e6('0xd'),_0x3b48b7,_0x83e6('0xe'),JSON[_0x83e6('0xf')](_0x2a0d16));if(_0x2a0d16[_0x83e6('0x10')]){if(_0x2a0d16[_0x83e6('0x10')]['code']===0x1f4){logger[_0x83e6('0x10')](_0x83e6('0x11'),_0x3b48b7,_0x2a0d16[_0x83e6('0x10')][_0x83e6('0x12')]);return _0x1c80b2(_0x2a0d16[_0x83e6('0x10')][_0x83e6('0x12')]);}logger[_0x83e6('0x10')]('Trigger,\x20%s,\x20%s',_0x3b48b7,_0x2a0d16[_0x83e6('0x10')][_0x83e6('0x12')]);return _0x220aee(_0x2a0d16[_0x83e6('0x10')][_0x83e6('0x12')]);}else{logger[_0x83e6('0xb')](_0x83e6('0x11'),_0x3b48b7,'request\x20sent');_0x220aee(_0x2a0d16[_0x83e6('0x13')][_0x83e6('0x12')]);}})[_0x83e6('0x14')](function(_0x5f0741){logger[_0x83e6('0x10')]('Trigger,\x20%s,\x20%s',_0x3b48b7,_0x5f0741);_0x1c80b2(_0x5f0741);});});}exports[_0x83e6('0x15')]=function(_0x22a467){var _0x30516c=this;return new Promise(function(_0x71fd47,_0x4e4e0f){return db['Trigger'][_0x83e6('0x16')]({'raw':_0x22a467[_0x83e6('0x17')]?_0x22a467['options'][_0x83e6('0x18')]===undefined?!![]:![]:!![],'where':_0x22a467[_0x83e6('0x17')]?_0x22a467[_0x83e6('0x17')][_0x83e6('0x19')]||null:null,'attributes':_0x22a467[_0x83e6('0x17')]?_0x22a467[_0x83e6('0x17')][_0x83e6('0x1a')]||null:null,'limit':_0x22a467[_0x83e6('0x17')]?_0x22a467[_0x83e6('0x17')][_0x83e6('0x1b')]||null:null,'include':_0x22a467[_0x83e6('0x17')]?_0x22a467[_0x83e6('0x17')][_0x83e6('0x1c')]?_['map'](_0x22a467['options'][_0x83e6('0x1c')],function(_0x17e82b){return{'model':db[_0x17e82b[_0x83e6('0x1d')]],'as':_0x17e82b['as'],'attributes':_0x17e82b['attributes'],'include':_0x17e82b[_0x83e6('0x1c')]?_['map'](_0x17e82b[_0x83e6('0x1c')],function(_0x448dc){return{'model':db[_0x448dc[_0x83e6('0x1d')]],'as':_0x448dc['as'],'attributes':_0x448dc[_0x83e6('0x1a')],'include':_0x448dc[_0x83e6('0x1c')]?_[_0x83e6('0x1e')](_0x448dc[_0x83e6('0x1c')],function(_0x417295){return{'model':db[_0x417295['model']],'as':_0x417295['as'],'attributes':_0x417295[_0x83e6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x83e6('0x1f')](function(_0x14012a){logger['info']('GetTrigger',_0x22a467);logger[_0x83e6('0xc')](_0x83e6('0x15'),_0x22a467,JSON[_0x83e6('0xf')](_0x14012a));_0x71fd47(_0x14012a);})['catch'](function(_0x57e2b5){logger[_0x83e6('0x10')]('GetTrigger',_0x57e2b5[_0x83e6('0x12')],_0x22a467);_0x4e4e0f(_0x30516c[_0x83e6('0x10')](0x1f4,_0x57e2b5[_0x83e6('0x12')]));});});};exports[_0x83e6('0x20')]=function(_0x308273){var _0x540e5f=this;return new Promise(function(_0x1eef7b,_0xe0909c){return db[_0x83e6('0x21')][_0x83e6('0x22')]({'raw':_0x308273['options']?_0x308273['options'][_0x83e6('0x18')]===undefined?!![]:![]:!![],'where':_0x308273[_0x83e6('0x17')]?_0x308273[_0x83e6('0x17')]['where']||null:null,'attributes':_0x308273[_0x83e6('0x17')]?_0x308273[_0x83e6('0x17')][_0x83e6('0x1a')]||null:null,'include':_0x308273[_0x83e6('0x17')]?_0x308273[_0x83e6('0x17')][_0x83e6('0x1c')]?_['map'](_0x308273[_0x83e6('0x17')]['include'],function(_0x156fb7){return{'model':db[_0x156fb7[_0x83e6('0x1d')]],'as':_0x156fb7['as'],'attributes':_0x156fb7['attributes'],'include':_0x156fb7[_0x83e6('0x1c')]?_[_0x83e6('0x1e')](_0x156fb7['include'],function(_0x408787){return{'model':db[_0x408787[_0x83e6('0x1d')]],'as':_0x408787['as'],'attributes':_0x408787['attributes'],'include':_0x408787[_0x83e6('0x1c')]?_[_0x83e6('0x1e')](_0x408787['include'],function(_0x542048){return{'model':db[_0x542048['model']],'as':_0x542048['as'],'attributes':_0x542048[_0x83e6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x83e6('0x1f')](function(_0x11fc95){logger[_0x83e6('0xb')](_0x83e6('0x20'),_0x308273);logger[_0x83e6('0xc')](_0x83e6('0x20'),_0x308273,JSON['stringify'](_0x11fc95));_0x1eef7b(_0x11fc95);})[_0x83e6('0x14')](function(_0x43f6ad){logger[_0x83e6('0x10')](_0x83e6('0x20'),_0x43f6ad[_0x83e6('0x12')],_0x308273);_0xe0909c(_0x540e5f[_0x83e6('0x10')](0x1f4,_0x43f6ad['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 48941da..6d3c482 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 _0x23e8=['./trunk.controller','get','index','show','post','isAuthenticated','clone','create','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3fd6ae,_0x332c75){var _0x204d55=function(_0xe316f3){while(--_0xe316f3){_0x3fd6ae['push'](_0x3fd6ae['shift']());}};_0x204d55(++_0x332c75);}(_0x23e8,0xac));var _0x823e=function(_0x39d294,_0xcb7a37){_0x39d294=_0x39d294-0x0;var _0x37c63f=_0x23e8[_0x39d294];return _0x37c63f;};'use strict';var multer=require(_0x823e('0x0'));var util=require(_0x823e('0x1'));var path=require('path');var timeout=require(_0x823e('0x2'));var express=require(_0x823e('0x3'));var router=express[_0x823e('0x4')]();var fs_extra=require(_0x823e('0x5'));var auth=require(_0x823e('0x6'));var interaction=require(_0x823e('0x7'));var config=require('../../config/environment');var controller=require(_0x823e('0x8'));router[_0x823e('0x9')]('/',auth['isAuthenticated'](),controller[_0x823e('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x823e('0xb')]);router[_0x823e('0xc')]('/:id/clone',auth[_0x823e('0xd')](),controller[_0x823e('0xe')]);router['post']('/',auth[_0x823e('0xd')](),controller[_0x823e('0xf')]);router['put'](_0x823e('0x10'),auth['isAuthenticated'](),controller[_0x823e('0x11')]);router['delete']('/:id',auth[_0x823e('0xd')](),controller[_0x823e('0x12')]);module[_0x823e('0x13')]=router; \ No newline at end of file +var _0xc2d5=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','/:id/clone','clone','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xc2d5,0xde));var _0x5c2d=function(_0x2c1dcd,_0x350452){_0x2c1dcd=_0x2c1dcd-0x0;var _0x158ce5=_0xc2d5[_0x2c1dcd];return _0x158ce5;};'use strict';var multer=require(_0x5c2d('0x0'));var util=require(_0x5c2d('0x1'));var path=require(_0x5c2d('0x2'));var timeout=require(_0x5c2d('0x3'));var express=require(_0x5c2d('0x4'));var router=express[_0x5c2d('0x5')]();var fs_extra=require(_0x5c2d('0x6'));var auth=require(_0x5c2d('0x7'));var interaction=require(_0x5c2d('0x8'));var config=require(_0x5c2d('0x9'));var controller=require('./trunk.controller');router[_0x5c2d('0xa')]('/',auth[_0x5c2d('0xb')](),controller[_0x5c2d('0xc')]);router['get'](_0x5c2d('0xd'),auth[_0x5c2d('0xb')](),controller['show']);router[_0x5c2d('0xe')](_0x5c2d('0xf'),auth['isAuthenticated'](),controller[_0x5c2d('0x10')]);router[_0x5c2d('0xe')]('/',auth['isAuthenticated'](),controller[_0x5c2d('0x11')]);router[_0x5c2d('0x12')](_0x5c2d('0xd'),auth[_0x5c2d('0xb')](),controller[_0x5c2d('0x13')]);router[_0x5c2d('0x14')]('/:id',auth[_0x5c2d('0xb')](),controller[_0x5c2d('0x15')]);module[_0x5c2d('0x16')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 62eb3b3..0849ea4 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 _0x9597=['update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','join','allow','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER','\x22\x22\x20<>','always','accept','uas','certificate','active','actpass','dynamic','BOOLEAN','exports','STRING','name','ENUM','user','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','yes','nonat'];(function(_0x1fd91a,_0x407662){var _0x3dc9ff=function(_0x3137d0){while(--_0x3137d0){_0x1fd91a['push'](_0x1fd91a['shift']());}};_0x3dc9ff(++_0x407662);}(_0x9597,0xcb));var _0x7959=function(_0x4dbf71,_0x153da8){_0x4dbf71=_0x4dbf71-0x0;var _0x1ae202=_0x9597[_0x4dbf71];return _0x1ae202;};'use strict';var Sequelize=require('sequelize');module[_0x7959('0x0')]={'name':{'type':Sequelize[_0x7959('0x1')],'allowNull':![],'unique':_0x7959('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7959('0x3')]('friend',_0x7959('0x4'),'peer'),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x7959('0x1')],'allowNull':![],'defaultValue':_0x7959('0x5')},'callingpres':{'type':Sequelize[_0x7959('0x3')]('ALLOWED_NOT_SCREENED',_0x7959('0x6'),_0x7959('0x7'),_0x7959('0x8'),_0x7959('0x9'),_0x7959('0xa'),_0x7959('0xb'),_0x7959('0xc'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x7959('0x1')]},'secret':{'type':Sequelize[_0x7959('0x1')]},'md5secret':{'type':Sequelize[_0x7959('0x1')]},'remotesecret':{'type':Sequelize[_0x7959('0x1')]},'transport':{'type':Sequelize[_0x7959('0x1')],'defaultValue':'udp','set':function(_0x518b11){this[_0x7959('0xd')](_0x7959('0xe'),_0x518b11?_0x518b11['join'](','):null);},'get':function(){return this[_0x7959('0xf')]('transport')?this[_0x7959('0xf')](_0x7959('0xe'))['split'](','):null;},'comment':_0x7959('0x10')},'dtmfmode':{'type':Sequelize['ENUM'](_0x7959('0x11'),'info',_0x7959('0x12'),_0x7959('0x13'),'auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no',_0x7959('0x15'),_0x7959('0x16'),_0x7959('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x7959('0x1')]},'directmediadeny':{'type':Sequelize[_0x7959('0x1')]},'nat':{'type':Sequelize[_0x7959('0x1')],'defaultValue':_0x7959('0x18'),'set':function(_0x39ca2c){this['setDataValue']('nat',_0x39ca2c?_0x39ca2c['join'](','):null);},'get':function(){return this[_0x7959('0xf')](_0x7959('0x19'))?this[_0x7959('0xf')](_0x7959('0x19'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x7959('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x7959('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x7959('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7959('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x7959('0x1')],'defaultValue':_0x7959('0x1a')},'allow':{'type':Sequelize[_0x7959('0x1')],'allowNull':![],'defaultValue':_0x7959('0x1b'),'set':function(_0x1a38d0){this[_0x7959('0xd')]('allow',_0x1a38d0?_0x1a38d0[_0x7959('0x1c')](';'):_0x7959('0x1b'));},'get':function(){return this[_0x7959('0xf')](_0x7959('0x1d'))?this[_0x7959('0xf')](_0x7959('0x1d'))[_0x7959('0x1e')](';'):null;},'comment':_0x7959('0x1f')},'autoframing':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no')},'insecure':{'type':Sequelize[_0x7959('0x1')],'defaultValue':_0x7959('0x20'),'set':function(_0x1194ec){this[_0x7959('0xd')](_0x7959('0x21'),_0x1194ec?_0x1194ec[_0x7959('0x1c')](','):null);},'get':function(){return this[_0x7959('0xf')](_0x7959('0x21'))?this[_0x7959('0xf')]('insecure')[_0x7959('0x1e')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x7959('0x14'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no',_0x7959('0x22'))},'promiscredir':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no')},'useclientcode':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no')},'accountcode':{'type':Sequelize[_0x7959('0x23')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x7959('0x1')],'defaultValue':_0x7959('0x24')},'amaflags':{'type':Sequelize[_0x7959('0x1')]},'callcounter':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x7959('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0x7959('0x3')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x7959('0x3')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x7959('0x1')]},'videosupport':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no',_0x7959('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x7959('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x7959('0x14'),'no')},'mailbox':{'type':Sequelize[_0x7959('0x1')]},'session_timers':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x26'),'refuse','originate')},'session_expires':{'type':Sequelize[_0x7959('0x23')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x7959('0x3')]('uac',_0x7959('0x27')),'defaultValue':_0x7959('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0x7959('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x7959('0x1')]},'fromuser':{'type':Sequelize[_0x7959('0x1')]},'port':{'type':Sequelize[_0x7959('0x23')](0x5)},'qualify':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no'),'defaultValue':_0x7959('0x14')},'keepalive':{'type':Sequelize[_0x7959('0x23')](0xb)},'defaultip':{'type':Sequelize[_0x7959('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x7959('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x7959('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x7959('0x23')](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x7959('0x1')]},'callbackextension':{'type':Sequelize[_0x7959('0x1')]},'timert1':{'type':Sequelize[_0x7959('0x23')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x7959('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0x7959('0x1')]},'contactdeny':{'type':Sequelize[_0x7959('0x1')]},'contactacl':{'type':Sequelize[_0x7959('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x7959('0x1')]},'use_q850_reason':{'type':Sequelize[_0x7959('0x1')]},'maxforwards':{'type':Sequelize[_0x7959('0x23')](0xb)},'encryption':{'type':Sequelize[_0x7959('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no')},'force_avp':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no')},'icesupport':{'type':Sequelize[_0x7959('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x7959('0x14'),'no','fingerprint',_0x7959('0x28'))},'dtlsrekey':{'type':Sequelize[_0x7959('0x23')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x7959('0x1')]},'dtlscapath':{'type':Sequelize[_0x7959('0x1')]},'dtlssetup':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x29'),'passive',_0x7959('0x2a')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x7959('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no')},'subscribemwi':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no')},'vmexten':{'type':Sequelize[_0x7959('0x1')]},'mohinterpret':{'type':Sequelize[_0x7959('0x1')]},'mohsuggest':{'type':Sequelize[_0x7959('0x1')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7959('0x1')]},'host':{'type':Sequelize[_0x7959('0x1')],'defaultValue':_0x7959('0x2b')},'canreinvite':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no',_0x7959('0x15'),_0x7959('0x16'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x7959('0x1')]},'otherFields':{'type':Sequelize[_0x7959('0x1')]},'active':{'type':Sequelize[_0x7959('0x2c')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x7959('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x495f=['ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','shortinfo','inband','auto','rfc2833','nonat','update','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uas','fingerprint','certificate','active','passive','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','ALLOWED_PASSED_SCREEN'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x495f,0x1c2));var _0xf495=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x495f[_0x4fc9e6];return _0x551d28;};'use strict';var Sequelize=require(_0xf495('0x0'));module[_0xf495('0x1')]={'name':{'type':Sequelize[_0xf495('0x2')],'allowNull':![],'unique':_0xf495('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xf495('0x4')](_0xf495('0x5'),_0xf495('0x6'),_0xf495('0x7')),'allowNull':![],'defaultValue':_0xf495('0x5')},'context':{'type':Sequelize[_0xf495('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xf495('0x4')]('ALLOWED_NOT_SCREENED',_0xf495('0x8'),_0xf495('0x9'),_0xf495('0xa'),_0xf495('0xb'),_0xf495('0xc'),_0xf495('0xd'),'PROHIB')},'deny':{'type':Sequelize[_0xf495('0x2')]},'permit':{'type':Sequelize[_0xf495('0x2')]},'secret':{'type':Sequelize[_0xf495('0x2')]},'md5secret':{'type':Sequelize[_0xf495('0x2')]},'remotesecret':{'type':Sequelize[_0xf495('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x5240c4){this[_0xf495('0xe')](_0xf495('0xf'),_0x5240c4?_0x5240c4[_0xf495('0x10')](','):null);},'get':function(){return this['getDataValue'](_0xf495('0xf'))?this[_0xf495('0x11')](_0xf495('0xf'))[_0xf495('0x12')](','):null;},'comment':_0xf495('0x13')},'dtmfmode':{'type':Sequelize[_0xf495('0x4')]('rfc2833','info',_0xf495('0x14'),_0xf495('0x15'),_0xf495('0x16')),'defaultValue':_0xf495('0x17')},'directmedia':{'type':Sequelize[_0xf495('0x4')]('yes','no',_0xf495('0x18'),_0xf495('0x19'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xf495('0x4')](_0xf495('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xf495('0x2')]},'nat':{'type':Sequelize[_0xf495('0x2')],'defaultValue':_0xf495('0x1b'),'set':function(_0x59199e){this[_0xf495('0xe')]('nat',_0x59199e?_0x59199e[_0xf495('0x10')](','):null);},'get':function(){return this['getDataValue'](_0xf495('0x1c'))?this[_0xf495('0x11')](_0xf495('0x1c'))['split'](','):null;},'comment':_0xf495('0x1d')},'callgroup':{'type':Sequelize[_0xf495('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xf495('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xf495('0x2')]},'language':{'type':Sequelize[_0xf495('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xf495('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xf495('0x2')],'defaultValue':_0xf495('0x1e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x2ccb73){this[_0xf495('0xe')]('allow',_0x2ccb73?_0x2ccb73[_0xf495('0x10')](';'):_0xf495('0x1f'));},'get':function(){return this[_0xf495('0x11')]('allow')?this[_0xf495('0x11')](_0xf495('0x20'))[_0xf495('0x12')](';'):null;},'comment':_0xf495('0x21')},'autoframing':{'type':Sequelize[_0xf495('0x4')](_0xf495('0x1a'),'no')},'insecure':{'type':Sequelize[_0xf495('0x2')],'defaultValue':_0xf495('0x22'),'set':function(_0x15bef5){this[_0xf495('0xe')](_0xf495('0x23'),_0x15bef5?_0x15bef5[_0xf495('0x10')](','):null);},'get':function(){return this[_0xf495('0x11')](_0xf495('0x23'))?this['getDataValue']('insecure')[_0xf495('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xf495('0x4')](_0xf495('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xf495('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xf495('0x4')](_0xf495('0x1a'),'no',_0xf495('0x24'))},'promiscredir':{'type':Sequelize[_0xf495('0x4')](_0xf495('0x1a'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0xf495('0x1a'),'no')},'accountcode':{'type':Sequelize[_0xf495('0x25')](0xb)},'setvar':{'type':Sequelize[_0xf495('0x2')]},'callerid':{'type':Sequelize[_0xf495('0x2')],'defaultValue':_0xf495('0x26')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xf495('0x4')](_0xf495('0x1a'),'no'),'defaultValue':_0xf495('0x1a')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xf495('0x4')](_0xf495('0x1a'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xf495('0x1a'),'no')},'allowtransfer':{'type':Sequelize[_0xf495('0x4')](_0xf495('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0xf495('0x4')](_0xf495('0x1a'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xf495('0x2')]},'videosupport':{'type':Sequelize[_0xf495('0x4')]('yes','no',_0xf495('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf495('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xf495('0x4')](_0xf495('0x1a'),'no')},'mailbox':{'type':Sequelize[_0xf495('0x2')]},'session_timers':{'type':Sequelize[_0xf495('0x4')](_0xf495('0x28'),_0xf495('0x29'),_0xf495('0x2a'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xf495('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0xf495('0x4')]('uac',_0xf495('0x2b')),'defaultValue':_0xf495('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0xf495('0x2')]},'regexten':{'type':Sequelize[_0xf495('0x2')]},'fromdomain':{'type':Sequelize[_0xf495('0x2')]},'fromuser':{'type':Sequelize[_0xf495('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xf495('0x4')]('yes','no'),'defaultValue':_0xf495('0x1a')},'keepalive':{'type':Sequelize[_0xf495('0x25')](0xb)},'defaultip':{'type':Sequelize[_0xf495('0x2')]},'defaultuser':{'type':Sequelize[_0xf495('0x2')]},'rtptimeout':{'type':Sequelize[_0xf495('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xf495('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xf495('0x1a'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xf495('0x2')]},'callbackextension':{'type':Sequelize[_0xf495('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xf495('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0xf495('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0xf495('0x2')]},'contactdeny':{'type':Sequelize[_0xf495('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xf495('0x2')]},'use_q850_reason':{'type':Sequelize[_0xf495('0x2')]},'maxforwards':{'type':Sequelize[_0xf495('0x25')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xf495('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xf495('0x4')]('yes','no')},'force_avp':{'type':Sequelize[_0xf495('0x4')](_0xf495('0x1a'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xf495('0x1a'),'no')},'dtlsenable':{'type':Sequelize[_0xf495('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM'](_0xf495('0x1a'),'no',_0xf495('0x2c'),_0xf495('0x2d'))},'dtlsrekey':{'type':Sequelize[_0xf495('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0xf495('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xf495('0x2')]},'dtlscipher':{'type':Sequelize[_0xf495('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xf495('0x2')]},'dtlssetup':{'type':Sequelize[_0xf495('0x4')](_0xf495('0x2e'),_0xf495('0x2f'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf495('0x2')]},'usereqphone':{'type':Sequelize['ENUM'](_0xf495('0x1a'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf495('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xf495('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xf495('0x4')](_0xf495('0x1a'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0xf495('0x1a'),'no')},'vmexten':{'type':Sequelize[_0xf495('0x2')]},'mohinterpret':{'type':Sequelize[_0xf495('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xf495('0x2')]},'description':{'type':Sequelize[_0xf495('0x2')]},'host':{'type':Sequelize[_0xf495('0x2')],'defaultValue':_0xf495('0x30')},'canreinvite':{'type':Sequelize['ENUM'](_0xf495('0x1a'),'no','nonat','update',_0xf495('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xf495('0x2')]},'otherFields':{'type':Sequelize[_0xf495('0x2')]},'active':{'type':Sequelize[_0xf495('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'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 bc35f69..4d0069f 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 _0x9f62=['updatedAt','body','create','user','role','UserProfileSection','autoAssociation','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','render','/etc/asterisk/sip_xcally_trunks.conf','Reload','server/files/templates/registry.ejs','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','get','Trunks','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','key','map','keys','filters','intersection','query','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','Trunk','findAll','rows','show','params','clone','find','omit','createdAt'];(function(_0x52085a,_0x3717ca){var _0x5afc1a=function(_0x2aa175){while(--_0x2aa175){_0x52085a['push'](_0x52085a['shift']());}};_0x5afc1a(++_0x3717ca);}(_0x9f62,0x154));var _0x29f6=function(_0x2cbe06,_0x3c0fba){_0x2cbe06=_0x2cbe06-0x0;var _0x243c46=_0x9f62[_0x2cbe06];return _0x243c46;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x29f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29f6('0x1'));var rp=require(_0x29f6('0x2'));var moment=require(_0x29f6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x29f6('0x4'));var path=require(_0x29f6('0x5'));var sox=require(_0x29f6('0x6'));var csv=require(_0x29f6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x29f6('0x8'));var _=require(_0x29f6('0x9'));var squel=require(_0x29f6('0xa'));var crypto=require(_0x29f6('0xb'));var jsforce=require(_0x29f6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x29f6('0xd'));var authService=require(_0x29f6('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29f6('0xf'));var logger=require(_0x29f6('0x10'))('api');var utils=require(_0x29f6('0x11'));var config=require(_0x29f6('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x29f6('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x55cf4,_0x189344,_0x11a1fd,_0x17de6e){return new BPromise(function(_0x156c96,_0x35d2e2){var _0x2418ee=_0x17de6e||client;return _0x2418ee[_0x29f6('0x14')](_0x55cf4,_0x11a1fd)[_0x29f6('0x15')](function(_0x28d314){logger[_0x29f6('0x16')](_0x29f6('0x17'),_0x189344,_0x29f6('0x18'));logger[_0x29f6('0x19')](_0x29f6('0x1a'),_0x189344,_0x29f6('0x18'),JSON['stringify'](_0x28d314));if(_0x28d314['error']){if(_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1c')]===0x1f4){logger[_0x29f6('0x1b')]('Trunk,\x20%s,\x20%s',_0x189344,_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1d')]);return _0x35d2e2(_0x28d314['error'][_0x29f6('0x1d')]);}logger[_0x29f6('0x1b')](_0x29f6('0x17'),_0x189344,_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1d')]);return _0x156c96(_0x28d314[_0x29f6('0x1b')]['message']);}else{logger[_0x29f6('0x16')]('Trunk,\x20%s,\x20%s',_0x189344,'request\x20sent');_0x156c96(_0x28d314[_0x29f6('0x1e')][_0x29f6('0x1d')]);}})[_0x29f6('0x1f')](function(_0xafb5dd){logger['error'](_0x29f6('0x17'),_0x189344,_0xafb5dd);_0x35d2e2(_0xafb5dd);});});}function respondWithStatusCode(_0x49f67d,_0xd4179c){_0xd4179c=_0xd4179c||0xcc;return function(_0xcce041){if(_0xcce041){return _0x49f67d[_0x29f6('0x20')](_0xd4179c);}return _0x49f67d[_0x29f6('0x21')](_0xd4179c)['end']();};}function respondWithResult(_0x4290a2,_0x4d494f){_0x4d494f=_0x4d494f||0xc8;return function(_0x47c385){if(_0x47c385){return _0x4290a2[_0x29f6('0x21')](_0x4d494f)[_0x29f6('0x22')](_0x47c385);}};}function respondWithFilteredResult(_0x2519ac,_0x342038){return function(_0x84ccb7){if(_0x84ccb7){var _0x4333bc=typeof _0x342038[_0x29f6('0x23')]==='undefined'&&typeof _0x342038[_0x29f6('0x24')]===_0x29f6('0x25');var _0x1ab8d8=_0x84ccb7[_0x29f6('0x26')];var _0xda0a63=_0x4333bc?0x0:_0x342038[_0x29f6('0x23')];var _0x3790f5=_0x4333bc?_0x84ccb7[_0x29f6('0x26')]:_0x342038[_0x29f6('0x23')]+_0x342038[_0x29f6('0x24')];var _0x2915bc;if(_0x3790f5>=_0x1ab8d8){_0x3790f5=_0x1ab8d8;_0x2915bc=0xc8;}else{_0x2915bc=0xce;}_0x2519ac[_0x29f6('0x21')](_0x2915bc);return _0x2519ac[_0x29f6('0x27')](_0x29f6('0x28'),_0xda0a63+'-'+_0x3790f5+'/'+_0x1ab8d8)[_0x29f6('0x22')](_0x84ccb7);}return null;};}function patchUpdates(_0x218931){return function(_0x3a7249){try{jsonpatch['apply'](_0x3a7249,_0x218931,!![]);}catch(_0x5582d3){return BPromise[_0x29f6('0x29')](_0x5582d3);}return _0x3a7249['save']();};}function saveUpdates(_0x341071,_0xc8d2c5){return function(_0x1e1bb6){if(_0x1e1bb6){return _0x1e1bb6[_0x29f6('0x2a')](_0x341071)['then'](function(_0x53e11f){return _0x53e11f;});}return null;};}function removeEntity(_0x1bde69,_0xa6377c){return function(_0x2edc2e){if(_0x2edc2e){return _0x2edc2e[_0x29f6('0x2b')]()[_0x29f6('0x15')](function(){var _0x20bc5e=_0x2edc2e[_0x29f6('0x2c')]({'plain':!![]});var _0x1c3f0f=_0x29f6('0x2d');return db[_0x29f6('0x2e')][_0x29f6('0x2b')]({'where':{'type':_0x1c3f0f,'resourceId':_0x20bc5e['id']}})[_0x29f6('0x15')](function(){return _0x2edc2e;});})[_0x29f6('0x15')](function(){_0x1bde69[_0x29f6('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e31dd,_0x206beb){return function(_0x44cf19){if(!_0x44cf19){_0x5e31dd[_0x29f6('0x20')](0x194);}return _0x44cf19;};}function handleError(_0x5416dc,_0x3e1e25){_0x3e1e25=_0x3e1e25||0x1f4;return function(_0x749b9d){logger[_0x29f6('0x1b')](_0x749b9d[_0x29f6('0x2f')]);if(_0x749b9d[_0x29f6('0x30')]){delete _0x749b9d['name'];}_0x5416dc[_0x29f6('0x21')](_0x3e1e25)[_0x29f6('0x31')](_0x749b9d);};}exports[_0x29f6('0x32')]=function(_0x1b51cc,_0x4f5fe1){var _0x30d747={},_0x2a09e8={},_0x14b392={'count':0x0,'rows':[]};var _0x105557=_['map'](db['Trunk'][_0x29f6('0x33')],function(_0x4bfc80){return{'name':_0x4bfc80[_0x29f6('0x34')],'type':_0x4bfc80['type'][_0x29f6('0x35')]};});_0x2a09e8['model']=_[_0x29f6('0x36')](_0x105557,_0x29f6('0x30'));_0x2a09e8['query']=_[_0x29f6('0x37')](_0x1b51cc['query']);_0x2a09e8[_0x29f6('0x38')]=_[_0x29f6('0x39')](_0x2a09e8['model'],_0x2a09e8[_0x29f6('0x3a')]);_0x30d747[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x2a09e8[_0x29f6('0x3c')],qs['fields'](_0x1b51cc[_0x29f6('0x3a')][_0x29f6('0x3d')]));_0x30d747[_0x29f6('0x3b')]=_0x30d747[_0x29f6('0x3b')][_0x29f6('0x3e')]?_0x30d747['attributes']:_0x2a09e8[_0x29f6('0x3c')];if(!_0x1b51cc['query'][_0x29f6('0x3f')]('nolimit')){_0x30d747[_0x29f6('0x24')]=qs[_0x29f6('0x24')](_0x1b51cc['query'][_0x29f6('0x24')]);_0x30d747[_0x29f6('0x23')]=qs[_0x29f6('0x23')](_0x1b51cc[_0x29f6('0x3a')]['offset']);}_0x30d747[_0x29f6('0x40')]=qs[_0x29f6('0x41')](_0x1b51cc[_0x29f6('0x3a')]['sort']);_0x30d747[_0x29f6('0x42')]=qs['filters'](_[_0x29f6('0x43')](_0x1b51cc['query'],_0x2a09e8['filters']),_0x105557);if(_0x1b51cc['query'][_0x29f6('0x44')]){_0x30d747[_0x29f6('0x42')]=_[_0x29f6('0x45')](_0x30d747[_0x29f6('0x42')],{'$or':_[_0x29f6('0x36')](_0x105557,function(_0x270842){if(_0x270842[_0x29f6('0x46')]!==_0x29f6('0x47')){var _0x352119={};_0x352119[_0x270842[_0x29f6('0x30')]]={'$like':'%'+_0x1b51cc['query']['filter']+'%'};return _0x352119;}})});}_0x30d747=_[_0x29f6('0x45')]({},_0x30d747,_0x1b51cc[_0x29f6('0x48')]);var _0x7a65c0={'where':_0x30d747[_0x29f6('0x42')]};return db['Trunk'][_0x29f6('0x26')](_0x7a65c0)[_0x29f6('0x15')](function(_0x532df5){_0x14b392[_0x29f6('0x26')]=_0x532df5;if(_0x1b51cc[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x30d747[_0x29f6('0x4a')]=[{'all':!![]}];}return db[_0x29f6('0x4b')][_0x29f6('0x4c')](_0x30d747);})[_0x29f6('0x15')](function(_0x1f03b6){_0x14b392[_0x29f6('0x4d')]=_0x1f03b6;return _0x14b392;})[_0x29f6('0x15')](respondWithFilteredResult(_0x4f5fe1,_0x30d747))[_0x29f6('0x1f')](handleError(_0x4f5fe1,null));};exports[_0x29f6('0x4e')]=function(_0x58ea69,_0x416c24){var _0x463551={'raw':![],'where':{'id':_0x58ea69[_0x29f6('0x4f')]['id']}},_0x335ec1={};_0x335ec1[_0x29f6('0x3c')]=_['keys'](db[_0x29f6('0x4b')]['rawAttributes']);_0x335ec1['query']=_[_0x29f6('0x37')](_0x58ea69[_0x29f6('0x3a')]);_0x335ec1[_0x29f6('0x38')]=_[_0x29f6('0x39')](_0x335ec1[_0x29f6('0x3c')],_0x335ec1['query']);_0x463551[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x335ec1['model'],qs[_0x29f6('0x3d')](_0x58ea69['query'][_0x29f6('0x3d')]));_0x463551[_0x29f6('0x3b')]=_0x463551[_0x29f6('0x3b')][_0x29f6('0x3e')]?_0x463551['attributes']:_0x335ec1[_0x29f6('0x3c')];if(_0x58ea69[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x463551[_0x29f6('0x4a')]=[{'all':!![]}];}_0x463551=_[_0x29f6('0x45')]({},_0x463551,_0x58ea69[_0x29f6('0x48')]);return db[_0x29f6('0x4b')]['find'](_0x463551)[_0x29f6('0x15')](handleEntityNotFound(_0x416c24,null))[_0x29f6('0x15')](respondWithResult(_0x416c24,null))[_0x29f6('0x1f')](handleError(_0x416c24,null));};exports[_0x29f6('0x50')]=function(_0x36e52c,_0x1ac20d){var _0x37c3c1={'where':{'id':_0x36e52c[_0x29f6('0x4f')]['id']}},_0x2f356d={};_0x2f356d[_0x29f6('0x3c')]=_['keys'](db['Trunk'][_0x29f6('0x33')]);_0x37c3c1[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x2f356d['model'],qs[_0x29f6('0x3d')](_0x36e52c['query']['fields']));_0x37c3c1[_0x29f6('0x3b')]=_0x37c3c1[_0x29f6('0x3b')]['length']?_0x37c3c1['attributes']:_0x2f356d[_0x29f6('0x3c')];if(_0x36e52c[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x37c3c1['include']=[{'all':!![]}];}_0x37c3c1=_[_0x29f6('0x45')]({},_0x37c3c1,_0x36e52c[_0x29f6('0x48')]);return db[_0x29f6('0x4b')][_0x29f6('0x51')](_0x37c3c1)[_0x29f6('0x15')](handleEntityNotFound(_0x1ac20d,null))[_0x29f6('0x15')](function(_0x7700da){if(_0x7700da){var _0x33b1d7=_0x7700da[_0x29f6('0x2c')]({'plain':!![]});_0x33b1d7=qs[_0x29f6('0x52')](_0x33b1d7,['id',_0x29f6('0x53'),_0x29f6('0x54')]);_0x36e52c[_0x29f6('0x55')]=_['omit'](_0x36e52c['body'],['id',_0x29f6('0x53'),'updatedAt']);return db[_0x29f6('0x4b')][_0x29f6('0x56')](_[_0x29f6('0x45')](_0x33b1d7,_0x36e52c[_0x29f6('0x55')]),{'include':_0x36e52c[_0x29f6('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0x29f6('0x15')](function(_0x38d684){var _0x2f694e=_0x36e52c[_0x29f6('0x57')][_0x29f6('0x2c')]({'plain':!![]});if(!_0x2f694e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f694e[_0x29f6('0x58')]==='user'){var _0x51b9dc=_0x38d684[_0x29f6('0x2c')]({'plain':!![]});var _0x336b8e='Trunks';return db[_0x29f6('0x59')][_0x29f6('0x51')]({'where':{'name':_0x336b8e,'userProfileId':_0x2f694e['userProfileId']},'raw':!![]})[_0x29f6('0x15')](function(_0x2ba44c){if(_0x2ba44c&&_0x2ba44c[_0x29f6('0x5a')]===0x0){return db[_0x29f6('0x2e')][_0x29f6('0x56')]({'name':_0x51b9dc[_0x29f6('0x30')],'resourceId':_0x51b9dc['id'],'type':_0x2ba44c[_0x29f6('0x30')],'sectionId':_0x2ba44c['id']},{})['then'](function(){return _0x38d684;});}else{return _0x38d684;}})[_0x29f6('0x1f')](function(_0x50ddd6){logger[_0x29f6('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50ddd6);throw _0x50ddd6;});}return _0x38d684;});}})['then'](respondWithResult(_0x1ac20d,0xc9))[_0x29f6('0x1f')](handleError(_0x1ac20d,null));};exports[_0x29f6('0x56')]=function(_0x195887,_0x536b0c,_0x6ae738){var _0x373cf6;return db[_0x29f6('0x4b')]['create'](_0x195887[_0x29f6('0x55')],{'raw':!![]})[_0x29f6('0x15')](function(_0x66a7bb){_0x373cf6=_0x66a7bb;return db[_0x29f6('0x4b')][_0x29f6('0x4c')]({'raw':!![]});})[_0x29f6('0x15')](function(_0x6587f3){var _0x41c1b9=fs['readFileSync'](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0x1636f1=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],'server/files/templates/registry.ejs'),_0x29f6('0x5e'));var _0x1ca187=ejs['render'](_0x41c1b9,{'trunks':_0x6587f3||[]});fs[_0x29f6('0x60')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1ca187);if(_0x373cf6[_0x29f6('0x61')]){var _0x5a383f=ejs['render'](_0x1636f1,{'trunks':_0x6587f3||[]});fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x5a383f);}})['then'](function(){return respondWithRpcPromise('Reload','create',{'module':_0x29f6('0x63')});})[_0x29f6('0x15')](function(){var _0x144c76=_0x195887[_0x29f6('0x57')][_0x29f6('0x2c')]({'plain':!![]});if(!_0x144c76)throw new Error(_0x29f6('0x64'));if(_0x144c76[_0x29f6('0x58')]==='user'){var _0x11ef85=_0x373cf6[_0x29f6('0x2c')]({'plain':!![]});return db[_0x29f6('0x59')][_0x29f6('0x51')]({'where':{'name':'Trunks','userProfileId':_0x144c76[_0x29f6('0x65')]},'raw':!![]})[_0x29f6('0x15')](function(_0x32a862){if(_0x32a862&&_0x32a862[_0x29f6('0x5a')]===0x0){return db[_0x29f6('0x2e')]['create']({'name':_0x11ef85[_0x29f6('0x30')],'resourceId':_0x11ef85['id'],'type':_0x32a862[_0x29f6('0x30')],'sectionId':_0x32a862['id']},{})[_0x29f6('0x15')](function(){return _0x373cf6;});}else{return _0x373cf6;}})[_0x29f6('0x1f')](function(_0x4273a3){logger[_0x29f6('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4273a3);throw _0x4273a3;});}return _0x373cf6;})[_0x29f6('0x15')](respondWithResult(_0x536b0c,0xc9))['catch'](handleError(_0x536b0c,null));};exports['update']=function(_0x4f9907,_0x842ae3,_0x5bcf90){var _0x425da2;return db[_0x29f6('0x4b')][_0x29f6('0x51')]({'where':{'id':_0x4f9907[_0x29f6('0x4f')]['id']}})[_0x29f6('0x15')](handleEntityNotFound(_0x842ae3,null))[_0x29f6('0x15')](saveUpdates(_0x4f9907[_0x29f6('0x55')],null))['then'](function(_0x3a23f3){if(_0x3a23f3){_0x425da2=_0x3a23f3;return db['Trunk'][_0x29f6('0x4c')]({'raw':!![]});}})[_0x29f6('0x15')](function(_0x32fa77){if(_0x32fa77){var _0x1d6e32=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0xe14459=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0xa31c7d=ejs[_0x29f6('0x66')](_0x1d6e32,{'trunks':_0x32fa77||[]});fs['writeFileSync'](_0x29f6('0x67'),_0xa31c7d);var _0x57b9fb=ejs[_0x29f6('0x66')](_0xe14459,{'trunks':_0x32fa77||[]});fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x57b9fb);return respondWithRpcPromise(_0x29f6('0x68'),_0x29f6('0x2a'),{'module':_0x29f6('0x63')});}return null;})[_0x29f6('0x15')](function(_0x4203f1){if(_0x4203f1){return _0x425da2;}})[_0x29f6('0x15')](respondWithResult(_0x842ae3,null))[_0x29f6('0x1f')](handleError(_0x842ae3,null));};exports['destroy']=function(_0x1d61ff,_0x4c0acc,_0x16bb3c){var _0x144d8c;return db[_0x29f6('0x4b')][_0x29f6('0x51')]({'where':{'id':_0x1d61ff[_0x29f6('0x4f')]['id']}})[_0x29f6('0x15')](handleEntityNotFound(_0x4c0acc,null))[_0x29f6('0x15')](removeEntity(_0x4c0acc,null))[_0x29f6('0x15')](function(){return db['Trunk'][_0x29f6('0x4c')]({'raw':!![]});})[_0x29f6('0x15')](function(_0x4e185f){var _0x4bb53f=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0x906098=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x69')),_0x29f6('0x5e'));var _0x3f51fa=ejs['render'](_0x4bb53f,{'trunks':_0x4e185f});var _0x4b9631=ejs[_0x29f6('0x66')](_0x906098,{'trunks':_0x4e185f});fs[_0x29f6('0x60')]('/etc/asterisk/sip_xcally_trunks.conf',_0x3f51fa);fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x4b9631);return respondWithRpcPromise(_0x29f6('0x68'),_0x29f6('0x2b'),{'module':_0x29f6('0x63')});})[_0x29f6('0x1f')](handleError(_0x4c0acc,null));}; \ No newline at end of file +var _0x4b84=['omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','create','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','mustache','util','path','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','Trunks','UserProfileResource','stack','name','send','index','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','includeAll','get'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x4b84,0x1cc));var _0x44b8=function(_0x34325b,_0x5e5afe){_0x34325b=_0x34325b-0x0;var _0x3da348=_0x4b84[_0x34325b];return _0x3da348;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];var jayson=require(_0x44b8('0x14'));var client=jayson['client'][_0x44b8('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x490bc6,_0x833ea3,_0x18d642,_0x4df670){return new BPromise(function(_0x63e8f6,_0x4be54c){var _0x54fa95=_0x4df670||client;return _0x54fa95[_0x44b8('0x16')](_0x490bc6,_0x18d642)[_0x44b8('0x17')](function(_0x1722da){logger[_0x44b8('0x18')]('Trunk,\x20%s,\x20%s',_0x833ea3,'request\x20sent');logger['debug'](_0x44b8('0x19'),_0x833ea3,'request\x20sent',JSON[_0x44b8('0x1a')](_0x1722da));if(_0x1722da[_0x44b8('0x1b')]){if(_0x1722da['error'][_0x44b8('0x1c')]===0x1f4){logger[_0x44b8('0x1b')]('Trunk,\x20%s,\x20%s',_0x833ea3,_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);return _0x4be54c(_0x1722da['error'][_0x44b8('0x1d')]);}logger[_0x44b8('0x1b')](_0x44b8('0x1e'),_0x833ea3,_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);return _0x63e8f6(_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);}else{logger[_0x44b8('0x18')](_0x44b8('0x1e'),_0x833ea3,_0x44b8('0x1f'));_0x63e8f6(_0x1722da[_0x44b8('0x20')][_0x44b8('0x1d')]);}})['catch'](function(_0x56549a){logger[_0x44b8('0x1b')](_0x44b8('0x1e'),_0x833ea3,_0x56549a);_0x4be54c(_0x56549a);});});}function respondWithStatusCode(_0x1418db,_0x305a5c){_0x305a5c=_0x305a5c||0xcc;return function(_0x51a34a){if(_0x51a34a){return _0x1418db[_0x44b8('0x21')](_0x305a5c);}return _0x1418db['status'](_0x305a5c)[_0x44b8('0x22')]();};}function respondWithResult(_0x228c81,_0x25a0c1){_0x25a0c1=_0x25a0c1||0xc8;return function(_0x47689e){if(_0x47689e){return _0x228c81[_0x44b8('0x23')](_0x25a0c1)['json'](_0x47689e);}};}function respondWithFilteredResult(_0x474f01,_0x502acf){return function(_0x41d673){if(_0x41d673){var _0x350482=typeof _0x502acf['offset']===_0x44b8('0x24')&&typeof _0x502acf[_0x44b8('0x25')]===_0x44b8('0x24');var _0x59c1bf=_0x41d673[_0x44b8('0x26')];var _0x242342=_0x350482?0x0:_0x502acf['offset'];var _0x2e0174=_0x350482?_0x41d673['count']:_0x502acf[_0x44b8('0x27')]+_0x502acf['limit'];var _0x559f0b;if(_0x2e0174>=_0x59c1bf){_0x2e0174=_0x59c1bf;_0x559f0b=0xc8;}else{_0x559f0b=0xce;}_0x474f01['status'](_0x559f0b);return _0x474f01[_0x44b8('0x28')](_0x44b8('0x29'),_0x242342+'-'+_0x2e0174+'/'+_0x59c1bf)[_0x44b8('0x2a')](_0x41d673);}return null;};}function patchUpdates(_0x1bd1be){return function(_0x38cd17){try{jsonpatch[_0x44b8('0x2b')](_0x38cd17,_0x1bd1be,!![]);}catch(_0x2cf205){return BPromise[_0x44b8('0x2c')](_0x2cf205);}return _0x38cd17[_0x44b8('0x2d')]();};}function saveUpdates(_0x28f918,_0x5e1129){return function(_0x417d81){if(_0x417d81){return _0x417d81[_0x44b8('0x2e')](_0x28f918)['then'](function(_0x261ff2){return _0x261ff2;});}return null;};}function removeEntity(_0x538db7,_0x212983){return function(_0x1652cb){if(_0x1652cb){return _0x1652cb[_0x44b8('0x2f')]()[_0x44b8('0x17')](function(){var _0x1b63a7=_0x1652cb['get']({'plain':!![]});var _0x16b706=_0x44b8('0x30');return db[_0x44b8('0x31')][_0x44b8('0x2f')]({'where':{'type':_0x16b706,'resourceId':_0x1b63a7['id']}})[_0x44b8('0x17')](function(){return _0x1652cb;});})['then'](function(){_0x538db7[_0x44b8('0x23')](0xcc)[_0x44b8('0x22')]();});}};}function handleEntityNotFound(_0x1a30fc,_0x3e93af){return function(_0x140a79){if(!_0x140a79){_0x1a30fc[_0x44b8('0x21')](0x194);}return _0x140a79;};}function handleError(_0x2e8b88,_0x14a9d7){_0x14a9d7=_0x14a9d7||0x1f4;return function(_0x28c10d){logger[_0x44b8('0x1b')](_0x28c10d[_0x44b8('0x32')]);if(_0x28c10d[_0x44b8('0x33')]){delete _0x28c10d[_0x44b8('0x33')];}_0x2e8b88[_0x44b8('0x23')](_0x14a9d7)[_0x44b8('0x34')](_0x28c10d);};}exports[_0x44b8('0x35')]=function(_0x323c50,_0xeff999){var _0x28faa9={},_0x3984f8={},_0x2c02d6={'count':0x0,'rows':[]};var _0x282345=_['map'](db[_0x44b8('0x36')][_0x44b8('0x37')],function(_0x4fcfa0){return{'name':_0x4fcfa0[_0x44b8('0x38')],'type':_0x4fcfa0[_0x44b8('0x39')][_0x44b8('0x3a')]};});_0x3984f8[_0x44b8('0x3b')]=_['map'](_0x282345,_0x44b8('0x33'));_0x3984f8[_0x44b8('0x3c')]=_[_0x44b8('0x3d')](_0x323c50[_0x44b8('0x3c')]);_0x3984f8[_0x44b8('0x3e')]=_[_0x44b8('0x3f')](_0x3984f8[_0x44b8('0x3b')],_0x3984f8[_0x44b8('0x3c')]);_0x28faa9[_0x44b8('0x40')]=_[_0x44b8('0x3f')](_0x3984f8[_0x44b8('0x3b')],qs[_0x44b8('0x41')](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x41')]));_0x28faa9[_0x44b8('0x40')]=_0x28faa9[_0x44b8('0x40')]['length']?_0x28faa9[_0x44b8('0x40')]:_0x3984f8[_0x44b8('0x3b')];if(!_0x323c50[_0x44b8('0x3c')]['hasOwnProperty'](_0x44b8('0x42'))){_0x28faa9[_0x44b8('0x25')]=qs[_0x44b8('0x25')](_0x323c50['query'][_0x44b8('0x25')]);_0x28faa9[_0x44b8('0x27')]=qs[_0x44b8('0x27')](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x27')]);}_0x28faa9['order']=qs['sort'](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x43')]);_0x28faa9[_0x44b8('0x44')]=qs[_0x44b8('0x3e')](_[_0x44b8('0x45')](_0x323c50[_0x44b8('0x3c')],_0x3984f8[_0x44b8('0x3e')]),_0x282345);if(_0x323c50[_0x44b8('0x3c')][_0x44b8('0x46')]){_0x28faa9[_0x44b8('0x44')]=_[_0x44b8('0x47')](_0x28faa9[_0x44b8('0x44')],{'$or':_[_0x44b8('0x48')](_0x282345,function(_0x1236c7){if(_0x1236c7[_0x44b8('0x39')]!==_0x44b8('0x49')){var _0xce06dc={};_0xce06dc[_0x1236c7[_0x44b8('0x33')]]={'$like':'%'+_0x323c50[_0x44b8('0x3c')]['filter']+'%'};return _0xce06dc;}})});}_0x28faa9=_['merge']({},_0x28faa9,_0x323c50[_0x44b8('0x4a')]);var _0x1df74b={'where':_0x28faa9[_0x44b8('0x44')]};return db[_0x44b8('0x36')][_0x44b8('0x26')](_0x1df74b)[_0x44b8('0x17')](function(_0x411ed6){_0x2c02d6['count']=_0x411ed6;if(_0x323c50[_0x44b8('0x3c')]['includeAll']){_0x28faa9[_0x44b8('0x4b')]=[{'all':!![]}];}return db[_0x44b8('0x36')][_0x44b8('0x4c')](_0x28faa9);})[_0x44b8('0x17')](function(_0x103d57){_0x2c02d6[_0x44b8('0x4d')]=_0x103d57;return _0x2c02d6;})['then'](respondWithFilteredResult(_0xeff999,_0x28faa9))[_0x44b8('0x4e')](handleError(_0xeff999,null));};exports[_0x44b8('0x4f')]=function(_0x10602c,_0x25d266){var _0x4ccc77={'raw':![],'where':{'id':_0x10602c[_0x44b8('0x50')]['id']}},_0x4e4ed1={};_0x4e4ed1[_0x44b8('0x3b')]=_[_0x44b8('0x3d')](db[_0x44b8('0x36')][_0x44b8('0x37')]);_0x4e4ed1['query']=_[_0x44b8('0x3d')](_0x10602c[_0x44b8('0x3c')]);_0x4e4ed1[_0x44b8('0x3e')]=_[_0x44b8('0x3f')](_0x4e4ed1[_0x44b8('0x3b')],_0x4e4ed1['query']);_0x4ccc77['attributes']=_[_0x44b8('0x3f')](_0x4e4ed1['model'],qs[_0x44b8('0x41')](_0x10602c['query'][_0x44b8('0x41')]));_0x4ccc77[_0x44b8('0x40')]=_0x4ccc77[_0x44b8('0x40')][_0x44b8('0x51')]?_0x4ccc77[_0x44b8('0x40')]:_0x4e4ed1[_0x44b8('0x3b')];if(_0x10602c[_0x44b8('0x3c')]['includeAll']){_0x4ccc77[_0x44b8('0x4b')]=[{'all':!![]}];}_0x4ccc77=_[_0x44b8('0x47')]({},_0x4ccc77,_0x10602c[_0x44b8('0x4a')]);return db['Trunk'][_0x44b8('0x52')](_0x4ccc77)[_0x44b8('0x17')](handleEntityNotFound(_0x25d266,null))[_0x44b8('0x17')](respondWithResult(_0x25d266,null))[_0x44b8('0x4e')](handleError(_0x25d266,null));};exports['clone']=function(_0x399d6b,_0x308f7b){var _0x4a6e55={'where':{'id':_0x399d6b[_0x44b8('0x50')]['id']}},_0x3de425={};_0x3de425[_0x44b8('0x3b')]=_[_0x44b8('0x3d')](db[_0x44b8('0x36')]['rawAttributes']);_0x4a6e55['attributes']=_[_0x44b8('0x3f')](_0x3de425[_0x44b8('0x3b')],qs[_0x44b8('0x41')](_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x41')]));_0x4a6e55[_0x44b8('0x40')]=_0x4a6e55[_0x44b8('0x40')][_0x44b8('0x51')]?_0x4a6e55[_0x44b8('0x40')]:_0x3de425[_0x44b8('0x3b')];if(_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x53')]){_0x4a6e55['include']=[{'all':!![]}];}_0x4a6e55=_[_0x44b8('0x47')]({},_0x4a6e55,_0x399d6b[_0x44b8('0x4a')]);return db[_0x44b8('0x36')][_0x44b8('0x52')](_0x4a6e55)[_0x44b8('0x17')](handleEntityNotFound(_0x308f7b,null))[_0x44b8('0x17')](function(_0x426a6a){if(_0x426a6a){var _0x172ff3=_0x426a6a[_0x44b8('0x54')]({'plain':!![]});_0x172ff3=qs[_0x44b8('0x55')](_0x172ff3,['id',_0x44b8('0x56'),_0x44b8('0x57')]);_0x399d6b[_0x44b8('0x58')]=_[_0x44b8('0x55')](_0x399d6b[_0x44b8('0x58')],['id',_0x44b8('0x56'),_0x44b8('0x57')]);return db[_0x44b8('0x36')]['create'](_[_0x44b8('0x47')](_0x172ff3,_0x399d6b[_0x44b8('0x58')]),{'include':_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x53')]?[{'all':!![]}]:undefined})[_0x44b8('0x17')](function(_0x29ed5d){var _0x2ecf65=_0x399d6b['user'][_0x44b8('0x54')]({'plain':!![]});if(!_0x2ecf65)throw new Error(_0x44b8('0x59'));if(_0x2ecf65['role']===_0x44b8('0x5a')){var _0x3354bd=_0x29ed5d['get']({'plain':!![]});var _0x37e42e=_0x44b8('0x30');return db[_0x44b8('0x5b')]['find']({'where':{'name':_0x37e42e,'userProfileId':_0x2ecf65[_0x44b8('0x5c')]},'raw':!![]})['then'](function(_0x36cdd8){if(_0x36cdd8&&_0x36cdd8['autoAssociation']===0x0){return db[_0x44b8('0x31')][_0x44b8('0x5d')]({'name':_0x3354bd[_0x44b8('0x33')],'resourceId':_0x3354bd['id'],'type':_0x36cdd8[_0x44b8('0x33')],'sectionId':_0x36cdd8['id']},{})[_0x44b8('0x17')](function(){return _0x29ed5d;});}else{return _0x29ed5d;}})[_0x44b8('0x4e')](function(_0x4c7edd){logger[_0x44b8('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c7edd);throw _0x4c7edd;});}return _0x29ed5d;});}})[_0x44b8('0x17')](respondWithResult(_0x308f7b,0xc9))[_0x44b8('0x4e')](handleError(_0x308f7b,null));};exports['create']=function(_0x3f9438,_0x1ee26b,_0x1cf31f){var _0x30d60f;return db[_0x44b8('0x36')][_0x44b8('0x5d')](_0x3f9438[_0x44b8('0x58')],{'raw':!![]})[_0x44b8('0x17')](function(_0x3f9102){_0x30d60f=_0x3f9102;return db[_0x44b8('0x36')][_0x44b8('0x4c')]({'raw':!![]});})[_0x44b8('0x17')](function(_0x52381a){var _0xd20d0=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],_0x44b8('0x60')),_0x44b8('0x61'));var _0x5bff09=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config[_0x44b8('0x62')],_0x44b8('0x63')),_0x44b8('0x61'));var _0x59060b=ejs[_0x44b8('0x64')](_0xd20d0,{'trunks':_0x52381a||[]});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x59060b);if(_0x30d60f[_0x44b8('0x67')]){var _0x2e02d7=ejs[_0x44b8('0x64')](_0x5bff09,{'trunks':_0x52381a||[]});fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x2e02d7);}})['then'](function(){return respondWithRpcPromise(_0x44b8('0x69'),_0x44b8('0x5d'),{'module':_0x44b8('0x6a')});})[_0x44b8('0x17')](function(){var _0x5b26e8=_0x3f9438['user']['get']({'plain':!![]});if(!_0x5b26e8)throw new Error(_0x44b8('0x59'));if(_0x5b26e8[_0x44b8('0x6b')]===_0x44b8('0x5a')){var _0x46e20f=_0x30d60f[_0x44b8('0x54')]({'plain':!![]});return db['UserProfileSection'][_0x44b8('0x52')]({'where':{'name':'Trunks','userProfileId':_0x5b26e8[_0x44b8('0x5c')]},'raw':!![]})[_0x44b8('0x17')](function(_0xea2c3e){if(_0xea2c3e&&_0xea2c3e['autoAssociation']===0x0){return db['UserProfileResource'][_0x44b8('0x5d')]({'name':_0x46e20f[_0x44b8('0x33')],'resourceId':_0x46e20f['id'],'type':_0xea2c3e[_0x44b8('0x33')],'sectionId':_0xea2c3e['id']},{})['then'](function(){return _0x30d60f;});}else{return _0x30d60f;}})[_0x44b8('0x4e')](function(_0x36f217){logger[_0x44b8('0x1b')](_0x44b8('0x6c'),_0x36f217);throw _0x36f217;});}return _0x30d60f;})[_0x44b8('0x17')](respondWithResult(_0x1ee26b,0xc9))['catch'](handleError(_0x1ee26b,null));};exports[_0x44b8('0x2e')]=function(_0x1888f8,_0xbbdab9,_0x2a8ccc){var _0x220f1b;return db['Trunk'][_0x44b8('0x52')]({'where':{'id':_0x1888f8[_0x44b8('0x50')]['id']}})[_0x44b8('0x17')](handleEntityNotFound(_0xbbdab9,null))[_0x44b8('0x17')](saveUpdates(_0x1888f8[_0x44b8('0x58')],null))[_0x44b8('0x17')](function(_0x1c7ef2){if(_0x1c7ef2){_0x220f1b=_0x1c7ef2;return db['Trunk'][_0x44b8('0x4c')]({'raw':!![]});}})[_0x44b8('0x17')](function(_0x4c3fea){if(_0x4c3fea){var _0x3bb7d8=fs[_0x44b8('0x5e')](path['join'](config[_0x44b8('0x62')],'server/files/templates/trunk.ejs'),'utf8');var _0x31d3b6=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0x36334a=ejs[_0x44b8('0x64')](_0x3bb7d8,{'trunks':_0x4c3fea||[]});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x36334a);var _0x1a5621=ejs[_0x44b8('0x64')](_0x31d3b6,{'trunks':_0x4c3fea||[]});fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x1a5621);return respondWithRpcPromise('Reload',_0x44b8('0x2e'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x55f4e4){if(_0x55f4e4){return _0x220f1b;}})[_0x44b8('0x17')](respondWithResult(_0xbbdab9,null))['catch'](handleError(_0xbbdab9,null));};exports[_0x44b8('0x2f')]=function(_0x1e37fd,_0x268e1e,_0x306793){var _0x3a9780;return db[_0x44b8('0x36')][_0x44b8('0x52')]({'where':{'id':_0x1e37fd[_0x44b8('0x50')]['id']}})['then'](handleEntityNotFound(_0x268e1e,null))[_0x44b8('0x17')](removeEntity(_0x268e1e,null))[_0x44b8('0x17')](function(){return db[_0x44b8('0x36')][_0x44b8('0x4c')]({'raw':!![]});})[_0x44b8('0x17')](function(_0xee44b3){var _0x10034d=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],'server/files/templates/trunk.ejs'),_0x44b8('0x61'));var _0x553aa9=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config[_0x44b8('0x62')],'server/files/templates/registry.ejs'),'utf8');var _0x4b22e7=ejs[_0x44b8('0x64')](_0x10034d,{'trunks':_0xee44b3});var _0x4860af=ejs[_0x44b8('0x64')](_0x553aa9,{'trunks':_0xee44b3});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x4b22e7);fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x4860af);return respondWithRpcPromise(_0x44b8('0x69'),_0x44b8('0x2f'),{'module':_0x44b8('0x6a')});})[_0x44b8('0x4e')](handleError(_0x268e1e,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 3166683..2cacc47 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 _0x3272=['../../config/environment','./trunk.attributes','tools_trunks','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x272dc5,_0x161199){var _0x2f62c4=function(_0x250a04){while(--_0x250a04){_0x272dc5['push'](_0x272dc5['shift']());}};_0x2f62c4(++_0x161199);}(_0x3272,0x14d));var _0x2327=function(_0x406265,_0x5c8abc){_0x406265=_0x406265-0x0;var _0x153b4c=_0x3272[_0x406265];return _0x153b4c;};'use strict';var _=require('lodash');var util=require(_0x2327('0x0'));var logger=require(_0x2327('0x1'))(_0x2327('0x2'));var moment=require(_0x2327('0x3'));var BPromise=require(_0x2327('0x4'));var rp=require(_0x2327('0x5'));var fs=require('fs');var path=require(_0x2327('0x6'));var rimraf=require(_0x2327('0x7'));var config=require(_0x2327('0x8'));var attributes=require(_0x2327('0x9'));module['exports']=function(_0x488028,_0x565dd8){return _0x488028['define']('Trunk',attributes,{'tableName':_0x2327('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa0e3=['tools_trunks','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./trunk.attributes','define','Trunk'];(function(_0x6f3957,_0x5cf071){var _0x20e1d5=function(_0x15a1f8){while(--_0x15a1f8){_0x6f3957['push'](_0x6f3957['shift']());}};_0x20e1d5(++_0x5cf071);}(_0xa0e3,0xbc));var _0x3a0e=function(_0x5a6e2e,_0x32d439){_0x5a6e2e=_0x5a6e2e-0x0;var _0x2221c1=_0xa0e3[_0x5a6e2e];return _0x2221c1;};'use strict';var _=require(_0x3a0e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3a0e('0x1'));var moment=require(_0x3a0e('0x2'));var BPromise=require(_0x3a0e('0x3'));var rp=require(_0x3a0e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3a0e('0x5'));var config=require(_0x3a0e('0x6'));var attributes=require(_0x3a0e('0x7'));module['exports']=function(_0x122a80,_0x59deb4){return _0x122a80[_0x3a0e('0x8')](_0x3a0e('0x9'),attributes,{'tableName':_0x3a0e('0xa'),'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 bd28280..2646cd1 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 _0xd366=['map','include','stringify','catch','ShowTrunk','find','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','model'];(function(_0x2499a4,_0x24ab91){var _0x27cff1=function(_0x2ca926){while(--_0x2ca926){_0x2499a4['push'](_0x2499a4['shift']());}};_0x27cff1(++_0x24ab91);}(_0xd366,0x14a));var _0x6d36=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xd366[_0x487b0c];return _0x1adbdc;};'use strict';var _=require('lodash');var util=require(_0x6d36('0x0'));var moment=require(_0x6d36('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d36('0x2'));var db=require(_0x6d36('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6d36('0x4'))(_0x6d36('0x5'));var config=require(_0x6d36('0x6'));var jayson=require(_0x6d36('0x7'));var client=jayson[_0x6d36('0x8')][_0x6d36('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a35e7,_0x6ca156,_0x243b8f){return new BPromise(function(_0x49c091,_0x4f94bb){return client[_0x6d36('0xa')](_0x5a35e7,_0x243b8f)[_0x6d36('0xb')](function(_0x5cb336){logger[_0x6d36('0xc')](_0x6d36('0xd'),_0x6ca156,_0x6d36('0xe'));logger[_0x6d36('0xf')](_0x6d36('0x10'),_0x6ca156,_0x6d36('0xe'),JSON['stringify'](_0x5cb336));if(_0x5cb336[_0x6d36('0x11')]){if(_0x5cb336[_0x6d36('0x11')][_0x6d36('0x12')]===0x1f4){logger[_0x6d36('0x11')](_0x6d36('0xd'),_0x6ca156,_0x5cb336[_0x6d36('0x11')][_0x6d36('0x13')]);return _0x4f94bb(_0x5cb336[_0x6d36('0x11')][_0x6d36('0x13')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x6ca156,_0x5cb336[_0x6d36('0x11')]['message']);return _0x49c091(_0x5cb336[_0x6d36('0x11')][_0x6d36('0x13')]);}else{logger['info'](_0x6d36('0xd'),_0x6ca156,_0x6d36('0xe'));_0x49c091(_0x5cb336[_0x6d36('0x14')][_0x6d36('0x13')]);}})['catch'](function(_0x57f34d){logger[_0x6d36('0x11')](_0x6d36('0xd'),_0x6ca156,_0x57f34d);_0x4f94bb(_0x57f34d);});});}exports[_0x6d36('0x15')]=function(_0x5eeeb9){var _0x54cb6c=this;return new Promise(function(_0x267c12,_0x5e9810){return db[_0x6d36('0x16')][_0x6d36('0x17')]({'raw':_0x5eeeb9[_0x6d36('0x18')]?_0x5eeeb9['options'][_0x6d36('0x19')]===undefined?!![]:![]:!![],'where':_0x5eeeb9['options']?_0x5eeeb9[_0x6d36('0x18')][_0x6d36('0x1a')]||null:null,'attributes':_0x5eeeb9[_0x6d36('0x18')]?_0x5eeeb9['options'][_0x6d36('0x1b')]||null:null,'limit':_0x5eeeb9[_0x6d36('0x18')]?_0x5eeeb9[_0x6d36('0x18')][_0x6d36('0x1c')]||null:null,'include':_0x5eeeb9[_0x6d36('0x18')]?_0x5eeeb9[_0x6d36('0x18')]['include']?_['map'](_0x5eeeb9[_0x6d36('0x18')]['include'],function(_0x44d6d8){return{'model':db[_0x44d6d8[_0x6d36('0x1d')]],'as':_0x44d6d8['as'],'attributes':_0x44d6d8[_0x6d36('0x1b')],'include':_0x44d6d8['include']?_[_0x6d36('0x1e')](_0x44d6d8[_0x6d36('0x1f')],function(_0x182433){return{'model':db[_0x182433['model']],'as':_0x182433['as'],'attributes':_0x182433[_0x6d36('0x1b')],'include':_0x182433[_0x6d36('0x1f')]?_[_0x6d36('0x1e')](_0x182433['include'],function(_0x4806a8){return{'model':db[_0x4806a8[_0x6d36('0x1d')]],'as':_0x4806a8['as'],'attributes':_0x4806a8[_0x6d36('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6d36('0xb')](function(_0x42b1a2){logger[_0x6d36('0xc')](_0x6d36('0x15'),_0x5eeeb9);logger[_0x6d36('0xf')]('GetTrunk',_0x5eeeb9,JSON[_0x6d36('0x20')](_0x42b1a2));_0x267c12(_0x42b1a2);})[_0x6d36('0x21')](function(_0xd43caa){logger[_0x6d36('0x11')](_0x6d36('0x15'),_0xd43caa[_0x6d36('0x13')],_0x5eeeb9);_0x5e9810(_0x54cb6c[_0x6d36('0x11')](0x1f4,_0xd43caa['message']));});});};exports[_0x6d36('0x22')]=function(_0x3ab94d){var _0x13e412=this;return new Promise(function(_0x2198c9,_0x5f4bb6){return db['Trunk'][_0x6d36('0x23')]({'raw':_0x3ab94d[_0x6d36('0x18')]?_0x3ab94d[_0x6d36('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3ab94d[_0x6d36('0x18')]?_0x3ab94d[_0x6d36('0x18')][_0x6d36('0x1a')]||null:null,'attributes':_0x3ab94d[_0x6d36('0x18')]?_0x3ab94d[_0x6d36('0x18')]['attributes']||null:null,'include':_0x3ab94d['options']?_0x3ab94d[_0x6d36('0x18')][_0x6d36('0x1f')]?_['map'](_0x3ab94d[_0x6d36('0x18')]['include'],function(_0x36f893){return{'model':db[_0x36f893[_0x6d36('0x1d')]],'as':_0x36f893['as'],'attributes':_0x36f893[_0x6d36('0x1b')],'include':_0x36f893['include']?_[_0x6d36('0x1e')](_0x36f893[_0x6d36('0x1f')],function(_0x449d50){return{'model':db[_0x449d50[_0x6d36('0x1d')]],'as':_0x449d50['as'],'attributes':_0x449d50[_0x6d36('0x1b')],'include':_0x449d50[_0x6d36('0x1f')]?_['map'](_0x449d50['include'],function(_0x1713c1){return{'model':db[_0x1713c1[_0x6d36('0x1d')]],'as':_0x1713c1['as'],'attributes':_0x1713c1[_0x6d36('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6d36('0xb')](function(_0x1ab3ac){logger['info'](_0x6d36('0x22'),_0x3ab94d);logger[_0x6d36('0xf')](_0x6d36('0x22'),_0x3ab94d,JSON[_0x6d36('0x20')](_0x1ab3ac));_0x2198c9(_0x1ab3ac);})[_0x6d36('0x21')](function(_0x5173e6){logger[_0x6d36('0x11')](_0x6d36('0x22'),_0x5173e6[_0x6d36('0x13')],_0x3ab94d);_0x5f4bb6(_0x13e412[_0x6d36('0x11')](0x1f4,_0x5173e6['message']));});});}; \ No newline at end of file +var _0x1a75=['then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetTrunk','Trunk','options','raw','attributes','limit','include','map','model','stringify','ShowTrunk','where','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1a75,0xa3));var _0x51a7=function(_0x54788d,_0x12e4ad){_0x54788d=_0x54788d-0x0;var _0x4acd4e=_0x1a75[_0x54788d];return _0x4acd4e;};'use strict';var _=require(_0x51a7('0x0'));var util=require('util');var moment=require(_0x51a7('0x1'));var BPromise=require(_0x51a7('0x2'));var rs=require(_0x51a7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x51a7('0x4'))['db'];var utils=require(_0x51a7('0x5'));var logger=require(_0x51a7('0x6'))(_0x51a7('0x7'));var config=require('../../config/environment');var jayson=require(_0x51a7('0x8'));var client=jayson[_0x51a7('0x9')][_0x51a7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a6a01,_0x2eacdc,_0x43590c){return new BPromise(function(_0x3e1aa3,_0xb73d3e){return client[_0x51a7('0xb')](_0x4a6a01,_0x43590c)[_0x51a7('0xc')](function(_0x5660cf){logger[_0x51a7('0xd')](_0x51a7('0xe'),_0x2eacdc,_0x51a7('0xf'));logger[_0x51a7('0x10')](_0x51a7('0x11'),_0x2eacdc,_0x51a7('0xf'),JSON['stringify'](_0x5660cf));if(_0x5660cf[_0x51a7('0x12')]){if(_0x5660cf[_0x51a7('0x12')][_0x51a7('0x13')]===0x1f4){logger['error'](_0x51a7('0xe'),_0x2eacdc,_0x5660cf[_0x51a7('0x12')][_0x51a7('0x14')]);return _0xb73d3e(_0x5660cf['error']['message']);}logger[_0x51a7('0x12')](_0x51a7('0xe'),_0x2eacdc,_0x5660cf['error'][_0x51a7('0x14')]);return _0x3e1aa3(_0x5660cf[_0x51a7('0x12')][_0x51a7('0x14')]);}else{logger[_0x51a7('0xd')](_0x51a7('0xe'),_0x2eacdc,_0x51a7('0xf'));_0x3e1aa3(_0x5660cf[_0x51a7('0x15')][_0x51a7('0x14')]);}})[_0x51a7('0x16')](function(_0x289485){logger[_0x51a7('0x12')](_0x51a7('0xe'),_0x2eacdc,_0x289485);_0xb73d3e(_0x289485);});});}exports[_0x51a7('0x17')]=function(_0x5a9bcb){var _0x372f23=this;return new Promise(function(_0x542892,_0x4ae048){return db[_0x51a7('0x18')]['findAll']({'raw':_0x5a9bcb['options']?_0x5a9bcb[_0x51a7('0x19')][_0x51a7('0x1a')]===undefined?!![]:![]:!![],'where':_0x5a9bcb['options']?_0x5a9bcb[_0x51a7('0x19')]['where']||null:null,'attributes':_0x5a9bcb[_0x51a7('0x19')]?_0x5a9bcb[_0x51a7('0x19')][_0x51a7('0x1b')]||null:null,'limit':_0x5a9bcb[_0x51a7('0x19')]?_0x5a9bcb[_0x51a7('0x19')][_0x51a7('0x1c')]||null:null,'include':_0x5a9bcb[_0x51a7('0x19')]?_0x5a9bcb[_0x51a7('0x19')][_0x51a7('0x1d')]?_[_0x51a7('0x1e')](_0x5a9bcb[_0x51a7('0x19')][_0x51a7('0x1d')],function(_0x1d6b1c){return{'model':db[_0x1d6b1c['model']],'as':_0x1d6b1c['as'],'attributes':_0x1d6b1c['attributes'],'include':_0x1d6b1c[_0x51a7('0x1d')]?_[_0x51a7('0x1e')](_0x1d6b1c[_0x51a7('0x1d')],function(_0x511471){return{'model':db[_0x511471['model']],'as':_0x511471['as'],'attributes':_0x511471[_0x51a7('0x1b')],'include':_0x511471[_0x51a7('0x1d')]?_['map'](_0x511471[_0x51a7('0x1d')],function(_0x1ec87a){return{'model':db[_0x1ec87a[_0x51a7('0x1f')]],'as':_0x1ec87a['as'],'attributes':_0x1ec87a[_0x51a7('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x51a7('0xc')](function(_0xfc7784){logger[_0x51a7('0xd')](_0x51a7('0x17'),_0x5a9bcb);logger[_0x51a7('0x10')]('GetTrunk',_0x5a9bcb,JSON[_0x51a7('0x20')](_0xfc7784));_0x542892(_0xfc7784);})['catch'](function(_0x27224c){logger[_0x51a7('0x12')](_0x51a7('0x17'),_0x27224c['message'],_0x5a9bcb);_0x4ae048(_0x372f23[_0x51a7('0x12')](0x1f4,_0x27224c['message']));});});};exports[_0x51a7('0x21')]=function(_0x38b9be){var _0x4ada0b=this;return new Promise(function(_0x4c4ba7,_0x2af8b1){return db[_0x51a7('0x18')]['find']({'raw':_0x38b9be[_0x51a7('0x19')]?_0x38b9be['options'][_0x51a7('0x1a')]===undefined?!![]:![]:!![],'where':_0x38b9be[_0x51a7('0x19')]?_0x38b9be[_0x51a7('0x19')][_0x51a7('0x22')]||null:null,'attributes':_0x38b9be[_0x51a7('0x19')]?_0x38b9be[_0x51a7('0x19')][_0x51a7('0x1b')]||null:null,'include':_0x38b9be['options']?_0x38b9be['options']['include']?_['map'](_0x38b9be[_0x51a7('0x19')][_0x51a7('0x1d')],function(_0xf0c5f){return{'model':db[_0xf0c5f[_0x51a7('0x1f')]],'as':_0xf0c5f['as'],'attributes':_0xf0c5f[_0x51a7('0x1b')],'include':_0xf0c5f[_0x51a7('0x1d')]?_[_0x51a7('0x1e')](_0xf0c5f[_0x51a7('0x1d')],function(_0x4dd2e7){return{'model':db[_0x4dd2e7[_0x51a7('0x1f')]],'as':_0x4dd2e7['as'],'attributes':_0x4dd2e7[_0x51a7('0x1b')],'include':_0x4dd2e7[_0x51a7('0x1d')]?_[_0x51a7('0x1e')](_0x4dd2e7['include'],function(_0x2d0718){return{'model':db[_0x2d0718[_0x51a7('0x1f')]],'as':_0x2d0718['as'],'attributes':_0x2d0718[_0x51a7('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x51a7('0xc')](function(_0x3047cd){logger[_0x51a7('0xd')]('ShowTrunk',_0x38b9be);logger[_0x51a7('0x10')](_0x51a7('0x21'),_0x38b9be,JSON[_0x51a7('0x20')](_0x3047cd));_0x4c4ba7(_0x3047cd);})[_0x51a7('0x16')](function(_0x2fb77f){logger[_0x51a7('0x12')]('ShowTrunk',_0x2fb77f['message'],_0x38b9be);_0x2af8b1(_0x4ada0b['error'](0x1f4,_0x2fb77f[_0x51a7('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 2d11e26..e3d8a65 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 _0xcfcb=['Router','../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated','update','exports'];(function(_0x187057,_0x535ffd){var _0x43820f=function(_0x49a279){while(--_0x49a279){_0x187057['push'](_0x187057['shift']());}};_0x43820f(++_0x535ffd);}(_0xcfcb,0xc0));var _0xbcfc=function(_0x296453,_0x219c2a){_0x296453=_0x296453-0x0;var _0x37b596=_0xcfcb[_0x296453];return _0x37b596;};'use strict';var express=require('express');var router=express[_0xbcfc('0x0')]();var auth=require(_0xbcfc('0x1'));var controller=require(_0xbcfc('0x2'));router[_0xbcfc('0x3')](_0xbcfc('0x4'),auth[_0xbcfc('0x5')](),controller[_0xbcfc('0x6')]);module[_0xbcfc('0x7')]=router; \ No newline at end of file +var _0xc662=['express','Router','./user-setting.controller','/:id','isAuthenticated','update','exports'];(function(_0x140849,_0x108e56){var _0x2e50a8=function(_0x3ef503){while(--_0x3ef503){_0x140849['push'](_0x140849['shift']());}};_0x2e50a8(++_0x108e56);}(_0xc662,0x1c0));var _0x2c66=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xc662[_0x1ddedd];return _0xa3e1ac;};'use strict';var express=require(_0x2c66('0x0'));var router=express[_0x2c66('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x2c66('0x2'));router['put'](_0x2c66('0x3'),auth[_0x2c66('0x4')](),controller[_0x2c66('0x5')]);module[_0x2c66('0x6')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index d0773f3..a659536 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 _0x8b07=['DATE','UserId','sequelize','error','warning','info','ENUM','BOOLEAN','TEXT'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x8b07,0x158));var _0x78b0=function(_0x2133df,_0x13cd29){_0x2133df=_0x2133df-0x0;var _0x17af94=_0x8b07[_0x2133df];return _0x17af94;};'use strict';var Sequelize=require(_0x78b0('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x78b0('0x1'),_0x78b0('0x2'),_0x78b0('0x3'),'debug'];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x78b0('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x78b0('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x78b0('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x78b0('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0x78b0('0x8')}}; \ No newline at end of file +var _0x1178=['sequelize','info','debug','exports','ENUM','error','BOOLEAN','DATE','INTEGER','UserId'];(function(_0x5490b4,_0x3a4ffd){var _0x3e8e46=function(_0x2efdee){while(--_0x2efdee){_0x5490b4['push'](_0x5490b4['shift']());}};_0x3e8e46(++_0x3a4ffd);}(_0x1178,0xf0));var _0x8117=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1178[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x8117('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error','warning',_0x8117('0x1'),_0x8117('0x2')];module[_0x8117('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0x8117('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x8117('0x5'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x8117('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x8117('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x8117('0x8')],'unique':_0x8117('0x9')}}; \ 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 a044b22..8be50c5 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 _0x6ce9=['sendStatus','error','stack','name','send','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','lodash','ioredis','../../config/logger','../../mysqldb','redis','./user-setting.socket','register','localhost','status','json','update','then'];(function(_0x12e7cb,_0x5c66e0){var _0x59d202=function(_0x14bd04){while(--_0x14bd04){_0x12e7cb['push'](_0x12e7cb['shift']());}};_0x59d202(++_0x5c66e0);}(_0x6ce9,0x76));var _0x96ce=function(_0x129254,_0x5e26af){_0x129254=_0x129254-0x0;var _0x2a0488=_0x6ce9[_0x129254];return _0x2a0488;};'use strict';var _=require(_0x96ce('0x0'));var Redis=require(_0x96ce('0x1'));var logger=require(_0x96ce('0x2'))('api');var config=require('../../config/environment');var db=require(_0x96ce('0x3'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x96ce('0x4')]));require(_0x96ce('0x5'))[_0x96ce('0x6')](socket);config[_0x96ce('0x4')]=_['defaults'](config[_0x96ce('0x4')],{'host':_0x96ce('0x7'),'port':0x18eb});function respondWithResult(_0x1a24c7,_0x569a40){_0x569a40=_0x569a40||0xc8;return function(_0x1abd8c){if(_0x1abd8c){return _0x1a24c7[_0x96ce('0x8')](_0x569a40)[_0x96ce('0x9')](_0x1abd8c);}};}function saveUpdates(_0x4a7278){return function(_0x4b4ba8){if(_0x4b4ba8){return _0x4b4ba8[_0x96ce('0xa')](_0x4a7278)[_0x96ce('0xb')](function(_0x19d1c2){return _0x19d1c2;});}return null;};}function handleEntityNotFound(_0x296e57){return function(_0x150f93){if(!_0x150f93){_0x296e57[_0x96ce('0xc')](0x194);}return _0x150f93;};}function handleError(_0x45711e,_0x897942){_0x897942=_0x897942||0x1f4;return function(_0x1e3c4a){logger[_0x96ce('0xd')](_0x1e3c4a[_0x96ce('0xe')]);if(_0x1e3c4a['name']){delete _0x1e3c4a[_0x96ce('0xf')];}_0x45711e[_0x96ce('0x8')](_0x897942)[_0x96ce('0x10')](_0x1e3c4a);};}exports['update']=function(_0x1743b3,_0x37bc3a){if(_0x1743b3[_0x96ce('0x11')][_0x96ce('0x12')]!==_0x96ce('0x13'))throw new Error(_0x96ce('0x14'));if(isNaN(Number(_0x1743b3[_0x96ce('0x15')]['id'])))throw new Error(_0x96ce('0x16'));return db[_0x96ce('0x17')][_0x96ce('0x18')]({'where':{'id':_0x1743b3[_0x96ce('0x15')]['id']}})[_0x96ce('0xb')](handleEntityNotFound(_0x37bc3a,null))[_0x96ce('0xb')](saveUpdates(_0x1743b3[_0x96ce('0x19')],null))[_0x96ce('0xb')](respondWithResult(_0x37bc3a,null))['catch'](handleError(_0x37bc3a,null));}; \ No newline at end of file +var _0xd82a=['update','then','sendStatus','error','name','status','user','role','admin','params','UserSetting','find','body','catch','lodash','ioredis','../../config/logger','api','../../mysqldb','redis','./user-setting.socket','register','defaults','localhost','json'];(function(_0x43432a,_0x4d1703){var _0x4d50a5=function(_0x33aa47){while(--_0x33aa47){_0x43432a['push'](_0x43432a['shift']());}};_0x4d50a5(++_0x4d1703);}(_0xd82a,0xbd));var _0xad82=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0xd82a[_0x2d34d6];return _0x1d3d12;};'use strict';var _=require(_0xad82('0x0'));var Redis=require(_0xad82('0x1'));var logger=require(_0xad82('0x2'))(_0xad82('0x3'));var config=require('../../config/environment');var db=require(_0xad82('0x4'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xad82('0x5')]));require(_0xad82('0x6'))[_0xad82('0x7')](socket);config[_0xad82('0x5')]=_[_0xad82('0x8')](config[_0xad82('0x5')],{'host':_0xad82('0x9'),'port':0x18eb});function respondWithResult(_0x45b835,_0x3cd50f){_0x3cd50f=_0x3cd50f||0xc8;return function(_0x2d37c8){if(_0x2d37c8){return _0x45b835['status'](_0x3cd50f)[_0xad82('0xa')](_0x2d37c8);}};}function saveUpdates(_0x1c55bb){return function(_0x1d0720){if(_0x1d0720){return _0x1d0720[_0xad82('0xb')](_0x1c55bb)[_0xad82('0xc')](function(_0x3dcbdd){return _0x3dcbdd;});}return null;};}function handleEntityNotFound(_0x3d4823){return function(_0x1d5b0d){if(!_0x1d5b0d){_0x3d4823[_0xad82('0xd')](0x194);}return _0x1d5b0d;};}function handleError(_0x1e3aa4,_0x1650b4){_0x1650b4=_0x1650b4||0x1f4;return function(_0x2f8efb){logger[_0xad82('0xe')](_0x2f8efb['stack']);if(_0x2f8efb[_0xad82('0xf')]){delete _0x2f8efb['name'];}_0x1e3aa4[_0xad82('0x10')](_0x1650b4)['send'](_0x2f8efb);};}exports[_0xad82('0xb')]=function(_0xd8239d,_0xaaf129){if(_0xd8239d[_0xad82('0x11')][_0xad82('0x12')]!==_0xad82('0x13'))throw new Error('Unauthorized');if(isNaN(Number(_0xd8239d[_0xad82('0x14')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0xad82('0x15')][_0xad82('0x16')]({'where':{'id':_0xd8239d[_0xad82('0x14')]['id']}})[_0xad82('0xc')](handleEntityNotFound(_0xaaf129,null))[_0xad82('0xc')](saveUpdates(_0xd8239d[_0xad82('0x17')],null))[_0xad82('0xc')](respondWithResult(_0xaaf129,null))[_0xad82('0x18')](handleError(_0xaaf129,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 34c0066..482f6bd 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 _0x0340=['hasOwnProperty','hook','exports','events','../../mysqldb','UserSetting','setMaxListeners','update','remove','emit'];(function(_0x41a785,_0x2a6ffa){var _0x56f35d=function(_0x5199d4){while(--_0x5199d4){_0x41a785['push'](_0x41a785['shift']());}};_0x56f35d(++_0x2a6ffa);}(_0x0340,0xad));var _0x0034=function(_0x19e0c3,_0x236526){_0x19e0c3=_0x19e0c3-0x0;var _0x5840b0=_0x0340[_0x19e0c3];return _0x5840b0;};'use strict';var EventEmitter=require(_0x0034('0x0'));var UserSetting=require(_0x0034('0x1'))['db'][_0x0034('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x0034('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0034('0x4'),'afterDestroy':_0x0034('0x5')};function emitEvent(_0x159dfa){return function(_0x49ac32,_0x356b7f,_0x3ef155){UserSettingEvents[_0x0034('0x6')](_0x159dfa+':'+_0x49ac32['id'],_0x49ac32);UserSettingEvents[_0x0034('0x6')](_0x159dfa,_0x49ac32);_0x3ef155(null);};}for(var e in events){if(events[_0x0034('0x7')](e)){var event=events[e];UserSetting[_0x0034('0x8')](e,emitEvent(event));}}module[_0x0034('0x9')]=UserSettingEvents; \ No newline at end of file +var _0x3f00=['emit','hasOwnProperty','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x571cfb,_0x177d42){var _0x19111f=function(_0x4ba9cb){while(--_0x4ba9cb){_0x571cfb['push'](_0x571cfb['shift']());}};_0x19111f(++_0x177d42);}(_0x3f00,0x6a));var _0x03f0=function(_0x45494,_0x1040a5){_0x45494=_0x45494-0x0;var _0x2ee547=_0x3f00[_0x45494];return _0x2ee547;};'use strict';var EventEmitter=require(_0x03f0('0x0'));var UserSetting=require(_0x03f0('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x03f0('0x2')](0x0);var events={'afterCreate':_0x03f0('0x3'),'afterUpdate':_0x03f0('0x4'),'afterDestroy':_0x03f0('0x5')};function emitEvent(_0x406934){return function(_0x3a0ede,_0x19ec2e,_0x31342f){UserSettingEvents['emit'](_0x406934+':'+_0x3a0ede['id'],_0x3a0ede);UserSettingEvents[_0x03f0('0x6')](_0x406934,_0x3a0ede);_0x31342f(null);};}for(var e in events){if(events[_0x03f0('0x7')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index f805fee..1de86a0 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 _0x2fe3=['exports','UserSetting','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2fe3,0x87));var _0x32fe=function(_0x220930,_0x405c50){_0x220930=_0x220930-0x0;var _0x6d32d0=_0x2fe3[_0x220930];return _0x6d32d0;};'use strict';var attributes=require(_0x32fe('0x0'));module[_0x32fe('0x1')]=function(_0x4795c6){return _0x4795c6['define'](_0x32fe('0x2'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2f85c0){if(!_0x2f85c0['clientSideLoggingEnabled'])_0x2f85c0['clientSideLoggingEnabledSince']=null;else if(_0x2f85c0[_0x32fe('0x3')]===null)_0x2f85c0[_0x32fe('0x3')]=new Date();}}});}; \ No newline at end of file +var _0xd87e=['exports','define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x540479,_0x340e8e){var _0x532937=function(_0x5e6a3e){while(--_0x5e6a3e){_0x540479['push'](_0x540479['shift']());}};_0x532937(++_0x340e8e);}(_0xd87e,0x1bf));var _0xed87=function(_0x47f8d2,_0x259040){_0x47f8d2=_0x47f8d2-0x0;var _0x5b31bb=_0xd87e[_0x47f8d2];return _0x5b31bb;};'use strict';var attributes=require(_0xed87('0x0'));module[_0xed87('0x1')]=function(_0x4a7ab7){return _0x4a7ab7[_0xed87('0x2')](_0xed87('0x3'),attributes,{'tableName':_0xed87('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5901be){if(!_0x5901be[_0xed87('0x5')])_0x5901be['clientSideLoggingEnabledSince']=null;else if(_0x5901be[_0xed87('0x6')]===null)_0x5901be[_0xed87('0x6')]=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 783c371..d08d06b 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 _0x23b9=['register','user-setting:','remove','update','emit','user-setting:update'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x23b9,0x170));var _0x923b=function(_0x2862eb,_0x398d09){_0x2862eb=_0x2862eb-0x0;var _0x1f3b64=_0x23b9[_0x2862eb];return _0x1f3b64;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=['save',_0x923b('0x0'),_0x923b('0x1')];function createListener(_0x23d724,_0xc5a5b3){return function(_0x47c5e2){_0xc5a5b3[_0x923b('0x2')](_0x23d724,_0x47c5e2);if(_0x23d724===_0x923b('0x3')){_0xc5a5b3['emit']('user-setting:update:user-'+_0x47c5e2['UserId'],_0x47c5e2);}};}exports[_0x923b('0x4')]=function(_0x17ee51){for(var _0x42bfd3=0x0,_0x54804d=events['length'];_0x42bfd3<_0x54804d;_0x42bfd3++){var _0x409a69=events[_0x42bfd3];var _0x5014c0=createListener(_0x923b('0x5')+_0x409a69,_0x17ee51);UserSettingEvents['on'](_0x409a69,_0x5014c0);}}; \ No newline at end of file +var _0x5043=['length','user-setting:','./user-setting.events','save','remove','update','emit','user-setting:update:user-'];(function(_0x5a7481,_0x224a1e){var _0x12d0bb=function(_0x3b597a){while(--_0x3b597a){_0x5a7481['push'](_0x5a7481['shift']());}};_0x12d0bb(++_0x224a1e);}(_0x5043,0x152));var _0x3504=function(_0x1ee1b7,_0x5ee1b4){_0x1ee1b7=_0x1ee1b7-0x0;var _0x564761=_0x5043[_0x1ee1b7];return _0x564761;};'use strict';var UserSettingEvents=require(_0x3504('0x0'));var events=[_0x3504('0x1'),_0x3504('0x2'),_0x3504('0x3')];function createListener(_0x589b02,_0x2a5155){return function(_0xd4a32a){_0x2a5155[_0x3504('0x4')](_0x589b02,_0xd4a32a);if(_0x589b02==='user-setting:update'){_0x2a5155[_0x3504('0x4')](_0x3504('0x5')+_0xd4a32a['UserId'],_0xd4a32a);}};}exports['register']=function(_0x2d6d13){for(var _0x1f4080=0x0,_0x21f91f=events[_0x3504('0x6')];_0x1f4080<_0x21f91f;_0x1f4080++){var _0x4a25fc=events[_0x1f4080];var _0x185899=createListener(_0x3504('0x7')+_0x4a25fc,_0x2d6d13);UserSettingEvents['on'](_0x4a25fc,_0x185899);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 214d37e..ab72c8e 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 _0x21bd=['getPresence','get','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','format','%s-%s','now','originalname','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','/:id','put','/:id/password','delete','/:id/queues','removeQueues','removeTeams','destroy','removeMailInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','/describe','describe','/whoami','whoami'];(function(_0x5ca644,_0x3d2165){var _0x5c87a2=function(_0x3dc7d9){while(--_0x3dc7d9){_0x5ca644['push'](_0x5ca644['shift']());}};_0x5c87a2(++_0x3d2165);}(_0x21bd,0x157));var _0xd21b=function(_0x229fe8,_0x502f24){_0x229fe8=_0x229fe8-0x0;var _0x354ca8=_0x21bd[_0x229fe8];return _0x354ca8;};'use strict';var multer=require(_0xd21b('0x0'));var util=require(_0xd21b('0x1'));var path=require(_0xd21b('0x2'));var timeout=require('connect-timeout');var express=require(_0xd21b('0x3'));var router=express[_0xd21b('0x4')]();var fs_extra=require(_0xd21b('0x5'));var auth=require(_0xd21b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd21b('0x7'));var controller=require('./user.controller');router['get']('/',auth[_0xd21b('0x8')](),controller[_0xd21b('0x9')]);router['get'](_0xd21b('0xa'),auth[_0xd21b('0x8')](),controller[_0xd21b('0xb')]);router['get'](_0xd21b('0xc'),auth[_0xd21b('0x8')](),controller[_0xd21b('0xd')]);router['get']('/presence',auth[_0xd21b('0x8')](),controller[_0xd21b('0xe')]);router[_0xd21b('0xf')]('/:id',auth[_0xd21b('0x8')](),controller['show']);router[_0xd21b('0xf')](_0xd21b('0x10'),controller[_0xd21b('0x11')]);router[_0xd21b('0xf')](_0xd21b('0x12'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x13')]);router['get'](_0xd21b('0x14'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x15')]);router[_0xd21b('0xf')]('/:id/queues',auth[_0xd21b('0x8')](),controller[_0xd21b('0x16')]);router[_0xd21b('0xf')](_0xd21b('0x17'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x18')]);router[_0xd21b('0xf')](_0xd21b('0x19'),auth['isAuthenticated'](),controller[_0xd21b('0x1a')]);router['get']('/:id/recordings',auth[_0xd21b('0x8')](),controller[_0xd21b('0x1b')]);router[_0xd21b('0xf')]('/:id/screen_recordings',auth[_0xd21b('0x8')](),controller[_0xd21b('0x1c')]);router[_0xd21b('0xf')]('/:id/chat/interactions',auth[_0xd21b('0x8')](),controller[_0xd21b('0x1d')]);router[_0xd21b('0xf')](_0xd21b('0x1e'),auth['isAuthenticated'](),controller[_0xd21b('0x1f')]);router[_0xd21b('0xf')]('/:id/mail/interactions',auth[_0xd21b('0x8')](),controller[_0xd21b('0x20')]);router[_0xd21b('0xf')](_0xd21b('0x21'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x22')]);router[_0xd21b('0xf')]('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0xd21b('0x23')]);router[_0xd21b('0xf')]('/:id/whatsapp/interactions',auth[_0xd21b('0x8')](),controller['getWhatsappInteractions']);router['get'](_0xd21b('0x24'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x25')]);router['get'](_0xd21b('0x26'),auth[_0xd21b('0x8')](),controller['getLists']);router[_0xd21b('0xf')](_0xd21b('0x27'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x28')]);router['get'](_0xd21b('0x29'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x2a')]);router[_0xd21b('0xf')]('/:id/fax_accounts',auth[_0xd21b('0x8')](),controller[_0xd21b('0x2b')]);router['get'](_0xd21b('0x2c'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x2d')]);router[_0xd21b('0xf')](_0xd21b('0x2e'),auth[_0xd21b('0x8')](),controller['getOpenchannelAccounts']);router[_0xd21b('0xf')](_0xd21b('0x2f'),auth['isAuthenticated'](),controller[_0xd21b('0x30')]);router['get'](_0xd21b('0x31'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x32')]);router['get'](_0xd21b('0x33'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x34')]);router[_0xd21b('0xf')](_0xd21b('0x35'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x36')]);router[_0xd21b('0xf')](_0xd21b('0x37'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x38')]);router[_0xd21b('0x39')](_0xd21b('0x14'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x3a')]);router[_0xd21b('0x39')]('/',auth[_0xd21b('0x8')](),controller[_0xd21b('0x3b')]);router[_0xd21b('0x39')](_0xd21b('0x3c'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x3d')]);router[_0xd21b('0x39')]('/:id/queues',auth[_0xd21b('0x8')](),controller[_0xd21b('0x3e')]);var upload=multer({'storage':multer[_0xd21b('0x3f')]({'destination':function(_0x2aba60,_0xb9b863,_0x2ca280){_0x2ca280(null,path[_0xd21b('0x40')](config['root'],'server/files/images/'));},'filename':function(_0x393895,_0x4e1b44,_0x46fb9a){_0x46fb9a(null,util[_0xd21b('0x41')](_0xd21b('0x42'),Date[_0xd21b('0x43')](),_0x4e1b44[_0xd21b('0x44')]));}})});router['post'](_0xd21b('0x10'),upload['single'](_0xd21b('0x45')),controller[_0xd21b('0x46')]);router[_0xd21b('0x39')](_0xd21b('0x47'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x48')]);router[_0xd21b('0x39')](_0xd21b('0x49'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x4a')]);router[_0xd21b('0x39')](_0xd21b('0x4b'),auth['isAuthenticated'](),controller[_0xd21b('0x4c')]);router[_0xd21b('0x39')](_0xd21b('0x4d'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x4e')]);router[_0xd21b('0x39')](_0xd21b('0x24'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x4f')]);router[_0xd21b('0x39')](_0xd21b('0x50'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x51')]);router[_0xd21b('0x39')](_0xd21b('0x52'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x53')]);router['post'](_0xd21b('0x54'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x55')]);router[_0xd21b('0x39')](_0xd21b('0x56'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x57')]);router['post']('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0xd21b('0x58')]);router[_0xd21b('0x39')](_0xd21b('0x59'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x5a')]);router[_0xd21b('0x39')](_0xd21b('0x5b'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x5c')]);router[_0xd21b('0x39')]('/:id/mail_accounts',auth['isAuthenticated'](),controller['addMailAccounts']);router['post'](_0xd21b('0x2e'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x5d')]);router[_0xd21b('0x39')](_0xd21b('0x2f'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x5e')]);router[_0xd21b('0x39')](_0xd21b('0x31'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x5f')]);router[_0xd21b('0x39')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0xd21b('0x60')]);router[_0xd21b('0x39')](_0xd21b('0x37'),auth['isAuthenticated'](),controller[_0xd21b('0x61')]);router['put'](_0xd21b('0x62'),auth[_0xd21b('0x8')](),controller['update']);router[_0xd21b('0x63')](_0xd21b('0x64'),auth[_0xd21b('0x8')](),controller['changePassword']);router[_0xd21b('0x65')](_0xd21b('0x66'),auth['isAuthenticated'](),controller[_0xd21b('0x67')]);router[_0xd21b('0x65')](_0xd21b('0x24'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x68')]);router[_0xd21b('0x65')](_0xd21b('0x62'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x69')]);router[_0xd21b('0x65')](_0xd21b('0x50'),auth[_0xd21b('0x8')](),controller['removeChatInteractions']);router[_0xd21b('0x65')]('/:id/mail_interactions',auth[_0xd21b('0x8')](),controller[_0xd21b('0x6a')]);router[_0xd21b('0x65')](_0xd21b('0x54'),auth[_0xd21b('0x8')](),controller['removeFaxInteractions']);router[_0xd21b('0x65')](_0xd21b('0x56'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x6b')]);router[_0xd21b('0x65')](_0xd21b('0x6c'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x6d')]);router['delete'](_0xd21b('0x59'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x6e')]);router[_0xd21b('0x65')](_0xd21b('0x5b'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x6f')]);router[_0xd21b('0x65')](_0xd21b('0x2c'),auth['isAuthenticated'](),controller['removeMailAccounts']);router[_0xd21b('0x65')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0xd21b('0x70')]);router[_0xd21b('0x65')](_0xd21b('0x2f'),auth[_0xd21b('0x8')](),controller['removeSmsAccounts']);router[_0xd21b('0x65')](_0xd21b('0x31'),auth['isAuthenticated'](),controller[_0xd21b('0x71')]);router['delete'](_0xd21b('0x33'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x72')]);router[_0xd21b('0x65')](_0xd21b('0x37'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x73')]);router[_0xd21b('0x39')](_0xd21b('0x74'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x75')]);module[_0xd21b('0x76')]=router; \ No newline at end of file +var _0xa3da=['getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','/:id/api_key','getApiKey','post','/:id/contacts','addContacts','/create_many','join','format','%s-%s','now','single','file','addAvatar','/:id/logout','/:id/pause','pause','unpause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','addFaxAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','update','put','/:id/password','changePassword','delete','removeQueues','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','/:id/messengerSoundNotification','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./user.controller','get','isAuthenticated','/describe','describe','/whoami','whoami','/:id','show','getAvatar','/:id/open_tabs','getOpenTabs','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions'];(function(_0x4cf205,_0xb79c74){var _0x2c3942=function(_0x355b39){while(--_0x355b39){_0x4cf205['push'](_0x4cf205['shift']());}};_0x2c3942(++_0xb79c74);}(_0xa3da,0xb4));var _0xaa3d=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa3da[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xaa3d('0x0'));var timeout=require(_0xaa3d('0x1'));var express=require(_0xaa3d('0x2'));var router=express[_0xaa3d('0x3')]();var fs_extra=require(_0xaa3d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xaa3d('0x5'));var config=require('../../config/environment');var controller=require(_0xaa3d('0x6'));router[_0xaa3d('0x7')]('/',auth[_0xaa3d('0x8')](),controller['index']);router['get'](_0xaa3d('0x9'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0xa')]);router[_0xaa3d('0x7')](_0xaa3d('0xb'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0xc')]);router[_0xaa3d('0x7')]('/presence',auth[_0xaa3d('0x8')](),controller['getPresence']);router[_0xaa3d('0x7')](_0xaa3d('0xd'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0xe')]);router[_0xaa3d('0x7')]('/:id/avatar',controller[_0xaa3d('0xf')]);router[_0xaa3d('0x7')](_0xaa3d('0x10'),auth['isAuthenticated'](),controller[_0xaa3d('0x11')]);router[_0xaa3d('0x7')]('/:id/contacts',auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x12')]);router[_0xaa3d('0x7')](_0xaa3d('0x13'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x14')]);router[_0xaa3d('0x7')](_0xaa3d('0x15'),auth['isAuthenticated'](),controller[_0xaa3d('0x16')]);router[_0xaa3d('0x7')](_0xaa3d('0x17'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x18')]);router[_0xaa3d('0x7')](_0xaa3d('0x19'),auth['isAuthenticated'](),controller['getRecordings']);router['get'](_0xaa3d('0x1a'),auth['isAuthenticated'](),controller[_0xaa3d('0x1b')]);router['get']('/:id/chat/interactions',auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x1c')]);router[_0xaa3d('0x7')](_0xaa3d('0x1d'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x1e')]);router[_0xaa3d('0x7')](_0xaa3d('0x1f'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x20')]);router['get']('/:id/sms/interactions',auth['isAuthenticated'](),controller[_0xaa3d('0x21')]);router['get'](_0xaa3d('0x22'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x23')]);router[_0xaa3d('0x7')](_0xaa3d('0x24'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x25')]);router[_0xaa3d('0x7')](_0xaa3d('0x26'),auth[_0xaa3d('0x8')](),controller['getTeams']);router[_0xaa3d('0x7')]('/:id/lists',auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x27')]);router[_0xaa3d('0x7')](_0xaa3d('0x28'),auth['isAuthenticated'](),controller['getAgents']);router['get'](_0xaa3d('0x29'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x2a')]);router[_0xaa3d('0x7')](_0xaa3d('0x2b'),auth[_0xaa3d('0x8')](),controller['getFaxAccounts']);router[_0xaa3d('0x7')](_0xaa3d('0x2c'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x2d')]);router['get'](_0xaa3d('0x2e'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x2f')]);router[_0xaa3d('0x7')]('/:id/sms_accounts',auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x30')]);router[_0xaa3d('0x7')](_0xaa3d('0x31'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x32')]);router['get'](_0xaa3d('0x33'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x34')]);router['get'](_0xaa3d('0x35'),auth[_0xaa3d('0x8')](),controller['getScheduledCalls']);router[_0xaa3d('0x7')](_0xaa3d('0x36'),auth['isAuthenticated'](),controller[_0xaa3d('0x37')]);router[_0xaa3d('0x38')](_0xaa3d('0x39'),auth['isAuthenticated'](),controller[_0xaa3d('0x3a')]);router['post']('/',auth[_0xaa3d('0x8')](),controller['create']);router[_0xaa3d('0x38')](_0xaa3d('0x3b'),auth[_0xaa3d('0x8')](),controller['bulkCreate']);router[_0xaa3d('0x38')](_0xaa3d('0x13'),auth[_0xaa3d('0x8')](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x7c83a0,_0x255cd4,_0x4e87df){_0x4e87df(null,path[_0xaa3d('0x3c')](config['root'],'server/files/images/'));},'filename':function(_0x1a7062,_0x183393,_0x320649){_0x320649(null,util[_0xaa3d('0x3d')](_0xaa3d('0x3e'),Date[_0xaa3d('0x3f')](),_0x183393['originalname']));}})});router[_0xaa3d('0x38')]('/:id/avatar',upload[_0xaa3d('0x40')](_0xaa3d('0x41')),controller[_0xaa3d('0x42')]);router[_0xaa3d('0x38')]('/:id/login',auth[_0xaa3d('0x8')](),controller['login']);router['post'](_0xaa3d('0x43'),auth['isAuthenticated'](),controller['logout']);router[_0xaa3d('0x38')](_0xaa3d('0x44'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x45')]);router[_0xaa3d('0x38')]('/:id/unpause',auth['isAuthenticated'](),controller[_0xaa3d('0x46')]);router[_0xaa3d('0x38')](_0xaa3d('0x26'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x47')]);router['post']('/:id/chat_interactions',auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x48')]);router[_0xaa3d('0x38')](_0xaa3d('0x49'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x4a')]);router[_0xaa3d('0x38')](_0xaa3d('0x4b'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x4c')]);router[_0xaa3d('0x38')](_0xaa3d('0x4d'),auth['isAuthenticated'](),controller['addSmsInteractions']);router[_0xaa3d('0x38')](_0xaa3d('0x4e'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x4f')]);router[_0xaa3d('0x38')]('/:id/whatsapp_interactions',auth[_0xaa3d('0x8')](),controller['addWhatsappInteractions']);router['post'](_0xaa3d('0x2b'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x50')]);router['post'](_0xaa3d('0x2c'),auth[_0xaa3d('0x8')](),controller['addMailAccounts']);router['post'](_0xaa3d('0x2e'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x51')]);router['post'](_0xaa3d('0x52'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x53')]);router[_0xaa3d('0x38')]('/:id/chat_websites',auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x54')]);router['post'](_0xaa3d('0x33'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x55')]);router[_0xaa3d('0x38')](_0xaa3d('0x36'),auth['isAuthenticated'](),controller[_0xaa3d('0x56')]);router['put']('/:id',auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x57')]);router[_0xaa3d('0x58')](_0xaa3d('0x59'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x5a')]);router[_0xaa3d('0x5b')](_0xaa3d('0x13'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x5c')]);router[_0xaa3d('0x5b')]('/:id/teams',auth[_0xaa3d('0x8')](),controller['removeTeams']);router[_0xaa3d('0x5b')](_0xaa3d('0xd'),auth[_0xaa3d('0x8')](),controller['destroy']);router[_0xaa3d('0x5b')]('/:id/chat_interactions',auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x5d')]);router[_0xaa3d('0x5b')]('/:id/mail_interactions',auth['isAuthenticated'](),controller['removeMailInteractions']);router[_0xaa3d('0x5b')]('/:id/fax_interactions',auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x5e')]);router[_0xaa3d('0x5b')](_0xaa3d('0x4d'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x5f')]);router['delete']('/:id/openchannel_interactions',auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x60')]);router[_0xaa3d('0x5b')](_0xaa3d('0x61'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x62')]);router[_0xaa3d('0x5b')]('/:id/fax_accounts',auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x63')]);router['delete'](_0xaa3d('0x2c'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x64')]);router['delete'](_0xaa3d('0x2e'),auth[_0xaa3d('0x8')](),controller['removeOpenchannelAccounts']);router[_0xaa3d('0x5b')](_0xaa3d('0x52'),auth['isAuthenticated'](),controller[_0xaa3d('0x65')]);router[_0xaa3d('0x5b')]('/:id/chat_websites',auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x66')]);router[_0xaa3d('0x5b')]('/:id/whatsapp_accounts',auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x67')]);router[_0xaa3d('0x5b')](_0xaa3d('0x36'),auth[_0xaa3d('0x8')](),controller['removeApiKey']);router[_0xaa3d('0x38')](_0xaa3d('0x68'),auth[_0xaa3d('0x8')](),controller['messengerSoundNotification']);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 4494d32..1c0de3b 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 _0x1929=['auto','yes','nonat','update','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','wss','encryption','avpf','force_avp','icesupport','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','dtlsenable','/etc/pki/tls/certs/motion.crt','permissions','map','true','false','screenrecording','blocked','sequelize','moment','util','lodash','exports','STRING','setDataValue','name','defaultuser','The\x20name\x20of\x20the\x20user','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','local','INTEGER','accountcode','format','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','friend','user','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband'];(function(_0x164798,_0x29e959){var _0xc5da=function(_0x30e86f){while(--_0x30e86f){_0x164798['push'](_0x164798['shift']());}};_0xc5da(++_0x29e959);}(_0x1929,0xdb));var _0x9192=function(_0x544099,_0x372b30){_0x544099=_0x544099-0x0;var _0x20ab09=_0x1929[_0x544099];return _0x20ab09;};'use strict';var Sequelize=require(_0x9192('0x0'));var moment=require(_0x9192('0x1'));var util=require(_0x9192('0x2'));var _=require(_0x9192('0x3'));module[_0x9192('0x4')]={'name':{'type':Sequelize[_0x9192('0x5')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x6804a4){this[_0x9192('0x6')](_0x9192('0x7'),_0x6804a4);this[_0x9192('0x6')](_0x9192('0x8'),_0x6804a4);},'comment':_0x9192('0x9')},'fullname':{'type':Sequelize[_0x9192('0x5')],'allowNull':![],'set':function(_0x31a426){this[_0x9192('0x6')]('fullname',_0x31a426);this[_0x9192('0x6')]('callerid',util['format'](_0x9192('0xa'),_0x31a426,this[_0x9192('0xb')](_0x9192('0xc'))));}},'alias':{'type':Sequelize[_0x9192('0x5')]},'email':{'type':Sequelize[_0x9192('0x5')],'allowNull':![],'unique':_0x9192('0xd'),'validate':{'isEmail':!![]},'set':function(_0x1ab929){if(_0x1ab929){this['setDataValue'](_0x9192('0xd'),_0x1ab929[_0x9192('0xe')]());}}},'role':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x10'),'user',_0x9192('0x11'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x9192('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x9192('0x5')],'defaultValue':_0x9192('0x12')},'internal':{'type':Sequelize[_0x9192('0x13')](0xb),'allowNull':![],'unique':_0x9192('0xc'),'set':function(_0x31f99b){this['setDataValue'](_0x9192('0xc'),_0x31f99b);this[_0x9192('0x6')](_0x9192('0x14'),_0x31f99b);this['setDataValue']('callerid',util[_0x9192('0x15')](_0x9192('0xa'),this['getDataValue'](_0x9192('0x16')),_0x31f99b));}},'salt':{'type':Sequelize[_0x9192('0x5')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x9192('0x5')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x9192('0x5')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x9192('0x5')]},'online':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x9192('0x18')]},'voicePause':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x9192('0x5')],'defaultValue':_0x9192('0x19')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x9192('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x9192('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x9192('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x9192('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x9192('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x9192('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x9192('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x9192('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x9192('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x9192('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x1a'),_0x9192('0x1b'),_0x9192('0x1c')),'allowNull':!![],'defaultValue':_0x9192('0x1a')},'context':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![],'defaultValue':_0x9192('0x1d')},'callingpres':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x1e'),_0x9192('0x1f'),'ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED',_0x9192('0x20'),_0x9192('0x21'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x9192('0x22'),'set':function(_0x467458){this['setDataValue'](_0x9192('0x23'),_0x467458?_0x467458[_0x9192('0x24')](','):null);},'get':function(){return this[_0x9192('0xb')]('transport')?this[_0x9192('0xb')]('transport')[_0x9192('0x25')](','):null;},'comment':_0x9192('0x26')},'dtmfmode':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x27'),_0x9192('0x28'),'shortinfo',_0x9192('0x29'),_0x9192('0x2a')),'allowNull':!![],'defaultValue':_0x9192('0x27')},'directmedia':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no',_0x9192('0x2c'),_0x9192('0x2d'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x9192('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x9192('0x2e'),'set':function(_0x42ee2e){this[_0x9192('0x6')](_0x9192('0x2f'),_0x42ee2e?_0x42ee2e[_0x9192('0x24')](','):null);},'get':function(){return this[_0x9192('0xb')]('nat')?this[_0x9192('0xb')](_0x9192('0x2f'))[_0x9192('0x25')](','):null;},'comment':_0x9192('0x30')},'callgroup':{'type':Sequelize[_0x9192('0x5')]},'namedcallgroup':{'type':Sequelize[_0x9192('0x5')]},'pickupgroup':{'type':Sequelize[_0x9192('0x5')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x9192('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x9192('0x5')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9192('0x31')},'allow':{'type':Sequelize[_0x9192('0x5')],'allowNull':![],'defaultValue':_0x9192('0x32'),'set':function(_0x18ebc5){this[_0x9192('0x6')]('allow',_0x18ebc5?_0x18ebc5['join'](';'):_0x9192('0x32'));},'get':function(){return this[_0x9192('0xb')](_0x9192('0x33'))?this[_0x9192('0xb')](_0x9192('0x33'))[_0x9192('0x25')](';'):null;},'comment':_0x9192('0x34')},'autoframing':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![],'set':function(_0x4388e2){this['setDataValue'](_0x9192('0x35'),_0x4388e2?_0x4388e2[_0x9192('0x24')](','):null);},'get':function(){return this[_0x9192('0xb')](_0x9192('0x35'))?this[_0x9192('0xb')]('insecure')[_0x9192('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x9192('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x9192('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x9192('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x9192('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x9192('0x37')},'amaflags':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x9192('0x2b')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no',_0x9192('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x9192('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x39'),_0x9192('0x3a'),_0x9192('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x9192('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x9192('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x3c'),'uas'),'allowNull':!![],'defaultValue':_0x9192('0x3d')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x9192('0x2b')},'keepalive':{'type':Sequelize[_0x9192('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x9192('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x9192('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x9192('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x9192('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no','fingerprint',_0x9192('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x9192('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x9192('0xf')]('active',_0x9192('0x3f'),_0x9192('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x9192('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x9192('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no',_0x9192('0x2c'),'update',_0x9192('0x41')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x9192('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0x9192('0x18')]},'passwordResetAt':{'type':Sequelize[_0x9192('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x9192('0x42')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x55b9be){this[_0x9192('0x6')](_0x9192('0x43'),_0x55b9be);var _0x1709ed=this[_0x9192('0x44')]({'plain':!![]});switch(_0x55b9be){case 0x0:case 0x1:var _0x15c035=_0x1709ed[_0x9192('0x23')]?_['isArray'](_0x1709ed[_0x9192('0x23')])?_0x1709ed[_0x9192('0x23')][_0x9192('0x24')]():_0x1709ed['transport']:_0x9192('0x22');if(_0x15c035===_0x9192('0x45')){_0x15c035=_0x9192('0x22');}this[_0x9192('0x6')]('transport',_0x15c035);this[_0x9192('0x6')](_0x9192('0x46'),'no');this[_0x9192('0x6')](_0x9192('0x47'),null);this['setDataValue'](_0x9192('0x48'),null);this[_0x9192('0x6')](_0x9192('0x49'),null);this[_0x9192('0x6')]('dtlsenable',null);this[_0x9192('0x6')](_0x9192('0x4a'),null);this[_0x9192('0x6')](_0x9192('0x4b'),null);this['setDataValue'](_0x9192('0x4c'),null);this[_0x9192('0x6')](_0x9192('0x4d'),null);this['setDataValue'](_0x9192('0x4e'),'no');break;case 0x2:this['setDataValue'](_0x9192('0x23'),_0x9192('0x45'));this[_0x9192('0x6')]('encryption',_0x9192('0x2b'));this[_0x9192('0x6')](_0x9192('0x47'),_0x9192('0x2b'));this[_0x9192('0x6')]('force_avp','yes');this[_0x9192('0x6')](_0x9192('0x49'),'yes');this['setDataValue'](_0x9192('0x4f'),_0x9192('0x2b'));this[_0x9192('0x6')]('dtlsverify','no');this['setDataValue'](_0x9192('0x4b'),_0x9192('0x40'));this[_0x9192('0x6')](_0x9192('0x4c'),_0x1709ed['dtlscertfile']||_0x9192('0x50'));this[_0x9192('0x6')](_0x9192('0x4d'),_0x1709ed[_0x9192('0x4d')]||'/etc/pki/tls/private/motion.key');this[_0x9192('0x6')]('rtcp_mux',_0x9192('0x2b'));break;default:}}},'permissions':{'type':Sequelize[_0x9192('0x42')],'set':function(_0x455ab2){this[_0x9192('0x6')]('permissions',_0x455ab2?_0x455ab2[_0x9192('0x24')](','):[]);},'get':function(){return this[_0x9192('0xb')](_0x9192('0x51'))?_[_0x9192('0x52')](this[_0x9192('0xb')]('permissions')['split'](','),function(_0x8571a7){return parseInt(_0x8571a7,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x9192('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x9192('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0x9192('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x9192('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x9192('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x9192('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x9192('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x9192('0xb')]('phoneBarEnableScreenRecordingByAgent')?this[_0x9192('0xb')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x9192('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![],'set':function(_0x55041c){if(typeof _0x55041c==='string'){var _0xf657b1=_0x55041c==='1'?!![]:_0x55041c==='0'?![]:_0x55041c===_0x9192('0x53')?!![]:_0x55041c===_0x9192('0x54')?![]:![];this[_0x9192('0x6')](_0x9192('0x55'),_0xf657b1);}else{this[_0x9192('0x6')](_0x9192('0x55'),_0x55041c);}}},'blocked':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![],'set':function(_0x2ba838){this[_0x9192('0x6')](_0x9192('0x56'),_0x2ba838);if(_0x2ba838===!![]){this[_0x9192('0x6')]('blockedAt',moment());this[_0x9192('0x6')]('loginAttempts',0x0);}else{this[_0x9192('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x9192('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x9192('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x9192('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x9192('0x13')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x9192('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x9192('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x9192('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x9192('0x13')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x9192('0x13')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x9192('0x13')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x9192('0x13')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x9192('0x13')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x9192('0x13')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]}}; \ No newline at end of file +var _0xf6ee=['dtlssetup','dtlscertfile','rtcp_mux','wss','encryption','icesupport','dtlsprivatekey','TEXT','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','internal','STRING','email','toLowerCase','admin','user','local','accountcode','\x22%s\x22\x20<%s>','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','yes','nonat','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','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','originate','uac','uas','certificate','active','passive','actpass','update,nonat','showWebBar','get','udp','avpf','force_avp','dtlsenable','dtlsverify'];(function(_0x3bf7f6,_0x307dd0){var _0x383261=function(_0x11f376){while(--_0x11f376){_0x3bf7f6['push'](_0x3bf7f6['shift']());}};_0x383261(++_0x307dd0);}(_0xf6ee,0x18e));var _0xef6e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf6ee[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xef6e('0x0'));var moment=require(_0xef6e('0x1'));var util=require(_0xef6e('0x2'));var _=require('lodash');module[_0xef6e('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xef6e('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x494db2){this[_0xef6e('0x5')](_0xef6e('0x4'),_0x494db2);this[_0xef6e('0x5')](_0xef6e('0x6'),_0x494db2);},'comment':_0xef6e('0x7')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x138624){this[_0xef6e('0x5')](_0xef6e('0x8'),_0x138624);this[_0xef6e('0x5')](_0xef6e('0x9'),util[_0xef6e('0xa')]('\x22%s\x22\x20<%s>',_0x138624,this['getDataValue'](_0xef6e('0xb'))));}},'alias':{'type':Sequelize[_0xef6e('0xc')]},'email':{'type':Sequelize[_0xef6e('0xc')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x288370){if(_0x288370){this[_0xef6e('0x5')](_0xef6e('0xd'),_0x288370[_0xef6e('0xe')]());}}},'role':{'type':Sequelize['ENUM'](_0xef6e('0xf'),_0xef6e('0x10'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xef6e('0xc')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xef6e('0xc')],'defaultValue':_0xef6e('0x11')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xef6e('0xb'),'set':function(_0x445b1a){this[_0xef6e('0x5')]('internal',_0x445b1a);this[_0xef6e('0x5')](_0xef6e('0x12'),_0x445b1a);this[_0xef6e('0x5')](_0xef6e('0x9'),util[_0xef6e('0xa')](_0xef6e('0x13'),this[_0xef6e('0x14')](_0xef6e('0x8')),_0x445b1a));}},'salt':{'type':Sequelize[_0xef6e('0xc')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xef6e('0xc')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xef6e('0xc')]},'userpic':{'type':Sequelize[_0xef6e('0xc')]},'city':{'type':Sequelize[_0xef6e('0xc')]},'country':{'type':Sequelize[_0xef6e('0xc')]},'online':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xef6e('0x16')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xef6e('0xc')],'defaultValue':_0xef6e('0x17')},'lastPauseAt':{'type':Sequelize[_0xef6e('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xef6e('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xef6e('0x18')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xef6e('0x18')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xef6e('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xef6e('0x18')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'host':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![],'defaultValue':_0xef6e('0x19')},'ipaddr':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xef6e('0x18')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xef6e('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x1b'),_0xef6e('0x10'),_0xef6e('0x1c')),'allowNull':!![],'defaultValue':_0xef6e('0x1b')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xef6e('0x1d')},'callingpres':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x1e'),_0xef6e('0x1f'),_0xef6e('0x20'),_0xef6e('0x21'),_0xef6e('0x22'),_0xef6e('0x23'),_0xef6e('0x24'),_0xef6e('0x25')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'transport':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![],'defaultValue':'udp','set':function(_0x100253){this['setDataValue'](_0xef6e('0x26'),_0x100253?_0x100253[_0xef6e('0x27')](','):null);},'get':function(){return this[_0xef6e('0x14')]('transport')?this[_0xef6e('0x14')](_0xef6e('0x26'))[_0xef6e('0x28')](','):null;},'comment':_0xef6e('0x29')},'dtmfmode':{'type':Sequelize[_0xef6e('0x1a')]('rfc2833',_0xef6e('0x2a'),_0xef6e('0x2b'),_0xef6e('0x2c'),_0xef6e('0x2d')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no',_0xef6e('0x2f'),'update',_0xef6e('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'nat':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![],'defaultValue':_0xef6e('0x31'),'set':function(_0x12b1ab){this[_0xef6e('0x5')](_0xef6e('0x32'),_0x12b1ab?_0x12b1ab[_0xef6e('0x27')](','):null);},'get':function(){return this[_0xef6e('0x14')](_0xef6e('0x32'))?this[_0xef6e('0x14')]('nat')[_0xef6e('0x28')](','):null;},'comment':_0xef6e('0x33')},'callgroup':{'type':Sequelize[_0xef6e('0xc')]},'namedcallgroup':{'type':Sequelize[_0xef6e('0xc')]},'pickupgroup':{'type':Sequelize[_0xef6e('0xc')]},'namedpickupgroup':{'type':Sequelize[_0xef6e('0xc')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xef6e('0xc')],'allowNull':![],'defaultValue':_0xef6e('0x34')},'allow':{'type':Sequelize[_0xef6e('0xc')],'allowNull':![],'defaultValue':_0xef6e('0x35'),'set':function(_0x5cd7e5){this['setDataValue']('allow',_0x5cd7e5?_0x5cd7e5[_0xef6e('0x27')](';'):_0xef6e('0x35'));},'get':function(){return this[_0xef6e('0x14')](_0xef6e('0x36'))?this[_0xef6e('0x14')](_0xef6e('0x36'))[_0xef6e('0x28')](';'):null;},'comment':_0xef6e('0x37')},'autoframing':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x45373d){this[_0xef6e('0x5')](_0xef6e('0x38'),_0x45373d?_0x45373d[_0xef6e('0x27')](','):null);},'get':function(){return this['getDataValue'](_0xef6e('0x38'))?this[_0xef6e('0x14')](_0xef6e('0x38'))[_0xef6e('0x28')](','):null;},'comment':_0xef6e('0x39')},'trustrpid':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xef6e('0x1a')]('yes','no',_0xef6e('0x3a')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xef6e('0x2e'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xef6e('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xef6e('0x3b')},'amaflags':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![],'defaultValue':_0xef6e('0x2e')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'template':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0xef6e('0x2e'),'no',_0xef6e('0x3c')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x3d'),'refuse',_0xef6e('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xef6e('0x18')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0xef6e('0x3f'),_0xef6e('0x40')),'allowNull':!![],'defaultValue':_0xef6e('0x40')},'t38pt_usertpsource':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![],'defaultValue':_0xef6e('0x2e')},'keepalive':{'type':Sequelize[_0xef6e('0x18')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xef6e('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xef6e('0x18')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xef6e('0x18')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xef6e('0x18')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xef6e('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xef6e('0x18')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xef6e('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no','fingerprint',_0xef6e('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xef6e('0x18')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x42'),_0xef6e('0x43'),_0xef6e('0x44')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xef6e('0x18')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no',_0xef6e('0x2f'),'update',_0xef6e('0x45')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xef6e('0xc')]},'resetPasswordExpires':{'type':Sequelize[_0xef6e('0x16')]},'passwordResetAt':{'type':Sequelize[_0xef6e('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0xef6e('0x18')],'defaultValue':0x0,'set':function(_0x62a2a9){this[_0xef6e('0x5')](_0xef6e('0x46'),_0x62a2a9);var _0x42fc94=this[_0xef6e('0x47')]({'plain':!![]});switch(_0x62a2a9){case 0x0:case 0x1:var _0x3f71ab=_0x42fc94['transport']?_['isArray'](_0x42fc94['transport'])?_0x42fc94[_0xef6e('0x26')][_0xef6e('0x27')]():_0x42fc94['transport']:'udp';if(_0x3f71ab==='wss'){_0x3f71ab=_0xef6e('0x48');}this[_0xef6e('0x5')](_0xef6e('0x26'),_0x3f71ab);this['setDataValue']('encryption','no');this[_0xef6e('0x5')](_0xef6e('0x49'),null);this[_0xef6e('0x5')](_0xef6e('0x4a'),null);this[_0xef6e('0x5')]('icesupport',null);this[_0xef6e('0x5')](_0xef6e('0x4b'),null);this[_0xef6e('0x5')](_0xef6e('0x4c'),null);this['setDataValue'](_0xef6e('0x4d'),null);this[_0xef6e('0x5')](_0xef6e('0x4e'),null);this[_0xef6e('0x5')]('dtlsprivatekey',null);this[_0xef6e('0x5')](_0xef6e('0x4f'),'no');break;case 0x2:this[_0xef6e('0x5')](_0xef6e('0x26'),_0xef6e('0x50'));this[_0xef6e('0x5')](_0xef6e('0x51'),_0xef6e('0x2e'));this[_0xef6e('0x5')]('avpf',_0xef6e('0x2e'));this['setDataValue'](_0xef6e('0x4a'),_0xef6e('0x2e'));this[_0xef6e('0x5')](_0xef6e('0x52'),_0xef6e('0x2e'));this[_0xef6e('0x5')]('dtlsenable',_0xef6e('0x2e'));this[_0xef6e('0x5')](_0xef6e('0x4c'),'no');this['setDataValue'](_0xef6e('0x4d'),_0xef6e('0x44'));this[_0xef6e('0x5')](_0xef6e('0x4e'),_0x42fc94[_0xef6e('0x4e')]||'/etc/pki/tls/certs/motion.crt');this[_0xef6e('0x5')]('dtlsprivatekey',_0x42fc94[_0xef6e('0x53')]||'/etc/pki/tls/private/motion.key');this[_0xef6e('0x5')](_0xef6e('0x4f'),_0xef6e('0x2e'));break;default:}}},'permissions':{'type':Sequelize[_0xef6e('0x54')],'set':function(_0x141a17){this[_0xef6e('0x5')](_0xef6e('0x55'),_0x141a17?_0x141a17['join'](','):[]);},'get':function(){return this['getDataValue'](_0xef6e('0x55'))?_['map'](this[_0xef6e('0x14')](_0xef6e('0x55'))[_0xef6e('0x28')](','),function(_0x451f1c){return parseInt(_0x451f1c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0xef6e('0xc')]},'phoneBarBusyNumber':{'type':Sequelize[_0xef6e('0xc')]},'phoneBarUnconditional':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xef6e('0x18')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xef6e('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xef6e('0xc')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xef6e('0x56')],'get':function(){return this[_0xef6e('0x14')](_0xef6e('0x57'))?this['getDataValue'](_0xef6e('0x57')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0xef6e('0xc')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![],'set':function(_0x3621bb){if(typeof _0x3621bb===_0xef6e('0x58')){var _0x4df8dd=_0x3621bb==='1'?!![]:_0x3621bb==='0'?![]:_0x3621bb==='true'?!![]:_0x3621bb===_0xef6e('0x59')?![]:![];this[_0xef6e('0x5')](_0xef6e('0x5a'),_0x4df8dd);}else{this[_0xef6e('0x5')](_0xef6e('0x5a'),_0x3621bb);}}},'blocked':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![],'set':function(_0x33506b){this['setDataValue'](_0xef6e('0x5b'),_0x33506b);if(_0x33506b===!![]){this[_0xef6e('0x5')](_0xef6e('0x5c'),moment());this['setDataValue'](_0xef6e('0x5d'),0x0);}else{this[_0xef6e('0x5')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0xef6e('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xef6e('0x18')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0xef6e('0x5e')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xef6e('0x18')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xef6e('0x18')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xef6e('0x18')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xef6e('0x18')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 09fc134..b7dfad4 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 _0x4da1=['Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','getAssociatedQueues','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getDataValue','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','flattenDeep','removeAgent','Voice','getLists','getAgents','You\x20can\x27t\x20delete\x20yourself','CmHopper','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','removeWhatsappAccounts','getScheduledCalls','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','firstName','lastName','CmContact','Contact','VoiceQueue','getApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','nonce','removeApiKey','apiKeyNonce','API\x20key\x20not\x20available','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','unknown','ringing','teams','queues','inbound','flatten','toString','lower','asc','substring','uniqBy','orderBy','getRealtimeAgents','voiceStatus','unavailable','slice','charAt','toUpperCase','select','field','ui.','InteractionId','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','messengerSoundNotification','enabled','moment','util','lodash','ioredis','jayson/promise','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../errors/api','APINotFoundError','APIForbiddenrror','../../mysqldb','redis','./user.socket','register','localhost','client','http','sendStatus','status','end','json','undefined','count','limit','set','Content-Range','then','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','update','role','agent','userNotification:recalc:','admin','Users','Telephones','telephone','ignore','map','value','includes','name','UserProfileResource','stack','send','User','rawAttributes','type','key','filter','password','salt','previousPasswords','resetPasswordToken','md5secret','index','where','query','includeAll','include','true','UserSetting','userSetting','attributes','push','openTabs','rows','length','dataValues','fax','openchannel','whatsapp','all','show','params','getOptions','merge','find','chat','sms','mail','body','describe','ids','omit','internal','Setting','securePassword','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','sequelize','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','permissions','101','103','104','105','106','107','108','100','111','114','115','create','user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','checkUserLimits','settingsEnabled','userProfileId','Agents','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','findAll','isEmpty','changePassword','oldPassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Sequelize','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','enforcePasswordHistory','validatePasswordPattern','validatePasswordHistory','updatePasswordsHistory','addQueues','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','emit','Queue:save','voice','get','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','channel','isArray','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','server/files/images/logos/default_profile.png','download','existsSync','root','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','FaxOpenTabs','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','tag','getQueues','model','keys','Queue','filters','intersection','sort','pick','options','nolimit','offset','getVoiceQueuesRt','fields','getGroups','findOne','ChatGroup','getRecordings','VoiceRecording','order','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','login','phone','mobile','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','PAUSE','LOGININPAUSE','MemberReport','resolve','logout','destroy','QueuePause','pause','updateAttributes','DEFAULT\x20PAUSE','Channel\x20parameter\x20%s\x20is\x20invalid','chatPause','faxPause','openchannelPause','whatsappPause','pauseType','lastPauseAt','getTeams'];(function(_0x1aa8c0,_0x42894){var _0x13fc1b=function(_0x26dac7){while(--_0x26dac7){_0x1aa8c0['push'](_0x1aa8c0['shift']());}};_0x13fc1b(++_0x42894);}(_0x4da1,0x7e));var _0x14da=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4da1[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require(_0x14da('0x0'));var util=require(_0x14da('0x1'));var path=require('path');var fs=require('fs');var _=require(_0x14da('0x2'));var squel=require('squel');var Redis=require(_0x14da('0x3'));var jayson=require(_0x14da('0x4'));var authService=require(_0x14da('0x5'));var contacts=require(_0x14da('0x6'));var qs=require(_0x14da('0x7'));var rta=require('../../components/realtime/agents');var logger=require(_0x14da('0x8'))(_0x14da('0x9'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x14da('0xa'));var APIBadRequestError=require(_0x14da('0xb'))['APIBadRequestError'];var APINotFoundError=require(_0x14da('0xb'))[_0x14da('0xc')];var APIForbiddenError=require('../../errors/api')[_0x14da('0xd')];var APIHandleError=require(_0x14da('0xb'))['handleError'];var db=require(_0x14da('0xe'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x14da('0xf')]));require(_0x14da('0x10'))[_0x14da('0x11')](socket);config[_0x14da('0xf')]=_['defaults'](config['redis'],{'host':_0x14da('0x12'),'port':0x18eb});var amiClient=jayson[_0x14da('0x13')][_0x14da('0x14')]({'port':0x232a});var values;function respondWithStatusCode(_0x4b3cd3,_0x5dc607){_0x5dc607=_0x5dc607||0xcc;return function(_0x4411c0){if(_0x4411c0){return _0x4b3cd3[_0x14da('0x15')](_0x5dc607);}return _0x4b3cd3[_0x14da('0x16')](_0x5dc607)[_0x14da('0x17')]();};}function respondWithResult(_0x50645e,_0x3ae86a){_0x3ae86a=_0x3ae86a||0xc8;return function(_0x57bd76){if(_0x57bd76){return _0x50645e['status'](_0x3ae86a)[_0x14da('0x18')](_0x57bd76);}};}function respondWithFilteredResult(_0x5ca9b6,_0x1d2e97){return function(_0x360ec){if(_0x360ec){var _0x40e169=typeof _0x1d2e97['offset']===_0x14da('0x19')&&typeof _0x1d2e97['limit']===_0x14da('0x19');var _0x132c8d=_0x360ec[_0x14da('0x1a')];var _0x2d921d=_0x40e169?0x0:_0x1d2e97['offset'];var _0x3341eb=_0x40e169?_0x360ec[_0x14da('0x1a')]:_0x1d2e97['offset']+_0x1d2e97[_0x14da('0x1b')];var _0x5640a7;if(_0x3341eb>=_0x132c8d){_0x3341eb=_0x132c8d;_0x5640a7=0xc8;}else{_0x5640a7=0xce;}_0x5ca9b6[_0x14da('0x16')](_0x5640a7);return _0x5ca9b6[_0x14da('0x1c')](_0x14da('0x1d'),_0x2d921d+'-'+_0x3341eb+'/'+_0x132c8d)['json'](_0x360ec);}return null;};}function respondWithRpcPromise(_0x991780,_0x5101a5,_0x545fa0,_0x2d931e){return new Promise(function(_0x5cac98,_0x105117){var _0x12b21e=_0x2d931e||amiClient;return _0x12b21e['request'](_0x991780,_0x545fa0)[_0x14da('0x1e')](function(_0x3a5dcc){logger[_0x14da('0x1f')](_0x14da('0x20'),_0x5101a5,_0x14da('0x21'));logger['debug'](_0x14da('0x22'),_0x5101a5,_0x14da('0x21'),JSON[_0x14da('0x23')](_0x3a5dcc));if(_0x3a5dcc[_0x14da('0x24')]){if(_0x3a5dcc[_0x14da('0x24')][_0x14da('0x25')]===0x1f4){logger[_0x14da('0x24')](_0x14da('0x20'),_0x5101a5,_0x3a5dcc[_0x14da('0x24')]['message']);return _0x105117(_0x3a5dcc[_0x14da('0x24')][_0x14da('0x26')]);}logger[_0x14da('0x24')](_0x14da('0x20'),_0x5101a5,_0x3a5dcc[_0x14da('0x24')][_0x14da('0x26')]);return _0x5cac98(_0x3a5dcc[_0x14da('0x24')][_0x14da('0x26')]);}else{logger[_0x14da('0x1f')]('User,\x20%s,\x20%s',_0x5101a5,_0x14da('0x21'));_0x5cac98(_0x3a5dcc[_0x14da('0x27')][_0x14da('0x26')]);}})[_0x14da('0x28')](function(_0x3515d1){logger[_0x14da('0x24')](_0x14da('0x20'),_0x5101a5,_0x3515d1);_0x105117(_0x3515d1);});});}function saveUpdates(_0x4b7112){return function(_0x3f9850){if(_0x3f9850){return _0x3f9850[_0x14da('0x29')](_0x4b7112)[_0x14da('0x1e')](function(_0x116b07){if(_0x116b07[_0x14da('0x2a')]===_0x14da('0x2b')){socket['emit'](_0x14da('0x2c')+_0x116b07['id'],_0x116b07);}return _0x116b07;});}return null;};}function removeEntity(_0x5d6021,_0x10ca45){return function(_0x449a1c){if(_0x449a1c){return _0x449a1c['destroy']({'transaction':_0x10ca45})[_0x14da('0x1e')](function(){var _0x54aaa0=_0x449a1c['get']({'plain':!![]});if(_0x54aaa0[_0x14da('0x2a')]===_0x14da('0x2d'))return;var _0x277f9d=[{'name':_0x14da('0x2e'),'value':'user','ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':_0x14da('0x2f'),'value':_0x14da('0x30'),'ignore':![]}];var _0x4f8caf=_(_0x277f9d)['filter'](_0x14da('0x31'))[_0x14da('0x32')](_0x14da('0x33'))[_0x14da('0x33')]();if(_[_0x14da('0x34')](_0x4f8caf,_0x54aaa0['role'])){return;}var _0x2b0604=_['find'](_0x277f9d,[_0x14da('0x33'),_0x54aaa0[_0x14da('0x2a')]])[_0x14da('0x35')];return db[_0x14da('0x36')]['destroy']({'where':{'type':_0x2b0604,'resourceId':_0x54aaa0['id']},'transaction':_0x10ca45})[_0x14da('0x1e')](function(){return _0x449a1c;});})[_0x14da('0x1e')](function(){_0x5d6021['status'](0xcc)[_0x14da('0x17')]();});}};}function handleEntityNotFound(_0x20c44b){return function(_0x5c3541){if(!_0x5c3541){_0x20c44b[_0x14da('0x15')](0x194);}return _0x5c3541;};}function handleError(_0x38b01b,_0x14cbcb){_0x14cbcb=_0x14cbcb||0x1f4;return function(_0x428fcc){logger[_0x14da('0x24')](_0x428fcc[_0x14da('0x37')]);if(_0x428fcc[_0x14da('0x35')]){delete _0x428fcc[_0x14da('0x35')];}_0x38b01b[_0x14da('0x16')](_0x14cbcb)[_0x14da('0x38')](_0x428fcc);};}function getUserAttributes(){return _(db[_0x14da('0x39')][_0x14da('0x3a')])[_0x14da('0x32')](function(_0x5d4615){return{'name':_0x5d4615['fieldName'],'type':_0x5d4615[_0x14da('0x3b')][_0x14da('0x3c')]};})[_0x14da('0x3d')](function(_0xd40b85){return![_0x14da('0x3e'),_0x14da('0x3f'),_0x14da('0x40'),_0x14da('0x41'),'resetPasswordExpires',_0x14da('0x42')][_0x14da('0x34')](_0xd40b85[_0x14da('0x35')]);})[_0x14da('0x33')]();}exports[_0x14da('0x43')]=function(_0x313732,_0x530a2f){var _0xc5624c={},_0x33bd92={'count':0x0,'rows':[]};var _0xb7e202=getUserAttributes();_0xc5624c=qs['getOptions'](_0xb7e202,_0x313732);var _0x2a98b5={'where':_0xc5624c[_0x14da('0x44')]};return db[_0x14da('0x39')][_0x14da('0x1a')](_0x2a98b5)[_0x14da('0x1e')](function(_0x1c009c){_0x33bd92[_0x14da('0x1a')]=_0x1c009c;if(_0x313732[_0x14da('0x45')][_0x14da('0x46')]){_0xc5624c[_0x14da('0x47')]=[{'all':!![]}];}if(_0x313732[_0x14da('0x45')]['userSetting']===_0x14da('0x48')){_0xc5624c[_0x14da('0x47')]=[{'model':db[_0x14da('0x49')],'as':_0x14da('0x4a')}];}if(!_['includes'](_0xc5624c['attributes'],'id')){_0xc5624c[_0x14da('0x4b')][_0x14da('0x4c')]('id');}return db[_0x14da('0x39')]['findAll'](_0xc5624c);})['then'](function(_0x5092b1){_0x33bd92['rows']=_0x5092b1;if(_0x313732[_0x14da('0x45')][_0x14da('0x4d')]===_0x14da('0x48')){var _0x252eb5=[];for(var _0xe4de59=0x0;_0xe4de59<_0x33bd92[_0x14da('0x4e')][_0x14da('0x4f')];_0xe4de59++){_0x252eb5[_0x14da('0x4c')](get_open_tabs('chat',_0x33bd92['rows'][_0xe4de59][_0x14da('0x50')]));_0x252eb5[_0x14da('0x4c')](get_open_tabs('sms',_0x33bd92[_0x14da('0x4e')][_0xe4de59]['dataValues']));_0x252eb5[_0x14da('0x4c')](get_open_tabs(_0x14da('0x51'),_0x33bd92[_0x14da('0x4e')][_0xe4de59][_0x14da('0x50')]));_0x252eb5[_0x14da('0x4c')](get_open_tabs('mail',_0x33bd92[_0x14da('0x4e')][_0xe4de59]['dataValues']));_0x252eb5[_0x14da('0x4c')](get_open_tabs(_0x14da('0x52'),_0x33bd92[_0x14da('0x4e')][_0xe4de59][_0x14da('0x50')]));_0x252eb5[_0x14da('0x4c')](get_open_tabs(_0x14da('0x53'),_0x33bd92[_0x14da('0x4e')][_0xe4de59][_0x14da('0x50')]));}return Promise[_0x14da('0x54')](_0x252eb5)[_0x14da('0x1e')](function(){return _0x33bd92;});}else{return _0x33bd92;}})[_0x14da('0x1e')](respondWithFilteredResult(_0x530a2f,_0xc5624c))['catch'](handleError(_0x530a2f,null));};exports[_0x14da('0x55')]=function(_0x4480fc,_0x34c915){var _0x78bc5c=getUserAttributes();_0x4480fc[_0x14da('0x45')]['id']=_0x4480fc[_0x14da('0x56')]['id'];var _0x13bef0=qs[_0x14da('0x57')](_0x78bc5c,_0x4480fc);if(_0x4480fc['query'][_0x14da('0x46')]){_0x13bef0[_0x14da('0x47')]=[{'all':!![]}];}if(_0x4480fc[_0x14da('0x45')]['userSetting']==='true'){_0x13bef0[_0x14da('0x47')]=[{'model':db[_0x14da('0x49')],'as':_0x14da('0x4a')}];}_0x13bef0=_[_0x14da('0x58')]({},_0x13bef0,_0x4480fc['options']);if(!_[_0x14da('0x34')](_0x13bef0[_0x14da('0x4b')],'id')){_0x13bef0['attributes']['push']('id');}return db['User'][_0x14da('0x59')](_0x13bef0)[_0x14da('0x1e')](handleEntityNotFound(_0x34c915,null))[_0x14da('0x1e')](function(_0x1130b6){var _0x138b8f=[];values=_0x1130b6;if(_0x4480fc['query'][_0x14da('0x4d')]===_0x14da('0x48')){_0x138b8f['push'](get_open_tabs(_0x14da('0x5a'),_0x1130b6[_0x14da('0x50')]));_0x138b8f[_0x14da('0x4c')](get_open_tabs(_0x14da('0x5b'),_0x1130b6[_0x14da('0x50')]));_0x138b8f[_0x14da('0x4c')](get_open_tabs(_0x14da('0x52'),_0x1130b6['dataValues']));_0x138b8f[_0x14da('0x4c')](get_open_tabs(_0x14da('0x53'),_0x1130b6['dataValues']));_0x138b8f['push'](get_open_tabs(_0x14da('0x51'),_0x1130b6['dataValues']));_0x138b8f[_0x14da('0x4c')](get_open_tabs(_0x14da('0x5c'),_0x1130b6[_0x14da('0x50')]));return Promise[_0x14da('0x54')](_0x138b8f);}else{return values;}})[_0x14da('0x1e')](function(){return values;})['then'](respondWithResult(_0x34c915,null))[_0x14da('0x28')](handleError(_0x34c915,null));};exports[_0x14da('0x29')]=function(_0x470563,_0x5129f4){if(_0x470563[_0x14da('0x5d')]['id']){delete _0x470563['body']['id'];}delete _0x470563['body'][_0x14da('0x2a')];return db['User'][_0x14da('0x59')]({'where':{'id':_0x470563[_0x14da('0x56')]['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0x5129f4,null))[_0x14da('0x1e')](saveUpdates(_0x470563[_0x14da('0x5d')],null))['then'](respondWithResult(_0x5129f4,null))[_0x14da('0x28')](handleError(_0x5129f4,null));};exports[_0x14da('0x5e')]=function(_0x27e4ee,_0x379ed3){return db[_0x14da('0x39')][_0x14da('0x5e')]()[_0x14da('0x1e')](respondWithResult(_0x379ed3,null))[_0x14da('0x28')](handleError(_0x379ed3,null));};exports['addContacts']=function(_0x35e121,_0x3808c6){return db[_0x14da('0x39')][_0x14da('0x59')]({'where':{'id':_0x35e121[_0x14da('0x56')]['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0x3808c6,null))[_0x14da('0x1e')](function(_0x1dc648){if(_0x1dc648){return _0x1dc648['addContacts'](_0x35e121['body'][_0x14da('0x5f')],_[_0x14da('0x60')](_0x35e121[_0x14da('0x5d')],[_0x14da('0x5f'),'id'])||{});}})[_0x14da('0x1e')](respondWithResult(_0x3808c6,null))['catch'](handleError(_0x3808c6,null));};function validateUser(_0x2a8bef){return new Promise(function(_0x21f075,_0x314f44){if(_0x2a8bef[_0x14da('0x61')])return _0x21f075(_0x2a8bef);return db[_0x14da('0x62')]['findById'](0x1)[_0x14da('0x1e')](function(_0x443871){if(_0x443871[_0x14da('0x63')])authService['validatePasswordPattern'](_0x2a8bef['password']);db[_0x14da('0x39')]['max']('internal')[_0x14da('0x1e')](function(_0x31cf0b){if(_[_0x14da('0x64')](_0x31cf0b)){_0x2a8bef[_0x14da('0x61')]=_0x443871[_0x14da('0x65')]||0x1;return;}if(_[_0x14da('0x64')](_0x443871[_0x14da('0x65')])||_0x443871['min_internal']===_0x31cf0b){_0x2a8bef[_0x14da('0x61')]=_0x31cf0b+0x1;return;}if(_0x443871['min_internal']>_0x31cf0b){_0x2a8bef[_0x14da('0x61')]=_0x443871[_0x14da('0x65')];return;}return db['sequelize'][_0x14da('0x45')](_0x14da('0x66'),{'type':db[_0x14da('0x67')][_0x14da('0x68')][_0x14da('0x69')]})[_0x14da('0x1e')](function(_0x482d72){if(_0x482d72&&_0x482d72[_0x14da('0x4f')]){for(var _0x304347=0x0,_0x53ed2f=_0x482d72[_0x14da('0x4f')];_0x304347<_0x53ed2f&&_[_0x14da('0x64')](_0x2a8bef[_0x14da('0x61')]);_0x304347++){if(_0x443871[_0x14da('0x65')]<=_0x482d72[_0x304347][_0x14da('0x6a')]){_0x2a8bef[_0x14da('0x61')]=_0x482d72[_0x304347][_0x14da('0x6a')];}else if(_0x443871[_0x14da('0x65')]>_0x482d72[_0x304347][_0x14da('0x6a')]&&_0x443871[_0x14da('0x65')]<=_0x482d72[_0x304347]['to']){_0x2a8bef[_0x14da('0x61')]=_0x443871['min_internal'];}}}if(_[_0x14da('0x64')](_0x2a8bef[_0x14da('0x61')])){_0x2a8bef['internal']=_0x31cf0b+0x1;}return _0x21f075(_0x2a8bef);});});})[_0x14da('0x28')](function(_0x561ffb){_0x314f44(_0x561ffb);});});}function updateUser(_0x5b5794){return new Promise(function(_0x20eb01,_0x2bb2aa){try{if(_0x5b5794[_0x14da('0x6b')]){_0x5b5794[_0x14da('0x6c')]=_0x5b5794[_0x14da('0x61')];_0x5b5794[_0x14da('0x6d')]={'mailbox':_0x5b5794[_0x14da('0x61')],'password':_0x5b5794[_0x14da('0x3e')],'fullname':_0x5b5794[_0x14da('0x6e')],'email':_0x5b5794['email']};}if(_0x5b5794['role']===_0x14da('0x2b')){if(!_0x5b5794[_0x14da('0x6f')])_0x5b5794[_0x14da('0x6f')]=[_0x14da('0x70'),'102',_0x14da('0x71'),'113','110',_0x14da('0x72'),_0x14da('0x73'),_0x14da('0x74'),_0x14da('0x75'),_0x14da('0x76'),'109',_0x14da('0x77'),_0x14da('0x78'),_0x14da('0x79'),_0x14da('0x7a')];}_0x20eb01(_0x5b5794);}catch(_0x4fdd2a){_0x2bb2aa(_0x4fdd2a);}});}exports[_0x14da('0x7b')]=function(_0x4456fc,_0x4bb2b8){if(_0x4456fc['user'][_0x14da('0x2a')]===_0x14da('0x2b'))throw new Error('Unauthorized');if(_0x4456fc['body'][_0x14da('0x2a')]===_0x14da('0x7c')&&_0x4456fc[_0x14da('0x7c')][_0x14da('0x2a')]!==_0x14da('0x2d')){throw new Error(_0x14da('0x7d'));}if(_0x4456fc[_0x14da('0x5d')][_0x14da('0x2a')]===_0x14da('0x2d')&&_0x4456fc['user'][_0x14da('0x2a')]!==_0x14da('0x2d')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x14da('0x7e')]([_0x4456fc[_0x14da('0x5d')]])[_0x14da('0x1e')](function(){return validateUser(_0x4456fc[_0x14da('0x5d')]);})[_0x14da('0x1e')](function(_0xf6ae99){return updateUser(_0xf6ae99)['then'](function(_0x263dd){if(_0x263dd['role']===_0x14da('0x2d')){_0x263dd[_0x14da('0x7f')]=_0x4456fc[_0x14da('0x7c')][_0x14da('0x7f')];delete _0x263dd[_0x14da('0x80')];}return _0x263dd;});})['then'](function(_0x4c62a7){return db['User'][_0x14da('0x7b')](_0x4c62a7,{'include':[{'model':db[_0x14da('0x6d')],'as':_0x14da('0x6d')}]});})[_0x14da('0x1e')](function(_0x528c59){if(_0x4456fc['body'][_0x14da('0x2a')]==='user')return _0x528c59;if(_0x4456fc[_0x14da('0x7c')][_0x14da('0x2a')]!==_0x14da('0x7c'))return _0x528c59;return db['UserProfileSection']['find']({'where':{'name':_0x528c59[_0x14da('0x2a')]===_0x14da('0x2b')?_0x14da('0x81'):'Telephones','userProfileId':_0x4456fc[_0x14da('0x7c')][_0x14da('0x80')]},'raw':!![]})[_0x14da('0x1e')](function(_0x59d541){if(!_0x59d541||_0x59d541[_0x14da('0x82')]!=0x0)return _0x528c59;return db[_0x14da('0x36')][_0x14da('0x7b')]({'name':_0x528c59['name'],'resourceId':_0x528c59['id'],'type':_0x59d541[_0x14da('0x35')],'sectionId':_0x59d541['id']},{})[_0x14da('0x1e')](function(){return _0x528c59;});})[_0x14da('0x28')](function(_0x12d4bf){logger[_0x14da('0x24')](_0x14da('0x83'),_0x12d4bf);throw _0x12d4bf;});})['then'](respondWithResult(_0x4bb2b8,0xc9))[_0x14da('0x28')](handleError(_0x4bb2b8,null));};exports[_0x14da('0x84')]=function(_0x2725f8,_0x4a8512){var _0x5dcc2e=_0x2725f8[_0x14da('0x5d')];var _0x355812=[];if(_0x2725f8['user'][_0x14da('0x2a')]===_0x14da('0x2b'))throw new Error(_0x14da('0x85'));if(_[_0x14da('0x86')](_0x5dcc2e,['role',_0x14da('0x7c')])&&_0x2725f8['user']['role']!==_0x14da('0x2d')){throw new Error(_0x14da('0x7d'));}if(_[_0x14da('0x86')](_0x5dcc2e,[_0x14da('0x2a'),_0x14da('0x2d')])&&_0x2725f8[_0x14da('0x7c')][_0x14da('0x2a')]!==_0x14da('0x2d')){throw new Error(_0x14da('0x87'));}return licenseUtil[_0x14da('0x7e')](_0x5dcc2e)[_0x14da('0x1e')](function(){return validateUser(_0x5dcc2e[0x0]);})[_0x14da('0x1e')](function(){for(var _0x534970=0x1;_0x534970<_0x5dcc2e[_0x14da('0x4f')];_0x534970++){var _0x396f45=_0x5dcc2e[_0x534970-0x1][_0x14da('0x61')];if(!_0x5dcc2e[_0x534970][_0x14da('0x61')])_0x5dcc2e[_0x534970][_0x14da('0x61')]=_0x396f45+0x1;_0x355812[_0x14da('0x4c')](validateUser(_0x5dcc2e[_0x534970]));}return Promise[_0x14da('0x54')](_0x355812);})[_0x14da('0x1e')](function(){_0x355812=[];for(var _0x465a9a=0x0;_0x465a9a<_0x5dcc2e[_0x14da('0x4f')];_0x465a9a++){_0x355812[_0x14da('0x4c')](updateUser(_0x5dcc2e[_0x465a9a]));}return Promise[_0x14da('0x54')](_0x355812);})[_0x14da('0x1e')](function(){_0x355812=_0x5dcc2e[_0x14da('0x32')](function(_0x33a4e6){return db[_0x14da('0x39')]['create'](_0x33a4e6,{'include':[{'model':db['VoiceMail'],'as':_0x14da('0x6d')}]})[_0x14da('0x1e')](function(_0x95bfc){_0x33a4e6['id']=_0x95bfc['id'];return _0x33a4e6;});});return Promise[_0x14da('0x54')](_0x355812);})[_0x14da('0x1e')](function(_0x5a3d01){if(_0x2725f8[_0x14da('0x5d')]['role']===_0x14da('0x7c'))return _0x5a3d01;if(_0x2725f8[_0x14da('0x7c')][_0x14da('0x2a')]!==_0x14da('0x7c'))return _0x5a3d01;var _0x44fd0f=_[_0x14da('0x86')](_0x5a3d01,function(_0x1fda27){return _0x1fda27[_0x14da('0x2a')]==='agent'||_0x1fda27[_0x14da('0x2a')]===_0x14da('0x30');});if(!_0x44fd0f)return _0x5a3d01;return db['UserProfileSection'][_0x14da('0x88')]({'where':{'name':{'$or':[_0x14da('0x81'),'Telephones']},'userProfileId':_0x2725f8[_0x14da('0x7c')][_0x14da('0x80')]},'raw':!![]})[_0x14da('0x1e')](function(_0x10d356){if(_[_0x14da('0x89')](_0x10d356)||!_[_0x14da('0x86')](_0x10d356,[_0x14da('0x82'),0x0]))return _0x5a3d01;_0x355812=[];var _0x14d2b2=_(_0x10d356)[_0x14da('0x32')](function(_0x19db99){if(_0x19db99[_0x14da('0x82')]===0x1)return;return _0x19db99[_0x14da('0x35')]===_0x14da('0x81')?'agent':_0x14da('0x30');})['compact']()[_0x14da('0x33')]();for(var _0x248e45=0x0;_0x248e45<_0x5a3d01[_0x14da('0x4f')];_0x248e45++){if(!_[_0x14da('0x34')](_0x14d2b2,_0x5a3d01[_0x248e45][_0x14da('0x2a')]))return;var _0x4cad3a=_0x5a3d01[_0x248e45][_0x14da('0x2a')]===_0x14da('0x2b')?_0x14da('0x81'):_0x14da('0x2f');_0x355812[_0x14da('0x4c')](db[_0x14da('0x36')][_0x14da('0x7b')]({'name':_0x5a3d01[_0x248e45][_0x14da('0x35')],'resourceId':_0x5a3d01[_0x248e45]['id'],'type':_0x4cad3a,'sectionId':_[_0x14da('0x59')](_0x10d356,[_0x14da('0x35'),_0x4cad3a])['id']},{}));}return Promise['all'](_0x355812);});})[_0x14da('0x1e')](respondWithResult(_0x4a8512,0xc9))['catch'](handleError(_0x4a8512,null));};exports[_0x14da('0x8a')]=function(_0x5a8377,_0x5accb8){if(_0x5a8377['body']['id']){delete _0x5a8377[_0x14da('0x5d')]['id'];}return db[_0x14da('0x39')][_0x14da('0x59')]({'where':{'id':_0x5a8377['params']['id']}})[_0x14da('0x1e')](function(_0x4277d4){if(!_0x4277d4)return null;if(_0x4277d4['id']===_0x5a8377[_0x14da('0x7c')]['id']){if(!_0x5a8377[_0x14da('0x5d')][_0x14da('0x8b')]||!_0x5a8377[_0x14da('0x5d')][_0x14da('0x8c')]){throw new db['Sequelize'][(_0x14da('0x8d'))](_0x14da('0x8e'));}if(!_0x4277d4[_0x14da('0x8f')](_0x5a8377[_0x14da('0x5d')]['oldPassword'])){throw new db[(_0x14da('0x90'))][(_0x14da('0x8d'))](_0x14da('0x91'));}if(_0x5a8377['body'][_0x14da('0x8b')]===_0x5a8377[_0x14da('0x5d')][_0x14da('0x8c')]){throw new db[(_0x14da('0x90'))][(_0x14da('0x8d'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x5a8377[_0x14da('0x7c')][_0x14da('0x2a')]===_0x14da('0x2d')){if(!_0x5a8377[_0x14da('0x5d')][_0x14da('0x8c')]){throw new db[(_0x14da('0x90'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x5a8377['user'][_0x14da('0x2a')]===_0x14da('0x7c')){if(!_0x5a8377[_0x14da('0x5d')][_0x14da('0x8c')]){throw new db[(_0x14da('0x90'))]['ValidationError'](_0x14da('0x92'));}if(_0x4277d4['role']!==_0x14da('0x2b')){throw new db[(_0x14da('0x90'))]['ValidationError'](_0x14da('0x85'));}}else{throw new db[(_0x14da('0x90'))][(_0x14da('0x8d'))]('Unauthorized');}return _0x4277d4;})[_0x14da('0x1e')](handleEntityNotFound(_0x5accb8,null))[_0x14da('0x1e')](function(_0x4378e9){return db[_0x14da('0x62')]['findOne']({'attributes':['id',_0x14da('0x63'),_0x14da('0x93'),'passwordHistoryLimit']})['then'](function(_0x5a701f){if(_0x5a701f['securePassword'])authService[_0x14da('0x94')](_0x5a8377['body'][_0x14da('0x8c')]);if(!_0x5a701f[_0x14da('0x93')]||!_0x4378e9['previousPasswords'])return _0x4378e9;authService[_0x14da('0x95')](_0x5a8377[_0x14da('0x5d')][_0x14da('0x8c')],_0x4378e9[_0x14da('0x40')],_0x5a701f['passwordHistoryLimit']);return _0x4378e9;})[_0x14da('0x1e')](saveUpdates({'password':_0x5a8377[_0x14da('0x5d')][_0x14da('0x8c')],'passwordResetAt':_0x5a8377[_0x14da('0x7c')]['id']==_0x5a8377[_0x14da('0x56')]['id']?moment():null,'previousPasswords':authService[_0x14da('0x96')](_0x5a8377[_0x14da('0x5d')][_0x14da('0x8c')],_0x4378e9[_0x14da('0x40')])},null));})[_0x14da('0x1e')](respondWithResult(_0x5accb8,null))[_0x14da('0x28')](handleError(_0x5accb8,null));};exports[_0x14da('0x97')]=function(_0x12b4f8,_0x51a6c2){var _0x3aca89=_0x12b4f8[_0x14da('0x5d')]['channel'];return db[_0x14da('0x39')][_0x14da('0x59')]({'where':{'id':_0x12b4f8[_0x14da('0x56')]['id']},'attributes':['id',_0x14da('0x35'),_0x14da('0x2a'),_0x14da('0x98'),_0x14da('0x99'),_0x14da('0x9a'),_0x14da('0x9b')]})['then'](handleEntityNotFound(_0x51a6c2,null))['then'](function(_0x64cd2d){if(_0x64cd2d){if(!utils[_0x14da('0x9c')](_0x3aca89)){throw new db[(_0x14da('0x90'))]['ValidationError'](_0x14da('0x9d'));}return _0x64cd2d[_0x14da('0x9e')+_[_0x14da('0x9f')](_0x3aca89[_0x14da('0xa0')]())+_0x14da('0xa1')](_0x12b4f8[_0x14da('0x5d')][_0x14da('0x5f')],{'penalty':_0x12b4f8[_0x14da('0x5d')][_0x14da('0xa2')]||0x0})[_0x14da('0xa3')](function(_0x2d50dd){for(var _0x47a37b=0x0;_0x47a37b<_0x12b4f8[_0x14da('0x5d')][_0x14da('0x5f')][_0x14da('0x4f')];_0x47a37b+=0x1){var _0x4124c8={'UserId':Number(_0x12b4f8[_0x14da('0x56')]['id'])};_0x4124c8[_['capitalize'](_0x3aca89['toLowerCase']())+_0x14da('0xa4')]=Number(_0x12b4f8[_0x14da('0x5d')][_0x14da('0x5f')][_0x47a37b]);socket[_0x14da('0xa5')](_0x14da('0x7c')+_[_0x14da('0x9f')](_0x3aca89[_0x14da('0xa0')]())+_0x14da('0xa6'),_0x4124c8);}return _0x2d50dd;})[_0x14da('0x1e')](function(){if(_0x3aca89===_0x14da('0xa7')){return db['VoiceQueue'][_0x14da('0x88')]({'where':{'id':_0x12b4f8[_0x14da('0x5d')][_0x14da('0x5f')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x14da('0x1e')](function(_0x80772e){var _0x5358db=_0x64cd2d[_0x14da('0xa8')]({'plain':!![]});var _0x17791e=[];if(_0x3aca89===_0x14da('0xa7')&&_0x5358db[_0x14da('0x2a')]==='agent'&&_0x5358db['online']){for(let _0x5ae657=0x0;_0x5ae657<_0x80772e['length'];_0x5ae657+=0x1){_0x17791e['push']({'membername':_0x5358db[_0x14da('0x35')],'UserId':_0x5358db['id'],'queue_name':_0x80772e[_0x5ae657][_0x14da('0x35')],'VoiceQueueId':_0x80772e[_0x5ae657]['id'],'interface':_[_0x14da('0x64')](_0x5358db[_0x14da('0x9b')])?util[_0x14da('0xa9')](_0x14da('0xaa'),_0x5358db[_0x14da('0x35')]):_0x5358db[_0x14da('0x9b')],'paused':_0x5358db[_0x14da('0x9a')]||![],'penalty':_0x12b4f8[_0x14da('0x5d')][_0x14da('0xa2')]||0x0});}return Promise['all'](_0x17791e[_0x14da('0x32')](function(_0x491e6e){return db[_0x14da('0xab')][_0x14da('0xac')](_0x491e6e);}));}return _0x64cd2d;});}})['then'](respondWithStatusCode(_0x51a6c2,null))['catch'](handleError(_0x51a6c2,null));};exports[_0x14da('0xad')]=function(_0x244ecb,_0x417fe5){var _0x6c81ec,_0xdb257a;return db['User'][_0x14da('0x59')]({'where':{'id':_0x244ecb[_0x14da('0x56')]['id']},'attributes':['id',_0x14da('0x35'),_0x14da('0x2a')]})[_0x14da('0x1e')](handleEntityNotFound(_0x417fe5,null))[_0x14da('0x1e')](function(_0x14132d){if(_0x14132d){_0x6c81ec=_0x14132d;if(!_0x244ecb[_0x14da('0x45')][_0x14da('0xae')]||!utils[_0x14da('0x9c')](_0x244ecb[_0x14da('0x45')]['channel'])){throw new db[(_0x14da('0x90'))]['ValidationError'](_0x14da('0x9d'));}return _0x14132d['remove'+_['capitalize'](_0x244ecb['query'][_0x14da('0xae')][_0x14da('0xa0')]())+_0x14da('0xa1')](_0x244ecb[_0x14da('0x45')][_0x14da('0x5f')]);}})[_0x14da('0x1e')](function(_0x168a47){if(_[_0x14da('0xaf')](_0x244ecb[_0x14da('0x45')]['ids'])){for(var _0x4d7332=0x0;_0x4d7332<_0x244ecb[_0x14da('0x45')]['ids'][_0x14da('0x4f')];_0x4d7332+=0x1){_0xdb257a={'UserId':Number(_0x244ecb[_0x14da('0x56')]['id'])};_0xdb257a[_[_0x14da('0x9f')](_0x244ecb[_0x14da('0x45')][_0x14da('0xae')][_0x14da('0xa0')]())+_0x14da('0xa4')]=Number(_0x244ecb[_0x14da('0x45')][_0x14da('0x5f')][_0x4d7332]);socket[_0x14da('0xa5')](_0x14da('0x7c')+_[_0x14da('0x9f')](_0x244ecb['query'][_0x14da('0xae')][_0x14da('0xa0')]())+_0x14da('0xb0'),_0xdb257a);}}else{_0xdb257a={'UserId':Number(_0x244ecb['params']['id'])};_0xdb257a[_[_0x14da('0x9f')](_0x244ecb[_0x14da('0x45')]['channel'][_0x14da('0xa0')]())+_0x14da('0xa4')]=Number(_0x244ecb[_0x14da('0x45')][_0x14da('0x5f')]);socket[_0x14da('0xa5')](_0x14da('0x7c')+_['capitalize'](_0x244ecb[_0x14da('0x45')]['channel'][_0x14da('0xa0')]())+'Queue:remove',_0xdb257a);}return _0x168a47;})['then'](function(){if(_0x244ecb['query'][_0x14da('0xae')]==='voice'){return db['UserVoiceQueueRt']['destroy']({'where':{'UserId':_0x244ecb[_0x14da('0x56')]['id'],'VoiceQueueId':_0x244ecb[_0x14da('0x45')][_0x14da('0x5f')]},'individualHooks':!![]})['then'](function(){return _0x6c81ec;});}return _0x6c81ec;})[_0x14da('0x1e')](respondWithStatusCode(_0x417fe5,null))['catch'](handleError(_0x417fe5,null));};exports[_0x14da('0xb1')]=function(_0x392e51,_0x2ed5cb){_0x392e51[_0x14da('0x5d')][_0x14da('0xb2')]=_0x392e51[_0x14da('0xb3')][_0x14da('0xb4')];return db['User'][_0x14da('0x59')]({'where':{'id':_0x392e51['params']['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0x2ed5cb,null))[_0x14da('0x1e')](saveUpdates(_0x392e51[_0x14da('0x5d')],null))[_0x14da('0x1e')](respondWithResult(_0x2ed5cb,null))[_0x14da('0x28')](handleError(_0x2ed5cb,null));};exports[_0x14da('0xb5')]=function(_0x2bef08,_0x4e2b72){var _0x16a550=path[_0x14da('0xb6')](config['root'],_0x14da('0xb7'));return db[_0x14da('0x39')][_0x14da('0x59')]({'where':{'id':_0x2bef08['params']['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x4e2b72,null))[_0x14da('0x1e')](function(_0x26c2b8){if(_0x26c2b8){if(_['isNil'](_0x26c2b8[_0x14da('0xb2')])){return _0x4e2b72[_0x14da('0xb8')](_0x16a550);}else{if(!fs[_0x14da('0xb9')](path[_0x14da('0xb6')](config[_0x14da('0xba')],_0x14da('0xbb'),_0x26c2b8[_0x14da('0xb2')]))){return _0x4e2b72[_0x14da('0xb8')](_0x16a550);}return _0x4e2b72[_0x14da('0xb8')](path[_0x14da('0xb6')](config['root'],_0x14da('0xbb'),_0x26c2b8[_0x14da('0xb2')]));}}})[_0x14da('0x28')](handleError(_0x4e2b72,null));};exports[_0x14da('0xbc')]=function(_0x894916,_0x5cdf7d){return db[_0x14da('0x39')][_0x14da('0x59')]({'where':{'id':_0x894916[_0x14da('0x56')]['id']},'attributes':['id']})[_0x14da('0x1e')](handleEntityNotFound(_0x5cdf7d,null))[_0x14da('0x1e')](function(_0x5bc6fe){var _0x3118f2=[];values=_0x5bc6fe[_0x14da('0x50')];_0x3118f2[_0x14da('0x4c')](get_open_tabs(_0x14da('0x5a'),_0x5bc6fe['dataValues']));_0x3118f2[_0x14da('0x4c')](get_open_tabs(_0x14da('0x5b'),_0x5bc6fe[_0x14da('0x50')]));_0x3118f2['push'](get_open_tabs('openchannel',_0x5bc6fe['dataValues']));_0x3118f2['push'](get_open_tabs(_0x14da('0x53'),_0x5bc6fe[_0x14da('0x50')]));_0x3118f2[_0x14da('0x4c')](get_open_tabs(_0x14da('0x51'),_0x5bc6fe[_0x14da('0x50')]));_0x3118f2['push'](get_open_tabs(_0x14da('0x5c'),_0x5bc6fe[_0x14da('0x50')]));return Promise[_0x14da('0x54')](_0x3118f2);})[_0x14da('0x1e')](function(_0x582f16){if(_0x582f16){var _0x7b4935=_['map'](values[_0x14da('0xbd')],function(_0x4e3c88){return{'channel':_0x14da('0xbe'),'id':_0x4e3c88['id'],'createdAt':_0x4e3c88['createdAt']};});var _0x42e202=_[_0x14da('0x32')](values[_0x14da('0xbf')],function(_0x90e1dc){return{'channel':'FAX','id':_0x90e1dc['id'],'createdAt':_0x90e1dc[_0x14da('0xc0')]};});var _0x51a5e5=_[_0x14da('0x32')](values[_0x14da('0xc1')],function(_0x3c3b6f){return{'channel':_0x14da('0xc2'),'id':_0x3c3b6f['id'],'createdAt':_0x3c3b6f[_0x14da('0xc0')]};});var _0x3d224c=_[_0x14da('0x32')](values['MailOpenTabs'],function(_0x58523d){return{'channel':_0x14da('0xc3'),'id':_0x58523d['id'],'createdAt':_0x58523d[_0x14da('0xc0')]};});var _0x423edf=_['map'](values[_0x14da('0xc4')],function(_0x542916){return{'channel':_0x14da('0xc5'),'id':_0x542916['id'],'createdAt':_0x542916[_0x14da('0xc0')]};});var _0x150015=_['map'](values[_0x14da('0xc6')],function(_0x2332ef){return{'channel':_0x14da('0xc7'),'id':_0x2332ef['id'],'createdAt':_0x2332ef[_0x14da('0xc0')]};});var _0x4f86cf=_[_0x14da('0xc8')](_0x7b4935,_0x42e202,_0x51a5e5,_0x3d224c,_0x423edf,_0x150015);var _0x24e66a={'count':_0x4f86cf[_0x14da('0x4f')],'rows':_0x4f86cf};return _0x24e66a;}else return null;})[_0x14da('0x1e')](respondWithResult(_0x5cdf7d,null))[_0x14da('0x28')](handleError(_0x5cdf7d,null));};exports[_0x14da('0xc9')]=function(_0x6c630,_0x377a84){var _0x45aa05={};return db['User']['findOne']({'where':{'id':_0x6c630[_0x14da('0x56')]['id']}})[_0x14da('0x1e')](function(_0x3e31aa){if(!_0x3e31aa){throw new APINotFoundError(util[_0x14da('0xa9')](_0x14da('0xca'),_0x6c630[_0x14da('0x56')]['id']));}return contacts[_0x14da('0x5e')]();})[_0x14da('0x1e')](function(_0x16d02f){_0x6c630['query'][_0x14da('0x39')]=_0x6c630[_0x14da('0x56')]['id'];_0x45aa05=qs['getOptions'](_0x16d02f,_0x6c630);if(_0x6c630[_0x14da('0x45')][_0x14da('0xcb')]('includeAll')){_0x45aa05[_0x14da('0x47')]=[{'model':db[_0x14da('0xcc')],'as':'List','required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x14da('0x35'),'color'],'where':_0x6c630[_0x14da('0x45')]['tag']?{'id':_0x6c630[_0x14da('0x45')][_0x14da('0xcd')]}:undefined,'required':_0x6c630[_0x14da('0x45')][_0x14da('0xcd')]?!![]:![]}];}return contacts[_0x14da('0x88')](_0x6c630['query'],_0x6c630['user'],_0x45aa05,_0x16d02f);})['then'](respondWithFilteredResult(_0x377a84,_0x45aa05))[_0x14da('0x28')](APIHandleError(_0x377a84));};exports[_0x14da('0xce')]=function(_0x4fa21d,_0x462b1e){var _0x37c408;var _0x17dba0={};var _0x2fd5d7;return db[_0x14da('0x39')]['findOne']({'where':{'id':_0x4fa21d[_0x14da('0x56')]['id']},'attributes':['id',_0x14da('0x35'),_0x14da('0x2a')]})['then'](handleEntityNotFound(_0x462b1e,null))['then'](function(_0x4aae5f){if(!utils[_0x14da('0x9c')](_0x4fa21d[_0x14da('0x45')][_0x14da('0xae')])){throw new db['Sequelize'][(_0x14da('0x8d'))]('Unknown\x20channel');}_0x37c408=_0x4aae5f;var _0x8d718c={};_0x8d718c[_0x14da('0xcf')]=_[_0x14da('0xd0')](db[_[_0x14da('0x9f')](_0x4fa21d[_0x14da('0x45')][_0x14da('0xae')])+_0x14da('0xd1')]['rawAttributes']);_0x8d718c[_0x14da('0x45')]=_[_0x14da('0xd0')](_0x4fa21d[_0x14da('0x45')]);_0x8d718c[_0x14da('0xd2')]=_[_0x14da('0xd3')](_0x8d718c['model'],_0x8d718c[_0x14da('0x45')]);_0x17dba0['attributes']=_[_0x14da('0xd3')](_0x8d718c[_0x14da('0xcf')],qs['fields'](_0x4fa21d[_0x14da('0x45')]['fields']));_0x17dba0['attributes']=_0x17dba0['attributes']['length']?_0x17dba0[_0x14da('0x4b')]:_0x8d718c[_0x14da('0xcf')];_0x17dba0['order']=qs[_0x14da('0xd4')](_0x4fa21d[_0x14da('0x45')]['sort']);_0x17dba0[_0x14da('0x44')]=qs['filters'](_[_0x14da('0xd5')](_0x4fa21d[_0x14da('0x45')],_0x8d718c[_0x14da('0xd2')]));if(_0x4fa21d['query']['filter']){_0x17dba0[_0x14da('0x44')]=_[_0x14da('0x58')](_0x17dba0[_0x14da('0x44')],{'$or':_[_0x14da('0x32')](_0x17dba0[_0x14da('0x4b')],function(_0x297d16){var _0x518886={};_0x518886[_0x297d16]={'$like':'%'+_0x4fa21d[_0x14da('0x45')]['filter']+'%'};return _0x518886;})});}_0x17dba0=_['merge']({},_0x17dba0,_0x4fa21d[_0x14da('0xd6')]);switch(_0x37c408['role']){case _0x14da('0x2d'):return db[_[_0x14da('0x9f')](_0x4fa21d[_0x14da('0x45')][_0x14da('0xae')])+'Queue']['findAll'](_0x17dba0);case _0x14da('0x7c'):case _0x14da('0x2b'):return _0x37c408[_0x14da('0xa8')+_[_0x14da('0x9f')](_0x4fa21d['query'][_0x14da('0xae')])+_0x14da('0xa1')](_0x17dba0);default:throw new db[(_0x14da('0x90'))][(_0x14da('0x8d'))]('Unknown\x20role');}})[_0x14da('0x1e')](function(_0x163263){_0x2fd5d7=_0x163263[_0x14da('0x4f')];if(!_0x4fa21d[_0x14da('0x45')][_0x14da('0xcb')](_0x14da('0xd7'))){_0x17dba0[_0x14da('0x1b')]=qs[_0x14da('0x1b')](_0x4fa21d[_0x14da('0x45')]['limit']);_0x17dba0[_0x14da('0xd8')]=qs[_0x14da('0xd8')](_0x4fa21d[_0x14da('0x45')]['offset']);}switch(_0x37c408[_0x14da('0x2a')]){case _0x14da('0x2d'):return db[_[_0x14da('0x9f')](_0x4fa21d[_0x14da('0x45')][_0x14da('0xae')])+_0x14da('0xd1')][_0x14da('0x88')](_0x17dba0);case _0x14da('0x7c'):case _0x14da('0x2b'):return _0x37c408[_0x14da('0xa8')+_[_0x14da('0x9f')](_0x4fa21d[_0x14da('0x45')][_0x14da('0xae')])+_0x14da('0xa1')](_0x17dba0);}})[_0x14da('0x1e')](function(_0x58d42d){return{'count':_0x2fd5d7,'rows':_0x58d42d};})[_0x14da('0x1e')](respondWithResult(_0x462b1e,null))['catch'](handleError(_0x462b1e,null));};exports[_0x14da('0xd9')]=function(_0x16bad1,_0x20bb4d){var _0x4bde8e={};var _0x5e232e={};var _0x316a8a;var _0xd20dba;return db['User']['findOne']({'where':{'id':_0x16bad1[_0x14da('0x56')]['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0x20bb4d,null))[_0x14da('0x1e')](function(_0x2a9df4){if(_0x2a9df4){_0x316a8a=_0x2a9df4;_0x5e232e[_0x14da('0xcf')]=_[_0x14da('0xd0')](db[_0x14da('0xab')]['rawAttributes']);_0x5e232e[_0x14da('0x45')]=_['keys'](_0x16bad1[_0x14da('0x45')]);_0x5e232e[_0x14da('0xd2')]=_[_0x14da('0xd3')](_0x5e232e[_0x14da('0xcf')],_0x5e232e[_0x14da('0x45')]);_0x4bde8e['attributes']=_[_0x14da('0xd3')](_0x5e232e[_0x14da('0xcf')],qs[_0x14da('0xda')](_0x16bad1[_0x14da('0x45')][_0x14da('0xda')]));_0x4bde8e[_0x14da('0x4b')]=_0x4bde8e['attributes'][_0x14da('0x4f')]?_0x4bde8e[_0x14da('0x4b')]:_0x5e232e[_0x14da('0xcf')];_0x4bde8e['order']=qs[_0x14da('0xd4')](_0x16bad1[_0x14da('0x45')][_0x14da('0xd4')]);_0x4bde8e[_0x14da('0x44')]=qs['filters'](_[_0x14da('0xd5')](_0x16bad1['query'],_0x5e232e[_0x14da('0xd2')]));if(_0x16bad1[_0x14da('0x45')]['filter']){_0x4bde8e['where']=_[_0x14da('0x58')](_0x4bde8e[_0x14da('0x44')],{'$or':_[_0x14da('0x32')](_0x4bde8e['attributes'],function(_0x559c23){var _0x2ac260={};_0x2ac260[_0x559c23]={'$like':'%'+_0x16bad1[_0x14da('0x45')][_0x14da('0x3d')]+'%'};return _0x2ac260;})});}_0x4bde8e=_[_0x14da('0x58')]({},_0x4bde8e,_0x16bad1[_0x14da('0xd6')]);return _0x316a8a['getVoiceQueuesRt'](_0x4bde8e);}})[_0x14da('0x1e')](function(_0x1efb7c){if(_0x1efb7c){_0xd20dba=_0x1efb7c[_0x14da('0x4f')];if(!_0x16bad1[_0x14da('0x45')]['hasOwnProperty']('nolimit')){_0x4bde8e[_0x14da('0x1b')]=qs[_0x14da('0x1b')](_0x16bad1[_0x14da('0x45')][_0x14da('0x1b')]);_0x4bde8e[_0x14da('0xd8')]=qs['offset'](_0x16bad1['query'][_0x14da('0xd8')]);}return _0x316a8a[_0x14da('0xd9')](_0x4bde8e);}})[_0x14da('0x1e')](function(_0x5b173f){if(_0x5b173f){return _0x5b173f?{'count':_0xd20dba,'rows':_0x5b173f}:null;}})[_0x14da('0x1e')](respondWithResult(_0x20bb4d,null))[_0x14da('0x28')](handleError(_0x20bb4d,null));};exports[_0x14da('0xdb')]=function(_0x817111,_0x3730fb){var _0x4bfad9={};var _0x317449={};var _0x5b9855;var _0x5155a5;return db['User'][_0x14da('0xdc')]({'where':{'id':_0x817111['params']['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0x3730fb,null))[_0x14da('0x1e')](function(_0x459167){if(_0x459167){_0x5b9855=_0x459167;_0x317449[_0x14da('0xcf')]=_['keys'](db[_0x14da('0xdd')][_0x14da('0x3a')]);_0x317449[_0x14da('0x45')]=_[_0x14da('0xd0')](_0x817111[_0x14da('0x45')]);_0x317449[_0x14da('0xd2')]=_['intersection'](_0x317449[_0x14da('0xcf')],_0x317449[_0x14da('0x45')]);_0x4bfad9[_0x14da('0x4b')]=_[_0x14da('0xd3')](_0x317449[_0x14da('0xcf')],qs[_0x14da('0xda')](_0x817111[_0x14da('0x45')][_0x14da('0xda')]));_0x4bfad9[_0x14da('0x4b')]=_0x4bfad9[_0x14da('0x4b')][_0x14da('0x4f')]?_0x4bfad9[_0x14da('0x4b')]:_0x317449[_0x14da('0xcf')];_0x4bfad9['order']=qs['sort'](_0x817111[_0x14da('0x45')][_0x14da('0xd4')]);_0x4bfad9[_0x14da('0x44')]=qs['filters'](_[_0x14da('0xd5')](_0x817111[_0x14da('0x45')],_0x317449[_0x14da('0xd2')]));if(_0x817111[_0x14da('0x45')]['filter']){_0x4bfad9[_0x14da('0x44')]=_[_0x14da('0x58')](_0x4bfad9[_0x14da('0x44')],{'$or':_[_0x14da('0x32')](_0x4bfad9[_0x14da('0x4b')],function(_0x48ac7a){var _0x3d1a27={};_0x3d1a27[_0x48ac7a]={'$like':'%'+_0x817111[_0x14da('0x45')]['filter']+'%'};return _0x3d1a27;})});}_0x4bfad9=_[_0x14da('0x58')]({},_0x4bfad9,_0x817111[_0x14da('0xd6')]);return _0x5b9855['getGroups'](_0x4bfad9);}})[_0x14da('0x1e')](function(_0x13c91a){if(_0x13c91a){_0x5155a5=_0x13c91a[_0x14da('0x4f')];if(!_0x817111[_0x14da('0x45')][_0x14da('0xcb')](_0x14da('0xd7'))){_0x4bfad9[_0x14da('0x1b')]=qs[_0x14da('0x1b')](_0x817111['query'][_0x14da('0x1b')]);_0x4bfad9[_0x14da('0xd8')]=qs[_0x14da('0xd8')](_0x817111['query'][_0x14da('0xd8')]);}return _0x5b9855[_0x14da('0xdb')](_0x4bfad9);}})[_0x14da('0x1e')](function(_0x3e3a63){if(_0x3e3a63){return _0x3e3a63?{'count':_0x5155a5,'rows':_0x3e3a63}:null;}})['then'](respondWithResult(_0x3730fb,null))['catch'](handleError(_0x3730fb,null));};exports[_0x14da('0xde')]=function(_0x286c63,_0x45886f){var _0xb7315a={'raw':!![],'where':{}};var _0x4f04c1={};var _0x1caa0d={'count':0x0,'rows':[]};return db[_0x14da('0x39')]['findOne']({'where':{'id':_0x286c63[_0x14da('0x56')]['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0x45886f,null))[_0x14da('0x1e')](function(_0x29a4f6){if(_0x29a4f6){_0x4f04c1['model']=_['keys'](db[_0x14da('0xdf')]['rawAttributes']);_0x4f04c1[_0x14da('0x45')]=_[_0x14da('0xd0')](_0x286c63[_0x14da('0x45')]);_0x4f04c1[_0x14da('0xd2')]=_[_0x14da('0xd3')](_0x4f04c1[_0x14da('0xcf')],_0x4f04c1['query']);_0xb7315a['attributes']=_[_0x14da('0xd3')](_0x4f04c1[_0x14da('0xcf')],qs['fields'](_0x286c63[_0x14da('0x45')][_0x14da('0xda')]));_0xb7315a['attributes']=_0xb7315a[_0x14da('0x4b')]['length']?_0xb7315a['attributes']:_0x4f04c1[_0x14da('0xcf')];if(!_0x286c63[_0x14da('0x45')]['hasOwnProperty'](_0x14da('0xd7'))){_0xb7315a['limit']=qs['limit'](_0x286c63[_0x14da('0x45')]['limit']);_0xb7315a[_0x14da('0xd8')]=qs[_0x14da('0xd8')](_0x286c63[_0x14da('0x45')][_0x14da('0xd8')]);}_0xb7315a[_0x14da('0xe0')]=qs[_0x14da('0xd4')](_0x286c63[_0x14da('0x45')][_0x14da('0xd4')]);_0xb7315a[_0x14da('0x44')]=qs['filters'](_['pick'](_0x286c63[_0x14da('0x45')],_0x4f04c1[_0x14da('0xd2')]));_0xb7315a[_0x14da('0x44')][_0x14da('0xe1')]=_0x29a4f6['id'];if(_0x286c63[_0x14da('0x45')][_0x14da('0x3d')]){_0xb7315a['where']=_[_0x14da('0x58')](_0xb7315a[_0x14da('0x44')],{'$or':_['map'](_0xb7315a[_0x14da('0x4b')],function(_0xdb2915){var _0x6c5caf={};_0x6c5caf[_0xdb2915]={'$like':'%'+_0x286c63[_0x14da('0x45')]['filter']+'%'};return _0x6c5caf;})});}_0xb7315a=_['merge']({},_0xb7315a,_0x286c63[_0x14da('0xd6')]);return db['VoiceRecording']['count']({'where':_0xb7315a[_0x14da('0x44')]})[_0x14da('0x1e')](function(_0x17267f){_0x1caa0d[_0x14da('0x1a')]=_0x17267f;if(_0x286c63[_0x14da('0x45')][_0x14da('0x46')]){_0xb7315a[_0x14da('0x47')]=[{'all':!![]}];}return db[_0x14da('0xdf')]['findAll'](_0xb7315a);})['then'](function(_0x2bedb3){_0x1caa0d[_0x14da('0x4e')]=_0x2bedb3;return _0x1caa0d;});}})[_0x14da('0x1e')](respondWithFilteredResult(_0x45886f,_0xb7315a))['catch'](handleError(_0x45886f,null));};exports[_0x14da('0xe2')]=function(_0x113bed,_0x57b297){var _0x3be773={'raw':!![],'where':{}};var _0x3f6c24={};var _0x3a28d5={'count':0x0,'rows':[]};return db[_0x14da('0x39')][_0x14da('0xdc')]({'where':{'id':_0x113bed['params']['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0x57b297,null))[_0x14da('0x1e')](function(_0x14487e){if(_0x14487e){_0x3f6c24['model']=_[_0x14da('0xd0')](db['ScreenRecording'][_0x14da('0x3a')]);_0x3f6c24['query']=_[_0x14da('0xd0')](_0x113bed[_0x14da('0x45')]);_0x3f6c24[_0x14da('0xd2')]=_[_0x14da('0xd3')](_0x3f6c24['model'],_0x3f6c24[_0x14da('0x45')]);_0x3be773[_0x14da('0x4b')]=_['intersection'](_0x3f6c24[_0x14da('0xcf')],qs['fields'](_0x113bed[_0x14da('0x45')][_0x14da('0xda')]));_0x3be773[_0x14da('0x4b')]=_0x3be773['attributes'][_0x14da('0x4f')]?_0x3be773[_0x14da('0x4b')]:_0x3f6c24[_0x14da('0xcf')];if(!_0x113bed['query'][_0x14da('0xcb')](_0x14da('0xd7'))){_0x3be773['limit']=qs[_0x14da('0x1b')](_0x113bed[_0x14da('0x45')]['limit']);_0x3be773[_0x14da('0xd8')]=qs[_0x14da('0xd8')](_0x113bed['query'][_0x14da('0xd8')]);}_0x3be773[_0x14da('0xe0')]=qs[_0x14da('0xd4')](_0x113bed[_0x14da('0x45')][_0x14da('0xd4')]);_0x3be773[_0x14da('0x44')]=qs[_0x14da('0xd2')](_[_0x14da('0xd5')](_0x113bed['query'],_0x3f6c24[_0x14da('0xd2')]));_0x3be773[_0x14da('0x44')][_0x14da('0xe1')]=_0x14487e['id'];if(_0x113bed[_0x14da('0x45')][_0x14da('0x3d')]){_0x3be773[_0x14da('0x44')]=_[_0x14da('0x58')](_0x3be773[_0x14da('0x44')],{'$or':_[_0x14da('0x32')](_0x3be773[_0x14da('0x4b')],function(_0x10fcf0){var _0x2942d4={};_0x2942d4[_0x10fcf0]={'$like':'%'+_0x113bed['query'][_0x14da('0x3d')]+'%'};return _0x2942d4;})});}_0x3be773=_[_0x14da('0x58')]({},_0x3be773,_0x113bed['options']);return db['ScreenRecording'][_0x14da('0x1a')]({'where':_0x3be773[_0x14da('0x44')]})[_0x14da('0x1e')](function(_0x57eec6){_0x3a28d5[_0x14da('0x1a')]=_0x57eec6;if(_0x113bed['query'][_0x14da('0x46')]){_0x3be773['include']=[{'all':!![]}];}return db[_0x14da('0xe3')][_0x14da('0x88')](_0x3be773);})[_0x14da('0x1e')](function(_0x384d91){_0x3a28d5['rows']=_0x384d91;return _0x3a28d5;});}})[_0x14da('0x1e')](respondWithFilteredResult(_0x57b297,_0x3be773))[_0x14da('0x28')](handleError(_0x57b297,null));};exports[_0x14da('0xe4')]=function(_0x1da6e7,_0x4950d7){var _0x52c4bc={};var _0x1e5a14={};var _0x4abb32;var _0x588e55;return db['User'][_0x14da('0xdc')]({'where':{'id':_0x1da6e7[_0x14da('0x56')]['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0x4950d7,null))[_0x14da('0x1e')](function(_0x40f444){if(_0x40f444){_0x4abb32=_0x40f444;_0x1e5a14[_0x14da('0xcf')]=_[_0x14da('0xd0')](db[_0x14da('0xe5')]['rawAttributes']);_0x1e5a14['query']=_[_0x14da('0xd0')](_0x1da6e7['query']);_0x1e5a14[_0x14da('0xd2')]=_[_0x14da('0xd3')](_0x1e5a14[_0x14da('0xcf')],_0x1e5a14[_0x14da('0x45')]);_0x52c4bc['attributes']=_[_0x14da('0xd3')](_0x1e5a14[_0x14da('0xcf')],qs[_0x14da('0xda')](_0x1da6e7[_0x14da('0x45')][_0x14da('0xda')]));_0x52c4bc[_0x14da('0x4b')]=_0x52c4bc[_0x14da('0x4b')]['length']?_0x52c4bc[_0x14da('0x4b')]:_0x1e5a14['model'];_0x52c4bc[_0x14da('0xe0')]=qs[_0x14da('0xd4')](_0x1da6e7[_0x14da('0x45')]['sort']);_0x52c4bc['where']=qs['filters'](_[_0x14da('0xd5')](_0x1da6e7[_0x14da('0x45')],_0x1e5a14[_0x14da('0xd2')]));if(_0x1da6e7[_0x14da('0x45')][_0x14da('0x3d')]){_0x52c4bc[_0x14da('0x44')]=_['merge'](_0x52c4bc[_0x14da('0x44')],{'$or':_[_0x14da('0x32')](_0x52c4bc[_0x14da('0x4b')],function(_0xecc9e5){var _0x131d2b={};_0x131d2b[_0xecc9e5]={'$like':'%'+_0x1da6e7['query'][_0x14da('0x3d')]+'%'};return _0x131d2b;})});}_0x52c4bc=_[_0x14da('0x58')]({},_0x52c4bc,_0x1da6e7[_0x14da('0xd6')]);return _0x4abb32[_0x14da('0xe4')](_0x52c4bc);}})['then'](function(_0x55605b){if(_0x55605b){_0x588e55=_0x55605b[_0x14da('0x4f')];if(!_0x1da6e7['query']['hasOwnProperty'](_0x14da('0xd7'))){_0x52c4bc[_0x14da('0x1b')]=qs[_0x14da('0x1b')](_0x1da6e7[_0x14da('0x45')][_0x14da('0x1b')]);_0x52c4bc[_0x14da('0xd8')]=qs[_0x14da('0xd8')](_0x1da6e7[_0x14da('0x45')][_0x14da('0xd8')]);}return _0x4abb32['getChatInteractions'](_0x52c4bc);}})['then'](function(_0x13dfa9){if(_0x13dfa9){return _0x13dfa9?{'count':_0x588e55,'rows':_0x13dfa9}:null;}})[_0x14da('0x1e')](respondWithResult(_0x4950d7,null))[_0x14da('0x28')](handleError(_0x4950d7,null));};exports[_0x14da('0xe6')]=function(_0x561e95,_0x204314){var _0x162708={};var _0x40bcbb={};var _0x10c7de;var _0x26c28a;return db[_0x14da('0x39')][_0x14da('0xdc')]({'where':{'id':_0x561e95[_0x14da('0x56')]['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0x204314,null))[_0x14da('0x1e')](function(_0x3d119f){if(_0x3d119f){_0x10c7de=_0x3d119f;_0x40bcbb[_0x14da('0xcf')]=_[_0x14da('0xd0')](db[_0x14da('0xe7')]['rawAttributes']);_0x40bcbb[_0x14da('0x45')]=_[_0x14da('0xd0')](_0x561e95['query']);_0x40bcbb[_0x14da('0xd2')]=_['intersection'](_0x40bcbb[_0x14da('0xcf')],_0x40bcbb[_0x14da('0x45')]);_0x162708['attributes']=_[_0x14da('0xd3')](_0x40bcbb[_0x14da('0xcf')],qs[_0x14da('0xda')](_0x561e95['query'][_0x14da('0xda')]));_0x162708[_0x14da('0x4b')]=_0x162708[_0x14da('0x4b')][_0x14da('0x4f')]?_0x162708[_0x14da('0x4b')]:_0x40bcbb[_0x14da('0xcf')];_0x162708['order']=qs[_0x14da('0xd4')](_0x561e95['query'][_0x14da('0xd4')]);_0x162708[_0x14da('0x44')]=qs['filters'](_[_0x14da('0xd5')](_0x561e95[_0x14da('0x45')],_0x40bcbb['filters']));if(_0x561e95[_0x14da('0x45')]['filter']){_0x162708['where']=_[_0x14da('0x58')](_0x162708[_0x14da('0x44')],{'$or':_[_0x14da('0x32')](_0x162708[_0x14da('0x4b')],function(_0x223478){var _0x5deb76={};_0x5deb76[_0x223478]={'$like':'%'+_0x561e95['query'][_0x14da('0x3d')]+'%'};return _0x5deb76;})});}_0x162708=_[_0x14da('0x58')]({},_0x162708,_0x561e95[_0x14da('0xd6')]);return _0x10c7de[_0x14da('0xe6')](_0x162708);}})[_0x14da('0x1e')](function(_0x573ba9){if(_0x573ba9){_0x26c28a=_0x573ba9['length'];if(!_0x561e95[_0x14da('0x45')][_0x14da('0xcb')](_0x14da('0xd7'))){_0x162708[_0x14da('0x1b')]=qs[_0x14da('0x1b')](_0x561e95[_0x14da('0x45')][_0x14da('0x1b')]);_0x162708[_0x14da('0xd8')]=qs[_0x14da('0xd8')](_0x561e95[_0x14da('0x45')]['offset']);}return _0x10c7de[_0x14da('0xe6')](_0x162708);}})[_0x14da('0x1e')](function(_0x46f570){if(_0x46f570){return _0x46f570?{'count':_0x26c28a,'rows':_0x46f570}:null;}})[_0x14da('0x1e')](respondWithResult(_0x204314,null))[_0x14da('0x28')](handleError(_0x204314,null));};exports[_0x14da('0xe8')]=function(_0x4c874b,_0x202e68){var _0x48f60d={'raw':!![],'where':{}};var _0x51c8ee={};var _0x44b245={'count':0x0,'rows':[]};return db[_0x14da('0x39')][_0x14da('0xdc')]({'where':{'id':_0x4c874b[_0x14da('0x56')]['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0x202e68,null))[_0x14da('0x1e')](function(_0x3d6227){if(_0x3d6227){_0x51c8ee['model']=_[_0x14da('0xd0')](db[_0x14da('0xe9')][_0x14da('0x3a')]);_0x51c8ee[_0x14da('0x45')]=_[_0x14da('0xd0')](_0x4c874b[_0x14da('0x45')]);_0x51c8ee[_0x14da('0xd2')]=_[_0x14da('0xd3')](_0x51c8ee[_0x14da('0xcf')],_0x51c8ee[_0x14da('0x45')]);_0x48f60d[_0x14da('0x4b')]=_[_0x14da('0xd3')](_0x51c8ee['model'],qs[_0x14da('0xda')](_0x4c874b['query']['fields']));_0x48f60d[_0x14da('0x4b')]=_0x48f60d[_0x14da('0x4b')][_0x14da('0x4f')]?_0x48f60d['attributes']:_0x51c8ee[_0x14da('0xcf')];if(!_0x4c874b['query']['hasOwnProperty'](_0x14da('0xd7'))){_0x48f60d['limit']=qs[_0x14da('0x1b')](_0x4c874b[_0x14da('0x45')]['limit']);_0x48f60d[_0x14da('0xd8')]=qs[_0x14da('0xd8')](_0x4c874b[_0x14da('0x45')][_0x14da('0xd8')]);}_0x48f60d[_0x14da('0xe0')]=qs[_0x14da('0xd4')](_0x4c874b[_0x14da('0x45')]['sort']);_0x48f60d['where']=qs['filters'](_[_0x14da('0xd5')](_0x4c874b[_0x14da('0x45')],_0x51c8ee[_0x14da('0xd2')]));_0x48f60d['where'][_0x14da('0xe1')]=_0x3d6227['id'];if(_0x4c874b[_0x14da('0x45')]['filter']){_0x48f60d[_0x14da('0x44')]=_[_0x14da('0x58')](_0x48f60d[_0x14da('0x44')],{'$or':_[_0x14da('0x32')](_0x48f60d[_0x14da('0x4b')],function(_0x52f1e9){var _0x18b84c={};_0x18b84c[_0x52f1e9]={'$like':'%'+_0x4c874b[_0x14da('0x45')][_0x14da('0x3d')]+'%'};return _0x18b84c;})});}_0x48f60d=_[_0x14da('0x58')]({},_0x48f60d,_0x4c874b[_0x14da('0xd6')]);return db['MailInteraction'][_0x14da('0x1a')]({'where':_0x48f60d[_0x14da('0x44')]})[_0x14da('0x1e')](function(_0x118582){_0x44b245[_0x14da('0x1a')]=_0x118582;if(_0x4c874b[_0x14da('0x45')][_0x14da('0x46')]){_0x48f60d[_0x14da('0x47')]=[{'all':!![]}];}return db[_0x14da('0xe9')][_0x14da('0x88')](_0x48f60d);})['then'](function(_0x195f53){_0x44b245[_0x14da('0x4e')]=_0x195f53;return _0x44b245;});}})[_0x14da('0x1e')](respondWithFilteredResult(_0x202e68,_0x48f60d))[_0x14da('0x28')](handleError(_0x202e68,null));};exports['getSmsInteractions']=function(_0x362a68,_0xe49038){var _0x39aa9c={};var _0x2782c1={};var _0x5512cc;var _0x3b4a62;return db['User'][_0x14da('0xdc')]({'where':{'id':_0x362a68[_0x14da('0x56')]['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0xe49038,null))[_0x14da('0x1e')](function(_0x3e27d8){if(_0x3e27d8){_0x5512cc=_0x3e27d8;_0x2782c1[_0x14da('0xcf')]=_[_0x14da('0xd0')](db[_0x14da('0xea')][_0x14da('0x3a')]);_0x2782c1['query']=_[_0x14da('0xd0')](_0x362a68[_0x14da('0x45')]);_0x2782c1['filters']=_['intersection'](_0x2782c1[_0x14da('0xcf')],_0x2782c1[_0x14da('0x45')]);_0x39aa9c[_0x14da('0x4b')]=_[_0x14da('0xd3')](_0x2782c1['model'],qs[_0x14da('0xda')](_0x362a68[_0x14da('0x45')][_0x14da('0xda')]));_0x39aa9c[_0x14da('0x4b')]=_0x39aa9c['attributes'][_0x14da('0x4f')]?_0x39aa9c['attributes']:_0x2782c1[_0x14da('0xcf')];_0x39aa9c[_0x14da('0xe0')]=qs[_0x14da('0xd4')](_0x362a68[_0x14da('0x45')][_0x14da('0xd4')]);_0x39aa9c[_0x14da('0x44')]=qs[_0x14da('0xd2')](_[_0x14da('0xd5')](_0x362a68[_0x14da('0x45')],_0x2782c1[_0x14da('0xd2')]));if(_0x362a68['query'][_0x14da('0x3d')]){_0x39aa9c[_0x14da('0x44')]=_[_0x14da('0x58')](_0x39aa9c[_0x14da('0x44')],{'$or':_[_0x14da('0x32')](_0x39aa9c[_0x14da('0x4b')],function(_0x229ff4){var _0x153671={};_0x153671[_0x229ff4]={'$like':'%'+_0x362a68[_0x14da('0x45')][_0x14da('0x3d')]+'%'};return _0x153671;})});}_0x39aa9c=_[_0x14da('0x58')]({},_0x39aa9c,_0x362a68[_0x14da('0xd6')]);return _0x5512cc[_0x14da('0xeb')](_0x39aa9c);}})[_0x14da('0x1e')](function(_0x131079){if(_0x131079){_0x3b4a62=_0x131079[_0x14da('0x4f')];if(!_0x362a68[_0x14da('0x45')][_0x14da('0xcb')](_0x14da('0xd7'))){_0x39aa9c[_0x14da('0x1b')]=qs[_0x14da('0x1b')](_0x362a68[_0x14da('0x45')][_0x14da('0x1b')]);_0x39aa9c[_0x14da('0xd8')]=qs[_0x14da('0xd8')](_0x362a68['query'][_0x14da('0xd8')]);}return _0x5512cc[_0x14da('0xeb')](_0x39aa9c);}})[_0x14da('0x1e')](function(_0x129ace){if(_0x129ace){return _0x129ace?{'count':_0x3b4a62,'rows':_0x129ace}:null;}})[_0x14da('0x1e')](respondWithResult(_0xe49038,null))[_0x14da('0x28')](handleError(_0xe49038,null));};exports[_0x14da('0xec')]=function(_0x5e2cbe,_0x5332a9){var _0xa7fd10={};var _0x53fd50={};var _0x237383;var _0x1d9053;return db[_0x14da('0x39')]['findOne']({'where':{'id':_0x5e2cbe[_0x14da('0x56')]['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0x5332a9,null))[_0x14da('0x1e')](function(_0x2b5bf9){if(_0x2b5bf9){_0x237383=_0x2b5bf9;_0x53fd50[_0x14da('0xcf')]=_['keys'](db[_0x14da('0xed')][_0x14da('0x3a')]);_0x53fd50[_0x14da('0x45')]=_[_0x14da('0xd0')](_0x5e2cbe[_0x14da('0x45')]);_0x53fd50['filters']=_[_0x14da('0xd3')](_0x53fd50['model'],_0x53fd50[_0x14da('0x45')]);_0xa7fd10['attributes']=_[_0x14da('0xd3')](_0x53fd50[_0x14da('0xcf')],qs[_0x14da('0xda')](_0x5e2cbe['query']['fields']));_0xa7fd10[_0x14da('0x4b')]=_0xa7fd10[_0x14da('0x4b')][_0x14da('0x4f')]?_0xa7fd10[_0x14da('0x4b')]:_0x53fd50[_0x14da('0xcf')];_0xa7fd10[_0x14da('0xe0')]=qs['sort'](_0x5e2cbe['query'][_0x14da('0xd4')]);_0xa7fd10[_0x14da('0x44')]=qs[_0x14da('0xd2')](_[_0x14da('0xd5')](_0x5e2cbe[_0x14da('0x45')],_0x53fd50['filters']));if(_0x5e2cbe['query'][_0x14da('0x3d')]){_0xa7fd10['where']=_[_0x14da('0x58')](_0xa7fd10[_0x14da('0x44')],{'$or':_[_0x14da('0x32')](_0xa7fd10[_0x14da('0x4b')],function(_0x1e47d9){var _0x2ebe83={};_0x2ebe83[_0x1e47d9]={'$like':'%'+_0x5e2cbe[_0x14da('0x45')][_0x14da('0x3d')]+'%'};return _0x2ebe83;})});}_0xa7fd10=_[_0x14da('0x58')]({},_0xa7fd10,_0x5e2cbe[_0x14da('0xd6')]);return _0x237383[_0x14da('0xec')](_0xa7fd10);}})[_0x14da('0x1e')](function(_0x4809d5){if(_0x4809d5){_0x1d9053=_0x4809d5[_0x14da('0x4f')];if(!_0x5e2cbe[_0x14da('0x45')][_0x14da('0xcb')](_0x14da('0xd7'))){_0xa7fd10[_0x14da('0x1b')]=qs[_0x14da('0x1b')](_0x5e2cbe[_0x14da('0x45')][_0x14da('0x1b')]);_0xa7fd10[_0x14da('0xd8')]=qs['offset'](_0x5e2cbe[_0x14da('0x45')][_0x14da('0xd8')]);}return _0x237383[_0x14da('0xec')](_0xa7fd10);}})[_0x14da('0x1e')](function(_0x5040b0){if(_0x5040b0){return _0x5040b0?{'count':_0x1d9053,'rows':_0x5040b0}:null;}})[_0x14da('0x1e')](respondWithResult(_0x5332a9,null))[_0x14da('0x28')](handleError(_0x5332a9,null));};exports['getWhatsappInteractions']=function(_0x30581f,_0x1b8952){var _0x3c7dcb={};var _0x1fb4a1={};var _0x5afb97;var _0x431209;return db[_0x14da('0x39')]['findOne']({'where':{'id':_0x30581f[_0x14da('0x56')]['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0x1b8952,null))[_0x14da('0x1e')](function(_0x87c5d6){if(_0x87c5d6){_0x5afb97=_0x87c5d6;_0x1fb4a1[_0x14da('0xcf')]=_[_0x14da('0xd0')](db['WhatsappInteraction'][_0x14da('0x3a')]);_0x1fb4a1[_0x14da('0x45')]=_['keys'](_0x30581f[_0x14da('0x45')]);_0x1fb4a1[_0x14da('0xd2')]=_[_0x14da('0xd3')](_0x1fb4a1[_0x14da('0xcf')],_0x1fb4a1['query']);_0x3c7dcb[_0x14da('0x4b')]=_[_0x14da('0xd3')](_0x1fb4a1[_0x14da('0xcf')],qs[_0x14da('0xda')](_0x30581f[_0x14da('0x45')][_0x14da('0xda')]));_0x3c7dcb[_0x14da('0x4b')]=_0x3c7dcb[_0x14da('0x4b')]['length']?_0x3c7dcb[_0x14da('0x4b')]:_0x1fb4a1['model'];_0x3c7dcb[_0x14da('0xe0')]=qs[_0x14da('0xd4')](_0x30581f[_0x14da('0x45')][_0x14da('0xd4')]);_0x3c7dcb[_0x14da('0x44')]=qs['filters'](_[_0x14da('0xd5')](_0x30581f['query'],_0x1fb4a1[_0x14da('0xd2')]));if(_0x30581f[_0x14da('0x45')][_0x14da('0x3d')]){_0x3c7dcb[_0x14da('0x44')]=_[_0x14da('0x58')](_0x3c7dcb[_0x14da('0x44')],{'$or':_[_0x14da('0x32')](_0x3c7dcb[_0x14da('0x4b')],function(_0x1c6d70){var _0x4865c9={};_0x4865c9[_0x1c6d70]={'$like':'%'+_0x30581f['query']['filter']+'%'};return _0x4865c9;})});}_0x3c7dcb=_[_0x14da('0x58')]({},_0x3c7dcb,_0x30581f[_0x14da('0xd6')]);return _0x5afb97[_0x14da('0xee')](_0x3c7dcb);}})[_0x14da('0x1e')](function(_0xee7f52){if(_0xee7f52){_0x431209=_0xee7f52[_0x14da('0x4f')];if(!_0x30581f[_0x14da('0x45')][_0x14da('0xcb')](_0x14da('0xd7'))){_0x3c7dcb['limit']=qs[_0x14da('0x1b')](_0x30581f[_0x14da('0x45')][_0x14da('0x1b')]);_0x3c7dcb[_0x14da('0xd8')]=qs[_0x14da('0xd8')](_0x30581f[_0x14da('0x45')][_0x14da('0xd8')]);}return _0x5afb97[_0x14da('0xee')](_0x3c7dcb);}})['then'](function(_0x49c4fe){if(_0x49c4fe){return _0x49c4fe?{'count':_0x431209,'rows':_0x49c4fe}:null;}})[_0x14da('0x1e')](respondWithResult(_0x1b8952,null))[_0x14da('0x28')](handleError(_0x1b8952,null));};exports[_0x14da('0xef')]=function(_0x592186,_0x4d63cf,_0x2424af){var _0x344c9e;var _0x3cb4e2;var _0x394b1c;var _0x5591ef=!_[_0x14da('0x64')](_0x592186['params']['id'])?_0x592186[_0x14da('0x56')]['id']:!_[_0x14da('0x64')](_0x592186['user']['id'])?_0x592186['user']['id']:null;return db[_0x14da('0x39')][_0x14da('0x59')]({'where':{'id':_0x5591ef,'role':{'$or':[_0x14da('0x2d'),_0x14da('0x7c'),_0x14da('0x2b')]}},'attributes':['id',_0x14da('0x35'),_0x14da('0xf0'),_0x14da('0xf1'),'role',_0x14da('0x61'),_0x14da('0x99')]})[_0x14da('0x1e')](function(_0x1567a1){if(_0x1567a1){if(_0x1567a1['role']===_0x14da('0x2b')){_0x344c9e=_0x1567a1;if(_0x592186[_0x14da('0x5d')][_0x14da('0x9b')]){_0x394b1c=util[_0x14da('0xa9')]('LOCAL/%s@from-sip/n',_0x344c9e[_0x592186[_0x14da('0x5d')][_0x14da('0x9b')]]);}else if(_0x592186[_0x14da('0x5d')][_0x14da('0xf2')]){_0x394b1c=util[_0x14da('0xa9')]('SIP/%s',_0x592186['body'][_0x14da('0xf2')]);}else{_0x394b1c=util[_0x14da('0xa9')]('SIP/%s',_0x344c9e[_0x14da('0x35')]);}socket['to'](util['format'](_0x14da('0xf3'),_0x344c9e[_0x14da('0x35')]))['emit'](_0x14da('0xf4'),{'user':{'id':_0x344c9e['id'],'name':_0x344c9e['name']},'ip':_0x592186[_0x14da('0xf5')][_0x14da('0xf6')]||_0x592186[_0x14da('0xf7')][_0x14da('0xf8')]||_0x592186[_0x14da('0xf9')][_0x14da('0xf8')]||_0x592186['connection'][_0x14da('0xf9')][_0x14da('0xf8')]});return db[_0x14da('0xab')]['destroy']({'where':{'membername':_0x344c9e[_0x14da('0x35')]},'individualHooks':!![]});}}else{throw new db[(_0x14da('0x90'))][(_0x14da('0x8d'))](_0x14da('0xfa'));}})[_0x14da('0x1e')](function(){if(_0x344c9e){return _0x344c9e[_0x14da('0xfb')]({'raw':!![]});}})[_0x14da('0x1e')](function(_0x674144){if(_0x344c9e){if(_0x674144){_0x3cb4e2=_0x674144;if(_0x3cb4e2[_0x14da('0x4f')]){var _0x55bcda=_0x3cb4e2[_0x14da('0x32')](function(_0x1704f0){var _0x549b9b={'membername':_0x344c9e[_0x14da('0x35')],'UserId':_0x344c9e['id'],'queue_name':_0x1704f0[_0x14da('0x35')],'VoiceQueueId':_0x1704f0['id'],'interface':_0x394b1c,'paused':_0x344c9e[_0x14da('0x99')]||![],'penalty':_0x1704f0[_0x14da('0xfc')]||0x0};return db[_0x14da('0xab')][_0x14da('0xac')](_0x549b9b);});return Promise[_0x14da('0x54')](_0x55bcda);}}}})[_0x14da('0x1e')](function(){if(_0x344c9e){return db['MemberReport'][_0x14da('0x88')]({'where':{'membername':_0x344c9e[_0x14da('0x35')],'exitAt':null}});}})[_0x14da('0x1e')](function(_0x376791){if(_0x344c9e){var _0x2da724=[];_0x376791[_0x14da('0xfd')](function(_0xab397d){_0x2da724['push'](_0xab397d['update']({'exitAt':moment()[_0x14da('0xa9')](_0x14da('0xfe'))}));});return Promise['all'](_0x2da724);}})[_0x14da('0x1e')](function(){if(_0x344c9e){var _0x3b8044=[];var _0x1e4a50=[];var _0x21601d=utils[_0x14da('0xff')]();var _0x3ce7e6={'membername':_0x344c9e[_0x14da('0x35')],'interface':_0x394b1c,'enterAt':moment()[_0x14da('0xa9')](_0x14da('0xfe')),'role':_0x344c9e[_0x14da('0x2a')],'internal':_0x344c9e[_0x14da('0x61')]};_0x21601d[_0x14da('0xfd')](function(_0xaab26a){_0x3b8044[_0x14da('0x4c')](_[_0x14da('0x58')]({'channel':_0xaab26a,'type':_0x14da('0x100'),'data1':_0x592186['body']['device'],'data2':_0x394b1c},_0x3ce7e6));if(_0x344c9e[_0x14da('0x99')]){_0x1e4a50[_0x14da('0x4c')](_[_0x14da('0x58')]({'channel':_0xaab26a,'type':_0x14da('0x101'),'data1':_0x14da('0x102')},_0x3ce7e6));}});return db[_0x14da('0x103')]['bulkCreate'](_0x3b8044[_0x14da('0xc8')](_0x1e4a50),{'individualHooks':!![]});}})[_0x14da('0x1e')](function(){if(_0x344c9e){return _0x344c9e['update']({'online':!![],'lastLoginAt':moment()[_0x14da('0xa9')](_0x14da('0xfe')),'voicePause':_0x344c9e['loginInPause']||![],'mailPause':_0x344c9e['loginInPause']||![],'chatPause':_0x344c9e[_0x14da('0x99')]||![],'faxPause':_0x344c9e[_0x14da('0x99')]||![],'smsPause':_0x344c9e[_0x14da('0x99')]||![],'openchannelPause':_0x344c9e[_0x14da('0x99')]||![],'whatsappPause':_0x344c9e[_0x14da('0x99')]||![],'pauseType':_0x344c9e[_0x14da('0x99')]?'LOGININPAUSE':null,'interface':_0x394b1c,'lastPauseAt':moment()[_0x14da('0xa9')](_0x14da('0xfe'))});}})['then'](function(_0x466760){if(_0x592186['isMiddleware']){return _0x2424af();}else{return Promise[_0x14da('0x104')](_0x466760)[_0x14da('0x1e')](respondWithResult(_0x4d63cf,null));}})[_0x14da('0x28')](handleError(_0x4d63cf,null));};exports[_0x14da('0x105')]=function(_0x212eca,_0x163c98){var _0x156860;return db[_0x14da('0x39')][_0x14da('0x59')]({'where':{'id':_0x212eca[_0x14da('0x56')]['id'],'role':_0x14da('0x2b')},'attributes':['id',_0x14da('0x35'),'role']})['then'](handleEntityNotFound(_0x163c98,null))[_0x14da('0x1e')](function(_0xa3677e){if(_0xa3677e){_0x156860=_0xa3677e;return db[_0x14da('0xab')][_0x14da('0x106')]({'where':{'membername':_0x156860[_0x14da('0x35')]},'individualHooks':!![]});}})['then'](function(){return db[_0x14da('0x103')][_0x14da('0x88')]({'where':{'membername':_0x156860['name'],'exitAt':null}});})[_0x14da('0x1e')](function(_0x2bd93c){var _0x2c6692=[];_0x2bd93c[_0x14da('0xfd')](function(_0x4bdfcb){_0x2c6692[_0x14da('0x4c')](_0x4bdfcb[_0x14da('0x29')]({'exitAt':moment()[_0x14da('0xa9')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0x2c6692);})[_0x14da('0x1e')](function(){return _0x156860[_0x14da('0x29')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x14da('0x1e')](respondWithResult(_0x163c98,null))[_0x14da('0x28')](handleError(_0x163c98,null));};exports['pause']=function(_0x59bf0b,_0x30a66e){var _0x54656e;return db[_0x14da('0xab')][_0x14da('0x29')]({'paused':0x1},{'where':{'UserId':_0x59bf0b['params']['id']},'individualHooks':!![]})[_0x14da('0x1e')](function(){return db[_0x14da('0x39')][_0x14da('0x59')]({'where':{'id':_0x59bf0b['params']['id'],'role':_0x14da('0x2b')},'attributes':['id',_0x14da('0x35'),'role',_0x14da('0x61'),_0x14da('0x9b'),'online']});})[_0x14da('0x1e')](handleEntityNotFound(_0x30a66e,null))['then'](function(_0x5dc224){if(_0x5dc224){_0x54656e=_0x5dc224;return respondWithRpcPromise(_0x14da('0x107'),_0x14da('0x108'),{'id':_0x54656e['id'],'name':_0x54656e[_0x14da('0x35')],'pause':!![]});}})['then'](function(){if(_0x54656e){return db[_0x14da('0x103')]['findAll']({'where':{'membername':_0x54656e[_0x14da('0x35')],'type':_0x14da('0x101'),'exitAt':null}});}})['then'](function(_0x174544){if(_0x174544[_0x14da('0x4f')]){var _0x2818d5=moment()[_0x14da('0xa9')](_0x14da('0xfe'));for(var _0x237649=0x0,_0x5f5d14=_0x174544[_0x14da('0x4f')];_0x237649<_0x5f5d14;_0x237649++){_0x174544[_0x237649][_0x14da('0x109')]({'exitAt':_0x2818d5});}}})['then'](function(){var _0x3196a8=[];var _0x32b5df=utils[_0x14da('0xff')]();_0x32b5df[_0x14da('0xfd')](function(_0x328c1b){_0x3196a8[_0x14da('0x4c')]({'channel':_0x328c1b,'membername':_0x54656e[_0x14da('0x35')],'interface':_[_0x14da('0x64')](_0x54656e[_0x14da('0x9b')])?util[_0x14da('0xa9')](_0x14da('0xaa'),_0x54656e[_0x14da('0x35')]):_0x54656e[_0x14da('0x9b')],'type':_0x14da('0x101'),'enterAt':moment()[_0x14da('0xa9')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x59bf0b[_0x14da('0x5d')][_0x14da('0x3b')]||_0x14da('0x10a'),'role':_0x54656e[_0x14da('0x2a')],'internal':_0x54656e[_0x14da('0x61')]});});return db[_0x14da('0x103')]['bulkCreate'](_0x3196a8,{'individualHooks':!![]});})[_0x14da('0x1e')](function(){return _0x54656e['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x59bf0b[_0x14da('0x5d')][_0x14da('0x3b')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x14da('0xa9')]('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x30a66e,null))[_0x14da('0x28')](handleError(_0x30a66e,null));};exports['unpause']=function(_0x4ec96c,_0x4b37c3){if(_0x4ec96c[_0x14da('0x5d')][_0x14da('0xae')]&&!utils['isValidChannel'](_0x4ec96c['body']['channel'])){throw new APIBadRequestError(util['format'](_0x14da('0x10b'),_0x4ec96c[_0x14da('0x5d')]['channel']));}return db[_0x14da('0x39')][_0x14da('0x59')]({'where':{'id':_0x4ec96c[_0x14da('0x56')]['id']},'attributes':['id',_0x14da('0x35'),_0x14da('0x2a'),_0x14da('0x61'),'interface',_0x14da('0x98'),_0x14da('0x9a'),'mailPause',_0x14da('0x10c'),_0x14da('0x10d'),_0x14da('0x10e'),'smsPause',_0x14da('0x10f'),_0x14da('0x110'),_0x14da('0x111')]})[_0x14da('0x1e')](function(_0x279ccc){if(!_0x279ccc){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x4ec96c['params']['id']));}return _0x279ccc['unpause'](_0x4ec96c['body'][_0x14da('0xae')]);})[_0x14da('0x1e')](respondWithResult(_0x4b37c3,null))[_0x14da('0x28')](APIHandleError(_0x4b37c3));};exports[_0x14da('0x112')]=function(_0x533352,_0x3e4082){var _0x26631e={};var _0x156fb4={};var _0x33920d;var _0x29b01b;return db[_0x14da('0x39')][_0x14da('0xdc')]({'where':{'id':_0x533352[_0x14da('0x56')]['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0x3e4082,null))['then'](function(_0x30c9ce){if(_0x30c9ce){_0x33920d=_0x30c9ce;_0x156fb4[_0x14da('0xcf')]=_[_0x14da('0xd0')](db[_0x14da('0x113')]['rawAttributes']);_0x156fb4['query']=_[_0x14da('0xd0')](_0x533352['query']);_0x156fb4[_0x14da('0xd2')]=_[_0x14da('0xd3')](_0x156fb4[_0x14da('0xcf')],_0x156fb4[_0x14da('0x45')]);_0x26631e[_0x14da('0x4b')]=_['intersection'](_0x156fb4['model'],qs[_0x14da('0xda')](_0x533352[_0x14da('0x45')][_0x14da('0xda')]));_0x26631e[_0x14da('0x4b')]=_0x26631e[_0x14da('0x4b')][_0x14da('0x4f')]?_0x26631e[_0x14da('0x4b')]:_0x156fb4['model'];_0x26631e[_0x14da('0xe0')]=qs[_0x14da('0xd4')](_0x533352['query']['sort']);_0x26631e['where']=qs[_0x14da('0xd2')](_[_0x14da('0xd5')](_0x533352[_0x14da('0x45')],_0x156fb4['filters']));if(_0x533352['query'][_0x14da('0x3d')]){_0x26631e[_0x14da('0x44')]=_[_0x14da('0x58')](_0x26631e['where'],{'$or':_['map'](_0x26631e['attributes'],function(_0x216c2c){var _0x100660={};_0x100660[_0x216c2c]={'$like':'%'+_0x533352[_0x14da('0x45')][_0x14da('0x3d')]+'%'};return _0x100660;})});}_0x26631e=_['merge']({},_0x26631e,_0x533352['options']);return _0x33920d[_0x14da('0x112')](_0x26631e);}})[_0x14da('0x1e')](function(_0x21291e){if(_0x21291e){_0x29b01b=_0x21291e['length'];if(!_0x533352[_0x14da('0x45')][_0x14da('0xcb')](_0x14da('0xd7'))){_0x26631e[_0x14da('0x1b')]=qs[_0x14da('0x1b')](_0x533352[_0x14da('0x45')][_0x14da('0x1b')]);_0x26631e[_0x14da('0xd8')]=qs[_0x14da('0xd8')](_0x533352[_0x14da('0x45')][_0x14da('0xd8')]);}return _0x33920d[_0x14da('0x112')](_0x26631e);}})[_0x14da('0x1e')](function(_0x58a196){if(_0x58a196){return _0x58a196?{'count':_0x29b01b,'rows':_0x58a196}:null;}})[_0x14da('0x1e')](respondWithResult(_0x3e4082,null))[_0x14da('0x28')](handleError(_0x3e4082,null));};exports[_0x14da('0x114')]=function(_0x1312de,_0x78bf95){var _0x33f0e7=_0x1312de[_0x14da('0x56')]['id'];var _0x272a8f=_0x1312de[_0x14da('0x5d')]?_0x1312de[_0x14da('0x5d')][_0x14da('0x5f')]:null;var _0x71383a=[];return Promise[_0x14da('0x104')]()[_0x14da('0x1e')](function(){if(!_0x272a8f)throw new APIBadRequestError(_0x14da('0x115'));})[_0x14da('0x1e')](function(){return db[_0x14da('0x39')][_0x14da('0xdc')]({'where':{'id':_0x33f0e7}});})['then'](function(_0x53e2de){if(!_0x53e2de)throw new APINotFoundError(util[_0x14da('0xa9')](_0x14da('0xca'),_0x1312de[_0x14da('0x56')]['id']));return db[_0x14da('0x67')][_0x14da('0x116')](function(_0x26e8ac){return _0x53e2de[_0x14da('0x114')](_0x272a8f,{'transaction':_0x26e8ac})[_0x14da('0x1e')](function(){return db['Team'][_0x14da('0x88')]({'where':{'id':{'$in':_0x272a8f}}});})[_0x14da('0x1e')](function(_0x441aed){var _0x2c7263=_['map'](_0x441aed,function(_0x2e5663){return _0x2e5663[_0x14da('0x117')]();});return Promise[_0x14da('0x54')](_0x2c7263);})['then'](function(_0x8b6c36){_0x71383a=_['flattenDeep'](_0x8b6c36);var _0xaa75=_[_0x14da('0x32')](_0x71383a,function(_0x278d03){return _0x278d03['addAgent'](_0x53e2de['id'],{'transaction':_0x26e8ac});});return Promise[_0x14da('0x54')](_0xaa75);})[_0x14da('0x1e')](function(){if(!_0x53e2de['online'])return;var _0x24f3b8=_[_0x14da('0x3d')](_0x71383a,function(_0xf6bed8){return _0xf6bed8['getDataValue'](_0x14da('0xae'))==='Voice';});var _0x39d08b=_[_0x14da('0x32')](_0x24f3b8,function(_0x4e2cb1){return db[_0x14da('0xab')][_0x14da('0xac')]({'membername':_0x53e2de[_0x14da('0x35')],'UserId':_0x53e2de['id'],'queue_name':_0x4e2cb1[_0x14da('0x35')],'VoiceQueueId':_0x4e2cb1['id'],'interface':_['isNil'](_0x53e2de[_0x14da('0x9b')])?util[_0x14da('0xa9')](_0x14da('0xaa'),_0x53e2de[_0x14da('0x35')]):_0x53e2de[_0x14da('0x9b')],'paused':_0x53e2de[_0x14da('0x9a')]||![],'penalty':_0x53e2de['penalty']},{'transaction':_0x26e8ac});});return Promise[_0x14da('0x54')](_0x39d08b);})[_0x14da('0x1e')](function(){return db[_0x14da('0x118')][_0x14da('0x88')]({'where':{'teamId':{'$in':_0x272a8f}}});})[_0x14da('0x1e')](function(_0x482216){var _0x472382=_[_0x14da('0x32')](_0x482216,function(_0x1d3ce0){return db[_0x14da('0x119')][_0x14da('0x7b')]({'UserId':_0x53e2de['id'],'VoicePrefixId':_0x1d3ce0[_0x14da('0x11a')]},{'transaction':_0x26e8ac});});return Promise['all'](_0x472382);});});})[_0x14da('0x1e')](function(){for(var _0x320eb2=0x0;_0x320eb2<_0x71383a['length'];_0x320eb2++){var _0x1ff87a=_0x71383a[_0x320eb2][_0x14da('0x11b')](_0x14da('0xae'));var _0x12026e=_0x1ff87a+_0x14da('0xa4');socket['emit'](_0x14da('0x7c')+_0x1ff87a+_0x14da('0xa6'),{'UserId':_0x33f0e7,['queueField']:_0x71383a[_0x320eb2]['id']});}})[_0x14da('0x1e')](respondWithStatusCode(_0x78bf95,null))[_0x14da('0x28')](APIHandleError(_0x78bf95));};exports[_0x14da('0x11c')]=function(_0x2862f8,_0x22728c){var _0x1bd7f8=_0x2862f8[_0x14da('0x56')]['id'];var _0x3c0fb8=null;if(_0x2862f8[_0x14da('0x45')][_0x14da('0x5f')]){_0x3c0fb8=_[_0x14da('0xaf')](_0x2862f8[_0x14da('0x45')][_0x14da('0x5f')])?_0x2862f8[_0x14da('0x45')][_0x14da('0x5f')]:[_0x2862f8['query'][_0x14da('0x5f')]];}var _0x1bda56=[];return Promise['resolve']()['then'](function(){if(!_0x3c0fb8)throw new APIBadRequestError(_0x14da('0x11d'));})[_0x14da('0x1e')](function(){return db['User'][_0x14da('0xdc')]({'where':{'id':_0x1bd7f8}});})[_0x14da('0x1e')](function(_0x24c5c8){if(!_0x24c5c8)throw new APINotFoundError(util[_0x14da('0xa9')]('User\x20with\x20id\x20%s\x20not\x20found',_0x2862f8[_0x14da('0x56')]['id']));return db[_0x14da('0x67')][_0x14da('0x116')](function(_0x1be069){return _0x24c5c8['removeTeams'](_0x3c0fb8,{'transaction':_0x1be069})[_0x14da('0x1e')](function(){return db[_0x14da('0x113')][_0x14da('0x88')]({'where':{'id':{'$in':_0x3c0fb8}}});})[_0x14da('0x1e')](function(_0x3d87ae){var _0x2a0f88=_[_0x14da('0x32')](_0x3d87ae,function(_0x3e6144){return _0x3e6144[_0x14da('0x117')]();});return Promise['all'](_0x2a0f88);})[_0x14da('0x1e')](function(_0x171a39){_0x1bda56=_[_0x14da('0x11e')](_0x171a39);var _0x188f3c=_[_0x14da('0x32')](_0x1bda56,function(_0x2f1832){return _0x2f1832[_0x14da('0x11f')](_0x24c5c8['id'],{'transaction':_0x1be069});});return Promise[_0x14da('0x54')](_0x188f3c);})[_0x14da('0x1e')](function(){if(!_0x24c5c8[_0x14da('0x98')])return;var _0x598d3a=_[_0x14da('0x3d')](_0x1bda56,function(_0x2b58a7){return _0x2b58a7[_0x14da('0x11b')](_0x14da('0xae'))===_0x14da('0x120');});var _0x1abbea=_['map'](_0x598d3a,function(_0x3ab617){return db[_0x14da('0xab')][_0x14da('0x106')]({'where':{'VoiceQueueId':_0x3ab617['id'],'UserId':_0x24c5c8['id']},'transaction':_0x1be069});});return Promise[_0x14da('0x54')](_0x1abbea);})[_0x14da('0x1e')](function(){return db['TeamVoicePrefix'][_0x14da('0x88')]({'where':{'teamId':{'$in':_0x3c0fb8}}});})[_0x14da('0x1e')](function(_0x398a16){var _0x24bd20=_[_0x14da('0x32')](_0x398a16,function(_0x3f8ad8){return db[_0x14da('0x119')][_0x14da('0x106')]({'where':{'UserId':_0x24c5c8['id'],'VoicePrefixId':_0x3f8ad8[_0x14da('0x11a')]}},{'transaction':_0x1be069});});return Promise[_0x14da('0x54')](_0x24bd20);});});})[_0x14da('0x1e')](function(){for(var _0x31ed11=0x0;_0x31ed11<_0x1bda56[_0x14da('0x4f')];_0x31ed11++){var _0x37c196=_0x1bda56[_0x31ed11][_0x14da('0x11b')](_0x14da('0xae'));var _0x3131aa=_0x37c196+_0x14da('0xa4');socket[_0x14da('0xa5')](_0x14da('0x7c')+_0x37c196+_0x14da('0xb0'),{'UserId':_0x1bd7f8,['queueField']:_0x1bda56[_0x31ed11]['id']});}})[_0x14da('0x1e')](respondWithStatusCode(_0x22728c,null))[_0x14da('0x28')](APIHandleError(_0x22728c));};exports[_0x14da('0x121')]=function(_0x203261,_0x295ebc){var _0x56ec24={};var _0x22cdfb={};var _0x1058ae;var _0x20ddb3;return db['User'][_0x14da('0xdc')]({'where':{'id':_0x203261[_0x14da('0x56')]['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0x295ebc,null))[_0x14da('0x1e')](function(_0x53ef83){if(_0x53ef83){_0x1058ae=_0x53ef83;_0x22cdfb[_0x14da('0xcf')]=_[_0x14da('0xd0')](db[_0x14da('0xcc')][_0x14da('0x3a')]);_0x22cdfb[_0x14da('0x45')]=_['keys'](_0x203261[_0x14da('0x45')]);_0x22cdfb['filters']=_['intersection'](_0x22cdfb[_0x14da('0xcf')],_0x22cdfb['query']);_0x56ec24[_0x14da('0x4b')]=_[_0x14da('0xd3')](_0x22cdfb[_0x14da('0xcf')],qs[_0x14da('0xda')](_0x203261[_0x14da('0x45')][_0x14da('0xda')]));_0x56ec24['attributes']=_0x56ec24[_0x14da('0x4b')][_0x14da('0x4f')]?_0x56ec24[_0x14da('0x4b')]:_0x22cdfb['model'];_0x56ec24['order']=qs[_0x14da('0xd4')](_0x203261[_0x14da('0x45')]['sort']);_0x56ec24['where']=qs['filters'](_[_0x14da('0xd5')](_0x203261[_0x14da('0x45')],_0x22cdfb[_0x14da('0xd2')]));if(_0x203261[_0x14da('0x45')][_0x14da('0x3d')]){_0x56ec24['where']=_[_0x14da('0x58')](_0x56ec24['where'],{'$or':_[_0x14da('0x32')](_0x56ec24[_0x14da('0x4b')],function(_0x263b07){var _0x5d1cd5={};_0x5d1cd5[_0x263b07]={'$like':'%'+_0x203261[_0x14da('0x45')][_0x14da('0x3d')]+'%'};return _0x5d1cd5;})});}_0x56ec24=_['merge']({},_0x56ec24,_0x203261[_0x14da('0xd6')]);return _0x1058ae[_0x14da('0x121')](_0x56ec24);}})[_0x14da('0x1e')](function(_0x10568b){if(_0x10568b){_0x20ddb3=_0x10568b[_0x14da('0x4f')];if(!_0x203261[_0x14da('0x45')][_0x14da('0xcb')](_0x14da('0xd7'))){_0x56ec24[_0x14da('0x1b')]=qs[_0x14da('0x1b')](_0x203261[_0x14da('0x45')][_0x14da('0x1b')]);_0x56ec24[_0x14da('0xd8')]=qs['offset'](_0x203261['query']['offset']);}return _0x1058ae['getLists'](_0x56ec24);}})[_0x14da('0x1e')](function(_0x289b09){if(_0x289b09){return _0x289b09?{'count':_0x20ddb3,'rows':_0x289b09}:null;}})[_0x14da('0x1e')](respondWithResult(_0x295ebc,null))[_0x14da('0x28')](handleError(_0x295ebc,null));};exports[_0x14da('0x122')]=function(_0x2719ba,_0x1cc20b){var _0x3d6d9d={};var _0x50b3da={};var _0x5e7244;return db['User']['findOne']({'where':{'id':_0x2719ba[_0x14da('0x56')]['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0x1cc20b,null))[_0x14da('0x1e')](function(_0x31928f){if(_0x31928f){_0x5e7244=_0x31928f;_0x50b3da[_0x14da('0xcf')]=_[_0x14da('0xd0')](db[_0x14da('0x39')]['rawAttributes']);_0x50b3da['query']=_[_0x14da('0xd0')](_0x2719ba[_0x14da('0x45')]);_0x50b3da[_0x14da('0xd2')]=_[_0x14da('0xd3')](_0x50b3da[_0x14da('0xcf')],_0x50b3da[_0x14da('0x45')]);_0x3d6d9d[_0x14da('0x4b')]=_['intersection'](_0x50b3da[_0x14da('0xcf')],qs[_0x14da('0xda')](_0x2719ba[_0x14da('0x45')]['fields']));_0x3d6d9d[_0x14da('0x4b')]=_0x3d6d9d[_0x14da('0x4b')]['length']?_0x3d6d9d[_0x14da('0x4b')]:_0x50b3da[_0x14da('0xcf')];_0x3d6d9d[_0x14da('0xe0')]=qs['sort'](_0x2719ba[_0x14da('0x45')][_0x14da('0xd4')]);_0x3d6d9d[_0x14da('0x44')]=qs[_0x14da('0xd2')](_[_0x14da('0xd5')](_0x2719ba[_0x14da('0x45')],_0x50b3da[_0x14da('0xd2')]));if(_0x2719ba[_0x14da('0x45')][_0x14da('0x3d')]){_0x3d6d9d[_0x14da('0x44')]=_[_0x14da('0x58')](_0x3d6d9d['where'],{'$or':_[_0x14da('0x32')](_0x3d6d9d[_0x14da('0x4b')],function(_0x5a591e){var _0x4992f7={};_0x4992f7[_0x5a591e]={'$like':'%'+_0x2719ba[_0x14da('0x45')][_0x14da('0x3d')]+'%'};return _0x4992f7;})});}_0x3d6d9d['model']=db[_0x14da('0x39')];_0x3d6d9d['as']=_0x14da('0x81');_0x3d6d9d=_[_0x14da('0x58')]({},_0x3d6d9d,_0x2719ba[_0x14da('0xd6')]);return _0x5e7244['getVoiceQueues']({'include':[_0x3d6d9d]});}})[_0x14da('0x1e')](function(_0x541cea){if(_0x541cea){var _0x52c174={},_0x678efb=[];for(var _0x5d08b0=0x0;_0x5d08b0<_0x541cea['length'];_0x5d08b0+=0x1){for(var _0x25498b=0x0,_0x29623b;_0x25498b<_0x541cea[_0x5d08b0]['Agents'][_0x14da('0x4f')];_0x25498b+=0x1){_0x29623b=_0x541cea[_0x5d08b0]['Agents'][_0x25498b]['get']({'plain':!![]});_0x52c174[_0x29623b['id']]=_0x29623b;}}_0x52c174=_['values'](_0x52c174);for(var _0x494551=qs[_0x14da('0xd8')](_0x2719ba[_0x14da('0x45')][_0x14da('0xd8')]);_0x494551<_0x52c174['length']&&_0x678efb[_0x14da('0x4f')]=_0x3c27f2){_0x4ef169=_0x3c27f2;_0x40e994=0xc8;}else{_0x40e994=0xce;}_0x5ba3b5[_0x4c4d('0x16')](_0x40e994);return _0x5ba3b5[_0x4c4d('0x1b')]('Content-Range',_0x204eb1+'-'+_0x4ef169+'/'+_0x3c27f2)[_0x4c4d('0x17')](_0x5f2b73);}return null;};}function respondWithRpcPromise(_0x298479,_0x42a554,_0x4e809c,_0x25e033){return new Promise(function(_0x3334b3,_0x38396e){var _0x230948=_0x25e033||amiClient;return _0x230948[_0x4c4d('0x1c')](_0x298479,_0x4e809c)[_0x4c4d('0x1d')](function(_0x4e9696){logger[_0x4c4d('0x1e')](_0x4c4d('0x1f'),_0x42a554,_0x4c4d('0x20'));logger[_0x4c4d('0x21')](_0x4c4d('0x22'),_0x42a554,_0x4c4d('0x20'),JSON[_0x4c4d('0x23')](_0x4e9696));if(_0x4e9696[_0x4c4d('0x24')]){if(_0x4e9696[_0x4c4d('0x24')][_0x4c4d('0x25')]===0x1f4){logger[_0x4c4d('0x24')](_0x4c4d('0x1f'),_0x42a554,_0x4e9696[_0x4c4d('0x24')]['message']);return _0x38396e(_0x4e9696[_0x4c4d('0x24')][_0x4c4d('0x26')]);}logger['error'](_0x4c4d('0x1f'),_0x42a554,_0x4e9696[_0x4c4d('0x24')][_0x4c4d('0x26')]);return _0x3334b3(_0x4e9696[_0x4c4d('0x24')][_0x4c4d('0x26')]);}else{logger['info'](_0x4c4d('0x1f'),_0x42a554,_0x4c4d('0x20'));_0x3334b3(_0x4e9696[_0x4c4d('0x27')][_0x4c4d('0x26')]);}})[_0x4c4d('0x28')](function(_0x28333f){logger['error'](_0x4c4d('0x1f'),_0x42a554,_0x28333f);_0x38396e(_0x28333f);});});}function saveUpdates(_0x15af7c){return function(_0x4c0db4){if(_0x4c0db4){return _0x4c0db4['update'](_0x15af7c)[_0x4c4d('0x1d')](function(_0x206085){if(_0x206085['role']===_0x4c4d('0x29')){socket['emit'](_0x4c4d('0x2a')+_0x206085['id'],_0x206085);}return _0x206085;});}return null;};}function removeEntity(_0x2a92f1,_0x485c09){return function(_0x5d510d){if(_0x5d510d){return _0x5d510d[_0x4c4d('0x2b')]({'transaction':_0x485c09})['then'](function(){var _0x41365e=_0x5d510d[_0x4c4d('0x2c')]({'plain':!![]});if(_0x41365e[_0x4c4d('0x2d')]===_0x4c4d('0x2e'))return;var _0x4ff26d=[{'name':'Users','value':'user','ignore':!![]},{'name':_0x4c4d('0x2f'),'value':_0x4c4d('0x29'),'ignore':![]},{'name':_0x4c4d('0x30'),'value':_0x4c4d('0x31'),'ignore':![]}];var _0x4cd4c9=_(_0x4ff26d)[_0x4c4d('0x32')](_0x4c4d('0x33'))['map'](_0x4c4d('0x34'))[_0x4c4d('0x34')]();if(_[_0x4c4d('0x35')](_0x4cd4c9,_0x41365e[_0x4c4d('0x2d')])){return;}var _0x4ee62c=_['find'](_0x4ff26d,[_0x4c4d('0x34'),_0x41365e[_0x4c4d('0x2d')]])[_0x4c4d('0x36')];return db[_0x4c4d('0x37')][_0x4c4d('0x2b')]({'where':{'type':_0x4ee62c,'resourceId':_0x41365e['id']},'transaction':_0x485c09})[_0x4c4d('0x1d')](function(){return _0x5d510d;});})['then'](function(){_0x2a92f1[_0x4c4d('0x16')](0xcc)[_0x4c4d('0x38')]();});}};}function handleEntityNotFound(_0x5f00e7){return function(_0x20d681){if(!_0x20d681){_0x5f00e7[_0x4c4d('0x15')](0x194);}return _0x20d681;};}function handleError(_0x2652c4,_0x32824d){_0x32824d=_0x32824d||0x1f4;return function(_0xdc96d8){logger[_0x4c4d('0x24')](_0xdc96d8[_0x4c4d('0x39')]);if(_0xdc96d8[_0x4c4d('0x36')]){delete _0xdc96d8[_0x4c4d('0x36')];}_0x2652c4[_0x4c4d('0x16')](_0x32824d)['send'](_0xdc96d8);};}function getUserAttributes(){return _(db[_0x4c4d('0x3a')][_0x4c4d('0x3b')])[_0x4c4d('0x3c')](function(_0x5160e9){return{'name':_0x5160e9['fieldName'],'type':_0x5160e9[_0x4c4d('0x3d')][_0x4c4d('0x3e')]};})[_0x4c4d('0x32')](function(_0x58cbd5){return![_0x4c4d('0x3f'),_0x4c4d('0x40'),'previousPasswords',_0x4c4d('0x41'),'resetPasswordExpires',_0x4c4d('0x42')][_0x4c4d('0x35')](_0x58cbd5['name']);})['value']();}exports[_0x4c4d('0x43')]=function(_0x4a8e06,_0x2d0668){var _0x328e8b={},_0x3ee292={'count':0x0,'rows':[]};var _0x1eec6f=getUserAttributes();_0x328e8b=qs['getOptions'](_0x1eec6f,_0x4a8e06);var _0x28d105={'where':_0x328e8b['where']};return db[_0x4c4d('0x3a')][_0x4c4d('0x44')](_0x28d105)[_0x4c4d('0x1d')](function(_0x522672){_0x3ee292[_0x4c4d('0x44')]=_0x522672;if(_0x4a8e06[_0x4c4d('0x45')]['includeAll']){_0x328e8b['include']=[{'all':!![]}];}if(_0x4a8e06[_0x4c4d('0x45')][_0x4c4d('0x46')]===_0x4c4d('0x47')){_0x328e8b[_0x4c4d('0x48')]=[{'model':db[_0x4c4d('0x49')],'as':_0x4c4d('0x46')}];}if(!_['includes'](_0x328e8b[_0x4c4d('0x4a')],'id')){_0x328e8b['attributes'][_0x4c4d('0x4b')]('id');}return db[_0x4c4d('0x3a')]['findAll'](_0x328e8b);})[_0x4c4d('0x1d')](function(_0x4c52ed){_0x3ee292['rows']=_0x4c52ed;if(_0x4a8e06[_0x4c4d('0x45')][_0x4c4d('0x4c')]===_0x4c4d('0x47')){var _0x2f6ffa=[];for(var _0x778ed=0x0;_0x778ed<_0x3ee292['rows']['length'];_0x778ed++){_0x2f6ffa[_0x4c4d('0x4b')](get_open_tabs(_0x4c4d('0x4d'),_0x3ee292[_0x4c4d('0x4e')][_0x778ed][_0x4c4d('0x4f')]));_0x2f6ffa[_0x4c4d('0x4b')](get_open_tabs(_0x4c4d('0x50'),_0x3ee292[_0x4c4d('0x4e')][_0x778ed][_0x4c4d('0x4f')]));_0x2f6ffa['push'](get_open_tabs('fax',_0x3ee292['rows'][_0x778ed][_0x4c4d('0x4f')]));_0x2f6ffa['push'](get_open_tabs(_0x4c4d('0x51'),_0x3ee292['rows'][_0x778ed][_0x4c4d('0x4f')]));_0x2f6ffa[_0x4c4d('0x4b')](get_open_tabs('openchannel',_0x3ee292[_0x4c4d('0x4e')][_0x778ed][_0x4c4d('0x4f')]));_0x2f6ffa[_0x4c4d('0x4b')](get_open_tabs(_0x4c4d('0x52'),_0x3ee292[_0x4c4d('0x4e')][_0x778ed][_0x4c4d('0x4f')]));}return Promise[_0x4c4d('0x53')](_0x2f6ffa)['then'](function(){return _0x3ee292;});}else{return _0x3ee292;}})[_0x4c4d('0x1d')](respondWithFilteredResult(_0x2d0668,_0x328e8b))[_0x4c4d('0x28')](handleError(_0x2d0668,null));};exports['show']=function(_0x5b9bee,_0x5a5f38){var _0x47823f=getUserAttributes();_0x5b9bee['query']['id']=_0x5b9bee[_0x4c4d('0x54')]['id'];var _0x135212=qs[_0x4c4d('0x55')](_0x47823f,_0x5b9bee);if(_0x5b9bee[_0x4c4d('0x45')][_0x4c4d('0x56')]){_0x135212['include']=[{'all':!![]}];}if(_0x5b9bee[_0x4c4d('0x45')][_0x4c4d('0x46')]===_0x4c4d('0x47')){_0x135212[_0x4c4d('0x48')]=[{'model':db['UserSetting'],'as':_0x4c4d('0x46')}];}_0x135212=_['merge']({},_0x135212,_0x5b9bee[_0x4c4d('0x57')]);if(!_['includes'](_0x135212[_0x4c4d('0x4a')],'id')){_0x135212['attributes'][_0x4c4d('0x4b')]('id');}return db['User'][_0x4c4d('0x58')](_0x135212)[_0x4c4d('0x1d')](handleEntityNotFound(_0x5a5f38,null))[_0x4c4d('0x1d')](function(_0x14ff89){var _0x131335=[];values=_0x14ff89;if(_0x5b9bee[_0x4c4d('0x45')][_0x4c4d('0x4c')]===_0x4c4d('0x47')){_0x131335[_0x4c4d('0x4b')](get_open_tabs(_0x4c4d('0x4d'),_0x14ff89[_0x4c4d('0x4f')]));_0x131335[_0x4c4d('0x4b')](get_open_tabs(_0x4c4d('0x50'),_0x14ff89['dataValues']));_0x131335[_0x4c4d('0x4b')](get_open_tabs('openchannel',_0x14ff89[_0x4c4d('0x4f')]));_0x131335[_0x4c4d('0x4b')](get_open_tabs(_0x4c4d('0x52'),_0x14ff89['dataValues']));_0x131335[_0x4c4d('0x4b')](get_open_tabs(_0x4c4d('0x59'),_0x14ff89[_0x4c4d('0x4f')]));_0x131335['push'](get_open_tabs(_0x4c4d('0x51'),_0x14ff89[_0x4c4d('0x4f')]));return Promise[_0x4c4d('0x53')](_0x131335);}else{return values;}})[_0x4c4d('0x1d')](function(){return values;})[_0x4c4d('0x1d')](respondWithResult(_0x5a5f38,null))['catch'](handleError(_0x5a5f38,null));};exports['update']=function(_0x1f04e6,_0x3af68a){if(_0x1f04e6[_0x4c4d('0x5a')]['id']){delete _0x1f04e6[_0x4c4d('0x5a')]['id'];}delete _0x1f04e6['body'][_0x4c4d('0x2d')];return db['User'][_0x4c4d('0x58')]({'where':{'id':_0x1f04e6[_0x4c4d('0x54')]['id']}})[_0x4c4d('0x1d')](handleEntityNotFound(_0x3af68a,null))[_0x4c4d('0x1d')](saveUpdates(_0x1f04e6[_0x4c4d('0x5a')],null))[_0x4c4d('0x1d')](respondWithResult(_0x3af68a,null))[_0x4c4d('0x28')](handleError(_0x3af68a,null));};exports[_0x4c4d('0x5b')]=function(_0x252a6c,_0x189e93){return db['User'][_0x4c4d('0x5b')]()[_0x4c4d('0x1d')](respondWithResult(_0x189e93,null))['catch'](handleError(_0x189e93,null));};exports[_0x4c4d('0x5c')]=function(_0x15ac7c,_0x5794d3){return db[_0x4c4d('0x3a')][_0x4c4d('0x58')]({'where':{'id':_0x15ac7c['params']['id']}})['then'](handleEntityNotFound(_0x5794d3,null))[_0x4c4d('0x1d')](function(_0xb35f){if(_0xb35f){return _0xb35f[_0x4c4d('0x5c')](_0x15ac7c[_0x4c4d('0x5a')][_0x4c4d('0x5d')],_['omit'](_0x15ac7c[_0x4c4d('0x5a')],[_0x4c4d('0x5d'),'id'])||{});}})['then'](respondWithResult(_0x5794d3,null))[_0x4c4d('0x28')](handleError(_0x5794d3,null));};function validateUser(_0x233da7){return new Promise(function(_0x439089,_0x37a558){if(_0x233da7[_0x4c4d('0x5e')])return _0x439089(_0x233da7);return db[_0x4c4d('0x5f')][_0x4c4d('0x60')](0x1)[_0x4c4d('0x1d')](function(_0x415b5f){if(_0x415b5f[_0x4c4d('0x61')])authService[_0x4c4d('0x62')](_0x233da7[_0x4c4d('0x3f')]);db[_0x4c4d('0x3a')][_0x4c4d('0x63')](_0x4c4d('0x5e'))[_0x4c4d('0x1d')](function(_0x58dfed){if(_[_0x4c4d('0x64')](_0x58dfed)){_0x233da7[_0x4c4d('0x5e')]=_0x415b5f['min_internal']||0x1;return;}if(_[_0x4c4d('0x64')](_0x415b5f[_0x4c4d('0x65')])||_0x415b5f[_0x4c4d('0x65')]===_0x58dfed){_0x233da7['internal']=_0x58dfed+0x1;return;}if(_0x415b5f[_0x4c4d('0x65')]>_0x58dfed){_0x233da7['internal']=_0x415b5f['min_internal'];return;}return db[_0x4c4d('0x66')][_0x4c4d('0x45')](_0x4c4d('0x67'),{'type':db[_0x4c4d('0x66')][_0x4c4d('0x68')][_0x4c4d('0x69')]})['then'](function(_0x5ace9c){if(_0x5ace9c&&_0x5ace9c[_0x4c4d('0x6a')]){for(var _0x5e17ff=0x0,_0x10ada4=_0x5ace9c[_0x4c4d('0x6a')];_0x5e17ff<_0x10ada4&&_[_0x4c4d('0x64')](_0x233da7['internal']);_0x5e17ff++){if(_0x415b5f[_0x4c4d('0x65')]<=_0x5ace9c[_0x5e17ff]['from']){_0x233da7[_0x4c4d('0x5e')]=_0x5ace9c[_0x5e17ff]['from'];}else if(_0x415b5f['min_internal']>_0x5ace9c[_0x5e17ff][_0x4c4d('0x6b')]&&_0x415b5f[_0x4c4d('0x65')]<=_0x5ace9c[_0x5e17ff]['to']){_0x233da7[_0x4c4d('0x5e')]=_0x415b5f['min_internal'];}}}if(_[_0x4c4d('0x64')](_0x233da7['internal'])){_0x233da7[_0x4c4d('0x5e')]=_0x58dfed+0x1;}return _0x439089(_0x233da7);});});})[_0x4c4d('0x28')](function(_0x2957c9){_0x37a558(_0x2957c9);});});}function updateUser(_0x15ab18){return new Promise(function(_0x467b4c,_0x2a55d){try{if(_0x15ab18['voicemail']){_0x15ab18['mailbox']=_0x15ab18[_0x4c4d('0x5e')];_0x15ab18[_0x4c4d('0x6c')]={'mailbox':_0x15ab18['internal'],'password':_0x15ab18[_0x4c4d('0x3f')],'fullname':_0x15ab18[_0x4c4d('0x6d')],'email':_0x15ab18['email']};}if(_0x15ab18[_0x4c4d('0x2d')]===_0x4c4d('0x29')){if(!_0x15ab18[_0x4c4d('0x6e')])_0x15ab18[_0x4c4d('0x6e')]=[_0x4c4d('0x6f'),_0x4c4d('0x70'),_0x4c4d('0x71'),_0x4c4d('0x72'),_0x4c4d('0x73'),'104',_0x4c4d('0x74'),_0x4c4d('0x75'),_0x4c4d('0x76'),_0x4c4d('0x77'),_0x4c4d('0x78'),_0x4c4d('0x79'),'111',_0x4c4d('0x7a'),_0x4c4d('0x7b')];}_0x467b4c(_0x15ab18);}catch(_0x39b8c0){_0x2a55d(_0x39b8c0);}});}exports[_0x4c4d('0x7c')]=function(_0x5531a4,_0x2ff4b0){if(_0x5531a4['user']['role']===_0x4c4d('0x29'))throw new Error('Unauthorized');if(_0x5531a4[_0x4c4d('0x5a')][_0x4c4d('0x2d')]===_0x4c4d('0x7d')&&_0x5531a4[_0x4c4d('0x7d')][_0x4c4d('0x2d')]!==_0x4c4d('0x2e')){throw new Error(_0x4c4d('0x7e'));}if(_0x5531a4['body'][_0x4c4d('0x2d')]==='admin'&&_0x5531a4[_0x4c4d('0x7d')][_0x4c4d('0x2d')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x4c4d('0x7f')]([_0x5531a4['body']])['then'](function(){return validateUser(_0x5531a4[_0x4c4d('0x5a')]);})[_0x4c4d('0x1d')](function(_0x4201d8){return updateUser(_0x4201d8)[_0x4c4d('0x1d')](function(_0x47f666){if(_0x47f666[_0x4c4d('0x2d')]===_0x4c4d('0x2e')){_0x47f666[_0x4c4d('0x80')]=_0x5531a4[_0x4c4d('0x7d')][_0x4c4d('0x80')];delete _0x47f666[_0x4c4d('0x81')];}return _0x47f666;});})[_0x4c4d('0x1d')](function(_0xd6b2f){return db['User'][_0x4c4d('0x7c')](_0xd6b2f,{'include':[{'model':db['VoiceMail'],'as':_0x4c4d('0x6c')}]});})[_0x4c4d('0x1d')](function(_0x47df23){if(_0x5531a4[_0x4c4d('0x5a')][_0x4c4d('0x2d')]===_0x4c4d('0x7d'))return _0x47df23;if(_0x5531a4[_0x4c4d('0x7d')]['role']!=='user')return _0x47df23;return db[_0x4c4d('0x82')][_0x4c4d('0x58')]({'where':{'name':_0x47df23[_0x4c4d('0x2d')]===_0x4c4d('0x29')?_0x4c4d('0x2f'):_0x4c4d('0x30'),'userProfileId':_0x5531a4[_0x4c4d('0x7d')][_0x4c4d('0x81')]},'raw':!![]})[_0x4c4d('0x1d')](function(_0x15e722){if(!_0x15e722||_0x15e722[_0x4c4d('0x83')]!=0x0)return _0x47df23;return db[_0x4c4d('0x37')][_0x4c4d('0x7c')]({'name':_0x47df23['name'],'resourceId':_0x47df23['id'],'type':_0x15e722['name'],'sectionId':_0x15e722['id']},{})[_0x4c4d('0x1d')](function(){return _0x47df23;});})['catch'](function(_0x3124a1){logger['error'](_0x4c4d('0x84'),_0x3124a1);throw _0x3124a1;});})[_0x4c4d('0x1d')](respondWithResult(_0x2ff4b0,0xc9))[_0x4c4d('0x28')](handleError(_0x2ff4b0,null));};exports['bulkCreate']=function(_0x25488e,_0x435b4e){var _0x4051d9=_0x25488e[_0x4c4d('0x5a')];var _0x9adbf=[];if(_0x25488e[_0x4c4d('0x7d')][_0x4c4d('0x2d')]===_0x4c4d('0x29'))throw new Error('Unauthorized');if(_[_0x4c4d('0x85')](_0x4051d9,[_0x4c4d('0x2d'),_0x4c4d('0x7d')])&&_0x25488e[_0x4c4d('0x7d')]['role']!==_0x4c4d('0x2e')){throw new Error(_0x4c4d('0x7e'));}if(_[_0x4c4d('0x85')](_0x4051d9,[_0x4c4d('0x2d'),_0x4c4d('0x2e')])&&_0x25488e[_0x4c4d('0x7d')]['role']!==_0x4c4d('0x2e')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil['checkUserLimits'](_0x4051d9)[_0x4c4d('0x1d')](function(){return validateUser(_0x4051d9[0x0]);})[_0x4c4d('0x1d')](function(){for(var _0x54d429=0x1;_0x54d429<_0x4051d9[_0x4c4d('0x6a')];_0x54d429++){var _0x3f208c=_0x4051d9[_0x54d429-0x1][_0x4c4d('0x5e')];if(!_0x4051d9[_0x54d429][_0x4c4d('0x5e')])_0x4051d9[_0x54d429][_0x4c4d('0x5e')]=_0x3f208c+0x1;_0x9adbf['push'](validateUser(_0x4051d9[_0x54d429]));}return Promise[_0x4c4d('0x53')](_0x9adbf);})['then'](function(){_0x9adbf=[];for(var _0x34d619=0x0;_0x34d619<_0x4051d9[_0x4c4d('0x6a')];_0x34d619++){_0x9adbf['push'](updateUser(_0x4051d9[_0x34d619]));}return Promise[_0x4c4d('0x53')](_0x9adbf);})['then'](function(){_0x9adbf=_0x4051d9[_0x4c4d('0x3c')](function(_0x2a05a3){return db['User']['create'](_0x2a05a3,{'include':[{'model':db[_0x4c4d('0x6c')],'as':_0x4c4d('0x6c')}]})[_0x4c4d('0x1d')](function(_0x4ee89d){_0x2a05a3['id']=_0x4ee89d['id'];return _0x2a05a3;});});return Promise[_0x4c4d('0x53')](_0x9adbf);})[_0x4c4d('0x1d')](function(_0x48554f){if(_0x25488e['body']['role']===_0x4c4d('0x7d'))return _0x48554f;if(_0x25488e[_0x4c4d('0x7d')][_0x4c4d('0x2d')]!==_0x4c4d('0x7d'))return _0x48554f;var _0x5040db=_['some'](_0x48554f,function(_0xad8359){return _0xad8359[_0x4c4d('0x2d')]===_0x4c4d('0x29')||_0xad8359[_0x4c4d('0x2d')]==='telephone';});if(!_0x5040db)return _0x48554f;return db[_0x4c4d('0x82')][_0x4c4d('0x86')]({'where':{'name':{'$or':[_0x4c4d('0x2f'),_0x4c4d('0x30')]},'userProfileId':_0x25488e[_0x4c4d('0x7d')]['userProfileId']},'raw':!![]})[_0x4c4d('0x1d')](function(_0x8f357c){if(_[_0x4c4d('0x87')](_0x8f357c)||!_[_0x4c4d('0x85')](_0x8f357c,[_0x4c4d('0x83'),0x0]))return _0x48554f;_0x9adbf=[];var _0xcb6670=_(_0x8f357c)['map'](function(_0x1d0e98){if(_0x1d0e98['autoAssociation']===0x1)return;return _0x1d0e98[_0x4c4d('0x36')]===_0x4c4d('0x2f')?_0x4c4d('0x29'):_0x4c4d('0x31');})[_0x4c4d('0x88')]()[_0x4c4d('0x34')]();for(var _0x9a1158=0x0;_0x9a1158<_0x48554f[_0x4c4d('0x6a')];_0x9a1158++){if(!_[_0x4c4d('0x35')](_0xcb6670,_0x48554f[_0x9a1158][_0x4c4d('0x2d')]))return;var _0x2fbd4c=_0x48554f[_0x9a1158][_0x4c4d('0x2d')]===_0x4c4d('0x29')?'Agents':_0x4c4d('0x30');_0x9adbf[_0x4c4d('0x4b')](db[_0x4c4d('0x37')][_0x4c4d('0x7c')]({'name':_0x48554f[_0x9a1158][_0x4c4d('0x36')],'resourceId':_0x48554f[_0x9a1158]['id'],'type':_0x2fbd4c,'sectionId':_['find'](_0x8f357c,[_0x4c4d('0x36'),_0x2fbd4c])['id']},{}));}return Promise['all'](_0x9adbf);});})['then'](respondWithResult(_0x435b4e,0xc9))[_0x4c4d('0x28')](handleError(_0x435b4e,null));};exports['changePassword']=function(_0x27ad44,_0x5f59cf){if(_0x27ad44['body']['id']){delete _0x27ad44['body']['id'];}return db['User'][_0x4c4d('0x58')]({'where':{'id':_0x27ad44[_0x4c4d('0x54')]['id']}})[_0x4c4d('0x1d')](function(_0x57f7c2){if(!_0x57f7c2)return null;if(_0x57f7c2['id']===_0x27ad44[_0x4c4d('0x7d')]['id']){if(!_0x27ad44[_0x4c4d('0x5a')][_0x4c4d('0x89')]||!_0x27ad44['body'][_0x4c4d('0x8a')]){throw new db[(_0x4c4d('0x8b'))]['ValidationError'](_0x4c4d('0x8c'));}if(!_0x57f7c2[_0x4c4d('0x8d')](_0x27ad44['body']['oldPassword'])){throw new db['Sequelize'][(_0x4c4d('0x8e'))](_0x4c4d('0x8f'));}if(_0x27ad44[_0x4c4d('0x5a')][_0x4c4d('0x89')]===_0x27ad44[_0x4c4d('0x5a')][_0x4c4d('0x8a')]){throw new db[(_0x4c4d('0x8b'))][(_0x4c4d('0x8e'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x27ad44[_0x4c4d('0x7d')]['role']==='admin'){if(!_0x27ad44[_0x4c4d('0x5a')]['newPassword']){throw new db[(_0x4c4d('0x8b'))][(_0x4c4d('0x8e'))](_0x4c4d('0x90'));}}else if(_0x27ad44[_0x4c4d('0x7d')][_0x4c4d('0x2d')]==='user'){if(!_0x27ad44['body'][_0x4c4d('0x8a')]){throw new db[(_0x4c4d('0x8b'))][(_0x4c4d('0x8e'))](_0x4c4d('0x90'));}if(_0x57f7c2[_0x4c4d('0x2d')]!==_0x4c4d('0x29')){throw new db['Sequelize']['ValidationError'](_0x4c4d('0x91'));}}else{throw new db[(_0x4c4d('0x8b'))][(_0x4c4d('0x8e'))]('Unauthorized');}return _0x57f7c2;})['then'](handleEntityNotFound(_0x5f59cf,null))[_0x4c4d('0x1d')](function(_0x274e5e){return db['Setting'][_0x4c4d('0x92')]({'attributes':['id','securePassword',_0x4c4d('0x93'),_0x4c4d('0x94')]})[_0x4c4d('0x1d')](function(_0x5b0135){if(_0x5b0135[_0x4c4d('0x61')])authService[_0x4c4d('0x62')](_0x27ad44[_0x4c4d('0x5a')][_0x4c4d('0x8a')]);if(!_0x5b0135['enforcePasswordHistory']||!_0x274e5e[_0x4c4d('0x95')])return _0x274e5e;authService[_0x4c4d('0x96')](_0x27ad44['body']['newPassword'],_0x274e5e['previousPasswords'],_0x5b0135['passwordHistoryLimit']);return _0x274e5e;})[_0x4c4d('0x1d')](saveUpdates({'password':_0x27ad44[_0x4c4d('0x5a')][_0x4c4d('0x8a')],'passwordResetAt':_0x27ad44[_0x4c4d('0x7d')]['id']==_0x27ad44['params']['id']?moment():null,'previousPasswords':authService[_0x4c4d('0x97')](_0x27ad44[_0x4c4d('0x5a')][_0x4c4d('0x8a')],_0x274e5e[_0x4c4d('0x95')])},null));})['then'](respondWithResult(_0x5f59cf,null))['catch'](handleError(_0x5f59cf,null));};exports[_0x4c4d('0x98')]=function(_0x3d77d2,_0x51b6c4){var _0x45e9e4=_0x3d77d2[_0x4c4d('0x5a')][_0x4c4d('0x99')];return db[_0x4c4d('0x3a')][_0x4c4d('0x58')]({'where':{'id':_0x3d77d2[_0x4c4d('0x54')]['id']},'attributes':['id',_0x4c4d('0x36'),_0x4c4d('0x2d'),_0x4c4d('0x9a'),_0x4c4d('0x9b'),_0x4c4d('0x9c'),_0x4c4d('0x9d')]})['then'](handleEntityNotFound(_0x51b6c4,null))[_0x4c4d('0x1d')](function(_0x3556cf){if(_0x3556cf){if(!utils[_0x4c4d('0x9e')](_0x45e9e4)){throw new db[(_0x4c4d('0x8b'))][(_0x4c4d('0x8e'))](_0x4c4d('0x9f'));}return _0x3556cf[_0x4c4d('0xa0')+_[_0x4c4d('0xa1')](_0x45e9e4[_0x4c4d('0xa2')]())+_0x4c4d('0xa3')](_0x3d77d2['body']['ids'],{'penalty':_0x3d77d2[_0x4c4d('0x5a')][_0x4c4d('0xa4')]||0x0})[_0x4c4d('0xa5')](function(_0xcdfe03){for(var _0x209706=0x0;_0x209706<_0x3d77d2[_0x4c4d('0x5a')][_0x4c4d('0x5d')]['length'];_0x209706+=0x1){var _0x3903a0={'UserId':Number(_0x3d77d2['params']['id'])};_0x3903a0[_[_0x4c4d('0xa1')](_0x45e9e4[_0x4c4d('0xa2')]())+'QueueId']=Number(_0x3d77d2[_0x4c4d('0x5a')][_0x4c4d('0x5d')][_0x209706]);socket['emit']('user'+_[_0x4c4d('0xa1')](_0x45e9e4[_0x4c4d('0xa2')]())+'Queue:save',_0x3903a0);}return _0xcdfe03;})[_0x4c4d('0x1d')](function(){if(_0x45e9e4===_0x4c4d('0xa6')){return db['VoiceQueue'][_0x4c4d('0x86')]({'where':{'id':_0x3d77d2[_0x4c4d('0x5a')]['ids']||[]},'raw':!![],'attributes':['id',_0x4c4d('0x36')]});}})['then'](function(_0x45f09d){var _0x201d32=_0x3556cf[_0x4c4d('0x2c')]({'plain':!![]});var _0x3e55f6=[];if(_0x45e9e4===_0x4c4d('0xa6')&&_0x201d32[_0x4c4d('0x2d')]==='agent'&&_0x201d32[_0x4c4d('0x9a')]){for(let _0x541e38=0x0;_0x541e38<_0x45f09d[_0x4c4d('0x6a')];_0x541e38+=0x1){_0x3e55f6[_0x4c4d('0x4b')]({'membername':_0x201d32[_0x4c4d('0x36')],'UserId':_0x201d32['id'],'queue_name':_0x45f09d[_0x541e38][_0x4c4d('0x36')],'VoiceQueueId':_0x45f09d[_0x541e38]['id'],'interface':_[_0x4c4d('0x64')](_0x201d32[_0x4c4d('0x9d')])?util[_0x4c4d('0xa7')](_0x4c4d('0xa8'),_0x201d32[_0x4c4d('0x36')]):_0x201d32['interface'],'paused':_0x201d32[_0x4c4d('0x9c')]||![],'penalty':_0x3d77d2[_0x4c4d('0x5a')][_0x4c4d('0xa4')]||0x0});}return Promise[_0x4c4d('0x53')](_0x3e55f6['map'](function(_0x36569){return db[_0x4c4d('0xa9')][_0x4c4d('0xaa')](_0x36569);}));}return _0x3556cf;});}})[_0x4c4d('0x1d')](respondWithStatusCode(_0x51b6c4,null))[_0x4c4d('0x28')](handleError(_0x51b6c4,null));};exports[_0x4c4d('0xab')]=function(_0x3c0df6,_0x45edcb){var _0x577a84,_0x16ffc9;return db[_0x4c4d('0x3a')][_0x4c4d('0x58')]({'where':{'id':_0x3c0df6['params']['id']},'attributes':['id',_0x4c4d('0x36'),'role']})[_0x4c4d('0x1d')](handleEntityNotFound(_0x45edcb,null))[_0x4c4d('0x1d')](function(_0x397fa1){if(_0x397fa1){_0x577a84=_0x397fa1;if(!_0x3c0df6[_0x4c4d('0x45')][_0x4c4d('0x99')]||!utils[_0x4c4d('0x9e')](_0x3c0df6[_0x4c4d('0x45')][_0x4c4d('0x99')])){throw new db['Sequelize'][(_0x4c4d('0x8e'))]('Unknown\x20channel');}return _0x397fa1[_0x4c4d('0xac')+_[_0x4c4d('0xa1')](_0x3c0df6[_0x4c4d('0x45')][_0x4c4d('0x99')][_0x4c4d('0xa2')]())+'Queues'](_0x3c0df6[_0x4c4d('0x45')][_0x4c4d('0x5d')]);}})['then'](function(_0x25e28e){if(_[_0x4c4d('0xad')](_0x3c0df6[_0x4c4d('0x45')]['ids'])){for(var _0x38e085=0x0;_0x38e085<_0x3c0df6[_0x4c4d('0x45')][_0x4c4d('0x5d')][_0x4c4d('0x6a')];_0x38e085+=0x1){_0x16ffc9={'UserId':Number(_0x3c0df6[_0x4c4d('0x54')]['id'])};_0x16ffc9[_[_0x4c4d('0xa1')](_0x3c0df6[_0x4c4d('0x45')]['channel'][_0x4c4d('0xa2')]())+_0x4c4d('0xae')]=Number(_0x3c0df6[_0x4c4d('0x45')][_0x4c4d('0x5d')][_0x38e085]);socket[_0x4c4d('0xaf')](_0x4c4d('0x7d')+_[_0x4c4d('0xa1')](_0x3c0df6[_0x4c4d('0x45')][_0x4c4d('0x99')][_0x4c4d('0xa2')]())+_0x4c4d('0xb0'),_0x16ffc9);}}else{_0x16ffc9={'UserId':Number(_0x3c0df6[_0x4c4d('0x54')]['id'])};_0x16ffc9[_[_0x4c4d('0xa1')](_0x3c0df6[_0x4c4d('0x45')]['channel'][_0x4c4d('0xa2')]())+_0x4c4d('0xae')]=Number(_0x3c0df6['query'][_0x4c4d('0x5d')]);socket[_0x4c4d('0xaf')](_0x4c4d('0x7d')+_[_0x4c4d('0xa1')](_0x3c0df6[_0x4c4d('0x45')][_0x4c4d('0x99')][_0x4c4d('0xa2')]())+'Queue:remove',_0x16ffc9);}return _0x25e28e;})['then'](function(){if(_0x3c0df6['query']['channel']===_0x4c4d('0xa6')){return db[_0x4c4d('0xa9')]['destroy']({'where':{'UserId':_0x3c0df6[_0x4c4d('0x54')]['id'],'VoiceQueueId':_0x3c0df6['query'][_0x4c4d('0x5d')]},'individualHooks':!![]})[_0x4c4d('0x1d')](function(){return _0x577a84;});}return _0x577a84;})[_0x4c4d('0x1d')](respondWithStatusCode(_0x45edcb,null))[_0x4c4d('0x28')](handleError(_0x45edcb,null));};exports[_0x4c4d('0xb1')]=function(_0x4c54cf,_0x1599cc){_0x4c54cf[_0x4c4d('0x5a')][_0x4c4d('0xb2')]=_0x4c54cf[_0x4c4d('0xb3')][_0x4c4d('0xb4')];return db['User'][_0x4c4d('0x58')]({'where':{'id':_0x4c54cf[_0x4c4d('0x54')]['id']}})[_0x4c4d('0x1d')](handleEntityNotFound(_0x1599cc,null))[_0x4c4d('0x1d')](saveUpdates(_0x4c54cf[_0x4c4d('0x5a')],null))[_0x4c4d('0x1d')](respondWithResult(_0x1599cc,null))[_0x4c4d('0x28')](handleError(_0x1599cc,null));};exports[_0x4c4d('0xb5')]=function(_0x4f79bc,_0x471bb2){var _0x48d4b6=path['join'](config['root'],'server/files/images/logos/default_profile.png');return db[_0x4c4d('0x3a')][_0x4c4d('0x58')]({'where':{'id':_0x4f79bc[_0x4c4d('0x54')]['id']},'attributes':['id',_0x4c4d('0xb2')],'raw':!![]})[_0x4c4d('0x1d')](handleEntityNotFound(_0x471bb2,null))[_0x4c4d('0x1d')](function(_0x3ec0ce){if(_0x3ec0ce){if(_[_0x4c4d('0x64')](_0x3ec0ce['userpic'])){return _0x471bb2['download'](_0x48d4b6);}else{if(!fs[_0x4c4d('0xb6')](path[_0x4c4d('0xb7')](config[_0x4c4d('0xb8')],'server/files/images/',_0x3ec0ce[_0x4c4d('0xb2')]))){return _0x471bb2[_0x4c4d('0xb9')](_0x48d4b6);}return _0x471bb2[_0x4c4d('0xb9')](path[_0x4c4d('0xb7')](config[_0x4c4d('0xb8')],'server/files/images/',_0x3ec0ce[_0x4c4d('0xb2')]));}}})[_0x4c4d('0x28')](handleError(_0x471bb2,null));};exports[_0x4c4d('0xba')]=function(_0x3f3c85,_0x209816){return db[_0x4c4d('0x3a')]['find']({'where':{'id':_0x3f3c85[_0x4c4d('0x54')]['id']},'attributes':['id']})[_0x4c4d('0x1d')](handleEntityNotFound(_0x209816,null))[_0x4c4d('0x1d')](function(_0x192caf){var _0x147396=[];values=_0x192caf[_0x4c4d('0x4f')];_0x147396[_0x4c4d('0x4b')](get_open_tabs(_0x4c4d('0x4d'),_0x192caf['dataValues']));_0x147396['push'](get_open_tabs('sms',_0x192caf['dataValues']));_0x147396['push'](get_open_tabs(_0x4c4d('0xbb'),_0x192caf['dataValues']));_0x147396[_0x4c4d('0x4b')](get_open_tabs('whatsapp',_0x192caf['dataValues']));_0x147396[_0x4c4d('0x4b')](get_open_tabs(_0x4c4d('0x59'),_0x192caf[_0x4c4d('0x4f')]));_0x147396['push'](get_open_tabs(_0x4c4d('0x51'),_0x192caf['dataValues']));return Promise[_0x4c4d('0x53')](_0x147396);})[_0x4c4d('0x1d')](function(_0x22fc05){if(_0x22fc05){var _0x941d68=_[_0x4c4d('0x3c')](values[_0x4c4d('0xbc')],function(_0x3bb3eb){return{'channel':'CHAT','id':_0x3bb3eb['id'],'createdAt':_0x3bb3eb[_0x4c4d('0xbd')]};});var _0x3b11e0=_['map'](values['FaxOpenTabs'],function(_0x374fa7){return{'channel':_0x4c4d('0xbe'),'id':_0x374fa7['id'],'createdAt':_0x374fa7[_0x4c4d('0xbd')]};});var _0x4c81de=_[_0x4c4d('0x3c')](values['OpenchannelOpenTabs'],function(_0x446803){return{'channel':_0x4c4d('0xbf'),'id':_0x446803['id'],'createdAt':_0x446803[_0x4c4d('0xbd')]};});var _0x54507c=_['map'](values[_0x4c4d('0xc0')],function(_0x128ad9){return{'channel':_0x4c4d('0xc1'),'id':_0x128ad9['id'],'createdAt':_0x128ad9[_0x4c4d('0xbd')]};});var _0x79105c=_['map'](values['SmsOpenTabs'],function(_0x24bf0f){return{'channel':'SMS','id':_0x24bf0f['id'],'createdAt':_0x24bf0f[_0x4c4d('0xbd')]};});var _0x58f2fc=_[_0x4c4d('0x3c')](values[_0x4c4d('0xc2')],function(_0x56986c){return{'channel':_0x4c4d('0xc3'),'id':_0x56986c['id'],'createdAt':_0x56986c['createdAt']};});var _0x4738a3=_['concat'](_0x941d68,_0x3b11e0,_0x4c81de,_0x54507c,_0x79105c,_0x58f2fc);var _0x1bb588={'count':_0x4738a3['length'],'rows':_0x4738a3};return _0x1bb588;}else return null;})[_0x4c4d('0x1d')](respondWithResult(_0x209816,null))['catch'](handleError(_0x209816,null));};exports[_0x4c4d('0xc4')]=function(_0x20cb49,_0x34ddd3){var _0x2e4925={};return db[_0x4c4d('0x3a')]['findOne']({'where':{'id':_0x20cb49[_0x4c4d('0x54')]['id']}})[_0x4c4d('0x1d')](function(_0x4796e5){if(!_0x4796e5){throw new APINotFoundError(util[_0x4c4d('0xa7')]('User\x20with\x20id\x20%s\x20not\x20found',_0x20cb49[_0x4c4d('0x54')]['id']));}return contacts['describe']();})[_0x4c4d('0x1d')](function(_0x99cf86){_0x20cb49[_0x4c4d('0x45')][_0x4c4d('0x3a')]=_0x20cb49[_0x4c4d('0x54')]['id'];_0x2e4925=qs[_0x4c4d('0x55')](_0x99cf86,_0x20cb49);if(_0x20cb49[_0x4c4d('0x45')][_0x4c4d('0xc5')](_0x4c4d('0x56'))){_0x2e4925[_0x4c4d('0x48')]=[{'model':db['CmList'],'as':'List','required':![]},{'model':db['Tag'],'as':_0x4c4d('0xc6'),'attributes':['id',_0x4c4d('0x36'),'color'],'where':_0x20cb49[_0x4c4d('0x45')][_0x4c4d('0xc7')]?{'id':_0x20cb49[_0x4c4d('0x45')][_0x4c4d('0xc7')]}:undefined,'required':_0x20cb49['query'][_0x4c4d('0xc7')]?!![]:![]}];}return contacts[_0x4c4d('0x86')](_0x20cb49[_0x4c4d('0x45')],_0x20cb49[_0x4c4d('0x7d')],_0x2e4925,_0x99cf86);})['then'](respondWithFilteredResult(_0x34ddd3,_0x2e4925))[_0x4c4d('0x28')](APIHandleError(_0x34ddd3));};exports[_0x4c4d('0xc8')]=function(_0x3ac28e,_0x1b44de){var _0x436302;var _0x5d262d={};var _0x158238;return db[_0x4c4d('0x3a')][_0x4c4d('0x92')]({'where':{'id':_0x3ac28e[_0x4c4d('0x54')]['id']},'attributes':['id',_0x4c4d('0x36'),_0x4c4d('0x2d')]})[_0x4c4d('0x1d')](handleEntityNotFound(_0x1b44de,null))[_0x4c4d('0x1d')](function(_0xa0f449){if(!utils[_0x4c4d('0x9e')](_0x3ac28e[_0x4c4d('0x45')]['channel'])){throw new db[(_0x4c4d('0x8b'))][(_0x4c4d('0x8e'))](_0x4c4d('0x9f'));}_0x436302=_0xa0f449;var _0x577d3f={};_0x577d3f[_0x4c4d('0xc9')]=_[_0x4c4d('0xca')](db[_[_0x4c4d('0xa1')](_0x3ac28e[_0x4c4d('0x45')][_0x4c4d('0x99')])+_0x4c4d('0xcb')][_0x4c4d('0x3b')]);_0x577d3f[_0x4c4d('0x45')]=_[_0x4c4d('0xca')](_0x3ac28e['query']);_0x577d3f[_0x4c4d('0xcc')]=_[_0x4c4d('0xcd')](_0x577d3f['model'],_0x577d3f[_0x4c4d('0x45')]);_0x5d262d[_0x4c4d('0x4a')]=_[_0x4c4d('0xcd')](_0x577d3f[_0x4c4d('0xc9')],qs['fields'](_0x3ac28e[_0x4c4d('0x45')][_0x4c4d('0xce')]));_0x5d262d[_0x4c4d('0x4a')]=_0x5d262d[_0x4c4d('0x4a')]['length']?_0x5d262d[_0x4c4d('0x4a')]:_0x577d3f['model'];_0x5d262d['order']=qs[_0x4c4d('0xcf')](_0x3ac28e['query'][_0x4c4d('0xcf')]);_0x5d262d[_0x4c4d('0xd0')]=qs[_0x4c4d('0xcc')](_[_0x4c4d('0xd1')](_0x3ac28e['query'],_0x577d3f['filters']));if(_0x3ac28e['query'][_0x4c4d('0x32')]){_0x5d262d[_0x4c4d('0xd0')]=_[_0x4c4d('0xd2')](_0x5d262d[_0x4c4d('0xd0')],{'$or':_['map'](_0x5d262d[_0x4c4d('0x4a')],function(_0x568f4d){var _0xce644={};_0xce644[_0x568f4d]={'$like':'%'+_0x3ac28e['query'][_0x4c4d('0x32')]+'%'};return _0xce644;})});}_0x5d262d=_[_0x4c4d('0xd2')]({},_0x5d262d,_0x3ac28e[_0x4c4d('0x57')]);switch(_0x436302['role']){case _0x4c4d('0x2e'):return db[_['capitalize'](_0x3ac28e[_0x4c4d('0x45')][_0x4c4d('0x99')])+_0x4c4d('0xcb')]['findAll'](_0x5d262d);case _0x4c4d('0x7d'):case _0x4c4d('0x29'):return _0x436302['get'+_[_0x4c4d('0xa1')](_0x3ac28e[_0x4c4d('0x45')][_0x4c4d('0x99')])+_0x4c4d('0xa3')](_0x5d262d);default:throw new db[(_0x4c4d('0x8b'))]['ValidationError'](_0x4c4d('0xd3'));}})['then'](function(_0x74dfd6){_0x158238=_0x74dfd6[_0x4c4d('0x6a')];if(!_0x3ac28e[_0x4c4d('0x45')][_0x4c4d('0xc5')]('nolimit')){_0x5d262d[_0x4c4d('0x19')]=qs[_0x4c4d('0x19')](_0x3ac28e[_0x4c4d('0x45')]['limit']);_0x5d262d['offset']=qs['offset'](_0x3ac28e[_0x4c4d('0x45')]['offset']);}switch(_0x436302[_0x4c4d('0x2d')]){case _0x4c4d('0x2e'):return db[_[_0x4c4d('0xa1')](_0x3ac28e['query'][_0x4c4d('0x99')])+_0x4c4d('0xcb')][_0x4c4d('0x86')](_0x5d262d);case _0x4c4d('0x7d'):case _0x4c4d('0x29'):return _0x436302[_0x4c4d('0x2c')+_[_0x4c4d('0xa1')](_0x3ac28e['query'][_0x4c4d('0x99')])+'Queues'](_0x5d262d);}})[_0x4c4d('0x1d')](function(_0x5b2606){return{'count':_0x158238,'rows':_0x5b2606};})['then'](respondWithResult(_0x1b44de,null))['catch'](handleError(_0x1b44de,null));};exports['getVoiceQueuesRt']=function(_0xf9a7a0,_0x234b5c){var _0x34b81f={};var _0x2a3db3={};var _0xdc19b9;var _0x555fc3;return db['User'][_0x4c4d('0x92')]({'where':{'id':_0xf9a7a0[_0x4c4d('0x54')]['id']}})[_0x4c4d('0x1d')](handleEntityNotFound(_0x234b5c,null))[_0x4c4d('0x1d')](function(_0x5e418b){if(_0x5e418b){_0xdc19b9=_0x5e418b;_0x2a3db3['model']=_['keys'](db['UserVoiceQueueRt'][_0x4c4d('0x3b')]);_0x2a3db3['query']=_[_0x4c4d('0xca')](_0xf9a7a0[_0x4c4d('0x45')]);_0x2a3db3[_0x4c4d('0xcc')]=_[_0x4c4d('0xcd')](_0x2a3db3[_0x4c4d('0xc9')],_0x2a3db3[_0x4c4d('0x45')]);_0x34b81f[_0x4c4d('0x4a')]=_[_0x4c4d('0xcd')](_0x2a3db3[_0x4c4d('0xc9')],qs[_0x4c4d('0xce')](_0xf9a7a0[_0x4c4d('0x45')][_0x4c4d('0xce')]));_0x34b81f[_0x4c4d('0x4a')]=_0x34b81f[_0x4c4d('0x4a')]['length']?_0x34b81f[_0x4c4d('0x4a')]:_0x2a3db3[_0x4c4d('0xc9')];_0x34b81f[_0x4c4d('0xd4')]=qs[_0x4c4d('0xcf')](_0xf9a7a0[_0x4c4d('0x45')][_0x4c4d('0xcf')]);_0x34b81f['where']=qs['filters'](_[_0x4c4d('0xd1')](_0xf9a7a0[_0x4c4d('0x45')],_0x2a3db3[_0x4c4d('0xcc')]));if(_0xf9a7a0['query'][_0x4c4d('0x32')]){_0x34b81f[_0x4c4d('0xd0')]=_[_0x4c4d('0xd2')](_0x34b81f[_0x4c4d('0xd0')],{'$or':_[_0x4c4d('0x3c')](_0x34b81f[_0x4c4d('0x4a')],function(_0x1549d5){var _0x54cdd1={};_0x54cdd1[_0x1549d5]={'$like':'%'+_0xf9a7a0[_0x4c4d('0x45')][_0x4c4d('0x32')]+'%'};return _0x54cdd1;})});}_0x34b81f=_['merge']({},_0x34b81f,_0xf9a7a0[_0x4c4d('0x57')]);return _0xdc19b9[_0x4c4d('0xd5')](_0x34b81f);}})['then'](function(_0x244c0f){if(_0x244c0f){_0x555fc3=_0x244c0f[_0x4c4d('0x6a')];if(!_0xf9a7a0[_0x4c4d('0x45')]['hasOwnProperty']('nolimit')){_0x34b81f[_0x4c4d('0x19')]=qs['limit'](_0xf9a7a0[_0x4c4d('0x45')][_0x4c4d('0x19')]);_0x34b81f['offset']=qs[_0x4c4d('0x1a')](_0xf9a7a0[_0x4c4d('0x45')][_0x4c4d('0x1a')]);}return _0xdc19b9[_0x4c4d('0xd5')](_0x34b81f);}})[_0x4c4d('0x1d')](function(_0x127b6e){if(_0x127b6e){return _0x127b6e?{'count':_0x555fc3,'rows':_0x127b6e}:null;}})['then'](respondWithResult(_0x234b5c,null))['catch'](handleError(_0x234b5c,null));};exports['getGroups']=function(_0x5ce18d,_0x491909){var _0x44e57e={};var _0x427432={};var _0xe1bb28;var _0x4e1d26;return db[_0x4c4d('0x3a')]['findOne']({'where':{'id':_0x5ce18d[_0x4c4d('0x54')]['id']}})[_0x4c4d('0x1d')](handleEntityNotFound(_0x491909,null))[_0x4c4d('0x1d')](function(_0x2a84de){if(_0x2a84de){_0xe1bb28=_0x2a84de;_0x427432[_0x4c4d('0xc9')]=_[_0x4c4d('0xca')](db[_0x4c4d('0xd6')]['rawAttributes']);_0x427432[_0x4c4d('0x45')]=_[_0x4c4d('0xca')](_0x5ce18d[_0x4c4d('0x45')]);_0x427432[_0x4c4d('0xcc')]=_[_0x4c4d('0xcd')](_0x427432[_0x4c4d('0xc9')],_0x427432[_0x4c4d('0x45')]);_0x44e57e[_0x4c4d('0x4a')]=_[_0x4c4d('0xcd')](_0x427432[_0x4c4d('0xc9')],qs[_0x4c4d('0xce')](_0x5ce18d[_0x4c4d('0x45')]['fields']));_0x44e57e[_0x4c4d('0x4a')]=_0x44e57e['attributes']['length']?_0x44e57e[_0x4c4d('0x4a')]:_0x427432[_0x4c4d('0xc9')];_0x44e57e['order']=qs['sort'](_0x5ce18d[_0x4c4d('0x45')][_0x4c4d('0xcf')]);_0x44e57e[_0x4c4d('0xd0')]=qs[_0x4c4d('0xcc')](_[_0x4c4d('0xd1')](_0x5ce18d['query'],_0x427432[_0x4c4d('0xcc')]));if(_0x5ce18d[_0x4c4d('0x45')][_0x4c4d('0x32')]){_0x44e57e[_0x4c4d('0xd0')]=_[_0x4c4d('0xd2')](_0x44e57e['where'],{'$or':_['map'](_0x44e57e[_0x4c4d('0x4a')],function(_0x15fd31){var _0x38156={};_0x38156[_0x15fd31]={'$like':'%'+_0x5ce18d[_0x4c4d('0x45')]['filter']+'%'};return _0x38156;})});}_0x44e57e=_[_0x4c4d('0xd2')]({},_0x44e57e,_0x5ce18d[_0x4c4d('0x57')]);return _0xe1bb28[_0x4c4d('0xd7')](_0x44e57e);}})['then'](function(_0x2b26a9){if(_0x2b26a9){_0x4e1d26=_0x2b26a9[_0x4c4d('0x6a')];if(!_0x5ce18d['query']['hasOwnProperty']('nolimit')){_0x44e57e[_0x4c4d('0x19')]=qs[_0x4c4d('0x19')](_0x5ce18d[_0x4c4d('0x45')][_0x4c4d('0x19')]);_0x44e57e[_0x4c4d('0x1a')]=qs[_0x4c4d('0x1a')](_0x5ce18d[_0x4c4d('0x45')][_0x4c4d('0x1a')]);}return _0xe1bb28[_0x4c4d('0xd7')](_0x44e57e);}})[_0x4c4d('0x1d')](function(_0x125f65){if(_0x125f65){return _0x125f65?{'count':_0x4e1d26,'rows':_0x125f65}:null;}})[_0x4c4d('0x1d')](respondWithResult(_0x491909,null))[_0x4c4d('0x28')](handleError(_0x491909,null));};exports[_0x4c4d('0xd8')]=function(_0x4f6da5,_0x5736c3){var _0x430bbd={'raw':!![],'where':{}};var _0xec2f54={};var _0x57815d={'count':0x0,'rows':[]};return db[_0x4c4d('0x3a')][_0x4c4d('0x92')]({'where':{'id':_0x4f6da5[_0x4c4d('0x54')]['id']}})[_0x4c4d('0x1d')](handleEntityNotFound(_0x5736c3,null))[_0x4c4d('0x1d')](function(_0x437efc){if(_0x437efc){_0xec2f54['model']=_['keys'](db['VoiceRecording'][_0x4c4d('0x3b')]);_0xec2f54['query']=_[_0x4c4d('0xca')](_0x4f6da5['query']);_0xec2f54[_0x4c4d('0xcc')]=_[_0x4c4d('0xcd')](_0xec2f54['model'],_0xec2f54[_0x4c4d('0x45')]);_0x430bbd[_0x4c4d('0x4a')]=_[_0x4c4d('0xcd')](_0xec2f54[_0x4c4d('0xc9')],qs['fields'](_0x4f6da5[_0x4c4d('0x45')][_0x4c4d('0xce')]));_0x430bbd[_0x4c4d('0x4a')]=_0x430bbd['attributes'][_0x4c4d('0x6a')]?_0x430bbd[_0x4c4d('0x4a')]:_0xec2f54['model'];if(!_0x4f6da5['query'][_0x4c4d('0xc5')](_0x4c4d('0xd9'))){_0x430bbd[_0x4c4d('0x19')]=qs[_0x4c4d('0x19')](_0x4f6da5[_0x4c4d('0x45')][_0x4c4d('0x19')]);_0x430bbd[_0x4c4d('0x1a')]=qs['offset'](_0x4f6da5[_0x4c4d('0x45')][_0x4c4d('0x1a')]);}_0x430bbd[_0x4c4d('0xd4')]=qs['sort'](_0x4f6da5[_0x4c4d('0x45')]['sort']);_0x430bbd[_0x4c4d('0xd0')]=qs[_0x4c4d('0xcc')](_[_0x4c4d('0xd1')](_0x4f6da5[_0x4c4d('0x45')],_0xec2f54[_0x4c4d('0xcc')]));_0x430bbd[_0x4c4d('0xd0')]['UserId']=_0x437efc['id'];if(_0x4f6da5[_0x4c4d('0x45')]['filter']){_0x430bbd[_0x4c4d('0xd0')]=_['merge'](_0x430bbd['where'],{'$or':_[_0x4c4d('0x3c')](_0x430bbd[_0x4c4d('0x4a')],function(_0x940941){var _0x1d65ae={};_0x1d65ae[_0x940941]={'$like':'%'+_0x4f6da5['query'][_0x4c4d('0x32')]+'%'};return _0x1d65ae;})});}_0x430bbd=_['merge']({},_0x430bbd,_0x4f6da5[_0x4c4d('0x57')]);return db[_0x4c4d('0xda')][_0x4c4d('0x44')]({'where':_0x430bbd[_0x4c4d('0xd0')]})['then'](function(_0x2b95f2){_0x57815d[_0x4c4d('0x44')]=_0x2b95f2;if(_0x4f6da5[_0x4c4d('0x45')]['includeAll']){_0x430bbd['include']=[{'all':!![]}];}return db[_0x4c4d('0xda')][_0x4c4d('0x86')](_0x430bbd);})[_0x4c4d('0x1d')](function(_0x46621a){_0x57815d[_0x4c4d('0x4e')]=_0x46621a;return _0x57815d;});}})['then'](respondWithFilteredResult(_0x5736c3,_0x430bbd))[_0x4c4d('0x28')](handleError(_0x5736c3,null));};exports['getScreenRecordings']=function(_0x4cd514,_0x5b7491){var _0x4cd334={'raw':!![],'where':{}};var _0x1f27b6={};var _0x481f6c={'count':0x0,'rows':[]};return db[_0x4c4d('0x3a')][_0x4c4d('0x92')]({'where':{'id':_0x4cd514[_0x4c4d('0x54')]['id']}})[_0x4c4d('0x1d')](handleEntityNotFound(_0x5b7491,null))[_0x4c4d('0x1d')](function(_0x52195e){if(_0x52195e){_0x1f27b6[_0x4c4d('0xc9')]=_[_0x4c4d('0xca')](db[_0x4c4d('0xdb')]['rawAttributes']);_0x1f27b6[_0x4c4d('0x45')]=_[_0x4c4d('0xca')](_0x4cd514[_0x4c4d('0x45')]);_0x1f27b6[_0x4c4d('0xcc')]=_['intersection'](_0x1f27b6[_0x4c4d('0xc9')],_0x1f27b6[_0x4c4d('0x45')]);_0x4cd334[_0x4c4d('0x4a')]=_[_0x4c4d('0xcd')](_0x1f27b6[_0x4c4d('0xc9')],qs[_0x4c4d('0xce')](_0x4cd514[_0x4c4d('0x45')][_0x4c4d('0xce')]));_0x4cd334[_0x4c4d('0x4a')]=_0x4cd334['attributes'][_0x4c4d('0x6a')]?_0x4cd334['attributes']:_0x1f27b6[_0x4c4d('0xc9')];if(!_0x4cd514[_0x4c4d('0x45')][_0x4c4d('0xc5')](_0x4c4d('0xd9'))){_0x4cd334[_0x4c4d('0x19')]=qs[_0x4c4d('0x19')](_0x4cd514[_0x4c4d('0x45')][_0x4c4d('0x19')]);_0x4cd334[_0x4c4d('0x1a')]=qs['offset'](_0x4cd514[_0x4c4d('0x45')][_0x4c4d('0x1a')]);}_0x4cd334['order']=qs[_0x4c4d('0xcf')](_0x4cd514[_0x4c4d('0x45')]['sort']);_0x4cd334[_0x4c4d('0xd0')]=qs[_0x4c4d('0xcc')](_['pick'](_0x4cd514[_0x4c4d('0x45')],_0x1f27b6[_0x4c4d('0xcc')]));_0x4cd334[_0x4c4d('0xd0')][_0x4c4d('0xdc')]=_0x52195e['id'];if(_0x4cd514[_0x4c4d('0x45')]['filter']){_0x4cd334[_0x4c4d('0xd0')]=_[_0x4c4d('0xd2')](_0x4cd334[_0x4c4d('0xd0')],{'$or':_[_0x4c4d('0x3c')](_0x4cd334['attributes'],function(_0x5ae7eb){var _0xf2566d={};_0xf2566d[_0x5ae7eb]={'$like':'%'+_0x4cd514['query'][_0x4c4d('0x32')]+'%'};return _0xf2566d;})});}_0x4cd334=_[_0x4c4d('0xd2')]({},_0x4cd334,_0x4cd514[_0x4c4d('0x57')]);return db[_0x4c4d('0xdb')][_0x4c4d('0x44')]({'where':_0x4cd334[_0x4c4d('0xd0')]})[_0x4c4d('0x1d')](function(_0x1265da){_0x481f6c['count']=_0x1265da;if(_0x4cd514[_0x4c4d('0x45')][_0x4c4d('0x56')]){_0x4cd334[_0x4c4d('0x48')]=[{'all':!![]}];}return db['ScreenRecording'][_0x4c4d('0x86')](_0x4cd334);})[_0x4c4d('0x1d')](function(_0x377ce3){_0x481f6c['rows']=_0x377ce3;return _0x481f6c;});}})[_0x4c4d('0x1d')](respondWithFilteredResult(_0x5b7491,_0x4cd334))[_0x4c4d('0x28')](handleError(_0x5b7491,null));};exports[_0x4c4d('0xdd')]=function(_0x3bbd7c,_0x562d1e){var _0x4b2dd5={};var _0x116460={};var _0x45fd20;var _0x802440;return db[_0x4c4d('0x3a')][_0x4c4d('0x92')]({'where':{'id':_0x3bbd7c['params']['id']}})['then'](handleEntityNotFound(_0x562d1e,null))[_0x4c4d('0x1d')](function(_0x50d899){if(_0x50d899){_0x45fd20=_0x50d899;_0x116460[_0x4c4d('0xc9')]=_[_0x4c4d('0xca')](db[_0x4c4d('0xde')][_0x4c4d('0x3b')]);_0x116460['query']=_['keys'](_0x3bbd7c[_0x4c4d('0x45')]);_0x116460['filters']=_['intersection'](_0x116460[_0x4c4d('0xc9')],_0x116460['query']);_0x4b2dd5[_0x4c4d('0x4a')]=_[_0x4c4d('0xcd')](_0x116460[_0x4c4d('0xc9')],qs[_0x4c4d('0xce')](_0x3bbd7c[_0x4c4d('0x45')]['fields']));_0x4b2dd5[_0x4c4d('0x4a')]=_0x4b2dd5['attributes'][_0x4c4d('0x6a')]?_0x4b2dd5[_0x4c4d('0x4a')]:_0x116460[_0x4c4d('0xc9')];_0x4b2dd5['order']=qs[_0x4c4d('0xcf')](_0x3bbd7c['query'][_0x4c4d('0xcf')]);_0x4b2dd5[_0x4c4d('0xd0')]=qs[_0x4c4d('0xcc')](_[_0x4c4d('0xd1')](_0x3bbd7c[_0x4c4d('0x45')],_0x116460[_0x4c4d('0xcc')]));if(_0x3bbd7c['query'][_0x4c4d('0x32')]){_0x4b2dd5[_0x4c4d('0xd0')]=_['merge'](_0x4b2dd5[_0x4c4d('0xd0')],{'$or':_[_0x4c4d('0x3c')](_0x4b2dd5[_0x4c4d('0x4a')],function(_0x1cfc28){var _0x12ceb8={};_0x12ceb8[_0x1cfc28]={'$like':'%'+_0x3bbd7c[_0x4c4d('0x45')][_0x4c4d('0x32')]+'%'};return _0x12ceb8;})});}_0x4b2dd5=_['merge']({},_0x4b2dd5,_0x3bbd7c['options']);return _0x45fd20[_0x4c4d('0xdd')](_0x4b2dd5);}})[_0x4c4d('0x1d')](function(_0x31c56a){if(_0x31c56a){_0x802440=_0x31c56a[_0x4c4d('0x6a')];if(!_0x3bbd7c[_0x4c4d('0x45')][_0x4c4d('0xc5')](_0x4c4d('0xd9'))){_0x4b2dd5['limit']=qs['limit'](_0x3bbd7c[_0x4c4d('0x45')]['limit']);_0x4b2dd5[_0x4c4d('0x1a')]=qs[_0x4c4d('0x1a')](_0x3bbd7c[_0x4c4d('0x45')][_0x4c4d('0x1a')]);}return _0x45fd20[_0x4c4d('0xdd')](_0x4b2dd5);}})[_0x4c4d('0x1d')](function(_0x12c467){if(_0x12c467){return _0x12c467?{'count':_0x802440,'rows':_0x12c467}:null;}})[_0x4c4d('0x1d')](respondWithResult(_0x562d1e,null))[_0x4c4d('0x28')](handleError(_0x562d1e,null));};exports['getOpenchannelInteractions']=function(_0x4bff49,_0xab8424){var _0x56bf11={};var _0x1a471a={};var _0x3c5a71;var _0x49fbf1;return db[_0x4c4d('0x3a')][_0x4c4d('0x92')]({'where':{'id':_0x4bff49[_0x4c4d('0x54')]['id']}})['then'](handleEntityNotFound(_0xab8424,null))[_0x4c4d('0x1d')](function(_0xa48f19){if(_0xa48f19){_0x3c5a71=_0xa48f19;_0x1a471a[_0x4c4d('0xc9')]=_[_0x4c4d('0xca')](db[_0x4c4d('0xdf')][_0x4c4d('0x3b')]);_0x1a471a['query']=_[_0x4c4d('0xca')](_0x4bff49[_0x4c4d('0x45')]);_0x1a471a[_0x4c4d('0xcc')]=_[_0x4c4d('0xcd')](_0x1a471a[_0x4c4d('0xc9')],_0x1a471a[_0x4c4d('0x45')]);_0x56bf11[_0x4c4d('0x4a')]=_[_0x4c4d('0xcd')](_0x1a471a[_0x4c4d('0xc9')],qs[_0x4c4d('0xce')](_0x4bff49[_0x4c4d('0x45')][_0x4c4d('0xce')]));_0x56bf11['attributes']=_0x56bf11[_0x4c4d('0x4a')]['length']?_0x56bf11[_0x4c4d('0x4a')]:_0x1a471a[_0x4c4d('0xc9')];_0x56bf11[_0x4c4d('0xd4')]=qs['sort'](_0x4bff49[_0x4c4d('0x45')][_0x4c4d('0xcf')]);_0x56bf11[_0x4c4d('0xd0')]=qs[_0x4c4d('0xcc')](_[_0x4c4d('0xd1')](_0x4bff49['query'],_0x1a471a[_0x4c4d('0xcc')]));if(_0x4bff49[_0x4c4d('0x45')][_0x4c4d('0x32')]){_0x56bf11[_0x4c4d('0xd0')]=_['merge'](_0x56bf11[_0x4c4d('0xd0')],{'$or':_[_0x4c4d('0x3c')](_0x56bf11[_0x4c4d('0x4a')],function(_0x31e77c){var _0x4ed1e1={};_0x4ed1e1[_0x31e77c]={'$like':'%'+_0x4bff49[_0x4c4d('0x45')][_0x4c4d('0x32')]+'%'};return _0x4ed1e1;})});}_0x56bf11=_[_0x4c4d('0xd2')]({},_0x56bf11,_0x4bff49[_0x4c4d('0x57')]);return _0x3c5a71['getOpenchannelInteractions'](_0x56bf11);}})['then'](function(_0x42ea71){if(_0x42ea71){_0x49fbf1=_0x42ea71[_0x4c4d('0x6a')];if(!_0x4bff49[_0x4c4d('0x45')]['hasOwnProperty'](_0x4c4d('0xd9'))){_0x56bf11[_0x4c4d('0x19')]=qs[_0x4c4d('0x19')](_0x4bff49['query'][_0x4c4d('0x19')]);_0x56bf11[_0x4c4d('0x1a')]=qs[_0x4c4d('0x1a')](_0x4bff49[_0x4c4d('0x45')]['offset']);}return _0x3c5a71[_0x4c4d('0xe0')](_0x56bf11);}})[_0x4c4d('0x1d')](function(_0x5288a8){if(_0x5288a8){return _0x5288a8?{'count':_0x49fbf1,'rows':_0x5288a8}:null;}})[_0x4c4d('0x1d')](respondWithResult(_0xab8424,null))[_0x4c4d('0x28')](handleError(_0xab8424,null));};exports[_0x4c4d('0xe1')]=function(_0x309c8f,_0x35b019){var _0x4dfdbc={'raw':!![],'where':{}};var _0x29e085={};var _0x5098a2={'count':0x0,'rows':[]};return db['User'][_0x4c4d('0x92')]({'where':{'id':_0x309c8f[_0x4c4d('0x54')]['id']}})[_0x4c4d('0x1d')](handleEntityNotFound(_0x35b019,null))[_0x4c4d('0x1d')](function(_0xf630d1){if(_0xf630d1){_0x29e085['model']=_['keys'](db['MailInteraction']['rawAttributes']);_0x29e085[_0x4c4d('0x45')]=_['keys'](_0x309c8f[_0x4c4d('0x45')]);_0x29e085[_0x4c4d('0xcc')]=_[_0x4c4d('0xcd')](_0x29e085[_0x4c4d('0xc9')],_0x29e085['query']);_0x4dfdbc[_0x4c4d('0x4a')]=_[_0x4c4d('0xcd')](_0x29e085[_0x4c4d('0xc9')],qs[_0x4c4d('0xce')](_0x309c8f[_0x4c4d('0x45')]['fields']));_0x4dfdbc['attributes']=_0x4dfdbc[_0x4c4d('0x4a')][_0x4c4d('0x6a')]?_0x4dfdbc[_0x4c4d('0x4a')]:_0x29e085[_0x4c4d('0xc9')];if(!_0x309c8f['query'][_0x4c4d('0xc5')]('nolimit')){_0x4dfdbc['limit']=qs[_0x4c4d('0x19')](_0x309c8f[_0x4c4d('0x45')][_0x4c4d('0x19')]);_0x4dfdbc[_0x4c4d('0x1a')]=qs[_0x4c4d('0x1a')](_0x309c8f[_0x4c4d('0x45')]['offset']);}_0x4dfdbc[_0x4c4d('0xd4')]=qs['sort'](_0x309c8f[_0x4c4d('0x45')][_0x4c4d('0xcf')]);_0x4dfdbc['where']=qs[_0x4c4d('0xcc')](_[_0x4c4d('0xd1')](_0x309c8f[_0x4c4d('0x45')],_0x29e085[_0x4c4d('0xcc')]));_0x4dfdbc['where'][_0x4c4d('0xdc')]=_0xf630d1['id'];if(_0x309c8f[_0x4c4d('0x45')][_0x4c4d('0x32')]){_0x4dfdbc[_0x4c4d('0xd0')]=_['merge'](_0x4dfdbc['where'],{'$or':_['map'](_0x4dfdbc[_0x4c4d('0x4a')],function(_0x24f1b6){var _0x632ec6={};_0x632ec6[_0x24f1b6]={'$like':'%'+_0x309c8f[_0x4c4d('0x45')][_0x4c4d('0x32')]+'%'};return _0x632ec6;})});}_0x4dfdbc=_[_0x4c4d('0xd2')]({},_0x4dfdbc,_0x309c8f['options']);return db['MailInteraction'][_0x4c4d('0x44')]({'where':_0x4dfdbc[_0x4c4d('0xd0')]})[_0x4c4d('0x1d')](function(_0x3fee53){_0x5098a2[_0x4c4d('0x44')]=_0x3fee53;if(_0x309c8f['query']['includeAll']){_0x4dfdbc[_0x4c4d('0x48')]=[{'all':!![]}];}return db['MailInteraction'][_0x4c4d('0x86')](_0x4dfdbc);})['then'](function(_0x53e802){_0x5098a2[_0x4c4d('0x4e')]=_0x53e802;return _0x5098a2;});}})[_0x4c4d('0x1d')](respondWithFilteredResult(_0x35b019,_0x4dfdbc))[_0x4c4d('0x28')](handleError(_0x35b019,null));};exports[_0x4c4d('0xe2')]=function(_0x13ad06,_0xe8514){var _0x3853f3={};var _0x31f046={};var _0x29a5bf;var _0x56720a;return db[_0x4c4d('0x3a')][_0x4c4d('0x92')]({'where':{'id':_0x13ad06['params']['id']}})[_0x4c4d('0x1d')](handleEntityNotFound(_0xe8514,null))[_0x4c4d('0x1d')](function(_0x147b57){if(_0x147b57){_0x29a5bf=_0x147b57;_0x31f046[_0x4c4d('0xc9')]=_[_0x4c4d('0xca')](db[_0x4c4d('0xe3')][_0x4c4d('0x3b')]);_0x31f046[_0x4c4d('0x45')]=_['keys'](_0x13ad06[_0x4c4d('0x45')]);_0x31f046['filters']=_[_0x4c4d('0xcd')](_0x31f046[_0x4c4d('0xc9')],_0x31f046[_0x4c4d('0x45')]);_0x3853f3[_0x4c4d('0x4a')]=_[_0x4c4d('0xcd')](_0x31f046[_0x4c4d('0xc9')],qs[_0x4c4d('0xce')](_0x13ad06[_0x4c4d('0x45')][_0x4c4d('0xce')]));_0x3853f3[_0x4c4d('0x4a')]=_0x3853f3[_0x4c4d('0x4a')]['length']?_0x3853f3[_0x4c4d('0x4a')]:_0x31f046[_0x4c4d('0xc9')];_0x3853f3[_0x4c4d('0xd4')]=qs[_0x4c4d('0xcf')](_0x13ad06[_0x4c4d('0x45')]['sort']);_0x3853f3[_0x4c4d('0xd0')]=qs['filters'](_[_0x4c4d('0xd1')](_0x13ad06['query'],_0x31f046[_0x4c4d('0xcc')]));if(_0x13ad06[_0x4c4d('0x45')]['filter']){_0x3853f3[_0x4c4d('0xd0')]=_[_0x4c4d('0xd2')](_0x3853f3['where'],{'$or':_[_0x4c4d('0x3c')](_0x3853f3['attributes'],function(_0x1fac49){var _0x223c19={};_0x223c19[_0x1fac49]={'$like':'%'+_0x13ad06[_0x4c4d('0x45')][_0x4c4d('0x32')]+'%'};return _0x223c19;})});}_0x3853f3=_[_0x4c4d('0xd2')]({},_0x3853f3,_0x13ad06[_0x4c4d('0x57')]);return _0x29a5bf[_0x4c4d('0xe2')](_0x3853f3);}})['then'](function(_0x293ce5){if(_0x293ce5){_0x56720a=_0x293ce5[_0x4c4d('0x6a')];if(!_0x13ad06[_0x4c4d('0x45')][_0x4c4d('0xc5')](_0x4c4d('0xd9'))){_0x3853f3['limit']=qs[_0x4c4d('0x19')](_0x13ad06[_0x4c4d('0x45')][_0x4c4d('0x19')]);_0x3853f3[_0x4c4d('0x1a')]=qs['offset'](_0x13ad06[_0x4c4d('0x45')][_0x4c4d('0x1a')]);}return _0x29a5bf['getSmsInteractions'](_0x3853f3);}})[_0x4c4d('0x1d')](function(_0x2b7d9d){if(_0x2b7d9d){return _0x2b7d9d?{'count':_0x56720a,'rows':_0x2b7d9d}:null;}})[_0x4c4d('0x1d')](respondWithResult(_0xe8514,null))[_0x4c4d('0x28')](handleError(_0xe8514,null));};exports[_0x4c4d('0xe4')]=function(_0x42f4ae,_0x5f57bd){var _0x4616e2={};var _0x5e188f={};var _0x5f3c04;var _0x623609;return db[_0x4c4d('0x3a')]['findOne']({'where':{'id':_0x42f4ae[_0x4c4d('0x54')]['id']}})[_0x4c4d('0x1d')](handleEntityNotFound(_0x5f57bd,null))[_0x4c4d('0x1d')](function(_0x401c6c){if(_0x401c6c){_0x5f3c04=_0x401c6c;_0x5e188f[_0x4c4d('0xc9')]=_[_0x4c4d('0xca')](db[_0x4c4d('0xe5')][_0x4c4d('0x3b')]);_0x5e188f[_0x4c4d('0x45')]=_[_0x4c4d('0xca')](_0x42f4ae[_0x4c4d('0x45')]);_0x5e188f[_0x4c4d('0xcc')]=_[_0x4c4d('0xcd')](_0x5e188f[_0x4c4d('0xc9')],_0x5e188f[_0x4c4d('0x45')]);_0x4616e2[_0x4c4d('0x4a')]=_[_0x4c4d('0xcd')](_0x5e188f[_0x4c4d('0xc9')],qs['fields'](_0x42f4ae[_0x4c4d('0x45')][_0x4c4d('0xce')]));_0x4616e2[_0x4c4d('0x4a')]=_0x4616e2['attributes'][_0x4c4d('0x6a')]?_0x4616e2[_0x4c4d('0x4a')]:_0x5e188f[_0x4c4d('0xc9')];_0x4616e2[_0x4c4d('0xd4')]=qs['sort'](_0x42f4ae['query'][_0x4c4d('0xcf')]);_0x4616e2[_0x4c4d('0xd0')]=qs[_0x4c4d('0xcc')](_['pick'](_0x42f4ae['query'],_0x5e188f['filters']));if(_0x42f4ae[_0x4c4d('0x45')][_0x4c4d('0x32')]){_0x4616e2['where']=_[_0x4c4d('0xd2')](_0x4616e2[_0x4c4d('0xd0')],{'$or':_[_0x4c4d('0x3c')](_0x4616e2[_0x4c4d('0x4a')],function(_0x57bc15){var _0x4a2b16={};_0x4a2b16[_0x57bc15]={'$like':'%'+_0x42f4ae[_0x4c4d('0x45')]['filter']+'%'};return _0x4a2b16;})});}_0x4616e2=_[_0x4c4d('0xd2')]({},_0x4616e2,_0x42f4ae['options']);return _0x5f3c04['getFaxInteractions'](_0x4616e2);}})[_0x4c4d('0x1d')](function(_0x15d328){if(_0x15d328){_0x623609=_0x15d328['length'];if(!_0x42f4ae[_0x4c4d('0x45')]['hasOwnProperty'](_0x4c4d('0xd9'))){_0x4616e2[_0x4c4d('0x19')]=qs[_0x4c4d('0x19')](_0x42f4ae[_0x4c4d('0x45')][_0x4c4d('0x19')]);_0x4616e2[_0x4c4d('0x1a')]=qs[_0x4c4d('0x1a')](_0x42f4ae[_0x4c4d('0x45')][_0x4c4d('0x1a')]);}return _0x5f3c04['getFaxInteractions'](_0x4616e2);}})['then'](function(_0x36fb97){if(_0x36fb97){return _0x36fb97?{'count':_0x623609,'rows':_0x36fb97}:null;}})[_0x4c4d('0x1d')](respondWithResult(_0x5f57bd,null))['catch'](handleError(_0x5f57bd,null));};exports['getWhatsappInteractions']=function(_0x3de502,_0x4a6fdd){var _0x3d90c1={};var _0x47bc46={};var _0xb50e3b;var _0x3a0921;return db['User'][_0x4c4d('0x92')]({'where':{'id':_0x3de502['params']['id']}})[_0x4c4d('0x1d')](handleEntityNotFound(_0x4a6fdd,null))['then'](function(_0x5ec51f){if(_0x5ec51f){_0xb50e3b=_0x5ec51f;_0x47bc46[_0x4c4d('0xc9')]=_['keys'](db[_0x4c4d('0xe6')]['rawAttributes']);_0x47bc46[_0x4c4d('0x45')]=_[_0x4c4d('0xca')](_0x3de502[_0x4c4d('0x45')]);_0x47bc46[_0x4c4d('0xcc')]=_[_0x4c4d('0xcd')](_0x47bc46['model'],_0x47bc46[_0x4c4d('0x45')]);_0x3d90c1[_0x4c4d('0x4a')]=_[_0x4c4d('0xcd')](_0x47bc46[_0x4c4d('0xc9')],qs[_0x4c4d('0xce')](_0x3de502[_0x4c4d('0x45')]['fields']));_0x3d90c1[_0x4c4d('0x4a')]=_0x3d90c1[_0x4c4d('0x4a')]['length']?_0x3d90c1['attributes']:_0x47bc46['model'];_0x3d90c1['order']=qs['sort'](_0x3de502[_0x4c4d('0x45')][_0x4c4d('0xcf')]);_0x3d90c1['where']=qs[_0x4c4d('0xcc')](_[_0x4c4d('0xd1')](_0x3de502[_0x4c4d('0x45')],_0x47bc46[_0x4c4d('0xcc')]));if(_0x3de502[_0x4c4d('0x45')]['filter']){_0x3d90c1[_0x4c4d('0xd0')]=_[_0x4c4d('0xd2')](_0x3d90c1[_0x4c4d('0xd0')],{'$or':_[_0x4c4d('0x3c')](_0x3d90c1[_0x4c4d('0x4a')],function(_0x50ba58){var _0x533a12={};_0x533a12[_0x50ba58]={'$like':'%'+_0x3de502[_0x4c4d('0x45')][_0x4c4d('0x32')]+'%'};return _0x533a12;})});}_0x3d90c1=_['merge']({},_0x3d90c1,_0x3de502[_0x4c4d('0x57')]);return _0xb50e3b[_0x4c4d('0xe7')](_0x3d90c1);}})[_0x4c4d('0x1d')](function(_0x12a599){if(_0x12a599){_0x3a0921=_0x12a599[_0x4c4d('0x6a')];if(!_0x3de502['query'][_0x4c4d('0xc5')]('nolimit')){_0x3d90c1['limit']=qs[_0x4c4d('0x19')](_0x3de502[_0x4c4d('0x45')][_0x4c4d('0x19')]);_0x3d90c1[_0x4c4d('0x1a')]=qs[_0x4c4d('0x1a')](_0x3de502['query'][_0x4c4d('0x1a')]);}return _0xb50e3b[_0x4c4d('0xe7')](_0x3d90c1);}})[_0x4c4d('0x1d')](function(_0x41540e){if(_0x41540e){return _0x41540e?{'count':_0x3a0921,'rows':_0x41540e}:null;}})[_0x4c4d('0x1d')](respondWithResult(_0x4a6fdd,null))[_0x4c4d('0x28')](handleError(_0x4a6fdd,null));};exports['login']=function(_0xb367a4,_0x27aa3c,_0x5018c9){var _0x5d2e1d;var _0x1ab3b8;var _0x12f8df;var _0x16a025=!_[_0x4c4d('0x64')](_0xb367a4[_0x4c4d('0x54')]['id'])?_0xb367a4[_0x4c4d('0x54')]['id']:!_[_0x4c4d('0x64')](_0xb367a4[_0x4c4d('0x7d')]['id'])?_0xb367a4['user']['id']:null;return db['User'][_0x4c4d('0x58')]({'where':{'id':_0x16a025,'role':{'$or':[_0x4c4d('0x2e'),_0x4c4d('0x7d'),_0x4c4d('0x29')]}},'attributes':['id',_0x4c4d('0x36'),_0x4c4d('0xe8'),_0x4c4d('0xe9'),'role','internal',_0x4c4d('0x9b')]})[_0x4c4d('0x1d')](function(_0x3664a0){if(_0x3664a0){if(_0x3664a0['role']===_0x4c4d('0x29')){_0x5d2e1d=_0x3664a0;if(_0xb367a4[_0x4c4d('0x5a')][_0x4c4d('0x9d')]){_0x12f8df=util[_0x4c4d('0xa7')]('LOCAL/%s@from-sip/n',_0x5d2e1d[_0xb367a4[_0x4c4d('0x5a')][_0x4c4d('0x9d')]]);}else if(_0xb367a4[_0x4c4d('0x5a')][_0x4c4d('0xea')]){_0x12f8df=util[_0x4c4d('0xa7')](_0x4c4d('0xa8'),_0xb367a4[_0x4c4d('0x5a')][_0x4c4d('0xea')]);}else{_0x12f8df=util[_0x4c4d('0xa7')]('SIP/%s',_0x5d2e1d[_0x4c4d('0x36')]);}socket['to'](util[_0x4c4d('0xa7')](_0x4c4d('0xeb'),_0x5d2e1d[_0x4c4d('0x36')]))[_0x4c4d('0xaf')](_0x4c4d('0xec'),{'user':{'id':_0x5d2e1d['id'],'name':_0x5d2e1d[_0x4c4d('0x36')]},'ip':_0xb367a4[_0x4c4d('0xed')][_0x4c4d('0xee')]||_0xb367a4[_0x4c4d('0xef')][_0x4c4d('0xf0')]||_0xb367a4[_0x4c4d('0xf1')][_0x4c4d('0xf0')]||_0xb367a4[_0x4c4d('0xef')]['socket'][_0x4c4d('0xf0')]});return db[_0x4c4d('0xa9')]['destroy']({'where':{'membername':_0x5d2e1d[_0x4c4d('0x36')]},'individualHooks':!![]});}}else{throw new db[(_0x4c4d('0x8b'))]['ValidationError'](_0x4c4d('0xf2'));}})[_0x4c4d('0x1d')](function(){if(_0x5d2e1d){return _0x5d2e1d[_0x4c4d('0xf3')]({'raw':!![]});}})[_0x4c4d('0x1d')](function(_0x433cfc){if(_0x5d2e1d){if(_0x433cfc){_0x1ab3b8=_0x433cfc;if(_0x1ab3b8[_0x4c4d('0x6a')]){var _0x3ebfab=_0x1ab3b8[_0x4c4d('0x3c')](function(_0x584ae4){var _0x41c7f9={'membername':_0x5d2e1d[_0x4c4d('0x36')],'UserId':_0x5d2e1d['id'],'queue_name':_0x584ae4[_0x4c4d('0x36')],'VoiceQueueId':_0x584ae4['id'],'interface':_0x12f8df,'paused':_0x5d2e1d[_0x4c4d('0x9b')]||![],'penalty':_0x584ae4['UserVoiceQueue.penalty']||0x0};return db['UserVoiceQueueRt'][_0x4c4d('0xaa')](_0x41c7f9);});return Promise[_0x4c4d('0x53')](_0x3ebfab);}}}})[_0x4c4d('0x1d')](function(){if(_0x5d2e1d){return db[_0x4c4d('0xf4')][_0x4c4d('0x86')]({'where':{'membername':_0x5d2e1d[_0x4c4d('0x36')],'exitAt':null}});}})['then'](function(_0x4e896b){if(_0x5d2e1d){var _0x4fa91e=[];_0x4e896b[_0x4c4d('0xf5')](function(_0x31117d){_0x4fa91e[_0x4c4d('0x4b')](_0x31117d[_0x4c4d('0xf6')]({'exitAt':moment()[_0x4c4d('0xa7')](_0x4c4d('0xf7'))}));});return Promise[_0x4c4d('0x53')](_0x4fa91e);}})[_0x4c4d('0x1d')](function(){if(_0x5d2e1d){var _0x409b96=[];var _0x596a64=[];var _0x3e639d=utils[_0x4c4d('0xf8')]();var _0x8debcb={'membername':_0x5d2e1d[_0x4c4d('0x36')],'interface':_0x12f8df,'enterAt':moment()['format'](_0x4c4d('0xf7')),'role':_0x5d2e1d[_0x4c4d('0x2d')],'internal':_0x5d2e1d['internal']};_0x3e639d[_0x4c4d('0xf5')](function(_0x58f350){_0x409b96[_0x4c4d('0x4b')](_[_0x4c4d('0xd2')]({'channel':_0x58f350,'type':_0x4c4d('0xf9'),'data1':_0xb367a4[_0x4c4d('0x5a')][_0x4c4d('0xfa')],'data2':_0x12f8df},_0x8debcb));if(_0x5d2e1d[_0x4c4d('0x9b')]){_0x596a64[_0x4c4d('0x4b')](_[_0x4c4d('0xd2')]({'channel':_0x58f350,'type':_0x4c4d('0xfb'),'data1':_0x4c4d('0xfc')},_0x8debcb));}});return db['MemberReport'][_0x4c4d('0xfd')](_0x409b96[_0x4c4d('0xfe')](_0x596a64),{'individualHooks':!![]});}})[_0x4c4d('0x1d')](function(){if(_0x5d2e1d){return _0x5d2e1d['update']({'online':!![],'lastLoginAt':moment()[_0x4c4d('0xa7')](_0x4c4d('0xf7')),'voicePause':_0x5d2e1d[_0x4c4d('0x9b')]||![],'mailPause':_0x5d2e1d[_0x4c4d('0x9b')]||![],'chatPause':_0x5d2e1d['loginInPause']||![],'faxPause':_0x5d2e1d['loginInPause']||![],'smsPause':_0x5d2e1d[_0x4c4d('0x9b')]||![],'openchannelPause':_0x5d2e1d[_0x4c4d('0x9b')]||![],'whatsappPause':_0x5d2e1d[_0x4c4d('0x9b')]||![],'pauseType':_0x5d2e1d[_0x4c4d('0x9b')]?_0x4c4d('0xfc'):null,'interface':_0x12f8df,'lastPauseAt':moment()[_0x4c4d('0xa7')](_0x4c4d('0xf7'))});}})[_0x4c4d('0x1d')](function(_0x221565){if(_0xb367a4[_0x4c4d('0xff')]){return _0x5018c9();}else{return Promise[_0x4c4d('0x100')](_0x221565)[_0x4c4d('0x1d')](respondWithResult(_0x27aa3c,null));}})['catch'](handleError(_0x27aa3c,null));};exports[_0x4c4d('0x101')]=function(_0x14b4d9,_0x3a0838){var _0x26238e;return db[_0x4c4d('0x3a')]['find']({'where':{'id':_0x14b4d9[_0x4c4d('0x54')]['id'],'role':'agent'},'attributes':['id','name',_0x4c4d('0x2d')]})['then'](handleEntityNotFound(_0x3a0838,null))[_0x4c4d('0x1d')](function(_0x334c86){if(_0x334c86){_0x26238e=_0x334c86;return db[_0x4c4d('0xa9')]['destroy']({'where':{'membername':_0x26238e['name']},'individualHooks':!![]});}})['then'](function(){return db[_0x4c4d('0xf4')][_0x4c4d('0x86')]({'where':{'membername':_0x26238e[_0x4c4d('0x36')],'exitAt':null}});})[_0x4c4d('0x1d')](function(_0xc93d3b){var _0x559d9b=[];_0xc93d3b[_0x4c4d('0xf5')](function(_0x48c858){_0x559d9b[_0x4c4d('0x4b')](_0x48c858[_0x4c4d('0xf6')]({'exitAt':moment()[_0x4c4d('0xa7')](_0x4c4d('0xf7'))}));});return Promise['all'](_0x559d9b);})[_0x4c4d('0x1d')](function(){return _0x26238e[_0x4c4d('0xf6')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x4c4d('0x1d')](respondWithResult(_0x3a0838,null))[_0x4c4d('0x28')](handleError(_0x3a0838,null));};exports[_0x4c4d('0x102')]=function(_0x1fde84,_0x2b8a75){var _0x2c3b3a;return db[_0x4c4d('0xa9')]['update']({'paused':0x1},{'where':{'UserId':_0x1fde84[_0x4c4d('0x54')]['id']},'individualHooks':!![]})[_0x4c4d('0x1d')](function(){return db[_0x4c4d('0x3a')][_0x4c4d('0x58')]({'where':{'id':_0x1fde84[_0x4c4d('0x54')]['id'],'role':_0x4c4d('0x29')},'attributes':['id',_0x4c4d('0x36'),_0x4c4d('0x2d'),_0x4c4d('0x5e'),_0x4c4d('0x9d'),'online']});})[_0x4c4d('0x1d')](handleEntityNotFound(_0x2b8a75,null))[_0x4c4d('0x1d')](function(_0x175e0d){if(_0x175e0d){_0x2c3b3a=_0x175e0d;return respondWithRpcPromise(_0x4c4d('0x103'),_0x4c4d('0x102'),{'id':_0x2c3b3a['id'],'name':_0x2c3b3a[_0x4c4d('0x36')],'pause':!![]});}})[_0x4c4d('0x1d')](function(){if(_0x2c3b3a){return db[_0x4c4d('0xf4')]['findAll']({'where':{'membername':_0x2c3b3a[_0x4c4d('0x36')],'type':_0x4c4d('0xfb'),'exitAt':null}});}})[_0x4c4d('0x1d')](function(_0x548c9f){if(_0x548c9f[_0x4c4d('0x6a')]){var _0x31dd0f=moment()[_0x4c4d('0xa7')](_0x4c4d('0xf7'));for(var _0x20a45a=0x0,_0x1d01a2=_0x548c9f[_0x4c4d('0x6a')];_0x20a45a<_0x1d01a2;_0x20a45a++){_0x548c9f[_0x20a45a]['updateAttributes']({'exitAt':_0x31dd0f});}}})[_0x4c4d('0x1d')](function(){var _0x2bf8f5=[];var _0x5674bb=utils[_0x4c4d('0xf8')]();_0x5674bb[_0x4c4d('0xf5')](function(_0xdb9df5){_0x2bf8f5[_0x4c4d('0x4b')]({'channel':_0xdb9df5,'membername':_0x2c3b3a[_0x4c4d('0x36')],'interface':_[_0x4c4d('0x64')](_0x2c3b3a[_0x4c4d('0x9d')])?util[_0x4c4d('0xa7')]('SIP/%s',_0x2c3b3a[_0x4c4d('0x36')]):_0x2c3b3a[_0x4c4d('0x9d')],'type':_0x4c4d('0xfb'),'enterAt':moment()[_0x4c4d('0xa7')](_0x4c4d('0xf7')),'data1':_0x1fde84[_0x4c4d('0x5a')][_0x4c4d('0x3d')]||_0x4c4d('0x104'),'role':_0x2c3b3a['role'],'internal':_0x2c3b3a['internal']});});return db[_0x4c4d('0xf4')][_0x4c4d('0xfd')](_0x2bf8f5,{'individualHooks':!![]});})[_0x4c4d('0x1d')](function(){return _0x2c3b3a[_0x4c4d('0xf6')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1fde84[_0x4c4d('0x5a')]['type']||_0x4c4d('0x104'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x2b8a75,null))[_0x4c4d('0x28')](handleError(_0x2b8a75,null));};exports[_0x4c4d('0x105')]=function(_0x214aaa,_0x48a615){if(_0x214aaa[_0x4c4d('0x5a')][_0x4c4d('0x99')]&&!utils['isValidChannel'](_0x214aaa[_0x4c4d('0x5a')]['channel'])){throw new APIBadRequestError(util[_0x4c4d('0xa7')](_0x4c4d('0x106'),_0x214aaa['body'][_0x4c4d('0x99')]));}return db[_0x4c4d('0x3a')][_0x4c4d('0x58')]({'where':{'id':_0x214aaa[_0x4c4d('0x54')]['id']},'attributes':['id',_0x4c4d('0x36'),_0x4c4d('0x2d'),_0x4c4d('0x5e'),_0x4c4d('0x9d'),_0x4c4d('0x9a'),_0x4c4d('0x9c'),_0x4c4d('0x107'),_0x4c4d('0x108'),_0x4c4d('0x109'),_0x4c4d('0x10a'),_0x4c4d('0x10b'),_0x4c4d('0x10c'),_0x4c4d('0x10d'),'lastPauseAt']})[_0x4c4d('0x1d')](function(_0x3b0cb7){if(!_0x3b0cb7){throw new APINotFoundError(util[_0x4c4d('0xa7')](_0x4c4d('0x10e'),_0x214aaa['params']['id']));}return _0x3b0cb7['unpause'](_0x214aaa[_0x4c4d('0x5a')][_0x4c4d('0x99')]);})[_0x4c4d('0x1d')](respondWithResult(_0x48a615,null))[_0x4c4d('0x28')](APIHandleError(_0x48a615));};exports[_0x4c4d('0x10f')]=function(_0x237bda,_0x550006){var _0xcaa219={};var _0x418f2d={};var _0x130be8;var _0x2ed62b;return db['User'][_0x4c4d('0x92')]({'where':{'id':_0x237bda['params']['id']}})[_0x4c4d('0x1d')](handleEntityNotFound(_0x550006,null))[_0x4c4d('0x1d')](function(_0x20a40a){if(_0x20a40a){_0x130be8=_0x20a40a;_0x418f2d[_0x4c4d('0xc9')]=_['keys'](db['Team']['rawAttributes']);_0x418f2d[_0x4c4d('0x45')]=_[_0x4c4d('0xca')](_0x237bda[_0x4c4d('0x45')]);_0x418f2d[_0x4c4d('0xcc')]=_['intersection'](_0x418f2d[_0x4c4d('0xc9')],_0x418f2d[_0x4c4d('0x45')]);_0xcaa219[_0x4c4d('0x4a')]=_[_0x4c4d('0xcd')](_0x418f2d[_0x4c4d('0xc9')],qs[_0x4c4d('0xce')](_0x237bda['query'][_0x4c4d('0xce')]));_0xcaa219[_0x4c4d('0x4a')]=_0xcaa219[_0x4c4d('0x4a')][_0x4c4d('0x6a')]?_0xcaa219['attributes']:_0x418f2d[_0x4c4d('0xc9')];_0xcaa219[_0x4c4d('0xd4')]=qs['sort'](_0x237bda[_0x4c4d('0x45')][_0x4c4d('0xcf')]);_0xcaa219[_0x4c4d('0xd0')]=qs[_0x4c4d('0xcc')](_['pick'](_0x237bda[_0x4c4d('0x45')],_0x418f2d[_0x4c4d('0xcc')]));if(_0x237bda[_0x4c4d('0x45')][_0x4c4d('0x32')]){_0xcaa219['where']=_[_0x4c4d('0xd2')](_0xcaa219[_0x4c4d('0xd0')],{'$or':_[_0x4c4d('0x3c')](_0xcaa219[_0x4c4d('0x4a')],function(_0x353ead){var _0x4e272d={};_0x4e272d[_0x353ead]={'$like':'%'+_0x237bda['query']['filter']+'%'};return _0x4e272d;})});}_0xcaa219=_[_0x4c4d('0xd2')]({},_0xcaa219,_0x237bda[_0x4c4d('0x57')]);return _0x130be8[_0x4c4d('0x10f')](_0xcaa219);}})['then'](function(_0x32f965){if(_0x32f965){_0x2ed62b=_0x32f965['length'];if(!_0x237bda['query'][_0x4c4d('0xc5')](_0x4c4d('0xd9'))){_0xcaa219['limit']=qs[_0x4c4d('0x19')](_0x237bda[_0x4c4d('0x45')]['limit']);_0xcaa219[_0x4c4d('0x1a')]=qs[_0x4c4d('0x1a')](_0x237bda[_0x4c4d('0x45')][_0x4c4d('0x1a')]);}return _0x130be8[_0x4c4d('0x10f')](_0xcaa219);}})[_0x4c4d('0x1d')](function(_0x572dd0){if(_0x572dd0){return _0x572dd0?{'count':_0x2ed62b,'rows':_0x572dd0}:null;}})[_0x4c4d('0x1d')](respondWithResult(_0x550006,null))[_0x4c4d('0x28')](handleError(_0x550006,null));};exports[_0x4c4d('0x110')]=function(_0x3744ae,_0x386dec){var _0x2b927b=_0x3744ae[_0x4c4d('0x54')]['id'];var _0x1dcee5=_0x3744ae[_0x4c4d('0x5a')]?_0x3744ae[_0x4c4d('0x5a')][_0x4c4d('0x5d')]:null;var _0x4c60a6=[];return Promise['resolve']()[_0x4c4d('0x1d')](function(){if(!_0x1dcee5)throw new APIBadRequestError(_0x4c4d('0x111'));})[_0x4c4d('0x1d')](function(){return db['User']['findOne']({'where':{'id':_0x2b927b}});})['then'](function(_0x337bc1){if(!_0x337bc1)throw new APINotFoundError(util[_0x4c4d('0xa7')](_0x4c4d('0x10e'),_0x3744ae['params']['id']));return db[_0x4c4d('0x66')][_0x4c4d('0x112')](function(_0x278b93){return _0x337bc1[_0x4c4d('0x110')](_0x1dcee5,{'transaction':_0x278b93})['then'](function(){return db[_0x4c4d('0x113')][_0x4c4d('0x86')]({'where':{'id':{'$in':_0x1dcee5}}});})['then'](function(_0x23c372){var _0x510707=_['map'](_0x23c372,function(_0x496d3f){return _0x496d3f['getAssociatedQueues']();});return Promise[_0x4c4d('0x53')](_0x510707);})['then'](function(_0x15454c){_0x4c60a6=_[_0x4c4d('0x114')](_0x15454c);var _0x26350b=_['map'](_0x4c60a6,function(_0x5a20aa){return _0x5a20aa[_0x4c4d('0x115')](_0x337bc1['id'],{'transaction':_0x278b93});});return Promise[_0x4c4d('0x53')](_0x26350b);})[_0x4c4d('0x1d')](function(){if(!_0x337bc1['online'])return;var _0x4cab8c=_[_0x4c4d('0x32')](_0x4c60a6,function(_0x178e37){return _0x178e37[_0x4c4d('0x116')](_0x4c4d('0x99'))===_0x4c4d('0x117');});var _0x46bc22=_[_0x4c4d('0x3c')](_0x4cab8c,function(_0x5503c9){return db['UserVoiceQueueRt'][_0x4c4d('0xaa')]({'membername':_0x337bc1[_0x4c4d('0x36')],'UserId':_0x337bc1['id'],'queue_name':_0x5503c9[_0x4c4d('0x36')],'VoiceQueueId':_0x5503c9['id'],'interface':_['isNil'](_0x337bc1[_0x4c4d('0x9d')])?util['format']('SIP/%s',_0x337bc1[_0x4c4d('0x36')]):_0x337bc1[_0x4c4d('0x9d')],'paused':_0x337bc1[_0x4c4d('0x9c')]||![],'penalty':_0x337bc1[_0x4c4d('0xa4')]},{'transaction':_0x278b93});});return Promise[_0x4c4d('0x53')](_0x46bc22);})[_0x4c4d('0x1d')](function(){return db[_0x4c4d('0x118')]['findAll']({'where':{'teamId':{'$in':_0x1dcee5}}});})[_0x4c4d('0x1d')](function(_0x2cdacf){var _0x5a2290=_[_0x4c4d('0x3c')](_0x2cdacf,function(_0x48f9e6){return db[_0x4c4d('0x119')][_0x4c4d('0x7c')]({'UserId':_0x337bc1['id'],'VoicePrefixId':_0x48f9e6['VoicePrefixId']},{'transaction':_0x278b93});});return Promise[_0x4c4d('0x53')](_0x5a2290);});});})['then'](function(){for(var _0x13e023=0x0;_0x13e023<_0x4c60a6[_0x4c4d('0x6a')];_0x13e023++){var _0x300387=_0x4c60a6[_0x13e023][_0x4c4d('0x116')](_0x4c4d('0x99'));var _0x56d49f=_0x300387+'QueueId';socket[_0x4c4d('0xaf')](_0x4c4d('0x7d')+_0x300387+'Queue:save',{'UserId':_0x2b927b,['queueField']:_0x4c60a6[_0x13e023]['id']});}})[_0x4c4d('0x1d')](respondWithStatusCode(_0x386dec,null))[_0x4c4d('0x28')](APIHandleError(_0x386dec));};exports[_0x4c4d('0x11a')]=function(_0x547956,_0x58c3ab){var _0x38b53e=_0x547956[_0x4c4d('0x54')]['id'];var _0x3b7344=null;if(_0x547956[_0x4c4d('0x45')][_0x4c4d('0x5d')]){_0x3b7344=_[_0x4c4d('0xad')](_0x547956[_0x4c4d('0x45')][_0x4c4d('0x5d')])?_0x547956['query'][_0x4c4d('0x5d')]:[_0x547956[_0x4c4d('0x45')][_0x4c4d('0x5d')]];}var _0x4bac32=[];return Promise['resolve']()[_0x4c4d('0x1d')](function(){if(!_0x3b7344)throw new APIBadRequestError(_0x4c4d('0x11b'));})[_0x4c4d('0x1d')](function(){return db[_0x4c4d('0x3a')][_0x4c4d('0x92')]({'where':{'id':_0x38b53e}});})[_0x4c4d('0x1d')](function(_0x46aee5){if(!_0x46aee5)throw new APINotFoundError(util[_0x4c4d('0xa7')](_0x4c4d('0x10e'),_0x547956[_0x4c4d('0x54')]['id']));return db[_0x4c4d('0x66')][_0x4c4d('0x112')](function(_0x5697b5){return _0x46aee5[_0x4c4d('0x11a')](_0x3b7344,{'transaction':_0x5697b5})[_0x4c4d('0x1d')](function(){return db[_0x4c4d('0x113')][_0x4c4d('0x86')]({'where':{'id':{'$in':_0x3b7344}}});})[_0x4c4d('0x1d')](function(_0x528f34){var _0x2b8089=_['map'](_0x528f34,function(_0x293dd8){return _0x293dd8[_0x4c4d('0x11c')]();});return Promise[_0x4c4d('0x53')](_0x2b8089);})['then'](function(_0x303049){_0x4bac32=_[_0x4c4d('0x114')](_0x303049);var _0x20c532=_[_0x4c4d('0x3c')](_0x4bac32,function(_0x27995a){return _0x27995a[_0x4c4d('0x11d')](_0x46aee5['id'],{'transaction':_0x5697b5});});return Promise[_0x4c4d('0x53')](_0x20c532);})[_0x4c4d('0x1d')](function(){if(!_0x46aee5[_0x4c4d('0x9a')])return;var _0x3e2140=_['filter'](_0x4bac32,function(_0x543fb8){return _0x543fb8[_0x4c4d('0x116')]('channel')==='Voice';});var _0xb406e0=_[_0x4c4d('0x3c')](_0x3e2140,function(_0x55224c){return db[_0x4c4d('0xa9')][_0x4c4d('0x2b')]({'where':{'VoiceQueueId':_0x55224c['id'],'UserId':_0x46aee5['id']},'transaction':_0x5697b5});});return Promise[_0x4c4d('0x53')](_0xb406e0);})[_0x4c4d('0x1d')](function(){return db[_0x4c4d('0x118')]['findAll']({'where':{'teamId':{'$in':_0x3b7344}}});})['then'](function(_0x51a0cf){var _0x46cfb0=_[_0x4c4d('0x3c')](_0x51a0cf,function(_0x40db88){return db[_0x4c4d('0x119')][_0x4c4d('0x2b')]({'where':{'UserId':_0x46aee5['id'],'VoicePrefixId':_0x40db88[_0x4c4d('0x11e')]}},{'transaction':_0x5697b5});});return Promise[_0x4c4d('0x53')](_0x46cfb0);});});})['then'](function(){for(var _0x2237a0=0x0;_0x2237a0<_0x4bac32['length'];_0x2237a0++){var _0x49b5a1=_0x4bac32[_0x2237a0][_0x4c4d('0x116')](_0x4c4d('0x99'));var _0x554286=_0x49b5a1+_0x4c4d('0xae');socket[_0x4c4d('0xaf')]('user'+_0x49b5a1+_0x4c4d('0xb0'),{'UserId':_0x38b53e,['queueField']:_0x4bac32[_0x2237a0]['id']});}})[_0x4c4d('0x1d')](respondWithStatusCode(_0x58c3ab,null))[_0x4c4d('0x28')](APIHandleError(_0x58c3ab));};exports[_0x4c4d('0x11f')]=function(_0x11441e,_0x70d136){var _0x1a82d1={};var _0x37f9e8={};var _0x14c0da;var _0x17eb50;return db[_0x4c4d('0x3a')][_0x4c4d('0x92')]({'where':{'id':_0x11441e[_0x4c4d('0x54')]['id']}})[_0x4c4d('0x1d')](handleEntityNotFound(_0x70d136,null))[_0x4c4d('0x1d')](function(_0x52c798){if(_0x52c798){_0x14c0da=_0x52c798;_0x37f9e8['model']=_[_0x4c4d('0xca')](db[_0x4c4d('0x120')][_0x4c4d('0x3b')]);_0x37f9e8[_0x4c4d('0x45')]=_['keys'](_0x11441e[_0x4c4d('0x45')]);_0x37f9e8['filters']=_[_0x4c4d('0xcd')](_0x37f9e8['model'],_0x37f9e8['query']);_0x1a82d1[_0x4c4d('0x4a')]=_[_0x4c4d('0xcd')](_0x37f9e8[_0x4c4d('0xc9')],qs[_0x4c4d('0xce')](_0x11441e[_0x4c4d('0x45')][_0x4c4d('0xce')]));_0x1a82d1[_0x4c4d('0x4a')]=_0x1a82d1['attributes'][_0x4c4d('0x6a')]?_0x1a82d1[_0x4c4d('0x4a')]:_0x37f9e8['model'];_0x1a82d1['order']=qs['sort'](_0x11441e[_0x4c4d('0x45')][_0x4c4d('0xcf')]);_0x1a82d1[_0x4c4d('0xd0')]=qs['filters'](_[_0x4c4d('0xd1')](_0x11441e[_0x4c4d('0x45')],_0x37f9e8[_0x4c4d('0xcc')]));if(_0x11441e['query']['filter']){_0x1a82d1[_0x4c4d('0xd0')]=_['merge'](_0x1a82d1[_0x4c4d('0xd0')],{'$or':_[_0x4c4d('0x3c')](_0x1a82d1[_0x4c4d('0x4a')],function(_0x388169){var _0x47ff2e={};_0x47ff2e[_0x388169]={'$like':'%'+_0x11441e[_0x4c4d('0x45')][_0x4c4d('0x32')]+'%'};return _0x47ff2e;})});}_0x1a82d1=_['merge']({},_0x1a82d1,_0x11441e[_0x4c4d('0x57')]);return _0x14c0da[_0x4c4d('0x11f')](_0x1a82d1);}})[_0x4c4d('0x1d')](function(_0x93e6e2){if(_0x93e6e2){_0x17eb50=_0x93e6e2[_0x4c4d('0x6a')];if(!_0x11441e['query'][_0x4c4d('0xc5')](_0x4c4d('0xd9'))){_0x1a82d1[_0x4c4d('0x19')]=qs[_0x4c4d('0x19')](_0x11441e[_0x4c4d('0x45')][_0x4c4d('0x19')]);_0x1a82d1[_0x4c4d('0x1a')]=qs[_0x4c4d('0x1a')](_0x11441e[_0x4c4d('0x45')][_0x4c4d('0x1a')]);}return _0x14c0da[_0x4c4d('0x11f')](_0x1a82d1);}})['then'](function(_0x110d06){if(_0x110d06){return _0x110d06?{'count':_0x17eb50,'rows':_0x110d06}:null;}})[_0x4c4d('0x1d')](respondWithResult(_0x70d136,null))[_0x4c4d('0x28')](handleError(_0x70d136,null));};exports[_0x4c4d('0x121')]=function(_0x2af521,_0xf2f978){var _0x5b57de={};var _0xb7eb31={};var _0xeed3d9;return db[_0x4c4d('0x3a')][_0x4c4d('0x92')]({'where':{'id':_0x2af521[_0x4c4d('0x54')]['id']}})[_0x4c4d('0x1d')](handleEntityNotFound(_0xf2f978,null))[_0x4c4d('0x1d')](function(_0x1cb565){if(_0x1cb565){_0xeed3d9=_0x1cb565;_0xb7eb31[_0x4c4d('0xc9')]=_[_0x4c4d('0xca')](db[_0x4c4d('0x3a')]['rawAttributes']);_0xb7eb31[_0x4c4d('0x45')]=_[_0x4c4d('0xca')](_0x2af521['query']);_0xb7eb31[_0x4c4d('0xcc')]=_[_0x4c4d('0xcd')](_0xb7eb31[_0x4c4d('0xc9')],_0xb7eb31[_0x4c4d('0x45')]);_0x5b57de[_0x4c4d('0x4a')]=_['intersection'](_0xb7eb31['model'],qs['fields'](_0x2af521[_0x4c4d('0x45')][_0x4c4d('0xce')]));_0x5b57de[_0x4c4d('0x4a')]=_0x5b57de[_0x4c4d('0x4a')][_0x4c4d('0x6a')]?_0x5b57de[_0x4c4d('0x4a')]:_0xb7eb31['model'];_0x5b57de[_0x4c4d('0xd4')]=qs['sort'](_0x2af521[_0x4c4d('0x45')][_0x4c4d('0xcf')]);_0x5b57de[_0x4c4d('0xd0')]=qs[_0x4c4d('0xcc')](_[_0x4c4d('0xd1')](_0x2af521[_0x4c4d('0x45')],_0xb7eb31[_0x4c4d('0xcc')]));if(_0x2af521[_0x4c4d('0x45')][_0x4c4d('0x32')]){_0x5b57de[_0x4c4d('0xd0')]=_['merge'](_0x5b57de[_0x4c4d('0xd0')],{'$or':_[_0x4c4d('0x3c')](_0x5b57de[_0x4c4d('0x4a')],function(_0x394f56){var _0x4fa943={};_0x4fa943[_0x394f56]={'$like':'%'+_0x2af521[_0x4c4d('0x45')][_0x4c4d('0x32')]+'%'};return _0x4fa943;})});}_0x5b57de[_0x4c4d('0xc9')]=db['User'];_0x5b57de['as']='Agents';_0x5b57de=_[_0x4c4d('0xd2')]({},_0x5b57de,_0x2af521[_0x4c4d('0x57')]);return _0xeed3d9[_0x4c4d('0xf3')]({'include':[_0x5b57de]});}})[_0x4c4d('0x1d')](function(_0x449ede){if(_0x449ede){var _0x2c0180={},_0x1b5cf8=[];for(var _0x216f81=0x0;_0x216f81<_0x449ede['length'];_0x216f81+=0x1){for(var _0x1a9e33=0x0,_0x28e670;_0x1a9e33<_0x449ede[_0x216f81][_0x4c4d('0x2f')]['length'];_0x1a9e33+=0x1){_0x28e670=_0x449ede[_0x216f81][_0x4c4d('0x2f')][_0x1a9e33][_0x4c4d('0x2c')]({'plain':!![]});_0x2c0180[_0x28e670['id']]=_0x28e670;}}_0x2c0180=_[_0x4c4d('0x122')](_0x2c0180);for(var _0x53fda2=qs[_0x4c4d('0x1a')](_0x2af521['query'][_0x4c4d('0x1a')]);_0x53fda2<_0x2c0180[_0x4c4d('0x6a')]&&_0x1b5cf8[_0x4c4d('0x6a')]=_0x34c4c2[_0x1df8('0x50')]){throw new Error(_0x1df8('0x51'));}})[_0x1df8('0x17')](function(){if(_0x4e6497){return db[_0x1df8('0x26')][_0x1df8('0x47')]({'where':{'membername':_0x4e6497[_0x1df8('0x28')]},'individualHooks':!![]});}})[_0x1df8('0x17')](function(){if(_0x4e6497){return _0x4e6497[_0x1df8('0x52')]({'raw':!![]});}})['then'](function(_0x4517b0){if(_0x4e6497){if(_0x4517b0){var _0x38f698=[];_0x18959f=_0x4517b0;if(_0x18959f[_0x1df8('0x29')]){for(var _0x57792a=0x0;_0x57792a<_0x18959f[_0x1df8('0x29')];_0x57792a++){_0x38f698[_0x1df8('0x2c')](db[_0x1df8('0x26')][_0x1df8('0x53')]({'membername':_0x4e6497['name'],'UserId':_0x4e6497['id'],'queue_name':_0x18959f[_0x57792a]['name'],'VoiceQueueId':_0x18959f[_0x57792a]['id'],'interface':_0xe5eb4d,'paused':_0x4e6497['loginInPause']||![],'penalty':_0x18959f[_0x57792a][_0x1df8('0x54')]||0x0}));}return BPromise['all'](_0x38f698);}}}})[_0x1df8('0x17')](function(){if(_0x4e6497){return db[_0x1df8('0x55')][_0x1df8('0x27')]({'where':{'membername':_0x4e6497[_0x1df8('0x28')],'exitAt':null}});}})[_0x1df8('0x17')](function(_0x41d757){if(_0x4e6497){if(_0x41d757&&_0x41d757['length']){var _0x54b95d=[];_0x41d757[_0x1df8('0x48')](function(_0x4a14c9){_0x54b95d[_0x1df8('0x2c')](_0x4a14c9[_0x1df8('0x34')]({'exitAt':moment()[_0x1df8('0x23')](_0x1df8('0x2a'))}));});return BPromise[_0x1df8('0x49')](_0x54b95d);}}})['then'](function(){if(_0x4e6497){var _0x5835f7=[];var _0x279b05=[];var _0x433c70=utils[_0x1df8('0x56')]();var _0x52f8c={'membername':_0x4e6497[_0x1df8('0x28')],'interface':_0xe5eb4d,'enterAt':moment()[_0x1df8('0x23')](_0x1df8('0x2a')),'role':_0x4e6497[_0x1df8('0x21')],'internal':_0x4e6497[_0x1df8('0x31')]};_0x433c70['forEach'](function(_0x4b46e9){_0x5835f7[_0x1df8('0x2c')](_[_0x1df8('0x57')]({'channel':_0x4b46e9,'type':_0x1df8('0x58'),'data1':'callysquare','data2':_0xe5eb4d},_0x52f8c));if(_0x4e6497[_0x1df8('0x59')]){_0x279b05[_0x1df8('0x2c')](_[_0x1df8('0x57')]({'channel':_0x4b46e9,'type':'PAUSE','data1':'LOGININPAUSE'},_0x52f8c));}});return db['MemberReport'][_0x1df8('0x33')](_0x5835f7['concat'](_0x279b05),{'individualHooks':!![]});}})[_0x1df8('0x17')](function(){if(_0x4e6497){return _0x4e6497[_0x1df8('0x34')]({'online':!![],'lastLoginAt':moment()[_0x1df8('0x23')](_0x1df8('0x2a')),'voicePause':_0x4e6497[_0x1df8('0x59')]||![],'mailPause':_0x4e6497[_0x1df8('0x59')]||![],'chatPause':_0x4e6497[_0x1df8('0x59')]||![],'faxPause':_0x4e6497[_0x1df8('0x59')]||![],'smsPause':_0x4e6497[_0x1df8('0x59')]||![],'openchannelPause':_0x4e6497[_0x1df8('0x59')]||![],'pauseType':_0x4e6497[_0x1df8('0x59')]?_0x1df8('0x5a'):null,'lastPauseAt':moment()[_0x1df8('0x23')](_0x1df8('0x2a')),'interface':_0xe5eb4d});}})[_0x1df8('0x17')](function(_0x5754a4){_0x14ec83(_0x5754a4);})[_0x1df8('0x1a')](function(_0x3f6c54){_0x303123(_0x114d53[_0x1df8('0x1b')](0x1f4,_0x3f6c54[_0x1df8('0x1c')]));});});}; \ No newline at end of file +var _0x2a5c=['stringify','error','message','ShowUser','find','then','catch','PauseUser','name','role','internal','format','MemberReport','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','isNil','interface','SIP/%s','type','DEFAULT\x20PAUSE','body','bulkCreate','update','UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','mailPause','faxPause','openchannelPause','smsPause','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','unpause','system','LogoutUser','UserVoiceQueueRt','destroy','all','LoginUser','mobile','phone','agent','../../config/license/util','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','push','upsert','loginInPause','UserVoiceQueue.penalty','merge','callysquare','PAUSE','LOGININPAUSE','concat','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','redis','defaults','localhost','./user.socket','register','GetUser','User','findAll','raw','options','where','limit','include','map','model','attributes','info','debug'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x2a5c,0x19a));var _0xc2a5=function(_0x312633,_0x2bb6c2){_0x312633=_0x312633-0x0;var _0x3e3ab7=_0x2a5c[_0x312633];return _0x3e3ab7;};'use strict';var _=require(_0xc2a5('0x0'));var util=require('util');var moment=require(_0xc2a5('0x1'));var BPromise=require(_0xc2a5('0x2'));var Redis=require(_0xc2a5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc2a5('0x4'));var logger=require('../../config/logger')(_0xc2a5('0x5'));var config=require(_0xc2a5('0x6'));config[_0xc2a5('0x7')]=_[_0xc2a5('0x8')](config[_0xc2a5('0x7')],{'host':_0xc2a5('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc2a5('0xa'))[_0xc2a5('0xb')](socket);exports[_0xc2a5('0xc')]=function(_0x3f1f57){var _0x3cd439=this;return new Promise(function(_0x3a174f,_0x1bd183){return db[_0xc2a5('0xd')][_0xc2a5('0xe')]({'raw':_0x3f1f57['options']?_0x3f1f57['options'][_0xc2a5('0xf')]===undefined?!![]:![]:!![],'where':_0x3f1f57[_0xc2a5('0x10')]?_0x3f1f57['options'][_0xc2a5('0x11')]||null:null,'attributes':_0x3f1f57['options']?_0x3f1f57['options']['attributes']||null:null,'limit':_0x3f1f57[_0xc2a5('0x10')]?_0x3f1f57['options'][_0xc2a5('0x12')]||null:null,'include':_0x3f1f57[_0xc2a5('0x10')]?_0x3f1f57[_0xc2a5('0x10')][_0xc2a5('0x13')]?_[_0xc2a5('0x14')](_0x3f1f57[_0xc2a5('0x10')][_0xc2a5('0x13')],function(_0x3e37a1){return{'model':db[_0x3e37a1[_0xc2a5('0x15')]],'as':_0x3e37a1['as'],'attributes':_0x3e37a1[_0xc2a5('0x16')],'include':_0x3e37a1[_0xc2a5('0x13')]?_[_0xc2a5('0x14')](_0x3e37a1[_0xc2a5('0x13')],function(_0x384bb5){return{'model':db[_0x384bb5['model']],'as':_0x384bb5['as'],'attributes':_0x384bb5[_0xc2a5('0x16')],'include':_0x384bb5[_0xc2a5('0x13')]?_[_0xc2a5('0x14')](_0x384bb5[_0xc2a5('0x13')],function(_0x48c216){return{'model':db[_0x48c216[_0xc2a5('0x15')]],'as':_0x48c216['as'],'attributes':_0x48c216[_0xc2a5('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23a943){logger[_0xc2a5('0x17')]('GetUser',_0x3f1f57);logger[_0xc2a5('0x18')](_0xc2a5('0xc'),_0x3f1f57,JSON[_0xc2a5('0x19')](_0x23a943));_0x3a174f(_0x23a943);})['catch'](function(_0x5fd815){logger[_0xc2a5('0x1a')]('GetUser',_0x5fd815[_0xc2a5('0x1b')],_0x3f1f57);_0x1bd183(_0x3cd439[_0xc2a5('0x1a')](0x1f4,_0x5fd815['message']));});});};exports[_0xc2a5('0x1c')]=function(_0x1d1e9d){var _0x415dc0=this;return new Promise(function(_0x4e9522,_0x524f58){return db[_0xc2a5('0xd')][_0xc2a5('0x1d')]({'raw':_0x1d1e9d[_0xc2a5('0x10')]?_0x1d1e9d[_0xc2a5('0x10')][_0xc2a5('0xf')]===undefined?!![]:![]:!![],'where':_0x1d1e9d[_0xc2a5('0x10')]?_0x1d1e9d[_0xc2a5('0x10')][_0xc2a5('0x11')]||null:null,'attributes':_0x1d1e9d['options']?_0x1d1e9d[_0xc2a5('0x10')]['attributes']||null:null,'include':_0x1d1e9d[_0xc2a5('0x10')]?_0x1d1e9d[_0xc2a5('0x10')][_0xc2a5('0x13')]?_['map'](_0x1d1e9d[_0xc2a5('0x10')][_0xc2a5('0x13')],function(_0x3ed781){return{'model':db[_0x3ed781[_0xc2a5('0x15')]],'as':_0x3ed781['as'],'attributes':_0x3ed781[_0xc2a5('0x16')],'include':_0x3ed781[_0xc2a5('0x13')]?_[_0xc2a5('0x14')](_0x3ed781[_0xc2a5('0x13')],function(_0x234108){return{'model':db[_0x234108[_0xc2a5('0x15')]],'as':_0x234108['as'],'attributes':_0x234108[_0xc2a5('0x16')],'include':_0x234108[_0xc2a5('0x13')]?_[_0xc2a5('0x14')](_0x234108[_0xc2a5('0x13')],function(_0x3a86fe){return{'model':db[_0x3a86fe['model']],'as':_0x3a86fe['as'],'attributes':_0x3a86fe['attributes']};}):[]};}):[]};}):[]:[]})[_0xc2a5('0x1e')](function(_0x48166a){logger[_0xc2a5('0x17')](_0xc2a5('0x1c'),_0x1d1e9d);logger['debug']('ShowUser',_0x1d1e9d,JSON[_0xc2a5('0x19')](_0x48166a));_0x4e9522(_0x48166a);})[_0xc2a5('0x1f')](function(_0x4b52f){logger['error'](_0xc2a5('0x1c'),_0x4b52f[_0xc2a5('0x1b')],_0x1d1e9d);_0x524f58(_0x415dc0[_0xc2a5('0x1a')](0x1f4,_0x4b52f[_0xc2a5('0x1b')]));});});};exports[_0xc2a5('0x20')]=function(_0x22a640){var _0x53ff19;return db[_0xc2a5('0xd')][_0xc2a5('0x1d')]({'where':_0x22a640[_0xc2a5('0x10')][_0xc2a5('0x11')]||{},'attributes':['id',_0xc2a5('0x21'),_0xc2a5('0x22'),_0xc2a5('0x23'),'interface']})[_0xc2a5('0x1e')](function(_0x54edca){if(!_0x54edca){throw new Error(util[_0xc2a5('0x24')]('User\x20with\x20id\x20%s\x20not\x20found',_0x22a640['params']['id']));}_0x53ff19=_0x54edca;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x53ff19['id']},'individualHooks':!![]});})['then'](function(){return db[_0xc2a5('0x25')][_0xc2a5('0xe')]({'where':{'membername':_0x53ff19[_0xc2a5('0x21')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x192dd4){if(_0x192dd4&&_0x192dd4[_0xc2a5('0x26')]){var _0x369652=moment()[_0xc2a5('0x24')](_0xc2a5('0x27'));for(var _0xc780c=0x0,_0x5993f6=_0x192dd4[_0xc2a5('0x26')];_0xc780c<_0x5993f6;_0xc780c++){_0x192dd4[_0xc780c][_0xc2a5('0x28')]({'exitAt':_0x369652});}}})[_0xc2a5('0x1e')](function(){var _0xa46540=[];var _0x5b96bf=utils[_0xc2a5('0x29')]();_0x5b96bf[_0xc2a5('0x2a')](function(_0x209b5e){_0xa46540['push']({'channel':_0x209b5e,'membername':_0x53ff19[_0xc2a5('0x21')],'interface':_[_0xc2a5('0x2b')](_0x53ff19[_0xc2a5('0x2c')])?util[_0xc2a5('0x24')](_0xc2a5('0x2d'),_0x53ff19[_0xc2a5('0x21')]):_0x53ff19[_0xc2a5('0x2c')],'type':'PAUSE','enterAt':moment()[_0xc2a5('0x24')](_0xc2a5('0x27')),'data1':_0x22a640['body'][_0xc2a5('0x2e')]||_0xc2a5('0x2f'),'role':_0x53ff19[_0xc2a5('0x22')],'internal':_0x53ff19[_0xc2a5('0x23')],'uniqueid':_0x22a640[_0xc2a5('0x30')]['uniqueid']||null});});return db[_0xc2a5('0x25')][_0xc2a5('0x31')](_0xa46540,{'individualHooks':!![]});})[_0xc2a5('0x1e')](function(){return _0x53ff19[_0xc2a5('0x32')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x22a640[_0xc2a5('0x30')][_0xc2a5('0x2e')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0xc2a5('0x1f')](function(_0x156b94){throw _0x156b94;});};exports[_0xc2a5('0x33')]=function(_0xa24adf){return Promise[_0xc2a5('0x34')]()[_0xc2a5('0x1e')](function(){if(_0xa24adf['body'][_0xc2a5('0x35')]&&!utils[_0xc2a5('0x36')](_0xa24adf[_0xc2a5('0x30')][_0xc2a5('0x35')])){throw new Error(util[_0xc2a5('0x24')](_0xc2a5('0x37'),_0xa24adf['body'][_0xc2a5('0x35')]));}return db[_0xc2a5('0xd')][_0xc2a5('0x38')]({'where':_0xa24adf[_0xc2a5('0x10')]['where']||{},'attributes':['id',_0xc2a5('0x21'),_0xc2a5('0x22'),_0xc2a5('0x23'),_0xc2a5('0x2c'),_0xc2a5('0x39'),'voicePause',_0xc2a5('0x3a'),'chatPause',_0xc2a5('0x3b'),_0xc2a5('0x3c'),_0xc2a5('0x3d'),'whatsappPause','pauseType',_0xc2a5('0x3e')]});})['then'](function(_0x53ced7){if(!_0x53ced7){throw new Error(util[_0xc2a5('0x24')](_0xc2a5('0x3f'),_0xa24adf['params']['id']));}return _0x53ced7[_0xc2a5('0x40')](_0xa24adf[_0xc2a5('0x30')][_0xc2a5('0x35')],_0xc2a5('0x41'));})['catch'](function(_0x784382){throw _0x784382;});};exports[_0xc2a5('0x42')]=function(_0x10e605){var _0x17df7f=this;return new Promise(function(_0xcef0b5,_0x4b8fe2){var _0x222647;return db[_0xc2a5('0xd')][_0xc2a5('0x38')]({'where':_0x10e605[_0xc2a5('0x10')][_0xc2a5('0x11')]||{},'attributes':['id','name']})['then'](function(_0x12bc70){if(_0x12bc70){_0x222647=_0x12bc70;return db[_0xc2a5('0x43')][_0xc2a5('0x44')]({'where':{'membername':_0x222647[_0xc2a5('0x21')]},'individualHooks':!![]});}})['then'](function(){if(_0x222647){return db[_0xc2a5('0x25')]['findAll']({'where':{'membername':_0x222647['name'],'exitAt':null}});}})[_0xc2a5('0x1e')](function(_0x1d7b11){if(_0x222647){if(_0x1d7b11&&_0x1d7b11[_0xc2a5('0x26')]){var _0x329c5e=[];_0x1d7b11[_0xc2a5('0x2a')](function(_0x306063){_0x329c5e['push'](_0x306063[_0xc2a5('0x32')]({'exitAt':moment()['format'](_0xc2a5('0x27'))}));});return BPromise[_0xc2a5('0x45')](_0x329c5e);}}})[_0xc2a5('0x1e')](function(){if(_0x222647){return _0x222647['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x4a6d3b){_0xcef0b5(_0x4a6d3b);})[_0xc2a5('0x1f')](function(_0x300834){_0x4b8fe2(_0x17df7f[_0xc2a5('0x1a')](0x1f4,_0x300834[_0xc2a5('0x1b')]));});});};exports[_0xc2a5('0x46')]=function(_0x580592){var _0x222566=this;return new Promise(function(_0x3b7d7d,_0x2b8e9c){var _0x2d7503;var _0x1b3555;var _0x3a00c3;var _0x20599c;return db['User']['findOne']({'where':_0x580592[_0xc2a5('0x10')]['where']||{},'attributes':['id','name',_0xc2a5('0x22'),_0xc2a5('0x47'),_0xc2a5('0x48'),_0xc2a5('0x23'),'loginInPause','interface']})[_0xc2a5('0x1e')](function(_0x1c32cd){if(_0x1c32cd){_0x2d7503=_0x1c32cd;_0x20599c=_0x580592[_0xc2a5('0x30')]['interface']?_0x580592[_0xc2a5('0x30')]['interface']:util[_0xc2a5('0x24')](_0xc2a5('0x2d'),_0x2d7503[_0xc2a5('0x21')]);return db['User']['count']({'where':{'role':_0xc2a5('0x49'),'online':!![],'id':{'$ne':_0x2d7503['id']}}});}})[_0xc2a5('0x1e')](function(_0x41f415){if(_0x41f415){_0x3a00c3=_0x41f415;return require(_0xc2a5('0x4a'))['getLicense']();}})['then'](function(_0x2e6ba3){if(_0x2e6ba3&&_0x2e6ba3[_0xc2a5('0x4b')]&&_0x3a00c3>=_0x2e6ba3[_0xc2a5('0x4b')]){throw new Error(_0xc2a5('0x4c'));}})[_0xc2a5('0x1e')](function(){if(_0x2d7503){return db[_0xc2a5('0x43')]['destroy']({'where':{'membername':_0x2d7503[_0xc2a5('0x21')]},'individualHooks':!![]});}})[_0xc2a5('0x1e')](function(){if(_0x2d7503){return _0x2d7503[_0xc2a5('0x4d')]({'raw':!![]});}})[_0xc2a5('0x1e')](function(_0x16083c){if(_0x2d7503){if(_0x16083c){var _0x4abe1b=[];_0x1b3555=_0x16083c;if(_0x1b3555[_0xc2a5('0x26')]){for(var _0xdee566=0x0;_0xdee566<_0x1b3555[_0xc2a5('0x26')];_0xdee566++){_0x4abe1b[_0xc2a5('0x4e')](db[_0xc2a5('0x43')][_0xc2a5('0x4f')]({'membername':_0x2d7503['name'],'UserId':_0x2d7503['id'],'queue_name':_0x1b3555[_0xdee566][_0xc2a5('0x21')],'VoiceQueueId':_0x1b3555[_0xdee566]['id'],'interface':_0x20599c,'paused':_0x2d7503[_0xc2a5('0x50')]||![],'penalty':_0x1b3555[_0xdee566][_0xc2a5('0x51')]||0x0}));}return BPromise[_0xc2a5('0x45')](_0x4abe1b);}}}})[_0xc2a5('0x1e')](function(){if(_0x2d7503){return db['MemberReport'][_0xc2a5('0xe')]({'where':{'membername':_0x2d7503[_0xc2a5('0x21')],'exitAt':null}});}})[_0xc2a5('0x1e')](function(_0x58c2bf){if(_0x2d7503){if(_0x58c2bf&&_0x58c2bf[_0xc2a5('0x26')]){var _0x4abfca=[];_0x58c2bf[_0xc2a5('0x2a')](function(_0x197e92){_0x4abfca['push'](_0x197e92[_0xc2a5('0x32')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xc2a5('0x45')](_0x4abfca);}}})[_0xc2a5('0x1e')](function(){if(_0x2d7503){var _0x29299d=[];var _0x302b69=[];var _0x481702=utils[_0xc2a5('0x29')]();var _0x1fbc93={'membername':_0x2d7503[_0xc2a5('0x21')],'interface':_0x20599c,'enterAt':moment()[_0xc2a5('0x24')](_0xc2a5('0x27')),'role':_0x2d7503['role'],'internal':_0x2d7503[_0xc2a5('0x23')]};_0x481702[_0xc2a5('0x2a')](function(_0x3103f6){_0x29299d[_0xc2a5('0x4e')](_[_0xc2a5('0x52')]({'channel':_0x3103f6,'type':'LOGIN','data1':_0xc2a5('0x53'),'data2':_0x20599c},_0x1fbc93));if(_0x2d7503[_0xc2a5('0x50')]){_0x302b69['push'](_[_0xc2a5('0x52')]({'channel':_0x3103f6,'type':_0xc2a5('0x54'),'data1':_0xc2a5('0x55')},_0x1fbc93));}});return db['MemberReport']['bulkCreate'](_0x29299d[_0xc2a5('0x56')](_0x302b69),{'individualHooks':!![]});}})['then'](function(){if(_0x2d7503){return _0x2d7503['update']({'online':!![],'lastLoginAt':moment()[_0xc2a5('0x24')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x2d7503[_0xc2a5('0x50')]||![],'mailPause':_0x2d7503[_0xc2a5('0x50')]||![],'chatPause':_0x2d7503[_0xc2a5('0x50')]||![],'faxPause':_0x2d7503[_0xc2a5('0x50')]||![],'smsPause':_0x2d7503[_0xc2a5('0x50')]||![],'openchannelPause':_0x2d7503[_0xc2a5('0x50')]||![],'pauseType':_0x2d7503[_0xc2a5('0x50')]?_0xc2a5('0x55'):null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x20599c});}})[_0xc2a5('0x1e')](function(_0xf7c044){_0x3b7d7d(_0xf7c044);})['catch'](function(_0x347fe6){_0x2b8e9c(_0x222566[_0xc2a5('0x1a')](0x1f4,_0x347fe6[_0xc2a5('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 64d6f80..0439878 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 _0x24ec=['removeListener','register','length','./user.events','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x24ec,0x147));var _0xc24e=function(_0x49fd03,_0x243aa0){_0x49fd03=_0x49fd03-0x0;var _0x405720=_0x24ec[_0x49fd03];return _0x405720;};'use strict';var UserEvents=require(_0xc24e('0x0'));var events=['save',_0xc24e('0x1'),'update'];function createListener(_0x5b5e90,_0x7724d0){return function(_0x2e4caf){_0x7724d0[_0xc24e('0x2')](_0x5b5e90,_0x2e4caf);};}function removeListener(_0x1511a3,_0x485e9c){return function(){UserEvents[_0xc24e('0x3')](_0x1511a3,_0x485e9c);};}exports[_0xc24e('0x4')]=function(_0x2fbad3){for(var _0x417134=0x0,_0x3af4b9=events[_0xc24e('0x5')];_0x417134<_0x3af4b9;_0x417134++){var _0x46844d=events[_0x417134];var _0x377ac2=createListener('user:'+_0x46844d,_0x2fbad3);UserEvents['on'](_0x46844d,_0x377ac2);}}; \ No newline at end of file +var _0xf9e5=['length','user:','./user.events','save','remove','update','emit','removeListener','register'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xf9e5,0x13d));var _0x5f9e=function(_0x29f3e3,_0x227bea){_0x29f3e3=_0x29f3e3-0x0;var _0x44b1b0=_0xf9e5[_0x29f3e3];return _0x44b1b0;};'use strict';var UserEvents=require(_0x5f9e('0x0'));var events=[_0x5f9e('0x1'),_0x5f9e('0x2'),_0x5f9e('0x3')];function createListener(_0x34b73e,_0x37256c){return function(_0x89474a){_0x37256c[_0x5f9e('0x4')](_0x34b73e,_0x89474a);};}function removeListener(_0x55bac3,_0x2bcaef){return function(){UserEvents[_0x5f9e('0x5')](_0x55bac3,_0x2bcaef);};}exports[_0x5f9e('0x6')]=function(_0x57e08b){for(var _0x2032e1=0x0,_0x44b55e=events[_0x5f9e('0x7')];_0x2032e1<_0x44b55e;_0x2032e1++){var _0x4cd279=events[_0x2032e1];var _0x23a6b7=createListener(_0x5f9e('0x8')+_0x4cd279,_0x57e08b);UserEvents['on'](_0x4cd279,_0x23a6b7);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 431dbad..88744ac 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x363fac,_0x479f13){var _0x53a343=function(_0x3fc856){while(--_0x3fc856){_0x363fac['push'](_0x363fac['shift']());}};_0x53a343(++_0x479f13);}(_0xe706,0xa3));var _0x6e70=function(_0x9f6f64,_0x4cd6df){_0x9f6f64=_0x9f6f64-0x0;var _0x3b9f5c=_0xe706[_0x9f6f64];return _0x3b9f5c;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x28d8d6,_0x452f71){var _0x12ba8e=function(_0x4548c8){while(--_0x4548c8){_0x28d8d6['push'](_0x28d8d6['shift']());}};_0x12ba8e(++_0x452f71);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 467e995..e53b169 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 _0xb22e=['sequelize','exports','INTEGER'];(function(_0x1ee351,_0x54261b){var _0x245aaf=function(_0x3e4b65){while(--_0x3e4b65){_0x1ee351['push'](_0x1ee351['shift']());}};_0x245aaf(++_0x54261b);}(_0xb22e,0x81));var _0xeb22=function(_0x220860,_0x87b5ea){_0x220860=_0x220860-0x0;var _0x506932=_0xb22e[_0x220860];return _0x506932;};'use strict';var Sequelize=require(_0xeb22('0x0'));module[_0xeb22('0x1')]={'penalty':{'type':Sequelize[_0xeb22('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbe83=['sequelize','INTEGER'];(function(_0x145e4c,_0x180ceb){var _0x2deb14=function(_0x51b2e1){while(--_0x51b2e1){_0x145e4c['push'](_0x145e4c['shift']());}};_0x2deb14(++_0x180ceb);}(_0xbe83,0xee));var _0x3be8=function(_0x3d9ded,_0x1ffcd0){_0x3d9ded=_0x3d9ded-0x0;var _0x348b01=_0xbe83[_0x3d9ded];return _0x348b01;};'use strict';var Sequelize=require(_0x3be8('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x3be8('0x1')],'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 22e7433..9e6144b 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 _0xdd4b=['UserChatQueue','user_has_chat_queues','util','../../config/logger','api','moment','request-promise','path','rimraf','./userChatQueue.attributes','define'];(function(_0x5a14dd,_0x55e143){var _0x43d8f6=function(_0x1d0e7d){while(--_0x1d0e7d){_0x5a14dd['push'](_0x5a14dd['shift']());}};_0x43d8f6(++_0x55e143);}(_0xdd4b,0x70));var _0xbdd4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xdd4b[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0xbdd4('0x0'));var logger=require(_0xbdd4('0x1'))(_0xbdd4('0x2'));var moment=require(_0xbdd4('0x3'));var BPromise=require('bluebird');var rp=require(_0xbdd4('0x4'));var fs=require('fs');var path=require(_0xbdd4('0x5'));var rimraf=require(_0xbdd4('0x6'));var config=require('../../config/environment');var attributes=require(_0xbdd4('0x7'));module['exports']=function(_0x2abd15,_0x4af720){return _0x2abd15[_0xbdd4('0x8')](_0xbdd4('0x9'),attributes,{'tableName':_0xbdd4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35b8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','lodash','../../config/logger','api'];(function(_0x6b2718,_0x40e9f3){var _0x49b993=function(_0x30ca07){while(--_0x30ca07){_0x6b2718['push'](_0x6b2718['shift']());}};_0x49b993(++_0x40e9f3);}(_0x35b8,0x176));var _0x835b=function(_0x353abb,_0x194c80){_0x353abb=_0x353abb-0x0;var _0x43c9c5=_0x35b8[_0x353abb];return _0x43c9c5;};'use strict';var _=require(_0x835b('0x0'));var util=require('util');var logger=require(_0x835b('0x1'))(_0x835b('0x2'));var moment=require(_0x835b('0x3'));var BPromise=require(_0x835b('0x4'));var rp=require(_0x835b('0x5'));var fs=require('fs');var path=require(_0x835b('0x6'));var rimraf=require(_0x835b('0x7'));var config=require(_0x835b('0x8'));var attributes=require(_0x835b('0x9'));module[_0x835b('0xa')]=function(_0x4fa1e4,_0x26adf3){return _0x4fa1e4[_0x835b('0xb')](_0x835b('0xc'),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 13e2afd..160aced 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 _0xce95=['error','code','message','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x32f4b2,_0x52fb01){var _0x426dab=function(_0xf3f5e0){while(--_0xf3f5e0){_0x32f4b2['push'](_0x32f4b2['shift']());}};_0x426dab(++_0x52fb01);}(_0xce95,0x7b));var _0x5ce9=function(_0x4a3eef,_0x16388a){_0x4a3eef=_0x4a3eef-0x0;var _0x2d5b79=_0xce95[_0x4a3eef];return _0x2d5b79;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5ce9('0x0'));var BPromise=require('bluebird');var rs=require(_0x5ce9('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ce9('0x2'))['db'];var utils=require(_0x5ce9('0x3'));var logger=require(_0x5ce9('0x4'))('rpc');var config=require(_0x5ce9('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x5ce9('0x6')][_0x5ce9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4d724b,_0x5bc268,_0x33ab0f){return new BPromise(function(_0x591cc1,_0x5c799c){return client[_0x5ce9('0x8')](_0x4d724b,_0x33ab0f)['then'](function(_0x1c00c8){logger[_0x5ce9('0x9')](_0x5ce9('0xa'),_0x5bc268,_0x5ce9('0xb'));logger[_0x5ce9('0xc')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x5bc268,_0x5ce9('0xb'),JSON['stringify'](_0x1c00c8));if(_0x1c00c8[_0x5ce9('0xd')]){if(_0x1c00c8[_0x5ce9('0xd')][_0x5ce9('0xe')]===0x1f4){logger[_0x5ce9('0xd')](_0x5ce9('0xa'),_0x5bc268,_0x1c00c8[_0x5ce9('0xd')][_0x5ce9('0xf')]);return _0x5c799c(_0x1c00c8[_0x5ce9('0xd')]['message']);}logger[_0x5ce9('0xd')](_0x5ce9('0xa'),_0x5bc268,_0x1c00c8[_0x5ce9('0xd')]['message']);return _0x591cc1(_0x1c00c8[_0x5ce9('0xd')]['message']);}else{logger[_0x5ce9('0x9')](_0x5ce9('0xa'),_0x5bc268,'request\x20sent');_0x591cc1(_0x1c00c8['result'][_0x5ce9('0xf')]);}})[_0x5ce9('0x10')](function(_0x4ed325){logger[_0x5ce9('0xd')](_0x5ce9('0xa'),_0x5bc268,_0x4ed325);_0x5c799c(_0x4ed325);});});} \ No newline at end of file +var _0x0623=['http','info','request\x20sent','debug','error','code','message','result','catch','UserChatQueue,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0623,0xbe));var _0x3062=function(_0x149756,_0x3ca594){_0x149756=_0x149756-0x0;var _0x7b8dc2=_0x0623[_0x149756];return _0x7b8dc2;};'use strict';var _=require(_0x3062('0x0'));var util=require(_0x3062('0x1'));var moment=require(_0x3062('0x2'));var BPromise=require(_0x3062('0x3'));var rs=require(_0x3062('0x4'));var fs=require('fs');var Redis=require(_0x3062('0x5'));var db=require(_0x3062('0x6'))['db'];var utils=require(_0x3062('0x7'));var logger=require('../../config/logger')(_0x3062('0x8'));var config=require(_0x3062('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3062('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3da16f,_0xad1bdb,_0x5a6968){return new BPromise(function(_0x192660,_0x4fefc5){return client['request'](_0x3da16f,_0x5a6968)['then'](function(_0xc1d664){logger[_0x3062('0xb')]('UserChatQueue,\x20%s,\x20%s',_0xad1bdb,_0x3062('0xc'));logger[_0x3062('0xd')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0xad1bdb,'request\x20sent',JSON['stringify'](_0xc1d664));if(_0xc1d664[_0x3062('0xe')]){if(_0xc1d664[_0x3062('0xe')][_0x3062('0xf')]===0x1f4){logger[_0x3062('0xe')]('UserChatQueue,\x20%s,\x20%s',_0xad1bdb,_0xc1d664[_0x3062('0xe')]['message']);return _0x4fefc5(_0xc1d664[_0x3062('0xe')][_0x3062('0x10')]);}logger[_0x3062('0xe')]('UserChatQueue,\x20%s,\x20%s',_0xad1bdb,_0xc1d664[_0x3062('0xe')]['message']);return _0x192660(_0xc1d664[_0x3062('0xe')][_0x3062('0x10')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0xad1bdb,_0x3062('0xc'));_0x192660(_0xc1d664[_0x3062('0x11')][_0x3062('0x10')]);}})[_0x3062('0x12')](function(_0x50989c){logger['error'](_0x3062('0x13'),_0xad1bdb,_0x50989c);_0x4fefc5(_0x50989c);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index a1f1659..dd74347 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0xf671b3,_0x37f4f7){var _0x3b6447=function(_0x1436f0){while(--_0x1436f0){_0xf671b3['push'](_0xf671b3['shift']());}};_0x3b6447(++_0x37f4f7);}(_0x70e0,0x17b));var _0x070e=function(_0x4d31aa,_0x5e9ba0){_0x4d31aa=_0x4d31aa-0x0;var _0x527373=_0x70e0[_0x4d31aa];return _0x527373;};'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(_0x55f6d7,_0x5bd984){var _0x2153cc=function(_0x11ff8b){while(--_0x11ff8b){_0x55f6d7['push'](_0x55f6d7['shift']());}};_0x2153cc(++_0x5bd984);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 590ad1b..94892c0 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 _0x5cbf=['sequelize','INTEGER','STRING'];(function(_0x558e45,_0x4f5e4f){var _0x3e9075=function(_0x289725){while(--_0x289725){_0x558e45['push'](_0x558e45['shift']());}};_0x3e9075(++_0x4f5e4f);}(_0x5cbf,0x1d4));var _0xf5cb=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x5cbf[_0x47aa64];return _0x549c7a;};'use strict';var Sequelize=require(_0xf5cb('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xf5cb('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xf5cb('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xf5cb('0x2')]}}; \ No newline at end of file +var _0x3f4d=['INTEGER','sequelize'];(function(_0x4953c9,_0x24591d){var _0x263a5e=function(_0x4181bf){while(--_0x4181bf){_0x4953c9['push'](_0x4953c9['shift']());}};_0x263a5e(++_0x24591d);}(_0x3f4d,0xeb));var _0xd3f4=function(_0x5e4fb9,_0x45caf4){_0x5e4fb9=_0x5e4fb9-0x0;var _0x4189b4=_0x3f4d[_0x5e4fb9];return _0x4189b4;};'use strict';var Sequelize=require(_0xd3f4('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xd3f4('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xd3f4('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 16eaf78..4ac3ab5 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 _0xb91f=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','user_has_fax_queues','util','../../config/logger'];(function(_0x5b41c2,_0x59461b){var _0x30bf4f=function(_0x52a746){while(--_0x52a746){_0x5b41c2['push'](_0x5b41c2['shift']());}};_0x30bf4f(++_0x59461b);}(_0xb91f,0x102));var _0xfb91=function(_0x3b9ad0,_0x2fa3f5){_0x3b9ad0=_0x3b9ad0-0x0;var _0xd8aee0=_0xb91f[_0x3b9ad0];return _0xd8aee0;};'use strict';var _=require('lodash');var util=require(_0xfb91('0x0'));var logger=require(_0xfb91('0x1'))('api');var moment=require('moment');var BPromise=require(_0xfb91('0x2'));var rp=require(_0xfb91('0x3'));var fs=require('fs');var path=require(_0xfb91('0x4'));var rimraf=require(_0xfb91('0x5'));var config=require(_0xfb91('0x6'));var attributes=require('./userFaxQueue.attributes');module[_0xfb91('0x7')]=function(_0x5dc1d8,_0x529b96){return _0x5dc1d8[_0xfb91('0x8')]('UserFaxQueue',attributes,{'tableName':_0xfb91('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd849=['exports','define','user_has_fax_queues','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes'];(function(_0x2c17a2,_0x58f80f){var _0x21d8c3=function(_0x41c5a5){while(--_0x41c5a5){_0x2c17a2['push'](_0x2c17a2['shift']());}};_0x21d8c3(++_0x58f80f);}(_0xd849,0x6f));var _0x9d84=function(_0x5bc28b,_0x5bf1a0){_0x5bc28b=_0x5bc28b-0x0;var _0x27a1d9=_0xd849[_0x5bc28b];return _0x27a1d9;};'use strict';var _=require(_0x9d84('0x0'));var util=require('util');var logger=require(_0x9d84('0x1'))('api');var moment=require(_0x9d84('0x2'));var BPromise=require(_0x9d84('0x3'));var rp=require(_0x9d84('0x4'));var fs=require('fs');var path=require(_0x9d84('0x5'));var rimraf=require(_0x9d84('0x6'));var config=require(_0x9d84('0x7'));var attributes=require(_0x9d84('0x8'));module[_0x9d84('0x9')]=function(_0x8f4da0,_0x4644c1){return _0x8f4da0[_0x9d84('0xa')]('UserFaxQueue',attributes,{'tableName':_0x9d84('0xb'),'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 170d035..eff1bb4 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 _0x0674=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','util','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0674,0x17a));var _0x4067=function(_0x19b002,_0x4027ca){_0x19b002=_0x19b002-0x0;var _0x777a08=_0x0674[_0x19b002];return _0x777a08;};'use strict';var _=require('lodash');var util=require(_0x4067('0x0'));var moment=require(_0x4067('0x1'));var BPromise=require(_0x4067('0x2'));var rs=require(_0x4067('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4067('0x4'))['db'];var utils=require(_0x4067('0x5'));var logger=require(_0x4067('0x6'))('rpc');var config=require(_0x4067('0x7'));var jayson=require(_0x4067('0x8'));var client=jayson[_0x4067('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23757e,_0x83c699,_0x54916d){return new BPromise(function(_0x39992d,_0x33c318){return client['request'](_0x23757e,_0x54916d)[_0x4067('0xa')](function(_0x267f96){logger[_0x4067('0xb')](_0x4067('0xc'),_0x83c699,'request\x20sent');logger[_0x4067('0xd')](_0x4067('0xe'),_0x83c699,_0x4067('0xf'),JSON[_0x4067('0x10')](_0x267f96));if(_0x267f96[_0x4067('0x11')]){if(_0x267f96[_0x4067('0x11')]['code']===0x1f4){logger[_0x4067('0x11')](_0x4067('0xc'),_0x83c699,_0x267f96[_0x4067('0x11')][_0x4067('0x12')]);return _0x33c318(_0x267f96['error'][_0x4067('0x12')]);}logger['error'](_0x4067('0xc'),_0x83c699,_0x267f96[_0x4067('0x11')][_0x4067('0x12')]);return _0x39992d(_0x267f96[_0x4067('0x11')][_0x4067('0x12')]);}else{logger[_0x4067('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x83c699,'request\x20sent');_0x39992d(_0x267f96['result'][_0x4067('0x12')]);}})[_0x4067('0x13')](function(_0x58ba98){logger[_0x4067('0x11')](_0x4067('0xc'),_0x83c699,_0x58ba98);_0x33c318(_0x58ba98);});});} \ No newline at end of file +var _0xdbad=['lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x524cb3,_0x2d702a){var _0x288975=function(_0x5e4b56){while(--_0x5e4b56){_0x524cb3['push'](_0x524cb3['shift']());}};_0x288975(++_0x2d702a);}(_0xdbad,0x1db));var _0xddba=function(_0x4b37c2,_0x13d497){_0x4b37c2=_0x4b37c2-0x0;var _0x5032f5=_0xdbad[_0x4b37c2];return _0x5032f5;};'use strict';var _=require(_0xddba('0x0'));var util=require(_0xddba('0x1'));var moment=require('moment');var BPromise=require(_0xddba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xddba('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xddba('0x4'));var logger=require(_0xddba('0x5'))(_0xddba('0x6'));var config=require(_0xddba('0x7'));var jayson=require(_0xddba('0x8'));var client=jayson['client'][_0xddba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c834d,_0x5db4ca,_0x4b13cf){return new BPromise(function(_0x5a5bc0,_0x55c1e4){return client['request'](_0x2c834d,_0x4b13cf)[_0xddba('0xa')](function(_0x3e4eaf){logger[_0xddba('0xb')](_0xddba('0xc'),_0x5db4ca,_0xddba('0xd'));logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x5db4ca,_0xddba('0xd'),JSON[_0xddba('0xe')](_0x3e4eaf));if(_0x3e4eaf['error']){if(_0x3e4eaf[_0xddba('0xf')][_0xddba('0x10')]===0x1f4){logger['error'](_0xddba('0xc'),_0x5db4ca,_0x3e4eaf[_0xddba('0xf')]['message']);return _0x55c1e4(_0x3e4eaf['error'][_0xddba('0x11')]);}logger['error'](_0xddba('0xc'),_0x5db4ca,_0x3e4eaf['error']['message']);return _0x5a5bc0(_0x3e4eaf[_0xddba('0xf')][_0xddba('0x11')]);}else{logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x5db4ca,'request\x20sent');_0x5a5bc0(_0x3e4eaf['result'][_0xddba('0x11')]);}})[_0xddba('0x12')](function(_0x3f5874){logger[_0xddba('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x5db4ca,_0x3f5874);_0x55c1e4(_0x3f5874);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index c8e6ff4..aa19ee9 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xc144be,_0x385142){var _0x4ffd89=function(_0x4d5ca1){while(--_0x4d5ca1){_0xc144be['push'](_0xc144be['shift']());}};_0x4ffd89(++_0x385142);}(_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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x54a479,_0x1b321d){var _0x2474ab=function(_0x428755){while(--_0x428755){_0x54a479['push'](_0x54a479['shift']());}};_0x2474ab(++_0x1b321d);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 4ceca60..edc83de 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 _0xcdce=['exports','INTEGER','sequelize'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xcdce,0xad));var _0xecdc=function(_0x43973e,_0x119e5d){_0x43973e=_0x43973e-0x0;var _0x26f1d2=_0xcdce[_0x43973e];return _0x26f1d2;};'use strict';var Sequelize=require(_0xecdc('0x0'));module[_0xecdc('0x1')]={'penalty':{'type':Sequelize[_0xecdc('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x555b=['exports','sequelize'];(function(_0x7c1a5d,_0x4bcb22){var _0x1cceb3=function(_0x3b235d){while(--_0x3b235d){_0x7c1a5d['push'](_0x7c1a5d['shift']());}};_0x1cceb3(++_0x4bcb22);}(_0x555b,0x16f));var _0xb555=function(_0x25eec4,_0x381181){_0x25eec4=_0x25eec4-0x0;var _0x189da5=_0x555b[_0x25eec4];return _0x189da5;};'use strict';var Sequelize=require(_0xb555('0x0'));module[_0xb555('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 73755d6..5c70fb1 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 _0x6b1b=['bluebird','rimraf','../../config/environment','./userMailQueue.attributes','exports','lodash','../../config/logger','api','moment'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6b1b,0x1e2));var _0xb6b1=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x6b1b[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0xb6b1('0x0'));var util=require('util');var logger=require(_0xb6b1('0x1'))(_0xb6b1('0x2'));var moment=require(_0xb6b1('0x3'));var BPromise=require(_0xb6b1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb6b1('0x5'));var config=require(_0xb6b1('0x6'));var attributes=require(_0xb6b1('0x7'));module[_0xb6b1('0x8')]=function(_0x471c6d,_0x4bc411){return _0x471c6d['define']('UserMailQueue',attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0296=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash','util'];(function(_0xa53e85,_0x41e734){var _0x573073=function(_0x3f0f83){while(--_0x3f0f83){_0xa53e85['push'](_0xa53e85['shift']());}};_0x573073(++_0x41e734);}(_0x0296,0x1b0));var _0x6029=function(_0x130d82,_0x25f49b){_0x130d82=_0x130d82-0x0;var _0x112070=_0x0296[_0x130d82];return _0x112070;};'use strict';var _=require(_0x6029('0x0'));var util=require(_0x6029('0x1'));var logger=require(_0x6029('0x2'))(_0x6029('0x3'));var moment=require(_0x6029('0x4'));var BPromise=require(_0x6029('0x5'));var rp=require(_0x6029('0x6'));var fs=require('fs');var path=require(_0x6029('0x7'));var rimraf=require(_0x6029('0x8'));var config=require(_0x6029('0x9'));var attributes=require(_0x6029('0xa'));module[_0x6029('0xb')]=function(_0x3434f2,_0x476a0a){return _0x3434f2[_0x6029('0xc')]('UserMailQueue',attributes,{'tableName':_0x6029('0xd'),'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 2fb9971..9827b6f 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 _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x1ec462,_0x5a00ef){var _0x4792eb=function(_0x5e2cc5){while(--_0x5e2cc5){_0x1ec462['push'](_0x1ec462['shift']());}};_0x4792eb(++_0x5a00ef);}(_0x34e8,0x12c));var _0x834e=function(_0x301e4d,_0x2afe6a){_0x301e4d=_0x301e4d-0x0;var _0x12d4d2=_0x34e8[_0x301e4d];return _0x12d4d2;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ 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(_0x27095b,_0x33dcd5){var _0x14cffc=function(_0xaa8784){while(--_0xaa8784){_0x27095b['push'](_0x27095b['shift']());}};_0x14cffc(++_0x33dcd5);}(_0xa41a,0x6b));var _0xaa41=function(_0x3ea9ca,_0x15a154){_0x3ea9ca=_0x3ea9ca-0x0;var _0x4d3307=_0xa41a[_0x3ea9ca];return _0x4d3307;};'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 c7a19a8..91b735f 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 _0xf332=['util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','sendUserNotification','exports','multer'];(function(_0x54fc7d,_0x3dc24c){var _0xa487de=function(_0x3c4b68){while(--_0x3c4b68){_0x54fc7d['push'](_0x54fc7d['shift']());}};_0xa487de(++_0x3dc24c);}(_0xf332,0x16a));var _0x2f33=function(_0x5ee4b1,_0x1b2a93){_0x5ee4b1=_0x5ee4b1-0x0;var _0x517050=_0xf332[_0x5ee4b1];return _0x517050;};'use strict';var multer=require(_0x2f33('0x0'));var util=require(_0x2f33('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2f33('0x2'));var router=express['Router']();var fs_extra=require(_0x2f33('0x3'));var auth=require(_0x2f33('0x4'));var interaction=require(_0x2f33('0x5'));var config=require(_0x2f33('0x6'));var controller=require(_0x2f33('0x7'));router[_0x2f33('0x8')]('/',auth['isAuthenticated'](),controller[_0x2f33('0x9')]);module[_0x2f33('0xa')]=router; \ No newline at end of file +var _0x8f0c=['../../components/interaction/service','../../config/environment','./userNotification.controller','post','util','path','express','Router','fs-extra'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x8f0c,0xee));var _0xc8f0=function(_0x5311e8,_0x57c5bb){_0x5311e8=_0x5311e8-0x0;var _0x582ad8=_0x8f0c[_0x5311e8];return _0x582ad8;};'use strict';var multer=require('multer');var util=require(_0xc8f0('0x0'));var path=require(_0xc8f0('0x1'));var timeout=require('connect-timeout');var express=require(_0xc8f0('0x2'));var router=express[_0xc8f0('0x3')]();var fs_extra=require(_0xc8f0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc8f0('0x5'));var config=require(_0xc8f0('0x6'));var controller=require(_0xc8f0('0x7'));router[_0xc8f0('0x8')]('/',auth['isAuthenticated'](),controller['sendUserNotification']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 32d8f23..b750638 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 _0x8cb0=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x4bece4,_0x1288eb){var _0x19d5c5=function(_0x165a05){while(--_0x165a05){_0x4bece4['push'](_0x4bece4['shift']());}};_0x19d5c5(++_0x1288eb);}(_0x8cb0,0x168));var _0x08cb=function(_0x403b85,_0x1b0d02){_0x403b85=_0x403b85-0x0;var _0x6290d7=_0x8cb0[_0x403b85];return _0x6290d7;};'use strict';var Sequelize=require(_0x08cb('0x0'));module[_0x08cb('0x1')]={'body':{'type':Sequelize[_0x08cb('0x2')]},'senderName':{'type':Sequelize[_0x08cb('0x3')]},'recipientsId':{'type':Sequelize[_0x08cb('0x2')]},'recipientsDescription':{'type':Sequelize[_0x08cb('0x3')]},'beep':{'type':Sequelize[_0x08cb('0x4')]}}; \ No newline at end of file +var _0x56de=['BOOLEAN','exports','TEXT','STRING'];(function(_0x10595e,_0x9bf938){var _0x55873f=function(_0x31b4e7){while(--_0x31b4e7){_0x10595e['push'](_0x10595e['shift']());}};_0x55873f(++_0x9bf938);}(_0x56de,0xf5));var _0xe56d=function(_0x308ae6,_0x2abf31){_0x308ae6=_0x308ae6-0x0;var _0xb5575c=_0x56de[_0x308ae6];return _0xb5575c;};'use strict';var Sequelize=require('sequelize');module[_0xe56d('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xe56d('0x1')]},'recipientsDescription':{'type':Sequelize[_0xe56d('0x2')]},'beep':{'type':Sequelize[_0xe56d('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 46461da..0112ff3 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 _0x7ae5=['isEmpty','recipientsDescription','beep','then','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','recipient','catch','Template','findOne','html','forEach','User','ids','includes','queue','replace','Queue','push','all','union','flatten','getAgents','map','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','destroy','error','stack','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','user','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname'];(function(_0x132fe1,_0x2a5861){var _0x3e9f38=function(_0x1bb681){while(--_0x1bb681){_0x132fe1['push'](_0x132fe1['shift']());}};_0x3e9f38(++_0x2a5861);}(_0x7ae5,0xeb));var _0x57ae=function(_0xb5646e,_0x327fd7){_0xb5646e=_0xb5646e-0x0;var _0x55fe64=_0x7ae5[_0xb5646e];return _0x55fe64;};'use strict';var emlformat=require(_0x57ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x57ae('0x1'));var jsonpatch=require(_0x57ae('0x2'));var rp=require(_0x57ae('0x3'));var moment=require(_0x57ae('0x4'));var BPromise=require(_0x57ae('0x5'));var Mustache=require(_0x57ae('0x6'));var util=require('util');var path=require(_0x57ae('0x7'));var sox=require(_0x57ae('0x8'));var csv=require(_0x57ae('0x9'));var ejs=require(_0x57ae('0xa'));var fs=require('fs');var fs_extra=require(_0x57ae('0xb'));var _=require(_0x57ae('0xc'));var squel=require(_0x57ae('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x57ae('0xe'));var toCsv=require('to-csv');var querystring=require(_0x57ae('0xf'));var Papa=require(_0x57ae('0x10'));var Redis=require(_0x57ae('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x57ae('0x12'));var as=require(_0x57ae('0x13'));var hardwareService=require(_0x57ae('0x14'));var logger=require('../../config/logger')(_0x57ae('0x15'));var utils=require(_0x57ae('0x16'));var config=require(_0x57ae('0x17'));var licenseUtil=require(_0x57ae('0x18'));var db=require(_0x57ae('0x19'))['db'];config[_0x57ae('0x1a')]=_[_0x57ae('0x1b')](config[_0x57ae('0x1a')],{'host':_0x57ae('0x1c'),'port':0x18eb});var socket=require(_0x57ae('0x1d'))(new Redis(config[_0x57ae('0x1a')]));require(_0x57ae('0x1e'))[_0x57ae('0x1f')](socket);function respondWithStatusCode(_0x4cf629,_0x32a010){_0x32a010=_0x32a010||0xcc;return function(_0x25e10a){if(_0x25e10a){return _0x4cf629[_0x57ae('0x20')](_0x32a010);}return _0x4cf629[_0x57ae('0x21')](_0x32a010)[_0x57ae('0x22')]();};}function respondWithResult(_0x1761c6,_0x25b58f){_0x25b58f=_0x25b58f||0xc8;return function(_0x45b4b3){if(_0x45b4b3){return _0x1761c6[_0x57ae('0x21')](_0x25b58f)[_0x57ae('0x23')](_0x45b4b3);}};}function respondWithFilteredResult(_0x12d031,_0x1f017c){return function(_0x4ad919){if(_0x4ad919){var _0x279a08=typeof _0x1f017c['offset']===_0x57ae('0x24')&&typeof _0x1f017c['limit']===_0x57ae('0x24');var _0x17923b=_0x4ad919[_0x57ae('0x25')];var _0x4d3ae0=_0x279a08?0x0:_0x1f017c[_0x57ae('0x26')];var _0x21c8c1=_0x279a08?_0x4ad919[_0x57ae('0x25')]:_0x1f017c['offset']+_0x1f017c[_0x57ae('0x27')];var _0x39cd4a;if(_0x21c8c1>=_0x17923b){_0x21c8c1=_0x17923b;_0x39cd4a=0xc8;}else{_0x39cd4a=0xce;}_0x12d031[_0x57ae('0x21')](_0x39cd4a);return _0x12d031[_0x57ae('0x28')](_0x57ae('0x29'),_0x4d3ae0+'-'+_0x21c8c1+'/'+_0x17923b)[_0x57ae('0x23')](_0x4ad919);}return null;};}function patchUpdates(_0x31bbbb){return function(_0x5aafa3){try{jsonpatch[_0x57ae('0x2a')](_0x5aafa3,_0x31bbbb,!![]);}catch(_0x52f5c7){return BPromise[_0x57ae('0x2b')](_0x52f5c7);}return _0x5aafa3['save']();};}function saveUpdates(_0x41f8d3,_0x5103b6){return function(_0x52d517){if(_0x52d517){return _0x52d517[_0x57ae('0x2c')](_0x41f8d3)['then'](function(_0x4e11ed){return _0x4e11ed;});}return null;};}function removeEntity(_0x5d5c1d,_0x18cc2c){return function(_0x4cbd8e){if(_0x4cbd8e){return _0x4cbd8e[_0x57ae('0x2d')]()['then'](function(){_0x5d5c1d['status'](0xcc)[_0x57ae('0x22')]();});}};}function handleEntityNotFound(_0x50208f,_0x52eb44){return function(_0x32681b){if(!_0x32681b){_0x50208f['sendStatus'](0x194);}return _0x32681b;};}function handleError(_0x463bba,_0x441f00){_0x441f00=_0x441f00||0x1f4;return function(_0x26e80b){logger[_0x57ae('0x2e')](_0x26e80b[_0x57ae('0x2f')]);if(_0x26e80b[_0x57ae('0x30')]){delete _0x26e80b[_0x57ae('0x30')];}_0x463bba['status'](_0x441f00)['send'](_0x26e80b);};}exports[_0x57ae('0x31')]=function(_0x24724b,_0x5d980b,_0x15098b){if(!_0x24724b[_0x57ae('0x32')][_0x57ae('0x33')](_0x57ae('0x34'))&&!_0x24724b[_0x57ae('0x32')]['hasOwnProperty'](_0x57ae('0x35'))){throw new db['Sequelize'][(_0x57ae('0x36'))](_0x57ae('0x37'));}else{if(_0x24724b[_0x57ae('0x32')][_0x57ae('0x33')]('TemplateId')&&!_0x24724b['body'][_0x57ae('0x33')](_0x57ae('0x38'))){throw new db[(_0x57ae('0x39'))][(_0x57ae('0x36'))](_0x57ae('0x3a'));}if(!_0x24724b[_0x57ae('0x32')]['hasOwnProperty'](_0x57ae('0x3b'))){throw new db[(_0x57ae('0x39'))][(_0x57ae('0x36'))](_0x57ae('0x3c'));}else{try{var _0x3df3cf=JSON[_0x57ae('0x3d')](_0x24724b[_0x57ae('0x32')]['recipients']);}catch(_0x54e2d5){logger['error'](_0x54e2d5);throw new db['Sequelize'][(_0x57ae('0x36'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x232bf1=[_0x57ae('0x3e'),_0x57ae('0x3f'),_0x57ae('0x40'),_0x57ae('0x41'),_0x57ae('0x42'),_0x57ae('0x43'),'whatsappqueue','team',_0x57ae('0x44')];if(_['some'](_0x3df3cf,function(_0x2cd57b){return!_['includes'](_0x232bf1,_0x2cd57b[_0x57ae('0x45')][_0x57ae('0x46')]());})){throw new db[(_0x57ae('0x39'))]['ValidationError'](_0x57ae('0x47'));}}}var _0x9cb9d8={};_0x9cb9d8['senderName']=_0x24724b['body'][_0x57ae('0x33')](_0x57ae('0x48'))?_0x24724b['body'][_0x57ae('0x48')]:_0x24724b[_0x57ae('0x44')][_0x57ae('0x49')];_0x9cb9d8['recipientsDescription']=_[_0x57ae('0x4a')](_0x24724b['body'][_0x57ae('0x4b')])?null:_0x24724b[_0x57ae('0x32')][_0x57ae('0x4b')];_0x9cb9d8[_0x57ae('0x4c')]=_0x24724b[_0x57ae('0x32')][_0x57ae('0x4c')]||![];_0x9cb9d8['SenderId']=_0x24724b[_0x57ae('0x44')]['id'];return getContent(_0x24724b[_0x57ae('0x32')])[_0x57ae('0x4d')](function(_0x535ae6){_0x9cb9d8[_0x57ae('0x32')]=_0x535ae6;return getRecipients(_0x3df3cf);})[_0x57ae('0x4d')](function(_0x5b0007){_0x9cb9d8[_0x57ae('0x4e')]=_[_0x57ae('0x4f')](_0x5b0007)[_0x57ae('0x50')](',');return db[_0x57ae('0x51')][_0x57ae('0x52')](function(_0x4e115e){return db[_0x57ae('0x53')][_0x57ae('0x54')](_0x9cb9d8,{'raw':!![],'transaction':_0x4e115e})['then'](function(_0x4e3e62){var _0x497bfa={'sender':_0x9cb9d8[_0x57ae('0x48')],'description':_0x9cb9d8[_0x57ae('0x4b')],'content':_0x9cb9d8[_0x57ae('0x32')],'beep':_0x9cb9d8[_0x57ae('0x4c')]};_0x5b0007['forEach'](function(_0x462ac8){_0x497bfa[_0x57ae('0x55')]=_0x462ac8;socket['emit']('userNotification:send',_0x497bfa);});return _0x4e3e62;});});})[_0x57ae('0x4d')](respondWithResult(_0x5d980b,0xc9))[_0x57ae('0x56')](handleError(_0x5d980b,null));};function getContent(_0x58bbba){return new BPromise(function(_0x485546,_0x15ed70){if(_0x58bbba[_0x57ae('0x34')]){_0x485546(_0x58bbba[_0x57ae('0x34')]);return;}return db[_0x57ae('0x57')][_0x57ae('0x58')]({'attributes':[_0x57ae('0x59')],'where':{'id':_0x58bbba[_0x57ae('0x35')]},'raw':!![]})['then'](function(_0x1e918f){if(!_0x1e918f)throw new db[(_0x57ae('0x39'))][(_0x57ae('0x36'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x3a6c3d=Mustache['render'](_0x1e918f[_0x57ae('0x59')],_0x58bbba['view']);_0x485546(_0x3a6c3d);})['catch'](function(_0x5bb9a2){_0x15ed70(_0x5bb9a2);});});}function getRecipients(_0x2fc7f1){return new BPromise(function(_0x17909d,_0xdf0c2f){var _0x2e926f=[];var _0x5396b0=[];_0x2fc7f1[_0x57ae('0x5a')](function(_0x2ad8dd){var _0x1a639b=_['startCase'](_0x2ad8dd[_0x57ae('0x45')][_0x57ae('0x46')]());if(_0x1a639b===_0x57ae('0x5b')){_0x2e926f=_['union'](_0x2e926f,_0x2ad8dd[_0x57ae('0x5c')]);}else{if(_[_0x57ae('0x5d')](_0x1a639b,_0x57ae('0x5e')))_0x1a639b=_0x1a639b[_0x57ae('0x5f')]('queue',_0x57ae('0x60'));_0x2ad8dd[_0x57ae('0x5c')][_0x57ae('0x5a')](function(_0x336946){_0x5396b0[_0x57ae('0x61')](getAgents(_0x1a639b,_0x336946));});}});return BPromise[_0x57ae('0x62')](_0x5396b0)['then'](function(_0x132c6f){_0x2e926f=_[_0x57ae('0x63')](_0x2e926f,_[_0x57ae('0x64')](_0x132c6f));_0x17909d(_0x2e926f);})['catch'](function(_0x2a844c){_0xdf0c2f(_0x2a844c);});});}function getAgents(_0x3b07cb,_0x3a26f7){return new BPromise(function(_0x27fdc2,_0x327bc8){return db[_0x3b07cb][_0x57ae('0x58')]({'where':{'id':_0x3a26f7}})['then'](function(_0x472315){return _0x472315[_0x57ae('0x65')]({'attributes':['id'],'raw':!![]})[_0x57ae('0x4d')](function(_0x446322){var _0x39152f=_[_0x57ae('0x66')](_0x446322,'id');_0x27fdc2(_0x39152f);});})[_0x57ae('0x56')](function(_0x3fa010){_0x327bc8(_0x3fa010);});});} \ No newline at end of file +var _0x1b4c=['html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','model','User','ids','queue','replace','Queue','all','union','flatten','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','sendUserNotification','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','create','forEach','recipient','emit','userNotification:send','findOne'];(function(_0x48255d,_0x3331e7){var _0x16a000=function(_0x5d0c1a){while(--_0x5d0c1a){_0x48255d['push'](_0x48255d['shift']());}};_0x16a000(++_0x3331e7);}(_0x1b4c,0xe4));var _0xc1b4=function(_0x27c7b2,_0x3c8adc){_0x27c7b2=_0x27c7b2-0x0;var _0x33829e=_0x1b4c[_0x27c7b2];return _0x33829e;};'use strict';var emlformat=require(_0xc1b4('0x0'));var rimraf=require(_0xc1b4('0x1'));var zipdir=require(_0xc1b4('0x2'));var jsonpatch=require(_0xc1b4('0x3'));var rp=require(_0xc1b4('0x4'));var moment=require('moment');var BPromise=require(_0xc1b4('0x5'));var Mustache=require(_0xc1b4('0x6'));var util=require(_0xc1b4('0x7'));var path=require(_0xc1b4('0x8'));var sox=require(_0xc1b4('0x9'));var csv=require(_0xc1b4('0xa'));var ejs=require(_0xc1b4('0xb'));var fs=require('fs');var fs_extra=require(_0xc1b4('0xc'));var _=require(_0xc1b4('0xd'));var squel=require(_0xc1b4('0xe'));var crypto=require(_0xc1b4('0xf'));var jsforce=require(_0xc1b4('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xc1b4('0xa'));var querystring=require(_0xc1b4('0x11'));var Papa=require(_0xc1b4('0x12'));var Redis=require('ioredis');var authService=require(_0xc1b4('0x13'));var qs=require(_0xc1b4('0x14'));var as=require(_0xc1b4('0x15'));var hardwareService=require(_0xc1b4('0x16'));var logger=require('../../config/logger')(_0xc1b4('0x17'));var utils=require(_0xc1b4('0x18'));var config=require(_0xc1b4('0x19'));var licenseUtil=require(_0xc1b4('0x1a'));var db=require(_0xc1b4('0x1b'))['db'];config[_0xc1b4('0x1c')]=_[_0xc1b4('0x1d')](config[_0xc1b4('0x1c')],{'host':_0xc1b4('0x1e'),'port':0x18eb});var socket=require(_0xc1b4('0x1f'))(new Redis(config[_0xc1b4('0x1c')]));require('./userNotification.socket')['register'](socket);function respondWithStatusCode(_0x5ee3c7,_0x4becaf){_0x4becaf=_0x4becaf||0xcc;return function(_0x10a8b8){if(_0x10a8b8){return _0x5ee3c7[_0xc1b4('0x20')](_0x4becaf);}return _0x5ee3c7['status'](_0x4becaf)[_0xc1b4('0x21')]();};}function respondWithResult(_0x518821,_0x5c6cac){_0x5c6cac=_0x5c6cac||0xc8;return function(_0x146a3c){if(_0x146a3c){return _0x518821[_0xc1b4('0x22')](_0x5c6cac)[_0xc1b4('0x23')](_0x146a3c);}};}function respondWithFilteredResult(_0x1a7775,_0x15dab4){return function(_0xbd8e33){if(_0xbd8e33){var _0x58d035=typeof _0x15dab4[_0xc1b4('0x24')]===_0xc1b4('0x25')&&typeof _0x15dab4[_0xc1b4('0x26')]===_0xc1b4('0x25');var _0x380dd2=_0xbd8e33['count'];var _0x4908d7=_0x58d035?0x0:_0x15dab4[_0xc1b4('0x24')];var _0x5eeb48=_0x58d035?_0xbd8e33[_0xc1b4('0x27')]:_0x15dab4[_0xc1b4('0x24')]+_0x15dab4['limit'];var _0x101e15;if(_0x5eeb48>=_0x380dd2){_0x5eeb48=_0x380dd2;_0x101e15=0xc8;}else{_0x101e15=0xce;}_0x1a7775[_0xc1b4('0x22')](_0x101e15);return _0x1a7775[_0xc1b4('0x28')](_0xc1b4('0x29'),_0x4908d7+'-'+_0x5eeb48+'/'+_0x380dd2)['json'](_0xbd8e33);}return null;};}function patchUpdates(_0x5067a9){return function(_0x2a14f9){try{jsonpatch[_0xc1b4('0x2a')](_0x2a14f9,_0x5067a9,!![]);}catch(_0x573fcc){return BPromise[_0xc1b4('0x2b')](_0x573fcc);}return _0x2a14f9[_0xc1b4('0x2c')]();};}function saveUpdates(_0x12bdbe,_0x29e882){return function(_0x4130e9){if(_0x4130e9){return _0x4130e9['update'](_0x12bdbe)[_0xc1b4('0x2d')](function(_0x37e76f){return _0x37e76f;});}return null;};}function removeEntity(_0x12b490,_0x38dbb6){return function(_0x51f9cd){if(_0x51f9cd){return _0x51f9cd[_0xc1b4('0x2e')]()[_0xc1b4('0x2d')](function(){_0x12b490[_0xc1b4('0x22')](0xcc)[_0xc1b4('0x21')]();});}};}function handleEntityNotFound(_0x273d63,_0x2dda87){return function(_0x126705){if(!_0x126705){_0x273d63[_0xc1b4('0x20')](0x194);}return _0x126705;};}function handleError(_0x2e0e9b,_0x366239){_0x366239=_0x366239||0x1f4;return function(_0x53460d){logger[_0xc1b4('0x2f')](_0x53460d['stack']);if(_0x53460d['name']){delete _0x53460d[_0xc1b4('0x30')];}_0x2e0e9b[_0xc1b4('0x22')](_0x366239)[_0xc1b4('0x31')](_0x53460d);};}exports[_0xc1b4('0x32')]=function(_0x4f6197,_0x43a441,_0xc642eb){if(!_0x4f6197['body'][_0xc1b4('0x33')](_0xc1b4('0x34'))&&!_0x4f6197[_0xc1b4('0x35')][_0xc1b4('0x33')](_0xc1b4('0x36'))){throw new db[(_0xc1b4('0x37'))][(_0xc1b4('0x38'))](_0xc1b4('0x39'));}else{if(_0x4f6197[_0xc1b4('0x35')]['hasOwnProperty'](_0xc1b4('0x36'))&&!_0x4f6197[_0xc1b4('0x35')][_0xc1b4('0x33')](_0xc1b4('0x3a'))){throw new db[(_0xc1b4('0x37'))]['ValidationError']('Missing\x20\x27view\x27\x20parameter');}if(!_0x4f6197[_0xc1b4('0x35')][_0xc1b4('0x33')](_0xc1b4('0x3b'))){throw new db[(_0xc1b4('0x37'))][(_0xc1b4('0x38'))](_0xc1b4('0x3c'));}else{try{var _0x52e937=JSON[_0xc1b4('0x3d')](_0x4f6197['body'][_0xc1b4('0x3b')]);}catch(_0x50c630){logger['error'](_0x50c630);throw new db[(_0xc1b4('0x37'))][(_0xc1b4('0x38'))](_0xc1b4('0x3e'));}var _0xdb25d5=[_0xc1b4('0x3f'),_0xc1b4('0x40'),_0xc1b4('0x41'),_0xc1b4('0x42'),_0xc1b4('0x43'),_0xc1b4('0x44'),_0xc1b4('0x45'),_0xc1b4('0x46'),_0xc1b4('0x47')];if(_[_0xc1b4('0x48')](_0x52e937,function(_0x55b4cf){return!_[_0xc1b4('0x49')](_0xdb25d5,_0x55b4cf['model'][_0xc1b4('0x4a')]());})){throw new db[(_0xc1b4('0x37'))][(_0xc1b4('0x38'))](_0xc1b4('0x4b'));}}}var _0xe4031c={};_0xe4031c[_0xc1b4('0x4c')]=_0x4f6197[_0xc1b4('0x35')][_0xc1b4('0x33')](_0xc1b4('0x4c'))?_0x4f6197['body'][_0xc1b4('0x4c')]:_0x4f6197[_0xc1b4('0x47')][_0xc1b4('0x4d')];_0xe4031c[_0xc1b4('0x4e')]=_[_0xc1b4('0x4f')](_0x4f6197['body'][_0xc1b4('0x4e')])?null:_0x4f6197['body'][_0xc1b4('0x4e')];_0xe4031c[_0xc1b4('0x50')]=_0x4f6197[_0xc1b4('0x35')]['beep']||![];_0xe4031c[_0xc1b4('0x51')]=_0x4f6197[_0xc1b4('0x47')]['id'];return getContent(_0x4f6197[_0xc1b4('0x35')])[_0xc1b4('0x2d')](function(_0x3c89a2){_0xe4031c[_0xc1b4('0x35')]=_0x3c89a2;return getRecipients(_0x52e937);})['then'](function(_0x465744){_0xe4031c[_0xc1b4('0x52')]=_[_0xc1b4('0x53')](_0x465744)[_0xc1b4('0x54')](',');return db[_0xc1b4('0x55')][_0xc1b4('0x56')](function(_0x366602){return db['UserNotification'][_0xc1b4('0x57')](_0xe4031c,{'raw':!![],'transaction':_0x366602})['then'](function(_0x261fd9){var _0x4b35f2={'sender':_0xe4031c[_0xc1b4('0x4c')],'description':_0xe4031c['recipientsDescription'],'content':_0xe4031c[_0xc1b4('0x35')],'beep':_0xe4031c[_0xc1b4('0x50')]};_0x465744[_0xc1b4('0x58')](function(_0x310071){_0x4b35f2[_0xc1b4('0x59')]=_0x310071;socket[_0xc1b4('0x5a')](_0xc1b4('0x5b'),_0x4b35f2);});return _0x261fd9;});});})['then'](respondWithResult(_0x43a441,0xc9))['catch'](handleError(_0x43a441,null));};function getContent(_0x21e63d){return new BPromise(function(_0x176eff,_0x52b8f9){if(_0x21e63d[_0xc1b4('0x34')]){_0x176eff(_0x21e63d[_0xc1b4('0x34')]);return;}return db['Template'][_0xc1b4('0x5c')]({'attributes':[_0xc1b4('0x5d')],'where':{'id':_0x21e63d[_0xc1b4('0x36')]},'raw':!![]})[_0xc1b4('0x2d')](function(_0x33281f){if(!_0x33281f)throw new db[(_0xc1b4('0x37'))][(_0xc1b4('0x38'))](_0xc1b4('0x5e'));var _0x406b36=Mustache[_0xc1b4('0x5f')](_0x33281f[_0xc1b4('0x5d')],_0x21e63d[_0xc1b4('0x3a')]);_0x176eff(_0x406b36);})[_0xc1b4('0x60')](function(_0x6d1d9d){_0x52b8f9(_0x6d1d9d);});});}function getRecipients(_0x56013b){return new BPromise(function(_0x337e6a,_0x429597){var _0x557b15=[];var _0x31a8ef=[];_0x56013b[_0xc1b4('0x58')](function(_0x28c4d6){var _0x1cbc16=_['startCase'](_0x28c4d6[_0xc1b4('0x61')][_0xc1b4('0x4a')]());if(_0x1cbc16===_0xc1b4('0x62')){_0x557b15=_['union'](_0x557b15,_0x28c4d6[_0xc1b4('0x63')]);}else{if(_[_0xc1b4('0x49')](_0x1cbc16,_0xc1b4('0x64')))_0x1cbc16=_0x1cbc16[_0xc1b4('0x65')](_0xc1b4('0x64'),_0xc1b4('0x66'));_0x28c4d6['ids'][_0xc1b4('0x58')](function(_0xd9c269){_0x31a8ef['push'](getAgents(_0x1cbc16,_0xd9c269));});}});return BPromise[_0xc1b4('0x67')](_0x31a8ef)[_0xc1b4('0x2d')](function(_0x21d571){_0x557b15=_[_0xc1b4('0x68')](_0x557b15,_[_0xc1b4('0x69')](_0x21d571));_0x337e6a(_0x557b15);})[_0xc1b4('0x60')](function(_0x2fb8c4){_0x429597(_0x2fb8c4);});});}function getAgents(_0x2e76aa,_0x3f84d0){return new BPromise(function(_0x1f95d9,_0x48597e){return db[_0x2e76aa][_0xc1b4('0x5c')]({'where':{'id':_0x3f84d0}})[_0xc1b4('0x2d')](function(_0x5e7dfc){return _0x5e7dfc['getAgents']({'attributes':['id'],'raw':!![]})[_0xc1b4('0x2d')](function(_0x3422bd){var _0x292480=_[_0xc1b4('0x6a')](_0x3422bd,'id');_0x1f95d9(_0x292480);});})[_0xc1b4('0x60')](function(_0x4d84f0){_0x48597e(_0x4d84f0);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index eea4137..c70f8c0 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 _0x0a00=['exports','events','../../mysqldb','UserNotification','save','update','remove','emit','hook'];(function(_0x2ba9ac,_0xa1fdc4){var _0x1b0fc9=function(_0x4343de){while(--_0x4343de){_0x2ba9ac['push'](_0x2ba9ac['shift']());}};_0x1b0fc9(++_0xa1fdc4);}(_0x0a00,0x10f));var _0x00a0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x0a00[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require(_0x00a0('0x0'));var UserNotification=require(_0x00a0('0x1'))['db'][_0x00a0('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x00a0('0x3'),'afterUpdate':_0x00a0('0x4'),'afterDestroy':_0x00a0('0x5')};function emitEvent(_0x138fe3){return function(_0x28cecc,_0x3146a9,_0x942f6e){UserNotificationEvents[_0x00a0('0x6')](_0x138fe3+':'+_0x28cecc['id'],_0x28cecc);UserNotificationEvents[_0x00a0('0x6')](_0x138fe3,_0x28cecc);_0x942f6e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x00a0('0x7')](e,emitEvent(event));}}module[_0x00a0('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0xea6a=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','UserNotification','setMaxListeners'];(function(_0x578081,_0x48fdf2){var _0xba77b8=function(_0x133518){while(--_0x133518){_0x578081['push'](_0x578081['shift']());}};_0xba77b8(++_0x48fdf2);}(_0xea6a,0x135));var _0xaea6=function(_0x5ec45c,_0x4f8362){_0x5ec45c=_0x5ec45c-0x0;var _0x4934e1=_0xea6a[_0x5ec45c];return _0x4934e1;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0xaea6('0x0'))['db'][_0xaea6('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xaea6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xaea6('0x3')};function emitEvent(_0x2ed35c){return function(_0x2a82ac,_0x3fa92f,_0x2c3667){UserNotificationEvents[_0xaea6('0x4')](_0x2ed35c+':'+_0x2a82ac['id'],_0x2a82ac);UserNotificationEvents['emit'](_0x2ed35c,_0x2a82ac);_0x2c3667(null);};}for(var e in events){if(events[_0xaea6('0x5')](e)){var event=events[e];UserNotification[_0xaea6('0x6')](e,emitEvent(event));}}module[_0xaea6('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index be1c27e..9bbfb39 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 _0x4331=['./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x26fe8a,_0x2568ec){var _0x15108e=function(_0x331235){while(--_0x331235){_0x26fe8a['push'](_0x26fe8a['shift']());}};_0x15108e(++_0x2568ec);}(_0x4331,0x115));var _0x1433=function(_0x44406f,_0x428cc6){_0x44406f=_0x44406f-0x0;var _0x59dfaf=_0x4331[_0x44406f];return _0x59dfaf;};'use strict';var _=require(_0x1433('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1433('0x1'));var moment=require(_0x1433('0x2'));var BPromise=require(_0x1433('0x3'));var rp=require(_0x1433('0x4'));var fs=require('fs');var path=require(_0x1433('0x5'));var rimraf=require(_0x1433('0x6'));var config=require(_0x1433('0x7'));var attributes=require(_0x1433('0x8'));module[_0x1433('0x9')]=function(_0x53fe31,_0xe158c8){return _0x53fe31[_0x1433('0xa')](_0x1433('0xb'),attributes,{'tableName':_0x1433('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1433('0xd'),'collate':_0x1433('0xe')});}; \ No newline at end of file +var _0x1551=['userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','path','rimraf','../../config/environment','UserNotification'];(function(_0x20c551,_0x5a28d0){var _0x24df8f=function(_0x3dae99){while(--_0x3dae99){_0x20c551['push'](_0x20c551['shift']());}};_0x24df8f(++_0x5a28d0);}(_0x1551,0x16e));var _0x1155=function(_0x43f881,_0xd6e5a2){_0x43f881=_0x43f881-0x0;var _0x365c14=_0x1551[_0x43f881];return _0x365c14;};'use strict';var _=require(_0x1155('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1155('0x1'));var moment=require(_0x1155('0x2'));var BPromise=require(_0x1155('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1155('0x4'));var rimraf=require(_0x1155('0x5'));var config=require(_0x1155('0x6'));var attributes=require('./userNotification.attributes');module['exports']=function(_0x21a611,_0x471cc9){return _0x21a611['define'](_0x1155('0x7'),attributes,{'tableName':_0x1155('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1155('0x9'),'collate':_0x1155('0xa')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index c34884c..5cd062f 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 _0x4d91=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','code','error','UserNotification,\x20%s,\x20%s','message','request\x20sent','result','catch','bluebird'];(function(_0x5f4464,_0x558b7f){var _0x1a9e15=function(_0x442c72){while(--_0x442c72){_0x5f4464['push'](_0x5f4464['shift']());}};_0x1a9e15(++_0x558b7f);}(_0x4d91,0x103));var _0x14d9=function(_0x4404ff,_0x13d7a9){_0x4404ff=_0x4404ff-0x0;var _0x5e7b19=_0x4d91[_0x4404ff];return _0x5e7b19;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x14d9('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x14d9('0x1'))['db'];var utils=require(_0x14d9('0x2'));var logger=require(_0x14d9('0x3'))(_0x14d9('0x4'));var config=require(_0x14d9('0x5'));var jayson=require(_0x14d9('0x6'));var client=jayson[_0x14d9('0x7')][_0x14d9('0x8')]({'port':0x232a});config[_0x14d9('0x9')]=_['defaults'](config[_0x14d9('0x9')],{'host':_0x14d9('0xa'),'port':0x18eb});var socket=require(_0x14d9('0xb'))(new Redis(config['redis']));require('./userNotification.socket')[_0x14d9('0xc')](socket);function respondWithRpcPromise(_0x1ac74d,_0x509472,_0x1f9d30){return new BPromise(function(_0x34af06,_0x13ba4b){return client[_0x14d9('0xd')](_0x1ac74d,_0x1f9d30)[_0x14d9('0xe')](function(_0x40e981){logger[_0x14d9('0xf')]('UserNotification,\x20%s,\x20%s',_0x509472,'request\x20sent');logger[_0x14d9('0x10')](_0x14d9('0x11'),_0x509472,'request\x20sent',JSON[_0x14d9('0x12')](_0x40e981));if(_0x40e981['error']){if(_0x40e981['error'][_0x14d9('0x13')]===0x1f4){logger[_0x14d9('0x14')](_0x14d9('0x15'),_0x509472,_0x40e981[_0x14d9('0x14')][_0x14d9('0x16')]);return _0x13ba4b(_0x40e981['error'][_0x14d9('0x16')]);}logger[_0x14d9('0x14')](_0x14d9('0x15'),_0x509472,_0x40e981[_0x14d9('0x14')][_0x14d9('0x16')]);return _0x34af06(_0x40e981[_0x14d9('0x14')]['message']);}else{logger[_0x14d9('0xf')](_0x14d9('0x15'),_0x509472,_0x14d9('0x17'));_0x34af06(_0x40e981[_0x14d9('0x18')][_0x14d9('0x16')]);}})[_0x14d9('0x19')](function(_0x5e9fef){logger[_0x14d9('0x14')]('UserNotification,\x20%s,\x20%s',_0x509472,_0x5e9fef);_0x13ba4b(_0x5e9fef);});});} \ No newline at end of file +var _0xc78c=['catch','lodash','util','moment','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','localhost','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x34bd5b,_0x40d40f){var _0x25890f=function(_0x3888ce){while(--_0x3888ce){_0x34bd5b['push'](_0x34bd5b['shift']());}};_0x25890f(++_0x40d40f);}(_0xc78c,0x161));var _0xcc78=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xc78c[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xcc78('0x0'));var util=require(_0xcc78('0x1'));var moment=require(_0xcc78('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcc78('0x3'));var db=require(_0xcc78('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcc78('0x5'));var config=require('../../config/environment');var jayson=require(_0xcc78('0x6'));var client=jayson[_0xcc78('0x7')][_0xcc78('0x8')]({'port':0x232a});config[_0xcc78('0x9')]=_[_0xcc78('0xa')](config['redis'],{'host':_0xcc78('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc78('0x9')]));require('./userNotification.socket')['register'](socket);function respondWithRpcPromise(_0x4030ab,_0x5a2137,_0x16fd47){return new BPromise(function(_0x161fc9,_0x22ee1e){return client[_0xcc78('0xc')](_0x4030ab,_0x16fd47)['then'](function(_0x4ea44e){logger[_0xcc78('0xd')](_0xcc78('0xe'),_0x5a2137,_0xcc78('0xf'));logger[_0xcc78('0x10')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x5a2137,_0xcc78('0xf'),JSON['stringify'](_0x4ea44e));if(_0x4ea44e[_0xcc78('0x11')]){if(_0x4ea44e[_0xcc78('0x11')][_0xcc78('0x12')]===0x1f4){logger[_0xcc78('0x11')](_0xcc78('0xe'),_0x5a2137,_0x4ea44e[_0xcc78('0x11')][_0xcc78('0x13')]);return _0x22ee1e(_0x4ea44e[_0xcc78('0x11')][_0xcc78('0x13')]);}logger['error'](_0xcc78('0xe'),_0x5a2137,_0x4ea44e[_0xcc78('0x11')][_0xcc78('0x13')]);return _0x161fc9(_0x4ea44e[_0xcc78('0x11')][_0xcc78('0x13')]);}else{logger[_0xcc78('0xd')](_0xcc78('0xe'),_0x5a2137,'request\x20sent');_0x161fc9(_0x4ea44e[_0xcc78('0x14')][_0xcc78('0x13')]);}})[_0xcc78('0x15')](function(_0x3fe87b){logger[_0xcc78('0x11')](_0xcc78('0xe'),_0x5a2137,_0x3fe87b);_0x22ee1e(_0x3fe87b);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index b594fc1..bf5a427 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 _0x6d47=['update','emit','removeListener','register','length','userNotification:','./userNotification.events','save','remove'];(function(_0xb893c,_0x1ab5b2){var _0x479368=function(_0x30e9ae){while(--_0x30e9ae){_0xb893c['push'](_0xb893c['shift']());}};_0x479368(++_0x1ab5b2);}(_0x6d47,0x141));var _0x76d4=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x6d47[_0x4ea69d];return _0x5318e0;};'use strict';var UserNotificationEvents=require(_0x76d4('0x0'));var events=[_0x76d4('0x1'),_0x76d4('0x2'),_0x76d4('0x3')];function createListener(_0x1aede4,_0x27f377){return function(_0x43b612){_0x27f377[_0x76d4('0x4')](_0x1aede4,_0x43b612);};}function removeListener(_0x3ecb11,_0x46fa77){return function(){UserNotificationEvents[_0x76d4('0x5')](_0x3ecb11,_0x46fa77);};}exports[_0x76d4('0x6')]=function(_0xa9b4d6){for(var _0x4553b2=0x0,_0x725b4c=events[_0x76d4('0x7')];_0x4553b2<_0x725b4c;_0x4553b2++){var _0x2db08c=events[_0x4553b2];var _0x40e2d5=createListener(_0x76d4('0x8')+_0x2db08c,_0xa9b4d6);UserNotificationEvents['on'](_0x2db08c,_0x40e2d5);}}; \ No newline at end of file +var _0x5649=['./userNotification.events','update','emit','removeListener','register','length'];(function(_0x2eee25,_0x53460d){var _0x1cb8c4=function(_0x4dad56){while(--_0x4dad56){_0x2eee25['push'](_0x2eee25['shift']());}};_0x1cb8c4(++_0x53460d);}(_0x5649,0x162));var _0x9564=function(_0x149478,_0x380771){_0x149478=_0x149478-0x0;var _0x2bcd4d=_0x5649[_0x149478];return _0x2bcd4d;};'use strict';var UserNotificationEvents=require(_0x9564('0x0'));var events=['save','remove',_0x9564('0x1')];function createListener(_0x219497,_0x454541){return function(_0x409684){_0x454541[_0x9564('0x2')](_0x219497,_0x409684);};}function removeListener(_0x51c3f1,_0xe879e2){return function(){UserNotificationEvents[_0x9564('0x3')](_0x51c3f1,_0xe879e2);};}exports[_0x9564('0x4')]=function(_0x1a22ec){for(var _0x4e7490=0x0,_0x7885ea=events[_0x9564('0x5')];_0x4e7490<_0x7885ea;_0x4e7490++){var _0x828391=events[_0x4e7490];var _0x2bc420=createListener('userNotification:'+_0x828391,_0x1a22ec);UserNotificationEvents['on'](_0x828391,_0x2bc420);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 766a640..89b747a 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x57931c,_0x5a3537){var _0x41cfe4=function(_0x2ab466){while(--_0x2ab466){_0x57931c['push'](_0x57931c['shift']());}};_0x41cfe4(++_0x5a3537);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3dea7d,_0x2cd4ea){_0x3dea7d=_0x3dea7d-0x0;var _0x53919a=_0xcb91[_0x3dea7d];return _0x53919a;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4651ae,_0x3d2bc0){var _0x29a97c=function(_0xf05c25){while(--_0xf05c25){_0x4651ae['push'](_0x4651ae['shift']());}};_0x29a97c(++_0x3d2bc0);}(_0x9c44,0x178));var _0x49c4=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x9c44[_0xb0f7c3];return _0x28ea68;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 0f5ba3b..56e32ea 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 _0x7ab0=['sequelize','exports','INTEGER'];(function(_0x45b24a,_0x83731){var _0x1dac4c=function(_0x52b0ac){while(--_0x52b0ac){_0x45b24a['push'](_0x45b24a['shift']());}};_0x1dac4c(++_0x83731);}(_0x7ab0,0x135));var _0x07ab=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7ab0[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x07ab('0x0'));module[_0x07ab('0x1')]={'penalty':{'type':Sequelize[_0x07ab('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3e67=['INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e67,0x88));var _0x73e6=function(_0x5c2a2b,_0x22c94e){_0x5c2a2b=_0x5c2a2b-0x0;var _0x19921f=_0x3e67[_0x5c2a2b];return _0x19921f;};'use strict';var Sequelize=require(_0x73e6('0x0'));module[_0x73e6('0x1')]={'penalty':{'type':Sequelize[_0x73e6('0x2')],'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 b357abe..30d383f 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 _0x3198=['bluebird','request-promise','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','api'];(function(_0x52ad00,_0x57bf4c){var _0x482d55=function(_0x335f10){while(--_0x335f10){_0x52ad00['push'](_0x52ad00['shift']());}};_0x482d55(++_0x57bf4c);}(_0x3198,0x11f));var _0x8319=function(_0x134c76,_0x173298){_0x134c76=_0x134c76-0x0;var _0x4e5064=_0x3198[_0x134c76];return _0x4e5064;};'use strict';var _=require(_0x8319('0x0'));var util=require(_0x8319('0x1'));var logger=require('../../config/logger')(_0x8319('0x2'));var moment=require('moment');var BPromise=require(_0x8319('0x3'));var rp=require(_0x8319('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8319('0x5'));module[_0x8319('0x6')]=function(_0x2d0d2a,_0x17829b){return _0x2d0d2a[_0x8319('0x7')](_0x8319('0x8'),attributes,{'tableName':_0x8319('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x132d=['user_has_openchannel_queues','lodash','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue'];(function(_0xb6b285,_0x596e01){var _0x11393c=function(_0x506469){while(--_0x506469){_0xb6b285['push'](_0xb6b285['shift']());}};_0x11393c(++_0x596e01);}(_0x132d,0x140));var _0xd132=function(_0x445179,_0x389247){_0x445179=_0x445179-0x0;var _0x36626f=_0x132d[_0x445179];return _0x36626f;};'use strict';var _=require(_0xd132('0x0'));var util=require('util');var logger=require(_0xd132('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd132('0x2'));var rp=require(_0xd132('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd132('0x4'));var config=require(_0xd132('0x5'));var attributes=require(_0xd132('0x6'));module[_0xd132('0x7')]=function(_0x5a9cc7,_0x39f821){return _0x5a9cc7[_0xd132('0x8')](_0xd132('0x9'),attributes,{'tableName':_0xd132('0xa'),'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 d55e12e..12cde8a 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 _0xaee3=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird'];(function(_0x2678d6,_0x4e2001){var _0x475503=function(_0x34b23d){while(--_0x34b23d){_0x2678d6['push'](_0x2678d6['shift']());}};_0x475503(++_0x4e2001);}(_0xaee3,0x1e0));var _0x3aee=function(_0x50c492,_0x5c1e67){_0x50c492=_0x50c492-0x0;var _0x3505a8=_0xaee3[_0x50c492];return _0x3505a8;};'use strict';var _=require(_0x3aee('0x0'));var util=require(_0x3aee('0x1'));var moment=require('moment');var BPromise=require(_0x3aee('0x2'));var rs=require(_0x3aee('0x3'));var fs=require('fs');var Redis=require(_0x3aee('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3aee('0x5'));var logger=require(_0x3aee('0x6'))(_0x3aee('0x7'));var config=require(_0x3aee('0x8'));var jayson=require(_0x3aee('0x9'));var client=jayson[_0x3aee('0xa')][_0x3aee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c0c3b,_0x1fcff0,_0x1b6017){return new BPromise(function(_0x457db4,_0x37aba2){return client['request'](_0x2c0c3b,_0x1b6017)[_0x3aee('0xc')](function(_0x3a7534){logger[_0x3aee('0xd')](_0x3aee('0xe'),_0x1fcff0,_0x3aee('0xf'));logger[_0x3aee('0x10')](_0x3aee('0x11'),_0x1fcff0,'request\x20sent',JSON[_0x3aee('0x12')](_0x3a7534));if(_0x3a7534['error']){if(_0x3a7534[_0x3aee('0x13')]['code']===0x1f4){logger[_0x3aee('0x13')](_0x3aee('0xe'),_0x1fcff0,_0x3a7534[_0x3aee('0x13')][_0x3aee('0x14')]);return _0x37aba2(_0x3a7534[_0x3aee('0x13')]['message']);}logger['error'](_0x3aee('0xe'),_0x1fcff0,_0x3a7534['error']['message']);return _0x457db4(_0x3a7534[_0x3aee('0x13')][_0x3aee('0x14')]);}else{logger[_0x3aee('0xd')](_0x3aee('0xe'),_0x1fcff0,'request\x20sent');_0x457db4(_0x3a7534[_0x3aee('0x15')][_0x3aee('0x14')]);}})[_0x3aee('0x16')](function(_0x40faf0){logger['error'](_0x3aee('0xe'),_0x1fcff0,_0x40faf0);_0x37aba2(_0x40faf0);});});} \ No newline at end of file +var _0xb88a=['../../config/utils','../../config/logger','jayson/promise','client','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1e89fd,_0x24ef0d){var _0x530c87=function(_0x2b35b5){while(--_0x2b35b5){_0x1e89fd['push'](_0x1e89fd['shift']());}};_0x530c87(++_0x24ef0d);}(_0xb88a,0x145));var _0xab88=function(_0x1054a8,_0xfbf0fc){_0x1054a8=_0x1054a8-0x0;var _0x68c389=_0xb88a[_0x1054a8];return _0x68c389;};'use strict';var _=require('lodash');var util=require(_0xab88('0x0'));var moment=require('moment');var BPromise=require(_0xab88('0x1'));var rs=require(_0xab88('0x2'));var fs=require('fs');var Redis=require(_0xab88('0x3'));var db=require(_0xab88('0x4'))['db'];var utils=require(_0xab88('0x5'));var logger=require(_0xab88('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xab88('0x7'));var client=jayson[_0xab88('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x323e57,_0x1ce9a8,_0x253eab){return new BPromise(function(_0x1cc750,_0x403044){return client[_0xab88('0x9')](_0x323e57,_0x253eab)[_0xab88('0xa')](function(_0x2f5439){logger['info'](_0xab88('0xb'),_0x1ce9a8,_0xab88('0xc'));logger[_0xab88('0xd')](_0xab88('0xe'),_0x1ce9a8,'request\x20sent',JSON[_0xab88('0xf')](_0x2f5439));if(_0x2f5439[_0xab88('0x10')]){if(_0x2f5439[_0xab88('0x10')][_0xab88('0x11')]===0x1f4){logger[_0xab88('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1ce9a8,_0x2f5439['error']['message']);return _0x403044(_0x2f5439[_0xab88('0x10')]['message']);}logger[_0xab88('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1ce9a8,_0x2f5439[_0xab88('0x10')][_0xab88('0x12')]);return _0x1cc750(_0x2f5439['error']['message']);}else{logger[_0xab88('0x13')](_0xab88('0xb'),_0x1ce9a8,_0xab88('0xc'));_0x1cc750(_0x2f5439[_0xab88('0x14')][_0xab88('0x12')]);}})[_0xab88('0x15')](function(_0x4fe489){logger['error'](_0xab88('0xb'),_0x1ce9a8,_0x4fe489);_0x403044(_0x4fe489);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 9be13b0..e377d13 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 _0x1ef3=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','getResources','post','addSections','/:id/resources','addResources','put','destroy','delete','/:id/sections','removeSections','removeResources'];(function(_0x27beea,_0x3bc9f4){var _0x122645=function(_0x2c848){while(--_0x2c848){_0x27beea['push'](_0x27beea['shift']());}};_0x122645(++_0x3bc9f4);}(_0x1ef3,0x69));var _0x31ef=function(_0x6e050,_0x38475a){_0x6e050=_0x6e050-0x0;var _0x41ce33=_0x1ef3[_0x6e050];return _0x41ce33;};'use strict';var multer=require(_0x31ef('0x0'));var util=require(_0x31ef('0x1'));var path=require('path');var timeout=require(_0x31ef('0x2'));var express=require(_0x31ef('0x3'));var router=express[_0x31ef('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x31ef('0x5'));var interaction=require(_0x31ef('0x6'));var config=require('../../config/environment');var controller=require(_0x31ef('0x7'));router[_0x31ef('0x8')]('/',auth[_0x31ef('0x9')](),controller[_0x31ef('0xa')]);router[_0x31ef('0x8')](_0x31ef('0xb'),auth['isAuthenticated'](),controller[_0x31ef('0xc')]);router[_0x31ef('0x8')](_0x31ef('0xd'),auth[_0x31ef('0x9')](),controller['show']);router[_0x31ef('0x8')]('/:id/sections',auth[_0x31ef('0x9')](),controller['getSections']);router['get']('/:id/resources',auth[_0x31ef('0x9')](),controller[_0x31ef('0xe')]);router[_0x31ef('0xf')]('/',auth[_0x31ef('0x9')](),controller['create']);router['post']('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0x31ef('0xf')]('/:id/sections',auth[_0x31ef('0x9')](),controller[_0x31ef('0x10')]);router['post'](_0x31ef('0x11'),auth[_0x31ef('0x9')](),controller[_0x31ef('0x12')]);router[_0x31ef('0x13')](_0x31ef('0xd'),auth[_0x31ef('0x9')](),controller['update']);router['delete'](_0x31ef('0xd'),auth['isAuthenticated'](),controller[_0x31ef('0x14')]);router[_0x31ef('0x15')](_0x31ef('0x16'),auth[_0x31ef('0x9')](),controller[_0x31ef('0x17')]);router['delete'](_0x31ef('0x11'),auth[_0x31ef('0x9')](),controller[_0x31ef('0x18')]);module[_0x31ef('0x19')]=router; \ No newline at end of file +var _0xda3c=['clone','addSections','/:id/resources','put','update','delete','destroy','removeSections','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/sections','getSections','getResources','create','post','/:id/clone'];(function(_0x16e5b3,_0x30d91d){var _0x4d6874=function(_0x2fffbe){while(--_0x2fffbe){_0x16e5b3['push'](_0x16e5b3['shift']());}};_0x4d6874(++_0x30d91d);}(_0xda3c,0x79));var _0xcda3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xda3c[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xcda3('0x0'));var util=require(_0xcda3('0x1'));var path=require(_0xcda3('0x2'));var timeout=require(_0xcda3('0x3'));var express=require(_0xcda3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcda3('0x5'));var config=require('../../config/environment');var controller=require(_0xcda3('0x6'));router[_0xcda3('0x7')]('/',auth[_0xcda3('0x8')](),controller['index']);router['get'](_0xcda3('0x9'),auth[_0xcda3('0x8')](),controller[_0xcda3('0xa')]);router[_0xcda3('0x7')](_0xcda3('0xb'),auth[_0xcda3('0x8')](),controller[_0xcda3('0xc')]);router['get'](_0xcda3('0xd'),auth['isAuthenticated'](),controller[_0xcda3('0xe')]);router['get']('/:id/resources',auth[_0xcda3('0x8')](),controller[_0xcda3('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcda3('0x10')]);router[_0xcda3('0x11')](_0xcda3('0x12'),auth[_0xcda3('0x8')](),controller[_0xcda3('0x13')]);router[_0xcda3('0x11')](_0xcda3('0xd'),auth[_0xcda3('0x8')](),controller[_0xcda3('0x14')]);router[_0xcda3('0x11')](_0xcda3('0x15'),auth[_0xcda3('0x8')](),controller['addResources']);router[_0xcda3('0x16')]('/:id',auth[_0xcda3('0x8')](),controller[_0xcda3('0x17')]);router[_0xcda3('0x18')](_0xcda3('0xb'),auth[_0xcda3('0x8')](),controller[_0xcda3('0x19')]);router['delete'](_0xcda3('0xd'),auth[_0xcda3('0x8')](),controller[_0xcda3('0x1a')]);router['delete'](_0xcda3('0x15'),auth[_0xcda3('0x8')](),controller['removeResources']);module[_0xcda3('0x1b')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index f66fcab..f3903e5 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 _0x4c28=['setDataValue','crudPermissions','join','getDataValue','BOOLEAN','exports','STRING'];(function(_0x25d2fb,_0x3f2182){var _0xcd1ff0=function(_0x1578db){while(--_0x1578db){_0x25d2fb['push'](_0x25d2fb['shift']());}};_0xcd1ff0(++_0x3f2182);}(_0x4c28,0x1e1));var _0x84c2=function(_0x19bd5b,_0x17a7b3){_0x19bd5b=_0x19bd5b-0x0;var _0x36fe10=_0x4c28[_0x19bd5b];return _0x36fe10;};'use strict';var Sequelize=require('sequelize');module[_0x84c2('0x0')]={'name':{'type':Sequelize[_0x84c2('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x84c2('0x1')],'set':function(_0x28be57){this[_0x84c2('0x2')](_0x84c2('0x3'),_0x28be57?_0x28be57[_0x84c2('0x4')](''):[]);},'get':function(){return this[_0x84c2('0x5')](_0x84c2('0x3'))?this['getDataValue']('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x84c2('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x84c2('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x84c2('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x84c2('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x84c2('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x84c2('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x84c2('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4c47=['setDataValue','join','getDataValue','crudPermissions','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x11ced7,_0x29a8b0){var _0x4bed14=function(_0x2b62d0){while(--_0x2b62d0){_0x11ced7['push'](_0x11ced7['shift']());}};_0x4bed14(++_0x29a8b0);}(_0x4c47,0x16d));var _0x74c4=function(_0x46a2dd,_0x3897a4){_0x46a2dd=_0x46a2dd-0x0;var _0x5cc6fb=_0x4c47[_0x46a2dd];return _0x5cc6fb;};'use strict';var Sequelize=require(_0x74c4('0x0'));module[_0x74c4('0x1')]={'name':{'type':Sequelize[_0x74c4('0x2')],'allowNull':![],'unique':_0x74c4('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x22e1aa){this[_0x74c4('0x4')]('crudPermissions',_0x22e1aa?_0x22e1aa[_0x74c4('0x5')](''):[]);},'get':function(){return this[_0x74c4('0x6')](_0x74c4('0x7'))?this[_0x74c4('0x6')](_0x74c4('0x7'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x74c4('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x74c4('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x74c4('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x74c4('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x74c4('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x74c4('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index f9c8bdf..b4692c2 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 _0xe698=['includeAll','get','omit','crudPermissions','body','createdAt','updatedAt','transaction','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','sequelize','UserProfileSection','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','concat','push','findOne','Dashboard','resourceId','Plugin','forEach','addResources','bulkCreate','removeResources','section','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./userProfile.socket','register','status','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','end','error','stack','name','index','map','UserProfile','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','clone'];(function(_0x868dbb,_0x26cc25){var _0x2ccd37=function(_0x3e99f8){while(--_0x3e99f8){_0x868dbb['push'](_0x868dbb['shift']());}};_0x2ccd37(++_0x26cc25);}(_0xe698,0x188));var _0x8e69=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe698[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0x8e69('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8e69('0x1'));var jsonpatch=require(_0x8e69('0x2'));var rp=require(_0x8e69('0x3'));var moment=require(_0x8e69('0x4'));var BPromise=require(_0x8e69('0x5'));var Mustache=require(_0x8e69('0x6'));var util=require(_0x8e69('0x7'));var path=require('path');var sox=require(_0x8e69('0x8'));var csv=require(_0x8e69('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8e69('0xa'));var squel=require(_0x8e69('0xb'));var crypto=require(_0x8e69('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8e69('0xd'));var toCsv=require(_0x8e69('0x9'));var querystring=require('querystring');var Papa=require(_0x8e69('0xe'));var Redis=require(_0x8e69('0xf'));var authService=require(_0x8e69('0x10'));var qs=require(_0x8e69('0x11'));var as=require(_0x8e69('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8e69('0x13'))(_0x8e69('0x14'));var utils=require(_0x8e69('0x15'));var config=require(_0x8e69('0x16'));var licenseUtil=require(_0x8e69('0x17'));var db=require(_0x8e69('0x18'))['db'];config[_0x8e69('0x19')]=_[_0x8e69('0x1a')](config[_0x8e69('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8e69('0x19')]));require(_0x8e69('0x1b'))[_0x8e69('0x1c')](socket);function respondWithStatusCode(_0x2203ee,_0x41faee){_0x41faee=_0x41faee||0xcc;return function(_0x1d57c8){if(_0x1d57c8){return _0x2203ee['sendStatus'](_0x41faee);}return _0x2203ee['status'](_0x41faee)['end']();};}function respondWithResult(_0x5e7522,_0x10f568){_0x10f568=_0x10f568||0xc8;return function(_0x2ce309){if(_0x2ce309){return _0x5e7522[_0x8e69('0x1d')](_0x10f568)['json'](_0x2ce309);}};}function respondWithFilteredResult(_0x623bf3,_0x6a2260){return function(_0x2224b5){if(_0x2224b5){var _0x35b1e8=typeof _0x6a2260['offset']===_0x8e69('0x1e')&&typeof _0x6a2260[_0x8e69('0x1f')]===_0x8e69('0x1e');var _0x5be90c=_0x2224b5[_0x8e69('0x20')];var _0x521ea2=_0x35b1e8?0x0:_0x6a2260[_0x8e69('0x21')];var _0x26d860=_0x35b1e8?_0x2224b5[_0x8e69('0x20')]:_0x6a2260[_0x8e69('0x21')]+_0x6a2260[_0x8e69('0x1f')];var _0x2c0ba1;if(_0x26d860>=_0x5be90c){_0x26d860=_0x5be90c;_0x2c0ba1=0xc8;}else{_0x2c0ba1=0xce;}_0x623bf3[_0x8e69('0x1d')](_0x2c0ba1);return _0x623bf3[_0x8e69('0x22')](_0x8e69('0x23'),_0x521ea2+'-'+_0x26d860+'/'+_0x5be90c)[_0x8e69('0x24')](_0x2224b5);}return null;};}function patchUpdates(_0x43b406){return function(_0x2ac9c9){try{jsonpatch[_0x8e69('0x25')](_0x2ac9c9,_0x43b406,!![]);}catch(_0x4177bf){return BPromise['reject'](_0x4177bf);}return _0x2ac9c9[_0x8e69('0x26')]();};}function saveUpdates(_0x3cc1bd,_0x125924){return function(_0x2a3518){if(_0x2a3518){return _0x2a3518[_0x8e69('0x27')](_0x3cc1bd)[_0x8e69('0x28')](function(_0x522c95){return _0x522c95;});}return null;};}function removeEntity(_0xfda4f3,_0x2e5eb7){return function(_0x5ce7f8){if(_0x5ce7f8){return _0x5ce7f8[_0x8e69('0x29')]()[_0x8e69('0x28')](function(){_0xfda4f3['status'](0xcc)[_0x8e69('0x2a')]();});}};}function handleEntityNotFound(_0x2abe9c,_0x5b779a){return function(_0x556e25){if(!_0x556e25){_0x2abe9c['sendStatus'](0x194);}return _0x556e25;};}function handleError(_0x58a6d8,_0x2dd233){_0x2dd233=_0x2dd233||0x1f4;return function(_0x55a42a){logger[_0x8e69('0x2b')](_0x55a42a[_0x8e69('0x2c')]);if(_0x55a42a[_0x8e69('0x2d')]){delete _0x55a42a[_0x8e69('0x2d')];}_0x58a6d8[_0x8e69('0x1d')](_0x2dd233)['send'](_0x55a42a);};}exports[_0x8e69('0x2e')]=function(_0x1b290e,_0x29f817){var _0x15af0d={},_0x4ce989={},_0x2def0f={'count':0x0,'rows':[]};var _0x3924f4=_[_0x8e69('0x2f')](db[_0x8e69('0x30')]['rawAttributes'],function(_0x3f07b0){return{'name':_0x3f07b0[_0x8e69('0x31')],'type':_0x3f07b0[_0x8e69('0x32')][_0x8e69('0x33')]};});_0x4ce989[_0x8e69('0x34')]=_[_0x8e69('0x2f')](_0x3924f4,_0x8e69('0x2d'));_0x4ce989[_0x8e69('0x35')]=_['keys'](_0x1b290e[_0x8e69('0x35')]);_0x4ce989[_0x8e69('0x36')]=_[_0x8e69('0x37')](_0x4ce989['model'],_0x4ce989[_0x8e69('0x35')]);_0x15af0d[_0x8e69('0x38')]=_[_0x8e69('0x37')](_0x4ce989[_0x8e69('0x34')],qs['fields'](_0x1b290e[_0x8e69('0x35')][_0x8e69('0x39')]));_0x15af0d['attributes']=_0x15af0d['attributes'][_0x8e69('0x3a')]?_0x15af0d[_0x8e69('0x38')]:_0x4ce989[_0x8e69('0x34')];if(!_0x1b290e['query'][_0x8e69('0x3b')](_0x8e69('0x3c'))){_0x15af0d[_0x8e69('0x1f')]=qs[_0x8e69('0x1f')](_0x1b290e['query'][_0x8e69('0x1f')]);_0x15af0d[_0x8e69('0x21')]=qs[_0x8e69('0x21')](_0x1b290e[_0x8e69('0x35')][_0x8e69('0x21')]);}_0x15af0d[_0x8e69('0x3d')]=qs[_0x8e69('0x3e')](_0x1b290e['query']['sort']);_0x15af0d['where']=qs['filters'](_[_0x8e69('0x3f')](_0x1b290e[_0x8e69('0x35')],_0x4ce989[_0x8e69('0x36')]),_0x3924f4);if(_0x1b290e[_0x8e69('0x35')]['filter']){_0x15af0d['where']=_[_0x8e69('0x40')](_0x15af0d[_0x8e69('0x41')],{'$or':_[_0x8e69('0x2f')](_0x3924f4,function(_0x4ac6d3){if(_0x4ac6d3['type']!==_0x8e69('0x42')){var _0x4c53ec={};_0x4c53ec[_0x4ac6d3['name']]={'$like':'%'+_0x1b290e[_0x8e69('0x35')][_0x8e69('0x43')]+'%'};return _0x4c53ec;}})});}_0x15af0d=_['merge']({},_0x15af0d,_0x1b290e[_0x8e69('0x44')]);var _0x2d49ee={'where':_0x15af0d[_0x8e69('0x41')]};return db['UserProfile'][_0x8e69('0x20')](_0x2d49ee)[_0x8e69('0x28')](function(_0x409675){_0x2def0f[_0x8e69('0x20')]=_0x409675;if(_0x1b290e[_0x8e69('0x35')]['includeAll']){_0x15af0d[_0x8e69('0x45')]=[{'all':!![]}];}return db['UserProfile'][_0x8e69('0x46')](_0x15af0d);})[_0x8e69('0x28')](function(_0x247cbe){_0x2def0f[_0x8e69('0x47')]=_0x247cbe;return _0x2def0f;})['then'](respondWithFilteredResult(_0x29f817,_0x15af0d))[_0x8e69('0x48')](handleError(_0x29f817,null));};exports[_0x8e69('0x49')]=function(_0x33048c,_0xe73a7a){var _0x55d8ab={'raw':![],'where':{'id':_0x33048c[_0x8e69('0x4a')]['id']}},_0x22f733={};_0x22f733['model']=_[_0x8e69('0x4b')](db[_0x8e69('0x30')][_0x8e69('0x4c')]);_0x22f733[_0x8e69('0x35')]=_[_0x8e69('0x4b')](_0x33048c[_0x8e69('0x35')]);_0x22f733[_0x8e69('0x36')]=_[_0x8e69('0x37')](_0x22f733[_0x8e69('0x34')],_0x22f733[_0x8e69('0x35')]);_0x55d8ab[_0x8e69('0x38')]=_['intersection'](_0x22f733[_0x8e69('0x34')],qs[_0x8e69('0x39')](_0x33048c[_0x8e69('0x35')]['fields']));_0x55d8ab['attributes']=_0x55d8ab[_0x8e69('0x38')][_0x8e69('0x3a')]?_0x55d8ab[_0x8e69('0x38')]:_0x22f733[_0x8e69('0x34')];if(_0x33048c[_0x8e69('0x35')]['includeAll']){_0x55d8ab['include']=[{'all':!![]}];}_0x55d8ab=_['merge']({},_0x55d8ab,_0x33048c['options']);return db[_0x8e69('0x30')][_0x8e69('0x4d')](_0x55d8ab)[_0x8e69('0x28')](handleEntityNotFound(_0xe73a7a,null))[_0x8e69('0x28')](respondWithResult(_0xe73a7a,null))[_0x8e69('0x48')](handleError(_0xe73a7a,null));};exports[_0x8e69('0x4e')]=function(_0x1b3888,_0x4c8f0e){return db[_0x8e69('0x30')][_0x8e69('0x4e')](_0x1b3888['body'],{})['then'](respondWithResult(_0x4c8f0e,0xc9))[_0x8e69('0x48')](handleError(_0x4c8f0e,null));};exports[_0x8e69('0x4f')]=function(_0x1ac3d6,_0x2f423c){var _0x13aaaf={'where':{'id':_0x1ac3d6[_0x8e69('0x4a')]['id']}},_0x1d8a69={};_0x1d8a69[_0x8e69('0x34')]=_[_0x8e69('0x4b')](db[_0x8e69('0x30')]['rawAttributes']);_0x13aaaf[_0x8e69('0x38')]=_[_0x8e69('0x37')](_0x1d8a69['model'],qs[_0x8e69('0x39')](_0x1ac3d6[_0x8e69('0x35')]['fields']));_0x13aaaf[_0x8e69('0x38')]=_0x13aaaf[_0x8e69('0x38')][_0x8e69('0x3a')]?_0x13aaaf['attributes']:_0x1d8a69[_0x8e69('0x34')];if(_0x1ac3d6[_0x8e69('0x35')][_0x8e69('0x50')]){_0x13aaaf[_0x8e69('0x45')]=[{'all':!![]}];}_0x13aaaf=_[_0x8e69('0x40')]({},_0x13aaaf,_0x1ac3d6['options']);return db[_0x8e69('0x30')][_0x8e69('0x4d')](_0x13aaaf)[_0x8e69('0x28')](handleEntityNotFound(_0x2f423c,null))[_0x8e69('0x28')](function(_0x3eda8d){if(_0x3eda8d){var _0xd19a3f=_0x3eda8d[_0x8e69('0x51')]({'plain':!![]});_0xd19a3f=qs[_0x8e69('0x52')](_0xd19a3f,['id','createdAt','updatedAt',_0x8e69('0x53')]);_0x1ac3d6[_0x8e69('0x54')]=_['omit'](_0x1ac3d6[_0x8e69('0x54')],['id',_0x8e69('0x55'),_0x8e69('0x56')]);return db['sequelize'][_0x8e69('0x57')](function(_0x4c9f56){return db['UserProfile'][_0x8e69('0x4e')](_[_0x8e69('0x40')](_0xd19a3f,_0x1ac3d6[_0x8e69('0x54')]),{'include':_0x1ac3d6[_0x8e69('0x35')][_0x8e69('0x50')]?[{'all':!![]}]:undefined,'transaction':_0x4c9f56})[_0x8e69('0x28')](function(_0x39e43f){var _0x388479=_0x39e43f[_0x8e69('0x51')]({'plain':!![]});return db['UserProfileSection'][_0x8e69('0x46')]({'where':{'userProfileId':_0x1ac3d6[_0x8e69('0x4a')]['id']},'raw':!![]})[_0x8e69('0x28')](function(_0x431429){if(_0x431429){return BPromise[_0x8e69('0x58')](_0x431429,function(_0x741118){return new BPromise(function(_0x302ccd,_0x5a0dd0){if(_0x741118[_0x8e69('0x59')]===null||_0x741118[_0x8e69('0x59')]===0x1)_0x302ccd(null);return db[_0x8e69('0x5a')][_0x8e69('0x46')]({'where':{'sectionId':_0x741118['id']},'raw':!![]})['then'](function(_0x13eddf){var _0x1824e8=_[_0x8e69('0x2f')](_0x13eddf,function(_0x473ab0){return qs[_0x8e69('0x52')](_0x473ab0,['id',_0x8e69('0x55'),'updatedAt',_0x8e69('0x5b')]);});_0x302ccd(_0x1824e8);})[_0x8e69('0x48')](function(_0x3c10fe){_0x5a0dd0(_0x3c10fe);});})[_0x8e69('0x28')](function(_0x23a283){var _0x25b007=qs[_0x8e69('0x52')](_0x741118,['id','createdAt',_0x8e69('0x56')]);_0x25b007[_0x8e69('0x5c')]=_0x388479['id'];if(_0x23a283)_0x25b007[_0x8e69('0x5d')]=_0x23a283;return _0x25b007;})['then'](function(_0x58fed5){return db['UserProfileSection']['create'](_0x58fed5,{'include':[{'model':db[_0x8e69('0x5a')],'as':_0x8e69('0x5d')}],'raw':!![],'transaction':_0x4c9f56});});})[_0x8e69('0x28')](function(){return _0x388479;});}});});});}})['then'](respondWithResult(_0x2f423c,0xc9))[_0x8e69('0x48')](handleError(_0x2f423c,null));};exports[_0x8e69('0x27')]=function(_0x5eff75,_0xbceefc){if(_0x5eff75[_0x8e69('0x54')]['id']){delete _0x5eff75[_0x8e69('0x54')]['id'];}return db[_0x8e69('0x30')][_0x8e69('0x4d')]({'where':{'id':_0x5eff75[_0x8e69('0x4a')]['id']}})['then'](handleEntityNotFound(_0xbceefc,null))[_0x8e69('0x28')](saveUpdates(_0x5eff75['body'],null))[_0x8e69('0x28')](respondWithResult(_0xbceefc,null))[_0x8e69('0x48')](handleError(_0xbceefc,null));};exports[_0x8e69('0x29')]=function(_0x4704da,_0x1facd1){return db[_0x8e69('0x30')][_0x8e69('0x4d')]({'where':{'id':_0x4704da[_0x8e69('0x4a')]['id']}})[_0x8e69('0x28')](handleEntityNotFound(_0x1facd1,null))[_0x8e69('0x28')](removeEntity(_0x1facd1,null))[_0x8e69('0x48')](handleError(_0x1facd1,null));};exports['describe']=function(_0xafa24d,_0x1920af){return db['UserProfile'][_0x8e69('0x5e')]()[_0x8e69('0x28')](respondWithResult(_0x1920af,null))[_0x8e69('0x48')](handleError(_0x1920af,null));};exports[_0x8e69('0x5f')]=function(_0x26b5b9,_0x43d7b0){var _0x20867e=_0x26b5b9[_0x8e69('0x54')];return db[_0x8e69('0x30')][_0x8e69('0x4d')]({'where':{'id':_0x26b5b9[_0x8e69('0x4a')]['id']}})[_0x8e69('0x28')](handleEntityNotFound(_0x43d7b0,null))[_0x8e69('0x28')](function(_0x243e8e){if(_0x243e8e){return db[_0x8e69('0x60')][_0x8e69('0x57')](function(_0x5e0bb8){return db[_0x8e69('0x61')]['destroy']({'where':{'userProfileId':_0x26b5b9[_0x8e69('0x4a')]['id'],'sectionId':_['map'](_0x20867e,function(_0x21f96d){return _0x21f96d[_0x8e69('0x5b')];})},'transaction':_0x5e0bb8})[_0x8e69('0x28')](function(){var _0x346da2=_[_0x8e69('0x2f')](_0x20867e,function(_0x2cc3eb){_0x2cc3eb[_0x8e69('0x5c')]=_0x26b5b9[_0x8e69('0x4a')]['id'];return _0x2cc3eb;});var _0x6d70d0=[];return BPromise[_0x8e69('0x58')](_0x346da2,function(_0x226914){return db[_0x8e69('0x61')][_0x8e69('0x4e')](_0x226914,{'include':[{'model':db[_0x8e69('0x5a')],'as':'Resources'}],'raw':!![],'transaction':_0x5e0bb8})[_0x8e69('0x28')](function(_0x1bec09){_0x6d70d0['push'](_0x1bec09['get']({'plain':!![]}));});})['then'](function(){return _0x6d70d0;});});});}})[_0x8e69('0x28')](function(_0x44a736){return _0x44a736;})[_0x8e69('0x28')](respondWithResult(_0x43d7b0,null))[_0x8e69('0x48')](handleError(_0x43d7b0,null));};exports[_0x8e69('0x62')]=function(_0x375b64,_0x1da493){var _0x198834;return db['UserProfile']['find']({'where':{'id':_0x375b64['params']['id']},'attributes':['id',_0x8e69('0x2d')]})[_0x8e69('0x28')](handleEntityNotFound(_0x1da493,null))[_0x8e69('0x28')](function(_0x2a84a8){if(_0x2a84a8){_0x198834=_0x2a84a8;return db[_0x8e69('0x61')][_0x8e69('0x29')]({'where':{'userProfileId':_0x375b64['params']['id'],'sectionId':_0x375b64[_0x8e69('0x35')][_0x8e69('0x63')]}});}})[_0x8e69('0x28')](function(){return _0x198834;})[_0x8e69('0x28')](respondWithStatusCode(_0x1da493,null))[_0x8e69('0x48')](handleError(_0x1da493,null));};exports[_0x8e69('0x64')]=function(_0xeaaa1b,_0x4d849e){var _0x556027=[];var _0x8c8395=[];return db[_0x8e69('0x61')][_0x8e69('0x46')]({'where':{'userProfileId':_0xeaaa1b[_0x8e69('0x4a')]['id']},'raw':!![]})[_0x8e69('0x28')](function(_0x4e267f){_0x556027=_[_0x8e69('0x43')](_0x4e267f,function(_0x48a366){return _0x48a366[_0x8e69('0x65')]===0x1||_['includes']([0x3eb,0x709],_0x48a366[_0x8e69('0x5b')]);});if(!_[_0x8e69('0x66')](_0x556027)){return _[_0x8e69('0x2f')](_0x556027,function(_0x32e4bb){return _0x32e4bb[_0x8e69('0x5b')];});}else{return;}})['then'](function(_0x10a3ec){if(_0x10a3ec)_0x8c8395=_0x10a3ec;if(_[_0x8e69('0x67')](_0x8c8395,0x64)){var _0x37e7f6=_[_0x8e69('0x4d')](_0x556027,{'sectionId':0x64});return hasDefaultDashboard(_0x37e7f6)[_0x8e69('0x28')](function(_0x399934){return _[_0x8e69('0x2f')](_0x556027,function(_0x42f749){if(_0x42f749[_0x8e69('0x5b')]===0x64){_0x42f749[_0x8e69('0x68')]=_0x399934;}return _0x42f749;});});}else{return;}})[_0x8e69('0x28')](function(_0x4d02d4){if(_0x4d02d4)_0x556027=_0x4d02d4;if(_[_0x8e69('0x67')](_0x8c8395,0x3eb)){var _0x2d9e35=_[_0x8e69('0x4d')](_0x556027,{'sectionId':0x3eb});return getCustomDashboards(_0x2d9e35)[_0x8e69('0x28')](function(_0x250a2a){return _['map'](_0x556027,function(_0x500933){if(_0x2d9e35[_0x8e69('0x65')]){if(_0x500933['sectionId']===0x3eb){_0x500933[_0x8e69('0x68')]=_0x250a2a;}}else{if(_0x500933[_0x8e69('0x5b')]===0x64){if(!_0x500933[_0x8e69('0x68')]){_0x500933[_0x8e69('0x68')]=[];}_0x500933[_0x8e69('0x68')]=_0x500933[_0x8e69('0x68')][_0x8e69('0x69')](_0x250a2a);}}return _0x500933;});});}else{return;}})[_0x8e69('0x28')](function(_0x43ba3a){if(_0x43ba3a)_0x556027=_0x43ba3a;if(_[_0x8e69('0x67')](_0x8c8395,0x709)){var _0xb87324=_['find'](_0x556027,{'sectionId':0x709});return getPlugins(_0xb87324)['then'](function(_0x474fd6){if(_0xb87324[_0x8e69('0x65')]){return _[_0x8e69('0x2f')](_0x556027,function(_0x417222){if(_0x417222['sectionId']===0x709){_0x417222[_0x8e69('0x68')]=_0x474fd6;}return _0x417222;});}else{var _0x36c59c={'sectionId':0x76c,'enabled':0x1,'subsections':_0x474fd6};var _0x5cc62c=_[_0x8e69('0x2f')](_0x556027);_0x5cc62c[_0x8e69('0x6a')](_0x36c59c);return _0x5cc62c;}});}else{return;}})[_0x8e69('0x28')](function(_0x291db1){if(_0x291db1)_0x556027=_0x291db1;return _[_0x8e69('0x43')](_0x556027,[_0x8e69('0x65'),0x1]);})[_0x8e69('0x28')](respondWithResult(_0x4d849e,null))['catch'](handleError(_0x4d849e,null));};function hasDefaultDashboard(_0x35fd48){var _0x5b04fd=[0x65];return new BPromise(function(_0x13f4ba,_0x3f1f58){try{if(_0x35fd48[_0x8e69('0x59')]){_0x13f4ba(_0x5b04fd);}else{return db[_0x8e69('0x5a')][_0x8e69('0x6b')]({'where':{'sectionId':_0x35fd48['id']},'raw':!![]})[_0x8e69('0x28')](function(_0x5657b1){_0x5657b1?_0x13f4ba(_0x5b04fd):_0x13f4ba();});}}catch(_0x3b0e9a){_0x3f1f58(_0x3b0e9a);}});}function getCustomDashboards(_0x4bd731){var _0x3d040f=[];return new BPromise(function(_0x5873c4,_0x46271e){try{if(_0x4bd731[_0x8e69('0x59')]){return db[_0x8e69('0x6c')][_0x8e69('0x46')]({'raw':!![]})[_0x8e69('0x28')](function(_0x2771b1){_0x2771b1['forEach'](function(_0x2ae979){_0x3d040f[_0x8e69('0x6a')](_0x2ae979['id']+0x1869f);});_0x5873c4(_0x3d040f);});}else{return db['UserProfileResource'][_0x8e69('0x46')]({'where':{'sectionId':_0x4bd731['id']},'raw':!![]})['then'](function(_0xe68e78){_0xe68e78['forEach'](function(_0x2aff86){_0x3d040f[_0x8e69('0x6a')](_0x2aff86[_0x8e69('0x6d')]+0x1869f);});_0x5873c4(_0x3d040f);});}}catch(_0x6721f9){_0x46271e(_0x6721f9);}});}function getPlugins(_0x2df214){var _0x3b7267=[];return new BPromise(function(_0x59d11f,_0x4e593f){try{if(_0x2df214[_0x8e69('0x59')]){return db[_0x8e69('0x6e')][_0x8e69('0x46')]({'raw':!![]})[_0x8e69('0x28')](function(_0x148fa9){_0x148fa9['forEach'](function(_0x5a0857){_0x3b7267['push'](_0x5a0857['id']+0x15b38);});_0x59d11f(_0x3b7267);});}else{return db[_0x8e69('0x5a')]['findAll']({'where':{'sectionId':_0x2df214['id']},'raw':!![]})[_0x8e69('0x28')](function(_0x2c49ea){_0x2c49ea[_0x8e69('0x6f')](function(_0x2cf22){_0x3b7267[_0x8e69('0x6a')](_0x2cf22[_0x8e69('0x6d')]+0x15b38);});_0x59d11f(_0x3b7267);});}}catch(_0x52c035){_0x4e593f(_0x52c035);}});}exports[_0x8e69('0x70')]=function(_0x4911f6,_0x25425a){return db[_0x8e69('0x30')][_0x8e69('0x4d')]({'where':{'id':_0x4911f6[_0x8e69('0x4a')]['id']}})[_0x8e69('0x28')](handleEntityNotFound(_0x25425a,null))[_0x8e69('0x28')](function(_0x4e525e){if(_0x4e525e){return db[_0x8e69('0x60')][_0x8e69('0x57')](function(_0x4680fb){return db[_0x8e69('0x61')][_0x8e69('0x46')]({'where':{'userProfileId':_0x4911f6[_0x8e69('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0x8e69('0x28')](function(_0x2c5431){if(_0x2c5431){return db[_0x8e69('0x61')]['destroy']({'where':{'userProfileId':_0x4911f6[_0x8e69('0x4a')]['id'],'id':_[_0x8e69('0x2f')](_0x2c5431,function(_0x15dfda){return _0x15dfda['id'];})},'transaction':_0x4680fb});}})[_0x8e69('0x28')](function(_0x19a5fa){var _0x50cd62=_[_0x8e69('0x2f')](_0x4911f6[_0x8e69('0x54')],function(_0x383e78){_0x383e78['userProfileId']=_0x4911f6[_0x8e69('0x4a')]['id'];return _0x383e78;});return db[_0x8e69('0x61')]['bulkCreate'](_0x50cd62,{'raw':!![],'transaction':_0x4680fb});})['then'](function(_0x23d997){var _0x2dc652=_['filter'](_['map'](_0x23d997,function(_0x46eef4){return _0x46eef4[_0x8e69('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x2dc652){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x4911f6[_0x8e69('0x4a')]['id'],'sectionId':_['map'](_0x2dc652,function(_0x1a0dbd){return _0x1a0dbd[_0x8e69('0x5b')];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x4d9f9a){var _0x30bc8e=_[_0x8e69('0x2f')](_0x4911f6[_0x8e69('0x54')],function(_0x2eaa1e){_0x2eaa1e['userProfileId']=_0x4911f6['params']['id'];return _0x2eaa1e;});return db[_0x8e69('0x5a')][_0x8e69('0x71')](_0x30bc8e,{'raw':!![],'transaction':_0x4680fb});});}})[_0x8e69('0x48')](handleError(_0x25425a,null));});}})['then'](function(_0x8c3041){var _0x4af5fe=_[_0x8e69('0x2f')](_0x8c3041,function(_0x2182e3){return _0x2182e3[_0x8e69('0x51')]({'plain':!![]});});})[_0x8e69('0x28')](respondWithResult(_0x25425a,null))['catch'](handleError(_0x25425a,null));};exports[_0x8e69('0x72')]=function(_0x19c1f4,_0x22a95e,_0x12865c){return db[_0x8e69('0x30')][_0x8e69('0x4d')]({'where':{'id':_0x19c1f4['params']['id']}})['then'](handleEntityNotFound(_0x22a95e,null))['then'](function(_0x33122e){if(_0x33122e){return _0x33122e[_0x8e69('0x72')](_0x19c1f4['query']['ids']);}})[_0x8e69('0x28')](respondWithStatusCode(_0x22a95e,null))[_0x8e69('0x48')](handleError(_0x22a95e,null));};exports['getResources']=function(_0x5b84dd,_0x42cb93){var _0x492380={};if(!_0x5b84dd['query'][_0x8e69('0x73')])throw new Error('Missing\x20section\x20parameter');if(!_0x5b84dd[_0x8e69('0x35')][_0x8e69('0x3b')](_0x8e69('0x3c'))){_0x492380['limit']=qs['limit'](_0x5b84dd[_0x8e69('0x35')]['limit']);_0x492380[_0x8e69('0x21')]=qs[_0x8e69('0x21')](_0x5b84dd[_0x8e69('0x35')][_0x8e69('0x21')]);}return db[_0x8e69('0x30')]['find']({'where':{'id':_0x5b84dd[_0x8e69('0x4a')]['id']}})[_0x8e69('0x28')](function(_0x3f1538){if(!_0x3f1538)throw new Error(_0x8e69('0x74')+_0x5b84dd['params']['id']);return db[_0x8e69('0x30')][_0x8e69('0x75')](_0x5b84dd);})['then'](respondWithFilteredResult(_0x42cb93,_0x492380))[_0x8e69('0x48')](handleError(_0x42cb93,null));}; \ No newline at end of file +var _0x7544=['transaction','UserProfileSection','each','autoAssociation','sectionId','userProfileId','Resources','UserProfileResource','update','destroy','addSections','ids','getSections','enabled','isEmpty','includes','subsections','push','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','then','error','name','send','index','map','rawAttributes','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','UserProfile','includeAll','findAll','rows','catch','show','keys','intersection','include','find','create','body','params','get','omit','createdAt','updatedAt','crudPermissions','sequelize'];(function(_0x1b5fd4,_0x552689){var _0x5757ac=function(_0x33c015){while(--_0x33c015){_0x1b5fd4['push'](_0x1b5fd4['shift']());}};_0x5757ac(++_0x552689);}(_0x7544,0x15d));var _0x4754=function(_0x546d5a,_0x320511){_0x546d5a=_0x546d5a-0x0;var _0x4da949=_0x7544[_0x546d5a];return _0x4da949;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4754('0x0'));var zipdir=require(_0x4754('0x1'));var jsonpatch=require(_0x4754('0x2'));var rp=require('request-promise');var moment=require(_0x4754('0x3'));var BPromise=require(_0x4754('0x4'));var Mustache=require(_0x4754('0x5'));var util=require(_0x4754('0x6'));var path=require('path');var sox=require(_0x4754('0x7'));var csv=require(_0x4754('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4754('0x9'));var _=require(_0x4754('0xa'));var squel=require(_0x4754('0xb'));var crypto=require(_0x4754('0xc'));var jsforce=require(_0x4754('0xd'));var deskjs=require(_0x4754('0xe'));var toCsv=require(_0x4754('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4754('0xf'));var as=require(_0x4754('0x10'));var hardwareService=require(_0x4754('0x11'));var logger=require(_0x4754('0x12'))(_0x4754('0x13'));var utils=require(_0x4754('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4754('0x15'));var db=require(_0x4754('0x16'))['db'];config[_0x4754('0x17')]=_['defaults'](config['redis'],{'host':_0x4754('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4754('0x17')]));require('./userProfile.socket')[_0x4754('0x19')](socket);function respondWithStatusCode(_0x9bde2d,_0x6e4ab5){_0x6e4ab5=_0x6e4ab5||0xcc;return function(_0x30c8fb){if(_0x30c8fb){return _0x9bde2d[_0x4754('0x1a')](_0x6e4ab5);}return _0x9bde2d['status'](_0x6e4ab5)[_0x4754('0x1b')]();};}function respondWithResult(_0xbf153e,_0x5754b8){_0x5754b8=_0x5754b8||0xc8;return function(_0x56e2e5){if(_0x56e2e5){return _0xbf153e[_0x4754('0x1c')](_0x5754b8)[_0x4754('0x1d')](_0x56e2e5);}};}function respondWithFilteredResult(_0x424239,_0x7146e2){return function(_0x44f933){if(_0x44f933){var _0x54f3f2=typeof _0x7146e2['offset']===_0x4754('0x1e')&&typeof _0x7146e2[_0x4754('0x1f')]===_0x4754('0x1e');var _0x305bb9=_0x44f933[_0x4754('0x20')];var _0x2bf7aa=_0x54f3f2?0x0:_0x7146e2[_0x4754('0x21')];var _0x15d8b0=_0x54f3f2?_0x44f933[_0x4754('0x20')]:_0x7146e2[_0x4754('0x21')]+_0x7146e2[_0x4754('0x1f')];var _0x253fce;if(_0x15d8b0>=_0x305bb9){_0x15d8b0=_0x305bb9;_0x253fce=0xc8;}else{_0x253fce=0xce;}_0x424239['status'](_0x253fce);return _0x424239[_0x4754('0x22')](_0x4754('0x23'),_0x2bf7aa+'-'+_0x15d8b0+'/'+_0x305bb9)[_0x4754('0x1d')](_0x44f933);}return null;};}function patchUpdates(_0x284448){return function(_0x147e5c){try{jsonpatch[_0x4754('0x24')](_0x147e5c,_0x284448,!![]);}catch(_0x1dd97e){return BPromise['reject'](_0x1dd97e);}return _0x147e5c['save']();};}function saveUpdates(_0x3a2bdf,_0x5848a3){return function(_0x102325){if(_0x102325){return _0x102325['update'](_0x3a2bdf)[_0x4754('0x25')](function(_0x3cc86e){return _0x3cc86e;});}return null;};}function removeEntity(_0x102fe3,_0x54ba8f){return function(_0x212445){if(_0x212445){return _0x212445['destroy']()['then'](function(){_0x102fe3['status'](0xcc)[_0x4754('0x1b')]();});}};}function handleEntityNotFound(_0x50dd1f,_0x5c1f64){return function(_0x125810){if(!_0x125810){_0x50dd1f[_0x4754('0x1a')](0x194);}return _0x125810;};}function handleError(_0x145e51,_0x57b110){_0x57b110=_0x57b110||0x1f4;return function(_0x9b482e){logger[_0x4754('0x26')](_0x9b482e['stack']);if(_0x9b482e[_0x4754('0x27')]){delete _0x9b482e[_0x4754('0x27')];}_0x145e51['status'](_0x57b110)[_0x4754('0x28')](_0x9b482e);};}exports[_0x4754('0x29')]=function(_0x177d91,_0x4ad3d3){var _0x45945a={},_0x4abcbf={},_0x1ea4ab={'count':0x0,'rows':[]};var _0x3551e7=_[_0x4754('0x2a')](db['UserProfile'][_0x4754('0x2b')],function(_0x4b4722){return{'name':_0x4b4722['fieldName'],'type':_0x4b4722['type'][_0x4754('0x2c')]};});_0x4abcbf[_0x4754('0x2d')]=_[_0x4754('0x2a')](_0x3551e7,'name');_0x4abcbf[_0x4754('0x2e')]=_['keys'](_0x177d91[_0x4754('0x2e')]);_0x4abcbf[_0x4754('0x2f')]=_['intersection'](_0x4abcbf[_0x4754('0x2d')],_0x4abcbf['query']);_0x45945a[_0x4754('0x30')]=_['intersection'](_0x4abcbf[_0x4754('0x2d')],qs[_0x4754('0x31')](_0x177d91[_0x4754('0x2e')][_0x4754('0x31')]));_0x45945a[_0x4754('0x30')]=_0x45945a['attributes'][_0x4754('0x32')]?_0x45945a[_0x4754('0x30')]:_0x4abcbf[_0x4754('0x2d')];if(!_0x177d91[_0x4754('0x2e')][_0x4754('0x33')](_0x4754('0x34'))){_0x45945a[_0x4754('0x1f')]=qs[_0x4754('0x1f')](_0x177d91[_0x4754('0x2e')][_0x4754('0x1f')]);_0x45945a[_0x4754('0x21')]=qs[_0x4754('0x21')](_0x177d91[_0x4754('0x2e')]['offset']);}_0x45945a['order']=qs[_0x4754('0x35')](_0x177d91['query'][_0x4754('0x35')]);_0x45945a['where']=qs['filters'](_[_0x4754('0x36')](_0x177d91['query'],_0x4abcbf[_0x4754('0x2f')]),_0x3551e7);if(_0x177d91[_0x4754('0x2e')][_0x4754('0x37')]){_0x45945a[_0x4754('0x38')]=_[_0x4754('0x39')](_0x45945a['where'],{'$or':_[_0x4754('0x2a')](_0x3551e7,function(_0x3c9c99){if(_0x3c9c99['type']!==_0x4754('0x3a')){var _0x455b0a={};_0x455b0a[_0x3c9c99[_0x4754('0x27')]]={'$like':'%'+_0x177d91['query'][_0x4754('0x37')]+'%'};return _0x455b0a;}})});}_0x45945a=_[_0x4754('0x39')]({},_0x45945a,_0x177d91[_0x4754('0x3b')]);var _0x497a29={'where':_0x45945a[_0x4754('0x38')]};return db[_0x4754('0x3c')]['count'](_0x497a29)[_0x4754('0x25')](function(_0x396ab1){_0x1ea4ab[_0x4754('0x20')]=_0x396ab1;if(_0x177d91[_0x4754('0x2e')][_0x4754('0x3d')]){_0x45945a['include']=[{'all':!![]}];}return db[_0x4754('0x3c')][_0x4754('0x3e')](_0x45945a);})[_0x4754('0x25')](function(_0x586279){_0x1ea4ab[_0x4754('0x3f')]=_0x586279;return _0x1ea4ab;})[_0x4754('0x25')](respondWithFilteredResult(_0x4ad3d3,_0x45945a))[_0x4754('0x40')](handleError(_0x4ad3d3,null));};exports[_0x4754('0x41')]=function(_0x5b9eba,_0x3d5856){var _0xe10dcb={'raw':![],'where':{'id':_0x5b9eba['params']['id']}},_0x46a901={};_0x46a901[_0x4754('0x2d')]=_[_0x4754('0x42')](db[_0x4754('0x3c')][_0x4754('0x2b')]);_0x46a901['query']=_['keys'](_0x5b9eba[_0x4754('0x2e')]);_0x46a901[_0x4754('0x2f')]=_[_0x4754('0x43')](_0x46a901[_0x4754('0x2d')],_0x46a901[_0x4754('0x2e')]);_0xe10dcb[_0x4754('0x30')]=_['intersection'](_0x46a901[_0x4754('0x2d')],qs[_0x4754('0x31')](_0x5b9eba[_0x4754('0x2e')]['fields']));_0xe10dcb[_0x4754('0x30')]=_0xe10dcb[_0x4754('0x30')][_0x4754('0x32')]?_0xe10dcb[_0x4754('0x30')]:_0x46a901[_0x4754('0x2d')];if(_0x5b9eba[_0x4754('0x2e')][_0x4754('0x3d')]){_0xe10dcb[_0x4754('0x44')]=[{'all':!![]}];}_0xe10dcb=_[_0x4754('0x39')]({},_0xe10dcb,_0x5b9eba[_0x4754('0x3b')]);return db[_0x4754('0x3c')][_0x4754('0x45')](_0xe10dcb)['then'](handleEntityNotFound(_0x3d5856,null))[_0x4754('0x25')](respondWithResult(_0x3d5856,null))[_0x4754('0x40')](handleError(_0x3d5856,null));};exports[_0x4754('0x46')]=function(_0x5c4481,_0x3e1157){return db[_0x4754('0x3c')][_0x4754('0x46')](_0x5c4481[_0x4754('0x47')],{})[_0x4754('0x25')](respondWithResult(_0x3e1157,0xc9))[_0x4754('0x40')](handleError(_0x3e1157,null));};exports['clone']=function(_0x1c4061,_0x43ed74){var _0x307b71={'where':{'id':_0x1c4061[_0x4754('0x48')]['id']}},_0x382c88={};_0x382c88[_0x4754('0x2d')]=_[_0x4754('0x42')](db['UserProfile'][_0x4754('0x2b')]);_0x307b71[_0x4754('0x30')]=_[_0x4754('0x43')](_0x382c88[_0x4754('0x2d')],qs[_0x4754('0x31')](_0x1c4061[_0x4754('0x2e')][_0x4754('0x31')]));_0x307b71['attributes']=_0x307b71[_0x4754('0x30')][_0x4754('0x32')]?_0x307b71[_0x4754('0x30')]:_0x382c88['model'];if(_0x1c4061[_0x4754('0x2e')]['includeAll']){_0x307b71[_0x4754('0x44')]=[{'all':!![]}];}_0x307b71=_['merge']({},_0x307b71,_0x1c4061['options']);return db['UserProfile'][_0x4754('0x45')](_0x307b71)[_0x4754('0x25')](handleEntityNotFound(_0x43ed74,null))['then'](function(_0x2d4bfd){if(_0x2d4bfd){var _0x25c2d8=_0x2d4bfd[_0x4754('0x49')]({'plain':!![]});_0x25c2d8=qs[_0x4754('0x4a')](_0x25c2d8,['id',_0x4754('0x4b'),_0x4754('0x4c'),_0x4754('0x4d')]);_0x1c4061[_0x4754('0x47')]=_[_0x4754('0x4a')](_0x1c4061[_0x4754('0x47')],['id','createdAt','updatedAt']);return db[_0x4754('0x4e')][_0x4754('0x4f')](function(_0x4b5309){return db[_0x4754('0x3c')]['create'](_[_0x4754('0x39')](_0x25c2d8,_0x1c4061[_0x4754('0x47')]),{'include':_0x1c4061[_0x4754('0x2e')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x4b5309})[_0x4754('0x25')](function(_0x4769e8){var _0x581e69=_0x4769e8['get']({'plain':!![]});return db[_0x4754('0x50')][_0x4754('0x3e')]({'where':{'userProfileId':_0x1c4061['params']['id']},'raw':!![]})[_0x4754('0x25')](function(_0x421abb){if(_0x421abb){return BPromise[_0x4754('0x51')](_0x421abb,function(_0x20aff6){return new BPromise(function(_0x2df591,_0x1b1c90){if(_0x20aff6['autoAssociation']===null||_0x20aff6[_0x4754('0x52')]===0x1)_0x2df591(null);return db['UserProfileResource'][_0x4754('0x3e')]({'where':{'sectionId':_0x20aff6['id']},'raw':!![]})['then'](function(_0x3674be){var _0xef3d9a=_[_0x4754('0x2a')](_0x3674be,function(_0x536f63){return qs['omit'](_0x536f63,['id',_0x4754('0x4b'),_0x4754('0x4c'),_0x4754('0x53')]);});_0x2df591(_0xef3d9a);})[_0x4754('0x40')](function(_0x221913){_0x1b1c90(_0x221913);});})[_0x4754('0x25')](function(_0x411dc6){var _0x28822d=qs['omit'](_0x20aff6,['id',_0x4754('0x4b'),_0x4754('0x4c')]);_0x28822d[_0x4754('0x54')]=_0x581e69['id'];if(_0x411dc6)_0x28822d[_0x4754('0x55')]=_0x411dc6;return _0x28822d;})[_0x4754('0x25')](function(_0x145fc9){return db[_0x4754('0x50')][_0x4754('0x46')](_0x145fc9,{'include':[{'model':db[_0x4754('0x56')],'as':_0x4754('0x55')}],'raw':!![],'transaction':_0x4b5309});});})['then'](function(){return _0x581e69;});}});});});}})['then'](respondWithResult(_0x43ed74,0xc9))[_0x4754('0x40')](handleError(_0x43ed74,null));};exports[_0x4754('0x57')]=function(_0x1f006c,_0xe7495e){if(_0x1f006c['body']['id']){delete _0x1f006c[_0x4754('0x47')]['id'];}return db[_0x4754('0x3c')][_0x4754('0x45')]({'where':{'id':_0x1f006c[_0x4754('0x48')]['id']}})[_0x4754('0x25')](handleEntityNotFound(_0xe7495e,null))['then'](saveUpdates(_0x1f006c[_0x4754('0x47')],null))[_0x4754('0x25')](respondWithResult(_0xe7495e,null))[_0x4754('0x40')](handleError(_0xe7495e,null));};exports[_0x4754('0x58')]=function(_0x3f6e0c,_0x927939){return db['UserProfile'][_0x4754('0x45')]({'where':{'id':_0x3f6e0c['params']['id']}})[_0x4754('0x25')](handleEntityNotFound(_0x927939,null))[_0x4754('0x25')](removeEntity(_0x927939,null))[_0x4754('0x40')](handleError(_0x927939,null));};exports['describe']=function(_0x8de7d7,_0x5e2795){return db[_0x4754('0x3c')]['describe']()[_0x4754('0x25')](respondWithResult(_0x5e2795,null))[_0x4754('0x40')](handleError(_0x5e2795,null));};exports[_0x4754('0x59')]=function(_0x4e41b2,_0x56f2ec){var _0x18df47=_0x4e41b2[_0x4754('0x47')];return db[_0x4754('0x3c')][_0x4754('0x45')]({'where':{'id':_0x4e41b2[_0x4754('0x48')]['id']}})['then'](handleEntityNotFound(_0x56f2ec,null))['then'](function(_0x53721d){if(_0x53721d){return db[_0x4754('0x4e')][_0x4754('0x4f')](function(_0x231a78){return db['UserProfileSection'][_0x4754('0x58')]({'where':{'userProfileId':_0x4e41b2['params']['id'],'sectionId':_['map'](_0x18df47,function(_0x40d33f){return _0x40d33f[_0x4754('0x53')];})},'transaction':_0x231a78})[_0x4754('0x25')](function(){var _0x483912=_['map'](_0x18df47,function(_0x378ad6){_0x378ad6[_0x4754('0x54')]=_0x4e41b2[_0x4754('0x48')]['id'];return _0x378ad6;});var _0x554af2=[];return BPromise[_0x4754('0x51')](_0x483912,function(_0xfac42b){return db[_0x4754('0x50')][_0x4754('0x46')](_0xfac42b,{'include':[{'model':db[_0x4754('0x56')],'as':_0x4754('0x55')}],'raw':!![],'transaction':_0x231a78})['then'](function(_0x20a82a){_0x554af2['push'](_0x20a82a['get']({'plain':!![]}));});})[_0x4754('0x25')](function(){return _0x554af2;});});});}})[_0x4754('0x25')](function(_0x45b2c8){return _0x45b2c8;})['then'](respondWithResult(_0x56f2ec,null))[_0x4754('0x40')](handleError(_0x56f2ec,null));};exports['removeSections']=function(_0x46e0fa,_0x5197cf){var _0x4571e2;return db['UserProfile']['find']({'where':{'id':_0x46e0fa['params']['id']},'attributes':['id',_0x4754('0x27')]})[_0x4754('0x25')](handleEntityNotFound(_0x5197cf,null))['then'](function(_0x93349c){if(_0x93349c){_0x4571e2=_0x93349c;return db[_0x4754('0x50')][_0x4754('0x58')]({'where':{'userProfileId':_0x46e0fa[_0x4754('0x48')]['id'],'sectionId':_0x46e0fa[_0x4754('0x2e')][_0x4754('0x5a')]}});}})[_0x4754('0x25')](function(){return _0x4571e2;})[_0x4754('0x25')](respondWithStatusCode(_0x5197cf,null))[_0x4754('0x40')](handleError(_0x5197cf,null));};exports[_0x4754('0x5b')]=function(_0x1b2608,_0x1d9652){var _0x263c1e=[];var _0x3273b7=[];return db[_0x4754('0x50')][_0x4754('0x3e')]({'where':{'userProfileId':_0x1b2608[_0x4754('0x48')]['id']},'raw':!![]})[_0x4754('0x25')](function(_0x2f7cab){_0x263c1e=_['filter'](_0x2f7cab,function(_0x4db338){return _0x4db338[_0x4754('0x5c')]===0x1||_['includes']([0x3eb,0x709],_0x4db338['sectionId']);});if(!_[_0x4754('0x5d')](_0x263c1e)){return _[_0x4754('0x2a')](_0x263c1e,function(_0x5a6b3b){return _0x5a6b3b[_0x4754('0x53')];});}else{return;}})[_0x4754('0x25')](function(_0x5d9628){if(_0x5d9628)_0x3273b7=_0x5d9628;if(_[_0x4754('0x5e')](_0x3273b7,0x64)){var _0x43c393=_['find'](_0x263c1e,{'sectionId':0x64});return hasDefaultDashboard(_0x43c393)[_0x4754('0x25')](function(_0x5b458b){return _[_0x4754('0x2a')](_0x263c1e,function(_0xc1b037){if(_0xc1b037['sectionId']===0x64){_0xc1b037[_0x4754('0x5f')]=_0x5b458b;}return _0xc1b037;});});}else{return;}})['then'](function(_0x2721ac){if(_0x2721ac)_0x263c1e=_0x2721ac;if(_[_0x4754('0x5e')](_0x3273b7,0x3eb)){var _0x381a40=_[_0x4754('0x45')](_0x263c1e,{'sectionId':0x3eb});return getCustomDashboards(_0x381a40)[_0x4754('0x25')](function(_0x4b74a1){return _['map'](_0x263c1e,function(_0x41bb94){if(_0x381a40[_0x4754('0x5c')]){if(_0x41bb94[_0x4754('0x53')]===0x3eb){_0x41bb94['subsections']=_0x4b74a1;}}else{if(_0x41bb94['sectionId']===0x64){if(!_0x41bb94[_0x4754('0x5f')]){_0x41bb94[_0x4754('0x5f')]=[];}_0x41bb94[_0x4754('0x5f')]=_0x41bb94[_0x4754('0x5f')]['concat'](_0x4b74a1);}}return _0x41bb94;});});}else{return;}})['then'](function(_0x437489){if(_0x437489)_0x263c1e=_0x437489;if(_['includes'](_0x3273b7,0x709)){var _0x50ad16=_['find'](_0x263c1e,{'sectionId':0x709});return getPlugins(_0x50ad16)['then'](function(_0x3d52c5){if(_0x50ad16[_0x4754('0x5c')]){return _[_0x4754('0x2a')](_0x263c1e,function(_0x5597f5){if(_0x5597f5[_0x4754('0x53')]===0x709){_0x5597f5[_0x4754('0x5f')]=_0x3d52c5;}return _0x5597f5;});}else{var _0x56f0e5={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3d52c5};var _0x14bfe2=_[_0x4754('0x2a')](_0x263c1e);_0x14bfe2[_0x4754('0x60')](_0x56f0e5);return _0x14bfe2;}});}else{return;}})[_0x4754('0x25')](function(_0x1aa855){if(_0x1aa855)_0x263c1e=_0x1aa855;return _['filter'](_0x263c1e,[_0x4754('0x5c'),0x1]);})['then'](respondWithResult(_0x1d9652,null))[_0x4754('0x40')](handleError(_0x1d9652,null));};function hasDefaultDashboard(_0x50ba3f){var _0x23e81b=[0x65];return new BPromise(function(_0x192910,_0x432d80){try{if(_0x50ba3f[_0x4754('0x52')]){_0x192910(_0x23e81b);}else{return db[_0x4754('0x56')]['findOne']({'where':{'sectionId':_0x50ba3f['id']},'raw':!![]})[_0x4754('0x25')](function(_0x5aee78){_0x5aee78?_0x192910(_0x23e81b):_0x192910();});}}catch(_0xe280b4){_0x432d80(_0xe280b4);}});}function getCustomDashboards(_0xecf201){var _0x25603d=[];return new BPromise(function(_0x49da38,_0x58759f){try{if(_0xecf201[_0x4754('0x52')]){return db[_0x4754('0x61')][_0x4754('0x3e')]({'raw':!![]})[_0x4754('0x25')](function(_0x1732f0){_0x1732f0['forEach'](function(_0x4f90ca){_0x25603d[_0x4754('0x60')](_0x4f90ca['id']+0x1869f);});_0x49da38(_0x25603d);});}else{return db[_0x4754('0x56')]['findAll']({'where':{'sectionId':_0xecf201['id']},'raw':!![]})[_0x4754('0x25')](function(_0x4cdb0a){_0x4cdb0a[_0x4754('0x62')](function(_0x4dd815){_0x25603d[_0x4754('0x60')](_0x4dd815[_0x4754('0x63')]+0x1869f);});_0x49da38(_0x25603d);});}}catch(_0x417856){_0x58759f(_0x417856);}});}function getPlugins(_0x842afd){var _0x172b05=[];return new BPromise(function(_0x293cd4,_0x277093){try{if(_0x842afd[_0x4754('0x52')]){return db[_0x4754('0x64')][_0x4754('0x3e')]({'raw':!![]})[_0x4754('0x25')](function(_0x509554){_0x509554[_0x4754('0x62')](function(_0x310302){_0x172b05[_0x4754('0x60')](_0x310302['id']+0x15b38);});_0x293cd4(_0x172b05);});}else{return db[_0x4754('0x56')][_0x4754('0x3e')]({'where':{'sectionId':_0x842afd['id']},'raw':!![]})[_0x4754('0x25')](function(_0x24a2dd){_0x24a2dd['forEach'](function(_0x14929a){_0x172b05[_0x4754('0x60')](_0x14929a[_0x4754('0x63')]+0x15b38);});_0x293cd4(_0x172b05);});}}catch(_0x4a8963){_0x277093(_0x4a8963);}});}exports[_0x4754('0x65')]=function(_0xdf9e6f,_0x3ef07d){return db[_0x4754('0x3c')][_0x4754('0x45')]({'where':{'id':_0xdf9e6f['params']['id']}})[_0x4754('0x25')](handleEntityNotFound(_0x3ef07d,null))['then'](function(_0x2d5b0f){if(_0x2d5b0f){return db['sequelize'][_0x4754('0x4f')](function(_0x4ff272){return db['UserProfileSection'][_0x4754('0x3e')]({'where':{'userProfileId':_0xdf9e6f[_0x4754('0x48')]['id']},'attributes':['id'],'raw':!![]})[_0x4754('0x25')](function(_0x4b1925){if(_0x4b1925){return db['UserProfileSection'][_0x4754('0x58')]({'where':{'userProfileId':_0xdf9e6f[_0x4754('0x48')]['id'],'id':_[_0x4754('0x2a')](_0x4b1925,function(_0x5bf5f8){return _0x5bf5f8['id'];})},'transaction':_0x4ff272});}})['then'](function(_0x60f54c){var _0x119763=_[_0x4754('0x2a')](_0xdf9e6f[_0x4754('0x47')],function(_0x5966a7){_0x5966a7[_0x4754('0x54')]=_0xdf9e6f['params']['id'];return _0x5966a7;});return db[_0x4754('0x50')][_0x4754('0x66')](_0x119763,{'raw':!![],'transaction':_0x4ff272});})[_0x4754('0x25')](function(_0x147856){var _0x4b874e=_[_0x4754('0x37')](_[_0x4754('0x2a')](_0x147856,function(_0x5bdcfa){return _0x5bdcfa[_0x4754('0x49')]({'plain':!![]});}),{'includeAll':![]});if(_0x4b874e){return db[_0x4754('0x50')][_0x4754('0x3e')]({'where':{'userProfileId':_0xdf9e6f[_0x4754('0x48')]['id'],'sectionId':_[_0x4754('0x2a')](_0x4b874e,function(_0x5ceb6f){return _0x5ceb6f[_0x4754('0x53')];})},'attributes':['id',_0x4754('0x53')],'raw':!![]})[_0x4754('0x25')](function(_0x1c056e){var _0x590d2e=_[_0x4754('0x2a')](_0xdf9e6f[_0x4754('0x47')],function(_0x22a59a){_0x22a59a['userProfileId']=_0xdf9e6f[_0x4754('0x48')]['id'];return _0x22a59a;});return db[_0x4754('0x56')]['bulkCreate'](_0x590d2e,{'raw':!![],'transaction':_0x4ff272});});}})[_0x4754('0x40')](handleError(_0x3ef07d,null));});}})[_0x4754('0x25')](function(_0x3e41a1){var _0x5cff70=_[_0x4754('0x2a')](_0x3e41a1,function(_0xb7fd08){return _0xb7fd08[_0x4754('0x49')]({'plain':!![]});});})[_0x4754('0x25')](respondWithResult(_0x3ef07d,null))[_0x4754('0x40')](handleError(_0x3ef07d,null));};exports['removeResources']=function(_0x499a4f,_0x1f4ecb,_0x3e9503){return db[_0x4754('0x3c')][_0x4754('0x45')]({'where':{'id':_0x499a4f['params']['id']}})['then'](handleEntityNotFound(_0x1f4ecb,null))[_0x4754('0x25')](function(_0x2e2426){if(_0x2e2426){return _0x2e2426['removeResources'](_0x499a4f[_0x4754('0x2e')]['ids']);}})[_0x4754('0x25')](respondWithStatusCode(_0x1f4ecb,null))['catch'](handleError(_0x1f4ecb,null));};exports[_0x4754('0x67')]=function(_0x3f8e2e,_0x51085f){var _0x5e9630={};if(!_0x3f8e2e['query'][_0x4754('0x68')])throw new Error(_0x4754('0x69'));if(!_0x3f8e2e[_0x4754('0x2e')][_0x4754('0x33')](_0x4754('0x34'))){_0x5e9630[_0x4754('0x1f')]=qs[_0x4754('0x1f')](_0x3f8e2e[_0x4754('0x2e')][_0x4754('0x1f')]);_0x5e9630[_0x4754('0x21')]=qs[_0x4754('0x21')](_0x3f8e2e['query'][_0x4754('0x21')]);}return db[_0x4754('0x3c')]['find']({'where':{'id':_0x3f8e2e[_0x4754('0x48')]['id']}})[_0x4754('0x25')](function(_0x1ee7a6){if(!_0x1ee7a6)throw new Error(_0x4754('0x6a')+_0x3f8e2e[_0x4754('0x48')]['id']);return db['UserProfile'][_0x4754('0x67')](_0x3f8e2e);})[_0x4754('0x25')](respondWithFilteredResult(_0x51085f,_0x5e9630))[_0x4754('0x40')](handleError(_0x51085f,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index a200200..2ab6f2e 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 _0x7e27=['update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x3c3a03,_0x3c0da1){var _0x57ff53=function(_0xd08f4a){while(--_0xd08f4a){_0x3c3a03['push'](_0x3c3a03['shift']());}};_0x57ff53(++_0x3c0da1);}(_0x7e27,0xdd));var _0x77e2=function(_0x58bbc5,_0x509e1b){_0x58bbc5=_0x58bbc5-0x0;var _0x5c0024=_0x7e27[_0x58bbc5];return _0x5c0024;};'use strict';var EventEmitter=require(_0x77e2('0x0'));var UserProfile=require(_0x77e2('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x77e2('0x2')](0x0);var events={'afterCreate':_0x77e2('0x3'),'afterUpdate':_0x77e2('0x4'),'afterDestroy':_0x77e2('0x5')};function emitEvent(_0x49537e){return function(_0x30766a,_0x21bb94,_0x20c6f0){UserProfileEvents['emit'](_0x49537e+':'+_0x30766a['id'],_0x30766a);UserProfileEvents[_0x77e2('0x6')](_0x49537e,_0x30766a);_0x20c6f0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x77e2('0x7')](e,emitEvent(event));}}module[_0x77e2('0x8')]=UserProfileEvents; \ No newline at end of file +var _0xee2c=['update','emit','hasOwnProperty','hook','exports','events','UserProfile','setMaxListeners','save'];(function(_0x5ee4b6,_0x1fb059){var _0x22f62f=function(_0x2ec02e){while(--_0x2ec02e){_0x5ee4b6['push'](_0x5ee4b6['shift']());}};_0x22f62f(++_0x1fb059);}(_0xee2c,0x1c7));var _0xcee2=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xee2c[_0xbd08b4];return _0x314f1e;};'use strict';var EventEmitter=require(_0xcee2('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xcee2('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xcee2('0x2')](0x0);var events={'afterCreate':_0xcee2('0x3'),'afterUpdate':_0xcee2('0x4'),'afterDestroy':'remove'};function emitEvent(_0x589e9d){return function(_0xc9b213,_0xb70cd1,_0x49d04d){UserProfileEvents[_0xcee2('0x5')](_0x589e9d+':'+_0xc9b213['id'],_0xc9b213);UserProfileEvents[_0xcee2('0x5')](_0x589e9d,_0xc9b213);_0x49d04d(null);};}for(var e in events){if(events[_0xcee2('0x6')](e)){var event=events[e];UserProfile[_0xcee2('0x7')](e,emitEvent(event));}}module[_0xcee2('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 4e64383..e42261f 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 _0x9e24=['options','autoAssociation','include','reportType','DefaultReports','custom','CustomReports','rows','ids','customSorting','extraQueryConditions','count','CmContact','color','ThroughTags','tag','openTabs','sms','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','exports','models','filter','field','findAll','then','associatedResources','map','catch','value','model','AnalyticExtractedReport','resourceId','type','squareprojects','childModel','parentSections','name','projectName','projects','contacts','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','membername','role','Telephones','User','queue','inbound','QueueCampaigns','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','VoiceQueue','VoiceQueues','users','agents','Users','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','Schedule','sounds','Sound','tags','Tag','templates','Template','Trigger','trunks','Trunk','variables','plugins','Plugin','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','select','ui.','InteractionId','ui.createdAt','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','filters','merge','key','foreignKey','forEach'];(function(_0x3f2fea,_0x3c4ea8){var _0x69a4d5=function(_0x223109){while(--_0x223109){_0x3f2fea['push'](_0x3f2fea['shift']());}};_0x69a4d5(++_0x3c4ea8);}(_0x9e24,0xd9));var _0x49e2=function(_0x34933a,_0x327378){_0x34933a=_0x34933a-0x0;var _0x36abb4=_0x9e24[_0x34933a];return _0x36abb4;};'use strict';var _=require(_0x49e2('0x0'));var attributes=require(_0x49e2('0x1'));var squel=require('squel');module[_0x49e2('0x2')]=function(_0x3cac55){var _0x355786=_0x3cac55[_0x49e2('0x3')];function _0x252e98(_0x308c5f,_0x1f7d24){return new Promise(function(_0x1c08cc,_0xfbcc61){if(!_0x1f7d24)return _0x1c08cc(null);var _0x4d30a9=_0x1f7d24[_0x49e2('0x4')]?{[_0x1f7d24['filter'][_0x49e2('0x5')]]:_0x1f7d24[_0x49e2('0x4')]['value']}:undefined;return _0x355786[_0x308c5f][_0x49e2('0x6')]({'where':_0x4d30a9,'raw':!![]})[_0x49e2('0x7')](function(_0x919936){_0x1f7d24[_0x49e2('0x8')]=_[_0x49e2('0x9')](_0x919936,'id');_0x1c08cc(_0x1f7d24);})[_0x49e2('0xa')](function(_0x88b70b){_0xfbcc61(_0x88b70b);});});}function _0x324b35(_0x3192b1,_0x33efca){return new Promise(function(_0xf15e5,_0x381532){var _0x1f05b0=_0x3192b1[_0x49e2('0x4')]?{[_0x3192b1[_0x49e2('0x4')][_0x49e2('0x5')]]:_0x3192b1[_0x49e2('0x4')][_0x49e2('0xb')]}:undefined;return _0x355786[_0x3192b1[_0x49e2('0xc')]][_0x49e2('0x6')]({'where':_0x1f05b0,'raw':!![]})[_0x49e2('0x7')](function(_0x388232){_0x33efca[_0x49e2('0x8')]=_[_0x49e2('0x9')](_0x388232,function(_0x143d29){return _0x143d29['name'];});_0xf15e5(_0x33efca);})[_0x49e2('0xa')](function(_0x2eb934){_0x381532(_0x2eb934);});});}function _0x1b5af(_0x118b17,_0x642fd0,_0x8c878a){if(!_0x642fd0)return Promise['resolve'](null);return new Promise(function(_0x5b3417,_0x464b26){return _0x355786['UserProfileResource'][_0x49e2('0x6')]({'where':{'sectionId':_0x642fd0['id']},'raw':!![]})[_0x49e2('0x7')](function(_0x261695){if(_0x118b17['field']&&_0x118b17[_0x49e2('0x5')]!=='id'){_0x642fd0['associatedResources']=_[_0x49e2('0x9')](_0x261695,function(_0x4df7d4){return _0x4df7d4[_0x118b17['field']];});}else{if(_0x8c878a===_0x49e2('0xd')){_0x642fd0[_0x49e2('0x8')]=_[_0x49e2('0x9')](_0x261695,function(_0x4f7e06){return{'id':_0x4f7e06[_0x49e2('0xe')],'type':_0x4f7e06[_0x49e2('0xf')]};});}else{_0x642fd0['associatedResources']=_[_0x49e2('0x9')](_0x261695,function(_0x5035c8){return _0x5035c8[_0x49e2('0xe')];});}}_0x5b3417(_0x642fd0);})[_0x49e2('0xa')](function(_0x1a33f7){_0x464b26(_0x1a33f7);});});}function _0x1a3fd8(_0x4cb9ff,_0x2bf7a4){var _0x1053b5={'parentSections':[]};switch(_0x4cb9ff['toLowerCase']()){case _0x49e2('0x10'):_0x1053b5[_0x49e2('0x11')]='SquareProject';break;case'odbc':_0x1053b5[_0x49e2('0x11')]='SquareOdbc';break;case'squarerecordings':_0x1053b5[_0x49e2('0x11')]='SquareRecording';_0x1053b5[_0x49e2('0x12')]=[{'name':'SquareProjects','field':_0x49e2('0x13'),'foreignKey':_0x49e2('0x14')}];break;case _0x49e2('0x15'):_0x1053b5[_0x49e2('0x11')]='JscriptyProject';break;case _0x49e2('0x16'):_0x1053b5[_0x49e2('0x11')]='CmContact';_0x1053b5[_0x49e2('0x12')]=[{'name':_0x49e2('0x17'),'field':'id','foreignKey':_0x49e2('0x18')}];break;case _0x49e2('0x19'):_0x1053b5['childModel']=_0x49e2('0x1a');break;case _0x49e2('0x1b'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x1c');break;case _0x49e2('0x1d'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x1e');break;case _0x49e2('0x1f'):_0x1053b5[_0x49e2('0x11')]='ChatQueue';break;case _0x49e2('0x20'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x21');break;case _0x49e2('0x22'):_0x1053b5['childModel']=_0x49e2('0x23');break;case _0x49e2('0x24'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x25');break;case'inboundroutes':case _0x49e2('0x26'):case _0x49e2('0x27'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x28');break;case _0x49e2('0x29'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x2a');break;case _0x49e2('0x2b'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x2c');break;case _0x49e2('0x2d'):_0x1053b5['childModel']=_0x49e2('0x2e');_0x1053b5['parentSections']=[{'name':'Agents','field':_0x49e2('0x13'),'foreignKey':_0x49e2('0x2f'),'model':'User','filter':{'field':_0x49e2('0x30'),'value':['agent']}},{'name':_0x49e2('0x31'),'field':_0x49e2('0x13'),'foreignKey':_0x49e2('0x2f'),'model':_0x49e2('0x32'),'filter':{'field':_0x49e2('0x30'),'value':['telephone']}},{'name':'VoiceQueues','field':'name','foreignKey':_0x49e2('0x33'),'model':'VoiceQueue','filter':{'field':'type','value':[_0x49e2('0x34')]}},{'name':_0x49e2('0x35'),'field':'name','foreignKey':_0x49e2('0x33'),'model':'VoiceQueue','filter':{'field':_0x49e2('0xf'),'value':[_0x49e2('0x36')]}}];break;case _0x49e2('0x37'):_0x1053b5['childModel']='VoiceMusicOnHold';break;case _0x49e2('0x38'):_0x1053b5['childModel']=_0x49e2('0x39');break;case _0x49e2('0x3a'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x3b');break;case _0x49e2('0x3c'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x3d');break;case _0x49e2('0x3e'):_0x1053b5['childModel']=_0x49e2('0x3f');break;case _0x49e2('0x40'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x41');break;case _0x49e2('0x42'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x43');break;case _0x49e2('0x44'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x45');break;case'openchannelaccounts':_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x46');break;case _0x49e2('0x47'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x48');break;case'smsaccounts':_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x49');break;case _0x49e2('0x4a'):_0x1053b5['childModel']=_0x49e2('0x4b');break;case _0x49e2('0x4c'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x4d');break;case _0x49e2('0x4e'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x4f');break;case _0x49e2('0x50'):case'queuecampaigns':_0x1053b5['childModel']=_0x49e2('0x51');if(_0x2bf7a4){_0x1053b5[_0x49e2('0x12')]=[{'name':_0x49e2('0x52')},{'name':_0x49e2('0x35')}];}break;case _0x49e2('0x53'):case _0x49e2('0x54'):case'telephones':_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x32');if(_0x2bf7a4){_0x1053b5['parentSections']=[{'name':_0x49e2('0x55'),'filter':{'field':'role','value':['admin',_0x49e2('0x56')]},'ignore':!![]},{'name':_0x49e2('0x57')},{'name':_0x49e2('0x31')}];}break;case _0x49e2('0x58'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x59');break;case _0x49e2('0x5a'):_0x1053b5['childModel']=_0x49e2('0x5b');break;case _0x49e2('0x5c'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x5d');break;case _0x49e2('0x5e'):_0x1053b5[_0x49e2('0x11')]='SugarcrmAccount';break;case'deskaccounts':_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x5f');break;case _0x49e2('0x60'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x61');break;case'vtigeraccounts':_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x32');break;case _0x49e2('0x62'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x63');break;case'dispositions':_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x64');break;case _0x49e2('0x65'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x66');break;case _0x49e2('0x67'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x68');break;case _0x49e2('0x69'):_0x1053b5['childModel']=_0x49e2('0x6a');break;case'scheduler':_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x6b');break;case _0x49e2('0x6c'):_0x1053b5['childModel']=_0x49e2('0x6d');break;case _0x49e2('0x6e'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x6f');break;case _0x49e2('0x70'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x71');break;case'triggers':_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x72');break;case _0x49e2('0x73'):_0x1053b5['childModel']=_0x49e2('0x74');break;case _0x49e2('0x75'):_0x1053b5[_0x49e2('0x11')]='Variable';break;case _0x49e2('0x76'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x77');break;case'extractedreports':_0x1053b5['childModel']=_0x49e2('0xd');_0x1053b5['parentSections']=[{'name':'Reports','field':'id','foreignKey':_0x49e2('0x78')}];break;case _0x49e2('0x79'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x7a');break;}return _0x1053b5;}function _0x2243a4(_0x22fea4,_0x4d9dcc){var _0x275efe=_0x22fea4[_0x49e2('0x7b')](0x0)[_0x49e2('0x7c')]()+_0x22fea4[_0x49e2('0x7d')](0x1);var _0x1e751f={'type':_0x355786[_0x49e2('0x7e')][_0x49e2('0x7f')]['SELECT'],'raw':!![]};return new Promise(function(_0x4a3882,_0x522b35){var _0x19ea07=squel[_0x49e2('0x80')]()[_0x49e2('0x5')](_0x49e2('0x81')+_0x275efe+_0x49e2('0x82'),'id')[_0x49e2('0x5')](_0x49e2('0x83'))['from'](_0x49e2('0x84')+_0x22fea4+_0x49e2('0x85'),'ui')[_0x49e2('0x86')](_0x49e2('0x87'),_0x4d9dcc['id']);return _0x355786[_0x49e2('0x88')][_0x49e2('0x89')](_0x19ea07[_0x49e2('0x8a')](),_0x1e751f)[_0x49e2('0x7')](function(_0x550e5c){_0x4d9dcc[_0x275efe+_0x49e2('0x8b')]=_0x550e5c;_0x4a3882(_0x550e5c);})[_0x49e2('0xa')](function(_0x26393b){_0x522b35(_0x26393b);});});}return _0x3cac55[_0x49e2('0x8c')](_0x49e2('0x8d'),attributes,{'tableName':_0x49e2('0x8e'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x18a80e){var _0x16fac1=require('../../components/parsers/qs');var _0x90207b={'raw':_0x18a80e[_0x49e2('0x89')]['raw'],'where':{}};var _0x2b08d4={};var _0x10c114={'count':0x0,'rows':[]};var _0xa3ef65=_0x18a80e[_0x49e2('0x89')][_0x49e2('0x8f')];var _0x138c52=_0x18a80e[_0x49e2('0x89')][_0x49e2('0x90')]||![];var _0x2da603=_0x1a3fd8(_0xa3ef65,_0x138c52);if(!_0x2da603[_0x49e2('0x11')])throw new Error(_0x49e2('0x91')+_0xa3ef65+'\x27');var _0x5d5a2f=[{'name':_0xa3ef65}];if(!_[_0x49e2('0x92')](_0x2da603[_0x49e2('0x12')]))_0x5d5a2f=_0x2da603[_0x49e2('0x12')];var _0x4b1efe=[];for(var _0x4cec96=0x0;_0x4cec96<_0x5d5a2f[_0x49e2('0x93')];_0x4cec96++){_0x4b1efe[_0x49e2('0x94')](_0x355786[_0x49e2('0x95')][_0x49e2('0x96')]({'where':{'userProfileId':_0x18a80e[_0x49e2('0x97')]['id'],'name':_0x5d5a2f[_0x4cec96][_0x49e2('0x13')]},'raw':!![]}));}return Promise[_0x49e2('0x98')](_0x4b1efe)['then'](function(_0x3968e2){var _0x20b380=_[_0x49e2('0x4')](_0x3968e2,function(_0x59f98b){return _0x59f98b?_0x59f98b:undefined;});var _0x2b4e58=_[_0x49e2('0x4')](_0x5d5a2f,[_0x49e2('0x99'),!![]]);var _0x2b99f2=_['isEmpty'](_0x20b380)&&_[_0x49e2('0x92')](_0x2b4e58)?null:_[_0x49e2('0x9a')](_0x2b4e58,_0x20b380);if(!_0x2b99f2)return null;var _0x3cf550=[];for(var _0x17cd02=0x0;_0x17cd02<_0x2b99f2['length'];_0x17cd02++){var _0x3ebf93=_['find'](_0x5d5a2f,function(_0x48e53a){return _0x2b99f2[_0x17cd02]?_0x48e53a[_0x49e2('0x13')]===_0x2b99f2[_0x17cd02][_0x49e2('0x13')]:null;});if(_0x3ebf93){if(_0x2b99f2[_0x17cd02][_0x49e2('0x99')]){_0x3cf550[_0x49e2('0x94')](_0x252e98(_0x2da603[_0x49e2('0x11')],_0x2b99f2[_0x17cd02]));}else{if(!_0x2b99f2[_0x17cd02]['autoAssociation']){_0x3cf550['push'](_0x1b5af(_0x3ebf93,_0x2b99f2[_0x17cd02],_0x2da603['childModel']));}else{if(_0x3ebf93[_0x49e2('0xc')]){_0x3cf550[_0x49e2('0x94')](_0x324b35(_0x3ebf93,_0x2b99f2[_0x17cd02]));}}}}}return Promise[_0x49e2('0x98')](_0x3cf550);})['then'](function(_0x3e0cfe){var _0x14caf7=_0x3e0cfe;var _0x583e6e=null;if(_0x14caf7){_0x583e6e=_0x14caf7[_0x49e2('0x93')]===0x1?_0x14caf7[0x0]:null;}if(!_0x583e6e&&!_0x14caf7)return _0x10c114;var _0x523179=_0x355786[_0x2da603[_0x49e2('0x11')]][_0x49e2('0x9b')];_0x2b08d4[_0x49e2('0xc')]=_[_0x49e2('0x9c')](_0x523179);_0x2b08d4[_0x49e2('0x89')]=_[_0x49e2('0x9c')](_0x18a80e[_0x49e2('0x89')]);_0x2b08d4['filters']=_[_0x49e2('0x9d')](_0x2b08d4[_0x49e2('0xc')],_0x2b08d4[_0x49e2('0x89')]);_0x90207b[_0x49e2('0x9e')]=_[_0x49e2('0x9d')](_0x2b08d4['model'],_0x16fac1[_0x49e2('0x9f')](_0x18a80e[_0x49e2('0x89')][_0x49e2('0x9f')]));_0x90207b[_0x49e2('0x9e')]=_0x90207b[_0x49e2('0x9e')][_0x49e2('0x93')]?_0x90207b[_0x49e2('0x9e')]:_0x2b08d4['model'];if(!_0x18a80e[_0x49e2('0x89')][_0x49e2('0xa0')](_0x49e2('0xa1'))){_0x90207b[_0x49e2('0xa2')]=_0x16fac1['limit'](_0x18a80e[_0x49e2('0x89')]['limit']);_0x90207b['offset']=_0x16fac1[_0x49e2('0xa3')](_0x18a80e[_0x49e2('0x89')][_0x49e2('0xa3')]);}_0x90207b[_0x49e2('0xa4')]=_0x16fac1[_0x49e2('0xa5')](_0x18a80e['query'][_0x49e2('0xa5')]);_0x90207b[_0x49e2('0x86')]=_0x16fac1[_0x49e2('0xa6')](_['pick'](_0x18a80e[_0x49e2('0x89')],_0x2b08d4[_0x49e2('0xa6')]));if(_0x18a80e[_0x49e2('0x89')][_0x49e2('0x4')]){_0x90207b[_0x49e2('0x86')]=_[_0x49e2('0xa7')](_0x90207b['where'],{'$or':_[_0x49e2('0x9')](_0x523179,function(_0x17cc11){if(_0x17cc11[_0x49e2('0xf')][_0x49e2('0xa8')]!=='VIRTUAL'){var _0x1fcbc3={};_0x1fcbc3[_0x17cc11[_0x49e2('0x5')]]={'$like':'%'+_0x18a80e[_0x49e2('0x89')][_0x49e2('0x4')]+'%'};return _0x1fcbc3;}})});}var _0x26eee7=[];var _0x9f54a8=null;var _0x4d5587={};if(_0x583e6e){_0x9f54a8=_['find'](_0x5d5a2f,[_0x49e2('0x13'),_0x583e6e[_0x49e2('0x13')]]);if(_0x9f54a8[_0x49e2('0x5')]){_0x4d5587={};if(_0x2da603[_0x49e2('0x11')]==='AnalyticExtractedReport'){_0x4d5587[_0x9f54a8['foreignKey']]=_[_0x49e2('0x9')](_0x583e6e[_0x49e2('0x8')],'id');}else{_0x4d5587[_0x9f54a8[_0x49e2('0xa9')]]=_0x583e6e[_0x49e2('0x8')];}_0x26eee7[_0x49e2('0x94')](_0x4d5587);}else{_0x90207b[_0x49e2('0x86')]['id']=_0x583e6e[_0x49e2('0x8')];}}else{for(var _0x3d9514=0x0;_0x3d9514<_0x14caf7['length'];_0x3d9514++){_0x9f54a8=_[_0x49e2('0x96')](_0x5d5a2f,[_0x49e2('0x13'),_0x14caf7[_0x3d9514][_0x49e2('0x13')]]);if(_0x9f54a8[_0x49e2('0x5')]){_0x4d5587={};_0x4d5587[_0x9f54a8['foreignKey']]=_0x14caf7[_0x3d9514][_0x49e2('0x8')];_0x26eee7[_0x49e2('0x94')](_0x4d5587);}else{if(!_0x90207b[_0x49e2('0x86')]['id'])_0x90207b[_0x49e2('0x86')]['id']=[];_0x14caf7[_0x3d9514][_0x49e2('0x8')][_0x49e2('0xaa')](function(_0x24dfe3){_0x90207b['where']['id'][_0x49e2('0x94')](_0x24dfe3);});}}}if(!_[_0x49e2('0x92')](_0x26eee7)){_0x90207b[_0x49e2('0x86')]=_[_0x49e2('0xa7')](_0x90207b[_0x49e2('0x86')],{'$and':{'$or':_0x26eee7}});}_0x90207b=_['merge']({},_0x90207b,_0x18a80e[_0x49e2('0xab')]);if(_0x583e6e&&!_0x583e6e[_0x49e2('0xac')]&&_0x2da603[_0x49e2('0x11')]==='AnalyticExtractedReport'){if(_0x18a80e['query']['includeAll']){_0x90207b[_0x49e2('0xad')]=[{'all':!![]}];}return _0x355786[_0x2da603['childModel']][_0x49e2('0x6')](_0x90207b)[_0x49e2('0x7')](function(_0xb1adbe){var _0x132c5e=[];_0xb1adbe[_0x49e2('0xaa')](function(_0x3f2b6c){var _0x553103;switch(_0x3f2b6c[_0x49e2('0xae')]){case'default':_0x553103=_[_0x49e2('0x96')](_0x583e6e[_0x49e2('0x8')],function(_0x3a4d73){return _0x3a4d73['id']===_0x3f2b6c[_0x49e2('0x78')]&&_0x3a4d73[_0x49e2('0xf')]===_0x49e2('0xaf');});break;case _0x49e2('0xb0'):_0x553103=_[_0x49e2('0x96')](_0x583e6e[_0x49e2('0x8')],function(_0x5db269){return _0x5db269['id']===_0x3f2b6c['reportId']&&_0x5db269['type']===_0x49e2('0xb1');});break;}if(_0x553103)_0x132c5e['push'](_0x3f2b6c);});_0x10c114['count']=_0x132c5e[_0x49e2('0x93')];_0x10c114[_0x49e2('0xb2')]=_0x132c5e;return _0x10c114;});}else{if(!_['isEmpty'](_0x18a80e['query'][_0x49e2('0xb3')])){_0x90207b['where']['id']=_0x90207b[_0x49e2('0x86')]['id']?_[_0x49e2('0x9d')](_0x90207b['where']['id'],_0x18a80e[_0x49e2('0x89')]['ids']):_0x18a80e['query'][_0x49e2('0xb3')];if(_0x18a80e[_0x49e2('0x89')][_0x49e2('0xb4')]){_0x90207b[_0x49e2('0xa4')]=_0x18a80e[_0x49e2('0x89')][_0x49e2('0xb4')];}}if(_0x18a80e[_0x49e2('0x89')][_0x49e2('0xb5')]){_0x90207b[_0x49e2('0x86')]=_['merge'](_0x90207b['where'],{'$and':_0x18a80e[_0x49e2('0x89')][_0x49e2('0xb5')]});}return _0x355786[_0x2da603['childModel']][_0x49e2('0xb6')]({'where':_0x90207b[_0x49e2('0x86')]})['then'](function(_0x45cf57){_0x10c114[_0x49e2('0xb6')]=_0x45cf57;if(_0x18a80e[_0x49e2('0x89')]['includeAll']){if(_0x2da603[_0x49e2('0x11')]===_0x49e2('0xb7')){_0x90207b['include']=[{'model':_0x355786[_0x49e2('0x6f')],'as':'Tags','attributes':['id',_0x49e2('0x13'),_0x49e2('0xb8')],'required':_0x18a80e[_0x49e2('0x89')]['tag']?!![]:![]},{'model':_0x355786[_0x49e2('0x6f')],'as':_0x49e2('0xb9'),'attributes':['id','name','color'],'through':_0x18a80e[_0x49e2('0x89')]['tag']?{'attributes':[],'where':{'TagId':_0x18a80e[_0x49e2('0x89')]['tag']||undefined}}:{},'required':_0x18a80e['query'][_0x49e2('0xba')]?!![]:![]}];}else{_0x90207b['include']=[{'all':!![]}];}}return _0x355786[_0x2da603['childModel']]['findAll'](_0x90207b);})[_0x49e2('0x7')](function(_0x19fb91){_0x10c114[_0x49e2('0xb2')]=_0x19fb91;if(_0xa3ef65==='Agents'&&_0x18a80e[_0x49e2('0x89')][_0x49e2('0xbb')]==='true'){var _0x5aa979=[];for(var _0x36ac0a=0x0;_0x36ac0a<_0x10c114[_0x49e2('0xb2')][_0x49e2('0x93')];_0x36ac0a++){_0x5aa979['push'](_0x2243a4('chat',_0x10c114[_0x49e2('0xb2')][_0x36ac0a]['dataValues']));_0x5aa979['push'](_0x2243a4(_0x49e2('0xbc'),_0x10c114['rows'][_0x36ac0a][_0x49e2('0xbd')]));_0x5aa979[_0x49e2('0x94')](_0x2243a4(_0x49e2('0xbe'),_0x10c114[_0x49e2('0xb2')][_0x36ac0a][_0x49e2('0xbd')]));_0x5aa979[_0x49e2('0x94')](_0x2243a4(_0x49e2('0xbf'),_0x10c114[_0x49e2('0xb2')][_0x36ac0a][_0x49e2('0xbd')]));_0x5aa979[_0x49e2('0x94')](_0x2243a4(_0x49e2('0xc0'),_0x10c114[_0x49e2('0xb2')][_0x36ac0a][_0x49e2('0xbd')]));_0x5aa979[_0x49e2('0x94')](_0x2243a4(_0x49e2('0xc1'),_0x10c114[_0x49e2('0xb2')][_0x36ac0a][_0x49e2('0xbd')]));}return Promise['all'](_0x5aa979)[_0x49e2('0x7')](function(){return _0x10c114;});}return _0x10c114;});}});}}});}; \ No newline at end of file +var _0x33a2=['nolimit','limit','offset','sort','filters','pick','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','order','extraQueryConditions','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','field','value','then','associatedResources','catch','model','map','name','resolve','findAll','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','squarerecordings','SquareRecording','parentSections','projects','JscriptyProject','contacts','CmContact','Lists','lists','companies','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','VoiceRecording','Agents','membername','User','role','agent','Telephones','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsaccounts','SmsAccount','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Variable','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','toUpperCase','slice','Sequelize','SELECT','select','ui.','InteractionId','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','toString','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','query','raw','section','mergeResources','isEmpty','length','push','UserProfileSection','find','params','all','union','ignore','autoAssociation','keys','intersection','attributes','fields','hasOwnProperty'];(function(_0x312a5c,_0x59990a){var _0x329f31=function(_0x52791c){while(--_0x52791c){_0x312a5c['push'](_0x312a5c['shift']());}};_0x329f31(++_0x59990a);}(_0x33a2,0x1be));var _0x233a=function(_0x1c869d,_0x34184b){_0x1c869d=_0x1c869d-0x0;var _0x4dc0ce=_0x33a2[_0x1c869d];return _0x4dc0ce;};'use strict';var _=require(_0x233a('0x0'));var attributes=require(_0x233a('0x1'));var squel=require(_0x233a('0x2'));module[_0x233a('0x3')]=function(_0x2f1e3b){var _0x140c3b=_0x2f1e3b[_0x233a('0x4')];function _0x708b9f(_0x551db5,_0x5c6d54){return new Promise(function(_0x808ffd,_0x357a3){if(!_0x5c6d54)return _0x808ffd(null);var _0x4e8ca6=_0x5c6d54[_0x233a('0x5')]?{[_0x5c6d54[_0x233a('0x5')][_0x233a('0x6')]]:_0x5c6d54[_0x233a('0x5')][_0x233a('0x7')]}:undefined;return _0x140c3b[_0x551db5]['findAll']({'where':_0x4e8ca6,'raw':!![]})[_0x233a('0x8')](function(_0x1d0e4c){_0x5c6d54[_0x233a('0x9')]=_['map'](_0x1d0e4c,'id');_0x808ffd(_0x5c6d54);})[_0x233a('0xa')](function(_0x1e6a52){_0x357a3(_0x1e6a52);});});}function _0x174fef(_0x47b455,_0x398280){return new Promise(function(_0x111664,_0x49955a){var _0x4cbc5d=_0x47b455[_0x233a('0x5')]?{[_0x47b455['filter'][_0x233a('0x6')]]:_0x47b455['filter'][_0x233a('0x7')]}:undefined;return _0x140c3b[_0x47b455[_0x233a('0xb')]]['findAll']({'where':_0x4cbc5d,'raw':!![]})[_0x233a('0x8')](function(_0x409276){_0x398280[_0x233a('0x9')]=_[_0x233a('0xc')](_0x409276,function(_0x212134){return _0x212134[_0x233a('0xd')];});_0x111664(_0x398280);})[_0x233a('0xa')](function(_0x3f26e1){_0x49955a(_0x3f26e1);});});}function _0x3387fc(_0x31b60b,_0xb03de5,_0x58cb0f){if(!_0xb03de5)return Promise[_0x233a('0xe')](null);return new Promise(function(_0x1585ed,_0x291452){return _0x140c3b['UserProfileResource'][_0x233a('0xf')]({'where':{'sectionId':_0xb03de5['id']},'raw':!![]})[_0x233a('0x8')](function(_0x2803bd){if(_0x31b60b[_0x233a('0x6')]&&_0x31b60b['field']!=='id'){_0xb03de5[_0x233a('0x9')]=_[_0x233a('0xc')](_0x2803bd,function(_0x546d26){return _0x546d26[_0x31b60b[_0x233a('0x6')]];});}else{if(_0x58cb0f===_0x233a('0x10')){_0xb03de5[_0x233a('0x9')]=_['map'](_0x2803bd,function(_0x45b294){return{'id':_0x45b294[_0x233a('0x11')],'type':_0x45b294[_0x233a('0x12')]};});}else{_0xb03de5[_0x233a('0x9')]=_[_0x233a('0xc')](_0x2803bd,function(_0x118fae){return _0x118fae[_0x233a('0x11')];});}}_0x1585ed(_0xb03de5);})[_0x233a('0xa')](function(_0x252afd){_0x291452(_0x252afd);});});}function _0x10480b(_0x5e1403,_0x3469c0){var _0xe5ae7a={'parentSections':[]};switch(_0x5e1403[_0x233a('0x13')]()){case _0x233a('0x14'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x16');break;case _0x233a('0x17'):_0xe5ae7a[_0x233a('0x15')]='SquareOdbc';break;case _0x233a('0x18'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x19');_0xe5ae7a[_0x233a('0x1a')]=[{'name':'SquareProjects','field':_0x233a('0xd'),'foreignKey':'projectName'}];break;case _0x233a('0x1b'):_0xe5ae7a['childModel']=_0x233a('0x1c');break;case _0x233a('0x1d'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x1e');_0xe5ae7a[_0x233a('0x1a')]=[{'name':_0x233a('0x1f'),'field':'id','foreignKey':'ListId'}];break;case _0x233a('0x20'):_0xe5ae7a[_0x233a('0x15')]='CmList';break;case _0x233a('0x21'):_0xe5ae7a[_0x233a('0x15')]='CmCompany';break;case _0x233a('0x22'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x23');break;case _0x233a('0x24'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x25');break;case _0x233a('0x26'):_0xe5ae7a['childModel']=_0x233a('0x27');break;case _0x233a('0x28'):_0xe5ae7a[_0x233a('0x15')]='FaxQueue';break;case _0x233a('0x29'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x2a');break;case _0x233a('0x2b'):case _0x233a('0x2c'):case _0x233a('0x2d'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x2e');break;case _0x233a('0x2f'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x30');break;case'voicemails':_0xe5ae7a['childModel']=_0x233a('0x31');break;case'voicerecordings':_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x32');_0xe5ae7a[_0x233a('0x1a')]=[{'name':_0x233a('0x33'),'field':_0x233a('0xd'),'foreignKey':_0x233a('0x34'),'model':_0x233a('0x35'),'filter':{'field':_0x233a('0x36'),'value':[_0x233a('0x37')]}},{'name':_0x233a('0x38'),'field':_0x233a('0xd'),'foreignKey':_0x233a('0x34'),'model':_0x233a('0x35'),'filter':{'field':_0x233a('0x36'),'value':['telephone']}},{'name':_0x233a('0x39'),'field':_0x233a('0xd'),'foreignKey':_0x233a('0x3a'),'model':_0x233a('0x3b'),'filter':{'field':'type','value':[_0x233a('0x3c')]}},{'name':_0x233a('0x3d'),'field':_0x233a('0xd'),'foreignKey':_0x233a('0x3a'),'model':'VoiceQueue','filter':{'field':_0x233a('0x12'),'value':[_0x233a('0x3e')]}}];break;case _0x233a('0x3f'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x40');break;case _0x233a('0x41'):_0xe5ae7a['childModel']=_0x233a('0x42');break;case _0x233a('0x43'):_0xe5ae7a[_0x233a('0x15')]='VoicePrefix';break;case'ivrcampaigns':_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x44');break;case _0x233a('0x45'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x46');break;case _0x233a('0x47'):_0xe5ae7a['childModel']=_0x233a('0x48');break;case _0x233a('0x49'):_0xe5ae7a[_0x233a('0x15')]='MailSubstatus';break;case _0x233a('0x4a'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x4b');break;case _0x233a('0x4c'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x4d');break;case'smsqueues':_0xe5ae7a[_0x233a('0x15')]='SmsQueue';break;case _0x233a('0x4e'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x4f');break;case'whatsappqueues':_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x50');break;case _0x233a('0x51'):_0xe5ae7a['childModel']=_0x233a('0x52');break;case _0x233a('0x53'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x54');break;case _0x233a('0x55'):case _0x233a('0x56'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x3b');if(_0x3469c0){_0xe5ae7a['parentSections']=[{'name':_0x233a('0x39')},{'name':'QueueCampaigns'}];}break;case _0x233a('0x57'):case _0x233a('0x58'):case _0x233a('0x59'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x35');if(_0x3469c0){_0xe5ae7a[_0x233a('0x1a')]=[{'name':_0x233a('0x5a'),'filter':{'field':'role','value':['admin','user']},'ignore':!![]},{'name':'Agents'},{'name':_0x233a('0x38')}];}break;case _0x233a('0x5b'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x5c');break;case'salesforceaccounts':_0xe5ae7a['childModel']=_0x233a('0x5d');break;case _0x233a('0x5e'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x5f');break;case _0x233a('0x60'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x61');break;case _0x233a('0x62'):_0xe5ae7a['childModel']='DeskAccount';break;case _0x233a('0x63'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x64');break;case _0x233a('0x65'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x35');break;case _0x233a('0x66'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x67');break;case _0x233a('0x68'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x69');break;case _0x233a('0x6a'):_0xe5ae7a['childModel']=_0x233a('0x6b');break;case _0x233a('0x6c'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x6d');break;case _0x233a('0x6e'):_0xe5ae7a['childModel']=_0x233a('0x6f');break;case'scheduler':_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x70');break;case _0x233a('0x71'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x72');break;case _0x233a('0x73'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x74');break;case _0x233a('0x75'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x76');break;case _0x233a('0x77'):_0xe5ae7a['childModel']=_0x233a('0x78');break;case _0x233a('0x79'):_0xe5ae7a[_0x233a('0x15')]='Trunk';break;case'variables':_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x7a');break;case'plugins':_0xe5ae7a['childModel']=_0x233a('0x7b');break;case _0x233a('0x7c'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x10');_0xe5ae7a[_0x233a('0x1a')]=[{'name':_0x233a('0x7d'),'field':'id','foreignKey':_0x233a('0x7e')}];break;case _0x233a('0x7f'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x80');break;}return _0xe5ae7a;}function _0x56dbfa(_0x5d1cf6,_0x5c933e){var _0x13417c=_0x5d1cf6['charAt'](0x0)[_0x233a('0x81')]()+_0x5d1cf6[_0x233a('0x82')](0x1);var _0x996b5c={'type':_0x140c3b[_0x233a('0x83')]['QueryTypes'][_0x233a('0x84')],'raw':!![]};return new Promise(function(_0x63677f,_0x13ea5d){var _0x4b773a=squel[_0x233a('0x85')]()['field'](_0x233a('0x86')+_0x13417c+_0x233a('0x87'),'id')['field']('ui.createdAt')[_0x233a('0x88')]('user_has_'+_0x5d1cf6+_0x233a('0x89'),'ui')[_0x233a('0x8a')](_0x233a('0x8b'),_0x5c933e['id']);return _0x140c3b[_0x233a('0x8c')]['query'](_0x4b773a[_0x233a('0x8d')](),_0x996b5c)[_0x233a('0x8')](function(_0x5322d8){_0x5c933e[_0x13417c+_0x233a('0x8e')]=_0x5322d8;_0x63677f(_0x5322d8);})[_0x233a('0xa')](function(_0x878853){_0x13ea5d(_0x878853);});});}return _0x2f1e3b[_0x233a('0x8f')](_0x233a('0x90'),attributes,{'tableName':_0x233a('0x91'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1e303d){var _0x3acdcf=require(_0x233a('0x92'));var _0x262b27={'raw':_0x1e303d[_0x233a('0x93')][_0x233a('0x94')],'where':{}};var _0x541bf2={};var _0x2d6810={'count':0x0,'rows':[]};var _0x494af4=_0x1e303d[_0x233a('0x93')][_0x233a('0x95')];var _0x4c6b48=_0x1e303d[_0x233a('0x93')][_0x233a('0x96')]||![];var _0x1ebcd6=_0x10480b(_0x494af4,_0x4c6b48);if(!_0x1ebcd6[_0x233a('0x15')])throw new Error('Invalid\x20section\x20\x27'+_0x494af4+'\x27');var _0x25b17e=[{'name':_0x494af4}];if(!_[_0x233a('0x97')](_0x1ebcd6[_0x233a('0x1a')]))_0x25b17e=_0x1ebcd6[_0x233a('0x1a')];var _0x31a6d0=[];for(var _0x48db0f=0x0;_0x48db0f<_0x25b17e[_0x233a('0x98')];_0x48db0f++){_0x31a6d0[_0x233a('0x99')](_0x140c3b[_0x233a('0x9a')][_0x233a('0x9b')]({'where':{'userProfileId':_0x1e303d[_0x233a('0x9c')]['id'],'name':_0x25b17e[_0x48db0f][_0x233a('0xd')]},'raw':!![]}));}return Promise[_0x233a('0x9d')](_0x31a6d0)[_0x233a('0x8')](function(_0x3942b6){var _0x21da9d=_['filter'](_0x3942b6,function(_0x51a733){return _0x51a733?_0x51a733:undefined;});var _0x529bc1=_[_0x233a('0x5')](_0x25b17e,['ignore',!![]]);var _0x1e1f18=_[_0x233a('0x97')](_0x21da9d)&&_[_0x233a('0x97')](_0x529bc1)?null:_[_0x233a('0x9e')](_0x529bc1,_0x21da9d);if(!_0x1e1f18)return null;var _0x3d42ab=[];for(var _0x40db4a=0x0;_0x40db4a<_0x1e1f18[_0x233a('0x98')];_0x40db4a++){var _0x4e43c2=_[_0x233a('0x9b')](_0x25b17e,function(_0x404d8e){return _0x1e1f18[_0x40db4a]?_0x404d8e[_0x233a('0xd')]===_0x1e1f18[_0x40db4a][_0x233a('0xd')]:null;});if(_0x4e43c2){if(_0x1e1f18[_0x40db4a][_0x233a('0x9f')]){_0x3d42ab[_0x233a('0x99')](_0x708b9f(_0x1ebcd6[_0x233a('0x15')],_0x1e1f18[_0x40db4a]));}else{if(!_0x1e1f18[_0x40db4a][_0x233a('0xa0')]){_0x3d42ab['push'](_0x3387fc(_0x4e43c2,_0x1e1f18[_0x40db4a],_0x1ebcd6[_0x233a('0x15')]));}else{if(_0x4e43c2[_0x233a('0xb')]){_0x3d42ab[_0x233a('0x99')](_0x174fef(_0x4e43c2,_0x1e1f18[_0x40db4a]));}}}}}return Promise['all'](_0x3d42ab);})[_0x233a('0x8')](function(_0x122b99){var _0x23d6fb=_0x122b99;var _0x41abdb=null;if(_0x23d6fb){_0x41abdb=_0x23d6fb[_0x233a('0x98')]===0x1?_0x23d6fb[0x0]:null;}if(!_0x41abdb&&!_0x23d6fb)return _0x2d6810;var _0x28cd76=_0x140c3b[_0x1ebcd6[_0x233a('0x15')]]['rawAttributes'];_0x541bf2[_0x233a('0xb')]=_[_0x233a('0xa1')](_0x28cd76);_0x541bf2[_0x233a('0x93')]=_['keys'](_0x1e303d[_0x233a('0x93')]);_0x541bf2['filters']=_[_0x233a('0xa2')](_0x541bf2[_0x233a('0xb')],_0x541bf2[_0x233a('0x93')]);_0x262b27[_0x233a('0xa3')]=_['intersection'](_0x541bf2[_0x233a('0xb')],_0x3acdcf[_0x233a('0xa4')](_0x1e303d[_0x233a('0x93')]['fields']));_0x262b27[_0x233a('0xa3')]=_0x262b27[_0x233a('0xa3')][_0x233a('0x98')]?_0x262b27[_0x233a('0xa3')]:_0x541bf2[_0x233a('0xb')];if(!_0x1e303d[_0x233a('0x93')][_0x233a('0xa5')](_0x233a('0xa6'))){_0x262b27['limit']=_0x3acdcf[_0x233a('0xa7')](_0x1e303d['query'][_0x233a('0xa7')]);_0x262b27[_0x233a('0xa8')]=_0x3acdcf[_0x233a('0xa8')](_0x1e303d[_0x233a('0x93')][_0x233a('0xa8')]);}_0x262b27['order']=_0x3acdcf[_0x233a('0xa9')](_0x1e303d[_0x233a('0x93')][_0x233a('0xa9')]);_0x262b27[_0x233a('0x8a')]=_0x3acdcf[_0x233a('0xaa')](_[_0x233a('0xab')](_0x1e303d[_0x233a('0x93')],_0x541bf2[_0x233a('0xaa')]));if(_0x1e303d['query'][_0x233a('0x5')]){_0x262b27['where']=_[_0x233a('0xac')](_0x262b27[_0x233a('0x8a')],{'$or':_[_0x233a('0xc')](_0x28cd76,function(_0x329266){if(_0x329266[_0x233a('0x12')][_0x233a('0xad')]!==_0x233a('0xae')){var _0x65c67e={};_0x65c67e[_0x329266[_0x233a('0x6')]]={'$like':'%'+_0x1e303d[_0x233a('0x93')][_0x233a('0x5')]+'%'};return _0x65c67e;}})});}var _0x5c53dd=[];var _0x177a64=null;var _0x2d53fa={};if(_0x41abdb){_0x177a64=_[_0x233a('0x9b')](_0x25b17e,['name',_0x41abdb[_0x233a('0xd')]]);if(_0x177a64[_0x233a('0x6')]){_0x2d53fa={};if(_0x1ebcd6['childModel']===_0x233a('0x10')){_0x2d53fa[_0x177a64['foreignKey']]=_[_0x233a('0xc')](_0x41abdb[_0x233a('0x9')],'id');}else{_0x2d53fa[_0x177a64['foreignKey']]=_0x41abdb[_0x233a('0x9')];}_0x5c53dd[_0x233a('0x99')](_0x2d53fa);}else{_0x262b27[_0x233a('0x8a')]['id']=_0x41abdb['associatedResources'];}}else{for(var _0x317430=0x0;_0x317430<_0x23d6fb[_0x233a('0x98')];_0x317430++){_0x177a64=_[_0x233a('0x9b')](_0x25b17e,[_0x233a('0xd'),_0x23d6fb[_0x317430][_0x233a('0xd')]]);if(_0x177a64[_0x233a('0x6')]){_0x2d53fa={};_0x2d53fa[_0x177a64[_0x233a('0xaf')]]=_0x23d6fb[_0x317430][_0x233a('0x9')];_0x5c53dd['push'](_0x2d53fa);}else{if(!_0x262b27[_0x233a('0x8a')]['id'])_0x262b27[_0x233a('0x8a')]['id']=[];_0x23d6fb[_0x317430][_0x233a('0x9')][_0x233a('0xb0')](function(_0x2609be){_0x262b27['where']['id'][_0x233a('0x99')](_0x2609be);});}}}if(!_['isEmpty'](_0x5c53dd)){_0x262b27[_0x233a('0x8a')]=_['merge'](_0x262b27['where'],{'$and':{'$or':_0x5c53dd}});}_0x262b27=_['merge']({},_0x262b27,_0x1e303d[_0x233a('0xb1')]);if(_0x41abdb&&!_0x41abdb['autoAssociation']&&_0x1ebcd6[_0x233a('0x15')]===_0x233a('0x10')){if(_0x1e303d[_0x233a('0x93')][_0x233a('0xb2')]){_0x262b27[_0x233a('0xb3')]=[{'all':!![]}];}return _0x140c3b[_0x1ebcd6[_0x233a('0x15')]]['findAll'](_0x262b27)[_0x233a('0x8')](function(_0x217d74){var _0x427568=[];_0x217d74[_0x233a('0xb0')](function(_0x3e63d9){var _0x4bf503;switch(_0x3e63d9[_0x233a('0xb4')]){case _0x233a('0xb5'):_0x4bf503=_[_0x233a('0x9b')](_0x41abdb[_0x233a('0x9')],function(_0x2be2f7){return _0x2be2f7['id']===_0x3e63d9[_0x233a('0x7e')]&&_0x2be2f7[_0x233a('0x12')]===_0x233a('0xb6');});break;case _0x233a('0xb7'):_0x4bf503=_[_0x233a('0x9b')](_0x41abdb[_0x233a('0x9')],function(_0x300787){return _0x300787['id']===_0x3e63d9[_0x233a('0x7e')]&&_0x300787['type']===_0x233a('0xb8');});break;}if(_0x4bf503)_0x427568[_0x233a('0x99')](_0x3e63d9);});_0x2d6810[_0x233a('0xb9')]=_0x427568['length'];_0x2d6810[_0x233a('0xba')]=_0x427568;return _0x2d6810;});}else{if(!_[_0x233a('0x97')](_0x1e303d[_0x233a('0x93')][_0x233a('0xbb')])){_0x262b27[_0x233a('0x8a')]['id']=_0x262b27[_0x233a('0x8a')]['id']?_[_0x233a('0xa2')](_0x262b27['where']['id'],_0x1e303d[_0x233a('0x93')][_0x233a('0xbb')]):_0x1e303d[_0x233a('0x93')][_0x233a('0xbb')];if(_0x1e303d[_0x233a('0x93')][_0x233a('0xbc')]){_0x262b27[_0x233a('0xbd')]=_0x1e303d[_0x233a('0x93')][_0x233a('0xbc')];}}if(_0x1e303d[_0x233a('0x93')][_0x233a('0xbe')]){_0x262b27[_0x233a('0x8a')]=_[_0x233a('0xac')](_0x262b27['where'],{'$and':_0x1e303d[_0x233a('0x93')][_0x233a('0xbe')]});}return _0x140c3b[_0x1ebcd6['childModel']][_0x233a('0xb9')]({'where':_0x262b27['where']})[_0x233a('0x8')](function(_0x298d30){_0x2d6810[_0x233a('0xb9')]=_0x298d30;if(_0x1e303d[_0x233a('0x93')][_0x233a('0xb2')]){if(_0x1ebcd6['childModel']===_0x233a('0x1e')){_0x262b27[_0x233a('0xb3')]=[{'model':_0x140c3b['Tag'],'as':_0x233a('0xbf'),'attributes':['id',_0x233a('0xd'),_0x233a('0xc0')],'required':_0x1e303d['query'][_0x233a('0xc1')]?!![]:![]},{'model':_0x140c3b[_0x233a('0x74')],'as':_0x233a('0xc2'),'attributes':['id',_0x233a('0xd'),_0x233a('0xc0')],'through':_0x1e303d[_0x233a('0x93')][_0x233a('0xc1')]?{'attributes':[],'where':{'TagId':_0x1e303d[_0x233a('0x93')][_0x233a('0xc1')]||undefined}}:{},'required':_0x1e303d['query'][_0x233a('0xc1')]?!![]:![]}];}else{_0x262b27[_0x233a('0xb3')]=[{'all':!![]}];}}return _0x140c3b[_0x1ebcd6[_0x233a('0x15')]][_0x233a('0xf')](_0x262b27);})[_0x233a('0x8')](function(_0x27949f){_0x2d6810[_0x233a('0xba')]=_0x27949f;if(_0x494af4===_0x233a('0x33')&&_0x1e303d[_0x233a('0x93')][_0x233a('0xc3')]===_0x233a('0xc4')){var _0x4d56c8=[];for(var _0x3c75b6=0x0;_0x3c75b6<_0x2d6810[_0x233a('0xba')][_0x233a('0x98')];_0x3c75b6++){_0x4d56c8[_0x233a('0x99')](_0x56dbfa(_0x233a('0xc5'),_0x2d6810['rows'][_0x3c75b6][_0x233a('0xc6')]));_0x4d56c8[_0x233a('0x99')](_0x56dbfa(_0x233a('0xc7'),_0x2d6810['rows'][_0x3c75b6]['dataValues']));_0x4d56c8[_0x233a('0x99')](_0x56dbfa(_0x233a('0xc8'),_0x2d6810[_0x233a('0xba')][_0x3c75b6][_0x233a('0xc6')]));_0x4d56c8[_0x233a('0x99')](_0x56dbfa(_0x233a('0xc9'),_0x2d6810[_0x233a('0xba')][_0x3c75b6][_0x233a('0xc6')]));_0x4d56c8[_0x233a('0x99')](_0x56dbfa(_0x233a('0xca'),_0x2d6810[_0x233a('0xba')][_0x3c75b6][_0x233a('0xc6')]));_0x4d56c8[_0x233a('0x99')](_0x56dbfa(_0x233a('0xcb'),_0x2d6810['rows'][_0x3c75b6][_0x233a('0xc6')]));}return Promise[_0x233a('0x9d')](_0x4d56c8)[_0x233a('0x8')](function(){return _0x2d6810;});}return _0x2d6810;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index cc24153..11e39d9 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 _0x980e=['request\x20sent','result','lodash','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','redis','defaults','localhost','socket.io-emitter','register','request','then','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','UserProfile,\x20%s,\x20%s','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x980e,0x1a6));var _0xe980=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x980e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe980('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe980('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe980('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe980('0x3'));var logger=require(_0xe980('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe980('0x5'));var client=jayson['client']['http']({'port':0x232a});config[_0xe980('0x6')]=_[_0xe980('0x7')](config[_0xe980('0x6')],{'host':_0xe980('0x8'),'port':0x18eb});var socket=require(_0xe980('0x9'))(new Redis(config[_0xe980('0x6')]));require('./userProfile.socket')[_0xe980('0xa')](socket);function respondWithRpcPromise(_0x3c5091,_0x323b26,_0x543cb9){return new BPromise(function(_0xc7944f,_0x43718a){return client[_0xe980('0xb')](_0x3c5091,_0x543cb9)[_0xe980('0xc')](function(_0x161409){logger['info']('UserProfile,\x20%s,\x20%s',_0x323b26,'request\x20sent');logger[_0xe980('0xd')](_0xe980('0xe'),_0x323b26,'request\x20sent',JSON['stringify'](_0x161409));if(_0x161409[_0xe980('0xf')]){if(_0x161409[_0xe980('0xf')][_0xe980('0x10')]===0x1f4){logger[_0xe980('0xf')](_0xe980('0x11'),_0x323b26,_0x161409[_0xe980('0xf')][_0xe980('0x12')]);return _0x43718a(_0x161409['error']['message']);}logger['error'](_0xe980('0x11'),_0x323b26,_0x161409[_0xe980('0xf')][_0xe980('0x12')]);return _0xc7944f(_0x161409[_0xe980('0xf')][_0xe980('0x12')]);}else{logger['info'](_0xe980('0x11'),_0x323b26,_0xe980('0x13'));_0xc7944f(_0x161409[_0xe980('0x14')]['message']);}})['catch'](function(_0xa49ed0){logger[_0xe980('0xf')](_0xe980('0x11'),_0x323b26,_0xa49ed0);_0x43718a(_0xa49ed0);});});} \ No newline at end of file +var _0x36c3=['defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x1e2096,_0x1fba06){var _0x181f01=function(_0x39f0d9){while(--_0x39f0d9){_0x1e2096['push'](_0x1e2096['shift']());}};_0x181f01(++_0x1fba06);}(_0x36c3,0x1a6));var _0x336c=function(_0x3e25c1,_0x1d15f9){_0x3e25c1=_0x3e25c1-0x0;var _0x52e7f2=_0x36c3[_0x3e25c1];return _0x52e7f2;};'use strict';var _=require(_0x336c('0x0'));var util=require(_0x336c('0x1'));var moment=require('moment');var BPromise=require(_0x336c('0x2'));var rs=require(_0x336c('0x3'));var fs=require('fs');var Redis=require(_0x336c('0x4'));var db=require(_0x336c('0x5'))['db'];var utils=require(_0x336c('0x6'));var logger=require(_0x336c('0x7'))(_0x336c('0x8'));var config=require('../../config/environment');var jayson=require(_0x336c('0x9'));var client=jayson[_0x336c('0xa')][_0x336c('0xb')]({'port':0x232a});config[_0x336c('0xc')]=_[_0x336c('0xd')](config['redis'],{'host':_0x336c('0xe'),'port':0x18eb});var socket=require(_0x336c('0xf'))(new Redis(config[_0x336c('0xc')]));require(_0x336c('0x10'))[_0x336c('0x11')](socket);function respondWithRpcPromise(_0x243984,_0x33ced0,_0x1a4503){return new BPromise(function(_0x179247,_0x31cee7){return client[_0x336c('0x12')](_0x243984,_0x1a4503)[_0x336c('0x13')](function(_0x1d896b){logger[_0x336c('0x14')](_0x336c('0x15'),_0x33ced0,_0x336c('0x16'));logger[_0x336c('0x17')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x33ced0,'request\x20sent',JSON[_0x336c('0x18')](_0x1d896b));if(_0x1d896b['error']){if(_0x1d896b[_0x336c('0x19')][_0x336c('0x1a')]===0x1f4){logger[_0x336c('0x19')](_0x336c('0x15'),_0x33ced0,_0x1d896b['error'][_0x336c('0x1b')]);return _0x31cee7(_0x1d896b[_0x336c('0x19')]['message']);}logger[_0x336c('0x19')]('UserProfile,\x20%s,\x20%s',_0x33ced0,_0x1d896b[_0x336c('0x19')]['message']);return _0x179247(_0x1d896b[_0x336c('0x19')]['message']);}else{logger[_0x336c('0x14')](_0x336c('0x15'),_0x33ced0,'request\x20sent');_0x179247(_0x1d896b['result'][_0x336c('0x1b')]);}})[_0x336c('0x1c')](function(_0x1d306c){logger[_0x336c('0x19')](_0x336c('0x15'),_0x33ced0,_0x1d306c);_0x31cee7(_0x1d306c);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 29d2a89..d536779 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 _0xb326=['userProfile:','./userProfile.events','save','remove','update','emit','register','length'];(function(_0x44310b,_0x97d7d3){var _0x1428b2=function(_0x215f40){while(--_0x215f40){_0x44310b['push'](_0x44310b['shift']());}};_0x1428b2(++_0x97d7d3);}(_0xb326,0x109));var _0x6b32=function(_0x599cf8,_0x48f1cb){_0x599cf8=_0x599cf8-0x0;var _0x209458=_0xb326[_0x599cf8];return _0x209458;};'use strict';var UserProfileEvents=require(_0x6b32('0x0'));var events=[_0x6b32('0x1'),_0x6b32('0x2'),_0x6b32('0x3')];function createListener(_0x1fd3a2,_0x2d4b98){return function(_0x136845){_0x2d4b98[_0x6b32('0x4')](_0x1fd3a2,_0x136845);};}function removeListener(_0x4149e7,_0x36b5fb){return function(){UserProfileEvents['removeListener'](_0x4149e7,_0x36b5fb);};}exports[_0x6b32('0x5')]=function(_0x4e995d){for(var _0x58d14e=0x0,_0x29663e=events[_0x6b32('0x6')];_0x58d14e<_0x29663e;_0x58d14e++){var _0x55ef3e=events[_0x58d14e];var _0x3deb94=createListener(_0x6b32('0x7')+_0x55ef3e,_0x4e995d);UserProfileEvents['on'](_0x55ef3e,_0x3deb94);}}; \ No newline at end of file +var _0x1882=['length','save','remove','update','emit','register'];(function(_0x22dd78,_0x21c5d7){var _0x282002=function(_0x2dbb9c){while(--_0x2dbb9c){_0x22dd78['push'](_0x22dd78['shift']());}};_0x282002(++_0x21c5d7);}(_0x1882,0x1a5));var _0x2188=function(_0x39ea44,_0x5e8297){_0x39ea44=_0x39ea44-0x0;var _0x23b5cb=_0x1882[_0x39ea44];return _0x23b5cb;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x2188('0x0'),_0x2188('0x1'),_0x2188('0x2')];function createListener(_0x429f6a,_0x10d621){return function(_0x3314ea){_0x10d621[_0x2188('0x3')](_0x429f6a,_0x3314ea);};}function removeListener(_0x1234f2,_0x143358){return function(){UserProfileEvents['removeListener'](_0x1234f2,_0x143358);};}exports[_0x2188('0x4')]=function(_0xfa2496){for(var _0x3cb593=0x0,_0x23d45a=events[_0x2188('0x5')];_0x3cb593<_0x23d45a;_0x3cb593++){var _0xa84004=events[_0x3cb593];var _0x1103af=createListener('userProfile:'+_0xa84004,_0xfa2496);UserProfileEvents['on'](_0xa84004,_0x1103af);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 1257140..55625e8 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 _0xfee8=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','delete','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x84a064,_0xbaa32e){var _0x104d6f=function(_0x32c121){while(--_0x32c121){_0x84a064['push'](_0x84a064['shift']());}};_0x104d6f(++_0xbaa32e);}(_0xfee8,0x174));var _0x8fee=function(_0x585133,_0x2412a1){_0x585133=_0x585133-0x0;var _0x18254a=_0xfee8[_0x585133];return _0x18254a;};'use strict';var multer=require(_0x8fee('0x0'));var util=require('util');var path=require(_0x8fee('0x1'));var timeout=require(_0x8fee('0x2'));var express=require(_0x8fee('0x3'));var router=express[_0x8fee('0x4')]();var fs_extra=require(_0x8fee('0x5'));var auth=require(_0x8fee('0x6'));var interaction=require(_0x8fee('0x7'));var config=require(_0x8fee('0x8'));var controller=require(_0x8fee('0x9'));router[_0x8fee('0xa')]('/',auth[_0x8fee('0xb')](),controller[_0x8fee('0xc')]);router[_0x8fee('0xa')]('/describe',auth[_0x8fee('0xb')](),controller[_0x8fee('0xd')]);router['get'](_0x8fee('0xe'),auth[_0x8fee('0xb')](),controller[_0x8fee('0xf')]);router[_0x8fee('0x10')]('/',auth['isAuthenticated'](),controller[_0x8fee('0x11')]);router[_0x8fee('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x8fee('0x13')](_0x8fee('0xe'),auth[_0x8fee('0xb')](),controller['destroy']);module[_0x8fee('0x14')]=router; \ No newline at end of file +var _0x2410=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','/describe','describe','/:id','create','update','delete','destroy','exports','multer','util'];(function(_0x2a8292,_0x173125){var _0x575fa1=function(_0x49f0fc){while(--_0x49f0fc){_0x2a8292['push'](_0x2a8292['shift']());}};_0x575fa1(++_0x173125);}(_0x2410,0x11e));var _0x0241=function(_0x3a2bce,_0x1d45ab){_0x3a2bce=_0x3a2bce-0x0;var _0x27d397=_0x2410[_0x3a2bce];return _0x27d397;};'use strict';var multer=require(_0x0241('0x0'));var util=require(_0x0241('0x1'));var path=require('path');var timeout=require(_0x0241('0x2'));var express=require('express');var router=express[_0x0241('0x3')]();var fs_extra=require(_0x0241('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0241('0x5'));var config=require(_0x0241('0x6'));var controller=require(_0x0241('0x7'));router[_0x0241('0x8')]('/',auth[_0x0241('0x9')](),controller['index']);router[_0x0241('0x8')](_0x0241('0xa'),auth['isAuthenticated'](),controller[_0x0241('0xb')]);router[_0x0241('0x8')](_0x0241('0xc'),auth[_0x0241('0x9')](),controller['show']);router['post']('/',auth[_0x0241('0x9')](),controller[_0x0241('0xd')]);router['put'](_0x0241('0xc'),auth['isAuthenticated'](),controller[_0x0241('0xe')]);router[_0x0241('0xf')](_0x0241('0xc'),auth[_0x0241('0x9')](),controller[_0x0241('0x10')]);module[_0x0241('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index f41b871..f1a0954 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 _0xbb44=['exports','STRING','INTEGER'];(function(_0x34c553,_0x3e7dfc){var _0x1357d2=function(_0x3b509f){while(--_0x3b509f){_0x34c553['push'](_0x34c553['shift']());}};_0x1357d2(++_0x3e7dfc);}(_0xbb44,0x12c));var _0x4bb4=function(_0x2907bd,_0x2cc752){_0x2907bd=_0x2907bd-0x0;var _0x428652=_0xbb44[_0x2907bd];return _0x428652;};'use strict';var Sequelize=require('sequelize');module[_0x4bb4('0x0')]={'name':{'type':Sequelize[_0x4bb4('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x4bb4('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4bb4('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xfe25=['sequelize','exports','STRING','INTEGER'];(function(_0x34482d,_0x2c1abb){var _0x2b8095=function(_0x107d61){while(--_0x107d61){_0x34482d['push'](_0x34482d['shift']());}};_0x2b8095(++_0x2c1abb);}(_0xfe25,0x1a8));var _0x5fe2=function(_0xd6b9b,_0x2a01f6){_0xd6b9b=_0xd6b9b-0x0;var _0x5bd427=_0xfe25[_0xd6b9b];return _0x5bd427;};'use strict';var Sequelize=require(_0x5fe2('0x0'));module[_0x5fe2('0x1')]={'name':{'type':Sequelize[_0x5fe2('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x5fe2('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 36e72d6..1d3915d 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 _0xdb28=['index','UserProfileResource','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send'];(function(_0x30b01e,_0x1184cb){var _0x196f32=function(_0x2939ba){while(--_0x2939ba){_0x30b01e['push'](_0x30b01e['shift']());}};_0x196f32(++_0x1184cb);}(_0xdb28,0x106));var _0x8db2=function(_0x5a667d,_0x46367e){_0x5a667d=_0x5a667d-0x0;var _0xe88493=_0xdb28[_0x5a667d];return _0xe88493;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'all':!![]}];}return db[_0x8db2('0x2b')][_0x8db2('0x40')](_0x21bae5);})['then'](function(_0x49a7ae){_0x3124d5[_0x8db2('0x41')]=_0x49a7ae;return _0x3124d5;})['then'](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x42')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x43')]=function(_0x313130,_0x307783){var _0xb4fe2c={'raw':![],'where':{'id':_0x313130[_0x8db2('0x44')]['id']}},_0x30d606={};_0x30d606['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x45')]);_0x30d606[_0x8db2('0x30')]=_['keys'](_0x313130[_0x8db2('0x30')]);_0x30d606[_0x8db2('0x39')]=_[_0x8db2('0x46')](_0x30d606[_0x8db2('0x32')],_0x30d606['query']);_0xb4fe2c[_0x8db2('0x34')]=_['intersection'](_0x30d606[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x313130[_0x8db2('0x30')]['fields']));_0xb4fe2c['attributes']=_0xb4fe2c[_0x8db2('0x34')]['length']?_0xb4fe2c[_0x8db2('0x34')]:_0x30d606[_0x8db2('0x32')];if(_0x313130[_0x8db2('0x30')][_0x8db2('0x3f')]){_0xb4fe2c[_0x8db2('0x47')]=[{'all':!![]}];}_0xb4fe2c=_[_0x8db2('0x3d')]({},_0xb4fe2c,_0x313130[_0x8db2('0x3e')]);return db[_0x8db2('0x2b')][_0x8db2('0x48')](_0xb4fe2c)[_0x8db2('0x24')](handleEntityNotFound(_0x307783,null))[_0x8db2('0x24')](respondWithResult(_0x307783,null))[_0x8db2('0x42')](handleError(_0x307783,null));};exports['create']=function(_0x449109,_0x2ada52){return db[_0x8db2('0x2b')][_0x8db2('0x49')](_0x449109['body'],{})['then'](respondWithResult(_0x2ada52,0xc9))[_0x8db2('0x42')](handleError(_0x2ada52,null));};exports[_0x8db2('0x23')]=function(_0x164020,_0x4c66e5){if(_0x164020['body']['id']){delete _0x164020['body']['id'];}return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x164020[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x4c66e5,null))[_0x8db2('0x24')](saveUpdates(_0x164020[_0x8db2('0x4a')],null))[_0x8db2('0x24')](respondWithResult(_0x4c66e5,null))['catch'](handleError(_0x4c66e5,null));};exports['destroy']=function(_0x3d29bc,_0x18c6ef){return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x3d29bc[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x18c6ef,null))[_0x8db2('0x24')](removeEntity(_0x18c6ef,null))[_0x8db2('0x42')](handleError(_0x18c6ef,null));};exports[_0x8db2('0x4b')]=function(_0x426ae0,_0x3bc632){return db[_0x8db2('0x2b')][_0x8db2('0x4b')]()[_0x8db2('0x24')](respondWithResult(_0x3bc632,null))[_0x8db2('0x42')](handleError(_0x3bc632,null));}; \ No newline at end of file +var _0x7096=['Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','UserProfileResource','find','catch','create','body','describe','rimraf','fast-json-patch','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set'];(function(_0x315e19,_0x36bfc3){var _0x439799=function(_0x1332f2){while(--_0x1332f2){_0x315e19['push'](_0x315e19['shift']());}};_0x439799(++_0x36bfc3);}(_0x7096,0x10c));var _0x6709=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x7096[_0x2dea24];return _0x309d58;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6709('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6709('0x1'));var rp=require('request-promise');var moment=require(_0x6709('0x2'));var BPromise=require(_0x6709('0x3'));var Mustache=require(_0x6709('0x4'));var util=require(_0x6709('0x5'));var path=require(_0x6709('0x6'));var sox=require(_0x6709('0x7'));var csv=require(_0x6709('0x8'));var ejs=require(_0x6709('0x9'));var fs=require('fs');var fs_extra=require(_0x6709('0xa'));var _=require(_0x6709('0xb'));var squel=require(_0x6709('0xc'));var crypto=require(_0x6709('0xd'));var jsforce=require(_0x6709('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6709('0xf'));var Papa=require(_0x6709('0x10'));var Redis=require(_0x6709('0x11'));var authService=require(_0x6709('0x12'));var qs=require(_0x6709('0x13'));var as=require(_0x6709('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6709('0x15'));var utils=require(_0x6709('0x16'));var config=require(_0x6709('0x17'));var licenseUtil=require(_0x6709('0x18'));var db=require(_0x6709('0x19'))['db'];function respondWithStatusCode(_0x288f51,_0x1d56a5){_0x1d56a5=_0x1d56a5||0xcc;return function(_0x1ac547){if(_0x1ac547){return _0x288f51['sendStatus'](_0x1d56a5);}return _0x288f51[_0x6709('0x1a')](_0x1d56a5)[_0x6709('0x1b')]();};}function respondWithResult(_0x4d5255,_0x3706e1){_0x3706e1=_0x3706e1||0xc8;return function(_0x4e4587){if(_0x4e4587){return _0x4d5255[_0x6709('0x1a')](_0x3706e1)['json'](_0x4e4587);}};}function respondWithFilteredResult(_0x41af1f,_0x4bc059){return function(_0x149233){if(_0x149233){var _0x28866a=typeof _0x4bc059[_0x6709('0x1c')]===_0x6709('0x1d')&&typeof _0x4bc059['limit']==='undefined';var _0x5c4f94=_0x149233[_0x6709('0x1e')];var _0x235a54=_0x28866a?0x0:_0x4bc059['offset'];var _0x9c1fd8=_0x28866a?_0x149233[_0x6709('0x1e')]:_0x4bc059[_0x6709('0x1c')]+_0x4bc059['limit'];var _0x13cf04;if(_0x9c1fd8>=_0x5c4f94){_0x9c1fd8=_0x5c4f94;_0x13cf04=0xc8;}else{_0x13cf04=0xce;}_0x41af1f[_0x6709('0x1a')](_0x13cf04);return _0x41af1f[_0x6709('0x1f')](_0x6709('0x20'),_0x235a54+'-'+_0x9c1fd8+'/'+_0x5c4f94)['json'](_0x149233);}return null;};}function patchUpdates(_0x3c4971){return function(_0x1edac3){try{jsonpatch[_0x6709('0x21')](_0x1edac3,_0x3c4971,!![]);}catch(_0x3cf882){return BPromise[_0x6709('0x22')](_0x3cf882);}return _0x1edac3[_0x6709('0x23')]();};}function saveUpdates(_0x45921e,_0x17763d){return function(_0x386224){if(_0x386224){return _0x386224[_0x6709('0x24')](_0x45921e)[_0x6709('0x25')](function(_0xa36371){return _0xa36371;});}return null;};}function removeEntity(_0x5cf48b,_0x29f25f){return function(_0x81138e){if(_0x81138e){return _0x81138e[_0x6709('0x26')]()['then'](function(){_0x5cf48b[_0x6709('0x1a')](0xcc)[_0x6709('0x1b')]();});}};}function handleEntityNotFound(_0x20a347,_0x44b465){return function(_0x588e00){if(!_0x588e00){_0x20a347[_0x6709('0x27')](0x194);}return _0x588e00;};}function handleError(_0x3076fe,_0x50f7d6){_0x50f7d6=_0x50f7d6||0x1f4;return function(_0x585073){logger[_0x6709('0x28')](_0x585073['stack']);if(_0x585073[_0x6709('0x29')]){delete _0x585073[_0x6709('0x29')];}_0x3076fe['status'](_0x50f7d6)[_0x6709('0x2a')](_0x585073);};}exports['index']=function(_0x46a325,_0x3cd555){var _0x5b6906={},_0x137137={},_0x4e6989={'count':0x0,'rows':[]};var _0xe066d8=_[_0x6709('0x2b')](db['UserProfileResource'][_0x6709('0x2c')],function(_0x5deff5){return{'name':_0x5deff5[_0x6709('0x2d')],'type':_0x5deff5[_0x6709('0x2e')]['key']};});_0x137137['model']=_[_0x6709('0x2b')](_0xe066d8,_0x6709('0x29'));_0x137137[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x46a325[_0x6709('0x2f')]);_0x137137[_0x6709('0x31')]=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],_0x137137[_0x6709('0x2f')]);_0x5b6906['attributes']=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],qs[_0x6709('0x34')](_0x46a325[_0x6709('0x2f')]['fields']));_0x5b6906[_0x6709('0x35')]=_0x5b6906[_0x6709('0x35')][_0x6709('0x36')]?_0x5b6906[_0x6709('0x35')]:_0x137137['model'];if(!_0x46a325[_0x6709('0x2f')][_0x6709('0x37')]('nolimit')){_0x5b6906[_0x6709('0x38')]=qs[_0x6709('0x38')](_0x46a325['query'][_0x6709('0x38')]);_0x5b6906[_0x6709('0x1c')]=qs[_0x6709('0x1c')](_0x46a325[_0x6709('0x2f')][_0x6709('0x1c')]);}_0x5b6906[_0x6709('0x39')]=qs[_0x6709('0x3a')](_0x46a325['query'][_0x6709('0x3a')]);_0x5b6906[_0x6709('0x3b')]=qs['filters'](_[_0x6709('0x3c')](_0x46a325[_0x6709('0x2f')],_0x137137[_0x6709('0x31')]),_0xe066d8);if(_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]){_0x5b6906[_0x6709('0x3b')]=_['merge'](_0x5b6906[_0x6709('0x3b')],{'$or':_['map'](_0xe066d8,function(_0x31e05a){if(_0x31e05a[_0x6709('0x2e')]!==_0x6709('0x3e')){var _0x48492f={};_0x48492f[_0x31e05a[_0x6709('0x29')]]={'$like':'%'+_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]+'%'};return _0x48492f;}})});}_0x5b6906=_[_0x6709('0x3f')]({},_0x5b6906,_0x46a325[_0x6709('0x40')]);var _0x1030ee={'where':_0x5b6906[_0x6709('0x3b')]};return db['UserProfileResource'][_0x6709('0x1e')](_0x1030ee)[_0x6709('0x25')](function(_0x50fbcd){_0x4e6989[_0x6709('0x1e')]=_0x50fbcd;if(_0x46a325[_0x6709('0x2f')][_0x6709('0x41')]){_0x5b6906[_0x6709('0x42')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x5b6906);})[_0x6709('0x25')](function(_0x3f0da1){_0x4e6989[_0x6709('0x43')]=_0x3f0da1;return _0x4e6989;})[_0x6709('0x25')](respondWithFilteredResult(_0x3cd555,_0x5b6906))['catch'](handleError(_0x3cd555,null));};exports['show']=function(_0x5af1fb,_0x3d4237){var _0x293577={'raw':![],'where':{'id':_0x5af1fb[_0x6709('0x44')]['id']}},_0x54f74e={};_0x54f74e[_0x6709('0x33')]=_['keys'](db['UserProfileResource'][_0x6709('0x2c')]);_0x54f74e[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x5af1fb[_0x6709('0x2f')]);_0x54f74e[_0x6709('0x31')]=_['intersection'](_0x54f74e[_0x6709('0x33')],_0x54f74e['query']);_0x293577[_0x6709('0x35')]=_[_0x6709('0x32')](_0x54f74e[_0x6709('0x33')],qs['fields'](_0x5af1fb[_0x6709('0x2f')]['fields']));_0x293577['attributes']=_0x293577[_0x6709('0x35')][_0x6709('0x36')]?_0x293577[_0x6709('0x35')]:_0x54f74e[_0x6709('0x33')];if(_0x5af1fb[_0x6709('0x2f')][_0x6709('0x41')]){_0x293577[_0x6709('0x42')]=[{'all':!![]}];}_0x293577=_[_0x6709('0x3f')]({},_0x293577,_0x5af1fb[_0x6709('0x40')]);return db[_0x6709('0x45')][_0x6709('0x46')](_0x293577)[_0x6709('0x25')](handleEntityNotFound(_0x3d4237,null))[_0x6709('0x25')](respondWithResult(_0x3d4237,null))[_0x6709('0x47')](handleError(_0x3d4237,null));};exports[_0x6709('0x48')]=function(_0x4f82a0,_0xfbb810){return db['UserProfileResource']['create'](_0x4f82a0[_0x6709('0x49')],{})[_0x6709('0x25')](respondWithResult(_0xfbb810,0xc9))[_0x6709('0x47')](handleError(_0xfbb810,null));};exports[_0x6709('0x24')]=function(_0x22363b,_0x2b05dc){if(_0x22363b[_0x6709('0x49')]['id']){delete _0x22363b[_0x6709('0x49')]['id'];}return db['UserProfileResource'][_0x6709('0x46')]({'where':{'id':_0x22363b[_0x6709('0x44')]['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2b05dc,null))[_0x6709('0x25')](saveUpdates(_0x22363b['body'],null))[_0x6709('0x25')](respondWithResult(_0x2b05dc,null))['catch'](handleError(_0x2b05dc,null));};exports[_0x6709('0x26')]=function(_0x34a950,_0x2a563b){return db[_0x6709('0x45')][_0x6709('0x46')]({'where':{'id':_0x34a950['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2a563b,null))[_0x6709('0x25')](removeEntity(_0x2a563b,null))[_0x6709('0x47')](handleError(_0x2a563b,null));};exports[_0x6709('0x4a')]=function(_0x1015e0,_0x55188c){return db['UserProfileResource'][_0x6709('0x4a')]()['then'](respondWithResult(_0x55188c,null))['catch'](handleError(_0x55188c,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index e1e7a6c..3f5b1be 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 _0xc2d1=['api','moment','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','resourceId','lodash','../../config/logger'];(function(_0x5e709a,_0x1d7975){var _0x57401a=function(_0x27eab5){while(--_0x27eab5){_0x5e709a['push'](_0x5e709a['shift']());}};_0x57401a(++_0x1d7975);}(_0xc2d1,0x174));var _0x1c2d=function(_0x5c2ad1,_0x171ef5){_0x5c2ad1=_0x5c2ad1-0x0;var _0x32328a=_0xc2d1[_0x5c2ad1];return _0x32328a;};'use strict';var _=require(_0x1c2d('0x0'));var util=require('util');var logger=require(_0x1c2d('0x1'))(_0x1c2d('0x2'));var moment=require(_0x1c2d('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(_0x1c2d('0x4'));var attributes=require(_0x1c2d('0x5'));module[_0x1c2d('0x6')]=function(_0x35a99e,_0x224e23){return _0x35a99e[_0x1c2d('0x7')](_0x1c2d('0x8'),attributes,{'tableName':_0x1c2d('0x9'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x1c2d('0xa'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8fe0=['bluebird','rimraf','./userProfileResource.attributes','UserProfileResource','resourceId','lodash','util','../../config/logger','moment'];(function(_0x5ae8f1,_0x58098e){var _0x4ac982=function(_0x469656){while(--_0x469656){_0x5ae8f1['push'](_0x5ae8f1['shift']());}};_0x4ac982(++_0x58098e);}(_0x8fe0,0xcb));var _0x08fe=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8fe0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x08fe('0x0'));var util=require(_0x08fe('0x1'));var logger=require(_0x08fe('0x2'))('api');var moment=require(_0x08fe('0x3'));var BPromise=require(_0x08fe('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x08fe('0x5'));var config=require('../../config/environment');var attributes=require(_0x08fe('0x6'));module['exports']=function(_0x2c4761,_0x508a6f){return _0x2c4761['define'](_0x08fe('0x7'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x08fe('0x8'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index ce6b470..b90fa6d 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 _0xefc6=['client','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise'];(function(_0x5d76cc,_0x195736){var _0x4acce4=function(_0x3b889d){while(--_0x3b889d){_0x5d76cc['push'](_0x5d76cc['shift']());}};_0x4acce4(++_0x195736);}(_0xefc6,0x148));var _0x6efc=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xefc6[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x6efc('0x0'));var util=require(_0x6efc('0x1'));var moment=require(_0x6efc('0x2'));var BPromise=require(_0x6efc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6efc('0x4'));var db=require(_0x6efc('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6efc('0x6'));var config=require('../../config/environment');var jayson=require(_0x6efc('0x7'));var client=jayson[_0x6efc('0x8')][_0x6efc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a3976,_0x81d244,_0x53b03d){return new BPromise(function(_0x6c37e6,_0x601a33){return client['request'](_0x1a3976,_0x53b03d)[_0x6efc('0xa')](function(_0x34527f){logger[_0x6efc('0xb')](_0x6efc('0xc'),_0x81d244,_0x6efc('0xd'));logger[_0x6efc('0xe')](_0x6efc('0xf'),_0x81d244,_0x6efc('0xd'),JSON['stringify'](_0x34527f));if(_0x34527f[_0x6efc('0x10')]){if(_0x34527f['error'][_0x6efc('0x11')]===0x1f4){logger['error'](_0x6efc('0xc'),_0x81d244,_0x34527f[_0x6efc('0x10')][_0x6efc('0x12')]);return _0x601a33(_0x34527f[_0x6efc('0x10')][_0x6efc('0x12')]);}logger[_0x6efc('0x10')](_0x6efc('0xc'),_0x81d244,_0x34527f[_0x6efc('0x10')][_0x6efc('0x12')]);return _0x6c37e6(_0x34527f['error'][_0x6efc('0x12')]);}else{logger[_0x6efc('0xb')](_0x6efc('0xc'),_0x81d244,_0x6efc('0xd'));_0x6c37e6(_0x34527f[_0x6efc('0x13')][_0x6efc('0x12')]);}})[_0x6efc('0x14')](function(_0x4dad00){logger[_0x6efc('0x10')](_0x6efc('0xc'),_0x81d244,_0x4dad00);_0x601a33(_0x4dad00);});});} \ No newline at end of file +var _0xb0cf=['code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3b711a,_0x410be8){var _0x89061d=function(_0x57d61a){while(--_0x57d61a){_0x3b711a['push'](_0x3b711a['shift']());}};_0x89061d(++_0x410be8);}(_0xb0cf,0x1d1));var _0xfb0c=function(_0x2e5093,_0x516434){_0x2e5093=_0x2e5093-0x0;var _0x1062b6=_0xb0cf[_0x2e5093];return _0x1062b6;};'use strict';var _=require(_0xfb0c('0x0'));var util=require(_0xfb0c('0x1'));var moment=require(_0xfb0c('0x2'));var BPromise=require('bluebird');var rs=require(_0xfb0c('0x3'));var fs=require('fs');var Redis=require(_0xfb0c('0x4'));var db=require(_0xfb0c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfb0c('0x6'))(_0xfb0c('0x7'));var config=require(_0xfb0c('0x8'));var jayson=require(_0xfb0c('0x9'));var client=jayson['client'][_0xfb0c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfe1cd9,_0x59b278,_0x56e855){return new BPromise(function(_0x5d5e95,_0x4a63cb){return client['request'](_0xfe1cd9,_0x56e855)[_0xfb0c('0xb')](function(_0x197730){logger[_0xfb0c('0xc')](_0xfb0c('0xd'),_0x59b278,_0xfb0c('0xe'));logger[_0xfb0c('0xf')](_0xfb0c('0x10'),_0x59b278,_0xfb0c('0xe'),JSON[_0xfb0c('0x11')](_0x197730));if(_0x197730[_0xfb0c('0x12')]){if(_0x197730[_0xfb0c('0x12')][_0xfb0c('0x13')]===0x1f4){logger[_0xfb0c('0x12')](_0xfb0c('0xd'),_0x59b278,_0x197730[_0xfb0c('0x12')][_0xfb0c('0x14')]);return _0x4a63cb(_0x197730[_0xfb0c('0x12')][_0xfb0c('0x14')]);}logger[_0xfb0c('0x12')](_0xfb0c('0xd'),_0x59b278,_0x197730[_0xfb0c('0x12')][_0xfb0c('0x14')]);return _0x5d5e95(_0x197730[_0xfb0c('0x12')][_0xfb0c('0x14')]);}else{logger['info'](_0xfb0c('0xd'),_0x59b278,_0xfb0c('0xe'));_0x5d5e95(_0x197730[_0xfb0c('0x15')]['message']);}})['catch'](function(_0x2c542a){logger[_0xfb0c('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x59b278,_0x2c542a);_0x4a63cb(_0x2c542a);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 50f71a0..0627a34 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 _0xa0cf=['../../config/environment','./userProfileSection.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service'];(function(_0x20ab5a,_0x178ffa){var _0x272c6e=function(_0x14922e){while(--_0x14922e){_0x20ab5a['push'](_0x20ab5a['shift']());}};_0x272c6e(++_0x178ffa);}(_0xa0cf,0x1db));var _0xfa0c=function(_0x548503,_0x1aa00c){_0x548503=_0x548503-0x0;var _0xf8f05f=_0xa0cf[_0x548503];return _0xf8f05f;};'use strict';var multer=require('multer');var util=require(_0xfa0c('0x0'));var path=require(_0xfa0c('0x1'));var timeout=require(_0xfa0c('0x2'));var express=require(_0xfa0c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfa0c('0x4'));var config=require(_0xfa0c('0x5'));var controller=require(_0xfa0c('0x6'));router['get']('/',auth[_0xfa0c('0x7')](),controller[_0xfa0c('0x8')]);router[_0xfa0c('0x9')]('/describe',auth[_0xfa0c('0x7')](),controller[_0xfa0c('0xa')]);router[_0xfa0c('0x9')](_0xfa0c('0xb'),auth[_0xfa0c('0x7')](),controller[_0xfa0c('0xc')]);router[_0xfa0c('0xd')]('/',auth['isAuthenticated'](),controller[_0xfa0c('0xe')]);router[_0xfa0c('0xf')](_0xfa0c('0xb'),auth['isAuthenticated'](),controller[_0xfa0c('0x10')]);router[_0xfa0c('0x11')](_0xfa0c('0xb'),auth[_0xfa0c('0x7')](),controller[_0xfa0c('0x12')]);module[_0xfa0c('0x13')]=router; \ No newline at end of file +var _0xf0f3=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path'];(function(_0xd07629,_0x280a38){var _0x2ea107=function(_0x529ff8){while(--_0x529ff8){_0xd07629['push'](_0xd07629['shift']());}};_0x2ea107(++_0x280a38);}(_0xf0f3,0x18d));var _0x3f0f=function(_0x5e972b,_0x47aeae){_0x5e972b=_0x5e972b-0x0;var _0x5f5bbb=_0xf0f3[_0x5e972b];return _0x5f5bbb;};'use strict';var multer=require(_0x3f0f('0x0'));var util=require(_0x3f0f('0x1'));var path=require(_0x3f0f('0x2'));var timeout=require(_0x3f0f('0x3'));var express=require('express');var router=express[_0x3f0f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3f0f('0x5'));var interaction=require(_0x3f0f('0x6'));var config=require(_0x3f0f('0x7'));var controller=require(_0x3f0f('0x8'));router[_0x3f0f('0x9')]('/',auth[_0x3f0f('0xa')](),controller['index']);router[_0x3f0f('0x9')]('/describe',auth[_0x3f0f('0xa')](),controller[_0x3f0f('0xb')]);router['get'](_0x3f0f('0xc'),auth[_0x3f0f('0xa')](),controller[_0x3f0f('0xd')]);router[_0x3f0f('0xe')]('/',auth[_0x3f0f('0xa')](),controller[_0x3f0f('0xf')]);router[_0x3f0f('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x3f0f('0x11')]);router[_0x3f0f('0x12')](_0x3f0f('0xc'),auth[_0x3f0f('0xa')](),controller[_0x3f0f('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 75c32d1..ea11654 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 _0xe605=['BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports','STRING','INTEGER'];(function(_0x3f42b0,_0x7727b3){var _0x3ba568=function(_0x3a518f){while(--_0x3a518f){_0x3f42b0['push'](_0x3f42b0['shift']());}};_0x3ba568(++_0x7727b3);}(_0xe605,0x92));var _0x5e60=function(_0x287f7c,_0x268ead){_0x287f7c=_0x287f7c-0x0;var _0xd28b20=_0xe605[_0x287f7c];return _0xd28b20;};'use strict';var Sequelize=require(_0x5e60('0x0'));module[_0x5e60('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x5e60('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x5e60('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x5e60('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x5e60('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x5e60('0x2')],'set':function(_0xfe1f64){this[_0x5e60('0x5')](_0x5e60('0x6'),_0xfe1f64?_0xfe1f64[_0x5e60('0x7')](''):[]);},'get':function(){return this[_0x5e60('0x8')](_0x5e60('0x6'))?this[_0x5e60('0x8')]('crudPermissions')[_0x5e60('0x9')](''):[];}}}; \ No newline at end of file +var _0xb10b=['split','sequelize','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue'];(function(_0x58ae8a,_0x3c619e){var _0x2f0b6b=function(_0x6db940){while(--_0x6db940){_0x58ae8a['push'](_0x58ae8a['shift']());}};_0x2f0b6b(++_0x3c619e);}(_0xb10b,0x12a));var _0xbb10=function(_0x34aec4,_0x3801da){_0x34aec4=_0x34aec4-0x0;var _0x51e1a7=_0xb10b[_0x34aec4];return _0x51e1a7;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xbb10('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xbb10('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xbb10('0x1')],'set':function(_0x460981){this[_0xbb10('0x4')](_0xbb10('0x5'),_0x460981?_0x460981[_0xbb10('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0xbb10('0x5'))?this[_0xbb10('0x7')]('crudPermissions')[_0xbb10('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 33d3eba..bd6c915 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 _0xb6e4=['jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','sort','where','filters','pick','filter','merge','VIRTUAL','options','UserProfileSection','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x4ddc5a,_0x5e319b){var _0x499313=function(_0x5aab52){while(--_0x5aab52){_0x4ddc5a['push'](_0x4ddc5a['shift']());}};_0x499313(++_0x5e319b);}(_0xb6e4,0x1f2));var _0x4b6e=function(_0x1e6dbd,_0x4e476e){_0x1e6dbd=_0x1e6dbd-0x0;var _0x523a5d=_0xb6e4[_0x1e6dbd];return _0x523a5d;};'use strict';var emlformat=require(_0x4b6e('0x0'));var rimraf=require(_0x4b6e('0x1'));var zipdir=require(_0x4b6e('0x2'));var jsonpatch=require(_0x4b6e('0x3'));var rp=require(_0x4b6e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4b6e('0x5'));var util=require(_0x4b6e('0x6'));var path=require(_0x4b6e('0x7'));var sox=require(_0x4b6e('0x8'));var csv=require(_0x4b6e('0x9'));var ejs=require(_0x4b6e('0xa'));var fs=require('fs');var fs_extra=require(_0x4b6e('0xb'));var _=require('lodash');var squel=require(_0x4b6e('0xc'));var crypto=require('crypto');var jsforce=require(_0x4b6e('0xd'));var deskjs=require(_0x4b6e('0xe'));var toCsv=require(_0x4b6e('0x9'));var querystring=require('querystring');var Papa=require(_0x4b6e('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4b6e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b6e('0x11'))(_0x4b6e('0x12'));var utils=require(_0x4b6e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4b6e('0x14'));var db=require(_0x4b6e('0x15'))['db'];function respondWithStatusCode(_0x47c69d,_0x4fbeb1){_0x4fbeb1=_0x4fbeb1||0xcc;return function(_0xa330d3){if(_0xa330d3){return _0x47c69d[_0x4b6e('0x16')](_0x4fbeb1);}return _0x47c69d['status'](_0x4fbeb1)[_0x4b6e('0x17')]();};}function respondWithResult(_0x2f6fd9,_0x5a0172){_0x5a0172=_0x5a0172||0xc8;return function(_0x5225f4){if(_0x5225f4){return _0x2f6fd9[_0x4b6e('0x18')](_0x5a0172)[_0x4b6e('0x19')](_0x5225f4);}};}function respondWithFilteredResult(_0x301528,_0x56f02e){return function(_0x4666d6){if(_0x4666d6){var _0x5c144a=typeof _0x56f02e[_0x4b6e('0x1a')]===_0x4b6e('0x1b')&&typeof _0x56f02e[_0x4b6e('0x1c')]==='undefined';var _0x58bfcf=_0x4666d6[_0x4b6e('0x1d')];var _0x4abb6e=_0x5c144a?0x0:_0x56f02e[_0x4b6e('0x1a')];var _0x5c075d=_0x5c144a?_0x4666d6['count']:_0x56f02e['offset']+_0x56f02e[_0x4b6e('0x1c')];var _0x1f9fb2;if(_0x5c075d>=_0x58bfcf){_0x5c075d=_0x58bfcf;_0x1f9fb2=0xc8;}else{_0x1f9fb2=0xce;}_0x301528['status'](_0x1f9fb2);return _0x301528['set'](_0x4b6e('0x1e'),_0x4abb6e+'-'+_0x5c075d+'/'+_0x58bfcf)[_0x4b6e('0x19')](_0x4666d6);}return null;};}function patchUpdates(_0x12650e){return function(_0xe6a7c6){try{jsonpatch[_0x4b6e('0x1f')](_0xe6a7c6,_0x12650e,!![]);}catch(_0x3ceda0){return BPromise['reject'](_0x3ceda0);}return _0xe6a7c6[_0x4b6e('0x20')]();};}function saveUpdates(_0x1b1e06,_0x7683c8){return function(_0x32433b){if(_0x32433b){return _0x32433b[_0x4b6e('0x21')](_0x1b1e06)[_0x4b6e('0x22')](function(_0x20944e){return _0x20944e;});}return null;};}function removeEntity(_0x4a666c,_0x45775e){return function(_0xaf136e){if(_0xaf136e){return _0xaf136e[_0x4b6e('0x23')]()['then'](function(){_0x4a666c[_0x4b6e('0x18')](0xcc)[_0x4b6e('0x17')]();});}};}function handleEntityNotFound(_0x24f82a,_0x46fbd4){return function(_0x408bfb){if(!_0x408bfb){_0x24f82a[_0x4b6e('0x16')](0x194);}return _0x408bfb;};}function handleError(_0x338590,_0x195ddc){_0x195ddc=_0x195ddc||0x1f4;return function(_0x10ef5e){logger[_0x4b6e('0x24')](_0x10ef5e[_0x4b6e('0x25')]);if(_0x10ef5e[_0x4b6e('0x26')]){delete _0x10ef5e[_0x4b6e('0x26')];}_0x338590['status'](_0x195ddc)[_0x4b6e('0x27')](_0x10ef5e);};}exports[_0x4b6e('0x28')]=function(_0x328f9e,_0x8043b){var _0x4bfdb5={},_0x1e0f0b={},_0x4779f8={'count':0x0,'rows':[]};var _0x29fbfa=_[_0x4b6e('0x29')](db['UserProfileSection']['rawAttributes'],function(_0x275505){return{'name':_0x275505[_0x4b6e('0x2a')],'type':_0x275505[_0x4b6e('0x2b')][_0x4b6e('0x2c')]};});_0x1e0f0b[_0x4b6e('0x2d')]=_['map'](_0x29fbfa,'name');_0x1e0f0b[_0x4b6e('0x2e')]=_[_0x4b6e('0x2f')](_0x328f9e[_0x4b6e('0x2e')]);_0x1e0f0b['filters']=_[_0x4b6e('0x30')](_0x1e0f0b[_0x4b6e('0x2d')],_0x1e0f0b[_0x4b6e('0x2e')]);_0x4bfdb5['attributes']=_[_0x4b6e('0x30')](_0x1e0f0b['model'],qs['fields'](_0x328f9e[_0x4b6e('0x2e')][_0x4b6e('0x31')]));_0x4bfdb5[_0x4b6e('0x32')]=_0x4bfdb5[_0x4b6e('0x32')][_0x4b6e('0x33')]?_0x4bfdb5[_0x4b6e('0x32')]:_0x1e0f0b['model'];if(!_0x328f9e['query']['hasOwnProperty']('nolimit')){_0x4bfdb5[_0x4b6e('0x1c')]=qs['limit'](_0x328f9e['query'][_0x4b6e('0x1c')]);_0x4bfdb5[_0x4b6e('0x1a')]=qs[_0x4b6e('0x1a')](_0x328f9e[_0x4b6e('0x2e')][_0x4b6e('0x1a')]);}_0x4bfdb5['order']=qs[_0x4b6e('0x34')](_0x328f9e[_0x4b6e('0x2e')][_0x4b6e('0x34')]);_0x4bfdb5[_0x4b6e('0x35')]=qs[_0x4b6e('0x36')](_[_0x4b6e('0x37')](_0x328f9e[_0x4b6e('0x2e')],_0x1e0f0b[_0x4b6e('0x36')]),_0x29fbfa);if(_0x328f9e[_0x4b6e('0x2e')][_0x4b6e('0x38')]){_0x4bfdb5[_0x4b6e('0x35')]=_[_0x4b6e('0x39')](_0x4bfdb5[_0x4b6e('0x35')],{'$or':_[_0x4b6e('0x29')](_0x29fbfa,function(_0x39a681){if(_0x39a681[_0x4b6e('0x2b')]!==_0x4b6e('0x3a')){var _0x162629={};_0x162629[_0x39a681[_0x4b6e('0x26')]]={'$like':'%'+_0x328f9e[_0x4b6e('0x2e')][_0x4b6e('0x38')]+'%'};return _0x162629;}})});}_0x4bfdb5=_[_0x4b6e('0x39')]({},_0x4bfdb5,_0x328f9e[_0x4b6e('0x3b')]);var _0x585d0a={'where':_0x4bfdb5['where']};return db[_0x4b6e('0x3c')][_0x4b6e('0x1d')](_0x585d0a)['then'](function(_0x185b68){_0x4779f8[_0x4b6e('0x1d')]=_0x185b68;if(_0x328f9e[_0x4b6e('0x2e')][_0x4b6e('0x3d')]){_0x4bfdb5[_0x4b6e('0x3e')]=[{'all':!![]}];}return db['UserProfileSection'][_0x4b6e('0x3f')](_0x4bfdb5);})[_0x4b6e('0x22')](function(_0x34519e){_0x4779f8[_0x4b6e('0x40')]=_0x34519e;return _0x4779f8;})[_0x4b6e('0x22')](respondWithFilteredResult(_0x8043b,_0x4bfdb5))[_0x4b6e('0x41')](handleError(_0x8043b,null));};exports[_0x4b6e('0x42')]=function(_0x56c57c,_0x455e13){var _0x2a406c={'raw':![],'where':{'id':_0x56c57c[_0x4b6e('0x43')]['id']}},_0x396cbb={};_0x396cbb[_0x4b6e('0x2d')]=_['keys'](db[_0x4b6e('0x3c')][_0x4b6e('0x44')]);_0x396cbb[_0x4b6e('0x2e')]=_[_0x4b6e('0x2f')](_0x56c57c['query']);_0x396cbb[_0x4b6e('0x36')]=_[_0x4b6e('0x30')](_0x396cbb[_0x4b6e('0x2d')],_0x396cbb['query']);_0x2a406c[_0x4b6e('0x32')]=_['intersection'](_0x396cbb[_0x4b6e('0x2d')],qs[_0x4b6e('0x31')](_0x56c57c[_0x4b6e('0x2e')][_0x4b6e('0x31')]));_0x2a406c['attributes']=_0x2a406c[_0x4b6e('0x32')][_0x4b6e('0x33')]?_0x2a406c[_0x4b6e('0x32')]:_0x396cbb['model'];if(_0x56c57c[_0x4b6e('0x2e')]['includeAll']){_0x2a406c['include']=[{'all':!![]}];}_0x2a406c=_[_0x4b6e('0x39')]({},_0x2a406c,_0x56c57c[_0x4b6e('0x3b')]);return db[_0x4b6e('0x3c')][_0x4b6e('0x45')](_0x2a406c)[_0x4b6e('0x22')](handleEntityNotFound(_0x455e13,null))['then'](respondWithResult(_0x455e13,null))[_0x4b6e('0x41')](handleError(_0x455e13,null));};exports[_0x4b6e('0x46')]=function(_0x873f91,_0x5ac357){return db[_0x4b6e('0x3c')][_0x4b6e('0x46')](_0x873f91[_0x4b6e('0x47')],{})[_0x4b6e('0x22')](respondWithResult(_0x5ac357,0xc9))[_0x4b6e('0x41')](handleError(_0x5ac357,null));};exports['update']=function(_0x2623b1,_0x1b3962){if(_0x2623b1['body']['id']){delete _0x2623b1[_0x4b6e('0x47')]['id'];}return db['UserProfileSection'][_0x4b6e('0x45')]({'where':{'id':_0x2623b1[_0x4b6e('0x43')]['id']}})[_0x4b6e('0x22')](handleEntityNotFound(_0x1b3962,null))[_0x4b6e('0x22')](saveUpdates(_0x2623b1[_0x4b6e('0x47')],null))[_0x4b6e('0x22')](respondWithResult(_0x1b3962,null))['catch'](handleError(_0x1b3962,null));};exports[_0x4b6e('0x23')]=function(_0x54697b,_0x32b6e0){return db[_0x4b6e('0x3c')][_0x4b6e('0x45')]({'where':{'id':_0x54697b[_0x4b6e('0x43')]['id']}})[_0x4b6e('0x22')](handleEntityNotFound(_0x32b6e0,null))[_0x4b6e('0x22')](removeEntity(_0x32b6e0,null))[_0x4b6e('0x41')](handleError(_0x32b6e0,null));};exports[_0x4b6e('0x48')]=function(_0x5860e9,_0x22f5b7){return db[_0x4b6e('0x3c')][_0x4b6e('0x48')]()['then'](respondWithResult(_0x22f5b7,null))['catch'](handleError(_0x22f5b7,null));}; \ No newline at end of file +var _0x5d1e=['../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','save','update','then','error','name','send','index','map','UserProfileSection','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','findAll','rows','show','params','include','options','catch','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x39d7ca,_0x4b30cc){var _0xf38800=function(_0x2879c1){while(--_0x2879c1){_0x39d7ca['push'](_0x39d7ca['shift']());}};_0xf38800(++_0x4b30cc);}(_0x5d1e,0x1b0));var _0xe5d1=function(_0x3af265,_0x45fe72){_0x3af265=_0x3af265-0x0;var _0x17b752=_0x5d1e[_0x3af265];return _0x17b752;};'use strict';var emlformat=require(_0xe5d1('0x0'));var rimraf=require(_0xe5d1('0x1'));var zipdir=require(_0xe5d1('0x2'));var jsonpatch=require(_0xe5d1('0x3'));var rp=require(_0xe5d1('0x4'));var moment=require(_0xe5d1('0x5'));var BPromise=require(_0xe5d1('0x6'));var Mustache=require(_0xe5d1('0x7'));var util=require(_0xe5d1('0x8'));var path=require(_0xe5d1('0x9'));var sox=require(_0xe5d1('0xa'));var csv=require(_0xe5d1('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe5d1('0xc'));var _=require(_0xe5d1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe5d1('0xe'));var deskjs=require(_0xe5d1('0xf'));var toCsv=require(_0xe5d1('0xb'));var querystring=require('querystring');var Papa=require(_0xe5d1('0x10'));var Redis=require(_0xe5d1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe5d1('0x12'));var as=require(_0xe5d1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe5d1('0x14'))('api');var utils=require(_0xe5d1('0x15'));var config=require(_0xe5d1('0x16'));var licenseUtil=require(_0xe5d1('0x17'));var db=require(_0xe5d1('0x18'))['db'];function respondWithStatusCode(_0x1886b2,_0x31e95a){_0x31e95a=_0x31e95a||0xcc;return function(_0x454603){if(_0x454603){return _0x1886b2[_0xe5d1('0x19')](_0x31e95a);}return _0x1886b2['status'](_0x31e95a)[_0xe5d1('0x1a')]();};}function respondWithResult(_0x1838a5,_0x3c0f89){_0x3c0f89=_0x3c0f89||0xc8;return function(_0x79b4a5){if(_0x79b4a5){return _0x1838a5['status'](_0x3c0f89)[_0xe5d1('0x1b')](_0x79b4a5);}};}function respondWithFilteredResult(_0x5176aa,_0x2a8a13){return function(_0x189aea){if(_0x189aea){var _0x216330=typeof _0x2a8a13[_0xe5d1('0x1c')]===_0xe5d1('0x1d')&&typeof _0x2a8a13[_0xe5d1('0x1e')]===_0xe5d1('0x1d');var _0x2a3f64=_0x189aea['count'];var _0x46a965=_0x216330?0x0:_0x2a8a13[_0xe5d1('0x1c')];var _0x3fc512=_0x216330?_0x189aea[_0xe5d1('0x1f')]:_0x2a8a13[_0xe5d1('0x1c')]+_0x2a8a13[_0xe5d1('0x1e')];var _0x508c9a;if(_0x3fc512>=_0x2a3f64){_0x3fc512=_0x2a3f64;_0x508c9a=0xc8;}else{_0x508c9a=0xce;}_0x5176aa[_0xe5d1('0x20')](_0x508c9a);return _0x5176aa['set'](_0xe5d1('0x21'),_0x46a965+'-'+_0x3fc512+'/'+_0x2a3f64)[_0xe5d1('0x1b')](_0x189aea);}return null;};}function patchUpdates(_0xf12797){return function(_0x118fc1){try{jsonpatch[_0xe5d1('0x22')](_0x118fc1,_0xf12797,!![]);}catch(_0xd4b0df){return BPromise['reject'](_0xd4b0df);}return _0x118fc1[_0xe5d1('0x23')]();};}function saveUpdates(_0xe1c606,_0x33a1f9){return function(_0x434832){if(_0x434832){return _0x434832[_0xe5d1('0x24')](_0xe1c606)[_0xe5d1('0x25')](function(_0x3083c1){return _0x3083c1;});}return null;};}function removeEntity(_0x5f5829,_0x64b8bb){return function(_0x5cb8d1){if(_0x5cb8d1){return _0x5cb8d1['destroy']()[_0xe5d1('0x25')](function(){_0x5f5829[_0xe5d1('0x20')](0xcc)[_0xe5d1('0x1a')]();});}};}function handleEntityNotFound(_0x2c633c,_0x567b9f){return function(_0x1d2af3){if(!_0x1d2af3){_0x2c633c['sendStatus'](0x194);}return _0x1d2af3;};}function handleError(_0x222bba,_0x72d919){_0x72d919=_0x72d919||0x1f4;return function(_0x21e4e6){logger[_0xe5d1('0x26')](_0x21e4e6['stack']);if(_0x21e4e6[_0xe5d1('0x27')]){delete _0x21e4e6[_0xe5d1('0x27')];}_0x222bba[_0xe5d1('0x20')](_0x72d919)[_0xe5d1('0x28')](_0x21e4e6);};}exports[_0xe5d1('0x29')]=function(_0x44b145,_0x1088ea){var _0x457fc4={},_0x5805ef={},_0x324e38={'count':0x0,'rows':[]};var _0x33b50f=_[_0xe5d1('0x2a')](db[_0xe5d1('0x2b')][_0xe5d1('0x2c')],function(_0x5d2b10){return{'name':_0x5d2b10['fieldName'],'type':_0x5d2b10[_0xe5d1('0x2d')][_0xe5d1('0x2e')]};});_0x5805ef['model']=_[_0xe5d1('0x2a')](_0x33b50f,'name');_0x5805ef[_0xe5d1('0x2f')]=_[_0xe5d1('0x30')](_0x44b145[_0xe5d1('0x2f')]);_0x5805ef[_0xe5d1('0x31')]=_[_0xe5d1('0x32')](_0x5805ef[_0xe5d1('0x33')],_0x5805ef[_0xe5d1('0x2f')]);_0x457fc4['attributes']=_[_0xe5d1('0x32')](_0x5805ef['model'],qs[_0xe5d1('0x34')](_0x44b145[_0xe5d1('0x2f')][_0xe5d1('0x34')]));_0x457fc4[_0xe5d1('0x35')]=_0x457fc4[_0xe5d1('0x35')][_0xe5d1('0x36')]?_0x457fc4[_0xe5d1('0x35')]:_0x5805ef[_0xe5d1('0x33')];if(!_0x44b145[_0xe5d1('0x2f')][_0xe5d1('0x37')](_0xe5d1('0x38'))){_0x457fc4[_0xe5d1('0x1e')]=qs['limit'](_0x44b145['query'][_0xe5d1('0x1e')]);_0x457fc4['offset']=qs[_0xe5d1('0x1c')](_0x44b145['query']['offset']);}_0x457fc4[_0xe5d1('0x39')]=qs[_0xe5d1('0x3a')](_0x44b145[_0xe5d1('0x2f')][_0xe5d1('0x3a')]);_0x457fc4['where']=qs[_0xe5d1('0x31')](_['pick'](_0x44b145['query'],_0x5805ef[_0xe5d1('0x31')]),_0x33b50f);if(_0x44b145[_0xe5d1('0x2f')][_0xe5d1('0x3b')]){_0x457fc4[_0xe5d1('0x3c')]=_[_0xe5d1('0x3d')](_0x457fc4[_0xe5d1('0x3c')],{'$or':_[_0xe5d1('0x2a')](_0x33b50f,function(_0x426ac8){if(_0x426ac8['type']!==_0xe5d1('0x3e')){var _0x170bd2={};_0x170bd2[_0x426ac8[_0xe5d1('0x27')]]={'$like':'%'+_0x44b145['query'][_0xe5d1('0x3b')]+'%'};return _0x170bd2;}})});}_0x457fc4=_[_0xe5d1('0x3d')]({},_0x457fc4,_0x44b145['options']);var _0x2e81dc={'where':_0x457fc4[_0xe5d1('0x3c')]};return db[_0xe5d1('0x2b')][_0xe5d1('0x1f')](_0x2e81dc)[_0xe5d1('0x25')](function(_0x4bd7f5){_0x324e38['count']=_0x4bd7f5;if(_0x44b145[_0xe5d1('0x2f')][_0xe5d1('0x3f')]){_0x457fc4['include']=[{'all':!![]}];}return db[_0xe5d1('0x2b')][_0xe5d1('0x40')](_0x457fc4);})[_0xe5d1('0x25')](function(_0x439bee){_0x324e38[_0xe5d1('0x41')]=_0x439bee;return _0x324e38;})[_0xe5d1('0x25')](respondWithFilteredResult(_0x1088ea,_0x457fc4))['catch'](handleError(_0x1088ea,null));};exports[_0xe5d1('0x42')]=function(_0x40001a,_0x31cfd){var _0x5d5523={'raw':![],'where':{'id':_0x40001a[_0xe5d1('0x43')]['id']}},_0x3633a8={};_0x3633a8['model']=_['keys'](db[_0xe5d1('0x2b')][_0xe5d1('0x2c')]);_0x3633a8[_0xe5d1('0x2f')]=_[_0xe5d1('0x30')](_0x40001a[_0xe5d1('0x2f')]);_0x3633a8[_0xe5d1('0x31')]=_[_0xe5d1('0x32')](_0x3633a8[_0xe5d1('0x33')],_0x3633a8['query']);_0x5d5523[_0xe5d1('0x35')]=_['intersection'](_0x3633a8[_0xe5d1('0x33')],qs[_0xe5d1('0x34')](_0x40001a['query']['fields']));_0x5d5523['attributes']=_0x5d5523[_0xe5d1('0x35')][_0xe5d1('0x36')]?_0x5d5523[_0xe5d1('0x35')]:_0x3633a8[_0xe5d1('0x33')];if(_0x40001a[_0xe5d1('0x2f')][_0xe5d1('0x3f')]){_0x5d5523[_0xe5d1('0x44')]=[{'all':!![]}];}_0x5d5523=_[_0xe5d1('0x3d')]({},_0x5d5523,_0x40001a[_0xe5d1('0x45')]);return db[_0xe5d1('0x2b')]['find'](_0x5d5523)[_0xe5d1('0x25')](handleEntityNotFound(_0x31cfd,null))[_0xe5d1('0x25')](respondWithResult(_0x31cfd,null))[_0xe5d1('0x46')](handleError(_0x31cfd,null));};exports[_0xe5d1('0x47')]=function(_0x3f0635,_0x454c29){return db['UserProfileSection'][_0xe5d1('0x47')](_0x3f0635[_0xe5d1('0x48')],{})['then'](respondWithResult(_0x454c29,0xc9))['catch'](handleError(_0x454c29,null));};exports[_0xe5d1('0x24')]=function(_0x378e71,_0xd03927){if(_0x378e71[_0xe5d1('0x48')]['id']){delete _0x378e71[_0xe5d1('0x48')]['id'];}return db[_0xe5d1('0x2b')][_0xe5d1('0x49')]({'where':{'id':_0x378e71['params']['id']}})[_0xe5d1('0x25')](handleEntityNotFound(_0xd03927,null))[_0xe5d1('0x25')](saveUpdates(_0x378e71[_0xe5d1('0x48')],null))[_0xe5d1('0x25')](respondWithResult(_0xd03927,null))[_0xe5d1('0x46')](handleError(_0xd03927,null));};exports[_0xe5d1('0x4a')]=function(_0xf4a0d6,_0x34c40b){return db[_0xe5d1('0x2b')][_0xe5d1('0x49')]({'where':{'id':_0xf4a0d6[_0xe5d1('0x43')]['id']}})['then'](handleEntityNotFound(_0x34c40b,null))['then'](removeEntity(_0x34c40b,null))['catch'](handleError(_0x34c40b,null));};exports[_0xe5d1('0x4b')]=function(_0x465239,_0x508973){return db['UserProfileSection'][_0xe5d1('0x4b')]()['then'](respondWithResult(_0x508973,null))[_0xe5d1('0x46')](handleError(_0x508973,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 872871e..c589aea 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 _0x5ee9=['request-promise','path','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','moment','bluebird'];(function(_0x194847,_0x34a5d5){var _0x9499e4=function(_0x364ec0){while(--_0x364ec0){_0x194847['push'](_0x194847['shift']());}};_0x9499e4(++_0x34a5d5);}(_0x5ee9,0x1db));var _0x95ee=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5ee9[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x95ee('0x0'));var util=require(_0x95ee('0x1'));var logger=require(_0x95ee('0x2'))('api');var moment=require(_0x95ee('0x3'));var BPromise=require(_0x95ee('0x4'));var rp=require(_0x95ee('0x5'));var fs=require('fs');var path=require(_0x95ee('0x6'));var rimraf=require('rimraf');var config=require(_0x95ee('0x7'));var attributes=require(_0x95ee('0x8'));module[_0x95ee('0x9')]=function(_0xcefde9,_0x4852f7){return _0xcefde9[_0x95ee('0xa')](_0x95ee('0xb'),attributes,{'tableName':_0x95ee('0xc'),'paranoid':![],'indexes':[{'name':_0x95ee('0xd'),'fields':[_0x95ee('0xe'),_0x95ee('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7e2b=['api','bluebird','request-promise','rimraf','../../config/environment','exports','define','UserProfileSection','compositeIndex','lodash','util'];(function(_0x5ad22d,_0x21efb3){var _0x5bcc79=function(_0x448f1a){while(--_0x448f1a){_0x5ad22d['push'](_0x5ad22d['shift']());}};_0x5bcc79(++_0x21efb3);}(_0x7e2b,0x13d));var _0xb7e2=function(_0xb77d35,_0x291854){_0xb77d35=_0xb77d35-0x0;var _0x5389a8=_0x7e2b[_0xb77d35];return _0x5389a8;};'use strict';var _=require(_0xb7e2('0x0'));var util=require(_0xb7e2('0x1'));var logger=require('../../config/logger')(_0xb7e2('0x2'));var moment=require('moment');var BPromise=require(_0xb7e2('0x3'));var rp=require(_0xb7e2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb7e2('0x5'));var config=require(_0xb7e2('0x6'));var attributes=require('./userProfileSection.attributes');module[_0xb7e2('0x7')]=function(_0x352bf4,_0x1a3308){return _0x352bf4[_0xb7e2('0x8')](_0xb7e2('0x9'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xb7e2('0xa'),'fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 835f2d2..1e2d7f4 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 _0x7a62=['debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','UserProfileSection,\x20%s,\x20%s','request\x20sent'];(function(_0x4bb2b9,_0x459c78){var _0x40e2a2=function(_0x19a26c){while(--_0x19a26c){_0x4bb2b9['push'](_0x4bb2b9['shift']());}};_0x40e2a2(++_0x459c78);}(_0x7a62,0x85));var _0x27a6=function(_0x29baa5,_0x26e470){_0x29baa5=_0x29baa5-0x0;var _0x3fc908=_0x7a62[_0x29baa5];return _0x3fc908;};'use strict';var _=require(_0x27a6('0x0'));var util=require(_0x27a6('0x1'));var moment=require('moment');var BPromise=require(_0x27a6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x27a6('0x3'));var db=require(_0x27a6('0x4'))['db'];var utils=require(_0x27a6('0x5'));var logger=require(_0x27a6('0x6'))('rpc');var config=require(_0x27a6('0x7'));var jayson=require(_0x27a6('0x8'));var client=jayson[_0x27a6('0x9')][_0x27a6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb6bf76,_0x5e2605,_0x34fe2b){return new BPromise(function(_0x3d1965,_0x410e82){return client['request'](_0xb6bf76,_0x34fe2b)[_0x27a6('0xb')](function(_0x8ca85c){logger['info'](_0x27a6('0xc'),_0x5e2605,_0x27a6('0xd'));logger[_0x27a6('0xe')](_0x27a6('0xf'),_0x5e2605,_0x27a6('0xd'),JSON[_0x27a6('0x10')](_0x8ca85c));if(_0x8ca85c[_0x27a6('0x11')]){if(_0x8ca85c[_0x27a6('0x11')]['code']===0x1f4){logger[_0x27a6('0x11')](_0x27a6('0xc'),_0x5e2605,_0x8ca85c[_0x27a6('0x11')][_0x27a6('0x12')]);return _0x410e82(_0x8ca85c['error']['message']);}logger['error']('UserProfileSection,\x20%s,\x20%s',_0x5e2605,_0x8ca85c[_0x27a6('0x11')][_0x27a6('0x12')]);return _0x3d1965(_0x8ca85c[_0x27a6('0x11')][_0x27a6('0x12')]);}else{logger[_0x27a6('0x13')](_0x27a6('0xc'),_0x5e2605,_0x27a6('0xd'));_0x3d1965(_0x8ca85c[_0x27a6('0x14')][_0x27a6('0x12')]);}})['catch'](function(_0x598cec){logger[_0x27a6('0x11')](_0x27a6('0xc'),_0x5e2605,_0x598cec);_0x410e82(_0x598cec);});});} \ No newline at end of file +var _0x2f92=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis'];(function(_0xea6d16,_0x11c300){var _0x59662c=function(_0xc2fdb0){while(--_0xc2fdb0){_0xea6d16['push'](_0xea6d16['shift']());}};_0x59662c(++_0x11c300);}(_0x2f92,0xe2));var _0x22f9=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x2f92[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x22f9('0x0'));var util=require('util');var moment=require(_0x22f9('0x1'));var BPromise=require(_0x22f9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x22f9('0x3'));var db=require(_0x22f9('0x4'))['db'];var utils=require(_0x22f9('0x5'));var logger=require(_0x22f9('0x6'))(_0x22f9('0x7'));var config=require(_0x22f9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x22f9('0x9')][_0x22f9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bce5d,_0x2c8b99,_0x49c971){return new BPromise(function(_0x1166eb,_0x261d90){return client['request'](_0x3bce5d,_0x49c971)[_0x22f9('0xb')](function(_0x317362){logger['info'](_0x22f9('0xc'),_0x2c8b99,'request\x20sent');logger[_0x22f9('0xd')](_0x22f9('0xe'),_0x2c8b99,_0x22f9('0xf'),JSON[_0x22f9('0x10')](_0x317362));if(_0x317362['error']){if(_0x317362[_0x22f9('0x11')][_0x22f9('0x12')]===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x2c8b99,_0x317362[_0x22f9('0x11')]['message']);return _0x261d90(_0x317362[_0x22f9('0x11')][_0x22f9('0x13')]);}logger[_0x22f9('0x11')](_0x22f9('0xc'),_0x2c8b99,_0x317362[_0x22f9('0x11')][_0x22f9('0x13')]);return _0x1166eb(_0x317362[_0x22f9('0x11')][_0x22f9('0x13')]);}else{logger[_0x22f9('0x14')](_0x22f9('0xc'),_0x2c8b99,_0x22f9('0xf'));_0x1166eb(_0x317362[_0x22f9('0x15')]['message']);}})[_0x22f9('0x16')](function(_0x2c75bf){logger['error'](_0x22f9('0xc'),_0x2c8b99,_0x2c75bf);_0x261d90(_0x2c75bf);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 3f5aca9..ba32a88 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5bad83,_0x5c216d){var _0x1bddfd=function(_0x236e94){while(--_0x236e94){_0x5bad83['push'](_0x5bad83['shift']());}};_0x1bddfd(++_0x5c216d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x428355,_0x362fd6){var _0x2c8c5a=function(_0x579cbf){while(--_0x579cbf){_0x428355['push'](_0x428355['shift']());}};_0x2c8c5a(++_0x362fd6);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 165dbc4..f8d0a12 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 _0x22d2=['sequelize','exports'];(function(_0x3ebbd2,_0x18293c){var _0x5cc1ba=function(_0x3ccace){while(--_0x3ccace){_0x3ebbd2['push'](_0x3ebbd2['shift']());}};_0x5cc1ba(++_0x18293c);}(_0x22d2,0x194));var _0x222d=function(_0x1790b0,_0x2c1b20){_0x1790b0=_0x1790b0-0x0;var _0x10c31c=_0x22d2[_0x1790b0];return _0x10c31c;};'use strict';var Sequelize=require(_0x222d('0x0'));module[_0x222d('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xedeb=['sequelize','exports','INTEGER'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xedeb,0x114));var _0xbede=function(_0x5be892,_0x68238a){_0x5be892=_0x5be892-0x0;var _0x53fc35=_0xedeb[_0x5be892];return _0x53fc35;};'use strict';var Sequelize=require(_0xbede('0x0'));module[_0xbede('0x1')]={'penalty':{'type':Sequelize[_0xbede('0x2')],'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 5e426eb..fdd9a4b 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 _0x2a07=['exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes'];(function(_0x163a4d,_0x22feab){var _0x47fbf3=function(_0x359e2f){while(--_0x359e2f){_0x163a4d['push'](_0x163a4d['shift']());}};_0x47fbf3(++_0x22feab);}(_0x2a07,0x74));var _0x72a0=function(_0x2e200c,_0x48ecf0){_0x2e200c=_0x2e200c-0x0;var _0x5a1e2e=_0x2a07[_0x2e200c];return _0x5a1e2e;};'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':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ccb=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','UserSmsQueue','user_has_sms_queues','lodash'];(function(_0x4a2858,_0x4dffde){var _0x567858=function(_0x107490){while(--_0x107490){_0x4a2858['push'](_0x4a2858['shift']());}};_0x567858(++_0x4dffde);}(_0x4ccb,0x196));var _0xb4cc=function(_0x50d46e,_0x20b9ed){_0x50d46e=_0x50d46e-0x0;var _0x1a0d9f=_0x4ccb[_0x50d46e];return _0x1a0d9f;};'use strict';var _=require(_0xb4cc('0x0'));var util=require(_0xb4cc('0x1'));var logger=require(_0xb4cc('0x2'))('api');var moment=require(_0xb4cc('0x3'));var BPromise=require(_0xb4cc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb4cc('0x5'));var rimraf=require(_0xb4cc('0x6'));var config=require(_0xb4cc('0x7'));var attributes=require('./userSmsQueue.attributes');module[_0xb4cc('0x8')]=function(_0x2181b2,_0x1e19dd){return _0x2181b2['define'](_0xb4cc('0x9'),attributes,{'tableName':_0xb4cc('0xa'),'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 c51599b..036eafb 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 _0x5539=['jayson/promise','client','request','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/environment'];(function(_0x1746cb,_0x442b68){var _0x59f3d4=function(_0x4a0224){while(--_0x4a0224){_0x1746cb['push'](_0x1746cb['shift']());}};_0x59f3d4(++_0x442b68);}(_0x5539,0xc2));var _0x9553=function(_0x15d3dd,_0x15a82a){_0x15d3dd=_0x15d3dd-0x0;var _0x26360a=_0x5539[_0x15d3dd];return _0x26360a;};'use strict';var _=require(_0x9553('0x0'));var util=require(_0x9553('0x1'));var moment=require(_0x9553('0x2'));var BPromise=require(_0x9553('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9553('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9553('0x5'));var jayson=require(_0x9553('0x6'));var client=jayson[_0x9553('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22343b,_0x22a06b,_0x281d31){return new BPromise(function(_0x459bfd,_0x58bdcb){return client[_0x9553('0x8')](_0x22343b,_0x281d31)['then'](function(_0x531b3b){logger['info'](_0x9553('0x9'),_0x22a06b,_0x9553('0xa'));logger[_0x9553('0xb')](_0x9553('0xc'),_0x22a06b,_0x9553('0xa'),JSON[_0x9553('0xd')](_0x531b3b));if(_0x531b3b[_0x9553('0xe')]){if(_0x531b3b['error'][_0x9553('0xf')]===0x1f4){logger[_0x9553('0xe')](_0x9553('0x9'),_0x22a06b,_0x531b3b[_0x9553('0xe')][_0x9553('0x10')]);return _0x58bdcb(_0x531b3b['error']['message']);}logger[_0x9553('0xe')](_0x9553('0x9'),_0x22a06b,_0x531b3b[_0x9553('0xe')][_0x9553('0x10')]);return _0x459bfd(_0x531b3b[_0x9553('0xe')][_0x9553('0x10')]);}else{logger[_0x9553('0x11')](_0x9553('0x9'),_0x22a06b,_0x9553('0xa'));_0x459bfd(_0x531b3b[_0x9553('0x12')]['message']);}})[_0x9553('0x13')](function(_0x24b4e4){logger[_0x9553('0xe')](_0x9553('0x9'),_0x22a06b,_0x24b4e4);_0x58bdcb(_0x24b4e4);});});} \ No newline at end of file +var _0x03f0=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util'];(function(_0x5aa582,_0x20267a){var _0x28cd1a=function(_0xce2031){while(--_0xce2031){_0x5aa582['push'](_0x5aa582['shift']());}};_0x28cd1a(++_0x20267a);}(_0x03f0,0x95));var _0x003f=function(_0x3bcde6,_0x4aad58){_0x3bcde6=_0x3bcde6-0x0;var _0x25b0f8=_0x03f0[_0x3bcde6];return _0x25b0f8;};'use strict';var _=require('lodash');var util=require(_0x003f('0x0'));var moment=require(_0x003f('0x1'));var BPromise=require(_0x003f('0x2'));var rs=require(_0x003f('0x3'));var fs=require('fs');var Redis=require(_0x003f('0x4'));var db=require(_0x003f('0x5'))['db'];var utils=require(_0x003f('0x6'));var logger=require(_0x003f('0x7'))(_0x003f('0x8'));var config=require(_0x003f('0x9'));var jayson=require(_0x003f('0xa'));var client=jayson[_0x003f('0xb')][_0x003f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x123589,_0x30b91a,_0x29f582){return new BPromise(function(_0x248f1b,_0x15fe1d){return client[_0x003f('0xd')](_0x123589,_0x29f582)[_0x003f('0xe')](function(_0xc0323d){logger[_0x003f('0xf')](_0x003f('0x10'),_0x30b91a,_0x003f('0x11'));logger[_0x003f('0x12')](_0x003f('0x13'),_0x30b91a,'request\x20sent',JSON[_0x003f('0x14')](_0xc0323d));if(_0xc0323d[_0x003f('0x15')]){if(_0xc0323d['error'][_0x003f('0x16')]===0x1f4){logger['error'](_0x003f('0x10'),_0x30b91a,_0xc0323d[_0x003f('0x15')]['message']);return _0x15fe1d(_0xc0323d[_0x003f('0x15')][_0x003f('0x17')]);}logger[_0x003f('0x15')](_0x003f('0x10'),_0x30b91a,_0xc0323d['error'][_0x003f('0x17')]);return _0x248f1b(_0xc0323d[_0x003f('0x15')]['message']);}else{logger[_0x003f('0xf')](_0x003f('0x10'),_0x30b91a,'request\x20sent');_0x248f1b(_0xc0323d['result'][_0x003f('0x17')]);}})[_0x003f('0x18')](function(_0x55a2d1){logger[_0x003f('0x15')](_0x003f('0x10'),_0x30b91a,_0x55a2d1);_0x15fe1d(_0x55a2d1);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 6fcf5c5..b035377 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 _0x94c0=['INTEGER','sequelize','exports'];(function(_0x3c2863,_0x1b2cee){var _0x2c3d27=function(_0x4f831b){while(--_0x4f831b){_0x3c2863['push'](_0x3c2863['shift']());}};_0x2c3d27(++_0x1b2cee);}(_0x94c0,0xcd));var _0x094c=function(_0x263b1f,_0x3f2376){_0x263b1f=_0x263b1f-0x0;var _0x4aa612=_0x94c0[_0x263b1f];return _0x4aa612;};'use strict';var Sequelize=require(_0x094c('0x0'));module[_0x094c('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x094c('0x2')]}}; \ No newline at end of file +var _0x8bd9=['exports','sequelize'];(function(_0x57975f,_0x388556){var _0x4793b8=function(_0x652c05){while(--_0x652c05){_0x57975f['push'](_0x57975f['shift']());}};_0x4793b8(++_0x388556);}(_0x8bd9,0x191));var _0x98bd=function(_0x6cf3b6,_0x4b7560){_0x6cf3b6=_0x6cf3b6-0x0;var _0xdbe948=_0x8bd9[_0x6cf3b6];return _0xdbe948;};'use strict';var Sequelize=require(_0x98bd('0x0'));module[_0x98bd('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 1585557..0a919d6 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(_0x407ea2,_0x1325ef){var _0x197ba4=function(_0x297d6d){while(--_0x297d6d){_0x407ea2['push'](_0x407ea2['shift']());}};_0x197ba4(++_0x1325ef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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(_0x39f767,_0x37031b){var _0xe88cf6=function(_0x374677){while(--_0x374677){_0x39f767['push'](_0x39f767['shift']());}};_0xe88cf6(++_0x37031b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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 f21bd2a..81464ee 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(_0x58b095,_0x102945){var _0x5341b3=function(_0xbf9f6a){while(--_0xbf9f6a){_0x58b095['push'](_0x58b095['shift']());}};_0x5341b3(++_0x102945);}(_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(_0x37a348,_0xc4d184){var _0x497dea=function(_0x280e51){while(--_0x280e51){_0x37a348['push'](_0x37a348['shift']());}};_0x497dea(++_0xc4d184);}(_0xe706,0xa3));var _0x6e70=function(_0x313a00,_0x107929){_0x313a00=_0x313a00-0x0;var _0x46d07b=_0xe706[_0x313a00];return _0x46d07b;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 9ad23ed..4ed6744 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 _0x81ef=['sequelize','exports','INTEGER'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x81ef,0xc3));var _0xf81e=function(_0x35bbe9,_0x541605){_0x35bbe9=_0x35bbe9-0x0;var _0x4d3e9f=_0x81ef[_0x35bbe9];return _0x4d3e9f;};'use strict';var Sequelize=require(_0xf81e('0x0'));module[_0xf81e('0x1')]={'penalty':{'type':Sequelize[_0xf81e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x20e1=['INTEGER','sequelize','exports'];(function(_0x14acf7,_0x4d077e){var _0x2557d6=function(_0x5db867){while(--_0x5db867){_0x14acf7['push'](_0x14acf7['shift']());}};_0x2557d6(++_0x4d077e);}(_0x20e1,0x139));var _0x120e=function(_0xaf0996,_0x3ee642){_0xaf0996=_0xaf0996-0x0;var _0x8fde5a=_0x20e1[_0xaf0996];return _0x8fde5a;};'use strict';var Sequelize=require(_0x120e('0x0'));module[_0x120e('0x1')]={'penalty':{'type':Sequelize[_0x120e('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 1e8d2a3..6804285 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 _0xfbc1=['bluebird','path','rimraf','../../config/environment','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api'];(function(_0x1dbf47,_0x221fc0){var _0x542d3a=function(_0x47c137){while(--_0x47c137){_0x1dbf47['push'](_0x1dbf47['shift']());}};_0x542d3a(++_0x221fc0);}(_0xfbc1,0x17c));var _0x1fbc=function(_0xfbdff6,_0x2af690){_0xfbdff6=_0xfbdff6-0x0;var _0x4cb9be=_0xfbc1[_0xfbdff6];return _0x4cb9be;};'use strict';var _=require(_0x1fbc('0x0'));var util=require(_0x1fbc('0x1'));var logger=require(_0x1fbc('0x2'))(_0x1fbc('0x3'));var moment=require('moment');var BPromise=require(_0x1fbc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fbc('0x5'));var rimraf=require(_0x1fbc('0x6'));var config=require(_0x1fbc('0x7'));var attributes=require('./userVoiceQueue.attributes');module[_0x1fbc('0x8')]=function(_0x2ab5ce,_0x55c9bf){return _0x2ab5ce[_0x1fbc('0x9')](_0x1fbc('0xa'),attributes,{'tableName':_0x1fbc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x391c=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userVoiceQueue.attributes','define','user_has_voice_queues','util'];(function(_0x2a3cb2,_0x55280a){var _0x4120af=function(_0x2f470c){while(--_0x2f470c){_0x2a3cb2['push'](_0x2a3cb2['shift']());}};_0x4120af(++_0x55280a);}(_0x391c,0xd0));var _0xc391=function(_0x4b9e01,_0xdd6b1b){_0x4b9e01=_0x4b9e01-0x0;var _0x2092ae=_0x391c[_0x4b9e01];return _0x2092ae;};'use strict';var _=require('lodash');var util=require(_0xc391('0x0'));var logger=require(_0xc391('0x1'))(_0xc391('0x2'));var moment=require(_0xc391('0x3'));var BPromise=require(_0xc391('0x4'));var rp=require(_0xc391('0x5'));var fs=require('fs');var path=require(_0xc391('0x6'));var rimraf=require(_0xc391('0x7'));var config=require('../../config/environment');var attributes=require(_0xc391('0x8'));module['exports']=function(_0x4012e3,_0x1965f0){return _0x4012e3[_0xc391('0x9')]('UserVoiceQueue',attributes,{'tableName':_0xc391('0xa'),'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 8a151c7..8c66fa6 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 _0xab56=['info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x199aed,_0x462dfd){var _0x595c7d=function(_0x4705ff){while(--_0x4705ff){_0x199aed['push'](_0x199aed['shift']());}};_0x595c7d(++_0x462dfd);}(_0xab56,0x71));var _0x6ab5=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xab56[_0x376b45];return _0x2341b3;};'use strict';var _=require('lodash');var util=require(_0x6ab5('0x0'));var moment=require('moment');var BPromise=require(_0x6ab5('0x1'));var rs=require(_0x6ab5('0x2'));var fs=require('fs');var Redis=require(_0x6ab5('0x3'));var db=require(_0x6ab5('0x4'))['db'];var utils=require(_0x6ab5('0x5'));var logger=require('../../config/logger')(_0x6ab5('0x6'));var config=require(_0x6ab5('0x7'));var jayson=require(_0x6ab5('0x8'));var client=jayson[_0x6ab5('0x9')][_0x6ab5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xdd2689,_0x33b4b6,_0x1aa377){return new BPromise(function(_0x509eb8,_0xe21ee1){return client[_0x6ab5('0xb')](_0xdd2689,_0x1aa377)[_0x6ab5('0xc')](function(_0x23b5a6){logger[_0x6ab5('0xd')](_0x6ab5('0xe'),_0x33b4b6,_0x6ab5('0xf'));logger[_0x6ab5('0x10')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x33b4b6,_0x6ab5('0xf'),JSON[_0x6ab5('0x11')](_0x23b5a6));if(_0x23b5a6['error']){if(_0x23b5a6['error']['code']===0x1f4){logger[_0x6ab5('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x33b4b6,_0x23b5a6[_0x6ab5('0x12')][_0x6ab5('0x13')]);return _0xe21ee1(_0x23b5a6[_0x6ab5('0x12')][_0x6ab5('0x13')]);}logger[_0x6ab5('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x33b4b6,_0x23b5a6[_0x6ab5('0x12')]['message']);return _0x509eb8(_0x23b5a6[_0x6ab5('0x12')][_0x6ab5('0x13')]);}else{logger[_0x6ab5('0xd')](_0x6ab5('0xe'),_0x33b4b6,_0x6ab5('0xf'));_0x509eb8(_0x23b5a6['result'][_0x6ab5('0x13')]);}})[_0x6ab5('0x14')](function(_0x172b76){logger['error'](_0x6ab5('0xe'),_0x33b4b6,_0x172b76);_0xe21ee1(_0x172b76);});});} \ No newline at end of file +var _0x040b=['UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug'];(function(_0xcd6ec5,_0x34e983){var _0x8e7b0b=function(_0x217d41){while(--_0x217d41){_0xcd6ec5['push'](_0xcd6ec5['shift']());}};_0x8e7b0b(++_0x34e983);}(_0x040b,0xf9));var _0xb040=function(_0x2197eb,_0x432efa){_0x2197eb=_0x2197eb-0x0;var _0x13ade6=_0x040b[_0x2197eb];return _0x13ade6;};'use strict';var _=require(_0xb040('0x0'));var util=require(_0xb040('0x1'));var moment=require(_0xb040('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb040('0x3'));var db=require(_0xb040('0x4'))['db'];var utils=require(_0xb040('0x5'));var logger=require(_0xb040('0x6'))(_0xb040('0x7'));var config=require(_0xb040('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb040('0x9')][_0xb040('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b13d5,_0x408905,_0x293ac7){return new BPromise(function(_0x4dc0fa,_0x2d7f21){return client['request'](_0x1b13d5,_0x293ac7)[_0xb040('0xb')](function(_0x4e9086){logger[_0xb040('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x408905,_0xb040('0xd'));logger[_0xb040('0xe')](_0xb040('0xf'),_0x408905,_0xb040('0xd'),JSON[_0xb040('0x10')](_0x4e9086));if(_0x4e9086[_0xb040('0x11')]){if(_0x4e9086[_0xb040('0x11')][_0xb040('0x12')]===0x1f4){logger['error'](_0xb040('0x13'),_0x408905,_0x4e9086['error'][_0xb040('0x14')]);return _0x2d7f21(_0x4e9086[_0xb040('0x11')][_0xb040('0x14')]);}logger[_0xb040('0x11')](_0xb040('0x13'),_0x408905,_0x4e9086[_0xb040('0x11')][_0xb040('0x14')]);return _0x4dc0fa(_0x4e9086['error'][_0xb040('0x14')]);}else{logger[_0xb040('0xc')](_0xb040('0x13'),_0x408905,_0xb040('0xd'));_0x4dc0fa(_0x4e9086[_0xb040('0x15')][_0xb040('0x14')]);}})['catch'](function(_0x384353){logger[_0xb040('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x408905,_0x384353);_0x2d7f21(_0x384353);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 3c471ee..35c78bc 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(_0x11bd20,_0x59bded){var _0x25be44=function(_0x248bff){while(--_0x248bff){_0x11bd20['push'](_0x11bd20['shift']());}};_0x25be44(++_0x59bded);}(_0xe706,0xa3));var _0x6e70=function(_0x6f0911,_0x5721c6){_0x6f0911=_0x6f0911-0x0;var _0x48cf3b=_0xe706[_0x6f0911];return _0x48cf3b;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x261643,_0x192def){var _0x56e3cb=function(_0x37da46){while(--_0x37da46){_0x261643['push'](_0x261643['shift']());}};_0x56e3cb(++_0x192def);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x136a0d,_0x476fe2){_0x136a0d=_0x136a0d-0x0;var _0x212ea5=_0xcb91[_0x136a0d];return _0x212ea5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 7c3cf3b..80976d7 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 _0x477f=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x4374fb,_0x3819b9){var _0x4ca7fe=function(_0x5f43be){while(--_0x5f43be){_0x4374fb['push'](_0x4374fb['shift']());}};_0x4ca7fe(++_0x3819b9);}(_0x477f,0x1dc));var _0xf477=function(_0x498772,_0x2388fb){_0x498772=_0x498772-0x0;var _0x22d890=_0x477f[_0x498772];return _0x22d890;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xf477('0x0')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xf477('0x1')},'membername':{'type':Sequelize[_0xf477('0x2')],'allowNull':![],'comment':_0xf477('0x1')},'UserId':{'type':Sequelize[_0xf477('0x0')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xf477('0x2')],'allowNull':![],'unique':_0xf477('0x3'),'comment':_0xf477('0x1')},'VoiceQueueId':{'type':Sequelize[_0xf477('0x0')],'allowNull':![]},'interface':{'type':Sequelize[_0xf477('0x2')],'allowNull':![],'unique':_0xf477('0x3'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0xf477('0x0')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xf477('0x1')}}; \ No newline at end of file +var _0xc9e6=['queue_interface','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x1d472e,_0x181da6){var _0x9344b3=function(_0x1c4402){while(--_0x1c4402){_0x1d472e['push'](_0x1d472e['shift']());}};_0x9344b3(++_0x181da6);}(_0xc9e6,0x1a9));var _0x6c9e=function(_0x45ad02,_0x26cd82){_0x45ad02=_0x45ad02-0x0;var _0x1cac12=_0xc9e6[_0x45ad02];return _0x1cac12;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x6c9e('0x0')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x6c9e('0x1')},'membername':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':![],'comment':_0x6c9e('0x1')},'UserId':{'type':Sequelize[_0x6c9e('0x0')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6c9e('0x3'),'comment':_0x6c9e('0x1')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':![],'unique':_0x6c9e('0x3'),'comment':_0x6c9e('0x1')},'penalty':{'type':Sequelize[_0x6c9e('0x0')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x6c9e('0x0')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 6632024..87d4505 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 _0xe872=['save','update','emit','hook','exports','events','UserVoiceQueueRt'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0xe872,0x186));var _0x2e87=function(_0x4085cc,_0x554cee){_0x4085cc=_0x4085cc-0x0;var _0x23e552=_0xe872[_0x4085cc];return _0x23e552;};'use strict';var EventEmitter=require(_0x2e87('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x2e87('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2e87('0x2'),'afterUpdate':_0x2e87('0x3'),'afterDestroy':'remove'};function emitEvent(_0x252060){return function(_0x136d78,_0x4116ed,_0x2d1715){UserVoiceQueueRtEvents[_0x2e87('0x4')](_0x252060+':'+_0x136d78['id'],_0x136d78);UserVoiceQueueRtEvents[_0x2e87('0x4')](_0x252060,_0x136d78);_0x2d1715(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x2e87('0x5')](e,emitEvent(event));}}module[_0x2e87('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x5067=['emit','hook','exports','events','UserVoiceQueueRt','setMaxListeners','remove'];(function(_0x3b93ca,_0x1e8709){var _0x1b0d9c=function(_0x80ab81){while(--_0x80ab81){_0x3b93ca['push'](_0x3b93ca['shift']());}};_0x1b0d9c(++_0x1e8709);}(_0x5067,0xe3));var _0x7506=function(_0x20bb88,_0x4abe7f){_0x20bb88=_0x20bb88-0x0;var _0x8a8aab=_0x5067[_0x20bb88];return _0x8a8aab;};'use strict';var EventEmitter=require(_0x7506('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x7506('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x7506('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7506('0x3')};function emitEvent(_0x5291e7){return function(_0x501c42,_0x178691,_0x3e23ff){UserVoiceQueueRtEvents['emit'](_0x5291e7+':'+_0x501c42['id'],_0x501c42);UserVoiceQueueRtEvents[_0x7506('0x4')](_0x5291e7,_0x501c42);_0x3e23ff(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x7506('0x5')](e,emitEvent(event));}}module[_0x7506('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index a12fe35..ea4cfbe 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 _0x61bf=['path','../../config/environment','./userVoiceQueueRt.attributes','exports','define','user_has_voice_queues_rt','lodash','util','../../config/logger','moment','request-promise'];(function(_0x47739c,_0x194604){var _0x2b5dbb=function(_0x232846){while(--_0x232846){_0x47739c['push'](_0x47739c['shift']());}};_0x2b5dbb(++_0x194604);}(_0x61bf,0x166));var _0xf61b=function(_0xf9ab75,_0xfaeaa9){_0xf9ab75=_0xf9ab75-0x0;var _0x224790=_0x61bf[_0xf9ab75];return _0x224790;};'use strict';var _=require(_0xf61b('0x0'));var util=require(_0xf61b('0x1'));var logger=require(_0xf61b('0x2'))('api');var moment=require(_0xf61b('0x3'));var BPromise=require('bluebird');var rp=require(_0xf61b('0x4'));var fs=require('fs');var path=require(_0xf61b('0x5'));var rimraf=require('rimraf');var config=require(_0xf61b('0x6'));var attributes=require(_0xf61b('0x7'));module[_0xf61b('0x8')]=function(_0x165959,_0x3e422c){return _0x165959[_0xf61b('0x9')]('UserVoiceQueueRt',attributes,{'tableName':_0xf61b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc520=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util'];(function(_0x5df98f,_0x140e19){var _0x4e6900=function(_0xe73e1a){while(--_0xe73e1a){_0x5df98f['push'](_0x5df98f['shift']());}};_0x4e6900(++_0x140e19);}(_0xc520,0x112));var _0x0c52=function(_0x3324f7,_0x31218f){_0x3324f7=_0x3324f7-0x0;var _0x3f27a3=_0xc520[_0x3324f7];return _0x3f27a3;};'use strict';var _=require(_0x0c52('0x0'));var util=require(_0x0c52('0x1'));var logger=require(_0x0c52('0x2'))('api');var moment=require(_0x0c52('0x3'));var BPromise=require(_0x0c52('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c52('0x5'));var rimraf=require(_0x0c52('0x6'));var config=require(_0x0c52('0x7'));var attributes=require(_0x0c52('0x8'));module['exports']=function(_0x566e13,_0x42058a){return _0x566e13[_0x0c52('0x9')](_0x0c52('0xa'),attributes,{'tableName':_0x0c52('0xb'),'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 56e8305..1e636dc 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 _0xacbd=['catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./userVoiceQueueRt.socket','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1c5391,_0x233c3f){var _0x2643be=function(_0x42a3e5){while(--_0x42a3e5){_0x1c5391['push'](_0x1c5391['shift']());}};_0x2643be(++_0x233c3f);}(_0xacbd,0x116));var _0xdacb=function(_0x5eca26,_0x3b609e){_0x5eca26=_0x5eca26-0x0;var _0x2e7a53=_0xacbd[_0x5eca26];return _0x2e7a53;};'use strict';var _=require(_0xdacb('0x0'));var util=require(_0xdacb('0x1'));var moment=require(_0xdacb('0x2'));var BPromise=require('bluebird');var rs=require(_0xdacb('0x3'));var fs=require('fs');var Redis=require(_0xdacb('0x4'));var db=require(_0xdacb('0x5'))['db'];var utils=require(_0xdacb('0x6'));var logger=require(_0xdacb('0x7'))(_0xdacb('0x8'));var config=require(_0xdacb('0x9'));var jayson=require(_0xdacb('0xa'));var client=jayson['client'][_0xdacb('0xb')]({'port':0x232a});config[_0xdacb('0xc')]=_[_0xdacb('0xd')](config['redis'],{'host':_0xdacb('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdacb('0xc')]));require(_0xdacb('0xf'))['register'](socket);function respondWithRpcPromise(_0x22bc0f,_0xedc079,_0x396ab5){return new BPromise(function(_0x13fc80,_0x54232a){return client['request'](_0x22bc0f,_0x396ab5)[_0xdacb('0x10')](function(_0x4a2b5b){logger[_0xdacb('0x11')](_0xdacb('0x12'),_0xedc079,_0xdacb('0x13'));logger['debug'](_0xdacb('0x14'),_0xedc079,'request\x20sent',JSON[_0xdacb('0x15')](_0x4a2b5b));if(_0x4a2b5b['error']){if(_0x4a2b5b[_0xdacb('0x16')][_0xdacb('0x17')]===0x1f4){logger['error'](_0xdacb('0x12'),_0xedc079,_0x4a2b5b[_0xdacb('0x16')][_0xdacb('0x18')]);return _0x54232a(_0x4a2b5b[_0xdacb('0x16')][_0xdacb('0x18')]);}logger[_0xdacb('0x16')](_0xdacb('0x12'),_0xedc079,_0x4a2b5b[_0xdacb('0x16')][_0xdacb('0x18')]);return _0x13fc80(_0x4a2b5b[_0xdacb('0x16')][_0xdacb('0x18')]);}else{logger[_0xdacb('0x11')](_0xdacb('0x12'),_0xedc079,_0xdacb('0x13'));_0x13fc80(_0x4a2b5b[_0xdacb('0x19')][_0xdacb('0x18')]);}})[_0xdacb('0x1a')](function(_0x6d1e28){logger['error'](_0xdacb('0x12'),_0xedc079,_0x6d1e28);_0x54232a(_0x6d1e28);});});}exports[_0xdacb('0x1b')]=function(_0x2a95a1){var _0x372e1f=this;return new Promise(function(_0xabe700,_0x5a4391){return db[_0xdacb('0x1c')][_0xdacb('0x1d')]({'raw':_0x2a95a1['options']?_0x2a95a1[_0xdacb('0x1e')][_0xdacb('0x1f')]===undefined?!![]:![]:!![],'where':_0x2a95a1[_0xdacb('0x1e')]?_0x2a95a1[_0xdacb('0x1e')]['where']||null:null,'attributes':[[db[_0xdacb('0x20')]['fn'](_0xdacb('0x21'),db[_0xdacb('0x20')]['fn']('IF',db['sequelize'][_0xdacb('0x22')](_0xdacb('0x23')))),_0xdacb('0x24')]]})[_0xdacb('0x10')](function(_0x4596be){logger[_0xdacb('0x11')](_0xdacb('0x1b'),_0x2a95a1);logger[_0xdacb('0x25')]('GetVoiceQueueRtPauses',_0x2a95a1,JSON[_0xdacb('0x15')](_0x4596be));_0xabe700(_0x4596be);})[_0xdacb('0x1a')](function(_0x38ee1c){logger[_0xdacb('0x16')]('GetVoiceQueueRtPauses',_0x38ee1c['message'],_0x2a95a1);_0x5a4391(_0x372e1f[_0xdacb('0x16')](0x1f4,_0x38ee1c[_0xdacb('0x18')]));});});}; \ No newline at end of file +var _0x9136=['code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x160cd7,_0x315362){var _0x4c34f2=function(_0x55c3c6){while(--_0x55c3c6){_0x160cd7['push'](_0x160cd7['shift']());}};_0x4c34f2(++_0x315362);}(_0x9136,0x147));var _0x6913=function(_0xf13b1b,_0x2fc837){_0xf13b1b=_0xf13b1b-0x0;var _0x28286f=_0x9136[_0xf13b1b];return _0x28286f;};'use strict';var _=require('lodash');var util=require(_0x6913('0x0'));var moment=require(_0x6913('0x1'));var BPromise=require('bluebird');var rs=require(_0x6913('0x2'));var fs=require('fs');var Redis=require(_0x6913('0x3'));var db=require(_0x6913('0x4'))['db'];var utils=require(_0x6913('0x5'));var logger=require(_0x6913('0x6'))(_0x6913('0x7'));var config=require(_0x6913('0x8'));var jayson=require(_0x6913('0x9'));var client=jayson['client'][_0x6913('0xa')]({'port':0x232a});config[_0x6913('0xb')]=_[_0x6913('0xc')](config[_0x6913('0xb')],{'host':_0x6913('0xd'),'port':0x18eb});var socket=require(_0x6913('0xe'))(new Redis(config[_0x6913('0xb')]));require(_0x6913('0xf'))['register'](socket);function respondWithRpcPromise(_0x59fa4a,_0xc66438,_0x1ba5b3){return new BPromise(function(_0x539082,_0x149128){return client[_0x6913('0x10')](_0x59fa4a,_0x1ba5b3)['then'](function(_0x3dbfe2){logger[_0x6913('0x11')](_0x6913('0x12'),_0xc66438,_0x6913('0x13'));logger[_0x6913('0x14')](_0x6913('0x15'),_0xc66438,_0x6913('0x13'),JSON[_0x6913('0x16')](_0x3dbfe2));if(_0x3dbfe2[_0x6913('0x17')]){if(_0x3dbfe2['error'][_0x6913('0x18')]===0x1f4){logger[_0x6913('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0xc66438,_0x3dbfe2[_0x6913('0x17')][_0x6913('0x19')]);return _0x149128(_0x3dbfe2['error'][_0x6913('0x19')]);}logger['error'](_0x6913('0x12'),_0xc66438,_0x3dbfe2[_0x6913('0x17')][_0x6913('0x19')]);return _0x539082(_0x3dbfe2[_0x6913('0x17')][_0x6913('0x19')]);}else{logger[_0x6913('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0xc66438,'request\x20sent');_0x539082(_0x3dbfe2[_0x6913('0x1a')][_0x6913('0x19')]);}})[_0x6913('0x1b')](function(_0x1a9b9b){logger[_0x6913('0x17')](_0x6913('0x12'),_0xc66438,_0x1a9b9b);_0x149128(_0x1a9b9b);});});}exports[_0x6913('0x1c')]=function(_0x403ccc){var _0x544a8d=this;return new Promise(function(_0x1313bd,_0x5d25f1){return db[_0x6913('0x1d')][_0x6913('0x1e')]({'raw':_0x403ccc[_0x6913('0x1f')]?_0x403ccc['options'][_0x6913('0x20')]===undefined?!![]:![]:!![],'where':_0x403ccc[_0x6913('0x1f')]?_0x403ccc['options']['where']||null:null,'attributes':[[db[_0x6913('0x21')]['fn'](_0x6913('0x22'),db[_0x6913('0x21')]['fn']('IF',db['sequelize'][_0x6913('0x23')](_0x6913('0x24')))),_0x6913('0x25')]]})[_0x6913('0x26')](function(_0x3ac920){logger[_0x6913('0x11')]('GetVoiceQueueRtPauses',_0x403ccc);logger[_0x6913('0x14')](_0x6913('0x1c'),_0x403ccc,JSON[_0x6913('0x16')](_0x3ac920));_0x1313bd(_0x3ac920);})[_0x6913('0x1b')](function(_0x24eeff){logger[_0x6913('0x17')](_0x6913('0x1c'),_0x24eeff[_0x6913('0x19')],_0x403ccc);_0x5d25f1(_0x544a8d[_0x6913('0x17')](0x1f4,_0x24eeff[_0x6913('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 1080107..e679631 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 _0xf96b=['length','./userVoiceQueueRt.events','save','remove','update','emit','removeListener','register'];(function(_0x4bd67a,_0x4f9725){var _0x2be5fb=function(_0x33e132){while(--_0x33e132){_0x4bd67a['push'](_0x4bd67a['shift']());}};_0x2be5fb(++_0x4f9725);}(_0xf96b,0x109));var _0xbf96=function(_0x1ea106,_0x48787d){_0x1ea106=_0x1ea106-0x0;var _0x1dae19=_0xf96b[_0x1ea106];return _0x1dae19;};'use strict';var UserVoiceQueueRtEvents=require(_0xbf96('0x0'));var events=[_0xbf96('0x1'),_0xbf96('0x2'),_0xbf96('0x3')];function createListener(_0x29e6f2,_0x34b226){return function(_0x440d4e){_0x34b226[_0xbf96('0x4')](_0x29e6f2,_0x440d4e);};}function removeListener(_0x42be7e,_0x38565){return function(){UserVoiceQueueRtEvents[_0xbf96('0x5')](_0x42be7e,_0x38565);};}exports[_0xbf96('0x6')]=function(_0x162c19){for(var _0x4de1c3=0x0,_0x3e8271=events[_0xbf96('0x7')];_0x4de1c3<_0x3e8271;_0x4de1c3++){var _0x260da0=events[_0x4de1c3];var _0x88b9fa=createListener('userVoiceQueueRt:'+_0x260da0,_0x162c19);UserVoiceQueueRtEvents['on'](_0x260da0,_0x88b9fa);}}; \ No newline at end of file +var _0xb76d=['userVoiceQueueRt:','./userVoiceQueueRt.events','remove','update','emit','removeListener','register','length'];(function(_0x149cf1,_0x29fbc7){var _0x50d71b=function(_0x36df13){while(--_0x36df13){_0x149cf1['push'](_0x149cf1['shift']());}};_0x50d71b(++_0x29fbc7);}(_0xb76d,0x119));var _0xdb76=function(_0xbf755e,_0x24ae8f){_0xbf755e=_0xbf755e-0x0;var _0x4113f8=_0xb76d[_0xbf755e];return _0x4113f8;};'use strict';var UserVoiceQueueRtEvents=require(_0xdb76('0x0'));var events=['save',_0xdb76('0x1'),_0xdb76('0x2')];function createListener(_0x3cd15e,_0x5376b1){return function(_0x2dca57){_0x5376b1[_0xdb76('0x3')](_0x3cd15e,_0x2dca57);};}function removeListener(_0x281c24,_0x371360){return function(){UserVoiceQueueRtEvents[_0xdb76('0x4')](_0x281c24,_0x371360);};}exports[_0xdb76('0x5')]=function(_0x5d80df){for(var _0xf1a18d=0x0,_0x39c442=events[_0xdb76('0x6')];_0xf1a18d<_0x39c442;_0xf1a18d++){var _0x3d80a0=events[_0xf1a18d];var _0x4e60dc=createListener(_0xdb76('0x7')+_0x3d80a0,_0x5d80df);UserVoiceQueueRtEvents['on'](_0x3d80a0,_0x4e60dc);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 7f8bc59..e2690b8 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3550e8,_0x424fea){var _0x18eb61=function(_0x2dcb49){while(--_0x2dcb49){_0x3550e8['push'](_0x3550e8['shift']());}};_0x18eb61(++_0x424fea);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1a459b,_0x4e4c56){var _0x5118ca=function(_0x4ff461){while(--_0x4ff461){_0x1a459b['push'](_0x1a459b['shift']());}};_0x5118ca(++_0x4e4c56);}(_0xe706,0xa3));var _0x6e70=function(_0x41d02a,_0x355e19){_0x41d02a=_0x41d02a-0x0;var _0x4c3983=_0xe706[_0x41d02a];return _0x4c3983;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 8d8fbc8..6784af4 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 _0xb20a=['exports'];(function(_0x1d09a1,_0x43d1ca){var _0x193fec=function(_0x49c706){while(--_0x49c706){_0x1d09a1['push'](_0x1d09a1['shift']());}};_0x193fec(++_0x43d1ca);}(_0xb20a,0x167));var _0xab20=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xb20a[_0x24f31b];return _0x488401;};'use strict';var Sequelize=require('sequelize');module[_0xab20('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x9425=['exports','sequelize'];(function(_0x5b9ee0,_0x41f4d2){var _0x2e7593=function(_0x10310f){while(--_0x10310f){_0x5b9ee0['push'](_0x5b9ee0['shift']());}};_0x2e7593(++_0x41f4d2);}(_0x9425,0x1cb));var _0x5942=function(_0x31f2f8,_0x305aea){_0x31f2f8=_0x31f2f8-0x0;var _0x506ac9=_0x9425[_0x31f2f8];return _0x506ac9;};'use strict';var Sequelize=require(_0x5942('0x0'));module[_0x5942('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 5f0f443..a84e1b3 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 _0xbc44=['define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x2c2568,_0x36e52b){var _0x54c73a=function(_0x3f8849){while(--_0x3f8849){_0x2c2568['push'](_0x2c2568['shift']());}};_0x54c73a(++_0x36e52b);}(_0xbc44,0x18f));var _0x4bc4=function(_0x14a7cd,_0x3ef92){_0x14a7cd=_0x14a7cd-0x0;var _0x54191c=_0xbc44[_0x14a7cd];return _0x54191c;};'use strict';var _=require(_0x4bc4('0x0'));var util=require('util');var logger=require(_0x4bc4('0x1'))('api');var moment=require(_0x4bc4('0x2'));var BPromise=require('bluebird');var rp=require(_0x4bc4('0x3'));var fs=require('fs');var path=require(_0x4bc4('0x4'));var rimraf=require(_0x4bc4('0x5'));var config=require(_0x4bc4('0x6'));var attributes=require('./userWhatsappQueue.attributes');module[_0x4bc4('0x7')]=function(_0x2fa2fa,_0x94ec9e){return _0x2fa2fa[_0x4bc4('0x8')](_0x4bc4('0x9'),attributes,{'tableName':_0x4bc4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4ce=['rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','util','api','moment','bluebird'];(function(_0x14ef5e,_0x220cab){var _0x2be983=function(_0x5b1b23){while(--_0x5b1b23){_0x14ef5e['push'](_0x14ef5e['shift']());}};_0x2be983(++_0x220cab);}(_0xe4ce,0xc4));var _0xee4c=function(_0x2d8014,_0x3fcecc){_0x2d8014=_0x2d8014-0x0;var _0x2b6727=_0xe4ce[_0x2d8014];return _0x2b6727;};'use strict';var _=require('lodash');var util=require(_0xee4c('0x0'));var logger=require('../../config/logger')(_0xee4c('0x1'));var moment=require(_0xee4c('0x2'));var BPromise=require(_0xee4c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xee4c('0x4'));var config=require(_0xee4c('0x5'));var attributes=require(_0xee4c('0x6'));module[_0xee4c('0x7')]=function(_0x371924,_0x1239d9){return _0x371924[_0xee4c('0x8')](_0xee4c('0x9'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 3fbd7b2..975ad24 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 _0xcda5=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','message','result','util','randomstring','ioredis'];(function(_0x3f651b,_0x2fa70f){var _0x27ce4b=function(_0x517597){while(--_0x517597){_0x3f651b['push'](_0x3f651b['shift']());}};_0x27ce4b(++_0x2fa70f);}(_0xcda5,0xf4));var _0x5cda=function(_0x101e27,_0x11de14){_0x101e27=_0x101e27-0x0;var _0x4094e5=_0xcda5[_0x101e27];return _0x4094e5;};'use strict';var _=require('lodash');var util=require(_0x5cda('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5cda('0x1'));var fs=require('fs');var Redis=require(_0x5cda('0x2'));var db=require(_0x5cda('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5cda('0x4'))(_0x5cda('0x5'));var config=require('../../config/environment');var jayson=require(_0x5cda('0x6'));var client=jayson[_0x5cda('0x7')][_0x5cda('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x256caf,_0x3cc239,_0x5420d9){return new BPromise(function(_0x3ee51b,_0x3d664f){return client[_0x5cda('0x9')](_0x256caf,_0x5420d9)[_0x5cda('0xa')](function(_0x15b134){logger[_0x5cda('0xb')](_0x5cda('0xc'),_0x3cc239,_0x5cda('0xd'));logger[_0x5cda('0xe')](_0x5cda('0xf'),_0x3cc239,_0x5cda('0xd'),JSON['stringify'](_0x15b134));if(_0x15b134[_0x5cda('0x10')]){if(_0x15b134['error']['code']===0x1f4){logger[_0x5cda('0x10')](_0x5cda('0xc'),_0x3cc239,_0x15b134['error'][_0x5cda('0x11')]);return _0x3d664f(_0x15b134[_0x5cda('0x10')][_0x5cda('0x11')]);}logger[_0x5cda('0x10')](_0x5cda('0xc'),_0x3cc239,_0x15b134[_0x5cda('0x10')]['message']);return _0x3ee51b(_0x15b134[_0x5cda('0x10')][_0x5cda('0x11')]);}else{logger[_0x5cda('0xb')](_0x5cda('0xc'),_0x3cc239,_0x5cda('0xd'));_0x3ee51b(_0x15b134[_0x5cda('0x12')][_0x5cda('0x11')]);}})['catch'](function(_0x4bcdf0){logger[_0x5cda('0x10')](_0x5cda('0xc'),_0x3cc239,_0x4bcdf0);_0x3d664f(_0x4bcdf0);});});} \ No newline at end of file +var _0x0102=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x290eef,_0x4635a3){var _0x21c635=function(_0x43957a){while(--_0x43957a){_0x290eef['push'](_0x290eef['shift']());}};_0x21c635(++_0x4635a3);}(_0x0102,0x1b6));var _0x2010=function(_0x197e67,_0x40c02d){_0x197e67=_0x197e67-0x0;var _0x4cb246=_0x0102[_0x197e67];return _0x4cb246;};'use strict';var _=require(_0x2010('0x0'));var util=require(_0x2010('0x1'));var moment=require(_0x2010('0x2'));var BPromise=require('bluebird');var rs=require(_0x2010('0x3'));var fs=require('fs');var Redis=require(_0x2010('0x4'));var db=require(_0x2010('0x5'))['db'];var utils=require(_0x2010('0x6'));var logger=require(_0x2010('0x7'))(_0x2010('0x8'));var config=require('../../config/environment');var jayson=require(_0x2010('0x9'));var client=jayson[_0x2010('0xa')][_0x2010('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x391c67,_0x17027f,_0x3c9b96){return new BPromise(function(_0x233fcb,_0x1e3864){return client[_0x2010('0xc')](_0x391c67,_0x3c9b96)['then'](function(_0x302b90){logger['info'](_0x2010('0xd'),_0x17027f,_0x2010('0xe'));logger[_0x2010('0xf')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x17027f,_0x2010('0xe'),JSON[_0x2010('0x10')](_0x302b90));if(_0x302b90[_0x2010('0x11')]){if(_0x302b90[_0x2010('0x11')][_0x2010('0x12')]===0x1f4){logger[_0x2010('0x11')](_0x2010('0xd'),_0x17027f,_0x302b90[_0x2010('0x11')]['message']);return _0x1e3864(_0x302b90['error'][_0x2010('0x13')]);}logger[_0x2010('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x17027f,_0x302b90[_0x2010('0x11')][_0x2010('0x13')]);return _0x233fcb(_0x302b90['error']['message']);}else{logger[_0x2010('0x14')]('UserWhatsappQueue,\x20%s,\x20%s',_0x17027f,_0x2010('0xe'));_0x233fcb(_0x302b90['result']['message']);}})[_0x2010('0x15')](function(_0x119e93){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x17027f,_0x119e93);_0x1e3864(_0x119e93);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 6c5cdef..7716683 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 _0xc43c=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./variable.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util'];(function(_0x41f745,_0x4b5c4a){var _0x2cbbcb=function(_0x4d5c74){while(--_0x4d5c74){_0x41f745['push'](_0x41f745['shift']());}};_0x2cbbcb(++_0x4b5c4a);}(_0xc43c,0x152));var _0xcc43=function(_0x36b28f,_0x5631b8){_0x36b28f=_0x36b28f-0x0;var _0xffc6d8=_0xc43c[_0x36b28f];return _0xffc6d8;};'use strict';var multer=require(_0xcc43('0x0'));var util=require(_0xcc43('0x1'));var path=require(_0xcc43('0x2'));var timeout=require(_0xcc43('0x3'));var express=require(_0xcc43('0x4'));var router=express[_0xcc43('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xcc43('0x6'));var interaction=require(_0xcc43('0x7'));var config=require('../../config/environment');var controller=require(_0xcc43('0x8'));router[_0xcc43('0x9')]('/',auth[_0xcc43('0xa')](),controller[_0xcc43('0xb')]);router[_0xcc43('0x9')](_0xcc43('0xc'),auth[_0xcc43('0xa')](),controller[_0xcc43('0xd')]);router[_0xcc43('0xe')]('/',auth[_0xcc43('0xa')](),controller['create']);router[_0xcc43('0xf')](_0xcc43('0xc'),auth[_0xcc43('0xa')](),controller[_0xcc43('0x10')]);router[_0xcc43('0x11')](_0xcc43('0xc'),auth['isAuthenticated'](),controller[_0xcc43('0x12')]);module[_0xcc43('0x13')]=router; \ No newline at end of file +var _0xb377=['update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','show','post','isAuthenticated','create','put','/:id'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0xb377,0x1b6));var _0x7b37=function(_0x987717,_0x4dfeaa){_0x987717=_0x987717-0x0;var _0x322fda=_0xb377[_0x987717];return _0x322fda;};'use strict';var multer=require(_0x7b37('0x0'));var util=require(_0x7b37('0x1'));var path=require(_0x7b37('0x2'));var timeout=require(_0x7b37('0x3'));var express=require(_0x7b37('0x4'));var router=express[_0x7b37('0x5')]();var fs_extra=require(_0x7b37('0x6'));var auth=require(_0x7b37('0x7'));var interaction=require(_0x7b37('0x8'));var config=require(_0x7b37('0x9'));var controller=require(_0x7b37('0xa'));router[_0x7b37('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b37('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7b37('0xc')]);router[_0x7b37('0xd')]('/',auth[_0x7b37('0xe')](),controller[_0x7b37('0xf')]);router[_0x7b37('0x10')](_0x7b37('0x11'),auth[_0x7b37('0xe')](),controller[_0x7b37('0x12')]);router['delete'](_0x7b37('0x11'),auth[_0x7b37('0xe')](),controller['destroy']);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 dbbc3af..9a4839b 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 _0x3baf=['exports','STRING','name','sequelize'];(function(_0x49f368,_0xf070e2){var _0x3923f3=function(_0x5a313a){while(--_0x5a313a){_0x49f368['push'](_0x49f368['shift']());}};_0x3923f3(++_0xf070e2);}(_0x3baf,0xf7));var _0xf3ba=function(_0x3dcec5,_0x4a2304){_0x3dcec5=_0x3dcec5-0x0;var _0x2d211b=_0x3baf[_0x3dcec5];return _0x2d211b;};'use strict';var Sequelize=require(_0xf3ba('0x0'));module[_0xf3ba('0x1')]={'name':{'type':Sequelize[_0xf3ba('0x2')],'unique':_0xf3ba('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf3ba('0x2')]}}; \ No newline at end of file +var _0x5b93=['STRING'];(function(_0x3a607e,_0x54d530){var _0x37b106=function(_0x1becae){while(--_0x1becae){_0x3a607e['push'](_0x3a607e['shift']());}};_0x37b106(++_0x54d530);}(_0x5b93,0x152));var _0x35b9=function(_0x289c06,_0x576e58){_0x289c06=_0x289c06-0x0;var _0x49a514=_0x5b93[_0x289c06];return _0x49a514;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x35b9('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x35b9('0x0')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index d786c77..fe694e5 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 _0xafe7=['sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','Variables','UserProfileResource','stack','name','send','index','map','Variable','rawAttributes','key','query','filters','intersection','model','attributes','order','sort','pick','filter','where','VIRTUAL','includeAll','include','findAll','params','keys','length','merge','options','find','catch','create','body','user','role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x295a5c,_0xfd0b5){var _0x53339e=function(_0x5ee71d){while(--_0x5ee71d){_0x295a5c['push'](_0x295a5c['shift']());}};_0x53339e(++_0xfd0b5);}(_0xafe7,0xe8));var _0x7afe=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xafe7[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require(_0x7afe('0x0'));var rimraf=require(_0x7afe('0x1'));var zipdir=require(_0x7afe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7afe('0x3'));var moment=require(_0x7afe('0x4'));var BPromise=require(_0x7afe('0x5'));var Mustache=require(_0x7afe('0x6'));var util=require(_0x7afe('0x7'));var path=require('path');var sox=require(_0x7afe('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7afe('0x9'));var _=require(_0x7afe('0xa'));var squel=require(_0x7afe('0xb'));var crypto=require(_0x7afe('0xc'));var jsforce=require(_0x7afe('0xd'));var deskjs=require(_0x7afe('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7afe('0xf'));var Papa=require(_0x7afe('0x10'));var Redis=require(_0x7afe('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7afe('0x12'));var as=require(_0x7afe('0x13'));var hardwareService=require(_0x7afe('0x14'));var logger=require(_0x7afe('0x15'))(_0x7afe('0x16'));var utils=require('../../config/utils');var config=require(_0x7afe('0x17'));var licenseUtil=require(_0x7afe('0x18'));var db=require(_0x7afe('0x19'))['db'];function respondWithStatusCode(_0x248b5b,_0x40f258){_0x40f258=_0x40f258||0xcc;return function(_0x1393e2){if(_0x1393e2){return _0x248b5b[_0x7afe('0x1a')](_0x40f258);}return _0x248b5b[_0x7afe('0x1b')](_0x40f258)[_0x7afe('0x1c')]();};}function respondWithResult(_0x292150,_0x46e5f5){_0x46e5f5=_0x46e5f5||0xc8;return function(_0x4b0f0e){if(_0x4b0f0e){return _0x292150['status'](_0x46e5f5)[_0x7afe('0x1d')](_0x4b0f0e);}};}function respondWithFilteredResult(_0x345a4f,_0x77d33d){return function(_0x417144){if(_0x417144){var _0x57baa7=typeof _0x77d33d[_0x7afe('0x1e')]===_0x7afe('0x1f')&&typeof _0x77d33d[_0x7afe('0x20')]==='undefined';var _0x553bcc=_0x417144[_0x7afe('0x21')];var _0x559a2a=_0x57baa7?0x0:_0x77d33d['offset'];var _0x1513ff=_0x57baa7?_0x417144['count']:_0x77d33d[_0x7afe('0x1e')]+_0x77d33d[_0x7afe('0x20')];var _0x935c4d;if(_0x1513ff>=_0x553bcc){_0x1513ff=_0x553bcc;_0x935c4d=0xc8;}else{_0x935c4d=0xce;}_0x345a4f['status'](_0x935c4d);return _0x345a4f[_0x7afe('0x22')](_0x7afe('0x23'),_0x559a2a+'-'+_0x1513ff+'/'+_0x553bcc)[_0x7afe('0x1d')](_0x417144);}return null;};}function patchUpdates(_0x42e318){return function(_0x2d4f29){try{jsonpatch['apply'](_0x2d4f29,_0x42e318,!![]);}catch(_0xb3507a){return BPromise[_0x7afe('0x24')](_0xb3507a);}return _0x2d4f29[_0x7afe('0x25')]();};}function saveUpdates(_0x380ecb,_0x28b911){return function(_0x3a3691){if(_0x3a3691){return _0x3a3691[_0x7afe('0x26')](_0x380ecb)[_0x7afe('0x27')](function(_0x17f903){return _0x17f903;});}return null;};}function removeEntity(_0x5e0d11,_0x5088f2){return function(_0x3589a2){if(_0x3589a2){return _0x3589a2[_0x7afe('0x28')]()[_0x7afe('0x27')](function(){var _0x107087=_0x3589a2[_0x7afe('0x29')]({'plain':!![]});var _0xe98882=_0x7afe('0x2a');return db[_0x7afe('0x2b')][_0x7afe('0x28')]({'where':{'type':_0xe98882,'resourceId':_0x107087['id']}})[_0x7afe('0x27')](function(){return _0x3589a2;});})[_0x7afe('0x27')](function(){_0x5e0d11[_0x7afe('0x1b')](0xcc)[_0x7afe('0x1c')]();});}};}function handleEntityNotFound(_0x535078,_0x456ad9){return function(_0x53ba29){if(!_0x53ba29){_0x535078['sendStatus'](0x194);}return _0x53ba29;};}function handleError(_0x4eb085,_0x456e52){_0x456e52=_0x456e52||0x1f4;return function(_0x1c369a){logger['error'](_0x1c369a[_0x7afe('0x2c')]);if(_0x1c369a[_0x7afe('0x2d')]){delete _0x1c369a[_0x7afe('0x2d')];}_0x4eb085['status'](_0x456e52)[_0x7afe('0x2e')](_0x1c369a);};}exports[_0x7afe('0x2f')]=function(_0x22620a,_0x514ece){var _0xe4bef2={},_0x3d2e44={},_0x3c9b42={'count':0x0,'rows':[]};var _0x1e33fb=_[_0x7afe('0x30')](db[_0x7afe('0x31')][_0x7afe('0x32')],function(_0x9e38bb){return{'name':_0x9e38bb['fieldName'],'type':_0x9e38bb['type'][_0x7afe('0x33')]};});_0x3d2e44['model']=_['map'](_0x1e33fb,_0x7afe('0x2d'));_0x3d2e44[_0x7afe('0x34')]=_['keys'](_0x22620a[_0x7afe('0x34')]);_0x3d2e44[_0x7afe('0x35')]=_[_0x7afe('0x36')](_0x3d2e44[_0x7afe('0x37')],_0x3d2e44[_0x7afe('0x34')]);_0xe4bef2[_0x7afe('0x38')]=_[_0x7afe('0x36')](_0x3d2e44[_0x7afe('0x37')],qs['fields'](_0x22620a[_0x7afe('0x34')]['fields']));_0xe4bef2['attributes']=_0xe4bef2[_0x7afe('0x38')]['length']?_0xe4bef2[_0x7afe('0x38')]:_0x3d2e44[_0x7afe('0x37')];if(!_0x22620a[_0x7afe('0x34')]['hasOwnProperty']('nolimit')){_0xe4bef2[_0x7afe('0x20')]=qs[_0x7afe('0x20')](_0x22620a[_0x7afe('0x34')][_0x7afe('0x20')]);_0xe4bef2[_0x7afe('0x1e')]=qs[_0x7afe('0x1e')](_0x22620a[_0x7afe('0x34')][_0x7afe('0x1e')]);}_0xe4bef2[_0x7afe('0x39')]=qs[_0x7afe('0x3a')](_0x22620a[_0x7afe('0x34')][_0x7afe('0x3a')]);_0xe4bef2['where']=qs['filters'](_[_0x7afe('0x3b')](_0x22620a['query'],_0x3d2e44[_0x7afe('0x35')]),_0x1e33fb);if(_0x22620a[_0x7afe('0x34')][_0x7afe('0x3c')]){_0xe4bef2[_0x7afe('0x3d')]=_['merge'](_0xe4bef2[_0x7afe('0x3d')],{'$or':_[_0x7afe('0x30')](_0x1e33fb,function(_0x54396a){if(_0x54396a['type']!==_0x7afe('0x3e')){var _0x2ddd77={};_0x2ddd77[_0x54396a[_0x7afe('0x2d')]]={'$like':'%'+_0x22620a['query'][_0x7afe('0x3c')]+'%'};return _0x2ddd77;}})});}_0xe4bef2=_['merge']({},_0xe4bef2,_0x22620a['options']);var _0x1b641f={'where':_0xe4bef2[_0x7afe('0x3d')]};return db[_0x7afe('0x31')][_0x7afe('0x21')](_0x1b641f)[_0x7afe('0x27')](function(_0x4507ac){_0x3c9b42[_0x7afe('0x21')]=_0x4507ac;if(_0x22620a[_0x7afe('0x34')][_0x7afe('0x3f')]){_0xe4bef2[_0x7afe('0x40')]=[{'all':!![]}];}return db['Variable'][_0x7afe('0x41')](_0xe4bef2);})[_0x7afe('0x27')](function(_0x1bb184){_0x3c9b42['rows']=_0x1bb184;return _0x3c9b42;})[_0x7afe('0x27')](respondWithFilteredResult(_0x514ece,_0xe4bef2))['catch'](handleError(_0x514ece,null));};exports['show']=function(_0x4bdb48,_0x2ffca2){var _0x7500d6={'raw':!![],'where':{'id':_0x4bdb48[_0x7afe('0x42')]['id']}},_0x376b4f={};_0x376b4f[_0x7afe('0x37')]=_['keys'](db[_0x7afe('0x31')][_0x7afe('0x32')]);_0x376b4f[_0x7afe('0x34')]=_[_0x7afe('0x43')](_0x4bdb48[_0x7afe('0x34')]);_0x376b4f[_0x7afe('0x35')]=_['intersection'](_0x376b4f[_0x7afe('0x37')],_0x376b4f['query']);_0x7500d6[_0x7afe('0x38')]=_[_0x7afe('0x36')](_0x376b4f[_0x7afe('0x37')],qs['fields'](_0x4bdb48[_0x7afe('0x34')]['fields']));_0x7500d6['attributes']=_0x7500d6[_0x7afe('0x38')][_0x7afe('0x44')]?_0x7500d6[_0x7afe('0x38')]:_0x376b4f[_0x7afe('0x37')];if(_0x4bdb48[_0x7afe('0x34')][_0x7afe('0x3f')]){_0x7500d6[_0x7afe('0x40')]=[{'all':!![]}];}_0x7500d6=_[_0x7afe('0x45')]({},_0x7500d6,_0x4bdb48[_0x7afe('0x46')]);return db[_0x7afe('0x31')][_0x7afe('0x47')](_0x7500d6)['then'](handleEntityNotFound(_0x2ffca2,null))[_0x7afe('0x27')](respondWithResult(_0x2ffca2,null))[_0x7afe('0x48')](handleError(_0x2ffca2,null));};exports[_0x7afe('0x49')]=function(_0x3c8fb4,_0xc9ffaa){return db[_0x7afe('0x31')][_0x7afe('0x49')](_0x3c8fb4[_0x7afe('0x4a')],{})[_0x7afe('0x27')](function(_0x1eee54){var _0x2cc0ef=_0x3c8fb4[_0x7afe('0x4b')]['get']({'plain':!![]});if(!_0x2cc0ef)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2cc0ef[_0x7afe('0x4c')]===_0x7afe('0x4b')){var _0x68ac1c=_0x1eee54[_0x7afe('0x29')]({'plain':!![]});var _0x62201f=_0x7afe('0x2a');return db['UserProfileSection'][_0x7afe('0x47')]({'where':{'name':_0x62201f,'userProfileId':_0x2cc0ef[_0x7afe('0x4d')]},'raw':!![]})['then'](function(_0x2a8de0){if(_0x2a8de0&&_0x2a8de0['autoAssociation']===0x0){return db[_0x7afe('0x2b')]['create']({'name':_0x68ac1c['name'],'resourceId':_0x68ac1c['id'],'type':_0x2a8de0[_0x7afe('0x2d')],'sectionId':_0x2a8de0['id']},{})[_0x7afe('0x27')](function(){return _0x1eee54;});}else{return _0x1eee54;}})[_0x7afe('0x48')](function(_0x3f9da1){logger[_0x7afe('0x4e')](_0x7afe('0x4f'),_0x3f9da1);throw _0x3f9da1;});}return _0x1eee54;})[_0x7afe('0x27')](respondWithResult(_0xc9ffaa,0xc9))[_0x7afe('0x48')](handleError(_0xc9ffaa,null));};exports[_0x7afe('0x26')]=function(_0x116028,_0x219d26){if(_0x116028[_0x7afe('0x4a')]['id']){delete _0x116028[_0x7afe('0x4a')]['id'];}return db[_0x7afe('0x31')][_0x7afe('0x47')]({'where':{'id':_0x116028[_0x7afe('0x42')]['id']}})[_0x7afe('0x27')](handleEntityNotFound(_0x219d26,null))[_0x7afe('0x27')](saveUpdates(_0x116028[_0x7afe('0x4a')],null))[_0x7afe('0x27')](respondWithResult(_0x219d26,null))[_0x7afe('0x48')](handleError(_0x219d26,null));};exports[_0x7afe('0x28')]=function(_0x1dbeac,_0x415168){return db[_0x7afe('0x31')][_0x7afe('0x47')]({'where':{'id':_0x1dbeac['params']['id']}})[_0x7afe('0x27')](handleEntityNotFound(_0x415168,null))[_0x7afe('0x27')](removeEntity(_0x415168,null))[_0x7afe('0x48')](handleError(_0x415168,null));}; \ No newline at end of file +var _0xdaf8=['to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Variables','UserProfileResource','destroy','sendStatus','stack','name','send','index','map','Variable','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','rows','show','rawAttributes','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','catch','error','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x17c35f,_0x4d4be0){var _0x374403=function(_0x2e9e85){while(--_0x2e9e85){_0x17c35f['push'](_0x17c35f['shift']());}};_0x374403(++_0x4d4be0);}(_0xdaf8,0x19b));var _0x8daf=function(_0x33ede9,_0x24b0a4){_0x33ede9=_0x33ede9-0x0;var _0x5152a5=_0xdaf8[_0x33ede9];return _0x5152a5;};'use strict';var emlformat=require(_0x8daf('0x0'));var rimraf=require(_0x8daf('0x1'));var zipdir=require(_0x8daf('0x2'));var jsonpatch=require(_0x8daf('0x3'));var rp=require(_0x8daf('0x4'));var moment=require(_0x8daf('0x5'));var BPromise=require(_0x8daf('0x6'));var Mustache=require(_0x8daf('0x7'));var util=require(_0x8daf('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x8daf('0x9'));var ejs=require(_0x8daf('0xa'));var fs=require('fs');var fs_extra=require(_0x8daf('0xb'));var _=require(_0x8daf('0xc'));var squel=require(_0x8daf('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8daf('0xe'));var toCsv=require(_0x8daf('0x9'));var querystring=require(_0x8daf('0xf'));var Papa=require('papaparse');var Redis=require(_0x8daf('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8daf('0x11'));var as=require(_0x8daf('0x12'));var hardwareService=require(_0x8daf('0x13'));var logger=require('../../config/logger')(_0x8daf('0x14'));var utils=require('../../config/utils');var config=require(_0x8daf('0x15'));var licenseUtil=require(_0x8daf('0x16'));var db=require(_0x8daf('0x17'))['db'];function respondWithStatusCode(_0x1e0805,_0x51208e){_0x51208e=_0x51208e||0xcc;return function(_0x333a25){if(_0x333a25){return _0x1e0805['sendStatus'](_0x51208e);}return _0x1e0805[_0x8daf('0x18')](_0x51208e)[_0x8daf('0x19')]();};}function respondWithResult(_0x4c325c,_0x49a506){_0x49a506=_0x49a506||0xc8;return function(_0x4dad8f){if(_0x4dad8f){return _0x4c325c['status'](_0x49a506)['json'](_0x4dad8f);}};}function respondWithFilteredResult(_0x51e2b1,_0x10454a){return function(_0x4cc5cb){if(_0x4cc5cb){var _0x1f2e9e=typeof _0x10454a[_0x8daf('0x1a')]===_0x8daf('0x1b')&&typeof _0x10454a[_0x8daf('0x1c')]===_0x8daf('0x1b');var _0x5f2d59=_0x4cc5cb[_0x8daf('0x1d')];var _0x26d38f=_0x1f2e9e?0x0:_0x10454a[_0x8daf('0x1a')];var _0x4e2b82=_0x1f2e9e?_0x4cc5cb['count']:_0x10454a[_0x8daf('0x1a')]+_0x10454a[_0x8daf('0x1c')];var _0x2fe271;if(_0x4e2b82>=_0x5f2d59){_0x4e2b82=_0x5f2d59;_0x2fe271=0xc8;}else{_0x2fe271=0xce;}_0x51e2b1[_0x8daf('0x18')](_0x2fe271);return _0x51e2b1[_0x8daf('0x1e')](_0x8daf('0x1f'),_0x26d38f+'-'+_0x4e2b82+'/'+_0x5f2d59)['json'](_0x4cc5cb);}return null;};}function patchUpdates(_0x5d4ae6){return function(_0x45a650){try{jsonpatch[_0x8daf('0x20')](_0x45a650,_0x5d4ae6,!![]);}catch(_0x452831){return BPromise[_0x8daf('0x21')](_0x452831);}return _0x45a650[_0x8daf('0x22')]();};}function saveUpdates(_0x27b3ed,_0x41452){return function(_0x7fbdc1){if(_0x7fbdc1){return _0x7fbdc1[_0x8daf('0x23')](_0x27b3ed)[_0x8daf('0x24')](function(_0x672fa6){return _0x672fa6;});}return null;};}function removeEntity(_0x1df529,_0xaf842a){return function(_0x3cfd3c){if(_0x3cfd3c){return _0x3cfd3c['destroy']()['then'](function(){var _0x33cf2b=_0x3cfd3c[_0x8daf('0x25')]({'plain':!![]});var _0x5799b9=_0x8daf('0x26');return db[_0x8daf('0x27')][_0x8daf('0x28')]({'where':{'type':_0x5799b9,'resourceId':_0x33cf2b['id']}})[_0x8daf('0x24')](function(){return _0x3cfd3c;});})['then'](function(){_0x1df529[_0x8daf('0x18')](0xcc)[_0x8daf('0x19')]();});}};}function handleEntityNotFound(_0x5179dc,_0x2efeec){return function(_0x9020ed){if(!_0x9020ed){_0x5179dc[_0x8daf('0x29')](0x194);}return _0x9020ed;};}function handleError(_0x6c6581,_0x32cfd3){_0x32cfd3=_0x32cfd3||0x1f4;return function(_0x57fee4){logger['error'](_0x57fee4[_0x8daf('0x2a')]);if(_0x57fee4['name']){delete _0x57fee4[_0x8daf('0x2b')];}_0x6c6581[_0x8daf('0x18')](_0x32cfd3)[_0x8daf('0x2c')](_0x57fee4);};}exports[_0x8daf('0x2d')]=function(_0xd4fbca,_0x1c34aa){var _0x45c4c5={},_0x4b2c0c={},_0x6f63f3={'count':0x0,'rows':[]};var _0x1699dd=_[_0x8daf('0x2e')](db[_0x8daf('0x2f')]['rawAttributes'],function(_0x594a3d){return{'name':_0x594a3d[_0x8daf('0x30')],'type':_0x594a3d['type'][_0x8daf('0x31')]};});_0x4b2c0c['model']=_[_0x8daf('0x2e')](_0x1699dd,_0x8daf('0x2b'));_0x4b2c0c[_0x8daf('0x32')]=_[_0x8daf('0x33')](_0xd4fbca[_0x8daf('0x32')]);_0x4b2c0c[_0x8daf('0x34')]=_[_0x8daf('0x35')](_0x4b2c0c['model'],_0x4b2c0c[_0x8daf('0x32')]);_0x45c4c5[_0x8daf('0x36')]=_[_0x8daf('0x35')](_0x4b2c0c[_0x8daf('0x37')],qs[_0x8daf('0x38')](_0xd4fbca[_0x8daf('0x32')]['fields']));_0x45c4c5[_0x8daf('0x36')]=_0x45c4c5[_0x8daf('0x36')][_0x8daf('0x39')]?_0x45c4c5[_0x8daf('0x36')]:_0x4b2c0c[_0x8daf('0x37')];if(!_0xd4fbca['query'][_0x8daf('0x3a')]('nolimit')){_0x45c4c5[_0x8daf('0x1c')]=qs[_0x8daf('0x1c')](_0xd4fbca[_0x8daf('0x32')][_0x8daf('0x1c')]);_0x45c4c5['offset']=qs[_0x8daf('0x1a')](_0xd4fbca['query'][_0x8daf('0x1a')]);}_0x45c4c5[_0x8daf('0x3b')]=qs[_0x8daf('0x3c')](_0xd4fbca[_0x8daf('0x32')][_0x8daf('0x3c')]);_0x45c4c5[_0x8daf('0x3d')]=qs[_0x8daf('0x34')](_[_0x8daf('0x3e')](_0xd4fbca['query'],_0x4b2c0c[_0x8daf('0x34')]),_0x1699dd);if(_0xd4fbca['query']['filter']){_0x45c4c5[_0x8daf('0x3d')]=_[_0x8daf('0x3f')](_0x45c4c5[_0x8daf('0x3d')],{'$or':_[_0x8daf('0x2e')](_0x1699dd,function(_0x37506c){if(_0x37506c[_0x8daf('0x40')]!==_0x8daf('0x41')){var _0x1f7ff0={};_0x1f7ff0[_0x37506c[_0x8daf('0x2b')]]={'$like':'%'+_0xd4fbca['query'][_0x8daf('0x42')]+'%'};return _0x1f7ff0;}})});}_0x45c4c5=_['merge']({},_0x45c4c5,_0xd4fbca[_0x8daf('0x43')]);var _0x3f7f4a={'where':_0x45c4c5[_0x8daf('0x3d')]};return db[_0x8daf('0x2f')][_0x8daf('0x1d')](_0x3f7f4a)[_0x8daf('0x24')](function(_0xada139){_0x6f63f3[_0x8daf('0x1d')]=_0xada139;if(_0xd4fbca[_0x8daf('0x32')][_0x8daf('0x44')]){_0x45c4c5['include']=[{'all':!![]}];}return db[_0x8daf('0x2f')]['findAll'](_0x45c4c5);})['then'](function(_0xf40200){_0x6f63f3[_0x8daf('0x45')]=_0xf40200;return _0x6f63f3;})[_0x8daf('0x24')](respondWithFilteredResult(_0x1c34aa,_0x45c4c5))['catch'](handleError(_0x1c34aa,null));};exports[_0x8daf('0x46')]=function(_0x2c6a30,_0x579cae){var _0x21683e={'raw':!![],'where':{'id':_0x2c6a30['params']['id']}},_0x1ae35a={};_0x1ae35a[_0x8daf('0x37')]=_[_0x8daf('0x33')](db['Variable'][_0x8daf('0x47')]);_0x1ae35a[_0x8daf('0x32')]=_[_0x8daf('0x33')](_0x2c6a30['query']);_0x1ae35a['filters']=_[_0x8daf('0x35')](_0x1ae35a[_0x8daf('0x37')],_0x1ae35a[_0x8daf('0x32')]);_0x21683e['attributes']=_[_0x8daf('0x35')](_0x1ae35a[_0x8daf('0x37')],qs[_0x8daf('0x38')](_0x2c6a30[_0x8daf('0x32')][_0x8daf('0x38')]));_0x21683e[_0x8daf('0x36')]=_0x21683e['attributes'][_0x8daf('0x39')]?_0x21683e[_0x8daf('0x36')]:_0x1ae35a['model'];if(_0x2c6a30[_0x8daf('0x32')]['includeAll']){_0x21683e[_0x8daf('0x48')]=[{'all':!![]}];}_0x21683e=_[_0x8daf('0x3f')]({},_0x21683e,_0x2c6a30[_0x8daf('0x43')]);return db[_0x8daf('0x2f')]['find'](_0x21683e)[_0x8daf('0x24')](handleEntityNotFound(_0x579cae,null))[_0x8daf('0x24')](respondWithResult(_0x579cae,null))['catch'](handleError(_0x579cae,null));};exports[_0x8daf('0x49')]=function(_0x1fd713,_0x34376e){return db['Variable'][_0x8daf('0x49')](_0x1fd713['body'],{})['then'](function(_0x26d2bb){var _0x4eecc8=_0x1fd713['user']['get']({'plain':!![]});if(!_0x4eecc8)throw new Error(_0x8daf('0x4a'));if(_0x4eecc8[_0x8daf('0x4b')]===_0x8daf('0x4c')){var _0x2132cd=_0x26d2bb[_0x8daf('0x25')]({'plain':!![]});var _0x4f1d71=_0x8daf('0x26');return db[_0x8daf('0x4d')][_0x8daf('0x4e')]({'where':{'name':_0x4f1d71,'userProfileId':_0x4eecc8['userProfileId']},'raw':!![]})['then'](function(_0x127605){if(_0x127605&&_0x127605[_0x8daf('0x4f')]===0x0){return db[_0x8daf('0x27')]['create']({'name':_0x2132cd['name'],'resourceId':_0x2132cd['id'],'type':_0x127605[_0x8daf('0x2b')],'sectionId':_0x127605['id']},{})[_0x8daf('0x24')](function(){return _0x26d2bb;});}else{return _0x26d2bb;}})[_0x8daf('0x50')](function(_0x424ac1){logger[_0x8daf('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x424ac1);throw _0x424ac1;});}return _0x26d2bb;})[_0x8daf('0x24')](respondWithResult(_0x34376e,0xc9))[_0x8daf('0x50')](handleError(_0x34376e,null));};exports[_0x8daf('0x23')]=function(_0xe59c14,_0x4f47dd){if(_0xe59c14[_0x8daf('0x52')]['id']){delete _0xe59c14['body']['id'];}return db['Variable'][_0x8daf('0x4e')]({'where':{'id':_0xe59c14[_0x8daf('0x53')]['id']}})[_0x8daf('0x24')](handleEntityNotFound(_0x4f47dd,null))['then'](saveUpdates(_0xe59c14[_0x8daf('0x52')],null))[_0x8daf('0x24')](respondWithResult(_0x4f47dd,null))[_0x8daf('0x50')](handleError(_0x4f47dd,null));};exports[_0x8daf('0x28')]=function(_0x21abe0,_0x1533f2){return db['Variable']['find']({'where':{'id':_0x21abe0['params']['id']}})['then'](handleEntityNotFound(_0x1533f2,null))['then'](removeEntity(_0x1533f2,null))['catch'](handleError(_0x1533f2,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 96d7733..5d80ee6 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 _0xe9ba=['rimraf','./variable.attributes','exports','define','tools_variables','../../config/logger','api','moment','bluebird'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0xe9ba,0x11c));var _0xae9b=function(_0x54a9ae,_0x10263e){_0x54a9ae=_0x54a9ae-0x0;var _0x37a96d=_0xe9ba[_0x54a9ae];return _0x37a96d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xae9b('0x0'))(_0xae9b('0x1'));var moment=require(_0xae9b('0x2'));var BPromise=require(_0xae9b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xae9b('0x4'));var config=require('../../config/environment');var attributes=require(_0xae9b('0x5'));module[_0xae9b('0x6')]=function(_0x558739,_0x37777c){return _0x558739[_0xae9b('0x7')]('Variable',attributes,{'tableName':_0xae9b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xddee=['Variable','tools_variables','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports'];(function(_0x21d296,_0x434d64){var _0x1e4bff=function(_0x544a4d){while(--_0x544a4d){_0x21d296['push'](_0x21d296['shift']());}};_0x1e4bff(++_0x434d64);}(_0xddee,0x156));var _0xedde=function(_0x3718b7,_0x2da677){_0x3718b7=_0x3718b7-0x0;var _0xf8c91e=_0xddee[_0x3718b7];return _0xf8c91e;};'use strict';var _=require(_0xedde('0x0'));var util=require(_0xedde('0x1'));var logger=require(_0xedde('0x2'))(_0xedde('0x3'));var moment=require('moment');var BPromise=require(_0xedde('0x4'));var rp=require(_0xedde('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xedde('0x6'));var attributes=require('./variable.attributes');module[_0xedde('0x7')]=function(_0xcc65d4,_0x39060e){return _0xcc65d4['define'](_0xedde('0x8'),attributes,{'tableName':_0xedde('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 e622bd5..87f7bd3 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 _0x9957=['stringify','error','code','message','result','catch','ShowVariable','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x7226b1,_0x399845){var _0x4fb039=function(_0x3fe120){while(--_0x3fe120){_0x7226b1['push'](_0x7226b1['shift']());}};_0x4fb039(++_0x399845);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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']('Variable,\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);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Variable'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowVariable',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file +var _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x2ae8c2,_0x4144d2){var _0x18dd69=function(_0x2f4805){while(--_0x2f4805){_0x2ae8c2['push'](_0x2ae8c2['shift']());}};_0x18dd69(++_0x4144d2);}(_0x1cb9,0x14e));var _0x91cb=function(_0x1c7dbf,_0x5e8f60){_0x1c7dbf=_0x1c7dbf-0x0;var _0x451ff0=_0x1cb9[_0x1c7dbf];return _0x451ff0;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 00f8b9d..8bed50e 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 _0x5cf3=['pull','/restart','restart','migrations','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','/pull'];(function(_0x2b93f5,_0x5d8b16){var _0x484a84=function(_0x139b6e){while(--_0x139b6e){_0x2b93f5['push'](_0x2b93f5['shift']());}};_0x484a84(++_0x5d8b16);}(_0x5cf3,0x1d4));var _0x35cf=function(_0x4aea3a,_0x3839f9){_0x4aea3a=_0x4aea3a-0x0;var _0x5a349e=_0x5cf3[_0x4aea3a];return _0x5a349e;};'use strict';var express=require(_0x35cf('0x0'));var router=express[_0x35cf('0x1')]();var auth=require(_0x35cf('0x2'));var controller=require(_0x35cf('0x3'));router[_0x35cf('0x4')]('/',controller[_0x35cf('0x5')]);router[_0x35cf('0x4')](_0x35cf('0x6'),auth[_0x35cf('0x7')](),auth[_0x35cf('0x8')](),controller[_0x35cf('0x9')]);router[_0x35cf('0x4')](_0x35cf('0xa'),auth[_0x35cf('0x7')](),auth['canUpdate'](),controller['reset']);router[_0x35cf('0x4')](_0x35cf('0xb'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x35cf('0xc')]);router['get'](_0x35cf('0xd'),auth[_0x35cf('0x7')](),controller[_0x35cf('0xe')]);router[_0x35cf('0x4')]('/migrations',controller[_0x35cf('0xf')]);module['exports']=router; \ No newline at end of file +var _0x8e5b=['express','Router','get','index','/fetch','canUpdate','fetch','/reset','isAuthenticated','/pull','pull','/restart','restart','migrations'];(function(_0x1c96ae,_0x4bb028){var _0x20e299=function(_0x2e11f1){while(--_0x2e11f1){_0x1c96ae['push'](_0x1c96ae['shift']());}};_0x20e299(++_0x4bb028);}(_0x8e5b,0x1dc));var _0xb8e5=function(_0x5d7087,_0x2143f4){_0x5d7087=_0x5d7087-0x0;var _0x133447=_0x8e5b[_0x5d7087];return _0x133447;};'use strict';var express=require(_0xb8e5('0x0'));var router=express[_0xb8e5('0x1')]();var auth=require('../../components/auth/service');var controller=require('./version.controller');router[_0xb8e5('0x2')]('/',controller[_0xb8e5('0x3')]);router[_0xb8e5('0x2')](_0xb8e5('0x4'),auth['isAuthenticated'](),auth[_0xb8e5('0x5')](),controller[_0xb8e5('0x6')]);router[_0xb8e5('0x2')](_0xb8e5('0x7'),auth[_0xb8e5('0x8')](),auth['canUpdate'](),controller['reset']);router['get'](_0xb8e5('0x9'),auth[_0xb8e5('0x8')](),auth[_0xb8e5('0x5')](),controller[_0xb8e5('0xa')]);router[_0xb8e5('0x2')](_0xb8e5('0xb'),auth['isAuthenticated'](),controller[_0xb8e5('0xc')]);router[_0xb8e5('0x2')]('/migrations',controller[_0xb8e5('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 82cf420..96b2186 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 _0xab76=['push','sort','Migration','sequelize','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','root','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','version','query','latest','fetch','tags','exports','2.0.0','status','json','origin','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','info','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','replace'];(function(_0x78defc,_0x3cec24){var _0x3c03b8=function(_0x4c4357){while(--_0x4c4357){_0x78defc['push'](_0x78defc['shift']());}};_0x3c03b8(++_0x3cec24);}(_0xab76,0xf1));var _0x6ab7=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xab76[_0x6131cd];return _0x47e916;};'use strict';var Umzug=require(_0x6ab7('0x0'));var path=require(_0x6ab7('0x1'));var fs=require('fs');var _=require(_0x6ab7('0x2'));var pkginfo=require(_0x6ab7('0x3'))(module,'version');var compareVersions=require(_0x6ab7('0x4'));var exec=require('child_process')[_0x6ab7('0x5')];var db=require(_0x6ab7('0x6'))['db'];var config=require(_0x6ab7('0x7'));var pm2=require(_0x6ab7('0x8'));var logger=require(_0x6ab7('0x9'))(_0x6ab7('0xa'));var git=require(_0x6ab7('0xb'))(config['root']);exports[_0x6ab7('0xc')]=function(_0x359d7a,_0x2b7b1f){var _0x444325={'current':module['exports'][_0x6ab7('0xd')],'phonebar':0x2};if(_0x359d7a[_0x6ab7('0xe')]&&_0x359d7a[_0x6ab7('0xe')][_0x6ab7('0xf')]){return git[_0x6ab7('0x10')]()[_0x6ab7('0x11')](function(_0x4e2ff4,_0x36861e){_0x444325[_0x6ab7('0xf')]=(_0x4e2ff4?module[_0x6ab7('0x12')][_0x6ab7('0xd')]:_0x36861e[_0x6ab7('0xf')])||_0x6ab7('0x13');return _0x2b7b1f[_0x6ab7('0x14')](0xc8)[_0x6ab7('0x15')](_0x444325);});}else{return _0x2b7b1f['status'](0xc8)[_0x6ab7('0x15')](_0x444325);}};exports[_0x6ab7('0x10')]=function(_0x134c1a,_0x38b8a4){return git[_0x6ab7('0x10')]([_0x6ab7('0x16'),'master'],function(_0x302d7f){if(_0x302d7f){logger[_0x6ab7('0x17')](_0x302d7f);return _0x38b8a4['status'](0x1f4)[_0x6ab7('0x15')](_0x302d7f);}logger['info'](_0x6ab7('0x18'));return _0x38b8a4[_0x6ab7('0x14')](0xc8)[_0x6ab7('0x15')]({'output':_0x6ab7('0x19')});});};exports[_0x6ab7('0x1a')]=function(_0x234ab6,_0x121b66){return git[_0x6ab7('0x1a')](['--hard',_0x6ab7('0x1b')],function(_0x17085f){if(_0x17085f){logger[_0x6ab7('0x17')](_0x17085f);return _0x121b66[_0x6ab7('0x14')](0x1f4)['json'](_0x17085f);}logger[_0x6ab7('0x1c')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x121b66[_0x6ab7('0x14')](0xc8)[_0x6ab7('0x15')]({'output':_0x6ab7('0x1d')});});};exports[_0x6ab7('0x1e')]=function(_0x4a6fb3,_0x7fc352){exec(_0x6ab7('0x1f'),function(_0x58f8c4,_0x3ff003,_0x12b3c2){logger[_0x6ab7('0x1c')](_0x3ff003);logger[_0x6ab7('0x1c')](_0x12b3c2);if(_0x58f8c4){logger[_0x6ab7('0x17')](_0x58f8c4);return _0x7fc352[_0x6ab7('0x14')](0x1f4)['json'](_0x58f8c4);}return _0x7fc352[_0x6ab7('0x14')](0xc8)['json']({'output':_0x3ff003});});};exports[_0x6ab7('0x20')]=function(_0x37f2c2,_0x2e1270){return pm2[_0x6ab7('0x20')](_0x6ab7('0x21'))[_0x6ab7('0x22')](function(_0x14cd2b){logger[_0x6ab7('0x1c')](_0x6ab7('0x23'),_0x14cd2b);return _0x2e1270[_0x6ab7('0x14')](0xc8)[_0x6ab7('0x15')]({'output':_0x6ab7('0x24')});})[_0x6ab7('0x25')](function(_0x5289e8){logger[_0x6ab7('0x17')](_0x5289e8);return _0x2e1270[_0x6ab7('0x14')](0x1f4)['json'](_0x5289e8);});};exports[_0x6ab7('0x26')]=function(_0x578fe7,_0xed6537){var _0x35424f=fs[_0x6ab7('0x27')](path[_0x6ab7('0x28')](config['root'],_0x6ab7('0x29'),_0x6ab7('0x26')));var _0xabe40e=[];for(var _0x325883=0x0;_0x325883<_0x35424f[_0x6ab7('0x2a')];_0x325883++){var _0x580ef9=_0x35424f[_0x325883][_0x6ab7('0x2b')]('.js','');if(compareVersions(module[_0x6ab7('0x12')][_0x6ab7('0xd')],_0x580ef9)===-0x1){_0xabe40e[_0x6ab7('0x2c')](_0x580ef9);}}if(_0xabe40e[_0x6ab7('0x2a')]){var _0x563d25=_0xabe40e[_0x6ab7('0x2d')](compareVersions);var _0x4e986f=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x6ab7('0x2e')],'modelName':_0x6ab7('0x2e'),'columnName':'version'},'migrations':{'params':[db[_0x6ab7('0x2f')]['getQueryInterface'](),db[_0x6ab7('0x2f')]['constructor'],function(){throw new Error(_0x6ab7('0x30'));}],'path':path[_0x6ab7('0x28')](config[_0x6ab7('0x31')],_0x6ab7('0x29'),_0x6ab7('0x26')),'pattern':/\.js$/}});_0x4e986f['up']({'migrations':_[_0x6ab7('0x32')](_0x563d25,function(_0x38f3d6){return _0x38f3d6+_0x6ab7('0x33');})})['then'](function(){return _0xed6537[_0x6ab7('0x14')](0xc8)['json']({'output':_0x6ab7('0x34')+module[_0x6ab7('0x12')][_0x6ab7('0xd')]+_0x6ab7('0x35')+_[_0x6ab7('0x36')](_0x563d25),'migrations':_[_0x6ab7('0x28')](_0x563d25)});})[_0x6ab7('0x25')](function(_0x34a7d4){if(_0x34a7d4 instanceof db['sequelize'][_0x6ab7('0x37')]){return _0xed6537[_0x6ab7('0x14')](0xc8)[_0x6ab7('0x15')]({'output':'Database\x20already\x20up-to-date'});}else{return _0xed6537[_0x6ab7('0x14')](0x1f4)[_0x6ab7('0x15')](_0x34a7d4);}});}else{return _0xed6537[_0x6ab7('0x14')](0xc8)['json']({'output':_0x6ab7('0x38')});}}; \ No newline at end of file +var _0x702b=['migrations','length','.js','push','Migration','sequelize','constructor','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','last','UniqueConstraintError','Database\x20already\x20up-to-date','path','pkginfo','version','compare-versions','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','latest','tags','2.0.0','status','json','fetch','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','server'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0x702b,0x75));var _0xb702=function(_0x2cbf63,_0x5d5757){_0x2cbf63=_0x2cbf63-0x0;var _0x51ce51=_0x702b[_0x2cbf63];return _0x51ce51;};'use strict';var Umzug=require('umzug');var path=require(_0xb702('0x0'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xb702('0x1'))(module,_0xb702('0x2'));var compareVersions=require(_0xb702('0x3'));var exec=require('child_process')[_0xb702('0x4')];var db=require(_0xb702('0x5'))['db'];var config=require(_0xb702('0x6'));var pm2=require(_0xb702('0x7'));var logger=require(_0xb702('0x8'))(_0xb702('0x9'));var git=require(_0xb702('0xa'))(config[_0xb702('0xb')]);exports[_0xb702('0xc')]=function(_0x3dfec8,_0x3c2cdf){var _0x14f70c={'current':module[_0xb702('0xd')][_0xb702('0x2')],'phonebar':0x2};if(_0x3dfec8['query']&&_0x3dfec8['query'][_0xb702('0xe')]){return git['fetch']()[_0xb702('0xf')](function(_0x3cc1a7,_0x147cb4){_0x14f70c['latest']=(_0x3cc1a7?module['exports'][_0xb702('0x2')]:_0x147cb4[_0xb702('0xe')])||_0xb702('0x10');return _0x3c2cdf[_0xb702('0x11')](0xc8)[_0xb702('0x12')](_0x14f70c);});}else{return _0x3c2cdf[_0xb702('0x11')](0xc8)['json'](_0x14f70c);}};exports[_0xb702('0x13')]=function(_0x475272,_0x469458){return git[_0xb702('0x13')]([_0xb702('0x14'),_0xb702('0x15')],function(_0x19614c){if(_0x19614c){logger[_0xb702('0x16')](_0x19614c);return _0x469458[_0xb702('0x11')](0x1f4)['json'](_0x19614c);}logger[_0xb702('0x17')](_0xb702('0x18'));return _0x469458[_0xb702('0x11')](0xc8)[_0xb702('0x12')]({'output':_0xb702('0x19')});});};exports[_0xb702('0x1a')]=function(_0x51726d,_0x5e8c50){return git[_0xb702('0x1a')]([_0xb702('0x1b'),_0xb702('0x1c')],function(_0x551478){if(_0x551478){logger['error'](_0x551478);return _0x5e8c50['status'](0x1f4)[_0xb702('0x12')](_0x551478);}logger[_0xb702('0x17')](_0xb702('0x1d'));return _0x5e8c50[_0xb702('0x11')](0xc8)[_0xb702('0x12')]({'output':'git\x20reset\x20--hard'});});};exports[_0xb702('0x1e')]=function(_0x629c6a,_0x18172c){exec('npm\x20install\x20--production',function(_0x5c723c,_0x290c98,_0x5344d6){logger['info'](_0x290c98);logger[_0xb702('0x17')](_0x5344d6);if(_0x5c723c){logger[_0xb702('0x16')](_0x5c723c);return _0x18172c[_0xb702('0x11')](0x1f4)[_0xb702('0x12')](_0x5c723c);}return _0x18172c[_0xb702('0x11')](0xc8)[_0xb702('0x12')]({'output':_0x290c98});});};exports[_0xb702('0x1f')]=function(_0x2929ac,_0x47a511){return pm2[_0xb702('0x1f')]('motion2')[_0xb702('0x20')](function(_0x277e46){logger[_0xb702('0x17')](_0xb702('0x21'),_0x277e46);return _0x47a511['status'](0xc8)[_0xb702('0x12')]({'output':_0xb702('0x22')});})[_0xb702('0x23')](function(_0x4386bf){logger['error'](_0x4386bf);return _0x47a511[_0xb702('0x11')](0x1f4)['json'](_0x4386bf);});};exports['migrations']=function(_0x313abd,_0x1d04da){var _0x3241a8=fs[_0xb702('0x24')](path[_0xb702('0x25')](config['root'],_0xb702('0x26'),_0xb702('0x27')));var _0x1e51fb=[];for(var _0x41f7c3=0x0;_0x41f7c3<_0x3241a8[_0xb702('0x28')];_0x41f7c3++){var _0x59e216=_0x3241a8[_0x41f7c3]['replace'](_0xb702('0x29'),'');if(compareVersions(module[_0xb702('0xd')][_0xb702('0x2')],_0x59e216)===-0x1){_0x1e51fb[_0xb702('0x2a')](_0x59e216);}}if(_0x1e51fb['length']){var _0x42e41d=_0x1e51fb['sort'](compareVersions);var _0x201a77=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xb702('0x2b')],'modelName':_0xb702('0x2b'),'columnName':'version'},'migrations':{'params':[db[_0xb702('0x2c')]['getQueryInterface'](),db[_0xb702('0x2c')][_0xb702('0x2d')],function(){throw new Error(_0xb702('0x2e'));}],'path':path[_0xb702('0x25')](config[_0xb702('0xb')],_0xb702('0x26'),'migrations'),'pattern':/\.js$/}});_0x201a77['up']({'migrations':_[_0xb702('0x2f')](_0x42e41d,function(_0x196b76){return _0x196b76+'.js';})})[_0xb702('0x20')](function(){return _0x1d04da[_0xb702('0x11')](0xc8)[_0xb702('0x12')]({'output':_0xb702('0x30')+module[_0xb702('0xd')][_0xb702('0x2')]+'\x20to\x20'+_[_0xb702('0x31')](_0x42e41d),'migrations':_[_0xb702('0x25')](_0x42e41d)});})[_0xb702('0x23')](function(_0x3d6290){if(_0x3d6290 instanceof db['sequelize'][_0xb702('0x32')]){return _0x1d04da[_0xb702('0x11')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x1d04da[_0xb702('0x11')](0x1f4)[_0xb702('0x12')](_0x3d6290);}});}else{return _0x1d04da[_0xb702('0x11')](0xc8)[_0xb702('0x12')]({'output':_0xb702('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 3581bf8..40bb797 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 _0xfeaa=['./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x97bbb3,_0x55cf8f){var _0x58e9d9=function(_0x59ad4b){while(--_0x59ad4b){_0x97bbb3['push'](_0x97bbb3['shift']());}};_0x58e9d9(++_0x55cf8f);}(_0xfeaa,0x17d));var _0xafea=function(_0x57ddb3,_0x398941){_0x57ddb3=_0x57ddb3-0x0;var _0x240faf=_0xfeaa[_0x57ddb3];return _0x240faf;};'use strict';var multer=require(_0xafea('0x0'));var util=require(_0xafea('0x1'));var path=require(_0xafea('0x2'));var timeout=require(_0xafea('0x3'));var express=require(_0xafea('0x4'));var router=express[_0xafea('0x5')]();var fs_extra=require(_0xafea('0x6'));var auth=require(_0xafea('0x7'));var interaction=require(_0xafea('0x8'));var config=require(_0xafea('0x9'));var controller=require(_0xafea('0xa'));router[_0xafea('0xb')]('/',auth[_0xafea('0xc')](),controller[_0xafea('0xd')]);router[_0xafea('0xb')](_0xafea('0xe'),auth[_0xafea('0xc')](),controller[_0xafea('0xf')]);router[_0xafea('0xb')](_0xafea('0x10'),auth[_0xafea('0xc')](),controller[_0xafea('0x11')]);router[_0xafea('0x12')]('/',auth[_0xafea('0xc')](),controller['create']);router['put'](_0xafea('0x10'),auth[_0xafea('0xc')](),controller[_0xafea('0x13')]);router[_0xafea('0x14')](_0xafea('0x10'),auth[_0xafea('0xc')](),controller[_0xafea('0x15')]);module[_0xafea('0x16')]=router; \ No newline at end of file +var _0xfe3c=['util','path','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer'];(function(_0x42c853,_0x4460c0){var _0x1ad3d7=function(_0x2b6d76){while(--_0x2b6d76){_0x42c853['push'](_0x42c853['shift']());}};_0x1ad3d7(++_0x4460c0);}(_0xfe3c,0x1af));var _0xcfe3=function(_0x14c07f,_0x14fd24){_0x14c07f=_0x14c07f-0x0;var _0x5f114e=_0xfe3c[_0x14c07f];return _0x5f114e;};'use strict';var multer=require(_0xcfe3('0x0'));var util=require(_0xcfe3('0x1'));var path=require(_0xcfe3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcfe3('0x3'));var interaction=require(_0xcfe3('0x4'));var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router[_0xcfe3('0x5')]('/',auth[_0xcfe3('0x6')](),controller[_0xcfe3('0x7')]);router[_0xcfe3('0x5')](_0xcfe3('0x8'),auth['isAuthenticated'](),controller[_0xcfe3('0x9')]);router['get'](_0xcfe3('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xcfe3('0xb')]('/',auth['isAuthenticated'](),controller[_0xcfe3('0xc')]);router[_0xcfe3('0xd')](_0xcfe3('0xa'),auth['isAuthenticated'](),controller[_0xcfe3('0xe')]);router[_0xcfe3('0xf')](_0xcfe3('0xa'),auth['isAuthenticated'](),controller[_0xcfe3('0x10')]);module[_0xcfe3('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index cb174c6..78dc134 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 _0x8374=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x3c27b6,_0x2192cb){var _0x2a5f55=function(_0x4d8700){while(--_0x4d8700){_0x3c27b6['push'](_0x3c27b6['shift']());}};_0x2a5f55(++_0x2192cb);}(_0x8374,0x174));var _0x4837=function(_0x4bda35,_0x1a370e){_0x4bda35=_0x4bda35-0x0;var _0x5cfb25=_0x8374[_0x4bda35];return _0x5cfb25;};'use strict';var Sequelize=require(_0x4837('0x0'));module[_0x4837('0x1')]={'type':{'type':Sequelize[_0x4837('0x2')]},'uniqueid':{'type':Sequelize[_0x4837('0x2')]},'calleridnum':{'type':Sequelize[_0x4837('0x2')]},'calleridname':{'type':Sequelize[_0x4837('0x2')]},'queue':{'type':Sequelize[_0x4837('0x2')]},'interface':{'type':Sequelize[_0x4837('0x2')]},'membername':{'type':Sequelize[_0x4837('0x2')]},'agentcalledAt':{'type':Sequelize[_0x4837('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4837('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x4837('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x4837('0x3')]},'agentdumpAt':{'type':Sequelize[_0x4837('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x4837('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x4837('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x4837('0x5')]},'agentacw':{'type':Sequelize[_0x4837('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4837('0x5')]},'reason':{'type':Sequelize[_0x4837('0x2')]},'lastevent':{'type':Sequelize[_0x4837('0x2')]},'channel':{'type':Sequelize[_0x4837('0x2')]},'channelstate':{'type':Sequelize[_0x4837('0x5')]},'channelstatedesc':{'type':Sequelize[_0x4837('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4837('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4837('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x4837('0x2')]},'priority':{'type':Sequelize[_0x4837('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x4837('0x2')]},'destcalleridname':{'type':Sequelize[_0x4837('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x4837('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4837('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x4837('0x2')]},'destcontext':{'type':Sequelize[_0x4837('0x2')]},'destexten':{'type':Sequelize[_0x4837('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x4837('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x4837('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x4837('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4837('0x2')],'comment':_0x4837('0x6')},'transferexten':{'type':Sequelize[_0x4837('0x2')]},'transferuniqueid':{'type':Sequelize[_0x4837('0x2')]},'agententerreason':{'type':Sequelize[_0x4837('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc2da=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING'];(function(_0x51a0a2,_0x31f10a){var _0x5286af=function(_0x1f30a6){while(--_0x1f30a6){_0x51a0a2['push'](_0x51a0a2['shift']());}};_0x5286af(++_0x31f10a);}(_0xc2da,0x124));var _0xac2d=function(_0x2b7248,_0x17b24e){_0x2b7248=_0x2b7248-0x0;var _0x418838=_0xc2da[_0x2b7248];return _0x418838;};'use strict';var Sequelize=require(_0xac2d('0x0'));module['exports']={'type':{'type':Sequelize[_0xac2d('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xac2d('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xac2d('0x1')]},'interface':{'type':Sequelize[_0xac2d('0x1')]},'membername':{'type':Sequelize[_0xac2d('0x1')]},'agentcalledAt':{'type':Sequelize[_0xac2d('0x2')]},'agentconnectAt':{'type':Sequelize[_0xac2d('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xac2d('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xac2d('0x2')]},'agentdumpAt':{'type':Sequelize[_0xac2d('0x2')]},'holdtime':{'type':Sequelize[_0xac2d('0x3')]},'agentcomplete':{'type':Sequelize[_0xac2d('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xac2d('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xac2d('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xac2d('0x1')]},'lastevent':{'type':Sequelize[_0xac2d('0x1')]},'channel':{'type':Sequelize[_0xac2d('0x1')]},'channelstate':{'type':Sequelize[_0xac2d('0x3')]},'channelstatedesc':{'type':Sequelize[_0xac2d('0x1')]},'connectedlinenum':{'type':Sequelize[_0xac2d('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xac2d('0x1')]},'context':{'type':Sequelize[_0xac2d('0x1')]},'exten':{'type':Sequelize[_0xac2d('0x1')]},'priority':{'type':Sequelize[_0xac2d('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xac2d('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xac2d('0x1')]},'destcalleridnum':{'type':Sequelize[_0xac2d('0x1')]},'destcalleridname':{'type':Sequelize[_0xac2d('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xac2d('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xac2d('0x1')]},'destlanguage':{'type':Sequelize[_0xac2d('0x1')]},'destaccountcode':{'type':Sequelize[_0xac2d('0x1')]},'destcontext':{'type':Sequelize[_0xac2d('0x1')]},'destexten':{'type':Sequelize[_0xac2d('0x1')]},'destpriority':{'type':Sequelize[_0xac2d('0x1')]},'destuniqueid':{'type':Sequelize[_0xac2d('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xac2d('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xac2d('0x1')]},'transfer':{'type':Sequelize[_0xac2d('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xac2d('0x5')},'transferexten':{'type':Sequelize[_0xac2d('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xac2d('0x3')],'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 2cde310..29cae4b 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(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 8405ad7..2138d9c 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 _0x5455=['define','VoiceAgentReport','uniqueid','destuniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceAgentReport.attributes','exports'];(function(_0x5a2744,_0x53f4cd){var _0x519f7a=function(_0x5d9aa2){while(--_0x5d9aa2){_0x5a2744['push'](_0x5a2744['shift']());}};_0x519f7a(++_0x53f4cd);}(_0x5455,0x197));var _0x5545=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5455[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0x5545('0x0'));var logger=require(_0x5545('0x1'))(_0x5545('0x2'));var moment=require(_0x5545('0x3'));var BPromise=require(_0x5545('0x4'));var rp=require(_0x5545('0x5'));var fs=require('fs');var path=require(_0x5545('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5545('0x7'));module[_0x5545('0x8')]=function(_0x5c22f1,_0x5a6ac7){return _0x5c22f1[_0x5545('0x9')](_0x5545('0xa'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x5545('0xb'),_0x5545('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1354=['rimraf','../../config/environment','./voiceAgentReport.attributes','VoiceAgentReport','report_agent','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4a0801,_0x55b298){var _0x47306d=function(_0x415a91){while(--_0x415a91){_0x4a0801['push'](_0x4a0801['shift']());}};_0x47306d(++_0x55b298);}(_0x1354,0x95));var _0x4135=function(_0x2ccd5e,_0x3deb44){_0x2ccd5e=_0x2ccd5e-0x0;var _0x1a758e=_0x1354[_0x2ccd5e];return _0x1a758e;};'use strict';var _=require(_0x4135('0x0'));var util=require(_0x4135('0x1'));var logger=require(_0x4135('0x2'))(_0x4135('0x3'));var moment=require(_0x4135('0x4'));var BPromise=require(_0x4135('0x5'));var rp=require(_0x4135('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4135('0x7'));var config=require(_0x4135('0x8'));var attributes=require(_0x4135('0x9'));module['exports']=function(_0x14ff47,_0x2bcd68){return _0x14ff47['define'](_0x4135('0xa'),attributes,{'tableName':_0x4135('0xb'),'paranoid':![],'indexes':[{'fields':[_0x4135('0xc'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 30ad0dd..6a5b007 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 _0x64d4=['request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','debug','UpdateVoiceAgentReport','update','body','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x33f135,_0x35b352){var _0x23bb2f=function(_0x109e1f){while(--_0x109e1f){_0x33f135['push'](_0x33f135['shift']());}};_0x23bb2f(++_0x35b352);}(_0x64d4,0x197));var _0x464d=function(_0x11db68,_0x4f0351){_0x11db68=_0x11db68-0x0;var _0xcd8a93=_0x64d4[_0x11db68];return _0xcd8a93;};'use strict';var _=require(_0x464d('0x0'));var util=require(_0x464d('0x1'));var moment=require(_0x464d('0x2'));var BPromise=require(_0x464d('0x3'));var rs=require(_0x464d('0x4'));var fs=require('fs');var Redis=require(_0x464d('0x5'));var db=require(_0x464d('0x6'))['db'];var utils=require(_0x464d('0x7'));var logger=require(_0x464d('0x8'))(_0x464d('0x9'));var config=require(_0x464d('0xa'));var jayson=require(_0x464d('0xb'));var client=jayson[_0x464d('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bb8d3,_0x3b38ae,_0x4589d4){return new BPromise(function(_0x43dbc2,_0x55282f){return client[_0x464d('0xd')](_0x1bb8d3,_0x4589d4)[_0x464d('0xe')](function(_0xbe766c){logger[_0x464d('0xf')](_0x464d('0x10'),_0x3b38ae,_0x464d('0x11'));logger['debug'](_0x464d('0x12'),_0x3b38ae,_0x464d('0x11'),JSON[_0x464d('0x13')](_0xbe766c));if(_0xbe766c[_0x464d('0x14')]){if(_0xbe766c[_0x464d('0x14')]['code']===0x1f4){logger[_0x464d('0x14')](_0x464d('0x10'),_0x3b38ae,_0xbe766c['error'][_0x464d('0x15')]);return _0x55282f(_0xbe766c[_0x464d('0x14')][_0x464d('0x15')]);}logger[_0x464d('0x14')](_0x464d('0x10'),_0x3b38ae,_0xbe766c['error'][_0x464d('0x15')]);return _0x43dbc2(_0xbe766c[_0x464d('0x14')][_0x464d('0x15')]);}else{logger[_0x464d('0xf')](_0x464d('0x10'),_0x3b38ae,_0x464d('0x11'));_0x43dbc2(_0xbe766c[_0x464d('0x16')][_0x464d('0x15')]);}})[_0x464d('0x17')](function(_0x2a9d98){logger[_0x464d('0x14')](_0x464d('0x10'),_0x3b38ae,_0x2a9d98);_0x55282f(_0x2a9d98);});});}exports[_0x464d('0x18')]=function(_0x25e8f7){var _0x2616d8=this;return new Promise(function(_0x3003fc,_0x5b52d7){return db[_0x464d('0x19')][_0x464d('0x1a')](_0x25e8f7['body'],{'raw':_0x25e8f7[_0x464d('0x1b')]?_0x25e8f7[_0x464d('0x1b')][_0x464d('0x1c')]===undefined?!![]:![]:!![]})[_0x464d('0xe')](function(_0x2222b5){logger['info'](_0x464d('0x18'),_0x25e8f7);logger[_0x464d('0x1d')]('CreateVoiceAgentReport',_0x25e8f7,JSON['stringify'](_0x2222b5));_0x3003fc(_0x2222b5);})[_0x464d('0x17')](function(_0x5dcbf0){logger[_0x464d('0x14')](_0x464d('0x18'),_0x5dcbf0[_0x464d('0x15')],_0x25e8f7);_0x5b52d7(_0x2616d8[_0x464d('0x14')](0x1f4,_0x5dcbf0[_0x464d('0x15')]));});});};exports[_0x464d('0x1e')]=function(_0x1b0eb4){var _0x52e90e=this;return new Promise(function(_0xfe6c12,_0x4df24f){return db['VoiceAgentReport'][_0x464d('0x1f')](_0x1b0eb4[_0x464d('0x20')],{'raw':_0x1b0eb4[_0x464d('0x1b')]?_0x1b0eb4[_0x464d('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b0eb4['options']?_0x1b0eb4[_0x464d('0x1b')][_0x464d('0x21')]||null:null,'attributes':_0x1b0eb4[_0x464d('0x1b')]?_0x1b0eb4[_0x464d('0x1b')][_0x464d('0x22')]||null:null,'limit':_0x1b0eb4[_0x464d('0x1b')]?_0x1b0eb4[_0x464d('0x1b')]['limit']||null:null})[_0x464d('0xe')](function(_0x5ad914){logger[_0x464d('0xf')]('UpdateVoiceAgentReport',_0x1b0eb4);logger[_0x464d('0x1d')](_0x464d('0x1e'),_0x1b0eb4,JSON[_0x464d('0x13')](_0x5ad914));_0xfe6c12(_0x5ad914);})[_0x464d('0x17')](function(_0x5976da){logger[_0x464d('0x14')](_0x464d('0x1e'),_0x5976da['message'],_0x1b0eb4);_0x4df24f(_0x52e90e[_0x464d('0x14')](0x1f4,_0x5976da[_0x464d('0x15')]));});});}; \ No newline at end of file +var _0xf87c=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','VoiceAgentReport','body','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','where','attributes','limit','debug','lodash','util','bluebird','randomstring'];(function(_0x2ca2f1,_0x4fd3db){var _0x3233b2=function(_0x22b1e2){while(--_0x22b1e2){_0x2ca2f1['push'](_0x2ca2f1['shift']());}};_0x3233b2(++_0x4fd3db);}(_0xf87c,0x78));var _0xcf87=function(_0x38854e,_0x23cbc9){_0x38854e=_0x38854e-0x0;var _0x3f8415=_0xf87c[_0x38854e];return _0x3f8415;};'use strict';var _=require(_0xcf87('0x0'));var util=require(_0xcf87('0x1'));var moment=require('moment');var BPromise=require(_0xcf87('0x2'));var rs=require(_0xcf87('0x3'));var fs=require('fs');var Redis=require(_0xcf87('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcf87('0x5'));var logger=require(_0xcf87('0x6'))(_0xcf87('0x7'));var config=require(_0xcf87('0x8'));var jayson=require(_0xcf87('0x9'));var client=jayson['client'][_0xcf87('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1378d3,_0x1d4019,_0x28f046){return new BPromise(function(_0x4a8b85,_0x4ba206){return client[_0xcf87('0xb')](_0x1378d3,_0x28f046)[_0xcf87('0xc')](function(_0x19afe7){logger[_0xcf87('0xd')](_0xcf87('0xe'),_0x1d4019,_0xcf87('0xf'));logger['debug']('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x1d4019,_0xcf87('0xf'),JSON[_0xcf87('0x10')](_0x19afe7));if(_0x19afe7[_0xcf87('0x11')]){if(_0x19afe7[_0xcf87('0x11')][_0xcf87('0x12')]===0x1f4){logger[_0xcf87('0x11')](_0xcf87('0xe'),_0x1d4019,_0x19afe7['error'][_0xcf87('0x13')]);return _0x4ba206(_0x19afe7['error'][_0xcf87('0x13')]);}logger[_0xcf87('0x11')](_0xcf87('0xe'),_0x1d4019,_0x19afe7[_0xcf87('0x11')]['message']);return _0x4a8b85(_0x19afe7[_0xcf87('0x11')]['message']);}else{logger['info'](_0xcf87('0xe'),_0x1d4019,_0xcf87('0xf'));_0x4a8b85(_0x19afe7['result'][_0xcf87('0x13')]);}})[_0xcf87('0x14')](function(_0x1238e1){logger['error'](_0xcf87('0xe'),_0x1d4019,_0x1238e1);_0x4ba206(_0x1238e1);});});}exports['CreateVoiceAgentReport']=function(_0x1a0b1f){var _0x377735=this;return new Promise(function(_0x34d298,_0x5d0f5c){return db[_0xcf87('0x15')]['create'](_0x1a0b1f[_0xcf87('0x16')],{'raw':_0x1a0b1f[_0xcf87('0x17')]?_0x1a0b1f[_0xcf87('0x17')][_0xcf87('0x18')]===undefined?!![]:![]:!![]})[_0xcf87('0xc')](function(_0x27c10c){logger[_0xcf87('0xd')](_0xcf87('0x19'),_0x1a0b1f);logger['debug'](_0xcf87('0x19'),_0x1a0b1f,JSON['stringify'](_0x27c10c));_0x34d298(_0x27c10c);})['catch'](function(_0x27c68f){logger[_0xcf87('0x11')](_0xcf87('0x19'),_0x27c68f[_0xcf87('0x13')],_0x1a0b1f);_0x5d0f5c(_0x377735[_0xcf87('0x11')](0x1f4,_0x27c68f[_0xcf87('0x13')]));});});};exports[_0xcf87('0x1a')]=function(_0xbd1f89){var _0x19c653=this;return new Promise(function(_0x3ad984,_0x46c048){return db[_0xcf87('0x15')]['update'](_0xbd1f89[_0xcf87('0x16')],{'raw':_0xbd1f89['options']?_0xbd1f89['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbd1f89[_0xcf87('0x17')]?_0xbd1f89[_0xcf87('0x17')][_0xcf87('0x1b')]||null:null,'attributes':_0xbd1f89['options']?_0xbd1f89['options'][_0xcf87('0x1c')]||null:null,'limit':_0xbd1f89[_0xcf87('0x17')]?_0xbd1f89[_0xcf87('0x17')][_0xcf87('0x1d')]||null:null})[_0xcf87('0xc')](function(_0x56a15b){logger[_0xcf87('0xd')](_0xcf87('0x1a'),_0xbd1f89);logger[_0xcf87('0x1e')](_0xcf87('0x1a'),_0xbd1f89,JSON['stringify'](_0x56a15b));_0x3ad984(_0x56a15b);})[_0xcf87('0x14')](function(_0x4ba9d3){logger['error']('UpdateVoiceAgentReport',_0x4ba9d3[_0xcf87('0x13')],_0xbd1f89);_0x46c048(_0x19c653[_0xcf87('0x11')](0x1f4,_0x4ba9d3[_0xcf87('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index ec35496..07a10c9 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 _0x4601=['./voiceCallReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','put','update','/with-retry/:id','updateWithRetry','delete','destroy','Router','../../components/auth/service'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x4601,0x1a7));var _0x1460=function(_0x3e7681,_0x394857){_0x3e7681=_0x3e7681-0x0;var _0x43995a=_0x4601[_0x3e7681];return _0x43995a;};'use strict';var express=require('express');var router=express[_0x1460('0x0')]();var auth=require(_0x1460('0x1'));var controller=require(_0x1460('0x2'));router[_0x1460('0x3')]('/',auth['isAuthenticated'](),controller[_0x1460('0x4')]);router[_0x1460('0x3')](_0x1460('0x5'),auth[_0x1460('0x6')](),controller[_0x1460('0x7')]);router[_0x1460('0x3')](_0x1460('0x8'),auth[_0x1460('0x6')](),controller[_0x1460('0x9')]);router['post']('/',auth[_0x1460('0x6')](),controller[_0x1460('0xa')]);router[_0x1460('0xb')](_0x1460('0x8'),auth[_0x1460('0x6')](),controller[_0x1460('0xc')]);router[_0x1460('0xb')](_0x1460('0xd'),auth[_0x1460('0x6')](),controller[_0x1460('0xe')]);router[_0x1460('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x1460('0x10')]);module['exports']=router; \ No newline at end of file +var _0x199a=['Router','../../components/auth/service','./voiceCallReport.controller','isAuthenticated','index','get','/describe','create','put','/:id','/with-retry/:id','delete','destroy'];(function(_0x315a7e,_0x6df2bc){var _0x30efbf=function(_0x33236b){while(--_0x33236b){_0x315a7e['push'](_0x315a7e['shift']());}};_0x30efbf(++_0x6df2bc);}(_0x199a,0x193));var _0xa199=function(_0x3a6778,_0x289fcb){_0x3a6778=_0x3a6778-0x0;var _0x516032=_0x199a[_0x3a6778];return _0x516032;};'use strict';var express=require('express');var router=express[_0xa199('0x0')]();var auth=require(_0xa199('0x1'));var controller=require(_0xa199('0x2'));router['get']('/',auth[_0xa199('0x3')](),controller[_0xa199('0x4')]);router[_0xa199('0x5')](_0xa199('0x6'),auth[_0xa199('0x3')](),controller['describe']);router[_0xa199('0x5')]('/:id',auth[_0xa199('0x3')](),controller['show']);router['post']('/',auth[_0xa199('0x3')](),controller[_0xa199('0x7')]);router[_0xa199('0x8')](_0xa199('0x9'),auth[_0xa199('0x3')](),controller['update']);router[_0xa199('0x8')](_0xa199('0xa'),auth[_0xa199('0x3')](),controller['updateWithRetry']);router[_0xa199('0xb')](_0xa199('0x9'),auth[_0xa199('0x3')](),controller[_0xa199('0xc')]);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 d9f41f3..0ac617b 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 _0xfe13=['ENUM','inbound','internal','outbound','inbound-fax','DATE','INTEGER','sequelize','STRING'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xfe13,0x178));var _0x3fe1=function(_0x43f881,_0xd6e5a2){_0x43f881=_0x43f881-0x0;var _0x365c14=_0xfe13[_0x43f881];return _0x365c14;};'use strict';var Sequelize=require(_0x3fe1('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x3fe1('0x1')]},'type':{'type':Sequelize[_0x3fe1('0x2')](_0x3fe1('0x3'),_0x3fe1('0x4'),_0x3fe1('0x5'),_0x3fe1('0x6'),'outbound-fax','dialer')},'tag':{'type':Sequelize[_0x3fe1('0x1')]},'accountcode':{'type':Sequelize[_0x3fe1('0x1')]},'source':{'type':Sequelize[_0x3fe1('0x1')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x3fe1('0x1')]},'callerid':{'type':Sequelize[_0x3fe1('0x1')]},'channel':{'type':Sequelize[_0x3fe1('0x1')]},'destinationchannel':{'type':Sequelize[_0x3fe1('0x1')]},'lastapplication':{'type':Sequelize[_0x3fe1('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x3fe1('0x7')]},'answertime':{'type':Sequelize[_0x3fe1('0x7')]},'endtime':{'type':Sequelize[_0x3fe1('0x7')]},'duration':{'type':Sequelize[_0x3fe1('0x8')]},'billableseconds':{'type':Sequelize[_0x3fe1('0x8')]},'mohtime':{'type':Sequelize[_0x3fe1('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x3fe1('0x1')]},'amaflags':{'type':Sequelize[_0x3fe1('0x1')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x3fe1('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x3fe1('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x3fe1('0x1')]},'note':{'type':Sequelize[_0x3fe1('0x1')]},'prefix':{'type':Sequelize[_0x3fe1('0x1')]},'routeid':{'type':Sequelize[_0x3fe1('0x8')]},'sipcallid':{'type':Sequelize[_0x3fe1('0x1')]}}; \ No newline at end of file +var _0xf496=['dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','outbound','inbound-fax'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xf496,0x1c7));var _0x6f49=function(_0x4d01f1,_0x48b783){_0x4d01f1=_0x4d01f1-0x0;var _0x29a7cb=_0xf496[_0x4d01f1];return _0x29a7cb;};'use strict';var Sequelize=require(_0x6f49('0x0'));module[_0x6f49('0x1')]={'uniqueid':{'type':Sequelize[_0x6f49('0x2')]},'type':{'type':Sequelize[_0x6f49('0x3')](_0x6f49('0x4'),'internal',_0x6f49('0x5'),_0x6f49('0x6'),'outbound-fax',_0x6f49('0x7'))},'tag':{'type':Sequelize[_0x6f49('0x2')]},'accountcode':{'type':Sequelize[_0x6f49('0x2')]},'source':{'type':Sequelize[_0x6f49('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x6f49('0x2')]},'callerid':{'type':Sequelize[_0x6f49('0x2')]},'channel':{'type':Sequelize[_0x6f49('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x6f49('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x6f49('0x9')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x6f49('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x6f49('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x6f49('0x2')]},'userDisposition':{'type':Sequelize[_0x6f49('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x6f49('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x6f49('0x2')]},'note':{'type':Sequelize[_0x6f49('0x2')]},'prefix':{'type':Sequelize[_0x6f49('0x2')]},'routeid':{'type':Sequelize[_0x6f49('0xa')]},'sipcallid':{'type':Sequelize[_0x6f49('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 8942b4b..b2c1c11 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 _0x33af=['../../components/parsers/qs','api','../../mysqldb','promise-retry','json','offset','undefined','limit','count','status','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','fullname','User','findAll','rows','show','params','include','find','catch','create','body','describe','user','uniqueid','updateWithRetry','No\x20such\x20report'];(function(_0x5a4293,_0x52e4eb){var _0xe1b2ab=function(_0x56d341){while(--_0x56d341){_0x5a4293['push'](_0x5a4293['shift']());}};_0xe1b2ab(++_0x52e4eb);}(_0x33af,0xec));var _0xf33a=function(_0x46fdbb,_0x217295){_0x46fdbb=_0x46fdbb-0x0;var _0x219d7e=_0x33af[_0x46fdbb];return _0x219d7e;};'use strict';var _=require('lodash');var qs=require(_0xf33a('0x0'));var logger=require('../../config/logger')(_0xf33a('0x1'));var db=require(_0xf33a('0x2'))['db'];const promiseRetry=require(_0xf33a('0x3'));function respondWithResult(_0x4303f1,_0x169f02){_0x169f02=_0x169f02||0xc8;return function(_0x25f156){if(_0x25f156){return _0x4303f1['status'](_0x169f02)[_0xf33a('0x4')](_0x25f156);}};}function respondWithFilteredResult(_0x44cfa5,_0x583e54){return function(_0xc0dd13){if(_0xc0dd13){var _0x384b14=typeof _0x583e54[_0xf33a('0x5')]===_0xf33a('0x6')&&typeof _0x583e54[_0xf33a('0x7')]===_0xf33a('0x6');var _0x52517f=_0xc0dd13[_0xf33a('0x8')];var _0x14eb0e=_0x384b14?0x0:_0x583e54[_0xf33a('0x5')];var _0x457b3b=_0x384b14?_0xc0dd13[_0xf33a('0x8')]:_0x583e54[_0xf33a('0x5')]+_0x583e54['limit'];var _0x4ea282;if(_0x457b3b>=_0x52517f){_0x457b3b=_0x52517f;_0x4ea282=0xc8;}else{_0x4ea282=0xce;}_0x44cfa5[_0xf33a('0x9')](_0x4ea282);return _0x44cfa5[_0xf33a('0xa')](_0xf33a('0xb'),_0x14eb0e+'-'+_0x457b3b+'/'+_0x52517f)[_0xf33a('0x4')](_0xc0dd13);}return null;};}function saveUpdates(_0x338d1b){return function(_0x5959c9){if(_0x5959c9){return _0x5959c9[_0xf33a('0xc')](_0x338d1b)[_0xf33a('0xd')](function(_0x549978){return _0x549978;});}return null;};}function removeEntity(_0x506924){return function(_0x374b01){if(_0x374b01){return _0x374b01[_0xf33a('0xe')]()[_0xf33a('0xd')](function(){_0x506924[_0xf33a('0x9')](0xcc)[_0xf33a('0xf')]();});}};}function handleEntityNotFound(_0xc01217){return function(_0x45e311){if(!_0x45e311){_0xc01217[_0xf33a('0x10')](0x194);}return _0x45e311;};}function handleError(_0x507cb9,_0x441f59){_0x441f59=_0x441f59||0x1f4;return function(_0x5b5f27){logger[_0xf33a('0x11')](_0x5b5f27[_0xf33a('0x12')]);if(_0x5b5f27['name']){delete _0x5b5f27[_0xf33a('0x13')];}_0x507cb9[_0xf33a('0x9')](_0x441f59)['send'](_0x5b5f27);};}exports[_0xf33a('0x14')]=function(_0x23d9e2,_0x38d69a){var _0x2a9f0e={},_0x532502={},_0x11efa0={'count':0x0,'rows':[]};var _0x366bda=_[_0xf33a('0x15')](db[_0xf33a('0x16')][_0xf33a('0x17')],function(_0x6cdf7b){return{'name':_0x6cdf7b[_0xf33a('0x18')],'type':_0x6cdf7b[_0xf33a('0x19')][_0xf33a('0x1a')]};});_0x532502[_0xf33a('0x1b')]=_['map'](_0x366bda,_0xf33a('0x13'));_0x532502[_0xf33a('0x1c')]=_[_0xf33a('0x1d')](_0x23d9e2[_0xf33a('0x1c')]);_0x532502[_0xf33a('0x1e')]=_['intersection'](_0x532502[_0xf33a('0x1b')],_0x532502['query']);_0x2a9f0e[_0xf33a('0x1f')]=_[_0xf33a('0x20')](_0x532502[_0xf33a('0x1b')],qs[_0xf33a('0x21')](_0x23d9e2[_0xf33a('0x1c')]['fields']));_0x2a9f0e[_0xf33a('0x1f')]=_0x2a9f0e[_0xf33a('0x1f')]['length']?_0x2a9f0e['attributes']:_0x532502[_0xf33a('0x1b')];if(!_0x23d9e2['query']['hasOwnProperty'](_0xf33a('0x22'))){_0x2a9f0e['limit']=qs[_0xf33a('0x7')](_0x23d9e2['query'][_0xf33a('0x7')]);_0x2a9f0e[_0xf33a('0x5')]=qs[_0xf33a('0x5')](_0x23d9e2[_0xf33a('0x1c')][_0xf33a('0x5')]);}_0x2a9f0e[_0xf33a('0x23')]=qs[_0xf33a('0x24')](_0x23d9e2[_0xf33a('0x1c')][_0xf33a('0x24')]);_0x2a9f0e[_0xf33a('0x25')]=qs[_0xf33a('0x1e')](_[_0xf33a('0x26')](_0x23d9e2[_0xf33a('0x1c')],_0x532502[_0xf33a('0x1e')]),_0x366bda);if(_0x23d9e2[_0xf33a('0x1c')]['filter']){_0x2a9f0e[_0xf33a('0x25')]=_[_0xf33a('0x27')](_0x2a9f0e[_0xf33a('0x25')],{'$or':_[_0xf33a('0x15')](_0x366bda,function(_0x4ee492){if(_0x4ee492[_0xf33a('0x19')]!==_0xf33a('0x28')){var _0x2d9a9d={};_0x2d9a9d[_0x4ee492[_0xf33a('0x13')]]={'$like':'%'+_0x23d9e2[_0xf33a('0x1c')][_0xf33a('0x29')]+'%'};return _0x2d9a9d;}})});}_0x2a9f0e=_['merge']({},_0x2a9f0e,_0x23d9e2[_0xf33a('0x2a')]);var _0x6f5b94={'where':_0x2a9f0e[_0xf33a('0x25')]};return db[_0xf33a('0x16')][_0xf33a('0x8')](_0x6f5b94)['then'](function(_0x578998){_0x11efa0[_0xf33a('0x8')]=_0x578998;if(_0x23d9e2['query']['includeAll']){_0x2a9f0e['include']=[{'attributes':['id',_0xf33a('0x13'),_0xf33a('0x2b'),'alias'],'model':db[_0xf33a('0x2c')],'as':'User'}];}return db[_0xf33a('0x16')][_0xf33a('0x2d')](_0x2a9f0e);})[_0xf33a('0xd')](function(_0x2a8e9e){_0x11efa0[_0xf33a('0x2e')]=_0x2a8e9e;return _0x11efa0;})[_0xf33a('0xd')](respondWithFilteredResult(_0x38d69a,_0x2a9f0e))['catch'](handleError(_0x38d69a,null));};exports[_0xf33a('0x2f')]=function(_0x29a39f,_0x5b8607){var _0x380842={'raw':!![],'where':{'id':_0x29a39f[_0xf33a('0x30')]['id']}},_0x3793b4={};_0x3793b4['model']=_[_0xf33a('0x1d')](db[_0xf33a('0x16')][_0xf33a('0x17')]);_0x3793b4[_0xf33a('0x1c')]=_[_0xf33a('0x1d')](_0x29a39f[_0xf33a('0x1c')]);_0x3793b4[_0xf33a('0x1e')]=_[_0xf33a('0x20')](_0x3793b4[_0xf33a('0x1b')],_0x3793b4['query']);_0x380842[_0xf33a('0x1f')]=_[_0xf33a('0x20')](_0x3793b4['model'],qs[_0xf33a('0x21')](_0x29a39f['query']['fields']));_0x380842[_0xf33a('0x1f')]=_0x380842[_0xf33a('0x1f')]['length']?_0x380842[_0xf33a('0x1f')]:_0x3793b4[_0xf33a('0x1b')];if(_0x29a39f[_0xf33a('0x1c')]['includeAll']){_0x380842[_0xf33a('0x31')]=[{'all':!![]}];}_0x380842=_[_0xf33a('0x27')]({},_0x380842,_0x29a39f['options']);return db[_0xf33a('0x16')][_0xf33a('0x32')](_0x380842)[_0xf33a('0xd')](handleEntityNotFound(_0x5b8607,null))[_0xf33a('0xd')](respondWithResult(_0x5b8607,null))[_0xf33a('0x33')](handleError(_0x5b8607,null));};exports['create']=function(_0x45ae15,_0x1722e5){return db[_0xf33a('0x16')][_0xf33a('0x34')](_0x45ae15[_0xf33a('0x35')],{})['then'](respondWithResult(_0x1722e5,0xc9))[_0xf33a('0x33')](handleError(_0x1722e5,null));};exports[_0xf33a('0xe')]=function(_0x6ae3ef,_0x5da70c){return db[_0xf33a('0x16')][_0xf33a('0x32')]({'where':{'id':_0x6ae3ef[_0xf33a('0x30')]['id']}})[_0xf33a('0xd')](handleEntityNotFound(_0x5da70c,null))[_0xf33a('0xd')](removeEntity(_0x5da70c,null))[_0xf33a('0x33')](handleError(_0x5da70c,null));};exports['describe']=function(_0x19aade,_0xa9c2cd){return db[_0xf33a('0x16')][_0xf33a('0x36')]()[_0xf33a('0xd')](respondWithResult(_0xa9c2cd,null))['catch'](handleError(_0xa9c2cd,null));};function findForUpdate(_0xcc4390){return db[_0xf33a('0x16')][_0xf33a('0x32')]({'where':{'uniqueid':_0xcc4390['params']['id'],'UserId':{'$or':[null,_0xcc4390[_0xf33a('0x37')]['id']]}}});}exports[_0xf33a('0xc')]=function(_0x4bcb39,_0x4c0f24){if(_0x4bcb39[_0xf33a('0x35')]['uniqueid']){delete _0x4bcb39[_0xf33a('0x35')][_0xf33a('0x38')];}return findForUpdate(_0x4bcb39)[_0xf33a('0xd')](handleEntityNotFound(_0x4c0f24,null))[_0xf33a('0xd')](saveUpdates(_0x4bcb39[_0xf33a('0x35')],null))[_0xf33a('0xd')](respondWithResult(_0x4c0f24,null))[_0xf33a('0x33')](handleError(_0x4c0f24,null));};exports[_0xf33a('0x39')]=function(_0x205409,_0xbe98a9,_0x704817){if(_0x205409[_0xf33a('0x35')][_0xf33a('0x38')]){delete _0x205409[_0xf33a('0x35')][_0xf33a('0x38')];}promiseRetry(function(_0x1a8a4e){return findForUpdate(_0x205409)[_0xf33a('0xd')](function(_0x103ec7){if(_0x103ec7!==null){return _0x103ec7;}else{_0x1a8a4e(new Error(_0xf33a('0x3a')));}});},{'retries':0x4,'minTimeout':0xfa})[_0xf33a('0xd')](function(_0xc0f0d3){if(!_0xc0f0d3){return new Promise(function(_0x3ddcdc){_0x3ddcdc(handleEntityNotFound(_0xbe98a9)());});}else{return _0xc0f0d3[_0xf33a('0xc')](_0x205409[_0xf33a('0x35')])[_0xf33a('0xd')](function(_0x1b15a1){return respondWithResult(_0xbe98a9)(_0x1b15a1);});}},function(){handleEntityNotFound(_0xbe98a9)();});}; \ No newline at end of file +var _0x2581=['VIRTUAL','filter','merge','options','fullname','alias','User','findAll','catch','params','includeAll','include','find','create','body','describe','user','uniqueid','updateWithRetry','No\x20such\x20report','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','stack','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x2581,0xcb));var _0x1258=function(_0x2ba58,_0x2eaf8c){_0x2ba58=_0x2ba58-0x0;var _0x35e4b5=_0x2581[_0x2ba58];return _0x35e4b5;};'use strict';var _=require(_0x1258('0x0'));var qs=require(_0x1258('0x1'));var logger=require(_0x1258('0x2'))(_0x1258('0x3'));var db=require(_0x1258('0x4'))['db'];const promiseRetry=require('promise-retry');function respondWithResult(_0x37572e,_0x1235e5){_0x1235e5=_0x1235e5||0xc8;return function(_0x339891){if(_0x339891){return _0x37572e[_0x1258('0x5')](_0x1235e5)[_0x1258('0x6')](_0x339891);}};}function respondWithFilteredResult(_0x1a5749,_0x16c926){return function(_0x2aeafc){if(_0x2aeafc){var _0x582ed7=typeof _0x16c926[_0x1258('0x7')]===_0x1258('0x8')&&typeof _0x16c926[_0x1258('0x9')]===_0x1258('0x8');var _0x44be2b=_0x2aeafc[_0x1258('0xa')];var _0x429efc=_0x582ed7?0x0:_0x16c926['offset'];var _0x4c35f9=_0x582ed7?_0x2aeafc[_0x1258('0xa')]:_0x16c926[_0x1258('0x7')]+_0x16c926[_0x1258('0x9')];var _0x1fe32a;if(_0x4c35f9>=_0x44be2b){_0x4c35f9=_0x44be2b;_0x1fe32a=0xc8;}else{_0x1fe32a=0xce;}_0x1a5749['status'](_0x1fe32a);return _0x1a5749[_0x1258('0xb')](_0x1258('0xc'),_0x429efc+'-'+_0x4c35f9+'/'+_0x44be2b)[_0x1258('0x6')](_0x2aeafc);}return null;};}function saveUpdates(_0x241bad){return function(_0x57ad9f){if(_0x57ad9f){return _0x57ad9f[_0x1258('0xd')](_0x241bad)[_0x1258('0xe')](function(_0x37fee3){return _0x37fee3;});}return null;};}function removeEntity(_0x41b891){return function(_0x2f9cd6){if(_0x2f9cd6){return _0x2f9cd6[_0x1258('0xf')]()[_0x1258('0xe')](function(){_0x41b891['status'](0xcc)[_0x1258('0x10')]();});}};}function handleEntityNotFound(_0x56bd82){return function(_0x477502){if(!_0x477502){_0x56bd82[_0x1258('0x11')](0x194);}return _0x477502;};}function handleError(_0x3e662d,_0x26e676){_0x26e676=_0x26e676||0x1f4;return function(_0x313717){logger['error'](_0x313717[_0x1258('0x12')]);if(_0x313717[_0x1258('0x13')]){delete _0x313717[_0x1258('0x13')];}_0x3e662d['status'](_0x26e676)[_0x1258('0x14')](_0x313717);};}exports[_0x1258('0x15')]=function(_0x55c458,_0x2dd7fd){var _0x2432b2={},_0x2d3327={},_0xb0b379={'count':0x0,'rows':[]};var _0x24074b=_[_0x1258('0x16')](db[_0x1258('0x17')][_0x1258('0x18')],function(_0x3dade8){return{'name':_0x3dade8[_0x1258('0x19')],'type':_0x3dade8[_0x1258('0x1a')][_0x1258('0x1b')]};});_0x2d3327[_0x1258('0x1c')]=_[_0x1258('0x16')](_0x24074b,_0x1258('0x13'));_0x2d3327['query']=_[_0x1258('0x1d')](_0x55c458['query']);_0x2d3327['filters']=_[_0x1258('0x1e')](_0x2d3327[_0x1258('0x1c')],_0x2d3327[_0x1258('0x1f')]);_0x2432b2[_0x1258('0x20')]=_[_0x1258('0x1e')](_0x2d3327[_0x1258('0x1c')],qs[_0x1258('0x21')](_0x55c458['query'][_0x1258('0x21')]));_0x2432b2[_0x1258('0x20')]=_0x2432b2[_0x1258('0x20')][_0x1258('0x22')]?_0x2432b2[_0x1258('0x20')]:_0x2d3327[_0x1258('0x1c')];if(!_0x55c458[_0x1258('0x1f')][_0x1258('0x23')](_0x1258('0x24'))){_0x2432b2[_0x1258('0x9')]=qs[_0x1258('0x9')](_0x55c458[_0x1258('0x1f')][_0x1258('0x9')]);_0x2432b2['offset']=qs['offset'](_0x55c458[_0x1258('0x1f')]['offset']);}_0x2432b2[_0x1258('0x25')]=qs[_0x1258('0x26')](_0x55c458['query'][_0x1258('0x26')]);_0x2432b2[_0x1258('0x27')]=qs[_0x1258('0x28')](_['pick'](_0x55c458['query'],_0x2d3327[_0x1258('0x28')]),_0x24074b);if(_0x55c458[_0x1258('0x1f')]['filter']){_0x2432b2[_0x1258('0x27')]=_['merge'](_0x2432b2[_0x1258('0x27')],{'$or':_[_0x1258('0x16')](_0x24074b,function(_0x27d072){if(_0x27d072[_0x1258('0x1a')]!==_0x1258('0x29')){var _0x563a28={};_0x563a28[_0x27d072['name']]={'$like':'%'+_0x55c458[_0x1258('0x1f')][_0x1258('0x2a')]+'%'};return _0x563a28;}})});}_0x2432b2=_[_0x1258('0x2b')]({},_0x2432b2,_0x55c458[_0x1258('0x2c')]);var _0x3dac88={'where':_0x2432b2[_0x1258('0x27')]};return db['VoiceCallReport']['count'](_0x3dac88)[_0x1258('0xe')](function(_0x38057e){_0xb0b379['count']=_0x38057e;if(_0x55c458['query']['includeAll']){_0x2432b2['include']=[{'attributes':['id',_0x1258('0x13'),_0x1258('0x2d'),_0x1258('0x2e')],'model':db[_0x1258('0x2f')],'as':_0x1258('0x2f')}];}return db[_0x1258('0x17')][_0x1258('0x30')](_0x2432b2);})[_0x1258('0xe')](function(_0x32aed5){_0xb0b379['rows']=_0x32aed5;return _0xb0b379;})['then'](respondWithFilteredResult(_0x2dd7fd,_0x2432b2))[_0x1258('0x31')](handleError(_0x2dd7fd,null));};exports['show']=function(_0x2d2183,_0x5b777f){var _0x36c36e={'raw':!![],'where':{'id':_0x2d2183[_0x1258('0x32')]['id']}},_0x2edb1b={};_0x2edb1b[_0x1258('0x1c')]=_[_0x1258('0x1d')](db[_0x1258('0x17')][_0x1258('0x18')]);_0x2edb1b[_0x1258('0x1f')]=_['keys'](_0x2d2183[_0x1258('0x1f')]);_0x2edb1b[_0x1258('0x28')]=_[_0x1258('0x1e')](_0x2edb1b[_0x1258('0x1c')],_0x2edb1b[_0x1258('0x1f')]);_0x36c36e[_0x1258('0x20')]=_['intersection'](_0x2edb1b['model'],qs[_0x1258('0x21')](_0x2d2183[_0x1258('0x1f')][_0x1258('0x21')]));_0x36c36e['attributes']=_0x36c36e[_0x1258('0x20')]['length']?_0x36c36e['attributes']:_0x2edb1b[_0x1258('0x1c')];if(_0x2d2183[_0x1258('0x1f')][_0x1258('0x33')]){_0x36c36e[_0x1258('0x34')]=[{'all':!![]}];}_0x36c36e=_[_0x1258('0x2b')]({},_0x36c36e,_0x2d2183[_0x1258('0x2c')]);return db[_0x1258('0x17')][_0x1258('0x35')](_0x36c36e)[_0x1258('0xe')](handleEntityNotFound(_0x5b777f,null))[_0x1258('0xe')](respondWithResult(_0x5b777f,null))[_0x1258('0x31')](handleError(_0x5b777f,null));};exports[_0x1258('0x36')]=function(_0x24b415,_0x365344){return db['VoiceCallReport'][_0x1258('0x36')](_0x24b415[_0x1258('0x37')],{})[_0x1258('0xe')](respondWithResult(_0x365344,0xc9))[_0x1258('0x31')](handleError(_0x365344,null));};exports[_0x1258('0xf')]=function(_0x2f2e08,_0x1d11c5){return db['VoiceCallReport'][_0x1258('0x35')]({'where':{'id':_0x2f2e08[_0x1258('0x32')]['id']}})[_0x1258('0xe')](handleEntityNotFound(_0x1d11c5,null))[_0x1258('0xe')](removeEntity(_0x1d11c5,null))[_0x1258('0x31')](handleError(_0x1d11c5,null));};exports[_0x1258('0x38')]=function(_0x2f3be4,_0x10addc){return db[_0x1258('0x17')][_0x1258('0x38')]()[_0x1258('0xe')](respondWithResult(_0x10addc,null))[_0x1258('0x31')](handleError(_0x10addc,null));};function findForUpdate(_0x119fca){return db[_0x1258('0x17')][_0x1258('0x35')]({'where':{'uniqueid':_0x119fca[_0x1258('0x32')]['id'],'UserId':{'$or':[null,_0x119fca[_0x1258('0x39')]['id']]}}});}exports[_0x1258('0xd')]=function(_0x455415,_0x5e4ff4){if(_0x455415[_0x1258('0x37')][_0x1258('0x3a')]){delete _0x455415['body']['uniqueid'];}return findForUpdate(_0x455415)[_0x1258('0xe')](handleEntityNotFound(_0x5e4ff4,null))[_0x1258('0xe')](saveUpdates(_0x455415[_0x1258('0x37')],null))['then'](respondWithResult(_0x5e4ff4,null))[_0x1258('0x31')](handleError(_0x5e4ff4,null));};exports[_0x1258('0x3b')]=function(_0x4631a2,_0x55d6f7,_0x3ca592){if(_0x4631a2[_0x1258('0x37')][_0x1258('0x3a')]){delete _0x4631a2[_0x1258('0x37')]['uniqueid'];}promiseRetry(function(_0x579662){return findForUpdate(_0x4631a2)['then'](function(_0x3fcff8){if(_0x3fcff8!==null){return _0x3fcff8;}else{_0x579662(new Error(_0x1258('0x3c')));}});},{'retries':0x4,'minTimeout':0xfa})['then'](function(_0x73c23a){if(!_0x73c23a){return new Promise(function(_0x39b4d0){_0x39b4d0(handleEntityNotFound(_0x55d6f7)());});}else{return _0x73c23a[_0x1258('0xd')](_0x4631a2[_0x1258('0x37')])['then'](function(_0x3d7327){return respondWithResult(_0x55d6f7)(_0x3d7327);});}},function(){handleEntityNotFound(_0x55d6f7)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index d008a21..6c7e975 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 _0x8a23=['api','moment','bluebird','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a23,0x1a1));var _0x38a2=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x8a23[_0x174ef5];return _0x1cc379;};'use strict';var _=require(_0x38a2('0x0'));var util=require(_0x38a2('0x1'));var logger=require(_0x38a2('0x2'))(_0x38a2('0x3'));var moment=require(_0x38a2('0x4'));var BPromise=require(_0x38a2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x38a2('0x6'));var rimraf=require(_0x38a2('0x7'));var config=require(_0x38a2('0x8'));var attributes=require(_0x38a2('0x9'));module[_0x38a2('0xa')]=function(_0x50c60c,_0x4239b7){return _0x50c60c[_0x38a2('0xb')](_0x38a2('0xc'),attributes,{'tableName':_0x38a2('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc9b7=['../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x25e9d3,_0x4ece1a){var _0x34e2c6=function(_0x28f48b){while(--_0x28f48b){_0x25e9d3['push'](_0x25e9d3['shift']());}};_0x34e2c6(++_0x4ece1a);}(_0xc9b7,0x1ab));var _0x7c9b=function(_0x369f62,_0x17a354){_0x369f62=_0x369f62-0x0;var _0x323a6d=_0xc9b7[_0x369f62];return _0x323a6d;};'use strict';var _=require(_0x7c9b('0x0'));var util=require(_0x7c9b('0x1'));var logger=require(_0x7c9b('0x2'))(_0x7c9b('0x3'));var moment=require('moment');var BPromise=require(_0x7c9b('0x4'));var rp=require(_0x7c9b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7c9b('0x6'));var config=require(_0x7c9b('0x7'));var attributes=require(_0x7c9b('0x8'));module[_0x7c9b('0x9')]=function(_0x3d19d7,_0x4714e0){return _0x3d19d7[_0x7c9b('0xa')](_0x7c9b('0xb'),attributes,{'tableName':_0x7c9b('0xc'),'paranoid':![],'indexes':[{'fields':[_0x7c9b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 4e34d15..85d9a86 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 _0x9878=['../../config/environment','jayson/promise','client','http','request','then','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','map','include','model','debug','CreateVoiceCallReport','create','body','limit','UpdateVoiceCallReport','lodash','util','moment','randomstring','../../mysqldb','../../config/logger'];(function(_0x16fe64,_0x4a91e2){var _0x4d17cf=function(_0x429e26){while(--_0x429e26){_0x16fe64['push'](_0x16fe64['shift']());}};_0x4d17cf(++_0x4a91e2);}(_0x9878,0x150));var _0x8987=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9878[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8987('0x0'));var util=require(_0x8987('0x1'));var moment=require(_0x8987('0x2'));var BPromise=require('bluebird');var rs=require(_0x8987('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8987('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8987('0x5'))('rpc');var config=require(_0x8987('0x6'));var jayson=require(_0x8987('0x7'));var client=jayson[_0x8987('0x8')][_0x8987('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41eb57,_0x2a6aeb,_0x47202a){return new BPromise(function(_0x27afcd,_0x154ebe){return client[_0x8987('0xa')](_0x41eb57,_0x47202a)[_0x8987('0xb')](function(_0x542c79){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x2a6aeb,_0x8987('0xc'));logger['debug'](_0x8987('0xd'),_0x2a6aeb,_0x8987('0xc'),JSON[_0x8987('0xe')](_0x542c79));if(_0x542c79[_0x8987('0xf')]){if(_0x542c79['error'][_0x8987('0x10')]===0x1f4){logger['error'](_0x8987('0x11'),_0x2a6aeb,_0x542c79['error']['message']);return _0x154ebe(_0x542c79['error'][_0x8987('0x12')]);}logger['error'](_0x8987('0x11'),_0x2a6aeb,_0x542c79[_0x8987('0xf')]['message']);return _0x27afcd(_0x542c79[_0x8987('0xf')][_0x8987('0x12')]);}else{logger[_0x8987('0x13')](_0x8987('0x11'),_0x2a6aeb,_0x8987('0xc'));_0x27afcd(_0x542c79[_0x8987('0x14')]['message']);}})[_0x8987('0x15')](function(_0x56a58a){logger[_0x8987('0xf')](_0x8987('0x11'),_0x2a6aeb,_0x56a58a);_0x154ebe(_0x56a58a);});});}exports[_0x8987('0x16')]=function(_0x42ac0c){var _0x11e59e=this;return new Promise(function(_0x5c118a,_0x398557){return db[_0x8987('0x17')][_0x8987('0x18')]({'raw':_0x42ac0c[_0x8987('0x19')]?_0x42ac0c['options'][_0x8987('0x1a')]===undefined?!![]:![]:!![],'where':_0x42ac0c[_0x8987('0x19')]?_0x42ac0c[_0x8987('0x19')][_0x8987('0x1b')]||null:null,'attributes':_0x42ac0c[_0x8987('0x19')]?_0x42ac0c[_0x8987('0x19')][_0x8987('0x1c')]||null:null,'limit':_0x42ac0c['options']?_0x42ac0c['options']['limit']||null:null,'include':_0x42ac0c[_0x8987('0x19')]?_0x42ac0c[_0x8987('0x19')]['include']?_[_0x8987('0x1d')](_0x42ac0c[_0x8987('0x19')][_0x8987('0x1e')],function(_0xd776fe){return{'model':db[_0xd776fe[_0x8987('0x1f')]],'as':_0xd776fe['as'],'attributes':_0xd776fe[_0x8987('0x1c')],'include':_0xd776fe[_0x8987('0x1e')]?_[_0x8987('0x1d')](_0xd776fe[_0x8987('0x1e')],function(_0x2d0688){return{'model':db[_0x2d0688['model']],'as':_0x2d0688['as'],'attributes':_0x2d0688[_0x8987('0x1c')],'include':_0x2d0688[_0x8987('0x1e')]?_['map'](_0x2d0688['include'],function(_0x58a8c4){return{'model':db[_0x58a8c4['model']],'as':_0x58a8c4['as'],'attributes':_0x58a8c4[_0x8987('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8987('0xb')](function(_0x374a7a){logger['info'](_0x8987('0x16'),_0x42ac0c);logger[_0x8987('0x20')]('GetVoiceCallReport',_0x42ac0c,JSON['stringify'](_0x374a7a));_0x5c118a(_0x374a7a);})[_0x8987('0x15')](function(_0x3fec20){logger[_0x8987('0xf')]('GetVoiceCallReport',_0x3fec20[_0x8987('0x12')],_0x42ac0c);_0x398557(_0x11e59e[_0x8987('0xf')](0x1f4,_0x3fec20[_0x8987('0x12')]));});});};exports[_0x8987('0x21')]=function(_0xf3af17){var _0x4e2952=this;return new Promise(function(_0x4097bf,_0x135989){return db[_0x8987('0x17')][_0x8987('0x22')](_0xf3af17[_0x8987('0x23')],{'raw':_0xf3af17[_0x8987('0x19')]?_0xf3af17[_0x8987('0x19')][_0x8987('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x31ae7d){logger[_0x8987('0x13')]('CreateVoiceCallReport',_0xf3af17);logger[_0x8987('0x20')](_0x8987('0x21'),_0xf3af17,JSON[_0x8987('0xe')](_0x31ae7d));_0x4097bf(_0x31ae7d);})[_0x8987('0x15')](function(_0x336a12){logger[_0x8987('0xf')](_0x8987('0x21'),_0x336a12[_0x8987('0x12')],_0xf3af17);_0x135989(_0x4e2952[_0x8987('0xf')](0x1f4,_0x336a12['message']));});});};exports['UpdateVoiceCallReport']=function(_0x4fd23f){var _0x1bd7bf=this;return new Promise(function(_0xa38dca,_0x5f5d68){return db[_0x8987('0x17')]['update'](_0x4fd23f[_0x8987('0x23')],{'raw':_0x4fd23f[_0x8987('0x19')]?_0x4fd23f[_0x8987('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fd23f['options']?_0x4fd23f[_0x8987('0x19')][_0x8987('0x1b')]||null:null,'attributes':_0x4fd23f[_0x8987('0x19')]?_0x4fd23f[_0x8987('0x19')][_0x8987('0x1c')]||null:null,'limit':_0x4fd23f[_0x8987('0x19')]?_0x4fd23f['options'][_0x8987('0x24')]||null:null})[_0x8987('0xb')](function(_0x15f366){logger['info'](_0x8987('0x25'),_0x4fd23f);logger[_0x8987('0x20')]('UpdateVoiceCallReport',_0x4fd23f,JSON['stringify'](_0x15f366));_0xa38dca(_0x15f366);})[_0x8987('0x15')](function(_0x1335b2){logger[_0x8987('0xf')](_0x8987('0x25'),_0x1335b2[_0x8987('0x12')],_0x4fd23f);_0x5f5d68(_0x1bd7bf['error'](0x1f4,_0x1335b2[_0x8987('0x12')]));});});}; \ No newline at end of file +var _0x7130=['catch','CreateVoiceCallReport','UpdateVoiceCallReport','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','model','map','GetVoiceCallReport'];(function(_0x534fe9,_0x19dd75){var _0x48592c=function(_0x26a7c3){while(--_0x26a7c3){_0x534fe9['push'](_0x534fe9['shift']());}};_0x48592c(++_0x19dd75);}(_0x7130,0x72));var _0x0713=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x7130[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x0713('0x0'));var util=require(_0x0713('0x1'));var moment=require(_0x0713('0x2'));var BPromise=require('bluebird');var rs=require(_0x0713('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0713('0x4'))['db'];var utils=require(_0x0713('0x5'));var logger=require(_0x0713('0x6'))(_0x0713('0x7'));var config=require(_0x0713('0x8'));var jayson=require(_0x0713('0x9'));var client=jayson[_0x0713('0xa')][_0x0713('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c6335,_0x358236,_0x259e6d){return new BPromise(function(_0x2d1897,_0x59cefa){return client['request'](_0x1c6335,_0x259e6d)[_0x0713('0xc')](function(_0x3f0082){logger[_0x0713('0xd')](_0x0713('0xe'),_0x358236,_0x0713('0xf'));logger[_0x0713('0x10')](_0x0713('0x11'),_0x358236,_0x0713('0xf'),JSON[_0x0713('0x12')](_0x3f0082));if(_0x3f0082['error']){if(_0x3f0082[_0x0713('0x13')][_0x0713('0x14')]===0x1f4){logger['error'](_0x0713('0xe'),_0x358236,_0x3f0082[_0x0713('0x13')][_0x0713('0x15')]);return _0x59cefa(_0x3f0082[_0x0713('0x13')][_0x0713('0x15')]);}logger['error'](_0x0713('0xe'),_0x358236,_0x3f0082[_0x0713('0x13')][_0x0713('0x15')]);return _0x2d1897(_0x3f0082[_0x0713('0x13')]['message']);}else{logger['info'](_0x0713('0xe'),_0x358236,_0x0713('0xf'));_0x2d1897(_0x3f0082[_0x0713('0x16')]['message']);}})['catch'](function(_0xbcfc20){logger[_0x0713('0x13')](_0x0713('0xe'),_0x358236,_0xbcfc20);_0x59cefa(_0xbcfc20);});});}exports['GetVoiceCallReport']=function(_0x520d70){var _0x3873ee=this;return new Promise(function(_0x5078b3,_0x265509){return db[_0x0713('0x17')][_0x0713('0x18')]({'raw':_0x520d70['options']?_0x520d70[_0x0713('0x19')][_0x0713('0x1a')]===undefined?!![]:![]:!![],'where':_0x520d70[_0x0713('0x19')]?_0x520d70[_0x0713('0x19')][_0x0713('0x1b')]||null:null,'attributes':_0x520d70['options']?_0x520d70[_0x0713('0x19')][_0x0713('0x1c')]||null:null,'limit':_0x520d70[_0x0713('0x19')]?_0x520d70[_0x0713('0x19')][_0x0713('0x1d')]||null:null,'include':_0x520d70[_0x0713('0x19')]?_0x520d70[_0x0713('0x19')][_0x0713('0x1e')]?_['map'](_0x520d70['options'][_0x0713('0x1e')],function(_0x45348a){return{'model':db[_0x45348a[_0x0713('0x1f')]],'as':_0x45348a['as'],'attributes':_0x45348a[_0x0713('0x1c')],'include':_0x45348a[_0x0713('0x1e')]?_[_0x0713('0x20')](_0x45348a[_0x0713('0x1e')],function(_0x5527e7){return{'model':db[_0x5527e7['model']],'as':_0x5527e7['as'],'attributes':_0x5527e7['attributes'],'include':_0x5527e7[_0x0713('0x1e')]?_[_0x0713('0x20')](_0x5527e7[_0x0713('0x1e')],function(_0x3f4f74){return{'model':db[_0x3f4f74[_0x0713('0x1f')]],'as':_0x3f4f74['as'],'attributes':_0x3f4f74[_0x0713('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0713('0xc')](function(_0x2bdd13){logger['info'](_0x0713('0x21'),_0x520d70);logger['debug']('GetVoiceCallReport',_0x520d70,JSON[_0x0713('0x12')](_0x2bdd13));_0x5078b3(_0x2bdd13);})[_0x0713('0x22')](function(_0x1df5f6){logger[_0x0713('0x13')]('GetVoiceCallReport',_0x1df5f6[_0x0713('0x15')],_0x520d70);_0x265509(_0x3873ee[_0x0713('0x13')](0x1f4,_0x1df5f6['message']));});});};exports['CreateVoiceCallReport']=function(_0x4d4030){var _0x1af4ac=this;return new Promise(function(_0x3905a0,_0x4666ca){return db['VoiceCallReport']['create'](_0x4d4030['body'],{'raw':_0x4d4030[_0x0713('0x19')]?_0x4d4030[_0x0713('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x0713('0xc')](function(_0x933a93){logger[_0x0713('0xd')](_0x0713('0x23'),_0x4d4030);logger[_0x0713('0x10')](_0x0713('0x23'),_0x4d4030,JSON[_0x0713('0x12')](_0x933a93));_0x3905a0(_0x933a93);})['catch'](function(_0x441b20){logger['error'](_0x0713('0x23'),_0x441b20[_0x0713('0x15')],_0x4d4030);_0x4666ca(_0x1af4ac[_0x0713('0x13')](0x1f4,_0x441b20[_0x0713('0x15')]));});});};exports['UpdateVoiceCallReport']=function(_0x3edd3e){var _0x3d257f=this;return new Promise(function(_0x4dbc73,_0x13e654){return db[_0x0713('0x17')]['update'](_0x3edd3e['body'],{'raw':_0x3edd3e['options']?_0x3edd3e['options'][_0x0713('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3edd3e['options']?_0x3edd3e['options'][_0x0713('0x1b')]||null:null,'attributes':_0x3edd3e[_0x0713('0x19')]?_0x3edd3e[_0x0713('0x19')][_0x0713('0x1c')]||null:null,'limit':_0x3edd3e['options']?_0x3edd3e[_0x0713('0x19')][_0x0713('0x1d')]||null:null})['then'](function(_0xa9a6d9){logger[_0x0713('0xd')](_0x0713('0x24'),_0x3edd3e);logger[_0x0713('0x10')](_0x0713('0x24'),_0x3edd3e,JSON[_0x0713('0x12')](_0xa9a6d9));_0x4dbc73(_0xa9a6d9);})[_0x0713('0x22')](function(_0x1375bc){logger['error'](_0x0713('0x24'),_0x1375bc[_0x0713('0x15')],_0x3edd3e);_0x13e654(_0x3d257f[_0x0713('0x13')](0x1f4,_0x1375bc[_0x0713('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index c4ea1a6..ebc8cee 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 _0x65fc=['/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x65fc,0x15c));var _0xc65f=function(_0x5e0f76,_0x23bf31){_0x5e0f76=_0x5e0f76-0x0;var _0x35f07a=_0x65fc[_0x5e0f76];return _0x35f07a;};'use strict';var multer=require(_0xc65f('0x0'));var util=require(_0xc65f('0x1'));var path=require(_0xc65f('0x2'));var timeout=require(_0xc65f('0x3'));var express=require('express');var router=express[_0xc65f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc65f('0x5'));var interaction=require(_0xc65f('0x6'));var config=require(_0xc65f('0x7'));var controller=require(_0xc65f('0x8'));router[_0xc65f('0x9')]('/',auth[_0xc65f('0xa')](),controller[_0xc65f('0xb')]);router[_0xc65f('0x9')](_0xc65f('0xc'),auth[_0xc65f('0xa')](),controller['show']);router[_0xc65f('0xd')]('/',auth['isAuthenticated'](),controller[_0xc65f('0xe')]);router[_0xc65f('0xf')](_0xc65f('0xc'),auth[_0xc65f('0xa')](),controller[_0xc65f('0x10')]);router[_0xc65f('0x11')](_0xc65f('0xc'),auth[_0xc65f('0xa')](),controller[_0xc65f('0x12')]);module[_0xc65f('0x13')]=router; \ No newline at end of file +var _0x4a0f=['../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x38dca6,_0x471cb7){var _0x29bcd7=function(_0x174c5d){while(--_0x174c5d){_0x38dca6['push'](_0x38dca6['shift']());}};_0x29bcd7(++_0x471cb7);}(_0x4a0f,0x15e));var _0xf4a0=function(_0x4995af,_0x4807b7){_0x4995af=_0x4995af-0x0;var _0x331c97=_0x4a0f[_0x4995af];return _0x331c97;};'use strict';var multer=require(_0xf4a0('0x0'));var util=require(_0xf4a0('0x1'));var path=require(_0xf4a0('0x2'));var timeout=require('connect-timeout');var express=require(_0xf4a0('0x3'));var router=express[_0xf4a0('0x4')]();var fs_extra=require(_0xf4a0('0x5'));var auth=require(_0xf4a0('0x6'));var interaction=require(_0xf4a0('0x7'));var config=require(_0xf4a0('0x8'));var controller=require(_0xf4a0('0x9'));router[_0xf4a0('0xa')]('/',auth[_0xf4a0('0xb')](),controller[_0xf4a0('0xc')]);router['get'](_0xf4a0('0xd'),auth[_0xf4a0('0xb')](),controller[_0xf4a0('0xe')]);router[_0xf4a0('0xf')]('/',auth[_0xf4a0('0xb')](),controller[_0xf4a0('0x10')]);router[_0xf4a0('0x11')](_0xf4a0('0xd'),auth[_0xf4a0('0xb')](),controller[_0xf4a0('0x12')]);router[_0xf4a0('0x13')](_0xf4a0('0xd'),auth[_0xf4a0('0xb')](),controller[_0xf4a0('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 6fb9dbb..9e5c5ef 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 _0x2f25=['sequelize','exports','STRING','name','setDataValue','options','join','getDataValue','split','BOOLEAN'];(function(_0x26aa88,_0x12eb93){var _0x5560b0=function(_0x47906a){while(--_0x47906a){_0x26aa88['push'](_0x26aa88['shift']());}};_0x5560b0(++_0x12eb93);}(_0x2f25,0x12c));var _0x52f2=function(_0x91489c,_0x46b3db){_0x91489c=_0x91489c-0x0;var _0x30c7b6=_0x2f25[_0x91489c];return _0x30c7b6;};'use strict';var Sequelize=require(_0x52f2('0x0'));module[_0x52f2('0x1')]={'name':{'type':Sequelize[_0x52f2('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x52f2('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x52f2('0x2')],'set':function(_0x2f6ade){this[_0x52f2('0x4')](_0x52f2('0x5'),_0x2f6ade?_0x2f6ade[_0x52f2('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x52f2('0x5'))?this[_0x52f2('0x7')](_0x52f2('0x5'))[_0x52f2('0x8')](''):[];}},'auth':{'type':Sequelize[_0x52f2('0x9')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x52f2('0x2')]},'description':{'type':Sequelize[_0x52f2('0x2')]}}; \ No newline at end of file +var _0xfecb=['sequelize','STRING','setDataValue','options','join','getDataValue','split','BOOLEAN'];(function(_0xb24fad,_0xd58756){var _0x173226=function(_0x33b4d6){while(--_0x33b4d6){_0xb24fad['push'](_0xb24fad['shift']());}};_0x173226(++_0xd58756);}(_0xfecb,0x130));var _0xbfec=function(_0x69f39b,_0x1993c3){_0x69f39b=_0x69f39b-0x0;var _0x477505=_0xfecb[_0x69f39b];return _0x477505;};'use strict';var Sequelize=require(_0xbfec('0x0'));module['exports']={'name':{'type':Sequelize[_0xbfec('0x1')]},'prefix':{'type':Sequelize[_0xbfec('0x1')],'unique':'name','allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x23d10d){this[_0xbfec('0x2')](_0xbfec('0x3'),_0x23d10d?_0x23d10d[_0xbfec('0x4')](''):[]);},'get':function(){return this[_0xbfec('0x5')](_0xbfec('0x3'))?this[_0xbfec('0x5')](_0xbfec('0x3'))[_0xbfec('0x6')](''):[];}},'auth':{'type':Sequelize[_0xbfec('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xbfec('0x1')]},'record':{'type':Sequelize[_0xbfec('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xbfec('0x1')]},'description':{'type':Sequelize[_0xbfec('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index e3471f4..863b444 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 _0x67da=['json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','ChanSpies','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceChanSpy','include','findAll','catch','params','intersection','length','includeAll','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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/license/util','../../mysqldb','status'];(function(_0x46728b,_0x376bc6){var _0x5aa8e2=function(_0x111c54){while(--_0x111c54){_0x46728b['push'](_0x46728b['shift']());}};_0x5aa8e2(++_0x376bc6);}(_0x67da,0x192));var _0xa67d=function(_0x5d963e,_0x5edbfe){_0x5d963e=_0x5d963e-0x0;var _0x523c8e=_0x67da[_0x5d963e];return _0x523c8e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa67d('0x0'));var zipdir=require(_0xa67d('0x1'));var jsonpatch=require(_0xa67d('0x2'));var rp=require(_0xa67d('0x3'));var moment=require(_0xa67d('0x4'));var BPromise=require(_0xa67d('0x5'));var Mustache=require(_0xa67d('0x6'));var util=require(_0xa67d('0x7'));var path=require(_0xa67d('0x8'));var sox=require(_0xa67d('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa67d('0xa'));var _=require('lodash');var squel=require(_0xa67d('0xb'));var crypto=require(_0xa67d('0xc'));var jsforce=require(_0xa67d('0xd'));var deskjs=require(_0xa67d('0xe'));var toCsv=require(_0xa67d('0xf'));var querystring=require(_0xa67d('0x10'));var Papa=require(_0xa67d('0x11'));var Redis=require(_0xa67d('0x12'));var authService=require(_0xa67d('0x13'));var qs=require(_0xa67d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa67d('0x15'));var logger=require(_0xa67d('0x16'))(_0xa67d('0x17'));var utils=require(_0xa67d('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xa67d('0x19'));var db=require(_0xa67d('0x1a'))['db'];function respondWithStatusCode(_0x560485,_0x4e86f6){_0x4e86f6=_0x4e86f6||0xcc;return function(_0x304ee2){if(_0x304ee2){return _0x560485['sendStatus'](_0x4e86f6);}return _0x560485[_0xa67d('0x1b')](_0x4e86f6)['end']();};}function respondWithResult(_0x5d757b,_0x22dcc7){_0x22dcc7=_0x22dcc7||0xc8;return function(_0x3b99e3){if(_0x3b99e3){return _0x5d757b['status'](_0x22dcc7)[_0xa67d('0x1c')](_0x3b99e3);}};}function respondWithFilteredResult(_0x267a67,_0x1cfe81){return function(_0x288e5f){if(_0x288e5f){var _0x5a47de=typeof _0x1cfe81['offset']==='undefined'&&typeof _0x1cfe81['limit']===_0xa67d('0x1d');var _0x553811=_0x288e5f[_0xa67d('0x1e')];var _0xf8422c=_0x5a47de?0x0:_0x1cfe81[_0xa67d('0x1f')];var _0x1b58c3=_0x5a47de?_0x288e5f[_0xa67d('0x1e')]:_0x1cfe81[_0xa67d('0x1f')]+_0x1cfe81[_0xa67d('0x20')];var _0x5538a5;if(_0x1b58c3>=_0x553811){_0x1b58c3=_0x553811;_0x5538a5=0xc8;}else{_0x5538a5=0xce;}_0x267a67[_0xa67d('0x1b')](_0x5538a5);return _0x267a67[_0xa67d('0x21')](_0xa67d('0x22'),_0xf8422c+'-'+_0x1b58c3+'/'+_0x553811)[_0xa67d('0x1c')](_0x288e5f);}return null;};}function patchUpdates(_0x28f38b){return function(_0x1c3498){try{jsonpatch['apply'](_0x1c3498,_0x28f38b,!![]);}catch(_0x3f1898){return BPromise[_0xa67d('0x23')](_0x3f1898);}return _0x1c3498[_0xa67d('0x24')]();};}function saveUpdates(_0xed6c3e,_0x48f240){return function(_0x276ef7){if(_0x276ef7){return _0x276ef7['update'](_0xed6c3e)[_0xa67d('0x25')](function(_0x415141){return _0x415141;});}return null;};}function removeEntity(_0x46bbc8,_0x9c2935){return function(_0x559009){if(_0x559009){return _0x559009[_0xa67d('0x26')]()[_0xa67d('0x25')](function(){var _0x5ed92a=_0x559009[_0xa67d('0x27')]({'plain':!![]});var _0x3dd0b9=_0xa67d('0x28');return db[_0xa67d('0x29')][_0xa67d('0x26')]({'where':{'type':_0x3dd0b9,'resourceId':_0x5ed92a['id']}})[_0xa67d('0x25')](function(){return _0x559009;});})['then'](function(){_0x46bbc8[_0xa67d('0x1b')](0xcc)[_0xa67d('0x2a')]();});}};}function handleEntityNotFound(_0x4e730e,_0x2ac61a){return function(_0x83b547){if(!_0x83b547){_0x4e730e[_0xa67d('0x2b')](0x194);}return _0x83b547;};}function handleError(_0x1e7f28,_0x40f829){_0x40f829=_0x40f829||0x1f4;return function(_0x8793cf){logger[_0xa67d('0x2c')](_0x8793cf[_0xa67d('0x2d')]);if(_0x8793cf[_0xa67d('0x2e')]){delete _0x8793cf[_0xa67d('0x2e')];}_0x1e7f28[_0xa67d('0x1b')](_0x40f829)[_0xa67d('0x2f')](_0x8793cf);};}exports[_0xa67d('0x30')]=function(_0x393269,_0x5e4f04){var _0x2998af={},_0x20c751={},_0x1fc18f={'count':0x0,'rows':[]};var _0x2703f5=_[_0xa67d('0x31')](db['VoiceChanSpy'][_0xa67d('0x32')],function(_0xc2b129){return{'name':_0xc2b129[_0xa67d('0x33')],'type':_0xc2b129[_0xa67d('0x34')][_0xa67d('0x35')]};});_0x20c751[_0xa67d('0x36')]=_[_0xa67d('0x31')](_0x2703f5,_0xa67d('0x2e'));_0x20c751[_0xa67d('0x37')]=_[_0xa67d('0x38')](_0x393269['query']);_0x20c751[_0xa67d('0x39')]=_['intersection'](_0x20c751[_0xa67d('0x36')],_0x20c751[_0xa67d('0x37')]);_0x2998af[_0xa67d('0x3a')]=_['intersection'](_0x20c751[_0xa67d('0x36')],qs[_0xa67d('0x3b')](_0x393269[_0xa67d('0x37')][_0xa67d('0x3b')]));_0x2998af[_0xa67d('0x3a')]=_0x2998af[_0xa67d('0x3a')]['length']?_0x2998af[_0xa67d('0x3a')]:_0x20c751[_0xa67d('0x36')];if(!_0x393269['query']['hasOwnProperty']('nolimit')){_0x2998af[_0xa67d('0x20')]=qs['limit'](_0x393269[_0xa67d('0x37')][_0xa67d('0x20')]);_0x2998af[_0xa67d('0x1f')]=qs[_0xa67d('0x1f')](_0x393269[_0xa67d('0x37')][_0xa67d('0x1f')]);}_0x2998af[_0xa67d('0x3c')]=qs[_0xa67d('0x3d')](_0x393269[_0xa67d('0x37')][_0xa67d('0x3d')]);_0x2998af[_0xa67d('0x3e')]=qs[_0xa67d('0x39')](_[_0xa67d('0x3f')](_0x393269['query'],_0x20c751['filters']),_0x2703f5);if(_0x393269['query'][_0xa67d('0x40')]){_0x2998af['where']=_[_0xa67d('0x41')](_0x2998af[_0xa67d('0x3e')],{'$or':_[_0xa67d('0x31')](_0x2703f5,function(_0x3777ae){if(_0x3777ae['type']!==_0xa67d('0x42')){var _0x46669f={};_0x46669f[_0x3777ae[_0xa67d('0x2e')]]={'$like':'%'+_0x393269[_0xa67d('0x37')][_0xa67d('0x40')]+'%'};return _0x46669f;}})});}_0x2998af=_[_0xa67d('0x41')]({},_0x2998af,_0x393269[_0xa67d('0x43')]);var _0x5b51dc={'where':_0x2998af['where']};return db[_0xa67d('0x44')][_0xa67d('0x1e')](_0x5b51dc)[_0xa67d('0x25')](function(_0x15b9b8){_0x1fc18f[_0xa67d('0x1e')]=_0x15b9b8;if(_0x393269[_0xa67d('0x37')]['includeAll']){_0x2998af[_0xa67d('0x45')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0xa67d('0x46')](_0x2998af);})[_0xa67d('0x25')](function(_0x2f698c){_0x1fc18f['rows']=_0x2f698c;return _0x1fc18f;})[_0xa67d('0x25')](respondWithFilteredResult(_0x5e4f04,_0x2998af))[_0xa67d('0x47')](handleError(_0x5e4f04,null));};exports['show']=function(_0x5765a8,_0xcd7852){var _0x5f0af2={'raw':![],'where':{'id':_0x5765a8[_0xa67d('0x48')]['id']}},_0x23f1e1={};_0x23f1e1[_0xa67d('0x36')]=_['keys'](db[_0xa67d('0x44')]['rawAttributes']);_0x23f1e1[_0xa67d('0x37')]=_[_0xa67d('0x38')](_0x5765a8['query']);_0x23f1e1[_0xa67d('0x39')]=_[_0xa67d('0x49')](_0x23f1e1[_0xa67d('0x36')],_0x23f1e1[_0xa67d('0x37')]);_0x5f0af2[_0xa67d('0x3a')]=_[_0xa67d('0x49')](_0x23f1e1[_0xa67d('0x36')],qs[_0xa67d('0x3b')](_0x5765a8['query'][_0xa67d('0x3b')]));_0x5f0af2[_0xa67d('0x3a')]=_0x5f0af2[_0xa67d('0x3a')][_0xa67d('0x4a')]?_0x5f0af2[_0xa67d('0x3a')]:_0x23f1e1['model'];if(_0x5765a8['query'][_0xa67d('0x4b')]){_0x5f0af2[_0xa67d('0x45')]=[{'all':!![]}];}_0x5f0af2=_[_0xa67d('0x41')]({},_0x5f0af2,_0x5765a8[_0xa67d('0x43')]);return db[_0xa67d('0x44')]['find'](_0x5f0af2)[_0xa67d('0x25')](handleEntityNotFound(_0xcd7852,null))['then'](respondWithResult(_0xcd7852,null))[_0xa67d('0x47')](handleError(_0xcd7852,null));};exports[_0xa67d('0x4c')]=function(_0x1c451f,_0x1dba18){return db[_0xa67d('0x44')]['create'](_0x1c451f[_0xa67d('0x4d')],{})[_0xa67d('0x25')](function(_0x348ebd){var _0x5833c2=_0x1c451f[_0xa67d('0x4e')][_0xa67d('0x27')]({'plain':!![]});if(!_0x5833c2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5833c2[_0xa67d('0x4f')]===_0xa67d('0x4e')){var _0x51c887=_0x348ebd['get']({'plain':!![]});var _0x21581d=_0xa67d('0x28');return db[_0xa67d('0x50')][_0xa67d('0x51')]({'where':{'name':_0x21581d,'userProfileId':_0x5833c2[_0xa67d('0x52')]},'raw':!![]})[_0xa67d('0x25')](function(_0x355ae2){if(_0x355ae2&&_0x355ae2[_0xa67d('0x53')]===0x0){return db[_0xa67d('0x29')]['create']({'name':_0x51c887[_0xa67d('0x2e')],'resourceId':_0x51c887['id'],'type':_0x355ae2[_0xa67d('0x2e')],'sectionId':_0x355ae2['id']},{})['then'](function(){return _0x348ebd;});}else{return _0x348ebd;}})[_0xa67d('0x47')](function(_0x18f99d){logger['error'](_0xa67d('0x54'),_0x18f99d);throw _0x18f99d;});}return _0x348ebd;})['then'](respondWithResult(_0x1dba18,0xc9))[_0xa67d('0x47')](handleError(_0x1dba18,null));};exports[_0xa67d('0x55')]=function(_0x503413,_0x1de1fb){if(_0x503413[_0xa67d('0x4d')]['id']){delete _0x503413[_0xa67d('0x4d')]['id'];}return db[_0xa67d('0x44')][_0xa67d('0x51')]({'where':{'id':_0x503413[_0xa67d('0x48')]['id']}})[_0xa67d('0x25')](handleEntityNotFound(_0x1de1fb,null))[_0xa67d('0x25')](saveUpdates(_0x503413['body'],null))[_0xa67d('0x25')](respondWithResult(_0x1de1fb,null))[_0xa67d('0x47')](handleError(_0x1de1fb,null));};exports[_0xa67d('0x26')]=function(_0x42fb68,_0x539307){return db[_0xa67d('0x44')][_0xa67d('0x51')]({'where':{'id':_0x42fb68[_0xa67d('0x48')]['id']}})[_0xa67d('0x25')](handleEntityNotFound(_0x539307,null))[_0xa67d('0x25')](removeEntity(_0x539307,null))[_0xa67d('0x47')](handleError(_0x539307,null));}; \ No newline at end of file +var _0xf2c7=['destroy','then','get','ChanSpies','sendStatus','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','catch','show','params','keys','length','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update'];(function(_0x3486e0,_0x3b80ac){var _0x1a6dab=function(_0x423608){while(--_0x423608){_0x3486e0['push'](_0x3486e0['shift']());}};_0x1a6dab(++_0x3b80ac);}(_0xf2c7,0x1d8));var _0x7f2c=function(_0x36909d,_0x2795f1){_0x36909d=_0x36909d-0x0;var _0x1fd29d=_0xf2c7[_0x36909d];return _0x1fd29d;};'use strict';var emlformat=require(_0x7f2c('0x0'));var rimraf=require(_0x7f2c('0x1'));var zipdir=require(_0x7f2c('0x2'));var jsonpatch=require(_0x7f2c('0x3'));var rp=require('request-promise');var moment=require(_0x7f2c('0x4'));var BPromise=require(_0x7f2c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7f2c('0x6'));var sox=require('sox');var csv=require(_0x7f2c('0x7'));var ejs=require(_0x7f2c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7f2c('0x9'));var squel=require(_0x7f2c('0xa'));var crypto=require(_0x7f2c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7f2c('0xc'));var toCsv=require(_0x7f2c('0x7'));var querystring=require(_0x7f2c('0xd'));var Papa=require(_0x7f2c('0xe'));var Redis=require(_0x7f2c('0xf'));var authService=require(_0x7f2c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7f2c('0x11'));var hardwareService=require(_0x7f2c('0x12'));var logger=require(_0x7f2c('0x13'))(_0x7f2c('0x14'));var utils=require(_0x7f2c('0x15'));var config=require(_0x7f2c('0x16'));var licenseUtil=require(_0x7f2c('0x17'));var db=require(_0x7f2c('0x18'))['db'];function respondWithStatusCode(_0x1c280d,_0x53309e){_0x53309e=_0x53309e||0xcc;return function(_0x2af83c){if(_0x2af83c){return _0x1c280d['sendStatus'](_0x53309e);}return _0x1c280d[_0x7f2c('0x19')](_0x53309e)[_0x7f2c('0x1a')]();};}function respondWithResult(_0x4e83ee,_0x51186f){_0x51186f=_0x51186f||0xc8;return function(_0x2a3409){if(_0x2a3409){return _0x4e83ee[_0x7f2c('0x19')](_0x51186f)['json'](_0x2a3409);}};}function respondWithFilteredResult(_0x3282f9,_0x153c8c){return function(_0x5d9aa2){if(_0x5d9aa2){var _0x1846c6=typeof _0x153c8c[_0x7f2c('0x1b')]===_0x7f2c('0x1c')&&typeof _0x153c8c[_0x7f2c('0x1d')]===_0x7f2c('0x1c');var _0x31858f=_0x5d9aa2[_0x7f2c('0x1e')];var _0xd8eb94=_0x1846c6?0x0:_0x153c8c[_0x7f2c('0x1b')];var _0x1d4ec4=_0x1846c6?_0x5d9aa2['count']:_0x153c8c['offset']+_0x153c8c[_0x7f2c('0x1d')];var _0x45b3e3;if(_0x1d4ec4>=_0x31858f){_0x1d4ec4=_0x31858f;_0x45b3e3=0xc8;}else{_0x45b3e3=0xce;}_0x3282f9[_0x7f2c('0x19')](_0x45b3e3);return _0x3282f9[_0x7f2c('0x1f')](_0x7f2c('0x20'),_0xd8eb94+'-'+_0x1d4ec4+'/'+_0x31858f)[_0x7f2c('0x21')](_0x5d9aa2);}return null;};}function patchUpdates(_0x130e51){return function(_0x13d338){try{jsonpatch[_0x7f2c('0x22')](_0x13d338,_0x130e51,!![]);}catch(_0x196651){return BPromise[_0x7f2c('0x23')](_0x196651);}return _0x13d338[_0x7f2c('0x24')]();};}function saveUpdates(_0x22399d,_0x13fcaf){return function(_0x1a1ee9){if(_0x1a1ee9){return _0x1a1ee9[_0x7f2c('0x25')](_0x22399d)['then'](function(_0x3e711c){return _0x3e711c;});}return null;};}function removeEntity(_0x8a9710,_0x4856b3){return function(_0x38f472){if(_0x38f472){return _0x38f472[_0x7f2c('0x26')]()[_0x7f2c('0x27')](function(){var _0x5a8f64=_0x38f472[_0x7f2c('0x28')]({'plain':!![]});var _0x2386bf=_0x7f2c('0x29');return db['UserProfileResource'][_0x7f2c('0x26')]({'where':{'type':_0x2386bf,'resourceId':_0x5a8f64['id']}})[_0x7f2c('0x27')](function(){return _0x38f472;});})[_0x7f2c('0x27')](function(){_0x8a9710['status'](0xcc)[_0x7f2c('0x1a')]();});}};}function handleEntityNotFound(_0x4f5059,_0x26c149){return function(_0x544fdf){if(!_0x544fdf){_0x4f5059[_0x7f2c('0x2a')](0x194);}return _0x544fdf;};}function handleError(_0xb37dc6,_0x209cf9){_0x209cf9=_0x209cf9||0x1f4;return function(_0x50ad96){logger[_0x7f2c('0x2b')](_0x50ad96[_0x7f2c('0x2c')]);if(_0x50ad96['name']){delete _0x50ad96[_0x7f2c('0x2d')];}_0xb37dc6[_0x7f2c('0x19')](_0x209cf9)[_0x7f2c('0x2e')](_0x50ad96);};}exports[_0x7f2c('0x2f')]=function(_0x2bd69a,_0x198434){var _0x8fb1e={},_0x241a68={},_0x4b3175={'count':0x0,'rows':[]};var _0x3119e3=_[_0x7f2c('0x30')](db[_0x7f2c('0x31')][_0x7f2c('0x32')],function(_0x4de0fd){return{'name':_0x4de0fd[_0x7f2c('0x33')],'type':_0x4de0fd['type'][_0x7f2c('0x34')]};});_0x241a68[_0x7f2c('0x35')]=_[_0x7f2c('0x30')](_0x3119e3,_0x7f2c('0x2d'));_0x241a68['query']=_['keys'](_0x2bd69a[_0x7f2c('0x36')]);_0x241a68[_0x7f2c('0x37')]=_[_0x7f2c('0x38')](_0x241a68[_0x7f2c('0x35')],_0x241a68[_0x7f2c('0x36')]);_0x8fb1e[_0x7f2c('0x39')]=_[_0x7f2c('0x38')](_0x241a68['model'],qs[_0x7f2c('0x3a')](_0x2bd69a[_0x7f2c('0x36')][_0x7f2c('0x3a')]));_0x8fb1e[_0x7f2c('0x39')]=_0x8fb1e[_0x7f2c('0x39')]['length']?_0x8fb1e[_0x7f2c('0x39')]:_0x241a68[_0x7f2c('0x35')];if(!_0x2bd69a[_0x7f2c('0x36')][_0x7f2c('0x3b')](_0x7f2c('0x3c'))){_0x8fb1e[_0x7f2c('0x1d')]=qs[_0x7f2c('0x1d')](_0x2bd69a[_0x7f2c('0x36')][_0x7f2c('0x1d')]);_0x8fb1e[_0x7f2c('0x1b')]=qs['offset'](_0x2bd69a['query'][_0x7f2c('0x1b')]);}_0x8fb1e['order']=qs[_0x7f2c('0x3d')](_0x2bd69a[_0x7f2c('0x36')][_0x7f2c('0x3d')]);_0x8fb1e[_0x7f2c('0x3e')]=qs['filters'](_[_0x7f2c('0x3f')](_0x2bd69a['query'],_0x241a68[_0x7f2c('0x37')]),_0x3119e3);if(_0x2bd69a[_0x7f2c('0x36')][_0x7f2c('0x40')]){_0x8fb1e[_0x7f2c('0x3e')]=_[_0x7f2c('0x41')](_0x8fb1e[_0x7f2c('0x3e')],{'$or':_['map'](_0x3119e3,function(_0x3861e8){if(_0x3861e8['type']!=='VIRTUAL'){var _0x292e45={};_0x292e45[_0x3861e8[_0x7f2c('0x2d')]]={'$like':'%'+_0x2bd69a['query'][_0x7f2c('0x40')]+'%'};return _0x292e45;}})});}_0x8fb1e=_['merge']({},_0x8fb1e,_0x2bd69a[_0x7f2c('0x42')]);var _0x180f39={'where':_0x8fb1e['where']};return db[_0x7f2c('0x31')][_0x7f2c('0x1e')](_0x180f39)[_0x7f2c('0x27')](function(_0x31e467){_0x4b3175['count']=_0x31e467;if(_0x2bd69a['query']['includeAll']){_0x8fb1e[_0x7f2c('0x43')]=[{'all':!![]}];}return db[_0x7f2c('0x31')][_0x7f2c('0x44')](_0x8fb1e);})[_0x7f2c('0x27')](function(_0x456a9e){_0x4b3175['rows']=_0x456a9e;return _0x4b3175;})['then'](respondWithFilteredResult(_0x198434,_0x8fb1e))[_0x7f2c('0x45')](handleError(_0x198434,null));};exports[_0x7f2c('0x46')]=function(_0x5b9ef4,_0x57905e){var _0x9b4209={'raw':![],'where':{'id':_0x5b9ef4[_0x7f2c('0x47')]['id']}},_0x1596e4={};_0x1596e4[_0x7f2c('0x35')]=_[_0x7f2c('0x48')](db[_0x7f2c('0x31')][_0x7f2c('0x32')]);_0x1596e4[_0x7f2c('0x36')]=_[_0x7f2c('0x48')](_0x5b9ef4[_0x7f2c('0x36')]);_0x1596e4['filters']=_['intersection'](_0x1596e4[_0x7f2c('0x35')],_0x1596e4['query']);_0x9b4209[_0x7f2c('0x39')]=_['intersection'](_0x1596e4[_0x7f2c('0x35')],qs[_0x7f2c('0x3a')](_0x5b9ef4[_0x7f2c('0x36')]['fields']));_0x9b4209[_0x7f2c('0x39')]=_0x9b4209[_0x7f2c('0x39')][_0x7f2c('0x49')]?_0x9b4209['attributes']:_0x1596e4['model'];if(_0x5b9ef4[_0x7f2c('0x36')][_0x7f2c('0x4a')]){_0x9b4209[_0x7f2c('0x43')]=[{'all':!![]}];}_0x9b4209=_[_0x7f2c('0x41')]({},_0x9b4209,_0x5b9ef4['options']);return db[_0x7f2c('0x31')][_0x7f2c('0x4b')](_0x9b4209)[_0x7f2c('0x27')](handleEntityNotFound(_0x57905e,null))[_0x7f2c('0x27')](respondWithResult(_0x57905e,null))[_0x7f2c('0x45')](handleError(_0x57905e,null));};exports['create']=function(_0x276004,_0x3ff774){return db[_0x7f2c('0x31')][_0x7f2c('0x4c')](_0x276004[_0x7f2c('0x4d')],{})[_0x7f2c('0x27')](function(_0x3ae7b1){var _0x4614a0=_0x276004['user'][_0x7f2c('0x28')]({'plain':!![]});if(!_0x4614a0)throw new Error(_0x7f2c('0x4e'));if(_0x4614a0[_0x7f2c('0x4f')]===_0x7f2c('0x50')){var _0x4436e2=_0x3ae7b1[_0x7f2c('0x28')]({'plain':!![]});var _0x4a2153='ChanSpies';return db[_0x7f2c('0x51')][_0x7f2c('0x4b')]({'where':{'name':_0x4a2153,'userProfileId':_0x4614a0[_0x7f2c('0x52')]},'raw':!![]})[_0x7f2c('0x27')](function(_0x39378b){if(_0x39378b&&_0x39378b['autoAssociation']===0x0){return db[_0x7f2c('0x53')]['create']({'name':_0x4436e2[_0x7f2c('0x2d')],'resourceId':_0x4436e2['id'],'type':_0x39378b[_0x7f2c('0x2d')],'sectionId':_0x39378b['id']},{})[_0x7f2c('0x27')](function(){return _0x3ae7b1;});}else{return _0x3ae7b1;}})[_0x7f2c('0x45')](function(_0x31a814){logger['error'](_0x7f2c('0x54'),_0x31a814);throw _0x31a814;});}return _0x3ae7b1;})[_0x7f2c('0x27')](respondWithResult(_0x3ff774,0xc9))[_0x7f2c('0x45')](handleError(_0x3ff774,null));};exports['update']=function(_0x1ee043,_0x4d163a){if(_0x1ee043[_0x7f2c('0x4d')]['id']){delete _0x1ee043['body']['id'];}return db[_0x7f2c('0x31')]['find']({'where':{'id':_0x1ee043[_0x7f2c('0x47')]['id']}})[_0x7f2c('0x27')](handleEntityNotFound(_0x4d163a,null))[_0x7f2c('0x27')](saveUpdates(_0x1ee043[_0x7f2c('0x4d')],null))[_0x7f2c('0x27')](respondWithResult(_0x4d163a,null))['catch'](handleError(_0x4d163a,null));};exports[_0x7f2c('0x26')]=function(_0x41a733,_0x43633b){return db[_0x7f2c('0x31')]['find']({'where':{'id':_0x41a733[_0x7f2c('0x47')]['id']}})['then'](handleEntityNotFound(_0x43633b,null))[_0x7f2c('0x27')](removeEntity(_0x43633b,null))[_0x7f2c('0x45')](handleError(_0x43633b,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 9ff05b8..6ab9d66 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 _0x9f90=['Authenticate','password','ChanSpy','SIP/%s,%s','name','options','record','length','concat','internal','findAll','agent','then','catch','exports','models','define','voice_chanspy','VoiceExtension','bulkCreate','destroy','util','bluebird','context','from-sip','format','prefix','system','merge','Set','chanspy','push','${UNIQUEID}.%s,a','recordingFormat','auth'];(function(_0x5e646a,_0x22a846){var _0x308280=function(_0x7f53a2){while(--_0x7f53a2){_0x5e646a['push'](_0x5e646a['shift']());}};_0x308280(++_0x22a846);}(_0x9f90,0x150));var _0x09f9=function(_0x1bcc3c,_0x59f478){_0x1bcc3c=_0x1bcc3c-0x0;var _0x4cdb22=_0x9f90[_0x1bcc3c];return _0x4cdb22;};'use strict';var _=require('lodash');var util=require(_0x09f9('0x0'));var BPromise=require(_0x09f9('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x29dbe1,_0x578c0a,_0x49f67a){var _0x4dbf3b=0x1;var _0x21eb43=[];var _0x4e5a5c={'context':_0x578c0a[_0x09f9('0x2')]||_0x09f9('0x3'),'exten':util[_0x09f9('0x4')]('%s%s',_0x29dbe1[_0x09f9('0x5')],_0x49f67a),'type':_0x09f9('0x6'),'isApp':![],'ChanSpyId':_0x29dbe1['id'],'UserId':_0x578c0a['id']};_0x21eb43['push'](_[_0x09f9('0x7')]({'app':_0x09f9('0x8'),'appdata':util[_0x09f9('0x4')]('CDR(type)=%s',_0x09f9('0x9')),'priority':_0x4dbf3b++},_0x4e5a5c));if(_0x29dbe1['record']){_0x21eb43[_0x09f9('0xa')](_[_0x09f9('0x7')]({'app':'MixMonitor','appdata':util[_0x09f9('0x4')](_0x09f9('0xb'),_0x29dbe1[_0x09f9('0xc')]),'priority':_0x4dbf3b++},_0x4e5a5c));}if(_0x29dbe1[_0x09f9('0xd')]){_0x21eb43['push'](_[_0x09f9('0x7')]({'app':_0x09f9('0xe'),'appdata':_0x29dbe1[_0x09f9('0xf')],'priority':_0x4dbf3b++},_0x4e5a5c));}_0x21eb43[_0x09f9('0xa')](_[_0x09f9('0x7')]({'app':_0x09f9('0x10'),'appdata':util[_0x09f9('0x4')](_0x09f9('0x11'),_0x578c0a[_0x09f9('0x12')],_0x29dbe1[_0x09f9('0x13')]?_0x29dbe1[_0x09f9('0x13')]['join'](''):''),'priority':_0x4dbf3b++},_0x4e5a5c));if(_0x29dbe1[_0x09f9('0x14')]){_0x21eb43['push'](_['merge']({'app':'StopMixMonitor','priority':_0x4dbf3b++},_0x4e5a5c));}return _0x21eb43;};var getChanSpyApplications=function(_0x1ef7bf,_0x454773){var _0x21ea98=[];for(var _0x2233bd=0x0,_0x1f199c=0x1;_0x2233bd<_0x454773[_0x09f9('0x15')];_0x2233bd++,_0x1f199c=0x1){_0x21ea98=_0x21ea98[_0x09f9('0x16')](getUserApplications(_0x1ef7bf,_0x454773[_0x2233bd],_0x454773[_0x2233bd][_0x09f9('0x17')]));if(_0x454773[_0x2233bd][_0x09f9('0x17')]!=_0x454773[_0x2233bd]['name']){_0x21ea98=_0x21ea98['concat'](getUserApplications(_0x1ef7bf,_0x454773[_0x2233bd],_0x454773[_0x2233bd][_0x09f9('0x12')]));}}return _0x21ea98;};var getChanSpyPromise=function(_0x1f96ff,_0x34f635){return new BPromise(function(_0x22e07b,_0x768c16){return _0x1f96ff['User'][_0x09f9('0x18')]({'attributes':['id','name',_0x09f9('0x17')],'where':{'role':_0x09f9('0x19'),'chanspy':!![]},'raw':!![]})[_0x09f9('0x1a')](function(_0x5227ab){if(_0x5227ab){return _0x22e07b(getChanSpyApplications(_0x34f635,_0x5227ab));}return _0x22e07b([]);})[_0x09f9('0x1b')](function(_0x49b02b){_0x768c16(_0x49b02b);});});};module[_0x09f9('0x1c')]=function(_0x37f703,_0x28a1da){var _0x506c84=_0x37f703[_0x09f9('0x1d')];return _0x37f703[_0x09f9('0x1e')]('VoiceChanSpy',attributes,{'tableName':_0x09f9('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5ad935,_0x35e620,_0x3faf15){return getChanSpyPromise(_0x506c84,_0x5ad935)[_0x09f9('0x1a')](function(_0x1b06c7){if(_0x1b06c7&&_0x1b06c7['length']){return _0x506c84[_0x09f9('0x20')][_0x09f9('0x21')](_0x1b06c7);}})[_0x09f9('0x1a')](function(){_0x3faf15();})[_0x09f9('0x1b')](function(_0x4278dc){_0x3faf15(_0x4278dc);});},'afterUpdate':function(_0x5bdc8e,_0x643644,_0x22c58a){return _0x506c84['VoiceExtension'][_0x09f9('0x22')]({'where':{'ChanSpyId':_0x5bdc8e['id']}})[_0x09f9('0x1a')](function(){return getChanSpyPromise(_0x506c84,_0x5bdc8e);})[_0x09f9('0x1a')](function(_0x28f0e5){if(_0x28f0e5&&_0x28f0e5['length']){return _0x506c84[_0x09f9('0x20')][_0x09f9('0x21')](_0x28f0e5);}})['then'](function(){_0x22c58a();})['catch'](function(_0x3b98a2){_0x22c58a(_0x3b98a2);});},'afterDestroy':function(_0x2b3840,_0x57e70a,_0x3bf6cb){return _0x506c84[_0x09f9('0x20')][_0x09f9('0x22')]({'where':{'ChanSpyId':_0x2b3840['id']}})[_0x09f9('0x1a')](function(){_0x3bf6cb();})[_0x09f9('0x1b')](function(_0x2d68b7){_0x3bf6cb(_0x2d68b7);});}}});}; \ No newline at end of file +var _0x5a08=['User','findAll','agent','then','exports','models','voice_chanspy','VoiceExtension','catch','bulkCreate','destroy','util','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','SIP/%s,%s','name','options','StopMixMonitor','length','concat','internal'];(function(_0x25680f,_0x49646a){var _0x135948=function(_0x4b6ebe){while(--_0x4b6ebe){_0x25680f['push'](_0x25680f['shift']());}};_0x135948(++_0x49646a);}(_0x5a08,0x93));var _0x85a0=function(_0x409714,_0x4a9f2d){_0x409714=_0x409714-0x0;var _0xc6d164=_0x5a08[_0x409714];return _0xc6d164;};'use strict';var _=require('lodash');var util=require(_0x85a0('0x0'));var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x139bfa,_0x386aee,_0x3f849a){var _0x2bc11e=0x1;var _0x20178d=[];var _0x9284b={'context':_0x386aee['context']||'from-sip','exten':util[_0x85a0('0x1')](_0x85a0('0x2'),_0x139bfa[_0x85a0('0x3')],_0x3f849a),'type':_0x85a0('0x4'),'isApp':![],'ChanSpyId':_0x139bfa['id'],'UserId':_0x386aee['id']};_0x20178d[_0x85a0('0x5')](_[_0x85a0('0x6')]({'app':_0x85a0('0x7'),'appdata':util[_0x85a0('0x1')](_0x85a0('0x8'),_0x85a0('0x9')),'priority':_0x2bc11e++},_0x9284b));if(_0x139bfa[_0x85a0('0xa')]){_0x20178d[_0x85a0('0x5')](_['merge']({'app':_0x85a0('0xb'),'appdata':util['format'](_0x85a0('0xc'),_0x139bfa[_0x85a0('0xd')]),'priority':_0x2bc11e++},_0x9284b));}if(_0x139bfa['auth']){_0x20178d[_0x85a0('0x5')](_[_0x85a0('0x6')]({'app':_0x85a0('0xe'),'appdata':_0x139bfa[_0x85a0('0xf')],'priority':_0x2bc11e++},_0x9284b));}_0x20178d[_0x85a0('0x5')](_[_0x85a0('0x6')]({'app':'ChanSpy','appdata':util[_0x85a0('0x1')](_0x85a0('0x10'),_0x386aee[_0x85a0('0x11')],_0x139bfa[_0x85a0('0x12')]?_0x139bfa[_0x85a0('0x12')]['join'](''):''),'priority':_0x2bc11e++},_0x9284b));if(_0x139bfa[_0x85a0('0xa')]){_0x20178d[_0x85a0('0x5')](_[_0x85a0('0x6')]({'app':_0x85a0('0x13'),'priority':_0x2bc11e++},_0x9284b));}return _0x20178d;};var getChanSpyApplications=function(_0x10b64d,_0x38b300){var _0x9803ec=[];for(var _0x53107c=0x0,_0x4c4056=0x1;_0x53107c<_0x38b300[_0x85a0('0x14')];_0x53107c++,_0x4c4056=0x1){_0x9803ec=_0x9803ec[_0x85a0('0x15')](getUserApplications(_0x10b64d,_0x38b300[_0x53107c],_0x38b300[_0x53107c]['internal']));if(_0x38b300[_0x53107c][_0x85a0('0x16')]!=_0x38b300[_0x53107c]['name']){_0x9803ec=_0x9803ec[_0x85a0('0x15')](getUserApplications(_0x10b64d,_0x38b300[_0x53107c],_0x38b300[_0x53107c]['name']));}}return _0x9803ec;};var getChanSpyPromise=function(_0x53ff08,_0x5e133d){return new BPromise(function(_0x15a859,_0x10e23){return _0x53ff08[_0x85a0('0x17')][_0x85a0('0x18')]({'attributes':['id',_0x85a0('0x11'),_0x85a0('0x16')],'where':{'role':_0x85a0('0x19'),'chanspy':!![]},'raw':!![]})[_0x85a0('0x1a')](function(_0x2a5870){if(_0x2a5870){return _0x15a859(getChanSpyApplications(_0x5e133d,_0x2a5870));}return _0x15a859([]);})['catch'](function(_0x2195e5){_0x10e23(_0x2195e5);});});};module[_0x85a0('0x1b')]=function(_0x51fde4,_0x54d378){var _0x385594=_0x51fde4[_0x85a0('0x1c')];return _0x51fde4['define']('VoiceChanSpy',attributes,{'tableName':_0x85a0('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xa938d4,_0x512689,_0xdf7f29){return getChanSpyPromise(_0x385594,_0xa938d4)[_0x85a0('0x1a')](function(_0x32af9e){if(_0x32af9e&&_0x32af9e[_0x85a0('0x14')]){return _0x385594[_0x85a0('0x1e')]['bulkCreate'](_0x32af9e);}})[_0x85a0('0x1a')](function(){_0xdf7f29();})[_0x85a0('0x1f')](function(_0x34962d){_0xdf7f29(_0x34962d);});},'afterUpdate':function(_0x5c3a44,_0x481207,_0x3f84c9){return _0x385594[_0x85a0('0x1e')]['destroy']({'where':{'ChanSpyId':_0x5c3a44['id']}})['then'](function(){return getChanSpyPromise(_0x385594,_0x5c3a44);})[_0x85a0('0x1a')](function(_0x3702fc){if(_0x3702fc&&_0x3702fc[_0x85a0('0x14')]){return _0x385594[_0x85a0('0x1e')][_0x85a0('0x20')](_0x3702fc);}})[_0x85a0('0x1a')](function(){_0x3f84c9();})[_0x85a0('0x1f')](function(_0x15c6a4){_0x3f84c9(_0x15c6a4);});},'afterDestroy':function(_0x1add8d,_0x3a7899,_0x58e123){return _0x385594[_0x85a0('0x1e')][_0x85a0('0x21')]({'where':{'ChanSpyId':_0x1add8d['id']}})[_0x85a0('0x1a')](function(){_0x58e123();})[_0x85a0('0x1f')](function(_0x5bf3c8){_0x58e123(_0x5bf3c8);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 56d6328..e4691e8 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 _0x6f7a=['http','request','then','info','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x252699,_0x134b4e){var _0x56d0c6=function(_0x5551a8){while(--_0x5551a8){_0x252699['push'](_0x252699['shift']());}};_0x56d0c6(++_0x134b4e);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x114e55,_0x5c9ac8){_0x114e55=_0x114e55-0x0;var _0x460a7e=_0x6f7a[_0x114e55];return _0x460a7e;};'use strict';var _=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var moment=require(_0xa6f7('0x2'));var BPromise=require(_0xa6f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa6f7('0x4'));var db=require(_0xa6f7('0x5'))['db'];var utils=require(_0xa6f7('0x6'));var logger=require(_0xa6f7('0x7'))(_0xa6f7('0x8'));var config=require(_0xa6f7('0x9'));var jayson=require(_0xa6f7('0xa'));var client=jayson[_0xa6f7('0xb')][_0xa6f7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x335aaa,_0x1a06d1,_0x481a8c){return new BPromise(function(_0x4b4f9e,_0x30f2a7){return client[_0xa6f7('0xd')](_0x335aaa,_0x481a8c)[_0xa6f7('0xe')](function(_0x362404){logger[_0xa6f7('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x1a06d1,'request\x20sent');logger[_0xa6f7('0x10')](_0xa6f7('0x11'),_0x1a06d1,'request\x20sent',JSON[_0xa6f7('0x12')](_0x362404));if(_0x362404['error']){if(_0x362404[_0xa6f7('0x13')][_0xa6f7('0x14')]===0x1f4){logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x362404['error'][_0xa6f7('0x16')]);return _0x30f2a7(_0x362404['error'][_0xa6f7('0x16')]);}logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x362404['error'][_0xa6f7('0x16')]);return _0x4b4f9e(_0x362404['error'][_0xa6f7('0x16')]);}else{logger['info'](_0xa6f7('0x15'),_0x1a06d1,_0xa6f7('0x17'));_0x4b4f9e(_0x362404[_0xa6f7('0x18')]['message']);}})[_0xa6f7('0x19')](function(_0x22635e){logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x22635e);_0x30f2a7(_0x22635e);});});} \ No newline at end of file +var _0x70e0=['code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x5b526e,_0x4ef7a2){var _0x3bad42=function(_0x297af9){while(--_0x297af9){_0x5b526e['push'](_0x5b526e['shift']());}};_0x3bad42(++_0x4ef7a2);}(_0x70e0,0x17b));var _0x070e=function(_0xdc2622,_0x309623){_0xdc2622=_0xdc2622-0x0;var _0x54f4cf=_0x70e0[_0xdc2622];return _0x54f4cf;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 7722bfc..f0316ad 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 _0xb415=['exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','index','/:id','post','isAuthenticated','delete','destroy'];(function(_0x2f843f,_0x1dfad5){var _0x588481=function(_0x18a633){while(--_0x18a633){_0x2f843f['push'](_0x2f843f['shift']());}};_0x588481(++_0x1dfad5);}(_0xb415,0x9a));var _0x5b41=function(_0x50aaf2,_0x467015){_0x50aaf2=_0x50aaf2-0x0;var _0x5e1fdb=_0xb415[_0x50aaf2];return _0x5e1fdb;};'use strict';var multer=require(_0x5b41('0x0'));var util=require(_0x5b41('0x1'));var path=require(_0x5b41('0x2'));var timeout=require('connect-timeout');var express=require(_0x5b41('0x3'));var router=express['Router']();var fs_extra=require(_0x5b41('0x4'));var auth=require(_0x5b41('0x5'));var interaction=require(_0x5b41('0x6'));var config=require(_0x5b41('0x7'));var controller=require(_0x5b41('0x8'));router[_0x5b41('0x9')]('/',auth['isAuthenticated'](),controller[_0x5b41('0xa')]);router['get'](_0x5b41('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x5b41('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x5b41('0xb'),auth[_0x5b41('0xd')](),controller['update']);router[_0x5b41('0xe')](_0x5b41('0xb'),auth[_0x5b41('0xd')](),controller[_0x5b41('0xf')]);module[_0x5b41('0x10')]=router; \ No newline at end of file +var _0x73e2=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','path'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x73e2,0x1c0));var _0x273e=function(_0xad33f0,_0x428ba6){_0xad33f0=_0xad33f0-0x0;var _0x1ad40a=_0x73e2[_0xad33f0];return _0x1ad40a;};'use strict';var multer=require(_0x273e('0x0'));var util=require('util');var path=require(_0x273e('0x1'));var timeout=require(_0x273e('0x2'));var express=require('express');var router=express[_0x273e('0x3')]();var fs_extra=require(_0x273e('0x4'));var auth=require(_0x273e('0x5'));var interaction=require(_0x273e('0x6'));var config=require('../../config/environment');var controller=require('./voiceContext.controller');router[_0x273e('0x7')]('/',auth[_0x273e('0x8')](),controller[_0x273e('0x9')]);router[_0x273e('0x7')](_0x273e('0xa'),auth['isAuthenticated'](),controller[_0x273e('0xb')]);router[_0x273e('0xc')]('/',auth[_0x273e('0x8')](),controller['create']);router[_0x273e('0xd')](_0x273e('0xa'),auth['isAuthenticated'](),controller[_0x273e('0xe')]);router[_0x273e('0xf')](_0x273e('0xa'),auth[_0x273e('0x8')](),controller[_0x273e('0x10')]);module[_0x273e('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index da787cb..d0a8cfe 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 _0xb0d9=['BOOLEAN','exports','STRING'];(function(_0xb21dd9,_0x55e6ec){var _0xa95acb=function(_0x1048e5){while(--_0x1048e5){_0xb21dd9['push'](_0xb21dd9['shift']());}};_0xa95acb(++_0x55e6ec);}(_0xb0d9,0xf4));var _0x9b0d=function(_0x4d5b97,_0x118d9d){_0x4d5b97=_0x4d5b97-0x0;var _0x4f9cea=_0xb0d9[_0x4d5b97];return _0x4f9cea;};'use strict';var Sequelize=require('sequelize');module[_0x9b0d('0x0')]={'name':{'type':Sequelize[_0x9b0d('0x1')],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x9b0d('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6d0f=['exports','STRING','name','BOOLEAN','sequelize'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x6d0f,0x1df));var _0xf6d0=function(_0x29e0a5,_0x3befba){_0x29e0a5=_0x29e0a5-0x0;var _0x3d020a=_0x6d0f[_0x29e0a5];return _0x3d020a;};'use strict';var Sequelize=require(_0xf6d0('0x0'));module[_0xf6d0('0x1')]={'name':{'type':Sequelize[_0xf6d0('0x2')],'unique':_0xf6d0('0x3')},'description':{'type':Sequelize[_0xf6d0('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xf6d0('0x4')],'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 d400e2c..58e1957 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 _0x55e0=['limit','count','offset','status','set','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','end','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceContext','include','findAll','params','includeAll','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','create','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','json','undefined'];(function(_0x41bfa8,_0x2222f0){var _0x5a689e=function(_0x9c9b27){while(--_0x9c9b27){_0x41bfa8['push'](_0x41bfa8['shift']());}};_0x5a689e(++_0x2222f0);}(_0x55e0,0xa2));var _0x055e=function(_0x346045,_0x3ce566){_0x346045=_0x346045-0x0;var _0x3d1573=_0x55e0[_0x346045];return _0x3d1573;};'use strict';var emlformat=require(_0x055e('0x0'));var rimraf=require(_0x055e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x055e('0x2'));var rp=require(_0x055e('0x3'));var moment=require(_0x055e('0x4'));var BPromise=require(_0x055e('0x5'));var Mustache=require(_0x055e('0x6'));var util=require(_0x055e('0x7'));var path=require(_0x055e('0x8'));var sox=require('sox');var csv=require(_0x055e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x055e('0xa'));var _=require('lodash');var squel=require(_0x055e('0xb'));var crypto=require('crypto');var jsforce=require(_0x055e('0xc'));var deskjs=require(_0x055e('0xd'));var toCsv=require(_0x055e('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x055e('0xe'));var authService=require(_0x055e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x055e('0x10'));var hardwareService=require(_0x055e('0x11'));var logger=require(_0x055e('0x12'))('api');var utils=require(_0x055e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x055e('0x14'));var db=require(_0x055e('0x15'))['db'];var jayson=require(_0x055e('0x16'));var client=jayson[_0x055e('0x17')][_0x055e('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x263d3d,_0x44e2e7,_0x242c25,_0x52647){return new BPromise(function(_0x43abe5,_0x2c3329){var _0x6dc294=_0x52647||client;return _0x6dc294[_0x055e('0x19')](_0x263d3d,_0x242c25)[_0x055e('0x1a')](function(_0xd21a16){logger[_0x055e('0x1b')](_0x055e('0x1c'),_0x44e2e7,_0x055e('0x1d'));logger[_0x055e('0x1e')](_0x055e('0x1f'),_0x44e2e7,'request\x20sent',JSON[_0x055e('0x20')](_0xd21a16));if(_0xd21a16[_0x055e('0x21')]){if(_0xd21a16[_0x055e('0x21')]['code']===0x1f4){logger[_0x055e('0x21')](_0x055e('0x1c'),_0x44e2e7,_0xd21a16[_0x055e('0x21')][_0x055e('0x22')]);return _0x2c3329(_0xd21a16[_0x055e('0x21')][_0x055e('0x22')]);}logger[_0x055e('0x21')](_0x055e('0x1c'),_0x44e2e7,_0xd21a16[_0x055e('0x21')][_0x055e('0x22')]);return _0x43abe5(_0xd21a16[_0x055e('0x21')][_0x055e('0x22')]);}else{logger[_0x055e('0x1b')]('VoiceContext,\x20%s,\x20%s',_0x44e2e7,_0x055e('0x1d'));_0x43abe5(_0xd21a16[_0x055e('0x23')][_0x055e('0x22')]);}})[_0x055e('0x24')](function(_0x3adba7){logger['error'](_0x055e('0x1c'),_0x44e2e7,_0x3adba7);_0x2c3329(_0x3adba7);});});}function respondWithStatusCode(_0x1074a7,_0x4ddbef){_0x4ddbef=_0x4ddbef||0xcc;return function(_0x531c73){if(_0x531c73){return _0x1074a7[_0x055e('0x25')](_0x4ddbef);}return _0x1074a7['status'](_0x4ddbef)['end']();};}function respondWithResult(_0x5e8d7b,_0x3b88bd){_0x3b88bd=_0x3b88bd||0xc8;return function(_0xab53bc){if(_0xab53bc){return _0x5e8d7b['status'](_0x3b88bd)[_0x055e('0x26')](_0xab53bc);}};}function respondWithFilteredResult(_0x288f52,_0x72f899){return function(_0x2def16){if(_0x2def16){var _0x556bf8=typeof _0x72f899['offset']===_0x055e('0x27')&&typeof _0x72f899[_0x055e('0x28')]==='undefined';var _0x49983e=_0x2def16[_0x055e('0x29')];var _0x290093=_0x556bf8?0x0:_0x72f899[_0x055e('0x2a')];var _0x2fa38e=_0x556bf8?_0x2def16[_0x055e('0x29')]:_0x72f899[_0x055e('0x2a')]+_0x72f899[_0x055e('0x28')];var _0x1fcd07;if(_0x2fa38e>=_0x49983e){_0x2fa38e=_0x49983e;_0x1fcd07=0xc8;}else{_0x1fcd07=0xce;}_0x288f52[_0x055e('0x2b')](_0x1fcd07);return _0x288f52[_0x055e('0x2c')]('Content-Range',_0x290093+'-'+_0x2fa38e+'/'+_0x49983e)['json'](_0x2def16);}return null;};}function patchUpdates(_0x8e7209){return function(_0x17f5e9){try{jsonpatch[_0x055e('0x2d')](_0x17f5e9,_0x8e7209,!![]);}catch(_0x16131b){return BPromise[_0x055e('0x2e')](_0x16131b);}return _0x17f5e9[_0x055e('0x2f')]();};}function saveUpdates(_0x1c9fbf,_0x3e96b5){return function(_0x458ab3){if(_0x458ab3){return _0x458ab3[_0x055e('0x30')](_0x1c9fbf)[_0x055e('0x1a')](function(_0x143fc5){return _0x143fc5;});}return null;};}function removeEntity(_0x2f64b3,_0x254bb3){return function(_0x45caf0){if(_0x45caf0){return _0x45caf0[_0x055e('0x31')]()[_0x055e('0x1a')](function(){var _0x2c57ed=_0x45caf0[_0x055e('0x32')]({'plain':!![]});var _0x3eee5b=_0x055e('0x33');return db[_0x055e('0x34')][_0x055e('0x31')]({'where':{'type':_0x3eee5b,'resourceId':_0x2c57ed['id']}})[_0x055e('0x1a')](function(){return _0x45caf0;});})['then'](function(){_0x2f64b3[_0x055e('0x2b')](0xcc)[_0x055e('0x35')]();});}};}function handleEntityNotFound(_0x1d6766,_0x3b9842){return function(_0x5e0067){if(!_0x5e0067){_0x1d6766['sendStatus'](0x194);}return _0x5e0067;};}function handleError(_0x577f7c,_0x47fe89){_0x47fe89=_0x47fe89||0x1f4;return function(_0x515759){logger[_0x055e('0x21')](_0x515759['stack']);if(_0x515759['name']){delete _0x515759[_0x055e('0x36')];}_0x577f7c['status'](_0x47fe89)[_0x055e('0x37')](_0x515759);};}exports[_0x055e('0x38')]=function(_0x453584,_0x4fa25b){var _0x52bae1={},_0x28f320={},_0x5cad0b={'count':0x0,'rows':[]};var _0x42337c=_[_0x055e('0x39')](db['VoiceContext'][_0x055e('0x3a')],function(_0x469353){return{'name':_0x469353[_0x055e('0x3b')],'type':_0x469353[_0x055e('0x3c')][_0x055e('0x3d')]};});_0x28f320['model']=_[_0x055e('0x39')](_0x42337c,_0x055e('0x36'));_0x28f320[_0x055e('0x3e')]=_['keys'](_0x453584['query']);_0x28f320[_0x055e('0x3f')]=_[_0x055e('0x40')](_0x28f320[_0x055e('0x41')],_0x28f320[_0x055e('0x3e')]);_0x52bae1[_0x055e('0x42')]=_[_0x055e('0x40')](_0x28f320[_0x055e('0x41')],qs['fields'](_0x453584['query'][_0x055e('0x43')]));_0x52bae1[_0x055e('0x42')]=_0x52bae1[_0x055e('0x42')][_0x055e('0x44')]?_0x52bae1[_0x055e('0x42')]:_0x28f320[_0x055e('0x41')];if(!_0x453584[_0x055e('0x3e')][_0x055e('0x45')](_0x055e('0x46'))){_0x52bae1['limit']=qs[_0x055e('0x28')](_0x453584[_0x055e('0x3e')][_0x055e('0x28')]);_0x52bae1[_0x055e('0x2a')]=qs[_0x055e('0x2a')](_0x453584['query'][_0x055e('0x2a')]);}_0x52bae1[_0x055e('0x47')]=qs['sort'](_0x453584[_0x055e('0x3e')][_0x055e('0x48')]);_0x52bae1[_0x055e('0x49')]=qs[_0x055e('0x3f')](_[_0x055e('0x4a')](_0x453584['query'],_0x28f320[_0x055e('0x3f')]),_0x42337c);if(_0x453584[_0x055e('0x3e')][_0x055e('0x4b')]){_0x52bae1[_0x055e('0x49')]=_[_0x055e('0x4c')](_0x52bae1[_0x055e('0x49')],{'$or':_[_0x055e('0x39')](_0x42337c,function(_0x36e95b){if(_0x36e95b[_0x055e('0x3c')]!==_0x055e('0x4d')){var _0x4f04af={};_0x4f04af[_0x36e95b[_0x055e('0x36')]]={'$like':'%'+_0x453584[_0x055e('0x3e')][_0x055e('0x4b')]+'%'};return _0x4f04af;}})});}_0x52bae1=_[_0x055e('0x4c')]({},_0x52bae1,_0x453584[_0x055e('0x4e')]);var _0x4584af={'where':_0x52bae1['where']};return db[_0x055e('0x4f')][_0x055e('0x29')](_0x4584af)[_0x055e('0x1a')](function(_0x21c6f6){_0x5cad0b['count']=_0x21c6f6;if(_0x453584[_0x055e('0x3e')]['includeAll']){_0x52bae1[_0x055e('0x50')]=[{'all':!![]}];}return db['VoiceContext'][_0x055e('0x51')](_0x52bae1);})['then'](function(_0x2d2c78){_0x5cad0b['rows']=_0x2d2c78;return _0x5cad0b;})[_0x055e('0x1a')](respondWithFilteredResult(_0x4fa25b,_0x52bae1))['catch'](handleError(_0x4fa25b,null));};exports['show']=function(_0x16ce5a,_0x13f31d){var _0x10c06e={'raw':![],'where':{'id':_0x16ce5a[_0x055e('0x52')]['id']}},_0x5cbc5e={};_0x5cbc5e[_0x055e('0x41')]=_['keys'](db[_0x055e('0x4f')][_0x055e('0x3a')]);_0x5cbc5e[_0x055e('0x3e')]=_['keys'](_0x16ce5a['query']);_0x5cbc5e[_0x055e('0x3f')]=_[_0x055e('0x40')](_0x5cbc5e['model'],_0x5cbc5e['query']);_0x10c06e[_0x055e('0x42')]=_[_0x055e('0x40')](_0x5cbc5e['model'],qs[_0x055e('0x43')](_0x16ce5a[_0x055e('0x3e')][_0x055e('0x43')]));_0x10c06e[_0x055e('0x42')]=_0x10c06e['attributes']['length']?_0x10c06e['attributes']:_0x5cbc5e[_0x055e('0x41')];if(_0x16ce5a['query'][_0x055e('0x53')]){_0x10c06e['include']=[{'all':!![]}];}_0x10c06e=_['merge']({},_0x10c06e,_0x16ce5a[_0x055e('0x4e')]);return db[_0x055e('0x4f')]['find'](_0x10c06e)[_0x055e('0x1a')](handleEntityNotFound(_0x13f31d,null))[_0x055e('0x1a')](respondWithResult(_0x13f31d,null))[_0x055e('0x24')](handleError(_0x13f31d,null));};exports['create']=function(_0x286650,_0x4b47d2,_0x312d56){var _0x3e6200;return db[_0x055e('0x4f')]['create'](_0x286650['body'],{'raw':!![]})[_0x055e('0x1a')](function(_0x15bdac){_0x3e6200=_0x15bdac;return db[_0x055e('0x4f')][_0x055e('0x51')]({'raw':!![]});})[_0x055e('0x1a')](function(_0x1a51a3){var _0x5a8201=fs[_0x055e('0x54')](path[_0x055e('0x55')](config[_0x055e('0x56')],_0x055e('0x57')),_0x055e('0x58'));var _0x44e9b9=ejs[_0x055e('0x59')](_0x5a8201,{'contexts':_0x1a51a3||[]});fs[_0x055e('0x5a')](_0x055e('0x5b'),_0x44e9b9);})[_0x055e('0x1a')](function(){return respondWithRpcPromise(_0x055e('0x5c'),_0x055e('0x5d'),{'module':_0x055e('0x5e')});})['then'](function(){var _0x5f353a=_0x286650['user'][_0x055e('0x32')]({'plain':!![]});if(!_0x5f353a)throw new Error(_0x055e('0x5f'));if(_0x5f353a[_0x055e('0x60')]===_0x055e('0x61')){var _0xc08da7=_0x3e6200[_0x055e('0x32')]({'plain':!![]});return db['UserProfileSection'][_0x055e('0x62')]({'where':{'name':_0x055e('0x33'),'userProfileId':_0x5f353a[_0x055e('0x63')]},'raw':!![]})['then'](function(_0x1b1bf3){if(_0x1b1bf3&&_0x1b1bf3['autoAssociation']===0x0){return db[_0x055e('0x34')][_0x055e('0x5d')]({'name':_0xc08da7['name'],'resourceId':_0xc08da7['id'],'type':_0x1b1bf3[_0x055e('0x36')],'sectionId':_0x1b1bf3['id']},{})[_0x055e('0x1a')](function(){return _0x3e6200;});}else{return _0x3e6200;}})['catch'](function(_0x3de8ad){logger[_0x055e('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3de8ad);throw _0x3de8ad;});}return _0x3e6200;})[_0x055e('0x1a')](respondWithResult(_0x4b47d2,0xc9))[_0x055e('0x24')](handleError(_0x4b47d2,null));};exports['update']=function(_0x1c51d4,_0x26b4f3,_0x254fd6){var _0x14e9ed;return db[_0x055e('0x4f')][_0x055e('0x62')]({'where':{'id':_0x1c51d4[_0x055e('0x52')]['id']}})['then'](handleEntityNotFound(_0x26b4f3,null))[_0x055e('0x1a')](saveUpdates(_0x1c51d4[_0x055e('0x64')],null))['then'](function(_0x24b132){if(_0x24b132){_0x14e9ed=_0x24b132;return db[_0x055e('0x4f')]['findAll']({'raw':!![]});}})['then'](function(_0x402515){var _0x514c66=fs[_0x055e('0x54')](path[_0x055e('0x55')](config[_0x055e('0x56')],_0x055e('0x57')),_0x055e('0x58'));var _0xc93b8e=ejs[_0x055e('0x59')](_0x514c66,{'contexts':_0x402515||[]});fs[_0x055e('0x5a')](_0x055e('0x5b'),_0xc93b8e);})[_0x055e('0x1a')](function(){return respondWithRpcPromise(_0x055e('0x5c'),_0x055e('0x30'),{'module':_0x055e('0x5e')});})[_0x055e('0x1a')](function(){return _0x14e9ed;})[_0x055e('0x1a')](respondWithResult(_0x26b4f3,null))[_0x055e('0x24')](handleError(_0x26b4f3,null));};exports[_0x055e('0x31')]=function(_0x544ec8,_0x387622,_0x12b989){var _0x2cc616;return db[_0x055e('0x4f')][_0x055e('0x62')]({'where':{'id':_0x544ec8[_0x055e('0x52')]['id']}})[_0x055e('0x1a')](handleEntityNotFound(_0x387622,null))['then'](removeEntity(_0x387622,null))[_0x055e('0x1a')](function(){return db[_0x055e('0x4f')][_0x055e('0x51')]({'raw':!![]});})[_0x055e('0x1a')](function(_0x5a3dba){var _0x3ef968=fs['readFileSync'](path[_0x055e('0x55')](config['root'],_0x055e('0x57')),'utf8');var _0x1c9ee8=ejs[_0x055e('0x59')](_0x3ef968,{'contexts':_0x5a3dba});fs['writeFileSync'](_0x055e('0x5b'),_0x1c9ee8);return respondWithRpcPromise(_0x055e('0x5c'),_0x055e('0x31'),{'module':'chan_sip.so'});})[_0x055e('0x24')](handleError(_0x387622,null));}; \ No newline at end of file +var _0x7712=['debug','stringify','error','VoiceContext,\x20%s,\x20%s','message','info','result','catch','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','get','Contexts','UserProfileResource','sendStatus','stack','name','send','index','map','VoiceContext','fieldName','key','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','findAll','rows','show','model','options','find','create','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','writeFileSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','request','then','request\x20sent'];(function(_0x51b88d,_0x249143){var _0x28ab06=function(_0x102bb){while(--_0x102bb){_0x51b88d['push'](_0x51b88d['shift']());}};_0x28ab06(++_0x249143);}(_0x7712,0x119));var _0x2771=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x7712[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x2771('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2771('0x1'));var jsonpatch=require(_0x2771('0x2'));var rp=require(_0x2771('0x3'));var moment=require('moment');var BPromise=require(_0x2771('0x4'));var Mustache=require(_0x2771('0x5'));var util=require('util');var path=require(_0x2771('0x6'));var sox=require(_0x2771('0x7'));var csv=require(_0x2771('0x8'));var ejs=require(_0x2771('0x9'));var fs=require('fs');var fs_extra=require(_0x2771('0xa'));var _=require(_0x2771('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2771('0xc'));var deskjs=require(_0x2771('0xd'));var toCsv=require(_0x2771('0x8'));var querystring=require(_0x2771('0xe'));var Papa=require(_0x2771('0xf'));var Redis=require(_0x2771('0x10'));var authService=require(_0x2771('0x11'));var qs=require(_0x2771('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2771('0x13'))('api');var utils=require(_0x2771('0x14'));var config=require(_0x2771('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2771('0x16'))['db'];var jayson=require(_0x2771('0x17'));var client=jayson[_0x2771('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x222710,_0x3bce3a,_0x56b90c,_0x535f55){return new BPromise(function(_0x4efb4a,_0x1f61a0){var _0x3ae868=_0x535f55||client;return _0x3ae868[_0x2771('0x19')](_0x222710,_0x56b90c)[_0x2771('0x1a')](function(_0x1990bb){logger['info']('VoiceContext,\x20%s,\x20%s',_0x3bce3a,_0x2771('0x1b'));logger[_0x2771('0x1c')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3bce3a,'request\x20sent',JSON[_0x2771('0x1d')](_0x1990bb));if(_0x1990bb[_0x2771('0x1e')]){if(_0x1990bb['error']['code']===0x1f4){logger[_0x2771('0x1e')](_0x2771('0x1f'),_0x3bce3a,_0x1990bb[_0x2771('0x1e')]['message']);return _0x1f61a0(_0x1990bb['error']['message']);}logger[_0x2771('0x1e')](_0x2771('0x1f'),_0x3bce3a,_0x1990bb[_0x2771('0x1e')][_0x2771('0x20')]);return _0x4efb4a(_0x1990bb[_0x2771('0x1e')][_0x2771('0x20')]);}else{logger[_0x2771('0x21')](_0x2771('0x1f'),_0x3bce3a,_0x2771('0x1b'));_0x4efb4a(_0x1990bb[_0x2771('0x22')][_0x2771('0x20')]);}})[_0x2771('0x23')](function(_0x57c967){logger[_0x2771('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x3bce3a,_0x57c967);_0x1f61a0(_0x57c967);});});}function respondWithStatusCode(_0x40b3a6,_0x3ce954){_0x3ce954=_0x3ce954||0xcc;return function(_0x9fcd5d){if(_0x9fcd5d){return _0x40b3a6['sendStatus'](_0x3ce954);}return _0x40b3a6['status'](_0x3ce954)[_0x2771('0x24')]();};}function respondWithResult(_0x34b7f7,_0xb49f8){_0xb49f8=_0xb49f8||0xc8;return function(_0x400c61){if(_0x400c61){return _0x34b7f7[_0x2771('0x25')](_0xb49f8)[_0x2771('0x26')](_0x400c61);}};}function respondWithFilteredResult(_0xefc86d,_0x32d6bd){return function(_0x2183b4){if(_0x2183b4){var _0x451da5=typeof _0x32d6bd[_0x2771('0x27')]===_0x2771('0x28')&&typeof _0x32d6bd[_0x2771('0x29')]===_0x2771('0x28');var _0x28cd5d=_0x2183b4[_0x2771('0x2a')];var _0x2a0f7b=_0x451da5?0x0:_0x32d6bd['offset'];var _0x390717=_0x451da5?_0x2183b4[_0x2771('0x2a')]:_0x32d6bd['offset']+_0x32d6bd['limit'];var _0x314d94;if(_0x390717>=_0x28cd5d){_0x390717=_0x28cd5d;_0x314d94=0xc8;}else{_0x314d94=0xce;}_0xefc86d[_0x2771('0x25')](_0x314d94);return _0xefc86d[_0x2771('0x2b')](_0x2771('0x2c'),_0x2a0f7b+'-'+_0x390717+'/'+_0x28cd5d)['json'](_0x2183b4);}return null;};}function patchUpdates(_0x48f5b7){return function(_0x35d52a){try{jsonpatch[_0x2771('0x2d')](_0x35d52a,_0x48f5b7,!![]);}catch(_0x262fa7){return BPromise[_0x2771('0x2e')](_0x262fa7);}return _0x35d52a[_0x2771('0x2f')]();};}function saveUpdates(_0x8109a7,_0x19ad24){return function(_0x4231f8){if(_0x4231f8){return _0x4231f8['update'](_0x8109a7)[_0x2771('0x1a')](function(_0x69ce2a){return _0x69ce2a;});}return null;};}function removeEntity(_0x162069,_0x4722b4){return function(_0x5af947){if(_0x5af947){return _0x5af947[_0x2771('0x30')]()[_0x2771('0x1a')](function(){var _0xd3d91d=_0x5af947[_0x2771('0x31')]({'plain':!![]});var _0x11cf0b=_0x2771('0x32');return db[_0x2771('0x33')][_0x2771('0x30')]({'where':{'type':_0x11cf0b,'resourceId':_0xd3d91d['id']}})['then'](function(){return _0x5af947;});})[_0x2771('0x1a')](function(){_0x162069[_0x2771('0x25')](0xcc)[_0x2771('0x24')]();});}};}function handleEntityNotFound(_0x5c472d,_0x14ec82){return function(_0xc28e23){if(!_0xc28e23){_0x5c472d[_0x2771('0x34')](0x194);}return _0xc28e23;};}function handleError(_0xd8bd00,_0xf33c79){_0xf33c79=_0xf33c79||0x1f4;return function(_0x463dee){logger[_0x2771('0x1e')](_0x463dee[_0x2771('0x35')]);if(_0x463dee[_0x2771('0x36')]){delete _0x463dee[_0x2771('0x36')];}_0xd8bd00[_0x2771('0x25')](_0xf33c79)[_0x2771('0x37')](_0x463dee);};}exports[_0x2771('0x38')]=function(_0xda0336,_0x207700){var _0x423705={},_0x221680={},_0x1d4647={'count':0x0,'rows':[]};var _0x5dfd5a=_[_0x2771('0x39')](db[_0x2771('0x3a')]['rawAttributes'],function(_0x311ce6){return{'name':_0x311ce6[_0x2771('0x3b')],'type':_0x311ce6['type'][_0x2771('0x3c')]};});_0x221680['model']=_[_0x2771('0x39')](_0x5dfd5a,_0x2771('0x36'));_0x221680[_0x2771('0x3d')]=_[_0x2771('0x3e')](_0xda0336[_0x2771('0x3d')]);_0x221680[_0x2771('0x3f')]=_['intersection'](_0x221680['model'],_0x221680[_0x2771('0x3d')]);_0x423705['attributes']=_[_0x2771('0x40')](_0x221680['model'],qs[_0x2771('0x41')](_0xda0336[_0x2771('0x3d')][_0x2771('0x41')]));_0x423705[_0x2771('0x42')]=_0x423705['attributes'][_0x2771('0x43')]?_0x423705[_0x2771('0x42')]:_0x221680['model'];if(!_0xda0336[_0x2771('0x3d')][_0x2771('0x44')](_0x2771('0x45'))){_0x423705[_0x2771('0x29')]=qs[_0x2771('0x29')](_0xda0336[_0x2771('0x3d')][_0x2771('0x29')]);_0x423705[_0x2771('0x27')]=qs['offset'](_0xda0336[_0x2771('0x3d')][_0x2771('0x27')]);}_0x423705[_0x2771('0x46')]=qs[_0x2771('0x47')](_0xda0336[_0x2771('0x3d')]['sort']);_0x423705[_0x2771('0x48')]=qs['filters'](_[_0x2771('0x49')](_0xda0336['query'],_0x221680[_0x2771('0x3f')]),_0x5dfd5a);if(_0xda0336['query'][_0x2771('0x4a')]){_0x423705[_0x2771('0x48')]=_['merge'](_0x423705[_0x2771('0x48')],{'$or':_['map'](_0x5dfd5a,function(_0x7a8d7c){if(_0x7a8d7c[_0x2771('0x4b')]!==_0x2771('0x4c')){var _0x3b4dd9={};_0x3b4dd9[_0x7a8d7c[_0x2771('0x36')]]={'$like':'%'+_0xda0336[_0x2771('0x3d')][_0x2771('0x4a')]+'%'};return _0x3b4dd9;}})});}_0x423705=_[_0x2771('0x4d')]({},_0x423705,_0xda0336['options']);var _0x23bbe2={'where':_0x423705[_0x2771('0x48')]};return db[_0x2771('0x3a')]['count'](_0x23bbe2)[_0x2771('0x1a')](function(_0x23ef81){_0x1d4647[_0x2771('0x2a')]=_0x23ef81;if(_0xda0336[_0x2771('0x3d')][_0x2771('0x4e')]){_0x423705['include']=[{'all':!![]}];}return db[_0x2771('0x3a')][_0x2771('0x4f')](_0x423705);})[_0x2771('0x1a')](function(_0x3c451e){_0x1d4647[_0x2771('0x50')]=_0x3c451e;return _0x1d4647;})[_0x2771('0x1a')](respondWithFilteredResult(_0x207700,_0x423705))[_0x2771('0x23')](handleError(_0x207700,null));};exports[_0x2771('0x51')]=function(_0x46f091,_0x2829c1){var _0x14b5fd={'raw':![],'where':{'id':_0x46f091['params']['id']}},_0x81030d={};_0x81030d[_0x2771('0x52')]=_[_0x2771('0x3e')](db['VoiceContext']['rawAttributes']);_0x81030d[_0x2771('0x3d')]=_[_0x2771('0x3e')](_0x46f091[_0x2771('0x3d')]);_0x81030d['filters']=_[_0x2771('0x40')](_0x81030d[_0x2771('0x52')],_0x81030d[_0x2771('0x3d')]);_0x14b5fd[_0x2771('0x42')]=_[_0x2771('0x40')](_0x81030d['model'],qs[_0x2771('0x41')](_0x46f091[_0x2771('0x3d')][_0x2771('0x41')]));_0x14b5fd['attributes']=_0x14b5fd[_0x2771('0x42')][_0x2771('0x43')]?_0x14b5fd[_0x2771('0x42')]:_0x81030d['model'];if(_0x46f091[_0x2771('0x3d')][_0x2771('0x4e')]){_0x14b5fd['include']=[{'all':!![]}];}_0x14b5fd=_['merge']({},_0x14b5fd,_0x46f091[_0x2771('0x53')]);return db['VoiceContext'][_0x2771('0x54')](_0x14b5fd)[_0x2771('0x1a')](handleEntityNotFound(_0x2829c1,null))[_0x2771('0x1a')](respondWithResult(_0x2829c1,null))[_0x2771('0x23')](handleError(_0x2829c1,null));};exports[_0x2771('0x55')]=function(_0x4cc77b,_0x1a6986,_0x34c0d1){var _0x358691;return db[_0x2771('0x3a')][_0x2771('0x55')](_0x4cc77b['body'],{'raw':!![]})[_0x2771('0x1a')](function(_0x57b6bd){_0x358691=_0x57b6bd;return db[_0x2771('0x3a')][_0x2771('0x4f')]({'raw':!![]});})[_0x2771('0x1a')](function(_0x345d78){var _0x4f9ac7=fs[_0x2771('0x56')](path[_0x2771('0x57')](config[_0x2771('0x58')],_0x2771('0x59')),_0x2771('0x5a'));var _0x2b23f6=ejs[_0x2771('0x5b')](_0x4f9ac7,{'contexts':_0x345d78||[]});fs['writeFileSync'](_0x2771('0x5c'),_0x2b23f6);})[_0x2771('0x1a')](function(){return respondWithRpcPromise(_0x2771('0x5d'),'create',{'module':_0x2771('0x5e')});})[_0x2771('0x1a')](function(){var _0x11558a=_0x4cc77b[_0x2771('0x5f')]['get']({'plain':!![]});if(!_0x11558a)throw new Error(_0x2771('0x60'));if(_0x11558a[_0x2771('0x61')]===_0x2771('0x5f')){var _0x3aa2a0=_0x358691['get']({'plain':!![]});return db[_0x2771('0x62')][_0x2771('0x54')]({'where':{'name':'Contexts','userProfileId':_0x11558a['userProfileId']},'raw':!![]})[_0x2771('0x1a')](function(_0x5bb53a){if(_0x5bb53a&&_0x5bb53a['autoAssociation']===0x0){return db['UserProfileResource'][_0x2771('0x55')]({'name':_0x3aa2a0['name'],'resourceId':_0x3aa2a0['id'],'type':_0x5bb53a[_0x2771('0x36')],'sectionId':_0x5bb53a['id']},{})[_0x2771('0x1a')](function(){return _0x358691;});}else{return _0x358691;}})[_0x2771('0x23')](function(_0x86e660){logger[_0x2771('0x1e')](_0x2771('0x63'),_0x86e660);throw _0x86e660;});}return _0x358691;})[_0x2771('0x1a')](respondWithResult(_0x1a6986,0xc9))[_0x2771('0x23')](handleError(_0x1a6986,null));};exports[_0x2771('0x64')]=function(_0x50a319,_0x423933,_0x4d1bea){var _0x3d2351;return db['VoiceContext'][_0x2771('0x54')]({'where':{'id':_0x50a319[_0x2771('0x65')]['id']}})[_0x2771('0x1a')](handleEntityNotFound(_0x423933,null))[_0x2771('0x1a')](saveUpdates(_0x50a319['body'],null))[_0x2771('0x1a')](function(_0x3e5ccf){if(_0x3e5ccf){_0x3d2351=_0x3e5ccf;return db[_0x2771('0x3a')]['findAll']({'raw':!![]});}})[_0x2771('0x1a')](function(_0x2d645d){var _0x441d1f=fs[_0x2771('0x56')](path[_0x2771('0x57')](config[_0x2771('0x58')],'server/files/templates/context.ejs'),_0x2771('0x5a'));var _0x12ee2f=ejs['render'](_0x441d1f,{'contexts':_0x2d645d||[]});fs[_0x2771('0x66')](_0x2771('0x5c'),_0x12ee2f);})[_0x2771('0x1a')](function(){return respondWithRpcPromise('Reload','update',{'module':_0x2771('0x5e')});})[_0x2771('0x1a')](function(){return _0x3d2351;})[_0x2771('0x1a')](respondWithResult(_0x423933,null))[_0x2771('0x23')](handleError(_0x423933,null));};exports[_0x2771('0x30')]=function(_0x22fe81,_0x14a115,_0x1943ce){var _0x596b41;return db[_0x2771('0x3a')][_0x2771('0x54')]({'where':{'id':_0x22fe81['params']['id']}})[_0x2771('0x1a')](handleEntityNotFound(_0x14a115,null))[_0x2771('0x1a')](removeEntity(_0x14a115,null))['then'](function(){return db[_0x2771('0x3a')][_0x2771('0x4f')]({'raw':!![]});})[_0x2771('0x1a')](function(_0x1eca61){var _0x5d1761=fs['readFileSync'](path[_0x2771('0x57')](config[_0x2771('0x58')],_0x2771('0x59')),_0x2771('0x5a'));var _0x5d7740=ejs['render'](_0x5d1761,{'contexts':_0x1eca61});fs[_0x2771('0x66')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x5d7740);return respondWithRpcPromise(_0x2771('0x5d'),_0x2771('0x30'),{'module':'chan_sip.so'});})[_0x2771('0x23')](handleError(_0x14a115,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index d143cc0..35797ac 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 _0xcc4f=['lodash','util','../../config/logger','api','moment','request-promise','path','./voiceContext.attributes','define','VoiceContext'];(function(_0x474cb1,_0x518d51){var _0x4e20bb=function(_0x463773){while(--_0x463773){_0x474cb1['push'](_0x474cb1['shift']());}};_0x4e20bb(++_0x518d51);}(_0xcc4f,0x82));var _0xfcc4=function(_0x3a7a85,_0x16bbe3){_0x3a7a85=_0x3a7a85-0x0;var _0x434e67=_0xcc4f[_0x3a7a85];return _0x434e67;};'use strict';var _=require(_0xfcc4('0x0'));var util=require(_0xfcc4('0x1'));var logger=require(_0xfcc4('0x2'))(_0xfcc4('0x3'));var moment=require(_0xfcc4('0x4'));var BPromise=require('bluebird');var rp=require(_0xfcc4('0x5'));var fs=require('fs');var path=require(_0xfcc4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfcc4('0x7'));module['exports']=function(_0x45e2a8,_0x51c01d){return _0x45e2a8[_0xfcc4('0x8')](_0xfcc4('0x9'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf55=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts'];(function(_0x3a2e4b,_0x1fc1f7){var _0x3697d9=function(_0x45a4fa){while(--_0x45a4fa){_0x3a2e4b['push'](_0x3a2e4b['shift']());}};_0x3697d9(++_0x1fc1f7);}(_0xaf55,0x1e0));var _0x5af5=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xaf55[_0x101e7b];return _0x4995c0;};'use strict';var _=require(_0x5af5('0x0'));var util=require(_0x5af5('0x1'));var logger=require(_0x5af5('0x2'))(_0x5af5('0x3'));var moment=require(_0x5af5('0x4'));var BPromise=require(_0x5af5('0x5'));var rp=require(_0x5af5('0x6'));var fs=require('fs');var path=require(_0x5af5('0x7'));var rimraf=require(_0x5af5('0x8'));var config=require(_0x5af5('0x9'));var attributes=require(_0x5af5('0xa'));module[_0x5af5('0xb')]=function(_0x16b6a0,_0x872cb0){return _0x16b6a0[_0x5af5('0xc')](_0x5af5('0xd'),attributes,{'tableName':_0x5af5('0xe'),'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 9a5376b..80217d2 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 _0xd844=['../../config/logger','rpc','../../config/environment','client','request','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util','bluebird','randomstring','../../config/utils'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd844,0x6d));var _0x4d84=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd844[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x4d84('0x0'));var util=require(_0x4d84('0x1'));var moment=require('moment');var BPromise=require(_0x4d84('0x2'));var rs=require(_0x4d84('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4d84('0x4'));var logger=require(_0x4d84('0x5'))(_0x4d84('0x6'));var config=require(_0x4d84('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4d84('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x591203,_0x423d11,_0x4f777a){return new BPromise(function(_0x49c1b0,_0xbdf246){return client[_0x4d84('0x9')](_0x591203,_0x4f777a)['then'](function(_0x42a874){logger['info'](_0x4d84('0xa'),_0x423d11,_0x4d84('0xb'));logger[_0x4d84('0xc')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x423d11,_0x4d84('0xb'),JSON[_0x4d84('0xd')](_0x42a874));if(_0x42a874[_0x4d84('0xe')]){if(_0x42a874[_0x4d84('0xe')][_0x4d84('0xf')]===0x1f4){logger[_0x4d84('0xe')](_0x4d84('0xa'),_0x423d11,_0x42a874[_0x4d84('0xe')][_0x4d84('0x10')]);return _0xbdf246(_0x42a874[_0x4d84('0xe')][_0x4d84('0x10')]);}logger['error'](_0x4d84('0xa'),_0x423d11,_0x42a874['error'][_0x4d84('0x10')]);return _0x49c1b0(_0x42a874[_0x4d84('0xe')][_0x4d84('0x10')]);}else{logger[_0x4d84('0x11')]('VoiceContext,\x20%s,\x20%s',_0x423d11,_0x4d84('0xb'));_0x49c1b0(_0x42a874['result'][_0x4d84('0x10')]);}})[_0x4d84('0x12')](function(_0x501525){logger['error'](_0x4d84('0xa'),_0x423d11,_0x501525);_0xbdf246(_0x501525);});});} \ No newline at end of file +var _0xb12d=['rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceContext,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xc88845,_0x38bd20){var _0x82346=function(_0x6cc22a){while(--_0x6cc22a){_0xc88845['push'](_0xc88845['shift']());}};_0x82346(++_0x38bd20);}(_0xb12d,0x124));var _0xdb12=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xb12d[_0x45783c];return _0x1161da;};'use strict';var _=require(_0xdb12('0x0'));var util=require(_0xdb12('0x1'));var moment=require(_0xdb12('0x2'));var BPromise=require('bluebird');var rs=require(_0xdb12('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdb12('0x4'))['db'];var utils=require(_0xdb12('0x5'));var logger=require(_0xdb12('0x6'))(_0xdb12('0x7'));var config=require(_0xdb12('0x8'));var jayson=require(_0xdb12('0x9'));var client=jayson['client'][_0xdb12('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19e73f,_0x27eb31,_0x3872c3){return new BPromise(function(_0x11385d,_0x11d97c){return client[_0xdb12('0xb')](_0x19e73f,_0x3872c3)[_0xdb12('0xc')](function(_0x54eb5b){logger[_0xdb12('0xd')]('VoiceContext,\x20%s,\x20%s',_0x27eb31,_0xdb12('0xe'));logger[_0xdb12('0xf')](_0xdb12('0x10'),_0x27eb31,'request\x20sent',JSON[_0xdb12('0x11')](_0x54eb5b));if(_0x54eb5b[_0xdb12('0x12')]){if(_0x54eb5b[_0xdb12('0x12')]['code']===0x1f4){logger[_0xdb12('0x12')]('VoiceContext,\x20%s,\x20%s',_0x27eb31,_0x54eb5b[_0xdb12('0x12')][_0xdb12('0x13')]);return _0x11d97c(_0x54eb5b[_0xdb12('0x12')]['message']);}logger[_0xdb12('0x12')](_0xdb12('0x14'),_0x27eb31,_0x54eb5b['error'][_0xdb12('0x13')]);return _0x11385d(_0x54eb5b['error'][_0xdb12('0x13')]);}else{logger[_0xdb12('0xd')]('VoiceContext,\x20%s,\x20%s',_0x27eb31,_0xdb12('0xe'));_0x11385d(_0x54eb5b[_0xdb12('0x15')][_0xdb12('0x13')]);}})[_0xdb12('0x16')](function(_0x504cf5){logger['error'](_0xdb12('0x14'),_0x27eb31,_0x504cf5);_0x11d97c(_0x504cf5);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index cbf1079..391af64 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 _0x4862=['express','fs-extra','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','get','/describe','describe','show','post','create','put','/:id','update','delete','exports','multer','path','connect-timeout'];(function(_0x18e7e2,_0x5b0886){var _0xea6f67=function(_0x23766c){while(--_0x23766c){_0x18e7e2['push'](_0x18e7e2['shift']());}};_0xea6f67(++_0x5b0886);}(_0x4862,0x129));var _0x2486=function(_0x16adf1,_0x1273a5){_0x16adf1=_0x16adf1-0x0;var _0xc13362=_0x4862[_0x16adf1];return _0xc13362;};'use strict';var multer=require(_0x2486('0x0'));var util=require('util');var path=require(_0x2486('0x1'));var timeout=require(_0x2486('0x2'));var express=require(_0x2486('0x3'));var router=express['Router']();var fs_extra=require(_0x2486('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2486('0x5'));var config=require(_0x2486('0x6'));var controller=require(_0x2486('0x7'));router['get']('/',auth[_0x2486('0x8')](),controller['index']);router[_0x2486('0x9')](_0x2486('0xa'),auth[_0x2486('0x8')](),controller[_0x2486('0xb')]);router['get']('/:id',auth[_0x2486('0x8')](),controller[_0x2486('0xc')]);router[_0x2486('0xd')]('/',auth['isAuthenticated'](),controller[_0x2486('0xe')]);router[_0x2486('0xf')](_0x2486('0x10'),auth['isAuthenticated'](),controller[_0x2486('0x11')]);router[_0x2486('0x12')]('/:id',auth[_0x2486('0x8')](),controller['destroy']);module[_0x2486('0x13')]=router; \ No newline at end of file +var _0xfbb0=['isAuthenticated','describe','/:id','show','post','create','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x37daa8,_0x775188){var _0x6dbe8d=function(_0xa2dd29){while(--_0xa2dd29){_0x37daa8['push'](_0x37daa8['shift']());}};_0x6dbe8d(++_0x775188);}(_0xfbb0,0x1d1));var _0x0fbb=function(_0x347dde,_0x161a05){_0x347dde=_0x347dde-0x0;var _0x1c0739=_0xfbb0[_0x347dde];return _0x1c0739;};'use strict';var multer=require(_0x0fbb('0x0'));var util=require(_0x0fbb('0x1'));var path=require('path');var timeout=require(_0x0fbb('0x2'));var express=require(_0x0fbb('0x3'));var router=express[_0x0fbb('0x4')]();var fs_extra=require(_0x0fbb('0x5'));var auth=require(_0x0fbb('0x6'));var interaction=require(_0x0fbb('0x7'));var config=require(_0x0fbb('0x8'));var controller=require('./voiceDialReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0fbb('0x9')]('/describe',auth[_0x0fbb('0xa')](),controller[_0x0fbb('0xb')]);router[_0x0fbb('0x9')](_0x0fbb('0xc'),auth[_0x0fbb('0xa')](),controller[_0x0fbb('0xd')]);router[_0x0fbb('0xe')]('/',auth[_0x0fbb('0xa')](),controller[_0x0fbb('0xf')]);router['put'](_0x0fbb('0xc'),auth['isAuthenticated'](),controller[_0x0fbb('0x10')]);router[_0x0fbb('0x11')](_0x0fbb('0xc'),auth[_0x0fbb('0xa')](),controller[_0x0fbb('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 701d916..6a3b133 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 _0xf3cd=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x2ba235,_0x4e1431){var _0x381629=function(_0x10f755){while(--_0x10f755){_0x2ba235['push'](_0x2ba235['shift']());}};_0x381629(++_0x4e1431);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x470f24,_0x2436a9){_0x470f24=_0x470f24-0x0;var _0x2c6fc8=_0xf3cd[_0x470f24];return _0x2c6fc8;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'privilege':{'type':Sequelize[_0xdf3c('0x2')]},'channel':{'type':Sequelize[_0xdf3c('0x2')]},'channelstate':{'type':Sequelize[_0xdf3c('0x3')]},'channelstatedesc':{'type':Sequelize[_0xdf3c('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xdf3c('0x2')]},'connectedlinenum':{'type':Sequelize[_0xdf3c('0x2')]},'connectedlinename':{'type':Sequelize[_0xdf3c('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xdf3c('0x2')]},'context':{'type':Sequelize[_0xdf3c('0x2')]},'exten':{'type':Sequelize[_0xdf3c('0x2')]},'priority':{'type':Sequelize[_0xdf3c('0x3')]},'uniqueid':{'type':Sequelize[_0xdf3c('0x2')]},'linkedid':{'type':Sequelize[_0xdf3c('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xdf3c('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xdf3c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xdf3c('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xdf3c('0x2')]},'destaccountcode':{'type':Sequelize[_0xdf3c('0x2')]},'destcontext':{'type':Sequelize[_0xdf3c('0x2')]},'destexten':{'type':Sequelize[_0xdf3c('0x2')]},'destpriority':{'type':Sequelize[_0xdf3c('0x3')]},'destuniqueid':{'type':Sequelize[_0xdf3c('0x2')]},'destlinkedid':{'type':Sequelize[_0xdf3c('0x2')]},'dialstring':{'type':Sequelize[_0xdf3c('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xdf3c('0x4')]},'answertime':{'type':Sequelize[_0xdf3c('0x4')]},'endtime':{'type':Sequelize[_0xdf3c('0x4')]},'lastevent':{'type':Sequelize[_0xdf3c('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xdf3c('0x3')]},'duration':{'type':Sequelize[_0xdf3c('0x3')]},'holdtime':{'type':Sequelize[_0xdf3c('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x9957=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x1630c0,_0x4b0ad2){var _0x116d2e=function(_0x46868a){while(--_0x46868a){_0x1630c0['push'](_0x1630c0['shift']());}};_0x116d2e(++_0x4b0ad2);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'privilege':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize[_0x7995('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x7995('0x2')]},'calleridnum':{'type':Sequelize[_0x7995('0x2')]},'calleridname':{'type':Sequelize[_0x7995('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'context':{'type':Sequelize[_0x7995('0x2')]},'exten':{'type':Sequelize[_0x7995('0x2')]},'priority':{'type':Sequelize[_0x7995('0x3')]},'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x7995('0x2')]},'destchannelstate':{'type':Sequelize[_0x7995('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x7995('0x2')]},'destcalleridname':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7995('0x2')]},'destlanguage':{'type':Sequelize[_0x7995('0x2')]},'destaccountcode':{'type':Sequelize[_0x7995('0x2')]},'destcontext':{'type':Sequelize[_0x7995('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x7995('0x3')]},'destuniqueid':{'type':Sequelize[_0x7995('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x7995('0x2')]},'dialstatus':{'type':Sequelize[_0x7995('0x2')]},'starttime':{'type':Sequelize[_0x7995('0x4')]},'answertime':{'type':Sequelize[_0x7995('0x4')]},'endtime':{'type':Sequelize[_0x7995('0x4')]},'lastevent':{'type':Sequelize[_0x7995('0x2')],'comment':_0x7995('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x7995('0x3')]},'billableseconds':{'type':Sequelize[_0x7995('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 1f5789e..db95b0d 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 _0xc3e5=['to-csv','ejs','fs-extra','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','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','rawAttributes','fieldName','key','map','filters','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','VoiceDialReport','includeAll','include','findAll','catch','show','params','keys','options','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x3121d3,_0x89bd10){var _0x3df779=function(_0x2f07ea){while(--_0x2f07ea){_0x3121d3['push'](_0x3121d3['shift']());}};_0x3df779(++_0x89bd10);}(_0xc3e5,0x13e));var _0x5c3e=function(_0x2fe2de,_0x45c467){_0x2fe2de=_0x2fe2de-0x0;var _0x590437=_0xc3e5[_0x2fe2de];return _0x590437;};'use strict';var emlformat=require(_0x5c3e('0x0'));var rimraf=require(_0x5c3e('0x1'));var zipdir=require(_0x5c3e('0x2'));var jsonpatch=require(_0x5c3e('0x3'));var rp=require('request-promise');var moment=require(_0x5c3e('0x4'));var BPromise=require(_0x5c3e('0x5'));var Mustache=require(_0x5c3e('0x6'));var util=require(_0x5c3e('0x7'));var path=require(_0x5c3e('0x8'));var sox=require(_0x5c3e('0x9'));var csv=require(_0x5c3e('0xa'));var ejs=require(_0x5c3e('0xb'));var fs=require('fs');var fs_extra=require(_0x5c3e('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5c3e('0xd'));var jsforce=require(_0x5c3e('0xe'));var deskjs=require(_0x5c3e('0xf'));var toCsv=require(_0x5c3e('0xa'));var querystring=require(_0x5c3e('0x10'));var Papa=require(_0x5c3e('0x11'));var Redis=require(_0x5c3e('0x12'));var authService=require(_0x5c3e('0x13'));var qs=require(_0x5c3e('0x14'));var as=require(_0x5c3e('0x15'));var hardwareService=require(_0x5c3e('0x16'));var logger=require(_0x5c3e('0x17'))(_0x5c3e('0x18'));var utils=require(_0x5c3e('0x19'));var config=require(_0x5c3e('0x1a'));var licenseUtil=require(_0x5c3e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d2248,_0x590d4a){_0x590d4a=_0x590d4a||0xcc;return function(_0x192d54){if(_0x192d54){return _0x3d2248[_0x5c3e('0x1c')](_0x590d4a);}return _0x3d2248[_0x5c3e('0x1d')](_0x590d4a)[_0x5c3e('0x1e')]();};}function respondWithResult(_0x178b87,_0xb1bdeb){_0xb1bdeb=_0xb1bdeb||0xc8;return function(_0x3c09d3){if(_0x3c09d3){return _0x178b87['status'](_0xb1bdeb)[_0x5c3e('0x1f')](_0x3c09d3);}};}function respondWithFilteredResult(_0x42f609,_0x4e2ef6){return function(_0x360abf){if(_0x360abf){var _0x2b2345=typeof _0x4e2ef6[_0x5c3e('0x20')]===_0x5c3e('0x21')&&typeof _0x4e2ef6[_0x5c3e('0x22')]===_0x5c3e('0x21');var _0x48f19d=_0x360abf[_0x5c3e('0x23')];var _0x2e99bf=_0x2b2345?0x0:_0x4e2ef6[_0x5c3e('0x20')];var _0xe56112=_0x2b2345?_0x360abf['count']:_0x4e2ef6[_0x5c3e('0x20')]+_0x4e2ef6[_0x5c3e('0x22')];var _0x39f475;if(_0xe56112>=_0x48f19d){_0xe56112=_0x48f19d;_0x39f475=0xc8;}else{_0x39f475=0xce;}_0x42f609[_0x5c3e('0x1d')](_0x39f475);return _0x42f609[_0x5c3e('0x24')](_0x5c3e('0x25'),_0x2e99bf+'-'+_0xe56112+'/'+_0x48f19d)[_0x5c3e('0x1f')](_0x360abf);}return null;};}function patchUpdates(_0x3114da){return function(_0x10792e){try{jsonpatch[_0x5c3e('0x26')](_0x10792e,_0x3114da,!![]);}catch(_0x3761f4){return BPromise[_0x5c3e('0x27')](_0x3761f4);}return _0x10792e[_0x5c3e('0x28')]();};}function saveUpdates(_0x15e1f2,_0xece7ff){return function(_0x3e9496){if(_0x3e9496){return _0x3e9496['update'](_0x15e1f2)['then'](function(_0x27dd66){return _0x27dd66;});}return null;};}function removeEntity(_0x11c66d,_0x1273dd){return function(_0x473e5b){if(_0x473e5b){return _0x473e5b[_0x5c3e('0x29')]()[_0x5c3e('0x2a')](function(){_0x11c66d[_0x5c3e('0x1d')](0xcc)[_0x5c3e('0x1e')]();});}};}function handleEntityNotFound(_0x2005a0,_0x3e2841){return function(_0x54c2ae){if(!_0x54c2ae){_0x2005a0[_0x5c3e('0x1c')](0x194);}return _0x54c2ae;};}function handleError(_0x3aa287,_0x35a8da){_0x35a8da=_0x35a8da||0x1f4;return function(_0x5d85f9){logger[_0x5c3e('0x2b')](_0x5d85f9[_0x5c3e('0x2c')]);if(_0x5d85f9['name']){delete _0x5d85f9[_0x5c3e('0x2d')];}_0x3aa287['status'](_0x35a8da)[_0x5c3e('0x2e')](_0x5d85f9);};}exports[_0x5c3e('0x2f')]=function(_0x4a0154,_0x32f18d){var _0x4b4cbe={},_0xf7e666={},_0x436821={'count':0x0,'rows':[]};var _0x220299=_['map'](db['VoiceDialReport'][_0x5c3e('0x30')],function(_0x2059ce){return{'name':_0x2059ce[_0x5c3e('0x31')],'type':_0x2059ce['type'][_0x5c3e('0x32')]};});_0xf7e666['model']=_[_0x5c3e('0x33')](_0x220299,'name');_0xf7e666['query']=_['keys'](_0x4a0154['query']);_0xf7e666[_0x5c3e('0x34')]=_['intersection'](_0xf7e666[_0x5c3e('0x35')],_0xf7e666[_0x5c3e('0x36')]);_0x4b4cbe[_0x5c3e('0x37')]=_[_0x5c3e('0x38')](_0xf7e666['model'],qs[_0x5c3e('0x39')](_0x4a0154[_0x5c3e('0x36')][_0x5c3e('0x39')]));_0x4b4cbe[_0x5c3e('0x37')]=_0x4b4cbe['attributes'][_0x5c3e('0x3a')]?_0x4b4cbe[_0x5c3e('0x37')]:_0xf7e666[_0x5c3e('0x35')];if(!_0x4a0154[_0x5c3e('0x36')][_0x5c3e('0x3b')](_0x5c3e('0x3c'))){_0x4b4cbe[_0x5c3e('0x22')]=qs[_0x5c3e('0x22')](_0x4a0154[_0x5c3e('0x36')][_0x5c3e('0x22')]);_0x4b4cbe[_0x5c3e('0x20')]=qs[_0x5c3e('0x20')](_0x4a0154[_0x5c3e('0x36')][_0x5c3e('0x20')]);}_0x4b4cbe[_0x5c3e('0x3d')]=qs[_0x5c3e('0x3e')](_0x4a0154[_0x5c3e('0x36')][_0x5c3e('0x3e')]);_0x4b4cbe[_0x5c3e('0x3f')]=qs[_0x5c3e('0x34')](_['pick'](_0x4a0154[_0x5c3e('0x36')],_0xf7e666[_0x5c3e('0x34')]),_0x220299);if(_0x4a0154[_0x5c3e('0x36')][_0x5c3e('0x40')]){_0x4b4cbe[_0x5c3e('0x3f')]=_[_0x5c3e('0x41')](_0x4b4cbe[_0x5c3e('0x3f')],{'$or':_[_0x5c3e('0x33')](_0x220299,function(_0x585285){if(_0x585285[_0x5c3e('0x42')]!==_0x5c3e('0x43')){var _0x4dc37b={};_0x4dc37b[_0x585285[_0x5c3e('0x2d')]]={'$like':'%'+_0x4a0154[_0x5c3e('0x36')]['filter']+'%'};return _0x4dc37b;}})});}_0x4b4cbe=_[_0x5c3e('0x41')]({},_0x4b4cbe,_0x4a0154['options']);var _0x154b4d={'where':_0x4b4cbe[_0x5c3e('0x3f')]};return db[_0x5c3e('0x44')][_0x5c3e('0x23')](_0x154b4d)[_0x5c3e('0x2a')](function(_0x46d580){_0x436821[_0x5c3e('0x23')]=_0x46d580;if(_0x4a0154[_0x5c3e('0x36')][_0x5c3e('0x45')]){_0x4b4cbe[_0x5c3e('0x46')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x5c3e('0x47')](_0x4b4cbe);})[_0x5c3e('0x2a')](function(_0x2823da){_0x436821['rows']=_0x2823da;return _0x436821;})[_0x5c3e('0x2a')](respondWithFilteredResult(_0x32f18d,_0x4b4cbe))[_0x5c3e('0x48')](handleError(_0x32f18d,null));};exports[_0x5c3e('0x49')]=function(_0x531ef8,_0x531850){var _0x8481aa={'raw':!![],'where':{'id':_0x531ef8[_0x5c3e('0x4a')]['id']}},_0x3b7a01={};_0x3b7a01[_0x5c3e('0x35')]=_[_0x5c3e('0x4b')](db[_0x5c3e('0x44')][_0x5c3e('0x30')]);_0x3b7a01['query']=_['keys'](_0x531ef8[_0x5c3e('0x36')]);_0x3b7a01['filters']=_['intersection'](_0x3b7a01[_0x5c3e('0x35')],_0x3b7a01[_0x5c3e('0x36')]);_0x8481aa[_0x5c3e('0x37')]=_['intersection'](_0x3b7a01['model'],qs[_0x5c3e('0x39')](_0x531ef8['query'][_0x5c3e('0x39')]));_0x8481aa[_0x5c3e('0x37')]=_0x8481aa[_0x5c3e('0x37')][_0x5c3e('0x3a')]?_0x8481aa['attributes']:_0x3b7a01[_0x5c3e('0x35')];if(_0x531ef8[_0x5c3e('0x36')][_0x5c3e('0x45')]){_0x8481aa['include']=[{'all':!![]}];}_0x8481aa=_[_0x5c3e('0x41')]({},_0x8481aa,_0x531ef8[_0x5c3e('0x4c')]);return db[_0x5c3e('0x44')]['find'](_0x8481aa)[_0x5c3e('0x2a')](handleEntityNotFound(_0x531850,null))[_0x5c3e('0x2a')](respondWithResult(_0x531850,null))[_0x5c3e('0x48')](handleError(_0x531850,null));};exports['create']=function(_0x2baece,_0x487995){return db[_0x5c3e('0x44')][_0x5c3e('0x4d')](_0x2baece[_0x5c3e('0x4e')],{})[_0x5c3e('0x2a')](respondWithResult(_0x487995,0xc9))[_0x5c3e('0x48')](handleError(_0x487995,null));};exports[_0x5c3e('0x4f')]=function(_0x14061d,_0x33b08c){if(_0x14061d['body']['id']){delete _0x14061d[_0x5c3e('0x4e')]['id'];}return db['VoiceDialReport']['find']({'where':{'id':_0x14061d[_0x5c3e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x33b08c,null))[_0x5c3e('0x2a')](saveUpdates(_0x14061d[_0x5c3e('0x4e')],null))['then'](respondWithResult(_0x33b08c,null))[_0x5c3e('0x48')](handleError(_0x33b08c,null));};exports['destroy']=function(_0x342ccf,_0x225c53){return db[_0x5c3e('0x44')][_0x5c3e('0x50')]({'where':{'id':_0x342ccf[_0x5c3e('0x4a')]['id']}})[_0x5c3e('0x2a')](handleEntityNotFound(_0x225c53,null))[_0x5c3e('0x2a')](removeEntity(_0x225c53,null))[_0x5c3e('0x48')](handleError(_0x225c53,null));};exports[_0x5c3e('0x51')]=function(_0x344c23,_0x1822f5){return db[_0x5c3e('0x44')][_0x5c3e('0x51')]()[_0x5c3e('0x2a')](respondWithResult(_0x1822f5,null))[_0x5c3e('0x48')](handleError(_0x1822f5,null));}; \ No newline at end of file +var _0x4df8=['Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','VoiceDialReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set'];(function(_0x2c4787,_0x3d31f9){var _0x23ef9e=function(_0x488332){while(--_0x488332){_0x2c4787['push'](_0x2c4787['shift']());}};_0x23ef9e(++_0x3d31f9);}(_0x4df8,0x77));var _0x84df=function(_0xd3f578,_0x260ebe){_0xd3f578=_0xd3f578-0x0;var _0x14b758=_0x4df8[_0xd3f578];return _0x14b758;};'use strict';var emlformat=require(_0x84df('0x0'));var rimraf=require(_0x84df('0x1'));var zipdir=require(_0x84df('0x2'));var jsonpatch=require(_0x84df('0x3'));var rp=require(_0x84df('0x4'));var moment=require('moment');var BPromise=require(_0x84df('0x5'));var Mustache=require(_0x84df('0x6'));var util=require(_0x84df('0x7'));var path=require(_0x84df('0x8'));var sox=require(_0x84df('0x9'));var csv=require(_0x84df('0xa'));var ejs=require(_0x84df('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x84df('0xc'));var squel=require(_0x84df('0xd'));var crypto=require(_0x84df('0xe'));var jsforce=require(_0x84df('0xf'));var deskjs=require(_0x84df('0x10'));var toCsv=require(_0x84df('0xa'));var querystring=require(_0x84df('0x11'));var Papa=require('papaparse');var Redis=require(_0x84df('0x12'));var authService=require(_0x84df('0x13'));var qs=require(_0x84df('0x14'));var as=require(_0x84df('0x15'));var hardwareService=require(_0x84df('0x16'));var logger=require('../../config/logger')(_0x84df('0x17'));var utils=require(_0x84df('0x18'));var config=require(_0x84df('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x84df('0x1a'))['db'];function respondWithStatusCode(_0x4f5ce2,_0x20a516){_0x20a516=_0x20a516||0xcc;return function(_0x3134f1){if(_0x3134f1){return _0x4f5ce2[_0x84df('0x1b')](_0x20a516);}return _0x4f5ce2['status'](_0x20a516)[_0x84df('0x1c')]();};}function respondWithResult(_0xf1d852,_0x1ebfcf){_0x1ebfcf=_0x1ebfcf||0xc8;return function(_0x27fa79){if(_0x27fa79){return _0xf1d852[_0x84df('0x1d')](_0x1ebfcf)[_0x84df('0x1e')](_0x27fa79);}};}function respondWithFilteredResult(_0x5b8efd,_0x311bd3){return function(_0x358c1c){if(_0x358c1c){var _0x27024c=typeof _0x311bd3[_0x84df('0x1f')]===_0x84df('0x20')&&typeof _0x311bd3['limit']===_0x84df('0x20');var _0x1129a9=_0x358c1c[_0x84df('0x21')];var _0x5c20f1=_0x27024c?0x0:_0x311bd3[_0x84df('0x1f')];var _0x3b6bcc=_0x27024c?_0x358c1c['count']:_0x311bd3['offset']+_0x311bd3['limit'];var _0x217510;if(_0x3b6bcc>=_0x1129a9){_0x3b6bcc=_0x1129a9;_0x217510=0xc8;}else{_0x217510=0xce;}_0x5b8efd[_0x84df('0x1d')](_0x217510);return _0x5b8efd[_0x84df('0x22')](_0x84df('0x23'),_0x5c20f1+'-'+_0x3b6bcc+'/'+_0x1129a9)['json'](_0x358c1c);}return null;};}function patchUpdates(_0x2d3bb9){return function(_0x5edcc6){try{jsonpatch[_0x84df('0x24')](_0x5edcc6,_0x2d3bb9,!![]);}catch(_0x15d2fc){return BPromise[_0x84df('0x25')](_0x15d2fc);}return _0x5edcc6[_0x84df('0x26')]();};}function saveUpdates(_0x275342,_0x45df14){return function(_0x4240ef){if(_0x4240ef){return _0x4240ef[_0x84df('0x27')](_0x275342)['then'](function(_0x127cf9){return _0x127cf9;});}return null;};}function removeEntity(_0x14f332,_0x2a8dbf){return function(_0x5baa2d){if(_0x5baa2d){return _0x5baa2d[_0x84df('0x28')]()[_0x84df('0x29')](function(){_0x14f332[_0x84df('0x1d')](0xcc)[_0x84df('0x1c')]();});}};}function handleEntityNotFound(_0x8b2d61,_0x41d8f3){return function(_0x40de34){if(!_0x40de34){_0x8b2d61[_0x84df('0x1b')](0x194);}return _0x40de34;};}function handleError(_0x37621a,_0x14ec83){_0x14ec83=_0x14ec83||0x1f4;return function(_0x5c9db7){logger[_0x84df('0x2a')](_0x5c9db7[_0x84df('0x2b')]);if(_0x5c9db7[_0x84df('0x2c')]){delete _0x5c9db7[_0x84df('0x2c')];}_0x37621a[_0x84df('0x1d')](_0x14ec83)['send'](_0x5c9db7);};}exports[_0x84df('0x2d')]=function(_0x155f8a,_0x5a28ed){var _0x4b5925={},_0xce423b={},_0x2d9c2={'count':0x0,'rows':[]};var _0x1e6302=_[_0x84df('0x2e')](db[_0x84df('0x2f')][_0x84df('0x30')],function(_0x218947){return{'name':_0x218947[_0x84df('0x31')],'type':_0x218947['type'][_0x84df('0x32')]};});_0xce423b[_0x84df('0x33')]=_[_0x84df('0x2e')](_0x1e6302,_0x84df('0x2c'));_0xce423b[_0x84df('0x34')]=_['keys'](_0x155f8a[_0x84df('0x34')]);_0xce423b[_0x84df('0x35')]=_[_0x84df('0x36')](_0xce423b[_0x84df('0x33')],_0xce423b['query']);_0x4b5925[_0x84df('0x37')]=_[_0x84df('0x36')](_0xce423b[_0x84df('0x33')],qs[_0x84df('0x38')](_0x155f8a[_0x84df('0x34')]['fields']));_0x4b5925[_0x84df('0x37')]=_0x4b5925[_0x84df('0x37')]['length']?_0x4b5925['attributes']:_0xce423b[_0x84df('0x33')];if(!_0x155f8a[_0x84df('0x34')][_0x84df('0x39')]('nolimit')){_0x4b5925[_0x84df('0x3a')]=qs['limit'](_0x155f8a[_0x84df('0x34')][_0x84df('0x3a')]);_0x4b5925[_0x84df('0x1f')]=qs[_0x84df('0x1f')](_0x155f8a[_0x84df('0x34')][_0x84df('0x1f')]);}_0x4b5925['order']=qs[_0x84df('0x3b')](_0x155f8a[_0x84df('0x34')][_0x84df('0x3b')]);_0x4b5925[_0x84df('0x3c')]=qs[_0x84df('0x35')](_[_0x84df('0x3d')](_0x155f8a[_0x84df('0x34')],_0xce423b[_0x84df('0x35')]),_0x1e6302);if(_0x155f8a[_0x84df('0x34')][_0x84df('0x3e')]){_0x4b5925[_0x84df('0x3c')]=_[_0x84df('0x3f')](_0x4b5925[_0x84df('0x3c')],{'$or':_['map'](_0x1e6302,function(_0x34a587){if(_0x34a587['type']!==_0x84df('0x40')){var _0x2aef7b={};_0x2aef7b[_0x34a587['name']]={'$like':'%'+_0x155f8a[_0x84df('0x34')][_0x84df('0x3e')]+'%'};return _0x2aef7b;}})});}_0x4b5925=_[_0x84df('0x3f')]({},_0x4b5925,_0x155f8a[_0x84df('0x41')]);var _0x4b261b={'where':_0x4b5925[_0x84df('0x3c')]};return db[_0x84df('0x2f')][_0x84df('0x21')](_0x4b261b)[_0x84df('0x29')](function(_0x56a8e0){_0x2d9c2[_0x84df('0x21')]=_0x56a8e0;if(_0x155f8a[_0x84df('0x34')][_0x84df('0x42')]){_0x4b5925['include']=[{'all':!![]}];}return db[_0x84df('0x2f')][_0x84df('0x43')](_0x4b5925);})['then'](function(_0x27f02c){_0x2d9c2[_0x84df('0x44')]=_0x27f02c;return _0x2d9c2;})[_0x84df('0x29')](respondWithFilteredResult(_0x5a28ed,_0x4b5925))[_0x84df('0x45')](handleError(_0x5a28ed,null));};exports['show']=function(_0x457001,_0x2af172){var _0x4802a8={'raw':!![],'where':{'id':_0x457001[_0x84df('0x46')]['id']}},_0x52c83c={};_0x52c83c['model']=_[_0x84df('0x47')](db[_0x84df('0x2f')][_0x84df('0x30')]);_0x52c83c['query']=_[_0x84df('0x47')](_0x457001[_0x84df('0x34')]);_0x52c83c[_0x84df('0x35')]=_[_0x84df('0x36')](_0x52c83c[_0x84df('0x33')],_0x52c83c[_0x84df('0x34')]);_0x4802a8[_0x84df('0x37')]=_['intersection'](_0x52c83c[_0x84df('0x33')],qs[_0x84df('0x38')](_0x457001[_0x84df('0x34')][_0x84df('0x38')]));_0x4802a8[_0x84df('0x37')]=_0x4802a8[_0x84df('0x37')][_0x84df('0x48')]?_0x4802a8[_0x84df('0x37')]:_0x52c83c['model'];if(_0x457001[_0x84df('0x34')][_0x84df('0x42')]){_0x4802a8['include']=[{'all':!![]}];}_0x4802a8=_[_0x84df('0x3f')]({},_0x4802a8,_0x457001['options']);return db['VoiceDialReport'][_0x84df('0x49')](_0x4802a8)[_0x84df('0x29')](handleEntityNotFound(_0x2af172,null))[_0x84df('0x29')](respondWithResult(_0x2af172,null))[_0x84df('0x45')](handleError(_0x2af172,null));};exports[_0x84df('0x4a')]=function(_0x314a41,_0x1e47a9){return db[_0x84df('0x2f')][_0x84df('0x4a')](_0x314a41['body'],{})[_0x84df('0x29')](respondWithResult(_0x1e47a9,0xc9))[_0x84df('0x45')](handleError(_0x1e47a9,null));};exports[_0x84df('0x27')]=function(_0x5c8696,_0x3bc194){if(_0x5c8696[_0x84df('0x4b')]['id']){delete _0x5c8696['body']['id'];}return db[_0x84df('0x2f')][_0x84df('0x49')]({'where':{'id':_0x5c8696[_0x84df('0x46')]['id']}})[_0x84df('0x29')](handleEntityNotFound(_0x3bc194,null))['then'](saveUpdates(_0x5c8696[_0x84df('0x4b')],null))['then'](respondWithResult(_0x3bc194,null))[_0x84df('0x45')](handleError(_0x3bc194,null));};exports[_0x84df('0x28')]=function(_0x32e209,_0x5d7cd2){return db[_0x84df('0x2f')][_0x84df('0x49')]({'where':{'id':_0x32e209[_0x84df('0x46')]['id']}})['then'](handleEntityNotFound(_0x5d7cd2,null))[_0x84df('0x29')](removeEntity(_0x5d7cd2,null))[_0x84df('0x45')](handleError(_0x5d7cd2,null));};exports[_0x84df('0x4c')]=function(_0x14cddc,_0xf418b6){return db['VoiceDialReport'][_0x84df('0x4c')]()[_0x84df('0x29')](respondWithResult(_0xf418b6,null))[_0x84df('0x45')](handleError(_0xf418b6,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 59777ae..f0cd3fb 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 _0x8250=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./voiceDialReport.attributes','define','report_dial'];(function(_0x388a6e,_0xb3af14){var _0x53c774=function(_0x2776ea){while(--_0x2776ea){_0x388a6e['push'](_0x388a6e['shift']());}};_0x53c774(++_0xb3af14);}(_0x8250,0xfa));var _0x0825=function(_0x2ee0e0,_0x1e0a09){_0x2ee0e0=_0x2ee0e0-0x0;var _0x4ca938=_0x8250[_0x2ee0e0];return _0x4ca938;};'use strict';var _=require(_0x0825('0x0'));var util=require(_0x0825('0x1'));var logger=require(_0x0825('0x2'))(_0x0825('0x3'));var moment=require('moment');var BPromise=require(_0x0825('0x4'));var rp=require(_0x0825('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0825('0x6'));var config=require('../../config/environment');var attributes=require(_0x0825('0x7'));module['exports']=function(_0x18733,_0x1a3bf8){return _0x18733[_0x0825('0x8')]('VoiceDialReport',attributes,{'tableName':_0x0825('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x88ac=['./voiceDialReport.attributes','define','report_dial','uniqueid','lodash','api','bluebird','request-promise','path'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x88ac,0x12d));var _0xc88a=function(_0x592eaa,_0x26d920){_0x592eaa=_0x592eaa-0x0;var _0x502849=_0x88ac[_0x592eaa];return _0x502849;};'use strict';var _=require(_0xc88a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc88a('0x1'));var moment=require('moment');var BPromise=require(_0xc88a('0x2'));var rp=require(_0xc88a('0x3'));var fs=require('fs');var path=require(_0xc88a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc88a('0x5'));module['exports']=function(_0x86cb2d,_0x47d938){return _0x86cb2d[_0xc88a('0x6')]('VoiceDialReport',attributes,{'tableName':_0xc88a('0x7'),'paranoid':![],'indexes':[{'fields':[_0xc88a('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index a6bac9e..b4c07f4 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 _0xbc78=['http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','attributes','limit','stringify','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x2628ba,_0x565f76){var _0x3666c3=function(_0x3c7279){while(--_0x3c7279){_0x2628ba['push'](_0x2628ba['shift']());}};_0x3666c3(++_0x565f76);}(_0xbc78,0xb1));var _0x8bc7=function(_0xf4caa3,_0x20107b){_0xf4caa3=_0xf4caa3-0x0;var _0x58ded2=_0xbc78[_0xf4caa3];return _0x58ded2;};'use strict';var _=require(_0x8bc7('0x0'));var util=require(_0x8bc7('0x1'));var moment=require(_0x8bc7('0x2'));var BPromise=require(_0x8bc7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8bc7('0x4'))['db'];var utils=require(_0x8bc7('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x8bc7('0x6'));var jayson=require(_0x8bc7('0x7'));var client=jayson[_0x8bc7('0x8')][_0x8bc7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8770a8,_0x9d8d4,_0xde4f05){return new BPromise(function(_0x4f40fc,_0x1a5057){return client[_0x8bc7('0xa')](_0x8770a8,_0xde4f05)[_0x8bc7('0xb')](function(_0x2ce8ab){logger[_0x8bc7('0xc')](_0x8bc7('0xd'),_0x9d8d4,_0x8bc7('0xe'));logger[_0x8bc7('0xf')](_0x8bc7('0x10'),_0x9d8d4,_0x8bc7('0xe'),JSON['stringify'](_0x2ce8ab));if(_0x2ce8ab['error']){if(_0x2ce8ab[_0x8bc7('0x11')]['code']===0x1f4){logger['error'](_0x8bc7('0xd'),_0x9d8d4,_0x2ce8ab[_0x8bc7('0x11')]['message']);return _0x1a5057(_0x2ce8ab[_0x8bc7('0x11')][_0x8bc7('0x12')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x9d8d4,_0x2ce8ab[_0x8bc7('0x11')]['message']);return _0x4f40fc(_0x2ce8ab[_0x8bc7('0x11')][_0x8bc7('0x12')]);}else{logger['info'](_0x8bc7('0xd'),_0x9d8d4,'request\x20sent');_0x4f40fc(_0x2ce8ab[_0x8bc7('0x13')]['message']);}})[_0x8bc7('0x14')](function(_0x151b8d){logger[_0x8bc7('0x11')](_0x8bc7('0xd'),_0x9d8d4,_0x151b8d);_0x1a5057(_0x151b8d);});});}exports[_0x8bc7('0x15')]=function(_0x4e66c2){var _0x565a75=this;return new Promise(function(_0x401dd1,_0x1b52ca){return db[_0x8bc7('0x16')][_0x8bc7('0x17')](_0x4e66c2[_0x8bc7('0x18')],{'raw':_0x4e66c2[_0x8bc7('0x19')]?_0x4e66c2[_0x8bc7('0x19')][_0x8bc7('0x1a')]===undefined?!![]:![]:!![]})[_0x8bc7('0xb')](function(_0x52ef57){logger[_0x8bc7('0xc')](_0x8bc7('0x15'),_0x4e66c2);logger['debug']('CreateVoiceDialReport',_0x4e66c2,JSON['stringify'](_0x52ef57));_0x401dd1(_0x52ef57);})['catch'](function(_0x3e16dc){logger[_0x8bc7('0x11')](_0x8bc7('0x15'),_0x3e16dc['message'],_0x4e66c2);_0x1b52ca(_0x565a75['error'](0x1f4,_0x3e16dc['message']));});});};exports[_0x8bc7('0x1b')]=function(_0x2880fc){var _0x1b6c27=this;return new Promise(function(_0x1df05f,_0x6ed07e){return db[_0x8bc7('0x16')]['update'](_0x2880fc[_0x8bc7('0x18')],{'raw':_0x2880fc[_0x8bc7('0x19')]?_0x2880fc[_0x8bc7('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2880fc[_0x8bc7('0x19')]?_0x2880fc[_0x8bc7('0x19')]['where']||null:null,'attributes':_0x2880fc[_0x8bc7('0x19')]?_0x2880fc[_0x8bc7('0x19')][_0x8bc7('0x1c')]||null:null,'limit':_0x2880fc[_0x8bc7('0x19')]?_0x2880fc['options'][_0x8bc7('0x1d')]||null:null})[_0x8bc7('0xb')](function(_0x37b725){logger[_0x8bc7('0xc')](_0x8bc7('0x1b'),_0x2880fc);logger['debug'](_0x8bc7('0x1b'),_0x2880fc,JSON[_0x8bc7('0x1e')](_0x37b725));_0x1df05f(_0x37b725);})[_0x8bc7('0x14')](function(_0x265db6){logger[_0x8bc7('0x11')](_0x8bc7('0x1b'),_0x265db6[_0x8bc7('0x12')],_0x2880fc);_0x6ed07e(_0x1b6c27[_0x8bc7('0x11')](0x1f4,_0x265db6[_0x8bc7('0x12')]));});});}; \ No newline at end of file +var _0x2d5d=['then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceDialReport,\x20%s,\x20%s','result','VoiceDialReport','create','body','options','raw','CreateVoiceDialReport','catch','UpdateVoiceDialReport','update','where','limit','lodash','util','randomstring','ioredis','rpc','../../config/environment','client','http'];(function(_0xbb14db,_0x3ee8c6){var _0x36bed7=function(_0x16c478){while(--_0x16c478){_0xbb14db['push'](_0xbb14db['shift']());}};_0x36bed7(++_0x3ee8c6);}(_0x2d5d,0xfd));var _0xd2d5=function(_0x2f458a,_0x44b0f0){_0x2f458a=_0x2f458a-0x0;var _0x56ac31=_0x2d5d[_0x2f458a];return _0x56ac31;};'use strict';var _=require(_0xd2d5('0x0'));var util=require(_0xd2d5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd2d5('0x2'));var fs=require('fs');var Redis=require(_0xd2d5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd2d5('0x4'));var config=require(_0xd2d5('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xd2d5('0x6')][_0xd2d5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xe90d9f,_0x414c84,_0x24cd7c){return new BPromise(function(_0x2b041c,_0x3549d1){return client['request'](_0xe90d9f,_0x24cd7c)[_0xd2d5('0x8')](function(_0x111fe1){logger[_0xd2d5('0x9')]('VoiceDialReport,\x20%s,\x20%s',_0x414c84,_0xd2d5('0xa'));logger[_0xd2d5('0xb')](_0xd2d5('0xc'),_0x414c84,_0xd2d5('0xa'),JSON[_0xd2d5('0xd')](_0x111fe1));if(_0x111fe1['error']){if(_0x111fe1[_0xd2d5('0xe')]['code']===0x1f4){logger[_0xd2d5('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x414c84,_0x111fe1[_0xd2d5('0xe')][_0xd2d5('0xf')]);return _0x3549d1(_0x111fe1[_0xd2d5('0xe')]['message']);}logger[_0xd2d5('0xe')](_0xd2d5('0x10'),_0x414c84,_0x111fe1[_0xd2d5('0xe')][_0xd2d5('0xf')]);return _0x2b041c(_0x111fe1[_0xd2d5('0xe')]['message']);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x414c84,'request\x20sent');_0x2b041c(_0x111fe1[_0xd2d5('0x11')]['message']);}})['catch'](function(_0xd37c03){logger[_0xd2d5('0xe')](_0xd2d5('0x10'),_0x414c84,_0xd37c03);_0x3549d1(_0xd37c03);});});}exports['CreateVoiceDialReport']=function(_0x4190ed){var _0x5c201d=this;return new Promise(function(_0x4d32bc,_0x1e1ec6){return db[_0xd2d5('0x12')][_0xd2d5('0x13')](_0x4190ed[_0xd2d5('0x14')],{'raw':_0x4190ed[_0xd2d5('0x15')]?_0x4190ed[_0xd2d5('0x15')][_0xd2d5('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x310b0b){logger[_0xd2d5('0x9')]('CreateVoiceDialReport',_0x4190ed);logger[_0xd2d5('0xb')](_0xd2d5('0x17'),_0x4190ed,JSON[_0xd2d5('0xd')](_0x310b0b));_0x4d32bc(_0x310b0b);})[_0xd2d5('0x18')](function(_0x34dab5){logger[_0xd2d5('0xe')](_0xd2d5('0x17'),_0x34dab5['message'],_0x4190ed);_0x1e1ec6(_0x5c201d[_0xd2d5('0xe')](0x1f4,_0x34dab5[_0xd2d5('0xf')]));});});};exports[_0xd2d5('0x19')]=function(_0xf8f588){var _0x5cc642=this;return new Promise(function(_0x37c0c6,_0x114522){return db[_0xd2d5('0x12')][_0xd2d5('0x1a')](_0xf8f588[_0xd2d5('0x14')],{'raw':_0xf8f588[_0xd2d5('0x15')]?_0xf8f588['options'][_0xd2d5('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf8f588[_0xd2d5('0x15')]?_0xf8f588[_0xd2d5('0x15')][_0xd2d5('0x1b')]||null:null,'attributes':_0xf8f588[_0xd2d5('0x15')]?_0xf8f588['options']['attributes']||null:null,'limit':_0xf8f588[_0xd2d5('0x15')]?_0xf8f588[_0xd2d5('0x15')][_0xd2d5('0x1c')]||null:null})['then'](function(_0x1b2582){logger[_0xd2d5('0x9')]('UpdateVoiceDialReport',_0xf8f588);logger[_0xd2d5('0xb')](_0xd2d5('0x19'),_0xf8f588,JSON['stringify'](_0x1b2582));_0x37c0c6(_0x1b2582);})[_0xd2d5('0x18')](function(_0x2eeb2a){logger[_0xd2d5('0xe')]('UpdateVoiceDialReport',_0x2eeb2a[_0xd2d5('0xf')],_0xf8f588);_0x114522(_0x5cc642['error'](0x1f4,_0x2eeb2a[_0xd2d5('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 11f4977..bf48d99 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 _0xdbd3=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','create','/:id/applications','addApplications','put','update','delete','exports','multer','path','connect-timeout'];(function(_0x51f28b,_0x5750b1){var _0xad39ff=function(_0x4dc9ca){while(--_0x4dc9ca){_0x51f28b['push'](_0x51f28b['shift']());}};_0xad39ff(++_0x5750b1);}(_0xdbd3,0x123));var _0x3dbd=function(_0x51ab83,_0x2721b9){_0x51ab83=_0x51ab83-0x0;var _0x14b6de=_0xdbd3[_0x51ab83];return _0x14b6de;};'use strict';var multer=require(_0x3dbd('0x0'));var util=require('util');var path=require(_0x3dbd('0x1'));var timeout=require(_0x3dbd('0x2'));var express=require(_0x3dbd('0x3'));var router=express[_0x3dbd('0x4')]();var fs_extra=require(_0x3dbd('0x5'));var auth=require(_0x3dbd('0x6'));var interaction=require(_0x3dbd('0x7'));var config=require(_0x3dbd('0x8'));var controller=require(_0x3dbd('0x9'));router[_0x3dbd('0xa')]('/',auth[_0x3dbd('0xb')](),controller[_0x3dbd('0xc')]);router[_0x3dbd('0xa')](_0x3dbd('0xd'),auth[_0x3dbd('0xb')](),controller['show']);router['post']('/',auth[_0x3dbd('0xb')](),controller[_0x3dbd('0xe')]);router['post'](_0x3dbd('0xf'),auth['isAuthenticated'](),controller[_0x3dbd('0x10')]);router[_0x3dbd('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x3dbd('0x12')]);router[_0x3dbd('0x13')](_0x3dbd('0xd'),auth[_0x3dbd('0xb')](),controller['destroy']);module[_0x3dbd('0x14')]=router; \ No newline at end of file +var _0xa4b2=['destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','/:id','show','post','create','/:id/applications','put','update','delete'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xa4b2,0x79));var _0x2a4b=function(_0x2f8c42,_0x2ba36d){_0x2f8c42=_0x2f8c42-0x0;var _0x500823=_0xa4b2[_0x2f8c42];return _0x500823;};'use strict';var multer=require(_0x2a4b('0x0'));var util=require(_0x2a4b('0x1'));var path=require(_0x2a4b('0x2'));var timeout=require(_0x2a4b('0x3'));var express=require(_0x2a4b('0x4'));var router=express[_0x2a4b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2a4b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2a4b('0x7'));var controller=require(_0x2a4b('0x8'));router[_0x2a4b('0x9')]('/',auth[_0x2a4b('0xa')](),controller['index']);router[_0x2a4b('0x9')](_0x2a4b('0xb'),auth[_0x2a4b('0xa')](),controller[_0x2a4b('0xc')]);router[_0x2a4b('0xd')]('/',auth[_0x2a4b('0xa')](),controller[_0x2a4b('0xe')]);router[_0x2a4b('0xd')](_0x2a4b('0xf'),auth[_0x2a4b('0xa')](),controller['addApplications']);router[_0x2a4b('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x2a4b('0x11')]);router[_0x2a4b('0x12')](_0x2a4b('0xb'),auth[_0x2a4b('0xa')](),controller[_0x2a4b('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 1236abc..fcc2bcc 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 _0xef13=['map','VoiceExtension','rawAttributes','fieldName','key','model','keys','filters','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','intersection','catch','destroy','create','body','startsWith','exten','concat','user','get','role','InboundRoutes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','recordingFormat','cutdigits','mandatoryDisposition','alias','context','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','then','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','value','type','find','name','UserProfileResource','error','send','index'];(function(_0x3e7ff2,_0x2627cd){var _0x1266da=function(_0x16b7cb){while(--_0x16b7cb){_0x3e7ff2['push'](_0x3e7ff2['shift']());}};_0x1266da(++_0x2627cd);}(_0xef13,0x15b));var _0x3ef1=function(_0x55f3f8,_0x4354c3){_0x55f3f8=_0x55f3f8-0x0;var _0x28bbc9=_0xef13[_0x55f3f8];return _0x28bbc9;};'use strict';var _=require(_0x3ef1('0x0'));var Redis=require(_0x3ef1('0x1'));var qs=require(_0x3ef1('0x2'));var logger=require(_0x3ef1('0x3'))(_0x3ef1('0x4'));var config=require(_0x3ef1('0x5'));var db=require(_0x3ef1('0x6'))['db'];config['redis']=_[_0x3ef1('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3ef1('0x8'))(new Redis(config[_0x3ef1('0x9')]));require(_0x3ef1('0xa'))[_0x3ef1('0xb')](socket);function respondWithStatusCode(_0x141084,_0x504403){_0x504403=_0x504403||0xcc;return function(_0x38f227){if(_0x38f227){return _0x141084[_0x3ef1('0xc')](_0x504403);}return _0x141084[_0x3ef1('0xd')](_0x504403)[_0x3ef1('0xe')]();};}function respondWithResult(_0x469ff8,_0x206052){_0x206052=_0x206052||0xc8;return function(_0x51455c){if(_0x51455c){return _0x469ff8['status'](_0x206052)[_0x3ef1('0xf')](_0x51455c);}};}function respondWithFilteredResult(_0x305e67,_0x559ee2){return function(_0x5aeafc){if(_0x5aeafc){var _0x25fd33=typeof _0x559ee2[_0x3ef1('0x10')]===_0x3ef1('0x11')&&typeof _0x559ee2[_0x3ef1('0x12')]==='undefined';var _0x62c3bc=_0x5aeafc[_0x3ef1('0x13')];var _0x5101ea=_0x25fd33?0x0:_0x559ee2['offset'];var _0x48fc92=_0x25fd33?_0x5aeafc['count']:_0x559ee2[_0x3ef1('0x10')]+_0x559ee2[_0x3ef1('0x12')];var _0xf817f5;if(_0x48fc92>=_0x62c3bc){_0x48fc92=_0x62c3bc;_0xf817f5=0xc8;}else{_0xf817f5=0xce;}_0x305e67[_0x3ef1('0xd')](_0xf817f5);return _0x305e67['set'](_0x3ef1('0x14'),_0x5101ea+'-'+_0x48fc92+'/'+_0x62c3bc)[_0x3ef1('0xf')](_0x5aeafc);}return null;};}function removeEntity(_0x312da3){return function(_0x208316){if(_0x208316){return _0x208316['destroy']()[_0x3ef1('0x15')](function(){var _0x1cf6d3=_0x208316['get']({'plain':!![]});var _0x3ea1bd=[{'name':'InboundRoutes','value':_0x3ef1('0x16'),'ignore':![]},{'name':_0x3ef1('0x17'),'value':_0x3ef1('0x18'),'ignore':![]},{'name':_0x3ef1('0x19'),'value':_0x3ef1('0x1a'),'ignore':![]}];var _0x268b7c=_(_0x3ea1bd)[_0x3ef1('0x1b')](_0x3ef1('0x1c'))['map'](_0x3ef1('0x1d'))[_0x3ef1('0x1d')]();if(_['includes'](_0x268b7c,_0x1cf6d3[_0x3ef1('0x1e')])){return;}var _0x58cbb5=_[_0x3ef1('0x1f')](_0x3ea1bd,[_0x3ef1('0x1d'),_0x1cf6d3[_0x3ef1('0x1e')]])[_0x3ef1('0x20')];return db[_0x3ef1('0x21')]['destroy']({'where':{'type':_0x58cbb5,'resourceId':_0x1cf6d3['id']}})[_0x3ef1('0x15')](function(){return _0x208316;});})[_0x3ef1('0x15')](function(){_0x312da3['status'](0xcc)[_0x3ef1('0xe')]();});}};}function handleEntityNotFound(_0x1eb102){return function(_0x3560a2){if(!_0x3560a2){_0x1eb102[_0x3ef1('0xc')](0x194);}return _0x3560a2;};}function handleError(_0x16419f,_0x47e271){_0x47e271=_0x47e271||0x1f4;return function(_0x291262){logger[_0x3ef1('0x22')](_0x291262['stack']);if(_0x291262[_0x3ef1('0x20')]){delete _0x291262[_0x3ef1('0x20')];}_0x16419f['status'](_0x47e271)[_0x3ef1('0x23')](_0x291262);};}exports[_0x3ef1('0x24')]=function(_0x1aa9e1,_0x40be37){var _0x565b01={},_0x3ba05f={},_0x40a38f={'count':0x0,'rows':[]};var _0x1e8aca=_[_0x3ef1('0x25')](db[_0x3ef1('0x26')][_0x3ef1('0x27')],function(_0x241df2){return{'name':_0x241df2[_0x3ef1('0x28')],'type':_0x241df2[_0x3ef1('0x1e')][_0x3ef1('0x29')]};});_0x3ba05f[_0x3ef1('0x2a')]=_[_0x3ef1('0x25')](_0x1e8aca,'name');_0x3ba05f['query']=_[_0x3ef1('0x2b')](_0x1aa9e1['query']);_0x3ba05f[_0x3ef1('0x2c')]=_['intersection'](_0x3ba05f['model'],_0x3ba05f['query']);_0x565b01[_0x3ef1('0x2d')]=_['intersection'](_0x3ba05f[_0x3ef1('0x2a')],qs[_0x3ef1('0x2e')](_0x1aa9e1[_0x3ef1('0x2f')][_0x3ef1('0x2e')]));_0x565b01[_0x3ef1('0x2d')]=_0x565b01['attributes'][_0x3ef1('0x30')]?_0x565b01[_0x3ef1('0x2d')]:_0x3ba05f['model'];if(!_0x1aa9e1[_0x3ef1('0x2f')][_0x3ef1('0x31')](_0x3ef1('0x32'))){_0x565b01[_0x3ef1('0x12')]=qs['limit'](_0x1aa9e1[_0x3ef1('0x2f')]['limit']);_0x565b01[_0x3ef1('0x10')]=qs[_0x3ef1('0x10')](_0x1aa9e1[_0x3ef1('0x2f')]['offset']);}_0x565b01[_0x3ef1('0x33')]=qs[_0x3ef1('0x34')](_0x1aa9e1[_0x3ef1('0x2f')][_0x3ef1('0x34')]);_0x565b01[_0x3ef1('0x35')]=qs[_0x3ef1('0x2c')](_['pick'](_0x1aa9e1[_0x3ef1('0x2f')],_0x3ba05f[_0x3ef1('0x2c')]),_0x1e8aca);if(_0x1aa9e1[_0x3ef1('0x2f')][_0x3ef1('0x1b')]){_0x565b01[_0x3ef1('0x35')]=_[_0x3ef1('0x36')](_0x565b01[_0x3ef1('0x35')],{'$or':_[_0x3ef1('0x25')](_0x1e8aca,function(_0x16794e){if(_0x16794e[_0x3ef1('0x1e')]!==_0x3ef1('0x37')){var _0xd7ff12={};_0xd7ff12[_0x16794e[_0x3ef1('0x20')]]={'$like':'%'+_0x1aa9e1[_0x3ef1('0x2f')]['filter']+'%'};return _0xd7ff12;}})});}_0x565b01=_[_0x3ef1('0x36')]({},_0x565b01,_0x1aa9e1[_0x3ef1('0x38')]);var _0x5d4bdc={'where':_0x565b01['where']};return db[_0x3ef1('0x26')][_0x3ef1('0x13')](_0x5d4bdc)['then'](function(_0x587415){_0x40a38f[_0x3ef1('0x13')]=_0x587415;if(_0x1aa9e1[_0x3ef1('0x2f')][_0x3ef1('0x39')]){_0x565b01[_0x3ef1('0x3a')]=[{'all':!![]}];}return db['VoiceExtension']['findAll'](_0x565b01);})[_0x3ef1('0x15')](function(_0x144de5){_0x40a38f[_0x3ef1('0x3b')]=_0x144de5;return _0x40a38f;})[_0x3ef1('0x15')](respondWithFilteredResult(_0x40be37,_0x565b01))['catch'](handleError(_0x40be37,null));};exports[_0x3ef1('0x3c')]=function(_0xd1800e,_0x25fa1d){var _0x5c61c2={'raw':![],'where':{'id':_0xd1800e[_0x3ef1('0x3d')]['id']}},_0x27b7cc={};_0x27b7cc[_0x3ef1('0x2a')]=_['keys'](db['VoiceExtension'][_0x3ef1('0x27')]);_0x27b7cc['query']=_['keys'](_0xd1800e[_0x3ef1('0x2f')]);_0x27b7cc[_0x3ef1('0x2c')]=_[_0x3ef1('0x3e')](_0x27b7cc['model'],_0x27b7cc[_0x3ef1('0x2f')]);_0x5c61c2[_0x3ef1('0x2d')]=_[_0x3ef1('0x3e')](_0x27b7cc[_0x3ef1('0x2a')],qs[_0x3ef1('0x2e')](_0xd1800e[_0x3ef1('0x2f')][_0x3ef1('0x2e')]));_0x5c61c2[_0x3ef1('0x2d')]=_0x5c61c2[_0x3ef1('0x2d')][_0x3ef1('0x30')]?_0x5c61c2[_0x3ef1('0x2d')]:_0x27b7cc['model'];if(_0xd1800e[_0x3ef1('0x2f')][_0x3ef1('0x39')]){_0x5c61c2[_0x3ef1('0x3a')]=[{'all':!![]}];}_0x5c61c2=_[_0x3ef1('0x36')]({},_0x5c61c2,_0xd1800e['options']);return db[_0x3ef1('0x26')][_0x3ef1('0x1f')](_0x5c61c2)[_0x3ef1('0x15')](handleEntityNotFound(_0x25fa1d,null))[_0x3ef1('0x15')](respondWithResult(_0x25fa1d,null))[_0x3ef1('0x3f')](handleError(_0x25fa1d,null));};exports[_0x3ef1('0x40')]=function(_0x47bcba,_0x4732af){return db[_0x3ef1('0x26')][_0x3ef1('0x1f')]({'where':{'id':_0x47bcba['params']['id']}})[_0x3ef1('0x15')](handleEntityNotFound(_0x4732af,null))['then'](removeEntity(_0x4732af,null))['catch'](handleError(_0x4732af,null));};exports[_0x3ef1('0x41')]=function(_0x196b59,_0x4d7508){if(_0x196b59[_0x3ef1('0x42')][_0x3ef1('0x1e')]===_0x3ef1('0x18')&&!_[_0x3ef1('0x43')](_0x196b59[_0x3ef1('0x42')][_0x3ef1('0x44')],'_')){_0x196b59[_0x3ef1('0x42')][_0x3ef1('0x44')]='_'[_0x3ef1('0x45')](_0x196b59[_0x3ef1('0x42')][_0x3ef1('0x44')]);}return db[_0x3ef1('0x26')][_0x3ef1('0x41')](_0x196b59[_0x3ef1('0x42')],{'raw':![]})[_0x3ef1('0x15')](function(_0x5b23a0){var _0x2f47d3=_0x196b59[_0x3ef1('0x46')][_0x3ef1('0x47')]({'plain':!![]});if(!_0x2f47d3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f47d3[_0x3ef1('0x48')]===_0x3ef1('0x46')){var _0x5f5710=_0x5b23a0['get']({'plain':!![]});var _0x58346c=[{'name':_0x3ef1('0x49'),'value':'inbound'},{'name':_0x3ef1('0x17'),'value':_0x3ef1('0x18')},{'name':_0x3ef1('0x19'),'value':_0x3ef1('0x1a')}];var _0x3ccb08=_[_0x3ef1('0x1f')](_0x58346c,[_0x3ef1('0x1d'),_0x5f5710[_0x3ef1('0x1e')]])[_0x3ef1('0x20')];return db['UserProfileSection'][_0x3ef1('0x1f')]({'where':{'name':_0x3ccb08,'userProfileId':_0x2f47d3[_0x3ef1('0x4a')]},'raw':!![]})[_0x3ef1('0x15')](function(_0x4f3b33){if(_0x4f3b33&&_0x4f3b33[_0x3ef1('0x4b')]===0x0){return db[_0x3ef1('0x21')][_0x3ef1('0x41')]({'name':_0x5f5710[_0x3ef1('0x20')],'resourceId':_0x5f5710['id'],'type':_0x4f3b33[_0x3ef1('0x20')],'sectionId':_0x4f3b33['id']},{})[_0x3ef1('0x15')](function(){return _0x5b23a0;});}else{return _0x5b23a0;}})[_0x3ef1('0x3f')](function(_0x2168f1){logger[_0x3ef1('0x22')](_0x3ef1('0x4c'),_0x2168f1);throw _0x2168f1;});}return _0x5b23a0;})[_0x3ef1('0x15')](respondWithResult(_0x4d7508,0xc9))[_0x3ef1('0x3f')](handleError(_0x4d7508,null));};exports[_0x3ef1('0x4d')]=function(_0x3212f9,_0x101991){if(_0x3212f9[_0x3ef1('0x42')]['id']){delete _0x3212f9[_0x3ef1('0x42')]['id'];}return db[_0x3ef1('0x26')][_0x3ef1('0x1f')]({'where':{'id':_0x3212f9[_0x3ef1('0x3d')]['id']}})[_0x3ef1('0x15')](handleEntityNotFound(_0x101991,null))[_0x3ef1('0x15')](function(_0x4243f6){if(_0x4243f6){return db[_0x3ef1('0x26')][_0x3ef1('0x4d')](_[_0x3ef1('0x4e')](_0x3212f9[_0x3ef1('0x42')],[_0x3ef1('0x44'),'context','description',_0x3ef1('0x4f'),_0x3ef1('0x50'),_0x3ef1('0x51'),_0x3ef1('0x52')]),{'where':{'context':_0x4243f6[_0x3ef1('0x53')],'exten':_0x4243f6[_0x3ef1('0x44')]},'individualHooks':!![]})[_0x3ef1('0x15')](function(_0x46539d){return _0x46539d;});}return null;})[_0x3ef1('0x15')](respondWithStatusCode(_0x101991,null))[_0x3ef1('0x3f')](handleError(_0x101991,null));};exports['addApplications']=function(_0x2cce70,_0x19ee72){var _0x92397d=_0x2cce70['params']['id'];var _0x5f3d49=_0x2cce70[_0x3ef1('0x42')];var _0x10559b=0xc8;var _0xdd64c8=null;return db[_0x3ef1('0x54')]['transaction']({'isolationLevel':db[_0x3ef1('0x54')][_0x3ef1('0x55')][_0x3ef1('0x56')][_0x3ef1('0x57')]},function(_0x2f15a7){return db[_0x3ef1('0x26')][_0x3ef1('0x58')]({'where':{'id':_0x92397d},'transaction':_0x2f15a7})[_0x3ef1('0x15')](function(_0x56af3f){if(_0x56af3f){return db[_0x3ef1('0x26')][_0x3ef1('0x40')]({'where':{'VoiceExtensionId':_0x92397d},'transaction':_0x2f15a7})[_0x3ef1('0x15')](function(){var _0x3d83b8=_[_0x3ef1('0x25')](_0x5f3d49,function(_0x4ae22f){_0x4ae22f[_0x3ef1('0x59')]=_0x92397d;_0x4ae22f[_0x3ef1('0x5a')]=!![];return _0x4ae22f;});return _0x56af3f['createRouting'](_0x3d83b8);})[_0x3ef1('0x15')](function(_0x2df7c9){return db[_0x3ef1('0x26')][_0x3ef1('0x5b')](_0x2df7c9,{'transaction':_0x2f15a7});});}else{_0x10559b=0x194;_0xdd64c8=[];}});})[_0x3ef1('0x15')](function(){if(_0x10559b!==0x194){return db[_0x3ef1('0x26')][_0x3ef1('0x5c')]({'where':{'isApp':!![],'VoiceExtensionId':_0x92397d},'order':_0x3ef1('0x5d')})[_0x3ef1('0x15')](function(_0x2687fa){_0xdd64c8=_0x2687fa;});}})[_0x3ef1('0x3f')](function(_0x200140){_0x10559b=0x1f4;logger[_0x3ef1('0x22')](_0x200140[_0x3ef1('0x5e')]);if(_0x200140[_0x3ef1('0x20')]){delete _0x200140[_0x3ef1('0x20')];}_0xdd64c8=_0x200140;})[_0x3ef1('0x5f')](function(){if(_0xdd64c8===null){_0x19ee72[_0x3ef1('0xc')](_0x10559b);}else{if(_0x10559b===0x1f4){_0x19ee72[_0x3ef1('0xd')](_0x10559b)[_0x3ef1('0x23')](_0xdd64c8);}else{_0x19ee72[_0x3ef1('0xd')](_0x10559b)[_0x3ef1('0xf')](_0xdd64c8);}}});}; \ No newline at end of file +var _0xeba1=['role','internal','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','register','end','status','json','offset','undefined','limit','count','set','destroy','InboundRoutes','inbound','outbound','InternalRoutes','filter','ignore','value','includes','type','name','UserProfileResource','then','sendStatus','send','map','VoiceExtension','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','merge','options','includeAll','include','findAll','rows','catch','show','find','params','create','body','exten','concat','user','get'];(function(_0x35e6b0,_0x42a3c9){var _0x561f06=function(_0x265fda){while(--_0x265fda){_0x35e6b0['push'](_0x35e6b0['shift']());}};_0x561f06(++_0x42a3c9);}(_0xeba1,0x187));var _0x1eba=function(_0x3cc47c,_0x1e59e2){_0x3cc47c=_0x3cc47c-0x0;var _0x1fe90f=_0xeba1[_0x3cc47c];return _0x1fe90f;};'use strict';var _=require(_0x1eba('0x0'));var Redis=require(_0x1eba('0x1'));var qs=require(_0x1eba('0x2'));var logger=require(_0x1eba('0x3'))(_0x1eba('0x4'));var config=require(_0x1eba('0x5'));var db=require(_0x1eba('0x6'))['db'];config[_0x1eba('0x7')]=_[_0x1eba('0x8')](config['redis'],{'host':_0x1eba('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1eba('0x7')]));require(_0x1eba('0xa'))[_0x1eba('0xb')](socket);function respondWithStatusCode(_0x351837,_0x8fa56d){_0x8fa56d=_0x8fa56d||0xcc;return function(_0x242bfb){if(_0x242bfb){return _0x351837['sendStatus'](_0x8fa56d);}return _0x351837['status'](_0x8fa56d)[_0x1eba('0xc')]();};}function respondWithResult(_0x3660bb,_0x217dc5){_0x217dc5=_0x217dc5||0xc8;return function(_0x33bddc){if(_0x33bddc){return _0x3660bb[_0x1eba('0xd')](_0x217dc5)[_0x1eba('0xe')](_0x33bddc);}};}function respondWithFilteredResult(_0x5e4c05,_0x128cd1){return function(_0x28e29b){if(_0x28e29b){var _0x2d0dfc=typeof _0x128cd1[_0x1eba('0xf')]===_0x1eba('0x10')&&typeof _0x128cd1[_0x1eba('0x11')]===_0x1eba('0x10');var _0x366078=_0x28e29b[_0x1eba('0x12')];var _0xfd865e=_0x2d0dfc?0x0:_0x128cd1[_0x1eba('0xf')];var _0x110e8b=_0x2d0dfc?_0x28e29b[_0x1eba('0x12')]:_0x128cd1[_0x1eba('0xf')]+_0x128cd1[_0x1eba('0x11')];var _0x5cc387;if(_0x110e8b>=_0x366078){_0x110e8b=_0x366078;_0x5cc387=0xc8;}else{_0x5cc387=0xce;}_0x5e4c05['status'](_0x5cc387);return _0x5e4c05[_0x1eba('0x13')]('Content-Range',_0xfd865e+'-'+_0x110e8b+'/'+_0x366078)[_0x1eba('0xe')](_0x28e29b);}return null;};}function removeEntity(_0x22e5f4){return function(_0x2ec3c2){if(_0x2ec3c2){return _0x2ec3c2[_0x1eba('0x14')]()['then'](function(){var _0x14b411=_0x2ec3c2['get']({'plain':!![]});var _0x4fce05=[{'name':_0x1eba('0x15'),'value':_0x1eba('0x16'),'ignore':![]},{'name':'OutboundRoutes','value':_0x1eba('0x17'),'ignore':![]},{'name':_0x1eba('0x18'),'value':'internal','ignore':![]}];var _0xcf4a87=_(_0x4fce05)[_0x1eba('0x19')](_0x1eba('0x1a'))['map'](_0x1eba('0x1b'))['value']();if(_[_0x1eba('0x1c')](_0xcf4a87,_0x14b411['type'])){return;}var _0xb901c8=_['find'](_0x4fce05,['value',_0x14b411[_0x1eba('0x1d')]])[_0x1eba('0x1e')];return db[_0x1eba('0x1f')][_0x1eba('0x14')]({'where':{'type':_0xb901c8,'resourceId':_0x14b411['id']}})[_0x1eba('0x20')](function(){return _0x2ec3c2;});})[_0x1eba('0x20')](function(){_0x22e5f4['status'](0xcc)[_0x1eba('0xc')]();});}};}function handleEntityNotFound(_0x517f71){return function(_0xa58b4b){if(!_0xa58b4b){_0x517f71[_0x1eba('0x21')](0x194);}return _0xa58b4b;};}function handleError(_0x125a92,_0x5535fb){_0x5535fb=_0x5535fb||0x1f4;return function(_0x5ae886){logger['error'](_0x5ae886['stack']);if(_0x5ae886['name']){delete _0x5ae886[_0x1eba('0x1e')];}_0x125a92[_0x1eba('0xd')](_0x5535fb)[_0x1eba('0x22')](_0x5ae886);};}exports['index']=function(_0x5d9097,_0x39f0cd){var _0x82afc3={},_0x139a2f={},_0x3ffc5b={'count':0x0,'rows':[]};var _0x31c0c3=_[_0x1eba('0x23')](db[_0x1eba('0x24')][_0x1eba('0x25')],function(_0x14035d){return{'name':_0x14035d[_0x1eba('0x26')],'type':_0x14035d[_0x1eba('0x1d')][_0x1eba('0x27')]};});_0x139a2f[_0x1eba('0x28')]=_['map'](_0x31c0c3,_0x1eba('0x1e'));_0x139a2f['query']=_[_0x1eba('0x29')](_0x5d9097[_0x1eba('0x2a')]);_0x139a2f[_0x1eba('0x2b')]=_[_0x1eba('0x2c')](_0x139a2f[_0x1eba('0x28')],_0x139a2f[_0x1eba('0x2a')]);_0x82afc3['attributes']=_[_0x1eba('0x2c')](_0x139a2f['model'],qs[_0x1eba('0x2d')](_0x5d9097['query'][_0x1eba('0x2d')]));_0x82afc3['attributes']=_0x82afc3[_0x1eba('0x2e')][_0x1eba('0x2f')]?_0x82afc3[_0x1eba('0x2e')]:_0x139a2f[_0x1eba('0x28')];if(!_0x5d9097[_0x1eba('0x2a')][_0x1eba('0x30')](_0x1eba('0x31'))){_0x82afc3[_0x1eba('0x11')]=qs[_0x1eba('0x11')](_0x5d9097[_0x1eba('0x2a')]['limit']);_0x82afc3[_0x1eba('0xf')]=qs[_0x1eba('0xf')](_0x5d9097['query'][_0x1eba('0xf')]);}_0x82afc3[_0x1eba('0x32')]=qs['sort'](_0x5d9097['query']['sort']);_0x82afc3[_0x1eba('0x33')]=qs[_0x1eba('0x2b')](_[_0x1eba('0x34')](_0x5d9097[_0x1eba('0x2a')],_0x139a2f[_0x1eba('0x2b')]),_0x31c0c3);if(_0x5d9097['query'][_0x1eba('0x19')]){_0x82afc3[_0x1eba('0x33')]=_['merge'](_0x82afc3['where'],{'$or':_['map'](_0x31c0c3,function(_0x559596){if(_0x559596[_0x1eba('0x1d')]!=='VIRTUAL'){var _0x476793={};_0x476793[_0x559596['name']]={'$like':'%'+_0x5d9097[_0x1eba('0x2a')][_0x1eba('0x19')]+'%'};return _0x476793;}})});}_0x82afc3=_[_0x1eba('0x35')]({},_0x82afc3,_0x5d9097[_0x1eba('0x36')]);var _0x2f428f={'where':_0x82afc3[_0x1eba('0x33')]};return db[_0x1eba('0x24')][_0x1eba('0x12')](_0x2f428f)['then'](function(_0x594cc8){_0x3ffc5b[_0x1eba('0x12')]=_0x594cc8;if(_0x5d9097[_0x1eba('0x2a')][_0x1eba('0x37')]){_0x82afc3[_0x1eba('0x38')]=[{'all':!![]}];}return db[_0x1eba('0x24')][_0x1eba('0x39')](_0x82afc3);})[_0x1eba('0x20')](function(_0x3ee605){_0x3ffc5b[_0x1eba('0x3a')]=_0x3ee605;return _0x3ffc5b;})[_0x1eba('0x20')](respondWithFilteredResult(_0x39f0cd,_0x82afc3))[_0x1eba('0x3b')](handleError(_0x39f0cd,null));};exports[_0x1eba('0x3c')]=function(_0x2b925b,_0x5ef2b3){var _0xca8424={'raw':![],'where':{'id':_0x2b925b['params']['id']}},_0x5e6987={};_0x5e6987[_0x1eba('0x28')]=_['keys'](db[_0x1eba('0x24')]['rawAttributes']);_0x5e6987['query']=_[_0x1eba('0x29')](_0x2b925b[_0x1eba('0x2a')]);_0x5e6987[_0x1eba('0x2b')]=_[_0x1eba('0x2c')](_0x5e6987[_0x1eba('0x28')],_0x5e6987[_0x1eba('0x2a')]);_0xca8424['attributes']=_[_0x1eba('0x2c')](_0x5e6987[_0x1eba('0x28')],qs[_0x1eba('0x2d')](_0x2b925b[_0x1eba('0x2a')][_0x1eba('0x2d')]));_0xca8424['attributes']=_0xca8424[_0x1eba('0x2e')][_0x1eba('0x2f')]?_0xca8424[_0x1eba('0x2e')]:_0x5e6987[_0x1eba('0x28')];if(_0x2b925b['query'][_0x1eba('0x37')]){_0xca8424[_0x1eba('0x38')]=[{'all':!![]}];}_0xca8424=_[_0x1eba('0x35')]({},_0xca8424,_0x2b925b[_0x1eba('0x36')]);return db[_0x1eba('0x24')]['find'](_0xca8424)[_0x1eba('0x20')](handleEntityNotFound(_0x5ef2b3,null))[_0x1eba('0x20')](respondWithResult(_0x5ef2b3,null))[_0x1eba('0x3b')](handleError(_0x5ef2b3,null));};exports['destroy']=function(_0x26da94,_0xfbf3ae){return db[_0x1eba('0x24')][_0x1eba('0x3d')]({'where':{'id':_0x26da94[_0x1eba('0x3e')]['id']}})[_0x1eba('0x20')](handleEntityNotFound(_0xfbf3ae,null))[_0x1eba('0x20')](removeEntity(_0xfbf3ae,null))[_0x1eba('0x3b')](handleError(_0xfbf3ae,null));};exports[_0x1eba('0x3f')]=function(_0x27a83b,_0x318bec){if(_0x27a83b[_0x1eba('0x40')]['type']===_0x1eba('0x17')&&!_['startsWith'](_0x27a83b['body'][_0x1eba('0x41')],'_')){_0x27a83b[_0x1eba('0x40')][_0x1eba('0x41')]='_'[_0x1eba('0x42')](_0x27a83b[_0x1eba('0x40')][_0x1eba('0x41')]);}return db[_0x1eba('0x24')]['create'](_0x27a83b[_0x1eba('0x40')],{'raw':![]})[_0x1eba('0x20')](function(_0x47d3ba){var _0x3b5398=_0x27a83b[_0x1eba('0x43')][_0x1eba('0x44')]({'plain':!![]});if(!_0x3b5398)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b5398[_0x1eba('0x45')]===_0x1eba('0x43')){var _0x57a4da=_0x47d3ba[_0x1eba('0x44')]({'plain':!![]});var _0x485db9=[{'name':_0x1eba('0x15'),'value':_0x1eba('0x16')},{'name':'OutboundRoutes','value':'outbound'},{'name':_0x1eba('0x18'),'value':_0x1eba('0x46')}];var _0x345ac3=_[_0x1eba('0x3d')](_0x485db9,[_0x1eba('0x1b'),_0x57a4da['type']])[_0x1eba('0x1e')];return db['UserProfileSection'][_0x1eba('0x3d')]({'where':{'name':_0x345ac3,'userProfileId':_0x3b5398[_0x1eba('0x47')]},'raw':!![]})[_0x1eba('0x20')](function(_0x54c3f3){if(_0x54c3f3&&_0x54c3f3[_0x1eba('0x48')]===0x0){return db[_0x1eba('0x1f')]['create']({'name':_0x57a4da[_0x1eba('0x1e')],'resourceId':_0x57a4da['id'],'type':_0x54c3f3[_0x1eba('0x1e')],'sectionId':_0x54c3f3['id']},{})['then'](function(){return _0x47d3ba;});}else{return _0x47d3ba;}})[_0x1eba('0x3b')](function(_0x2073d1){logger[_0x1eba('0x49')](_0x1eba('0x4a'),_0x2073d1);throw _0x2073d1;});}return _0x47d3ba;})[_0x1eba('0x20')](respondWithResult(_0x318bec,0xc9))['catch'](handleError(_0x318bec,null));};exports[_0x1eba('0x4b')]=function(_0x29e87f,_0x30ab35){if(_0x29e87f[_0x1eba('0x40')]['id']){delete _0x29e87f[_0x1eba('0x40')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x29e87f[_0x1eba('0x3e')]['id']}})['then'](handleEntityNotFound(_0x30ab35,null))[_0x1eba('0x20')](function(_0x4cafe1){if(_0x4cafe1){return db['VoiceExtension'][_0x1eba('0x4b')](_[_0x1eba('0x34')](_0x29e87f[_0x1eba('0x40')],[_0x1eba('0x41'),_0x1eba('0x4c'),_0x1eba('0x4d'),'recordingFormat','cutdigits','mandatoryDisposition',_0x1eba('0x4e')]),{'where':{'context':_0x4cafe1['context'],'exten':_0x4cafe1[_0x1eba('0x41')]},'individualHooks':!![]})['then'](function(_0x514222){return _0x514222;});}return null;})[_0x1eba('0x20')](respondWithStatusCode(_0x30ab35,null))[_0x1eba('0x3b')](handleError(_0x30ab35,null));};exports[_0x1eba('0x4f')]=function(_0x2827eb,_0x2ffcad){var _0x5e08b4=_0x2827eb[_0x1eba('0x3e')]['id'];var _0x7899b3=_0x2827eb[_0x1eba('0x40')];var _0x46cbd5=0xc8;var _0x1dbd86=null;return db[_0x1eba('0x50')][_0x1eba('0x51')]({'isolationLevel':db['sequelize'][_0x1eba('0x52')][_0x1eba('0x53')][_0x1eba('0x54')]},function(_0x624e44){return db[_0x1eba('0x24')][_0x1eba('0x55')]({'where':{'id':_0x5e08b4},'transaction':_0x624e44})[_0x1eba('0x20')](function(_0x53f323){if(_0x53f323){return db[_0x1eba('0x24')][_0x1eba('0x14')]({'where':{'VoiceExtensionId':_0x5e08b4},'transaction':_0x624e44})['then'](function(){var _0x42c117=_[_0x1eba('0x23')](_0x7899b3,function(_0x3002ac){_0x3002ac['VoiceExtensionId']=_0x5e08b4;_0x3002ac[_0x1eba('0x56')]=!![];return _0x3002ac;});return _0x53f323['createRouting'](_0x42c117);})['then'](function(_0x370dc){return db['VoiceExtension'][_0x1eba('0x57')](_0x370dc,{'transaction':_0x624e44});});}else{_0x46cbd5=0x194;_0x1dbd86=[];}});})['then'](function(){if(_0x46cbd5!==0x194){return db[_0x1eba('0x24')][_0x1eba('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5e08b4},'order':_0x1eba('0x59')})[_0x1eba('0x20')](function(_0x21a68a){_0x1dbd86=_0x21a68a;});}})[_0x1eba('0x3b')](function(_0x54c38e){_0x46cbd5=0x1f4;logger[_0x1eba('0x49')](_0x54c38e[_0x1eba('0x5a')]);if(_0x54c38e[_0x1eba('0x1e')]){delete _0x54c38e[_0x1eba('0x1e')];}_0x1dbd86=_0x54c38e;})[_0x1eba('0x5b')](function(){if(_0x1dbd86===null){_0x2ffcad[_0x1eba('0x21')](_0x46cbd5);}else{if(_0x46cbd5===0x1f4){_0x2ffcad[_0x1eba('0xd')](_0x46cbd5)[_0x1eba('0x22')](_0x1dbd86);}else{_0x2ffcad[_0x1eba('0xd')](_0x46cbd5)['json'](_0x1dbd86);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index dacab8d..f35dc78 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 _0x1e56=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0xf4666e,_0x571140){var _0x1853f1=function(_0x5160a5){while(--_0x5160a5){_0xf4666e['push'](_0xf4666e['shift']());}};_0x1853f1(++_0x571140);}(_0x1e56,0x86));var _0x61e5=function(_0x4b5378,_0x47a610){_0x4b5378=_0x4b5378-0x0;var _0x5181d6=_0x1e56[_0x4b5378];return _0x5181d6;};'use strict';var EventEmitter=require(_0x61e5('0x0'));var VoiceExtension=require(_0x61e5('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x61e5('0x2')](0x0);var events={'afterCreate':_0x61e5('0x3'),'afterUpdate':_0x61e5('0x4'),'afterDestroy':_0x61e5('0x5')};function emitEvent(_0x4db815){return function(_0x56105a,_0x37d9ae,_0x384bcb){VoiceExtensionEvents[_0x61e5('0x6')](_0x4db815+':'+_0x56105a['id'],_0x56105a);VoiceExtensionEvents[_0x61e5('0x6')](_0x4db815,_0x56105a);_0x384bcb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x61e5('0x7')](e,emitEvent(event));}}module[_0x61e5('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0xfd79=['../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x4da0e8,_0xe9995){var _0x579a56=function(_0x1e1f8c){while(--_0x1e1f8c){_0x4da0e8['push'](_0x4da0e8['shift']());}};_0x579a56(++_0xe9995);}(_0xfd79,0x15d));var _0x9fd7=function(_0x3b28cd,_0x3c89df){_0x3b28cd=_0x3b28cd-0x0;var _0x492596=_0xfd79[_0x3b28cd];return _0x492596;};'use strict';var EventEmitter=require(_0x9fd7('0x0'));var VoiceExtension=require(_0x9fd7('0x1'))['db'][_0x9fd7('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x9fd7('0x3')](0x0);var events={'afterCreate':_0x9fd7('0x4'),'afterUpdate':_0x9fd7('0x5'),'afterDestroy':_0x9fd7('0x6')};function emitEvent(_0x1167e7){return function(_0x4af09f,_0x382d86,_0x5a0792){VoiceExtensionEvents[_0x9fd7('0x7')](_0x1167e7+':'+_0x4af09f['id'],_0x4af09f);VoiceExtensionEvents[_0x9fd7('0x7')](_0x1167e7,_0x4af09f);_0x5a0792(null);};}for(var e in events){if(events[_0x9fd7('0x8')](e)){var event=events[e];VoiceExtension[_0x9fd7('0x9')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 7639abc..29261e1 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 _0x1ab4=['wav','trunk','timeout','options','url','split','length','name','phone','param','prefix','${EXTEN:','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','interval','IntervalId','then','intervals','map','filter','toLowerCase','hasOwnProperty','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','VoiceExtension','voice_extensions','get','Hangup','exports','models','type','Set','CDR(type)=','context','inbound','push','exten','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}'];(function(_0x26c949,_0x237670){var _0x1cf84c=function(_0x1c9450){while(--_0x1c9450){_0x26c949['push'](_0x26c949['shift']());}};_0x1cf84c(++_0x237670);}(_0x1ab4,0x8b));var _0x41ab=function(_0x342cf1,_0xbcece1){_0x342cf1=_0x342cf1-0x0;var _0x135bef=_0x1ab4[_0x342cf1];return _0x135bef;};'use strict';var _=require('lodash');var attributes=require('./voiceExtension.attributes');module[_0x41ab('0x0')]=function(_0x1f21e3){var _0x3b6aed=_0x1f21e3[_0x41ab('0x1')];function _0x365153(_0x1319b8){var _0x46ddaf=0x2;var _0x301f50=[{'type':_0x1319b8[_0x41ab('0x2')],'app':_0x41ab('0x3'),'appdata':_0x41ab('0x4')+_0x1319b8['type'],'context':_0x1319b8[_0x41ab('0x5')],'exten':_0x1319b8['exten'],'priority':_0x46ddaf++,'VoiceExtensionId':_0x1319b8['id']}];if(_0x1319b8[_0x41ab('0x2')]===_0x41ab('0x6')){_0x301f50[_0x41ab('0x7')]({'type':_0x41ab('0x6'),'app':'Set','appdata':'CDR(routeid)='+_0x1319b8['id'],'context':_0x1319b8['context'],'exten':_0x1319b8[_0x41ab('0x8')],'priority':_0x46ddaf++,'VoiceExtensionId':_0x1319b8['id']});}_0x301f50[_0x41ab('0x7')]({'type':_0x1319b8[_0x41ab('0x2')],'app':_0x41ab('0x3'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1319b8[_0x41ab('0x5')],'exten':_0x1319b8['exten'],'priority':_0x46ddaf++,'VoiceExtensionId':_0x1319b8['id']},{'type':_0x1319b8[_0x41ab('0x2')],'app':'Set','appdata':_0x41ab('0x9'),'context':_0x1319b8[_0x41ab('0x5')],'exten':_0x1319b8[_0x41ab('0x8')],'priority':_0x46ddaf++,'VoiceExtensionId':_0x1319b8['id']},{'type':_0x1319b8[_0x41ab('0x2')],'app':_0x41ab('0x3'),'appdata':_0x41ab('0xa'),'context':_0x1319b8[_0x41ab('0x5')],'exten':_0x1319b8[_0x41ab('0x8')],'priority':_0x46ddaf++,'VoiceExtensionId':_0x1319b8['id']});return _0x301f50;}function _0x118e46(_0x3bc766){var _0x562169=0x2;var _0x817d2b=[{'type':_0x41ab('0xb'),'app':_0x41ab('0x3'),'appdata':_0x41ab('0xc'),'context':_0x3bc766[_0x41ab('0x5')],'exten':_0x3bc766[_0x41ab('0x8')],'priority':_0x562169++,'VoiceExtensionId':_0x3bc766['id']},{'type':_0x41ab('0xb'),'app':_0x41ab('0x3'),'appdata':_0x41ab('0xd')+(_0x3bc766[_0x41ab('0xe')]?'${EXTEN:'+_0x3bc766['cutdigits']+'}':_0x41ab('0xf')),'context':_0x3bc766['context'],'exten':_0x3bc766[_0x41ab('0x8')],'priority':_0x562169++,'VoiceExtensionId':_0x3bc766['id']},{'type':'outbound','app':_0x41ab('0x3'),'appdata':_0x41ab('0x10')+_0x3bc766['id'],'context':_0x3bc766[_0x41ab('0x5')],'exten':_0x3bc766['exten'],'priority':_0x562169++,'VoiceExtensionId':_0x3bc766['id']},{'type':'outbound','app':_0x41ab('0x11'),'appdata':_0x41ab('0x12')+(_0x562169+0x2)+_0x41ab('0x13')+(_0x562169+0x1)+')','context':_0x3bc766['context'],'exten':_0x3bc766['exten'],'priority':_0x562169++,'VoiceExtensionId':_0x3bc766['id']},{'type':'outbound','app':_0x41ab('0x3'),'appdata':_0x3bc766['cutdigits']?_0x41ab('0x14')+_0x3bc766[_0x41ab('0xe')]+'}':_0x41ab('0x15'),'context':_0x3bc766[_0x41ab('0x5')],'exten':_0x3bc766[_0x41ab('0x8')],'priority':_0x562169++,'VoiceExtensionId':_0x3bc766['id']},{'type':_0x41ab('0xb'),'app':_0x41ab('0x3'),'appdata':_0x41ab('0x16'),'context':_0x3bc766[_0x41ab('0x5')],'exten':_0x3bc766['exten'],'priority':_0x562169++,'VoiceExtensionId':_0x3bc766['id']},{'type':_0x41ab('0xb'),'app':_0x41ab('0x3'),'appdata':_0x41ab('0x9'),'context':_0x3bc766[_0x41ab('0x5')],'exten':_0x3bc766[_0x41ab('0x8')],'priority':_0x562169++,'VoiceExtensionId':_0x3bc766['id']},{'type':'outbound','app':_0x41ab('0x3'),'appdata':_0x41ab('0xa'),'context':_0x3bc766[_0x41ab('0x5')],'exten':_0x3bc766[_0x41ab('0x8')],'priority':_0x562169++,'VoiceExtensionId':_0x3bc766['id']},{'type':_0x41ab('0xb'),'app':'Set','appdata':_0x41ab('0x17')+_0x3bc766['id'],'context':_0x3bc766[_0x41ab('0x5')],'exten':_0x3bc766[_0x41ab('0x8')],'priority':_0x562169++,'VoiceExtensionId':_0x3bc766['id']}];if(_0x3bc766['hasOwnProperty'](_0x41ab('0x18'))&&_0x3bc766[_0x41ab('0x18')]!==_0x41ab('0x19')){_0x817d2b[_0x41ab('0x7')]({'type':_0x41ab('0xb'),'app':'Set','appdata':_0x41ab('0x1a'),'context':_0x3bc766['context'],'exten':_0x3bc766[_0x41ab('0x8')],'priority':_0x562169++,'VoiceExtensionId':_0x3bc766['id']},{'type':_0x41ab('0xb'),'app':_0x41ab('0x3'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x3bc766['recordingFormat']||_0x41ab('0x1b'),'context':_0x3bc766[_0x41ab('0x5')],'exten':_0x3bc766[_0x41ab('0x8')],'priority':_0x562169++,'VoiceExtensionId':_0x3bc766['id']});}return _0x817d2b;}function _0x1551b2(_0x3a9962,_0x17b525){var _0xbdc859=[{'name':_0x41ab('0x1c'),'param':0x0},{'name':_0x41ab('0x1d'),'param':0x1},{'name':_0x41ab('0x1e'),'param':0x2},{'name':_0x41ab('0x1f'),'param':0x3}];var _0x39a1af={};var _0x242569=_0x17b525[_0x41ab('0x20')](',');var _0x582279=[];for(var _0xd52590=0x0;_0xd52590<_0xbdc859[_0x41ab('0x21')];_0xd52590++){switch(_0xbdc859[_0xd52590][_0x41ab('0x22')]){case _0x41ab('0x1c'):_0x39a1af[_0x41ab('0x1c')]=_0x242569[_0xbdc859[_0xd52590]['param']][_0x41ab('0x20')]('/')[0x1];_0x39a1af[_0x41ab('0x23')]=_0x242569[_0xbdc859[_0xd52590][_0x41ab('0x24')]][_0x41ab('0x20')]('/')[0x2];_0x39a1af[_0x41ab('0x25')]=_0x39a1af[_0x41ab('0x23')]?_0x39a1af['phone'][_0x41ab('0x20')]('$')[0x0]:undefined;_0x39a1af[_0x41ab('0x23')]=_0x3a9962['cutdigits']?(_0x39a1af[_0x41ab('0x25')]||'')+_0x41ab('0x26')+_0x3a9962[_0x41ab('0xe')]+'}':(_0x39a1af[_0x41ab('0x25')]||'')+_0x41ab('0xf');_0x582279[_0xbdc859[_0xd52590][_0x41ab('0x24')]]=[_0x41ab('0x27'),_0x39a1af[_0x41ab('0x1c')],_0x39a1af['phone']][_0x41ab('0x28')]('/');break;case _0x41ab('0x1e'):_0x39a1af[_0x41ab('0x1e')]=_0x242569[_0xbdc859[_0xd52590][_0x41ab('0x24')]];if(_0x3a9962[_0x41ab('0x18')]!==_0x41ab('0x19')){if(_0x39a1af[_0x41ab('0x1e')][_0x41ab('0x29')](_0x41ab('0x2a'))<0x0){_0x39a1af[_0x41ab('0x1e')]+='U(xcally-mixmonitor-context)';}}else{_0x39a1af[_0x41ab('0x1e')]=_0x39a1af[_0x41ab('0x1e')][_0x41ab('0x2b')](_0x41ab('0x2a'),'');}_0x582279[_0xbdc859[_0xd52590][_0x41ab('0x24')]]=_0x39a1af['options'];break;default:_0x582279[_0xbdc859[_0xd52590][_0x41ab('0x24')]]=_0x242569[_0xbdc859[_0xd52590][_0x41ab('0x24')]];}}return _0x582279[_0x41ab('0x28')](',');}function _0x16bb7c(_0x111be0,_0x35b241,_0x5e1848){return new Promise(function(_0x16715b,_0x120920){var _0x319f6d=[];if(_[_0x41ab('0x2c')](_0x35b241))return _0x16715b(_0x319f6d);_0x3b6aed['Interval'][_0x41ab('0x2d')]({'attributes':['id',_0x41ab('0x2e'),_0x41ab('0x2f')],'raw':!![]})[_0x41ab('0x30')](function(_0x381cb0){for(var _0x5d9b27=0x0,_0x59357c=0x0;_0x5d9b27<_0x35b241[_0x41ab('0x21')];_0x5d9b27++,_0x59357c=0x0){var _0x38849a=_0x35b241[_0x5d9b27];var _0x12c89c=[];var _0x496c75=[];delete _0x38849a['id'];if(_0x38849a[_0x41ab('0x2e')]!=='*,*,*,*'){_0x38849a['intervals']=[_0x38849a[_0x41ab('0x2e')]];}else{_0x38849a[_0x41ab('0x31')]=_0x38849a['IntervalId']?_[_0x41ab('0x32')](_[_0x41ab('0x33')](_0x381cb0,{'IntervalId':_0x38849a[_0x41ab('0x2f')]}),_0x41ab('0x2e')):[];}_0x38849a[_0x41ab('0x5')]=_0x111be0[_0x41ab('0x5')];_0x38849a[_0x41ab('0x8')]=_0x111be0['exten'];if(_0x38849a[_0x41ab('0x2')])_0x38849a['type']=_0x38849a[_0x41ab('0x2')][_0x41ab('0x34')]();if(_0x111be0[_0x41ab('0x2')]===_0x41ab('0xb')){if(_0x38849a[_0x41ab('0x35')](_0x41ab('0x36'))&&_0x38849a['tag']&&_0x38849a[_0x41ab('0x36')]!=='--'){_0x12c89c[_0x41ab('0x7')]({'type':_0x38849a[_0x41ab('0x2')][_0x41ab('0x34')](),'app':_0x41ab('0x3'),'appdata':_0x41ab('0x37')+_0x38849a['tag'],'context':_0x111be0[_0x41ab('0x5')],'exten':_0x111be0[_0x41ab('0x8')],'priority':_0x38849a[_0x41ab('0x31')][_0x41ab('0x21')]+_0x5e1848+_0x59357c++,'VoiceExtensionId':_0x111be0['id']});}_0x12c89c['push']({'type':_0x38849a[_0x41ab('0x2')][_0x41ab('0x34')](),'app':_0x41ab('0x11'),'appdata':_0x41ab('0x38')+(_0x38849a[_0x41ab('0x39')]?_0x41ab('0x3a')+_0x38849a[_0x41ab('0x39')]+')':'NoOp(No\x20number\x20available)'),'context':_0x111be0['context'],'exten':_0x111be0[_0x41ab('0x8')],'priority':_0x38849a[_0x41ab('0x31')][_0x41ab('0x21')]+_0x5e1848+_0x59357c++,'VoiceExtensionId':_0x111be0['id']});}else{if(_0x38849a['hasOwnProperty'](_0x41ab('0x3b'))){if([_0x41ab('0x3c'),_0x41ab('0x3d')][_0x41ab('0x3e')](_0x38849a[_0x41ab('0x3f')][_0x41ab('0x34')]())&&_0x38849a[_0x41ab('0x40')]!==_0x41ab('0x41')){if(_0x38849a[_0x41ab('0x3b')]){_0x12c89c['push']({'type':_0x38849a[_0x41ab('0x2')][_0x41ab('0x34')](),'app':_0x41ab('0x11'),'appdata':_0x41ab('0x42'),'context':_0x111be0[_0x41ab('0x5')],'exten':_0x111be0[_0x41ab('0x8')],'priority':_0x38849a[_0x41ab('0x31')][_0x41ab('0x21')]+_0x5e1848+_0x59357c++,'VoiceExtensionId':_0x111be0['id']});_0x12c89c[_0x41ab('0x7')]({'type':_0x38849a[_0x41ab('0x2')][_0x41ab('0x34')](),'app':'Set','appdata':_0x41ab('0x43'),'context':_0x111be0[_0x41ab('0x5')],'exten':_0x111be0[_0x41ab('0x8')],'priority':_0x38849a['intervals'][_0x41ab('0x21')]+_0x5e1848+_0x59357c++,'VoiceExtensionId':_0x111be0['id']});}else{_0x12c89c[_0x41ab('0x7')]({'type':_0x38849a['type']['toLowerCase'](),'app':_0x41ab('0x11'),'appdata':_0x41ab('0x44'),'context':_0x111be0[_0x41ab('0x5')],'exten':_0x111be0[_0x41ab('0x8')],'priority':_0x38849a['intervals']['length']+_0x5e1848+_0x59357c++,'VoiceExtensionId':_0x111be0['id']});_0x12c89c[_0x41ab('0x7')]({'type':_0x38849a[_0x41ab('0x2')][_0x41ab('0x34')](),'app':_0x41ab('0x3'),'appdata':_0x41ab('0x45'),'context':_0x111be0['context'],'exten':_0x111be0[_0x41ab('0x8')],'priority':_0x38849a[_0x41ab('0x31')][_0x41ab('0x21')]+_0x5e1848+_0x59357c++,'VoiceExtensionId':_0x111be0['id']});}}}}for(var _0x399823=0x0;_0x399823<_0x38849a['intervals'][_0x41ab('0x21')];_0x399823++){var _0x472fe0=_0x5e1848+_0x38849a[_0x41ab('0x31')][_0x41ab('0x21')];var _0x3c9f02=_0x399823===_0x38849a[_0x41ab('0x31')]['length']-0x1?_0x5e1848+_0x12c89c[_0x41ab('0x21')]+_0x496c75[_0x41ab('0x21')]+0x2:_0x5e1848+_0x399823+0x1;_0x12c89c[_0x41ab('0x46')](_0x399823,0x0,{'type':_0x111be0[_0x41ab('0x2')],'app':_0x41ab('0x47'),'appdata':_0x38849a[_0x41ab('0x31')][_0x399823]+'?'+_0x111be0[_0x41ab('0x5')]+_0x41ab('0x48')+_0x472fe0+':'+_0x111be0[_0x41ab('0x5')]+_0x41ab('0x48')+_0x3c9f02,'exten':_0x111be0[_0x41ab('0x8')],'context':_0x111be0[_0x41ab('0x5')],'priority':_0x5e1848+_0x399823,'VoiceExtensionId':_0x111be0['id']});}if(_0x38849a['appType']===_0x41ab('0x49')){_0x38849a[_0x41ab('0x4a')]=_0x1551b2(_0x111be0,_0x38849a[_0x41ab('0x4a')]);}if(_0x38849a['appType']==='agi'){_0x12c89c['push']({'type':_0x38849a['type']['toLowerCase'](),'app':_0x41ab('0x3'),'appdata':_0x41ab('0x4b'),'context':_0x111be0['context'],'exten':_0x111be0[_0x41ab('0x8')],'priority':_0x38849a[_0x41ab('0x31')]['length']+_0x5e1848+_0x59357c++,'VoiceExtensionId':_0x111be0['id']});}_0x38849a[_0x41ab('0x4c')]=_0x12c89c['length']?_[_0x41ab('0x4d')](_0x12c89c)['priority']+0x1:_0x5e1848;_0x319f6d=_[_0x41ab('0x4e')](_0x319f6d,_0x12c89c,[_0x38849a],_0x496c75);_0x5e1848=_[_0x41ab('0x4d')](_0x319f6d)[_0x41ab('0x4c')]+0x1;}return _0x16715b(_0x319f6d);})['catch'](function(_0x15822f){_0x120920(_0x15822f);});});}return _0x1f21e3['define'](_0x41ab('0x4f'),attributes,{'tableName':_0x41ab('0x50'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x30199b){var _0x1a5529=this[_0x41ab('0x51')]({'plain':!![]});var _0x17df99=_0x1a5529[_0x41ab('0x2')]===_0x41ab('0xb')?_0x118e46(_0x1a5529):_0x365153(_0x1a5529);return _0x16bb7c(_0x1a5529,_0x30199b,_[_0x41ab('0x4d')](_0x17df99)[_0x41ab('0x4c')]+0x1)[_0x41ab('0x30')](function(_0x1bacb4){var _0x2de770=_[_0x41ab('0x4e')](_0x17df99,_0x1bacb4);_0x2de770['push']({'type':_0x1a5529[_0x41ab('0x2')],'app':_0x41ab('0x52'),'exten':_0x1a5529['exten'],'context':_0x1a5529['context'],'priority':_[_0x41ab('0x4d')](_0x2de770)[_0x41ab('0x4c')]+0x1,'VoiceExtensionId':_0x1a5529['id']});return _0x2de770;});}}});}; \ No newline at end of file +var _0xe52c=['last','catch','define','VoiceExtension','voice_extensions','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','inbound','push','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','options','url','split','param','prefix','phone','SIP','join','indexOf','U(xcally-mixmonitor-context)','Interval','findAll','interval','IntervalId','then','length','*,*,*,*','intervals','map','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','queue','playback','custom','answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','appType','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority'];(function(_0x59d954,_0x2b0247){var _0x4041eb=function(_0x12defc){while(--_0x12defc){_0x59d954['push'](_0x59d954['shift']());}};_0x4041eb(++_0x2b0247);}(_0xe52c,0x97));var _0xce52=function(_0x46f463,_0x4602af){_0x46f463=_0x46f463-0x0;var _0xebdcf6=_0xe52c[_0x46f463];return _0xebdcf6;};'use strict';var _=require(_0xce52('0x0'));var attributes=require(_0xce52('0x1'));module[_0xce52('0x2')]=function(_0x1b87c4){var _0x4e68fb=_0x1b87c4[_0xce52('0x3')];function _0x2ec08f(_0x25d67d){var _0x5075b5=0x2;var _0x13e0fb=[{'type':_0x25d67d[_0xce52('0x4')],'app':_0xce52('0x5'),'appdata':_0xce52('0x6')+_0x25d67d['type'],'context':_0x25d67d[_0xce52('0x7')],'exten':_0x25d67d[_0xce52('0x8')],'priority':_0x5075b5++,'VoiceExtensionId':_0x25d67d['id']}];if(_0x25d67d[_0xce52('0x4')]===_0xce52('0x9')){_0x13e0fb[_0xce52('0xa')]({'type':_0xce52('0x9'),'app':'Set','appdata':'CDR(routeid)='+_0x25d67d['id'],'context':_0x25d67d[_0xce52('0x7')],'exten':_0x25d67d[_0xce52('0x8')],'priority':_0x5075b5++,'VoiceExtensionId':_0x25d67d['id']});}_0x13e0fb[_0xce52('0xa')]({'type':_0x25d67d[_0xce52('0x4')],'app':_0xce52('0x5'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x25d67d[_0xce52('0x7')],'exten':_0x25d67d[_0xce52('0x8')],'priority':_0x5075b5++,'VoiceExtensionId':_0x25d67d['id']},{'type':_0x25d67d[_0xce52('0x4')],'app':_0xce52('0x5'),'appdata':_0xce52('0xb'),'context':_0x25d67d['context'],'exten':_0x25d67d['exten'],'priority':_0x5075b5++,'VoiceExtensionId':_0x25d67d['id']},{'type':_0x25d67d[_0xce52('0x4')],'app':_0xce52('0x5'),'appdata':_0xce52('0xc'),'context':_0x25d67d[_0xce52('0x7')],'exten':_0x25d67d[_0xce52('0x8')],'priority':_0x5075b5++,'VoiceExtensionId':_0x25d67d['id']});return _0x13e0fb;}function _0x5723e8(_0x2a4e88){var _0x5b992a=0x2;var _0x3f1399=[{'type':_0xce52('0xd'),'app':_0xce52('0x5'),'appdata':_0xce52('0xe'),'context':_0x2a4e88[_0xce52('0x7')],'exten':_0x2a4e88[_0xce52('0x8')],'priority':_0x5b992a++,'VoiceExtensionId':_0x2a4e88['id']},{'type':_0xce52('0xd'),'app':_0xce52('0x5'),'appdata':'CDR(destination)='+(_0x2a4e88[_0xce52('0xf')]?_0xce52('0x10')+_0x2a4e88[_0xce52('0xf')]+'}':_0xce52('0x11')),'context':_0x2a4e88[_0xce52('0x7')],'exten':_0x2a4e88['exten'],'priority':_0x5b992a++,'VoiceExtensionId':_0x2a4e88['id']},{'type':_0xce52('0xd'),'app':_0xce52('0x5'),'appdata':_0xce52('0x12')+_0x2a4e88['id'],'context':_0x2a4e88['context'],'exten':_0x2a4e88[_0xce52('0x8')],'priority':_0x5b992a++,'VoiceExtensionId':_0x2a4e88['id']},{'type':_0xce52('0xd'),'app':_0xce52('0x13'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x5b992a+0x2)+_0xce52('0x14')+(_0x5b992a+0x1)+')','context':_0x2a4e88[_0xce52('0x7')],'exten':_0x2a4e88[_0xce52('0x8')],'priority':_0x5b992a++,'VoiceExtensionId':_0x2a4e88['id']},{'type':_0xce52('0xd'),'app':_0xce52('0x5'),'appdata':_0x2a4e88['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x2a4e88[_0xce52('0xf')]+'}':_0xce52('0x15'),'context':_0x2a4e88[_0xce52('0x7')],'exten':_0x2a4e88[_0xce52('0x8')],'priority':_0x5b992a++,'VoiceExtensionId':_0x2a4e88['id']},{'type':_0xce52('0xd'),'app':_0xce52('0x5'),'appdata':_0xce52('0x16'),'context':_0x2a4e88[_0xce52('0x7')],'exten':_0x2a4e88[_0xce52('0x8')],'priority':_0x5b992a++,'VoiceExtensionId':_0x2a4e88['id']},{'type':_0xce52('0xd'),'app':_0xce52('0x5'),'appdata':_0xce52('0xb'),'context':_0x2a4e88[_0xce52('0x7')],'exten':_0x2a4e88[_0xce52('0x8')],'priority':_0x5b992a++,'VoiceExtensionId':_0x2a4e88['id']},{'type':_0xce52('0xd'),'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x2a4e88[_0xce52('0x7')],'exten':_0x2a4e88[_0xce52('0x8')],'priority':_0x5b992a++,'VoiceExtensionId':_0x2a4e88['id']},{'type':_0xce52('0xd'),'app':'Set','appdata':'outboundrouteid='+_0x2a4e88['id'],'context':_0x2a4e88[_0xce52('0x7')],'exten':_0x2a4e88[_0xce52('0x8')],'priority':_0x5b992a++,'VoiceExtensionId':_0x2a4e88['id']}];if(_0x2a4e88[_0xce52('0x17')](_0xce52('0x18'))&&_0x2a4e88[_0xce52('0x18')]!==_0xce52('0x19')){_0x3f1399[_0xce52('0xa')]({'type':_0xce52('0xd'),'app':_0xce52('0x5'),'appdata':_0xce52('0x1a'),'context':_0x2a4e88[_0xce52('0x7')],'exten':_0x2a4e88[_0xce52('0x8')],'priority':_0x5b992a++,'VoiceExtensionId':_0x2a4e88['id']},{'type':_0xce52('0xd'),'app':_0xce52('0x5'),'appdata':_0xce52('0x1b')+_0x2a4e88[_0xce52('0x18')]||'wav','context':_0x2a4e88[_0xce52('0x7')],'exten':_0x2a4e88[_0xce52('0x8')],'priority':_0x5b992a++,'VoiceExtensionId':_0x2a4e88['id']});}return _0x3f1399;}function _0x851d46(_0x1ce077,_0x80029d){var _0xb58495=[{'name':_0xce52('0x1c'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0xce52('0x1d'),'param':0x2},{'name':_0xce52('0x1e'),'param':0x3}];var _0x4b88a4={};var _0xbdb912=_0x80029d['split'](',');var _0x259e36=[];for(var _0x5ce1a2=0x0;_0x5ce1a2<_0xb58495['length'];_0x5ce1a2++){switch(_0xb58495[_0x5ce1a2]['name']){case _0xce52('0x1c'):_0x4b88a4['trunk']=_0xbdb912[_0xb58495[_0x5ce1a2]['param']][_0xce52('0x1f')]('/')[0x1];_0x4b88a4['phone']=_0xbdb912[_0xb58495[_0x5ce1a2][_0xce52('0x20')]][_0xce52('0x1f')]('/')[0x2];_0x4b88a4[_0xce52('0x21')]=_0x4b88a4[_0xce52('0x22')]?_0x4b88a4[_0xce52('0x22')][_0xce52('0x1f')]('$')[0x0]:undefined;_0x4b88a4['phone']=_0x1ce077['cutdigits']?(_0x4b88a4[_0xce52('0x21')]||'')+_0xce52('0x10')+_0x1ce077[_0xce52('0xf')]+'}':(_0x4b88a4['prefix']||'')+'${EXTEN}';_0x259e36[_0xb58495[_0x5ce1a2][_0xce52('0x20')]]=[_0xce52('0x23'),_0x4b88a4['trunk'],_0x4b88a4['phone']][_0xce52('0x24')]('/');break;case _0xce52('0x1d'):_0x4b88a4[_0xce52('0x1d')]=_0xbdb912[_0xb58495[_0x5ce1a2][_0xce52('0x20')]];if(_0x1ce077[_0xce52('0x18')]!==_0xce52('0x19')){if(_0x4b88a4[_0xce52('0x1d')][_0xce52('0x25')](_0xce52('0x26'))<0x0){_0x4b88a4[_0xce52('0x1d')]+=_0xce52('0x26');}}else{_0x4b88a4[_0xce52('0x1d')]=_0x4b88a4[_0xce52('0x1d')]['replace'](_0xce52('0x26'),'');}_0x259e36[_0xb58495[_0x5ce1a2][_0xce52('0x20')]]=_0x4b88a4['options'];break;default:_0x259e36[_0xb58495[_0x5ce1a2][_0xce52('0x20')]]=_0xbdb912[_0xb58495[_0x5ce1a2]['param']];}}return _0x259e36[_0xce52('0x24')](',');}function _0x58c0b3(_0xefab5e,_0x9e9b42,_0x332565){return new Promise(function(_0x5c9f36,_0x275122){var _0x9caa0=[];if(_['isEmpty'](_0x9e9b42))return _0x5c9f36(_0x9caa0);_0x4e68fb[_0xce52('0x27')][_0xce52('0x28')]({'attributes':['id',_0xce52('0x29'),_0xce52('0x2a')],'raw':!![]})[_0xce52('0x2b')](function(_0x48e03a){for(var _0x5627ed=0x0,_0x557926=0x0;_0x5627ed<_0x9e9b42[_0xce52('0x2c')];_0x5627ed++,_0x557926=0x0){var _0x20bb69=_0x9e9b42[_0x5627ed];var _0xa057d=[];var _0x19a75a=[];delete _0x20bb69['id'];if(_0x20bb69[_0xce52('0x29')]!==_0xce52('0x2d')){_0x20bb69[_0xce52('0x2e')]=[_0x20bb69[_0xce52('0x29')]];}else{_0x20bb69[_0xce52('0x2e')]=_0x20bb69['IntervalId']?_[_0xce52('0x2f')](_['filter'](_0x48e03a,{'IntervalId':_0x20bb69[_0xce52('0x2a')]}),_0xce52('0x29')):[];}_0x20bb69[_0xce52('0x7')]=_0xefab5e[_0xce52('0x7')];_0x20bb69[_0xce52('0x8')]=_0xefab5e['exten'];if(_0x20bb69[_0xce52('0x4')])_0x20bb69[_0xce52('0x4')]=_0x20bb69[_0xce52('0x4')][_0xce52('0x30')]();if(_0xefab5e['type']===_0xce52('0xd')){if(_0x20bb69['hasOwnProperty']('tag')&&_0x20bb69['tag']&&_0x20bb69[_0xce52('0x31')]!=='--'){_0xa057d['push']({'type':_0x20bb69[_0xce52('0x4')][_0xce52('0x30')](),'app':_0xce52('0x5'),'appdata':'CDR(tag)='+_0x20bb69[_0xce52('0x31')],'context':_0xefab5e[_0xce52('0x7')],'exten':_0xefab5e[_0xce52('0x8')],'priority':_0x20bb69[_0xce52('0x2e')]['length']+_0x332565+_0x557926++,'VoiceExtensionId':_0xefab5e['id']});}_0xa057d[_0xce52('0xa')]({'type':_0x20bb69[_0xce52('0x4')][_0xce52('0x30')](),'app':'ExecIf','appdata':_0xce52('0x32')+(_0x20bb69[_0xce52('0x33')]?_0xce52('0x34')+_0x20bb69[_0xce52('0x33')]+')':_0xce52('0x35')),'context':_0xefab5e[_0xce52('0x7')],'exten':_0xefab5e[_0xce52('0x8')],'priority':_0x20bb69['intervals'][_0xce52('0x2c')]+_0x332565+_0x557926++,'VoiceExtensionId':_0xefab5e['id']});}else{if(_0x20bb69['hasOwnProperty']('answer')){if([_0xce52('0x36'),_0xce52('0x37')]['includes'](_0x20bb69['app']['toLowerCase']())&&_0x20bb69['appType']!==_0xce52('0x38')){if(_0x20bb69[_0xce52('0x39')]){_0xa057d[_0xce52('0xa')]({'type':_0x20bb69[_0xce52('0x4')][_0xce52('0x30')](),'app':_0xce52('0x13'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0xefab5e[_0xce52('0x7')],'exten':_0xefab5e['exten'],'priority':_0x20bb69[_0xce52('0x2e')][_0xce52('0x2c')]+_0x332565+_0x557926++,'VoiceExtensionId':_0xefab5e['id']});_0xa057d[_0xce52('0xa')]({'type':_0x20bb69[_0xce52('0x4')][_0xce52('0x30')](),'app':_0xce52('0x5'),'appdata':_0xce52('0x3a'),'context':_0xefab5e[_0xce52('0x7')],'exten':_0xefab5e['exten'],'priority':_0x20bb69[_0xce52('0x2e')][_0xce52('0x2c')]+_0x332565+_0x557926++,'VoiceExtensionId':_0xefab5e['id']});}else{_0xa057d[_0xce52('0xa')]({'type':_0x20bb69[_0xce52('0x4')]['toLowerCase'](),'app':_0xce52('0x13'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0xefab5e[_0xce52('0x7')],'exten':_0xefab5e['exten'],'priority':_0x20bb69[_0xce52('0x2e')]['length']+_0x332565+_0x557926++,'VoiceExtensionId':_0xefab5e['id']});_0xa057d[_0xce52('0xa')]({'type':_0x20bb69[_0xce52('0x4')][_0xce52('0x30')](),'app':_0xce52('0x5'),'appdata':_0xce52('0x3b'),'context':_0xefab5e[_0xce52('0x7')],'exten':_0xefab5e[_0xce52('0x8')],'priority':_0x20bb69[_0xce52('0x2e')][_0xce52('0x2c')]+_0x332565+_0x557926++,'VoiceExtensionId':_0xefab5e['id']});}}}}for(var _0x8870bd=0x0;_0x8870bd<_0x20bb69[_0xce52('0x2e')][_0xce52('0x2c')];_0x8870bd++){var _0x1f8357=_0x332565+_0x20bb69['intervals']['length'];var _0x5ba8c6=_0x8870bd===_0x20bb69[_0xce52('0x2e')]['length']-0x1?_0x332565+_0xa057d[_0xce52('0x2c')]+_0x19a75a[_0xce52('0x2c')]+0x2:_0x332565+_0x8870bd+0x1;_0xa057d[_0xce52('0x3c')](_0x8870bd,0x0,{'type':_0xefab5e[_0xce52('0x4')],'app':'GotoIfTime','appdata':_0x20bb69[_0xce52('0x2e')][_0x8870bd]+'?'+_0xefab5e['context']+_0xce52('0x3d')+_0x1f8357+':'+_0xefab5e[_0xce52('0x7')]+_0xce52('0x3d')+_0x5ba8c6,'exten':_0xefab5e[_0xce52('0x8')],'context':_0xefab5e[_0xce52('0x7')],'priority':_0x332565+_0x8870bd,'VoiceExtensionId':_0xefab5e['id']});}if(_0x20bb69[_0xce52('0x3e')]===_0xce52('0x3f')){_0x20bb69[_0xce52('0x40')]=_0x851d46(_0xefab5e,_0x20bb69['appdata']);}if(_0x20bb69[_0xce52('0x3e')]===_0xce52('0x41')){_0xa057d[_0xce52('0xa')]({'type':_0x20bb69['type'][_0xce52('0x30')](),'app':_0xce52('0x5'),'appdata':_0xce52('0x42'),'context':_0xefab5e['context'],'exten':_0xefab5e[_0xce52('0x8')],'priority':_0x20bb69[_0xce52('0x2e')][_0xce52('0x2c')]+_0x332565+_0x557926++,'VoiceExtensionId':_0xefab5e['id']});}_0x20bb69[_0xce52('0x43')]=_0xa057d[_0xce52('0x2c')]?_[_0xce52('0x44')](_0xa057d)[_0xce52('0x43')]+0x1:_0x332565;_0x9caa0=_['concat'](_0x9caa0,_0xa057d,[_0x20bb69],_0x19a75a);_0x332565=_[_0xce52('0x44')](_0x9caa0)['priority']+0x1;}return _0x5c9f36(_0x9caa0);})[_0xce52('0x45')](function(_0x2d03b8){_0x275122(_0x2d03b8);});});}return _0x1b87c4[_0xce52('0x46')](_0xce52('0x47'),attributes,{'tableName':_0xce52('0x48'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x194ff2){var _0x2d3ded=this['get']({'plain':!![]});var _0x418e96=_0x2d3ded['type']===_0xce52('0xd')?_0x5723e8(_0x2d3ded):_0x2ec08f(_0x2d3ded);return _0x58c0b3(_0x2d3ded,_0x194ff2,_[_0xce52('0x44')](_0x418e96)[_0xce52('0x43')]+0x1)[_0xce52('0x2b')](function(_0x3db110){var _0x2339a5=_['concat'](_0x418e96,_0x3db110);_0x2339a5[_0xce52('0xa')]({'type':_0x2d3ded[_0xce52('0x4')],'app':'Hangup','exten':_0x2d3ded[_0xce52('0x8')],'context':_0x2d3ded['context'],'priority':_[_0xce52('0x44')](_0x2339a5)[_0xce52('0x43')]+0x1,'VoiceExtensionId':_0x2d3ded['id']});return _0x2339a5;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index b53ac75..2d319bf 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 _0x644f=['limit','include','map','model','info','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes'];(function(_0x1ca361,_0x573b1c){var _0x454618=function(_0x50531a){while(--_0x50531a){_0x1ca361['push'](_0x1ca361['shift']());}};_0x454618(++_0x573b1c);}(_0x644f,0x177));var _0xf644=function(_0x318840,_0x561b1e){_0x318840=_0x318840-0x0;var _0x223da4=_0x644f[_0x318840];return _0x223da4;};'use strict';var _=require('lodash');var util=require(_0xf644('0x0'));var moment=require(_0xf644('0x1'));var BPromise=require(_0xf644('0x2'));var rs=require(_0xf644('0x3'));var fs=require('fs');var Redis=require(_0xf644('0x4'));var db=require(_0xf644('0x5'))['db'];var utils=require(_0xf644('0x6'));var logger=require(_0xf644('0x7'))(_0xf644('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf644('0x9')][_0xf644('0xa')]({'port':0x232a});config[_0xf644('0xb')]=_['defaults'](config[_0xf644('0xb')],{'host':_0xf644('0xc'),'port':0x18eb});var socket=require(_0xf644('0xd'))(new Redis(config[_0xf644('0xb')]));require(_0xf644('0xe'))['register'](socket);function respondWithRpcPromise(_0x35b8e5,_0x21e90a,_0x33a2c2){return new BPromise(function(_0xcd5688,_0x59d974){return client['request'](_0x35b8e5,_0x33a2c2)[_0xf644('0xf')](function(_0x517447){logger['info'](_0xf644('0x10'),_0x21e90a,_0xf644('0x11'));logger[_0xf644('0x12')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x21e90a,_0xf644('0x11'),JSON[_0xf644('0x13')](_0x517447));if(_0x517447[_0xf644('0x14')]){if(_0x517447[_0xf644('0x14')][_0xf644('0x15')]===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x21e90a,_0x517447['error']['message']);return _0x59d974(_0x517447['error'][_0xf644('0x16')]);}logger['error'](_0xf644('0x10'),_0x21e90a,_0x517447[_0xf644('0x14')][_0xf644('0x16')]);return _0xcd5688(_0x517447[_0xf644('0x14')][_0xf644('0x16')]);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x21e90a,_0xf644('0x11'));_0xcd5688(_0x517447[_0xf644('0x17')][_0xf644('0x16')]);}})[_0xf644('0x18')](function(_0x2b628d){logger[_0xf644('0x14')](_0xf644('0x10'),_0x21e90a,_0x2b628d);_0x59d974(_0x2b628d);});});}exports[_0xf644('0x19')]=function(_0x2c51ef){var _0x1c8c56=this;return new Promise(function(_0x1c5613,_0x567c1d){return db[_0xf644('0x1a')][_0xf644('0x1b')]({'raw':_0x2c51ef[_0xf644('0x1c')]?_0x2c51ef[_0xf644('0x1c')][_0xf644('0x1d')]===undefined?!![]:![]:!![],'where':_0x2c51ef['options']?_0x2c51ef[_0xf644('0x1c')][_0xf644('0x1e')]||null:null,'attributes':_0x2c51ef[_0xf644('0x1c')]?_0x2c51ef[_0xf644('0x1c')][_0xf644('0x1f')]||null:null,'limit':_0x2c51ef['options']?_0x2c51ef[_0xf644('0x1c')][_0xf644('0x20')]||null:null,'include':_0x2c51ef[_0xf644('0x1c')]?_0x2c51ef[_0xf644('0x1c')]['include']?_['map'](_0x2c51ef[_0xf644('0x1c')][_0xf644('0x21')],function(_0x372f30){return{'model':db[_0x372f30['model']],'as':_0x372f30['as'],'attributes':_0x372f30['attributes'],'include':_0x372f30[_0xf644('0x21')]?_[_0xf644('0x22')](_0x372f30[_0xf644('0x21')],function(_0x530a33){return{'model':db[_0x530a33[_0xf644('0x23')]],'as':_0x530a33['as'],'attributes':_0x530a33['attributes'],'include':_0x530a33[_0xf644('0x21')]?_[_0xf644('0x22')](_0x530a33[_0xf644('0x21')],function(_0x295c04){return{'model':db[_0x295c04[_0xf644('0x23')]],'as':_0x295c04['as'],'attributes':_0x295c04['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x44366a){logger[_0xf644('0x24')](_0xf644('0x19'),_0x2c51ef);logger['debug'](_0xf644('0x19'),_0x2c51ef,JSON[_0xf644('0x13')](_0x44366a));_0x1c5613(_0x44366a);})[_0xf644('0x18')](function(_0x42351e){logger[_0xf644('0x14')]('GetVoiceExtension',_0x42351e[_0xf644('0x16')],_0x2c51ef);_0x567c1d(_0x1c8c56[_0xf644('0x14')](0x1f4,_0x42351e[_0xf644('0x16')]));});});}; \ No newline at end of file +var _0xba34=['../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','then','VoiceExtension,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','GetVoiceExtension','findAll','options','raw','limit','include','map','model','attributes','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0xa2049b,_0x7eeb1e){var _0x2fd615=function(_0x7dbb84){while(--_0x7dbb84){_0xa2049b['push'](_0xa2049b['shift']());}};_0x2fd615(++_0x7eeb1e);}(_0xba34,0x119));var _0x4ba3=function(_0xfc29d9,_0x256414){_0xfc29d9=_0xfc29d9-0x0;var _0x50b39b=_0xba34[_0xfc29d9];return _0x50b39b;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});config[_0x4ba3('0xb')]=_['defaults'](config[_0x4ba3('0xb')],{'host':_0x4ba3('0xc'),'port':0x18eb});var socket=require(_0x4ba3('0xd'))(new Redis(config[_0x4ba3('0xb')]));require(_0x4ba3('0xe'))[_0x4ba3('0xf')](socket);function respondWithRpcPromise(_0x292f58,_0x3f653c,_0x2ed106){return new BPromise(function(_0x14ebf2,_0x2d215b){return client['request'](_0x292f58,_0x2ed106)[_0x4ba3('0x10')](function(_0x9071){logger['info'](_0x4ba3('0x11'),_0x3f653c,'request\x20sent');logger[_0x4ba3('0x12')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x3f653c,_0x4ba3('0x13'),JSON[_0x4ba3('0x14')](_0x9071));if(_0x9071[_0x4ba3('0x15')]){if(_0x9071[_0x4ba3('0x15')][_0x4ba3('0x16')]===0x1f4){logger[_0x4ba3('0x15')](_0x4ba3('0x11'),_0x3f653c,_0x9071[_0x4ba3('0x15')][_0x4ba3('0x17')]);return _0x2d215b(_0x9071[_0x4ba3('0x15')][_0x4ba3('0x17')]);}logger[_0x4ba3('0x15')](_0x4ba3('0x11'),_0x3f653c,_0x9071[_0x4ba3('0x15')][_0x4ba3('0x17')]);return _0x14ebf2(_0x9071[_0x4ba3('0x15')]['message']);}else{logger[_0x4ba3('0x18')](_0x4ba3('0x11'),_0x3f653c,_0x4ba3('0x13'));_0x14ebf2(_0x9071[_0x4ba3('0x19')]['message']);}})[_0x4ba3('0x1a')](function(_0xe4eff9){logger[_0x4ba3('0x15')](_0x4ba3('0x11'),_0x3f653c,_0xe4eff9);_0x2d215b(_0xe4eff9);});});}exports[_0x4ba3('0x1b')]=function(_0x125944){var _0x4b2791=this;return new Promise(function(_0x57de6a,_0x2278b0){return db['VoiceExtension'][_0x4ba3('0x1c')]({'raw':_0x125944[_0x4ba3('0x1d')]?_0x125944[_0x4ba3('0x1d')][_0x4ba3('0x1e')]===undefined?!![]:![]:!![],'where':_0x125944[_0x4ba3('0x1d')]?_0x125944[_0x4ba3('0x1d')]['where']||null:null,'attributes':_0x125944[_0x4ba3('0x1d')]?_0x125944[_0x4ba3('0x1d')]['attributes']||null:null,'limit':_0x125944[_0x4ba3('0x1d')]?_0x125944['options'][_0x4ba3('0x1f')]||null:null,'include':_0x125944[_0x4ba3('0x1d')]?_0x125944[_0x4ba3('0x1d')][_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x125944[_0x4ba3('0x1d')][_0x4ba3('0x20')],function(_0xe1f7d2){return{'model':db[_0xe1f7d2[_0x4ba3('0x22')]],'as':_0xe1f7d2['as'],'attributes':_0xe1f7d2[_0x4ba3('0x23')],'include':_0xe1f7d2['include']?_[_0x4ba3('0x21')](_0xe1f7d2[_0x4ba3('0x20')],function(_0x2311ed){return{'model':db[_0x2311ed['model']],'as':_0x2311ed['as'],'attributes':_0x2311ed[_0x4ba3('0x23')],'include':_0x2311ed[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x2311ed['include'],function(_0x10cae6){return{'model':db[_0x10cae6[_0x4ba3('0x22')]],'as':_0x10cae6['as'],'attributes':_0x10cae6[_0x4ba3('0x23')]};}):[]};}):[]};}):[]:[]})[_0x4ba3('0x10')](function(_0x4a339e){logger['info'](_0x4ba3('0x1b'),_0x125944);logger[_0x4ba3('0x12')](_0x4ba3('0x1b'),_0x125944,JSON[_0x4ba3('0x14')](_0x4a339e));_0x57de6a(_0x4a339e);})[_0x4ba3('0x1a')](function(_0x11f88f){logger['error'](_0x4ba3('0x1b'),_0x11f88f[_0x4ba3('0x17')],_0x125944);_0x2278b0(_0x4b2791[_0x4ba3('0x15')](0x1f4,_0x11f88f[_0x4ba3('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 6e6b553..1f5ef48 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 _0x4975=['length','./voiceExtension.events','remove','update','emit','removeListener','register'];(function(_0x49cde6,_0x492715){var _0x5987f4=function(_0x3f6e71){while(--_0x3f6e71){_0x49cde6['push'](_0x49cde6['shift']());}};_0x5987f4(++_0x492715);}(_0x4975,0x86));var _0x5497=function(_0x583bd4,_0x408786){_0x583bd4=_0x583bd4-0x0;var _0x488c80=_0x4975[_0x583bd4];return _0x488c80;};'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 +var _0xabce=['voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x67f164,_0x47f390){var _0x300978=function(_0x134e07){while(--_0x134e07){_0x67f164['push'](_0x67f164['shift']());}};_0x300978(++_0x47f390);}(_0xabce,0x103));var _0xeabc=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xabce[_0x5ddb1c];return _0x354adc;};'use strict';var VoiceExtensionEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){VoiceExtensionEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);VoiceExtensionEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 2fe4ee0..7300bcb 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 _0x32f4=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id','getMessages','post','create','update','exports'];(function(_0x189f99,_0x1bb970){var _0x29ee75=function(_0x60bffe){while(--_0x60bffe){_0x189f99['push'](_0x189f99['shift']());}};_0x29ee75(++_0x1bb970);}(_0x32f4,0x154));var _0x432f=function(_0x4d2789,_0x50788d){_0x4d2789=_0x4d2789-0x0;var _0xaf9c17=_0x32f4[_0x4d2789];return _0xaf9c17;};'use strict';var multer=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var path=require(_0x432f('0x2'));var timeout=require(_0x432f('0x3'));var express=require('express');var router=express[_0x432f('0x4')]();var fs_extra=require(_0x432f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x432f('0x6'));var config=require(_0x432f('0x7'));var controller=require(_0x432f('0x8'));router[_0x432f('0x9')]('/',auth[_0x432f('0xa')](),controller['index']);router['get'](_0x432f('0xb'),auth[_0x432f('0xa')](),controller['show']);router[_0x432f('0x9')]('/:id/messages',auth[_0x432f('0xa')](),controller[_0x432f('0xc')]);router[_0x432f('0xd')]('/',auth[_0x432f('0xa')](),controller[_0x432f('0xe')]);router['put'](_0x432f('0xb'),auth['isAuthenticated'](),controller[_0x432f('0xf')]);router['delete'](_0x432f('0xb'),auth[_0x432f('0xa')](),controller['destroy']);module[_0x432f('0x10')]=router; \ No newline at end of file +var _0x4325=['get','/:id/messages','getMessages','put','update','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceMail.controller','isAuthenticated','index','/:id','show'];(function(_0x3eabdb,_0x2cb3af){var _0x5cfffa=function(_0x16ee41){while(--_0x16ee41){_0x3eabdb['push'](_0x3eabdb['shift']());}};_0x5cfffa(++_0x2cb3af);}(_0x4325,0x1da));var _0x5432=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4325[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var path=require('path');var timeout=require(_0x5432('0x2'));var express=require(_0x5432('0x3'));var router=express[_0x5432('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5432('0x5'));var config=require(_0x5432('0x6'));var controller=require(_0x5432('0x7'));router['get']('/',auth[_0x5432('0x8')](),controller[_0x5432('0x9')]);router['get'](_0x5432('0xa'),auth['isAuthenticated'](),controller[_0x5432('0xb')]);router[_0x5432('0xc')](_0x5432('0xd'),auth[_0x5432('0x8')](),controller[_0x5432('0xe')]);router['post']('/',auth[_0x5432('0x8')](),controller['create']);router[_0x5432('0xf')](_0x5432('0xa'),auth[_0x5432('0x8')](),controller[_0x5432('0x10')]);router['delete']('/:id',auth[_0x5432('0x8')](),controller[_0x5432('0x11')]);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 aa18fb6..58f2b9a 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 _0x91e0=['getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL'];(function(_0x9d5969,_0x3177ef){var _0x442cb4=function(_0x1df983){while(--_0x1df983){_0x9d5969['push'](_0x9d5969['shift']());}};_0x442cb4(++_0x3177ef);}(_0x91e0,0x16c));var _0x091e=function(_0x38c7a1,_0x17f38c){_0x38c7a1=_0x38c7a1-0x0;var _0x52a582=_0x91e0[_0x38c7a1];return _0x52a582;};'use strict';var Sequelize=require(_0x091e('0x0'));module[_0x091e('0x1')]={'customer_id':{'type':Sequelize[_0x091e('0x2')]},'context':{'type':Sequelize[_0x091e('0x2')],'defaultValue':_0x091e('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x091e('0x2')],'defaultValue':'','allowNull':![],'unique':_0x091e('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x091e('0x2')]},'email':{'type':Sequelize[_0x091e('0x2')],'validate':{'isEmail':!![]},'set':function(_0x56d3b6){this[_0x091e('0x5')]('email',typeof _0x56d3b6===_0x091e('0x6')&&_0x56d3b6[_0x091e('0x7')]()?_0x56d3b6[_0x091e('0x7')]():null);}},'pager':{'type':Sequelize[_0x091e('0x2')]},'tz':{'type':Sequelize[_0x091e('0x2')],'defaultValue':_0x091e('0x8')},'attach':{'type':Sequelize[_0x091e('0x9')](_0x091e('0xa'),'no'),'defaultValue':_0x091e('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x091e('0x9')](_0x091e('0xa'),'no'),'defaultValue':_0x091e('0xa'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x091e('0x9')](_0x091e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x091e('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x091e('0x9')](_0x091e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x091e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x091e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x091e('0x9')](_0x091e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x091e('0x9')]('yes','no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x091e('0x9')](_0x091e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x091e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x091e('0x9')](_0x091e('0xa'),'no'),'defaultValue':_0x091e('0xa'),'allowNull':![]},'stamp':{'type':_0x091e('0xb')},'emailsubject':{'type':Sequelize[_0x091e('0x2')]},'emailbody':{'type':Sequelize[_0x091e('0x2')]},'maxsecs':{'type':Sequelize[_0x091e('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x091e('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x091e('0xd')],'get':function(){return this[_0x091e('0xe')](_0x091e('0xf'))+_0x091e('0x10')+this[_0x091e('0xe')](_0x091e('0x11'));}}}; \ No newline at end of file +var _0x7918=['mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','trim','central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue'];(function(_0x275cef,_0x42637a){var _0x4a2c47=function(_0x4a39a6){while(--_0x4a39a6){_0x275cef['push'](_0x275cef['shift']());}};_0x4a2c47(++_0x42637a);}(_0x7918,0x7f));var _0x8791=function(_0x24d090,_0x59ff9a){_0x24d090=_0x24d090-0x0;var _0x3788e3=_0x7918[_0x24d090];return _0x3788e3;};'use strict';var Sequelize=require(_0x8791('0x0'));module[_0x8791('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8791('0x2')],'defaultValue':_0x8791('0x3'),'unique':_0x8791('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x8791('0x4')},'password':{'type':Sequelize[_0x8791('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x8791('0x2')],'validate':{'isEmail':!![]},'set':function(_0x24ff9e){this[_0x8791('0x5')](_0x8791('0x6'),typeof _0x24ff9e==='string'&&_0x24ff9e[_0x8791('0x7')]()?_0x24ff9e['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x8791('0x2')],'defaultValue':_0x8791('0x8')},'attach':{'type':Sequelize[_0x8791('0x9')](_0x8791('0xa'),'no'),'defaultValue':_0x8791('0xa'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x8791('0x2')]},'callback':{'type':Sequelize[_0x8791('0x2')]},'review':{'type':Sequelize[_0x8791('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x8791('0x9')](_0x8791('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x8791('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x8791('0x9')](_0x8791('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x8791('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x8791('0x9')](_0x8791('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x8791('0x9')](_0x8791('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x8791('0x9')](_0x8791('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x8791('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x8791('0x9')]('yes','no'),'defaultValue':_0x8791('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x8791('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x8791('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x8791('0xd')],'get':function(){return this['getDataValue'](_0x8791('0xe'))+_0x8791('0xf')+this[_0x8791('0x10')](_0x8791('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 853a511..23da472 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 _0x13f6=['destroy','Voicemails','error','send','index','map','VoiceMail','rawAttributes','fieldName','type','model','name','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','user','get','UserProfileSection','userProfileId','UserProfileResource','getMessages','findOne','VoiceMailMessage','pick','findAndCountAll','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then'];(function(_0x202780,_0x4889b5){var _0x386548=function(_0x334391){while(--_0x334391){_0x202780['push'](_0x202780['shift']());}};_0x386548(++_0x4889b5);}(_0x13f6,0x124));var _0x613f=function(_0xbd3294,_0xf4ef07){_0xbd3294=_0xbd3294-0x0;var _0x5db501=_0x13f6[_0xbd3294];return _0x5db501;};'use strict';var emlformat=require(_0x613f('0x0'));var rimraf=require(_0x613f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x613f('0x2'));var moment=require(_0x613f('0x3'));var BPromise=require(_0x613f('0x4'));var Mustache=require('mustache');var util=require(_0x613f('0x5'));var path=require(_0x613f('0x6'));var sox=require(_0x613f('0x7'));var csv=require('to-csv');var ejs=require(_0x613f('0x8'));var fs=require('fs');var fs_extra=require(_0x613f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x613f('0xa'));var toCsv=require(_0x613f('0xb'));var querystring=require(_0x613f('0xc'));var Papa=require(_0x613f('0xd'));var Redis=require('ioredis');var authService=require(_0x613f('0xe'));var qs=require(_0x613f('0xf'));var as=require(_0x613f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x613f('0x11'))(_0x613f('0x12'));var utils=require(_0x613f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x613f('0x14'));var db=require(_0x613f('0x15'))['db'];function respondWithStatusCode(_0x542230,_0x4c2a85){_0x4c2a85=_0x4c2a85||0xcc;return function(_0x517f57){if(_0x517f57){return _0x542230[_0x613f('0x16')](_0x4c2a85);}return _0x542230[_0x613f('0x17')](_0x4c2a85)[_0x613f('0x18')]();};}function respondWithResult(_0x375db1,_0x329fcf){_0x329fcf=_0x329fcf||0xc8;return function(_0x4a6fc){if(_0x4a6fc){return _0x375db1[_0x613f('0x17')](_0x329fcf)[_0x613f('0x19')](_0x4a6fc);}};}function respondWithFilteredResult(_0x2eee4d,_0x1d68fd){return function(_0x548218){if(_0x548218){var _0x3c9edf=typeof _0x1d68fd['offset']==='undefined'&&typeof _0x1d68fd[_0x613f('0x1a')]===_0x613f('0x1b');var _0x544eca=_0x548218[_0x613f('0x1c')];var _0x4f9dae=_0x3c9edf?0x0:_0x1d68fd[_0x613f('0x1d')];var _0x1e5a11=_0x3c9edf?_0x548218[_0x613f('0x1c')]:_0x1d68fd[_0x613f('0x1d')]+_0x1d68fd[_0x613f('0x1a')];var _0x1ba35f;if(_0x1e5a11>=_0x544eca){_0x1e5a11=_0x544eca;_0x1ba35f=0xc8;}else{_0x1ba35f=0xce;}_0x2eee4d['status'](_0x1ba35f);return _0x2eee4d['set'](_0x613f('0x1e'),_0x4f9dae+'-'+_0x1e5a11+'/'+_0x544eca)['json'](_0x548218);}return null;};}function patchUpdates(_0x48493c){return function(_0x3c9b58){try{jsonpatch[_0x613f('0x1f')](_0x3c9b58,_0x48493c,!![]);}catch(_0x4f5a5a){return BPromise[_0x613f('0x20')](_0x4f5a5a);}return _0x3c9b58[_0x613f('0x21')]();};}function saveUpdates(_0x2aa14b,_0x48b28a){return function(_0x5401c2){if(_0x5401c2){return _0x5401c2[_0x613f('0x22')](_0x2aa14b)[_0x613f('0x23')](function(_0x2acfcf){return _0x2acfcf;});}return null;};}function removeEntity(_0x51f376,_0x41104e){return function(_0x33e0c6){if(_0x33e0c6){return _0x33e0c6[_0x613f('0x24')]()[_0x613f('0x23')](function(){var _0x3013a1=_0x33e0c6['get']({'plain':!![]});var _0x30fb15=_0x613f('0x25');return db['UserProfileResource'][_0x613f('0x24')]({'where':{'type':_0x30fb15,'resourceId':_0x3013a1['id']}})[_0x613f('0x23')](function(){return _0x33e0c6;});})[_0x613f('0x23')](function(){_0x51f376['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a4a8b,_0x379920){return function(_0x594c28){if(!_0x594c28){_0x5a4a8b[_0x613f('0x16')](0x194);}return _0x594c28;};}function handleError(_0x1767db,_0x4ca372){_0x4ca372=_0x4ca372||0x1f4;return function(_0x121241){logger[_0x613f('0x26')](_0x121241['stack']);if(_0x121241['name']){delete _0x121241['name'];}_0x1767db[_0x613f('0x17')](_0x4ca372)[_0x613f('0x27')](_0x121241);};}exports[_0x613f('0x28')]=function(_0x47f4af,_0x23eda8){var _0x439478={},_0xd335a6={},_0x19bb8f={'count':0x0,'rows':[]};var _0x4f8500=_[_0x613f('0x29')](db[_0x613f('0x2a')][_0x613f('0x2b')],function(_0x728f45){return{'name':_0x728f45[_0x613f('0x2c')],'type':_0x728f45[_0x613f('0x2d')]['key']};});_0xd335a6[_0x613f('0x2e')]=_[_0x613f('0x29')](_0x4f8500,_0x613f('0x2f'));_0xd335a6['query']=_[_0x613f('0x30')](_0x47f4af['query']);_0xd335a6[_0x613f('0x31')]=_[_0x613f('0x32')](_0xd335a6[_0x613f('0x2e')],_0xd335a6[_0x613f('0x33')]);_0x439478[_0x613f('0x34')]=_[_0x613f('0x32')](_0xd335a6['model'],qs[_0x613f('0x35')](_0x47f4af[_0x613f('0x33')][_0x613f('0x35')]));_0x439478[_0x613f('0x34')]=_0x439478[_0x613f('0x34')]['length']?_0x439478['attributes']:_0xd335a6['model'];if(!_0x47f4af[_0x613f('0x33')][_0x613f('0x36')](_0x613f('0x37'))){_0x439478[_0x613f('0x1a')]=qs['limit'](_0x47f4af[_0x613f('0x33')][_0x613f('0x1a')]);_0x439478['offset']=qs[_0x613f('0x1d')](_0x47f4af['query'][_0x613f('0x1d')]);}_0x439478['order']=qs[_0x613f('0x38')](_0x47f4af['query'][_0x613f('0x38')]);_0x439478[_0x613f('0x39')]=qs[_0x613f('0x31')](_['pick'](_0x47f4af[_0x613f('0x33')],_0xd335a6[_0x613f('0x31')]),_0x4f8500);if(_0x47f4af[_0x613f('0x33')][_0x613f('0x3a')]){_0x439478[_0x613f('0x39')]=_[_0x613f('0x3b')](_0x439478[_0x613f('0x39')],{'$or':_[_0x613f('0x29')](_0x4f8500,function(_0x1f71f3){if(_0x1f71f3[_0x613f('0x2d')]!=='VIRTUAL'){var _0x28b1bc={};_0x28b1bc[_0x1f71f3[_0x613f('0x2f')]]={'$like':'%'+_0x47f4af[_0x613f('0x33')][_0x613f('0x3a')]+'%'};return _0x28b1bc;}})});}_0x439478=_[_0x613f('0x3b')]({},_0x439478,_0x47f4af[_0x613f('0x3c')]);var _0xa76fff={'where':_0x439478['where']};return db[_0x613f('0x2a')][_0x613f('0x1c')](_0xa76fff)[_0x613f('0x23')](function(_0x3d2d7b){_0x19bb8f[_0x613f('0x1c')]=_0x3d2d7b;if(_0x47f4af[_0x613f('0x33')][_0x613f('0x3d')]){_0x439478['include']=[{'all':!![]}];}return db[_0x613f('0x2a')][_0x613f('0x3e')](_0x439478);})[_0x613f('0x23')](function(_0x2f584e){_0x19bb8f[_0x613f('0x3f')]=_0x2f584e;return _0x19bb8f;})[_0x613f('0x23')](respondWithFilteredResult(_0x23eda8,_0x439478))[_0x613f('0x40')](handleError(_0x23eda8,null));};exports[_0x613f('0x41')]=function(_0x403feb,_0x2d2574){var _0x12647a={'raw':!![],'where':{'id':_0x403feb[_0x613f('0x42')]['id']}},_0x258a71={};_0x258a71['model']=_[_0x613f('0x30')](db[_0x613f('0x2a')][_0x613f('0x2b')]);_0x258a71[_0x613f('0x33')]=_['keys'](_0x403feb[_0x613f('0x33')]);_0x258a71[_0x613f('0x31')]=_[_0x613f('0x32')](_0x258a71[_0x613f('0x2e')],_0x258a71[_0x613f('0x33')]);_0x12647a[_0x613f('0x34')]=_[_0x613f('0x32')](_0x258a71[_0x613f('0x2e')],qs[_0x613f('0x35')](_0x403feb[_0x613f('0x33')]['fields']));_0x12647a['attributes']=_0x12647a[_0x613f('0x34')][_0x613f('0x43')]?_0x12647a['attributes']:_0x258a71[_0x613f('0x2e')];if(_0x403feb[_0x613f('0x33')][_0x613f('0x3d')]){_0x12647a[_0x613f('0x44')]=[{'all':!![]}];}_0x12647a=_[_0x613f('0x3b')]({},_0x12647a,_0x403feb[_0x613f('0x3c')]);return db[_0x613f('0x2a')][_0x613f('0x45')](_0x12647a)[_0x613f('0x23')](handleEntityNotFound(_0x2d2574,null))[_0x613f('0x23')](respondWithResult(_0x2d2574,null))[_0x613f('0x40')](handleError(_0x2d2574,null));};exports[_0x613f('0x46')]=function(_0x174e22,_0x17f8e5){return db[_0x613f('0x2a')][_0x613f('0x46')](_0x174e22[_0x613f('0x47')],{})[_0x613f('0x23')](function(_0x5a4079){var _0x47c84b=_0x174e22[_0x613f('0x48')][_0x613f('0x49')]({'plain':!![]});if(!_0x47c84b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47c84b['role']===_0x613f('0x48')){var _0x51729a=_0x5a4079['get']({'plain':!![]});var _0x6e006b=_0x613f('0x25');return db[_0x613f('0x4a')]['find']({'where':{'name':_0x6e006b,'userProfileId':_0x47c84b[_0x613f('0x4b')]},'raw':!![]})[_0x613f('0x23')](function(_0x4f59b6){if(_0x4f59b6&&_0x4f59b6['autoAssociation']===0x0){return db[_0x613f('0x4c')][_0x613f('0x46')]({'name':_0x51729a[_0x613f('0x2f')],'resourceId':_0x51729a['id'],'type':_0x4f59b6[_0x613f('0x2f')],'sectionId':_0x4f59b6['id']},{})[_0x613f('0x23')](function(){return _0x5a4079;});}else{return _0x5a4079;}})[_0x613f('0x40')](function(_0x24d162){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24d162);throw _0x24d162;});}return _0x5a4079;})[_0x613f('0x23')](respondWithResult(_0x17f8e5,0xc9))['catch'](handleError(_0x17f8e5,null));};exports['update']=function(_0x387913,_0x52c2a6){if(_0x387913[_0x613f('0x47')]['id']){delete _0x387913['body']['id'];}return db[_0x613f('0x2a')][_0x613f('0x45')]({'where':{'id':_0x387913[_0x613f('0x42')]['id']}})[_0x613f('0x23')](handleEntityNotFound(_0x52c2a6,null))[_0x613f('0x23')](saveUpdates(_0x387913[_0x613f('0x47')],null))[_0x613f('0x23')](respondWithResult(_0x52c2a6,null))['catch'](handleError(_0x52c2a6,null));};exports[_0x613f('0x24')]=function(_0x4ff3ad,_0x3ce3dd){return db[_0x613f('0x2a')][_0x613f('0x45')]({'where':{'id':_0x4ff3ad[_0x613f('0x42')]['id']}})[_0x613f('0x23')](handleEntityNotFound(_0x3ce3dd,null))[_0x613f('0x23')](removeEntity(_0x3ce3dd,null))[_0x613f('0x40')](handleError(_0x3ce3dd,null));};exports[_0x613f('0x4d')]=function(_0x214d01,_0x49637d,_0x2ebce1){return db[_0x613f('0x2a')][_0x613f('0x4e')]({'where':{'id':_0x214d01['params']['id']}})['then'](handleEntityNotFound(_0x49637d,null))[_0x613f('0x23')](function(_0x4b6eb3){var _0xcb1c9d;var _0x3c3cd7={},_0x42a72b={};_0x42a72b[_0x613f('0x2e')]=_[_0x613f('0x30')](db[_0x613f('0x4f')][_0x613f('0x2b')]);_0x42a72b[_0x613f('0x33')]=_[_0x613f('0x30')](_0x214d01[_0x613f('0x33')]);_0x42a72b[_0x613f('0x31')]=_['intersection'](_0x42a72b[_0x613f('0x2e')],_0x42a72b[_0x613f('0x33')]);_0x3c3cd7[_0x613f('0x34')]=_[_0x613f('0x32')](_0x42a72b['model'],qs[_0x613f('0x35')](_0x214d01[_0x613f('0x33')]['fields']));_0x3c3cd7['attributes']=_0x3c3cd7[_0x613f('0x34')]['length']?_0x3c3cd7['attributes']:_0x42a72b['model'];if(!_0x214d01[_0x613f('0x33')]['hasOwnProperty']('nolimit')){_0x3c3cd7['limit']=qs[_0x613f('0x1a')](_0x214d01[_0x613f('0x33')]['limit']);_0x3c3cd7[_0x613f('0x1d')]=qs[_0x613f('0x1d')](_0x214d01[_0x613f('0x33')][_0x613f('0x1d')]);}_0x3c3cd7['order']=qs[_0x613f('0x38')](_0x214d01[_0x613f('0x33')]['sort']);_0x3c3cd7[_0x613f('0x39')]=qs[_0x613f('0x31')](_[_0x613f('0x50')](_0x214d01[_0x613f('0x33')],_0x42a72b[_0x613f('0x31')]));if(_0x214d01[_0x613f('0x33')][_0x613f('0x3a')]){_0x3c3cd7[_0x613f('0x39')]=_[_0x613f('0x3b')](_0x3c3cd7[_0x613f('0x39')],{'$or':_[_0x613f('0x29')](_0x3c3cd7[_0x613f('0x34')],function(_0x50d7ca){var _0x1c4e48={};_0x1c4e48[_0x50d7ca]={'$like':'%'+_0x214d01[_0x613f('0x33')][_0x613f('0x3a')]+'%'};return _0x1c4e48;})});}_0x3c3cd7[_0x613f('0x39')]=_[_0x613f('0x3b')](_0x3c3cd7[_0x613f('0x39')],{'mailboxuser':_0x4b6eb3['mailbox']});_0x3c3cd7=_[_0x613f('0x3b')]({},_0x3c3cd7,_0x214d01[_0x613f('0x3c')]);return db[_0x613f('0x4f')][_0x613f('0x51')](_0x3c3cd7)[_0x613f('0x23')](respondWithFilteredResult(_0x49637d,_0x3c3cd7));})[_0x613f('0x40')](handleError(_0x49637d,null));}; \ No newline at end of file +var _0x0565=['lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','then','destroy','Voicemails','sendStatus','stack','name','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','catch','error','update','findOne','VoiceMailMessage','mailbox','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0x547587,_0x48cbd9){var _0x3d7777=function(_0x3e5075){while(--_0x3e5075){_0x547587['push'](_0x547587['shift']());}};_0x3d7777(++_0x48cbd9);}(_0x0565,0xf2));var _0x5056=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x0565[_0x1da527];return _0x40fc7c;};'use strict';var emlformat=require(_0x5056('0x0'));var rimraf=require(_0x5056('0x1'));var zipdir=require(_0x5056('0x2'));var jsonpatch=require(_0x5056('0x3'));var rp=require(_0x5056('0x4'));var moment=require(_0x5056('0x5'));var BPromise=require(_0x5056('0x6'));var Mustache=require(_0x5056('0x7'));var util=require(_0x5056('0x8'));var path=require(_0x5056('0x9'));var sox=require('sox');var csv=require(_0x5056('0xa'));var ejs=require(_0x5056('0xb'));var fs=require('fs');var fs_extra=require(_0x5056('0xc'));var _=require(_0x5056('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5056('0xe'));var deskjs=require(_0x5056('0xf'));var toCsv=require(_0x5056('0xa'));var querystring=require(_0x5056('0x10'));var Papa=require(_0x5056('0x11'));var Redis=require(_0x5056('0x12'));var authService=require(_0x5056('0x13'));var qs=require(_0x5056('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5056('0x15'));var logger=require(_0x5056('0x16'))(_0x5056('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5056('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x548bcf,_0x53e98a){_0x53e98a=_0x53e98a||0xcc;return function(_0x2d44fb){if(_0x2d44fb){return _0x548bcf['sendStatus'](_0x53e98a);}return _0x548bcf[_0x5056('0x19')](_0x53e98a)[_0x5056('0x1a')]();};}function respondWithResult(_0x7af76b,_0x543cee){_0x543cee=_0x543cee||0xc8;return function(_0x1e8b64){if(_0x1e8b64){return _0x7af76b[_0x5056('0x19')](_0x543cee)[_0x5056('0x1b')](_0x1e8b64);}};}function respondWithFilteredResult(_0x56c3ef,_0x21561d){return function(_0x6a044a){if(_0x6a044a){var _0x4ac332=typeof _0x21561d[_0x5056('0x1c')]==='undefined'&&typeof _0x21561d[_0x5056('0x1d')]===_0x5056('0x1e');var _0x1c0ee9=_0x6a044a[_0x5056('0x1f')];var _0x4056ce=_0x4ac332?0x0:_0x21561d['offset'];var _0x9ea88=_0x4ac332?_0x6a044a[_0x5056('0x1f')]:_0x21561d['offset']+_0x21561d['limit'];var _0x20776c;if(_0x9ea88>=_0x1c0ee9){_0x9ea88=_0x1c0ee9;_0x20776c=0xc8;}else{_0x20776c=0xce;}_0x56c3ef[_0x5056('0x19')](_0x20776c);return _0x56c3ef[_0x5056('0x20')](_0x5056('0x21'),_0x4056ce+'-'+_0x9ea88+'/'+_0x1c0ee9)[_0x5056('0x1b')](_0x6a044a);}return null;};}function patchUpdates(_0xf04e08){return function(_0x33035c){try{jsonpatch['apply'](_0x33035c,_0xf04e08,!![]);}catch(_0x13b363){return BPromise[_0x5056('0x22')](_0x13b363);}return _0x33035c['save']();};}function saveUpdates(_0x271efc,_0x1bccef){return function(_0x2564d0){if(_0x2564d0){return _0x2564d0['update'](_0x271efc)[_0x5056('0x23')](function(_0x26a3c2){return _0x26a3c2;});}return null;};}function removeEntity(_0x5afbfe,_0x4a64be){return function(_0x29e166){if(_0x29e166){return _0x29e166[_0x5056('0x24')]()[_0x5056('0x23')](function(){var _0x37f7b5=_0x29e166['get']({'plain':!![]});var _0x267048=_0x5056('0x25');return db['UserProfileResource'][_0x5056('0x24')]({'where':{'type':_0x267048,'resourceId':_0x37f7b5['id']}})['then'](function(){return _0x29e166;});})[_0x5056('0x23')](function(){_0x5afbfe[_0x5056('0x19')](0xcc)[_0x5056('0x1a')]();});}};}function handleEntityNotFound(_0x2b8fab,_0x45f600){return function(_0x50f2a8){if(!_0x50f2a8){_0x2b8fab[_0x5056('0x26')](0x194);}return _0x50f2a8;};}function handleError(_0x346e9e,_0x14cb84){_0x14cb84=_0x14cb84||0x1f4;return function(_0x2ac79a){logger['error'](_0x2ac79a[_0x5056('0x27')]);if(_0x2ac79a['name']){delete _0x2ac79a[_0x5056('0x28')];}_0x346e9e['status'](_0x14cb84)['send'](_0x2ac79a);};}exports['index']=function(_0x113be0,_0x252f75){var _0x482939={},_0x27f4be={},_0x2c5728={'count':0x0,'rows':[]};var _0x9e2986=_[_0x5056('0x29')](db[_0x5056('0x2a')][_0x5056('0x2b')],function(_0x173fac){return{'name':_0x173fac[_0x5056('0x2c')],'type':_0x173fac[_0x5056('0x2d')][_0x5056('0x2e')]};});_0x27f4be[_0x5056('0x2f')]=_['map'](_0x9e2986,'name');_0x27f4be[_0x5056('0x30')]=_[_0x5056('0x31')](_0x113be0['query']);_0x27f4be[_0x5056('0x32')]=_[_0x5056('0x33')](_0x27f4be['model'],_0x27f4be[_0x5056('0x30')]);_0x482939[_0x5056('0x34')]=_[_0x5056('0x33')](_0x27f4be[_0x5056('0x2f')],qs[_0x5056('0x35')](_0x113be0[_0x5056('0x30')][_0x5056('0x35')]));_0x482939[_0x5056('0x34')]=_0x482939[_0x5056('0x34')][_0x5056('0x36')]?_0x482939[_0x5056('0x34')]:_0x27f4be[_0x5056('0x2f')];if(!_0x113be0[_0x5056('0x30')][_0x5056('0x37')](_0x5056('0x38'))){_0x482939['limit']=qs[_0x5056('0x1d')](_0x113be0['query'][_0x5056('0x1d')]);_0x482939[_0x5056('0x1c')]=qs[_0x5056('0x1c')](_0x113be0[_0x5056('0x30')]['offset']);}_0x482939[_0x5056('0x39')]=qs[_0x5056('0x3a')](_0x113be0['query'][_0x5056('0x3a')]);_0x482939['where']=qs[_0x5056('0x32')](_[_0x5056('0x3b')](_0x113be0[_0x5056('0x30')],_0x27f4be['filters']),_0x9e2986);if(_0x113be0[_0x5056('0x30')][_0x5056('0x3c')]){_0x482939[_0x5056('0x3d')]=_[_0x5056('0x3e')](_0x482939[_0x5056('0x3d')],{'$or':_[_0x5056('0x29')](_0x9e2986,function(_0x1aa311){if(_0x1aa311[_0x5056('0x2d')]!==_0x5056('0x3f')){var _0x430db0={};_0x430db0[_0x1aa311[_0x5056('0x28')]]={'$like':'%'+_0x113be0[_0x5056('0x30')][_0x5056('0x3c')]+'%'};return _0x430db0;}})});}_0x482939=_[_0x5056('0x3e')]({},_0x482939,_0x113be0[_0x5056('0x40')]);var _0x351ebd={'where':_0x482939['where']};return db['VoiceMail'][_0x5056('0x1f')](_0x351ebd)[_0x5056('0x23')](function(_0x6946b4){_0x2c5728[_0x5056('0x1f')]=_0x6946b4;if(_0x113be0[_0x5056('0x30')][_0x5056('0x41')]){_0x482939[_0x5056('0x42')]=[{'all':!![]}];}return db[_0x5056('0x2a')]['findAll'](_0x482939);})['then'](function(_0x68a385){_0x2c5728[_0x5056('0x43')]=_0x68a385;return _0x2c5728;})[_0x5056('0x23')](respondWithFilteredResult(_0x252f75,_0x482939))['catch'](handleError(_0x252f75,null));};exports[_0x5056('0x44')]=function(_0x5b99e9,_0x285fee){var _0x40375b={'raw':!![],'where':{'id':_0x5b99e9[_0x5056('0x45')]['id']}},_0x2ef93e={};_0x2ef93e[_0x5056('0x2f')]=_[_0x5056('0x31')](db['VoiceMail'][_0x5056('0x2b')]);_0x2ef93e[_0x5056('0x30')]=_[_0x5056('0x31')](_0x5b99e9['query']);_0x2ef93e['filters']=_['intersection'](_0x2ef93e['model'],_0x2ef93e[_0x5056('0x30')]);_0x40375b[_0x5056('0x34')]=_[_0x5056('0x33')](_0x2ef93e[_0x5056('0x2f')],qs[_0x5056('0x35')](_0x5b99e9['query']['fields']));_0x40375b[_0x5056('0x34')]=_0x40375b[_0x5056('0x34')][_0x5056('0x36')]?_0x40375b[_0x5056('0x34')]:_0x2ef93e[_0x5056('0x2f')];if(_0x5b99e9[_0x5056('0x30')][_0x5056('0x41')]){_0x40375b['include']=[{'all':!![]}];}_0x40375b=_['merge']({},_0x40375b,_0x5b99e9[_0x5056('0x40')]);return db[_0x5056('0x2a')]['find'](_0x40375b)[_0x5056('0x23')](handleEntityNotFound(_0x285fee,null))[_0x5056('0x23')](respondWithResult(_0x285fee,null))['catch'](handleError(_0x285fee,null));};exports['create']=function(_0x83d8e4,_0x1ab1a9){return db['VoiceMail']['create'](_0x83d8e4[_0x5056('0x46')],{})[_0x5056('0x23')](function(_0x528575){var _0x5c3f73=_0x83d8e4[_0x5056('0x47')][_0x5056('0x48')]({'plain':!![]});if(!_0x5c3f73)throw new Error(_0x5056('0x49'));if(_0x5c3f73[_0x5056('0x4a')]===_0x5056('0x47')){var _0xdf427c=_0x528575[_0x5056('0x48')]({'plain':!![]});var _0x366ba2=_0x5056('0x25');return db[_0x5056('0x4b')][_0x5056('0x4c')]({'where':{'name':_0x366ba2,'userProfileId':_0x5c3f73[_0x5056('0x4d')]},'raw':!![]})[_0x5056('0x23')](function(_0x327821){if(_0x327821&&_0x327821[_0x5056('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0xdf427c[_0x5056('0x28')],'resourceId':_0xdf427c['id'],'type':_0x327821[_0x5056('0x28')],'sectionId':_0x327821['id']},{})[_0x5056('0x23')](function(){return _0x528575;});}else{return _0x528575;}})[_0x5056('0x4f')](function(_0x35776b){logger[_0x5056('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x35776b);throw _0x35776b;});}return _0x528575;})[_0x5056('0x23')](respondWithResult(_0x1ab1a9,0xc9))[_0x5056('0x4f')](handleError(_0x1ab1a9,null));};exports[_0x5056('0x51')]=function(_0x3d22cc,_0x1ff74a){if(_0x3d22cc[_0x5056('0x46')]['id']){delete _0x3d22cc[_0x5056('0x46')]['id'];}return db[_0x5056('0x2a')][_0x5056('0x4c')]({'where':{'id':_0x3d22cc[_0x5056('0x45')]['id']}})[_0x5056('0x23')](handleEntityNotFound(_0x1ff74a,null))[_0x5056('0x23')](saveUpdates(_0x3d22cc[_0x5056('0x46')],null))['then'](respondWithResult(_0x1ff74a,null))[_0x5056('0x4f')](handleError(_0x1ff74a,null));};exports[_0x5056('0x24')]=function(_0x2df8e8,_0x5363fd){return db[_0x5056('0x2a')][_0x5056('0x4c')]({'where':{'id':_0x2df8e8[_0x5056('0x45')]['id']}})[_0x5056('0x23')](handleEntityNotFound(_0x5363fd,null))['then'](removeEntity(_0x5363fd,null))['catch'](handleError(_0x5363fd,null));};exports['getMessages']=function(_0x427007,_0x55ae24,_0x1934e1){return db[_0x5056('0x2a')][_0x5056('0x52')]({'where':{'id':_0x427007[_0x5056('0x45')]['id']}})[_0x5056('0x23')](handleEntityNotFound(_0x55ae24,null))[_0x5056('0x23')](function(_0x5330b4){var _0x48568b;var _0x25da13={},_0x333d22={};_0x333d22['model']=_[_0x5056('0x31')](db[_0x5056('0x53')][_0x5056('0x2b')]);_0x333d22[_0x5056('0x30')]=_[_0x5056('0x31')](_0x427007['query']);_0x333d22[_0x5056('0x32')]=_[_0x5056('0x33')](_0x333d22['model'],_0x333d22[_0x5056('0x30')]);_0x25da13[_0x5056('0x34')]=_[_0x5056('0x33')](_0x333d22[_0x5056('0x2f')],qs[_0x5056('0x35')](_0x427007[_0x5056('0x30')][_0x5056('0x35')]));_0x25da13[_0x5056('0x34')]=_0x25da13[_0x5056('0x34')][_0x5056('0x36')]?_0x25da13[_0x5056('0x34')]:_0x333d22[_0x5056('0x2f')];if(!_0x427007[_0x5056('0x30')]['hasOwnProperty'](_0x5056('0x38'))){_0x25da13[_0x5056('0x1d')]=qs[_0x5056('0x1d')](_0x427007[_0x5056('0x30')][_0x5056('0x1d')]);_0x25da13[_0x5056('0x1c')]=qs['offset'](_0x427007[_0x5056('0x30')]['offset']);}_0x25da13[_0x5056('0x39')]=qs[_0x5056('0x3a')](_0x427007['query']['sort']);_0x25da13[_0x5056('0x3d')]=qs[_0x5056('0x32')](_[_0x5056('0x3b')](_0x427007[_0x5056('0x30')],_0x333d22['filters']));if(_0x427007['query'][_0x5056('0x3c')]){_0x25da13[_0x5056('0x3d')]=_[_0x5056('0x3e')](_0x25da13['where'],{'$or':_[_0x5056('0x29')](_0x25da13['attributes'],function(_0x57cb62){var _0x1bfae9={};_0x1bfae9[_0x57cb62]={'$like':'%'+_0x427007[_0x5056('0x30')]['filter']+'%'};return _0x1bfae9;})});}_0x25da13[_0x5056('0x3d')]=_[_0x5056('0x3e')](_0x25da13[_0x5056('0x3d')],{'mailboxuser':_0x5330b4[_0x5056('0x54')]});_0x25da13=_[_0x5056('0x3e')]({},_0x25da13,_0x427007[_0x5056('0x40')]);return db[_0x5056('0x53')]['findAndCountAll'](_0x25da13)[_0x5056('0x23')](respondWithFilteredResult(_0x55ae24,_0x25da13));})[_0x5056('0x4f')](handleError(_0x55ae24,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 48ea480..c45948b 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 _0x23c3=['context','util','moment','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox'];(function(_0x10c9a0,_0x5dd803){var _0xf80043=function(_0x45edf4){while(--_0x45edf4){_0x10c9a0['push'](_0x10c9a0['shift']());}};_0xf80043(++_0x5dd803);}(_0x23c3,0x1a1));var _0x323c=function(_0x22cc16,_0x1f4fa2){_0x22cc16=_0x22cc16-0x0;var _0x399b70=_0x23c3[_0x22cc16];return _0x399b70;};'use strict';var _=require('lodash');var util=require(_0x323c('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x323c('0x1'));var BPromise=require('bluebird');var rp=require(_0x323c('0x2'));var fs=require('fs');var path=require(_0x323c('0x3'));var rimraf=require(_0x323c('0x4'));var config=require(_0x323c('0x5'));var attributes=require(_0x323c('0x6'));module[_0x323c('0x7')]=function(_0x2d3e8f,_0x17f8ac){return _0x2d3e8f[_0x323c('0x8')](_0x323c('0x9'),attributes,{'tableName':_0x323c('0xa'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x323c('0xb'),_0x323c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcf44=['../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox','context','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x334fea,_0x1f1e18){var _0x3c5829=function(_0x4fd6ac){while(--_0x4fd6ac){_0x334fea['push'](_0x334fea['shift']());}};_0x3c5829(++_0x1f1e18);}(_0xcf44,0xda));var _0x4cf4=function(_0x5b7218,_0x51cb1f){_0x5b7218=_0x5b7218-0x0;var _0x424010=_0xcf44[_0x5b7218];return _0x424010;};'use strict';var _=require(_0x4cf4('0x0'));var util=require(_0x4cf4('0x1'));var logger=require(_0x4cf4('0x2'))(_0x4cf4('0x3'));var moment=require(_0x4cf4('0x4'));var BPromise=require('bluebird');var rp=require(_0x4cf4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4cf4('0x6'));var config=require(_0x4cf4('0x7'));var attributes=require(_0x4cf4('0x8'));module[_0x4cf4('0x9')]=function(_0x673d1f,_0x53b902){return _0x673d1f[_0x4cf4('0xa')](_0x4cf4('0xb'),attributes,{'tableName':_0x4cf4('0xc'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x4cf4('0xd'),_0x4cf4('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index fc66db6..24ac583 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 _0xc80a=['error','message','VoiceMail,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xc80a,0x1d0));var _0xac80=function(_0x1ef167,_0x444fcd){_0x1ef167=_0x1ef167-0x0;var _0x594b71=_0xc80a[_0x1ef167];return _0x594b71;};'use strict';var _=require(_0xac80('0x0'));var util=require(_0xac80('0x1'));var moment=require(_0xac80('0x2'));var BPromise=require(_0xac80('0x3'));var rs=require(_0xac80('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac80('0x5'))['db'];var utils=require(_0xac80('0x6'));var logger=require('../../config/logger')(_0xac80('0x7'));var config=require(_0xac80('0x8'));var jayson=require(_0xac80('0x9'));var client=jayson[_0xac80('0xa')][_0xac80('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46f58b,_0x20c85e,_0x3d2f9c){return new BPromise(function(_0x4fa63f,_0x1a8502){return client[_0xac80('0xc')](_0x46f58b,_0x3d2f9c)[_0xac80('0xd')](function(_0xda1994){logger[_0xac80('0xe')]('VoiceMail,\x20%s,\x20%s',_0x20c85e,'request\x20sent');logger[_0xac80('0xf')](_0xac80('0x10'),_0x20c85e,_0xac80('0x11'),JSON[_0xac80('0x12')](_0xda1994));if(_0xda1994[_0xac80('0x13')]){if(_0xda1994[_0xac80('0x13')]['code']===0x1f4){logger[_0xac80('0x13')]('VoiceMail,\x20%s,\x20%s',_0x20c85e,_0xda1994[_0xac80('0x13')][_0xac80('0x14')]);return _0x1a8502(_0xda1994[_0xac80('0x13')]['message']);}logger[_0xac80('0x13')](_0xac80('0x15'),_0x20c85e,_0xda1994['error'][_0xac80('0x14')]);return _0x4fa63f(_0xda1994['error']['message']);}else{logger[_0xac80('0xe')](_0xac80('0x15'),_0x20c85e,_0xac80('0x11'));_0x4fa63f(_0xda1994['result'][_0xac80('0x14')]);}})[_0xac80('0x16')](function(_0x5debf5){logger['error'](_0xac80('0x15'),_0x20c85e,_0x5debf5);_0x1a8502(_0x5debf5);});});} \ No newline at end of file +var _0x1d4c=['../../config/environment','jayson/promise','http','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','randomstring','../../config/utils','../../config/logger'];(function(_0xa40210,_0x51c664){var _0xae0140=function(_0x259735){while(--_0x259735){_0xa40210['push'](_0xa40210['shift']());}};_0xae0140(++_0x51c664);}(_0x1d4c,0xa6));var _0xc1d4=function(_0x1a4c39,_0x22b9be){_0x1a4c39=_0x1a4c39-0x0;var _0x174630=_0x1d4c[_0x1a4c39];return _0x174630;};'use strict';var _=require(_0xc1d4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc1d4('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc1d4('0x2'));var logger=require(_0xc1d4('0x3'))('rpc');var config=require(_0xc1d4('0x4'));var jayson=require(_0xc1d4('0x5'));var client=jayson['client'][_0xc1d4('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2a9b33,_0x21a0a2,_0x8e7351){return new BPromise(function(_0x301473,_0x3c24ca){return client[_0xc1d4('0x7')](_0x2a9b33,_0x8e7351)['then'](function(_0x1564ca){logger[_0xc1d4('0x8')](_0xc1d4('0x9'),_0x21a0a2,_0xc1d4('0xa'));logger[_0xc1d4('0xb')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x21a0a2,'request\x20sent',JSON[_0xc1d4('0xc')](_0x1564ca));if(_0x1564ca[_0xc1d4('0xd')]){if(_0x1564ca['error'][_0xc1d4('0xe')]===0x1f4){logger[_0xc1d4('0xd')](_0xc1d4('0x9'),_0x21a0a2,_0x1564ca[_0xc1d4('0xd')][_0xc1d4('0xf')]);return _0x3c24ca(_0x1564ca['error'][_0xc1d4('0xf')]);}logger[_0xc1d4('0xd')](_0xc1d4('0x9'),_0x21a0a2,_0x1564ca[_0xc1d4('0xd')][_0xc1d4('0xf')]);return _0x301473(_0x1564ca['error']['message']);}else{logger['info'](_0xc1d4('0x9'),_0x21a0a2,_0xc1d4('0xa'));_0x301473(_0x1564ca[_0xc1d4('0x10')][_0xc1d4('0xf')]);}})['catch'](function(_0x53c022){logger['error'](_0xc1d4('0x9'),_0x21a0a2,_0x53c022);_0x3c24ca(_0x53c022);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 2bcebcc..ba1b11e 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 _0x9b39=['isAuthenticated','index','/:id','show','download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./voiceMailMessage.controller','get'];(function(_0x28240c,_0x4301c9){var _0x2bbe34=function(_0xbbe64a){while(--_0xbbe64a){_0x28240c['push'](_0x28240c['shift']());}};_0x2bbe34(++_0x4301c9);}(_0x9b39,0x132));var _0x99b3=function(_0x18841f,_0x4e8d18){_0x18841f=_0x18841f-0x0;var _0x17187a=_0x9b39[_0x18841f];return _0x17187a;};'use strict';var multer=require(_0x99b3('0x0'));var util=require(_0x99b3('0x1'));var path=require(_0x99b3('0x2'));var timeout=require(_0x99b3('0x3'));var express=require('express');var router=express[_0x99b3('0x4')]();var fs_extra=require(_0x99b3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x99b3('0x6'));var config=require('../../config/environment');var controller=require(_0x99b3('0x7'));router[_0x99b3('0x8')]('/',auth[_0x99b3('0x9')](),controller[_0x99b3('0xa')]);router[_0x99b3('0x8')](_0x99b3('0xb'),auth[_0x99b3('0x9')](),controller[_0x99b3('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x99b3('0xd')]);router[_0x99b3('0xe')]('/',auth[_0x99b3('0x9')](),controller[_0x99b3('0xf')]);router[_0x99b3('0x10')](_0x99b3('0xb'),auth[_0x99b3('0x9')](),controller[_0x99b3('0x11')]);router[_0x99b3('0x12')](_0x99b3('0xb'),auth[_0x99b3('0x9')](),controller[_0x99b3('0x13')]);module[_0x99b3('0x14')]=router; \ No newline at end of file +var _0xf286=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','index','show','/:id/download','download','post','/:id','delete','destroy','exports','util','path'];(function(_0x81dec8,_0x215d03){var _0x2eeb1b=function(_0x34a8ff){while(--_0x34a8ff){_0x81dec8['push'](_0x81dec8['shift']());}};_0x2eeb1b(++_0x215d03);}(_0xf286,0x1c6));var _0x6f28=function(_0x9d1e6b,_0x3bdc22){_0x9d1e6b=_0x9d1e6b-0x0;var _0x2b3070=_0xf286[_0x9d1e6b];return _0x2b3070;};'use strict';var multer=require('multer');var util=require(_0x6f28('0x0'));var path=require(_0x6f28('0x1'));var timeout=require('connect-timeout');var express=require(_0x6f28('0x2'));var router=express[_0x6f28('0x3')]();var fs_extra=require(_0x6f28('0x4'));var auth=require(_0x6f28('0x5'));var interaction=require(_0x6f28('0x6'));var config=require('../../config/environment');var controller=require(_0x6f28('0x7'));router[_0x6f28('0x8')]('/',auth[_0x6f28('0x9')](),controller[_0x6f28('0xa')]);router[_0x6f28('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x6f28('0xb')]);router[_0x6f28('0x8')](_0x6f28('0xc'),auth[_0x6f28('0x9')](),controller[_0x6f28('0xd')]);router[_0x6f28('0xe')]('/',auth[_0x6f28('0x9')](),controller['create']);router['put'](_0x6f28('0xf'),auth[_0x6f28('0x9')](),controller['update']);router[_0x6f28('0x10')](_0x6f28('0xf'),auth[_0x6f28('0x9')](),controller[_0x6f28('0x11')]);module[_0x6f28('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 4f17e23..efe162b 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 _0xa9b9=['long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','INTEGER','STRING','BLOB'];(function(_0x3c414c,_0x399dbb){var _0x4f3062=function(_0x1b71cc){while(--_0x1b71cc){_0x3c414c['push'](_0x3c414c['shift']());}};_0x4f3062(++_0x399dbb);}(_0xa9b9,0x16c));var _0x9a9b=function(_0x99868f,_0xbdb8e7){_0x99868f=_0x99868f-0x0;var _0x27a71b=_0xa9b9[_0x99868f];return _0x27a71b;};'use strict';var Sequelize=require('sequelize');module[_0x9a9b('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x293e5a){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x9a9b('0x1')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x9a9b('0x2')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x9a9b('0x2')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x9a9b('0x2')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x9a9b('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x9a9b('0x2')],'defaultValue':''},'recording':{'type':Sequelize[_0x9a9b('0x3')](_0x9a9b('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0x9a9b('0x2')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x9a9b('0x5'),'defaultValue':Sequelize[_0x9a9b('0x6')](_0x9a9b('0x7'))}}; \ No newline at end of file +var _0xb866=['VIRTUAL','getDataValue','INTEGER','STRING','TIMESTAMP','literal','sequelize','exports'];(function(_0x53ad58,_0x3fb489){var _0x554b03=function(_0x5769ba){while(--_0x5769ba){_0x53ad58['push'](_0x53ad58['shift']());}};_0x554b03(++_0x3fb489);}(_0xb866,0x7e));var _0x6b86=function(_0x12887f,_0xa12862){_0x12887f=_0x12887f-0x0;var _0x37668a=_0xb866[_0x12887f];return _0x37668a;};'use strict';var Sequelize=require(_0x6b86('0x0'));module[_0x6b86('0x1')]={'name':{'type':Sequelize[_0x6b86('0x2')],'get':function(_0x4e56f9){return this[_0x6b86('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x6b86('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x6b86('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x6b86('0x5')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x6b86('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x6b86('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x6b86('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB']('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x6b86('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x6b86('0x5')],'defaultValue':''},'stamp':{'type':_0x6b86('0x6'),'defaultValue':Sequelize[_0x6b86('0x7')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 55395c5..6ceacf6 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 _0x520f=['recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','attachment;\x20filename=\x22','.wav\x22','send','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','error','stack','name','index','map','VoiceMailMessage','rawAttributes','type','key','model','differenceBy','query','intersection','fields','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','attributes','length','find','create','body','download'];(function(_0x35f892,_0x13c4cf){var _0x144e18=function(_0x5cf729){while(--_0x5cf729){_0x35f892['push'](_0x35f892['shift']());}};_0x144e18(++_0x13c4cf);}(_0x520f,0x1a3));var _0xf520=function(_0x515e9f,_0xff9586){_0x515e9f=_0x515e9f-0x0;var _0x19cbf0=_0x520f[_0x515e9f];return _0x19cbf0;};'use strict';var emlformat=require(_0xf520('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf520('0x1'));var jsonpatch=require(_0xf520('0x2'));var rp=require('request-promise');var moment=require(_0xf520('0x3'));var BPromise=require(_0xf520('0x4'));var Mustache=require(_0xf520('0x5'));var util=require(_0xf520('0x6'));var path=require('path');var sox=require(_0xf520('0x7'));var csv=require(_0xf520('0x8'));var ejs=require(_0xf520('0x9'));var fs=require('fs');var fs_extra=require(_0xf520('0xa'));var _=require('lodash');var squel=require(_0xf520('0xb'));var crypto=require(_0xf520('0xc'));var jsforce=require(_0xf520('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf520('0x8'));var querystring=require(_0xf520('0xe'));var Papa=require('papaparse');var Redis=require(_0xf520('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf520('0x10'));var as=require(_0xf520('0x11'));var hardwareService=require(_0xf520('0x12'));var logger=require(_0xf520('0x13'))(_0xf520('0x14'));var utils=require(_0xf520('0x15'));var config=require(_0xf520('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf520('0x17'))['db'];function respondWithStatusCode(_0x1ce989,_0x2c7df7){_0x2c7df7=_0x2c7df7||0xcc;return function(_0xcb408b){if(_0xcb408b){return _0x1ce989['sendStatus'](_0x2c7df7);}return _0x1ce989[_0xf520('0x18')](_0x2c7df7)[_0xf520('0x19')]();};}function respondWithResult(_0x357cf2,_0x21dbda){_0x21dbda=_0x21dbda||0xc8;return function(_0xe4845f){if(_0xe4845f){return _0x357cf2[_0xf520('0x18')](_0x21dbda)['json'](_0xe4845f);}};}function respondWithFilteredResult(_0x2cf84b,_0x1ee356){return function(_0x4d55b4){if(_0x4d55b4){var _0x54f780=typeof _0x1ee356[_0xf520('0x1a')]===_0xf520('0x1b')&&typeof _0x1ee356[_0xf520('0x1c')]==='undefined';var _0x3b386b=_0x4d55b4['count'];var _0x258ca2=_0x54f780?0x0:_0x1ee356['offset'];var _0x4d6860=_0x54f780?_0x4d55b4[_0xf520('0x1d')]:_0x1ee356[_0xf520('0x1a')]+_0x1ee356[_0xf520('0x1c')];var _0x282838;if(_0x4d6860>=_0x3b386b){_0x4d6860=_0x3b386b;_0x282838=0xc8;}else{_0x282838=0xce;}_0x2cf84b['status'](_0x282838);return _0x2cf84b[_0xf520('0x1e')]('Content-Range',_0x258ca2+'-'+_0x4d6860+'/'+_0x3b386b)[_0xf520('0x1f')](_0x4d55b4);}return null;};}function patchUpdates(_0x1d85dd){return function(_0x5962f1){try{jsonpatch['apply'](_0x5962f1,_0x1d85dd,!![]);}catch(_0x321d30){return BPromise[_0xf520('0x20')](_0x321d30);}return _0x5962f1[_0xf520('0x21')]();};}function saveUpdates(_0x51c9c4,_0x138a56){return function(_0x2efb50){if(_0x2efb50){return _0x2efb50[_0xf520('0x22')](_0x51c9c4)[_0xf520('0x23')](function(_0x37e2d0){return _0x37e2d0;});}return null;};}function removeEntity(_0x4da386,_0x8b3584){return function(_0x41862d){if(_0x41862d){return _0x41862d[_0xf520('0x24')]()[_0xf520('0x23')](function(){_0x4da386[_0xf520('0x18')](0xcc)[_0xf520('0x19')]();});}};}function handleEntityNotFound(_0x5d48de,_0x538835){return function(_0x10b674){if(!_0x10b674){_0x5d48de['sendStatus'](0x194);}return _0x10b674;};}function handleError(_0x58ab3,_0x133e6c){_0x133e6c=_0x133e6c||0x1f4;return function(_0x44ad51){logger[_0xf520('0x25')](_0x44ad51[_0xf520('0x26')]);if(_0x44ad51[_0xf520('0x27')]){delete _0x44ad51[_0xf520('0x27')];}_0x58ab3[_0xf520('0x18')](_0x133e6c)['send'](_0x44ad51);};}exports[_0xf520('0x28')]=function(_0x37aa04,_0x1b177a){var _0x88841e={},_0x3968f5={},_0x5ec6a1={'count':0x0,'rows':[]};var _0x1ad790=_[_0xf520('0x29')](db[_0xf520('0x2a')][_0xf520('0x2b')],function(_0x5acdf1){return{'name':_0x5acdf1['fieldName'],'type':_0x5acdf1[_0xf520('0x2c')][_0xf520('0x2d')]};});_0x3968f5[_0xf520('0x2e')]=_[_0xf520('0x2f')](_[_0xf520('0x29')](_0x1ad790,_0xf520('0x27')),[_0xf520('0x27')]);_0x3968f5[_0xf520('0x30')]=_['keys'](_0x37aa04['query']);_0x3968f5['filters']=_[_0xf520('0x31')](_0x3968f5[_0xf520('0x2e')],_0x3968f5['query']);_0x88841e['attributes']=_[_0xf520('0x31')](_0x3968f5['model'],qs['fields'](_0x37aa04[_0xf520('0x30')][_0xf520('0x32')]));_0x88841e['attributes']=_0x88841e['attributes']['length']?_0x88841e['attributes']:_0x3968f5[_0xf520('0x2e')];if(!_0x37aa04[_0xf520('0x30')]['hasOwnProperty'](_0xf520('0x33'))){_0x88841e[_0xf520('0x1c')]=qs[_0xf520('0x1c')](_0x37aa04[_0xf520('0x30')][_0xf520('0x1c')]);_0x88841e[_0xf520('0x1a')]=qs[_0xf520('0x1a')](_0x37aa04[_0xf520('0x30')][_0xf520('0x1a')]);}_0x88841e['order']=qs['sort'](_0x37aa04[_0xf520('0x30')][_0xf520('0x34')]);_0x88841e[_0xf520('0x35')]=qs[_0xf520('0x36')](_[_0xf520('0x37')](_0x37aa04['query'],_0x3968f5[_0xf520('0x36')]),_0x1ad790);if(_0x37aa04['query'][_0xf520('0x38')]){_0x88841e['where']=_[_0xf520('0x39')](_0x88841e['where'],{'$or':_[_0xf520('0x29')](_0x1ad790,function(_0x1b6752){if(_0x1b6752[_0xf520('0x2c')]!==_0xf520('0x3a')){var _0x382850={};_0x382850[_0x1b6752[_0xf520('0x27')]]={'$like':'%'+_0x37aa04[_0xf520('0x30')]['filter']+'%'};return _0x382850;}})});}_0x88841e=_[_0xf520('0x39')]({},_0x88841e,_0x37aa04[_0xf520('0x3b')]);var _0xb7568={'where':_0x88841e['where']};return db[_0xf520('0x2a')][_0xf520('0x1d')](_0xb7568)['then'](function(_0x2a0353){_0x5ec6a1[_0xf520('0x1d')]=_0x2a0353;if(_0x37aa04[_0xf520('0x30')][_0xf520('0x3c')]){_0x88841e[_0xf520('0x3d')]=[{'all':!![]}];}return db[_0xf520('0x2a')]['findAll'](_0x88841e);})[_0xf520('0x23')](function(_0x5d4569){_0x5ec6a1[_0xf520('0x3e')]=_0x5d4569;return _0x5ec6a1;})['then'](respondWithFilteredResult(_0x1b177a,_0x88841e))[_0xf520('0x3f')](handleError(_0x1b177a,null));};exports[_0xf520('0x40')]=function(_0x542a82,_0x241257){var _0x4e4216={'raw':!![],'where':{'id':_0x542a82[_0xf520('0x41')]['id']}},_0x258693={};_0x258693[_0xf520('0x2e')]=_[_0xf520('0x42')](db['VoiceMailMessage']['rawAttributes']);_0x258693['query']=_[_0xf520('0x42')](_0x542a82[_0xf520('0x30')]);_0x258693[_0xf520('0x36')]=_[_0xf520('0x31')](_0x258693[_0xf520('0x2e')],_0x258693[_0xf520('0x30')]);_0x4e4216[_0xf520('0x43')]=_['intersection'](_0x258693['model'],qs[_0xf520('0x32')](_0x542a82[_0xf520('0x30')][_0xf520('0x32')]));_0x4e4216[_0xf520('0x43')]=_0x4e4216[_0xf520('0x43')][_0xf520('0x44')]?_0x4e4216[_0xf520('0x43')]:_0x258693[_0xf520('0x2e')];if(_0x542a82['query']['includeAll']){_0x4e4216[_0xf520('0x3d')]=[{'all':!![]}];}_0x4e4216=_[_0xf520('0x39')]({},_0x4e4216,_0x542a82[_0xf520('0x3b')]);return db[_0xf520('0x2a')][_0xf520('0x45')](_0x4e4216)['then'](handleEntityNotFound(_0x241257,null))['then'](respondWithResult(_0x241257,null))['catch'](handleError(_0x241257,null));};exports['create']=function(_0x4abf94,_0x56c832){return db['VoiceMailMessage'][_0xf520('0x46')](_0x4abf94[_0xf520('0x47')],{})[_0xf520('0x23')](respondWithResult(_0x56c832,0xc9))[_0xf520('0x3f')](handleError(_0x56c832,null));};exports[_0xf520('0x22')]=function(_0xb2535a,_0x432f8c){if(_0xb2535a[_0xf520('0x47')]['id']){delete _0xb2535a[_0xf520('0x47')]['id'];}return db[_0xf520('0x2a')][_0xf520('0x45')]({'where':{'id':_0xb2535a['params']['id']}})['then'](handleEntityNotFound(_0x432f8c,null))[_0xf520('0x23')](saveUpdates(_0xb2535a[_0xf520('0x47')],null))[_0xf520('0x23')](respondWithResult(_0x432f8c,null))[_0xf520('0x3f')](handleError(_0x432f8c,null));};exports[_0xf520('0x24')]=function(_0x270ca6,_0x4e00bd){return db[_0xf520('0x2a')][_0xf520('0x45')]({'where':{'id':_0x270ca6['params']['id']}})[_0xf520('0x23')](handleEntityNotFound(_0x4e00bd,null))[_0xf520('0x23')](removeEntity(_0x4e00bd,null))['catch'](handleError(_0x4e00bd,null));};exports[_0xf520('0x48')]=function(_0xb8b237,_0x2066e2,_0x508899){return db[_0xf520('0x2a')][_0xf520('0x45')]({'where':{'id':_0xb8b237[_0xf520('0x41')]['id']},'attributes':['id',_0xf520('0x49'),_0xf520('0x4a')]})['then'](handleEntityNotFound(_0x2066e2,null))[_0xf520('0x23')](function(_0xfe3579){if(_0xfe3579){if(!_0xfe3579[_0xf520('0x49')]){throw new db[(_0xf520('0x4b'))]['ValidationError'](_0xf520('0x4c'));}var _0xd22eab={'Content-Type':_0xf520('0x4d'),'Content-Disposition':_0xf520('0x4e')};if(_0xfe3579['msg_id']){_0xd22eab['Content-Disposition']=_0xf520('0x4f')+_0xfe3579[_0xf520('0x4a')]+_0xf520('0x50');}_0x2066e2[_0xf520('0x1e')](_0xd22eab);return _0x2066e2[_0xf520('0x51')](new Buffer(_0xfe3579[_0xf520('0x49')]));}})[_0xf520('0x3f')](handleError(_0x2066e2,null));}; \ No newline at end of file +var _0xa492=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','query','filters','model','intersection','fields','attributes','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','download','recording','msg_id','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','rimraf','zip-dir','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x103d4a,_0x48ef14){var _0x4a15dc=function(_0x1de9f4){while(--_0x1de9f4){_0x103d4a['push'](_0x103d4a['shift']());}};_0x4a15dc(++_0x48ef14);}(_0xa492,0x8f));var _0x2a49=function(_0x25763a,_0x4e1c00){_0x25763a=_0x25763a-0x0;var _0x4df5a7=_0xa492[_0x25763a];return _0x4df5a7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2a49('0x0'));var zipdir=require(_0x2a49('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2a49('0x2'));var Mustache=require(_0x2a49('0x3'));var util=require(_0x2a49('0x4'));var path=require(_0x2a49('0x5'));var sox=require('sox');var csv=require(_0x2a49('0x6'));var ejs=require(_0x2a49('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2a49('0x8'));var squel=require(_0x2a49('0x9'));var crypto=require(_0x2a49('0xa'));var jsforce=require(_0x2a49('0xb'));var deskjs=require(_0x2a49('0xc'));var toCsv=require(_0x2a49('0x6'));var querystring=require(_0x2a49('0xd'));var Papa=require(_0x2a49('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2a49('0xf'));var as=require(_0x2a49('0x10'));var hardwareService=require(_0x2a49('0x11'));var logger=require(_0x2a49('0x12'))('api');var utils=require(_0x2a49('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2a49('0x14'));var db=require(_0x2a49('0x15'))['db'];function respondWithStatusCode(_0x22f62e,_0x5ed672){_0x5ed672=_0x5ed672||0xcc;return function(_0x1c5d65){if(_0x1c5d65){return _0x22f62e[_0x2a49('0x16')](_0x5ed672);}return _0x22f62e[_0x2a49('0x17')](_0x5ed672)['end']();};}function respondWithResult(_0xd6e899,_0x496ef5){_0x496ef5=_0x496ef5||0xc8;return function(_0x13470f){if(_0x13470f){return _0xd6e899[_0x2a49('0x17')](_0x496ef5)[_0x2a49('0x18')](_0x13470f);}};}function respondWithFilteredResult(_0x27ab76,_0x156c6a){return function(_0x89d6df){if(_0x89d6df){var _0x50c346=typeof _0x156c6a[_0x2a49('0x19')]===_0x2a49('0x1a')&&typeof _0x156c6a[_0x2a49('0x1b')]===_0x2a49('0x1a');var _0x4d2728=_0x89d6df[_0x2a49('0x1c')];var _0x5dbf48=_0x50c346?0x0:_0x156c6a['offset'];var _0x2a4c38=_0x50c346?_0x89d6df['count']:_0x156c6a[_0x2a49('0x19')]+_0x156c6a[_0x2a49('0x1b')];var _0x266c65;if(_0x2a4c38>=_0x4d2728){_0x2a4c38=_0x4d2728;_0x266c65=0xc8;}else{_0x266c65=0xce;}_0x27ab76[_0x2a49('0x17')](_0x266c65);return _0x27ab76[_0x2a49('0x1d')](_0x2a49('0x1e'),_0x5dbf48+'-'+_0x2a4c38+'/'+_0x4d2728)[_0x2a49('0x18')](_0x89d6df);}return null;};}function patchUpdates(_0x20997e){return function(_0x4cc46b){try{jsonpatch['apply'](_0x4cc46b,_0x20997e,!![]);}catch(_0x25999e){return BPromise[_0x2a49('0x1f')](_0x25999e);}return _0x4cc46b[_0x2a49('0x20')]();};}function saveUpdates(_0x28ae50,_0xb72e71){return function(_0x3efc0e){if(_0x3efc0e){return _0x3efc0e[_0x2a49('0x21')](_0x28ae50)[_0x2a49('0x22')](function(_0x1fe469){return _0x1fe469;});}return null;};}function removeEntity(_0x19fe98,_0x4ef51c){return function(_0x599fcd){if(_0x599fcd){return _0x599fcd[_0x2a49('0x23')]()[_0x2a49('0x22')](function(){_0x19fe98[_0x2a49('0x17')](0xcc)[_0x2a49('0x24')]();});}};}function handleEntityNotFound(_0x49f87b,_0x56ef89){return function(_0x466f94){if(!_0x466f94){_0x49f87b[_0x2a49('0x16')](0x194);}return _0x466f94;};}function handleError(_0xd89bf8,_0x42b339){_0x42b339=_0x42b339||0x1f4;return function(_0x87d367){logger['error'](_0x87d367[_0x2a49('0x25')]);if(_0x87d367[_0x2a49('0x26')]){delete _0x87d367[_0x2a49('0x26')];}_0xd89bf8['status'](_0x42b339)[_0x2a49('0x27')](_0x87d367);};}exports[_0x2a49('0x28')]=function(_0x4348ce,_0x25fd0d){var _0x17a3f8={},_0x343b37={},_0x4fbea6={'count':0x0,'rows':[]};var _0x50281c=_[_0x2a49('0x29')](db[_0x2a49('0x2a')][_0x2a49('0x2b')],function(_0x5296dc){return{'name':_0x5296dc[_0x2a49('0x2c')],'type':_0x5296dc[_0x2a49('0x2d')][_0x2a49('0x2e')]};});_0x343b37['model']=_['differenceBy'](_['map'](_0x50281c,_0x2a49('0x26')),['name']);_0x343b37['query']=_['keys'](_0x4348ce[_0x2a49('0x2f')]);_0x343b37[_0x2a49('0x30')]=_['intersection'](_0x343b37[_0x2a49('0x31')],_0x343b37[_0x2a49('0x2f')]);_0x17a3f8['attributes']=_[_0x2a49('0x32')](_0x343b37[_0x2a49('0x31')],qs[_0x2a49('0x33')](_0x4348ce[_0x2a49('0x2f')][_0x2a49('0x33')]));_0x17a3f8[_0x2a49('0x34')]=_0x17a3f8[_0x2a49('0x34')][_0x2a49('0x35')]?_0x17a3f8[_0x2a49('0x34')]:_0x343b37[_0x2a49('0x31')];if(!_0x4348ce[_0x2a49('0x2f')]['hasOwnProperty']('nolimit')){_0x17a3f8[_0x2a49('0x1b')]=qs[_0x2a49('0x1b')](_0x4348ce[_0x2a49('0x2f')][_0x2a49('0x1b')]);_0x17a3f8[_0x2a49('0x19')]=qs[_0x2a49('0x19')](_0x4348ce[_0x2a49('0x2f')][_0x2a49('0x19')]);}_0x17a3f8['order']=qs['sort'](_0x4348ce[_0x2a49('0x2f')][_0x2a49('0x36')]);_0x17a3f8[_0x2a49('0x37')]=qs[_0x2a49('0x30')](_[_0x2a49('0x38')](_0x4348ce[_0x2a49('0x2f')],_0x343b37['filters']),_0x50281c);if(_0x4348ce[_0x2a49('0x2f')][_0x2a49('0x39')]){_0x17a3f8[_0x2a49('0x37')]=_[_0x2a49('0x3a')](_0x17a3f8[_0x2a49('0x37')],{'$or':_[_0x2a49('0x29')](_0x50281c,function(_0x23c896){if(_0x23c896[_0x2a49('0x2d')]!==_0x2a49('0x3b')){var _0x1032d8={};_0x1032d8[_0x23c896[_0x2a49('0x26')]]={'$like':'%'+_0x4348ce[_0x2a49('0x2f')][_0x2a49('0x39')]+'%'};return _0x1032d8;}})});}_0x17a3f8=_[_0x2a49('0x3a')]({},_0x17a3f8,_0x4348ce[_0x2a49('0x3c')]);var _0x39b71b={'where':_0x17a3f8[_0x2a49('0x37')]};return db[_0x2a49('0x2a')][_0x2a49('0x1c')](_0x39b71b)[_0x2a49('0x22')](function(_0x27e83){_0x4fbea6[_0x2a49('0x1c')]=_0x27e83;if(_0x4348ce[_0x2a49('0x2f')][_0x2a49('0x3d')]){_0x17a3f8[_0x2a49('0x3e')]=[{'all':!![]}];}return db[_0x2a49('0x2a')][_0x2a49('0x3f')](_0x17a3f8);})[_0x2a49('0x22')](function(_0x370e35){_0x4fbea6[_0x2a49('0x40')]=_0x370e35;return _0x4fbea6;})[_0x2a49('0x22')](respondWithFilteredResult(_0x25fd0d,_0x17a3f8))[_0x2a49('0x41')](handleError(_0x25fd0d,null));};exports[_0x2a49('0x42')]=function(_0x34c2dc,_0x30228a){var _0x17f028={'raw':!![],'where':{'id':_0x34c2dc[_0x2a49('0x43')]['id']}},_0x144c19={};_0x144c19[_0x2a49('0x31')]=_[_0x2a49('0x44')](db[_0x2a49('0x2a')][_0x2a49('0x2b')]);_0x144c19['query']=_[_0x2a49('0x44')](_0x34c2dc['query']);_0x144c19[_0x2a49('0x30')]=_[_0x2a49('0x32')](_0x144c19[_0x2a49('0x31')],_0x144c19['query']);_0x17f028[_0x2a49('0x34')]=_[_0x2a49('0x32')](_0x144c19['model'],qs[_0x2a49('0x33')](_0x34c2dc['query'][_0x2a49('0x33')]));_0x17f028['attributes']=_0x17f028[_0x2a49('0x34')][_0x2a49('0x35')]?_0x17f028[_0x2a49('0x34')]:_0x144c19[_0x2a49('0x31')];if(_0x34c2dc[_0x2a49('0x2f')][_0x2a49('0x3d')]){_0x17f028[_0x2a49('0x3e')]=[{'all':!![]}];}_0x17f028=_[_0x2a49('0x3a')]({},_0x17f028,_0x34c2dc[_0x2a49('0x3c')]);return db['VoiceMailMessage'][_0x2a49('0x45')](_0x17f028)[_0x2a49('0x22')](handleEntityNotFound(_0x30228a,null))[_0x2a49('0x22')](respondWithResult(_0x30228a,null))[_0x2a49('0x41')](handleError(_0x30228a,null));};exports[_0x2a49('0x46')]=function(_0x5ae078,_0x12dcea){return db[_0x2a49('0x2a')][_0x2a49('0x46')](_0x5ae078[_0x2a49('0x47')],{})[_0x2a49('0x22')](respondWithResult(_0x12dcea,0xc9))[_0x2a49('0x41')](handleError(_0x12dcea,null));};exports[_0x2a49('0x21')]=function(_0x5dbb28,_0xb93d15){if(_0x5dbb28['body']['id']){delete _0x5dbb28[_0x2a49('0x47')]['id'];}return db[_0x2a49('0x2a')][_0x2a49('0x45')]({'where':{'id':_0x5dbb28[_0x2a49('0x43')]['id']}})['then'](handleEntityNotFound(_0xb93d15,null))[_0x2a49('0x22')](saveUpdates(_0x5dbb28[_0x2a49('0x47')],null))[_0x2a49('0x22')](respondWithResult(_0xb93d15,null))['catch'](handleError(_0xb93d15,null));};exports[_0x2a49('0x23')]=function(_0x4b9fef,_0x563888){return db[_0x2a49('0x2a')]['find']({'where':{'id':_0x4b9fef[_0x2a49('0x43')]['id']}})['then'](handleEntityNotFound(_0x563888,null))['then'](removeEntity(_0x563888,null))['catch'](handleError(_0x563888,null));};exports[_0x2a49('0x48')]=function(_0x446505,_0x21a2b4,_0x58cc68){return db['VoiceMailMessage'][_0x2a49('0x45')]({'where':{'id':_0x446505[_0x2a49('0x43')]['id']},'attributes':['id',_0x2a49('0x49'),_0x2a49('0x4a')]})[_0x2a49('0x22')](handleEntityNotFound(_0x21a2b4,null))[_0x2a49('0x22')](function(_0x38dc41){if(_0x38dc41){if(!_0x38dc41['recording']){throw new db['Sequelize']['ValidationError'](_0x2a49('0x4b'));}var _0x5d027e={'Content-Type':'audio/wav','Content-Disposition':_0x2a49('0x4c')};if(_0x38dc41[_0x2a49('0x4a')]){_0x5d027e[_0x2a49('0x4d')]=_0x2a49('0x4e')+_0x38dc41[_0x2a49('0x4a')]+_0x2a49('0x4f');}_0x21a2b4[_0x2a49('0x1d')](_0x5d027e);return _0x21a2b4[_0x2a49('0x27')](new Buffer(_0x38dc41[_0x2a49('0x49')]));}})[_0x2a49('0x41')](handleError(_0x21a2b4,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index c488194..e93be03 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 _0x18ad=['path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','dir','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x5636cc,_0x1d76bb){var _0x324fb5=function(_0x28d72a){while(--_0x28d72a){_0x5636cc['push'](_0x5636cc['shift']());}};_0x324fb5(++_0x1d76bb);}(_0x18ad,0x19d));var _0xd18a=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x18ad[_0x2b7764];return _0x848dcb;};'use strict';var _=require(_0xd18a('0x0'));var util=require('util');var logger=require(_0xd18a('0x1'))(_0xd18a('0x2'));var moment=require('moment');var BPromise=require(_0xd18a('0x3'));var rp=require(_0xd18a('0x4'));var fs=require('fs');var path=require(_0xd18a('0x5'));var rimraf=require(_0xd18a('0x6'));var config=require(_0xd18a('0x7'));var attributes=require(_0xd18a('0x8'));module[_0xd18a('0x9')]=function(_0x2b71fa,_0x5b3ab0){return _0x2b71fa['define']('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xd18a('0xa'),'fields':[_0xd18a('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0xce85=['../../config/logger','moment','bluebird','path','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util'];(function(_0x2f8fbe,_0x194628){var _0x4aa12a=function(_0x5d2797){while(--_0x5d2797){_0x2f8fbe['push'](_0x2f8fbe['shift']());}};_0x4aa12a(++_0x194628);}(_0xce85,0x80));var _0x5ce8=function(_0x53a2e6,_0xcaff5c){_0x53a2e6=_0x53a2e6-0x0;var _0x4f13ac=_0xce85[_0x53a2e6];return _0x4f13ac;};'use strict';var _=require(_0x5ce8('0x0'));var util=require(_0x5ce8('0x1'));var logger=require(_0x5ce8('0x2'))('api');var moment=require(_0x5ce8('0x3'));var BPromise=require(_0x5ce8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ce8('0x5'));var rimraf=require('rimraf');var config=require(_0x5ce8('0x6'));var attributes=require(_0x5ce8('0x7'));module[_0x5ce8('0x8')]=function(_0x1a5572,_0xd6f84){return _0x1a5572[_0x5ce8('0x9')](_0x5ce8('0xa'),attributes,{'tableName':_0x5ce8('0xb'),'paranoid':![],'indexes':[{'name':_0x5ce8('0xc'),'fields':[_0x5ce8('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index d24dbaa..d536dc4 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 _0x8b72=['result','util','moment','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x9e05d1,_0x3cef4a){var _0x4f7e97=function(_0x402f40){while(--_0x402f40){_0x9e05d1['push'](_0x9e05d1['shift']());}};_0x4f7e97(++_0x3cef4a);}(_0x8b72,0x1d1));var _0x28b7=function(_0x567342,_0x3bbe75){_0x567342=_0x567342-0x0;var _0x334036=_0x8b72[_0x567342];return _0x334036;};'use strict';var _=require('lodash');var util=require(_0x28b7('0x0'));var moment=require(_0x28b7('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x28b7('0x2'))['db'];var utils=require(_0x28b7('0x3'));var logger=require(_0x28b7('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x28b7('0x5'));var client=jayson[_0x28b7('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x84b2b1,_0x4f0e97,_0x54c0ed){return new BPromise(function(_0x35f6f6,_0x3a4b53){return client['request'](_0x84b2b1,_0x54c0ed)['then'](function(_0x371b68){logger[_0x28b7('0x7')](_0x28b7('0x8'),_0x4f0e97,_0x28b7('0x9'));logger[_0x28b7('0xa')](_0x28b7('0xb'),_0x4f0e97,_0x28b7('0x9'),JSON[_0x28b7('0xc')](_0x371b68));if(_0x371b68[_0x28b7('0xd')]){if(_0x371b68[_0x28b7('0xd')]['code']===0x1f4){logger[_0x28b7('0xd')](_0x28b7('0x8'),_0x4f0e97,_0x371b68[_0x28b7('0xd')][_0x28b7('0xe')]);return _0x3a4b53(_0x371b68[_0x28b7('0xd')][_0x28b7('0xe')]);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x4f0e97,_0x371b68['error'][_0x28b7('0xe')]);return _0x35f6f6(_0x371b68[_0x28b7('0xd')][_0x28b7('0xe')]);}else{logger[_0x28b7('0x7')](_0x28b7('0x8'),_0x4f0e97,_0x28b7('0x9'));_0x35f6f6(_0x371b68[_0x28b7('0xf')][_0x28b7('0xe')]);}})['catch'](function(_0x19a4a4){logger['error'](_0x28b7('0x8'),_0x4f0e97,_0x19a4a4);_0x3a4b53(_0x19a4a4);});});} \ No newline at end of file +var _0x39cf=['then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x39cf,0x1ee));var _0xf39c=function(_0x5550b3,_0x2d0ee0){_0x5550b3=_0x5550b3-0x0;var _0x4b8fc4=_0x39cf[_0x5550b3];return _0x4b8fc4;};'use strict';var _=require(_0xf39c('0x0'));var util=require(_0xf39c('0x1'));var moment=require(_0xf39c('0x2'));var BPromise=require('bluebird');var rs=require(_0xf39c('0x3'));var fs=require('fs');var Redis=require(_0xf39c('0x4'));var db=require(_0xf39c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf39c('0x6'))(_0xf39c('0x7'));var config=require(_0xf39c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf39c('0x9')][_0xf39c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ab2ec,_0x3ce740,_0x33977f){return new BPromise(function(_0x3626ac,_0x3acc0e){return client[_0xf39c('0xb')](_0x5ab2ec,_0x33977f)[_0xf39c('0xc')](function(_0x254a35){logger[_0xf39c('0xd')](_0xf39c('0xe'),_0x3ce740,_0xf39c('0xf'));logger[_0xf39c('0x10')](_0xf39c('0x11'),_0x3ce740,'request\x20sent',JSON[_0xf39c('0x12')](_0x254a35));if(_0x254a35[_0xf39c('0x13')]){if(_0x254a35['error'][_0xf39c('0x14')]===0x1f4){logger[_0xf39c('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x3ce740,_0x254a35['error']['message']);return _0x3acc0e(_0x254a35[_0xf39c('0x13')][_0xf39c('0x15')]);}logger[_0xf39c('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x3ce740,_0x254a35['error'][_0xf39c('0x15')]);return _0x3626ac(_0x254a35['error'][_0xf39c('0x15')]);}else{logger['info'](_0xf39c('0xe'),_0x3ce740,'request\x20sent');_0x3626ac(_0x254a35['result']['message']);}})['catch'](function(_0x38318c){logger['error'](_0xf39c('0xe'),_0x3ce740,_0x38318c);_0x3acc0e(_0x38318c);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 50c5a5f..76fd34d 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 _0x24ae=['show','/:id/sounds','post','create','addSound','/:id','delete','destroy','removeSound','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x24ae,0x1ea));var _0xe24a=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x24ae[_0xaa1b3e];return _0x454d7d;};'use strict';var multer=require(_0xe24a('0x0'));var util=require(_0xe24a('0x1'));var path=require('path');var timeout=require(_0xe24a('0x2'));var express=require(_0xe24a('0x3'));var router=express[_0xe24a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe24a('0x5'));var interaction=require(_0xe24a('0x6'));var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth[_0xe24a('0x7')](),controller[_0xe24a('0x8')]);router[_0xe24a('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe24a('0xa')]);router[_0xe24a('0x9')](_0xe24a('0xb'),auth['isAuthenticated'](),controller['getSounds']);router[_0xe24a('0xc')]('/',auth[_0xe24a('0x7')](),controller[_0xe24a('0xd')]);router[_0xe24a('0xc')]('/:id/sounds',auth[_0xe24a('0x7')](),controller[_0xe24a('0xe')]);router['put'](_0xe24a('0xf'),auth[_0xe24a('0x7')](),controller['update']);router[_0xe24a('0x10')](_0xe24a('0xf'),auth[_0xe24a('0x7')](),controller[_0xe24a('0x11')]);router[_0xe24a('0x10')]('/:id/sounds/:id2',auth[_0xe24a('0x7')](),controller[_0xe24a('0x12')]);module[_0xe24a('0x13')]=router; \ No newline at end of file +var _0x0ee9=['index','/:id','show','/:id/sounds','create','addSound','put','destroy','delete','/:id/sounds/:id2','removeSound','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated'];(function(_0xff7c05,_0x2456ca){var _0x1c1ab9=function(_0x187d56){while(--_0x187d56){_0xff7c05['push'](_0xff7c05['shift']());}};_0x1c1ab9(++_0x2456ca);}(_0x0ee9,0x165));var _0x90ee=function(_0x37038e,_0x40809f){_0x37038e=_0x37038e-0x0;var _0xa28216=_0x0ee9[_0x37038e];return _0xa28216;};'use strict';var multer=require(_0x90ee('0x0'));var util=require(_0x90ee('0x1'));var path=require(_0x90ee('0x2'));var timeout=require('connect-timeout');var express=require(_0x90ee('0x3'));var router=express[_0x90ee('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x90ee('0x5'));var interaction=require(_0x90ee('0x6'));var config=require(_0x90ee('0x7'));var controller=require(_0x90ee('0x8'));router[_0x90ee('0x9')]('/',auth[_0x90ee('0xa')](),controller[_0x90ee('0xb')]);router['get'](_0x90ee('0xc'),auth[_0x90ee('0xa')](),controller[_0x90ee('0xd')]);router['get'](_0x90ee('0xe'),auth[_0x90ee('0xa')](),controller['getSounds']);router['post']('/',auth[_0x90ee('0xa')](),controller[_0x90ee('0xf')]);router['post']('/:id/sounds',auth[_0x90ee('0xa')](),controller[_0x90ee('0x10')]);router[_0x90ee('0x11')](_0x90ee('0xc'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x90ee('0xa')](),controller[_0x90ee('0x12')]);router[_0x90ee('0x13')](_0x90ee('0x14'),auth['isAuthenticated'](),controller[_0x90ee('0x15')]);module[_0x90ee('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 5c2fedc..d63ae2b 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 _0x6ded=['custom','files','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM'];(function(_0x17218c,_0x3e8bf6){var _0x2fb49a=function(_0x1d293c){while(--_0x1d293c){_0x17218c['push'](_0x17218c['shift']());}};_0x2fb49a(++_0x3e8bf6);}(_0x6ded,0xff));var _0xd6de=function(_0x302cb2,_0x2f0c30){_0x302cb2=_0x302cb2-0x0;var _0x4f1403=_0x6ded[_0x302cb2];return _0x4f1403;};'use strict';var Sequelize=require(_0xd6de('0x0'));module[_0xd6de('0x1')]={'name':{'type':Sequelize[_0xd6de('0x2')],'allowNull':![],'unique':_0xd6de('0x3')},'mode':{'type':Sequelize[_0xd6de('0x4')](_0xd6de('0x5'),_0xd6de('0x6'),'mp3nb',_0xd6de('0x7'),_0xd6de('0x8'),_0xd6de('0x9')),'allowNull':!![],'defaultValue':_0xd6de('0x6')},'directory':{'type':Sequelize[_0xd6de('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xd6de('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xd6de('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xd6de('0x2')],'allowNull':!![],'defaultValue':_0xd6de('0xa')},'format':{'type':Sequelize[_0xd6de('0x2')],'allowNull':!![]},'stamp':{'type':_0xd6de('0xb')},'defaultEntry':{'type':Sequelize[_0xd6de('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc009=['custom','quietmp3nb','quietmp3','files','STRING','TIMESTAMP','BOOLEAN','sequelize','exports','name'];(function(_0x4f920d,_0x221271){var _0x2120e0=function(_0x468736){while(--_0x468736){_0x4f920d['push'](_0x4f920d['shift']());}};_0x2120e0(++_0x221271);}(_0xc009,0x179));var _0x9c00=function(_0x480e7f,_0x199e38){_0x480e7f=_0x480e7f-0x0;var _0x4b432a=_0xc009[_0x480e7f];return _0x4b432a;};'use strict';var Sequelize=require(_0x9c00('0x0'));module[_0x9c00('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9c00('0x2')},'mode':{'type':Sequelize['ENUM'](_0x9c00('0x3'),'files','mp3nb',_0x9c00('0x4'),_0x9c00('0x5'),'mp3'),'allowNull':!![],'defaultValue':_0x9c00('0x6')},'directory':{'type':Sequelize[_0x9c00('0x7')],'allowNull':!![]},'application':{'type':Sequelize[_0x9c00('0x7')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x9c00('0x7')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x9c00('0x8')},'defaultEntry':{'type':Sequelize[_0x9c00('0x9')],'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 33e5aab..b6ccf38 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 _0x37d8=['directory','join','server/files/moh','mkdirSync','0777','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','root','server/files/sounds/converted','%s.%s','basename','extname','removeSound','id2','format','getSounds','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','status','set','Content-Range','apply','reject','save','then','destroy','MusicOnHolds','UserProfileResource','error','stack','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','find','update','body','create','sequelize','transaction','mode','files'];(function(_0x182647,_0x5e98ed){var _0x1b9847=function(_0x24dff7){while(--_0x24dff7){_0x182647['push'](_0x182647['shift']());}};_0x1b9847(++_0x5e98ed);}(_0x37d8,0x95));var _0x837d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x37d8[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x837d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x837d('0x1'));var rp=require(_0x837d('0x2'));var moment=require('moment');var BPromise=require(_0x837d('0x3'));var Mustache=require(_0x837d('0x4'));var util=require(_0x837d('0x5'));var path=require(_0x837d('0x6'));var sox=require(_0x837d('0x7'));var csv=require('to-csv');var ejs=require(_0x837d('0x8'));var fs=require('fs');var fs_extra=require(_0x837d('0x9'));var _=require('lodash');var squel=require(_0x837d('0xa'));var crypto=require('crypto');var jsforce=require(_0x837d('0xb'));var deskjs=require(_0x837d('0xc'));var toCsv=require(_0x837d('0xd'));var querystring=require(_0x837d('0xe'));var Papa=require(_0x837d('0xf'));var Redis=require('ioredis');var authService=require(_0x837d('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x837d('0x11'))(_0x837d('0x12'));var utils=require(_0x837d('0x13'));var config=require(_0x837d('0x14'));var licenseUtil=require(_0x837d('0x15'));var db=require(_0x837d('0x16'))['db'];function respondWithStatusCode(_0xa88946,_0x50632a){_0x50632a=_0x50632a||0xcc;return function(_0x70a8f5){if(_0x70a8f5){return _0xa88946[_0x837d('0x17')](_0x50632a);}return _0xa88946['status'](_0x50632a)[_0x837d('0x18')]();};}function respondWithResult(_0x5147e6,_0x2ad005){_0x2ad005=_0x2ad005||0xc8;return function(_0x5eb506){if(_0x5eb506){return _0x5147e6['status'](_0x2ad005)[_0x837d('0x19')](_0x5eb506);}};}function respondWithFilteredResult(_0x1d75c6,_0x43fc5f){return function(_0x3fd3a5){if(_0x3fd3a5){var _0xc7863e=typeof _0x43fc5f[_0x837d('0x1a')]===_0x837d('0x1b')&&typeof _0x43fc5f[_0x837d('0x1c')]===_0x837d('0x1b');var _0x5a62f0=_0x3fd3a5['count'];var _0x236675=_0xc7863e?0x0:_0x43fc5f[_0x837d('0x1a')];var _0x515a20=_0xc7863e?_0x3fd3a5['count']:_0x43fc5f[_0x837d('0x1a')]+_0x43fc5f[_0x837d('0x1c')];var _0x3159aa;if(_0x515a20>=_0x5a62f0){_0x515a20=_0x5a62f0;_0x3159aa=0xc8;}else{_0x3159aa=0xce;}_0x1d75c6[_0x837d('0x1d')](_0x3159aa);return _0x1d75c6[_0x837d('0x1e')](_0x837d('0x1f'),_0x236675+'-'+_0x515a20+'/'+_0x5a62f0)[_0x837d('0x19')](_0x3fd3a5);}return null;};}function patchUpdates(_0x272c6c){return function(_0x3c6894){try{jsonpatch[_0x837d('0x20')](_0x3c6894,_0x272c6c,!![]);}catch(_0x3e84c5){return BPromise[_0x837d('0x21')](_0x3e84c5);}return _0x3c6894[_0x837d('0x22')]();};}function saveUpdates(_0x1451d9,_0x1d6029){return function(_0x58206f){if(_0x58206f){return _0x58206f['update'](_0x1451d9)[_0x837d('0x23')](function(_0x568380){return _0x568380;});}return null;};}function removeEntity(_0x331d9a,_0x963a31){return function(_0x7667af){if(_0x7667af){return _0x7667af[_0x837d('0x24')]()['then'](function(){var _0x399507=_0x7667af['get']({'plain':!![]});var _0x4af99c=_0x837d('0x25');return db[_0x837d('0x26')][_0x837d('0x24')]({'where':{'type':_0x4af99c,'resourceId':_0x399507['id']}})['then'](function(){return _0x7667af;});})['then'](function(){_0x331d9a[_0x837d('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38a653,_0x591496){return function(_0x44ef06){if(!_0x44ef06){_0x38a653['sendStatus'](0x194);}return _0x44ef06;};}function handleError(_0x22c237,_0x3f40d2){_0x3f40d2=_0x3f40d2||0x1f4;return function(_0x5d316b){logger[_0x837d('0x27')](_0x5d316b[_0x837d('0x28')]);if(_0x5d316b[_0x837d('0x29')]){delete _0x5d316b[_0x837d('0x29')];}_0x22c237['status'](_0x3f40d2)[_0x837d('0x2a')](_0x5d316b);};}exports['index']=function(_0x37b990,_0x2a2ce4){var _0x63d378={},_0x23c5f7={},_0x274aa6={'count':0x0,'rows':[]};var _0x42cd01=_[_0x837d('0x2b')](db[_0x837d('0x2c')][_0x837d('0x2d')],function(_0x56d16e){return{'name':_0x56d16e[_0x837d('0x2e')],'type':_0x56d16e[_0x837d('0x2f')][_0x837d('0x30')]};});_0x23c5f7[_0x837d('0x31')]=_[_0x837d('0x2b')](_0x42cd01,_0x837d('0x29'));_0x23c5f7[_0x837d('0x32')]=_[_0x837d('0x33')](_0x37b990['query']);_0x23c5f7['filters']=_[_0x837d('0x34')](_0x23c5f7['model'],_0x23c5f7[_0x837d('0x32')]);_0x63d378[_0x837d('0x35')]=_['intersection'](_0x23c5f7[_0x837d('0x31')],qs[_0x837d('0x36')](_0x37b990[_0x837d('0x32')]['fields']));_0x63d378['attributes']=_0x63d378['attributes'][_0x837d('0x37')]?_0x63d378[_0x837d('0x35')]:_0x23c5f7[_0x837d('0x31')];if(!_0x37b990[_0x837d('0x32')][_0x837d('0x38')](_0x837d('0x39'))){_0x63d378[_0x837d('0x1c')]=qs['limit'](_0x37b990[_0x837d('0x32')][_0x837d('0x1c')]);_0x63d378[_0x837d('0x1a')]=qs['offset'](_0x37b990['query'][_0x837d('0x1a')]);}_0x63d378[_0x837d('0x3a')]=qs[_0x837d('0x3b')](_0x37b990[_0x837d('0x32')][_0x837d('0x3b')]);delete _0x37b990['query'][_0x837d('0x3b')];_0x63d378[_0x837d('0x3c')]=qs['filters'](_[_0x837d('0x3d')](_0x37b990[_0x837d('0x32')],_0x23c5f7[_0x837d('0x3e')]),_0x42cd01);if(_0x37b990[_0x837d('0x32')]['filter']){_0x63d378[_0x837d('0x3c')]=_['merge'](_0x63d378[_0x837d('0x3c')],{'$or':_['map'](_0x42cd01,function(_0x42d737){if(_0x42d737['type']!==_0x837d('0x3f')){var _0x2151d0={};_0x2151d0[_0x42d737['name']]={'$like':'%'+_0x37b990[_0x837d('0x32')][_0x837d('0x40')]+'%'};return _0x2151d0;}})});}_0x63d378=_[_0x837d('0x41')]({},_0x63d378,_0x37b990[_0x837d('0x42')]);var _0x5ae9d4={'where':_0x63d378[_0x837d('0x3c')]};return db[_0x837d('0x2c')][_0x837d('0x43')](_0x5ae9d4)[_0x837d('0x23')](function(_0x5a961f){_0x274aa6[_0x837d('0x43')]=_0x5a961f;if(_0x37b990[_0x837d('0x32')][_0x837d('0x44')]){_0x63d378[_0x837d('0x45')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x837d('0x46')](_0x63d378);})[_0x837d('0x23')](function(_0x11b202){_0x274aa6[_0x837d('0x47')]=_0x11b202;return _0x274aa6;})[_0x837d('0x23')](respondWithFilteredResult(_0x2a2ce4,_0x63d378))[_0x837d('0x48')](handleError(_0x2a2ce4,null));};exports[_0x837d('0x49')]=function(_0x2710fb,_0x332883){var _0x2dc63a={'raw':![],'where':{'id':_0x2710fb[_0x837d('0x4a')]['id']}},_0x3e9f87={};_0x3e9f87[_0x837d('0x31')]=_[_0x837d('0x33')](db[_0x837d('0x2c')]['rawAttributes']);_0x3e9f87[_0x837d('0x32')]=_['keys'](_0x2710fb[_0x837d('0x32')]);_0x3e9f87[_0x837d('0x3e')]=_['intersection'](_0x3e9f87[_0x837d('0x31')],_0x3e9f87['query']);_0x2dc63a[_0x837d('0x35')]=_[_0x837d('0x34')](_0x3e9f87[_0x837d('0x31')],qs[_0x837d('0x36')](_0x2710fb[_0x837d('0x32')]['fields']));_0x2dc63a[_0x837d('0x35')]=_0x2dc63a['attributes'][_0x837d('0x37')]?_0x2dc63a['attributes']:_0x3e9f87[_0x837d('0x31')];if(_0x2710fb['query']['includeAll']){_0x2dc63a[_0x837d('0x45')]=[{'all':!![]}];}_0x2dc63a=_[_0x837d('0x41')]({},_0x2dc63a,_0x2710fb[_0x837d('0x42')]);return db['VoiceMusicOnHold'][_0x837d('0x4b')](_0x2dc63a)[_0x837d('0x23')](handleEntityNotFound(_0x332883,null))[_0x837d('0x23')](respondWithResult(_0x332883,null))[_0x837d('0x48')](handleError(_0x332883,null));};exports[_0x837d('0x4c')]=function(_0x82d840,_0x1f465c){if(_0x82d840[_0x837d('0x4d')]['id']){delete _0x82d840['body']['id'];}return db[_0x837d('0x2c')][_0x837d('0x4b')]({'where':{'id':_0x82d840[_0x837d('0x4a')]['id']}})[_0x837d('0x23')](handleEntityNotFound(_0x1f465c,null))[_0x837d('0x23')](saveUpdates(_0x82d840['body'],null))[_0x837d('0x23')](respondWithResult(_0x1f465c,null))[_0x837d('0x48')](handleError(_0x1f465c,null));};exports[_0x837d('0x4e')]=function(_0x25ebf1,_0x47b74d,_0x82caff){return db[_0x837d('0x4f')][_0x837d('0x50')](function(_0x58cdcf){if(_0x25ebf1[_0x837d('0x4d')][_0x837d('0x51')]===_0x837d('0x52')){_0x25ebf1[_0x837d('0x4d')][_0x837d('0x53')]=path[_0x837d('0x54')](config['root'],_0x837d('0x55'),_0x25ebf1[_0x837d('0x4d')][_0x837d('0x29')]);}return db['VoiceMusicOnHold'][_0x837d('0x4e')](_0x25ebf1[_0x837d('0x4d')],{'transaction':_0x58cdcf})[_0x837d('0x23')](function(_0x287642){if(_0x25ebf1['body']['mode']===_0x837d('0x52')){fs[_0x837d('0x56')](_0x287642['directory'],parseInt(_0x837d('0x57'),0x8));}var _0x460f47=_0x25ebf1['user'][_0x837d('0x58')]({'plain':!![]});if(!_0x460f47)throw new Error(_0x837d('0x59'));if(_0x460f47[_0x837d('0x5a')]===_0x837d('0x5b')){var _0x3f7179=_0x287642[_0x837d('0x58')]({'plain':!![]});return db[_0x837d('0x5c')][_0x837d('0x4b')]({'where':{'name':'MusicOnHolds','userProfileId':_0x460f47['userProfileId']},'raw':!![]})[_0x837d('0x23')](function(_0x113a34){if(_0x113a34&&_0x113a34[_0x837d('0x5d')]===0x0){return db[_0x837d('0x26')][_0x837d('0x4e')]({'name':_0x3f7179[_0x837d('0x29')],'resourceId':_0x3f7179['id'],'type':_0x113a34[_0x837d('0x29')],'sectionId':_0x113a34['id']},{})[_0x837d('0x23')](function(){return _0x287642;});}else{return _0x287642;}})[_0x837d('0x48')](function(_0x4232c9){logger[_0x837d('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4232c9);});}return _0x287642;});})[_0x837d('0x23')](respondWithResult(_0x47b74d,0xc9))[_0x837d('0x48')](handleError(_0x47b74d,null));};exports['destroy']=function(_0x51b5e1,_0x2fbcb0,_0x2c8a6c){var _0x18dc7f;return db[_0x837d('0x2c')][_0x837d('0x4b')]({'where':{'id':_0x51b5e1[_0x837d('0x4a')]['id']}})['then'](function(_0x517493){if(_0x517493){return db['sequelize'][_0x837d('0x50')](function(_0x38cb92){return _0x517493['destroy']({'transaction':_0x38cb92,'raw':!![]})[_0x837d('0x23')](function(_0x31cd2f){if(_0x31cd2f[_0x837d('0x53')]){fs[_0x837d('0x5e')](_0x31cd2f[_0x837d('0x53')])[_0x837d('0x5f')](function(_0x62e8bd){fs[_0x837d('0x60')](path[_0x837d('0x54')](_0x31cd2f[_0x837d('0x53')],_0x62e8bd));});fs[_0x837d('0x61')](_0x31cd2f[_0x837d('0x53')]);}return _0x31cd2f;});})['catch'](function(_0x156cb5){throw new db[(_0x837d('0x62'))][(_0x837d('0x63'))](_0x156cb5[_0x837d('0x64')]);});}})[_0x837d('0x23')](handleEntityNotFound(_0x2fbcb0,null))[_0x837d('0x23')](removeEntity(_0x2fbcb0,null))[_0x837d('0x48')](handleError(_0x2fbcb0,null));};exports[_0x837d('0x65')]=function(_0x5b0093,_0x90d0fa,_0x2021f5){return db[_0x837d('0x4f')]['transaction'](function(_0x1e1722){var _0x2455f5;return db[_0x837d('0x2c')][_0x837d('0x4b')]({'where':{'id':_0x5b0093[_0x837d('0x4a')]['id']}})[_0x837d('0x23')](function(_0x5989d5){if(_0x5989d5){_0x2455f5=_0x5989d5;return _0x5989d5[_0x837d('0x65')](_0x5b0093[_0x837d('0x4d')]['id'],{'transaction':_0x1e1722});}})[_0x837d('0x23')](function(_0x18cd83){if(_0x18cd83){return db[_0x837d('0x66')][_0x837d('0x67')]({'where':{'id':_0x5b0093['body']['id']},'attributes':['id',_0x837d('0x29'),_0x837d('0x68'),_0x837d('0x69'),_0x837d('0x6a')],'raw':!![]});}})[_0x837d('0x23')](function(_0x98f108){if(_0x98f108){var _0x1807a7=path[_0x837d('0x54')](config[_0x837d('0x6b')],_0x837d('0x6c'),util['format'](_0x837d('0x6d'),path[_0x837d('0x6e')](_0x98f108['save_name'],path[_0x837d('0x6f')](_0x98f108['save_name'])),_0x98f108[_0x837d('0x69')]));var _0x5664a8=path['join'](config['root'],_0x837d('0x55'),_0x2455f5[_0x837d('0x29')],util['format'](_0x837d('0x6d'),_0x98f108[_0x837d('0x29')],_0x98f108['converted_format']));fs['symlinkSync'](_0x1807a7,_0x5664a8);return _0x98f108;}})['catch'](function(_0x1238f2){throw new db['Sequelize'][(_0x837d('0x63'))](_0x1238f2[_0x837d('0x64')]);});})['then'](handleEntityNotFound(_0x90d0fa,null))[_0x837d('0x23')](respondWithResult(_0x90d0fa,0xc9))['catch'](handleError(_0x90d0fa,null));};exports['removeSound']=function(_0x588b35,_0x21b2e6,_0x4d4165){return db[_0x837d('0x4f')][_0x837d('0x50')](function(_0x5233c8){var _0x2fece1;return db['VoiceMusicOnHold'][_0x837d('0x67')]({'where':{'id':_0x588b35[_0x837d('0x4a')]['id']}})[_0x837d('0x23')](handleEntityNotFound(_0x21b2e6,null))['then'](function(_0x5a42f5){if(_0x5a42f5){_0x2fece1=_0x5a42f5;return _0x5a42f5[_0x837d('0x70')](_0x588b35[_0x837d('0x4a')][_0x837d('0x71')]);}})[_0x837d('0x23')](function(_0x451b84){if(_0x451b84){return db[_0x837d('0x66')][_0x837d('0x67')]({'where':{'id':_0x588b35[_0x837d('0x4a')][_0x837d('0x71')]},'attributes':['id',_0x837d('0x29'),_0x837d('0x68'),_0x837d('0x69'),'createdAt'],'raw':!![]});}})[_0x837d('0x23')](function(_0x5c180b){if(_0x5c180b){fs[_0x837d('0x60')](path['join'](_0x2fece1[_0x837d('0x53')],util[_0x837d('0x72')]('%s.%s',_0x5c180b[_0x837d('0x29')],_0x5c180b[_0x837d('0x69')])));return _0x5c180b;}})['catch'](function(_0x4d2f7a){throw new db['Sequelize'][(_0x837d('0x63'))](_0x4d2f7a[_0x837d('0x64')]);});})[_0x837d('0x23')](handleEntityNotFound(_0x21b2e6,null))[_0x837d('0x23')](respondWithStatusCode(_0x21b2e6,0xcc))[_0x837d('0x48')](handleError(_0x21b2e6,null));};exports[_0x837d('0x73')]=function(_0x463962,_0x57dfc4,_0x4b74a9){var _0x4442fc={};var _0xa8a0b2={};var _0x3e00cd;var _0x2cfbb5;return db[_0x837d('0x2c')][_0x837d('0x67')]({'where':{'id':_0x463962[_0x837d('0x4a')]['id']}})[_0x837d('0x23')](handleEntityNotFound(_0x57dfc4,null))['then'](function(_0x561cbc){if(_0x561cbc){_0x3e00cd=_0x561cbc;_0xa8a0b2[_0x837d('0x31')]=_[_0x837d('0x33')](db[_0x837d('0x66')][_0x837d('0x2d')]);_0xa8a0b2['query']=_[_0x837d('0x33')](_0x463962[_0x837d('0x32')]);_0xa8a0b2[_0x837d('0x3e')]=_['intersection'](_0xa8a0b2['model'],_0xa8a0b2[_0x837d('0x32')]);_0x4442fc[_0x837d('0x35')]=_['intersection'](_0xa8a0b2['model'],qs[_0x837d('0x36')](_0x463962['query']['fields']));_0x4442fc[_0x837d('0x35')]=_0x4442fc['attributes'][_0x837d('0x37')]?_0x4442fc[_0x837d('0x35')]:_0xa8a0b2['model'];_0x4442fc[_0x837d('0x3a')]=qs[_0x837d('0x3b')](_0x463962['query'][_0x837d('0x3b')]);_0x4442fc['where']=qs[_0x837d('0x3e')](_[_0x837d('0x3d')](_0x463962['query'],_0xa8a0b2[_0x837d('0x3e')]));if(_0x463962[_0x837d('0x32')][_0x837d('0x40')]){_0x4442fc['where']=_['merge'](_0x4442fc[_0x837d('0x3c')],{'$or':_[_0x837d('0x2b')](_0x4442fc[_0x837d('0x35')],function(_0x492bd4){var _0x1ce72b={};_0x1ce72b[_0x492bd4]={'$like':'%'+_0x463962[_0x837d('0x32')][_0x837d('0x40')]+'%'};return _0x1ce72b;})});}_0x4442fc=_['merge']({},_0x4442fc,_0x463962[_0x837d('0x42')]);return _0x3e00cd['getSounds'](_0x4442fc);}})[_0x837d('0x23')](function(_0x23240a){if(_0x23240a){_0x2cfbb5=_0x23240a['length'];if(!_0x463962[_0x837d('0x32')][_0x837d('0x38')]('nolimit')){_0x4442fc['limit']=qs['limit'](_0x463962[_0x837d('0x32')][_0x837d('0x1c')]);_0x4442fc['offset']=qs[_0x837d('0x1a')](_0x463962[_0x837d('0x32')][_0x837d('0x1a')]);}return _0x3e00cd[_0x837d('0x73')](_0x4442fc);}})['then'](function(_0xd3dc2c){if(_0xd3dc2c){return _0xd3dc2c?{'count':_0x2cfbb5,'rows':_0xd3dc2c}:null;}})[_0x837d('0x23')](respondWithResult(_0x57dfc4,null))[_0x837d('0x48')](handleError(_0x57dfc4,null));}; \ No newline at end of file +var _0x69f3=['sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','then','MusicOnHolds','UserProfileResource','destroy','error','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','rows','show','params','include','catch','update','body','find','create','mode','files','join','root','server/files/moh','mkdirSync','directory','0777','user','get','role','UserProfileSection','userProfileId','autoAssociation','sequelize','transaction','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','findOne','save_name','converted_format','createdAt','format','%s.%s','basename','extname','symlinkSync','message','removeSound','id2','Sound','getSounds','keys','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x11e82b,_0x390817){var _0xe826f1=function(_0x41f463){while(--_0x41f463){_0x11e82b['push'](_0x11e82b['shift']());}};_0xe826f1(++_0x390817);}(_0x69f3,0x142));var _0x369f=function(_0x4308a2,_0x558b21){_0x4308a2=_0x4308a2-0x0;var _0x106fcc=_0x69f3[_0x4308a2];return _0x106fcc;};'use strict';var emlformat=require(_0x369f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x369f('0x1'));var jsonpatch=require(_0x369f('0x2'));var rp=require(_0x369f('0x3'));var moment=require(_0x369f('0x4'));var BPromise=require(_0x369f('0x5'));var Mustache=require(_0x369f('0x6'));var util=require(_0x369f('0x7'));var path=require(_0x369f('0x8'));var sox=require(_0x369f('0x9'));var csv=require(_0x369f('0xa'));var ejs=require(_0x369f('0xb'));var fs=require('fs');var fs_extra=require(_0x369f('0xc'));var _=require(_0x369f('0xd'));var squel=require(_0x369f('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x369f('0xf'));var toCsv=require(_0x369f('0xa'));var querystring=require(_0x369f('0x10'));var Papa=require(_0x369f('0x11'));var Redis=require('ioredis');var authService=require(_0x369f('0x12'));var qs=require(_0x369f('0x13'));var as=require(_0x369f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x369f('0x15'))(_0x369f('0x16'));var utils=require(_0x369f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x369f('0x18'));var db=require(_0x369f('0x19'))['db'];function respondWithStatusCode(_0x43e899,_0xb6b9e1){_0xb6b9e1=_0xb6b9e1||0xcc;return function(_0x305316){if(_0x305316){return _0x43e899[_0x369f('0x1a')](_0xb6b9e1);}return _0x43e899[_0x369f('0x1b')](_0xb6b9e1)[_0x369f('0x1c')]();};}function respondWithResult(_0x3084c5,_0x3c1cd5){_0x3c1cd5=_0x3c1cd5||0xc8;return function(_0x10e4b5){if(_0x10e4b5){return _0x3084c5['status'](_0x3c1cd5)[_0x369f('0x1d')](_0x10e4b5);}};}function respondWithFilteredResult(_0x39ce92,_0x4e30b5){return function(_0x13447e){if(_0x13447e){var _0x4162af=typeof _0x4e30b5[_0x369f('0x1e')]===_0x369f('0x1f')&&typeof _0x4e30b5['limit']===_0x369f('0x1f');var _0x58ad24=_0x13447e['count'];var _0x14c658=_0x4162af?0x0:_0x4e30b5[_0x369f('0x1e')];var _0x31e95c=_0x4162af?_0x13447e[_0x369f('0x20')]:_0x4e30b5[_0x369f('0x1e')]+_0x4e30b5[_0x369f('0x21')];var _0x3843ff;if(_0x31e95c>=_0x58ad24){_0x31e95c=_0x58ad24;_0x3843ff=0xc8;}else{_0x3843ff=0xce;}_0x39ce92[_0x369f('0x1b')](_0x3843ff);return _0x39ce92[_0x369f('0x22')]('Content-Range',_0x14c658+'-'+_0x31e95c+'/'+_0x58ad24)[_0x369f('0x1d')](_0x13447e);}return null;};}function patchUpdates(_0x191bed){return function(_0x2a513d){try{jsonpatch['apply'](_0x2a513d,_0x191bed,!![]);}catch(_0x4e3dbe){return BPromise[_0x369f('0x23')](_0x4e3dbe);}return _0x2a513d[_0x369f('0x24')]();};}function saveUpdates(_0x293d76,_0x465f3f){return function(_0x1f4214){if(_0x1f4214){return _0x1f4214['update'](_0x293d76)['then'](function(_0x2ac875){return _0x2ac875;});}return null;};}function removeEntity(_0x9b04b6,_0x32ef89){return function(_0x1221d8){if(_0x1221d8){return _0x1221d8['destroy']()[_0x369f('0x25')](function(){var _0x3b48a8=_0x1221d8['get']({'plain':!![]});var _0x4399e8=_0x369f('0x26');return db[_0x369f('0x27')][_0x369f('0x28')]({'where':{'type':_0x4399e8,'resourceId':_0x3b48a8['id']}})[_0x369f('0x25')](function(){return _0x1221d8;});})[_0x369f('0x25')](function(){_0x9b04b6[_0x369f('0x1b')](0xcc)[_0x369f('0x1c')]();});}};}function handleEntityNotFound(_0x2b5346,_0x17e0a6){return function(_0x5bf138){if(!_0x5bf138){_0x2b5346[_0x369f('0x1a')](0x194);}return _0x5bf138;};}function handleError(_0x30c19d,_0x403786){_0x403786=_0x403786||0x1f4;return function(_0x116036){logger[_0x369f('0x29')](_0x116036['stack']);if(_0x116036[_0x369f('0x2a')]){delete _0x116036[_0x369f('0x2a')];}_0x30c19d[_0x369f('0x1b')](_0x403786)[_0x369f('0x2b')](_0x116036);};}exports[_0x369f('0x2c')]=function(_0x40a41e,_0x38b50b){var _0x349bdf={},_0x5a42b0={},_0x1b8669={'count':0x0,'rows':[]};var _0x1e4270=_[_0x369f('0x2d')](db[_0x369f('0x2e')][_0x369f('0x2f')],function(_0x11ec14){return{'name':_0x11ec14[_0x369f('0x30')],'type':_0x11ec14[_0x369f('0x31')][_0x369f('0x32')]};});_0x5a42b0[_0x369f('0x33')]=_[_0x369f('0x2d')](_0x1e4270,_0x369f('0x2a'));_0x5a42b0[_0x369f('0x34')]=_['keys'](_0x40a41e['query']);_0x5a42b0['filters']=_[_0x369f('0x35')](_0x5a42b0['model'],_0x5a42b0[_0x369f('0x34')]);_0x349bdf[_0x369f('0x36')]=_[_0x369f('0x35')](_0x5a42b0[_0x369f('0x33')],qs[_0x369f('0x37')](_0x40a41e['query'][_0x369f('0x37')]));_0x349bdf[_0x369f('0x36')]=_0x349bdf[_0x369f('0x36')][_0x369f('0x38')]?_0x349bdf[_0x369f('0x36')]:_0x5a42b0[_0x369f('0x33')];if(!_0x40a41e[_0x369f('0x34')][_0x369f('0x39')](_0x369f('0x3a'))){_0x349bdf[_0x369f('0x21')]=qs[_0x369f('0x21')](_0x40a41e[_0x369f('0x34')][_0x369f('0x21')]);_0x349bdf[_0x369f('0x1e')]=qs[_0x369f('0x1e')](_0x40a41e['query'][_0x369f('0x1e')]);}_0x349bdf[_0x369f('0x3b')]=qs[_0x369f('0x3c')](_0x40a41e['query'][_0x369f('0x3c')]);delete _0x40a41e['query'][_0x369f('0x3c')];_0x349bdf[_0x369f('0x3d')]=qs[_0x369f('0x3e')](_[_0x369f('0x3f')](_0x40a41e[_0x369f('0x34')],_0x5a42b0[_0x369f('0x3e')]),_0x1e4270);if(_0x40a41e['query']['filter']){_0x349bdf[_0x369f('0x3d')]=_[_0x369f('0x40')](_0x349bdf[_0x369f('0x3d')],{'$or':_[_0x369f('0x2d')](_0x1e4270,function(_0x90749b){if(_0x90749b['type']!==_0x369f('0x41')){var _0x32706c={};_0x32706c[_0x90749b['name']]={'$like':'%'+_0x40a41e[_0x369f('0x34')][_0x369f('0x42')]+'%'};return _0x32706c;}})});}_0x349bdf=_[_0x369f('0x40')]({},_0x349bdf,_0x40a41e[_0x369f('0x43')]);var _0x59a8ec={'where':_0x349bdf[_0x369f('0x3d')]};return db[_0x369f('0x2e')][_0x369f('0x20')](_0x59a8ec)[_0x369f('0x25')](function(_0x52cb7d){_0x1b8669[_0x369f('0x20')]=_0x52cb7d;if(_0x40a41e['query'][_0x369f('0x44')]){_0x349bdf['include']=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0x349bdf);})['then'](function(_0x48e653){_0x1b8669[_0x369f('0x45')]=_0x48e653;return _0x1b8669;})[_0x369f('0x25')](respondWithFilteredResult(_0x38b50b,_0x349bdf))['catch'](handleError(_0x38b50b,null));};exports[_0x369f('0x46')]=function(_0x262698,_0x3bedd4){var _0xa9a463={'raw':![],'where':{'id':_0x262698[_0x369f('0x47')]['id']}},_0x50f991={};_0x50f991['model']=_['keys'](db[_0x369f('0x2e')][_0x369f('0x2f')]);_0x50f991['query']=_['keys'](_0x262698[_0x369f('0x34')]);_0x50f991['filters']=_[_0x369f('0x35')](_0x50f991[_0x369f('0x33')],_0x50f991[_0x369f('0x34')]);_0xa9a463[_0x369f('0x36')]=_[_0x369f('0x35')](_0x50f991[_0x369f('0x33')],qs[_0x369f('0x37')](_0x262698[_0x369f('0x34')][_0x369f('0x37')]));_0xa9a463[_0x369f('0x36')]=_0xa9a463[_0x369f('0x36')][_0x369f('0x38')]?_0xa9a463['attributes']:_0x50f991[_0x369f('0x33')];if(_0x262698[_0x369f('0x34')]['includeAll']){_0xa9a463[_0x369f('0x48')]=[{'all':!![]}];}_0xa9a463=_[_0x369f('0x40')]({},_0xa9a463,_0x262698[_0x369f('0x43')]);return db[_0x369f('0x2e')]['find'](_0xa9a463)[_0x369f('0x25')](handleEntityNotFound(_0x3bedd4,null))[_0x369f('0x25')](respondWithResult(_0x3bedd4,null))[_0x369f('0x49')](handleError(_0x3bedd4,null));};exports[_0x369f('0x4a')]=function(_0x363417,_0x36531e){if(_0x363417[_0x369f('0x4b')]['id']){delete _0x363417[_0x369f('0x4b')]['id'];}return db[_0x369f('0x2e')][_0x369f('0x4c')]({'where':{'id':_0x363417[_0x369f('0x47')]['id']}})[_0x369f('0x25')](handleEntityNotFound(_0x36531e,null))[_0x369f('0x25')](saveUpdates(_0x363417[_0x369f('0x4b')],null))[_0x369f('0x25')](respondWithResult(_0x36531e,null))['catch'](handleError(_0x36531e,null));};exports[_0x369f('0x4d')]=function(_0x166a99,_0xe5c2bf,_0x272974){return db['sequelize']['transaction'](function(_0x23c85f){if(_0x166a99[_0x369f('0x4b')][_0x369f('0x4e')]===_0x369f('0x4f')){_0x166a99[_0x369f('0x4b')]['directory']=path[_0x369f('0x50')](config[_0x369f('0x51')],_0x369f('0x52'),_0x166a99[_0x369f('0x4b')]['name']);}return db[_0x369f('0x2e')][_0x369f('0x4d')](_0x166a99['body'],{'transaction':_0x23c85f})['then'](function(_0x520507){if(_0x166a99[_0x369f('0x4b')]['mode']===_0x369f('0x4f')){fs[_0x369f('0x53')](_0x520507[_0x369f('0x54')],parseInt(_0x369f('0x55'),0x8));}var _0x3ed125=_0x166a99[_0x369f('0x56')][_0x369f('0x57')]({'plain':!![]});if(!_0x3ed125)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ed125[_0x369f('0x58')]===_0x369f('0x56')){var _0x2a7ab6=_0x520507[_0x369f('0x57')]({'plain':!![]});return db[_0x369f('0x59')][_0x369f('0x4c')]({'where':{'name':_0x369f('0x26'),'userProfileId':_0x3ed125[_0x369f('0x5a')]},'raw':!![]})[_0x369f('0x25')](function(_0x6e345d){if(_0x6e345d&&_0x6e345d[_0x369f('0x5b')]===0x0){return db[_0x369f('0x27')][_0x369f('0x4d')]({'name':_0x2a7ab6[_0x369f('0x2a')],'resourceId':_0x2a7ab6['id'],'type':_0x6e345d[_0x369f('0x2a')],'sectionId':_0x6e345d['id']},{})[_0x369f('0x25')](function(){return _0x520507;});}else{return _0x520507;}})[_0x369f('0x49')](function(_0x2c0877){logger[_0x369f('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c0877);});}return _0x520507;});})[_0x369f('0x25')](respondWithResult(_0xe5c2bf,0xc9))[_0x369f('0x49')](handleError(_0xe5c2bf,null));};exports[_0x369f('0x28')]=function(_0x174b2a,_0x5a932d,_0x1d21a5){var _0x33f871;return db[_0x369f('0x2e')][_0x369f('0x4c')]({'where':{'id':_0x174b2a['params']['id']}})[_0x369f('0x25')](function(_0x265d4e){if(_0x265d4e){return db[_0x369f('0x5c')][_0x369f('0x5d')](function(_0x3ad594){return _0x265d4e[_0x369f('0x28')]({'transaction':_0x3ad594,'raw':!![]})[_0x369f('0x25')](function(_0x4768fb){if(_0x4768fb[_0x369f('0x54')]){fs[_0x369f('0x5e')](_0x4768fb[_0x369f('0x54')])[_0x369f('0x5f')](function(_0x19e5bb){fs[_0x369f('0x60')](path[_0x369f('0x50')](_0x4768fb[_0x369f('0x54')],_0x19e5bb));});fs[_0x369f('0x61')](_0x4768fb[_0x369f('0x54')]);}return _0x4768fb;});})[_0x369f('0x49')](function(_0x215d7f){throw new db[(_0x369f('0x62'))][(_0x369f('0x63'))](_0x215d7f['message']);});}})[_0x369f('0x25')](handleEntityNotFound(_0x5a932d,null))[_0x369f('0x25')](removeEntity(_0x5a932d,null))[_0x369f('0x49')](handleError(_0x5a932d,null));};exports['addSound']=function(_0x126a43,_0x3aad1a,_0x5e5fb3){return db[_0x369f('0x5c')][_0x369f('0x5d')](function(_0x1b09c5){var _0x183c94;return db['VoiceMusicOnHold'][_0x369f('0x4c')]({'where':{'id':_0x126a43[_0x369f('0x47')]['id']}})[_0x369f('0x25')](function(_0x457bc7){if(_0x457bc7){_0x183c94=_0x457bc7;return _0x457bc7[_0x369f('0x64')](_0x126a43['body']['id'],{'transaction':_0x1b09c5});}})[_0x369f('0x25')](function(_0xafad9){if(_0xafad9){return db['Sound'][_0x369f('0x65')]({'where':{'id':_0x126a43[_0x369f('0x4b')]['id']},'attributes':['id','name',_0x369f('0x66'),_0x369f('0x67'),_0x369f('0x68')],'raw':!![]});}})['then'](function(_0x4c244a){if(_0x4c244a){var _0x2dfb0f=path[_0x369f('0x50')](config[_0x369f('0x51')],'server/files/sounds/converted',util[_0x369f('0x69')](_0x369f('0x6a'),path[_0x369f('0x6b')](_0x4c244a['save_name'],path[_0x369f('0x6c')](_0x4c244a[_0x369f('0x66')])),_0x4c244a[_0x369f('0x67')]));var _0x19b0c1=path[_0x369f('0x50')](config[_0x369f('0x51')],_0x369f('0x52'),_0x183c94['name'],util[_0x369f('0x69')](_0x369f('0x6a'),_0x4c244a['name'],_0x4c244a[_0x369f('0x67')]));fs[_0x369f('0x6d')](_0x2dfb0f,_0x19b0c1);return _0x4c244a;}})[_0x369f('0x49')](function(_0x48271b){throw new db['Sequelize'][(_0x369f('0x63'))](_0x48271b[_0x369f('0x6e')]);});})[_0x369f('0x25')](handleEntityNotFound(_0x3aad1a,null))[_0x369f('0x25')](respondWithResult(_0x3aad1a,0xc9))['catch'](handleError(_0x3aad1a,null));};exports[_0x369f('0x6f')]=function(_0x383f15,_0x51c801,_0x186e34){return db[_0x369f('0x5c')][_0x369f('0x5d')](function(_0x1bdd3f){var _0x2722cd;return db['VoiceMusicOnHold'][_0x369f('0x65')]({'where':{'id':_0x383f15[_0x369f('0x47')]['id']}})[_0x369f('0x25')](handleEntityNotFound(_0x51c801,null))['then'](function(_0x210b08){if(_0x210b08){_0x2722cd=_0x210b08;return _0x210b08[_0x369f('0x6f')](_0x383f15['params'][_0x369f('0x70')]);}})[_0x369f('0x25')](function(_0x23562d){if(_0x23562d){return db[_0x369f('0x71')]['findOne']({'where':{'id':_0x383f15['params']['id2']},'attributes':['id',_0x369f('0x2a'),_0x369f('0x66'),_0x369f('0x67'),_0x369f('0x68')],'raw':!![]});}})[_0x369f('0x25')](function(_0x49545b){if(_0x49545b){fs[_0x369f('0x60')](path[_0x369f('0x50')](_0x2722cd[_0x369f('0x54')],util['format'](_0x369f('0x6a'),_0x49545b[_0x369f('0x2a')],_0x49545b[_0x369f('0x67')])));return _0x49545b;}})[_0x369f('0x49')](function(_0x22663d){throw new db[(_0x369f('0x62'))][(_0x369f('0x63'))](_0x22663d[_0x369f('0x6e')]);});})['then'](handleEntityNotFound(_0x51c801,null))[_0x369f('0x25')](respondWithStatusCode(_0x51c801,0xcc))['catch'](handleError(_0x51c801,null));};exports[_0x369f('0x72')]=function(_0x3dbede,_0x337d05,_0x45de3a){var _0x2332da={};var _0x4c2698={};var _0x54de43;var _0x1d29ec;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x3dbede['params']['id']}})[_0x369f('0x25')](handleEntityNotFound(_0x337d05,null))[_0x369f('0x25')](function(_0x495a44){if(_0x495a44){_0x54de43=_0x495a44;_0x4c2698[_0x369f('0x33')]=_[_0x369f('0x73')](db['Sound'][_0x369f('0x2f')]);_0x4c2698['query']=_[_0x369f('0x73')](_0x3dbede['query']);_0x4c2698[_0x369f('0x3e')]=_[_0x369f('0x35')](_0x4c2698['model'],_0x4c2698[_0x369f('0x34')]);_0x2332da['attributes']=_[_0x369f('0x35')](_0x4c2698[_0x369f('0x33')],qs[_0x369f('0x37')](_0x3dbede[_0x369f('0x34')][_0x369f('0x37')]));_0x2332da[_0x369f('0x36')]=_0x2332da[_0x369f('0x36')][_0x369f('0x38')]?_0x2332da[_0x369f('0x36')]:_0x4c2698['model'];_0x2332da[_0x369f('0x3b')]=qs['sort'](_0x3dbede[_0x369f('0x34')][_0x369f('0x3c')]);_0x2332da[_0x369f('0x3d')]=qs['filters'](_['pick'](_0x3dbede['query'],_0x4c2698[_0x369f('0x3e')]));if(_0x3dbede[_0x369f('0x34')][_0x369f('0x42')]){_0x2332da[_0x369f('0x3d')]=_[_0x369f('0x40')](_0x2332da['where'],{'$or':_[_0x369f('0x2d')](_0x2332da[_0x369f('0x36')],function(_0x4dd23c){var _0x5e3d8a={};_0x5e3d8a[_0x4dd23c]={'$like':'%'+_0x3dbede[_0x369f('0x34')][_0x369f('0x42')]+'%'};return _0x5e3d8a;})});}_0x2332da=_[_0x369f('0x40')]({},_0x2332da,_0x3dbede['options']);return _0x54de43['getSounds'](_0x2332da);}})[_0x369f('0x25')](function(_0x5e8dbe){if(_0x5e8dbe){_0x1d29ec=_0x5e8dbe[_0x369f('0x38')];if(!_0x3dbede['query'][_0x369f('0x39')]('nolimit')){_0x2332da[_0x369f('0x21')]=qs[_0x369f('0x21')](_0x3dbede[_0x369f('0x34')][_0x369f('0x21')]);_0x2332da[_0x369f('0x1e')]=qs[_0x369f('0x1e')](_0x3dbede[_0x369f('0x34')][_0x369f('0x1e')]);}return _0x54de43[_0x369f('0x72')](_0x2332da);}})[_0x369f('0x25')](function(_0x24e8d7){if(_0x24e8d7){return _0x24e8d7?{'count':_0x1d29ec,'rows':_0x24e8d7}:null;}})[_0x369f('0x25')](respondWithResult(_0x337d05,null))['catch'](handleError(_0x337d05,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 0dacd70..96222e5 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 _0x66a6=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','voice_musiconhold'];(function(_0x459e81,_0x52aeb0){var _0x4fac6a=function(_0x2880ae){while(--_0x2880ae){_0x459e81['push'](_0x459e81['shift']());}};_0x4fac6a(++_0x52aeb0);}(_0x66a6,0x1c3));var _0x666a=function(_0x42c97b,_0x3e401a){_0x42c97b=_0x42c97b-0x0;var _0x5ee945=_0x66a6[_0x42c97b];return _0x5ee945;};'use strict';var _=require(_0x666a('0x0'));var util=require(_0x666a('0x1'));var logger=require(_0x666a('0x2'))('api');var moment=require(_0x666a('0x3'));var BPromise=require(_0x666a('0x4'));var rp=require(_0x666a('0x5'));var fs=require('fs');var path=require(_0x666a('0x6'));var rimraf=require(_0x666a('0x7'));var config=require('../../config/environment');var attributes=require('./voiceMusicOnHold.attributes');module[_0x666a('0x8')]=function(_0x4d1f8a,_0x376ae6){return _0x4d1f8a[_0x666a('0x9')]('VoiceMusicOnHold',attributes,{'tableName':_0x666a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0749=['../../config/environment','./voiceMusicOnHold.attributes','exports','define','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x263a08,_0x53279e){var _0x32d03b=function(_0x27d18d){while(--_0x27d18d){_0x263a08['push'](_0x263a08['shift']());}};_0x32d03b(++_0x53279e);}(_0x0749,0x16c));var _0x9074=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x0749[_0x27af45];return _0x18df21;};'use strict';var _=require('lodash');var util=require(_0x9074('0x0'));var logger=require(_0x9074('0x1'))(_0x9074('0x2'));var moment=require(_0x9074('0x3'));var BPromise=require(_0x9074('0x4'));var rp=require(_0x9074('0x5'));var fs=require('fs');var path=require(_0x9074('0x6'));var rimraf=require(_0x9074('0x7'));var config=require(_0x9074('0x8'));var attributes=require(_0x9074('0x9'));module[_0x9074('0xa')]=function(_0x5b9fb3,_0xcc5847){return _0x5b9fb3[_0x9074('0xb')]('VoiceMusicOnHold',attributes,{'tableName':'voice_musiconhold','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 cdc54e2..a6e8065 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x9720b9,_0x578c4f){var _0xf1778b=function(_0x56c89a){while(--_0x56c89a){_0x9720b9['push'](_0x9720b9['shift']());}};_0xf1778b(++_0x578c4f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4bcf38,_0x3c12be){_0x4bcf38=_0x4bcf38-0x0;var _0x4a89be=_0xcb91[_0x4bcf38];return _0x4a89be;};'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')]('VoiceMusicOnHold,\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 _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(_0xb54647,_0x44cf20){var _0x34afbb=function(_0x2e5fa0){while(--_0x2e5fa0){_0xb54647['push'](_0xb54647['shift']());}};_0x34afbb(++_0x44cf20);}(_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 228633d..ae36131 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 _0xc7a4=['/:id/teams','post','addAgents','addTeams','delete','destroy','removeAgents','removeTeams','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getAgents'];(function(_0x5e5964,_0x201efc){var _0xb11687=function(_0x544c1b){while(--_0x544c1b){_0x5e5964['push'](_0x5e5964['shift']());}};_0xb11687(++_0x201efc);}(_0xc7a4,0x8b));var _0x4c7a=function(_0x250965,_0x148a1e){_0x250965=_0x250965-0x0;var _0x2a0f14=_0xc7a4[_0x250965];return _0x2a0f14;};'use strict';var multer=require(_0x4c7a('0x0'));var util=require(_0x4c7a('0x1'));var path=require(_0x4c7a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4c7a('0x3')]();var fs_extra=require(_0x4c7a('0x4'));var auth=require(_0x4c7a('0x5'));var interaction=require(_0x4c7a('0x6'));var config=require(_0x4c7a('0x7'));var controller=require('./voicePrefix.controller');router[_0x4c7a('0x8')]('/',auth[_0x4c7a('0x9')](),controller[_0x4c7a('0xa')]);router[_0x4c7a('0x8')](_0x4c7a('0xb'),auth['isAuthenticated'](),controller[_0x4c7a('0xc')]);router['get'](_0x4c7a('0xd'),auth['isAuthenticated'](),controller[_0x4c7a('0xe')]);router[_0x4c7a('0x8')](_0x4c7a('0xf'),auth[_0x4c7a('0x9')](),controller[_0x4c7a('0x10')]);router['get'](_0x4c7a('0x11'),auth[_0x4c7a('0x9')](),controller['getTeams']);router[_0x4c7a('0x12')]('/',auth[_0x4c7a('0x9')](),controller['create']);router[_0x4c7a('0x12')](_0x4c7a('0xf'),auth[_0x4c7a('0x9')](),controller[_0x4c7a('0x13')]);router[_0x4c7a('0x12')](_0x4c7a('0x11'),auth['isAuthenticated'](),controller[_0x4c7a('0x14')]);router['put'](_0x4c7a('0xd'),auth[_0x4c7a('0x9')](),controller['update']);router[_0x4c7a('0x15')](_0x4c7a('0xd'),auth[_0x4c7a('0x9')](),controller[_0x4c7a('0x16')]);router['delete'](_0x4c7a('0xf'),auth[_0x4c7a('0x9')](),controller[_0x4c7a('0x17')]);router[_0x4c7a('0x15')]('/:id/teams',auth['isAuthenticated'](),controller[_0x4c7a('0x18')]);module[_0x4c7a('0x19')]=router; \ No newline at end of file +var _0xe132=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','create','post','addAgents','addTeams','put','update','delete','destroy','removeAgents','removeTeams','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe132,0x162));var _0x2e13=function(_0x2c8856,_0x4002ad){_0x2c8856=_0x2c8856-0x0;var _0x5a0d14=_0xe132[_0x2c8856];return _0x5a0d14;};'use strict';var multer=require(_0x2e13('0x0'));var util=require('util');var path=require(_0x2e13('0x1'));var timeout=require(_0x2e13('0x2'));var express=require(_0x2e13('0x3'));var router=express[_0x2e13('0x4')]();var fs_extra=require(_0x2e13('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2e13('0x6'));var config=require(_0x2e13('0x7'));var controller=require('./voicePrefix.controller');router['get']('/',auth[_0x2e13('0x8')](),controller[_0x2e13('0x9')]);router[_0x2e13('0xa')](_0x2e13('0xb'),auth[_0x2e13('0x8')](),controller[_0x2e13('0xc')]);router[_0x2e13('0xa')](_0x2e13('0xd'),auth[_0x2e13('0x8')](),controller[_0x2e13('0xe')]);router['get'](_0x2e13('0xf'),auth[_0x2e13('0x8')](),controller[_0x2e13('0x10')]);router[_0x2e13('0xa')](_0x2e13('0x11'),auth[_0x2e13('0x8')](),controller[_0x2e13('0x12')]);router['post']('/',auth[_0x2e13('0x8')](),controller[_0x2e13('0x13')]);router[_0x2e13('0x14')](_0x2e13('0xf'),auth[_0x2e13('0x8')](),controller[_0x2e13('0x15')]);router[_0x2e13('0x14')]('/:id/teams',auth[_0x2e13('0x8')](),controller[_0x2e13('0x16')]);router[_0x2e13('0x17')]('/:id',auth[_0x2e13('0x8')](),controller[_0x2e13('0x18')]);router[_0x2e13('0x19')]('/:id',auth[_0x2e13('0x8')](),controller[_0x2e13('0x1a')]);router[_0x2e13('0x19')]('/:id/users',auth['isAuthenticated'](),controller[_0x2e13('0x1b')]);router[_0x2e13('0x19')](_0x2e13('0x11'),auth[_0x2e13('0x8')](),controller[_0x2e13('0x1c')]);module[_0x2e13('0x1d')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index edc8e09..88aafd4 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 _0xb9b2=['getDataValue','STRING','INTEGER','sequelize','name','system-'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xb9b2,0x75));var _0x2b9b=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0xb9b2[_0x53cf8e];return _0x459197;};'use strict';var Sequelize=require(_0x2b9b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2b9b('0x1')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x5f5613){return _0x2b9b('0x2')+this[_0x2b9b('0x3')]('name')+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x2b9b('0x4')]},'VoiceExtensionId':{'type':Sequelize[_0x2b9b('0x5')]}}; \ No newline at end of file +var _0x0d94=['getDataValue','INTEGER','sequelize','STRING','name','system-'];(function(_0x1fb7c1,_0x14a6f7){var _0x5659ec=function(_0xea6c0d){while(--_0xea6c0d){_0x1fb7c1['push'](_0x1fb7c1['shift']());}};_0x5659ec(++_0x14a6f7);}(_0x0d94,0x18e));var _0x40d9=function(_0x191618,_0x493f39){_0x191618=_0x191618-0x0;var _0x361ae1=_0x0d94[_0x191618];return _0x361ae1;};'use strict';var Sequelize=require(_0x40d9('0x0'));module['exports']={'name':{'type':Sequelize[_0x40d9('0x1')],'allowNull':![],'unique':_0x40d9('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x127e3f){return _0x40d9('0x3')+this[_0x40d9('0x4')]('name')+'-';}},'description':{'type':Sequelize[_0x40d9('0x1')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x40d9('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index dbb1ea1..9b8c88c 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 _0x63a5=['merge','VIRTUAL','options','includeAll','include','VoicePrefix','findAll','rows','catch','show','params','rawAttributes','keys','find','describe','create','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','context','from-sip','exten','app','appdata','prefix','NoOp','VoicePrefixId','VoiceExtension','bulkCreate','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','goto','charAt','system-','transaction','findById','addAgents','ids','spread','emit','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','pick','getTeams','Team','Agents','online','voicePause','interface','flatMap','sequelize','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','removeTeams','select','field','tq.TeamId','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','compact','value','isEmpty','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','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','socket.io-emitter','register','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','VoicePrefixes','UserProfileResource','sendStatus','error','stack','name','send','index','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter'];(function(_0x53ef5e,_0x2ea64f){var _0x2aec64=function(_0x53f1a0){while(--_0x53f1a0){_0x53ef5e['push'](_0x53ef5e['shift']());}};_0x2aec64(++_0x2ea64f);}(_0x63a5,0x18e));var _0x563a=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x63a5[_0x20a558];return _0x53d3f7;};'use strict';var emlformat=require(_0x563a('0x0'));var rimraf=require(_0x563a('0x1'));var zipdir=require(_0x563a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x563a('0x3'));var moment=require('moment');var BPromise=require(_0x563a('0x4'));var Mustache=require(_0x563a('0x5'));var util=require(_0x563a('0x6'));var path=require(_0x563a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x563a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x563a('0x9'));var squel=require(_0x563a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x563a('0xb'));var toCsv=require(_0x563a('0xc'));var querystring=require(_0x563a('0xd'));var Papa=require(_0x563a('0xe'));var Redis=require(_0x563a('0xf'));var authService=require(_0x563a('0x10'));var qs=require(_0x563a('0x11'));var as=require(_0x563a('0x12'));var hardwareService=require(_0x563a('0x13'));var logger=require(_0x563a('0x14'))(_0x563a('0x15'));var utils=require(_0x563a('0x16'));var config=require(_0x563a('0x17'));var licenseUtil=require(_0x563a('0x18'));var db=require('../../mysqldb')['db'];config[_0x563a('0x19')]=_[_0x563a('0x1a')](config[_0x563a('0x19')],{'host':_0x563a('0x1b'),'port':0x18eb});var socket=require(_0x563a('0x1c'))(new Redis(config[_0x563a('0x19')]));require('./voicePrefix.socket')[_0x563a('0x1d')](socket);function respondWithStatusCode(_0x3045ac,_0x8c3727){_0x8c3727=_0x8c3727||0xcc;return function(_0x26987f){if(_0x26987f){return _0x3045ac['sendStatus'](_0x8c3727);}return _0x3045ac['status'](_0x8c3727)[_0x563a('0x1e')]();};}function respondWithResult(_0x2ad667,_0x5b291f){_0x5b291f=_0x5b291f||0xc8;return function(_0x2ade24){if(_0x2ade24){return _0x2ad667[_0x563a('0x1f')](_0x5b291f)[_0x563a('0x20')](_0x2ade24);}};}function respondWithFilteredResult(_0x9c2f77,_0x4f947d){return function(_0x598693){if(_0x598693){var _0xe3d2bd=typeof _0x4f947d[_0x563a('0x21')]===_0x563a('0x22')&&typeof _0x4f947d['limit']==='undefined';var _0x52b99a=_0x598693['count'];var _0x40916a=_0xe3d2bd?0x0:_0x4f947d[_0x563a('0x21')];var _0x26061f=_0xe3d2bd?_0x598693[_0x563a('0x23')]:_0x4f947d['offset']+_0x4f947d['limit'];var _0x3930f0;if(_0x26061f>=_0x52b99a){_0x26061f=_0x52b99a;_0x3930f0=0xc8;}else{_0x3930f0=0xce;}_0x9c2f77[_0x563a('0x1f')](_0x3930f0);return _0x9c2f77[_0x563a('0x24')](_0x563a('0x25'),_0x40916a+'-'+_0x26061f+'/'+_0x52b99a)[_0x563a('0x20')](_0x598693);}return null;};}function patchUpdates(_0x2dc7e2){return function(_0x44b460){try{jsonpatch[_0x563a('0x26')](_0x44b460,_0x2dc7e2,!![]);}catch(_0x506491){return BPromise[_0x563a('0x27')](_0x506491);}return _0x44b460['save']();};}function saveUpdates(_0x44e2c1,_0xd3e0ae){return function(_0x3a36a4){if(_0x3a36a4){return _0x3a36a4[_0x563a('0x28')](_0x44e2c1)[_0x563a('0x29')](function(_0x1682ee){return _0x1682ee;});}return null;};}function removeEntity(_0x3642b3,_0x173990){return function(_0x4de4c3){if(_0x4de4c3){return _0x4de4c3[_0x563a('0x2a')]()[_0x563a('0x29')](function(){var _0x2311f2=_0x4de4c3[_0x563a('0x2b')]({'plain':!![]});var _0xce8165=_0x563a('0x2c');return db[_0x563a('0x2d')][_0x563a('0x2a')]({'where':{'type':_0xce8165,'resourceId':_0x2311f2['id']}})[_0x563a('0x29')](function(){return _0x4de4c3;});})[_0x563a('0x29')](function(){_0x3642b3[_0x563a('0x1f')](0xcc)[_0x563a('0x1e')]();});}};}function handleEntityNotFound(_0x1bdfb0,_0x7696c2){return function(_0x579cb5){if(!_0x579cb5){_0x1bdfb0[_0x563a('0x2e')](0x194);}return _0x579cb5;};}function handleError(_0x3c16d0,_0x2257e1){_0x2257e1=_0x2257e1||0x1f4;return function(_0x4aaa3d){logger[_0x563a('0x2f')](_0x4aaa3d[_0x563a('0x30')]);if(_0x4aaa3d[_0x563a('0x31')]){delete _0x4aaa3d[_0x563a('0x31')];}_0x3c16d0[_0x563a('0x1f')](_0x2257e1)[_0x563a('0x32')](_0x4aaa3d);};}exports[_0x563a('0x33')]=function(_0x4a2d28,_0x2418ae){var _0x24ec9d={},_0x4259f6={},_0x2ea6c2={'count':0x0,'rows':[]};var _0x1a77b8=_['map'](db['VoicePrefix']['rawAttributes'],function(_0x4e5c46){return{'name':_0x4e5c46[_0x563a('0x34')],'type':_0x4e5c46[_0x563a('0x35')][_0x563a('0x36')]};});_0x4259f6[_0x563a('0x37')]=_[_0x563a('0x38')](_0x1a77b8,_0x563a('0x31'));_0x4259f6['query']=_['keys'](_0x4a2d28[_0x563a('0x39')]);_0x4259f6[_0x563a('0x3a')]=_[_0x563a('0x3b')](_0x4259f6[_0x563a('0x37')],_0x4259f6[_0x563a('0x39')]);_0x24ec9d[_0x563a('0x3c')]=_[_0x563a('0x3b')](_0x4259f6[_0x563a('0x37')],qs[_0x563a('0x3d')](_0x4a2d28[_0x563a('0x39')][_0x563a('0x3d')]));_0x24ec9d[_0x563a('0x3c')]=_0x24ec9d[_0x563a('0x3c')][_0x563a('0x3e')]?_0x24ec9d[_0x563a('0x3c')]:_0x4259f6[_0x563a('0x37')];if(!_0x4a2d28['query'][_0x563a('0x3f')](_0x563a('0x40'))){_0x24ec9d[_0x563a('0x41')]=qs['limit'](_0x4a2d28[_0x563a('0x39')]['limit']);_0x24ec9d[_0x563a('0x21')]=qs[_0x563a('0x21')](_0x4a2d28['query']['offset']);}_0x24ec9d[_0x563a('0x42')]=qs['sort'](_0x4a2d28[_0x563a('0x39')][_0x563a('0x43')]);_0x24ec9d[_0x563a('0x44')]=qs[_0x563a('0x3a')](_['pick'](_0x4a2d28['query'],_0x4259f6[_0x563a('0x3a')]),_0x1a77b8);if(_0x4a2d28['query'][_0x563a('0x45')]){_0x24ec9d[_0x563a('0x44')]=_[_0x563a('0x46')](_0x24ec9d[_0x563a('0x44')],{'$or':_[_0x563a('0x38')](_0x1a77b8,function(_0x38fab5){if(_0x38fab5[_0x563a('0x35')]!==_0x563a('0x47')){var _0x4c71df={};_0x4c71df[_0x38fab5[_0x563a('0x31')]]={'$like':'%'+_0x4a2d28['query'][_0x563a('0x45')]+'%'};return _0x4c71df;}})});}_0x24ec9d=_[_0x563a('0x46')]({},_0x24ec9d,_0x4a2d28[_0x563a('0x48')]);var _0x2d3800={'where':_0x24ec9d['where']};return db['VoicePrefix']['count'](_0x2d3800)[_0x563a('0x29')](function(_0x1255da){_0x2ea6c2[_0x563a('0x23')]=_0x1255da;if(_0x4a2d28[_0x563a('0x39')][_0x563a('0x49')]){_0x24ec9d[_0x563a('0x4a')]=[{'all':!![]}];}return db[_0x563a('0x4b')][_0x563a('0x4c')](_0x24ec9d);})[_0x563a('0x29')](function(_0x433353){_0x2ea6c2[_0x563a('0x4d')]=_0x433353;return _0x2ea6c2;})[_0x563a('0x29')](respondWithFilteredResult(_0x2418ae,_0x24ec9d))[_0x563a('0x4e')](handleError(_0x2418ae,null));};exports[_0x563a('0x4f')]=function(_0x144e15,_0x456d27){var _0x4643c4={'raw':![],'where':{'id':_0x144e15[_0x563a('0x50')]['id']}},_0x21bafb={};_0x21bafb['model']=_['keys'](db[_0x563a('0x4b')][_0x563a('0x51')]);_0x21bafb[_0x563a('0x39')]=_[_0x563a('0x52')](_0x144e15[_0x563a('0x39')]);_0x21bafb[_0x563a('0x3a')]=_[_0x563a('0x3b')](_0x21bafb[_0x563a('0x37')],_0x21bafb['query']);_0x4643c4['attributes']=_[_0x563a('0x3b')](_0x21bafb[_0x563a('0x37')],qs[_0x563a('0x3d')](_0x144e15[_0x563a('0x39')][_0x563a('0x3d')]));_0x4643c4[_0x563a('0x3c')]=_0x4643c4[_0x563a('0x3c')][_0x563a('0x3e')]?_0x4643c4['attributes']:_0x21bafb[_0x563a('0x37')];if(_0x144e15[_0x563a('0x39')]['includeAll']){_0x4643c4[_0x563a('0x4a')]=[{'all':!![]}];}_0x4643c4=_['merge']({},_0x4643c4,_0x144e15[_0x563a('0x48')]);return db[_0x563a('0x4b')][_0x563a('0x53')](_0x4643c4)['then'](handleEntityNotFound(_0x456d27,null))[_0x563a('0x29')](respondWithResult(_0x456d27,null))[_0x563a('0x4e')](handleError(_0x456d27,null));};exports[_0x563a('0x2a')]=function(_0x39c104,_0x6fe8a9){return db[_0x563a('0x4b')][_0x563a('0x53')]({'where':{'id':_0x39c104[_0x563a('0x50')]['id']}})[_0x563a('0x29')](handleEntityNotFound(_0x6fe8a9,null))[_0x563a('0x29')](removeEntity(_0x6fe8a9,null))[_0x563a('0x4e')](handleError(_0x6fe8a9,null));};exports[_0x563a('0x54')]=function(_0x406d4a,_0x497469){return db['VoicePrefix'][_0x563a('0x54')]()[_0x563a('0x29')](respondWithResult(_0x497469,null))[_0x563a('0x4e')](handleError(_0x497469,null));};exports['create']=function(_0x5ae08f,_0x13530f){var _0x1fc4d2;return db['sequelize']['transaction'](function(_0x51e142){return db[_0x563a('0x4b')][_0x563a('0x55')](_0x5ae08f[_0x563a('0x56')],{'transaction':_0x51e142})[_0x563a('0x29')](function(_0x8d3997){_0x1fc4d2=_0x8d3997[_0x563a('0x2b')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x1fc4d2[_0x563a('0x57')]},'raw':!![]})['then'](function(_0x4453b2){return createVoicePrefixExtensions(_0x1fc4d2,_0x4453b2,_0x51e142);});});})[_0x563a('0x29')](function(){var _0x3e993e=_0x5ae08f[_0x563a('0x58')][_0x563a('0x2b')]({'plain':!![]});if(!_0x3e993e)throw new Error(_0x563a('0x59'));if(_0x3e993e[_0x563a('0x5a')]==='user'){var _0x22cc91=_0x1fc4d2;return db[_0x563a('0x5b')]['find']({'where':{'name':_0x563a('0x2c'),'userProfileId':_0x3e993e[_0x563a('0x5c')]},'raw':!![]})[_0x563a('0x29')](function(_0x2afa8c){if(_0x2afa8c&&_0x2afa8c[_0x563a('0x5d')]===0x0){return db[_0x563a('0x2d')][_0x563a('0x55')]({'name':_0x22cc91[_0x563a('0x31')],'resourceId':_0x22cc91['id'],'type':_0x2afa8c[_0x563a('0x31')],'sectionId':_0x2afa8c['id']},{})[_0x563a('0x29')](function(){return _0x1fc4d2;});}else{return _0x1fc4d2;}})['catch'](function(_0x1926f1){logger[_0x563a('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1926f1);throw _0x1926f1;});}return _0x1fc4d2;})['then'](respondWithResult(_0x13530f,null))[_0x563a('0x4e')](handleError(_0x13530f,null));};function Extension(_0x709bfd,_0x579d61,_0x19edc3,_0x59e371){this[_0x563a('0x5e')]=_0x563a('0x5f');this[_0x563a('0x60')]=_0x709bfd;this[_0x563a('0x61')]=_0x19edc3;this[_0x563a('0x35')]='system';this['description']='Voice\x20Prefix\x20Extension';this['priority']=_0x579d61;this[_0x563a('0x62')]=_0x59e371;}function createVoicePrefixExtensions(_0x5141d5,_0x111444,_0x496b6a){return new BPromise(function(_0x2a82cf,_0x3f2750){var _0xbe3343=new Extension(formatPrefixName(_0x5141d5[_0x563a('0x63')]),0x1,_0x563a('0x64'),'Voice\x20Prefix');_0xbe3343[_0x563a('0x65')]=_0x5141d5['id'];return db['VoiceExtension']['create'](_0xbe3343,{'transaction':_0x496b6a})[_0x563a('0x29')](function(_0x3b7993){var _0x409f3c=_0x3b7993[_0x563a('0x2b')]({'plain':!![]});var _0x1c8ad7=_['map'](addVoicePrefixExtensions(_0x5141d5,_0x111444),function(_0x10eb03){_0x10eb03[_0x563a('0x57')]=_0x409f3c['id'];_0x10eb03[_0x563a('0x65')]=_0x5141d5['id'];return _0x10eb03;});return db[_0x563a('0x66')][_0x563a('0x67')](_0x1c8ad7,{'transaction':_0x496b6a})['then'](function(_0xac578c){if(!_0xac578c){return _0x3f2750('Extensions\x20creation\x20failed');}else{return _0x2a82cf(_0xac578c);}})[_0x563a('0x4e')](function(_0x201c9d){return _0x3f2750(_0x201c9d);});});;});};function addVoicePrefixExtensions(_0x47d6cd,_0x34dd59){var _0x30bf2b=[];var _0x18a26b=formatPrefixName(_0x47d6cd[_0x563a('0x63')]);_0x30bf2b[_0x563a('0x68')](new Extension(_0x18a26b,0x2,_0x563a('0x69'),_0x563a('0x6a')+_0x47d6cd[_0x563a('0x31')]));if(_0x47d6cd['callerIdAll']){_0x30bf2b[_0x563a('0x68')](new Extension(_0x18a26b,0x3,_0x563a('0x69'),_0x563a('0x6b')+_0x47d6cd[_0x563a('0x6c')]));}else{_0x30bf2b[_0x563a('0x68')](new Extension(_0x18a26b,0x3,_0x563a('0x64'),_0x563a('0x6d')));}_0x30bf2b['push'](new Extension(_0x18a26b,0x4,_0x563a('0x6e'),_0x34dd59['context']+','+'${EXTEN:'+(0x8+_0x47d6cd['name'][_0x563a('0x3e')])+'}'+','+0x1));return _0x30bf2b;}function formatPrefixName(_0x4e4e60){var _0x529587='_';for(var _0x30d775=0x0;_0x30d775<_0x4e4e60[_0x563a('0x3e')];_0x30d775++){if(_0x4e4e60[_0x563a('0x6f')](_0x30d775)=='-'){_0x529587+=_0x4e4e60[_0x563a('0x6f')](_0x30d775);}else{_0x529587+='['+_0x4e4e60[_0x563a('0x6f')](_0x30d775)+']';}}_0x529587+='.';return _0x529587;}exports['update']=function(_0x4814b3,_0x4c9ad7,_0x39b8f8){var _0x8b2e10=_0x4814b3[_0x563a('0x56')];_0x8b2e10[_0x563a('0x63')]=_0x563a('0x70')+_0x8b2e10[_0x563a('0x31')]+'-';return db['sequelize'][_0x563a('0x71')](function(_0x43b2f1){return db['VoicePrefix'][_0x563a('0x28')](_0x8b2e10,{'where':{'id':_0x8b2e10['id']},'transaction':_0x43b2f1})[_0x563a('0x29')](function(){return db[_0x563a('0x66')]['destroy']({'where':{'VoicePrefixId':_0x8b2e10['id']},'transaction':_0x43b2f1})[_0x563a('0x29')](function(){return db[_0x563a('0x66')][_0x563a('0x53')]({'where':{'id':_0x8b2e10[_0x563a('0x57')]},'raw':!![]})['then'](function(_0x229690){return createVoicePrefixExtensions(_0x8b2e10,_0x229690,_0x43b2f1);});});});})[_0x563a('0x29')](function(){return db[_0x563a('0x4b')][_0x563a('0x72')](_0x8b2e10['id']);})[_0x563a('0x29')](respondWithResult(_0x4c9ad7,null))['catch'](handleError(_0x4c9ad7,null));};exports['addAgents']=function(_0x4346fe,_0x598a91,_0x46beba){return db[_0x563a('0x4b')][_0x563a('0x53')]({'where':{'id':_0x4346fe[_0x563a('0x50')]['id']}})[_0x563a('0x29')](handleEntityNotFound(_0x598a91,null))[_0x563a('0x29')](function(_0x3f66be){if(_0x3f66be){return _0x3f66be[_0x563a('0x73')](_0x4346fe[_0x563a('0x56')][_0x563a('0x74')],_['omit'](_0x4346fe[_0x563a('0x56')],['ids','id'])||{})[_0x563a('0x75')](function(_0x441933){for(var _0x54c512=0x0;_0x54c512<_0x4346fe[_0x563a('0x56')]['ids'][_0x563a('0x3e')];_0x54c512+=0x1){socket[_0x563a('0x76')]('userVoicePrefix:save',{'UserId':Number(_0x4346fe[_0x563a('0x56')][_0x563a('0x74')][_0x54c512]),'VoicePrefixId':Number(_0x4346fe[_0x563a('0x50')]['id'])});}return _0x441933;});}})[_0x563a('0x29')](respondWithResult(_0x598a91,null))['catch'](handleError(_0x598a91,null));};exports[_0x563a('0x77')]=function(_0x31faef,_0x17000b,_0x3cdfc1){return db[_0x563a('0x4b')][_0x563a('0x53')]({'where':{'id':_0x31faef[_0x563a('0x50')]['id']}})[_0x563a('0x29')](handleEntityNotFound(_0x17000b,null))[_0x563a('0x29')](function(_0x238ae4){if(_0x238ae4){return _0x238ae4['removeAgents'](_0x31faef[_0x563a('0x39')][_0x563a('0x74')])[_0x563a('0x29')](function(){if(_['isArray'](_0x31faef[_0x563a('0x39')][_0x563a('0x74')])){for(var _0x3dc800=0x0;_0x3dc800<_0x31faef[_0x563a('0x39')][_0x563a('0x74')][_0x563a('0x3e')];_0x3dc800+=0x1){socket[_0x563a('0x76')](_0x563a('0x78'),{'UserId':Number(_0x31faef[_0x563a('0x39')][_0x563a('0x74')][_0x3dc800]),'VoicePrefixId':Number(_0x31faef[_0x563a('0x50')]['id'])});}}else{socket[_0x563a('0x76')](_0x563a('0x78'),{'UserId':Number(_0x31faef['query'][_0x563a('0x74')]),'VoicePrefixId':Number(_0x31faef[_0x563a('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x17000b,null))[_0x563a('0x4e')](handleError(_0x17000b,null));};exports[_0x563a('0x79')]=function(_0x1ecca5,_0x162ab6,_0xf3ed04){var _0x44cbb4={};var _0x3a00b8={};var _0x9b753b;var _0x41898f;return db['VoicePrefix'][_0x563a('0x7a')]({'where':{'id':_0x1ecca5[_0x563a('0x50')]['id']}})[_0x563a('0x29')](handleEntityNotFound(_0x162ab6,null))[_0x563a('0x29')](function(_0x4c5547){if(_0x4c5547){_0x9b753b=_0x4c5547;_0x3a00b8['model']=_['keys'](db[_0x563a('0x7b')][_0x563a('0x51')]);_0x3a00b8[_0x563a('0x39')]=_[_0x563a('0x52')](_0x1ecca5[_0x563a('0x39')]);_0x3a00b8[_0x563a('0x3a')]=_[_0x563a('0x3b')](_0x3a00b8[_0x563a('0x37')],_0x3a00b8[_0x563a('0x39')]);_0x44cbb4[_0x563a('0x3c')]=_['intersection'](_0x3a00b8[_0x563a('0x37')],qs[_0x563a('0x3d')](_0x1ecca5[_0x563a('0x39')][_0x563a('0x3d')]));_0x44cbb4[_0x563a('0x3c')]=_0x44cbb4[_0x563a('0x3c')][_0x563a('0x3e')]?_0x44cbb4[_0x563a('0x3c')]:_0x3a00b8[_0x563a('0x37')];_0x44cbb4[_0x563a('0x42')]=qs[_0x563a('0x43')](_0x1ecca5[_0x563a('0x39')][_0x563a('0x43')]);_0x44cbb4['where']=qs[_0x563a('0x3a')](_[_0x563a('0x7c')](_0x1ecca5[_0x563a('0x39')],_0x3a00b8[_0x563a('0x3a')]));if(_0x1ecca5[_0x563a('0x39')][_0x563a('0x45')]){_0x44cbb4[_0x563a('0x44')]=_['merge'](_0x44cbb4[_0x563a('0x44')],{'$or':_[_0x563a('0x38')](_0x44cbb4[_0x563a('0x3c')],function(_0x562120){var _0x1e3b8c={};_0x1e3b8c[_0x562120]={'$like':'%'+_0x1ecca5[_0x563a('0x39')][_0x563a('0x45')]+'%'};return _0x1e3b8c;})});}_0x44cbb4=_[_0x563a('0x46')]({},_0x44cbb4,_0x1ecca5[_0x563a('0x48')]);return _0x9b753b[_0x563a('0x79')](_0x44cbb4);}})['then'](function(_0x2d46f5){if(_0x2d46f5){_0x41898f=_0x2d46f5[_0x563a('0x3e')];if(!_0x1ecca5[_0x563a('0x39')][_0x563a('0x3f')](_0x563a('0x40'))){_0x44cbb4['limit']=qs[_0x563a('0x41')](_0x1ecca5[_0x563a('0x39')][_0x563a('0x41')]);_0x44cbb4[_0x563a('0x21')]=qs['offset'](_0x1ecca5[_0x563a('0x39')][_0x563a('0x21')]);}return _0x9b753b['getAgents'](_0x44cbb4);}})['then'](function(_0x458a21){if(_0x458a21){return _0x458a21?{'count':_0x41898f,'rows':_0x458a21}:null;}})[_0x563a('0x29')](respondWithResult(_0x162ab6,null))[_0x563a('0x4e')](handleError(_0x162ab6,null));};exports[_0x563a('0x7d')]=function(_0x241361,_0x31a58e,_0x1e324a){var _0x38857b={};var _0x43b6a2={};var _0x2385eb;var _0x36fe22;return db['VoicePrefix'][_0x563a('0x7a')]({'where':{'id':_0x241361[_0x563a('0x50')]['id']}})[_0x563a('0x29')](handleEntityNotFound(_0x31a58e,null))['then'](function(_0x1dc77d){if(_0x1dc77d){_0x2385eb=_0x1dc77d;_0x43b6a2[_0x563a('0x37')]=_['keys'](db[_0x563a('0x7e')][_0x563a('0x51')]);_0x43b6a2[_0x563a('0x39')]=_[_0x563a('0x52')](_0x241361[_0x563a('0x39')]);_0x43b6a2[_0x563a('0x3a')]=_[_0x563a('0x3b')](_0x43b6a2[_0x563a('0x37')],_0x43b6a2['query']);_0x38857b[_0x563a('0x3c')]=_[_0x563a('0x3b')](_0x43b6a2[_0x563a('0x37')],qs[_0x563a('0x3d')](_0x241361[_0x563a('0x39')]['fields']));_0x38857b[_0x563a('0x3c')]=_0x38857b['attributes']['length']?_0x38857b[_0x563a('0x3c')]:_0x43b6a2[_0x563a('0x37')];_0x38857b[_0x563a('0x42')]=qs[_0x563a('0x43')](_0x241361['query'][_0x563a('0x43')]);_0x38857b[_0x563a('0x44')]=qs['filters'](_[_0x563a('0x7c')](_0x241361['query'],_0x43b6a2[_0x563a('0x3a')]));if(_0x241361[_0x563a('0x39')][_0x563a('0x45')]){_0x38857b[_0x563a('0x44')]=_[_0x563a('0x46')](_0x38857b[_0x563a('0x44')],{'$or':_[_0x563a('0x38')](_0x38857b[_0x563a('0x3c')],function(_0x372e43){var _0x484953={};_0x484953[_0x372e43]={'$like':'%'+_0x241361[_0x563a('0x39')]['filter']+'%'};return _0x484953;})});}_0x38857b=_['merge']({},_0x38857b,_0x241361[_0x563a('0x48')]);return _0x2385eb[_0x563a('0x7d')](_0x38857b);}})['then'](function(_0x44859c){if(_0x44859c){_0x36fe22=_0x44859c[_0x563a('0x3e')];if(!_0x241361[_0x563a('0x39')][_0x563a('0x3f')](_0x563a('0x40'))){_0x38857b[_0x563a('0x41')]=qs[_0x563a('0x41')](_0x241361[_0x563a('0x39')]['limit']);_0x38857b[_0x563a('0x21')]=qs[_0x563a('0x21')](_0x241361['query'][_0x563a('0x21')]);}return _0x2385eb[_0x563a('0x7d')](_0x38857b);}})['then'](function(_0x38601a){if(_0x38601a){return _0x38601a?{'count':_0x36fe22,'rows':_0x38601a}:null;}})[_0x563a('0x29')](respondWithResult(_0x31a58e,null))[_0x563a('0x4e')](handleError(_0x31a58e,null));};exports['addTeams']=function(_0x10c81e,_0x4928de,_0x95bb77){var _0x33d74b=_0x10c81e[_0x563a('0x56')]['ids'];var _0x2d9810;return db['Team'][_0x563a('0x4c')]({'where':{'id':_0x33d74b},'attributes':['id'],'include':[{'model':db['User'],'as':_0x563a('0x7f'),'attributes':['id',_0x563a('0x31'),_0x563a('0x80'),_0x563a('0x81'),_0x563a('0x82')],'raw':!![]}]})[_0x563a('0x29')](function(_0x2d2cb9){if(_0x2d2cb9){_0x2d9810=_0x2d2cb9;var _0x2c4b52=_[_0x563a('0x83')](_0x2d2cb9,function(_0x5c8df5){var _0x579601=_0x5c8df5[_0x563a('0x2b')]({'plain':!![]});return _0x579601[_0x563a('0x7f')];});return db['VoicePrefix'][_0x563a('0x53')]({'where':{'id':_0x10c81e[_0x563a('0x50')]['id']}})[_0x563a('0x29')](function(_0x1ebdd0){return db[_0x563a('0x84')][_0x563a('0x71')](function(_0x2a3bdd){return _0x1ebdd0['addTeams'](_0x33d74b,{'transaction':_0x2a3bdd})[_0x563a('0x29')](function(){return BPromise[_0x563a('0x85')](_0x2d9810,function(_0x28bbe5){return db[_0x563a('0x86')]['upsert']({'TeamId':_0x28bbe5['id'],'VoicePrefixId':_0x10c81e[_0x563a('0x50')]['id']},{'transaction':_0x2a3bdd});});})[_0x563a('0x29')](function(){return BPromise[_0x563a('0x85')](_0x2c4b52,function(_0x150fd6){return db[_0x563a('0x87')][_0x563a('0x88')]({'where':{'UserId':_0x150fd6['id'],'VoicePrefixId':_0x10c81e[_0x563a('0x50')]['id']},'transaction':_0x2a3bdd});});})[_0x563a('0x29')](function(){_0x2c4b52[_0x563a('0x89')](function(_0x3f78b7){socket[_0x563a('0x76')](_0x563a('0x8a'),{'UserId':_0x3f78b7['id'],'VoicePrefixId':_0x1ebdd0['id']});});});});});}})[_0x563a('0x29')](respondWithStatusCode(_0x4928de,null))[_0x563a('0x4e')](handleError(_0x4928de,null));};exports[_0x563a('0x8b')]=function(_0x115188,_0x713637,_0x12bb1b){return db[_0x563a('0x7e')][_0x563a('0x4c')]({'where':{'id':_0x115188[_0x563a('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0x563a('0x7b')],'as':_0x563a('0x7f'),'attributes':['id'],'raw':!![]}]})[_0x563a('0x29')](handleEntityNotFound(_0x713637,null))[_0x563a('0x29')](function(_0xb9cbc9){var _0x42831f=_[_0x563a('0x38')](_0xb9cbc9,'id');var _0x5385e0=[];var _0x1d0ed4=[];var _0x14bc9e=squel[_0x563a('0x8c')]();_0x14bc9e[_0x563a('0x8d')](_0x563a('0x8e'))['from'](_0x563a('0x8f'),'tq')['join'](_0x563a('0x90'),'ut',_0x563a('0x91'))[_0x563a('0x44')]('VoicePrefixId\x20=\x20?',_0x115188[_0x563a('0x50')]['id']);for(var _0x25e5d1=0x0;_0x25e5d1<_0xb9cbc9[_0x563a('0x3e')];_0x25e5d1+=0x1){let _0x5ba698=_0xb9cbc9[_0x25e5d1];for(var _0x2dadc1=0x0;_0x2dadc1<_0x5ba698[_0x563a('0x7f')]['length'];_0x2dadc1+=0x1){let _0x55f64e=_0x5ba698[_0x563a('0x7f')][_0x2dadc1];var _0x41d0df=_0x14bc9e['clone']();_0x41d0df['where'](_0x563a('0x92'),_0x55f64e['id']);_0x1d0ed4['push'](db[_0x563a('0x84')][_0x563a('0x39')](_0x41d0df[_0x563a('0x93')](),{'type':db[_0x563a('0x84')][_0x563a('0x94')][_0x563a('0x95')]})[_0x563a('0x29')](function(_0xc24817){if(_0xc24817[_0x563a('0x3e')]===0x1){return _0x55f64e['id'];}else{var _0xd04cd=_[_0x563a('0x96')](_['map'](_0xc24817,'TeamId'),function(_0x571a84){return _[_0x563a('0x97')](_0x42831f,_0x571a84);});if(_0xd04cd){return _0x55f64e['id'];}}}));}}return BPromise[_0x563a('0x98')](_0x1d0ed4)[_0x563a('0x29')](function(_0x5244e5){_0x5385e0=_(_0x5385e0)['union'](_0x5244e5)[_0x563a('0x99')]()[_0x563a('0x9a')]();return db[_0x563a('0x4b')][_0x563a('0x53')]({'where':{'id':_0x115188[_0x563a('0x50')]['id']}})[_0x563a('0x29')](function(_0x23e33f){return db['sequelize'][_0x563a('0x71')](function(_0x25049d){return _0x23e33f[_0x563a('0x8b')](_0x115188[_0x563a('0x39')][_0x563a('0x74')],{'transaction':_0x25049d})[_0x563a('0x29')](function(){if(!_[_0x563a('0x9b')](_0x5385e0)){return _0x23e33f[_0x563a('0x77')](_0x5385e0,{'transaction':_0x25049d});}})[_0x563a('0x29')](function(){_0x5385e0[_0x563a('0x89')](function(_0x482d21){socket[_0x563a('0x76')]('userVoicePrefix:remove',{'UserId':_0x482d21,'VoicePrefixId':_0x23e33f['id']});});});});});});})[_0x563a('0x29')](respondWithStatusCode(_0x713637,null))[_0x563a('0x4e')](handleError(_0x713637,null));}; \ No newline at end of file +var _0xd914=['Voice\x20Prefix\x20Extension','priority','appdata','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','push','Set','PREFIX-CALLERIDALL=','callerIdAll','NoOp','No\x20callerid\x20available','goto','${EXTEN:','charAt','update','sequelize','findById','addAgents','ids','omit','emit','removeAgents','isArray','userVoicePrefix:remove','findOne','User','pick','getAgents','hasOwnProperty','nolimit','getTeams','Team','addTeams','Agents','online','voicePause','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','removeTeams','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','union','compact','value','isEmpty','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','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/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','VoicePrefixes','UserProfileResource','sendStatus','error','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','describe','create','transaction','body','get','VoiceExtension','VoiceExtensionId','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','type','system','description'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd914,0x17f));var _0x4d91=function(_0x25b24a,_0x1c0163){_0x25b24a=_0x25b24a-0x0;var _0x224e68=_0xd914[_0x25b24a];return _0x224e68;};'use strict';var emlformat=require(_0x4d91('0x0'));var rimraf=require(_0x4d91('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d91('0x2'));var rp=require(_0x4d91('0x3'));var moment=require(_0x4d91('0x4'));var BPromise=require(_0x4d91('0x5'));var Mustache=require(_0x4d91('0x6'));var util=require(_0x4d91('0x7'));var path=require('path');var sox=require(_0x4d91('0x8'));var csv=require('to-csv');var ejs=require(_0x4d91('0x9'));var fs=require('fs');var fs_extra=require(_0x4d91('0xa'));var _=require(_0x4d91('0xb'));var squel=require(_0x4d91('0xc'));var crypto=require(_0x4d91('0xd'));var jsforce=require(_0x4d91('0xe'));var deskjs=require(_0x4d91('0xf'));var toCsv=require(_0x4d91('0x10'));var querystring=require('querystring');var Papa=require(_0x4d91('0x11'));var Redis=require(_0x4d91('0x12'));var authService=require(_0x4d91('0x13'));var qs=require(_0x4d91('0x14'));var as=require(_0x4d91('0x15'));var hardwareService=require(_0x4d91('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x4d91('0x17'));var config=require(_0x4d91('0x18'));var licenseUtil=require(_0x4d91('0x19'));var db=require(_0x4d91('0x1a'))['db'];config[_0x4d91('0x1b')]=_[_0x4d91('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4d91('0x1d'))(new Redis(config[_0x4d91('0x1b')]));require(_0x4d91('0x1e'))[_0x4d91('0x1f')](socket);function respondWithStatusCode(_0x33fbd4,_0x25bafc){_0x25bafc=_0x25bafc||0xcc;return function(_0x36f606){if(_0x36f606){return _0x33fbd4['sendStatus'](_0x25bafc);}return _0x33fbd4[_0x4d91('0x20')](_0x25bafc)[_0x4d91('0x21')]();};}function respondWithResult(_0x1e2ef7,_0xb92681){_0xb92681=_0xb92681||0xc8;return function(_0x280e80){if(_0x280e80){return _0x1e2ef7['status'](_0xb92681)[_0x4d91('0x22')](_0x280e80);}};}function respondWithFilteredResult(_0xb75abf,_0x241564){return function(_0x44b9a7){if(_0x44b9a7){var _0x4cfa40=typeof _0x241564[_0x4d91('0x23')]===_0x4d91('0x24')&&typeof _0x241564[_0x4d91('0x25')]==='undefined';var _0x13ef2c=_0x44b9a7[_0x4d91('0x26')];var _0x351388=_0x4cfa40?0x0:_0x241564[_0x4d91('0x23')];var _0x10b767=_0x4cfa40?_0x44b9a7[_0x4d91('0x26')]:_0x241564[_0x4d91('0x23')]+_0x241564[_0x4d91('0x25')];var _0x30d911;if(_0x10b767>=_0x13ef2c){_0x10b767=_0x13ef2c;_0x30d911=0xc8;}else{_0x30d911=0xce;}_0xb75abf[_0x4d91('0x20')](_0x30d911);return _0xb75abf['set'](_0x4d91('0x27'),_0x351388+'-'+_0x10b767+'/'+_0x13ef2c)['json'](_0x44b9a7);}return null;};}function patchUpdates(_0x57913e){return function(_0x74a697){try{jsonpatch[_0x4d91('0x28')](_0x74a697,_0x57913e,!![]);}catch(_0x341d18){return BPromise[_0x4d91('0x29')](_0x341d18);}return _0x74a697[_0x4d91('0x2a')]();};}function saveUpdates(_0x12b722,_0x100cd4){return function(_0x123606){if(_0x123606){return _0x123606['update'](_0x12b722)['then'](function(_0x1ee6b3){return _0x1ee6b3;});}return null;};}function removeEntity(_0x112923,_0x3bed98){return function(_0x45fc91){if(_0x45fc91){return _0x45fc91[_0x4d91('0x2b')]()[_0x4d91('0x2c')](function(){var _0x14bdb4=_0x45fc91['get']({'plain':!![]});var _0x3dc353=_0x4d91('0x2d');return db[_0x4d91('0x2e')]['destroy']({'where':{'type':_0x3dc353,'resourceId':_0x14bdb4['id']}})['then'](function(){return _0x45fc91;});})[_0x4d91('0x2c')](function(){_0x112923[_0x4d91('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50fe76,_0x42d5a0){return function(_0x2d6981){if(!_0x2d6981){_0x50fe76[_0x4d91('0x2f')](0x194);}return _0x2d6981;};}function handleError(_0x17c7bc,_0x4f23dd){_0x4f23dd=_0x4f23dd||0x1f4;return function(_0x2587a1){logger[_0x4d91('0x30')](_0x2587a1[_0x4d91('0x31')]);if(_0x2587a1[_0x4d91('0x32')]){delete _0x2587a1[_0x4d91('0x32')];}_0x17c7bc[_0x4d91('0x20')](_0x4f23dd)[_0x4d91('0x33')](_0x2587a1);};}exports['index']=function(_0x82f585,_0x4f44ff){var _0x4ad7bf={},_0x292808={},_0x3a2780={'count':0x0,'rows':[]};var _0x4f95f0=_[_0x4d91('0x34')](db[_0x4d91('0x35')][_0x4d91('0x36')],function(_0x2be3f5){return{'name':_0x2be3f5[_0x4d91('0x37')],'type':_0x2be3f5['type'][_0x4d91('0x38')]};});_0x292808[_0x4d91('0x39')]=_[_0x4d91('0x34')](_0x4f95f0,_0x4d91('0x32'));_0x292808[_0x4d91('0x3a')]=_[_0x4d91('0x3b')](_0x82f585['query']);_0x292808[_0x4d91('0x3c')]=_[_0x4d91('0x3d')](_0x292808['model'],_0x292808[_0x4d91('0x3a')]);_0x4ad7bf[_0x4d91('0x3e')]=_[_0x4d91('0x3d')](_0x292808['model'],qs[_0x4d91('0x3f')](_0x82f585[_0x4d91('0x3a')][_0x4d91('0x3f')]));_0x4ad7bf[_0x4d91('0x3e')]=_0x4ad7bf['attributes'][_0x4d91('0x40')]?_0x4ad7bf[_0x4d91('0x3e')]:_0x292808[_0x4d91('0x39')];if(!_0x82f585[_0x4d91('0x3a')]['hasOwnProperty']('nolimit')){_0x4ad7bf[_0x4d91('0x25')]=qs[_0x4d91('0x25')](_0x82f585['query'][_0x4d91('0x25')]);_0x4ad7bf[_0x4d91('0x23')]=qs[_0x4d91('0x23')](_0x82f585[_0x4d91('0x3a')]['offset']);}_0x4ad7bf[_0x4d91('0x41')]=qs[_0x4d91('0x42')](_0x82f585['query'][_0x4d91('0x42')]);_0x4ad7bf['where']=qs[_0x4d91('0x3c')](_['pick'](_0x82f585[_0x4d91('0x3a')],_0x292808['filters']),_0x4f95f0);if(_0x82f585[_0x4d91('0x3a')][_0x4d91('0x43')]){_0x4ad7bf[_0x4d91('0x44')]=_[_0x4d91('0x45')](_0x4ad7bf['where'],{'$or':_['map'](_0x4f95f0,function(_0x25e0f5){if(_0x25e0f5['type']!==_0x4d91('0x46')){var _0x282d64={};_0x282d64[_0x25e0f5['name']]={'$like':'%'+_0x82f585[_0x4d91('0x3a')][_0x4d91('0x43')]+'%'};return _0x282d64;}})});}_0x4ad7bf=_[_0x4d91('0x45')]({},_0x4ad7bf,_0x82f585[_0x4d91('0x47')]);var _0x1c6d0b={'where':_0x4ad7bf[_0x4d91('0x44')]};return db[_0x4d91('0x35')]['count'](_0x1c6d0b)[_0x4d91('0x2c')](function(_0x4c70af){_0x3a2780[_0x4d91('0x26')]=_0x4c70af;if(_0x82f585[_0x4d91('0x3a')][_0x4d91('0x48')]){_0x4ad7bf[_0x4d91('0x49')]=[{'all':!![]}];}return db[_0x4d91('0x35')][_0x4d91('0x4a')](_0x4ad7bf);})['then'](function(_0x4ffc08){_0x3a2780[_0x4d91('0x4b')]=_0x4ffc08;return _0x3a2780;})[_0x4d91('0x2c')](respondWithFilteredResult(_0x4f44ff,_0x4ad7bf))['catch'](handleError(_0x4f44ff,null));};exports[_0x4d91('0x4c')]=function(_0x164658,_0x342de1){var _0x3f8659={'raw':![],'where':{'id':_0x164658[_0x4d91('0x4d')]['id']}},_0x31f21a={};_0x31f21a[_0x4d91('0x39')]=_[_0x4d91('0x3b')](db[_0x4d91('0x35')]['rawAttributes']);_0x31f21a['query']=_[_0x4d91('0x3b')](_0x164658['query']);_0x31f21a[_0x4d91('0x3c')]=_[_0x4d91('0x3d')](_0x31f21a[_0x4d91('0x39')],_0x31f21a[_0x4d91('0x3a')]);_0x3f8659['attributes']=_[_0x4d91('0x3d')](_0x31f21a['model'],qs['fields'](_0x164658[_0x4d91('0x3a')][_0x4d91('0x3f')]));_0x3f8659[_0x4d91('0x3e')]=_0x3f8659[_0x4d91('0x3e')][_0x4d91('0x40')]?_0x3f8659[_0x4d91('0x3e')]:_0x31f21a['model'];if(_0x164658[_0x4d91('0x3a')][_0x4d91('0x48')]){_0x3f8659[_0x4d91('0x49')]=[{'all':!![]}];}_0x3f8659=_[_0x4d91('0x45')]({},_0x3f8659,_0x164658[_0x4d91('0x47')]);return db[_0x4d91('0x35')][_0x4d91('0x4e')](_0x3f8659)[_0x4d91('0x2c')](handleEntityNotFound(_0x342de1,null))[_0x4d91('0x2c')](respondWithResult(_0x342de1,null))[_0x4d91('0x4f')](handleError(_0x342de1,null));};exports[_0x4d91('0x2b')]=function(_0x5a67fa,_0xa5c630){return db['VoicePrefix'][_0x4d91('0x4e')]({'where':{'id':_0x5a67fa[_0x4d91('0x4d')]['id']}})[_0x4d91('0x2c')](handleEntityNotFound(_0xa5c630,null))[_0x4d91('0x2c')](removeEntity(_0xa5c630,null))[_0x4d91('0x4f')](handleError(_0xa5c630,null));};exports[_0x4d91('0x50')]=function(_0x3028b1,_0x22b341){return db['VoicePrefix'][_0x4d91('0x50')]()[_0x4d91('0x2c')](respondWithResult(_0x22b341,null))[_0x4d91('0x4f')](handleError(_0x22b341,null));};exports[_0x4d91('0x51')]=function(_0x26ecd7,_0x19e57e){var _0x5765ce;return db['sequelize'][_0x4d91('0x52')](function(_0x2159e4){return db[_0x4d91('0x35')][_0x4d91('0x51')](_0x26ecd7[_0x4d91('0x53')],{'transaction':_0x2159e4})[_0x4d91('0x2c')](function(_0x2875f4){_0x5765ce=_0x2875f4[_0x4d91('0x54')]({'plain':!![]});return db[_0x4d91('0x55')][_0x4d91('0x4e')]({'where':{'id':_0x5765ce[_0x4d91('0x56')]},'raw':!![]})[_0x4d91('0x2c')](function(_0x280c41){return createVoicePrefixExtensions(_0x5765ce,_0x280c41,_0x2159e4);});});})[_0x4d91('0x2c')](function(){var _0x3e9154=_0x26ecd7[_0x4d91('0x57')][_0x4d91('0x54')]({'plain':!![]});if(!_0x3e9154)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e9154['role']==='user'){var _0x45cf4e=_0x5765ce;return db[_0x4d91('0x58')][_0x4d91('0x4e')]({'where':{'name':'VoicePrefixes','userProfileId':_0x3e9154[_0x4d91('0x59')]},'raw':!![]})[_0x4d91('0x2c')](function(_0x3985f3){if(_0x3985f3&&_0x3985f3['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x45cf4e[_0x4d91('0x32')],'resourceId':_0x45cf4e['id'],'type':_0x3985f3[_0x4d91('0x32')],'sectionId':_0x3985f3['id']},{})[_0x4d91('0x2c')](function(){return _0x5765ce;});}else{return _0x5765ce;}})[_0x4d91('0x4f')](function(_0x31d6e5){logger['error'](_0x4d91('0x5a'),_0x31d6e5);throw _0x31d6e5;});}return _0x5765ce;})[_0x4d91('0x2c')](respondWithResult(_0x19e57e,null))['catch'](handleError(_0x19e57e,null));};function Extension(_0x563558,_0x3f4f24,_0x544711,_0x3fda50){this[_0x4d91('0x5b')]=_0x4d91('0x5c');this['exten']=_0x563558;this[_0x4d91('0x5d')]=_0x544711;this[_0x4d91('0x5e')]=_0x4d91('0x5f');this[_0x4d91('0x60')]=_0x4d91('0x61');this[_0x4d91('0x62')]=_0x3f4f24;this[_0x4d91('0x63')]=_0x3fda50;}function createVoicePrefixExtensions(_0x524b4f,_0x533572,_0x5eeba8){return new BPromise(function(_0x4bd66d,_0x83395){var _0x8d6db2=new Extension(formatPrefixName(_0x524b4f[_0x4d91('0x64')]),0x1,'NoOp',_0x4d91('0x65'));_0x8d6db2['VoicePrefixId']=_0x524b4f['id'];return db[_0x4d91('0x55')][_0x4d91('0x51')](_0x8d6db2,{'transaction':_0x5eeba8})['then'](function(_0x51a594){var _0x1a707f=_0x51a594[_0x4d91('0x54')]({'plain':!![]});var _0x31150f=_[_0x4d91('0x34')](addVoicePrefixExtensions(_0x524b4f,_0x533572),function(_0x24661a){_0x24661a[_0x4d91('0x56')]=_0x1a707f['id'];_0x24661a[_0x4d91('0x66')]=_0x524b4f['id'];return _0x24661a;});return db[_0x4d91('0x55')][_0x4d91('0x67')](_0x31150f,{'transaction':_0x5eeba8})[_0x4d91('0x2c')](function(_0x5bfb08){if(!_0x5bfb08){return _0x83395('Extensions\x20creation\x20failed');}else{return _0x4bd66d(_0x5bfb08);}})[_0x4d91('0x4f')](function(_0x7e26c2){return _0x83395(_0x7e26c2);});});;});};function addVoicePrefixExtensions(_0x2049ca,_0x13281d){var _0x16ba26=[];var _0x16d384=formatPrefixName(_0x2049ca[_0x4d91('0x64')]);_0x16ba26[_0x4d91('0x68')](new Extension(_0x16d384,0x2,_0x4d91('0x69'),'CDR(prefix)='+_0x2049ca['name']));if(_0x2049ca['callerIdAll']){_0x16ba26['push'](new Extension(_0x16d384,0x3,_0x4d91('0x69'),_0x4d91('0x6a')+_0x2049ca[_0x4d91('0x6b')]));}else{_0x16ba26[_0x4d91('0x68')](new Extension(_0x16d384,0x3,_0x4d91('0x6c'),_0x4d91('0x6d')));}_0x16ba26[_0x4d91('0x68')](new Extension(_0x16d384,0x4,_0x4d91('0x6e'),_0x13281d[_0x4d91('0x5b')]+','+_0x4d91('0x6f')+(0x8+_0x2049ca[_0x4d91('0x32')][_0x4d91('0x40')])+'}'+','+0x1));return _0x16ba26;}function formatPrefixName(_0x4444a2){var _0xef787='_';for(var _0x3bc828=0x0;_0x3bc828<_0x4444a2[_0x4d91('0x40')];_0x3bc828++){if(_0x4444a2[_0x4d91('0x70')](_0x3bc828)=='-'){_0xef787+=_0x4444a2['charAt'](_0x3bc828);}else{_0xef787+='['+_0x4444a2[_0x4d91('0x70')](_0x3bc828)+']';}}_0xef787+='.';return _0xef787;}exports[_0x4d91('0x71')]=function(_0xc4ef10,_0x2e2105,_0x1cad5b){var _0x5ab447=_0xc4ef10[_0x4d91('0x53')];_0x5ab447[_0x4d91('0x64')]='system-'+_0x5ab447[_0x4d91('0x32')]+'-';return db[_0x4d91('0x72')][_0x4d91('0x52')](function(_0xa469a4){return db[_0x4d91('0x35')]['update'](_0x5ab447,{'where':{'id':_0x5ab447['id']},'transaction':_0xa469a4})[_0x4d91('0x2c')](function(){return db[_0x4d91('0x55')]['destroy']({'where':{'VoicePrefixId':_0x5ab447['id']},'transaction':_0xa469a4})[_0x4d91('0x2c')](function(){return db[_0x4d91('0x55')][_0x4d91('0x4e')]({'where':{'id':_0x5ab447['VoiceExtensionId']},'raw':!![]})[_0x4d91('0x2c')](function(_0x403e0c){return createVoicePrefixExtensions(_0x5ab447,_0x403e0c,_0xa469a4);});});});})[_0x4d91('0x2c')](function(){return db[_0x4d91('0x35')][_0x4d91('0x73')](_0x5ab447['id']);})[_0x4d91('0x2c')](respondWithResult(_0x2e2105,null))[_0x4d91('0x4f')](handleError(_0x2e2105,null));};exports['addAgents']=function(_0xdbb484,_0x2e014b,_0x4e7994){return db[_0x4d91('0x35')]['find']({'where':{'id':_0xdbb484['params']['id']}})[_0x4d91('0x2c')](handleEntityNotFound(_0x2e014b,null))['then'](function(_0x1a5376){if(_0x1a5376){return _0x1a5376[_0x4d91('0x74')](_0xdbb484[_0x4d91('0x53')][_0x4d91('0x75')],_[_0x4d91('0x76')](_0xdbb484[_0x4d91('0x53')],[_0x4d91('0x75'),'id'])||{})['spread'](function(_0x485da1){for(var _0x1c27e7=0x0;_0x1c27e7<_0xdbb484[_0x4d91('0x53')][_0x4d91('0x75')][_0x4d91('0x40')];_0x1c27e7+=0x1){socket[_0x4d91('0x77')]('userVoicePrefix:save',{'UserId':Number(_0xdbb484['body'][_0x4d91('0x75')][_0x1c27e7]),'VoicePrefixId':Number(_0xdbb484['params']['id'])});}return _0x485da1;});}})['then'](respondWithResult(_0x2e014b,null))[_0x4d91('0x4f')](handleError(_0x2e014b,null));};exports['removeAgents']=function(_0x585a8d,_0x216c33,_0x1b813c){return db[_0x4d91('0x35')]['find']({'where':{'id':_0x585a8d['params']['id']}})['then'](handleEntityNotFound(_0x216c33,null))[_0x4d91('0x2c')](function(_0x8d84f3){if(_0x8d84f3){return _0x8d84f3[_0x4d91('0x78')](_0x585a8d[_0x4d91('0x3a')][_0x4d91('0x75')])[_0x4d91('0x2c')](function(){if(_[_0x4d91('0x79')](_0x585a8d[_0x4d91('0x3a')][_0x4d91('0x75')])){for(var _0x542f58=0x0;_0x542f58<_0x585a8d[_0x4d91('0x3a')]['ids']['length'];_0x542f58+=0x1){socket[_0x4d91('0x77')](_0x4d91('0x7a'),{'UserId':Number(_0x585a8d[_0x4d91('0x3a')][_0x4d91('0x75')][_0x542f58]),'VoicePrefixId':Number(_0x585a8d['params']['id'])});}}else{socket[_0x4d91('0x77')](_0x4d91('0x7a'),{'UserId':Number(_0x585a8d[_0x4d91('0x3a')][_0x4d91('0x75')]),'VoicePrefixId':Number(_0x585a8d[_0x4d91('0x4d')]['id'])});}});}})[_0x4d91('0x2c')](respondWithStatusCode(_0x216c33,null))[_0x4d91('0x4f')](handleError(_0x216c33,null));};exports['getAgents']=function(_0x28322e,_0x24376e,_0x7bc606){var _0x49d81c={};var _0xc37e2e={};var _0x45a628;var _0x2cf518;return db[_0x4d91('0x35')][_0x4d91('0x7b')]({'where':{'id':_0x28322e[_0x4d91('0x4d')]['id']}})['then'](handleEntityNotFound(_0x24376e,null))[_0x4d91('0x2c')](function(_0x582bee){if(_0x582bee){_0x45a628=_0x582bee;_0xc37e2e[_0x4d91('0x39')]=_['keys'](db[_0x4d91('0x7c')][_0x4d91('0x36')]);_0xc37e2e['query']=_['keys'](_0x28322e['query']);_0xc37e2e[_0x4d91('0x3c')]=_[_0x4d91('0x3d')](_0xc37e2e[_0x4d91('0x39')],_0xc37e2e[_0x4d91('0x3a')]);_0x49d81c[_0x4d91('0x3e')]=_['intersection'](_0xc37e2e['model'],qs[_0x4d91('0x3f')](_0x28322e[_0x4d91('0x3a')][_0x4d91('0x3f')]));_0x49d81c[_0x4d91('0x3e')]=_0x49d81c[_0x4d91('0x3e')][_0x4d91('0x40')]?_0x49d81c[_0x4d91('0x3e')]:_0xc37e2e['model'];_0x49d81c[_0x4d91('0x41')]=qs[_0x4d91('0x42')](_0x28322e[_0x4d91('0x3a')][_0x4d91('0x42')]);_0x49d81c[_0x4d91('0x44')]=qs[_0x4d91('0x3c')](_[_0x4d91('0x7d')](_0x28322e[_0x4d91('0x3a')],_0xc37e2e[_0x4d91('0x3c')]));if(_0x28322e['query'][_0x4d91('0x43')]){_0x49d81c[_0x4d91('0x44')]=_[_0x4d91('0x45')](_0x49d81c[_0x4d91('0x44')],{'$or':_[_0x4d91('0x34')](_0x49d81c[_0x4d91('0x3e')],function(_0x4682a8){var _0x51a30d={};_0x51a30d[_0x4682a8]={'$like':'%'+_0x28322e[_0x4d91('0x3a')][_0x4d91('0x43')]+'%'};return _0x51a30d;})});}_0x49d81c=_['merge']({},_0x49d81c,_0x28322e[_0x4d91('0x47')]);return _0x45a628[_0x4d91('0x7e')](_0x49d81c);}})['then'](function(_0x22cd5a){if(_0x22cd5a){_0x2cf518=_0x22cd5a[_0x4d91('0x40')];if(!_0x28322e[_0x4d91('0x3a')][_0x4d91('0x7f')](_0x4d91('0x80'))){_0x49d81c[_0x4d91('0x25')]=qs['limit'](_0x28322e[_0x4d91('0x3a')][_0x4d91('0x25')]);_0x49d81c[_0x4d91('0x23')]=qs[_0x4d91('0x23')](_0x28322e[_0x4d91('0x3a')]['offset']);}return _0x45a628[_0x4d91('0x7e')](_0x49d81c);}})[_0x4d91('0x2c')](function(_0x3b0ab3){if(_0x3b0ab3){return _0x3b0ab3?{'count':_0x2cf518,'rows':_0x3b0ab3}:null;}})[_0x4d91('0x2c')](respondWithResult(_0x24376e,null))[_0x4d91('0x4f')](handleError(_0x24376e,null));};exports[_0x4d91('0x81')]=function(_0x18f844,_0x3e93d0,_0x53d973){var _0x367c30={};var _0x28b505={};var _0x451e14;var _0x37fe62;return db[_0x4d91('0x35')][_0x4d91('0x7b')]({'where':{'id':_0x18f844[_0x4d91('0x4d')]['id']}})[_0x4d91('0x2c')](handleEntityNotFound(_0x3e93d0,null))[_0x4d91('0x2c')](function(_0x5abc1d){if(_0x5abc1d){_0x451e14=_0x5abc1d;_0x28b505[_0x4d91('0x39')]=_[_0x4d91('0x3b')](db[_0x4d91('0x82')][_0x4d91('0x36')]);_0x28b505['query']=_['keys'](_0x18f844[_0x4d91('0x3a')]);_0x28b505[_0x4d91('0x3c')]=_[_0x4d91('0x3d')](_0x28b505[_0x4d91('0x39')],_0x28b505['query']);_0x367c30[_0x4d91('0x3e')]=_[_0x4d91('0x3d')](_0x28b505[_0x4d91('0x39')],qs[_0x4d91('0x3f')](_0x18f844[_0x4d91('0x3a')][_0x4d91('0x3f')]));_0x367c30[_0x4d91('0x3e')]=_0x367c30[_0x4d91('0x3e')][_0x4d91('0x40')]?_0x367c30['attributes']:_0x28b505[_0x4d91('0x39')];_0x367c30[_0x4d91('0x41')]=qs[_0x4d91('0x42')](_0x18f844[_0x4d91('0x3a')][_0x4d91('0x42')]);_0x367c30[_0x4d91('0x44')]=qs[_0x4d91('0x3c')](_[_0x4d91('0x7d')](_0x18f844[_0x4d91('0x3a')],_0x28b505[_0x4d91('0x3c')]));if(_0x18f844[_0x4d91('0x3a')][_0x4d91('0x43')]){_0x367c30['where']=_[_0x4d91('0x45')](_0x367c30[_0x4d91('0x44')],{'$or':_[_0x4d91('0x34')](_0x367c30[_0x4d91('0x3e')],function(_0x3e57a1){var _0x41fbc7={};_0x41fbc7[_0x3e57a1]={'$like':'%'+_0x18f844[_0x4d91('0x3a')][_0x4d91('0x43')]+'%'};return _0x41fbc7;})});}_0x367c30=_[_0x4d91('0x45')]({},_0x367c30,_0x18f844[_0x4d91('0x47')]);return _0x451e14[_0x4d91('0x81')](_0x367c30);}})[_0x4d91('0x2c')](function(_0x5a241a){if(_0x5a241a){_0x37fe62=_0x5a241a['length'];if(!_0x18f844[_0x4d91('0x3a')]['hasOwnProperty'](_0x4d91('0x80'))){_0x367c30[_0x4d91('0x25')]=qs[_0x4d91('0x25')](_0x18f844[_0x4d91('0x3a')][_0x4d91('0x25')]);_0x367c30[_0x4d91('0x23')]=qs['offset'](_0x18f844[_0x4d91('0x3a')][_0x4d91('0x23')]);}return _0x451e14[_0x4d91('0x81')](_0x367c30);}})[_0x4d91('0x2c')](function(_0x1419c5){if(_0x1419c5){return _0x1419c5?{'count':_0x37fe62,'rows':_0x1419c5}:null;}})[_0x4d91('0x2c')](respondWithResult(_0x3e93d0,null))[_0x4d91('0x4f')](handleError(_0x3e93d0,null));};exports[_0x4d91('0x83')]=function(_0x47cbca,_0x1df276,_0x3e2771){var _0x15d270=_0x47cbca[_0x4d91('0x53')][_0x4d91('0x75')];var _0x17e3bc;return db[_0x4d91('0x82')][_0x4d91('0x4a')]({'where':{'id':_0x15d270},'attributes':['id'],'include':[{'model':db[_0x4d91('0x7c')],'as':_0x4d91('0x84'),'attributes':['id','name',_0x4d91('0x85'),_0x4d91('0x86'),'interface'],'raw':!![]}]})[_0x4d91('0x2c')](function(_0x1f836b){if(_0x1f836b){_0x17e3bc=_0x1f836b;var _0x455dd6=_['flatMap'](_0x1f836b,function(_0x46ccf4){var _0xcc22a2=_0x46ccf4['get']({'plain':!![]});return _0xcc22a2['Agents'];});return db[_0x4d91('0x35')][_0x4d91('0x4e')]({'where':{'id':_0x47cbca[_0x4d91('0x4d')]['id']}})['then'](function(_0x352e84){return db[_0x4d91('0x72')][_0x4d91('0x52')](function(_0x3b2e36){return _0x352e84[_0x4d91('0x83')](_0x15d270,{'transaction':_0x3b2e36})[_0x4d91('0x2c')](function(){return BPromise[_0x4d91('0x87')](_0x17e3bc,function(_0x185ded){return db[_0x4d91('0x88')][_0x4d91('0x89')]({'TeamId':_0x185ded['id'],'VoicePrefixId':_0x47cbca[_0x4d91('0x4d')]['id']},{'transaction':_0x3b2e36});});})['then'](function(){return BPromise[_0x4d91('0x87')](_0x455dd6,function(_0x2a9069){return db[_0x4d91('0x8a')][_0x4d91('0x8b')]({'where':{'UserId':_0x2a9069['id'],'VoicePrefixId':_0x47cbca[_0x4d91('0x4d')]['id']},'transaction':_0x3b2e36});});})[_0x4d91('0x2c')](function(){_0x455dd6[_0x4d91('0x8c')](function(_0xb67bd3){socket[_0x4d91('0x77')](_0x4d91('0x8d'),{'UserId':_0xb67bd3['id'],'VoicePrefixId':_0x352e84['id']});});});});});}})[_0x4d91('0x2c')](respondWithStatusCode(_0x1df276,null))[_0x4d91('0x4f')](handleError(_0x1df276,null));};exports[_0x4d91('0x8e')]=function(_0xbadba4,_0xe88619,_0x44f21b){return db[_0x4d91('0x82')]['findAll']({'where':{'id':_0xbadba4['query'][_0x4d91('0x75')]},'attributes':['id'],'include':[{'model':db[_0x4d91('0x7c')],'as':_0x4d91('0x84'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xe88619,null))[_0x4d91('0x2c')](function(_0x2882d5){var _0x2678e7=_[_0x4d91('0x34')](_0x2882d5,'id');var _0x236a61=[];var _0x54f720=[];var _0x5f2ce4=squel['select']();_0x5f2ce4['field'](_0x4d91('0x8f'))[_0x4d91('0x90')]('team_has_voice_prefixes','tq')[_0x4d91('0x91')](_0x4d91('0x92'),'ut',_0x4d91('0x93'))['where'](_0x4d91('0x94'),_0xbadba4[_0x4d91('0x4d')]['id']);for(var _0x237074=0x0;_0x237074<_0x2882d5['length'];_0x237074+=0x1){let _0x3b4804=_0x2882d5[_0x237074];for(var _0x20212f=0x0;_0x20212f<_0x3b4804[_0x4d91('0x84')][_0x4d91('0x40')];_0x20212f+=0x1){let _0x39de93=_0x3b4804['Agents'][_0x20212f];var _0xe60b6=_0x5f2ce4[_0x4d91('0x95')]();_0xe60b6[_0x4d91('0x44')](_0x4d91('0x96'),_0x39de93['id']);_0x54f720['push'](db[_0x4d91('0x72')][_0x4d91('0x3a')](_0xe60b6[_0x4d91('0x97')](),{'type':db[_0x4d91('0x72')][_0x4d91('0x98')][_0x4d91('0x99')]})['then'](function(_0x12e226){if(_0x12e226[_0x4d91('0x40')]===0x1){return _0x39de93['id'];}else{var _0x448a12=_[_0x4d91('0x9a')](_[_0x4d91('0x34')](_0x12e226,_0x4d91('0x9b')),function(_0x2c5ccc){return _['includes'](_0x2678e7,_0x2c5ccc);});if(_0x448a12){return _0x39de93['id'];}}}));}}return BPromise['all'](_0x54f720)[_0x4d91('0x2c')](function(_0x4026b3){_0x236a61=_(_0x236a61)[_0x4d91('0x9c')](_0x4026b3)[_0x4d91('0x9d')]()[_0x4d91('0x9e')]();return db[_0x4d91('0x35')]['find']({'where':{'id':_0xbadba4[_0x4d91('0x4d')]['id']}})['then'](function(_0x3e23df){return db[_0x4d91('0x72')]['transaction'](function(_0x9d7ff1){return _0x3e23df[_0x4d91('0x8e')](_0xbadba4['query']['ids'],{'transaction':_0x9d7ff1})['then'](function(){if(!_[_0x4d91('0x9f')](_0x236a61)){return _0x3e23df['removeAgents'](_0x236a61,{'transaction':_0x9d7ff1});}})[_0x4d91('0x2c')](function(){_0x236a61[_0x4d91('0x8c')](function(_0x4da3b1){socket['emit'](_0x4d91('0x7a'),{'UserId':_0x4da3b1,'VoicePrefixId':_0x3e23df['id']});});});});});});})[_0x4d91('0x2c')](respondWithStatusCode(_0xe88619,null))[_0x4d91('0x4f')](handleError(_0xe88619,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index f0c2364..b266ee7 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 _0x1594=['emit','hasOwnProperty','hook','exports','events','VoicePrefix','setMaxListeners','remove'];(function(_0x382285,_0x1e4f54){var _0x5a5b70=function(_0x55dfd6){while(--_0x55dfd6){_0x382285['push'](_0x382285['shift']());}};_0x5a5b70(++_0x1e4f54);}(_0x1594,0x184));var _0x4159=function(_0x5cf942,_0x529414){_0x5cf942=_0x5cf942-0x0;var _0x425e71=_0x1594[_0x5cf942];return _0x425e71;};'use strict';var EventEmitter=require(_0x4159('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x4159('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x4159('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4159('0x3')};function emitEvent(_0x16e2b1){return function(_0xbdd64c,_0x6edda0,_0x11fa1b){VoicePrefixEvents[_0x4159('0x4')](_0x16e2b1+':'+_0xbdd64c['id'],_0xbdd64c);VoicePrefixEvents[_0x4159('0x4')](_0x16e2b1,_0xbdd64c);_0x11fa1b(null);};}for(var e in events){if(events[_0x4159('0x5')](e)){var event=events[e];VoicePrefix[_0x4159('0x6')](e,emitEvent(event));}}module[_0x4159('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0xef2b=['emit','hasOwnProperty','hook','exports','events','VoicePrefix','save','update'];(function(_0x557404,_0x1f162){var _0x2fdec8=function(_0x3f4ef2){while(--_0x3f4ef2){_0x557404['push'](_0x557404['shift']());}};_0x2fdec8(++_0x1f162);}(_0xef2b,0x1b4));var _0xbef2=function(_0x206a0d,_0x5e70d6){_0x206a0d=_0x206a0d-0x0;var _0x1a38d8=_0xef2b[_0x206a0d];return _0x1a38d8;};'use strict';var EventEmitter=require(_0xbef2('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0xbef2('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbef2('0x2'),'afterUpdate':_0xbef2('0x3'),'afterDestroy':'remove'};function emitEvent(_0x54b55e){return function(_0x45b722,_0x9e291f,_0xac269){VoicePrefixEvents[_0xbef2('0x4')](_0x54b55e+':'+_0x45b722['id'],_0x45b722);VoicePrefixEvents[_0xbef2('0x4')](_0x54b55e,_0x45b722);_0xac269(null);};}for(var e in events){if(events[_0xbef2('0x5')](e)){var event=events[e];VoicePrefix[_0xbef2('0x6')](e,emitEvent(event));}}module[_0xbef2('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index d1b3b96..8f8c20c 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 _0x9f5a=['voice_prefixes','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','define','VoicePrefix'];(function(_0x20852f,_0x224a17){var _0x18abb7=function(_0x2f5299){while(--_0x2f5299){_0x20852f['push'](_0x20852f['shift']());}};_0x18abb7(++_0x224a17);}(_0x9f5a,0x109));var _0xa9f5=function(_0x56fb92,_0x519dda){_0x56fb92=_0x56fb92-0x0;var _0xa9defa=_0x9f5a[_0x56fb92];return _0xa9defa;};'use strict';var _=require(_0xa9f5('0x0'));var util=require(_0xa9f5('0x1'));var logger=require(_0xa9f5('0x2'))('api');var moment=require(_0xa9f5('0x3'));var BPromise=require(_0xa9f5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa9f5('0x5'));var rimraf=require(_0xa9f5('0x6'));var config=require(_0xa9f5('0x7'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x269c94,_0x3e29d7){return _0x269c94[_0xa9f5('0x8')](_0xa9f5('0x9'),attributes,{'tableName':_0xa9f5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a0b=['lodash','util','api','bluebird','rimraf','../../config/environment','./voicePrefix.attributes','exports','VoicePrefix','voice_prefixes'];(function(_0xb61e1b,_0x9f371a){var _0x482007=function(_0x4832f5){while(--_0x4832f5){_0xb61e1b['push'](_0xb61e1b['shift']());}};_0x482007(++_0x9f371a);}(_0x4a0b,0x1e0));var _0xb4a0=function(_0x3116c9,_0x1db034){_0x3116c9=_0x3116c9-0x0;var _0x2ca671=_0x4a0b[_0x3116c9];return _0x2ca671;};'use strict';var _=require(_0xb4a0('0x0'));var util=require(_0xb4a0('0x1'));var logger=require('../../config/logger')(_0xb4a0('0x2'));var moment=require('moment');var BPromise=require(_0xb4a0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb4a0('0x4'));var config=require(_0xb4a0('0x5'));var attributes=require(_0xb4a0('0x6'));module[_0xb4a0('0x7')]=function(_0x56540f,_0x538297){return _0x56540f['define'](_0xb4a0('0x8'),attributes,{'tableName':_0xb4a0('0x9'),'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 16945c5..0d4f8e2 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 _0x2af8=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x29120c,_0x1c80f9){var _0x80a193=function(_0x2ff66e){while(--_0x2ff66e){_0x29120c['push'](_0x29120c['shift']());}};_0x80a193(++_0x1c80f9);}(_0x2af8,0xf6));var _0x82af=function(_0x12bada,_0xcc257d){_0x12bada=_0x12bada-0x0;var _0x479493=_0x2af8[_0x12bada];return _0x479493;};'use strict';var _=require(_0x82af('0x0'));var util=require('util');var moment=require(_0x82af('0x1'));var BPromise=require(_0x82af('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x82af('0x3'));var db=require(_0x82af('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x82af('0x5'))('rpc');var config=require(_0x82af('0x6'));var jayson=require(_0x82af('0x7'));var client=jayson['client'][_0x82af('0x8')]({'port':0x232a});config[_0x82af('0x9')]=_['defaults'](config[_0x82af('0x9')],{'host':_0x82af('0xa'),'port':0x18eb});var socket=require(_0x82af('0xb'))(new Redis(config[_0x82af('0x9')]));require(_0x82af('0xc'))[_0x82af('0xd')](socket);function respondWithRpcPromise(_0x1dbaff,_0x46fe4b,_0x41451a){return new BPromise(function(_0xd5ecc8,_0x459bf0){return client[_0x82af('0xe')](_0x1dbaff,_0x41451a)[_0x82af('0xf')](function(_0x1dedf2){logger[_0x82af('0x10')](_0x82af('0x11'),_0x46fe4b,_0x82af('0x12'));logger[_0x82af('0x13')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x46fe4b,'request\x20sent',JSON[_0x82af('0x14')](_0x1dedf2));if(_0x1dedf2[_0x82af('0x15')]){if(_0x1dedf2[_0x82af('0x15')]['code']===0x1f4){logger[_0x82af('0x15')](_0x82af('0x11'),_0x46fe4b,_0x1dedf2[_0x82af('0x15')][_0x82af('0x16')]);return _0x459bf0(_0x1dedf2['error'][_0x82af('0x16')]);}logger[_0x82af('0x15')](_0x82af('0x11'),_0x46fe4b,_0x1dedf2[_0x82af('0x15')][_0x82af('0x16')]);return _0xd5ecc8(_0x1dedf2[_0x82af('0x15')][_0x82af('0x16')]);}else{logger[_0x82af('0x10')](_0x82af('0x11'),_0x46fe4b,_0x82af('0x12'));_0xd5ecc8(_0x1dedf2[_0x82af('0x17')][_0x82af('0x16')]);}})[_0x82af('0x18')](function(_0x5be05a){logger[_0x82af('0x15')](_0x82af('0x11'),_0x46fe4b,_0x5be05a);_0x459bf0(_0x5be05a);});});} \ No newline at end of file +var _0x6209=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5b32b6,_0x415042){var _0x436536=function(_0x4c9772){while(--_0x4c9772){_0x5b32b6['push'](_0x5b32b6['shift']());}};_0x436536(++_0x415042);}(_0x6209,0x1e8));var _0x9620=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x6209[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x9620('0x0'));var util=require(_0x9620('0x1'));var moment=require(_0x9620('0x2'));var BPromise=require(_0x9620('0x3'));var rs=require(_0x9620('0x4'));var fs=require('fs');var Redis=require(_0x9620('0x5'));var db=require(_0x9620('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9620('0x7'))(_0x9620('0x8'));var config=require(_0x9620('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9620('0xa')][_0x9620('0xb')]({'port':0x232a});config[_0x9620('0xc')]=_[_0x9620('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9620('0xe'))(new Redis(config['redis']));require(_0x9620('0xf'))[_0x9620('0x10')](socket);function respondWithRpcPromise(_0x186b36,_0x10e8c3,_0x4764e6){return new BPromise(function(_0xec897,_0x30fa46){return client['request'](_0x186b36,_0x4764e6)[_0x9620('0x11')](function(_0x52bb7c){logger[_0x9620('0x12')](_0x9620('0x13'),_0x10e8c3,_0x9620('0x14'));logger[_0x9620('0x15')](_0x9620('0x16'),_0x10e8c3,_0x9620('0x14'),JSON[_0x9620('0x17')](_0x52bb7c));if(_0x52bb7c[_0x9620('0x18')]){if(_0x52bb7c[_0x9620('0x18')][_0x9620('0x19')]===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x10e8c3,_0x52bb7c[_0x9620('0x18')][_0x9620('0x1a')]);return _0x30fa46(_0x52bb7c['error'][_0x9620('0x1a')]);}logger[_0x9620('0x18')](_0x9620('0x13'),_0x10e8c3,_0x52bb7c[_0x9620('0x18')]['message']);return _0xec897(_0x52bb7c[_0x9620('0x18')][_0x9620('0x1a')]);}else{logger['info'](_0x9620('0x13'),_0x10e8c3,'request\x20sent');_0xec897(_0x52bb7c[_0x9620('0x1b')][_0x9620('0x1a')]);}})[_0x9620('0x1c')](function(_0x3a7a3a){logger[_0x9620('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x10e8c3,_0x3a7a3a);_0x30fa46(_0x3a7a3a);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 6861aa3..a385fbf 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 _0x9173=['removeListener','register','length','voicePrefix:','./voicePrefix.events','save','update','emit'];(function(_0x2f5e81,_0x49c319){var _0x5e4f0e=function(_0x3343d8){while(--_0x3343d8){_0x2f5e81['push'](_0x2f5e81['shift']());}};_0x5e4f0e(++_0x49c319);}(_0x9173,0xb4));var _0x3917=function(_0xc8a897,_0x5830fa){_0xc8a897=_0xc8a897-0x0;var _0x26a589=_0x9173[_0xc8a897];return _0x26a589;};'use strict';var VoicePrefixEvents=require(_0x3917('0x0'));var events=[_0x3917('0x1'),'remove',_0x3917('0x2')];function createListener(_0x30989e,_0x282f74){return function(_0x5df798){_0x282f74[_0x3917('0x3')](_0x30989e,_0x5df798);};}function removeListener(_0x5e0739,_0xb4eb06){return function(){VoicePrefixEvents[_0x3917('0x4')](_0x5e0739,_0xb4eb06);};}exports[_0x3917('0x5')]=function(_0x403e03){for(var _0x2dace9=0x0,_0x48d592=events[_0x3917('0x6')];_0x2dace9<_0x48d592;_0x2dace9++){var _0x27f513=events[_0x2dace9];var _0x11267b=createListener(_0x3917('0x7')+_0x27f513,_0x403e03);VoicePrefixEvents['on'](_0x27f513,_0x11267b);}}; \ No newline at end of file +var _0xb945=['length','./voicePrefix.events','remove','emit','removeListener','register'];(function(_0x1cb5a7,_0x153234){var _0x20deba=function(_0x2ea303){while(--_0x2ea303){_0x1cb5a7['push'](_0x1cb5a7['shift']());}};_0x20deba(++_0x153234);}(_0xb945,0x97));var _0x5b94=function(_0x371c6d,_0xb66639){_0x371c6d=_0x371c6d-0x0;var _0x40e38f=_0xb945[_0x371c6d];return _0x40e38f;};'use strict';var VoicePrefixEvents=require(_0x5b94('0x0'));var events=['save',_0x5b94('0x1'),'update'];function createListener(_0x2b814e,_0x4cc83f){return function(_0x488e8d){_0x4cc83f[_0x5b94('0x2')](_0x2b814e,_0x488e8d);};}function removeListener(_0x3f7199,_0x30d552){return function(){VoicePrefixEvents[_0x5b94('0x3')](_0x3f7199,_0x30d552);};}exports[_0x5b94('0x4')]=function(_0x4bef06){for(var _0x492388=0x0,_0x2db8d8=events[_0x5b94('0x5')];_0x492388<_0x2db8d8;_0x492388++){var _0x42bd69=events[_0x492388];var _0x186d22=createListener('voicePrefix:'+_0x42bd69,_0x4bef06);VoicePrefixEvents['on'](_0x42bd69,_0x186d22);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 521ffe9..53b08ce 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 _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(_0x5582f7,_0x422b0f){var _0x56e6d6=function(_0x355318){while(--_0x355318){_0x5582f7['push'](_0x5582f7['shift']());}};_0x56e6d6(++_0x422b0f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 +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(_0x86ca1,_0x40c492){var _0x55ad17=function(_0x377977){while(--_0x377977){_0x86ca1['push'](_0x86ca1['shift']());}};_0x55ad17(++_0x40c492);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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 bc81e1a..53bccf0 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 _0xceb0=['Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\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\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','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\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)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','ENUM','inbound','outbound','default','fewestcalls','random','rrmemory','linear','wrandom','strategy','getDataValue','booked','roundrobin','includes','INTEGER','yes','all','once','TEXT','join','periodic_announce','setDataValue','joinempty','split','leavewhenempty','BOOLEAN','acw','Active/Disactive\x20Campaign','preview','progressive','power','predictive','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','UNSIGNED'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xceb0,0xc8));var _0x0ceb=function(_0x490faf,_0x3205ce){_0x490faf=_0x490faf-0x0;var _0x1358f9=_0xceb0[_0x490faf];return _0x1358f9;};'use strict';var Sequelize=require(_0x0ceb('0x0'));module[_0x0ceb('0x1')]={'name':{'type':Sequelize[_0x0ceb('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x0ceb('0x3')](_0x0ceb('0x4'),_0x0ceb('0x5')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':_0x0ceb('0x6')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x0ceb('0x3')]('rr','ringall','leastrecent',_0x0ceb('0x7'),_0x0ceb('0x8'),_0x0ceb('0x9'),_0x0ceb('0xa'),_0x0ceb('0xb'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x10cd7f){this['setDataValue'](_0x0ceb('0xc'),_0x10cd7f?_0x10cd7f:'rrmemory');},'get':function(){var _0x40990a=this['getDataValue']('type');var _0x43b3c9=this['getDataValue']('dialMethod');var _0x4aed8a=this[_0x0ceb('0xd')](_0x0ceb('0xc'));if(_0x40990a===_0x0ceb('0x5')){if(_0x43b3c9==='preview'){return null;}if(_0x43b3c9===_0x0ceb('0xe')&&![_0x0ceb('0x9'),_0x0ceb('0xf')][_0x0ceb('0x10')](_0x4aed8a)){this['setDataValue'](_0x0ceb('0xc'),_0x0ceb('0x9'));}}return _0x4aed8a;}},'servicelevel':{'type':Sequelize[_0x0ceb('0x11')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x0ceb('0x11')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x0ceb('0x11')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0ceb('0x3')](_0x0ceb('0x12'),'no'),'defaultValue':_0x0ceb('0x12')},'autopause':{'type':Sequelize[_0x0ceb('0x3')]('yes','no',_0x0ceb('0x13')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x0ceb('0x3')](_0x0ceb('0x12'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0ceb('0x3')](_0x0ceb('0x12'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0ceb('0x11')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0ceb('0x3')](_0x0ceb('0x12'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x0ceb('0x12'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x0ceb('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0ceb('0x3')](_0x0ceb('0x12'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0ceb('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x0ceb('0x11')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0ceb('0x11')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0ceb('0x11')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0ceb('0x3')](_0x0ceb('0x12'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x0ceb('0x3')]('yes','no'),'defaultValue':_0x0ceb('0x12')},'announce_holdtime':{'type':Sequelize[_0x0ceb('0x3')](_0x0ceb('0x12'),'no',_0x0ceb('0x14')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x0ceb('0x12'),'no')},'announce_position_limit':{'type':Sequelize[_0x0ceb('0x11')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0ceb('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0ceb('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0ceb('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0ceb('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0ceb('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0ceb('0x2')]},'queue_less_than':{'type':Sequelize[_0x0ceb('0x2')]},'periodic_announce':{'type':Sequelize[_0x0ceb('0x15')],'set':function(_0x2fe819){this['setDataValue']('periodic_announce',_0x2fe819?_0x2fe819[_0x0ceb('0x16')](','):[]);},'get':function(){return this[_0x0ceb('0xd')](_0x0ceb('0x17'))?this['getDataValue'](_0x0ceb('0x17'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':'yes','set':function(_0x545a56){this[_0x0ceb('0x18')]('joinempty',_0x545a56?_0x545a56['join'](','):undefined);},'get':function(){return this['getDataValue'](_0x0ceb('0x19'))?this[_0x0ceb('0xd')](_0x0ceb('0x19'))[_0x0ceb('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':'no','set':function(_0x301fbc){this[_0x0ceb('0x18')](_0x0ceb('0x1b'),_0x301fbc?_0x301fbc[_0x0ceb('0x16')](','):undefined);},'get':function(){return this[_0x0ceb('0xd')](_0x0ceb('0x1b'))?this[_0x0ceb('0xd')](_0x0ceb('0x1b'))[_0x0ceb('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0ceb('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0ceb('0x12'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0ceb('0x3')](_0x0ceb('0x12'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0ceb('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x0ceb('0x1c')],'defaultValue':0x0,'set':function(_0x3c87f1){this[_0x0ceb('0x18')](_0x0ceb('0x1d'),_0x3c87f1);if(_0x3c87f1){if(this['getDataValue']('wrapuptime')<0x2){this[_0x0ceb('0x18')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x0ceb('0x11')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0ceb('0x1c')],'defaultValue':0x0,'comment':_0x0ceb('0x1e')},'dialMethod':{'type':Sequelize[_0x0ceb('0x3')](_0x0ceb('0x1f'),_0x0ceb('0x20'),_0x0ceb('0x21'),_0x0ceb('0x22'),_0x0ceb('0xe')),'defaultValue':_0x0ceb('0x20'),'comment':_0x0ceb('0x23')},'dialLimitChannel':{'type':Sequelize[_0x0ceb('0x11')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0ceb('0x24')},'dialLimitQueue':{'type':Sequelize[_0x0ceb('0x11')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0ceb('0x25')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0ceb('0x26')},'dialPredictiveOptimization':{'type':Sequelize[_0x0ceb('0x3')]('agentBusyFactor','dropRate'),'defaultValue':_0x0ceb('0x27'),'comment':_0x0ceb('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0ceb('0x29')](0x2)[_0x0ceb('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0ceb('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0x0ceb('0x11')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0ceb('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0ceb('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ceb('0x2c')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x0ceb('0x2d'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x0ceb('0x11')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ceb('0x2e')},'dialQueueProject':{'type':Sequelize[_0x0ceb('0x2')],'comment':_0x0ceb('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0ceb('0x11')](0x3)[_0x0ceb('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ceb('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0ceb('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x0ceb('0x11')](0x3)[_0x0ceb('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x0ceb('0x11')](0x5)[_0x0ceb('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ceb('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0ceb('0x11')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x0ceb('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ceb('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0ceb('0x11')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0ceb('0x34')},'dialTimezone':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':_0x0ceb('0x35')},'dialPrefix':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x0ceb('0x3')](_0x0ceb('0x36'),_0x0ceb('0x37'),_0x0ceb('0x38')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x0ceb('0x1c')],'defaultValue':0x0,'comment':_0x0ceb('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0x0ceb('0x11')](0x9)[_0x0ceb('0x2a')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0ceb('0x3a')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x0ceb('0x2a')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0ceb('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0ceb('0x11')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0ceb('0x11')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0ceb('0x3c')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x0ceb('0x2a')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0ceb('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0ceb('0x11')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0ceb('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0ceb('0x11')](0x9)[_0x0ceb('0x2a')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x0ceb('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0ceb('0x11')](0x5)[_0x0ceb('0x2a')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0ceb('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0ceb('0x41')},'dialRecallMeTimeout':{'type':Sequelize[_0x0ceb('0x11')](0x5)[_0x0ceb('0x2a')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0ceb('0x42')},'dialRecallInQueue':{'type':Sequelize[_0x0ceb('0x1c')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x0ceb('0x3')]('DESC',_0x0ceb('0x43')),'defaultValue':_0x0ceb('0x44')},'dialQueueProject2':{'type':Sequelize[_0x0ceb('0x2')],'comment':_0x0ceb('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0ceb('0x1c')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0ceb('0x11')](0x3)[_0x0ceb('0x2a')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0ceb('0x45')},'dialCutDigit':{'type':Sequelize[_0x0ceb('0x11')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0ceb('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0ceb('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ceb('0x47')},'dialDropMaxRetry':{'type':Sequelize[_0x0ceb('0x11')](0x3)[_0x0ceb('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ceb('0x48')},'dialDropRetryFrequency':{'type':Sequelize[_0x0ceb('0x11')](0x5)[_0x0ceb('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ceb('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x0ceb('0x11')](0x3)[_0x0ceb('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0ceb('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ceb('0x4a')},'dialMachineMaxRetry':{'type':Sequelize[_0x0ceb('0x11')](0x3)[_0x0ceb('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ceb('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0ceb('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ceb('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0ceb('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ceb('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0ceb('0x11')](0x5)[_0x0ceb('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0ceb('0x11')],'allowNull':!![],'comment':_0x0ceb('0x4e')},'mandatoryDisposition':{'type':Sequelize[_0x0ceb('0x1c')],'defaultValue':![],'comment':_0x0ceb('0x4f'),'set':function(_0x4a8513){if(!_0x4a8513)this[_0x0ceb('0x18')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x0ceb('0x50'),_0x4a8513);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0ceb('0x2a')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x0ceb('0x11')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x0ceb('0x2a')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xc017=['#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','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','preview','booked','roundrobin','includes','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','progressive','predictive','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.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','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)','07:00-22:00,*,*,*','always','never','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\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)'];(function(_0x101f53,_0x227e4e){var _0x4ffee3=function(_0xf06790){while(--_0xf06790){_0x101f53['push'](_0x101f53['shift']());}};_0x4ffee3(++_0x227e4e);}(_0xc017,0x1f2));var _0x7c01=function(_0x150b05,_0x4b83a2){_0x150b05=_0x150b05-0x0;var _0x10570d=_0xc017[_0x150b05];return _0x10570d;};'use strict';var Sequelize=require(_0x7c01('0x0'));module[_0x7c01('0x1')]={'name':{'type':Sequelize[_0x7c01('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7c01('0x3')](_0x7c01('0x4'),_0x7c01('0x5')),'allowNull':![],'defaultValue':_0x7c01('0x4')},'musiconhold':{'type':Sequelize[_0x7c01('0x2')],'defaultValue':_0x7c01('0x6')},'announce':{'type':Sequelize[_0x7c01('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x7c01('0x7'),_0x7c01('0x8'),_0x7c01('0x9'),'random',_0x7c01('0xa'),_0x7c01('0xb'),_0x7c01('0xc'),_0x7c01('0xd')),'allowNull':![],'defaultValue':_0x7c01('0x7'),'set':function(_0x10a92c){this[_0x7c01('0xe')](_0x7c01('0xf'),_0x10a92c?_0x10a92c:_0x7c01('0xa'));},'get':function(){var _0x2ad43c=this[_0x7c01('0x10')](_0x7c01('0x11'));var _0x163650=this['getDataValue']('dialMethod');var _0x3163a7=this['getDataValue'](_0x7c01('0xf'));if(_0x2ad43c===_0x7c01('0x5')){if(_0x163650===_0x7c01('0x12')){return null;}if(_0x163650===_0x7c01('0x13')&&!['rrmemory',_0x7c01('0x14')][_0x7c01('0x15')](_0x3163a7)){this[_0x7c01('0xe')](_0x7c01('0xf'),_0x7c01('0xa'));}}return _0x3163a7;}},'servicelevel':{'type':Sequelize[_0x7c01('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x7c01('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x7c01('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x7c01('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x7c01('0x2')]},'weight':{'type':Sequelize[_0x7c01('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x7c01('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x7c01('0x3')](_0x7c01('0x17'),'no'),'defaultValue':_0x7c01('0x17')},'autopause':{'type':Sequelize['ENUM'](_0x7c01('0x17'),'no',_0x7c01('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x7c01('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x7c01('0x3')](_0x7c01('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x7c01('0x3')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x7c01('0x3')](_0x7c01('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x7c01('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x7c01('0x3')](_0x7c01('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x7c01('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x7c01('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x7c01('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x7c01('0x3')](_0x7c01('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x7c01('0x3')](_0x7c01('0x17'),'no'),'defaultValue':_0x7c01('0x17')},'announce_holdtime':{'type':Sequelize[_0x7c01('0x3')]('yes','no',_0x7c01('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x7c01('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x7c01('0x3')](_0x7c01('0x17'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x7c01('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x7c01('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x7c01('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x7c01('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x7c01('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x7c01('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x7c01('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x7c01('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x7c01('0x2')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x7c01('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x7c01('0x2')]},'queue_less_than':{'type':Sequelize[_0x7c01('0x2')]},'periodic_announce':{'type':Sequelize[_0x7c01('0x1a')],'set':function(_0x2f993a){this[_0x7c01('0xe')](_0x7c01('0x1b'),_0x2f993a?_0x2f993a[_0x7c01('0x1c')](','):[]);},'get':function(){return this[_0x7c01('0x10')](_0x7c01('0x1b'))?this[_0x7c01('0x10')]('periodic_announce')[_0x7c01('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0x7c01('0x2')],'defaultValue':_0x7c01('0x17'),'set':function(_0x32fae7){this[_0x7c01('0xe')](_0x7c01('0x1e'),_0x32fae7?_0x32fae7[_0x7c01('0x1c')](','):undefined);},'get':function(){return this['getDataValue']('joinempty')?this['getDataValue'](_0x7c01('0x1e'))[_0x7c01('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x7c01('0x2')],'defaultValue':'no','set':function(_0x525e45){this[_0x7c01('0xe')](_0x7c01('0x1f'),_0x525e45?_0x525e45[_0x7c01('0x1c')](','):undefined);},'get':function(){return this[_0x7c01('0x10')](_0x7c01('0x1f'))?this[_0x7c01('0x10')](_0x7c01('0x1f'))[_0x7c01('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x7c01('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x7c01('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x7c01('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x7c01('0x3')](_0x7c01('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x7c01('0x2')]},'description':{'type':Sequelize[_0x7c01('0x2')]},'acw':{'type':Sequelize[_0x7c01('0x20')],'defaultValue':0x0,'set':function(_0x4c9b10){this[_0x7c01('0xe')](_0x7c01('0x21'),_0x4c9b10);if(_0x4c9b10){if(this[_0x7c01('0x10')](_0x7c01('0x22'))<0x2){this[_0x7c01('0xe')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x7c01('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x7c01('0x3')]('preview',_0x7c01('0x23'),'power',_0x7c01('0x24'),_0x7c01('0x13')),'defaultValue':_0x7c01('0x23'),'comment':_0x7c01('0x25')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x7c01('0x26')},'dialLimitQueue':{'type':Sequelize[_0x7c01('0x16')](0x4)[_0x7c01('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x7c01('0x28')](0x2)[_0x7c01('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x7c01('0x29')},'dialPredictiveOptimization':{'type':Sequelize[_0x7c01('0x3')](_0x7c01('0x2a'),_0x7c01('0x2b')),'defaultValue':_0x7c01('0x2b'),'comment':_0x7c01('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x7c01('0x28')](0x2)[_0x7c01('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x7c01('0x16')](0x3)[_0x7c01('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x7c01('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x7c01('0x16')](0x3)[_0x7c01('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7c01('0x2d')},'dialQueueOptions':{'type':Sequelize[_0x7c01('0x2')],'defaultValue':_0x7c01('0x2e'),'comment':_0x7c01('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0x7c01('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x7c01('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x7c01('0x16')](0x3)[_0x7c01('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7c01('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x7c01('0x16')](0x5)[_0x7c01('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7c01('0x31')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7c01('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x7c01('0x16')](0x5)[_0x7c01('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7c01('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7c01('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7c01('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x7c01('0x16')](0x3)[_0x7c01('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x7c01('0x34')},'dialTimezone':{'type':Sequelize[_0x7c01('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x7c01('0x35')},'dialPrefix':{'type':Sequelize[_0x7c01('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x7c01('0x3')](_0x7c01('0x36'),_0x7c01('0x37'),'onlyIfOpen'),'defaultValue':_0x7c01('0x36')},'dialAMDActive':{'type':Sequelize[_0x7c01('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x7c01('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x7c01('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x7c01('0x16')](0x9)[_0x7c01('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x7c01('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x7c01('0x16')](0x9)[_0x7c01('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x7c01('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x7c01('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7c01('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x7c01('0x16')](0x9)[_0x7c01('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x7c01('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x7c01('0x16')](0x9)[_0x7c01('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x7c01('0x3d')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x7c01('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x7c01('0x16')](0x5)[_0x7c01('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x7c01('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x7c01('0x16')](0x9)[_0x7c01('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7c01('0x3f')},'dialRecallMeTimeout':{'type':Sequelize[_0x7c01('0x16')](0x5)[_0x7c01('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x7c01('0x40')},'dialRecallInQueue':{'type':Sequelize[_0x7c01('0x20')],'defaultValue':0x0,'comment':_0x7c01('0x41')},'dialOrderByScheduledAt':{'type':Sequelize[_0x7c01('0x3')]('DESC',_0x7c01('0x42')),'defaultValue':_0x7c01('0x43')},'dialQueueProject2':{'type':Sequelize[_0x7c01('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x7c01('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x7c01('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x7c01('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7c01('0x44')},'dialCutDigit':{'type':Sequelize[_0x7c01('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7c01('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x7c01('0x16')](0x3)[_0x7c01('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7c01('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7c01('0x16')](0x5)[_0x7c01('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7c01('0x47')},'dialDropMaxRetry':{'type':Sequelize[_0x7c01('0x16')](0x3)[_0x7c01('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7c01('0x48')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7c01('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7c01('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7c01('0x4a')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7c01('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7c01('0x4b')},'dialMachineMaxRetry':{'type':Sequelize[_0x7c01('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7c01('0x4c')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7c01('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7c01('0x4d')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x7c01('0x16')](0x3)[_0x7c01('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7c01('0x4e')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x7c01('0x16')](0x5)[_0x7c01('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7c01('0x16')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x7c01('0x4f'),'set':function(_0x4a347f){if(!_0x4a347f)this[_0x7c01('0xe')](_0x7c01('0x50'),null);this[_0x7c01('0xe')](_0x7c01('0x51'),_0x4a347f);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x7c01('0x16')](0x3)[_0x7c01('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x7c01('0x16')](0x3)[_0x7c01('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x7c01('0x20')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x7c01('0x16')](0x3)[_0x7c01('0x27')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x7c01('0x20')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 4f99a36..914708e 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 _0x7217=['toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','ids','emit','userVoiceQueue:remove','addAgents','isEmpty','removeAgents','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert','into','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_hopper','fromQuery','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','filter','ignore','map','value','type','find','name','UserProfileResource','end','error','send','index','VoiceQueue','fieldName','getOptions','where','include','query','findAll','rows','catch','params','model','keys','rawAttributes','filters','attributes','intersection','fields','length','options','create','user','role','outbound','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','includeAll','omit','createdAt','updatedAt','body','merge','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','getHoppers','findOne','CmHopper','hasOwnProperty','nolimit','limit','order','sort','pick','VoiceQueueId','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','User','online','flatMap','penalty','sequelize','transaction','addTeams','upsert','each','UserVoiceQueueRt','isNil','interface','format','SIP/%s','voicePause','forEach','userVoiceQueue:save','removeTeams','Agents','select','field','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push'];(function(_0x15cae3,_0x458cb9){var _0x20596f=function(_0x1ad3e6){while(--_0x1ad3e6){_0x15cae3['push'](_0x15cae3['shift']());}};_0x20596f(++_0x458cb9);}(_0x7217,0x19e));var _0x7721=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x7217[_0x5c351c];return _0x26f3b3;};'use strict';var moment=require(_0x7721('0x0'));var BPromise=require('bluebird');var util=require(_0x7721('0x1'));var _=require(_0x7721('0x2'));var squel=require(_0x7721('0x3'));var Redis=require(_0x7721('0x4'));var qs=require(_0x7721('0x5'));var logger=require('../../config/logger')('api');var config=require(_0x7721('0x6'));var db=require(_0x7721('0x7'))['db'];config[_0x7721('0x8')]=_[_0x7721('0x9')](config[_0x7721('0x8')],{'host':_0x7721('0xa'),'port':0x18eb});var socket=require(_0x7721('0xb'))(new Redis(config[_0x7721('0x8')]));require(_0x7721('0xc'))[_0x7721('0xd')](socket);function respondWithStatusCode(_0x3e6368,_0x2a66cb){_0x2a66cb=_0x2a66cb||0xcc;return function(_0xfa8835){if(_0xfa8835){return _0x3e6368[_0x7721('0xe')](_0x2a66cb);}return _0x3e6368[_0x7721('0xf')](_0x2a66cb)['end']();};}function respondWithResult(_0x461d1a,_0x29bc8f){_0x29bc8f=_0x29bc8f||0xc8;return function(_0x8729a6){if(_0x8729a6){return _0x461d1a[_0x7721('0xf')](_0x29bc8f)[_0x7721('0x10')](_0x8729a6);}};}function respondWithFilteredResult(_0x409b37,_0x1e7fd7){return function(_0x27b36b){if(_0x27b36b){var _0x55b4ca=typeof _0x1e7fd7[_0x7721('0x11')]===_0x7721('0x12')&&typeof _0x1e7fd7['limit']===_0x7721('0x12');var _0x30da54=_0x27b36b[_0x7721('0x13')];var _0x2e9752=_0x55b4ca?0x0:_0x1e7fd7['offset'];var _0x3cbce8=_0x55b4ca?_0x27b36b[_0x7721('0x13')]:_0x1e7fd7['offset']+_0x1e7fd7['limit'];var _0x4b183e;if(_0x3cbce8>=_0x30da54){_0x3cbce8=_0x30da54;_0x4b183e=0xc8;}else{_0x4b183e=0xce;}_0x409b37[_0x7721('0xf')](_0x4b183e);return _0x409b37[_0x7721('0x14')](_0x7721('0x15'),_0x2e9752+'-'+_0x3cbce8+'/'+_0x30da54)[_0x7721('0x10')](_0x27b36b);}return null;};}function saveUpdates(_0x5ed94b){return function(_0x20f669){if(_0x20f669){return _0x20f669['update'](_0x5ed94b)[_0x7721('0x16')](function(_0x5cb0e6){return _0x5cb0e6;});}return null;};}function removeEntity(_0xfec626){return function(_0x4e96fb){if(_0x4e96fb){return _0x4e96fb[_0x7721('0x17')]()[_0x7721('0x16')](function(){var _0x2286e5=_0x4e96fb[_0x7721('0x18')]({'plain':!![]});var _0x402820=[{'name':_0x7721('0x19'),'value':_0x7721('0x1a'),'ignore':![]},{'name':_0x7721('0x1b'),'value':'outbound','ignore':![]}];var _0x288f7e=_(_0x402820)[_0x7721('0x1c')](_0x7721('0x1d'))[_0x7721('0x1e')]('value')[_0x7721('0x1f')]();if(_['includes'](_0x288f7e,_0x2286e5[_0x7721('0x20')])){return;}var _0x288e3a=_[_0x7721('0x21')](_0x402820,[_0x7721('0x1f'),_0x2286e5[_0x7721('0x20')]])[_0x7721('0x22')];return db[_0x7721('0x23')]['destroy']({'where':{'type':_0x288e3a,'resourceId':_0x2286e5['id']}})[_0x7721('0x16')](function(){return _0x4e96fb;});})[_0x7721('0x16')](function(){_0xfec626[_0x7721('0xf')](0xcc)[_0x7721('0x24')]();});}};}function handleEntityNotFound(_0x40d550){return function(_0x16355a){if(!_0x16355a){_0x40d550[_0x7721('0xe')](0x194);}return _0x16355a;};}function handleError(_0xf753f1,_0x40f367){_0x40f367=_0x40f367||0x1f4;return function(_0x52316e){logger[_0x7721('0x25')](_0x52316e['stack']);if(_0x52316e['name']){delete _0x52316e[_0x7721('0x22')];}_0xf753f1[_0x7721('0xf')](_0x40f367)[_0x7721('0x26')](_0x52316e);};}exports[_0x7721('0x27')]=function(_0x1ea4d,_0x37b9f0){var _0xd7d703={};var _0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x1e')](db[_0x7721('0x28')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x29')],'type':_0x4a25c9[_0x7721('0x20')]['key']};});_0xd7d703=qs[_0x7721('0x2a')](_0x5c54f0,_0x1ea4d);var _0x4651b5={'where':_0xd7d703[_0x7721('0x2b')]};return db['VoiceQueue'][_0x7721('0x13')](_0x4651b5)[_0x7721('0x16')](function(_0x1492d4){_0x1da2d8[_0x7721('0x13')]=_0x1492d4;_0xd7d703[_0x7721('0x2c')]=qs['include'](_0x1ea4d[_0x7721('0x2d')]);return db[_0x7721('0x28')][_0x7721('0x2e')](_0xd7d703);})['then'](function(_0x35de7a){_0x1da2d8[_0x7721('0x2f')]=_0x35de7a;return _0x1da2d8;})['then'](respondWithFilteredResult(_0x37b9f0,_0xd7d703))[_0x7721('0x30')](handleError(_0x37b9f0,null));};exports['show']=function(_0x2d6ba0,_0x326c50){var _0x19d082={'raw':![],'where':{'id':_0x2d6ba0[_0x7721('0x31')]['id']}},_0x1d894b={};_0x1d894b[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x28')][_0x7721('0x34')]);_0x1d894b[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x2d6ba0['query']);_0x1d894b[_0x7721('0x35')]=_['intersection'](_0x1d894b[_0x7721('0x32')],_0x1d894b[_0x7721('0x2d')]);_0x19d082[_0x7721('0x36')]=_[_0x7721('0x37')](_0x1d894b[_0x7721('0x32')],qs[_0x7721('0x38')](_0x2d6ba0['query']['fields']));_0x19d082['attributes']=_0x19d082['attributes'][_0x7721('0x39')]?_0x19d082[_0x7721('0x36')]:_0x1d894b[_0x7721('0x32')];if(_0x2d6ba0[_0x7721('0x2d')]['includeAll']){_0x19d082[_0x7721('0x2c')]=[{'all':!![]}];}_0x19d082=_['merge']({},_0x19d082,_0x2d6ba0[_0x7721('0x3a')]);return db[_0x7721('0x28')]['find'](_0x19d082)[_0x7721('0x16')](handleEntityNotFound(_0x326c50,null))[_0x7721('0x16')](respondWithResult(_0x326c50,null))['catch'](handleError(_0x326c50,null));};exports['create']=function(_0x3d84d3,_0xfc4dc4){return db[_0x7721('0x28')][_0x7721('0x3b')](_0x3d84d3['body'],{})[_0x7721('0x16')](function(_0x120de9){var _0x40ce8c=_0x3d84d3[_0x7721('0x3c')][_0x7721('0x18')]({'plain':!![]});if(!_0x40ce8c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40ce8c[_0x7721('0x3d')]==='user'){var _0xaa3216=_0x120de9['get']({'plain':!![]});var _0x2333b8=[{'name':_0x7721('0x19'),'value':_0x7721('0x1a')},{'name':'QueueCampaigns','value':_0x7721('0x3e')}];var _0x11d853=_[_0x7721('0x21')](_0x2333b8,['value',_0xaa3216[_0x7721('0x20')]])[_0x7721('0x22')];return db[_0x7721('0x3f')][_0x7721('0x21')]({'where':{'name':_0x11d853,'userProfileId':_0x40ce8c[_0x7721('0x40')]},'raw':!![]})[_0x7721('0x16')](function(_0x463ccc){if(_0x463ccc&&_0x463ccc['autoAssociation']===0x0){return db['UserProfileResource'][_0x7721('0x3b')]({'name':_0xaa3216[_0x7721('0x22')],'resourceId':_0xaa3216['id'],'type':_0x463ccc[_0x7721('0x22')],'sectionId':_0x463ccc['id']},{})[_0x7721('0x16')](function(){return _0x120de9;});}else{return _0x120de9;}})[_0x7721('0x30')](function(_0x15181b){logger[_0x7721('0x25')](_0x7721('0x41'),_0x15181b);throw _0x15181b;});}return _0x120de9;})[_0x7721('0x16')](respondWithResult(_0xfc4dc4,0xc9))[_0x7721('0x30')](handleError(_0xfc4dc4,null));};exports['clone']=function(_0x578867,_0x5ed70d){var _0x6a4664={'where':{'id':_0x578867[_0x7721('0x31')]['id']}},_0x151f69={};_0x151f69['model']=_[_0x7721('0x33')](db[_0x7721('0x28')]['rawAttributes']);_0x6a4664[_0x7721('0x36')]=_['intersection'](_0x151f69[_0x7721('0x32')],qs['fields'](_0x578867[_0x7721('0x2d')][_0x7721('0x38')]));_0x6a4664[_0x7721('0x36')]=_0x6a4664['attributes'][_0x7721('0x39')]?_0x6a4664[_0x7721('0x36')]:_0x151f69['model'];if(_0x578867[_0x7721('0x2d')][_0x7721('0x42')]){_0x6a4664[_0x7721('0x2c')]=[{'all':!![]}];}_0x6a4664=_['merge']({},_0x6a4664,_0x578867[_0x7721('0x3a')]);return db['VoiceQueue'][_0x7721('0x21')](_0x6a4664)[_0x7721('0x16')](handleEntityNotFound(_0x5ed70d,null))[_0x7721('0x16')](function(_0x443503){if(_0x443503){var _0x1c95d8=_0x443503[_0x7721('0x18')]({'plain':!![]});_0x1c95d8=qs[_0x7721('0x43')](_0x1c95d8,['id',_0x7721('0x44'),_0x7721('0x45')]);_0x578867[_0x7721('0x46')]=_[_0x7721('0x43')](_0x578867[_0x7721('0x46')],['id',_0x7721('0x44'),_0x7721('0x45')]);return db[_0x7721('0x28')]['create'](_[_0x7721('0x47')](_0x1c95d8,_0x578867[_0x7721('0x46')]),{'include':_0x578867[_0x7721('0x2d')][_0x7721('0x42')]?[{'all':!![]}]:undefined})[_0x7721('0x16')](function(_0x315127){var _0x267f5e=_0x578867['user'][_0x7721('0x18')]({'plain':!![]});if(!_0x267f5e)throw new Error(_0x7721('0x48'));if(_0x267f5e[_0x7721('0x3d')]===_0x7721('0x3c')){var _0x1f1e84=_0x315127[_0x7721('0x18')]({'plain':!![]});var _0x7fbd6c=[{'name':_0x7721('0x19'),'value':_0x7721('0x1a')},{'name':_0x7721('0x1b'),'value':_0x7721('0x3e')}];var _0x52e870=_[_0x7721('0x21')](_0x7fbd6c,[_0x7721('0x1f'),_0x1f1e84[_0x7721('0x20')]])[_0x7721('0x22')];return db[_0x7721('0x3f')][_0x7721('0x21')]({'where':{'name':_0x52e870,'userProfileId':_0x267f5e[_0x7721('0x40')]},'raw':!![]})[_0x7721('0x16')](function(_0x360882){if(_0x360882&&_0x360882[_0x7721('0x49')]===0x0){return db[_0x7721('0x23')][_0x7721('0x3b')]({'name':_0x1f1e84[_0x7721('0x22')],'resourceId':_0x1f1e84['id'],'type':_0x360882[_0x7721('0x22')],'sectionId':_0x360882['id']},{})[_0x7721('0x16')](function(){return _0x315127;});}else{return _0x315127;}})['catch'](function(_0x50e9e9){logger['error'](_0x7721('0x41'),_0x50e9e9);throw _0x50e9e9;});}return _0x315127;});}})['then'](respondWithResult(_0x5ed70d,0xc9))['catch'](handleError(_0x5ed70d,null));};exports['update']=function(_0x5d7036,_0x47925a){if(_0x5d7036[_0x7721('0x46')]['id']){delete _0x5d7036[_0x7721('0x46')]['id'];}return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0x5d7036['params']['id']}})['then'](handleEntityNotFound(_0x47925a,null))['then'](saveUpdates(_0x5d7036[_0x7721('0x46')],null))['then'](respondWithResult(_0x47925a,null))['catch'](handleError(_0x47925a,null));};exports['destroy']=function(_0x160292,_0x2e9155){return db[_0x7721('0x28')]['find']({'where':{'id':_0x160292[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x2e9155,null))[_0x7721('0x16')](removeEntity(_0x2e9155,null))[_0x7721('0x30')](handleError(_0x2e9155,null));};exports[_0x7721('0x4a')]=function(_0x16e80b,_0xad43ce){var _0x3e3301={'raw':![],'where':{}};var _0x127f46={};var _0x197b73={'count':0x0,'rows':[]};return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x16e80b[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0xad43ce,null))[_0x7721('0x16')](function(_0x4cbd28){if(_0x4cbd28){_0x127f46[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x4c')][_0x7721('0x34')]);_0x127f46['query']=_[_0x7721('0x33')](_0x16e80b[_0x7721('0x2d')]);_0x127f46['filters']=_[_0x7721('0x37')](_0x127f46['model'],_0x127f46[_0x7721('0x2d')]);_0x3e3301[_0x7721('0x36')]=_[_0x7721('0x37')](_0x127f46[_0x7721('0x32')],qs[_0x7721('0x38')](_0x16e80b[_0x7721('0x2d')][_0x7721('0x38')]));_0x3e3301[_0x7721('0x36')]=_0x3e3301[_0x7721('0x36')]['length']?_0x3e3301[_0x7721('0x36')]:_0x127f46[_0x7721('0x32')];if(!_0x16e80b[_0x7721('0x2d')][_0x7721('0x4d')](_0x7721('0x4e'))){_0x3e3301[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x16e80b['query'][_0x7721('0x4f')]);_0x3e3301[_0x7721('0x11')]=qs['offset'](_0x16e80b[_0x7721('0x2d')]['offset']);}_0x3e3301[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x16e80b[_0x7721('0x2d')][_0x7721('0x51')]);_0x3e3301[_0x7721('0x2b')]=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x16e80b['query'],_0x127f46[_0x7721('0x35')]));_0x3e3301[_0x7721('0x2b')][_0x7721('0x53')]=_0x4cbd28['id'];if(_0x16e80b['query']['filter']){_0x3e3301['where']=_['merge'](_0x3e3301['where'],{'$or':_[_0x7721('0x1e')](_0x3e3301[_0x7721('0x36')],function(_0x580473){var _0x2d4b3a={};_0x2d4b3a[_0x580473]={'$like':'%'+_0x16e80b[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x2d4b3a;})});}_0x3e3301=_[_0x7721('0x47')]({},_0x3e3301,_0x16e80b['options']);return db[_0x7721('0x4c')][_0x7721('0x13')]({'where':_0x3e3301[_0x7721('0x2b')]})[_0x7721('0x16')](function(_0x3cf3fd){_0x197b73['count']=_0x3cf3fd;if(_0x16e80b[_0x7721('0x2d')][_0x7721('0x42')]){_0x3e3301[_0x7721('0x2c')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x3e3301);})[_0x7721('0x16')](function(_0x752564){_0x197b73[_0x7721('0x2f')]=_0x752564;return _0x197b73;});}})[_0x7721('0x16')](respondWithFilteredResult(_0xad43ce,_0x3e3301))[_0x7721('0x30')](handleError(_0xad43ce,null));};exports['getHopperHistories']=function(_0x4ba35e,_0x263070){var _0x1bd97e={'raw':!![],'where':{}};var _0x68de4={};var _0x3c66b3={'count':0x0,'rows':[]};return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x4ba35e[_0x7721('0x31')]['id']}})['then'](handleEntityNotFound(_0x263070,null))[_0x7721('0x16')](function(_0x413185){if(_0x413185){_0x68de4[_0x7721('0x32')]=_['keys'](db[_0x7721('0x54')][_0x7721('0x34')]);_0x68de4[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x4ba35e['query']);_0x68de4['filters']=_[_0x7721('0x37')](_0x68de4[_0x7721('0x32')],_0x68de4[_0x7721('0x2d')]);_0x1bd97e[_0x7721('0x36')]=_[_0x7721('0x37')](_0x68de4[_0x7721('0x32')],qs['fields'](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x38')]));_0x1bd97e[_0x7721('0x36')]=_0x1bd97e['attributes'][_0x7721('0x39')]?_0x1bd97e[_0x7721('0x36')]:_0x68de4[_0x7721('0x32')];if(!_0x4ba35e[_0x7721('0x2d')][_0x7721('0x4d')]('nolimit')){_0x1bd97e[_0x7721('0x4f')]=qs['limit'](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x4f')]);_0x1bd97e[_0x7721('0x11')]=qs[_0x7721('0x11')](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x11')]);}_0x1bd97e[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x51')]);_0x1bd97e[_0x7721('0x2b')]=qs['filters'](_[_0x7721('0x52')](_0x4ba35e[_0x7721('0x2d')],_0x68de4[_0x7721('0x35')]));_0x1bd97e['where'][_0x7721('0x53')]=_0x413185['id'];if(_0x4ba35e[_0x7721('0x2d')][_0x7721('0x1c')]){_0x1bd97e[_0x7721('0x2b')]=_[_0x7721('0x47')](_0x1bd97e['where'],{'$or':_[_0x7721('0x1e')](_0x1bd97e[_0x7721('0x36')],function(_0x44326d){var _0x21b365={};_0x21b365[_0x44326d]={'$like':'%'+_0x4ba35e[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x21b365;})});}_0x1bd97e=_['merge']({},_0x1bd97e,_0x4ba35e[_0x7721('0x3a')]);return db[_0x7721('0x54')]['count']({'where':_0x1bd97e[_0x7721('0x2b')]})['then'](function(_0x453792){_0x3c66b3[_0x7721('0x13')]=_0x453792;if(_0x4ba35e['query'][_0x7721('0x42')]){_0x1bd97e['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x1bd97e);})[_0x7721('0x16')](function(_0x20f12e){_0x3c66b3[_0x7721('0x2f')]=_0x20f12e;return _0x3c66b3;});}})['then'](respondWithFilteredResult(_0x263070,_0x1bd97e))['catch'](handleError(_0x263070,null));};exports['getHopperFinals']=function(_0x355aa8,_0x3f7923){var _0x3c9334={'raw':!![],'where':{}};var _0x4220cf={};var _0x3b02d7={'count':0x0,'rows':[]};return db[_0x7721('0x28')]['findOne']({'where':{'id':_0x355aa8[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x3f7923,null))[_0x7721('0x16')](function(_0xcf5304){if(_0xcf5304){_0x4220cf[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x55')][_0x7721('0x34')]);_0x4220cf[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x355aa8[_0x7721('0x2d')]);_0x4220cf[_0x7721('0x35')]=_['intersection'](_0x4220cf['model'],_0x4220cf[_0x7721('0x2d')]);_0x3c9334[_0x7721('0x36')]=_['intersection'](_0x4220cf[_0x7721('0x32')],qs['fields'](_0x355aa8['query'][_0x7721('0x38')]));_0x3c9334['attributes']=_0x3c9334['attributes'][_0x7721('0x39')]?_0x3c9334[_0x7721('0x36')]:_0x4220cf[_0x7721('0x32')];if(!_0x355aa8[_0x7721('0x2d')][_0x7721('0x4d')]('nolimit')){_0x3c9334[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x355aa8[_0x7721('0x2d')][_0x7721('0x4f')]);_0x3c9334['offset']=qs['offset'](_0x355aa8[_0x7721('0x2d')][_0x7721('0x11')]);}_0x3c9334['order']=qs[_0x7721('0x51')](_0x355aa8[_0x7721('0x2d')]['sort']);_0x3c9334['where']=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x355aa8[_0x7721('0x2d')],_0x4220cf[_0x7721('0x35')]));_0x3c9334[_0x7721('0x2b')][_0x7721('0x53')]=_0xcf5304['id'];if(_0x355aa8[_0x7721('0x2d')][_0x7721('0x1c')]){_0x3c9334['where']=_[_0x7721('0x47')](_0x3c9334[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x3c9334[_0x7721('0x36')],function(_0xe1c795){var _0x9b5f60={};_0x9b5f60[_0xe1c795]={'$like':'%'+_0x355aa8[_0x7721('0x2d')]['filter']+'%'};return _0x9b5f60;})});}_0x3c9334=_[_0x7721('0x47')]({},_0x3c9334,_0x355aa8[_0x7721('0x3a')]);return db['CmHopperFinal'][_0x7721('0x13')]({'where':_0x3c9334[_0x7721('0x2b')]})[_0x7721('0x16')](function(_0xb8547a){_0x3b02d7[_0x7721('0x13')]=_0xb8547a;if(_0x355aa8[_0x7721('0x2d')][_0x7721('0x42')]){_0x3c9334[_0x7721('0x2c')]=[{'all':!![]}];}return db[_0x7721('0x55')][_0x7721('0x2e')](_0x3c9334);})['then'](function(_0x418954){_0x3b02d7[_0x7721('0x2f')]=_0x418954;return _0x3b02d7;});}})[_0x7721('0x16')](respondWithFilteredResult(_0x3f7923,_0x3c9334))[_0x7721('0x30')](handleError(_0x3f7923,null));};exports[_0x7721('0x56')]=function(_0x47653d,_0x12869b){var _0x1cfee2={'raw':!![],'where':{}};var _0x425327={};var _0x42ee11={'count':0x0,'rows':[]};return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x47653d[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x12869b,null))[_0x7721('0x16')](function(_0x461938){if(_0x461938){_0x425327[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x57')][_0x7721('0x34')]);_0x425327['query']=_[_0x7721('0x33')](_0x47653d['query']);_0x425327[_0x7721('0x35')]=_[_0x7721('0x37')](_0x425327[_0x7721('0x32')],_0x425327[_0x7721('0x2d')]);_0x1cfee2[_0x7721('0x36')]=_['intersection'](_0x425327['model'],qs['fields'](_0x47653d['query'][_0x7721('0x38')]));_0x1cfee2[_0x7721('0x36')]=_0x1cfee2[_0x7721('0x36')][_0x7721('0x39')]?_0x1cfee2[_0x7721('0x36')]:_0x425327['model'];if(!_0x47653d[_0x7721('0x2d')]['hasOwnProperty'](_0x7721('0x4e'))){_0x1cfee2[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x47653d[_0x7721('0x2d')][_0x7721('0x4f')]);_0x1cfee2[_0x7721('0x11')]=qs['offset'](_0x47653d[_0x7721('0x2d')]['offset']);}_0x1cfee2['order']=qs[_0x7721('0x51')](_0x47653d[_0x7721('0x2d')][_0x7721('0x51')]);_0x1cfee2[_0x7721('0x2b')]=qs[_0x7721('0x35')](_['pick'](_0x47653d[_0x7721('0x2d')],_0x425327[_0x7721('0x35')]));_0x1cfee2[_0x7721('0x2b')][_0x7721('0x53')]=_0x461938['id'];if(_0x47653d[_0x7721('0x2d')][_0x7721('0x1c')]){_0x1cfee2[_0x7721('0x2b')]=_['merge'](_0x1cfee2[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x1cfee2[_0x7721('0x36')],function(_0x193326){var _0x1dbf47={};_0x1dbf47[_0x193326]={'$like':'%'+_0x47653d['query'][_0x7721('0x1c')]+'%'};return _0x1dbf47;})});}_0x1cfee2=_[_0x7721('0x47')]({},_0x1cfee2,_0x47653d[_0x7721('0x3a')]);return db['CmHopperBlack'][_0x7721('0x13')]({'where':_0x1cfee2[_0x7721('0x2b')]})['then'](function(_0x29403d){_0x42ee11[_0x7721('0x13')]=_0x29403d;if(_0x47653d[_0x7721('0x2d')][_0x7721('0x42')]){_0x1cfee2['include']=[{'all':!![]}];}return db[_0x7721('0x57')]['findAll'](_0x1cfee2);})[_0x7721('0x16')](function(_0x1c50c2){_0x42ee11['rows']=_0x1c50c2;return _0x42ee11;});}})[_0x7721('0x16')](respondWithFilteredResult(_0x12869b,_0x1cfee2))[_0x7721('0x30')](handleError(_0x12869b,null));};exports['getTeams']=function(_0x29968c,_0x11733f){var _0x5e3816={};var _0x7fd3e8={};var _0x52e8b1;var _0x240b0a;return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x29968c['params']['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x11733f,null))['then'](function(_0x5a00be){if(_0x5a00be){_0x52e8b1=_0x5a00be;_0x7fd3e8[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x58')][_0x7721('0x34')]);_0x7fd3e8[_0x7721('0x2d')]=_['keys'](_0x29968c[_0x7721('0x2d')]);_0x7fd3e8[_0x7721('0x35')]=_[_0x7721('0x37')](_0x7fd3e8[_0x7721('0x32')],_0x7fd3e8[_0x7721('0x2d')]);_0x5e3816['attributes']=_[_0x7721('0x37')](_0x7fd3e8['model'],qs[_0x7721('0x38')](_0x29968c['query']['fields']));_0x5e3816[_0x7721('0x36')]=_0x5e3816['attributes']['length']?_0x5e3816[_0x7721('0x36')]:_0x7fd3e8[_0x7721('0x32')];_0x5e3816[_0x7721('0x50')]=qs['sort'](_0x29968c[_0x7721('0x2d')]['sort']);_0x5e3816['where']=qs['filters'](_[_0x7721('0x52')](_0x29968c[_0x7721('0x2d')],_0x7fd3e8[_0x7721('0x35')]));if(_0x29968c[_0x7721('0x2d')][_0x7721('0x1c')]){_0x5e3816[_0x7721('0x2b')]=_[_0x7721('0x47')](_0x5e3816[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x5e3816[_0x7721('0x36')],function(_0x25bf32){var _0x4ec3c6={};_0x4ec3c6[_0x25bf32]={'$like':'%'+_0x29968c[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x4ec3c6;})});}_0x5e3816=_[_0x7721('0x47')]({},_0x5e3816,_0x29968c[_0x7721('0x3a')]);return _0x52e8b1[_0x7721('0x59')](_0x5e3816);}})[_0x7721('0x16')](function(_0xc7e4e9){if(_0xc7e4e9){_0x240b0a=_0xc7e4e9['length'];if(!_0x29968c['query'][_0x7721('0x4d')](_0x7721('0x4e'))){_0x5e3816[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x29968c['query'][_0x7721('0x4f')]);_0x5e3816['offset']=qs[_0x7721('0x11')](_0x29968c['query'][_0x7721('0x11')]);}return _0x52e8b1[_0x7721('0x59')](_0x5e3816);}})[_0x7721('0x16')](function(_0x249a5b){if(_0x249a5b){return _0x249a5b?{'count':_0x240b0a,'rows':_0x249a5b}:null;}})[_0x7721('0x16')](respondWithResult(_0x11733f,null))[_0x7721('0x30')](handleError(_0x11733f,null));};exports['addTeams']=function(_0x509f2d,_0x4d2644){var _0x2b0968=_0x509f2d['body'][_0x7721('0x5a')];var _0x186ada=_['map'](_0x2b0968,'id');return db[_0x7721('0x58')][_0x7721('0x2e')]({'where':{'id':_0x186ada},'attributes':['id'],'include':[{'model':db[_0x7721('0x5b')],'as':'Agents','attributes':['id',_0x7721('0x22'),_0x7721('0x5c'),'voicePause','interface'],'raw':!![]}]})[_0x7721('0x16')](function(_0xc85b9){if(_0xc85b9){var _0x58be49=_[_0x7721('0x5d')](_0xc85b9,function(_0x283716){var _0x4cd26e=_0x283716['get']({'plain':!![]});_0x4cd26e['Agents']['forEach'](function(_0x19be6b){_0x19be6b[_0x7721('0x5e')]=_[_0x7721('0x21')](_0x2b0968,{'id':_0x4cd26e['id']})['penalty'];});return _0x4cd26e['Agents'];});return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0x509f2d[_0x7721('0x31')]['id']}})[_0x7721('0x16')](function(_0x14711c){return db[_0x7721('0x5f')][_0x7721('0x60')](function(_0x435455){return _0x14711c[_0x7721('0x61')](_0x186ada,{'transaction':_0x435455})['then'](function(){return BPromise['each'](_0x2b0968,function(_0x415445){return db['TeamVoiceQueue'][_0x7721('0x62')]({'TeamId':_0x415445['id'],'VoiceQueueId':_0x509f2d['params']['id'],'penalty':_0x415445[_0x7721('0x5e')]},{'transaction':_0x435455});});})['then'](function(){return BPromise[_0x7721('0x63')](_0x58be49,function(_0x14341e){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x14341e['id'],'VoiceQueueId':_0x509f2d[_0x7721('0x31')]['id']},'defaults':{'penalty':_0x14341e[_0x7721('0x5e')]},'transaction':_0x435455});});})[_0x7721('0x16')](function(){return BPromise[_0x7721('0x63')](_[_0x7721('0x1c')](_0x58be49,{'online':!![]}),function(_0x5e69d7){return db[_0x7721('0x64')][_0x7721('0x62')]({'membername':_0x5e69d7[_0x7721('0x22')],'UserId':_0x5e69d7['id'],'queue_name':_0x14711c['name'],'VoiceQueueId':_0x14711c['id'],'interface':_[_0x7721('0x65')](_0x5e69d7[_0x7721('0x66')])?util[_0x7721('0x67')](_0x7721('0x68'),_0x5e69d7[_0x7721('0x22')]):_0x5e69d7[_0x7721('0x66')],'paused':_0x5e69d7[_0x7721('0x69')]||![],'penalty':_0x5e69d7[_0x7721('0x5e')]},{'transaction':_0x435455});});})[_0x7721('0x16')](function(){_0x58be49[_0x7721('0x6a')](function(_0x2a2d8a){socket['emit'](_0x7721('0x6b'),{'UserId':_0x2a2d8a['id'],'VoiceQueueId':_0x14711c['id']});});});});});}})[_0x7721('0x16')](respondWithStatusCode(_0x4d2644,null))[_0x7721('0x30')](handleError(_0x4d2644,null));};exports[_0x7721('0x6c')]=function(_0xcb843e,_0x35d3f1){return db[_0x7721('0x58')]['findAll']({'where':{'id':_0xcb843e[_0x7721('0x2d')]['ids']},'attributes':['id'],'include':[{'model':db[_0x7721('0x5b')],'as':_0x7721('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x7721('0x16')](handleEntityNotFound(_0x35d3f1,null))[_0x7721('0x16')](function(_0x37b607){var _0x3d6d41=_['map'](_0x37b607,'id');var _0xbce1b=[];var _0x4d3ad1=[];var _0x4028fa=squel[_0x7721('0x6e')]();_0x4028fa[_0x7721('0x6f')]('tq.TeamId')[_0x7721('0x70')](_0x7721('0x71'),'tq')[_0x7721('0x72')](_0x7721('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7721('0x2b')](_0x7721('0x74'),_0xcb843e[_0x7721('0x31')]['id']);for(var _0x980f26=0x0;_0x980f26<_0x37b607['length'];_0x980f26+=0x1){let _0x40dd5e=_0x37b607[_0x980f26];for(var _0x3d143a=0x0;_0x3d143a<_0x40dd5e[_0x7721('0x6d')][_0x7721('0x39')];_0x3d143a+=0x1){let _0x53fa66=_0x40dd5e[_0x7721('0x6d')][_0x3d143a];var _0x1a95e6=_0x4028fa[_0x7721('0x75')]();_0x1a95e6[_0x7721('0x2b')](_0x7721('0x76'),_0x53fa66['id']);_0x4d3ad1[_0x7721('0x77')](db[_0x7721('0x5f')][_0x7721('0x2d')](_0x1a95e6[_0x7721('0x78')](),{'type':db['sequelize'][_0x7721('0x79')][_0x7721('0x7a')]})[_0x7721('0x16')](function(_0x1c246b){if(_0x1c246b[_0x7721('0x39')]===0x1){return _0x53fa66['id'];}else{var _0x31447d=_[_0x7721('0x7b')](_[_0x7721('0x1e')](_0x1c246b,_0x7721('0x7c')),function(_0x14fd97){return _[_0x7721('0x7d')](_0x3d6d41,_0x14fd97);});if(_0x31447d){return _0x53fa66['id'];}}}));}}return BPromise[_0x7721('0x7e')](_0x4d3ad1)[_0x7721('0x16')](function(_0x18ccdf){_0xbce1b=_(_0xbce1b)[_0x7721('0x7f')](_0x18ccdf)[_0x7721('0x80')]()['value']();return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0xcb843e[_0x7721('0x31')]['id']}})[_0x7721('0x16')](function(_0x157310){return db[_0x7721('0x5f')][_0x7721('0x60')](function(_0xdd0e7a){return _0x157310[_0x7721('0x6c')](_0xcb843e[_0x7721('0x2d')][_0x7721('0x81')],{'transaction':_0xdd0e7a})[_0x7721('0x16')](function(){if(!_['isEmpty'](_0xbce1b)){return _0x157310['removeAgents'](_0xbce1b,{'transaction':_0xdd0e7a})[_0x7721('0x16')](function(){return db[_0x7721('0x64')][_0x7721('0x17')]({'where':{'VoiceQueueId':_0xcb843e[_0x7721('0x31')]['id'],'UserId':_0xbce1b},'transaction':_0xdd0e7a});});}})[_0x7721('0x16')](function(){_0xbce1b['forEach'](function(_0x1ebc86){socket[_0x7721('0x82')](_0x7721('0x83'),{'UserId':_0x1ebc86,'VoiceQueueId':_0x157310['id']});});});});});});})[_0x7721('0x16')](respondWithStatusCode(_0x35d3f1,null))[_0x7721('0x30')](handleError(_0x35d3f1,null));};exports[_0x7721('0x84')]=function(_0xc0f448,_0x3dc688){var _0x298aca,_0x45b430;return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0xc0f448['params']['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x3dc688,null))[_0x7721('0x16')](function(_0x16e0cd){if(_0x16e0cd){_0x45b430=_0x16e0cd;return _0x16e0cd['addAgents'](_0xc0f448[_0x7721('0x46')][_0x7721('0x81')],_[_0x7721('0x43')](_0xc0f448['body'],[_0x7721('0x81'),'id'])||{})['spread'](function(_0x5f3dd2){for(var _0xa73193=0x0;_0xa73193<_0xc0f448[_0x7721('0x46')][_0x7721('0x81')][_0x7721('0x39')];_0xa73193+=0x1){socket['emit'](_0x7721('0x6b'),{'UserId':Number(_0xc0f448[_0x7721('0x46')][_0x7721('0x81')][_0xa73193]),'VoiceQueueId':Number(_0xc0f448[_0x7721('0x31')]['id'])});}return _0x5f3dd2;});}})[_0x7721('0x16')](function(_0x5b12c7){_0x298aca=_0x5b12c7||[];if(_0x45b430){return db[_0x7721('0x5b')][_0x7721('0x2e')]({'where':{'id':_0xc0f448[_0x7721('0x46')][_0x7721('0x81')]},'attributes':['id',_0x7721('0x22'),_0x7721('0x5c'),_0x7721('0x69'),_0x7721('0x66')],'raw':!![]});}})[_0x7721('0x16')](function(_0x385c86){if(!_[_0x7721('0x85')](_0x385c86)){var _0xc18d1a=[];for(var _0x9575b3=0x0;_0x9575b3<_0x385c86[_0x7721('0x39')];_0x9575b3++){if(_0x385c86[_0x9575b3][_0x7721('0x5c')]){_0xc18d1a[_0x7721('0x77')](db[_0x7721('0x64')][_0x7721('0x62')]({'membername':_0x385c86[_0x9575b3][_0x7721('0x22')],'UserId':_0x385c86[_0x9575b3]['id'],'queue_name':_0x45b430[_0x7721('0x22')],'VoiceQueueId':_0x45b430['id'],'interface':_[_0x7721('0x65')](_0x385c86[_0x9575b3][_0x7721('0x66')])?util['format'](_0x7721('0x68'),_0x385c86[_0x9575b3]['name']):_0x385c86[_0x9575b3][_0x7721('0x66')],'paused':_0x385c86[_0x9575b3][_0x7721('0x69')]||![],'penalty':_0xc0f448[_0x7721('0x46')][_0x7721('0x5e')]||0x0}));}}return BPromise['all'](_0xc18d1a);}})[_0x7721('0x16')](function(){return _0x298aca;})[_0x7721('0x16')](respondWithResult(_0x3dc688,null))['catch'](handleError(_0x3dc688,null));};exports[_0x7721('0x86')]=function(_0x3a8f89,_0x52aae1){return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0x3a8f89[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x52aae1,null))[_0x7721('0x16')](function(_0x55c43c){if(_0x55c43c){return _0x55c43c['removeAgents'](_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')])['then'](function(){if(_['isArray'](_0x3a8f89[_0x7721('0x2d')]['ids'])){for(var _0x1c23e3=0x0;_0x1c23e3<_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')]['length'];_0x1c23e3+=0x1){socket[_0x7721('0x82')](_0x7721('0x83'),{'UserId':Number(_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')][_0x1c23e3]),'VoiceQueueId':Number(_0x3a8f89[_0x7721('0x31')]['id'])});}}else{socket[_0x7721('0x82')](_0x7721('0x83'),{'UserId':Number(_0x3a8f89[_0x7721('0x2d')]['ids']),'VoiceQueueId':Number(_0x3a8f89[_0x7721('0x31')]['id'])});}});}})[_0x7721('0x16')](function(_0x3c3c7e){return db[_0x7721('0x64')][_0x7721('0x17')]({'where':{'VoiceQueueId':_0x3a8f89['params']['id'],'UserId':_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')]}})[_0x7721('0x16')](function(){return _0x3c3c7e;});})[_0x7721('0x16')](respondWithStatusCode(_0x52aae1,null))[_0x7721('0x30')](handleError(_0x52aae1,null));};exports[_0x7721('0x87')]=function(_0x16b110,_0x366323){var _0x14b49e={};var _0x12f568={};var _0x259640;var _0x4a0e50;return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x16b110[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x366323,null))[_0x7721('0x16')](function(_0x25e4db){if(_0x25e4db){_0x259640=_0x25e4db;_0x12f568[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x5b')][_0x7721('0x34')]);_0x12f568[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x16b110[_0x7721('0x2d')]);_0x12f568[_0x7721('0x35')]=_[_0x7721('0x37')](_0x12f568['model'],_0x12f568[_0x7721('0x2d')]);_0x14b49e['attributes']=_['intersection'](_0x12f568[_0x7721('0x32')],qs['fields'](_0x16b110[_0x7721('0x2d')][_0x7721('0x38')]));_0x14b49e[_0x7721('0x36')]=_0x14b49e[_0x7721('0x36')]['length']?_0x14b49e['attributes']:_0x12f568[_0x7721('0x32')];_0x14b49e[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x16b110[_0x7721('0x2d')][_0x7721('0x51')]);_0x14b49e[_0x7721('0x2b')]=qs[_0x7721('0x35')](_['pick'](_0x16b110[_0x7721('0x2d')],_0x12f568['filters']));if(_0x16b110[_0x7721('0x2d')][_0x7721('0x1c')]){_0x14b49e[_0x7721('0x2b')]=_[_0x7721('0x47')](_0x14b49e[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x14b49e[_0x7721('0x36')],function(_0x184f1b){var _0xa257a0={};_0xa257a0[_0x184f1b]={'$like':'%'+_0x16b110[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0xa257a0;})});}_0x14b49e=_[_0x7721('0x47')]({},_0x14b49e,_0x16b110[_0x7721('0x3a')]);return _0x259640[_0x7721('0x87')](_0x14b49e);}})[_0x7721('0x16')](function(_0x1ee0c1){if(_0x1ee0c1){_0x4a0e50=_0x1ee0c1[_0x7721('0x39')];if(!_0x16b110[_0x7721('0x2d')]['hasOwnProperty'](_0x7721('0x4e'))){_0x14b49e[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x16b110[_0x7721('0x2d')][_0x7721('0x4f')]);_0x14b49e[_0x7721('0x11')]=qs['offset'](_0x16b110[_0x7721('0x2d')][_0x7721('0x11')]);}return _0x259640[_0x7721('0x87')](_0x14b49e);}})['then'](function(_0x1bdadb){if(_0x1bdadb){return _0x1bdadb?{'count':_0x4a0e50,'rows':_0x1bdadb}:null;}})['then'](respondWithResult(_0x366323,null))[_0x7721('0x30')](handleError(_0x366323,null));};exports['getMembers']=function(_0xe5e55f,_0x17ce3b){var _0xbc0a80={};var _0xf2dc08={};var _0x5b493a;var _0x45024c;return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0xe5e55f[_0x7721('0x31')]['id']}})['then'](handleEntityNotFound(_0x17ce3b,null))['then'](function(_0x12b255){if(_0x12b255){_0x5b493a=_0x12b255;_0xf2dc08['model']=_[_0x7721('0x33')](db[_0x7721('0x64')][_0x7721('0x34')]);_0xf2dc08[_0x7721('0x2d')]=_[_0x7721('0x33')](_0xe5e55f[_0x7721('0x2d')]);_0xf2dc08[_0x7721('0x35')]=_[_0x7721('0x37')](_0xf2dc08[_0x7721('0x32')],_0xf2dc08['query']);_0xbc0a80[_0x7721('0x36')]=_[_0x7721('0x37')](_0xf2dc08[_0x7721('0x32')],qs['fields'](_0xe5e55f['query'][_0x7721('0x38')]));_0xbc0a80[_0x7721('0x36')]=_0xbc0a80[_0x7721('0x36')][_0x7721('0x39')]?_0xbc0a80[_0x7721('0x36')]:_0xf2dc08[_0x7721('0x32')];_0xbc0a80['order']=qs[_0x7721('0x51')](_0xe5e55f[_0x7721('0x2d')]['sort']);_0xbc0a80[_0x7721('0x2b')]=qs['filters'](_[_0x7721('0x52')](_0xe5e55f['query'],_0xf2dc08[_0x7721('0x35')]));if(_0xe5e55f['query']['filter']){_0xbc0a80['where']=_[_0x7721('0x47')](_0xbc0a80['where'],{'$or':_['map'](_0xbc0a80['attributes'],function(_0x52a1ee){var _0x41c991={};_0x41c991[_0x52a1ee]={'$like':'%'+_0xe5e55f[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x41c991;})});}_0xbc0a80=_[_0x7721('0x47')]({},_0xbc0a80,_0xe5e55f[_0x7721('0x3a')]);return _0x5b493a['getMembers'](_0xbc0a80);}})[_0x7721('0x16')](function(_0x22d4e0){if(_0x22d4e0){_0x45024c=_0x22d4e0['length'];if(!_0xe5e55f[_0x7721('0x2d')][_0x7721('0x4d')](_0x7721('0x4e'))){_0xbc0a80[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0xe5e55f[_0x7721('0x2d')][_0x7721('0x4f')]);_0xbc0a80[_0x7721('0x11')]=qs['offset'](_0xe5e55f[_0x7721('0x2d')][_0x7721('0x11')]);}return _0x5b493a[_0x7721('0x88')](_0xbc0a80);}})[_0x7721('0x16')](function(_0x2fbb00){return _0x2fbb00?{'count':_0x45024c,'rows':_0x2fbb00}:null;})[_0x7721('0x16')](respondWithResult(_0x17ce3b,null))[_0x7721('0x30')](handleError(_0x17ce3b,null));};exports[_0x7721('0x89')]=function(_0x561235,_0x12ad4d){var _0x226081={};var _0x17c3e7={};var _0x250cbf;var _0x255b22;return db['VoiceQueue'][_0x7721('0x4b')]({'where':{'id':_0x561235[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x12ad4d,null))[_0x7721('0x16')](function(_0x396880){if(_0x396880){_0x250cbf=_0x396880;_0x17c3e7['model']=_[_0x7721('0x33')](db[_0x7721('0x8a')]['rawAttributes']);_0x17c3e7[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x561235[_0x7721('0x2d')]);_0x17c3e7[_0x7721('0x35')]=_[_0x7721('0x37')](_0x17c3e7['model'],_0x17c3e7[_0x7721('0x2d')]);_0x226081[_0x7721('0x36')]=_['intersection'](_0x17c3e7['model'],qs[_0x7721('0x38')](_0x561235[_0x7721('0x2d')][_0x7721('0x38')]));_0x226081['attributes']=_0x226081[_0x7721('0x36')]['length']?_0x226081['attributes']:_0x17c3e7[_0x7721('0x32')];_0x226081[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x561235[_0x7721('0x2d')][_0x7721('0x51')]);_0x226081['where']=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x561235[_0x7721('0x2d')],_0x17c3e7[_0x7721('0x35')]));if(_0x561235[_0x7721('0x2d')]['filter']){_0x226081[_0x7721('0x2b')]=_['merge'](_0x226081[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x226081[_0x7721('0x36')],function(_0x5209ff){var _0x2583c1={};_0x2583c1[_0x5209ff]={'$like':'%'+_0x561235['query'][_0x7721('0x1c')]+'%'};return _0x2583c1;})});}_0x226081=_[_0x7721('0x47')]({},_0x226081,_0x561235[_0x7721('0x3a')]);return _0x250cbf[_0x7721('0x89')](_0x226081);}})[_0x7721('0x16')](function(_0x3235d8){if(_0x3235d8){_0x255b22=_0x3235d8[_0x7721('0x39')];if(!_0x561235[_0x7721('0x2d')][_0x7721('0x4d')](_0x7721('0x4e'))){_0x226081['limit']=qs[_0x7721('0x4f')](_0x561235[_0x7721('0x2d')][_0x7721('0x4f')]);_0x226081[_0x7721('0x11')]=qs[_0x7721('0x11')](_0x561235['query'][_0x7721('0x11')]);}return _0x250cbf[_0x7721('0x89')](_0x226081);}})[_0x7721('0x16')](function(_0x501e31){if(_0x501e31){return _0x501e31?{'count':_0x255b22,'rows':_0x501e31}:null;}})[_0x7721('0x16')](respondWithResult(_0x12ad4d,null))[_0x7721('0x30')](handleError(_0x12ad4d,null));};exports[_0x7721('0x8b')]=function(_0xe325e1,_0x1aa1fc){var _0x560be6=moment()[_0x7721('0x67')](_0x7721('0x8c'));var _0x1bd066,_0xaa15c5;return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0xe325e1[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x1aa1fc,null))[_0x7721('0x16')](function(_0x42ffff){if(_0x42ffff){_0xaa15c5=_0x42ffff;return _0x42ffff[_0x7721('0x8b')](_0xe325e1[_0x7721('0x46')][_0x7721('0x81')],_[_0x7721('0x43')](_0xe325e1[_0x7721('0x46')],[_0x7721('0x81'),'id'])||{});}return null;})[_0x7721('0x8d')](function(_0x3f19f5){var _0x28f11a;_0x1bd066=_0x3f19f5||[];var _0x3bc8f3=[];if(_0x3f19f5){for(var _0x26cea3=0x0;_0x26cea3<_0x3f19f5[_0x7721('0x39')];_0x26cea3+=0x1){var _0x57e928=_0x3f19f5[_0x26cea3]['get']({'plain':!![]});_0xaa15c5[_0x7721('0x8e')]=_0xe325e1[_0x7721('0x46')][_0x7721('0x8e')]?_0xe325e1[_0x7721('0x46')]['dialCheckDuplicateType']:_0xaa15c5[_0x7721('0x8e')];switch(_0xaa15c5['dialCheckDuplicateType']){case _0x7721('0x8f'):_0x28f11a=squel[_0x7721('0x90')]()[_0x7721('0x91')]('cm_hopper')['fromQuery'](['phone',_0x7721('0x92'),_0x7721('0x93'),_0x7721('0x94'),_0x7721('0x53'),_0x7721('0x44'),'updatedAt'],squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x95'),'phone')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x92'))[_0x7721('0x6f')]('id','ContactId')[_0x7721('0x6f')](_0x57e928[_0x7721('0x96')][_0x7721('0x78')](),'ListId')[_0x7721('0x6f')](_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27','createdAt')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27','updatedAt')['from'](_0x7721('0x97'))[_0x7721('0x2b')](_0x7721('0x98'))[_0x7721('0x2b')](_0x7721('0x99'),_0x57e928['CmListId'][_0x7721('0x78')]())[_0x7721('0x2b')](_0x7721('0x9a'))[_0x7721('0x2b')](_0x7721('0x9b'),squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x9c'))[_0x7721('0x70')](_0x7721('0x9d'))['where'](_0x7721('0x74'),_0xe325e1[_0x7721('0x31')]['id']['toString']()))[_0x7721('0x2b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7721('0x6e')]()['field'](_0x7721('0x9e'))['from']('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0xe325e1[_0x7721('0x31')]['id']['toString']())))[_0x7721('0x78')]();break;case _0x7721('0x9f'):_0x28f11a=squel[_0x7721('0x90')]()[_0x7721('0x91')](_0x7721('0xa0'))[_0x7721('0xa1')](['phone',_0x7721('0x92'),_0x7721('0x93'),'ListId','VoiceQueueId',_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()['field'](_0x7721('0x95'),_0x7721('0x95'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x92'))[_0x7721('0x6f')]('id','ContactId')[_0x7721('0x6f')](_0x57e928[_0x7721('0x96')][_0x7721('0x78')](),_0x7721('0x94'))[_0x7721('0x6f')](_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))['field']('\x27'+_0x560be6+'\x27','createdAt')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x45'))['from'](_0x7721('0x97'))['where']('deletedAt\x20IS\x20NULL')[_0x7721('0x2b')]('ListId\x20=\x20?',_0x57e928[_0x7721('0x96')]['toString']())[_0x7721('0x2b')](_0x7721('0x9a'))['where'](_0x7721('0x9b'),squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x9e'))[_0x7721('0x70')]('cm_hopper')[_0x7721('0x2b')](_0x7721('0x74'),_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')]())))[_0x7721('0x78')]();break;default:_0x28f11a=squel[_0x7721('0x90')]()[_0x7721('0x91')]('cm_hopper')[_0x7721('0xa1')]([_0x7721('0x95'),_0x7721('0x92'),_0x7721('0x93'),_0x7721('0x94'),'VoiceQueueId',_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x95'),_0x7721('0x95'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x92'))[_0x7721('0x6f')]('id',_0x7721('0x93'))['field'](_0x57e928['CmListId'][_0x7721('0x78')](),'ListId')['field'](_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x44'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x45'))[_0x7721('0x70')](_0x7721('0x97'))[_0x7721('0x2b')](_0x7721('0x98'))[_0x7721('0x2b')](_0x7721('0x99'),_0x57e928[_0x7721('0x96')][_0x7721('0x78')]())[_0x7721('0x2b')]('phone\x20IS\x20NOT\x20NULL'))[_0x7721('0x78')]();}_0x3bc8f3[_0x7721('0x77')](db[_0x7721('0x5f')][_0x7721('0x2d')](_0x28f11a));}return BPromise[_0x7721('0x7e')](_0x3bc8f3);}})[_0x7721('0x16')](function(){var _0x5f53b3=[];var _0x8fc283=squel[_0x7721('0x90')]()['into'](_0x7721('0xa2'))['fromQuery']([_0x7721('0xa3'),_0x7721('0x95'),_0x7721('0xa4'),_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0xa5'))[_0x7721('0x6f')](_0x7721('0xa6'))[_0x7721('0x6f')](_0x7721('0xa7'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27','createdAt')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x45'))[_0x7721('0x70')](_0x7721('0xa8'),'ci')[_0x7721('0x72')](_0x7721('0xa0'),'h',_0x7721('0xa9'))['where'](_0x7721('0xaa'),_0x560be6)[_0x7721('0x2b')](_0x7721('0xab'),'PHONE'))[_0x7721('0x78')]();_0x5f53b3['push'](db['sequelize'][_0x7721('0x2d')](_0x8fc283));return BPromise[_0x7721('0x7e')](_0x5f53b3);})['then'](function(){return _0x1bd066;})[_0x7721('0x16')](respondWithResult(_0x1aa1fc,null))[_0x7721('0x30')](handleError(_0x1aa1fc,null));};exports[_0x7721('0xac')]=function(_0xbc4f13,_0x50f4bd){return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0xbc4f13['params']['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x50f4bd,null))[_0x7721('0x16')](function(_0x537831){if(_0x537831){return _0x537831[_0x7721('0xac')](_0xbc4f13[_0x7721('0x2d')][_0x7721('0x81')]);}})[_0x7721('0x16')](function(_0x49548e){if(_0x49548e){return db['CmHopper'][_0x7721('0x17')]({'where':{'ListId':_0xbc4f13[_0x7721('0x2d')][_0x7721('0x81')],'VoiceQueueId':_0xbc4f13[_0x7721('0x31')]['id']}})['then'](function(){return _0x49548e;});}})['then'](respondWithStatusCode(_0x50f4bd,null))[_0x7721('0x30')](handleError(_0x50f4bd,null));};exports[_0x7721('0xad')]=function(_0x4ea8ac,_0x226556){var _0x4bd023={};var _0x50de45={};var _0x51ac8f;var _0x27ed5e;return db['VoiceQueue'][_0x7721('0x4b')]({'where':{'id':_0x4ea8ac[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x226556,null))['then'](function(_0x4893c0){if(_0x4893c0){_0x51ac8f=_0x4893c0;_0x50de45[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x8a')][_0x7721('0x34')]);_0x50de45[_0x7721('0x2d')]=_['keys'](_0x4ea8ac[_0x7721('0x2d')]);_0x50de45[_0x7721('0x35')]=_[_0x7721('0x37')](_0x50de45[_0x7721('0x32')],_0x50de45[_0x7721('0x2d')]);_0x4bd023['attributes']=_[_0x7721('0x37')](_0x50de45[_0x7721('0x32')],qs[_0x7721('0x38')](_0x4ea8ac[_0x7721('0x2d')][_0x7721('0x38')]));_0x4bd023[_0x7721('0x36')]=_0x4bd023['attributes']['length']?_0x4bd023[_0x7721('0x36')]:_0x50de45[_0x7721('0x32')];_0x4bd023[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x4ea8ac[_0x7721('0x2d')][_0x7721('0x51')]);_0x4bd023[_0x7721('0x2b')]=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x4ea8ac[_0x7721('0x2d')],_0x50de45[_0x7721('0x35')]));if(_0x4ea8ac['query'][_0x7721('0x1c')]){_0x4bd023[_0x7721('0x2b')]=_['merge'](_0x4bd023[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x4bd023[_0x7721('0x36')],function(_0x400273){var _0x42c438={};_0x42c438[_0x400273]={'$like':'%'+_0x4ea8ac[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x42c438;})});}_0x4bd023=_[_0x7721('0x47')]({},_0x4bd023,_0x4ea8ac[_0x7721('0x3a')]);return _0x51ac8f[_0x7721('0xad')](_0x4bd023);}})[_0x7721('0x16')](function(_0x1192a8){if(_0x1192a8){_0x27ed5e=_0x1192a8[_0x7721('0x39')];if(!_0x4ea8ac['query'][_0x7721('0x4d')](_0x7721('0x4e'))){_0x4bd023['limit']=qs[_0x7721('0x4f')](_0x4ea8ac['query'][_0x7721('0x4f')]);_0x4bd023[_0x7721('0x11')]=qs['offset'](_0x4ea8ac['query'][_0x7721('0x11')]);}return _0x51ac8f['getBlackLists'](_0x4bd023);}})[_0x7721('0x16')](function(_0x2f7067){if(_0x2f7067){return _0x2f7067?{'count':_0x27ed5e,'rows':_0x2f7067}:null;}})[_0x7721('0x16')](respondWithResult(_0x226556,null))[_0x7721('0x30')](handleError(_0x226556,null));};exports[_0x7721('0xae')]=function(_0x376f37,_0x5b157e){var _0x4b84b9;return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0x376f37[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x5b157e,null))[_0x7721('0x16')](function(_0x39d43b){if(_0x39d43b){return _0x39d43b['addBlackLists'](_0x376f37['body'][_0x7721('0x81')],_[_0x7721('0x43')](_0x376f37[_0x7721('0x46')],[_0x7721('0x81'),'id'])||{});}return null;})[_0x7721('0x8d')](function(_0x430304){var _0x469b6b;_0x4b84b9=_0x430304||[];var _0x6766c6=[];if(_0x430304){for(var _0x37877c=0x0;_0x37877c<_0x430304['length'];_0x37877c+=0x1){var _0x259eaa=_0x430304[_0x37877c][_0x7721('0x18')]({'plain':!![]});_0x469b6b=squel['insert']()['into'](_0x7721('0xaf'))[_0x7721('0xa1')]([_0x7721('0x95'),'ContactId',_0x7721('0x94'),_0x7721('0x53'),_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()['field'](_0x7721('0x95'),'phone')[_0x7721('0x6f')]('id','ContactId')[_0x7721('0x6f')](_0x259eaa['CmListId'][_0x7721('0x78')](),_0x7721('0x94'))[_0x7721('0x6f')](_0x376f37[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))['field'](_0x7721('0xb0'),_0x7721('0x44'))[_0x7721('0x6f')](_0x7721('0xb0'),'updatedAt')[_0x7721('0x70')](_0x7721('0x97'))['where'](_0x7721('0x98'))[_0x7721('0x2b')](_0x7721('0x99'),_0x259eaa['CmListId']['toString']())[_0x7721('0x2b')]('phone\x20IS\x20NOT\x20NULL'))[_0x7721('0x78')]();_0x6766c6[_0x7721('0x77')](db['sequelize'][_0x7721('0x2d')](_0x469b6b));}return BPromise[_0x7721('0x7e')](_0x6766c6);}})['then'](function(){return _0x4b84b9;})[_0x7721('0x16')](respondWithResult(_0x5b157e,null))[_0x7721('0x30')](handleError(_0x5b157e,null));};exports[_0x7721('0xb1')]=function(_0x37da70,_0x54616a){return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0x37da70[_0x7721('0x31')]['id']}})['then'](handleEntityNotFound(_0x54616a,null))[_0x7721('0x16')](function(_0x174e79){if(_0x174e79){return _0x174e79['removeBlackLists'](_0x37da70[_0x7721('0x2d')]['ids']);}})[_0x7721('0x16')](function(_0x4c1b63){if(_0x4c1b63){return db[_0x7721('0x57')][_0x7721('0x17')]({'where':{'ListId':_0x37da70[_0x7721('0x2d')][_0x7721('0x81')],'VoiceQueueId':_0x37da70[_0x7721('0x31')]['id']}})['then'](function(){return _0x4c1b63;});}})[_0x7721('0x16')](respondWithStatusCode(_0x54616a,null))[_0x7721('0x30')](handleError(_0x54616a,null));}; \ No newline at end of file +var _0xf3cd=['CmHopperFinal','nolimit','getHopperBlacks','CmHopperBlack','getTeams','addTeams','User','online','flatMap','Agents','penalty','transaction','each','TeamVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','interface','SIP/%s','voicePause','forEach','emit','removeTeams','Team','ids','select','field','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','all','union','removeAgents','userVoiceQueue:remove','addAgents','spread','isEmpty','getAgents','getMembers','getLists','CmList','format','YYYY-MM-DD\x20HH:mm:ss','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','phone\x20NOT\x20IN\x20(?)','ListId\x20=\x20?','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','filter','map','value','includes','type','name','UserProfileResource','VoiceQueue','fieldName','key','where','include','query','findAll','rows','catch','params','keys','filters','intersection','attributes','model','fields','length','includeAll','options','find','create','body','user','role','outbound','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','merge','omit','updatedAt','createdAt','getHoppers','findOne','hasOwnProperty','order','sort','pick','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals'];(function(_0x53ccc2,_0x22bc3a){var _0x3a620d=function(_0x1d7ba1){while(--_0x1d7ba1){_0x53ccc2['push'](_0x53ccc2['shift']());}};_0x3a620d(++_0x22bc3a);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x1dd532,_0x36e81c){_0x1dd532=_0x1dd532-0x0;var _0x3732aa=_0xf3cd[_0x1dd532];return _0x3732aa;};'use strict';var moment=require(_0xdf3c('0x0'));var BPromise=require(_0xdf3c('0x1'));var util=require(_0xdf3c('0x2'));var _=require(_0xdf3c('0x3'));var squel=require(_0xdf3c('0x4'));var Redis=require(_0xdf3c('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0xdf3c('0x6'))(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var db=require('../../mysqldb')['db'];config[_0xdf3c('0x9')]=_[_0xdf3c('0xa')](config[_0xdf3c('0x9')],{'host':_0xdf3c('0xb'),'port':0x18eb});var socket=require(_0xdf3c('0xc'))(new Redis(config[_0xdf3c('0x9')]));require('./voiceQueue.socket')[_0xdf3c('0xd')](socket);function respondWithStatusCode(_0x52cf30,_0x52f855){_0x52f855=_0x52f855||0xcc;return function(_0x22d8ae){if(_0x22d8ae){return _0x52cf30[_0xdf3c('0xe')](_0x52f855);}return _0x52cf30['status'](_0x52f855)[_0xdf3c('0xf')]();};}function respondWithResult(_0x205f33,_0x2d420c){_0x2d420c=_0x2d420c||0xc8;return function(_0x21a6e5){if(_0x21a6e5){return _0x205f33[_0xdf3c('0x10')](_0x2d420c)[_0xdf3c('0x11')](_0x21a6e5);}};}function respondWithFilteredResult(_0xf7da9d,_0x32d2db){return function(_0x5e8925){if(_0x5e8925){var _0x1d483c=typeof _0x32d2db[_0xdf3c('0x12')]===_0xdf3c('0x13')&&typeof _0x32d2db[_0xdf3c('0x14')]==='undefined';var _0x2ae4ad=_0x5e8925[_0xdf3c('0x15')];var _0x13ea5f=_0x1d483c?0x0:_0x32d2db['offset'];var _0x18aafa=_0x1d483c?_0x5e8925[_0xdf3c('0x15')]:_0x32d2db[_0xdf3c('0x12')]+_0x32d2db[_0xdf3c('0x14')];var _0x21e587;if(_0x18aafa>=_0x2ae4ad){_0x18aafa=_0x2ae4ad;_0x21e587=0xc8;}else{_0x21e587=0xce;}_0xf7da9d[_0xdf3c('0x10')](_0x21e587);return _0xf7da9d[_0xdf3c('0x16')](_0xdf3c('0x17'),_0x13ea5f+'-'+_0x18aafa+'/'+_0x2ae4ad)[_0xdf3c('0x11')](_0x5e8925);}return null;};}function saveUpdates(_0x5d3991){return function(_0x54cdd4){if(_0x54cdd4){return _0x54cdd4[_0xdf3c('0x18')](_0x5d3991)[_0xdf3c('0x19')](function(_0xf1da1f){return _0xf1da1f;});}return null;};}function removeEntity(_0x18d4ec){return function(_0x1e2690){if(_0x1e2690){return _0x1e2690[_0xdf3c('0x1a')]()[_0xdf3c('0x19')](function(){var _0x3ee0af=_0x1e2690[_0xdf3c('0x1b')]({'plain':!![]});var _0x18fb5f=[{'name':_0xdf3c('0x1c'),'value':_0xdf3c('0x1d'),'ignore':![]},{'name':_0xdf3c('0x1e'),'value':'outbound','ignore':![]}];var _0x4d620f=_(_0x18fb5f)[_0xdf3c('0x1f')]('ignore')[_0xdf3c('0x20')](_0xdf3c('0x21'))[_0xdf3c('0x21')]();if(_[_0xdf3c('0x22')](_0x4d620f,_0x3ee0af[_0xdf3c('0x23')])){return;}var _0x36ba1c=_['find'](_0x18fb5f,[_0xdf3c('0x21'),_0x3ee0af[_0xdf3c('0x23')]])[_0xdf3c('0x24')];return db[_0xdf3c('0x25')][_0xdf3c('0x1a')]({'where':{'type':_0x36ba1c,'resourceId':_0x3ee0af['id']}})[_0xdf3c('0x19')](function(){return _0x1e2690;});})[_0xdf3c('0x19')](function(){_0x18d4ec[_0xdf3c('0x10')](0xcc)[_0xdf3c('0xf')]();});}};}function handleEntityNotFound(_0x1adee4){return function(_0x4c076c){if(!_0x4c076c){_0x1adee4[_0xdf3c('0xe')](0x194);}return _0x4c076c;};}function handleError(_0x153daa,_0x4b57a4){_0x4b57a4=_0x4b57a4||0x1f4;return function(_0xdc8962){logger['error'](_0xdc8962['stack']);if(_0xdc8962['name']){delete _0xdc8962[_0xdf3c('0x24')];}_0x153daa[_0xdf3c('0x10')](_0x4b57a4)['send'](_0xdc8962);};}exports['index']=function(_0x37ecfd,_0x1f2ce4){var _0xd3cfcb={};var _0x1ccdd4={'count':0x0,'rows':[]};var _0x5c98a2=_[_0xdf3c('0x20')](db[_0xdf3c('0x26')]['rawAttributes'],function(_0x51e0a4){return{'name':_0x51e0a4[_0xdf3c('0x27')],'type':_0x51e0a4[_0xdf3c('0x23')][_0xdf3c('0x28')]};});_0xd3cfcb=qs['getOptions'](_0x5c98a2,_0x37ecfd);var _0x2355f6={'where':_0xd3cfcb[_0xdf3c('0x29')]};return db[_0xdf3c('0x26')][_0xdf3c('0x15')](_0x2355f6)['then'](function(_0xda0de0){_0x1ccdd4[_0xdf3c('0x15')]=_0xda0de0;_0xd3cfcb['include']=qs[_0xdf3c('0x2a')](_0x37ecfd[_0xdf3c('0x2b')]);return db[_0xdf3c('0x26')][_0xdf3c('0x2c')](_0xd3cfcb);})['then'](function(_0x33632f){_0x1ccdd4[_0xdf3c('0x2d')]=_0x33632f;return _0x1ccdd4;})[_0xdf3c('0x19')](respondWithFilteredResult(_0x1f2ce4,_0xd3cfcb))[_0xdf3c('0x2e')](handleError(_0x1f2ce4,null));};exports['show']=function(_0x474564,_0x3e7a4b){var _0x5ddd21={'raw':![],'where':{'id':_0x474564[_0xdf3c('0x2f')]['id']}},_0x4f68f9={};_0x4f68f9['model']=_[_0xdf3c('0x30')](db['VoiceQueue']['rawAttributes']);_0x4f68f9['query']=_[_0xdf3c('0x30')](_0x474564[_0xdf3c('0x2b')]);_0x4f68f9[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x4f68f9['model'],_0x4f68f9['query']);_0x5ddd21[_0xdf3c('0x33')]=_['intersection'](_0x4f68f9[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x474564[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x5ddd21[_0xdf3c('0x33')]=_0x5ddd21[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x5ddd21[_0xdf3c('0x33')]:_0x4f68f9[_0xdf3c('0x34')];if(_0x474564['query'][_0xdf3c('0x37')]){_0x5ddd21['include']=[{'all':!![]}];}_0x5ddd21=_['merge']({},_0x5ddd21,_0x474564[_0xdf3c('0x38')]);return db['VoiceQueue'][_0xdf3c('0x39')](_0x5ddd21)['then'](handleEntityNotFound(_0x3e7a4b,null))[_0xdf3c('0x19')](respondWithResult(_0x3e7a4b,null))[_0xdf3c('0x2e')](handleError(_0x3e7a4b,null));};exports[_0xdf3c('0x3a')]=function(_0x1349a4,_0x3098cb){return db[_0xdf3c('0x26')][_0xdf3c('0x3a')](_0x1349a4[_0xdf3c('0x3b')],{})[_0xdf3c('0x19')](function(_0xa65478){var _0x424acf=_0x1349a4[_0xdf3c('0x3c')]['get']({'plain':!![]});if(!_0x424acf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x424acf[_0xdf3c('0x3d')]==='user'){var _0x3a6527=_0xa65478[_0xdf3c('0x1b')]({'plain':!![]});var _0x46194d=[{'name':_0xdf3c('0x1c'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xdf3c('0x3e')}];var _0x33edab=_[_0xdf3c('0x39')](_0x46194d,['value',_0x3a6527[_0xdf3c('0x23')]])[_0xdf3c('0x24')];return db[_0xdf3c('0x3f')][_0xdf3c('0x39')]({'where':{'name':_0x33edab,'userProfileId':_0x424acf['userProfileId']},'raw':!![]})[_0xdf3c('0x19')](function(_0x3e9be9){if(_0x3e9be9&&_0x3e9be9[_0xdf3c('0x40')]===0x0){return db[_0xdf3c('0x25')][_0xdf3c('0x3a')]({'name':_0x3a6527['name'],'resourceId':_0x3a6527['id'],'type':_0x3e9be9[_0xdf3c('0x24')],'sectionId':_0x3e9be9['id']},{})[_0xdf3c('0x19')](function(){return _0xa65478;});}else{return _0xa65478;}})[_0xdf3c('0x2e')](function(_0x2456cf){logger[_0xdf3c('0x41')](_0xdf3c('0x42'),_0x2456cf);throw _0x2456cf;});}return _0xa65478;})['then'](respondWithResult(_0x3098cb,0xc9))['catch'](handleError(_0x3098cb,null));};exports[_0xdf3c('0x43')]=function(_0x2be86d,_0x5a4443){var _0x5c9885={'where':{'id':_0x2be86d[_0xdf3c('0x2f')]['id']}},_0x269723={};_0x269723[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db[_0xdf3c('0x26')][_0xdf3c('0x44')]);_0x5c9885[_0xdf3c('0x33')]=_[_0xdf3c('0x32')](_0x269723[_0xdf3c('0x34')],qs['fields'](_0x2be86d[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x5c9885[_0xdf3c('0x33')]=_0x5c9885[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x5c9885[_0xdf3c('0x33')]:_0x269723[_0xdf3c('0x34')];if(_0x2be86d['query'][_0xdf3c('0x37')]){_0x5c9885['include']=[{'all':!![]}];}_0x5c9885=_[_0xdf3c('0x45')]({},_0x5c9885,_0x2be86d['options']);return db[_0xdf3c('0x26')][_0xdf3c('0x39')](_0x5c9885)[_0xdf3c('0x19')](handleEntityNotFound(_0x5a4443,null))[_0xdf3c('0x19')](function(_0x5eef94){if(_0x5eef94){var _0x55da0f=_0x5eef94['get']({'plain':!![]});_0x55da0f=qs[_0xdf3c('0x46')](_0x55da0f,['id','createdAt',_0xdf3c('0x47')]);_0x2be86d[_0xdf3c('0x3b')]=_[_0xdf3c('0x46')](_0x2be86d[_0xdf3c('0x3b')],['id',_0xdf3c('0x48'),'updatedAt']);return db['VoiceQueue'][_0xdf3c('0x3a')](_[_0xdf3c('0x45')](_0x55da0f,_0x2be86d['body']),{'include':_0x2be86d[_0xdf3c('0x2b')][_0xdf3c('0x37')]?[{'all':!![]}]:undefined})[_0xdf3c('0x19')](function(_0x3fda0a){var _0x38de63=_0x2be86d[_0xdf3c('0x3c')][_0xdf3c('0x1b')]({'plain':!![]});if(!_0x38de63)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38de63['role']===_0xdf3c('0x3c')){var _0x28030e=_0x3fda0a[_0xdf3c('0x1b')]({'plain':!![]});var _0x1ad771=[{'name':_0xdf3c('0x1c'),'value':_0xdf3c('0x1d')},{'name':_0xdf3c('0x1e'),'value':_0xdf3c('0x3e')}];var _0x143d01=_[_0xdf3c('0x39')](_0x1ad771,[_0xdf3c('0x21'),_0x28030e['type']])[_0xdf3c('0x24')];return db['UserProfileSection']['find']({'where':{'name':_0x143d01,'userProfileId':_0x38de63['userProfileId']},'raw':!![]})['then'](function(_0x541c57){if(_0x541c57&&_0x541c57[_0xdf3c('0x40')]===0x0){return db[_0xdf3c('0x25')]['create']({'name':_0x28030e[_0xdf3c('0x24')],'resourceId':_0x28030e['id'],'type':_0x541c57[_0xdf3c('0x24')],'sectionId':_0x541c57['id']},{})['then'](function(){return _0x3fda0a;});}else{return _0x3fda0a;}})[_0xdf3c('0x2e')](function(_0x28f935){logger[_0xdf3c('0x41')](_0xdf3c('0x42'),_0x28f935);throw _0x28f935;});}return _0x3fda0a;});}})[_0xdf3c('0x19')](respondWithResult(_0x5a4443,0xc9))[_0xdf3c('0x2e')](handleError(_0x5a4443,null));};exports[_0xdf3c('0x18')]=function(_0xdc859,_0x42efa2){if(_0xdc859[_0xdf3c('0x3b')]['id']){delete _0xdc859[_0xdf3c('0x3b')]['id'];}return db['VoiceQueue'][_0xdf3c('0x39')]({'where':{'id':_0xdc859[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x42efa2,null))['then'](saveUpdates(_0xdc859[_0xdf3c('0x3b')],null))[_0xdf3c('0x19')](respondWithResult(_0x42efa2,null))[_0xdf3c('0x2e')](handleError(_0x42efa2,null));};exports['destroy']=function(_0x1effdb,_0x13bf69){return db['VoiceQueue'][_0xdf3c('0x39')]({'where':{'id':_0x1effdb['params']['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x13bf69,null))[_0xdf3c('0x19')](removeEntity(_0x13bf69,null))[_0xdf3c('0x2e')](handleError(_0x13bf69,null));};exports[_0xdf3c('0x49')]=function(_0xed2a78,_0x30e6e1){var _0x3fca95={'raw':![],'where':{}};var _0x2a1559={};var _0x2922d8={'count':0x0,'rows':[]};return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0xed2a78[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x30e6e1,null))[_0xdf3c('0x19')](function(_0x204110){if(_0x204110){_0x2a1559[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db['CmHopper']['rawAttributes']);_0x2a1559[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0xed2a78[_0xdf3c('0x2b')]);_0x2a1559['filters']=_[_0xdf3c('0x32')](_0x2a1559['model'],_0x2a1559['query']);_0x3fca95[_0xdf3c('0x33')]=_[_0xdf3c('0x32')](_0x2a1559[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x3fca95[_0xdf3c('0x33')]=_0x3fca95[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x3fca95[_0xdf3c('0x33')]:_0x2a1559[_0xdf3c('0x34')];if(!_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x4b')]('nolimit')){_0x3fca95[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x14')]);_0x3fca95[_0xdf3c('0x12')]=qs['offset'](_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}_0x3fca95[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x4d')]);_0x3fca95[_0xdf3c('0x29')]=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0xed2a78[_0xdf3c('0x2b')],_0x2a1559['filters']));_0x3fca95[_0xdf3c('0x29')][_0xdf3c('0x4f')]=_0x204110['id'];if(_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x1f')]){_0x3fca95[_0xdf3c('0x29')]=_[_0xdf3c('0x45')](_0x3fca95[_0xdf3c('0x29')],{'$or':_['map'](_0x3fca95[_0xdf3c('0x33')],function(_0x662fd5){var _0x4e1b77={};_0x4e1b77[_0x662fd5]={'$like':'%'+_0xed2a78['query'][_0xdf3c('0x1f')]+'%'};return _0x4e1b77;})});}_0x3fca95=_[_0xdf3c('0x45')]({},_0x3fca95,_0xed2a78[_0xdf3c('0x38')]);return db[_0xdf3c('0x50')][_0xdf3c('0x15')]({'where':_0x3fca95[_0xdf3c('0x29')]})[_0xdf3c('0x19')](function(_0x38af90){_0x2922d8['count']=_0x38af90;if(_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x37')]){_0x3fca95[_0xdf3c('0x2a')]=[{'all':!![]}];}return db['CmHopper'][_0xdf3c('0x2c')](_0x3fca95);})[_0xdf3c('0x19')](function(_0x43d299){_0x2922d8['rows']=_0x43d299;return _0x2922d8;});}})[_0xdf3c('0x19')](respondWithFilteredResult(_0x30e6e1,_0x3fca95))[_0xdf3c('0x2e')](handleError(_0x30e6e1,null));};exports[_0xdf3c('0x51')]=function(_0x1b279f,_0xe01538){var _0x12f737={'raw':!![],'where':{}};var _0x560348={};var _0x50753f={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x1b279f['params']['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0xe01538,null))[_0xdf3c('0x19')](function(_0xf66fae){if(_0xf66fae){_0x560348['model']=_[_0xdf3c('0x30')](db[_0xdf3c('0x52')][_0xdf3c('0x44')]);_0x560348['query']=_['keys'](_0x1b279f[_0xdf3c('0x2b')]);_0x560348['filters']=_[_0xdf3c('0x32')](_0x560348['model'],_0x560348[_0xdf3c('0x2b')]);_0x12f737[_0xdf3c('0x33')]=_[_0xdf3c('0x32')](_0x560348[_0xdf3c('0x34')],qs['fields'](_0x1b279f['query'][_0xdf3c('0x35')]));_0x12f737[_0xdf3c('0x33')]=_0x12f737[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x12f737[_0xdf3c('0x33')]:_0x560348[_0xdf3c('0x34')];if(!_0x1b279f['query'][_0xdf3c('0x4b')]('nolimit')){_0x12f737[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0x1b279f[_0xdf3c('0x2b')][_0xdf3c('0x14')]);_0x12f737[_0xdf3c('0x12')]=qs['offset'](_0x1b279f[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}_0x12f737[_0xdf3c('0x4c')]=qs['sort'](_0x1b279f['query']['sort']);_0x12f737['where']=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0x1b279f[_0xdf3c('0x2b')],_0x560348[_0xdf3c('0x31')]));_0x12f737[_0xdf3c('0x29')][_0xdf3c('0x4f')]=_0xf66fae['id'];if(_0x1b279f['query'][_0xdf3c('0x1f')]){_0x12f737['where']=_[_0xdf3c('0x45')](_0x12f737[_0xdf3c('0x29')],{'$or':_[_0xdf3c('0x20')](_0x12f737[_0xdf3c('0x33')],function(_0x320452){var _0x3a221d={};_0x3a221d[_0x320452]={'$like':'%'+_0x1b279f[_0xdf3c('0x2b')][_0xdf3c('0x1f')]+'%'};return _0x3a221d;})});}_0x12f737=_[_0xdf3c('0x45')]({},_0x12f737,_0x1b279f[_0xdf3c('0x38')]);return db[_0xdf3c('0x52')][_0xdf3c('0x15')]({'where':_0x12f737[_0xdf3c('0x29')]})[_0xdf3c('0x19')](function(_0x55fd73){_0x50753f[_0xdf3c('0x15')]=_0x55fd73;if(_0x1b279f[_0xdf3c('0x2b')][_0xdf3c('0x37')]){_0x12f737[_0xdf3c('0x2a')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xdf3c('0x2c')](_0x12f737);})[_0xdf3c('0x19')](function(_0x54b7b8){_0x50753f['rows']=_0x54b7b8;return _0x50753f;});}})[_0xdf3c('0x19')](respondWithFilteredResult(_0xe01538,_0x12f737))[_0xdf3c('0x2e')](handleError(_0xe01538,null));};exports[_0xdf3c('0x53')]=function(_0x1aaf8b,_0x44dd2a){var _0x56fc77={'raw':!![],'where':{}};var _0x50105b={};var _0x471d8f={'count':0x0,'rows':[]};return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0x1aaf8b[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x44dd2a,null))['then'](function(_0x30235e){if(_0x30235e){_0x50105b[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db[_0xdf3c('0x54')][_0xdf3c('0x44')]);_0x50105b['query']=_['keys'](_0x1aaf8b['query']);_0x50105b[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x50105b[_0xdf3c('0x34')],_0x50105b[_0xdf3c('0x2b')]);_0x56fc77[_0xdf3c('0x33')]=_[_0xdf3c('0x32')](_0x50105b[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x1aaf8b['query'][_0xdf3c('0x35')]));_0x56fc77[_0xdf3c('0x33')]=_0x56fc77[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x56fc77[_0xdf3c('0x33')]:_0x50105b[_0xdf3c('0x34')];if(!_0x1aaf8b['query'][_0xdf3c('0x4b')](_0xdf3c('0x55'))){_0x56fc77['limit']=qs['limit'](_0x1aaf8b[_0xdf3c('0x2b')]['limit']);_0x56fc77[_0xdf3c('0x12')]=qs[_0xdf3c('0x12')](_0x1aaf8b['query'][_0xdf3c('0x12')]);}_0x56fc77[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_0x1aaf8b[_0xdf3c('0x2b')][_0xdf3c('0x4d')]);_0x56fc77[_0xdf3c('0x29')]=qs['filters'](_[_0xdf3c('0x4e')](_0x1aaf8b[_0xdf3c('0x2b')],_0x50105b[_0xdf3c('0x31')]));_0x56fc77[_0xdf3c('0x29')][_0xdf3c('0x4f')]=_0x30235e['id'];if(_0x1aaf8b[_0xdf3c('0x2b')][_0xdf3c('0x1f')]){_0x56fc77['where']=_['merge'](_0x56fc77[_0xdf3c('0x29')],{'$or':_[_0xdf3c('0x20')](_0x56fc77[_0xdf3c('0x33')],function(_0x5b6419){var _0x38c374={};_0x38c374[_0x5b6419]={'$like':'%'+_0x1aaf8b['query']['filter']+'%'};return _0x38c374;})});}_0x56fc77=_[_0xdf3c('0x45')]({},_0x56fc77,_0x1aaf8b[_0xdf3c('0x38')]);return db['CmHopperFinal'][_0xdf3c('0x15')]({'where':_0x56fc77['where']})[_0xdf3c('0x19')](function(_0x4b35ff){_0x471d8f[_0xdf3c('0x15')]=_0x4b35ff;if(_0x1aaf8b[_0xdf3c('0x2b')][_0xdf3c('0x37')]){_0x56fc77[_0xdf3c('0x2a')]=[{'all':!![]}];}return db[_0xdf3c('0x54')][_0xdf3c('0x2c')](_0x56fc77);})[_0xdf3c('0x19')](function(_0x2dc0d2){_0x471d8f[_0xdf3c('0x2d')]=_0x2dc0d2;return _0x471d8f;});}})[_0xdf3c('0x19')](respondWithFilteredResult(_0x44dd2a,_0x56fc77))[_0xdf3c('0x2e')](handleError(_0x44dd2a,null));};exports[_0xdf3c('0x56')]=function(_0x10528d,_0x1acc47){var _0x5b3aa5={'raw':!![],'where':{}};var _0x3cf465={};var _0x22bacf={'count':0x0,'rows':[]};return db[_0xdf3c('0x26')]['findOne']({'where':{'id':_0x10528d[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x1acc47,null))[_0xdf3c('0x19')](function(_0x6e1899){if(_0x6e1899){_0x3cf465[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db[_0xdf3c('0x57')][_0xdf3c('0x44')]);_0x3cf465[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0x10528d[_0xdf3c('0x2b')]);_0x3cf465['filters']=_[_0xdf3c('0x32')](_0x3cf465[_0xdf3c('0x34')],_0x3cf465[_0xdf3c('0x2b')]);_0x5b3aa5[_0xdf3c('0x33')]=_[_0xdf3c('0x32')](_0x3cf465[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x10528d[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x5b3aa5[_0xdf3c('0x33')]=_0x5b3aa5[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x5b3aa5['attributes']:_0x3cf465[_0xdf3c('0x34')];if(!_0x10528d[_0xdf3c('0x2b')][_0xdf3c('0x4b')](_0xdf3c('0x55'))){_0x5b3aa5[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0x10528d[_0xdf3c('0x2b')]['limit']);_0x5b3aa5[_0xdf3c('0x12')]=qs[_0xdf3c('0x12')](_0x10528d[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}_0x5b3aa5['order']=qs[_0xdf3c('0x4d')](_0x10528d[_0xdf3c('0x2b')]['sort']);_0x5b3aa5[_0xdf3c('0x29')]=qs['filters'](_[_0xdf3c('0x4e')](_0x10528d[_0xdf3c('0x2b')],_0x3cf465['filters']));_0x5b3aa5[_0xdf3c('0x29')][_0xdf3c('0x4f')]=_0x6e1899['id'];if(_0x10528d[_0xdf3c('0x2b')]['filter']){_0x5b3aa5['where']=_[_0xdf3c('0x45')](_0x5b3aa5['where'],{'$or':_[_0xdf3c('0x20')](_0x5b3aa5[_0xdf3c('0x33')],function(_0x161604){var _0x91dd6e={};_0x91dd6e[_0x161604]={'$like':'%'+_0x10528d['query'][_0xdf3c('0x1f')]+'%'};return _0x91dd6e;})});}_0x5b3aa5=_[_0xdf3c('0x45')]({},_0x5b3aa5,_0x10528d['options']);return db[_0xdf3c('0x57')]['count']({'where':_0x5b3aa5[_0xdf3c('0x29')]})[_0xdf3c('0x19')](function(_0x5429b6){_0x22bacf['count']=_0x5429b6;if(_0x10528d[_0xdf3c('0x2b')]['includeAll']){_0x5b3aa5[_0xdf3c('0x2a')]=[{'all':!![]}];}return db[_0xdf3c('0x57')][_0xdf3c('0x2c')](_0x5b3aa5);})[_0xdf3c('0x19')](function(_0x19a723){_0x22bacf[_0xdf3c('0x2d')]=_0x19a723;return _0x22bacf;});}})[_0xdf3c('0x19')](respondWithFilteredResult(_0x1acc47,_0x5b3aa5))[_0xdf3c('0x2e')](handleError(_0x1acc47,null));};exports[_0xdf3c('0x58')]=function(_0x3d8ff0,_0x2a2f03){var _0x55975e={};var _0x4299d1={};var _0x132c27;var _0x52a641;return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0x3d8ff0[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x2a2f03,null))[_0xdf3c('0x19')](function(_0x12576e){if(_0x12576e){_0x132c27=_0x12576e;_0x4299d1['model']=_[_0xdf3c('0x30')](db['Team'][_0xdf3c('0x44')]);_0x4299d1[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0x3d8ff0[_0xdf3c('0x2b')]);_0x4299d1[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x4299d1['model'],_0x4299d1[_0xdf3c('0x2b')]);_0x55975e[_0xdf3c('0x33')]=_['intersection'](_0x4299d1[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x3d8ff0[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x55975e[_0xdf3c('0x33')]=_0x55975e[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x55975e[_0xdf3c('0x33')]:_0x4299d1['model'];_0x55975e['order']=qs[_0xdf3c('0x4d')](_0x3d8ff0[_0xdf3c('0x2b')][_0xdf3c('0x4d')]);_0x55975e[_0xdf3c('0x29')]=qs['filters'](_['pick'](_0x3d8ff0[_0xdf3c('0x2b')],_0x4299d1['filters']));if(_0x3d8ff0[_0xdf3c('0x2b')]['filter']){_0x55975e[_0xdf3c('0x29')]=_[_0xdf3c('0x45')](_0x55975e[_0xdf3c('0x29')],{'$or':_['map'](_0x55975e[_0xdf3c('0x33')],function(_0x142cd0){var _0x5bf9a9={};_0x5bf9a9[_0x142cd0]={'$like':'%'+_0x3d8ff0['query'][_0xdf3c('0x1f')]+'%'};return _0x5bf9a9;})});}_0x55975e=_[_0xdf3c('0x45')]({},_0x55975e,_0x3d8ff0[_0xdf3c('0x38')]);return _0x132c27[_0xdf3c('0x58')](_0x55975e);}})[_0xdf3c('0x19')](function(_0x294682){if(_0x294682){_0x52a641=_0x294682[_0xdf3c('0x36')];if(!_0x3d8ff0['query']['hasOwnProperty'](_0xdf3c('0x55'))){_0x55975e[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0x3d8ff0[_0xdf3c('0x2b')][_0xdf3c('0x14')]);_0x55975e[_0xdf3c('0x12')]=qs[_0xdf3c('0x12')](_0x3d8ff0[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}return _0x132c27[_0xdf3c('0x58')](_0x55975e);}})[_0xdf3c('0x19')](function(_0x322cf5){if(_0x322cf5){return _0x322cf5?{'count':_0x52a641,'rows':_0x322cf5}:null;}})[_0xdf3c('0x19')](respondWithResult(_0x2a2f03,null))[_0xdf3c('0x2e')](handleError(_0x2a2f03,null));};exports[_0xdf3c('0x59')]=function(_0x199ff0,_0x244bf0){var _0x1a0d61=_0x199ff0[_0xdf3c('0x3b')]['teams'];var _0x4c6615=_[_0xdf3c('0x20')](_0x1a0d61,'id');return db['Team']['findAll']({'where':{'id':_0x4c6615},'attributes':['id'],'include':[{'model':db[_0xdf3c('0x5a')],'as':'Agents','attributes':['id',_0xdf3c('0x24'),_0xdf3c('0x5b'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x1c7b50){if(_0x1c7b50){var _0x3e0a0f=_[_0xdf3c('0x5c')](_0x1c7b50,function(_0x4d5216){var _0x197b8a=_0x4d5216['get']({'plain':!![]});_0x197b8a[_0xdf3c('0x5d')]['forEach'](function(_0x5b0101){_0x5b0101[_0xdf3c('0x5e')]=_[_0xdf3c('0x39')](_0x1a0d61,{'id':_0x197b8a['id']})[_0xdf3c('0x5e')];});return _0x197b8a[_0xdf3c('0x5d')];});return db[_0xdf3c('0x26')][_0xdf3c('0x39')]({'where':{'id':_0x199ff0['params']['id']}})['then'](function(_0x128a4e){return db['sequelize'][_0xdf3c('0x5f')](function(_0x14244a){return _0x128a4e[_0xdf3c('0x59')](_0x4c6615,{'transaction':_0x14244a})[_0xdf3c('0x19')](function(){return BPromise[_0xdf3c('0x60')](_0x1a0d61,function(_0x619c66){return db[_0xdf3c('0x61')]['upsert']({'TeamId':_0x619c66['id'],'VoiceQueueId':_0x199ff0['params']['id'],'penalty':_0x619c66[_0xdf3c('0x5e')]},{'transaction':_0x14244a});});})[_0xdf3c('0x19')](function(){return BPromise[_0xdf3c('0x60')](_0x3e0a0f,function(_0x13a882){return db['UserVoiceQueue'][_0xdf3c('0x62')]({'where':{'UserId':_0x13a882['id'],'VoiceQueueId':_0x199ff0[_0xdf3c('0x2f')]['id']},'defaults':{'penalty':_0x13a882[_0xdf3c('0x5e')]},'transaction':_0x14244a});});})[_0xdf3c('0x19')](function(){return BPromise[_0xdf3c('0x60')](_[_0xdf3c('0x1f')](_0x3e0a0f,{'online':!![]}),function(_0x524482){return db[_0xdf3c('0x63')][_0xdf3c('0x64')]({'membername':_0x524482['name'],'UserId':_0x524482['id'],'queue_name':_0x128a4e[_0xdf3c('0x24')],'VoiceQueueId':_0x128a4e['id'],'interface':_[_0xdf3c('0x65')](_0x524482[_0xdf3c('0x66')])?util['format'](_0xdf3c('0x67'),_0x524482[_0xdf3c('0x24')]):_0x524482[_0xdf3c('0x66')],'paused':_0x524482[_0xdf3c('0x68')]||![],'penalty':_0x524482[_0xdf3c('0x5e')]},{'transaction':_0x14244a});});})[_0xdf3c('0x19')](function(){_0x3e0a0f[_0xdf3c('0x69')](function(_0x12ffd3){socket[_0xdf3c('0x6a')]('userVoiceQueue:save',{'UserId':_0x12ffd3['id'],'VoiceQueueId':_0x128a4e['id']});});});});});}})[_0xdf3c('0x19')](respondWithStatusCode(_0x244bf0,null))['catch'](handleError(_0x244bf0,null));};exports[_0xdf3c('0x6b')]=function(_0x160568,_0xfcf42f){return db[_0xdf3c('0x6c')][_0xdf3c('0x2c')]({'where':{'id':_0x160568[_0xdf3c('0x2b')][_0xdf3c('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xdf3c('0x5a')],'as':_0xdf3c('0x5d'),'attributes':['id'],'raw':!![]}]})[_0xdf3c('0x19')](handleEntityNotFound(_0xfcf42f,null))[_0xdf3c('0x19')](function(_0x5f09a0){var _0x379996=_[_0xdf3c('0x20')](_0x5f09a0,'id');var _0x5f1b51=[];var _0x323058=[];var _0x8fd9e4=squel[_0xdf3c('0x6e')]();_0x8fd9e4[_0xdf3c('0x6f')]('tq.TeamId')[_0xdf3c('0x70')](_0xdf3c('0x71'),'tq')[_0xdf3c('0x72')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xdf3c('0x73'),_0x160568[_0xdf3c('0x2f')]['id']);for(var _0x403ac5=0x0;_0x403ac5<_0x5f09a0[_0xdf3c('0x36')];_0x403ac5+=0x1){let _0x44d862=_0x5f09a0[_0x403ac5];for(var _0x33132b=0x0;_0x33132b<_0x44d862[_0xdf3c('0x5d')][_0xdf3c('0x36')];_0x33132b+=0x1){let _0x49c29e=_0x44d862[_0xdf3c('0x5d')][_0x33132b];var _0x5e868a=_0x8fd9e4[_0xdf3c('0x43')]();_0x5e868a[_0xdf3c('0x29')](_0xdf3c('0x74'),_0x49c29e['id']);_0x323058[_0xdf3c('0x75')](db[_0xdf3c('0x76')][_0xdf3c('0x2b')](_0x5e868a['toString'](),{'type':db[_0xdf3c('0x76')][_0xdf3c('0x77')]['SELECT']})[_0xdf3c('0x19')](function(_0x270353){if(_0x270353[_0xdf3c('0x36')]===0x1){return _0x49c29e['id'];}else{var _0x3f6df9=_['every'](_[_0xdf3c('0x20')](_0x270353,'TeamId'),function(_0x7d9a0f){return _[_0xdf3c('0x22')](_0x379996,_0x7d9a0f);});if(_0x3f6df9){return _0x49c29e['id'];}}}));}}return BPromise[_0xdf3c('0x78')](_0x323058)[_0xdf3c('0x19')](function(_0x17669f){_0x5f1b51=_(_0x5f1b51)[_0xdf3c('0x79')](_0x17669f)['compact']()['value']();return db['VoiceQueue'][_0xdf3c('0x39')]({'where':{'id':_0x160568[_0xdf3c('0x2f')]['id']}})['then'](function(_0x528c97){return db[_0xdf3c('0x76')]['transaction'](function(_0x58a2d8){return _0x528c97['removeTeams'](_0x160568[_0xdf3c('0x2b')][_0xdf3c('0x6d')],{'transaction':_0x58a2d8})[_0xdf3c('0x19')](function(){if(!_['isEmpty'](_0x5f1b51)){return _0x528c97[_0xdf3c('0x7a')](_0x5f1b51,{'transaction':_0x58a2d8})['then'](function(){return db[_0xdf3c('0x63')][_0xdf3c('0x1a')]({'where':{'VoiceQueueId':_0x160568[_0xdf3c('0x2f')]['id'],'UserId':_0x5f1b51},'transaction':_0x58a2d8});});}})[_0xdf3c('0x19')](function(){_0x5f1b51[_0xdf3c('0x69')](function(_0x467090){socket[_0xdf3c('0x6a')](_0xdf3c('0x7b'),{'UserId':_0x467090,'VoiceQueueId':_0x528c97['id']});});});});});});})[_0xdf3c('0x19')](respondWithStatusCode(_0xfcf42f,null))['catch'](handleError(_0xfcf42f,null));};exports[_0xdf3c('0x7c')]=function(_0x4652af,_0x5e08bc){var _0x2702ca,_0x1e8646;return db['VoiceQueue'][_0xdf3c('0x39')]({'where':{'id':_0x4652af['params']['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x5e08bc,null))[_0xdf3c('0x19')](function(_0x3ea47d){if(_0x3ea47d){_0x1e8646=_0x3ea47d;return _0x3ea47d[_0xdf3c('0x7c')](_0x4652af[_0xdf3c('0x3b')][_0xdf3c('0x6d')],_[_0xdf3c('0x46')](_0x4652af[_0xdf3c('0x3b')],[_0xdf3c('0x6d'),'id'])||{})[_0xdf3c('0x7d')](function(_0xfdb4e2){for(var _0x1c31ee=0x0;_0x1c31ee<_0x4652af[_0xdf3c('0x3b')][_0xdf3c('0x6d')][_0xdf3c('0x36')];_0x1c31ee+=0x1){socket[_0xdf3c('0x6a')]('userVoiceQueue:save',{'UserId':Number(_0x4652af[_0xdf3c('0x3b')][_0xdf3c('0x6d')][_0x1c31ee]),'VoiceQueueId':Number(_0x4652af['params']['id'])});}return _0xfdb4e2;});}})[_0xdf3c('0x19')](function(_0xf39067){_0x2702ca=_0xf39067||[];if(_0x1e8646){return db[_0xdf3c('0x5a')][_0xdf3c('0x2c')]({'where':{'id':_0x4652af['body'][_0xdf3c('0x6d')]},'attributes':['id',_0xdf3c('0x24'),'online',_0xdf3c('0x68'),_0xdf3c('0x66')],'raw':!![]});}})['then'](function(_0x59c8f9){if(!_[_0xdf3c('0x7e')](_0x59c8f9)){var _0x388f8d=[];for(var _0x1c4964=0x0;_0x1c4964<_0x59c8f9['length'];_0x1c4964++){if(_0x59c8f9[_0x1c4964][_0xdf3c('0x5b')]){_0x388f8d['push'](db[_0xdf3c('0x63')][_0xdf3c('0x64')]({'membername':_0x59c8f9[_0x1c4964][_0xdf3c('0x24')],'UserId':_0x59c8f9[_0x1c4964]['id'],'queue_name':_0x1e8646[_0xdf3c('0x24')],'VoiceQueueId':_0x1e8646['id'],'interface':_[_0xdf3c('0x65')](_0x59c8f9[_0x1c4964][_0xdf3c('0x66')])?util['format'](_0xdf3c('0x67'),_0x59c8f9[_0x1c4964]['name']):_0x59c8f9[_0x1c4964][_0xdf3c('0x66')],'paused':_0x59c8f9[_0x1c4964][_0xdf3c('0x68')]||![],'penalty':_0x4652af[_0xdf3c('0x3b')]['penalty']||0x0}));}}return BPromise[_0xdf3c('0x78')](_0x388f8d);}})['then'](function(){return _0x2702ca;})[_0xdf3c('0x19')](respondWithResult(_0x5e08bc,null))[_0xdf3c('0x2e')](handleError(_0x5e08bc,null));};exports['removeAgents']=function(_0x153bce,_0x4185f0){return db[_0xdf3c('0x26')][_0xdf3c('0x39')]({'where':{'id':_0x153bce['params']['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x4185f0,null))[_0xdf3c('0x19')](function(_0xa61c3f){if(_0xa61c3f){return _0xa61c3f[_0xdf3c('0x7a')](_0x153bce[_0xdf3c('0x2b')][_0xdf3c('0x6d')])[_0xdf3c('0x19')](function(){if(_['isArray'](_0x153bce[_0xdf3c('0x2b')][_0xdf3c('0x6d')])){for(var _0x26251d=0x0;_0x26251d<_0x153bce[_0xdf3c('0x2b')][_0xdf3c('0x6d')][_0xdf3c('0x36')];_0x26251d+=0x1){socket[_0xdf3c('0x6a')](_0xdf3c('0x7b'),{'UserId':Number(_0x153bce[_0xdf3c('0x2b')][_0xdf3c('0x6d')][_0x26251d]),'VoiceQueueId':Number(_0x153bce[_0xdf3c('0x2f')]['id'])});}}else{socket['emit'](_0xdf3c('0x7b'),{'UserId':Number(_0x153bce[_0xdf3c('0x2b')][_0xdf3c('0x6d')]),'VoiceQueueId':Number(_0x153bce['params']['id'])});}});}})[_0xdf3c('0x19')](function(_0x109153){return db[_0xdf3c('0x63')][_0xdf3c('0x1a')]({'where':{'VoiceQueueId':_0x153bce[_0xdf3c('0x2f')]['id'],'UserId':_0x153bce['query'][_0xdf3c('0x6d')]}})[_0xdf3c('0x19')](function(){return _0x109153;});})['then'](respondWithStatusCode(_0x4185f0,null))[_0xdf3c('0x2e')](handleError(_0x4185f0,null));};exports[_0xdf3c('0x7f')]=function(_0x38c6f3,_0xb39cc){var _0xcc2f18={};var _0x13ee9b={};var _0x8d7c0c;var _0x3d9041;return db[_0xdf3c('0x26')]['findOne']({'where':{'id':_0x38c6f3[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0xb39cc,null))['then'](function(_0x39bc51){if(_0x39bc51){_0x8d7c0c=_0x39bc51;_0x13ee9b[_0xdf3c('0x34')]=_['keys'](db['User'][_0xdf3c('0x44')]);_0x13ee9b[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0x38c6f3[_0xdf3c('0x2b')]);_0x13ee9b[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x13ee9b[_0xdf3c('0x34')],_0x13ee9b[_0xdf3c('0x2b')]);_0xcc2f18['attributes']=_[_0xdf3c('0x32')](_0x13ee9b[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x38c6f3[_0xdf3c('0x2b')]['fields']));_0xcc2f18[_0xdf3c('0x33')]=_0xcc2f18[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0xcc2f18[_0xdf3c('0x33')]:_0x13ee9b['model'];_0xcc2f18[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_0x38c6f3[_0xdf3c('0x2b')]['sort']);_0xcc2f18['where']=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0x38c6f3[_0xdf3c('0x2b')],_0x13ee9b['filters']));if(_0x38c6f3[_0xdf3c('0x2b')][_0xdf3c('0x1f')]){_0xcc2f18[_0xdf3c('0x29')]=_[_0xdf3c('0x45')](_0xcc2f18[_0xdf3c('0x29')],{'$or':_['map'](_0xcc2f18['attributes'],function(_0x1cd1a7){var _0x48141c={};_0x48141c[_0x1cd1a7]={'$like':'%'+_0x38c6f3[_0xdf3c('0x2b')][_0xdf3c('0x1f')]+'%'};return _0x48141c;})});}_0xcc2f18=_[_0xdf3c('0x45')]({},_0xcc2f18,_0x38c6f3[_0xdf3c('0x38')]);return _0x8d7c0c[_0xdf3c('0x7f')](_0xcc2f18);}})[_0xdf3c('0x19')](function(_0x5a56b5){if(_0x5a56b5){_0x3d9041=_0x5a56b5[_0xdf3c('0x36')];if(!_0x38c6f3[_0xdf3c('0x2b')][_0xdf3c('0x4b')](_0xdf3c('0x55'))){_0xcc2f18['limit']=qs[_0xdf3c('0x14')](_0x38c6f3[_0xdf3c('0x2b')][_0xdf3c('0x14')]);_0xcc2f18['offset']=qs['offset'](_0x38c6f3[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}return _0x8d7c0c['getAgents'](_0xcc2f18);}})[_0xdf3c('0x19')](function(_0x5eebe3){if(_0x5eebe3){return _0x5eebe3?{'count':_0x3d9041,'rows':_0x5eebe3}:null;}})[_0xdf3c('0x19')](respondWithResult(_0xb39cc,null))[_0xdf3c('0x2e')](handleError(_0xb39cc,null));};exports[_0xdf3c('0x80')]=function(_0x1961cd,_0x30659d){var _0x27f25a={};var _0x5e5dad={};var _0x19ce27;var _0x2c24b7;return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0x1961cd[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x30659d,null))[_0xdf3c('0x19')](function(_0x1dee13){if(_0x1dee13){_0x19ce27=_0x1dee13;_0x5e5dad[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db[_0xdf3c('0x63')]['rawAttributes']);_0x5e5dad[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0x1961cd['query']);_0x5e5dad[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x5e5dad[_0xdf3c('0x34')],_0x5e5dad[_0xdf3c('0x2b')]);_0x27f25a[_0xdf3c('0x33')]=_['intersection'](_0x5e5dad[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x1961cd[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x27f25a[_0xdf3c('0x33')]=_0x27f25a[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x27f25a[_0xdf3c('0x33')]:_0x5e5dad[_0xdf3c('0x34')];_0x27f25a[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_0x1961cd[_0xdf3c('0x2b')][_0xdf3c('0x4d')]);_0x27f25a['where']=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0x1961cd['query'],_0x5e5dad[_0xdf3c('0x31')]));if(_0x1961cd[_0xdf3c('0x2b')][_0xdf3c('0x1f')]){_0x27f25a[_0xdf3c('0x29')]=_[_0xdf3c('0x45')](_0x27f25a[_0xdf3c('0x29')],{'$or':_[_0xdf3c('0x20')](_0x27f25a[_0xdf3c('0x33')],function(_0xc3b6a1){var _0x3d9a1e={};_0x3d9a1e[_0xc3b6a1]={'$like':'%'+_0x1961cd['query'][_0xdf3c('0x1f')]+'%'};return _0x3d9a1e;})});}_0x27f25a=_[_0xdf3c('0x45')]({},_0x27f25a,_0x1961cd['options']);return _0x19ce27[_0xdf3c('0x80')](_0x27f25a);}})['then'](function(_0x330ee0){if(_0x330ee0){_0x2c24b7=_0x330ee0['length'];if(!_0x1961cd[_0xdf3c('0x2b')]['hasOwnProperty'](_0xdf3c('0x55'))){_0x27f25a[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0x1961cd[_0xdf3c('0x2b')][_0xdf3c('0x14')]);_0x27f25a[_0xdf3c('0x12')]=qs[_0xdf3c('0x12')](_0x1961cd[_0xdf3c('0x2b')]['offset']);}return _0x19ce27[_0xdf3c('0x80')](_0x27f25a);}})[_0xdf3c('0x19')](function(_0x1b3daa){return _0x1b3daa?{'count':_0x2c24b7,'rows':_0x1b3daa}:null;})['then'](respondWithResult(_0x30659d,null))[_0xdf3c('0x2e')](handleError(_0x30659d,null));};exports[_0xdf3c('0x81')]=function(_0x30e5ab,_0x465c59){var _0x571f14={};var _0x55a4fa={};var _0x4f7b39;var _0x5e5af3;return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0x30e5ab[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x465c59,null))[_0xdf3c('0x19')](function(_0x323d9b){if(_0x323d9b){_0x4f7b39=_0x323d9b;_0x55a4fa[_0xdf3c('0x34')]=_['keys'](db[_0xdf3c('0x82')]['rawAttributes']);_0x55a4fa[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0x30e5ab[_0xdf3c('0x2b')]);_0x55a4fa[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x55a4fa[_0xdf3c('0x34')],_0x55a4fa[_0xdf3c('0x2b')]);_0x571f14[_0xdf3c('0x33')]=_['intersection'](_0x55a4fa[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x30e5ab[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x571f14[_0xdf3c('0x33')]=_0x571f14['attributes']['length']?_0x571f14[_0xdf3c('0x33')]:_0x55a4fa[_0xdf3c('0x34')];_0x571f14[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_0x30e5ab[_0xdf3c('0x2b')][_0xdf3c('0x4d')]);_0x571f14[_0xdf3c('0x29')]=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0x30e5ab[_0xdf3c('0x2b')],_0x55a4fa[_0xdf3c('0x31')]));if(_0x30e5ab['query'][_0xdf3c('0x1f')]){_0x571f14[_0xdf3c('0x29')]=_[_0xdf3c('0x45')](_0x571f14[_0xdf3c('0x29')],{'$or':_[_0xdf3c('0x20')](_0x571f14[_0xdf3c('0x33')],function(_0x184a55){var _0x4e8ad8={};_0x4e8ad8[_0x184a55]={'$like':'%'+_0x30e5ab[_0xdf3c('0x2b')]['filter']+'%'};return _0x4e8ad8;})});}_0x571f14=_[_0xdf3c('0x45')]({},_0x571f14,_0x30e5ab['options']);return _0x4f7b39[_0xdf3c('0x81')](_0x571f14);}})[_0xdf3c('0x19')](function(_0x54d975){if(_0x54d975){_0x5e5af3=_0x54d975['length'];if(!_0x30e5ab[_0xdf3c('0x2b')][_0xdf3c('0x4b')](_0xdf3c('0x55'))){_0x571f14[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0x30e5ab['query'][_0xdf3c('0x14')]);_0x571f14[_0xdf3c('0x12')]=qs[_0xdf3c('0x12')](_0x30e5ab[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}return _0x4f7b39['getLists'](_0x571f14);}})[_0xdf3c('0x19')](function(_0x55a593){if(_0x55a593){return _0x55a593?{'count':_0x5e5af3,'rows':_0x55a593}:null;}})[_0xdf3c('0x19')](respondWithResult(_0x465c59,null))['catch'](handleError(_0x465c59,null));};exports['addLists']=function(_0x42d720,_0x2da908){var _0x3e2a89=moment()[_0xdf3c('0x83')](_0xdf3c('0x84'));var _0x4f4afd,_0xd3d760;return db[_0xdf3c('0x26')]['find']({'where':{'id':_0x42d720[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x2da908,null))[_0xdf3c('0x19')](function(_0x386a3b){if(_0x386a3b){_0xd3d760=_0x386a3b;return _0x386a3b[_0xdf3c('0x85')](_0x42d720['body'][_0xdf3c('0x6d')],_[_0xdf3c('0x46')](_0x42d720[_0xdf3c('0x3b')],[_0xdf3c('0x6d'),'id'])||{});}return null;})[_0xdf3c('0x7d')](function(_0x511630){var _0x2cf46;_0x4f4afd=_0x511630||[];var _0x43fc55=[];if(_0x511630){for(var _0x81b8dd=0x0;_0x81b8dd<_0x511630[_0xdf3c('0x36')];_0x81b8dd+=0x1){var _0xb852c5=_0x511630[_0x81b8dd][_0xdf3c('0x1b')]({'plain':!![]});_0xd3d760[_0xdf3c('0x86')]=_0x42d720[_0xdf3c('0x3b')][_0xdf3c('0x86')]?_0x42d720[_0xdf3c('0x3b')][_0xdf3c('0x86')]:_0xd3d760[_0xdf3c('0x86')];switch(_0xd3d760[_0xdf3c('0x86')]){case _0xdf3c('0x87'):_0x2cf46=squel[_0xdf3c('0x88')]()[_0xdf3c('0x89')](_0xdf3c('0x8a'))[_0xdf3c('0x8b')](['phone',_0xdf3c('0x8c'),_0xdf3c('0x8d'),_0xdf3c('0x8e'),'VoiceQueueId',_0xdf3c('0x48'),'updatedAt'],squel[_0xdf3c('0x6e')]()['field'](_0xdf3c('0x8f'),_0xdf3c('0x8f'))[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x8c'))[_0xdf3c('0x6f')]('id',_0xdf3c('0x8d'))[_0xdf3c('0x6f')](_0xb852c5[_0xdf3c('0x90')][_0xdf3c('0x91')](),'ListId')[_0xdf3c('0x6f')](_0x42d720[_0xdf3c('0x2f')]['id'][_0xdf3c('0x91')](),_0xdf3c('0x4f'))['field']('\x27'+_0x3e2a89+'\x27','createdAt')[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x47'))[_0xdf3c('0x70')](_0xdf3c('0x92'))['where'](_0xdf3c('0x93'))['where']('ListId\x20=\x20?',_0xb852c5[_0xdf3c('0x90')][_0xdf3c('0x91')]())['where'](_0xdf3c('0x94'))[_0xdf3c('0x29')]('phone\x20NOT\x20IN\x20(?)',squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')]('COALESCE(calleridnum,\x27\x27)')[_0xdf3c('0x70')](_0xdf3c('0x95'))[_0xdf3c('0x29')](_0xdf3c('0x73'),_0x42d720[_0xdf3c('0x2f')]['id'][_0xdf3c('0x91')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x96'))[_0xdf3c('0x70')](_0xdf3c('0x8a'))[_0xdf3c('0x29')]('VoiceQueueId\x20=\x20?',_0x42d720[_0xdf3c('0x2f')]['id'][_0xdf3c('0x91')]())))[_0xdf3c('0x91')]();break;case _0xdf3c('0x97'):_0x2cf46=squel['insert']()[_0xdf3c('0x89')](_0xdf3c('0x8a'))['fromQuery']([_0xdf3c('0x8f'),_0xdf3c('0x8c'),_0xdf3c('0x8d'),_0xdf3c('0x8e'),'VoiceQueueId',_0xdf3c('0x48'),_0xdf3c('0x47')],squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')]('phone','phone')[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x8c'))[_0xdf3c('0x6f')]('id',_0xdf3c('0x8d'))[_0xdf3c('0x6f')](_0xb852c5[_0xdf3c('0x90')][_0xdf3c('0x91')](),_0xdf3c('0x8e'))['field'](_0x42d720[_0xdf3c('0x2f')]['id'][_0xdf3c('0x91')](),'VoiceQueueId')[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x48'))['field']('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x47'))['from'](_0xdf3c('0x92'))[_0xdf3c('0x29')](_0xdf3c('0x93'))[_0xdf3c('0x29')]('ListId\x20=\x20?',_0xb852c5['CmListId']['toString']())[_0xdf3c('0x29')](_0xdf3c('0x94'))[_0xdf3c('0x29')](_0xdf3c('0x98'),squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x96'))['from'](_0xdf3c('0x8a'))[_0xdf3c('0x29')]('VoiceQueueId\x20=\x20?',_0x42d720[_0xdf3c('0x2f')]['id']['toString']())))[_0xdf3c('0x91')]();break;default:_0x2cf46=squel[_0xdf3c('0x88')]()[_0xdf3c('0x89')]('cm_hopper')[_0xdf3c('0x8b')]([_0xdf3c('0x8f'),_0xdf3c('0x8c'),_0xdf3c('0x8d'),_0xdf3c('0x8e'),'VoiceQueueId',_0xdf3c('0x48'),_0xdf3c('0x47')],squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x8f'),_0xdf3c('0x8f'))[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27','scheduledAt')[_0xdf3c('0x6f')]('id',_0xdf3c('0x8d'))[_0xdf3c('0x6f')](_0xb852c5['CmListId'][_0xdf3c('0x91')](),'ListId')[_0xdf3c('0x6f')](_0x42d720[_0xdf3c('0x2f')]['id']['toString'](),_0xdf3c('0x4f'))[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x48'))[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x47'))[_0xdf3c('0x70')](_0xdf3c('0x92'))[_0xdf3c('0x29')](_0xdf3c('0x93'))[_0xdf3c('0x29')](_0xdf3c('0x99'),_0xb852c5[_0xdf3c('0x90')]['toString']())[_0xdf3c('0x29')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x43fc55['push'](db['sequelize'][_0xdf3c('0x2b')](_0x2cf46));}return BPromise[_0xdf3c('0x78')](_0x43fc55);}})[_0xdf3c('0x19')](function(){var _0x1eb736=[];var _0x321ff1=squel[_0xdf3c('0x88')]()['into'](_0xdf3c('0x9a'))['fromQuery']([_0xdf3c('0x9b'),_0xdf3c('0x8f'),_0xdf3c('0x9c'),_0xdf3c('0x48'),_0xdf3c('0x47')],squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x9d'))[_0xdf3c('0x6f')]('ci.item')[_0xdf3c('0x6f')](_0xdf3c('0x9e'))[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x48'))['field']('\x27'+_0x3e2a89+'\x27','updatedAt')[_0xdf3c('0x70')](_0xdf3c('0x9f'),'ci')[_0xdf3c('0x72')](_0xdf3c('0x8a'),'h','h.ContactId=ci.CmContactId')[_0xdf3c('0x29')](_0xdf3c('0xa0'),_0x3e2a89)[_0xdf3c('0x29')](_0xdf3c('0xa1'),_0xdf3c('0xa2')))[_0xdf3c('0x91')]();_0x1eb736[_0xdf3c('0x75')](db['sequelize'][_0xdf3c('0x2b')](_0x321ff1));return BPromise[_0xdf3c('0x78')](_0x1eb736);})[_0xdf3c('0x19')](function(){return _0x4f4afd;})[_0xdf3c('0x19')](respondWithResult(_0x2da908,null))[_0xdf3c('0x2e')](handleError(_0x2da908,null));};exports[_0xdf3c('0xa3')]=function(_0x51404d,_0x4cfc67){return db[_0xdf3c('0x26')][_0xdf3c('0x39')]({'where':{'id':_0x51404d[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x4cfc67,null))[_0xdf3c('0x19')](function(_0x5e06a2){if(_0x5e06a2){return _0x5e06a2[_0xdf3c('0xa3')](_0x51404d[_0xdf3c('0x2b')][_0xdf3c('0x6d')]);}})[_0xdf3c('0x19')](function(_0x2cab31){if(_0x2cab31){return db[_0xdf3c('0x50')]['destroy']({'where':{'ListId':_0x51404d[_0xdf3c('0x2b')][_0xdf3c('0x6d')],'VoiceQueueId':_0x51404d['params']['id']}})[_0xdf3c('0x19')](function(){return _0x2cab31;});}})['then'](respondWithStatusCode(_0x4cfc67,null))[_0xdf3c('0x2e')](handleError(_0x4cfc67,null));};exports[_0xdf3c('0xa4')]=function(_0xa6fa19,_0x16b173){var _0x578e41={};var _0x4815ee={};var _0xa523c8;var _0x52ae27;return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0xa6fa19[_0xdf3c('0x2f')]['id']}})['then'](handleEntityNotFound(_0x16b173,null))[_0xdf3c('0x19')](function(_0x148785){if(_0x148785){_0xa523c8=_0x148785;_0x4815ee[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db['CmList']['rawAttributes']);_0x4815ee[_0xdf3c('0x2b')]=_['keys'](_0xa6fa19[_0xdf3c('0x2b')]);_0x4815ee[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x4815ee[_0xdf3c('0x34')],_0x4815ee[_0xdf3c('0x2b')]);_0x578e41['attributes']=_[_0xdf3c('0x32')](_0x4815ee[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0xa6fa19['query'][_0xdf3c('0x35')]));_0x578e41[_0xdf3c('0x33')]=_0x578e41[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x578e41[_0xdf3c('0x33')]:_0x4815ee[_0xdf3c('0x34')];_0x578e41[_0xdf3c('0x4c')]=qs['sort'](_0xa6fa19['query'][_0xdf3c('0x4d')]);_0x578e41['where']=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0xa6fa19[_0xdf3c('0x2b')],_0x4815ee[_0xdf3c('0x31')]));if(_0xa6fa19['query'][_0xdf3c('0x1f')]){_0x578e41['where']=_[_0xdf3c('0x45')](_0x578e41['where'],{'$or':_[_0xdf3c('0x20')](_0x578e41[_0xdf3c('0x33')],function(_0x36fb96){var _0x2ac2ca={};_0x2ac2ca[_0x36fb96]={'$like':'%'+_0xa6fa19[_0xdf3c('0x2b')][_0xdf3c('0x1f')]+'%'};return _0x2ac2ca;})});}_0x578e41=_[_0xdf3c('0x45')]({},_0x578e41,_0xa6fa19['options']);return _0xa523c8[_0xdf3c('0xa4')](_0x578e41);}})[_0xdf3c('0x19')](function(_0x25d312){if(_0x25d312){_0x52ae27=_0x25d312[_0xdf3c('0x36')];if(!_0xa6fa19['query'][_0xdf3c('0x4b')](_0xdf3c('0x55'))){_0x578e41[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0xa6fa19[_0xdf3c('0x2b')]['limit']);_0x578e41['offset']=qs['offset'](_0xa6fa19[_0xdf3c('0x2b')]['offset']);}return _0xa523c8[_0xdf3c('0xa4')](_0x578e41);}})['then'](function(_0xbbc217){if(_0xbbc217){return _0xbbc217?{'count':_0x52ae27,'rows':_0xbbc217}:null;}})[_0xdf3c('0x19')](respondWithResult(_0x16b173,null))[_0xdf3c('0x2e')](handleError(_0x16b173,null));};exports['addBlackLists']=function(_0x47d44e,_0x4dd133){var _0x2b8425;return db[_0xdf3c('0x26')]['find']({'where':{'id':_0x47d44e[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x4dd133,null))[_0xdf3c('0x19')](function(_0x4009e0){if(_0x4009e0){return _0x4009e0[_0xdf3c('0xa5')](_0x47d44e[_0xdf3c('0x3b')][_0xdf3c('0x6d')],_[_0xdf3c('0x46')](_0x47d44e['body'],[_0xdf3c('0x6d'),'id'])||{});}return null;})[_0xdf3c('0x7d')](function(_0x37e578){var _0x11436f;_0x2b8425=_0x37e578||[];var _0x1d66b6=[];if(_0x37e578){for(var _0x4b4bab=0x0;_0x4b4bab<_0x37e578[_0xdf3c('0x36')];_0x4b4bab+=0x1){var _0x290778=_0x37e578[_0x4b4bab][_0xdf3c('0x1b')]({'plain':!![]});_0x11436f=squel[_0xdf3c('0x88')]()[_0xdf3c('0x89')](_0xdf3c('0xa6'))['fromQuery']([_0xdf3c('0x8f'),'ContactId',_0xdf3c('0x8e'),_0xdf3c('0x4f'),_0xdf3c('0x48'),_0xdf3c('0x47')],squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x8f'),_0xdf3c('0x8f'))[_0xdf3c('0x6f')]('id','ContactId')[_0xdf3c('0x6f')](_0x290778[_0xdf3c('0x90')][_0xdf3c('0x91')](),'ListId')[_0xdf3c('0x6f')](_0x47d44e['params']['id'][_0xdf3c('0x91')](),_0xdf3c('0x4f'))[_0xdf3c('0x6f')](_0xdf3c('0xa7'),_0xdf3c('0x48'))[_0xdf3c('0x6f')](_0xdf3c('0xa7'),_0xdf3c('0x47'))[_0xdf3c('0x70')](_0xdf3c('0x92'))[_0xdf3c('0x29')](_0xdf3c('0x93'))['where']('ListId\x20=\x20?',_0x290778['CmListId'][_0xdf3c('0x91')]())[_0xdf3c('0x29')](_0xdf3c('0x94')))[_0xdf3c('0x91')]();_0x1d66b6[_0xdf3c('0x75')](db[_0xdf3c('0x76')][_0xdf3c('0x2b')](_0x11436f));}return BPromise[_0xdf3c('0x78')](_0x1d66b6);}})[_0xdf3c('0x19')](function(){return _0x2b8425;})[_0xdf3c('0x19')](respondWithResult(_0x4dd133,null))[_0xdf3c('0x2e')](handleError(_0x4dd133,null));};exports[_0xdf3c('0xa8')]=function(_0xc5ac78,_0x567748){return db['VoiceQueue'][_0xdf3c('0x39')]({'where':{'id':_0xc5ac78[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x567748,null))['then'](function(_0x290a39){if(_0x290a39){return _0x290a39['removeBlackLists'](_0xc5ac78[_0xdf3c('0x2b')][_0xdf3c('0x6d')]);}})['then'](function(_0xabf05c){if(_0xabf05c){return db[_0xdf3c('0x57')][_0xdf3c('0x1a')]({'where':{'ListId':_0xc5ac78[_0xdf3c('0x2b')][_0xdf3c('0x6d')],'VoiceQueueId':_0xc5ac78[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](function(){return _0xabf05c;});}})[_0xdf3c('0x19')](respondWithStatusCode(_0x567748,null))['catch'](handleError(_0x567748,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 8f734dd..ca08ca2 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 _0xb5f4=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceQueue'];(function(_0x158443,_0x1f4a35){var _0x282e59=function(_0xd72bee){while(--_0xd72bee){_0x158443['push'](_0x158443['shift']());}};_0x282e59(++_0x1f4a35);}(_0xb5f4,0x6a));var _0x4b5f=function(_0x47378a,_0x20bc70){_0x47378a=_0x47378a-0x0;var _0x120fdb=_0xb5f4[_0x47378a];return _0x120fdb;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x4b5f('0x0'))['db'][_0x4b5f('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4b5f('0x2'),'afterUpdate':_0x4b5f('0x3'),'afterDestroy':_0x4b5f('0x4')};function emitEvent(_0x19e1cd){return function(_0x41f6f2,_0x2cbf59,_0x574915){VoiceQueueEvents[_0x4b5f('0x5')](_0x19e1cd+':'+_0x41f6f2['id'],_0x41f6f2);VoiceQueueEvents['emit'](_0x19e1cd,_0x41f6f2);_0x574915(null);};}for(var e in events){if(events[_0x4b5f('0x6')](e)){var event=events[e];VoiceQueue[_0x4b5f('0x7')](e,emitEvent(event));}}module[_0x4b5f('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0xac5c=['emit','hasOwnProperty','hook','exports','VoiceQueue','setMaxListeners','save','update','remove'];(function(_0x4ea046,_0x23765f){var _0x4d4c5d=function(_0x5e1c55){while(--_0x5e1c55){_0x4ea046['push'](_0x4ea046['shift']());}};_0x4d4c5d(++_0x23765f);}(_0xac5c,0x124));var _0xcac5=function(_0x38cef8,_0x39a050){_0x38cef8=_0x38cef8-0x0;var _0x219907=_0xac5c[_0x38cef8];return _0x219907;};'use strict';var EventEmitter=require('events');var VoiceQueue=require('../../mysqldb')['db'][_0xcac5('0x0')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xcac5('0x1')](0x0);var events={'afterCreate':_0xcac5('0x2'),'afterUpdate':_0xcac5('0x3'),'afterDestroy':_0xcac5('0x4')};function emitEvent(_0x5c8f36){return function(_0x3ada02,_0x124463,_0x301c35){VoiceQueueEvents[_0xcac5('0x5')](_0x5c8f36+':'+_0x3ada02['id'],_0x3ada02);VoiceQueueEvents[_0xcac5('0x5')](_0x5c8f36,_0x3ada02);_0x301c35(null);};}for(var e in events){if(events[_0xcac5('0x6')](e)){var event=events[e];VoiceQueue[_0xcac5('0x7')](e,emitEvent(event));}}module[_0xcac5('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 209466c..692f36e 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x5f3b52,_0x554fa9){var _0x1ffa89=function(_0x4c8f7f){while(--_0x4c8f7f){_0x5f3b52['push'](_0x5f3b52['shift']());}};_0x1ffa89(++_0x554fa9);}(_0xedd9,0xfc));var _0x9edd=function(_0xb4a397,_0x5cf722){_0xb4a397=_0xb4a397-0x0;var _0x24be46=_0xedd9[_0xb4a397];return _0x24be46;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x5e59d1,_0x3a43dd){var _0x6111c1=function(_0x4c9ff3){while(--_0x4c9ff3){_0x5e59d1['push'](_0x5e59d1['shift']());}};_0x6111c1(++_0x3a43dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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':'voice_queues','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 f987824..74bbd26 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 _0x367a=['then','info','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','catch','GetVoiceQueue','findAll','options','raw','attributes','limit','include','map','model','ShowVoiceQueue','VoiceQueue','where','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','redis','defaults','localhost','./voiceQueue.socket','register','request'];(function(_0xbc1c93,_0x30351e){var _0x49204e=function(_0x36f8a7){while(--_0x36f8a7){_0xbc1c93['push'](_0xbc1c93['shift']());}};_0x49204e(++_0x30351e);}(_0x367a,0xf5));var _0xa367=function(_0x56a38e,_0x42856d){_0x56a38e=_0x56a38e-0x0;var _0x51faa2=_0x367a[_0x56a38e];return _0x51faa2;};'use strict';var _=require(_0xa367('0x0'));var util=require(_0xa367('0x1'));var moment=require(_0xa367('0x2'));var BPromise=require(_0xa367('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa367('0x4'))['db'];var utils=require(_0xa367('0x5'));var logger=require(_0xa367('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa367('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xa367('0x8')]=_[_0xa367('0x9')](config[_0xa367('0x8')],{'host':_0xa367('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa367('0x8')]));require(_0xa367('0xb'))[_0xa367('0xc')](socket);function respondWithRpcPromise(_0x2207e9,_0xf42c76,_0x4a2fff){return new BPromise(function(_0x53c8b0,_0x2bd446){return client[_0xa367('0xd')](_0x2207e9,_0x4a2fff)[_0xa367('0xe')](function(_0x41cca0){logger[_0xa367('0xf')]('VoiceQueue,\x20%s,\x20%s',_0xf42c76,'request\x20sent');logger[_0xa367('0x10')](_0xa367('0x11'),_0xf42c76,_0xa367('0x12'),JSON[_0xa367('0x13')](_0x41cca0));if(_0x41cca0['error']){if(_0x41cca0[_0xa367('0x14')][_0xa367('0x15')]===0x1f4){logger[_0xa367('0x14')](_0xa367('0x16'),_0xf42c76,_0x41cca0[_0xa367('0x14')]['message']);return _0x2bd446(_0x41cca0[_0xa367('0x14')][_0xa367('0x17')]);}logger['error']('VoiceQueue,\x20%s,\x20%s',_0xf42c76,_0x41cca0[_0xa367('0x14')]['message']);return _0x53c8b0(_0x41cca0[_0xa367('0x14')][_0xa367('0x17')]);}else{logger[_0xa367('0xf')](_0xa367('0x16'),_0xf42c76,_0xa367('0x12'));_0x53c8b0(_0x41cca0['result'][_0xa367('0x17')]);}})[_0xa367('0x18')](function(_0x1781a7){logger[_0xa367('0x14')](_0xa367('0x16'),_0xf42c76,_0x1781a7);_0x2bd446(_0x1781a7);});});}exports[_0xa367('0x19')]=function(_0x5984f3){var _0x4534d6=this;return new Promise(function(_0x538532,_0x3afe8c){return db['VoiceQueue'][_0xa367('0x1a')]({'raw':_0x5984f3[_0xa367('0x1b')]?_0x5984f3[_0xa367('0x1b')][_0xa367('0x1c')]===undefined?!![]:![]:!![],'where':_0x5984f3[_0xa367('0x1b')]?_0x5984f3[_0xa367('0x1b')]['where']||null:null,'attributes':_0x5984f3['options']?_0x5984f3[_0xa367('0x1b')][_0xa367('0x1d')]||null:null,'limit':_0x5984f3[_0xa367('0x1b')]?_0x5984f3['options'][_0xa367('0x1e')]||null:null,'include':_0x5984f3[_0xa367('0x1b')]?_0x5984f3['options'][_0xa367('0x1f')]?_[_0xa367('0x20')](_0x5984f3[_0xa367('0x1b')][_0xa367('0x1f')],function(_0x490c94){return{'model':db[_0x490c94[_0xa367('0x21')]],'as':_0x490c94['as'],'attributes':_0x490c94['attributes'],'include':_0x490c94[_0xa367('0x1f')]?_[_0xa367('0x20')](_0x490c94[_0xa367('0x1f')],function(_0x774a3f){return{'model':db[_0x774a3f[_0xa367('0x21')]],'as':_0x774a3f['as'],'attributes':_0x774a3f[_0xa367('0x1d')],'include':_0x774a3f['include']?_[_0xa367('0x20')](_0x774a3f[_0xa367('0x1f')],function(_0x33219f){return{'model':db[_0x33219f['model']],'as':_0x33219f['as'],'attributes':_0x33219f[_0xa367('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa367('0xe')](function(_0xa93489){logger[_0xa367('0xf')](_0xa367('0x19'),_0x5984f3);logger[_0xa367('0x10')](_0xa367('0x19'),_0x5984f3,JSON['stringify'](_0xa93489));_0x538532(_0xa93489);})[_0xa367('0x18')](function(_0x47c538){logger[_0xa367('0x14')](_0xa367('0x19'),_0x47c538[_0xa367('0x17')],_0x5984f3);_0x3afe8c(_0x4534d6[_0xa367('0x14')](0x1f4,_0x47c538[_0xa367('0x17')]));});});};exports[_0xa367('0x22')]=function(_0x1957af){var _0x512935=this;return new Promise(function(_0x5b0699,_0x69c030){return db[_0xa367('0x23')]['find']({'raw':_0x1957af[_0xa367('0x1b')]?_0x1957af[_0xa367('0x1b')][_0xa367('0x1c')]===undefined?!![]:![]:!![],'where':_0x1957af[_0xa367('0x1b')]?_0x1957af[_0xa367('0x1b')][_0xa367('0x24')]||null:null,'attributes':_0x1957af[_0xa367('0x1b')]?_0x1957af[_0xa367('0x1b')][_0xa367('0x1d')]||null:null,'include':_0x1957af[_0xa367('0x1b')]?_0x1957af['options'][_0xa367('0x1f')]?_[_0xa367('0x20')](_0x1957af[_0xa367('0x1b')][_0xa367('0x1f')],function(_0x4acfe2){return{'model':db[_0x4acfe2[_0xa367('0x21')]],'as':_0x4acfe2['as'],'attributes':_0x4acfe2[_0xa367('0x1d')],'include':_0x4acfe2[_0xa367('0x1f')]?_[_0xa367('0x20')](_0x4acfe2[_0xa367('0x1f')],function(_0x4794cf){return{'model':db[_0x4794cf['model']],'as':_0x4794cf['as'],'attributes':_0x4794cf['attributes'],'include':_0x4794cf[_0xa367('0x1f')]?_[_0xa367('0x20')](_0x4794cf['include'],function(_0x138fb6){return{'model':db[_0x138fb6[_0xa367('0x21')]],'as':_0x138fb6['as'],'attributes':_0x138fb6[_0xa367('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x477cd8){logger[_0xa367('0xf')](_0xa367('0x22'),_0x1957af);logger['debug'](_0xa367('0x22'),_0x1957af,JSON[_0xa367('0x13')](_0x477cd8));_0x5b0699(_0x477cd8);})[_0xa367('0x18')](function(_0x2529c0){logger[_0xa367('0x14')](_0xa367('0x22'),_0x2529c0[_0xa367('0x17')],_0x1957af);_0x69c030(_0x512935['error'](0x1f4,_0x2529c0[_0xa367('0x17')]));});});}; \ No newline at end of file +var _0xd70c=['socket.io-emitter','./voiceQueue.socket','register','request','VoiceQueue,\x20%s,\x20%s','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','catch','VoiceQueue','findAll','options','limit','model','attributes','include','map','GetVoiceQueue','ShowVoiceQueue','find','raw','where','then','debug','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','redis'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0xd70c,0xab));var _0xcd70=function(_0x621d5d,_0x1dc307){_0x621d5d=_0x621d5d-0x0;var _0x4fd21e=_0xd70c[_0x621d5d];return _0x4fd21e;};'use strict';var _=require(_0xcd70('0x0'));var util=require('util');var moment=require(_0xcd70('0x1'));var BPromise=require('bluebird');var rs=require(_0xcd70('0x2'));var fs=require('fs');var Redis=require(_0xcd70('0x3'));var db=require(_0xcd70('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd70('0x5'))('rpc');var config=require(_0xcd70('0x6'));var jayson=require(_0xcd70('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xcd70('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcd70('0x9'))(new Redis(config[_0xcd70('0x8')]));require(_0xcd70('0xa'))[_0xcd70('0xb')](socket);function respondWithRpcPromise(_0x3fd504,_0x146122,_0x414ad2){return new BPromise(function(_0x5139c0,_0x41fb66){return client[_0xcd70('0xc')](_0x3fd504,_0x414ad2)['then'](function(_0x46c6b7){logger['info'](_0xcd70('0xd'),_0x146122,'request\x20sent');logger['debug'](_0xcd70('0xe'),_0x146122,_0xcd70('0xf'),JSON['stringify'](_0x46c6b7));if(_0x46c6b7[_0xcd70('0x10')]){if(_0x46c6b7[_0xcd70('0x10')]['code']===0x1f4){logger[_0xcd70('0x10')](_0xcd70('0xd'),_0x146122,_0x46c6b7[_0xcd70('0x10')][_0xcd70('0x11')]);return _0x41fb66(_0x46c6b7[_0xcd70('0x10')][_0xcd70('0x11')]);}logger[_0xcd70('0x10')](_0xcd70('0xd'),_0x146122,_0x46c6b7[_0xcd70('0x10')][_0xcd70('0x11')]);return _0x5139c0(_0x46c6b7['error'][_0xcd70('0x11')]);}else{logger[_0xcd70('0x12')](_0xcd70('0xd'),_0x146122,_0xcd70('0xf'));_0x5139c0(_0x46c6b7['result']['message']);}})[_0xcd70('0x13')](function(_0x1508bb){logger[_0xcd70('0x10')](_0xcd70('0xd'),_0x146122,_0x1508bb);_0x41fb66(_0x1508bb);});});}exports['GetVoiceQueue']=function(_0x1706a2){var _0x22b9fb=this;return new Promise(function(_0x3c38bb,_0x3231ec){return db[_0xcd70('0x14')][_0xcd70('0x15')]({'raw':_0x1706a2[_0xcd70('0x16')]?_0x1706a2[_0xcd70('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1706a2['options']?_0x1706a2[_0xcd70('0x16')]['where']||null:null,'attributes':_0x1706a2[_0xcd70('0x16')]?_0x1706a2[_0xcd70('0x16')]['attributes']||null:null,'limit':_0x1706a2['options']?_0x1706a2['options'][_0xcd70('0x17')]||null:null,'include':_0x1706a2[_0xcd70('0x16')]?_0x1706a2[_0xcd70('0x16')]['include']?_['map'](_0x1706a2[_0xcd70('0x16')]['include'],function(_0x3811a2){return{'model':db[_0x3811a2[_0xcd70('0x18')]],'as':_0x3811a2['as'],'attributes':_0x3811a2[_0xcd70('0x19')],'include':_0x3811a2[_0xcd70('0x1a')]?_[_0xcd70('0x1b')](_0x3811a2[_0xcd70('0x1a')],function(_0x35a545){return{'model':db[_0x35a545[_0xcd70('0x18')]],'as':_0x35a545['as'],'attributes':_0x35a545['attributes'],'include':_0x35a545[_0xcd70('0x1a')]?_[_0xcd70('0x1b')](_0x35a545[_0xcd70('0x1a')],function(_0x4ae7f2){return{'model':db[_0x4ae7f2[_0xcd70('0x18')]],'as':_0x4ae7f2['as'],'attributes':_0x4ae7f2[_0xcd70('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4919c1){logger[_0xcd70('0x12')](_0xcd70('0x1c'),_0x1706a2);logger['debug'](_0xcd70('0x1c'),_0x1706a2,JSON['stringify'](_0x4919c1));_0x3c38bb(_0x4919c1);})[_0xcd70('0x13')](function(_0x547697){logger[_0xcd70('0x10')](_0xcd70('0x1c'),_0x547697[_0xcd70('0x11')],_0x1706a2);_0x3231ec(_0x22b9fb[_0xcd70('0x10')](0x1f4,_0x547697[_0xcd70('0x11')]));});});};exports[_0xcd70('0x1d')]=function(_0x10cd27){var _0x3b863c=this;return new Promise(function(_0x51aaa0,_0x3e1317){return db['VoiceQueue'][_0xcd70('0x1e')]({'raw':_0x10cd27['options']?_0x10cd27[_0xcd70('0x16')][_0xcd70('0x1f')]===undefined?!![]:![]:!![],'where':_0x10cd27[_0xcd70('0x16')]?_0x10cd27[_0xcd70('0x16')][_0xcd70('0x20')]||null:null,'attributes':_0x10cd27[_0xcd70('0x16')]?_0x10cd27[_0xcd70('0x16')][_0xcd70('0x19')]||null:null,'include':_0x10cd27['options']?_0x10cd27[_0xcd70('0x16')][_0xcd70('0x1a')]?_['map'](_0x10cd27[_0xcd70('0x16')][_0xcd70('0x1a')],function(_0x52c99b){return{'model':db[_0x52c99b[_0xcd70('0x18')]],'as':_0x52c99b['as'],'attributes':_0x52c99b[_0xcd70('0x19')],'include':_0x52c99b['include']?_['map'](_0x52c99b['include'],function(_0x253a77){return{'model':db[_0x253a77[_0xcd70('0x18')]],'as':_0x253a77['as'],'attributes':_0x253a77[_0xcd70('0x19')],'include':_0x253a77['include']?_[_0xcd70('0x1b')](_0x253a77[_0xcd70('0x1a')],function(_0x61dd0f){return{'model':db[_0x61dd0f[_0xcd70('0x18')]],'as':_0x61dd0f['as'],'attributes':_0x61dd0f[_0xcd70('0x19')]};}):[]};}):[]};}):[]:[]})[_0xcd70('0x21')](function(_0x8d44d3){logger['info']('ShowVoiceQueue',_0x10cd27);logger[_0xcd70('0x22')](_0xcd70('0x1d'),_0x10cd27,JSON[_0xcd70('0x23')](_0x8d44d3));_0x51aaa0(_0x8d44d3);})[_0xcd70('0x13')](function(_0x2d0a79){logger['error']('ShowVoiceQueue',_0x2d0a79[_0xcd70('0x11')],_0x10cd27);_0x3e1317(_0x3b863c[_0xcd70('0x10')](0x1f4,_0x2d0a79[_0xcd70('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 348ee11..7559b2c 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 _0x2d69=['removeListener','register','voiceQueue:','./voiceQueue.events','save'];(function(_0x422d4b,_0x1ce750){var _0x483cf7=function(_0x21c188){while(--_0x21c188){_0x422d4b['push'](_0x422d4b['shift']());}};_0x483cf7(++_0x1ce750);}(_0x2d69,0x71));var _0x92d6=function(_0x4b65f1,_0x3dfc92){_0x4b65f1=_0x4b65f1-0x0;var _0x4efedd=_0x2d69[_0x4b65f1];return _0x4efedd;};'use strict';var VoiceQueueEvents=require(_0x92d6('0x0'));var events=[_0x92d6('0x1'),'remove','update'];function createListener(_0x284cd1,_0x2c7514){return function(_0x220fcb){_0x2c7514['emit'](_0x284cd1,_0x220fcb);};}function removeListener(_0x35fe91,_0x77b122){return function(){VoiceQueueEvents[_0x92d6('0x2')](_0x35fe91,_0x77b122);};}exports[_0x92d6('0x3')]=function(_0x14b037){for(var _0x2f8aeb=0x0,_0x1f0e4e=events['length'];_0x2f8aeb<_0x1f0e4e;_0x2f8aeb++){var _0x41c1b7=events[_0x2f8aeb];var _0xba1866=createListener(_0x92d6('0x4')+_0x41c1b7,_0x14b037);VoiceQueueEvents['on'](_0x41c1b7,_0xba1866);}}; \ No newline at end of file +var _0xf003=['save','removeListener','register','voiceQueue:','./voiceQueue.events'];(function(_0x20be3c,_0x26150e){var _0x3c105=function(_0x29ea9c){while(--_0x29ea9c){_0x20be3c['push'](_0x20be3c['shift']());}};_0x3c105(++_0x26150e);}(_0xf003,0x153));var _0x3f00=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0xf003[_0x236d24];return _0x1574cf;};'use strict';var VoiceQueueEvents=require(_0x3f00('0x0'));var events=[_0x3f00('0x1'),'remove','update'];function createListener(_0x33e25b,_0x1ac291){return function(_0x996c5c){_0x1ac291['emit'](_0x33e25b,_0x996c5c);};}function removeListener(_0x402ed3,_0x170675){return function(){VoiceQueueEvents[_0x3f00('0x2')](_0x402ed3,_0x170675);};}exports[_0x3f00('0x3')]=function(_0x5a9bd7){for(var _0x3a28e5=0x0,_0x4b6939=events['length'];_0x3a28e5<_0x4b6939;_0x3a28e5++){var _0x48cefe=events[_0x3a28e5];var _0x4d9647=createListener(_0x3f00('0x4')+_0x48cefe,_0x5a9bd7);VoiceQueueEvents['on'](_0x48cefe,_0x4d9647);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index ef9410c..2cfbdc7 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 _0x592a=['isAuthenticated','index','get','/describe','describe','/index','getVoiceQueuesReport','show','post','/:id','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceQueueReport.controller'];(function(_0x1e5fa3,_0x528acc){var _0x23ca3d=function(_0x488995){while(--_0x488995){_0x1e5fa3['push'](_0x1e5fa3['shift']());}};_0x23ca3d(++_0x528acc);}(_0x592a,0x1c5));var _0xa592=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x592a[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xa592('0x0'));var util=require(_0xa592('0x1'));var path=require(_0xa592('0x2'));var timeout=require(_0xa592('0x3'));var express=require(_0xa592('0x4'));var router=express['Router']();var fs_extra=require(_0xa592('0x5'));var auth=require(_0xa592('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa592('0x7'));var controller=require(_0xa592('0x8'));router['get']('/',auth[_0xa592('0x9')](),controller[_0xa592('0xa')]);router[_0xa592('0xb')](_0xa592('0xc'),auth[_0xa592('0x9')](),controller[_0xa592('0xd')]);router['get'](_0xa592('0xe'),auth[_0xa592('0x9')](),controller[_0xa592('0xf')]);router[_0xa592('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xa592('0x10')]);router[_0xa592('0x11')]('/',auth[_0xa592('0x9')](),controller['create']);router['put'](_0xa592('0x12'),auth[_0xa592('0x9')](),controller[_0xa592('0x13')]);router[_0xa592('0x14')](_0xa592('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0xa592('0x15')]=router; \ No newline at end of file +var _0x11e9=['put','delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','/describe','describe','/index','isAuthenticated','getVoiceQueuesReport','/:id','show','post','create'];(function(_0x4489cd,_0x83d7ee){var _0x3d202c=function(_0x134751){while(--_0x134751){_0x4489cd['push'](_0x4489cd['shift']());}};_0x3d202c(++_0x83d7ee);}(_0x11e9,0x168));var _0x911e=function(_0x3b5350,_0x1b5f0c){_0x3b5350=_0x3b5350-0x0;var _0x32a360=_0x11e9[_0x3b5350];return _0x32a360;};'use strict';var multer=require(_0x911e('0x0'));var util=require(_0x911e('0x1'));var path=require(_0x911e('0x2'));var timeout=require(_0x911e('0x3'));var express=require(_0x911e('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x911e('0x5'));var config=require(_0x911e('0x6'));var controller=require(_0x911e('0x7'));router[_0x911e('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x911e('0x8')](_0x911e('0x9'),auth['isAuthenticated'](),controller[_0x911e('0xa')]);router[_0x911e('0x8')](_0x911e('0xb'),auth[_0x911e('0xc')](),controller[_0x911e('0xd')]);router[_0x911e('0x8')](_0x911e('0xe'),auth[_0x911e('0xc')](),controller[_0x911e('0xf')]);router[_0x911e('0x10')]('/',auth[_0x911e('0xc')](),controller[_0x911e('0x11')]);router[_0x911e('0x12')](_0x911e('0xe'),auth[_0x911e('0xc')](),controller['update']);router[_0x911e('0x13')](_0x911e('0xe'),auth['isAuthenticated'](),controller[_0x911e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index baa4f7c..62fce24 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 _0x82b7=['BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING','DATE','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER'];(function(_0x32c2e7,_0x576ada){var _0x30da17=function(_0x1374c2){while(--_0x1374c2){_0x32c2e7['push'](_0x32c2e7['shift']());}};_0x30da17(++_0x576ada);}(_0x82b7,0x98));var _0x782b=function(_0x1c4654,_0x5d6e0d){_0x1c4654=_0x1c4654-0x0;var _0x14018f=_0x82b7[_0x1c4654];return _0x14018f;};'use strict';var Sequelize=require(_0x782b('0x0'));var moment=require(_0x782b('0x1'));module[_0x782b('0x2')]={'type':{'type':Sequelize[_0x782b('0x3')]},'uniqueid':{'type':Sequelize[_0x782b('0x3')]},'calleridnum':{'type':Sequelize[_0x782b('0x3')]},'calleridname':{'type':Sequelize[_0x782b('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x782b('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x782b('0x4')],'set':function(_0x2030af){var _0x3a24a4=moment(_0x2030af);var _0x276739=moment(this['getDataValue'](_0x782b('0x5')))[_0x782b('0x6')](_0x782b('0x7'));var _0x16da1d=_0x3a24a4['diff'](_0x276739,_0x782b('0x8'));this[_0x782b('0x9')](_0x782b('0xa'),_0x2030af);this[_0x782b('0x9')](_0x782b('0xb'),_0x16da1d||null);}},'position':{'type':Sequelize[_0x782b('0xc')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x782b('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x782b('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x782b('0x4')]},'queuecallerexit':{'type':Sequelize[_0x782b('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x782b('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x782b('0xe')},'originalposition':{'type':Sequelize[_0x782b('0xc')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x782b('0x3')]},'accountcode':{'type':Sequelize[_0x782b('0x3')]},'context':{'type':Sequelize[_0x782b('0x3')]},'exten':{'type':Sequelize[_0x782b('0x3')]},'priority':{'type':Sequelize[_0x782b('0x3')]},'holdtime':{'type':Sequelize[_0x782b('0xc')]},'mohtime':{'type':Sequelize[_0x782b('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x782b('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x782b('0x3')]},'transfer':{'type':Sequelize[_0x782b('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x782b('0x3')]},'transferuniqueid':{'type':Sequelize[_0x782b('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x782b('0x3')]},'thirdDisposition':{'type':Sequelize[_0x782b('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x782b('0xc')],'defaultValue':0x0},'note':{'type':Sequelize[_0x782b('0x3')]}}; \ No newline at end of file +var _0x07ea=['diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2f1404,_0x6db70d){var _0x6582c=function(_0x418aa4){while(--_0x418aa4){_0x2f1404['push'](_0x2f1404['shift']());}};_0x6582c(++_0x6db70d);}(_0x07ea,0x129));var _0xa07e=function(_0x4fb584,_0x24fe3c){_0x4fb584=_0x4fb584-0x0;var _0x5ba4b8=_0x07ea[_0x4fb584];return _0x5ba4b8;};'use strict';var Sequelize=require(_0xa07e('0x0'));var moment=require(_0xa07e('0x1'));module[_0xa07e('0x2')]={'type':{'type':Sequelize[_0xa07e('0x3')]},'uniqueid':{'type':Sequelize[_0xa07e('0x3')]},'calleridnum':{'type':Sequelize[_0xa07e('0x3')]},'calleridname':{'type':Sequelize[_0xa07e('0x3')]},'queue':{'type':Sequelize[_0xa07e('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xa07e('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x2478a3){var _0x7e1a4d=moment(_0x2478a3);var _0x1865ba=moment(this[_0xa07e('0x5')](_0xa07e('0x6')))[_0xa07e('0x7')](_0xa07e('0x8'));var _0x39aa3a=_0x7e1a4d[_0xa07e('0x9')](_0x1865ba,_0xa07e('0xa'));this[_0xa07e('0xb')](_0xa07e('0xc'),_0x2478a3);this[_0xa07e('0xb')](_0xa07e('0xd'),_0x39aa3a||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0xa07e('0xe')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xa07e('0x4')]},'queuecallercomplete':{'type':Sequelize[_0xa07e('0xf')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xa07e('0x4')]},'queuecallerexit':{'type':Sequelize[_0xa07e('0xf')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xa07e('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xa07e('0xe')]},'channel':{'type':Sequelize[_0xa07e('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xa07e('0x3')]},'accountcode':{'type':Sequelize[_0xa07e('0x3')]},'context':{'type':Sequelize[_0xa07e('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa07e('0x3')]},'holdtime':{'type':Sequelize[_0xa07e('0xe')]},'mohtime':{'type':Sequelize[_0xa07e('0xe')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xa07e('0xf')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xa07e('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa07e('0x3')],'comment':_0xa07e('0x10')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xa07e('0x3')]},'disposition':{'type':Sequelize[_0xa07e('0x3')]},'secondDisposition':{'type':Sequelize[_0xa07e('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0xa07e('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 62c9088..e8b50fa 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 _0x535d=['papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','VoiceQueueReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys','merge','create','body','find','describe','nolimit','pick','map','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x535d,0x1a2));var _0xd535=function(_0x5017d0,_0x36e6a9){_0x5017d0=_0x5017d0-0x0;var _0x1ebd2b=_0x535d[_0x5017d0];return _0x1ebd2b;};'use strict';var emlformat=require(_0xd535('0x0'));var rimraf=require(_0xd535('0x1'));var zipdir=require(_0xd535('0x2'));var jsonpatch=require(_0xd535('0x3'));var rp=require(_0xd535('0x4'));var moment=require(_0xd535('0x5'));var BPromise=require(_0xd535('0x6'));var Mustache=require(_0xd535('0x7'));var util=require('util');var path=require(_0xd535('0x8'));var sox=require(_0xd535('0x9'));var csv=require(_0xd535('0xa'));var ejs=require(_0xd535('0xb'));var fs=require('fs');var fs_extra=require(_0xd535('0xc'));var _=require(_0xd535('0xd'));var squel=require('squel');var crypto=require(_0xd535('0xe'));var jsforce=require(_0xd535('0xf'));var deskjs=require(_0xd535('0x10'));var toCsv=require(_0xd535('0xa'));var querystring=require('querystring');var Papa=require(_0xd535('0x11'));var Redis=require(_0xd535('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd535('0x13'));var hardwareService=require(_0xd535('0x14'));var logger=require(_0xd535('0x15'))(_0xd535('0x16'));var utils=require(_0xd535('0x17'));var config=require(_0xd535('0x18'));var licenseUtil=require(_0xd535('0x19'));var db=require(_0xd535('0x1a'))['db'];config[_0xd535('0x1b')]=_[_0xd535('0x1c')](config[_0xd535('0x1b')],{'host':_0xd535('0x1d'),'port':0x18eb});var socket=require(_0xd535('0x1e'))(new Redis(config['redis']));require(_0xd535('0x1f'))[_0xd535('0x20')](socket);function respondWithStatusCode(_0x1c1186,_0x24dfaf){_0x24dfaf=_0x24dfaf||0xcc;return function(_0x2df957){if(_0x2df957){return _0x1c1186[_0xd535('0x21')](_0x24dfaf);}return _0x1c1186[_0xd535('0x22')](_0x24dfaf)[_0xd535('0x23')]();};}function respondWithResult(_0xee71ab,_0x16a0d6){_0x16a0d6=_0x16a0d6||0xc8;return function(_0x1f872d){if(_0x1f872d){return _0xee71ab[_0xd535('0x22')](_0x16a0d6)['json'](_0x1f872d);}};}function respondWithFilteredResult(_0x2a1b2d,_0x1e08ee){return function(_0x15de5e){if(_0x15de5e){var _0x440a69=typeof _0x1e08ee[_0xd535('0x24')]===_0xd535('0x25')&&typeof _0x1e08ee[_0xd535('0x26')]==='undefined';var _0x2708a7=_0x15de5e['count'];var _0x35e2d8=_0x440a69?0x0:_0x1e08ee[_0xd535('0x24')];var _0x441024=_0x440a69?_0x15de5e[_0xd535('0x27')]:_0x1e08ee[_0xd535('0x24')]+_0x1e08ee[_0xd535('0x26')];var _0x190eb5;if(_0x441024>=_0x2708a7){_0x441024=_0x2708a7;_0x190eb5=0xc8;}else{_0x190eb5=0xce;}_0x2a1b2d[_0xd535('0x22')](_0x190eb5);return _0x2a1b2d[_0xd535('0x28')](_0xd535('0x29'),_0x35e2d8+'-'+_0x441024+'/'+_0x2708a7)[_0xd535('0x2a')](_0x15de5e);}return null;};}function patchUpdates(_0x359fbe){return function(_0x20dff3){try{jsonpatch[_0xd535('0x2b')](_0x20dff3,_0x359fbe,!![]);}catch(_0x42bbae){return BPromise[_0xd535('0x2c')](_0x42bbae);}return _0x20dff3[_0xd535('0x2d')]();};}function saveUpdates(_0x1dc2ce,_0x50bf9a){return function(_0x16a503){if(_0x16a503){return _0x16a503[_0xd535('0x2e')](_0x1dc2ce)[_0xd535('0x2f')](function(_0x35dab7){return _0x35dab7;});}return null;};}function removeEntity(_0x16f74a,_0x913d64){return function(_0x1088a5){if(_0x1088a5){return _0x1088a5[_0xd535('0x30')]()[_0xd535('0x2f')](function(){_0x16f74a[_0xd535('0x22')](0xcc)[_0xd535('0x23')]();});}};}function handleEntityNotFound(_0x425d11,_0x4b69c4){return function(_0x318f20){if(!_0x318f20){_0x425d11[_0xd535('0x21')](0x194);}return _0x318f20;};}function handleError(_0x280721,_0x25f17a){_0x25f17a=_0x25f17a||0x1f4;return function(_0x5266f7){logger[_0xd535('0x31')](_0x5266f7['stack']);if(_0x5266f7[_0xd535('0x32')]){delete _0x5266f7[_0xd535('0x32')];}_0x280721[_0xd535('0x22')](_0x25f17a)[_0xd535('0x33')](_0x5266f7);};}exports[_0xd535('0x34')]=function(_0x142c2f,_0x53f93f){var _0x1686ce={},_0x552d8d={},_0x3768d4={'count':0x0,'rows':[]};var _0x343e41=_['map'](db[_0xd535('0x35')][_0xd535('0x36')],function(_0x5496ae){return{'name':_0x5496ae['fieldName'],'type':_0x5496ae[_0xd535('0x37')][_0xd535('0x38')]};});_0x552d8d[_0xd535('0x39')]=_['map'](_0x343e41,_0xd535('0x32'));_0x552d8d[_0xd535('0x3a')]=_['keys'](_0x142c2f['query']);_0x552d8d[_0xd535('0x3b')]=_[_0xd535('0x3c')](_0x552d8d['model'],_0x552d8d[_0xd535('0x3a')]);_0x1686ce[_0xd535('0x3d')]=_[_0xd535('0x3c')](_0x552d8d[_0xd535('0x39')],qs[_0xd535('0x3e')](_0x142c2f[_0xd535('0x3a')][_0xd535('0x3e')]));_0x1686ce[_0xd535('0x3d')]=_0x1686ce['attributes'][_0xd535('0x3f')]?_0x1686ce[_0xd535('0x3d')]:_0x552d8d[_0xd535('0x39')];if(!_0x142c2f[_0xd535('0x3a')][_0xd535('0x40')]('nolimit')){_0x1686ce[_0xd535('0x26')]=qs[_0xd535('0x26')](_0x142c2f[_0xd535('0x3a')][_0xd535('0x26')]);_0x1686ce[_0xd535('0x24')]=qs[_0xd535('0x24')](_0x142c2f[_0xd535('0x3a')][_0xd535('0x24')]);}_0x1686ce[_0xd535('0x41')]=qs[_0xd535('0x42')](_0x142c2f[_0xd535('0x3a')][_0xd535('0x42')]);_0x1686ce[_0xd535('0x43')]=qs[_0xd535('0x3b')](_['pick'](_0x142c2f[_0xd535('0x3a')],_0x552d8d['filters']),_0x343e41);if(_0x142c2f[_0xd535('0x3a')]['filter']){_0x1686ce[_0xd535('0x43')]=_['merge'](_0x1686ce[_0xd535('0x43')],{'$or':_['map'](_0x343e41,function(_0x2d0689){if(_0x2d0689[_0xd535('0x37')]!==_0xd535('0x44')){var _0x6d74d8={};_0x6d74d8[_0x2d0689[_0xd535('0x32')]]={'$like':'%'+_0x142c2f[_0xd535('0x3a')][_0xd535('0x45')]+'%'};return _0x6d74d8;}})});}_0x1686ce=_['merge']({},_0x1686ce,_0x142c2f[_0xd535('0x46')]);var _0x5606e3={'where':_0x1686ce[_0xd535('0x43')]};return db[_0xd535('0x35')][_0xd535('0x27')](_0x5606e3)[_0xd535('0x2f')](function(_0x5fa607){_0x3768d4[_0xd535('0x27')]=_0x5fa607;if(_0x142c2f[_0xd535('0x3a')][_0xd535('0x47')]){_0x1686ce[_0xd535('0x48')]=[{'all':!![]}];}return db[_0xd535('0x35')]['findAll'](_0x1686ce);})[_0xd535('0x2f')](function(_0xe64653){_0x3768d4[_0xd535('0x49')]=_0xe64653;return _0x3768d4;})[_0xd535('0x2f')](respondWithFilteredResult(_0x53f93f,_0x1686ce))[_0xd535('0x4a')](handleError(_0x53f93f,null));};exports[_0xd535('0x4b')]=function(_0xb72167,_0x1bc322){var _0x112c23={'raw':![],'where':{'id':_0xb72167[_0xd535('0x4c')]['id']}},_0x33bb48={};_0x33bb48[_0xd535('0x39')]=_[_0xd535('0x4d')](db['VoiceQueueReport']['rawAttributes']);_0x33bb48['query']=_[_0xd535('0x4d')](_0xb72167[_0xd535('0x3a')]);_0x33bb48[_0xd535('0x3b')]=_['intersection'](_0x33bb48[_0xd535('0x39')],_0x33bb48['query']);_0x112c23[_0xd535('0x3d')]=_[_0xd535('0x3c')](_0x33bb48[_0xd535('0x39')],qs[_0xd535('0x3e')](_0xb72167[_0xd535('0x3a')][_0xd535('0x3e')]));_0x112c23[_0xd535('0x3d')]=_0x112c23[_0xd535('0x3d')][_0xd535('0x3f')]?_0x112c23[_0xd535('0x3d')]:_0x33bb48[_0xd535('0x39')];if(_0xb72167['query'][_0xd535('0x47')]){_0x112c23[_0xd535('0x48')]=[{'all':!![]}];}_0x112c23=_[_0xd535('0x4e')]({},_0x112c23,_0xb72167[_0xd535('0x46')]);return db[_0xd535('0x35')]['find'](_0x112c23)[_0xd535('0x2f')](handleEntityNotFound(_0x1bc322,null))[_0xd535('0x2f')](respondWithResult(_0x1bc322,null))[_0xd535('0x4a')](handleError(_0x1bc322,null));};exports[_0xd535('0x4f')]=function(_0x4ad8e4,_0x3bb806){return db[_0xd535('0x35')]['create'](_0x4ad8e4[_0xd535('0x50')],{})[_0xd535('0x2f')](respondWithResult(_0x3bb806,0xc9))[_0xd535('0x4a')](handleError(_0x3bb806,null));};exports[_0xd535('0x2e')]=function(_0x55040b,_0x5d2e00){if(_0x55040b['body']['id']){delete _0x55040b[_0xd535('0x50')]['id'];}return db[_0xd535('0x35')][_0xd535('0x51')]({'where':{'id':_0x55040b[_0xd535('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5d2e00,null))[_0xd535('0x2f')](saveUpdates(_0x55040b[_0xd535('0x50')],null))[_0xd535('0x2f')](respondWithResult(_0x5d2e00,null))['catch'](handleError(_0x5d2e00,null));};exports[_0xd535('0x30')]=function(_0x36f830,_0xe42741){return db['VoiceQueueReport'][_0xd535('0x51')]({'where':{'id':_0x36f830[_0xd535('0x4c')]['id']}})[_0xd535('0x2f')](handleEntityNotFound(_0xe42741,null))[_0xd535('0x2f')](removeEntity(_0xe42741,null))['catch'](handleError(_0xe42741,null));};exports[_0xd535('0x52')]=function(_0x1db024,_0x2e14f2){return db[_0xd535('0x35')][_0xd535('0x52')]()[_0xd535('0x2f')](respondWithResult(_0x2e14f2,null))[_0xd535('0x4a')](handleError(_0x2e14f2,null));};exports['getVoiceQueuesReport']=function(_0x59cffc,_0x4e752b){var _0x5004b0={},_0x21a68d={},_0x5d097c={'count':0x0,'rows':[]};_0x21a68d[_0xd535('0x39')]=_[_0xd535('0x4d')](db[_0xd535('0x35')][_0xd535('0x36')]);_0x21a68d[_0xd535('0x3a')]=_['keys'](_0x59cffc['query']);_0x21a68d[_0xd535('0x3b')]=_[_0xd535('0x3c')](_0x21a68d['model'],_0x21a68d[_0xd535('0x3a')]);_0x5004b0['attributes']=_['intersection'](_0x21a68d[_0xd535('0x39')],qs['fields'](_0x59cffc[_0xd535('0x3a')]['fields']));_0x5004b0[_0xd535('0x3d')]=_0x5004b0['attributes'][_0xd535('0x3f')]?_0x5004b0[_0xd535('0x3d')]:_0x21a68d['model'];if(!_0x59cffc[_0xd535('0x3a')]['hasOwnProperty'](_0xd535('0x53'))){_0x5004b0[_0xd535('0x26')]=qs[_0xd535('0x26')](_0x59cffc[_0xd535('0x3a')]['limit']);_0x5004b0['offset']=qs[_0xd535('0x24')](_0x59cffc['query'][_0xd535('0x24')]);}_0x5004b0['order']=qs[_0xd535('0x42')](_0x59cffc[_0xd535('0x3a')][_0xd535('0x42')]);_0x5004b0[_0xd535('0x43')]=qs[_0xd535('0x3b')](_[_0xd535('0x54')](_0x59cffc[_0xd535('0x3a')],_0x21a68d[_0xd535('0x3b')]));if(_0x59cffc['query'][_0xd535('0x45')]){_0x5004b0['where']=_[_0xd535('0x4e')](_0x5004b0[_0xd535('0x43')],{'$or':_[_0xd535('0x55')](_0x5004b0[_0xd535('0x3d')],function(_0x146ada){var _0xc85dc3={};_0xc85dc3[_0x146ada]={'$like':'%'+_0x59cffc['query'][_0xd535('0x45')]+'%'};return _0xc85dc3;})});}_0x5004b0=_['merge']({},_0x5004b0,_0x59cffc[_0xd535('0x46')]);var _0x1e6f23={'where':_0x5004b0[_0xd535('0x43')]};return db[_0xd535('0x35')]['count'](_0x1e6f23)[_0xd535('0x2f')](function(_0x548f8d){_0x5d097c['count']=_0x548f8d;if(_0x59cffc['query'][_0xd535('0x47')]){_0x5004b0[_0xd535('0x48')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x5004b0);})[_0xd535('0x2f')](function(_0x1d732a){_0x5d097c[_0xd535('0x49')]=_0x1d732a;return _0x5d097c;})[_0xd535('0x2f')](respondWithFilteredResult(_0x4e752b,_0x5004b0,_0xd535('0x56')))['catch'](handleError(_0x4e752b,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x959b=['to-csv','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','error','stack','name','send','index','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','VoiceQueueReport','findAll','rows','show','keys','includeAll','include','find','catch','create','body','destroy','describe','getVoiceQueuesReport','options','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x959b,0x17a));var _0xb959=function(_0x4d8527,_0x303cc0){_0x4d8527=_0x4d8527-0x0;var _0x444bae=_0x959b[_0x4d8527];return _0x444bae;};'use strict';var emlformat=require(_0xb959('0x0'));var rimraf=require(_0xb959('0x1'));var zipdir=require(_0xb959('0x2'));var jsonpatch=require(_0xb959('0x3'));var rp=require('request-promise');var moment=require(_0xb959('0x4'));var BPromise=require(_0xb959('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xb959('0x6'));var csv=require(_0xb959('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb959('0x8'));var crypto=require(_0xb959('0x9'));var jsforce=require(_0xb959('0xa'));var deskjs=require(_0xb959('0xb'));var toCsv=require(_0xb959('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb959('0xc'));var qs=require(_0xb959('0xd'));var as=require(_0xb959('0xe'));var hardwareService=require(_0xb959('0xf'));var logger=require(_0xb959('0x10'))(_0xb959('0x11'));var utils=require(_0xb959('0x12'));var config=require(_0xb959('0x13'));var licenseUtil=require(_0xb959('0x14'));var db=require(_0xb959('0x15'))['db'];config[_0xb959('0x16')]=_['defaults'](config[_0xb959('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xb959('0x17'))(new Redis(config[_0xb959('0x16')]));require('./voiceQueueReport.socket')[_0xb959('0x18')](socket);function respondWithStatusCode(_0x3a1c3e,_0x21470f){_0x21470f=_0x21470f||0xcc;return function(_0x3e3028){if(_0x3e3028){return _0x3a1c3e[_0xb959('0x19')](_0x21470f);}return _0x3a1c3e[_0xb959('0x1a')](_0x21470f)[_0xb959('0x1b')]();};}function respondWithResult(_0x216d83,_0x58a2ba){_0x58a2ba=_0x58a2ba||0xc8;return function(_0x4e0e45){if(_0x4e0e45){return _0x216d83[_0xb959('0x1a')](_0x58a2ba)['json'](_0x4e0e45);}};}function respondWithFilteredResult(_0x3306d9,_0x4b513){return function(_0x276a7a){if(_0x276a7a){var _0x4990cf=typeof _0x4b513[_0xb959('0x1c')]===_0xb959('0x1d')&&typeof _0x4b513[_0xb959('0x1e')]==='undefined';var _0x57f3a9=_0x276a7a[_0xb959('0x1f')];var _0x533837=_0x4990cf?0x0:_0x4b513[_0xb959('0x1c')];var _0x13cf27=_0x4990cf?_0x276a7a[_0xb959('0x1f')]:_0x4b513[_0xb959('0x1c')]+_0x4b513['limit'];var _0x389fc5;if(_0x13cf27>=_0x57f3a9){_0x13cf27=_0x57f3a9;_0x389fc5=0xc8;}else{_0x389fc5=0xce;}_0x3306d9[_0xb959('0x1a')](_0x389fc5);return _0x3306d9[_0xb959('0x20')](_0xb959('0x21'),_0x533837+'-'+_0x13cf27+'/'+_0x57f3a9)[_0xb959('0x22')](_0x276a7a);}return null;};}function patchUpdates(_0x5e39c4){return function(_0x307720){try{jsonpatch['apply'](_0x307720,_0x5e39c4,!![]);}catch(_0xccae37){return BPromise[_0xb959('0x23')](_0xccae37);}return _0x307720[_0xb959('0x24')]();};}function saveUpdates(_0x4d5ff1,_0x47f690){return function(_0x455fb0){if(_0x455fb0){return _0x455fb0[_0xb959('0x25')](_0x4d5ff1)[_0xb959('0x26')](function(_0x521b05){return _0x521b05;});}return null;};}function removeEntity(_0x220384,_0x472032){return function(_0x126f1){if(_0x126f1){return _0x126f1['destroy']()[_0xb959('0x26')](function(){_0x220384[_0xb959('0x1a')](0xcc)[_0xb959('0x1b')]();});}};}function handleEntityNotFound(_0x4e5694,_0x459e62){return function(_0x5227c6){if(!_0x5227c6){_0x4e5694[_0xb959('0x19')](0x194);}return _0x5227c6;};}function handleError(_0x1f89fe,_0x174737){_0x174737=_0x174737||0x1f4;return function(_0x256cdc){logger[_0xb959('0x27')](_0x256cdc[_0xb959('0x28')]);if(_0x256cdc['name']){delete _0x256cdc[_0xb959('0x29')];}_0x1f89fe[_0xb959('0x1a')](_0x174737)[_0xb959('0x2a')](_0x256cdc);};}exports[_0xb959('0x2b')]=function(_0x42fab2,_0x273d2e){var _0x1a354e={},_0x305510={},_0xb32d42={'count':0x0,'rows':[]};var _0x407b83=_['map'](db['VoiceQueueReport'][_0xb959('0x2c')],function(_0x39d838){return{'name':_0x39d838['fieldName'],'type':_0x39d838[_0xb959('0x2d')][_0xb959('0x2e')]};});_0x305510[_0xb959('0x2f')]=_[_0xb959('0x30')](_0x407b83,_0xb959('0x29'));_0x305510[_0xb959('0x31')]=_['keys'](_0x42fab2[_0xb959('0x31')]);_0x305510['filters']=_[_0xb959('0x32')](_0x305510[_0xb959('0x2f')],_0x305510[_0xb959('0x31')]);_0x1a354e[_0xb959('0x33')]=_[_0xb959('0x32')](_0x305510[_0xb959('0x2f')],qs[_0xb959('0x34')](_0x42fab2[_0xb959('0x31')][_0xb959('0x34')]));_0x1a354e['attributes']=_0x1a354e['attributes'][_0xb959('0x35')]?_0x1a354e[_0xb959('0x33')]:_0x305510[_0xb959('0x2f')];if(!_0x42fab2[_0xb959('0x31')][_0xb959('0x36')](_0xb959('0x37'))){_0x1a354e['limit']=qs[_0xb959('0x1e')](_0x42fab2[_0xb959('0x31')]['limit']);_0x1a354e[_0xb959('0x1c')]=qs[_0xb959('0x1c')](_0x42fab2['query'][_0xb959('0x1c')]);}_0x1a354e[_0xb959('0x38')]=qs[_0xb959('0x39')](_0x42fab2['query'][_0xb959('0x39')]);_0x1a354e[_0xb959('0x3a')]=qs['filters'](_['pick'](_0x42fab2['query'],_0x305510[_0xb959('0x3b')]),_0x407b83);if(_0x42fab2['query']['filter']){_0x1a354e[_0xb959('0x3a')]=_[_0xb959('0x3c')](_0x1a354e[_0xb959('0x3a')],{'$or':_[_0xb959('0x30')](_0x407b83,function(_0xbb5c72){if(_0xbb5c72['type']!=='VIRTUAL'){var _0x22a665={};_0x22a665[_0xbb5c72[_0xb959('0x29')]]={'$like':'%'+_0x42fab2[_0xb959('0x31')][_0xb959('0x3d')]+'%'};return _0x22a665;}})});}_0x1a354e=_[_0xb959('0x3c')]({},_0x1a354e,_0x42fab2['options']);var _0x5aeff0={'where':_0x1a354e[_0xb959('0x3a')]};return db[_0xb959('0x3e')][_0xb959('0x1f')](_0x5aeff0)[_0xb959('0x26')](function(_0x4d5880){_0xb32d42['count']=_0x4d5880;if(_0x42fab2['query']['includeAll']){_0x1a354e['include']=[{'all':!![]}];}return db[_0xb959('0x3e')][_0xb959('0x3f')](_0x1a354e);})[_0xb959('0x26')](function(_0x495483){_0xb32d42[_0xb959('0x40')]=_0x495483;return _0xb32d42;})[_0xb959('0x26')](respondWithFilteredResult(_0x273d2e,_0x1a354e))['catch'](handleError(_0x273d2e,null));};exports[_0xb959('0x41')]=function(_0x5d8cd9,_0x1ded90){var _0x23ace8={'raw':![],'where':{'id':_0x5d8cd9['params']['id']}},_0x259406={};_0x259406[_0xb959('0x2f')]=_[_0xb959('0x42')](db[_0xb959('0x3e')][_0xb959('0x2c')]);_0x259406[_0xb959('0x31')]=_[_0xb959('0x42')](_0x5d8cd9['query']);_0x259406[_0xb959('0x3b')]=_[_0xb959('0x32')](_0x259406[_0xb959('0x2f')],_0x259406['query']);_0x23ace8[_0xb959('0x33')]=_[_0xb959('0x32')](_0x259406[_0xb959('0x2f')],qs[_0xb959('0x34')](_0x5d8cd9[_0xb959('0x31')][_0xb959('0x34')]));_0x23ace8[_0xb959('0x33')]=_0x23ace8[_0xb959('0x33')][_0xb959('0x35')]?_0x23ace8[_0xb959('0x33')]:_0x259406[_0xb959('0x2f')];if(_0x5d8cd9[_0xb959('0x31')][_0xb959('0x43')]){_0x23ace8[_0xb959('0x44')]=[{'all':!![]}];}_0x23ace8=_[_0xb959('0x3c')]({},_0x23ace8,_0x5d8cd9['options']);return db[_0xb959('0x3e')][_0xb959('0x45')](_0x23ace8)['then'](handleEntityNotFound(_0x1ded90,null))[_0xb959('0x26')](respondWithResult(_0x1ded90,null))[_0xb959('0x46')](handleError(_0x1ded90,null));};exports['create']=function(_0x15f9fa,_0x276f82){return db[_0xb959('0x3e')][_0xb959('0x47')](_0x15f9fa[_0xb959('0x48')],{})['then'](respondWithResult(_0x276f82,0xc9))[_0xb959('0x46')](handleError(_0x276f82,null));};exports[_0xb959('0x25')]=function(_0x157804,_0x50b005){if(_0x157804[_0xb959('0x48')]['id']){delete _0x157804[_0xb959('0x48')]['id'];}return db[_0xb959('0x3e')]['find']({'where':{'id':_0x157804['params']['id']}})[_0xb959('0x26')](handleEntityNotFound(_0x50b005,null))[_0xb959('0x26')](saveUpdates(_0x157804['body'],null))[_0xb959('0x26')](respondWithResult(_0x50b005,null))[_0xb959('0x46')](handleError(_0x50b005,null));};exports[_0xb959('0x49')]=function(_0x31d4e1,_0x3cd64e){return db[_0xb959('0x3e')][_0xb959('0x45')]({'where':{'id':_0x31d4e1['params']['id']}})[_0xb959('0x26')](handleEntityNotFound(_0x3cd64e,null))['then'](removeEntity(_0x3cd64e,null))['catch'](handleError(_0x3cd64e,null));};exports[_0xb959('0x4a')]=function(_0x5e3efd,_0x2f4cd6){return db[_0xb959('0x3e')][_0xb959('0x4a')]()[_0xb959('0x26')](respondWithResult(_0x2f4cd6,null))[_0xb959('0x46')](handleError(_0x2f4cd6,null));};exports[_0xb959('0x4b')]=function(_0x27a6bd,_0x3dc8d7){var _0x477216={},_0x125567={},_0x3f66e8={'count':0x0,'rows':[]};_0x125567[_0xb959('0x2f')]=_[_0xb959('0x42')](db['VoiceQueueReport'][_0xb959('0x2c')]);_0x125567[_0xb959('0x31')]=_[_0xb959('0x42')](_0x27a6bd[_0xb959('0x31')]);_0x125567['filters']=_['intersection'](_0x125567[_0xb959('0x2f')],_0x125567[_0xb959('0x31')]);_0x477216[_0xb959('0x33')]=_['intersection'](_0x125567['model'],qs[_0xb959('0x34')](_0x27a6bd[_0xb959('0x31')][_0xb959('0x34')]));_0x477216[_0xb959('0x33')]=_0x477216[_0xb959('0x33')]['length']?_0x477216[_0xb959('0x33')]:_0x125567[_0xb959('0x2f')];if(!_0x27a6bd[_0xb959('0x31')][_0xb959('0x36')](_0xb959('0x37'))){_0x477216[_0xb959('0x1e')]=qs[_0xb959('0x1e')](_0x27a6bd[_0xb959('0x31')]['limit']);_0x477216[_0xb959('0x1c')]=qs[_0xb959('0x1c')](_0x27a6bd[_0xb959('0x31')][_0xb959('0x1c')]);}_0x477216[_0xb959('0x38')]=qs[_0xb959('0x39')](_0x27a6bd[_0xb959('0x31')][_0xb959('0x39')]);_0x477216['where']=qs[_0xb959('0x3b')](_['pick'](_0x27a6bd[_0xb959('0x31')],_0x125567[_0xb959('0x3b')]));if(_0x27a6bd[_0xb959('0x31')][_0xb959('0x3d')]){_0x477216[_0xb959('0x3a')]=_[_0xb959('0x3c')](_0x477216[_0xb959('0x3a')],{'$or':_[_0xb959('0x30')](_0x477216[_0xb959('0x33')],function(_0x3181e9){var _0x32c736={};_0x32c736[_0x3181e9]={'$like':'%'+_0x27a6bd['query'][_0xb959('0x3d')]+'%'};return _0x32c736;})});}_0x477216=_['merge']({},_0x477216,_0x27a6bd[_0xb959('0x4c')]);var _0x5eef94={'where':_0x477216[_0xb959('0x3a')]};return db[_0xb959('0x3e')][_0xb959('0x1f')](_0x5eef94)[_0xb959('0x26')](function(_0x3cb6a8){_0x3f66e8[_0xb959('0x1f')]=_0x3cb6a8;if(_0x27a6bd[_0xb959('0x31')][_0xb959('0x43')]){_0x477216['include']=[{'all':!![]}];}return db[_0xb959('0x3e')][_0xb959('0x3f')](_0x477216);})[_0xb959('0x26')](function(_0x5baace){_0x3f66e8['rows']=_0x5baace;return _0x3f66e8;})['then'](respondWithFilteredResult(_0x3dc8d7,_0x477216,_0xb959('0x4b')))[_0xb959('0x46')](handleError(_0x3dc8d7,null,_0xb959('0x4b')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 3892542..9f0f700 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 _0x672d=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoiceQueueReport'];(function(_0x33b9ac,_0x1cd671){var _0x4da2a0=function(_0x62ec6b){while(--_0x62ec6b){_0x33b9ac['push'](_0x33b9ac['shift']());}};_0x4da2a0(++_0x1cd671);}(_0x672d,0xc3));var _0xd672=function(_0x4f5f6c,_0x15a990){_0x4f5f6c=_0x4f5f6c-0x0;var _0x3f3fba=_0x672d[_0x4f5f6c];return _0x3f3fba;};'use strict';var EventEmitter=require(_0xd672('0x0'));var VoiceQueueReport=require(_0xd672('0x1'))['db'][_0xd672('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd672('0x3'),'afterUpdate':_0xd672('0x4'),'afterDestroy':_0xd672('0x5')};function emitEvent(_0x5bde88){return function(_0x526b20,_0x1619bc,_0x33e2fc){VoiceQueueReportEvents[_0xd672('0x6')](_0x5bde88+':'+_0x526b20['id'],_0x526b20);VoiceQueueReportEvents[_0xd672('0x6')](_0x5bde88,_0x526b20);_0x33e2fc(null);};}for(var e in events){if(events[_0xd672('0x7')](e)){var event=events[e];VoiceQueueReport[_0xd672('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x7295=['remove','emit','hook','exports','events','../../mysqldb','VoiceQueueReport','save','update'];(function(_0x3ed95e,_0x2d2d13){var _0x4ab531=function(_0x4823b4){while(--_0x4823b4){_0x3ed95e['push'](_0x3ed95e['shift']());}};_0x4ab531(++_0x2d2d13);}(_0x7295,0xe5));var _0x5729=function(_0x14a54b,_0x3eec32){_0x14a54b=_0x14a54b-0x0;var _0x5b5e4b=_0x7295[_0x14a54b];return _0x5b5e4b;};'use strict';var EventEmitter=require(_0x5729('0x0'));var VoiceQueueReport=require(_0x5729('0x1'))['db'][_0x5729('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5729('0x3'),'afterUpdate':_0x5729('0x4'),'afterDestroy':_0x5729('0x5')};function emitEvent(_0x4b2069){return function(_0x1090fc,_0x1bac39,_0x2a469b){VoiceQueueReportEvents[_0x5729('0x6')](_0x4b2069+':'+_0x1090fc['id'],_0x1090fc);VoiceQueueReportEvents[_0x5729('0x6')](_0x4b2069,_0x1090fc);_0x2a469b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x5729('0x7')](e,emitEvent(event));}}module[_0x5729('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 19dc0fd..6aaf699 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 _0xae6b=['rimraf','exports','define','VoiceQueueReport','uniqueid','calleridnum','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3c3a36,_0x49c795){var _0x477e6a=function(_0x171741){while(--_0x171741){_0x3c3a36['push'](_0x3c3a36['shift']());}};_0x477e6a(++_0x49c795);}(_0xae6b,0x158));var _0xbae6=function(_0x55042e,_0x10aa58){_0x55042e=_0x55042e-0x0;var _0x9871fc=_0xae6b[_0x55042e];return _0x9871fc;};'use strict';var _=require(_0xbae6('0x0'));var util=require('util');var logger=require(_0xbae6('0x1'))(_0xbae6('0x2'));var moment=require(_0xbae6('0x3'));var BPromise=require(_0xbae6('0x4'));var rp=require(_0xbae6('0x5'));var fs=require('fs');var path=require(_0xbae6('0x6'));var rimraf=require(_0xbae6('0x7'));var config=require('../../config/environment');var attributes=require('./voiceQueueReport.attributes');module[_0xbae6('0x8')]=function(_0x47597b,_0x24e0ad){return _0x47597b[_0xbae6('0x9')](_0xbae6('0xa'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xbae6('0xb')]},{'fields':[_0xbae6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x742c=['./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','calleridnum','lodash','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x26a74d,_0x37ecfc){var _0xcbb1a3=function(_0x24b978){while(--_0x24b978){_0x26a74d['push'](_0x26a74d['shift']());}};_0xcbb1a3(++_0x37ecfc);}(_0x742c,0x14a));var _0xc742=function(_0x51674a,_0x77ccff){_0x51674a=_0x51674a-0x0;var _0x13fca6=_0x742c[_0x51674a];return _0x13fca6;};'use strict';var _=require(_0xc742('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc742('0x1'));var moment=require(_0xc742('0x2'));var BPromise=require(_0xc742('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc742('0x4'));var config=require(_0xc742('0x5'));var attributes=require(_0xc742('0x6'));module[_0xc742('0x7')]=function(_0x4286ae,_0x173b88){return _0x4286ae[_0xc742('0x8')](_0xc742('0x9'),attributes,{'tableName':_0xc742('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xc742('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index a785fca..9e0385c 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 _0xa99a=['model','attributes','CreateVoiceQueueReport','UpdateVoiceQueueReport','body','lodash','util','moment','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then','info','debug','request\x20sent','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','limit','map','include'];(function(_0x389a26,_0x389051){var _0x12c638=function(_0x35e5bd){while(--_0x35e5bd){_0x389a26['push'](_0x389a26['shift']());}};_0x12c638(++_0x389051);}(_0xa99a,0x1a7));var _0xaa99=function(_0x3177b1,_0x4d2db0){_0x3177b1=_0x3177b1-0x0;var _0x867a86=_0xa99a[_0x3177b1];return _0x867a86;};'use strict';var _=require(_0xaa99('0x0'));var util=require(_0xaa99('0x1'));var moment=require(_0xaa99('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xaa99('0x3'));var logger=require(_0xaa99('0x4'))(_0xaa99('0x5'));var config=require('../../config/environment');var jayson=require(_0xaa99('0x6'));var client=jayson['client'][_0xaa99('0x7')]({'port':0x232a});config[_0xaa99('0x8')]=_['defaults'](config[_0xaa99('0x8')],{'host':_0xaa99('0x9'),'port':0x18eb});var socket=require(_0xaa99('0xa'))(new Redis(config['redis']));require(_0xaa99('0xb'))['register'](socket);function respondWithRpcPromise(_0x3ac071,_0x1e26d7,_0x1a1610){return new BPromise(function(_0x2cf89f,_0x413ec9){return client[_0xaa99('0xc')](_0x3ac071,_0x1a1610)[_0xaa99('0xd')](function(_0x142176){logger[_0xaa99('0xe')]('VoiceQueueReport,\x20%s,\x20%s',_0x1e26d7,'request\x20sent');logger[_0xaa99('0xf')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x1e26d7,_0xaa99('0x10'),JSON[_0xaa99('0x11')](_0x142176));if(_0x142176[_0xaa99('0x12')]){if(_0x142176[_0xaa99('0x12')][_0xaa99('0x13')]===0x1f4){logger[_0xaa99('0x12')](_0xaa99('0x14'),_0x1e26d7,_0x142176['error'][_0xaa99('0x15')]);return _0x413ec9(_0x142176[_0xaa99('0x12')][_0xaa99('0x15')]);}logger[_0xaa99('0x12')](_0xaa99('0x14'),_0x1e26d7,_0x142176[_0xaa99('0x12')]['message']);return _0x2cf89f(_0x142176[_0xaa99('0x12')][_0xaa99('0x15')]);}else{logger[_0xaa99('0xe')](_0xaa99('0x14'),_0x1e26d7,_0xaa99('0x10'));_0x2cf89f(_0x142176[_0xaa99('0x16')][_0xaa99('0x15')]);}})[_0xaa99('0x17')](function(_0x2c0dee){logger[_0xaa99('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x1e26d7,_0x2c0dee);_0x413ec9(_0x2c0dee);});});}exports[_0xaa99('0x18')]=function(_0x15d0f6){var _0x472bbc=this;return new Promise(function(_0x102e26,_0xa7abf){return db[_0xaa99('0x19')][_0xaa99('0x1a')]({'raw':_0x15d0f6['options']?_0x15d0f6[_0xaa99('0x1b')][_0xaa99('0x1c')]===undefined?!![]:![]:!![],'where':_0x15d0f6['options']?_0x15d0f6[_0xaa99('0x1b')][_0xaa99('0x1d')]||null:null,'attributes':_0x15d0f6[_0xaa99('0x1b')]?_0x15d0f6[_0xaa99('0x1b')]['attributes']||null:null,'limit':_0x15d0f6['options']?_0x15d0f6[_0xaa99('0x1b')][_0xaa99('0x1e')]||null:null,'include':_0x15d0f6[_0xaa99('0x1b')]?_0x15d0f6[_0xaa99('0x1b')]['include']?_[_0xaa99('0x1f')](_0x15d0f6[_0xaa99('0x1b')][_0xaa99('0x20')],function(_0x353497){return{'model':db[_0x353497[_0xaa99('0x21')]],'as':_0x353497['as'],'attributes':_0x353497[_0xaa99('0x22')],'include':_0x353497[_0xaa99('0x20')]?_[_0xaa99('0x1f')](_0x353497['include'],function(_0x2bdfcc){return{'model':db[_0x2bdfcc[_0xaa99('0x21')]],'as':_0x2bdfcc['as'],'attributes':_0x2bdfcc[_0xaa99('0x22')],'include':_0x2bdfcc[_0xaa99('0x20')]?_[_0xaa99('0x1f')](_0x2bdfcc[_0xaa99('0x20')],function(_0x1a9df0){return{'model':db[_0x1a9df0[_0xaa99('0x21')]],'as':_0x1a9df0['as'],'attributes':_0x1a9df0[_0xaa99('0x22')]};}):[]};}):[]};}):[]:[]})[_0xaa99('0xd')](function(_0x10cd42){logger['info']('GetVoiceQueueReport',_0x15d0f6);logger[_0xaa99('0xf')](_0xaa99('0x18'),_0x15d0f6,JSON[_0xaa99('0x11')](_0x10cd42));_0x102e26(_0x10cd42);})['catch'](function(_0x2bf791){logger[_0xaa99('0x12')](_0xaa99('0x18'),_0x2bf791[_0xaa99('0x15')],_0x15d0f6);_0xa7abf(_0x472bbc[_0xaa99('0x12')](0x1f4,_0x2bf791[_0xaa99('0x15')]));});});};exports[_0xaa99('0x23')]=function(_0x29ef9b){var _0x56faf7=this;return new Promise(function(_0x26c402,_0x51dce1){return db[_0xaa99('0x19')]['create'](_0x29ef9b['body'],{'raw':_0x29ef9b[_0xaa99('0x1b')]?_0x29ef9b[_0xaa99('0x1b')][_0xaa99('0x1c')]===undefined?!![]:![]:!![]})[_0xaa99('0xd')](function(_0x3e973a){logger[_0xaa99('0xe')]('CreateVoiceQueueReport',_0x29ef9b);logger['debug'](_0xaa99('0x23'),_0x29ef9b,JSON['stringify'](_0x3e973a));_0x26c402(_0x3e973a);})['catch'](function(_0x108689){logger[_0xaa99('0x12')](_0xaa99('0x23'),_0x108689['message'],_0x29ef9b);_0x51dce1(_0x56faf7['error'](0x1f4,_0x108689[_0xaa99('0x15')]));});});};exports[_0xaa99('0x24')]=function(_0x59f7a8){var _0x3ab968=this;return new Promise(function(_0xced023,_0x5655e6){return db[_0xaa99('0x19')]['update'](_0x59f7a8[_0xaa99('0x25')],{'raw':_0x59f7a8['options']?_0x59f7a8['options'][_0xaa99('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59f7a8[_0xaa99('0x1b')]?_0x59f7a8[_0xaa99('0x1b')]['where']||null:null,'attributes':_0x59f7a8[_0xaa99('0x1b')]?_0x59f7a8[_0xaa99('0x1b')][_0xaa99('0x22')]||null:null,'limit':_0x59f7a8[_0xaa99('0x1b')]?_0x59f7a8[_0xaa99('0x1b')][_0xaa99('0x1e')]||null:null})[_0xaa99('0xd')](function(_0x41f190){logger[_0xaa99('0xe')]('UpdateVoiceQueueReport',_0x59f7a8);logger[_0xaa99('0xf')]('UpdateVoiceQueueReport',_0x59f7a8,JSON[_0xaa99('0x11')](_0x41f190));_0xced023(_0x41f190);})[_0xaa99('0x17')](function(_0x4fc51b){logger[_0xaa99('0x12')](_0xaa99('0x24'),_0x4fc51b[_0xaa99('0x15')],_0x59f7a8);_0x5655e6(_0x3ab968[_0xaa99('0x12')](0x1f4,_0x4fc51b[_0xaa99('0x15')]));});});}; \ No newline at end of file +var _0x9deb=['attributes','limit','include','map','model','then','CreateVoiceQueueReport','VoiceQueueReport','body','raw','debug','UpdateVoiceQueueReport','update','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetVoiceQueueReport','options','where'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x9deb,0x125));var _0xb9de=function(_0x61c0b1,_0x4c07f3){_0x61c0b1=_0x61c0b1-0x0;var _0x5f2d2e=_0x9deb[_0x61c0b1];return _0x5f2d2e;};'use strict';var _=require('lodash');var util=require(_0xb9de('0x0'));var moment=require(_0xb9de('0x1'));var BPromise=require(_0xb9de('0x2'));var rs=require(_0xb9de('0x3'));var fs=require('fs');var Redis=require(_0xb9de('0x4'));var db=require(_0xb9de('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb9de('0x6'))('rpc');var config=require(_0xb9de('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb9de('0x8')][_0xb9de('0x9')]({'port':0x232a});config[_0xb9de('0xa')]=_[_0xb9de('0xb')](config[_0xb9de('0xa')],{'host':_0xb9de('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb9de('0xd'))[_0xb9de('0xe')](socket);function respondWithRpcPromise(_0x134f0b,_0x21f9e9,_0x3d5ad6){return new BPromise(function(_0x33f422,_0x22fefa){return client[_0xb9de('0xf')](_0x134f0b,_0x3d5ad6)['then'](function(_0xee1073){logger[_0xb9de('0x10')](_0xb9de('0x11'),_0x21f9e9,_0xb9de('0x12'));logger['debug'](_0xb9de('0x13'),_0x21f9e9,'request\x20sent',JSON[_0xb9de('0x14')](_0xee1073));if(_0xee1073[_0xb9de('0x15')]){if(_0xee1073[_0xb9de('0x15')]['code']===0x1f4){logger[_0xb9de('0x15')](_0xb9de('0x11'),_0x21f9e9,_0xee1073[_0xb9de('0x15')]['message']);return _0x22fefa(_0xee1073[_0xb9de('0x15')][_0xb9de('0x16')]);}logger[_0xb9de('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x21f9e9,_0xee1073[_0xb9de('0x15')][_0xb9de('0x16')]);return _0x33f422(_0xee1073['error'][_0xb9de('0x16')]);}else{logger['info'](_0xb9de('0x11'),_0x21f9e9,_0xb9de('0x12'));_0x33f422(_0xee1073['result'][_0xb9de('0x16')]);}})[_0xb9de('0x17')](function(_0x14a346){logger[_0xb9de('0x15')](_0xb9de('0x11'),_0x21f9e9,_0x14a346);_0x22fefa(_0x14a346);});});}exports[_0xb9de('0x18')]=function(_0x3d6e3e){var _0x47e6e5=this;return new Promise(function(_0x542c72,_0x159961){return db['VoiceQueueReport']['findAll']({'raw':_0x3d6e3e[_0xb9de('0x19')]?_0x3d6e3e[_0xb9de('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3d6e3e[_0xb9de('0x19')]?_0x3d6e3e[_0xb9de('0x19')][_0xb9de('0x1a')]||null:null,'attributes':_0x3d6e3e[_0xb9de('0x19')]?_0x3d6e3e['options'][_0xb9de('0x1b')]||null:null,'limit':_0x3d6e3e['options']?_0x3d6e3e['options'][_0xb9de('0x1c')]||null:null,'include':_0x3d6e3e[_0xb9de('0x19')]?_0x3d6e3e[_0xb9de('0x19')][_0xb9de('0x1d')]?_[_0xb9de('0x1e')](_0x3d6e3e[_0xb9de('0x19')][_0xb9de('0x1d')],function(_0x259e26){return{'model':db[_0x259e26['model']],'as':_0x259e26['as'],'attributes':_0x259e26[_0xb9de('0x1b')],'include':_0x259e26[_0xb9de('0x1d')]?_[_0xb9de('0x1e')](_0x259e26[_0xb9de('0x1d')],function(_0x3a7ea9){return{'model':db[_0x3a7ea9[_0xb9de('0x1f')]],'as':_0x3a7ea9['as'],'attributes':_0x3a7ea9[_0xb9de('0x1b')],'include':_0x3a7ea9[_0xb9de('0x1d')]?_[_0xb9de('0x1e')](_0x3a7ea9[_0xb9de('0x1d')],function(_0x468dfe){return{'model':db[_0x468dfe[_0xb9de('0x1f')]],'as':_0x468dfe['as'],'attributes':_0x468dfe[_0xb9de('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb9de('0x20')](function(_0x16593b){logger['info'](_0xb9de('0x18'),_0x3d6e3e);logger['debug'](_0xb9de('0x18'),_0x3d6e3e,JSON['stringify'](_0x16593b));_0x542c72(_0x16593b);})[_0xb9de('0x17')](function(_0x18b10){logger['error'](_0xb9de('0x18'),_0x18b10[_0xb9de('0x16')],_0x3d6e3e);_0x159961(_0x47e6e5[_0xb9de('0x15')](0x1f4,_0x18b10[_0xb9de('0x16')]));});});};exports[_0xb9de('0x21')]=function(_0x49d49a){var _0x11224e=this;return new Promise(function(_0x499bae,_0x293237){return db[_0xb9de('0x22')]['create'](_0x49d49a[_0xb9de('0x23')],{'raw':_0x49d49a['options']?_0x49d49a[_0xb9de('0x19')][_0xb9de('0x24')]===undefined?!![]:![]:!![]})[_0xb9de('0x20')](function(_0x308174){logger[_0xb9de('0x10')](_0xb9de('0x21'),_0x49d49a);logger[_0xb9de('0x25')](_0xb9de('0x21'),_0x49d49a,JSON['stringify'](_0x308174));_0x499bae(_0x308174);})['catch'](function(_0x3f62c0){logger['error'](_0xb9de('0x21'),_0x3f62c0[_0xb9de('0x16')],_0x49d49a);_0x293237(_0x11224e[_0xb9de('0x15')](0x1f4,_0x3f62c0[_0xb9de('0x16')]));});});};exports[_0xb9de('0x26')]=function(_0x5e08a7){var _0x1a6bfd=this;return new Promise(function(_0x3bc676,_0x6d43f3){return db[_0xb9de('0x22')][_0xb9de('0x27')](_0x5e08a7['body'],{'raw':_0x5e08a7[_0xb9de('0x19')]?_0x5e08a7[_0xb9de('0x19')][_0xb9de('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e08a7[_0xb9de('0x19')]?_0x5e08a7[_0xb9de('0x19')][_0xb9de('0x1a')]||null:null,'attributes':_0x5e08a7[_0xb9de('0x19')]?_0x5e08a7[_0xb9de('0x19')][_0xb9de('0x1b')]||null:null,'limit':_0x5e08a7['options']?_0x5e08a7[_0xb9de('0x19')][_0xb9de('0x1c')]||null:null})['then'](function(_0x5f369f){logger[_0xb9de('0x10')]('UpdateVoiceQueueReport',_0x5e08a7);logger[_0xb9de('0x25')]('UpdateVoiceQueueReport',_0x5e08a7,JSON[_0xb9de('0x14')](_0x5f369f));_0x3bc676(_0x5f369f);})[_0xb9de('0x17')](function(_0x2b2dfc){logger[_0xb9de('0x15')]('UpdateVoiceQueueReport',_0x2b2dfc[_0xb9de('0x16')],_0x5e08a7);_0x6d43f3(_0x1a6bfd['error'](0x1f4,_0x2b2dfc[_0xb9de('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 6f2571c..ac86ad5 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 _0x1061=['register','voiceQueueReport:','./voiceQueueReport.events','emit','removeListener'];(function(_0x54a28a,_0x1ba1fe){var _0x3da1f1=function(_0x7231b5){while(--_0x7231b5){_0x54a28a['push'](_0x54a28a['shift']());}};_0x3da1f1(++_0x1ba1fe);}(_0x1061,0x1b5));var _0x1106=function(_0x3cc670,_0x4e515f){_0x3cc670=_0x3cc670-0x0;var _0x222f13=_0x1061[_0x3cc670];return _0x222f13;};'use strict';var VoiceQueueReportEvents=require(_0x1106('0x0'));var events=['save','remove','update'];function createListener(_0x986553,_0x3a9fe3){return function(_0x3362fc){_0x3a9fe3[_0x1106('0x1')](_0x986553,_0x3362fc);};}function removeListener(_0x1c1bae,_0x13fcfc){return function(){VoiceQueueReportEvents[_0x1106('0x2')](_0x1c1bae,_0x13fcfc);};}exports[_0x1106('0x3')]=function(_0x5120c6){for(var _0x1f098a=0x0,_0x36bfb3=events['length'];_0x1f098a<_0x36bfb3;_0x1f098a++){var _0x523f0f=events[_0x1f098a];var _0x287336=createListener(_0x1106('0x4')+_0x523f0f,_0x5120c6);VoiceQueueReportEvents['on'](_0x523f0f,_0x287336);}}; \ No newline at end of file +var _0x008c=['./voiceQueueReport.events','save','remove','update','emit','removeListener','register','voiceQueueReport:'];(function(_0x13f2d6,_0x1cbf18){var _0x4a8b4f=function(_0x43753a){while(--_0x43753a){_0x13f2d6['push'](_0x13f2d6['shift']());}};_0x4a8b4f(++_0x1cbf18);}(_0x008c,0x188));var _0xc008=function(_0x263b1f,_0x3f2376){_0x263b1f=_0x263b1f-0x0;var _0x4aa612=_0x008c[_0x263b1f];return _0x4aa612;};'use strict';var VoiceQueueReportEvents=require(_0xc008('0x0'));var events=[_0xc008('0x1'),_0xc008('0x2'),_0xc008('0x3')];function createListener(_0x1d119a,_0x544fdf){return function(_0x3641af){_0x544fdf[_0xc008('0x4')](_0x1d119a,_0x3641af);};}function removeListener(_0x10b33c,_0x163bd9){return function(){VoiceQueueReportEvents[_0xc008('0x5')](_0x10b33c,_0x163bd9);};}exports[_0xc008('0x6')]=function(_0x13aa7){for(var _0x39bb5e=0x0,_0x9c8cb2=events['length'];_0x39bb5e<_0x9c8cb2;_0x39bb5e++){var _0x428fa9=events[_0x39bb5e];var _0x5aa09b=createListener(_0xc008('0x7')+_0x428fa9,_0x13aa7);VoiceQueueReportEvents['on'](_0x428fa9,_0x5aa09b);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 16bb6df..ed84f1f 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 _0x84fe=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x221a48,_0x5d80f1){var _0x298b2e=function(_0x40df28){while(--_0x40df28){_0x221a48['push'](_0x221a48['shift']());}};_0x298b2e(++_0x5d80f1);}(_0x84fe,0xdb));var _0xe84f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x84fe[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xe84f('0x0'));var util=require(_0xe84f('0x1'));var path=require(_0xe84f('0x2'));var timeout=require(_0xe84f('0x3'));var express=require(_0xe84f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe84f('0x5'));var interaction=require(_0xe84f('0x6'));var config=require(_0xe84f('0x7'));var controller=require('./voiceQueuesLog.controller');router[_0xe84f('0x8')]('/',auth[_0xe84f('0x9')](),controller[_0xe84f('0xa')]);router['get'](_0xe84f('0xb'),auth[_0xe84f('0x9')](),controller['show']);router[_0xe84f('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xe84f('0xb'),auth[_0xe84f('0x9')](),controller[_0xe84f('0xd')]);router['delete'](_0xe84f('0xb'),auth[_0xe84f('0x9')](),controller[_0xe84f('0xe')]);module[_0xe84f('0xf')]=router; \ No newline at end of file +var _0x88ea=['post','create','put','update','delete','destroy','util','express','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id'];(function(_0x4f0637,_0x321cde){var _0x43d41d=function(_0x4cde39){while(--_0x4cde39){_0x4f0637['push'](_0x4f0637['shift']());}};_0x43d41d(++_0x321cde);}(_0x88ea,0x110));var _0xa88e=function(_0x87bed7,_0x509ffc){_0x87bed7=_0x87bed7-0x0;var _0x57bf7d=_0x88ea[_0x87bed7];return _0x57bf7d;};'use strict';var multer=require('multer');var util=require(_0xa88e('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa88e('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa88e('0x2'));var config=require(_0xa88e('0x3'));var controller=require(_0xa88e('0x4'));router[_0xa88e('0x5')]('/',auth[_0xa88e('0x6')](),controller['index']);router[_0xa88e('0x5')](_0xa88e('0x7'),auth[_0xa88e('0x6')](),controller['show']);router[_0xa88e('0x8')]('/',auth[_0xa88e('0x6')](),controller[_0xa88e('0x9')]);router[_0xa88e('0xa')](_0xa88e('0x7'),auth['isAuthenticated'](),controller[_0xa88e('0xb')]);router[_0xa88e('0xc')](_0xa88e('0x7'),auth['isAuthenticated'](),controller[_0xa88e('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index cf6549e..8eca98d 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 _0x54a1=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','STRING'];(function(_0x11b1b3,_0xf3cc69){var _0x437029=function(_0x40499a){while(--_0x40499a){_0x11b1b3['push'](_0x11b1b3['shift']());}};_0x437029(++_0xf3cc69);}(_0x54a1,0xa1));var _0x154a=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x54a1[_0x486f4a];return _0x135d99;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'time':{'type':Sequelize[_0x154a('0x0')]},'callid':{'type':Sequelize[_0x154a('0x0')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x154a('0x0')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x154a('0x0')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x154a('0x0')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x154a('0x0')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x154a('0x0')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x154a('0x0')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x154a('0x0')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x154a('0x1')](_0x154a('0x2'))}}; \ No newline at end of file +var _0x87b9=['sequelize','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x487a42,_0x5bebe9){var _0x4c9510=function(_0xf266d3){while(--_0xf266d3){_0x487a42['push'](_0x487a42['shift']());}};_0x4c9510(++_0x5bebe9);}(_0x87b9,0xf5));var _0x987b=function(_0x27fad0,_0x2168d6){_0x27fad0=_0x27fad0-0x0;var _0x4d373a=_0x87b9[_0x27fad0];return _0x4d373a;};'use strict';var Sequelize=require(_0x987b('0x0'));var moment=require('moment');module['exports']={'time':{'type':Sequelize[_0x987b('0x1')]},'callid':{'type':Sequelize[_0x987b('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x987b('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x987b('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x987b('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x987b('0x2')],'allowNull':![],'defaultValue':Sequelize[_0x987b('0x3')](_0x987b('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index dc48626..d26d0dc 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 _0x150b=['apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','VoiceQueuesLog','count','includeAll','include','findAll','catch','show','params','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','offset','limit','Content-Range'];(function(_0x3f59b1,_0x25cdbe){var _0x11d2e8=function(_0x37b3fc){while(--_0x37b3fc){_0x3f59b1['push'](_0x3f59b1['shift']());}};_0x11d2e8(++_0x25cdbe);}(_0x150b,0xc2));var _0xb150=function(_0x1394a2,_0x533264){_0x1394a2=_0x1394a2-0x0;var _0x31dcd1=_0x150b[_0x1394a2];return _0x31dcd1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb150('0x0'));var zipdir=require(_0xb150('0x1'));var jsonpatch=require(_0xb150('0x2'));var rp=require(_0xb150('0x3'));var moment=require(_0xb150('0x4'));var BPromise=require(_0xb150('0x5'));var Mustache=require(_0xb150('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb150('0x7'));var csv=require(_0xb150('0x8'));var ejs=require(_0xb150('0x9'));var fs=require('fs');var fs_extra=require(_0xb150('0xa'));var _=require(_0xb150('0xb'));var squel=require('squel');var crypto=require(_0xb150('0xc'));var jsforce=require(_0xb150('0xd'));var deskjs=require(_0xb150('0xe'));var toCsv=require(_0xb150('0x8'));var querystring=require(_0xb150('0xf'));var Papa=require('papaparse');var Redis=require(_0xb150('0x10'));var authService=require(_0xb150('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb150('0x12'));var hardwareService=require(_0xb150('0x13'));var logger=require(_0xb150('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xb150('0x15'));var licenseUtil=require(_0xb150('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x280e7e,_0x1481c2){_0x1481c2=_0x1481c2||0xcc;return function(_0x1beaee){if(_0x1beaee){return _0x280e7e[_0xb150('0x17')](_0x1481c2);}return _0x280e7e[_0xb150('0x18')](_0x1481c2)[_0xb150('0x19')]();};}function respondWithResult(_0x26a21b,_0x3ba25d){_0x3ba25d=_0x3ba25d||0xc8;return function(_0x5c0da7){if(_0x5c0da7){return _0x26a21b[_0xb150('0x18')](_0x3ba25d)[_0xb150('0x1a')](_0x5c0da7);}};}function respondWithFilteredResult(_0x225415,_0x14ddda){return function(_0x2ade2e){if(_0x2ade2e){var _0x2210f4=typeof _0x14ddda['offset']===_0xb150('0x1b')&&typeof _0x14ddda['limit']===_0xb150('0x1b');var _0x205c0e=_0x2ade2e['count'];var _0x3554ab=_0x2210f4?0x0:_0x14ddda[_0xb150('0x1c')];var _0x5c3648=_0x2210f4?_0x2ade2e['count']:_0x14ddda[_0xb150('0x1c')]+_0x14ddda[_0xb150('0x1d')];var _0xe1cc13;if(_0x5c3648>=_0x205c0e){_0x5c3648=_0x205c0e;_0xe1cc13=0xc8;}else{_0xe1cc13=0xce;}_0x225415['status'](_0xe1cc13);return _0x225415['set'](_0xb150('0x1e'),_0x3554ab+'-'+_0x5c3648+'/'+_0x205c0e)['json'](_0x2ade2e);}return null;};}function patchUpdates(_0xad69ed){return function(_0x311188){try{jsonpatch[_0xb150('0x1f')](_0x311188,_0xad69ed,!![]);}catch(_0x3c5447){return BPromise[_0xb150('0x20')](_0x3c5447);}return _0x311188[_0xb150('0x21')]();};}function saveUpdates(_0x606e81,_0x5235d8){return function(_0x2d7308){if(_0x2d7308){return _0x2d7308[_0xb150('0x22')](_0x606e81)[_0xb150('0x23')](function(_0x4b4e69){return _0x4b4e69;});}return null;};}function removeEntity(_0x4c0fc4,_0x344ecf){return function(_0x273770){if(_0x273770){return _0x273770[_0xb150('0x24')]()['then'](function(){_0x4c0fc4[_0xb150('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28a349,_0x9bef1d){return function(_0x4dd7da){if(!_0x4dd7da){_0x28a349[_0xb150('0x17')](0x194);}return _0x4dd7da;};}function handleError(_0x5463da,_0xe88b57){_0xe88b57=_0xe88b57||0x1f4;return function(_0x321706){logger[_0xb150('0x25')](_0x321706[_0xb150('0x26')]);if(_0x321706['name']){delete _0x321706[_0xb150('0x27')];}_0x5463da['status'](_0xe88b57)[_0xb150('0x28')](_0x321706);};}exports[_0xb150('0x29')]=function(_0x2efa6a,_0x42d321){var _0x185b4a={},_0x2db855={},_0x5845d5={'count':0x0,'rows':[]};var _0x5f4f19=_[_0xb150('0x2a')](db['VoiceQueuesLog'][_0xb150('0x2b')],function(_0x32f5ec){return{'name':_0x32f5ec[_0xb150('0x2c')],'type':_0x32f5ec['type']['key']};});_0x2db855[_0xb150('0x2d')]=_['map'](_0x5f4f19,_0xb150('0x27'));_0x2db855[_0xb150('0x2e')]=_[_0xb150('0x2f')](_0x2efa6a[_0xb150('0x2e')]);_0x2db855[_0xb150('0x30')]=_[_0xb150('0x31')](_0x2db855[_0xb150('0x2d')],_0x2db855[_0xb150('0x2e')]);_0x185b4a['attributes']=_[_0xb150('0x31')](_0x2db855[_0xb150('0x2d')],qs[_0xb150('0x32')](_0x2efa6a[_0xb150('0x2e')]['fields']));_0x185b4a[_0xb150('0x33')]=_0x185b4a[_0xb150('0x33')][_0xb150('0x34')]?_0x185b4a[_0xb150('0x33')]:_0x2db855[_0xb150('0x2d')];if(!_0x2efa6a[_0xb150('0x2e')][_0xb150('0x35')](_0xb150('0x36'))){_0x185b4a[_0xb150('0x1d')]=qs[_0xb150('0x1d')](_0x2efa6a[_0xb150('0x2e')][_0xb150('0x1d')]);_0x185b4a['offset']=qs[_0xb150('0x1c')](_0x2efa6a[_0xb150('0x2e')][_0xb150('0x1c')]);}_0x185b4a[_0xb150('0x37')]=qs['sort'](_0x2efa6a[_0xb150('0x2e')][_0xb150('0x38')]);_0x185b4a[_0xb150('0x39')]=qs['filters'](_[_0xb150('0x3a')](_0x2efa6a[_0xb150('0x2e')],_0x2db855[_0xb150('0x30')]),_0x5f4f19);if(_0x2efa6a[_0xb150('0x2e')][_0xb150('0x3b')]){_0x185b4a['where']=_[_0xb150('0x3c')](_0x185b4a[_0xb150('0x39')],{'$or':_['map'](_0x5f4f19,function(_0x14f267){if(_0x14f267[_0xb150('0x3d')]!==_0xb150('0x3e')){var _0x40b77b={};_0x40b77b[_0x14f267['name']]={'$like':'%'+_0x2efa6a[_0xb150('0x2e')][_0xb150('0x3b')]+'%'};return _0x40b77b;}})});}_0x185b4a=_[_0xb150('0x3c')]({},_0x185b4a,_0x2efa6a[_0xb150('0x3f')]);var _0x23ee36={'where':_0x185b4a[_0xb150('0x39')]};return db[_0xb150('0x40')][_0xb150('0x41')](_0x23ee36)[_0xb150('0x23')](function(_0x1b60e1){_0x5845d5[_0xb150('0x41')]=_0x1b60e1;if(_0x2efa6a[_0xb150('0x2e')][_0xb150('0x42')]){_0x185b4a[_0xb150('0x43')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xb150('0x44')](_0x185b4a);})['then'](function(_0x4dd895){_0x5845d5['rows']=_0x4dd895;return _0x5845d5;})[_0xb150('0x23')](respondWithFilteredResult(_0x42d321,_0x185b4a))[_0xb150('0x45')](handleError(_0x42d321,null));};exports[_0xb150('0x46')]=function(_0x414f08,_0x15bba0){var _0x31b51a={'raw':!![],'where':{'id':_0x414f08[_0xb150('0x47')]['id']}},_0xf8f7c0={};_0xf8f7c0['model']=_[_0xb150('0x2f')](db[_0xb150('0x40')]['rawAttributes']);_0xf8f7c0[_0xb150('0x2e')]=_[_0xb150('0x2f')](_0x414f08[_0xb150('0x2e')]);_0xf8f7c0[_0xb150('0x30')]=_['intersection'](_0xf8f7c0[_0xb150('0x2d')],_0xf8f7c0[_0xb150('0x2e')]);_0x31b51a['attributes']=_[_0xb150('0x31')](_0xf8f7c0[_0xb150('0x2d')],qs['fields'](_0x414f08[_0xb150('0x2e')][_0xb150('0x32')]));_0x31b51a[_0xb150('0x33')]=_0x31b51a[_0xb150('0x33')][_0xb150('0x34')]?_0x31b51a[_0xb150('0x33')]:_0xf8f7c0['model'];if(_0x414f08[_0xb150('0x2e')][_0xb150('0x42')]){_0x31b51a['include']=[{'all':!![]}];}_0x31b51a=_[_0xb150('0x3c')]({},_0x31b51a,_0x414f08[_0xb150('0x3f')]);return db['VoiceQueuesLog']['find'](_0x31b51a)[_0xb150('0x23')](handleEntityNotFound(_0x15bba0,null))[_0xb150('0x23')](respondWithResult(_0x15bba0,null))[_0xb150('0x45')](handleError(_0x15bba0,null));};exports[_0xb150('0x48')]=function(_0x34208a,_0x697d2c){return db['VoiceQueuesLog'][_0xb150('0x48')](_0x34208a[_0xb150('0x49')],{})[_0xb150('0x23')](respondWithResult(_0x697d2c,0xc9))[_0xb150('0x45')](handleError(_0x697d2c,null));};exports[_0xb150('0x22')]=function(_0x5faf6c,_0x553bfb){if(_0x5faf6c[_0xb150('0x49')]['id']){delete _0x5faf6c['body']['id'];}return db[_0xb150('0x40')][_0xb150('0x4a')]({'where':{'id':_0x5faf6c[_0xb150('0x47')]['id']}})[_0xb150('0x23')](handleEntityNotFound(_0x553bfb,null))[_0xb150('0x23')](saveUpdates(_0x5faf6c[_0xb150('0x49')],null))[_0xb150('0x23')](respondWithResult(_0x553bfb,null))[_0xb150('0x45')](handleError(_0x553bfb,null));};exports['destroy']=function(_0x1dcd14,_0x649f1d){return db['VoiceQueuesLog'][_0xb150('0x4a')]({'where':{'id':_0x1dcd14[_0xb150('0x47')]['id']}})[_0xb150('0x23')](handleEntityNotFound(_0x649f1d,null))['then'](removeEntity(_0x649f1d,null))[_0xb150('0x45')](handleError(_0x649f1d,null));}; \ No newline at end of file +var _0x4ed8=['pick','filter','VIRTUAL','options','VoiceQueuesLog','includeAll','include','rows','catch','show','params','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','end','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where'];(function(_0x37a4d7,_0x2357c7){var _0x307048=function(_0x2c34f9){while(--_0x2c34f9){_0x37a4d7['push'](_0x37a4d7['shift']());}};_0x307048(++_0x2357c7);}(_0x4ed8,0x17c));var _0x84ed=function(_0x213cb4,_0xbe7f1){_0x213cb4=_0x213cb4-0x0;var _0x3bb951=_0x4ed8[_0x213cb4];return _0x3bb951;};'use strict';var emlformat=require(_0x84ed('0x0'));var rimraf=require(_0x84ed('0x1'));var zipdir=require(_0x84ed('0x2'));var jsonpatch=require(_0x84ed('0x3'));var rp=require(_0x84ed('0x4'));var moment=require('moment');var BPromise=require(_0x84ed('0x5'));var Mustache=require('mustache');var util=require(_0x84ed('0x6'));var path=require('path');var sox=require(_0x84ed('0x7'));var csv=require(_0x84ed('0x8'));var ejs=require(_0x84ed('0x9'));var fs=require('fs');var fs_extra=require(_0x84ed('0xa'));var _=require(_0x84ed('0xb'));var squel=require(_0x84ed('0xc'));var crypto=require('crypto');var jsforce=require(_0x84ed('0xd'));var deskjs=require(_0x84ed('0xe'));var toCsv=require(_0x84ed('0x8'));var querystring=require('querystring');var Papa=require(_0x84ed('0xf'));var Redis=require('ioredis');var authService=require(_0x84ed('0x10'));var qs=require(_0x84ed('0x11'));var as=require(_0x84ed('0x12'));var hardwareService=require(_0x84ed('0x13'));var logger=require(_0x84ed('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x84ed('0x15'));var licenseUtil=require(_0x84ed('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x390fa8,_0xc01d59){_0xc01d59=_0xc01d59||0xcc;return function(_0x59b7a4){if(_0x59b7a4){return _0x390fa8[_0x84ed('0x17')](_0xc01d59);}return _0x390fa8['status'](_0xc01d59)['end']();};}function respondWithResult(_0x4fa9ad,_0x93d700){_0x93d700=_0x93d700||0xc8;return function(_0x217708){if(_0x217708){return _0x4fa9ad[_0x84ed('0x18')](_0x93d700)[_0x84ed('0x19')](_0x217708);}};}function respondWithFilteredResult(_0x2d0e66,_0x33df6c){return function(_0x98d7f7){if(_0x98d7f7){var _0x4ff127=typeof _0x33df6c[_0x84ed('0x1a')]===_0x84ed('0x1b')&&typeof _0x33df6c[_0x84ed('0x1c')]===_0x84ed('0x1b');var _0x2f008f=_0x98d7f7['count'];var _0x290526=_0x4ff127?0x0:_0x33df6c[_0x84ed('0x1a')];var _0x789d65=_0x4ff127?_0x98d7f7[_0x84ed('0x1d')]:_0x33df6c[_0x84ed('0x1a')]+_0x33df6c[_0x84ed('0x1c')];var _0x14f398;if(_0x789d65>=_0x2f008f){_0x789d65=_0x2f008f;_0x14f398=0xc8;}else{_0x14f398=0xce;}_0x2d0e66[_0x84ed('0x18')](_0x14f398);return _0x2d0e66[_0x84ed('0x1e')](_0x84ed('0x1f'),_0x290526+'-'+_0x789d65+'/'+_0x2f008f)[_0x84ed('0x19')](_0x98d7f7);}return null;};}function patchUpdates(_0x523842){return function(_0x3f1693){try{jsonpatch[_0x84ed('0x20')](_0x3f1693,_0x523842,!![]);}catch(_0x11c0f1){return BPromise[_0x84ed('0x21')](_0x11c0f1);}return _0x3f1693['save']();};}function saveUpdates(_0x7ae13b,_0x1286b6){return function(_0x456003){if(_0x456003){return _0x456003['update'](_0x7ae13b)[_0x84ed('0x22')](function(_0x48d7a7){return _0x48d7a7;});}return null;};}function removeEntity(_0x2f4828,_0x12136a){return function(_0x1452e0){if(_0x1452e0){return _0x1452e0[_0x84ed('0x23')]()['then'](function(){_0x2f4828['status'](0xcc)[_0x84ed('0x24')]();});}};}function handleEntityNotFound(_0x202490,_0xdb8acb){return function(_0x3ab72b){if(!_0x3ab72b){_0x202490[_0x84ed('0x17')](0x194);}return _0x3ab72b;};}function handleError(_0x2c088d,_0x4860b0){_0x4860b0=_0x4860b0||0x1f4;return function(_0x481547){logger[_0x84ed('0x25')](_0x481547[_0x84ed('0x26')]);if(_0x481547[_0x84ed('0x27')]){delete _0x481547[_0x84ed('0x27')];}_0x2c088d[_0x84ed('0x18')](_0x4860b0)['send'](_0x481547);};}exports[_0x84ed('0x28')]=function(_0x29c8d8,_0xb7939f){var _0x51ffa7={},_0x335f51={},_0x5d478e={'count':0x0,'rows':[]};var _0x1e86d1=_['map'](db['VoiceQueuesLog'][_0x84ed('0x29')],function(_0x5835e6){return{'name':_0x5835e6[_0x84ed('0x2a')],'type':_0x5835e6[_0x84ed('0x2b')][_0x84ed('0x2c')]};});_0x335f51[_0x84ed('0x2d')]=_[_0x84ed('0x2e')](_0x1e86d1,'name');_0x335f51[_0x84ed('0x2f')]=_[_0x84ed('0x30')](_0x29c8d8[_0x84ed('0x2f')]);_0x335f51[_0x84ed('0x31')]=_[_0x84ed('0x32')](_0x335f51[_0x84ed('0x2d')],_0x335f51[_0x84ed('0x2f')]);_0x51ffa7[_0x84ed('0x33')]=_[_0x84ed('0x32')](_0x335f51['model'],qs[_0x84ed('0x34')](_0x29c8d8['query'][_0x84ed('0x34')]));_0x51ffa7[_0x84ed('0x33')]=_0x51ffa7[_0x84ed('0x33')][_0x84ed('0x35')]?_0x51ffa7['attributes']:_0x335f51['model'];if(!_0x29c8d8['query'][_0x84ed('0x36')]('nolimit')){_0x51ffa7[_0x84ed('0x1c')]=qs[_0x84ed('0x1c')](_0x29c8d8['query'][_0x84ed('0x1c')]);_0x51ffa7[_0x84ed('0x1a')]=qs[_0x84ed('0x1a')](_0x29c8d8[_0x84ed('0x2f')]['offset']);}_0x51ffa7[_0x84ed('0x37')]=qs[_0x84ed('0x38')](_0x29c8d8[_0x84ed('0x2f')][_0x84ed('0x38')]);_0x51ffa7[_0x84ed('0x39')]=qs[_0x84ed('0x31')](_[_0x84ed('0x3a')](_0x29c8d8['query'],_0x335f51[_0x84ed('0x31')]),_0x1e86d1);if(_0x29c8d8[_0x84ed('0x2f')][_0x84ed('0x3b')]){_0x51ffa7['where']=_['merge'](_0x51ffa7['where'],{'$or':_[_0x84ed('0x2e')](_0x1e86d1,function(_0x19ab54){if(_0x19ab54[_0x84ed('0x2b')]!==_0x84ed('0x3c')){var _0x27f988={};_0x27f988[_0x19ab54[_0x84ed('0x27')]]={'$like':'%'+_0x29c8d8['query'][_0x84ed('0x3b')]+'%'};return _0x27f988;}})});}_0x51ffa7=_['merge']({},_0x51ffa7,_0x29c8d8[_0x84ed('0x3d')]);var _0x3c6e33={'where':_0x51ffa7[_0x84ed('0x39')]};return db[_0x84ed('0x3e')]['count'](_0x3c6e33)[_0x84ed('0x22')](function(_0x54f2cf){_0x5d478e[_0x84ed('0x1d')]=_0x54f2cf;if(_0x29c8d8[_0x84ed('0x2f')][_0x84ed('0x3f')]){_0x51ffa7[_0x84ed('0x40')]=[{'all':!![]}];}return db['VoiceQueuesLog']['findAll'](_0x51ffa7);})[_0x84ed('0x22')](function(_0x4a957e){_0x5d478e[_0x84ed('0x41')]=_0x4a957e;return _0x5d478e;})[_0x84ed('0x22')](respondWithFilteredResult(_0xb7939f,_0x51ffa7))[_0x84ed('0x42')](handleError(_0xb7939f,null));};exports[_0x84ed('0x43')]=function(_0x372e43,_0x3cadc2){var _0x1b7b92={'raw':!![],'where':{'id':_0x372e43[_0x84ed('0x44')]['id']}},_0x4761e1={};_0x4761e1[_0x84ed('0x2d')]=_[_0x84ed('0x30')](db[_0x84ed('0x3e')][_0x84ed('0x29')]);_0x4761e1['query']=_[_0x84ed('0x30')](_0x372e43[_0x84ed('0x2f')]);_0x4761e1[_0x84ed('0x31')]=_['intersection'](_0x4761e1['model'],_0x4761e1['query']);_0x1b7b92[_0x84ed('0x33')]=_['intersection'](_0x4761e1[_0x84ed('0x2d')],qs[_0x84ed('0x34')](_0x372e43[_0x84ed('0x2f')][_0x84ed('0x34')]));_0x1b7b92[_0x84ed('0x33')]=_0x1b7b92['attributes']['length']?_0x1b7b92['attributes']:_0x4761e1['model'];if(_0x372e43[_0x84ed('0x2f')]['includeAll']){_0x1b7b92[_0x84ed('0x40')]=[{'all':!![]}];}_0x1b7b92=_['merge']({},_0x1b7b92,_0x372e43['options']);return db['VoiceQueuesLog'][_0x84ed('0x45')](_0x1b7b92)['then'](handleEntityNotFound(_0x3cadc2,null))[_0x84ed('0x22')](respondWithResult(_0x3cadc2,null))['catch'](handleError(_0x3cadc2,null));};exports[_0x84ed('0x46')]=function(_0x640e21,_0x342ef5){return db['VoiceQueuesLog'][_0x84ed('0x46')](_0x640e21[_0x84ed('0x47')],{})[_0x84ed('0x22')](respondWithResult(_0x342ef5,0xc9))[_0x84ed('0x42')](handleError(_0x342ef5,null));};exports[_0x84ed('0x48')]=function(_0x5a5fce,_0x605dab){if(_0x5a5fce[_0x84ed('0x47')]['id']){delete _0x5a5fce[_0x84ed('0x47')]['id'];}return db[_0x84ed('0x3e')][_0x84ed('0x45')]({'where':{'id':_0x5a5fce[_0x84ed('0x44')]['id']}})[_0x84ed('0x22')](handleEntityNotFound(_0x605dab,null))[_0x84ed('0x22')](saveUpdates(_0x5a5fce[_0x84ed('0x47')],null))['then'](respondWithResult(_0x605dab,null))['catch'](handleError(_0x605dab,null));};exports[_0x84ed('0x23')]=function(_0x4de774,_0x2bb3a8){return db[_0x84ed('0x3e')][_0x84ed('0x45')]({'where':{'id':_0x4de774['params']['id']}})[_0x84ed('0x22')](handleEntityNotFound(_0x2bb3a8,null))['then'](removeEntity(_0x2bb3a8,null))['catch'](handleError(_0x2bb3a8,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 1cceefc..d51884a 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 _0xafcc=['exports','event_dtm','event','dtm','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes'];(function(_0xa7fcd,_0x49d5a3){var _0x2d3429=function(_0x1e4475){while(--_0x1e4475){_0xa7fcd['push'](_0xa7fcd['shift']());}};_0x2d3429(++_0x49d5a3);}(_0xafcc,0x154));var _0xcafc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xafcc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcafc('0x0'));var util=require('util');var logger=require(_0xcafc('0x1'))(_0xcafc('0x2'));var moment=require(_0xcafc('0x3'));var BPromise=require('bluebird');var rp=require(_0xcafc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcafc('0x5'));var config=require(_0xcafc('0x6'));var attributes=require(_0xcafc('0x7'));module[_0xcafc('0x8')]=function(_0x48d41f,_0x5754e4){return _0x48d41f['define']('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xcafc('0x9'),'fields':[_0xcafc('0xa'),_0xcafc('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x34c6=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash'];(function(_0x185ef5,_0x2589c9){var _0x34e906=function(_0x1b30ee){while(--_0x1b30ee){_0x185ef5['push'](_0x185ef5['shift']());}};_0x34e906(++_0x2589c9);}(_0x34c6,0x1cd));var _0x634c=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x34c6[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x634c('0x0'));var util=require('util');var logger=require(_0x634c('0x1'))(_0x634c('0x2'));var moment=require(_0x634c('0x3'));var BPromise=require(_0x634c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x634c('0x5'));var config=require(_0x634c('0x6'));var attributes=require(_0x634c('0x7'));module['exports']=function(_0x2aab37,_0x550409){return _0x2aab37[_0x634c('0x8')](_0x634c('0x9'),attributes,{'tableName':_0x634c('0xa'),'paranoid':![],'indexes':[{'name':_0x634c('0xb'),'fields':[_0x634c('0xc'),_0x634c('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index a8d282c..664eb0c 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 _0x92a2=['VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','then'];(function(_0x4db3ca,_0xae5665){var _0x404a6c=function(_0x522bca){while(--_0x522bca){_0x4db3ca['push'](_0x4db3ca['shift']());}};_0x404a6c(++_0xae5665);}(_0x92a2,0x1ee));var _0x292a=function(_0xc6478a,_0x3ecbea){_0xc6478a=_0xc6478a-0x0;var _0x545ebf=_0x92a2[_0xc6478a];return _0x545ebf;};'use strict';var _=require(_0x292a('0x0'));var util=require(_0x292a('0x1'));var moment=require(_0x292a('0x2'));var BPromise=require(_0x292a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x292a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x292a('0x5'));var logger=require(_0x292a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x292a('0x7'));var client=jayson[_0x292a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b7ec3,_0xde082c,_0x41f1f0){return new BPromise(function(_0x3e5c02,_0x419de4){return client['request'](_0x3b7ec3,_0x41f1f0)[_0x292a('0x9')](function(_0x1beb9d){logger['info'](_0x292a('0xa'),_0xde082c,_0x292a('0xb'));logger['debug'](_0x292a('0xc'),_0xde082c,'request\x20sent',JSON[_0x292a('0xd')](_0x1beb9d));if(_0x1beb9d[_0x292a('0xe')]){if(_0x1beb9d[_0x292a('0xe')][_0x292a('0xf')]===0x1f4){logger[_0x292a('0xe')](_0x292a('0xa'),_0xde082c,_0x1beb9d[_0x292a('0xe')]['message']);return _0x419de4(_0x1beb9d[_0x292a('0xe')][_0x292a('0x10')]);}logger[_0x292a('0xe')](_0x292a('0xa'),_0xde082c,_0x1beb9d[_0x292a('0xe')][_0x292a('0x10')]);return _0x3e5c02(_0x1beb9d['error'][_0x292a('0x10')]);}else{logger['info'](_0x292a('0xa'),_0xde082c,'request\x20sent');_0x3e5c02(_0x1beb9d[_0x292a('0x11')]['message']);}})['catch'](function(_0x3c5b3f){logger[_0x292a('0xe')](_0x292a('0xa'),_0xde082c,_0x3c5b3f);_0x419de4(_0x3c5b3f);});});} \ No newline at end of file +var _0x2f14=['http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x35c324,_0x1d544f){var _0x11e905=function(_0x4d1956){while(--_0x4d1956){_0x35c324['push'](_0x35c324['shift']());}};_0x11e905(++_0x1d544f);}(_0x2f14,0x199));var _0x42f1=function(_0x53b19b,_0x5b8e4e){_0x53b19b=_0x53b19b-0x0;var _0x34ab5d=_0x2f14[_0x53b19b];return _0x34ab5d;};'use strict';var _=require('lodash');var util=require(_0x42f1('0x0'));var moment=require(_0x42f1('0x1'));var BPromise=require('bluebird');var rs=require(_0x42f1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x42f1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x42f1('0x4'))(_0x42f1('0x5'));var config=require(_0x42f1('0x6'));var jayson=require(_0x42f1('0x7'));var client=jayson[_0x42f1('0x8')][_0x42f1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x230d3b,_0x1b0c67,_0x28748c){return new BPromise(function(_0x516359,_0x2a77a6){return client[_0x42f1('0xa')](_0x230d3b,_0x28748c)[_0x42f1('0xb')](function(_0x34bd74){logger[_0x42f1('0xc')](_0x42f1('0xd'),_0x1b0c67,'request\x20sent');logger[_0x42f1('0xe')](_0x42f1('0xf'),_0x1b0c67,_0x42f1('0x10'),JSON[_0x42f1('0x11')](_0x34bd74));if(_0x34bd74[_0x42f1('0x12')]){if(_0x34bd74[_0x42f1('0x12')][_0x42f1('0x13')]===0x1f4){logger['error'](_0x42f1('0xd'),_0x1b0c67,_0x34bd74['error'][_0x42f1('0x14')]);return _0x2a77a6(_0x34bd74['error']['message']);}logger['error'](_0x42f1('0xd'),_0x1b0c67,_0x34bd74[_0x42f1('0x12')]['message']);return _0x516359(_0x34bd74[_0x42f1('0x12')]['message']);}else{logger[_0x42f1('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1b0c67,_0x42f1('0x10'));_0x516359(_0x34bd74['result'][_0x42f1('0x14')]);}})[_0x42f1('0x15')](function(_0x3e2606){logger['error'](_0x42f1('0xd'),_0x1b0c67,_0x3e2606);_0x2a77a6(_0x3e2606);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index d0f34b5..a119459 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 _0x4bf2=['isAuthenticated','index','/describe','describe','/:id','show','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','put','update','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get'];(function(_0x20f08b,_0x646ea0){var _0x675062=function(_0x266c20){while(--_0x266c20){_0x20f08b['push'](_0x20f08b['shift']());}};_0x675062(++_0x646ea0);}(_0x4bf2,0xbf));var _0x24bf=function(_0x5ede08,_0x11d12e){_0x5ede08=_0x5ede08-0x0;var _0x38c4b1=_0x4bf2[_0x5ede08];return _0x38c4b1;};'use strict';var multer=require(_0x24bf('0x0'));var util=require(_0x24bf('0x1'));var path=require(_0x24bf('0x2'));var timeout=require(_0x24bf('0x3'));var express=require('express');var router=express[_0x24bf('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x24bf('0x5'));var config=require(_0x24bf('0x6'));var controller=require(_0x24bf('0x7'));router[_0x24bf('0x8')]('/',auth[_0x24bf('0x9')](),controller[_0x24bf('0xa')]);router['get'](_0x24bf('0xb'),auth[_0x24bf('0x9')](),controller[_0x24bf('0xc')]);router['get'](_0x24bf('0xd'),auth[_0x24bf('0x9')](),controller[_0x24bf('0xe')]);router[_0x24bf('0x8')]('/:id/download',auth[_0x24bf('0x9')](),controller[_0x24bf('0xf')]);router['get'](_0x24bf('0x10'),controller[_0x24bf('0x11')]);router[_0x24bf('0x8')](_0x24bf('0x12'),auth[_0x24bf('0x9')](),controller[_0x24bf('0x13')]);router[_0x24bf('0x14')]('/',auth[_0x24bf('0x9')](),controller[_0x24bf('0x15')]);router[_0x24bf('0x14')]('/:id/transcribe',auth[_0x24bf('0x9')](),controller['runTranscribe']);router[_0x24bf('0x16')](_0x24bf('0xd'),auth[_0x24bf('0x9')](),controller[_0x24bf('0x17')]);router['delete'](_0x24bf('0xd'),auth[_0x24bf('0x9')](),controller['destroy']);module[_0x24bf('0x18')]=router; \ No newline at end of file +var _0x81f5=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated','index','get','/describe','show','/:id/download','download','/:id/downloads','downloadTranscribe','create','post','/:id/transcribe','runTranscribe','/:id','update'];(function(_0x3edadf,_0x29b0cb){var _0x38094b=function(_0x10e9fd){while(--_0x10e9fd){_0x3edadf['push'](_0x3edadf['shift']());}};_0x38094b(++_0x29b0cb);}(_0x81f5,0x9e));var _0x581f=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x81f5[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x581f('0x0'));var util=require(_0x581f('0x1'));var path=require(_0x581f('0x2'));var timeout=require(_0x581f('0x3'));var express=require(_0x581f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x581f('0x5'));var interaction=require(_0x581f('0x6'));var config=require(_0x581f('0x7'));var controller=require(_0x581f('0x8'));router['get']('/',auth[_0x581f('0x9')](),controller[_0x581f('0xa')]);router[_0x581f('0xb')](_0x581f('0xc'),auth[_0x581f('0x9')](),controller['describe']);router[_0x581f('0xb')]('/:id',auth[_0x581f('0x9')](),controller[_0x581f('0xd')]);router[_0x581f('0xb')](_0x581f('0xe'),auth[_0x581f('0x9')](),controller[_0x581f('0xf')]);router[_0x581f('0xb')](_0x581f('0x10'),controller['downloads']);router[_0x581f('0xb')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0x581f('0x11')]);router['post']('/',auth[_0x581f('0x9')](),controller[_0x581f('0x12')]);router[_0x581f('0x13')](_0x581f('0x14'),auth[_0x581f('0x9')](),controller[_0x581f('0x15')]);router['put'](_0x581f('0x16'),auth[_0x581f('0x9')](),controller[_0x581f('0x17')]);router['delete'](_0x581f('0x16'),auth['isAuthenticated'](),controller[_0x581f('0x18')]);module[_0x581f('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 62cdc14..3f66de3 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(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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 135644e..ff1d4c7 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 _0xb85b=['jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','index','map','rawAttributes','fieldName','type','key','model','differenceBy','name','format','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','include','rows','catch','show','VoiceRecording','length','options','find','create','body','params','describe','download','uniqueid','value','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','send','downloads','../../components/encryptor','MD5','sequelize','col','token','$and','push','%s.cypher','existsSync','destroy','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash'];(function(_0x11d372,_0x3ccb76){var _0x14ecff=function(_0x457bdb){while(--_0x457bdb){_0x11d372['push'](_0x11d372['shift']());}};_0x14ecff(++_0x3ccb76);}(_0xb85b,0x129));var _0xbb85=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xb85b[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbb85('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb85('0x1'));var rp=require(_0xbb85('0x2'));var moment=require(_0xbb85('0x3'));var BPromise=require(_0xbb85('0x4'));var Mustache=require(_0xbb85('0x5'));var util=require(_0xbb85('0x6'));var path=require(_0xbb85('0x7'));var sox=require('sox');var csv=require(_0xbb85('0x8'));var ejs=require(_0xbb85('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb85('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbb85('0xb'));var deskjs=require(_0xbb85('0xc'));var toCsv=require(_0xbb85('0x8'));var querystring=require(_0xbb85('0xd'));var Papa=require(_0xbb85('0xe'));var AWS=require(_0xbb85('0xf'));var uuidv4=require(_0xbb85('0x10'));var Redis=require('ioredis');var authService=require(_0xbb85('0x11'));var qs=require(_0xbb85('0x12'));var as=require(_0xbb85('0x13'));var hardwareService=require(_0xbb85('0x14'));var logger=require(_0xbb85('0x15'))('api');var utils=require(_0xbb85('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb85('0x17'));var db=require(_0xbb85('0x18'))['db'];function respondWithStatusCode(_0x4474dd,_0x51b733){_0x51b733=_0x51b733||0xcc;return function(_0x10bdbb){if(_0x10bdbb){return _0x4474dd[_0xbb85('0x19')](_0x51b733);}return _0x4474dd[_0xbb85('0x1a')](_0x51b733)[_0xbb85('0x1b')]();};}function respondWithResult(_0x270a90,_0x8fa331){_0x8fa331=_0x8fa331||0xc8;return function(_0x3320b6){if(_0x3320b6){return _0x270a90[_0xbb85('0x1a')](_0x8fa331)[_0xbb85('0x1c')](_0x3320b6);}};}function respondWithFilteredResult(_0x3d283e,_0x532117){return function(_0x556570){if(_0x556570){var _0x3570e2=typeof _0x532117['offset']===_0xbb85('0x1d')&&typeof _0x532117[_0xbb85('0x1e')]===_0xbb85('0x1d');var _0x5ef497=_0x556570[_0xbb85('0x1f')];var _0x5ed55b=_0x3570e2?0x0:_0x532117[_0xbb85('0x20')];var _0x2f0a45=_0x3570e2?_0x556570[_0xbb85('0x1f')]:_0x532117[_0xbb85('0x20')]+_0x532117['limit'];var _0x4a2899;if(_0x2f0a45>=_0x5ef497){_0x2f0a45=_0x5ef497;_0x4a2899=0xc8;}else{_0x4a2899=0xce;}_0x3d283e[_0xbb85('0x1a')](_0x4a2899);return _0x3d283e[_0xbb85('0x21')](_0xbb85('0x22'),_0x5ed55b+'-'+_0x2f0a45+'/'+_0x5ef497)[_0xbb85('0x1c')](_0x556570);}return null;};}function patchUpdates(_0x18ca69){return function(_0xb364ab){try{jsonpatch[_0xbb85('0x23')](_0xb364ab,_0x18ca69,!![]);}catch(_0x5c793d){return BPromise['reject'](_0x5c793d);}return _0xb364ab[_0xbb85('0x24')]();};}function saveUpdates(_0x27d00a,_0x3d6d4b){return function(_0x3b849c){if(_0x3b849c){return _0x3b849c[_0xbb85('0x25')](_0x27d00a)[_0xbb85('0x26')](function(_0x4ef548){return _0x4ef548;});}return null;};}function removeEntity(_0x3cd8cd,_0x3ea220){return function(_0x4f219d){if(_0x4f219d){return _0x4f219d['destroy']()[_0xbb85('0x26')](function(){_0x3cd8cd[_0xbb85('0x1a')](0xcc)[_0xbb85('0x1b')]();});}};}function handleEntityNotFound(_0x139e03,_0x5c1c33){return function(_0x344539){if(!_0x344539){_0x139e03['sendStatus'](0x194);}return _0x344539;};}function handleError(_0x4a9a4f,_0x200e68){_0x200e68=_0x200e68||0x1f4;return function(_0x3e1a77){logger['error'](_0x3e1a77['stack']);if(_0x3e1a77['name']){delete _0x3e1a77['name'];}_0x4a9a4f[_0xbb85('0x1a')](_0x200e68)['send'](_0x3e1a77);};}exports[_0xbb85('0x27')]=function(_0x593b32,_0x10a2b1){var _0x39c7e0={},_0x131ce2={},_0x34413e={'count':0x0,'rows':[]};var _0x29c3c7=_[_0xbb85('0x28')](db['VoiceRecording'][_0xbb85('0x29')],function(_0x5a0856){return{'name':_0x5a0856[_0xbb85('0x2a')],'type':_0x5a0856[_0xbb85('0x2b')][_0xbb85('0x2c')]};});_0x131ce2[_0xbb85('0x2d')]=_[_0xbb85('0x2e')](_[_0xbb85('0x28')](_0x29c3c7,_0xbb85('0x2f')),[_0xbb85('0x30')]);_0x131ce2[_0xbb85('0x31')]=_[_0xbb85('0x32')](_0x593b32[_0xbb85('0x31')]);_0x131ce2[_0xbb85('0x33')]=_[_0xbb85('0x34')](_0x131ce2[_0xbb85('0x2d')],_0x131ce2[_0xbb85('0x31')]);_0x39c7e0[_0xbb85('0x35')]=_[_0xbb85('0x34')](_0x131ce2[_0xbb85('0x2d')],qs[_0xbb85('0x36')](_0x593b32[_0xbb85('0x31')]['fields']));_0x39c7e0[_0xbb85('0x35')]=_0x39c7e0['attributes']['length']?_0x39c7e0['attributes']:_0x131ce2[_0xbb85('0x2d')];if(!_0x593b32[_0xbb85('0x31')]['hasOwnProperty'](_0xbb85('0x37'))){_0x39c7e0[_0xbb85('0x1e')]=qs[_0xbb85('0x1e')](_0x593b32['query'][_0xbb85('0x1e')]);_0x39c7e0[_0xbb85('0x20')]=qs['offset'](_0x593b32[_0xbb85('0x31')][_0xbb85('0x20')]);}_0x39c7e0[_0xbb85('0x38')]=qs[_0xbb85('0x39')](_0x593b32[_0xbb85('0x31')][_0xbb85('0x39')]);_0x39c7e0[_0xbb85('0x3a')]=qs[_0xbb85('0x33')](_[_0xbb85('0x3b')](_0x593b32[_0xbb85('0x31')],_0x131ce2[_0xbb85('0x33')]),_0x29c3c7);if(_0x593b32[_0xbb85('0x31')]['filter']){_0x39c7e0[_0xbb85('0x3a')]=_[_0xbb85('0x3c')](_0x39c7e0[_0xbb85('0x3a')],{'$or':_[_0xbb85('0x28')](_0x29c3c7,function(_0x2c9e18){if(_0x2c9e18[_0xbb85('0x2b')]!==_0xbb85('0x3d')){var _0x1a42ee={};_0x1a42ee[_0x2c9e18[_0xbb85('0x2f')]]={'$like':'%'+_0x593b32[_0xbb85('0x31')][_0xbb85('0x3e')]+'%'};return _0x1a42ee;}})});}_0x39c7e0=_['merge']({},_0x39c7e0,_0x593b32['options']);var _0x8c4f79={'where':_0x39c7e0['where']};return db['VoiceRecording'][_0xbb85('0x1f')](_0x8c4f79)[_0xbb85('0x26')](function(_0x1c1063){_0x34413e['count']=_0x1c1063;if(_0x593b32['query']['includeAll']){_0x39c7e0[_0xbb85('0x3f')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x39c7e0);})[_0xbb85('0x26')](function(_0x22b03b){_0x34413e[_0xbb85('0x40')]=_0x22b03b;return _0x34413e;})['then'](respondWithFilteredResult(_0x10a2b1,_0x39c7e0))[_0xbb85('0x41')](handleError(_0x10a2b1,null));};exports[_0xbb85('0x42')]=function(_0x17d0a0,_0x1744e4){var _0x5bfdb0={'raw':![],'where':{'id':_0x17d0a0['params']['id']}},_0x3aed0d={};_0x3aed0d['model']=_[_0xbb85('0x32')](db[_0xbb85('0x43')]['rawAttributes']);_0x3aed0d['query']=_[_0xbb85('0x32')](_0x17d0a0[_0xbb85('0x31')]);_0x3aed0d[_0xbb85('0x33')]=_[_0xbb85('0x34')](_0x3aed0d[_0xbb85('0x2d')],_0x3aed0d[_0xbb85('0x31')]);_0x5bfdb0[_0xbb85('0x35')]=_[_0xbb85('0x34')](_0x3aed0d[_0xbb85('0x2d')],qs[_0xbb85('0x36')](_0x17d0a0[_0xbb85('0x31')][_0xbb85('0x36')]));_0x5bfdb0[_0xbb85('0x35')]=_0x5bfdb0[_0xbb85('0x35')][_0xbb85('0x44')]?_0x5bfdb0['attributes']:_0x3aed0d[_0xbb85('0x2d')];if(_0x17d0a0[_0xbb85('0x31')]['includeAll']){_0x5bfdb0[_0xbb85('0x3f')]=[{'all':!![]}];}_0x5bfdb0=_[_0xbb85('0x3c')]({},_0x5bfdb0,_0x17d0a0[_0xbb85('0x45')]);return db[_0xbb85('0x43')][_0xbb85('0x46')](_0x5bfdb0)[_0xbb85('0x26')](handleEntityNotFound(_0x1744e4,null))[_0xbb85('0x26')](respondWithResult(_0x1744e4,null))[_0xbb85('0x41')](handleError(_0x1744e4,null));};exports[_0xbb85('0x47')]=function(_0x139436,_0x1337f2){return db['VoiceRecording'][_0xbb85('0x47')](_0x139436[_0xbb85('0x48')],{})[_0xbb85('0x26')](respondWithResult(_0x1337f2,0xc9))[_0xbb85('0x41')](handleError(_0x1337f2,null));};exports['update']=function(_0x4c4caa,_0x414ce8){if(_0x4c4caa[_0xbb85('0x48')]['id']){delete _0x4c4caa[_0xbb85('0x48')]['id'];}return db[_0xbb85('0x43')][_0xbb85('0x46')]({'where':{'id':_0x4c4caa[_0xbb85('0x49')]['id']}})[_0xbb85('0x26')](handleEntityNotFound(_0x414ce8,null))[_0xbb85('0x26')](saveUpdates(_0x4c4caa[_0xbb85('0x48')],null))['then'](respondWithResult(_0x414ce8,null))[_0xbb85('0x41')](handleError(_0x414ce8,null));};exports[_0xbb85('0x4a')]=function(_0x230ecb,_0x1ab504){return db[_0xbb85('0x43')][_0xbb85('0x4a')]()['then'](respondWithResult(_0x1ab504,null))['catch'](handleError(_0x1ab504,null));};exports[_0xbb85('0x4b')]=function(_0x5b3bb6,_0x431d32,_0x26928a){var _0x23afc2=require('../../components/encryptor');var _0x3d7790=![];var _0x3414f6={};if(_0x5b3bb6[_0xbb85('0x31')][_0xbb85('0x2b')]&&_0x5b3bb6[_0xbb85('0x31')][_0xbb85('0x2b')]===_0xbb85('0x4c')){_0x3414f6[_0xbb85('0x4c')]=_0x5b3bb6[_0xbb85('0x49')]['id'];}else{_0x3414f6['id']=_0x5b3bb6[_0xbb85('0x49')]['id'];}return db[_0xbb85('0x43')][_0xbb85('0x46')]({'where':_0x3414f6,'attributes':['id',_0xbb85('0x4d')],'raw':!![]})[_0xbb85('0x26')](handleEntityNotFound(_0x431d32,null))[_0xbb85('0x26')](function(_0x28256a){if(_0x28256a){var _0x11a55a=_0x28256a[_0xbb85('0x4d')];var _0x55eb25=util[_0xbb85('0x30')]('%s.cypher',_0x11a55a);if(fs['existsSync'](_0x55eb25)){_0x3d7790=!![];return _0x23afc2[_0xbb85('0x4e')](_0x55eb25,_0x11a55a,config[_0xbb85('0x4f')][_0xbb85('0x50')])[_0xbb85('0x26')](function(){return _0x28256a;});}return _0x28256a;}})[_0xbb85('0x26')](function(_0x4a1254){if(_0x4a1254){var _0x781df9=_0x4a1254['value'];if(!fs['existsSync'](_0x781df9)){throw new db[(_0xbb85('0x51'))][(_0xbb85('0x52'))](_0xbb85('0x53'));}if(_0x4a1254['filename']){return _0x431d32['download'](_0x781df9,_0x4a1254[_0xbb85('0x54')]+path[_0xbb85('0x55')](_0x781df9),function(){if(_0x3d7790){fs['unlink'](_0x781df9);}});}else{return _0x431d32['download'](_0x781df9,function(_0xb053c8){if(_0x3d7790){fs[_0xbb85('0x56')](_0x781df9);}});}}})[_0xbb85('0x41')](function(_0x3b6960){if(_0x3b6960['message']===_0xbb85('0x53')){_0x431d32[_0xbb85('0x1a')](0x194)[_0xbb85('0x57')]('Not\x20found');}else{return handleError(_0x431d32,null);}});};exports[_0xbb85('0x58')]=function(_0xf07348,_0x44e268,_0x36f849){var _0x25aa27=require(_0xbb85('0x59'));var _0x2dcac3=![];var _0x33c333={'$and':[db['sequelize']['where'](db['sequelize']['fn'](_0xbb85('0x5a'),db[_0xbb85('0x5b')][_0xbb85('0x5c')](_0xbb85('0x4c'))),_0xf07348[_0xbb85('0x31')][_0xbb85('0x5d')])]};if(_0xf07348[_0xbb85('0x31')][_0xbb85('0x2b')]&&_0xf07348[_0xbb85('0x31')][_0xbb85('0x2b')]===_0xbb85('0x4c')){_0x33c333[_0xbb85('0x5e')][_0xbb85('0x5f')]({'uniqueid':_0xf07348[_0xbb85('0x49')]['id']});}else{_0x33c333[_0xbb85('0x5e')][_0xbb85('0x5f')]({'id':_0xf07348[_0xbb85('0x49')]['id']});}return db['VoiceRecording']['find']({'where':_0x33c333,'attributes':['id',_0xbb85('0x4d')],'raw':!![]})[_0xbb85('0x26')](handleEntityNotFound(_0x44e268,null))[_0xbb85('0x26')](function(_0x2325a3){if(_0x2325a3){var _0x44dd4d=util[_0xbb85('0x30')](_0xbb85('0x60'),_0x2325a3['value']);if(fs[_0xbb85('0x61')](_0x44dd4d)){_0x2dcac3=!![];return _0x25aa27[_0xbb85('0x4e')](_0x44dd4d,_0x2325a3[_0xbb85('0x4d')],config['secrets'][_0xbb85('0x50')])[_0xbb85('0x26')](function(){return _0x2325a3;});}return _0x2325a3;}})[_0xbb85('0x26')](function(_0x922fa6){if(_0x922fa6){if(!fs[_0xbb85('0x61')](_0x922fa6[_0xbb85('0x4d')])){throw new db[(_0xbb85('0x51'))][(_0xbb85('0x52'))](_0xbb85('0x53'));}if(_0x922fa6[_0xbb85('0x54')]){return _0x44e268[_0xbb85('0x4b')](_0x922fa6[_0xbb85('0x4d')],_0x922fa6[_0xbb85('0x54')]+path[_0xbb85('0x55')](_0x922fa6[_0xbb85('0x4d')]),function(){if(_0x2dcac3){fs[_0xbb85('0x56')](_0x922fa6[_0xbb85('0x4d')]);}});}else{return _0x44e268[_0xbb85('0x4b')](_0x922fa6['value'],function(_0x5c81e7){if(_0x2dcac3){fs['unlink'](_0x922fa6[_0xbb85('0x4d')]);}});}}})['catch'](handleError(_0x44e268,null));};exports[_0xbb85('0x62')]=function(_0x160398,_0x2c6b87){return db[_0xbb85('0x43')][_0xbb85('0x46')]({'where':{'id':_0x160398[_0xbb85('0x49')]['id']}})[_0xbb85('0x26')](function(_0x4ec2b8){if(_[_0xbb85('0x63')](_0x4ec2b8)){throw new ReferenceError(_0xbb85('0x64'));}return _0x4ec2b8;})[_0xbb85('0x26')](function(_0x5ba443){var _0x13091f=_0x5ba443[_0xbb85('0x4d')];logger['info'](_0xbb85('0x65'),_0x13091f);if(!_['isNil'](_0x5ba443[_0xbb85('0x4d')])&&fs[_0xbb85('0x61')](_0x13091f)){logger[_0xbb85('0x66')]('File:\x20\x22'+_0x13091f+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x13091f);}_0x13091f=_0x13091f+'.cypher';if(!_[_0xbb85('0x63')](_0x5ba443[_0xbb85('0x4d')])&&fs[_0xbb85('0x61')](_0x13091f)){logger[_0xbb85('0x66')](_0xbb85('0x67')+_0x13091f+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xbb85('0x68')](_0x13091f);}return _0x5ba443;})[_0xbb85('0x26')](function(_0x321df4){if(!_0x321df4)throw new InternalError();return _0x321df4['destroy']();})[_0xbb85('0x26')](function(){_0x2c6b87[_0xbb85('0x1a')](0xcc)[_0xbb85('0x1b')]();})[_0xbb85('0x41')](handleError(_0x2c6b87,null));};function getBucketslist(_0x4e9d89,_0x5ecc61,_0x109f6d){return new Promise(function(_0xe82fa2,_0x4c71d8){var _0x4edeac=new AWS['S3']({'accessKeyId':_0x5ecc61,'secretAccessKey':_0x4e9d89,'region':_0x109f6d});_0x4edeac[_0xbb85('0x69')]({},function(_0x584377,_0x1a99f6){if(_0x584377){return _0x4c71d8(_0x584377);}else{return _0xe82fa2(_0x1a99f6);}});});}function createBucket(_0x36a719,_0x2cfd75,_0x287735,_0x493413){return new Promise(function(_0x3a6f27,_0x2eb5fd){var _0x290d6a=new AWS['S3']({'accessKeyId':_0x2cfd75,'secretAccessKey':_0x36a719,'region':_0x287735});_0x290d6a['createBucket']({'Bucket':_0x493413},function(_0x1fe0ef,_0x4396d8){if(_0x1fe0ef){return _0x2eb5fd(_0x1fe0ef);}else{return _0x3a6f27(_0x4396d8);}});});}function uploadFile(_0x45a53c,_0x29d3a6,_0x4577c0,_0x365486,_0x1f1443,_0x4adae7){return new Promise(function(_0x462f5b,_0x5d8d36){var _0x2a1125=new AWS['S3']({'accessKeyId':_0x29d3a6,'secretAccessKey':_0x45a53c,'region':_0x4577c0});_0x2a1125[_0xbb85('0x6a')]({'Bucket':_0x365486,'Key':_0x1f1443,'Body':_0x4adae7},function(_0x274370,_0x1b77ef){if(_0x274370){return _0x5d8d36(_0x274370);}else{return _0x462f5b(_0x1b77ef);}});});}function startTranscribe(_0x4ac35f,_0x3ce468,_0x4c2750,_0x67e15c,_0x6439d5,_0xec5f79){return new Promise(function(_0x1397f7,_0x5d7058){var _0x4a3cee=new AWS[(_0xbb85('0x6b'))]({'accessKeyId':_0x3ce468,'secretAccessKey':_0x4ac35f,'region':_0x4c2750});_0x4a3cee[_0xbb85('0x6c')]({'TranscriptionJobName':_0x67e15c,'LanguageCode':_0x6439d5,'Media':{'MediaFileUri':_0xec5f79}},function(_0x12ebdb,_0x11fc95){if(_0x12ebdb){return _0x5d7058(_0x12ebdb);}else{return _0x1397f7(_0x11fc95);}});});}function transcribe(_0x3a242b,_0x87902d,_0xfe939,_0x12f6c0,_0x1a38b2,_0x553249,_0x2f0255){return new Promise(function(_0x502057,_0xd14753){var _0x2172ed={};logger[_0xbb85('0x66')](util['format'](_0xbb85('0x6d'),_0x3a242b,_0x1a38b2));return uploadFile(_0x87902d,_0xfe939,_0x12f6c0,_0x1a38b2,path[_0xbb85('0x6e')](_0x553249),fs['readFileSync'](_0x553249))[_0xbb85('0x26')](function(_0x3c36a3){logger[_0xbb85('0x66')](util[_0xbb85('0x30')](_0xbb85('0x6f'),_0x3a242b,_0x1a38b2,_0x3c36a3[_0xbb85('0x70')]));_0x2172ed[_0xbb85('0x71')]=_0x3c36a3[_0xbb85('0x72')];_0x2172ed[_0xbb85('0x73')]=_0x3c36a3[_0xbb85('0x70')];logger[_0xbb85('0x66')](util[_0xbb85('0x30')](_0xbb85('0x74'),_0x3a242b));return startTranscribe(_0x87902d,_0xfe939,_0x12f6c0,uuidv4(),_0x2f0255,_0x3c36a3[_0xbb85('0x70')]);})[_0xbb85('0x26')](function(_0x4c30a7){logger[_0xbb85('0x66')](util[_0xbb85('0x30')](_0xbb85('0x75'),_0x3a242b,_0x4c30a7[_0xbb85('0x76')][_0xbb85('0x77')]));_0x2172ed[_0xbb85('0x78')]=_0x4c30a7['TranscriptionJob']['TranscriptionJobName'];_0x2172ed['transcribeStatus']=_0x4c30a7['TranscriptionJob'][_0xbb85('0x79')];return _0x502057(_0x2172ed);})[_0xbb85('0x41')](function(_0x25adb0){return _0xd14753(_0x25adb0);});});}exports[_0xbb85('0x7a')]=function(_0x384b36,_0x19982b,_0x1aaabc){var _0x336d73;var _0x123d05;var _0x3b16c9;var _0x50eb5f=require('../../components/encryptor');return db[_0xbb85('0x43')][_0xbb85('0x7b')]({'where':{'id':_0x384b36['params']['id']}})[_0xbb85('0x26')](function(_0x265114){if(_0x265114){var _0x50e8fa=util[_0xbb85('0x30')](_0xbb85('0x60'),_0x265114[_0xbb85('0x4d')]);if(fs[_0xbb85('0x61')](_0x50e8fa)){cypher=!![];return _0x50eb5f[_0xbb85('0x4e')](_0x50e8fa,_0x265114[_0xbb85('0x4d')],config[_0xbb85('0x4f')][_0xbb85('0x50')])[_0xbb85('0x26')](function(){return _0x265114;});}return _0x265114;}})[_0xbb85('0x26')](function(_0x3ef7ea){if(!_0x3ef7ea){throw new db['Sequelize'][(_0xbb85('0x52'))](_0xbb85('0x7c'));}_0x123d05=_0x3ef7ea;return db[_0xbb85('0x7d')]['findOne']({'where':{'id':0x1}});})[_0xbb85('0x26')](handleEntityNotFound(_0x19982b,null))[_0xbb85('0x26')](function(_0x583efe){if(_0x583efe){_0x336d73=_0x583efe;if(!_0x336d73['transcribe']||!_0x336d73[_0xbb85('0x7e')]||!_0x336d73[_0xbb85('0x7f')]||!_0x336d73['language']||!_0x336d73[_0xbb85('0x71')]){throw new db['Sequelize']['ValidationError'](_0xbb85('0x80'));}if(_0x384b36['body'][_0xbb85('0x81')]&&(!_0x336d73['sentiment']||!_0x336d73['sentimentAccountId']||!_0x336d73[_0xbb85('0x82')]||!_0x336d73[_0xbb85('0x83')]||!_0x336d73[_0xbb85('0x71')])){throw new db[(_0xbb85('0x51'))][(_0xbb85('0x52'))](_0xbb85('0x84'));}return db[_0xbb85('0x85')][_0xbb85('0x7b')]({'where':{'id':_0x336d73[_0xbb85('0x7e')]}});}})[_0xbb85('0x26')](function(_0x8414d4){if(!_0x8414d4){throw new db[(_0xbb85('0x51'))][(_0xbb85('0x52'))](_0xbb85('0x86'));}if(!_0x8414d4[_0xbb85('0x87')]||!_0x8414d4[_0xbb85('0x88')]){throw new db[(_0xbb85('0x51'))][(_0xbb85('0x52'))](_0xbb85('0x89'));}_0x3b16c9=_0x8414d4;return getBucketslist(_0x3b16c9['data1'],_0x3b16c9[_0xbb85('0x88')],_0x336d73[_0xbb85('0x7f')]);})[_0xbb85('0x26')](function(_0x4c40e2){if(_0x4c40e2&&_0x4c40e2[_0xbb85('0x8a')]){var _0x47de3b=_[_0xbb85('0x46')](_0x4c40e2[_0xbb85('0x8a')],function(_0x5e6dee){return _0x5e6dee[_0xbb85('0x8b')]===_0x336d73[_0xbb85('0x71')];});if(!_0x47de3b){logger[_0xbb85('0x66')](util[_0xbb85('0x30')](_0xbb85('0x8c'),_0x384b36[_0xbb85('0x49')]['id'],_0x336d73['bucket']));return createBucket(_0x3b16c9[_0xbb85('0x87')],_0x3b16c9[_0xbb85('0x88')],_0x336d73[_0xbb85('0x7f')],_0x336d73[_0xbb85('0x71')]);}logger[_0xbb85('0x66')](util['format'](_0xbb85('0x8d'),_0x384b36['params']['id'],_0x336d73[_0xbb85('0x71')]));return;}})[_0xbb85('0x26')](function(_0x2c9c35){if(_0x123d05[_0xbb85('0x8e')]===_0xbb85('0x8f')){return transcribe(_0x384b36[_0xbb85('0x49')]['id'],_0x3b16c9[_0xbb85('0x87')],_0x3b16c9[_0xbb85('0x88')],_0x336d73[_0xbb85('0x7f')],_0x336d73[_0xbb85('0x71')],_0x123d05[_0xbb85('0x4d')],_0x336d73[_0xbb85('0x83')]);}else{logger[_0xbb85('0x66')](util[_0xbb85('0x30')](_0xbb85('0x90'),_0x384b36[_0xbb85('0x49')]['id']));return{'transcribeStatus':_0xbb85('0x91')};}})['then'](function(_0xb01508){if(_0xb01508){_0xb01508[_0xbb85('0x92')]=_0x384b36[_0xbb85('0x48')][_0xbb85('0x81')];return _0x123d05[_0xbb85('0x93')](_0xb01508);}})[_0xbb85('0x26')](respondWithResult(_0x19982b,null))['catch'](handleError(_0x19982b,null));};function writeFile(_0x3e8c60,_0x2496e4){return new Promise(function(_0x5d7f20,_0xdc8dc5){fs[_0xbb85('0x94')](_0x2496e4,_0x3e8c60,function(_0x15cc1e,_0x51cb54){if(_0x15cc1e){return _0xdc8dc5(_0x15cc1e);}else{return _0x5d7f20(_0x51cb54);}});});}exports[_0xbb85('0x95')]=function(_0x319eb0,_0x2d664e,_0x12a492){return db[_0xbb85('0x43')][_0xbb85('0x7b')]({'where':{'id':_0x319eb0[_0xbb85('0x49')]['id']}})[_0xbb85('0x26')](handleEntityNotFound(_0x2d664e))[_0xbb85('0x26')](function(_0x169c6a){if(_0x169c6a&&_0x169c6a['fileText']){var _0x55606c=_0x169c6a['fileText'];var _0x16fa6d=config[_0xbb85('0x96')]+_0xbb85('0x97')+_0x169c6a['id']+_0xbb85('0x98');if(fs[_0xbb85('0x61')](_0x16fa6d)){return _0x16fa6d;}return writeFile(_0x55606c,_0x16fa6d)[_0xbb85('0x26')](function(){return _0x16fa6d;});}else{throw new db['Sequelize'][(_0xbb85('0x52'))](_0xbb85('0x99'));}})['then'](function(_0x168ad0){return _0x2d664e['download'](_0x168ad0);})['catch'](handleError(_0x2d664e));}; \ No newline at end of file +var _0x3a08=['status','end','json','offset','limit','undefined','count','set','reject','update','then','destroy','error','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','format','keys','filters','intersection','model','query','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','find','catch','body','params','describe','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','download','Not\x20found','sequelize','col','token','$and','push','decryptFile','ValidationError','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','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','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','language','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','moment','path','to-csv','fs-extra','squel','crypto','jsforce','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus'];(function(_0x2777df,_0x5e764f){var _0x51e04d=function(_0x1843e0){while(--_0x1843e0){_0x2777df['push'](_0x2777df['shift']());}};_0x51e04d(++_0x5e764f);}(_0x3a08,0x7a));var _0x83a0=function(_0x8be80e,_0x500faa){_0x8be80e=_0x8be80e-0x0;var _0x11e04b=_0x3a08[_0x8be80e];return _0x11e04b;};'use strict';var emlformat=require(_0x83a0('0x0'));var rimraf=require(_0x83a0('0x1'));var zipdir=require(_0x83a0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x83a0('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x83a0('0x4'));var sox=require('sox');var csv=require(_0x83a0('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x83a0('0x6'));var _=require('lodash');var squel=require(_0x83a0('0x7'));var crypto=require(_0x83a0('0x8'));var jsforce=require(_0x83a0('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x83a0('0xa'));var AWS=require(_0x83a0('0xb'));var uuidv4=require(_0x83a0('0xc'));var Redis=require(_0x83a0('0xd'));var authService=require(_0x83a0('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x83a0('0xf'));var logger=require(_0x83a0('0x10'))(_0x83a0('0x11'));var utils=require('../../config/utils');var config=require(_0x83a0('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x83a0('0x13'))['db'];function respondWithStatusCode(_0x1e8814,_0x136def){_0x136def=_0x136def||0xcc;return function(_0x1c8182){if(_0x1c8182){return _0x1e8814[_0x83a0('0x14')](_0x136def);}return _0x1e8814[_0x83a0('0x15')](_0x136def)[_0x83a0('0x16')]();};}function respondWithResult(_0x1f6a0d,_0x290fed){_0x290fed=_0x290fed||0xc8;return function(_0x3eb40b){if(_0x3eb40b){return _0x1f6a0d[_0x83a0('0x15')](_0x290fed)[_0x83a0('0x17')](_0x3eb40b);}};}function respondWithFilteredResult(_0x185f1e,_0x1eb4c7){return function(_0x4d9e23){if(_0x4d9e23){var _0x3cb708=typeof _0x1eb4c7[_0x83a0('0x18')]==='undefined'&&typeof _0x1eb4c7[_0x83a0('0x19')]===_0x83a0('0x1a');var _0x4f62c6=_0x4d9e23[_0x83a0('0x1b')];var _0x107fe0=_0x3cb708?0x0:_0x1eb4c7[_0x83a0('0x18')];var _0xda80ce=_0x3cb708?_0x4d9e23['count']:_0x1eb4c7['offset']+_0x1eb4c7[_0x83a0('0x19')];var _0x300a5a;if(_0xda80ce>=_0x4f62c6){_0xda80ce=_0x4f62c6;_0x300a5a=0xc8;}else{_0x300a5a=0xce;}_0x185f1e[_0x83a0('0x15')](_0x300a5a);return _0x185f1e[_0x83a0('0x1c')]('Content-Range',_0x107fe0+'-'+_0xda80ce+'/'+_0x4f62c6)[_0x83a0('0x17')](_0x4d9e23);}return null;};}function patchUpdates(_0x2d3332){return function(_0x58d198){try{jsonpatch['apply'](_0x58d198,_0x2d3332,!![]);}catch(_0x3b5e23){return BPromise[_0x83a0('0x1d')](_0x3b5e23);}return _0x58d198['save']();};}function saveUpdates(_0x2eb5a0,_0x659e5b){return function(_0x3fba32){if(_0x3fba32){return _0x3fba32[_0x83a0('0x1e')](_0x2eb5a0)[_0x83a0('0x1f')](function(_0x4cb518){return _0x4cb518;});}return null;};}function removeEntity(_0x157e1e,_0x59f736){return function(_0x4146cf){if(_0x4146cf){return _0x4146cf[_0x83a0('0x20')]()[_0x83a0('0x1f')](function(){_0x157e1e[_0x83a0('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15d22e,_0x59c7c8){return function(_0x4df556){if(!_0x4df556){_0x15d22e[_0x83a0('0x14')](0x194);}return _0x4df556;};}function handleError(_0x159b3b,_0x4be20e){_0x4be20e=_0x4be20e||0x1f4;return function(_0x5b746e){logger[_0x83a0('0x21')](_0x5b746e['stack']);if(_0x5b746e[_0x83a0('0x22')]){delete _0x5b746e[_0x83a0('0x22')];}_0x159b3b[_0x83a0('0x15')](_0x4be20e)[_0x83a0('0x23')](_0x5b746e);};}exports[_0x83a0('0x24')]=function(_0xc0ab6f,_0x3958a4){var _0x2a8b0b={},_0x2ef6e5={},_0x111428={'count':0x0,'rows':[]};var _0x3c2cfa=_[_0x83a0('0x25')](db[_0x83a0('0x26')][_0x83a0('0x27')],function(_0x2d1f27){return{'name':_0x2d1f27[_0x83a0('0x28')],'type':_0x2d1f27[_0x83a0('0x29')][_0x83a0('0x2a')]};});_0x2ef6e5['model']=_['differenceBy'](_[_0x83a0('0x25')](_0x3c2cfa,_0x83a0('0x22')),[_0x83a0('0x2b')]);_0x2ef6e5['query']=_[_0x83a0('0x2c')](_0xc0ab6f['query']);_0x2ef6e5[_0x83a0('0x2d')]=_[_0x83a0('0x2e')](_0x2ef6e5[_0x83a0('0x2f')],_0x2ef6e5[_0x83a0('0x30')]);_0x2a8b0b[_0x83a0('0x31')]=_[_0x83a0('0x2e')](_0x2ef6e5[_0x83a0('0x2f')],qs[_0x83a0('0x32')](_0xc0ab6f[_0x83a0('0x30')][_0x83a0('0x32')]));_0x2a8b0b[_0x83a0('0x31')]=_0x2a8b0b[_0x83a0('0x31')][_0x83a0('0x33')]?_0x2a8b0b['attributes']:_0x2ef6e5[_0x83a0('0x2f')];if(!_0xc0ab6f['query']['hasOwnProperty'](_0x83a0('0x34'))){_0x2a8b0b[_0x83a0('0x19')]=qs['limit'](_0xc0ab6f['query'][_0x83a0('0x19')]);_0x2a8b0b['offset']=qs[_0x83a0('0x18')](_0xc0ab6f[_0x83a0('0x30')]['offset']);}_0x2a8b0b[_0x83a0('0x35')]=qs[_0x83a0('0x36')](_0xc0ab6f[_0x83a0('0x30')]['sort']);_0x2a8b0b['where']=qs[_0x83a0('0x2d')](_[_0x83a0('0x37')](_0xc0ab6f[_0x83a0('0x30')],_0x2ef6e5[_0x83a0('0x2d')]),_0x3c2cfa);if(_0xc0ab6f[_0x83a0('0x30')][_0x83a0('0x38')]){_0x2a8b0b[_0x83a0('0x39')]=_[_0x83a0('0x3a')](_0x2a8b0b['where'],{'$or':_[_0x83a0('0x25')](_0x3c2cfa,function(_0x4acb47){if(_0x4acb47['type']!==_0x83a0('0x3b')){var _0x4a52ee={};_0x4a52ee[_0x4acb47[_0x83a0('0x22')]]={'$like':'%'+_0xc0ab6f[_0x83a0('0x30')]['filter']+'%'};return _0x4a52ee;}})});}_0x2a8b0b=_[_0x83a0('0x3a')]({},_0x2a8b0b,_0xc0ab6f[_0x83a0('0x3c')]);var _0x5dac35={'where':_0x2a8b0b[_0x83a0('0x39')]};return db[_0x83a0('0x26')][_0x83a0('0x1b')](_0x5dac35)['then'](function(_0xa0186b){_0x111428[_0x83a0('0x1b')]=_0xa0186b;if(_0xc0ab6f[_0x83a0('0x30')][_0x83a0('0x3d')]){_0x2a8b0b[_0x83a0('0x3e')]=[{'all':!![]}];}return db[_0x83a0('0x26')]['findAll'](_0x2a8b0b);})['then'](function(_0x11068d){_0x111428[_0x83a0('0x3f')]=_0x11068d;return _0x111428;})['then'](respondWithFilteredResult(_0x3958a4,_0x2a8b0b))['catch'](handleError(_0x3958a4,null));};exports['show']=function(_0x511083,_0x12f605){var _0x55555f={'raw':![],'where':{'id':_0x511083['params']['id']}},_0x14882f={};_0x14882f[_0x83a0('0x2f')]=_[_0x83a0('0x2c')](db[_0x83a0('0x26')][_0x83a0('0x27')]);_0x14882f[_0x83a0('0x30')]=_[_0x83a0('0x2c')](_0x511083['query']);_0x14882f[_0x83a0('0x2d')]=_['intersection'](_0x14882f['model'],_0x14882f[_0x83a0('0x30')]);_0x55555f[_0x83a0('0x31')]=_['intersection'](_0x14882f['model'],qs[_0x83a0('0x32')](_0x511083['query'][_0x83a0('0x32')]));_0x55555f[_0x83a0('0x31')]=_0x55555f[_0x83a0('0x31')]['length']?_0x55555f[_0x83a0('0x31')]:_0x14882f[_0x83a0('0x2f')];if(_0x511083[_0x83a0('0x30')]['includeAll']){_0x55555f[_0x83a0('0x3e')]=[{'all':!![]}];}_0x55555f=_['merge']({},_0x55555f,_0x511083[_0x83a0('0x3c')]);return db[_0x83a0('0x26')][_0x83a0('0x40')](_0x55555f)['then'](handleEntityNotFound(_0x12f605,null))[_0x83a0('0x1f')](respondWithResult(_0x12f605,null))[_0x83a0('0x41')](handleError(_0x12f605,null));};exports['create']=function(_0x35666b,_0x1dc2d5){return db[_0x83a0('0x26')]['create'](_0x35666b[_0x83a0('0x42')],{})[_0x83a0('0x1f')](respondWithResult(_0x1dc2d5,0xc9))[_0x83a0('0x41')](handleError(_0x1dc2d5,null));};exports['update']=function(_0x4c3565,_0x12abdf){if(_0x4c3565['body']['id']){delete _0x4c3565[_0x83a0('0x42')]['id'];}return db['VoiceRecording'][_0x83a0('0x40')]({'where':{'id':_0x4c3565[_0x83a0('0x43')]['id']}})[_0x83a0('0x1f')](handleEntityNotFound(_0x12abdf,null))[_0x83a0('0x1f')](saveUpdates(_0x4c3565[_0x83a0('0x42')],null))[_0x83a0('0x1f')](respondWithResult(_0x12abdf,null))['catch'](handleError(_0x12abdf,null));};exports[_0x83a0('0x44')]=function(_0x2e39ba,_0x10f4e7){return db['VoiceRecording'][_0x83a0('0x44')]()[_0x83a0('0x1f')](respondWithResult(_0x10f4e7,null))[_0x83a0('0x41')](handleError(_0x10f4e7,null));};exports['download']=function(_0x227eb8,_0x5a02d4,_0xf6de87){var _0x5cd9ab=require(_0x83a0('0x45'));var _0x4b5104=![];var _0xf239fd={};if(_0x227eb8[_0x83a0('0x30')]['type']&&_0x227eb8[_0x83a0('0x30')][_0x83a0('0x29')]===_0x83a0('0x46')){_0xf239fd[_0x83a0('0x46')]=_0x227eb8[_0x83a0('0x43')]['id'];}else{_0xf239fd['id']=_0x227eb8['params']['id'];}return db['VoiceRecording'][_0x83a0('0x40')]({'where':_0xf239fd,'attributes':['id','value'],'raw':!![]})[_0x83a0('0x1f')](handleEntityNotFound(_0x5a02d4,null))[_0x83a0('0x1f')](function(_0x46f876){if(_0x46f876){var _0x291b1c=_0x46f876[_0x83a0('0x47')];var _0x13b8d7=util['format'](_0x83a0('0x48'),_0x291b1c);if(fs[_0x83a0('0x49')](_0x13b8d7)){_0x4b5104=!![];return _0x5cd9ab['decryptFile'](_0x13b8d7,_0x291b1c,config[_0x83a0('0x4a')][_0x83a0('0x4b')])['then'](function(){return _0x46f876;});}return _0x46f876;}})[_0x83a0('0x1f')](function(_0x311c2c){if(_0x311c2c){var _0xfac7d5=_0x311c2c['value'];if(!fs['existsSync'](_0xfac7d5)){throw new db[(_0x83a0('0x4c'))]['ValidationError'](_0x83a0('0x4d'));}if(_0x311c2c['filename']){return _0x5a02d4['download'](_0xfac7d5,_0x311c2c[_0x83a0('0x4e')]+path[_0x83a0('0x4f')](_0xfac7d5),function(){if(_0x4b5104){fs[_0x83a0('0x50')](_0xfac7d5);}});}else{return _0x5a02d4[_0x83a0('0x51')](_0xfac7d5,function(_0xab8f39){if(_0x4b5104){fs[_0x83a0('0x50')](_0xfac7d5);}});}}})[_0x83a0('0x41')](function(_0x513d78){if(_0x513d78['message']===_0x83a0('0x4d')){_0x5a02d4[_0x83a0('0x15')](0x194)[_0x83a0('0x23')](_0x83a0('0x52'));}else{return handleError(_0x5a02d4,null);}});};exports['downloads']=function(_0x4f2fb7,_0x51fdec,_0x1cb95d){var _0x192436=require(_0x83a0('0x45'));var _0x335a71=![];var _0x14a37d={'$and':[db[_0x83a0('0x53')][_0x83a0('0x39')](db[_0x83a0('0x53')]['fn']('MD5',db[_0x83a0('0x53')][_0x83a0('0x54')]('uniqueid')),_0x4f2fb7['query'][_0x83a0('0x55')])]};if(_0x4f2fb7[_0x83a0('0x30')][_0x83a0('0x29')]&&_0x4f2fb7[_0x83a0('0x30')][_0x83a0('0x29')]===_0x83a0('0x46')){_0x14a37d[_0x83a0('0x56')][_0x83a0('0x57')]({'uniqueid':_0x4f2fb7[_0x83a0('0x43')]['id']});}else{_0x14a37d[_0x83a0('0x56')][_0x83a0('0x57')]({'id':_0x4f2fb7[_0x83a0('0x43')]['id']});}return db[_0x83a0('0x26')]['find']({'where':_0x14a37d,'attributes':['id',_0x83a0('0x47')],'raw':!![]})[_0x83a0('0x1f')](handleEntityNotFound(_0x51fdec,null))['then'](function(_0x5b78d5){if(_0x5b78d5){var _0x2f0195=util['format'](_0x83a0('0x48'),_0x5b78d5[_0x83a0('0x47')]);if(fs[_0x83a0('0x49')](_0x2f0195)){_0x335a71=!![];return _0x192436[_0x83a0('0x58')](_0x2f0195,_0x5b78d5[_0x83a0('0x47')],config[_0x83a0('0x4a')][_0x83a0('0x4b')])[_0x83a0('0x1f')](function(){return _0x5b78d5;});}return _0x5b78d5;}})[_0x83a0('0x1f')](function(_0xb157e3){if(_0xb157e3){if(!fs[_0x83a0('0x49')](_0xb157e3[_0x83a0('0x47')])){throw new db[(_0x83a0('0x4c'))][(_0x83a0('0x59'))](_0x83a0('0x4d'));}if(_0xb157e3[_0x83a0('0x4e')]){return _0x51fdec[_0x83a0('0x51')](_0xb157e3[_0x83a0('0x47')],_0xb157e3[_0x83a0('0x4e')]+path[_0x83a0('0x4f')](_0xb157e3[_0x83a0('0x47')]),function(){if(_0x335a71){fs[_0x83a0('0x50')](_0xb157e3['value']);}});}else{return _0x51fdec[_0x83a0('0x51')](_0xb157e3['value'],function(_0x2fba78){if(_0x335a71){fs[_0x83a0('0x50')](_0xb157e3[_0x83a0('0x47')]);}});}}})[_0x83a0('0x41')](handleError(_0x51fdec,null));};exports[_0x83a0('0x20')]=function(_0x391e43,_0x2abb3e){return db[_0x83a0('0x26')][_0x83a0('0x40')]({'where':{'id':_0x391e43[_0x83a0('0x43')]['id']}})[_0x83a0('0x1f')](function(_0x2da7b4){if(_[_0x83a0('0x5a')](_0x2da7b4)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2da7b4;})['then'](function(_0x12f6d6){var _0xbf2fd8=_0x12f6d6['value'];logger[_0x83a0('0x5b')](_0x83a0('0x5c'),_0xbf2fd8);if(!_[_0x83a0('0x5a')](_0x12f6d6[_0x83a0('0x47')])&&fs[_0x83a0('0x49')](_0xbf2fd8)){logger[_0x83a0('0x5b')](_0x83a0('0x5d')+_0xbf2fd8+_0x83a0('0x5e'));fs[_0x83a0('0x5f')](_0xbf2fd8);}_0xbf2fd8=_0xbf2fd8+_0x83a0('0x60');if(!_[_0x83a0('0x5a')](_0x12f6d6[_0x83a0('0x47')])&&fs[_0x83a0('0x49')](_0xbf2fd8)){logger[_0x83a0('0x5b')]('File:\x20\x22'+_0xbf2fd8+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0xbf2fd8);}return _0x12f6d6;})[_0x83a0('0x1f')](function(_0x6ca1d5){if(!_0x6ca1d5)throw new InternalError();return _0x6ca1d5[_0x83a0('0x20')]();})[_0x83a0('0x1f')](function(){_0x2abb3e[_0x83a0('0x15')](0xcc)[_0x83a0('0x16')]();})[_0x83a0('0x41')](handleError(_0x2abb3e,null));};function getBucketslist(_0x53a3f2,_0x3df0dd,_0x22463f){return new Promise(function(_0x453e07,_0x1f6867){var _0x22d78a=new AWS['S3']({'accessKeyId':_0x3df0dd,'secretAccessKey':_0x53a3f2,'region':_0x22463f});_0x22d78a[_0x83a0('0x61')]({},function(_0xa08fe0,_0x1fa80a){if(_0xa08fe0){return _0x1f6867(_0xa08fe0);}else{return _0x453e07(_0x1fa80a);}});});}function createBucket(_0x1fe7d0,_0xc8b7f7,_0x57c301,_0x46c212){return new Promise(function(_0xa45094,_0xf2ce08){var _0x41f859=new AWS['S3']({'accessKeyId':_0xc8b7f7,'secretAccessKey':_0x1fe7d0,'region':_0x57c301});_0x41f859[_0x83a0('0x62')]({'Bucket':_0x46c212},function(_0x389e2e,_0x13136b){if(_0x389e2e){return _0xf2ce08(_0x389e2e);}else{return _0xa45094(_0x13136b);}});});}function uploadFile(_0x4c0783,_0x262e4d,_0x359f7c,_0x20a2b4,_0x202025,_0x4bd76b){return new Promise(function(_0x55b814,_0x40cea1){var _0x593783=new AWS['S3']({'accessKeyId':_0x262e4d,'secretAccessKey':_0x4c0783,'region':_0x359f7c});_0x593783['upload']({'Bucket':_0x20a2b4,'Key':_0x202025,'Body':_0x4bd76b},function(_0x4d7cc2,_0x48ef40){if(_0x4d7cc2){return _0x40cea1(_0x4d7cc2);}else{return _0x55b814(_0x48ef40);}});});}function startTranscribe(_0xce586,_0x3559db,_0x4d89fc,_0x3012fd,_0x4b48a9,_0xf6b4bf){return new Promise(function(_0x34470a,_0x51ce0a){var _0x3ed6d6=new AWS[(_0x83a0('0x63'))]({'accessKeyId':_0x3559db,'secretAccessKey':_0xce586,'region':_0x4d89fc});_0x3ed6d6[_0x83a0('0x64')]({'TranscriptionJobName':_0x3012fd,'LanguageCode':_0x4b48a9,'Media':{'MediaFileUri':_0xf6b4bf}},function(_0x12c573,_0x5544f2){if(_0x12c573){return _0x51ce0a(_0x12c573);}else{return _0x34470a(_0x5544f2);}});});}function transcribe(_0x1dcff5,_0x14cf63,_0x198828,_0x4e7ff6,_0x19d91a,_0x5cbfab,_0x19a59b){return new Promise(function(_0x2987b5,_0x27ee74){var _0x29ee92={};logger[_0x83a0('0x5b')](util[_0x83a0('0x2b')](_0x83a0('0x65'),_0x1dcff5,_0x19d91a));return uploadFile(_0x14cf63,_0x198828,_0x4e7ff6,_0x19d91a,path[_0x83a0('0x66')](_0x5cbfab),fs[_0x83a0('0x67')](_0x5cbfab))[_0x83a0('0x1f')](function(_0x15424d){logger[_0x83a0('0x5b')](util['format'](_0x83a0('0x68'),_0x1dcff5,_0x19d91a,_0x15424d[_0x83a0('0x69')]));_0x29ee92[_0x83a0('0x6a')]=_0x15424d[_0x83a0('0x6b')];_0x29ee92[_0x83a0('0x6c')]=_0x15424d[_0x83a0('0x69')];logger[_0x83a0('0x5b')](util['format']('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x1dcff5));return startTranscribe(_0x14cf63,_0x198828,_0x4e7ff6,uuidv4(),_0x19a59b,_0x15424d['Location']);})[_0x83a0('0x1f')](function(_0x3c4e99){logger[_0x83a0('0x5b')](util[_0x83a0('0x2b')](_0x83a0('0x6d'),_0x1dcff5,_0x3c4e99[_0x83a0('0x6e')]['TranscriptionJobName']));_0x29ee92[_0x83a0('0x6f')]=_0x3c4e99['TranscriptionJob'][_0x83a0('0x70')];_0x29ee92[_0x83a0('0x71')]=_0x3c4e99[_0x83a0('0x6e')][_0x83a0('0x72')];return _0x2987b5(_0x29ee92);})[_0x83a0('0x41')](function(_0x52d358){return _0x27ee74(_0x52d358);});});}exports['runTranscribe']=function(_0x50d4d1,_0x4d0bb2,_0xcc00ef){var _0x4d893f;var _0x4c1ed4;var _0x18980a;var _0x52f45d=require('../../components/encryptor');return db[_0x83a0('0x26')]['findOne']({'where':{'id':_0x50d4d1['params']['id']}})[_0x83a0('0x1f')](function(_0x32fcd4){if(_0x32fcd4){var _0x4ebb72=util[_0x83a0('0x2b')](_0x83a0('0x48'),_0x32fcd4['value']);if(fs[_0x83a0('0x49')](_0x4ebb72)){cypher=!![];return _0x52f45d[_0x83a0('0x58')](_0x4ebb72,_0x32fcd4[_0x83a0('0x47')],config[_0x83a0('0x4a')]['recording'])[_0x83a0('0x1f')](function(){return _0x32fcd4;});}return _0x32fcd4;}})[_0x83a0('0x1f')](function(_0x169dae){if(!_0x169dae){throw new db[(_0x83a0('0x4c'))]['ValidationError'](_0x83a0('0x73'));}_0x4c1ed4=_0x169dae;return db[_0x83a0('0x74')][_0x83a0('0x75')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x4d0bb2,null))[_0x83a0('0x1f')](function(_0x500d43){if(_0x500d43){_0x4d893f=_0x500d43;if(!_0x4d893f[_0x83a0('0x76')]||!_0x4d893f['transcribeAccountId']||!_0x4d893f['transcribeRegion']||!_0x4d893f['language']||!_0x4d893f[_0x83a0('0x6a')]){throw new db[(_0x83a0('0x4c'))][(_0x83a0('0x59'))](_0x83a0('0x77'));}if(_0x50d4d1['body'][_0x83a0('0x78')]&&(!_0x4d893f[_0x83a0('0x79')]||!_0x4d893f[_0x83a0('0x7a')]||!_0x4d893f['sentimentRegion']||!_0x4d893f['language']||!_0x4d893f[_0x83a0('0x6a')])){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x83a0('0x7b')][_0x83a0('0x75')]({'where':{'id':_0x4d893f[_0x83a0('0x7c')]}});}})[_0x83a0('0x1f')](function(_0x241699){if(!_0x241699){throw new db[(_0x83a0('0x4c'))][(_0x83a0('0x59'))](_0x83a0('0x7d'));}if(!_0x241699[_0x83a0('0x7e')]||!_0x241699[_0x83a0('0x7f')]){throw new db['Sequelize'][(_0x83a0('0x59'))](_0x83a0('0x80'));}_0x18980a=_0x241699;return getBucketslist(_0x18980a['data1'],_0x18980a['data2'],_0x4d893f[_0x83a0('0x81')]);})[_0x83a0('0x1f')](function(_0x95cfdc){if(_0x95cfdc&&_0x95cfdc['Buckets']){var _0x488ec9=_['find'](_0x95cfdc['Buckets'],function(_0x1c4598){return _0x1c4598[_0x83a0('0x82')]===_0x4d893f[_0x83a0('0x6a')];});if(!_0x488ec9){logger[_0x83a0('0x5b')](util[_0x83a0('0x2b')](_0x83a0('0x83'),_0x50d4d1['params']['id'],_0x4d893f[_0x83a0('0x6a')]));return createBucket(_0x18980a['data1'],_0x18980a[_0x83a0('0x7f')],_0x4d893f['transcribeRegion'],_0x4d893f['bucket']);}logger[_0x83a0('0x5b')](util[_0x83a0('0x2b')](_0x83a0('0x84'),_0x50d4d1[_0x83a0('0x43')]['id'],_0x4d893f[_0x83a0('0x6a')]));return;}})['then'](function(_0xb9e8f3){if(_0x4c1ed4[_0x83a0('0x71')]===_0x83a0('0x85')){return transcribe(_0x50d4d1[_0x83a0('0x43')]['id'],_0x18980a[_0x83a0('0x7e')],_0x18980a['data2'],_0x4d893f[_0x83a0('0x81')],_0x4d893f[_0x83a0('0x6a')],_0x4c1ed4[_0x83a0('0x47')],_0x4d893f[_0x83a0('0x86')]);}else{logger[_0x83a0('0x5b')](util[_0x83a0('0x2b')](_0x83a0('0x87'),_0x50d4d1[_0x83a0('0x43')]['id']));return{'transcribeStatus':_0x83a0('0x88')};}})[_0x83a0('0x1f')](function(_0x25efa8){if(_0x25efa8){_0x25efa8['tempSentiment']=_0x50d4d1['body'][_0x83a0('0x78')];return _0x4c1ed4[_0x83a0('0x89')](_0x25efa8);}})[_0x83a0('0x1f')](respondWithResult(_0x4d0bb2,null))[_0x83a0('0x41')](handleError(_0x4d0bb2,null));};function writeFile(_0x3c431a,_0x4575fc){return new Promise(function(_0x83641b,_0x111901){fs[_0x83a0('0x8a')](_0x4575fc,_0x3c431a,function(_0x448c27,_0x4f5b75){if(_0x448c27){return _0x111901(_0x448c27);}else{return _0x83641b(_0x4f5b75);}});});}exports[_0x83a0('0x8b')]=function(_0x89333d,_0x17786a,_0x44c516){return db[_0x83a0('0x26')][_0x83a0('0x75')]({'where':{'id':_0x89333d[_0x83a0('0x43')]['id']}})['then'](handleEntityNotFound(_0x17786a))[_0x83a0('0x1f')](function(_0x3553c0){if(_0x3553c0&&_0x3553c0[_0x83a0('0x8c')]){var _0x354337=_0x3553c0[_0x83a0('0x8c')];var _0xb5854e=config['root']+_0x83a0('0x8d')+_0x3553c0['id']+'.txt';if(fs[_0x83a0('0x49')](_0xb5854e)){return _0xb5854e;}return writeFile(_0x354337,_0xb5854e)['then'](function(){return _0xb5854e;});}else{throw new db[(_0x83a0('0x4c'))]['ValidationError'](_0x83a0('0x8e'));}})[_0x83a0('0x1f')](function(_0x533be5){return _0x17786a['download'](_0x533be5);})[_0x83a0('0x41')](handleError(_0x17786a));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 5a2e69b..4009d33 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 _0xbf1a=['define','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x557fd2,_0x2c0a7a){var _0x1b54a2=function(_0x2e439b){while(--_0x2e439b){_0x557fd2['push'](_0x557fd2['shift']());}};_0x1b54a2(++_0x2c0a7a);}(_0xbf1a,0x7c));var _0xabf1=function(_0x461577,_0x5c6c79){_0x461577=_0x461577-0x0;var _0x5751c5=_0xbf1a[_0x461577];return _0x5751c5;};'use strict';var attributes=require(_0xabf1('0x0'));module[_0xabf1('0x1')]=function(_0x7cbc88,_0x2132b4){return _0x7cbc88[_0xabf1('0x2')]('VoiceRecording',attributes,{'tableName':_0xabf1('0x3'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xabf1('0x4')]},{'name':_0xabf1('0x5'),'fields':[_0xabf1('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3fec=['voice_recordings','transcribeStatus','./voiceRecording.attributes','define'];(function(_0x5e9054,_0x496c02){var _0x1dd43f=function(_0x4c393e){while(--_0x4c393e){_0x5e9054['push'](_0x5e9054['shift']());}};_0x1dd43f(++_0x496c02);}(_0x3fec,0x1ba));var _0xc3fe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3fec[_0x20a584];return _0x4b41a8;};'use strict';var attributes=require(_0xc3fe('0x0'));module['exports']=function(_0x502342,_0x3096c1){return _0x502342[_0xc3fe('0x1')]('VoiceRecording',attributes,{'tableName':_0xc3fe('0x2'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']},{'name':_0xc3fe('0x3'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 55acadb..f8799cb 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 _0x7b84=['VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','raw','where','attributes','limit','UpdateVoiceRecording','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','create','body','existsSync','value','format','%s.cypher','recording','unlink','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x7b84,0x17c));var _0x47b8=function(_0x31fbfb,_0x306890){_0x31fbfb=_0x31fbfb-0x0;var _0x51013d=_0x7b84[_0x31fbfb];return _0x51013d;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var moment=require(_0x47b8('0x2'));var BPromise=require(_0x47b8('0x3'));var rs=require(_0x47b8('0x4'));var fs=require('fs');var Redis=require(_0x47b8('0x5'));var db=require(_0x47b8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x47b8('0x7'))(_0x47b8('0x8'));var config=require(_0x47b8('0x9'));var jayson=require(_0x47b8('0xa'));var client=jayson[_0x47b8('0xb')][_0x47b8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x53e656,_0x3867ca,_0x3ce846){return new BPromise(function(_0x46245a,_0xb845c9){return client[_0x47b8('0xd')](_0x53e656,_0x3ce846)[_0x47b8('0xe')](function(_0x24d240){logger[_0x47b8('0xf')](_0x47b8('0x10'),_0x3867ca,_0x47b8('0x11'));logger[_0x47b8('0x12')](_0x47b8('0x13'),_0x3867ca,_0x47b8('0x11'),JSON[_0x47b8('0x14')](_0x24d240));if(_0x24d240[_0x47b8('0x15')]){if(_0x24d240[_0x47b8('0x15')][_0x47b8('0x16')]===0x1f4){logger[_0x47b8('0x15')](_0x47b8('0x10'),_0x3867ca,_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);return _0xb845c9(_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);}logger[_0x47b8('0x15')](_0x47b8('0x10'),_0x3867ca,_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);return _0x46245a(_0x24d240['error'][_0x47b8('0x17')]);}else{logger[_0x47b8('0xf')](_0x47b8('0x10'),_0x3867ca,_0x47b8('0x11'));_0x46245a(_0x24d240[_0x47b8('0x18')][_0x47b8('0x17')]);}})[_0x47b8('0x19')](function(_0x5ad3ae){logger[_0x47b8('0x15')]('VoiceRecording,\x20%s,\x20%s',_0x3867ca,_0x5ad3ae);_0xb845c9(_0x5ad3ae);});});}exports['UpdateVoiceRecording']=function(_0x4f7317){var _0x299195=this;return new Promise(function(_0x36faf1,_0x2797ac){return db['VoiceRecording']['update'](_0x4f7317['body'],{'raw':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317['options'][_0x47b8('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317[_0x47b8('0x1a')][_0x47b8('0x1c')]||null:null,'attributes':_0x4f7317['options']?_0x4f7317[_0x47b8('0x1a')][_0x47b8('0x1d')]||null:null,'limit':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317[_0x47b8('0x1a')][_0x47b8('0x1e')]||null:null})[_0x47b8('0xe')](function(_0x54f6bc){logger[_0x47b8('0xf')](_0x47b8('0x1f'),_0x4f7317);logger['debug'](_0x47b8('0x1f'),_0x4f7317,JSON[_0x47b8('0x14')](_0x54f6bc));_0x36faf1(_0x54f6bc);})[_0x47b8('0x19')](function(_0x142fb6){logger['error'](_0x47b8('0x1f'),_0x142fb6[_0x47b8('0x17')],_0x4f7317);_0x2797ac(_0x299195[_0x47b8('0x15')](0x1f4,_0x142fb6[_0x47b8('0x17')]));});});};exports[_0x47b8('0x20')]=function(_0xbf5ce9){var _0x40918f=this;return new Promise(function(_0x568c1e,_0x43fd49){var _0x1f719a=require('../../components/encryptor');var _0x195a66;return db[_0x47b8('0x21')][_0x47b8('0x22')]({'attributes':['id',_0x47b8('0x23')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x162d96){_0x195a66=_0x162d96;return db['VoiceRecording'][_0x47b8('0x24')](_0xbf5ce9[_0x47b8('0x25')]);})[_0x47b8('0xe')](function(_0x2e540d){if(_0x195a66['callRecordingEncryption']&&fs[_0x47b8('0x26')](_0x2e540d[_0x47b8('0x27')])){var _0x402e7c=util[_0x47b8('0x28')](_0x47b8('0x29'),_0x2e540d[_0x47b8('0x27')]);return _0x1f719a['encryptFile'](_0x2e540d['value'],_0x402e7c,config['secrets'][_0x47b8('0x2a')])[_0x47b8('0xe')](function(){fs[_0x47b8('0x2b')](_0x2e540d['value']);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x2e540d;});}return _0x2e540d;})['then'](function(_0x347769){logger[_0x47b8('0xf')](_0x47b8('0x20'),_0xbf5ce9);logger[_0x47b8('0x12')](_0x47b8('0x20'),_0xbf5ce9,JSON[_0x47b8('0x14')](_0x347769));_0x568c1e(_0x347769);})[_0x47b8('0x19')](function(_0x460dcc){logger[_0x47b8('0x15')]('CreateVoiceRecording',_0x460dcc['message'],_0xbf5ce9);_0x43fd49(_0x40918f[_0x47b8('0x15')](0x1f4,_0x460dcc[_0x47b8('0x17')]));});});}; \ No newline at end of file +var _0x5c3c=['../../config/environment','jayson/promise','client','http','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','CreateVoiceRecording','findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','debug','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x56c1a4,_0x4f8746){var _0x5d7341=function(_0xd890ab){while(--_0xd890ab){_0x56c1a4['push'](_0x56c1a4['shift']());}};_0x5d7341(++_0x4f8746);}(_0x5c3c,0x132));var _0xc5c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5c3c[_0x20a584];return _0x4b41a8;};'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')](_0x2ff158[_0xc5c3('0x1a')],{'raw':_0x2ff158[_0xc5c3('0x1b')]?_0x2ff158['options'][_0xc5c3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ff158[_0xc5c3('0x1b')]?_0x2ff158[_0xc5c3('0x1b')][_0xc5c3('0x1d')]||null:null,'attributes':_0x2ff158[_0xc5c3('0x1b')]?_0x2ff158['options'][_0xc5c3('0x1e')]||null:null,'limit':_0x2ff158[_0xc5c3('0x1b')]?_0x2ff158[_0xc5c3('0x1b')][_0xc5c3('0x1f')]||null:null})[_0xc5c3('0xd')](function(_0x67445){logger[_0xc5c3('0x15')]('UpdateVoiceRecording',_0x2ff158);logger['debug'](_0xc5c3('0x17'),_0x2ff158,JSON[_0xc5c3('0x11')](_0x67445));_0x28bae6(_0x67445);})['catch'](function(_0x5c7329){logger[_0xc5c3('0x12')](_0xc5c3('0x17'),_0x5c7329[_0xc5c3('0x14')],_0x2ff158);_0x5e11d5(_0x13c867['error'](0x1f4,_0x5c7329['message']));});});};exports[_0xc5c3('0x20')]=function(_0x22f607){var _0x20c506=this;return new Promise(function(_0x29791c,_0x5caf85){var _0x21efd6=require('../../components/encryptor');var _0x2eacec;return db['Setting'][_0xc5c3('0x21')]({'attributes':['id',_0xc5c3('0x22')],'where':{'id':0x1},'raw':!![]})[_0xc5c3('0xd')](function(_0x4773c5){_0x2eacec=_0x4773c5;return db[_0xc5c3('0x18')][_0xc5c3('0x23')](_0x22f607[_0xc5c3('0x1a')]);})['then'](function(_0xbcafd6){if(_0x2eacec['callRecordingEncryption']&&fs[_0xc5c3('0x24')](_0xbcafd6[_0xc5c3('0x25')])){var _0x5b26e9=util['format'](_0xc5c3('0x26'),_0xbcafd6[_0xc5c3('0x25')]);return _0x21efd6[_0xc5c3('0x27')](_0xbcafd6[_0xc5c3('0x25')],_0x5b26e9,config['secrets'][_0xc5c3('0x28')])[_0xc5c3('0xd')](function(){fs[_0xc5c3('0x29')](_0xbcafd6[_0xc5c3('0x25')]);logger[_0xc5c3('0x15')](_0xc5c3('0x2a'));return _0xbcafd6;});}return _0xbcafd6;})[_0xc5c3('0xd')](function(_0x1e6749){logger[_0xc5c3('0x15')]('CreateVoiceRecording',_0x22f607);logger[_0xc5c3('0x2b')](_0xc5c3('0x20'),_0x22f607,JSON[_0xc5c3('0x11')](_0x1e6749));_0x29791c(_0x1e6749);})[_0xc5c3('0x2c')](function(_0x330391){logger[_0xc5c3('0x12')](_0xc5c3('0x20'),_0x330391['message'],_0x22f607);_0x5caf85(_0x20c506['error'](0x1f4,_0x330391[_0xc5c3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index a9acac3..a2676c0 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 _0x760b=['put','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post'];(function(_0x5caadc,_0x4bbf3f){var _0x5877fa=function(_0x51b1a6){while(--_0x51b1a6){_0x5caadc['push'](_0x5caadc['shift']());}};_0x5877fa(++_0x4bbf3f);}(_0x760b,0x16b));var _0xb760=function(_0xcbee2,_0x2beacc){_0xcbee2=_0xcbee2-0x0;var _0x45a41a=_0x760b[_0xcbee2];return _0x45a41a;};'use strict';var multer=require(_0xb760('0x0'));var util=require(_0xb760('0x1'));var path=require(_0xb760('0x2'));var timeout=require(_0xb760('0x3'));var express=require(_0xb760('0x4'));var router=express['Router']();var fs_extra=require(_0xb760('0x5'));var auth=require(_0xb760('0x6'));var interaction=require(_0xb760('0x7'));var config=require(_0xb760('0x8'));var controller=require(_0xb760('0x9'));router[_0xb760('0xa')]('/',auth[_0xb760('0xb')](),controller[_0xb760('0xc')]);router['get']('/describe',auth[_0xb760('0xb')](),controller[_0xb760('0xd')]);router['get'](_0xb760('0xe'),auth[_0xb760('0xb')](),controller[_0xb760('0xf')]);router[_0xb760('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb760('0x11')]('/:id',auth[_0xb760('0xb')](),controller[_0xb760('0x12')]);router['delete']('/:id',auth[_0xb760('0xb')](),controller['destroy']);module[_0xb760('0x13')]=router; \ No newline at end of file +var _0xae39=['index','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','express','Router','./voiceTransferReport.controller'];(function(_0x18e1eb,_0x531b8e){var _0x2f506e=function(_0xf05899){while(--_0xf05899){_0x18e1eb['push'](_0x18e1eb['shift']());}};_0x2f506e(++_0x531b8e);}(_0xae39,0x11b));var _0x9ae3=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xae39[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require(_0x9ae3('0x0'));var util=require(_0x9ae3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9ae3('0x2'));var router=express[_0x9ae3('0x3')]();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(_0x9ae3('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x9ae3('0x5')]);router[_0x9ae3('0x6')](_0x9ae3('0x7'),auth[_0x9ae3('0x8')](),controller[_0x9ae3('0x9')]);router[_0x9ae3('0x6')](_0x9ae3('0xa'),auth[_0x9ae3('0x8')](),controller[_0x9ae3('0xb')]);router[_0x9ae3('0xc')]('/',auth['isAuthenticated'](),controller[_0x9ae3('0xd')]);router[_0x9ae3('0xe')](_0x9ae3('0xa'),auth[_0x9ae3('0x8')](),controller[_0x9ae3('0xf')]);router[_0x9ae3('0x10')]('/:id',auth[_0x9ae3('0x8')](),controller[_0x9ae3('0x11')]);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 bf92d16..1483dfe 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 _0x121f=['attended','STRING','Yes','moment','exports','ENUM','blind'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x121f,0xce));var _0xf121=function(_0x255ac0,_0x3f6645){_0x255ac0=_0x255ac0-0x0;var _0x437bf1=_0x121f[_0x255ac0];return _0x437bf1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf121('0x0'));module[_0xf121('0x1')]={'type':{'type':Sequelize[_0xf121('0x2')](_0xf121('0x3'),_0xf121('0x4'))},'result':{'type':Sequelize[_0xf121('0x5')]},'transfererchannel':{'type':Sequelize[_0xf121('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xf121('0x5')]},'transferercalleridname':{'type':Sequelize[_0xf121('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xf121('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xf121('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xf121('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xf121('0x5')]},'transfereechannel':{'type':Sequelize[_0xf121('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xf121('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xf121('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xf121('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xf121('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xf121('0x5')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xf121('0x2')](_0xf121('0x6'),'No')},'context':{'type':Sequelize[_0xf121('0x5')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0f43=['exports','blind','STRING','ENUM','Yes','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f43,0x8f));var _0x30f4=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x0f43[_0x4a53d];return _0x27410e;};'use strict';var Sequelize=require(_0x30f4('0x0'));var moment=require('moment');module[_0x30f4('0x1')]={'type':{'type':Sequelize['ENUM'](_0x30f4('0x2'),'attended')},'result':{'type':Sequelize[_0x30f4('0x3')]},'transfererchannel':{'type':Sequelize[_0x30f4('0x3')]},'transferercalleridnum':{'type':Sequelize[_0x30f4('0x3')]},'transferercalleridname':{'type':Sequelize[_0x30f4('0x3')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x30f4('0x3')]},'transfereraccountcode':{'type':Sequelize[_0x30f4('0x3')]},'transferercontext':{'type':Sequelize[_0x30f4('0x3')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x30f4('0x3')]},'transfereechannel':{'type':Sequelize[_0x30f4('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0x30f4('0x3')]},'transfereecalleridname':{'type':Sequelize[_0x30f4('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x30f4('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0x30f4('0x3')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x30f4('0x3')]},'transfereeexten':{'type':Sequelize[_0x30f4('0x3')]},'transfereelinkedid':{'type':Sequelize[_0x30f4('0x3')]},'isexternal':{'type':Sequelize[_0x30f4('0x4')](_0x30f4('0x5'),'No')},'context':{'type':Sequelize[_0x30f4('0x3')]},'extension':{'type':Sequelize[_0x30f4('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index a9dbdf4..88e975e 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 _0x2fa8=['destroy','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','count','findAll','rows','params','keys','includeAll','include','find','catch','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','apply','reject','save','update','then'];(function(_0x472815,_0x585779){var _0x54f08d=function(_0x379fd0){while(--_0x379fd0){_0x472815['push'](_0x472815['shift']());}};_0x54f08d(++_0x585779);}(_0x2fa8,0x103));var _0x82fa=function(_0x2025d1,_0x465966){_0x2025d1=_0x2025d1-0x0;var _0x184ee1=_0x2fa8[_0x2025d1];return _0x184ee1;};'use strict';var emlformat=require(_0x82fa('0x0'));var rimraf=require(_0x82fa('0x1'));var zipdir=require(_0x82fa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x82fa('0x3'));var BPromise=require(_0x82fa('0x4'));var Mustache=require(_0x82fa('0x5'));var util=require(_0x82fa('0x6'));var path=require(_0x82fa('0x7'));var sox=require(_0x82fa('0x8'));var csv=require(_0x82fa('0x9'));var ejs=require(_0x82fa('0xa'));var fs=require('fs');var fs_extra=require(_0x82fa('0xb'));var _=require(_0x82fa('0xc'));var squel=require(_0x82fa('0xd'));var crypto=require('crypto');var jsforce=require(_0x82fa('0xe'));var deskjs=require(_0x82fa('0xf'));var toCsv=require(_0x82fa('0x9'));var querystring=require('querystring');var Papa=require(_0x82fa('0x10'));var Redis=require(_0x82fa('0x11'));var authService=require(_0x82fa('0x12'));var qs=require(_0x82fa('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x82fa('0x14'));var logger=require(_0x82fa('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x82fa('0x16'));var db=require(_0x82fa('0x17'))['db'];function respondWithStatusCode(_0x5b1fe3,_0x6a1164){_0x6a1164=_0x6a1164||0xcc;return function(_0x1aaae2){if(_0x1aaae2){return _0x5b1fe3[_0x82fa('0x18')](_0x6a1164);}return _0x5b1fe3['status'](_0x6a1164)[_0x82fa('0x19')]();};}function respondWithResult(_0x29c456,_0x1762c5){_0x1762c5=_0x1762c5||0xc8;return function(_0xa1b25a){if(_0xa1b25a){return _0x29c456[_0x82fa('0x1a')](_0x1762c5)[_0x82fa('0x1b')](_0xa1b25a);}};}function respondWithFilteredResult(_0x451489,_0x2206f2){return function(_0x54a3f3){if(_0x54a3f3){var _0xe461e8=typeof _0x2206f2[_0x82fa('0x1c')]===_0x82fa('0x1d')&&typeof _0x2206f2['limit']==='undefined';var _0x34f200=_0x54a3f3['count'];var _0x280cb1=_0xe461e8?0x0:_0x2206f2['offset'];var _0x5be1b2=_0xe461e8?_0x54a3f3['count']:_0x2206f2[_0x82fa('0x1c')]+_0x2206f2[_0x82fa('0x1e')];var _0x3ca098;if(_0x5be1b2>=_0x34f200){_0x5be1b2=_0x34f200;_0x3ca098=0xc8;}else{_0x3ca098=0xce;}_0x451489[_0x82fa('0x1a')](_0x3ca098);return _0x451489[_0x82fa('0x1f')]('Content-Range',_0x280cb1+'-'+_0x5be1b2+'/'+_0x34f200)[_0x82fa('0x1b')](_0x54a3f3);}return null;};}function patchUpdates(_0x463a7f){return function(_0x35f069){try{jsonpatch[_0x82fa('0x20')](_0x35f069,_0x463a7f,!![]);}catch(_0x1afd5c){return BPromise[_0x82fa('0x21')](_0x1afd5c);}return _0x35f069[_0x82fa('0x22')]();};}function saveUpdates(_0x4ed1a5,_0x33fad0){return function(_0x1f7a7f){if(_0x1f7a7f){return _0x1f7a7f[_0x82fa('0x23')](_0x4ed1a5)[_0x82fa('0x24')](function(_0x39a3d4){return _0x39a3d4;});}return null;};}function removeEntity(_0x76f838,_0x2c3030){return function(_0x49f8bf){if(_0x49f8bf){return _0x49f8bf[_0x82fa('0x25')]()['then'](function(){_0x76f838[_0x82fa('0x1a')](0xcc)[_0x82fa('0x19')]();});}};}function handleEntityNotFound(_0x2be472,_0x92b185){return function(_0xd653ed){if(!_0xd653ed){_0x2be472[_0x82fa('0x18')](0x194);}return _0xd653ed;};}function handleError(_0x12084c,_0x3d373f){_0x3d373f=_0x3d373f||0x1f4;return function(_0x324e84){logger['error'](_0x324e84[_0x82fa('0x26')]);if(_0x324e84[_0x82fa('0x27')]){delete _0x324e84[_0x82fa('0x27')];}_0x12084c[_0x82fa('0x1a')](_0x3d373f)['send'](_0x324e84);};}exports[_0x82fa('0x28')]=function(_0x1a3ebc,_0x6a9ae1){var _0x3e1a52={},_0x5ebae2={},_0x10985b={'count':0x0,'rows':[]};var _0xf929da=_[_0x82fa('0x29')](db[_0x82fa('0x2a')][_0x82fa('0x2b')],function(_0x418134){return{'name':_0x418134[_0x82fa('0x2c')],'type':_0x418134[_0x82fa('0x2d')][_0x82fa('0x2e')]};});_0x5ebae2[_0x82fa('0x2f')]=_[_0x82fa('0x29')](_0xf929da,_0x82fa('0x27'));_0x5ebae2[_0x82fa('0x30')]=_['keys'](_0x1a3ebc['query']);_0x5ebae2[_0x82fa('0x31')]=_['intersection'](_0x5ebae2[_0x82fa('0x2f')],_0x5ebae2[_0x82fa('0x30')]);_0x3e1a52['attributes']=_[_0x82fa('0x32')](_0x5ebae2[_0x82fa('0x2f')],qs[_0x82fa('0x33')](_0x1a3ebc[_0x82fa('0x30')][_0x82fa('0x33')]));_0x3e1a52[_0x82fa('0x34')]=_0x3e1a52[_0x82fa('0x34')][_0x82fa('0x35')]?_0x3e1a52[_0x82fa('0x34')]:_0x5ebae2[_0x82fa('0x2f')];if(!_0x1a3ebc[_0x82fa('0x30')][_0x82fa('0x36')]('nolimit')){_0x3e1a52[_0x82fa('0x1e')]=qs[_0x82fa('0x1e')](_0x1a3ebc[_0x82fa('0x30')][_0x82fa('0x1e')]);_0x3e1a52[_0x82fa('0x1c')]=qs[_0x82fa('0x1c')](_0x1a3ebc['query'][_0x82fa('0x1c')]);}_0x3e1a52[_0x82fa('0x37')]=qs[_0x82fa('0x38')](_0x1a3ebc[_0x82fa('0x30')]['sort']);_0x3e1a52[_0x82fa('0x39')]=qs[_0x82fa('0x31')](_['pick'](_0x1a3ebc['query'],_0x5ebae2[_0x82fa('0x31')]),_0xf929da);if(_0x1a3ebc[_0x82fa('0x30')][_0x82fa('0x3a')]){_0x3e1a52[_0x82fa('0x39')]=_[_0x82fa('0x3b')](_0x3e1a52[_0x82fa('0x39')],{'$or':_[_0x82fa('0x29')](_0xf929da,function(_0x5d0648){if(_0x5d0648['type']!==_0x82fa('0x3c')){var _0x22d576={};_0x22d576[_0x5d0648[_0x82fa('0x27')]]={'$like':'%'+_0x1a3ebc[_0x82fa('0x30')][_0x82fa('0x3a')]+'%'};return _0x22d576;}})});}_0x3e1a52=_['merge']({},_0x3e1a52,_0x1a3ebc[_0x82fa('0x3d')]);var _0xba8092={'where':_0x3e1a52[_0x82fa('0x39')]};return db[_0x82fa('0x2a')][_0x82fa('0x3e')](_0xba8092)[_0x82fa('0x24')](function(_0x5dea1c){_0x10985b['count']=_0x5dea1c;if(_0x1a3ebc['query']['includeAll']){_0x3e1a52['include']=[{'all':!![]}];}return db[_0x82fa('0x2a')][_0x82fa('0x3f')](_0x3e1a52);})[_0x82fa('0x24')](function(_0x5edb48){_0x10985b[_0x82fa('0x40')]=_0x5edb48;return _0x10985b;})['then'](respondWithFilteredResult(_0x6a9ae1,_0x3e1a52))['catch'](handleError(_0x6a9ae1,null));};exports['show']=function(_0x59927a,_0x5c45b7){var _0x4f7964={'raw':!![],'where':{'id':_0x59927a[_0x82fa('0x41')]['id']}},_0x771aa2={};_0x771aa2[_0x82fa('0x2f')]=_[_0x82fa('0x42')](db[_0x82fa('0x2a')][_0x82fa('0x2b')]);_0x771aa2[_0x82fa('0x30')]=_[_0x82fa('0x42')](_0x59927a[_0x82fa('0x30')]);_0x771aa2[_0x82fa('0x31')]=_['intersection'](_0x771aa2[_0x82fa('0x2f')],_0x771aa2[_0x82fa('0x30')]);_0x4f7964[_0x82fa('0x34')]=_['intersection'](_0x771aa2[_0x82fa('0x2f')],qs[_0x82fa('0x33')](_0x59927a[_0x82fa('0x30')][_0x82fa('0x33')]));_0x4f7964[_0x82fa('0x34')]=_0x4f7964[_0x82fa('0x34')]['length']?_0x4f7964[_0x82fa('0x34')]:_0x771aa2[_0x82fa('0x2f')];if(_0x59927a[_0x82fa('0x30')][_0x82fa('0x43')]){_0x4f7964[_0x82fa('0x44')]=[{'all':!![]}];}_0x4f7964=_[_0x82fa('0x3b')]({},_0x4f7964,_0x59927a['options']);return db[_0x82fa('0x2a')][_0x82fa('0x45')](_0x4f7964)['then'](handleEntityNotFound(_0x5c45b7,null))[_0x82fa('0x24')](respondWithResult(_0x5c45b7,null))[_0x82fa('0x46')](handleError(_0x5c45b7,null));};exports['create']=function(_0x45746a,_0x24cdd3){return db[_0x82fa('0x2a')][_0x82fa('0x47')](_0x45746a[_0x82fa('0x48')],{})[_0x82fa('0x24')](respondWithResult(_0x24cdd3,0xc9))['catch'](handleError(_0x24cdd3,null));};exports[_0x82fa('0x23')]=function(_0x160af1,_0x115685){if(_0x160af1['body']['id']){delete _0x160af1['body']['id'];}return db[_0x82fa('0x2a')][_0x82fa('0x45')]({'where':{'id':_0x160af1[_0x82fa('0x41')]['id']}})[_0x82fa('0x24')](handleEntityNotFound(_0x115685,null))['then'](saveUpdates(_0x160af1['body'],null))['then'](respondWithResult(_0x115685,null))[_0x82fa('0x46')](handleError(_0x115685,null));};exports['destroy']=function(_0x17a298,_0x105ec6){return db['VoiceTransferReport'][_0x82fa('0x45')]({'where':{'id':_0x17a298[_0x82fa('0x41')]['id']}})[_0x82fa('0x24')](handleEntityNotFound(_0x105ec6,null))[_0x82fa('0x24')](removeEntity(_0x105ec6,null))[_0x82fa('0x46')](handleError(_0x105ec6,null));};exports[_0x82fa('0x49')]=function(_0x2f5d18,_0x46c1f9){return db[_0x82fa('0x2a')]['describe']()[_0x82fa('0x24')](respondWithResult(_0x46c1f9,null))[_0x82fa('0x46')](handleError(_0x46c1f9,null));}; \ No newline at end of file +var _0xb1c3=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','name','send','map','rawAttributes','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','VoiceTransferReport','includeAll','include','findAll','catch','params','keys','length','find','create','body','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json'];(function(_0x164e6c,_0xb23c7e){var _0x604034=function(_0x4707f7){while(--_0x4707f7){_0x164e6c['push'](_0x164e6c['shift']());}};_0x604034(++_0xb23c7e);}(_0xb1c3,0x105));var _0x3b1c=function(_0x97cb9a,_0x58a3d4){_0x97cb9a=_0x97cb9a-0x0;var _0x49f9b4=_0xb1c3[_0x97cb9a];return _0x49f9b4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3b1c('0x0'));var jsonpatch=require(_0x3b1c('0x1'));var rp=require(_0x3b1c('0x2'));var moment=require(_0x3b1c('0x3'));var BPromise=require(_0x3b1c('0x4'));var Mustache=require(_0x3b1c('0x5'));var util=require(_0x3b1c('0x6'));var path=require(_0x3b1c('0x7'));var sox=require('sox');var csv=require(_0x3b1c('0x8'));var ejs=require(_0x3b1c('0x9'));var fs=require('fs');var fs_extra=require(_0x3b1c('0xa'));var _=require(_0x3b1c('0xb'));var squel=require(_0x3b1c('0xc'));var crypto=require(_0x3b1c('0xd'));var jsforce=require(_0x3b1c('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3b1c('0xf'));var Redis=require(_0x3b1c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3b1c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3b1c('0x12'))(_0x3b1c('0x13'));var utils=require(_0x3b1c('0x14'));var config=require(_0x3b1c('0x15'));var licenseUtil=require(_0x3b1c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fb7cd,_0x38d193){_0x38d193=_0x38d193||0xcc;return function(_0x384f9d){if(_0x384f9d){return _0x4fb7cd[_0x3b1c('0x17')](_0x38d193);}return _0x4fb7cd['status'](_0x38d193)[_0x3b1c('0x18')]();};}function respondWithResult(_0x59e110,_0x5ef352){_0x5ef352=_0x5ef352||0xc8;return function(_0x13c49d){if(_0x13c49d){return _0x59e110[_0x3b1c('0x19')](_0x5ef352)[_0x3b1c('0x1a')](_0x13c49d);}};}function respondWithFilteredResult(_0x2f4617,_0x5d69d5){return function(_0x57d13d){if(_0x57d13d){var _0x5bc1de=typeof _0x5d69d5[_0x3b1c('0x1b')]===_0x3b1c('0x1c')&&typeof _0x5d69d5[_0x3b1c('0x1d')]===_0x3b1c('0x1c');var _0x582349=_0x57d13d[_0x3b1c('0x1e')];var _0x3a3525=_0x5bc1de?0x0:_0x5d69d5['offset'];var _0x52e57b=_0x5bc1de?_0x57d13d[_0x3b1c('0x1e')]:_0x5d69d5[_0x3b1c('0x1b')]+_0x5d69d5[_0x3b1c('0x1d')];var _0x4cfaca;if(_0x52e57b>=_0x582349){_0x52e57b=_0x582349;_0x4cfaca=0xc8;}else{_0x4cfaca=0xce;}_0x2f4617['status'](_0x4cfaca);return _0x2f4617[_0x3b1c('0x1f')](_0x3b1c('0x20'),_0x3a3525+'-'+_0x52e57b+'/'+_0x582349)[_0x3b1c('0x1a')](_0x57d13d);}return null;};}function patchUpdates(_0x240273){return function(_0x2f6cd6){try{jsonpatch[_0x3b1c('0x21')](_0x2f6cd6,_0x240273,!![]);}catch(_0x40e74a){return BPromise[_0x3b1c('0x22')](_0x40e74a);}return _0x2f6cd6[_0x3b1c('0x23')]();};}function saveUpdates(_0x16c041,_0x591287){return function(_0x25f5e6){if(_0x25f5e6){return _0x25f5e6[_0x3b1c('0x24')](_0x16c041)[_0x3b1c('0x25')](function(_0xe010f7){return _0xe010f7;});}return null;};}function removeEntity(_0x574a1a,_0x3c7c5f){return function(_0x250c9e){if(_0x250c9e){return _0x250c9e['destroy']()[_0x3b1c('0x25')](function(){_0x574a1a[_0x3b1c('0x19')](0xcc)[_0x3b1c('0x18')]();});}};}function handleEntityNotFound(_0x178c9c,_0x28c8f8){return function(_0x6953b2){if(!_0x6953b2){_0x178c9c['sendStatus'](0x194);}return _0x6953b2;};}function handleError(_0x3c7382,_0x576d9e){_0x576d9e=_0x576d9e||0x1f4;return function(_0x2c9a36){logger['error'](_0x2c9a36['stack']);if(_0x2c9a36[_0x3b1c('0x26')]){delete _0x2c9a36[_0x3b1c('0x26')];}_0x3c7382[_0x3b1c('0x19')](_0x576d9e)[_0x3b1c('0x27')](_0x2c9a36);};}exports['index']=function(_0x5ef77f,_0x29e7d8){var _0x472b6b={},_0x3dbab5={},_0x38554f={'count':0x0,'rows':[]};var _0x152cfe=_[_0x3b1c('0x28')](db['VoiceTransferReport'][_0x3b1c('0x29')],function(_0x57bad2){return{'name':_0x57bad2['fieldName'],'type':_0x57bad2['type'][_0x3b1c('0x2a')]};});_0x3dbab5[_0x3b1c('0x2b')]=_[_0x3b1c('0x28')](_0x152cfe,_0x3b1c('0x26'));_0x3dbab5[_0x3b1c('0x2c')]=_['keys'](_0x5ef77f['query']);_0x3dbab5[_0x3b1c('0x2d')]=_[_0x3b1c('0x2e')](_0x3dbab5[_0x3b1c('0x2b')],_0x3dbab5['query']);_0x472b6b['attributes']=_[_0x3b1c('0x2e')](_0x3dbab5[_0x3b1c('0x2b')],qs[_0x3b1c('0x2f')](_0x5ef77f['query'][_0x3b1c('0x2f')]));_0x472b6b[_0x3b1c('0x30')]=_0x472b6b[_0x3b1c('0x30')]['length']?_0x472b6b['attributes']:_0x3dbab5[_0x3b1c('0x2b')];if(!_0x5ef77f[_0x3b1c('0x2c')][_0x3b1c('0x31')](_0x3b1c('0x32'))){_0x472b6b[_0x3b1c('0x1d')]=qs['limit'](_0x5ef77f[_0x3b1c('0x2c')]['limit']);_0x472b6b[_0x3b1c('0x1b')]=qs[_0x3b1c('0x1b')](_0x5ef77f[_0x3b1c('0x2c')][_0x3b1c('0x1b')]);}_0x472b6b[_0x3b1c('0x33')]=qs[_0x3b1c('0x34')](_0x5ef77f[_0x3b1c('0x2c')][_0x3b1c('0x34')]);_0x472b6b[_0x3b1c('0x35')]=qs[_0x3b1c('0x2d')](_[_0x3b1c('0x36')](_0x5ef77f[_0x3b1c('0x2c')],_0x3dbab5[_0x3b1c('0x2d')]),_0x152cfe);if(_0x5ef77f[_0x3b1c('0x2c')][_0x3b1c('0x37')]){_0x472b6b[_0x3b1c('0x35')]=_['merge'](_0x472b6b[_0x3b1c('0x35')],{'$or':_[_0x3b1c('0x28')](_0x152cfe,function(_0x13f42b){if(_0x13f42b[_0x3b1c('0x38')]!=='VIRTUAL'){var _0x124a7e={};_0x124a7e[_0x13f42b[_0x3b1c('0x26')]]={'$like':'%'+_0x5ef77f[_0x3b1c('0x2c')][_0x3b1c('0x37')]+'%'};return _0x124a7e;}})});}_0x472b6b=_[_0x3b1c('0x39')]({},_0x472b6b,_0x5ef77f[_0x3b1c('0x3a')]);var _0x73990a={'where':_0x472b6b[_0x3b1c('0x35')]};return db[_0x3b1c('0x3b')][_0x3b1c('0x1e')](_0x73990a)[_0x3b1c('0x25')](function(_0x46d952){_0x38554f[_0x3b1c('0x1e')]=_0x46d952;if(_0x5ef77f['query'][_0x3b1c('0x3c')]){_0x472b6b[_0x3b1c('0x3d')]=[{'all':!![]}];}return db[_0x3b1c('0x3b')][_0x3b1c('0x3e')](_0x472b6b);})['then'](function(_0x274f1d){_0x38554f['rows']=_0x274f1d;return _0x38554f;})['then'](respondWithFilteredResult(_0x29e7d8,_0x472b6b))[_0x3b1c('0x3f')](handleError(_0x29e7d8,null));};exports['show']=function(_0x1a227f,_0x4dc223){var _0x4774f9={'raw':!![],'where':{'id':_0x1a227f[_0x3b1c('0x40')]['id']}},_0xa4b845={};_0xa4b845[_0x3b1c('0x2b')]=_[_0x3b1c('0x41')](db['VoiceTransferReport']['rawAttributes']);_0xa4b845['query']=_[_0x3b1c('0x41')](_0x1a227f[_0x3b1c('0x2c')]);_0xa4b845[_0x3b1c('0x2d')]=_[_0x3b1c('0x2e')](_0xa4b845[_0x3b1c('0x2b')],_0xa4b845[_0x3b1c('0x2c')]);_0x4774f9['attributes']=_[_0x3b1c('0x2e')](_0xa4b845[_0x3b1c('0x2b')],qs[_0x3b1c('0x2f')](_0x1a227f[_0x3b1c('0x2c')][_0x3b1c('0x2f')]));_0x4774f9[_0x3b1c('0x30')]=_0x4774f9[_0x3b1c('0x30')][_0x3b1c('0x42')]?_0x4774f9[_0x3b1c('0x30')]:_0xa4b845[_0x3b1c('0x2b')];if(_0x1a227f[_0x3b1c('0x2c')][_0x3b1c('0x3c')]){_0x4774f9[_0x3b1c('0x3d')]=[{'all':!![]}];}_0x4774f9=_['merge']({},_0x4774f9,_0x1a227f[_0x3b1c('0x3a')]);return db[_0x3b1c('0x3b')][_0x3b1c('0x43')](_0x4774f9)['then'](handleEntityNotFound(_0x4dc223,null))[_0x3b1c('0x25')](respondWithResult(_0x4dc223,null))[_0x3b1c('0x3f')](handleError(_0x4dc223,null));};exports[_0x3b1c('0x44')]=function(_0x51badf,_0x1d99eb){return db[_0x3b1c('0x3b')][_0x3b1c('0x44')](_0x51badf[_0x3b1c('0x45')],{})['then'](respondWithResult(_0x1d99eb,0xc9))[_0x3b1c('0x3f')](handleError(_0x1d99eb,null));};exports[_0x3b1c('0x24')]=function(_0x3762e3,_0x18dea5){if(_0x3762e3[_0x3b1c('0x45')]['id']){delete _0x3762e3[_0x3b1c('0x45')]['id'];}return db['VoiceTransferReport'][_0x3b1c('0x43')]({'where':{'id':_0x3762e3[_0x3b1c('0x40')]['id']}})['then'](handleEntityNotFound(_0x18dea5,null))[_0x3b1c('0x25')](saveUpdates(_0x3762e3['body'],null))['then'](respondWithResult(_0x18dea5,null))['catch'](handleError(_0x18dea5,null));};exports[_0x3b1c('0x46')]=function(_0x1a2049,_0x2c4385){return db[_0x3b1c('0x3b')][_0x3b1c('0x43')]({'where':{'id':_0x1a2049[_0x3b1c('0x40')]['id']}})[_0x3b1c('0x25')](handleEntityNotFound(_0x2c4385,null))[_0x3b1c('0x25')](removeEntity(_0x2c4385,null))['catch'](handleError(_0x2c4385,null));};exports['describe']=function(_0x5eaab4,_0x160176){return db[_0x3b1c('0x3b')][_0x3b1c('0x47')]()[_0x3b1c('0x25')](respondWithResult(_0x160176,null))[_0x3b1c('0x3f')](handleError(_0x160176,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index aa564f0..b09890e 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 _0x9dc3=['util','api','moment','bluebird','request-promise','path','exports','define','VoiceTransferReport','report_call_transfer','lodash'];(function(_0x46092f,_0x223615){var _0x162d22=function(_0x304945){while(--_0x304945){_0x46092f['push'](_0x46092f['shift']());}};_0x162d22(++_0x223615);}(_0x9dc3,0x154));var _0x39dc=function(_0x4bcac2,_0x18bc5f){_0x4bcac2=_0x4bcac2-0x0;var _0xf1f9a1=_0x9dc3[_0x4bcac2];return _0xf1f9a1;};'use strict';var _=require(_0x39dc('0x0'));var util=require(_0x39dc('0x1'));var logger=require('../../config/logger')(_0x39dc('0x2'));var moment=require(_0x39dc('0x3'));var BPromise=require(_0x39dc('0x4'));var rp=require(_0x39dc('0x5'));var fs=require('fs');var path=require(_0x39dc('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceTransferReport.attributes');module[_0x39dc('0x7')]=function(_0x31e7a2,_0x5f59cf){return _0x31e7a2[_0x39dc('0x8')](_0x39dc('0x9'),attributes,{'tableName':_0x39dc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb49=['report_call_transfer','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','define'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xeb49,0x88));var _0x9eb4=function(_0x16ddf2,_0x250bd9){_0x16ddf2=_0x16ddf2-0x0;var _0x36b330=_0xeb49[_0x16ddf2];return _0x36b330;};'use strict';var _=require(_0x9eb4('0x0'));var util=require('util');var logger=require(_0x9eb4('0x1'))('api');var moment=require(_0x9eb4('0x2'));var BPromise=require('bluebird');var rp=require(_0x9eb4('0x3'));var fs=require('fs');var path=require(_0x9eb4('0x4'));var rimraf=require(_0x9eb4('0x5'));var config=require(_0x9eb4('0x6'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x46296f,_0x23eadf){return _0x46296f[_0x9eb4('0x7')]('VoiceTransferReport',attributes,{'tableName':_0x9eb4('0x8'),'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 faeca24..1f49587 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 _0x967c=['client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x465ba4,_0x2f04b){var _0x17f6e8=function(_0x46ccdf){while(--_0x46ccdf){_0x465ba4['push'](_0x465ba4['shift']());}};_0x17f6e8(++_0x2f04b);}(_0x967c,0x146));var _0xc967=function(_0x29ff5e,_0x220788){_0x29ff5e=_0x29ff5e-0x0;var _0xd8135a=_0x967c[_0x29ff5e];return _0xd8135a;};'use strict';var _=require('lodash');var util=require(_0xc967('0x0'));var moment=require(_0xc967('0x1'));var BPromise=require(_0xc967('0x2'));var rs=require(_0xc967('0x3'));var fs=require('fs');var Redis=require(_0xc967('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc967('0x5'));var logger=require(_0xc967('0x6'))(_0xc967('0x7'));var config=require(_0xc967('0x8'));var jayson=require(_0xc967('0x9'));var client=jayson[_0xc967('0xa')][_0xc967('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2cdc91,_0x211f1c,_0x4dfb7a){return new BPromise(function(_0x977b58,_0x5a7710){return client[_0xc967('0xc')](_0x2cdc91,_0x4dfb7a)[_0xc967('0xd')](function(_0x3087c3){logger[_0xc967('0xe')](_0xc967('0xf'),_0x211f1c,'request\x20sent');logger[_0xc967('0x10')](_0xc967('0x11'),_0x211f1c,_0xc967('0x12'),JSON[_0xc967('0x13')](_0x3087c3));if(_0x3087c3['error']){if(_0x3087c3['error']['code']===0x1f4){logger[_0xc967('0x14')](_0xc967('0xf'),_0x211f1c,_0x3087c3[_0xc967('0x14')][_0xc967('0x15')]);return _0x5a7710(_0x3087c3['error'][_0xc967('0x15')]);}logger[_0xc967('0x14')](_0xc967('0xf'),_0x211f1c,_0x3087c3[_0xc967('0x14')][_0xc967('0x15')]);return _0x977b58(_0x3087c3[_0xc967('0x14')][_0xc967('0x15')]);}else{logger[_0xc967('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x211f1c,_0xc967('0x12'));_0x977b58(_0x3087c3['result'][_0xc967('0x15')]);}})[_0xc967('0x16')](function(_0x5acfe8){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x211f1c,_0x5acfe8);_0x5a7710(_0x5acfe8);});});}exports[_0xc967('0x17')]=function(_0x488412){var _0x210cbd=this;return new Promise(function(_0x5166ca,_0x22e9a6){return db[_0xc967('0x18')][_0xc967('0x19')](_0x488412['body'],{'raw':_0x488412[_0xc967('0x1a')]?_0x488412[_0xc967('0x1a')][_0xc967('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3d2baf){logger['info'](_0xc967('0x17'),_0x488412);logger[_0xc967('0x10')](_0xc967('0x17'),_0x488412,JSON[_0xc967('0x13')](_0x3d2baf));_0x5166ca(_0x3d2baf);})[_0xc967('0x16')](function(_0xe906c8){logger['error']('CreateVoiceTransferReport',_0xe906c8[_0xc967('0x15')],_0x488412);_0x22e9a6(_0x210cbd[_0xc967('0x14')](0x1f4,_0xe906c8[_0xc967('0x15')]));});});}; \ No newline at end of file +var _0x97fd=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','raw','stringify','lodash','util','ioredis'];(function(_0xab126d,_0x5645f0){var _0x284a65=function(_0x14cd1b){while(--_0x14cd1b){_0xab126d['push'](_0xab126d['shift']());}};_0x284a65(++_0x5645f0);}(_0x97fd,0x192));var _0xd97f=function(_0x3e8e0c,_0x32561b){_0x3e8e0c=_0x3e8e0c-0x0;var _0x4793f3=_0x97fd[_0x3e8e0c];return _0x4793f3;};'use strict';var _=require(_0xd97f('0x0'));var util=require(_0xd97f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd97f('0x2'));var db=require(_0xd97f('0x3'))['db'];var utils=require(_0xd97f('0x4'));var logger=require(_0xd97f('0x5'))(_0xd97f('0x6'));var config=require(_0xd97f('0x7'));var jayson=require(_0xd97f('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3be433,_0x6e2f2d,_0x5f5381){return new BPromise(function(_0x5676b3,_0x31388b){return client[_0xd97f('0x9')](_0x3be433,_0x5f5381)[_0xd97f('0xa')](function(_0x554025){logger['info'](_0xd97f('0xb'),_0x6e2f2d,_0xd97f('0xc'));logger[_0xd97f('0xd')](_0xd97f('0xe'),_0x6e2f2d,'request\x20sent',JSON['stringify'](_0x554025));if(_0x554025[_0xd97f('0xf')]){if(_0x554025[_0xd97f('0xf')][_0xd97f('0x10')]===0x1f4){logger['error'](_0xd97f('0xb'),_0x6e2f2d,_0x554025['error'][_0xd97f('0x11')]);return _0x31388b(_0x554025[_0xd97f('0xf')][_0xd97f('0x11')]);}logger[_0xd97f('0xf')](_0xd97f('0xb'),_0x6e2f2d,_0x554025[_0xd97f('0xf')][_0xd97f('0x11')]);return _0x5676b3(_0x554025[_0xd97f('0xf')][_0xd97f('0x11')]);}else{logger[_0xd97f('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x6e2f2d,'request\x20sent');_0x5676b3(_0x554025[_0xd97f('0x13')][_0xd97f('0x11')]);}})[_0xd97f('0x14')](function(_0x5c1705){logger[_0xd97f('0xf')](_0xd97f('0xb'),_0x6e2f2d,_0x5c1705);_0x31388b(_0x5c1705);});});}exports[_0xd97f('0x15')]=function(_0x24c574){var _0x39da38=this;return new Promise(function(_0x133021,_0xe5aea5){return db[_0xd97f('0x16')]['create'](_0x24c574[_0xd97f('0x17')],{'raw':_0x24c574['options']?_0x24c574[_0xd97f('0x18')][_0xd97f('0x19')]===undefined?!![]:![]:!![]})[_0xd97f('0xa')](function(_0x24cadc){logger[_0xd97f('0x12')](_0xd97f('0x15'),_0x24c574);logger[_0xd97f('0xd')](_0xd97f('0x15'),_0x24c574,JSON[_0xd97f('0x1a')](_0x24cadc));_0x133021(_0x24cadc);})[_0xd97f('0x14')](function(_0x1f502f){logger[_0xd97f('0xf')]('CreateVoiceTransferReport',_0x1f502f[_0xd97f('0x11')],_0x24c574);_0xe5aea5(_0x39da38[_0xd97f('0xf')](0x1f4,_0x1f502f['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 1e49f70..a236384 100644 --- a/server/api/webbar/index.js +++ b/server/api/webbar/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['/unhold','unhold','/calls','calls','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','hold'];(function(_0x40bdbc,_0x3fabcd){var _0xc603a8=function(_0x17c0e6){while(--_0x17c0e6){_0x40bdbc['push'](_0x40bdbc['shift']());}};_0xc603a8(++_0x3fabcd);}(_0x34e8,0x12c));var _0x834e=function(_0x3a1085,_0x374be3){_0x3a1085=_0x3a1085-0x0;var _0xd60ef4=_0x34e8[_0x3a1085];return _0xd60ef4;};'use strict';var express=require(_0x834e('0x0'));var router=express[_0x834e('0x1')]();var auth=require(_0x834e('0x2'));var controller=require(_0x834e('0x3'));router['post'](_0x834e('0x4'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x7')]);router[_0x834e('0x8')](_0x834e('0x9'),auth[_0x834e('0x5')](),auth['isWebrtcLicence'](),controller[_0x834e('0xa')]);router['post'](_0x834e('0xb'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0xc')]);router[_0x834e('0x8')](_0x834e('0xd'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0xe')]);router[_0x834e('0x8')](_0x834e('0xf'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x10')]);router[_0x834e('0x8')](_0x834e('0x11'),auth[_0x834e('0x5')](),auth['isWebrtcLicence'](),controller[_0x834e('0x12')]);router[_0x834e('0x8')]('/transfer',auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x13')]);module[_0x834e('0x14')]=router; \ No newline at end of file +var _0xe14d=['hangup','answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','originate','post','/hangup','isWebrtcLicence'];(function(_0x17ec16,_0x2436e3){var _0x1f59f5=function(_0x165b75){while(--_0x165b75){_0x17ec16['push'](_0x17ec16['shift']());}};_0x1f59f5(++_0x2436e3);}(_0xe14d,0x1ee));var _0xde14=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xe14d[_0x47b58b];return _0x46bebe;};'use strict';var express=require(_0xde14('0x0'));var router=express[_0xde14('0x1')]();var auth=require(_0xde14('0x2'));var controller=require(_0xde14('0x3'));router['post'](_0xde14('0x4'),auth[_0xde14('0x5')](),auth['isWebrtcLicence'](),controller[_0xde14('0x6')]);router[_0xde14('0x7')](_0xde14('0x8'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xa')]);router['post']('/answer',auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xb')]);router[_0xde14('0x7')](_0xde14('0xc'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xd')]);router['post'](_0xde14('0xe'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xf')]);router[_0xde14('0x7')](_0xde14('0x10'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0x11')]);router[_0xde14('0x7')](_0xde14('0x12'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0x13')]);module[_0xde14('0x14')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index d24aafe..0d225b0 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 _0xca31=['string','number','info','stringify','log','error','stack','name','status','send','NotFound','message','User','agent','then','VoiceChannels','all','filter','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callbackUrl','entityFound:','format','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','user:%s','hangup\x20executed!','answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','UserId','webbar:conference','conference\x20executed!','transferNumber','webbar:transfer','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','http','webbarapi','redis','localhost','validate','userId\x20is\x20required'];(function(_0x585c02,_0x46b1ea){var _0x1f0d36=function(_0x265fcc){while(--_0x265fcc){_0x585c02['push'](_0x585c02['shift']());}};_0x1f0d36(++_0x46b1ea);}(_0xca31,0x1f4));var _0x1ca3=function(_0x593a37,_0x20ac5b){_0x593a37=_0x593a37-0x0;var _0x4bde96=_0xca31[_0x593a37];return _0x4bde96;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x1ca3('0x0'));var db=require(_0x1ca3('0x1'))['db'];var config=require(_0x1ca3('0x2'));var util=require(_0x1ca3('0x3'));var BPromise=require(_0x1ca3('0x4'));var jayson=require(_0x1ca3('0x5'));var amiClient=jayson['client'][_0x1ca3('0x6')]({'port':0x232a});var logger=require('../../config/logger')(_0x1ca3('0x7'));var Redis=require('ioredis');config[_0x1ca3('0x8')]=_['defaults'](config[_0x1ca3('0x8')],{'host':_0x1ca3('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1ca3('0x8')]));var Schema=require(_0x1ca3('0xa'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x1ca3('0xb')]},'callNumber':{'type':_0x1ca3('0xc'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0x1ca3('0xc')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x1ca3('0xb')]},'sessionId':{'type':_0x1ca3('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x1ca3('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x1ca3('0xd'),'required':[!![],_0x1ca3('0xb')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x1ca3('0xc'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x1ca3('0xd'),'required':[!![],_0x1ca3('0xb')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x1ca3('0xd'),'required':[!![],_0x1ca3('0xb')]},'sessionId':{'type':_0x1ca3('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x1ca3('0xd'),'required':[!![],_0x1ca3('0xb')]}});var conferenceValidation=new Schema({'userId':{'type':_0x1ca3('0xd'),'required':[!![],_0x1ca3('0xb')]}});function emit(_0x4bb0e5,_0x3edc40,_0x6b4817){logger[_0x1ca3('0xe')](_0x4bb0e5,_0x3edc40,JSON[_0x1ca3('0xf')](_0x6b4817));io['to'](_0x4bb0e5)['emit'](_0x3edc40,_0x6b4817);}function handleError(_0x7c6383){return function(_0x2c5184){console[_0x1ca3('0x10')]('handleError:',_0x2c5184,_0x2c5184 instanceof RangeError);logger[_0x1ca3('0x11')](_0x2c5184[_0x1ca3('0x12')]);if(_0x2c5184 instanceof RangeError){if(_0x2c5184[_0x1ca3('0x13')]){delete _0x2c5184['name'];}_0x7c6383[_0x1ca3('0x14')](0x194)['send'](_0x2c5184);}else{if(_0x2c5184[_0x1ca3('0x13')]){delete _0x2c5184[_0x1ca3('0x13')];}_0x7c6383[_0x1ca3('0x14')](0x1f4)[_0x1ca3('0x15')](_0x2c5184);}};}function checkError(){return function(_0x39a7e0){if(!_0x39a7e0){throw new RangeError(_0x1ca3('0x16'));}return _0x39a7e0;};}function respondWithRpcPromise(_0x2ee6c8,_0x12a97e){return new BPromise(function(_0x19ca7e,_0x2e3532){var _0x2658ba=amiClient;return _0x2658ba['request'](_0x2ee6c8,_0x12a97e)['then'](function(_0x15951b){if(_0x15951b['error']){if(_0x15951b[_0x1ca3('0x11')]['code']===0x1f4){return _0x2e3532(_0x15951b['error'][_0x1ca3('0x17')]);}return _0x19ca7e(_0x15951b[_0x1ca3('0x11')][_0x1ca3('0x17')]);}else{_0x19ca7e(_0x15951b['result']);}})['catch'](function(_0x4cdf23){_0x2e3532(_0x4cdf23);});});}function getAgent(_0x1e2948){return db[_0x1ca3('0x18')]['findOne']({'where':{'id':_0x1e2948,'role':_0x1ca3('0x19')}})[_0x1ca3('0x1a')](checkError());}function getAgentCheckSession(_0x2949a3,_0x4c5390){return new BPromise(function(_0x291c1f,_0x291f3d){var _0x336f76=respondWithRpcPromise(_0x1ca3('0x1b'));var _0x508356=getAgent(_0x2949a3);Promise[_0x1ca3('0x1c')]([_0x336f76,_0x508356])['then'](function(_0x5bfe71){var _0x380f6b=_0x5bfe71[0x0];var _0x1847c3=_0x5bfe71[0x1];var _0x166234=_[_0x1ca3('0x1d')](_0x380f6b['rows'],function(_0x2e5060){return _0x2e5060['UserId']==_0x1847c3['id']&&_0x2e5060[_0x1ca3('0x1e')]==_0x4c5390;});if(_0x166234[_0x1ca3('0x1f')]==0x1){_0x291c1f(_0x1847c3);}else{_0x291f3d(new RangeError(_0x1ca3('0x20')+_0x4c5390+_0x1ca3('0x21')));}});});}exports[_0x1ca3('0x22')]=function(_0x25446a,_0x44e353){logger['info'](_0x1ca3('0x23'),_0x25446a[_0x1ca3('0x24')]);var _0x21f3b5=originateValidation[_0x1ca3('0xa')](_0x25446a[_0x1ca3('0x24')]);if(_0x21f3b5[_0x1ca3('0x1f')]>0x0){return _0x44e353[_0x1ca3('0x14')](0x190)[_0x1ca3('0x25')](_0x21f3b5);}var _0x531b09=_0x25446a[_0x1ca3('0x24')][_0x1ca3('0x26')];var _0x4ab145=_0x25446a[_0x1ca3('0x24')][_0x1ca3('0x27')];var _0x30fb16=_0x25446a[_0x1ca3('0x24')]['callerId'];var _0x5b1631=_0x25446a[_0x1ca3('0x24')][_0x1ca3('0x28')];return getAgent(_0x531b09)[_0x1ca3('0x1a')](function(_0xa44837){logger[_0x1ca3('0xe')](_0x1ca3('0x29'),_0xa44837[_0x1ca3('0x13')]);emit(util[_0x1ca3('0x2a')]('user:%s',_0xa44837[_0x1ca3('0x13')]),_0x1ca3('0x2b'),{'callNumber':_0x4ab145,'callerId':_0x30fb16,'callbackUrl':_0x5b1631});return _0x44e353[_0x1ca3('0x14')](0xc8)[_0x1ca3('0x25')]({'error':![],'message':_0x1ca3('0x2c')});})[_0x1ca3('0x2d')](handleError(_0x44e353));};exports[_0x1ca3('0x2e')]=function(_0x1263a8,_0x79a280){logger[_0x1ca3('0xe')](_0x1ca3('0x2f'),_0x1263a8[_0x1ca3('0x24')]);var _0x289a52=hangupValidation[_0x1ca3('0xa')](_0x1263a8[_0x1ca3('0x24')]);if(_0x289a52[_0x1ca3('0x1f')]>0x0){return _0x79a280[_0x1ca3('0x14')](0x190)[_0x1ca3('0x25')](_0x289a52);}var _0x369fda=_0x1263a8[_0x1ca3('0x24')][_0x1ca3('0x26')];var _0x215765=_0x1263a8[_0x1ca3('0x24')][_0x1ca3('0x1e')];return getAgent(_0x369fda)['then'](function(_0x226a18){logger[_0x1ca3('0xe')]('entityFound:',_0x226a18[_0x1ca3('0x13')]);emit(util['format'](_0x1ca3('0x30'),_0x226a18['name']),'webbar:hangup',{'sessionId':_0x215765});return _0x79a280[_0x1ca3('0x14')](0xc8)['json']({'error':![],'message':_0x1ca3('0x31')});})[_0x1ca3('0x2d')](handleError(_0x79a280));};exports[_0x1ca3('0x32')]=function(_0x5f22b8,_0x3ad204){logger[_0x1ca3('0xe')]('answer\x20fired:',_0x5f22b8[_0x1ca3('0x24')]);var _0x44e06c=answerValidation[_0x1ca3('0xa')](_0x5f22b8[_0x1ca3('0x24')]);if(_0x44e06c[_0x1ca3('0x1f')]>0x0){return _0x3ad204[_0x1ca3('0x14')](0x190)['json'](_0x44e06c);}var _0x241538=_0x5f22b8['body'][_0x1ca3('0x26')];var _0x18d7ba=_0x5f22b8[_0x1ca3('0x24')][_0x1ca3('0x1e')];return getAgent(_0x241538)[_0x1ca3('0x1a')](function(_0x1d990f){logger[_0x1ca3('0xe')]('entityFound:',_0x1d990f[_0x1ca3('0x13')]);emit(util[_0x1ca3('0x2a')](_0x1ca3('0x30'),_0x1d990f[_0x1ca3('0x13')]),'webbar:answer',{'sessionId':_0x18d7ba});return _0x3ad204['status'](0xc8)[_0x1ca3('0x25')]({'error':![],'message':_0x1ca3('0x33')});})[_0x1ca3('0x2d')](handleError(_0x3ad204));};exports['hold']=function(_0x1d9885,_0x1db949){logger['info'](_0x1ca3('0x34'),_0x1d9885[_0x1ca3('0x24')]);var _0x2fb25e=holdValidation['validate'](_0x1d9885[_0x1ca3('0x24')]);if(_0x2fb25e[_0x1ca3('0x1f')]>0x0){return _0x1db949[_0x1ca3('0x14')](0x190)[_0x1ca3('0x25')](_0x2fb25e);}var _0x1945a5=_0x1d9885[_0x1ca3('0x24')][_0x1ca3('0x26')];var _0x259699=_0x1d9885[_0x1ca3('0x24')][_0x1ca3('0x1e')];return getAgent(_0x1945a5)[_0x1ca3('0x1a')](function(_0x17466c){logger[_0x1ca3('0xe')](_0x1ca3('0x29'),_0x17466c[_0x1ca3('0x13')]);emit(util[_0x1ca3('0x2a')]('user:%s',_0x17466c['name']),_0x1ca3('0x35'),{'sessionId':_0x259699});return _0x1db949[_0x1ca3('0x14')](0xc8)['json']({'error':![],'message':_0x1ca3('0x36')});})[_0x1ca3('0x2d')](handleError(_0x1db949));};exports[_0x1ca3('0x37')]=function(_0x597ac2,_0x3b3013){logger['info']('unhold\x20fired:',_0x597ac2[_0x1ca3('0x24')]);var _0x3464ea=unholdValidation[_0x1ca3('0xa')](_0x597ac2[_0x1ca3('0x24')]);if(_0x3464ea[_0x1ca3('0x1f')]>0x0){return _0x3b3013[_0x1ca3('0x14')](0x190)['json'](_0x3464ea);}var _0x1df2de=_0x597ac2[_0x1ca3('0x24')][_0x1ca3('0x26')];var _0x12dd1b=_0x597ac2[_0x1ca3('0x24')]['sessionId'];return getAgent(_0x1df2de)[_0x1ca3('0x1a')](function(_0x26e630){logger[_0x1ca3('0xe')](_0x1ca3('0x29'),_0x26e630[_0x1ca3('0x13')]);emit(util[_0x1ca3('0x2a')](_0x1ca3('0x30'),_0x26e630['name']),_0x1ca3('0x38'),{'sessionId':_0x12dd1b});return _0x3b3013[_0x1ca3('0x14')](0xc8)[_0x1ca3('0x25')]({'error':![],'message':_0x1ca3('0x39')});})[_0x1ca3('0x2d')](handleError(_0x3b3013));};exports[_0x1ca3('0x3a')]=function(_0x407ca5,_0x2e000e){logger['info']('calls\x20fired:',_0x2e000e[_0x1ca3('0x24')]);var _0x49963b=callsValidation[_0x1ca3('0xa')](_0x407ca5[_0x1ca3('0x24')]);if(_0x49963b[_0x1ca3('0x1f')]>0x0){return _0x2e000e[_0x1ca3('0x14')](0x190)[_0x1ca3('0x25')](_0x49963b);}var _0x55fc3a=_0x407ca5[_0x1ca3('0x24')][_0x1ca3('0x26')];var _0x56f276=respondWithRpcPromise(_0x1ca3('0x1b'));var _0x384a20=getAgent(_0x55fc3a);return Promise[_0x1ca3('0x1c')]([_0x56f276,_0x384a20])[_0x1ca3('0x1a')](function(_0x2a7780){var _0x13152d=_0x2a7780[0x0];var _0x18be28=_0x2a7780[0x1];var _0x308978=_['filter'](_0x13152d['rows'],function(_0x54ed80){return _0x54ed80[_0x1ca3('0x3b')]==_0x18be28['id'];});return _0x2e000e['status'](0xc8)['json']({'count':_0x308978[_0x1ca3('0x1f')],'rows':_0x308978});})['catch'](handleError(_0x2e000e));};exports['conference']=function(_0x44342b,_0x131693){logger[_0x1ca3('0xe')]('conference\x20fired:',_0x44342b['body']);var _0x429481=conferenceValidation[_0x1ca3('0xa')](_0x44342b[_0x1ca3('0x24')]);if(_0x429481[_0x1ca3('0x1f')]>0x0){return _0x131693[_0x1ca3('0x14')](0x190)['json'](_0x429481);}var _0x23070f=_0x44342b[_0x1ca3('0x24')][_0x1ca3('0x26')];return getAgent(_0x23070f)[_0x1ca3('0x1a')](function(_0xfa7d65){logger[_0x1ca3('0xe')]('entityFound:',_0xfa7d65[_0x1ca3('0x13')]);emit(util[_0x1ca3('0x2a')](_0x1ca3('0x30'),_0xfa7d65[_0x1ca3('0x13')]),_0x1ca3('0x3c'));return _0x131693[_0x1ca3('0x14')](0xc8)[_0x1ca3('0x25')]({'error':![],'message':_0x1ca3('0x3d')});})[_0x1ca3('0x2d')](handleError(_0x131693));};exports['transfer']=function(_0x2d7f95,_0x3561e4){logger['info']('transfer\x20fired:',_0x2d7f95[_0x1ca3('0x24')]);var _0x4a1803=transferValidation[_0x1ca3('0xa')](_0x2d7f95[_0x1ca3('0x24')]);if(_0x4a1803[_0x1ca3('0x1f')]>0x0){return _0x3561e4['status'](0x190)[_0x1ca3('0x25')](_0x4a1803);}var _0x16e6e3=_0x2d7f95[_0x1ca3('0x24')][_0x1ca3('0x26')];var _0x4956cb=_0x2d7f95[_0x1ca3('0x24')][_0x1ca3('0x1e')];var _0xf4bf6f=_0x2d7f95[_0x1ca3('0x24')][_0x1ca3('0x3e')];return getAgent(_0x16e6e3)['then'](function(_0x4bf79a){logger[_0x1ca3('0xe')](_0x1ca3('0x29'),_0x4bf79a[_0x1ca3('0x13')]);emit(util[_0x1ca3('0x2a')]('user:%s',_0x4bf79a[_0x1ca3('0x13')]),_0x1ca3('0x3f'),{'sessionId':_0x4956cb,'transferNumber':_0xf4bf6f});return _0x3561e4['status'](0xc8)[_0x1ca3('0x25')]({'error':![],'message':'transfer\x20executed!'});})[_0x1ca3('0x2d')](handleError(_0x3561e4));}; \ No newline at end of file +var _0x385e=['client','http','../../config/logger','ioredis','defaults','localhost','socket.io-emitter','redis','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','error','stack','name','send','status','NotFound','then','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','validate','body','json','userId','callNumber','callerId','callbackUrl','format','user:%s','webbar:originate','originate\x20executed!','hangup\x20executed!','answer','answer\x20fired:','entityFound:','answer\x20executed!','hold','webbar:hold','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','UserId','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x385e,0x185));var _0xe385=function(_0x95411e,_0x38b4c3){_0x95411e=_0x95411e-0x0;var _0x2c8718=_0x385e[_0x95411e];return _0x2c8718;};'use strict';var path=require(_0xe385('0x0'));var fs=require('fs');var _=require(_0xe385('0x1'));var db=require(_0xe385('0x2'))['db'];var config=require(_0xe385('0x3'));var util=require('util');var BPromise=require(_0xe385('0x4'));var jayson=require(_0xe385('0x5'));var amiClient=jayson[_0xe385('0x6')][_0xe385('0x7')]({'port':0x232a});var logger=require(_0xe385('0x8'))('webbarapi');var Redis=require(_0xe385('0x9'));config['redis']=_[_0xe385('0xa')](config['redis'],{'host':_0xe385('0xb'),'port':0x18eb});var io=require(_0xe385('0xc'))(new Redis(config[_0xe385('0xd')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xe385('0xe'),'required':[!![],_0xe385('0xf')]},'callNumber':{'type':_0xe385('0x10'),'required':[!![],_0xe385('0x11')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xe385('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0xe385('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xe385('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xe385('0xe'),'required':[!![],_0xe385('0xf')]},'sessionId':{'type':_0xe385('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xe385('0xe'),'required':[!![],_0xe385('0xf')]},'sessionId':{'type':_0xe385('0x10'),'required':[!![],_0xe385('0x12')]},'transferNumber':{'type':'string','required':[!![],_0xe385('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0xe385('0xe'),'required':[!![],_0xe385('0xf')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xe385('0xe'),'required':[!![],_0xe385('0xf')]},'sessionId':{'type':_0xe385('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xe385('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0xe385('0xe'),'required':[!![],_0xe385('0xf')]}});function emit(_0x33fc67,_0x1f4f79,_0x168825){logger[_0xe385('0x14')](_0x33fc67,_0x1f4f79,JSON[_0xe385('0x15')](_0x168825));io['to'](_0x33fc67)[_0xe385('0x16')](_0x1f4f79,_0x168825);}function handleError(_0x817483){return function(_0x2e4210){console['log']('handleError:',_0x2e4210,_0x2e4210 instanceof RangeError);logger[_0xe385('0x17')](_0x2e4210[_0xe385('0x18')]);if(_0x2e4210 instanceof RangeError){if(_0x2e4210[_0xe385('0x19')]){delete _0x2e4210[_0xe385('0x19')];}_0x817483['status'](0x194)[_0xe385('0x1a')](_0x2e4210);}else{if(_0x2e4210[_0xe385('0x19')]){delete _0x2e4210[_0xe385('0x19')];}_0x817483[_0xe385('0x1b')](0x1f4)[_0xe385('0x1a')](_0x2e4210);}};}function checkError(){return function(_0x5ce257){if(!_0x5ce257){throw new RangeError(_0xe385('0x1c'));}return _0x5ce257;};}function respondWithRpcPromise(_0x64a61f,_0x4a79a6){return new BPromise(function(_0x30b1a2,_0x3342c3){var _0x38371c=amiClient;return _0x38371c['request'](_0x64a61f,_0x4a79a6)[_0xe385('0x1d')](function(_0x3a863a){if(_0x3a863a[_0xe385('0x17')]){if(_0x3a863a[_0xe385('0x17')]['code']===0x1f4){return _0x3342c3(_0x3a863a[_0xe385('0x17')][_0xe385('0x1e')]);}return _0x30b1a2(_0x3a863a[_0xe385('0x17')]['message']);}else{_0x30b1a2(_0x3a863a[_0xe385('0x1f')]);}})[_0xe385('0x20')](function(_0x8f6012){_0x3342c3(_0x8f6012);});});}function getAgent(_0x93363e){return db[_0xe385('0x21')][_0xe385('0x22')]({'where':{'id':_0x93363e,'role':_0xe385('0x23')}})['then'](checkError());}function getAgentCheckSession(_0x328a07,_0x1831d4){return new BPromise(function(_0x4200bb,_0x164faa){var _0x286d2e=respondWithRpcPromise(_0xe385('0x24'));var _0x45cec9=getAgent(_0x328a07);Promise[_0xe385('0x25')]([_0x286d2e,_0x45cec9])[_0xe385('0x1d')](function(_0x5db4a5){var _0x1667f7=_0x5db4a5[0x0];var _0x2e66c0=_0x5db4a5[0x1];var _0x279c9e=_[_0xe385('0x26')](_0x1667f7[_0xe385('0x27')],function(_0x83bacb){return _0x83bacb['UserId']==_0x2e66c0['id']&&_0x83bacb[_0xe385('0x28')]==_0x1831d4;});if(_0x279c9e[_0xe385('0x29')]==0x1){_0x4200bb(_0x2e66c0);}else{_0x164faa(new RangeError(_0xe385('0x2a')+_0x1831d4+_0xe385('0x2b')));}});});}exports[_0xe385('0x2c')]=function(_0x213c4c,_0x55cf7f){logger[_0xe385('0x14')](_0xe385('0x2d'),_0x213c4c['body']);var _0x380d9d=originateValidation[_0xe385('0x2e')](_0x213c4c[_0xe385('0x2f')]);if(_0x380d9d[_0xe385('0x29')]>0x0){return _0x55cf7f[_0xe385('0x1b')](0x190)[_0xe385('0x30')](_0x380d9d);}var _0x135338=_0x213c4c[_0xe385('0x2f')][_0xe385('0x31')];var _0x5654b5=_0x213c4c[_0xe385('0x2f')][_0xe385('0x32')];var _0x10ba44=_0x213c4c[_0xe385('0x2f')][_0xe385('0x33')];var _0x1139bb=_0x213c4c[_0xe385('0x2f')][_0xe385('0x34')];return getAgent(_0x135338)[_0xe385('0x1d')](function(_0x2cc80f){logger[_0xe385('0x14')]('entityFound:',_0x2cc80f[_0xe385('0x19')]);emit(util[_0xe385('0x35')](_0xe385('0x36'),_0x2cc80f[_0xe385('0x19')]),_0xe385('0x37'),{'callNumber':_0x5654b5,'callerId':_0x10ba44,'callbackUrl':_0x1139bb});return _0x55cf7f['status'](0xc8)['json']({'error':![],'message':_0xe385('0x38')});})[_0xe385('0x20')](handleError(_0x55cf7f));};exports['hangup']=function(_0x3c37d2,_0x3978a7){logger[_0xe385('0x14')]('hangup\x20fired:',_0x3c37d2['body']);var _0x526937=hangupValidation[_0xe385('0x2e')](_0x3c37d2[_0xe385('0x2f')]);if(_0x526937[_0xe385('0x29')]>0x0){return _0x3978a7[_0xe385('0x1b')](0x190)['json'](_0x526937);}var _0x11c8f6=_0x3c37d2[_0xe385('0x2f')][_0xe385('0x31')];var _0xf7478e=_0x3c37d2[_0xe385('0x2f')]['sessionId'];return getAgent(_0x11c8f6)[_0xe385('0x1d')](function(_0x462b0f){logger[_0xe385('0x14')]('entityFound:',_0x462b0f[_0xe385('0x19')]);emit(util[_0xe385('0x35')](_0xe385('0x36'),_0x462b0f[_0xe385('0x19')]),'webbar:hangup',{'sessionId':_0xf7478e});return _0x3978a7[_0xe385('0x1b')](0xc8)['json']({'error':![],'message':_0xe385('0x39')});})['catch'](handleError(_0x3978a7));};exports[_0xe385('0x3a')]=function(_0x1c3ddc,_0x1f2364){logger[_0xe385('0x14')](_0xe385('0x3b'),_0x1c3ddc[_0xe385('0x2f')]);var _0x1a34b1=answerValidation[_0xe385('0x2e')](_0x1c3ddc['body']);if(_0x1a34b1[_0xe385('0x29')]>0x0){return _0x1f2364[_0xe385('0x1b')](0x190)[_0xe385('0x30')](_0x1a34b1);}var _0x426965=_0x1c3ddc[_0xe385('0x2f')][_0xe385('0x31')];var _0x58273f=_0x1c3ddc['body'][_0xe385('0x28')];return getAgent(_0x426965)[_0xe385('0x1d')](function(_0x8cdec2){logger['info'](_0xe385('0x3c'),_0x8cdec2['name']);emit(util[_0xe385('0x35')](_0xe385('0x36'),_0x8cdec2[_0xe385('0x19')]),'webbar:answer',{'sessionId':_0x58273f});return _0x1f2364[_0xe385('0x1b')](0xc8)[_0xe385('0x30')]({'error':![],'message':_0xe385('0x3d')});})[_0xe385('0x20')](handleError(_0x1f2364));};exports[_0xe385('0x3e')]=function(_0x1ae5c0,_0x1691c9){logger[_0xe385('0x14')]('hold\x20fired:',_0x1ae5c0[_0xe385('0x2f')]);var _0x49449a=holdValidation['validate'](_0x1ae5c0[_0xe385('0x2f')]);if(_0x49449a['length']>0x0){return _0x1691c9['status'](0x190)['json'](_0x49449a);}var _0x436564=_0x1ae5c0['body'][_0xe385('0x31')];var _0x3ade60=_0x1ae5c0['body'][_0xe385('0x28')];return getAgent(_0x436564)[_0xe385('0x1d')](function(_0x599deb){logger[_0xe385('0x14')](_0xe385('0x3c'),_0x599deb[_0xe385('0x19')]);emit(util['format'](_0xe385('0x36'),_0x599deb[_0xe385('0x19')]),_0xe385('0x3f'),{'sessionId':_0x3ade60});return _0x1691c9['status'](0xc8)[_0xe385('0x30')]({'error':![],'message':'hold\x20executed!'});})[_0xe385('0x20')](handleError(_0x1691c9));};exports[_0xe385('0x40')]=function(_0x39dd5f,_0x39cb03){logger['info']('unhold\x20fired:',_0x39dd5f[_0xe385('0x2f')]);var _0x926475=unholdValidation[_0xe385('0x2e')](_0x39dd5f[_0xe385('0x2f')]);if(_0x926475[_0xe385('0x29')]>0x0){return _0x39cb03[_0xe385('0x1b')](0x190)['json'](_0x926475);}var _0x41a2cf=_0x39dd5f[_0xe385('0x2f')]['userId'];var _0x3654f6=_0x39dd5f[_0xe385('0x2f')][_0xe385('0x28')];return getAgent(_0x41a2cf)['then'](function(_0xd366a3){logger[_0xe385('0x14')](_0xe385('0x3c'),_0xd366a3['name']);emit(util[_0xe385('0x35')](_0xe385('0x36'),_0xd366a3[_0xe385('0x19')]),_0xe385('0x41'),{'sessionId':_0x3654f6});return _0x39cb03['status'](0xc8)['json']({'error':![],'message':_0xe385('0x42')});})[_0xe385('0x20')](handleError(_0x39cb03));};exports[_0xe385('0x43')]=function(_0x54654f,_0x4eb199){logger['info'](_0xe385('0x44'),_0x4eb199[_0xe385('0x2f')]);var _0x437b71=callsValidation['validate'](_0x54654f[_0xe385('0x2f')]);if(_0x437b71[_0xe385('0x29')]>0x0){return _0x4eb199['status'](0x190)['json'](_0x437b71);}var _0x2473ef=_0x54654f[_0xe385('0x2f')][_0xe385('0x31')];var _0x95ab36=respondWithRpcPromise(_0xe385('0x24'));var _0x2c7a86=getAgent(_0x2473ef);return Promise[_0xe385('0x25')]([_0x95ab36,_0x2c7a86])['then'](function(_0x46ed8b){var _0x55db13=_0x46ed8b[0x0];var _0x53440f=_0x46ed8b[0x1];var _0x4b4513=_[_0xe385('0x26')](_0x55db13[_0xe385('0x27')],function(_0x685487){return _0x685487[_0xe385('0x45')]==_0x53440f['id'];});return _0x4eb199[_0xe385('0x1b')](0xc8)[_0xe385('0x30')]({'count':_0x4b4513['length'],'rows':_0x4b4513});})[_0xe385('0x20')](handleError(_0x4eb199));};exports[_0xe385('0x46')]=function(_0x24ee0e,_0x33ba6a){logger[_0xe385('0x14')](_0xe385('0x47'),_0x24ee0e['body']);var _0x5841d1=conferenceValidation[_0xe385('0x2e')](_0x24ee0e['body']);if(_0x5841d1[_0xe385('0x29')]>0x0){return _0x33ba6a[_0xe385('0x1b')](0x190)[_0xe385('0x30')](_0x5841d1);}var _0x48554b=_0x24ee0e[_0xe385('0x2f')]['userId'];return getAgent(_0x48554b)[_0xe385('0x1d')](function(_0x1918ad){logger[_0xe385('0x14')](_0xe385('0x3c'),_0x1918ad[_0xe385('0x19')]);emit(util['format'](_0xe385('0x36'),_0x1918ad['name']),_0xe385('0x48'));return _0x33ba6a[_0xe385('0x1b')](0xc8)[_0xe385('0x30')]({'error':![],'message':_0xe385('0x49')});})[_0xe385('0x20')](handleError(_0x33ba6a));};exports[_0xe385('0x4a')]=function(_0x2c7860,_0x68750){logger[_0xe385('0x14')](_0xe385('0x4b'),_0x2c7860['body']);var _0x157dd5=transferValidation[_0xe385('0x2e')](_0x2c7860[_0xe385('0x2f')]);if(_0x157dd5[_0xe385('0x29')]>0x0){return _0x68750['status'](0x190)[_0xe385('0x30')](_0x157dd5);}var _0x16f1c7=_0x2c7860[_0xe385('0x2f')][_0xe385('0x31')];var _0x5be7e7=_0x2c7860['body']['sessionId'];var _0x4dceb3=_0x2c7860[_0xe385('0x2f')][_0xe385('0x4c')];return getAgent(_0x16f1c7)[_0xe385('0x1d')](function(_0x14e90b){logger[_0xe385('0x14')]('entityFound:',_0x14e90b[_0xe385('0x19')]);emit(util[_0xe385('0x35')](_0xe385('0x36'),_0x14e90b['name']),_0xe385('0x4d'),{'sessionId':_0x5be7e7,'transferNumber':_0x4dceb3});return _0x68750[_0xe385('0x1b')](0xc8)[_0xe385('0x30')]({'error':![],'message':_0xe385('0x4e')});})['catch'](handleError(_0x68750));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 9af530c..7ab9905 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 _0xf4a6=['addAgents','addApplications','/:id/notify','send','put','update','delete','destroy','removeAnswers','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','describe','/:id','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/users','getAgents','/:id/applications','create','post','/:id/canned_answers','addAnswer'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0xf4a6,0x1c4));var _0x6f4a=function(_0xdb158d,_0x5b6178){_0xdb158d=_0xdb158d-0x0;var _0x256286=_0xf4a6[_0xdb158d];return _0x256286;};'use strict';var multer=require(_0x6f4a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6f4a('0x1'));var express=require(_0x6f4a('0x2'));var router=express[_0x6f4a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6f4a('0x4'));var interaction=require(_0x6f4a('0x5'));var config=require(_0x6f4a('0x6'));var controller=require(_0x6f4a('0x7'));router[_0x6f4a('0x8')]('/',auth['isAuthenticated'](),controller[_0x6f4a('0x9')]);router[_0x6f4a('0x8')](_0x6f4a('0xa'),auth['isAuthenticated'](),controller[_0x6f4a('0xb')]);router[_0x6f4a('0x8')](_0x6f4a('0xc'),auth['isAuthenticated'](),controller[_0x6f4a('0xd')]);router[_0x6f4a('0x8')](_0x6f4a('0xe'),auth[_0x6f4a('0xf')](),controller[_0x6f4a('0x10')]);router[_0x6f4a('0x8')]('/:id/canned_answers',auth[_0x6f4a('0xf')](),controller['getAnswers']);router[_0x6f4a('0x8')](_0x6f4a('0x11'),auth[_0x6f4a('0xf')](),controller[_0x6f4a('0x12')]);router['get'](_0x6f4a('0x13'),auth[_0x6f4a('0xf')](),controller['getApplications']);router['post']('/',auth[_0x6f4a('0xf')](),controller[_0x6f4a('0x14')]);router[_0x6f4a('0x15')](_0x6f4a('0xe'),auth[_0x6f4a('0xf')](),controller['addDisposition']);router[_0x6f4a('0x15')](_0x6f4a('0x16'),auth[_0x6f4a('0xf')](),controller[_0x6f4a('0x17')]);router[_0x6f4a('0x15')]('/:id/users',auth[_0x6f4a('0xf')](),controller[_0x6f4a('0x18')]);router[_0x6f4a('0x15')]('/:id/applications',auth[_0x6f4a('0xf')](),controller[_0x6f4a('0x19')]);router[_0x6f4a('0x15')](_0x6f4a('0x1a'),controller['notify']);router[_0x6f4a('0x15')]('/:id/send',auth[_0x6f4a('0xf')](),controller[_0x6f4a('0x1b')]);router[_0x6f4a('0x1c')](_0x6f4a('0xc'),auth[_0x6f4a('0xf')](),controller[_0x6f4a('0x1d')]);router[_0x6f4a('0x1e')](_0x6f4a('0xc'),auth[_0x6f4a('0xf')](),controller[_0x6f4a('0x1f')]);router['delete'](_0x6f4a('0xe'),auth[_0x6f4a('0xf')](),controller['removeDispositions']);router['delete'](_0x6f4a('0x16'),auth[_0x6f4a('0xf')](),controller[_0x6f4a('0x20')]);router[_0x6f4a('0x1e')]('/:id/users',auth[_0x6f4a('0xf')](),controller['removeAgents']);module[_0x6f4a('0x21')]=router; \ No newline at end of file +var _0x13a6=['post','create','addDisposition','/:id/canned_answers','/:id/notify','notify','/:id/send','send','put','/:id','update','destroy','removeAnswers','delete','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/users','/:id/applications','getApplications'];(function(_0x3dc1e9,_0x20484c){var _0x1a8e32=function(_0x3248a1){while(--_0x3248a1){_0x3dc1e9['push'](_0x3dc1e9['shift']());}};_0x1a8e32(++_0x20484c);}(_0x13a6,0x140));var _0x613a=function(_0x4677ee,_0x5d58dd){_0x4677ee=_0x4677ee-0x0;var _0x3dda22=_0x13a6[_0x4677ee];return _0x3dda22;};'use strict';var multer=require(_0x613a('0x0'));var util=require(_0x613a('0x1'));var path=require('path');var timeout=require(_0x613a('0x2'));var express=require(_0x613a('0x3'));var router=express[_0x613a('0x4')]();var fs_extra=require(_0x613a('0x5'));var auth=require(_0x613a('0x6'));var interaction=require(_0x613a('0x7'));var config=require(_0x613a('0x8'));var controller=require(_0x613a('0x9'));router[_0x613a('0xa')]('/',auth[_0x613a('0xb')](),controller[_0x613a('0xc')]);router[_0x613a('0xa')](_0x613a('0xd'),auth[_0x613a('0xb')](),controller[_0x613a('0xe')]);router['get']('/:id',auth[_0x613a('0xb')](),controller[_0x613a('0xf')]);router[_0x613a('0xa')](_0x613a('0x10'),auth[_0x613a('0xb')](),controller[_0x613a('0x11')]);router[_0x613a('0xa')]('/:id/canned_answers',auth[_0x613a('0xb')](),controller[_0x613a('0x12')]);router['get'](_0x613a('0x13'),auth[_0x613a('0xb')](),controller['getAgents']);router[_0x613a('0xa')](_0x613a('0x14'),auth[_0x613a('0xb')](),controller[_0x613a('0x15')]);router[_0x613a('0x16')]('/',auth['isAuthenticated'](),controller[_0x613a('0x17')]);router['post'](_0x613a('0x10'),auth[_0x613a('0xb')](),controller[_0x613a('0x18')]);router[_0x613a('0x16')](_0x613a('0x19'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x613a('0x16')]('/:id/users',auth[_0x613a('0xb')](),controller['addAgents']);router['post'](_0x613a('0x14'),auth[_0x613a('0xb')](),controller['addApplications']);router[_0x613a('0x16')](_0x613a('0x1a'),controller[_0x613a('0x1b')]);router['post'](_0x613a('0x1c'),auth[_0x613a('0xb')](),controller[_0x613a('0x1d')]);router[_0x613a('0x1e')](_0x613a('0x1f'),auth['isAuthenticated'](),controller[_0x613a('0x20')]);router['delete'](_0x613a('0x1f'),auth[_0x613a('0xb')](),controller[_0x613a('0x21')]);router['delete']('/:id/dispositions',auth[_0x613a('0xb')](),controller['removeDispositions']);router['delete'](_0x613a('0x19'),auth['isAuthenticated'](),controller[_0x613a('0x22')]);router[_0x613a('0x23')](_0x613a('0x13'),auth[_0x613a('0xb')](),controller[_0x613a('0x24')]);module[_0x613a('0x25')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 30bb0d0..66cd134 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 _0x3b0d=['sinch','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','randomstring','STRING','name','generate','ENUM','twilio'];(function(_0x45ce08,_0x59dcc7){var _0x23dff2=function(_0x1ad0e5){while(--_0x1ad0e5){_0x45ce08['push'](_0x45ce08['shift']());}};_0x23dff2(++_0x59dcc7);}(_0x3b0d,0x1db));var _0xd3b0=function(_0x114adc,_0x1b1c55){_0x114adc=_0x114adc-0x0;var _0x19199a=_0x3b0d[_0x114adc];return _0x19199a;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xd3b0('0x0'));module['exports']={'name':{'type':Sequelize[_0xd3b0('0x1')],'unique':_0xd3b0('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xd3b0('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xd3b0('0x3')]();}},'phone':{'type':Sequelize[_0xd3b0('0x1')]},'type':{'type':Sequelize[_0xd3b0('0x4')](_0xd3b0('0x5'),_0xd3b0('0x6'))},'accountSid':{'type':Sequelize[_0xd3b0('0x1')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xd3b0('0x7');}},'notificationSound':{'type':Sequelize[_0xd3b0('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xd3b0('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd3b0('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xd3b0('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd3b0('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd3b0('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd3b0('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd3b0('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd3b0('0x9')],'comment':_0xd3b0('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xd3b0('0x8')],'defaultValue':![],'comment':_0xd3b0('0xb'),'set':function(_0x10893c){if(!_0x10893c){this['setDataValue'](_0xd3b0('0xc'),null);}this['setDataValue']('mandatoryDisposition',_0x10893c);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb410=['sequelize','randomstring','STRING','name','generate','twilio','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0xff9cb,_0x1b45d7){var _0x455a53=function(_0x50cd1b){while(--_0x50cd1b){_0xff9cb['push'](_0xff9cb['shift']());}};_0x455a53(++_0x1b45d7);}(_0xb410,0x96));var _0x0b41=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xb410[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0x0b41('0x0'));var rs=require(_0x0b41('0x1'));module['exports']={'name':{'type':Sequelize[_0x0b41('0x2')],'unique':_0x0b41('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x0b41('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x0b41('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x0b41('0x2')],'defaultValue':function(){return rs[_0x0b41('0x4')]();}},'phone':{'type':Sequelize[_0x0b41('0x2')]},'type':{'type':Sequelize['ENUM'](_0x0b41('0x5'),_0x0b41('0x6'))},'accountSid':{'type':Sequelize[_0x0b41('0x2')]},'baseUrl':{'type':Sequelize[_0x0b41('0x2')]},'authToken':{'type':Sequelize[_0x0b41('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x0b41('0x7');}},'notificationSound':{'type':Sequelize[_0x0b41('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x0b41('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0b41('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x0b41('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0b41('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0b41('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0b41('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0b41('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x0b41('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x0b41('0x8')],'defaultValue':![],'comment':_0x0b41('0xb'),'set':function(_0x5cff8e){if(!_0x5cff8e){this[_0x0b41('0xc')](_0x0b41('0xd'),null);}this['setDataValue'](_0x0b41('0xe'),_0x5cff8e);}},'description':{'type':Sequelize[_0x0b41('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 156a7a5..2670153 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 _0xebd3=['queueId','WhatsappQueue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','set','Content-Type','\x0a','to\x20is\x20mandatory','List','WhatsappInteraction','out','user','Messages','dataValues','eml-format','zip-dir','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','request','then','info','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','WhatsappAccount,\x20%s,\x20%s','error','message','request\x20sent','result','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy','WhatsappAccounts','stack','name','send','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','options','removeAnswers','ids','addAgents','omit','spread','emit','removeAgents','getAgents','User','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','finally','getApplications','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','mobile','twilio','From','replace','whatsapp:','Body','MessageSid','from','notifications','messageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','ListId','Contacts','DESC','list','contact','interaction','autoclose','push','created','ContactId','AttachmentId','UserId','unshift','*,*,*,*'];(function(_0x28c3a3,_0x1cc488){var _0x5772fa=function(_0xd5659d){while(--_0xd5659d){_0x28c3a3['push'](_0x28c3a3['shift']());}};_0x5772fa(++_0x1cc488);}(_0xebd3,0x194));var _0x3ebd=function(_0x19b84f,_0x48765e){_0x19b84f=_0x19b84f-0x0;var _0x18067b=_0xebd3[_0x19b84f];return _0x18067b;};'use strict';var emlformat=require(_0x3ebd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3ebd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3ebd('0x2'));var moment=require(_0x3ebd('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x3ebd('0x4'));var sox=require(_0x3ebd('0x5'));var csv=require(_0x3ebd('0x6'));var ejs=require(_0x3ebd('0x7'));var fs=require('fs');var fs_extra=require(_0x3ebd('0x8'));var _=require(_0x3ebd('0x9'));var squel=require(_0x3ebd('0xa'));var crypto=require(_0x3ebd('0xb'));var jsforce=require(_0x3ebd('0xc'));var deskjs=require(_0x3ebd('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3ebd('0xe'));var Papa=require('papaparse');var Redis=require(_0x3ebd('0xf'));var authService=require(_0x3ebd('0x10'));var qs=require(_0x3ebd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ebd('0x12'));var logger=require('../../config/logger')(_0x3ebd('0x13'));var utils=require('../../config/utils');var config=require(_0x3ebd('0x14'));var licenseUtil=require(_0x3ebd('0x15'));var db=require(_0x3ebd('0x16'))['db'];config[_0x3ebd('0x17')]=_[_0x3ebd('0x18')](config['redis'],{'host':_0x3ebd('0x19'),'port':0x18eb});var socket=require(_0x3ebd('0x1a'))(new Redis(config['redis']));require(_0x3ebd('0x1b'))[_0x3ebd('0x1c')](socket);var jayson=require(_0x3ebd('0x1d'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x3b6ced,_0x585ff7,_0x116f7b,_0x6e6291){return new BPromise(function(_0x2a0c2e,_0x32d9e8){var _0x3f6278=_0x6e6291||client;return _0x3f6278[_0x3ebd('0x1e')](_0x3b6ced,_0x116f7b)[_0x3ebd('0x1f')](function(_0x6c486a){logger[_0x3ebd('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x585ff7,'request\x20sent');logger['debug'](_0x3ebd('0x21'),_0x585ff7,'request\x20sent',JSON[_0x3ebd('0x22')](_0x6c486a));if(_0x6c486a['error']){if(_0x6c486a['error']['code']===0x1f4){logger['error'](_0x3ebd('0x23'),_0x585ff7,_0x6c486a[_0x3ebd('0x24')]['message']);return _0x32d9e8(_0x6c486a['error'][_0x3ebd('0x25')]);}logger[_0x3ebd('0x24')](_0x3ebd('0x23'),_0x585ff7,_0x6c486a['error'][_0x3ebd('0x25')]);return _0x2a0c2e(_0x6c486a[_0x3ebd('0x24')][_0x3ebd('0x25')]);}else{logger[_0x3ebd('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x585ff7,_0x3ebd('0x26'));_0x2a0c2e(_0x6c486a[_0x3ebd('0x27')]['message']);}})['catch'](function(_0x506748){logger['error'](_0x3ebd('0x23'),_0x585ff7,_0x506748);_0x32d9e8(_0x506748);});});}function respondWithStatusCode(_0x339c8b,_0x2b17d1){_0x2b17d1=_0x2b17d1||0xcc;return function(_0x45666b){if(_0x45666b){return _0x339c8b[_0x3ebd('0x28')](_0x2b17d1);}return _0x339c8b[_0x3ebd('0x29')](_0x2b17d1)[_0x3ebd('0x2a')]();};}function respondWithResult(_0x143ef1,_0x10855a){_0x10855a=_0x10855a||0xc8;return function(_0x1dbc38){if(_0x1dbc38){return _0x143ef1[_0x3ebd('0x29')](_0x10855a)[_0x3ebd('0x2b')](_0x1dbc38);}};}function respondWithFilteredResult(_0x4dcc51,_0x4af09b){return function(_0x29537a){if(_0x29537a){var _0x1f4e46=typeof _0x4af09b[_0x3ebd('0x2c')]===_0x3ebd('0x2d')&&typeof _0x4af09b[_0x3ebd('0x2e')]===_0x3ebd('0x2d');var _0x939846=_0x29537a[_0x3ebd('0x2f')];var _0x485b30=_0x1f4e46?0x0:_0x4af09b[_0x3ebd('0x2c')];var _0x5b807c=_0x1f4e46?_0x29537a[_0x3ebd('0x2f')]:_0x4af09b['offset']+_0x4af09b['limit'];var _0x533dd9;if(_0x5b807c>=_0x939846){_0x5b807c=_0x939846;_0x533dd9=0xc8;}else{_0x533dd9=0xce;}_0x4dcc51[_0x3ebd('0x29')](_0x533dd9);return _0x4dcc51['set']('Content-Range',_0x485b30+'-'+_0x5b807c+'/'+_0x939846)[_0x3ebd('0x2b')](_0x29537a);}return null;};}function patchUpdates(_0x48d9dd){return function(_0x127a3a){try{jsonpatch[_0x3ebd('0x30')](_0x127a3a,_0x48d9dd,!![]);}catch(_0x81af02){return BPromise[_0x3ebd('0x31')](_0x81af02);}return _0x127a3a[_0x3ebd('0x32')]();};}function saveUpdates(_0x4f060f,_0x4b6d9e){return function(_0xf8cee1){if(_0xf8cee1){return _0xf8cee1[_0x3ebd('0x33')](_0x4f060f)[_0x3ebd('0x1f')](function(_0xe9ed9a){return _0xe9ed9a;});}return null;};}function removeEntity(_0x2a4232,_0x2562cb){return function(_0x5bdf01){if(_0x5bdf01){return _0x5bdf01[_0x3ebd('0x34')]()[_0x3ebd('0x1f')](function(){var _0x250124=_0x5bdf01['get']({'plain':!![]});var _0xa63d0f=_0x3ebd('0x35');return db['UserProfileResource']['destroy']({'where':{'type':_0xa63d0f,'resourceId':_0x250124['id']}})[_0x3ebd('0x1f')](function(){return _0x5bdf01;});})[_0x3ebd('0x1f')](function(){_0x2a4232[_0x3ebd('0x29')](0xcc)[_0x3ebd('0x2a')]();});}};}function handleEntityNotFound(_0x4f9968,_0x3e5aae){return function(_0x1e7558){if(!_0x1e7558){_0x4f9968[_0x3ebd('0x28')](0x194);}return _0x1e7558;};}function handleError(_0x41c034,_0x5b43fb){_0x5b43fb=_0x5b43fb||0x1f4;return function(_0x585209){logger[_0x3ebd('0x24')](_0x585209[_0x3ebd('0x36')]);if(_0x585209[_0x3ebd('0x37')]){delete _0x585209[_0x3ebd('0x37')];}_0x41c034[_0x3ebd('0x29')](_0x5b43fb)[_0x3ebd('0x38')](_0x585209);};}exports['index']=function(_0x3bd7bf,_0x291817){var _0x275ce9={'include':[{'model':db['Pause'],'as':_0x3ebd('0x39')}]},_0x44c932={},_0x4c527d={'count':0x0,'rows':[]};var _0x59da81=_['map'](db[_0x3ebd('0x3a')][_0x3ebd('0x3b')],function(_0x30466a){return{'name':_0x30466a[_0x3ebd('0x3c')],'type':_0x30466a[_0x3ebd('0x3d')][_0x3ebd('0x3e')]};});_0x44c932['model']=_[_0x3ebd('0x3f')](_0x59da81,'name');_0x44c932['query']=_['keys'](_0x3bd7bf[_0x3ebd('0x40')]);_0x44c932[_0x3ebd('0x41')]=_[_0x3ebd('0x42')](_0x44c932[_0x3ebd('0x43')],_0x44c932['query']);_0x275ce9[_0x3ebd('0x44')]=_[_0x3ebd('0x42')](_0x44c932[_0x3ebd('0x43')],qs[_0x3ebd('0x45')](_0x3bd7bf['query']['fields']));_0x275ce9[_0x3ebd('0x44')]=_0x275ce9[_0x3ebd('0x44')][_0x3ebd('0x46')]?_0x275ce9['attributes']:_0x44c932[_0x3ebd('0x43')];if(!_0x3bd7bf[_0x3ebd('0x40')][_0x3ebd('0x47')](_0x3ebd('0x48'))){_0x275ce9[_0x3ebd('0x2e')]=qs[_0x3ebd('0x2e')](_0x3bd7bf[_0x3ebd('0x40')][_0x3ebd('0x2e')]);_0x275ce9[_0x3ebd('0x2c')]=qs['offset'](_0x3bd7bf[_0x3ebd('0x40')][_0x3ebd('0x2c')]);}_0x275ce9[_0x3ebd('0x49')]=qs[_0x3ebd('0x4a')](_0x3bd7bf[_0x3ebd('0x40')][_0x3ebd('0x4a')]);_0x275ce9['where']=qs['filters'](_[_0x3ebd('0x4b')](_0x3bd7bf['query'],_0x44c932['filters']),_0x59da81);if(_0x3bd7bf[_0x3ebd('0x40')][_0x3ebd('0x4c')]){_0x275ce9[_0x3ebd('0x4d')]=_[_0x3ebd('0x4e')](_0x275ce9['where'],{'$or':_[_0x3ebd('0x3f')](_0x59da81,function(_0x4aa47c){if(_0x4aa47c[_0x3ebd('0x3d')]!=='VIRTUAL'){var _0x488ceb={};_0x488ceb[_0x4aa47c[_0x3ebd('0x37')]]={'$like':'%'+_0x3bd7bf[_0x3ebd('0x40')]['filter']+'%'};return _0x488ceb;}})});}_0x275ce9=_['merge']({},_0x275ce9,_0x3bd7bf['options']);var _0x2eba50={'where':_0x275ce9['where']};return db[_0x3ebd('0x3a')]['count'](_0x2eba50)[_0x3ebd('0x1f')](function(_0x5e64df){_0x4c527d['count']=_0x5e64df;if(_0x3bd7bf['query'][_0x3ebd('0x4f')]){_0x275ce9[_0x3ebd('0x50')]=[{'all':!![]}];}return db[_0x3ebd('0x3a')][_0x3ebd('0x51')](_0x275ce9);})[_0x3ebd('0x1f')](function(_0x11c8ab){_0x4c527d[_0x3ebd('0x52')]=_0x11c8ab;return _0x4c527d;})[_0x3ebd('0x1f')](respondWithFilteredResult(_0x291817,_0x275ce9))[_0x3ebd('0x53')](handleError(_0x291817,null));};exports[_0x3ebd('0x54')]=function(_0x60e1b2,_0x22fc7f){var _0x433482={'raw':![],'where':{'id':_0x60e1b2[_0x3ebd('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x3ebd('0x39')}]},_0x2c5b94={};_0x2c5b94[_0x3ebd('0x43')]=_[_0x3ebd('0x56')](db['WhatsappAccount'][_0x3ebd('0x3b')]);_0x2c5b94['query']=_[_0x3ebd('0x56')](_0x60e1b2['query']);_0x2c5b94[_0x3ebd('0x41')]=_[_0x3ebd('0x42')](_0x2c5b94[_0x3ebd('0x43')],_0x2c5b94[_0x3ebd('0x40')]);_0x433482[_0x3ebd('0x44')]=_[_0x3ebd('0x42')](_0x2c5b94['model'],qs['fields'](_0x60e1b2[_0x3ebd('0x40')][_0x3ebd('0x45')]));_0x433482[_0x3ebd('0x44')]=_0x433482[_0x3ebd('0x44')][_0x3ebd('0x46')]?_0x433482[_0x3ebd('0x44')]:_0x2c5b94['model'];if(_0x60e1b2['query']['includeAll']){_0x433482[_0x3ebd('0x50')]=[{'all':!![]}];}_0x433482=_[_0x3ebd('0x4e')]({},_0x433482,_0x60e1b2['options']);return db[_0x3ebd('0x3a')][_0x3ebd('0x57')](_0x433482)[_0x3ebd('0x1f')](handleEntityNotFound(_0x22fc7f,null))[_0x3ebd('0x1f')](respondWithResult(_0x22fc7f,null))[_0x3ebd('0x53')](handleError(_0x22fc7f,null));};exports[_0x3ebd('0x58')]=function(_0x8fd21d,_0x1a093e){return db['WhatsappAccount']['create'](_0x8fd21d[_0x3ebd('0x59')],{})['then'](function(_0x234ca1){var _0xdc3dc2=_0x8fd21d['user'][_0x3ebd('0x5a')]({'plain':!![]});if(!_0xdc3dc2)throw new Error(_0x3ebd('0x5b'));if(_0xdc3dc2['role']==='user'){var _0x227c53=_0x234ca1[_0x3ebd('0x5a')]({'plain':!![]});var _0x77b409='WhatsappAccounts';return db[_0x3ebd('0x5c')]['find']({'where':{'name':_0x77b409,'userProfileId':_0xdc3dc2[_0x3ebd('0x5d')]},'raw':!![]})[_0x3ebd('0x1f')](function(_0x4d5007){if(_0x4d5007&&_0x4d5007['autoAssociation']===0x0){return db['UserProfileResource'][_0x3ebd('0x58')]({'name':_0x227c53['name'],'resourceId':_0x227c53['id'],'type':_0x4d5007['name'],'sectionId':_0x4d5007['id']},{})[_0x3ebd('0x1f')](function(){return _0x234ca1;});}else{return _0x234ca1;}})['catch'](function(_0x3be32f){logger[_0x3ebd('0x24')](_0x3ebd('0x5e'),_0x3be32f);throw _0x3be32f;});}return _0x234ca1;})['then'](respondWithResult(_0x1a093e,0xc9))['catch'](handleError(_0x1a093e,null));};exports[_0x3ebd('0x33')]=function(_0x3fd30e,_0x2925ea){if(_0x3fd30e[_0x3ebd('0x59')]['id']){delete _0x3fd30e[_0x3ebd('0x59')]['id'];}return db[_0x3ebd('0x3a')][_0x3ebd('0x57')]({'where':{'id':_0x3fd30e[_0x3ebd('0x55')]['id']},'include':[{'model':db[_0x3ebd('0x5f')],'as':_0x3ebd('0x39')}]})[_0x3ebd('0x1f')](handleEntityNotFound(_0x2925ea,null))[_0x3ebd('0x1f')](saveUpdates(_0x3fd30e[_0x3ebd('0x59')],null))['then'](respondWithResult(_0x2925ea,null))['catch'](handleError(_0x2925ea,null));};exports[_0x3ebd('0x34')]=function(_0x5e7790,_0x4dc3bd){return db[_0x3ebd('0x3a')][_0x3ebd('0x57')]({'where':{'id':_0x5e7790[_0x3ebd('0x55')]['id']}})[_0x3ebd('0x1f')](handleEntityNotFound(_0x4dc3bd,null))[_0x3ebd('0x1f')](removeEntity(_0x4dc3bd,null))[_0x3ebd('0x53')](handleError(_0x4dc3bd,null));};exports[_0x3ebd('0x60')]=function(_0x51dc82,_0x5c93c2){return db[_0x3ebd('0x3a')][_0x3ebd('0x60')]()[_0x3ebd('0x1f')](respondWithResult(_0x5c93c2,null))[_0x3ebd('0x53')](handleError(_0x5c93c2,null));};exports[_0x3ebd('0x61')]=function(_0x2c2f89,_0x2507e0,_0x75ddb3){if(_0x2c2f89[_0x3ebd('0x59')]['id']){delete _0x2c2f89[_0x3ebd('0x59')]['id'];}return db[_0x3ebd('0x3a')][_0x3ebd('0x57')]({'where':{'id':_0x2c2f89[_0x3ebd('0x55')]['id']}})[_0x3ebd('0x1f')](handleEntityNotFound(_0x2507e0,null))[_0x3ebd('0x1f')](function(_0x2c86b5){if(_0x2c86b5){_0x2c2f89[_0x3ebd('0x59')][_0x3ebd('0x62')]=_0x2c86b5['id'];return db[_0x3ebd('0x63')]['create'](_0x2c2f89[_0x3ebd('0x59')]);}})['then'](respondWithResult(_0x2507e0,null))[_0x3ebd('0x53')](handleError(_0x2507e0,null));};exports[_0x3ebd('0x64')]=function(_0x3046cb,_0x5767ac,_0x291c4b){var _0x3333be={'raw':![],'where':{}};var _0x35a336={};var _0x4f8d18={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x3ebd('0x65')]({'where':{'id':_0x3046cb[_0x3ebd('0x55')]['id']}})[_0x3ebd('0x1f')](handleEntityNotFound(_0x5767ac,null))[_0x3ebd('0x1f')](function(_0x1f9930){if(_0x1f9930){_0x35a336[_0x3ebd('0x43')]=_[_0x3ebd('0x56')](db[_0x3ebd('0x63')]['rawAttributes']);_0x35a336[_0x3ebd('0x40')]=_[_0x3ebd('0x56')](_0x3046cb['query']);_0x35a336[_0x3ebd('0x41')]=_[_0x3ebd('0x42')](_0x35a336[_0x3ebd('0x43')],_0x35a336[_0x3ebd('0x40')]);_0x3333be['attributes']=_[_0x3ebd('0x42')](_0x35a336[_0x3ebd('0x43')],qs[_0x3ebd('0x45')](_0x3046cb[_0x3ebd('0x40')][_0x3ebd('0x45')]));_0x3333be[_0x3ebd('0x44')]=_0x3333be[_0x3ebd('0x44')][_0x3ebd('0x46')]?_0x3333be['attributes']:_0x35a336[_0x3ebd('0x43')];if(!_0x3046cb[_0x3ebd('0x40')][_0x3ebd('0x47')](_0x3ebd('0x48'))){_0x3333be[_0x3ebd('0x2e')]=qs[_0x3ebd('0x2e')](_0x3046cb['query']['limit']);_0x3333be[_0x3ebd('0x2c')]=qs[_0x3ebd('0x2c')](_0x3046cb[_0x3ebd('0x40')][_0x3ebd('0x2c')]);}_0x3333be['order']=qs['sort'](_0x3046cb['query'][_0x3ebd('0x4a')]);_0x3333be[_0x3ebd('0x4d')]=qs[_0x3ebd('0x41')](_['pick'](_0x3046cb[_0x3ebd('0x40')],_0x35a336['filters']));_0x3333be[_0x3ebd('0x4d')]['WhatsappAccountId']=_0x1f9930['id'];if(_0x3046cb[_0x3ebd('0x40')]['filter']){_0x3333be[_0x3ebd('0x4d')]=_[_0x3ebd('0x4e')](_0x3333be[_0x3ebd('0x4d')],{'$or':_['map'](_0x3333be[_0x3ebd('0x44')],function(_0x1d71b4){var _0x299e4a={};_0x299e4a[_0x1d71b4]={'$like':'%'+_0x3046cb[_0x3ebd('0x40')][_0x3ebd('0x4c')]+'%'};return _0x299e4a;})});}_0x3333be=_[_0x3ebd('0x4e')]({},_0x3333be,_0x3046cb['options']);return db[_0x3ebd('0x63')][_0x3ebd('0x2f')]({'where':_0x3333be[_0x3ebd('0x4d')]})[_0x3ebd('0x1f')](function(_0x26508f){_0x4f8d18['count']=_0x26508f;if(_0x3046cb[_0x3ebd('0x40')][_0x3ebd('0x4f')]){_0x3333be[_0x3ebd('0x50')]=[{'all':!![]}];}return db['Disposition'][_0x3ebd('0x51')](_0x3333be);})[_0x3ebd('0x1f')](function(_0x2d1c5c){_0x4f8d18[_0x3ebd('0x52')]=_0x2d1c5c;return _0x4f8d18;});}})['then'](respondWithFilteredResult(_0x5767ac,_0x3333be))['catch'](handleError(_0x5767ac,null));};exports['removeDispositions']=function(_0x22b0cf,_0x35408c,_0x390bf9){return db[_0x3ebd('0x3a')][_0x3ebd('0x57')]({'where':{'id':_0x22b0cf[_0x3ebd('0x55')]['id']}})[_0x3ebd('0x1f')](handleEntityNotFound(_0x35408c,null))['then'](function(_0x2424f2){if(_0x2424f2){return _0x2424f2[_0x3ebd('0x66')](_0x22b0cf[_0x3ebd('0x40')]['ids']);}})[_0x3ebd('0x1f')](respondWithStatusCode(_0x35408c,null))[_0x3ebd('0x53')](handleError(_0x35408c,null));};exports[_0x3ebd('0x67')]=function(_0x3ba915,_0x112ebd,_0x477ff7){if(_0x3ba915['body']['id']){delete _0x3ba915[_0x3ebd('0x59')]['id'];}return db[_0x3ebd('0x3a')][_0x3ebd('0x57')]({'where':{'id':_0x3ba915[_0x3ebd('0x55')]['id']}})[_0x3ebd('0x1f')](handleEntityNotFound(_0x112ebd,null))[_0x3ebd('0x1f')](function(_0x22f723){if(_0x22f723){_0x3ba915[_0x3ebd('0x59')][_0x3ebd('0x62')]=_0x22f723['id'];return db[_0x3ebd('0x68')][_0x3ebd('0x58')](_0x3ba915['body']);}})[_0x3ebd('0x1f')](respondWithResult(_0x112ebd,null))[_0x3ebd('0x53')](handleError(_0x112ebd,null));};exports[_0x3ebd('0x69')]=function(_0x331fe8,_0x459f58,_0x5e015a){var _0x410ca9={'raw':![],'where':{}};var _0x3c7ed8={};var _0x1b170f={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x3ebd('0x65')]({'where':{'id':_0x331fe8[_0x3ebd('0x55')]['id']}})[_0x3ebd('0x1f')](handleEntityNotFound(_0x459f58,null))['then'](function(_0x281a77){if(_0x281a77){_0x3c7ed8['model']=_[_0x3ebd('0x56')](db['CannedAnswer']['rawAttributes']);_0x3c7ed8['query']=_[_0x3ebd('0x56')](_0x331fe8['query']);_0x3c7ed8['filters']=_[_0x3ebd('0x42')](_0x3c7ed8[_0x3ebd('0x43')],_0x3c7ed8[_0x3ebd('0x40')]);_0x410ca9[_0x3ebd('0x44')]=_[_0x3ebd('0x42')](_0x3c7ed8[_0x3ebd('0x43')],qs['fields'](_0x331fe8[_0x3ebd('0x40')]['fields']));_0x410ca9['attributes']=_0x410ca9[_0x3ebd('0x44')]['length']?_0x410ca9[_0x3ebd('0x44')]:_0x3c7ed8[_0x3ebd('0x43')];if(!_0x331fe8[_0x3ebd('0x40')][_0x3ebd('0x47')](_0x3ebd('0x48'))){_0x410ca9[_0x3ebd('0x2e')]=qs[_0x3ebd('0x2e')](_0x331fe8['query'][_0x3ebd('0x2e')]);_0x410ca9[_0x3ebd('0x2c')]=qs[_0x3ebd('0x2c')](_0x331fe8['query'][_0x3ebd('0x2c')]);}_0x410ca9[_0x3ebd('0x49')]=qs[_0x3ebd('0x4a')](_0x331fe8[_0x3ebd('0x40')][_0x3ebd('0x4a')]);_0x410ca9['where']=qs['filters'](_[_0x3ebd('0x4b')](_0x331fe8['query'],_0x3c7ed8[_0x3ebd('0x41')]));_0x410ca9[_0x3ebd('0x4d')][_0x3ebd('0x62')]=_0x281a77['id'];if(_0x331fe8['query']['filter']){_0x410ca9[_0x3ebd('0x4d')]=_[_0x3ebd('0x4e')](_0x410ca9[_0x3ebd('0x4d')],{'$or':_[_0x3ebd('0x3f')](_0x410ca9['attributes'],function(_0x1f8203){var _0x55c3ff={};_0x55c3ff[_0x1f8203]={'$like':'%'+_0x331fe8['query'][_0x3ebd('0x4c')]+'%'};return _0x55c3ff;})});}_0x410ca9=_[_0x3ebd('0x4e')]({},_0x410ca9,_0x331fe8[_0x3ebd('0x6a')]);return db[_0x3ebd('0x68')]['count']({'where':_0x410ca9[_0x3ebd('0x4d')]})[_0x3ebd('0x1f')](function(_0x405134){_0x1b170f[_0x3ebd('0x2f')]=_0x405134;if(_0x331fe8[_0x3ebd('0x40')][_0x3ebd('0x4f')]){_0x410ca9['include']=[{'all':!![]}];}return db[_0x3ebd('0x68')][_0x3ebd('0x51')](_0x410ca9);})[_0x3ebd('0x1f')](function(_0x38a55c){_0x1b170f[_0x3ebd('0x52')]=_0x38a55c;return _0x1b170f;});}})[_0x3ebd('0x1f')](respondWithFilteredResult(_0x459f58,_0x410ca9))[_0x3ebd('0x53')](handleError(_0x459f58,null));};exports[_0x3ebd('0x6b')]=function(_0x3bb679,_0x1ddce2,_0x4c8964){return db[_0x3ebd('0x3a')][_0x3ebd('0x57')]({'where':{'id':_0x3bb679[_0x3ebd('0x55')]['id']}})[_0x3ebd('0x1f')](handleEntityNotFound(_0x1ddce2,null))['then'](function(_0x4a1d18){if(_0x4a1d18){return _0x4a1d18[_0x3ebd('0x6b')](_0x3bb679['query'][_0x3ebd('0x6c')]);}})[_0x3ebd('0x1f')](respondWithStatusCode(_0x1ddce2,null))[_0x3ebd('0x53')](handleError(_0x1ddce2,null));};exports[_0x3ebd('0x6d')]=function(_0x5124e1,_0x13ac68,_0x202070){return db[_0x3ebd('0x3a')][_0x3ebd('0x57')]({'where':{'id':_0x5124e1[_0x3ebd('0x55')]['id']}})['then'](handleEntityNotFound(_0x13ac68,null))['then'](function(_0x264419){if(_0x264419){return _0x264419[_0x3ebd('0x6d')](_0x5124e1[_0x3ebd('0x59')][_0x3ebd('0x6c')],_[_0x3ebd('0x6e')](_0x5124e1[_0x3ebd('0x59')],['ids','id'])||{})[_0x3ebd('0x6f')](function(_0x44c006){for(var _0x512126=0x0;_0x512126<_0x5124e1['body'][_0x3ebd('0x6c')]['length'];_0x512126+=0x1){socket[_0x3ebd('0x70')]('userWhatsappAccount:save',{'UserId':Number(_0x5124e1[_0x3ebd('0x59')][_0x3ebd('0x6c')][_0x512126]),'WhatsappAccountId':Number(_0x5124e1['params']['id'])});}return _0x44c006;});}})[_0x3ebd('0x1f')](respondWithResult(_0x13ac68,null))[_0x3ebd('0x53')](handleError(_0x13ac68,null));};exports['removeAgents']=function(_0x4e2a3f,_0x255713,_0x11f704){return db[_0x3ebd('0x3a')][_0x3ebd('0x57')]({'where':{'id':_0x4e2a3f[_0x3ebd('0x55')]['id']}})['then'](handleEntityNotFound(_0x255713,null))[_0x3ebd('0x1f')](function(_0x4ef6f9){if(_0x4ef6f9){return _0x4ef6f9[_0x3ebd('0x71')](_0x4e2a3f[_0x3ebd('0x40')][_0x3ebd('0x6c')])[_0x3ebd('0x1f')](function(){if(_['isArray'](_0x4e2a3f[_0x3ebd('0x40')][_0x3ebd('0x6c')])){for(var _0x2e282f=0x0;_0x2e282f<_0x4e2a3f['query'][_0x3ebd('0x6c')][_0x3ebd('0x46')];_0x2e282f+=0x1){socket[_0x3ebd('0x70')]('userWhatsappAccount:remove',{'UserId':Number(_0x4e2a3f[_0x3ebd('0x40')][_0x3ebd('0x6c')][_0x2e282f]),'WhatsappAccountId':Number(_0x4e2a3f[_0x3ebd('0x55')]['id'])});}}else{socket[_0x3ebd('0x70')]('userWhatsappAccount:remove',{'UserId':Number(_0x4e2a3f[_0x3ebd('0x40')][_0x3ebd('0x6c')]),'WhatsappAccountId':Number(_0x4e2a3f[_0x3ebd('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x255713,null))[_0x3ebd('0x53')](handleError(_0x255713,null));};exports[_0x3ebd('0x72')]=function(_0x15c4ad,_0x3ef2be,_0x37fd90){var _0x3009bc={};var _0x33b672={};var _0x5d96b1;var _0x49a16a;return db[_0x3ebd('0x3a')][_0x3ebd('0x65')]({'where':{'id':_0x15c4ad[_0x3ebd('0x55')]['id']}})[_0x3ebd('0x1f')](handleEntityNotFound(_0x3ef2be,null))[_0x3ebd('0x1f')](function(_0x3159f2){if(_0x3159f2){_0x5d96b1=_0x3159f2;_0x33b672['model']=_[_0x3ebd('0x56')](db[_0x3ebd('0x73')][_0x3ebd('0x3b')]);_0x33b672[_0x3ebd('0x40')]=_[_0x3ebd('0x56')](_0x15c4ad['query']);_0x33b672[_0x3ebd('0x41')]=_['intersection'](_0x33b672[_0x3ebd('0x43')],_0x33b672[_0x3ebd('0x40')]);_0x3009bc['attributes']=_[_0x3ebd('0x42')](_0x33b672[_0x3ebd('0x43')],qs['fields'](_0x15c4ad[_0x3ebd('0x40')][_0x3ebd('0x45')]));_0x3009bc[_0x3ebd('0x44')]=_0x3009bc[_0x3ebd('0x44')][_0x3ebd('0x46')]?_0x3009bc[_0x3ebd('0x44')]:_0x33b672['model'];_0x3009bc[_0x3ebd('0x49')]=qs['sort'](_0x15c4ad[_0x3ebd('0x40')][_0x3ebd('0x4a')]);_0x3009bc[_0x3ebd('0x4d')]=qs[_0x3ebd('0x41')](_[_0x3ebd('0x4b')](_0x15c4ad[_0x3ebd('0x40')],_0x33b672['filters']));if(_0x15c4ad[_0x3ebd('0x40')]['filter']){_0x3009bc[_0x3ebd('0x4d')]=_[_0x3ebd('0x4e')](_0x3009bc[_0x3ebd('0x4d')],{'$or':_[_0x3ebd('0x3f')](_0x3009bc[_0x3ebd('0x44')],function(_0x323b92){var _0xc3c0be={};_0xc3c0be[_0x323b92]={'$like':'%'+_0x15c4ad[_0x3ebd('0x40')][_0x3ebd('0x4c')]+'%'};return _0xc3c0be;})});}_0x3009bc=_[_0x3ebd('0x4e')]({},_0x3009bc,_0x15c4ad[_0x3ebd('0x6a')]);return _0x5d96b1[_0x3ebd('0x72')](_0x3009bc);}})[_0x3ebd('0x1f')](function(_0x1319f6){if(_0x1319f6){_0x49a16a=_0x1319f6[_0x3ebd('0x46')];if(!_0x15c4ad[_0x3ebd('0x40')]['hasOwnProperty'](_0x3ebd('0x48'))){_0x3009bc['limit']=qs[_0x3ebd('0x2e')](_0x15c4ad[_0x3ebd('0x40')][_0x3ebd('0x2e')]);_0x3009bc[_0x3ebd('0x2c')]=qs[_0x3ebd('0x2c')](_0x15c4ad[_0x3ebd('0x40')][_0x3ebd('0x2c')]);}return _0x5d96b1[_0x3ebd('0x72')](_0x3009bc);}})[_0x3ebd('0x1f')](function(_0x1e7b79){if(_0x1e7b79){return _0x1e7b79?{'count':_0x49a16a,'rows':_0x1e7b79}:null;}})[_0x3ebd('0x1f')](respondWithResult(_0x3ef2be,null))[_0x3ebd('0x53')](handleError(_0x3ef2be,null));};exports[_0x3ebd('0x74')]=function(_0x27910c,_0x2ed078){var _0xab144b=_0x27910c[_0x3ebd('0x55')]['id'];var _0x103d78=_0x27910c['body'];var _0x359074=0xc8;var _0x24c374=null;return db['sequelize'][_0x3ebd('0x75')]({'isolationLevel':db[_0x3ebd('0x76')][_0x3ebd('0x77')][_0x3ebd('0x78')][_0x3ebd('0x79')]},function(_0x2fc75a){return db[_0x3ebd('0x3a')]['findOne']({'where':{'id':_0xab144b},'transaction':_0x2fc75a})[_0x3ebd('0x1f')](function(_0x458c73){if(_0x458c73){return db[_0x3ebd('0x7a')][_0x3ebd('0x34')]({'where':{'WhatsappAccountId':_0xab144b},'transaction':_0x2fc75a})['then'](function(){var _0x5276b8=_[_0x3ebd('0x3f')](_0x103d78,function(_0x2e27a9){_0x2e27a9[_0x3ebd('0x62')]=_0xab144b;return _0x2e27a9;});return db[_0x3ebd('0x7a')][_0x3ebd('0x7b')](_0x5276b8,{'transaction':_0x2fc75a});});}else{_0x359074=0x194;_0x24c374=[];}});})[_0x3ebd('0x1f')](function(){if(_0x359074!==0x194){return db[_0x3ebd('0x7a')]['findAndCountAll']({'where':{'WhatsappAccountId':_0xab144b},'order':_0x3ebd('0x7c')})[_0x3ebd('0x1f')](function(_0x2068c9){_0x24c374=_0x2068c9;});}})[_0x3ebd('0x53')](function(_0x4a0c50){_0x359074=0x1f4;logger[_0x3ebd('0x24')](_0x4a0c50[_0x3ebd('0x36')]);if(_0x4a0c50[_0x3ebd('0x37')]){delete _0x4a0c50['name'];}_0x24c374=_0x4a0c50;})[_0x3ebd('0x7d')](function(){if(_0x24c374===null){_0x2ed078[_0x3ebd('0x28')](_0x359074);}else{if(_0x359074===0x1f4){_0x2ed078[_0x3ebd('0x29')](_0x359074)[_0x3ebd('0x38')](_0x24c374);}else{_0x2ed078[_0x3ebd('0x29')](_0x359074)['json'](_0x24c374);}}});};exports[_0x3ebd('0x7e')]=function(_0x115c4d,_0x391140,_0x299771){var _0x1cd22d={};var _0x24d7b8={};var _0x325e42;var _0x3f093e;return db['WhatsappAccount'][_0x3ebd('0x65')]({'where':{'id':_0x115c4d[_0x3ebd('0x55')]['id']}})[_0x3ebd('0x1f')](handleEntityNotFound(_0x391140,null))[_0x3ebd('0x1f')](function(_0x272042){if(_0x272042){_0x325e42=_0x272042;_0x24d7b8['model']=_['keys'](db[_0x3ebd('0x7a')][_0x3ebd('0x3b')]);_0x24d7b8[_0x3ebd('0x40')]=_[_0x3ebd('0x56')](_0x115c4d[_0x3ebd('0x40')]);_0x24d7b8[_0x3ebd('0x41')]=_[_0x3ebd('0x42')](_0x24d7b8[_0x3ebd('0x43')],_0x24d7b8[_0x3ebd('0x40')]);_0x1cd22d['attributes']=_[_0x3ebd('0x42')](_0x24d7b8[_0x3ebd('0x43')],qs['fields'](_0x115c4d[_0x3ebd('0x40')]['fields']));_0x1cd22d[_0x3ebd('0x44')]=_0x1cd22d['attributes']['length']?_0x1cd22d['attributes']:_0x24d7b8[_0x3ebd('0x43')];_0x1cd22d[_0x3ebd('0x49')]=qs[_0x3ebd('0x4a')](_0x115c4d[_0x3ebd('0x40')]['sort']);_0x1cd22d['where']=qs[_0x3ebd('0x41')](_[_0x3ebd('0x4b')](_0x115c4d[_0x3ebd('0x40')],_0x24d7b8['filters']));if(_0x115c4d[_0x3ebd('0x40')][_0x3ebd('0x4c')]){_0x1cd22d[_0x3ebd('0x4d')]=_[_0x3ebd('0x4e')](_0x1cd22d[_0x3ebd('0x4d')],{'$or':_[_0x3ebd('0x3f')](_0x1cd22d[_0x3ebd('0x44')],function(_0x40e3e0){var _0x3a509b={};_0x3a509b[_0x40e3e0]={'$like':'%'+_0x115c4d[_0x3ebd('0x40')][_0x3ebd('0x4c')]+'%'};return _0x3a509b;})});}_0x1cd22d=_[_0x3ebd('0x4e')]({},_0x1cd22d,_0x115c4d[_0x3ebd('0x6a')]);return _0x325e42[_0x3ebd('0x7e')](_0x1cd22d);}})[_0x3ebd('0x1f')](function(_0x264aef){if(_0x264aef){_0x3f093e=_0x264aef['length'];if(!_0x115c4d[_0x3ebd('0x40')]['hasOwnProperty'](_0x3ebd('0x48'))){_0x1cd22d[_0x3ebd('0x2e')]=qs[_0x3ebd('0x2e')](_0x115c4d[_0x3ebd('0x40')][_0x3ebd('0x2e')]);_0x1cd22d[_0x3ebd('0x2c')]=qs['offset'](_0x115c4d[_0x3ebd('0x40')][_0x3ebd('0x2c')]);}return _0x325e42[_0x3ebd('0x7e')](_0x1cd22d);}})[_0x3ebd('0x1f')](function(_0x11b557){if(_0x11b557){return _0x11b557?{'count':_0x3f093e,'rows':_0x11b557}:null;}})[_0x3ebd('0x1f')](respondWithResult(_0x391140,null))['catch'](handleError(_0x391140,null));};exports['notify']=function(_0x567fff,_0x4fee03,_0x56c283){var _0x15c27b={'channel':'whatsapp'};var _0x46ae06=[];var _0x4d7469=[];var _0x323128={};return db[_0x3ebd('0x3a')][_0x3ebd('0x57')]({'where':{'id':_0x567fff[_0x3ebd('0x55')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x3ebd('0x7f')}]})[_0x3ebd('0x1f')](handleEntityNotFound(_0x4fee03,null))[_0x3ebd('0x1f')](function(_0x5bd9ce){_0x15c27b[_0x3ebd('0x80')]=_0x5bd9ce;if(_0x15c27b[_0x3ebd('0x80')]&&_0x15c27b[_0x3ebd('0x80')][_0x3ebd('0x3d')]===_0x3ebd('0x81')&&_0x567fff[_0x3ebd('0x59')][_0x3ebd('0x82')]){if(_0x567fff[_0x3ebd('0x59')][_0x3ebd('0x82')][_0x3ebd('0x46')]===0x0)return;if(_0x567fff[_0x3ebd('0x59')][_0x3ebd('0x82')][0x0][_0x3ebd('0x83')]!==_0x3ebd('0x84'))return;return db[_0x3ebd('0x85')][_0x3ebd('0x33')]({'read':!![],'readAt':_0x567fff[_0x3ebd('0x59')][_0x3ebd('0x82')][0x0][_0x3ebd('0x86')]},{'where':{'messageId':_0x567fff['body'][_0x3ebd('0x82')][0x0]['message_id']},'individualHooks':!![]})[_0x3ebd('0x1f')](function(_0x2e056b){return _0x4fee03['status'](0xc8)[_0x3ebd('0x2b')](_0x2e056b);});}_0x15c27b[_0x3ebd('0x87')]=_[_0x3ebd('0x88')](_0x5bd9ce[_0x3ebd('0x7f')],[_0x3ebd('0x7c')],[_0x3ebd('0x89')]);if(_0x15c27b[_0x3ebd('0x80')]['Applications']){delete _0x15c27b[_0x3ebd('0x80')][_0x3ebd('0x7f')];}return db[_0x3ebd('0x8a')][_0x3ebd('0x60')]()[_0x3ebd('0x1f')](function(_0x50cd05){if(!_0x50cd05){throw new db[(_0x3ebd('0x8b'))][(_0x3ebd('0x8c'))](_0x3ebd('0x8d'));}_0x46ae06=_[_0x3ebd('0x8e')](_['keys'](_0x50cd05),[_0x3ebd('0x8f'),_0x3ebd('0x90')]);_0x4d7469=_['difference'](_[_0x3ebd('0x56')](_0x50cd05),[_0x3ebd('0x8f'),_0x3ebd('0x90'),'CompanyId','ListId']);_0x15c27b['body']={'mapKey':_0x3ebd('0x91')};if(_0x15c27b['account']&&_0x15c27b[_0x3ebd('0x80')][_0x3ebd('0x3d')]===_0x3ebd('0x92')){_0x15c27b[_0x3ebd('0x59')]['from']=_0x567fff[_0x3ebd('0x59')][_0x3ebd('0x93')][_0x3ebd('0x94')](_0x3ebd('0x95'),'');_0x15c27b[_0x3ebd('0x59')][_0x3ebd('0x59')]=_0x567fff[_0x3ebd('0x59')][_0x3ebd('0x96')];_0x15c27b[_0x3ebd('0x59')]['messageId']=_0x567fff['body'][_0x3ebd('0x97')];}if(_0x15c27b[_0x3ebd('0x80')]&&_0x15c27b[_0x3ebd('0x80')][_0x3ebd('0x3d')]===_0x3ebd('0x81')){_0x15c27b['body'][_0x3ebd('0x98')]=_0x567fff[_0x3ebd('0x59')][_0x3ebd('0x99')][0x0][_0x3ebd('0x98')];_0x15c27b[_0x3ebd('0x59')][_0x3ebd('0x59')]=_0x567fff['body'][_0x3ebd('0x99')][0x0][_0x3ebd('0x25')][_0x3ebd('0x59')];_0x15c27b[_0x3ebd('0x59')][_0x3ebd('0x9a')]=_0x567fff[_0x3ebd('0x59')][_0x3ebd('0x99')][0x0]['message_id'];}if(_0x15c27b['body']['id']){delete _0x15c27b['body']['id'];}if(_[_0x3ebd('0x9b')](_0x15c27b[_0x3ebd('0x59')][_0x3ebd('0x98')])){throw new db[(_0x3ebd('0x8b'))][(_0x3ebd('0x8c'))](_0x3ebd('0x9c'));}if(_['isNil'](_0x15c27b[_0x3ebd('0x59')]['body'])||_0x15c27b[_0x3ebd('0x59')]['body']===''){throw new db[(_0x3ebd('0x8b'))][(_0x3ebd('0x8c'))](_0x3ebd('0x9d'));}if(_[_0x3ebd('0x9b')](_0x15c27b[_0x3ebd('0x59')]['mapKey'])){throw new db[(_0x3ebd('0x8b'))][(_0x3ebd('0x8c'))](_0x3ebd('0x9e')+_0x4d7469);}if(!_['includes'](_0x4d7469,_0x15c27b[_0x3ebd('0x59')][_0x3ebd('0x9f')])){throw new db[(_0x3ebd('0x8b'))][(_0x3ebd('0x8c'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4d7469);}_0x323128[_0x15c27b[_0x3ebd('0x59')][_0x3ebd('0x9f')]]=_0x15c27b[_0x3ebd('0x59')]['from'];return db[_0x3ebd('0xa0')][_0x3ebd('0x57')]({'where':{'id':_0x15c27b[_0x3ebd('0x80')][_0x3ebd('0xa1')]},'include':[{'model':db[_0x3ebd('0x8a')],'as':_0x3ebd('0xa2'),'where':_0x323128,'limit':0x1,'order':[[_0x3ebd('0x90'),_0x3ebd('0xa3')]]}]});})[_0x3ebd('0x1f')](handleEntityNotFound(_0x4fee03,null))[_0x3ebd('0x1f')](function(_0x26e4ff){if(_0x26e4ff){_0x15c27b[_0x3ebd('0xa4')]=_[_0x3ebd('0x6e')](_0x26e4ff,[_0x3ebd('0xa2')]);if(_0x26e4ff[_0x3ebd('0xa2')][_0x3ebd('0x46')]){return _0x26e4ff[_0x3ebd('0xa2')][0x0];}var _0x139de9=_[_0x3ebd('0x18')](_0x15c27b[_0x3ebd('0x59')],{'firstName':_0x15c27b['body'][_0x3ebd('0x98')],'ListId':_0x26e4ff['id']});_0x139de9[_0x15c27b['body'][_0x3ebd('0x9f')]]=_0x15c27b['body']['from'];return db['CmContact']['create'](_0x139de9,{'fields':_0x46ae06,'raw':!![]});}})['then'](handleEntityNotFound(_0x4fee03,null))[_0x3ebd('0x1f')](function(_0x45c510){if(_0x45c510){_0x15c27b[_0x3ebd('0xa5')]=_0x45c510;var _0x5a0c9c={'ContactId':_0x45c510['id'],'phone':_0x15c27b[_0x3ebd('0x59')][_0x3ebd('0x98')],'WhatsappAccountId':_0x567fff[_0x3ebd('0x55')]['id']};var _0x2cb838={'ContactId':_0x45c510['id'],'WhatsappAccountId':_0x567fff[_0x3ebd('0x55')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x3ebd('0x57')]({'where':_0x2cb838})[_0x3ebd('0x1f')](function(_0x563399){if(_0x563399){return[_0x563399,![]];}return db['WhatsappInteraction'][_0x3ebd('0x58')](_0x5a0c9c)[_0x3ebd('0x1f')](function(_0xe156fe){return[_0xe156fe,!![]];});});}})['spread'](function(_0x431a40,_0x1e196c){_0x15c27b[_0x3ebd('0xa6')]=_0x431a40[_0x3ebd('0x5a')]({'plain':!![]});_0x15c27b['interaction']['created']=![];if(_0x1e196c){if(_0x15c27b[_0x3ebd('0x80')][_0x3ebd('0xa7')]){_0x15c27b['applications'][_0x3ebd('0xa8')]({'id':0x0,'priority':_0x15c27b['applications'][_0x3ebd('0x46')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}_0x15c27b[_0x3ebd('0xa6')][_0x3ebd('0xa9')]=!![];}return db[_0x3ebd('0x85')][_0x3ebd('0x58')]({'phone':_0x15c27b[_0x3ebd('0x59')]['from'],'messageId':_0x15c27b[_0x3ebd('0x59')][_0x3ebd('0x9a')],'body':_0x15c27b[_0x3ebd('0x59')][_0x3ebd('0x59')],'WhatsappAccountId':_0x567fff[_0x3ebd('0x55')]['id'],'WhatsappInteractionId':_0x431a40['id'],'direction':'in','ContactId':_0x431a40[_0x3ebd('0xaa')],'AttachmentId':_0x15c27b[_0x3ebd('0x59')][_0x3ebd('0xab')]});})[_0x3ebd('0x1f')](function(_0x47e17e){_0x15c27b[_0x3ebd('0x25')]=_0x47e17e;if(!_0x15c27b[_0x3ebd('0xa6')][_0x3ebd('0xac')])return;return db[_0x3ebd('0x73')][_0x3ebd('0x57')]({'attributes':['id',_0x3ebd('0x37')],'where':{'id':_0x15c27b[_0x3ebd('0xa6')][_0x3ebd('0xac')]}});})[_0x3ebd('0x1f')](function(_0xa7b12f){if(_0xa7b12f){_0x15c27b['applications'][_0x3ebd('0xad')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xa7b12f[_0x3ebd('0x37')]+','+(_0x15c27b[_0x3ebd('0x80')]['waitForTheAssignedAgent']||0xa),'interval':_0x3ebd('0xae')});}if(!_0x15c27b[_0x3ebd('0xa6')][_0x3ebd('0xaf')])return;return db[_0x3ebd('0xb0')][_0x3ebd('0x57')]({'attributes':['id',_0x3ebd('0x37')],'where':{'id':_0x15c27b[_0x3ebd('0xa6')]['queueId']}});})[_0x3ebd('0x1f')](function(_0x3b15d3){if(_0x3b15d3){_0x15c27b[_0x3ebd('0x87')][_0x3ebd('0xad')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x3b15d3['name']+','+(_0x15c27b[_0x3ebd('0x80')][_0x3ebd('0xb1')]||0x12c),'interval':_0x3ebd('0xae')});}return respondWithRpcPromise(_0x3ebd('0xb2'),_0x3ebd('0xb3'),_0x15c27b);})[_0x3ebd('0x1f')](function(_0xc43cce){if(_0xc43cce){var _0x3ac31c=0xc8;var _0x25e440=_0x3ebd('0xb4');logger[_0x3ebd('0x20')](_0x3ebd('0x21'),_0x25e440,_0x3ac31c,'entity\x20found');logger['debug'](_0x3ebd('0xb5'),_0x25e440,_0x3ac31c,_0x3ebd('0xb6'),JSON[_0x3ebd('0x22')](_0xc43cce));if(_0x15c27b[_0x3ebd('0x80')][_0x3ebd('0x3d')]==='twilio'){return _0x4fee03['status'](_0x3ac31c)[_0x3ebd('0xb7')](_0x3ebd('0xb8'),'text/xml')[_0x3ebd('0x38')](_0x3ebd('0xb9'));}else{return _0x4fee03[_0x3ebd('0x29')](_0x3ac31c)[_0x3ebd('0x2b')](_0xc43cce);}}});})['catch'](handleError(_0x4fee03,null));};exports[_0x3ebd('0x38')]=function(_0x203411,_0x42cfec,_0x24aac2){var _0x4ec4a1,_0xd5b9e6,_0x10f713;if(_[_0x3ebd('0x9b')](_0x203411['body'][_0x3ebd('0x59')])||_0x203411[_0x3ebd('0x59')]['body']===''){throw new db[(_0x3ebd('0x8b'))][(_0x3ebd('0x8c'))](_0x3ebd('0x9d'));}if(_[_0x3ebd('0x9b')](_0x203411['body']['to'])){throw new db['Sequelize'][(_0x3ebd('0x8c'))](_0x3ebd('0xba'));}_0x4ec4a1=_0x203411[_0x3ebd('0x59')]['to'];return db['WhatsappAccount'][_0x3ebd('0x57')]({'where':{'id':_0x203411['params']['id']},'include':[{'model':db[_0x3ebd('0xa0')],'as':'List','include':[{'model':db[_0x3ebd('0x8a')],'as':_0x3ebd('0xa2'),'where':{'mobile':_0x4ec4a1},'limit':0x1,'order':[[_0x3ebd('0x90'),_0x3ebd('0xa3')]]}]}]})['then'](handleEntityNotFound(_0x42cfec,null))[_0x3ebd('0x1f')](function(_0x5ad3ac){if(_0x5ad3ac&&_0x5ad3ac[_0x3ebd('0xbb')]){_0xd5b9e6=_0x5ad3ac[_0x3ebd('0x5a')]({'plain':!![]});if(_0xd5b9e6['List']&&_0xd5b9e6['List'][_0x3ebd('0xa2')]['length']){return _0xd5b9e6['List']['Contacts'][0x0];}return db[_0x3ebd('0x8a')][_0x3ebd('0x58')](_['defaults'](_0x203411[_0x3ebd('0x59')],{'firstName':_0x4ec4a1,'mobile':_0x4ec4a1,'phone':_0x4ec4a1,'ListId':_0xd5b9e6[_0x3ebd('0xa1')]}));}})[_0x3ebd('0x1f')](handleEntityNotFound(_0x42cfec,null))[_0x3ebd('0x1f')](function(_0x4f267d){if(_0x4f267d){_0x10f713=_0x4f267d;return db[_0x3ebd('0xbc')][_0x3ebd('0x57')]({'where':{'ContactId':_0x10f713['id'],'closed':![],'WhatsappAccountId':_0xd5b9e6['id']}})[_0x3ebd('0x1f')](function(_0x2ce56c){if(_0x2ce56c){return[_0x2ce56c,![]];}return db[_0x3ebd('0xbc')][_0x3ebd('0x58')]({'UserId':_0x203411['user']['id'],'ContactId':_0x10f713['id'],'WhatsappAccountId':_0xd5b9e6['id'],'phone':_0x4ec4a1,'firstMsgDirection':_0x3ebd('0xbd'),'Messages':[_[_0x3ebd('0x4e')](_0x203411[_0x3ebd('0x59')],{'read':![],'body':_0x203411[_0x3ebd('0x59')][_0x3ebd('0x59')],'phone':_0x4ec4a1,'WhatsappAccountId':_0xd5b9e6['id'],'UserId':_0x203411[_0x3ebd('0xbe')]['id'],'ContactId':_0x10f713['id']})]},{'include':[{'model':db[_0x3ebd('0x85')],'as':_0x3ebd('0xbf')}]})[_0x3ebd('0x1f')](function(_0x1a2c91){return[_0x1a2c91,!![]];});});}})[_0x3ebd('0x6f')](function(_0x3b7d01,_0x11ad44){if(_0x11ad44){return _0x3b7d01;}return db[_0x3ebd('0x85')][_0x3ebd('0x58')](_[_0x3ebd('0x4e')](_0x203411[_0x3ebd('0x59')],{'read':![],'body':_0x203411[_0x3ebd('0x59')]['body'],'phone':_0x4ec4a1,'WhatsappAccountId':_0xd5b9e6['id'],'WhatsappInteractionId':_0x3b7d01['id'],'UserId':_0x203411['user']['id'],'ContactId':_0x10f713['id']}))['then'](function(_0x3ff48f){_0x3b7d01[_0x3ebd('0xc0')][_0x3ebd('0xbf')]=[];_0x3b7d01[_0x3ebd('0xc0')][_0x3ebd('0xbf')]['push'](_0x3ff48f[_0x3ebd('0xc0')]);return _0x3b7d01;});})[_0x3ebd('0x1f')](respondWithResult(_0x42cfec,null))['catch'](handleError(_0x42cfec,null));}; \ No newline at end of file +var _0xc7d5=['rawAttributes','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','nolimit','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','transaction','sequelize','Transaction','ISOLATION_LEVELS','WhatsappApplication','findAndCountAll','priority','finally','send','getApplications','notify','whatsapp','Applications','account','statuses','state','read','WhatsappMessage','timestamp','applications','orderBy','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','From','messageId','MessageSid','notifications','message_id','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','ListId','CmContact','Contacts','DESC','omit','contact','WhatsappInteraction','autoclose','push','close','unmanaged','*,*,*,*','created','ContactId','interaction','UserId','unshift','agent','queueId','queue','Start','startRouting','receiveMessage','info','entity\x20found','stringify','Content-Type','text/xml','\x0a','List','user','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','request','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','get','WhatsappAccounts','UserProfileResource','end','stack','name','index','Pause','mandatoryDispositionPause','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','WhatsappAccount','includeAll','include','rows','show','params','keys'];(function(_0x25fc41,_0x250864){var _0x1371d1=function(_0x8ab2e3){while(--_0x8ab2e3){_0x25fc41['push'](_0x25fc41['shift']());}};_0x1371d1(++_0x250864);}(_0xc7d5,0x6b));var _0x5c7d=function(_0x59bdf1,_0x4e41af){_0x59bdf1=_0x59bdf1-0x0;var _0x8f49=_0xc7d5[_0x59bdf1];return _0x8f49;};'use strict';var emlformat=require(_0x5c7d('0x0'));var rimraf=require(_0x5c7d('0x1'));var zipdir=require(_0x5c7d('0x2'));var jsonpatch=require(_0x5c7d('0x3'));var rp=require(_0x5c7d('0x4'));var moment=require(_0x5c7d('0x5'));var BPromise=require(_0x5c7d('0x6'));var Mustache=require('mustache');var util=require(_0x5c7d('0x7'));var path=require(_0x5c7d('0x8'));var sox=require(_0x5c7d('0x9'));var csv=require(_0x5c7d('0xa'));var ejs=require(_0x5c7d('0xb'));var fs=require('fs');var fs_extra=require(_0x5c7d('0xc'));var _=require(_0x5c7d('0xd'));var squel=require(_0x5c7d('0xe'));var crypto=require(_0x5c7d('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x5c7d('0x10'));var toCsv=require('to-csv');var querystring=require(_0x5c7d('0x11'));var Papa=require(_0x5c7d('0x12'));var Redis=require(_0x5c7d('0x13'));var authService=require(_0x5c7d('0x14'));var qs=require(_0x5c7d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c7d('0x16'));var logger=require(_0x5c7d('0x17'))('api');var utils=require(_0x5c7d('0x18'));var config=require(_0x5c7d('0x19'));var licenseUtil=require(_0x5c7d('0x1a'));var db=require(_0x5c7d('0x1b'))['db'];config[_0x5c7d('0x1c')]=_[_0x5c7d('0x1d')](config[_0x5c7d('0x1c')],{'host':_0x5c7d('0x1e'),'port':0x18eb});var socket=require(_0x5c7d('0x1f'))(new Redis(config[_0x5c7d('0x1c')]));require(_0x5c7d('0x20'))[_0x5c7d('0x21')](socket);var jayson=require(_0x5c7d('0x22'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x1deffa,_0x382ffb,_0x406154,_0x3052a7){return new BPromise(function(_0x662a7e,_0x5911f7){var _0xe6a845=_0x3052a7||client;return _0xe6a845[_0x5c7d('0x23')](_0x1deffa,_0x406154)['then'](function(_0x19c8b0){logger['info'](_0x5c7d('0x24'),_0x382ffb,'request\x20sent');logger[_0x5c7d('0x25')](_0x5c7d('0x26'),_0x382ffb,_0x5c7d('0x27'),JSON['stringify'](_0x19c8b0));if(_0x19c8b0[_0x5c7d('0x28')]){if(_0x19c8b0[_0x5c7d('0x28')][_0x5c7d('0x29')]===0x1f4){logger['error'](_0x5c7d('0x24'),_0x382ffb,_0x19c8b0[_0x5c7d('0x28')][_0x5c7d('0x2a')]);return _0x5911f7(_0x19c8b0[_0x5c7d('0x28')]['message']);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x382ffb,_0x19c8b0[_0x5c7d('0x28')][_0x5c7d('0x2a')]);return _0x662a7e(_0x19c8b0[_0x5c7d('0x28')]['message']);}else{logger['info'](_0x5c7d('0x24'),_0x382ffb,_0x5c7d('0x27'));_0x662a7e(_0x19c8b0[_0x5c7d('0x2b')][_0x5c7d('0x2a')]);}})[_0x5c7d('0x2c')](function(_0x312a07){logger['error'](_0x5c7d('0x24'),_0x382ffb,_0x312a07);_0x5911f7(_0x312a07);});});}function respondWithStatusCode(_0x15f4ff,_0x1355ee){_0x1355ee=_0x1355ee||0xcc;return function(_0xc8cd58){if(_0xc8cd58){return _0x15f4ff['sendStatus'](_0x1355ee);}return _0x15f4ff[_0x5c7d('0x2d')](_0x1355ee)['end']();};}function respondWithResult(_0x4a62e5,_0x23d19f){_0x23d19f=_0x23d19f||0xc8;return function(_0x4a9b27){if(_0x4a9b27){return _0x4a62e5[_0x5c7d('0x2d')](_0x23d19f)['json'](_0x4a9b27);}};}function respondWithFilteredResult(_0x4c5bdf,_0x5828ae){return function(_0x307480){if(_0x307480){var _0x4b85bd=typeof _0x5828ae[_0x5c7d('0x2e')]===_0x5c7d('0x2f')&&typeof _0x5828ae[_0x5c7d('0x30')]===_0x5c7d('0x2f');var _0x56e90a=_0x307480[_0x5c7d('0x31')];var _0x30d733=_0x4b85bd?0x0:_0x5828ae[_0x5c7d('0x2e')];var _0x372d83=_0x4b85bd?_0x307480[_0x5c7d('0x31')]:_0x5828ae[_0x5c7d('0x2e')]+_0x5828ae['limit'];var _0x4e24ad;if(_0x372d83>=_0x56e90a){_0x372d83=_0x56e90a;_0x4e24ad=0xc8;}else{_0x4e24ad=0xce;}_0x4c5bdf[_0x5c7d('0x2d')](_0x4e24ad);return _0x4c5bdf[_0x5c7d('0x32')](_0x5c7d('0x33'),_0x30d733+'-'+_0x372d83+'/'+_0x56e90a)[_0x5c7d('0x34')](_0x307480);}return null;};}function patchUpdates(_0x3278c8){return function(_0x59aa6f){try{jsonpatch[_0x5c7d('0x35')](_0x59aa6f,_0x3278c8,!![]);}catch(_0x44357e){return BPromise['reject'](_0x44357e);}return _0x59aa6f[_0x5c7d('0x36')]();};}function saveUpdates(_0x4701ed,_0x537323){return function(_0x442a03){if(_0x442a03){return _0x442a03['update'](_0x4701ed)[_0x5c7d('0x37')](function(_0x2aaa4d){return _0x2aaa4d;});}return null;};}function removeEntity(_0x32964d,_0x18a20e){return function(_0x42b816){if(_0x42b816){return _0x42b816[_0x5c7d('0x38')]()[_0x5c7d('0x37')](function(){var _0x5a8968=_0x42b816[_0x5c7d('0x39')]({'plain':!![]});var _0x330963=_0x5c7d('0x3a');return db[_0x5c7d('0x3b')]['destroy']({'where':{'type':_0x330963,'resourceId':_0x5a8968['id']}})['then'](function(){return _0x42b816;});})[_0x5c7d('0x37')](function(){_0x32964d[_0x5c7d('0x2d')](0xcc)[_0x5c7d('0x3c')]();});}};}function handleEntityNotFound(_0x4a3e69,_0x530793){return function(_0x379f94){if(!_0x379f94){_0x4a3e69['sendStatus'](0x194);}return _0x379f94;};}function handleError(_0x6f571b,_0x10de4d){_0x10de4d=_0x10de4d||0x1f4;return function(_0x3f6cdb){logger[_0x5c7d('0x28')](_0x3f6cdb[_0x5c7d('0x3d')]);if(_0x3f6cdb[_0x5c7d('0x3e')]){delete _0x3f6cdb[_0x5c7d('0x3e')];}_0x6f571b[_0x5c7d('0x2d')](_0x10de4d)['send'](_0x3f6cdb);};}exports[_0x5c7d('0x3f')]=function(_0x3719f5,_0x28f859){var _0x4e7b02={'include':[{'model':db[_0x5c7d('0x40')],'as':_0x5c7d('0x41')}]},_0x4881e6={},_0x2fc98a={'count':0x0,'rows':[]};var _0x5b0ac2=_[_0x5c7d('0x42')](db['WhatsappAccount']['rawAttributes'],function(_0x11236a){return{'name':_0x11236a[_0x5c7d('0x43')],'type':_0x11236a[_0x5c7d('0x44')][_0x5c7d('0x45')]};});_0x4881e6[_0x5c7d('0x46')]=_[_0x5c7d('0x42')](_0x5b0ac2,'name');_0x4881e6[_0x5c7d('0x47')]=_['keys'](_0x3719f5[_0x5c7d('0x47')]);_0x4881e6[_0x5c7d('0x48')]=_[_0x5c7d('0x49')](_0x4881e6['model'],_0x4881e6[_0x5c7d('0x47')]);_0x4e7b02[_0x5c7d('0x4a')]=_[_0x5c7d('0x49')](_0x4881e6[_0x5c7d('0x46')],qs[_0x5c7d('0x4b')](_0x3719f5[_0x5c7d('0x47')][_0x5c7d('0x4b')]));_0x4e7b02[_0x5c7d('0x4a')]=_0x4e7b02[_0x5c7d('0x4a')][_0x5c7d('0x4c')]?_0x4e7b02['attributes']:_0x4881e6[_0x5c7d('0x46')];if(!_0x3719f5['query'][_0x5c7d('0x4d')]('nolimit')){_0x4e7b02['limit']=qs[_0x5c7d('0x30')](_0x3719f5[_0x5c7d('0x47')]['limit']);_0x4e7b02[_0x5c7d('0x2e')]=qs[_0x5c7d('0x2e')](_0x3719f5[_0x5c7d('0x47')]['offset']);}_0x4e7b02[_0x5c7d('0x4e')]=qs['sort'](_0x3719f5[_0x5c7d('0x47')][_0x5c7d('0x4f')]);_0x4e7b02[_0x5c7d('0x50')]=qs[_0x5c7d('0x48')](_[_0x5c7d('0x51')](_0x3719f5[_0x5c7d('0x47')],_0x4881e6[_0x5c7d('0x48')]),_0x5b0ac2);if(_0x3719f5[_0x5c7d('0x47')][_0x5c7d('0x52')]){_0x4e7b02[_0x5c7d('0x50')]=_[_0x5c7d('0x53')](_0x4e7b02['where'],{'$or':_[_0x5c7d('0x42')](_0x5b0ac2,function(_0x49e241){if(_0x49e241[_0x5c7d('0x44')]!=='VIRTUAL'){var _0x4d3a46={};_0x4d3a46[_0x49e241[_0x5c7d('0x3e')]]={'$like':'%'+_0x3719f5[_0x5c7d('0x47')]['filter']+'%'};return _0x4d3a46;}})});}_0x4e7b02=_[_0x5c7d('0x53')]({},_0x4e7b02,_0x3719f5[_0x5c7d('0x54')]);var _0x5526d2={'where':_0x4e7b02[_0x5c7d('0x50')]};return db[_0x5c7d('0x55')][_0x5c7d('0x31')](_0x5526d2)[_0x5c7d('0x37')](function(_0x1961aa){_0x2fc98a[_0x5c7d('0x31')]=_0x1961aa;if(_0x3719f5['query'][_0x5c7d('0x56')]){_0x4e7b02[_0x5c7d('0x57')]=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x4e7b02);})[_0x5c7d('0x37')](function(_0x4b2710){_0x2fc98a[_0x5c7d('0x58')]=_0x4b2710;return _0x2fc98a;})[_0x5c7d('0x37')](respondWithFilteredResult(_0x28f859,_0x4e7b02))[_0x5c7d('0x2c')](handleError(_0x28f859,null));};exports[_0x5c7d('0x59')]=function(_0x503325,_0x3b19ed){var _0x5b1207={'raw':![],'where':{'id':_0x503325[_0x5c7d('0x5a')]['id']},'include':[{'model':db[_0x5c7d('0x40')],'as':_0x5c7d('0x41')}]},_0x28f687={};_0x28f687[_0x5c7d('0x46')]=_[_0x5c7d('0x5b')](db[_0x5c7d('0x55')][_0x5c7d('0x5c')]);_0x28f687[_0x5c7d('0x47')]=_['keys'](_0x503325['query']);_0x28f687[_0x5c7d('0x48')]=_['intersection'](_0x28f687[_0x5c7d('0x46')],_0x28f687['query']);_0x5b1207[_0x5c7d('0x4a')]=_[_0x5c7d('0x49')](_0x28f687[_0x5c7d('0x46')],qs['fields'](_0x503325[_0x5c7d('0x47')]['fields']));_0x5b1207[_0x5c7d('0x4a')]=_0x5b1207[_0x5c7d('0x4a')][_0x5c7d('0x4c')]?_0x5b1207[_0x5c7d('0x4a')]:_0x28f687[_0x5c7d('0x46')];if(_0x503325[_0x5c7d('0x47')][_0x5c7d('0x56')]){_0x5b1207['include']=[{'all':!![]}];}_0x5b1207=_['merge']({},_0x5b1207,_0x503325[_0x5c7d('0x54')]);return db['WhatsappAccount'][_0x5c7d('0x5d')](_0x5b1207)[_0x5c7d('0x37')](handleEntityNotFound(_0x3b19ed,null))['then'](respondWithResult(_0x3b19ed,null))[_0x5c7d('0x2c')](handleError(_0x3b19ed,null));};exports[_0x5c7d('0x5e')]=function(_0x211220,_0x25d653){return db[_0x5c7d('0x55')][_0x5c7d('0x5e')](_0x211220['body'],{})[_0x5c7d('0x37')](function(_0x40924d){var _0x502949=_0x211220['user'][_0x5c7d('0x39')]({'plain':!![]});if(!_0x502949)throw new Error(_0x5c7d('0x5f'));if(_0x502949['role']==='user'){var _0x2bbd1d=_0x40924d[_0x5c7d('0x39')]({'plain':!![]});var _0x4e2657=_0x5c7d('0x3a');return db['UserProfileSection'][_0x5c7d('0x5d')]({'where':{'name':_0x4e2657,'userProfileId':_0x502949['userProfileId']},'raw':!![]})[_0x5c7d('0x37')](function(_0x5038f3){if(_0x5038f3&&_0x5038f3['autoAssociation']===0x0){return db[_0x5c7d('0x3b')]['create']({'name':_0x2bbd1d[_0x5c7d('0x3e')],'resourceId':_0x2bbd1d['id'],'type':_0x5038f3['name'],'sectionId':_0x5038f3['id']},{})[_0x5c7d('0x37')](function(){return _0x40924d;});}else{return _0x40924d;}})[_0x5c7d('0x2c')](function(_0x5703d0){logger[_0x5c7d('0x28')](_0x5c7d('0x60'),_0x5703d0);throw _0x5703d0;});}return _0x40924d;})['then'](respondWithResult(_0x25d653,0xc9))['catch'](handleError(_0x25d653,null));};exports[_0x5c7d('0x61')]=function(_0x2daca5,_0x130d8f){if(_0x2daca5[_0x5c7d('0x62')]['id']){delete _0x2daca5[_0x5c7d('0x62')]['id'];}return db[_0x5c7d('0x55')]['find']({'where':{'id':_0x2daca5[_0x5c7d('0x5a')]['id']},'include':[{'model':db[_0x5c7d('0x40')],'as':_0x5c7d('0x41')}]})[_0x5c7d('0x37')](handleEntityNotFound(_0x130d8f,null))['then'](saveUpdates(_0x2daca5[_0x5c7d('0x62')],null))[_0x5c7d('0x37')](respondWithResult(_0x130d8f,null))[_0x5c7d('0x2c')](handleError(_0x130d8f,null));};exports[_0x5c7d('0x38')]=function(_0x5389e0,_0xbf28a3){return db[_0x5c7d('0x55')]['find']({'where':{'id':_0x5389e0[_0x5c7d('0x5a')]['id']}})[_0x5c7d('0x37')](handleEntityNotFound(_0xbf28a3,null))[_0x5c7d('0x37')](removeEntity(_0xbf28a3,null))[_0x5c7d('0x2c')](handleError(_0xbf28a3,null));};exports[_0x5c7d('0x63')]=function(_0x3bf654,_0x46ed3a){return db[_0x5c7d('0x55')][_0x5c7d('0x63')]()[_0x5c7d('0x37')](respondWithResult(_0x46ed3a,null))[_0x5c7d('0x2c')](handleError(_0x46ed3a,null));};exports[_0x5c7d('0x64')]=function(_0x51bf49,_0x424e40,_0x10f74e){if(_0x51bf49[_0x5c7d('0x62')]['id']){delete _0x51bf49['body']['id'];}return db[_0x5c7d('0x55')]['find']({'where':{'id':_0x51bf49[_0x5c7d('0x5a')]['id']}})[_0x5c7d('0x37')](handleEntityNotFound(_0x424e40,null))[_0x5c7d('0x37')](function(_0x76ea89){if(_0x76ea89){_0x51bf49[_0x5c7d('0x62')][_0x5c7d('0x65')]=_0x76ea89['id'];return db[_0x5c7d('0x66')]['create'](_0x51bf49[_0x5c7d('0x62')]);}})[_0x5c7d('0x37')](respondWithResult(_0x424e40,null))[_0x5c7d('0x2c')](handleError(_0x424e40,null));};exports[_0x5c7d('0x67')]=function(_0x3b95da,_0x629345,_0x9f2ac1){var _0x1c3c25={'raw':![],'where':{}};var _0x51858e={};var _0xf0ddfc={'count':0x0,'rows':[]};return db[_0x5c7d('0x55')][_0x5c7d('0x68')]({'where':{'id':_0x3b95da[_0x5c7d('0x5a')]['id']}})[_0x5c7d('0x37')](handleEntityNotFound(_0x629345,null))[_0x5c7d('0x37')](function(_0x40fcd5){if(_0x40fcd5){_0x51858e[_0x5c7d('0x46')]=_[_0x5c7d('0x5b')](db[_0x5c7d('0x66')][_0x5c7d('0x5c')]);_0x51858e[_0x5c7d('0x47')]=_[_0x5c7d('0x5b')](_0x3b95da['query']);_0x51858e[_0x5c7d('0x48')]=_[_0x5c7d('0x49')](_0x51858e[_0x5c7d('0x46')],_0x51858e[_0x5c7d('0x47')]);_0x1c3c25[_0x5c7d('0x4a')]=_[_0x5c7d('0x49')](_0x51858e[_0x5c7d('0x46')],qs[_0x5c7d('0x4b')](_0x3b95da[_0x5c7d('0x47')][_0x5c7d('0x4b')]));_0x1c3c25[_0x5c7d('0x4a')]=_0x1c3c25['attributes'][_0x5c7d('0x4c')]?_0x1c3c25[_0x5c7d('0x4a')]:_0x51858e['model'];if(!_0x3b95da[_0x5c7d('0x47')]['hasOwnProperty'](_0x5c7d('0x69'))){_0x1c3c25[_0x5c7d('0x30')]=qs[_0x5c7d('0x30')](_0x3b95da[_0x5c7d('0x47')]['limit']);_0x1c3c25[_0x5c7d('0x2e')]=qs[_0x5c7d('0x2e')](_0x3b95da[_0x5c7d('0x47')][_0x5c7d('0x2e')]);}_0x1c3c25[_0x5c7d('0x4e')]=qs[_0x5c7d('0x4f')](_0x3b95da[_0x5c7d('0x47')]['sort']);_0x1c3c25[_0x5c7d('0x50')]=qs[_0x5c7d('0x48')](_[_0x5c7d('0x51')](_0x3b95da[_0x5c7d('0x47')],_0x51858e[_0x5c7d('0x48')]));_0x1c3c25[_0x5c7d('0x50')]['WhatsappAccountId']=_0x40fcd5['id'];if(_0x3b95da['query'][_0x5c7d('0x52')]){_0x1c3c25['where']=_[_0x5c7d('0x53')](_0x1c3c25['where'],{'$or':_[_0x5c7d('0x42')](_0x1c3c25[_0x5c7d('0x4a')],function(_0x2bea61){var _0x1c4b2b={};_0x1c4b2b[_0x2bea61]={'$like':'%'+_0x3b95da[_0x5c7d('0x47')][_0x5c7d('0x52')]+'%'};return _0x1c4b2b;})});}_0x1c3c25=_[_0x5c7d('0x53')]({},_0x1c3c25,_0x3b95da[_0x5c7d('0x54')]);return db[_0x5c7d('0x66')][_0x5c7d('0x31')]({'where':_0x1c3c25[_0x5c7d('0x50')]})[_0x5c7d('0x37')](function(_0xc4b622){_0xf0ddfc['count']=_0xc4b622;if(_0x3b95da['query']['includeAll']){_0x1c3c25[_0x5c7d('0x57')]=[{'all':!![]}];}return db['Disposition'][_0x5c7d('0x6a')](_0x1c3c25);})[_0x5c7d('0x37')](function(_0x4a7cf7){_0xf0ddfc['rows']=_0x4a7cf7;return _0xf0ddfc;});}})[_0x5c7d('0x37')](respondWithFilteredResult(_0x629345,_0x1c3c25))[_0x5c7d('0x2c')](handleError(_0x629345,null));};exports['removeDispositions']=function(_0x425213,_0x3bfa5a,_0x5e8fe1){return db['WhatsappAccount'][_0x5c7d('0x5d')]({'where':{'id':_0x425213[_0x5c7d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3bfa5a,null))[_0x5c7d('0x37')](function(_0x48f73b){if(_0x48f73b){return _0x48f73b[_0x5c7d('0x6b')](_0x425213[_0x5c7d('0x47')][_0x5c7d('0x6c')]);}})[_0x5c7d('0x37')](respondWithStatusCode(_0x3bfa5a,null))['catch'](handleError(_0x3bfa5a,null));};exports[_0x5c7d('0x6d')]=function(_0x5494b0,_0x4c7020,_0x233113){if(_0x5494b0[_0x5c7d('0x62')]['id']){delete _0x5494b0[_0x5c7d('0x62')]['id'];}return db[_0x5c7d('0x55')][_0x5c7d('0x5d')]({'where':{'id':_0x5494b0[_0x5c7d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4c7020,null))['then'](function(_0x214959){if(_0x214959){_0x5494b0[_0x5c7d('0x62')][_0x5c7d('0x65')]=_0x214959['id'];return db['CannedAnswer'][_0x5c7d('0x5e')](_0x5494b0[_0x5c7d('0x62')]);}})['then'](respondWithResult(_0x4c7020,null))[_0x5c7d('0x2c')](handleError(_0x4c7020,null));};exports[_0x5c7d('0x6e')]=function(_0x193e89,_0x3c568a,_0x527ea5){var _0x15231d={'raw':![],'where':{}};var _0x15b54c={};var _0x14442e={'count':0x0,'rows':[]};return db[_0x5c7d('0x55')][_0x5c7d('0x68')]({'where':{'id':_0x193e89['params']['id']}})[_0x5c7d('0x37')](handleEntityNotFound(_0x3c568a,null))[_0x5c7d('0x37')](function(_0x3989f3){if(_0x3989f3){_0x15b54c[_0x5c7d('0x46')]=_['keys'](db[_0x5c7d('0x6f')][_0x5c7d('0x5c')]);_0x15b54c[_0x5c7d('0x47')]=_[_0x5c7d('0x5b')](_0x193e89[_0x5c7d('0x47')]);_0x15b54c[_0x5c7d('0x48')]=_['intersection'](_0x15b54c['model'],_0x15b54c['query']);_0x15231d[_0x5c7d('0x4a')]=_[_0x5c7d('0x49')](_0x15b54c[_0x5c7d('0x46')],qs[_0x5c7d('0x4b')](_0x193e89['query'][_0x5c7d('0x4b')]));_0x15231d[_0x5c7d('0x4a')]=_0x15231d['attributes'][_0x5c7d('0x4c')]?_0x15231d[_0x5c7d('0x4a')]:_0x15b54c[_0x5c7d('0x46')];if(!_0x193e89['query'][_0x5c7d('0x4d')]('nolimit')){_0x15231d[_0x5c7d('0x30')]=qs[_0x5c7d('0x30')](_0x193e89[_0x5c7d('0x47')][_0x5c7d('0x30')]);_0x15231d[_0x5c7d('0x2e')]=qs[_0x5c7d('0x2e')](_0x193e89['query'][_0x5c7d('0x2e')]);}_0x15231d[_0x5c7d('0x4e')]=qs[_0x5c7d('0x4f')](_0x193e89['query'][_0x5c7d('0x4f')]);_0x15231d[_0x5c7d('0x50')]=qs['filters'](_[_0x5c7d('0x51')](_0x193e89[_0x5c7d('0x47')],_0x15b54c[_0x5c7d('0x48')]));_0x15231d[_0x5c7d('0x50')][_0x5c7d('0x65')]=_0x3989f3['id'];if(_0x193e89[_0x5c7d('0x47')][_0x5c7d('0x52')]){_0x15231d['where']=_[_0x5c7d('0x53')](_0x15231d[_0x5c7d('0x50')],{'$or':_[_0x5c7d('0x42')](_0x15231d[_0x5c7d('0x4a')],function(_0x4a9b78){var _0x5e7cc3={};_0x5e7cc3[_0x4a9b78]={'$like':'%'+_0x193e89['query']['filter']+'%'};return _0x5e7cc3;})});}_0x15231d=_[_0x5c7d('0x53')]({},_0x15231d,_0x193e89[_0x5c7d('0x54')]);return db[_0x5c7d('0x6f')][_0x5c7d('0x31')]({'where':_0x15231d[_0x5c7d('0x50')]})[_0x5c7d('0x37')](function(_0x1b362b){_0x14442e['count']=_0x1b362b;if(_0x193e89['query'][_0x5c7d('0x56')]){_0x15231d[_0x5c7d('0x57')]=[{'all':!![]}];}return db[_0x5c7d('0x6f')][_0x5c7d('0x6a')](_0x15231d);})[_0x5c7d('0x37')](function(_0x5c28c1){_0x14442e['rows']=_0x5c28c1;return _0x14442e;});}})['then'](respondWithFilteredResult(_0x3c568a,_0x15231d))[_0x5c7d('0x2c')](handleError(_0x3c568a,null));};exports[_0x5c7d('0x70')]=function(_0x488084,_0x697311,_0x5c9c3f){return db[_0x5c7d('0x55')][_0x5c7d('0x5d')]({'where':{'id':_0x488084[_0x5c7d('0x5a')]['id']}})[_0x5c7d('0x37')](handleEntityNotFound(_0x697311,null))[_0x5c7d('0x37')](function(_0x5ba8a1){if(_0x5ba8a1){return _0x5ba8a1[_0x5c7d('0x70')](_0x488084[_0x5c7d('0x47')]['ids']);}})[_0x5c7d('0x37')](respondWithStatusCode(_0x697311,null))[_0x5c7d('0x2c')](handleError(_0x697311,null));};exports['addAgents']=function(_0x4bf1bc,_0x3caa74,_0x4f6adb){return db[_0x5c7d('0x55')]['find']({'where':{'id':_0x4bf1bc['params']['id']}})[_0x5c7d('0x37')](handleEntityNotFound(_0x3caa74,null))[_0x5c7d('0x37')](function(_0x5e2c21){if(_0x5e2c21){return _0x5e2c21[_0x5c7d('0x71')](_0x4bf1bc[_0x5c7d('0x62')]['ids'],_['omit'](_0x4bf1bc[_0x5c7d('0x62')],[_0x5c7d('0x6c'),'id'])||{})[_0x5c7d('0x72')](function(_0x56f3f5){for(var _0x1f700c=0x0;_0x1f700c<_0x4bf1bc[_0x5c7d('0x62')]['ids'][_0x5c7d('0x4c')];_0x1f700c+=0x1){socket[_0x5c7d('0x73')](_0x5c7d('0x74'),{'UserId':Number(_0x4bf1bc[_0x5c7d('0x62')][_0x5c7d('0x6c')][_0x1f700c]),'WhatsappAccountId':Number(_0x4bf1bc['params']['id'])});}return _0x56f3f5;});}})[_0x5c7d('0x37')](respondWithResult(_0x3caa74,null))[_0x5c7d('0x2c')](handleError(_0x3caa74,null));};exports['removeAgents']=function(_0x21a4d2,_0x58fee2,_0x130fc4){return db[_0x5c7d('0x55')]['find']({'where':{'id':_0x21a4d2['params']['id']}})[_0x5c7d('0x37')](handleEntityNotFound(_0x58fee2,null))[_0x5c7d('0x37')](function(_0x395331){if(_0x395331){return _0x395331[_0x5c7d('0x75')](_0x21a4d2[_0x5c7d('0x47')][_0x5c7d('0x6c')])[_0x5c7d('0x37')](function(){if(_[_0x5c7d('0x76')](_0x21a4d2[_0x5c7d('0x47')][_0x5c7d('0x6c')])){for(var _0x22bf7a=0x0;_0x22bf7a<_0x21a4d2[_0x5c7d('0x47')]['ids']['length'];_0x22bf7a+=0x1){socket[_0x5c7d('0x73')]('userWhatsappAccount:remove',{'UserId':Number(_0x21a4d2[_0x5c7d('0x47')][_0x5c7d('0x6c')][_0x22bf7a]),'WhatsappAccountId':Number(_0x21a4d2[_0x5c7d('0x5a')]['id'])});}}else{socket[_0x5c7d('0x73')](_0x5c7d('0x77'),{'UserId':Number(_0x21a4d2['query'][_0x5c7d('0x6c')]),'WhatsappAccountId':Number(_0x21a4d2[_0x5c7d('0x5a')]['id'])});}});}})[_0x5c7d('0x37')](respondWithStatusCode(_0x58fee2,null))[_0x5c7d('0x2c')](handleError(_0x58fee2,null));};exports['getAgents']=function(_0x527403,_0x10ddba,_0x4c1ce4){var _0x1863e9={};var _0x1a098a={};var _0x304501;var _0x25e38a;return db['WhatsappAccount'][_0x5c7d('0x68')]({'where':{'id':_0x527403[_0x5c7d('0x5a')]['id']}})[_0x5c7d('0x37')](handleEntityNotFound(_0x10ddba,null))[_0x5c7d('0x37')](function(_0x5af6b4){if(_0x5af6b4){_0x304501=_0x5af6b4;_0x1a098a[_0x5c7d('0x46')]=_[_0x5c7d('0x5b')](db[_0x5c7d('0x78')]['rawAttributes']);_0x1a098a[_0x5c7d('0x47')]=_[_0x5c7d('0x5b')](_0x527403[_0x5c7d('0x47')]);_0x1a098a[_0x5c7d('0x48')]=_[_0x5c7d('0x49')](_0x1a098a['model'],_0x1a098a[_0x5c7d('0x47')]);_0x1863e9[_0x5c7d('0x4a')]=_[_0x5c7d('0x49')](_0x1a098a['model'],qs[_0x5c7d('0x4b')](_0x527403[_0x5c7d('0x47')]['fields']));_0x1863e9[_0x5c7d('0x4a')]=_0x1863e9[_0x5c7d('0x4a')][_0x5c7d('0x4c')]?_0x1863e9[_0x5c7d('0x4a')]:_0x1a098a['model'];_0x1863e9['order']=qs[_0x5c7d('0x4f')](_0x527403[_0x5c7d('0x47')]['sort']);_0x1863e9['where']=qs[_0x5c7d('0x48')](_[_0x5c7d('0x51')](_0x527403[_0x5c7d('0x47')],_0x1a098a[_0x5c7d('0x48')]));if(_0x527403[_0x5c7d('0x47')][_0x5c7d('0x52')]){_0x1863e9['where']=_[_0x5c7d('0x53')](_0x1863e9[_0x5c7d('0x50')],{'$or':_[_0x5c7d('0x42')](_0x1863e9[_0x5c7d('0x4a')],function(_0x46de34){var _0x5551d={};_0x5551d[_0x46de34]={'$like':'%'+_0x527403[_0x5c7d('0x47')][_0x5c7d('0x52')]+'%'};return _0x5551d;})});}_0x1863e9=_[_0x5c7d('0x53')]({},_0x1863e9,_0x527403[_0x5c7d('0x54')]);return _0x304501['getAgents'](_0x1863e9);}})[_0x5c7d('0x37')](function(_0x44d44e){if(_0x44d44e){_0x25e38a=_0x44d44e['length'];if(!_0x527403[_0x5c7d('0x47')][_0x5c7d('0x4d')](_0x5c7d('0x69'))){_0x1863e9[_0x5c7d('0x30')]=qs[_0x5c7d('0x30')](_0x527403[_0x5c7d('0x47')][_0x5c7d('0x30')]);_0x1863e9['offset']=qs[_0x5c7d('0x2e')](_0x527403[_0x5c7d('0x47')][_0x5c7d('0x2e')]);}return _0x304501[_0x5c7d('0x79')](_0x1863e9);}})[_0x5c7d('0x37')](function(_0x2c7ec7){if(_0x2c7ec7){return _0x2c7ec7?{'count':_0x25e38a,'rows':_0x2c7ec7}:null;}})[_0x5c7d('0x37')](respondWithResult(_0x10ddba,null))[_0x5c7d('0x2c')](handleError(_0x10ddba,null));};exports['addApplications']=function(_0x13b8a3,_0x3b2d9d){var _0x365381=_0x13b8a3[_0x5c7d('0x5a')]['id'];var _0x3f8bfc=_0x13b8a3[_0x5c7d('0x62')];var _0x1019ef=0xc8;var _0x2b376c=null;return db['sequelize'][_0x5c7d('0x7a')]({'isolationLevel':db[_0x5c7d('0x7b')][_0x5c7d('0x7c')][_0x5c7d('0x7d')]['READ_COMMITTED']},function(_0x56f00d){return db[_0x5c7d('0x55')]['findOne']({'where':{'id':_0x365381},'transaction':_0x56f00d})[_0x5c7d('0x37')](function(_0x1c5d08){if(_0x1c5d08){return db[_0x5c7d('0x7e')][_0x5c7d('0x38')]({'where':{'WhatsappAccountId':_0x365381},'transaction':_0x56f00d})[_0x5c7d('0x37')](function(){var _0x2271c2=_[_0x5c7d('0x42')](_0x3f8bfc,function(_0x32888a){_0x32888a['WhatsappAccountId']=_0x365381;return _0x32888a;});return db[_0x5c7d('0x7e')]['bulkCreate'](_0x2271c2,{'transaction':_0x56f00d});});}else{_0x1019ef=0x194;_0x2b376c=[];}});})['then'](function(){if(_0x1019ef!==0x194){return db[_0x5c7d('0x7e')][_0x5c7d('0x7f')]({'where':{'WhatsappAccountId':_0x365381},'order':_0x5c7d('0x80')})[_0x5c7d('0x37')](function(_0x1e9087){_0x2b376c=_0x1e9087;});}})[_0x5c7d('0x2c')](function(_0x2e1f8a){_0x1019ef=0x1f4;logger[_0x5c7d('0x28')](_0x2e1f8a['stack']);if(_0x2e1f8a['name']){delete _0x2e1f8a[_0x5c7d('0x3e')];}_0x2b376c=_0x2e1f8a;})[_0x5c7d('0x81')](function(){if(_0x2b376c===null){_0x3b2d9d['sendStatus'](_0x1019ef);}else{if(_0x1019ef===0x1f4){_0x3b2d9d['status'](_0x1019ef)[_0x5c7d('0x82')](_0x2b376c);}else{_0x3b2d9d[_0x5c7d('0x2d')](_0x1019ef)[_0x5c7d('0x34')](_0x2b376c);}}});};exports['getApplications']=function(_0x3249a2,_0x45df82,_0x3f9b2e){var _0x21bca5={};var _0x2ceff4={};var _0x2175c6;var _0x365111;return db[_0x5c7d('0x55')][_0x5c7d('0x68')]({'where':{'id':_0x3249a2[_0x5c7d('0x5a')]['id']}})[_0x5c7d('0x37')](handleEntityNotFound(_0x45df82,null))[_0x5c7d('0x37')](function(_0x31afd8){if(_0x31afd8){_0x2175c6=_0x31afd8;_0x2ceff4['model']=_[_0x5c7d('0x5b')](db[_0x5c7d('0x7e')][_0x5c7d('0x5c')]);_0x2ceff4[_0x5c7d('0x47')]=_['keys'](_0x3249a2[_0x5c7d('0x47')]);_0x2ceff4['filters']=_['intersection'](_0x2ceff4['model'],_0x2ceff4[_0x5c7d('0x47')]);_0x21bca5['attributes']=_[_0x5c7d('0x49')](_0x2ceff4[_0x5c7d('0x46')],qs[_0x5c7d('0x4b')](_0x3249a2[_0x5c7d('0x47')]['fields']));_0x21bca5['attributes']=_0x21bca5[_0x5c7d('0x4a')][_0x5c7d('0x4c')]?_0x21bca5['attributes']:_0x2ceff4['model'];_0x21bca5[_0x5c7d('0x4e')]=qs[_0x5c7d('0x4f')](_0x3249a2[_0x5c7d('0x47')][_0x5c7d('0x4f')]);_0x21bca5[_0x5c7d('0x50')]=qs[_0x5c7d('0x48')](_[_0x5c7d('0x51')](_0x3249a2[_0x5c7d('0x47')],_0x2ceff4[_0x5c7d('0x48')]));if(_0x3249a2[_0x5c7d('0x47')][_0x5c7d('0x52')]){_0x21bca5['where']=_['merge'](_0x21bca5[_0x5c7d('0x50')],{'$or':_['map'](_0x21bca5['attributes'],function(_0x15226b){var _0x5601b7={};_0x5601b7[_0x15226b]={'$like':'%'+_0x3249a2['query']['filter']+'%'};return _0x5601b7;})});}_0x21bca5=_[_0x5c7d('0x53')]({},_0x21bca5,_0x3249a2[_0x5c7d('0x54')]);return _0x2175c6['getApplications'](_0x21bca5);}})[_0x5c7d('0x37')](function(_0x50ba4c){if(_0x50ba4c){_0x365111=_0x50ba4c[_0x5c7d('0x4c')];if(!_0x3249a2['query'][_0x5c7d('0x4d')](_0x5c7d('0x69'))){_0x21bca5[_0x5c7d('0x30')]=qs[_0x5c7d('0x30')](_0x3249a2[_0x5c7d('0x47')][_0x5c7d('0x30')]);_0x21bca5['offset']=qs[_0x5c7d('0x2e')](_0x3249a2[_0x5c7d('0x47')][_0x5c7d('0x2e')]);}return _0x2175c6[_0x5c7d('0x83')](_0x21bca5);}})[_0x5c7d('0x37')](function(_0x2b2c68){if(_0x2b2c68){return _0x2b2c68?{'count':_0x365111,'rows':_0x2b2c68}:null;}})[_0x5c7d('0x37')](respondWithResult(_0x45df82,null))[_0x5c7d('0x2c')](handleError(_0x45df82,null));};exports[_0x5c7d('0x84')]=function(_0x3c7799,_0x4519cb,_0x5e4e4b){var _0xcbc15={'channel':_0x5c7d('0x85')};var _0x4af412=[];var _0x4a3a0c=[];var _0x36a656={};return db['WhatsappAccount'][_0x5c7d('0x5d')]({'where':{'id':_0x3c7799[_0x5c7d('0x5a')]['id']},'include':[{'model':db[_0x5c7d('0x7e')],'as':_0x5c7d('0x86')}]})[_0x5c7d('0x37')](handleEntityNotFound(_0x4519cb,null))['then'](function(_0x416459){_0xcbc15[_0x5c7d('0x87')]=_0x416459;if(_0xcbc15[_0x5c7d('0x87')]&&_0xcbc15['account'][_0x5c7d('0x44')]==='sinch'&&_0x3c7799[_0x5c7d('0x62')][_0x5c7d('0x88')]){if(_0x3c7799[_0x5c7d('0x62')][_0x5c7d('0x88')][_0x5c7d('0x4c')]===0x0)return;if(_0x3c7799[_0x5c7d('0x62')][_0x5c7d('0x88')][0x0][_0x5c7d('0x89')]!==_0x5c7d('0x8a'))return;return db[_0x5c7d('0x8b')]['update']({'read':!![],'readAt':_0x3c7799[_0x5c7d('0x62')][_0x5c7d('0x88')][0x0][_0x5c7d('0x8c')]},{'where':{'messageId':_0x3c7799[_0x5c7d('0x62')][_0x5c7d('0x88')][0x0]['message_id']},'individualHooks':!![]})[_0x5c7d('0x37')](function(_0x52d295){return _0x4519cb[_0x5c7d('0x2d')](0xc8)['json'](_0x52d295);});}_0xcbc15[_0x5c7d('0x8d')]=_[_0x5c7d('0x8e')](_0x416459[_0x5c7d('0x86')],[_0x5c7d('0x80')],['asc']);if(_0xcbc15[_0x5c7d('0x87')]['Applications']){delete _0xcbc15['account'][_0x5c7d('0x86')];}return db['CmContact'][_0x5c7d('0x63')]()[_0x5c7d('0x37')](function(_0x9f956){if(!_0x9f956){throw new db[(_0x5c7d('0x8f'))][(_0x5c7d('0x90'))](_0x5c7d('0x91'));}_0x4af412=_[_0x5c7d('0x92')](_['keys'](_0x9f956),[_0x5c7d('0x93'),_0x5c7d('0x94')]);_0x4a3a0c=_[_0x5c7d('0x92')](_[_0x5c7d('0x5b')](_0x9f956),[_0x5c7d('0x93'),_0x5c7d('0x94'),_0x5c7d('0x95'),'ListId']);_0xcbc15[_0x5c7d('0x62')]={'mapKey':_0x5c7d('0x96')};if(_0xcbc15[_0x5c7d('0x87')]&&_0xcbc15[_0x5c7d('0x87')][_0x5c7d('0x44')]===_0x5c7d('0x97')){_0xcbc15[_0x5c7d('0x62')][_0x5c7d('0x98')]=_0x3c7799['body'][_0x5c7d('0x99')]['replace']('whatsapp:','');_0xcbc15[_0x5c7d('0x62')]['body']=_0x3c7799['body']['Body'];_0xcbc15[_0x5c7d('0x62')][_0x5c7d('0x9a')]=_0x3c7799[_0x5c7d('0x62')][_0x5c7d('0x9b')];}if(_0xcbc15[_0x5c7d('0x87')]&&_0xcbc15['account'][_0x5c7d('0x44')]==='sinch'){_0xcbc15[_0x5c7d('0x62')][_0x5c7d('0x98')]=_0x3c7799[_0x5c7d('0x62')][_0x5c7d('0x9c')][0x0][_0x5c7d('0x98')];_0xcbc15[_0x5c7d('0x62')][_0x5c7d('0x62')]=_0x3c7799[_0x5c7d('0x62')][_0x5c7d('0x9c')][0x0][_0x5c7d('0x2a')]['body'];_0xcbc15[_0x5c7d('0x62')]['messageId']=_0x3c7799['body']['notifications'][0x0][_0x5c7d('0x9d')];}if(_0xcbc15[_0x5c7d('0x62')]['id']){delete _0xcbc15[_0x5c7d('0x62')]['id'];}if(_[_0x5c7d('0x9e')](_0xcbc15[_0x5c7d('0x62')][_0x5c7d('0x98')])){throw new db[(_0x5c7d('0x8f'))]['ValidationError'](_0x5c7d('0x9f'));}if(_['isNil'](_0xcbc15['body'][_0x5c7d('0x62')])||_0xcbc15['body']['body']===''){throw new db[(_0x5c7d('0x8f'))][(_0x5c7d('0x90'))](_0x5c7d('0xa0'));}if(_['isNil'](_0xcbc15[_0x5c7d('0x62')][_0x5c7d('0xa1')])){throw new db[(_0x5c7d('0x8f'))][(_0x5c7d('0x90'))](_0x5c7d('0xa2')+_0x4a3a0c);}if(!_[_0x5c7d('0xa3')](_0x4a3a0c,_0xcbc15['body'][_0x5c7d('0xa1')])){throw new db[(_0x5c7d('0x8f'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4a3a0c);}_0x36a656[_0xcbc15[_0x5c7d('0x62')][_0x5c7d('0xa1')]]=_0xcbc15['body'][_0x5c7d('0x98')];return db[_0x5c7d('0xa4')][_0x5c7d('0x5d')]({'where':{'id':_0xcbc15[_0x5c7d('0x87')][_0x5c7d('0xa5')]},'include':[{'model':db[_0x5c7d('0xa6')],'as':_0x5c7d('0xa7'),'where':_0x36a656,'limit':0x1,'order':[[_0x5c7d('0x94'),_0x5c7d('0xa8')]]}]});})[_0x5c7d('0x37')](handleEntityNotFound(_0x4519cb,null))[_0x5c7d('0x37')](function(_0x105562){if(_0x105562){_0xcbc15['list']=_[_0x5c7d('0xa9')](_0x105562,[_0x5c7d('0xa7')]);if(_0x105562[_0x5c7d('0xa7')][_0x5c7d('0x4c')]){return _0x105562[_0x5c7d('0xa7')][0x0];}var _0x1720b6=_[_0x5c7d('0x1d')](_0xcbc15[_0x5c7d('0x62')],{'firstName':_0xcbc15[_0x5c7d('0x62')][_0x5c7d('0x98')],'ListId':_0x105562['id']});_0x1720b6[_0xcbc15['body'][_0x5c7d('0xa1')]]=_0xcbc15['body'][_0x5c7d('0x98')];return db[_0x5c7d('0xa6')][_0x5c7d('0x5e')](_0x1720b6,{'fields':_0x4af412,'raw':!![]});}})['then'](handleEntityNotFound(_0x4519cb,null))[_0x5c7d('0x37')](function(_0x441c22){if(_0x441c22){_0xcbc15[_0x5c7d('0xaa')]=_0x441c22;var _0x1276f9={'ContactId':_0x441c22['id'],'phone':_0xcbc15[_0x5c7d('0x62')][_0x5c7d('0x98')],'WhatsappAccountId':_0x3c7799[_0x5c7d('0x5a')]['id']};var _0x1081ad={'ContactId':_0x441c22['id'],'WhatsappAccountId':_0x3c7799[_0x5c7d('0x5a')]['id'],'closed':![]};return db[_0x5c7d('0xab')][_0x5c7d('0x5d')]({'where':_0x1081ad})['then'](function(_0x581bc4){if(_0x581bc4){return[_0x581bc4,![]];}return db['WhatsappInteraction'][_0x5c7d('0x5e')](_0x1276f9)[_0x5c7d('0x37')](function(_0x19d833){return[_0x19d833,!![]];});});}})[_0x5c7d('0x72')](function(_0x41945a,_0x11590a){_0xcbc15['interaction']=_0x41945a[_0x5c7d('0x39')]({'plain':!![]});_0xcbc15['interaction']['created']=![];if(_0x11590a){if(_0xcbc15[_0x5c7d('0x87')][_0x5c7d('0xac')]){_0xcbc15[_0x5c7d('0x8d')][_0x5c7d('0xad')]({'id':0x0,'priority':_0xcbc15[_0x5c7d('0x8d')]['length']+0x1,'app':_0x5c7d('0xae'),'appdata':_0x5c7d('0xaf'),'interval':_0x5c7d('0xb0')});}_0xcbc15['interaction'][_0x5c7d('0xb1')]=!![];}return db[_0x5c7d('0x8b')][_0x5c7d('0x5e')]({'phone':_0xcbc15['body'][_0x5c7d('0x98')],'messageId':_0xcbc15['body'][_0x5c7d('0x9a')],'body':_0xcbc15['body']['body'],'WhatsappAccountId':_0x3c7799[_0x5c7d('0x5a')]['id'],'WhatsappInteractionId':_0x41945a['id'],'direction':'in','ContactId':_0x41945a[_0x5c7d('0xb2')],'AttachmentId':_0xcbc15[_0x5c7d('0x62')]['AttachmentId']});})[_0x5c7d('0x37')](function(_0x1c3b38){_0xcbc15['message']=_0x1c3b38;if(!_0xcbc15[_0x5c7d('0xb3')][_0x5c7d('0xb4')])return;return db['User'][_0x5c7d('0x5d')]({'attributes':['id',_0x5c7d('0x3e')],'where':{'id':_0xcbc15[_0x5c7d('0xb3')][_0x5c7d('0xb4')]}});})[_0x5c7d('0x37')](function(_0x3a4e3a){if(_0x3a4e3a){_0xcbc15[_0x5c7d('0x8d')][_0x5c7d('0xb5')]({'id':0x0,'priority':0x0,'app':_0x5c7d('0xb6'),'appdata':_0x3a4e3a['name']+','+(_0xcbc15[_0x5c7d('0x87')]['waitForTheAssignedAgent']||0xa),'interval':_0x5c7d('0xb0')});}if(!_0xcbc15[_0x5c7d('0xb3')]['queueId'])return;return db['WhatsappQueue'][_0x5c7d('0x5d')]({'attributes':['id',_0x5c7d('0x3e')],'where':{'id':_0xcbc15[_0x5c7d('0xb3')][_0x5c7d('0xb7')]}});})[_0x5c7d('0x37')](function(_0x59e074){if(_0x59e074){_0xcbc15[_0x5c7d('0x8d')][_0x5c7d('0xb5')]({'id':0x0,'priority':0x1,'app':_0x5c7d('0xb8'),'appdata':_0x59e074['name']+','+(_0xcbc15[_0x5c7d('0x87')]['waitForTheAssignedQueue']||0x12c),'interval':_0x5c7d('0xb0')});}return respondWithRpcPromise(_0x5c7d('0xb9'),_0x5c7d('0xba'),_0xcbc15);})[_0x5c7d('0x37')](function(_0x206067){if(_0x206067){var _0x55a7f7=0xc8;var _0x2f9f05=_0x5c7d('0xbb');logger[_0x5c7d('0xbc')](_0x5c7d('0x26'),_0x2f9f05,_0x55a7f7,_0x5c7d('0xbd'));logger[_0x5c7d('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x2f9f05,_0x55a7f7,_0x5c7d('0xbd'),JSON[_0x5c7d('0xbe')](_0x206067));if(_0xcbc15['account'][_0x5c7d('0x44')]===_0x5c7d('0x97')){return _0x4519cb[_0x5c7d('0x2d')](_0x55a7f7)[_0x5c7d('0x32')](_0x5c7d('0xbf'),_0x5c7d('0xc0'))['send'](_0x5c7d('0xc1'));}else{return _0x4519cb[_0x5c7d('0x2d')](_0x55a7f7)[_0x5c7d('0x34')](_0x206067);}}});})[_0x5c7d('0x2c')](handleError(_0x4519cb,null));};exports[_0x5c7d('0x82')]=function(_0x2e63db,_0x4404a4,_0x41b4c6){var _0x11ba0a,_0x1a3ede,_0x3f8724;if(_['isNil'](_0x2e63db[_0x5c7d('0x62')]['body'])||_0x2e63db[_0x5c7d('0x62')][_0x5c7d('0x62')]===''){throw new db[(_0x5c7d('0x8f'))][(_0x5c7d('0x90'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5c7d('0x9e')](_0x2e63db[_0x5c7d('0x62')]['to'])){throw new db[(_0x5c7d('0x8f'))]['ValidationError']('to\x20is\x20mandatory');}_0x11ba0a=_0x2e63db[_0x5c7d('0x62')]['to'];return db[_0x5c7d('0x55')][_0x5c7d('0x5d')]({'where':{'id':_0x2e63db[_0x5c7d('0x5a')]['id']},'include':[{'model':db[_0x5c7d('0xa4')],'as':_0x5c7d('0xc2'),'include':[{'model':db[_0x5c7d('0xa6')],'as':_0x5c7d('0xa7'),'where':{'mobile':_0x11ba0a},'limit':0x1,'order':[[_0x5c7d('0x94'),_0x5c7d('0xa8')]]}]}]})[_0x5c7d('0x37')](handleEntityNotFound(_0x4404a4,null))[_0x5c7d('0x37')](function(_0x238636){if(_0x238636&&_0x238636[_0x5c7d('0xc2')]){_0x1a3ede=_0x238636[_0x5c7d('0x39')]({'plain':!![]});if(_0x1a3ede[_0x5c7d('0xc2')]&&_0x1a3ede['List']['Contacts']['length']){return _0x1a3ede[_0x5c7d('0xc2')]['Contacts'][0x0];}return db[_0x5c7d('0xa6')][_0x5c7d('0x5e')](_['defaults'](_0x2e63db[_0x5c7d('0x62')],{'firstName':_0x11ba0a,'mobile':_0x11ba0a,'phone':_0x11ba0a,'ListId':_0x1a3ede[_0x5c7d('0xa5')]}));}})[_0x5c7d('0x37')](handleEntityNotFound(_0x4404a4,null))[_0x5c7d('0x37')](function(_0x43651f){if(_0x43651f){_0x3f8724=_0x43651f;return db[_0x5c7d('0xab')]['find']({'where':{'ContactId':_0x3f8724['id'],'closed':![],'WhatsappAccountId':_0x1a3ede['id']}})[_0x5c7d('0x37')](function(_0x37409c){if(_0x37409c){return[_0x37409c,![]];}return db[_0x5c7d('0xab')]['create']({'UserId':_0x2e63db[_0x5c7d('0xc3')]['id'],'ContactId':_0x3f8724['id'],'WhatsappAccountId':_0x1a3ede['id'],'phone':_0x11ba0a,'firstMsgDirection':_0x5c7d('0xc4'),'Messages':[_[_0x5c7d('0x53')](_0x2e63db['body'],{'read':![],'body':_0x2e63db[_0x5c7d('0x62')][_0x5c7d('0x62')],'phone':_0x11ba0a,'WhatsappAccountId':_0x1a3ede['id'],'UserId':_0x2e63db[_0x5c7d('0xc3')]['id'],'ContactId':_0x3f8724['id']})]},{'include':[{'model':db[_0x5c7d('0x8b')],'as':_0x5c7d('0xc5')}]})[_0x5c7d('0x37')](function(_0x592347){return[_0x592347,!![]];});});}})[_0x5c7d('0x72')](function(_0x5c9fdb,_0x37370e){if(_0x37370e){return _0x5c9fdb;}return db[_0x5c7d('0x8b')][_0x5c7d('0x5e')](_[_0x5c7d('0x53')](_0x2e63db[_0x5c7d('0x62')],{'read':![],'body':_0x2e63db['body'][_0x5c7d('0x62')],'phone':_0x11ba0a,'WhatsappAccountId':_0x1a3ede['id'],'WhatsappInteractionId':_0x5c9fdb['id'],'UserId':_0x2e63db[_0x5c7d('0xc3')]['id'],'ContactId':_0x3f8724['id']}))[_0x5c7d('0x37')](function(_0x4571d6){_0x5c9fdb[_0x5c7d('0xc6')]['Messages']=[];_0x5c9fdb[_0x5c7d('0xc6')][_0x5c7d('0xc5')][_0x5c7d('0xad')](_0x4571d6[_0x5c7d('0xc6')]);return _0x5c9fdb;});})[_0x5c7d('0x37')](respondWithResult(_0x4404a4,null))['catch'](handleError(_0x4404a4,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 698ad62..6ac5951 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 _0xcb4d=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','WhatsappAccount'];(function(_0x1de108,_0x112861){var _0xac408d=function(_0x4b49a9){while(--_0x4b49a9){_0x1de108['push'](_0x1de108['shift']());}};_0xac408d(++_0x112861);}(_0xcb4d,0x101));var _0xdcb4=function(_0x41726c,_0x4cf7a4){_0x41726c=_0x41726c-0x0;var _0x1c9577=_0xcb4d[_0x41726c];return _0x1c9577;};'use strict';var EventEmitter=require(_0xdcb4('0x0'));var WhatsappAccount=require(_0xdcb4('0x1'))['db'][_0xdcb4('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xdcb4('0x3')](0x0);var events={'afterCreate':_0xdcb4('0x4'),'afterUpdate':_0xdcb4('0x5'),'afterDestroy':_0xdcb4('0x6')};function emitEvent(_0x277a4e){return function(_0x2876e3,_0x19c25f,_0x1e70f8){WhatsappAccountEvents[_0xdcb4('0x7')](_0x277a4e+':'+_0x2876e3['id'],_0x2876e3);WhatsappAccountEvents[_0xdcb4('0x7')](_0x277a4e,_0x2876e3);_0x1e70f8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0xdcb4('0x8')](e,emitEvent(event));}}module[_0xdcb4('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0xea69=['WhatsappAccount','setMaxListeners','save','update','emit','hook','../../mysqldb'];(function(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0xea69,0x8b));var _0x9ea6=function(_0x397706,_0x32a840){_0x397706=_0x397706-0x0;var _0x4ffa44=_0xea69[_0x397706];return _0x4ffa44;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x9ea6('0x0'))['db'][_0x9ea6('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x9ea6('0x2')](0x0);var events={'afterCreate':_0x9ea6('0x3'),'afterUpdate':_0x9ea6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x51ebfa){return function(_0x38df7f,_0x12c2d1,_0x1c05b9){WhatsappAccountEvents[_0x9ea6('0x5')](_0x51ebfa+':'+_0x38df7f['id'],_0x38df7f);WhatsappAccountEvents['emit'](_0x51ebfa,_0x38df7f);_0x1c05b9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x9ea6('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 e378126..a81c446 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 _0x8d01=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api'];(function(_0x52eabb,_0x4ecc51){var _0x290a28=function(_0x60dfb0){while(--_0x60dfb0){_0x52eabb['push'](_0x52eabb['shift']());}};_0x290a28(++_0x4ecc51);}(_0x8d01,0x6c));var _0x18d0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d01[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x18d0('0x0'));var util=require(_0x18d0('0x1'));var logger=require(_0x18d0('0x2'))(_0x18d0('0x3'));var moment=require(_0x18d0('0x4'));var BPromise=require(_0x18d0('0x5'));var rp=require(_0x18d0('0x6'));var fs=require('fs');var path=require(_0x18d0('0x7'));var rimraf=require(_0x18d0('0x8'));var config=require(_0x18d0('0x9'));var attributes=require('./whatsappAccount.attributes');module[_0x18d0('0xa')]=function(_0x25839d,_0xab6fc9){return _0x25839d[_0x18d0('0xb')](_0x18d0('0xc'),attributes,{'tableName':_0x18d0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbfa=['bluebird','request-promise','path','rimraf','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api'];(function(_0x207140,_0x4c6556){var _0x39e8cf=function(_0x16b730){while(--_0x16b730){_0x207140['push'](_0x207140['shift']());}};_0x39e8cf(++_0x4c6556);}(_0xbbfa,0xcc));var _0xabbf=function(_0x44ff66,_0x27f548){_0x44ff66=_0x44ff66-0x0;var _0x136331=_0xbbfa[_0x44ff66];return _0x136331;};'use strict';var _=require(_0xabbf('0x0'));var util=require(_0xabbf('0x1'));var logger=require(_0xabbf('0x2'))(_0xabbf('0x3'));var moment=require('moment');var BPromise=require(_0xabbf('0x4'));var rp=require(_0xabbf('0x5'));var fs=require('fs');var path=require(_0xabbf('0x6'));var rimraf=require(_0xabbf('0x7'));var config=require('../../config/environment');var attributes=require(_0xabbf('0x8'));module[_0xabbf('0x9')]=function(_0x1d3da5,_0xd5542b){return _0x1d3da5[_0xabbf('0xa')](_0xabbf('0xb'),attributes,{'tableName':_0xabbf('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 e2f2d67..0dac0a1 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 _0x120a=['message','catch','ShowWhatsappAccount','options','raw','attributes','include','model','map','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x3a04d5,_0x436db9){var _0x50bc4b=function(_0x21f8f3){while(--_0x21f8f3){_0x3a04d5['push'](_0x3a04d5['shift']());}};_0x50bc4b(++_0x436db9);}(_0x120a,0xa4));var _0xa120=function(_0x4f1789,_0x37fda7){_0x4f1789=_0x4f1789-0x0;var _0x5bb8fe=_0x120a[_0x4f1789];return _0x5bb8fe;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa120('0x0'));var rs=require(_0xa120('0x1'));var fs=require('fs');var Redis=require(_0xa120('0x2'));var db=require(_0xa120('0x3'))['db'];var utils=require(_0xa120('0x4'));var logger=require(_0xa120('0x5'))('rpc');var config=require(_0xa120('0x6'));var jayson=require(_0xa120('0x7'));var client=jayson['client'][_0xa120('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xa120('0x9')],{'host':_0xa120('0xa'),'port':0x18eb});var socket=require(_0xa120('0xb'))(new Redis(config[_0xa120('0x9')]));require(_0xa120('0xc'))[_0xa120('0xd')](socket);function respondWithRpcPromise(_0x314328,_0x63ef50,_0x4be317){return new BPromise(function(_0x54e40f,_0x429e57){return client['request'](_0x314328,_0x4be317)[_0xa120('0xe')](function(_0x1084a6){logger[_0xa120('0xf')](_0xa120('0x10'),_0x63ef50,_0xa120('0x11'));logger[_0xa120('0x12')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x63ef50,_0xa120('0x11'),JSON[_0xa120('0x13')](_0x1084a6));if(_0x1084a6['error']){if(_0x1084a6[_0xa120('0x14')][_0xa120('0x15')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x63ef50,_0x1084a6[_0xa120('0x14')][_0xa120('0x16')]);return _0x429e57(_0x1084a6[_0xa120('0x14')][_0xa120('0x16')]);}logger[_0xa120('0x14')](_0xa120('0x10'),_0x63ef50,_0x1084a6['error']['message']);return _0x54e40f(_0x1084a6[_0xa120('0x14')][_0xa120('0x16')]);}else{logger[_0xa120('0xf')](_0xa120('0x10'),_0x63ef50,_0xa120('0x11'));_0x54e40f(_0x1084a6['result'][_0xa120('0x16')]);}})[_0xa120('0x17')](function(_0x68d44e){logger['error'](_0xa120('0x10'),_0x63ef50,_0x68d44e);_0x429e57(_0x68d44e);});});}exports[_0xa120('0x18')]=function(_0xfda576){var _0xa26cf=this;return new Promise(function(_0x4a8809,_0x3db641){return db['WhatsappAccount']['find']({'raw':_0xfda576[_0xa120('0x19')]?_0xfda576[_0xa120('0x19')][_0xa120('0x1a')]===undefined?!![]:![]:!![],'where':_0xfda576[_0xa120('0x19')]?_0xfda576[_0xa120('0x19')]['where']||null:null,'attributes':_0xfda576['options']?_0xfda576['options'][_0xa120('0x1b')]||null:null,'include':_0xfda576['options']?_0xfda576[_0xa120('0x19')][_0xa120('0x1c')]?_['map'](_0xfda576[_0xa120('0x19')][_0xa120('0x1c')],function(_0x209bcd){return{'model':db[_0x209bcd[_0xa120('0x1d')]],'as':_0x209bcd['as'],'attributes':_0x209bcd[_0xa120('0x1b')],'include':_0x209bcd[_0xa120('0x1c')]?_['map'](_0x209bcd[_0xa120('0x1c')],function(_0x3a3f8e){return{'model':db[_0x3a3f8e[_0xa120('0x1d')]],'as':_0x3a3f8e['as'],'attributes':_0x3a3f8e[_0xa120('0x1b')],'include':_0x3a3f8e[_0xa120('0x1c')]?_[_0xa120('0x1e')](_0x3a3f8e[_0xa120('0x1c')],function(_0x4b4104){return{'model':db[_0x4b4104[_0xa120('0x1d')]],'as':_0x4b4104['as'],'attributes':_0x4b4104['attributes']};}):[]};}):[]};}):[]:[]})[_0xa120('0xe')](function(_0x3726ba){logger['info'](_0xa120('0x18'),_0xfda576);logger['debug'](_0xa120('0x18'),_0xfda576,JSON[_0xa120('0x13')](_0x3726ba));_0x4a8809(_0x3726ba);})[_0xa120('0x17')](function(_0x4a0cce){logger[_0xa120('0x14')](_0xa120('0x18'),_0x4a0cce[_0xa120('0x16')],_0xfda576);_0x3db641(_0xa26cf[_0xa120('0x14')](0x1f4,_0x4a0cce[_0xa120('0x16')]));});});}; \ No newline at end of file +var _0xeefe=['defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0xe3042e,_0x3b370a){var _0x254cb5=function(_0xcf70ee){while(--_0xcf70ee){_0xe3042e['push'](_0xe3042e['shift']());}};_0x254cb5(++_0x3b370a);}(_0xeefe,0xf2));var _0xeeef=function(_0x2aead5,_0x31abc2){_0x2aead5=_0x2aead5-0x0;var _0x21dac5=_0xeefe[_0x2aead5];return _0x21dac5;};'use strict';var _=require(_0xeeef('0x0'));var util=require('util');var moment=require(_0xeeef('0x1'));var BPromise=require('bluebird');var rs=require(_0xeeef('0x2'));var fs=require('fs');var Redis=require(_0xeeef('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xeeef('0x4'));var logger=require('../../config/logger')(_0xeeef('0x5'));var config=require(_0xeeef('0x6'));var jayson=require(_0xeeef('0x7'));var client=jayson[_0xeeef('0x8')]['http']({'port':0x232a});config[_0xeeef('0x9')]=_[_0xeeef('0xa')](config[_0xeeef('0x9')],{'host':_0xeeef('0xb'),'port':0x18eb});var socket=require(_0xeeef('0xc'))(new Redis(config[_0xeeef('0x9')]));require(_0xeeef('0xd'))[_0xeeef('0xe')](socket);function respondWithRpcPromise(_0x3257f7,_0x3a7729,_0x5b5ccd){return new BPromise(function(_0x45f63b,_0x3d3d53){return client[_0xeeef('0xf')](_0x3257f7,_0x5b5ccd)[_0xeeef('0x10')](function(_0xc3daf7){logger['info'](_0xeeef('0x11'),_0x3a7729,_0xeeef('0x12'));logger[_0xeeef('0x13')](_0xeeef('0x14'),_0x3a7729,_0xeeef('0x12'),JSON['stringify'](_0xc3daf7));if(_0xc3daf7['error']){if(_0xc3daf7[_0xeeef('0x15')]['code']===0x1f4){logger[_0xeeef('0x15')](_0xeeef('0x11'),_0x3a7729,_0xc3daf7[_0xeeef('0x15')][_0xeeef('0x16')]);return _0x3d3d53(_0xc3daf7[_0xeeef('0x15')][_0xeeef('0x16')]);}logger[_0xeeef('0x15')](_0xeeef('0x11'),_0x3a7729,_0xc3daf7[_0xeeef('0x15')][_0xeeef('0x16')]);return _0x45f63b(_0xc3daf7[_0xeeef('0x15')][_0xeeef('0x16')]);}else{logger[_0xeeef('0x17')](_0xeeef('0x11'),_0x3a7729,_0xeeef('0x12'));_0x45f63b(_0xc3daf7[_0xeeef('0x18')][_0xeeef('0x16')]);}})[_0xeeef('0x19')](function(_0x341249){logger[_0xeeef('0x15')](_0xeeef('0x11'),_0x3a7729,_0x341249);_0x3d3d53(_0x341249);});});}exports[_0xeeef('0x1a')]=function(_0x1ff712){var _0x56c454=this;return new Promise(function(_0x5b4be8,_0x4ef8c6){return db[_0xeeef('0x1b')][_0xeeef('0x1c')]({'raw':_0x1ff712[_0xeeef('0x1d')]?_0x1ff712[_0xeeef('0x1d')][_0xeeef('0x1e')]===undefined?!![]:![]:!![],'where':_0x1ff712[_0xeeef('0x1d')]?_0x1ff712[_0xeeef('0x1d')][_0xeeef('0x1f')]||null:null,'attributes':_0x1ff712[_0xeeef('0x1d')]?_0x1ff712[_0xeeef('0x1d')][_0xeeef('0x20')]||null:null,'include':_0x1ff712['options']?_0x1ff712[_0xeeef('0x1d')][_0xeeef('0x21')]?_[_0xeeef('0x22')](_0x1ff712[_0xeeef('0x1d')]['include'],function(_0x2f40be){return{'model':db[_0x2f40be['model']],'as':_0x2f40be['as'],'attributes':_0x2f40be[_0xeeef('0x20')],'include':_0x2f40be[_0xeeef('0x21')]?_[_0xeeef('0x22')](_0x2f40be[_0xeeef('0x21')],function(_0x2a6552){return{'model':db[_0x2a6552[_0xeeef('0x23')]],'as':_0x2a6552['as'],'attributes':_0x2a6552['attributes'],'include':_0x2a6552[_0xeeef('0x21')]?_[_0xeeef('0x22')](_0x2a6552[_0xeeef('0x21')],function(_0x5e85e9){return{'model':db[_0x5e85e9['model']],'as':_0x5e85e9['as'],'attributes':_0x5e85e9['attributes']};}):[]};}):[]};}):[]:[]})[_0xeeef('0x10')](function(_0x287af7){logger[_0xeeef('0x17')]('ShowWhatsappAccount',_0x1ff712);logger[_0xeeef('0x13')](_0xeeef('0x1a'),_0x1ff712,JSON['stringify'](_0x287af7));_0x5b4be8(_0x287af7);})[_0xeeef('0x19')](function(_0x1d96c2){logger[_0xeeef('0x15')](_0xeeef('0x1a'),_0x1d96c2[_0xeeef('0x16')],_0x1ff712);_0x4ef8c6(_0x56c454[_0xeeef('0x15')](0x1f4,_0x1d96c2[_0xeeef('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 7431b59..cc38853 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 _0x1f9f=['length','whatsappAccount:','remove','emit','removeListener','register'];(function(_0x18f90e,_0x25a7f8){var _0x11cb87=function(_0x204815){while(--_0x204815){_0x18f90e['push'](_0x18f90e['shift']());}};_0x11cb87(++_0x25a7f8);}(_0x1f9f,0x1e8));var _0xf1f9=function(_0x4067ac,_0x363603){_0x4067ac=_0x4067ac-0x0;var _0x53d74d=_0x1f9f[_0x4067ac];return _0x53d74d;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save',_0xf1f9('0x0'),'update'];function createListener(_0x363fad,_0xd812dd){return function(_0x350102){_0xd812dd[_0xf1f9('0x1')](_0x363fad,_0x350102);};}function removeListener(_0x248291,_0x525c69){return function(){WhatsappAccountEvents[_0xf1f9('0x2')](_0x248291,_0x525c69);};}exports[_0xf1f9('0x3')]=function(_0x14d2a1){for(var _0x116b09=0x0,_0x1e4d4a=events[_0xf1f9('0x4')];_0x116b09<_0x1e4d4a;_0x116b09++){var _0x5ecbf8=events[_0x116b09];var _0x5b9daa=createListener(_0xf1f9('0x5')+_0x5ecbf8,_0x14d2a1);WhatsappAccountEvents['on'](_0x5ecbf8,_0x5b9daa);}}; \ No newline at end of file +var _0xd09c=['update','removeListener','register','length','./whatsappAccount.events','remove'];(function(_0x5be581,_0xa69d1a){var _0x2b9297=function(_0x304b8f){while(--_0x304b8f){_0x5be581['push'](_0x5be581['shift']());}};_0x2b9297(++_0xa69d1a);}(_0xd09c,0x11e));var _0xcd09=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd09c[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappAccountEvents=require(_0xcd09('0x0'));var events=['save',_0xcd09('0x1'),_0xcd09('0x2')];function createListener(_0x5b363e,_0x26b8eb){return function(_0x223caf){_0x26b8eb['emit'](_0x5b363e,_0x223caf);};}function removeListener(_0x514a47,_0x5ad07d){return function(){WhatsappAccountEvents[_0xcd09('0x3')](_0x514a47,_0x5ad07d);};}exports[_0xcd09('0x4')]=function(_0xafc297){for(var _0x3d011d=0x0,_0x2d204e=events[_0xcd09('0x5')];_0x3d011d<_0x2d204e;_0x3d011d++){var _0x56fba4=events[_0x3d011d];var _0x1a721c=createListener('whatsappAccount:'+_0x56fba4,_0xafc297);WhatsappAccountEvents['on'](_0x56fba4,_0x1a721c);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index c0edc0f..a69ade5 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 _0xecc6=['index','/:id','show','post','create','put','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated'];(function(_0x590ef7,_0x175f08){var _0x4c2634=function(_0xf94570){while(--_0xf94570){_0x590ef7['push'](_0x590ef7['shift']());}};_0x4c2634(++_0x175f08);}(_0xecc6,0x172));var _0x6ecc=function(_0x20cca4,_0x5f456f){_0x20cca4=_0x20cca4-0x0;var _0x100fa4=_0xecc6[_0x20cca4];return _0x100fa4;};'use strict';var multer=require('multer');var util=require(_0x6ecc('0x0'));var path=require(_0x6ecc('0x1'));var timeout=require('connect-timeout');var express=require(_0x6ecc('0x2'));var router=express[_0x6ecc('0x3')]();var fs_extra=require(_0x6ecc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6ecc('0x5'));var config=require(_0x6ecc('0x6'));var controller=require(_0x6ecc('0x7'));router[_0x6ecc('0x8')]('/',auth[_0x6ecc('0x9')](),controller[_0x6ecc('0xa')]);router['get'](_0x6ecc('0xb'),auth[_0x6ecc('0x9')](),controller[_0x6ecc('0xc')]);router[_0x6ecc('0xd')]('/',auth[_0x6ecc('0x9')](),controller[_0x6ecc('0xe')]);router[_0x6ecc('0xf')](_0x6ecc('0xb'),auth[_0x6ecc('0x9')](),controller['update']);router[_0x6ecc('0x10')](_0x6ecc('0xb'),auth[_0x6ecc('0x9')](),controller[_0x6ecc('0x11')]);module[_0x6ecc('0x12')]=router; \ No newline at end of file +var _0x502b=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','get','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer'];(function(_0x49365d,_0x227a7c){var _0x508eaa=function(_0x4c4464){while(--_0x4c4464){_0x49365d['push'](_0x49365d['shift']());}};_0x508eaa(++_0x227a7c);}(_0x502b,0x1b7));var _0xb502=function(_0x3513a0,_0x3bdc88){_0x3513a0=_0x3513a0-0x0;var _0x2bdeb9=_0x502b[_0x3513a0];return _0x2bdeb9;};'use strict';var multer=require(_0xb502('0x0'));var util=require(_0xb502('0x1'));var path=require(_0xb502('0x2'));var timeout=require(_0xb502('0x3'));var express=require(_0xb502('0x4'));var router=express[_0xb502('0x5')]();var fs_extra=require(_0xb502('0x6'));var auth=require(_0xb502('0x7'));var interaction=require(_0xb502('0x8'));var config=require('../../config/environment');var controller=require(_0xb502('0x9'));router[_0xb502('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb502('0xa')](_0xb502('0xb'),auth[_0xb502('0xc')](),controller[_0xb502('0xd')]);router['post']('/',auth[_0xb502('0xc')](),controller[_0xb502('0xe')]);router[_0xb502('0xf')]('/:id',auth[_0xb502('0xc')](),controller[_0xb502('0x10')]);router[_0xb502('0x11')]('/:id',auth[_0xb502('0xc')](),controller[_0xb502('0x12')]);module[_0xb502('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 48e2eb8..77d249d 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 _0xed3d=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x10b304,_0x3f188e){var _0x10fb78=function(_0x5079b1){while(--_0x5079b1){_0x10b304['push'](_0x10b304['shift']());}};_0x10fb78(++_0x3f188e);}(_0xed3d,0x1ea));var _0xded3=function(_0x482283,_0x45de3a){_0x482283=_0x482283-0x0;var _0x332c7e=_0xed3d[_0x482283];return _0x332c7e;};'use strict';var Sequelize=require(_0xded3('0x0'));module[_0xded3('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xded3('0x2')],'allowNull':![],'defaultValue':_0xded3('0x3')},'appdata':{'type':Sequelize[_0xded3('0x4')]()},'description':{'type':Sequelize[_0xded3('0x2')]},'interval':{'type':Sequelize[_0xded3('0x2')],'defaultValue':_0xded3('0x5')}}; \ No newline at end of file +var _0xc550=['*,*,*,*','exports','STRING','noop','TEXT'];(function(_0x12d72c,_0x37b2f9){var _0x367399=function(_0x30f7a0){while(--_0x30f7a0){_0x12d72c['push'](_0x12d72c['shift']());}};_0x367399(++_0x37b2f9);}(_0xc550,0x15a));var _0x0c55=function(_0x10baeb,_0x1f83cf){_0x10baeb=_0x10baeb-0x0;var _0x54493e=_0xc550[_0x10baeb];return _0x54493e;};'use strict';var Sequelize=require('sequelize');module[_0x0c55('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0c55('0x1')],'allowNull':![],'defaultValue':_0x0c55('0x2')},'appdata':{'type':Sequelize[_0x0c55('0x3')]()},'description':{'type':Sequelize[_0x0c55('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x0c55('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 3223e7b..465ab15 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 _0x9219=['includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','create','body','params','request-promise','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','map','WhatsappApplication','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9219,0x19e));var _0x9921=function(_0x4efb0c,_0x235e83){_0x4efb0c=_0x4efb0c-0x0;var _0xe66fc4=_0x9219[_0x4efb0c];return _0xe66fc4;};'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(_0x9921('0x0'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9921('0x1'));var util=require('util');var path=require('path');var sox=require(_0x9921('0x2'));var csv=require(_0x9921('0x3'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9921('0x4'));var _=require(_0x9921('0x5'));var squel=require(_0x9921('0x6'));var crypto=require(_0x9921('0x7'));var jsforce=require(_0x9921('0x8'));var deskjs=require(_0x9921('0x9'));var toCsv=require(_0x9921('0x3'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9921('0xa'));var qs=require('../../components/parsers/qs');var as=require(_0x9921('0xb'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9921('0xc'));var utils=require(_0x9921('0xd'));var config=require(_0x9921('0xe'));var licenseUtil=require(_0x9921('0xf'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x415387,_0x4f1f14){_0x4f1f14=_0x4f1f14||0xcc;return function(_0x484827){if(_0x484827){return _0x415387[_0x9921('0x10')](_0x4f1f14);}return _0x415387[_0x9921('0x11')](_0x4f1f14)['end']();};}function respondWithResult(_0x38b5cd,_0x3840eb){_0x3840eb=_0x3840eb||0xc8;return function(_0x51638f){if(_0x51638f){return _0x38b5cd[_0x9921('0x11')](_0x3840eb)[_0x9921('0x12')](_0x51638f);}};}function respondWithFilteredResult(_0x12def0,_0x5114c6){return function(_0x20fca1){if(_0x20fca1){var _0x258116=typeof _0x5114c6[_0x9921('0x13')]==='undefined'&&typeof _0x5114c6[_0x9921('0x14')]===_0x9921('0x15');var _0x47cd77=_0x20fca1[_0x9921('0x16')];var _0x566838=_0x258116?0x0:_0x5114c6[_0x9921('0x13')];var _0x291874=_0x258116?_0x20fca1[_0x9921('0x16')]:_0x5114c6['offset']+_0x5114c6[_0x9921('0x14')];var _0x823824;if(_0x291874>=_0x47cd77){_0x291874=_0x47cd77;_0x823824=0xc8;}else{_0x823824=0xce;}_0x12def0[_0x9921('0x11')](_0x823824);return _0x12def0[_0x9921('0x17')](_0x9921('0x18'),_0x566838+'-'+_0x291874+'/'+_0x47cd77)[_0x9921('0x12')](_0x20fca1);}return null;};}function patchUpdates(_0x47cda8){return function(_0x26d351){try{jsonpatch[_0x9921('0x19')](_0x26d351,_0x47cda8,!![]);}catch(_0x27f246){return BPromise[_0x9921('0x1a')](_0x27f246);}return _0x26d351['save']();};}function saveUpdates(_0x24cc66,_0x3d1f40){return function(_0x24023b){if(_0x24023b){return _0x24023b[_0x9921('0x1b')](_0x24cc66)[_0x9921('0x1c')](function(_0x32c5f3){return _0x32c5f3;});}return null;};}function removeEntity(_0x7a2c31,_0x2105be){return function(_0x2bc3f7){if(_0x2bc3f7){return _0x2bc3f7[_0x9921('0x1d')]()['then'](function(){_0x7a2c31['status'](0xcc)[_0x9921('0x1e')]();});}};}function handleEntityNotFound(_0x1e7076,_0x51e115){return function(_0x5e0da7){if(!_0x5e0da7){_0x1e7076[_0x9921('0x10')](0x194);}return _0x5e0da7;};}function handleError(_0x2be1cd,_0x40eb38){_0x40eb38=_0x40eb38||0x1f4;return function(_0xfa470){logger['error'](_0xfa470[_0x9921('0x1f')]);if(_0xfa470['name']){delete _0xfa470[_0x9921('0x20')];}_0x2be1cd[_0x9921('0x11')](_0x40eb38)[_0x9921('0x21')](_0xfa470);};}exports['index']=function(_0x5e5c01,_0x59620e){var _0x115ee9={},_0x3a36c5={},_0x1607e6={'count':0x0,'rows':[]};var _0x486446=_[_0x9921('0x22')](db[_0x9921('0x23')]['rawAttributes'],function(_0x2fb165){return{'name':_0x2fb165[_0x9921('0x24')],'type':_0x2fb165[_0x9921('0x25')][_0x9921('0x26')]};});_0x3a36c5[_0x9921('0x27')]=_[_0x9921('0x22')](_0x486446,_0x9921('0x20'));_0x3a36c5[_0x9921('0x28')]=_['keys'](_0x5e5c01[_0x9921('0x28')]);_0x3a36c5[_0x9921('0x29')]=_['intersection'](_0x3a36c5[_0x9921('0x27')],_0x3a36c5[_0x9921('0x28')]);_0x115ee9[_0x9921('0x2a')]=_[_0x9921('0x2b')](_0x3a36c5[_0x9921('0x27')],qs[_0x9921('0x2c')](_0x5e5c01[_0x9921('0x28')]['fields']));_0x115ee9[_0x9921('0x2a')]=_0x115ee9[_0x9921('0x2a')][_0x9921('0x2d')]?_0x115ee9[_0x9921('0x2a')]:_0x3a36c5[_0x9921('0x27')];if(!_0x5e5c01[_0x9921('0x28')]['hasOwnProperty'](_0x9921('0x2e'))){_0x115ee9['limit']=qs['limit'](_0x5e5c01[_0x9921('0x28')][_0x9921('0x14')]);_0x115ee9[_0x9921('0x13')]=qs['offset'](_0x5e5c01[_0x9921('0x28')][_0x9921('0x13')]);}_0x115ee9[_0x9921('0x2f')]=qs['sort'](_0x5e5c01['query'][_0x9921('0x30')]);_0x115ee9[_0x9921('0x31')]=qs[_0x9921('0x29')](_[_0x9921('0x32')](_0x5e5c01[_0x9921('0x28')],_0x3a36c5[_0x9921('0x29')]),_0x486446);if(_0x5e5c01[_0x9921('0x28')][_0x9921('0x33')]){_0x115ee9[_0x9921('0x31')]=_['merge'](_0x115ee9[_0x9921('0x31')],{'$or':_[_0x9921('0x22')](_0x486446,function(_0x28ef0a){if(_0x28ef0a['type']!==_0x9921('0x34')){var _0x31b6b2={};_0x31b6b2[_0x28ef0a[_0x9921('0x20')]]={'$like':'%'+_0x5e5c01['query'][_0x9921('0x33')]+'%'};return _0x31b6b2;}})});}_0x115ee9=_[_0x9921('0x35')]({},_0x115ee9,_0x5e5c01[_0x9921('0x36')]);var _0x5e6487={'where':_0x115ee9[_0x9921('0x31')]};return db[_0x9921('0x23')][_0x9921('0x16')](_0x5e6487)['then'](function(_0x47a1c6){_0x1607e6[_0x9921('0x16')]=_0x47a1c6;if(_0x5e5c01['query'][_0x9921('0x37')]){_0x115ee9[_0x9921('0x38')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x9921('0x39')](_0x115ee9);})[_0x9921('0x1c')](function(_0x2ecf47){_0x1607e6[_0x9921('0x3a')]=_0x2ecf47;return _0x1607e6;})[_0x9921('0x1c')](respondWithFilteredResult(_0x59620e,_0x115ee9))[_0x9921('0x3b')](handleError(_0x59620e,null));};exports[_0x9921('0x3c')]=function(_0x376b19,_0x4f8ff6){var _0x59de7f={'raw':!![],'where':{'id':_0x376b19['params']['id']}},_0x4286f9={};_0x4286f9[_0x9921('0x27')]=_[_0x9921('0x3d')](db[_0x9921('0x23')][_0x9921('0x3e')]);_0x4286f9[_0x9921('0x28')]=_['keys'](_0x376b19[_0x9921('0x28')]);_0x4286f9[_0x9921('0x29')]=_[_0x9921('0x2b')](_0x4286f9[_0x9921('0x27')],_0x4286f9[_0x9921('0x28')]);_0x59de7f['attributes']=_[_0x9921('0x2b')](_0x4286f9[_0x9921('0x27')],qs['fields'](_0x376b19[_0x9921('0x28')][_0x9921('0x2c')]));_0x59de7f[_0x9921('0x2a')]=_0x59de7f['attributes'][_0x9921('0x2d')]?_0x59de7f[_0x9921('0x2a')]:_0x4286f9[_0x9921('0x27')];if(_0x376b19[_0x9921('0x28')][_0x9921('0x37')]){_0x59de7f[_0x9921('0x38')]=[{'all':!![]}];}_0x59de7f=_[_0x9921('0x35')]({},_0x59de7f,_0x376b19[_0x9921('0x36')]);return db['WhatsappApplication'][_0x9921('0x3f')](_0x59de7f)[_0x9921('0x1c')](handleEntityNotFound(_0x4f8ff6,null))[_0x9921('0x1c')](respondWithResult(_0x4f8ff6,null))['catch'](handleError(_0x4f8ff6,null));};exports[_0x9921('0x40')]=function(_0x783704,_0x1f3faa){return db['WhatsappApplication'][_0x9921('0x40')](_0x783704['body'],{})[_0x9921('0x1c')](respondWithResult(_0x1f3faa,0xc9))[_0x9921('0x3b')](handleError(_0x1f3faa,null));};exports[_0x9921('0x1b')]=function(_0x4af7ea,_0x29a1e4){if(_0x4af7ea[_0x9921('0x41')]['id']){delete _0x4af7ea['body']['id'];}return db[_0x9921('0x23')][_0x9921('0x3f')]({'where':{'id':_0x4af7ea['params']['id']}})[_0x9921('0x1c')](handleEntityNotFound(_0x29a1e4,null))[_0x9921('0x1c')](saveUpdates(_0x4af7ea['body'],null))[_0x9921('0x1c')](respondWithResult(_0x29a1e4,null))[_0x9921('0x3b')](handleError(_0x29a1e4,null));};exports[_0x9921('0x1d')]=function(_0x4c0639,_0x52c7fe){return db['WhatsappApplication'][_0x9921('0x3f')]({'where':{'id':_0x4c0639[_0x9921('0x42')]['id']}})[_0x9921('0x1c')](handleEntityNotFound(_0x52c7fe,null))[_0x9921('0x1c')](removeEntity(_0x52c7fe,null))[_0x9921('0x3b')](handleError(_0x52c7fe,null));}; \ No newline at end of file +var _0xdbb9=['destroy','stack','name','index','map','WhatsappApplication','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','update','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','save','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdbb9,0xf9));var _0x9dbb=function(_0x55e2b2,_0x1a57ac){_0x55e2b2=_0x55e2b2-0x0;var _0x28bdc4=_0xdbb9[_0x55e2b2];return _0x28bdc4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9dbb('0x0'));var zipdir=require(_0x9dbb('0x1'));var jsonpatch=require(_0x9dbb('0x2'));var rp=require(_0x9dbb('0x3'));var moment=require('moment');var BPromise=require(_0x9dbb('0x4'));var Mustache=require(_0x9dbb('0x5'));var util=require(_0x9dbb('0x6'));var path=require(_0x9dbb('0x7'));var sox=require(_0x9dbb('0x8'));var csv=require(_0x9dbb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9dbb('0xa'));var crypto=require(_0x9dbb('0xb'));var jsforce=require(_0x9dbb('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9dbb('0xd'));var Papa=require(_0x9dbb('0xe'));var Redis=require(_0x9dbb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9dbb('0x10'));var as=require(_0x9dbb('0x11'));var hardwareService=require(_0x9dbb('0x12'));var logger=require(_0x9dbb('0x13'))('api');var utils=require(_0x9dbb('0x14'));var config=require(_0x9dbb('0x15'));var licenseUtil=require(_0x9dbb('0x16'));var db=require(_0x9dbb('0x17'))['db'];function respondWithStatusCode(_0x3fe0bd,_0x4468e8){_0x4468e8=_0x4468e8||0xcc;return function(_0x382cc6){if(_0x382cc6){return _0x3fe0bd[_0x9dbb('0x18')](_0x4468e8);}return _0x3fe0bd[_0x9dbb('0x19')](_0x4468e8)[_0x9dbb('0x1a')]();};}function respondWithResult(_0x293028,_0x2c36d3){_0x2c36d3=_0x2c36d3||0xc8;return function(_0x24b20b){if(_0x24b20b){return _0x293028[_0x9dbb('0x19')](_0x2c36d3)[_0x9dbb('0x1b')](_0x24b20b);}};}function respondWithFilteredResult(_0x464df5,_0x528110){return function(_0x1366b2){if(_0x1366b2){var _0x30add1=typeof _0x528110[_0x9dbb('0x1c')]===_0x9dbb('0x1d')&&typeof _0x528110[_0x9dbb('0x1e')]==='undefined';var _0x382d61=_0x1366b2[_0x9dbb('0x1f')];var _0x2383cf=_0x30add1?0x0:_0x528110[_0x9dbb('0x1c')];var _0x45c6f5=_0x30add1?_0x1366b2['count']:_0x528110[_0x9dbb('0x1c')]+_0x528110['limit'];var _0x3de435;if(_0x45c6f5>=_0x382d61){_0x45c6f5=_0x382d61;_0x3de435=0xc8;}else{_0x3de435=0xce;}_0x464df5['status'](_0x3de435);return _0x464df5[_0x9dbb('0x20')]('Content-Range',_0x2383cf+'-'+_0x45c6f5+'/'+_0x382d61)[_0x9dbb('0x1b')](_0x1366b2);}return null;};}function patchUpdates(_0x192eb5){return function(_0x188c75){try{jsonpatch['apply'](_0x188c75,_0x192eb5,!![]);}catch(_0x50e5e3){return BPromise['reject'](_0x50e5e3);}return _0x188c75[_0x9dbb('0x21')]();};}function saveUpdates(_0x35c136,_0x48bb65){return function(_0x4a07ef){if(_0x4a07ef){return _0x4a07ef['update'](_0x35c136)[_0x9dbb('0x22')](function(_0x245d12){return _0x245d12;});}return null;};}function removeEntity(_0x10c06a,_0x55e2ef){return function(_0x1f30ec){if(_0x1f30ec){return _0x1f30ec[_0x9dbb('0x23')]()[_0x9dbb('0x22')](function(){_0x10c06a[_0x9dbb('0x19')](0xcc)[_0x9dbb('0x1a')]();});}};}function handleEntityNotFound(_0x3e51ca,_0x668f7b){return function(_0x187486){if(!_0x187486){_0x3e51ca[_0x9dbb('0x18')](0x194);}return _0x187486;};}function handleError(_0x127742,_0x25614a){_0x25614a=_0x25614a||0x1f4;return function(_0x27a6f6){logger['error'](_0x27a6f6[_0x9dbb('0x24')]);if(_0x27a6f6['name']){delete _0x27a6f6[_0x9dbb('0x25')];}_0x127742[_0x9dbb('0x19')](_0x25614a)['send'](_0x27a6f6);};}exports[_0x9dbb('0x26')]=function(_0x4ebd57,_0x4b5ce1){var _0x589f63={},_0x25555c={},_0x3578b3={'count':0x0,'rows':[]};var _0x491324=_[_0x9dbb('0x27')](db[_0x9dbb('0x28')]['rawAttributes'],function(_0x71692a){return{'name':_0x71692a[_0x9dbb('0x29')],'type':_0x71692a[_0x9dbb('0x2a')]['key']};});_0x25555c[_0x9dbb('0x2b')]=_['map'](_0x491324,_0x9dbb('0x25'));_0x25555c[_0x9dbb('0x2c')]=_[_0x9dbb('0x2d')](_0x4ebd57[_0x9dbb('0x2c')]);_0x25555c[_0x9dbb('0x2e')]=_[_0x9dbb('0x2f')](_0x25555c[_0x9dbb('0x2b')],_0x25555c[_0x9dbb('0x2c')]);_0x589f63[_0x9dbb('0x30')]=_[_0x9dbb('0x2f')](_0x25555c[_0x9dbb('0x2b')],qs['fields'](_0x4ebd57[_0x9dbb('0x2c')][_0x9dbb('0x31')]));_0x589f63[_0x9dbb('0x30')]=_0x589f63[_0x9dbb('0x30')][_0x9dbb('0x32')]?_0x589f63[_0x9dbb('0x30')]:_0x25555c[_0x9dbb('0x2b')];if(!_0x4ebd57[_0x9dbb('0x2c')][_0x9dbb('0x33')](_0x9dbb('0x34'))){_0x589f63[_0x9dbb('0x1e')]=qs[_0x9dbb('0x1e')](_0x4ebd57[_0x9dbb('0x2c')][_0x9dbb('0x1e')]);_0x589f63[_0x9dbb('0x1c')]=qs[_0x9dbb('0x1c')](_0x4ebd57[_0x9dbb('0x2c')]['offset']);}_0x589f63[_0x9dbb('0x35')]=qs[_0x9dbb('0x36')](_0x4ebd57[_0x9dbb('0x2c')]['sort']);_0x589f63[_0x9dbb('0x37')]=qs[_0x9dbb('0x2e')](_[_0x9dbb('0x38')](_0x4ebd57[_0x9dbb('0x2c')],_0x25555c[_0x9dbb('0x2e')]),_0x491324);if(_0x4ebd57[_0x9dbb('0x2c')]['filter']){_0x589f63[_0x9dbb('0x37')]=_['merge'](_0x589f63[_0x9dbb('0x37')],{'$or':_[_0x9dbb('0x27')](_0x491324,function(_0xa3bc3){if(_0xa3bc3[_0x9dbb('0x2a')]!=='VIRTUAL'){var _0x1a5eeb={};_0x1a5eeb[_0xa3bc3['name']]={'$like':'%'+_0x4ebd57[_0x9dbb('0x2c')]['filter']+'%'};return _0x1a5eeb;}})});}_0x589f63=_[_0x9dbb('0x39')]({},_0x589f63,_0x4ebd57[_0x9dbb('0x3a')]);var _0x34524e={'where':_0x589f63[_0x9dbb('0x37')]};return db[_0x9dbb('0x28')]['count'](_0x34524e)[_0x9dbb('0x22')](function(_0x59eea1){_0x3578b3[_0x9dbb('0x1f')]=_0x59eea1;if(_0x4ebd57[_0x9dbb('0x2c')][_0x9dbb('0x3b')]){_0x589f63[_0x9dbb('0x3c')]=[{'all':!![]}];}return db[_0x9dbb('0x28')][_0x9dbb('0x3d')](_0x589f63);})[_0x9dbb('0x22')](function(_0x49e63f){_0x3578b3[_0x9dbb('0x3e')]=_0x49e63f;return _0x3578b3;})['then'](respondWithFilteredResult(_0x4b5ce1,_0x589f63))[_0x9dbb('0x3f')](handleError(_0x4b5ce1,null));};exports[_0x9dbb('0x40')]=function(_0x34c114,_0x104ec5){var _0x490833={'raw':!![],'where':{'id':_0x34c114['params']['id']}},_0x2f99ed={};_0x2f99ed[_0x9dbb('0x2b')]=_['keys'](db[_0x9dbb('0x28')][_0x9dbb('0x41')]);_0x2f99ed['query']=_['keys'](_0x34c114[_0x9dbb('0x2c')]);_0x2f99ed[_0x9dbb('0x2e')]=_[_0x9dbb('0x2f')](_0x2f99ed[_0x9dbb('0x2b')],_0x2f99ed[_0x9dbb('0x2c')]);_0x490833[_0x9dbb('0x30')]=_[_0x9dbb('0x2f')](_0x2f99ed[_0x9dbb('0x2b')],qs[_0x9dbb('0x31')](_0x34c114['query'][_0x9dbb('0x31')]));_0x490833['attributes']=_0x490833[_0x9dbb('0x30')][_0x9dbb('0x32')]?_0x490833[_0x9dbb('0x30')]:_0x2f99ed[_0x9dbb('0x2b')];if(_0x34c114['query'][_0x9dbb('0x3b')]){_0x490833['include']=[{'all':!![]}];}_0x490833=_['merge']({},_0x490833,_0x34c114[_0x9dbb('0x3a')]);return db[_0x9dbb('0x28')][_0x9dbb('0x42')](_0x490833)[_0x9dbb('0x22')](handleEntityNotFound(_0x104ec5,null))[_0x9dbb('0x22')](respondWithResult(_0x104ec5,null))[_0x9dbb('0x3f')](handleError(_0x104ec5,null));};exports['create']=function(_0x202235,_0x56d319){return db[_0x9dbb('0x28')][_0x9dbb('0x43')](_0x202235[_0x9dbb('0x44')],{})[_0x9dbb('0x22')](respondWithResult(_0x56d319,0xc9))[_0x9dbb('0x3f')](handleError(_0x56d319,null));};exports[_0x9dbb('0x45')]=function(_0x34304a,_0x31c532){if(_0x34304a['body']['id']){delete _0x34304a[_0x9dbb('0x44')]['id'];}return db['WhatsappApplication'][_0x9dbb('0x42')]({'where':{'id':_0x34304a[_0x9dbb('0x46')]['id']}})['then'](handleEntityNotFound(_0x31c532,null))[_0x9dbb('0x22')](saveUpdates(_0x34304a['body'],null))['then'](respondWithResult(_0x31c532,null))['catch'](handleError(_0x31c532,null));};exports[_0x9dbb('0x23')]=function(_0x3c19bb,_0x5c398b){return db[_0x9dbb('0x28')]['find']({'where':{'id':_0x3c19bb[_0x9dbb('0x46')]['id']}})[_0x9dbb('0x22')](handleEntityNotFound(_0x5c398b,null))[_0x9dbb('0x22')](removeEntity(_0x5c398b,null))[_0x9dbb('0x3f')](handleError(_0x5c398b,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index d54143e..2b87073 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 _0x8ce1=['WhatsappApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define'];(function(_0xa11023,_0x1509fe){var _0x5ec706=function(_0x582127){while(--_0x582127){_0xa11023['push'](_0xa11023['shift']());}};_0x5ec706(++_0x1509fe);}(_0x8ce1,0x183));var _0x18ce=function(_0x58d596,_0x8fa3c){_0x58d596=_0x58d596-0x0;var _0x34c840=_0x8ce1[_0x58d596];return _0x34c840;};'use strict';var _=require(_0x18ce('0x0'));var util=require(_0x18ce('0x1'));var logger=require(_0x18ce('0x2'))(_0x18ce('0x3'));var moment=require(_0x18ce('0x4'));var BPromise=require(_0x18ce('0x5'));var rp=require(_0x18ce('0x6'));var fs=require('fs');var path=require(_0x18ce('0x7'));var rimraf=require(_0x18ce('0x8'));var config=require(_0x18ce('0x9'));var attributes=require(_0x18ce('0xa'));module[_0x18ce('0xb')]=function(_0x13ff9d,_0x36f8db){return _0x13ff9d[_0x18ce('0xc')](_0x18ce('0xd'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x18ce('0xe'),'collate':_0x18ce('0xf')});}; \ No newline at end of file +var _0x24ca=['request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment'];(function(_0x16ed87,_0x1be1a2){var _0xc1a1d8=function(_0x3c0fcf){while(--_0x3c0fcf){_0x16ed87['push'](_0x16ed87['shift']());}};_0xc1a1d8(++_0x1be1a2);}(_0x24ca,0x1bc));var _0xa24c=function(_0x420b24,_0x382adc){_0x420b24=_0x420b24-0x0;var _0x4da552=_0x24ca[_0x420b24];return _0x4da552;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var logger=require(_0xa24c('0x1'))(_0xa24c('0x2'));var moment=require(_0xa24c('0x3'));var BPromise=require('bluebird');var rp=require(_0xa24c('0x4'));var fs=require('fs');var path=require(_0xa24c('0x5'));var rimraf=require(_0xa24c('0x6'));var config=require(_0xa24c('0x7'));var attributes=require(_0xa24c('0x8'));module[_0xa24c('0x9')]=function(_0xf0511,_0x3c0aaa){return _0xf0511[_0xa24c('0xa')](_0xa24c('0xb'),attributes,{'tableName':_0xa24c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xa24c('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index dad092c..b3f2304 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 _0xb821=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','ioredis'];(function(_0x11f8ab,_0x14c79c){var _0xe10e93=function(_0x4b4c66){while(--_0x4b4c66){_0x11f8ab['push'](_0x11f8ab['shift']());}};_0xe10e93(++_0x14c79c);}(_0xb821,0xa7));var _0x1b82=function(_0x462073,_0x218a1e){_0x462073=_0x462073-0x0;var _0x27e3dd=_0xb821[_0x462073];return _0x27e3dd;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b82('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b82('0x3'))(_0x1b82('0x4'));var config=require(_0x1b82('0x5'));var jayson=require(_0x1b82('0x6'));var client=jayson['client'][_0x1b82('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x192434,_0x202a5f,_0x3632dd){return new BPromise(function(_0x18f45f,_0x7b87e8){return client[_0x1b82('0x8')](_0x192434,_0x3632dd)[_0x1b82('0x9')](function(_0x141673){logger['info'](_0x1b82('0xa'),_0x202a5f,_0x1b82('0xb'));logger[_0x1b82('0xc')](_0x1b82('0xd'),_0x202a5f,_0x1b82('0xb'),JSON[_0x1b82('0xe')](_0x141673));if(_0x141673[_0x1b82('0xf')]){if(_0x141673[_0x1b82('0xf')]['code']===0x1f4){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);return _0x7b87e8(_0x141673['error'][_0x1b82('0x10')]);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x202a5f,_0x141673[_0x1b82('0xf')]['message']);return _0x18f45f(_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);}else{logger['info'](_0x1b82('0xa'),_0x202a5f,'request\x20sent');_0x18f45f(_0x141673['result'][_0x1b82('0x10')]);}})['catch'](function(_0x111247){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x111247);_0x7b87e8(_0x111247);});});} \ No newline at end of file +var _0x0e85=['bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x355515,_0x1e9fa1){var _0x3216c7=function(_0x2153ae){while(--_0x2153ae){_0x355515['push'](_0x355515['shift']());}};_0x3216c7(++_0x1e9fa1);}(_0x0e85,0x7c));var _0x50e8=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x0e85[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var moment=require('moment');var BPromise=require(_0x50e8('0x2'));var rs=require(_0x50e8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x50e8('0x4'))('rpc');var config=require(_0x50e8('0x5'));var jayson=require(_0x50e8('0x6'));var client=jayson[_0x50e8('0x7')][_0x50e8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e8b01,_0x3ce904,_0x108edc){return new BPromise(function(_0x42665e,_0x988da0){return client[_0x50e8('0x9')](_0x5e8b01,_0x108edc)[_0x50e8('0xa')](function(_0x5825f5){logger[_0x50e8('0xb')](_0x50e8('0xc'),_0x3ce904,_0x50e8('0xd'));logger[_0x50e8('0xe')](_0x50e8('0xf'),_0x3ce904,_0x50e8('0xd'),JSON[_0x50e8('0x10')](_0x5825f5));if(_0x5825f5[_0x50e8('0x11')]){if(_0x5825f5['error']['code']===0x1f4){logger[_0x50e8('0x11')](_0x50e8('0xc'),_0x3ce904,_0x5825f5['error']['message']);return _0x988da0(_0x5825f5[_0x50e8('0x11')][_0x50e8('0x12')]);}logger[_0x50e8('0x11')](_0x50e8('0xc'),_0x3ce904,_0x5825f5['error'][_0x50e8('0x12')]);return _0x42665e(_0x5825f5[_0x50e8('0x11')][_0x50e8('0x12')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x3ce904,_0x50e8('0xd'));_0x42665e(_0x5825f5[_0x50e8('0x13')][_0x50e8('0x12')]);}})[_0x50e8('0x14')](function(_0x211731){logger[_0x50e8('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x3ce904,_0x211731);_0x988da0(_0x211731);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index fb4a54d..3f09328 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 _0xe3da=['post','create','addMessage','/:id/tags','tracked','whatsapp','addTags','put','/:id','update','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages'];(function(_0xac8f37,_0x421df5){var _0x32b646=function(_0x671212){while(--_0x671212){_0xac8f37['push'](_0xac8f37['shift']());}};_0x32b646(++_0x421df5);}(_0xe3da,0x1cd));var _0xae3d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe3da[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var path=require(_0xae3d('0x2'));var timeout=require(_0xae3d('0x3'));var express=require(_0xae3d('0x4'));var router=express[_0xae3d('0x5')]();var fs_extra=require(_0xae3d('0x6'));var auth=require(_0xae3d('0x7'));var interaction=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var controller=require(_0xae3d('0xa'));router[_0xae3d('0xb')]('/',auth[_0xae3d('0xc')](),controller[_0xae3d('0xd')]);router[_0xae3d('0xb')](_0xae3d('0xe'),auth['isAuthenticated'](),controller[_0xae3d('0xf')]);router[_0xae3d('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xae3d('0x10')]);router[_0xae3d('0xb')](_0xae3d('0x11'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x12')]);router[_0xae3d('0xb')]('/:id/download',auth[_0xae3d('0xc')](),controller['download']);router[_0xae3d('0x13')]('/',auth[_0xae3d('0xc')](),controller[_0xae3d('0x14')]);router[_0xae3d('0x13')]('/:id/messages',auth[_0xae3d('0xc')](),controller[_0xae3d('0x15')]);router[_0xae3d('0x13')](_0xae3d('0x16'),auth[_0xae3d('0xc')](),interaction[_0xae3d('0x17')](_0xae3d('0x18'),'whatsappinteraction:addtags'),controller[_0xae3d('0x19')]);router[_0xae3d('0x1a')](_0xae3d('0x1b'),auth[_0xae3d('0xc')](),interaction[_0xae3d('0x17')](_0xae3d('0x18'),'whatsappinteraction:update'),controller[_0xae3d('0x1c')]);router[_0xae3d('0x1d')](_0xae3d('0x1b'),auth['isAuthenticated'](),interaction[_0xae3d('0x17')](_0xae3d('0x18'),'whatsappinteraction:destroy'),controller['destroy']);router[_0xae3d('0x1d')](_0xae3d('0x16'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x1e')]);module[_0xae3d('0x1f')]=router; \ No newline at end of file +var _0x25fa=['update','delete','whatsappinteraction:destroy','removeTags','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update'];(function(_0x56323a,_0x36b29c){var _0x2606af=function(_0x55e103){while(--_0x55e103){_0x56323a['push'](_0x56323a['shift']());}};_0x2606af(++_0x36b29c);}(_0x25fa,0x109));var _0xa25f=function(_0x254a99,_0x90ae06){_0x254a99=_0x254a99-0x0;var _0x52882f=_0x25fa[_0x254a99];return _0x52882f;};'use strict';var multer=require(_0xa25f('0x0'));var util=require('util');var path=require(_0xa25f('0x1'));var timeout=require(_0xa25f('0x2'));var express=require('express');var router=express[_0xa25f('0x3')]();var fs_extra=require(_0xa25f('0x4'));var auth=require(_0xa25f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa25f('0x6'));router['get']('/',auth[_0xa25f('0x7')](),controller[_0xa25f('0x8')]);router[_0xa25f('0x9')](_0xa25f('0xa'),auth[_0xa25f('0x7')](),controller[_0xa25f('0xb')]);router[_0xa25f('0x9')](_0xa25f('0xc'),auth[_0xa25f('0x7')](),controller['show']);router[_0xa25f('0x9')](_0xa25f('0xd'),auth['isAuthenticated'](),controller[_0xa25f('0xe')]);router[_0xa25f('0x9')](_0xa25f('0xf'),auth[_0xa25f('0x7')](),controller['download']);router[_0xa25f('0x10')]('/',auth[_0xa25f('0x7')](),controller['create']);router[_0xa25f('0x10')](_0xa25f('0xd'),auth['isAuthenticated'](),controller[_0xa25f('0x11')]);router[_0xa25f('0x10')](_0xa25f('0x12'),auth[_0xa25f('0x7')](),interaction[_0xa25f('0x13')](_0xa25f('0x14'),_0xa25f('0x15')),controller[_0xa25f('0x16')]);router[_0xa25f('0x17')](_0xa25f('0xc'),auth[_0xa25f('0x7')](),interaction[_0xa25f('0x13')]('whatsapp',_0xa25f('0x18')),controller[_0xa25f('0x19')]);router[_0xa25f('0x1a')](_0xa25f('0xc'),auth[_0xa25f('0x7')](),interaction[_0xa25f('0x13')]('whatsapp',_0xa25f('0x1b')),controller['destroy']);router[_0xa25f('0x1a')]('/:id/tags',auth['isAuthenticated'](),controller[_0xa25f('0x1c')]);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 458eee5..4d96457 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 _0x8f1a=['BOOLEAN','DATE','STRING','out','INTEGER','sequelize','moment','exports'];(function(_0x26cbc2,_0x5491e3){var _0x56f9a0=function(_0x21f0db){while(--_0x21f0db){_0x26cbc2['push'](_0x26cbc2['shift']());}};_0x56f9a0(++_0x5491e3);}(_0x8f1a,0xcd));var _0xa8f1=function(_0x329f20,_0x5dd5d9){_0x329f20=_0x329f20-0x0;var _0x26f134=_0x8f1a[_0x329f20];return _0x26f134;};'use strict';var Sequelize=require(_0xa8f1('0x0'));var moment=require(_0xa8f1('0x1'));module[_0xa8f1('0x2')]={'closed':{'type':Sequelize[_0xa8f1('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa8f1('0x4')]},'disposition':{'type':Sequelize[_0xa8f1('0x5')]},'secondDisposition':{'type':Sequelize[_0xa8f1('0x5')]},'thirdDisposition':{'type':Sequelize[_0xa8f1('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xa8f1('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xa8f1('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa8f1('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa8f1('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa8f1('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xa8f1('0x7')]}}; \ No newline at end of file +var _0xaf6e=['sequelize','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x747086,_0x34241f){var _0x2dc2c9=function(_0x5b3c76){while(--_0x5b3c76){_0x747086['push'](_0x747086['shift']());}};_0x2dc2c9(++_0x34241f);}(_0xaf6e,0x16e));var _0xeaf6=function(_0x3eae87,_0x3a0f7c){_0x3eae87=_0x3eae87-0x0;var _0x14db70=_0xaf6e[_0x3eae87];return _0x14db70;};'use strict';var Sequelize=require(_0xeaf6('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0xeaf6('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xeaf6('0x2')]},'disposition':{'type':Sequelize[_0xeaf6('0x3')]},'secondDisposition':{'type':Sequelize[_0xeaf6('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xeaf6('0x3')]},'phone':{'type':Sequelize[_0xeaf6('0x3')]},'read1stAt':{'type':Sequelize[_0xeaf6('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xeaf6('0x4')]('in',_0xeaf6('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xeaf6('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 95d7280..50e336d 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 _0xda7d=['catch','create','body','describe','addMessage','ids','omit','findOne','WhatsappMessage','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','addTags','setTags','spread','Tag','color','emit','whatsappInteractionTags:save','unix','join','files','tmp','root','server','attachments','transcript-%d-%s.zip','push','User','CmContact','firstName','lastName','Attachment','direction','secret','read','WhatsappAccount','Account','get','mkdirSync','Whatsapp','Owner','fullname','N.A.','createdAt','closed','closedAt','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','toString','Contact','out','views','downloadInteraction.ejs','transcript-','.pdf','download','log','err','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./whatsappInteraction.socket','register','status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','sendStatus','error','stack','name','index','map','WhatsappInteraction','rawAttributes','fieldName','type','getOptions','findAll','user','show','params','model','keys','query','intersection','attributes','fields','length','include','merge','find'];(function(_0x28d391,_0x1357b3){var _0x3c8bf0=function(_0x55bac9){while(--_0x55bac9){_0x28d391['push'](_0x28d391['shift']());}};_0x3c8bf0(++_0x1357b3);}(_0xda7d,0x145));var _0xdda7=function(_0x962edb,_0x5dd356){_0x962edb=_0x962edb-0x0;var _0x359dcf=_0xda7d[_0x962edb];return _0x359dcf;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xdda7('0x0'));var moment=require(_0xdda7('0x1'));var BPromise=require(_0xdda7('0x2'));var util=require(_0xdda7('0x3'));var path=require(_0xdda7('0x4'));var ejs=require(_0xdda7('0x5'));var fs=require('fs');var _=require(_0xdda7('0x6'));var Redis=require(_0xdda7('0x7'));var interaction=require(_0xdda7('0x8'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0xdda7('0x9'))(_0xdda7('0xa'));var config=require(_0xdda7('0xb'));var db=require(_0xdda7('0xc'))['db'];config[_0xdda7('0xd')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xdda7('0xe'))(new Redis(config[_0xdda7('0xd')]));require(_0xdda7('0xf'))[_0xdda7('0x10')](socket);function respondWithStatusCode(_0x4f0e12,_0x52e0cc){_0x52e0cc=_0x52e0cc||0xcc;return function(_0x307c10){if(_0x307c10){return _0x4f0e12['sendStatus'](_0x52e0cc);}return _0x4f0e12[_0xdda7('0x11')](_0x52e0cc)['end']();};}function respondWithResult(_0x38c4a8,_0xfd6b25){_0xfd6b25=_0xfd6b25||0xc8;return function(_0x2c4ee1){if(_0x2c4ee1){return _0x38c4a8[_0xdda7('0x11')](_0xfd6b25)['json'](_0x2c4ee1);}};}function respondWithFilteredResult(_0x1be32e,_0x348727){return function(_0x597d45){if(_0x597d45){var _0x42b0e6=typeof _0x348727[_0xdda7('0x12')]===_0xdda7('0x13')&&typeof _0x348727[_0xdda7('0x14')]==='undefined';var _0x4d88fb=_0x597d45['count'];var _0x2afc7e=_0x42b0e6?0x0:_0x348727[_0xdda7('0x12')];var _0x196d85=_0x42b0e6?_0x597d45[_0xdda7('0x15')]:_0x348727[_0xdda7('0x12')]+_0x348727[_0xdda7('0x14')];var _0x4cbcf7;if(_0x196d85>=_0x4d88fb){_0x196d85=_0x4d88fb;_0x4cbcf7=0xc8;}else{_0x4cbcf7=0xce;}_0x1be32e[_0xdda7('0x11')](_0x4cbcf7);return _0x1be32e[_0xdda7('0x16')](_0xdda7('0x17'),_0x2afc7e+'-'+_0x196d85+'/'+_0x4d88fb)[_0xdda7('0x18')](_0x597d45);}return null;};}function saveUpdates(_0x26abce){return function(_0x23f026){if(_0x23f026){return _0x23f026[_0xdda7('0x19')](_0x26abce)[_0xdda7('0x1a')](function(_0x4f1296){return _0x4f1296;});}return null;};}function removeEntity(_0xeb15d2){return function(_0x2dfef0){if(_0x2dfef0){return _0x2dfef0[_0xdda7('0x1b')]()[_0xdda7('0x1a')](function(){_0xeb15d2[_0xdda7('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22dae1){return function(_0x2f199f){if(!_0x2f199f){_0x22dae1[_0xdda7('0x1c')](0x194);}return _0x2f199f;};}function handleError(_0x2811d0,_0x39e3bd){_0x39e3bd=_0x39e3bd||0x1f4;return function(_0x3a5a49){logger[_0xdda7('0x1d')](_0x3a5a49[_0xdda7('0x1e')]);if(_0x3a5a49['name']){delete _0x3a5a49[_0xdda7('0x1f')];}_0x2811d0[_0xdda7('0x11')](_0x39e3bd)['send'](_0x3a5a49);};}exports[_0xdda7('0x20')]=function(_0x33ef90,_0x3998ad){var _0x2f4454={};var _0x283490=_[_0xdda7('0x21')](db[_0xdda7('0x22')][_0xdda7('0x23')],function(_0x3ad5c6){return{'name':_0x3ad5c6[_0xdda7('0x24')],'type':_0x3ad5c6[_0xdda7('0x25')]['key']};});_0x2f4454=qs[_0xdda7('0x26')](_0x283490,_0x33ef90);return interaction[_0xdda7('0x27')]('whatsapp',_0x33ef90['query'],_0x33ef90[_0xdda7('0x28')],_0x2f4454,_0x283490)[_0xdda7('0x1a')](respondWithFilteredResult(_0x3998ad,_0x2f4454))['catch'](handleError(_0x3998ad,null));};exports[_0xdda7('0x29')]=function(_0x1cdccd,_0x1b516c){var _0x5122b4={'raw':![],'where':{'id':_0x1cdccd[_0xdda7('0x2a')]['id']}},_0x14fb92={};_0x14fb92[_0xdda7('0x2b')]=_[_0xdda7('0x2c')](db[_0xdda7('0x22')]['rawAttributes']);_0x14fb92[_0xdda7('0x2d')]=_[_0xdda7('0x2c')](_0x1cdccd[_0xdda7('0x2d')]);_0x14fb92['filters']=_[_0xdda7('0x2e')](_0x14fb92[_0xdda7('0x2b')],_0x14fb92['query']);_0x5122b4[_0xdda7('0x2f')]=_[_0xdda7('0x2e')](_0x14fb92[_0xdda7('0x2b')],qs['fields'](_0x1cdccd[_0xdda7('0x2d')][_0xdda7('0x30')]));_0x5122b4[_0xdda7('0x2f')]=_0x5122b4[_0xdda7('0x2f')][_0xdda7('0x31')]?_0x5122b4[_0xdda7('0x2f')]:_0x14fb92['model'];if(_0x1cdccd[_0xdda7('0x2d')]['includeAll']){_0x5122b4[_0xdda7('0x32')]=[{'all':!![]}];}_0x5122b4=_[_0xdda7('0x33')]({},_0x5122b4,_0x1cdccd['options']);return db[_0xdda7('0x22')][_0xdda7('0x34')](_0x5122b4)[_0xdda7('0x1a')](handleEntityNotFound(_0x1b516c,null))[_0xdda7('0x1a')](respondWithResult(_0x1b516c,null))[_0xdda7('0x35')](handleError(_0x1b516c,null));};exports[_0xdda7('0x36')]=function(_0x18b720,_0x83000b){return db[_0xdda7('0x22')][_0xdda7('0x36')](_0x18b720[_0xdda7('0x37')],{})['then'](respondWithResult(_0x83000b,0xc9))[_0xdda7('0x35')](handleError(_0x83000b,null));};exports[_0xdda7('0x19')]=function(_0x24ae11,_0x38a0f0){if(_0x24ae11[_0xdda7('0x37')]['id']){delete _0x24ae11[_0xdda7('0x37')]['id'];}return db[_0xdda7('0x22')]['find']({'where':{'id':_0x24ae11[_0xdda7('0x2a')]['id']}})[_0xdda7('0x1a')](handleEntityNotFound(_0x38a0f0,null))['then'](saveUpdates(_0x24ae11[_0xdda7('0x37')],null))['then'](respondWithResult(_0x38a0f0,null))[_0xdda7('0x35')](handleError(_0x38a0f0,null));};exports[_0xdda7('0x1b')]=function(_0x4c5172,_0x11fc82){return db[_0xdda7('0x22')][_0xdda7('0x34')]({'where':{'id':_0x4c5172[_0xdda7('0x2a')]['id']}})[_0xdda7('0x1a')](handleEntityNotFound(_0x11fc82,null))[_0xdda7('0x1a')](removeEntity(_0x11fc82,null))['catch'](handleError(_0x11fc82,null));};exports[_0xdda7('0x38')]=function(_0x2a0228,_0x56a3d9){return db['WhatsappInteraction']['describe']()['then'](respondWithResult(_0x56a3d9,null))['catch'](handleError(_0x56a3d9,null));};exports[_0xdda7('0x39')]=function(_0x3c3bfd,_0x18dbc1){return db['WhatsappMessage'][_0xdda7('0x34')]({'where':{'id':_0x3c3bfd['params']['id']}})[_0xdda7('0x1a')](handleEntityNotFound(_0x18dbc1,null))[_0xdda7('0x1a')](function(_0x37c17f){if(_0x37c17f){return _0x37c17f[_0xdda7('0x39')](_0x3c3bfd[_0xdda7('0x37')][_0xdda7('0x3a')],_[_0xdda7('0x3b')](_0x3c3bfd[_0xdda7('0x37')],['ids','id'])||{});}})['then'](respondWithResult(_0x18dbc1,null))[_0xdda7('0x35')](handleError(_0x18dbc1,null));};exports['getMessages']=function(_0x329a8d,_0x135f17){var _0xabb0bb={'raw':![],'where':{}};var _0x2f05f6={};var _0x33e64c={'count':0x0,'rows':[]};return db[_0xdda7('0x22')][_0xdda7('0x3c')]({'where':{'id':_0x329a8d[_0xdda7('0x2a')]['id']}})[_0xdda7('0x1a')](handleEntityNotFound(_0x135f17,null))[_0xdda7('0x1a')](function(_0x7807da){if(_0x7807da){_0x2f05f6[_0xdda7('0x2b')]=_[_0xdda7('0x2c')](db[_0xdda7('0x3d')]['rawAttributes']);_0x2f05f6[_0xdda7('0x2d')]=_[_0xdda7('0x2c')](_0x329a8d[_0xdda7('0x2d')]);_0x2f05f6['filters']=_[_0xdda7('0x2e')](_0x2f05f6[_0xdda7('0x2b')],_0x2f05f6[_0xdda7('0x2d')]);_0xabb0bb[_0xdda7('0x2f')]=_[_0xdda7('0x2e')](_0x2f05f6[_0xdda7('0x2b')],qs['fields'](_0x329a8d['query'][_0xdda7('0x30')]));_0xabb0bb['attributes']=_0xabb0bb[_0xdda7('0x2f')]['length']?_0xabb0bb['attributes']:_0x2f05f6[_0xdda7('0x2b')];if(!_0x329a8d['query'][_0xdda7('0x3e')](_0xdda7('0x3f'))){_0xabb0bb[_0xdda7('0x14')]=qs[_0xdda7('0x14')](_0x329a8d[_0xdda7('0x2d')][_0xdda7('0x14')]);_0xabb0bb[_0xdda7('0x12')]=qs['offset'](_0x329a8d[_0xdda7('0x2d')][_0xdda7('0x12')]);}_0xabb0bb[_0xdda7('0x40')]=qs[_0xdda7('0x41')](_0x329a8d[_0xdda7('0x2d')][_0xdda7('0x41')]);_0xabb0bb[_0xdda7('0x42')]=qs[_0xdda7('0x43')](_[_0xdda7('0x44')](_0x329a8d[_0xdda7('0x2d')],_0x2f05f6['filters']));_0xabb0bb[_0xdda7('0x42')]['WhatsappInteractionId']=_0x7807da['id'];if(_0x329a8d['query'][_0xdda7('0x45')]){_0xabb0bb['where']=_[_0xdda7('0x33')](_0xabb0bb[_0xdda7('0x42')],{'$or':_[_0xdda7('0x21')](_0xabb0bb['attributes'],function(_0x2199e8){var _0x84c7b2={};_0x84c7b2[_0x2199e8]={'$like':'%'+_0x329a8d[_0xdda7('0x2d')][_0xdda7('0x45')]+'%'};return _0x84c7b2;})});}if(_0x329a8d['query'][_0xdda7('0x46')]){var _0x3a326c=_0x329a8d['query'][_0xdda7('0x46')][_0xdda7('0x47')](',');var _0x1a898c={};_0x1a898c[_0x3a326c[0x0]]={'$gte':moment(_0x3a326c[0x1])[_0xdda7('0x48')](_0xdda7('0x49'))};_0xabb0bb[_0xdda7('0x42')]=_[_0xdda7('0x33')](_0xabb0bb[_0xdda7('0x42')],_0x1a898c);}_0xabb0bb=_['merge']({},_0xabb0bb,_0x329a8d['options']);return db['WhatsappMessage'][_0xdda7('0x15')]({'where':_0xabb0bb[_0xdda7('0x42')]})['then'](function(_0x52e2c4){_0x33e64c[_0xdda7('0x15')]=_0x52e2c4;if(_0x329a8d[_0xdda7('0x2d')][_0xdda7('0x4a')]){_0xabb0bb['include']=[{'all':!![]}];}return db[_0xdda7('0x3d')][_0xdda7('0x27')](_0xabb0bb);})['then'](function(_0x4dbcce){_0x33e64c['rows']=_0x4dbcce;return _0x33e64c;});}})['then'](respondWithFilteredResult(_0x135f17,_0xabb0bb))[_0xdda7('0x35')](handleError(_0x135f17,null));};exports[_0xdda7('0x4b')]=function(_0x164a45,_0x43b1e5){return db['WhatsappInteraction'][_0xdda7('0x34')]({'where':{'id':_0x164a45[_0xdda7('0x2a')]['id']}})[_0xdda7('0x1a')](handleEntityNotFound(_0x43b1e5,null))['then'](function(_0x4dacc8){if(_0x4dacc8){return _0x4dacc8[_0xdda7('0x4c')](_0x164a45[_0xdda7('0x37')][_0xdda7('0x3a')],_[_0xdda7('0x3b')](_0x164a45[_0xdda7('0x37')],[_0xdda7('0x3a'),'id'])||{})[_0xdda7('0x4d')](function(){return db[_0xdda7('0x4e')][_0xdda7('0x27')]({'attributes':['id','name',_0xdda7('0x4f')],'where':{'id':_0x164a45[_0xdda7('0x37')]['ids']}});})[_0xdda7('0x1a')](function(_0x5d42cb){socket[_0xdda7('0x50')](_0xdda7('0x51'),{'id':Number(_0x164a45['params']['id']),'tags':_0x5d42cb||[]});return{'id':Number(_0x164a45[_0xdda7('0x2a')]['id']),'tags':_0x5d42cb||[]};});}})[_0xdda7('0x1a')](respondWithResult(_0x43b1e5,null))[_0xdda7('0x35')](handleError(_0x43b1e5,null));};exports['removeTags']=function(_0x1b6761,_0x47c82f){return db[_0xdda7('0x22')]['find']({'where':{'id':_0x1b6761[_0xdda7('0x2a')]['id']}})[_0xdda7('0x1a')](handleEntityNotFound(_0x47c82f,null))[_0xdda7('0x1a')](function(_0xeb7731){if(_0xeb7731){return _0xeb7731['removeTags'](_0x1b6761[_0xdda7('0x2d')]['ids']);}})[_0xdda7('0x1a')](respondWithStatusCode(_0x47c82f,null))[_0xdda7('0x35')](handleError(_0x47c82f,null));};exports['download']=function(_0xe74197,_0x3e1981){var _0x4305cd=moment()[_0xdda7('0x52')]()['toString']();var _0x2d8077=path[_0xdda7('0x53')](config['root'],'server',_0xdda7('0x54'),_0xdda7('0x55'));var _0x5bedeb=path[_0xdda7('0x53')](config[_0xdda7('0x56')],_0xdda7('0x57'),_0xdda7('0x54'),_0xdda7('0x58'));var _0x3f509f=path[_0xdda7('0x53')](_0x2d8077,_0x4305cd);var _0xfba3e3=util[_0xdda7('0x48')](_0xdda7('0x59'),_0xe74197[_0xdda7('0x2a')]['id'],_0x4305cd);var _0x50cb03=path[_0xdda7('0x53')](_0x2d8077,_0xfba3e3);var _0x1ff5d2=[];_0x1ff5d2[_0xdda7('0x5a')]({'model':db[_0xdda7('0x5b')],'as':_0xdda7('0x5b'),'attributes':['id','fullname'],'raw':!![]});_0x1ff5d2[_0xdda7('0x5a')]({'model':db[_0xdda7('0x5c')],'as':'Contact','attributes':['id',_0xdda7('0x5d'),_0xdda7('0x5e')],'raw':!![]});if(_0xe74197['query']['attachments']){_0x1ff5d2[_0xdda7('0x5a')]({'model':db['Attachment'],'as':_0xdda7('0x5f'),'raw':!![]});}var _0x1c386c=[{'model':db[_0xdda7('0x3d')],'as':'Messages','attributes':['id','body','createdAt',_0xdda7('0x60'),_0xdda7('0x61'),_0xdda7('0x62')],'include':_0x1ff5d2}];_0x1c386c[_0xdda7('0x5a')]({'model':db[_0xdda7('0x63')],'as':_0xdda7('0x64'),'attributes':['id','name']});_0x1c386c['push']({'model':db[_0xdda7('0x5b')],'as':'Owner','attributes':['id','fullname']});return db[_0xdda7('0x22')][_0xdda7('0x34')]({'where':{'id':_0xe74197[_0xdda7('0x2a')]['id']},'include':_0x1c386c})['then'](handleEntityNotFound(_0x3e1981,null))['then'](function(_0x27acf6){if(_0x27acf6){var _0x15fabb=_0x27acf6[_0xdda7('0x65')]({'plain':!![]});fs[_0xdda7('0x66')](_0x3f509f);var _0x21cd84={'channel':_0xdda7('0x67'),'account':_0x15fabb[_0xdda7('0x64')][_0xdda7('0x1f')],'agent':_0x15fabb[_0xdda7('0x68')]?_0x15fabb[_0xdda7('0x68')][_0xdda7('0x69')]:_0xdda7('0x6a'),'createdAt':moment(_0x15fabb[_0xdda7('0x6b')])[_0xdda7('0x48')](_0xdda7('0x49'))['toString'](),'closedAt':_0x15fabb[_0xdda7('0x6c')]?moment(_0x15fabb[_0xdda7('0x6d')])[_0xdda7('0x48')](_0xdda7('0x49'))['toString']():'','disposition':_0x15fabb['disposition'],'messages':_(_0x15fabb[_0xdda7('0x6e')])[_0xdda7('0x45')]({'secret':![]})[_0xdda7('0x21')](function(_0x3b2492){if(_0x3b2492[_0xdda7('0x5f')]){var _0x4747=path[_0xdda7('0x53')](_0x5bedeb,_0x3b2492[_0xdda7('0x5f')][_0xdda7('0x6f')]);if(fs[_0xdda7('0x70')](_0x4747)){fs[_0xdda7('0x71')](_0x4747)[_0xdda7('0x72')](fs[_0xdda7('0x73')](path['join'](_0x3f509f,_0x3b2492[_0xdda7('0x5f')][_0xdda7('0x6f')])));}}return{'date':moment(_0x3b2492[_0xdda7('0x6b')])[_0xdda7('0x48')](_0xdda7('0x49'))[_0xdda7('0x74')](),'sender':_0x3b2492['direction']==='out'?_0x3b2492[_0xdda7('0x5b')]?_0x3b2492[_0xdda7('0x5b')][_0xdda7('0x69')]:'System':_0x3b2492['Contact'][_0xdda7('0x5d')]+(_0x3b2492[_0xdda7('0x75')][_0xdda7('0x5e')]?'\x20'+_0x3b2492[_0xdda7('0x75')][_0xdda7('0x5e')]:''),'body':_0x3b2492[_0xdda7('0x5f')]?_0x3b2492[_0xdda7('0x5f')]['basename']:_0x3b2492[_0xdda7('0x37')],'direction':_0x3b2492[_0xdda7('0x60')]===_0xdda7('0x76')?'A':'C','secret':_0x3b2492[_0xdda7('0x61')],'read':_0x3b2492[_0xdda7('0x62')],'attachment':_0x3b2492[_0xdda7('0x5f')]};})['value']()};return ejs['renderFile'](path[_0xdda7('0x53')](config[_0xdda7('0x56')],'server',_0xdda7('0x77'),_0xdda7('0x78')),{'interaction':_0x21cd84})[_0xdda7('0x1a')](function(_0x24db79){var _0x3ffb96=path[_0xdda7('0x53')](_0x3f509f,_0xdda7('0x79')+_0x15fabb['id']+'-'+_0x4305cd+_0xdda7('0x7a'));var _0x2fde5c={'path':_0x3ffb96,'channel':_0xdda7('0x67'),'interactionId':_0x15fabb['id']};return pdf['createPdfFromHTML'](_0x24db79,_0x2fde5c);})[_0xdda7('0x1a')](function(){return new BPromise(function(_0x448967,_0x3a164b){zipdir(_0x3f509f,{'saveTo':_0x50cb03},function(_0x3a8464,_0x97d797){if(_0x3a8464)return _0x3a164b(_0x3a8464);return _0x448967(_0x97d797);});})[_0xdda7('0x1a')](function(){return new BPromise(function(_0x260de6,_0x3caa9b){rimraf(_0x3f509f,function(_0x389b62){if(_0x389b62)_0x3caa9b(_0x389b62);return _0x260de6();});});})[_0xdda7('0x1a')](function(){return _0x3e1981[_0xdda7('0x7b')](_0x50cb03,_0xfba3e3,function(_0x7a4cd6){if(_0x7a4cd6){console[_0xdda7('0x7c')](_0xdda7('0x7d'),_0x7a4cd6);}else{fs['unlinkSync'](_0x50cb03);}});});});}else{return _0x3e1981[_0xdda7('0x1c')](0xc8);}})[_0xdda7('0x35')](handleError(_0x3e1981,null));}; \ No newline at end of file +var _0x666b=['basename','out','System','lastName','value','renderFile','transcript-','.pdf','createPdfFromHTML','log','err','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','update','then','destroy','error','stack','name','send','index','WhatsappInteraction','rawAttributes','fieldName','key','getOptions','findAll','query','user','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','options','find','create','body','catch','describe','WhatsappMessage','addMessage','omit','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','WhatsappInteractionId','filter','merge','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','color','emit','whatsappInteractionTags:save','removeTags','unix','toString','join','root','tmp','server','files','transcript-%d-%s.zip','User','fullname','push','Contact','firstName','Attachment','Messages','createdAt','direction','secret','read','Account','get','mkdirSync','Whatsapp','Owner','N.A.','closedAt','disposition','existsSync','createReadStream','pipe','createWriteStream'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x666b,0x107));var _0xb666=function(_0x4d3599,_0x57e308){_0x4d3599=_0x4d3599-0x0;var _0x3d77b5=_0x666b[_0x4d3599];return _0x3d77b5;};'use strict';var rimraf=require(_0xb666('0x0'));var zipdir=require(_0xb666('0x1'));var moment=require(_0xb666('0x2'));var BPromise=require(_0xb666('0x3'));var util=require(_0xb666('0x4'));var path=require(_0xb666('0x5'));var ejs=require(_0xb666('0x6'));var fs=require('fs');var _=require(_0xb666('0x7'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0xb666('0x8'));var pdf=require(_0xb666('0x9'));var logger=require(_0xb666('0xa'))('api');var config=require(_0xb666('0xb'));var db=require(_0xb666('0xc'))['db'];config[_0xb666('0xd')]=_[_0xb666('0xe')](config['redis'],{'host':_0xb666('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb666('0xd')]));require('./whatsappInteraction.socket')[_0xb666('0x10')](socket);function respondWithStatusCode(_0x34856e,_0x177e5c){_0x177e5c=_0x177e5c||0xcc;return function(_0x1f84fb){if(_0x1f84fb){return _0x34856e[_0xb666('0x11')](_0x177e5c);}return _0x34856e[_0xb666('0x12')](_0x177e5c)[_0xb666('0x13')]();};}function respondWithResult(_0x27e91b,_0x48d715){_0x48d715=_0x48d715||0xc8;return function(_0x2032c3){if(_0x2032c3){return _0x27e91b[_0xb666('0x12')](_0x48d715)[_0xb666('0x14')](_0x2032c3);}};}function respondWithFilteredResult(_0x36e542,_0x35b1aa){return function(_0x3968c3){if(_0x3968c3){var _0x2529da=typeof _0x35b1aa[_0xb666('0x15')]===_0xb666('0x16')&&typeof _0x35b1aa['limit']===_0xb666('0x16');var _0x33ec4a=_0x3968c3[_0xb666('0x17')];var _0xebfea=_0x2529da?0x0:_0x35b1aa[_0xb666('0x15')];var _0x46b188=_0x2529da?_0x3968c3[_0xb666('0x17')]:_0x35b1aa['offset']+_0x35b1aa[_0xb666('0x18')];var _0xa42fd0;if(_0x46b188>=_0x33ec4a){_0x46b188=_0x33ec4a;_0xa42fd0=0xc8;}else{_0xa42fd0=0xce;}_0x36e542['status'](_0xa42fd0);return _0x36e542['set'](_0xb666('0x19'),_0xebfea+'-'+_0x46b188+'/'+_0x33ec4a)[_0xb666('0x14')](_0x3968c3);}return null;};}function saveUpdates(_0x2be423){return function(_0x4fa8bd){if(_0x4fa8bd){return _0x4fa8bd[_0xb666('0x1a')](_0x2be423)[_0xb666('0x1b')](function(_0x4727de){return _0x4727de;});}return null;};}function removeEntity(_0x324e5b){return function(_0x8ebf68){if(_0x8ebf68){return _0x8ebf68[_0xb666('0x1c')]()[_0xb666('0x1b')](function(){_0x324e5b['status'](0xcc)[_0xb666('0x13')]();});}};}function handleEntityNotFound(_0x582457){return function(_0x406748){if(!_0x406748){_0x582457[_0xb666('0x11')](0x194);}return _0x406748;};}function handleError(_0x4787cb,_0x28465e){_0x28465e=_0x28465e||0x1f4;return function(_0x1d8633){logger[_0xb666('0x1d')](_0x1d8633[_0xb666('0x1e')]);if(_0x1d8633[_0xb666('0x1f')]){delete _0x1d8633[_0xb666('0x1f')];}_0x4787cb[_0xb666('0x12')](_0x28465e)[_0xb666('0x20')](_0x1d8633);};}exports[_0xb666('0x21')]=function(_0x16af7d,_0x1140d7){var _0x2df123={};var _0x1c9e63=_['map'](db[_0xb666('0x22')][_0xb666('0x23')],function(_0x151986){return{'name':_0x151986[_0xb666('0x24')],'type':_0x151986['type'][_0xb666('0x25')]};});_0x2df123=qs[_0xb666('0x26')](_0x1c9e63,_0x16af7d);return interaction[_0xb666('0x27')]('whatsapp',_0x16af7d[_0xb666('0x28')],_0x16af7d[_0xb666('0x29')],_0x2df123,_0x1c9e63)[_0xb666('0x1b')](respondWithFilteredResult(_0x1140d7,_0x2df123))['catch'](handleError(_0x1140d7,null));};exports[_0xb666('0x2a')]=function(_0x1fd73f,_0x4d9e21){var _0x56f16={'raw':![],'where':{'id':_0x1fd73f[_0xb666('0x2b')]['id']}},_0x966f69={};_0x966f69[_0xb666('0x2c')]=_[_0xb666('0x2d')](db[_0xb666('0x22')][_0xb666('0x23')]);_0x966f69[_0xb666('0x28')]=_[_0xb666('0x2d')](_0x1fd73f['query']);_0x966f69[_0xb666('0x2e')]=_[_0xb666('0x2f')](_0x966f69[_0xb666('0x2c')],_0x966f69[_0xb666('0x28')]);_0x56f16[_0xb666('0x30')]=_[_0xb666('0x2f')](_0x966f69[_0xb666('0x2c')],qs[_0xb666('0x31')](_0x1fd73f[_0xb666('0x28')][_0xb666('0x31')]));_0x56f16[_0xb666('0x30')]=_0x56f16[_0xb666('0x30')][_0xb666('0x32')]?_0x56f16[_0xb666('0x30')]:_0x966f69[_0xb666('0x2c')];if(_0x1fd73f['query'][_0xb666('0x33')]){_0x56f16[_0xb666('0x34')]=[{'all':!![]}];}_0x56f16=_['merge']({},_0x56f16,_0x1fd73f[_0xb666('0x35')]);return db[_0xb666('0x22')][_0xb666('0x36')](_0x56f16)[_0xb666('0x1b')](handleEntityNotFound(_0x4d9e21,null))[_0xb666('0x1b')](respondWithResult(_0x4d9e21,null))['catch'](handleError(_0x4d9e21,null));};exports['create']=function(_0x4edddb,_0x31583d){return db[_0xb666('0x22')][_0xb666('0x37')](_0x4edddb[_0xb666('0x38')],{})[_0xb666('0x1b')](respondWithResult(_0x31583d,0xc9))[_0xb666('0x39')](handleError(_0x31583d,null));};exports[_0xb666('0x1a')]=function(_0x220785,_0x4a7c49){if(_0x220785[_0xb666('0x38')]['id']){delete _0x220785[_0xb666('0x38')]['id'];}return db[_0xb666('0x22')]['find']({'where':{'id':_0x220785[_0xb666('0x2b')]['id']}})[_0xb666('0x1b')](handleEntityNotFound(_0x4a7c49,null))[_0xb666('0x1b')](saveUpdates(_0x220785[_0xb666('0x38')],null))[_0xb666('0x1b')](respondWithResult(_0x4a7c49,null))['catch'](handleError(_0x4a7c49,null));};exports[_0xb666('0x1c')]=function(_0x24079f,_0xa35248){return db[_0xb666('0x22')][_0xb666('0x36')]({'where':{'id':_0x24079f[_0xb666('0x2b')]['id']}})[_0xb666('0x1b')](handleEntityNotFound(_0xa35248,null))['then'](removeEntity(_0xa35248,null))[_0xb666('0x39')](handleError(_0xa35248,null));};exports[_0xb666('0x3a')]=function(_0x278965,_0x3edfb3){return db[_0xb666('0x22')][_0xb666('0x3a')]()[_0xb666('0x1b')](respondWithResult(_0x3edfb3,null))[_0xb666('0x39')](handleError(_0x3edfb3,null));};exports['addMessage']=function(_0x304e3a,_0x5889ad){return db[_0xb666('0x3b')]['find']({'where':{'id':_0x304e3a['params']['id']}})[_0xb666('0x1b')](handleEntityNotFound(_0x5889ad,null))[_0xb666('0x1b')](function(_0x3ee667){if(_0x3ee667){return _0x3ee667[_0xb666('0x3c')](_0x304e3a['body']['ids'],_[_0xb666('0x3d')](_0x304e3a[_0xb666('0x38')],[_0xb666('0x3e'),'id'])||{});}})['then'](respondWithResult(_0x5889ad,null))['catch'](handleError(_0x5889ad,null));};exports[_0xb666('0x3f')]=function(_0x344632,_0x5b0d57){var _0x17892c={'raw':![],'where':{}};var _0x20bfac={};var _0x2bba30={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xb666('0x40')]({'where':{'id':_0x344632['params']['id']}})[_0xb666('0x1b')](handleEntityNotFound(_0x5b0d57,null))[_0xb666('0x1b')](function(_0x205ae9){if(_0x205ae9){_0x20bfac[_0xb666('0x2c')]=_['keys'](db['WhatsappMessage']['rawAttributes']);_0x20bfac['query']=_['keys'](_0x344632[_0xb666('0x28')]);_0x20bfac[_0xb666('0x2e')]=_[_0xb666('0x2f')](_0x20bfac[_0xb666('0x2c')],_0x20bfac[_0xb666('0x28')]);_0x17892c[_0xb666('0x30')]=_[_0xb666('0x2f')](_0x20bfac[_0xb666('0x2c')],qs[_0xb666('0x31')](_0x344632[_0xb666('0x28')][_0xb666('0x31')]));_0x17892c[_0xb666('0x30')]=_0x17892c[_0xb666('0x30')][_0xb666('0x32')]?_0x17892c['attributes']:_0x20bfac['model'];if(!_0x344632['query'][_0xb666('0x41')](_0xb666('0x42'))){_0x17892c[_0xb666('0x18')]=qs[_0xb666('0x18')](_0x344632[_0xb666('0x28')]['limit']);_0x17892c[_0xb666('0x15')]=qs[_0xb666('0x15')](_0x344632[_0xb666('0x28')][_0xb666('0x15')]);}_0x17892c[_0xb666('0x43')]=qs[_0xb666('0x44')](_0x344632[_0xb666('0x28')]['sort']);_0x17892c['where']=qs[_0xb666('0x2e')](_['pick'](_0x344632[_0xb666('0x28')],_0x20bfac[_0xb666('0x2e')]));_0x17892c[_0xb666('0x45')][_0xb666('0x46')]=_0x205ae9['id'];if(_0x344632[_0xb666('0x28')][_0xb666('0x47')]){_0x17892c[_0xb666('0x45')]=_[_0xb666('0x48')](_0x17892c[_0xb666('0x45')],{'$or':_[_0xb666('0x49')](_0x17892c[_0xb666('0x30')],function(_0xe29e3c){var _0x4e2663={};_0x4e2663[_0xe29e3c]={'$like':'%'+_0x344632['query'][_0xb666('0x47')]+'%'};return _0x4e2663;})});}if(_0x344632[_0xb666('0x28')][_0xb666('0x4a')]){var _0x1e0b30=_0x344632[_0xb666('0x28')][_0xb666('0x4a')][_0xb666('0x4b')](',');var _0x289475={};_0x289475[_0x1e0b30[0x0]]={'$gte':moment(_0x1e0b30[0x1])[_0xb666('0x4c')](_0xb666('0x4d'))};_0x17892c[_0xb666('0x45')]=_[_0xb666('0x48')](_0x17892c[_0xb666('0x45')],_0x289475);}_0x17892c=_[_0xb666('0x48')]({},_0x17892c,_0x344632[_0xb666('0x35')]);return db['WhatsappMessage'][_0xb666('0x17')]({'where':_0x17892c['where']})[_0xb666('0x1b')](function(_0x367c6e){_0x2bba30['count']=_0x367c6e;if(_0x344632['query'][_0xb666('0x33')]){_0x17892c[_0xb666('0x34')]=[{'all':!![]}];}return db[_0xb666('0x3b')][_0xb666('0x27')](_0x17892c);})[_0xb666('0x1b')](function(_0x4af3c0){_0x2bba30[_0xb666('0x4e')]=_0x4af3c0;return _0x2bba30;});}})[_0xb666('0x1b')](respondWithFilteredResult(_0x5b0d57,_0x17892c))[_0xb666('0x39')](handleError(_0x5b0d57,null));};exports['addTags']=function(_0x1a052c,_0x5d6e4d){return db[_0xb666('0x22')]['find']({'where':{'id':_0x1a052c[_0xb666('0x2b')]['id']}})[_0xb666('0x1b')](handleEntityNotFound(_0x5d6e4d,null))[_0xb666('0x1b')](function(_0x40b374){if(_0x40b374){return _0x40b374[_0xb666('0x4f')](_0x1a052c[_0xb666('0x38')]['ids'],_[_0xb666('0x3d')](_0x1a052c[_0xb666('0x38')],[_0xb666('0x3e'),'id'])||{})['spread'](function(){return db['Tag'][_0xb666('0x27')]({'attributes':['id',_0xb666('0x1f'),_0xb666('0x50')],'where':{'id':_0x1a052c[_0xb666('0x38')][_0xb666('0x3e')]}});})['then'](function(_0x55340b){socket[_0xb666('0x51')](_0xb666('0x52'),{'id':Number(_0x1a052c[_0xb666('0x2b')]['id']),'tags':_0x55340b||[]});return{'id':Number(_0x1a052c[_0xb666('0x2b')]['id']),'tags':_0x55340b||[]};});}})[_0xb666('0x1b')](respondWithResult(_0x5d6e4d,null))[_0xb666('0x39')](handleError(_0x5d6e4d,null));};exports[_0xb666('0x53')]=function(_0x32b0d3,_0x475a5a){return db[_0xb666('0x22')][_0xb666('0x36')]({'where':{'id':_0x32b0d3['params']['id']}})[_0xb666('0x1b')](handleEntityNotFound(_0x475a5a,null))[_0xb666('0x1b')](function(_0x153e9f){if(_0x153e9f){return _0x153e9f[_0xb666('0x53')](_0x32b0d3[_0xb666('0x28')]['ids']);}})['then'](respondWithStatusCode(_0x475a5a,null))['catch'](handleError(_0x475a5a,null));};exports['download']=function(_0x4ef729,_0x4a116b){var _0x5bf747=moment()[_0xb666('0x54')]()[_0xb666('0x55')]();var _0x4357ff=path[_0xb666('0x56')](config[_0xb666('0x57')],'server','files',_0xb666('0x58'));var _0x57c21e=path[_0xb666('0x56')](config['root'],_0xb666('0x59'),_0xb666('0x5a'),'attachments');var _0x39c2c3=path[_0xb666('0x56')](_0x4357ff,_0x5bf747);var _0x2e0a61=util['format'](_0xb666('0x5b'),_0x4ef729[_0xb666('0x2b')]['id'],_0x5bf747);var _0x1ee6c4=path['join'](_0x4357ff,_0x2e0a61);var _0x57bc08=[];_0x57bc08['push']({'model':db[_0xb666('0x5c')],'as':_0xb666('0x5c'),'attributes':['id',_0xb666('0x5d')],'raw':!![]});_0x57bc08[_0xb666('0x5e')]({'model':db['CmContact'],'as':_0xb666('0x5f'),'attributes':['id',_0xb666('0x60'),'lastName'],'raw':!![]});if(_0x4ef729[_0xb666('0x28')]['attachments']){_0x57bc08[_0xb666('0x5e')]({'model':db[_0xb666('0x61')],'as':'Attachment','raw':!![]});}var _0x211b5d=[{'model':db[_0xb666('0x3b')],'as':_0xb666('0x62'),'attributes':['id',_0xb666('0x38'),_0xb666('0x63'),_0xb666('0x64'),_0xb666('0x65'),_0xb666('0x66')],'include':_0x57bc08}];_0x211b5d[_0xb666('0x5e')]({'model':db['WhatsappAccount'],'as':_0xb666('0x67'),'attributes':['id','name']});_0x211b5d[_0xb666('0x5e')]({'model':db[_0xb666('0x5c')],'as':'Owner','attributes':['id','fullname']});return db[_0xb666('0x22')][_0xb666('0x36')]({'where':{'id':_0x4ef729[_0xb666('0x2b')]['id']},'include':_0x211b5d})[_0xb666('0x1b')](handleEntityNotFound(_0x4a116b,null))['then'](function(_0x66dcb){if(_0x66dcb){var _0x203dce=_0x66dcb[_0xb666('0x68')]({'plain':!![]});fs[_0xb666('0x69')](_0x39c2c3);var _0x42018b={'channel':_0xb666('0x6a'),'account':_0x203dce[_0xb666('0x67')]['name'],'agent':_0x203dce[_0xb666('0x6b')]?_0x203dce[_0xb666('0x6b')]['fullname']:_0xb666('0x6c'),'createdAt':moment(_0x203dce[_0xb666('0x63')])[_0xb666('0x4c')](_0xb666('0x4d'))[_0xb666('0x55')](),'closedAt':_0x203dce['closed']?moment(_0x203dce[_0xb666('0x6d')])[_0xb666('0x4c')](_0xb666('0x4d'))['toString']():'','disposition':_0x203dce[_0xb666('0x6e')],'messages':_(_0x203dce[_0xb666('0x62')])[_0xb666('0x47')]({'secret':![]})['map'](function(_0x406712){if(_0x406712[_0xb666('0x61')]){var _0x575c30=path[_0xb666('0x56')](_0x57c21e,_0x406712[_0xb666('0x61')]['basename']);if(fs[_0xb666('0x6f')](_0x575c30)){fs[_0xb666('0x70')](_0x575c30)[_0xb666('0x71')](fs[_0xb666('0x72')](path[_0xb666('0x56')](_0x39c2c3,_0x406712[_0xb666('0x61')][_0xb666('0x73')])));}}return{'date':moment(_0x406712[_0xb666('0x63')])[_0xb666('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb666('0x55')](),'sender':_0x406712[_0xb666('0x64')]===_0xb666('0x74')?_0x406712['User']?_0x406712[_0xb666('0x5c')][_0xb666('0x5d')]:_0xb666('0x75'):_0x406712[_0xb666('0x5f')][_0xb666('0x60')]+(_0x406712['Contact'][_0xb666('0x76')]?'\x20'+_0x406712[_0xb666('0x5f')]['lastName']:''),'body':_0x406712[_0xb666('0x61')]?_0x406712[_0xb666('0x61')][_0xb666('0x73')]:_0x406712[_0xb666('0x38')],'direction':_0x406712['direction']===_0xb666('0x74')?'A':'C','secret':_0x406712[_0xb666('0x65')],'read':_0x406712[_0xb666('0x66')],'attachment':_0x406712[_0xb666('0x61')]};})[_0xb666('0x77')]()};return ejs[_0xb666('0x78')](path[_0xb666('0x56')](config['root'],_0xb666('0x59'),'views','downloadInteraction.ejs'),{'interaction':_0x42018b})['then'](function(_0x599fd7){var _0x1ac0c5=path[_0xb666('0x56')](_0x39c2c3,_0xb666('0x79')+_0x203dce['id']+'-'+_0x5bf747+_0xb666('0x7a'));var _0x4a3a5a={'path':_0x1ac0c5,'channel':_0xb666('0x6a'),'interactionId':_0x203dce['id']};return pdf[_0xb666('0x7b')](_0x599fd7,_0x4a3a5a);})['then'](function(){return new BPromise(function(_0x437f2b,_0x22a293){zipdir(_0x39c2c3,{'saveTo':_0x1ee6c4},function(_0x314928,_0x45408e){if(_0x314928)return _0x22a293(_0x314928);return _0x437f2b(_0x45408e);});})[_0xb666('0x1b')](function(){return new BPromise(function(_0xd0428e,_0x3e34d1){rimraf(_0x39c2c3,function(_0x12cd69){if(_0x12cd69)_0x3e34d1(_0x12cd69);return _0xd0428e();});});})['then'](function(){return _0x4a116b['download'](_0x1ee6c4,_0x2e0a61,function(_0x4e6edd){if(_0x4e6edd){console[_0xb666('0x7c')](_0xb666('0x7d'),_0x4e6edd);}else{fs['unlinkSync'](_0x1ee6c4);}});});});}else{return _0x4a116b[_0xb666('0x11')](0xc8);}})[_0xb666('0x39')](handleError(_0x4a116b,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index cae11de..3abf9f4 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 _0x4a47=['length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','save','remove','getUsers','Users','findAll','then','unreadMessages'];(function(_0x4b98df,_0x39e3ca){var _0x33a6b4=function(_0x43eb26){while(--_0x43eb26){_0x4b98df['push'](_0x4b98df['shift']());}};_0x33a6b4(++_0x39e3ca);}(_0x4a47,0xb5));var _0x74a4=function(_0x59820d,_0xc8e6ba){_0x59820d=_0x59820d-0x0;var _0x3c72b1=_0x4a47[_0x59820d];return _0x3c72b1;};'use strict';var EventEmitter=require(_0x74a4('0x0'));var WhatsappInteraction=require(_0x74a4('0x1'))['db'][_0x74a4('0x2')];var WhatsappMessage=require(_0x74a4('0x1'))['db'][_0x74a4('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x74a4('0x4'),'afterUpdate':'update','afterDestroy':_0x74a4('0x5')};function emitEvent(_0x450c10){return function(_0x5af655,_0x43080b,_0x3c6344){_0x5af655[_0x74a4('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x41ef5a){_0x5af655['setDataValue'](_0x74a4('0x7'),_0x41ef5a['map'](function(_0x39bbb4){return{'id':_0x39bbb4['id']};}));return WhatsappMessage[_0x74a4('0x8')]({'where':{'WhatsappInteractionId':_0x5af655['id'],'direction':'in','read':![]},'raw':!![]});})[_0x74a4('0x9')](function(_0x17c01f){_0x5af655['setDataValue'](_0x74a4('0xa'),_0x17c01f[_0x74a4('0xb')]);WhatsappInteractionEvents[_0x74a4('0xc')](_0x450c10+':'+_0x5af655['id'],_0x5af655);WhatsappInteractionEvents[_0x74a4('0xc')](_0x450c10,_0x5af655);_0x3c6344(null);})['catch'](_0x3c6344(null));};}for(var e in events){if(events[_0x74a4('0xd')](e)){var event=events[e];WhatsappInteraction[_0x74a4('0xe')](e,emitEvent(event));}}module[_0x74a4('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x4065=['then','setDataValue','Users','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','getUsers'];(function(_0x50f99a,_0x4ed44f){var _0x2d38e6=function(_0x23ca9a){while(--_0x23ca9a){_0x50f99a['push'](_0x50f99a['shift']());}};_0x2d38e6(++_0x4ed44f);}(_0x4065,0xdc));var _0x5406=function(_0x3c9f72,_0x206fd9){_0x3c9f72=_0x3c9f72-0x0;var _0x64dd5f=_0x4065[_0x3c9f72];return _0x64dd5f;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require('../../mysqldb')['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x5406('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x5406('0x1')](0x0);var events={'afterCreate':_0x5406('0x2'),'afterUpdate':_0x5406('0x3'),'afterDestroy':'remove'};function emitEvent(_0xc5c0b5){return function(_0x281baf,_0x5f5cb7,_0x1d2a1c){_0x281baf[_0x5406('0x4')]({'attributes':['id'],'raw':!![]})[_0x5406('0x5')](function(_0x132fc5){_0x281baf[_0x5406('0x6')](_0x5406('0x7'),_0x132fc5['map'](function(_0x476d17){return{'id':_0x476d17['id']};}));return WhatsappMessage[_0x5406('0x8')]({'where':{'WhatsappInteractionId':_0x281baf['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5406('0x5')](function(_0x266399){_0x281baf[_0x5406('0x6')](_0x5406('0x9'),_0x266399['length']);WhatsappInteractionEvents[_0x5406('0xa')](_0xc5c0b5+':'+_0x281baf['id'],_0x281baf);WhatsappInteractionEvents[_0x5406('0xa')](_0xc5c0b5,_0x281baf);_0x1d2a1c(null);})[_0x5406('0xb')](_0x1d2a1c(null));};}for(var e in events){if(events[_0x5406('0xc')](e)){var event=events[e];WhatsappInteraction[_0x5406('0xd')](e,emitEvent(event));}}module[_0x5406('0xe')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 3d92954..3f8339d 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 _0x0e9f=['define','WhatsappInteraction','whatsapp_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports'];(function(_0x59fc33,_0x2e182d){var _0x39066f=function(_0x4d843d){while(--_0x4d843d){_0x59fc33['push'](_0x59fc33['shift']());}};_0x39066f(++_0x2e182d);}(_0x0e9f,0xf7));var _0xf0e9=function(_0x1e2569,_0x23fcda){_0x1e2569=_0x1e2569-0x0;var _0x186ec6=_0x0e9f[_0x1e2569];return _0x186ec6;};'use strict';var _=require('lodash');var util=require(_0xf0e9('0x0'));var logger=require('../../config/logger')(_0xf0e9('0x1'));var moment=require(_0xf0e9('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf0e9('0x3'));var rimraf=require(_0xf0e9('0x4'));var config=require(_0xf0e9('0x5'));var attributes=require(_0xf0e9('0x6'));module[_0xf0e9('0x7')]=function(_0x570a1b,_0x37995d){return _0x570a1b[_0xf0e9('0x8')](_0xf0e9('0x9'),attributes,{'tableName':_0xf0e9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2ab744,_0x26207f,_0x33f6b0){if(_0x2ab744[_0xf0e9('0xb')](_0xf0e9('0xc'))){_0x2ab744['closedAt']=moment()[_0xf0e9('0xd')](_0xf0e9('0xe'));}_0x33f6b0(null,_0x2ab744);}}});}; \ No newline at end of file +var _0x7a66=['path','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','format','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x1e0245,_0x154010){var _0x53bea7=function(_0x5d6b09){while(--_0x5d6b09){_0x1e0245['push'](_0x1e0245['shift']());}};_0x53bea7(++_0x154010);}(_0x7a66,0x1ae));var _0x67a6=function(_0xf56751,_0x3c05e0){_0xf56751=_0xf56751-0x0;var _0x443b2a=_0x7a66[_0xf56751];return _0x443b2a;};'use strict';var _=require(_0x67a6('0x0'));var util=require('util');var logger=require(_0x67a6('0x1'))(_0x67a6('0x2'));var moment=require('moment');var BPromise=require(_0x67a6('0x3'));var rp=require(_0x67a6('0x4'));var fs=require('fs');var path=require(_0x67a6('0x5'));var rimraf=require('rimraf');var config=require(_0x67a6('0x6'));var attributes=require(_0x67a6('0x7'));module[_0x67a6('0x8')]=function(_0x4c2c64,_0x45748f){return _0x4c2c64[_0x67a6('0x9')](_0x67a6('0xa'),attributes,{'tableName':_0x67a6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x497e8f,_0x43f981,_0x182e23){if(_0x497e8f[_0x67a6('0xc')](_0x67a6('0xd'))){_0x497e8f['closedAt']=moment()[_0x67a6('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x182e23(null,_0x497e8f);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 8ab9f23..a9e1926 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 _0x2f95=['catch','UpdateWhatsappInteraction','WhatsappInteraction','options','where','attributes','limit','then','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x51ffeb,_0x3e7fcb){var _0x3f8201=function(_0x253e58){while(--_0x253e58){_0x51ffeb['push'](_0x51ffeb['shift']());}};_0x3f8201(++_0x3e7fcb);}(_0x2f95,0x180));var _0x52f9=function(_0x2755e6,_0x50a38e){_0x2755e6=_0x2755e6-0x0;var _0x383f97=_0x2f95[_0x2755e6];return _0x383f97;};'use strict';var _=require(_0x52f9('0x0'));var util=require(_0x52f9('0x1'));var moment=require(_0x52f9('0x2'));var BPromise=require(_0x52f9('0x3'));var rs=require(_0x52f9('0x4'));var fs=require('fs');var Redis=require(_0x52f9('0x5'));var db=require(_0x52f9('0x6'))['db'];var utils=require(_0x52f9('0x7'));var logger=require(_0x52f9('0x8'))(_0x52f9('0x9'));var config=require(_0x52f9('0xa'));var jayson=require(_0x52f9('0xb'));var client=jayson[_0x52f9('0xc')]['http']({'port':0x232a});config['redis']=_[_0x52f9('0xd')](config['redis'],{'host':_0x52f9('0xe'),'port':0x18eb});var socket=require(_0x52f9('0xf'))(new Redis(config[_0x52f9('0x10')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x637220,_0x706437,_0x242019){return new BPromise(function(_0x5d6ca0,_0x2f1b4c){return client['request'](_0x637220,_0x242019)['then'](function(_0x218003){logger[_0x52f9('0x11')](_0x52f9('0x12'),_0x706437,_0x52f9('0x13'));logger[_0x52f9('0x14')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x706437,_0x52f9('0x13'),JSON[_0x52f9('0x15')](_0x218003));if(_0x218003[_0x52f9('0x16')]){if(_0x218003['error'][_0x52f9('0x17')]===0x1f4){logger[_0x52f9('0x16')](_0x52f9('0x12'),_0x706437,_0x218003[_0x52f9('0x16')][_0x52f9('0x18')]);return _0x2f1b4c(_0x218003[_0x52f9('0x16')][_0x52f9('0x18')]);}logger[_0x52f9('0x16')](_0x52f9('0x12'),_0x706437,_0x218003[_0x52f9('0x16')][_0x52f9('0x18')]);return _0x5d6ca0(_0x218003[_0x52f9('0x16')]['message']);}else{logger[_0x52f9('0x11')](_0x52f9('0x12'),_0x706437,_0x52f9('0x13'));_0x5d6ca0(_0x218003[_0x52f9('0x19')][_0x52f9('0x18')]);}})[_0x52f9('0x1a')](function(_0x2f6072){logger[_0x52f9('0x16')](_0x52f9('0x12'),_0x706437,_0x2f6072);_0x2f1b4c(_0x2f6072);});});}exports[_0x52f9('0x1b')]=function(_0x520e4e){var _0x268bb6=this;return new Promise(function(_0xc66dba,_0x489de1){return db[_0x52f9('0x1c')]['update'](_0x520e4e['body'],{'raw':_0x520e4e[_0x52f9('0x1d')]?_0x520e4e[_0x52f9('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x520e4e[_0x52f9('0x1d')]?_0x520e4e[_0x52f9('0x1d')][_0x52f9('0x1e')]||null:null,'attributes':_0x520e4e['options']?_0x520e4e[_0x52f9('0x1d')][_0x52f9('0x1f')]||null:null,'limit':_0x520e4e[_0x52f9('0x1d')]?_0x520e4e[_0x52f9('0x1d')][_0x52f9('0x20')]||null:null})[_0x52f9('0x21')](function(_0x2a80ee){logger[_0x52f9('0x11')]('UpdateWhatsappInteraction',_0x520e4e);logger[_0x52f9('0x14')]('UpdateWhatsappInteraction',_0x520e4e,JSON[_0x52f9('0x15')](_0x2a80ee));_0xc66dba(_0x2a80ee);})[_0x52f9('0x1a')](function(_0x5b6ac9){logger[_0x52f9('0x16')](_0x52f9('0x1b'),_0x5b6ac9[_0x52f9('0x18')],_0x520e4e);_0x489de1(_0x268bb6[_0x52f9('0x16')](0x1f4,_0x5b6ac9['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x297917){return new Promise(function(_0x3df452,_0x20ca7a){return db[_0x52f9('0x1c')][_0x52f9('0x22')]({'where':_0x297917[_0x52f9('0x1d')]?_0x297917['options'][_0x52f9('0x1e')]||null:null})[_0x52f9('0x21')](function(_0x523a3c){if(_0x523a3c){return _0x523a3c[_0x52f9('0x23')](_0x297917[_0x52f9('0x24')][_0x52f9('0x25')],_[_0x52f9('0x26')](_0x297917['body'],[_0x52f9('0x25'),'id'])||{});}})[_0x52f9('0x27')](function(_0x50e685){logger[_0x52f9('0x11')](_0x52f9('0x28'),_0x297917);logger[_0x52f9('0x14')]('AddTags',_0x297917,JSON[_0x52f9('0x15')](_0x50e685));_0x3df452(_0x50e685);})['catch'](function(_0x6f0ab8){logger[_0x52f9('0x16')](_0x52f9('0x28'),_0x6f0ab8[_0x52f9('0x18')],_0x297917);_0x20ca7a(_this['error'](0x1f4,_0x6f0ab8[_0x52f9('0x18')]));});});}; \ No newline at end of file +var _0xacb5=['stringify','error','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','attributes','then','AddTagsToWhatsappInteraction','find','where','addTags','body','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x2043c5,_0x4ed48d){var _0x1a1f73=function(_0x3224c2){while(--_0x3224c2){_0x2043c5['push'](_0x2043c5['shift']());}};_0x1a1f73(++_0x4ed48d);}(_0xacb5,0x13b));var _0x5acb=function(_0x3439b4,_0x3c235c){_0x3439b4=_0x3439b4-0x0;var _0x38d9f8=_0xacb5[_0x3439b4];return _0x38d9f8;};'use strict';var _=require(_0x5acb('0x0'));var util=require(_0x5acb('0x1'));var moment=require('moment');var BPromise=require(_0x5acb('0x2'));var rs=require(_0x5acb('0x3'));var fs=require('fs');var Redis=require(_0x5acb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5acb('0x5'));var logger=require(_0x5acb('0x6'))('rpc');var config=require(_0x5acb('0x7'));var jayson=require(_0x5acb('0x8'));var client=jayson[_0x5acb('0x9')][_0x5acb('0xa')]({'port':0x232a});config[_0x5acb('0xb')]=_[_0x5acb('0xc')](config[_0x5acb('0xb')],{'host':_0x5acb('0xd'),'port':0x18eb});var socket=require(_0x5acb('0xe'))(new Redis(config[_0x5acb('0xb')]));require('./whatsappInteraction.socket')[_0x5acb('0xf')](socket);function respondWithRpcPromise(_0x20ec4e,_0x2b15f6,_0x252ce6){return new BPromise(function(_0x376f2e,_0x359971){return client['request'](_0x20ec4e,_0x252ce6)['then'](function(_0xe078e9){logger[_0x5acb('0x10')](_0x5acb('0x11'),_0x2b15f6,_0x5acb('0x12'));logger[_0x5acb('0x13')](_0x5acb('0x14'),_0x2b15f6,_0x5acb('0x12'),JSON[_0x5acb('0x15')](_0xe078e9));if(_0xe078e9[_0x5acb('0x16')]){if(_0xe078e9['error']['code']===0x1f4){logger[_0x5acb('0x16')](_0x5acb('0x11'),_0x2b15f6,_0xe078e9['error']['message']);return _0x359971(_0xe078e9[_0x5acb('0x16')]['message']);}logger[_0x5acb('0x16')](_0x5acb('0x11'),_0x2b15f6,_0xe078e9[_0x5acb('0x16')][_0x5acb('0x17')]);return _0x376f2e(_0xe078e9[_0x5acb('0x16')]['message']);}else{logger[_0x5acb('0x10')](_0x5acb('0x11'),_0x2b15f6,_0x5acb('0x12'));_0x376f2e(_0xe078e9[_0x5acb('0x18')]['message']);}})[_0x5acb('0x19')](function(_0x7b0f7b){logger[_0x5acb('0x16')](_0x5acb('0x11'),_0x2b15f6,_0x7b0f7b);_0x359971(_0x7b0f7b);});});}exports[_0x5acb('0x1a')]=function(_0x529295){var _0x2dcf1b=this;return new Promise(function(_0x5c2040,_0x31561f){return db[_0x5acb('0x1b')][_0x5acb('0x1c')](_0x529295['body'],{'raw':_0x529295[_0x5acb('0x1d')]?_0x529295[_0x5acb('0x1d')][_0x5acb('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529295[_0x5acb('0x1d')]?_0x529295['options']['where']||null:null,'attributes':_0x529295['options']?_0x529295[_0x5acb('0x1d')][_0x5acb('0x1f')]||null:null,'limit':_0x529295[_0x5acb('0x1d')]?_0x529295[_0x5acb('0x1d')]['limit']||null:null})[_0x5acb('0x20')](function(_0x693b4){logger[_0x5acb('0x10')](_0x5acb('0x1a'),_0x529295);logger[_0x5acb('0x13')](_0x5acb('0x1a'),_0x529295,JSON[_0x5acb('0x15')](_0x693b4));_0x5c2040(_0x693b4);})['catch'](function(_0x438d19){logger['error'](_0x5acb('0x1a'),_0x438d19[_0x5acb('0x17')],_0x529295);_0x31561f(_0x2dcf1b[_0x5acb('0x16')](0x1f4,_0x438d19['message']));});});};exports[_0x5acb('0x21')]=function(_0x4e6afa){return new Promise(function(_0x56757f,_0x3232b6){return db[_0x5acb('0x1b')][_0x5acb('0x22')]({'where':_0x4e6afa[_0x5acb('0x1d')]?_0x4e6afa['options'][_0x5acb('0x23')]||null:null})['then'](function(_0x45aa89){if(_0x45aa89){return _0x45aa89[_0x5acb('0x24')](_0x4e6afa[_0x5acb('0x25')][_0x5acb('0x26')],_[_0x5acb('0x27')](_0x4e6afa[_0x5acb('0x25')],[_0x5acb('0x26'),'id'])||{});}})[_0x5acb('0x28')](function(_0x32fcc8){logger[_0x5acb('0x10')]('AddTags',_0x4e6afa);logger['debug'](_0x5acb('0x29'),_0x4e6afa,JSON[_0x5acb('0x15')](_0x32fcc8));_0x56757f(_0x32fcc8);})[_0x5acb('0x19')](function(_0x331aac){logger['error']('AddTags',_0x331aac[_0x5acb('0x17')],_0x4e6afa);_0x3232b6(_this[_0x5acb('0x16')](0x1f4,_0x331aac[_0x5acb('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 53d9030..0986741 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 _0x29ba=['removeListener','register','length','whatsappInteraction:','remove','update'];(function(_0x286633,_0x27159e){var _0x4aa6f0=function(_0x199b8a){while(--_0x199b8a){_0x286633['push'](_0x286633['shift']());}};_0x4aa6f0(++_0x27159e);}(_0x29ba,0xe8));var _0xa29b=function(_0x359377,_0x1a63ef){_0x359377=_0x359377-0x0;var _0x8be18a=_0x29ba[_0x359377];return _0x8be18a;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0xa29b('0x0'),_0xa29b('0x1')];function createListener(_0x3a2322,_0x821632){return function(_0x2e9e8d){_0x821632['emit'](_0x3a2322,_0x2e9e8d);};}function removeListener(_0x2d8b18,_0xfac1de){return function(){WhatsappInteractionEvents[_0xa29b('0x2')](_0x2d8b18,_0xfac1de);};}exports[_0xa29b('0x3')]=function(_0x4c98df){for(var _0x119066=0x0,_0x1d122c=events[_0xa29b('0x4')];_0x119066<_0x1d122c;_0x119066++){var _0x3c8a56=events[_0x119066];var _0x2036d8=createListener(_0xa29b('0x5')+_0x3c8a56,_0x4c98df);WhatsappInteractionEvents['on'](_0x3c8a56,_0x2036d8);}}; \ No newline at end of file +var _0x1084=['remove','emit','length','./whatsappInteraction.events','save'];(function(_0x581f39,_0xb0a5c6){var _0x3ecf4f=function(_0x195a49){while(--_0x195a49){_0x581f39['push'](_0x581f39['shift']());}};_0x3ecf4f(++_0xb0a5c6);}(_0x1084,0x11b));var _0x4108=function(_0x5dcb33,_0x11bee1){_0x5dcb33=_0x5dcb33-0x0;var _0x590843=_0x1084[_0x5dcb33];return _0x590843;};'use strict';var WhatsappInteractionEvents=require(_0x4108('0x0'));var events=[_0x4108('0x1'),_0x4108('0x2'),'update'];function createListener(_0x31ef10,_0x152184){return function(_0x46e089){_0x152184[_0x4108('0x3')](_0x31ef10,_0x46e089);};}function removeListener(_0x545632,_0x267bea){return function(){WhatsappInteractionEvents['removeListener'](_0x545632,_0x267bea);};}exports['register']=function(_0x2c4205){for(var _0x3ab202=0x0,_0x288a38=events[_0x4108('0x4')];_0x3ab202<_0x288a38;_0x3ab202++){var _0x3cd4f7=events[_0x3ab202];var _0x20fed1=createListener('whatsappInteraction:'+_0x3cd4f7,_0x2c4205);WhatsappInteractionEvents['on'](_0x3cd4f7,_0x20fed1);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 1b30361..cca6996 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 _0x1a52=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','post','whatsapp','whatsappmessage:create','create','/:id/status','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','express'];(function(_0x1e4180,_0x4d8d35){var _0x86f6e7=function(_0x50e840){while(--_0x50e840){_0x1e4180['push'](_0x1e4180['shift']());}};_0x86f6e7(++_0x4d8d35);}(_0x1a52,0x130));var _0x21a5=function(_0x35f1f5,_0x162028){_0x35f1f5=_0x35f1f5-0x0;var _0x40e9f9=_0x1a52[_0x35f1f5];return _0x40e9f9;};'use strict';var multer=require(_0x21a5('0x0'));var util=require(_0x21a5('0x1'));var path=require(_0x21a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x21a5('0x3'));var router=express[_0x21a5('0x4')]();var fs_extra=require(_0x21a5('0x5'));var auth=require(_0x21a5('0x6'));var interaction=require(_0x21a5('0x7'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router[_0x21a5('0x8')]('/',auth['isAuthenticated'](),controller[_0x21a5('0x9')]);router[_0x21a5('0x8')](_0x21a5('0xa'),auth[_0x21a5('0xb')](),controller[_0x21a5('0xc')]);router['get'](_0x21a5('0xd'),auth[_0x21a5('0xb')](),controller[_0x21a5('0xe')]);router[_0x21a5('0xf')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x21a5('0x10'),_0x21a5('0x11')),controller[_0x21a5('0x12')]);router[_0x21a5('0xf')](_0x21a5('0x13'),controller['status']);router[_0x21a5('0x14')](_0x21a5('0xd'),auth[_0x21a5('0xb')](),controller[_0x21a5('0x15')]);router[_0x21a5('0x14')](_0x21a5('0x16'),auth['isAuthenticated'](),controller[_0x21a5('0x17')]);router[_0x21a5('0x14')](_0x21a5('0x18'),auth[_0x21a5('0xb')](),controller['reject']);router[_0x21a5('0x19')]('/:id',auth[_0x21a5('0xb')](),controller[_0x21a5('0x1a')]);module[_0x21a5('0x1b')]=router; \ No newline at end of file +var _0x15f7=['create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show','post','whatsapp'];(function(_0x4346c4,_0x53ac29){var _0x304289=function(_0x3daddb){while(--_0x3daddb){_0x4346c4['push'](_0x4346c4['shift']());}};_0x304289(++_0x53ac29);}(_0x15f7,0xd7));var _0x715f=function(_0x459335,_0x2e95dd){_0x459335=_0x459335-0x0;var _0x50f00b=_0x15f7[_0x459335];return _0x50f00b;};'use strict';var multer=require(_0x715f('0x0'));var util=require(_0x715f('0x1'));var path=require(_0x715f('0x2'));var timeout=require(_0x715f('0x3'));var express=require(_0x715f('0x4'));var router=express[_0x715f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x715f('0x6'));var interaction=require(_0x715f('0x7'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router['get']('/',auth[_0x715f('0x8')](),controller[_0x715f('0x9')]);router[_0x715f('0xa')](_0x715f('0xb'),auth[_0x715f('0x8')](),controller[_0x715f('0xc')]);router['get'](_0x715f('0xd'),auth[_0x715f('0x8')](),controller[_0x715f('0xe')]);router[_0x715f('0xf')]('/',auth[_0x715f('0x8')](),interaction['tracked'](_0x715f('0x10'),'whatsappmessage:create'),controller[_0x715f('0x11')]);router[_0x715f('0xf')](_0x715f('0x12'),controller[_0x715f('0x13')]);router[_0x715f('0x14')](_0x715f('0xd'),auth[_0x715f('0x8')](),controller[_0x715f('0x15')]);router[_0x715f('0x14')](_0x715f('0x16'),auth[_0x715f('0x8')](),controller[_0x715f('0x17')]);router[_0x715f('0x14')](_0x715f('0x18'),auth[_0x715f('0x8')](),controller[_0x715f('0x19')]);router[_0x715f('0x1a')](_0x715f('0xd'),auth[_0x715f('0x8')](),controller[_0x715f('0x1b')]);module[_0x715f('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 85d4e8d..5bb2c28 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 _0xeb00=['STRING','DATE','TEXT','sequelize','exports','BOOLEAN','ENUM','out'];(function(_0xe07686,_0xd36d8e){var _0x1e41a3=function(_0x39124b){while(--_0x39124b){_0xe07686['push'](_0xe07686['shift']());}};_0x1e41a3(++_0xd36d8e);}(_0xeb00,0x1bb));var _0x0eb0=function(_0x2f3fdb,_0x5854f2){_0x2f3fdb=_0x2f3fdb-0x0;var _0x8d3b0b=_0xeb00[_0x2f3fdb];return _0x8d3b0b;};'use strict';var Sequelize=require(_0x0eb0('0x0'));module[_0x0eb0('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x0eb0('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0eb0('0x3')]('in',_0x0eb0('0x4')),'defaultValue':_0x0eb0('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0eb0('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x0eb0('0x6')]},'secret':{'type':Sequelize[_0x0eb0('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0eb0('0x5')]},'providerResponse':{'type':Sequelize[_0x0eb0('0x7')]}}; \ No newline at end of file +var _0xaa19=['out','STRING','DATE','BOOLEAN','sequelize','exports','TEXT','medium','ENUM'];(function(_0x5a24de,_0x542232){var _0x388e2e=function(_0x438603){while(--_0x438603){_0x5a24de['push'](_0x5a24de['shift']());}};_0x388e2e(++_0x542232);}(_0xaa19,0x79));var _0x9aa1=function(_0x31f0dc,_0x36b8fd){_0x31f0dc=_0x31f0dc-0x0;var _0x4ea2cc=_0xaa19[_0x31f0dc];return _0x4ea2cc;};'use strict';var Sequelize=require(_0x9aa1('0x0'));module[_0x9aa1('0x1')]={'body':{'type':Sequelize[_0x9aa1('0x2')](_0x9aa1('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x9aa1('0x4')]('in','out'),'defaultValue':_0x9aa1('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x9aa1('0x6')]},'readAt':{'type':Sequelize[_0x9aa1('0x7')]},'secret':{'type':Sequelize[_0x9aa1('0x8')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x9aa1('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 98c43ad..a9700df 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 _0x0f3a=['desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','info','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','body','describe','whatsapp','read','format','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','channel','event','accept','EventManager','acceptmessage','whatsapp-interactions','RejectMessage','rejectMessage','contact','motionChannel','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x0f3a,0x193));var _0xa0f3=function(_0x2d993f,_0x482508){_0x2d993f=_0x2d993f-0x0;var _0x247c34=_0x0f3a[_0x2d993f];return _0x247c34;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa0f3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa0f3('0x1'));var rp=require('request-promise');var moment=require(_0xa0f3('0x2'));var BPromise=require(_0xa0f3('0x3'));var Mustache=require(_0xa0f3('0x4'));var util=require(_0xa0f3('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xa0f3('0x6'));var ejs=require(_0xa0f3('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa0f3('0x8'));var squel=require('squel');var crypto=require(_0xa0f3('0x9'));var jsforce=require(_0xa0f3('0xa'));var deskjs=require(_0xa0f3('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa0f3('0xc'));var Redis=require('ioredis');var authService=require(_0xa0f3('0xd'));var qs=require(_0xa0f3('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa0f3('0xf'));var logger=require(_0xa0f3('0x10'))(_0xa0f3('0x11'));var utils=require(_0xa0f3('0x12'));var config=require(_0xa0f3('0x13'));var licenseUtil=require(_0xa0f3('0x14'));var db=require(_0xa0f3('0x15'))['db'];config[_0xa0f3('0x16')]=_[_0xa0f3('0x17')](config[_0xa0f3('0x16')],{'host':_0xa0f3('0x18'),'port':0x18eb});var socket=require(_0xa0f3('0x19'))(new Redis(config['redis']));require(_0xa0f3('0x1a'))[_0xa0f3('0x1b')](socket);var jayson=require(_0xa0f3('0x1c'));var client=jayson[_0xa0f3('0x1d')][_0xa0f3('0x1e')]({'port':0x232c});var client9002=jayson[_0xa0f3('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1209f4,_0x58a3d7,_0x1a068a,_0x278998){return new BPromise(function(_0x3a28a5,_0x20696f){var _0x52cdc6=_0x278998||client;return _0x52cdc6[_0xa0f3('0x1f')](_0x1209f4,_0x1a068a)[_0xa0f3('0x20')](function(_0x2a2297){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x58a3d7,_0xa0f3('0x21'));logger[_0xa0f3('0x22')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x58a3d7,'request\x20sent',JSON[_0xa0f3('0x23')](_0x2a2297));if(_0x2a2297['error']){if(_0x2a2297[_0xa0f3('0x24')][_0xa0f3('0x25')]===0x1f4){logger[_0xa0f3('0x24')](_0xa0f3('0x26'),_0x58a3d7,_0x2a2297[_0xa0f3('0x24')]['message']);return _0x20696f(_0x2a2297[_0xa0f3('0x24')]['message']);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x58a3d7,_0x2a2297[_0xa0f3('0x24')]['message']);return _0x3a28a5(_0x2a2297[_0xa0f3('0x24')][_0xa0f3('0x27')]);}else{logger[_0xa0f3('0x28')]('WhatsappMessage,\x20%s,\x20%s',_0x58a3d7,_0xa0f3('0x21'));_0x3a28a5(_0x2a2297['result'][_0xa0f3('0x27')]);}})[_0xa0f3('0x29')](function(_0x1dffaf){logger['error'](_0xa0f3('0x26'),_0x58a3d7,_0x1dffaf);_0x20696f(_0x1dffaf);});});}function respondWithStatusCode(_0x54f0af,_0x13ac5e){_0x13ac5e=_0x13ac5e||0xcc;return function(_0x29ec4f){if(_0x29ec4f){return _0x54f0af['sendStatus'](_0x13ac5e);}return _0x54f0af[_0xa0f3('0x2a')](_0x13ac5e)[_0xa0f3('0x2b')]();};}function respondWithResult(_0x178bb4,_0x382df6){_0x382df6=_0x382df6||0xc8;return function(_0x20906f){if(_0x20906f){return _0x178bb4[_0xa0f3('0x2a')](_0x382df6)[_0xa0f3('0x2c')](_0x20906f);}};}function respondWithFilteredResult(_0x23a7fe,_0x2f4111){return function(_0xf85766){if(_0xf85766){var _0x47becb=typeof _0x2f4111[_0xa0f3('0x2d')]===_0xa0f3('0x2e')&&typeof _0x2f4111['limit']===_0xa0f3('0x2e');var _0x1bf7bc=_0xf85766['count'];var _0x5c68a3=_0x47becb?0x0:_0x2f4111[_0xa0f3('0x2d')];var _0x143cf9=_0x47becb?_0xf85766[_0xa0f3('0x2f')]:_0x2f4111[_0xa0f3('0x2d')]+_0x2f4111[_0xa0f3('0x30')];var _0x38a629;if(_0x143cf9>=_0x1bf7bc){_0x143cf9=_0x1bf7bc;_0x38a629=0xc8;}else{_0x38a629=0xce;}_0x23a7fe['status'](_0x38a629);return _0x23a7fe[_0xa0f3('0x31')](_0xa0f3('0x32'),_0x5c68a3+'-'+_0x143cf9+'/'+_0x1bf7bc)['json'](_0xf85766);}return null;};}function patchUpdates(_0x27a32a){return function(_0x2ee980){try{jsonpatch[_0xa0f3('0x33')](_0x2ee980,_0x27a32a,!![]);}catch(_0x37d39e){return BPromise[_0xa0f3('0x34')](_0x37d39e);}return _0x2ee980['save']();};}function saveUpdates(_0x5ab98b,_0x5bd52d){return function(_0x3d5fd5){if(_0x3d5fd5){return _0x3d5fd5[_0xa0f3('0x35')](_0x5ab98b)[_0xa0f3('0x20')](function(_0x34bbc3){return _0x34bbc3;});}return null;};}function removeEntity(_0x460022,_0x36c877){return function(_0x1c5407){if(_0x1c5407){return _0x1c5407[_0xa0f3('0x36')]()[_0xa0f3('0x20')](function(){_0x460022[_0xa0f3('0x2a')](0xcc)[_0xa0f3('0x2b')]();});}};}function handleEntityNotFound(_0x50d3be,_0x2ffd53){return function(_0x49be35){if(!_0x49be35){_0x50d3be['sendStatus'](0x194);}return _0x49be35;};}function handleError(_0x8a320,_0x45033e){_0x45033e=_0x45033e||0x1f4;return function(_0x59e71e){logger[_0xa0f3('0x24')](_0x59e71e[_0xa0f3('0x37')]);if(_0x59e71e[_0xa0f3('0x38')]){delete _0x59e71e['name'];}_0x8a320[_0xa0f3('0x2a')](_0x45033e)[_0xa0f3('0x39')](_0x59e71e);};}exports[_0xa0f3('0x3a')]=function(_0x31de25,_0x523459){var _0x5e099d={},_0x5106b6={},_0x2cf677={'count':0x0,'rows':[]};var _0x51e51f=_[_0xa0f3('0x3b')](db[_0xa0f3('0x3c')][_0xa0f3('0x3d')],function(_0x306b77){return{'name':_0x306b77['fieldName'],'type':_0x306b77[_0xa0f3('0x3e')][_0xa0f3('0x3f')]};});_0x5106b6[_0xa0f3('0x40')]=_[_0xa0f3('0x3b')](_0x51e51f,_0xa0f3('0x38'));_0x5106b6[_0xa0f3('0x41')]=_[_0xa0f3('0x42')](_0x31de25[_0xa0f3('0x41')]);_0x5106b6['filters']=_[_0xa0f3('0x43')](_0x5106b6[_0xa0f3('0x40')],_0x5106b6[_0xa0f3('0x41')]);_0x5e099d[_0xa0f3('0x44')]=_['intersection'](_0x5106b6[_0xa0f3('0x40')],qs[_0xa0f3('0x45')](_0x31de25[_0xa0f3('0x41')][_0xa0f3('0x45')]));_0x5e099d[_0xa0f3('0x44')]=_0x5e099d['attributes'][_0xa0f3('0x46')]?_0x5e099d[_0xa0f3('0x44')]:_0x5106b6[_0xa0f3('0x40')];if(!_0x31de25[_0xa0f3('0x41')][_0xa0f3('0x47')](_0xa0f3('0x48'))){_0x5e099d['limit']=qs[_0xa0f3('0x30')](_0x31de25['query'][_0xa0f3('0x30')]);_0x5e099d[_0xa0f3('0x2d')]=qs['offset'](_0x31de25[_0xa0f3('0x41')][_0xa0f3('0x2d')]);}_0x5e099d[_0xa0f3('0x49')]=qs[_0xa0f3('0x4a')](_0x31de25['query']['sort']);_0x5e099d[_0xa0f3('0x4b')]=qs['filters'](_[_0xa0f3('0x4c')](_0x31de25[_0xa0f3('0x41')],_0x5106b6[_0xa0f3('0x4d')]),_0x51e51f);if(_0x31de25[_0xa0f3('0x41')][_0xa0f3('0x4e')]){_0x5e099d[_0xa0f3('0x4b')]=_[_0xa0f3('0x4f')](_0x5e099d[_0xa0f3('0x4b')],{'$or':_['map'](_0x51e51f,function(_0x363e63){if(_0x363e63[_0xa0f3('0x3e')]!==_0xa0f3('0x50')){var _0x4862d0={};_0x4862d0[_0x363e63[_0xa0f3('0x38')]]={'$like':'%'+_0x31de25[_0xa0f3('0x41')]['filter']+'%'};return _0x4862d0;}})});}_0x5e099d=_[_0xa0f3('0x4f')]({},_0x5e099d,_0x31de25['options']);var _0x4bc751={'where':_0x5e099d[_0xa0f3('0x4b')]};return db[_0xa0f3('0x3c')]['count'](_0x4bc751)[_0xa0f3('0x20')](function(_0x4aa5ed){_0x2cf677[_0xa0f3('0x2f')]=_0x4aa5ed;if(_0x31de25['query'][_0xa0f3('0x51')]){_0x5e099d[_0xa0f3('0x52')]=[{'all':!![]}];}return db[_0xa0f3('0x3c')][_0xa0f3('0x53')](_0x5e099d);})[_0xa0f3('0x20')](function(_0x4702ec){_0x2cf677[_0xa0f3('0x54')]=_0x4702ec;return _0x2cf677;})[_0xa0f3('0x20')](respondWithFilteredResult(_0x523459,_0x5e099d))[_0xa0f3('0x29')](handleError(_0x523459,null));};exports[_0xa0f3('0x55')]=function(_0x39eb4f,_0x14bd50){var _0x5ab7ca={'raw':!![],'where':{'id':_0x39eb4f[_0xa0f3('0x56')]['id']}},_0x599f68={};_0x599f68[_0xa0f3('0x40')]=_[_0xa0f3('0x42')](db[_0xa0f3('0x3c')][_0xa0f3('0x3d')]);_0x599f68[_0xa0f3('0x41')]=_[_0xa0f3('0x42')](_0x39eb4f['query']);_0x599f68['filters']=_[_0xa0f3('0x43')](_0x599f68[_0xa0f3('0x40')],_0x599f68[_0xa0f3('0x41')]);_0x5ab7ca[_0xa0f3('0x44')]=_[_0xa0f3('0x43')](_0x599f68[_0xa0f3('0x40')],qs[_0xa0f3('0x45')](_0x39eb4f[_0xa0f3('0x41')][_0xa0f3('0x45')]));_0x5ab7ca[_0xa0f3('0x44')]=_0x5ab7ca[_0xa0f3('0x44')][_0xa0f3('0x46')]?_0x5ab7ca[_0xa0f3('0x44')]:_0x599f68[_0xa0f3('0x40')];if(_0x39eb4f[_0xa0f3('0x41')][_0xa0f3('0x51')]){_0x5ab7ca[_0xa0f3('0x52')]=[{'all':!![]}];}_0x5ab7ca=_['merge']({},_0x5ab7ca,_0x39eb4f[_0xa0f3('0x57')]);return db['WhatsappMessage'][_0xa0f3('0x58')](_0x5ab7ca)[_0xa0f3('0x20')](handleEntityNotFound(_0x14bd50,null))[_0xa0f3('0x20')](respondWithResult(_0x14bd50,null))[_0xa0f3('0x29')](handleError(_0x14bd50,null));};exports[_0xa0f3('0x59')]=function(_0x932878,_0x599390){return db[_0xa0f3('0x3c')][_0xa0f3('0x59')](_0x932878[_0xa0f3('0x5a')],{})['then'](respondWithResult(_0x599390,0xc9))[_0xa0f3('0x29')](handleError(_0x599390,null));};exports[_0xa0f3('0x35')]=function(_0x5dc3df,_0x252305){if(_0x5dc3df[_0xa0f3('0x5a')]['id']){delete _0x5dc3df[_0xa0f3('0x5a')]['id'];}return db['WhatsappMessage'][_0xa0f3('0x58')]({'where':{'id':_0x5dc3df[_0xa0f3('0x56')]['id']}})[_0xa0f3('0x20')](handleEntityNotFound(_0x252305,null))[_0xa0f3('0x20')](saveUpdates(_0x5dc3df['body'],null))[_0xa0f3('0x20')](respondWithResult(_0x252305,null))[_0xa0f3('0x29')](handleError(_0x252305,null));};exports[_0xa0f3('0x36')]=function(_0x2233fb,_0x1b00ca){return db[_0xa0f3('0x3c')][_0xa0f3('0x58')]({'where':{'id':_0x2233fb['params']['id']}})[_0xa0f3('0x20')](handleEntityNotFound(_0x1b00ca,null))['then'](removeEntity(_0x1b00ca,null))[_0xa0f3('0x29')](handleError(_0x1b00ca,null));};exports[_0xa0f3('0x5b')]=function(_0x345313,_0x14852b){return db[_0xa0f3('0x3c')][_0xa0f3('0x5b')]()[_0xa0f3('0x20')](respondWithResult(_0x14852b,null))[_0xa0f3('0x29')](handleError(_0x14852b,null));};var interaction_log=require(_0xa0f3('0x10'))('whatsapp-interactions');exports['accept']=function(_0x1fa28c,_0x796917,_0x43a4f5){var _0x4c21d2={'agent':{},'channel':_0xa0f3('0x5c')};if(_0x1fa28c[_0xa0f3('0x5a')]['id']){delete _0x1fa28c['body']['id'];}_0x1fa28c[_0xa0f3('0x5a')][_0xa0f3('0x5d')]=!![];_0x1fa28c[_0xa0f3('0x5a')]['readAt']=moment()[_0xa0f3('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x1fa28c[_0xa0f3('0x5a')][_0xa0f3('0x5f')]=_0x1fa28c['body']['UserId']||_0x1fa28c[_0xa0f3('0x60')]['id'];_0x4c21d2[_0xa0f3('0x61')]['id']=_0x1fa28c[_0xa0f3('0x5a')]['UserId'];return db[_0xa0f3('0x3c')]['find']({'where':{'id':_0x1fa28c['params']['id'],'UserId':null}})[_0xa0f3('0x20')](handleEntityNotFound(_0x796917,null))[_0xa0f3('0x20')](saveUpdates(_0x1fa28c['body'],null))[_0xa0f3('0x20')](function(_0x270ada){if(_0x270ada){_0x4c21d2[_0xa0f3('0x27')]=_0x270ada[_0xa0f3('0x62')]({'plain':!![]});return db[_0xa0f3('0x63')]['find']({'where':{'id':_0x270ada[_0xa0f3('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x796917,null))[_0xa0f3('0x20')](function(_0xbcf47){if(_0xbcf47){return _0xbcf47['update']({'UserId':_0x1fa28c[_0xa0f3('0x5a')][_0xa0f3('0x5f')],'read1stAt':_[_0xa0f3('0x65')](_0xbcf47[_0xa0f3('0x66')])?moment()[_0xa0f3('0x5e')](_0xa0f3('0x67')):undefined});}return null;})['then'](function(_0x537066){if(_0x537066){_0x4c21d2[_0xa0f3('0x68')]=_0x537066[_0xa0f3('0x62')]({'plain':!![]});interaction_log[_0xa0f3('0x28')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1fa28c[_0xa0f3('0x60')]['id'],_0x1fa28c[_0xa0f3('0x60')][_0xa0f3('0x38')],_0x1fa28c[_0xa0f3('0x60')][_0xa0f3('0x69')],_0x4c21d2[_0xa0f3('0x68')]['id'],_0x1fa28c[_0xa0f3('0x5a')]?JSON[_0xa0f3('0x23')](_0x1fa28c['body']):_0xa0f3('0x6a'));return respondWithRpcPromise('AcceptMessage',_0xa0f3('0x6b'),_0x4c21d2);}return null;})[_0xa0f3('0x20')](function(_0x549faf){var _0x2c3872=_0xa0f3('0x6c')+_0x549faf[_0xa0f3('0x27')][_0xa0f3('0x6d')];return db[_0xa0f3('0x6e')][_0xa0f3('0x41')](_0x2c3872,{'type':db[_0xa0f3('0x6f')][_0xa0f3('0x70')][_0xa0f3('0x71')],'raw':!![]})[_0xa0f3('0x20')](function(_0x55dc26){return _0x55dc26;});})[_0xa0f3('0x20')](function(_0x347c62){if(_0x347c62){_0x4c21d2[_0xa0f3('0x27')]['contact']=_0x347c62[0x0];if(!_0x1fa28c[_0xa0f3('0x5a')][_0xa0f3('0x5f')])return;return db[_0xa0f3('0x72')][_0xa0f3('0x58')]({'where':{'id':_0x1fa28c[_0xa0f3('0x5a')][_0xa0f3('0x5f')],'role':_0xa0f3('0x61')},'attributes':['id','name',_0xa0f3('0x73'),_0xa0f3('0x74'),_0xa0f3('0x75')],'raw':!![]});}return null;})[_0xa0f3('0x20')](function(_0xc02ecc){if(!_0xc02ecc)return null;_0x4c21d2[_0xa0f3('0x27')][_0xa0f3('0x61')]=_0xc02ecc;return _0x4c21d2;})[_0xa0f3('0x20')](function(_0x1b87e9){if(_0x1b87e9){if(_0x1fa28c[_0xa0f3('0x5a')][_0xa0f3('0x76')]){_0x4c21d2[_0xa0f3('0x27')][_0xa0f3('0x77')]=util[_0xa0f3('0x5e')]('SIP/%s',_0x1fa28c[_0xa0f3('0x60')][_0xa0f3('0x38')]);_0x4c21d2[_0xa0f3('0x27')]['channel']=_0x4c21d2[_0xa0f3('0x78')];_0x4c21d2[_0xa0f3('0x27')]['motionChannel']=_0x4c21d2[_0xa0f3('0x78')];_0x4c21d2[_0xa0f3('0x27')][_0xa0f3('0x79')]=_0xa0f3('0x7a');return respondWithRpcPromise(_0xa0f3('0x7b'),'EventManager',{'event':_0xa0f3('0x7c'),'message':_0x4c21d2[_0xa0f3('0x27')]},client9002)[_0xa0f3('0x20')](function(){return _0x4c21d2;});}return _0x4c21d2;}return null;})[_0xa0f3('0x20')](respondWithResult(_0x796917,null))['catch'](handleError(_0x796917,null));};var interaction_log=require('../../config/logger')(_0xa0f3('0x7d'));exports[_0xa0f3('0x34')]=function(_0x2d5651,_0x478183,_0x1a29cf){var _0x11cee8={'agent':{},'channel':_0xa0f3('0x5c')};if(_0x2d5651[_0xa0f3('0x5a')]['id']){delete _0x2d5651[_0xa0f3('0x5a')]['id'];}_0x2d5651[_0xa0f3('0x5a')][_0xa0f3('0x5f')]=_0x2d5651[_0xa0f3('0x5a')][_0xa0f3('0x5f')]||_0x2d5651[_0xa0f3('0x60')]['id'];_0x11cee8['agent']['id']=_0x2d5651[_0xa0f3('0x5a')]['UserId'];return db[_0xa0f3('0x3c')]['find']({'where':{'id':_0x2d5651['params']['id'],'UserId':null}})[_0xa0f3('0x20')](handleEntityNotFound(_0x478183,null))[_0xa0f3('0x20')](function(_0x1a4cc3){if(_0x1a4cc3){_0x11cee8['message']=_0x1a4cc3[_0xa0f3('0x62')]({'plain':!![]});return db[_0xa0f3('0x63')]['find']({'where':{'id':_0x1a4cc3[_0xa0f3('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x478183,null))[_0xa0f3('0x20')](function(_0x36d54e){if(_0x36d54e){_0x11cee8[_0xa0f3('0x68')]=_0x36d54e[_0xa0f3('0x62')]({'plain':!![]});interaction_log[_0xa0f3('0x28')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2d5651[_0xa0f3('0x60')]['id'],_0x2d5651[_0xa0f3('0x60')][_0xa0f3('0x38')],_0x2d5651[_0xa0f3('0x60')][_0xa0f3('0x69')],_0x11cee8[_0xa0f3('0x68')]['id'],_0x2d5651[_0xa0f3('0x5a')]?JSON[_0xa0f3('0x23')](_0x2d5651[_0xa0f3('0x5a')]):_0xa0f3('0x6a'));return respondWithRpcPromise(_0xa0f3('0x7e'),_0xa0f3('0x7f'),_0x11cee8);}return null;})[_0xa0f3('0x20')](function(_0x2bfbd3){var _0x7e939a=_0xa0f3('0x6c')+_0x2bfbd3['message'][_0xa0f3('0x6d')];return db[_0xa0f3('0x6e')][_0xa0f3('0x41')](_0x7e939a,{'type':db[_0xa0f3('0x6f')][_0xa0f3('0x70')][_0xa0f3('0x71')],'raw':!![]})['then'](function(_0x3e8d7c){return _0x3e8d7c;});})['then'](function(_0x34f0fa){if(_0x34f0fa){_0x11cee8[_0xa0f3('0x27')][_0xa0f3('0x80')]=_0x34f0fa[0x0];if(!_0x2d5651[_0xa0f3('0x5a')][_0xa0f3('0x5f')])return;return db[_0xa0f3('0x72')][_0xa0f3('0x58')]({'where':{'id':_0x2d5651[_0xa0f3('0x5a')][_0xa0f3('0x5f')],'role':_0xa0f3('0x61')},'attributes':['id',_0xa0f3('0x38'),_0xa0f3('0x73'),'email','internal'],'raw':!![]});}return null;})[_0xa0f3('0x20')](function(_0x8407c4){if(!_0x8407c4)return null;_0x11cee8[_0xa0f3('0x27')][_0xa0f3('0x61')]=_0x8407c4;return _0x11cee8;})['then'](function(_0x3b91f5){if(_0x3b91f5){_0x3b91f5[_0xa0f3('0x27')][_0xa0f3('0x77')]=util['format']('SIP/%s',_0x2d5651[_0xa0f3('0x60')][_0xa0f3('0x38')]);_0x3b91f5['message'][_0xa0f3('0x78')]=_0x11cee8[_0xa0f3('0x78')];_0x3b91f5[_0xa0f3('0x27')][_0xa0f3('0x81')]=_0x11cee8['channel'];_0x3b91f5['message'][_0xa0f3('0x79')]=_0xa0f3('0x34');respondWithRpcPromise(_0xa0f3('0x7b'),_0xa0f3('0x7b'),{'event':'rejectmessage','message':_0x3b91f5[_0xa0f3('0x27')]},client9002);return _0x11cee8;}return null;})[_0xa0f3('0x20')](respondWithResult(_0x478183,null))['catch'](handleError(_0x478183,null));};exports[_0xa0f3('0x2a')]=function(_0x143511,_0x13945c,_0x12421b){if(_0x143511[_0xa0f3('0x5a')]['id']){delete _0x143511[_0xa0f3('0x5a')]['id'];}var _0x43e12e;return db['WhatsappMessage'][_0xa0f3('0x58')]({'where':{'id':_0x143511[_0xa0f3('0x56')]['id']}})[_0xa0f3('0x20')](handleEntityNotFound(_0x13945c,null))['then'](function(_0x2a0dba){if(_0x2a0dba){_0x43e12e=_0x2a0dba;return db[_0xa0f3('0x82')]['find']({'where':{'id':_0x2a0dba[_0xa0f3('0x83')]}});}})[_0xa0f3('0x20')](handleEntityNotFound(_0x13945c,null))[_0xa0f3('0x20')](function(_0x37bb4c){if(_0x37bb4c){logger[_0xa0f3('0x22')](_0xa0f3('0x84'),'status','received\x20delivery\x20report\x20from',_0x37bb4c[_0xa0f3('0x3e')],util[_0xa0f3('0x85')](_0x143511[_0xa0f3('0x5a')],{'showHidden':![],'depth':null}));switch(_0x37bb4c[_0xa0f3('0x3e')]){case _0xa0f3('0x86'):if(_0x143511['body'][_0xa0f3('0x87')]&&_0x143511[_0xa0f3('0x5a')][_0xa0f3('0x87')]===_0x43e12e[_0xa0f3('0x88')]&&_0x143511[_0xa0f3('0x5a')]['MessageStatus']&&_0x143511['body']['MessageStatus']===_0xa0f3('0x5d')){return _0x43e12e['update']({'read':!![]});}else{logger[_0xa0f3('0x24')](_0xa0f3('0x89'),_0xa0f3('0x2a'),'twilio',util[_0xa0f3('0x85')](_0x143511[_0xa0f3('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x43e12e;}})['then'](respondWithResult(_0x13945c,null))[_0xa0f3('0x29')](handleError(_0x13945c,null));}; \ No newline at end of file +var _0x490a=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','stack','name','send','index','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','options','WhatsappMessage','includeAll','findAll','rows','show','keys','fields','length','include','create','body','find','params','describe','../../config/logger','whatsapp-interactions','read','readAt','format','UserId','user','get','WhatsappInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','internal','agent','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','fullname','rejectmessage','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3c38c7,_0x39c81f){var _0x11b128=function(_0x688ff8){while(--_0x688ff8){_0x3c38c7['push'](_0x3c38c7['shift']());}};_0x11b128(++_0x39c81f);}(_0x490a,0x1ad));var _0xa490=function(_0x3d0eb1,_0x21ae79){_0x3d0eb1=_0x3d0eb1-0x0;var _0x3d0018=_0x490a[_0x3d0eb1];return _0x3d0018;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa490('0x0'));var zipdir=require(_0xa490('0x1'));var jsonpatch=require(_0xa490('0x2'));var rp=require(_0xa490('0x3'));var moment=require(_0xa490('0x4'));var BPromise=require(_0xa490('0x5'));var Mustache=require('mustache');var util=require(_0xa490('0x6'));var path=require(_0xa490('0x7'));var sox=require(_0xa490('0x8'));var csv=require('to-csv');var ejs=require(_0xa490('0x9'));var fs=require('fs');var fs_extra=require(_0xa490('0xa'));var _=require(_0xa490('0xb'));var squel=require(_0xa490('0xc'));var crypto=require(_0xa490('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa490('0xe'));var toCsv=require(_0xa490('0xf'));var querystring=require(_0xa490('0x10'));var Papa=require(_0xa490('0x11'));var Redis=require(_0xa490('0x12'));var authService=require(_0xa490('0x13'));var qs=require(_0xa490('0x14'));var as=require(_0xa490('0x15'));var hardwareService=require(_0xa490('0x16'));var logger=require('../../config/logger')(_0xa490('0x17'));var utils=require(_0xa490('0x18'));var config=require(_0xa490('0x19'));var licenseUtil=require(_0xa490('0x1a'));var db=require(_0xa490('0x1b'))['db'];config[_0xa490('0x1c')]=_[_0xa490('0x1d')](config['redis'],{'host':_0xa490('0x1e'),'port':0x18eb});var socket=require(_0xa490('0x1f'))(new Redis(config[_0xa490('0x1c')]));require('./whatsappMessage.socket')[_0xa490('0x20')](socket);var jayson=require(_0xa490('0x21'));var client=jayson[_0xa490('0x22')]['http']({'port':0x232c});var client9002=jayson[_0xa490('0x22')][_0xa490('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x32150d,_0x39d3f8,_0x4dd8e3,_0x5cf6aa){return new BPromise(function(_0x26206d,_0x5d09a6){var _0x564f55=_0x5cf6aa||client;return _0x564f55[_0xa490('0x24')](_0x32150d,_0x4dd8e3)['then'](function(_0xb551cb){logger['info'](_0xa490('0x25'),_0x39d3f8,_0xa490('0x26'));logger[_0xa490('0x27')](_0xa490('0x28'),_0x39d3f8,'request\x20sent',JSON[_0xa490('0x29')](_0xb551cb));if(_0xb551cb[_0xa490('0x2a')]){if(_0xb551cb[_0xa490('0x2a')][_0xa490('0x2b')]===0x1f4){logger['error'](_0xa490('0x25'),_0x39d3f8,_0xb551cb[_0xa490('0x2a')]['message']);return _0x5d09a6(_0xb551cb['error']['message']);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x39d3f8,_0xb551cb['error'][_0xa490('0x2c')]);return _0x26206d(_0xb551cb[_0xa490('0x2a')]['message']);}else{logger[_0xa490('0x2d')](_0xa490('0x25'),_0x39d3f8,_0xa490('0x26'));_0x26206d(_0xb551cb[_0xa490('0x2e')][_0xa490('0x2c')]);}})[_0xa490('0x2f')](function(_0x356ca8){logger[_0xa490('0x2a')]('WhatsappMessage,\x20%s,\x20%s',_0x39d3f8,_0x356ca8);_0x5d09a6(_0x356ca8);});});}function respondWithStatusCode(_0x5aafdb,_0x1683c7){_0x1683c7=_0x1683c7||0xcc;return function(_0x4f7bd7){if(_0x4f7bd7){return _0x5aafdb[_0xa490('0x30')](_0x1683c7);}return _0x5aafdb[_0xa490('0x31')](_0x1683c7)[_0xa490('0x32')]();};}function respondWithResult(_0x1925b4,_0xc4a4c6){_0xc4a4c6=_0xc4a4c6||0xc8;return function(_0x2f4502){if(_0x2f4502){return _0x1925b4[_0xa490('0x31')](_0xc4a4c6)['json'](_0x2f4502);}};}function respondWithFilteredResult(_0x2f63b9,_0x3de42c){return function(_0x5b726a){if(_0x5b726a){var _0x3960c6=typeof _0x3de42c[_0xa490('0x33')]===_0xa490('0x34')&&typeof _0x3de42c['limit']===_0xa490('0x34');var _0x6185a9=_0x5b726a[_0xa490('0x35')];var _0x3c85fc=_0x3960c6?0x0:_0x3de42c['offset'];var _0x5049f0=_0x3960c6?_0x5b726a[_0xa490('0x35')]:_0x3de42c['offset']+_0x3de42c[_0xa490('0x36')];var _0x361707;if(_0x5049f0>=_0x6185a9){_0x5049f0=_0x6185a9;_0x361707=0xc8;}else{_0x361707=0xce;}_0x2f63b9['status'](_0x361707);return _0x2f63b9[_0xa490('0x37')](_0xa490('0x38'),_0x3c85fc+'-'+_0x5049f0+'/'+_0x6185a9)[_0xa490('0x39')](_0x5b726a);}return null;};}function patchUpdates(_0x570c37){return function(_0x2b68c8){try{jsonpatch[_0xa490('0x3a')](_0x2b68c8,_0x570c37,!![]);}catch(_0x12890c){return BPromise[_0xa490('0x3b')](_0x12890c);}return _0x2b68c8[_0xa490('0x3c')]();};}function saveUpdates(_0x2ebc93,_0x3dbdd8){return function(_0x301948){if(_0x301948){return _0x301948[_0xa490('0x3d')](_0x2ebc93)['then'](function(_0x3e4e03){return _0x3e4e03;});}return null;};}function removeEntity(_0x57700a,_0x564af7){return function(_0x2e3bd7){if(_0x2e3bd7){return _0x2e3bd7[_0xa490('0x3e')]()[_0xa490('0x3f')](function(){_0x57700a[_0xa490('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1eed8d,_0x7344c5){return function(_0x3d2544){if(!_0x3d2544){_0x1eed8d['sendStatus'](0x194);}return _0x3d2544;};}function handleError(_0x10f636,_0x7726d){_0x7726d=_0x7726d||0x1f4;return function(_0x5caabc){logger[_0xa490('0x2a')](_0x5caabc[_0xa490('0x40')]);if(_0x5caabc[_0xa490('0x41')]){delete _0x5caabc[_0xa490('0x41')];}_0x10f636[_0xa490('0x31')](_0x7726d)[_0xa490('0x42')](_0x5caabc);};}exports[_0xa490('0x43')]=function(_0x5a1ce2,_0xba078b){var _0xec9f60={},_0x339346={},_0x33abf9={'count':0x0,'rows':[]};var _0x1156bb=_['map'](db['WhatsappMessage'][_0xa490('0x44')],function(_0x29adbd){return{'name':_0x29adbd[_0xa490('0x45')],'type':_0x29adbd[_0xa490('0x46')][_0xa490('0x47')]};});_0x339346['model']=_['map'](_0x1156bb,_0xa490('0x41'));_0x339346[_0xa490('0x48')]=_['keys'](_0x5a1ce2['query']);_0x339346[_0xa490('0x49')]=_[_0xa490('0x4a')](_0x339346[_0xa490('0x4b')],_0x339346[_0xa490('0x48')]);_0xec9f60['attributes']=_[_0xa490('0x4a')](_0x339346[_0xa490('0x4b')],qs['fields'](_0x5a1ce2[_0xa490('0x48')]['fields']));_0xec9f60[_0xa490('0x4c')]=_0xec9f60[_0xa490('0x4c')]['length']?_0xec9f60[_0xa490('0x4c')]:_0x339346[_0xa490('0x4b')];if(!_0x5a1ce2['query'][_0xa490('0x4d')](_0xa490('0x4e'))){_0xec9f60[_0xa490('0x36')]=qs[_0xa490('0x36')](_0x5a1ce2[_0xa490('0x48')][_0xa490('0x36')]);_0xec9f60['offset']=qs['offset'](_0x5a1ce2['query']['offset']);}_0xec9f60[_0xa490('0x4f')]=qs['sort'](_0x5a1ce2[_0xa490('0x48')][_0xa490('0x50')]);_0xec9f60[_0xa490('0x51')]=qs['filters'](_[_0xa490('0x52')](_0x5a1ce2[_0xa490('0x48')],_0x339346[_0xa490('0x49')]),_0x1156bb);if(_0x5a1ce2[_0xa490('0x48')]['filter']){_0xec9f60[_0xa490('0x51')]=_['merge'](_0xec9f60['where'],{'$or':_[_0xa490('0x53')](_0x1156bb,function(_0x42b340){if(_0x42b340['type']!==_0xa490('0x54')){var _0xb589b1={};_0xb589b1[_0x42b340[_0xa490('0x41')]]={'$like':'%'+_0x5a1ce2[_0xa490('0x48')][_0xa490('0x55')]+'%'};return _0xb589b1;}})});}_0xec9f60=_[_0xa490('0x56')]({},_0xec9f60,_0x5a1ce2[_0xa490('0x57')]);var _0x394c0b={'where':_0xec9f60[_0xa490('0x51')]};return db[_0xa490('0x58')][_0xa490('0x35')](_0x394c0b)[_0xa490('0x3f')](function(_0x4e032c){_0x33abf9[_0xa490('0x35')]=_0x4e032c;if(_0x5a1ce2['query'][_0xa490('0x59')]){_0xec9f60['include']=[{'all':!![]}];}return db[_0xa490('0x58')][_0xa490('0x5a')](_0xec9f60);})[_0xa490('0x3f')](function(_0x292220){_0x33abf9[_0xa490('0x5b')]=_0x292220;return _0x33abf9;})['then'](respondWithFilteredResult(_0xba078b,_0xec9f60))[_0xa490('0x2f')](handleError(_0xba078b,null));};exports[_0xa490('0x5c')]=function(_0xc44e82,_0x323f75){var _0x57c632={'raw':!![],'where':{'id':_0xc44e82['params']['id']}},_0x338609={};_0x338609[_0xa490('0x4b')]=_[_0xa490('0x5d')](db[_0xa490('0x58')][_0xa490('0x44')]);_0x338609[_0xa490('0x48')]=_[_0xa490('0x5d')](_0xc44e82[_0xa490('0x48')]);_0x338609['filters']=_[_0xa490('0x4a')](_0x338609[_0xa490('0x4b')],_0x338609[_0xa490('0x48')]);_0x57c632[_0xa490('0x4c')]=_[_0xa490('0x4a')](_0x338609['model'],qs[_0xa490('0x5e')](_0xc44e82[_0xa490('0x48')][_0xa490('0x5e')]));_0x57c632[_0xa490('0x4c')]=_0x57c632[_0xa490('0x4c')][_0xa490('0x5f')]?_0x57c632[_0xa490('0x4c')]:_0x338609[_0xa490('0x4b')];if(_0xc44e82['query'][_0xa490('0x59')]){_0x57c632[_0xa490('0x60')]=[{'all':!![]}];}_0x57c632=_[_0xa490('0x56')]({},_0x57c632,_0xc44e82[_0xa490('0x57')]);return db[_0xa490('0x58')]['find'](_0x57c632)['then'](handleEntityNotFound(_0x323f75,null))[_0xa490('0x3f')](respondWithResult(_0x323f75,null))['catch'](handleError(_0x323f75,null));};exports[_0xa490('0x61')]=function(_0x31b152,_0x1fdcd1){return db['WhatsappMessage'][_0xa490('0x61')](_0x31b152['body'],{})[_0xa490('0x3f')](respondWithResult(_0x1fdcd1,0xc9))[_0xa490('0x2f')](handleError(_0x1fdcd1,null));};exports[_0xa490('0x3d')]=function(_0x88ce52,_0x10aa73){if(_0x88ce52[_0xa490('0x62')]['id']){delete _0x88ce52['body']['id'];}return db['WhatsappMessage'][_0xa490('0x63')]({'where':{'id':_0x88ce52[_0xa490('0x64')]['id']}})[_0xa490('0x3f')](handleEntityNotFound(_0x10aa73,null))['then'](saveUpdates(_0x88ce52[_0xa490('0x62')],null))[_0xa490('0x3f')](respondWithResult(_0x10aa73,null))[_0xa490('0x2f')](handleError(_0x10aa73,null));};exports[_0xa490('0x3e')]=function(_0x4d4174,_0x28fad0){return db[_0xa490('0x58')][_0xa490('0x63')]({'where':{'id':_0x4d4174['params']['id']}})[_0xa490('0x3f')](handleEntityNotFound(_0x28fad0,null))['then'](removeEntity(_0x28fad0,null))[_0xa490('0x2f')](handleError(_0x28fad0,null));};exports[_0xa490('0x65')]=function(_0x572d5b,_0xbeb9d3){return db['WhatsappMessage']['describe']()['then'](respondWithResult(_0xbeb9d3,null))[_0xa490('0x2f')](handleError(_0xbeb9d3,null));};var interaction_log=require(_0xa490('0x66'))(_0xa490('0x67'));exports['accept']=function(_0x3bf298,_0x5ba723,_0x218b70){var _0x206008={'agent':{},'channel':'whatsapp'};if(_0x3bf298[_0xa490('0x62')]['id']){delete _0x3bf298[_0xa490('0x62')]['id'];}_0x3bf298[_0xa490('0x62')][_0xa490('0x68')]=!![];_0x3bf298[_0xa490('0x62')][_0xa490('0x69')]=moment()[_0xa490('0x6a')]('YYYY-MM-DD\x20HH:mm:ss');_0x3bf298['body'][_0xa490('0x6b')]=_0x3bf298[_0xa490('0x62')][_0xa490('0x6b')]||_0x3bf298[_0xa490('0x6c')]['id'];_0x206008['agent']['id']=_0x3bf298[_0xa490('0x62')][_0xa490('0x6b')];return db[_0xa490('0x58')][_0xa490('0x63')]({'where':{'id':_0x3bf298[_0xa490('0x64')]['id'],'UserId':null}})[_0xa490('0x3f')](handleEntityNotFound(_0x5ba723,null))[_0xa490('0x3f')](saveUpdates(_0x3bf298[_0xa490('0x62')],null))['then'](function(_0x4bd63a){if(_0x4bd63a){_0x206008[_0xa490('0x2c')]=_0x4bd63a[_0xa490('0x6d')]({'plain':!![]});return db['WhatsappInteraction'][_0xa490('0x63')]({'where':{'id':_0x4bd63a[_0xa490('0x6e')]}});}return null;})[_0xa490('0x3f')](handleEntityNotFound(_0x5ba723,null))[_0xa490('0x3f')](function(_0x19a8db){if(_0x19a8db){return _0x19a8db['update']({'UserId':_0x3bf298[_0xa490('0x62')][_0xa490('0x6b')],'read1stAt':_[_0xa490('0x6f')](_0x19a8db[_0xa490('0x70')])?moment()[_0xa490('0x6a')](_0xa490('0x71')):undefined});}return null;})['then'](function(_0x3e85af){if(_0x3e85af){_0x206008[_0xa490('0x72')]=_0x3e85af['get']({'plain':!![]});interaction_log[_0xa490('0x2d')](_0xa490('0x73'),_0x3bf298[_0xa490('0x6c')]['id'],_0x3bf298[_0xa490('0x6c')][_0xa490('0x41')],_0x3bf298[_0xa490('0x6c')][_0xa490('0x74')],_0x206008[_0xa490('0x72')]['id'],_0x3bf298[_0xa490('0x62')]?JSON[_0xa490('0x29')](_0x3bf298[_0xa490('0x62')]):_0xa490('0x75'));return respondWithRpcPromise(_0xa490('0x76'),_0xa490('0x77'),_0x206008);}return null;})[_0xa490('0x3f')](function(_0x258117){var _0x1de5c1=_0xa490('0x78')+_0x258117[_0xa490('0x2c')][_0xa490('0x79')];return db[_0xa490('0x7a')][_0xa490('0x48')](_0x1de5c1,{'type':db[_0xa490('0x7b')][_0xa490('0x7c')][_0xa490('0x7d')],'raw':!![]})[_0xa490('0x3f')](function(_0x9ace45){return _0x9ace45;});})[_0xa490('0x3f')](function(_0x4e6898){if(_0x4e6898){_0x206008[_0xa490('0x2c')][_0xa490('0x7e')]=_0x4e6898[0x0];if(!_0x3bf298[_0xa490('0x62')]['UserId'])return;return db[_0xa490('0x7f')][_0xa490('0x63')]({'where':{'id':_0x3bf298[_0xa490('0x62')]['UserId'],'role':'agent'},'attributes':['id',_0xa490('0x41'),'fullname',_0xa490('0x80'),_0xa490('0x81')],'raw':!![]});}return null;})[_0xa490('0x3f')](function(_0x58d6c0){if(!_0x58d6c0)return null;_0x206008['message'][_0xa490('0x82')]=_0x58d6c0;return _0x206008;})[_0xa490('0x3f')](function(_0x5366ab){if(_0x5366ab){if(_0x3bf298[_0xa490('0x62')][_0xa490('0x83')]){_0x206008[_0xa490('0x2c')][_0xa490('0x84')]=util[_0xa490('0x6a')](_0xa490('0x85'),_0x3bf298[_0xa490('0x6c')][_0xa490('0x41')]);_0x206008[_0xa490('0x2c')][_0xa490('0x86')]=_0x206008['channel'];_0x206008[_0xa490('0x2c')][_0xa490('0x87')]=_0x206008[_0xa490('0x86')];_0x206008['message'][_0xa490('0x88')]='accept';return respondWithRpcPromise(_0xa490('0x89'),_0xa490('0x89'),{'event':'acceptmessage','message':_0x206008[_0xa490('0x2c')]},client9002)[_0xa490('0x3f')](function(){return _0x206008;});}return _0x206008;}return null;})[_0xa490('0x3f')](respondWithResult(_0x5ba723,null))[_0xa490('0x2f')](handleError(_0x5ba723,null));};var interaction_log=require(_0xa490('0x66'))('whatsapp-interactions');exports[_0xa490('0x3b')]=function(_0x126312,_0x5bcccd,_0x2c81f0){var _0x3244a0={'agent':{},'channel':'whatsapp'};if(_0x126312[_0xa490('0x62')]['id']){delete _0x126312[_0xa490('0x62')]['id'];}_0x126312[_0xa490('0x62')][_0xa490('0x6b')]=_0x126312[_0xa490('0x62')][_0xa490('0x6b')]||_0x126312[_0xa490('0x6c')]['id'];_0x3244a0['agent']['id']=_0x126312[_0xa490('0x62')][_0xa490('0x6b')];return db['WhatsappMessage'][_0xa490('0x63')]({'where':{'id':_0x126312['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5bcccd,null))[_0xa490('0x3f')](function(_0x49ad3e){if(_0x49ad3e){_0x3244a0[_0xa490('0x2c')]=_0x49ad3e['get']({'plain':!![]});return db['WhatsappInteraction'][_0xa490('0x63')]({'where':{'id':_0x49ad3e[_0xa490('0x6e')]}});}return null;})['then'](handleEntityNotFound(_0x5bcccd,null))[_0xa490('0x3f')](function(_0x3a215c){if(_0x3a215c){_0x3244a0[_0xa490('0x72')]=_0x3a215c['get']({'plain':!![]});interaction_log[_0xa490('0x2d')](_0xa490('0x8a'),_0x126312[_0xa490('0x6c')]['id'],_0x126312['user']['name'],_0x126312['user'][_0xa490('0x74')],_0x3244a0[_0xa490('0x72')]['id'],_0x126312['body']?JSON['stringify'](_0x126312[_0xa490('0x62')]):_0xa490('0x75'));return respondWithRpcPromise(_0xa490('0x8b'),_0xa490('0x8c'),_0x3244a0);}return null;})[_0xa490('0x3f')](function(_0x498e5e){var _0x383d07=_0xa490('0x78')+_0x498e5e['message'][_0xa490('0x79')];return db['sequelize']['query'](_0x383d07,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x40c8d8){return _0x40c8d8;});})[_0xa490('0x3f')](function(_0x406536){if(_0x406536){_0x3244a0[_0xa490('0x2c')][_0xa490('0x7e')]=_0x406536[0x0];if(!_0x126312['body'][_0xa490('0x6b')])return;return db[_0xa490('0x7f')][_0xa490('0x63')]({'where':{'id':_0x126312[_0xa490('0x62')]['UserId'],'role':_0xa490('0x82')},'attributes':['id',_0xa490('0x41'),_0xa490('0x8d'),_0xa490('0x80'),'internal'],'raw':!![]});}return null;})['then'](function(_0x4f6f84){if(!_0x4f6f84)return null;_0x3244a0[_0xa490('0x2c')]['agent']=_0x4f6f84;return _0x3244a0;})['then'](function(_0x5dfa19){if(_0x5dfa19){_0x5dfa19[_0xa490('0x2c')][_0xa490('0x84')]=util[_0xa490('0x6a')](_0xa490('0x85'),_0x126312[_0xa490('0x6c')][_0xa490('0x41')]);_0x5dfa19[_0xa490('0x2c')][_0xa490('0x86')]=_0x3244a0[_0xa490('0x86')];_0x5dfa19[_0xa490('0x2c')]['motionChannel']=_0x3244a0[_0xa490('0x86')];_0x5dfa19['message'][_0xa490('0x88')]=_0xa490('0x3b');respondWithRpcPromise(_0xa490('0x89'),_0xa490('0x89'),{'event':_0xa490('0x8e'),'message':_0x5dfa19[_0xa490('0x2c')]},client9002);return _0x3244a0;}return null;})['then'](respondWithResult(_0x5bcccd,null))[_0xa490('0x2f')](handleError(_0x5bcccd,null));};exports[_0xa490('0x31')]=function(_0x19bab3,_0x2d111a,_0x3570a3){if(_0x19bab3['body']['id']){delete _0x19bab3[_0xa490('0x62')]['id'];}var _0x5759a9;return db[_0xa490('0x58')][_0xa490('0x63')]({'where':{'id':_0x19bab3[_0xa490('0x64')]['id']}})['then'](handleEntityNotFound(_0x2d111a,null))['then'](function(_0x2809b2){if(_0x2809b2){_0x5759a9=_0x2809b2;return db['WhatsappAccount'][_0xa490('0x63')]({'where':{'id':_0x2809b2[_0xa490('0x8f')]}});}})[_0xa490('0x3f')](handleEntityNotFound(_0x2d111a,null))[_0xa490('0x3f')](function(_0x1cf6b0){if(_0x1cf6b0){logger[_0xa490('0x27')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xa490('0x31'),_0xa490('0x90'),_0x1cf6b0[_0xa490('0x46')],util[_0xa490('0x91')](_0x19bab3[_0xa490('0x62')],{'showHidden':![],'depth':null}));switch(_0x1cf6b0[_0xa490('0x46')]){case _0xa490('0x92'):if(_0x19bab3['body'][_0xa490('0x93')]&&_0x19bab3[_0xa490('0x62')][_0xa490('0x93')]===_0x5759a9[_0xa490('0x94')]&&_0x19bab3[_0xa490('0x62')][_0xa490('0x95')]&&_0x19bab3[_0xa490('0x62')][_0xa490('0x95')]===_0xa490('0x68')){return _0x5759a9['update']({'read':!![]});}else{logger[_0xa490('0x2a')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xa490('0x31'),_0xa490('0x92'),util[_0xa490('0x91')](_0x19bab3[_0xa490('0x62')],{'showHidden':![],'depth':null}));}break;}return _0x5759a9;}})['then'](respondWithResult(_0x2d111a,null))[_0xa490('0x2f')](handleError(_0x2d111a,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index ea2ebbf..1010012 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 _0xcf66=['exports','events','../../mysqldb','WhatsappMessage','save','update','emit','hasOwnProperty'];(function(_0x18856a,_0x5d09af){var _0x4d285a=function(_0x16a37e){while(--_0x16a37e){_0x18856a['push'](_0x18856a['shift']());}};_0x4d285a(++_0x5d09af);}(_0xcf66,0x71));var _0x6cf6=function(_0x51ce29,_0x2c0867){_0x51ce29=_0x51ce29-0x0;var _0x2b08ca=_0xcf66[_0x51ce29];return _0x2b08ca;};'use strict';var EventEmitter=require(_0x6cf6('0x0'));var WhatsappMessage=require(_0x6cf6('0x1'))['db'][_0x6cf6('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6cf6('0x3'),'afterUpdate':_0x6cf6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4e16eb){return function(_0x1c599d,_0x45d0d8,_0x57f22f){WhatsappMessageEvents[_0x6cf6('0x5')](_0x4e16eb+':'+_0x1c599d['id'],_0x1c599d);WhatsappMessageEvents[_0x6cf6('0x5')](_0x4e16eb,_0x1c599d);_0x57f22f(null);};}for(var e in events){if(events[_0x6cf6('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x6cf6('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0x236c=['WhatsappMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x49c699,_0x314403){var _0x2853ea=function(_0x68ceb9){while(--_0x68ceb9){_0x49c699['push'](_0x49c699['shift']());}};_0x2853ea(++_0x314403);}(_0x236c,0x155));var _0xc236=function(_0x40d843,_0x3a4115){_0x40d843=_0x40d843-0x0;var _0x3d83a4=_0x236c[_0x40d843];return _0x3d83a4;};'use strict';var EventEmitter=require(_0xc236('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xc236('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xc236('0x2')](0x0);var events={'afterCreate':_0xc236('0x3'),'afterUpdate':_0xc236('0x4'),'afterDestroy':_0xc236('0x5')};function emitEvent(_0x518d6a){return function(_0x3adce9,_0x36e87d,_0x33bc57){WhatsappMessageEvents[_0xc236('0x6')](_0x518d6a+':'+_0x3adce9['id'],_0x3adce9);WhatsappMessageEvents[_0xc236('0x6')](_0x518d6a,_0x3adce9);_0x33bc57(null);};}for(var e in events){if(events[_0xc236('0x7')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xc236('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 beafced..9dbec13 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 _0x777f=['../../config/environment','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','then','update','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','phone','authToken','messages','whatsapp:','/api/whatsapp/messages/','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/whatsapp/v1/','text','POST','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','rimraf'];(function(_0xd99a75,_0x455205){var _0x73bdfb=function(_0xf5540b){while(--_0xf5540b){_0xd99a75['push'](_0xd99a75['shift']());}};_0x73bdfb(++_0x455205);}(_0x777f,0x9f));var _0xf777=function(_0x254b22,_0x27159f){_0x254b22=_0x254b22-0x0;var _0x1279db=_0x777f[_0x254b22];return _0x1279db;};'use strict';var _=require(_0xf777('0x0'));var util=require(_0xf777('0x1'));var logger=require(_0xf777('0x2'))(_0xf777('0x3'));var moment=require(_0xf777('0x4'));var BPromise=require(_0xf777('0x5'));var rp=require(_0xf777('0x6'));var fetch=require(_0xf777('0x7'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf777('0x8'));var config=require(_0xf777('0x9'));var attributes=require('./whatsappMessage.attributes');module['exports']=function(_0x5df5dc,_0xa78a3){return _0x5df5dc[_0xf777('0xa')](_0xf777('0xb'),attributes,{'tableName':_0xf777('0xc'),'paranoid':![],'indexes':[{'name':_0xf777('0xd'),'fields':[_0xf777('0xd')]},{'name':_0xf777('0xe'),'fields':[_0xf777('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b849a,_0x5d8752,_0x121128){var _0x2bfd8c=_0x5df5dc['models'];var _0x133cfc=_0x4b849a[_0xf777('0x10')]({'plain':!![]});if(_0x133cfc[_0xf777('0x11')]['toLowerCase']()==='in'||_0x133cfc[_0xf777('0x11')][_0xf777('0x12')]()===_0xf777('0x13')&&!_0x133cfc[_0xf777('0x14')]&&!_[_0xf777('0x15')](_0x133cfc[_0xf777('0x16')])){_0x2bfd8c[_0xf777('0x17')]['findOne']({'where':{'id':_0x133cfc['WhatsappInteractionId']}})[_0xf777('0x18')](function(_0x599c09){if(_0x599c09){_0x599c09[_0xf777('0x19')]({'lastMsgAt':_0x133cfc[_0xf777('0x1a')],'lastMsgDirection':_0x133cfc[_0xf777('0x11')]['toLowerCase']()});}})[_0xf777('0x1b')](function(_0xa9c4f8){console[_0xf777('0x1c')](_0xa9c4f8);});}if(_0x133cfc[_0xf777('0x11')]===_0xf777('0x13')&&!_0x133cfc[_0xf777('0x14')]){var _0x263c7f;_0x2bfd8c[_0xf777('0x1d')][_0xf777('0x1e')]({'where':{'id':_0x133cfc[_0xf777('0x1f')]},'raw':!![]})[_0xf777('0x18')](function(_0x5ac512){_0x263c7f=_0x5ac512;if(_0x263c7f&&_0x263c7f[_0xf777('0x20')]){switch(_0x263c7f['type']){case _0xf777('0x21'):var _0x5a5b80=require(_0xf777('0x21'));if(_0x263c7f['accountSid']&&_0x263c7f['authToken']&&_0x263c7f[_0xf777('0x22')]){var _0x3ffa51=new _0x5a5b80(_0x263c7f['accountSid'],_0x263c7f[_0xf777('0x23')]);_0x3ffa51[_0xf777('0x24')]['create']({'body':_0x133cfc['body'],'to':'whatsapp:'+_0x133cfc[_0xf777('0x22')],'from':_0xf777('0x25')+_0x263c7f['phone'],'statusCallback':_0x263c7f['remote']+_0xf777('0x26')+_0x133cfc['id']+'/status?token='+_0x263c7f[_0xf777('0x27')]})['then'](function(_0x2b4a0f){if(_0x2b4a0f['sid']){return _0x4b849a['update']({'messageId':_0x2b4a0f[_0xf777('0x28')]});}})['catch'](function(_0x9b8b20){logger['error'](_0xf777('0x29'),_0xf777('0x2a'),_0xf777('0x21'),util[_0xf777('0x2b')](_0x9b8b20,{'showHidden':![],'depth':null}));});}else{logger[_0xf777('0x1c')](_0xf777('0x29'),'afterCreate',_0xf777('0x21'),_0xf777('0x2c'));}break;case _0xf777('0x2d'):var _0x4f38f2=_0x263c7f['accountSid'];var _0x451e21=_0x263c7f['authToken'];var _0x2719c3=_0x263c7f['baseUrl']+_0xf777('0x2e')+_0x4f38f2+'/messages/';var _0x30f09b={'to':[_0x133cfc[_0xf777('0x22')]],'message':{'type':_0xf777('0x2f'),'text':_0x133cfc[_0xf777('0xf')]}};var _0x3492bd={'method':_0xf777('0x30'),'uri':_0x2719c3,'headers':{'Authorization':'Bearer\x20'+_0x451e21,'Content-Type':_0xf777('0x31')},'body':_0x30f09b,'json':!![]};rp(_0x3492bd)[_0xf777('0x18')](function(_0x2e41bd){if(_0x2e41bd[_0xf777('0x32')][0x0][_0xf777('0x33')]){return _0x4b849a[_0xf777('0x19')]({'messageId':_0x2e41bd[_0xf777('0x32')][0x0]['message_id']});}})[_0xf777('0x1b')](function(_0x342e67){logger[_0xf777('0x34')](_0xf777('0x35'),_0x342e67);});break;}}})[_0xf777('0x36')](function(){_0x121128();});}else{_0x121128();}}},'charset':_0xf777('0x37'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5cad=['/whatsapp/v1/','text','POST','Bearer\x20','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','WhatsappInteraction','findOne','then','update','createdAt','catch','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','accountSid','messages','create','body','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','token','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x5cad,0x8c));var _0xd5ca=function(_0x4b9e80,_0x2b3179){_0x4b9e80=_0x4b9e80-0x0;var _0xc73b33=_0x5cad[_0x4b9e80];return _0xc73b33;};'use strict';var _=require(_0xd5ca('0x0'));var util=require(_0xd5ca('0x1'));var logger=require(_0xd5ca('0x2'))(_0xd5ca('0x3'));var moment=require(_0xd5ca('0x4'));var BPromise=require(_0xd5ca('0x5'));var rp=require(_0xd5ca('0x6'));var fetch=require(_0xd5ca('0x7'));var fs=require('fs');var path=require(_0xd5ca('0x8'));var rimraf=require(_0xd5ca('0x9'));var config=require(_0xd5ca('0xa'));var attributes=require(_0xd5ca('0xb'));module[_0xd5ca('0xc')]=function(_0x462093,_0x33574c){return _0x462093[_0xd5ca('0xd')](_0xd5ca('0xe'),attributes,{'tableName':_0xd5ca('0xf'),'paranoid':![],'indexes':[{'name':_0xd5ca('0x10'),'fields':[_0xd5ca('0x10')]},{'name':_0xd5ca('0x11'),'fields':['body'],'type':_0xd5ca('0x12')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a3ae4,_0x1fbc1f,_0x5c8a51){var _0x3fcef8=_0x462093['models'];var _0x26eaf0=_0x5a3ae4[_0xd5ca('0x13')]({'plain':!![]});if(_0x26eaf0[_0xd5ca('0x14')][_0xd5ca('0x15')]()==='in'||_0x26eaf0[_0xd5ca('0x14')][_0xd5ca('0x15')]()===_0xd5ca('0x16')&&!_0x26eaf0['secret']&&!_[_0xd5ca('0x17')](_0x26eaf0[_0xd5ca('0x18')])){_0x3fcef8[_0xd5ca('0x19')][_0xd5ca('0x1a')]({'where':{'id':_0x26eaf0['WhatsappInteractionId']}})[_0xd5ca('0x1b')](function(_0x31ae9d){if(_0x31ae9d){_0x31ae9d[_0xd5ca('0x1c')]({'lastMsgAt':_0x26eaf0[_0xd5ca('0x1d')],'lastMsgDirection':_0x26eaf0[_0xd5ca('0x14')][_0xd5ca('0x15')]()});}})[_0xd5ca('0x1e')](function(_0x1677a8){console['error'](_0x1677a8);});}if(_0x26eaf0[_0xd5ca('0x14')]===_0xd5ca('0x16')&&!_0x26eaf0['secret']){var _0x3f3524;_0x3fcef8[_0xd5ca('0x1f')][_0xd5ca('0x20')]({'where':{'id':_0x26eaf0[_0xd5ca('0x21')]},'raw':!![]})[_0xd5ca('0x1b')](function(_0x191b39){_0x3f3524=_0x191b39;if(_0x3f3524&&_0x3f3524[_0xd5ca('0x22')]){switch(_0x3f3524[_0xd5ca('0x22')]){case _0xd5ca('0x23'):var _0x11ec20=require(_0xd5ca('0x23'));if(_0x3f3524['accountSid']&&_0x3f3524[_0xd5ca('0x24')]&&_0x3f3524['phone']){var _0x438a74=new _0x11ec20(_0x3f3524[_0xd5ca('0x25')],_0x3f3524[_0xd5ca('0x24')]);_0x438a74[_0xd5ca('0x26')][_0xd5ca('0x27')]({'body':_0x26eaf0[_0xd5ca('0x28')],'to':'whatsapp:'+_0x26eaf0['phone'],'from':_0xd5ca('0x29')+_0x3f3524[_0xd5ca('0x2a')],'statusCallback':_0x3f3524[_0xd5ca('0x2b')]+_0xd5ca('0x2c')+_0x26eaf0['id']+_0xd5ca('0x2d')+_0x3f3524[_0xd5ca('0x2e')]})['then'](function(_0x4e6090){if(_0x4e6090['sid']){return _0x5a3ae4[_0xd5ca('0x1c')]({'messageId':_0x4e6090[_0xd5ca('0x2f')]});}})[_0xd5ca('0x1e')](function(_0x168881){logger[_0xd5ca('0x30')](_0xd5ca('0x31'),_0xd5ca('0x32'),_0xd5ca('0x23'),util[_0xd5ca('0x33')](_0x168881,{'showHidden':![],'depth':null}));});}else{logger[_0xd5ca('0x30')](_0xd5ca('0x31'),_0xd5ca('0x32'),_0xd5ca('0x23'),_0xd5ca('0x34'));}break;case _0xd5ca('0x35'):var _0x3bfa35=_0x3f3524[_0xd5ca('0x25')];var _0x5f5d5c=_0x3f3524[_0xd5ca('0x24')];var _0x46e8c5=_0x3f3524[_0xd5ca('0x36')]+_0xd5ca('0x37')+_0x3bfa35+'/messages/';var _0x231c09={'to':[_0x26eaf0[_0xd5ca('0x2a')]],'message':{'type':_0xd5ca('0x38'),'text':_0x26eaf0['body']}};var _0x261cba={'method':_0xd5ca('0x39'),'uri':_0x46e8c5,'headers':{'Authorization':_0xd5ca('0x3a')+_0x5f5d5c,'Content-Type':'application/json'},'body':_0x231c09,'json':!![]};rp(_0x261cba)[_0xd5ca('0x1b')](function(_0x3eb080){if(_0x3eb080[_0xd5ca('0x3b')][0x0][_0xd5ca('0x3c')]){return _0x5a3ae4[_0xd5ca('0x1c')]({'messageId':_0x3eb080[_0xd5ca('0x3b')][0x0][_0xd5ca('0x3c')]});}})[_0xd5ca('0x1e')](function(_0x4e67a1){logger[_0xd5ca('0x3d')](_0xd5ca('0x3e'),_0x4e67a1);});break;}}})[_0xd5ca('0x3f')](function(){_0x5c8a51();});}else{_0x5c8a51();}}},'charset':'utf8mb4','collate':_0xd5ca('0x40')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index c17fb3c..de5686b 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 _0x0c62=['stringify','error','code','message','info','result','catch','CreateWhatsappMessage','create','body','options','raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','./whatsappMessage.socket','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x413bc0,_0x5d1de8){var _0x369313=function(_0x31ba1f){while(--_0x31ba1f){_0x413bc0['push'](_0x413bc0['shift']());}};_0x369313(++_0x5d1de8);}(_0x0c62,0x161));var _0x20c6=function(_0x30e9d8,_0x89aee6){_0x30e9d8=_0x30e9d8-0x0;var _0x5a7c2d=_0x0c62[_0x30e9d8];return _0x5a7c2d;};'use strict';var _=require(_0x20c6('0x0'));var util=require('util');var moment=require(_0x20c6('0x1'));var BPromise=require('bluebird');var rs=require(_0x20c6('0x2'));var fs=require('fs');var Redis=require(_0x20c6('0x3'));var db=require(_0x20c6('0x4'))['db'];var utils=require(_0x20c6('0x5'));var logger=require(_0x20c6('0x6'))(_0x20c6('0x7'));var config=require('../../config/environment');var jayson=require(_0x20c6('0x8'));var client=jayson[_0x20c6('0x9')][_0x20c6('0xa')]({'port':0x232a});config[_0x20c6('0xb')]=_['defaults'](config[_0x20c6('0xb')],{'host':_0x20c6('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x20c6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5a7717,_0x4325a5,_0x177a5b){return new BPromise(function(_0x1bfd8a,_0x353286){return client[_0x20c6('0xe')](_0x5a7717,_0x177a5b)[_0x20c6('0xf')](function(_0x504241){logger['info'](_0x20c6('0x10'),_0x4325a5,_0x20c6('0x11'));logger[_0x20c6('0x12')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4325a5,'request\x20sent',JSON[_0x20c6('0x13')](_0x504241));if(_0x504241[_0x20c6('0x14')]){if(_0x504241[_0x20c6('0x14')][_0x20c6('0x15')]===0x1f4){logger[_0x20c6('0x14')](_0x20c6('0x10'),_0x4325a5,_0x504241['error']['message']);return _0x353286(_0x504241['error'][_0x20c6('0x16')]);}logger[_0x20c6('0x14')](_0x20c6('0x10'),_0x4325a5,_0x504241[_0x20c6('0x14')]['message']);return _0x1bfd8a(_0x504241[_0x20c6('0x14')][_0x20c6('0x16')]);}else{logger[_0x20c6('0x17')](_0x20c6('0x10'),_0x4325a5,_0x20c6('0x11'));_0x1bfd8a(_0x504241[_0x20c6('0x18')]['message']);}})[_0x20c6('0x19')](function(_0x52af75){logger[_0x20c6('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x4325a5,_0x52af75);_0x353286(_0x52af75);});});}exports[_0x20c6('0x1a')]=function(_0x38861b){var _0x58a4a2=this;return new Promise(function(_0x1dfcd5,_0xa7db3b){return db['WhatsappMessage'][_0x20c6('0x1b')](_0x38861b[_0x20c6('0x1c')],{'raw':_0x38861b[_0x20c6('0x1d')]?_0x38861b['options'][_0x20c6('0x1e')]===undefined?!![]:![]:!![]})[_0x20c6('0xf')](function(_0x30f428){logger[_0x20c6('0x17')](_0x20c6('0x1a'),_0x38861b);logger['debug'](_0x20c6('0x1a'),_0x38861b,JSON['stringify'](_0x30f428));_0x1dfcd5(_0x30f428);})[_0x20c6('0x19')](function(_0x65fc4c){logger[_0x20c6('0x14')](_0x20c6('0x1a'),_0x65fc4c[_0x20c6('0x16')],_0x38861b);_0xa7db3b(_0x58a4a2[_0x20c6('0x14')](0x1f4,_0x65fc4c['message']));});});}; \ No newline at end of file +var _0x5a7a=['register','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','CreateWhatsappMessage','create','options','raw','stringify','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./whatsappMessage.socket'];(function(_0x2a1fa6,_0x2772a9){var _0x45d07b=function(_0x42e442){while(--_0x42e442){_0x2a1fa6['push'](_0x2a1fa6['shift']());}};_0x45d07b(++_0x2772a9);}(_0x5a7a,0x109));var _0xa5a7=function(_0x4f5557,_0xde8b4f){_0x4f5557=_0x4f5557-0x0;var _0x352055=_0x5a7a[_0x4f5557];return _0x352055;};'use strict';var _=require(_0xa5a7('0x0'));var util=require(_0xa5a7('0x1'));var moment=require('moment');var BPromise=require(_0xa5a7('0x2'));var rs=require(_0xa5a7('0x3'));var fs=require('fs');var Redis=require(_0xa5a7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa5a7('0x5'));var logger=require(_0xa5a7('0x6'))('rpc');var config=require(_0xa5a7('0x7'));var jayson=require(_0xa5a7('0x8'));var client=jayson[_0xa5a7('0x9')]['http']({'port':0x232a});config[_0xa5a7('0xa')]=_['defaults'](config[_0xa5a7('0xa')],{'host':_0xa5a7('0xb'),'port':0x18eb});var socket=require(_0xa5a7('0xc'))(new Redis(config['redis']));require(_0xa5a7('0xd'))[_0xa5a7('0xe')](socket);function respondWithRpcPromise(_0xb837fd,_0x1797fe,_0x29772f){return new BPromise(function(_0x412364,_0x3b886d){return client[_0xa5a7('0xf')](_0xb837fd,_0x29772f)[_0xa5a7('0x10')](function(_0x447c2d){logger[_0xa5a7('0x11')](_0xa5a7('0x12'),_0x1797fe,'request\x20sent');logger[_0xa5a7('0x13')](_0xa5a7('0x14'),_0x1797fe,'request\x20sent',JSON['stringify'](_0x447c2d));if(_0x447c2d['error']){if(_0x447c2d[_0xa5a7('0x15')][_0xa5a7('0x16')]===0x1f4){logger[_0xa5a7('0x15')](_0xa5a7('0x12'),_0x1797fe,_0x447c2d['error']['message']);return _0x3b886d(_0x447c2d['error'][_0xa5a7('0x17')]);}logger[_0xa5a7('0x15')](_0xa5a7('0x12'),_0x1797fe,_0x447c2d['error'][_0xa5a7('0x17')]);return _0x412364(_0x447c2d[_0xa5a7('0x15')][_0xa5a7('0x17')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x1797fe,_0xa5a7('0x18'));_0x412364(_0x447c2d['result']['message']);}})[_0xa5a7('0x19')](function(_0x224421){logger[_0xa5a7('0x15')](_0xa5a7('0x12'),_0x1797fe,_0x224421);_0x3b886d(_0x224421);});});}exports[_0xa5a7('0x1a')]=function(_0xe641b4){var _0x296317=this;return new Promise(function(_0x8a88cc,_0x4dcfd6){return db['WhatsappMessage'][_0xa5a7('0x1b')](_0xe641b4['body'],{'raw':_0xe641b4['options']?_0xe641b4[_0xa5a7('0x1c')][_0xa5a7('0x1d')]===undefined?!![]:![]:!![]})[_0xa5a7('0x10')](function(_0x4e7a11){logger[_0xa5a7('0x11')]('CreateWhatsappMessage',_0xe641b4);logger['debug'](_0xa5a7('0x1a'),_0xe641b4,JSON[_0xa5a7('0x1e')](_0x4e7a11));_0x8a88cc(_0x4e7a11);})[_0xa5a7('0x19')](function(_0x638e58){logger[_0xa5a7('0x15')](_0xa5a7('0x1a'),_0x638e58[_0xa5a7('0x17')],_0xe641b4);_0x4dcfd6(_0x296317['error'](0x1f4,_0x638e58['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index f1d5f84..14f9e36 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 _0x8379=['length','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x596284,_0x1cd02b){var _0x5313c6=function(_0x77db49){while(--_0x77db49){_0x596284['push'](_0x596284['shift']());}};_0x5313c6(++_0x1cd02b);}(_0x8379,0x12b));var _0x9837=function(_0x65bfd0,_0x2d1560){_0x65bfd0=_0x65bfd0-0x0;var _0x38e4ad=_0x8379[_0x65bfd0];return _0x38e4ad;};'use strict';var WhatsappMessageEvents=require(_0x9837('0x0'));var events=[_0x9837('0x1'),_0x9837('0x2'),_0x9837('0x3')];function createListener(_0x1e7d76,_0x5cdcdb){return function(_0xc6a19a){_0x5cdcdb[_0x9837('0x4')](_0x1e7d76,_0xc6a19a);};}function removeListener(_0x4ff284,_0x4bb192){return function(){WhatsappMessageEvents[_0x9837('0x5')](_0x4ff284,_0x4bb192);};}exports[_0x9837('0x6')]=function(_0x3cdb7f){for(var _0x5e89b3=0x0,_0x41fb63=events[_0x9837('0x7')];_0x5e89b3<_0x41fb63;_0x5e89b3++){var _0x2a0fd8=events[_0x5e89b3];var _0x348e91=createListener(_0x9837('0x8')+_0x2a0fd8,_0x3cdb7f);WhatsappMessageEvents['on'](_0x2a0fd8,_0x348e91);}}; \ No newline at end of file +var _0x2fd4=['./whatsappMessage.events','save','remove','update','emit','register','length','whatsappMessage:'];(function(_0x49693f,_0x4d994f){var _0x1b0f6e=function(_0x4b2c16){while(--_0x4b2c16){_0x49693f['push'](_0x49693f['shift']());}};_0x1b0f6e(++_0x4d994f);}(_0x2fd4,0x78));var _0x42fd=function(_0x47e27c,_0x84b659){_0x47e27c=_0x47e27c-0x0;var _0x1a8635=_0x2fd4[_0x47e27c];return _0x1a8635;};'use strict';var WhatsappMessageEvents=require(_0x42fd('0x0'));var events=[_0x42fd('0x1'),_0x42fd('0x2'),_0x42fd('0x3')];function createListener(_0x1eb4e1,_0x2514ec){return function(_0x1a6e97){_0x2514ec[_0x42fd('0x4')](_0x1eb4e1,_0x1a6e97);};}function removeListener(_0x2e3992,_0x7aab9f){return function(){WhatsappMessageEvents['removeListener'](_0x2e3992,_0x7aab9f);};}exports[_0x42fd('0x5')]=function(_0x425f17){for(var _0x2c52fd=0x0,_0x32469d=events[_0x42fd('0x6')];_0x2c52fd<_0x32469d;_0x2c52fd++){var _0x55976a=events[_0x2c52fd];var _0x42918e=createListener(_0x42fd('0x7')+_0x55976a,_0x425f17);WhatsappMessageEvents['on'](_0x55976a,_0x42918e);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 22e82f5..7135cb5 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 _0x88f3=['post','addAgents','put','update','delete','destroy','removeAgents','exports','util','path','express','Router','fs-extra','../../components/auth/service','./whatsappQueue.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x88f3,0x70));var _0x388f=function(_0x449118,_0x14ce50){_0x449118=_0x449118-0x0;var _0x3ed0f2=_0x88f3[_0x449118];return _0x3ed0f2;};'use strict';var multer=require('multer');var util=require(_0x388f('0x0'));var path=require(_0x388f('0x1'));var timeout=require('connect-timeout');var express=require(_0x388f('0x2'));var router=express[_0x388f('0x3')]();var fs_extra=require(_0x388f('0x4'));var auth=require(_0x388f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x388f('0x6'));router[_0x388f('0x7')]('/',auth['isAuthenticated'](),controller[_0x388f('0x8')]);router['get'](_0x388f('0x9'),auth[_0x388f('0xa')](),controller['describe']);router[_0x388f('0x7')](_0x388f('0xb'),auth[_0x388f('0xa')](),controller[_0x388f('0xc')]);router[_0x388f('0x7')](_0x388f('0xd'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0x388f('0xe'),auth[_0x388f('0xa')](),controller[_0x388f('0xf')]);router[_0x388f('0x7')](_0x388f('0x10'),auth[_0x388f('0xa')](),controller[_0x388f('0x11')]);router['post']('/',auth[_0x388f('0xa')](),controller['create']);router[_0x388f('0x12')](_0x388f('0xe'),auth[_0x388f('0xa')](),controller['addTeams']);router[_0x388f('0x12')](_0x388f('0x10'),auth[_0x388f('0xa')](),controller[_0x388f('0x13')]);router[_0x388f('0x14')]('/:id',auth[_0x388f('0xa')](),controller[_0x388f('0x15')]);router[_0x388f('0x16')]('/:id',auth[_0x388f('0xa')](),controller[_0x388f('0x17')]);router[_0x388f('0x16')](_0x388f('0xe'),auth[_0x388f('0xa')](),controller['removeTeams']);router[_0x388f('0x16')]('/:id/users',auth[_0x388f('0xa')](),controller[_0x388f('0x18')]);module[_0x388f('0x19')]=router; \ No newline at end of file +var _0x8475=['../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','update','destroy','delete','removeAgents','multer','util','path','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8475,0x64));var _0x5847=function(_0x1e1c91,_0x18aaf8){_0x1e1c91=_0x1e1c91-0x0;var _0x395517=_0x8475[_0x1e1c91];return _0x395517;};'use strict';var multer=require(_0x5847('0x0'));var util=require(_0x5847('0x1'));var path=require(_0x5847('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5847('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5847('0x4'));var interaction=require(_0x5847('0x5'));var config=require('../../config/environment');var controller=require(_0x5847('0x6'));router[_0x5847('0x7')]('/',auth[_0x5847('0x8')](),controller[_0x5847('0x9')]);router[_0x5847('0x7')](_0x5847('0xa'),auth[_0x5847('0x8')](),controller[_0x5847('0xb')]);router[_0x5847('0x7')](_0x5847('0xc'),auth[_0x5847('0x8')](),controller['show']);router[_0x5847('0x7')]('/:id/members',auth[_0x5847('0x8')](),controller[_0x5847('0xd')]);router[_0x5847('0x7')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5847('0xe')]);router['get'](_0x5847('0xf'),auth['isAuthenticated'](),controller[_0x5847('0x10')]);router[_0x5847('0x11')]('/',auth[_0x5847('0x8')](),controller[_0x5847('0x12')]);router[_0x5847('0x11')](_0x5847('0x13'),auth['isAuthenticated'](),controller[_0x5847('0x14')]);router[_0x5847('0x11')](_0x5847('0xf'),auth[_0x5847('0x8')](),controller[_0x5847('0x15')]);router['put'](_0x5847('0xc'),auth['isAuthenticated'](),controller[_0x5847('0x16')]);router['delete'](_0x5847('0xc'),auth[_0x5847('0x8')](),controller[_0x5847('0x17')]);router[_0x5847('0x18')]('/:id/teams',auth[_0x5847('0x8')](),controller['removeTeams']);router[_0x5847('0x18')](_0x5847('0xf'),auth[_0x5847('0x8')](),controller[_0x5847('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 305259f..df87aab 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 _0x9d02=['sequelize','STRING','INTEGER','rrmemory','beepall'];(function(_0x34df4a,_0x209d10){var _0x145c69=function(_0xb9bcbd){while(--_0xb9bcbd){_0x34df4a['push'](_0x34df4a['shift']());}};_0x145c69(++_0x209d10);}(_0x9d02,0x118));var _0x29d0=function(_0x555089,_0x3b5a57){_0x555089=_0x555089-0x0;var _0x22e91e=_0x9d02[_0x555089];return _0x22e91e;};'use strict';var Sequelize=require(_0x29d0('0x0'));module['exports']={'name':{'type':Sequelize[_0x29d0('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x29d0('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x29d0('0x3'),_0x29d0('0x4'),'roundrobin')},'description':{'type':Sequelize[_0x29d0('0x1')]}}; \ No newline at end of file +var _0x9086=['rrmemory','beepall','roundrobin','sequelize','exports','name','INTEGER','ENUM'];(function(_0x172659,_0x2d706b){var _0x23a612=function(_0x4b0e0c){while(--_0x4b0e0c){_0x172659['push'](_0x172659['shift']());}};_0x23a612(++_0x2d706b);}(_0x9086,0x10b));var _0x6908=function(_0x42f6d1,_0x52c740){_0x42f6d1=_0x42f6d1-0x0;var _0x50ae08=_0x9086[_0x42f6d1];return _0x50ae08;};'use strict';var Sequelize=require(_0x6908('0x0'));module[_0x6908('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6908('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x6908('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6908('0x4')](_0x6908('0x5'),_0x6908('0x6'),_0x6908('0x7'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 9a063eb..ecac384 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 _0xda4f=['update','then','get','WhatsappQueues','destroy','error','stack','name','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','catch','show','params','keys','filters','model','intersection','fields','attributes','length','includeAll','merge','options','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','describe','getMembers','UserWhatsappQueue','nolimit','order','sort','pick','WhatsappQueueId','filter','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','findOne','Team','hasOwnProperty','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','isEmpty','userWhatsappQueue:remove','addAgents','omit','spread','userWhatsappQueue:save','removeAgents','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','./whatsappQueue.socket','register','sendStatus','end','status','json','offset','count','limit','Content-Range'];(function(_0x40baa0,_0x4a557e){var _0x47d78c=function(_0x10f9eb){while(--_0x10f9eb){_0x40baa0['push'](_0x40baa0['shift']());}};_0x47d78c(++_0x4a557e);}(_0xda4f,0x168));var _0xfda4=function(_0x5d6518,_0x5e2d02){_0x5d6518=_0x5d6518-0x0;var _0x17c918=_0xda4f[_0x5d6518];return _0x17c918;};'use strict';var BPromise=require(_0xfda4('0x0'));var util=require(_0xfda4('0x1'));var _=require(_0xfda4('0x2'));var squel=require(_0xfda4('0x3'));var Redis=require(_0xfda4('0x4'));var qs=require(_0xfda4('0x5'));var logger=require('../../config/logger')(_0xfda4('0x6'));var config=require(_0xfda4('0x7'));var db=require(_0xfda4('0x8'))['db'];config[_0xfda4('0x9')]=_['defaults'](config[_0xfda4('0x9')],{'host':_0xfda4('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfda4('0x9')]));require(_0xfda4('0xb'))[_0xfda4('0xc')](socket);function respondWithStatusCode(_0x555f3a,_0x53c2e3){_0x53c2e3=_0x53c2e3||0xcc;return function(_0x5c3b3e){if(_0x5c3b3e){return _0x555f3a[_0xfda4('0xd')](_0x53c2e3);}return _0x555f3a['status'](_0x53c2e3)[_0xfda4('0xe')]();};}function respondWithResult(_0x48eda1,_0x569570){_0x569570=_0x569570||0xc8;return function(_0x1ee530){if(_0x1ee530){return _0x48eda1[_0xfda4('0xf')](_0x569570)[_0xfda4('0x10')](_0x1ee530);}};}function respondWithFilteredResult(_0x1ce2de,_0x2f6aaa){return function(_0x2e370d){if(_0x2e370d){var _0x1693af=typeof _0x2f6aaa[_0xfda4('0x11')]==='undefined'&&typeof _0x2f6aaa['limit']==='undefined';var _0x173702=_0x2e370d[_0xfda4('0x12')];var _0x4a4bf6=_0x1693af?0x0:_0x2f6aaa[_0xfda4('0x11')];var _0x99b4f3=_0x1693af?_0x2e370d[_0xfda4('0x12')]:_0x2f6aaa[_0xfda4('0x11')]+_0x2f6aaa[_0xfda4('0x13')];var _0x52e2bb;if(_0x99b4f3>=_0x173702){_0x99b4f3=_0x173702;_0x52e2bb=0xc8;}else{_0x52e2bb=0xce;}_0x1ce2de[_0xfda4('0xf')](_0x52e2bb);return _0x1ce2de['set'](_0xfda4('0x14'),_0x4a4bf6+'-'+_0x99b4f3+'/'+_0x173702)['json'](_0x2e370d);}return null;};}function saveUpdates(_0x5131e3){return function(_0x3ff5cb){if(_0x3ff5cb){return _0x3ff5cb[_0xfda4('0x15')](_0x5131e3)[_0xfda4('0x16')](function(_0x22e833){return _0x22e833;});}return null;};}function removeEntity(_0x5773ef){return function(_0x569911){if(_0x569911){return _0x569911['destroy']()[_0xfda4('0x16')](function(){var _0x1c73ef=_0x569911[_0xfda4('0x17')]({'plain':!![]});var _0x2892ea=_0xfda4('0x18');return db['UserProfileResource'][_0xfda4('0x19')]({'where':{'type':_0x2892ea,'resourceId':_0x1c73ef['id']}})[_0xfda4('0x16')](function(){return _0x569911;});})[_0xfda4('0x16')](function(){_0x5773ef[_0xfda4('0xf')](0xcc)[_0xfda4('0xe')]();});}};}function handleEntityNotFound(_0xac70c9){return function(_0x3144de){if(!_0x3144de){_0xac70c9[_0xfda4('0xd')](0x194);}return _0x3144de;};}function handleError(_0x500354,_0x510a43){_0x510a43=_0x510a43||0x1f4;return function(_0x1267a9){logger[_0xfda4('0x1a')](_0x1267a9[_0xfda4('0x1b')]);if(_0x1267a9[_0xfda4('0x1c')]){delete _0x1267a9[_0xfda4('0x1c')];}_0x500354['status'](_0x510a43)['send'](_0x1267a9);};}exports[_0xfda4('0x1d')]=function(_0x289131,_0x210961){var _0xf8159={};var _0x574a1d={'count':0x0,'rows':[]};var _0x36dfea=_[_0xfda4('0x1e')](db[_0xfda4('0x1f')][_0xfda4('0x20')],function(_0x9bca23){return{'name':_0x9bca23[_0xfda4('0x21')],'type':_0x9bca23[_0xfda4('0x22')][_0xfda4('0x23')]};});_0xf8159=qs[_0xfda4('0x24')](_0x36dfea,_0x289131);var _0xef1b67={'where':_0xf8159[_0xfda4('0x25')]};return db[_0xfda4('0x1f')]['count'](_0xef1b67)['then'](function(_0x4a1ea7){_0x574a1d['count']=_0x4a1ea7;_0xf8159[_0xfda4('0x26')]=qs[_0xfda4('0x26')](_0x289131[_0xfda4('0x27')]);return db[_0xfda4('0x1f')][_0xfda4('0x28')](_0xf8159);})[_0xfda4('0x16')](function(_0x5f4950){_0x574a1d['rows']=_0x5f4950;return _0x574a1d;})[_0xfda4('0x16')](respondWithFilteredResult(_0x210961,_0xf8159))[_0xfda4('0x29')](handleError(_0x210961,null));};exports[_0xfda4('0x2a')]=function(_0x3319bc,_0x13cf0c){var _0x1ab6ec={'raw':!![],'where':{'id':_0x3319bc[_0xfda4('0x2b')]['id']}},_0x1b026d={};_0x1b026d['model']=_[_0xfda4('0x2c')](db[_0xfda4('0x1f')][_0xfda4('0x20')]);_0x1b026d[_0xfda4('0x27')]=_[_0xfda4('0x2c')](_0x3319bc[_0xfda4('0x27')]);_0x1b026d[_0xfda4('0x2d')]=_['intersection'](_0x1b026d[_0xfda4('0x2e')],_0x1b026d[_0xfda4('0x27')]);_0x1ab6ec['attributes']=_[_0xfda4('0x2f')](_0x1b026d[_0xfda4('0x2e')],qs[_0xfda4('0x30')](_0x3319bc[_0xfda4('0x27')]['fields']));_0x1ab6ec['attributes']=_0x1ab6ec[_0xfda4('0x31')][_0xfda4('0x32')]?_0x1ab6ec[_0xfda4('0x31')]:_0x1b026d[_0xfda4('0x2e')];if(_0x3319bc['query'][_0xfda4('0x33')]){_0x1ab6ec[_0xfda4('0x26')]=[{'all':!![]}];}_0x1ab6ec=_[_0xfda4('0x34')]({},_0x1ab6ec,_0x3319bc[_0xfda4('0x35')]);return db[_0xfda4('0x1f')]['find'](_0x1ab6ec)['then'](handleEntityNotFound(_0x13cf0c,null))['then'](respondWithResult(_0x13cf0c,null))[_0xfda4('0x29')](handleError(_0x13cf0c,null));};exports[_0xfda4('0x36')]=function(_0x24ac10,_0x2dff21){return db[_0xfda4('0x1f')]['create'](_0x24ac10[_0xfda4('0x37')],{})[_0xfda4('0x16')](function(_0x286c21){var _0x3e1ea3=_0x24ac10[_0xfda4('0x38')][_0xfda4('0x17')]({'plain':!![]});if(!_0x3e1ea3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e1ea3[_0xfda4('0x39')]===_0xfda4('0x38')){var _0x3ceb5f=_0x286c21[_0xfda4('0x17')]({'plain':!![]});var _0x414f42='WhatsappQueues';return db[_0xfda4('0x3a')][_0xfda4('0x3b')]({'where':{'name':_0x414f42,'userProfileId':_0x3e1ea3[_0xfda4('0x3c')]},'raw':!![]})[_0xfda4('0x16')](function(_0x21d2cf){if(_0x21d2cf&&_0x21d2cf[_0xfda4('0x3d')]===0x0){return db[_0xfda4('0x3e')][_0xfda4('0x36')]({'name':_0x3ceb5f[_0xfda4('0x1c')],'resourceId':_0x3ceb5f['id'],'type':_0x21d2cf[_0xfda4('0x1c')],'sectionId':_0x21d2cf['id']},{})[_0xfda4('0x16')](function(){return _0x286c21;});}else{return _0x286c21;}})[_0xfda4('0x29')](function(_0x363485){logger[_0xfda4('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x363485);throw _0x363485;});}return _0x286c21;})[_0xfda4('0x16')](respondWithResult(_0x2dff21,0xc9))[_0xfda4('0x29')](handleError(_0x2dff21,null));};exports[_0xfda4('0x15')]=function(_0x3a60f1,_0x30f414){if(_0x3a60f1[_0xfda4('0x37')]['id']){delete _0x3a60f1[_0xfda4('0x37')]['id'];}return db[_0xfda4('0x1f')][_0xfda4('0x3b')]({'where':{'id':_0x3a60f1[_0xfda4('0x2b')]['id']}})['then'](handleEntityNotFound(_0x30f414,null))[_0xfda4('0x16')](saveUpdates(_0x3a60f1[_0xfda4('0x37')],null))['then'](respondWithResult(_0x30f414,null))[_0xfda4('0x29')](handleError(_0x30f414,null));};exports[_0xfda4('0x19')]=function(_0x3c509,_0x1a47fb){return db[_0xfda4('0x1f')][_0xfda4('0x3b')]({'where':{'id':_0x3c509[_0xfda4('0x2b')]['id']}})[_0xfda4('0x16')](handleEntityNotFound(_0x1a47fb,null))[_0xfda4('0x16')](removeEntity(_0x1a47fb,null))[_0xfda4('0x29')](handleError(_0x1a47fb,null));};exports[_0xfda4('0x3f')]=function(_0x6408f0,_0x18129c){return db[_0xfda4('0x1f')][_0xfda4('0x3f')]()[_0xfda4('0x16')](respondWithResult(_0x18129c,null))[_0xfda4('0x29')](handleError(_0x18129c,null));};exports[_0xfda4('0x40')]=function(_0x2d97de,_0x56c805){var _0xff96a9={'raw':!![],'where':{}},_0x199e1f={},_0xb3085d;return db[_0xfda4('0x1f')]['findOne']({'where':{'id':_0x2d97de[_0xfda4('0x2b')]['id']}})['then'](handleEntityNotFound(_0x56c805,null))['then'](function(_0x26f350){if(_0x26f350){_0xb3085d=_0x26f350['get']({'plain':!![]});_0x199e1f['model']=_[_0xfda4('0x2c')](db[_0xfda4('0x41')][_0xfda4('0x20')]);_0x199e1f[_0xfda4('0x27')]=_[_0xfda4('0x2c')](_0x2d97de[_0xfda4('0x27')]);_0x199e1f[_0xfda4('0x2d')]=_[_0xfda4('0x2f')](_0x199e1f[_0xfda4('0x2e')],_0x199e1f[_0xfda4('0x27')]);_0xff96a9[_0xfda4('0x31')]=_['intersection'](_0x199e1f[_0xfda4('0x2e')],qs[_0xfda4('0x30')](_0x2d97de[_0xfda4('0x27')][_0xfda4('0x30')]));_0xff96a9['attributes']=_0xff96a9[_0xfda4('0x31')]['length']?_0xff96a9[_0xfda4('0x31')]:_0x199e1f[_0xfda4('0x2e')];if(!_0x2d97de[_0xfda4('0x27')]['hasOwnProperty'](_0xfda4('0x42'))){_0xff96a9[_0xfda4('0x13')]=qs[_0xfda4('0x13')](_0x2d97de[_0xfda4('0x27')][_0xfda4('0x13')]);_0xff96a9[_0xfda4('0x11')]=qs[_0xfda4('0x11')](_0x2d97de[_0xfda4('0x27')][_0xfda4('0x11')]);}_0xff96a9[_0xfda4('0x43')]=qs[_0xfda4('0x44')](_0x2d97de[_0xfda4('0x27')]['sort']);_0xff96a9[_0xfda4('0x25')]=qs[_0xfda4('0x2d')](_[_0xfda4('0x45')](_0x2d97de[_0xfda4('0x27')],_0x199e1f['filters']));_0xff96a9[_0xfda4('0x25')][_0xfda4('0x46')]=_0x26f350['id'];if(_0x2d97de[_0xfda4('0x27')][_0xfda4('0x47')]){_0xff96a9[_0xfda4('0x25')]=_[_0xfda4('0x34')](_0xff96a9[_0xfda4('0x25')],{'$or':_[_0xfda4('0x1e')](_0xff96a9[_0xfda4('0x31')],function(_0x4b6b14){var _0x139700={};_0x139700[_0x4b6b14]={'$like':'%'+_0x2d97de[_0xfda4('0x27')][_0xfda4('0x47')]+'%'};return _0x139700;})});}_0xff96a9=_['merge']({},_0xff96a9,_0x2d97de['options']);return db['UserWhatsappQueue'][_0xfda4('0x28')](_0xff96a9);}})[_0xfda4('0x16')](function(_0x3a75aa){if(_0x3a75aa){return db[_0xfda4('0x48')][_0xfda4('0x49')]({'where':{'id':_[_0xfda4('0x1e')](_0x3a75aa,_0xfda4('0x4a')),'role':_0xfda4('0x4b')},'attributes':['id',_0xfda4('0x1c'),_0xfda4('0x4c'),_0xfda4('0x4d'),_0xfda4('0x4e')]});}})[_0xfda4('0x16')](function(_0x20d6e2){if(_0x20d6e2){return{'count':_0x20d6e2[_0xfda4('0x12')],'rows':_[_0xfda4('0x1e')](_0x20d6e2[_0xfda4('0x4f')],function(_0x2c3409){return{'membername':_0x2c3409[_0xfda4('0x1c')],'UserId':_0x2c3409['id'],'queue_name':_0xb3085d[_0xfda4('0x1c')],'WhatsappQueueId':_0xb3085d['id'],'interface':util[_0xfda4('0x50')](_0xfda4('0x51'),_0xfda4('0x52'),_0x2c3409['name']),'penalty':0x0,'paused':_0x2c3409[_0xfda4('0x4c')],'createdAt':_0x2c3409['createdAt'],'updatedAt':_0x2c3409['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xfda4('0x16')](respondWithFilteredResult(_0x56c805,_0xff96a9))[_0xfda4('0x29')](handleError(_0x56c805,null));};exports[_0xfda4('0x53')]=function(_0x21a96d,_0x46f283){var _0x2b88d9={};var _0x31255e={};var _0x34432e;var _0x2cc29e;return db[_0xfda4('0x1f')][_0xfda4('0x54')]({'where':{'id':_0x21a96d[_0xfda4('0x2b')]['id']}})[_0xfda4('0x16')](handleEntityNotFound(_0x46f283,null))[_0xfda4('0x16')](function(_0x50ab69){if(_0x50ab69){_0x34432e=_0x50ab69;_0x31255e['model']=_[_0xfda4('0x2c')](db[_0xfda4('0x55')][_0xfda4('0x20')]);_0x31255e['query']=_[_0xfda4('0x2c')](_0x21a96d[_0xfda4('0x27')]);_0x31255e[_0xfda4('0x2d')]=_[_0xfda4('0x2f')](_0x31255e[_0xfda4('0x2e')],_0x31255e[_0xfda4('0x27')]);_0x2b88d9['attributes']=_['intersection'](_0x31255e[_0xfda4('0x2e')],qs[_0xfda4('0x30')](_0x21a96d[_0xfda4('0x27')]['fields']));_0x2b88d9['attributes']=_0x2b88d9[_0xfda4('0x31')][_0xfda4('0x32')]?_0x2b88d9[_0xfda4('0x31')]:_0x31255e[_0xfda4('0x2e')];_0x2b88d9[_0xfda4('0x43')]=qs[_0xfda4('0x44')](_0x21a96d['query'][_0xfda4('0x44')]);_0x2b88d9[_0xfda4('0x25')]=qs[_0xfda4('0x2d')](_[_0xfda4('0x45')](_0x21a96d[_0xfda4('0x27')],_0x31255e[_0xfda4('0x2d')]));if(_0x21a96d['query'][_0xfda4('0x47')]){_0x2b88d9[_0xfda4('0x25')]=_[_0xfda4('0x34')](_0x2b88d9['where'],{'$or':_[_0xfda4('0x1e')](_0x2b88d9[_0xfda4('0x31')],function(_0x4dc02b){var _0x48c1cf={};_0x48c1cf[_0x4dc02b]={'$like':'%'+_0x21a96d['query'][_0xfda4('0x47')]+'%'};return _0x48c1cf;})});}_0x2b88d9=_['merge']({},_0x2b88d9,_0x21a96d['options']);return _0x34432e[_0xfda4('0x53')](_0x2b88d9);}})[_0xfda4('0x16')](function(_0x215d9a){if(_0x215d9a){_0x2cc29e=_0x215d9a[_0xfda4('0x32')];if(!_0x21a96d['query'][_0xfda4('0x56')](_0xfda4('0x42'))){_0x2b88d9[_0xfda4('0x13')]=qs[_0xfda4('0x13')](_0x21a96d['query'][_0xfda4('0x13')]);_0x2b88d9[_0xfda4('0x11')]=qs[_0xfda4('0x11')](_0x21a96d['query'][_0xfda4('0x11')]);}return _0x34432e[_0xfda4('0x53')](_0x2b88d9);}})[_0xfda4('0x16')](function(_0x1b3f47){if(_0x1b3f47){return _0x1b3f47?{'count':_0x2cc29e,'rows':_0x1b3f47}:null;}})[_0xfda4('0x16')](respondWithResult(_0x46f283,null))[_0xfda4('0x29')](handleError(_0x46f283,null));};exports[_0xfda4('0x57')]=function(_0x5d058e,_0x599865){var _0x2fcf5d=_0x5d058e[_0xfda4('0x37')][_0xfda4('0x58')];return db[_0xfda4('0x55')][_0xfda4('0x28')]({'where':{'id':_0x2fcf5d},'attributes':['id'],'include':[{'model':db[_0xfda4('0x48')],'as':_0xfda4('0x59'),'attributes':['id','name',_0xfda4('0x5a'),_0xfda4('0x5b'),_0xfda4('0x5c')],'raw':!![]}]})[_0xfda4('0x16')](function(_0x3287ec){if(_0x3287ec){var _0x5aa130=_[_0xfda4('0x5d')](_0x3287ec,function(_0x4a2342){var _0x3d36a2=_0x4a2342[_0xfda4('0x17')]({'plain':!![]});return _0x3d36a2[_0xfda4('0x59')];});return db[_0xfda4('0x1f')][_0xfda4('0x3b')]({'where':{'id':_0x5d058e[_0xfda4('0x2b')]['id']}})[_0xfda4('0x16')](function(_0x5d26d4){return db[_0xfda4('0x5e')][_0xfda4('0x5f')](function(_0x35d940){return _0x5d26d4[_0xfda4('0x57')](_0x2fcf5d,{'transaction':_0x35d940})[_0xfda4('0x16')](function(){return BPromise[_0xfda4('0x60')](_0x5aa130,function(_0x2f8e45){return db[_0xfda4('0x41')]['findOrCreate']({'where':{'UserId':_0x2f8e45['id'],'WhatsappQueueId':_0x5d058e['params']['id']},'transaction':_0x35d940});});})[_0xfda4('0x16')](function(){_0x5aa130['forEach'](function(_0x329f02){socket[_0xfda4('0x61')]('userWhatsappQueue:save',{'UserId':_0x329f02['id'],'WhatsappQueueId':_0x5d26d4['id']});});});});});}})[_0xfda4('0x16')](respondWithStatusCode(_0x599865,null))[_0xfda4('0x29')](handleError(_0x599865,null));};exports[_0xfda4('0x62')]=function(_0x3ba0fb,_0xec6a62){return db[_0xfda4('0x55')][_0xfda4('0x28')]({'where':{'id':_0x3ba0fb[_0xfda4('0x27')]['ids']},'attributes':['id'],'include':[{'model':db[_0xfda4('0x48')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xfda4('0x16')](handleEntityNotFound(_0xec6a62,null))[_0xfda4('0x16')](function(_0x45cd31){var _0x1e45b1=_[_0xfda4('0x1e')](_0x45cd31,'id');var _0x1bef21=[];var _0x2a2177=[];var _0x46c0a0=squel[_0xfda4('0x63')]();_0x46c0a0[_0xfda4('0x64')](_0xfda4('0x65'))[_0xfda4('0x66')](_0xfda4('0x67'),'tq')[_0xfda4('0x68')]('user_has_teams','ut',_0xfda4('0x69'))['where'](_0xfda4('0x6a'),_0x3ba0fb[_0xfda4('0x2b')]['id']);for(var _0x3df5d3=0x0;_0x3df5d3<_0x45cd31[_0xfda4('0x32')];_0x3df5d3+=0x1){let _0x39927d=_0x45cd31[_0x3df5d3];for(var _0x538893=0x0;_0x538893<_0x39927d[_0xfda4('0x59')][_0xfda4('0x32')];_0x538893+=0x1){let _0x2dd95d=_0x39927d[_0xfda4('0x59')][_0x538893];var _0x5d9734=_0x46c0a0['clone']();_0x5d9734[_0xfda4('0x25')](_0xfda4('0x6b'),_0x2dd95d['id']);_0x2a2177[_0xfda4('0x6c')](db['sequelize'][_0xfda4('0x27')](_0x5d9734[_0xfda4('0x6d')](),{'type':db[_0xfda4('0x5e')][_0xfda4('0x6e')]['SELECT']})[_0xfda4('0x16')](function(_0x1ad5b9){if(_0x1ad5b9[_0xfda4('0x32')]===0x1){return _0x2dd95d['id'];}else{var _0xba30ef=_[_0xfda4('0x6f')](_[_0xfda4('0x1e')](_0x1ad5b9,_0xfda4('0x70')),function(_0x13b010){return _[_0xfda4('0x71')](_0x1e45b1,_0x13b010);});if(_0xba30ef){return _0x2dd95d['id'];}}}));}}return BPromise[_0xfda4('0x72')](_0x2a2177)['then'](function(_0x27b3e4){_0x1bef21=_(_0x1bef21)[_0xfda4('0x73')](_0x27b3e4)[_0xfda4('0x74')]()[_0xfda4('0x75')]();return db['WhatsappQueue'][_0xfda4('0x3b')]({'where':{'id':_0x3ba0fb[_0xfda4('0x2b')]['id']}})[_0xfda4('0x16')](function(_0x1e73bb){return db['sequelize'][_0xfda4('0x5f')](function(_0x4b17d3){return _0x1e73bb[_0xfda4('0x62')](_0x3ba0fb[_0xfda4('0x27')]['ids'],{'transaction':_0x4b17d3})[_0xfda4('0x16')](function(){if(!_[_0xfda4('0x76')](_0x1bef21)){return _0x1e73bb['removeAgents'](_0x1bef21,{'transaction':_0x4b17d3});}})[_0xfda4('0x16')](function(){_0x1bef21['forEach'](function(_0x51b48e){socket[_0xfda4('0x61')](_0xfda4('0x77'),{'UserId':_0x51b48e,'WhatsappQueueId':_0x1e73bb['id']});});});});});});})['then'](respondWithStatusCode(_0xec6a62,null))[_0xfda4('0x29')](handleError(_0xec6a62,null));};exports[_0xfda4('0x78')]=function(_0x2af042,_0x14c4d1){return db[_0xfda4('0x1f')]['find']({'where':{'id':_0x2af042[_0xfda4('0x2b')]['id']}})[_0xfda4('0x16')](handleEntityNotFound(_0x14c4d1,null))[_0xfda4('0x16')](function(_0xa8f727){if(_0xa8f727){return _0xa8f727[_0xfda4('0x78')](_0x2af042[_0xfda4('0x37')][_0xfda4('0x58')],_[_0xfda4('0x79')](_0x2af042['body'],[_0xfda4('0x58'),'id'])||{})[_0xfda4('0x7a')](function(_0x28ae55){for(var _0x4d8113=0x0;_0x4d8113<_0x2af042['body'][_0xfda4('0x58')][_0xfda4('0x32')];_0x4d8113+=0x1){socket[_0xfda4('0x61')](_0xfda4('0x7b'),{'UserId':Number(_0x2af042[_0xfda4('0x37')][_0xfda4('0x58')][_0x4d8113]),'WhatsappQueueId':Number(_0x2af042[_0xfda4('0x2b')]['id'])});}return _0x28ae55;});}})[_0xfda4('0x16')](respondWithResult(_0x14c4d1,null))['catch'](handleError(_0x14c4d1,null));};exports[_0xfda4('0x7c')]=function(_0x48d9bc,_0x65917b){return db[_0xfda4('0x1f')][_0xfda4('0x3b')]({'where':{'id':_0x48d9bc['params']['id']}})[_0xfda4('0x16')](handleEntityNotFound(_0x65917b,null))[_0xfda4('0x16')](function(_0x5d2132){if(_0x5d2132){return _0x5d2132[_0xfda4('0x7c')](_0x48d9bc[_0xfda4('0x27')][_0xfda4('0x58')])['then'](function(){if(_[_0xfda4('0x7d')](_0x48d9bc['query']['ids'])){for(var _0x5a2f34=0x0;_0x5a2f34<_0x48d9bc['query'][_0xfda4('0x58')][_0xfda4('0x32')];_0x5a2f34+=0x1){socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x48d9bc[_0xfda4('0x27')]['ids'][_0x5a2f34]),'WhatsappQueueId':Number(_0x48d9bc[_0xfda4('0x2b')]['id'])});}}else{socket[_0xfda4('0x61')](_0xfda4('0x77'),{'UserId':Number(_0x48d9bc[_0xfda4('0x27')]['ids']),'WhatsappQueueId':Number(_0x48d9bc[_0xfda4('0x2b')]['id'])});}});}})[_0xfda4('0x16')](respondWithStatusCode(_0x65917b,null))[_0xfda4('0x29')](handleError(_0x65917b,null));};exports[_0xfda4('0x7e')]=function(_0x5e7b36,_0x1505f1){var _0x5cb370={};var _0x90051d={};var _0x577231;var _0x589a5f;return db[_0xfda4('0x1f')][_0xfda4('0x54')]({'where':{'id':_0x5e7b36[_0xfda4('0x2b')]['id']}})[_0xfda4('0x16')](handleEntityNotFound(_0x1505f1,null))['then'](function(_0x19287e){if(_0x19287e){_0x577231=_0x19287e;_0x90051d[_0xfda4('0x2e')]=_['keys'](db[_0xfda4('0x48')][_0xfda4('0x20')]);_0x90051d[_0xfda4('0x27')]=_[_0xfda4('0x2c')](_0x5e7b36['query']);_0x90051d[_0xfda4('0x2d')]=_[_0xfda4('0x2f')](_0x90051d[_0xfda4('0x2e')],_0x90051d[_0xfda4('0x27')]);_0x5cb370['attributes']=_[_0xfda4('0x2f')](_0x90051d['model'],qs[_0xfda4('0x30')](_0x5e7b36[_0xfda4('0x27')]['fields']));_0x5cb370[_0xfda4('0x31')]=_0x5cb370['attributes'][_0xfda4('0x32')]?_0x5cb370[_0xfda4('0x31')]:_0x90051d[_0xfda4('0x2e')];_0x5cb370[_0xfda4('0x43')]=qs[_0xfda4('0x44')](_0x5e7b36[_0xfda4('0x27')][_0xfda4('0x44')]);_0x5cb370[_0xfda4('0x25')]=qs['filters'](_['pick'](_0x5e7b36[_0xfda4('0x27')],_0x90051d['filters']));if(_0x5e7b36[_0xfda4('0x27')][_0xfda4('0x47')]){_0x5cb370['where']=_[_0xfda4('0x34')](_0x5cb370[_0xfda4('0x25')],{'$or':_[_0xfda4('0x1e')](_0x5cb370[_0xfda4('0x31')],function(_0x5970eb){var _0x235298={};_0x235298[_0x5970eb]={'$like':'%'+_0x5e7b36[_0xfda4('0x27')]['filter']+'%'};return _0x235298;})});}_0x5cb370=_[_0xfda4('0x34')]({},_0x5cb370,_0x5e7b36[_0xfda4('0x35')]);return _0x577231['getAgents'](_0x5cb370);}})[_0xfda4('0x16')](function(_0x2e95fb){if(_0x2e95fb){_0x589a5f=_0x2e95fb['length'];if(!_0x5e7b36[_0xfda4('0x27')][_0xfda4('0x56')](_0xfda4('0x42'))){_0x5cb370['limit']=qs[_0xfda4('0x13')](_0x5e7b36[_0xfda4('0x27')]['limit']);_0x5cb370['offset']=qs[_0xfda4('0x11')](_0x5e7b36[_0xfda4('0x27')][_0xfda4('0x11')]);}return _0x577231[_0xfda4('0x7e')](_0x5cb370);}})[_0xfda4('0x16')](function(_0x170332){if(_0x170332){return _0x170332?{'count':_0x589a5f,'rows':_0x170332}:null;}})[_0xfda4('0x16')](respondWithResult(_0x1505f1,null))[_0xfda4('0x29')](handleError(_0x1505f1,null));}; \ No newline at end of file +var _0x108d=['spread','userWhatsappQueue:save','removeAgents','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','status','end','json','offset','undefined','limit','count','set','Content-Range','then','WhatsappQueues','UserProfileResource','destroy','sendStatus','error','name','index','map','key','getOptions','where','WhatsappQueue','include','query','rows','catch','show','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','update','describe','get','hasOwnProperty','sort','pick','WhatsappQueueId','filter','UserWhatsappQueue','findAll','User','UserId','whatsappPause','createdAt','%s/%s','SIP','updatedAt','getTeams','findOne','Team','order','nolimit','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','each','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','emit','userWhatsappQueue:remove','addAgents','omit'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x108d,0x175));var _0xd108=function(_0x65d6d0,_0x57bc76){_0x65d6d0=_0x65d6d0-0x0;var _0x315e6f=_0x108d[_0x65d6d0];return _0x315e6f;};'use strict';var BPromise=require(_0xd108('0x0'));var util=require(_0xd108('0x1'));var _=require(_0xd108('0x2'));var squel=require(_0xd108('0x3'));var Redis=require(_0xd108('0x4'));var qs=require(_0xd108('0x5'));var logger=require(_0xd108('0x6'))(_0xd108('0x7'));var config=require(_0xd108('0x8'));var db=require(_0xd108('0x9'))['db'];config[_0xd108('0xa')]=_[_0xd108('0xb')](config[_0xd108('0xa')],{'host':_0xd108('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd108('0xa')]));require('./whatsappQueue.socket')['register'](socket);function respondWithStatusCode(_0x1081fa,_0x4e7356){_0x4e7356=_0x4e7356||0xcc;return function(_0x398ae8){if(_0x398ae8){return _0x1081fa['sendStatus'](_0x4e7356);}return _0x1081fa[_0xd108('0xd')](_0x4e7356)[_0xd108('0xe')]();};}function respondWithResult(_0x236913,_0x17dcb0){_0x17dcb0=_0x17dcb0||0xc8;return function(_0x2aaa96){if(_0x2aaa96){return _0x236913[_0xd108('0xd')](_0x17dcb0)[_0xd108('0xf')](_0x2aaa96);}};}function respondWithFilteredResult(_0x53704e,_0x55df63){return function(_0x4529e5){if(_0x4529e5){var _0x212243=typeof _0x55df63[_0xd108('0x10')]===_0xd108('0x11')&&typeof _0x55df63[_0xd108('0x12')]==='undefined';var _0x2f06b7=_0x4529e5[_0xd108('0x13')];var _0x1a0a95=_0x212243?0x0:_0x55df63[_0xd108('0x10')];var _0x4abbd1=_0x212243?_0x4529e5['count']:_0x55df63[_0xd108('0x10')]+_0x55df63[_0xd108('0x12')];var _0x585191;if(_0x4abbd1>=_0x2f06b7){_0x4abbd1=_0x2f06b7;_0x585191=0xc8;}else{_0x585191=0xce;}_0x53704e[_0xd108('0xd')](_0x585191);return _0x53704e[_0xd108('0x14')](_0xd108('0x15'),_0x1a0a95+'-'+_0x4abbd1+'/'+_0x2f06b7)[_0xd108('0xf')](_0x4529e5);}return null;};}function saveUpdates(_0x2c06f9){return function(_0x271106){if(_0x271106){return _0x271106['update'](_0x2c06f9)[_0xd108('0x16')](function(_0x2a7124){return _0x2a7124;});}return null;};}function removeEntity(_0x38636b){return function(_0x3d2eeb){if(_0x3d2eeb){return _0x3d2eeb['destroy']()['then'](function(){var _0x4882c0=_0x3d2eeb['get']({'plain':!![]});var _0x3da96b=_0xd108('0x17');return db[_0xd108('0x18')][_0xd108('0x19')]({'where':{'type':_0x3da96b,'resourceId':_0x4882c0['id']}})[_0xd108('0x16')](function(){return _0x3d2eeb;});})[_0xd108('0x16')](function(){_0x38636b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xec8aed){return function(_0x2f916c){if(!_0x2f916c){_0xec8aed[_0xd108('0x1a')](0x194);}return _0x2f916c;};}function handleError(_0x20a9be,_0x3cd1fb){_0x3cd1fb=_0x3cd1fb||0x1f4;return function(_0x367ca9){logger[_0xd108('0x1b')](_0x367ca9['stack']);if(_0x367ca9[_0xd108('0x1c')]){delete _0x367ca9[_0xd108('0x1c')];}_0x20a9be['status'](_0x3cd1fb)['send'](_0x367ca9);};}exports[_0xd108('0x1d')]=function(_0xe20bb3,_0x1b3255){var _0x5a0cf6={};var _0x38704a={'count':0x0,'rows':[]};var _0x234e3b=_[_0xd108('0x1e')](db['WhatsappQueue']['rawAttributes'],function(_0x2947d8){return{'name':_0x2947d8['fieldName'],'type':_0x2947d8['type'][_0xd108('0x1f')]};});_0x5a0cf6=qs[_0xd108('0x20')](_0x234e3b,_0xe20bb3);var _0x5067c3={'where':_0x5a0cf6[_0xd108('0x21')]};return db[_0xd108('0x22')][_0xd108('0x13')](_0x5067c3)[_0xd108('0x16')](function(_0x6470be){_0x38704a['count']=_0x6470be;_0x5a0cf6[_0xd108('0x23')]=qs['include'](_0xe20bb3[_0xd108('0x24')]);return db[_0xd108('0x22')]['findAll'](_0x5a0cf6);})[_0xd108('0x16')](function(_0x542706){_0x38704a[_0xd108('0x25')]=_0x542706;return _0x38704a;})[_0xd108('0x16')](respondWithFilteredResult(_0x1b3255,_0x5a0cf6))[_0xd108('0x26')](handleError(_0x1b3255,null));};exports[_0xd108('0x27')]=function(_0x448a6d,_0x2cb740){var _0x2b4667={'raw':!![],'where':{'id':_0x448a6d[_0xd108('0x28')]['id']}},_0x4424d0={};_0x4424d0[_0xd108('0x29')]=_[_0xd108('0x2a')](db['WhatsappQueue'][_0xd108('0x2b')]);_0x4424d0['query']=_[_0xd108('0x2a')](_0x448a6d[_0xd108('0x24')]);_0x4424d0[_0xd108('0x2c')]=_[_0xd108('0x2d')](_0x4424d0['model'],_0x4424d0[_0xd108('0x24')]);_0x2b4667[_0xd108('0x2e')]=_[_0xd108('0x2d')](_0x4424d0['model'],qs[_0xd108('0x2f')](_0x448a6d[_0xd108('0x24')][_0xd108('0x2f')]));_0x2b4667[_0xd108('0x2e')]=_0x2b4667['attributes'][_0xd108('0x30')]?_0x2b4667['attributes']:_0x4424d0[_0xd108('0x29')];if(_0x448a6d['query'][_0xd108('0x31')]){_0x2b4667['include']=[{'all':!![]}];}_0x2b4667=_[_0xd108('0x32')]({},_0x2b4667,_0x448a6d[_0xd108('0x33')]);return db['WhatsappQueue'][_0xd108('0x34')](_0x2b4667)['then'](handleEntityNotFound(_0x2cb740,null))[_0xd108('0x16')](respondWithResult(_0x2cb740,null))[_0xd108('0x26')](handleError(_0x2cb740,null));};exports[_0xd108('0x35')]=function(_0x1944b0,_0xb5ac0b){return db[_0xd108('0x22')]['create'](_0x1944b0[_0xd108('0x36')],{})[_0xd108('0x16')](function(_0x1d094e){var _0x4b7cc8=_0x1944b0[_0xd108('0x37')]['get']({'plain':!![]});if(!_0x4b7cc8)throw new Error(_0xd108('0x38'));if(_0x4b7cc8['role']===_0xd108('0x37')){var _0x4fa135=_0x1d094e['get']({'plain':!![]});var _0x177c19='WhatsappQueues';return db[_0xd108('0x39')][_0xd108('0x34')]({'where':{'name':_0x177c19,'userProfileId':_0x4b7cc8[_0xd108('0x3a')]},'raw':!![]})[_0xd108('0x16')](function(_0x55f199){if(_0x55f199&&_0x55f199[_0xd108('0x3b')]===0x0){return db[_0xd108('0x18')][_0xd108('0x35')]({'name':_0x4fa135['name'],'resourceId':_0x4fa135['id'],'type':_0x55f199[_0xd108('0x1c')],'sectionId':_0x55f199['id']},{})[_0xd108('0x16')](function(){return _0x1d094e;});}else{return _0x1d094e;}})['catch'](function(_0x553c21){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x553c21);throw _0x553c21;});}return _0x1d094e;})['then'](respondWithResult(_0xb5ac0b,0xc9))[_0xd108('0x26')](handleError(_0xb5ac0b,null));};exports[_0xd108('0x3c')]=function(_0x49b30b,_0x1ab2c0){if(_0x49b30b['body']['id']){delete _0x49b30b[_0xd108('0x36')]['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x49b30b[_0xd108('0x28')]['id']}})['then'](handleEntityNotFound(_0x1ab2c0,null))[_0xd108('0x16')](saveUpdates(_0x49b30b[_0xd108('0x36')],null))[_0xd108('0x16')](respondWithResult(_0x1ab2c0,null))[_0xd108('0x26')](handleError(_0x1ab2c0,null));};exports['destroy']=function(_0x2db5d6,_0xd3bf6d){return db[_0xd108('0x22')][_0xd108('0x34')]({'where':{'id':_0x2db5d6[_0xd108('0x28')]['id']}})[_0xd108('0x16')](handleEntityNotFound(_0xd3bf6d,null))[_0xd108('0x16')](removeEntity(_0xd3bf6d,null))['catch'](handleError(_0xd3bf6d,null));};exports[_0xd108('0x3d')]=function(_0x3f9415,_0x55f413){return db[_0xd108('0x22')][_0xd108('0x3d')]()[_0xd108('0x16')](respondWithResult(_0x55f413,null))[_0xd108('0x26')](handleError(_0x55f413,null));};exports['getMembers']=function(_0x3f1d5f,_0x41196f){var _0x56b4cd={'raw':!![],'where':{}},_0x3fbf33={},_0x3e455c;return db[_0xd108('0x22')]['findOne']({'where':{'id':_0x3f1d5f[_0xd108('0x28')]['id']}})[_0xd108('0x16')](handleEntityNotFound(_0x41196f,null))[_0xd108('0x16')](function(_0x4f5209){if(_0x4f5209){_0x3e455c=_0x4f5209[_0xd108('0x3e')]({'plain':!![]});_0x3fbf33[_0xd108('0x29')]=_['keys'](db['UserWhatsappQueue'][_0xd108('0x2b')]);_0x3fbf33[_0xd108('0x24')]=_[_0xd108('0x2a')](_0x3f1d5f['query']);_0x3fbf33[_0xd108('0x2c')]=_['intersection'](_0x3fbf33[_0xd108('0x29')],_0x3fbf33[_0xd108('0x24')]);_0x56b4cd['attributes']=_[_0xd108('0x2d')](_0x3fbf33[_0xd108('0x29')],qs[_0xd108('0x2f')](_0x3f1d5f[_0xd108('0x24')][_0xd108('0x2f')]));_0x56b4cd[_0xd108('0x2e')]=_0x56b4cd[_0xd108('0x2e')][_0xd108('0x30')]?_0x56b4cd['attributes']:_0x3fbf33[_0xd108('0x29')];if(!_0x3f1d5f[_0xd108('0x24')][_0xd108('0x3f')]('nolimit')){_0x56b4cd[_0xd108('0x12')]=qs['limit'](_0x3f1d5f[_0xd108('0x24')][_0xd108('0x12')]);_0x56b4cd[_0xd108('0x10')]=qs['offset'](_0x3f1d5f[_0xd108('0x24')]['offset']);}_0x56b4cd['order']=qs[_0xd108('0x40')](_0x3f1d5f[_0xd108('0x24')][_0xd108('0x40')]);_0x56b4cd[_0xd108('0x21')]=qs[_0xd108('0x2c')](_[_0xd108('0x41')](_0x3f1d5f[_0xd108('0x24')],_0x3fbf33['filters']));_0x56b4cd['where'][_0xd108('0x42')]=_0x4f5209['id'];if(_0x3f1d5f['query'][_0xd108('0x43')]){_0x56b4cd[_0xd108('0x21')]=_['merge'](_0x56b4cd[_0xd108('0x21')],{'$or':_[_0xd108('0x1e')](_0x56b4cd[_0xd108('0x2e')],function(_0x436485){var _0x5bbb63={};_0x5bbb63[_0x436485]={'$like':'%'+_0x3f1d5f[_0xd108('0x24')]['filter']+'%'};return _0x5bbb63;})});}_0x56b4cd=_[_0xd108('0x32')]({},_0x56b4cd,_0x3f1d5f[_0xd108('0x33')]);return db[_0xd108('0x44')][_0xd108('0x45')](_0x56b4cd);}})[_0xd108('0x16')](function(_0x49e211){if(_0x49e211){return db[_0xd108('0x46')]['findAndCountAll']({'where':{'id':_[_0xd108('0x1e')](_0x49e211,_0xd108('0x47')),'role':'agent'},'attributes':['id',_0xd108('0x1c'),_0xd108('0x48'),'updatedAt',_0xd108('0x49')]});}})[_0xd108('0x16')](function(_0x54bfaf){if(_0x54bfaf){return{'count':_0x54bfaf[_0xd108('0x13')],'rows':_[_0xd108('0x1e')](_0x54bfaf[_0xd108('0x25')],function(_0x596168){return{'membername':_0x596168[_0xd108('0x1c')],'UserId':_0x596168['id'],'queue_name':_0x3e455c[_0xd108('0x1c')],'WhatsappQueueId':_0x3e455c['id'],'interface':util['format'](_0xd108('0x4a'),_0xd108('0x4b'),_0x596168['name']),'penalty':0x0,'paused':_0x596168[_0xd108('0x48')],'createdAt':_0x596168[_0xd108('0x49')],'updatedAt':_0x596168[_0xd108('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x41196f,_0x56b4cd))[_0xd108('0x26')](handleError(_0x41196f,null));};exports[_0xd108('0x4d')]=function(_0x2cf980,_0xb5e968){var _0x4f5f78={};var _0x63016f={};var _0x31a2e9;var _0x4abb51;return db['WhatsappQueue'][_0xd108('0x4e')]({'where':{'id':_0x2cf980[_0xd108('0x28')]['id']}})['then'](handleEntityNotFound(_0xb5e968,null))[_0xd108('0x16')](function(_0x643eaf){if(_0x643eaf){_0x31a2e9=_0x643eaf;_0x63016f[_0xd108('0x29')]=_[_0xd108('0x2a')](db[_0xd108('0x4f')][_0xd108('0x2b')]);_0x63016f['query']=_[_0xd108('0x2a')](_0x2cf980[_0xd108('0x24')]);_0x63016f[_0xd108('0x2c')]=_['intersection'](_0x63016f[_0xd108('0x29')],_0x63016f['query']);_0x4f5f78[_0xd108('0x2e')]=_[_0xd108('0x2d')](_0x63016f[_0xd108('0x29')],qs[_0xd108('0x2f')](_0x2cf980[_0xd108('0x24')]['fields']));_0x4f5f78[_0xd108('0x2e')]=_0x4f5f78['attributes'][_0xd108('0x30')]?_0x4f5f78['attributes']:_0x63016f['model'];_0x4f5f78[_0xd108('0x50')]=qs['sort'](_0x2cf980['query'][_0xd108('0x40')]);_0x4f5f78['where']=qs[_0xd108('0x2c')](_[_0xd108('0x41')](_0x2cf980[_0xd108('0x24')],_0x63016f[_0xd108('0x2c')]));if(_0x2cf980[_0xd108('0x24')][_0xd108('0x43')]){_0x4f5f78[_0xd108('0x21')]=_[_0xd108('0x32')](_0x4f5f78[_0xd108('0x21')],{'$or':_['map'](_0x4f5f78[_0xd108('0x2e')],function(_0x33c150){var _0x342d96={};_0x342d96[_0x33c150]={'$like':'%'+_0x2cf980['query'][_0xd108('0x43')]+'%'};return _0x342d96;})});}_0x4f5f78=_[_0xd108('0x32')]({},_0x4f5f78,_0x2cf980['options']);return _0x31a2e9[_0xd108('0x4d')](_0x4f5f78);}})[_0xd108('0x16')](function(_0xd4c0ec){if(_0xd4c0ec){_0x4abb51=_0xd4c0ec[_0xd108('0x30')];if(!_0x2cf980['query'][_0xd108('0x3f')](_0xd108('0x51'))){_0x4f5f78[_0xd108('0x12')]=qs[_0xd108('0x12')](_0x2cf980[_0xd108('0x24')][_0xd108('0x12')]);_0x4f5f78[_0xd108('0x10')]=qs['offset'](_0x2cf980[_0xd108('0x24')][_0xd108('0x10')]);}return _0x31a2e9['getTeams'](_0x4f5f78);}})[_0xd108('0x16')](function(_0x1a6252){if(_0x1a6252){return _0x1a6252?{'count':_0x4abb51,'rows':_0x1a6252}:null;}})[_0xd108('0x16')](respondWithResult(_0xb5e968,null))[_0xd108('0x26')](handleError(_0xb5e968,null));};exports[_0xd108('0x52')]=function(_0x4a0d80,_0x2837e8){var _0x755626=_0x4a0d80[_0xd108('0x36')][_0xd108('0x53')];return db[_0xd108('0x4f')][_0xd108('0x45')]({'where':{'id':_0x755626},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd108('0x54'),'attributes':['id',_0xd108('0x1c'),_0xd108('0x55'),_0xd108('0x56'),'interface'],'raw':!![]}]})[_0xd108('0x16')](function(_0x34d88a){if(_0x34d88a){var _0x222f28=_[_0xd108('0x57')](_0x34d88a,function(_0x2bbf55){var _0x3dcda4=_0x2bbf55[_0xd108('0x3e')]({'plain':!![]});return _0x3dcda4[_0xd108('0x54')];});return db[_0xd108('0x22')][_0xd108('0x34')]({'where':{'id':_0x4a0d80[_0xd108('0x28')]['id']}})[_0xd108('0x16')](function(_0x1c328f){return db[_0xd108('0x58')]['transaction'](function(_0x4a759c){return _0x1c328f[_0xd108('0x52')](_0x755626,{'transaction':_0x4a759c})[_0xd108('0x16')](function(){return BPromise[_0xd108('0x59')](_0x222f28,function(_0xcc145f){return db[_0xd108('0x44')][_0xd108('0x5a')]({'where':{'UserId':_0xcc145f['id'],'WhatsappQueueId':_0x4a0d80[_0xd108('0x28')]['id']},'transaction':_0x4a759c});});})['then'](function(){_0x222f28[_0xd108('0x5b')](function(_0x5eb828){socket['emit']('userWhatsappQueue:save',{'UserId':_0x5eb828['id'],'WhatsappQueueId':_0x1c328f['id']});});});});});}})[_0xd108('0x16')](respondWithStatusCode(_0x2837e8,null))[_0xd108('0x26')](handleError(_0x2837e8,null));};exports[_0xd108('0x5c')]=function(_0x3938c5,_0x4d8705){return db[_0xd108('0x4f')][_0xd108('0x45')]({'where':{'id':_0x3938c5['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xd108('0x46')],'as':_0xd108('0x54'),'attributes':['id'],'raw':!![]}]})[_0xd108('0x16')](handleEntityNotFound(_0x4d8705,null))[_0xd108('0x16')](function(_0x4969d1){var _0xd19c6d=_[_0xd108('0x1e')](_0x4969d1,'id');var _0x121234=[];var _0x19c987=[];var _0x548610=squel[_0xd108('0x5d')]();_0x548610[_0xd108('0x5e')](_0xd108('0x5f'))[_0xd108('0x60')](_0xd108('0x61'),'tq')[_0xd108('0x62')](_0xd108('0x63'),'ut',_0xd108('0x64'))[_0xd108('0x21')]('WhatsappQueueId\x20=\x20?',_0x3938c5[_0xd108('0x28')]['id']);for(var _0x2d97b2=0x0;_0x2d97b2<_0x4969d1[_0xd108('0x30')];_0x2d97b2+=0x1){let _0x176926=_0x4969d1[_0x2d97b2];for(var _0x2602dc=0x0;_0x2602dc<_0x176926[_0xd108('0x54')]['length'];_0x2602dc+=0x1){let _0x1f3267=_0x176926[_0xd108('0x54')][_0x2602dc];var _0xb17c53=_0x548610[_0xd108('0x65')]();_0xb17c53[_0xd108('0x21')](_0xd108('0x66'),_0x1f3267['id']);_0x19c987[_0xd108('0x67')](db[_0xd108('0x58')][_0xd108('0x24')](_0xb17c53[_0xd108('0x68')](),{'type':db[_0xd108('0x58')][_0xd108('0x69')][_0xd108('0x6a')]})['then'](function(_0x3bb40f){if(_0x3bb40f['length']===0x1){return _0x1f3267['id'];}else{var _0x5a6e1c=_[_0xd108('0x6b')](_[_0xd108('0x1e')](_0x3bb40f,_0xd108('0x6c')),function(_0x5f3ccd){return _[_0xd108('0x6d')](_0xd19c6d,_0x5f3ccd);});if(_0x5a6e1c){return _0x1f3267['id'];}}}));}}return BPromise[_0xd108('0x6e')](_0x19c987)[_0xd108('0x16')](function(_0x485573){_0x121234=_(_0x121234)[_0xd108('0x6f')](_0x485573)[_0xd108('0x70')]()[_0xd108('0x71')]();return db[_0xd108('0x22')][_0xd108('0x34')]({'where':{'id':_0x3938c5[_0xd108('0x28')]['id']}})[_0xd108('0x16')](function(_0x336d13){return db[_0xd108('0x58')][_0xd108('0x72')](function(_0x365aa6){return _0x336d13['removeTeams'](_0x3938c5[_0xd108('0x24')][_0xd108('0x53')],{'transaction':_0x365aa6})[_0xd108('0x16')](function(){if(!_['isEmpty'](_0x121234)){return _0x336d13['removeAgents'](_0x121234,{'transaction':_0x365aa6});}})['then'](function(){_0x121234[_0xd108('0x5b')](function(_0xefb41f){socket[_0xd108('0x73')](_0xd108('0x74'),{'UserId':_0xefb41f,'WhatsappQueueId':_0x336d13['id']});});});});});});})[_0xd108('0x16')](respondWithStatusCode(_0x4d8705,null))[_0xd108('0x26')](handleError(_0x4d8705,null));};exports[_0xd108('0x75')]=function(_0x2c94c2,_0x232d2c){return db[_0xd108('0x22')][_0xd108('0x34')]({'where':{'id':_0x2c94c2[_0xd108('0x28')]['id']}})[_0xd108('0x16')](handleEntityNotFound(_0x232d2c,null))[_0xd108('0x16')](function(_0x22f9b7){if(_0x22f9b7){return _0x22f9b7[_0xd108('0x75')](_0x2c94c2['body']['ids'],_[_0xd108('0x76')](_0x2c94c2[_0xd108('0x36')],[_0xd108('0x53'),'id'])||{})[_0xd108('0x77')](function(_0x18a4f7){for(var _0x1d6e5a=0x0;_0x1d6e5a<_0x2c94c2[_0xd108('0x36')][_0xd108('0x53')]['length'];_0x1d6e5a+=0x1){socket[_0xd108('0x73')](_0xd108('0x78'),{'UserId':Number(_0x2c94c2[_0xd108('0x36')][_0xd108('0x53')][_0x1d6e5a]),'WhatsappQueueId':Number(_0x2c94c2['params']['id'])});}return _0x18a4f7;});}})[_0xd108('0x16')](respondWithResult(_0x232d2c,null))[_0xd108('0x26')](handleError(_0x232d2c,null));};exports[_0xd108('0x79')]=function(_0x689bfe,_0x19e3bb){return db[_0xd108('0x22')][_0xd108('0x34')]({'where':{'id':_0x689bfe[_0xd108('0x28')]['id']}})[_0xd108('0x16')](handleEntityNotFound(_0x19e3bb,null))[_0xd108('0x16')](function(_0x518232){if(_0x518232){return _0x518232[_0xd108('0x79')](_0x689bfe[_0xd108('0x24')][_0xd108('0x53')])['then'](function(){if(_['isArray'](_0x689bfe['query'][_0xd108('0x53')])){for(var _0x2e313d=0x0;_0x2e313d<_0x689bfe['query'][_0xd108('0x53')][_0xd108('0x30')];_0x2e313d+=0x1){socket['emit'](_0xd108('0x74'),{'UserId':Number(_0x689bfe[_0xd108('0x24')]['ids'][_0x2e313d]),'WhatsappQueueId':Number(_0x689bfe[_0xd108('0x28')]['id'])});}}else{socket['emit'](_0xd108('0x74'),{'UserId':Number(_0x689bfe[_0xd108('0x24')][_0xd108('0x53')]),'WhatsappQueueId':Number(_0x689bfe[_0xd108('0x28')]['id'])});}});}})[_0xd108('0x16')](respondWithStatusCode(_0x19e3bb,null))['catch'](handleError(_0x19e3bb,null));};exports[_0xd108('0x7a')]=function(_0xe003ba,_0x4a3ba9){var _0x4361eb={};var _0x1bd84e={};var _0x12ba82;var _0x2d37ab;return db['WhatsappQueue'][_0xd108('0x4e')]({'where':{'id':_0xe003ba['params']['id']}})[_0xd108('0x16')](handleEntityNotFound(_0x4a3ba9,null))['then'](function(_0xc88780){if(_0xc88780){_0x12ba82=_0xc88780;_0x1bd84e[_0xd108('0x29')]=_['keys'](db[_0xd108('0x46')][_0xd108('0x2b')]);_0x1bd84e[_0xd108('0x24')]=_[_0xd108('0x2a')](_0xe003ba[_0xd108('0x24')]);_0x1bd84e[_0xd108('0x2c')]=_[_0xd108('0x2d')](_0x1bd84e['model'],_0x1bd84e[_0xd108('0x24')]);_0x4361eb[_0xd108('0x2e')]=_[_0xd108('0x2d')](_0x1bd84e[_0xd108('0x29')],qs[_0xd108('0x2f')](_0xe003ba['query']['fields']));_0x4361eb[_0xd108('0x2e')]=_0x4361eb[_0xd108('0x2e')][_0xd108('0x30')]?_0x4361eb[_0xd108('0x2e')]:_0x1bd84e['model'];_0x4361eb['order']=qs['sort'](_0xe003ba[_0xd108('0x24')][_0xd108('0x40')]);_0x4361eb[_0xd108('0x21')]=qs[_0xd108('0x2c')](_[_0xd108('0x41')](_0xe003ba[_0xd108('0x24')],_0x1bd84e[_0xd108('0x2c')]));if(_0xe003ba[_0xd108('0x24')][_0xd108('0x43')]){_0x4361eb['where']=_[_0xd108('0x32')](_0x4361eb[_0xd108('0x21')],{'$or':_[_0xd108('0x1e')](_0x4361eb['attributes'],function(_0x145de8){var _0x4663ca={};_0x4663ca[_0x145de8]={'$like':'%'+_0xe003ba['query']['filter']+'%'};return _0x4663ca;})});}_0x4361eb=_[_0xd108('0x32')]({},_0x4361eb,_0xe003ba['options']);return _0x12ba82[_0xd108('0x7a')](_0x4361eb);}})[_0xd108('0x16')](function(_0x3b5927){if(_0x3b5927){_0x2d37ab=_0x3b5927['length'];if(!_0xe003ba[_0xd108('0x24')][_0xd108('0x3f')](_0xd108('0x51'))){_0x4361eb[_0xd108('0x12')]=qs[_0xd108('0x12')](_0xe003ba['query'][_0xd108('0x12')]);_0x4361eb[_0xd108('0x10')]=qs[_0xd108('0x10')](_0xe003ba[_0xd108('0x24')]['offset']);}return _0x12ba82[_0xd108('0x7a')](_0x4361eb);}})[_0xd108('0x16')](function(_0x3faa8f){if(_0x3faa8f){return _0x3faa8f?{'count':_0x2d37ab,'rows':_0x3faa8f}:null;}})[_0xd108('0x16')](respondWithResult(_0x4a3ba9,null))[_0xd108('0x26')](handleError(_0x4a3ba9,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index c7c97be..a242bf6 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 _0x6dec=['events','../../mysqldb','WhatsappQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2b7055,_0x45df71){var _0x2c8fc4=function(_0x1fd01d){while(--_0x1fd01d){_0x2b7055['push'](_0x2b7055['shift']());}};_0x2c8fc4(++_0x45df71);}(_0x6dec,0x190));var _0xc6de=function(_0x2a4bf1,_0x52c5be){_0x2a4bf1=_0x2a4bf1-0x0;var _0x2f16c1=_0x6dec[_0x2a4bf1];return _0x2f16c1;};'use strict';var EventEmitter=require(_0xc6de('0x0'));var WhatsappQueue=require(_0xc6de('0x1'))['db'][_0xc6de('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xc6de('0x3')](0x0);var events={'afterCreate':_0xc6de('0x4'),'afterUpdate':'update','afterDestroy':_0xc6de('0x5')};function emitEvent(_0x14648e){return function(_0x1dc3de,_0x5b6551,_0x5d19f1){WhatsappQueueEvents[_0xc6de('0x6')](_0x14648e+':'+_0x1dc3de['id'],_0x1dc3de);WhatsappQueueEvents[_0xc6de('0x6')](_0x14648e,_0x1dc3de);_0x5d19f1(null);};}for(var e in events){if(events[_0xc6de('0x7')](e)){var event=events[e];WhatsappQueue[_0xc6de('0x8')](e,emitEvent(event));}}module[_0xc6de('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0xef4d=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappQueue','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef4d,0x100));var _0xdef4=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xef4d[_0xbd08b4];return _0x314f1e;};'use strict';var EventEmitter=require(_0xdef4('0x0'));var WhatsappQueue=require(_0xdef4('0x1'))['db'][_0xdef4('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xdef4('0x3')](0x0);var events={'afterCreate':_0xdef4('0x4'),'afterUpdate':'update','afterDestroy':_0xdef4('0x5')};function emitEvent(_0x46d7b5){return function(_0x438ab5,_0x482ec7,_0x17af65){WhatsappQueueEvents[_0xdef4('0x6')](_0x46d7b5+':'+_0x438ab5['id'],_0x438ab5);WhatsappQueueEvents[_0xdef4('0x6')](_0x46d7b5,_0x438ab5);_0x17af65(null);};}for(var e in events){if(events[_0xdef4('0x7')](e)){var event=events[e];WhatsappQueue[_0xdef4('0x8')](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 9b2d931..e2f7604 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 _0x8ff7=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','whatsapp_queues','lodash'];(function(_0x3e21f4,_0x43d310){var _0x40fc49=function(_0x54a8f6){while(--_0x54a8f6){_0x3e21f4['push'](_0x3e21f4['shift']());}};_0x40fc49(++_0x43d310);}(_0x8ff7,0x151));var _0x78ff=function(_0x59eef7,_0x55429a){_0x59eef7=_0x59eef7-0x0;var _0x4641f6=_0x8ff7[_0x59eef7];return _0x4641f6;};'use strict';var _=require(_0x78ff('0x0'));var util=require(_0x78ff('0x1'));var logger=require('../../config/logger')(_0x78ff('0x2'));var moment=require(_0x78ff('0x3'));var BPromise=require(_0x78ff('0x4'));var rp=require(_0x78ff('0x5'));var fs=require('fs');var path=require(_0x78ff('0x6'));var rimraf=require(_0x78ff('0x7'));var config=require(_0x78ff('0x8'));var attributes=require(_0x78ff('0x9'));module[_0x78ff('0xa')]=function(_0x1d8e91,_0x11d53a){return _0x1d8e91[_0x78ff('0xb')]('WhatsappQueue',attributes,{'tableName':_0x78ff('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafa4=['bluebird','path','rimraf','../../config/environment','exports','whatsapp_queues','lodash','util','../../config/logger','api'];(function(_0x72699,_0x2db3f6){var _0x183e18=function(_0x263e9f){while(--_0x263e9f){_0x72699['push'](_0x72699['shift']());}};_0x183e18(++_0x2db3f6);}(_0xafa4,0x132));var _0x4afa=function(_0x53a2c9,_0x5bcc2e){_0x53a2c9=_0x53a2c9-0x0;var _0x3b1949=_0xafa4[_0x53a2c9];return _0x3b1949;};'use strict';var _=require(_0x4afa('0x0'));var util=require(_0x4afa('0x1'));var logger=require(_0x4afa('0x2'))(_0x4afa('0x3'));var moment=require('moment');var BPromise=require(_0x4afa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4afa('0x5'));var rimraf=require(_0x4afa('0x6'));var config=require(_0x4afa('0x7'));var attributes=require('./whatsappQueue.attributes');module[_0x4afa('0x8')]=function(_0x3cef4a,_0x332deb){return _0x3cef4a['define']('WhatsappQueue',attributes,{'tableName':_0x4afa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index c913e18..e306e75 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 _0x399a=['findAll','options','raw','limit','include','attributes','map','model','GetWhatsappQueue','ShowWhatsappQueue','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','WhatsappQueue'];(function(_0x35d9f5,_0x3f47d7){var _0x3db11f=function(_0x11e4d8){while(--_0x11e4d8){_0x35d9f5['push'](_0x35d9f5['shift']());}};_0x3db11f(++_0x3f47d7);}(_0x399a,0x1d2));var _0xa399=function(_0x435b2f,_0x4c44da){_0x435b2f=_0x435b2f-0x0;var _0x181648=_0x399a[_0x435b2f];return _0x181648;};'use strict';var _=require('lodash');var util=require(_0xa399('0x0'));var moment=require(_0xa399('0x1'));var BPromise=require('bluebird');var rs=require(_0xa399('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa399('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa399('0x4'))(_0xa399('0x5'));var config=require(_0xa399('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa399('0x7')][_0xa399('0x8')]({'port':0x232a});config[_0xa399('0x9')]=_[_0xa399('0xa')](config[_0xa399('0x9')],{'host':_0xa399('0xb'),'port':0x18eb});var socket=require(_0xa399('0xc'))(new Redis(config[_0xa399('0x9')]));require('./whatsappQueue.socket')[_0xa399('0xd')](socket);function respondWithRpcPromise(_0x478ddb,_0x56863c,_0x3f9c43){return new BPromise(function(_0x2c9da7,_0x23dc45){return client[_0xa399('0xe')](_0x478ddb,_0x3f9c43)[_0xa399('0xf')](function(_0x3af07a){logger['info'](_0xa399('0x10'),_0x56863c,_0xa399('0x11'));logger[_0xa399('0x12')](_0xa399('0x13'),_0x56863c,'request\x20sent',JSON[_0xa399('0x14')](_0x3af07a));if(_0x3af07a[_0xa399('0x15')]){if(_0x3af07a[_0xa399('0x15')][_0xa399('0x16')]===0x1f4){logger[_0xa399('0x15')](_0xa399('0x10'),_0x56863c,_0x3af07a['error']['message']);return _0x23dc45(_0x3af07a['error'][_0xa399('0x17')]);}logger[_0xa399('0x15')](_0xa399('0x10'),_0x56863c,_0x3af07a[_0xa399('0x15')][_0xa399('0x17')]);return _0x2c9da7(_0x3af07a['error']['message']);}else{logger[_0xa399('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x56863c,_0xa399('0x11'));_0x2c9da7(_0x3af07a[_0xa399('0x19')][_0xa399('0x17')]);}})[_0xa399('0x1a')](function(_0x5db163){logger['error'](_0xa399('0x10'),_0x56863c,_0x5db163);_0x23dc45(_0x5db163);});});}exports['GetWhatsappQueue']=function(_0xdcbf1a){var _0x2c82a8=this;return new Promise(function(_0x3d4976,_0x9148da){return db[_0xa399('0x1b')][_0xa399('0x1c')]({'raw':_0xdcbf1a[_0xa399('0x1d')]?_0xdcbf1a[_0xa399('0x1d')][_0xa399('0x1e')]===undefined?!![]:![]:!![],'where':_0xdcbf1a[_0xa399('0x1d')]?_0xdcbf1a[_0xa399('0x1d')]['where']||null:null,'attributes':_0xdcbf1a[_0xa399('0x1d')]?_0xdcbf1a[_0xa399('0x1d')]['attributes']||null:null,'limit':_0xdcbf1a[_0xa399('0x1d')]?_0xdcbf1a['options'][_0xa399('0x1f')]||null:null,'include':_0xdcbf1a['options']?_0xdcbf1a[_0xa399('0x1d')][_0xa399('0x20')]?_['map'](_0xdcbf1a['options'][_0xa399('0x20')],function(_0x155ec0){return{'model':db[_0x155ec0['model']],'as':_0x155ec0['as'],'attributes':_0x155ec0[_0xa399('0x21')],'include':_0x155ec0[_0xa399('0x20')]?_[_0xa399('0x22')](_0x155ec0[_0xa399('0x20')],function(_0x2dbf67){return{'model':db[_0x2dbf67['model']],'as':_0x2dbf67['as'],'attributes':_0x2dbf67[_0xa399('0x21')],'include':_0x2dbf67['include']?_[_0xa399('0x22')](_0x2dbf67[_0xa399('0x20')],function(_0x5730d5){return{'model':db[_0x5730d5[_0xa399('0x23')]],'as':_0x5730d5['as'],'attributes':_0x5730d5[_0xa399('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa399('0xf')](function(_0x48eb43){logger[_0xa399('0x18')](_0xa399('0x24'),_0xdcbf1a);logger['debug'](_0xa399('0x24'),_0xdcbf1a,JSON[_0xa399('0x14')](_0x48eb43));_0x3d4976(_0x48eb43);})['catch'](function(_0x26fa42){logger['error'](_0xa399('0x24'),_0x26fa42[_0xa399('0x17')],_0xdcbf1a);_0x9148da(_0x2c82a8[_0xa399('0x15')](0x1f4,_0x26fa42[_0xa399('0x17')]));});});};exports[_0xa399('0x25')]=function(_0x377260){var _0x3a30ec=this;return new Promise(function(_0x3585eb,_0x4abc00){return db['WhatsappQueue']['find']({'raw':_0x377260['options']?_0x377260[_0xa399('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x377260[_0xa399('0x1d')]?_0x377260[_0xa399('0x1d')]['where']||null:null,'attributes':_0x377260[_0xa399('0x1d')]?_0x377260[_0xa399('0x1d')][_0xa399('0x21')]||null:null,'include':_0x377260[_0xa399('0x1d')]?_0x377260[_0xa399('0x1d')][_0xa399('0x20')]?_[_0xa399('0x22')](_0x377260[_0xa399('0x1d')][_0xa399('0x20')],function(_0x4d3dc0){return{'model':db[_0x4d3dc0[_0xa399('0x23')]],'as':_0x4d3dc0['as'],'attributes':_0x4d3dc0['attributes'],'include':_0x4d3dc0['include']?_['map'](_0x4d3dc0[_0xa399('0x20')],function(_0x150ee8){return{'model':db[_0x150ee8[_0xa399('0x23')]],'as':_0x150ee8['as'],'attributes':_0x150ee8[_0xa399('0x21')],'include':_0x150ee8['include']?_[_0xa399('0x22')](_0x150ee8[_0xa399('0x20')],function(_0x472ef2){return{'model':db[_0x472ef2['model']],'as':_0x472ef2['as'],'attributes':_0x472ef2[_0xa399('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa399('0xf')](function(_0x266738){logger[_0xa399('0x18')]('ShowWhatsappQueue',_0x377260);logger[_0xa399('0x12')](_0xa399('0x25'),_0x377260,JSON['stringify'](_0x266738));_0x3585eb(_0x266738);})[_0xa399('0x1a')](function(_0x548518){logger[_0xa399('0x15')]('ShowWhatsappQueue',_0x548518[_0xa399('0x17')],_0x377260);_0x4abc00(_0x3a30ec[_0xa399('0x15')](0x1f4,_0x548518['message']));});});}; \ No newline at end of file +var _0xabdc=['ShowWhatsappQueue','find','lodash','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','request','then','request\x20sent','debug','stringify','error','WhatsappQueue,\x20%s,\x20%s','message','info','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x5b8a03,_0x28363f){var _0x1fdc8b=function(_0x538659){while(--_0x538659){_0x5b8a03['push'](_0x5b8a03['shift']());}};_0x1fdc8b(++_0x28363f);}(_0xabdc,0x174));var _0xcabd=function(_0x11154a,_0x295767){_0x11154a=_0x11154a-0x0;var _0x5039ca=_0xabdc[_0x11154a];return _0x5039ca;};'use strict';var _=require(_0xcabd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcabd('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcabd('0x2'));var logger=require('../../config/logger')(_0xcabd('0x3'));var config=require(_0xcabd('0x4'));var jayson=require(_0xcabd('0x5'));var client=jayson[_0xcabd('0x6')][_0xcabd('0x7')]({'port':0x232a});config[_0xcabd('0x8')]=_[_0xcabd('0x9')](config[_0xcabd('0x8')],{'host':_0xcabd('0xa'),'port':0x18eb});var socket=require(_0xcabd('0xb'))(new Redis(config[_0xcabd('0x8')]));require(_0xcabd('0xc'))['register'](socket);function respondWithRpcPromise(_0x29f3a4,_0x3f3688,_0x498bb3){return new BPromise(function(_0x4693ea,_0x4bdbef){return client[_0xcabd('0xd')](_0x29f3a4,_0x498bb3)[_0xcabd('0xe')](function(_0xf5ca00){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x3f3688,_0xcabd('0xf'));logger[_0xcabd('0x10')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x3f3688,'request\x20sent',JSON[_0xcabd('0x11')](_0xf5ca00));if(_0xf5ca00[_0xcabd('0x12')]){if(_0xf5ca00['error']['code']===0x1f4){logger['error'](_0xcabd('0x13'),_0x3f3688,_0xf5ca00[_0xcabd('0x12')][_0xcabd('0x14')]);return _0x4bdbef(_0xf5ca00[_0xcabd('0x12')][_0xcabd('0x14')]);}logger[_0xcabd('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x3f3688,_0xf5ca00[_0xcabd('0x12')][_0xcabd('0x14')]);return _0x4693ea(_0xf5ca00[_0xcabd('0x12')]['message']);}else{logger[_0xcabd('0x15')](_0xcabd('0x13'),_0x3f3688,'request\x20sent');_0x4693ea(_0xf5ca00[_0xcabd('0x16')]['message']);}})[_0xcabd('0x17')](function(_0x3952d0){logger['error'](_0xcabd('0x13'),_0x3f3688,_0x3952d0);_0x4bdbef(_0x3952d0);});});}exports[_0xcabd('0x18')]=function(_0xa97d39){var _0x4b8311=this;return new Promise(function(_0x50e6ea,_0x17364f){return db[_0xcabd('0x19')][_0xcabd('0x1a')]({'raw':_0xa97d39[_0xcabd('0x1b')]?_0xa97d39['options'][_0xcabd('0x1c')]===undefined?!![]:![]:!![],'where':_0xa97d39['options']?_0xa97d39['options'][_0xcabd('0x1d')]||null:null,'attributes':_0xa97d39['options']?_0xa97d39[_0xcabd('0x1b')][_0xcabd('0x1e')]||null:null,'limit':_0xa97d39['options']?_0xa97d39[_0xcabd('0x1b')][_0xcabd('0x1f')]||null:null,'include':_0xa97d39[_0xcabd('0x1b')]?_0xa97d39[_0xcabd('0x1b')][_0xcabd('0x20')]?_[_0xcabd('0x21')](_0xa97d39[_0xcabd('0x1b')][_0xcabd('0x20')],function(_0x1a5843){return{'model':db[_0x1a5843[_0xcabd('0x22')]],'as':_0x1a5843['as'],'attributes':_0x1a5843[_0xcabd('0x1e')],'include':_0x1a5843[_0xcabd('0x20')]?_['map'](_0x1a5843['include'],function(_0x3250a7){return{'model':db[_0x3250a7[_0xcabd('0x22')]],'as':_0x3250a7['as'],'attributes':_0x3250a7['attributes'],'include':_0x3250a7['include']?_[_0xcabd('0x21')](_0x3250a7[_0xcabd('0x20')],function(_0x25a446){return{'model':db[_0x25a446[_0xcabd('0x22')]],'as':_0x25a446['as'],'attributes':_0x25a446[_0xcabd('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xcabd('0xe')](function(_0x375c40){logger[_0xcabd('0x15')]('GetWhatsappQueue',_0xa97d39);logger[_0xcabd('0x10')](_0xcabd('0x18'),_0xa97d39,JSON[_0xcabd('0x11')](_0x375c40));_0x50e6ea(_0x375c40);})[_0xcabd('0x17')](function(_0x2d0b8c){logger[_0xcabd('0x12')](_0xcabd('0x18'),_0x2d0b8c[_0xcabd('0x14')],_0xa97d39);_0x17364f(_0x4b8311['error'](0x1f4,_0x2d0b8c[_0xcabd('0x14')]));});});};exports[_0xcabd('0x23')]=function(_0x42779a){var _0xe42676=this;return new Promise(function(_0x3d7a46,_0x36cf20){return db[_0xcabd('0x19')][_0xcabd('0x24')]({'raw':_0x42779a['options']?_0x42779a[_0xcabd('0x1b')][_0xcabd('0x1c')]===undefined?!![]:![]:!![],'where':_0x42779a[_0xcabd('0x1b')]?_0x42779a['options'][_0xcabd('0x1d')]||null:null,'attributes':_0x42779a['options']?_0x42779a['options'][_0xcabd('0x1e')]||null:null,'include':_0x42779a[_0xcabd('0x1b')]?_0x42779a[_0xcabd('0x1b')][_0xcabd('0x20')]?_[_0xcabd('0x21')](_0x42779a[_0xcabd('0x1b')][_0xcabd('0x20')],function(_0x1876ce){return{'model':db[_0x1876ce[_0xcabd('0x22')]],'as':_0x1876ce['as'],'attributes':_0x1876ce[_0xcabd('0x1e')],'include':_0x1876ce[_0xcabd('0x20')]?_[_0xcabd('0x21')](_0x1876ce[_0xcabd('0x20')],function(_0x1cad50){return{'model':db[_0x1cad50[_0xcabd('0x22')]],'as':_0x1cad50['as'],'attributes':_0x1cad50[_0xcabd('0x1e')],'include':_0x1cad50['include']?_['map'](_0x1cad50[_0xcabd('0x20')],function(_0x3f1139){return{'model':db[_0x3f1139[_0xcabd('0x22')]],'as':_0x3f1139['as'],'attributes':_0x3f1139[_0xcabd('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xcabd('0xe')](function(_0xfa6c60){logger[_0xcabd('0x15')](_0xcabd('0x23'),_0x42779a);logger[_0xcabd('0x10')]('ShowWhatsappQueue',_0x42779a,JSON['stringify'](_0xfa6c60));_0x3d7a46(_0xfa6c60);})[_0xcabd('0x17')](function(_0x484d77){logger[_0xcabd('0x12')](_0xcabd('0x23'),_0x484d77[_0xcabd('0x14')],_0x42779a);_0x36cf20(_0xe42676['error'](0x1f4,_0x484d77[_0xcabd('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 9127317..e08a146 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 _0x72cf=['emit','removeListener','register','whatsappQueue:','./whatsappQueue.events','save','update'];(function(_0x3612c5,_0x23593e){var _0x2e6706=function(_0x33dead){while(--_0x33dead){_0x3612c5['push'](_0x3612c5['shift']());}};_0x2e6706(++_0x23593e);}(_0x72cf,0x162));var _0xf72c=function(_0x12e318,_0x191068){_0x12e318=_0x12e318-0x0;var _0x433c40=_0x72cf[_0x12e318];return _0x433c40;};'use strict';var WhatsappQueueEvents=require(_0xf72c('0x0'));var events=[_0xf72c('0x1'),'remove',_0xf72c('0x2')];function createListener(_0x229370,_0x40aed7){return function(_0x5d7aca){_0x40aed7[_0xf72c('0x3')](_0x229370,_0x5d7aca);};}function removeListener(_0x4423ba,_0x2cb549){return function(){WhatsappQueueEvents[_0xf72c('0x4')](_0x4423ba,_0x2cb549);};}exports[_0xf72c('0x5')]=function(_0x1dbf6f){for(var _0x52a151=0x0,_0x48c628=events['length'];_0x52a151<_0x48c628;_0x52a151++){var _0x5914fa=events[_0x52a151];var _0x279643=createListener(_0xf72c('0x6')+_0x5914fa,_0x1dbf6f);WhatsappQueueEvents['on'](_0x5914fa,_0x279643);}}; \ No newline at end of file +var _0x6e2a=['emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save','remove','update'];(function(_0x57eebd,_0x561057){var _0x343a79=function(_0x5e2cb4){while(--_0x5e2cb4){_0x57eebd['push'](_0x57eebd['shift']());}};_0x343a79(++_0x561057);}(_0x6e2a,0x1e2));var _0xa6e2=function(_0x2d6630,_0x45fb62){_0x2d6630=_0x2d6630-0x0;var _0x33acb2=_0x6e2a[_0x2d6630];return _0x33acb2;};'use strict';var WhatsappQueueEvents=require(_0xa6e2('0x0'));var events=[_0xa6e2('0x1'),_0xa6e2('0x2'),_0xa6e2('0x3')];function createListener(_0xb8c7a,_0x17a47b){return function(_0x36e894){_0x17a47b[_0xa6e2('0x4')](_0xb8c7a,_0x36e894);};}function removeListener(_0x1a29c7,_0x46e06c){return function(){WhatsappQueueEvents[_0xa6e2('0x5')](_0x1a29c7,_0x46e06c);};}exports[_0xa6e2('0x6')]=function(_0xe9eac8){for(var _0x5de2e6=0x0,_0x4ed51d=events[_0xa6e2('0x7')];_0x5de2e6<_0x4ed51d;_0x5de2e6++){var _0x1c21b9=events[_0x5de2e6];var _0x58cce3=createListener(_0xa6e2('0x8')+_0x1c21b9,_0xe9eac8);WhatsappQueueEvents['on'](_0x1c21b9,_0x58cce3);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 7999efa..ab221df 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 _0xb82c=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','show','put','update','exports','multer','connect-timeout','express'];(function(_0x4a42ce,_0x451cde){var _0x3f8968=function(_0x76a4c3){while(--_0x76a4c3){_0x4a42ce['push'](_0x4a42ce['shift']());}};_0x3f8968(++_0x451cde);}(_0xb82c,0x153));var _0xcb82=function(_0x577968,_0x3079a5){_0x577968=_0x577968-0x0;var _0x1d8128=_0xb82c[_0x577968];return _0x1d8128;};'use strict';var multer=require(_0xcb82('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcb82('0x1'));var express=require(_0xcb82('0x2'));var router=express[_0xcb82('0x3')]();var fs_extra=require(_0xcb82('0x4'));var auth=require(_0xcb82('0x5'));var interaction=require(_0xcb82('0x6'));var config=require(_0xcb82('0x7'));var controller=require('./whatsappQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xcb82('0x8')]);router[_0xcb82('0x9')](_0xcb82('0xa'),auth[_0xcb82('0xb')](),controller[_0xcb82('0xc')]);router[_0xcb82('0x9')](_0xcb82('0xd'),auth['isAuthenticated'](),controller[_0xcb82('0xe')]);router['post']('/',auth[_0xcb82('0xb')](),controller['create']);router[_0xcb82('0xf')](_0xcb82('0xd'),auth[_0xcb82('0xb')](),controller[_0xcb82('0x10')]);router['delete'](_0xcb82('0xd'),auth[_0xcb82('0xb')](),controller['destroy']);module[_0xcb82('0x11')]=router; \ No newline at end of file +var _0x8891=['get','describe','/:id','show','post','put','update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','isAuthenticated','index'];(function(_0x456c4f,_0x4ea98e){var _0x496d2c=function(_0x12e7d4){while(--_0x12e7d4){_0x456c4f['push'](_0x456c4f['shift']());}};_0x496d2c(++_0x4ea98e);}(_0x8891,0x119));var _0x1889=function(_0x540f3c,_0xc117d8){_0x540f3c=_0x540f3c-0x0;var _0x2c3ad3=_0x8891[_0x540f3c];return _0x2c3ad3;};'use strict';var multer=require(_0x1889('0x0'));var util=require(_0x1889('0x1'));var path=require('path');var timeout=require(_0x1889('0x2'));var express=require(_0x1889('0x3'));var router=express['Router']();var fs_extra=require(_0x1889('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1889('0x5'));var config=require('../../config/environment');var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x1889('0x6')](),controller[_0x1889('0x7')]);router[_0x1889('0x8')]('/describe',auth[_0x1889('0x6')](),controller[_0x1889('0x9')]);router[_0x1889('0x8')](_0x1889('0xa'),auth[_0x1889('0x6')](),controller[_0x1889('0xb')]);router[_0x1889('0xc')]('/',auth[_0x1889('0x6')](),controller['create']);router[_0x1889('0xd')](_0x1889('0xa'),auth[_0x1889('0x6')](),controller[_0x1889('0xe')]);router[_0x1889('0xf')]('/:id',auth[_0x1889('0x6')](),controller[_0x1889('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 246a858..b5b1bd5 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(_0x55e1c8,_0x35499f){var _0x3613d3=function(_0x582a98){while(--_0x582a98){_0x55e1c8['push'](_0x55e1c8['shift']());}};_0x3613d3(++_0x35499f);}(_0x7a54,0x106));var _0x47a5=function(_0x4bdb67,_0x1ee0eb){_0x4bdb67=_0x4bdb67-0x0;var _0x517ec1=_0x7a54[_0x4bdb67];return _0x517ec1;};'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 _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x1f7d5f,_0x28d25a){var _0xb36080=function(_0x13928b){while(--_0x13928b){_0x1f7d5f['push'](_0x1f7d5f['shift']());}};_0xb36080(++_0x28d25a);}(_0x7a54,0x106));var _0x47a5=function(_0x4f28fc,_0x1e76dc){_0x4f28fc=_0x4f28fc-0x0;var _0x184737=_0x7a54[_0x4f28fc];return _0x184737;};'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 diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 89d756a..a4ddc54 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 _0xe820=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','undefined','count','status','set','Content-Range','json','reject','save','update','then','destroy','error','name','index','WhatsappQueueReport','rawAttributes','key','map','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','params','describe','eml-format','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse'];(function(_0x2825c0,_0x442135){var _0xd518a9=function(_0x334c75){while(--_0x334c75){_0x2825c0['push'](_0x2825c0['shift']());}};_0xd518a9(++_0x442135);}(_0xe820,0xd2));var _0x0e82=function(_0x5f0ab4,_0x42945f){_0x5f0ab4=_0x5f0ab4-0x0;var _0x1915af=_0xe820[_0x5f0ab4];return _0x1915af;};'use strict';var emlformat=require(_0x0e82('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0e82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0e82('0x2'));var BPromise=require(_0x0e82('0x3'));var Mustache=require(_0x0e82('0x4'));var util=require('util');var path=require(_0x0e82('0x5'));var sox=require('sox');var csv=require(_0x0e82('0x6'));var ejs=require(_0x0e82('0x7'));var fs=require('fs');var fs_extra=require(_0x0e82('0x8'));var _=require(_0x0e82('0x9'));var squel=require(_0x0e82('0xa'));var crypto=require('crypto');var jsforce=require(_0x0e82('0xb'));var deskjs=require(_0x0e82('0xc'));var toCsv=require(_0x0e82('0x6'));var querystring=require(_0x0e82('0xd'));var Papa=require(_0x0e82('0xe'));var Redis=require('ioredis');var authService=require(_0x0e82('0xf'));var qs=require(_0x0e82('0x10'));var as=require(_0x0e82('0x11'));var hardwareService=require(_0x0e82('0x12'));var logger=require(_0x0e82('0x13'))(_0x0e82('0x14'));var utils=require(_0x0e82('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0e82('0x16'));var db=require(_0x0e82('0x17'))['db'];function respondWithStatusCode(_0x21c40b,_0x1da28a){_0x1da28a=_0x1da28a||0xcc;return function(_0x166dc2){if(_0x166dc2){return _0x21c40b[_0x0e82('0x18')](_0x1da28a);}return _0x21c40b['status'](_0x1da28a)[_0x0e82('0x19')]();};}function respondWithResult(_0x5c161c,_0x48d99b){_0x48d99b=_0x48d99b||0xc8;return function(_0x1e4ddb){if(_0x1e4ddb){return _0x5c161c['status'](_0x48d99b)['json'](_0x1e4ddb);}};}function respondWithFilteredResult(_0x5a2d28,_0x3298c7){return function(_0x4d1aa0){if(_0x4d1aa0){var _0x585b9b=typeof _0x3298c7[_0x0e82('0x1a')]==='undefined'&&typeof _0x3298c7[_0x0e82('0x1b')]===_0x0e82('0x1c');var _0x233c6d=_0x4d1aa0[_0x0e82('0x1d')];var _0x53622b=_0x585b9b?0x0:_0x3298c7[_0x0e82('0x1a')];var _0x310aac=_0x585b9b?_0x4d1aa0[_0x0e82('0x1d')]:_0x3298c7[_0x0e82('0x1a')]+_0x3298c7[_0x0e82('0x1b')];var _0x1230e6;if(_0x310aac>=_0x233c6d){_0x310aac=_0x233c6d;_0x1230e6=0xc8;}else{_0x1230e6=0xce;}_0x5a2d28[_0x0e82('0x1e')](_0x1230e6);return _0x5a2d28[_0x0e82('0x1f')](_0x0e82('0x20'),_0x53622b+'-'+_0x310aac+'/'+_0x233c6d)[_0x0e82('0x21')](_0x4d1aa0);}return null;};}function patchUpdates(_0x5903c){return function(_0x493280){try{jsonpatch['apply'](_0x493280,_0x5903c,!![]);}catch(_0x294696){return BPromise[_0x0e82('0x22')](_0x294696);}return _0x493280[_0x0e82('0x23')]();};}function saveUpdates(_0xb0a31,_0xd48046){return function(_0x1bdad4){if(_0x1bdad4){return _0x1bdad4[_0x0e82('0x24')](_0xb0a31)[_0x0e82('0x25')](function(_0x56b3ad){return _0x56b3ad;});}return null;};}function removeEntity(_0x1b71b4,_0x13f023){return function(_0x3d6c28){if(_0x3d6c28){return _0x3d6c28[_0x0e82('0x26')]()['then'](function(){_0x1b71b4[_0x0e82('0x1e')](0xcc)[_0x0e82('0x19')]();});}};}function handleEntityNotFound(_0x7a9399,_0x16e11c){return function(_0x4900d3){if(!_0x4900d3){_0x7a9399[_0x0e82('0x18')](0x194);}return _0x4900d3;};}function handleError(_0x51dbcd,_0x595319){_0x595319=_0x595319||0x1f4;return function(_0x384f88){logger[_0x0e82('0x27')](_0x384f88['stack']);if(_0x384f88[_0x0e82('0x28')]){delete _0x384f88[_0x0e82('0x28')];}_0x51dbcd[_0x0e82('0x1e')](_0x595319)['send'](_0x384f88);};}exports[_0x0e82('0x29')]=function(_0x25fa4e,_0x4ee65a){var _0xabc536={},_0x59a5b6={},_0x4300f9={'count':0x0,'rows':[]};var _0x3ec302=_['map'](db[_0x0e82('0x2a')][_0x0e82('0x2b')],function(_0x661718){return{'name':_0x661718['fieldName'],'type':_0x661718['type'][_0x0e82('0x2c')]};});_0x59a5b6['model']=_[_0x0e82('0x2d')](_0x3ec302,'name');_0x59a5b6[_0x0e82('0x2e')]=_[_0x0e82('0x2f')](_0x25fa4e[_0x0e82('0x2e')]);_0x59a5b6['filters']=_[_0x0e82('0x30')](_0x59a5b6['model'],_0x59a5b6[_0x0e82('0x2e')]);_0xabc536[_0x0e82('0x31')]=_[_0x0e82('0x30')](_0x59a5b6[_0x0e82('0x32')],qs[_0x0e82('0x33')](_0x25fa4e[_0x0e82('0x2e')]['fields']));_0xabc536[_0x0e82('0x31')]=_0xabc536[_0x0e82('0x31')][_0x0e82('0x34')]?_0xabc536[_0x0e82('0x31')]:_0x59a5b6[_0x0e82('0x32')];if(!_0x25fa4e[_0x0e82('0x2e')][_0x0e82('0x35')](_0x0e82('0x36'))){_0xabc536[_0x0e82('0x1b')]=qs[_0x0e82('0x1b')](_0x25fa4e[_0x0e82('0x2e')][_0x0e82('0x1b')]);_0xabc536[_0x0e82('0x1a')]=qs[_0x0e82('0x1a')](_0x25fa4e[_0x0e82('0x2e')]['offset']);}_0xabc536[_0x0e82('0x37')]=qs[_0x0e82('0x38')](_0x25fa4e[_0x0e82('0x2e')][_0x0e82('0x38')]);_0xabc536['where']=qs[_0x0e82('0x39')](_[_0x0e82('0x3a')](_0x25fa4e['query'],_0x59a5b6[_0x0e82('0x39')]),_0x3ec302);if(_0x25fa4e['query']['filter']){_0xabc536[_0x0e82('0x3b')]=_[_0x0e82('0x3c')](_0xabc536[_0x0e82('0x3b')],{'$or':_[_0x0e82('0x2d')](_0x3ec302,function(_0x61a5ce){if(_0x61a5ce[_0x0e82('0x3d')]!==_0x0e82('0x3e')){var _0x50fed8={};_0x50fed8[_0x61a5ce['name']]={'$like':'%'+_0x25fa4e[_0x0e82('0x2e')][_0x0e82('0x3f')]+'%'};return _0x50fed8;}})});}_0xabc536=_[_0x0e82('0x3c')]({},_0xabc536,_0x25fa4e[_0x0e82('0x40')]);var _0x265872={'where':_0xabc536[_0x0e82('0x3b')]};return db[_0x0e82('0x2a')][_0x0e82('0x1d')](_0x265872)['then'](function(_0x3ba181){_0x4300f9[_0x0e82('0x1d')]=_0x3ba181;if(_0x25fa4e[_0x0e82('0x2e')][_0x0e82('0x41')]){_0xabc536[_0x0e82('0x42')]=[{'all':!![]}];}return db[_0x0e82('0x2a')][_0x0e82('0x43')](_0xabc536);})['then'](function(_0x311cb8){_0x4300f9[_0x0e82('0x44')]=_0x311cb8;return _0x4300f9;})[_0x0e82('0x25')](respondWithFilteredResult(_0x4ee65a,_0xabc536))[_0x0e82('0x45')](handleError(_0x4ee65a,null));};exports[_0x0e82('0x46')]=function(_0x423b14,_0x453cd3){var _0x50322b={'raw':!![],'where':{'id':_0x423b14['params']['id']}},_0x581764={};_0x581764['model']=_['keys'](db['WhatsappQueueReport'][_0x0e82('0x2b')]);_0x581764[_0x0e82('0x2e')]=_[_0x0e82('0x2f')](_0x423b14[_0x0e82('0x2e')]);_0x581764[_0x0e82('0x39')]=_[_0x0e82('0x30')](_0x581764[_0x0e82('0x32')],_0x581764[_0x0e82('0x2e')]);_0x50322b['attributes']=_['intersection'](_0x581764[_0x0e82('0x32')],qs[_0x0e82('0x33')](_0x423b14[_0x0e82('0x2e')][_0x0e82('0x33')]));_0x50322b[_0x0e82('0x31')]=_0x50322b[_0x0e82('0x31')][_0x0e82('0x34')]?_0x50322b[_0x0e82('0x31')]:_0x581764['model'];if(_0x423b14[_0x0e82('0x2e')]['includeAll']){_0x50322b[_0x0e82('0x42')]=[{'all':!![]}];}_0x50322b=_['merge']({},_0x50322b,_0x423b14[_0x0e82('0x40')]);return db['WhatsappQueueReport'][_0x0e82('0x47')](_0x50322b)[_0x0e82('0x25')](handleEntityNotFound(_0x453cd3,null))[_0x0e82('0x25')](respondWithResult(_0x453cd3,null))['catch'](handleError(_0x453cd3,null));};exports['create']=function(_0x331668,_0x132c45){return db[_0x0e82('0x2a')]['create'](_0x331668[_0x0e82('0x48')],{})['then'](respondWithResult(_0x132c45,0xc9))[_0x0e82('0x45')](handleError(_0x132c45,null));};exports[_0x0e82('0x24')]=function(_0x162890,_0x64406e){if(_0x162890[_0x0e82('0x48')]['id']){delete _0x162890[_0x0e82('0x48')]['id'];}return db[_0x0e82('0x2a')][_0x0e82('0x47')]({'where':{'id':_0x162890[_0x0e82('0x49')]['id']}})[_0x0e82('0x25')](handleEntityNotFound(_0x64406e,null))[_0x0e82('0x25')](saveUpdates(_0x162890[_0x0e82('0x48')],null))['then'](respondWithResult(_0x64406e,null))[_0x0e82('0x45')](handleError(_0x64406e,null));};exports[_0x0e82('0x26')]=function(_0x576726,_0x360858){return db['WhatsappQueueReport']['find']({'where':{'id':_0x576726[_0x0e82('0x49')]['id']}})['then'](handleEntityNotFound(_0x360858,null))[_0x0e82('0x25')](removeEntity(_0x360858,null))[_0x0e82('0x45')](handleError(_0x360858,null));};exports[_0x0e82('0x4a')]=function(_0x149100,_0xdbb813){return db['WhatsappQueueReport'][_0x0e82('0x4a')]()['then'](respondWithResult(_0xdbb813,null))[_0x0e82('0x45')](handleError(_0xdbb813,null));}; \ No newline at end of file +var _0x1d2d=['options','WhatsappQueueReport','includeAll','findAll','catch','show','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge'];(function(_0x459f0f,_0xfd5405){var _0x2f5992=function(_0x31948f){while(--_0x31948f){_0x459f0f['push'](_0x459f0f['shift']());}};_0x2f5992(++_0xfd5405);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x4874ef,_0x597486){_0x4874ef=_0x4874ef-0x0;var _0x28b1f0=_0x1d2d[_0x4874ef];return _0x28b1f0;};'use strict';var emlformat=require(_0xd1d2('0x0'));var rimraf=require(_0xd1d2('0x1'));var zipdir=require(_0xd1d2('0x2'));var jsonpatch=require(_0xd1d2('0x3'));var rp=require(_0xd1d2('0x4'));var moment=require('moment');var BPromise=require(_0xd1d2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd1d2('0x6'));var sox=require(_0xd1d2('0x7'));var csv=require(_0xd1d2('0x8'));var ejs=require(_0xd1d2('0x9'));var fs=require('fs');var fs_extra=require(_0xd1d2('0xa'));var _=require(_0xd1d2('0xb'));var squel=require('squel');var crypto=require(_0xd1d2('0xc'));var jsforce=require(_0xd1d2('0xd'));var deskjs=require(_0xd1d2('0xe'));var toCsv=require(_0xd1d2('0x8'));var querystring=require(_0xd1d2('0xf'));var Papa=require(_0xd1d2('0x10'));var Redis=require(_0xd1d2('0x11'));var authService=require(_0xd1d2('0x12'));var qs=require(_0xd1d2('0x13'));var as=require(_0xd1d2('0x14'));var hardwareService=require(_0xd1d2('0x15'));var logger=require(_0xd1d2('0x16'))(_0xd1d2('0x17'));var utils=require('../../config/utils');var config=require(_0xd1d2('0x18'));var licenseUtil=require(_0xd1d2('0x19'));var db=require(_0xd1d2('0x1a'))['db'];function respondWithStatusCode(_0x33f088,_0x129d8f){_0x129d8f=_0x129d8f||0xcc;return function(_0xc3ee82){if(_0xc3ee82){return _0x33f088[_0xd1d2('0x1b')](_0x129d8f);}return _0x33f088[_0xd1d2('0x1c')](_0x129d8f)[_0xd1d2('0x1d')]();};}function respondWithResult(_0x3f670f,_0x4cf702){_0x4cf702=_0x4cf702||0xc8;return function(_0x2e7fec){if(_0x2e7fec){return _0x3f670f[_0xd1d2('0x1c')](_0x4cf702)[_0xd1d2('0x1e')](_0x2e7fec);}};}function respondWithFilteredResult(_0x56de25,_0x35381b){return function(_0xc36ce){if(_0xc36ce){var _0x208425=typeof _0x35381b[_0xd1d2('0x1f')]===_0xd1d2('0x20')&&typeof _0x35381b[_0xd1d2('0x21')]===_0xd1d2('0x20');var _0x57f2f9=_0xc36ce['count'];var _0x3be186=_0x208425?0x0:_0x35381b['offset'];var _0x247b3a=_0x208425?_0xc36ce[_0xd1d2('0x22')]:_0x35381b[_0xd1d2('0x1f')]+_0x35381b[_0xd1d2('0x21')];var _0x4ab386;if(_0x247b3a>=_0x57f2f9){_0x247b3a=_0x57f2f9;_0x4ab386=0xc8;}else{_0x4ab386=0xce;}_0x56de25['status'](_0x4ab386);return _0x56de25[_0xd1d2('0x23')]('Content-Range',_0x3be186+'-'+_0x247b3a+'/'+_0x57f2f9)['json'](_0xc36ce);}return null;};}function patchUpdates(_0x1ab67c){return function(_0x27e26b){try{jsonpatch[_0xd1d2('0x24')](_0x27e26b,_0x1ab67c,!![]);}catch(_0x40170b){return BPromise['reject'](_0x40170b);}return _0x27e26b[_0xd1d2('0x25')]();};}function saveUpdates(_0xbb4d27,_0x24b8db){return function(_0x4eb082){if(_0x4eb082){return _0x4eb082['update'](_0xbb4d27)[_0xd1d2('0x26')](function(_0x3a1078){return _0x3a1078;});}return null;};}function removeEntity(_0x19d535,_0x2f92ee){return function(_0x3f229c){if(_0x3f229c){return _0x3f229c[_0xd1d2('0x27')]()[_0xd1d2('0x26')](function(){_0x19d535['status'](0xcc)[_0xd1d2('0x1d')]();});}};}function handleEntityNotFound(_0x42da6d,_0x41330f){return function(_0x2e1709){if(!_0x2e1709){_0x42da6d[_0xd1d2('0x1b')](0x194);}return _0x2e1709;};}function handleError(_0x39e991,_0x28b8be){_0x28b8be=_0x28b8be||0x1f4;return function(_0x34faf7){logger[_0xd1d2('0x28')](_0x34faf7[_0xd1d2('0x29')]);if(_0x34faf7[_0xd1d2('0x2a')]){delete _0x34faf7['name'];}_0x39e991['status'](_0x28b8be)[_0xd1d2('0x2b')](_0x34faf7);};}exports[_0xd1d2('0x2c')]=function(_0x1e6072,_0x2b4c1f){var _0xc815ea={},_0x48ade1={},_0x39d694={'count':0x0,'rows':[]};var _0x41171c=_[_0xd1d2('0x2d')](db['WhatsappQueueReport'][_0xd1d2('0x2e')],function(_0x1db17f){return{'name':_0x1db17f[_0xd1d2('0x2f')],'type':_0x1db17f['type'][_0xd1d2('0x30')]};});_0x48ade1[_0xd1d2('0x31')]=_[_0xd1d2('0x2d')](_0x41171c,_0xd1d2('0x2a'));_0x48ade1[_0xd1d2('0x32')]=_[_0xd1d2('0x33')](_0x1e6072[_0xd1d2('0x32')]);_0x48ade1[_0xd1d2('0x34')]=_[_0xd1d2('0x35')](_0x48ade1[_0xd1d2('0x31')],_0x48ade1[_0xd1d2('0x32')]);_0xc815ea[_0xd1d2('0x36')]=_[_0xd1d2('0x35')](_0x48ade1[_0xd1d2('0x31')],qs[_0xd1d2('0x37')](_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x37')]));_0xc815ea[_0xd1d2('0x36')]=_0xc815ea['attributes'][_0xd1d2('0x38')]?_0xc815ea[_0xd1d2('0x36')]:_0x48ade1[_0xd1d2('0x31')];if(!_0x1e6072['query'][_0xd1d2('0x39')]('nolimit')){_0xc815ea['limit']=qs[_0xd1d2('0x21')](_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x21')]);_0xc815ea[_0xd1d2('0x1f')]=qs[_0xd1d2('0x1f')](_0x1e6072[_0xd1d2('0x32')]['offset']);}_0xc815ea[_0xd1d2('0x3a')]=qs[_0xd1d2('0x3b')](_0x1e6072['query'][_0xd1d2('0x3b')]);_0xc815ea[_0xd1d2('0x3c')]=qs[_0xd1d2('0x34')](_[_0xd1d2('0x3d')](_0x1e6072['query'],_0x48ade1['filters']),_0x41171c);if(_0x1e6072[_0xd1d2('0x32')]['filter']){_0xc815ea['where']=_['merge'](_0xc815ea[_0xd1d2('0x3c')],{'$or':_['map'](_0x41171c,function(_0x3f4fd7){if(_0x3f4fd7['type']!=='VIRTUAL'){var _0x4bcea4={};_0x4bcea4[_0x3f4fd7[_0xd1d2('0x2a')]]={'$like':'%'+_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x3e')]+'%'};return _0x4bcea4;}})});}_0xc815ea=_[_0xd1d2('0x3f')]({},_0xc815ea,_0x1e6072[_0xd1d2('0x40')]);var _0xb5bec2={'where':_0xc815ea[_0xd1d2('0x3c')]};return db[_0xd1d2('0x41')][_0xd1d2('0x22')](_0xb5bec2)[_0xd1d2('0x26')](function(_0x2cedb4){_0x39d694[_0xd1d2('0x22')]=_0x2cedb4;if(_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x42')]){_0xc815ea['include']=[{'all':!![]}];}return db['WhatsappQueueReport'][_0xd1d2('0x43')](_0xc815ea);})[_0xd1d2('0x26')](function(_0x24fc93){_0x39d694['rows']=_0x24fc93;return _0x39d694;})['then'](respondWithFilteredResult(_0x2b4c1f,_0xc815ea))[_0xd1d2('0x44')](handleError(_0x2b4c1f,null));};exports[_0xd1d2('0x45')]=function(_0x4dc730,_0x2fe92a){var _0x4c5d49={'raw':!![],'where':{'id':_0x4dc730[_0xd1d2('0x46')]['id']}},_0x5a3790={};_0x5a3790['model']=_['keys'](db[_0xd1d2('0x41')][_0xd1d2('0x2e')]);_0x5a3790[_0xd1d2('0x32')]=_['keys'](_0x4dc730[_0xd1d2('0x32')]);_0x5a3790[_0xd1d2('0x34')]=_[_0xd1d2('0x35')](_0x5a3790[_0xd1d2('0x31')],_0x5a3790['query']);_0x4c5d49[_0xd1d2('0x36')]=_[_0xd1d2('0x35')](_0x5a3790['model'],qs[_0xd1d2('0x37')](_0x4dc730['query'][_0xd1d2('0x37')]));_0x4c5d49[_0xd1d2('0x36')]=_0x4c5d49[_0xd1d2('0x36')][_0xd1d2('0x38')]?_0x4c5d49[_0xd1d2('0x36')]:_0x5a3790['model'];if(_0x4dc730['query'][_0xd1d2('0x42')]){_0x4c5d49[_0xd1d2('0x47')]=[{'all':!![]}];}_0x4c5d49=_['merge']({},_0x4c5d49,_0x4dc730[_0xd1d2('0x40')]);return db[_0xd1d2('0x41')][_0xd1d2('0x48')](_0x4c5d49)[_0xd1d2('0x26')](handleEntityNotFound(_0x2fe92a,null))[_0xd1d2('0x26')](respondWithResult(_0x2fe92a,null))[_0xd1d2('0x44')](handleError(_0x2fe92a,null));};exports[_0xd1d2('0x49')]=function(_0x57c668,_0xed9e9){return db[_0xd1d2('0x41')]['create'](_0x57c668[_0xd1d2('0x4a')],{})[_0xd1d2('0x26')](respondWithResult(_0xed9e9,0xc9))['catch'](handleError(_0xed9e9,null));};exports['update']=function(_0x3d4fe3,_0x182ea8){if(_0x3d4fe3['body']['id']){delete _0x3d4fe3[_0xd1d2('0x4a')]['id'];}return db[_0xd1d2('0x41')][_0xd1d2('0x48')]({'where':{'id':_0x3d4fe3[_0xd1d2('0x46')]['id']}})[_0xd1d2('0x26')](handleEntityNotFound(_0x182ea8,null))['then'](saveUpdates(_0x3d4fe3['body'],null))[_0xd1d2('0x26')](respondWithResult(_0x182ea8,null))['catch'](handleError(_0x182ea8,null));};exports[_0xd1d2('0x27')]=function(_0xcd4b70,_0x4f4cb9){return db[_0xd1d2('0x41')][_0xd1d2('0x48')]({'where':{'id':_0xcd4b70['params']['id']}})['then'](handleEntityNotFound(_0x4f4cb9,null))[_0xd1d2('0x26')](removeEntity(_0x4f4cb9,null))[_0xd1d2('0x44')](handleError(_0x4f4cb9,null));};exports[_0xd1d2('0x4b')]=function(_0xfd8024,_0xa013ce){return db[_0xd1d2('0x41')][_0xd1d2('0x4b')]()[_0xd1d2('0x26')](respondWithResult(_0xa013ce,null))[_0xd1d2('0x44')](handleError(_0xa013ce,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 955f91e..1b0d989 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 _0x0b88=['report_whatsapp_queue','uniqueid','api','moment','bluebird','rimraf','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport'];(function(_0xfbd165,_0x1e8c53){var _0x9414d4=function(_0xb57fca){while(--_0xb57fca){_0xfbd165['push'](_0xfbd165['shift']());}};_0x9414d4(++_0x1e8c53);}(_0x0b88,0x1ba));var _0x80b8=function(_0x4e126b,_0x3aa531){_0x4e126b=_0x4e126b-0x0;var _0x55ef4=_0x0b88[_0x4e126b];return _0x55ef4;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x80b8('0x0'));var moment=require(_0x80b8('0x1'));var BPromise=require(_0x80b8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x80b8('0x3'));var config=require('../../config/environment');var attributes=require(_0x80b8('0x4'));module[_0x80b8('0x5')]=function(_0x5440bc,_0xbada85){return _0x5440bc[_0x80b8('0x6')](_0x80b8('0x7'),attributes,{'tableName':_0x80b8('0x8'),'paranoid':![],'indexes':[{'name':_0x80b8('0x9'),'fields':[_0x80b8('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3b5c=['define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','api','moment','rimraf','./whatsappQueueReport.attributes','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3b5c,0x1ee));var _0xc3b5=function(_0x213a7d,_0x5367d7){_0x213a7d=_0x213a7d-0x0;var _0x30400b=_0x3b5c[_0x213a7d];return _0x30400b;};'use strict';var _=require(_0xc3b5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc3b5('0x1'));var moment=require(_0xc3b5('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc3b5('0x3'));var config=require('../../config/environment');var attributes=require(_0xc3b5('0x4'));module[_0xc3b5('0x5')]=function(_0x282b15,_0x4939db){return _0x282b15[_0xc3b5('0x6')](_0xc3b5('0x7'),attributes,{'tableName':_0xc3b5('0x8'),'paranoid':![],'indexes':[{'name':_0xc3b5('0x9'),'fields':[_0xc3b5('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index e9a7613..9c878af 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 _0x3a41=['create','body','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','attributes','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','then','info','request\x20sent','debug','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','catch','WhatsappQueueReport'];(function(_0x57421c,_0x49c6b3){var _0x129674=function(_0x1d4413){while(--_0x1d4413){_0x57421c['push'](_0x57421c['shift']());}};_0x129674(++_0x49c6b3);}(_0x3a41,0x8f));var _0x13a4=function(_0x64edb0,_0x4dd13c){_0x64edb0=_0x64edb0-0x0;var _0x580a4b=_0x3a41[_0x64edb0];return _0x580a4b;};'use strict';var _=require('lodash');var util=require(_0x13a4('0x0'));var moment=require('moment');var BPromise=require(_0x13a4('0x1'));var rs=require(_0x13a4('0x2'));var fs=require('fs');var Redis=require(_0x13a4('0x3'));var db=require(_0x13a4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x13a4('0x5'))('rpc');var config=require(_0x13a4('0x6'));var jayson=require(_0x13a4('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x50f130,_0x37ad0c,_0x4f9f64){return new BPromise(function(_0x23a6ae,_0x15fab8){return client['request'](_0x50f130,_0x4f9f64)[_0x13a4('0x8')](function(_0x479ce1){logger[_0x13a4('0x9')]('WhatsappQueueReport,\x20%s,\x20%s',_0x37ad0c,_0x13a4('0xa'));logger[_0x13a4('0xb')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x37ad0c,_0x13a4('0xa'),JSON[_0x13a4('0xc')](_0x479ce1));if(_0x479ce1[_0x13a4('0xd')]){if(_0x479ce1[_0x13a4('0xd')][_0x13a4('0xe')]===0x1f4){logger[_0x13a4('0xd')](_0x13a4('0xf'),_0x37ad0c,_0x479ce1[_0x13a4('0xd')][_0x13a4('0x10')]);return _0x15fab8(_0x479ce1[_0x13a4('0xd')][_0x13a4('0x10')]);}logger[_0x13a4('0xd')](_0x13a4('0xf'),_0x37ad0c,_0x479ce1['error'][_0x13a4('0x10')]);return _0x23a6ae(_0x479ce1[_0x13a4('0xd')][_0x13a4('0x10')]);}else{logger[_0x13a4('0x9')](_0x13a4('0xf'),_0x37ad0c,_0x13a4('0xa'));_0x23a6ae(_0x479ce1['result'][_0x13a4('0x10')]);}})[_0x13a4('0x11')](function(_0x4c8bf0){logger[_0x13a4('0xd')](_0x13a4('0xf'),_0x37ad0c,_0x4c8bf0);_0x15fab8(_0x4c8bf0);});});}exports['CreateWhatsappQueueReport']=function(_0x3f9b37){var _0x41caf4=this;return new Promise(function(_0x1657d8,_0x322cda){return db[_0x13a4('0x12')][_0x13a4('0x13')](_0x3f9b37[_0x13a4('0x14')],{'raw':_0x3f9b37[_0x13a4('0x15')]?_0x3f9b37[_0x13a4('0x15')][_0x13a4('0x16')]===undefined?!![]:![]:!![]})[_0x13a4('0x8')](function(_0x502810){logger['info']('CreateWhatsappQueueReport',_0x3f9b37);logger['debug']('CreateWhatsappQueueReport',_0x3f9b37,JSON[_0x13a4('0xc')](_0x502810));_0x1657d8(_0x502810);})[_0x13a4('0x11')](function(_0x397e63){logger[_0x13a4('0xd')](_0x13a4('0x17'),_0x397e63[_0x13a4('0x10')],_0x3f9b37);_0x322cda(_0x41caf4[_0x13a4('0xd')](0x1f4,_0x397e63[_0x13a4('0x10')]));});});};exports[_0x13a4('0x18')]=function(_0x4e551e){var _0x30eb63=this;return new Promise(function(_0x4f6b54,_0x34f264){return db[_0x13a4('0x12')][_0x13a4('0x19')](_0x4e551e[_0x13a4('0x14')],{'raw':_0x4e551e['options']?_0x4e551e['options'][_0x13a4('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e551e[_0x13a4('0x15')]?_0x4e551e[_0x13a4('0x15')]['where']||null:null,'attributes':_0x4e551e['options']?_0x4e551e[_0x13a4('0x15')][_0x13a4('0x1a')]||null:null,'limit':_0x4e551e[_0x13a4('0x15')]?_0x4e551e[_0x13a4('0x15')]['limit']||null:null})[_0x13a4('0x8')](function(_0x1fff3b){logger[_0x13a4('0x9')](_0x13a4('0x18'),_0x4e551e);logger['debug']('UpdateWhatsappQueueReport',_0x4e551e,JSON['stringify'](_0x1fff3b));_0x4f6b54(_0x1fff3b);})[_0x13a4('0x11')](function(_0x49ef05){logger['error'](_0x13a4('0x18'),_0x49ef05[_0x13a4('0x10')],_0x4e551e);_0x34f264(_0x30eb63[_0x13a4('0xd')](0x1f4,_0x49ef05[_0x13a4('0x10')]));});});}; \ No newline at end of file +var _0xb708=['where','attributes','limit','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','raw','then','debug','stringify','UpdateWhatsappQueueReport','update','options'];(function(_0x2bed49,_0x227cc7){var _0x1d00fc=function(_0x373c75){while(--_0x373c75){_0x2bed49['push'](_0x2bed49['shift']());}};_0x1d00fc(++_0x227cc7);}(_0xb708,0x9e));var _0x8b70=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xb708[_0x1e7b16];return _0x37fadc;};'use strict';var _=require('lodash');var util=require(_0x8b70('0x0'));var moment=require(_0x8b70('0x1'));var BPromise=require('bluebird');var rs=require(_0x8b70('0x2'));var fs=require('fs');var Redis=require(_0x8b70('0x3'));var db=require(_0x8b70('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b70('0x5'))(_0x8b70('0x6'));var config=require('../../config/environment');var jayson=require(_0x8b70('0x7'));var client=jayson['client'][_0x8b70('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c0e91,_0x4ed29e,_0x5992c0){return new BPromise(function(_0xce6ff4,_0x1df2b2){return client[_0x8b70('0x9')](_0x4c0e91,_0x5992c0)['then'](function(_0x1d759e){logger[_0x8b70('0xa')](_0x8b70('0xb'),_0x4ed29e,_0x8b70('0xc'));logger['debug'](_0x8b70('0xd'),_0x4ed29e,_0x8b70('0xc'),JSON['stringify'](_0x1d759e));if(_0x1d759e[_0x8b70('0xe')]){if(_0x1d759e[_0x8b70('0xe')]['code']===0x1f4){logger[_0x8b70('0xe')](_0x8b70('0xb'),_0x4ed29e,_0x1d759e[_0x8b70('0xe')]['message']);return _0x1df2b2(_0x1d759e[_0x8b70('0xe')][_0x8b70('0xf')]);}logger[_0x8b70('0xe')](_0x8b70('0xb'),_0x4ed29e,_0x1d759e[_0x8b70('0xe')][_0x8b70('0xf')]);return _0xce6ff4(_0x1d759e[_0x8b70('0xe')][_0x8b70('0xf')]);}else{logger[_0x8b70('0xa')](_0x8b70('0xb'),_0x4ed29e,_0x8b70('0xc'));_0xce6ff4(_0x1d759e['result']['message']);}})[_0x8b70('0x10')](function(_0x1556e8){logger[_0x8b70('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4ed29e,_0x1556e8);_0x1df2b2(_0x1556e8);});});}exports[_0x8b70('0x11')]=function(_0x3bf25e){var _0x5157b7=this;return new Promise(function(_0x5f347c,_0x51ee75){return db[_0x8b70('0x12')][_0x8b70('0x13')](_0x3bf25e[_0x8b70('0x14')],{'raw':_0x3bf25e['options']?_0x3bf25e['options'][_0x8b70('0x15')]===undefined?!![]:![]:!![]})[_0x8b70('0x16')](function(_0x26aaa4){logger[_0x8b70('0xa')](_0x8b70('0x11'),_0x3bf25e);logger[_0x8b70('0x17')]('CreateWhatsappQueueReport',_0x3bf25e,JSON[_0x8b70('0x18')](_0x26aaa4));_0x5f347c(_0x26aaa4);})[_0x8b70('0x10')](function(_0x2eb2d0){logger['error']('CreateWhatsappQueueReport',_0x2eb2d0[_0x8b70('0xf')],_0x3bf25e);_0x51ee75(_0x5157b7[_0x8b70('0xe')](0x1f4,_0x2eb2d0[_0x8b70('0xf')]));});});};exports[_0x8b70('0x19')]=function(_0x538eee){var _0x24cf6c=this;return new Promise(function(_0x522285,_0x5f36a){return db[_0x8b70('0x12')][_0x8b70('0x1a')](_0x538eee[_0x8b70('0x14')],{'raw':_0x538eee['options']?_0x538eee['options'][_0x8b70('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x538eee[_0x8b70('0x1b')]?_0x538eee[_0x8b70('0x1b')][_0x8b70('0x1c')]||null:null,'attributes':_0x538eee[_0x8b70('0x1b')]?_0x538eee[_0x8b70('0x1b')][_0x8b70('0x1d')]||null:null,'limit':_0x538eee[_0x8b70('0x1b')]?_0x538eee['options'][_0x8b70('0x1e')]||null:null})[_0x8b70('0x16')](function(_0x53cedd){logger[_0x8b70('0xa')](_0x8b70('0x19'),_0x538eee);logger['debug'](_0x8b70('0x19'),_0x538eee,JSON[_0x8b70('0x18')](_0x53cedd));_0x522285(_0x53cedd);})[_0x8b70('0x10')](function(_0x139c9a){logger[_0x8b70('0xe')](_0x8b70('0x19'),_0x139c9a[_0x8b70('0xf')],_0x538eee);_0x5f36a(_0x24cf6c[_0x8b70('0xe')](0x1f4,_0x139c9a[_0x8b70('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index be85b19..28a1ad6 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 _0xd124=['describe','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x324648,_0x27149e){var _0x304041=function(_0x4fd9b6){while(--_0x4fd9b6){_0x324648['push'](_0x324648['shift']());}};_0x304041(++_0x27149e);}(_0xd124,0x14b));var _0x4d12=function(_0x4d8dcc,_0x36d964){_0x4d8dcc=_0x4d8dcc-0x0;var _0x1cf65b=_0xd124[_0x4d8dcc];return _0x1cf65b;};'use strict';var multer=require(_0x4d12('0x0'));var util=require(_0x4d12('0x1'));var path=require(_0x4d12('0x2'));var timeout=require(_0x4d12('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4d12('0x4'));var config=require(_0x4d12('0x5'));var controller=require(_0x4d12('0x6'));router[_0x4d12('0x7')]('/',auth[_0x4d12('0x8')](),controller[_0x4d12('0x9')]);router[_0x4d12('0x7')](_0x4d12('0xa'),auth[_0x4d12('0x8')](),controller[_0x4d12('0xb')]);router['get'](_0x4d12('0xc'),auth[_0x4d12('0x8')](),controller[_0x4d12('0xd')]);router[_0x4d12('0xe')]('/',auth[_0x4d12('0x8')](),controller[_0x4d12('0xf')]);router['put']('/:id',auth[_0x4d12('0x8')](),controller['update']);router[_0x4d12('0x10')]('/:id',auth[_0x4d12('0x8')](),controller[_0x4d12('0x11')]);module[_0x4d12('0x12')]=router; \ No newline at end of file +var _0xe61b=['Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','post','put','exports','multer','util','path','connect-timeout','express'];(function(_0x2250da,_0xdb9fe6){var _0x573dc5=function(_0x3f397a){while(--_0x3f397a){_0x2250da['push'](_0x2250da['shift']());}};_0x573dc5(++_0xdb9fe6);}(_0xe61b,0x1cb));var _0xbe61=function(_0x2c534a,_0x18a19e){_0x2c534a=_0x2c534a-0x0;var _0x3f5c99=_0xe61b[_0x2c534a];return _0x3f5c99;};'use strict';var multer=require(_0xbe61('0x0'));var util=require(_0xbe61('0x1'));var path=require(_0xbe61('0x2'));var timeout=require(_0xbe61('0x3'));var express=require(_0xbe61('0x4'));var router=express[_0xbe61('0x5')]();var fs_extra=require(_0xbe61('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbe61('0x7'));var controller=require('./whatsappTransferReport.controller');router[_0xbe61('0x8')]('/',auth[_0xbe61('0x9')](),controller[_0xbe61('0xa')]);router[_0xbe61('0x8')](_0xbe61('0xb'),auth[_0xbe61('0x9')](),controller['describe']);router[_0xbe61('0x8')](_0xbe61('0xc'),auth[_0xbe61('0x9')](),controller['show']);router[_0xbe61('0xd')]('/',auth[_0xbe61('0x9')](),controller['create']);router[_0xbe61('0xe')](_0xbe61('0xc'),auth[_0xbe61('0x9')](),controller['update']);router['delete'](_0xbe61('0xc'),auth[_0xbe61('0x9')](),controller['destroy']);module[_0xbe61('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 09b8aeb..47adc0e 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 _0x6b72=['ENUM','agent','queue','sequelize','STRING'];(function(_0x366217,_0x42d2b7){var _0x398346=function(_0x35c910){while(--_0x35c910){_0x366217['push'](_0x366217['shift']());}};_0x398346(++_0x42d2b7);}(_0x6b72,0x19d));var _0x26b7=function(_0x5e897b,_0x349df5){_0x5e897b=_0x5e897b-0x0;var _0x507d2c=_0x6b72[_0x5e897b];return _0x507d2c;};'use strict';var Sequelize=require(_0x26b7('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x26b7('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x26b7('0x2')]('account',_0x26b7('0x3'),_0x26b7('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x3609=['STRING','ENUM','account','agent','queue','sequelize','exports'];(function(_0x2f78cb,_0x3bd916){var _0x16d1d7=function(_0x215f90){while(--_0x215f90){_0x2f78cb['push'](_0x2f78cb['shift']());}};_0x16d1d7(++_0x3bd916);}(_0x3609,0x101));var _0x9360=function(_0x16c56f,_0x2b6967){_0x16c56f=_0x16c56f-0x0;var _0x105697=_0x3609[_0x16c56f];return _0x105697;};'use strict';var Sequelize=require(_0x9360('0x0'));module[_0x9360('0x1')]={'uniqueid':{'type':Sequelize[_0x9360('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9360('0x3')](_0x9360('0x4'),_0x9360('0x5'),_0x9360('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 563524e..8ee5328 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 _0xa770=['update','then','destroy','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','keys','length','catch','create','body','find','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save'];(function(_0xc0100a,_0x50a006){var _0x150057=function(_0x45d31a){while(--_0x45d31a){_0xc0100a['push'](_0xc0100a['shift']());}};_0x150057(++_0x50a006);}(_0xa770,0xc6));var _0x0a77=function(_0x495b1b,_0x45c6c8){_0x495b1b=_0x495b1b-0x0;var _0x4172f4=_0xa770[_0x495b1b];return _0x4172f4;};'use strict';var emlformat=require(_0x0a77('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0a77('0x1'));var jsonpatch=require(_0x0a77('0x2'));var rp=require(_0x0a77('0x3'));var moment=require(_0x0a77('0x4'));var BPromise=require(_0x0a77('0x5'));var Mustache=require(_0x0a77('0x6'));var util=require('util');var path=require(_0x0a77('0x7'));var sox=require(_0x0a77('0x8'));var csv=require(_0x0a77('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a77('0xa'));var _=require(_0x0a77('0xb'));var squel=require(_0x0a77('0xc'));var crypto=require(_0x0a77('0xd'));var jsforce=require(_0x0a77('0xe'));var deskjs=require(_0x0a77('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0a77('0x10'));var Papa=require(_0x0a77('0x11'));var Redis=require(_0x0a77('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0a77('0x13'));var as=require(_0x0a77('0x14'));var hardwareService=require(_0x0a77('0x15'));var logger=require(_0x0a77('0x16'))('api');var utils=require(_0x0a77('0x17'));var config=require(_0x0a77('0x18'));var licenseUtil=require(_0x0a77('0x19'));var db=require(_0x0a77('0x1a'))['db'];function respondWithStatusCode(_0x21ee75,_0x1c13bb){_0x1c13bb=_0x1c13bb||0xcc;return function(_0xa155af){if(_0xa155af){return _0x21ee75[_0x0a77('0x1b')](_0x1c13bb);}return _0x21ee75[_0x0a77('0x1c')](_0x1c13bb)[_0x0a77('0x1d')]();};}function respondWithResult(_0x281516,_0x45553b){_0x45553b=_0x45553b||0xc8;return function(_0x37ca79){if(_0x37ca79){return _0x281516[_0x0a77('0x1c')](_0x45553b)[_0x0a77('0x1e')](_0x37ca79);}};}function respondWithFilteredResult(_0x244713,_0x1b55bc){return function(_0x2c2273){if(_0x2c2273){var _0x45e28b=typeof _0x1b55bc[_0x0a77('0x1f')]===_0x0a77('0x20')&&typeof _0x1b55bc[_0x0a77('0x21')]==='undefined';var _0x19c16c=_0x2c2273[_0x0a77('0x22')];var _0xec125d=_0x45e28b?0x0:_0x1b55bc[_0x0a77('0x1f')];var _0x539921=_0x45e28b?_0x2c2273[_0x0a77('0x22')]:_0x1b55bc['offset']+_0x1b55bc[_0x0a77('0x21')];var _0x18074a;if(_0x539921>=_0x19c16c){_0x539921=_0x19c16c;_0x18074a=0xc8;}else{_0x18074a=0xce;}_0x244713[_0x0a77('0x1c')](_0x18074a);return _0x244713[_0x0a77('0x23')](_0x0a77('0x24'),_0xec125d+'-'+_0x539921+'/'+_0x19c16c)[_0x0a77('0x1e')](_0x2c2273);}return null;};}function patchUpdates(_0x4703e7){return function(_0x4bc201){try{jsonpatch[_0x0a77('0x25')](_0x4bc201,_0x4703e7,!![]);}catch(_0x1b117e){return BPromise['reject'](_0x1b117e);}return _0x4bc201[_0x0a77('0x26')]();};}function saveUpdates(_0x3d9705,_0x8b02f8){return function(_0x43b01f){if(_0x43b01f){return _0x43b01f[_0x0a77('0x27')](_0x3d9705)[_0x0a77('0x28')](function(_0x1aa35d){return _0x1aa35d;});}return null;};}function removeEntity(_0x563ab3,_0x3ca57d){return function(_0x107c84){if(_0x107c84){return _0x107c84[_0x0a77('0x29')]()['then'](function(){_0x563ab3[_0x0a77('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31143d,_0x21ad75){return function(_0x2e1ee8){if(!_0x2e1ee8){_0x31143d[_0x0a77('0x1b')](0x194);}return _0x2e1ee8;};}function handleError(_0x40afc5,_0x4c362a){_0x4c362a=_0x4c362a||0x1f4;return function(_0x53262a){logger[_0x0a77('0x2a')](_0x53262a[_0x0a77('0x2b')]);if(_0x53262a[_0x0a77('0x2c')]){delete _0x53262a[_0x0a77('0x2c')];}_0x40afc5['status'](_0x4c362a)[_0x0a77('0x2d')](_0x53262a);};}exports[_0x0a77('0x2e')]=function(_0x1bfcc9,_0x274c74){var _0x1ce2a4={},_0x54d5f6={},_0x111f6d={'count':0x0,'rows':[]};var _0xbb7403=_[_0x0a77('0x2f')](db[_0x0a77('0x30')][_0x0a77('0x31')],function(_0x1fcb67){return{'name':_0x1fcb67[_0x0a77('0x32')],'type':_0x1fcb67['type'][_0x0a77('0x33')]};});_0x54d5f6[_0x0a77('0x34')]=_['map'](_0xbb7403,_0x0a77('0x2c'));_0x54d5f6[_0x0a77('0x35')]=_['keys'](_0x1bfcc9[_0x0a77('0x35')]);_0x54d5f6[_0x0a77('0x36')]=_[_0x0a77('0x37')](_0x54d5f6[_0x0a77('0x34')],_0x54d5f6['query']);_0x1ce2a4[_0x0a77('0x38')]=_[_0x0a77('0x37')](_0x54d5f6[_0x0a77('0x34')],qs[_0x0a77('0x39')](_0x1bfcc9[_0x0a77('0x35')]['fields']));_0x1ce2a4['attributes']=_0x1ce2a4[_0x0a77('0x38')]['length']?_0x1ce2a4[_0x0a77('0x38')]:_0x54d5f6[_0x0a77('0x34')];if(!_0x1bfcc9['query']['hasOwnProperty'](_0x0a77('0x3a'))){_0x1ce2a4[_0x0a77('0x21')]=qs[_0x0a77('0x21')](_0x1bfcc9[_0x0a77('0x35')][_0x0a77('0x21')]);_0x1ce2a4[_0x0a77('0x1f')]=qs[_0x0a77('0x1f')](_0x1bfcc9[_0x0a77('0x35')][_0x0a77('0x1f')]);}_0x1ce2a4[_0x0a77('0x3b')]=qs[_0x0a77('0x3c')](_0x1bfcc9[_0x0a77('0x35')][_0x0a77('0x3c')]);_0x1ce2a4[_0x0a77('0x3d')]=qs['filters'](_[_0x0a77('0x3e')](_0x1bfcc9[_0x0a77('0x35')],_0x54d5f6['filters']),_0xbb7403);if(_0x1bfcc9['query'][_0x0a77('0x3f')]){_0x1ce2a4[_0x0a77('0x3d')]=_[_0x0a77('0x40')](_0x1ce2a4[_0x0a77('0x3d')],{'$or':_[_0x0a77('0x2f')](_0xbb7403,function(_0x1f9bef){if(_0x1f9bef[_0x0a77('0x41')]!==_0x0a77('0x42')){var _0x5d6df8={};_0x5d6df8[_0x1f9bef[_0x0a77('0x2c')]]={'$like':'%'+_0x1bfcc9[_0x0a77('0x35')][_0x0a77('0x3f')]+'%'};return _0x5d6df8;}})});}_0x1ce2a4=_[_0x0a77('0x40')]({},_0x1ce2a4,_0x1bfcc9[_0x0a77('0x43')]);var _0x2e6f9b={'where':_0x1ce2a4[_0x0a77('0x3d')]};return db[_0x0a77('0x30')]['count'](_0x2e6f9b)[_0x0a77('0x28')](function(_0x5810ac){_0x111f6d['count']=_0x5810ac;if(_0x1bfcc9[_0x0a77('0x35')][_0x0a77('0x44')]){_0x1ce2a4[_0x0a77('0x45')]=[{'all':!![]}];}return db[_0x0a77('0x30')]['findAll'](_0x1ce2a4);})[_0x0a77('0x28')](function(_0x4002d1){_0x111f6d[_0x0a77('0x46')]=_0x4002d1;return _0x111f6d;})['then'](respondWithFilteredResult(_0x274c74,_0x1ce2a4))['catch'](handleError(_0x274c74,null));};exports['show']=function(_0x31c1e1,_0x3761e6){var _0x8eda={'raw':!![],'where':{'id':_0x31c1e1['params']['id']}},_0x6b22f7={};_0x6b22f7['model']=_['keys'](db['WhatsappTransferReport'][_0x0a77('0x31')]);_0x6b22f7[_0x0a77('0x35')]=_[_0x0a77('0x47')](_0x31c1e1['query']);_0x6b22f7[_0x0a77('0x36')]=_[_0x0a77('0x37')](_0x6b22f7[_0x0a77('0x34')],_0x6b22f7[_0x0a77('0x35')]);_0x8eda[_0x0a77('0x38')]=_[_0x0a77('0x37')](_0x6b22f7[_0x0a77('0x34')],qs['fields'](_0x31c1e1[_0x0a77('0x35')]['fields']));_0x8eda['attributes']=_0x8eda[_0x0a77('0x38')][_0x0a77('0x48')]?_0x8eda['attributes']:_0x6b22f7['model'];if(_0x31c1e1[_0x0a77('0x35')][_0x0a77('0x44')]){_0x8eda['include']=[{'all':!![]}];}_0x8eda=_[_0x0a77('0x40')]({},_0x8eda,_0x31c1e1[_0x0a77('0x43')]);return db[_0x0a77('0x30')]['find'](_0x8eda)[_0x0a77('0x28')](handleEntityNotFound(_0x3761e6,null))[_0x0a77('0x28')](respondWithResult(_0x3761e6,null))[_0x0a77('0x49')](handleError(_0x3761e6,null));};exports[_0x0a77('0x4a')]=function(_0x4e57d6,_0x93628c){return db[_0x0a77('0x30')]['create'](_0x4e57d6['body'],{})[_0x0a77('0x28')](respondWithResult(_0x93628c,0xc9))[_0x0a77('0x49')](handleError(_0x93628c,null));};exports[_0x0a77('0x27')]=function(_0x3fcccd,_0x2ac3eb){if(_0x3fcccd[_0x0a77('0x4b')]['id']){delete _0x3fcccd['body']['id'];}return db[_0x0a77('0x30')][_0x0a77('0x4c')]({'where':{'id':_0x3fcccd['params']['id']}})[_0x0a77('0x28')](handleEntityNotFound(_0x2ac3eb,null))['then'](saveUpdates(_0x3fcccd[_0x0a77('0x4b')],null))[_0x0a77('0x28')](respondWithResult(_0x2ac3eb,null))['catch'](handleError(_0x2ac3eb,null));};exports[_0x0a77('0x29')]=function(_0x40ccd5,_0x2eb382){return db[_0x0a77('0x30')]['find']({'where':{'id':_0x40ccd5[_0x0a77('0x4d')]['id']}})[_0x0a77('0x28')](handleEntityNotFound(_0x2eb382,null))[_0x0a77('0x28')](removeEntity(_0x2eb382,null))[_0x0a77('0x49')](handleError(_0x2eb382,null));};exports[_0x0a77('0x4e')]=function(_0x5d263a,_0x292465){return db[_0x0a77('0x30')][_0x0a77('0x4e')]()['then'](respondWithResult(_0x292465,null))[_0x0a77('0x49')](handleError(_0x292465,null));}; \ No newline at end of file +var _0xdc9c=['where','filters','pick','merge','VIRTUAL','options','then','include','findAll','rows','catch','params','create','body','find','describe','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','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','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x2de6b6,_0x542075){var _0xa4b3d6=function(_0x1e61a6){while(--_0x1e61a6){_0x2de6b6['push'](_0x2de6b6['shift']());}};_0xa4b3d6(++_0x542075);}(_0xdc9c,0xe2));var _0xcdc9=function(_0x1daf8e,_0x3205cc){_0x1daf8e=_0x1daf8e-0x0;var _0x4f4a44=_0xdc9c[_0x1daf8e];return _0x4f4a44;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcdc9('0x0'));var rp=require('request-promise');var moment=require(_0xcdc9('0x1'));var BPromise=require(_0xcdc9('0x2'));var Mustache=require(_0xcdc9('0x3'));var util=require(_0xcdc9('0x4'));var path=require('path');var sox=require(_0xcdc9('0x5'));var csv=require('to-csv');var ejs=require(_0xcdc9('0x6'));var fs=require('fs');var fs_extra=require(_0xcdc9('0x7'));var _=require(_0xcdc9('0x8'));var squel=require(_0xcdc9('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcdc9('0xa'));var Papa=require(_0xcdc9('0xb'));var Redis=require(_0xcdc9('0xc'));var authService=require(_0xcdc9('0xd'));var qs=require(_0xcdc9('0xe'));var as=require(_0xcdc9('0xf'));var hardwareService=require(_0xcdc9('0x10'));var logger=require(_0xcdc9('0x11'))(_0xcdc9('0x12'));var utils=require('../../config/utils');var config=require(_0xcdc9('0x13'));var licenseUtil=require(_0xcdc9('0x14'));var db=require(_0xcdc9('0x15'))['db'];function respondWithStatusCode(_0x55d625,_0x255532){_0x255532=_0x255532||0xcc;return function(_0x11f0e2){if(_0x11f0e2){return _0x55d625[_0xcdc9('0x16')](_0x255532);}return _0x55d625[_0xcdc9('0x17')](_0x255532)[_0xcdc9('0x18')]();};}function respondWithResult(_0x1df9a8,_0x2559dd){_0x2559dd=_0x2559dd||0xc8;return function(_0x397d1e){if(_0x397d1e){return _0x1df9a8[_0xcdc9('0x17')](_0x2559dd)[_0xcdc9('0x19')](_0x397d1e);}};}function respondWithFilteredResult(_0x1df8e6,_0x35303a){return function(_0x100f89){if(_0x100f89){var _0x385770=typeof _0x35303a[_0xcdc9('0x1a')]==='undefined'&&typeof _0x35303a[_0xcdc9('0x1b')]===_0xcdc9('0x1c');var _0x5683c4=_0x100f89[_0xcdc9('0x1d')];var _0x19d34c=_0x385770?0x0:_0x35303a[_0xcdc9('0x1a')];var _0x4ff036=_0x385770?_0x100f89[_0xcdc9('0x1d')]:_0x35303a[_0xcdc9('0x1a')]+_0x35303a[_0xcdc9('0x1b')];var _0x32ca6c;if(_0x4ff036>=_0x5683c4){_0x4ff036=_0x5683c4;_0x32ca6c=0xc8;}else{_0x32ca6c=0xce;}_0x1df8e6[_0xcdc9('0x17')](_0x32ca6c);return _0x1df8e6[_0xcdc9('0x1e')](_0xcdc9('0x1f'),_0x19d34c+'-'+_0x4ff036+'/'+_0x5683c4)[_0xcdc9('0x19')](_0x100f89);}return null;};}function patchUpdates(_0x22a5fe){return function(_0x1809a1){try{jsonpatch[_0xcdc9('0x20')](_0x1809a1,_0x22a5fe,!![]);}catch(_0xd23138){return BPromise[_0xcdc9('0x21')](_0xd23138);}return _0x1809a1[_0xcdc9('0x22')]();};}function saveUpdates(_0x2bffed,_0x1c718a){return function(_0x59cd18){if(_0x59cd18){return _0x59cd18[_0xcdc9('0x23')](_0x2bffed)['then'](function(_0x2c7227){return _0x2c7227;});}return null;};}function removeEntity(_0x2cb3d0,_0x2938cc){return function(_0x23b771){if(_0x23b771){return _0x23b771[_0xcdc9('0x24')]()['then'](function(){_0x2cb3d0[_0xcdc9('0x17')](0xcc)[_0xcdc9('0x18')]();});}};}function handleEntityNotFound(_0x3865be,_0x47b226){return function(_0x2c565c){if(!_0x2c565c){_0x3865be[_0xcdc9('0x16')](0x194);}return _0x2c565c;};}function handleError(_0xe6eab3,_0xad920){_0xad920=_0xad920||0x1f4;return function(_0x187352){logger['error'](_0x187352[_0xcdc9('0x25')]);if(_0x187352[_0xcdc9('0x26')]){delete _0x187352[_0xcdc9('0x26')];}_0xe6eab3[_0xcdc9('0x17')](_0xad920)[_0xcdc9('0x27')](_0x187352);};}exports[_0xcdc9('0x28')]=function(_0x2d8c91,_0x1c75e5){var _0xdead1={},_0x12443f={},_0x464058={'count':0x0,'rows':[]};var _0x502abe=_[_0xcdc9('0x29')](db[_0xcdc9('0x2a')][_0xcdc9('0x2b')],function(_0x1c834d){return{'name':_0x1c834d['fieldName'],'type':_0x1c834d[_0xcdc9('0x2c')][_0xcdc9('0x2d')]};});_0x12443f[_0xcdc9('0x2e')]=_[_0xcdc9('0x29')](_0x502abe,_0xcdc9('0x26'));_0x12443f['query']=_[_0xcdc9('0x2f')](_0x2d8c91[_0xcdc9('0x30')]);_0x12443f['filters']=_['intersection'](_0x12443f[_0xcdc9('0x2e')],_0x12443f['query']);_0xdead1[_0xcdc9('0x31')]=_[_0xcdc9('0x32')](_0x12443f['model'],qs[_0xcdc9('0x33')](_0x2d8c91[_0xcdc9('0x30')][_0xcdc9('0x33')]));_0xdead1[_0xcdc9('0x31')]=_0xdead1[_0xcdc9('0x31')][_0xcdc9('0x34')]?_0xdead1[_0xcdc9('0x31')]:_0x12443f[_0xcdc9('0x2e')];if(!_0x2d8c91[_0xcdc9('0x30')][_0xcdc9('0x35')]('nolimit')){_0xdead1[_0xcdc9('0x1b')]=qs[_0xcdc9('0x1b')](_0x2d8c91[_0xcdc9('0x30')][_0xcdc9('0x1b')]);_0xdead1['offset']=qs[_0xcdc9('0x1a')](_0x2d8c91['query']['offset']);}_0xdead1['order']=qs['sort'](_0x2d8c91[_0xcdc9('0x30')]['sort']);_0xdead1[_0xcdc9('0x36')]=qs[_0xcdc9('0x37')](_[_0xcdc9('0x38')](_0x2d8c91[_0xcdc9('0x30')],_0x12443f[_0xcdc9('0x37')]),_0x502abe);if(_0x2d8c91[_0xcdc9('0x30')]['filter']){_0xdead1['where']=_[_0xcdc9('0x39')](_0xdead1[_0xcdc9('0x36')],{'$or':_[_0xcdc9('0x29')](_0x502abe,function(_0x5db3ab){if(_0x5db3ab[_0xcdc9('0x2c')]!==_0xcdc9('0x3a')){var _0x11935e={};_0x11935e[_0x5db3ab['name']]={'$like':'%'+_0x2d8c91[_0xcdc9('0x30')]['filter']+'%'};return _0x11935e;}})});}_0xdead1=_[_0xcdc9('0x39')]({},_0xdead1,_0x2d8c91[_0xcdc9('0x3b')]);var _0x426c72={'where':_0xdead1[_0xcdc9('0x36')]};return db[_0xcdc9('0x2a')][_0xcdc9('0x1d')](_0x426c72)[_0xcdc9('0x3c')](function(_0x27f438){_0x464058['count']=_0x27f438;if(_0x2d8c91[_0xcdc9('0x30')]['includeAll']){_0xdead1[_0xcdc9('0x3d')]=[{'all':!![]}];}return db[_0xcdc9('0x2a')][_0xcdc9('0x3e')](_0xdead1);})['then'](function(_0x30e353){_0x464058[_0xcdc9('0x3f')]=_0x30e353;return _0x464058;})[_0xcdc9('0x3c')](respondWithFilteredResult(_0x1c75e5,_0xdead1))[_0xcdc9('0x40')](handleError(_0x1c75e5,null));};exports['show']=function(_0x20eae4,_0x13e4cf){var _0x311157={'raw':!![],'where':{'id':_0x20eae4[_0xcdc9('0x41')]['id']}},_0x5c7d01={};_0x5c7d01[_0xcdc9('0x2e')]=_[_0xcdc9('0x2f')](db[_0xcdc9('0x2a')][_0xcdc9('0x2b')]);_0x5c7d01['query']=_[_0xcdc9('0x2f')](_0x20eae4['query']);_0x5c7d01['filters']=_[_0xcdc9('0x32')](_0x5c7d01['model'],_0x5c7d01[_0xcdc9('0x30')]);_0x311157[_0xcdc9('0x31')]=_[_0xcdc9('0x32')](_0x5c7d01[_0xcdc9('0x2e')],qs[_0xcdc9('0x33')](_0x20eae4[_0xcdc9('0x30')][_0xcdc9('0x33')]));_0x311157['attributes']=_0x311157[_0xcdc9('0x31')][_0xcdc9('0x34')]?_0x311157[_0xcdc9('0x31')]:_0x5c7d01[_0xcdc9('0x2e')];if(_0x20eae4[_0xcdc9('0x30')]['includeAll']){_0x311157[_0xcdc9('0x3d')]=[{'all':!![]}];}_0x311157=_['merge']({},_0x311157,_0x20eae4[_0xcdc9('0x3b')]);return db[_0xcdc9('0x2a')]['find'](_0x311157)[_0xcdc9('0x3c')](handleEntityNotFound(_0x13e4cf,null))[_0xcdc9('0x3c')](respondWithResult(_0x13e4cf,null))[_0xcdc9('0x40')](handleError(_0x13e4cf,null));};exports[_0xcdc9('0x42')]=function(_0x1c3c6e,_0x33590d){return db[_0xcdc9('0x2a')]['create'](_0x1c3c6e[_0xcdc9('0x43')],{})[_0xcdc9('0x3c')](respondWithResult(_0x33590d,0xc9))['catch'](handleError(_0x33590d,null));};exports[_0xcdc9('0x23')]=function(_0x40f6ba,_0x14b274){if(_0x40f6ba[_0xcdc9('0x43')]['id']){delete _0x40f6ba[_0xcdc9('0x43')]['id'];}return db['WhatsappTransferReport'][_0xcdc9('0x44')]({'where':{'id':_0x40f6ba[_0xcdc9('0x41')]['id']}})[_0xcdc9('0x3c')](handleEntityNotFound(_0x14b274,null))[_0xcdc9('0x3c')](saveUpdates(_0x40f6ba[_0xcdc9('0x43')],null))[_0xcdc9('0x3c')](respondWithResult(_0x14b274,null))[_0xcdc9('0x40')](handleError(_0x14b274,null));};exports[_0xcdc9('0x24')]=function(_0x526ea6,_0x341c99){return db[_0xcdc9('0x2a')][_0xcdc9('0x44')]({'where':{'id':_0x526ea6[_0xcdc9('0x41')]['id']}})[_0xcdc9('0x3c')](handleEntityNotFound(_0x341c99,null))['then'](removeEntity(_0x341c99,null))[_0xcdc9('0x40')](handleError(_0x341c99,null));};exports['describe']=function(_0xb0a080,_0x39b5e8){return db['WhatsappTransferReport'][_0xcdc9('0x45')]()[_0xcdc9('0x3c')](respondWithResult(_0x39b5e8,null))[_0xcdc9('0x40')](handleError(_0x39b5e8,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 2a02ae5..766ed76 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 _0x406a=['./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','api','bluebird','path','rimraf'];(function(_0x549c11,_0x37a9b5){var _0x446684=function(_0x16839b){while(--_0x16839b){_0x549c11['push'](_0x549c11['shift']());}};_0x446684(++_0x37a9b5);}(_0x406a,0x1be));var _0xa406=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x406a[_0x51c819];return _0x15c5d2;};'use strict';var _=require('lodash');var util=require(_0xa406('0x0'));var logger=require('../../config/logger')(_0xa406('0x1'));var moment=require('moment');var BPromise=require(_0xa406('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa406('0x3'));var rimraf=require(_0xa406('0x4'));var config=require('../../config/environment');var attributes=require(_0xa406('0x5'));module[_0xa406('0x6')]=function(_0x31c66d,_0x262d76){return _0x31c66d[_0xa406('0x7')](_0xa406('0x8'),attributes,{'tableName':_0xa406('0x9'),'paranoid':![],'indexes':[{'name':_0xa406('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc021=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','uniqueid','util'];(function(_0x20a37d,_0x5efaed){var _0x242e8c=function(_0x475639){while(--_0x475639){_0x20a37d['push'](_0x20a37d['shift']());}};_0x242e8c(++_0x5efaed);}(_0xc021,0xaf));var _0x1c02=function(_0x50a5a7,_0x54f4d2){_0x50a5a7=_0x50a5a7-0x0;var _0x49f909=_0xc021[_0x50a5a7];return _0x49f909;};'use strict';var _=require('lodash');var util=require(_0x1c02('0x0'));var logger=require(_0x1c02('0x1'))(_0x1c02('0x2'));var moment=require(_0x1c02('0x3'));var BPromise=require(_0x1c02('0x4'));var rp=require(_0x1c02('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1c02('0x6'));var config=require(_0x1c02('0x7'));var attributes=require('./whatsappTransferReport.attributes');module[_0x1c02('0x8')]=function(_0x5f03e,_0x7aa269){return _0x5f03e[_0x1c02('0x9')]('WhatsappTransferReport',attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x1c02('0xa'),'fields':[_0x1c02('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 fd8bc67..61478db 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 _0xe55d=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x271ecd,_0x5789d8){var _0x3affec=function(_0x4f09c5){while(--_0x4f09c5){_0x271ecd['push'](_0x271ecd['shift']());}};_0x3affec(++_0x5789d8);}(_0xe55d,0x126));var _0xde55=function(_0x3cf57c,_0x1af43f){_0x3cf57c=_0x3cf57c-0x0;var _0x1ce95a=_0xe55d[_0x3cf57c];return _0x1ce95a;};'use strict';var _=require(_0xde55('0x0'));var util=require(_0xde55('0x1'));var moment=require('moment');var BPromise=require(_0xde55('0x2'));var rs=require(_0xde55('0x3'));var fs=require('fs');var Redis=require(_0xde55('0x4'));var db=require(_0xde55('0x5'))['db'];var utils=require(_0xde55('0x6'));var logger=require(_0xde55('0x7'))('rpc');var config=require(_0xde55('0x8'));var jayson=require(_0xde55('0x9'));var client=jayson[_0xde55('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e7b53,_0x1468f2,_0x1e342e){return new BPromise(function(_0x2094bb,_0x22cbd8){return client[_0xde55('0xb')](_0x1e7b53,_0x1e342e)['then'](function(_0x11aa16){logger[_0xde55('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1468f2,'request\x20sent');logger[_0xde55('0xd')](_0xde55('0xe'),_0x1468f2,'request\x20sent',JSON[_0xde55('0xf')](_0x11aa16));if(_0x11aa16[_0xde55('0x10')]){if(_0x11aa16['error'][_0xde55('0x11')]===0x1f4){logger[_0xde55('0x10')](_0xde55('0x12'),_0x1468f2,_0x11aa16['error'][_0xde55('0x13')]);return _0x22cbd8(_0x11aa16[_0xde55('0x10')][_0xde55('0x13')]);}logger[_0xde55('0x10')](_0xde55('0x12'),_0x1468f2,_0x11aa16[_0xde55('0x10')]['message']);return _0x2094bb(_0x11aa16['error'][_0xde55('0x13')]);}else{logger[_0xde55('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1468f2,_0xde55('0x14'));_0x2094bb(_0x11aa16[_0xde55('0x15')][_0xde55('0x13')]);}})[_0xde55('0x16')](function(_0x2f4a77){logger[_0xde55('0x10')](_0xde55('0x12'),_0x1468f2,_0x2f4a77);_0x22cbd8(_0x2f4a77);});});} \ No newline at end of file +var _0xedb1=['code','WhatsappTransferReport,\x20%s,\x20%s','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x5362c8,_0x578457){var _0x2eabce=function(_0x4c45ed){while(--_0x4c45ed){_0x5362c8['push'](_0x5362c8['shift']());}};_0x2eabce(++_0x578457);}(_0xedb1,0x179));var _0x1edb=function(_0x110b66,_0x1e73ca){_0x110b66=_0x110b66-0x0;var _0x2b2d06=_0xedb1[_0x110b66];return _0x2b2d06;};'use strict';var _=require(_0x1edb('0x0'));var util=require(_0x1edb('0x1'));var moment=require(_0x1edb('0x2'));var BPromise=require('bluebird');var rs=require(_0x1edb('0x3'));var fs=require('fs');var Redis=require(_0x1edb('0x4'));var db=require(_0x1edb('0x5'))['db'];var utils=require(_0x1edb('0x6'));var logger=require(_0x1edb('0x7'))('rpc');var config=require(_0x1edb('0x8'));var jayson=require(_0x1edb('0x9'));var client=jayson[_0x1edb('0xa')][_0x1edb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b9820,_0xa62ddd,_0x4b2325){return new BPromise(function(_0xeb828a,_0x2d415c){return client[_0x1edb('0xc')](_0x5b9820,_0x4b2325)[_0x1edb('0xd')](function(_0x4b7527){logger[_0x1edb('0xe')]('WhatsappTransferReport,\x20%s,\x20%s',_0xa62ddd,'request\x20sent');logger[_0x1edb('0xf')](_0x1edb('0x10'),_0xa62ddd,_0x1edb('0x11'),JSON['stringify'](_0x4b7527));if(_0x4b7527[_0x1edb('0x12')]){if(_0x4b7527[_0x1edb('0x12')][_0x1edb('0x13')]===0x1f4){logger['error'](_0x1edb('0x14'),_0xa62ddd,_0x4b7527['error'][_0x1edb('0x15')]);return _0x2d415c(_0x4b7527[_0x1edb('0x12')][_0x1edb('0x15')]);}logger['error'](_0x1edb('0x14'),_0xa62ddd,_0x4b7527[_0x1edb('0x12')][_0x1edb('0x15')]);return _0xeb828a(_0x4b7527[_0x1edb('0x12')][_0x1edb('0x15')]);}else{logger[_0x1edb('0xe')](_0x1edb('0x14'),_0xa62ddd,_0x1edb('0x11'));_0xeb828a(_0x4b7527['result'][_0x1edb('0x15')]);}})['catch'](function(_0x4367aa){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0xa62ddd,_0x4367aa);_0x2d415c(_0x4367aa);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 6e69dac..52317c3 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdcf6=['App\x20Ready!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','then','default','info','start','filter','exitCode','length','map','pm2_env','name','Online\x20apps:','join','Offline\x20apps:','online','None','log'];(function(_0x7ff7da,_0x13a1f2){var _0x4626f1=function(_0x4a4ee5){while(--_0x4a4ee5){_0x7ff7da['push'](_0x7ff7da['shift']());}};_0x4626f1(++_0x13a1f2);}(_0xdcf6,0x1b6));var _0x6dcf=function(_0x3374fd,_0x59a9bc){_0x3374fd=_0x3374fd-0x0;var _0xb10792=_0xdcf6[_0x3374fd];return _0xb10792;};'use strict';var _=require('lodash');var db=require(_0x6dcf('0x0'))['db'];var seedDb=require(_0x6dcf('0x1'));var checkLicense=require(_0x6dcf('0x2'));var rpc=require(_0x6dcf('0x3'));var config=require(_0x6dcf('0x4'));var logger=require(_0x6dcf('0x5'))(_0x6dcf('0x6'));var pm2=require('./config/pm2');var pm2Config=require(_0x6dcf('0x7'));var schedule=require(_0x6dcf('0x8'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x6dcf('0x9'));var transcribe=require(_0x6dcf('0xa'));var provider=require('./config/schedule/cloud-provider');function main(){return db['sequelize']['sync']()[_0x6dcf('0xb')](function(){if(config['seedDB']){return seedDb[_0x6dcf('0xc')]();}})[_0x6dcf('0xb')](function(){return checkLicense[_0x6dcf('0xc')]();})['then'](function(){return rpc['listen']();})['then'](function(_0x443c93){logger[_0x6dcf('0xd')](_0x443c93);return chat[_0x6dcf('0xe')]();})['then'](function(){return whatsapp[_0x6dcf('0xe')]();})[_0x6dcf('0xb')](function(){return schedule[_0x6dcf('0xe')]();})[_0x6dcf('0xb')](function(){return transcribe[_0x6dcf('0xe')]();})[_0x6dcf('0xb')](function(){return provider[_0x6dcf('0xe')]();})[_0x6dcf('0xb')](function(_0x43dbf1){logger[_0x6dcf('0xd')](_0x43dbf1);return pm2[_0x6dcf('0xe')](pm2Config);})[_0x6dcf('0xb')](function(_0x418c45){var _0x214050=_0x418c45[_0x6dcf('0xf')](function(_0x31239d){return typeof _0x31239d[_0x6dcf('0x10')]==='number'&&_0x31239d[_0x6dcf('0x10')]>=0x0;});if(_0x214050[_0x6dcf('0x11')]>0x0){throw new Error(_0x214050[_0x6dcf('0x11')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x6dcf('0x12')](_0x214050,function(_0x1a03b4){return'\x22'+_0x1a03b4[_0x6dcf('0x13')][_0x6dcf('0x14')]+'\x22';}));}logger[_0x6dcf('0xd')](_0x6dcf('0x15'),_[_0x6dcf('0x12')](_[_0x6dcf('0xf')](_0x418c45,{'status':'online'}),_0x6dcf('0x14'))[_0x6dcf('0x16')]());logger[_0x6dcf('0xd')](_0x6dcf('0x17'),_[_0x6dcf('0x12')](_[_0x6dcf('0xf')](_0x418c45,function(_0x32ea6c){return _0x32ea6c['status']!==_0x6dcf('0x18');}),'name')[_0x6dcf('0x16')]()||_0x6dcf('0x19'));console[_0x6dcf('0x1a')](_0x6dcf('0x1b'));})['catch'](function(_0x576cce){console[_0x6dcf('0x1a')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x576cce);logger[_0x6dcf('0x1c')](_0x6dcf('0x1d'),_0x576cce);process[_0x6dcf('0x1e')](0x1);});}main(); \ No newline at end of file +var _0x30bc=['status','log','App\x20Ready!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','seedDB','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','online','join','Offline\x20apps:'];(function(_0xc0bc7f,_0x51678d){var _0x5a5597=function(_0x3c05a3){while(--_0x3c05a3){_0xc0bc7f['push'](_0xc0bc7f['shift']());}};_0x5a5597(++_0x51678d);}(_0x30bc,0x149));var _0xc30b=function(_0x205852,_0x184d90){_0x205852=_0x205852-0x0;var _0x491d8d=_0x30bc[_0x205852];return _0x491d8d;};'use strict';var _=require(_0xc30b('0x0'));var db=require(_0xc30b('0x1'))['db'];var seedDb=require(_0xc30b('0x2'));var checkLicense=require('./config/license');var rpc=require(_0xc30b('0x3'));var config=require(_0xc30b('0x4'));var logger=require(_0xc30b('0x5'))(_0xc30b('0x6'));var pm2=require(_0xc30b('0x7'));var pm2Config=require(_0xc30b('0x8'));var schedule=require(_0xc30b('0x9'));var chat=require(_0xc30b('0xa'));var whatsapp=require(_0xc30b('0xb'));var transcribe=require(_0xc30b('0xc'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0xc30b('0xd')][_0xc30b('0xe')]()[_0xc30b('0xf')](function(){if(config[_0xc30b('0x10')]){return seedDb['default']();}})[_0xc30b('0xf')](function(){return checkLicense['default']();})[_0xc30b('0xf')](function(){return rpc[_0xc30b('0x11')]();})['then'](function(_0x5a9807){logger[_0xc30b('0x12')](_0x5a9807);return chat[_0xc30b('0x13')]();})[_0xc30b('0xf')](function(){return whatsapp[_0xc30b('0x13')]();})[_0xc30b('0xf')](function(){return schedule[_0xc30b('0x13')]();})['then'](function(){return transcribe[_0xc30b('0x13')]();})[_0xc30b('0xf')](function(){return provider['start']();})[_0xc30b('0xf')](function(_0x45f6b3){logger['info'](_0x45f6b3);return pm2[_0xc30b('0x13')](pm2Config);})['then'](function(_0x58fb81){var _0x4d7725=_0x58fb81[_0xc30b('0x14')](function(_0x56e53c){return typeof _0x56e53c[_0xc30b('0x15')]===_0xc30b('0x16')&&_0x56e53c[_0xc30b('0x15')]>=0x0;});if(_0x4d7725[_0xc30b('0x17')]>0x0){throw new Error(_0x4d7725['length']+_0xc30b('0x18')+_[_0xc30b('0x19')](_0x4d7725,function(_0x1cd5de){return'\x22'+_0x1cd5de[_0xc30b('0x1a')][_0xc30b('0x1b')]+'\x22';}));}logger[_0xc30b('0x12')]('Online\x20apps:',_[_0xc30b('0x19')](_[_0xc30b('0x14')](_0x58fb81,{'status':_0xc30b('0x1c')}),_0xc30b('0x1b'))[_0xc30b('0x1d')]());logger[_0xc30b('0x12')](_0xc30b('0x1e'),_['map'](_[_0xc30b('0x14')](_0x58fb81,function(_0x513d86){return _0x513d86[_0xc30b('0x1f')]!==_0xc30b('0x1c');}),_0xc30b('0x1b'))[_0xc30b('0x1d')]()||'None');console[_0xc30b('0x20')](_0xc30b('0x21'));})['catch'](function(_0x504514){console[_0xc30b('0x20')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x504514);logger['error'](_0xc30b('0x22'),_0x504514);process[_0xc30b('0x23')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 4614141..db26b12 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 _0xd6ef=['express-jwt','composable-middleware','basic-auth','util','moment','secrets','session','role','fullname','name','userpic','permissions','md5secret','voicePause','chatPause','mailPause','smsPause','pauseType','showWebBar','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','openchannelAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','disposition','then','closed','forceDownload','status','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','find','authenticate','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','apikey','getUuid','User','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','isWebrtcLicence','webrtc','Forbidden','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','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','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','unshift','encryptString','join','promisify','sign','secret','payload','verify','randomBytes','toString','floor','now','../../config/environment','../encryptor','jsonwebtoken'];(function(_0x7d4bbe,_0x264cf8){var _0x22a59f=function(_0x1d0db5){while(--_0x1d0db5){_0x7d4bbe['push'](_0x7d4bbe['shift']());}};_0x22a59f(++_0x264cf8);}(_0xd6ef,0x109));var _0xfd6e=function(_0x4775c9,_0x2192e4){_0x4775c9=_0x4775c9-0x0;var _0x14dbc6=_0xd6ef[_0x4775c9];return _0x14dbc6;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0xfd6e('0x0'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require(_0xfd6e('0x1'));var _=require('lodash');var jwt=require(_0xfd6e('0x2'));var expressJwt=require(_0xfd6e('0x3'));var compose=require(_0xfd6e('0x4'));var basicAuth=require(_0xfd6e('0x5'));var crypto=require('crypto');var BPromise=require('bluebird');var util=require(_0xfd6e('0x6'));var moment=require(_0xfd6e('0x7'));var validateJwt=expressJwt({'secret':config[_0xfd6e('0x8')][_0xfd6e('0x9')]});var userAttributes=['id',_0xfd6e('0xa'),_0xfd6e('0xb'),_0xfd6e('0xc'),'internal','email',_0xfd6e('0xd'),_0xfd6e('0xe'),_0xfd6e('0xf'),_0xfd6e('0x10'),_0xfd6e('0x11'),_0xfd6e('0x12'),'faxPause',_0xfd6e('0x13'),'openchannelPause',_0xfd6e('0x14'),_0xfd6e('0x15'),_0xfd6e('0x16'),'lastPauseAt',_0xfd6e('0x17'),_0xfd6e('0x18'),_0xfd6e('0x19'),_0xfd6e('0x1a'),'phoneBarAutoAnswer',_0xfd6e('0x1b'),_0xfd6e('0x1c'),_0xfd6e('0x1d'),_0xfd6e('0x1e'),'phoneBarEnableSettings',_0xfd6e('0x1f'),_0xfd6e('0x20'),_0xfd6e('0x21'),_0xfd6e('0x22'),'hotdesk','interface','userProfileId',_0xfd6e('0x23'),_0xfd6e('0x24'),_0xfd6e('0x25'),_0xfd6e('0x26'),_0xfd6e('0x27'),'downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign',_0xfd6e('0x28'),_0xfd6e('0x29'),_0xfd6e('0x2a'),_0xfd6e('0x2b'),_0xfd6e('0x2c'),'smsAutoanswerDelay',_0xfd6e('0x2d'),'openchannelAutoanswerDelay','faxAutoanswer',_0xfd6e('0x2e'),'whatsappAutoanswer',_0xfd6e('0x2f'),_0xfd6e('0x30')];exports[_0xfd6e('0x31')]=function(){return this[_0xfd6e('0x32')](!![])[_0xfd6e('0x33')](function(_0x41e813,_0x44edcc,_0x27579f){if(_0x41e813[_0xfd6e('0x34')]){_0x27579f();}else{return db[_0xfd6e('0x35')][_0xfd6e('0x36')]({'where':{'id':_0x41e813[_0xfd6e('0x37')]['id']},'attributes':['id','closed',_0xfd6e('0x38')],'raw':!![]})[_0xfd6e('0x39')](function(_0x3430bb){if(_0x3430bb&&_0x3430bb[_0xfd6e('0x3a')]&&!_0x41e813['query'][_0xfd6e('0x3b')]){return _0x44edcc[_0xfd6e('0x3c')](_0x3430bb[_0xfd6e('0x38')]===_0xfd6e('0x3d')?0x195:0x193)[_0xfd6e('0x3e')]({'message':_0x3430bb['disposition']===_0xfd6e('0x3d')?_0xfd6e('0x3f'):_0xfd6e('0x40')});}else{_0x27579f();}})[_0xfd6e('0x41')](function(_0x4be15c){_0x27579f(_0x4be15c);});}});};exports['isAuthenticated']=function isAuthenticated(_0x3120e8){return compose()[_0xfd6e('0x33')](function(_0x317a98,_0x443241,_0x25a9f2){var _0xcb6523;if(_0x317a98[_0xfd6e('0x42')][_0xfd6e('0x43')]){if(_[_0xfd6e('0x44')](_0x317a98[_0xfd6e('0x42')][_0xfd6e('0x43')],_0xfd6e('0x45'))){var _0x2aedb3=basicAuth(_0x317a98);db['User'][_0xfd6e('0x46')]({'where':{'name':_0x2aedb3[_0xfd6e('0xc')]}})['then'](function(_0x1d83f4){if(!_0x1d83f4||!_0x1d83f4[_0xfd6e('0x47')](_0x2aedb3['pass'])){return _0x443241[_0xfd6e('0x3c')](0x191)[_0xfd6e('0x3e')]({'message':_0xfd6e('0x48')});}_0x317a98[_0xfd6e('0x34')]={'id':_0x1d83f4['id']};_0x25a9f2();})[_0xfd6e('0x41')](function(_0x2d3f1e){_0x25a9f2(_0x2d3f1e);});}else if(_[_0xfd6e('0x44')](_0x317a98[_0xfd6e('0x42')]['authorization'],'Bearer')){validateJwt(_0x317a98,_0x443241,_0x25a9f2);}else{if(_0x3120e8){_0x25a9f2();}else{return _0x443241[_0xfd6e('0x3c')](0x193)[_0xfd6e('0x3e')]({'message':_0xfd6e('0x49')});}}}else if(_0x317a98[_0xfd6e('0x4a')][_0xfd6e('0x4b')]){try{var _0x49267c={'audience':hardwareConf[_0xfd6e('0x4c')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x317a98[_0xfd6e('0x4a')][_0xfd6e('0x4b')],_0x49267c)[_0xfd6e('0x39')](function(_0xbe0010){return db[_0xfd6e('0x4d')][_0xfd6e('0x46')]({'where':{'id':_0xbe0010[_0xfd6e('0x4e')]}})[_0xfd6e('0x39')](function(_0x209a5b){_0xcb6523=_0x209a5b;return db[_0xfd6e('0x4f')]['findOne']({'where':{'id':0x1},'attributes':[_0xfd6e('0x50'),_0xfd6e('0x51')],'raw':!![]});})[_0xfd6e('0x39')](function(_0x56eb5d){if(!_0xcb6523||!_[_0xfd6e('0x52')](_0xcb6523['apiKeyNonce'],_0xbe0010[_0xfd6e('0x53')])){return _0x443241['status'](0x191)[_0xfd6e('0x3e')]({'message':_0xfd6e('0x54')});}if(_0xcb6523[_0xfd6e('0x55')]){return _0x443241['status'](0x191)[_0xfd6e('0x3e')]({'message':_0xfd6e('0x56')});}if(_0xcb6523[_0xfd6e('0x57')]){if(_0x56eb5d['blockDuration']>0x0){if(moment(_0xcb6523[_0xfd6e('0x58')])[_0xfd6e('0x59')](_0x56eb5d['blockDuration'],_0xfd6e('0x5a'))>moment()){return _0x443241[_0xfd6e('0x3c')](0x191)[_0xfd6e('0x3e')]({'message':_0xfd6e('0x56')});}}else{return _0x443241['status'](0x191)[_0xfd6e('0x3e')]({'message':_0xfd6e('0x56')});}}_0x317a98[_0xfd6e('0x34')]={'id':_0xcb6523['id']};_0x25a9f2();});})[_0xfd6e('0x41')](function(){return _0x443241[_0xfd6e('0x3c')](0x191)['json']({'message':_0xfd6e('0x56')});});}catch(_0x5d04d9){_0x25a9f2(_0x5d04d9);}}else if(_0x3120e8){_0x25a9f2();}else{return _0x443241[_0xfd6e('0x3c')](0x193)['json']({'message':_0xfd6e('0x49')});}})[_0xfd6e('0x33')](function(_0x463a88,_0x25dcf1,_0x3ca3c4){if(_0x463a88['user']){db[_0xfd6e('0x4d')][_0xfd6e('0x46')]({'where':{'id':_0x463a88[_0xfd6e('0x34')]['id']},'attributes':userAttributes})[_0xfd6e('0x39')](function(_0x10f5bc){if(!_0x10f5bc){return _0x25dcf1['status'](0x194)[_0xfd6e('0x3e')]({'message':_0xfd6e('0x5b')});}_0x463a88[_0xfd6e('0x34')]=_0x10f5bc;_0x3ca3c4();})[_0xfd6e('0x41')](function(_0x24d3b1){_0x3ca3c4(_0x24d3b1);});}else if(_0x3120e8){_0x3ca3c4();}else{return _0x25dcf1[_0xfd6e('0x3c')](0x194)['json']({'message':_0xfd6e('0x5c')});}});};exports[_0xfd6e('0x5d')]=function canUpdate(){return compose()[_0xfd6e('0x33')](function(_0x49f52e,_0x439d69,_0x3a29eb){return licenseUtil[_0xfd6e('0x5e')]()['then'](function(_0x41e2d7){if(_0x41e2d7['update']){_0x3a29eb();}else{return _0x439d69[_0xfd6e('0x3c')](0x193)[_0xfd6e('0x3e')]({'message':'Forbidden'});}})['catch'](function(_0xf84ebc){_0x3a29eb(_0xf84ebc);});});};exports[_0xfd6e('0x5f')]=function isWebrtcLicence(){return compose()[_0xfd6e('0x33')](function(_0x4ac589,_0x39bef0,_0x3bcb9b){return licenseUtil[_0xfd6e('0x5e')]()['then'](function(_0x43e357){if(_0x43e357[_0xfd6e('0x60')]){_0x3bcb9b();}else{return _0x39bef0[_0xfd6e('0x3c')](0x193)[_0xfd6e('0x3e')]({'message':_0xfd6e('0x61')});}})['catch'](function(_0x38254b){_0x3bcb9b(_0x38254b);});});};exports['isMiddleware']=function(_0x407696,_0x21a5dd,_0xb864ca){_0x407696[_0xfd6e('0x62')]=!![];return _0xb864ca();};exports['signToken']=function signToken(_0x5777d7){return signJwt(_0x5777d7);};exports[_0xfd6e('0x63')]=function(_0x4c663e,_0x496fbc){if(!_0x4c663e[_0xfd6e('0x34')]){return _0x496fbc[_0xfd6e('0x3c')](0x194)[_0xfd6e('0x3e')]({'message':_0xfd6e('0x64')});}var _0x5b40b6={'payload':{'id':_0x4c663e[_0xfd6e('0x34')]['id'],'role':_0x4c663e[_0xfd6e('0x34')][_0xfd6e('0xa')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5b40b6)[_0xfd6e('0x39')](function(_0x4d5660){_0x496fbc[_0xfd6e('0x65')](_0xfd6e('0x66'),_0x4d5660);_0x496fbc[_0xfd6e('0x67')]('/dashboards/general');})[_0xfd6e('0x41')](function(_0x470383){return _0x496fbc[_0xfd6e('0x3c')](0x1f4)[_0xfd6e('0x68')](_0x470383);});};exports[_0xfd6e('0x69')]=function(_0x8ec257){if(_[_0xfd6e('0x6a')](_0x8ec257[_0xfd6e('0x6b')])||_[_0xfd6e('0x6a')](_0x8ec257[_0xfd6e('0x6c')])){return null;}else{return createJwt(_0x8ec257);}};exports['generateApiKey']=function(_0x392980){_0x392980[_0xfd6e('0x6b')]=generateNonce();_0x392980[_0xfd6e('0x6c')]=generateIssuedAt();return createJwt(_0x392980);};exports['regenerateApiKey']=function(_0x362a42,_0x406946){var _0x534157=_0x362a42[_0xfd6e('0x4a')][_0xfd6e('0x4b')];if(_0x534157){var _0x416a45={'nonce':_0x406946[_0xfd6e('0x6b')],'iat':_0x406946['apiKeyIat'],'audience':hardwareConf[_0xfd6e('0x4c')](),'issuer':hardwareConf[_0xfd6e('0x4c')]()};return verifyJwt(_0x534157,_0x416a45)[_0xfd6e('0x39')](function(){return generateApiKey(_0x406946);});}else{throw{'message':_0xfd6e('0x6d')};}};exports[_0xfd6e('0x6e')]=function(_0x375c82){var _0x1b7640=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1b7640[_0xfd6e('0x6f')](_0x375c82))throw new db[(_0xfd6e('0x70'))][(_0xfd6e('0x71'))](_0xfd6e('0x72'));return;};exports[_0xfd6e('0x73')]=function(_0x5230b1,_0x5d0bf1,_0x5bbbc4){var _0x4ae5d6=encryptor[_0xfd6e('0x74')](_0x5d0bf1)[_0xfd6e('0x75')](',');for(var _0x535a08=0x0;_0x535a08<_0x5bbbc4;_0x535a08++){if(!_0x4ae5d6[_0x535a08])break;if(_0x5230b1[_0xfd6e('0x76')]()===_0x4ae5d6[_0x535a08][_0xfd6e('0x76')]()){var _0x5c1dd8=util[_0xfd6e('0x77')](_0xfd6e('0x78'),_0x5bbbc4);if(_0x5bbbc4===0x1){_0x5c1dd8='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db['Sequelize'][(_0xfd6e('0x71'))](_0x5c1dd8);}}return;};exports[_0xfd6e('0x79')]=function(_0x23e534,_0xb28e71){var _0x418aea=_0xb28e71?encryptor['decryptString'](_0xb28e71)[_0xfd6e('0x75')](','):[];if(_0x418aea['length']===0x5){_0x418aea['splice'](-0x1,0x1);}_0x418aea[_0xfd6e('0x7a')](_0x23e534);return encryptor[_0xfd6e('0x7b')](_0x418aea[_0xfd6e('0x7c')](','));};function signJwt(_0x526385){var _0x15d752=BPromise[_0xfd6e('0x7d')](jwt[_0xfd6e('0x7e')],{'context':jwt});var _0xabc9ba=_0x526385[_0xfd6e('0x7f')]||config['secrets'][_0xfd6e('0x9')];return new BPromise(function(_0x3338e1,_0x4f9142){_0x15d752(_0x526385[_0xfd6e('0x80')],_0xabc9ba,_0x526385['options'])[_0xfd6e('0x39')](function(_0x37a1c7){_0x3338e1(_0x37a1c7);})[_0xfd6e('0x41')](function(_0x2a4e4d){_0x4f9142(_0x2a4e4d);});});}function verifyJwt(_0x31e2a5,_0xca0cb7,_0x38a344){var _0x28a008=BPromise[_0xfd6e('0x7d')](jwt[_0xfd6e('0x81')],{'context':jwt});var _0x2147eb=_0x38a344||config[_0xfd6e('0x8')]['session'];return new BPromise(function(_0x5997c0,_0xc38edc){_0x28a008(_0x31e2a5,_0x2147eb,_0xca0cb7)[_0xfd6e('0x39')](function(_0x56d813){_0x5997c0(_0x56d813);})[_0xfd6e('0x41')](function(_0xd26fbf){_0xc38edc(_0xd26fbf);});});}function generateNonce(){return crypto[_0xfd6e('0x82')](0x10)[_0xfd6e('0x83')]('hex');}function generateIssuedAt(){return Math[_0xfd6e('0x84')](Date[_0xfd6e('0x85')]()/0x3e8)[_0xfd6e('0x83')]();}function createJwt(_0x179c01){var _0x1271f0={'payload':{'iat':_0x179c01[_0xfd6e('0x6c')],'nonce':_0x179c01['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x179c01['id']['toString'](),'issuer':hardwareConf[_0xfd6e('0x4c')](),'audience':hardwareConf[_0xfd6e('0x4c')]()}};return signJwt(_0x1271f0)[_0xfd6e('0x39')](function(_0x901bcb){return{'iat':_0x179c01[_0xfd6e('0x6c')],'nonce':_0x179c01[_0xfd6e('0x6b')],'token':_0x901bcb};});} \ No newline at end of file +var _0xbf49=['test','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','decryptString','split','toLowerCase','format','updatePasswordsHistory','length','splice','unshift','sign','session','options','promisify','verify','randomBytes','toString','hex','now','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','composable-middleware','bluebird','util','moment','secrets','role','fullname','name','email','userpic','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','passwordResetAt','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','emailAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','findOne','params','closed','disposition','forceDownload','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','User','then','authenticate','pass','user','Bearer','status','Unknown\x20authorization\x20format','query','apikey','getUuid','find','sub','Setting','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blockedAt','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','update','Forbidden','isWebrtcLicence','isMiddleware','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','send','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'];(function(_0x3a76c9,_0xf47eb4){var _0x5d56a3=function(_0x563f6){while(--_0x563f6){_0x3a76c9['push'](_0x3a76c9['shift']());}};_0x5d56a3(++_0xf47eb4);}(_0xbf49,0x11d));var _0x9bf4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf49[_0x3dd15e];return _0x231fd0;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x9bf4('0x0'));var hardwareConf=require(_0x9bf4('0x1'));var licenseUtil=require(_0x9bf4('0x2'));var encryptor=require(_0x9bf4('0x3'));var _=require(_0x9bf4('0x4'));var jwt=require(_0x9bf4('0x5'));var expressJwt=require('express-jwt');var compose=require(_0x9bf4('0x6'));var basicAuth=require('basic-auth');var crypto=require('crypto');var BPromise=require(_0x9bf4('0x7'));var util=require(_0x9bf4('0x8'));var moment=require(_0x9bf4('0x9'));var validateJwt=expressJwt({'secret':config[_0x9bf4('0xa')]['session']});var userAttributes=['id',_0x9bf4('0xb'),_0x9bf4('0xc'),_0x9bf4('0xd'),'internal',_0x9bf4('0xe'),_0x9bf4('0xf'),'permissions',_0x9bf4('0x10'),_0x9bf4('0x11'),_0x9bf4('0x12'),_0x9bf4('0x13'),_0x9bf4('0x14'),_0x9bf4('0x15'),_0x9bf4('0x16'),_0x9bf4('0x17'),_0x9bf4('0x18'),'lastLoginAt',_0x9bf4('0x19'),_0x9bf4('0x1a'),'allowmessenger',_0x9bf4('0x1b'),'alias',_0x9bf4('0x1c'),'phoneBarAutoAnswerDelay',_0x9bf4('0x1d'),_0x9bf4('0x1e'),_0x9bf4('0x1f'),_0x9bf4('0x20'),_0x9bf4('0x21'),'phoneBarPrefixRequired',_0x9bf4('0x22'),_0x9bf4('0x23'),'hotdesk',_0x9bf4('0x24'),'userProfileId','privacyEnabled',_0x9bf4('0x25'),_0x9bf4('0x26'),_0x9bf4('0x27'),'downloadOmnichannelInteractions',_0x9bf4('0x28'),_0x9bf4('0x29'),_0x9bf4('0x2a'),_0x9bf4('0x2b'),'chatAutoanswerDelay',_0x9bf4('0x2c'),'emailAutoanswerDelay','smsAutoanswer',_0x9bf4('0x2d'),_0x9bf4('0x2e'),_0x9bf4('0x2f'),_0x9bf4('0x30'),'faxAutoanswerDelay',_0x9bf4('0x31'),_0x9bf4('0x32'),_0x9bf4('0x33')];exports[_0x9bf4('0x34')]=function(){return this[_0x9bf4('0x35')](!![])[_0x9bf4('0x36')](function(_0x248335,_0x27c1cf,_0x6efbbb){if(_0x248335['user']){_0x6efbbb();}else{return db[_0x9bf4('0x37')][_0x9bf4('0x38')]({'where':{'id':_0x248335[_0x9bf4('0x39')]['id']},'attributes':['id',_0x9bf4('0x3a'),_0x9bf4('0x3b')],'raw':!![]})['then'](function(_0x445af0){if(_0x445af0&&_0x445af0[_0x9bf4('0x3a')]&&!_0x248335['query'][_0x9bf4('0x3c')]){return _0x27c1cf['status'](_0x445af0[_0x9bf4('0x3b')]===_0x9bf4('0x3d')?0x195:0x193)[_0x9bf4('0x3e')]({'message':_0x445af0[_0x9bf4('0x3b')]===_0x9bf4('0x3d')?_0x9bf4('0x3f'):_0x9bf4('0x40')});}else{_0x6efbbb();}})[_0x9bf4('0x41')](function(_0x2ae91c){_0x6efbbb(_0x2ae91c);});}});};exports['isAuthenticated']=function isAuthenticated(_0xd098e8){return compose()[_0x9bf4('0x36')](function(_0x348cad,_0x1200d6,_0x3d53e1){var _0x57cf4f;if(_0x348cad[_0x9bf4('0x42')][_0x9bf4('0x43')]){if(_[_0x9bf4('0x44')](_0x348cad[_0x9bf4('0x42')][_0x9bf4('0x43')],_0x9bf4('0x45'))){var _0x7f4e3b=basicAuth(_0x348cad);db[_0x9bf4('0x46')]['find']({'where':{'name':_0x7f4e3b[_0x9bf4('0xd')]}})[_0x9bf4('0x47')](function(_0x2f607f){if(!_0x2f607f||!_0x2f607f[_0x9bf4('0x48')](_0x7f4e3b[_0x9bf4('0x49')])){return _0x1200d6['status'](0x191)[_0x9bf4('0x3e')]({'message':'Wrong\x20credentials.'});}_0x348cad[_0x9bf4('0x4a')]={'id':_0x2f607f['id']};_0x3d53e1();})['catch'](function(_0x3af595){_0x3d53e1(_0x3af595);});}else if(_[_0x9bf4('0x44')](_0x348cad[_0x9bf4('0x42')][_0x9bf4('0x43')],_0x9bf4('0x4b'))){validateJwt(_0x348cad,_0x1200d6,_0x3d53e1);}else{if(_0xd098e8){_0x3d53e1();}else{return _0x1200d6[_0x9bf4('0x4c')](0x193)[_0x9bf4('0x3e')]({'message':_0x9bf4('0x4d')});}}}else if(_0x348cad[_0x9bf4('0x4e')][_0x9bf4('0x4f')]){try{var _0x3830f9={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x9bf4('0x50')]()};verifyJwt(_0x348cad[_0x9bf4('0x4e')]['apikey'],_0x3830f9)[_0x9bf4('0x47')](function(_0x363762){return db[_0x9bf4('0x46')][_0x9bf4('0x51')]({'where':{'id':_0x363762[_0x9bf4('0x52')]}})[_0x9bf4('0x47')](function(_0x3818ea){_0x57cf4f=_0x3818ea;return db[_0x9bf4('0x53')][_0x9bf4('0x38')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x9bf4('0x54')],'raw':!![]});})[_0x9bf4('0x47')](function(_0x4870a7){if(!_0x57cf4f||!_[_0x9bf4('0x55')](_0x57cf4f[_0x9bf4('0x56')],_0x363762['nonce'])){return _0x1200d6['status'](0x191)[_0x9bf4('0x3e')]({'message':_0x9bf4('0x57')});}if(_0x57cf4f[_0x9bf4('0x58')]){return _0x1200d6[_0x9bf4('0x4c')](0x191)[_0x9bf4('0x3e')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x57cf4f['blocked']){if(_0x4870a7[_0x9bf4('0x54')]>0x0){if(moment(_0x57cf4f[_0x9bf4('0x59')])['add'](_0x4870a7[_0x9bf4('0x54')],'minutes')>moment()){return _0x1200d6[_0x9bf4('0x4c')](0x191)[_0x9bf4('0x3e')]({'message':_0x9bf4('0x5a')});}}else{return _0x1200d6['status'](0x191)['json']({'message':_0x9bf4('0x5a')});}}_0x348cad[_0x9bf4('0x4a')]={'id':_0x57cf4f['id']};_0x3d53e1();});})[_0x9bf4('0x41')](function(){return _0x1200d6[_0x9bf4('0x4c')](0x191)[_0x9bf4('0x3e')]({'message':_0x9bf4('0x5a')});});}catch(_0x10dca1){_0x3d53e1(_0x10dca1);}}else if(_0xd098e8){_0x3d53e1();}else{return _0x1200d6[_0x9bf4('0x4c')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})[_0x9bf4('0x36')](function(_0x2c7959,_0x314459,_0xacd121){if(_0x2c7959[_0x9bf4('0x4a')]){db[_0x9bf4('0x46')][_0x9bf4('0x51')]({'where':{'id':_0x2c7959[_0x9bf4('0x4a')]['id']},'attributes':userAttributes})[_0x9bf4('0x47')](function(_0x18a9bd){if(!_0x18a9bd){return _0x314459[_0x9bf4('0x4c')](0x194)[_0x9bf4('0x3e')]({'message':_0x9bf4('0x5b')});}_0x2c7959[_0x9bf4('0x4a')]=_0x18a9bd;_0xacd121();})[_0x9bf4('0x41')](function(_0x550ecd){_0xacd121(_0x550ecd);});}else if(_0xd098e8){_0xacd121();}else{return _0x314459[_0x9bf4('0x4c')](0x194)['json']({'message':_0x9bf4('0x5c')});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x5d3ff4,_0x35e3c3,_0x16bc09){return licenseUtil[_0x9bf4('0x5d')]()[_0x9bf4('0x47')](function(_0x3f0fe3){if(_0x3f0fe3[_0x9bf4('0x5e')]){_0x16bc09();}else{return _0x35e3c3[_0x9bf4('0x4c')](0x193)[_0x9bf4('0x3e')]({'message':_0x9bf4('0x5f')});}})[_0x9bf4('0x41')](function(_0x599688){_0x16bc09(_0x599688);});});};exports[_0x9bf4('0x60')]=function isWebrtcLicence(){return compose()[_0x9bf4('0x36')](function(_0x19f5cb,_0x3ad773,_0x4589ae){return licenseUtil['getLicense']()[_0x9bf4('0x47')](function(_0x260f5a){if(_0x260f5a['webrtc']){_0x4589ae();}else{return _0x3ad773[_0x9bf4('0x4c')](0x193)[_0x9bf4('0x3e')]({'message':_0x9bf4('0x5f')});}})[_0x9bf4('0x41')](function(_0x514fcd){_0x4589ae(_0x514fcd);});});};exports[_0x9bf4('0x61')]=function(_0x57e7bf,_0x469eac,_0x950c21){_0x57e7bf[_0x9bf4('0x61')]=!![];return _0x950c21();};exports['signToken']=function signToken(_0x3a89ee){return signJwt(_0x3a89ee);};exports[_0x9bf4('0x62')]=function(_0x139f8f,_0x5d6756){if(!_0x139f8f['user']){return _0x5d6756[_0x9bf4('0x4c')](0x194)[_0x9bf4('0x3e')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x3a0c14={'payload':{'id':_0x139f8f['user']['id'],'role':_0x139f8f['user'][_0x9bf4('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x3a0c14)['then'](function(_0x3a94b8){_0x5d6756[_0x9bf4('0x63')](_0x9bf4('0x64'),_0x3a94b8);_0x5d6756[_0x9bf4('0x65')](_0x9bf4('0x66'));})[_0x9bf4('0x41')](function(_0x5cecda){return _0x5d6756[_0x9bf4('0x4c')](0x1f4)[_0x9bf4('0x67')](_0x5cecda);});};exports['retrieveApiKey']=function(_0x2fb7a0){if(_[_0x9bf4('0x68')](_0x2fb7a0['apiKeyNonce'])||_[_0x9bf4('0x68')](_0x2fb7a0[_0x9bf4('0x69')])){return null;}else{return createJwt(_0x2fb7a0);}};exports['generateApiKey']=function(_0x38d43f){_0x38d43f[_0x9bf4('0x56')]=generateNonce();_0x38d43f[_0x9bf4('0x69')]=generateIssuedAt();return createJwt(_0x38d43f);};exports[_0x9bf4('0x6a')]=function(_0x75fce8,_0x24334b){var _0x3d729e=_0x75fce8['query'][_0x9bf4('0x4f')];if(_0x3d729e){var _0x5b9862={'nonce':_0x24334b['apiKeyNonce'],'iat':_0x24334b[_0x9bf4('0x69')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x9bf4('0x50')]()};return verifyJwt(_0x3d729e,_0x5b9862)[_0x9bf4('0x47')](function(){return generateApiKey(_0x24334b);});}else{throw{'message':_0x9bf4('0x6b')};}};exports['validatePasswordPattern']=function(_0x3e60de){var _0xa20ec5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xa20ec5[_0x9bf4('0x6c')](_0x3e60de))throw new db[(_0x9bf4('0x6d'))][(_0x9bf4('0x6e'))](_0x9bf4('0x6f'));return;};exports[_0x9bf4('0x70')]=function(_0x3fc29a,_0x4318a4,_0xecc48c){var _0x2b751e=encryptor[_0x9bf4('0x71')](_0x4318a4)[_0x9bf4('0x72')](',');for(var _0x960b81=0x0;_0x960b81<_0xecc48c;_0x960b81++){if(!_0x2b751e[_0x960b81])break;if(_0x3fc29a['toLowerCase']()===_0x2b751e[_0x960b81][_0x9bf4('0x73')]()){var _0x9f41f7=util[_0x9bf4('0x74')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0xecc48c);if(_0xecc48c===0x1){_0x9f41f7='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db['Sequelize'][(_0x9bf4('0x6e'))](_0x9f41f7);}}return;};exports[_0x9bf4('0x75')]=function(_0xfc46a9,_0x318bbd){var _0x25f59e=_0x318bbd?encryptor[_0x9bf4('0x71')](_0x318bbd)[_0x9bf4('0x72')](','):[];if(_0x25f59e[_0x9bf4('0x76')]===0x5){_0x25f59e[_0x9bf4('0x77')](-0x1,0x1);}_0x25f59e[_0x9bf4('0x78')](_0xfc46a9);return encryptor['encryptString'](_0x25f59e['join'](','));};function signJwt(_0x4d0c5d){var _0x27e4aa=BPromise['promisify'](jwt[_0x9bf4('0x79')],{'context':jwt});var _0x4e0b3c=_0x4d0c5d['secret']||config['secrets'][_0x9bf4('0x7a')];return new BPromise(function(_0x5743c0,_0x46fdc2){_0x27e4aa(_0x4d0c5d['payload'],_0x4e0b3c,_0x4d0c5d[_0x9bf4('0x7b')])[_0x9bf4('0x47')](function(_0x1aee50){_0x5743c0(_0x1aee50);})[_0x9bf4('0x41')](function(_0x3495c2){_0x46fdc2(_0x3495c2);});});}function verifyJwt(_0x772a71,_0x1e4127,_0x5050e2){var _0x2c25f1=BPromise[_0x9bf4('0x7c')](jwt[_0x9bf4('0x7d')],{'context':jwt});var _0x7d106d=_0x5050e2||config[_0x9bf4('0xa')][_0x9bf4('0x7a')];return new BPromise(function(_0x310d93,_0x486a83){_0x2c25f1(_0x772a71,_0x7d106d,_0x1e4127)['then'](function(_0x3ab6af){_0x310d93(_0x3ab6af);})[_0x9bf4('0x41')](function(_0x26ad00){_0x486a83(_0x26ad00);});});}function generateNonce(){return crypto[_0x9bf4('0x7e')](0x10)[_0x9bf4('0x7f')](_0x9bf4('0x80'));}function generateIssuedAt(){return Math['floor'](Date[_0x9bf4('0x81')]()/0x3e8)[_0x9bf4('0x7f')]();}function createJwt(_0x37a64a){var _0x39409f={'payload':{'iat':_0x37a64a[_0x9bf4('0x69')],'nonce':_0x37a64a['apiKeyNonce']},'options':{'algorithm':_0x9bf4('0x82'),'subject':_0x37a64a['id'][_0x9bf4('0x7f')](),'issuer':hardwareConf[_0x9bf4('0x50')](),'audience':hardwareConf[_0x9bf4('0x50')]()}};return signJwt(_0x39409f)[_0x9bf4('0x47')](function(_0x4c739f){return{'iat':_0x37a64a[_0x9bf4('0x69')],'nonce':_0x37a64a[_0x9bf4('0x56')],'token':_0x4c739f};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index bc8468d..9b7de2d 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 _0xeba7=['lodash','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','user','tags','skip','checkListsRestrictions','ids','tag','countFilteredContacts','User','buildContactsQuery','fields','getFilteredContacts','rows','catch','CmContact','describe','keys','filter','cf_','map','CmCustomField','findOne','slice','all','length','fieldType','type'];(function(_0x261d05,_0x48cbb2){var _0x2684cd=function(_0xd47565){while(--_0xd47565){_0x261d05['push'](_0x261d05['shift']());}};_0x2684cd(++_0x48cbb2);}(_0xeba7,0x1e1));var _0x7eba=function(_0x526f57,_0x3949e5){_0x526f57=_0x526f57-0x0;var _0x2f8a22=_0xeba7[_0x526f57];return _0x2f8a22;};'use strict';var _=require(_0x7eba('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0x7eba('0x1'))['db'];exports[_0x7eba('0x2')]=function(_0x4ee6f4,_0x1a3260,_0x16c568,_0x193918){var _0x211469={'count':0x0,'rows':[]};var _0x353245=sqlUtils[_0x7eba('0x3')](_0x1a3260,_0x4ee6f4);if(_0x353245){return Promise[_0x7eba('0x4')](_0x211469);}var _0x13de34=sqlUtils[_0x7eba('0x5')]();var _0x1013b8={};var _0x12fc32=![];var _0x3afb8b=![];return Promise[_0x7eba('0x4')]()[_0x7eba('0x6')](function(){if(_0x4ee6f4[_0x7eba('0x7')]){return sqlUtils[_0x7eba('0x8')](_0x4ee6f4[_0x7eba('0x7')],_0x193918);}else{return sqlUtils[_0x7eba('0x9')](_0x4ee6f4,_0x193918);}})[_0x7eba('0x6')](function(_0x6803be){_0x13de34[_0x7eba('0xa')](_0x6803be['default']);_0x13de34[_0x7eba('0xa')](_0x6803be['fields']);_0x13de34[_0x7eba('0xa')](_0x6803be['filter']);_0x13de34['where'](_0x6803be[_0x7eba('0xb')]['clause']);_0x1013b8=_0x6803be[_0x7eba('0xc')];_0x3afb8b=_0x6803be[_0x7eba('0xb')][_0x7eba('0xd')];return sqlUtils[_0x7eba('0xe')](_0x1a3260,_0x4ee6f4,_0x3afb8b);})['then'](function(_0x4fdf68){_0x13de34['where'](_0x4fdf68);var _0x200fa7=_0x4ee6f4['search']?_0x1013b8[_0x7eba('0xf')]:_0x4ee6f4[_0x7eba('0x10')];_0x12fc32=_0x200fa7?!![]:![];return sqlUtils[_0x7eba('0x11')](_0x13de34,_0x200fa7);})[_0x7eba('0x6')](function(_0x89f991){_0x211469['count']=_0x89f991;if(_0x211469['count']===0x0){return;}if(_0x4ee6f4[_0x7eba('0x12')]){_0x3afb8b=!![];}return sqlUtils[_0x7eba('0x13')](_0x13de34,_0x4ee6f4[_0x7eba('0x14')],_0x16c568,_0x12fc32,_0x1013b8['clause'],_0x3afb8b);})[_0x7eba('0x6')](function(_0x48a6bf){if(!_0x48a6bf){return[];}return sqlUtils[_0x7eba('0x15')](_0x48a6bf,_0x4ee6f4,_0x16c568);})[_0x7eba('0x6')](function(_0x582226){_0x211469[_0x7eba('0x16')]=_0x582226;return _0x211469;})[_0x7eba('0x17')](function(_0x2bce58){throw _0x2bce58;});};exports['describe']=function(){var _0x43a51f={};var _0x494e32=[];return db[_0x7eba('0x18')][_0x7eba('0x19')]()[_0x7eba('0x6')](function(_0x552b7e){_0x43a51f=_0x552b7e;var _0x901c33=Object[_0x7eba('0x1a')](_0x43a51f)[_0x7eba('0x1b')](function(_0x3fe00e){return _['startsWith'](_0x3fe00e,_0x7eba('0x1c'))?_0x3fe00e:undefined;});var _0x15065c=_0x901c33[_0x7eba('0x1d')](function(_0x35bf62){return db[_0x7eba('0x1e')][_0x7eba('0x1f')]({'where':{'id':_0x35bf62[_0x7eba('0x20')](0x3)},'raw':!![]});});return Promise[_0x7eba('0x21')](_0x15065c);})[_0x7eba('0x6')](function(_0x5c96e3){for(var _0x284a83=0x0;_0x284a83<_0x5c96e3[_0x7eba('0x22')];_0x284a83++){if(_0x5c96e3[_0x284a83]){var _0x2d4332=_0x7eba('0x1c')+_0x5c96e3[_0x284a83]['id'];_0x43a51f[_0x2d4332][_0x7eba('0x23')]=_0x5c96e3[_0x284a83][_0x7eba('0x24')];}}_0x494e32=_[_0x7eba('0x1d')](Object[_0x7eba('0x1a')](_0x43a51f),function(_0x3f2d0d){return{'name':_0x3f2d0d,'type':_0x43a51f[_0x3f2d0d][_0x7eba('0x24')]};});return _0x494e32;})[_0x7eba('0x17')](function(_0x4c01b2){throw _0x4c01b2;});}; \ No newline at end of file +var _0xa014=['findAll','getContactsSubquery','resolve','parseAdvancedSearchFilter','search','then','where','default','fields','clause','tags','user','skip','checkListsRestrictions','ids','countFilteredContacts','count','User','buildContactsQuery','getFilteredContacts','rows','catch','describe','keys','filter','startsWith','cf_','map','CmCustomField','findOne','slice','all','fieldType','type','lodash','../../mysqldb'];(function(_0x4adc5e,_0x74995){var _0x1cebda=function(_0x435398){while(--_0x435398){_0x4adc5e['push'](_0x4adc5e['shift']());}};_0x1cebda(++_0x74995);}(_0xa014,0x8e));var _0x4a01=function(_0xfd28b7,_0x5afeca){_0xfd28b7=_0xfd28b7-0x0;var _0x158668=_0xa014[_0xfd28b7];return _0x158668;};'use strict';var _=require(_0x4a01('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0x4a01('0x1'))['db'];exports[_0x4a01('0x2')]=function(_0x49e2ab,_0x8e1c22,_0xce9e8c,_0x4ad987){var _0x16c8f8={'count':0x0,'rows':[]};var _0x4551fd=sqlUtils['skipContactsQuery'](_0x8e1c22,_0x49e2ab);if(_0x4551fd){return Promise['resolve'](_0x16c8f8);}var _0x5d25b3=sqlUtils[_0x4a01('0x3')]();var _0x54ddc3={};var _0x228a4d=![];var _0x99bed6=![];return Promise[_0x4a01('0x4')]()['then'](function(){if(_0x49e2ab['search']){return sqlUtils[_0x4a01('0x5')](_0x49e2ab[_0x4a01('0x6')],_0x4ad987);}else{return sqlUtils['parseQueryParameters'](_0x49e2ab,_0x4ad987);}})[_0x4a01('0x7')](function(_0x5dfcd8){_0x5d25b3[_0x4a01('0x8')](_0x5dfcd8[_0x4a01('0x9')]);_0x5d25b3['where'](_0x5dfcd8[_0x4a01('0xa')]);_0x5d25b3[_0x4a01('0x8')](_0x5dfcd8['filter']);_0x5d25b3[_0x4a01('0x8')](_0x5dfcd8['user'][_0x4a01('0xb')]);_0x54ddc3=_0x5dfcd8[_0x4a01('0xc')];_0x99bed6=_0x5dfcd8[_0x4a01('0xd')][_0x4a01('0xe')];return sqlUtils[_0x4a01('0xf')](_0x8e1c22,_0x49e2ab,_0x99bed6);})[_0x4a01('0x7')](function(_0xd735a7){_0x5d25b3[_0x4a01('0x8')](_0xd735a7);var _0xd1eedd=_0x49e2ab[_0x4a01('0x6')]?_0x54ddc3[_0x4a01('0x10')]:_0x49e2ab['tag'];_0x228a4d=_0xd1eedd?!![]:![];return sqlUtils[_0x4a01('0x11')](_0x5d25b3,_0xd1eedd);})[_0x4a01('0x7')](function(_0x193dff){_0x16c8f8[_0x4a01('0x12')]=_0x193dff;if(_0x16c8f8[_0x4a01('0x12')]===0x0){return;}if(_0x49e2ab[_0x4a01('0x13')]){_0x99bed6=!![];}return sqlUtils[_0x4a01('0x14')](_0x5d25b3,_0x49e2ab['fields'],_0xce9e8c,_0x228a4d,_0x54ddc3[_0x4a01('0xb')],_0x99bed6);})[_0x4a01('0x7')](function(_0x1026f3){if(!_0x1026f3){return[];}return sqlUtils[_0x4a01('0x15')](_0x1026f3,_0x49e2ab,_0xce9e8c);})[_0x4a01('0x7')](function(_0x202bb1){_0x16c8f8[_0x4a01('0x16')]=_0x202bb1;return _0x16c8f8;})[_0x4a01('0x17')](function(_0x4601dd){throw _0x4601dd;});};exports[_0x4a01('0x18')]=function(){var _0x31cc35={};var _0x524fa6=[];return db['CmContact'][_0x4a01('0x18')]()[_0x4a01('0x7')](function(_0x3544eb){_0x31cc35=_0x3544eb;var _0x3e1f41=Object[_0x4a01('0x19')](_0x31cc35)[_0x4a01('0x1a')](function(_0x915f1d){return _[_0x4a01('0x1b')](_0x915f1d,_0x4a01('0x1c'))?_0x915f1d:undefined;});var _0x5c9226=_0x3e1f41[_0x4a01('0x1d')](function(_0x3a3459){return db[_0x4a01('0x1e')][_0x4a01('0x1f')]({'where':{'id':_0x3a3459[_0x4a01('0x20')](0x3)},'raw':!![]});});return Promise[_0x4a01('0x21')](_0x5c9226);})[_0x4a01('0x7')](function(_0x360a1b){for(var _0x3a16cc=0x0;_0x3a16cc<_0x360a1b['length'];_0x3a16cc++){if(_0x360a1b[_0x3a16cc]){var _0x4042e0='cf_'+_0x360a1b[_0x3a16cc]['id'];_0x31cc35[_0x4042e0][_0x4a01('0x22')]=_0x360a1b[_0x3a16cc][_0x4a01('0x23')];}}_0x524fa6=_[_0x4a01('0x1d')](Object['keys'](_0x31cc35),function(_0x24939b){return{'name':_0x24939b,'type':_0x31cc35[_0x24939b][_0x4a01('0x23')]};});return _0x524fa6;})['catch'](function(_0x78f6ba){throw _0x78f6ba;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 55344bf..5b82b98 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 _0x891c=['SELECT','CmContact','sequelize','query','Tags','clone','COUNT(*)','getSelectedTags','isEmpty','t.id\x20IN\x20?','Sequelize','toString','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','agent','ListId','true','from','cm_contacts','where','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','fax','CompanyId','createdAt','deletedAt','TagIds','forEach','field','expr','replace','escapeLIKESpecialChars','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?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','fieldType','datetime','castTo','buildExpression','default','text','value','start','end','Tag','map','tags','clause','and','ids','uc.UserId\x20=\x20?','user','skip','keys','some','compact','push','Contact','User','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','search','role','getLists','c.ListId\x20IS\x20NULL','attributes','select','group','c.id','limit','offset','order','DESC','findAll','color','keyBy','QueryTypes'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x891c,0x1cc));var _0xc891=function(_0x56fcd0,_0x1aa69f){_0x56fcd0=_0x56fcd0-0x0;var _0x3bbb8d=_0x891c[_0x56fcd0];return _0x3bbb8d;};'use strict';var _=require(_0xc891('0x0'));var squel=require(_0xc891('0x1'));var as=require(_0xc891('0x2'));var qs=require(_0xc891('0x3'));var utils=require(_0xc891('0x4'));var db=require(_0xc891('0x5'))['db'];function skipContactsQuery(_0x39fa07,_0x383fca){var _0x5b41ff=![];if(_0x39fa07['role']===_0xc891('0x6')&&!_0x383fca['search']&&!_0x383fca[_0xc891('0x7')]&&_0x383fca['autocomplete']!==_0xc891('0x8')){_0x5b41ff=!![];}return _0x5b41ff;}function getContactsSubquery(){return squel['select']()[_0xc891('0x9')](_0xc891('0xa'),'c')[_0xc891('0xb')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x1dc523,_0x2cbe44){var _0x53b8cb=_0x2cbe44?'c':_0xc891('0xc');_0x1dc523[_0xc891('0xd')](_0xc891('0xe'),'uc',_0xc891('0xf')+_0x53b8cb+_0xc891('0x10'))[_0xc891('0xd')](_0xc891('0x11'),'ct',_0xc891('0x12')+_0x53b8cb+_0xc891('0x10'))[_0xc891('0xd')](_0xc891('0x13'),'t',_0xc891('0x14'));return _0x1dc523;}function addFieldsToQuery(_0x120ac4,_0x230358,_0x3907ea,_0x148ae7,_0x35e802){var _0x544568=_0x35e802?'c':_0xc891('0xc');if(!_0x230358){_0x230358=['id',_0xc891('0x15'),_0xc891('0x16'),_0xc891('0x17'),_0xc891('0x18'),_0xc891('0x19'),'email',_0xc891('0x7'),_0xc891('0x1a'),_0xc891('0x1b'),'updatedAt',_0xc891('0x1c'),_0xc891('0x1d')];}else if(!_0x230358['includes']('id')){_0x230358['push']('id');}var _0x596292=_0x3907ea&&_0x35e802||!_0x3907ea&&!_0x35e802;if(_0x148ae7){_0x596292=_0x148ae7&&_0x35e802||!_0x148ae7&&!_0x35e802;}_0x230358[_0xc891('0x1e')](function(_0x241bcf){if(_0x241bcf===_0xc891('0x1d')){if(_0x596292){_0x120ac4[_0xc891('0x1f')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x241bcf);}else if(_0x3907ea||_0x148ae7){_0x120ac4[_0xc891('0x1f')](_0x544568+'.'+_0x241bcf);}}else{_0x120ac4['field'](_0x544568+'.'+_0x241bcf);}});return _0x120ac4;}function getSqlClauses(){var _0x209b12={'default':squel[_0xc891('0x20')](),'fields':squel['expr'](),'filter':squel['expr'](),'tags':{'clause':squel[_0xc891('0x20')](),'ids':null},'user':{'clause':squel[_0xc891('0x20')](),'skip':![]}};return _0x209b12;}function parseTagParameter(_0x22b9ba){var _0x3dbba8=squel[_0xc891('0x20')]();if(_0x22b9ba){var _0xdeba5d=utils['getSelectedTags'](_0x22b9ba);_0xdeba5d['forEach'](function(_0x32a316){_0x3dbba8['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x32a316+',%');});}return _0x3dbba8;}function parseSearchFilter(_0x2e91d6){var _0x141b04=squel[_0xc891('0x20')]();if(_0x2e91d6){var _0x3b9114=_0x2e91d6[_0xc891('0x21')]('\x5c','\x5c\x5c')[_0xc891('0x21')](/'/g,'\x27\x27');var _0x2684b1=qs[_0xc891('0x22')](_0x3b9114);if(_0x3b9114[_0xc891('0x23')]('\x20')[_0xc891('0x24')]>0x1){_0x141b04['or'](_0xc891('0x25'),qs[_0xc891('0x26')](_0x3b9114,!![]),null);}else{if(qs[_0xc891('0x27')](_0x3b9114)){_0x141b04['or'](_0xc891('0x28'),_0x2684b1+'%');_0x141b04['or']('c.phone\x20LIKE\x20?',_0x2684b1+'%');_0x141b04['or'](_0xc891('0x29'),_0x2684b1+'%');_0x141b04['or'](_0xc891('0x2a'),_0x2684b1+'%');}else if(qs['isEmail'](_0x3b9114)){_0x141b04['or'](_0xc891('0x2b'),_0x2684b1+'%');}else{_0x141b04['or'](_0xc891('0x2c'),'%'+_0x2684b1+'%');_0x141b04['or'](_0xc891('0x2d'),'%'+_0x2684b1+'%');_0x141b04['or'](_0xc891('0x2b'),'%'+_0x2684b1+'%');}}}return _0x141b04;}function parseAdvancedSearchFilter(_0x279bf2,_0x17321a){var _0x41f4cd=getSqlClauses();var _0x21b1a9=as[_0xc891('0x2e')](_0x279bf2);var _0x3db2d6=_0x21b1a9[_0xc891('0x2f')];for(var _0xe61da9=0x0;_0xe61da9<_0x21b1a9[_0xc891('0x30')][_0xc891('0x24')];_0xe61da9++){var _0x387e88=_0x21b1a9['conditions'][_0xe61da9];var _0x47f29d='c';var _0x34a0d6=_[_0xc891('0x31')](_0x17321a,[_0xc891('0x32'),_0x387e88[_0xc891('0x1f')]]);if(_0x34a0d6){if(_0x387e88[_0xc891('0x1f')]===_0xc891('0x33')||_0x34a0d6[_0xc891('0x34')]===_0xc891('0x35')){_0x387e88[_0xc891('0x36')]='DATE';}var _0x1ed6c6=as[_0xc891('0x37')](_0x47f29d,_0x34a0d6['type'],_0x387e88);_0x41f4cd[_0xc891('0x38')][_0x3db2d6](_0x1ed6c6[_0xc891('0x39')],_0x1ed6c6[_0xc891('0x3a')][_0xc891('0x3b')],_0x1ed6c6[_0xc891('0x3a')][_0xc891('0x3c')]);}else{if(_0x387e88[_0xc891('0x1f')]===_0xc891('0x3d')){var _0x176c34=_0x387e88[_0xc891('0x3a')]['split'](',')[_0xc891('0x3e')](function(_0x45e46b){return Number(_0x45e46b);});var _0x47a8e7=parseTagParameter(_0x176c34);_0x41f4cd[_0xc891('0x3f')][_0xc891('0x40')][_0xc891('0x41')](_0x47a8e7);_0x41f4cd[_0xc891('0x3f')][_0xc891('0x42')]=_0x176c34;}else if(_0x387e88[_0xc891('0x1f')]==='User'){_0x41f4cd['user'][_0xc891('0x40')][_0xc891('0x41')](_0xc891('0x43'),_0x387e88[_0xc891('0x3a')]);_0x41f4cd[_0xc891('0x44')][_0xc891('0x45')]=!![];}}}return _0x41f4cd;}function parseModelFields(_0x3a50d1,_0x3c3b2e){var _0x5a65c4=squel[_0xc891('0x20')]();var _0x2b78c7=_(_0x3a50d1)[_0xc891('0x46')]()[_0xc891('0x3e')](function(_0x203433){return _[_0xc891('0x47')](_0x3c3b2e,[_0xc891('0x32'),_0x203433])?_0x203433:undefined;})[_0xc891('0x48')]()[_0xc891('0x3a')]();if(_0x3a50d1['Contact']){_0x2b78c7[_0xc891('0x49')](_0xc891('0x4a'));}if(_0x3a50d1[_0xc891('0x4b')]){_0x2b78c7[_0xc891('0x49')](_0xc891('0x4b'));}if(_0x2b78c7[_0xc891('0x24')]>0x0){_0x2b78c7[_0xc891('0x1e')](function(_0x49fb7b){if(_0x49fb7b===_0xc891('0x7')){_0x5a65c4[_0xc891('0x41')](_0xc891('0x4c'),[]['concat'](_0x3a50d1[_0x49fb7b]));}else if(_0x49fb7b===_0xc891('0x4a')){var _0xa2451='%'+_0x3a50d1[_0x49fb7b]+'%';_0x5a65c4[_0xc891('0x41')](_0xc891('0x4d'),_0xa2451);}else if(_0x49fb7b===_0xc891('0x4b')){_0x5a65c4[_0xc891('0x41')](_0xc891('0x43'),_0x3a50d1[_0x49fb7b]);}else{_0x5a65c4[_0xc891('0x41')]('c.'+_0x49fb7b+_0xc891('0x4e'),_0x3a50d1[_0x49fb7b]);}});}return _0x5a65c4;}function parseQueryParameters(_0x5ee9f1,_0x4cc925){var _0x2a1808=getSqlClauses();return Promise[_0xc891('0x4f')]()[_0xc891('0x50')](function(){return parseModelFields(_0x5ee9f1,_0x4cc925);})[_0xc891('0x50')](function(_0x31e774){_0x2a1808[_0xc891('0x51')][_0xc891('0x41')](_0x31e774);return parseTagParameter(_0x5ee9f1[_0xc891('0x52')]);})['then'](function(_0x557214){_0x2a1808[_0xc891('0x3f')]['clause'][_0xc891('0x41')](_0x557214);return parseSearchFilter(_0x5ee9f1[_0xc891('0x53')]);})['then'](function(_0x1573f4){_0x2a1808[_0xc891('0x53')]=_0x1573f4;return _0x2a1808;});}function checkListsRestrictions(_0x500c11,_0x419bb1,_0x53decb){var _0x44ca5d=squel[_0xc891('0x20')]();return Promise['resolve']()[_0xc891('0x50')](function(){if(_0x419bb1[_0xc891('0x54')]&&_0x500c11[_0xc891('0x55')]===_0xc891('0x6')&&!_0x53decb){return _0x500c11[_0xc891('0x56')]({'attributes':['id'],'raw':!![]});}})[_0xc891('0x50')](function(_0x47a471){if(_0x47a471){if(_0x47a471[_0xc891('0x24')]===0x0){_0x44ca5d['and'](_0xc891('0x57'));}else{_0x44ca5d['and']('c.ListId\x20IN\x20?',_[_0xc891('0x3e')](_0x47a471,'id'));}}})[_0xc891('0x50')](function(){return _0x44ca5d;});}function buildContactsQuery(_0x1e4e61,_0x2ed08a,_0x2ebb20,_0x120620,_0x1ec950,_0x508384){if(_0x2ed08a){_0x2ed08a=_0x2ebb20[_0xc891('0x58')];}_0x1e4e61=addFieldsToQuery(_0x1e4e61,_0x2ed08a,_0x120620,_0x508384,!![]);var _0x2b19e2=squel[_0xc891('0x59')]();_0x2b19e2=addFieldsToQuery(_0x2b19e2,_0x2ed08a,_0x120620,_0x508384,![]);if(_0x120620||_0x508384){_0x1e4e61=applyJoinClauses(_0x1e4e61,!![]);_0x1e4e61[_0xc891('0x5a')](_0xc891('0x5b'));if(_0x2ebb20[_0xc891('0x5c')]){_0x2b19e2[_0xc891('0x5c')](_0x2ebb20[_0xc891('0x5c')]);}if(_0x2ebb20['offset']){_0x2b19e2[_0xc891('0x5d')](_0x2ebb20[_0xc891('0x5d')]);}}else{_0x2b19e2=applyJoinClauses(_0x2b19e2,![]);_0x2b19e2[_0xc891('0x5a')]('subqry.id');if(_0x2ebb20[_0xc891('0x5c')]){_0x1e4e61[_0xc891('0x5c')](_0x2ebb20[_0xc891('0x5c')]);}if(_0x2ebb20[_0xc891('0x5d')]){_0x1e4e61[_0xc891('0x5d')](_0x2ebb20[_0xc891('0x5d')]);}}_0x2b19e2['having'](_0x1ec950);if(_0x2ebb20[_0xc891('0x5e')]){_0x2ebb20[_0xc891('0x5e')][_0xc891('0x1e')](function(_0x43c9c4){_0x1e4e61[_0xc891('0x5e')]('c.'+_0x43c9c4[0x0],_0x43c9c4[0x1]===_0xc891('0x5f')?![]:!![]);_0x2b19e2[_0xc891('0x5e')]('subqry.'+_0x43c9c4[0x0],_0x43c9c4[0x1]===_0xc891('0x5f')?![]:!![]);});}_0x2b19e2[_0xc891('0x9')](_0x1e4e61,_0xc891('0xc'));return _0x2b19e2;}function getFilteredContacts(_0x56ac92){var _0xa26d3e=[];return db[_0xc891('0x3d')][_0xc891('0x60')]({'attributes':['id',_0xc891('0x32'),_0xc891('0x61')],'raw':!![]})['then'](function(_0x3220a7){_0xa26d3e=_[_0xc891('0x62')](_0x3220a7,'id');var _0x4bc4d8={'type':db['Sequelize'][_0xc891('0x63')][_0xc891('0x64')],'model':db[_0xc891('0x65')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xc891('0x66')][_0xc891('0x67')](_0x56ac92['toString'](),_0x4bc4d8);})[_0xc891('0x50')](function(_0xee0310){_0xee0310[_0xc891('0x1e')](function(_0x1fd92a){if(_0x1fd92a['TagIds']){_0x1fd92a[_0xc891('0x68')]=[];_0x1fd92a[_0xc891('0x1d')][_0xc891('0x23')](',')[_0xc891('0x1e')](function(_0x4fc025){_0x1fd92a[_0xc891('0x68')][_0xc891('0x49')](_0xa26d3e[_0x4fc025]);});}delete _0x1fd92a['TagIds'];});return _0xee0310;});}function countFilteredContacts(_0x1c9da2,_0x1e3f20){var _0x88468a=_0x1c9da2[_0xc891('0x69')]();_0x88468a[_0xc891('0x1f')](_0xc891('0x6a'));_0x88468a=applyJoinClauses(_0x88468a,!![]);_0x1c9da2[_0xc891('0x5a')]('c.id');var _0x4a5bd3=utils[_0xc891('0x6b')](_0x1e3f20);if(!_[_0xc891('0x6c')](_0x4a5bd3)){_0x88468a[_0xc891('0xb')](_0xc891('0x6d'),_0x4a5bd3);}var _0x115ac5={'type':db[_0xc891('0x6e')][_0xc891('0x63')]['SELECT'],'raw':!![]};return db[_0xc891('0x66')][_0xc891('0x67')](_0x88468a[_0xc891('0x6f')](),_0x115ac5)[_0xc891('0x50')](function(_0x151c98){return _0x151c98[0x0][_0xc891('0x6a')];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x6062=['escapeLIKESpecialChars','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.email\x20LIKE\x20?','conditions','length','dateOfBirth','fieldType','castTo','buildExpression','type','default','text','value','end','Tag','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','keys','map','name','compact','Contact','ListId','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','resolve','then','fields','tag','filter','search','getLists','group','c.id','limit','offset','order','DESC','subqry.','from','findAll','color','Sequelize','QueryTypes','CmContact','query','toString','Tags','clone','COUNT(*)','getSelectedTags','t.id\x20IN\x20?','SELECT','sequelize','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','role','agent','autocomplete','true','select','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','firstName','lastName','phone','mobile','fax','email','CompanyId','createdAt','updatedAt','TagIds','includes','push','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace'];(function(_0x14148e,_0x4d91d1){var _0x410bb6=function(_0x48c50c){while(--_0x48c50c){_0x14148e['push'](_0x14148e['shift']());}};_0x410bb6(++_0x4d91d1);}(_0x6062,0x1dd));var _0x2606=function(_0x25cce5,_0x5647cd){_0x25cce5=_0x25cce5-0x0;var _0x1d2384=_0x6062[_0x25cce5];return _0x1d2384;};'use strict';var _=require(_0x2606('0x0'));var squel=require(_0x2606('0x1'));var as=require(_0x2606('0x2'));var qs=require(_0x2606('0x3'));var utils=require('../interaction/utils');var db=require('../../mysqldb')['db'];function skipContactsQuery(_0xacbced,_0x25c1c3){var _0x42bf3c=![];if(_0xacbced[_0x2606('0x4')]===_0x2606('0x5')&&!_0x25c1c3['search']&&!_0x25c1c3['ListId']&&_0x25c1c3[_0x2606('0x6')]!==_0x2606('0x7')){_0x42bf3c=!![];}return _0x42bf3c;}function getContactsSubquery(){return squel[_0x2606('0x8')]()['from'](_0x2606('0x9'),'c')[_0x2606('0xa')](_0x2606('0xb'));}function applyJoinClauses(_0x5064b5,_0x403c56){var _0x3d541f=_0x403c56?'c':_0x2606('0xc');_0x5064b5['left_join'](_0x2606('0xd'),'uc',_0x2606('0xe')+_0x3d541f+_0x2606('0xf'))[_0x2606('0x10')](_0x2606('0x11'),'ct',_0x2606('0x12')+_0x3d541f+'.id')[_0x2606('0x10')](_0x2606('0x13'),'t','t.id\x20=\x20ct.TagId');return _0x5064b5;}function addFieldsToQuery(_0x2f116c,_0x473633,_0x24ced7,_0x5e7e41,_0x1962ec){var _0x4d20d7=_0x1962ec?'c':'subqry';if(!_0x473633){_0x473633=['id',_0x2606('0x14'),_0x2606('0x15'),_0x2606('0x16'),_0x2606('0x17'),_0x2606('0x18'),_0x2606('0x19'),'ListId',_0x2606('0x1a'),_0x2606('0x1b'),_0x2606('0x1c'),'deletedAt',_0x2606('0x1d')];}else if(!_0x473633[_0x2606('0x1e')]('id')){_0x473633[_0x2606('0x1f')]('id');}var _0x12df9b=_0x24ced7&&_0x1962ec||!_0x24ced7&&!_0x1962ec;if(_0x5e7e41){_0x12df9b=_0x5e7e41&&_0x1962ec||!_0x5e7e41&&!_0x1962ec;}_0x473633[_0x2606('0x20')](function(_0x4d60fe){if(_0x4d60fe===_0x2606('0x1d')){if(_0x12df9b){_0x2f116c['field'](_0x2606('0x21'),_0x4d60fe);}else if(_0x24ced7||_0x5e7e41){_0x2f116c[_0x2606('0x22')](_0x4d20d7+'.'+_0x4d60fe);}}else{_0x2f116c[_0x2606('0x22')](_0x4d20d7+'.'+_0x4d60fe);}});return _0x2f116c;}function getSqlClauses(){var _0x16c277={'default':squel[_0x2606('0x23')](),'fields':squel[_0x2606('0x23')](),'filter':squel[_0x2606('0x23')](),'tags':{'clause':squel[_0x2606('0x23')](),'ids':null},'user':{'clause':squel[_0x2606('0x23')](),'skip':![]}};return _0x16c277;}function parseTagParameter(_0x281761){var _0x2dc8d2=squel[_0x2606('0x23')]();if(_0x281761){var _0x43791a=utils['getSelectedTags'](_0x281761);_0x43791a[_0x2606('0x20')](function(_0x2790ec){_0x2dc8d2['or'](_0x2606('0x24'),'%,'+_0x2790ec+',%');});}return _0x2dc8d2;}function parseSearchFilter(_0x12a983){var _0x56fc1b=squel[_0x2606('0x23')]();if(_0x12a983){var _0x50c9d8=_0x12a983[_0x2606('0x25')]('\x5c','\x5c\x5c')[_0x2606('0x25')](/'/g,'\x27\x27');var _0x140c5b=qs[_0x2606('0x26')](_0x50c9d8);if(_0x50c9d8[_0x2606('0x27')]('\x20')['length']>0x1){_0x56fc1b['or'](_0x2606('0x28'),qs[_0x2606('0x29')](_0x50c9d8,!![]),null);}else{if(qs['isNumeric'](_0x50c9d8)){_0x56fc1b['or'](_0x2606('0x2a'),_0x140c5b+'%');_0x56fc1b['or']('c.phone\x20LIKE\x20?',_0x140c5b+'%');_0x56fc1b['or']('c.mobile\x20LIKE\x20?',_0x140c5b+'%');_0x56fc1b['or'](_0x2606('0x2b'),_0x140c5b+'%');}else if(qs['isEmail'](_0x50c9d8)){_0x56fc1b['or']('c.email\x20LIKE\x20?',_0x140c5b+'%');}else{_0x56fc1b['or'](_0x2606('0x2c'),'%'+_0x140c5b+'%');_0x56fc1b['or']('c.lastName\x20LIKE\x20?','%'+_0x140c5b+'%');_0x56fc1b['or'](_0x2606('0x2d'),'%'+_0x140c5b+'%');}}}return _0x56fc1b;}function parseAdvancedSearchFilter(_0x457169,_0x4a9845){var _0x2f5c4c=getSqlClauses();var _0x352068=as['parseSearch'](_0x457169);var _0x25673c=_0x352068['sqlOperator'];for(var _0x37211b=0x0;_0x37211b<_0x352068[_0x2606('0x2e')][_0x2606('0x2f')];_0x37211b++){var _0x3f3872=_0x352068['conditions'][_0x37211b];var _0x163afd='c';var _0x585858=_['find'](_0x4a9845,['name',_0x3f3872[_0x2606('0x22')]]);if(_0x585858){if(_0x3f3872[_0x2606('0x22')]===_0x2606('0x30')||_0x585858[_0x2606('0x31')]==='datetime'){_0x3f3872[_0x2606('0x32')]='DATE';}var _0x564d08=as[_0x2606('0x33')](_0x163afd,_0x585858[_0x2606('0x34')],_0x3f3872);_0x2f5c4c[_0x2606('0x35')][_0x25673c](_0x564d08[_0x2606('0x36')],_0x564d08[_0x2606('0x37')]['start'],_0x564d08[_0x2606('0x37')][_0x2606('0x38')]);}else{if(_0x3f3872[_0x2606('0x22')]===_0x2606('0x39')){var _0x277b08=_0x3f3872[_0x2606('0x37')][_0x2606('0x27')](',')['map'](function(_0x37bf04){return Number(_0x37bf04);});var _0x3db04d=parseTagParameter(_0x277b08);_0x2f5c4c[_0x2606('0x3a')][_0x2606('0x3b')][_0x2606('0x3c')](_0x3db04d);_0x2f5c4c[_0x2606('0x3a')][_0x2606('0x3d')]=_0x277b08;}else if(_0x3f3872['field']===_0x2606('0x3e')){_0x2f5c4c[_0x2606('0x3f')]['clause'][_0x2606('0x3c')](_0x2606('0x40'),_0x3f3872[_0x2606('0x37')]);_0x2f5c4c[_0x2606('0x3f')]['skip']=!![];}}}return _0x2f5c4c;}function parseModelFields(_0x56f9c6,_0x42d94f){var _0x37d87b=squel[_0x2606('0x23')]();var _0x39783d=_(_0x56f9c6)[_0x2606('0x41')]()[_0x2606('0x42')](function(_0x16b23f){return _['some'](_0x42d94f,[_0x2606('0x43'),_0x16b23f])?_0x16b23f:undefined;})[_0x2606('0x44')]()[_0x2606('0x37')]();if(_0x56f9c6[_0x2606('0x45')]){_0x39783d[_0x2606('0x1f')](_0x2606('0x45'));}if(_0x56f9c6[_0x2606('0x3e')]){_0x39783d[_0x2606('0x1f')](_0x2606('0x3e'));}if(_0x39783d[_0x2606('0x2f')]>0x0){_0x39783d['forEach'](function(_0x31cc15){if(_0x31cc15===_0x2606('0x46')){_0x37d87b['and']('c.ListId\x20IN\x20?',[][_0x2606('0x47')](_0x56f9c6[_0x31cc15]));}else if(_0x31cc15===_0x2606('0x45')){var _0x4fadd9='%'+_0x56f9c6[_0x31cc15]+'%';_0x37d87b[_0x2606('0x3c')](_0x2606('0x48'),_0x4fadd9);}else if(_0x31cc15===_0x2606('0x3e')){_0x37d87b[_0x2606('0x3c')](_0x2606('0x40'),_0x56f9c6[_0x31cc15]);}else{_0x37d87b[_0x2606('0x3c')]('c.'+_0x31cc15+'\x20=\x20?',_0x56f9c6[_0x31cc15]);}});}return _0x37d87b;}function parseQueryParameters(_0x50f183,_0x4b93b2){var _0xf24b=getSqlClauses();return Promise[_0x2606('0x49')]()['then'](function(){return parseModelFields(_0x50f183,_0x4b93b2);})[_0x2606('0x4a')](function(_0x495d83){_0xf24b[_0x2606('0x4b')][_0x2606('0x3c')](_0x495d83);return parseTagParameter(_0x50f183[_0x2606('0x4c')]);})[_0x2606('0x4a')](function(_0x2abc70){_0xf24b[_0x2606('0x3a')][_0x2606('0x3b')][_0x2606('0x3c')](_0x2abc70);return parseSearchFilter(_0x50f183[_0x2606('0x4d')]);})[_0x2606('0x4a')](function(_0x1a8be5){_0xf24b[_0x2606('0x4d')]=_0x1a8be5;return _0xf24b;});}function checkListsRestrictions(_0x40197a,_0x35e822,_0x2d7e6e){var _0x121236=squel[_0x2606('0x23')]();return Promise['resolve']()['then'](function(){if(_0x35e822[_0x2606('0x4e')]&&_0x40197a[_0x2606('0x4')]==='agent'&&!_0x2d7e6e){return _0x40197a[_0x2606('0x4f')]({'attributes':['id'],'raw':!![]});}})[_0x2606('0x4a')](function(_0x27af57){if(_0x27af57){if(_0x27af57[_0x2606('0x2f')]===0x0){_0x121236['and']('c.ListId\x20IS\x20NULL');}else{_0x121236[_0x2606('0x3c')]('c.ListId\x20IN\x20?',_[_0x2606('0x42')](_0x27af57,'id'));}}})['then'](function(){return _0x121236;});}function buildContactsQuery(_0x58ab5d,_0x547ced,_0x17069c,_0x59a623,_0x59a3b0,_0x46f31e){if(_0x547ced){_0x547ced=_0x17069c['attributes'];}_0x58ab5d=addFieldsToQuery(_0x58ab5d,_0x547ced,_0x59a623,_0x46f31e,!![]);var _0x31a853=squel['select']();_0x31a853=addFieldsToQuery(_0x31a853,_0x547ced,_0x59a623,_0x46f31e,![]);if(_0x59a623||_0x46f31e){_0x58ab5d=applyJoinClauses(_0x58ab5d,!![]);_0x58ab5d[_0x2606('0x50')](_0x2606('0x51'));if(_0x17069c[_0x2606('0x52')]){_0x31a853[_0x2606('0x52')](_0x17069c[_0x2606('0x52')]);}if(_0x17069c[_0x2606('0x53')]){_0x31a853[_0x2606('0x53')](_0x17069c[_0x2606('0x53')]);}}else{_0x31a853=applyJoinClauses(_0x31a853,![]);_0x31a853[_0x2606('0x50')]('subqry.id');if(_0x17069c[_0x2606('0x52')]){_0x58ab5d['limit'](_0x17069c[_0x2606('0x52')]);}if(_0x17069c[_0x2606('0x53')]){_0x58ab5d['offset'](_0x17069c[_0x2606('0x53')]);}}_0x31a853['having'](_0x59a3b0);if(_0x17069c[_0x2606('0x54')]){_0x17069c[_0x2606('0x54')][_0x2606('0x20')](function(_0x4fb1c8){_0x58ab5d[_0x2606('0x54')]('c.'+_0x4fb1c8[0x0],_0x4fb1c8[0x1]===_0x2606('0x55')?![]:!![]);_0x31a853[_0x2606('0x54')](_0x2606('0x56')+_0x4fb1c8[0x0],_0x4fb1c8[0x1]==='DESC'?![]:!![]);});}_0x31a853[_0x2606('0x57')](_0x58ab5d,_0x2606('0xc'));return _0x31a853;}function getFilteredContacts(_0x4baf46){var _0x440b28=[];return db[_0x2606('0x39')][_0x2606('0x58')]({'attributes':['id',_0x2606('0x43'),_0x2606('0x59')],'raw':!![]})['then'](function(_0x3d2968){_0x440b28=_['keyBy'](_0x3d2968,'id');var _0x584021={'type':db[_0x2606('0x5a')][_0x2606('0x5b')]['SELECT'],'model':db[_0x2606('0x5c')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x2606('0x5d')](_0x4baf46[_0x2606('0x5e')](),_0x584021);})['then'](function(_0x5a644a){_0x5a644a[_0x2606('0x20')](function(_0x353dbe){if(_0x353dbe[_0x2606('0x1d')]){_0x353dbe[_0x2606('0x5f')]=[];_0x353dbe[_0x2606('0x1d')][_0x2606('0x27')](',')[_0x2606('0x20')](function(_0x4a1eac){_0x353dbe['Tags']['push'](_0x440b28[_0x4a1eac]);});}delete _0x353dbe[_0x2606('0x1d')];});return _0x5a644a;});}function countFilteredContacts(_0x11bf6c,_0x5656f1){var _0x250315=_0x11bf6c[_0x2606('0x60')]();_0x250315['field'](_0x2606('0x61'));_0x250315=applyJoinClauses(_0x250315,!![]);_0x11bf6c[_0x2606('0x50')](_0x2606('0x51'));var _0x274977=utils[_0x2606('0x62')](_0x5656f1);if(!_['isEmpty'](_0x274977)){_0x250315[_0x2606('0xa')](_0x2606('0x63'),_0x274977);}var _0x48ca3b={'type':db[_0x2606('0x5a')][_0x2606('0x5b')][_0x2606('0x64')],'raw':!![]};return db[_0x2606('0x65')]['query'](_0x250315[_0x2606('0x5e')](),_0x48ca3b)[_0x2606('0x4a')](function(_0x506350){return _0x506350[0x0][_0x2606('0x61')];});}module[_0x2606('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 ec3d925..5a56cd2 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 _0x806e=['is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createCipher','data','update','binary','final','write','end','close','unlink','decryptFile','createWriteStream','createDecipher','secret','base64','decryptString','utf8','crypto','bluebird','lodash','../../config/environment','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x806e,0x1a4));var _0xe806=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x806e[_0x20a584];return _0x4b41a8;};'use strict';var crypto=require(_0xe806('0x0'));var fs=require('fs');var BPromise=require(_0xe806('0x1'));var _=require(_0xe806('0x2'));var config=require(_0xe806('0x3'));var logger=require('../../config/logger')('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xe806('0x4')][_0xe806('0x5')],'algorithm':_0xe806('0x6')};const fileOptions={'algorithm':_0xe806('0x7')};if(config[_0xe806('0x8')]&&config['encrypt'][_0xe806('0x9')]){var isSupported=isAlgorithmSupported(config[_0xe806('0x8')][_0xe806('0x9')]);if(isSupported){fileOptions[_0xe806('0x9')]=config[_0xe806('0x8')][_0xe806('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xe806('0xa')](',\x20');logger[_0xe806('0xb')](config['encrypt'][_0xe806('0x9')],_0xe806('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x2d9a59){return AES_SUPPORTED_RX[_0xe806('0xd')](_0x2d9a59);}function getSupportedCiphers(){return crypto[_0xe806('0xe')]()[_0xe806('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0xc254d2){return getSupportedCiphers()[_0xe806('0x10')](_0xc254d2)>-0x1;}function combineOptions(_0x2d3eab){var _0x1e569b={};for(var _0x430ae6 in fileOptions){if(fileOptions[_0xe806('0x11')](_0x430ae6)){_0x1e569b[_0x430ae6]=fileOptions[_0x430ae6];}}if(_0x2d3eab){for(var _0x52637b in _0x2d3eab){if(_0x2d3eab['hasOwnProperty'](_0x52637b)){_0x1e569b[_0x52637b]=_0x2d3eab[_0x52637b];}}}return _0x1e569b;}exports[_0xe806('0x12')]=function(_0x1a5d9d,_0x523995,_0x5589fa,_0x220f94){return new BPromise(function(_0x54582a,_0x572b35){_0x220f94=combineOptions(_0x220f94);var _0x3b0df3=new Buffer(_0x5589fa);var _0x3c1d6b=fs[_0xe806('0x13')](_0x1a5d9d);var _0x3da871=fs['createWriteStream'](_0x523995);var _0x5c28c6=crypto[_0xe806('0x14')](_0x220f94[_0xe806('0x9')],_0x3b0df3);_0x3c1d6b['on'](_0xe806('0x15'),function(_0xaf6a48){var _0x49dc58=new Buffer(_0x5c28c6[_0xe806('0x16')](_0xaf6a48),_0xe806('0x17'));_0x3da871['write'](_0x49dc58);});_0x3c1d6b['on']('end',function(){try{var _0x3a1778=new Buffer(_0x5c28c6[_0xe806('0x18')](_0xe806('0x17')),_0xe806('0x17'));_0x3da871[_0xe806('0x19')](_0x3a1778);_0x3da871[_0xe806('0x1a')]();_0x3da871['on'](_0xe806('0x1b'),function(){return _0x54582a(_0x523995);});}catch(_0x317bb9){fs[_0xe806('0x1c')](_0x523995);return _0x572b35(_0x317bb9);}});});};exports[_0xe806('0x1d')]=function(_0x4314ec,_0x1944e7,_0x3276ce,_0xd2b6b0){return new BPromise(function(_0x55bf9f,_0x13c9a3){_0xd2b6b0=combineOptions(_0xd2b6b0);var _0xb3c30d=new Buffer(_0x3276ce);var _0x63ed6f=fs[_0xe806('0x13')](_0x4314ec);var _0x28e3fc=fs[_0xe806('0x1e')](_0x1944e7);var _0x274467=crypto[_0xe806('0x1f')](_0xd2b6b0[_0xe806('0x9')],_0xb3c30d);_0x63ed6f['on'](_0xe806('0x15'),function(_0x5660b5){var _0x5b5dec=new Buffer(_0x274467[_0xe806('0x16')](_0x5660b5),_0xe806('0x17'));_0x28e3fc[_0xe806('0x19')](_0x5b5dec);});_0x63ed6f['on'](_0xe806('0x1a'),function(){try{var _0xbf350c=new Buffer(_0x274467[_0xe806('0x18')](_0xe806('0x17')),_0xe806('0x17'));_0x28e3fc[_0xe806('0x19')](_0xbf350c);_0x28e3fc[_0xe806('0x1a')]();_0x28e3fc['on']('close',function(){return _0x55bf9f(_0x1944e7);});}catch(_0x271e03){fs['unlink'](_0x1944e7);return _0x13c9a3(_0x271e03);}});});};exports['encryptString']=function(_0x4b367f,_0x55c227,_0x114bd1){var _0x50d092=_0x114bd1||stringOptions['algorithm'];var _0x2f668a=_0x55c227||stringOptions[_0xe806('0x20')];var _0x1d1a70=crypto['createCipher'](_0x50d092,_0x2f668a);var _0x592242=_0x1d1a70[_0xe806('0x16')](_0x4b367f,'utf8','base64');_0x592242+=_0x1d1a70[_0xe806('0x18')](_0xe806('0x21'));return _0x592242;};exports[_0xe806('0x22')]=function(_0x2dd4c2,_0xb109f8,_0x5957d2){var _0x134de9=_0x5957d2||stringOptions[_0xe806('0x9')];var _0x5a8ba0=_0xb109f8||stringOptions[_0xe806('0x20')];var _0x2eebaa=crypto[_0xe806('0x1f')](_0x134de9,_0x5a8ba0);var _0x1bf9a3=_0x2eebaa[_0xe806('0x16')](_0x2dd4c2,_0xe806('0x21'),'utf8');_0x1bf9a3+=_0x2eebaa[_0xe806('0x18')](_0xe806('0x23'));return _0x1bf9a3;}; \ No newline at end of file +var _0x145e=['utf8','base64','decryptString','secret','crypto','bluebird','../../config/logger','app','secrets','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','indexOf','hasOwnProperty','encryptFile','createReadStream','createCipher','data','binary','write','end','final','close','decryptFile','createWriteStream','createDecipher','update','unlink'];(function(_0x3e4007,_0x5b6da4){var _0x349453=function(_0x26cc4d){while(--_0x26cc4d){_0x3e4007['push'](_0x3e4007['shift']());}};_0x349453(++_0x5b6da4);}(_0x145e,0x6a));var _0xe145=function(_0x36f797,_0x351603){_0x36f797=_0x36f797-0x0;var _0x44ba30=_0x145e[_0x36f797];return _0x44ba30;};'use strict';var crypto=require(_0xe145('0x0'));var fs=require('fs');var BPromise=require(_0xe145('0x1'));var _=require('lodash');var config=require('../../config/environment');var logger=require(_0xe145('0x2'))(_0xe145('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xe145('0x4')]['session'],'algorithm':_0xe145('0x5')};const fileOptions={'algorithm':_0xe145('0x6')};if(config[_0xe145('0x7')]&&config[_0xe145('0x7')][_0xe145('0x8')]){var isSupported=isAlgorithmSupported(config[_0xe145('0x7')][_0xe145('0x8')]);if(isSupported){fileOptions[_0xe145('0x8')]=config[_0xe145('0x7')][_0xe145('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xe145('0x9')](',\x20');logger[_0xe145('0xa')](config[_0xe145('0x7')][_0xe145('0x8')],_0xe145('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x8ac26a){return AES_SUPPORTED_RX[_0xe145('0xc')](_0x8ac26a);}function getSupportedCiphers(){return crypto[_0xe145('0xd')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x20c41b){return getSupportedCiphers()[_0xe145('0xe')](_0x20c41b)>-0x1;}function combineOptions(_0x7a9e0d){var _0x5aa550={};for(var _0x376bbc in fileOptions){if(fileOptions[_0xe145('0xf')](_0x376bbc)){_0x5aa550[_0x376bbc]=fileOptions[_0x376bbc];}}if(_0x7a9e0d){for(var _0x1d375d in _0x7a9e0d){if(_0x7a9e0d[_0xe145('0xf')](_0x1d375d)){_0x5aa550[_0x1d375d]=_0x7a9e0d[_0x1d375d];}}}return _0x5aa550;}exports[_0xe145('0x10')]=function(_0x524bbc,_0x32ed0d,_0x50c524,_0x459a1f){return new BPromise(function(_0x465911,_0x139433){_0x459a1f=combineOptions(_0x459a1f);var _0x120873=new Buffer(_0x50c524);var _0x46b580=fs[_0xe145('0x11')](_0x524bbc);var _0x40c365=fs['createWriteStream'](_0x32ed0d);var _0x52a363=crypto[_0xe145('0x12')](_0x459a1f['algorithm'],_0x120873);_0x46b580['on'](_0xe145('0x13'),function(_0x42fd40){var _0x30a0af=new Buffer(_0x52a363['update'](_0x42fd40),_0xe145('0x14'));_0x40c365[_0xe145('0x15')](_0x30a0af);});_0x46b580['on'](_0xe145('0x16'),function(){try{var _0x2cc94b=new Buffer(_0x52a363[_0xe145('0x17')]('binary'),_0xe145('0x14'));_0x40c365[_0xe145('0x15')](_0x2cc94b);_0x40c365[_0xe145('0x16')]();_0x40c365['on'](_0xe145('0x18'),function(){return _0x465911(_0x32ed0d);});}catch(_0x3893ef){fs['unlink'](_0x32ed0d);return _0x139433(_0x3893ef);}});});};exports[_0xe145('0x19')]=function(_0x2c86e6,_0x5e6f62,_0xd8703a,_0x3bc6fc){return new BPromise(function(_0x5770ff,_0x46be7a){_0x3bc6fc=combineOptions(_0x3bc6fc);var _0x1dd524=new Buffer(_0xd8703a);var _0x1fc443=fs[_0xe145('0x11')](_0x2c86e6);var _0x25b455=fs[_0xe145('0x1a')](_0x5e6f62);var _0x133ec2=crypto[_0xe145('0x1b')](_0x3bc6fc[_0xe145('0x8')],_0x1dd524);_0x1fc443['on'](_0xe145('0x13'),function(_0x4280e2){var _0x3ece2c=new Buffer(_0x133ec2[_0xe145('0x1c')](_0x4280e2),_0xe145('0x14'));_0x25b455[_0xe145('0x15')](_0x3ece2c);});_0x1fc443['on'](_0xe145('0x16'),function(){try{var _0x7be48b=new Buffer(_0x133ec2[_0xe145('0x17')](_0xe145('0x14')),'binary');_0x25b455[_0xe145('0x15')](_0x7be48b);_0x25b455[_0xe145('0x16')]();_0x25b455['on'](_0xe145('0x18'),function(){return _0x5770ff(_0x5e6f62);});}catch(_0x14bb7a){fs[_0xe145('0x1d')](_0x5e6f62);return _0x46be7a(_0x14bb7a);}});});};exports['encryptString']=function(_0xa9c75f,_0x36d724,_0x523a85){var _0x1a2acf=_0x523a85||stringOptions['algorithm'];var _0x556233=_0x36d724||stringOptions['secret'];var _0x1d5f0e=crypto['createCipher'](_0x1a2acf,_0x556233);var _0x1a373e=_0x1d5f0e[_0xe145('0x1c')](_0xa9c75f,_0xe145('0x1e'),_0xe145('0x1f'));_0x1a373e+=_0x1d5f0e[_0xe145('0x17')](_0xe145('0x1f'));return _0x1a373e;};exports[_0xe145('0x20')]=function(_0x4a089b,_0x16461a,_0x569bd8){var _0x332a6f=_0x569bd8||stringOptions[_0xe145('0x8')];var _0x3eca02=_0x16461a||stringOptions[_0xe145('0x21')];var _0x3c110e=crypto[_0xe145('0x1b')](_0x332a6f,_0x3eca02);var _0x173854=_0x3c110e[_0xe145('0x1c')](_0x4a089b,'base64','utf8');_0x173854+=_0x3c110e[_0xe145('0x17')](_0xe145('0x1e'));return _0x173854;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index e33519b..9b261f0 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 _0xf46f=['../../config/logger','argv','savename','AnalyticExtractedReport','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','length','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Failed','exit','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH'];(function(_0xdc19d4,_0x4afa8e){var _0x1e9ff9=function(_0xe6a551){while(--_0xe6a551){_0xdc19d4['push'](_0xdc19d4['shift']());}};_0x1e9ff9(++_0x4afa8e);}(_0xf46f,0xf2));var _0xff46=function(_0xc3b7fe,_0x4a9350){_0xc3b7fe=_0xc3b7fe-0x0;var _0xc1c137=_0xf46f[_0xc3b7fe];return _0xc1c137;};'use strict';var util=require('util');var path=require(_0xff46('0x0'));var _=require(_0xff46('0x1'));var csv=require(_0xff46('0x2'));var fs=require('fs');var BPromise=require(_0xff46('0x3'));var zipdir=require(_0xff46('0x4'));var rimraf=require(_0xff46('0x5'));var db=require(_0xff46('0x6'))['db'];var dbH=require(_0xff46('0x6'))[_0xff46('0x7')];var logger=require(_0xff46('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xff46('0x9')][0x2]);var QUERY=process[_0xff46('0x9')][0x3];var PATH=process[_0xff46('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4fc28c,_0x4fe9ff){var _0x5cffdb={'status':_0x4fc28c};var _0x4c4814={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4fe9ff){_0x5cffdb[_0xff46('0xa')]=_0x4fe9ff;}return db[_0xff46('0xb')]['update'](_0x5cffdb,_0x4c4814);}function main(){var _0x3d4c78=0x1388;var _0x35aef1;logger[_0xff46('0xc')](util['format'](_0xff46('0xd'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xff46('0xe')][_0xff46('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xff46('0x10'),'splitSizeCsv']})['then'](function(_0x52d4dd){if(_0x52d4dd){_0x35aef1=_0x52d4dd;_0x3d4c78=_0x35aef1[_0xff46('0x11')]||0x1388;}})[_0xff46('0x12')](function(){return dbH[_0xff46('0x13')][_0xff46('0x14')](util[_0xff46('0x15')](_0xff46('0x16'),QUERY),{'type':dbH[_0xff46('0x13')][_0xff46('0x17')][_0xff46('0x18')]});})[_0xff46('0x12')](function(_0x20b042){if(!_0x20b042[0x0][_0xff46('0x19')]){return analyticExtractedReport(_0xff46('0x1a'));}var _0x4c223b=[];var _0x379613=0x0;if(_0x35aef1[_0xff46('0x10')]){if(_0x20b042&&_0x20b042['length']){var _0xbda700=_[_0xff46('0x1b')](_0x20b042[0x0][_0xff46('0x19')]/_0x3d4c78);var _0x248876=Number['isInteger'](_0x20b042[0x0][_0xff46('0x19')]/_0x3d4c78)?_0x20b042[0x0][_0xff46('0x19')]%_0x3d4c78:0x0;_0xbda700[_0xff46('0x1c')](function(_0x5d8cb5){if(_0x5d8cb5>0x0){_0x379613+=_0x3d4c78;}_0x4c223b[_0xff46('0x1d')](dbH['sequelize'][_0xff46('0x14')](util[_0xff46('0x15')](_0xff46('0x1e'),QUERY,_0x3d4c78,_0x379613),{'type':dbH['sequelize'][_0xff46('0x17')][_0xff46('0x18')]}));});if(_0x248876>0x0){_0x379613+=_0x3d4c78;_0x4c223b[_0xff46('0x1d')](dbH['sequelize']['query'](util[_0xff46('0x15')](_0xff46('0x1e'),QUERY,_0x248876,_0x379613),{'type':dbH[_0xff46('0x13')][_0xff46('0x17')]['SELECT']}));}}}else{_0x4c223b[_0xff46('0x1d')](dbH[_0xff46('0x13')][_0xff46('0x14')](QUERY,{'type':dbH['sequelize'][_0xff46('0x17')][_0xff46('0x18')]}));}var _0x52aacc=path[_0xff46('0x1f')](PATH);var _0x18b429=path[_0xff46('0x20')](PATH,_0xff46('0x21'));var _0x2e0fb4=_0x35aef1['split']&&_0x4c223b[_0xff46('0x22')]>0x1;var _0x5cac2c=[];if(!fs[_0xff46('0x23')](path[_0xff46('0x24')](_0x52aacc,_0x18b429))&&_0x2e0fb4){fs[_0xff46('0x25')](path[_0xff46('0x24')](_0x52aacc,_0x18b429));}return BPromise[_0xff46('0x26')](_0x4c223b,function(_0xda094e){_0x5cac2c[_0xff46('0x1d')](_0xda094e);})[_0xff46('0x12')](function(){for(var _0x2ba745=0x0;_0x2ba745<_0x5cac2c[_0xff46('0x22')];_0x2ba745+=0x1){var _0x5be7ee;var _0x47787a=_0x5cac2c[_0x2ba745];if(_0x2e0fb4){_0x5be7ee=path[_0xff46('0x24')](_0x52aacc,_0x18b429,util[_0xff46('0x15')](_0xff46('0x27'),_0x18b429,_0x2ba745,_0xff46('0x28')));}else{_0x5be7ee=path[_0xff46('0x24')](_0x52aacc,util[_0xff46('0x15')](_0xff46('0x29'),_0x18b429,_0xff46('0x28')));}fs[_0xff46('0x2a')](_0x5be7ee,csv(_0x47787a));}})[_0xff46('0x12')](function(){if(_0x2e0fb4){return new Promise(function(_0x473ca9){zipdir(path['join'](_0x52aacc,_0x18b429),{'saveTo':path[_0xff46('0x24')](_0x52aacc,util['format'](_0xff46('0x29'),_0x18b429,_0xff46('0x2b')))},function(_0x1d272a,_0x4fb8d2){rimraf(path[_0xff46('0x24')](_0x52aacc,_0x18b429),function(){});_0x473ca9('zip\x20finished');});});}})[_0xff46('0x12')](function(){logger['info'](util[_0xff46('0x15')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xff46('0x2c'),_0x2e0fb4?util[_0xff46('0x15')]('%s.%s',_0x18b429,_0x2e0fb4?_0xff46('0x2b'):_0xff46('0x28')):null);});})[_0xff46('0x2d')](function(_0x562552){logger[_0xff46('0xc')](util[_0xff46('0x15')](_0xff46('0x2e'),EXTRACTED_REPORT_ID,_0xff46('0x2f')),util['inspect'](_0x562552,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xff46('0x30'));})['finally'](function(){process[_0xff46('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xaa34=['zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','util','path','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','splitSizeCsv','then','query','format','sequelize','QueryTypes','num','Empty','isInteger','forEach','push','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','length','existsSync','join','%s%d.%s','csv','%s.%s','writeFileSync','zip'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xaa34,0xc2));var _0x4aa3=function(_0x1594e8,_0x5c037c){_0x1594e8=_0x1594e8-0x0;var _0x47c94d=_0xaa34[_0x1594e8];return _0x47c94d;};'use strict';var util=require(_0x4aa3('0x0'));var path=require(_0x4aa3('0x1'));var _=require('lodash');var csv=require(_0x4aa3('0x2'));var fs=require('fs');var BPromise=require(_0x4aa3('0x3'));var zipdir=require(_0x4aa3('0x4'));var rimraf=require(_0x4aa3('0x5'));var db=require(_0x4aa3('0x6'))['db'];var dbH=require(_0x4aa3('0x6'))['dbH'];var logger=require(_0x4aa3('0x7'))(_0x4aa3('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x4aa3('0x9')][0x2]);var QUERY=process[_0x4aa3('0x9')][0x3];var PATH=process[_0x4aa3('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2ff5f4,_0x5598a7){var _0x1a9551={'status':_0x2ff5f4};var _0xb3006f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5598a7){_0x1a9551[_0x4aa3('0xa')]=_0x5598a7;}return db[_0x4aa3('0xb')][_0x4aa3('0xc')](_0x1a9551,_0xb3006f);}function main(){var _0x17a958=0x1388;var _0x1f9349;logger['info'](util['format'](_0x4aa3('0xd'),EXTRACTED_REPORT_ID,_0x4aa3('0xe')));return db[_0x4aa3('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4aa3('0x10'),_0x4aa3('0x11')]})[_0x4aa3('0x12')](function(_0x5b678e){if(_0x5b678e){_0x1f9349=_0x5b678e;_0x17a958=_0x1f9349[_0x4aa3('0x11')]||0x1388;}})[_0x4aa3('0x12')](function(){return dbH['sequelize'][_0x4aa3('0x13')](util[_0x4aa3('0x14')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x4aa3('0x15')][_0x4aa3('0x16')]['SELECT']});})[_0x4aa3('0x12')](function(_0x4e6b97){if(!_0x4e6b97[0x0][_0x4aa3('0x17')]){return analyticExtractedReport(_0x4aa3('0x18'));}var _0x1b355=[];var _0x4e99ed=0x0;if(_0x1f9349['split']){if(_0x4e6b97&&_0x4e6b97['length']){var _0x26d297=_['range'](_0x4e6b97[0x0][_0x4aa3('0x17')]/_0x17a958);var _0x583308=Number[_0x4aa3('0x19')](_0x4e6b97[0x0][_0x4aa3('0x17')]/_0x17a958)?_0x4e6b97[0x0][_0x4aa3('0x17')]%_0x17a958:0x0;_0x26d297[_0x4aa3('0x1a')](function(_0x27b0f8){if(_0x27b0f8>0x0){_0x4e99ed+=_0x17a958;}_0x1b355[_0x4aa3('0x1b')](dbH['sequelize'][_0x4aa3('0x13')](util[_0x4aa3('0x14')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x17a958,_0x4e99ed),{'type':dbH[_0x4aa3('0x15')][_0x4aa3('0x16')][_0x4aa3('0x1c')]}));});if(_0x583308>0x0){_0x4e99ed+=_0x17a958;_0x1b355[_0x4aa3('0x1b')](dbH[_0x4aa3('0x15')]['query'](util[_0x4aa3('0x14')](_0x4aa3('0x1d'),QUERY,_0x583308,_0x4e99ed),{'type':dbH[_0x4aa3('0x15')][_0x4aa3('0x16')]['SELECT']}));}}}else{_0x1b355['push'](dbH[_0x4aa3('0x15')]['query'](QUERY,{'type':dbH['sequelize'][_0x4aa3('0x16')][_0x4aa3('0x1c')]}));}var _0x1f14e7=path[_0x4aa3('0x1e')](PATH);var _0x37b29d=path[_0x4aa3('0x1f')](PATH,_0x4aa3('0x20'));var _0x50f1e9=_0x1f9349[_0x4aa3('0x10')]&&_0x1b355[_0x4aa3('0x21')]>0x1;var _0x1a1b29=[];if(!fs[_0x4aa3('0x22')](path[_0x4aa3('0x23')](_0x1f14e7,_0x37b29d))&&_0x50f1e9){fs['mkdirSync'](path[_0x4aa3('0x23')](_0x1f14e7,_0x37b29d));}return BPromise['each'](_0x1b355,function(_0x3b75bc){_0x1a1b29[_0x4aa3('0x1b')](_0x3b75bc);})['then'](function(){for(var _0x57a1e4=0x0;_0x57a1e4<_0x1a1b29['length'];_0x57a1e4+=0x1){var _0x14d5e4;var _0x26051c=_0x1a1b29[_0x57a1e4];if(_0x50f1e9){_0x14d5e4=path[_0x4aa3('0x23')](_0x1f14e7,_0x37b29d,util[_0x4aa3('0x14')](_0x4aa3('0x24'),_0x37b29d,_0x57a1e4,_0x4aa3('0x25')));}else{_0x14d5e4=path[_0x4aa3('0x23')](_0x1f14e7,util[_0x4aa3('0x14')](_0x4aa3('0x26'),_0x37b29d,_0x4aa3('0x25')));}fs[_0x4aa3('0x27')](_0x14d5e4,csv(_0x26051c));}})[_0x4aa3('0x12')](function(){if(_0x50f1e9){return new Promise(function(_0x170aac){zipdir(path[_0x4aa3('0x23')](_0x1f14e7,_0x37b29d),{'saveTo':path[_0x4aa3('0x23')](_0x1f14e7,util[_0x4aa3('0x14')](_0x4aa3('0x26'),_0x37b29d,_0x4aa3('0x28')))},function(_0xbd84d3,_0x580d77){rimraf(path['join'](_0x1f14e7,_0x37b29d),function(){});_0x170aac(_0x4aa3('0x29'));});});}})[_0x4aa3('0x12')](function(){logger[_0x4aa3('0x2a')](util[_0x4aa3('0x14')](_0x4aa3('0x2b'),EXTRACTED_REPORT_ID,_0x4aa3('0xe')));return analyticExtractedReport(_0x4aa3('0x2c'),_0x50f1e9?util[_0x4aa3('0x14')]('%s.%s',_0x37b29d,_0x50f1e9?_0x4aa3('0x28'):'csv'):null);});})['catch'](function(_0x13c066){logger[_0x4aa3('0x2a')](util['format'](_0x4aa3('0x2d'),EXTRACTED_REPORT_ID,_0x4aa3('0xe')),util[_0x4aa3('0x2e')](_0x13c066,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 7572e67..16c525d 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 _0xacf2=['splitSizePdf','then','num','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','.pdf','split','existsSync','join','mkdirSync','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','toString','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','error','end','createPdfFromHTML','path','util','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','JSDOM','window','bluebird','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','update','tableHeader','map','pick','value','fill','length','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','header','pageBreak','before','\x20/\x20','footer','Arial','Empty','Setting','find'];(function(_0x2ff4bd,_0x4780a6){var _0x28edc6=function(_0x792380){while(--_0x792380){_0x2ff4bd['push'](_0x2ff4bd['shift']());}};_0x28edc6(++_0x4780a6);}(_0xacf2,0x8f));var _0x2acf=function(_0x5c1ade,_0xaa1212){_0x5c1ade=_0x5c1ade-0x0;var _0x4980b4=_0xacf2[_0x5c1ade];return _0x4980b4;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x2acf('0x0'));var path=require('path');var moment=require(_0x2acf('0x1'));var htmlToPdfmake=require(_0x2acf('0x2'));var PdfPrinter=require(_0x2acf('0x3'));var zipdir=require(_0x2acf('0x4'));var rimraf=require('rimraf');var JSDOM=require(_0x2acf('0x5'))[_0x2acf('0x6')];var window=new JSDOM('')[_0x2acf('0x7')];var BPromise=require(_0x2acf('0x8'));var db=require(_0x2acf('0x9'))['db'];var dbH=require(_0x2acf('0x9'))['dbH'];var logger=require(_0x2acf('0xa'))(_0x2acf('0xb'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x2acf('0xc')][0x3];var PATH=process[_0x2acf('0xc')][0x4];var NAME=process[_0x2acf('0xc')][0x5];var FORMAT=_0x2acf('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x58110b,_0x265e9e){var _0x3cfce4={'status':_0x58110b};var _0x17fa55={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x265e9e){_0x3cfce4['savename']=_0x265e9e;}return db['AnalyticExtractedReport'][_0x2acf('0xe')](_0x3cfce4,_0x17fa55);}function getHeaders(_0x462c14){return _['map'](_0x462c14,function(_0x15274e){return{'text':_0x15274e,'style':_0x2acf('0xf')};});}function getRows(_0x2e8e0a,_0x2e798c){return _[_0x2acf('0x10')](_0x2e798c,function(_0x1e4ed4){return _(_0x1e4ed4)[_0x2acf('0x11')](_0x2e8e0a)[_0x2acf('0x10')](function(_0x450546){return _0x450546?_['toString'](_0x450546):'';})[_0x2acf('0x12')]();});}function createTable(_0x16bba8,_0xb9c602){var _0x1d28d8={'widths':_[_0x2acf('0x13')](Array(_0x16bba8[_0x2acf('0x14')]),0x91),'heights':function(_0x1b2e13){return _0x1b2e13===0x0?_0x2acf('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x500835=getHeaders(_0x16bba8);_0x1d28d8[_0x2acf('0x16')][_0x2acf('0x17')](_0x500835);var _0x26e326=getRows(_0x16bba8,_0xb9c602);_0x1d28d8[_0x2acf('0x16')]=_0x1d28d8['body'][_0x2acf('0x18')](_0x26e326);return _0x1d28d8;}function createTables(_0x2694f8){var _0x903cf7=[];var _0x3d108f=_[_0x2acf('0x19')](Object[_0x2acf('0x1a')](_0x2694f8[0x0]),0x5);_0x3d108f[_0x2acf('0x1b')](function(_0x115f81){_0x903cf7[_0x2acf('0x17')](createTable(_0x115f81,_0x2694f8));});return _0x903cf7;}function getPDFDocDefinition(_0xa23ddf){var _0x3697b2=util[_0x2acf('0x1c')](_0x2acf('0x1d'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x2acf('0x1e')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x2acf('0x1f')])[_0x2acf('0x1c')](FORMAT));var _0xe9a4ef=[];for(var _0x5a60ba=0x0;_0x5a60ba<_0xa23ddf[_0x2acf('0x14')];_0x5a60ba++){var _0x1a540d=[];if(_0x5a60ba===0x0){_0x1a540d[_0x2acf('0x17')]({'text':_0x3697b2,'style':_0x2acf('0x20')});}var _0x2f95a5={'table':_0xa23ddf[_0x5a60ba]};if(_0x5a60ba>0x0){_0x2f95a5[_0x2acf('0x21')]=_0x2acf('0x22');_0x2f95a5['margin']=[0x0,0x46,0x0,0x0];}_0x1a540d[_0x2acf('0x17')](_0x2f95a5);_0xe9a4ef['push'](_0x1a540d);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0xe9a4ef,'footer':function(_0x4b1feb,_0x2a93bf){return{'text':_0x4b1feb['toString']()+_0x2acf('0x23')+_0x2a93bf,'style':_0x2acf('0x24')};},'defaultStyle':{'font':_0x2acf('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x26be50){var _0x5d072a=0x1388;var _0x244c3c;if(!_0x26be50[0x0]['num']){return analyticExtractedReport(_0x2acf('0x26'));}return db[_0x2acf('0x27')][_0x2acf('0x28')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x2acf('0x29')]})[_0x2acf('0x2a')](function(_0x48855f){if(_0x48855f){_0x244c3c=_0x48855f;_0x5d072a=_0x244c3c[_0x2acf('0x29')]||0x3e8;}})[_0x2acf('0x2a')](function(){var _0xb9900c=[];var _0x4952ac=0x0;if(_0x244c3c['split']){if(_0x26be50&&_0x26be50[_0x2acf('0x14')]){var _0x14f515=_['range'](_0x26be50[0x0][_0x2acf('0x2b')]/_0x5d072a);var _0x2375e5=Number[_0x2acf('0x2c')](_0x26be50[0x0][_0x2acf('0x2b')]/_0x5d072a)?_0x26be50[0x0][_0x2acf('0x2b')]%_0x5d072a:0x0;_0x14f515[_0x2acf('0x1b')](function(_0x527f00){if(_0x527f00>0x0){_0x4952ac+=_0x5d072a;}_0xb9900c[_0x2acf('0x17')](dbH[_0x2acf('0x2d')][_0x2acf('0x2e')](util[_0x2acf('0x1c')](_0x2acf('0x2f'),QUERY,_0x5d072a,_0x4952ac),{'type':dbH['sequelize'][_0x2acf('0x30')][_0x2acf('0x31')]}));});if(_0x2375e5>0x0){_0x4952ac+=_0x5d072a;_0xb9900c[_0x2acf('0x17')](dbH[_0x2acf('0x2d')][_0x2acf('0x2e')](util['format'](_0x2acf('0x2f'),QUERY,_0x2375e5,_0x4952ac),{'type':dbH['sequelize'][_0x2acf('0x30')][_0x2acf('0x31')]}));}}}else{_0xb9900c[_0x2acf('0x17')](dbH[_0x2acf('0x2d')][_0x2acf('0x2e')](QUERY,{'type':dbH['sequelize'][_0x2acf('0x30')][_0x2acf('0x31')]}));}var _0x1379e7=path['dirname'](PATH);var _0x398b80=path['basename'](PATH,_0x2acf('0x32'));var _0x54278d=_0x244c3c[_0x2acf('0x33')]&&_0xb9900c['length']>0x1;var _0x5d33ec=[];if(!fs[_0x2acf('0x34')](path[_0x2acf('0x35')](_0x1379e7,_0x398b80))&&_0x54278d){fs[_0x2acf('0x36')](path['join'](_0x1379e7,_0x398b80));}return BPromise['each'](_0xb9900c,function(_0x21c85f){_0x5d33ec[_0x2acf('0x17')](_0x21c85f);})['then'](function(){var _0x520343=[];for(var _0x22427e=0x0;_0x22427e<_0x5d33ec[_0x2acf('0x14')];_0x22427e+=0x1){var _0x31be76=_0x5d33ec[_0x22427e];var _0x8338f2=createTables(_[_0x2acf('0x37')](_0x31be76));var _0x50b045;var _0x127eb4=getPDFDocDefinition(_0x8338f2);var _0x1da1cc=getPDFPrinter();var _0x282fe3=_0x1da1cc[_0x2acf('0x38')](_0x127eb4);if(_0x54278d){_0x50b045=path['join'](_0x1379e7,_0x398b80,util[_0x2acf('0x1c')](_0x2acf('0x39'),_0x398b80,_0x22427e,_0x2acf('0x3a')));}else{_0x50b045=path[_0x2acf('0x35')](_0x1379e7,util['format'](_0x2acf('0x3b'),_0x398b80,'pdf'));}_0x520343[_0x2acf('0x17')](writePDFDocument(_0x282fe3,_0x50b045));}return Promise[_0x2acf('0x3c')](_0x520343);})[_0x2acf('0x2a')](function(){if(_0x54278d){return new Promise(function(_0x4eaee6){zipdir(path['join'](_0x1379e7,_0x398b80),{'saveTo':path[_0x2acf('0x35')](_0x1379e7,util['format'](_0x2acf('0x3b'),_0x398b80,_0x2acf('0x3d')))},function(){rimraf(path['join'](_0x1379e7,_0x398b80),function(){});_0x4eaee6(_0x2acf('0x3e'));});});}})[_0x2acf('0x2a')](function(){if(!_0x54278d)return;rimraf(path['join'](_0x1379e7,_0x398b80),function(){});})[_0x2acf('0x2a')](function(){logger['info'](util[_0x2acf('0x1c')](_0x2acf('0x3f'),EXTRACTED_REPORT_ID,_0x2acf('0x40')));return analyticExtractedReport(_0x2acf('0x41'),_0x54278d?util[_0x2acf('0x1c')](_0x2acf('0x3b'),_0x398b80,_0x54278d?_0x2acf('0x3d'):_0x2acf('0x3a')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x2acf('0x42')](util[_0x2acf('0x1c')](_0x2acf('0x43'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x2acf('0x44')][_0x2acf('0x45')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x5af60d){EXTRACTED_REPORT=_0x5af60d;return dbH[_0x2acf('0x2d')][_0x2acf('0x2e')](util[_0x2acf('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x2acf('0x31')]});})[_0x2acf('0x2a')](extractReport)[_0x2acf('0x46')](function(_0x955bbf){logger[_0x2acf('0x42')](util[_0x2acf('0x1c')](_0x2acf('0x47'),EXTRACTED_REPORT_ID,_0x2acf('0x40')),util[_0x2acf('0x48')](_0x955bbf,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2acf('0x49'));})[_0x2acf('0x4a')](function(){process[_0x2acf('0x4b')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x1767c9=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x2acf('0x4c'),'bolditalics':__dirname+_0x2acf('0x4d')}});return _0x1767c9;}function getPDFDocDefinitionFromHTML(_0x586649,_0x45e6f2){var _0x76d037=util[_0x2acf('0x1c')](_0x2acf('0x4e'),_0x45e6f2[_0x2acf('0x4f')],_0x45e6f2[_0x2acf('0x50')]);var _0x4fc4d4=moment()['format'](_0x2acf('0x51'))[_0x2acf('0x52')]();var _0x474450=htmlToPdfmake(_0x586649,{'window':window,'tableAutoSize':!![]});return{'content':[_0x474450],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x2acf('0x53'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x2acf('0x53')}},'header':function(){return[{'text':_0x2acf('0x54'),'style':'header'}];},'footer':function(_0x121164,_0x35f585){return[{'text':util[_0x2acf('0x1c')](_0x2acf('0x55'),_0x76d037,_0x121164,_0x35f585,_0x4fc4d4),'style':_0x2acf('0x24')}];}};}function writePDFDocument(_0x5289f7,_0x245f6a){return new Promise(function(_0x281336,_0x3f9df8){var _0x40fcd2=_0x5289f7['pipe'](fs[_0x2acf('0x56')](_0x245f6a));_0x40fcd2['on'](_0x2acf('0x57'),function(){_0x281336(_0x2acf('0x57'));});_0x40fcd2['on'](_0x2acf('0x58'),function(_0x1f06c5){_0x3f9df8(_0x1f06c5);});_0x5289f7[_0x2acf('0x59')]();});}exports[_0x2acf('0x5a')]=function(_0x41b28f,_0x4ca3f4){var _0x19144c=getPDFPrinter();var _0x4f3003=getPDFDocDefinitionFromHTML(_0x41b28f,_0x4ca3f4);var _0x3ef93f=_0x19144c[_0x2acf('0x38')](_0x4f3003);return writePDFDocument(_0x3ef93f,_0x4ca3f4[_0x2acf('0x5b')])[_0x2acf('0x46')](function(_0x3877a3){throw _0x3877a3;});}; \ No newline at end of file +var _0xd019=['find','split','splitSizePdf','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','basename','.pdf','existsSync','join','each','then','flatten','%s%d.%s','pdf','%s.%s','all','zip\x20finished','info','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','createPdfKitDocument','lodash','util','path','moment','zip-dir','rimraf','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','pick','toString','value','fill','auto','body','concat','chunk','keys','forEach','push','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','format','endDate','length','header','before','landscape','\x20/\x20','footer','Arial','black','num','Empty','Setting'];(function(_0x1f44c1,_0x1af55c){var _0x4a5bef=function(_0x16bdfb){while(--_0x16bdfb){_0x1f44c1['push'](_0x1f44c1['shift']());}};_0x4a5bef(++_0x1af55c);}(_0xd019,0x1f1));var _0x9d01=function(_0x10f68e,_0xf198ea){_0x10f68e=_0x10f68e-0x0;var _0x4c8372=_0xd019[_0x10f68e];return _0x4c8372;};'use strict';var _=require(_0x9d01('0x0'));var fs=require('fs');var util=require(_0x9d01('0x1'));var path=require(_0x9d01('0x2'));var moment=require(_0x9d01('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x9d01('0x4'));var rimraf=require(_0x9d01('0x5'));var JSDOM=require('jsdom')['JSDOM'];var window=new JSDOM('')['window'];var BPromise=require(_0x9d01('0x6'));var db=require(_0x9d01('0x7'))['db'];var dbH=require(_0x9d01('0x7'))[_0x9d01('0x8')];var logger=require(_0x9d01('0x9'))(_0x9d01('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x9d01('0xb')][0x2]);var QUERY=process[_0x9d01('0xb')][0x3];var PATH=process[_0x9d01('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x9d01('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3cc2b7,_0xae05c1){var _0x1d79e5={'status':_0x3cc2b7};var _0x12a34e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xae05c1){_0x1d79e5[_0x9d01('0xd')]=_0xae05c1;}return db[_0x9d01('0xe')]['update'](_0x1d79e5,_0x12a34e);}function getHeaders(_0x3b74a4){return _[_0x9d01('0xf')](_0x3b74a4,function(_0x472355){return{'text':_0x472355,'style':_0x9d01('0x10')};});}function getRows(_0x4c75dd,_0x1076de){return _[_0x9d01('0xf')](_0x1076de,function(_0x357aad){return _(_0x357aad)[_0x9d01('0x11')](_0x4c75dd)[_0x9d01('0xf')](function(_0x6801d1){return _0x6801d1?_[_0x9d01('0x12')](_0x6801d1):'';})[_0x9d01('0x13')]();});}function createTable(_0x4036be,_0x56f793){var _0x4b591c={'widths':_[_0x9d01('0x14')](Array(_0x4036be['length']),0x91),'heights':function(_0x39d88f){return _0x39d88f===0x0?_0x9d01('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x50b240=getHeaders(_0x4036be);_0x4b591c[_0x9d01('0x16')]['push'](_0x50b240);var _0x291c52=getRows(_0x4036be,_0x56f793);_0x4b591c[_0x9d01('0x16')]=_0x4b591c['body'][_0x9d01('0x17')](_0x291c52);return _0x4b591c;}function createTables(_0x2b7e31){var _0x13ccaf=[];var _0x4b17b5=_[_0x9d01('0x18')](Object[_0x9d01('0x19')](_0x2b7e31[0x0]),0x5);_0x4b17b5[_0x9d01('0x1a')](function(_0x77c2f){_0x13ccaf[_0x9d01('0x1b')](createTable(_0x77c2f,_0x2b7e31));});return _0x13ccaf;}function getPDFDocDefinition(_0x1fdf45){var _0x4fccd4=util['format'](_0x9d01('0x1c'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x9d01('0x1d')])[_0x9d01('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0x9d01('0x1f')])[_0x9d01('0x1e')](FORMAT));var _0x5d0205=[];for(var _0x380c8c=0x0;_0x380c8c<_0x1fdf45[_0x9d01('0x20')];_0x380c8c++){var _0x280b84=[];if(_0x380c8c===0x0){_0x280b84['push']({'text':_0x4fccd4,'style':_0x9d01('0x21')});}var _0x116162={'table':_0x1fdf45[_0x380c8c]};if(_0x380c8c>0x0){_0x116162['pageBreak']=_0x9d01('0x22');_0x116162['margin']=[0x0,0x46,0x0,0x0];}_0x280b84[_0x9d01('0x1b')](_0x116162);_0x5d0205[_0x9d01('0x1b')](_0x280b84);}return{'pageSize':'A4','pageOrientation':_0x9d01('0x23'),'content':_0x5d0205,'footer':function(_0x1f9817,_0x406045){return{'text':_0x1f9817['toString']()+_0x9d01('0x24')+_0x406045,'style':_0x9d01('0x25')};},'defaultStyle':{'font':_0x9d01('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x9d01('0x27')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x2bde31){var _0x3069fa=0x1388;var _0x1a1c17;if(!_0x2bde31[0x0][_0x9d01('0x28')]){return analyticExtractedReport(_0x9d01('0x29'));}return db[_0x9d01('0x2a')][_0x9d01('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9d01('0x2c'),_0x9d01('0x2d')]})['then'](function(_0x53449e){if(_0x53449e){_0x1a1c17=_0x53449e;_0x3069fa=_0x1a1c17[_0x9d01('0x2d')]||0x3e8;}})['then'](function(){var _0x5ef040=[];var _0x3a8a2e=0x0;if(_0x1a1c17[_0x9d01('0x2c')]){if(_0x2bde31&&_0x2bde31[_0x9d01('0x20')]){var _0x27d8f5=_[_0x9d01('0x2e')](_0x2bde31[0x0][_0x9d01('0x28')]/_0x3069fa);var _0x4cfd8f=Number[_0x9d01('0x2f')](_0x2bde31[0x0][_0x9d01('0x28')]/_0x3069fa)?_0x2bde31[0x0][_0x9d01('0x28')]%_0x3069fa:0x0;_0x27d8f5['forEach'](function(_0x352aff){if(_0x352aff>0x0){_0x3a8a2e+=_0x3069fa;}_0x5ef040[_0x9d01('0x1b')](dbH[_0x9d01('0x30')][_0x9d01('0x31')](util[_0x9d01('0x1e')](_0x9d01('0x32'),QUERY,_0x3069fa,_0x3a8a2e),{'type':dbH['sequelize'][_0x9d01('0x33')][_0x9d01('0x34')]}));});if(_0x4cfd8f>0x0){_0x3a8a2e+=_0x3069fa;_0x5ef040[_0x9d01('0x1b')](dbH[_0x9d01('0x30')][_0x9d01('0x31')](util[_0x9d01('0x1e')](_0x9d01('0x32'),QUERY,_0x4cfd8f,_0x3a8a2e),{'type':dbH[_0x9d01('0x30')][_0x9d01('0x33')][_0x9d01('0x34')]}));}}}else{_0x5ef040[_0x9d01('0x1b')](dbH[_0x9d01('0x30')]['query'](QUERY,{'type':dbH[_0x9d01('0x30')][_0x9d01('0x33')][_0x9d01('0x34')]}));}var _0xef338f=path['dirname'](PATH);var _0x53c479=path[_0x9d01('0x35')](PATH,_0x9d01('0x36'));var _0x3fbd4e=_0x1a1c17[_0x9d01('0x2c')]&&_0x5ef040[_0x9d01('0x20')]>0x1;var _0x2b6b55=[];if(!fs[_0x9d01('0x37')](path[_0x9d01('0x38')](_0xef338f,_0x53c479))&&_0x3fbd4e){fs['mkdirSync'](path[_0x9d01('0x38')](_0xef338f,_0x53c479));}return BPromise[_0x9d01('0x39')](_0x5ef040,function(_0x3a9531){_0x2b6b55['push'](_0x3a9531);})[_0x9d01('0x3a')](function(){var _0x190463=[];for(var _0xf24ded=0x0;_0xf24ded<_0x2b6b55['length'];_0xf24ded+=0x1){var _0x761eb8=_0x2b6b55[_0xf24ded];var _0x1d873b=createTables(_[_0x9d01('0x3b')](_0x761eb8));var _0x65f63a;var _0x1beded=getPDFDocDefinition(_0x1d873b);var _0x542ba5=getPDFPrinter();var _0x31b410=_0x542ba5['createPdfKitDocument'](_0x1beded);if(_0x3fbd4e){_0x65f63a=path[_0x9d01('0x38')](_0xef338f,_0x53c479,util[_0x9d01('0x1e')](_0x9d01('0x3c'),_0x53c479,_0xf24ded,_0x9d01('0x3d')));}else{_0x65f63a=path['join'](_0xef338f,util['format'](_0x9d01('0x3e'),_0x53c479,'pdf'));}_0x190463[_0x9d01('0x1b')](writePDFDocument(_0x31b410,_0x65f63a));}return Promise[_0x9d01('0x3f')](_0x190463);})[_0x9d01('0x3a')](function(){if(_0x3fbd4e){return new Promise(function(_0x243ca2){zipdir(path[_0x9d01('0x38')](_0xef338f,_0x53c479),{'saveTo':path[_0x9d01('0x38')](_0xef338f,util[_0x9d01('0x1e')]('%s.%s',_0x53c479,'zip'))},function(){rimraf(path[_0x9d01('0x38')](_0xef338f,_0x53c479),function(){});_0x243ca2(_0x9d01('0x40'));});});}})[_0x9d01('0x3a')](function(){if(!_0x3fbd4e)return;rimraf(path['join'](_0xef338f,_0x53c479),function(){});})[_0x9d01('0x3a')](function(){logger[_0x9d01('0x41')](util[_0x9d01('0x1e')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x9d01('0x42'),_0x3fbd4e?util[_0x9d01('0x1e')](_0x9d01('0x3e'),_0x53c479,_0x3fbd4e?'zip':_0x9d01('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x9d01('0x41')](util[_0x9d01('0x1e')](_0x9d01('0x43'),EXTRACTED_REPORT_ID,_0x9d01('0x44')));return db[_0x9d01('0xe')][_0x9d01('0x45')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x9d01('0x3a')](function(_0x17c98c){EXTRACTED_REPORT=_0x17c98c;return dbH[_0x9d01('0x30')][_0x9d01('0x31')](util[_0x9d01('0x1e')](_0x9d01('0x46'),QUERY),{'type':dbH[_0x9d01('0x30')]['QueryTypes']['SELECT']});})['then'](extractReport)[_0x9d01('0x47')](function(_0x148b19){logger['info'](util[_0x9d01('0x1e')](_0x9d01('0x48'),EXTRACTED_REPORT_ID,_0x9d01('0x44')),util[_0x9d01('0x49')](_0x148b19,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9d01('0x4a'));})['finally'](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3a1977=new PdfPrinter({'Arial':{'normal':__dirname+_0x9d01('0x4b'),'bold':__dirname+_0x9d01('0x4c'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x9d01('0x4d')}});return _0x3a1977;}function getPDFDocDefinitionFromHTML(_0x47027f,_0x21f691){var _0x4990f6=util['format'](_0x9d01('0x4e'),_0x21f691['channel'],_0x21f691[_0x9d01('0x4f')]);var _0x3f954c=moment()[_0x9d01('0x1e')](_0x9d01('0x50'))['toString']();var _0x39eb90=htmlToPdfmake(_0x47027f,{'window':window,'tableAutoSize':!![]});return{'content':[_0x39eb90],'defaultStyle':{'font':_0x9d01('0x26')},'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':_0x9d01('0x51'),'style':_0x9d01('0x21')}];},'footer':function(_0x22453c,_0x344f3c){return[{'text':util['format'](_0x9d01('0x52'),_0x4990f6,_0x22453c,_0x344f3c,_0x3f954c),'style':_0x9d01('0x25')}];}};}function writePDFDocument(_0x517a66,_0x508389){return new Promise(function(_0x2d8e43,_0x3af8b5){var _0x355f75=_0x517a66[_0x9d01('0x53')](fs[_0x9d01('0x54')](_0x508389));_0x355f75['on']('finish',function(){_0x2d8e43(_0x9d01('0x55'));});_0x355f75['on'](_0x9d01('0x56'),function(_0x4a9e75){_0x3af8b5(_0x4a9e75);});_0x517a66[_0x9d01('0x57')]();});}exports[_0x9d01('0x58')]=function(_0x4d7629,_0x398183){var _0x5833be=getPDFPrinter();var _0x1bde44=getPDFDocDefinitionFromHTML(_0x4d7629,_0x398183);var _0x48aefe=_0x5833be[_0x9d01('0x59')](_0x1bde44);return writePDFDocument(_0x48aefe,_0x398183[_0x9d01('0x2')])[_0x9d01('0x47')](function(_0xa9ab99){throw _0xa9ab99;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index f6f60a2..f2b2868 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 _0xa20a=['binary','zip','zip\x20finished','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','QueryTypes','SELECT','num','Empty','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','length','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xa20a,0x14d));var _0xaa20=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xa20a[_0x32f7d7];return _0x133d09;};'use strict';var util=require(_0xaa20('0x0'));var path=require(_0xaa20('0x1'));var _=require(_0xaa20('0x2'));var fs=require('fs');var json2xls=require(_0xaa20('0x3'));var BPromise=require('bluebird');var zipdir=require(_0xaa20('0x4'));var rimraf=require(_0xaa20('0x5'));var db=require(_0xaa20('0x6'))['db'];var dbH=require(_0xaa20('0x6'))[_0xaa20('0x7')];var logger=require(_0xaa20('0x8'))(_0xaa20('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xaa20('0xa')][0x2]);var QUERY=process[_0xaa20('0xa')][0x3];var PATH=process[_0xaa20('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5ad1dc,_0x201081){var _0x509ca7={'status':_0x5ad1dc};var _0x116358={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x201081){_0x509ca7[_0xaa20('0xb')]=_0x201081;}return db[_0xaa20('0xc')][_0xaa20('0xd')](_0x509ca7,_0x116358);}function main(){var _0x44722a=0x1388;var _0x2dcb10;logger[_0xaa20('0xe')](util[_0xaa20('0xf')](_0xaa20('0x10'),EXTRACTED_REPORT_ID,_0xaa20('0x11')));return db[_0xaa20('0x12')][_0xaa20('0x13')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xaa20('0x14'),_0xaa20('0x15')]})['then'](function(_0x4ae093){if(_0x4ae093){_0x2dcb10=_0x4ae093;_0x44722a=_0x2dcb10[_0xaa20('0x15')]||0x1388;}})[_0xaa20('0x16')](function(){return dbH[_0xaa20('0x17')][_0xaa20('0x18')](util[_0xaa20('0xf')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0xaa20('0x19')][_0xaa20('0x1a')]});})[_0xaa20('0x16')](function(_0x42b666){if(!_0x42b666[0x0][_0xaa20('0x1b')]){return analyticExtractedReport(_0xaa20('0x1c'));}var _0x231da0=[];var _0x2911fe=0x0;if(_0x2dcb10[_0xaa20('0x14')]){if(_0x42b666&&_0x42b666['length']){var _0x1f7066=_['range'](_0x42b666[0x0][_0xaa20('0x1b')]/_0x44722a);var _0x846fbe=Number[_0xaa20('0x1d')](_0x42b666[0x0]['num']/_0x44722a)?_0x42b666[0x0][_0xaa20('0x1b')]%_0x44722a:0x0;_0x1f7066[_0xaa20('0x1e')](function(_0x51134c){if(_0x51134c>0x0){_0x2911fe+=_0x44722a;}_0x231da0[_0xaa20('0x1f')](dbH[_0xaa20('0x17')][_0xaa20('0x18')](util[_0xaa20('0xf')](_0xaa20('0x20'),QUERY,_0x44722a,_0x2911fe),{'type':dbH[_0xaa20('0x17')][_0xaa20('0x19')][_0xaa20('0x1a')]}));});if(_0x846fbe>0x0){_0x2911fe+=_0x44722a;_0x231da0[_0xaa20('0x1f')](dbH[_0xaa20('0x17')][_0xaa20('0x18')](util[_0xaa20('0xf')](_0xaa20('0x20'),QUERY,_0x846fbe,_0x2911fe),{'type':dbH[_0xaa20('0x17')][_0xaa20('0x19')][_0xaa20('0x1a')]}));}}}else{_0x231da0[_0xaa20('0x1f')](dbH['sequelize'][_0xaa20('0x18')](QUERY,{'type':dbH[_0xaa20('0x17')][_0xaa20('0x19')][_0xaa20('0x1a')]}));}var _0x50b8de=path[_0xaa20('0x21')](PATH);var _0x403168=path[_0xaa20('0x22')](PATH,_0xaa20('0x23'));var _0x4d1982=_0x2dcb10[_0xaa20('0x14')]&&_0x231da0[_0xaa20('0x24')]>0x1;var _0x1b16ca=[];if(!fs[_0xaa20('0x25')](path[_0xaa20('0x26')](_0x50b8de,_0x403168))&&_0x4d1982){fs[_0xaa20('0x27')](path[_0xaa20('0x26')](_0x50b8de,_0x403168));}return BPromise[_0xaa20('0x28')](_0x231da0,function(_0x81b232){_0x1b16ca[_0xaa20('0x1f')](_0x81b232);})['then'](function(){for(var _0xa6463b=0x0;_0xa6463b<_0x1b16ca[_0xaa20('0x24')];_0xa6463b+=0x1){var _0x5316ce;var _0x112fa4=_0x1b16ca[_0xa6463b];if(_0x4d1982){_0x5316ce=path['join'](_0x50b8de,_0x403168,util[_0xaa20('0xf')](_0xaa20('0x29'),_0x403168,_0xa6463b,_0xaa20('0x2a')));}else{_0x5316ce=path[_0xaa20('0x26')](_0x50b8de,util[_0xaa20('0xf')](_0xaa20('0x2b'),_0x403168,_0xaa20('0x2a')));}fs[_0xaa20('0x2c')](_0x5316ce,json2xls(_0x112fa4),_0xaa20('0x2d'));}})['then'](function(){if(_0x4d1982){return new Promise(function(_0xbe4263){zipdir(path[_0xaa20('0x26')](_0x50b8de,_0x403168),{'saveTo':path[_0xaa20('0x26')](_0x50b8de,util[_0xaa20('0xf')](_0xaa20('0x2b'),_0x403168,_0xaa20('0x2e')))},function(_0x303187,_0x3cf199){rimraf(path['join'](_0x50b8de,_0x403168),function(){});_0xbe4263(_0xaa20('0x2f'));});});}})['then'](function(){logger['info'](util[_0xaa20('0xf')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xaa20('0x11')));return analyticExtractedReport('Completed',_0x4d1982?util[_0xaa20('0xf')](_0xaa20('0x2b'),_0x403168,_0x4d1982?_0xaa20('0x2e'):_0xaa20('0x2a')):null);});})[_0xaa20('0x30')](function(_0x58132c){logger[_0xaa20('0xe')](util['format'](_0xaa20('0x31'),EXTRACTED_REPORT_ID,_0xaa20('0x11')),util[_0xaa20('0x32')](_0x58132c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xaa20('0x33'));})[_0xaa20('0x34')](function(){process[_0xaa20('0x35')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x7f68=['mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','info','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','util','lodash','json2xls','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','then','splitSizeXlsx','sequelize','query','QueryTypes','SELECT','num','split','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','existsSync','join'];(function(_0x110973,_0x975de7){var _0xcfa20f=function(_0xfa012c){while(--_0xfa012c){_0x110973['push'](_0x110973['shift']());}};_0xcfa20f(++_0x975de7);}(_0x7f68,0xcf));var _0x87f6=function(_0x46ae53,_0x4e490d){_0x46ae53=_0x46ae53-0x0;var _0x498500=_0x7f68[_0x46ae53];return _0x498500;};'use strict';var util=require(_0x87f6('0x0'));var path=require('path');var _=require(_0x87f6('0x1'));var fs=require('fs');var json2xls=require(_0x87f6('0x2'));var BPromise=require(_0x87f6('0x3'));var zipdir=require(_0x87f6('0x4'));var rimraf=require('rimraf');var db=require(_0x87f6('0x5'))['db'];var dbH=require('../../mysqldb')[_0x87f6('0x6')];var logger=require(_0x87f6('0x7'))(_0x87f6('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x87f6('0x9')][0x2]);var QUERY=process[_0x87f6('0x9')][0x3];var PATH=process[_0x87f6('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5475ed,_0x5a05a8){var _0x397d3e={'status':_0x5475ed};var _0x2fa576={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5a05a8){_0x397d3e[_0x87f6('0xa')]=_0x5a05a8;}return db['AnalyticExtractedReport'][_0x87f6('0xb')](_0x397d3e,_0x2fa576);}function main(){var _0x3d0471=0x1388;var _0x5ddbca;logger['info'](util[_0x87f6('0xc')](_0x87f6('0xd'),EXTRACTED_REPORT_ID,_0x87f6('0xe')));return db[_0x87f6('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})[_0x87f6('0x10')](function(_0x3392f3){if(_0x3392f3){_0x5ddbca=_0x3392f3;_0x3d0471=_0x5ddbca[_0x87f6('0x11')]||0x1388;}})[_0x87f6('0x10')](function(){return dbH[_0x87f6('0x12')][_0x87f6('0x13')](util[_0x87f6('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x87f6('0x12')][_0x87f6('0x14')][_0x87f6('0x15')]});})[_0x87f6('0x10')](function(_0x5d217f){if(!_0x5d217f[0x0][_0x87f6('0x16')]){return analyticExtractedReport('Empty');}var _0xa9f478=[];var _0x174982=0x0;if(_0x5ddbca[_0x87f6('0x17')]){if(_0x5d217f&&_0x5d217f[_0x87f6('0x18')]){var _0x9c7ec6=_[_0x87f6('0x19')](_0x5d217f[0x0][_0x87f6('0x16')]/_0x3d0471);var _0x1a23b9=Number[_0x87f6('0x1a')](_0x5d217f[0x0]['num']/_0x3d0471)?_0x5d217f[0x0][_0x87f6('0x16')]%_0x3d0471:0x0;_0x9c7ec6['forEach'](function(_0x355648){if(_0x355648>0x0){_0x174982+=_0x3d0471;}_0xa9f478[_0x87f6('0x1b')](dbH[_0x87f6('0x12')]['query'](util['format'](_0x87f6('0x1c'),QUERY,_0x3d0471,_0x174982),{'type':dbH[_0x87f6('0x12')][_0x87f6('0x14')][_0x87f6('0x15')]}));});if(_0x1a23b9>0x0){_0x174982+=_0x3d0471;_0xa9f478[_0x87f6('0x1b')](dbH[_0x87f6('0x12')][_0x87f6('0x13')](util[_0x87f6('0xc')](_0x87f6('0x1c'),QUERY,_0x1a23b9,_0x174982),{'type':dbH[_0x87f6('0x12')][_0x87f6('0x14')][_0x87f6('0x15')]}));}}}else{_0xa9f478['push'](dbH[_0x87f6('0x12')][_0x87f6('0x13')](QUERY,{'type':dbH[_0x87f6('0x12')]['QueryTypes']['SELECT']}));}var _0xe7943b=path[_0x87f6('0x1d')](PATH);var _0x104997=path[_0x87f6('0x1e')](PATH,'.xlsx');var _0x21a3e1=_0x5ddbca[_0x87f6('0x17')]&&_0xa9f478[_0x87f6('0x18')]>0x1;var _0x20e68d=[];if(!fs[_0x87f6('0x1f')](path[_0x87f6('0x20')](_0xe7943b,_0x104997))&&_0x21a3e1){fs[_0x87f6('0x21')](path['join'](_0xe7943b,_0x104997));}return BPromise[_0x87f6('0x22')](_0xa9f478,function(_0x13f7f6){_0x20e68d[_0x87f6('0x1b')](_0x13f7f6);})[_0x87f6('0x10')](function(){for(var _0x543d42=0x0;_0x543d42<_0x20e68d[_0x87f6('0x18')];_0x543d42+=0x1){var _0x2e4b45;var _0x44432f=_0x20e68d[_0x543d42];if(_0x21a3e1){_0x2e4b45=path[_0x87f6('0x20')](_0xe7943b,_0x104997,util[_0x87f6('0xc')](_0x87f6('0x23'),_0x104997,_0x543d42,_0x87f6('0x24')));}else{_0x2e4b45=path['join'](_0xe7943b,util[_0x87f6('0xc')](_0x87f6('0x25'),_0x104997,_0x87f6('0x24')));}fs[_0x87f6('0x26')](_0x2e4b45,json2xls(_0x44432f),_0x87f6('0x27'));}})['then'](function(){if(_0x21a3e1){return new Promise(function(_0x17c2e8){zipdir(path['join'](_0xe7943b,_0x104997),{'saveTo':path[_0x87f6('0x20')](_0xe7943b,util[_0x87f6('0xc')]('%s.%s',_0x104997,_0x87f6('0x28')))},function(_0xe86af2,_0x119f05){rimraf(path[_0x87f6('0x20')](_0xe7943b,_0x104997),function(){});_0x17c2e8(_0x87f6('0x29'));});});}})[_0x87f6('0x10')](function(){logger[_0x87f6('0x2a')](util[_0x87f6('0xc')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x87f6('0xe')));return analyticExtractedReport(_0x87f6('0x2b'),_0x21a3e1?util[_0x87f6('0xc')]('%s.%s',_0x104997,_0x21a3e1?_0x87f6('0x28'):_0x87f6('0x24')):null);});})[_0x87f6('0x2c')](function(_0x42fc16){logger[_0x87f6('0x2a')](util['format'](_0x87f6('0x2d'),EXTRACTED_REPORT_ID,_0x87f6('0xe')),util[_0x87f6('0x2e')](_0x42fc16,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x87f6('0x2f')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index e9448c8..7641499 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 _0xb2c5=['type','format','VoiceExtensionId','Set','CDR(routeid)=','context','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','length','createdAt','updatedAt','interval','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','toLowerCase','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','catch','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extensions','extension','find','push'];(function(_0xcab889,_0x51d667){var _0x4f956e=function(_0x54f7d7){while(--_0x54f7d7){_0xcab889['push'](_0xcab889['shift']());}};_0x4f956e(++_0x51d667);}(_0xb2c5,0x14d));var _0x5b2c=function(_0x4eb832,_0x324bff){_0x4eb832=_0x4eb832-0x0;var _0x2e5927=_0xb2c5[_0x4eb832];return _0x2e5927;};'use strict';var _=require(_0x5b2c('0x0'));var util=require(_0x5b2c('0x1'));function rewrite(_0x4888c5,_0x34bac5){var _0x55eb12=this;return _0x4888c5[_0x5b2c('0x2')][_0x5b2c('0x3')][_0x5b2c('0x4')]({'raw':!![]})[_0x5b2c('0x5')](function(_0x3f8ed2){_0x55eb12[_0x5b2c('0x6')]=_0x3f8ed2;return _0x4888c5[_0x5b2c('0x2')][_0x5b2c('0x7')][_0x5b2c('0x4')]({'where':{'IntervalId':_0x34bac5[_0x5b2c('0x8')]},'raw':!![]});})[_0x5b2c('0x5')](function(_0x3eb21c){return _0x4888c5[_0x5b2c('0x2')][_0x5b2c('0x7')][_0x5b2c('0x4')]({'where':{'exten':{'$in':_[_0x5b2c('0x9')](_[_0x5b2c('0xa')](_0x3eb21c,_0x5b2c('0xb')))}},'order':[{'raw':_0x5b2c('0xc')}],'raw':!![]});})['then'](function(_0x218a1d){var _0x19c0d8=_[_0x5b2c('0xd')](_0x218a1d,{'priority':'1'});var _0x263a02=_[_0x5b2c('0xd')](_0x218a1d,{'isApp':0x1});var _0x1b29d9=_[_0x5b2c('0xe')](_0x263a02,'exten');var _0x2f2aa9=[_0x5b2c('0xf'),_0x5b2c('0x10')];var _0x276693=[];var _0x3007dd=[];for(var _0xc6a8f9 in _0x1b29d9){if(_0x1b29d9['hasOwnProperty'](_0xc6a8f9)){_0x55eb12[_0x5b2c('0x11')]=0x2;_0x55eb12[_0x5b2c('0x12')]=[];_0x55eb12[_0x5b2c('0x13')]=_[_0x5b2c('0x14')](_0x19c0d8,{'exten':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0xb')]});_0x55eb12[_0x5b2c('0x12')][_0x5b2c('0x15')]({'type':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x16')],'app':'Set','appdata':util[_0x5b2c('0x17')]('CDR(type)=%s',_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x16')]),'context':_0x1b29d9[_0xc6a8f9][0x0]['context'],'exten':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0xb')],'priority':_0x55eb12[_0x5b2c('0x11')]++,'VoiceExtensionId':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x18')]});if(_0x1b29d9[_0xc6a8f9][0x0]['type']==='inbound'){_0x55eb12[_0x5b2c('0x12')][_0x5b2c('0x15')]({'type':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x16')],'app':_0x5b2c('0x19'),'appdata':_0x5b2c('0x1a')+_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x18')],'context':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x1b')],'exten':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0xb')],'priority':_0x55eb12['priority']++,'VoiceExtensionId':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x18')]});}else if(_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x16')]===_0x5b2c('0x1c')){if(_0x55eb12['extension']){_0x55eb12[_0x5b2c('0x12')][_0x5b2c('0x15')]({'type':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x16')],'app':'Set','appdata':_0x5b2c('0x1d')+(_0x55eb12[_0x5b2c('0x13')][_0x5b2c('0x1e')]?_0x5b2c('0x1f')+_0x55eb12[_0x5b2c('0x13')]['cutdigits']+'}':_0x5b2c('0x20')),'context':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x1b')],'exten':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0xb')],'priority':_0x55eb12[_0x5b2c('0x11')]++,'VoiceExtensionId':_0x1b29d9[_0xc6a8f9][0x0]['VoiceExtensionId']});}_0x55eb12['extensions']['push']({'type':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x16')],'app':_0x5b2c('0x19'),'appdata':_0x5b2c('0x1a')+_0x1b29d9[_0xc6a8f9][0x0]['VoiceExtensionId'],'context':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x1b')],'exten':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0xb')],'priority':_0x55eb12[_0x5b2c('0x11')]++,'VoiceExtensionId':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x18')]});var _0x3952b0=_0x55eb12['priority']++;_0x55eb12[_0x5b2c('0x12')]['push']({'type':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x16')],'app':'ExecIf','appdata':_0x5b2c('0x21')+(_0x3952b0+0x2)+_0x5b2c('0x22')+(_0x3952b0+0x1)+')','context':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x1b')],'exten':_0x1b29d9[_0xc6a8f9][0x0]['exten'],'priority':_0x3952b0,'VoiceExtensionId':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x18')]});if(_0x55eb12[_0x5b2c('0x13')]){_0x55eb12['extensions']['push']({'type':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x16')],'app':_0x5b2c('0x19'),'appdata':_0x55eb12[_0x5b2c('0x13')][_0x5b2c('0x1e')]?'CDR(prefix)=${EXTEN:0:'+_0x55eb12[_0x5b2c('0x13')][_0x5b2c('0x1e')]+'}':_0x5b2c('0x23'),'context':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x1b')],'exten':_0x1b29d9[_0xc6a8f9][0x0]['exten'],'priority':_0x55eb12[_0x5b2c('0x11')]++,'VoiceExtensionId':_0x1b29d9[_0xc6a8f9][0x0]['VoiceExtensionId']});}_0x55eb12[_0x5b2c('0x12')][_0x5b2c('0x15')]({'type':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x16')],'app':'Set','appdata':_0x5b2c('0x24')+_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x18')],'context':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x1b')],'exten':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0xb')],'priority':_0x55eb12[_0x5b2c('0x11')]++,'VoiceExtensionId':_0x1b29d9[_0xc6a8f9][0x0]['VoiceExtensionId']});if(_0x55eb12['extension']&&_0x55eb12[_0x5b2c('0x13')][_0x5b2c('0x25')](_0x5b2c('0x26'))&&_0x55eb12[_0x5b2c('0x13')][_0x5b2c('0x26')]!==_0x5b2c('0x27')){_0x55eb12[_0x5b2c('0x12')][_0x5b2c('0x15')]({'type':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x16')],'app':_0x5b2c('0x19'),'appdata':_0x5b2c('0x28'),'context':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x1b')],'exten':_0x1b29d9[_0xc6a8f9][0x0]['exten'],'priority':_0x55eb12[_0x5b2c('0x11')]++,'VoiceExtensionId':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x18')]});_0x55eb12[_0x5b2c('0x12')][_0x5b2c('0x15')]({'type':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x16')],'app':'Set','appdata':_0x5b2c('0x29')+_0x55eb12['extension'][_0x5b2c('0x26')]||_0x5b2c('0x2a'),'context':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x1b')],'exten':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0xb')],'priority':_0x55eb12['priority']++,'VoiceExtensionId':_0x1b29d9[_0xc6a8f9][0x0]['VoiceExtensionId']});}}_0x55eb12[_0x5b2c('0x12')]['push']({'type':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x16')],'app':_0x5b2c('0x19'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x1b')],'exten':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0xb')],'priority':_0x55eb12[_0x5b2c('0x11')]++,'VoiceExtensionId':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x18')]});_0x55eb12[_0x5b2c('0x12')]['push']({'type':_0x1b29d9[_0xc6a8f9][0x0]['type'],'app':_0x5b2c('0x19'),'appdata':_0x5b2c('0x2b'),'context':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x1b')],'exten':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0xb')],'priority':_0x55eb12['priority']++,'VoiceExtensionId':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x18')]});_0x55eb12[_0x5b2c('0x12')][_0x5b2c('0x15')]({'type':_0x1b29d9[_0xc6a8f9][0x0]['type'],'app':_0x5b2c('0x19'),'appdata':'MONITOR_OPTIONS=ab','context':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x1b')],'exten':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0xb')],'priority':_0x55eb12[_0x5b2c('0x11')]++,'VoiceExtensionId':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x18')]});for(var _0x973339=0x0,_0x2c2c86=0x0;_0x973339<_0x1b29d9[_0xc6a8f9][_0x5b2c('0x2c')];_0x973339+=0x1,_0x2c2c86=0x0){var _0x3750f9=_0x1b29d9[_0xc6a8f9][_0x973339];if(_0x3750f9[_0x5b2c('0x16')]){_0x3750f9['type']=_0x3750f9['type']['toLowerCase']();}var _0x5747b9=[];var _0x52666b=[];delete _0x3750f9['id'];delete _0x3750f9[_0x5b2c('0x2d')];delete _0x3750f9[_0x5b2c('0x2e')];var _0x491033=_0x3750f9[_0x5b2c('0x2f')]!=='*,*,*,*'?[_0x3750f9['interval']]:_0x3750f9[_0x5b2c('0x8')]?_[_0x5b2c('0xa')](_[_0x5b2c('0xd')](_0x55eb12[_0x5b2c('0x6')],{'IntervalId':_0x3750f9[_0x5b2c('0x8')]}),'interval'):[];if(_0x3750f9[_0x5b2c('0x25')]('tag')){if(_0x3750f9[_0x5b2c('0x30')]&&_0x3750f9[_0x5b2c('0x30')]!=='--'){_0x5747b9[_0x5b2c('0x15')]({'type':_0x3750f9[_0x5b2c('0x16')],'app':'Set','appdata':_0x5b2c('0x31')+_0x3750f9['tag'],'context':_0x3750f9[_0x5b2c('0x1b')],'exten':_0x3750f9[_0x5b2c('0xb')],'priority':_0x491033['length']+_0x55eb12['priority']+_0x2c2c86++,'VoiceExtensionId':_0x3750f9[_0x5b2c('0x18')]});}}if(_0x3750f9['type']===_0x5b2c('0x1c')&&_0x3750f9['hasOwnProperty'](_0x5b2c('0x32'))){if(_0x3750f9[_0x5b2c('0x32')]){_0x5747b9['push']({'type':_0x3750f9[_0x5b2c('0x16')],'app':_0x5b2c('0x33'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x3750f9['callerID']+')','context':_0x3750f9[_0x5b2c('0x1b')],'exten':_0x3750f9[_0x5b2c('0xb')],'priority':_0x491033[_0x5b2c('0x2c')]+_0x55eb12[_0x5b2c('0x11')]+_0x2c2c86++,'VoiceExtensionId':_0x3750f9[_0x5b2c('0x18')]});}else{_0x5747b9['push']({'type':_0x3750f9[_0x5b2c('0x16')],'app':_0x5b2c('0x33'),'appdata':_0x5b2c('0x34'),'context':_0x3750f9[_0x5b2c('0x1b')],'exten':_0x3750f9[_0x5b2c('0xb')],'priority':_0x491033[_0x5b2c('0x2c')]+_0x55eb12['priority']+_0x2c2c86++,'VoiceExtensionId':_0x3750f9['VoiceExtensionId']});}}if(_0x3750f9[_0x5b2c('0x25')](_0x5b2c('0x35'))){if(_0x2f2aa9[_0x5b2c('0x36')](_0x3750f9[_0x5b2c('0x37')][_0x5b2c('0x38')]())>=0x0&&_0x3750f9[_0x5b2c('0x39')]!==_0x5b2c('0x3a')){if(_0x3750f9['answer']){_0x5747b9[_0x5b2c('0x15')]({'type':_0x3750f9[_0x5b2c('0x16')],'app':_0x5b2c('0x33'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x3750f9['context'],'exten':_0x3750f9[_0x5b2c('0xb')],'priority':_0x491033[_0x5b2c('0x2c')]+_0x55eb12[_0x5b2c('0x11')]+_0x2c2c86++,'VoiceExtensionId':_0x3750f9[_0x5b2c('0x18')]});_0x5747b9[_0x5b2c('0x15')]({'type':_0x3750f9[_0x5b2c('0x16')],'app':_0x5b2c('0x19'),'appdata':_0x5b2c('0x3b'),'context':_0x3750f9['context'],'exten':_0x3750f9[_0x5b2c('0xb')],'priority':_0x491033[_0x5b2c('0x2c')]+_0x55eb12[_0x5b2c('0x11')]+_0x2c2c86++,'VoiceExtensionId':_0x3750f9['VoiceExtensionId']});}else{_0x5747b9[_0x5b2c('0x15')]({'type':_0x3750f9[_0x5b2c('0x16')],'app':'ExecIf','appdata':_0x5b2c('0x3c'),'context':_0x3750f9[_0x5b2c('0x1b')],'exten':_0x3750f9[_0x5b2c('0xb')],'priority':_0x491033[_0x5b2c('0x2c')]+_0x55eb12[_0x5b2c('0x11')]+_0x2c2c86++,'VoiceExtensionId':_0x3750f9[_0x5b2c('0x18')]});_0x5747b9[_0x5b2c('0x15')]({'type':_0x3750f9[_0x5b2c('0x16')],'app':_0x5b2c('0x19'),'appdata':_0x5b2c('0x3d'),'context':_0x3750f9[_0x5b2c('0x1b')],'exten':_0x3750f9[_0x5b2c('0xb')],'priority':_0x491033[_0x5b2c('0x2c')]+_0x55eb12[_0x5b2c('0x11')]+_0x2c2c86++,'VoiceExtensionId':_0x3750f9[_0x5b2c('0x18')]});}}}for(var _0x47df7d=0x0;_0x47df7d<_0x491033[_0x5b2c('0x2c')];_0x47df7d+=0x1){var _0x49451e=_0x55eb12['priority']+_0x491033[_0x5b2c('0x2c')];var _0x449fd4=_0x47df7d===_0x491033['length']-0x1?_0x55eb12[_0x5b2c('0x11')]+_0x5747b9[_0x5b2c('0x2c')]+_0x52666b['length']+0x2:_0x55eb12[_0x5b2c('0x11')]+_0x47df7d+0x1;_0x5747b9['splice'](_0x47df7d,0x0,{'type':_0x3750f9[_0x5b2c('0x16')],'app':_0x5b2c('0x3e'),'appdata':_0x491033[_0x47df7d]+'?'+_0x3750f9['context']+_0x5b2c('0x3f')+_0x49451e+':'+_0x3750f9[_0x5b2c('0x1b')]+_0x5b2c('0x3f')+_0x449fd4,'exten':_0x3750f9['exten'],'context':_0x3750f9[_0x5b2c('0x1b')],'priority':_0x55eb12[_0x5b2c('0x11')]+_0x47df7d,'VoiceExtensionId':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x18')]});}_0x3750f9[_0x5b2c('0x11')]=_0x5747b9[_0x5b2c('0x2c')]?_[_0x5b2c('0x40')](_0x5747b9)['priority']+0x1:_0x55eb12['priority'];_0x55eb12[_0x5b2c('0x11')]=(_0x52666b[_0x5b2c('0x2c')]?_['last'](_0x52666b)[_0x5b2c('0x11')]:_0x3750f9['priority'])+0x1;_0x55eb12[_0x5b2c('0x12')]=_[_0x5b2c('0x41')](_0x55eb12[_0x5b2c('0x12')],_0x5747b9,[_0x3750f9],_0x52666b);}_0x55eb12[_0x5b2c('0x12')][_0x5b2c('0x15')]({'type':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x16')],'app':'Hangup','exten':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0xb')],'context':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x1b')],'priority':_0x55eb12[_0x5b2c('0x11')],'VoiceExtensionId':_0x1b29d9[_0xc6a8f9][0x0]['VoiceExtensionId']});_0x276693[_0x5b2c('0x15')](_0x1b29d9[_0xc6a8f9][0x0]['VoiceExtensionId']);_0x3007dd=_['concat'](_0x3007dd,_0x55eb12['extensions']);}}return _0x4888c5[_0x5b2c('0x42')](function(_0x1cc4a6){return _0x4888c5['models'][_0x5b2c('0x7')][_0x5b2c('0x43')]({'where':{'VoiceExtensionId':{'$in':_0x276693}},'transaction':_0x1cc4a6})[_0x5b2c('0x5')](function(_0x5d8001){return _0x4888c5[_0x5b2c('0x2')][_0x5b2c('0x7')][_0x5b2c('0x44')](_['sortBy'](_0x3007dd,_0x5b2c('0x11')),{'transaction':_0x1cc4a6});});});})[_0x5b2c('0x45')](function(_0x5959c6){console['error'](_0x5959c6);});}exports[_0x5b2c('0x46')]=rewrite; \ No newline at end of file +var _0x1e80=['extension','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','length','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','tag','CDR(tag)=','callerID','answer','indexOf','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','last','Hangup','concat','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','findAll','then','intervals','models','IntervalId','VoiceExtension','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','playback','priority','extensions','find','push','Set','type','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound'];(function(_0x888931,_0x52f998){var _0x4dac8b=function(_0x6f30d9){while(--_0x6f30d9){_0x888931['push'](_0x888931['shift']());}};_0x4dac8b(++_0x52f998);}(_0x1e80,0x1b0));var _0x01e8=function(_0x26003b,_0x37abc9){_0x26003b=_0x26003b-0x0;var _0x1a8dc9=_0x1e80[_0x26003b];return _0x1a8dc9;};'use strict';var _=require(_0x01e8('0x0'));var util=require('util');function rewrite(_0x3e8267,_0x528e8c){var _0x22218c=this;return _0x3e8267['models']['Interval'][_0x01e8('0x1')]({'raw':!![]})[_0x01e8('0x2')](function(_0x414a41){_0x22218c[_0x01e8('0x3')]=_0x414a41;return _0x3e8267[_0x01e8('0x4')]['VoiceExtension'][_0x01e8('0x1')]({'where':{'IntervalId':_0x528e8c[_0x01e8('0x5')]},'raw':!![]});})[_0x01e8('0x2')](function(_0x1e9837){return _0x3e8267[_0x01e8('0x4')][_0x01e8('0x6')][_0x01e8('0x1')]({'where':{'exten':{'$in':_['uniq'](_[_0x01e8('0x7')](_0x1e9837,_0x01e8('0x8')))}},'order':[{'raw':_0x01e8('0x9')}],'raw':!![]});})[_0x01e8('0x2')](function(_0x347d0a){var _0x26febf=_[_0x01e8('0xa')](_0x347d0a,{'priority':'1'});var _0x4a64ac=_['filter'](_0x347d0a,{'isApp':0x1});var _0x1d9c15=_['groupBy'](_0x4a64ac,_0x01e8('0x8'));var _0x5df067=['queue',_0x01e8('0xb')];var _0x30ba4f=[];var _0x16ebea=[];for(var _0xd01c4f in _0x1d9c15){if(_0x1d9c15['hasOwnProperty'](_0xd01c4f)){_0x22218c[_0x01e8('0xc')]=0x2;_0x22218c[_0x01e8('0xd')]=[];_0x22218c['extension']=_[_0x01e8('0xe')](_0x26febf,{'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')]});_0x22218c[_0x01e8('0xd')][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0]['type'],'app':_0x01e8('0x10'),'appdata':util['format']('CDR(type)=%s',_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')]),'context':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x12')],'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')],'priority':_0x22218c['priority']++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});if(_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')]===_0x01e8('0x14')){_0x22218c[_0x01e8('0xd')][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')],'app':_0x01e8('0x10'),'appdata':_0x01e8('0x15')+_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')],'context':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x12')],'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')],'priority':_0x22218c[_0x01e8('0xc')]++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});}else if(_0x1d9c15[_0xd01c4f][0x0]['type']===_0x01e8('0x16')){if(_0x22218c[_0x01e8('0x17')]){_0x22218c['extensions']['push']({'type':_0x1d9c15[_0xd01c4f][0x0]['type'],'app':_0x01e8('0x10'),'appdata':_0x01e8('0x18')+(_0x22218c[_0x01e8('0x17')][_0x01e8('0x19')]?_0x01e8('0x1a')+_0x22218c['extension'][_0x01e8('0x19')]+'}':'${EXTEN}'),'context':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x12')],'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')],'priority':_0x22218c['priority']++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});}_0x22218c[_0x01e8('0xd')][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')],'app':'Set','appdata':_0x01e8('0x15')+_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')],'context':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x12')],'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')],'priority':_0x22218c[_0x01e8('0xc')]++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});var _0x1508d5=_0x22218c[_0x01e8('0xc')]++;_0x22218c[_0x01e8('0xd')][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0]['type'],'app':_0x01e8('0x1b'),'appdata':_0x01e8('0x1c')+(_0x1508d5+0x2)+'):Goto('+(_0x1508d5+0x1)+')','context':_0x1d9c15[_0xd01c4f][0x0]['context'],'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')],'priority':_0x1508d5,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});if(_0x22218c[_0x01e8('0x17')]){_0x22218c[_0x01e8('0xd')][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')],'app':'Set','appdata':_0x22218c['extension']['cutdigits']?_0x01e8('0x1d')+_0x22218c['extension'][_0x01e8('0x19')]+'}':_0x01e8('0x1e'),'context':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x12')],'exten':_0x1d9c15[_0xd01c4f][0x0]['exten'],'priority':_0x22218c['priority']++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0]['VoiceExtensionId']});}_0x22218c['extensions']['push']({'type':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')],'app':'Set','appdata':_0x01e8('0x1f')+_0x1d9c15[_0xd01c4f][0x0]['VoiceExtensionId'],'context':_0x1d9c15[_0xd01c4f][0x0]['context'],'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')],'priority':_0x22218c[_0x01e8('0xc')]++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0]['VoiceExtensionId']});if(_0x22218c['extension']&&_0x22218c['extension'][_0x01e8('0x20')](_0x01e8('0x21'))&&_0x22218c[_0x01e8('0x17')]['recordingFormat']!==_0x01e8('0x22')){_0x22218c['extensions'][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')],'app':_0x01e8('0x10'),'appdata':_0x01e8('0x23'),'context':_0x1d9c15[_0xd01c4f][0x0]['context'],'exten':_0x1d9c15[_0xd01c4f][0x0]['exten'],'priority':_0x22218c[_0x01e8('0xc')]++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});_0x22218c[_0x01e8('0xd')][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')],'app':'Set','appdata':_0x01e8('0x24')+_0x22218c[_0x01e8('0x17')]['recordingFormat']||'wav','context':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x12')],'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')],'priority':_0x22218c['priority']++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});}}_0x22218c['extensions'][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0]['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x12')],'exten':_0x1d9c15[_0xd01c4f][0x0]['exten'],'priority':_0x22218c['priority']++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0]['VoiceExtensionId']});_0x22218c['extensions'][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')],'app':_0x01e8('0x10'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x12')],'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')],'priority':_0x22218c['priority']++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});_0x22218c[_0x01e8('0xd')][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x1d9c15[_0xd01c4f][0x0]['context'],'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')],'priority':_0x22218c[_0x01e8('0xc')]++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});for(var _0x2b967a=0x0,_0x5b6bcd=0x0;_0x2b967a<_0x1d9c15[_0xd01c4f][_0x01e8('0x25')];_0x2b967a+=0x1,_0x5b6bcd=0x0){var _0x63aee6=_0x1d9c15[_0xd01c4f][_0x2b967a];if(_0x63aee6[_0x01e8('0x11')]){_0x63aee6['type']=_0x63aee6['type'][_0x01e8('0x26')]();}var _0x3d178a=[];var _0x4565fa=[];delete _0x63aee6['id'];delete _0x63aee6[_0x01e8('0x27')];delete _0x63aee6[_0x01e8('0x28')];var _0x27542d=_0x63aee6['interval']!==_0x01e8('0x29')?[_0x63aee6[_0x01e8('0x2a')]]:_0x63aee6[_0x01e8('0x5')]?_[_0x01e8('0x7')](_[_0x01e8('0xa')](_0x22218c[_0x01e8('0x3')],{'IntervalId':_0x63aee6[_0x01e8('0x5')]}),_0x01e8('0x2a')):[];if(_0x63aee6[_0x01e8('0x20')](_0x01e8('0x2b'))){if(_0x63aee6[_0x01e8('0x2b')]&&_0x63aee6[_0x01e8('0x2b')]!=='--'){_0x3d178a[_0x01e8('0xf')]({'type':_0x63aee6[_0x01e8('0x11')],'app':_0x01e8('0x10'),'appdata':_0x01e8('0x2c')+_0x63aee6[_0x01e8('0x2b')],'context':_0x63aee6[_0x01e8('0x12')],'exten':_0x63aee6[_0x01e8('0x8')],'priority':_0x27542d[_0x01e8('0x25')]+_0x22218c[_0x01e8('0xc')]+_0x5b6bcd++,'VoiceExtensionId':_0x63aee6['VoiceExtensionId']});}}if(_0x63aee6[_0x01e8('0x11')]===_0x01e8('0x16')&&_0x63aee6['hasOwnProperty']('callerID')){if(_0x63aee6[_0x01e8('0x2d')]){_0x3d178a[_0x01e8('0xf')]({'type':_0x63aee6[_0x01e8('0x11')],'app':_0x01e8('0x1b'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x63aee6[_0x01e8('0x2d')]+')','context':_0x63aee6[_0x01e8('0x12')],'exten':_0x63aee6[_0x01e8('0x8')],'priority':_0x27542d[_0x01e8('0x25')]+_0x22218c['priority']+_0x5b6bcd++,'VoiceExtensionId':_0x63aee6['VoiceExtensionId']});}else{_0x3d178a[_0x01e8('0xf')]({'type':_0x63aee6['type'],'app':_0x01e8('0x1b'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x63aee6['context'],'exten':_0x63aee6[_0x01e8('0x8')],'priority':_0x27542d['length']+_0x22218c[_0x01e8('0xc')]+_0x5b6bcd++,'VoiceExtensionId':_0x63aee6[_0x01e8('0x13')]});}}if(_0x63aee6[_0x01e8('0x20')](_0x01e8('0x2e'))){if(_0x5df067[_0x01e8('0x2f')](_0x63aee6[_0x01e8('0x30')][_0x01e8('0x26')]())>=0x0&&_0x63aee6[_0x01e8('0x31')]!==_0x01e8('0x32')){if(_0x63aee6[_0x01e8('0x2e')]){_0x3d178a['push']({'type':_0x63aee6[_0x01e8('0x11')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x63aee6[_0x01e8('0x12')],'exten':_0x63aee6['exten'],'priority':_0x27542d['length']+_0x22218c[_0x01e8('0xc')]+_0x5b6bcd++,'VoiceExtensionId':_0x63aee6[_0x01e8('0x13')]});_0x3d178a[_0x01e8('0xf')]({'type':_0x63aee6[_0x01e8('0x11')],'app':_0x01e8('0x10'),'appdata':_0x01e8('0x33'),'context':_0x63aee6['context'],'exten':_0x63aee6[_0x01e8('0x8')],'priority':_0x27542d[_0x01e8('0x25')]+_0x22218c[_0x01e8('0xc')]+_0x5b6bcd++,'VoiceExtensionId':_0x63aee6[_0x01e8('0x13')]});}else{_0x3d178a[_0x01e8('0xf')]({'type':_0x63aee6[_0x01e8('0x11')],'app':_0x01e8('0x1b'),'appdata':_0x01e8('0x34'),'context':_0x63aee6['context'],'exten':_0x63aee6[_0x01e8('0x8')],'priority':_0x27542d[_0x01e8('0x25')]+_0x22218c[_0x01e8('0xc')]+_0x5b6bcd++,'VoiceExtensionId':_0x63aee6[_0x01e8('0x13')]});_0x3d178a['push']({'type':_0x63aee6[_0x01e8('0x11')],'app':_0x01e8('0x10'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x63aee6[_0x01e8('0x12')],'exten':_0x63aee6[_0x01e8('0x8')],'priority':_0x27542d[_0x01e8('0x25')]+_0x22218c[_0x01e8('0xc')]+_0x5b6bcd++,'VoiceExtensionId':_0x63aee6[_0x01e8('0x13')]});}}}for(var _0x1208c7=0x0;_0x1208c7<_0x27542d[_0x01e8('0x25')];_0x1208c7+=0x1){var _0x3585b4=_0x22218c[_0x01e8('0xc')]+_0x27542d[_0x01e8('0x25')];var _0x23b6c7=_0x1208c7===_0x27542d[_0x01e8('0x25')]-0x1?_0x22218c[_0x01e8('0xc')]+_0x3d178a['length']+_0x4565fa[_0x01e8('0x25')]+0x2:_0x22218c['priority']+_0x1208c7+0x1;_0x3d178a[_0x01e8('0x35')](_0x1208c7,0x0,{'type':_0x63aee6[_0x01e8('0x11')],'app':'GotoIfTime','appdata':_0x27542d[_0x1208c7]+'?'+_0x63aee6[_0x01e8('0x12')]+_0x01e8('0x36')+_0x3585b4+':'+_0x63aee6['context']+_0x01e8('0x36')+_0x23b6c7,'exten':_0x63aee6['exten'],'context':_0x63aee6['context'],'priority':_0x22218c[_0x01e8('0xc')]+_0x1208c7,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});}_0x63aee6[_0x01e8('0xc')]=_0x3d178a[_0x01e8('0x25')]?_[_0x01e8('0x37')](_0x3d178a)[_0x01e8('0xc')]+0x1:_0x22218c['priority'];_0x22218c[_0x01e8('0xc')]=(_0x4565fa[_0x01e8('0x25')]?_['last'](_0x4565fa)['priority']:_0x63aee6[_0x01e8('0xc')])+0x1;_0x22218c[_0x01e8('0xd')]=_['concat'](_0x22218c['extensions'],_0x3d178a,[_0x63aee6],_0x4565fa);}_0x22218c[_0x01e8('0xd')][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')],'app':_0x01e8('0x38'),'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')],'context':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x12')],'priority':_0x22218c[_0x01e8('0xc')],'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});_0x30ba4f['push'](_0x1d9c15[_0xd01c4f][0x0]['VoiceExtensionId']);_0x16ebea=_[_0x01e8('0x39')](_0x16ebea,_0x22218c[_0x01e8('0xd')]);}}return _0x3e8267[_0x01e8('0x3a')](function(_0x2b5974){return _0x3e8267[_0x01e8('0x4')][_0x01e8('0x6')][_0x01e8('0x3b')]({'where':{'VoiceExtensionId':{'$in':_0x30ba4f}},'transaction':_0x2b5974})['then'](function(_0x3dfc4c){return _0x3e8267[_0x01e8('0x4')][_0x01e8('0x6')][_0x01e8('0x3c')](_[_0x01e8('0x3d')](_0x16ebea,_0x01e8('0xc')),{'transaction':_0x2b5974});});});})[_0x01e8('0x3e')](function(_0x40713c){console[_0x01e8('0x3f')](_0x40713c);});}exports[_0x01e8('0x40')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 085badc..61b9d33 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 _0xbf87=['Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/logger','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','register','undefined','argv','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate','CmContact','keys','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','inspect','insert','into','cm_hopper','fromQuery','createdAt','updatedAt','select','field','ContactId','toString','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','scheduledAt','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','VoiceQueue','findAll','outbound','CmList','get','always','push','sequelize','VoiceQueueId','query','BlackLists','all','Campaign','dialCheckDuplicateType','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','Unable\x20to\x20delete\x20temp\x20file:','stringify','exit','info','resolve','createReadStream','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error'];(function(_0x281cf4,_0x5f3a4b){var _0x3a77ab=function(_0x155bcb){while(--_0x155bcb){_0x281cf4['push'](_0x281cf4['shift']());}};_0x3a77ab(++_0x5f3a4b);}(_0xbf87,0xd3));var _0x7bf8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbf87[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x7bf8('0x0'));var util=require(_0x7bf8('0x1'));var _=require(_0x7bf8('0x2'));var fs=require('fs');var squel=require(_0x7bf8('0x3'));var Papa=require(_0x7bf8('0x4'));var Redis=require(_0x7bf8('0x5'));var db=require(_0x7bf8('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0x7bf8('0x7'))('api');config[_0x7bf8('0x8')]=_[_0x7bf8('0x9')](config[_0x7bf8('0x8')],{'host':_0x7bf8('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7bf8('0x8')]));require(_0x7bf8('0xb'))[_0x7bf8('0xc')](socket);try{if(!process['argv'][0x2]||process['argv'][0x2]===_0x7bf8('0xd')||process[_0x7bf8('0xe')][0x2]===_0x7bf8('0xf')){throw new Error(_0x7bf8('0x10'));}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process[_0x7bf8('0xe')][0x3]===_0x7bf8('0xd')||process[_0x7bf8('0xe')][0x3]===_0x7bf8('0xf')||!process[_0x7bf8('0xe')][0x4]||process[_0x7bf8('0xe')][0x4]===_0x7bf8('0xd')||process['argv'][0x4]===_0x7bf8('0xf')){throw new Error(_0x7bf8('0x11'));}var FIELDS=_[_0x7bf8('0x12')](process[_0x7bf8('0xe')][0x3][_0x7bf8('0x13')](','),process[_0x7bf8('0xe')][0x4][_0x7bf8('0x13')](','));if(!process['argv'][0x5]||process['argv'][0x5]===_0x7bf8('0xd')||process[_0x7bf8('0xe')][0x5]===_0x7bf8('0xf')){throw new Error(_0x7bf8('0x14'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x7bf8('0xe')][0x6]&&process[_0x7bf8('0xe')][0x6]!==_0x7bf8('0xd')&&process[_0x7bf8('0xe')][0x6]!==_0x7bf8('0xf')?process[_0x7bf8('0xe')][0x6]:null;var DUPLICATES=process[_0x7bf8('0xe')][0x7]&&process[_0x7bf8('0xe')][0x7]!==_0x7bf8('0xd')&&process[_0x7bf8('0xe')][0x7]!==_0x7bf8('0xf')?process[_0x7bf8('0xe')][0x7]:null;if(!process[_0x7bf8('0xe')][0x8]||process[_0x7bf8('0xe')][0x8]==='undefined'||process[_0x7bf8('0xe')][0x8]===_0x7bf8('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x7bf8('0xe')][0x8];}catch(_0x7e495f){logger[_0x7bf8('0x15')](_0x7e495f);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(_0x5c0a1c,_0x236a2c,_0x17f6ef,_0x30cdc3){var _0x2498df={'message':_0x236a2c};_0x2498df[_0x5c0a1c]=!![];if(_0x17f6ef){_0x2498df[_0x7bf8('0x16')]=_0x17f6ef;}if(_0x30cdc3){_0x2498df['index']=_0x30cdc3;}return _0x2498df;}function isEmail(_0x5aaf88){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))*$/[_0x7bf8('0x17')](_0x5aaf88);}function checkRow(_0x13977a,_0x137449,_0x7e6462){return new BPromise(function(_0x4db7aa,_0x2c1f12){if(_[_0x7bf8('0x18')](_0x13977a)){return _0x2c1f12(handleCheckRowError(_0x7bf8('0x15'),_0x7bf8('0x19'),null,_0x7e6462));}if(_0x13977a[_0x7bf8('0x1a')]&&_0x13977a[_0x7bf8('0x1a')][_0x7bf8('0x1b')]){var _0x5d2200=_['map'](_0x13977a['errors'],'message')[_0x7bf8('0x1c')](';');return _0x2c1f12(handleCheckRowError(_0x7bf8('0x15'),_0x5d2200,null,_0x7e6462));}var _0x252210={};for(var _0x53046a in FIELDS){if(FIELDS[_0x7bf8('0x1d')](_0x53046a)&&FIELDS[_0x53046a]){_0x252210[_0x53046a]=_0x13977a['data'][0x0][FIELDS[_0x53046a]]||_0x13977a[_0x7bf8('0x1e')][0x0]['\ufeff'+FIELDS[_0x53046a]];}}if(!_0x252210['firstName']){return _0x2c1f12(handleCheckRowError('error',_0x7bf8('0x1f'),null,_0x7e6462));}if(!_0x252210[_0x7bf8('0x20')]){return _0x2c1f12(handleCheckRowError(_0x7bf8('0x15'),_0x7bf8('0x21'),null,_0x7e6462));}if(_0x252210[_0x7bf8('0x22')]){var _0x2e0b3a=moment(_0x252210[_0x7bf8('0x22')],'YYYY-MM-DD');if(!_0x2e0b3a[_0x7bf8('0x23')]()){return _0x2c1f12(handleCheckRowError(_0x7bf8('0x15'),_0x7bf8('0x24'),null,_0x7e6462));}}if(_0x252210[_0x7bf8('0x25')]){if(!isEmail(_0x252210[_0x7bf8('0x25')])){return _0x2c1f12(handleCheckRowError('error',_0x7bf8('0x26'),null,_0x7e6462));}}_0x252210[_0x7bf8('0x27')]=LISTID;_0x252210[_0x7bf8('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7bf8('0x1b')]&&_0x137449){var _0x2af7d9={};for(var _0xffb1cf=0x0,_0x588ee1=DUPLICATES[_0x7bf8('0x1b')];_0xffb1cf<_0x588ee1;_0xffb1cf+=0x1){_0x2af7d9[DUPLICATES[_0xffb1cf]]=_0x252210[DUPLICATES[_0xffb1cf]];}var _0x4913ba=_['find'](_0x137449,_0x2af7d9);if(_0x4913ba){return _0x2c1f12(handleCheckRowError(_0x7bf8('0x29'),'Duplicate\x20Contact',_0x4913ba,_0x7e6462));}}return db[_0x7bf8('0x2a')]['create'](_0x252210,{'raw':!![],'hooks':![],'fields':_[_0x7bf8('0x2b')](_0x252210)})[_0x7bf8('0x2c')](function(_0x43cf9e){if(DUPLICATES&&DUPLICATES[_0x7bf8('0x1b')]&&_0x137449){_0x137449['push'](_[_0x7bf8('0x2d')](_0x252210,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x43cf9e['id'];return _0x4db7aa();})[_0x7bf8('0x2e')](function(_0x59f9bb){return _0x2c1f12(handleCheckRowError(_0x7bf8('0x15'),_0x7bf8('0x2f')+(_0x59f9bb['message']||JSON['stringify'](_0x59f9bb)),null,_0x7e6462));});});}function checkHopper(){function _0x9bcc8f(){return function(_0xaa489){logger[_0x7bf8('0x15')](_0x7bf8('0x30'),'checkHopper',util[_0x7bf8('0x31')](_0xaa489,{'showHidden':![],'depth':null}));};}var _0xad7081=function(_0x232761,_0x3ef9f5){var _0x13dacc=squel[_0x7bf8('0x32')]()[_0x7bf8('0x33')](_0x7bf8('0x34'))[_0x7bf8('0x35')]([_0x7bf8('0x20'),'scheduledAt','ContactId',_0x7bf8('0x27'),_0x3ef9f5,_0x7bf8('0x36'),_0x7bf8('0x37')],squel[_0x7bf8('0x38')]()[_0x7bf8('0x39')](_0x7bf8('0x20'),_0x7bf8('0x20'))['field']('NOW()','scheduledAt')['field']('id',_0x7bf8('0x3a'))[_0x7bf8('0x39')](LISTID[_0x7bf8('0x3b')](),_0x7bf8('0x27'))[_0x7bf8('0x39')](_0x232761['id'][_0x7bf8('0x3b')](),_0x3ef9f5)[_0x7bf8('0x39')](_0x7bf8('0x3c'),_0x7bf8('0x36'))['field']('NOW()',_0x7bf8('0x37'))[_0x7bf8('0x3d')](_0x7bf8('0x3e'))[_0x7bf8('0x3f')](_0x7bf8('0x40'))[_0x7bf8('0x3f')](_0x7bf8('0x41'),LISTID[_0x7bf8('0x3b')]())[_0x7bf8('0x3f')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x7bf8('0x42'),squel[_0x7bf8('0x38')]()[_0x7bf8('0x39')](_0x7bf8('0x20'))[_0x7bf8('0x3d')]('cm_hopper')['where'](_0x3ef9f5+_0x7bf8('0x43'),_0x232761['id']['toString']())))[_0x7bf8('0x3b')]();return _0x13dacc;};var _0x41ed5f=function(_0x555a76,_0x488e53){var _0x5420d8=squel[_0x7bf8('0x32')]()['into'](_0x7bf8('0x34'))['fromQuery'](['phone',_0x7bf8('0x44'),_0x7bf8('0x3a'),_0x7bf8('0x27'),_0x488e53,_0x7bf8('0x36'),_0x7bf8('0x37')],squel[_0x7bf8('0x38')]()[_0x7bf8('0x39')]('phone',_0x7bf8('0x20'))[_0x7bf8('0x39')](_0x7bf8('0x3c'),_0x7bf8('0x44'))[_0x7bf8('0x39')]('id',_0x7bf8('0x3a'))['field'](LISTID[_0x7bf8('0x3b')](),_0x7bf8('0x27'))[_0x7bf8('0x39')](_0x555a76['id'][_0x7bf8('0x3b')](),_0x488e53)[_0x7bf8('0x39')](_0x7bf8('0x3c'),_0x7bf8('0x36'))[_0x7bf8('0x39')](_0x7bf8('0x3c'),_0x7bf8('0x37'))[_0x7bf8('0x3d')]('cm_contacts')['where'](_0x7bf8('0x40'))[_0x7bf8('0x3f')](_0x7bf8('0x41'),LISTID[_0x7bf8('0x3b')]())[_0x7bf8('0x3f')](_0x7bf8('0x45'),squel[_0x7bf8('0x46')](hopperContacts))[_0x7bf8('0x3f')](_0x7bf8('0x47'))[_0x7bf8('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7bf8('0x38')]()[_0x7bf8('0x39')](_0x7bf8('0x48'))['from']('cm_hopper_final')[_0x7bf8('0x3f')](_0x488e53+_0x7bf8('0x43'),_0x555a76['id'][_0x7bf8('0x3b')]()))[_0x7bf8('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x7bf8('0x39')](_0x7bf8('0x20'))[_0x7bf8('0x3d')](_0x7bf8('0x34'))[_0x7bf8('0x3f')](_0x488e53+_0x7bf8('0x43'),_0x555a76['id'][_0x7bf8('0x3b')]())))[_0x7bf8('0x3b')]();return _0x5420d8;};function _0x196a46(_0x346246,_0x492a46){var _0x124b65=squel[_0x7bf8('0x32')]()[_0x7bf8('0x33')](_0x7bf8('0x34'))[_0x7bf8('0x35')]([_0x7bf8('0x20'),_0x7bf8('0x44'),_0x7bf8('0x3a'),_0x7bf8('0x27'),_0x492a46,_0x7bf8('0x36'),'updatedAt'],squel['select']()[_0x7bf8('0x39')](_0x7bf8('0x20'),_0x7bf8('0x20'))[_0x7bf8('0x39')](_0x7bf8('0x3c'),_0x7bf8('0x44'))[_0x7bf8('0x39')]('id',_0x7bf8('0x3a'))[_0x7bf8('0x39')](LISTID[_0x7bf8('0x3b')](),'ListId')['field'](_0x346246['id']['toString'](),_0x492a46)[_0x7bf8('0x39')](_0x7bf8('0x3c'),_0x7bf8('0x36'))['field']('NOW()',_0x7bf8('0x37'))[_0x7bf8('0x3d')](_0x7bf8('0x3e'))['where']('deletedAt\x20IS\x20NULL')[_0x7bf8('0x3f')]('ListId\x20=\x20?',LISTID[_0x7bf8('0x3b')]())['where'](_0x7bf8('0x45'),squel[_0x7bf8('0x46')](hopperContacts))[_0x7bf8('0x3f')](_0x7bf8('0x47')))[_0x7bf8('0x3b')]();return _0x124b65;}function _0x3c2d55(_0x342878,_0x3c304c){var _0x512f12=squel[_0x7bf8('0x32')]()[_0x7bf8('0x33')]('cm_hopper_black')['fromQuery']([_0x7bf8('0x20'),_0x7bf8('0x3a'),_0x7bf8('0x27'),_0x3c304c,'createdAt','updatedAt'],squel['select']()[_0x7bf8('0x39')]('phone',_0x7bf8('0x20'))[_0x7bf8('0x39')]('id',_0x7bf8('0x3a'))['field'](LISTID[_0x7bf8('0x3b')](),_0x7bf8('0x27'))[_0x7bf8('0x39')](_0x342878['id'][_0x7bf8('0x3b')](),_0x3c304c)[_0x7bf8('0x39')]('NOW()',_0x7bf8('0x36'))['field'](_0x7bf8('0x3c'),_0x7bf8('0x37'))[_0x7bf8('0x3d')]('cm_contacts')[_0x7bf8('0x3f')]('deletedAt\x20IS\x20NULL')[_0x7bf8('0x3f')](_0x7bf8('0x41'),LISTID[_0x7bf8('0x3b')]())[_0x7bf8('0x3f')](_0x7bf8('0x45'),squel[_0x7bf8('0x46')](hopperContacts))['where'](_0x7bf8('0x47')))[_0x7bf8('0x3b')]();return _0x512f12;}return db[_0x7bf8('0x49')][_0x7bf8('0x4a')]({'where':{'type':_0x7bf8('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x7bf8('0x4c')],'as':'Lists','where':{'id':LISTID}}]})[_0x7bf8('0x2c')](function(_0x4842c9){var _0x4ad65f=[];if(_0x4842c9){var _0x35aae2;for(var _0x19d398=0x0,_0x5a1244;_0x19d398<_0x4842c9[_0x7bf8('0x1b')];_0x19d398+=0x1){_0x5a1244=_0x4842c9[_0x19d398][_0x7bf8('0x4d')]({'plain':!![]});switch(_0x5a1244['dialCheckDuplicateType']){case _0x7bf8('0x4e'):_0x4ad65f[_0x7bf8('0x4f')](db[_0x7bf8('0x50')]['query'](_0x41ed5f(_0x5a1244,_0x7bf8('0x51')))[_0x7bf8('0x2c')](function(){})[_0x7bf8('0x2e')](_0x9bcc8f()));break;case'onlyIfOpen':_0x4ad65f[_0x7bf8('0x4f')](db['sequelize']['query'](_0xad7081(_0x5a1244,'VoiceQueueId'))[_0x7bf8('0x2c')](function(){})['catch'](_0x9bcc8f()));break;default:_0x4ad65f[_0x7bf8('0x4f')](db['sequelize'][_0x7bf8('0x52')](_0x196a46(_0x5a1244,'VoiceQueueId'))['then'](function(){})[_0x7bf8('0x2e')](_0x9bcc8f()));}}}return _0x4ad65f;})['all']()['then'](function(){return db[_0x7bf8('0x49')]['findAll']({'where':{'type':_0x7bf8('0x4b')},'attributes':['id'],'include':[{'model':db[_0x7bf8('0x4c')],'as':_0x7bf8('0x53'),'where':{'id':LISTID}}]})[_0x7bf8('0x2c')](function(_0x41ad36){var _0x471cbd=[];if(_0x41ad36){var _0x2b0f31;for(var _0x410414=0x0,_0x3e35a4;_0x410414<_0x41ad36[_0x7bf8('0x1b')];_0x410414+=0x1){_0x3e35a4=_0x41ad36[_0x410414]['get']({'plain':!![]});_0x471cbd[_0x7bf8('0x4f')](db['sequelize'][_0x7bf8('0x52')](_0x3c2d55(_0x3e35a4,_0x7bf8('0x51')))[_0x7bf8('0x2c')](function(){})['catch'](_0x9bcc8f()));}}return _0x471cbd;})[_0x7bf8('0x54')]();})[_0x7bf8('0x2c')](function(){return db[_0x7bf8('0x55')]['findAll']({'attributes':['id',_0x7bf8('0x56')],'include':[{'model':db[_0x7bf8('0x4c')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x6ef75){var _0x55b76e=[];if(_0x6ef75){for(var _0x48e786=0x0,_0x510614;_0x48e786<_0x6ef75[_0x7bf8('0x1b')];_0x48e786+=0x1){_0x510614=_0x6ef75[_0x48e786][_0x7bf8('0x4d')]({'plain':!![]});switch(_0x510614[_0x7bf8('0x56')]){case'always':_0x55b76e[_0x7bf8('0x4f')](db[_0x7bf8('0x50')]['query'](_0x41ed5f(_0x510614,_0x7bf8('0x57')))[_0x7bf8('0x2c')](function(){})[_0x7bf8('0x2e')](_0x9bcc8f()));break;case _0x7bf8('0x58'):_0x55b76e[_0x7bf8('0x4f')](db[_0x7bf8('0x50')]['query'](_0xad7081(_0x510614,_0x7bf8('0x57')))[_0x7bf8('0x2c')](function(){})['catch'](_0x9bcc8f()));break;default:_0x55b76e['push'](db[_0x7bf8('0x50')][_0x7bf8('0x52')](_0x196a46(_0x510614,_0x7bf8('0x57')))[_0x7bf8('0x2c')](function(){})[_0x7bf8('0x2e')](_0x9bcc8f()));}}}return _0x55b76e;})[_0x7bf8('0x54')]();})[_0x7bf8('0x2c')](function(){return db[_0x7bf8('0x55')][_0x7bf8('0x4a')]({'attributes':['id'],'include':[{'model':db[_0x7bf8('0x4c')],'as':_0x7bf8('0x53'),'where':{'id':LISTID}}]})[_0x7bf8('0x2c')](function(_0x244732){var _0x428587=[];if(_0x244732){for(var _0x5873cf=0x0,_0x271512;_0x5873cf<_0x244732[_0x7bf8('0x1b')];_0x5873cf+=0x1){_0x271512=_0x244732[_0x5873cf]['get']({'plain':!![]});_0x428587['push'](db[_0x7bf8('0x50')][_0x7bf8('0x52')](_0x3c2d55(_0x271512,_0x7bf8('0x57')))['then'](function(){})['catch'](_0x9bcc8f()));}}return _0x428587;})['all']();})[_0x7bf8('0x2e')](function(_0x258877){logger[_0x7bf8('0x15')](_0x7bf8('0x59'),'generalCheckHopper',_0x258877['message']);});}var processPromises=function(_0x5c06fd){return BPromise[_0x7bf8('0x54')](promises)[_0x7bf8('0x2c')](function(_0x2d4583){})[_0x7bf8('0x2e')](function(_0x5991da){logger['error'](_0x7bf8('0x5a'),JSON['stringify'](_0x5991da));})[_0x7bf8('0x5b')](function(){socket[_0x7bf8('0x5c')](_0x7bf8('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5c06fd){return _0x5c06fd[_0x7bf8('0x5e')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x7bf8('0x2c')](function(){if(hopperContacts){return checkHopper();}})[_0x7bf8('0x2c')](function(){socket['emit'](_0x7bf8('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x28bd6c){logger[_0x7bf8('0x15')](_0x7bf8('0x5f'),JSON[_0x7bf8('0x60')](_0x28bd6c));}finally{process[_0x7bf8('0x61')](0x0);}});};process['on']('SIGINT',function(){logger[_0x7bf8('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x7bf8('0x63')]()[_0x7bf8('0x2c')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x7bf8('0x13')](',');return db[_0x7bf8('0x2a')][_0x7bf8('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7bf8('0x2c')](function(_0x3044ba){var _0x3107b3=fs[_0x7bf8('0x64')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x3107b3,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4a611e,_0x4b0d87){total+=0x1;var _0x2bd71c=total;promises['push'](checkRow(_0x4a611e,_0x3044ba,_0x2bd71c)[_0x7bf8('0x2c')](function(){success+=0x1;})['catch'](function(_0x11a35a){if(_0x11a35a[_0x7bf8('0x15')]){errors+=0x1;delete _0x11a35a['error'];}else if(_0x11a35a['duplicate']){duplicates+=0x1;delete _0x11a35a['duplicate'];}rows[_0x7bf8('0x4f')](_0x11a35a);}));if(total%0xc8===0x0){_0x4b0d87[_0x7bf8('0x65')]();return processPromises(_0x4b0d87);}},'complete':function(){return processPromises()[_0x7bf8('0x2c')](function(){logger['info'](_0x7bf8('0x66'));endCsv();});},'error':function(_0x2a79d7,_0x5b9906){logger['info'](_0x7bf8('0x67'),JSON[_0x7bf8('0x60')](_0x2a79d7));endCsv();}});})[_0x7bf8('0x2e')](function(_0x40f38b){logger[_0x7bf8('0x15')](_0x7bf8('0x68'),JSON[_0x7bf8('0x60')](_0x40f38b));});}main(); \ No newline at end of file +var _0x4f62=['Duplicate\x20Contact','CmContact','create','keys','then','push','catch','stringify','cmContact','checkHopper','inspect','insert','into','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','toString','phone\x20IS\x20NOT\x20NULL','cm_hopper','\x20=\x20?','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','calleridnum','id\x20IN\x20?','str','cm_hopper_black','VoiceQueue','findAll','dialCheckDuplicateType','Lists','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','outbound','CmList','BlackLists','get','Campaign','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','api','defaults','localhost','redis','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate'];(function(_0xb7a307,_0x4a2603){var _0x259d96=function(_0x41e6b8){while(--_0x41e6b8){_0xb7a307['push'](_0xb7a307['shift']());}};_0x259d96(++_0x4a2603);}(_0x4f62,0xab));var _0x24f6=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x4f62[_0x47b58b];return _0x46bebe;};'use strict';var BPromise=require(_0x24f6('0x0'));var util=require(_0x24f6('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0x24f6('0x2'));var Papa=require(_0x24f6('0x3'));var Redis=require(_0x24f6('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x24f6('0x5'));var logger=require(_0x24f6('0x6'))(_0x24f6('0x7'));config['redis']=_[_0x24f6('0x8')](config['redis'],{'host':_0x24f6('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x24f6('0xa')]));require(_0x24f6('0xb'))['register'](socket);try{if(!process[_0x24f6('0xc')][0x2]||process['argv'][0x2]===_0x24f6('0xd')||process[_0x24f6('0xc')][0x2]===_0x24f6('0xe')){throw new Error(_0x24f6('0xf'));}var FILEPATH=process[_0x24f6('0xc')][0x2];if(!process[_0x24f6('0xc')][0x3]||process[_0x24f6('0xc')][0x3]==='undefined'||process[_0x24f6('0xc')][0x3]===_0x24f6('0xe')||!process['argv'][0x4]||process['argv'][0x4]===_0x24f6('0xd')||process[_0x24f6('0xc')][0x4]===_0x24f6('0xe')){throw new Error(_0x24f6('0x10'));}var FIELDS=_[_0x24f6('0x11')](process[_0x24f6('0xc')][0x3]['split'](','),process[_0x24f6('0xc')][0x4][_0x24f6('0x12')](','));if(!process[_0x24f6('0xc')][0x5]||process[_0x24f6('0xc')][0x5]==='undefined'||process[_0x24f6('0xc')][0x5]==='null'){throw new Error(_0x24f6('0x13'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x24f6('0xc')][0x6]&&process['argv'][0x6]!==_0x24f6('0xd')&&process['argv'][0x6]!==_0x24f6('0xe')?process[_0x24f6('0xc')][0x6]:null;var DUPLICATES=process[_0x24f6('0xc')][0x7]&&process['argv'][0x7]!==_0x24f6('0xd')&&process['argv'][0x7]!==_0x24f6('0xe')?process[_0x24f6('0xc')][0x7]:null;if(!process[_0x24f6('0xc')][0x8]||process[_0x24f6('0xc')][0x8]===_0x24f6('0xd')||process[_0x24f6('0xc')][0x8]===_0x24f6('0xe')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x24f6('0xc')][0x8];}catch(_0x2683b1){logger[_0x24f6('0x14')](_0x2683b1);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(_0x316fe8,_0x22d7f6,_0x4e11a8,_0x1f51ac){var _0x30c74c={'message':_0x22d7f6};_0x30c74c[_0x316fe8]=!![];if(_0x4e11a8){_0x30c74c['contact']=_0x4e11a8;}if(_0x1f51ac){_0x30c74c['index']=_0x1f51ac;}return _0x30c74c;}function isEmail(_0x5de28c){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'](_0x5de28c);}function checkRow(_0x5ed183,_0x3a03d1,_0x58932c){return new BPromise(function(_0x232961,_0x4d6573){if(_['isNil'](_0x5ed183)){return _0x4d6573(handleCheckRowError(_0x24f6('0x14'),_0x24f6('0x15'),null,_0x58932c));}if(_0x5ed183['errors']&&_0x5ed183[_0x24f6('0x16')][_0x24f6('0x17')]){var _0x706681=_[_0x24f6('0x18')](_0x5ed183['errors'],_0x24f6('0x19'))['join'](';');return _0x4d6573(handleCheckRowError(_0x24f6('0x14'),_0x706681,null,_0x58932c));}var _0x186365={};for(var _0x2a2ceb in FIELDS){if(FIELDS[_0x24f6('0x1a')](_0x2a2ceb)&&FIELDS[_0x2a2ceb]){_0x186365[_0x2a2ceb]=_0x5ed183['data'][0x0][FIELDS[_0x2a2ceb]]||_0x5ed183[_0x24f6('0x1b')][0x0]['\ufeff'+FIELDS[_0x2a2ceb]];}}if(!_0x186365[_0x24f6('0x1c')]){return _0x4d6573(handleCheckRowError(_0x24f6('0x14'),_0x24f6('0x1d'),null,_0x58932c));}if(!_0x186365[_0x24f6('0x1e')]){return _0x4d6573(handleCheckRowError(_0x24f6('0x14'),_0x24f6('0x1f'),null,_0x58932c));}if(_0x186365[_0x24f6('0x20')]){var _0x21909e=moment(_0x186365[_0x24f6('0x20')],_0x24f6('0x21'));if(!_0x21909e[_0x24f6('0x22')]()){return _0x4d6573(handleCheckRowError(_0x24f6('0x14'),_0x24f6('0x23'),null,_0x58932c));}}if(_0x186365[_0x24f6('0x24')]){if(!isEmail(_0x186365[_0x24f6('0x24')])){return _0x4d6573(handleCheckRowError(_0x24f6('0x14'),_0x24f6('0x25'),null,_0x58932c));}}_0x186365[_0x24f6('0x26')]=LISTID;_0x186365[_0x24f6('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x3a03d1){var _0x21495e={};for(var _0x3fcd15=0x0,_0x1f9d57=DUPLICATES[_0x24f6('0x17')];_0x3fcd15<_0x1f9d57;_0x3fcd15+=0x1){_0x21495e[DUPLICATES[_0x3fcd15]]=_0x186365[DUPLICATES[_0x3fcd15]];}var _0x1dccbc=_['find'](_0x3a03d1,_0x21495e);if(_0x1dccbc){return _0x4d6573(handleCheckRowError(_0x24f6('0x28'),_0x24f6('0x29'),_0x1dccbc,_0x58932c));}}return db[_0x24f6('0x2a')][_0x24f6('0x2b')](_0x186365,{'raw':!![],'hooks':![],'fields':_[_0x24f6('0x2c')](_0x186365)})[_0x24f6('0x2d')](function(_0x3036b9){if(DUPLICATES&&DUPLICATES[_0x24f6('0x17')]&&_0x3a03d1){_0x3a03d1[_0x24f6('0x2e')](_['pick'](_0x186365,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3036b9['id'];return _0x232961();})[_0x24f6('0x2f')](function(_0x25b72e){return _0x4d6573(handleCheckRowError(_0x24f6('0x14'),'Error\x20while\x20creating\x20contact:\x20'+(_0x25b72e[_0x24f6('0x19')]||JSON[_0x24f6('0x30')](_0x25b72e)),null,_0x58932c));});});}function checkHopper(){function _0x4298f3(){return function(_0x1ed7a1){logger[_0x24f6('0x14')](_0x24f6('0x31'),_0x24f6('0x32'),util[_0x24f6('0x33')](_0x1ed7a1,{'showHidden':![],'depth':null}));};}var _0x3d97cd=function(_0x2f91f4,_0x1eca3f){var _0x4ee02d=squel[_0x24f6('0x34')]()[_0x24f6('0x35')]('cm_hopper')[_0x24f6('0x36')]([_0x24f6('0x1e'),_0x24f6('0x37'),_0x24f6('0x38'),_0x24f6('0x26'),_0x1eca3f,_0x24f6('0x39'),_0x24f6('0x3a')],squel[_0x24f6('0x3b')]()[_0x24f6('0x3c')](_0x24f6('0x1e'),_0x24f6('0x1e'))[_0x24f6('0x3c')](_0x24f6('0x3d'),_0x24f6('0x37'))[_0x24f6('0x3c')]('id',_0x24f6('0x38'))['field'](LISTID['toString'](),_0x24f6('0x26'))['field'](_0x2f91f4['id']['toString'](),_0x1eca3f)[_0x24f6('0x3c')](_0x24f6('0x3d'),'createdAt')[_0x24f6('0x3c')](_0x24f6('0x3d'),_0x24f6('0x3a'))[_0x24f6('0x3e')](_0x24f6('0x3f'))[_0x24f6('0x40')](_0x24f6('0x41'))[_0x24f6('0x40')]('ListId\x20=\x20?',LISTID[_0x24f6('0x42')]())['where'](_0x24f6('0x43'))[_0x24f6('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x24f6('0x3b')]()[_0x24f6('0x3c')](_0x24f6('0x1e'))['from'](_0x24f6('0x44'))[_0x24f6('0x40')](_0x1eca3f+_0x24f6('0x45'),_0x2f91f4['id'][_0x24f6('0x42')]())))[_0x24f6('0x42')]();return _0x4ee02d;};var _0x59ce33=function(_0x53c9ee,_0x3c8dba){var _0x339704=squel[_0x24f6('0x34')]()[_0x24f6('0x35')]('cm_hopper')[_0x24f6('0x36')]([_0x24f6('0x1e'),_0x24f6('0x37'),_0x24f6('0x38'),_0x24f6('0x26'),_0x3c8dba,_0x24f6('0x39'),_0x24f6('0x3a')],squel[_0x24f6('0x3b')]()['field'](_0x24f6('0x1e'),_0x24f6('0x1e'))['field'](_0x24f6('0x3d'),_0x24f6('0x37'))[_0x24f6('0x3c')]('id','ContactId')['field'](LISTID[_0x24f6('0x42')](),_0x24f6('0x26'))[_0x24f6('0x3c')](_0x53c9ee['id'][_0x24f6('0x42')](),_0x3c8dba)[_0x24f6('0x3c')](_0x24f6('0x3d'),_0x24f6('0x39'))[_0x24f6('0x3c')](_0x24f6('0x3d'),_0x24f6('0x3a'))['from'](_0x24f6('0x3f'))[_0x24f6('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0x24f6('0x46'),LISTID[_0x24f6('0x42')]())['where']('id\x20IN\x20?',squel['str'](hopperContacts))[_0x24f6('0x40')](_0x24f6('0x43'))[_0x24f6('0x40')](_0x24f6('0x47'),squel[_0x24f6('0x3b')]()[_0x24f6('0x3c')](_0x24f6('0x48'))[_0x24f6('0x3e')]('cm_hopper_final')[_0x24f6('0x40')](_0x3c8dba+'\x20=\x20?',_0x53c9ee['id'][_0x24f6('0x42')]()))[_0x24f6('0x40')](_0x24f6('0x47'),squel[_0x24f6('0x3b')]()[_0x24f6('0x3c')]('phone')[_0x24f6('0x3e')](_0x24f6('0x44'))['where'](_0x3c8dba+_0x24f6('0x45'),_0x53c9ee['id']['toString']())))[_0x24f6('0x42')]();return _0x339704;};function _0x382183(_0x1b3b21,_0x5bc297){var _0x30fbcb=squel['insert']()[_0x24f6('0x35')](_0x24f6('0x44'))['fromQuery']([_0x24f6('0x1e'),_0x24f6('0x37'),'ContactId',_0x24f6('0x26'),_0x5bc297,_0x24f6('0x39'),_0x24f6('0x3a')],squel[_0x24f6('0x3b')]()[_0x24f6('0x3c')](_0x24f6('0x1e'),_0x24f6('0x1e'))[_0x24f6('0x3c')](_0x24f6('0x3d'),'scheduledAt')[_0x24f6('0x3c')]('id',_0x24f6('0x38'))['field'](LISTID[_0x24f6('0x42')](),'ListId')['field'](_0x1b3b21['id'][_0x24f6('0x42')](),_0x5bc297)['field']('NOW()',_0x24f6('0x39'))['field']('NOW()',_0x24f6('0x3a'))['from']('cm_contacts')[_0x24f6('0x40')]('deletedAt\x20IS\x20NULL')[_0x24f6('0x40')](_0x24f6('0x46'),LISTID[_0x24f6('0x42')]())['where'](_0x24f6('0x49'),squel[_0x24f6('0x4a')](hopperContacts))[_0x24f6('0x40')](_0x24f6('0x43')))[_0x24f6('0x42')]();return _0x30fbcb;}function _0x22dd88(_0x1cc3c0,_0x43d73d){var _0x45147f=squel[_0x24f6('0x34')]()[_0x24f6('0x35')](_0x24f6('0x4b'))[_0x24f6('0x36')]([_0x24f6('0x1e'),'ContactId',_0x24f6('0x26'),_0x43d73d,'createdAt',_0x24f6('0x3a')],squel[_0x24f6('0x3b')]()[_0x24f6('0x3c')](_0x24f6('0x1e'),_0x24f6('0x1e'))[_0x24f6('0x3c')]('id',_0x24f6('0x38'))[_0x24f6('0x3c')](LISTID[_0x24f6('0x42')](),_0x24f6('0x26'))[_0x24f6('0x3c')](_0x1cc3c0['id'][_0x24f6('0x42')](),_0x43d73d)['field'](_0x24f6('0x3d'),'createdAt')[_0x24f6('0x3c')](_0x24f6('0x3d'),_0x24f6('0x3a'))[_0x24f6('0x3e')](_0x24f6('0x3f'))['where']('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID[_0x24f6('0x42')]())[_0x24f6('0x40')](_0x24f6('0x49'),squel['str'](hopperContacts))[_0x24f6('0x40')]('phone\x20IS\x20NOT\x20NULL'))[_0x24f6('0x42')]();return _0x45147f;}return db[_0x24f6('0x4c')][_0x24f6('0x4d')]({'where':{'type':'outbound'},'attributes':['id',_0x24f6('0x4e')],'include':[{'model':db['CmList'],'as':_0x24f6('0x4f'),'where':{'id':LISTID}}]})[_0x24f6('0x2d')](function(_0x4fc99d){var _0x4d99c4=[];if(_0x4fc99d){var _0x2c1866;for(var _0x5bd4b4=0x0,_0x30d344;_0x5bd4b4<_0x4fc99d[_0x24f6('0x17')];_0x5bd4b4+=0x1){_0x30d344=_0x4fc99d[_0x5bd4b4]['get']({'plain':!![]});switch(_0x30d344['dialCheckDuplicateType']){case _0x24f6('0x50'):_0x4d99c4[_0x24f6('0x2e')](db[_0x24f6('0x51')][_0x24f6('0x52')](_0x59ce33(_0x30d344,_0x24f6('0x53')))['then'](function(){})[_0x24f6('0x2f')](_0x4298f3()));break;case _0x24f6('0x54'):_0x4d99c4[_0x24f6('0x2e')](db[_0x24f6('0x51')]['query'](_0x3d97cd(_0x30d344,_0x24f6('0x53')))[_0x24f6('0x2d')](function(){})[_0x24f6('0x2f')](_0x4298f3()));break;default:_0x4d99c4['push'](db['sequelize'][_0x24f6('0x52')](_0x382183(_0x30d344,_0x24f6('0x53')))['then'](function(){})['catch'](_0x4298f3()));}}}return _0x4d99c4;})[_0x24f6('0x55')]()['then'](function(){return db['VoiceQueue']['findAll']({'where':{'type':_0x24f6('0x56')},'attributes':['id'],'include':[{'model':db[_0x24f6('0x57')],'as':_0x24f6('0x58'),'where':{'id':LISTID}}]})[_0x24f6('0x2d')](function(_0x2bd317){var _0x68493a=[];if(_0x2bd317){var _0x173bab;for(var _0x308537=0x0,_0x101dca;_0x308537<_0x2bd317[_0x24f6('0x17')];_0x308537+=0x1){_0x101dca=_0x2bd317[_0x308537][_0x24f6('0x59')]({'plain':!![]});_0x68493a[_0x24f6('0x2e')](db[_0x24f6('0x51')][_0x24f6('0x52')](_0x22dd88(_0x101dca,'VoiceQueueId'))[_0x24f6('0x2d')](function(){})[_0x24f6('0x2f')](_0x4298f3()));}}return _0x68493a;})[_0x24f6('0x55')]();})['then'](function(){return db[_0x24f6('0x5a')][_0x24f6('0x4d')]({'attributes':['id',_0x24f6('0x4e')],'include':[{'model':db[_0x24f6('0x57')],'as':_0x24f6('0x4f'),'where':{'id':LISTID}}]})['then'](function(_0x2842ce){var _0x40ea16=[];if(_0x2842ce){for(var _0x2ea737=0x0,_0x492c6e;_0x2ea737<_0x2842ce['length'];_0x2ea737+=0x1){_0x492c6e=_0x2842ce[_0x2ea737]['get']({'plain':!![]});switch(_0x492c6e[_0x24f6('0x4e')]){case'always':_0x40ea16[_0x24f6('0x2e')](db[_0x24f6('0x51')][_0x24f6('0x52')](_0x59ce33(_0x492c6e,'CampaignId'))[_0x24f6('0x2d')](function(){})[_0x24f6('0x2f')](_0x4298f3()));break;case'onlyIfOpen':_0x40ea16[_0x24f6('0x2e')](db[_0x24f6('0x51')]['query'](_0x3d97cd(_0x492c6e,'CampaignId'))[_0x24f6('0x2d')](function(){})[_0x24f6('0x2f')](_0x4298f3()));break;default:_0x40ea16[_0x24f6('0x2e')](db[_0x24f6('0x51')][_0x24f6('0x52')](_0x382183(_0x492c6e,_0x24f6('0x5b')))[_0x24f6('0x2d')](function(){})[_0x24f6('0x2f')](_0x4298f3()));}}}return _0x40ea16;})['all']();})['then'](function(){return db['Campaign'][_0x24f6('0x4d')]({'attributes':['id'],'include':[{'model':db[_0x24f6('0x57')],'as':_0x24f6('0x58'),'where':{'id':LISTID}}]})[_0x24f6('0x2d')](function(_0x64f678){var _0x1fffd7=[];if(_0x64f678){for(var _0x2d2386=0x0,_0x4de9db;_0x2d2386<_0x64f678[_0x24f6('0x17')];_0x2d2386+=0x1){_0x4de9db=_0x64f678[_0x2d2386][_0x24f6('0x59')]({'plain':!![]});_0x1fffd7['push'](db['sequelize'][_0x24f6('0x52')](_0x22dd88(_0x4de9db,_0x24f6('0x5b')))[_0x24f6('0x2d')](function(){})[_0x24f6('0x2f')](_0x4298f3()));}}return _0x1fffd7;})[_0x24f6('0x55')]();})[_0x24f6('0x2f')](function(_0x18a551){logger[_0x24f6('0x14')](_0x24f6('0x5c'),'generalCheckHopper',_0x18a551[_0x24f6('0x19')]);});}var processPromises=function(_0x118912){return BPromise[_0x24f6('0x55')](promises)[_0x24f6('0x2d')](function(_0x12af16){})[_0x24f6('0x2f')](function(_0xb27e29){logger['error'](_0x24f6('0x5d'),JSON[_0x24f6('0x30')](_0xb27e29));})[_0x24f6('0x5e')](function(){socket[_0x24f6('0x5f')](_0x24f6('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x118912){return _0x118912['resume']();}});};var endCsv=function(){return BPromise[_0x24f6('0x61')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x24f6('0x2d')](function(){socket[_0x24f6('0x5f')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x1a5a7f){logger[_0x24f6('0x14')](_0x24f6('0x62'),JSON[_0x24f6('0x30')](_0x1a5a7f));}finally{process[_0x24f6('0x63')](0x0);}});};process['on']('SIGINT',function(){logger[_0x24f6('0x64')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x24f6('0x61')]()[_0x24f6('0x2d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x24f6('0x12')](',');return db[_0x24f6('0x2a')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x1a4117){var _0x4c478e=fs[_0x24f6('0x65')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x24f6('0x66')](_0x4c478e,{'header':!![],'skipEmptyLines':!![],'step':function(_0x42846d,_0x4be29d){total+=0x1;var _0x19486d=total;promises['push'](checkRow(_0x42846d,_0x1a4117,_0x19486d)[_0x24f6('0x2d')](function(){success+=0x1;})[_0x24f6('0x2f')](function(_0x212b5e){if(_0x212b5e[_0x24f6('0x14')]){errors+=0x1;delete _0x212b5e[_0x24f6('0x14')];}else if(_0x212b5e[_0x24f6('0x28')]){duplicates+=0x1;delete _0x212b5e[_0x24f6('0x28')];}rows[_0x24f6('0x2e')](_0x212b5e);}));if(total%0xc8===0x0){_0x4be29d['pause']();return processPromises(_0x4be29d);}},'complete':function(){return processPromises()[_0x24f6('0x2d')](function(){logger[_0x24f6('0x64')](_0x24f6('0x67'));endCsv();});},'error':function(_0x44bd12,_0x5f3e5e){logger[_0x24f6('0x64')](_0x24f6('0x68'),JSON[_0x24f6('0x30')](_0x44bd12));endCsv();}});})[_0x24f6('0x2f')](function(_0x4af2ca){logger['error'](_0x24f6('0x69'),JSON[_0x24f6('0x30')](_0x4af2ca));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index a51d22e..857fd86 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 _0x2eb6=['util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','localhost','socket.io-emitter','format','test','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','CmContact','findAll','AdditionalPhones','then','length','push','all','split','isNil','filter','CmContactHasItem','findOne','updated','PHONE','inserted','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','createdAt','updatedAt','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','scheduledat','cm_hopper_black','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_hopper.ListId\x20=\x20?','concat','CompanyId','scheduledAt','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','code','query','spread','catch','campaigns.id','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','sequelize','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','dialTimezone','set','stringify','send','start','binding','clone','socket_timestamp','root','keys','includes','header','ContactItemType','name','_description','writeFileSync','parse','createReadStream','data','errors','find','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','itemTypeId','description','SystemRow','appendFileSync','emit','abort','SystemError','step','duplicates','campaigns_','voice_queues_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','VoiceQueueId','campaigns','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_blacklists','finish','affectedRows','contact:import:','unlink','exit','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse'];(function(_0x195343,_0x2a0d70){var _0x15f280=function(_0x1e3760){while(--_0x1e3760){_0x195343['push'](_0x195343['shift']());}};_0x15f280(++_0x2a0d70);}(_0x2eb6,0x172));var _0x62eb=function(_0x29c674,_0x47100a){_0x29c674=_0x29c674-0x0;var _0x8f85c1=_0x2eb6[_0x29c674];return _0x8f85c1;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x62eb('0x0'));var Papa=require(_0x62eb('0x1'));var util=require(_0x62eb('0x2'));var BPromise=require(_0x62eb('0x3'));var moment=require(_0x62eb('0x4'));var squel=require(_0x62eb('0x5'));var Redis=require(_0x62eb('0x6'));var db=require(_0x62eb('0x7'))['db'];var config=require(_0x62eb('0x8'));var shared=require(_0x62eb('0x9'));var logger=require(_0x62eb('0xa'))('import');config[_0x62eb('0xb')]=_['defaults'](config[_0x62eb('0xb')],{'host':_0x62eb('0xc'),'port':0x18eb});var socket=require(_0x62eb('0xd'))(new Redis(config[_0x62eb('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x62eb('0xe')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x62eb('0xe')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x720b75){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))*$/[_0x62eb('0xf')](_0x720b75);}function selectNotIn(_0xbff089,_0x17e476,_0x6461ab,_0x44eb85,_0x5c4b4b){return squel[_0x62eb('0x10')]()[_0x62eb('0x11')](_0x62eb('0x12'))[_0x62eb('0x13')](_0x44eb85)['join'](_0x17e476,null,_0x17e476+_0x62eb('0x14')+_0x44eb85+'.'+_0x6461ab)[_0x62eb('0x15')](_0x44eb85+'.'+_0x6461ab+_0x62eb('0x16')+_0xbff089+'.'+_0x6461ab)[_0x62eb('0x15')](_0x17e476+_0x62eb('0x17')+_0x5c4b4b[_0x62eb('0x18')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x33f696,_0x4ed74a){promisesAdditionalPhones=[];return db[_0x62eb('0x19')][_0x62eb('0x1a')]({'raw':!![],'attributes':['id',_0x62eb('0x1b')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x62eb('0x1c')](function(_0x48a19d){if(_0x48a19d!==null){var _0x79d351=[];for(var _0x3fc5e8=0x0;_0x3fc5e8<_0x48a19d[_0x62eb('0x1d')];_0x3fc5e8++){var _0xbdd9c4=_0x48a19d[_0x3fc5e8];_0x79d351[_0x62eb('0x1e')](insertAdditionalPhones(_0xbdd9c4));}}Promise[_0x62eb('0x1f')](_0x79d351)['then'](function(){_0x33f696({'val':0x1});});});});}function insertAdditionalPhones(_0x1d47f8){return new Promise(function(_0x3d372d,_0x3dce12){var _0x3417c1=_0x1d47f8[_0x62eb('0x1b')];var _0x23bf2d=_0x3417c1[_0x62eb('0x20')](';');var _0x2e9ad9=[];orderBy=0x0;for(var _0x48122e=0x0;_0x48122e<_0x23bf2d[_0x62eb('0x1d')];_0x48122e++){_0x2e9ad9[_0x62eb('0x1e')](splitAdditionalPhone(_0x1d47f8['id'],_0x23bf2d[_0x48122e]));}Promise['all'](_0x2e9ad9)[_0x62eb('0x1c')](function(){_0x3d372d({'val':_0x23bf2d[_0x62eb('0x1d')]});});});}function splitAdditionalPhone(_0x18b01d,_0x3bfa44){return new Promise(function(_0x157214,_0x31db4a){var _0x157563=_0x3bfa44[_0x62eb('0x20')](':');var _0x2ac4d9=_0x157563[0x0];var _0x5d3e7c=_0x157563[0x1];if(!_[_0x62eb('0x21')](_0x5d3e7c)){var _0x57e1e7=_0x5d3e7c['split']('|');var _0x35ca50=[];for(var _0xd04cfc=0x0;_0xd04cfc<_0x57e1e7[_0x62eb('0x1d')];_0xd04cfc++){if(_0x57e1e7[_0xd04cfc]!==''){var _0x49a2cf=_[_0x62eb('0x22')](promisesAdditionalPhones,{'contactId':_0x18b01d,'phone':_0x57e1e7[_0xd04cfc]});if(_0x49a2cf[_0x62eb('0x1d')]==0x0){orderBy++;promisesAdditionalPhones[_0x62eb('0x1e')]({'contactId':_0x18b01d,'contactTypeId':_0x2ac4d9,'phone':_0x57e1e7[_0xd04cfc],'orderBy':orderBy});}}}_0x157214({'ok':0x1});}else _0x157214({'res':0x0});});}function createAdditionalPhone(_0x5772b3,_0x1067b9,_0x3acb6f,_0x4d01bd){var _0x7fcb9c='';var _0x283f61='';var _0x2c71ae=_0x3acb6f[_0x62eb('0x20')]('§');_0x7fcb9c=_0x2c71ae[0x0];if(_0x2c71ae[_0x62eb('0x1d')]==0x2)_0x283f61=_0x2c71ae[0x1];return new Promise(function(_0x3af026,_0x183c13){return db[_0x62eb('0x23')][_0x62eb('0x24')]({'where':{'CmContactId':_0x5772b3,'item':_0x7fcb9c}})[_0x62eb('0x1c')](function(_0x33767a){if(_0x33767a){return db['CmContactHasItem']['update']({'ItemTypeId':_0x1067b9,'description':_0x283f61,'OrderBy':_0x4d01bd},{'where':{'CmContactId':_0x5772b3,'item':_0x7fcb9c}})[_0x62eb('0x1c')](function(_0x3bd8c3){_0x3af026({'res':_0x62eb('0x25')});});}else{return db[_0x62eb('0x23')]['create']({'CmContactId':_0x5772b3,'item':_0x7fcb9c,'description':_0x283f61,'ItemTypeId':_0x1067b9,'OrderBy':_0x4d01bd,'ItemClass':_0x62eb('0x26')})[_0x62eb('0x1c')](function(_0x3eba8d){_0x3af026({'res':_0x62eb('0x27')});});}});});}function insertCmHopper(_0x3cf020,_0x47ed8a,_0x41a936,_0x376af4,_0x1a5e02){var _0x43bab3=['cm_contacts.phone',_0x62eb('0x28'),_0x62eb('0x29'),_0x62eb('0x2a'),_0x47ed8a+'.'+_0x376af4,_0x62eb('0x2b'),_0x62eb('0x2c'),_0x62eb('0x2d'),_0x62eb('0x2e'),'\x22'+_0x1a5e02+'\x22'];return squel[_0x62eb('0x2f')]()[_0x62eb('0x30')](_0x62eb('0x31'))[_0x62eb('0x32')](['phone','scheduledat',_0x62eb('0x33'),_0x62eb('0x34'),_0x376af4,_0x62eb('0x35'),_0x62eb('0x36'),'priority',_0x62eb('0x37'),_0x62eb('0x38')],squel['select']()[_0x62eb('0x39')](_0x43bab3)[_0x62eb('0x13')](_0x47ed8a)[_0x62eb('0x18')](_0x62eb('0x3a'),null,_0x62eb('0x3b')+_0x47ed8a+_0x62eb('0x3c'))[_0x62eb('0x18')](_0x41a936,null,_0x41a936+_0x62eb('0x14')+_0x47ed8a+'.'+_0x376af4)[_0x62eb('0x15')](_0x47ed8a+_0x62eb('0x3d'),_0x3cf020)['where'](_0x62eb('0x3e'),NOW)[_0x62eb('0x15')](_0x62eb('0x3f'),selectNotIn(_0x47ed8a,_0x41a936,_0x376af4,'cm_hopper',[_0x62eb('0x40'),_0x62eb('0x41')]))['where'](_0x62eb('0x3f'),selectNotIn(_0x47ed8a,_0x41a936,_0x376af4,_0x62eb('0x31'),[_0x62eb('0x40')])))[_0x62eb('0x42')]();}function insertCmHopperBlack(_0x5a3be3,_0x5a0d47,_0x5c9ed3,_0x3319c5){var _0xe4bbe4=[_0x62eb('0x43'),_0x62eb('0x29'),_0x62eb('0x2a'),_0x5a0d47+'.'+_0x3319c5,'cm_contacts.createdAt',_0x62eb('0x2c')];return squel['insert']()['into']('cm_hopper_black')[_0x62eb('0x32')]([_0x62eb('0x12'),_0x62eb('0x33'),_0x62eb('0x34'),_0x3319c5,'createdAt',_0x62eb('0x36')],squel[_0x62eb('0x10')]()[_0x62eb('0x39')](_0xe4bbe4)[_0x62eb('0x13')](_0x5a0d47)[_0x62eb('0x18')](_0x62eb('0x3a'),null,_0x62eb('0x3b')+_0x5a0d47+_0x62eb('0x3c'))[_0x62eb('0x18')](_0x5c9ed3,null,_0x5c9ed3+_0x62eb('0x14')+_0x5a0d47+'.'+_0x3319c5)[_0x62eb('0x15')](_0x5a0d47+_0x62eb('0x3d'),_0x5a3be3)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x62eb('0x15')](_0x62eb('0x3f'),squel[_0x62eb('0x10')]()[_0x62eb('0x11')](_0x62eb('0x12'))[_0x62eb('0x13')]('cm_hopper_black')[_0x62eb('0x15')](_0x62eb('0x44'),_0x5a3be3)[_0x62eb('0x15')](_0x3319c5+'\x20=\x20'+_0x5a0d47+'.'+_0x3319c5)))[_0x62eb('0x42')]();}function insertTzCmHopper(_0x2f50ab,_0x4a2532,_0x19802b,_0x49bf60,_0x49ae54,_0xe6e82e){var _0x406bec=[_0x62eb('0x43'),_0x62eb('0x45')+_0xe6e82e+_0x62eb('0x46'),'cm_contacts.id',_0x62eb('0x2a'),_0x4a2532+'.'+_0x49bf60,'cm_contacts.createdAt',_0x62eb('0x2c'),_0x62eb('0x2d'),_0x62eb('0x2e'),'\x22'+_0x49ae54+'\x22'];var _0x53373f=squel[_0x62eb('0x2f')]()[_0x62eb('0x30')](_0x62eb('0x31'))[_0x62eb('0x32')]([_0x62eb('0x12'),_0x62eb('0x47'),_0x62eb('0x33'),_0x62eb('0x34'),_0x49bf60,_0x62eb('0x35'),_0x62eb('0x36'),'priority',_0x62eb('0x37'),_0x62eb('0x38')],squel[_0x62eb('0x10')]()[_0x62eb('0x39')](_0x406bec)[_0x62eb('0x13')](_0x4a2532)[_0x62eb('0x18')](_0x62eb('0x3a'),null,_0x62eb('0x3b')+_0x4a2532+_0x62eb('0x3c'))[_0x62eb('0x18')](_0x19802b,null,_0x19802b+'.id\x20=\x20'+_0x4a2532+'.'+_0x49bf60)[_0x62eb('0x18')](_0xe6e82e,null,_0xe6e82e+_0x62eb('0x14')+_0x4a2532+'.'+_0x49bf60)[_0x62eb('0x15')](_0x4a2532+_0x62eb('0x3d'),_0x2f50ab)[_0x62eb('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x62eb('0x15')](_0x62eb('0x3f'),selectNotIn(_0x4a2532,_0x19802b,_0x49bf60,_0x62eb('0x31'),[_0x62eb('0x40'),_0x62eb('0x41')]))[_0x62eb('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4a2532,_0x19802b,_0x49bf60,_0x62eb('0x31'),[_0x62eb('0x40')])))[_0x62eb('0x42')]();return _0x53373f;}function insertTzCmHopperBlack(_0x34075d,_0x3ab469,_0x1dbb44,_0x4282c6){var _0x4bbe5d=[_0x62eb('0x43'),_0x62eb('0x29'),_0x62eb('0x2a'),_0x3ab469+'.'+_0x4282c6,_0x62eb('0x2b'),'cm_contacts.updatedAt'];return squel[_0x62eb('0x2f')]()['into']('cm_hopper_black')[_0x62eb('0x32')]([_0x62eb('0x12'),_0x62eb('0x33'),_0x62eb('0x34'),_0x4282c6,_0x62eb('0x35'),_0x62eb('0x36')],squel['select']()[_0x62eb('0x39')](_0x4bbe5d)['from'](_0x3ab469)[_0x62eb('0x18')]('cm_contacts',null,_0x62eb('0x3b')+_0x3ab469+_0x62eb('0x3c'))['join'](_0x1dbb44,null,_0x1dbb44+_0x62eb('0x14')+_0x3ab469+'.'+_0x4282c6)[_0x62eb('0x15')](_0x3ab469+_0x62eb('0x3d'),_0x34075d)['where'](_0x62eb('0x3e'),NOW)[_0x62eb('0x15')](_0x62eb('0x3f'),squel[_0x62eb('0x10')]()[_0x62eb('0x11')](_0x62eb('0x12'))[_0x62eb('0x13')](_0x62eb('0x48'))[_0x62eb('0x15')](_0x62eb('0x44'),_0x34075d)['where'](_0x4282c6+'\x20=\x20'+_0x3ab469+'.'+_0x4282c6)))[_0x62eb('0x42')]();}function insertCmHopperAdditionalPhones(_0x34a4fe){var _0x2e7a2e=[_0x62eb('0x49'),_0x62eb('0x4a'),'cm_contact_has_items.OrderBy',_0x62eb('0x4b'),_0x62eb('0x4c')];return squel[_0x62eb('0x2f')]()[_0x62eb('0x30')](_0x62eb('0x4d'))[_0x62eb('0x32')](['CmHopperId','phone',_0x62eb('0x4e'),_0x62eb('0x35'),'updatedAt'],squel['select']()[_0x62eb('0x39')](_0x2e7a2e)[_0x62eb('0x13')](_0x62eb('0x31'))[_0x62eb('0x18')](_0x62eb('0x3a'),null,_0x62eb('0x4f'))[_0x62eb('0x18')]('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')['where'](_0x62eb('0x50'),_0x34a4fe)[_0x62eb('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x62eb('0x42')]();}function insertCmContact(_0x4705f7,_0x1e1178,_0x24d3cb,_0x385754){var _0x297859=_[_0x62eb('0x51')](_['keys'](_0x385754),[_0x62eb('0x34'),_0x62eb('0x52'),_0x62eb('0x35'),_0x62eb('0x36'),_0x62eb('0x53')]);return squel['insert']()[_0x62eb('0x30')](_0x62eb('0x3a'))['fromQuery'](_0x297859,squel[_0x62eb('0x10')]()[_0x62eb('0x39')](_0x297859)[_0x62eb('0x13')](_0x1e1178)[_0x62eb('0x15')]('('+_0x24d3cb[_0x62eb('0x18')](',')+')\x20NOT\x20IN\x20?',squel[_0x62eb('0x10')]()[_0x62eb('0x39')](_0x24d3cb)[_0x62eb('0x13')](_0x62eb('0x3a'))[_0x62eb('0x15')](_0x62eb('0x44'),_0x4705f7)['where'](_0x62eb('0x54')))[_0x62eb('0x15')](_0x62eb('0x55'),squel[_0x62eb('0x10')]()[_0x62eb('0x11')](_0x62eb('0x56'),_0x62eb('0x57'))['from'](_0x1e1178)[_0x62eb('0x58')](_0x24d3cb[_0x62eb('0x18')](','))))[_0x62eb('0x42')]();}function handleStop(){logger[_0x62eb('0x59')](_0x62eb('0x5a'));stopped=!![];}function handleUncaughtException(_0xae1565){logger[_0x62eb('0x5b')](_0xae1565[_0x62eb('0x5c')]);process['exit'](0x1);}function handleError(_0x28a594,_0x5266c3){stats['errors'][_0x62eb('0x1e')]({'name':_0x5266c3[_0x62eb('0x5d')],'message':_0x5266c3['message'],'row':_0x28a594});}function handleQuery(_0x22ca55){logger[_0x62eb('0x59')](_0x22ca55);return db['sequelize'][_0x62eb('0x5e')](_0x22ca55)[_0x62eb('0x5f')](function(_0x3ff3fe){results['push'](_0x3ff3fe);})[_0x62eb('0x60')](function(_0x1e1c14){logger[_0x62eb('0x5b')](_0x1e1c14[_0x62eb('0x5c')]);});}function updateTzCampaigns(_0x3266be){return new Promise(function(_0x1b4c01,_0x435bd0){var _0x57dece=squel['select']()[_0x62eb('0x39')]([_0x62eb('0x61'),'campaigns.dialTimezone'])['from']('campaigns')[_0x62eb('0x18')](_0x62eb('0x62'),null,_0x62eb('0x63'))['where']('campaigns_has_cm_lists.CmListId='+_0x3266be);db[_0x62eb('0x64')]['query'](_0x57dece[_0x62eb('0x42')]())[_0x62eb('0x5f')](function(_0x1547a4){var _0x25d3c2=[];for(var _0x46a23b=0x0;_0x46a23b<_0x1547a4['length'];_0x46a23b++){_0x25d3c2[_0x62eb('0x1e')](getTimezoneData(_0x1547a4[_0x46a23b],tmp_campaigns));}BPromise[_0x62eb('0x1f')](_0x25d3c2)[_0x62eb('0x1c')](function(){_0x1b4c01({'val':0x1});});})['catch'](function(_0x1e3659){logger[_0x62eb('0x5b')](_0x1e3659[_0x62eb('0x5c')]);_0x1b4c01({'val':0x0});});});}function updateTzVoiceQueues(_0x41f83a){return new Promise(function(_0x29ca9d,_0x3b6cf4){var _0x34d6b2=squel[_0x62eb('0x10')]()[_0x62eb('0x39')]([_0x62eb('0x65'),_0x62eb('0x66')])['from'](_0x62eb('0x67'))['join'](_0x62eb('0x68'),null,_0x62eb('0x69'))['where']('voice_queues_has_cm_lists.CmListId='+_0x41f83a);db['sequelize']['query'](_0x34d6b2['toString']())[_0x62eb('0x5f')](function(_0x3ce1e3){var _0x4fb49a=[];for(var _0x955024=0x0;_0x955024<_0x3ce1e3[_0x62eb('0x1d')];_0x955024++){_0x4fb49a['push'](getTimezoneData(_0x3ce1e3[_0x955024],tmp_voice_queues));}BPromise[_0x62eb('0x1f')](_0x4fb49a)[_0x62eb('0x1c')](function(){_0x29ca9d({'val':0x1});});})['catch'](function(_0x8c53fc){logger[_0x62eb('0x5b')](_0x8c53fc['message']);_0x29ca9d({'val':0x0});});});}function getTimezoneData(_0x2e0a32,_0x2aa8e4){return new Promise(function(_0x171365,_0x94f6e2){var _0x15a9b5=shared[_0x62eb('0x6a')];var _0x5a9f9d=_0x15a9b5[_0x2e0a32[_0x62eb('0x6b')]];if(_[_0x62eb('0x21')](_0x5a9f9d)){_0x171365({'ret':0x1});}else{var _0x192d22=_0x5a9f9d['utcOffset'];var _0x1143ca=squel['insert']()[_0x62eb('0x30')](_0x2aa8e4)['set']('id',_0x2e0a32['id'])[_0x62eb('0x6c')]('offset',_0x192d22)[_0x62eb('0x6c')](_0x62eb('0x6b'),_0x2e0a32['dialTimezone'])[_0x62eb('0x42')]();return db[_0x62eb('0x64')][_0x62eb('0x5e')](_0x1143ca)[_0x62eb('0x5f')](function(_0x5c9e26){_0x171365({'ret':0x1});})['catch'](function(_0x1ba6e9){logger[_0x62eb('0x5b')](_0x1ba6e9[_0x62eb('0x5c')]);_0x94f6e2({'ret':0x1});});}});}function handleTZQuery(_0x1319af){logger[_0x62eb('0x59')](_0x1319af);return db['sequelize'][_0x62eb('0x5e')](_0x1319af)['spread'](function(_0x4076c7){})[_0x62eb('0x60')](function(_0x5b8839){logger['error'](_0x5b8839[_0x62eb('0x5c')]);});}function main(_0x382a79,_0x23a444,_0x132b3d,_0x5b9543){logger['info']('main',_0x382a79,JSON[_0x62eb('0x6d')](_0x23a444));process[_0x62eb('0x6e')](_0x62eb('0x6f'));var _0x6c221c=_0x23a444[_0x62eb('0x70')];var _0x343dd3=_[_0x62eb('0x71')](_0x6c221c);var _0x35f037=_0x23a444[_0x62eb('0x72')];var _0x3b5f90=path[_0x62eb('0x18')](config[_0x62eb('0x73')],'server/files/tmp',_0x35f037+'.csv');hasTZ=_[_0x62eb('0x74')](_0x6c221c)[_0x62eb('0x75')](_0x62eb('0x6b'));var _0x5a981c=_[_0x62eb('0x74')](_0x6c221c)['join']();logger['info'](_0x62eb('0x76'),_0x5a981c);db[_0x62eb('0x77')][_0x62eb('0x1a')]({'raw':!![],'attributes':['id','name']})[_0x62eb('0x1c')](function(_0x37755c){for(var _0x510ab5=0x0;_0x510ab5<_0x37755c[_0x62eb('0x1d')];_0x510ab5++){if(_0x37755c[_0x510ab5]['name']in _0x6c221c){contactItemTypes[_0x62eb('0x1e')](_0x37755c[_0x510ab5]);delete _0x343dd3[_0x37755c[_0x510ab5][_0x62eb('0x78')]];hasAdditionalPhones=!![];}for(var _0x514bc5 in _0x6c221c){if(_0x37755c[_0x510ab5][_0x62eb('0x78')]+_0x62eb('0x79')===_0x514bc5){phoneDescriptions[_0x62eb('0x1e')]({'itemTypeId':_0x37755c[_0x510ab5]['id'],'description':_0x514bc5});delete _0x343dd3[_0x514bc5];}}}if(hasAdditionalPhones)_0x343dd3['AdditionalPhones']='';var _0x165df6=_[_0x62eb('0x74')](_0x343dd3)[_0x62eb('0x18')]();logger[_0x62eb('0x59')](_0x62eb('0x76'),_0x165df6);fs[_0x62eb('0x7a')](_0x3b5f90,_0x165df6+'\x0a');Papa[_0x62eb('0x7b')](fs[_0x62eb('0x7c')](_0x382a79),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1674ad,_0x50d766){try{for(var _0x5d7e6e=0x0,_0x514c65=[];_0x5d7e6e<_0x1674ad[_0x62eb('0x7d')][_0x62eb('0x1d')];_0x5d7e6e++){stats['rows']+=0x1;if(_0x1674ad[_0x62eb('0x7e')][_0x5d7e6e]){handleError(_0x1674ad['data'][_0x5d7e6e],_0x1674ad[_0x62eb('0x7e')][_0x5d7e6e]);}else{var _0x44ce5c=[];var _0x1137bf=[];var _0x3e2f60={};for(var _0x3f78e9 in _0x6c221c){let _0x3ebfb9=contactItemTypes[_0x62eb('0x7f')](_0x475ef2=>_0x475ef2[_0x62eb('0x78')]===_0x3f78e9);let _0x1a092f=contactItemTypes[_0x62eb('0x7f')](_0x58adb6=>_0x58adb6['name']+_0x62eb('0x79')===_0x3f78e9);if(_[_0x62eb('0x21')](_0x3ebfb9)&&_[_0x62eb('0x21')](_0x1a092f)){if(_0x6c221c[_0x62eb('0x80')](_0x3f78e9)){if(_0x1674ad[_0x62eb('0x7d')][_0x5d7e6e][_0x6c221c[_0x3f78e9]]){var _0x808691=_[_0x62eb('0x81')](_0x1674ad['data'][_0x5d7e6e][_0x6c221c[_0x3f78e9]][_0x62eb('0x82')](/"/g,'\x27'));switch(_0x3f78e9){case _0x62eb('0x47'):var _0x494201=moment(_0x808691,_0x62eb('0x83'),!![]);if(_0x494201['isValid']()){_0x514c65[_0x62eb('0x1e')]('\x22'+_0x808691+'\x22');}else{_0x44ce5c[_0x62eb('0x1e')](_0x62eb('0x84'));}break;case _0x62eb('0x85'):var _0x55987f=parseInt(_0x808691);_0x808691=_[_0x62eb('0x86')](_0x55987f)||_0x55987f<0x0||_0x55987f>0x4?_0x5b9543?0x3:0x2:_0x55987f;_0x514c65[_0x62eb('0x1e')]('\x22'+_0x808691+'\x22');break;case _0x62eb('0x37'):var _0x1033a8=parseInt(_0x808691);if(_[_0x62eb('0x87')](_0x1033a8)&&_[_0x62eb('0x75')](_0x132b3d,_0x1033a8)){_0x514c65[_0x62eb('0x1e')]('\x22'+_0x1033a8+'\x22');}else{_0x44ce5c[_0x62eb('0x1e')](_0x62eb('0x88'));}break;case _0x62eb('0x89'):if(isEmail(_0x808691)){_0x514c65[_0x62eb('0x1e')]('\x22'+_0x808691+'\x22');}else{_0x44ce5c[_0x62eb('0x1e')](_0x62eb('0x8a'));}break;case _0x62eb('0x8b'):var _0x45ad4c=moment(_0x808691,'YYYY-MM-DD',!![]);if(_0x45ad4c['isValid']()){_0x514c65[_0x62eb('0x1e')]('\x22'+_0x808691+'\x22');}else{_0x44ce5c[_0x62eb('0x1e')](_0x62eb('0x8c'));}break;case _0x62eb('0x6b'):var _0x560760=shared['timezones'];var _0x5ecdc7=_0x560760[_0x808691];if(!_[_0x62eb('0x21')](_0x5ecdc7)){var _0x230f2e=_0x5ecdc7['utcOffset'];_0x514c65[_0x62eb('0x1e')]('\x22'+_0x808691+'\x22');_0x514c65['push']('\x22'+_0x230f2e+'\x22');}break;default:_0x514c65[_0x62eb('0x1e')]('\x22'+_0x808691+'\x22');}}else{switch(_0x3f78e9){case _0x62eb('0x8d'):case'phone':_0x44ce5c[_0x62eb('0x1e')](_0x3f78e9+'\x20not\x20specified');break;default:_0x514c65['push']('\x22\x22');}}}}else{var _0x2714a0='';if(!_[_0x62eb('0x21')](_0x3ebfb9)){if(!_0x3e2f60[_0x62eb('0x80')](_0x3ebfb9['id'])){if(!_[_0x62eb('0x21')](_0x1674ad['data'][_0x5d7e6e][_0x6c221c[_0x3f78e9]])){var _0x808691=_[_0x62eb('0x81')](_0x1674ad[_0x62eb('0x7d')][_0x5d7e6e][_0x6c221c[_0x3f78e9]][_0x62eb('0x82')](/"/g,'\x27'));var _0x1b04f6=phoneDescriptions[_0x62eb('0x7f')](_0x5a842b=>_0x5a842b[_0x62eb('0x8e')]===_0x3ebfb9['id']);if(!_['isNil'](_0x1b04f6)){var _0x1b4471=_['trim'](_0x1674ad[_0x62eb('0x7d')][_0x5d7e6e][_0x6c221c[_0x1b04f6[_0x62eb('0x8f')]]][_0x62eb('0x82')](/"/g,'\x27'));if(!_[_0x62eb('0x21')](_0x1b4471))_0x808691=_0x808691+'§'+_0x1b4471;}if(_0x2714a0=='')_0x2714a0=_0x808691;else _0x2714a0+='|'+_0x808691;}_0x1137bf[_0x62eb('0x1e')](_0x3ebfb9['id']+':'+_0x2714a0);_0x3e2f60[_0x3ebfb9['id']]=0x1;}}}}if(hasAdditionalPhones){_0x514c65[_0x62eb('0x1e')]('\x22'+_0x1137bf[_0x62eb('0x18')](';')+'\x22');}if(_0x44ce5c[_0x62eb('0x1d')]){handleError(_0x1674ad[_0x62eb('0x7d')][_0x5d7e6e],{'code':_0x62eb('0x90'),'message':_0x44ce5c[_0x62eb('0x18')]()});}else{fs[_0x62eb('0x91')](_0x3b5f90,_0x514c65['join']()+'\x0a');}_0x514c65=[];}if(!(stats['rows']%0xc8)){socket[_0x62eb('0x92')]('contact:import:'+_0x35f037,stats);stats['errors']=[];}}if(stopped){logger[_0x62eb('0x59')]('Abort\x20parser');_0x50d766[_0x62eb('0x93')]();}}catch(_0x47f3c8){handleError(_0x1674ad[_0x62eb('0x7d')][_0x5d7e6e],{'code':_0x62eb('0x94'),'message':_0x47f3c8[_0x62eb('0x5c')]});logger[_0x62eb('0x5b')](_0x62eb('0x95'),_0x47f3c8[_0x62eb('0x5c')]);}},'complete':function(){try{var _0x13866e=[];var _0x48d015=[];var _0x18dd87='cm_contacts';if(_0x23a444[_0x62eb('0x96')]&&_0x23a444[_0x62eb('0x96')][_0x62eb('0x1d')]){_0x18dd87='cm_contacts_'+_0x35f037;_0x13866e['push']('CREATE\x20TABLE\x20'+_0x18dd87+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x62eb('0x97')+_0x35f037;tmp_voice_queues=_0x62eb('0x98')+_0x35f037;_0x48d015[_0x62eb('0x1e')](_0x62eb('0x99')+tmp_campaigns+_0x62eb('0x9a'));_0x48d015[_0x62eb('0x1e')](_0x62eb('0x99')+tmp_voice_queues+_0x62eb('0x9a'));BPromise[_0x62eb('0x9b')](_0x48d015,handleTZQuery)['then'](function(_0x272591){updateTzCampaigns(_0x23a444[_0x62eb('0x34')])[_0x62eb('0x1c')](function(_0x555add){updateTzVoiceQueues(_0x23a444[_0x62eb('0x34')])['then'](function(_0x3721aa){if(hasTZ)_0x165df6=_0x165df6[_0x62eb('0x82')](_0x62eb('0x6b'),_0x62eb('0x9c'));var _0xe3c0fd=util[_0x62eb('0xe')](_0x62eb('0x9d'),_0x3b5f90,_0x18dd87,_0x165df6,_0x23a444[_0x62eb('0x34')],_0x23a444[_0x62eb('0x52')]||null,NOW,NOW);if(_[_0x62eb('0x21')](_0x6c221c[_0x62eb('0x47')])){_0xe3c0fd+=_0x62eb('0x9e');}_0x13866e[_0x62eb('0x1e')](_0xe3c0fd);if(_0x23a444[_0x62eb('0x96')]&&_0x23a444[_0x62eb('0x96')]['length']){_0x13866e[_0x62eb('0x1e')](insertCmContact(_0x23a444[_0x62eb('0x34')],_0x18dd87,_0x23a444['duplicates'],_0x6c221c));_0x13866e['push'](_0x62eb('0x9f')+_0x18dd87+';');}BPromise[_0x62eb('0x9b')](_0x13866e,handleQuery)[_0x62eb('0x1c')](function(_0x38679d){BPromise['all']([handleAdditionalPhones()])[_0x62eb('0x1c')](function(){_0x13866e=[];for(var _0x3c8166=0x0;_0x3c8166\x20\x20','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','util','bluebird','moment','squel','../../../mysqldb','redis','defaults','YYYY-MM-DD\x20HH:mm:ss','field','phone'];(function(_0x150f00,_0x55e584){var _0x1d4236=function(_0x1dbf93){while(--_0x1dbf93){_0x150f00['push'](_0x150f00['shift']());}};_0x1d4236(++_0x55e584);}(_0x378b,0xa4));var _0xb378=function(_0x3d7315,_0x56ec93){_0x3d7315=_0x3d7315-0x0;var _0x59e915=_0x378b[_0x3d7315];return _0x59e915;};'use strict';var fs=require('fs');var path=require(_0xb378('0x0'));var _=require(_0xb378('0x1'));var Papa=require('papaparse');var util=require(_0xb378('0x2'));var BPromise=require(_0xb378('0x3'));var moment=require(_0xb378('0x4'));var squel=require(_0xb378('0x5'));var Redis=require('ioredis');var db=require(_0xb378('0x6'))['db'];var config=require('../../../config/environment');var shared=require('../../../config/environment/shared');var logger=require('../../../config/logger')('import');config[_0xb378('0x7')]=_[_0xb378('0x8')](config[_0xb378('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb378('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0xb378('0x9'));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(_0x5564ff){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'](_0x5564ff);}function selectNotIn(_0x1b5bad,_0x2950ef,_0x832fb7,_0x624218,_0x215a80){return squel['select']()[_0xb378('0xa')](_0xb378('0xb'))[_0xb378('0xc')](_0x624218)[_0xb378('0xd')](_0x2950ef,null,_0x2950ef+_0xb378('0xe')+_0x624218+'.'+_0x832fb7)[_0xb378('0xf')](_0x624218+'.'+_0x832fb7+'\x20=\x20'+_0x1b5bad+'.'+_0x832fb7)[_0xb378('0xf')](_0x2950ef+'.dialCheckDuplicateType\x20IN\x20('+_0x215a80[_0xb378('0xd')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x483598,_0x104f80){promisesAdditionalPhones=[];return db[_0xb378('0x10')]['findAll']({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xb378('0x11')](function(_0x325eec){if(_0x325eec!==null){var _0x4dbed7=[];for(var _0x88938f=0x0;_0x88938f<_0x325eec[_0xb378('0x12')];_0x88938f++){var _0x5ea14c=_0x325eec[_0x88938f];_0x4dbed7['push'](insertAdditionalPhones(_0x5ea14c));}}Promise['all'](_0x4dbed7)['then'](function(){_0x483598({'val':0x1});});});});}function insertAdditionalPhones(_0x4b6543){return new Promise(function(_0xd08c42,_0x3ed843){var _0x5b7f11=_0x4b6543[_0xb378('0x13')];var _0x5c4e4b=_0x5b7f11[_0xb378('0x14')](';');var _0xc988e7=[];orderBy=0x0;for(var _0x263777=0x0;_0x263777<_0x5c4e4b[_0xb378('0x12')];_0x263777++){_0xc988e7[_0xb378('0x15')](splitAdditionalPhone(_0x4b6543['id'],_0x5c4e4b[_0x263777]));}Promise['all'](_0xc988e7)[_0xb378('0x11')](function(){_0xd08c42({'val':_0x5c4e4b[_0xb378('0x12')]});});});}function splitAdditionalPhone(_0x66e6f0,_0x187c6c){return new Promise(function(_0x27171a,_0x340d86){var _0x5522bc=_0x187c6c[_0xb378('0x14')](':');var _0x5e2b4d=_0x5522bc[0x0];var _0x18e6c5=_0x5522bc[0x1];if(!_[_0xb378('0x16')](_0x18e6c5)){var _0x126f31=_0x18e6c5[_0xb378('0x14')]('|');var _0x2e47e7=[];for(var _0xdd4716=0x0;_0xdd4716<_0x126f31[_0xb378('0x12')];_0xdd4716++){if(_0x126f31[_0xdd4716]!==''){var _0x44bc2e=_[_0xb378('0x17')](promisesAdditionalPhones,{'contactId':_0x66e6f0,'phone':_0x126f31[_0xdd4716]});if(_0x44bc2e[_0xb378('0x12')]==0x0){orderBy++;promisesAdditionalPhones[_0xb378('0x15')]({'contactId':_0x66e6f0,'contactTypeId':_0x5e2b4d,'phone':_0x126f31[_0xdd4716],'orderBy':orderBy});}}}_0x27171a({'ok':0x1});}else _0x27171a({'res':0x0});});}function createAdditionalPhone(_0x275c3b,_0x3addc5,_0x4d0b0b,_0x2d53e0){var _0x1390ae='';var _0x50054c='';var _0x746b38=_0x4d0b0b[_0xb378('0x14')]('§');_0x1390ae=_0x746b38[0x0];if(_0x746b38[_0xb378('0x12')]==0x2)_0x50054c=_0x746b38[0x1];return new Promise(function(_0x1a4c59,_0x253909){return db[_0xb378('0x18')][_0xb378('0x19')]({'where':{'CmContactId':_0x275c3b,'item':_0x1390ae}})[_0xb378('0x11')](function(_0x302102){if(_0x302102){return db['CmContactHasItem'][_0xb378('0x1a')]({'ItemTypeId':_0x3addc5,'description':_0x50054c,'OrderBy':_0x2d53e0},{'where':{'CmContactId':_0x275c3b,'item':_0x1390ae}})[_0xb378('0x11')](function(_0x30e457){_0x1a4c59({'res':'updated'});});}else{return db[_0xb378('0x18')][_0xb378('0x1b')]({'CmContactId':_0x275c3b,'item':_0x1390ae,'description':_0x50054c,'ItemTypeId':_0x3addc5,'OrderBy':_0x2d53e0,'ItemClass':_0xb378('0x1c')})[_0xb378('0x11')](function(_0x5e8b52){_0x1a4c59({'res':_0xb378('0x1d')});});}});});}function insertCmHopper(_0x5604db,_0x3a033b,_0x311c35,_0x3331f4,_0x4e281d){var _0x297cb0=[_0xb378('0x1e'),'cm_contacts.scheduledat',_0xb378('0x1f'),'cm_contacts.ListId',_0x3a033b+'.'+_0x3331f4,_0xb378('0x20'),_0xb378('0x21'),_0xb378('0x22'),_0xb378('0x23'),'\x22'+_0x4e281d+'\x22'];return squel[_0xb378('0x24')]()[_0xb378('0x25')]('cm_hopper')[_0xb378('0x26')]([_0xb378('0xb'),_0xb378('0x27'),'ContactId',_0xb378('0x28'),_0x3331f4,'createdAt','updatedAt',_0xb378('0x29'),'UserId','recallme'],squel[_0xb378('0x2a')]()['fields'](_0x297cb0)[_0xb378('0xc')](_0x3a033b)[_0xb378('0xd')](_0xb378('0x2b'),null,_0xb378('0x2c')+_0x3a033b+_0xb378('0x2d'))[_0xb378('0xd')](_0x311c35,null,_0x311c35+_0xb378('0xe')+_0x3a033b+'.'+_0x3331f4)[_0xb378('0xf')](_0x3a033b+_0xb378('0x2e'),_0x5604db)[_0xb378('0xf')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xb378('0x2f'),selectNotIn(_0x3a033b,_0x311c35,_0x3331f4,_0xb378('0x30'),[_0xb378('0x31'),_0xb378('0x32')]))[_0xb378('0xf')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3a033b,_0x311c35,_0x3331f4,'cm_hopper',['\x22always\x22'])))[_0xb378('0x33')]();}function insertCmHopperBlack(_0x1c72f0,_0x59c887,_0x3652ed,_0x561395){var _0x34b5e1=[_0xb378('0x1e'),'cm_contacts.id',_0xb378('0x34'),_0x59c887+'.'+_0x561395,_0xb378('0x20'),_0xb378('0x21')];return squel[_0xb378('0x24')]()['into']('cm_hopper_black')['fromQuery'](['phone','ContactId','ListId',_0x561395,_0xb378('0x35'),'updatedAt'],squel[_0xb378('0x2a')]()['fields'](_0x34b5e1)[_0xb378('0xc')](_0x59c887)[_0xb378('0xd')]('cm_contacts',null,_0xb378('0x2c')+_0x59c887+'.CmListId')['join'](_0x3652ed,null,_0x3652ed+_0xb378('0xe')+_0x59c887+'.'+_0x561395)[_0xb378('0xf')](_0x59c887+'.CmListId\x20=\x20?',_0x1c72f0)['where'](_0xb378('0x36'),NOW)[_0xb378('0xf')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xb378('0x2a')]()[_0xb378('0xa')]('phone')[_0xb378('0xc')]('cm_hopper_black')[_0xb378('0xf')]('ListId\x20=\x20?',_0x1c72f0)[_0xb378('0xf')](_0x561395+_0xb378('0x37')+_0x59c887+'.'+_0x561395)))[_0xb378('0x33')]();}function insertTzCmHopper(_0x58bd3e,_0x3297d5,_0x545673,_0x20759c,_0x569981,_0x20d89a){var _0x40360c=[_0xb378('0x1e'),_0xb378('0x38')+_0x20d89a+_0xb378('0x39'),_0xb378('0x1f'),_0xb378('0x34'),_0x3297d5+'.'+_0x20759c,'cm_contacts.createdAt',_0xb378('0x21'),_0xb378('0x22'),_0xb378('0x23'),'\x22'+_0x569981+'\x22'];var _0xfb3ea8=squel[_0xb378('0x24')]()[_0xb378('0x25')](_0xb378('0x30'))[_0xb378('0x26')]([_0xb378('0xb'),_0xb378('0x27'),_0xb378('0x3a'),_0xb378('0x28'),_0x20759c,_0xb378('0x35'),_0xb378('0x3b'),'priority','UserId',_0xb378('0x3c')],squel[_0xb378('0x2a')]()[_0xb378('0x3d')](_0x40360c)['from'](_0x3297d5)[_0xb378('0xd')](_0xb378('0x2b'),null,_0xb378('0x2c')+_0x3297d5+_0xb378('0x2d'))[_0xb378('0xd')](_0x545673,null,_0x545673+_0xb378('0xe')+_0x3297d5+'.'+_0x20759c)[_0xb378('0xd')](_0x20d89a,null,_0x20d89a+'.id\x20=\x20'+_0x3297d5+'.'+_0x20759c)[_0xb378('0xf')](_0x3297d5+_0xb378('0x2e'),_0x58bd3e)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xb378('0xf')](_0xb378('0x2f'),selectNotIn(_0x3297d5,_0x545673,_0x20759c,'cm_hopper',[_0xb378('0x31'),_0xb378('0x32')]))[_0xb378('0xf')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3297d5,_0x545673,_0x20759c,_0xb378('0x30'),['\x22always\x22'])))[_0xb378('0x33')]();return _0xfb3ea8;}function insertTzCmHopperBlack(_0x26b5f2,_0x40514b,_0x2ad68f,_0x18289f){var _0x111417=['cm_contacts.phone',_0xb378('0x1f'),_0xb378('0x34'),_0x40514b+'.'+_0x18289f,_0xb378('0x20'),_0xb378('0x21')];return squel[_0xb378('0x24')]()['into']('cm_hopper_black')['fromQuery']([_0xb378('0xb'),'ContactId','ListId',_0x18289f,_0xb378('0x35'),'updatedAt'],squel[_0xb378('0x2a')]()[_0xb378('0x3d')](_0x111417)[_0xb378('0xc')](_0x40514b)[_0xb378('0xd')](_0xb378('0x2b'),null,'cm_contacts.ListId\x20=\x20'+_0x40514b+_0xb378('0x2d'))['join'](_0x2ad68f,null,_0x2ad68f+_0xb378('0xe')+_0x40514b+'.'+_0x18289f)[_0xb378('0xf')](_0x40514b+_0xb378('0x2e'),_0x26b5f2)[_0xb378('0xf')](_0xb378('0x36'),NOW)[_0xb378('0xf')](_0xb378('0x2f'),squel['select']()['field']('phone')['from']('cm_hopper_black')['where'](_0xb378('0x3e'),_0x26b5f2)[_0xb378('0xf')](_0x18289f+_0xb378('0x37')+_0x40514b+'.'+_0x18289f)))[_0xb378('0x33')]();}function insertCmHopperAdditionalPhones(_0x2c35ec){var _0x3bcc7e=[_0xb378('0x3f'),_0xb378('0x40'),'cm_contact_has_items.OrderBy',_0xb378('0x41'),_0xb378('0x42')];return squel['insert']()[_0xb378('0x25')](_0xb378('0x43'))[_0xb378('0x26')]([_0xb378('0x44'),_0xb378('0xb'),_0xb378('0x45'),_0xb378('0x35'),_0xb378('0x3b')],squel[_0xb378('0x2a')]()[_0xb378('0x3d')](_0x3bcc7e)[_0xb378('0xc')]('cm_hopper')['join'](_0xb378('0x2b'),null,_0xb378('0x46'))[_0xb378('0xd')](_0xb378('0x47'),null,_0xb378('0x48'))[_0xb378('0xf')]('cm_hopper.ListId\x20=\x20?',_0x2c35ec)[_0xb378('0xf')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xb378('0x33')]();}function insertCmContact(_0x244056,_0x211a8a,_0x5bc3f9,_0x20022f){var _0x164b07=_[_0xb378('0x49')](_[_0xb378('0x4a')](_0x20022f),[_0xb378('0x28'),_0xb378('0x4b'),_0xb378('0x35'),'updatedAt',_0xb378('0x4c')]);return squel[_0xb378('0x24')]()[_0xb378('0x25')](_0xb378('0x2b'))[_0xb378('0x26')](_0x164b07,squel[_0xb378('0x2a')]()[_0xb378('0x3d')](_0x164b07)[_0xb378('0xc')](_0x211a8a)[_0xb378('0xf')]('('+_0x5bc3f9[_0xb378('0xd')](',')+_0xb378('0x4d'),squel[_0xb378('0x2a')]()[_0xb378('0x3d')](_0x5bc3f9)['from'](_0xb378('0x2b'))[_0xb378('0xf')](_0xb378('0x3e'),_0x244056)[_0xb378('0xf')]('deletedAt\x20IS\x20NULL'))[_0xb378('0xf')](_0xb378('0x4e'),squel[_0xb378('0x2a')]()[_0xb378('0xa')](_0xb378('0x4f'),_0xb378('0x50'))[_0xb378('0xc')](_0x211a8a)[_0xb378('0x51')](_0x5bc3f9['join'](','))))[_0xb378('0x33')]();}function handleStop(){logger[_0xb378('0x52')](_0xb378('0x53'));stopped=!![];}function handleUncaughtException(_0x4eed65){logger['error'](_0x4eed65[_0xb378('0x54')]);process['exit'](0x1);}function handleError(_0x514eb0,_0x2df570){stats[_0xb378('0x55')]['push']({'name':_0x2df570[_0xb378('0x56')],'message':_0x2df570[_0xb378('0x54')],'row':_0x514eb0});}function handleQuery(_0x3b6ef6){logger[_0xb378('0x52')](_0x3b6ef6);return db['sequelize'][_0xb378('0x57')](_0x3b6ef6)[_0xb378('0x58')](function(_0x3a6768){results[_0xb378('0x15')](_0x3a6768);})[_0xb378('0x59')](function(_0x3058db){logger['error'](_0x3058db[_0xb378('0x54')]);});}function updateTzCampaigns(_0x6c0be7){return new Promise(function(_0x3159bb,_0x34f05b){var _0x14b45f=squel[_0xb378('0x2a')]()[_0xb378('0x3d')]([_0xb378('0x5a'),_0xb378('0x5b')])[_0xb378('0xc')]('campaigns')[_0xb378('0xd')](_0xb378('0x5c'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0xb378('0xf')](_0xb378('0x5d')+_0x6c0be7);db['sequelize']['query'](_0x14b45f['toString']())[_0xb378('0x58')](function(_0x1b32d3){var _0x22606b=[];for(var _0x4dd32c=0x0;_0x4dd32c<_0x1b32d3[_0xb378('0x12')];_0x4dd32c++){_0x22606b['push'](getTimezoneData(_0x1b32d3[_0x4dd32c],tmp_campaigns));}BPromise[_0xb378('0x5e')](_0x22606b)['then'](function(){_0x3159bb({'val':0x1});});})[_0xb378('0x59')](function(_0x3a9d34){logger[_0xb378('0x5f')](_0x3a9d34['message']);_0x3159bb({'val':0x0});});});}function updateTzVoiceQueues(_0x1eaee9){return new Promise(function(_0xc19b1c,_0x413537){var _0x4b150b=squel[_0xb378('0x2a')]()[_0xb378('0x3d')]([_0xb378('0x60'),_0xb378('0x61')])[_0xb378('0xc')]('voice_queues')[_0xb378('0xd')]('voice_queues_has_cm_lists',null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0xb378('0xf')](_0xb378('0x62')+_0x1eaee9);db[_0xb378('0x63')][_0xb378('0x57')](_0x4b150b[_0xb378('0x33')]())[_0xb378('0x58')](function(_0x3a8159){var _0x54ec36=[];for(var _0x4a240e=0x0;_0x4a240e<_0x3a8159[_0xb378('0x12')];_0x4a240e++){_0x54ec36[_0xb378('0x15')](getTimezoneData(_0x3a8159[_0x4a240e],tmp_voice_queues));}BPromise[_0xb378('0x5e')](_0x54ec36)[_0xb378('0x11')](function(){_0xc19b1c({'val':0x1});});})['catch'](function(_0x6e7f68){logger[_0xb378('0x5f')](_0x6e7f68[_0xb378('0x54')]);_0xc19b1c({'val':0x0});});});}function getTimezoneData(_0x272581,_0x50212a){return new Promise(function(_0x422726,_0x4d6e3b){var _0x4d583b=shared[_0xb378('0x64')];var _0x2fe8f8=_0x4d583b[_0x272581[_0xb378('0x65')]];if(_['isNil'](_0x2fe8f8)){_0x422726({'ret':0x1});}else{var _0x48a27c=_0x2fe8f8[_0xb378('0x66')];var _0x4fc48a=squel[_0xb378('0x24')]()[_0xb378('0x25')](_0x50212a)['set']('id',_0x272581['id'])[_0xb378('0x67')](_0xb378('0x68'),_0x48a27c)[_0xb378('0x67')](_0xb378('0x65'),_0x272581[_0xb378('0x65')])[_0xb378('0x33')]();return db['sequelize'][_0xb378('0x57')](_0x4fc48a)[_0xb378('0x58')](function(_0x37c73d){_0x422726({'ret':0x1});})[_0xb378('0x59')](function(_0x30bdde){logger[_0xb378('0x5f')](_0x30bdde[_0xb378('0x54')]);_0x4d6e3b({'ret':0x1});});}});}function handleTZQuery(_0x51ed90){logger[_0xb378('0x52')](_0x51ed90);return db[_0xb378('0x63')][_0xb378('0x57')](_0x51ed90)[_0xb378('0x58')](function(_0x56f998){})[_0xb378('0x59')](function(_0x165e50){logger[_0xb378('0x5f')](_0x165e50[_0xb378('0x54')]);});}function main(_0x4f99f6,_0x2fda3d,_0xcec325,_0x1d76da){logger['info'](_0xb378('0x69'),_0x4f99f6,JSON['stringify'](_0x2fda3d));process[_0xb378('0x6a')](_0xb378('0x6b'));var _0x53917f=_0x2fda3d[_0xb378('0x6c')];var _0x1f252e=_[_0xb378('0x6d')](_0x53917f);var _0x324eea=_0x2fda3d[_0xb378('0x6e')];var _0x57922d=path[_0xb378('0xd')](config[_0xb378('0x6f')],_0xb378('0x70'),_0x324eea+_0xb378('0x71'));hasTZ=_['keys'](_0x53917f)[_0xb378('0x72')](_0xb378('0x65'));var _0x4a41d0=_[_0xb378('0x4a')](_0x53917f)[_0xb378('0xd')]();logger[_0xb378('0x52')]('header',_0x4a41d0);db[_0xb378('0x73')][_0xb378('0x74')]({'raw':!![],'attributes':['id',_0xb378('0x75')]})[_0xb378('0x11')](function(_0x19ab8b){for(var _0x209041=0x0;_0x209041<_0x19ab8b['length'];_0x209041++){if(_0x19ab8b[_0x209041][_0xb378('0x75')]in _0x53917f){contactItemTypes[_0xb378('0x15')](_0x19ab8b[_0x209041]);delete _0x1f252e[_0x19ab8b[_0x209041][_0xb378('0x75')]];hasAdditionalPhones=!![];}for(var _0x34eacd in _0x53917f){if(_0x19ab8b[_0x209041][_0xb378('0x75')]+_0xb378('0x76')===_0x34eacd){phoneDescriptions[_0xb378('0x15')]({'itemTypeId':_0x19ab8b[_0x209041]['id'],'description':_0x34eacd});delete _0x1f252e[_0x34eacd];}}}if(hasAdditionalPhones)_0x1f252e['AdditionalPhones']='';var _0x309cb2=_['keys'](_0x1f252e)[_0xb378('0xd')]();logger[_0xb378('0x52')]('header',_0x309cb2);fs['writeFileSync'](_0x57922d,_0x309cb2+'\x0a');Papa[_0xb378('0x77')](fs[_0xb378('0x78')](_0x4f99f6),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3d74ac,_0x1abfcc){try{for(var _0x48e6a9=0x0,_0x3f78d8=[];_0x48e6a9<_0x3d74ac[_0xb378('0x79')][_0xb378('0x12')];_0x48e6a9++){stats[_0xb378('0x7a')]+=0x1;if(_0x3d74ac['errors'][_0x48e6a9]){handleError(_0x3d74ac[_0xb378('0x79')][_0x48e6a9],_0x3d74ac[_0xb378('0x55')][_0x48e6a9]);}else{var _0x1909ad=[];var _0x33dec4=[];var _0x3e7f7d={};for(var _0x586dc8 in _0x53917f){let _0x22eba4=contactItemTypes['find'](_0xd187b8=>_0xd187b8[_0xb378('0x75')]===_0x586dc8);let _0x40d45f=contactItemTypes[_0xb378('0x7b')](_0x264daf=>_0x264daf[_0xb378('0x75')]+'_description'===_0x586dc8);if(_[_0xb378('0x16')](_0x22eba4)&&_[_0xb378('0x16')](_0x40d45f)){if(_0x53917f['hasOwnProperty'](_0x586dc8)){if(_0x3d74ac[_0xb378('0x79')][_0x48e6a9][_0x53917f[_0x586dc8]]){var _0xcf4b4d=_[_0xb378('0x7c')](_0x3d74ac[_0xb378('0x79')][_0x48e6a9][_0x53917f[_0x586dc8]][_0xb378('0x7d')](/"/g,'\x27'));switch(_0x586dc8){case _0xb378('0x27'):var _0x57d6e0=moment(_0xcf4b4d,_0xb378('0x9'),!![]);if(_0x57d6e0[_0xb378('0x7e')]()){_0x3f78d8[_0xb378('0x15')]('\x22'+_0xcf4b4d+'\x22');}else{_0x1909ad[_0xb378('0x15')](_0xb378('0x7f'));}break;case _0xb378('0x29'):var _0x16141c=parseInt(_0xcf4b4d);_0xcf4b4d=_['isNaN'](_0x16141c)||_0x16141c<0x0||_0x16141c>0x4?_0x1d76da?0x3:0x2:_0x16141c;_0x3f78d8[_0xb378('0x15')]('\x22'+_0xcf4b4d+'\x22');break;case'UserId':var _0x4d1435=parseInt(_0xcf4b4d);if(_[_0xb378('0x80')](_0x4d1435)&&_['includes'](_0xcec325,_0x4d1435)){_0x3f78d8[_0xb378('0x15')]('\x22'+_0x4d1435+'\x22');}else{_0x1909ad[_0xb378('0x15')](_0xb378('0x81'));}break;case _0xb378('0x82'):if(isEmail(_0xcf4b4d)){_0x3f78d8['push']('\x22'+_0xcf4b4d+'\x22');}else{_0x1909ad['push'](_0xb378('0x83'));}break;case _0xb378('0x84'):var _0x20597a=moment(_0xcf4b4d,_0xb378('0x85'),!![]);if(_0x20597a[_0xb378('0x7e')]()){_0x3f78d8[_0xb378('0x15')]('\x22'+_0xcf4b4d+'\x22');}else{_0x1909ad[_0xb378('0x15')](_0xb378('0x86'));}break;case _0xb378('0x65'):var _0x502c78=shared[_0xb378('0x64')];var _0x49f6be=_0x502c78[_0xcf4b4d];if(!_[_0xb378('0x16')](_0x49f6be)){var _0x12783c=_0x49f6be['utcOffset'];_0x3f78d8[_0xb378('0x15')]('\x22'+_0xcf4b4d+'\x22');_0x3f78d8[_0xb378('0x15')]('\x22'+_0x12783c+'\x22');}break;default:_0x3f78d8[_0xb378('0x15')]('\x22'+_0xcf4b4d+'\x22');}}else{switch(_0x586dc8){case _0xb378('0x87'):case _0xb378('0xb'):_0x1909ad['push'](_0x586dc8+'\x20not\x20specified');break;default:_0x3f78d8[_0xb378('0x15')]('\x22\x22');}}}}else{var _0x437943='';if(!_[_0xb378('0x16')](_0x22eba4)){if(!_0x3e7f7d['hasOwnProperty'](_0x22eba4['id'])){if(!_[_0xb378('0x16')](_0x3d74ac['data'][_0x48e6a9][_0x53917f[_0x586dc8]])){var _0xcf4b4d=_[_0xb378('0x7c')](_0x3d74ac['data'][_0x48e6a9][_0x53917f[_0x586dc8]][_0xb378('0x7d')](/"/g,'\x27'));var _0x5c55a0=phoneDescriptions[_0xb378('0x7b')](_0x3d7f19=>_0x3d7f19[_0xb378('0x88')]===_0x22eba4['id']);if(!_['isNil'](_0x5c55a0)){var _0x4c3e2a=_[_0xb378('0x7c')](_0x3d74ac[_0xb378('0x79')][_0x48e6a9][_0x53917f[_0x5c55a0[_0xb378('0x89')]]][_0xb378('0x7d')](/"/g,'\x27'));if(!_[_0xb378('0x16')](_0x4c3e2a))_0xcf4b4d=_0xcf4b4d+'§'+_0x4c3e2a;}if(_0x437943=='')_0x437943=_0xcf4b4d;else _0x437943+='|'+_0xcf4b4d;}_0x33dec4[_0xb378('0x15')](_0x22eba4['id']+':'+_0x437943);_0x3e7f7d[_0x22eba4['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3f78d8['push']('\x22'+_0x33dec4['join'](';')+'\x22');}if(_0x1909ad[_0xb378('0x12')]){handleError(_0x3d74ac[_0xb378('0x79')][_0x48e6a9],{'code':'SystemRow','message':_0x1909ad[_0xb378('0xd')]()});}else{fs['appendFileSync'](_0x57922d,_0x3f78d8['join']()+'\x0a');}_0x3f78d8=[];}if(!(stats['rows']%0xc8)){socket['emit'](_0xb378('0x8a')+_0x324eea,stats);stats[_0xb378('0x55')]=[];}}if(stopped){logger[_0xb378('0x52')]('Abort\x20parser');_0x1abfcc['abort']();}}catch(_0x32518b){handleError(_0x3d74ac[_0xb378('0x79')][_0x48e6a9],{'code':_0xb378('0x8b'),'message':_0x32518b['message']});logger['error'](_0xb378('0x8c'),_0x32518b[_0xb378('0x54')]);}},'complete':function(){try{var _0x3d3f6e=[];var _0x5a5d7c=[];var _0xf00ef9=_0xb378('0x2b');if(_0x2fda3d[_0xb378('0x8d')]&&_0x2fda3d[_0xb378('0x8d')][_0xb378('0x12')]){_0xf00ef9=_0xb378('0x8e')+_0x324eea;_0x3d3f6e[_0xb378('0x15')](_0xb378('0x8f')+_0xf00ef9+_0xb378('0x90'));}tmp_campaigns=_0xb378('0x91')+_0x324eea;tmp_voice_queues='voice_queues_'+_0x324eea;_0x5a5d7c[_0xb378('0x15')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0xb378('0x92'));_0x5a5d7c['push'](_0xb378('0x8f')+tmp_voice_queues+_0xb378('0x92'));BPromise[_0xb378('0x93')](_0x5a5d7c,handleTZQuery)[_0xb378('0x11')](function(_0x6bd765){updateTzCampaigns(_0x2fda3d[_0xb378('0x28')])[_0xb378('0x11')](function(_0x5212df){updateTzVoiceQueues(_0x2fda3d[_0xb378('0x28')])[_0xb378('0x11')](function(_0x586c20){if(hasTZ)_0x309cb2=_0x309cb2['replace']('dialTimezone',_0xb378('0x94'));var _0x54eff4=util['format'](_0xb378('0x95'),_0x57922d,_0xf00ef9,_0x309cb2,_0x2fda3d[_0xb378('0x28')],_0x2fda3d[_0xb378('0x4b')]||null,NOW,NOW);if(_[_0xb378('0x16')](_0x53917f[_0xb378('0x27')])){_0x54eff4+=',\x20scheduledAt\x20=\x20NOW()';}_0x3d3f6e['push'](_0x54eff4);if(_0x2fda3d['duplicates']&&_0x2fda3d['duplicates'][_0xb378('0x12')]){_0x3d3f6e[_0xb378('0x15')](insertCmContact(_0x2fda3d[_0xb378('0x28')],_0xf00ef9,_0x2fda3d[_0xb378('0x8d')],_0x53917f));_0x3d3f6e[_0xb378('0x15')]('DROP\x20TABLE\x20'+_0xf00ef9+';');}BPromise[_0xb378('0x93')](_0x3d3f6e,handleQuery)[_0xb378('0x11')](function(_0xda9249){BPromise[_0xb378('0x5e')]([handleAdditionalPhones()])[_0xb378('0x11')](function(){_0x3d3f6e=[];for(var _0x3742d0=0x0;_0x3742d0\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','squel','ioredis','../../../config/environment','../../../config/logger','redis','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','format','test','select','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','isNil','AdditionalPhones','push','all','then','catch','message','split','length','findOne','CmContactHasItem','update','PHONE','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','cm_hopper_black','fields','cm_contacts','.CmListId','field','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','error','exit','errors','code','info','main','stringify','send','start','binding','clone','socket_timestamp','server/files/tmp','.csv','body','ContactItemType','findAll','name','_description','header','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','replace','scheduledat','isValid','isNaN','isNumber','agent\x20not\x20exists','email'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x19e1,0x163));var _0x119e=function(_0x2aefb6,_0x1bd384){_0x2aefb6=_0x2aefb6-0x0;var _0x202772=_0x19e1[_0x2aefb6];return _0x202772;};'use strict';var fs=require('fs');var path=require(_0x119e('0x0'));var _=require(_0x119e('0x1'));var Papa=require(_0x119e('0x2'));var util=require(_0x119e('0x3'));var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0x119e('0x4'));var Redis=require(_0x119e('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x119e('0x6'));var logger=require(_0x119e('0x7'))('import');config[_0x119e('0x8')]=_['defaults'](config[_0x119e('0x8')],{'host':_0x119e('0x9'),'port':0x18eb});var socket=require(_0x119e('0xa'))(new Redis(config[_0x119e('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()['format'](_0x119e('0xb'));var tempTableName=_0x119e('0xc')+moment()[_0x119e('0xd')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x4ee06c){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))*$/[_0x119e('0xe')](_0x4ee06c);}function selectNotIn(_0xc2c4a7,_0x3199b1,_0x35fbf1,_0x475b7f,_0x24a27b){return squel[_0x119e('0xf')]()['field'](_0x119e('0x10'))[_0x119e('0x11')](_0x475b7f)[_0x119e('0x12')](_0x3199b1,null,_0x3199b1+_0x119e('0x13')+_0x475b7f+'.'+_0x35fbf1)[_0x119e('0x14')](_0x475b7f+'.'+_0x35fbf1+_0x119e('0x15')+_0xc2c4a7+'.'+_0x35fbf1)['where'](_0x3199b1+_0x119e('0x16')+_0x24a27b[_0x119e('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1c6fd5,_0x881816){promisesAdditionalPhones=[];promisesContact=[];return db[_0x119e('0x17')][_0x119e('0x18')](_0x119e('0x19')+tempTableName)[_0x119e('0x1a')](function(_0x2c5902){if(_0x2c5902!==null){var _0x42acfd=[];for(var _0x41f329=0x0;_0x41f329<_0x2c5902['length'];_0x41f329++){var _0x1820ff=_0x2c5902[_0x41f329];if(!_[_0x119e('0x1b')](_0x1820ff[_0x119e('0x10')])){if(!_[_0x119e('0x1b')](_0x1820ff[_0x119e('0x1c')]))_0x42acfd[_0x119e('0x1d')](insertAdditionalPhones(_0x1820ff));promisesContact[_0x119e('0x1d')]({'contact':_0x1820ff});}}}Promise[_0x119e('0x1e')](_0x42acfd)[_0x119e('0x1f')](function(){_0x1c6fd5({'val':0x1});});})[_0x119e('0x20')](function(_0x2bd27a){logger['error'](_0x2bd27a[_0x119e('0x21')]);});});}function insertAdditionalPhones(_0x5ef280){return new Promise(function(_0xd4c2d5,_0x523a8d){var _0x3cb1bb=_0x5ef280[_0x119e('0x1c')];if(_['isNil'](_0x3cb1bb))_0x523a8d({'val':0x0});else{var _0x4d41f0=_0x3cb1bb[_0x119e('0x22')](';');var _0x29de19=[];orderBy=0x0;for(var _0x37b07e=0x0;_0x37b07e<_0x4d41f0['length'];_0x37b07e++){_0x29de19['push'](splitAdditionalPhone(_0x5ef280['id'],_0x4d41f0[_0x37b07e]));}Promise[_0x119e('0x1e')](_0x29de19)['then'](function(){_0xd4c2d5({'val':_0x4d41f0[_0x119e('0x23')]});});}});}function splitAdditionalPhone(_0x21fb19,_0x198f7b){return new Promise(function(_0x596dfb,_0x1e4c98){var _0x59fc43=_0x198f7b[_0x119e('0x22')](':');var _0x5398e6=_0x59fc43[0x0];var _0x5c57a2=_0x59fc43[0x1];if(_0x5c57a2!==''){var _0xdc170f=_0x5c57a2[_0x119e('0x22')]('|');var _0x1a7dea=[];for(var _0x2770ac=0x0;_0x2770ac<_0xdc170f[_0x119e('0x23')];_0x2770ac++){if(_0xdc170f[_0x2770ac]!==''){var _0x3a9588=_['filter'](promisesAdditionalPhones,{'contactId':_0x21fb19,'phone':_0xdc170f[_0x2770ac]});if(_0x3a9588[_0x119e('0x23')]==0x0){orderBy++;promisesAdditionalPhones[_0x119e('0x1d')]({'contactId':_0x21fb19,'contactTypeId':_0x5398e6,'phone':_0xdc170f[_0x2770ac],'orderBy':orderBy});}}}_0x596dfb({'ok':0x1});}else _0x596dfb({'res':0x0});});}function createAdditionalPhone(_0x58aa83,_0x3ba6ee,_0x1ca670,_0x49b965){var _0x18f2d4='';var _0x513843='';var _0x12d101=_0x1ca670[_0x119e('0x22')]('§');_0x18f2d4=_0x12d101[0x0];if(_0x12d101[_0x119e('0x23')]==0x2)_0x513843=_0x12d101[0x1];return new Promise(function(_0x1e122a,_0x3df7e9){return db['CmContactHasItem'][_0x119e('0x24')]({'where':{'CmContactId':_0x58aa83,'item':_0x18f2d4}})[_0x119e('0x1f')](function(_0x2743d9){if(_0x2743d9){return db[_0x119e('0x25')][_0x119e('0x26')]({'ItemTypeId':_0x3ba6ee,'description':_0x513843,'OrderBy':_0x49b965},{'where':{'CmContactId':_0x58aa83,'item':_0x18f2d4}})[_0x119e('0x1f')](function(_0x4fc239){_0x1e122a({'res':'updated'});});}else{return db['CmContactHasItem']['create']({'CmContactId':_0x58aa83,'item':_0x18f2d4,'ItemTypeId':_0x3ba6ee,'description':_0x513843,'OrderBy':_0x49b965,'ItemClass':_0x119e('0x27')})[_0x119e('0x1f')](function(_0x48fae5){_0x1e122a({'res':'inserted'});});}});});}function updateContact(_0x3cc2cc){return new Promise(function(_0x3dc17f,_0x5f021d){var _0x1a9d07=_0x3cc2cc['id'];delete _0x3cc2cc['id'];return db[_0x119e('0x28')]['update'](_0x3cc2cc,{'where':{'id':_0x1a9d07}})[_0x119e('0x1f')](function(_0x2a196d){updatedRows+=0x1;return db[_0x119e('0x29')][_0x119e('0x26')]({'phone':_0x3cc2cc[_0x119e('0x10')]},{'where':{'ContactId':_0x1a9d07}})[_0x119e('0x1f')](function(_0x1f05e8){_0x3dc17f({'ret':'OK'});});});});}function insertCmHopper(_0x3af549,_0x7f1e56,_0xf4755,_0x35f1fd,_0xf81f0f){var _0x323510=[_0x119e('0x2a'),_0x119e('0x2b'),'cm_contacts.id',_0x119e('0x2c'),_0x7f1e56+'.'+_0x35f1fd,_0x119e('0x2d'),_0x119e('0x2e'),'cm_contacts.priority',_0x119e('0x2f'),'\x22'+_0xf81f0f+'\x22'];return squel[_0x119e('0x30')]()[_0x119e('0x31')](_0x119e('0x32'))[_0x119e('0x33')](['phone','scheduledat',_0x119e('0x34'),_0x119e('0x35'),_0x35f1fd,_0x119e('0x36'),_0x119e('0x37'),_0x119e('0x38'),_0x119e('0x39'),_0x119e('0x3a')],squel['select']()['fields'](_0x323510)[_0x119e('0x11')](_0x7f1e56)['join']('cm_contacts',null,_0x119e('0x3b')+_0x7f1e56+'.CmListId')['join'](_0xf4755,null,_0xf4755+'.id\x20=\x20'+_0x7f1e56+'.'+_0x35f1fd)[_0x119e('0x14')](_0x7f1e56+_0x119e('0x3c'),_0x3af549)[_0x119e('0x14')](_0x119e('0x3d'),NOW)[_0x119e('0x14')](_0x119e('0x3e'),selectNotIn(_0x7f1e56,_0xf4755,_0x35f1fd,_0x119e('0x32'),[_0x119e('0x3f'),_0x119e('0x40')]))[_0x119e('0x14')](_0x119e('0x3e'),selectNotIn(_0x7f1e56,_0xf4755,_0x35f1fd,_0x119e('0x32'),[_0x119e('0x3f')])))[_0x119e('0x41')]();}function insertCmHopperBlack(_0x4f57f8,_0x442c05,_0x3fb1f0,_0x3a55b3){var _0x31e6e6=[_0x119e('0x2a'),_0x119e('0x42'),'cm_contacts.ListId',_0x442c05+'.'+_0x3a55b3,_0x119e('0x2d'),'cm_contacts.updatedAt'];return squel[_0x119e('0x30')]()[_0x119e('0x31')](_0x119e('0x43'))[_0x119e('0x33')]([_0x119e('0x10'),_0x119e('0x34'),_0x119e('0x35'),_0x3a55b3,'createdAt','updatedAt'],squel[_0x119e('0xf')]()[_0x119e('0x44')](_0x31e6e6)[_0x119e('0x11')](_0x442c05)[_0x119e('0x12')](_0x119e('0x45'),null,_0x119e('0x3b')+_0x442c05+_0x119e('0x46'))[_0x119e('0x12')](_0x3fb1f0,null,_0x3fb1f0+_0x119e('0x13')+_0x442c05+'.'+_0x3a55b3)[_0x119e('0x14')](_0x442c05+_0x119e('0x3c'),_0x4f57f8)[_0x119e('0x14')](_0x119e('0x3d'),NOW)[_0x119e('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x119e('0xf')]()[_0x119e('0x47')]('phone')[_0x119e('0x11')]('cm_hopper_black')[_0x119e('0x14')](_0x119e('0x48'),_0x4f57f8)[_0x119e('0x14')](_0x3a55b3+'\x20=\x20?',_0x442c05+'.'+_0x3a55b3)))[_0x119e('0x41')]();}function insertCmHopperAdditionalPhones(_0x1a15d8){var _0x50ea06=[_0x119e('0x49'),_0x119e('0x4a'),_0x119e('0x4b'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel['insert']()[_0x119e('0x31')](_0x119e('0x4c'))['fromQuery']([_0x119e('0x4d'),'phone',_0x119e('0x4e'),'createdAt',_0x119e('0x37')],squel[_0x119e('0xf')]()['fields'](_0x50ea06)['from'](_0x119e('0x32'))[_0x119e('0x12')](_0x119e('0x45'),null,_0x119e('0x4f'))[_0x119e('0x12')](_0x119e('0x50'),null,_0x119e('0x51'))['where']('cm_hopper.ListId\x20=\x20?',_0x1a15d8)['where'](_0x119e('0x3d'),NOW))[_0x119e('0x41')]();}function insertCmContact(_0x488154,_0x2d02b3,_0x400994,_0xd1b420){var _0x1a13fc=_['concat'](_[_0x119e('0x52')](_0xd1b420),['ListId',_0x119e('0x53'),_0x119e('0x36'),_0x119e('0x37')]);return squel[_0x119e('0x30')]()[_0x119e('0x31')]('cm_contacts')[_0x119e('0x33')](_0x1a13fc,squel[_0x119e('0xf')]()[_0x119e('0x44')](_0x1a13fc)[_0x119e('0x11')](_0x2d02b3)[_0x119e('0x14')]('('+_0x400994['join'](',')+_0x119e('0x54'),squel[_0x119e('0xf')]()[_0x119e('0x44')](_0x400994)[_0x119e('0x11')](_0x119e('0x45'))['where'](_0x119e('0x48'),_0x488154))[_0x119e('0x14')](_0x119e('0x55'),squel['select']()['field'](_0x119e('0x56'),_0x119e('0x57'))['from'](_0x2d02b3)[_0x119e('0x58')](_0x400994[_0x119e('0x12')](','))))[_0x119e('0x41')]();}function handleStop(){logger['info'](_0x119e('0x59'));stopped=!![];}function handleUncaughtException(_0xacb4bd){logger[_0x119e('0x5a')](_0xacb4bd[_0x119e('0x21')]);process[_0x119e('0x5b')](0x1);}function handleError(_0x3ecbb9,_0x4e1d55){stats[_0x119e('0x5c')]['push']({'name':_0x4e1d55[_0x119e('0x5d')],'message':_0x4e1d55['message'],'row':_0x3ecbb9});}function handleQuery(_0x870ecf){logger[_0x119e('0x5e')](_0x870ecf);return db[_0x119e('0x17')]['query'](_0x870ecf)['spread'](function(_0x1d891c){results[_0x119e('0x1d')](_0x1d891c);})[_0x119e('0x20')](function(_0x543062){logger[_0x119e('0x5a')](_0x543062[_0x119e('0x21')]);});}function main(_0x28866d,_0x1e851c,_0xe24f19,_0x2146bc){logger[_0x119e('0x5e')](_0x119e('0x5f'),_0x28866d,JSON[_0x119e('0x60')](_0x1e851c));process[_0x119e('0x61')](_0x119e('0x62'));var _0x13c0d8=_0x1e851c[_0x119e('0x63')];var _0x51bf9c=_[_0x119e('0x64')](_0x13c0d8);var _0x21ae76=_0x1e851c[_0x119e('0x65')];var _0x47f1ff=path[_0x119e('0x12')](config['root'],_0x119e('0x66'),_0x21ae76+_0x119e('0x67'));logger[_0x119e('0x5e')](_0x119e('0x68'),_0x1e851c);db[_0x119e('0x69')][_0x119e('0x6a')]({'raw':!![],'attributes':['id',_0x119e('0x6b')]})[_0x119e('0x1f')](function(_0x528302){for(var _0x142236=0x0;_0x142236<_0x528302['length'];_0x142236++){if(_0x528302[_0x142236][_0x119e('0x6b')]in _0x13c0d8){contactItemTypes['push'](_0x528302[_0x142236]);delete _0x51bf9c[_0x528302[_0x142236][_0x119e('0x6b')]];hasAdditionalPhones=!![];}for(var _0x3828bc in _0x13c0d8){if(_0x528302[_0x142236]['name']+_0x119e('0x6c')===_0x3828bc){phoneDescriptions[_0x119e('0x1d')]({'itemTypeId':_0x528302[_0x142236]['id'],'description':_0x3828bc});delete _0x51bf9c[_0x3828bc];}}}if(hasAdditionalPhones)_0x51bf9c['AdditionalPhones']='';var _0x5539f8=_['keys'](_0x51bf9c)[_0x119e('0x12')]();logger['info'](_0x119e('0x6d'),_0x5539f8);fs[_0x119e('0x6e')](_0x47f1ff,_0x5539f8+'\x0a');Papa[_0x119e('0x6f')](fs[_0x119e('0x70')](_0x28866d),{'header':!![],'skipEmptyLines':!![],'step':function(_0x38452e,_0x8b1998){try{for(var _0x574e5=0x0,_0x1e453f=[];_0x574e5<_0x38452e[_0x119e('0x71')]['length'];_0x574e5++){stats[_0x119e('0x72')]+=0x1;if(_0x38452e[_0x119e('0x5c')][_0x574e5]){handleError(_0x38452e[_0x119e('0x71')][_0x574e5],_0x38452e['errors'][_0x574e5]);}else{var _0x590599=[];var _0x5eb194=[];var _0x42a412={};for(var _0x17f423 in _0x13c0d8){let _0x3dd9a2=contactItemTypes[_0x119e('0x73')](_0x2b66e3=>_0x2b66e3[_0x119e('0x6b')]===_0x17f423);let _0x13c63c=contactItemTypes['find'](_0x235ffc=>_0x235ffc[_0x119e('0x6b')]+_0x119e('0x6c')===_0x17f423);if(_[_0x119e('0x1b')](_0x3dd9a2)&&_[_0x119e('0x1b')](_0x13c63c)){if(_0x13c0d8[_0x119e('0x74')](_0x17f423)){if(_0x38452e[_0x119e('0x71')][_0x574e5][_0x13c0d8[_0x17f423]]){var _0x3abc01=_[_0x119e('0x75')](_0x38452e['data'][_0x574e5][_0x13c0d8[_0x17f423]][_0x119e('0x76')](/"/g,'\x27'));switch(_0x17f423){case _0x119e('0x77'):var _0xb67e5e=moment(_0x3abc01,_0x119e('0xb'),!![]);if(_0xb67e5e[_0x119e('0x78')]()){_0x1e453f[_0x119e('0x1d')]('\x22'+_0x3abc01+'\x22');}else{_0x590599[_0x119e('0x1d')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x59a772=parseInt(_0x3abc01);_0x3abc01=_[_0x119e('0x79')](_0x59a772)||_0x59a772<0x0||_0x59a772>0x4?_0x2146bc?0x3:0x2:_0x59a772;_0x1e453f['push']('\x22'+_0x3abc01+'\x22');break;case'UserId':var _0x35f22f=parseInt(_0x3abc01);if(_[_0x119e('0x7a')](_0x35f22f)&&_['includes'](_0xe24f19,_0x35f22f)){_0x1e453f[_0x119e('0x1d')]('\x22'+_0x35f22f+'\x22');}else{_0x590599[_0x119e('0x1d')](_0x119e('0x7b'));}break;case _0x119e('0x7c'):if(isEmail(_0x3abc01)){_0x1e453f[_0x119e('0x1d')]('\x22'+_0x3abc01+'\x22');}else{_0x590599[_0x119e('0x1d')](_0x119e('0x7d'));}break;case _0x119e('0x7e'):var _0x2c9157=moment(_0x3abc01,'YYYY-MM-DD',!![]);if(_0x2c9157[_0x119e('0x78')]()){_0x1e453f[_0x119e('0x1d')]('\x22'+_0x3abc01+'\x22');}else{_0x590599[_0x119e('0x1d')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x1e453f[_0x119e('0x1d')]('\x22'+_0x3abc01+'\x22');}}else{switch(_0x17f423){case _0x119e('0x7f'):case _0x119e('0x10'):_0x590599['push'](_0x17f423+_0x119e('0x80'));break;default:_0x1e453f[_0x119e('0x1d')]('\x22\x22');}}}}else{var _0x1bc648='';if(!_[_0x119e('0x1b')](_0x3dd9a2)){if(!_0x42a412[_0x119e('0x74')](_0x3dd9a2['id'])){for(var _0x274146=0x0;_0x274146<_0x13c0d8[_0x17f423][_0x119e('0x23')];_0x274146++){var _0x3abc01=_[_0x119e('0x75')](_0x38452e[_0x119e('0x71')][_0x574e5][_0x13c0d8[_0x17f423][_0x274146]]['replace'](/"/g,'\x27'));var _0x16772c=phoneDescriptions[_0x119e('0x73')](_0x496402=>_0x496402['itemTypeId']===_0x3dd9a2['id']);if(!_['isNil'](_0x16772c)){var _0x52f67f=_['trim'](_0x38452e[_0x119e('0x71')][_0x574e5][_0x13c0d8[_0x16772c[_0x119e('0x81')]][0x0]][_0x119e('0x76')](/"/g,'\x27'));if(!_[_0x119e('0x1b')](_0x52f67f))_0x3abc01=_0x3abc01+'§'+_0x52f67f;}if(_0x1bc648=='')_0x1bc648=_0x3abc01;else _0x1bc648+='|'+_0x3abc01;}_0x5eb194[_0x119e('0x1d')](_0x3dd9a2['id']+':'+_0x1bc648);_0x42a412[_0x3dd9a2['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1e453f[_0x119e('0x1d')]('\x22'+_0x5eb194[_0x119e('0x12')](';')+'\x22');}if(_0x590599['length']){handleError(_0x38452e['data'][_0x574e5],{'code':_0x119e('0x82'),'message':_0x590599[_0x119e('0x12')]()});}else{fs[_0x119e('0x83')](_0x47f1ff,_0x1e453f['join']()+'\x0a');}_0x1e453f=[];}if(!(stats['rows']%0xc8)){socket['emit'](_0x119e('0x84')+_0x21ae76,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x119e('0x85'));_0x8b1998[_0x119e('0x86')]();}}catch(_0x13550b){handleError(_0x38452e[_0x119e('0x71')][_0x574e5],{'code':'SystemError','message':_0x13550b[_0x119e('0x21')]});logger[_0x119e('0x5a')](_0x119e('0x87'),_0x13550b[_0x119e('0x21')]);}},'complete':function(){try{var _0x5b5975=[];var _0x2bee23=tempTableName;_0x5b5975[_0x119e('0x1d')](_0x119e('0x88')+_0x2bee23+_0x119e('0x89'));logger[_0x119e('0x5e')]('CIS\x20len',contactItemTypes[_0x119e('0x23')]);var _0x5aedff=util['format'](_0x119e('0x8a'),_0x47f1ff,_0x2bee23,_0x5539f8,_0x1e851c[_0x119e('0x35')],_0x1e851c['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x13c0d8[_0x119e('0x77')])){_0x5aedff+=_0x119e('0x8b');}_0x5b5975[_0x119e('0x1d')](_0x5aedff);BPromise[_0x119e('0x8c')](_0x5b5975,handleQuery)[_0x119e('0x1f')](function(_0x307902){BPromise[_0x119e('0x1e')]([handleAdditionalPhones()])[_0x119e('0x1f')](function(){_0x5b5975=[];for(var _0x54eb43=0x0;_0x54eb43\x20\x20','root','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','No\x20agent\x20available','path','lodash','papaparse','util','moment','squel','../../../mysqldb','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','format','test','field','phone','from','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','join','sequelize','query','push','all','then','catch','error','isNil','length','split','filter','CmContactHasItem','updated','PHONE','CmContact','update','CmHopper','cm_contacts.phone','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','into','fromQuery','scheduledat','createdAt','priority','recallme','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','insert','cm_hopper_black','ContactId','.CmListId','cm_contacts.createdAt\x20=\x20?','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','cm_hopper_additional_phones'];(function(_0x5805d7,_0x3d584a){var _0x170fe4=function(_0x3b9b73){while(--_0x3b9b73){_0x5805d7['push'](_0x5805d7['shift']());}};_0x170fe4(++_0x3d584a);}(_0x21c9,0xea));var _0x921c=function(_0x1971d0,_0x4ad9d9){_0x1971d0=_0x1971d0-0x0;var _0x52f42c=_0x21c9[_0x1971d0];return _0x52f42c;};'use strict';var fs=require('fs');var path=require(_0x921c('0x0'));var _=require(_0x921c('0x1'));var Papa=require(_0x921c('0x2'));var util=require(_0x921c('0x3'));var BPromise=require('bluebird');var moment=require(_0x921c('0x4'));var squel=require(_0x921c('0x5'));var Redis=require('ioredis');var db=require(_0x921c('0x6'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x921c('0x7'));config[_0x921c('0x8')]=_[_0x921c('0x9')](config[_0x921c('0x8')],{'host':_0x921c('0xa'),'port':0x18eb});var socket=require(_0x921c('0xb'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0x921c('0xc'));var tempTableName='cm_contacts_temp_'+moment()[_0x921c('0xd')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0xbdf09e){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))*$/[_0x921c('0xe')](_0xbdf09e);}function selectNotIn(_0x4aeafa,_0x17e372,_0x29db4d,_0x55da04,_0x36c2b1){return squel['select']()[_0x921c('0xf')](_0x921c('0x10'))[_0x921c('0x11')](_0x55da04)['join'](_0x17e372,null,_0x17e372+'.id\x20=\x20'+_0x55da04+'.'+_0x29db4d)['where'](_0x55da04+'.'+_0x29db4d+_0x921c('0x12')+_0x4aeafa+'.'+_0x29db4d)[_0x921c('0x13')](_0x17e372+_0x921c('0x14')+_0x36c2b1[_0x921c('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x451317,_0x4be115){promisesAdditionalPhones=[];promisesContact=[];return db[_0x921c('0x16')][_0x921c('0x17')]('select\x20*\x20from\x20'+tempTableName)['spread'](function(_0x402ea4){if(_0x402ea4!==null){var _0x32c264=[];for(var _0x348bf7=0x0;_0x348bf7<_0x402ea4['length'];_0x348bf7++){var _0x21b689=_0x402ea4[_0x348bf7];if(!_['isNil'](_0x21b689[_0x921c('0x10')])){if(!_['isNil'](_0x21b689['AdditionalPhones']))_0x32c264[_0x921c('0x18')](insertAdditionalPhones(_0x21b689));promisesContact[_0x921c('0x18')]({'contact':_0x21b689});}}}Promise[_0x921c('0x19')](_0x32c264)[_0x921c('0x1a')](function(){_0x451317({'val':0x1});});})[_0x921c('0x1b')](function(_0x44effc){logger[_0x921c('0x1c')](_0x44effc['message']);});});}function insertAdditionalPhones(_0x31acde){return new Promise(function(_0x4dd1ff,_0x3c2796){var _0x5304b2=_0x31acde['AdditionalPhones'];if(_[_0x921c('0x1d')](_0x5304b2))_0x3c2796({'val':0x0});else{var _0x1d0123=_0x5304b2['split'](';');var _0x42c1e2=[];orderBy=0x0;for(var _0x2890f3=0x0;_0x2890f3<_0x1d0123[_0x921c('0x1e')];_0x2890f3++){_0x42c1e2['push'](splitAdditionalPhone(_0x31acde['id'],_0x1d0123[_0x2890f3]));}Promise[_0x921c('0x19')](_0x42c1e2)[_0x921c('0x1a')](function(){_0x4dd1ff({'val':_0x1d0123[_0x921c('0x1e')]});});}});}function splitAdditionalPhone(_0x815b9b,_0x5e47b6){return new Promise(function(_0x55a32e,_0x22cd7a){var _0x56cf0a=_0x5e47b6[_0x921c('0x1f')](':');var _0x2a3faf=_0x56cf0a[0x0];var _0x491f9c=_0x56cf0a[0x1];if(_0x491f9c!==''){var _0x5f23ee=_0x491f9c[_0x921c('0x1f')]('|');var _0x50d2ce=[];for(var _0x5d4760=0x0;_0x5d4760<_0x5f23ee[_0x921c('0x1e')];_0x5d4760++){if(_0x5f23ee[_0x5d4760]!==''){var _0x498ebb=_[_0x921c('0x20')](promisesAdditionalPhones,{'contactId':_0x815b9b,'phone':_0x5f23ee[_0x5d4760]});if(_0x498ebb[_0x921c('0x1e')]==0x0){orderBy++;promisesAdditionalPhones[_0x921c('0x18')]({'contactId':_0x815b9b,'contactTypeId':_0x2a3faf,'phone':_0x5f23ee[_0x5d4760],'orderBy':orderBy});}}}_0x55a32e({'ok':0x1});}else _0x55a32e({'res':0x0});});}function createAdditionalPhone(_0x6aa9a0,_0x5f5dba,_0x1508d9,_0x3017c5){var _0x46cc65='';var _0x1b3409='';var _0x45d93e=_0x1508d9[_0x921c('0x1f')]('§');_0x46cc65=_0x45d93e[0x0];if(_0x45d93e[_0x921c('0x1e')]==0x2)_0x1b3409=_0x45d93e[0x1];return new Promise(function(_0x36bbf5,_0x7de247){return db[_0x921c('0x21')]['findOne']({'where':{'CmContactId':_0x6aa9a0,'item':_0x46cc65}})['then'](function(_0x49b4a8){if(_0x49b4a8){return db[_0x921c('0x21')]['update']({'ItemTypeId':_0x5f5dba,'description':_0x1b3409,'OrderBy':_0x3017c5},{'where':{'CmContactId':_0x6aa9a0,'item':_0x46cc65}})[_0x921c('0x1a')](function(_0x44dc5e){_0x36bbf5({'res':_0x921c('0x22')});});}else{return db[_0x921c('0x21')]['create']({'CmContactId':_0x6aa9a0,'item':_0x46cc65,'ItemTypeId':_0x5f5dba,'description':_0x1b3409,'OrderBy':_0x3017c5,'ItemClass':_0x921c('0x23')})[_0x921c('0x1a')](function(_0x5e6b9b){_0x36bbf5({'res':'inserted'});});}});});}function updateContact(_0x3c250a){return new Promise(function(_0x332d80,_0x11936e){var _0x168a9f=_0x3c250a['id'];delete _0x3c250a['id'];return db[_0x921c('0x24')][_0x921c('0x25')](_0x3c250a,{'where':{'id':_0x168a9f}})['then'](function(_0x4a9b00){updatedRows+=0x1;return db[_0x921c('0x26')]['update']({'phone':_0x3c250a[_0x921c('0x10')]},{'where':{'ContactId':_0x168a9f}})['then'](function(_0x8e7419){_0x332d80({'ret':'OK'});});});});}function insertCmHopper(_0x4290dc,_0x2f6f93,_0x368ef1,_0x1912de,_0xad7326){var _0x4afca7=[_0x921c('0x27'),'cm_contacts.scheduledat','cm_contacts.id',_0x921c('0x28'),_0x2f6f93+'.'+_0x1912de,_0x921c('0x29'),_0x921c('0x2a'),_0x921c('0x2b'),'cm_contacts.UserId','\x22'+_0xad7326+'\x22'];return squel['insert']()[_0x921c('0x2c')]('cm_hopper')[_0x921c('0x2d')](['phone',_0x921c('0x2e'),'ContactId','ListId',_0x1912de,_0x921c('0x2f'),'updatedAt',_0x921c('0x30'),'UserId',_0x921c('0x31')],squel[_0x921c('0x32')]()[_0x921c('0x33')](_0x4afca7)['from'](_0x2f6f93)['join'](_0x921c('0x34'),null,_0x921c('0x35')+_0x2f6f93+'.CmListId')[_0x921c('0x15')](_0x368ef1,null,_0x368ef1+_0x921c('0x36')+_0x2f6f93+'.'+_0x1912de)[_0x921c('0x13')](_0x2f6f93+_0x921c('0x37'),_0x4290dc)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x921c('0x13')](_0x921c('0x38'),selectNotIn(_0x2f6f93,_0x368ef1,_0x1912de,'cm_hopper',[_0x921c('0x39'),_0x921c('0x3a')]))[_0x921c('0x13')](_0x921c('0x38'),selectNotIn(_0x2f6f93,_0x368ef1,_0x1912de,'cm_hopper',['\x22always\x22'])))[_0x921c('0x3b')]();}function insertCmHopperBlack(_0x40116f,_0x4627c1,_0x524334,_0x3aa17c){var _0x5ddbcf=[_0x921c('0x27'),_0x921c('0x3c'),_0x921c('0x28'),_0x4627c1+'.'+_0x3aa17c,_0x921c('0x29'),'cm_contacts.updatedAt'];return squel[_0x921c('0x3d')]()[_0x921c('0x2c')](_0x921c('0x3e'))['fromQuery']([_0x921c('0x10'),_0x921c('0x3f'),'ListId',_0x3aa17c,_0x921c('0x2f'),'updatedAt'],squel[_0x921c('0x32')]()[_0x921c('0x33')](_0x5ddbcf)[_0x921c('0x11')](_0x4627c1)[_0x921c('0x15')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x4627c1+_0x921c('0x40'))['join'](_0x524334,null,_0x524334+'.id\x20=\x20'+_0x4627c1+'.'+_0x3aa17c)['where'](_0x4627c1+_0x921c('0x37'),_0x40116f)[_0x921c('0x13')](_0x921c('0x41'),NOW)[_0x921c('0x13')](_0x921c('0x38'),squel[_0x921c('0x32')]()[_0x921c('0xf')]('phone')[_0x921c('0x11')](_0x921c('0x3e'))[_0x921c('0x13')](_0x921c('0x42'),_0x40116f)[_0x921c('0x13')](_0x3aa17c+_0x921c('0x43'),_0x4627c1+'.'+_0x3aa17c)))[_0x921c('0x3b')]();}function insertCmHopperAdditionalPhones(_0x1c6327){var _0x4ce8d7=[_0x921c('0x44'),_0x921c('0x45'),_0x921c('0x46'),_0x921c('0x47'),_0x921c('0x48')];return squel[_0x921c('0x3d')]()[_0x921c('0x2c')](_0x921c('0x49'))[_0x921c('0x2d')]([_0x921c('0x4a'),_0x921c('0x10'),_0x921c('0x4b'),_0x921c('0x2f'),'updatedAt'],squel[_0x921c('0x32')]()[_0x921c('0x33')](_0x4ce8d7)['from'](_0x921c('0x4c'))[_0x921c('0x15')](_0x921c('0x34'),null,_0x921c('0x4d'))['join'](_0x921c('0x4e'),null,_0x921c('0x4f'))[_0x921c('0x13')](_0x921c('0x50'),_0x1c6327)[_0x921c('0x13')](_0x921c('0x41'),NOW))[_0x921c('0x3b')]();}function insertCmContact(_0x47eb34,_0x19d029,_0x480b93,_0x541a5d){var _0x2cfce4=_[_0x921c('0x51')](_[_0x921c('0x52')](_0x541a5d),[_0x921c('0x53'),_0x921c('0x54'),'createdAt','updatedAt']);return squel['insert']()[_0x921c('0x2c')](_0x921c('0x34'))[_0x921c('0x2d')](_0x2cfce4,squel[_0x921c('0x32')]()[_0x921c('0x33')](_0x2cfce4)['from'](_0x19d029)[_0x921c('0x13')]('('+_0x480b93[_0x921c('0x15')](',')+_0x921c('0x55'),squel['select']()['fields'](_0x480b93)[_0x921c('0x11')](_0x921c('0x34'))[_0x921c('0x13')]('ListId\x20=\x20?',_0x47eb34))[_0x921c('0x13')]('id\x20IN\x20?',squel[_0x921c('0x32')]()[_0x921c('0xf')](_0x921c('0x56'),_0x921c('0x57'))[_0x921c('0x11')](_0x19d029)[_0x921c('0x58')](_0x480b93['join'](','))))['toString']();}function handleStop(){logger[_0x921c('0x59')](_0x921c('0x5a'));stopped=!![];}function handleUncaughtException(_0x1eed23){logger[_0x921c('0x1c')](_0x1eed23[_0x921c('0x5b')]);process[_0x921c('0x5c')](0x1);}function handleError(_0x4c505d,_0x3cf987){stats[_0x921c('0x5d')]['push']({'name':_0x3cf987['code'],'message':_0x3cf987['message'],'row':_0x4c505d});}function handleQuery(_0x4121fa){logger[_0x921c('0x59')](_0x4121fa);return db['sequelize']['query'](_0x4121fa)[_0x921c('0x5e')](function(_0xcfd81e){results[_0x921c('0x18')](_0xcfd81e);})['catch'](function(_0x4328da){logger[_0x921c('0x1c')](_0x4328da[_0x921c('0x5b')]);});}function main(_0x2b0009,_0x2a1655,_0x309782,_0x3848bc){logger['info']('main',_0x2b0009,JSON[_0x921c('0x5f')](_0x2a1655));process['send']('start');var _0x2d2122=_0x2a1655[_0x921c('0x60')];var _0x1babf7=_[_0x921c('0x61')](_0x2d2122);var _0x28f26e=_0x2a1655[_0x921c('0x62')];var _0x1ad30e=path[_0x921c('0x15')](config['root'],_0x921c('0x63'),_0x28f26e+_0x921c('0x64'));logger[_0x921c('0x59')](_0x921c('0x65'),_0x2a1655);db[_0x921c('0x66')][_0x921c('0x67')]({'raw':!![],'attributes':['id',_0x921c('0x68')]})[_0x921c('0x1a')](function(_0x44a403){for(var _0x4cd7ec=0x0;_0x4cd7ec<_0x44a403[_0x921c('0x1e')];_0x4cd7ec++){if(_0x44a403[_0x4cd7ec]['name']in _0x2d2122){contactItemTypes[_0x921c('0x18')](_0x44a403[_0x4cd7ec]);delete _0x1babf7[_0x44a403[_0x4cd7ec][_0x921c('0x68')]];hasAdditionalPhones=!![];}for(var _0x531a1c in _0x2d2122){if(_0x44a403[_0x4cd7ec][_0x921c('0x68')]+'_description'===_0x531a1c){phoneDescriptions[_0x921c('0x18')]({'itemTypeId':_0x44a403[_0x4cd7ec]['id'],'description':_0x531a1c});delete _0x1babf7[_0x531a1c];}}}if(hasAdditionalPhones)_0x1babf7['AdditionalPhones']='';var _0x4453b8=_[_0x921c('0x52')](_0x1babf7)[_0x921c('0x15')]();logger[_0x921c('0x59')](_0x921c('0x69'),_0x4453b8);fs[_0x921c('0x6a')](_0x1ad30e,_0x4453b8+'\x0a');Papa[_0x921c('0x6b')](fs[_0x921c('0x6c')](_0x2b0009),{'header':!![],'skipEmptyLines':!![],'step':function(_0x12dbaf,_0x4f5397){try{for(var _0x48d2b2=0x0,_0x3dd648=[];_0x48d2b2<_0x12dbaf[_0x921c('0x6d')][_0x921c('0x1e')];_0x48d2b2++){stats[_0x921c('0x6e')]+=0x1;if(_0x12dbaf[_0x921c('0x5d')][_0x48d2b2]){handleError(_0x12dbaf[_0x921c('0x6d')][_0x48d2b2],_0x12dbaf[_0x921c('0x5d')][_0x48d2b2]);}else{var _0x36f715=[];var _0x125621=[];var _0x45edbe={};for(var _0x199522 in _0x2d2122){let _0x34e0c2=contactItemTypes[_0x921c('0x6f')](_0x3ac790=>_0x3ac790['name']===_0x199522);let _0x5d9aa4=contactItemTypes[_0x921c('0x6f')](_0x14e7d2=>_0x14e7d2['name']+_0x921c('0x70')===_0x199522);if(_['isNil'](_0x34e0c2)&&_[_0x921c('0x1d')](_0x5d9aa4)){if(_0x2d2122['hasOwnProperty'](_0x199522)){if(_0x12dbaf[_0x921c('0x6d')][_0x48d2b2][_0x2d2122[_0x199522]]){var _0x42919a=_[_0x921c('0x71')](_0x12dbaf[_0x921c('0x6d')][_0x48d2b2][_0x2d2122[_0x199522]]['replace'](/"/g,'\x27'));switch(_0x199522){case _0x921c('0x2e'):var _0x3813e5=moment(_0x42919a,_0x921c('0xc'),!![]);if(_0x3813e5[_0x921c('0x72')]()){_0x3dd648['push']('\x22'+_0x42919a+'\x22');}else{_0x36f715[_0x921c('0x18')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x921c('0x30'):var _0x5c68cf=parseInt(_0x42919a);_0x42919a=_[_0x921c('0x73')](_0x5c68cf)||_0x5c68cf<0x0||_0x5c68cf>0x4?_0x3848bc?0x3:0x2:_0x5c68cf;_0x3dd648['push']('\x22'+_0x42919a+'\x22');break;case _0x921c('0x74'):var _0x199d50=parseInt(_0x42919a);if(_[_0x921c('0x75')](_0x199d50)&&_[_0x921c('0x76')](_0x309782,_0x199d50)){_0x3dd648[_0x921c('0x18')]('\x22'+_0x199d50+'\x22');}else{_0x36f715[_0x921c('0x18')](_0x921c('0x77'));}break;case _0x921c('0x78'):if(isEmail(_0x42919a)){_0x3dd648[_0x921c('0x18')]('\x22'+_0x42919a+'\x22');}else{_0x36f715[_0x921c('0x18')](_0x921c('0x79'));}break;case'dateOfBirth':var _0x2e1b65=moment(_0x42919a,'YYYY-MM-DD',!![]);if(_0x2e1b65['isValid']()){_0x3dd648[_0x921c('0x18')]('\x22'+_0x42919a+'\x22');}else{_0x36f715[_0x921c('0x18')](_0x921c('0x7a'));}break;default:_0x3dd648[_0x921c('0x18')]('\x22'+_0x42919a+'\x22');}}else{switch(_0x199522){case'firstName':case _0x921c('0x10'):_0x36f715[_0x921c('0x18')](_0x199522+_0x921c('0x7b'));break;default:_0x3dd648['push']('\x22\x22');}}}}else{var _0x5a300b='';if(!_[_0x921c('0x1d')](_0x34e0c2)){if(!_0x45edbe[_0x921c('0x7c')](_0x34e0c2['id'])){for(var _0x355742=0x0;_0x355742<_0x2d2122[_0x199522][_0x921c('0x1e')];_0x355742++){var _0x42919a=_[_0x921c('0x71')](_0x12dbaf['data'][_0x48d2b2][_0x2d2122[_0x199522][_0x355742]]['replace'](/"/g,'\x27'));var _0x254626=phoneDescriptions[_0x921c('0x6f')](_0x4ef417=>_0x4ef417['itemTypeId']===_0x34e0c2['id']);if(!_['isNil'](_0x254626)){var _0x32d63f=_[_0x921c('0x71')](_0x12dbaf[_0x921c('0x6d')][_0x48d2b2][_0x2d2122[_0x254626[_0x921c('0x7d')]][0x0]][_0x921c('0x7e')](/"/g,'\x27'));if(!_[_0x921c('0x1d')](_0x32d63f))_0x42919a=_0x42919a+'§'+_0x32d63f;}if(_0x5a300b=='')_0x5a300b=_0x42919a;else _0x5a300b+='|'+_0x42919a;}_0x125621[_0x921c('0x18')](_0x34e0c2['id']+':'+_0x5a300b);_0x45edbe[_0x34e0c2['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3dd648[_0x921c('0x18')]('\x22'+_0x125621[_0x921c('0x15')](';')+'\x22');}if(_0x36f715[_0x921c('0x1e')]){handleError(_0x12dbaf[_0x921c('0x6d')][_0x48d2b2],{'code':_0x921c('0x7f'),'message':_0x36f715[_0x921c('0x15')]()});}else{fs[_0x921c('0x80')](_0x1ad30e,_0x3dd648[_0x921c('0x15')]()+'\x0a');}_0x3dd648=[];}if(!(stats[_0x921c('0x6e')]%0xc8)){socket[_0x921c('0x81')]('contact:import:'+_0x28f26e,stats);stats[_0x921c('0x5d')]=[];}}if(stopped){logger['info'](_0x921c('0x82'));_0x4f5397[_0x921c('0x83')]();}}catch(_0x41d98b){handleError(_0x12dbaf[_0x921c('0x6d')][_0x48d2b2],{'code':_0x921c('0x84'),'message':_0x41d98b[_0x921c('0x5b')]});logger[_0x921c('0x1c')]('step',_0x41d98b[_0x921c('0x5b')]);}},'complete':function(){try{var _0x430588=[];var _0x458172=tempTableName;_0x430588['push'](_0x921c('0x85')+_0x458172+_0x921c('0x86'));logger[_0x921c('0x59')](_0x921c('0x87'),contactItemTypes[_0x921c('0x1e')]);var _0x2f2c93=util[_0x921c('0xd')](_0x921c('0x88'),_0x1ad30e,_0x458172,_0x4453b8,_0x2a1655[_0x921c('0x53')],_0x2a1655[_0x921c('0x54')]||null,NOW,NOW);if(_['isNil'](_0x2d2122[_0x921c('0x2e')])){_0x2f2c93+=_0x921c('0x89');}_0x430588['push'](_0x2f2c93);BPromise[_0x921c('0x8a')](_0x430588,handleQuery)[_0x921c('0x1a')](function(_0x35fe88){BPromise[_0x921c('0x19')]([handleAdditionalPhones()])['then'](function(){_0x430588=[];for(var _0xb5e7d8=0x0;_0xb5e7d8\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.lastMsgAt','i.lastMsgDirection','i.subject','i.thirdDisposition','i.to','i.ContactId','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','Contact.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','sequelize','groupBy','Setting','findOne','enableEmailPreview','clone','COUNT(*)','t.id\x20IN\x20?','squel','../parsers/qs','./update-interaction','./utils','role','agent','select','name','field','color','from','tools_tags','_interactions','u.id','u.fullname','ui.','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','getInteractionFK','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','escapeLIKESpecialChars','isNumeric','whatsapp','includes','i.phone\x20LIKE\x20?'];(function(_0x543f9f,_0x563bf5){var _0x23e5d3=function(_0x5cd0e0){while(--_0x5cd0e0){_0x543f9f['push'](_0x543f9f['shift']());}};_0x23e5d3(++_0x563bf5);}(_0x5816,0x6f));var _0x6581=function(_0x2e0e91,_0x393e3d){_0x2e0e91=_0x2e0e91-0x0;var _0x173430=_0x5816[_0x2e0e91];return _0x173430;};'use strict';var _=require('lodash');var squel=require(_0x6581('0x0'));var as=require('../parsers/advancedSearch');var qs=require(_0x6581('0x1'));var updateInteraction=require(_0x6581('0x2'))['updateInteraction'];var utils=require(_0x6581('0x3'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x3879ad,_0x2a9533,_0x38a101){var _0xcf03e6=![];var _0x228391=utils['getAccountFK'](_0x3879ad);if(_0x2a9533[_0x6581('0x4')]===_0x6581('0x5')&&!_0x38a101['search']&&!_0x38a101[_0x228391]){_0xcf03e6=!![];}return _0xcf03e6;}function getTagsQuery(){return squel[_0x6581('0x6')]()['field']('id')['field'](_0x6581('0x7'))[_0x6581('0x8')](_0x6581('0x9'))[_0x6581('0xa')](_0x6581('0xb'));}function getUsersQuery(_0x4d4602,_0x15a0b2){var _0x10db5c=utils['getInteractionFK'](_0x4d4602);var _0x2e99d8='user_has_'+_0x4d4602+_0x6581('0xc');var _0x3b954c=squel[_0x6581('0x6')]()[_0x6581('0x8')](_0x6581('0xd'))[_0x6581('0x8')](_0x6581('0xe'))['field'](_0x6581('0xf')+_0x10db5c)[_0x6581('0xa')](_0x2e99d8,'ui')['left_join'](_0x6581('0x10'),'u',_0x6581('0x11'));if(_0x15a0b2[_0x6581('0x12')]>0x0){_0x3b954c[_0x6581('0x13')](_0x6581('0xf')+_0x10db5c+_0x6581('0x14'),_[_0x6581('0x15')](_0x15a0b2,'id'));}return _0x3b954c;}function getInteractionsQuery(_0x2d7bf2){var _0x3adddf=utils[_0x6581('0x16')](_0x2d7bf2);var _0x20b7c4=utils['getAccountFK'](_0x2d7bf2);var _0x56f9e0=utils[_0x6581('0x17')](_0x2d7bf2);return squel[_0x6581('0x6')]()['from'](_0x3adddf['interactions'],'i')[_0x6581('0x18')](_0x6581('0x19'),'c',_0x6581('0x1a'))['left_join']('users','o',_0x6581('0x1b'))[_0x6581('0x18')](_0x3adddf[_0x6581('0x1c')],'a',_0x6581('0x1d')+_0x20b7c4)[_0x6581('0x18')](_0x3adddf['messages'],'me','me.'+_0x56f9e0+'\x20=\x20i.id')['left_join'](_0x3adddf['interactionsTags'],'it',_0x6581('0x1e')+_0x56f9e0+'\x20=\x20i.id')[_0x6581('0x18')](_0x6581('0xb'),'t',_0x6581('0x1f'));}function getSqlClauses(){var _0x4fb8e2={'body':squel[_0x6581('0x20')](),'contact':squel['expr'](),'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0x6581('0x20')](),'read':squel['expr'](),'tags':{'clause':squel[_0x6581('0x20')](),'ids':null},'user':squel[_0x6581('0x20')]()};return _0x4fb8e2;}function parseTagParameter(_0x16b2f2){var _0x5f4c01=squel[_0x6581('0x20')]();if(_0x16b2f2){var _0x5155a4=utils[_0x6581('0x21')](_0x16b2f2);_0x5155a4['forEach'](function(_0x267efe){_0x5f4c01['or'](_0x6581('0x22'),'%,'+_0x267efe+',%');});}return _0x5f4c01;}function parseReadParameter(_0x268d02){var _0x1719ab='';if(_0x268d02){_0x1719ab=_0x6581('0x23');if(_0x268d02==='1'){_0x1719ab=_0x1719ab[_0x6581('0x24')](_0x6581('0x25'),'=');}else{_0x1719ab=_0x1719ab[_0x6581('0x24')](_0x6581('0x25'),'>');}}return _0x1719ab;}function parseSearchFilter(_0x38fc4e,_0x1367e2){var _0x326e73=squel[_0x6581('0x20')]();if(_0x1367e2){var _0x297d1a=_0x1367e2[_0x6581('0x24')]('\x5c','\x5c\x5c')[_0x6581('0x24')](/'/g,'\x27\x27');var _0x3ecf0f=qs[_0x6581('0x26')](_0x297d1a);if(qs[_0x6581('0x27')](_0x297d1a)){_0x326e73['or']('i.id\x20LIKE\x20?',_0x3ecf0f+'%');if(['sms',_0x6581('0x28')][_0x6581('0x29')](_0x38fc4e)){_0x326e73['or'](_0x6581('0x2a'),_0x3ecf0f+'%');}else if(_0x38fc4e===_0x6581('0x2b')){_0x326e73['or'](_0x6581('0x2c'),_0x3ecf0f+'%');}else if(_0x38fc4e===_0x6581('0x2d')){_0x326e73['or']('i.from\x20LIKE\x20?',_0x3ecf0f+'%');}}else if(_0x38fc4e==='mail'&&qs[_0x6581('0x2e')](_0x297d1a)){_0x326e73['or']('c.email\x20LIKE\x20?',_0x3ecf0f+'%');}else{if(_0x38fc4e===_0x6581('0x2f')){_0x326e73['or'](_0x6581('0x30'),qs[_0x6581('0x31')](_0x297d1a,!![]))['or'](_0x6581('0x32'),qs[_0x6581('0x31')](_0x297d1a));}else if(_0x38fc4e!==_0x6581('0x2b')){_0x326e73['or'](_0x6581('0x33'),qs['getFullTextValue'](_0x297d1a));}_0x326e73['or'](_0x6581('0x34'),qs[_0x6581('0x31')](_0x297d1a,!![]),null);}}return _0x326e73;}function parseAdvancedSearchFilter(_0x1c8e39,_0x3635bd){var _0x2291d8=getSqlClauses();var _0x33f9f0=as[_0x6581('0x35')](_0x1c8e39);var _0x355f2f=_0x33f9f0[_0x6581('0x36')];for(var _0x2af9ed=0x0;_0x2af9ed<_0x33f9f0[_0x6581('0x37')][_0x6581('0x12')];_0x2af9ed++){var _0x5d62a8=_0x33f9f0[_0x6581('0x37')][_0x2af9ed];var _0x28d62a='i';var _0x16c2a0=_[_0x6581('0x38')](_0x3635bd,[_0x6581('0x7'),_0x5d62a8[_0x6581('0x8')]]);if(_0x16c2a0){var _0x5ecddf=as[_0x6581('0x39')](_0x28d62a,_0x16c2a0['type'],_0x5d62a8);_0x2291d8['default'][_0x355f2f](_0x5ecddf[_0x6581('0x3a')],_0x5ecddf[_0x6581('0x3b')][_0x6581('0x3c')],_0x5ecddf[_0x6581('0x3b')][_0x6581('0x3d')]);}else{switch(_0x5d62a8[_0x6581('0x8')]){case _0x6581('0x3e'):var _0x51c6a0=parseReadParameter(_0x5d62a8[_0x6581('0x3b')]);_0x2291d8[_0x6581('0x3f')][_0x6581('0x40')](_0x51c6a0);break;case'Contact':if(_0x5d62a8['operator']===_0x6581('0x41')){if(_0x5d62a8[_0x6581('0x3b')][_0x6581('0x42')]('\x20')[_0x6581('0x12')]>0x1){_0x2291d8[_0x6581('0x43')][_0x355f2f](_0x6581('0x34'),qs[_0x6581('0x31')](_0x5d62a8['value'],!![]),null);}else{var _0x4a2c53='%'+_0x5d62a8[_0x6581('0x3b')]+'%';_0x2291d8[_0x6581('0x43')][_0x355f2f](_0x6581('0x44'),_0x4a2c53,_0x4a2c53,_0x4a2c53);}}else{_0x16c2a0=_[_0x6581('0x38')](_0x3635bd,['name',_0x6581('0x45')]);_0x5d62a8[_0x6581('0x8')]=_0x6581('0x45');_0x5ecddf=as[_0x6581('0x39')](_0x28d62a,_0x16c2a0[_0x6581('0x46')],_0x5d62a8);_0x2291d8['contact'][_0x355f2f](_0x5ecddf[_0x6581('0x3a')],_0x5ecddf[_0x6581('0x3b')][_0x6581('0x3c')],_0x5ecddf[_0x6581('0x3b')][_0x6581('0x3d')]);}break;case _0x6581('0x47'):var _0x474eff=_0x5d62a8[_0x6581('0x3b')][_0x6581('0x42')](',')[_0x6581('0x15')](function(_0x4157d9){return Number(_0x4157d9);});var _0x53f7dd=parseTagParameter(_0x474eff);_0x2291d8[_0x6581('0x48')][_0x6581('0x49')][_0x6581('0x40')](_0x53f7dd);_0x2291d8[_0x6581('0x48')][_0x6581('0x4a')]=_0x474eff;break;case'User':if(_0x5d62a8[_0x6581('0x4b')]===_0x6581('0x41')){_0x2291d8[_0x6581('0x4c')][_0x355f2f]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','%'+_0x5d62a8[_0x6581('0x3b')]+'%',null);}else{_0x16c2a0=_[_0x6581('0x38')](_0x3635bd,['name',_0x6581('0x4d')]);_0x5d62a8['field']=_0x6581('0x4d');_0x5ecddf=as[_0x6581('0x39')](_0x28d62a,_0x16c2a0[_0x6581('0x46')],_0x5d62a8);_0x2291d8[_0x6581('0x4c')][_0x355f2f](_0x5ecddf[_0x6581('0x3a')],_0x5ecddf['value']['start'],_0x5ecddf[_0x6581('0x3b')]['end']);}break;case _0x6581('0x4e'):case _0x6581('0x4f'):_0x5ecddf=as[_0x6581('0x39')]('me',null,_0x5d62a8);_0x2291d8[_0x6581('0x4e')][_0x355f2f](_0x5ecddf['text'],_0x5ecddf[_0x6581('0x3b')][_0x6581('0x3c')],_0x5ecddf['value'][_0x6581('0x3d')]);break;}}}return _0x2291d8;}function parseModelFields(_0x20bcfc,_0x4c2d64,_0x35b5ec){var _0x7939f6=utils[_0x6581('0x50')](_0x20bcfc);var _0x1a1073=squel[_0x6581('0x20')]();var _0x51eddc=_(_0x4c2d64)['keys']()[_0x6581('0x15')](function(_0x1e3e1d){return _['some'](_0x35b5ec,[_0x6581('0x7'),_0x1e3e1d])?_0x1e3e1d:undefined;})[_0x6581('0x51')]()[_0x6581('0x3b')]();if(_0x51eddc[_0x6581('0x12')]>0x0){_0x51eddc[_0x6581('0x52')](function(_0x158db5){if(_0x158db5===_0x7939f6){_0x1a1073['and']('i.'+_0x7939f6+_0x6581('0x14'),[][_0x6581('0x53')](_0x4c2d64[_0x158db5]));}else if(_0x158db5===_0x6581('0x54')){var _0x4e3bcd=JSON[_0x6581('0x55')](_0x4c2d64[_0x158db5])[_0x6581('0x56')];var _0x217f2d=JSON['parse'](_0x4c2d64[_0x158db5])['$lte'];_0x1a1073[_0x6581('0x40')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4e3bcd,_0x217f2d);}else{if(_0x4c2d64[_0x158db5]==='null'){_0x1a1073['and']('i.'+_0x158db5+_0x6581('0x57'));}else{_0x1a1073[_0x6581('0x40')]('i.'+_0x158db5+_0x6581('0x58'),_0x4c2d64[_0x158db5]);}}});}return _0x1a1073;}function parseQueryParameters(_0x111141,_0x4d7246,_0x51a1e4){var _0x4f3a0b=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x111141,_0x4d7246,_0x51a1e4);})[_0x6581('0x59')](function(_0x45fae2){_0x4f3a0b[_0x6581('0x5a')][_0x6581('0x40')](_0x45fae2);return parseReadParameter(_0x4d7246[_0x6581('0x3f')]);})[_0x6581('0x59')](function(_0x2348f9){_0x4f3a0b['read']['and'](_0x2348f9);return parseTagParameter(_0x4d7246[_0x6581('0x5b')]);})[_0x6581('0x59')](function(_0x3e556f){_0x4f3a0b[_0x6581('0x48')][_0x6581('0x49')][_0x6581('0x40')](_0x3e556f);return parseSearchFilter(_0x111141,_0x4d7246[_0x6581('0x5c')]);})[_0x6581('0x59')](function(_0x153e91){_0x4f3a0b[_0x6581('0x5c')]=_0x153e91;return _0x4f3a0b;});}function checkAccountsRestrictions(_0x3e722c,_0x39b98e,_0x1163f3){var _0x5a055b=utils['getAccountFK'](_0x3e722c);var _0x268768='get'+_['capitalize'](_0x3e722c)+(_0x3e722c==='chat'?'Websites':_0x6581('0x5d'));var _0x2aa6cc=squel[_0x6581('0x20')]();return Promise[_0x6581('0x5e')]()['then'](function(){if(_0x1163f3['search']&&_0x39b98e['role']==='agent'){return _0x39b98e[_0x268768]({'attributes':['id'],'raw':!![]});}})[_0x6581('0x59')](function(_0x5e446b){if(_0x5e446b){if(_0x5e446b[_0x6581('0x12')]===0x0){_0x2aa6cc[_0x6581('0x40')]('i.'+_0x5a055b+_0x6581('0x57'));}else{_0x2aa6cc[_0x6581('0x40')]('i.'+_0x5a055b+_0x6581('0x14'),_[_0x6581('0x15')](_0x5e446b,'id'));}}else if(!_0x1163f3[_0x5a055b]){_0x2aa6cc[_0x6581('0x40')]('i.'+_0x5a055b+'\x20IS\x20NOT\x20NULL');}})['then'](function(){return _0x2aa6cc;});}function getClosedOrderClause(_0x546035,_0x1f86ad){var _0xf12e82='';var _0x25beae=['i.thirdDisposition',_0x6581('0x5f'),_0x6581('0x60')];if(_0x546035==='mail'){_0x25beae[_0x6581('0x61')](_0x6581('0x62'));}if(_0x1f86ad[_0x6581('0x63')]==='0'&&_0x546035===_0x6581('0x2f')){_0xf12e82=_0x6581('0x62');}else{if(_0x1f86ad[_0x6581('0x63')]==='1'){_0x25beae[_0x6581('0x64')]();}_0xf12e82=_0x6581('0x65')+_0x25beae['join'](',\x20')+')';}return _0xf12e82;}function getFilteredInteractions(_0x3ce0d0,_0x45c731,_0x3f6660,_0x4f3ab5){var _0x48cb19=utils[_0x6581('0x17')](_0x3ce0d0);var _0x24fb5d=_[_0x6581('0x66')](_0x3ce0d0)+'Interaction';var _0x297a0d=[];var _0x51c01d=getTagsQuery();var _0x552e25={'type':db[_0x6581('0x67')][_0x6581('0x68')][_0x6581('0x69')],'raw':!![]};var _0x5c8ec1=[];var _0x4d8399=[];return db['sequelize'][_0x6581('0x6a')](_0x51c01d[_0x6581('0x6b')](),_0x552e25)[_0x6581('0x59')](function(_0x1b9f89){_0x297a0d=_[_0x6581('0x6c')](_0x1b9f89,'id');_0x552e25=_[_0x6581('0x6d')](_0x552e25,{'model':db[_0x24fb5d],'mapToModel':!![],'nest':!![]});if(_0x3f6660[_0x6581('0x5a')]){_0x4f3ab5[_0x6581('0x6e')][_0x6581('0x52')](function(_0x4e07ff){_0x45c731[_0x6581('0x8')]('i.'+_0x4e07ff);});}else{_0x45c731[_0x6581('0x8')](_0x6581('0x6f'),_0x6581('0x3e'));_0x45c731['field'](_0x6581('0x70'),'Account.key');_0x45c731[_0x6581('0x8')](_0x6581('0x71'),_0x6581('0x72'));if(_0x3ce0d0===_0x6581('0x2f')){_0x45c731[_0x6581('0x8')](_0x6581('0x73'),_0x6581('0x74'));_0x45c731['field'](_0x6581('0x75'),_0x6581('0x76'));_0x45c731[_0x6581('0x8')](_0x6581('0x77'));_0x45c731[_0x6581('0x8')](_0x6581('0x78'));_0x45c731[_0x6581('0x8')](_0x6581('0x79'));_0x45c731[_0x6581('0x8')]('i.closed');_0x45c731[_0x6581('0x8')]('i.closedAt');_0x45c731[_0x6581('0x8')]('i.attach');_0x45c731['field'](_0x6581('0x7a'));_0x45c731[_0x6581('0x8')](_0x6581('0x7b'));_0x45c731[_0x6581('0x8')](_0x6581('0x7c'));_0x45c731[_0x6581('0x8')](_0x6581('0x60'));_0x45c731[_0x6581('0x8')](_0x6581('0x5f'));_0x45c731[_0x6581('0x8')](_0x6581('0x7d'));_0x45c731['field']('i.substatus');_0x45c731[_0x6581('0x8')](_0x6581('0x7e'));_0x45c731[_0x6581('0x8')](_0x6581('0x7f'));_0x45c731[_0x6581('0x8')]('i.MailAccountId');_0x45c731['field']('i.UserId');}else if(_0x3ce0d0===_0x6581('0x2d')){_0x45c731[_0x6581('0x8')](_0x6581('0x80'),_0x6581('0x76'));}else{_0x45c731['field'](_0x6581('0x81'),'contactName');}if(_0x3ce0d0!==_0x6581('0x2f')){_0x45c731['field']('i.*');}_0x45c731[_0x6581('0x8')](_0x6581('0x82'),_0x6581('0x83'));_0x45c731[_0x6581('0x8')](_0x6581('0x84'),_0x6581('0x85'));_0x45c731[_0x6581('0x8')]('c.email','Contact.email');_0x45c731[_0x6581('0x8')](_0x6581('0x86'),_0x6581('0x87'));_0x45c731[_0x6581('0x8')](_0x6581('0x88'),_0x6581('0x89'));_0x45c731[_0x6581('0x8')]('c.fax',_0x6581('0x8a'));_0x45c731[_0x6581('0x8')](_0x6581('0x8b'),_0x6581('0x8c'));_0x45c731['field'](_0x6581('0x8d'),_0x6581('0x8e'));_0x45c731[_0x6581('0x8')](_0x6581('0x8f'),'TagIds');}if(_0x4f3ab5[_0x6581('0x90')]){_0x45c731['limit'](_0x4f3ab5[_0x6581('0x90')]);}if(_0x4f3ab5['offset']){_0x45c731[_0x6581('0x91')](_0x4f3ab5['offset']);}return db[_0x6581('0x92')][_0x6581('0x6a')](_0x45c731[_0x6581('0x6b')](),_0x552e25);})['then'](function(_0x33c0de){_0x5c8ec1=_0x33c0de;var _0x3cb13a=getUsersQuery(_0x3ce0d0,_0x5c8ec1);return db[_0x6581('0x92')][_0x6581('0x6a')](_0x3cb13a['toString'](),_0x552e25);})[_0x6581('0x59')](function(_0x259aa7){_0x4d8399=_[_0x6581('0x93')](_0x259aa7,_0x48cb19);if(_0x3ce0d0==='mail'){return db[_0x6581('0x94')][_0x6581('0x95')]({'attributes':[_0x6581('0x96')],'raw':!![]});}})['then'](function(_0x345aaf){var _0x934714=_0x345aaf?_0x345aaf[_0x6581('0x96')]:undefined;var _0x337339=_0x5c8ec1[_0x6581('0x15')](function(_0x541f89){return updateInteraction(_0x541f89,_0x297a0d,_0x4d8399,_0x934714);});return Promise['all'](_0x337339);});}function countFilteredInteractions(_0x23c6dc,_0x59e9b4){var _0xeef4e6=_0x23c6dc[_0x6581('0x97')]();_0xeef4e6[_0x6581('0x8')](_0x6581('0x98'));_0xeef4e6[_0x6581('0x8')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x6581('0x3e'));var _0x2993f4=utils['getSelectedTags'](_0x59e9b4);if(!_['isEmpty'](_0x2993f4)){_0xeef4e6['where'](_0x6581('0x99'),_0x2993f4);}var _0x4a0416={'type':db[_0x6581('0x67')][_0x6581('0x68')][_0x6581('0x69')],'raw':!![]};return db[_0x6581('0x92')][_0x6581('0x6a')](_0xeef4e6[_0x6581('0x6b')](),_0x4a0416);}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 _0x4b15=['i.ContactId','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','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','sequelize','groupBy','findOne','enableEmailPreview','all','clone','isEmpty','t.id\x20IN\x20?','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','../../mysqldb','getAccountFK','agent','search','field','name','color','from','tools_tags','getInteractionFK','_interactions','select','u.id','u.fullname','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','where','map','getInteractionsTables','cm_contacts','o.id\x20=\x20i.UserId','accounts','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','openchannel','isEmail','mail','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','buildExpression','default','value','unreadMessages','read','and','Contact','operator','$substring','split','contact','find','ContactId','type','text','start','end','Tag','tags','clause','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId','body','plainBody','keys','\x20IN\x20?','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','tag','filter','get','capitalize','chat','Websites','Accounts','role','\x20IS\x20NOT\x20NULL','i.disposition','unshift','i.substatus','closed','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','SELECT','query','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.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.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.thirdDisposition','i.to'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x4b15,0x160));var _0x54b1=function(_0x428fef,_0x2becf0){_0x428fef=_0x428fef-0x0;var _0x1b5b0c=_0x4b15[_0x428fef];return _0x1b5b0c;};'use strict';var _=require(_0x54b1('0x0'));var squel=require(_0x54b1('0x1'));var as=require(_0x54b1('0x2'));var qs=require(_0x54b1('0x3'));var updateInteraction=require(_0x54b1('0x4'))[_0x54b1('0x5')];var utils=require('./utils');var db=require(_0x54b1('0x6'))['db'];function skipInteractionsQuery(_0x16a070,_0x328dff,_0x41f5cb){var _0x3ea640=![];var _0x5a97f6=utils[_0x54b1('0x7')](_0x16a070);if(_0x328dff['role']===_0x54b1('0x8')&&!_0x41f5cb[_0x54b1('0x9')]&&!_0x41f5cb[_0x5a97f6]){_0x3ea640=!![];}return _0x3ea640;}function getTagsQuery(){return squel['select']()[_0x54b1('0xa')]('id')['field'](_0x54b1('0xb'))['field'](_0x54b1('0xc'))[_0x54b1('0xd')](_0x54b1('0xe'));}function getUsersQuery(_0x701a0c,_0x5d2776){var _0x5d4f37=utils[_0x54b1('0xf')](_0x701a0c);var _0x2d9508='user_has_'+_0x701a0c+_0x54b1('0x10');var _0x297c9c=squel[_0x54b1('0x11')]()['field'](_0x54b1('0x12'))['field'](_0x54b1('0x13'))[_0x54b1('0xa')](_0x54b1('0x14')+_0x5d4f37)[_0x54b1('0xd')](_0x2d9508,'ui')[_0x54b1('0x15')](_0x54b1('0x16'),'u',_0x54b1('0x17'));if(_0x5d2776[_0x54b1('0x18')]>0x0){_0x297c9c[_0x54b1('0x19')](_0x54b1('0x14')+_0x5d4f37+'\x20IN\x20?',_[_0x54b1('0x1a')](_0x5d2776,'id'));}return _0x297c9c;}function getInteractionsQuery(_0x54feb3){var _0x482cd5=utils[_0x54b1('0x1b')](_0x54feb3);var _0x3e517b=utils[_0x54b1('0x7')](_0x54feb3);var _0xf3da4b=utils[_0x54b1('0xf')](_0x54feb3);return squel[_0x54b1('0x11')]()[_0x54b1('0xd')](_0x482cd5['interactions'],'i')[_0x54b1('0x15')](_0x54b1('0x1c'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x54b1('0x15')](_0x54b1('0x16'),'o',_0x54b1('0x1d'))[_0x54b1('0x15')](_0x482cd5[_0x54b1('0x1e')],'a','a.id\x20=\x20i.'+_0x3e517b)[_0x54b1('0x15')](_0x482cd5['messages'],'me',_0x54b1('0x1f')+_0xf3da4b+_0x54b1('0x20'))[_0x54b1('0x15')](_0x482cd5[_0x54b1('0x21')],'it',_0x54b1('0x22')+_0xf3da4b+_0x54b1('0x20'))[_0x54b1('0x15')](_0x54b1('0xe'),'t',_0x54b1('0x23'));}function getSqlClauses(){var _0x53ad65={'body':squel[_0x54b1('0x24')](),'contact':squel[_0x54b1('0x24')](),'default':squel[_0x54b1('0x24')](),'fields':squel[_0x54b1('0x24')](),'filter':squel[_0x54b1('0x24')](),'read':squel[_0x54b1('0x24')](),'tags':{'clause':squel[_0x54b1('0x24')](),'ids':null},'user':squel[_0x54b1('0x24')]()};return _0x53ad65;}function parseTagParameter(_0x15a406){var _0x377925=squel[_0x54b1('0x24')]();if(_0x15a406){var _0x19be04=utils[_0x54b1('0x25')](_0x15a406);_0x19be04[_0x54b1('0x26')](function(_0x38faa5){_0x377925['or'](_0x54b1('0x27'),'%,'+_0x38faa5+',%');});}return _0x377925;}function parseReadParameter(_0x41c3d7){var _0x56ca11='';if(_0x41c3d7){_0x56ca11=_0x54b1('0x28');if(_0x41c3d7==='1'){_0x56ca11=_0x56ca11[_0x54b1('0x29')](_0x54b1('0x2a'),'=');}else{_0x56ca11=_0x56ca11[_0x54b1('0x29')](_0x54b1('0x2a'),'>');}}return _0x56ca11;}function parseSearchFilter(_0xc49998,_0x26876a){var _0x38f46e=squel[_0x54b1('0x24')]();if(_0x26876a){var _0x35f14d=_0x26876a[_0x54b1('0x29')]('\x5c','\x5c\x5c')[_0x54b1('0x29')](/'/g,'\x27\x27');var _0xd93cfe=qs['escapeLIKESpecialChars'](_0x35f14d);if(qs[_0x54b1('0x2b')](_0x35f14d)){_0x38f46e['or'](_0x54b1('0x2c'),_0xd93cfe+'%');if([_0x54b1('0x2d'),_0x54b1('0x2e')][_0x54b1('0x2f')](_0xc49998)){_0x38f46e['or'](_0x54b1('0x30'),_0xd93cfe+'%');}else if(_0xc49998===_0x54b1('0x31')){_0x38f46e['or']('i.fax\x20LIKE\x20?',_0xd93cfe+'%');}else if(_0xc49998===_0x54b1('0x32')){_0x38f46e['or']('i.from\x20LIKE\x20?',_0xd93cfe+'%');}}else if(_0xc49998==='mail'&&qs[_0x54b1('0x33')](_0x35f14d)){_0x38f46e['or']('c.email\x20LIKE\x20?',_0xd93cfe+'%');}else{if(_0xc49998===_0x54b1('0x34')){_0x38f46e['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x35f14d,!![]))['or'](_0x54b1('0x35'),qs[_0x54b1('0x36')](_0x35f14d));}else if(_0xc49998!==_0x54b1('0x31')){_0x38f46e['or'](_0x54b1('0x37'),qs['getFullTextValue'](_0x35f14d));}_0x38f46e['or'](_0x54b1('0x38'),qs[_0x54b1('0x36')](_0x35f14d,!![]),null);}}return _0x38f46e;}function parseAdvancedSearchFilter(_0x547db0,_0x526325){var _0xce1e09=getSqlClauses();var _0x1c8537=as[_0x54b1('0x39')](_0x547db0);var _0xa4dace=_0x1c8537[_0x54b1('0x3a')];for(var _0x236f89=0x0;_0x236f89<_0x1c8537[_0x54b1('0x3b')][_0x54b1('0x18')];_0x236f89++){var _0x532cd4=_0x1c8537[_0x54b1('0x3b')][_0x236f89];var _0x54a596='i';var _0x5069f7=_['find'](_0x526325,[_0x54b1('0xb'),_0x532cd4[_0x54b1('0xa')]]);if(_0x5069f7){var _0x22cbf9=as[_0x54b1('0x3c')](_0x54a596,_0x5069f7['type'],_0x532cd4);_0xce1e09[_0x54b1('0x3d')][_0xa4dace](_0x22cbf9['text'],_0x22cbf9[_0x54b1('0x3e')]['start'],_0x22cbf9[_0x54b1('0x3e')]['end']);}else{switch(_0x532cd4[_0x54b1('0xa')]){case _0x54b1('0x3f'):var _0x1718bb=parseReadParameter(_0x532cd4[_0x54b1('0x3e')]);_0xce1e09[_0x54b1('0x40')][_0x54b1('0x41')](_0x1718bb);break;case _0x54b1('0x42'):if(_0x532cd4[_0x54b1('0x43')]===_0x54b1('0x44')){if(_0x532cd4[_0x54b1('0x3e')][_0x54b1('0x45')]('\x20')[_0x54b1('0x18')]>0x1){_0xce1e09[_0x54b1('0x46')][_0xa4dace](_0x54b1('0x38'),qs[_0x54b1('0x36')](_0x532cd4['value'],!![]),null);}else{var _0x5b265a='%'+_0x532cd4['value']+'%';_0xce1e09[_0x54b1('0x46')][_0xa4dace]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5b265a,_0x5b265a,_0x5b265a);}}else{_0x5069f7=_[_0x54b1('0x47')](_0x526325,[_0x54b1('0xb'),_0x54b1('0x48')]);_0x532cd4['field']=_0x54b1('0x48');_0x22cbf9=as['buildExpression'](_0x54a596,_0x5069f7[_0x54b1('0x49')],_0x532cd4);_0xce1e09[_0x54b1('0x46')][_0xa4dace](_0x22cbf9[_0x54b1('0x4a')],_0x22cbf9['value'][_0x54b1('0x4b')],_0x22cbf9['value'][_0x54b1('0x4c')]);}break;case _0x54b1('0x4d'):var _0x456606=_0x532cd4[_0x54b1('0x3e')]['split'](',')[_0x54b1('0x1a')](function(_0x1cc88e){return Number(_0x1cc88e);});var _0x29e577=parseTagParameter(_0x456606);_0xce1e09[_0x54b1('0x4e')][_0x54b1('0x4f')][_0x54b1('0x41')](_0x29e577);_0xce1e09[_0x54b1('0x4e')][_0x54b1('0x50')]=_0x456606;break;case _0x54b1('0x51'):if(_0x532cd4[_0x54b1('0x43')]===_0x54b1('0x44')){_0xce1e09[_0x54b1('0x52')][_0xa4dace](_0x54b1('0x53'),'%'+_0x532cd4['value']+'%',null);}else{_0x5069f7=_[_0x54b1('0x47')](_0x526325,[_0x54b1('0xb'),_0x54b1('0x54')]);_0x532cd4[_0x54b1('0xa')]='UserId';_0x22cbf9=as[_0x54b1('0x3c')](_0x54a596,_0x5069f7['type'],_0x532cd4);_0xce1e09[_0x54b1('0x52')][_0xa4dace](_0x22cbf9['text'],_0x22cbf9[_0x54b1('0x3e')][_0x54b1('0x4b')],_0x22cbf9[_0x54b1('0x3e')][_0x54b1('0x4c')]);}break;case _0x54b1('0x55'):case _0x54b1('0x56'):_0x22cbf9=as[_0x54b1('0x3c')]('me',null,_0x532cd4);_0xce1e09[_0x54b1('0x55')][_0xa4dace](_0x22cbf9[_0x54b1('0x4a')],_0x22cbf9['value'][_0x54b1('0x4b')],_0x22cbf9['value'][_0x54b1('0x4c')]);break;}}}return _0xce1e09;}function parseModelFields(_0x398a6d,_0x4576c1,_0xfa9574){var _0x16b8a7=utils[_0x54b1('0x7')](_0x398a6d);var _0x5e4d1f=squel[_0x54b1('0x24')]();var _0x4f6b59=_(_0x4576c1)[_0x54b1('0x57')]()[_0x54b1('0x1a')](function(_0x197210){return _['some'](_0xfa9574,['name',_0x197210])?_0x197210:undefined;})['compact']()['value']();if(_0x4f6b59['length']>0x0){_0x4f6b59[_0x54b1('0x26')](function(_0x3448f6){if(_0x3448f6===_0x16b8a7){_0x5e4d1f['and']('i.'+_0x16b8a7+_0x54b1('0x58'),[]['concat'](_0x4576c1[_0x3448f6]));}else if(_0x3448f6==='createdAt'){var _0x1bf1f2=JSON[_0x54b1('0x59')](_0x4576c1[_0x3448f6])[_0x54b1('0x5a')];var _0x3de1ac=JSON[_0x54b1('0x59')](_0x4576c1[_0x3448f6])['$lte'];_0x5e4d1f[_0x54b1('0x41')](_0x54b1('0x5b'),_0x1bf1f2,_0x3de1ac);}else{if(_0x4576c1[_0x3448f6]===_0x54b1('0x5c')){_0x5e4d1f[_0x54b1('0x41')]('i.'+_0x3448f6+_0x54b1('0x5d'));}else{_0x5e4d1f[_0x54b1('0x41')]('i.'+_0x3448f6+_0x54b1('0x5e'),_0x4576c1[_0x3448f6]);}}});}return _0x5e4d1f;}function parseQueryParameters(_0xc1a820,_0x1583a6,_0x4e1ae3){var _0x16055e=getSqlClauses();return Promise[_0x54b1('0x5f')]()['then'](function(){return parseModelFields(_0xc1a820,_0x1583a6,_0x4e1ae3);})[_0x54b1('0x60')](function(_0x267b4f){_0x16055e['fields'][_0x54b1('0x41')](_0x267b4f);return parseReadParameter(_0x1583a6['read']);})[_0x54b1('0x60')](function(_0x4e1813){_0x16055e[_0x54b1('0x40')][_0x54b1('0x41')](_0x4e1813);return parseTagParameter(_0x1583a6[_0x54b1('0x61')]);})[_0x54b1('0x60')](function(_0x6914e9){_0x16055e[_0x54b1('0x4e')][_0x54b1('0x4f')][_0x54b1('0x41')](_0x6914e9);return parseSearchFilter(_0xc1a820,_0x1583a6[_0x54b1('0x62')]);})[_0x54b1('0x60')](function(_0x4b2dc0){_0x16055e['filter']=_0x4b2dc0;return _0x16055e;});}function checkAccountsRestrictions(_0x3da2e1,_0x3900fd,_0x8fec1d){var _0x41e572=utils[_0x54b1('0x7')](_0x3da2e1);var _0x489b06=_0x54b1('0x63')+_[_0x54b1('0x64')](_0x3da2e1)+(_0x3da2e1===_0x54b1('0x65')?_0x54b1('0x66'):_0x54b1('0x67'));var _0x40d5f4=squel['expr']();return Promise[_0x54b1('0x5f')]()[_0x54b1('0x60')](function(){if(_0x8fec1d[_0x54b1('0x9')]&&_0x3900fd[_0x54b1('0x68')]===_0x54b1('0x8')){return _0x3900fd[_0x489b06]({'attributes':['id'],'raw':!![]});}})[_0x54b1('0x60')](function(_0x5e6fd5){if(_0x5e6fd5){if(_0x5e6fd5[_0x54b1('0x18')]===0x0){_0x40d5f4[_0x54b1('0x41')]('i.'+_0x41e572+'\x20IS\x20NULL');}else{_0x40d5f4[_0x54b1('0x41')]('i.'+_0x41e572+_0x54b1('0x58'),_[_0x54b1('0x1a')](_0x5e6fd5,'id'));}}else if(!_0x8fec1d[_0x41e572]){_0x40d5f4[_0x54b1('0x41')]('i.'+_0x41e572+_0x54b1('0x69'));}})['then'](function(){return _0x40d5f4;});}function getClosedOrderClause(_0x5b2ed7,_0xf012c){var _0x25b65c='';var _0x6344bc=['i.thirdDisposition','i.secondDisposition',_0x54b1('0x6a')];if(_0x5b2ed7===_0x54b1('0x34')){_0x6344bc[_0x54b1('0x6b')](_0x54b1('0x6c'));}if(_0xf012c['closed']==='0'&&_0x5b2ed7===_0x54b1('0x34')){_0x25b65c=_0x54b1('0x6c');}else{if(_0xf012c[_0x54b1('0x6d')]==='1'){_0x6344bc['shift']();}_0x25b65c=_0x54b1('0x6e')+_0x6344bc[_0x54b1('0x6f')](',\x20')+')';}return _0x25b65c;}function getFilteredInteractions(_0x3959e0,_0x7d78b5,_0x43101e,_0x5661c7){var _0x1ea8f7=utils[_0x54b1('0xf')](_0x3959e0);var _0x141b30=_[_0x54b1('0x64')](_0x3959e0)+_0x54b1('0x70');var _0x4500b8=[];var _0x2d52e9=getTagsQuery();var _0x2114c4={'type':db[_0x54b1('0x71')][_0x54b1('0x72')][_0x54b1('0x73')],'raw':!![]};var _0x2dbace=[];var _0x142d74=[];return db['sequelize'][_0x54b1('0x74')](_0x2d52e9[_0x54b1('0x75')](),_0x2114c4)[_0x54b1('0x60')](function(_0x4a1479){_0x4500b8=_[_0x54b1('0x76')](_0x4a1479,'id');_0x2114c4=_[_0x54b1('0x77')](_0x2114c4,{'model':db[_0x141b30],'mapToModel':!![],'nest':!![]});if(_0x43101e['fields']){_0x5661c7[_0x54b1('0x78')][_0x54b1('0x26')](function(_0x96bc6d){_0x7d78b5[_0x54b1('0xa')]('i.'+_0x96bc6d);});}else{_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x79'),'unreadMessages');_0x7d78b5['field'](_0x54b1('0x7a'),'Account.key');_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x7b'),'Account.mandatoryDisposition');if(_0x3959e0===_0x54b1('0x34')){_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x7c'),_0x54b1('0x7d'));_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x7e'),_0x54b1('0x7f'));_0x7d78b5['field']('i.id');_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x80'));_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x81'));_0x7d78b5['field'](_0x54b1('0x82'));_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x83'));_0x7d78b5['field'](_0x54b1('0x84'));_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x85'));_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x86'));_0x7d78b5[_0x54b1('0xa')]('i.subject');_0x7d78b5[_0x54b1('0xa')]('i.disposition');_0x7d78b5[_0x54b1('0xa')]('i.secondDisposition');_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x87'));_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x6c'));_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x88'));_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x89'));_0x7d78b5['field']('i.MailAccountId');_0x7d78b5[_0x54b1('0xa')]('i.UserId');}else if(_0x3959e0===_0x54b1('0x32')){_0x7d78b5['field'](_0x54b1('0x8a'),_0x54b1('0x7f'));}else{_0x7d78b5[_0x54b1('0xa')]('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',_0x54b1('0x7f'));}if(_0x3959e0!==_0x54b1('0x34')){_0x7d78b5[_0x54b1('0xa')]('i.*');}_0x7d78b5[_0x54b1('0xa')]('c.firstName',_0x54b1('0x8b'));_0x7d78b5['field'](_0x54b1('0x8c'),_0x54b1('0x8d'));_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x8e'),'Contact.email');_0x7d78b5[_0x54b1('0xa')]('c.phone',_0x54b1('0x8f'));_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x90'),_0x54b1('0x91'));_0x7d78b5['field']('c.fax',_0x54b1('0x92'));_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x93'),'Owner.fullname');_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x94'),_0x54b1('0x95'));_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x96'),_0x54b1('0x97'));}if(_0x5661c7[_0x54b1('0x98')]){_0x7d78b5[_0x54b1('0x98')](_0x5661c7['limit']);}if(_0x5661c7[_0x54b1('0x99')]){_0x7d78b5[_0x54b1('0x99')](_0x5661c7[_0x54b1('0x99')]);}return db[_0x54b1('0x9a')][_0x54b1('0x74')](_0x7d78b5[_0x54b1('0x75')](),_0x2114c4);})['then'](function(_0xb68857){_0x2dbace=_0xb68857;var _0x1f9e12=getUsersQuery(_0x3959e0,_0x2dbace);return db[_0x54b1('0x9a')][_0x54b1('0x74')](_0x1f9e12[_0x54b1('0x75')](),_0x2114c4);})[_0x54b1('0x60')](function(_0x59bb07){_0x142d74=_[_0x54b1('0x9b')](_0x59bb07,_0x1ea8f7);if(_0x3959e0===_0x54b1('0x34')){return db['Setting'][_0x54b1('0x9c')]({'attributes':[_0x54b1('0x9d')],'raw':!![]});}})[_0x54b1('0x60')](function(_0x28158c){var _0x1c11c0=_0x28158c?_0x28158c['enableEmailPreview']:undefined;var _0x319b9a=_0x2dbace[_0x54b1('0x1a')](function(_0x195da8){return updateInteraction(_0x195da8,_0x4500b8,_0x142d74,_0x1c11c0);});return Promise[_0x54b1('0x9e')](_0x319b9a);});}function countFilteredInteractions(_0x14f411,_0x2995a7){var _0x214535=_0x14f411[_0x54b1('0x9f')]();_0x214535[_0x54b1('0xa')]('COUNT(*)');_0x214535['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x54b1('0x3f'));var _0x205084=utils[_0x54b1('0x25')](_0x2995a7);if(!_[_0x54b1('0xa0')](_0x205084)){_0x214535['where'](_0x54b1('0xa1'),_0x205084);}var _0x21398={'type':db[_0x54b1('0x71')][_0x54b1('0x72')][_0x54b1('0x73')],'raw':!![]};return db[_0x54b1('0x9a')][_0x54b1('0x74')](_0x214535[_0x54b1('0x75')](),_0x21398);}module[_0x54b1('0xa2')]={'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 3ff692e..341d0ab 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 _0xca32=['forEach','push','waiting','talking','answered','unmanaged','abandoned','total','disposition','UserId','MailMessage','findOne','out','-id','then','plainBody','lastMsgText','trimStart','catch','updateInteraction','Users','Tags','TagIds','lodash','../../mysqldb'];(function(_0x687843,_0x26671e){var _0x5d1a52=function(_0x599034){while(--_0x599034){_0x687843['push'](_0x687843['shift']());}};_0x5d1a52(++_0x26671e);}(_0xca32,0x7b));var _0x2ca3=function(_0x5a1223,_0x3ab86c){_0x5a1223=_0x5a1223-0x0;var _0x2e5ccb=_0xca32[_0x5a1223];return _0x2e5ccb;};'use strict';var _=require(_0x2ca3('0x0'));var db=require(_0x2ca3('0x1'))['db'];function getInteractionUsers(_0x23ecc4,_0x222728){return new Promise(function(_0x104055,_0x4b319b){try{var _0x3fc4bb=[];if(_0x222728[_0x23ecc4]){_0x3fc4bb=_0x222728[_0x23ecc4]['map'](function(_0x384f8f){return{'id':_0x384f8f['id'],'fullname':_0x384f8f['fullname']};});}return _0x104055(_0x3fc4bb);}catch(_0x261871){_0x4b319b(_0x261871);}});}function getInteractionTags(_0x3ad110,_0x3bf309){var _0x4f2440=[];if(_0x3ad110){_0x3ad110['split'](',')[_0x2ca3('0x2')](function(_0x555e50){_0x4f2440[_0x2ca3('0x3')](_0x3bf309[_0x555e50]);});}return _0x4f2440;}function updateWaitingCounter(_0x2efae5){if(_0x2efae5[_0x2ca3('0x4')]){_0x2efae5[_0x2ca3('0x4')]-=0x1;}}function updateInteractionCounters(_0x35ee34){_0x35ee34[_0x2ca3('0x4')]=0x0;_0x35ee34[_0x2ca3('0x5')]=0x0;_0x35ee34[_0x2ca3('0x6')]=0x0;_0x35ee34[_0x2ca3('0x7')]=0x0;_0x35ee34[_0x2ca3('0x8')]=0x0;_0x35ee34[_0x2ca3('0x9')]=0x0;if(_0x35ee34['closed']){if(_0x35ee34[_0x2ca3('0xa')]===_0x2ca3('0x8')){_0x35ee34['abandoned']+=0x1;updateWaitingCounter(_0x35ee34);}if(_0x35ee34['UserId']){_0x35ee34[_0x2ca3('0x6')]+=0x1;if(_0x35ee34[_0x2ca3('0x5')]){_0x35ee34[_0x2ca3('0x5')]-=0x1;}}else{if(_0x35ee34['disposition']){_0x35ee34[_0x2ca3('0x7')]+=0x1;updateWaitingCounter(_0x35ee34);}}}else{if(!_0x35ee34[_0x2ca3('0xb')]){_0x35ee34[_0x2ca3('0x4')]+=0x1;}if(_0x35ee34[_0x2ca3('0xb')]){_0x35ee34['talking']+=0x1;updateWaitingCounter(_0x35ee34);}}_0x35ee34[_0x2ca3('0x9')]+=0x1;return _0x35ee34;}function getLastMessageText(_0x344237){return db[_0x2ca3('0xc')][_0x2ca3('0xd')]({'where':{'$and':[{'MailInteractionId':_0x344237['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x2ca3('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x2ca3('0xf'),'raw':!![]})[_0x2ca3('0x10')](function(_0x297f29){if(_0x297f29&&_0x297f29[_0x2ca3('0x11')]){_0x344237[_0x2ca3('0x12')]=_[_0x2ca3('0x13')](_0x297f29[_0x2ca3('0x11')]);}return _0x344237;})[_0x2ca3('0x14')](function(_0x376d10){throw _0x376d10;});}exports[_0x2ca3('0x15')]=function(_0x5ebed0,_0x6575f6,_0x18a537,_0x3d571e){return new Promise(function(_0x389c3d,_0x26ecb1){return getInteractionUsers(_0x5ebed0['id'],_0x18a537)[_0x2ca3('0x10')](function(_0x31a45a){_0x5ebed0[_0x2ca3('0x16')]=_0x31a45a;return getInteractionTags(_0x5ebed0['TagIds'],_0x6575f6);})['then'](function(_0x3e2ad5){_0x5ebed0[_0x2ca3('0x17')]=_0x3e2ad5;delete _0x5ebed0[_0x2ca3('0x18')];return updateInteractionCounters(_0x5ebed0);})[_0x2ca3('0x10')](function(_0x4c3ff0){if(_0x3d571e){return getLastMessageText(_0x4c3ff0);}else{return _0x4c3ff0;}})[_0x2ca3('0x10')](function(_0x5d8366){_0x389c3d(_0x5d8366);})['catch'](function(_0x37ef5a){_0x26ecb1(_0x37ef5a);});});}; \ No newline at end of file +var _0xc7b8=['answered','unmanaged','abandoned','closed','disposition','UserId','talking','total','MailMessage','findOne','out','plainBody','then','lastMsgText','trimStart','catch','Users','TagIds','../../mysqldb','map','split','push','waiting'];(function(_0x35c243,_0x5ace82){var _0x29a1f7=function(_0x188cc3){while(--_0x188cc3){_0x35c243['push'](_0x35c243['shift']());}};_0x29a1f7(++_0x5ace82);}(_0xc7b8,0xca));var _0x8c7b=function(_0x1970c8,_0x4d7336){_0x1970c8=_0x1970c8-0x0;var _0x4acaf6=_0xc7b8[_0x1970c8];return _0x4acaf6;};'use strict';var _=require('lodash');var db=require(_0x8c7b('0x0'))['db'];function getInteractionUsers(_0x6ca84c,_0x435179){return new Promise(function(_0x28654f,_0x48053f){try{var _0x18f08d=[];if(_0x435179[_0x6ca84c]){_0x18f08d=_0x435179[_0x6ca84c][_0x8c7b('0x1')](function(_0x217419){return{'id':_0x217419['id'],'fullname':_0x217419['fullname']};});}return _0x28654f(_0x18f08d);}catch(_0x68aaa2){_0x48053f(_0x68aaa2);}});}function getInteractionTags(_0x16d3ca,_0x4b7e86){var _0x235770=[];if(_0x16d3ca){_0x16d3ca[_0x8c7b('0x2')](',')['forEach'](function(_0x321f96){_0x235770[_0x8c7b('0x3')](_0x4b7e86[_0x321f96]);});}return _0x235770;}function updateWaitingCounter(_0x5a4618){if(_0x5a4618['waiting']){_0x5a4618[_0x8c7b('0x4')]-=0x1;}}function updateInteractionCounters(_0x4b4ef7){_0x4b4ef7[_0x8c7b('0x4')]=0x0;_0x4b4ef7['talking']=0x0;_0x4b4ef7[_0x8c7b('0x5')]=0x0;_0x4b4ef7[_0x8c7b('0x6')]=0x0;_0x4b4ef7[_0x8c7b('0x7')]=0x0;_0x4b4ef7['total']=0x0;if(_0x4b4ef7[_0x8c7b('0x8')]){if(_0x4b4ef7[_0x8c7b('0x9')]===_0x8c7b('0x7')){_0x4b4ef7[_0x8c7b('0x7')]+=0x1;updateWaitingCounter(_0x4b4ef7);}if(_0x4b4ef7[_0x8c7b('0xa')]){_0x4b4ef7['answered']+=0x1;if(_0x4b4ef7[_0x8c7b('0xb')]){_0x4b4ef7[_0x8c7b('0xb')]-=0x1;}}else{if(_0x4b4ef7[_0x8c7b('0x9')]){_0x4b4ef7[_0x8c7b('0x6')]+=0x1;updateWaitingCounter(_0x4b4ef7);}}}else{if(!_0x4b4ef7[_0x8c7b('0xa')]){_0x4b4ef7[_0x8c7b('0x4')]+=0x1;}if(_0x4b4ef7[_0x8c7b('0xa')]){_0x4b4ef7[_0x8c7b('0xb')]+=0x1;updateWaitingCounter(_0x4b4ef7);}}_0x4b4ef7[_0x8c7b('0xc')]+=0x1;return _0x4b4ef7;}function getLastMessageText(_0x30a81d){return db[_0x8c7b('0xd')][_0x8c7b('0xe')]({'where':{'$and':[{'MailInteractionId':_0x30a81d['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x8c7b('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x8c7b('0x10')],'order':'-id','raw':!![]})[_0x8c7b('0x11')](function(_0x39558e){if(_0x39558e&&_0x39558e[_0x8c7b('0x10')]){_0x30a81d[_0x8c7b('0x12')]=_[_0x8c7b('0x13')](_0x39558e[_0x8c7b('0x10')]);}return _0x30a81d;})[_0x8c7b('0x14')](function(_0x1598de){throw _0x1598de;});}exports['updateInteraction']=function(_0x57b015,_0x276409,_0x1f04dd,_0x315783){return new Promise(function(_0x28a3a8,_0x386ae1){return getInteractionUsers(_0x57b015['id'],_0x1f04dd)[_0x8c7b('0x11')](function(_0x148481){_0x57b015[_0x8c7b('0x15')]=_0x148481;return getInteractionTags(_0x57b015[_0x8c7b('0x16')],_0x276409);})[_0x8c7b('0x11')](function(_0x3fea84){_0x57b015['Tags']=_0x3fea84;delete _0x57b015[_0x8c7b('0x16')];return updateInteractionCounters(_0x57b015);})[_0x8c7b('0x11')](function(_0x408043){if(_0x315783){return getLastMessageText(_0x408043);}else{return _0x408043;}})[_0x8c7b('0x11')](function(_0x4b80e6){_0x28a3a8(_0x4b80e6);})[_0x8c7b('0x14')](function(_0x1a57c9){_0x386ae1(_0x1a57c9);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index f7e01af..f2a58fc 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 _0x943d=['stringify','null','Interaction','findOne','then','update','info','catch','error','exports','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','whatsapp-interactions','Website','InteractionId','unknown','chat','websites','accounts','_interactions','_messages','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x943d,0x19f));var _0xd943=function(_0x5a1a51,_0x144c79){_0x5a1a51=_0x5a1a51-0x0;var _0x47edd7=_0x943d[_0x5a1a51];return _0x47edd7;};'use strict';var _=require('lodash');var db=require(_0xd943('0x0'))['db'];var loggers={'openchannel':require('../../config/logger')('openchannel-interactions'),'mail':require(_0xd943('0x1'))(_0xd943('0x2')),'fax':require(_0xd943('0x1'))(_0xd943('0x3')),'sms':require(_0xd943('0x1'))('sms-interactions'),'chat':require(_0xd943('0x1'))('chat-interactions'),'whatsapp':require('../../config/logger')(_0xd943('0x4'))};function getAccountFK(_0x1ba2fe){return _['capitalize'](_0x1ba2fe)+(_0x1ba2fe==='chat'?_0xd943('0x5'):'Account')+'Id';}function getInteractionFK(_0x4222cf){return _['capitalize'](_0x4222cf)+'InteractionId';}function getInteractionId(_0x4087b6,_0x34fd85,_0x58223f){if(_0x4087b6&&_0x4087b6[_['upperFirst'](_0x58223f)+_0xd943('0x6')]){return _0x4087b6[_['upperFirst'](_0x58223f)+_0xd943('0x6')];}else if(_0x4087b6&&_0x4087b6['id']){return _0x4087b6['id'];}else if(_0x34fd85&&_0x34fd85['id']){return _0x34fd85['id'];}else{return _0xd943('0x7');}}function getInteractionsTables(_0x3e6779){return{'accounts':_0x3e6779+'_'+(_0x3e6779===_0xd943('0x8')?_0xd943('0x9'):_0xd943('0xa')),'interactions':_0x3e6779+_0xd943('0xb'),'interactionsTags':_0x3e6779+'_interaction_has_tags','messages':_0x3e6779+_0xd943('0xc'),'userInteractions':'user_has_'+_0x3e6779+'_interactions'};}function getSelectedTags(_0x6e4d45){var _0x468c0a=[];if(_0x6e4d45){_0x468c0a=Array['isArray'](_0x6e4d45)?_0x6e4d45:[_0x6e4d45];}return _0x468c0a;}function log(_0xe175e8,_0xffb9e1,_0x1cf0a3,_0x5a0a9d,_0x7282bc,_0x31fcd9){loggers[_0x7282bc[_0xd943('0xd')]()][_0xe175e8](_0xd943('0xe'),_0x31fcd9[_0xd943('0xf')](),_0xffb9e1?_0xffb9e1['id']:null,_0xffb9e1?_0xffb9e1[_0xd943('0x10')]:null,_0xffb9e1?_0xffb9e1['role']:null,getInteractionId(_0x1cf0a3,_0x5a0a9d,_0x7282bc),_0x1cf0a3?JSON[_0xd943('0x11')](_0x1cf0a3):_0xd943('0x12'));}function updateUser(_0x1ef714,_0x4f4bb3,_0x17180b,_0xdbcb0e,_0x4ca57a){db[_['upperFirst'](_0xdbcb0e)+_0xd943('0x13')][_0xd943('0x14')]({'where':{'id':getInteractionId(_0x4f4bb3,_0x17180b,_0xdbcb0e)}})[_0xd943('0x15')](function(_0x1cd58f){if(_0x1cd58f){return _0x1cd58f[_0xd943('0x16')]({'UserId':_0x1ef714?_0x1ef714['id']:null});}})['then'](function(_0x40b1ff){if(_0x40b1ff){log(_0xd943('0x17'),_0x1ef714,_0x4f4bb3,_0x17180b,_0xdbcb0e,_0x4ca57a);}})[_0xd943('0x18')](function(){log(_0xd943('0x19'),_0x1ef714,_0x4f4bb3,_0x17180b,_0xdbcb0e,_0x4ca57a);});}module[_0xd943('0x1a')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x6c30=['accounts','_interactions','_messages','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','null','Interaction','findOne','then','update','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','chat-interactions','capitalize','chat','Account','InteractionId','upperFirst','unknown'];(function(_0x29de36,_0x509410){var _0x4bd731=function(_0xcf9a0e){while(--_0xcf9a0e){_0x29de36['push'](_0x29de36['shift']());}};_0x4bd731(++_0x509410);}(_0x6c30,0x1e0));var _0x06c3=function(_0x209ec9,_0x30378c){_0x209ec9=_0x209ec9-0x0;var _0x129b1b=_0x6c30[_0x209ec9];return _0x129b1b;};'use strict';var _=require(_0x06c3('0x0'));var db=require(_0x06c3('0x1'))['db'];var loggers={'openchannel':require(_0x06c3('0x2'))(_0x06c3('0x3')),'mail':require(_0x06c3('0x2'))('mail-interactions'),'fax':require('../../config/logger')(_0x06c3('0x4')),'sms':require('../../config/logger')(_0x06c3('0x5')),'chat':require('../../config/logger')(_0x06c3('0x6')),'whatsapp':require(_0x06c3('0x2'))('whatsapp-interactions')};function getAccountFK(_0x5186d5){return _[_0x06c3('0x7')](_0x5186d5)+(_0x5186d5===_0x06c3('0x8')?'Website':_0x06c3('0x9'))+'Id';}function getInteractionFK(_0x1d9d7b){return _[_0x06c3('0x7')](_0x1d9d7b)+_0x06c3('0xa');}function getInteractionId(_0x2fb19f,_0x20bb7a,_0x2a09e5){if(_0x2fb19f&&_0x2fb19f[_[_0x06c3('0xb')](_0x2a09e5)+'InteractionId']){return _0x2fb19f[_[_0x06c3('0xb')](_0x2a09e5)+_0x06c3('0xa')];}else if(_0x2fb19f&&_0x2fb19f['id']){return _0x2fb19f['id'];}else if(_0x20bb7a&&_0x20bb7a['id']){return _0x20bb7a['id'];}else{return _0x06c3('0xc');}}function getInteractionsTables(_0x4f673c){return{'accounts':_0x4f673c+'_'+(_0x4f673c===_0x06c3('0x8')?'websites':_0x06c3('0xd')),'interactions':_0x4f673c+_0x06c3('0xe'),'interactionsTags':_0x4f673c+'_interaction_has_tags','messages':_0x4f673c+_0x06c3('0xf'),'userInteractions':'user_has_'+_0x4f673c+_0x06c3('0xe')};}function getSelectedTags(_0x392ad7){var _0x10054b=[];if(_0x392ad7){_0x10054b=Array[_0x06c3('0x10')](_0x392ad7)?_0x392ad7:[_0x392ad7];}return _0x10054b;}function log(_0x47fa0c,_0x499905,_0xe291c2,_0x1f4567,_0x810583,_0x3430f7){loggers[_0x810583[_0x06c3('0x11')]()][_0x47fa0c](_0x06c3('0x12'),_0x3430f7['toUpperCase'](),_0x499905?_0x499905['id']:null,_0x499905?_0x499905[_0x06c3('0x13')]:null,_0x499905?_0x499905[_0x06c3('0x14')]:null,getInteractionId(_0xe291c2,_0x1f4567,_0x810583),_0xe291c2?JSON[_0x06c3('0x15')](_0xe291c2):_0x06c3('0x16'));}function updateUser(_0x5f21d3,_0x5df3c7,_0x1ba0b1,_0x3a2a8f,_0x2f086d){db[_[_0x06c3('0xb')](_0x3a2a8f)+_0x06c3('0x17')][_0x06c3('0x18')]({'where':{'id':getInteractionId(_0x5df3c7,_0x1ba0b1,_0x3a2a8f)}})[_0x06c3('0x19')](function(_0x10d57d){if(_0x10d57d){return _0x10d57d[_0x06c3('0x1a')]({'UserId':_0x5f21d3?_0x5f21d3['id']:null});}})[_0x06c3('0x19')](function(_0x451e80){if(_0x451e80){log('info',_0x5f21d3,_0x5df3c7,_0x1ba0b1,_0x3a2a8f,_0x2f086d);}})['catch'](function(){log(_0x06c3('0x1b'),_0x5f21d3,_0x5df3c7,_0x1ba0b1,_0x3a2a8f,_0x2f086d);});}module[_0x06c3('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 a019376..7c3c03b 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 _0xd054=['utf8','final','hasOwnProperty','use','License','findOne','then','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','update','base64'];(function(_0x35b208,_0x2b9846){var _0x145e21=function(_0xaf4ff4){while(--_0xaf4ff4){_0x35b208['push'](_0x35b208['shift']());}};_0x145e21(++_0x2b9846);}(_0xd054,0x160));var _0x4d05=function(_0x1b2bbf,_0x314a90){_0x1b2bbf=_0x1b2bbf-0x0;var _0x1cfe40=_0xd054[_0x1b2bbf];return _0x1cfe40;};'use strict';var crypto=require(_0x4d05('0x0'));var util=require(_0x4d05('0x1'));var compose=require(_0x4d05('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x4d05('0x3'));function getValueFromLicense(_0x3808f8,_0x155b29){if(_0x3808f8&&_0x155b29){if(_0x155b29[_0x4d05('0x4')]&&_0x155b29[_0x4d05('0x5')]){var _0x4d33a9=_0x155b29[_0x4d05('0x4')];var _0x2e236d=_0x155b29[_0x4d05('0x5')];var _0x36fe13=_0x4d33a9['split']('-')[0x4];var _0x47bcbc=_0x4d33a9[_0x4d05('0x6')]('-')[0x0];var _0x57f15e=crypto[_0x4d05('0x7')](_0x4d05('0x8'),util[_0x4d05('0x9')]('%s:%s:%s',_0x36fe13,_0x4d33a9,_0x47bcbc));var _0x364757=_0x57f15e[_0x4d05('0xa')](_0x2e236d,_0x4d05('0xb'),_0x4d05('0xc'));_0x364757+=_0x57f15e[_0x4d05('0xd')]('utf8');var _0x47519b=JSON['parse'](_0x364757);return _0x47519b[_0x4d05('0xe')](_0x3808f8)?_0x47519b[_0x3808f8]:null;}}return null;}function isLimit(_0x48bd81,_0x56e1ec,_0x1d4d1c,_0xfdb0b0){var _0x13bebe=_0x56e1ec;return compose()[_0x4d05('0xf')](function(_0x4000b9,_0x14828f,_0x193307){return db[_0x4d05('0x10')][_0x4d05('0x11')]({'where':{'id':0x1},'raw':!![]})[_0x4d05('0x12')](function(_0x4cb937){var _0x2ba4cf=getValueFromLicense(_0x48bd81,_0x4cb937);return _0x2ba4cf?_0x2ba4cf:_0x13bebe;})[_0x4d05('0x12')](function(_0x4c24cb){_0x13bebe=_0x4c24cb;return _0x1d4d1c['count'](_0xfdb0b0);})[_0x4d05('0x12')](function(_0x3f065d){if(_0x3f065d>=_0x13bebe){return _0x14828f[_0x4d05('0x13')](0x193)['json']({'message':util['format'](_0x4d05('0x14'),_0x48bd81)});}_0x193307();})['catch'](function(_0x8354e9){_0x193307(_0x8354e9);});});}function isUserLimit(){return isLimit(_0x4d05('0x15'),0x1,db[_0x4d05('0x16')],{'where':{'$or':[{'role':_0x4d05('0x17')},{'role':_0x4d05('0x18')}]}});}exports[_0x4d05('0x19')]=isUserLimit; \ No newline at end of file +var _0xe140=['parse','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','user','crypto','util','../../mysqldb','../../config/environment','data1','license','split','aes-256-ctr','format','update','base64','utf8','final'];(function(_0x4fb9ed,_0x187ea0){var _0x263645=function(_0x11c604){while(--_0x11c604){_0x4fb9ed['push'](_0x4fb9ed['shift']());}};_0x263645(++_0x187ea0);}(_0xe140,0x16a));var _0x0e14=function(_0x5a8c60,_0xb4aa8e){_0x5a8c60=_0x5a8c60-0x0;var _0xd4a567=_0xe140[_0x5a8c60];return _0xd4a567;};'use strict';var crypto=require(_0x0e14('0x0'));var util=require(_0x0e14('0x1'));var compose=require('composable-middleware');var db=require(_0x0e14('0x2'))['db'];var config=require(_0x0e14('0x3'));function getValueFromLicense(_0x2f4d6c,_0x24c7e4){if(_0x2f4d6c&&_0x24c7e4){if(_0x24c7e4[_0x0e14('0x4')]&&_0x24c7e4[_0x0e14('0x5')]){var _0x16a295=_0x24c7e4[_0x0e14('0x4')];var _0x11fb2e=_0x24c7e4[_0x0e14('0x5')];var _0x1c9ccd=_0x16a295[_0x0e14('0x6')]('-')[0x4];var _0x200441=_0x16a295['split']('-')[0x0];var _0x52efed=crypto['createDecipher'](_0x0e14('0x7'),util[_0x0e14('0x8')]('%s:%s:%s',_0x1c9ccd,_0x16a295,_0x200441));var _0x1680aa=_0x52efed[_0x0e14('0x9')](_0x11fb2e,_0x0e14('0xa'),_0x0e14('0xb'));_0x1680aa+=_0x52efed[_0x0e14('0xc')](_0x0e14('0xb'));var _0x2b1dda=JSON[_0x0e14('0xd')](_0x1680aa);return _0x2b1dda['hasOwnProperty'](_0x2f4d6c)?_0x2b1dda[_0x2f4d6c]:null;}}return null;}function isLimit(_0x4b26d6,_0xe7a9a,_0x524c84,_0x3a151c){var _0x208b00=_0xe7a9a;return compose()['use'](function(_0x1459cb,_0x558bdc,_0x313b5c){return db[_0x0e14('0xe')][_0x0e14('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x0e14('0x10')](function(_0x1e3998){var _0x5607b0=getValueFromLicense(_0x4b26d6,_0x1e3998);return _0x5607b0?_0x5607b0:_0x208b00;})[_0x0e14('0x10')](function(_0x50aeed){_0x208b00=_0x50aeed;return _0x524c84[_0x0e14('0x11')](_0x3a151c);})['then'](function(_0xcae2fc){if(_0xcae2fc>=_0x208b00){return _0x558bdc[_0x0e14('0x12')](0x193)[_0x0e14('0x13')]({'message':util[_0x0e14('0x8')](_0x0e14('0x14'),_0x4b26d6)});}_0x313b5c();})[_0x0e14('0x15')](function(_0x1bed7b){_0x313b5c(_0x1bed7b);});});}function isUserLimit(){return isLimit(_0x0e14('0x16'),0x1,db[_0x0e14('0x17')],{'where':{'$or':[{'role':'admin'},{'role':_0x0e14('0x18')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 58a4308..c32d0bc 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 _0x056c=['format','YYYY-MM-DD','castTo','text','CAST(','field','includes','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','=\x20?','<>\x20?','$startsWith','$endsWith','LIKE\x20?','$lt','$gt','>\x20?','$lte','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','$in','start','pop','DATE','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','replace','[$and]','split','length','slice','forEach','match','filter','indexOf','map','push','buildExpression','operator','$eq','$between','value','add','days'];(function(_0x2c602e,_0x1d26f5){var _0x1a2650=function(_0x2370d1){while(--_0x2370d1){_0x2c602e['push'](_0x2c602e['shift']());}};_0x1a2650(++_0x1d26f5);}(_0x056c,0x1d7));var _0xc056=function(_0x388778,_0x5c9075){_0x388778=_0x388778-0x0;var _0x561d89=_0x056c[_0x388778];return _0x561d89;};'use strict';var _=require(_0xc056('0x0'));var moment=require(_0xc056('0x1'));exports[_0xc056('0x2')]=function(_0x144f36){var _0x3726d0={'conditions':[]};_0x3726d0[_0xc056('0x3')]=_[_0xc056('0x4')](_0x144f36,_0xc056('0x5'))?'or':'and';var _0x369b77=_0x144f36[_0xc056('0x6')](_0xc056('0x7'),'')[_0xc056('0x6')](_0xc056('0x5'),'')[_0xc056('0x8')]('||');for(var _0x5c1299=0x0;_0x5c1299<_0x369b77[_0xc056('0x9')];_0x5c1299++){var _0x46518d=_0x369b77[_0x5c1299][_0xc056('0x8')](':=');var _0x1612ea=_0x46518d[0x0];var _0x3a34a7=_0x46518d[_0xc056('0xa')](0x1);_0x3a34a7[_0xc056('0xb')](function(_0x116a9b){var _0x22ff87=_0x116a9b[_0xc056('0x8')]('[')['shift']();var _0x15fbef=_0x116a9b[_0xc056('0xc')](/\[(.*?)\]/g);_0x15fbef[_0xc056('0xb')](function(_0x183925){var _0x559574=_0x183925[_0xc056('0x8')]('[')[_0xc056('0xd')](function(_0x452249){return _0x452249[_0xc056('0xe')](']')>-0x1;})[_0xc056('0xf')](function(_0x54166d){return _0x54166d[_0xc056('0x8')](']')[0x0];})[0x0];_0x3726d0['conditions'][_0xc056('0x10')]({'field':_0x1612ea,'operator':_0x22ff87,'value':_0x559574});});});}return _0x3726d0;};exports[_0xc056('0x11')]=function(_0x2d7468,_0xca4513,_0x4ce0f5){var _0x33add7={};if(_0xca4513==='DATE'){if(_0x4ce0f5[_0xc056('0x12')]===_0xc056('0x13')){_0x4ce0f5['operator']=_0xc056('0x14');_0x4ce0f5[_0xc056('0x15')]+=','+_0x4ce0f5[_0xc056('0x15')];}else if(_['includes'](['$gt','$lte'],_0x4ce0f5[_0xc056('0x12')])){_0x4ce0f5[_0xc056('0x15')]=moment(_0x4ce0f5['value'])[_0xc056('0x16')](0x1,_0xc056('0x17'))[_0xc056('0x18')](_0xc056('0x19'));}}if(_0x4ce0f5['castTo']){_0xca4513=_0x4ce0f5[_0xc056('0x1a')];_0x33add7[_0xc056('0x1b')]=_0xc056('0x1c')+_0x2d7468+'.'+_0x4ce0f5[_0xc056('0x1d')]+'\x20AS\x20'+_0x4ce0f5['castTo']+')\x20'+parseOperator(_0x4ce0f5[_0xc056('0x12')]);}else{_0x33add7[_0xc056('0x1b')]=_0x2d7468+'.'+_0x4ce0f5[_0xc056('0x1d')]+'\x20'+parseOperator(_0x4ce0f5['operator']);}if(_[_0xc056('0x1e')]([_0xc056('0x1f'),_0xc056('0x20')],_0x4ce0f5[_0xc056('0x12')]))_0x33add7[_0xc056('0x1b')]='('+_0x33add7[_0xc056('0x1b')]+_0xc056('0x21')+_0x2d7468+'.'+_0x4ce0f5[_0xc056('0x1d')]+_0xc056('0x22');_0x33add7[_0xc056('0x15')]=parseValue(_0xca4513,_0x4ce0f5['operator'],_0x4ce0f5[_0xc056('0x15')]);return _0x33add7;};function parseOperator(_0x56ee56){var _0x3e057b;switch(_0x56ee56){case'$in':_0x3e057b=_0xc056('0x23');break;case _0xc056('0x20'):_0x3e057b='NOT\x20IN\x20?';break;case _0xc056('0x13'):_0x3e057b=_0xc056('0x24');break;case'$ne':_0x3e057b=_0xc056('0x25');break;case'$substring':case _0xc056('0x26'):case _0xc056('0x27'):_0x3e057b=_0xc056('0x28');break;case _0xc056('0x29'):_0x3e057b='<\x20?';break;case _0xc056('0x2a'):_0x3e057b=_0xc056('0x2b');break;case _0xc056('0x2c'):_0x3e057b=_0xc056('0x2d');break;case _0xc056('0x2e'):_0x3e057b='>=\x20?';break;case _0xc056('0x14'):_0x3e057b=_0xc056('0x2f');break;}return _0x3e057b;}function parseValue(_0x577e06,_0x725b5b,_0x5d0ffe){var _0xdcc235={'start':undefined,'end':undefined};switch(_0x725b5b){case _0xc056('0x30'):case _0xc056('0x20'):_0xdcc235[_0xc056('0x31')]=_0x5d0ffe[_0xc056('0x8')](',');break;case'$substring':_0xdcc235[_0xc056('0x31')]='%'+_0x5d0ffe+'%';break;case _0xc056('0x26'):_0xdcc235[_0xc056('0x31')]=_0x5d0ffe+'%';break;case'$endsWith':_0xdcc235[_0xc056('0x31')]='%'+_0x5d0ffe;break;case _0xc056('0x14'):var _0x1e5031=_0x5d0ffe[_0xc056('0x8')](',');var _0x5d0ffe=_0x1e5031['shift']();var _0x5babf5=_0x1e5031[_0xc056('0x32')]();if(_0x577e06===_0xc056('0x33')){_0x5d0ffe=moment(_0x5d0ffe)['utcOffset'](0x0,!![])['format']();_0x5babf5=moment(_0x5babf5)['utcOffset'](0x0,!![])[_0xc056('0x16')](0x17,_0xc056('0x34'))[_0xc056('0x16')](0x3b,_0xc056('0x35'))['add'](0x3b,_0xc056('0x36'))[_0xc056('0x18')]();}_0xdcc235={'start':_0x5d0ffe,'end':_0x5babf5};break;default:_0xdcc235[_0xc056('0x31')]=_0x5d0ffe;break;}return _0xdcc235;} \ No newline at end of file +var _0x4bd9=['match','filter','conditions','push','DATE','operator','$eq','value','includes','$gt','add','days','YYYY-MM-DD','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','$between','start','$endsWith','pop','utcOffset','format','hours','minutes','seconds','lodash','moment','startsWith','[$or]','and','replace','split','length','slice','forEach','shift'];(function(_0x4110b1,_0x1fd4c5){var _0x372a85=function(_0x3accf7){while(--_0x3accf7){_0x4110b1['push'](_0x4110b1['shift']());}};_0x372a85(++_0x1fd4c5);}(_0x4bd9,0x97));var _0x94bd=function(_0x4bc9c3,_0x2b4ee7){_0x4bc9c3=_0x4bc9c3-0x0;var _0x53dfb4=_0x4bd9[_0x4bc9c3];return _0x53dfb4;};'use strict';var _=require(_0x94bd('0x0'));var moment=require(_0x94bd('0x1'));exports['parseSearch']=function(_0x34bbfe){var _0x3dd7ef={'conditions':[]};_0x3dd7ef['sqlOperator']=_[_0x94bd('0x2')](_0x34bbfe,_0x94bd('0x3'))?'or':_0x94bd('0x4');var _0x138d66=_0x34bbfe[_0x94bd('0x5')]('[$and]','')[_0x94bd('0x5')]('[$or]','')[_0x94bd('0x6')]('||');for(var _0x540a4f=0x0;_0x540a4f<_0x138d66[_0x94bd('0x7')];_0x540a4f++){var _0x483695=_0x138d66[_0x540a4f][_0x94bd('0x6')](':=');var _0x2e1abf=_0x483695[0x0];var _0x10da6d=_0x483695[_0x94bd('0x8')](0x1);_0x10da6d[_0x94bd('0x9')](function(_0x264982){var _0x47ff2e=_0x264982[_0x94bd('0x6')]('[')[_0x94bd('0xa')]();var _0x185b4b=_0x264982[_0x94bd('0xb')](/\[(.*?)\]/g);_0x185b4b['forEach'](function(_0x5454b2){var _0x1436d3=_0x5454b2[_0x94bd('0x6')]('[')[_0x94bd('0xc')](function(_0x104e35){return _0x104e35['indexOf'](']')>-0x1;})['map'](function(_0x5ac3a3){return _0x5ac3a3[_0x94bd('0x6')](']')[0x0];})[0x0];_0x3dd7ef[_0x94bd('0xd')][_0x94bd('0xe')]({'field':_0x2e1abf,'operator':_0x47ff2e,'value':_0x1436d3});});});}return _0x3dd7ef;};exports['buildExpression']=function(_0x13a37b,_0x25577c,_0x2b8b8d){var _0x459b0a={};if(_0x25577c===_0x94bd('0xf')){if(_0x2b8b8d[_0x94bd('0x10')]===_0x94bd('0x11')){_0x2b8b8d[_0x94bd('0x10')]='$between';_0x2b8b8d[_0x94bd('0x12')]+=','+_0x2b8b8d[_0x94bd('0x12')];}else if(_[_0x94bd('0x13')]([_0x94bd('0x14'),'$lte'],_0x2b8b8d[_0x94bd('0x10')])){_0x2b8b8d['value']=moment(_0x2b8b8d['value'])[_0x94bd('0x15')](0x1,_0x94bd('0x16'))['format'](_0x94bd('0x17'));}}if(_0x2b8b8d['castTo']){_0x25577c=_0x2b8b8d['castTo'];_0x459b0a[_0x94bd('0x18')]=_0x94bd('0x19')+_0x13a37b+'.'+_0x2b8b8d[_0x94bd('0x1a')]+_0x94bd('0x1b')+_0x2b8b8d['castTo']+')\x20'+parseOperator(_0x2b8b8d[_0x94bd('0x10')]);}else{_0x459b0a[_0x94bd('0x18')]=_0x13a37b+'.'+_0x2b8b8d[_0x94bd('0x1a')]+'\x20'+parseOperator(_0x2b8b8d['operator']);}if(_[_0x94bd('0x13')]([_0x94bd('0x1c'),_0x94bd('0x1d')],_0x2b8b8d[_0x94bd('0x10')]))_0x459b0a[_0x94bd('0x18')]='('+_0x459b0a['text']+'\x20OR\x20'+_0x13a37b+'.'+_0x2b8b8d[_0x94bd('0x1a')]+_0x94bd('0x1e');_0x459b0a['value']=parseValue(_0x25577c,_0x2b8b8d['operator'],_0x2b8b8d[_0x94bd('0x12')]);return _0x459b0a;};function parseOperator(_0x18c188){var _0x30f37c;switch(_0x18c188){case _0x94bd('0x1f'):_0x30f37c=_0x94bd('0x20');break;case _0x94bd('0x1d'):_0x30f37c=_0x94bd('0x21');break;case _0x94bd('0x11'):_0x30f37c=_0x94bd('0x22');break;case'$ne':_0x30f37c=_0x94bd('0x23');break;case _0x94bd('0x24'):case _0x94bd('0x25'):case'$endsWith':_0x30f37c=_0x94bd('0x26');break;case _0x94bd('0x27'):_0x30f37c=_0x94bd('0x28');break;case _0x94bd('0x14'):_0x30f37c=_0x94bd('0x29');break;case'$lte':_0x30f37c=_0x94bd('0x2a');break;case _0x94bd('0x2b'):_0x30f37c=_0x94bd('0x2c');break;case _0x94bd('0x2d'):_0x30f37c='BETWEEN\x20?\x20AND\x20?';break;}return _0x30f37c;}function parseValue(_0x2ab6a4,_0x1176fd,_0x4de104){var _0x148dc8={'start':undefined,'end':undefined};switch(_0x1176fd){case'$in':case'$notIn':_0x148dc8[_0x94bd('0x2e')]=_0x4de104[_0x94bd('0x6')](',');break;case'$substring':_0x148dc8[_0x94bd('0x2e')]='%'+_0x4de104+'%';break;case _0x94bd('0x25'):_0x148dc8[_0x94bd('0x2e')]=_0x4de104+'%';break;case _0x94bd('0x2f'):_0x148dc8['start']='%'+_0x4de104;break;case'$between':var _0x23a1b4=_0x4de104['split'](',');var _0x4de104=_0x23a1b4['shift']();var _0x2403f0=_0x23a1b4[_0x94bd('0x30')]();if(_0x2ab6a4==='DATE'){_0x4de104=moment(_0x4de104)[_0x94bd('0x31')](0x0,!![])[_0x94bd('0x32')]();_0x2403f0=moment(_0x2403f0)['utcOffset'](0x0,!![])['add'](0x17,_0x94bd('0x33'))[_0x94bd('0x15')](0x3b,_0x94bd('0x34'))[_0x94bd('0x15')](0x3b,_0x94bd('0x35'))[_0x94bd('0x32')]();}_0x148dc8={'start':_0x4de104,'end':_0x2403f0};break;default:_0x148dc8[_0x94bd('0x2e')]=_0x4de104;break;}return _0x148dc8;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 382dea3..d20db18 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 _0x6e71=['priority','col','unsigned','ASC','omit','isObject','isString','length','unset','hasOwnProperty','isNumeric','getFullTextValue','{EXPR}','replace','trim','forEach','match','push','join','getOptions','query','$id','model','intersection','attributes','nolimit','where','pick','filter','columns','merge','lower','options','include','includeAll','escapeLIKESpecialChars','lodash','sequelize','moment','../../mysqldb','keys','includes','parse','alias','fields','raw','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','limit','offset','sort','map'];(function(_0x13ed69,_0x229161){var _0x50c72e=function(_0x4f1491){while(--_0x4f1491){_0x13ed69['push'](_0x13ed69['shift']());}};_0x50c72e(++_0x229161);}(_0x6e71,0x67));var _0x16e7=function(_0x37f20f,_0x321935){_0x37f20f=_0x37f20f-0x0;var _0x3639dd=_0x6e71[_0x37f20f];return _0x3639dd;};'use strict';var _=require(_0x16e7('0x0'));var sequelize=require(_0x16e7('0x1'));var moment=require(_0x16e7('0x2'));var db=require(_0x16e7('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x123845){var _0x119387=['ne'];try{var _0x217548=JSON['parse'](_0x123845);var _0xc756f5=Object[_0x16e7('0x4')](_0x217548)[0x0];return _0x119387[_0x16e7('0x5')](_0xc756f5);}catch(_0x4a51fa){return![];}}function getOperatorValue(_0x136f56){var _0x5656d8=JSON[_0x16e7('0x6')](_0x136f56);var _0x312846=Object[_0x16e7('0x4')](_0x5656d8)[0x0];var _0x5749f5=_0x5656d8[_0x312846];return{['$'+_0x312846]:_0x5749f5};}function parseIncludeModel(_0x146575){var _0x4e3cf3=JSON['parse'](_0x146575);return{'model':db[_0x4e3cf3['model']],'as':_0x4e3cf3[_0x16e7('0x7')],'attributes':_0x4e3cf3[_0x16e7('0x8')],'raw':_0x4e3cf3[_0x16e7('0x9')]};}exports[_0x16e7('0x8')]=function(_0x4f49a3){var _0x43a809=null;if(_0x4f49a3){_0x43a809=_0x4f49a3[_0x16e7('0xa')](',');}return _0x43a809;};exports[_0x16e7('0xb')]=function(_0x20ceec,_0x287bec){var _0x41c120={};if(!_[_0x16e7('0xc')](_0x20ceec)){_[_0x16e7('0xd')](_0x20ceec,function(_0x35173a,_0x5796c3){try{if(_0x287bec){var _0x481c56=_[_0x16e7('0xe')](_0x287bec,{'name':_0x5796c3})||{};if(hasSequelizeOperator(_0x35173a)){_0x41c120[_0x5796c3]=getOperatorValue(_0x35173a);}else if(_0x481c56[_0x16e7('0xf')]===_0x16e7('0x10')&&_[_0x16e7('0x11')](_0x35173a)){var _0x2e2af7=JSON[_0x16e7('0x6')](_0x35173a);var _0x49cf2e={'$gte':moment(moment(_0x2e2af7[_0x16e7('0x12')])[_0x16e7('0x13')](_0x16e7('0x14')))[_0x16e7('0x15')]()[_0x16e7('0x13')](),'$lte':moment(moment(_0x2e2af7[_0x16e7('0x16')])[_0x16e7('0x13')]('YYYY-MM-DD'))[_0x16e7('0x15')]()[_0x16e7('0x17')](0x1,'s')[_0x16e7('0x13')]()};_0x41c120[_0x5796c3]=_0x49cf2e;}else if(_0x481c56[_0x16e7('0x18')]===_0x16e7('0x19')){_0x41c120[_0x5796c3]=_0x35173a;}else{_0x41c120[_0x5796c3]=_['isArray'](_0x35173a)?_0x35173a:JSON[_0x16e7('0x6')](_0x35173a);}}else{_0x41c120[_0x5796c3]=_[_0x16e7('0x1a')](_0x35173a)?_0x35173a:JSON[_0x16e7('0x6')](_0x35173a);}}catch(_0x18194c){_0x41c120[_0x5796c3]=_0x35173a[_0x16e7('0xa')](',');}});}return _0x41c120;};exports[_0x16e7('0x1b')]=function(_0x636a64){_0x636a64=parseInt(_0x636a64,0xa);if(!_0x636a64||_0x636a64<0x0){_0x636a64=LIMIT_VALUE;}return _0x636a64;};exports[_0x16e7('0x1c')]=function(_0x35f7b1){_0x35f7b1=parseInt(_0x35f7b1,0xa);if(!_0x35f7b1||_0x35f7b1<0x0){_0x35f7b1=0x0;}return _0x35f7b1;};exports[_0x16e7('0x1d')]=function(_0x124ebb){var _0x16274b,_0xdc9969=null;if(_0x124ebb){_0x16274b=_0x124ebb[_0x16e7('0xa')](',');_0xdc9969=_[_0x16e7('0x1e')](_0x16274b,function(_0x1cc8b2){if(_0x1cc8b2['indexOf']('-')===0x0){return[_0x1cc8b2===_0x16e7('0x1f')?sequelize['cast'](sequelize[_0x16e7('0x20')](_0x16e7('0x1f')),_0x16e7('0x21')):_0x1cc8b2['substr'](0x1),'DESC'];}else{return[_0x1cc8b2===_0x16e7('0x1f')?sequelize['cast'](sequelize[_0x16e7('0x20')]('priority'),_0x16e7('0x21')):_0x1cc8b2,_0x16e7('0x22')];}});}return _0xdc9969;};exports[_0x16e7('0x23')]=function(_0x2358d2,_0x4b118a){if(_[_0x16e7('0xc')](_0x2358d2)){return _0x2358d2;}if(_['isArray'](_0x2358d2)){for(var _0x315677=0x0;_0x315677<_0x2358d2['length'];_0x315677+=0x1){_0x2358d2[_0x315677]=this[_0x16e7('0x23')](_0x2358d2[_0x315677],_0x4b118a);}return _0x2358d2;}if(!_[_0x16e7('0x24')](_0x2358d2)){return _0x2358d2;}if(_[_0x16e7('0x25')](_0x4b118a)){_0x4b118a=[_0x4b118a];}if(!_[_0x16e7('0x1a')](_0x4b118a)){return _0x2358d2;}for(var _0x1177fd=0x0;_0x1177fd<_0x4b118a[_0x16e7('0x26')];_0x1177fd+=0x1){_[_0x16e7('0x27')](_0x2358d2,_0x4b118a[_0x1177fd]);}for(var _0x1df0a0 in _0x2358d2){if(_0x2358d2[_0x16e7('0x28')](_0x1df0a0)){_0x2358d2[_0x1df0a0]=this[_0x16e7('0x23')](_0x2358d2[_0x1df0a0],_0x4b118a);}}return _0x2358d2;};exports[_0x16e7('0x29')]=function(_0x5d2791){return _0x5d2791['match'](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0x2f0aa0){return _0x2f0aa0['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x16e7('0x2a')]=function(_0x52d507,_0x71b9eb){var _0x108e1f=[];var _0x475caa=/([^:]")"+/g;var _0x455728=/[*<>~@-]/g;var _0x323a25=/[ `!@#$%^&*()_\-?~<>]/;var _0x14a41c=/[ ,]+/;var _0x3d570e=_0x71b9eb?'\x22{EXPR}\x22':_0x16e7('0x2b');if(_0x71b9eb){_0x52d507=_0x52d507[_0x16e7('0x2c')](_0x455728,'\x20')[_0x16e7('0x2d')]();}_0x52d507[_0x16e7('0xa')](_0x14a41c)[_0x16e7('0x2e')](function(_0x4f0a96){_0x4f0a96=_0x4f0a96[_0x16e7('0x2c')](_0x475caa,'$1');_0x4f0a96='+'+_0x4f0a96+'*';var _0x2b6d09=_0x4f0a96[_0x16e7('0x2f')](_0x323a25);if(_0x2b6d09){_0x4f0a96='\x22'+_0x4f0a96+'\x22';}_0x108e1f[_0x16e7('0x30')](_0x4f0a96);});_0x3d570e=_0x3d570e[_0x16e7('0x2c')](_0x16e7('0x2b'),_0x108e1f[_0x16e7('0x31')]('\x20'));return _0x3d570e;};exports[_0x16e7('0x32')]=function(_0x38af57,_0x33e3c6,_0x533d37){var _0x29c3c4={},_0x4f7caf={};if(_0x33e3c6['query']['$id']){_0x33e3c6['query']['id']=_0x33e3c6[_0x16e7('0x33')][_0x16e7('0x34')];delete _0x33e3c6['query']['$id'];}_0x29c3c4[_0x16e7('0x35')]=_[_0x16e7('0x1e')](_0x38af57,'name');_0x29c3c4['query']=_[_0x16e7('0x4')](_0x33e3c6[_0x16e7('0x33')]);_0x29c3c4[_0x16e7('0xb')]=_[_0x16e7('0x36')](_0x29c3c4['model'],_0x29c3c4['query']);_0x4f7caf[_0x16e7('0x37')]=_[_0x16e7('0x36')](_0x29c3c4[_0x16e7('0x35')],this[_0x16e7('0x8')](_0x33e3c6['query'][_0x16e7('0x8')]));_0x4f7caf['attributes']=_0x4f7caf[_0x16e7('0x37')][_0x16e7('0x26')]?_0x4f7caf[_0x16e7('0x37')]:_0x29c3c4['model'];if(!_0x33e3c6[_0x16e7('0x33')][_0x16e7('0x28')](_0x16e7('0x38'))){_0x4f7caf[_0x16e7('0x1b')]=this[_0x16e7('0x1b')](_0x33e3c6[_0x16e7('0x33')][_0x16e7('0x1b')]);_0x4f7caf['offset']=this[_0x16e7('0x1c')](_0x33e3c6[_0x16e7('0x33')]['offset']);}_0x4f7caf['order']=this[_0x16e7('0x1d')](_0x33e3c6[_0x16e7('0x33')][_0x16e7('0x1d')]);_0x4f7caf[_0x16e7('0x39')]=this['filters'](_[_0x16e7('0x3a')](_0x33e3c6[_0x16e7('0x33')],_0x29c3c4[_0x16e7('0xb')]),_0x38af57);if(_0x33e3c6[_0x16e7('0x33')][_0x16e7('0x3b')]){var _0x36590a=_0x38af57;var _0xc09390=_0x33e3c6[_0x16e7('0x33')]['filter'];if(typeof _0xc09390==='object'){_0x36590a=_[_0x16e7('0x3b')](_0x38af57,function(_0x51183e){return _['includes'](_0xc09390[_0x16e7('0x3c')],_0x51183e[_0x16e7('0x18')]);});_0xc09390=_0xc09390['value'];}_0x4f7caf[_0x16e7('0x39')]=_[_0x16e7('0x3d')](_0x4f7caf['where'],{'$or':_[_0x16e7('0x1e')](_0x36590a,function(_0x516902){if(_0x516902['type']!=='VIRTUAL'){if(_0x533d37){return sequelize[_0x16e7('0x39')](sequelize['fn']('lower',sequelize[_0x16e7('0x20')](_0x516902[_0x16e7('0x18')])),{'$like':sequelize['fn'](_0x16e7('0x3e'),'%'+_0x33e3c6['query'][_0x16e7('0x3b')]+'%')});}else{var _0x568bfc={};_0x568bfc[_0x516902[_0x16e7('0x18')]]={'$like':'%'+_0x33e3c6[_0x16e7('0x33')][_0x16e7('0x3b')]+'%'};return _0x568bfc;}}})});}_0x4f7caf=_[_0x16e7('0x3d')]({},_0x4f7caf,_0x33e3c6[_0x16e7('0x3f')]);return _0x4f7caf;};exports[_0x16e7('0x40')]=function(_0x3de70c){var _0x5561ae=[];if(_0x3de70c[_0x16e7('0x41')]){_0x5561ae[_0x16e7('0x30')]({'all':!![]});}else if(_0x3de70c[_0x16e7('0x40')]){if(Array[_0x16e7('0x1a')](_0x3de70c['include'])){_0x5561ae=Object[_0x16e7('0x4')](_0x3de70c[_0x16e7('0x40')])[_0x16e7('0x1e')](function(_0x4c4c1b){return parseIncludeModel(_0x3de70c[_0x16e7('0x40')][_0x4c4c1b]);});}else{var _0x2ba77c=parseIncludeModel(_0x3de70c['include']);_0x5561ae['push'](_0x2ba77c);}}return _0x5561ae;};exports[_0x16e7('0x42')]=function(_0x51a5b3){return _0x51a5b3[_0x16e7('0x2c')](/[%_^-]/g,function(_0xb15320){return'\x5c'+_0xb15320;});}; \ No newline at end of file +var _0x6d71=['{EXPR}','trim','match','push','join','query','$id','intersection','attributes','nolimit','where','pick','filter','value','merge','VIRTUAL','lower','options','include','includeAll','lodash','moment','../../mysqldb','parse','includes','keys','model','fields','raw','split','filters','isEmpty','forOwn','type','DATE','isPlainObject','format','YYYY-MM-DD','utc','name','isArray','limit','offset','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','isObject','isString','length','unset','hasOwnProperty','isNumeric','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22'];(function(_0x534c7a,_0x2d5c89){var _0xf5eb5f=function(_0x9fdd84){while(--_0x9fdd84){_0x534c7a['push'](_0x534c7a['shift']());}};_0xf5eb5f(++_0x2d5c89);}(_0x6d71,0xd4));var _0x16d7=function(_0x410256,_0x4cfe9f){_0x410256=_0x410256-0x0;var _0x18ce0f=_0x6d71[_0x410256];return _0x18ce0f;};'use strict';var _=require(_0x16d7('0x0'));var sequelize=require('sequelize');var moment=require(_0x16d7('0x1'));var db=require(_0x16d7('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x5e77da){var _0x37b2eb=['ne'];try{var _0x5dab2d=JSON[_0x16d7('0x3')](_0x5e77da);var _0x5b9170=Object['keys'](_0x5dab2d)[0x0];return _0x37b2eb[_0x16d7('0x4')](_0x5b9170);}catch(_0x2cf178){return![];}}function getOperatorValue(_0x59e516){var _0x1f06c0=JSON[_0x16d7('0x3')](_0x59e516);var _0x3fbc77=Object[_0x16d7('0x5')](_0x1f06c0)[0x0];var _0x4888fa=_0x1f06c0[_0x3fbc77];return{['$'+_0x3fbc77]:_0x4888fa};}function parseIncludeModel(_0x2efe5a){var _0x4c1500=JSON['parse'](_0x2efe5a);return{'model':db[_0x4c1500[_0x16d7('0x6')]],'as':_0x4c1500['alias'],'attributes':_0x4c1500[_0x16d7('0x7')],'raw':_0x4c1500[_0x16d7('0x8')]};}exports[_0x16d7('0x7')]=function(_0x2d3bc5){var _0x1b7167=null;if(_0x2d3bc5){_0x1b7167=_0x2d3bc5[_0x16d7('0x9')](',');}return _0x1b7167;};exports[_0x16d7('0xa')]=function(_0x4c1331,_0x1098dd){var _0x237f38={};if(!_[_0x16d7('0xb')](_0x4c1331)){_[_0x16d7('0xc')](_0x4c1331,function(_0x329fec,_0x3430fe){try{if(_0x1098dd){var _0x568cc0=_['find'](_0x1098dd,{'name':_0x3430fe})||{};if(hasSequelizeOperator(_0x329fec)){_0x237f38[_0x3430fe]=getOperatorValue(_0x329fec);}else if(_0x568cc0[_0x16d7('0xd')]===_0x16d7('0xe')&&_[_0x16d7('0xf')](_0x329fec)){var _0x28e21e=JSON[_0x16d7('0x3')](_0x329fec);var _0x3ca4ff={'$gte':moment(moment(_0x28e21e['$gte'])[_0x16d7('0x10')](_0x16d7('0x11')))['utc']()[_0x16d7('0x10')](),'$lte':moment(moment(_0x28e21e['$lte'])['format']('YYYY-MM-DD'))[_0x16d7('0x12')]()['subtract'](0x1,'s')[_0x16d7('0x10')]()};_0x237f38[_0x3430fe]=_0x3ca4ff;}else if(_0x568cc0[_0x16d7('0x13')]==='uniqueid'){_0x237f38[_0x3430fe]=_0x329fec;}else{_0x237f38[_0x3430fe]=_[_0x16d7('0x14')](_0x329fec)?_0x329fec:JSON[_0x16d7('0x3')](_0x329fec);}}else{_0x237f38[_0x3430fe]=_[_0x16d7('0x14')](_0x329fec)?_0x329fec:JSON[_0x16d7('0x3')](_0x329fec);}}catch(_0x1a3492){_0x237f38[_0x3430fe]=_0x329fec[_0x16d7('0x9')](',');}});}return _0x237f38;};exports[_0x16d7('0x15')]=function(_0x29f92b){_0x29f92b=parseInt(_0x29f92b,0xa);if(!_0x29f92b||_0x29f92b<0x0){_0x29f92b=LIMIT_VALUE;}return _0x29f92b;};exports[_0x16d7('0x16')]=function(_0x111c14){_0x111c14=parseInt(_0x111c14,0xa);if(!_0x111c14||_0x111c14<0x0){_0x111c14=0x0;}return _0x111c14;};exports[_0x16d7('0x17')]=function(_0x3d6271){var _0x17f093,_0x2679c3=null;if(_0x3d6271){_0x17f093=_0x3d6271[_0x16d7('0x9')](',');_0x2679c3=_[_0x16d7('0x18')](_0x17f093,function(_0x21d0f6){if(_0x21d0f6[_0x16d7('0x19')]('-')===0x0){return[_0x21d0f6===_0x16d7('0x1a')?sequelize[_0x16d7('0x1b')](sequelize[_0x16d7('0x1c')](_0x16d7('0x1a')),_0x16d7('0x1d')):_0x21d0f6[_0x16d7('0x1e')](0x1),_0x16d7('0x1f')];}else{return[_0x21d0f6===_0x16d7('0x1a')?sequelize[_0x16d7('0x1b')](sequelize['col']('priority'),_0x16d7('0x1d')):_0x21d0f6,_0x16d7('0x20')];}});}return _0x2679c3;};exports[_0x16d7('0x21')]=function(_0x1b8e5e,_0x5d466e){if(_[_0x16d7('0xb')](_0x1b8e5e)){return _0x1b8e5e;}if(_[_0x16d7('0x14')](_0x1b8e5e)){for(var _0x129c09=0x0;_0x129c09<_0x1b8e5e['length'];_0x129c09+=0x1){_0x1b8e5e[_0x129c09]=this['omit'](_0x1b8e5e[_0x129c09],_0x5d466e);}return _0x1b8e5e;}if(!_[_0x16d7('0x22')](_0x1b8e5e)){return _0x1b8e5e;}if(_[_0x16d7('0x23')](_0x5d466e)){_0x5d466e=[_0x5d466e];}if(!_[_0x16d7('0x14')](_0x5d466e)){return _0x1b8e5e;}for(var _0xbb7bf9=0x0;_0xbb7bf9<_0x5d466e[_0x16d7('0x24')];_0xbb7bf9+=0x1){_[_0x16d7('0x25')](_0x1b8e5e,_0x5d466e[_0xbb7bf9]);}for(var _0x54a065 in _0x1b8e5e){if(_0x1b8e5e[_0x16d7('0x26')](_0x54a065)){_0x1b8e5e[_0x54a065]=this[_0x16d7('0x21')](_0x1b8e5e[_0x54a065],_0x5d466e);}}return _0x1b8e5e;};exports[_0x16d7('0x27')]=function(_0x1d7395){return _0x1d7395['match'](RegExp(_0x16d7('0x28')))?!![]:![];};exports[_0x16d7('0x29')]=function(_0x63bf28){return _0x63bf28['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x16d7('0x2a')]=function(_0x4afce0,_0x3a9f39){var _0x4012ca=[];var _0x2d0e20=/([^:]")"+/g;var _0x2b5829=/[*<>~@-]/g;var _0x427dbb=/[ `!@#$%^&*()_\-?~<>]/;var _0x172ccd=/[ ,]+/;var _0x22354a=_0x3a9f39?_0x16d7('0x2b'):_0x16d7('0x2c');if(_0x3a9f39){_0x4afce0=_0x4afce0['replace'](_0x2b5829,'\x20')[_0x16d7('0x2d')]();}_0x4afce0['split'](_0x172ccd)['forEach'](function(_0x543724){_0x543724=_0x543724['replace'](_0x2d0e20,'$1');_0x543724='+'+_0x543724+'*';var _0x614339=_0x543724[_0x16d7('0x2e')](_0x427dbb);if(_0x614339){_0x543724='\x22'+_0x543724+'\x22';}_0x4012ca[_0x16d7('0x2f')](_0x543724);});_0x22354a=_0x22354a['replace'](_0x16d7('0x2c'),_0x4012ca[_0x16d7('0x30')]('\x20'));return _0x22354a;};exports['getOptions']=function(_0x28d01a,_0x275747,_0x1c7754){var _0x4123fa={},_0x4e8684={};if(_0x275747[_0x16d7('0x31')][_0x16d7('0x32')]){_0x275747[_0x16d7('0x31')]['id']=_0x275747[_0x16d7('0x31')][_0x16d7('0x32')];delete _0x275747['query'][_0x16d7('0x32')];}_0x4123fa[_0x16d7('0x6')]=_[_0x16d7('0x18')](_0x28d01a,_0x16d7('0x13'));_0x4123fa[_0x16d7('0x31')]=_[_0x16d7('0x5')](_0x275747[_0x16d7('0x31')]);_0x4123fa['filters']=_[_0x16d7('0x33')](_0x4123fa[_0x16d7('0x6')],_0x4123fa[_0x16d7('0x31')]);_0x4e8684['attributes']=_[_0x16d7('0x33')](_0x4123fa['model'],this[_0x16d7('0x7')](_0x275747[_0x16d7('0x31')][_0x16d7('0x7')]));_0x4e8684[_0x16d7('0x34')]=_0x4e8684[_0x16d7('0x34')][_0x16d7('0x24')]?_0x4e8684[_0x16d7('0x34')]:_0x4123fa['model'];if(!_0x275747[_0x16d7('0x31')]['hasOwnProperty'](_0x16d7('0x35'))){_0x4e8684[_0x16d7('0x15')]=this[_0x16d7('0x15')](_0x275747[_0x16d7('0x31')][_0x16d7('0x15')]);_0x4e8684[_0x16d7('0x16')]=this[_0x16d7('0x16')](_0x275747[_0x16d7('0x31')][_0x16d7('0x16')]);}_0x4e8684['order']=this[_0x16d7('0x17')](_0x275747[_0x16d7('0x31')][_0x16d7('0x17')]);_0x4e8684[_0x16d7('0x36')]=this['filters'](_[_0x16d7('0x37')](_0x275747[_0x16d7('0x31')],_0x4123fa[_0x16d7('0xa')]),_0x28d01a);if(_0x275747[_0x16d7('0x31')][_0x16d7('0x38')]){var _0x458765=_0x28d01a;var _0x2362f6=_0x275747[_0x16d7('0x31')][_0x16d7('0x38')];if(typeof _0x2362f6==='object'){_0x458765=_[_0x16d7('0x38')](_0x28d01a,function(_0x20a945){return _['includes'](_0x2362f6['columns'],_0x20a945['name']);});_0x2362f6=_0x2362f6[_0x16d7('0x39')];}_0x4e8684[_0x16d7('0x36')]=_[_0x16d7('0x3a')](_0x4e8684[_0x16d7('0x36')],{'$or':_['map'](_0x458765,function(_0x3db8ec){if(_0x3db8ec[_0x16d7('0xd')]!==_0x16d7('0x3b')){if(_0x1c7754){return sequelize[_0x16d7('0x36')](sequelize['fn'](_0x16d7('0x3c'),sequelize[_0x16d7('0x1c')](_0x3db8ec[_0x16d7('0x13')])),{'$like':sequelize['fn']('lower','%'+_0x275747['query'][_0x16d7('0x38')]+'%')});}else{var _0x273fe5={};_0x273fe5[_0x3db8ec[_0x16d7('0x13')]]={'$like':'%'+_0x275747[_0x16d7('0x31')]['filter']+'%'};return _0x273fe5;}}})});}_0x4e8684=_['merge']({},_0x4e8684,_0x275747[_0x16d7('0x3d')]);return _0x4e8684;};exports[_0x16d7('0x3e')]=function(_0x26629){var _0x1a6fcd=[];if(_0x26629[_0x16d7('0x3f')]){_0x1a6fcd[_0x16d7('0x2f')]({'all':!![]});}else if(_0x26629[_0x16d7('0x3e')]){if(Array[_0x16d7('0x14')](_0x26629[_0x16d7('0x3e')])){_0x1a6fcd=Object['keys'](_0x26629[_0x16d7('0x3e')])[_0x16d7('0x18')](function(_0x57271b){return parseIncludeModel(_0x26629[_0x16d7('0x3e')][_0x57271b]);});}else{var _0x3a475c=parseIncludeModel(_0x26629[_0x16d7('0x3e')]);_0x1a6fcd['push'](_0x3a475c);}}return _0x1a6fcd;};exports['escapeLIKESpecialChars']=function(_0x37634b){return _0x37634b['replace'](/[%_^-]/g,function(_0x4f0f78){return'\x5c'+_0x4f0f78;});}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index b4e9346..db06412 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 _0x5ed9=['jayson/promise','client','http','chatPause','mailPause','smsPause','voicePause','whatsappPause','every','filter','length','unknown','ringing','isNil','voiceStatus','idle','pause','mailStatus','openchannelStatus','smsStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','getAgents','all','flatten','value','getAgentIdsByQueues','includes','User','name','fullname','openchannelPause','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','fullname,internal','internal','substring','indexOf','sort','DESC','pauseType','toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','lastPauseAt','faxPause','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus','whatsappStatus','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','screenrecording','phoneBarEnableAutomaticScreenRecording','omit','pick','filterAgentAttributes','role','online','chatCapacity','destconnectedlinenum','onhold','queue','getRealtimeAgentsQueryFields','lodash'];(function(_0x25b8b1,_0xe0b951){var _0x2d04f7=function(_0x1a45b8){while(--_0x1a45b8){_0x25b8b1['push'](_0x25b8b1['shift']());}};_0x2d04f7(++_0xe0b951);}(_0x5ed9,0x1e9));var _0x95ed=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5ed9[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x95ed('0x0'));var jayson=require(_0x95ed('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x95ed('0x2')][_0x95ed('0x3')]({'port':0x232a});var routingClient=jayson[_0x95ed('0x2')][_0x95ed('0x3')]({'port':0x232c});function isAgentPaused(_0x5a9572,_0x3cb5d1){var _0x991cf8=[_0x5a9572[_0x95ed('0x4')],_0x5a9572['faxPause'],_0x5a9572[_0x95ed('0x5')],_0x5a9572['openchannelPause'],_0x5a9572[_0x95ed('0x6')],_0x5a9572[_0x95ed('0x7')],_0x5a9572[_0x95ed('0x8')]];if(!_0x3cb5d1)return _[_0x95ed('0x9')](_0x991cf8);var _0x46ed43=_[_0x95ed('0xa')](_0x991cf8);return _0x46ed43['length']>0x0&&_0x46ed43[_0x95ed('0xb')]<_0x991cf8[_0x95ed('0xb')]?!![]:![];}function isIdle(_0x295fd7){return _0x295fd7==='idle'||_0x295fd7===_0x95ed('0xc')||_0x295fd7==='unavailable'||_0x295fd7===_0x95ed('0xd')||_[_0x95ed('0xe')](_0x295fd7);}function isAgentIdle(_0x2d4091){if(_0x2d4091[_0x95ed('0xf')]!==_0x95ed('0x10')&&_0x2d4091['voicePause']){_0x2d4091['voiceStatus']=_0x95ed('0x11');return![];}return _[_0x95ed('0x9')]([_0x2d4091['chatStatus'],_0x2d4091['faxStatus'],_0x2d4091[_0x95ed('0x12')],_0x2d4091[_0x95ed('0x13')],_0x2d4091[_0x95ed('0x14')],_0x2d4091[_0x95ed('0xf')],_0x2d4091['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0x95ed('0x15')](_0x95ed('0x16'),{})[_0x95ed('0x17')](function(_0x597a04){if(_0x597a04[_0x95ed('0x18')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x23c63f=_0x597a04['result'];return routingClient['request']('Agents',{})[_0x95ed('0x17')](function(_0x58fb9e){if(_0x58fb9e[_0x95ed('0x18')]){throw new Error(_0x95ed('0x19'));}var _0x4ad26d=_0x58fb9e[_0x95ed('0x1a')];return _[_0x95ed('0x1b')]({},_0x23c63f,_0x4ad26d);});})[_0x95ed('0x1c')](function(_0x2a8dc3){throw _0x2a8dc3;});}exports[_0x95ed('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x41efe4){var _0x2d427e=_0x95ed('0xc');if(isAgentPaused(_0x41efe4))_0x2d427e=_0x95ed('0x11');else if(isAgentPaused(_0x41efe4,!![]))_0x2d427e=_0x95ed('0x1e');else if(isAgentIdle(_0x41efe4))_0x2d427e='idle';else _0x2d427e=_0x95ed('0x1f');return _0x2d427e;}exports[_0x95ed('0x20')]=getAgentStatus;function getAgentIdsByQueues(_0x4e8a5d,_0x5d5afe){var _0x54c5ae=_[_0x95ed('0x21')](_0x4e8a5d)?_0x4e8a5d:[_0x4e8a5d];var _0x226a60=_[_0x95ed('0x22')](_0x5d5afe)+_0x95ed('0x23');var _0x2c0824=_[_0x95ed('0x24')](_0x54c5ae,function(_0x3ef74c){return db[_0x226a60][_0x95ed('0x25')]({'where':{'id':_0x3ef74c}})[_0x95ed('0x17')](function(_0x3bcb6d){if(!_0x3bcb6d)return[];return _0x3bcb6d[_0x95ed('0x26')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x95ed('0x27')](_0x2c0824)[_0x95ed('0x17')](function(_0x25b1fc){var _0x51ca8b=_(_0x25b1fc)[_0x95ed('0x28')]()['map']('id')['uniq']()[_0x95ed('0x29')]();return _0x51ca8b;});}exports[_0x95ed('0x2a')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x45e403,_0x3096ad,_0x2d5042){try{if(_0x3096ad[_0x95ed('0xb')]>0x0){_0x45e403=_0x45e403[_0x95ed('0xa')](function(_0x190620){return _0x3096ad[_0x95ed('0x2b')](_0x190620['id']);});}var _0x3f3ed9=_0x45e403[_0x95ed('0xa')](function(_0x3a8841){var _0x5c3a7f=_0x95ed('0x1f');if(isAgentIdle(_0x3a8841)){_0x5c3a7f=_0x95ed('0x10');}return _0x5c3a7f===_0x2d5042;});return _['map'](_0x3f3ed9,'id');}catch(_0x28c738){throw _0x28c738;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x5365ae,_0x5d550a,_0x5ecbb5){return Promise['resolve']()[_0x95ed('0x17')](function(){if(_0x5d550a[_0x95ed('0xb')]>0x0){_0x5365ae=_0x5365ae[_0x95ed('0xa')](function(_0x20f565){return _0x5d550a[_0x95ed('0x2b')](_0x20f565['id']);});}return _0x5365ae;})[_0x95ed('0x17')](function(){return db[_0x95ed('0x2c')]['findAll']({'attributes':['id',_0x95ed('0x2d'),_0x95ed('0x2e'),_0x95ed('0x4'),'faxPause','mailPause',_0x95ed('0x2f'),'smsPause','voicePause','whatsappPause','pauseType'],'where':{'id':{'$in':_[_0x95ed('0x24')](_0x5365ae,'id')}},'raw':!![]});})['then'](function(_0x15c1b5){return _0x15c1b5[_0x95ed('0x24')](function(_0x519598){var _0x57c2e2=_['find'](_0x5365ae,['id',_0x519598['id']]);var _0x4e9c3d=filterAgentAttributes(_0x57c2e2);_['merge'](_0x519598,_0x4e9c3d);_0x519598[_0x95ed('0x30')]=getAgentStatus(_0x519598);return _0x519598;});})[_0x95ed('0x17')](function(_0x3a2fe0){var _0x32a95f=sortAgentsByStatus(_0x3a2fe0,_0x5ecbb5);return _[_0x95ed('0x24')](_0x32a95f,'id');})[_0x95ed('0x1c')](function(_0x564410){throw _0x564410;});}exports[_0x95ed('0x31')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0xa6dc11){var _0x46aa73={'fields':[],'order':null};var _0x5218a3=_0xa6dc11[_0x95ed('0x32')](',');_0x46aa73[_0x95ed('0x33')]=_[_0x95ed('0xa')](_0x5218a3,function(_0x2170c5){if(!_0x2170c5[_0x95ed('0x2b')](_0x95ed('0x30'))){return!![];}_0x46aa73[_0x95ed('0x34')]=_[_0x95ed('0x35')](_0x2170c5,'-')?'DESC':'ASC';return![];});return _0x46aa73;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x2b6292){if(!_0x2b6292){_0x2b6292=_0x95ed('0x36');}if(_0x2b6292[_0x95ed('0x2b')](_0x95ed('0x2e'))&&!_0x2b6292[_0x95ed('0x2b')](_0x95ed('0x37'))){var _0x4b9e16=_0x2b6292[_0x95ed('0x38')](0x0,_0x2b6292[_0x95ed('0x39')](_0x95ed('0x2e')));_0x2b6292+=','+_0x4b9e16+'internal';}return _0x2b6292;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x284948,_0x17ee3f){var _0x2dfae2=_0x284948[_0x95ed('0x3a')](function(_0x3754a7,_0x5c4c54){if(_0x3754a7['globalStatus']===_0x5c4c54[_0x95ed('0x30')]){if(_0x3754a7[_0x95ed('0x30')]===_0x95ed('0x11')){if(_0x17ee3f===_0x95ed('0x3b')){return(_0x3754a7['pauseType']||'')<(_0x5c4c54[_0x95ed('0x3c')]||'')||_0x3754a7['fullname'][_0x95ed('0x3d')]()>_0x5c4c54[_0x95ed('0x2e')][_0x95ed('0x3d')]()?0x1:-0x1;}else{return(_0x3754a7['pauseType']||'')<(_0x5c4c54[_0x95ed('0x3c')]||'')||_0x3754a7[_0x95ed('0x2e')][_0x95ed('0x3d')]()>_0x5c4c54['fullname']['toLowerCase']()?-0x1:0x1;}}else{if(_0x17ee3f===_0x95ed('0x3b')){return _0x3754a7['fullname'][_0x95ed('0x3d')]()<_0x5c4c54['fullname'][_0x95ed('0x3d')]()?0x1:-0x1;}else{return _0x3754a7[_0x95ed('0x2e')][_0x95ed('0x3d')]()<_0x5c4c54[_0x95ed('0x2e')][_0x95ed('0x3d')]()?-0x1:0x1;}}}else{if(_0x17ee3f==='DESC'){return _0x3754a7[_0x95ed('0x30')]<_0x5c4c54[_0x95ed('0x30')]?0x1:-0x1;}else{return _0x3754a7[_0x95ed('0x30')]<_0x5c4c54['globalStatus']?-0x1:0x1;}}});return _0x2dfae2;}exports[_0x95ed('0x3e')]=sortAgentsByStatus;function filterAgentAttributes(_0x5e8c88){var _0x9cac30=[_0x95ed('0x3f'),'online',_0x95ed('0x40'),_0x95ed('0x41'),'pauseType','lastPauseAt',_0x95ed('0x37'),'address',_0x95ed('0x4'),'openchannelPause',_0x95ed('0x5'),_0x95ed('0x6'),_0x95ed('0x8'),_0x95ed('0x42'),_0x95ed('0x7'),'chatCapacity',_0x95ed('0x43'),_0x95ed('0x44'),_0x95ed('0x45'),_0x95ed('0x46'),_0x95ed('0x47'),_0x95ed('0x48'),_0x95ed('0x49'),_0x95ed('0x4a'),_0x95ed('0x4b'),_0x95ed('0x4c'),_0x95ed('0x4d'),_0x95ed('0x4e'),_0x95ed('0x13'),'mailStatus',_0x95ed('0x14'),_0x95ed('0x4f'),'faxStatus',_0x95ed('0xf'),'chatStatusTime',_0x95ed('0x50'),_0x95ed('0x51'),_0x95ed('0x52'),_0x95ed('0x53'),_0x95ed('0x54'),_0x95ed('0x55'),'queue','destconnectedlinenum',_0x95ed('0x56'),'phoneBarEnableScreenRecordingByAgent',_0x95ed('0x57')];var _0xeed7e9=['chatPause',_0x95ed('0x2f'),_0x95ed('0x5'),_0x95ed('0x6'),_0x95ed('0x8'),'faxPause','voicePause','online'];var _0xa0e671=_(_0x5e8c88)[_0x95ed('0x58')](_0xeed7e9)[_0x95ed('0x59')](_0x9cac30)[_0x95ed('0x29')]();return _0xa0e671;}exports[_0x95ed('0x5a')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x95ed('0x2d'),'fullname',_0x95ed('0x5b'),_0x95ed('0x37'),_0x95ed('0x5c'),_0x95ed('0x30'),_0x95ed('0x3f'),'lastLoginAt','pauseType',_0x95ed('0x41'),_0x95ed('0x42'),'chatPause','mailPause',_0x95ed('0x2f'),_0x95ed('0x6'),_0x95ed('0x7'),'whatsappPause','chatStatus','faxStatus',_0x95ed('0x12'),'openchannelStatus',_0x95ed('0x14'),_0x95ed('0xf'),_0x95ed('0x4f'),'chatStatusTime',_0x95ed('0x54'),_0x95ed('0x51'),_0x95ed('0x50'),_0x95ed('0x52'),_0x95ed('0x55'),_0x95ed('0x53'),_0x95ed('0x5d'),'faxCapacity',_0x95ed('0x44'),_0x95ed('0x43'),_0x95ed('0x45'),'whatsappCapacity','chatCurrentCapacity',_0x95ed('0x4d'),'mailCurrentCapacity',_0x95ed('0x49'),_0x95ed('0x4b'),_0x95ed('0x4c'),'phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording',_0x95ed('0x5e'),_0x95ed('0x5f'),_0x95ed('0x60'),_0x95ed('0x56')];}exports[_0x95ed('0x61')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0xaf60=['indexOf','sort','pauseType','toLowerCase','userpic','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','whatsappCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','faxCurrentCapacity','faxStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','queue','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','online','pick','filterAgentAttributes','openchannelStatus','faxStatusTime','faxCapacity','smsCapacity','smsCurrentCapacity','whatsappCurrentCapacity','onhold','lodash','jayson/promise','../../mysqldb','client','chatPause','faxPause','mailPause','openchannelPause','smsPause','whatsappPause','every','filter','length','unknown','ringing','voiceStatus','idle','voicePause','pause','chatStatus','mailStatus','smsStatus','whatsappStatus','request','Agents','then','result','catch','*pause','busy','isArray','startCase','map','findOne','getAgents','flatten','uniq','value','includes','getAgentIdsByStatus','User','fullname','find','merge','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','ASC','getUpdatedSortOptions','fullname,internal','internal','substring'];(function(_0x43cb5d,_0x5cb85c){var _0x21a488=function(_0x34f7ec){while(--_0x34f7ec){_0x43cb5d['push'](_0x43cb5d['shift']());}};_0x21a488(++_0x5cb85c);}(_0xaf60,0x82));var _0x0af6=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xaf60[_0x102e37];return _0x35a07c;};'use strict';var _=require(_0x0af6('0x0'));var jayson=require(_0x0af6('0x1'));var db=require(_0x0af6('0x2'))['db'];var amiClient=jayson['client']['http']({'port':0x232a});var routingClient=jayson[_0x0af6('0x3')]['http']({'port':0x232c});function isAgentPaused(_0x4e62b7,_0xbb4bdd){var _0x3e1023=[_0x4e62b7[_0x0af6('0x4')],_0x4e62b7[_0x0af6('0x5')],_0x4e62b7[_0x0af6('0x6')],_0x4e62b7[_0x0af6('0x7')],_0x4e62b7[_0x0af6('0x8')],_0x4e62b7['voicePause'],_0x4e62b7[_0x0af6('0x9')]];if(!_0xbb4bdd)return _[_0x0af6('0xa')](_0x3e1023);var _0x525bcc=_[_0x0af6('0xb')](_0x3e1023);return _0x525bcc[_0x0af6('0xc')]>0x0&&_0x525bcc[_0x0af6('0xc')]<_0x3e1023['length']?!![]:![];}function isIdle(_0x5f1492){return _0x5f1492==='idle'||_0x5f1492===_0x0af6('0xd')||_0x5f1492==='unavailable'||_0x5f1492===_0x0af6('0xe')||_['isNil'](_0x5f1492);}function isAgentIdle(_0x5d2b35){if(_0x5d2b35[_0x0af6('0xf')]!==_0x0af6('0x10')&&_0x5d2b35[_0x0af6('0x11')]){_0x5d2b35['voiceStatus']=_0x0af6('0x12');return![];}return _[_0x0af6('0xa')]([_0x5d2b35[_0x0af6('0x13')],_0x5d2b35['faxStatus'],_0x5d2b35[_0x0af6('0x14')],_0x5d2b35['openchannelStatus'],_0x5d2b35[_0x0af6('0x15')],_0x5d2b35['voiceStatus'],_0x5d2b35[_0x0af6('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x0af6('0x17')](_0x0af6('0x18'),{})[_0x0af6('0x19')](function(_0x53fb83){if(_0x53fb83['error']){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x48051a=_0x53fb83['result'];return routingClient[_0x0af6('0x17')](_0x0af6('0x18'),{})[_0x0af6('0x19')](function(_0x2bd5c0){if(_0x2bd5c0['error']){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x4bf9b8=_0x2bd5c0[_0x0af6('0x1a')];return _['merge']({},_0x48051a,_0x4bf9b8);});})[_0x0af6('0x1b')](function(_0xa1c5f6){throw _0xa1c5f6;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x1d6b30){var _0x340260=_0x0af6('0xd');if(isAgentPaused(_0x1d6b30))_0x340260='pause';else if(isAgentPaused(_0x1d6b30,!![]))_0x340260=_0x0af6('0x1c');else if(isAgentIdle(_0x1d6b30))_0x340260=_0x0af6('0x10');else _0x340260=_0x0af6('0x1d');return _0x340260;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x48a50f,_0x4adb2b){var _0xfd5351=_[_0x0af6('0x1e')](_0x48a50f)?_0x48a50f:[_0x48a50f];var _0x30c596=_[_0x0af6('0x1f')](_0x4adb2b)+'Queue';var _0x3aae56=_[_0x0af6('0x20')](_0xfd5351,function(_0x3fac44){return db[_0x30c596][_0x0af6('0x21')]({'where':{'id':_0x3fac44}})['then'](function(_0x37d0aa){if(!_0x37d0aa)return[];return _0x37d0aa[_0x0af6('0x22')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x3aae56)[_0x0af6('0x19')](function(_0x49e4c8){var _0x5fbff4=_(_0x49e4c8)[_0x0af6('0x23')]()[_0x0af6('0x20')]('id')[_0x0af6('0x24')]()[_0x0af6('0x25')]();return _0x5fbff4;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x4f16d5,_0x49a7be,_0x25e378){try{if(_0x49a7be[_0x0af6('0xc')]>0x0){_0x4f16d5=_0x4f16d5[_0x0af6('0xb')](function(_0x4da5d0){return _0x49a7be[_0x0af6('0x26')](_0x4da5d0['id']);});}var _0x29e57b=_0x4f16d5['filter'](function(_0x526998){var _0x47afe2=_0x0af6('0x1d');if(isAgentIdle(_0x526998)){_0x47afe2=_0x0af6('0x10');}return _0x47afe2===_0x25e378;});return _['map'](_0x29e57b,'id');}catch(_0x412388){throw _0x412388;}}exports[_0x0af6('0x27')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x4673b8,_0x1dc221,_0x53ec8a){return Promise['resolve']()[_0x0af6('0x19')](function(){if(_0x1dc221[_0x0af6('0xc')]>0x0){_0x4673b8=_0x4673b8['filter'](function(_0x5d9dda){return _0x1dc221[_0x0af6('0x26')](_0x5d9dda['id']);});}return _0x4673b8;})[_0x0af6('0x19')](function(){return db[_0x0af6('0x28')]['findAll']({'attributes':['id','name',_0x0af6('0x29'),_0x0af6('0x4'),_0x0af6('0x5'),'mailPause',_0x0af6('0x7'),_0x0af6('0x8'),'voicePause','whatsappPause','pauseType'],'where':{'id':{'$in':_[_0x0af6('0x20')](_0x4673b8,'id')}},'raw':!![]});})[_0x0af6('0x19')](function(_0x1b723e){return _0x1b723e[_0x0af6('0x20')](function(_0x218d02){var _0x5de5e5=_[_0x0af6('0x2a')](_0x4673b8,['id',_0x218d02['id']]);var _0x1a1f70=filterAgentAttributes(_0x5de5e5);_[_0x0af6('0x2b')](_0x218d02,_0x1a1f70);_0x218d02[_0x0af6('0x2c')]=getAgentStatus(_0x218d02);return _0x218d02;});})['then'](function(_0x396877){var _0x552282=sortAgentsByStatus(_0x396877,_0x53ec8a);return _[_0x0af6('0x20')](_0x552282,'id');})['catch'](function(_0x50cb22){throw _0x50cb22;});}exports[_0x0af6('0x2d')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x160e3b){var _0x174e83={'fields':[],'order':null};var _0x17caf4=_0x160e3b[_0x0af6('0x2e')](',');_0x174e83[_0x0af6('0x2f')]=_[_0x0af6('0xb')](_0x17caf4,function(_0x4e5a0b){if(!_0x4e5a0b[_0x0af6('0x26')](_0x0af6('0x2c'))){return!![];}_0x174e83[_0x0af6('0x30')]=_[_0x0af6('0x31')](_0x4e5a0b,'-')?_0x0af6('0x32'):_0x0af6('0x33');return![];});return _0x174e83;}exports[_0x0af6('0x34')]=getUpdatedSortOptions;function validateSortParameter(_0x133b43){if(!_0x133b43){_0x133b43=_0x0af6('0x35');}if(_0x133b43[_0x0af6('0x26')](_0x0af6('0x29'))&&!_0x133b43[_0x0af6('0x26')](_0x0af6('0x36'))){var _0x279e38=_0x133b43[_0x0af6('0x37')](0x0,_0x133b43[_0x0af6('0x38')](_0x0af6('0x29')));_0x133b43+=','+_0x279e38+_0x0af6('0x36');}return _0x133b43;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x4cf573,_0xbcb362){var _0xba11d6=_0x4cf573[_0x0af6('0x39')](function(_0x18b795,_0x3fceca){if(_0x18b795[_0x0af6('0x2c')]===_0x3fceca['globalStatus']){if(_0x18b795[_0x0af6('0x2c')]===_0x0af6('0x12')){if(_0xbcb362===_0x0af6('0x32')){return(_0x18b795['pauseType']||'')<(_0x3fceca[_0x0af6('0x3a')]||'')||_0x18b795[_0x0af6('0x29')][_0x0af6('0x3b')]()>_0x3fceca[_0x0af6('0x29')][_0x0af6('0x3b')]()?0x1:-0x1;}else{return(_0x18b795['pauseType']||'')<(_0x3fceca['pauseType']||'')||_0x18b795['fullname']['toLowerCase']()>_0x3fceca['fullname'][_0x0af6('0x3b')]()?-0x1:0x1;}}else{if(_0xbcb362===_0x0af6('0x32')){return _0x18b795[_0x0af6('0x29')][_0x0af6('0x3b')]()<_0x3fceca[_0x0af6('0x29')][_0x0af6('0x3b')]()?0x1:-0x1;}else{return _0x18b795[_0x0af6('0x29')][_0x0af6('0x3b')]()<_0x3fceca['fullname'][_0x0af6('0x3b')]()?-0x1:0x1;}}}else{if(_0xbcb362===_0x0af6('0x32')){return _0x18b795[_0x0af6('0x2c')]<_0x3fceca[_0x0af6('0x2c')]?0x1:-0x1;}else{return _0x18b795[_0x0af6('0x2c')]<_0x3fceca[_0x0af6('0x2c')]?-0x1:0x1;}}});return _0xba11d6;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x683464){var _0x317a12=[_0x0af6('0x3c'),'online',_0x0af6('0x3d'),_0x0af6('0x3e'),'pauseType',_0x0af6('0x3e'),'internal',_0x0af6('0x3f'),'chatPause',_0x0af6('0x7'),_0x0af6('0x6'),_0x0af6('0x8'),_0x0af6('0x9'),_0x0af6('0x5'),'voicePause',_0x0af6('0x40'),_0x0af6('0x41'),_0x0af6('0x42'),'smsCapacity',_0x0af6('0x43'),'faxCapacity',_0x0af6('0x44'),_0x0af6('0x45'),_0x0af6('0x46'),'smsCurrentCapacity','whatsappCurrentCapacity',_0x0af6('0x47'),'chatStatus','openchannelStatus',_0x0af6('0x14'),_0x0af6('0x15'),_0x0af6('0x16'),_0x0af6('0x48'),'voiceStatus',_0x0af6('0x49'),_0x0af6('0x4a'),_0x0af6('0x4b'),_0x0af6('0x4c'),_0x0af6('0x4d'),'faxStatusTime',_0x0af6('0x4e'),_0x0af6('0x4f'),'destconnectedlinenum',_0x0af6('0x50'),_0x0af6('0x51'),_0x0af6('0x52')];var _0x350e3a=[_0x0af6('0x4'),_0x0af6('0x7'),_0x0af6('0x6'),'smsPause',_0x0af6('0x9'),_0x0af6('0x5'),'voicePause',_0x0af6('0x53')];var _0x5d3f1a=_(_0x683464)['omit'](_0x350e3a)[_0x0af6('0x54')](_0x317a12)[_0x0af6('0x25')]();return _0x5d3f1a;}exports[_0x0af6('0x55')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id','name','fullname','role','internal','online','globalStatus',_0x0af6('0x3c'),_0x0af6('0x3d'),_0x0af6('0x3a'),_0x0af6('0x3e'),_0x0af6('0x5'),'chatPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause',_0x0af6('0x13'),'faxStatus','mailStatus',_0x0af6('0x56'),_0x0af6('0x15'),_0x0af6('0xf'),_0x0af6('0x16'),_0x0af6('0x49'),_0x0af6('0x57'),_0x0af6('0x4b'),'openchannelStatusTime','smsStatusTime','voiceStatusTime',_0x0af6('0x4d'),'chatCapacity',_0x0af6('0x58'),_0x0af6('0x42'),_0x0af6('0x41'),_0x0af6('0x59'),'whatsappCapacity',_0x0af6('0x44'),_0x0af6('0x47'),'mailCurrentCapacity','openchannelCurrentCapacity',_0x0af6('0x5a'),_0x0af6('0x5b'),_0x0af6('0x51'),_0x0af6('0x52'),'destconnectedlinenum',_0x0af6('0x5c'),'queue',_0x0af6('0x50')];}exports['getRealtimeAgentsQueryFields']=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 23fd500..1ce9c40 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 _0x1358=['get','loggedInDb','outbound','merge','pick','initializeQueues','lodash','jayson/promise','client','http','available','loggedIn','paused','waiting','busy','inUse','invalid','notInUse','onHold','ringing','talking','unavailable','unknown','pTalking','originated','message','dialActive','Trunk','startPredictive','startProgressive','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','request','startCase','Queues','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','voice','inbound','concat','map'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x1358,0x6c));var _0x8135=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x1358[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x8135('0x0'));var jayson=require(_0x8135('0x1'));var util=require('util');var amiClient=jayson[_0x8135('0x2')][_0x8135('0x3')]({'port':0x232a});var routingClient=jayson[_0x8135('0x2')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x8135('0x4'),_0x8135('0x5'),_0x8135('0x6'),_0x8135('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x8135('0x8'),_0x8135('0x9'),_0x8135('0xa'),'loggedInDb',_0x8135('0xb'),_0x8135('0xc'),_0x8135('0xd'),'ringInUse',_0x8135('0xe'),_0x8135('0xf'),_0x8135('0x10')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x8135('0x11'),_0x8135('0x12'),_0x8135('0x13'),'statusMessage',_0x8135('0x14'),'dialMethod',_0x8135('0x15'),_0x8135('0x16'),_0x8135('0x17'),'erlangCalls','erlangCallToSecond',_0x8135('0x18'),_0x8135('0x19'),_0x8135('0x1a'),'dialPredictiveIntervalMaxThreshold',_0x8135('0x1b'),'predictiveIntervalAvailable',_0x8135('0x1c'),_0x8135('0x1d'),_0x8135('0x1e'),_0x8135('0x1f'),_0x8135('0x20'),_0x8135('0x21')];function getRealtimeQueues(_0x3b8c72,_0x34e799){var _0x190ecf=_0x34e799==='voice'?amiClient:routingClient;return _0x190ecf[_0x8135('0x22')](_[_0x8135('0x23')](_0x34e799)+_0x8135('0x24'),_0x3b8c72)['then'](function(_0x25de32){if(_0x25de32[_0x8135('0x25')])throw new Error(util[_0x8135('0x26')](_0x8135('0x27'),_0x34e799));return _0x25de32[_0x8135('0x28')];})['catch'](function(_0x1edd81){throw _0x1edd81;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x3d1f2d,_0x1fc72f,_0x2ec6dd,_0x3d7fe3){var _0x58cb50=DEFAULT_QUEUE_ATTRIBUTES;if(_0x2ec6dd===_0x8135('0x29')){if(_0x3d7fe3===_0x8135('0x2a')){_0x58cb50=_0x58cb50[_0x8135('0x2b')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x3d7fe3==='outbound'){_0x58cb50=_0x58cb50['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x3d1f2d[_0x8135('0x2c')](function(_0x2f508a){var _0x57c0b7=_0x2f508a[_0x8135('0x2d')]({'plain':!![]});_0x57c0b7[_0x8135('0x6')]=0x0;_0x57c0b7[_0x8135('0x2e')]=0x0;_0x57c0b7['loggedIn']=0x0;_0x57c0b7['available']=0x0;_0x57c0b7[_0x8135('0x7')]=0x0;if(_0x2ec6dd===_0x8135('0x29')){_0x57c0b7[_0x8135('0xe')]=0x0;_0x57c0b7[_0x8135('0x8')]=0x0;if(_0x3d7fe3===_0x8135('0x2f')){_0x57c0b7[_0x8135('0x11')]=0x0;_0x57c0b7[_0x8135('0x12')]=0x0;}}var _0x16f6ac=_['find'](_0x1fc72f,['id',_0x57c0b7['id']]);if(_0x16f6ac){_[_0x8135('0x30')](_0x57c0b7,_[_0x8135('0x31')](_0x16f6ac,_0x58cb50));}return _0x57c0b7;});}exports[_0x8135('0x32')]=initializeQueues; \ No newline at end of file +var _0xe8c9=['client','http','available','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','ringing','ringInUse','pTalking','message','statusMessage','dialMethod','Trunk','startProgressive','erlangAbandonmentRate','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','outbound','map','get','loggedIn','talking','originated','find','merge','pick','lodash','util'];(function(_0x5ceea1,_0x41340a){var _0x498e5d=function(_0x221081){while(--_0x221081){_0x5ceea1['push'](_0x5ceea1['shift']());}};_0x498e5d(++_0x41340a);}(_0xe8c9,0x94));var _0x9e8c=function(_0x16a9c5,_0x3f6082){_0x16a9c5=_0x16a9c5-0x0;var _0x1ee255=_0xe8c9[_0x16a9c5];return _0x1ee255;};'use strict';var _=require(_0x9e8c('0x0'));var jayson=require('jayson/promise');var util=require(_0x9e8c('0x1'));var amiClient=jayson[_0x9e8c('0x2')]['http']({'port':0x232a});var routingClient=jayson['client'][_0x9e8c('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x9e8c('0x4'),'loggedIn',_0x9e8c('0x5'),_0x9e8c('0x6')];var VOICE_QUEUE_ATTRIBUTES=[_0x9e8c('0x7'),_0x9e8c('0x8'),_0x9e8c('0x9'),_0x9e8c('0xa'),_0x9e8c('0xb'),'onHold',_0x9e8c('0xc'),_0x9e8c('0xd'),'talking','unavailable','unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x9e8c('0xe'),'originated',_0x9e8c('0xf'),_0x9e8c('0x10'),'dialActive',_0x9e8c('0x11'),_0x9e8c('0x12'),'startPredictive',_0x9e8c('0x13'),'erlangCalls','erlangCallToSecond',_0x9e8c('0x14'),'erlangBusyFactor','dialPredictiveInterval',_0x9e8c('0x15'),_0x9e8c('0x16'),_0x9e8c('0x17'),_0x9e8c('0x18'),'predictiveIntervalAnsweredCalls',_0x9e8c('0x19'),_0x9e8c('0x1a'),_0x9e8c('0x1b'),_0x9e8c('0x1c')];function getRealtimeQueues(_0x5e5950,_0x7c08c2){var _0x2c1467=_0x7c08c2===_0x9e8c('0x1d')?amiClient:routingClient;return _0x2c1467[_0x9e8c('0x1e')](_[_0x9e8c('0x1f')](_0x7c08c2)+_0x9e8c('0x20'),_0x5e5950)[_0x9e8c('0x21')](function(_0x1e54bd){if(_0x1e54bd['error'])throw new Error(util[_0x9e8c('0x22')](_0x9e8c('0x23'),_0x7c08c2));return _0x1e54bd[_0x9e8c('0x24')];})[_0x9e8c('0x25')](function(_0x3a298b){throw _0x3a298b;});}exports[_0x9e8c('0x26')]=getRealtimeQueues;function initializeQueues(_0x402b65,_0x106329,_0x26a92e,_0x511254){var _0x1d4aa1=DEFAULT_QUEUE_ATTRIBUTES;if(_0x26a92e===_0x9e8c('0x1d')){if(_0x511254===_0x9e8c('0x27')){_0x1d4aa1=_0x1d4aa1[_0x9e8c('0x28')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x511254===_0x9e8c('0x29')){_0x1d4aa1=_0x1d4aa1['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x402b65[_0x9e8c('0x2a')](function(_0x544e37){var _0x284147=_0x544e37[_0x9e8c('0x2b')]({'plain':!![]});_0x284147['paused']=0x0;_0x284147['loggedInDb']=0x0;_0x284147[_0x9e8c('0x2c')]=0x0;_0x284147[_0x9e8c('0x4')]=0x0;_0x284147[_0x9e8c('0x6')]=0x0;if(_0x26a92e===_0x9e8c('0x1d')){_0x284147[_0x9e8c('0x2d')]=0x0;_0x284147[_0x9e8c('0x7')]=0x0;if(_0x511254===_0x9e8c('0x29')){_0x284147['pTalking']=0x0;_0x284147[_0x9e8c('0x2e')]=0x0;}}var _0x147217=_[_0x9e8c('0x2f')](_0x106329,['id',_0x284147['id']]);if(_0x147217){_[_0x9e8c('0x30')](_0x284147,_[_0x9e8c('0x31')](_0x147217,_0x1d4aa1));}return _0x284147;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 217c74b..1350b5c 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(_0x4baae3,_0x5f0235){var _0x454819=function(_0x4359ff){while(--_0x4359ff){_0x4baae3['push'](_0x4baae3['shift']());}};_0x454819(++_0x5f0235);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 _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(_0x20038e,_0x4b6981){var _0x425e2e=function(_0xea2c9){while(--_0xea2c9){_0x20038e['push'](_0x20038e['shift']());}};_0x425e2e(++_0x4b6981);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 31e3bfa..d6d58b2 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 _0x0297=['utf8','replace','hostname','macAddress','update','digest','substring','lodash','crypto','child_process','execSync','../environment','networkInterfaces','orderBy','keys','filter','IPv4','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','model','join','createHash','md5','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid'];(function(_0x168cab,_0x1b0292){var _0x437052=function(_0x416c01){while(--_0x416c01){_0x168cab['push'](_0x168cab['shift']());}};_0x437052(++_0x1b0292);}(_0x0297,0xdf));var _0x7029=function(_0x31544d,_0xc3624f){_0x31544d=_0x31544d-0x0;var _0x514218=_0x0297[_0x31544d];return _0x514218;};'use strict';var _=require(_0x7029('0x0'));var os=require('os');var crypto=require(_0x7029('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0x7029('0x2'))[_0x7029('0x3')];var config=require(_0x7029('0x4'));function getInterfaces(){var _0x944594=[];var _0x5d5fda=os[_0x7029('0x5')]();var _0x32511d=_[_0x7029('0x6')](_[_0x7029('0x7')](_0x5d5fda));for(var _0x51f086=0x0;_0x51f086<_0x32511d['length'];_0x51f086++){var _0x42811b=_0x5d5fda[_0x32511d[_0x51f086]][_0x7029('0x8')](function(_0x2ccffa){return _0x2ccffa['family']===_0x7029('0x9')&&_0x2ccffa['internal']===![];});_0x944594=_0x944594[_0x7029('0xa')](_0x42811b);}return _0x944594;}function getFirstInterface(){var _0x210ae8=_[_0x7029('0xb')](getInterfaces());return{'macAddress':_0x210ae8&&_0x210ae8[_0x7029('0xc')]?_0x210ae8['mac']:_0x7029('0xd'),'ipAddress':_0x210ae8&&_0x210ae8[_0x7029('0xe')]?_0x210ae8['address']:_0x7029('0xf')};}exports[_0x7029('0x10')]=getFirstInterface;function getCPUhash(){var _0x514b56=_['orderBy'](os[_0x7029('0x11')]()['map'](function(_0x39cb02){return _0x39cb02[_0x7029('0x12')];}))[_0x7029('0x13')](':');return crypto[_0x7029('0x14')](_0x7029('0x15'))['update'](_0x514b56)['digest'](_0x7029('0x16'));}exports[_0x7029('0x17')]=function(){var _0x45ce29=os[_0x7029('0x18')]();var _0x25a021=/[0-9a-f-]{36}/;if(config[_0x7029('0x19')]&&_0x25a021[_0x7029('0x1a')](config['licenseToken'])){return config['licenseToken'];}else if(_0x45ce29===_0x7029('0x1b')){return exec(_0x7029('0x1c'),{'encoding':_0x7029('0x1d')})[_0x7029('0x1e')]('\x0d\x0a','');}else{var _0x2e57d8=getFirstInterface();var _0xe61a60=getCPUhash();var _0x235499=_0xe61a60+'|'+os[_0x7029('0x1f')]()+'|'+_0x2e57d8[_0x7029('0x20')]+'|'+_0x2e57d8['ipAddress'];var _0x4720fb=crypto['createHash'](_0x7029('0x15'))[_0x7029('0x21')](_0x235499)[_0x7029('0x22')]('hex');return _0x4720fb[_0x7029('0x23')](0x0,0x8)+'-'+_0x4720fb[_0x7029('0x23')](0x8,0xc)+'-'+_0x4720fb[_0x7029('0x23')](0xc,0x10)+'-'+_0x4720fb[_0x7029('0x23')](0x10,0x14)+'-'+_0x4720fb[_0x7029('0x23')](0x14);}}; \ No newline at end of file +var _0x4c81=['macAddress','ipAddress','hex','substring','lodash','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','createHash','md5','update','digest','getUuid','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','replace','hostname'];(function(_0x3c296e,_0x40e566){var _0x42d374=function(_0x4124aa){while(--_0x4124aa){_0x3c296e['push'](_0x3c296e['shift']());}};_0x42d374(++_0x40e566);}(_0x4c81,0x73));var _0x14c8=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x4c81[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x14c8('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x14c8('0x1'));var exec=require(_0x14c8('0x2'))[_0x14c8('0x3')];var config=require('../environment');function getInterfaces(){var _0x56d63d=[];var _0x17ffc9=os[_0x14c8('0x4')]();var _0x46c20f=_[_0x14c8('0x5')](_[_0x14c8('0x6')](_0x17ffc9));for(var _0x32bdc4=0x0;_0x32bdc4<_0x46c20f[_0x14c8('0x7')];_0x32bdc4++){var _0x413e82=_0x17ffc9[_0x46c20f[_0x32bdc4]][_0x14c8('0x8')](function(_0x155c73){return _0x155c73[_0x14c8('0x9')]===_0x14c8('0xa')&&_0x155c73[_0x14c8('0xb')]===![];});_0x56d63d=_0x56d63d[_0x14c8('0xc')](_0x413e82);}return _0x56d63d;}function getFirstInterface(){var _0x456c4a=_[_0x14c8('0xd')](getInterfaces());return{'macAddress':_0x456c4a&&_0x456c4a[_0x14c8('0xe')]?_0x456c4a[_0x14c8('0xe')]:_0x14c8('0xf'),'ipAddress':_0x456c4a&&_0x456c4a[_0x14c8('0x10')]?_0x456c4a['address']:_0x14c8('0x11')};}exports[_0x14c8('0x12')]=getFirstInterface;function getCPUhash(){var _0x5d7ea4=_[_0x14c8('0x5')](os[_0x14c8('0x13')]()[_0x14c8('0x14')](function(_0x63a2c3){return _0x63a2c3[_0x14c8('0x15')];}))['join'](':');return crypto[_0x14c8('0x16')](_0x14c8('0x17'))[_0x14c8('0x18')](_0x5d7ea4)[_0x14c8('0x19')]('hex');}exports[_0x14c8('0x1a')]=function(){var _0x16af70=os[_0x14c8('0x1b')]();var _0x1ccce5=/[0-9a-f-]{36}/;if(config[_0x14c8('0x1c')]&&_0x1ccce5['test'](config['licenseToken'])){return config[_0x14c8('0x1c')];}else if(_0x16af70===_0x14c8('0x1d')){return exec(_0x14c8('0x1e'),{'encoding':'utf8'})[_0x14c8('0x1f')]('\x0d\x0a','');}else{var _0x66eae7=getFirstInterface();var _0x1094af=getCPUhash();var _0x3c531f=_0x1094af+'|'+os[_0x14c8('0x20')]()+'|'+_0x66eae7[_0x14c8('0x21')]+'|'+_0x66eae7[_0x14c8('0x22')];var _0x3d3dce=crypto[_0x14c8('0x16')]('md5')[_0x14c8('0x18')](_0x3c531f)[_0x14c8('0x19')](_0x14c8('0x23'));return _0x3d3dce[_0x14c8('0x24')](0x0,0x8)+'-'+_0x3d3dce['substring'](0x8,0xc)+'-'+_0x3d3dce[_0x14c8('0x24')](0xc,0x10)+'-'+_0x3d3dce[_0x14c8('0x24')](0x10,0x14)+'-'+_0x3d3dce[_0x14c8('0x24')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index f24e5cf..c55c9f6 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 _0x98b9=['THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','error','message','getUuid','License','findOrCreate','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','license','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','then','catch','data1','data2','info'];(function(_0x52c0f4,_0x256bb1){var _0x8af134=function(_0xf7d358){while(--_0xf7d358){_0x52c0f4['push'](_0x52c0f4['shift']());}};_0x8af134(++_0x256bb1);}(_0x98b9,0x184));var _0x998b=function(_0x461aff,_0x3f3346){_0x461aff=_0x461aff-0x0;var _0x3c912e=_0x98b9[_0x461aff];return _0x3c912e;};'use strict';var util=require(_0x998b('0x0'));var moment=require(_0x998b('0x1'));var rp=require(_0x998b('0x2'));var BPromise=require(_0x998b('0x3'));var pkginfo=require(_0x998b('0x4'))(module,_0x998b('0x5'));var db=require(_0x998b('0x6'))['db'];var encryptor=require(_0x998b('0x7'));var hardware=require('./hardware');var logger=require('../logger')(_0x998b('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x3be849){return new BPromise(function(_0x131c23,_0x4ebf46){var _0x5f0d2e=util[_0x998b('0x9')](_0x998b('0xa'),HOST,_0x3be849,module['exports'][_0x998b('0x5')]);if(oldToken){_0x5f0d2e=util[_0x998b('0x9')](_0x998b('0xb'),HOST,_0x3be849,module[_0x998b('0xc')][_0x998b('0x5')],oldToken);}var _0x321ae9={'uri':_0x5f0d2e,'method':_0x998b('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x321ae9)[_0x998b('0xe')](function(_0x5217a5){_0x131c23(_0x5217a5);})[_0x998b('0xf')](function(_0x16a12f){_0x4ebf46(_0x16a12f);});});}function manageLicense(_0x112aa2,_0x2aab29){var _0x15b955=_0x2aab29['get']({'plain':!![]});if(!isOldTokenSent&&_0x15b955[_0x998b('0x10')]!==_0x112aa2&&!_0x15b955['data2']){oldToken=_0x15b955[_0x998b('0x10')];}httpRequest(_0x112aa2)[_0x998b('0xe')](function(_0x2ec248){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2ec248['active']){isOldTokenSent=![];if(!_0x15b955[_0x998b('0x8')]&&_0x15b955[_0x998b('0x8')]!=_0x2ec248[_0x998b('0x8')]||_0x15b955[_0x998b('0x8')]&&_0x15b955[_0x998b('0x11')]){logger[_0x998b('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x15b955['license']&&!_0x15b955[_0x998b('0x11')]&&_0x15b955[_0x998b('0x8')]!=_0x2ec248[_0x998b('0x8')]){logger[_0x998b('0x12')](_0x998b('0x13'));}if(_0x15b955[_0x998b('0x8')]&&!_0x15b955[_0x998b('0x11')]&&_0x15b955[_0x998b('0x8')]==_0x2ec248[_0x998b('0x8')]){return _0x2aab29;}return _0x2aab29[_0x998b('0x14')]({'data1':_0x112aa2,'data2':null,'license':_0x2ec248[_0x998b('0x8')]});}else{if(_0x2ec248[_0x998b('0x8')]||_0x15b955[_0x998b('0x8')]){if(!_0x15b955[_0x998b('0x11')]){if(_0x15b955[_0x998b('0x10')]==_0x112aa2){GRAY_PERIOD_REASON=_0x998b('0x15');logger[_0x998b('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';logger[_0x998b('0x12')](_0x998b('0x16'),_0x15b955[_0x998b('0x10')],_0x112aa2);}logger[_0x998b('0x12')](_0x998b('0x17'),GRAY_PERIOD_REASON[_0x998b('0x18')](),moment()[_0x998b('0x9')]('YYYY-MM-DD\x20HH:mm'));return _0x2aab29[_0x998b('0x14')]({'data2':encryptor[_0x998b('0x19')](moment()[_0x998b('0x9')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x998b('0x1a')](encryptor[_0x998b('0x1b')](_0x15b955[_0x998b('0x11')]),_0x998b('0x1c'))>DAYS){logger[_0x998b('0x12')](_0x998b('0x1d'),moment()[_0x998b('0x9')](_0x998b('0x1e')));isOldTokenSent=![];return _0x2aab29[_0x998b('0x14')]({'data1':_0x112aa2,'data2':null,'license':null});}}}else{if(_0x15b955[_0x998b('0x10')]!=_0x112aa2){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x15b955['data1'],_0x112aa2);return _0x2aab29['update']({'data1':_0x112aa2,'data2':null,'license':null});}}}return _0x2aab29;})['then'](function(_0x4a797d){_0x2aab29=_0x4a797d;})[_0x998b('0xf')](function(_0x2728dd){logger[_0x998b('0x1f')](_0x2728dd[_0x998b('0x20')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x2aab29);},TIME);});}function defaultLicense(){var _0x1ce823=hardware[_0x998b('0x21')]();if(_0x1ce823){return db[_0x998b('0x22')][_0x998b('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x1ce823}})['spread'](function(_0x262440,_0x5d191b){logger[_0x998b('0x12')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x1ce823);manageLicense(_0x1ce823,_0x262440);})[_0x998b('0xf')](function(_0x20f110){logger[_0x998b('0x1f')](_0x20f110[_0x998b('0x20')]);});}}exports[_0x998b('0x24')]=defaultLicense; \ No newline at end of file +var _0xdbf3=['active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','data1','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','error','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','moment','request-promise','bluebird','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','then','get','data2'];(function(_0x3ae055,_0x2908d){var _0x2341a0=function(_0x550f41){while(--_0x550f41){_0x3ae055['push'](_0x3ae055['shift']());}};_0x2341a0(++_0x2908d);}(_0xdbf3,0x1b3));var _0x3dbf=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xdbf3[_0x29d915];return _0x160f86;};'use strict';var util=require('util');var moment=require(_0x3dbf('0x0'));var rp=require(_0x3dbf('0x1'));var BPromise=require(_0x3dbf('0x2'));var pkginfo=require('pkginfo')(module,_0x3dbf('0x3'));var db=require(_0x3dbf('0x4'))['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require(_0x3dbf('0x5'))(_0x3dbf('0x6'));var HOST=_0x3dbf('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x467d7){return new BPromise(function(_0x584371,_0x110fdd){var _0x42605d=util[_0x3dbf('0x8')](_0x3dbf('0x9'),HOST,_0x467d7,module[_0x3dbf('0xa')][_0x3dbf('0x3')]);if(oldToken){_0x42605d=util[_0x3dbf('0x8')](_0x3dbf('0xb'),HOST,_0x467d7,module[_0x3dbf('0xa')]['version'],oldToken);}var _0x15879e={'uri':_0x42605d,'method':_0x3dbf('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x15879e)[_0x3dbf('0xd')](function(_0x5917d3){_0x584371(_0x5917d3);})['catch'](function(_0x2371f5){_0x110fdd(_0x2371f5);});});}function manageLicense(_0x452c87,_0x24a192){var _0x3199a2=_0x24a192[_0x3dbf('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x3199a2['data1']!==_0x452c87&&!_0x3199a2[_0x3dbf('0xf')]){oldToken=_0x3199a2['data1'];}httpRequest(_0x452c87)['then'](function(_0x5c430f){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5c430f[_0x3dbf('0x10')]){isOldTokenSent=![];if(!_0x3199a2['license']&&_0x3199a2[_0x3dbf('0x6')]!=_0x5c430f['license']||_0x3199a2['license']&&_0x3199a2[_0x3dbf('0xf')]){logger[_0x3dbf('0x11')](_0x3dbf('0x12'));}if(_0x3199a2[_0x3dbf('0x6')]&&!_0x3199a2[_0x3dbf('0xf')]&&_0x3199a2[_0x3dbf('0x6')]!=_0x5c430f['license']){logger['info'](_0x3dbf('0x13'));}if(_0x3199a2[_0x3dbf('0x6')]&&!_0x3199a2[_0x3dbf('0xf')]&&_0x3199a2[_0x3dbf('0x6')]==_0x5c430f['license']){return _0x24a192;}return _0x24a192[_0x3dbf('0x14')]({'data1':_0x452c87,'data2':null,'license':_0x5c430f[_0x3dbf('0x6')]});}else{if(_0x5c430f[_0x3dbf('0x6')]||_0x3199a2[_0x3dbf('0x6')]){if(!_0x3199a2[_0x3dbf('0xf')]){if(_0x3199a2['data1']==_0x452c87){GRAY_PERIOD_REASON=_0x3dbf('0x15');logger[_0x3dbf('0x11')](_0x3dbf('0x16'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x3dbf('0x11')](_0x3dbf('0x17'),_0x3199a2[_0x3dbf('0x18')],_0x452c87);}logger[_0x3dbf('0x11')](_0x3dbf('0x19'),GRAY_PERIOD_REASON[_0x3dbf('0x1a')](),moment()[_0x3dbf('0x8')](_0x3dbf('0x1b')));return _0x24a192[_0x3dbf('0x14')]({'data2':encryptor[_0x3dbf('0x1c')](moment()[_0x3dbf('0x8')](_0x3dbf('0x1b')))});}else{if(moment()[_0x3dbf('0x1d')](encryptor[_0x3dbf('0x1e')](_0x3199a2[_0x3dbf('0xf')]),_0x3dbf('0x1f'))>DAYS){logger[_0x3dbf('0x11')]('DEMO\x20START\x20AT\x20%s',moment()[_0x3dbf('0x8')](_0x3dbf('0x1b')));isOldTokenSent=![];return _0x24a192[_0x3dbf('0x14')]({'data1':_0x452c87,'data2':null,'license':null});}}}else{if(_0x3199a2['data1']!=_0x452c87){logger[_0x3dbf('0x11')](_0x3dbf('0x17'),_0x3199a2[_0x3dbf('0x18')],_0x452c87);return _0x24a192[_0x3dbf('0x14')]({'data1':_0x452c87,'data2':null,'license':null});}}}return _0x24a192;})[_0x3dbf('0xd')](function(_0x1171b2){_0x24a192=_0x1171b2;})['catch'](function(_0x5b197f){logger[_0x3dbf('0x20')](_0x5b197f['message']);})[_0x3dbf('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0x3dbf('0x22')](),_0x24a192);},TIME);});}function defaultLicense(){var _0x21d2a6=hardware[_0x3dbf('0x22')]();if(_0x21d2a6){return db[_0x3dbf('0x23')][_0x3dbf('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x21d2a6}})[_0x3dbf('0x25')](function(_0x3c9aa5,_0x1a7296){logger[_0x3dbf('0x11')](_0x3dbf('0x26'),_0x21d2a6);manageLicense(_0x21d2a6,_0x3c9aa5);})['catch'](function(_0x425afa){logger['error'](_0x425afa[_0x3dbf('0x27')]);});}}exports[_0x3dbf('0x28')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index e8576fc..1e972ea 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 _0x959c=['2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','defaults','then','catch','uuid','license','isEmpty','data2','split','format','parse','demo','machineUuid','decryptString','deadline','add','days','grayReason','changed','disabled','data1','message','User','findAll','sequelize','COUNT','col','role','count','admin','user','telephone','telephones','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor'];(function(_0x5716d5,_0x5150e1){var _0x635f6f=function(_0x4ac572){while(--_0x4ac572){_0x5716d5['push'](_0x5716d5['shift']());}};_0x635f6f(++_0x5150e1);}(_0x959c,0xea));var _0xc959=function(_0x192e06,_0x4aa2a8){_0x192e06=_0x192e06-0x0;var _0x5bc719=_0x959c[_0x192e06];return _0x5bc719;};'use strict';var util=require(_0xc959('0x0'));var _=require(_0xc959('0x1'));var moment=require(_0xc959('0x2'));var BPromise=require(_0xc959('0x3'));var hardware=require(_0xc959('0x4'));var encryptor=require(_0xc959('0x5'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc959('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xc959('0x7'),'machineUuid':hardware[_0xc959('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc959('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xc959('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x53354a){return new BPromise(function(_0x280d61,_0x5900a4){return db[_0xc959('0x9')][_0xc959('0xa')](_[_0xc959('0xb')](_0x53354a,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x47f464){return checkLicense(_0x47f464,null);})[_0xc959('0xc')](function(_0x3c71b4){_0x280d61(_0x3c71b4);return;})[_0xc959('0xd')](function(_0x31833a){_0x5900a4(_0x31833a);});});}function checkLicense(_0x4fe6a8,_0x5bd36c){if(!_0x4fe6a8){demoLicense[_0xc959('0xe')]=_0x4fe6a8['data1'];return demoLicense;}try{var _0x163178=_0x5bd36c||_0x4fe6a8[_0xc959('0xf')];if(_[_0xc959('0x10')](_0x163178)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0xc0541e=_0x4fe6a8['data1'];var _0x1169fe=_0x4fe6a8[_0xc959('0x11')];var _0x29b6e6=_0xc0541e[_0xc959('0x12')]('-')[0x4];var _0x12e4b5=_0xc0541e[_0xc959('0x12')]('-')[0x0];var _0xcf66ee=encryptor['decryptString'](_0x163178,util[_0xc959('0x13')]('%s:%s:%s',_0x29b6e6,_0xc0541e,_0x12e4b5));var _0x5a2cbf=JSON[_0xc959('0x14')](_0xcf66ee);_0x5a2cbf[_0xc959('0x15')]=![];_0x5a2cbf[_0xc959('0xe')]=_0xc0541e;_0x5a2cbf[_0xc959('0x16')]=hardware['getUuid']();if(_0x1169fe){var _0x536333=encryptor[_0xc959('0x17')](_0x1169fe);_0x5a2cbf['gray']=_0x536333;_0x5a2cbf[_0xc959('0x18')]=moment(_0x536333)[_0xc959('0x19')](0x7,_0xc959('0x1a'))[_0xc959('0x13')]();_0x5a2cbf[_0xc959('0x1b')]=_0x5a2cbf[_0xc959('0xe')]!=_0x5a2cbf['machineUuid']?_0xc959('0x1c'):_0xc959('0x1d');}return _0x5a2cbf;}catch(_0x445ada){breakingLicense[_0xc959('0xe')]=_0x4fe6a8[_0xc959('0x1e')];breakingLicense[_0xc959('0x1f')]=_0x445ada[_0xc959('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xc3e509,_0x3a642a){getLicense()['then'](function(_0x29ac7b){return db[_0xc959('0x20')][_0xc959('0x21')]({'attributes':['role',[db[_0xc959('0x22')]['fn'](_0xc959('0x23'),db[_0xc959('0x22')][_0xc959('0x24')](_0xc959('0x25'))),_0xc959('0x26')]],'group':_0xc959('0x25'),'where':{'role':{'$or':[_0xc959('0x27'),_0xc959('0x28'),_0xc959('0x29')]}},'raw':!![]})[_0xc959('0xc')](function(_0xdbc20b){var _0x12c353={'user':_0x29ac7b['users']||0x0,'telephone':_0x29ac7b[_0xc959('0x2a')]||0x0};_0xdbc20b['forEach'](function(_0x5cd56c){var _0x24d062=_0x5cd56c[_0xc959('0x25')]===_0xc959('0x27')?_0xc959('0x28'):_0x5cd56c[_0xc959('0x25')];_0x12c353[_0x24d062]-=_0x5cd56c[_0xc959('0x26')];if(_0x12c353[_0x24d062]<0x0)_0x12c353[_0x24d062]=0x0;});_0xc3e509(_0x12c353);return;});})['catch'](function(_0x7a4dfc){_0x3a642a(_0x7a4dfc);});});}function checkUserLimits(_0x291ab7){return new BPromise(function(_0x28aaac,_0x47bb19){getLimits()['then'](function(_0xd4ccbe){var _0x5c4f7d=_[_0xc959('0x2b')](_[_0xc959('0x2c')](_0x291ab7,'role'),['admin',_0xc959('0x28'),_0xc959('0x29')]);var _0x2153cf=(_0x5c4f7d[_0xc959('0x27')]||0x0)+(_0x5c4f7d[_0xc959('0x28')]||0x0);var _0x2af856=_0x5c4f7d[_0xc959('0x29')]||0x0;if(_0x2153cf>_0xd4ccbe[_0xc959('0x28')])return _0x47bb19(_0xc959('0x2d'));if(_0x2af856>_0xd4ccbe[_0xc959('0x29')])return _0x47bb19(_0xc959('0x2e'));return _0x28aaac();})[_0xc959('0xd')](function(_0x203d71){_0x47bb19(_0x203d71);});});}module[_0xc959('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x89d1=['decryptString','gray','deadline','add','days','format','grayReason','changed','message','User','findAll','role','COUNT','sequelize','count','admin','telephone','users','telephones','forEach','pick','countBy','user','exports','util','lodash','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','then','catch','data1','License\x20key\x20value\x20not\x20found','data2','split','%s:%s:%s','demo','uuid','machineUuid'];(function(_0x416e12,_0x2973f9){var _0x16947e=function(_0x342cd0){while(--_0x342cd0){_0x416e12['push'](_0x416e12['shift']());}};_0x16947e(++_0x2973f9);}(_0x89d1,0x14c));var _0x189d=function(_0x555964,_0x10e06e){_0x555964=_0x555964-0x0;var _0x521e7b=_0x89d1[_0x555964];return _0x521e7b;};'use strict';var util=require(_0x189d('0x0'));var _=require(_0x189d('0x1'));var moment=require(_0x189d('0x2'));var BPromise=require('bluebird');var hardware=require(_0x189d('0x3'));var encryptor=require(_0x189d('0x4'));var db=require(_0x189d('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x189d('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x189d('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x189d('0x8'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x10274a){return new BPromise(function(_0x4235de,_0x4528a3){return db[_0x189d('0x9')]['find'](_['defaults'](_0x10274a,{'raw':!![],'where':{'id':0x1}}))[_0x189d('0xa')](function(_0x4fdb38){return checkLicense(_0x4fdb38,null);})[_0x189d('0xa')](function(_0x53674e){_0x4235de(_0x53674e);return;})[_0x189d('0xb')](function(_0xe628b5){_0x4528a3(_0xe628b5);});});}function checkLicense(_0x1380f0,_0x19fc64){if(!_0x1380f0){demoLicense['uuid']=_0x1380f0[_0x189d('0xc')];return demoLicense;}try{var _0xae0364=_0x19fc64||_0x1380f0['license'];if(_['isEmpty'](_0xae0364)){throw new Error(_0x189d('0xd'));}var _0x1200ab=_0x1380f0[_0x189d('0xc')];var _0x3b1d08=_0x1380f0[_0x189d('0xe')];var _0x45cf3b=_0x1200ab[_0x189d('0xf')]('-')[0x4];var _0x505755=_0x1200ab[_0x189d('0xf')]('-')[0x0];var _0x5c9f31=encryptor['decryptString'](_0xae0364,util['format'](_0x189d('0x10'),_0x45cf3b,_0x1200ab,_0x505755));var _0x28a802=JSON['parse'](_0x5c9f31);_0x28a802[_0x189d('0x11')]=![];_0x28a802[_0x189d('0x12')]=_0x1200ab;_0x28a802[_0x189d('0x13')]=hardware[_0x189d('0x7')]();if(_0x3b1d08){var _0x14e187=encryptor[_0x189d('0x14')](_0x3b1d08);_0x28a802[_0x189d('0x15')]=_0x14e187;_0x28a802[_0x189d('0x16')]=moment(_0x14e187)[_0x189d('0x17')](0x7,_0x189d('0x18'))[_0x189d('0x19')]();_0x28a802[_0x189d('0x1a')]=_0x28a802[_0x189d('0x12')]!=_0x28a802[_0x189d('0x13')]?_0x189d('0x1b'):'disabled';}return _0x28a802;}catch(_0xee6608){breakingLicense['uuid']=_0x1380f0['data1'];breakingLicense['message']=_0xee6608[_0x189d('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4fb3e9,_0x534941){getLicense()[_0x189d('0xa')](function(_0x1ab367){return db[_0x189d('0x1d')][_0x189d('0x1e')]({'attributes':[_0x189d('0x1f'),[db['sequelize']['fn'](_0x189d('0x20'),db[_0x189d('0x21')]['col'](_0x189d('0x1f'))),_0x189d('0x22')]],'group':_0x189d('0x1f'),'where':{'role':{'$or':[_0x189d('0x23'),'user',_0x189d('0x24')]}},'raw':!![]})[_0x189d('0xa')](function(_0x870787){var _0x50ba94={'user':_0x1ab367[_0x189d('0x25')]||0x0,'telephone':_0x1ab367[_0x189d('0x26')]||0x0};_0x870787[_0x189d('0x27')](function(_0x4e47ce){var _0x2851e3=_0x4e47ce[_0x189d('0x1f')]===_0x189d('0x23')?'user':_0x4e47ce[_0x189d('0x1f')];_0x50ba94[_0x2851e3]-=_0x4e47ce[_0x189d('0x22')];if(_0x50ba94[_0x2851e3]<0x0)_0x50ba94[_0x2851e3]=0x0;});_0x4fb3e9(_0x50ba94);return;});})[_0x189d('0xb')](function(_0x41fc11){_0x534941(_0x41fc11);});});}function checkUserLimits(_0x5d4780){return new BPromise(function(_0x31ce23,_0xb4ac49){getLimits()[_0x189d('0xa')](function(_0x323721){var _0x4d43e9=_[_0x189d('0x28')](_[_0x189d('0x29')](_0x5d4780,'role'),[_0x189d('0x23'),_0x189d('0x2a'),_0x189d('0x24')]);var _0x414f83=(_0x4d43e9[_0x189d('0x23')]||0x0)+(_0x4d43e9[_0x189d('0x2a')]||0x0);var _0x5c3afd=_0x4d43e9[_0x189d('0x24')]||0x0;if(_0x414f83>_0x323721[_0x189d('0x2a')])return _0xb4ac49('License\x20limit\x20reached\x20for\x20users');if(_0x5c3afd>_0x323721[_0x189d('0x24')])return _0xb4ac49('License\x20limit\x20reached\x20for\x20telephones');return _0x31ce23();})[_0x189d('0xb')](function(_0x3efe8b){_0xb4ac49(_0x3efe8b);});});}module[_0x189d('0x2b')]={'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 fd08eb2..403d277 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 _0x430c=['exports','app-id','secret'];(function(_0x22e00a,_0x23991a){var _0x13537f=function(_0xbf78b4){while(--_0xbf78b4){_0x22e00a['push'](_0x22e00a['shift']());}};_0x13537f(++_0x23991a);}(_0x430c,0x1a1));var _0xc430=function(_0x380307,_0x440ccd){_0x380307=_0x380307-0x0;var _0x9ea14b=_0x430c[_0x380307];return _0x9ea14b;};'use strict';module[_0xc430('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xc430('0x1'),'GOOGLE_SECRET':_0xc430('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x57ca=['http://localhost:9000','myappanuglar-secret','secret'];(function(_0x31e00f,_0x1a4e77){var _0x260194=function(_0x58c57a){while(--_0x58c57a){_0x31e00f['push'](_0x31e00f['shift']());}};_0x260194(++_0x1a4e77);}(_0x57ca,0x108));var _0xa57c=function(_0x26942a,_0x2a5ce0){_0x26942a=_0x26942a-0x0;var _0x1f047c=_0x57ca[_0x26942a];return _0x1f047c;};'use strict';module['exports']={'DOMAIN':_0xa57c('0x0'),'SESSION_SECRET':_0xa57c('0x1'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xa57c('0x2'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index d680f2f..3fc2593 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e4f=['exports','../utils/loggers','fileLogger'];(function(_0x2a43b9,_0x2aa7ea){var _0x3b6c90=function(_0x5be37f){while(--_0x5be37f){_0x2a43b9['push'](_0x2a43b9['shift']());}};_0x3b6c90(++_0x2aa7ea);}(_0x8e4f,0xac));var _0xf8e4=function(_0x3c8324,_0x2e94a9){_0x3c8324=_0x3c8324-0x0;var _0x5399f5=_0x8e4f[_0x3c8324];return _0x5399f5;};'use strict';var fileLogger=require(_0xf8e4('0x0'))[_0xf8e4('0x1')];module[_0xf8e4('0x2')]=fileLogger; \ No newline at end of file +var _0xcde7=['../utils/loggers','fileLogger'];(function(_0x1f2efd,_0x3d1d9e){var _0x19d2a8=function(_0x5b60aa){while(--_0x5b60aa){_0x1f2efd['push'](_0x1f2efd['shift']());}};_0x19d2a8(++_0x3d1d9e);}(_0xcde7,0x1c4));var _0x7cde=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xcde7[_0x59ee6f];return _0x4c0979;};'use strict';var fileLogger=require(_0x7cde('0x0'))[_0x7cde('0x1')];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index fd9cb09..00b8d7b 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 _0x6a35=['ami','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing','xdr','exports','path','../../config/environment','join','root','legacy-libs','../../services/express/index.js'];(function(_0x2e3107,_0x25f970){var _0x833d69=function(_0x420e78){while(--_0x420e78){_0x2e3107['push'](_0x2e3107['shift']());}};_0x833d69(++_0x25f970);}(_0x6a35,0x174));var _0x56a3=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x6a35[_0x368fb9];return _0x4892fb;};'use strict';var path=require(_0x56a3('0x0'));var cfg=require(_0x56a3('0x1'));var env={'NODE_PATH':path['resolve'](path[_0x56a3('0x2')](cfg[_0x56a3('0x3')],_0x56a3('0x4')))};var pm2config={'apps':[{'name':'express','script':path[_0x56a3('0x2')](__dirname,_0x56a3('0x5')),'env':env},{'name':_0x56a3('0x6'),'script':path[_0x56a3('0x2')](__dirname,_0x56a3('0x7')),'env':env},{'name':'agi','script':path[_0x56a3('0x2')](__dirname,_0x56a3('0x8')),'env':env},{'name':_0x56a3('0x9'),'script':path[_0x56a3('0x2')](__dirname,_0x56a3('0xa')),'env':env},{'name':_0x56a3('0xb'),'script':path[_0x56a3('0x2')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0x56a3('0xc'),'script':path[_0x56a3('0x2')](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0x56a3('0xd')]=pm2config; \ No newline at end of file +var _0xfe05=['exports','../../config/environment','resolve','join','root','legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','routing','../../services/routing/index.js','xdr'];(function(_0x55b3e7,_0x5e2030){var _0x1b3461=function(_0x3dced6){while(--_0x3dced6){_0x55b3e7['push'](_0x55b3e7['shift']());}};_0x1b3461(++_0x5e2030);}(_0xfe05,0x79));var _0x5fe0=function(_0xe50edf,_0x12df36){_0xe50edf=_0xe50edf-0x0;var _0x1e3313=_0xfe05[_0xe50edf];return _0x1e3313;};'use strict';var path=require('path');var cfg=require(_0x5fe0('0x0'));var env={'NODE_PATH':path[_0x5fe0('0x1')](path[_0x5fe0('0x2')](cfg[_0x5fe0('0x3')],_0x5fe0('0x4')))};var pm2config={'apps':[{'name':_0x5fe0('0x5'),'script':path[_0x5fe0('0x2')](__dirname,_0x5fe0('0x6')),'env':env},{'name':_0x5fe0('0x7'),'script':path[_0x5fe0('0x2')](__dirname,_0x5fe0('0x8')),'env':env},{'name':_0x5fe0('0x9'),'script':path['join'](__dirname,_0x5fe0('0xa')),'env':env},{'name':'email','script':path['join'](__dirname,'../../services/email/index.js'),'env':env},{'name':_0x5fe0('0xb'),'script':path[_0x5fe0('0x2')](__dirname,_0x5fe0('0xc')),'env':env},{'name':_0x5fe0('0xd'),'script':path[_0x5fe0('0x2')](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0x5fe0('0xe')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index a7f45ff..bb4c326 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 _0x9c71=['describe','delete','dump','saved','pm2','bluebird','./config','connect','connected','start','then','disconnect','stop','restart','list'];(function(_0x32729c,_0xf5afd8){var _0x482cfd=function(_0x231471){while(--_0x231471){_0x32729c['push'](_0x32729c['shift']());}};_0x482cfd(++_0xf5afd8);}(_0x9c71,0x15d));var _0x19c7=function(_0x5eeea9,_0x7951b6){_0x5eeea9=_0x5eeea9-0x0;var _0x3d31ab=_0x9c71[_0x5eeea9];return _0x3d31ab;};'use strict';var pm2=require(_0x19c7('0x0'));var BPromise=require(_0x19c7('0x1'));var config=require(_0x19c7('0x2'));function connect(){return new BPromise(function(_0x260af4,_0x500483){return pm2[_0x19c7('0x3')](function(_0x269a99){if(_0x269a99){return _0x500483(_0x269a99);}return _0x260af4(_0x19c7('0x4'));});});};exports[_0x19c7('0x5')]=function(_0x3328f9){return connect()[_0x19c7('0x6')](function(){return new BPromise(function(_0x3773c6,_0x28a3fd){return pm2[_0x19c7('0x5')](_0x3328f9,function(_0x22dcf4,_0x184347){if(_0x22dcf4){return _0x28a3fd(_0x22dcf4);}pm2[_0x19c7('0x7')]();return _0x3773c6(_0x184347);});});});};exports['stop']=function(_0x48a493){return connect()[_0x19c7('0x6')](function(){return new BPromise(function(_0xd9b72a,_0x1d6b2d){return pm2[_0x19c7('0x8')](_0x48a493,function(_0xa883a8,_0x307372){if(_0xa883a8){return _0x1d6b2d(_0xa883a8);}pm2[_0x19c7('0x7')]();return _0xd9b72a(_0x307372);});});});};exports[_0x19c7('0x9')]=function(_0x5754e4){return connect()[_0x19c7('0x6')](function(){return new BPromise(function(_0x5afe18,_0xbfc973){return pm2['restart'](_0x5754e4,function(_0x686142,_0x3a4a63){if(_0x686142){return _0xbfc973(_0x686142);}pm2[_0x19c7('0x7')]();return _0x5afe18(_0x3a4a63);});});});};exports[_0x19c7('0xa')]=function(){return connect()[_0x19c7('0x6')](function(){return new BPromise(function(_0x3f2038,_0x4288b0){return pm2['list'](function(_0x480767,_0x169492){if(_0x480767){return _0x4288b0(_0x480767);}pm2['disconnect']();return _0x3f2038(_0x169492);});});});};exports[_0x19c7('0xb')]=function(_0x1b9f19){return connect()[_0x19c7('0x6')](function(){return new BPromise(function(_0x156b37,_0x2ca10b){return pm2[_0x19c7('0xb')](_0x1b9f19,function(_0x2f8afa,_0x1fb3fd){if(_0x2f8afa){return _0x2ca10b(_0x2f8afa);}pm2[_0x19c7('0x7')]();return _0x156b37(_0x1fb3fd);});});});};exports[_0x19c7('0xc')]=function(_0x3e77df){return connect()[_0x19c7('0x6')](function(){return new BPromise(function(_0x92fd74,_0x2a1649){return pm2[_0x19c7('0xc')](_0x3e77df,function(_0x5dac95,_0x1b78a5){if(_0x5dac95){return _0x2a1649(_0x5dac95);}pm2[_0x19c7('0x7')]();return _0x92fd74(_0x1b78a5);});});});};exports['dump']=function(){return connect()[_0x19c7('0x6')](function(){return new BPromise(function(_0x57bd32,_0x2cce56){return pm2[_0x19c7('0xd')](function(_0x3948f9){if(_0x3948f9){return _0x2cce56(_0x3948f9);}return _0x57bd32(_0x19c7('0xe'));});});});}; \ No newline at end of file +var _0x3628=['then','disconnect','stop','restart','list','describe','dump','saved','pm2','bluebird','./config','connect','connected','start'];(function(_0xcdbe48,_0x318df3){var _0x409123=function(_0x9bfa0d){while(--_0x9bfa0d){_0xcdbe48['push'](_0xcdbe48['shift']());}};_0x409123(++_0x318df3);}(_0x3628,0x19e));var _0x8362=function(_0x2a0350,_0x249319){_0x2a0350=_0x2a0350-0x0;var _0x425220=_0x3628[_0x2a0350];return _0x425220;};'use strict';var pm2=require(_0x8362('0x0'));var BPromise=require(_0x8362('0x1'));var config=require(_0x8362('0x2'));function connect(){return new BPromise(function(_0x49526f,_0xc52373){return pm2[_0x8362('0x3')](function(_0x2a5599){if(_0x2a5599){return _0xc52373(_0x2a5599);}return _0x49526f(_0x8362('0x4'));});});};exports[_0x8362('0x5')]=function(_0x47b94f){return connect()[_0x8362('0x6')](function(){return new BPromise(function(_0x1fd181,_0x2ebf87){return pm2[_0x8362('0x5')](_0x47b94f,function(_0x57c2c0,_0x3eeebe){if(_0x57c2c0){return _0x2ebf87(_0x57c2c0);}pm2[_0x8362('0x7')]();return _0x1fd181(_0x3eeebe);});});});};exports[_0x8362('0x8')]=function(_0x1aedb0){return connect()['then'](function(){return new BPromise(function(_0x15835a,_0x45edc5){return pm2['stop'](_0x1aedb0,function(_0x5b1e25,_0x415e84){if(_0x5b1e25){return _0x45edc5(_0x5b1e25);}pm2[_0x8362('0x7')]();return _0x15835a(_0x415e84);});});});};exports[_0x8362('0x9')]=function(_0x2efedd){return connect()['then'](function(){return new BPromise(function(_0x2ebb2a,_0x236af5){return pm2[_0x8362('0x9')](_0x2efedd,function(_0x2a5e58,_0x698b70){if(_0x2a5e58){return _0x236af5(_0x2a5e58);}pm2[_0x8362('0x7')]();return _0x2ebb2a(_0x698b70);});});});};exports[_0x8362('0xa')]=function(){return connect()['then'](function(){return new BPromise(function(_0x583ad3,_0x316b7d){return pm2[_0x8362('0xa')](function(_0xde755f,_0x19b326){if(_0xde755f){return _0x316b7d(_0xde755f);}pm2[_0x8362('0x7')]();return _0x583ad3(_0x19b326);});});});};exports[_0x8362('0xb')]=function(_0x3667d4){return connect()[_0x8362('0x6')](function(){return new BPromise(function(_0x3a4689,_0x190daf){return pm2[_0x8362('0xb')](_0x3667d4,function(_0x34d7c8,_0x156e83){if(_0x34d7c8){return _0x190daf(_0x34d7c8);}pm2[_0x8362('0x7')]();return _0x3a4689(_0x156e83);});});});};exports['delete']=function(_0x2672e8){return connect()[_0x8362('0x6')](function(){return new BPromise(function(_0x48ef5d,_0x248fd6){return pm2['delete'](_0x2672e8,function(_0x1317e1,_0x5cd9a6){if(_0x1317e1){return _0x248fd6(_0x1317e1);}pm2['disconnect']();return _0x48ef5d(_0x5cd9a6);});});});};exports[_0x8362('0xc')]=function(){return connect()[_0x8362('0x6')](function(){return new BPromise(function(_0x3f9fca,_0x18d513){return pm2['dump'](function(_0x495316){if(_0x495316){return _0x18d513(_0x495316);}return _0x3f9fca(_0x8362('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index e74ce65..e051fae 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 _0x8c98=['[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','catch','error','start','lodash','moment','ioredis','util','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','lastMsgAt','length','map','info'];(function(_0x2edacb,_0x56c7d0){var _0x292220=function(_0x4cad45){while(--_0x4cad45){_0x2edacb['push'](_0x2edacb['shift']());}};_0x292220(++_0x56c7d0);}(_0x8c98,0x19f));var _0x88c9=function(_0x2762fc,_0x4d21a6){_0x2762fc=_0x2762fc-0x0;var _0x1ae50b=_0x8c98[_0x2762fc];return _0x1ae50b;};'use strict';var _=require(_0x88c9('0x0'));var moment=require(_0x88c9('0x1'));var Redis=require(_0x88c9('0x2'));var util=require(_0x88c9('0x3'));var config=require('../../config/environment');var db=require(_0x88c9('0x4'))['db'];var logger=require(_0x88c9('0x5'))(_0x88c9('0x6'));config['redis']=_['defaults'](config[_0x88c9('0x7')],{'host':_0x88c9('0x8'),'port':0x18eb});var io=require(_0x88c9('0x9'))(new Redis(config[_0x88c9('0x7')]));function closeInteractions(){var _0x1a91c9=0x0;var _0x5a3918=[];return db[_0x88c9('0xa')][_0x88c9('0xb')]({'raw':!![],'attributes':['id',_0x88c9('0xc')],'where':{'id':0x1}})[_0x88c9('0xd')](function(_0x5e760e){_0x1a91c9=_0x5e760e[_0x88c9('0xc')];if(_0x1a91c9){return db[_0x88c9('0xe')]['findAll']({'raw':!![],'attributes':['id',_0x88c9('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x5e760e[_0x88c9('0xc')],'minutes')}}});}else{return[];}})[_0x88c9('0xd')](function(_0x53d1ab){if(_0x53d1ab&&_0x53d1ab[_0x88c9('0x10')]){_0x5a3918=_[_0x88c9('0x11')](_0x53d1ab||[],'id');logger[_0x88c9('0x12')](_0x88c9('0x13'),_0x5a3918[_0x88c9('0x14')]());return db[_0x88c9('0xe')][_0x88c9('0x15')]({'closeReason':_0x88c9('0x16'),'disposition':_0x88c9('0x17'),'closed':!![],'closedAt':moment()[_0x88c9('0x18')](_0x88c9('0x19'))},{'where':{'id':_0x5a3918}});}})[_0x88c9('0xd')](function(){if(_0x5a3918&&_0x5a3918[_0x88c9('0x10')]){logger[_0x88c9('0x12')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x5a3918[_0x88c9('0x14')]());for(var _0x28d34a=0x0;_0x28d34a<_0x5a3918[_0x88c9('0x10')];_0x28d34a++){io[_0x88c9('0x1a')](_0x88c9('0x1b'),{'id':_0x5a3918[_0x28d34a],'closed':!![]});}}})[_0x88c9('0x1c')](function(_0x10f7af){logger[_0x88c9('0x1d')]('[CHAT]\x20Error\x20closing\x20interactions',_0x10f7af?util['inspect'](_0x10f7af,{'showHidden':![],'depth':null}):'');});}exports[_0x88c9('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x6465=['moment','ioredis','util','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','lodash'];(function(_0x2700de,_0x4baeac){var _0x4bfc1b=function(_0x1a12f0){while(--_0x1a12f0){_0x2700de['push'](_0x2700de['shift']());}};_0x4bfc1b(++_0x4baeac);}(_0x6465,0xfb));var _0x5646=function(_0x4f7f12,_0x3ab9b8){_0x4f7f12=_0x4f7f12-0x0;var _0x42175d=_0x6465[_0x4f7f12];return _0x42175d;};'use strict';var _=require(_0x5646('0x0'));var moment=require(_0x5646('0x1'));var Redis=require(_0x5646('0x2'));var util=require(_0x5646('0x3'));var config=require(_0x5646('0x4'));var db=require(_0x5646('0x5'))['db'];var logger=require('../logger')('schedule');config[_0x5646('0x6')]=_[_0x5646('0x7')](config[_0x5646('0x6')],{'host':_0x5646('0x8'),'port':0x18eb});var io=require(_0x5646('0x9'))(new Redis(config[_0x5646('0x6')]));function closeInteractions(){var _0x3b7cd3=0x0;var _0x398e3d=[];return db[_0x5646('0xa')][_0x5646('0xb')]({'raw':!![],'attributes':['id',_0x5646('0xc')],'where':{'id':0x1}})[_0x5646('0xd')](function(_0x35f5ec){_0x3b7cd3=_0x35f5ec[_0x5646('0xc')];if(_0x3b7cd3){return db[_0x5646('0xe')][_0x5646('0xf')]({'raw':!![],'attributes':['id',_0x5646('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x5646('0x11')](_0x35f5ec[_0x5646('0xc')],_0x5646('0x12'))}}});}else{return[];}})[_0x5646('0xd')](function(_0x203fd9){if(_0x203fd9&&_0x203fd9[_0x5646('0x13')]){_0x398e3d=_['map'](_0x203fd9||[],'id');logger[_0x5646('0x14')](_0x5646('0x15'),_0x398e3d[_0x5646('0x16')]());return db[_0x5646('0xe')][_0x5646('0x17')]({'closeReason':_0x5646('0x18'),'disposition':_0x5646('0x19'),'closed':!![],'closedAt':moment()['format'](_0x5646('0x1a'))},{'where':{'id':_0x398e3d}});}})[_0x5646('0xd')](function(){if(_0x398e3d&&_0x398e3d[_0x5646('0x13')]){logger['info'](_0x5646('0x1b'),_0x398e3d[_0x5646('0x16')]());for(var _0x2394f6=0x0;_0x2394f6<_0x398e3d[_0x5646('0x13')];_0x2394f6++){io['emit']('chatInteraction:update',{'id':_0x398e3d[_0x2394f6],'closed':!![]});}}})['catch'](function(_0x250d4e){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0x250d4e?util['inspect'](_0x250d4e,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 8376cf6..89e7a1c 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 _0xcf05=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x203416,_0x1de974){var _0x5008c9=function(_0x36de32){while(--_0x36de32){_0x203416['push'](_0x203416['shift']());}};_0x5008c9(++_0x1de974);}(_0xcf05,0x1b3));var _0x5cf0=function(_0xee94ff,_0x2d8b03){_0xee94ff=_0xee94ff-0x0;var _0x361b60=_0xcf05[_0xee94ff];return _0x361b60;};'use strict';function start(){var _0x26b633=require(_0x5cf0('0x0'));return _0x26b633[_0x5cf0('0x1')]();}module[_0x5cf0('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x1d1f=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x1d1f,0x15e));var _0xf1d1=function(_0x45862f,_0xf5f0a6){_0x45862f=_0x45862f-0x0;var _0x35b20b=_0x1d1f[_0x45862f];return _0x35b20b;};'use strict';function start(){var _0x259e5c=require(_0xf1d1('0x0'));return _0x259e5c[_0xf1d1('0x1')]();}module[_0xf1d1('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 9460664..1910748 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 _0x69b9=['jayson/promise','bluebird','../logger','schedule','../../mysqldb','retry','../../api/analyticDefaultReport/analyticDefaultReport.controller','number','AnalyticExtractedReport','error','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','format','\x22%s\x22\x20<%s>','name','email','Smtp','user','subtractUnit','join','../../files/reports','savename','basename','status','Sent','message','text','stringify','attachments','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Failed','request','SendMail','then','error\x20mail','email\x20sent','catch','case\x20loading','retryOptions','retries','job','operation','stop','still\x20loading','case\x20completed','data','case\x20failed','Unrecognized\x20status:','entity','\x20Attempt\x20#:','report\x20status:','dataValues','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20custom\x20report\x20id:%s','CustomReportId','runReport','no\x20report\x20id','findAll','MailServerOut','CloudProvider','map','toString','difference','exists','delete\x20cron','toRun','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','deleteJob','stop\x20cron','length','update','update\x20cron','run','util','path','lodash','cron-job-manager'];(function(_0x360206,_0x7c26ef){var _0x48eaad=function(_0x8bbd62){while(--_0x8bbd62){_0x360206['push'](_0x360206['shift']());}};_0x48eaad(++_0x7c26ef);}(_0x69b9,0x125));var _0x969b=function(_0x56a1b7,_0x5eef01){_0x56a1b7=_0x56a1b7-0x0;var _0x442c19=_0x69b9[_0x56a1b7];return _0x442c19;};'use strict';var fs=require('fs');var util=require(_0x969b('0x0'));var path=require(_0x969b('0x1'));var _=require(_0x969b('0x2'));var moment=require('moment');var CronJobManager=require(_0x969b('0x3'));var jayson=require(_0x969b('0x4'));var BPromise=require(_0x969b('0x5'));var logger=require(_0x969b('0x6'))(_0x969b('0x7'));var db=require(_0x969b('0x8'))['db'];const retry=require(_0x969b('0x9'));var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x969b('0xa'));var client=jayson['client']['http']({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x5ca5fe){const _0x2f4992={};if(typeof _0x5ca5fe===_0x969b('0xb')){_0x2f4992['id']=_0x5ca5fe;}return db[_0x969b('0xc')]['findOne']({'where':_0x2f4992})['then'](function(_0x32af98){return _0x32af98;})['catch'](function(_0x21bde3){logger[_0x969b('0xd')](_0x21bde3);});}function handleSendEmail(_0x367f34,_0xba4598){logger[_0x969b('0xe')](_0x969b('0xf'),_0x367f34['email']);var _0x53f88d=!![];var _0xf6686=_0x367f34[_0x969b('0x10')]['getSmtpOptions']();var _0x4e577d={'account':_0xf6686,'message':{'from':util[_0x969b('0x11')](_0x969b('0x12'),_0x367f34[_0x969b('0x10')][_0x969b('0x13')],_0x367f34['MailAccount'][_0x969b('0x14')]||_0x367f34[_0x969b('0x10')][_0x969b('0x15')][_0x969b('0x16')]),'to':_0x367f34[_0x969b('0x14')],'cc':_0x367f34['cc'],'bcc':_0x367f34['bcc'],'subject':util[_0x969b('0x11')]('Report\x20%s\x20last\x20%s\x20%s',_0xba4598['name'],_0x367f34['subtractNumber'],_0x367f34[_0x969b('0x17')])}};var _0x4c45b2=path[_0x969b('0x18')](__dirname,_0x969b('0x19'));var _0x84a5ad=_0xba4598[_0x969b('0x1a')];var _0x3206fa=util[_0x969b('0x11')]('%s.%s',path[_0x969b('0x1b')](_0xba4598['savename'],path['extname'](_0xba4598[_0x969b('0x1a')])),'zip');var _0x31b9bc=path['join'](_0x4c45b2,_0x84a5ad);var _0x31b53f=path['join'](_0x4c45b2,_0x3206fa);if(fs['existsSync'](_0x31b9bc)){_0xba4598[_0x969b('0x1c')]=_0x969b('0x1d');_0x4e577d[_0x969b('0x1e')]['attachments']=[{'filename':_0x84a5ad,'path':_0x31b9bc}];_0x4e577d[_0x969b('0x1e')][_0x969b('0x1f')]=util[_0x969b('0x11')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x969b('0x20')](_0xba4598,null,0x2));}else if(fs['existsSync'](_0x31b53f)){_0xba4598[_0x969b('0x1c')]=_0x969b('0x1d');_0x4e577d[_0x969b('0x1e')][_0x969b('0x21')]=[{'filename':_0x3206fa,'path':_0x31b53f}];}else{if(_0xba4598[_0x969b('0x1c')]===_0x969b('0x22')){_0x4e577d[_0x969b('0x1e')]['text']=_0x969b('0x23');if(!_0x367f34['sendIfEmpty']){_0x53f88d=![];logger[_0x969b('0xe')](_0x969b('0x24'));}}else if(_0xba4598[_0x969b('0x1c')]==='Loading'){_0x4e577d[_0x969b('0x1e')][_0x969b('0x1f')]=_0x969b('0x25');}else if(_0xba4598[_0x969b('0x1c')]===_0x969b('0x26')){_0x4e577d[_0x969b('0x1e')][_0x969b('0x1f')]='Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0xba4598[_0x969b('0x1c')]===_0x969b('0x27')){_0x4e577d['message']['text']='Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else{logger[_0x969b('0xd')]('[handleSendEmail]\x20Unrecognized\x20status:',_0xba4598[_0x969b('0x1c')]);}}if(_0x53f88d){return client[_0x969b('0x28')](_0x969b('0x29'),_0x4e577d)[_0x969b('0x2a')](function(_0x48c1d9){if(_0x48c1d9['error']){return logger[_0x969b('0xd')](_0x969b('0x2b'),JSON[_0x969b('0x20')](_0x48c1d9));}return logger[_0x969b('0xe')](_0x969b('0x2c'));})[_0x969b('0x2d')](function(_0x2c6b72){return logger[_0x969b('0xd')](_0x969b('0x2b'),JSON[_0x969b('0x20')](_0x2c6b72));});}}function handleError(){return function(_0xf87844){return logger[_0x969b('0xd')](JSON['stringify'](_0xf87844));};}function loading(_0x3892f0){logger['info'](_0x969b('0x2e'));if(_0x3892f0['currentAttempt']===_0x3892f0[_0x969b('0x2f')][_0x969b('0x30')]){handleSendEmail(_0x3892f0[_0x969b('0x31')],_0x3892f0['data']);_0x3892f0[_0x969b('0x32')][_0x969b('0x33')]();}else{_0x3892f0[_0x969b('0x32')][_0x969b('0x9')](_0x969b('0x34'));}}function completed(_0x54dc59){logger[_0x969b('0xe')](_0x969b('0x35'));handleSendEmail(_0x54dc59[_0x969b('0x31')],_0x54dc59[_0x969b('0x36')]);_0x54dc59[_0x969b('0x32')][_0x969b('0x33')]();}function empty(_0x47fa1e){logger[_0x969b('0xe')]('case\x20empty');handleSendEmail(_0x47fa1e['job'],_0x47fa1e[_0x969b('0x36')]);_0x47fa1e[_0x969b('0x32')]['stop']();}function failed(_0x2ff3d2){logger[_0x969b('0xe')](_0x969b('0x37'));handleSendEmail(_0x2ff3d2[_0x969b('0x31')],_0x2ff3d2[_0x969b('0x36')]);_0x2ff3d2[_0x969b('0x32')]['stop']();}function urecognized(_0x202b72){logger[_0x969b('0xd')](_0x969b('0x38'),_0x202b72[_0x969b('0x39')]['dataValues'][_0x969b('0x1c')]);_0x202b72[_0x969b('0x32')]['stop']();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x5950a7,_0x437e02){const _0x9e35f2={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x52c360=retry[_0x969b('0x32')](_0x9e35f2);_0x52c360['attempt'](_0x4e0d7f=>{logger[_0x969b('0xe')]('Job\x20ID\x20'+_0x5950a7['id']+_0x969b('0x3a')+_0x4e0d7f);try{getReportData(_0x437e02['id'])[_0x969b('0x2a')](function(_0x275dae){_0x437e02=_0x275dae;logger['info'](_0x969b('0x3b'),_0x275dae[_0x969b('0x3c')][_0x969b('0x1c')]);if(!reportStatusStrategies[_0x275dae[_0x969b('0x3c')][_0x969b('0x1c')]]){logger[_0x969b('0xd')](_0x969b('0x3b'),_0x275dae[_0x969b('0x3c')][_0x969b('0x1c')]);_0x52c360[_0x969b('0x9')]();}reportStatusStrategies[_0x275dae[_0x969b('0x3c')][_0x969b('0x1c')]]({'operation':_0x52c360,'currentAttempt':_0x4e0d7f,'retryOptions':_0x9e35f2,'job':_0x5950a7,'data':_0x437e02,'entity':_0x275dae});});}catch(_0x552286){_0x52c360['retry'](_0x552286);}});}function handleResult(_0xa06f1e){return function(_0x41d26e){if(_0xa06f1e['sendMail']&&_0xa06f1e[_0x969b('0x10')]&&_0xa06f1e['MailAccount'][_0x969b('0x15')]&&!_['isNil'](_0xa06f1e[_0x969b('0x14')])){retryer(_0xa06f1e,_0x41d26e);}};}function handleJob(_0x5c3da0){return function(){try{if(_[_0x969b('0x3d')](_0x5c3da0[_0x969b('0x3e')])){return logger[_0x969b('0xe')](_0x969b('0x3f'));}if(_[_0x969b('0x3d')](_0x5c3da0[_0x969b('0x17')])){return logger['info'](_0x969b('0x40'));}var _0x4f99a3={'startDate':moment()[_0x969b('0x41')](_0x5c3da0[_0x969b('0x3e')],_0x5c3da0['subtractUnit'])[_0x969b('0x11')](_0x969b('0x42')),'endDate':moment()[_0x969b('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x969b('0x43'),'output':_0x5c3da0[_0x969b('0x44')],'name':_0x5c3da0[_0x969b('0x13')]};if(!_['isNil'](_0x5c3da0[_0x969b('0x45')])){logger[_0x969b('0xe')]('exec\x20defaul\x20report\x20id:%s',_0x5c3da0[_0x969b('0x45')]);return analyticDefaultReportController['runReport']({'id':_0x5c3da0[_0x969b('0x45')]},_0x4f99a3)[_0x969b('0x2a')](handleResult(_0x5c3da0))[_0x969b('0x2d')](handleError());}if(!_[_0x969b('0x3d')](_0x5c3da0['CustomReportId'])){logger['info'](_0x969b('0x46'),_0x5c3da0[_0x969b('0x47')]);return analyticCustomReportController[_0x969b('0x48')]({'id':_0x5c3da0[_0x969b('0x47')]},_0x4f99a3)[_0x969b('0x2a')](handleResult(_0x5c3da0))['catch'](handleError());}}catch(_0x88b78){logger[_0x969b('0xd')](JSON['stringify'](_0x88b78));}return logger['info'](_0x969b('0x49'));};}function getJobs(_0x1227ec){var _0x3b08d1={};if(_0x1227ec){_0x3b08d1['id']=_0x1227ec;}return db['Schedule'][_0x969b('0x4a')]({'where':_0x3b08d1,'include':[{'model':db[_0x969b('0x10')],'attributes':['id','name',_0x969b('0x14')],'include':[{'model':db[_0x969b('0x4b')],'as':_0x969b('0x15'),'include':[{'model':db['CloudProvider'],'as':_0x969b('0x4c')}]}]}]})[_0x969b('0x2a')](function(_0x174285){var _0xa983c4=_['keys'](manager['jobs']);var _0x3135cc=_[_0x969b('0x4d')](_0x174285,function(_0x4dc5c1){return _0x4dc5c1['id']['toString']();});var _0x4721a9=_['keyBy'](_0x174285,function(_0x1aa07e){return _0x1aa07e['id'][_0x969b('0x4e')]();});var _0x181474=_0x1227ec?_0x3135cc:_[_0x969b('0x4f')](_0x3135cc,_0xa983c4);var _0x56f4d4=_['intersection'](_0x3135cc,_0xa983c4);var _0x85abf6=_[_0x969b('0x4f')](_0xa983c4,_0x3135cc);var _0x498f7d;var _0x2fd40c;for(_0x498f7d=0x0;_0x498f7d<_0x85abf6['length']&&!_0x1227ec;_0x498f7d+=0x1){_0x2fd40c=_0x85abf6[_0x498f7d][_0x969b('0x4e')]();if(manager[_0x969b('0x50')](_0x2fd40c)){manager[_0x969b('0x33')](_0x2fd40c);manager['deleteJob'](_0x2fd40c);logger[_0x969b('0xe')](_0x969b('0x51'),_0x2fd40c);}}logger[_0x969b('0xe')](_0x969b('0x52'),JSON[_0x969b('0x20')](_0x181474));for(_0x498f7d=0x0;_0x498f7d<_0x181474['length'];_0x498f7d+=0x1){_0x2fd40c=_0x181474[_0x498f7d][_0x969b('0x4e')]();if(_0x1227ec){logger['info'](JSON[_0x969b('0x20')](_0x4721a9[_0x2fd40c]));BPromise[_0x969b('0x53')]()['then'](handleJob(_0x4721a9[_0x2fd40c]));logger['info'](_0x969b('0x54'),_0x4721a9[_0x2fd40c][_0x969b('0x13')],_0x4721a9[_0x2fd40c][_0x969b('0x55')]);}else if(_0x4721a9[_0x2fd40c]['cron']&&_0x4721a9[_0x2fd40c][_0x969b('0x56')]&&moment()[_0x969b('0x57')](_0x4721a9[_0x2fd40c][_0x969b('0x58')],_0x4721a9[_0x2fd40c][_0x969b('0x59')])){manager[_0x969b('0x5a')](_0x2fd40c,_0x4721a9[_0x2fd40c][_0x969b('0x55')],handleJob(_0x4721a9[_0x2fd40c]));manager[_0x969b('0x5b')](_0x2fd40c);logger[_0x969b('0xe')](_0x969b('0x5c'),_0x4721a9[_0x2fd40c][_0x969b('0x13')],_0x4721a9[_0x2fd40c][_0x969b('0x55')]);}else if(manager[_0x969b('0x50')](_0x2fd40c)){manager[_0x969b('0x33')](_0x2fd40c);manager[_0x969b('0x5d')](_0x2fd40c);logger[_0x969b('0xe')](_0x969b('0x5e'),_0x4721a9[_0x2fd40c][_0x969b('0x13')],_0x4721a9[_0x2fd40c][_0x969b('0x55')]);}}for(_0x498f7d=0x0,_0x2fd40c;_0x498f7d<_0x56f4d4[_0x969b('0x5f')]&&!_0x1227ec;_0x498f7d+=0x1){_0x2fd40c=_0x56f4d4[_0x498f7d][_0x969b('0x4e')]();if(manager['exists'](_0x2fd40c)){if(_0x4721a9[_0x2fd40c][_0x969b('0x55')]&&_0x4721a9[_0x2fd40c][_0x969b('0x56')]&&moment()[_0x969b('0x57')](_0x4721a9[_0x2fd40c][_0x969b('0x58')],_0x4721a9[_0x2fd40c][_0x969b('0x59')])){manager[_0x969b('0x60')](_0x2fd40c,_0x4721a9[_0x2fd40c][_0x969b('0x55')],handleJob(_0x4721a9[_0x2fd40c]));logger[_0x969b('0xe')](_0x969b('0x61'),_0x4721a9[_0x2fd40c][_0x969b('0x13')],_0x4721a9[_0x2fd40c]['cron']);}else{manager[_0x969b('0x33')](_0x2fd40c);manager[_0x969b('0x5d')](_0x2fd40c);logger[_0x969b('0xe')](_0x969b('0x5e'),_0x4721a9[_0x2fd40c][_0x969b('0x13')],_0x4721a9[_0x2fd40c]['cron']);}}}})['catch'](function(_0x279644){logger['error'](JSON[_0x969b('0x20')](_0x279644));});}exports[_0x969b('0x62')]=function(_0x336ffa){return getJobs(_0x336ffa);};exports[_0x969b('0x5b')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x6cf4=['no\x20report\x20id','Schedule','findAll','CloudProvider','keys','map','toString','difference','intersection','length','exists','deleteJob','resolve','run\x20job','cron','isBetween','startAt','add','start','add\x20cron','stop\x20cron','active','endAt','update','update\x20cron','run','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','schedule','../../mysqldb','retry','client','http','number','AnalyticExtractedReport','findOne','then','catch','error','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','format','\x22%s\x22\x20<%s>','name','Smtp','user','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','savename','%s.%s','basename','extname','zip','existsSync','attachments','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','Sent','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','request','SendMail','error\x20mail','email\x20sent','case\x20loading','currentAttempt','retryOptions','retries','job','data','stop','still\x20loading','case\x20completed','operation','case\x20empty','case\x20failed','entity','dataValues','Job\x20ID\x20','\x20Attempt\x20#:','report\x20status:','sendMail','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s'];(function(_0x1e4f2d,_0x22e2bb){var _0xd05ce5=function(_0x4c7b43){while(--_0x4c7b43){_0x1e4f2d['push'](_0x1e4f2d['shift']());}};_0xd05ce5(++_0x22e2bb);}(_0x6cf4,0x87));var _0x46cf=function(_0x9be28f,_0x231334){_0x9be28f=_0x9be28f-0x0;var _0xa9f52d=_0x6cf4[_0x9be28f];return _0xa9f52d;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x46cf('0x0'));var _=require(_0x46cf('0x1'));var moment=require(_0x46cf('0x2'));var CronJobManager=require(_0x46cf('0x3'));var jayson=require(_0x46cf('0x4'));var BPromise=require(_0x46cf('0x5'));var logger=require('../logger')(_0x46cf('0x6'));var db=require(_0x46cf('0x7'))['db'];const retry=require(_0x46cf('0x8'));var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x46cf('0x9')][_0x46cf('0xa')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x4c1d20){const _0x754d3f={};if(typeof _0x4c1d20===_0x46cf('0xb')){_0x754d3f['id']=_0x4c1d20;}return db[_0x46cf('0xc')][_0x46cf('0xd')]({'where':_0x754d3f})[_0x46cf('0xe')](function(_0x55b5f9){return _0x55b5f9;})[_0x46cf('0xf')](function(_0x3b43cf){logger[_0x46cf('0x10')](_0x3b43cf);});}function handleSendEmail(_0x194610,_0x5d5775){logger[_0x46cf('0x11')](_0x46cf('0x12'),_0x194610[_0x46cf('0x13')]);var _0x476081=!![];var _0x1f8dad=_0x194610[_0x46cf('0x14')]['getSmtpOptions']();var _0x3960d4={'account':_0x1f8dad,'message':{'from':util[_0x46cf('0x15')](_0x46cf('0x16'),_0x194610[_0x46cf('0x14')][_0x46cf('0x17')],_0x194610[_0x46cf('0x14')]['email']||_0x194610[_0x46cf('0x14')][_0x46cf('0x18')][_0x46cf('0x19')]),'to':_0x194610[_0x46cf('0x13')],'cc':_0x194610['cc'],'bcc':_0x194610['bcc'],'subject':util[_0x46cf('0x15')](_0x46cf('0x1a'),_0x5d5775[_0x46cf('0x17')],_0x194610[_0x46cf('0x1b')],_0x194610[_0x46cf('0x1c')])}};var _0x5b1d06=path[_0x46cf('0x1d')](__dirname,'../../files/reports');var _0x11645e=_0x5d5775[_0x46cf('0x1e')];var _0x33647c=util[_0x46cf('0x15')](_0x46cf('0x1f'),path[_0x46cf('0x20')](_0x5d5775[_0x46cf('0x1e')],path[_0x46cf('0x21')](_0x5d5775[_0x46cf('0x1e')])),_0x46cf('0x22'));var _0x56f8e1=path[_0x46cf('0x1d')](_0x5b1d06,_0x11645e);var _0x52bb73=path['join'](_0x5b1d06,_0x33647c);if(fs[_0x46cf('0x23')](_0x56f8e1)){_0x5d5775['status']='Sent';_0x3960d4['message'][_0x46cf('0x24')]=[{'filename':_0x11645e,'path':_0x56f8e1}];_0x3960d4[_0x46cf('0x25')][_0x46cf('0x26')]=util['format'](_0x46cf('0x27'),JSON[_0x46cf('0x28')](_0x5d5775,null,0x2));}else if(fs['existsSync'](_0x52bb73)){_0x5d5775[_0x46cf('0x29')]=_0x46cf('0x2a');_0x3960d4[_0x46cf('0x25')][_0x46cf('0x24')]=[{'filename':_0x33647c,'path':_0x52bb73}];}else{if(_0x5d5775['status']===_0x46cf('0x2b')){_0x3960d4[_0x46cf('0x25')][_0x46cf('0x26')]=_0x46cf('0x2c');if(!_0x194610[_0x46cf('0x2d')]){_0x476081=![];logger[_0x46cf('0x11')](_0x46cf('0x2e'));}}else if(_0x5d5775[_0x46cf('0x29')]==='Loading'){_0x3960d4['message'][_0x46cf('0x26')]=_0x46cf('0x2f');}else if(_0x5d5775[_0x46cf('0x29')]===_0x46cf('0x30')){_0x3960d4[_0x46cf('0x25')]['text']=_0x46cf('0x31');}else if(_0x5d5775[_0x46cf('0x29')]==='Failed'){_0x3960d4[_0x46cf('0x25')]['text']='Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else{logger[_0x46cf('0x10')](_0x46cf('0x32'),_0x5d5775[_0x46cf('0x29')]);}}if(_0x476081){return client[_0x46cf('0x33')](_0x46cf('0x34'),_0x3960d4)['then'](function(_0xb6a3fe){if(_0xb6a3fe[_0x46cf('0x10')]){return logger[_0x46cf('0x10')](_0x46cf('0x35'),JSON[_0x46cf('0x28')](_0xb6a3fe));}return logger[_0x46cf('0x11')](_0x46cf('0x36'));})[_0x46cf('0xf')](function(_0x399178){return logger[_0x46cf('0x10')](_0x46cf('0x35'),JSON[_0x46cf('0x28')](_0x399178));});}}function handleError(){return function(_0x50c2a7){return logger[_0x46cf('0x10')](JSON[_0x46cf('0x28')](_0x50c2a7));};}function loading(_0x84656){logger[_0x46cf('0x11')](_0x46cf('0x37'));if(_0x84656[_0x46cf('0x38')]===_0x84656[_0x46cf('0x39')][_0x46cf('0x3a')]){handleSendEmail(_0x84656[_0x46cf('0x3b')],_0x84656[_0x46cf('0x3c')]);_0x84656['operation'][_0x46cf('0x3d')]();}else{_0x84656['operation'][_0x46cf('0x8')](_0x46cf('0x3e'));}}function completed(_0x141fcc){logger[_0x46cf('0x11')](_0x46cf('0x3f'));handleSendEmail(_0x141fcc[_0x46cf('0x3b')],_0x141fcc[_0x46cf('0x3c')]);_0x141fcc[_0x46cf('0x40')][_0x46cf('0x3d')]();}function empty(_0xfa6ad0){logger['info'](_0x46cf('0x41'));handleSendEmail(_0xfa6ad0['job'],_0xfa6ad0['data']);_0xfa6ad0['operation'][_0x46cf('0x3d')]();}function failed(_0xd7d891){logger[_0x46cf('0x11')](_0x46cf('0x42'));handleSendEmail(_0xd7d891[_0x46cf('0x3b')],_0xd7d891[_0x46cf('0x3c')]);_0xd7d891[_0x46cf('0x40')]['stop']();}function urecognized(_0x2b097c){logger['error']('Unrecognized\x20status:',_0x2b097c[_0x46cf('0x43')][_0x46cf('0x44')][_0x46cf('0x29')]);_0x2b097c[_0x46cf('0x40')][_0x46cf('0x3d')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x2ca769,_0x362294){const _0x1752ee={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x3f9d6e=retry[_0x46cf('0x40')](_0x1752ee);_0x3f9d6e['attempt'](_0x39eb3a=>{logger[_0x46cf('0x11')](_0x46cf('0x45')+_0x2ca769['id']+_0x46cf('0x46')+_0x39eb3a);try{getReportData(_0x362294['id'])['then'](function(_0x386cb1){_0x362294=_0x386cb1;logger[_0x46cf('0x11')](_0x46cf('0x47'),_0x386cb1[_0x46cf('0x44')][_0x46cf('0x29')]);if(!reportStatusStrategies[_0x386cb1['dataValues'][_0x46cf('0x29')]]){logger[_0x46cf('0x10')](_0x46cf('0x47'),_0x386cb1[_0x46cf('0x44')][_0x46cf('0x29')]);_0x3f9d6e['retry']();}reportStatusStrategies[_0x386cb1[_0x46cf('0x44')]['status']]({'operation':_0x3f9d6e,'currentAttempt':_0x39eb3a,'retryOptions':_0x1752ee,'job':_0x2ca769,'data':_0x362294,'entity':_0x386cb1});});}catch(_0x312752){_0x3f9d6e[_0x46cf('0x8')](_0x312752);}});}function handleResult(_0x4f8c51){return function(_0x433305){if(_0x4f8c51[_0x46cf('0x48')]&&_0x4f8c51[_0x46cf('0x14')]&&_0x4f8c51[_0x46cf('0x14')][_0x46cf('0x18')]&&!_[_0x46cf('0x49')](_0x4f8c51[_0x46cf('0x13')])){retryer(_0x4f8c51,_0x433305);}};}function handleJob(_0x5971ae){return function(){try{if(_[_0x46cf('0x49')](_0x5971ae[_0x46cf('0x1b')])){return logger[_0x46cf('0x11')](_0x46cf('0x4a'));}if(_[_0x46cf('0x49')](_0x5971ae[_0x46cf('0x1c')])){return logger[_0x46cf('0x11')](_0x46cf('0x4b'));}var _0x2bff5d={'startDate':moment()['subtract'](_0x5971ae[_0x46cf('0x1b')],_0x5971ae[_0x46cf('0x1c')])[_0x46cf('0x15')](_0x46cf('0x4c')),'endDate':moment()[_0x46cf('0x15')](_0x46cf('0x4c')),'type':_0x46cf('0x4d'),'output':_0x5971ae['output'],'name':_0x5971ae[_0x46cf('0x17')]};if(!_[_0x46cf('0x49')](_0x5971ae[_0x46cf('0x4e')])){logger['info'](_0x46cf('0x4f'),_0x5971ae[_0x46cf('0x4e')]);return analyticDefaultReportController[_0x46cf('0x50')]({'id':_0x5971ae[_0x46cf('0x4e')]},_0x2bff5d)[_0x46cf('0xe')](handleResult(_0x5971ae))[_0x46cf('0xf')](handleError());}if(!_[_0x46cf('0x49')](_0x5971ae[_0x46cf('0x51')])){logger[_0x46cf('0x11')](_0x46cf('0x52'),_0x5971ae[_0x46cf('0x51')]);return analyticCustomReportController[_0x46cf('0x50')]({'id':_0x5971ae[_0x46cf('0x51')]},_0x2bff5d)[_0x46cf('0xe')](handleResult(_0x5971ae))['catch'](handleError());}}catch(_0x5e5bac){logger[_0x46cf('0x10')](JSON['stringify'](_0x5e5bac));}return logger[_0x46cf('0x11')](_0x46cf('0x53'));};}function getJobs(_0x2eca2e){var _0x3d2057={};if(_0x2eca2e){_0x3d2057['id']=_0x2eca2e;}return db[_0x46cf('0x54')][_0x46cf('0x55')]({'where':_0x3d2057,'include':[{'model':db[_0x46cf('0x14')],'attributes':['id',_0x46cf('0x17'),_0x46cf('0x13')],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0x46cf('0x56')],'as':_0x46cf('0x56')}]}]}]})['then'](function(_0x5c3675){var _0x36d31e=_[_0x46cf('0x57')](manager['jobs']);var _0x17097e=_[_0x46cf('0x58')](_0x5c3675,function(_0xf87d20){return _0xf87d20['id'][_0x46cf('0x59')]();});var _0x16f392=_['keyBy'](_0x5c3675,function(_0x22ac68){return _0x22ac68['id'][_0x46cf('0x59')]();});var _0xdbd370=_0x2eca2e?_0x17097e:_[_0x46cf('0x5a')](_0x17097e,_0x36d31e);var _0x27091b=_[_0x46cf('0x5b')](_0x17097e,_0x36d31e);var _0x1fd03b=_['difference'](_0x36d31e,_0x17097e);var _0x2007d1;var _0xb7bfaa;for(_0x2007d1=0x0;_0x2007d1<_0x1fd03b[_0x46cf('0x5c')]&&!_0x2eca2e;_0x2007d1+=0x1){_0xb7bfaa=_0x1fd03b[_0x2007d1]['toString']();if(manager[_0x46cf('0x5d')](_0xb7bfaa)){manager[_0x46cf('0x3d')](_0xb7bfaa);manager[_0x46cf('0x5e')](_0xb7bfaa);logger['info']('delete\x20cron',_0xb7bfaa);}}logger[_0x46cf('0x11')]('toRun',JSON['stringify'](_0xdbd370));for(_0x2007d1=0x0;_0x2007d1<_0xdbd370['length'];_0x2007d1+=0x1){_0xb7bfaa=_0xdbd370[_0x2007d1][_0x46cf('0x59')]();if(_0x2eca2e){logger[_0x46cf('0x11')](JSON[_0x46cf('0x28')](_0x16f392[_0xb7bfaa]));BPromise[_0x46cf('0x5f')]()[_0x46cf('0xe')](handleJob(_0x16f392[_0xb7bfaa]));logger[_0x46cf('0x11')](_0x46cf('0x60'),_0x16f392[_0xb7bfaa]['name'],_0x16f392[_0xb7bfaa]['cron']);}else if(_0x16f392[_0xb7bfaa][_0x46cf('0x61')]&&_0x16f392[_0xb7bfaa]['active']&&moment()[_0x46cf('0x62')](_0x16f392[_0xb7bfaa][_0x46cf('0x63')],_0x16f392[_0xb7bfaa]['endAt'])){manager[_0x46cf('0x64')](_0xb7bfaa,_0x16f392[_0xb7bfaa]['cron'],handleJob(_0x16f392[_0xb7bfaa]));manager[_0x46cf('0x65')](_0xb7bfaa);logger[_0x46cf('0x11')](_0x46cf('0x66'),_0x16f392[_0xb7bfaa][_0x46cf('0x17')],_0x16f392[_0xb7bfaa][_0x46cf('0x61')]);}else if(manager[_0x46cf('0x5d')](_0xb7bfaa)){manager[_0x46cf('0x3d')](_0xb7bfaa);manager[_0x46cf('0x5e')](_0xb7bfaa);logger[_0x46cf('0x11')](_0x46cf('0x67'),_0x16f392[_0xb7bfaa][_0x46cf('0x17')],_0x16f392[_0xb7bfaa][_0x46cf('0x61')]);}}for(_0x2007d1=0x0,_0xb7bfaa;_0x2007d1<_0x27091b['length']&&!_0x2eca2e;_0x2007d1+=0x1){_0xb7bfaa=_0x27091b[_0x2007d1][_0x46cf('0x59')]();if(manager[_0x46cf('0x5d')](_0xb7bfaa)){if(_0x16f392[_0xb7bfaa][_0x46cf('0x61')]&&_0x16f392[_0xb7bfaa][_0x46cf('0x68')]&&moment()[_0x46cf('0x62')](_0x16f392[_0xb7bfaa][_0x46cf('0x63')],_0x16f392[_0xb7bfaa][_0x46cf('0x69')])){manager[_0x46cf('0x6a')](_0xb7bfaa,_0x16f392[_0xb7bfaa]['cron'],handleJob(_0x16f392[_0xb7bfaa]));logger[_0x46cf('0x11')](_0x46cf('0x6b'),_0x16f392[_0xb7bfaa][_0x46cf('0x17')],_0x16f392[_0xb7bfaa][_0x46cf('0x61')]);}else{manager['stop'](_0xb7bfaa);manager[_0x46cf('0x5e')](_0xb7bfaa);logger[_0x46cf('0x11')](_0x46cf('0x67'),_0x16f392[_0xb7bfaa][_0x46cf('0x17')],_0x16f392[_0xb7bfaa][_0x46cf('0x61')]);}}}})[_0x46cf('0xf')](function(_0x31ded8){logger[_0x46cf('0x10')](JSON['stringify'](_0x31ded8));});}exports[_0x46cf('0x6c')]=function(_0x4192cb){return getJobs(_0x4192cb);};exports[_0x46cf('0x65')]=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 3877861..4a7d811 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 _0x2ec8=['Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','sentimentAccountId','CloudProvider','findOne','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20available','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribe','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','lodash','aws-sdk','request-promise','util','../../mysqldb','getTranscriptionJob','Comprehend','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','transcribeRegion','transcribeName','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','Transcript','then','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment'];(function(_0x10f281,_0x5e8e8f){var _0x495274=function(_0x67b0c5){while(--_0x67b0c5){_0x10f281['push'](_0x10f281['shift']());}};_0x495274(++_0x5e8e8f);}(_0x2ec8,0x188));var _0x82ec=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2ec8[_0x501510];return _0x1e6ee5;};var _=require(_0x82ec('0x0'));var AWS=require(_0x82ec('0x1'));var rp=require(_0x82ec('0x2'));var util=require(_0x82ec('0x3'));var BPromise=require('bluebird');var db=require(_0x82ec('0x4'))['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x1b21cd,_0x51192a,_0x1ba7b4,_0x1baccd){return new Promise(function(_0x528e26,_0x4c9400){var _0x5c786a=new AWS['TranscribeService']({'accessKeyId':_0x51192a,'secretAccessKey':_0x1b21cd,'region':_0x1ba7b4});_0x5c786a[_0x82ec('0x5')]({'TranscriptionJobName':_0x1baccd},function(_0x3ceabc,_0x4dd14f){if(_0x3ceabc){return _0x4c9400(_0x3ceabc);}else{return _0x528e26(_0x4dd14f);}});});}function sentiment(_0x53c644,_0x1c3022,_0x132ac9,_0x4da5d8,_0x2810d4){return new Promise(function(_0xf1ab6c,_0x749932){var _0x46a3be=new AWS[(_0x82ec('0x6'))]({'accessKeyId':_0x1c3022,'secretAccessKey':_0x53c644,'region':_0x132ac9});_0x46a3be['detectSentiment']({'Text':_0x4da5d8,'LanguageCode':_0x2810d4[_0x82ec('0x7')](0x0,0x2)},function(_0x1a53f5,_0x445d3f){if(_0x1a53f5){return _0x749932(_0x1a53f5);}else{return _0xf1ab6c(_0x445d3f);}});});}function checkTranscribeJob(_0x55717e,_0x317339,_0x1eb33e){var _0x53d03a;return new BPromise(function(_0x26181f,_0x52f476){logger[_0x82ec('0x8')](util[_0x82ec('0x9')](_0x82ec('0xa'),_0x55717e['id'],_0x55717e['transcribeName']));return getTranscriptionJob(_0x1eb33e[_0x82ec('0xb')],_0x1eb33e['data2'],_0x317339[_0x82ec('0xc')],_0x55717e[_0x82ec('0xd')])['then'](function(_0x57a4f3){logger[_0x82ec('0x8')](util[_0x82ec('0x9')](_0x82ec('0xe'),_0x55717e['id'],_0x55717e[_0x82ec('0xd')],_0x57a4f3[_0x82ec('0xf')][_0x82ec('0x10')]));if(!_0x55717e[_0x82ec('0x11')]){switch(_0x57a4f3['TranscriptionJob'][_0x82ec('0x10')]){case _0x82ec('0x12'):var _0x5430a9={'transcribeStatus':_0x57a4f3['TranscriptionJob'][_0x82ec('0x10')],'fileUri':_0x57a4f3[_0x82ec('0xf')]['Transcript'][_0x82ec('0x13')]};logger['info'](util[_0x82ec('0x9')]('[RECORDING:%d]\x20Get\x20transcript',_0x55717e['id']));return rp({'uri':_0x57a4f3[_0x82ec('0xf')][_0x82ec('0x14')][_0x82ec('0x13')],'json':!![]})[_0x82ec('0x15')](function(_0x161cb4){logger[_0x82ec('0x8')](util[_0x82ec('0x9')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x55717e['id']));if(_0x161cb4&&_0x161cb4[_0x82ec('0x16')]&&_0x161cb4['results'][_0x82ec('0x17')]&&_0x161cb4[_0x82ec('0x16')][_0x82ec('0x17')][_0x82ec('0x18')]){_0x5430a9[_0x82ec('0x11')]='';for(var _0x49d36c=0x0;_0x49d36c<_0x161cb4[_0x82ec('0x16')][_0x82ec('0x17')][_0x82ec('0x18')];_0x49d36c++){_0x5430a9[_0x82ec('0x11')]+=_0x161cb4['results'][_0x82ec('0x17')][_0x49d36c]['transcript']+'';}}return _0x55717e[_0x82ec('0x19')](_0x5430a9);})['then'](function(){logger[_0x82ec('0x8')](util[_0x82ec('0x9')](_0x82ec('0x1a'),_0x55717e['id']));if(!_0x55717e[_0x82ec('0x1b')]){throw new db[(_0x82ec('0x1c'))][(_0x82ec('0x1d'))](_0x82ec('0x1e'));}if(!_0x317339[_0x82ec('0x1f')]||!_0x317339['sentimentAccountId']||!_0x317339[_0x82ec('0x20')]||!_0x317339[_0x82ec('0x21')]||!_0x317339[_0x82ec('0x22')]){throw new db[(_0x82ec('0x1c'))]['ValidationError'](_0x82ec('0x23'));}if(!_0x5430a9[_0x82ec('0x11')]){throw new Error('Transcript\x20not\x20available');}if(_0x317339[_0x82ec('0x24')]===_0x1eb33e['id']){return _0x1eb33e;}else{return db[_0x82ec('0x25')][_0x82ec('0x26')]({'where':{'id':_settings[_0x82ec('0x24')]}});}})[_0x82ec('0x15')](function(_0x538802){if(!_0x538802){throw new db[(_0x82ec('0x1c'))][(_0x82ec('0x1d'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x538802[_0x82ec('0xb')]||!_0x538802[_0x82ec('0x27')]){throw new db[(_0x82ec('0x1c'))]['ValidationError'](_0x82ec('0x28'));}_0x53d03a=_0x538802;logger[_0x82ec('0x8')](util['format'](_0x82ec('0x29'),_0x55717e['id']));return sentiment(_0x53d03a[_0x82ec('0xb')],_0x53d03a[_0x82ec('0x27')],_0x317339['sentimentRegion'],_0x5430a9[_0x82ec('0x11')],_0x317339[_0x82ec('0x21')]);})[_0x82ec('0x15')](function(_0x116f8a){logger[_0x82ec('0x8')](util['format'](_0x82ec('0x2a'),_0x55717e['id']));return _0x55717e[_0x82ec('0x19')]({'sentiment':_0x116f8a[_0x82ec('0x2b')],'sPositive':_0x116f8a[_0x82ec('0x2c')][_0x82ec('0x2d')],'sNegative':_0x116f8a[_0x82ec('0x2c')][_0x82ec('0x2e')],'sMixed':_0x116f8a['SentimentScore'][_0x82ec('0x2f')],'sNeutral':_0x116f8a[_0x82ec('0x2c')][_0x82ec('0x30')]});})[_0x82ec('0x15')](function(){logger[_0x82ec('0x8')](util[_0x82ec('0x9')](_0x82ec('0x1a'),_0x55717e['id']));_0x26181f();});case _0x82ec('0x31'):return _0x55717e[_0x82ec('0x19')]({'transcribeStatus':_0x82ec('0x31'),'failureReason':_0x57a4f3['TranscriptionJob']['FailureReason']})['then'](function(){logger[_0x82ec('0x8')](util[_0x82ec('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x55717e['id']));_0x26181f();});default:logger[_0x82ec('0x8')](util[_0x82ec('0x9')](_0x82ec('0x32'),_0x55717e['id']));break;}}else{return BPromise[_0x82ec('0x33')]()['then'](function(){if(!_0x55717e[_0x82ec('0x1b')]){throw new db[(_0x82ec('0x1c'))][(_0x82ec('0x1d'))](_0x82ec('0x1e'));}if(!_0x317339[_0x82ec('0x1f')]||!_0x317339[_0x82ec('0x24')]||!_0x317339[_0x82ec('0x20')]||!_0x317339[_0x82ec('0x21')]||!_0x317339[_0x82ec('0x22')]){throw new db[(_0x82ec('0x1c'))][(_0x82ec('0x1d'))](_0x82ec('0x23'));}if(!_0x55717e[_0x82ec('0x11')]){throw new Error(_0x82ec('0x34'));}if(_0x317339['sentimentAccountId']===_0x1eb33e['id']){return _0x1eb33e;}else{return db[_0x82ec('0x25')][_0x82ec('0x26')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x4b9eaf){if(!_0x4b9eaf){throw new db[(_0x82ec('0x1c'))]['ValidationError'](_0x82ec('0x35'));}if(!_0x4b9eaf[_0x82ec('0xb')]||!_0x4b9eaf[_0x82ec('0x27')]){throw new db['Sequelize'][(_0x82ec('0x1d'))](_0x82ec('0x28'));}_0x53d03a=_0x4b9eaf;logger[_0x82ec('0x8')](util[_0x82ec('0x9')](_0x82ec('0x29'),_0x55717e['id']));return sentiment(_0x53d03a[_0x82ec('0xb')],_0x53d03a[_0x82ec('0x27')],_0x317339[_0x82ec('0x20')],_0x55717e['fileText'],_0x317339['language']);})['then'](function(_0x4957f){logger[_0x82ec('0x8')](util[_0x82ec('0x9')](_0x82ec('0x2a'),_0x55717e['id']));return _0x55717e[_0x82ec('0x19')]({'sentiment':_0x4957f[_0x82ec('0x2b')],'sPositive':_0x4957f['SentimentScore'][_0x82ec('0x2d')],'sNegative':_0x4957f[_0x82ec('0x2c')][_0x82ec('0x2e')],'sMixed':_0x4957f[_0x82ec('0x2c')][_0x82ec('0x2f')],'sNeutral':_0x4957f[_0x82ec('0x2c')][_0x82ec('0x30')],'transcribeStatus':'COMPLETED'});})[_0x82ec('0x15')](function(){logger[_0x82ec('0x8')](util[_0x82ec('0x9')](_0x82ec('0x1a'),_0x55717e['id']));_0x26181f();});}})[_0x82ec('0x36')](function(_0x1d7551){if(_0x1d7551){if(!_0x1d7551[_0x82ec('0x37')]||_0x1d7551['name']!==_0x82ec('0x38')){logger[_0x82ec('0x39')](util[_0x82ec('0x9')](_0x82ec('0x3a'),_0x55717e['id']),util[_0x82ec('0x3b')](_0x1d7551,{'showHidden':![],'depth':null}));}}_0x26181f();});});}function checkTranscribe(){var _0x2f888a;var _0x4a9901;var _0x34b20b;return db[_0x82ec('0x3c')][_0x82ec('0x3d')]({'where':{'transcribeStatus':_0x82ec('0x3e')}})[_0x82ec('0x15')](function(_0x3f6820){if(!_0x3f6820||!_0x3f6820[_0x82ec('0x18')]){throw new db['Sequelize']['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0x2f888a=_0x3f6820;return db[_0x82ec('0x3f')][_0x82ec('0x26')]({'where':{'id':0x1}});})['then'](function(_0x528907){if(!_0x528907){throw new db[(_0x82ec('0x1c'))][(_0x82ec('0x1d'))](_0x82ec('0x40'));}_0x4a9901=_0x528907;if(!_0x4a9901[_0x82ec('0x41')]||!_0x4a9901['transcribeAccountId']||!_0x4a9901[_0x82ec('0xc')]||!_0x4a9901[_0x82ec('0x21')]||!_0x4a9901[_0x82ec('0x22')]){throw new db[(_0x82ec('0x1c'))]['ValidationError'](_0x82ec('0x42'));}return db[_0x82ec('0x25')]['findOne']({'where':{'id':_0x4a9901[_0x82ec('0x43')]}});})['then'](function(_0x518af8){if(!_0x518af8){throw new db['Sequelize'][(_0x82ec('0x1d'))](_0x82ec('0x35'));}if(!_0x518af8[_0x82ec('0xb')]||!_0x518af8[_0x82ec('0x27')]){throw new db[(_0x82ec('0x1c'))][(_0x82ec('0x1d'))](_0x82ec('0x28'));}_0x34b20b=_0x518af8;var _0x35a863=[];_0x2f888a[_0x82ec('0x44')](function(_0x15570b){_0x35a863[_0x82ec('0x45')](checkTranscribeJob(_0x15570b,_0x4a9901,_0x34b20b));});return BPromise['all'](_0x35a863);})[_0x82ec('0x36')](function(_0x307267){if(_0x307267){if(!_0x307267[_0x82ec('0x37')]||_0x307267[_0x82ec('0x37')]!==_0x82ec('0x38')){logger[_0x82ec('0x39')](util[_0x82ec('0x3b')](_0x307267,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x3715=['Comprehend','detectSentiment','substring','info','format','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','resolve','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','transcribeAccountId','findOne','forEach','inspect','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3715,0xc3));var _0x5371=function(_0xb219c6,_0x2d7100){_0xb219c6=_0xb219c6-0x0;var _0xc188e9=_0x3715[_0xb219c6];return _0xc188e9;};var _=require(_0x5371('0x0'));var AWS=require(_0x5371('0x1'));var rp=require(_0x5371('0x2'));var util=require(_0x5371('0x3'));var BPromise=require(_0x5371('0x4'));var db=require(_0x5371('0x5'))['db'];var logger=require(_0x5371('0x6'))(_0x5371('0x7'));function getTranscriptionJob(_0x3ff067,_0x355d6a,_0x13c458,_0x368886){return new Promise(function(_0x50a759,_0x1ffdcb){var _0x340e44=new AWS['TranscribeService']({'accessKeyId':_0x355d6a,'secretAccessKey':_0x3ff067,'region':_0x13c458});_0x340e44[_0x5371('0x8')]({'TranscriptionJobName':_0x368886},function(_0x16c64a,_0x41d142){if(_0x16c64a){return _0x1ffdcb(_0x16c64a);}else{return _0x50a759(_0x41d142);}});});}function sentiment(_0x56debd,_0xdbc695,_0x48b76c,_0x56e64c,_0x36760c){return new Promise(function(_0x1f7021,_0x6b17f8){var _0x55f6f6=new AWS[(_0x5371('0x9'))]({'accessKeyId':_0xdbc695,'secretAccessKey':_0x56debd,'region':_0x48b76c});_0x55f6f6[_0x5371('0xa')]({'Text':_0x56e64c,'LanguageCode':_0x36760c[_0x5371('0xb')](0x0,0x2)},function(_0x55653f,_0x4df51b){if(_0x55653f){return _0x6b17f8(_0x55653f);}else{return _0x1f7021(_0x4df51b);}});});}function checkTranscribeJob(_0x2207f2,_0x1faac2,_0x1b0a8a){var _0x5b4adf;return new BPromise(function(_0x445408,_0x4c5df6){logger[_0x5371('0xc')](util[_0x5371('0xd')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x2207f2['id'],_0x2207f2[_0x5371('0xe')]));return getTranscriptionJob(_0x1b0a8a[_0x5371('0xf')],_0x1b0a8a[_0x5371('0x10')],_0x1faac2[_0x5371('0x11')],_0x2207f2[_0x5371('0xe')])[_0x5371('0x12')](function(_0x33b592){logger['info'](util[_0x5371('0xd')](_0x5371('0x13'),_0x2207f2['id'],_0x2207f2[_0x5371('0xe')],_0x33b592[_0x5371('0x14')][_0x5371('0x15')]));if(!_0x2207f2[_0x5371('0x16')]){switch(_0x33b592[_0x5371('0x14')]['TranscriptionJobStatus']){case'COMPLETED':var _0x250ca4={'transcribeStatus':_0x33b592['TranscriptionJob'][_0x5371('0x15')],'fileUri':_0x33b592['TranscriptionJob'][_0x5371('0x17')][_0x5371('0x18')]};logger['info'](util[_0x5371('0xd')](_0x5371('0x19'),_0x2207f2['id']));return rp({'uri':_0x33b592['TranscriptionJob'][_0x5371('0x17')][_0x5371('0x18')],'json':!![]})[_0x5371('0x12')](function(_0x5eacf2){logger['info'](util['format'](_0x5371('0x1a'),_0x2207f2['id']));if(_0x5eacf2&&_0x5eacf2[_0x5371('0x1b')]&&_0x5eacf2[_0x5371('0x1b')][_0x5371('0x1c')]&&_0x5eacf2[_0x5371('0x1b')][_0x5371('0x1c')]['length']){_0x250ca4[_0x5371('0x16')]='';for(var _0x4992e4=0x0;_0x4992e4<_0x5eacf2[_0x5371('0x1b')]['transcripts'][_0x5371('0x1d')];_0x4992e4++){_0x250ca4[_0x5371('0x16')]+=_0x5eacf2['results'][_0x5371('0x1c')][_0x4992e4][_0x5371('0x1e')]+'';}}return _0x2207f2[_0x5371('0x1f')](_0x250ca4);})[_0x5371('0x12')](function(){logger[_0x5371('0xc')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2207f2['id']));if(!_0x2207f2[_0x5371('0x20')]){throw new db['Sequelize']['ValidationError'](_0x5371('0x21'));}if(!_0x1faac2[_0x5371('0x22')]||!_0x1faac2['sentimentAccountId']||!_0x1faac2[_0x5371('0x23')]||!_0x1faac2[_0x5371('0x24')]||!_0x1faac2[_0x5371('0x25')]){throw new db[(_0x5371('0x26'))][(_0x5371('0x27'))](_0x5371('0x28'));}if(!_0x250ca4[_0x5371('0x16')]){throw new Error(_0x5371('0x29'));}if(_0x1faac2[_0x5371('0x2a')]===_0x1b0a8a['id']){return _0x1b0a8a;}else{return db[_0x5371('0x2b')]['findOne']({'where':{'id':_settings[_0x5371('0x2a')]}});}})['then'](function(_0x2f24b1){if(!_0x2f24b1){throw new db['Sequelize']['ValidationError'](_0x5371('0x2c'));}if(!_0x2f24b1[_0x5371('0xf')]||!_0x2f24b1[_0x5371('0x10')]){throw new db[(_0x5371('0x26'))][(_0x5371('0x27'))](_0x5371('0x2d'));}_0x5b4adf=_0x2f24b1;logger['info'](util[_0x5371('0xd')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x2207f2['id']));return sentiment(_0x5b4adf[_0x5371('0xf')],_0x5b4adf[_0x5371('0x10')],_0x1faac2[_0x5371('0x23')],_0x250ca4[_0x5371('0x16')],_0x1faac2[_0x5371('0x24')]);})[_0x5371('0x12')](function(_0x120ee1){logger['info'](util[_0x5371('0xd')](_0x5371('0x2e'),_0x2207f2['id']));return _0x2207f2[_0x5371('0x1f')]({'sentiment':_0x120ee1[_0x5371('0x2f')],'sPositive':_0x120ee1[_0x5371('0x30')][_0x5371('0x31')],'sNegative':_0x120ee1[_0x5371('0x30')]['Negative'],'sMixed':_0x120ee1[_0x5371('0x30')][_0x5371('0x32')],'sNeutral':_0x120ee1['SentimentScore'][_0x5371('0x33')]});})[_0x5371('0x12')](function(){logger[_0x5371('0xc')](util[_0x5371('0xd')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2207f2['id']));_0x445408();});case _0x5371('0x34'):return _0x2207f2[_0x5371('0x1f')]({'transcribeStatus':'FAILED','failureReason':_0x33b592[_0x5371('0x14')][_0x5371('0x35')]})[_0x5371('0x12')](function(){logger[_0x5371('0xc')](util[_0x5371('0xd')](_0x5371('0x36'),_0x2207f2['id']));_0x445408();});default:logger[_0x5371('0xc')](util[_0x5371('0xd')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x2207f2['id']));break;}}else{return BPromise[_0x5371('0x37')]()[_0x5371('0x12')](function(){if(!_0x2207f2[_0x5371('0x20')]){throw new db[(_0x5371('0x26'))]['ValidationError'](_0x5371('0x21'));}if(!_0x1faac2[_0x5371('0x22')]||!_0x1faac2[_0x5371('0x2a')]||!_0x1faac2[_0x5371('0x23')]||!_0x1faac2[_0x5371('0x24')]||!_0x1faac2[_0x5371('0x25')]){throw new db['Sequelize'][(_0x5371('0x27'))](_0x5371('0x28'));}if(!_0x2207f2[_0x5371('0x16')]){throw new Error(_0x5371('0x29'));}if(_0x1faac2[_0x5371('0x2a')]===_0x1b0a8a['id']){return _0x1b0a8a;}else{return db[_0x5371('0x2b')]['findOne']({'where':{'id':_settings[_0x5371('0x2a')]}});}})[_0x5371('0x12')](function(_0x711476){if(!_0x711476){throw new db[(_0x5371('0x26'))][(_0x5371('0x27'))](_0x5371('0x2c'));}if(!_0x711476['data1']||!_0x711476[_0x5371('0x10')]){throw new db['Sequelize']['ValidationError'](_0x5371('0x2d'));}_0x5b4adf=_0x711476;logger['info'](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x2207f2['id']));return sentiment(_0x5b4adf[_0x5371('0xf')],_0x5b4adf[_0x5371('0x10')],_0x1faac2[_0x5371('0x23')],_0x2207f2['fileText'],_0x1faac2[_0x5371('0x24')]);})[_0x5371('0x12')](function(_0x5c05d7){logger['info'](util[_0x5371('0xd')](_0x5371('0x2e'),_0x2207f2['id']));return _0x2207f2[_0x5371('0x1f')]({'sentiment':_0x5c05d7[_0x5371('0x2f')],'sPositive':_0x5c05d7['SentimentScore']['Positive'],'sNegative':_0x5c05d7['SentimentScore']['Negative'],'sMixed':_0x5c05d7['SentimentScore'][_0x5371('0x32')],'sNeutral':_0x5c05d7['SentimentScore'][_0x5371('0x33')],'transcribeStatus':'COMPLETED'});})[_0x5371('0x12')](function(){logger[_0x5371('0xc')](util[_0x5371('0xd')](_0x5371('0x36'),_0x2207f2['id']));_0x445408();});}})['catch'](function(_0x434ea9){if(_0x434ea9){if(!_0x434ea9[_0x5371('0x38')]||_0x434ea9['name']!==_0x5371('0x39')){logger[_0x5371('0x3a')](util['format'](_0x5371('0x3b'),_0x2207f2['id']),util['inspect'](_0x434ea9,{'showHidden':![],'depth':null}));}}_0x445408();});});}function checkTranscribe(){var _0x594710;var _0x394fad;var _0x179163;return db[_0x5371('0x3c')][_0x5371('0x3d')]({'where':{'transcribeStatus':_0x5371('0x3e')}})[_0x5371('0x12')](function(_0x10e42f){if(!_0x10e42f||!_0x10e42f['length']){throw new db[(_0x5371('0x26'))][(_0x5371('0x27'))](_0x5371('0x3f'));}_0x594710=_0x10e42f;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0x5371('0x12')](function(_0x334b29){if(!_0x334b29){throw new db['Sequelize'][(_0x5371('0x27'))]('Settings\x20not\x20available');}_0x394fad=_0x334b29;if(!_0x394fad[_0x5371('0x7')]||!_0x394fad[_0x5371('0x40')]||!_0x394fad[_0x5371('0x11')]||!_0x394fad[_0x5371('0x24')]||!_0x394fad['bucket']){throw new db[(_0x5371('0x26'))]['ValidationError']('Transcribe\x20not\x20configured');}return db[_0x5371('0x2b')][_0x5371('0x41')]({'where':{'id':_0x394fad[_0x5371('0x40')]}});})['then'](function(_0x1a2512){if(!_0x1a2512){throw new db['Sequelize'][(_0x5371('0x27'))](_0x5371('0x2c'));}if(!_0x1a2512['data1']||!_0x1a2512[_0x5371('0x10')]){throw new db[(_0x5371('0x26'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x179163=_0x1a2512;var _0x343584=[];_0x594710[_0x5371('0x42')](function(_0x17bf6f){_0x343584['push'](checkTranscribeJob(_0x17bf6f,_0x394fad,_0x179163));});return BPromise['all'](_0x343584);})['catch'](function(_0x15e7e1){if(_0x15e7e1){if(!_0x15e7e1[_0x5371('0x38')]||_0x15e7e1[_0x5371('0x38')]!==_0x5371('0x39')){logger[_0x5371('0x3a')](util[_0x5371('0x43')](_0x15e7e1,{'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 ee0de1a..87dd02a 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 _0x59c7=['then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','util','../../config/environment','../logger','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','subtract','hours'];(function(_0x259d1b,_0x548317){var _0x55a111=function(_0x43743a){while(--_0x43743a){_0x259d1b['push'](_0x259d1b['shift']());}};_0x55a111(++_0x548317);}(_0x59c7,0x1b4));var _0x759c=function(_0xe3d179,_0x2a4698){_0xe3d179=_0xe3d179-0x0;var _0xf8eb37=_0x59c7[_0xe3d179];return _0xf8eb37;};'use strict';var _=require(_0x759c('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0x759c('0x1'));var config=require(_0x759c('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x759c('0x3'))(_0x759c('0x4'));config['redis']=_['defaults'](config[_0x759c('0x5')],{'host':_0x759c('0x6'),'port':0x18eb});var io=require(_0x759c('0x7'))(new Redis(config[_0x759c('0x5')]));function closeInteractions(){var _0x4583f3=[];return db[_0x759c('0x8')]['findAll']({'raw':!![],'attributes':['id',_0x759c('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x759c('0xa')](0x18,_0x759c('0xb'))}}})[_0x759c('0xc')](function(_0x633652){if(_0x633652&&_0x633652[_0x759c('0xd')]){_0x4583f3=_['map'](_0x633652||[],'id');logger[_0x759c('0xe')](_0x759c('0xf'),_0x4583f3[_0x759c('0x10')]());return db['WhatsappInteraction'][_0x759c('0x11')]({'closeReason':_0x759c('0x12'),'disposition':_0x759c('0x13'),'closed':!![],'closedAt':moment()[_0x759c('0x14')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x4583f3}});}})['then'](function(){if(_0x4583f3&&_0x4583f3['length']){logger['info'](_0x759c('0x15'),_0x4583f3['join']());for(var _0x4dfaf0=0x0;_0x4dfaf0<_0x4583f3[_0x759c('0xd')];_0x4dfaf0++){io[_0x759c('0x16')](_0x759c('0x17'),{'id':_0x4583f3[_0x4dfaf0],'closed':!![]});}}})[_0x759c('0x18')](function(_0x272284){logger[_0x759c('0x19')](_0x759c('0x1a'),_0x272284?util['inspect'](_0x272284,{'showHidden':![],'depth':null}):'');});}exports[_0x759c('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x048d=['length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','system','timeout','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','socket.io-emitter','findAll','lastMsgAt','subtract','hours','then'];(function(_0x495234,_0x5f02a6){var _0x498c37=function(_0x54ac77){while(--_0x54ac77){_0x495234['push'](_0x495234['shift']());}};_0x498c37(++_0x5f02a6);}(_0x048d,0x1c3));var _0xd048=function(_0x4ae459,_0x3bf329){_0x4ae459=_0x4ae459-0x0;var _0x51d0c9=_0x048d[_0x4ae459];return _0x51d0c9;};'use strict';var _=require('lodash');var moment=require(_0xd048('0x0'));var Redis=require(_0xd048('0x1'));var util=require(_0xd048('0x2'));var config=require(_0xd048('0x3'));var db=require(_0xd048('0x4'))['db'];var logger=require(_0xd048('0x5'))(_0xd048('0x6'));config['redis']=_['defaults'](config[_0xd048('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xd048('0x8'))(new Redis(config[_0xd048('0x7')]));function closeInteractions(){var _0x1a50e2=[];return db['WhatsappInteraction'][_0xd048('0x9')]({'raw':!![],'attributes':['id',_0xd048('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xd048('0xb')](0x18,_0xd048('0xc'))}}})[_0xd048('0xd')](function(_0x18f9c1){if(_0x18f9c1&&_0x18f9c1[_0xd048('0xe')]){_0x1a50e2=_[_0xd048('0xf')](_0x18f9c1||[],'id');logger[_0xd048('0x10')](_0xd048('0x11'),_0x1a50e2[_0xd048('0x12')]());return db[_0xd048('0x13')][_0xd048('0x14')]({'closeReason':_0xd048('0x15'),'disposition':_0xd048('0x16'),'closed':!![],'closedAt':moment()[_0xd048('0x17')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x1a50e2}});}})['then'](function(){if(_0x1a50e2&&_0x1a50e2[_0xd048('0xe')]){logger[_0xd048('0x10')](_0xd048('0x18'),_0x1a50e2[_0xd048('0x12')]());for(var _0x4b660c=0x0;_0x4b660c<_0x1a50e2[_0xd048('0xe')];_0x4b660c++){io[_0xd048('0x19')](_0xd048('0x1a'),{'id':_0x1a50e2[_0x4b660c],'closed':!![]});}}})[_0xd048('0x1b')](function(_0x3b8ae5){logger[_0xd048('0x1c')](_0xd048('0x1d'),_0x3b8ae5?util['inspect'](_0x3b8ae5,{'showHidden':![],'depth':null}):'');});}exports[_0xd048('0x1e')]=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 5e5e774..317610d 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe1c0=['finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','util','../mysqldb','Innocenzo','@xcally.com','push','now','Biondo','innocenzo.biondo','CmContact','destroy','then','bulkCreate','log'];(function(_0x295317,_0x46aebf){var _0x458246=function(_0x46f6ee){while(--_0x46f6ee){_0x295317['push'](_0x295317['shift']());}};_0x458246(++_0x46aebf);}(_0xe1c0,0x110));var _0x0e1c=function(_0x356bf0,_0x2315cf){_0x356bf0=_0x356bf0-0x0;var _0x480b0b=_0xe1c0[_0x356bf0];return _0x480b0b;};'use strict';var util=require(_0x0e1c('0x0'));var db=require(_0x0e1c('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x0e1c('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x0e1c('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x0e1c('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x0e1c('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x0e1c('0x5')](),'updatedAt':Date[_0x0e1c('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x0e1c('0x4')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x0e1c('0x6')+i,'phone':0xf879fb460+i,'email':_0x0e1c('0x7')+i+_0x0e1c('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x0e1c('0x4')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x0e1c('0x5')](),'updatedAt':Date[_0x0e1c('0x5')]()});}db[_0x0e1c('0x8')][_0x0e1c('0x9')]({'where':{}})[_0x0e1c('0xa')](function(){return db[_0x0e1c('0x8')][_0x0e1c('0xb')](contacts);})[_0x0e1c('0xa')](function(){console[_0x0e1c('0xc')](_0x0e1c('0xd'),_0x0e1c('0xe'));return db[_0x0e1c('0xf')][_0x0e1c('0x9')]({'where':{}});})[_0x0e1c('0xa')](function(){return db[_0x0e1c('0xf')][_0x0e1c('0xb')](hopper);})[_0x0e1c('0xa')](function(){console[_0x0e1c('0xc')](_0x0e1c('0xd'),_0x0e1c('0x10'));return db[_0x0e1c('0x8')][_0x0e1c('0xb')](contacts2);})[_0x0e1c('0xa')](function(){console[_0x0e1c('0xc')]('finished\x20populating',_0x0e1c('0x11'));return db[_0x0e1c('0xf')][_0x0e1c('0xb')](hopper2);})['then'](function(){console[_0x0e1c('0xc')](_0x0e1c('0xd'),_0x0e1c('0x12'));})['catch'](function(_0x412c9c){console[_0x0e1c('0xc')](_0x412c9c);}); \ No newline at end of file +var _0xe01c=['now','Biondo','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','util','../mysqldb','push','Innocenzo','innocenzo.biondo','@xcally.com'];(function(_0x10dbf6,_0x3ff964){var _0x452147=function(_0x7476e0){while(--_0x7476e0){_0x10dbf6['push'](_0x10dbf6['shift']());}};_0x452147(++_0x3ff964);}(_0xe01c,0x1f2));var _0xce01=function(_0x16990f,_0x66dccd){_0x16990f=_0x16990f-0x0;var _0x4efc92=_0xe01c[_0x16990f];return _0x4efc92;};'use strict';var util=require(_0xce01('0x0'));var db=require(_0xce01('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xce01('0x2')]({'id':i,'firstName':_0xce01('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xce01('0x4')+i+_0xce01('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xce01('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xce01('0x6')](),'updatedAt':Date[_0xce01('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xce01('0x7')+i,'phone':0xf879fb460+i,'email':_0xce01('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xce01('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xce01('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xce01('0x6')]()});}db[_0xce01('0x8')][_0xce01('0x9')]({'where':{}})[_0xce01('0xa')](function(){return db[_0xce01('0x8')][_0xce01('0xb')](contacts);})['then'](function(){console[_0xce01('0xc')](_0xce01('0xd'),_0xce01('0xe'));return db[_0xce01('0xf')][_0xce01('0x9')]({'where':{}});})[_0xce01('0xa')](function(){return db[_0xce01('0xf')][_0xce01('0xb')](hopper);})[_0xce01('0xa')](function(){console['log'](_0xce01('0xd'),_0xce01('0x10'));return db[_0xce01('0x8')][_0xce01('0xb')](contacts2);})[_0xce01('0xa')](function(){console['log']('finished\x20populating',_0xce01('0x11'));return db[_0xce01('0xf')]['bulkCreate'](hopper2);})[_0xce01('0xa')](function(){console[_0xce01('0xc')](_0xce01('0xd'),'hopper2');})['catch'](function(_0x186708){console[_0xce01('0xc')](_0x186708);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index e06ca81..7f880bd 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed7a=['bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','format','agent','%s%s','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User'];(function(_0xcf5436,_0x4632c3){var _0xc4f5c8=function(_0x567528){while(--_0x567528){_0xcf5436['push'](_0xcf5436['shift']());}};_0xc4f5c8(++_0x4632c3);}(_0xed7a,0xb5));var _0xaed7=function(_0x40e16d,_0x57ec73){_0x40e16d=_0x40e16d-0x0;var _0x3d0d84=_0xed7a[_0x40e16d];return _0x3d0d84;};'use strict';var util=require(_0xaed7('0x0'));var db=require(_0xaed7('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xaed7('0x2')]({'name':util[_0xaed7('0x3')]('%s%s',_0xaed7('0x4'),i),'fullname':util[_0xaed7('0x3')](_0xaed7('0x5'),_0xaed7('0x4'),i),'email':util[_0xaed7('0x3')]('%s%s@xcally.com',_0xaed7('0x4'),i),'role':'agent','password':_0xaed7('0x6'),'internal':0xfa0+i,'type':_0xaed7('0x7'),'transport':[_0xaed7('0x8'),'ws',_0xaed7('0x9')],'disallow':[_0xaed7('0xa')],'allow':[_0xaed7('0xb')],'defaultuser':util['format'](_0xaed7('0x5'),_0xaed7('0x4'),i),'encryption':_0xaed7('0xc'),'avpf':_0xaed7('0xc'),'force_avp':'yes','icesupport':_0xaed7('0xc'),'dtlsenable':_0xaed7('0xc'),'dtlsverify':'no','dtlscertfile':_0xaed7('0xd'),'dtlsprivatekey':_0xaed7('0xe'),'dtlssetup':_0xaed7('0xf'),'callerid':util[_0xaed7('0x3')]('\x22%s\x22\x20<%s>',util['format']('%s%s',_0xaed7('0x4'),i),0xfa0+i)});}db[_0xaed7('0x10')][_0xaed7('0x11')](users)[_0xaed7('0x12')](function(){console[_0xaed7('0x13')](_0xaed7('0x14'));})[_0xaed7('0x15')](function(_0x4513b9){console[_0xaed7('0x13')](_0x4513b9);}); \ No newline at end of file +var _0x6e7e=['\x22%s\x22\x20<%s>','User','bulkCreate','log','add\x20user','catch','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/private/motion.key','actpass'];(function(_0x5ad8d2,_0x3fcef3){var _0x27a8e1=function(_0x5631fb){while(--_0x5631fb){_0x5ad8d2['push'](_0x5ad8d2['shift']());}};_0x27a8e1(++_0x3fcef3);}(_0x6e7e,0x146));var _0xe6e7=function(_0x129102,_0x3ac9c9){_0x129102=_0x129102-0x0;var _0x346551=_0x6e7e[_0x129102];return _0x346551;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xe6e7('0x0')]({'name':util[_0xe6e7('0x1')](_0xe6e7('0x2'),_0xe6e7('0x3'),i),'fullname':util[_0xe6e7('0x1')](_0xe6e7('0x2'),_0xe6e7('0x3'),i),'email':util['format'](_0xe6e7('0x4'),_0xe6e7('0x3'),i),'role':_0xe6e7('0x3'),'password':_0xe6e7('0x5'),'internal':0xfa0+i,'type':_0xe6e7('0x6'),'transport':[_0xe6e7('0x7'),'ws',_0xe6e7('0x8')],'disallow':[_0xe6e7('0x9')],'allow':[_0xe6e7('0xa')],'defaultuser':util[_0xe6e7('0x1')](_0xe6e7('0x2'),'agent',i),'encryption':_0xe6e7('0xb'),'avpf':_0xe6e7('0xb'),'force_avp':_0xe6e7('0xb'),'icesupport':_0xe6e7('0xb'),'dtlsenable':_0xe6e7('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xe6e7('0xc'),'dtlssetup':_0xe6e7('0xd'),'callerid':util[_0xe6e7('0x1')](_0xe6e7('0xe'),util[_0xe6e7('0x1')](_0xe6e7('0x2'),'agent',i),0xfa0+i)});}db[_0xe6e7('0xf')][_0xe6e7('0x10')](users)['then'](function(){console[_0xe6e7('0x11')](_0xe6e7('0x12'));})[_0xe6e7('0x13')](function(_0x2c65b0){console[_0xe6e7('0x11')](_0x2c65b0);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 0a24e3b..5410cfa 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3759=['user_has_openchannel_interactions:remove','removeWhatsappInteractions','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','log','nsp','DISCONNECTED','lodash','util','bluebird','../mysqldb','./environment','User','name','agent','type','ivr','then','autoAssociation','ChatQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','resourceId','map','where','telephone','format','%s:queue:%s','Agents','length','user:%s','handshake','query','find','ChatInteraction','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','include','push','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','user','VoiceQueues','userProfileId','VoiceQueue','MailQueue','OpenchannelQueues','Trunks','IvrCampaigns','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','chat','fax','mail','openchannel','role','telephone:%s','trunk:%s','leave','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions'];(function(_0x134cab,_0xdcaa87){var _0xe5a8ab=function(_0x1d1ef5){while(--_0x1d1ef5){_0x134cab['push'](_0x134cab['shift']());}};_0xe5a8ab(++_0xdcaa87);}(_0x3759,0x131));var _0x9375=function(_0x1a3e75,_0x4e1afa){_0x1a3e75=_0x1a3e75-0x0;var _0x1b0227=_0x3759[_0x1a3e75];return _0x1b0227;};'use strict';var _=require(_0x9375('0x0'));var util=require(_0x9375('0x1'));var BPromise=require(_0x9375('0x2'));var db=require(_0x9375('0x3'))['db'];var config=require(_0x9375('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db[_0x9375('0x5')],'attributes':['id',_0x9375('0x6'),'role'],'raw':!![],'where':{'role':_0x9375('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x9375('0x6')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x9375('0x6')]};var queryAgents={'raw':!![],'attributes':['id',_0x9375('0x6')],'where':{'role':_0x9375('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x9375('0x6'),_0x9375('0x8')],'where':{'type':_0x9375('0x9')}};function getAssociatedResources(_0x3d8bc8,_0x44fa56,_0x5798fe){return db['UserProfileSection']['findOne']({'where':{'name':_0x3d8bc8,'userProfileId':_0x44fa56},'raw':!![]})[_0x9375('0xa')](function(_0x14c75c){if(_0x14c75c){if(_0x14c75c[_0x9375('0xb')]){switch(_0x3d8bc8){case'VoiceQueues':case _0x9375('0xc'):case _0x9375('0xd'):case _0x9375('0xe'):case _0x9375('0xf'):case'OpenchannelQueues':case _0x9375('0x10'):return db[_0x5798fe][_0x9375('0x11')](queryQueues);case _0x9375('0x12'):return db[_0x5798fe][_0x9375('0x11')](queryTelephones);case'Trunks':return db[_0x5798fe]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0x5798fe][_0x9375('0x11')](queryCampaigns);}}else{return db['UserProfileResource']['findAll']({'attributes':[_0x9375('0x13')],'where':{'sectionId':_0x14c75c['id']},'raw':!![]})[_0x9375('0xa')](function(_0x1e58e4){if(_0x1e58e4){var _0x58c8ea={'where':{'id':_[_0x9375('0x14')](_0x1e58e4,'resourceId')},'raw':!![]};switch(_0x5798fe){case _0x9375('0x5'):_0x58c8ea[_0x9375('0x15')]['role']=_0x9375('0x16');break;case'Campaign':_0x58c8ea['where'][_0x9375('0x8')]=_0x9375('0x9');break;}return db[_0x5798fe][_0x9375('0x11')](_0x58c8ea);}else{return[];}});}}else{return[];}})[_0x9375('0xa')](function(_0x5eb935){return _0x5eb935;});}function joinOrLeaveQueues(_0x18d80c,_0x3012e1,_0x4d1882,_0x19146f){_0x18d80c[_0x3012e1](util[_0x9375('0x17')](_0x9375('0x18'),_0x4d1882,_0x19146f[_0x9375('0x6')]));if(_0x19146f['Agents']){for(var _0x298a8b=0x0;_0x298a8b<_0x19146f[_0x9375('0x19')][_0x9375('0x1a')];_0x298a8b+=0x1){_0x18d80c[_0x3012e1](util[_0x9375('0x17')](_0x9375('0x1b'),_0x19146f[_0x9375('0x19')][_0x298a8b][_0x9375('0x6')]));}}}function joinOrLeave(_0x548b78,_0x4ccc28,_0x273091){var _0x1c36b0;if(_0x548b78[_0x9375('0x1c')][_0x9375('0x1d')]['id']){db[_0x9375('0x5')][_0x9375('0x1e')]({'attributes':['id',_0x9375('0x6'),'role','userProfileId'],'where':{'id':_0x548b78[_0x9375('0x1c')][_0x9375('0x1d')]['id']},'include':[{'model':db[_0x9375('0x1f')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x9375('0x20'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x9375('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x9375('0x22')],'as':_0x9375('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x9375('0x24')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x9375('0x25')],'as':_0x9375('0x26'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x39f75c){if(_0x39f75c){_0x1c36b0=_0x39f75c;_0x548b78[_0x4ccc28](util[_0x9375('0x17')](_0x9375('0x1b'),_0x39f75c[_0x9375('0x6')]));var _0x5d990b=[];switch(_0x39f75c['role']){case _0x9375('0x27'):_0x548b78[_0x4ccc28](_0x9375('0x28'));_0x548b78[_0x4ccc28](_0x9375('0x29'));if(queryQueues['hasOwnProperty'](_0x9375('0x2a'))){delete queryQueues[_0x9375('0x2a')];}_0x5d990b['push'](db['VoiceQueue'][_0x9375('0x11')](queryQueues));_0x5d990b[_0x9375('0x2b')](db[_0x9375('0x2c')][_0x9375('0x11')](queryQueues));_0x5d990b['push'](db[_0x9375('0x2d')][_0x9375('0x11')](queryQueues));_0x5d990b['push'](db[_0x9375('0x2e')]['findAll'](queryQueues));_0x5d990b['push'](db['MailQueue']['findAll'](queryQueues));_0x5d990b[_0x9375('0x2b')](db[_0x9375('0x2f')][_0x9375('0x11')](queryQueues));_0x5d990b['push'](db[_0x9375('0x30')][_0x9375('0x11')](queryQueues));_0x5d990b[_0x9375('0x2b')](db[_0x9375('0x5')][_0x9375('0x11')](queryTelephones));_0x5d990b['push'](db[_0x9375('0x31')][_0x9375('0x11')](queryTrunks));_0x5d990b[_0x9375('0x2b')](db[_0x9375('0x32')]['findAll'](queryCampaigns));_0x5d990b[_0x9375('0x2b')](db[_0x9375('0x5')]['findAll'](queryAgents));break;case _0x9375('0x33'):_0x548b78[_0x4ccc28](_0x9375('0x28'));_0x548b78[_0x4ccc28](_0x9375('0x29'));_0x5d990b['push'](getAssociatedResources(_0x9375('0x34'),_0x39f75c[_0x9375('0x35')],_0x9375('0x36')));_0x5d990b['push'](getAssociatedResources('ChatQueues',_0x39f75c[_0x9375('0x35')],_0x9375('0x2c')));_0x5d990b[_0x9375('0x2b')](getAssociatedResources(_0x9375('0xd'),_0x39f75c[_0x9375('0x35')],_0x9375('0x2d')));_0x5d990b['push'](getAssociatedResources(_0x9375('0xe'),_0x39f75c['userProfileId'],_0x9375('0x2e')));_0x5d990b['push'](getAssociatedResources('MailQueues',_0x39f75c[_0x9375('0x35')],_0x9375('0x37')));_0x5d990b[_0x9375('0x2b')](getAssociatedResources(_0x9375('0x38'),_0x39f75c[_0x9375('0x35')],_0x9375('0x2f')));_0x5d990b[_0x9375('0x2b')](getAssociatedResources('WhatsappQueues',_0x39f75c[_0x9375('0x35')],_0x9375('0x30')));_0x5d990b['push'](getAssociatedResources(_0x9375('0x12'),_0x39f75c[_0x9375('0x35')],_0x9375('0x5')));_0x5d990b[_0x9375('0x2b')](getAssociatedResources(_0x9375('0x39'),_0x39f75c[_0x9375('0x35')],_0x9375('0x31')));_0x5d990b[_0x9375('0x2b')](getAssociatedResources(_0x9375('0x3a'),_0x39f75c[_0x9375('0x35')],_0x9375('0x32')));_0x5d990b[_0x9375('0x2b')](db[_0x9375('0x5')][_0x9375('0x11')](queryAgents));break;case _0x9375('0x7'):_0x548b78[_0x4ccc28]('voice:inbound');_0x548b78[_0x4ccc28](_0x9375('0x29'));_0x5d990b[_0x9375('0x2b')](_0x39f75c[_0x9375('0x3b')]({'attributes':['id','name']}));_0x5d990b[_0x9375('0x2b')](_0x39f75c[_0x9375('0x3c')]({'attributes':['id',_0x9375('0x6')]}));_0x5d990b['push'](_0x39f75c['getFaxQueues']({'attributes':['id',_0x9375('0x6')]}));_0x5d990b[_0x9375('0x2b')](_0x39f75c[_0x9375('0x3d')]({'attributes':['id',_0x9375('0x6')]}));_0x5d990b[_0x9375('0x2b')](_0x39f75c[_0x9375('0x3e')]({'attributes':['id',_0x9375('0x6')]}));_0x5d990b[_0x9375('0x2b')](_0x39f75c[_0x9375('0x3f')]({'attributes':['id',_0x9375('0x6')]}));_0x5d990b['push'](_0x39f75c[_0x9375('0x40')]({'attributes':['id','name']}));break;}return BPromise[_0x9375('0x41')](_0x5d990b);}})[_0x9375('0xa')](function(_0x226ad3){if(_0x226ad3&&_0x226ad3['length']){for(var _0x87ee2c=0x0;_0x87ee2c<_0x226ad3['length'];_0x87ee2c+=0x1){for(var _0x1b3d8e=0x0;_0x1b3d8e<_0x226ad3[_0x87ee2c]['length'];_0x1b3d8e+=0x1){switch(_0x87ee2c){case 0x0:joinOrLeaveQueues(_0x548b78,_0x4ccc28,'voice',_0x226ad3[_0x87ee2c][_0x1b3d8e]);break;case 0x1:joinOrLeaveQueues(_0x548b78,_0x4ccc28,_0x9375('0x42'),_0x226ad3[_0x87ee2c][_0x1b3d8e]);break;case 0x2:joinOrLeaveQueues(_0x548b78,_0x4ccc28,_0x9375('0x43'),_0x226ad3[_0x87ee2c][_0x1b3d8e]);break;case 0x3:joinOrLeaveQueues(_0x548b78,_0x4ccc28,'sms',_0x226ad3[_0x87ee2c][_0x1b3d8e]);break;case 0x4:joinOrLeaveQueues(_0x548b78,_0x4ccc28,_0x9375('0x44'),_0x226ad3[_0x87ee2c][_0x1b3d8e]);break;case 0x5:joinOrLeaveQueues(_0x548b78,_0x4ccc28,_0x9375('0x45'),_0x226ad3[_0x87ee2c][_0x1b3d8e]);break;case 0x6:joinOrLeaveQueues(_0x548b78,_0x4ccc28,'whatsapp',_0x226ad3[_0x87ee2c][_0x1b3d8e]);break;case 0x7:if(_0x1c36b0[_0x9375('0x46')]!==_0x9375('0x7'))_0x548b78[_0x4ccc28](util['format'](_0x9375('0x47'),_0x226ad3[_0x87ee2c][_0x1b3d8e][_0x9375('0x6')]));break;case 0x8:if(_0x1c36b0[_0x9375('0x46')]!=='agent')_0x548b78[_0x4ccc28](util['format'](_0x9375('0x48'),_0x226ad3[_0x87ee2c][_0x1b3d8e][_0x9375('0x6')]));break;case 0x9:if(_0x1c36b0['role']!==_0x9375('0x7'))_0x548b78[_0x4ccc28](util[_0x9375('0x17')]('campaign:%s:%s',_0x226ad3[_0x87ee2c][_0x1b3d8e]['type'],_0x226ad3[_0x87ee2c][_0x1b3d8e][_0x9375('0x6')]));break;case 0xa:_0x548b78[_0x4ccc28](util[_0x9375('0x17')]('user:%s',_0x226ad3[_0x87ee2c][_0x1b3d8e][_0x9375('0x6')]));break;}}}}})[_0x9375('0xa')](function(){if(_0x4ccc28===_0x9375('0x49')){var _0x25abb6=_[_0x9375('0x14')](_0x1c36b0[_0x9375('0x4a')],'id');return _0x1c36b0[_0x9375('0x4b')](_0x25abb6)[_0x9375('0xa')](function(){for(var _0x40aaba=0x0;_0x40aaba<_0x25abb6['length'];_0x40aaba+=0x1){_0x273091[_0x9375('0x4c')](_0x9375('0x4d'),{'ChatInteractionId':Number(_0x25abb6[_0x40aaba]),'UserId':Number(_0x1c36b0['id'])});}});}})[_0x9375('0xa')](function(){if(_0x4ccc28==='leave'){var _0x301fc9=_['map'](_0x1c36b0[_0x9375('0x20')],'id');return _0x1c36b0[_0x9375('0x4e')](_0x301fc9)[_0x9375('0xa')](function(){for(var _0x1f9c3b=0x0;_0x1f9c3b<_0x301fc9[_0x9375('0x1a')];_0x1f9c3b+=0x1){_0x273091[_0x9375('0x4c')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x301fc9[_0x1f9c3b]),'UserId':Number(_0x1c36b0['id'])});}});}})[_0x9375('0xa')](function(){if(_0x4ccc28===_0x9375('0x49')){var _0x43dd0b=_[_0x9375('0x14')](_0x1c36b0[_0x9375('0x21')],'id');return _0x1c36b0['removeFaxInteractions'](_0x43dd0b)[_0x9375('0xa')](function(){for(var _0xf123e5=0x0;_0xf123e5<_0x43dd0b[_0x9375('0x1a')];_0xf123e5+=0x1){_0x273091['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x43dd0b[_0xf123e5]),'UserId':Number(_0x1c36b0['id'])});}});}})[_0x9375('0xa')](function(){if(_0x4ccc28===_0x9375('0x49')){var _0x5bcf82=_['map'](_0x1c36b0['SmsInteractions'],'id');return _0x1c36b0[_0x9375('0x4f')](_0x5bcf82)[_0x9375('0xa')](function(){for(var _0x9440ec=0x0;_0x9440ec<_0x5bcf82['length'];_0x9440ec+=0x1){_0x273091[_0x9375('0x4c')](_0x9375('0x50'),{'SmsInteractionId':Number(_0x5bcf82[_0x9440ec]),'UserId':Number(_0x1c36b0['id'])});}});}})['then'](function(){if(_0x4ccc28===_0x9375('0x49')){var _0x1dab1c=_[_0x9375('0x14')](_0x1c36b0[_0x9375('0x51')],'id');return _0x1c36b0[_0x9375('0x52')](_0x1dab1c)['then'](function(){for(var _0x1df024=0x0;_0x1df024<_0x1dab1c[_0x9375('0x1a')];_0x1df024+=0x1){_0x273091[_0x9375('0x4c')](_0x9375('0x53'),{'OpenchannelInteractionId':Number(_0x1dab1c[_0x1df024]),'UserId':Number(_0x1c36b0['id'])});}});}})[_0x9375('0xa')](function(){if(_0x4ccc28===_0x9375('0x49')){var _0x58e412=_['map'](_0x1c36b0[_0x9375('0x26')],'id');return _0x1c36b0[_0x9375('0x54')](_0x58e412)['then'](function(){for(var _0x3680b8=0x0;_0x3680b8<_0x58e412[_0x9375('0x1a')];_0x3680b8+=0x1){_0x273091[_0x9375('0x4c')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x58e412[_0x3680b8]),'UserId':Number(_0x1c36b0['id'])});}});}})['catch'](function(_0x5f169d){_0x548b78['log'](_0x5f169d);});}}function onDisconnect(_0x192979,_0x36b41b){joinOrLeave(_0x192979,_0x9375('0x49'),_0x36b41b);}function onConnect(_0x91d140){joinOrLeave(_0x91d140,_0x9375('0x55'));}exports[_0x9375('0x56')]=function(_0x5a935b){_0x5a935b['on'](_0x9375('0x57'),function(_0x1e52e6){_0x1e52e6[_0x9375('0x58')](0x0);_0x1e52e6[_0x9375('0x59')]=_0x1e52e6[_0x9375('0x5a')][_0x9375('0x57')][_0x9375('0x5b')]+':'+_0x1e52e6[_0x9375('0x5a')][_0x9375('0x57')][_0x9375('0x5c')];_0x1e52e6[_0x9375('0x5d')]=new Date();_0x1e52e6['log']=function(_0x4e0284){console[_0x9375('0x5e')]('SocketIO\x20'+_0x1e52e6[_0x9375('0x5f')]['name']+'['+_0x1e52e6[_0x9375('0x59')]+']',_0x4e0284);};_0x1e52e6['on']('disconnect',function(){onDisconnect(_0x1e52e6,_0x5a935b);_0x1e52e6[_0x9375('0x5e')](_0x9375('0x60'));});onConnect(_0x1e52e6);_0x1e52e6[_0x9375('0x5e')]('CONNECTED');});}; \ No newline at end of file +var _0xcf37=['user_has_sms_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','setMaxListeners','address','connection','remoteAddress','request','remotePort','nsp','disconnect','DISCONNECTED','CONNECTED','util','bluebird','../mysqldb','./environment','name','User','role','agent','type','ivr','UserProfileSection','findOne','then','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','Telephones','Trunks','findAll','UserProfileResource','resourceId','map','where','telephone','%s:queue:%s','Agents','format','user:%s','query','find','userProfileId','handshake','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','VoiceQueue','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','chat','fax','sms','mail','openchannel','telephone:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions'];(function(_0x3573b9,_0x319527){var _0x13421e=function(_0x1af3a0){while(--_0x1af3a0){_0x3573b9['push'](_0x3573b9['shift']());}};_0x13421e(++_0x319527);}(_0xcf37,0xdc));var _0x7cf3=function(_0xc24ae3,_0x12a04b){_0xc24ae3=_0xc24ae3-0x0;var _0x33f600=_0xcf37[_0xc24ae3];return _0x33f600;};'use strict';var _=require('lodash');var util=require(_0x7cf3('0x0'));var BPromise=require(_0x7cf3('0x1'));var db=require(_0x7cf3('0x2'))['db'];var config=require(_0x7cf3('0x3'));var queryQueues={'attributes':['id',_0x7cf3('0x4')],'include':[{'as':'Agents','model':db[_0x7cf3('0x5')],'attributes':['id',_0x7cf3('0x4'),_0x7cf3('0x6')],'raw':!![],'where':{'role':_0x7cf3('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x7cf3('0x4')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x7cf3('0x4'),_0x7cf3('0x8')],'where':{'type':_0x7cf3('0x9')}};function getAssociatedResources(_0x589786,_0x1b1c39,_0x377577){return db[_0x7cf3('0xa')][_0x7cf3('0xb')]({'where':{'name':_0x589786,'userProfileId':_0x1b1c39},'raw':!![]})[_0x7cf3('0xc')](function(_0x23fe46){if(_0x23fe46){if(_0x23fe46['autoAssociation']){switch(_0x589786){case _0x7cf3('0xd'):case _0x7cf3('0xe'):case _0x7cf3('0xf'):case _0x7cf3('0x10'):case _0x7cf3('0x11'):case'OpenchannelQueues':case _0x7cf3('0x12'):return db[_0x377577]['findAll'](queryQueues);case _0x7cf3('0x13'):return db[_0x377577]['findAll'](queryTelephones);case _0x7cf3('0x14'):return db[_0x377577][_0x7cf3('0x15')](queryTrunks);case'IvrCampaigns':return db[_0x377577][_0x7cf3('0x15')](queryCampaigns);}}else{return db[_0x7cf3('0x16')][_0x7cf3('0x15')]({'attributes':[_0x7cf3('0x17')],'where':{'sectionId':_0x23fe46['id']},'raw':!![]})['then'](function(_0x34d074){if(_0x34d074){var _0x5d38cd={'where':{'id':_[_0x7cf3('0x18')](_0x34d074,_0x7cf3('0x17'))},'raw':!![]};switch(_0x377577){case _0x7cf3('0x5'):_0x5d38cd[_0x7cf3('0x19')][_0x7cf3('0x6')]=_0x7cf3('0x1a');break;case'Campaign':_0x5d38cd['where'][_0x7cf3('0x8')]=_0x7cf3('0x9');break;}return db[_0x377577][_0x7cf3('0x15')](_0x5d38cd);}else{return[];}});}}else{return[];}})['then'](function(_0x9b14f8){return _0x9b14f8;});}function joinOrLeaveQueues(_0x29e951,_0x36462e,_0x27ef8d,_0x369e30){_0x29e951[_0x36462e](util['format'](_0x7cf3('0x1b'),_0x27ef8d,_0x369e30[_0x7cf3('0x4')]));if(_0x369e30[_0x7cf3('0x1c')]){for(var _0x230a80=0x0;_0x230a80<_0x369e30[_0x7cf3('0x1c')]['length'];_0x230a80+=0x1){_0x29e951[_0x36462e](util[_0x7cf3('0x1d')](_0x7cf3('0x1e'),_0x369e30['Agents'][_0x230a80]['name']));}}}function joinOrLeave(_0x568722,_0x24dc98,_0x5b1f72){var _0x35f8b9;if(_0x568722['handshake'][_0x7cf3('0x1f')]['id']){db['User'][_0x7cf3('0x20')]({'attributes':['id','name',_0x7cf3('0x6'),_0x7cf3('0x21')],'where':{'id':_0x568722[_0x7cf3('0x22')][_0x7cf3('0x1f')]['id']},'include':[{'model':db[_0x7cf3('0x23')],'as':_0x7cf3('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x7cf3('0x25')],'as':_0x7cf3('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x7cf3('0x27')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x7cf3('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x7cf3('0x29')],'as':_0x7cf3('0x2a'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x7cf3('0x2b'),'attributes':['id'],'raw':!![]}]})[_0x7cf3('0xc')](function(_0x565ef7){if(_0x565ef7){_0x35f8b9=_0x565ef7;_0x568722[_0x24dc98](util[_0x7cf3('0x1d')](_0x7cf3('0x1e'),_0x565ef7[_0x7cf3('0x4')]));var _0x2fd8f5=[];switch(_0x565ef7[_0x7cf3('0x6')]){case _0x7cf3('0x2c'):_0x568722[_0x24dc98](_0x7cf3('0x2d'));_0x568722[_0x24dc98](_0x7cf3('0x2e'));if(queryQueues[_0x7cf3('0x2f')](_0x7cf3('0x30'))){delete queryQueues['include'];}_0x2fd8f5[_0x7cf3('0x31')](db['VoiceQueue'][_0x7cf3('0x15')](queryQueues));_0x2fd8f5[_0x7cf3('0x31')](db[_0x7cf3('0x32')]['findAll'](queryQueues));_0x2fd8f5[_0x7cf3('0x31')](db[_0x7cf3('0x33')]['findAll'](queryQueues));_0x2fd8f5[_0x7cf3('0x31')](db[_0x7cf3('0x34')][_0x7cf3('0x15')](queryQueues));_0x2fd8f5[_0x7cf3('0x31')](db[_0x7cf3('0x35')][_0x7cf3('0x15')](queryQueues));_0x2fd8f5['push'](db[_0x7cf3('0x36')][_0x7cf3('0x15')](queryQueues));_0x2fd8f5[_0x7cf3('0x31')](db[_0x7cf3('0x37')]['findAll'](queryQueues));_0x2fd8f5[_0x7cf3('0x31')](db[_0x7cf3('0x5')][_0x7cf3('0x15')](queryTelephones));_0x2fd8f5[_0x7cf3('0x31')](db[_0x7cf3('0x38')][_0x7cf3('0x15')](queryTrunks));_0x2fd8f5[_0x7cf3('0x31')](db[_0x7cf3('0x39')][_0x7cf3('0x15')](queryCampaigns));_0x2fd8f5[_0x7cf3('0x31')](db['User']['findAll'](queryAgents));break;case'user':_0x568722[_0x24dc98](_0x7cf3('0x2d'));_0x568722[_0x24dc98](_0x7cf3('0x2e'));_0x2fd8f5[_0x7cf3('0x31')](getAssociatedResources(_0x7cf3('0xd'),_0x565ef7[_0x7cf3('0x21')],_0x7cf3('0x3a')));_0x2fd8f5[_0x7cf3('0x31')](getAssociatedResources(_0x7cf3('0xe'),_0x565ef7[_0x7cf3('0x21')],'ChatQueue'));_0x2fd8f5['push'](getAssociatedResources(_0x7cf3('0xf'),_0x565ef7['userProfileId'],'FaxQueue'));_0x2fd8f5[_0x7cf3('0x31')](getAssociatedResources('SmsQueues',_0x565ef7[_0x7cf3('0x21')],_0x7cf3('0x34')));_0x2fd8f5['push'](getAssociatedResources(_0x7cf3('0x11'),_0x565ef7[_0x7cf3('0x21')],_0x7cf3('0x35')));_0x2fd8f5[_0x7cf3('0x31')](getAssociatedResources('OpenchannelQueues',_0x565ef7[_0x7cf3('0x21')],_0x7cf3('0x36')));_0x2fd8f5[_0x7cf3('0x31')](getAssociatedResources(_0x7cf3('0x12'),_0x565ef7[_0x7cf3('0x21')],'WhatsappQueue'));_0x2fd8f5[_0x7cf3('0x31')](getAssociatedResources(_0x7cf3('0x13'),_0x565ef7['userProfileId'],_0x7cf3('0x5')));_0x2fd8f5[_0x7cf3('0x31')](getAssociatedResources(_0x7cf3('0x14'),_0x565ef7[_0x7cf3('0x21')],_0x7cf3('0x38')));_0x2fd8f5[_0x7cf3('0x31')](getAssociatedResources(_0x7cf3('0x3b'),_0x565ef7['userProfileId'],_0x7cf3('0x39')));_0x2fd8f5[_0x7cf3('0x31')](db['User'][_0x7cf3('0x15')](queryAgents));break;case _0x7cf3('0x7'):_0x568722[_0x24dc98](_0x7cf3('0x2d'));_0x568722[_0x24dc98](_0x7cf3('0x2e'));_0x2fd8f5[_0x7cf3('0x31')](_0x565ef7[_0x7cf3('0x3c')]({'attributes':['id',_0x7cf3('0x4')]}));_0x2fd8f5[_0x7cf3('0x31')](_0x565ef7[_0x7cf3('0x3d')]({'attributes':['id',_0x7cf3('0x4')]}));_0x2fd8f5['push'](_0x565ef7[_0x7cf3('0x3e')]({'attributes':['id','name']}));_0x2fd8f5['push'](_0x565ef7[_0x7cf3('0x3f')]({'attributes':['id',_0x7cf3('0x4')]}));_0x2fd8f5[_0x7cf3('0x31')](_0x565ef7[_0x7cf3('0x40')]({'attributes':['id','name']}));_0x2fd8f5['push'](_0x565ef7[_0x7cf3('0x41')]({'attributes':['id',_0x7cf3('0x4')]}));_0x2fd8f5[_0x7cf3('0x31')](_0x565ef7[_0x7cf3('0x42')]({'attributes':['id','name']}));break;}return BPromise[_0x7cf3('0x43')](_0x2fd8f5);}})[_0x7cf3('0xc')](function(_0x2b3346){if(_0x2b3346&&_0x2b3346[_0x7cf3('0x44')]){for(var _0x530cd4=0x0;_0x530cd4<_0x2b3346[_0x7cf3('0x44')];_0x530cd4+=0x1){for(var _0x1cb52c=0x0;_0x1cb52c<_0x2b3346[_0x530cd4][_0x7cf3('0x44')];_0x1cb52c+=0x1){switch(_0x530cd4){case 0x0:joinOrLeaveQueues(_0x568722,_0x24dc98,_0x7cf3('0x45'),_0x2b3346[_0x530cd4][_0x1cb52c]);break;case 0x1:joinOrLeaveQueues(_0x568722,_0x24dc98,_0x7cf3('0x46'),_0x2b3346[_0x530cd4][_0x1cb52c]);break;case 0x2:joinOrLeaveQueues(_0x568722,_0x24dc98,_0x7cf3('0x47'),_0x2b3346[_0x530cd4][_0x1cb52c]);break;case 0x3:joinOrLeaveQueues(_0x568722,_0x24dc98,_0x7cf3('0x48'),_0x2b3346[_0x530cd4][_0x1cb52c]);break;case 0x4:joinOrLeaveQueues(_0x568722,_0x24dc98,_0x7cf3('0x49'),_0x2b3346[_0x530cd4][_0x1cb52c]);break;case 0x5:joinOrLeaveQueues(_0x568722,_0x24dc98,_0x7cf3('0x4a'),_0x2b3346[_0x530cd4][_0x1cb52c]);break;case 0x6:joinOrLeaveQueues(_0x568722,_0x24dc98,'whatsapp',_0x2b3346[_0x530cd4][_0x1cb52c]);break;case 0x7:if(_0x35f8b9['role']!==_0x7cf3('0x7'))_0x568722[_0x24dc98](util[_0x7cf3('0x1d')](_0x7cf3('0x4b'),_0x2b3346[_0x530cd4][_0x1cb52c]['name']));break;case 0x8:if(_0x35f8b9['role']!==_0x7cf3('0x7'))_0x568722[_0x24dc98](util[_0x7cf3('0x1d')]('trunk:%s',_0x2b3346[_0x530cd4][_0x1cb52c][_0x7cf3('0x4')]));break;case 0x9:if(_0x35f8b9[_0x7cf3('0x6')]!==_0x7cf3('0x7'))_0x568722[_0x24dc98](util[_0x7cf3('0x1d')](_0x7cf3('0x4c'),_0x2b3346[_0x530cd4][_0x1cb52c]['type'],_0x2b3346[_0x530cd4][_0x1cb52c][_0x7cf3('0x4')]));break;case 0xa:_0x568722[_0x24dc98](util[_0x7cf3('0x1d')](_0x7cf3('0x1e'),_0x2b3346[_0x530cd4][_0x1cb52c][_0x7cf3('0x4')]));break;}}}}})[_0x7cf3('0xc')](function(){if(_0x24dc98===_0x7cf3('0x4d')){var _0x452b07=_[_0x7cf3('0x18')](_0x35f8b9[_0x7cf3('0x24')],'id');return _0x35f8b9[_0x7cf3('0x4e')](_0x452b07)[_0x7cf3('0xc')](function(){for(var _0x5848c1=0x0;_0x5848c1<_0x452b07[_0x7cf3('0x44')];_0x5848c1+=0x1){_0x5b1f72[_0x7cf3('0x4f')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x452b07[_0x5848c1]),'UserId':Number(_0x35f8b9['id'])});}});}})[_0x7cf3('0xc')](function(){if(_0x24dc98==='leave'){var _0x360bf1=_[_0x7cf3('0x18')](_0x35f8b9[_0x7cf3('0x26')],'id');return _0x35f8b9['removeMailInteractions'](_0x360bf1)[_0x7cf3('0xc')](function(){for(var _0x14ee8b=0x0;_0x14ee8b<_0x360bf1[_0x7cf3('0x44')];_0x14ee8b+=0x1){_0x5b1f72[_0x7cf3('0x4f')](_0x7cf3('0x50'),{'MailInteractionId':Number(_0x360bf1[_0x14ee8b]),'UserId':Number(_0x35f8b9['id'])});}});}})[_0x7cf3('0xc')](function(){if(_0x24dc98===_0x7cf3('0x4d')){var _0x57918b=_[_0x7cf3('0x18')](_0x35f8b9['FaxInteractions'],'id');return _0x35f8b9[_0x7cf3('0x51')](_0x57918b)[_0x7cf3('0xc')](function(){for(var _0x22ce86=0x0;_0x22ce86<_0x57918b['length'];_0x22ce86+=0x1){_0x5b1f72[_0x7cf3('0x4f')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x57918b[_0x22ce86]),'UserId':Number(_0x35f8b9['id'])});}});}})[_0x7cf3('0xc')](function(){if(_0x24dc98===_0x7cf3('0x4d')){var _0x449099=_[_0x7cf3('0x18')](_0x35f8b9[_0x7cf3('0x28')],'id');return _0x35f8b9[_0x7cf3('0x52')](_0x449099)[_0x7cf3('0xc')](function(){for(var _0x40be43=0x0;_0x40be43<_0x449099[_0x7cf3('0x44')];_0x40be43+=0x1){_0x5b1f72['emit'](_0x7cf3('0x53'),{'SmsInteractionId':Number(_0x449099[_0x40be43]),'UserId':Number(_0x35f8b9['id'])});}});}})[_0x7cf3('0xc')](function(){if(_0x24dc98===_0x7cf3('0x4d')){var _0x17beaf=_['map'](_0x35f8b9['OpenchannelInteractions'],'id');return _0x35f8b9[_0x7cf3('0x54')](_0x17beaf)[_0x7cf3('0xc')](function(){for(var _0x518ef6=0x0;_0x518ef6<_0x17beaf['length'];_0x518ef6+=0x1){_0x5b1f72[_0x7cf3('0x4f')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x17beaf[_0x518ef6]),'UserId':Number(_0x35f8b9['id'])});}});}})[_0x7cf3('0xc')](function(){if(_0x24dc98===_0x7cf3('0x4d')){var _0x288032=_[_0x7cf3('0x18')](_0x35f8b9[_0x7cf3('0x2b')],'id');return _0x35f8b9[_0x7cf3('0x55')](_0x288032)[_0x7cf3('0xc')](function(){for(var _0x3d7162=0x0;_0x3d7162<_0x288032[_0x7cf3('0x44')];_0x3d7162+=0x1){_0x5b1f72['emit'](_0x7cf3('0x56'),{'WhatsappInteractionId':Number(_0x288032[_0x3d7162]),'UserId':Number(_0x35f8b9['id'])});}});}})[_0x7cf3('0x57')](function(_0x1e7c88){_0x568722[_0x7cf3('0x58')](_0x1e7c88);});}}function onDisconnect(_0x31e339,_0x2afe8d){joinOrLeave(_0x31e339,_0x7cf3('0x4d'),_0x2afe8d);}function onConnect(_0x580617){joinOrLeave(_0x580617,_0x7cf3('0x59'));}exports[_0x7cf3('0x5a')]=function(_0x225921){_0x225921['on']('connection',function(_0x4bb726){_0x4bb726[_0x7cf3('0x5b')](0x0);_0x4bb726[_0x7cf3('0x5c')]=_0x4bb726['request'][_0x7cf3('0x5d')][_0x7cf3('0x5e')]+':'+_0x4bb726[_0x7cf3('0x5f')]['connection'][_0x7cf3('0x60')];_0x4bb726['connectedAt']=new Date();_0x4bb726[_0x7cf3('0x58')]=function(_0x2fcdd9){console[_0x7cf3('0x58')]('SocketIO\x20'+_0x4bb726[_0x7cf3('0x61')]['name']+'['+_0x4bb726['address']+']',_0x2fcdd9);};_0x4bb726['on'](_0x7cf3('0x62'),function(){onDisconnect(_0x4bb726,_0x225921);_0x4bb726['log'](_0x7cf3('0x63'));});onConnect(_0x4bb726);_0x4bb726[_0x7cf3('0x58')](_0x7cf3('0x64'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index dd8dd22..a31ce02 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 _0xeef1=['ChatOfflineMessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappMessage','Fax','Mail','MailInteraction','MailMessage','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','info','Trigger,\x20%s','EventManager','error','code','catch','get','motionChannel','event','direction','resolve','then','ContactId','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','QueryTypes','SELECT','contact','UserId','undefined','interface','format','SIP/%s','name','incomingmessage','outgoingmessage','offlineMessage','channel','opened','agent','changed','closed','substatus','AfterUpdate','User','find','fullname','email','internal','default','length','hasOwnProperty','model','hook','condition','util','../../mysqldb','triggers','client','http','Chat','ChatInteraction','newinteraction','afterUpdate','closedinteraction','ChatMessage','afterCreate','newmessage'];(function(_0x54dd73,_0x1d7f85){var _0x152a29=function(_0x1a9c44){while(--_0x1a9c44){_0x54dd73['push'](_0x54dd73['shift']());}};_0x152a29(++_0x1d7f85);}(_0xeef1,0x160));var _0x1eef=function(_0x4eb841,_0x333d7c){_0x4eb841=_0x4eb841-0x0;var _0x526cbe=_0xeef1[_0x4eb841];return _0x526cbe;};'use strict';var util=require(_0x1eef('0x0'));var db=require(_0x1eef('0x1'))['db'];var jayson=require('jayson/promise');var logger=require('../logger')(_0x1eef('0x2'));var client=jayson[_0x1eef('0x3')][_0x1eef('0x4')]({'port':0x232a});var triggers=[{'channel':_0x1eef('0x5'),'model':_0x1eef('0x6'),'event':'afterCreate','condition':_0x1eef('0x7'),'callback':afterCreate},{'channel':_0x1eef('0x5'),'model':_0x1eef('0x6'),'event':_0x1eef('0x8'),'condition':_0x1eef('0x9'),'callback':afterUpdate},{'channel':_0x1eef('0x5'),'model':_0x1eef('0xa'),'event':_0x1eef('0xb'),'condition':_0x1eef('0xc'),'callback':afterCreateMessage},{'channel':_0x1eef('0x5'),'model':_0x1eef('0xd'),'event':_0x1eef('0xb'),'condition':_0x1eef('0xc'),'callback':afterCreateOfflineMessage},{'channel':'Sms','model':'SmsInteraction','event':_0x1eef('0xb'),'condition':_0x1eef('0x7'),'callback':afterCreate},{'channel':_0x1eef('0xe'),'model':_0x1eef('0xf'),'event':_0x1eef('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Sms','model':_0x1eef('0x10'),'event':_0x1eef('0xb'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x1eef('0x11'),'model':'WhatsappInteraction','event':'afterCreate','condition':_0x1eef('0x7'),'callback':afterCreate},{'channel':'Whatsapp','model':'WhatsappInteraction','event':'afterUpdate','condition':_0x1eef('0x9'),'callback':afterUpdate},{'channel':_0x1eef('0x11'),'model':_0x1eef('0x12'),'event':_0x1eef('0xb'),'condition':_0x1eef('0xc'),'callback':afterCreateMessage},{'channel':_0x1eef('0x13'),'model':'FaxInteraction','event':_0x1eef('0xb'),'condition':_0x1eef('0x7'),'callback':afterCreate},{'channel':_0x1eef('0x13'),'model':'FaxInteraction','event':_0x1eef('0x8'),'condition':_0x1eef('0x9'),'callback':afterUpdate},{'channel':_0x1eef('0x13'),'model':'FaxMessage','event':'afterCreate','condition':_0x1eef('0xc'),'callback':afterCreateMessage},{'channel':_0x1eef('0x14'),'model':_0x1eef('0x15'),'event':_0x1eef('0xb'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x1eef('0x14'),'model':_0x1eef('0x15'),'event':'afterUpdate','condition':_0x1eef('0x9'),'callback':afterUpdate},{'channel':_0x1eef('0x14'),'model':_0x1eef('0x16'),'event':_0x1eef('0xb'),'condition':_0x1eef('0xc'),'callback':afterCreateMessage},{'channel':'Openchannel','model':'OpenchannelInteraction','event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':'Openchannel','model':_0x1eef('0x17'),'event':_0x1eef('0x8'),'condition':_0x1eef('0x9'),'callback':afterUpdate},{'channel':_0x1eef('0x18'),'model':_0x1eef('0x19'),'event':_0x1eef('0xb'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x18c45a){return client[_0x1eef('0x1a')]('EventManager',_0x18c45a)['then'](function(_0x30123e){logger[_0x1eef('0x1b')](_0x1eef('0x1c'),_0x1eef('0x1d'),_0x30123e);if(_0x30123e[_0x1eef('0x1e')]){if(_0x30123e[_0x1eef('0x1e')][_0x1eef('0x1f')]===0x1f4){logger['error'](_0x1eef('0x1c'),_0x1eef('0x1d'),_0x30123e[_0x1eef('0x1e')]);}}})[_0x1eef('0x20')](function(_0x158891){logger['error'](_0x1eef('0x1c'),'EventManager',_0x158891);});}function afterCreateMessage(_0x4d311e){return function(_0xaf735){_0xaf735=_0xaf735[_0x1eef('0x21')]({'plain':!![]});_0xaf735['channel']=_0x4d311e;_0xaf735[_0x1eef('0x22')]=_0x4d311e;_0xaf735[_0x1eef('0x23')]=_0xaf735[_0x1eef('0x24')];Promise[_0x1eef('0x25')]()[_0x1eef('0x26')](function(){if(typeof _0xaf735[_0x1eef('0x27')]==='undefined')return null;var _0x322e29=_0x1eef('0x28')+_0xaf735[_0x1eef('0x27')];return db[_0x1eef('0x29')][_0x1eef('0x2a')](_0x322e29,{'type':db['Sequelize'][_0x1eef('0x2b')][_0x1eef('0x2c')],'raw':!![]});})['then'](function(_0x156f64){if(_0x156f64){_0xaf735[_0x1eef('0x2d')]=_0x156f64[0x0];}if(typeof _0xaf735[_0x1eef('0x2e')]===_0x1eef('0x2f'))return;return getAgent(_0xaf735[_0x1eef('0x2e')]);})[_0x1eef('0x26')](function(_0x225f9c){if(_0x225f9c){_0xaf735[_0x1eef('0x30')]=util[_0x1eef('0x31')](_0x1eef('0x32'),_0x225f9c[_0x1eef('0x33')]);_0xaf735['agent']=_0x225f9c;_0xaf735['channel']=_0x4d311e;return request({'event':_0x1eef('0x34'),'message':_0xaf735});}else{return request({'event':_0x1eef('0x35'),'message':_0xaf735});}})[_0x1eef('0x20')](function(_0x5c55b3){logger[_0x1eef('0x1e')]('Trigger,\x20%s','AfterCreateMessage',_0x5c55b3);});};}function afterCreateOfflineMessage(_0x491871){return function(_0x2d14da){_0x2d14da=_0x2d14da['get']({'plain':!![]});_0x2d14da['channel']=_0x491871;_0x2d14da[_0x1eef('0x22')]=_0x491871;_0x2d14da[_0x1eef('0x23')]=_0x1eef('0x36');return request({'event':_0x2d14da['event'],'message':_0x2d14da});};}function afterCreate(_0x5b9910,_0x4c291c){return function(_0xbce7d4){_0xbce7d4=_0xbce7d4[_0x1eef('0x21')]({'plain':!![]});_0xbce7d4[_0x1eef('0x37')]=_0x5b9910;_0xbce7d4['motionChannel']=_0x5b9910;_0xbce7d4[_0x1eef('0x23')]=_0x1eef('0x38');Promise[_0x1eef('0x25')]()[_0x1eef('0x26')](function(){var _0x4cbf52=_0x1eef('0x28')+_0xbce7d4[_0x1eef('0x27')];return db[_0x1eef('0x29')]['query'](_0x4cbf52,{'type':db['Sequelize'][_0x1eef('0x2b')][_0x1eef('0x2c')],'raw':!![]});})[_0x1eef('0x26')](function(_0x4994bf){if(_0x4994bf){_0xbce7d4[_0x1eef('0x2d')]=_0x4994bf[0x0];}if(typeof _0xbce7d4[_0x1eef('0x2e')]===_0x1eef('0x2f'))return;return getAgent(_0xbce7d4[_0x1eef('0x2e')]);})[_0x1eef('0x26')](function(_0x2cb250){if(_0x2cb250){_0xbce7d4[_0x1eef('0x30')]=util[_0x1eef('0x31')](_0x1eef('0x32'),_0x2cb250['name']);_0xbce7d4[_0x1eef('0x39')]=_0x2cb250;}return request({'event':_0x4c291c,'message':_0xbce7d4});})[_0x1eef('0x20')](function(_0x161713){logger[_0x1eef('0x1e')](_0x1eef('0x1c'),'AfterCreate',_0x161713);});};}function afterUpdate(_0x6d6d96){return function(_0x354d0b){var _0x5d8158=_0x354d0b[_0x1eef('0x3a')](_0x1eef('0x3b'))&&_0x354d0b[_0x1eef('0x3b')];var _0xae03c7=_0x354d0b[_0x1eef('0x3a')](_0x1eef('0x3c'));if(_0x5d8158||_0xae03c7){var _0x2a75fe=_0x5d8158?'closedinteraction':'substatus';var _0x5bfd82=_0x354d0b['get']({'plain':!![]});_0x5bfd82[_0x1eef('0x37')]=_0x6d6d96;_0x5bfd82[_0x1eef('0x22')]=_0x6d6d96;_0x5bfd82[_0x1eef('0x23')]=_0x5d8158?'closed':_0x1eef('0x3c');var _0x152451=_0x1eef('0x28')+_0x5bfd82[_0x1eef('0x27')];return db[_0x1eef('0x29')][_0x1eef('0x2a')](_0x152451,{'type':db['Sequelize'][_0x1eef('0x2b')][_0x1eef('0x2c')],'raw':!![]})[_0x1eef('0x26')](function(_0x56002a){if(_0x56002a){_0x5bfd82[_0x1eef('0x2d')]=_0x56002a[0x0];}if(typeof _0x5bfd82[_0x1eef('0x2e')]===_0x1eef('0x2f'))return;return getAgent(_0x5bfd82['UserId']);})[_0x1eef('0x26')](function(_0x510231){if(_0x510231){_0x5bfd82[_0x1eef('0x30')]=util[_0x1eef('0x31')]('SIP/%s',_0x510231['name']);_0x5bfd82[_0x1eef('0x39')]=_0x510231;}return request({'event':_0x2a75fe,'message':_0x5bfd82});})[_0x1eef('0x20')](function(_0x13a089){logger['error'](_0x1eef('0x1c'),_0x1eef('0x3d'),_0x13a089);});}};}function getAgent(_0x299dba){return db[_0x1eef('0x3e')][_0x1eef('0x3f')]({'where':{'id':_0x299dba},'attributes':['id',_0x1eef('0x33'),_0x1eef('0x40'),_0x1eef('0x41'),_0x1eef('0x42')],'raw':!![]})[_0x1eef('0x26')](function(_0x572eb0){return _0x572eb0;});}exports[_0x1eef('0x43')]=function(){for(var _0x6bfa59=0x0;_0x6bfa59=_0x5b5f1b['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x1af745(_0x43eb62);})[_0x1993('0x14')](function(_0x56a7df){_0x102905(_0x56a7df);});});}; \ No newline at end of file +var _0x8e6b=['includes','clearBlockUser','isUndefined','blockedAt','count','agent','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','./license/util','voice','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8e6b,0x17b));var _0xb8e6=function(_0x46e2c3,_0x3c7011){_0x46e2c3=_0x46e2c3-0x0;var _0x7d1ba0=_0x8e6b[_0x46e2c3];return _0x7d1ba0;};'use strict';var _=require(_0xb8e6('0x0'));var BPromise=require(_0xb8e6('0x1'));var db=require('../mysqldb')['db'];var util=require(_0xb8e6('0x2'));var channels=[_0xb8e6('0x3'),'mail',_0xb8e6('0x4'),_0xb8e6('0x5'),_0xb8e6('0x6'),_0xb8e6('0x7'),_0xb8e6('0x8')];exports[_0xb8e6('0x9')]=function(){return channels;};exports[_0xb8e6('0xa')]=function(_0x35c577){_0x35c577=_0x35c577[_0xb8e6('0xb')]();return _[_0xb8e6('0xc')](channels,_0x35c577);};exports[_0xb8e6('0xd')]=function(_0x19394b,_0x5d1f09,_0x1c6488,_0x57c57f){var _0x3d7734={'loginAttempts':_0x5d1f09,'blocked':_0x1c6488};if(!_[_0xb8e6('0xe')](_0x57c57f)){_0x3d7734[_0xb8e6('0xf')]=_0x57c57f;}return _0x19394b['updateAttributes'](_0x3d7734);};exports['getLicense']=function(_0x24e1b4){return new BPromise(function(_0x3c34cb,_0x2972f8){var _0x336238=0x0;if(_0x24e1b4['role']!=='agent'){_0x3c34cb(_0x24e1b4);}db['User'][_0xb8e6('0x10')]({'where':{'role':_0xb8e6('0x11'),'online':!![],'id':{'$ne':_0x24e1b4['id']}}})[_0xb8e6('0x12')](function(_0x58efea){_0x336238=_0x58efea;return util[_0xb8e6('0x13')]();})[_0xb8e6('0x12')](function(_0x145195){if(_0x145195&&_0x145195[_0xb8e6('0x14')]&&_0x336238>=_0x145195[_0xb8e6('0x14')]){throw Error(_0xb8e6('0x15'));}_0x3c34cb(_0x24e1b4);})[_0xb8e6('0x16')](function(_0x4c2045){_0x2972f8(_0x4c2045);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 3cd5d57..af5c5b7 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7401=['Conflict','Out\x20Of\x20Interval','error','stack','statusMessage','send','exports','util','../config/logger','api','message','Internal\x20Server\x20Error','inherits','Bad\x20Request','name','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','code','Resource\x20Conflict'];(function(_0x33b1f2,_0x39c940){var _0x487207=function(_0x411157){while(--_0x411157){_0x33b1f2['push'](_0x33b1f2['shift']());}};_0x487207(++_0x39c940);}(_0x7401,0xaf));var _0x1740=function(_0x287ee2,_0x339134){_0x287ee2=_0x287ee2-0x0;var _0x40e98b=_0x7401[_0x287ee2];return _0x40e98b;};'use strict';var util=require(_0x1740('0x0'));var logger=require(_0x1740('0x1'))(_0x1740('0x2'));var APIError=function(_0x137319,_0x2212a9){this[_0x1740('0x3')]=_0x137319||_0x1740('0x4');this['name']=_0x2212a9||'Error';util[_0x1740('0x5')](APIError,Error);};var APIBadRequestError=function(_0x1daf38){this[_0x1740('0x3')]=_0x1daf38||_0x1740('0x6');this[_0x1740('0x7')]=_0x1740('0x6');util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0xc4c3b3){this[_0x1740('0x3')]=_0xc4c3b3||_0x1740('0x8');this['name']=_0x1740('0x8');util['inherits'](APIForbiddenError,APIError);};var APINotFoundError=function(_0x214b61){this['message']=_0x214b61||_0x1740('0x9');this[_0x1740('0x7')]=_0x1740('0xa');util[_0x1740('0x5')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x219479){this[_0x1740('0x3')]=_0x219479||_0x1740('0xb');this[_0x1740('0x7')]='Out\x20Of\x20Interval';this[_0x1740('0xc')]=0x193;this['details']={'type':'OutOfInterval'};util[_0x1740('0x5')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x3a4d48){this[_0x1740('0x3')]=_0x3a4d48||_0x1740('0xd');this['name']='Conflict';util[_0x1740('0x5')](APIBadRequestError,APIError);};function getStatusCode(_0xd9741b){switch(_0xd9741b){case _0x1740('0x6'):return 0x190;case'Forbidden','Out\x20Of\x20Interval':return 0x193;case'Not\x20Found':return 0x194;case _0x1740('0xe'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x3130a8){if(_0x3130a8===_0x1740('0xf'))return _0x3130a8;return null;}function handleError(_0x424585){return function(_0x49e1a5){logger[_0x1740('0x10')](_0x49e1a5[_0x1740('0x11')]);var _0x53635b=getStatusCode(_0x49e1a5[_0x1740('0x7')]);var _0x4f1a62=getCustomStatusMessage(_0x49e1a5[_0x1740('0x7')]);if(_0x49e1a5[_0x1740('0x7')]){delete _0x49e1a5['name'];}if(_0x4f1a62){_0x424585[_0x1740('0x12')]=_0x4f1a62;}return _0x424585['status'](_0x53635b)[_0x1740('0x13')](_0x49e1a5);};}module[_0x1740('0x14')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0x90e4=['Bad\x20Request','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','OutOfInterval','Resource\x20Conflict','Conflict','error','stack','status','exports','util','../config/logger','api','message','Internal\x20Server\x20Error','name','inherits'];(function(_0x21cd58,_0x4604d6){var _0x3fba55=function(_0x51922e){while(--_0x51922e){_0x21cd58['push'](_0x21cd58['shift']());}};_0x3fba55(++_0x4604d6);}(_0x90e4,0x89));var _0x490e=function(_0x30c2ae,_0x4c98a2){_0x30c2ae=_0x30c2ae-0x0;var _0x1ee1cc=_0x90e4[_0x30c2ae];return _0x1ee1cc;};'use strict';var util=require(_0x490e('0x0'));var logger=require(_0x490e('0x1'))(_0x490e('0x2'));var APIError=function(_0x120254,_0x1dcb1a){this[_0x490e('0x3')]=_0x120254||_0x490e('0x4');this[_0x490e('0x5')]=_0x1dcb1a||'Error';util[_0x490e('0x6')](APIError,Error);};var APIBadRequestError=function(_0x2d6f27){this[_0x490e('0x3')]=_0x2d6f27||_0x490e('0x7');this[_0x490e('0x5')]=_0x490e('0x7');util[_0x490e('0x6')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x39b421){this[_0x490e('0x3')]=_0x39b421||'Forbidden';this[_0x490e('0x5')]='Forbidden';util[_0x490e('0x6')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x4b45b3){this[_0x490e('0x3')]=_0x4b45b3||'Entity\x20not\x20found';this[_0x490e('0x5')]=_0x490e('0x8');util[_0x490e('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x17696d){this['message']=_0x17696d||_0x490e('0x9');this['name']=_0x490e('0xa');this['code']=0x193;this['details']={'type':_0x490e('0xb')};util[_0x490e('0x6')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x42171d){this[_0x490e('0x3')]=_0x42171d||_0x490e('0xc');this['name']='Conflict';util['inherits'](APIBadRequestError,APIError);};function getStatusCode(_0x5ade06){switch(_0x5ade06){case _0x490e('0x7'):return 0x190;case'Forbidden',_0x490e('0xa'):return 0x193;case _0x490e('0x8'):return 0x194;case _0x490e('0xd'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x525a77){if(_0x525a77===_0x490e('0xa'))return _0x525a77;return null;}function handleError(_0x438fc0){return function(_0xe1ab5f){logger[_0x490e('0xe')](_0xe1ab5f[_0x490e('0xf')]);var _0x21a33b=getStatusCode(_0xe1ab5f[_0x490e('0x5')]);var _0x310ca2=getCustomStatusMessage(_0xe1ab5f[_0x490e('0x5')]);if(_0xe1ab5f[_0x490e('0x5')]){delete _0xe1ab5f['name'];}if(_0x310ca2){_0x438fc0['statusMessage']=_0x310ca2;}return _0x438fc0[_0x490e('0x10')](_0x21a33b)['send'](_0xe1ab5f);};}module[_0x490e('0x11')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index b68ef50..6432062 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x84d1=['json','send','exports','404','status','render'];(function(_0x1d8bfa,_0x3035eb){var _0x3bdd83=function(_0x481c70){while(--_0x481c70){_0x1d8bfa['push'](_0x1d8bfa['shift']());}};_0x3bdd83(++_0x3035eb);}(_0x84d1,0xa4));var _0x184d=function(_0xaa4f3,_0x37be20){_0xaa4f3=_0xaa4f3-0x0;var _0x163cc9=_0x84d1[_0xaa4f3];return _0x163cc9;};'use strict';module[_0x184d('0x0')][0x194]=function pageNotFound(_0x516af6,_0x49097e){var _0x87f27c=_0x184d('0x1');var _0x2e02f8=0x194;var _0x14a280={'status':_0x2e02f8};_0x49097e[_0x184d('0x2')](_0x14a280['status']);_0x49097e[_0x184d('0x3')](_0x87f27c,{},function(_0x3c1e6b,_0x495f05){if(_0x3c1e6b){return _0x49097e['status'](_0x14a280[_0x184d('0x2')])[_0x184d('0x4')](_0x14a280);}_0x49097e[_0x184d('0x5')](_0x495f05);});}; \ No newline at end of file +var _0x462e=['status','render','json','send','exports','404'];(function(_0xf45dbd,_0xa12f0){var _0x1dc148=function(_0x1c70bc){while(--_0x1c70bc){_0xf45dbd['push'](_0xf45dbd['shift']());}};_0x1dc148(++_0xa12f0);}(_0x462e,0x13c));var _0xe462=function(_0x1ba29,_0x1d30be){_0x1ba29=_0x1ba29-0x0;var _0x2b5527=_0x462e[_0x1ba29];return _0x2b5527;};'use strict';module[_0xe462('0x0')][0x194]=function pageNotFound(_0x43e2d5,_0x12b7fd){var _0x18da95=_0xe462('0x1');var _0x589839=0x194;var _0x3d0c4a={'status':_0x589839};_0x12b7fd[_0xe462('0x2')](_0x3d0c4a[_0xe462('0x2')]);_0x12b7fd[_0xe462('0x3')](_0x18da95,{},function(_0x57f563,_0x11f3a6){if(_0x57f563){return _0x12b7fd[_0xe462('0x2')](_0x3d0c4a[_0xe462('0x2')])[_0xe462('0x4')](_0x3d0c4a);}_0x12b7fd[_0xe462('0x5')](_0x11f3a6);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 2ea701a..312903e 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3da7=['SenderId','Hoppers','SET\x20NULL','userProfileId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','ChatWebsites','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SpiedAgents','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperHistories','HopperBlacks','belongsTo','TrunkId','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Teams','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceQueueReport','QueueCalls','AgentReports','Contact','ContactId','MailServerIn','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','Interactions','List','ListId','TemplateId','Agents','team_has_mail_queues','MailInteractionId','Account','Owner','Tags','mail_interaction_has_tags','ThroughTags','Users','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','TagId','MailQueueReport','DashboardItem','Items','FaxAccountId','Exntensions','fax_interaction_has_tags','FaxInteractionId','AttachmentId','SmsAccountId','SmsMessage','SmsApplication','sms_interaction_has_tags','SmsInteractionId','UserSmsQueue','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','OpenchannelQueueReport','Agent','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','CompanyId','Phones','CmContactId','JscriptySessions','ChatInteractions','Company','cm_contact_has_tags','AdditionalPhones','OwnerId','CmHopperBlack','Queue','CampaignId','Condition','All','AutomationAllId','Any','OneAny','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','DefaultReportId','CustomReportId','whatsapp_interaction_has_tags','ItemType','ItemTypeId','CmHopperId','AllConditions','AnyConditions','AnyCondition','Fields','AnalyticFieldReport','MetricId','Configurations','AccountId','Subjects','SubjectId','SalesforceField','Descriptions','DescriptionId','Subject','Description','Field','FieldId','Variable','VariableId','SugarcrmAccount','int_desk_configuration_has_tags','ZohoConfiguration','ZohoField','int_zendesk_configuration_has_tags','FreshdeskAccount','VtigerAccount','VtigerField','ServicenowConfiguration','Dynamics365Account','FreshsalesConfiguration','ChatQueueReport','FromId','JscriptyAnswerReport','ProjectId','TeamVoiceQueue','team_has_chat_queues','team_has_fax_queues','team_has_whatsapp_queues','WhatsappQueues','VoicePrefix','TeamVoicePrefix','TrunkBackup','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToAccount','ChatTransferReport','FromChatWebsiteId','ToAgent','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','voice_queues_has_cm_lists','UserProfileSections','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','WhatsappQueueReport','ToWhatsappAccountId','ToQueueId','UserWhatsappQueue','WhatsappQueueId','exports','../config/environment','lodash','jstz','determine','sequelize','defaultsDeep','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8_general_ci','sequelizeHistory','motion2','name','database','username','password','options','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','JscriptyProject','Setting','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappMessage','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','SmsInteractions','FaxInteraction','FaxInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','UserNotifications'];(function(_0x39cf70,_0x3ec55b){var _0x580424=function(_0x580a4e){while(--_0x580a4e){_0x39cf70['push'](_0x39cf70['shift']());}};_0x580424(++_0x3ec55b);}(_0x3da7,0xe2));var _0x73da=function(_0x1147ab,_0x10e72b){_0x1147ab=_0x1147ab-0x0;var _0x55cb5a=_0x3da7[_0x1147ab];return _0x55cb5a;};'use strict';var config=require(_0x73da('0x0'));var Sequelize=require('sequelize');var _=require(_0x73da('0x1'));var jstz=require(_0x73da('0x2'));var timezone=jstz[_0x73da('0x3')]();config[_0x73da('0x4')]=_[_0x73da('0x5')](config[_0x73da('0x4')],{'database':'motion2','username':_0x73da('0x6'),'password':_0x73da('0x7'),'options':{'host':_0x73da('0x8'),'port':0xcea,'dialect':_0x73da('0x9'),'dialectOptions':{'charset':_0x73da('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x73da('0xb')}}});config[_0x73da('0xc')]=_['defaultsDeep'](config[_0x73da('0xc')],{'database':_0x73da('0xd'),'username':_0x73da('0x6'),'password':'xC@LL1234','options':{'host':_0x73da('0x8'),'port':0xcea,'dialect':_0x73da('0x9'),'dialectOptions':{'charset':_0x73da('0xa')},'logging':![],'timezone':timezone[_0x73da('0xe')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x73da('0xf')],config[_0x73da('0x4')][_0x73da('0x10')],config[_0x73da('0x4')][_0x73da('0x11')],config['sequelize'][_0x73da('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x73da('0xc')][_0x73da('0xf')],config[_0x73da('0xc')]['username'],config['sequelizeHistory'][_0x73da('0x11')],config['sequelizeHistory'][_0x73da('0x12')])};db[_0x73da('0x13')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/user/user.model');db[_0x73da('0x15')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x16'));db[_0x73da('0x17')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x18'));db[_0x73da('0x19')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x1a'));db[_0x73da('0x1b')]=db['sequelize'][_0x73da('0x14')](_0x73da('0x1c'));db[_0x73da('0x1d')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x1e'));db[_0x73da('0x1f')]=db['sequelize']['import'](_0x73da('0x20'));db[_0x73da('0x21')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/screenRecording/screenRecording.model');db[_0x73da('0x22')]=db[_0x73da('0x4')]['import'](_0x73da('0x23'));db[_0x73da('0x24')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x73da('0x25')]=db[_0x73da('0x4')]['import'](_0x73da('0x26'));db[_0x73da('0x27')]=db['sequelize'][_0x73da('0x14')](_0x73da('0x28'));db[_0x73da('0x29')]=db[_0x73da('0x4')]['import'](_0x73da('0x2a'));db['VoiceQueueReport']=db[_0x73da('0x4')]['import'](_0x73da('0x2b'));db[_0x73da('0x2c')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/memberReport/memberReport.model');db[_0x73da('0x2d')]=db[_0x73da('0x4')]['import'](_0x73da('0x2e'));db[_0x73da('0x2f')]=db[_0x73da('0x4')]['import'](_0x73da('0x30'));db[_0x73da('0x31')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x32'));db['UserVoiceQueue']=db[_0x73da('0x4')]['import'](_0x73da('0x33'));db[_0x73da('0x34')]=db['sequelize'][_0x73da('0x14')](_0x73da('0x35'));db[_0x73da('0x36')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/userMailQueue/userMailQueue.model');db[_0x73da('0x37')]=db['sequelize'][_0x73da('0x14')](_0x73da('0x38'));db['UserSmsQueue']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x39'));db[_0x73da('0x3a')]=db['sequelize'][_0x73da('0x14')](_0x73da('0x3b'));db['UserWhatsappQueue']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x3c'));db['MailServerIn']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x3d'));db[_0x73da('0x3e')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/mailServerOut/mailServerOut.model');db[_0x73da('0x3f')]=db['sequelize'][_0x73da('0x14')](_0x73da('0x40'));db[_0x73da('0x41')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x42'));db[_0x73da('0x43')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x44'));db[_0x73da('0x45')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x46'));db[_0x73da('0x47')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x48'));db[_0x73da('0x49')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x4a'));db['MailQueueReport']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x4b'));db[_0x73da('0x4c')]=db[_0x73da('0x4')]['import'](_0x73da('0x4d'));db['DashboardItem']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x4e'));db['FaxAccount']=db[_0x73da('0x4')][_0x73da('0x14')]('../api/faxAccount/faxAccount.model');db[_0x73da('0x4f')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x50'));db['FaxInteraction']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x51'));db[_0x73da('0x52')]=db['sequelize'][_0x73da('0x14')](_0x73da('0x53'));db[_0x73da('0x54')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/faxQueue/faxQueue.model');db[_0x73da('0x55')]=db[_0x73da('0x4')]['import'](_0x73da('0x56'));db[_0x73da('0x57')]=db['sequelize']['import'](_0x73da('0x58'));db['SmsApplication']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x59'));db[_0x73da('0x5a')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x5b'));db['SmsMessage']=db[_0x73da('0x4')]['import'](_0x73da('0x5c'));db[_0x73da('0x5d')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x5e'));db[_0x73da('0x5f')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x60'));db[_0x73da('0x61')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x62'));db[_0x73da('0x63')]=db[_0x73da('0x4')]['import'](_0x73da('0x64'));db[_0x73da('0x65')]=db['sequelize'][_0x73da('0x14')](_0x73da('0x66'));db[_0x73da('0x67')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/openchannelQueue/openchannelQueue.model');db[_0x73da('0x68')]=db[_0x73da('0x4')]['import'](_0x73da('0x69'));db['OpenchannelQueueReport']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x6a'));db[_0x73da('0x6b')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x6c'));db[_0x73da('0x6d')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x6e'));db[_0x73da('0x6f')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x70'));db['ChatOfflineMessage']=db[_0x73da('0x4')][_0x73da('0x14')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x73da('0x71')]=db[_0x73da('0x4')]['import'](_0x73da('0x72'));db[_0x73da('0x73')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x74'));db[_0x73da('0x75')]=db[_0x73da('0x4')]['import'](_0x73da('0x76'));db['CmCompany']=db[_0x73da('0x4')][_0x73da('0x14')]('../api/cmCompany/cmCompany.model');db['CmContact']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x77'));db[_0x73da('0x78')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x79'));db['CmHopperBlack']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x7a'));db[_0x73da('0x7b')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x7c'));db['CmHopperHistory']=db[_0x73da('0x4')][_0x73da('0x14')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x73da('0x7d')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x7e'));db[_0x73da('0x7f')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/cmCustomField/cmCustomField.model');db[_0x73da('0x80')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x81'));db[_0x73da('0x82')]=db['sequelize'][_0x73da('0x14')](_0x73da('0x83'));db[_0x73da('0x84')]=db['sequelize'][_0x73da('0x14')](_0x73da('0x85'));db[_0x73da('0x86')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/disposition/disposition.model');db['Condition']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x87'));db[_0x73da('0x88')]=db['sequelize']['import'](_0x73da('0x89'));db[_0x73da('0x8a')]=db[_0x73da('0x4')]['import'](_0x73da('0x8b'));db[_0x73da('0x8c')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/cdr/cdr.model');db[_0x73da('0x8d')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x8e'));db[_0x73da('0x8f')]=db[_0x73da('0x4')]['import']('../api/schedule/schedule.model');db[_0x73da('0x90')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x91'));db[_0x73da('0x92')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x93'));db[_0x73da('0x94')]=db[_0x73da('0x4')]['import'](_0x73da('0x95'));db[_0x73da('0x96')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x97'));db['CmHopperAdditionalPhone']=db['sequelize'][_0x73da('0x14')](_0x73da('0x98'));db[_0x73da('0x99')]=db['sequelize'][_0x73da('0x14')](_0x73da('0x9a'));db[_0x73da('0x9b')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/trigger/trigger.model');db['Variable']=db[_0x73da('0x4')][_0x73da('0x14')]('../api/variable/variable.model');db[_0x73da('0x9c')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x9d'));db[_0x73da('0x9e')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x9f'));db[_0x73da('0xa0')]=db[_0x73da('0x4')]['import'](_0x73da('0xa1'));db[_0x73da('0xa2')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xa3'));db['AnalyticExtractedReport']=db[_0x73da('0x4')]['import'](_0x73da('0xa4'));db[_0x73da('0xa5')]=db[_0x73da('0x4')]['import']('../api/analyticMetric/analyticMetric.model');db['AnalyticFieldReport']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xa6'));db[_0x73da('0xa7')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xa8'));db[_0x73da('0xa9')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xaa'));db[_0x73da('0xab')]=db['sequelize'][_0x73da('0x14')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db['SalesforceField']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xac'));db['SugarcrmAccount']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xad'));db[_0x73da('0xae')]=db[_0x73da('0x4')]['import'](_0x73da('0xaf'));db[_0x73da('0xb0')]=db['sequelize'][_0x73da('0x14')](_0x73da('0xb1'));db[_0x73da('0xb2')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xb3'));db[_0x73da('0xb4')]=db[_0x73da('0x4')]['import'](_0x73da('0xb5'));db[_0x73da('0xb6')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/intDeskField/intDeskField.model');db[_0x73da('0xb7')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xb8'));db['ZohoConfiguration']=db['sequelize'][_0x73da('0x14')](_0x73da('0xb9'));db['ZohoField']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xba'));db[_0x73da('0xbb')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xbc'));db[_0x73da('0xbd')]=db['sequelize'][_0x73da('0x14')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x73da('0xbe')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xbf'));db[_0x73da('0xc0')]=db['sequelize']['import'](_0x73da('0xc1'));db[_0x73da('0xc2')]=db[_0x73da('0x4')]['import'](_0x73da('0xc3'));db['VtigerAccount']=db['sequelize'][_0x73da('0x14')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x73da('0xc4')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xc5'));db['VtigerField']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xc6'));db[_0x73da('0xc7')]=db['sequelize'][_0x73da('0x14')](_0x73da('0xc8'));db['ServicenowConfiguration']=db['sequelize'][_0x73da('0x14')](_0x73da('0xc9'));db[_0x73da('0xca')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xcb'));db['Dynamics365Account']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xcc'));db[_0x73da('0xcd')]=db['sequelize'][_0x73da('0x14')](_0x73da('0xce'));db[_0x73da('0xcf')]=db['sequelize']['import'](_0x73da('0xd0'));db[_0x73da('0xd1')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xd2'));db['FreshsalesConfiguration']=db[_0x73da('0x4')]['import'](_0x73da('0xd3'));db[_0x73da('0xd4')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xd5'));db[_0x73da('0x9c')]=db[_0x73da('0x4')]['import'](_0x73da('0x9d'));db[_0x73da('0xd6')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xd7'));db['ChatQueueReport']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xd8'));db[_0x73da('0xd9')]=db[_0x73da('0x4')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db['JscriptyAnswerReport']=db['sequelize'][_0x73da('0x14')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x73da('0xda')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xdb'));db[_0x73da('0xdc')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xdd'));db[_0x73da('0xde')]=db['sequelize'][_0x73da('0x14')](_0x73da('0xdf'));db[_0x73da('0xe0')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/squareReport/squareReport.model');db[_0x73da('0xe1')]=db['sequelize']['import']('../api/squareReportDetail/squareReportDetail.model');db[_0x73da('0xe2')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/jscriptyProject/jscriptyProject.model');db[_0x73da('0xe3')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/setting/setting.model');db[_0x73da('0xe4')]=db[_0x73da('0x4')]['import']('../api/squareOdbc/squareOdbc.model');db[_0x73da('0xe5')]=db[_0x73da('0x4')]['import'](_0x73da('0xe6'));db[_0x73da('0xe7')]=db['sequelize'][_0x73da('0x14')](_0x73da('0xe8'));db[_0x73da('0xe9')]=db[_0x73da('0x4')]['import'](_0x73da('0xea'));db[_0x73da('0xeb')]=db['sequelize'][_0x73da('0x14')](_0x73da('0xec'));db[_0x73da('0xed')]=db[_0x73da('0x4')]['import'](_0x73da('0xee'));db[_0x73da('0xef')]=db['sequelize'][_0x73da('0x14')](_0x73da('0xf0'));db[_0x73da('0xf1')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xf2'));db[_0x73da('0xf3')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xf4'));db['Plugin']=db[_0x73da('0x4')]['import'](_0x73da('0xf5'));db['MailTransferReport']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xf6'));db['ChatTransferReport']=db[_0x73da('0x4')][_0x73da('0x14')]('../api/chatTransferReport/chatTransferReport.model');db[_0x73da('0xf7')]=db[_0x73da('0x4')]['import'](_0x73da('0xf8'));db[_0x73da('0xf9')]=db[_0x73da('0x4')]['import'](_0x73da('0xfa'));db[_0x73da('0xfb')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xfc'));db[_0x73da('0xfd')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/cmList/cmList.model');db['VoicePrefix']=db[_0x73da('0x4')]['import']('../api/voicePrefix/voicePrefix.model');db[_0x73da('0xfe')]=db['sequelize'][_0x73da('0x14')](_0x73da('0xff'));db[_0x73da('0x100')]=db[_0x73da('0x4')]['import']('../api/userProfileSection/userProfileSection.model');db[_0x73da('0x101')]=db[_0x73da('0x4')]['import'](_0x73da('0x102'));db[_0x73da('0x103')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x104'));db[_0x73da('0x105')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x106'));db['WhatsappApplication']=db[_0x73da('0x4')]['import'](_0x73da('0x107'));db['WhatsappInteraction']=db[_0x73da('0x4')]['import']('../api/whatsappInteraction/whatsappInteraction.model');db[_0x73da('0x108')]=db['sequelize']['import']('../api/whatsappMessage/whatsappMessage.model');db['WhatsappQueueReport']=db[_0x73da('0x4')]['import'](_0x73da('0x109'));db[_0x73da('0x10a')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x10b'));db[_0x73da('0x10c')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x10d'));db[_0x73da('0x10e')]=db[_0x73da('0x4')]['import'](_0x73da('0x10f'));db['TeamVoiceQueue']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x110'));db['TeamVoicePrefix']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x111'));db[_0x73da('0x112')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x113'));db[_0x73da('0x114')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/user-setting/user-setting.model');db[_0x73da('0x115')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x116'));db[_0x73da('0x13')][_0x73da('0x117')](db[_0x73da('0x22')],{'as':'VoiceMail','onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x119')});db[_0x73da('0x13')]['hasOne'](db[_0x73da('0x114')],{'as':'userSetting','onDelete':'cascade','foreignKey':_0x73da('0x119')});db['User'][_0x73da('0x11a')](db[_0x73da('0x1f')],{'as':_0x73da('0x11b'),'foreignKey':_0x73da('0x119')});db[_0x73da('0x13')][_0x73da('0x11a')](db['UserVoiceQueueRt'],{'as':_0x73da('0x11c'),'foreignKey':'UserId'});db[_0x73da('0x13')][_0x73da('0x11a')](db[_0x73da('0x19')],{'as':_0x73da('0x11d'),'onDelete':_0x73da('0x118'),'hooks':!![]});db[_0x73da('0x13')]['hasMany'](db[_0x73da('0x7b')],{'as':_0x73da('0x11e'),'foreignKey':_0x73da('0x119')});db['User'][_0x73da('0x11a')](db[_0x73da('0x11f')],{'as':_0x73da('0x120'),'foreignKey':'UserId'});db[_0x73da('0x13')][_0x73da('0x11a')](db[_0x73da('0x7d')],{'as':_0x73da('0x7d'),'foreignKey':_0x73da('0x119')});db[_0x73da('0x13')][_0x73da('0x11a')](db[_0x73da('0x63')],{'as':_0x73da('0x121'),'foreignKey':_0x73da('0x119')});db[_0x73da('0x13')][_0x73da('0x11a')](db[_0x73da('0x6d')],{'as':'ChatInteractions','foreignKey':_0x73da('0x119')});db[_0x73da('0x13')][_0x73da('0x11a')](db['SmsInteraction'],{'as':_0x73da('0x122'),'foreignKey':_0x73da('0x119')});db[_0x73da('0x13')][_0x73da('0x11a')](db[_0x73da('0x123')],{'as':_0x73da('0x124'),'foreignKey':_0x73da('0x119')});db[_0x73da('0x13')]['hasMany'](db[_0x73da('0x45')],{'as':_0x73da('0x125'),'foreignKey':_0x73da('0x119')});db[_0x73da('0x13')][_0x73da('0x11a')](db[_0x73da('0x126')],{'as':_0x73da('0x127'),'foreignKey':'UserId'});db[_0x73da('0x13')][_0x73da('0x11a')](db[_0x73da('0x103')],{'as':_0x73da('0x128'),'foreignKey':_0x73da('0x129')});db[_0x73da('0x13')][_0x73da('0x11a')](db[_0x73da('0x78')],{'as':_0x73da('0x12a'),'foreignKey':_0x73da('0x119'),'onDelete':_0x73da('0x12b')});db[_0x73da('0x13')]['belongsTo'](db['UserProfile'],{'as':_0x73da('0xfe'),'foreignKey':_0x73da('0x12c')});db[_0x73da('0x13')][_0x73da('0x12d')](db[_0x73da('0x73')],{'as':_0x73da('0x12e'),'through':_0x73da('0x12f')});db[_0x73da('0x13')][_0x73da('0x12d')](db[_0x73da('0x130')],{'as':_0x73da('0x131'),'through':_0x73da('0x132')});db[_0x73da('0x13')][_0x73da('0x12d')](db[_0x73da('0xfd')],{'as':_0x73da('0x133'),'through':_0x73da('0x134')});db['User'][_0x73da('0x12d')](db['Team'],{'through':_0x73da('0x135')});db[_0x73da('0x13')][_0x73da('0x12d')](db[_0x73da('0x45')],{'as':_0x73da('0x125'),'through':_0x73da('0x136')});db[_0x73da('0x13')]['belongsToMany'](db['ChatInteraction'],{'as':'ChatInteractions','through':_0x73da('0x137')});db['User'][_0x73da('0x12d')](db[_0x73da('0x123')],{'as':_0x73da('0x124'),'through':_0x73da('0x138')});db['User'][_0x73da('0x12d')](db[_0x73da('0x5a')],{'as':_0x73da('0x122'),'through':_0x73da('0x139')});db[_0x73da('0x13')]['belongsToMany'](db[_0x73da('0x63')],{'as':_0x73da('0x121'),'through':_0x73da('0x13a')});db['User'][_0x73da('0x12d')](db[_0x73da('0x126')],{'as':_0x73da('0x127'),'through':_0x73da('0x13b')});db[_0x73da('0x13')][_0x73da('0x12d')](db[_0x73da('0x1d')],{'as':_0x73da('0x13c'),'through':_0x73da('0x13d'),'required':![]});db[_0x73da('0x13')]['belongsToMany'](db['VoicePrefix'],{'as':_0x73da('0x13e'),'through':_0x73da('0x112'),'required':![]});db['User']['belongsToMany'](db[_0x73da('0x41')],{'as':_0x73da('0x13f'),'through':'UserMailQueue','required':![]});db[_0x73da('0x13')]['belongsToMany'](db[_0x73da('0x71')],{'as':_0x73da('0x140'),'through':_0x73da('0x34'),'required':![],'hooks':!![]});db[_0x73da('0x13')]['belongsToMany'](db[_0x73da('0x54')],{'as':_0x73da('0x141'),'through':_0x73da('0x37'),'required':![]});db[_0x73da('0x13')][_0x73da('0x12d')](db['SmsQueue'],{'as':_0x73da('0x142'),'through':'UserSmsQueue','required':![]});db[_0x73da('0x13')][_0x73da('0x12d')](db[_0x73da('0x67')],{'as':_0x73da('0x143'),'through':_0x73da('0x3a'),'required':![]});db[_0x73da('0x13')][_0x73da('0x12d')](db[_0x73da('0x10c')],{'as':'WhatsappQueues','through':'UserWhatsappQueue','required':![]});db['User'][_0x73da('0x12d')](db[_0x73da('0xfd')],{'through':_0x73da('0x134')});db[_0x73da('0x13')]['belongsToMany'](db[_0x73da('0x68')],{'as':_0x73da('0x144'),'through':_0x73da('0x145')});db['User'][_0x73da('0x12d')](db[_0x73da('0x146')],{'as':_0x73da('0x147'),'through':_0x73da('0x148')});db['User']['belongsToMany'](db[_0x73da('0x3f')],{'as':_0x73da('0x149'),'through':_0x73da('0x14a')});db[_0x73da('0x13')][_0x73da('0x12d')](db[_0x73da('0x5f')],{'as':_0x73da('0x14b'),'through':'user_has_openchannel_accounts'});db[_0x73da('0x13')]['belongsToMany'](db[_0x73da('0x57')],{'as':_0x73da('0x14c'),'through':_0x73da('0x14d')});db[_0x73da('0x13')][_0x73da('0x12d')](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':_0x73da('0x14e')});db[_0x73da('0x15')][_0x73da('0x11a')](db[_0x73da('0x19')],{'as':_0x73da('0x14f'),'onDelete':_0x73da('0x118'),'foreignKey':'ChanSpyId'});db[_0x73da('0x17')]['hasMany'](db['VoiceExtension'],{'onDelete':_0x73da('0x118')});db[_0x73da('0x19')][_0x73da('0x11a')](db['VoiceExtension'],{'as':_0x73da('0x150'),'onDelete':_0x73da('0x118')});db[_0x73da('0x1b')][_0x73da('0x12d')](db[_0x73da('0x90')],{'as':_0x73da('0x151'),'through':_0x73da('0x152')});db['VoiceQueue'][_0x73da('0x11a')](db[_0x73da('0x31')],{'as':_0x73da('0x153'),'foreignKey':_0x73da('0x154')});db[_0x73da('0x1d')][_0x73da('0x11a')](db[_0x73da('0x78')],{'as':_0x73da('0x12a'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x73da('0x11a')](db['CmHopperFinal'],{'as':_0x73da('0x11e'),'foreignKey':_0x73da('0x154')});db[_0x73da('0x1d')][_0x73da('0x11a')](db[_0x73da('0x11f')],{'as':_0x73da('0x155'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x73da('0x11a')](db[_0x73da('0x7d')],{'as':_0x73da('0x7d'),'foreignKey':_0x73da('0x154')});db[_0x73da('0x1d')][_0x73da('0x11a')](db['CmHopperBlack'],{'as':_0x73da('0x156'),'foreignKey':_0x73da('0x154')});db[_0x73da('0x1d')][_0x73da('0x11a')](db[_0x73da('0xdc')],{'as':'JscriptySessions','foreignKey':'VoiceQueueId'});db[_0x73da('0x1d')][_0x73da('0x157')](db[_0x73da('0x2d')],{'as':_0x73da('0x2d'),'foreignKey':_0x73da('0x158')});db['VoiceQueue'][_0x73da('0x157')](db[_0x73da('0x2d')],{'as':'TrunkBackup','foreignKey':_0x73da('0x159')});db[_0x73da('0x1d')]['belongsTo'](db[_0x73da('0x88')],{'as':_0x73da('0x88'),'foreignKey':_0x73da('0x15a')});db[_0x73da('0x1d')][_0x73da('0x157')](db['Pause'],{'as':_0x73da('0x15b'),'foreignKey':_0x73da('0x15c')});db['VoiceQueue'][_0x73da('0x12d')](db[_0x73da('0xfd')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db[_0x73da('0x1d')][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':'Agents','through':_0x73da('0x13d')});db[_0x73da('0x1d')][_0x73da('0x12d')](db[_0x73da('0xeb')],{'as':_0x73da('0x15d'),'through':'TeamVoiceQueue'});db[_0x73da('0x1d')][_0x73da('0x12d')](db[_0x73da('0xfd')],{'as':'BlackLists','through':_0x73da('0x15e')});db[_0x73da('0x1f')][_0x73da('0x157')](db['User'],{'as':_0x73da('0x13'),'foreignKey':_0x73da('0x119')});db['ScreenRecording'][_0x73da('0x157')](db[_0x73da('0x13')],{'as':_0x73da('0x13'),'foreignKey':'UserId'});db[_0x73da('0x22')]['hasMany'](db[_0x73da('0x24')],{'as':_0x73da('0x15f'),'onDelete':_0x73da('0x118'),'foreignKey':'mailboxuser','sourceKey':_0x73da('0x160')});db['VoiceMailMessage'][_0x73da('0x157')](db[_0x73da('0x22')],{'foreignKey':_0x73da('0x161'),'targetKey':_0x73da('0x160')});db[_0x73da('0x25')][_0x73da('0x11a')](db[_0x73da('0x162')],{'as':_0x73da('0x163'),'foreignKey':'uniqueid','constraints':![]});db[_0x73da('0x25')][_0x73da('0x11a')](db['VoiceAgentReport'],{'as':_0x73da('0x164'),'foreignKey':'uniqueid','constraints':![]});db[_0x73da('0x25')][_0x73da('0x157')](db[_0x73da('0x13')],{'as':_0x73da('0x13'),'foreignKey':_0x73da('0x119')});db[_0x73da('0x25')][_0x73da('0x157')](db['CmContact'],{'as':_0x73da('0x165'),'foreignKey':_0x73da('0x166')});db[_0x73da('0x167')][_0x73da('0x157')](db[_0x73da('0x3f')],{'as':_0x73da('0x3f'),'foreignKey':_0x73da('0x168')});db['MailServerIn'][_0x73da('0x157')](db['CloudProvider'],{'as':_0x73da('0x10e'),'foreignKey':_0x73da('0x169'),'onDelete':_0x73da('0x16a')});db[_0x73da('0x3e')][_0x73da('0x157')](db[_0x73da('0x3f')],{'as':_0x73da('0x3f'),'foreignKey':_0x73da('0x168')});db[_0x73da('0x3e')][_0x73da('0x157')](db[_0x73da('0x10e')],{'as':_0x73da('0x10e'),'foreignKey':'CloudProviderId','onDelete':_0x73da('0x16a')});db['MailAccount'][_0x73da('0x117')](db[_0x73da('0x167')],{'as':_0x73da('0x16b'),'onDelete':_0x73da('0x118')});db[_0x73da('0x3f')][_0x73da('0x117')](db['MailServerOut'],{'as':_0x73da('0x16c'),'onDelete':_0x73da('0x118')});db[_0x73da('0x3f')][_0x73da('0x11a')](db[_0x73da('0x86')],{'as':_0x73da('0x16d'),'foreignKey':_0x73da('0x168'),'onDelete':_0x73da('0x118')});db[_0x73da('0x3f')][_0x73da('0x11a')](db[_0x73da('0x84')],{'as':_0x73da('0x16e'),'foreignKey':'MailAccountId'});db[_0x73da('0x3f')]['hasMany'](db['MailMessage'],{'as':_0x73da('0x15f'),'foreignKey':_0x73da('0x168')});db['MailAccount'][_0x73da('0x11a')](db[_0x73da('0x45')],{'as':_0x73da('0x16f')});db[_0x73da('0x3f')][_0x73da('0x11a')](db[_0x73da('0x49')],{'as':'Applications','foreignKey':_0x73da('0x168'),'onDelete':'cascade'});db['MailAccount'][_0x73da('0x157')](db[_0x73da('0xfd')],{'as':_0x73da('0x170'),'foreignKey':_0x73da('0x171')});db[_0x73da('0x3f')][_0x73da('0x157')](db['Template'],{'as':_0x73da('0x99'),'foreignKey':_0x73da('0x172')});db['MailAccount']['belongsTo'](db[_0x73da('0x8a')],{'as':'mandatoryDispositionPause','foreignKey':_0x73da('0x15c')});db[_0x73da('0x3f')][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':_0x73da('0x173'),'through':'user_has_mail_accounts'});db['MailQueue'][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':_0x73da('0x173'),'through':_0x73da('0x36')});db['MailQueue'][_0x73da('0x12d')](db[_0x73da('0xeb')],{'through':_0x73da('0x174'),'as':'Teams'});db['MailInteraction']['hasMany'](db['MailMessage'],{'as':'Messages','onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x175')});db[_0x73da('0x45')][_0x73da('0x157')](db[_0x73da('0x3f')],{'as':_0x73da('0x176'),'foreignKey':'MailAccountId'});db[_0x73da('0x45')][_0x73da('0x157')](db[_0x73da('0x130')],{'as':'Contact','foreignKey':_0x73da('0x166')});db[_0x73da('0x45')][_0x73da('0x157')](db[_0x73da('0x13')],{'as':_0x73da('0x177'),'foreignKey':'UserId'});db[_0x73da('0x45')][_0x73da('0x12d')](db[_0x73da('0x92')],{'through':'mail_interaction_has_tags','as':_0x73da('0x178')});db['MailInteraction'][_0x73da('0x12d')](db[_0x73da('0x92')],{'through':_0x73da('0x179'),'as':_0x73da('0x17a')});db[_0x73da('0x45')][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':_0x73da('0x17b'),'through':_0x73da('0x136'),'foreignKey':_0x73da('0x175')});db[_0x73da('0x47')][_0x73da('0x11a')](db[_0x73da('0xf3')],{'as':_0x73da('0x17c'),'onDelete':_0x73da('0x118')});db['MailMessage'][_0x73da('0x157')](db[_0x73da('0x13')],{'as':_0x73da('0x13')});db[_0x73da('0x47')][_0x73da('0x157')](db[_0x73da('0x130')],{'onDelete':_0x73da('0x118'),'as':_0x73da('0x165')});db[_0x73da('0x47')][_0x73da('0x157')](db['MailInteraction'],{'as':_0x73da('0x17d'),'foreignKey':_0x73da('0x175')});db[_0x73da('0x47')][_0x73da('0x157')](db[_0x73da('0x3f')],{'as':_0x73da('0x176'),'foreignKey':_0x73da('0x168')});db[_0x73da('0x47')][_0x73da('0x157')](db[_0x73da('0x68')],{'as':_0x73da('0x68'),'foreignKey':_0x73da('0x17e')});db[_0x73da('0x47')][_0x73da('0x157')](db[_0x73da('0x17f')],{'as':'ChatOfflineMessage','foreignKey':_0x73da('0x180')});db['MailApplication'][_0x73da('0x157')](db['User'],{'onDelete':'restrict'});db[_0x73da('0x49')][_0x73da('0x157')](db['MailQueue'],{'onDelete':'restrict'});db[_0x73da('0x49')][_0x73da('0x157')](db[_0x73da('0x3f')],{'onDelete':_0x73da('0x16a')});db[_0x73da('0x49')][_0x73da('0x157')](db[_0x73da('0x88')],{'onDelete':_0x73da('0x16a'),'foreignKey':'IntervalId'});db[_0x73da('0x49')][_0x73da('0x157')](db['Tag'],{'onDelete':_0x73da('0x16a'),'foreignKey':_0x73da('0x181')});db[_0x73da('0x182')][_0x73da('0x157')](db[_0x73da('0x3f')],{});db[_0x73da('0x182')][_0x73da('0x157')](db[_0x73da('0xfd')],{'as':_0x73da('0x170'),'foreignKey':_0x73da('0x171')});db['MailQueueReport']['belongsTo'](db[_0x73da('0x130')],{'as':_0x73da('0x165'),'foreignKey':_0x73da('0x166')});db[_0x73da('0x182')][_0x73da('0x157')](db[_0x73da('0x45')],{});db[_0x73da('0x182')][_0x73da('0x157')](db[_0x73da('0x47')],{});db['MailQueueReport'][_0x73da('0x157')](db['User'],{});db[_0x73da('0x182')]['belongsTo'](db['MailQueue'],{});db['Dashboard'][_0x73da('0x11a')](db[_0x73da('0x183')],{'as':_0x73da('0x184'),'onDelete':_0x73da('0x118')});db[_0x73da('0x146')]['hasMany'](db[_0x73da('0x86')],{'as':_0x73da('0x16d'),'foreignKey':_0x73da('0x185'),'onDelete':_0x73da('0x118')});db[_0x73da('0x146')]['hasMany'](db[_0x73da('0x84')],{'as':_0x73da('0x16e'),'foreignKey':_0x73da('0x185')});db[_0x73da('0x146')][_0x73da('0x11a')](db[_0x73da('0x123')],{'as':_0x73da('0x16f')});db['FaxAccount'][_0x73da('0x11a')](db[_0x73da('0x4f')],{'as':_0x73da('0x150'),'foreignKey':_0x73da('0x185'),'onDelete':_0x73da('0x118')});db[_0x73da('0x146')][_0x73da('0x11a')](db['VoiceExtension'],{'as':_0x73da('0x186'),'onDelete':_0x73da('0x118')});db[_0x73da('0x146')][_0x73da('0x11a')](db['FaxMessage'],{'as':_0x73da('0x15f')});db['FaxAccount'][_0x73da('0x157')](db[_0x73da('0x2d')],{'as':_0x73da('0x2d')});db[_0x73da('0x146')][_0x73da('0x157')](db[_0x73da('0xfd')],{'as':_0x73da('0x170'),'foreignKey':_0x73da('0x171')});db[_0x73da('0x146')][_0x73da('0x157')](db[_0x73da('0x8a')],{'as':'mandatoryDispositionPause','foreignKey':_0x73da('0x15c')});db[_0x73da('0x146')][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':_0x73da('0x173'),'through':_0x73da('0x148')});db[_0x73da('0x4f')][_0x73da('0x157')](db[_0x73da('0x13')],{'onDelete':_0x73da('0x16a')});db['FaxApplication'][_0x73da('0x157')](db[_0x73da('0x54')],{'onDelete':_0x73da('0x16a')});db[_0x73da('0x4f')]['belongsTo'](db['FaxAccount'],{'onDelete':'restrict'});db['FaxApplication'][_0x73da('0x157')](db['Tag'],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x73da('0x123')]['hasMany'](db['FaxMessage'],{'as':_0x73da('0x15f'),'onDelete':_0x73da('0x118'),'foreignKey':'FaxInteractionId'});db[_0x73da('0x123')][_0x73da('0x157')](db[_0x73da('0x146')],{'as':'Account','foreignKey':_0x73da('0x185')});db[_0x73da('0x123')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x73da('0x123')][_0x73da('0x157')](db[_0x73da('0x13')],{'as':_0x73da('0x177'),'foreignKey':_0x73da('0x119')});db[_0x73da('0x123')]['belongsToMany'](db[_0x73da('0x92')],{'through':_0x73da('0x187'),'as':_0x73da('0x178')});db['FaxInteraction'][_0x73da('0x12d')](db[_0x73da('0x92')],{'through':_0x73da('0x187'),'as':'ThroughTags'});db['FaxInteraction'][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':_0x73da('0x17b'),'through':_0x73da('0x138'),'foreignKey':_0x73da('0x188')});db[_0x73da('0x52')][_0x73da('0x157')](db['User'],{'onDelete':'cascade','as':_0x73da('0x13')});db[_0x73da('0x52')]['belongsTo'](db[_0x73da('0x123')],{'as':_0x73da('0x17d'),'foreignKey':_0x73da('0x188')});db[_0x73da('0x52')][_0x73da('0x157')](db[_0x73da('0x130')],{'onDelete':_0x73da('0x118'),'as':'Contact'});db['FaxMessage'][_0x73da('0x157')](db[_0x73da('0xf3')],{'as':_0x73da('0xf3'),'foreignKey':_0x73da('0x189')});db[_0x73da('0x52')][_0x73da('0x157')](db[_0x73da('0x146')],{'as':_0x73da('0x176'),'foreignKey':_0x73da('0x185')});db['FaxQueue'][_0x73da('0x12d')](db['User'],{'as':'Agents','through':_0x73da('0x37')});db[_0x73da('0x54')][_0x73da('0x12d')](db[_0x73da('0xeb')],{'through':'team_has_fax_queues','as':'Teams'});db[_0x73da('0x55')][_0x73da('0x157')](db[_0x73da('0x146')],{});db['FaxQueueReport']['belongsTo'](db['CmList'],{'as':_0x73da('0x170'),'foreignKey':_0x73da('0x171')});db['FaxQueueReport'][_0x73da('0x157')](db['CmContact'],{'as':_0x73da('0x165'),'foreignKey':_0x73da('0x166')});db['FaxQueueReport']['belongsTo'](db[_0x73da('0x123')],{});db[_0x73da('0x55')]['belongsTo'](db[_0x73da('0x52')],{});db[_0x73da('0x55')][_0x73da('0x157')](db[_0x73da('0x13')],{});db[_0x73da('0x55')]['belongsTo'](db[_0x73da('0x54')],{});db[_0x73da('0x57')][_0x73da('0x11a')](db[_0x73da('0x86')],{'as':'Dispositions','foreignKey':'SmsAccountId','onDelete':_0x73da('0x118')});db['SmsAccount'][_0x73da('0x11a')](db[_0x73da('0x84')],{'as':'Answers','foreignKey':_0x73da('0x18a')});db[_0x73da('0x57')][_0x73da('0x11a')](db[_0x73da('0x18b')],{'as':_0x73da('0x15f'),'foreignKey':_0x73da('0x18a')});db[_0x73da('0x57')]['hasMany'](db[_0x73da('0x5a')],{'as':_0x73da('0x16f')});db[_0x73da('0x57')]['hasMany'](db[_0x73da('0x18c')],{'as':_0x73da('0x150'),'foreignKey':'SmsAccountId','onDelete':'cascade'});db[_0x73da('0x57')]['belongsTo'](db['CmList'],{'as':_0x73da('0x170'),'foreignKey':_0x73da('0x171')});db[_0x73da('0x57')][_0x73da('0x157')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x73da('0x15c')});db[_0x73da('0x57')][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':'Agents','through':_0x73da('0x14d')});db[_0x73da('0x18c')]['belongsTo'](db[_0x73da('0x13')],{'onDelete':_0x73da('0x16a')});db['SmsApplication'][_0x73da('0x157')](db[_0x73da('0x5d')],{'onDelete':_0x73da('0x16a')});db[_0x73da('0x18c')][_0x73da('0x157')](db[_0x73da('0x57')],{'onDelete':'restrict'});db[_0x73da('0x18c')][_0x73da('0x157')](db['Interval'],{'onDelete':_0x73da('0x16a'),'foreignKey':'IntervalId'});db[_0x73da('0x18c')][_0x73da('0x157')](db[_0x73da('0x92')],{'onDelete':_0x73da('0x16a'),'foreignKey':_0x73da('0x181')});db[_0x73da('0x5a')][_0x73da('0x11a')](db['SmsMessage'],{'as':_0x73da('0x15f'),'onDelete':_0x73da('0x118'),'foreignKey':'SmsInteractionId'});db[_0x73da('0x5a')]['belongsTo'](db[_0x73da('0x57')],{'as':'Account','foreignKey':'SmsAccountId'});db[_0x73da('0x5a')][_0x73da('0x157')](db['CmContact'],{'as':_0x73da('0x165'),'foreignKey':_0x73da('0x166')});db[_0x73da('0x5a')]['belongsTo'](db[_0x73da('0x13')],{'as':_0x73da('0x177'),'foreignKey':_0x73da('0x119')});db[_0x73da('0x5a')][_0x73da('0x12d')](db[_0x73da('0x92')],{'through':'sms_interaction_has_tags','as':_0x73da('0x178')});db[_0x73da('0x5a')][_0x73da('0x12d')](db[_0x73da('0x92')],{'through':_0x73da('0x18d'),'as':_0x73da('0x17a')});db[_0x73da('0x5a')][_0x73da('0x12d')](db['User'],{'as':_0x73da('0x17b'),'through':_0x73da('0x139'),'foreignKey':_0x73da('0x18e')});db[_0x73da('0x18b')][_0x73da('0x157')](db[_0x73da('0x13')],{'as':_0x73da('0x13')});db[_0x73da('0x18b')]['belongsTo'](db[_0x73da('0x130')],{'onDelete':_0x73da('0x118'),'as':_0x73da('0x165')});db['SmsMessage'][_0x73da('0x157')](db[_0x73da('0x5a')],{'onDelete':_0x73da('0x118'),'as':'Interaction','foreignKey':'SmsInteractionId'});db[_0x73da('0x18b')][_0x73da('0x157')](db[_0x73da('0x57')],{'as':'Account','foreignKey':_0x73da('0x18a')});db[_0x73da('0x5d')][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':'Agents','through':_0x73da('0x18f'),'foreignKey':_0x73da('0x190')});db[_0x73da('0x5d')][_0x73da('0x12d')](db[_0x73da('0xeb')],{'through':_0x73da('0x191'),'as':_0x73da('0x15d')});db['OpenchannelAccount'][_0x73da('0x11a')](db[_0x73da('0x86')],{'as':_0x73da('0x16d'),'foreignKey':_0x73da('0x192'),'onDelete':_0x73da('0x118')});db[_0x73da('0x5f')]['hasMany'](db[_0x73da('0x84')],{'as':'Answers','foreignKey':_0x73da('0x192')});db[_0x73da('0x5f')][_0x73da('0x11a')](db[_0x73da('0x63')],{'as':_0x73da('0x16f'),'foreignKey':'OpenchannelAccountId'});db[_0x73da('0x5f')][_0x73da('0x11a')](db[_0x73da('0x65')],{'as':_0x73da('0x15f'),'foreignKey':_0x73da('0x192')});db[_0x73da('0x5f')]['hasMany'](db[_0x73da('0x61')],{'as':'Applications','foreignKey':_0x73da('0x192'),'onDelete':_0x73da('0x118')});db['OpenchannelAccount']['belongsTo'](db[_0x73da('0xfd')],{'as':_0x73da('0x170'),'foreignKey':_0x73da('0x171')});db[_0x73da('0x5f')]['belongsTo'](db[_0x73da('0x8a')],{'as':_0x73da('0x15b'),'foreignKey':_0x73da('0x15c')});db[_0x73da('0x5f')][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':_0x73da('0x173'),'through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0x73da('0x157')](db[_0x73da('0x13')],{'onDelete':_0x73da('0x16a')});db[_0x73da('0x61')][_0x73da('0x157')](db[_0x73da('0x67')],{'onDelete':_0x73da('0x16a'),'foreignKey':_0x73da('0x193')});db[_0x73da('0x61')][_0x73da('0x157')](db[_0x73da('0x5f')],{'onDelete':_0x73da('0x16a'),'foreignKey':_0x73da('0x192')});db['OpenchannelApplication'][_0x73da('0x157')](db[_0x73da('0x88')],{'onDelete':_0x73da('0x16a'),'foreignKey':_0x73da('0x15a')});db[_0x73da('0x61')][_0x73da('0x157')](db['Tag'],{'onDelete':_0x73da('0x16a'),'foreignKey':'TagId'});db[_0x73da('0x63')][_0x73da('0x11a')](db[_0x73da('0x65')],{'as':_0x73da('0x15f'),'onDelete':_0x73da('0x118'),'foreignKey':'OpenchannelInteractionId'});db[_0x73da('0x63')][_0x73da('0x157')](db[_0x73da('0x5f')],{'as':_0x73da('0x176'),'foreignKey':_0x73da('0x192')});db[_0x73da('0x63')][_0x73da('0x157')](db[_0x73da('0x130')],{'as':_0x73da('0x165'),'foreignKey':'ContactId'});db['OpenchannelInteraction'][_0x73da('0x157')](db[_0x73da('0x13')],{'as':'Owner','foreignKey':_0x73da('0x119')});db[_0x73da('0x63')]['belongsToMany'](db['Tag'],{'through':_0x73da('0x194'),'as':_0x73da('0x178')});db[_0x73da('0x63')][_0x73da('0x12d')](db[_0x73da('0x92')],{'through':_0x73da('0x194'),'as':_0x73da('0x17a')});db[_0x73da('0x63')]['belongsToMany'](db[_0x73da('0x13')],{'as':'Users','through':_0x73da('0x13a'),'foreignKey':_0x73da('0x195')});db['OpenchannelMessage'][_0x73da('0x157')](db[_0x73da('0x13')],{'onDelete':_0x73da('0x118'),'as':'User'});db['OpenchannelMessage'][_0x73da('0x157')](db[_0x73da('0x130')],{'onDelete':'cascade','as':_0x73da('0x165')});db[_0x73da('0x65')][_0x73da('0x157')](db[_0x73da('0x63')],{'onDelete':_0x73da('0x118'),'as':_0x73da('0x17d'),'foreignKey':_0x73da('0x195')});db[_0x73da('0x65')]['belongsTo'](db[_0x73da('0xf3')],{'as':_0x73da('0xf3'),'foreignKey':'AttachmentId'});db['OpenchannelMessage'][_0x73da('0x157')](db[_0x73da('0x5f')],{'as':_0x73da('0x176'),'foreignKey':_0x73da('0x192')});db['OpenchannelQueue'][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':_0x73da('0x173'),'through':_0x73da('0x3a'),'foreignKey':'OpenchannelQueueId'});db[_0x73da('0x67')][_0x73da('0x12d')](db[_0x73da('0xeb')],{'through':_0x73da('0x196'),'as':_0x73da('0x15d')});db[_0x73da('0x68')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x73da('0x17e'),'onDelete':_0x73da('0x118')});db['ChatWebsite']['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x73da('0x17e')});db[_0x73da('0x68')]['hasMany'](db[_0x73da('0x75')],{'as':'ProactiveActions'});db[_0x73da('0x68')][_0x73da('0x11a')](db[_0x73da('0x6d')],{'as':_0x73da('0x16f')});db[_0x73da('0x68')][_0x73da('0x11a')](db[_0x73da('0x6b')],{'as':_0x73da('0x150'),'foreignKey':'ChatWebsiteId','onDelete':_0x73da('0x118')});db[_0x73da('0x68')][_0x73da('0x11a')](db[_0x73da('0x6f')],{'as':_0x73da('0x15f')});db[_0x73da('0x68')][_0x73da('0x157')](db[_0x73da('0xfd')],{'as':_0x73da('0x170'),'foreignKey':_0x73da('0x171')});db[_0x73da('0x68')][_0x73da('0x157')](db['Interval'],{'as':'Interval','foreignKey':_0x73da('0x15a')});db[_0x73da('0x68')][_0x73da('0x157')](db[_0x73da('0x3f')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x73da('0x68')][_0x73da('0x157')](db['Pause'],{'as':_0x73da('0x15b'),'foreignKey':_0x73da('0x15c')});db[_0x73da('0x68')]['belongsToMany'](db[_0x73da('0x13')],{'as':_0x73da('0x173'),'through':_0x73da('0x145')});db['OpenchannelQueueReport'][_0x73da('0x157')](db[_0x73da('0x5f')],{});db[_0x73da('0x197')][_0x73da('0x157')](db[_0x73da('0xfd')],{'as':_0x73da('0x170'),'foreignKey':_0x73da('0x171')});db[_0x73da('0x197')][_0x73da('0x157')](db['CmContact'],{'as':_0x73da('0x165'),'foreignKey':_0x73da('0x166')});db[_0x73da('0x197')][_0x73da('0x157')](db[_0x73da('0x63')],{});db[_0x73da('0x197')]['belongsTo'](db[_0x73da('0x65')],{});db[_0x73da('0x197')][_0x73da('0x157')](db[_0x73da('0x13')],{});db[_0x73da('0x197')][_0x73da('0x157')](db[_0x73da('0x67')],{});db['ChatApplication'][_0x73da('0x157')](db[_0x73da('0x13')],{'as':_0x73da('0x198'),'foreignKey':_0x73da('0x119'),'onDelete':'restrict'});db[_0x73da('0x6b')][_0x73da('0x157')](db[_0x73da('0x71')],{'as':'Queue','foreignKey':_0x73da('0x199'),'onDelete':_0x73da('0x16a')});db[_0x73da('0x6b')]['belongsTo'](db['ChatWebsite'],{'as':_0x73da('0x19a'),'foreignKey':_0x73da('0x17e'),'onDelete':'restrict'});db[_0x73da('0x6b')][_0x73da('0x157')](db['Tag'],{'onDelete':_0x73da('0x16a'),'foreignKey':'TagId'});db[_0x73da('0x6d')][_0x73da('0x11a')](db[_0x73da('0x6f')],{'as':_0x73da('0x15f'),'onDelete':'cascade','foreignKey':_0x73da('0x19b')});db[_0x73da('0x6d')]['belongsTo'](db[_0x73da('0x68')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x73da('0x6d')][_0x73da('0x157')](db[_0x73da('0x130')],{'as':_0x73da('0x165'),'foreignKey':_0x73da('0x166')});db[_0x73da('0x6d')][_0x73da('0x157')](db[_0x73da('0x13')],{'as':_0x73da('0x177'),'foreignKey':'UserId'});db['ChatInteraction'][_0x73da('0x12d')](db[_0x73da('0x92')],{'through':_0x73da('0x19c'),'as':_0x73da('0x178')});db[_0x73da('0x6d')][_0x73da('0x12d')](db[_0x73da('0x92')],{'through':_0x73da('0x19c'),'as':_0x73da('0x17a')});db['ChatInteraction'][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':'Users','through':'user_has_chat_interactions','foreignKey':_0x73da('0x19b')});db[_0x73da('0x6f')][_0x73da('0x157')](db[_0x73da('0x13')],{'onDelete':_0x73da('0x118'),'as':'User'});db[_0x73da('0x6f')][_0x73da('0x157')](db[_0x73da('0x130')],{'onDelete':_0x73da('0x118'),'as':_0x73da('0x165'),'foreignKey':_0x73da('0x166')});db['ChatMessage'][_0x73da('0x157')](db[_0x73da('0x6d')],{'onDelete':_0x73da('0x118'),'as':'Interaction','foreignKey':_0x73da('0x19b')});db['ChatMessage'][_0x73da('0x157')](db['Attachment'],{'as':_0x73da('0xf3'),'foreignKey':_0x73da('0x189')});db[_0x73da('0x6f')]['belongsTo'](db['ChatWebsite'],{'as':_0x73da('0x176'),'foreignKey':_0x73da('0x17e')});db[_0x73da('0x17f')][_0x73da('0x11a')](db[_0x73da('0xf3')],{'as':_0x73da('0x17c'),'foreignKey':'ChatOfflineMessageId','onDelete':_0x73da('0x118'),'hooks':!![]});db[_0x73da('0x17f')][_0x73da('0x157')](db[_0x73da('0x130')],{'onDelete':_0x73da('0x118'),'as':_0x73da('0x165'),'foreignKey':_0x73da('0x166')});db['ChatOfflineMessage'][_0x73da('0x157')](db[_0x73da('0x68')],{'as':'Account','foreignKey':_0x73da('0x17e')});db['ChatQueue'][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':_0x73da('0x173'),'through':_0x73da('0x34'),'hooks':!![]});db[_0x73da('0x71')]['belongsToMany'](db[_0x73da('0xeb')],{'through':'team_has_chat_queues','as':_0x73da('0x15d')});db[_0x73da('0x73')][_0x73da('0x11a')](db[_0x73da('0xd9')],{'as':_0x73da('0x15f'),'foreignKey':'ChatGroupId','onDelete':_0x73da('0x118')});db[_0x73da('0x73')][_0x73da('0x12d')](db['User'],{'as':_0x73da('0x153'),'through':_0x73da('0x12f')});db['ChatProactiveAction']['belongsTo'](db[_0x73da('0x68')],{'as':_0x73da('0x19a'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x73da('0x11a')](db['CmContact'],{'as':'Contacts','foreignKey':_0x73da('0x19d')});db['CmContact'][_0x73da('0x11a')](db['CmContactHasItem'],{'as':_0x73da('0x19e'),'foreignKey':_0x73da('0x19f')});db[_0x73da('0x130')]['hasMany'](db[_0x73da('0x78')],{'as':_0x73da('0x12a'),'foreignKey':_0x73da('0x166')});db[_0x73da('0x130')][_0x73da('0x11a')](db[_0x73da('0x7b')],{'as':'HopperFinals','foreignKey':_0x73da('0x166')});db[_0x73da('0x130')][_0x73da('0x11a')](db[_0x73da('0x11f')],{'as':_0x73da('0x155'),'foreignKey':'ContactId'});db[_0x73da('0x130')][_0x73da('0x11a')](db[_0x73da('0x7d')],{'as':_0x73da('0x7d'),'foreignKey':_0x73da('0x166')});db[_0x73da('0x130')][_0x73da('0x11a')](db[_0x73da('0xdc')],{'as':_0x73da('0x1a0'),'foreignKey':'ContactId'});db[_0x73da('0x130')][_0x73da('0x11a')](db[_0x73da('0x63')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x73da('0x16a')});db['CmContact'][_0x73da('0x11a')](db['ChatInteraction'],{'as':_0x73da('0x1a1'),'foreignKey':_0x73da('0x166'),'onDelete':_0x73da('0x16a')});db[_0x73da('0x130')][_0x73da('0x11a')](db[_0x73da('0x5a')],{'as':_0x73da('0x122'),'foreignKey':_0x73da('0x166'),'onDelete':_0x73da('0x16a')});db[_0x73da('0x130')][_0x73da('0x11a')](db[_0x73da('0x123')],{'as':'FaxInteractions','foreignKey':_0x73da('0x166'),'onDelete':_0x73da('0x16a')});db[_0x73da('0x130')][_0x73da('0x11a')](db[_0x73da('0x45')],{'as':_0x73da('0x125'),'foreignKey':_0x73da('0x166'),'onDelete':_0x73da('0x16a')});db[_0x73da('0x130')][_0x73da('0x157')](db['CmCompany'],{'as':_0x73da('0x1a2'),'foreignKey':'CompanyId'});db[_0x73da('0x130')][_0x73da('0x157')](db[_0x73da('0xfd')],{'as':'List','foreignKey':_0x73da('0x171'),'onDelete':_0x73da('0x118')});db[_0x73da('0x130')][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':'Users','through':_0x73da('0x132')});db[_0x73da('0x130')]['belongsToMany'](db['Tag'],{'as':_0x73da('0x178'),'through':_0x73da('0x1a3')});db['CmContact'][_0x73da('0x12d')](db[_0x73da('0x92')],{'through':'cm_contact_has_tags','as':_0x73da('0x17a')});db[_0x73da('0x78')][_0x73da('0x11a')](db['CmHopperAdditionalPhone'],{'as':_0x73da('0x1a4'),'foreignKey':'CmHopperId'});db[_0x73da('0x78')][_0x73da('0x157')](db['CmContact'],{'as':_0x73da('0x165'),'foreignKey':_0x73da('0x166'),'onDelete':_0x73da('0x118')});db[_0x73da('0x78')]['belongsTo'](db[_0x73da('0xfd')],{'as':_0x73da('0x170'),'foreignKey':_0x73da('0x171'),'onDelete':_0x73da('0x118')});db['CmHopper'][_0x73da('0x157')](db['User'],{'as':_0x73da('0x198'),'foreignKey':_0x73da('0x119')});db[_0x73da('0x78')]['belongsTo'](db[_0x73da('0x1d')],{'as':'Queue','foreignKey':_0x73da('0x154'),'onDelete':_0x73da('0x118')});db['CmHopper']['belongsTo'](db[_0x73da('0xef')],{'as':_0x73da('0xef'),'foreignKey':'CampaignId','onDelete':_0x73da('0x118')});db['CmHopper'][_0x73da('0x157')](db[_0x73da('0x13')],{'as':_0x73da('0x177'),'foreignKey':_0x73da('0x1a5')});db['CmHopperBlack'][_0x73da('0x157')](db['CmContact'],{'as':'Contact','foreignKey':_0x73da('0x166'),'onDelete':_0x73da('0x118')});db['CmHopperBlack'][_0x73da('0x157')](db[_0x73da('0xfd')],{'as':'List','foreignKey':_0x73da('0x171'),'onDelete':_0x73da('0x118')});db[_0x73da('0x1a6')][_0x73da('0x157')](db[_0x73da('0x1d')],{'as':_0x73da('0x1a7'),'foreignKey':_0x73da('0x154'),'onDelete':_0x73da('0x118')});db[_0x73da('0x1a6')][_0x73da('0x157')](db[_0x73da('0xef')],{'as':_0x73da('0xef'),'foreignKey':_0x73da('0x1a8'),'onDelete':'cascade'});db['Automation'][_0x73da('0x11a')](db[_0x73da('0x1a9')],{'as':{'plural':_0x73da('0x1aa'),'singular':'OneAll'},'foreignKey':_0x73da('0x1ab'),'onDelete':'cascade','hooks':!![]});db[_0x73da('0x82')][_0x73da('0x11a')](db[_0x73da('0x1a9')],{'as':{'plural':_0x73da('0x1ac'),'singular':_0x73da('0x1ad')},'foreignKey':'AutomationAnyId','onDelete':_0x73da('0x118'),'hooks':!![]});db[_0x73da('0x82')][_0x73da('0x11a')](db[_0x73da('0x80')],{'as':_0x73da('0x1ae'),'foreignKey':_0x73da('0x1af'),'onDelete':'cascade','hooks':!![]});db['Disposition'][_0x73da('0x11a')](db['Disposition'],{'as':_0x73da('0x16d'),'foreignKey':_0x73da('0x1b0'),'onDelete':_0x73da('0x118')});db['Interval'][_0x73da('0x11a')](db[_0x73da('0x88')],{'as':_0x73da('0x1b1'),'foreignKey':'IntervalId','onDelete':_0x73da('0x118'),'hooks':!![],'required':![]});db['Interval']['hasMany'](db[_0x73da('0x19')],{'as':'Extensions','foreignKey':_0x73da('0x15a'),'onDelete':'restrict'});db[_0x73da('0x88')]['hasMany'](db['MailApplication'],{'as':_0x73da('0x1b2'),'foreignKey':_0x73da('0x15a')});db['Interval'][_0x73da('0x11a')](db[_0x73da('0x6b')],{'as':_0x73da('0x1b3'),'foreignKey':_0x73da('0x15a')});db['Interval'][_0x73da('0x11a')](db[_0x73da('0x4f')],{'as':'FaxApplications','foreignKey':_0x73da('0x15a')});db['Interval'][_0x73da('0x11a')](db[_0x73da('0x18c')],{'as':'SmsApplications','foreignKey':'IntervalId'});db[_0x73da('0x8f')][_0x73da('0x157')](db[_0x73da('0x3f')],{});db['Schedule'][_0x73da('0x157')](db['AnalyticDefaultReport'],{'foreignKey':_0x73da('0x1b4')});db['Schedule']['belongsTo'](db[_0x73da('0xa0')],{'foreignKey':_0x73da('0x1b5')});db[_0x73da('0x90')][_0x73da('0x12d')](db[_0x73da('0x1b')],{'as':'Mohs','through':_0x73da('0x152'),'onDelete':_0x73da('0x16a')});db['Tag'][_0x73da('0x12d')](db[_0x73da('0x130')],{'through':_0x73da('0x1a3')});db[_0x73da('0x92')]['belongsToMany'](db[_0x73da('0x6d')],{'through':_0x73da('0x19c')});db[_0x73da('0x92')][_0x73da('0x12d')](db[_0x73da('0x45')],{'through':_0x73da('0x179')});db[_0x73da('0x92')]['belongsToMany'](db[_0x73da('0x5a')],{'through':_0x73da('0x18d')});db[_0x73da('0x92')]['belongsToMany'](db[_0x73da('0x123')],{'through':_0x73da('0x187')});db[_0x73da('0x92')][_0x73da('0x12d')](db[_0x73da('0x63')],{'through':'openchannel_interaction_has_tags'});db[_0x73da('0x92')]['belongsToMany'](db['WhatsappInteraction'],{'through':_0x73da('0x1b6')});db[_0x73da('0x96')][_0x73da('0x157')](db[_0x73da('0x94')],{'as':_0x73da('0x1b7'),'foreignKey':_0x73da('0x1b8')});db['CmHopperAdditionalPhone'][_0x73da('0x157')](db[_0x73da('0x78')],{'as':'Hopper','foreignKey':_0x73da('0x1b9')});db[_0x73da('0x96')]['belongsTo'](db[_0x73da('0x130')],{'as':_0x73da('0x165'),'foreignKey':_0x73da('0x19f')});db[_0x73da('0x9b')]['hasMany'](db[_0x73da('0x1a9')],{'as':{'plural':_0x73da('0x1ba'),'singular':'AllCondition'},'foreignKey':'TriggerAllId','onDelete':_0x73da('0x118'),'hooks':!![]});db[_0x73da('0x9b')]['hasMany'](db[_0x73da('0x1a9')],{'as':{'plural':_0x73da('0x1bb'),'singular':_0x73da('0x1bc')},'foreignKey':'TriggerAnyId','onDelete':_0x73da('0x118'),'hooks':!![]});db[_0x73da('0x9b')]['hasMany'](db['Action'],{'as':_0x73da('0x1ae'),'foreignKey':'TriggerId','onDelete':_0x73da('0x118'),'hooks':!![]});db['AnalyticCustomReport'][_0x73da('0x11a')](db['AnalyticFieldReport'],{'as':_0x73da('0x1bd'),'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1b5'),'hooks':!![]});db[_0x73da('0xa2')][_0x73da('0x11a')](db[_0x73da('0x1be')],{'as':_0x73da('0x1bd'),'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1b4')});db[_0x73da('0xa5')][_0x73da('0x11a')](db[_0x73da('0x1be')],{'as':_0x73da('0x1bd'),'onDelete':'cascade','foreignKey':_0x73da('0x1bf')});db[_0x73da('0x1be')][_0x73da('0x157')](db[_0x73da('0xa5')],{'foreignKey':_0x73da('0x1bf')});db[_0x73da('0xa9')][_0x73da('0x11a')](db[_0x73da('0xab')],{'as':_0x73da('0x1c0'),'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1c1')});db['SalesforceConfiguration']['hasMany'](db['SalesforceField'],{'as':_0x73da('0x1c2'),'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1c3')});db['SalesforceConfiguration'][_0x73da('0x11a')](db[_0x73da('0x1c4')],{'as':_0x73da('0x1c5'),'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1c6')});db['SalesforceConfiguration'][_0x73da('0x11a')](db[_0x73da('0x1c4')],{'as':_0x73da('0x1bd'),'onDelete':_0x73da('0x118'),'foreignKey':'FieldId'});db[_0x73da('0xab')][_0x73da('0x157')](db[_0x73da('0xa9')],{'as':'Account','foreignKey':'AccountId'});db[_0x73da('0x1c4')]['hasMany'](db[_0x73da('0x1c4')],{'as':_0x73da('0x1c7'),'foreignKey':_0x73da('0x1c3')});db['SalesforceField'][_0x73da('0x11a')](db[_0x73da('0x1c4')],{'as':_0x73da('0x1c8'),'foreignKey':_0x73da('0x1c6')});db['SalesforceField'][_0x73da('0x11a')](db[_0x73da('0x1c4')],{'as':_0x73da('0x1c9'),'foreignKey':_0x73da('0x1ca')});db[_0x73da('0x1c4')][_0x73da('0x157')](db[_0x73da('0x1cb')],{'as':'Variable','foreignKey':_0x73da('0x1cc')});db[_0x73da('0x1cd')][_0x73da('0x11a')](db['SugarcrmConfiguration'],{'as':_0x73da('0x1c0'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x73da('0xae')][_0x73da('0x11a')](db[_0x73da('0xb0')],{'as':_0x73da('0x1c2'),'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1c3')});db[_0x73da('0xae')][_0x73da('0x11a')](db[_0x73da('0xb0')],{'as':'Descriptions','onDelete':_0x73da('0x118'),'foreignKey':'DescriptionId'});db[_0x73da('0xae')][_0x73da('0x11a')](db[_0x73da('0xb0')],{'as':_0x73da('0x1bd'),'onDelete':'cascade','foreignKey':_0x73da('0x1ca')});db[_0x73da('0xae')][_0x73da('0x157')](db[_0x73da('0x1cd')],{'as':_0x73da('0x176'),'foreignKey':_0x73da('0x1c1')});db[_0x73da('0xb0')][_0x73da('0x11a')](db[_0x73da('0xb0')],{'as':_0x73da('0x1c7'),'foreignKey':_0x73da('0x1c3')});db['SugarcrmField'][_0x73da('0x11a')](db[_0x73da('0xb0')],{'as':'Description','foreignKey':_0x73da('0x1c6')});db[_0x73da('0xb0')]['hasMany'](db['SugarcrmField'],{'as':_0x73da('0x1c9'),'foreignKey':_0x73da('0x1ca')});db[_0x73da('0xb0')]['belongsTo'](db[_0x73da('0x1cb')],{'as':_0x73da('0x1cb'),'foreignKey':_0x73da('0x1cc')});db[_0x73da('0xb2')]['hasMany'](db[_0x73da('0xb4')],{'as':_0x73da('0x1c0'),'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1c1')});db[_0x73da('0xb4')]['hasMany'](db[_0x73da('0xb6')],{'as':_0x73da('0x1c2'),'onDelete':_0x73da('0x118'),'foreignKey':'SubjectId'});db[_0x73da('0xb4')][_0x73da('0x11a')](db[_0x73da('0xb6')],{'as':_0x73da('0x1c5'),'onDelete':_0x73da('0x118'),'foreignKey':'DescriptionId'});db[_0x73da('0xb4')][_0x73da('0x11a')](db[_0x73da('0xb6')],{'as':_0x73da('0x1bd'),'onDelete':'cascade','foreignKey':'FieldId'});db['DeskConfiguration']['belongsTo'](db['DeskAccount'],{'as':_0x73da('0x176'),'foreignKey':_0x73da('0x1c1')});db['DeskConfiguration'][_0x73da('0x12d')](db[_0x73da('0x92')],{'through':_0x73da('0x1ce')});db[_0x73da('0xb6')][_0x73da('0x11a')](db[_0x73da('0xb6')],{'as':_0x73da('0x1c7'),'foreignKey':_0x73da('0x1c3')});db[_0x73da('0xb6')][_0x73da('0x11a')](db[_0x73da('0xb6')],{'as':_0x73da('0x1c8'),'foreignKey':_0x73da('0x1c6')});db[_0x73da('0xb6')]['hasMany'](db['DeskField'],{'as':'Field','foreignKey':_0x73da('0x1ca')});db[_0x73da('0xb6')][_0x73da('0x157')](db[_0x73da('0x1cb')],{'as':_0x73da('0x1cb'),'foreignKey':_0x73da('0x1cc')});db['ZohoAccount'][_0x73da('0x11a')](db[_0x73da('0x1cf')],{'as':'Configurations','onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1c1')});db[_0x73da('0x1cf')][_0x73da('0x11a')](db[_0x73da('0x1d0')],{'as':_0x73da('0x1c2'),'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1c3')});db['ZohoConfiguration'][_0x73da('0x11a')](db[_0x73da('0x1d0')],{'as':_0x73da('0x1c5'),'onDelete':_0x73da('0x118'),'foreignKey':'DescriptionId'});db[_0x73da('0x1cf')]['hasMany'](db[_0x73da('0x1d0')],{'as':_0x73da('0x1bd'),'onDelete':_0x73da('0x118'),'foreignKey':'FieldId'});db[_0x73da('0x1cf')][_0x73da('0x157')](db[_0x73da('0xb7')],{'as':_0x73da('0x176'),'foreignKey':_0x73da('0x1c1')});db[_0x73da('0x1d0')]['hasMany'](db[_0x73da('0x1d0')],{'as':_0x73da('0x1c7'),'foreignKey':_0x73da('0x1c3')});db[_0x73da('0x1d0')][_0x73da('0x11a')](db['ZohoField'],{'as':_0x73da('0x1c8'),'foreignKey':'DescriptionId'});db['ZohoField']['hasMany'](db[_0x73da('0x1d0')],{'as':_0x73da('0x1c9'),'foreignKey':_0x73da('0x1ca')});db[_0x73da('0x1d0')][_0x73da('0x157')](db['Variable'],{'as':'Variable','foreignKey':_0x73da('0x1cc')});db['ZendeskAccount'][_0x73da('0x11a')](db[_0x73da('0xbd')],{'as':_0x73da('0x1c0'),'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1c1')});db[_0x73da('0xbd')][_0x73da('0x11a')](db[_0x73da('0xbe')],{'as':'Subjects','foreignKey':_0x73da('0x1c3')});db[_0x73da('0xbd')]['hasMany'](db['ZendeskField'],{'as':'Descriptions','foreignKey':_0x73da('0x1c6')});db['ZendeskConfiguration'][_0x73da('0x11a')](db[_0x73da('0xbe')],{'as':_0x73da('0x1bd'),'foreignKey':'FieldId'});db['ZendeskConfiguration']['belongsTo'](db['ZendeskAccount'],{'as':_0x73da('0x176'),'foreignKey':_0x73da('0x1c1')});db[_0x73da('0xbd')][_0x73da('0x12d')](db[_0x73da('0x92')],{'through':_0x73da('0x1d1')});db['ZendeskField']['hasMany'](db[_0x73da('0xbe')],{'as':_0x73da('0x1c7'),'foreignKey':_0x73da('0x1c3')});db[_0x73da('0xbe')]['hasMany'](db[_0x73da('0xbe')],{'as':_0x73da('0x1c8'),'foreignKey':'DescriptionId'});db[_0x73da('0xbe')][_0x73da('0x11a')](db[_0x73da('0xbe')],{'as':_0x73da('0x1c9'),'foreignKey':_0x73da('0x1ca')});db[_0x73da('0xbe')][_0x73da('0x157')](db[_0x73da('0x1cb')],{'as':_0x73da('0x1cb'),'foreignKey':_0x73da('0x1cc')});db[_0x73da('0x1d2')]['hasMany'](db['FreshdeskConfiguration'],{'as':_0x73da('0x1c0'),'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1c1')});db[_0x73da('0xc0')][_0x73da('0x11a')](db[_0x73da('0xc2')],{'as':_0x73da('0x1c2'),'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1c3')});db[_0x73da('0xc0')]['hasMany'](db[_0x73da('0xc2')],{'as':_0x73da('0x1c5'),'onDelete':'cascade','foreignKey':_0x73da('0x1c6')});db[_0x73da('0xc0')][_0x73da('0x11a')](db[_0x73da('0xc2')],{'as':_0x73da('0x1bd'),'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1ca')});db['FreshdeskConfiguration'][_0x73da('0x157')](db[_0x73da('0x1d2')],{'as':_0x73da('0x176'),'foreignKey':_0x73da('0x1c1')});db[_0x73da('0xc0')][_0x73da('0x12d')](db[_0x73da('0x92')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x73da('0xc2')][_0x73da('0x11a')](db[_0x73da('0xc2')],{'as':'Subject','foreignKey':_0x73da('0x1c3')});db[_0x73da('0xc2')][_0x73da('0x11a')](db[_0x73da('0xc2')],{'as':_0x73da('0x1c8'),'foreignKey':_0x73da('0x1c6')});db[_0x73da('0xc2')][_0x73da('0x11a')](db[_0x73da('0xc2')],{'as':_0x73da('0x1c9'),'foreignKey':_0x73da('0x1ca')});db[_0x73da('0xc2')][_0x73da('0x157')](db[_0x73da('0x1cb')],{'as':'Variable','foreignKey':'VariableId'});db[_0x73da('0x1d3')]['hasMany'](db['VtigerConfiguration'],{'as':'Configurations','onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1c1')});db[_0x73da('0xc4')]['hasMany'](db['VtigerField'],{'as':_0x73da('0x1c2'),'foreignKey':'SubjectId'});db[_0x73da('0xc4')][_0x73da('0x11a')](db[_0x73da('0x1d4')],{'as':_0x73da('0x1c5'),'foreignKey':_0x73da('0x1c6')});db[_0x73da('0xc4')][_0x73da('0x11a')](db[_0x73da('0x1d4')],{'as':_0x73da('0x1bd'),'foreignKey':_0x73da('0x1ca')});db[_0x73da('0xc4')][_0x73da('0x157')](db[_0x73da('0x1d3')],{'as':_0x73da('0x176'),'foreignKey':'AccountId'});db[_0x73da('0x1d4')][_0x73da('0x11a')](db['VtigerField'],{'as':_0x73da('0x1c7'),'foreignKey':'SubjectId'});db[_0x73da('0x1d4')][_0x73da('0x11a')](db[_0x73da('0x1d4')],{'as':'Description','foreignKey':_0x73da('0x1c6')});db[_0x73da('0x1d4')][_0x73da('0x11a')](db[_0x73da('0x1d4')],{'as':_0x73da('0x1c9'),'foreignKey':'FieldId'});db[_0x73da('0x1d4')][_0x73da('0x157')](db['Variable'],{'as':_0x73da('0x1cb'),'foreignKey':_0x73da('0x1cc')});db['ServicenowAccount']['hasMany'](db[_0x73da('0x1d5')],{'as':_0x73da('0x1c0'),'onDelete':'cascade','foreignKey':_0x73da('0x1c1')});db[_0x73da('0x1d5')][_0x73da('0x11a')](db[_0x73da('0xca')],{'as':'Subjects','foreignKey':_0x73da('0x1c3')});db[_0x73da('0x1d5')][_0x73da('0x11a')](db['ServicenowField'],{'as':_0x73da('0x1c5'),'foreignKey':_0x73da('0x1c6')});db['ServicenowConfiguration'][_0x73da('0x11a')](db[_0x73da('0xca')],{'as':_0x73da('0x1bd'),'foreignKey':_0x73da('0x1ca')});db['ServicenowConfiguration'][_0x73da('0x157')](db[_0x73da('0xc7')],{'as':_0x73da('0x176'),'foreignKey':_0x73da('0x1c1')});db[_0x73da('0xca')][_0x73da('0x11a')](db[_0x73da('0xca')],{'as':_0x73da('0x1c7'),'foreignKey':_0x73da('0x1c3')});db[_0x73da('0xca')][_0x73da('0x11a')](db[_0x73da('0xca')],{'as':_0x73da('0x1c8'),'foreignKey':_0x73da('0x1c6')});db['ServicenowField'][_0x73da('0x11a')](db[_0x73da('0xca')],{'as':_0x73da('0x1c9'),'foreignKey':_0x73da('0x1ca')});db[_0x73da('0xca')]['belongsTo'](db[_0x73da('0x1cb')],{'as':_0x73da('0x1cb'),'foreignKey':_0x73da('0x1cc')});db['Dynamics365Account']['hasMany'](db[_0x73da('0xcd')],{'as':_0x73da('0x1c0'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x73da('0x1d6')]['belongsTo'](db[_0x73da('0x10e')],{'as':_0x73da('0x10e'),'foreignKey':_0x73da('0x169')});db[_0x73da('0xcd')][_0x73da('0x11a')](db[_0x73da('0xcf')],{'as':_0x73da('0x1c2'),'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1c3')});db['Dynamics365Configuration']['hasMany'](db[_0x73da('0xcf')],{'as':_0x73da('0x1c5'),'onDelete':'cascade','foreignKey':_0x73da('0x1c6')});db['Dynamics365Configuration'][_0x73da('0x11a')](db['Dynamics365Field'],{'as':'Fields','onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1ca')});db[_0x73da('0xcd')][_0x73da('0x157')](db[_0x73da('0x1d6')],{'as':_0x73da('0x176'),'foreignKey':_0x73da('0x1c1')});db[_0x73da('0xcf')][_0x73da('0x11a')](db['Dynamics365Field'],{'as':_0x73da('0x1c7'),'foreignKey':_0x73da('0x1c3')});db[_0x73da('0xcf')][_0x73da('0x11a')](db[_0x73da('0xcf')],{'as':_0x73da('0x1c8'),'foreignKey':_0x73da('0x1c6')});db[_0x73da('0xcf')][_0x73da('0x11a')](db[_0x73da('0xcf')],{'as':_0x73da('0x1c9'),'foreignKey':_0x73da('0x1ca')});db[_0x73da('0xcf')][_0x73da('0x157')](db[_0x73da('0x1cb')],{'as':_0x73da('0x1cb'),'foreignKey':_0x73da('0x1cc')});db[_0x73da('0xd1')][_0x73da('0x11a')](db[_0x73da('0x1d7')],{'as':'Configurations','onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1c1')});db[_0x73da('0x1d7')][_0x73da('0x11a')](db[_0x73da('0xd4')],{'as':'Subjects','foreignKey':_0x73da('0x1c3')});db['FreshsalesConfiguration'][_0x73da('0x11a')](db[_0x73da('0xd4')],{'as':_0x73da('0x1c5'),'foreignKey':_0x73da('0x1c6')});db['FreshsalesConfiguration'][_0x73da('0x11a')](db[_0x73da('0xd4')],{'as':_0x73da('0x1bd'),'foreignKey':_0x73da('0x1ca')});db[_0x73da('0x1d7')]['belongsTo'](db[_0x73da('0xd1')],{'as':_0x73da('0x176'),'foreignKey':_0x73da('0x1c1')});db[_0x73da('0xd4')][_0x73da('0x11a')](db[_0x73da('0xd4')],{'as':_0x73da('0x1c7'),'foreignKey':'SubjectId'});db[_0x73da('0xd4')][_0x73da('0x11a')](db[_0x73da('0xd4')],{'as':_0x73da('0x1c8'),'foreignKey':_0x73da('0x1c6')});db[_0x73da('0xd4')]['hasMany'](db[_0x73da('0xd4')],{'as':'Field','foreignKey':_0x73da('0x1ca')});db[_0x73da('0xd4')]['belongsTo'](db[_0x73da('0x1cb')],{'as':_0x73da('0x1cb'),'foreignKey':_0x73da('0x1cc')});db[_0x73da('0x1d8')]['belongsTo'](db[_0x73da('0x68')],{});db[_0x73da('0x1d8')]['belongsTo'](db[_0x73da('0xfd')],{'as':'List','foreignKey':'ListId'});db[_0x73da('0x1d8')][_0x73da('0x157')](db[_0x73da('0x130')],{'as':_0x73da('0x165'),'foreignKey':_0x73da('0x166')});db[_0x73da('0x1d8')][_0x73da('0x157')](db['ChatInteraction'],{});db['ChatQueueReport']['belongsTo'](db['ChatMessage'],{});db['ChatQueueReport'][_0x73da('0x157')](db[_0x73da('0x13')],{});db['ChatQueueReport']['belongsTo'](db[_0x73da('0x71')],{});db[_0x73da('0xd9')][_0x73da('0x157')](db[_0x73da('0x13')],{'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1d9')});db[_0x73da('0xd9')][_0x73da('0x157')](db[_0x73da('0x13')],{'onDelete':_0x73da('0x118'),'foreignKey':'ToId'});db[_0x73da('0xdc')][_0x73da('0x11a')](db[_0x73da('0xda')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x73da('0xdc')][_0x73da('0x11a')](db[_0x73da('0x1da')],{'foreignKey':'SessionId','onDelete':_0x73da('0x118')});db[_0x73da('0xde')][_0x73da('0x157')](db['SmsAccount'],{});db[_0x73da('0xde')][_0x73da('0x157')](db['CmList'],{'as':_0x73da('0x170'),'foreignKey':'ListId'});db['SmsQueueReport']['belongsTo'](db[_0x73da('0x130')],{'as':_0x73da('0x165'),'foreignKey':_0x73da('0x166')});db[_0x73da('0xde')]['belongsTo'](db[_0x73da('0x5a')],{});db[_0x73da('0xde')][_0x73da('0x157')](db[_0x73da('0x18b')],{});db['SmsQueueReport'][_0x73da('0x157')](db[_0x73da('0x13')],{});db[_0x73da('0xde')][_0x73da('0x157')](db['SmsQueue'],{});db[_0x73da('0xe2')]['hasMany'](db['JscriptySessionReport'],{'foreignKey':_0x73da('0x1db')});db[_0x73da('0xe2')][_0x73da('0x11a')](db[_0x73da('0xda')],{'foreignKey':_0x73da('0x1db')});db['JscriptyProject'][_0x73da('0x11a')](db['JscriptyAnswerReport'],{'foreignKey':_0x73da('0x1db')});db[_0x73da('0xeb')][_0x73da('0x12d')](db['User'],{'as':_0x73da('0x173'),'through':_0x73da('0x135')});db[_0x73da('0xeb')]['belongsToMany'](db[_0x73da('0x1d')],{'through':_0x73da('0x1dc'),'as':_0x73da('0x13c')});db[_0x73da('0xeb')]['belongsToMany'](db[_0x73da('0x41')],{'through':_0x73da('0x174'),'as':_0x73da('0x13f')});db[_0x73da('0xeb')]['belongsToMany'](db['ChatQueue'],{'through':_0x73da('0x1dd'),'as':_0x73da('0x140')});db['Team'][_0x73da('0x12d')](db[_0x73da('0x54')],{'through':_0x73da('0x1de'),'as':_0x73da('0x141')});db[_0x73da('0xeb')][_0x73da('0x12d')](db['SmsQueue'],{'through':_0x73da('0x191'),'as':_0x73da('0x142')});db[_0x73da('0xeb')]['belongsToMany'](db[_0x73da('0x67')],{'through':'team_has_openchannel_queues','as':_0x73da('0x143')});db[_0x73da('0xeb')][_0x73da('0x12d')](db[_0x73da('0x10c')],{'through':_0x73da('0x1df'),'as':_0x73da('0x1e0')});db[_0x73da('0xeb')][_0x73da('0x12d')](db[_0x73da('0x1e1')],{'through':_0x73da('0x1e2'),'as':_0x73da('0x13e')});db[_0x73da('0xef')][_0x73da('0x11a')](db[_0x73da('0x78')],{'as':_0x73da('0x12a'),'foreignKey':_0x73da('0x1a8')});db[_0x73da('0xef')][_0x73da('0x11a')](db['CmHopperFinal'],{'as':_0x73da('0x11e'),'foreignKey':_0x73da('0x1a8')});db[_0x73da('0xef')]['hasMany'](db[_0x73da('0x11f')],{'as':_0x73da('0x155'),'foreignKey':_0x73da('0x1a8')});db[_0x73da('0xef')][_0x73da('0x11a')](db[_0x73da('0x1a6')],{'as':_0x73da('0x156'),'foreignKey':_0x73da('0x1a8')});db[_0x73da('0xef')][_0x73da('0x157')](db[_0x73da('0x2d')],{'as':'Trunk','foreignKey':_0x73da('0x158')});db['Campaign'][_0x73da('0x157')](db[_0x73da('0x2d')],{'as':_0x73da('0x1e3'),'foreignKey':'TrunkBackupId'});db[_0x73da('0xef')][_0x73da('0x157')](db[_0x73da('0x88')],{'as':_0x73da('0x88'),'foreignKey':_0x73da('0x15a')});db[_0x73da('0xef')]['belongsTo'](db[_0x73da('0xe5')],{'as':_0x73da('0xe5'),'foreignKey':_0x73da('0x1e4')});db[_0x73da('0xef')][_0x73da('0x12d')](db[_0x73da('0xfd')],{'as':_0x73da('0x133'),'through':_0x73da('0x1e5')});db[_0x73da('0xef')][_0x73da('0x12d')](db[_0x73da('0xfd')],{'as':_0x73da('0x1e6'),'through':_0x73da('0x1e7')});db['Attachment'][_0x73da('0x157')](db[_0x73da('0x17f')],{'as':_0x73da('0x17f'),'foreignKey':_0x73da('0x180')});db[_0x73da('0x1e8')]['belongsTo'](db[_0x73da('0x47')],{});db[_0x73da('0x1e8')][_0x73da('0x157')](db[_0x73da('0x45')],{});db[_0x73da('0x1e8')]['belongsTo'](db[_0x73da('0x3f')],{'foreignKey':_0x73da('0x1e9'),'as':_0x73da('0x1ea')});db[_0x73da('0x1e8')][_0x73da('0x157')](db[_0x73da('0x13')],{'foreignKey':_0x73da('0x1eb'),'as':_0x73da('0x1ec')});db[_0x73da('0x1e8')][_0x73da('0x157')](db[_0x73da('0x13')],{'foreignKey':_0x73da('0x1ed'),'as':'ToAgent'});db[_0x73da('0x1e8')]['belongsTo'](db[_0x73da('0x41')],{'foreignKey':_0x73da('0x1ee'),'as':_0x73da('0x1ef')});db['MailTransferReport'][_0x73da('0x157')](db[_0x73da('0x3f')],{'foreignKey':'ToMailAccountId','as':_0x73da('0x1f0')});db[_0x73da('0x1f1')][_0x73da('0x157')](db[_0x73da('0x6f')],{});db['ChatTransferReport'][_0x73da('0x157')](db['ChatInteraction'],{});db[_0x73da('0x1f1')][_0x73da('0x157')](db[_0x73da('0x68')],{'foreignKey':_0x73da('0x1f2'),'as':_0x73da('0x1ea')});db[_0x73da('0x1f1')][_0x73da('0x157')](db[_0x73da('0x13')],{'foreignKey':_0x73da('0x1eb'),'as':_0x73da('0x1ec')});db[_0x73da('0x1f1')][_0x73da('0x157')](db[_0x73da('0x13')],{'foreignKey':_0x73da('0x1ed'),'as':_0x73da('0x1f3')});db[_0x73da('0x1f1')][_0x73da('0x157')](db[_0x73da('0x71')],{'foreignKey':_0x73da('0x1f4'),'as':'ToQueue'});db[_0x73da('0x1f1')][_0x73da('0x157')](db[_0x73da('0x68')],{'foreignKey':_0x73da('0x1f5'),'as':_0x73da('0x1f0')});db[_0x73da('0xf7')][_0x73da('0x157')](db[_0x73da('0x52')],{});db['FaxTransferReport'][_0x73da('0x157')](db['FaxInteraction'],{});db[_0x73da('0xf7')]['belongsTo'](db[_0x73da('0x146')],{'foreignKey':_0x73da('0x1f6'),'as':_0x73da('0x1ea')});db[_0x73da('0xf7')][_0x73da('0x157')](db[_0x73da('0x13')],{'foreignKey':_0x73da('0x1eb'),'as':'FromAgent'});db[_0x73da('0xf7')][_0x73da('0x157')](db[_0x73da('0x13')],{'foreignKey':_0x73da('0x1ed'),'as':_0x73da('0x1f3')});db['FaxTransferReport'][_0x73da('0x157')](db['FaxQueue'],{'foreignKey':_0x73da('0x1f7'),'as':_0x73da('0x1ef')});db[_0x73da('0xf7')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0x73da('0x1f8'),'as':_0x73da('0x1f0')});db[_0x73da('0xf9')][_0x73da('0x157')](db[_0x73da('0x65')],{});db[_0x73da('0xf9')][_0x73da('0x157')](db[_0x73da('0x63')],{});db[_0x73da('0xf9')]['belongsTo'](db[_0x73da('0x5f')],{'foreignKey':_0x73da('0x1f9'),'as':'FromAccount'});db['OpenchannelTransferReport'][_0x73da('0x157')](db[_0x73da('0x13')],{'foreignKey':_0x73da('0x1eb'),'as':_0x73da('0x1ec')});db[_0x73da('0xf9')][_0x73da('0x157')](db[_0x73da('0x13')],{'foreignKey':_0x73da('0x1ed'),'as':'ToAgent'});db[_0x73da('0xf9')][_0x73da('0x157')](db['OpenchannelQueue'],{'foreignKey':_0x73da('0x1fa'),'as':'ToQueue'});db[_0x73da('0xf9')][_0x73da('0x157')](db[_0x73da('0x5f')],{'foreignKey':_0x73da('0x1fb'),'as':_0x73da('0x1f0')});db[_0x73da('0xfb')][_0x73da('0x157')](db[_0x73da('0x18b')],{});db['SmsTransferReport'][_0x73da('0x157')](db[_0x73da('0x5a')],{});db[_0x73da('0xfb')][_0x73da('0x157')](db['SmsAccount'],{'foreignKey':_0x73da('0x1fc'),'as':_0x73da('0x1ea')});db[_0x73da('0xfb')][_0x73da('0x157')](db[_0x73da('0x13')],{'foreignKey':_0x73da('0x1eb'),'as':_0x73da('0x1ec')});db['SmsTransferReport'][_0x73da('0x157')](db[_0x73da('0x13')],{'foreignKey':'ToUserId','as':_0x73da('0x1f3')});db[_0x73da('0xfb')]['belongsTo'](db[_0x73da('0x5d')],{'foreignKey':_0x73da('0x1fd'),'as':'ToQueue'});db[_0x73da('0xfb')][_0x73da('0x157')](db['SmsAccount'],{'foreignKey':_0x73da('0x1fe'),'as':_0x73da('0x1f0')});db[_0x73da('0xfd')][_0x73da('0x11a')](db[_0x73da('0x86')],{'as':'Dispositions','foreignKey':'ListId','onDelete':'cascade'});db[_0x73da('0xfd')][_0x73da('0x11a')](db['CmCustomField'],{'as':'CustomFields','foreignKey':'ListId'});db[_0x73da('0xfd')][_0x73da('0x11a')](db['CmContact'],{'as':_0x73da('0x131'),'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x171')});db[_0x73da('0xfd')][_0x73da('0x11a')](db['CmHopperFinal'],{'as':_0x73da('0x11e'),'foreignKey':'ListId'});db['CmList'][_0x73da('0x11a')](db[_0x73da('0x11f')],{'as':_0x73da('0x120'),'foreignKey':_0x73da('0x171')});db['CmList'][_0x73da('0x11a')](db[_0x73da('0x7d')],{'as':_0x73da('0x7d'),'foreignKey':_0x73da('0x171')});db[_0x73da('0xfd')][_0x73da('0x12d')](db[_0x73da('0x1d')],{'as':_0x73da('0x1ff'),'through':_0x73da('0x200')});db['CmList']['belongsToMany'](db[_0x73da('0x13')],{'as':'Agents','through':_0x73da('0x134')});db[_0x73da('0x1e1')][_0x73da('0x11a')](db['VoiceExtension'],{'as':_0x73da('0x11d'),'onDelete':_0x73da('0x118')});db[_0x73da('0x1e1')][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':_0x73da('0x173'),'through':_0x73da('0x112')});db['VoicePrefix'][_0x73da('0x12d')](db['Team'],{'through':_0x73da('0x1e2'),'as':_0x73da('0x15d')});db[_0x73da('0xfe')][_0x73da('0x11a')](db['User'],{'as':_0x73da('0x17b'),'foreignKey':_0x73da('0x12c')});db['UserProfile'][_0x73da('0x11a')](db['UserProfileSection'],{'as':_0x73da('0x201'),'foreignKey':_0x73da('0x12c'),'onDelete':_0x73da('0x118')});db[_0x73da('0x100')][_0x73da('0x11a')](db[_0x73da('0x101')],{'as':'Resources','foreignKey':'sectionId','onDelete':_0x73da('0x118')});db[_0x73da('0x105')][_0x73da('0x11a')](db[_0x73da('0x86')],{'as':_0x73da('0x16d'),'foreignKey':_0x73da('0x202'),'onDelete':'cascade'});db['WhatsappAccount'][_0x73da('0x11a')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x73da('0x202')});db[_0x73da('0x105')]['hasMany'](db[_0x73da('0x108')],{'as':_0x73da('0x15f'),'foreignKey':_0x73da('0x202')});db['WhatsappAccount']['hasMany'](db[_0x73da('0x126')],{'as':_0x73da('0x16f')});db[_0x73da('0x105')][_0x73da('0x11a')](db['WhatsappApplication'],{'as':_0x73da('0x150'),'foreignKey':'WhatsappAccountId','onDelete':_0x73da('0x118')});db[_0x73da('0x105')][_0x73da('0x157')](db[_0x73da('0xfd')],{'as':_0x73da('0x170'),'foreignKey':_0x73da('0x171')});db[_0x73da('0x105')][_0x73da('0x157')](db[_0x73da('0x8a')],{'as':_0x73da('0x15b'),'foreignKey':_0x73da('0x15c')});db['WhatsappAccount'][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':_0x73da('0x173'),'through':_0x73da('0x14e')});db[_0x73da('0x203')][_0x73da('0x157')](db[_0x73da('0x13')],{'onDelete':_0x73da('0x16a')});db['WhatsappApplication'][_0x73da('0x157')](db[_0x73da('0x10c')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x73da('0x157')](db['WhatsappAccount'],{'onDelete':'restrict'});db['WhatsappApplication'][_0x73da('0x157')](db[_0x73da('0x88')],{'onDelete':'restrict','foreignKey':_0x73da('0x15a')});db[_0x73da('0x203')][_0x73da('0x157')](db[_0x73da('0x92')],{'onDelete':_0x73da('0x16a'),'foreignKey':_0x73da('0x181')});db[_0x73da('0x126')][_0x73da('0x11a')](db['WhatsappMessage'],{'as':_0x73da('0x15f'),'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x204')});db[_0x73da('0x126')][_0x73da('0x157')](db[_0x73da('0x105')],{'as':_0x73da('0x176'),'foreignKey':_0x73da('0x202')});db['WhatsappInteraction']['belongsTo'](db[_0x73da('0x130')],{'as':'Contact','foreignKey':_0x73da('0x166')});db['WhatsappInteraction'][_0x73da('0x157')](db[_0x73da('0x13')],{'as':'Owner','foreignKey':_0x73da('0x119')});db[_0x73da('0x126')][_0x73da('0x12d')](db[_0x73da('0x92')],{'through':_0x73da('0x1b6'),'as':_0x73da('0x178')});db['WhatsappInteraction'][_0x73da('0x12d')](db[_0x73da('0x92')],{'through':_0x73da('0x1b6'),'as':'ThroughTags'});db[_0x73da('0x126')][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':_0x73da('0x17b'),'through':_0x73da('0x13b'),'foreignKey':_0x73da('0x204')});db[_0x73da('0x108')][_0x73da('0x157')](db['User'],{'as':_0x73da('0x13')});db[_0x73da('0x108')][_0x73da('0x157')](db['CmContact'],{'onDelete':_0x73da('0x118'),'as':'Contact'});db[_0x73da('0x108')][_0x73da('0x157')](db[_0x73da('0x126')],{'onDelete':_0x73da('0x118'),'as':_0x73da('0x17d'),'foreignKey':_0x73da('0x204')});db['WhatsappMessage'][_0x73da('0x157')](db[_0x73da('0x105')],{'as':_0x73da('0x176'),'foreignKey':_0x73da('0x202')});db['WhatsappQueueReport'][_0x73da('0x157')](db['WhatsappAccount'],{});db[_0x73da('0x205')][_0x73da('0x157')](db[_0x73da('0xfd')],{'as':_0x73da('0x170'),'foreignKey':'ListId'});db[_0x73da('0x205')][_0x73da('0x157')](db['CmContact'],{'as':_0x73da('0x165'),'foreignKey':'ContactId'});db['WhatsappQueueReport'][_0x73da('0x157')](db[_0x73da('0x126')],{});db[_0x73da('0x205')][_0x73da('0x157')](db['WhatsappQueue'],{});db[_0x73da('0x205')]['belongsTo'](db[_0x73da('0x108')],{});db[_0x73da('0x205')]['belongsTo'](db[_0x73da('0x13')],{});db[_0x73da('0x10a')][_0x73da('0x157')](db[_0x73da('0x108')],{});db[_0x73da('0x10a')][_0x73da('0x157')](db['WhatsappInteraction'],{});db[_0x73da('0x10a')][_0x73da('0x157')](db[_0x73da('0x105')],{'foreignKey':'FromWhatsappAccountId','as':_0x73da('0x1ea')});db[_0x73da('0x10a')][_0x73da('0x157')](db[_0x73da('0x105')],{'foreignKey':_0x73da('0x206'),'as':_0x73da('0x1f0')});db['WhatsappTransferReport'][_0x73da('0x157')](db[_0x73da('0x10c')],{'foreignKey':_0x73da('0x207'),'as':_0x73da('0x1ef')});db[_0x73da('0x10a')][_0x73da('0x157')](db['User'],{'foreignKey':_0x73da('0x1eb'),'as':'FromAgent'});db[_0x73da('0x10a')]['belongsTo'](db['User'],{'foreignKey':_0x73da('0x1ed'),'as':_0x73da('0x1f3')});db[_0x73da('0x10c')]['belongsToMany'](db[_0x73da('0x13')],{'as':'Agents','through':_0x73da('0x208'),'foreignKey':_0x73da('0x209')});db[_0x73da('0x10c')][_0x73da('0x12d')](db['Team'],{'through':'team_has_whatsapp_queues','as':'Teams'});db[_0x73da('0x114')][_0x73da('0x157')](db[_0x73da('0x13')],{'as':'user','foreignKey':_0x73da('0x119'),'onDelete':_0x73da('0x118'),'hooks':!![]});db['CloudProvider'][_0x73da('0x117')](db[_0x73da('0x1d6')],{'as':_0x73da('0x1d6'),'onDelete':_0x73da('0x16a')});db[_0x73da('0x10e')][_0x73da('0x117')](db[_0x73da('0x167')],{'as':'Imap','onDelete':_0x73da('0x16a')});db[_0x73da('0x10e')]['hasOne'](db[_0x73da('0x3e')],{'as':_0x73da('0x16c'),'onDelete':_0x73da('0x16a')});module[_0x73da('0x20a')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x8fae=['UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','cascade','User','UserSetting','userSetting','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','CmHopperFinal','HopperFinals','OpenchannelInteractions','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','CmHopper','Hoppers','SET\x20NULL','belongsTo','UserProfile','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_lists','user_has_teams','user_has_chat_interactions','FaxInteraction','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteraction','VoiceQueues','UserVoiceQueue','UserVoicePrefix','ChatQueues','FaxQueues','SmsQueue','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','ChatWebsite','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccount','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','ChanSpyId','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperHistories','ReportAgentPreview','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','Interval','Pause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Teams','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','ContactId','MailAccountId','MailServerIn','CloudProvider','CloudProviderId','restrict','Imap','Dispositions','CannedAnswer','Answers','Interactions','ListId','TemplateId','mandatoryDispositionPause','team_has_mail_queues','MailInteractionId','Account','Owner','Tags','mail_interaction_has_tags','ThroughTags','user_has_mail_interactions','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','IntervalId','List','FaxAccountId','Exntensions','TagId','FaxInteractionId','fax_interaction_has_tags','Users','AttachmentId','team_has_fax_queues','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','ProactiveActions','ChatInteraction','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','CompanyId','CmContactHasItem','Phones','CmContactId','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','Agent','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Action','Actions','AutomationId','ParentId','Intervals','Extensions','MailApplications','ChatApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemType','Hopper','AllConditions','AllCondition','TriggerAllId','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','AnalyticMetric','Configurations','Subjects','SubjectId','Descriptions','DescriptionId','AccountId','Subject','Description','Field','FieldId','VariableId','SugarcrmAccount','SugarcrmConfiguration','DeskConfiguration','int_desk_configuration_has_tags','ZohoConfiguration','ZendeskAccount','int_freshdesk_configuration_has_tags','ServicenowConfiguration','Dynamics365Configuration','Dynamics365Field','SessionId','JscriptyProject','ProjectId','JscriptyQuestionReport','team_has_openchannel_queues','team_has_whatsapp_queues','VoicePrefixes','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','FromAccount','ToChatWebsiteId','ToAccount','FromFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','CustomFields','userProfileId','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappMessage','user_has_whatsapp_interactions','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToQueueId','user','exports','../config/environment','sequelize','lodash','jstz','determine','motion2','xcall','xC@LL1234','127.0.0.1','mysql','name','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','utf8mb4','database','password','options','username','import','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/pause/pause.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','Campaign','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model'];(function(_0x145348,_0x25bb84){var _0x18d11b=function(_0x41a102){while(--_0x41a102){_0x145348['push'](_0x145348['shift']());}};_0x18d11b(++_0x25bb84);}(_0x8fae,0x10d));var _0xe8fa=function(_0x36c50d,_0x981cfd){_0x36c50d=_0x36c50d-0x0;var _0x70ea89=_0x8fae[_0x36c50d];return _0x70ea89;};'use strict';var config=require(_0xe8fa('0x0'));var Sequelize=require(_0xe8fa('0x1'));var _=require(_0xe8fa('0x2'));var jstz=require(_0xe8fa('0x3'));var timezone=jstz[_0xe8fa('0x4')]();config[_0xe8fa('0x1')]=_['defaultsDeep'](config[_0xe8fa('0x1')],{'database':_0xe8fa('0x5'),'username':_0xe8fa('0x6'),'password':_0xe8fa('0x7'),'options':{'host':_0xe8fa('0x8'),'port':0xcea,'dialect':_0xe8fa('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xe8fa('0xa')](),'define':{'charset':_0xe8fa('0xb'),'collate':_0xe8fa('0xc')}}});config[_0xe8fa('0xd')]=_[_0xe8fa('0xe')](config[_0xe8fa('0xd')],{'database':_0xe8fa('0x5'),'username':_0xe8fa('0x6'),'password':_0xe8fa('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xe8fa('0x9'),'dialectOptions':{'charset':_0xe8fa('0xf')},'logging':![],'timezone':timezone[_0xe8fa('0xa')](),'define':{'charset':'utf8','collate':_0xe8fa('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe8fa('0x1')][_0xe8fa('0x10')],config[_0xe8fa('0x1')]['username'],config[_0xe8fa('0x1')][_0xe8fa('0x11')],config[_0xe8fa('0x1')][_0xe8fa('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe8fa('0xd')][_0xe8fa('0x10')],config['sequelizeHistory'][_0xe8fa('0x13')],config[_0xe8fa('0xd')][_0xe8fa('0x11')],config[_0xe8fa('0xd')][_0xe8fa('0x12')])};db['User']=db['sequelize'][_0xe8fa('0x14')]('../api/user/user.model');db[_0xe8fa('0x15')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0xe8fa('0x16')]=db['sequelize']['import'](_0xe8fa('0x17'));db[_0xe8fa('0x18')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x19'));db[_0xe8fa('0x1a')]=db['sequelize'][_0xe8fa('0x14')]('../api/voiceQueue/voiceQueue.model');db['VoiceRecording']=db['sequelize'][_0xe8fa('0x14')]('../api/voiceRecording/voiceRecording.model');db[_0xe8fa('0x1b')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x1c'));db[_0xe8fa('0x1d')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/voiceMail/voiceMail.model');db[_0xe8fa('0x1e')]=db['sequelize'][_0xe8fa('0x14')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xe8fa('0x1f')]=db[_0xe8fa('0x1')]['import'](_0xe8fa('0x20'));db['VoiceDialReport']=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0x21'));db['VoiceAgentReport']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x22'));db[_0xe8fa('0x23')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0xe8fa('0x24')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x25'));db[_0xe8fa('0x26')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x27'));db[_0xe8fa('0x28')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x29'));db[_0xe8fa('0x2a')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x2b'));db['UserVoiceQueue']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x2c'));db[_0xe8fa('0x2d')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/userChatQueue/userChatQueue.model');db[_0xe8fa('0x2e')]=db['sequelize'][_0xe8fa('0x14')]('../api/userMailQueue/userMailQueue.model');db[_0xe8fa('0x2f')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x30'));db[_0xe8fa('0x31')]=db[_0xe8fa('0x1')]['import'](_0xe8fa('0x32'));db[_0xe8fa('0x33')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x34'));db[_0xe8fa('0x35')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/userWhatsappQueue/userWhatsappQueue.model');db['MailServerIn']=db[_0xe8fa('0x1')]['import']('../api/mailServerIn/mailServerIn.model');db[_0xe8fa('0x36')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x37'));db['MailAccount']=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0x38'));db[_0xe8fa('0x39')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x3a'));db[_0xe8fa('0x3b')]=db['sequelize'][_0xe8fa('0x14')]('../api/mailSubstatus/mailSubstatus.model');db[_0xe8fa('0x3c')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x3d'));db[_0xe8fa('0x3e')]=db[_0xe8fa('0x1')]['import'](_0xe8fa('0x3f'));db[_0xe8fa('0x40')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/mailApplication/mailApplication.model');db[_0xe8fa('0x41')]=db['sequelize'][_0xe8fa('0x14')]('../api/mailQueueReport/mailQueueReport.model');db[_0xe8fa('0x42')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x43'));db[_0xe8fa('0x44')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x45'));db[_0xe8fa('0x46')]=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0x47'));db[_0xe8fa('0x48')]=db[_0xe8fa('0x1')]['import'](_0xe8fa('0x49'));db['FaxInteraction']=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/faxInteraction/faxInteraction.model');db[_0xe8fa('0x4a')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/faxMessage/faxMessage.model');db[_0xe8fa('0x4b')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x4c'));db[_0xe8fa('0x4d')]=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0x4e'));db[_0xe8fa('0x4f')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x50'));db[_0xe8fa('0x51')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x52'));db['SmsInteraction']=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/smsInteraction/smsInteraction.model');db[_0xe8fa('0x53')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x54'));db['SmsQueue']=db[_0xe8fa('0x1')]['import'](_0xe8fa('0x55'));db[_0xe8fa('0x56')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x57'));db[_0xe8fa('0x58')]=db['sequelize']['import'](_0xe8fa('0x59'));db[_0xe8fa('0x5a')]=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0x5b'));db[_0xe8fa('0x5c')]=db['sequelize']['import'](_0xe8fa('0x5d'));db['OpenchannelQueue']=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/openchannelQueue/openchannelQueue.model');db['ChatWebsite']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x5e'));db[_0xe8fa('0x5f')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x60'));db[_0xe8fa('0x61')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x62'));db['ChatInteraction']=db['sequelize'][_0xe8fa('0x14')]('../api/chatInteraction/chatInteraction.model');db[_0xe8fa('0x63')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x64'));db[_0xe8fa('0x65')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x66'));db[_0xe8fa('0x67')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/chatQueue/chatQueue.model');db[_0xe8fa('0x68')]=db[_0xe8fa('0x1')]['import'](_0xe8fa('0x69'));db[_0xe8fa('0x6a')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x6b'));db[_0xe8fa('0x6c')]=db[_0xe8fa('0x1')]['import']('../api/cmCompany/cmCompany.model');db[_0xe8fa('0x6d')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x6e'));db['CmHopper']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x6f'));db[_0xe8fa('0x70')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x71'));db['CmHopperFinal']=db['sequelize']['import'](_0xe8fa('0x72'));db[_0xe8fa('0x73')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x74'));db['ReportAgentPreview']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x75'));db[_0xe8fa('0x76')]=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0x77'));db['Action']=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/action/action.model');db[_0xe8fa('0x78')]=db[_0xe8fa('0x1')]['import'](_0xe8fa('0x79'));db['CannedAnswer']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x7a'));db[_0xe8fa('0x7b')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x7c'));db[_0xe8fa('0x7d')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/condition/condition.model');db['Interval']=db['sequelize']['import']('../api/interval/interval.model');db['Pause']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x7e'));db['Cdr']=db['sequelize'][_0xe8fa('0x14')]('../api/cdr/cdr.model');db['VoiceQueuesLog']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x7f'));db[_0xe8fa('0x80')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x81'));db[_0xe8fa('0x82')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/sound/sound.model');db[_0xe8fa('0x83')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x84'));db[_0xe8fa('0x85')]=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0x86'));db['CmContactHasItem']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x87'));db[_0xe8fa('0x88')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x89'));db[_0xe8fa('0x8a')]=db[_0xe8fa('0x1')]['import']('../api/template/template.model');db[_0xe8fa('0x8b')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x8c'));db[_0xe8fa('0x8d')]=db[_0xe8fa('0x1')]['import'](_0xe8fa('0x8e'));db[_0xe8fa('0x8f')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x90'));db[_0xe8fa('0x91')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x92'));db[_0xe8fa('0x93')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x94'));db[_0xe8fa('0x95')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0xe8fa('0x96')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x97'));db['AnalyticMetric']=db[_0xe8fa('0x1')]['import'](_0xe8fa('0x98'));db[_0xe8fa('0x99')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x9a'));db['AnalyticTreeReport']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x9b'));db[_0xe8fa('0x9c')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x9d'));db[_0xe8fa('0x9e')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x9f'));db[_0xe8fa('0xa0')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xa1'));db['SugarcrmAccount']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xa2'));db['SugarcrmConfiguration']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xa3'));db[_0xe8fa('0xa4')]=db[_0xe8fa('0x1')]['import'](_0xe8fa('0xa5'));db[_0xe8fa('0xa6')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xa7'));db['DeskConfiguration']=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0xe8fa('0xa8')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/intDeskField/intDeskField.model');db[_0xe8fa('0xa9')]=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0xaa'));db['ZohoConfiguration']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xab'));db[_0xe8fa('0xac')]=db[_0xe8fa('0x1')]['import']('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db['sequelize']['import'](_0xe8fa('0xad'));db[_0xe8fa('0xae')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xe8fa('0xaf')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xb0'));db[_0xe8fa('0xb1')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xb2'));db[_0xe8fa('0xb3')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xb4'));db[_0xe8fa('0xb5')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0xe8fa('0xb6')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xb7'));db[_0xe8fa('0xb8')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0xe8fa('0xb9')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xba'));db[_0xe8fa('0xbb')]=db[_0xe8fa('0x1')]['import'](_0xe8fa('0xbc'));db['ServicenowConfiguration']=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0xbd'));db[_0xe8fa('0xbe')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/intServicenowField/intServicenowField.model');db[_0xe8fa('0xbf')]=db[_0xe8fa('0x1')]['import'](_0xe8fa('0xc0'));db['Dynamics365Configuration']=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db['Dynamics365Field']=db['sequelize']['import']('../api/intDynamics365Field/intDynamics365Field.model');db[_0xe8fa('0xc1')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xe8fa('0xc2')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xc3'));db[_0xe8fa('0xc4')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xc5'));db[_0xe8fa('0x8f')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x90'));db[_0xe8fa('0xc6')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xc7'));db[_0xe8fa('0xc8')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xc9'));db[_0xe8fa('0xca')]=db[_0xe8fa('0x1')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db[_0xe8fa('0xcb')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db['JscriptyQuestionReport']=db['sequelize'][_0xe8fa('0x14')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xe8fa('0xcc')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xcd'));db[_0xe8fa('0xce')]=db['sequelize'][_0xe8fa('0x14')]('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/squareReport/squareReport.model');db[_0xe8fa('0xcf')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xd0'));db['JscriptyProject']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xd1'));db[_0xe8fa('0xd2')]=db[_0xe8fa('0x1')]['import'](_0xe8fa('0xd3'));db[_0xe8fa('0xd4')]=db[_0xe8fa('0x1')]['import'](_0xe8fa('0xd5'));db[_0xe8fa('0xd6')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/squareProject/squareProject.model');db[_0xe8fa('0xd7')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xd8'));db[_0xe8fa('0xd9')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xda'));db[_0xe8fa('0xdb')]=db['sequelize']['import'](_0xe8fa('0xdc'));db[_0xe8fa('0xdd')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/license/license.model');db[_0xe8fa('0xde')]=db['sequelize'][_0xe8fa('0x14')]('../api/campaign/campaign.model');db[_0xe8fa('0xdf')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xe0'));db[_0xe8fa('0xe1')]=db[_0xe8fa('0x1')]['import'](_0xe8fa('0xe2'));db[_0xe8fa('0xe3')]=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0xe4'));db[_0xe8fa('0xe5')]=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0xe6'));db[_0xe8fa('0xe7')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xe8'));db[_0xe8fa('0xe9')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xea'));db['OpenchannelTransferReport']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xeb'));db['SmsTransferReport']=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/smsTransferReport/smsTransferReport.model');db[_0xe8fa('0xec')]=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0xed'));db[_0xe8fa('0xee')]=db['sequelize'][_0xe8fa('0x14')]('../api/voicePrefix/voicePrefix.model');db['UserProfile']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xef'));db[_0xe8fa('0xf0')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xf1'));db['UserProfileResource']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xf2'));db[_0xe8fa('0xf3')]=db[_0xe8fa('0x1')]['import'](_0xe8fa('0xf4'));db[_0xe8fa('0xf5')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/whatsappAccount/whatsappAccount.model');db[_0xe8fa('0xf6')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xf7'));db['WhatsappInteraction']=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0xf8'));db['WhatsappMessage']=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0xf9'));db['WhatsappQueueReport']=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0xfa'));db[_0xe8fa('0xfb')]=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0xfc'));db[_0xe8fa('0xfd')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xfe'));db['CloudProvider']=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/cloudProvider/cloudProvider.model');db['TeamVoiceQueue']=db['sequelize']['import'](_0xe8fa('0xff'));db[_0xe8fa('0x100')]=db[_0xe8fa('0x1')]['import'](_0xe8fa('0x101'));db['UserVoicePrefix']=db[_0xe8fa('0x1')]['import']('../api/userVoicePrefix/userVoicePrefix.model');db['UserSetting']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x102'));db[_0xe8fa('0x103')]=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0x104'));db['User'][_0xe8fa('0x105')](db[_0xe8fa('0x1d')],{'as':_0xe8fa('0x1d'),'onDelete':_0xe8fa('0x106'),'foreignKey':'UserId'});db[_0xe8fa('0x107')][_0xe8fa('0x105')](db[_0xe8fa('0x108')],{'as':_0xe8fa('0x109'),'onDelete':'cascade','foreignKey':_0xe8fa('0x10a')});db['User'][_0xe8fa('0x10b')](db[_0xe8fa('0x10c')],{'as':_0xe8fa('0x10d'),'foreignKey':_0xe8fa('0x10a')});db[_0xe8fa('0x107')][_0xe8fa('0x10b')](db['UserVoiceQueueRt'],{'as':_0xe8fa('0x10e'),'foreignKey':_0xe8fa('0x10a')});db['User'][_0xe8fa('0x10b')](db[_0xe8fa('0x18')],{'as':'Extensions','onDelete':_0xe8fa('0x106'),'hooks':!![]});db[_0xe8fa('0x107')][_0xe8fa('0x10b')](db[_0xe8fa('0x10f')],{'as':_0xe8fa('0x110'),'foreignKey':_0xe8fa('0x10a')});db[_0xe8fa('0x107')][_0xe8fa('0x10b')](db[_0xe8fa('0x73')],{'as':'HopperHistory','foreignKey':_0xe8fa('0x10a')});db['User']['hasMany'](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xe8fa('0x10a')});db['User'][_0xe8fa('0x10b')](db[_0xe8fa('0x5a')],{'as':_0xe8fa('0x111'),'foreignKey':_0xe8fa('0x10a')});db[_0xe8fa('0x107')][_0xe8fa('0x10b')](db['ChatInteraction'],{'as':_0xe8fa('0x112'),'foreignKey':'UserId'});db['User']['hasMany'](db[_0xe8fa('0x113')],{'as':_0xe8fa('0x114'),'foreignKey':_0xe8fa('0x10a')});db[_0xe8fa('0x107')][_0xe8fa('0x10b')](db['FaxInteraction'],{'as':_0xe8fa('0x115'),'foreignKey':_0xe8fa('0x10a')});db[_0xe8fa('0x107')][_0xe8fa('0x10b')](db[_0xe8fa('0x3c')],{'as':_0xe8fa('0x116'),'foreignKey':_0xe8fa('0x10a')});db[_0xe8fa('0x107')][_0xe8fa('0x10b')](db['WhatsappInteraction'],{'as':_0xe8fa('0x117'),'foreignKey':'UserId'});db[_0xe8fa('0x107')][_0xe8fa('0x10b')](db[_0xe8fa('0xf3')],{'as':_0xe8fa('0x118'),'foreignKey':_0xe8fa('0x119')});db['User'][_0xe8fa('0x10b')](db[_0xe8fa('0x11a')],{'as':_0xe8fa('0x11b'),'foreignKey':_0xe8fa('0x10a'),'onDelete':_0xe8fa('0x11c')});db[_0xe8fa('0x107')][_0xe8fa('0x11d')](db[_0xe8fa('0x11e')],{'as':'UserProfile','foreignKey':'userProfileId'});db[_0xe8fa('0x107')][_0xe8fa('0x11f')](db[_0xe8fa('0x68')],{'as':_0xe8fa('0x120'),'through':_0xe8fa('0x121')});db[_0xe8fa('0x107')][_0xe8fa('0x11f')](db['CmContact'],{'as':_0xe8fa('0x122'),'through':'cm_user_has_contacts'});db['User']['belongsToMany'](db['CmList'],{'as':'Lists','through':_0xe8fa('0x123')});db[_0xe8fa('0x107')]['belongsToMany'](db[_0xe8fa('0xdb')],{'through':_0xe8fa('0x124')});db[_0xe8fa('0x107')]['belongsToMany'](db[_0xe8fa('0x3c')],{'as':_0xe8fa('0x116'),'through':'user_has_mail_interactions'});db['User'][_0xe8fa('0x11f')](db['ChatInteraction'],{'as':'ChatInteractions','through':_0xe8fa('0x125')});db[_0xe8fa('0x107')][_0xe8fa('0x11f')](db[_0xe8fa('0x126')],{'as':_0xe8fa('0x115'),'through':_0xe8fa('0x127')});db[_0xe8fa('0x107')]['belongsToMany'](db[_0xe8fa('0x113')],{'as':_0xe8fa('0x114'),'through':_0xe8fa('0x128')});db[_0xe8fa('0x107')][_0xe8fa('0x11f')](db[_0xe8fa('0x5a')],{'as':'OpenchannelInteractions','through':_0xe8fa('0x129')});db['User'][_0xe8fa('0x11f')](db[_0xe8fa('0x12a')],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db[_0xe8fa('0x107')][_0xe8fa('0x11f')](db[_0xe8fa('0x1a')],{'as':_0xe8fa('0x12b'),'through':_0xe8fa('0x12c'),'required':![]});db['User'][_0xe8fa('0x11f')](db[_0xe8fa('0xee')],{'as':'VoicePrefixes','through':_0xe8fa('0x12d'),'required':![]});db[_0xe8fa('0x107')][_0xe8fa('0x11f')](db[_0xe8fa('0x39')],{'as':'MailQueues','through':_0xe8fa('0x2e'),'required':![]});db['User'][_0xe8fa('0x11f')](db[_0xe8fa('0x67')],{'as':_0xe8fa('0x12e'),'through':_0xe8fa('0x2d'),'required':![],'hooks':!![]});db[_0xe8fa('0x107')][_0xe8fa('0x11f')](db[_0xe8fa('0x4b')],{'as':_0xe8fa('0x12f'),'through':_0xe8fa('0x2f'),'required':![]});db[_0xe8fa('0x107')][_0xe8fa('0x11f')](db[_0xe8fa('0x130')],{'as':_0xe8fa('0x131'),'through':_0xe8fa('0x31'),'required':![]});db[_0xe8fa('0x107')][_0xe8fa('0x11f')](db[_0xe8fa('0x132')],{'as':_0xe8fa('0x133'),'through':_0xe8fa('0x33'),'required':![]});db['User'][_0xe8fa('0x11f')](db[_0xe8fa('0xfd')],{'as':_0xe8fa('0x134'),'through':_0xe8fa('0x35'),'required':![]});db[_0xe8fa('0x107')][_0xe8fa('0x11f')](db[_0xe8fa('0xec')],{'through':_0xe8fa('0x123')});db[_0xe8fa('0x107')][_0xe8fa('0x11f')](db[_0xe8fa('0x135')],{'as':_0xe8fa('0x136'),'through':_0xe8fa('0x137')});db[_0xe8fa('0x107')][_0xe8fa('0x11f')](db[_0xe8fa('0x46')],{'as':'FaxAccounts','through':_0xe8fa('0x138')});db[_0xe8fa('0x107')][_0xe8fa('0x11f')](db[_0xe8fa('0x139')],{'as':_0xe8fa('0x13a'),'through':_0xe8fa('0x13b')});db[_0xe8fa('0x107')][_0xe8fa('0x11f')](db[_0xe8fa('0x56')],{'as':'OpenchannelAccounts','through':_0xe8fa('0x13c')});db['User'][_0xe8fa('0x11f')](db[_0xe8fa('0x4f')],{'as':_0xe8fa('0x13d'),'through':_0xe8fa('0x13e')});db[_0xe8fa('0x107')]['belongsToMany'](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':_0xe8fa('0x13f')});db[_0xe8fa('0x15')]['hasMany'](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':_0xe8fa('0x140')});db[_0xe8fa('0x16')][_0xe8fa('0x10b')](db[_0xe8fa('0x18')],{'onDelete':_0xe8fa('0x106')});db[_0xe8fa('0x18')]['hasMany'](db[_0xe8fa('0x18')],{'as':_0xe8fa('0x141'),'onDelete':_0xe8fa('0x106')});db[_0xe8fa('0x142')]['belongsToMany'](db['Sound'],{'as':_0xe8fa('0x143'),'through':_0xe8fa('0x144')});db['VoiceQueue'][_0xe8fa('0x10b')](db[_0xe8fa('0x2a')],{'as':_0xe8fa('0x145'),'foreignKey':'VoiceQueueId'});db[_0xe8fa('0x1a')]['hasMany'](db['CmHopper'],{'as':_0xe8fa('0x11b'),'foreignKey':_0xe8fa('0x146')});db[_0xe8fa('0x1a')][_0xe8fa('0x10b')](db['CmHopperFinal'],{'as':_0xe8fa('0x110'),'foreignKey':_0xe8fa('0x146')});db[_0xe8fa('0x1a')][_0xe8fa('0x10b')](db['CmHopperHistory'],{'as':_0xe8fa('0x147'),'foreignKey':_0xe8fa('0x146')});db[_0xe8fa('0x1a')]['hasMany'](db['ReportAgentPreview'],{'as':_0xe8fa('0x148'),'foreignKey':_0xe8fa('0x146')});db[_0xe8fa('0x1a')][_0xe8fa('0x10b')](db[_0xe8fa('0x70')],{'as':_0xe8fa('0x149'),'foreignKey':_0xe8fa('0x146')});db[_0xe8fa('0x1a')][_0xe8fa('0x10b')](db[_0xe8fa('0xcc')],{'as':_0xe8fa('0x14a'),'foreignKey':'VoiceQueueId'});db[_0xe8fa('0x1a')][_0xe8fa('0x11d')](db[_0xe8fa('0x26')],{'as':_0xe8fa('0x26'),'foreignKey':_0xe8fa('0x14b')});db[_0xe8fa('0x1a')][_0xe8fa('0x11d')](db[_0xe8fa('0x26')],{'as':_0xe8fa('0x14c'),'foreignKey':_0xe8fa('0x14d')});db[_0xe8fa('0x1a')][_0xe8fa('0x11d')](db[_0xe8fa('0x14e')],{'as':_0xe8fa('0x14e'),'foreignKey':'IntervalId'});db[_0xe8fa('0x1a')][_0xe8fa('0x11d')](db[_0xe8fa('0x14f')],{'as':'mandatoryDispositionPause','foreignKey':_0xe8fa('0x150')});db['VoiceQueue'][_0xe8fa('0x11f')](db[_0xe8fa('0xec')],{'as':_0xe8fa('0x151'),'through':_0xe8fa('0x152')});db[_0xe8fa('0x1a')]['belongsToMany'](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x153'),'through':_0xe8fa('0x12c')});db['VoiceQueue'][_0xe8fa('0x11f')](db[_0xe8fa('0xdb')],{'as':_0xe8fa('0x154'),'through':_0xe8fa('0x155')});db['VoiceQueue']['belongsToMany'](db[_0xe8fa('0xec')],{'as':_0xe8fa('0x156'),'through':_0xe8fa('0x157')});db[_0xe8fa('0x10c')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'as':'User','foreignKey':_0xe8fa('0x10a')});db[_0xe8fa('0x1b')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x107'),'foreignKey':_0xe8fa('0x10a')});db[_0xe8fa('0x1d')][_0xe8fa('0x10b')](db[_0xe8fa('0x1e')],{'as':_0xe8fa('0x158'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x159'),'sourceKey':_0xe8fa('0x15a')});db['VoiceMailMessage'][_0xe8fa('0x11d')](db[_0xe8fa('0x1d')],{'foreignKey':_0xe8fa('0x159'),'targetKey':_0xe8fa('0x15a')});db['VoiceCallReport'][_0xe8fa('0x10b')](db[_0xe8fa('0x23')],{'as':_0xe8fa('0x15b'),'foreignKey':_0xe8fa('0x15c'),'constraints':![]});db[_0xe8fa('0x1f')][_0xe8fa('0x10b')](db[_0xe8fa('0x15d')],{'as':_0xe8fa('0x15e'),'foreignKey':_0xe8fa('0x15c'),'constraints':![]});db['VoiceCallReport'][_0xe8fa('0x11d')](db['User'],{'as':_0xe8fa('0x107'),'foreignKey':_0xe8fa('0x10a')});db[_0xe8fa('0x1f')][_0xe8fa('0x11d')](db[_0xe8fa('0x6d')],{'as':_0xe8fa('0x15f'),'foreignKey':_0xe8fa('0x160')});db['MailServerIn'][_0xe8fa('0x11d')](db['MailAccount'],{'as':_0xe8fa('0x139'),'foreignKey':_0xe8fa('0x161')});db[_0xe8fa('0x162')][_0xe8fa('0x11d')](db[_0xe8fa('0x163')],{'as':_0xe8fa('0x163'),'foreignKey':_0xe8fa('0x164'),'onDelete':_0xe8fa('0x165')});db[_0xe8fa('0x36')][_0xe8fa('0x11d')](db['MailAccount'],{'as':_0xe8fa('0x139'),'foreignKey':_0xe8fa('0x161')});db[_0xe8fa('0x36')][_0xe8fa('0x11d')](db[_0xe8fa('0x163')],{'as':_0xe8fa('0x163'),'foreignKey':_0xe8fa('0x164'),'onDelete':_0xe8fa('0x165')});db[_0xe8fa('0x139')][_0xe8fa('0x105')](db[_0xe8fa('0x162')],{'as':_0xe8fa('0x166'),'onDelete':_0xe8fa('0x106')});db['MailAccount'][_0xe8fa('0x105')](db[_0xe8fa('0x36')],{'as':'Smtp','onDelete':'cascade'});db['MailAccount'][_0xe8fa('0x10b')](db['Disposition'],{'as':_0xe8fa('0x167'),'foreignKey':'MailAccountId','onDelete':_0xe8fa('0x106')});db[_0xe8fa('0x139')][_0xe8fa('0x10b')](db[_0xe8fa('0x168')],{'as':_0xe8fa('0x169'),'foreignKey':_0xe8fa('0x161')});db['MailAccount'][_0xe8fa('0x10b')](db[_0xe8fa('0x3e')],{'as':_0xe8fa('0x158'),'foreignKey':_0xe8fa('0x161')});db[_0xe8fa('0x139')][_0xe8fa('0x10b')](db[_0xe8fa('0x3c')],{'as':_0xe8fa('0x16a')});db[_0xe8fa('0x139')][_0xe8fa('0x10b')](db[_0xe8fa('0x40')],{'as':_0xe8fa('0x141'),'foreignKey':_0xe8fa('0x161'),'onDelete':_0xe8fa('0x106')});db['MailAccount']['belongsTo'](db[_0xe8fa('0xec')],{'as':'List','foreignKey':_0xe8fa('0x16b')});db['MailAccount'][_0xe8fa('0x11d')](db[_0xe8fa('0x8a')],{'as':_0xe8fa('0x8a'),'foreignKey':_0xe8fa('0x16c')});db['MailAccount'][_0xe8fa('0x11d')](db[_0xe8fa('0x14f')],{'as':_0xe8fa('0x16d'),'foreignKey':_0xe8fa('0x150')});db['MailAccount'][_0xe8fa('0x11f')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x153'),'through':_0xe8fa('0x13b')});db[_0xe8fa('0x39')][_0xe8fa('0x11f')](db['User'],{'as':'Agents','through':_0xe8fa('0x2e')});db[_0xe8fa('0x39')][_0xe8fa('0x11f')](db[_0xe8fa('0xdb')],{'through':_0xe8fa('0x16e'),'as':_0xe8fa('0x154')});db['MailInteraction'][_0xe8fa('0x10b')](db[_0xe8fa('0x3e')],{'as':_0xe8fa('0x158'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x16f')});db[_0xe8fa('0x3c')][_0xe8fa('0x11d')](db['MailAccount'],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x161')});db['MailInteraction']['belongsTo'](db['CmContact'],{'as':_0xe8fa('0x15f'),'foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0x3c')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x171'),'foreignKey':'UserId'});db['MailInteraction'][_0xe8fa('0x11f')](db[_0xe8fa('0x83')],{'through':'mail_interaction_has_tags','as':_0xe8fa('0x172')});db[_0xe8fa('0x3c')][_0xe8fa('0x11f')](db['Tag'],{'through':_0xe8fa('0x173'),'as':_0xe8fa('0x174')});db[_0xe8fa('0x3c')][_0xe8fa('0x11f')](db[_0xe8fa('0x107')],{'as':'Users','through':_0xe8fa('0x175'),'foreignKey':_0xe8fa('0x16f')});db['MailMessage'][_0xe8fa('0x10b')](db['Attachment'],{'as':_0xe8fa('0x176'),'onDelete':_0xe8fa('0x106')});db['MailMessage']['belongsTo'](db['User'],{'as':_0xe8fa('0x107')});db['MailMessage']['belongsTo'](db[_0xe8fa('0x6d')],{'onDelete':'cascade','as':'Contact'});db[_0xe8fa('0x3e')][_0xe8fa('0x11d')](db[_0xe8fa('0x3c')],{'as':_0xe8fa('0x177'),'foreignKey':_0xe8fa('0x16f')});db[_0xe8fa('0x3e')][_0xe8fa('0x11d')](db[_0xe8fa('0x139')],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x161')});db[_0xe8fa('0x3e')]['belongsTo'](db[_0xe8fa('0x135')],{'as':'ChatWebsite','foreignKey':_0xe8fa('0x178')});db['MailMessage'][_0xe8fa('0x11d')](db['ChatOfflineMessage'],{'as':_0xe8fa('0x65'),'foreignKey':_0xe8fa('0x179')});db[_0xe8fa('0x40')]['belongsTo'](db['User'],{'onDelete':_0xe8fa('0x165')});db['MailApplication'][_0xe8fa('0x11d')](db[_0xe8fa('0x39')],{'onDelete':_0xe8fa('0x165')});db[_0xe8fa('0x40')][_0xe8fa('0x11d')](db[_0xe8fa('0x139')],{'onDelete':_0xe8fa('0x165')});db['MailApplication'][_0xe8fa('0x11d')](db['Interval'],{'onDelete':'restrict','foreignKey':_0xe8fa('0x17a')});db['MailApplication']['belongsTo'](db[_0xe8fa('0x83')],{'onDelete':_0xe8fa('0x165'),'foreignKey':'TagId'});db[_0xe8fa('0x41')][_0xe8fa('0x11d')](db[_0xe8fa('0x139')],{});db[_0xe8fa('0x41')][_0xe8fa('0x11d')](db['CmList'],{'as':_0xe8fa('0x17b'),'foreignKey':'ListId'});db[_0xe8fa('0x41')]['belongsTo'](db['CmContact'],{'as':_0xe8fa('0x15f'),'foreignKey':'ContactId'});db[_0xe8fa('0x41')][_0xe8fa('0x11d')](db[_0xe8fa('0x3c')],{});db[_0xe8fa('0x41')]['belongsTo'](db[_0xe8fa('0x3e')],{});db[_0xe8fa('0x41')]['belongsTo'](db[_0xe8fa('0x107')],{});db[_0xe8fa('0x41')][_0xe8fa('0x11d')](db['MailQueue'],{});db[_0xe8fa('0x42')][_0xe8fa('0x10b')](db['DashboardItem'],{'as':'Items','onDelete':_0xe8fa('0x106')});db[_0xe8fa('0x46')][_0xe8fa('0x10b')](db[_0xe8fa('0x7b')],{'as':_0xe8fa('0x167'),'foreignKey':_0xe8fa('0x17c'),'onDelete':_0xe8fa('0x106')});db['FaxAccount'][_0xe8fa('0x10b')](db[_0xe8fa('0x168')],{'as':_0xe8fa('0x169'),'foreignKey':_0xe8fa('0x17c')});db['FaxAccount'][_0xe8fa('0x10b')](db[_0xe8fa('0x126')],{'as':_0xe8fa('0x16a')});db[_0xe8fa('0x46')][_0xe8fa('0x10b')](db[_0xe8fa('0x48')],{'as':_0xe8fa('0x141'),'foreignKey':_0xe8fa('0x17c'),'onDelete':_0xe8fa('0x106')});db['FaxAccount'][_0xe8fa('0x10b')](db['VoiceExtension'],{'as':_0xe8fa('0x17d'),'onDelete':'cascade'});db[_0xe8fa('0x46')][_0xe8fa('0x10b')](db[_0xe8fa('0x4a')],{'as':_0xe8fa('0x158')});db[_0xe8fa('0x46')][_0xe8fa('0x11d')](db[_0xe8fa('0x26')],{'as':_0xe8fa('0x26')});db[_0xe8fa('0x46')][_0xe8fa('0x11d')](db[_0xe8fa('0xec')],{'as':_0xe8fa('0x17b'),'foreignKey':_0xe8fa('0x16b')});db[_0xe8fa('0x46')][_0xe8fa('0x11d')](db['Pause'],{'as':_0xe8fa('0x16d'),'foreignKey':_0xe8fa('0x150')});db[_0xe8fa('0x46')][_0xe8fa('0x11f')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x153'),'through':_0xe8fa('0x138')});db[_0xe8fa('0x48')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'onDelete':_0xe8fa('0x165')});db[_0xe8fa('0x48')][_0xe8fa('0x11d')](db[_0xe8fa('0x4b')],{'onDelete':'restrict'});db['FaxApplication'][_0xe8fa('0x11d')](db[_0xe8fa('0x46')],{'onDelete':_0xe8fa('0x165')});db['FaxApplication']['belongsTo'](db[_0xe8fa('0x83')],{'onDelete':_0xe8fa('0x165'),'foreignKey':_0xe8fa('0x17e')});db['FaxInteraction'][_0xe8fa('0x10b')](db[_0xe8fa('0x4a')],{'as':_0xe8fa('0x158'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x17f')});db[_0xe8fa('0x126')][_0xe8fa('0x11d')](db[_0xe8fa('0x46')],{'as':'Account','foreignKey':_0xe8fa('0x17c')});db[_0xe8fa('0x126')][_0xe8fa('0x11d')](db[_0xe8fa('0x6d')],{'as':'Contact','foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0x126')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x171'),'foreignKey':_0xe8fa('0x10a')});db['FaxInteraction']['belongsToMany'](db[_0xe8fa('0x83')],{'through':'fax_interaction_has_tags','as':_0xe8fa('0x172')});db['FaxInteraction'][_0xe8fa('0x11f')](db[_0xe8fa('0x83')],{'through':_0xe8fa('0x180'),'as':_0xe8fa('0x174')});db[_0xe8fa('0x126')][_0xe8fa('0x11f')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x181'),'through':_0xe8fa('0x127'),'foreignKey':_0xe8fa('0x17f')});db[_0xe8fa('0x4a')][_0xe8fa('0x11d')](db['User'],{'onDelete':'cascade','as':_0xe8fa('0x107')});db[_0xe8fa('0x4a')][_0xe8fa('0x11d')](db[_0xe8fa('0x126')],{'as':_0xe8fa('0x177'),'foreignKey':_0xe8fa('0x17f')});db[_0xe8fa('0x4a')][_0xe8fa('0x11d')](db[_0xe8fa('0x6d')],{'onDelete':_0xe8fa('0x106'),'as':_0xe8fa('0x15f')});db['FaxMessage'][_0xe8fa('0x11d')](db[_0xe8fa('0xe1')],{'as':'Attachment','foreignKey':_0xe8fa('0x182')});db['FaxMessage'][_0xe8fa('0x11d')](db[_0xe8fa('0x46')],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x17c')});db[_0xe8fa('0x4b')][_0xe8fa('0x11f')](db['User'],{'as':_0xe8fa('0x153'),'through':_0xe8fa('0x2f')});db['FaxQueue'][_0xe8fa('0x11f')](db['Team'],{'through':_0xe8fa('0x183'),'as':_0xe8fa('0x154')});db[_0xe8fa('0x4d')][_0xe8fa('0x11d')](db[_0xe8fa('0x46')],{});db[_0xe8fa('0x4d')][_0xe8fa('0x11d')](db[_0xe8fa('0xec')],{'as':'List','foreignKey':_0xe8fa('0x16b')});db[_0xe8fa('0x4d')][_0xe8fa('0x11d')](db[_0xe8fa('0x6d')],{'as':_0xe8fa('0x15f'),'foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0x4d')]['belongsTo'](db[_0xe8fa('0x126')],{});db[_0xe8fa('0x4d')][_0xe8fa('0x11d')](db[_0xe8fa('0x4a')],{});db[_0xe8fa('0x4d')][_0xe8fa('0x11d')](db['User'],{});db[_0xe8fa('0x4d')][_0xe8fa('0x11d')](db['FaxQueue'],{});db['SmsAccount'][_0xe8fa('0x10b')](db['Disposition'],{'as':_0xe8fa('0x167'),'foreignKey':_0xe8fa('0x184'),'onDelete':_0xe8fa('0x106')});db[_0xe8fa('0x4f')][_0xe8fa('0x10b')](db[_0xe8fa('0x168')],{'as':'Answers','foreignKey':'SmsAccountId'});db['SmsAccount'][_0xe8fa('0x10b')](db[_0xe8fa('0x53')],{'as':_0xe8fa('0x158'),'foreignKey':'SmsAccountId'});db[_0xe8fa('0x4f')][_0xe8fa('0x10b')](db['SmsInteraction'],{'as':_0xe8fa('0x16a')});db[_0xe8fa('0x4f')][_0xe8fa('0x10b')](db[_0xe8fa('0x51')],{'as':_0xe8fa('0x141'),'foreignKey':_0xe8fa('0x184'),'onDelete':_0xe8fa('0x106')});db['SmsAccount'][_0xe8fa('0x11d')](db[_0xe8fa('0xec')],{'as':'List','foreignKey':'ListId'});db[_0xe8fa('0x4f')][_0xe8fa('0x11d')](db[_0xe8fa('0x14f')],{'as':'mandatoryDispositionPause','foreignKey':_0xe8fa('0x150')});db[_0xe8fa('0x4f')]['belongsToMany'](db['User'],{'as':'Agents','through':_0xe8fa('0x13e')});db[_0xe8fa('0x51')]['belongsTo'](db[_0xe8fa('0x107')],{'onDelete':_0xe8fa('0x165')});db['SmsApplication']['belongsTo'](db[_0xe8fa('0x130')],{'onDelete':'restrict'});db[_0xe8fa('0x51')][_0xe8fa('0x11d')](db[_0xe8fa('0x4f')],{'onDelete':_0xe8fa('0x165')});db['SmsApplication']['belongsTo'](db[_0xe8fa('0x14e')],{'onDelete':_0xe8fa('0x165'),'foreignKey':_0xe8fa('0x17a')});db[_0xe8fa('0x51')][_0xe8fa('0x11d')](db[_0xe8fa('0x83')],{'onDelete':_0xe8fa('0x165'),'foreignKey':_0xe8fa('0x17e')});db[_0xe8fa('0x113')][_0xe8fa('0x10b')](db['SmsMessage'],{'as':_0xe8fa('0x158'),'onDelete':_0xe8fa('0x106'),'foreignKey':'SmsInteractionId'});db[_0xe8fa('0x113')][_0xe8fa('0x11d')](db[_0xe8fa('0x4f')],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x184')});db['SmsInteraction']['belongsTo'](db['CmContact'],{'as':_0xe8fa('0x15f'),'foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0x113')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'as':'Owner','foreignKey':_0xe8fa('0x10a')});db[_0xe8fa('0x113')][_0xe8fa('0x11f')](db['Tag'],{'through':_0xe8fa('0x185'),'as':'Tags'});db['SmsInteraction']['belongsToMany'](db[_0xe8fa('0x83')],{'through':'sms_interaction_has_tags','as':_0xe8fa('0x174')});db[_0xe8fa('0x113')][_0xe8fa('0x11f')](db['User'],{'as':_0xe8fa('0x181'),'through':_0xe8fa('0x128'),'foreignKey':_0xe8fa('0x186')});db['SmsMessage'][_0xe8fa('0x11d')](db['User'],{'as':_0xe8fa('0x107')});db['SmsMessage'][_0xe8fa('0x11d')](db[_0xe8fa('0x6d')],{'onDelete':_0xe8fa('0x106'),'as':'Contact'});db[_0xe8fa('0x53')]['belongsTo'](db[_0xe8fa('0x113')],{'onDelete':_0xe8fa('0x106'),'as':_0xe8fa('0x177'),'foreignKey':_0xe8fa('0x186')});db[_0xe8fa('0x53')][_0xe8fa('0x11d')](db[_0xe8fa('0x4f')],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x184')});db[_0xe8fa('0x130')][_0xe8fa('0x11f')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x153'),'through':_0xe8fa('0x31'),'foreignKey':_0xe8fa('0x187')});db[_0xe8fa('0x130')]['belongsToMany'](db[_0xe8fa('0xdb')],{'through':_0xe8fa('0x188'),'as':_0xe8fa('0x154')});db[_0xe8fa('0x56')]['hasMany'](db[_0xe8fa('0x7b')],{'as':_0xe8fa('0x167'),'foreignKey':_0xe8fa('0x189'),'onDelete':'cascade'});db[_0xe8fa('0x56')]['hasMany'](db[_0xe8fa('0x168')],{'as':_0xe8fa('0x169'),'foreignKey':_0xe8fa('0x189')});db[_0xe8fa('0x56')][_0xe8fa('0x10b')](db[_0xe8fa('0x5a')],{'as':_0xe8fa('0x16a'),'foreignKey':_0xe8fa('0x189')});db['OpenchannelAccount'][_0xe8fa('0x10b')](db[_0xe8fa('0x5c')],{'as':_0xe8fa('0x158'),'foreignKey':'OpenchannelAccountId'});db[_0xe8fa('0x56')][_0xe8fa('0x10b')](db['OpenchannelApplication'],{'as':'Applications','foreignKey':'OpenchannelAccountId','onDelete':_0xe8fa('0x106')});db[_0xe8fa('0x56')][_0xe8fa('0x11d')](db[_0xe8fa('0xec')],{'as':_0xe8fa('0x17b'),'foreignKey':_0xe8fa('0x16b')});db[_0xe8fa('0x56')][_0xe8fa('0x11d')](db[_0xe8fa('0x14f')],{'as':_0xe8fa('0x16d'),'foreignKey':_0xe8fa('0x150')});db[_0xe8fa('0x56')][_0xe8fa('0x11f')](db['User'],{'as':'Agents','through':'user_has_openchannel_accounts'});db[_0xe8fa('0x58')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'onDelete':_0xe8fa('0x165')});db[_0xe8fa('0x58')][_0xe8fa('0x11d')](db[_0xe8fa('0x132')],{'onDelete':_0xe8fa('0x165'),'foreignKey':_0xe8fa('0x18a')});db[_0xe8fa('0x58')][_0xe8fa('0x11d')](db[_0xe8fa('0x56')],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db[_0xe8fa('0x58')][_0xe8fa('0x11d')](db[_0xe8fa('0x14e')],{'onDelete':_0xe8fa('0x165'),'foreignKey':_0xe8fa('0x17a')});db[_0xe8fa('0x58')][_0xe8fa('0x11d')](db[_0xe8fa('0x83')],{'onDelete':_0xe8fa('0x165'),'foreignKey':_0xe8fa('0x17e')});db[_0xe8fa('0x5a')][_0xe8fa('0x10b')](db[_0xe8fa('0x5c')],{'as':_0xe8fa('0x158'),'onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db[_0xe8fa('0x5a')]['belongsTo'](db[_0xe8fa('0x56')],{'as':'Account','foreignKey':_0xe8fa('0x189')});db[_0xe8fa('0x5a')][_0xe8fa('0x11d')](db[_0xe8fa('0x6d')],{'as':_0xe8fa('0x15f'),'foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0x5a')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x171'),'foreignKey':_0xe8fa('0x10a')});db[_0xe8fa('0x5a')][_0xe8fa('0x11f')](db['Tag'],{'through':_0xe8fa('0x18b'),'as':_0xe8fa('0x172')});db[_0xe8fa('0x5a')][_0xe8fa('0x11f')](db[_0xe8fa('0x83')],{'through':'openchannel_interaction_has_tags','as':_0xe8fa('0x174')});db[_0xe8fa('0x5a')][_0xe8fa('0x11f')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x181'),'through':_0xe8fa('0x129'),'foreignKey':_0xe8fa('0x18c')});db['OpenchannelMessage'][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'onDelete':_0xe8fa('0x106'),'as':'User'});db[_0xe8fa('0x5c')][_0xe8fa('0x11d')](db[_0xe8fa('0x6d')],{'onDelete':_0xe8fa('0x106'),'as':_0xe8fa('0x15f')});db[_0xe8fa('0x5c')][_0xe8fa('0x11d')](db[_0xe8fa('0x5a')],{'onDelete':'cascade','as':_0xe8fa('0x177'),'foreignKey':'OpenchannelInteractionId'});db[_0xe8fa('0x5c')]['belongsTo'](db['Attachment'],{'as':'Attachment','foreignKey':_0xe8fa('0x182')});db[_0xe8fa('0x5c')]['belongsTo'](db[_0xe8fa('0x56')],{'as':_0xe8fa('0x170'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelQueue']['belongsToMany'](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x153'),'through':_0xe8fa('0x33'),'foreignKey':_0xe8fa('0x18a')});db[_0xe8fa('0x132')]['belongsToMany'](db[_0xe8fa('0xdb')],{'through':'team_has_openchannel_queues','as':'Teams'});db[_0xe8fa('0x135')][_0xe8fa('0x10b')](db[_0xe8fa('0x7b')],{'as':_0xe8fa('0x167'),'foreignKey':'ChatWebsiteId','onDelete':_0xe8fa('0x106')});db[_0xe8fa('0x135')]['hasMany'](db[_0xe8fa('0x168')],{'as':_0xe8fa('0x169'),'foreignKey':_0xe8fa('0x178')});db[_0xe8fa('0x135')][_0xe8fa('0x10b')](db[_0xe8fa('0x6a')],{'as':_0xe8fa('0x18d')});db[_0xe8fa('0x135')][_0xe8fa('0x10b')](db[_0xe8fa('0x18e')],{'as':_0xe8fa('0x16a')});db['ChatWebsite'][_0xe8fa('0x10b')](db[_0xe8fa('0x61')],{'as':_0xe8fa('0x141'),'foreignKey':_0xe8fa('0x178'),'onDelete':_0xe8fa('0x106')});db[_0xe8fa('0x135')][_0xe8fa('0x10b')](db[_0xe8fa('0x63')],{'as':_0xe8fa('0x158')});db[_0xe8fa('0x135')][_0xe8fa('0x11d')](db[_0xe8fa('0xec')],{'as':'List','foreignKey':_0xe8fa('0x16b')});db['ChatWebsite'][_0xe8fa('0x11d')](db[_0xe8fa('0x14e')],{'as':_0xe8fa('0x14e'),'foreignKey':_0xe8fa('0x17a')});db[_0xe8fa('0x135')]['belongsTo'](db[_0xe8fa('0x139')],{'as':'MailAccount','foreignKey':_0xe8fa('0x161')});db[_0xe8fa('0x135')][_0xe8fa('0x11d')](db[_0xe8fa('0x14f')],{'as':'mandatoryDispositionPause','foreignKey':_0xe8fa('0x150')});db[_0xe8fa('0x135')][_0xe8fa('0x11f')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x153'),'through':'user_has_chat_websites'});db['OpenchannelQueueReport'][_0xe8fa('0x11d')](db[_0xe8fa('0x56')],{});db['OpenchannelQueueReport'][_0xe8fa('0x11d')](db[_0xe8fa('0xec')],{'as':_0xe8fa('0x17b'),'foreignKey':'ListId'});db[_0xe8fa('0x5f')][_0xe8fa('0x11d')](db['CmContact'],{'as':'Contact','foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0x5f')][_0xe8fa('0x11d')](db[_0xe8fa('0x5a')],{});db[_0xe8fa('0x5f')][_0xe8fa('0x11d')](db[_0xe8fa('0x5c')],{});db[_0xe8fa('0x5f')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{});db['OpenchannelQueueReport'][_0xe8fa('0x11d')](db[_0xe8fa('0x132')],{});db[_0xe8fa('0x61')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'as':'Agent','foreignKey':_0xe8fa('0x10a'),'onDelete':_0xe8fa('0x165')});db[_0xe8fa('0x61')][_0xe8fa('0x11d')](db[_0xe8fa('0x67')],{'as':_0xe8fa('0x18f'),'foreignKey':_0xe8fa('0x190'),'onDelete':_0xe8fa('0x165')});db[_0xe8fa('0x61')][_0xe8fa('0x11d')](db[_0xe8fa('0x135')],{'as':_0xe8fa('0x191'),'foreignKey':_0xe8fa('0x178'),'onDelete':_0xe8fa('0x165')});db[_0xe8fa('0x61')]['belongsTo'](db['Tag'],{'onDelete':_0xe8fa('0x165'),'foreignKey':_0xe8fa('0x17e')});db[_0xe8fa('0x18e')][_0xe8fa('0x10b')](db[_0xe8fa('0x63')],{'as':_0xe8fa('0x158'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x192')});db[_0xe8fa('0x18e')][_0xe8fa('0x11d')](db[_0xe8fa('0x135')],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x178')});db[_0xe8fa('0x18e')]['belongsTo'](db['CmContact'],{'as':_0xe8fa('0x15f'),'foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0x18e')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x171'),'foreignKey':_0xe8fa('0x10a')});db[_0xe8fa('0x18e')][_0xe8fa('0x11f')](db[_0xe8fa('0x83')],{'through':_0xe8fa('0x193'),'as':_0xe8fa('0x172')});db[_0xe8fa('0x18e')]['belongsToMany'](db[_0xe8fa('0x83')],{'through':'chat_interaction_has_tags','as':_0xe8fa('0x174')});db[_0xe8fa('0x18e')][_0xe8fa('0x11f')](db['User'],{'as':_0xe8fa('0x181'),'through':_0xe8fa('0x125'),'foreignKey':_0xe8fa('0x192')});db[_0xe8fa('0x63')][_0xe8fa('0x11d')](db['User'],{'onDelete':_0xe8fa('0x106'),'as':_0xe8fa('0x107')});db[_0xe8fa('0x63')][_0xe8fa('0x11d')](db[_0xe8fa('0x6d')],{'onDelete':_0xe8fa('0x106'),'as':_0xe8fa('0x15f'),'foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0x63')]['belongsTo'](db[_0xe8fa('0x18e')],{'onDelete':_0xe8fa('0x106'),'as':'Interaction','foreignKey':_0xe8fa('0x192')});db[_0xe8fa('0x63')][_0xe8fa('0x11d')](db[_0xe8fa('0xe1')],{'as':_0xe8fa('0xe1'),'foreignKey':'AttachmentId'});db[_0xe8fa('0x63')][_0xe8fa('0x11d')](db['ChatWebsite'],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x178')});db[_0xe8fa('0x65')][_0xe8fa('0x10b')](db[_0xe8fa('0xe1')],{'as':_0xe8fa('0x176'),'foreignKey':_0xe8fa('0x179'),'onDelete':_0xe8fa('0x106'),'hooks':!![]});db[_0xe8fa('0x65')][_0xe8fa('0x11d')](db[_0xe8fa('0x6d')],{'onDelete':_0xe8fa('0x106'),'as':'Contact','foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0x65')][_0xe8fa('0x11d')](db['ChatWebsite'],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x178')});db[_0xe8fa('0x67')][_0xe8fa('0x11f')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x153'),'through':_0xe8fa('0x2d'),'hooks':!![]});db[_0xe8fa('0x67')][_0xe8fa('0x11f')](db[_0xe8fa('0xdb')],{'through':_0xe8fa('0x194'),'as':'Teams'});db[_0xe8fa('0x68')][_0xe8fa('0x10b')](db[_0xe8fa('0xca')],{'as':_0xe8fa('0x158'),'foreignKey':_0xe8fa('0x195'),'onDelete':_0xe8fa('0x106')});db[_0xe8fa('0x68')][_0xe8fa('0x11f')](db['User'],{'as':_0xe8fa('0x145'),'through':_0xe8fa('0x121')});db[_0xe8fa('0x6a')][_0xe8fa('0x11d')](db[_0xe8fa('0x135')],{'as':_0xe8fa('0x191'),'foreignKey':_0xe8fa('0x178')});db[_0xe8fa('0x6c')][_0xe8fa('0x10b')](db['CmContact'],{'as':_0xe8fa('0x122'),'foreignKey':_0xe8fa('0x196')});db['CmContact'][_0xe8fa('0x10b')](db[_0xe8fa('0x197')],{'as':_0xe8fa('0x198'),'foreignKey':_0xe8fa('0x199')});db[_0xe8fa('0x6d')]['hasMany'](db[_0xe8fa('0x11a')],{'as':_0xe8fa('0x11b'),'foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0x6d')][_0xe8fa('0x10b')](db[_0xe8fa('0x10f')],{'as':'HopperFinals','foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0x6d')][_0xe8fa('0x10b')](db['CmHopperHistory'],{'as':_0xe8fa('0x147'),'foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0x6d')][_0xe8fa('0x10b')](db[_0xe8fa('0x148')],{'as':'ReportAgentPreview','foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0x6d')]['hasMany'](db[_0xe8fa('0xcc')],{'as':_0xe8fa('0x14a'),'foreignKey':'ContactId'});db[_0xe8fa('0x6d')][_0xe8fa('0x10b')](db['OpenchannelInteraction'],{'as':_0xe8fa('0x111'),'foreignKey':_0xe8fa('0x160'),'onDelete':_0xe8fa('0x165')});db['CmContact']['hasMany'](db[_0xe8fa('0x18e')],{'as':_0xe8fa('0x112'),'foreignKey':'ContactId','onDelete':_0xe8fa('0x165')});db[_0xe8fa('0x6d')][_0xe8fa('0x10b')](db[_0xe8fa('0x113')],{'as':_0xe8fa('0x114'),'foreignKey':'ContactId','onDelete':_0xe8fa('0x165')});db[_0xe8fa('0x6d')]['hasMany'](db['FaxInteraction'],{'as':_0xe8fa('0x115'),'foreignKey':'ContactId','onDelete':_0xe8fa('0x165')});db[_0xe8fa('0x6d')]['hasMany'](db[_0xe8fa('0x3c')],{'as':_0xe8fa('0x116'),'foreignKey':_0xe8fa('0x160'),'onDelete':_0xe8fa('0x165')});db[_0xe8fa('0x6d')][_0xe8fa('0x11d')](db[_0xe8fa('0x6c')],{'as':_0xe8fa('0x19a'),'foreignKey':_0xe8fa('0x196')});db['CmContact'][_0xe8fa('0x11d')](db[_0xe8fa('0xec')],{'as':_0xe8fa('0x17b'),'foreignKey':_0xe8fa('0x16b'),'onDelete':'cascade'});db[_0xe8fa('0x6d')][_0xe8fa('0x11f')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x181'),'through':'cm_user_has_contacts'});db['CmContact'][_0xe8fa('0x11f')](db[_0xe8fa('0x83')],{'as':'Tags','through':_0xe8fa('0x19b')});db[_0xe8fa('0x6d')][_0xe8fa('0x11f')](db[_0xe8fa('0x83')],{'through':_0xe8fa('0x19b'),'as':_0xe8fa('0x174')});db[_0xe8fa('0x11a')]['hasMany'](db['CmHopperAdditionalPhone'],{'as':_0xe8fa('0x19c'),'foreignKey':_0xe8fa('0x19d')});db[_0xe8fa('0x11a')][_0xe8fa('0x11d')](db[_0xe8fa('0x6d')],{'as':_0xe8fa('0x15f'),'foreignKey':_0xe8fa('0x160'),'onDelete':'cascade'});db['CmHopper'][_0xe8fa('0x11d')](db[_0xe8fa('0xec')],{'as':_0xe8fa('0x17b'),'foreignKey':_0xe8fa('0x16b'),'onDelete':_0xe8fa('0x106')});db[_0xe8fa('0x11a')]['belongsTo'](db['User'],{'as':_0xe8fa('0x19e'),'foreignKey':'UserId'});db['CmHopper'][_0xe8fa('0x11d')](db['VoiceQueue'],{'as':_0xe8fa('0x18f'),'foreignKey':_0xe8fa('0x146'),'onDelete':_0xe8fa('0x106')});db[_0xe8fa('0x11a')]['belongsTo'](db[_0xe8fa('0xde')],{'as':_0xe8fa('0xde'),'foreignKey':_0xe8fa('0x19f'),'onDelete':_0xe8fa('0x106')});db[_0xe8fa('0x11a')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x171'),'foreignKey':_0xe8fa('0x1a0')});db[_0xe8fa('0x70')][_0xe8fa('0x11d')](db[_0xe8fa('0x6d')],{'as':'Contact','foreignKey':_0xe8fa('0x160'),'onDelete':'cascade'});db[_0xe8fa('0x70')][_0xe8fa('0x11d')](db[_0xe8fa('0xec')],{'as':_0xe8fa('0x17b'),'foreignKey':_0xe8fa('0x16b'),'onDelete':'cascade'});db[_0xe8fa('0x70')][_0xe8fa('0x11d')](db[_0xe8fa('0x1a')],{'as':_0xe8fa('0x18f'),'foreignKey':_0xe8fa('0x146'),'onDelete':_0xe8fa('0x106')});db['CmHopperBlack'][_0xe8fa('0x11d')](db[_0xe8fa('0xde')],{'as':_0xe8fa('0xde'),'foreignKey':_0xe8fa('0x19f'),'onDelete':'cascade'});db[_0xe8fa('0x78')][_0xe8fa('0x10b')](db['Condition'],{'as':{'plural':_0xe8fa('0x1a1'),'singular':_0xe8fa('0x1a2')},'foreignKey':_0xe8fa('0x1a3'),'onDelete':'cascade','hooks':!![]});db[_0xe8fa('0x78')][_0xe8fa('0x10b')](db[_0xe8fa('0x7d')],{'as':{'plural':_0xe8fa('0x1a4'),'singular':_0xe8fa('0x1a5')},'foreignKey':_0xe8fa('0x1a6'),'onDelete':'cascade','hooks':!![]});db[_0xe8fa('0x78')][_0xe8fa('0x10b')](db[_0xe8fa('0x1a7')],{'as':_0xe8fa('0x1a8'),'foreignKey':_0xe8fa('0x1a9'),'onDelete':'cascade','hooks':!![]});db[_0xe8fa('0x7b')][_0xe8fa('0x10b')](db[_0xe8fa('0x7b')],{'as':'Dispositions','foreignKey':_0xe8fa('0x1aa'),'onDelete':_0xe8fa('0x106')});db[_0xe8fa('0x14e')][_0xe8fa('0x10b')](db['Interval'],{'as':_0xe8fa('0x1ab'),'foreignKey':_0xe8fa('0x17a'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0xe8fa('0x14e')][_0xe8fa('0x10b')](db[_0xe8fa('0x18')],{'as':_0xe8fa('0x1ac'),'foreignKey':_0xe8fa('0x17a'),'onDelete':_0xe8fa('0x165')});db[_0xe8fa('0x14e')][_0xe8fa('0x10b')](db[_0xe8fa('0x40')],{'as':_0xe8fa('0x1ad'),'foreignKey':_0xe8fa('0x17a')});db[_0xe8fa('0x14e')][_0xe8fa('0x10b')](db['ChatApplication'],{'as':_0xe8fa('0x1ae'),'foreignKey':_0xe8fa('0x17a')});db[_0xe8fa('0x14e')]['hasMany'](db[_0xe8fa('0x48')],{'as':'FaxApplications','foreignKey':_0xe8fa('0x17a')});db['Interval']['hasMany'](db[_0xe8fa('0x51')],{'as':_0xe8fa('0x1af'),'foreignKey':_0xe8fa('0x17a')});db[_0xe8fa('0x80')][_0xe8fa('0x11d')](db[_0xe8fa('0x139')],{});db['Schedule']['belongsTo'](db[_0xe8fa('0x95')],{'foreignKey':_0xe8fa('0x1b0')});db['Schedule'][_0xe8fa('0x11d')](db[_0xe8fa('0x93')],{'foreignKey':_0xe8fa('0x1b1')});db[_0xe8fa('0x82')]['belongsToMany'](db[_0xe8fa('0x142')],{'as':_0xe8fa('0x1b2'),'through':_0xe8fa('0x144'),'onDelete':_0xe8fa('0x165')});db[_0xe8fa('0x83')][_0xe8fa('0x11f')](db['CmContact'],{'through':'cm_contact_has_tags'});db[_0xe8fa('0x83')][_0xe8fa('0x11f')](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db[_0xe8fa('0x83')][_0xe8fa('0x11f')](db[_0xe8fa('0x3c')],{'through':_0xe8fa('0x173')});db[_0xe8fa('0x83')][_0xe8fa('0x11f')](db[_0xe8fa('0x113')],{'through':_0xe8fa('0x185')});db[_0xe8fa('0x83')][_0xe8fa('0x11f')](db[_0xe8fa('0x126')],{'through':_0xe8fa('0x180')});db[_0xe8fa('0x83')]['belongsToMany'](db['OpenchannelInteraction'],{'through':_0xe8fa('0x18b')});db[_0xe8fa('0x83')][_0xe8fa('0x11f')](db[_0xe8fa('0x12a')],{'through':_0xe8fa('0x1b3')});db[_0xe8fa('0x197')][_0xe8fa('0x11d')](db[_0xe8fa('0x85')],{'as':_0xe8fa('0x1b4'),'foreignKey':'ItemTypeId'});db['CmHopperAdditionalPhone'][_0xe8fa('0x11d')](db[_0xe8fa('0x11a')],{'as':_0xe8fa('0x1b5'),'foreignKey':'CmHopperId'});db['CmContactHasItem'][_0xe8fa('0x11d')](db[_0xe8fa('0x6d')],{'as':_0xe8fa('0x15f'),'foreignKey':_0xe8fa('0x199')});db[_0xe8fa('0x8b')][_0xe8fa('0x10b')](db['Condition'],{'as':{'plural':_0xe8fa('0x1b6'),'singular':_0xe8fa('0x1b7')},'foreignKey':_0xe8fa('0x1b8'),'onDelete':_0xe8fa('0x106'),'hooks':!![]});db[_0xe8fa('0x8b')][_0xe8fa('0x10b')](db['Condition'],{'as':{'plural':'AnyConditions','singular':_0xe8fa('0x1b9')},'foreignKey':_0xe8fa('0x1ba'),'onDelete':_0xe8fa('0x106'),'hooks':!![]});db[_0xe8fa('0x8b')][_0xe8fa('0x10b')](db[_0xe8fa('0x1a7')],{'as':_0xe8fa('0x1a8'),'foreignKey':_0xe8fa('0x1bb'),'onDelete':_0xe8fa('0x106'),'hooks':!![]});db[_0xe8fa('0x93')][_0xe8fa('0x10b')](db[_0xe8fa('0x99')],{'as':_0xe8fa('0x1bc'),'onDelete':'cascade','foreignKey':_0xe8fa('0x1b1'),'hooks':!![]});db[_0xe8fa('0x95')][_0xe8fa('0x10b')](db[_0xe8fa('0x99')],{'as':_0xe8fa('0x1bc'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x1b0')});db['AnalyticMetric'][_0xe8fa('0x10b')](db[_0xe8fa('0x99')],{'as':_0xe8fa('0x1bc'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x1bd')});db[_0xe8fa('0x99')][_0xe8fa('0x11d')](db[_0xe8fa('0x1be')],{'foreignKey':'MetricId'});db[_0xe8fa('0x9c')]['hasMany'](db[_0xe8fa('0x9e')],{'as':_0xe8fa('0x1bf'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xe8fa('0x9e')][_0xe8fa('0x10b')](db[_0xe8fa('0xa0')],{'as':_0xe8fa('0x1c0'),'onDelete':'cascade','foreignKey':_0xe8fa('0x1c1')});db['SalesforceConfiguration'][_0xe8fa('0x10b')](db[_0xe8fa('0xa0')],{'as':_0xe8fa('0x1c2'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x1c3')});db['SalesforceConfiguration']['hasMany'](db[_0xe8fa('0xa0')],{'as':_0xe8fa('0x1bc'),'onDelete':_0xe8fa('0x106'),'foreignKey':'FieldId'});db[_0xe8fa('0x9e')]['belongsTo'](db[_0xe8fa('0x9c')],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x1c4')});db[_0xe8fa('0xa0')][_0xe8fa('0x10b')](db['SalesforceField'],{'as':_0xe8fa('0x1c5'),'foreignKey':_0xe8fa('0x1c1')});db[_0xe8fa('0xa0')]['hasMany'](db[_0xe8fa('0xa0')],{'as':_0xe8fa('0x1c6'),'foreignKey':'DescriptionId'});db[_0xe8fa('0xa0')][_0xe8fa('0x10b')](db[_0xe8fa('0xa0')],{'as':_0xe8fa('0x1c7'),'foreignKey':_0xe8fa('0x1c8')});db[_0xe8fa('0xa0')][_0xe8fa('0x11d')](db[_0xe8fa('0x8d')],{'as':_0xe8fa('0x8d'),'foreignKey':_0xe8fa('0x1c9')});db[_0xe8fa('0x1ca')][_0xe8fa('0x10b')](db[_0xe8fa('0x1cb')],{'as':_0xe8fa('0x1bf'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x1c4')});db[_0xe8fa('0x1cb')]['hasMany'](db[_0xe8fa('0xa4')],{'as':_0xe8fa('0x1c0'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x1c1')});db[_0xe8fa('0x1cb')][_0xe8fa('0x10b')](db[_0xe8fa('0xa4')],{'as':'Descriptions','onDelete':_0xe8fa('0x106'),'foreignKey':'DescriptionId'});db[_0xe8fa('0x1cb')]['hasMany'](db['SugarcrmField'],{'as':_0xe8fa('0x1bc'),'onDelete':_0xe8fa('0x106'),'foreignKey':'FieldId'});db[_0xe8fa('0x1cb')][_0xe8fa('0x11d')](db['SugarcrmAccount'],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x1c4')});db[_0xe8fa('0xa4')][_0xe8fa('0x10b')](db[_0xe8fa('0xa4')],{'as':_0xe8fa('0x1c5'),'foreignKey':_0xe8fa('0x1c1')});db[_0xe8fa('0xa4')]['hasMany'](db[_0xe8fa('0xa4')],{'as':_0xe8fa('0x1c6'),'foreignKey':'DescriptionId'});db['SugarcrmField'][_0xe8fa('0x10b')](db[_0xe8fa('0xa4')],{'as':_0xe8fa('0x1c7'),'foreignKey':'FieldId'});db[_0xe8fa('0xa4')][_0xe8fa('0x11d')](db[_0xe8fa('0x8d')],{'as':_0xe8fa('0x8d'),'foreignKey':_0xe8fa('0x1c9')});db['DeskAccount'][_0xe8fa('0x10b')](db[_0xe8fa('0x1cc')],{'as':_0xe8fa('0x1bf'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x1c4')});db['DeskConfiguration'][_0xe8fa('0x10b')](db[_0xe8fa('0xa8')],{'as':_0xe8fa('0x1c0'),'onDelete':_0xe8fa('0x106'),'foreignKey':'SubjectId'});db[_0xe8fa('0x1cc')][_0xe8fa('0x10b')](db[_0xe8fa('0xa8')],{'as':_0xe8fa('0x1c2'),'onDelete':'cascade','foreignKey':_0xe8fa('0x1c3')});db[_0xe8fa('0x1cc')][_0xe8fa('0x10b')](db[_0xe8fa('0xa8')],{'as':'Fields','onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x1c8')});db[_0xe8fa('0x1cc')][_0xe8fa('0x11d')](db['DeskAccount'],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x1c4')});db['DeskConfiguration'][_0xe8fa('0x11f')](db[_0xe8fa('0x83')],{'through':_0xe8fa('0x1cd')});db[_0xe8fa('0xa8')][_0xe8fa('0x10b')](db[_0xe8fa('0xa8')],{'as':_0xe8fa('0x1c5'),'foreignKey':'SubjectId'});db['DeskField'][_0xe8fa('0x10b')](db[_0xe8fa('0xa8')],{'as':_0xe8fa('0x1c6'),'foreignKey':_0xe8fa('0x1c3')});db['DeskField'][_0xe8fa('0x10b')](db[_0xe8fa('0xa8')],{'as':_0xe8fa('0x1c7'),'foreignKey':_0xe8fa('0x1c8')});db[_0xe8fa('0xa8')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0xe8fa('0x1c9')});db[_0xe8fa('0xa9')][_0xe8fa('0x10b')](db['ZohoConfiguration'],{'as':_0xe8fa('0x1bf'),'onDelete':_0xe8fa('0x106'),'foreignKey':'AccountId'});db[_0xe8fa('0x1ce')][_0xe8fa('0x10b')](db[_0xe8fa('0xac')],{'as':'Subjects','onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x1c1')});db[_0xe8fa('0x1ce')][_0xe8fa('0x10b')](db[_0xe8fa('0xac')],{'as':_0xe8fa('0x1c2'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x1c3')});db[_0xe8fa('0x1ce')][_0xe8fa('0x10b')](db[_0xe8fa('0xac')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xe8fa('0x1c8')});db['ZohoConfiguration'][_0xe8fa('0x11d')](db[_0xe8fa('0xa9')],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x1c4')});db[_0xe8fa('0xac')]['hasMany'](db[_0xe8fa('0xac')],{'as':_0xe8fa('0x1c5'),'foreignKey':'SubjectId'});db[_0xe8fa('0xac')][_0xe8fa('0x10b')](db[_0xe8fa('0xac')],{'as':'Description','foreignKey':_0xe8fa('0x1c3')});db[_0xe8fa('0xac')][_0xe8fa('0x10b')](db[_0xe8fa('0xac')],{'as':'Field','foreignKey':_0xe8fa('0x1c8')});db['ZohoField']['belongsTo'](db[_0xe8fa('0x8d')],{'as':'Variable','foreignKey':'VariableId'});db[_0xe8fa('0x1cf')][_0xe8fa('0x10b')](db['ZendeskConfiguration'],{'as':_0xe8fa('0x1bf'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x1c4')});db[_0xe8fa('0xae')][_0xe8fa('0x10b')](db['ZendeskField'],{'as':'Subjects','foreignKey':_0xe8fa('0x1c1')});db[_0xe8fa('0xae')][_0xe8fa('0x10b')](db['ZendeskField'],{'as':_0xe8fa('0x1c2'),'foreignKey':_0xe8fa('0x1c3')});db[_0xe8fa('0xae')][_0xe8fa('0x10b')](db[_0xe8fa('0xaf')],{'as':_0xe8fa('0x1bc'),'foreignKey':_0xe8fa('0x1c8')});db[_0xe8fa('0xae')][_0xe8fa('0x11d')](db[_0xe8fa('0x1cf')],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x1c4')});db[_0xe8fa('0xae')][_0xe8fa('0x11f')](db[_0xe8fa('0x83')],{'through':'int_zendesk_configuration_has_tags'});db[_0xe8fa('0xaf')][_0xe8fa('0x10b')](db[_0xe8fa('0xaf')],{'as':_0xe8fa('0x1c5'),'foreignKey':_0xe8fa('0x1c1')});db[_0xe8fa('0xaf')][_0xe8fa('0x10b')](db['ZendeskField'],{'as':_0xe8fa('0x1c6'),'foreignKey':_0xe8fa('0x1c3')});db[_0xe8fa('0xaf')][_0xe8fa('0x10b')](db[_0xe8fa('0xaf')],{'as':_0xe8fa('0x1c7'),'foreignKey':_0xe8fa('0x1c8')});db['ZendeskField'][_0xe8fa('0x11d')](db[_0xe8fa('0x8d')],{'as':'Variable','foreignKey':_0xe8fa('0x1c9')});db[_0xe8fa('0xb1')][_0xe8fa('0x10b')](db[_0xe8fa('0xb3')],{'as':_0xe8fa('0x1bf'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x1c4')});db[_0xe8fa('0xb3')][_0xe8fa('0x10b')](db[_0xe8fa('0xb5')],{'as':_0xe8fa('0x1c0'),'onDelete':'cascade','foreignKey':_0xe8fa('0x1c1')});db[_0xe8fa('0xb3')]['hasMany'](db['FreshdeskField'],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xe8fa('0x1c3')});db[_0xe8fa('0xb3')][_0xe8fa('0x10b')](db['FreshdeskField'],{'as':_0xe8fa('0x1bc'),'onDelete':_0xe8fa('0x106'),'foreignKey':'FieldId'});db[_0xe8fa('0xb3')][_0xe8fa('0x11d')](db[_0xe8fa('0xb1')],{'as':_0xe8fa('0x170'),'foreignKey':'AccountId'});db[_0xe8fa('0xb3')][_0xe8fa('0x11f')](db[_0xe8fa('0x83')],{'through':_0xe8fa('0x1d0')});db[_0xe8fa('0xb5')][_0xe8fa('0x10b')](db[_0xe8fa('0xb5')],{'as':_0xe8fa('0x1c5'),'foreignKey':_0xe8fa('0x1c1')});db[_0xe8fa('0xb5')]['hasMany'](db[_0xe8fa('0xb5')],{'as':_0xe8fa('0x1c6'),'foreignKey':_0xe8fa('0x1c3')});db[_0xe8fa('0xb5')][_0xe8fa('0x10b')](db['FreshdeskField'],{'as':_0xe8fa('0x1c7'),'foreignKey':_0xe8fa('0x1c8')});db[_0xe8fa('0xb5')][_0xe8fa('0x11d')](db[_0xe8fa('0x8d')],{'as':_0xe8fa('0x8d'),'foreignKey':_0xe8fa('0x1c9')});db[_0xe8fa('0xb6')][_0xe8fa('0x10b')](db[_0xe8fa('0xb8')],{'as':_0xe8fa('0x1bf'),'onDelete':_0xe8fa('0x106'),'foreignKey':'AccountId'});db[_0xe8fa('0xb8')][_0xe8fa('0x10b')](db[_0xe8fa('0xb9')],{'as':'Subjects','foreignKey':_0xe8fa('0x1c1')});db[_0xe8fa('0xb8')]['hasMany'](db[_0xe8fa('0xb9')],{'as':_0xe8fa('0x1c2'),'foreignKey':_0xe8fa('0x1c3')});db[_0xe8fa('0xb8')][_0xe8fa('0x10b')](db['VtigerField'],{'as':_0xe8fa('0x1bc'),'foreignKey':_0xe8fa('0x1c8')});db[_0xe8fa('0xb8')][_0xe8fa('0x11d')](db['VtigerAccount'],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x1c4')});db[_0xe8fa('0xb9')]['hasMany'](db[_0xe8fa('0xb9')],{'as':_0xe8fa('0x1c5'),'foreignKey':_0xe8fa('0x1c1')});db['VtigerField'][_0xe8fa('0x10b')](db[_0xe8fa('0xb9')],{'as':'Description','foreignKey':_0xe8fa('0x1c3')});db[_0xe8fa('0xb9')][_0xe8fa('0x10b')](db['VtigerField'],{'as':_0xe8fa('0x1c7'),'foreignKey':'FieldId'});db[_0xe8fa('0xb9')][_0xe8fa('0x11d')](db[_0xe8fa('0x8d')],{'as':'Variable','foreignKey':_0xe8fa('0x1c9')});db['ServicenowAccount']['hasMany'](db[_0xe8fa('0x1d1')],{'as':_0xe8fa('0x1bf'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x1c4')});db[_0xe8fa('0x1d1')][_0xe8fa('0x10b')](db[_0xe8fa('0xbe')],{'as':_0xe8fa('0x1c0'),'foreignKey':_0xe8fa('0x1c1')});db[_0xe8fa('0x1d1')][_0xe8fa('0x10b')](db[_0xe8fa('0xbe')],{'as':_0xe8fa('0x1c2'),'foreignKey':_0xe8fa('0x1c3')});db[_0xe8fa('0x1d1')][_0xe8fa('0x10b')](db[_0xe8fa('0xbe')],{'as':_0xe8fa('0x1bc'),'foreignKey':_0xe8fa('0x1c8')});db['ServicenowConfiguration'][_0xe8fa('0x11d')](db[_0xe8fa('0xbb')],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x1c4')});db[_0xe8fa('0xbe')][_0xe8fa('0x10b')](db[_0xe8fa('0xbe')],{'as':_0xe8fa('0x1c5'),'foreignKey':_0xe8fa('0x1c1')});db[_0xe8fa('0xbe')][_0xe8fa('0x10b')](db['ServicenowField'],{'as':_0xe8fa('0x1c6'),'foreignKey':'DescriptionId'});db[_0xe8fa('0xbe')][_0xe8fa('0x10b')](db[_0xe8fa('0xbe')],{'as':_0xe8fa('0x1c7'),'foreignKey':'FieldId'});db[_0xe8fa('0xbe')][_0xe8fa('0x11d')](db[_0xe8fa('0x8d')],{'as':'Variable','foreignKey':_0xe8fa('0x1c9')});db[_0xe8fa('0xbf')]['hasMany'](db[_0xe8fa('0x1d2')],{'as':_0xe8fa('0x1bf'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x1c4')});db[_0xe8fa('0xbf')][_0xe8fa('0x11d')](db[_0xe8fa('0x163')],{'as':_0xe8fa('0x163'),'foreignKey':_0xe8fa('0x164')});db['Dynamics365Configuration'][_0xe8fa('0x10b')](db[_0xe8fa('0x1d3')],{'as':_0xe8fa('0x1c0'),'onDelete':_0xe8fa('0x106'),'foreignKey':'SubjectId'});db[_0xe8fa('0x1d2')][_0xe8fa('0x10b')](db[_0xe8fa('0x1d3')],{'as':_0xe8fa('0x1c2'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x1c3')});db['Dynamics365Configuration'][_0xe8fa('0x10b')](db[_0xe8fa('0x1d3')],{'as':_0xe8fa('0x1bc'),'onDelete':_0xe8fa('0x106'),'foreignKey':'FieldId'});db[_0xe8fa('0x1d2')][_0xe8fa('0x11d')](db[_0xe8fa('0xbf')],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x1c4')});db['Dynamics365Field'][_0xe8fa('0x10b')](db[_0xe8fa('0x1d3')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xe8fa('0x1d3')][_0xe8fa('0x10b')](db[_0xe8fa('0x1d3')],{'as':_0xe8fa('0x1c6'),'foreignKey':_0xe8fa('0x1c3')});db[_0xe8fa('0x1d3')][_0xe8fa('0x10b')](db[_0xe8fa('0x1d3')],{'as':_0xe8fa('0x1c7'),'foreignKey':'FieldId'});db[_0xe8fa('0x1d3')]['belongsTo'](db[_0xe8fa('0x8d')],{'as':'Variable','foreignKey':_0xe8fa('0x1c9')});db[_0xe8fa('0xc1')][_0xe8fa('0x10b')](db[_0xe8fa('0xc2')],{'as':_0xe8fa('0x1bf'),'onDelete':_0xe8fa('0x106'),'foreignKey':'AccountId'});db[_0xe8fa('0xc2')][_0xe8fa('0x10b')](db[_0xe8fa('0xc4')],{'as':_0xe8fa('0x1c0'),'foreignKey':_0xe8fa('0x1c1')});db[_0xe8fa('0xc2')]['hasMany'](db[_0xe8fa('0xc4')],{'as':'Descriptions','foreignKey':_0xe8fa('0x1c3')});db[_0xe8fa('0xc2')]['hasMany'](db[_0xe8fa('0xc4')],{'as':'Fields','foreignKey':_0xe8fa('0x1c8')});db[_0xe8fa('0xc2')][_0xe8fa('0x11d')](db[_0xe8fa('0xc1')],{'as':'Account','foreignKey':'AccountId'});db[_0xe8fa('0xc4')]['hasMany'](db['FreshsalesField'],{'as':_0xe8fa('0x1c5'),'foreignKey':_0xe8fa('0x1c1')});db['FreshsalesField'][_0xe8fa('0x10b')](db[_0xe8fa('0xc4')],{'as':_0xe8fa('0x1c6'),'foreignKey':_0xe8fa('0x1c3')});db[_0xe8fa('0xc4')][_0xe8fa('0x10b')](db[_0xe8fa('0xc4')],{'as':_0xe8fa('0x1c7'),'foreignKey':_0xe8fa('0x1c8')});db[_0xe8fa('0xc4')][_0xe8fa('0x11d')](db[_0xe8fa('0x8d')],{'as':_0xe8fa('0x8d'),'foreignKey':_0xe8fa('0x1c9')});db[_0xe8fa('0xc8')][_0xe8fa('0x11d')](db[_0xe8fa('0x135')],{});db['ChatQueueReport']['belongsTo'](db[_0xe8fa('0xec')],{'as':_0xe8fa('0x17b'),'foreignKey':_0xe8fa('0x16b')});db[_0xe8fa('0xc8')][_0xe8fa('0x11d')](db['CmContact'],{'as':'Contact','foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0xc8')][_0xe8fa('0x11d')](db['ChatInteraction'],{});db[_0xe8fa('0xc8')][_0xe8fa('0x11d')](db[_0xe8fa('0x63')],{});db['ChatQueueReport'][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{});db[_0xe8fa('0xc8')][_0xe8fa('0x11d')](db[_0xe8fa('0x67')],{});db[_0xe8fa('0xca')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'onDelete':_0xe8fa('0x106'),'foreignKey':'FromId'});db[_0xe8fa('0xca')]['belongsTo'](db[_0xe8fa('0x107')],{'onDelete':_0xe8fa('0x106'),'foreignKey':'ToId'});db[_0xe8fa('0xcc')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0xe8fa('0x1d4'),'onDelete':_0xe8fa('0x106')});db[_0xe8fa('0xcc')][_0xe8fa('0x10b')](db[_0xe8fa('0xcb')],{'foreignKey':_0xe8fa('0x1d4'),'onDelete':'cascade'});db[_0xe8fa('0xce')][_0xe8fa('0x11d')](db['SmsAccount'],{});db[_0xe8fa('0xce')][_0xe8fa('0x11d')](db[_0xe8fa('0xec')],{'as':'List','foreignKey':_0xe8fa('0x16b')});db[_0xe8fa('0xce')][_0xe8fa('0x11d')](db[_0xe8fa('0x6d')],{'as':_0xe8fa('0x15f'),'foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0xce')]['belongsTo'](db[_0xe8fa('0x113')],{});db[_0xe8fa('0xce')][_0xe8fa('0x11d')](db[_0xe8fa('0x53')],{});db[_0xe8fa('0xce')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{});db[_0xe8fa('0xce')]['belongsTo'](db[_0xe8fa('0x130')],{});db[_0xe8fa('0x1d5')][_0xe8fa('0x10b')](db[_0xe8fa('0xcc')],{'foreignKey':_0xe8fa('0x1d6')});db[_0xe8fa('0x1d5')][_0xe8fa('0x10b')](db[_0xe8fa('0x1d7')],{'foreignKey':_0xe8fa('0x1d6')});db[_0xe8fa('0x1d5')]['hasMany'](db[_0xe8fa('0xcb')],{'foreignKey':_0xe8fa('0x1d6')});db['Team']['belongsToMany'](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x153'),'through':_0xe8fa('0x124')});db[_0xe8fa('0xdb')]['belongsToMany'](db[_0xe8fa('0x1a')],{'through':_0xe8fa('0x155'),'as':'VoiceQueues'});db['Team'][_0xe8fa('0x11f')](db[_0xe8fa('0x39')],{'through':'team_has_mail_queues','as':'MailQueues'});db[_0xe8fa('0xdb')]['belongsToMany'](db['ChatQueue'],{'through':'team_has_chat_queues','as':_0xe8fa('0x12e')});db[_0xe8fa('0xdb')][_0xe8fa('0x11f')](db[_0xe8fa('0x4b')],{'through':_0xe8fa('0x183'),'as':_0xe8fa('0x12f')});db['Team']['belongsToMany'](db['SmsQueue'],{'through':_0xe8fa('0x188'),'as':'SmsQueues'});db[_0xe8fa('0xdb')][_0xe8fa('0x11f')](db[_0xe8fa('0x132')],{'through':_0xe8fa('0x1d8'),'as':_0xe8fa('0x133')});db[_0xe8fa('0xdb')]['belongsToMany'](db['WhatsappQueue'],{'through':_0xe8fa('0x1d9'),'as':'WhatsappQueues'});db[_0xe8fa('0xdb')][_0xe8fa('0x11f')](db[_0xe8fa('0xee')],{'through':_0xe8fa('0x100'),'as':_0xe8fa('0x1da')});db[_0xe8fa('0xde')]['hasMany'](db[_0xe8fa('0x11a')],{'as':_0xe8fa('0x11b'),'foreignKey':_0xe8fa('0x19f')});db[_0xe8fa('0xde')]['hasMany'](db[_0xe8fa('0x10f')],{'as':'HopperFinals','foreignKey':'CampaignId'});db[_0xe8fa('0xde')]['hasMany'](db[_0xe8fa('0x73')],{'as':_0xe8fa('0x147'),'foreignKey':_0xe8fa('0x19f')});db[_0xe8fa('0xde')][_0xe8fa('0x10b')](db[_0xe8fa('0x70')],{'as':'HopperBlacks','foreignKey':_0xe8fa('0x19f')});db[_0xe8fa('0xde')][_0xe8fa('0x11d')](db[_0xe8fa('0x26')],{'as':_0xe8fa('0x26'),'foreignKey':_0xe8fa('0x14b')});db[_0xe8fa('0xde')][_0xe8fa('0x11d')](db[_0xe8fa('0x26')],{'as':_0xe8fa('0x14c'),'foreignKey':_0xe8fa('0x14d')});db[_0xe8fa('0xde')][_0xe8fa('0x11d')](db[_0xe8fa('0x14e')],{'as':_0xe8fa('0x14e'),'foreignKey':'IntervalId'});db['Campaign'][_0xe8fa('0x11d')](db[_0xe8fa('0xd6')],{'as':_0xe8fa('0xd6'),'foreignKey':_0xe8fa('0x1db')});db[_0xe8fa('0xde')][_0xe8fa('0x11f')](db[_0xe8fa('0xec')],{'as':'Lists','through':_0xe8fa('0x1dc')});db['Campaign']['belongsToMany'](db[_0xe8fa('0xec')],{'as':_0xe8fa('0x156'),'through':_0xe8fa('0x1dd')});db[_0xe8fa('0xe1')][_0xe8fa('0x11d')](db[_0xe8fa('0x65')],{'as':_0xe8fa('0x65'),'foreignKey':_0xe8fa('0x179')});db[_0xe8fa('0xe5')][_0xe8fa('0x11d')](db[_0xe8fa('0x3e')],{});db[_0xe8fa('0xe5')]['belongsTo'](db[_0xe8fa('0x3c')],{});db[_0xe8fa('0xe5')][_0xe8fa('0x11d')](db[_0xe8fa('0x139')],{'foreignKey':_0xe8fa('0x1de'),'as':'FromAccount'});db[_0xe8fa('0xe5')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'foreignKey':_0xe8fa('0x1df'),'as':_0xe8fa('0x1e0')});db[_0xe8fa('0xe5')][_0xe8fa('0x11d')](db['User'],{'foreignKey':_0xe8fa('0x1e1'),'as':_0xe8fa('0x1e2')});db['MailTransferReport'][_0xe8fa('0x11d')](db[_0xe8fa('0x39')],{'foreignKey':_0xe8fa('0x1e3'),'as':_0xe8fa('0x1e4')});db[_0xe8fa('0xe5')][_0xe8fa('0x11d')](db[_0xe8fa('0x139')],{'foreignKey':_0xe8fa('0x1e5'),'as':'ToAccount'});db[_0xe8fa('0xe7')][_0xe8fa('0x11d')](db[_0xe8fa('0x63')],{});db[_0xe8fa('0xe7')]['belongsTo'](db['ChatInteraction'],{});db[_0xe8fa('0xe7')][_0xe8fa('0x11d')](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':_0xe8fa('0x1e6')});db['ChatTransferReport'][_0xe8fa('0x11d')](db['User'],{'foreignKey':_0xe8fa('0x1df'),'as':_0xe8fa('0x1e0')});db[_0xe8fa('0xe7')]['belongsTo'](db['User'],{'foreignKey':_0xe8fa('0x1e1'),'as':_0xe8fa('0x1e2')});db[_0xe8fa('0xe7')]['belongsTo'](db[_0xe8fa('0x67')],{'foreignKey':'ToChatQueueId','as':_0xe8fa('0x1e4')});db[_0xe8fa('0xe7')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0xe8fa('0x1e7'),'as':_0xe8fa('0x1e8')});db[_0xe8fa('0xe9')][_0xe8fa('0x11d')](db[_0xe8fa('0x4a')],{});db[_0xe8fa('0xe9')][_0xe8fa('0x11d')](db['FaxInteraction'],{});db[_0xe8fa('0xe9')]['belongsTo'](db[_0xe8fa('0x46')],{'foreignKey':_0xe8fa('0x1e9'),'as':'FromAccount'});db[_0xe8fa('0xe9')][_0xe8fa('0x11d')](db['User'],{'foreignKey':_0xe8fa('0x1df'),'as':_0xe8fa('0x1e0')});db[_0xe8fa('0xe9')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'foreignKey':_0xe8fa('0x1e1'),'as':'ToAgent'});db[_0xe8fa('0xe9')][_0xe8fa('0x11d')](db[_0xe8fa('0x4b')],{'foreignKey':'ToFaxQueueId','as':_0xe8fa('0x1e4')});db[_0xe8fa('0xe9')][_0xe8fa('0x11d')](db[_0xe8fa('0x46')],{'foreignKey':'ToFaxAccountId','as':_0xe8fa('0x1e8')});db[_0xe8fa('0x1ea')][_0xe8fa('0x11d')](db['OpenchannelMessage'],{});db[_0xe8fa('0x1ea')][_0xe8fa('0x11d')](db[_0xe8fa('0x5a')],{});db[_0xe8fa('0x1ea')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0xe8fa('0x1eb'),'as':_0xe8fa('0x1e6')});db[_0xe8fa('0x1ea')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'foreignKey':_0xe8fa('0x1df'),'as':_0xe8fa('0x1e0')});db[_0xe8fa('0x1ea')]['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':_0xe8fa('0x1e2')});db['OpenchannelTransferReport'][_0xe8fa('0x11d')](db[_0xe8fa('0x132')],{'foreignKey':_0xe8fa('0x1ec'),'as':_0xe8fa('0x1e4')});db['OpenchannelTransferReport'][_0xe8fa('0x11d')](db[_0xe8fa('0x56')],{'foreignKey':_0xe8fa('0x1ed'),'as':'ToAccount'});db[_0xe8fa('0x1ee')][_0xe8fa('0x11d')](db['SmsMessage'],{});db[_0xe8fa('0x1ee')][_0xe8fa('0x11d')](db[_0xe8fa('0x113')],{});db[_0xe8fa('0x1ee')][_0xe8fa('0x11d')](db['SmsAccount'],{'foreignKey':_0xe8fa('0x1ef'),'as':_0xe8fa('0x1e6')});db[_0xe8fa('0x1ee')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'foreignKey':_0xe8fa('0x1df'),'as':_0xe8fa('0x1e0')});db['SmsTransferReport'][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'foreignKey':_0xe8fa('0x1e1'),'as':'ToAgent'});db[_0xe8fa('0x1ee')][_0xe8fa('0x11d')](db[_0xe8fa('0x130')],{'foreignKey':_0xe8fa('0x1f0'),'as':_0xe8fa('0x1e4')});db['SmsTransferReport'][_0xe8fa('0x11d')](db[_0xe8fa('0x4f')],{'foreignKey':'ToSmsAccountId','as':_0xe8fa('0x1e8')});db[_0xe8fa('0xec')]['hasMany'](db[_0xe8fa('0x7b')],{'as':_0xe8fa('0x167'),'foreignKey':_0xe8fa('0x16b'),'onDelete':'cascade'});db[_0xe8fa('0xec')][_0xe8fa('0x10b')](db[_0xe8fa('0x76')],{'as':_0xe8fa('0x1f1'),'foreignKey':'ListId'});db['CmList'][_0xe8fa('0x10b')](db['CmContact'],{'as':_0xe8fa('0x122'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x16b')});db[_0xe8fa('0xec')][_0xe8fa('0x10b')](db[_0xe8fa('0x10f')],{'as':_0xe8fa('0x110'),'foreignKey':_0xe8fa('0x16b')});db[_0xe8fa('0xec')]['hasMany'](db[_0xe8fa('0x73')],{'as':'HopperHistory','foreignKey':_0xe8fa('0x16b')});db['CmList']['hasMany'](db[_0xe8fa('0x148')],{'as':_0xe8fa('0x148'),'foreignKey':_0xe8fa('0x16b')});db['CmList'][_0xe8fa('0x11f')](db[_0xe8fa('0x1a')],{'as':'Queues','through':_0xe8fa('0x152')});db[_0xe8fa('0xec')][_0xe8fa('0x11f')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x153'),'through':_0xe8fa('0x123')});db[_0xe8fa('0xee')][_0xe8fa('0x10b')](db[_0xe8fa('0x18')],{'as':_0xe8fa('0x1ac'),'onDelete':_0xe8fa('0x106')});db[_0xe8fa('0xee')][_0xe8fa('0x11f')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x153'),'through':_0xe8fa('0x12d')});db[_0xe8fa('0xee')][_0xe8fa('0x11f')](db[_0xe8fa('0xdb')],{'through':_0xe8fa('0x100'),'as':'Teams'});db[_0xe8fa('0x11e')][_0xe8fa('0x10b')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x181'),'foreignKey':_0xe8fa('0x1f2')});db[_0xe8fa('0x11e')][_0xe8fa('0x10b')](db[_0xe8fa('0xf0')],{'as':_0xe8fa('0x1f3'),'foreignKey':_0xe8fa('0x1f2'),'onDelete':_0xe8fa('0x106')});db[_0xe8fa('0xf0')]['hasMany'](db[_0xe8fa('0x1f4')],{'as':_0xe8fa('0x1f5'),'foreignKey':_0xe8fa('0x1f6'),'onDelete':_0xe8fa('0x106')});db[_0xe8fa('0xf5')][_0xe8fa('0x10b')](db[_0xe8fa('0x7b')],{'as':_0xe8fa('0x167'),'foreignKey':_0xe8fa('0x1f7'),'onDelete':_0xe8fa('0x106')});db['WhatsappAccount'][_0xe8fa('0x10b')](db[_0xe8fa('0x168')],{'as':_0xe8fa('0x169'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0xe8fa('0x10b')](db[_0xe8fa('0x1f8')],{'as':'Messages','foreignKey':_0xe8fa('0x1f7')});db[_0xe8fa('0xf5')][_0xe8fa('0x10b')](db[_0xe8fa('0x12a')],{'as':_0xe8fa('0x16a')});db[_0xe8fa('0xf5')]['hasMany'](db[_0xe8fa('0xf6')],{'as':_0xe8fa('0x141'),'foreignKey':_0xe8fa('0x1f7'),'onDelete':_0xe8fa('0x106')});db['WhatsappAccount'][_0xe8fa('0x11d')](db[_0xe8fa('0xec')],{'as':'List','foreignKey':_0xe8fa('0x16b')});db[_0xe8fa('0xf5')][_0xe8fa('0x11d')](db['Pause'],{'as':_0xe8fa('0x16d'),'foreignKey':_0xe8fa('0x150')});db[_0xe8fa('0xf5')][_0xe8fa('0x11f')](db['User'],{'as':'Agents','through':_0xe8fa('0x13f')});db[_0xe8fa('0xf6')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'onDelete':'restrict'});db[_0xe8fa('0xf6')]['belongsTo'](db['WhatsappQueue'],{'onDelete':'restrict'});db[_0xe8fa('0xf6')][_0xe8fa('0x11d')](db[_0xe8fa('0xf5')],{'onDelete':_0xe8fa('0x165')});db[_0xe8fa('0xf6')][_0xe8fa('0x11d')](db[_0xe8fa('0x14e')],{'onDelete':'restrict','foreignKey':_0xe8fa('0x17a')});db[_0xe8fa('0xf6')][_0xe8fa('0x11d')](db[_0xe8fa('0x83')],{'onDelete':'restrict','foreignKey':_0xe8fa('0x17e')});db[_0xe8fa('0x12a')][_0xe8fa('0x10b')](db[_0xe8fa('0x1f8')],{'as':'Messages','onDelete':_0xe8fa('0x106'),'foreignKey':'WhatsappInteractionId'});db[_0xe8fa('0x12a')][_0xe8fa('0x11d')](db['WhatsappAccount'],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x1f7')});db['WhatsappInteraction']['belongsTo'](db[_0xe8fa('0x6d')],{'as':_0xe8fa('0x15f'),'foreignKey':'ContactId'});db[_0xe8fa('0x12a')][_0xe8fa('0x11d')](db['User'],{'as':_0xe8fa('0x171'),'foreignKey':_0xe8fa('0x10a')});db[_0xe8fa('0x12a')][_0xe8fa('0x11f')](db[_0xe8fa('0x83')],{'through':_0xe8fa('0x1b3'),'as':_0xe8fa('0x172')});db[_0xe8fa('0x12a')][_0xe8fa('0x11f')](db['Tag'],{'through':_0xe8fa('0x1b3'),'as':_0xe8fa('0x174')});db['WhatsappInteraction'][_0xe8fa('0x11f')](db[_0xe8fa('0x107')],{'as':'Users','through':_0xe8fa('0x1f9'),'foreignKey':_0xe8fa('0x1fa')});db[_0xe8fa('0x1f8')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x107')});db['WhatsappMessage'][_0xe8fa('0x11d')](db[_0xe8fa('0x6d')],{'onDelete':_0xe8fa('0x106'),'as':_0xe8fa('0x15f')});db['WhatsappMessage'][_0xe8fa('0x11d')](db[_0xe8fa('0x12a')],{'onDelete':_0xe8fa('0x106'),'as':_0xe8fa('0x177'),'foreignKey':_0xe8fa('0x1fa')});db[_0xe8fa('0x1f8')][_0xe8fa('0x11d')](db[_0xe8fa('0xf5')],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x1f7')});db[_0xe8fa('0x1fb')][_0xe8fa('0x11d')](db['WhatsappAccount'],{});db[_0xe8fa('0x1fb')][_0xe8fa('0x11d')](db[_0xe8fa('0xec')],{'as':_0xe8fa('0x17b'),'foreignKey':'ListId'});db[_0xe8fa('0x1fb')][_0xe8fa('0x11d')](db['CmContact'],{'as':'Contact','foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0x1fb')][_0xe8fa('0x11d')](db[_0xe8fa('0x12a')],{});db[_0xe8fa('0x1fb')]['belongsTo'](db[_0xe8fa('0xfd')],{});db[_0xe8fa('0x1fb')]['belongsTo'](db[_0xe8fa('0x1f8')],{});db[_0xe8fa('0x1fb')]['belongsTo'](db[_0xe8fa('0x107')],{});db['WhatsappTransferReport'][_0xe8fa('0x11d')](db[_0xe8fa('0x1f8')],{});db['WhatsappTransferReport']['belongsTo'](db[_0xe8fa('0x12a')],{});db[_0xe8fa('0xfb')][_0xe8fa('0x11d')](db[_0xe8fa('0xf5')],{'foreignKey':_0xe8fa('0x1fc'),'as':_0xe8fa('0x1e6')});db[_0xe8fa('0xfb')][_0xe8fa('0x11d')](db[_0xe8fa('0xf5')],{'foreignKey':'ToWhatsappAccountId','as':_0xe8fa('0x1e8')});db[_0xe8fa('0xfb')][_0xe8fa('0x11d')](db['WhatsappQueue'],{'foreignKey':_0xe8fa('0x1fd'),'as':_0xe8fa('0x1e4')});db[_0xe8fa('0xfb')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'foreignKey':_0xe8fa('0x1df'),'as':_0xe8fa('0x1e0')});db['WhatsappTransferReport'][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'foreignKey':_0xe8fa('0x1e1'),'as':_0xe8fa('0x1e2')});db['WhatsappQueue']['belongsToMany'](db[_0xe8fa('0x107')],{'as':'Agents','through':_0xe8fa('0x35'),'foreignKey':'WhatsappQueueId'});db[_0xe8fa('0xfd')][_0xe8fa('0x11f')](db[_0xe8fa('0xdb')],{'through':_0xe8fa('0x1d9'),'as':_0xe8fa('0x154')});db[_0xe8fa('0x108')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x1fe'),'foreignKey':_0xe8fa('0x10a'),'onDelete':_0xe8fa('0x106'),'hooks':!![]});db['CloudProvider'][_0xe8fa('0x105')](db['Dynamics365Account'],{'as':_0xe8fa('0xbf'),'onDelete':_0xe8fa('0x165')});db['CloudProvider'][_0xe8fa('0x105')](db[_0xe8fa('0x162')],{'as':_0xe8fa('0x166'),'onDelete':_0xe8fa('0x165')});db['CloudProvider']['hasOne'](db[_0xe8fa('0x36')],{'as':'Smtp','onDelete':'restrict'});module[_0xe8fa('0x1ff')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 825a4ae..affcda0 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa9f=['/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','./api/license','./api/campaign','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/cloudProviders','./api/cloudProvider','/api/realtime','/api/user-settings','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','/api/rpc','./api/rpc','./api/version','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','join','/apidoc','/www','static','root','/snippet','snippet','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','default','then','use','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','./api/mailMessage','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/cm/companies','./api/cmCompany','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/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/templates','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport'];(function(_0x4d09cb,_0x410341){var _0x64958b=function(_0x3ed018){while(--_0x3ed018){_0x4d09cb['push'](_0x4d09cb['shift']());}};_0x64958b(++_0x410341);}(_0xfa9f,0x93));var _0xffa9=function(_0x170772,_0x1f1ee7){_0x170772=_0x170772-0x0;var _0x3ef69c=_0xfa9f[_0x170772];return _0x3ef69c;};'use strict';var path=require('path');var express=require(_0xffa9('0x0'));var errors=require(_0xffa9('0x1'));var config=require(_0xffa9('0x2'));var setupLoggers=require(_0xffa9('0x3'))[_0xffa9('0x4')];var clientSideLogs=require('./api/client-side-logs');exports[_0xffa9('0x5')]=function(_0x5bed37){return setupLoggers(_0x5bed37)[_0xffa9('0x6')](function(){_0x5bed37[_0xffa9('0x7')]('/api/users',require(_0xffa9('0x8')));_0x5bed37['use']('/api/voice/chanspy',require(_0xffa9('0x9')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xa'),require(_0xffa9('0xb')));_0x5bed37['use'](_0xffa9('0xc'),require(_0xffa9('0xd')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xe'),require(_0xffa9('0xf')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x10'),require(_0xffa9('0x11')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x12'),require(_0xffa9('0x13')));_0x5bed37['use'](_0xffa9('0x14'),require(_0xffa9('0x15')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x16'),require(_0xffa9('0x17')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x18'),require(_0xffa9('0x19')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x1a'),require('./api/voiceCallReport'));_0x5bed37[_0xffa9('0x7')]('/api/voice/dials/reports',require(_0xffa9('0x1b')));_0x5bed37[_0xffa9('0x7')]('/api/voice/agents/reports',require(_0xffa9('0x1c')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x1d'),require('./api/voiceQueueReport'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x1e'),require(_0xffa9('0x1f')));_0x5bed37[_0xffa9('0x7')]('/api/trunks',require(_0xffa9('0x20')));_0x5bed37['use'](_0xffa9('0x21'),require(_0xffa9('0x22')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x23'),require(_0xffa9('0x24')));_0x5bed37[_0xffa9('0x7')]('/api/mail/accounts',require(_0xffa9('0x25')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x26'),require(_0xffa9('0x27')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x28'),require(_0xffa9('0x29')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x2a'),require('./api/mailInteraction'));_0x5bed37['use'](_0xffa9('0x2b'),require(_0xffa9('0x2c')));_0x5bed37[_0xffa9('0x7')]('/api/mail/applications',require('./api/mailApplication'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x2d'),require(_0xffa9('0x2e')));_0x5bed37['use']('/api/dashboards',require(_0xffa9('0x2f')));_0x5bed37['use'](_0xffa9('0x30'),require(_0xffa9('0x31')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x32'),require(_0xffa9('0x33')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x34'),require('./api/faxApplication'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x35'),require(_0xffa9('0x36')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x37'),require(_0xffa9('0x38')));_0x5bed37['use']('/api/fax/queues',require(_0xffa9('0x39')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x3a'),require(_0xffa9('0x3b')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x3c'),require(_0xffa9('0x3d')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x3e'),require('./api/smsApplication'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x3f'),require(_0xffa9('0x40')));_0x5bed37['use'](_0xffa9('0x41'),require(_0xffa9('0x42')));_0x5bed37[_0xffa9('0x7')]('/api/sms/queues',require(_0xffa9('0x43')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x44'),require('./api/openchannelAccount'));_0x5bed37[_0xffa9('0x7')]('/api/openchannel/applications',require('./api/openchannelApplication'));_0x5bed37[_0xffa9('0x7')]('/api/openchannel/interactions',require(_0xffa9('0x45')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x46'),require(_0xffa9('0x47')));_0x5bed37[_0xffa9('0x7')]('/api/openchannel/queues',require(_0xffa9('0x48')));_0x5bed37['use']('/api/chat/websites',require(_0xffa9('0x49')));_0x5bed37['use'](_0xffa9('0x4a'),require(_0xffa9('0x4b')));_0x5bed37['use']('/api/chat/applications',require(_0xffa9('0x4c')));_0x5bed37['use'](_0xffa9('0x4d'),require(_0xffa9('0x4e')));_0x5bed37['use']('/api/chat/messages',require('./api/chatMessage'));_0x5bed37['use'](_0xffa9('0x4f'),require(_0xffa9('0x50')));_0x5bed37[_0xffa9('0x7')]('/api/chat/queues',require(_0xffa9('0x51')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x52'),require(_0xffa9('0x53')));_0x5bed37[_0xffa9('0x7')]('/api/chat/proactive_actions',require('./api/chatProactiveAction'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x54'),require(_0xffa9('0x55')));_0x5bed37[_0xffa9('0x7')]('/api/cm/contacts',require(_0xffa9('0x56')));_0x5bed37[_0xffa9('0x7')]('/api/cm/hopper',require(_0xffa9('0x57')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x58'),require('./api/cmHopperBlack'));_0x5bed37['use'](_0xffa9('0x59'),require(_0xffa9('0x5a')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x5b'),require('./api/cmHopperHistory'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x5c'),require(_0xffa9('0x5d')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x5e'),require(_0xffa9('0x5f')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x60'),require(_0xffa9('0x61')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x62'),require(_0xffa9('0x63')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x64'),require(_0xffa9('0x65')));_0x5bed37['use']('/api/conditions',require(_0xffa9('0x66')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x67'),require(_0xffa9('0x68')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x69'),require('./api/pause'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x6a'),require('./api/cdr'));_0x5bed37['use'](_0xffa9('0x6b'),require(_0xffa9('0x6c')));_0x5bed37[_0xffa9('0x7')]('/api/schedules',require('./api/schedule'));_0x5bed37['use'](_0xffa9('0x6d'),require(_0xffa9('0x6e')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x6f'),require(_0xffa9('0x70')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x71'),require('./api/contactItemType'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x72'),require(_0xffa9('0x73')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x74'),require(_0xffa9('0x75')));_0x5bed37['use'](_0xffa9('0x76'),require('./api/template'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x77'),require(_0xffa9('0x78')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x79'),require(_0xffa9('0x7a')));_0x5bed37['use']('/api/integrations',require('./api/integration'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x7b'),require('./api/integrationReport'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x7c'),require(_0xffa9('0x7d')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x7e'),require(_0xffa9('0x7f')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x80'),require(_0xffa9('0x81')));_0x5bed37[_0xffa9('0x7')]('/api/analytics/metrics',require(_0xffa9('0x82')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x83'),require(_0xffa9('0x84')));_0x5bed37['use'](_0xffa9('0x85'),require(_0xffa9('0x86')));_0x5bed37[_0xffa9('0x7')]('/api/integrations/salesforce/accounts',require(_0xffa9('0x87')));_0x5bed37[_0xffa9('0x7')]('/api/integrations/salesforce/configurations',require('./api/intSalesforceConfiguration'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x88'),require(_0xffa9('0x89')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x8a'),require('./api/intSugarcrmAccount'));_0x5bed37['use']('/api/integrations/sugarcrm/configurations',require(_0xffa9('0x8b')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x8c'),require(_0xffa9('0x8d')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x8e'),require('./api/intDeskAccount'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x8f'),require(_0xffa9('0x90')));_0x5bed37[_0xffa9('0x7')]('/api/integrations/desk/fields',require(_0xffa9('0x91')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x92'),require(_0xffa9('0x93')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x94'),require(_0xffa9('0x95')));_0x5bed37[_0xffa9('0x7')]('/api/integrations/zoho/fields',require(_0xffa9('0x96')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x97'),require(_0xffa9('0x98')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x99'),require(_0xffa9('0x9a')));_0x5bed37[_0xffa9('0x7')]('/api/integrations/zendesk/fields',require(_0xffa9('0x9b')));_0x5bed37['use'](_0xffa9('0x9c'),require(_0xffa9('0x9d')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x9e'),require('./api/intFreshdeskConfiguration'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x9f'),require(_0xffa9('0xa0')));_0x5bed37['use'](_0xffa9('0xa1'),require(_0xffa9('0xa2')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xa3'),require('./api/intVtigerConfiguration'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xa4'),require('./api/intVtigerField'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xa5'),require(_0xffa9('0xa6')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xa7'),require(_0xffa9('0xa8')));_0x5bed37['use'](_0xffa9('0xa9'),require(_0xffa9('0xaa')));_0x5bed37[_0xffa9('0x7')]('/api/integrations/dynamics365/accounts',require(_0xffa9('0xab')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xac'),require(_0xffa9('0xad')));_0x5bed37['use'](_0xffa9('0xae'),require('./api/intDynamics365Field'));_0x5bed37['use'](_0xffa9('0xaf'),require('./api/intFreshsalesAccount'));_0x5bed37['use'](_0xffa9('0xb0'),require(_0xffa9('0xb1')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xb2'),require(_0xffa9('0xb3')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xb4'),require(_0xffa9('0xb5')));_0x5bed37[_0xffa9('0x7')]('/api/chat/reports/queue',require(_0xffa9('0xb6')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xb7'),require('./api/chatInternalMessage'));_0x5bed37['use']('/api/jscripty/answers/reports',require(_0xffa9('0xb8')));_0x5bed37['use'](_0xffa9('0xb9'),require(_0xffa9('0xba')));_0x5bed37['use'](_0xffa9('0xbb'),require(_0xffa9('0xbc')));_0x5bed37[_0xffa9('0x7')]('/api/sms/reports/queue',require(_0xffa9('0xbd')));_0x5bed37['use'](_0xffa9('0xbe'),require(_0xffa9('0xbf')));_0x5bed37['use']('/api/square/details/reports',require(_0xffa9('0xc0')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xc1'),require('./api/jscriptyProject'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xc2'),require('./api/setting'));_0x5bed37['use']('/api/square/odbc',require(_0xffa9('0xc3')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xc4'),require(_0xffa9('0xc5')));_0x5bed37['use'](_0xffa9('0xc6'),require(_0xffa9('0xc7')));_0x5bed37[_0xffa9('0x7')]('/api/square/messages',require(_0xffa9('0xc8')));_0x5bed37[_0xffa9('0x7')]('/api/teams',require('./api/team'));_0x5bed37[_0xffa9('0x7')]('/api/license',require(_0xffa9('0xc9')));_0x5bed37['use']('/api/campaigns',require(_0xffa9('0xca')));_0x5bed37[_0xffa9('0x7')]('/api/migrations',require('./api/migration'));_0x5bed37['use'](_0xffa9('0xcb'),require(_0xffa9('0xcc')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xcd'),require(_0xffa9('0xce')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xcf'),require(_0xffa9('0xd0')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xd1'),require(_0xffa9('0xd2')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xd3'),require(_0xffa9('0xd4')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xd5'),require(_0xffa9('0xd6')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xd7'),require(_0xffa9('0xd8')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xd9'),require(_0xffa9('0xda')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xdb'),require(_0xffa9('0xdc')));_0x5bed37['use'](_0xffa9('0xdd'),require(_0xffa9('0xde')));_0x5bed37[_0xffa9('0x7')]('/api/userProfile/sections',require(_0xffa9('0xdf')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xe0'),require(_0xffa9('0xe1')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xe2'),require(_0xffa9('0xe3')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xe4'),require('./api/whatsappAccount'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xe5'),require(_0xffa9('0xe6')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xe7'),require(_0xffa9('0xe8')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xe9'),require(_0xffa9('0xea')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xeb'),require(_0xffa9('0xec')));_0x5bed37['use'](_0xffa9('0xed'),require('./api/whatsappTransferReport'));_0x5bed37[_0xffa9('0x7')]('/api/whatsapp/queues',require('./api/whatsappQueue'));_0x5bed37['use'](_0xffa9('0xee'),require(_0xffa9('0xef')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xf0'),require('./api/realtime'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xf1'),require('./api/user-setting'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xf2'),require(_0xffa9('0xf3')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xf4'),require('./api/authLocal'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xf5'),require(_0xffa9('0xf6')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xf7'),require(_0xffa9('0xf8')));_0x5bed37[_0xffa9('0x7')]('/api/jira',require(_0xffa9('0xf9')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xfa'),require(_0xffa9('0xfb')));_0x5bed37[_0xffa9('0x7')]('/api/version',require(_0xffa9('0xfc')));_0x5bed37[_0xffa9('0x7')]('/api/system',require('./api/system'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xfd'),require(_0xffa9('0xfe')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xff'),require(_0xffa9('0x100')));_0x5bed37['use'](_0xffa9('0x101'),clientSideLogs);_0x5bed37[_0xffa9('0x7')]('/apidoc',express['static'](path[_0xffa9('0x102')](config['root'],_0xffa9('0x103'))));_0x5bed37['use'](_0xffa9('0x104'),express[_0xffa9('0x105')](path['join'](config[_0xffa9('0x106')],'/www')));_0x5bed37['use']('/demo',express['static'](path[_0xffa9('0x102')](config['root'],'/demo')));_0x5bed37['use'](_0xffa9('0x107'),express[_0xffa9('0x105')](path['join'](config[_0xffa9('0x106')],_0xffa9('0x108'),'3.10.1')));_0x5bed37[_0xffa9('0x7')]('/plugins',express[_0xffa9('0x105')](path[_0xffa9('0x102')](config[_0xffa9('0x106')],_0xffa9('0x109'))));_0x5bed37[_0xffa9('0x10a')](_0xffa9('0x10b'))[_0xffa9('0x10c')](errors[0x194]);_0x5bed37[_0xffa9('0x10a')]('/*')[_0xffa9('0x10c')](function(_0x5b3df3,_0x46d0f1){_0x46d0f1[_0xffa9('0x10d')](path[_0xffa9('0x10e')](_0x5bed37[_0xffa9('0x10c')](_0xffa9('0x10f'))+_0xffa9('0x110')));});return _0x5bed37;});}; \ No newline at end of file +var _0x1298=['/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','./api/template','/api/triggers','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/mailInteractionHasTag','/api/auth/local','/api/auth/google','/api/auth/activedirectory','/api/jira','./api/jira','./api/rpc','/api/version','/api/system','./api/system','/api/pm2','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','snippet','3.10.1','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','sendFile','resolve','get','express','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','/api/users','./api/user','./api/voiceChanSpy','use','/api/voice/contexts','./api/voiceContext','./api/voiceMusicOnHold','./api/voiceQueue','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/applications','/api/fax/interactions','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatInteraction','/api/chat/messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/actions','./api/action','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType'];(function(_0x2a1a31,_0x1b8b1a){var _0xe175e8=function(_0xa6f2c2){while(--_0xa6f2c2){_0x2a1a31['push'](_0x2a1a31['shift']());}};_0xe175e8(++_0x1b8b1a);}(_0x1298,0x19e));var _0x8129=function(_0x5d284c,_0x9654c8){_0x5d284c=_0x5d284c-0x0;var _0x2c6d31=_0x1298[_0x5d284c];return _0x2c6d31;};'use strict';var path=require('path');var express=require(_0x8129('0x0'));var errors=require('./errors');var config=require(_0x8129('0x1'));var setupLoggers=require(_0x8129('0x2'))[_0x8129('0x3')];var clientSideLogs=require(_0x8129('0x4'));exports[_0x8129('0x5')]=function(_0x31d02a){return setupLoggers(_0x31d02a)[_0x8129('0x6')](function(){_0x31d02a['use'](_0x8129('0x7'),require(_0x8129('0x8')));_0x31d02a['use']('/api/voice/chanspy',require(_0x8129('0x9')));_0x31d02a[_0x8129('0xa')](_0x8129('0xb'),require(_0x8129('0xc')));_0x31d02a[_0x8129('0xa')]('/api/voice/extensions',require('./api/voiceExtension'));_0x31d02a['use']('/api/voice/mohs',require(_0x8129('0xd')));_0x31d02a[_0x8129('0xa')]('/api/voice/queues',require(_0x8129('0xe')));_0x31d02a['use']('/api/voice/recordings',require(_0x8129('0xf')));_0x31d02a['use']('/api/screen/recordings',require(_0x8129('0x10')));_0x31d02a[_0x8129('0xa')](_0x8129('0x11'),require(_0x8129('0x12')));_0x31d02a[_0x8129('0xa')](_0x8129('0x13'),require('./api/voiceMailMessage'));_0x31d02a['use'](_0x8129('0x14'),require('./api/voiceCallReport'));_0x31d02a[_0x8129('0xa')]('/api/voice/dials/reports',require(_0x8129('0x15')));_0x31d02a[_0x8129('0xa')]('/api/voice/agents/reports',require(_0x8129('0x16')));_0x31d02a['use'](_0x8129('0x17'),require(_0x8129('0x18')));_0x31d02a[_0x8129('0xa')]('/api/members/reports',require(_0x8129('0x19')));_0x31d02a[_0x8129('0xa')](_0x8129('0x1a'),require(_0x8129('0x1b')));_0x31d02a[_0x8129('0xa')](_0x8129('0x1c'),require('./api/voiceTransferReport'));_0x31d02a['use'](_0x8129('0x1d'),require('./api/mailServerOut'));_0x31d02a[_0x8129('0xa')](_0x8129('0x1e'),require(_0x8129('0x1f')));_0x31d02a[_0x8129('0xa')](_0x8129('0x20'),require(_0x8129('0x21')));_0x31d02a[_0x8129('0xa')](_0x8129('0x22'),require(_0x8129('0x23')));_0x31d02a[_0x8129('0xa')]('/api/mail/interactions',require(_0x8129('0x24')));_0x31d02a[_0x8129('0xa')](_0x8129('0x25'),require(_0x8129('0x26')));_0x31d02a['use'](_0x8129('0x27'),require(_0x8129('0x28')));_0x31d02a['use'](_0x8129('0x29'),require('./api/mailQueueReport'));_0x31d02a[_0x8129('0xa')](_0x8129('0x2a'),require(_0x8129('0x2b')));_0x31d02a['use'](_0x8129('0x2c'),require(_0x8129('0x2d')));_0x31d02a[_0x8129('0xa')]('/api/fax/accounts',require('./api/faxAccount'));_0x31d02a[_0x8129('0xa')](_0x8129('0x2e'),require('./api/faxApplication'));_0x31d02a[_0x8129('0xa')](_0x8129('0x2f'),require('./api/faxInteraction'));_0x31d02a[_0x8129('0xa')](_0x8129('0x30'),require('./api/faxMessage'));_0x31d02a[_0x8129('0xa')](_0x8129('0x31'),require(_0x8129('0x32')));_0x31d02a[_0x8129('0xa')](_0x8129('0x33'),require(_0x8129('0x34')));_0x31d02a[_0x8129('0xa')](_0x8129('0x35'),require(_0x8129('0x36')));_0x31d02a[_0x8129('0xa')](_0x8129('0x37'),require('./api/smsApplication'));_0x31d02a['use'](_0x8129('0x38'),require(_0x8129('0x39')));_0x31d02a[_0x8129('0xa')](_0x8129('0x3a'),require('./api/smsMessage'));_0x31d02a[_0x8129('0xa')](_0x8129('0x3b'),require(_0x8129('0x3c')));_0x31d02a[_0x8129('0xa')](_0x8129('0x3d'),require('./api/openchannelAccount'));_0x31d02a['use'](_0x8129('0x3e'),require(_0x8129('0x3f')));_0x31d02a[_0x8129('0xa')](_0x8129('0x40'),require('./api/openchannelInteraction'));_0x31d02a['use'](_0x8129('0x41'),require('./api/openchannelMessage'));_0x31d02a[_0x8129('0xa')](_0x8129('0x42'),require(_0x8129('0x43')));_0x31d02a[_0x8129('0xa')](_0x8129('0x44'),require(_0x8129('0x45')));_0x31d02a[_0x8129('0xa')](_0x8129('0x46'),require('./api/openchannelQueueReport'));_0x31d02a[_0x8129('0xa')](_0x8129('0x47'),require('./api/chatApplication'));_0x31d02a['use']('/api/chat/interactions',require(_0x8129('0x48')));_0x31d02a[_0x8129('0xa')](_0x8129('0x49'),require('./api/chatMessage'));_0x31d02a[_0x8129('0xa')]('/api/chat/offline_messages',require(_0x8129('0x4a')));_0x31d02a[_0x8129('0xa')](_0x8129('0x4b'),require(_0x8129('0x4c')));_0x31d02a[_0x8129('0xa')]('/api/chat/groups',require(_0x8129('0x4d')));_0x31d02a[_0x8129('0xa')](_0x8129('0x4e'),require(_0x8129('0x4f')));_0x31d02a[_0x8129('0xa')](_0x8129('0x50'),require(_0x8129('0x51')));_0x31d02a[_0x8129('0xa')](_0x8129('0x52'),require(_0x8129('0x53')));_0x31d02a[_0x8129('0xa')](_0x8129('0x54'),require(_0x8129('0x55')));_0x31d02a[_0x8129('0xa')]('/api/cm/hopper_black',require(_0x8129('0x56')));_0x31d02a[_0x8129('0xa')](_0x8129('0x57'),require(_0x8129('0x58')));_0x31d02a['use']('/api/cm/hopper_history',require(_0x8129('0x59')));_0x31d02a[_0x8129('0xa')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0x31d02a[_0x8129('0xa')](_0x8129('0x5a'),require(_0x8129('0x5b')));_0x31d02a['use']('/api/automations',require(_0x8129('0x5c')));_0x31d02a['use']('/api/canned_answers',require(_0x8129('0x5d')));_0x31d02a[_0x8129('0xa')](_0x8129('0x5e'),require(_0x8129('0x5f')));_0x31d02a['use']('/api/conditions',require(_0x8129('0x60')));_0x31d02a[_0x8129('0xa')]('/api/intervals',require('./api/interval'));_0x31d02a[_0x8129('0xa')]('/api/pauses',require('./api/pause'));_0x31d02a['use']('/api/cdr',require(_0x8129('0x61')));_0x31d02a[_0x8129('0xa')](_0x8129('0x62'),require(_0x8129('0x63')));_0x31d02a[_0x8129('0xa')](_0x8129('0x64'),require(_0x8129('0x65')));_0x31d02a[_0x8129('0xa')](_0x8129('0x66'),require(_0x8129('0x67')));_0x31d02a['use'](_0x8129('0x68'),require(_0x8129('0x69')));_0x31d02a[_0x8129('0xa')](_0x8129('0x6a'),require(_0x8129('0x6b')));_0x31d02a[_0x8129('0xa')]('/api/cm_contact_has_items',require('./api/cmContactHasItem'));_0x31d02a[_0x8129('0xa')](_0x8129('0x6c'),require(_0x8129('0x6d')));_0x31d02a[_0x8129('0xa')]('/api/templates',require(_0x8129('0x6e')));_0x31d02a[_0x8129('0xa')](_0x8129('0x6f'),require('./api/trigger'));_0x31d02a[_0x8129('0xa')](_0x8129('0x70'),require(_0x8129('0x71')));_0x31d02a[_0x8129('0xa')](_0x8129('0x72'),require('./api/integration'));_0x31d02a['use'](_0x8129('0x73'),require(_0x8129('0x74')));_0x31d02a[_0x8129('0xa')](_0x8129('0x75'),require('./api/analyticCustomReport'));_0x31d02a[_0x8129('0xa')](_0x8129('0x76'),require(_0x8129('0x77')));_0x31d02a[_0x8129('0xa')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x31d02a[_0x8129('0xa')]('/api/analytics/metrics',require(_0x8129('0x78')));_0x31d02a[_0x8129('0xa')]('/api/analytics/field_reports',require(_0x8129('0x79')));_0x31d02a['use'](_0x8129('0x7a'),require(_0x8129('0x7b')));_0x31d02a[_0x8129('0xa')]('/api/integrations/salesforce/accounts',require('./api/intSalesforceAccount'));_0x31d02a[_0x8129('0xa')](_0x8129('0x7c'),require(_0x8129('0x7d')));_0x31d02a['use'](_0x8129('0x7e'),require(_0x8129('0x7f')));_0x31d02a[_0x8129('0xa')]('/api/integrations/sugarcrm/accounts',require(_0x8129('0x80')));_0x31d02a[_0x8129('0xa')](_0x8129('0x81'),require(_0x8129('0x82')));_0x31d02a[_0x8129('0xa')](_0x8129('0x83'),require(_0x8129('0x84')));_0x31d02a[_0x8129('0xa')]('/api/integrations/desk/accounts',require(_0x8129('0x85')));_0x31d02a[_0x8129('0xa')](_0x8129('0x86'),require(_0x8129('0x87')));_0x31d02a[_0x8129('0xa')](_0x8129('0x88'),require(_0x8129('0x89')));_0x31d02a[_0x8129('0xa')](_0x8129('0x8a'),require('./api/intZohoAccount'));_0x31d02a['use'](_0x8129('0x8b'),require(_0x8129('0x8c')));_0x31d02a[_0x8129('0xa')](_0x8129('0x8d'),require(_0x8129('0x8e')));_0x31d02a['use']('/api/integrations/zendesk/accounts',require(_0x8129('0x8f')));_0x31d02a[_0x8129('0xa')]('/api/integrations/zendesk/configurations',require('./api/intZendeskConfiguration'));_0x31d02a[_0x8129('0xa')](_0x8129('0x90'),require(_0x8129('0x91')));_0x31d02a[_0x8129('0xa')](_0x8129('0x92'),require(_0x8129('0x93')));_0x31d02a[_0x8129('0xa')](_0x8129('0x94'),require('./api/intFreshdeskConfiguration'));_0x31d02a[_0x8129('0xa')](_0x8129('0x95'),require(_0x8129('0x96')));_0x31d02a[_0x8129('0xa')](_0x8129('0x97'),require(_0x8129('0x98')));_0x31d02a[_0x8129('0xa')](_0x8129('0x99'),require('./api/intVtigerConfiguration'));_0x31d02a[_0x8129('0xa')](_0x8129('0x9a'),require(_0x8129('0x9b')));_0x31d02a['use'](_0x8129('0x9c'),require(_0x8129('0x9d')));_0x31d02a[_0x8129('0xa')](_0x8129('0x9e'),require(_0x8129('0x9f')));_0x31d02a[_0x8129('0xa')](_0x8129('0xa0'),require(_0x8129('0xa1')));_0x31d02a[_0x8129('0xa')](_0x8129('0xa2'),require(_0x8129('0xa3')));_0x31d02a[_0x8129('0xa')]('/api/integrations/dynamics365/configurations',require(_0x8129('0xa4')));_0x31d02a[_0x8129('0xa')](_0x8129('0xa5'),require(_0x8129('0xa6')));_0x31d02a['use'](_0x8129('0xa7'),require(_0x8129('0xa8')));_0x31d02a['use'](_0x8129('0xa9'),require('./api/intFreshsalesConfiguration'));_0x31d02a[_0x8129('0xa')](_0x8129('0xaa'),require(_0x8129('0xab')));_0x31d02a['use'](_0x8129('0xac'),require('./api/network'));_0x31d02a[_0x8129('0xa')](_0x8129('0xad'),require(_0x8129('0xae')));_0x31d02a[_0x8129('0xa')](_0x8129('0xaf'),require(_0x8129('0xb0')));_0x31d02a[_0x8129('0xa')](_0x8129('0xb1'),require('./api/jscriptyAnswerReport'));_0x31d02a[_0x8129('0xa')](_0x8129('0xb2'),require(_0x8129('0xb3')));_0x31d02a[_0x8129('0xa')]('/api/jscripty/sessions/reports',require(_0x8129('0xb4')));_0x31d02a['use'](_0x8129('0xb5'),require('./api/smsQueueReport'));_0x31d02a[_0x8129('0xa')]('/api/square/reports',require(_0x8129('0xb6')));_0x31d02a[_0x8129('0xa')](_0x8129('0xb7'),require(_0x8129('0xb8')));_0x31d02a[_0x8129('0xa')](_0x8129('0xb9'),require('./api/jscriptyProject'));_0x31d02a[_0x8129('0xa')](_0x8129('0xba'),require(_0x8129('0xbb')));_0x31d02a[_0x8129('0xa')](_0x8129('0xbc'),require('./api/squareOdbc'));_0x31d02a[_0x8129('0xa')](_0x8129('0xbd'),require(_0x8129('0xbe')));_0x31d02a[_0x8129('0xa')](_0x8129('0xbf'),require(_0x8129('0xc0')));_0x31d02a[_0x8129('0xa')](_0x8129('0xc1'),require(_0x8129('0xc2')));_0x31d02a[_0x8129('0xa')](_0x8129('0xc3'),require(_0x8129('0xc4')));_0x31d02a[_0x8129('0xa')](_0x8129('0xc5'),require(_0x8129('0xc6')));_0x31d02a[_0x8129('0xa')](_0x8129('0xc7'),require(_0x8129('0xc8')));_0x31d02a['use'](_0x8129('0xc9'),require(_0x8129('0xca')));_0x31d02a['use'](_0x8129('0xcb'),require(_0x8129('0xcc')));_0x31d02a[_0x8129('0xa')]('/api/plugins',require('./api/plugin'));_0x31d02a[_0x8129('0xa')](_0x8129('0xcd'),require('./api/mailTransferReport'));_0x31d02a[_0x8129('0xa')](_0x8129('0xce'),require(_0x8129('0xcf')));_0x31d02a[_0x8129('0xa')](_0x8129('0xd0'),require(_0x8129('0xd1')));_0x31d02a[_0x8129('0xa')](_0x8129('0xd2'),require(_0x8129('0xd3')));_0x31d02a['use'](_0x8129('0xd4'),require('./api/smsTransferReport'));_0x31d02a[_0x8129('0xa')]('/api/cm/lists',require(_0x8129('0xd5')));_0x31d02a['use'](_0x8129('0xd6'),require(_0x8129('0xd7')));_0x31d02a[_0x8129('0xa')](_0x8129('0xd8'),require(_0x8129('0xd9')));_0x31d02a['use'](_0x8129('0xda'),require('./api/userProfileSection'));_0x31d02a[_0x8129('0xa')](_0x8129('0xdb'),require(_0x8129('0xdc')));_0x31d02a[_0x8129('0xa')](_0x8129('0xdd'),require('./api/userNotification'));_0x31d02a['use'](_0x8129('0xde'),require('./api/whatsappAccount'));_0x31d02a[_0x8129('0xa')]('/api/whatsapp/applications',require(_0x8129('0xdf')));_0x31d02a[_0x8129('0xa')]('/api/whatsapp/interactions',require(_0x8129('0xe0')));_0x31d02a[_0x8129('0xa')](_0x8129('0xe1'),require(_0x8129('0xe2')));_0x31d02a[_0x8129('0xa')](_0x8129('0xe3'),require(_0x8129('0xe4')));_0x31d02a[_0x8129('0xa')]('/api/whatsapp/reports/transfer',require('./api/whatsappTransferReport'));_0x31d02a[_0x8129('0xa')](_0x8129('0xe5'),require('./api/whatsappQueue'));_0x31d02a['use'](_0x8129('0xe6'),require(_0x8129('0xe7')));_0x31d02a[_0x8129('0xa')](_0x8129('0xe8'),require('./api/realtime'));_0x31d02a[_0x8129('0xa')]('/api/user-settings',require('./api/user-setting'));_0x31d02a[_0x8129('0xa')]('/api/mail_interaction_has_tags',require(_0x8129('0xe9')));_0x31d02a[_0x8129('0xa')](_0x8129('0xea'),require('./api/authLocal'));_0x31d02a[_0x8129('0xa')](_0x8129('0xeb'),require('./api/authGoogle'));_0x31d02a['use'](_0x8129('0xec'),require('./api/authActiveDirectory'));_0x31d02a[_0x8129('0xa')](_0x8129('0xed'),require(_0x8129('0xee')));_0x31d02a[_0x8129('0xa')]('/api/rpc',require(_0x8129('0xef')));_0x31d02a['use'](_0x8129('0xf0'),require('./api/version'));_0x31d02a[_0x8129('0xa')](_0x8129('0xf1'),require(_0x8129('0xf2')));_0x31d02a['use'](_0x8129('0xf3'),require('./api/pm2'));_0x31d02a['use']('/api/webbar',require(_0x8129('0xf4')));_0x31d02a['use'](_0x8129('0xf5'),clientSideLogs);_0x31d02a[_0x8129('0xa')](_0x8129('0xf6'),express[_0x8129('0xf7')](path[_0x8129('0xf8')](config[_0x8129('0xf9')],_0x8129('0xf6'))));_0x31d02a[_0x8129('0xa')](_0x8129('0xfa'),express[_0x8129('0xf7')](path[_0x8129('0xf8')](config[_0x8129('0xf9')],'/www')));_0x31d02a[_0x8129('0xa')](_0x8129('0xfb'),express[_0x8129('0xf7')](path[_0x8129('0xf8')](config['root'],'/demo')));_0x31d02a[_0x8129('0xa')]('/snippet',express[_0x8129('0xf7')](path[_0x8129('0xf8')](config['root'],_0x8129('0xfc'),_0x8129('0xfd'))));_0x31d02a[_0x8129('0xa')](_0x8129('0xfe'),express['static'](path[_0x8129('0xf8')](config['root'],_0x8129('0xff'))));_0x31d02a[_0x8129('0x100')](_0x8129('0x101'))['get'](errors[0x194]);_0x31d02a[_0x8129('0x100')]('/*')['get'](function(_0x6aebf0,_0x566d7d){_0x566d7d[_0x8129('0x102')](path[_0x8129('0x103')](_0x31d02a[_0x8129('0x104')]('appPath')+'/index.html'));});return _0x31d02a;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 4f71bca..ea28ba9 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x51f2=['../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','http','rpc','port','localhost','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/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.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/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc'];(function(_0x1254a5,_0x2ba0be){var _0x2fbf81=function(_0x1f5c83){while(--_0x1f5c83){_0x1254a5['push'](_0x1254a5['shift']());}};_0x2fbf81(++_0x2ba0be);}(_0x51f2,0xeb));var _0x251f=function(_0x233cd3,_0x474ec3){_0x233cd3=_0x233cd3-0x0;var _0x19c11a=_0x51f2[_0x233cd3];return _0x19c11a;};'use strict';var jayson=require(_0x251f('0x0'));var _=require(_0x251f('0x1'));var config=require(_0x251f('0x2'));exports[_0x251f('0x3')]=function(){return new Promise(function(_0x2afc7f,_0x243816){var _0x1d0c48={};_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x5')));_0x1d0c48=_['merge'](_0x1d0c48,require(_0x251f('0x6')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x7')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x8')));_0x1d0c48=_['merge'](_0x1d0c48,require(_0x251f('0x9')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0xa')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0xb')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0xc')));_0x1d0c48=_['merge'](_0x1d0c48,require(_0x251f('0xd')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0xe')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0xf')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x10')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x11')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x12')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x13')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/mailApplication/mailApplication.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x14')));_0x1d0c48=_['merge'](_0x1d0c48,require(_0x251f('0x15')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x16')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x17')));_0x1d0c48=_['merge'](_0x1d0c48,require('../api/faxMessage/faxMessage.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x18')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x19')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/smsAccount/smsAccount.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x1a')));_0x1d0c48=_['merge'](_0x1d0c48,require('../api/smsMessage/smsMessage.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x1b')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x1c')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x1d0c48=_['merge'](_0x1d0c48,require(_0x251f('0x1d')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x1d0c48=_['merge'](_0x1d0c48,require(_0x251f('0x1e')));_0x1d0c48=_['merge'](_0x1d0c48,require('../api/chatMessage/chatMessage.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x1f')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/cmContact/cmContact.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x20')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x21')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x22')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x23')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x24')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/pause/pause.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x25')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x26')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x27')));_0x1d0c48=_['merge'](_0x1d0c48,require('../api/trigger/trigger.rpc'));_0x1d0c48=_['merge'](_0x1d0c48,require(_0x251f('0x28')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x29')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x2a')));_0x1d0c48=_['merge'](_0x1d0c48,require(_0x251f('0x2b')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x2c')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x2d')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x2e')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x2f')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x30')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x31')));_0x1d0c48=_['merge'](_0x1d0c48,require(_0x251f('0x32')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x33')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x34')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/squareRecording/squareRecording.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x35')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/campaign/campaign.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/attachment/attachment.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x36')));_0x1d0c48=_['merge'](_0x1d0c48,require(_0x251f('0x37')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x38')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x39')));_0x1d0c48=_['merge'](_0x1d0c48,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x55236a=jayson['server'](_0x1d0c48)[_0x251f('0x3a')]();var _0x3f611b=config[_0x251f('0x3b')][_0x251f('0x3c')]||config[_0x251f('0x3c')]+0x1;var _0x414987=config['rpc']['ip']||_0x251f('0x3d');_0x55236a['on']('error',function(_0x529078){return _0x243816(_0x529078);});_0x55236a['listen'](_0x3f611b,_0x414987,function(){console[_0x251f('0x3e')](_0x251f('0x3f'),_0x414987,_0x3f611b);require(_0x251f('0x40'))[_0x251f('0x41')]();return _0x2afc7f(_0x251f('0x42')+_0x414987+':'+_0x3f611b);});});}; \ No newline at end of file +var _0x714b=['../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/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','log','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelInteraction/openchannelInteraction.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/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc'];(function(_0x207099,_0x18e589){var _0x54a298=function(_0x5ccaa0){while(--_0x5ccaa0){_0x207099['push'](_0x207099['shift']());}};_0x54a298(++_0x18e589);}(_0x714b,0xed));var _0xb714=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x714b[_0x2dafbe];return _0x58a45a;};'use strict';var jayson=require('jayson/promise');var _=require(_0xb714('0x0'));var config=require(_0xb714('0x1'));exports[_0xb714('0x2')]=function(){return new Promise(function(_0x26473e,_0x20f04a){var _0x545a83={};_0x545a83=_[_0xb714('0x3')](_0x545a83,require('../api/user/user.rpc'));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x4')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x5')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x6')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x7')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x8')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x9')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0xa')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0xb')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0xc')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0xd')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0xe')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0xf')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x10')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x11')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x12')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require('../api/mailApplication/mailApplication.rpc'));_0x545a83=_['merge'](_0x545a83,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x13')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x14')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x15')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x16')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x17')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x18')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x19')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require('../api/smsInteraction/smsInteraction.rpc'));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x1a')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require('../api/smsQueue/smsQueue.rpc'));_0x545a83=_[_0xb714('0x3')](_0x545a83,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x1b')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x1c')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x1d')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x1e')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x1f')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x20')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x21')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require('../api/cmContact/cmContact.rpc'));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x22')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x23')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x24')));_0x545a83=_['merge'](_0x545a83,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x25')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x26')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x27')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x28')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x29')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require('../api/template/template.rpc'));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x2a')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x2b')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x545a83=_[_0xb714('0x3')](_0x545a83,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x2c')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x2d')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x2e')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x2f')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x30')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x31')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x32')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x33')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x34')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require('../api/squareReport/squareReport.rpc'));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x35')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x36')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require('../api/squareOdbc/squareOdbc.rpc'));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x37')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x38')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x39')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x3a')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x3b')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require('../api/plugin/plugin.rpc'));_0x545a83=_[_0xb714('0x3')](_0x545a83,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x3c')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x3d')));_0x545a83=_['merge'](_0x545a83,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x3e')));var _0x573266=jayson[_0xb714('0x3f')](_0x545a83)['http']();var _0x5a8dd6=config[_0xb714('0x40')][_0xb714('0x41')]||config[_0xb714('0x41')]+0x1;var _0x122550=config[_0xb714('0x40')]['ip']||'localhost';_0x573266['on']('error',function(_0xb1de96){return _0x20f04a(_0xb1de96);});_0x573266['listen'](_0x5a8dd6,_0x122550,function(){console[_0xb714('0x42')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x122550,_0x5a8dd6);require(_0xb714('0x43'))[_0xb714('0x44')]();return _0x26473e(_0xb714('0x45')+_0x122550+':'+_0x5a8dd6);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index defe665..6039ca1 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 _0x3f54=['noop','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','WAIT','label','exports','util','lodash','events','EventEmitter','./reply','call','utf8','setTimeout','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','substr','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','destroy','inherits','sync','prototype','sendRequest','ANSWER','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','exec','isArray','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setContext'];(function(_0x5e6515,_0x2954b1){var _0xd33ce2=function(_0x5ce7ea){while(--_0x5ce7ea){_0x5e6515['push'](_0x5e6515['shift']());}};_0xd33ce2(++_0x2954b1);}(_0x3f54,0xe4));var _0x43f5=function(_0x4d0662,_0x145963){_0x4d0662=_0x4d0662-0x0;var _0x6eea6d=_0x3f54[_0x4d0662];return _0x6eea6d;};'use strict';var util=require(_0x43f5('0x0'));var _=require(_0x43f5('0x1'));var EventEmitter=require(_0x43f5('0x2'))[_0x43f5('0x3')];var AGIReply=require(_0x43f5('0x4'));var AGIError=require('./error');function AGIChannel(_0x435c5b){var _0x537da4=this,_0x5bb3d8=new AGIReply(),_0xde8c2d=![],_0x3d4a6a={};EventEmitter[_0x43f5('0x5')](_0x537da4);_0x435c5b['setEncoding'](_0x43f5('0x6'));_0x435c5b[_0x43f5('0x7')](0x8*0x3c*0x3c*0x3e8);_0x5bb3d8['setEncoding'](_0x43f5('0x6'));_0x5bb3d8['on']('headers',function(_0x147b80){for(var _0xa5d6f8 in _0x147b80){_0x537da4[_0xa5d6f8]=_0x147b80[_0xa5d6f8];}_0x537da4[_0x43f5('0x8')](_0x43f5('0x9'));});_0x5bb3d8['on'](_0x43f5('0xa'),function(_0x63a68f){if(_0x63a68f[_0x43f5('0xb')]()==_0x43f5('0xc')){_0x537da4[_0x43f5('0x8')](_0x43f5('0xc'));return;}if(_0x63a68f[_0x43f5('0xd')](0x0,0xb)==_0x43f5('0xe')){_0xde8c2d=!![];}if(_0xde8c2d){_0x3d4a6a['rx']+=_0x63a68f+'\x0a';if(_0x63a68f['search'](_0x43f5('0xf'))!=-0x1){_0xde8c2d=![];}}else{_0x3d4a6a['rx']=_0x63a68f;}if(_0xde8c2d){return;}if(typeof _0x3d4a6a['cb']==_0x43f5('0x10')){var _0x3c9e06=_0x3d4a6a['rx'][_0x43f5('0xd')](0x0,0x3),_0xfc6d32=null,_0x345441=null;_0x3c9e06=parseInt(_0x3c9e06);if(isNaN(_0x3c9e06)){_0x3d4a6a['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x43f5('0x11')});return;}if(_0x3c9e06!=0xc8){_0x3d4a6a['cb'](null,{'code':_0x3c9e06,'result':-0x1,'extra':'KO'});return;}_0xfc6d32=_0x3d4a6a['rx'][_0x43f5('0xd')](0x4)[_0x43f5('0x12')]('result=','');if(_0xfc6d32[_0x43f5('0x13')]('\x20')!=-0x1){_0xfc6d32=_0xfc6d32[_0x43f5('0x14')](0x0,_0xfc6d32['indexOf']('\x20'));}if(_['startsWith'](_0xfc6d32,'-1')){_0xfc6d32=parseInt(_0xfc6d32);}_0x345441=_0x3d4a6a['rx'][_0x43f5('0x15')]('\x20');if(_0x345441[_0x43f5('0x16')]==0x3){_0x345441=_0x345441[0x2][_0x43f5('0xd')](0x1,_0x345441[0x2][_0x43f5('0x16')]-0x1);}else if(_0x345441[_0x43f5('0x16')]>0x3){var _0x2a69e4=/\((.+)\)/;var _0x303580=_0x3d4a6a['rx']['match'](_0x2a69e4);if(_0x303580){_0x345441=_0x303580[0x1];}else{_0x345441=null;}}else{_0x345441=null;}_0x3d4a6a['cb'](null,{'code':_0x3c9e06,'result':_0xfc6d32,'extra':_0x345441});}});_0x435c5b['on']('error',function(_0x48452d){_0x537da4[_0x43f5('0x8')](_0x43f5('0x17'),new AGIError(_0x43f5('0x18'),_0x48452d[_0x43f5('0x19')]));});_0x435c5b['on'](_0x43f5('0x1a'),function(){_0x537da4[_0x43f5('0x8')](_0x43f5('0x1a'),new AGIError(_0x43f5('0x1b')));});_0x435c5b['on'](_0x43f5('0x1c'),function(){_0x537da4['emit']('timeout',new AGIError(_0x43f5('0x1d')));_0x435c5b['destroy']();});_0x435c5b[_0x43f5('0x1e')](_0x5bb3d8);this[_0x43f5('0x1f')]=function(_0x1a9d21,_0x18f7f7){var _0x1a9d21=_0x1a9d21||'',_0x18f7f7=typeof _0x18f7f7==_0x43f5('0x10')?_0x18f7f7:new Function();_0x3d4a6a={'tx':_0x1a9d21,'rx':'','cb':_0x18f7f7};_0x435c5b[_0x43f5('0x20')](_0x1a9d21+'\x0a');},this[_0x43f5('0x1a')]=function(){_0x435c5b[_0x43f5('0x21')]();};}util[_0x43f5('0x22')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x31abd9){return this['command'][_0x43f5('0x23')](this,_0x31abd9);};AGIChannel[_0x43f5('0x24')]['answer']=function(){return this[_0x43f5('0x25')](_0x43f5('0x26'));};AGIChannel['prototype']['getData']=function(_0x5db596,_0x1649e6,_0xbf947d){_0x5db596=_0x5db596===undefined?'beep':_0x5db596;_0x1649e6=_0x1649e6===undefined?'5':_0x1649e6;_0xbf947d=_0xbf947d===undefined?'1':_0xbf947d;return this[_0x43f5('0x25')](util[_0x43f5('0x27')](_0x43f5('0x28'),_0x5db596,_0x1649e6*0x3e8,_0xbf947d));};AGIChannel[_0x43f5('0x24')]['noop']=function(_0x3b56c7){_0x3b56c7=_0x3b56c7||_0x43f5('0x29');return this[_0x43f5('0x25')](util[_0x43f5('0x27')]('VERBOSE\x20\x22%s\x22',_0x3b56c7));};AGIChannel[_0x43f5('0x24')][_0x43f5('0x2a')]=function(_0x1acea9,_0x147a09){if(_[_0x43f5('0x2b')](_0x147a09)){return this[_0x43f5('0x25')](util[_0x43f5('0x27')](_0x43f5('0x2c'),_0x1acea9,_0x147a09[_0x43f5('0x2d')](',')));}return this[_0x43f5('0x25')](util[_0x43f5('0x27')](_0x43f5('0x2c'),_0x1acea9,_0x147a09));};AGIChannel['prototype']['setContext']=function(_0x535a9c){return this[_0x43f5('0x25')](util[_0x43f5('0x27')](_0x43f5('0x2e'),_0x535a9c));};AGIChannel[_0x43f5('0x24')][_0x43f5('0x2f')]=function(_0x4be8f6){return this[_0x43f5('0x25')](util[_0x43f5('0x27')](_0x43f5('0x30'),_0x4be8f6));};AGIChannel['prototype']['setPriority']=function(_0x33333c){return this[_0x43f5('0x25')](util[_0x43f5('0x27')](_0x43f5('0x31'),_0x33333c));};AGIChannel['prototype']['hangup']=function(){return this['sendRequest'](_0x43f5('0x32'));};AGIChannel[_0x43f5('0x24')]['setVariable']=function(_0x170c52,_0x13a83a){var _0x5f07b8=_[_0x43f5('0x33')](_0x13a83a)||_[_0x43f5('0x34')](_0x13a83a)?_0x13a83a[_0x43f5('0x35')]():_0x13a83a;return this[_0x43f5('0x25')](util[_0x43f5('0x27')](_0x43f5('0x36'),_0x170c52,_0x5f07b8?_0x5f07b8['toString']()[_0x43f5('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x43f5('0x24')]['sayNumber']=function(_0x58ed5a,_0x52e390){return this[_0x43f5('0x25')](util[_0x43f5('0x27')]('SAY\x20NUMBER\x20%s\x20%s',_0x58ed5a,_0x52e390));};AGIChannel[_0x43f5('0x24')]['sayDigits']=function(_0x50a4a8,_0x1b4c1d){return this[_0x43f5('0x25')](util[_0x43f5('0x27')](_0x43f5('0x37'),_0x50a4a8,_0x1b4c1d));};AGIChannel[_0x43f5('0x24')][_0x43f5('0x38')]=function(_0xf34407,_0x422fb7){return this['sendRequest'](util[_0x43f5('0x27')](_0x43f5('0x39'),_0xf34407,_0x422fb7));};AGIChannel[_0x43f5('0x24')][_0x43f5('0x3a')]=function(_0x49820e,_0x9bb8cb,_0xcaa0ee){_0x9bb8cb=_0x9bb8cb||this['extension'];_0xcaa0ee=_0xcaa0ee||0x1;this[_0x43f5('0x3b')](_0x49820e);this[_0x43f5('0x2f')](_0x9bb8cb);this['setPriority'](_0xcaa0ee);return this[_0x43f5('0x3c')](util['format']('GOTO\x20%s\x20%s\x20%s',_0x49820e,_0x9bb8cb,_0xcaa0ee));};AGIChannel['prototype']['getVariable']=function(_0x3cdf92){return this[_0x43f5('0x25')](util[_0x43f5('0x27')](_0x43f5('0x3d'),_0x3cdf92));};AGIChannel[_0x43f5('0x24')][_0x43f5('0x3e')]=function(_0x115da5,_0x5173bb,_0x29baaa,_0x224e65,_0x2d7f6b,_0x38bf4f){_0x5173bb=_0x5173bb||_0x43f5('0x3f');_0x29baaa=_0x29baaa||'';_0x224e65=_0x224e65===undefined?-0x1:_0x224e65==='-1'?-0x1:_0x224e65*0x3e8;_0x2d7f6b=_0x2d7f6b===undefined?'':'s='+_0x2d7f6b;_0x38bf4f=_0x38bf4f?_0x43f5('0x40'):'';return this[_0x43f5('0x25')](util[_0x43f5('0x27')](_0x43f5('0x41'),_0x115da5,_0x5173bb,_0x29baaa,_0x224e65,_0x38bf4f,_0x2d7f6b));};AGIChannel[_0x43f5('0x24')]['streamFile']=function(_0x5cb34b,_0x188bd8){_0x188bd8=_0x188bd8||'';return this[_0x43f5('0x25')](util[_0x43f5('0x27')](_0x43f5('0x42'),_0x5cb34b,_0x188bd8));};AGIChannel[_0x43f5('0x24')][_0x43f5('0x43')]=function(_0x23aa43){return this[_0x43f5('0x2a')](_0x43f5('0x44'),_0x23aa43);};AGIChannel['prototype']['wait']=function(_0x88bc22){return this['exec'](_0x43f5('0x45'),_0x88bc22);};AGIChannel['prototype'][_0x43f5('0x17')]=function(_0x57caeb,_0x50988d){this[_0x43f5('0x3c')](util[_0x43f5('0x27')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x57caeb['id'],_0x57caeb[_0x43f5('0x46')],_0x50988d));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x43f5('0x47')]=AGIChannel; \ No newline at end of file +var _0xb344=['join','setContext','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','setEncoding','utf8','headers','emit','hangup','520-Invalid','search','520\x20End\x20of\x20proper','function','substring','no\x20code','replace','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','command','write','destroy','inherits','prototype','sendRequest','sync','answer','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s'];(function(_0x4ac40b,_0x44aabb){var _0x5a199d=function(_0x5d4e27){while(--_0x5d4e27){_0x4ac40b['push'](_0x4ac40b['shift']());}};_0x5a199d(++_0x44aabb);}(_0xb344,0x152));var _0x4b34=function(_0x3a7c8a,_0x24eeba){_0x3a7c8a=_0x3a7c8a-0x0;var _0x12ed2c=_0xb344[_0x3a7c8a];return _0x12ed2c;};'use strict';var util=require(_0x4b34('0x0'));var _=require(_0x4b34('0x1'));var EventEmitter=require(_0x4b34('0x2'))[_0x4b34('0x3')];var AGIReply=require(_0x4b34('0x4'));var AGIError=require(_0x4b34('0x5'));function AGIChannel(_0x11b964){var _0x5e7814=this,_0x51f872=new AGIReply(),_0x423b07=![],_0x9f7bf3={};EventEmitter['call'](_0x5e7814);_0x11b964[_0x4b34('0x6')](_0x4b34('0x7'));_0x11b964['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x51f872[_0x4b34('0x6')]('utf8');_0x51f872['on'](_0x4b34('0x8'),function(_0x1a2934){for(var _0x5c0c48 in _0x1a2934){_0x5e7814[_0x5c0c48]=_0x1a2934[_0x5c0c48];}_0x5e7814[_0x4b34('0x9')]('ready');});_0x51f872['on']('line',function(_0x57e24d){if(_0x57e24d['toLowerCase']()==_0x4b34('0xa')){_0x5e7814['emit']('hangup');return;}if(_0x57e24d['substring'](0x0,0xb)==_0x4b34('0xb')){_0x423b07=!![];}if(_0x423b07){_0x9f7bf3['rx']+=_0x57e24d+'\x0a';if(_0x57e24d[_0x4b34('0xc')](_0x4b34('0xd'))!=-0x1){_0x423b07=![];}}else{_0x9f7bf3['rx']=_0x57e24d;}if(_0x423b07){return;}if(typeof _0x9f7bf3['cb']==_0x4b34('0xe')){var _0x24212a=_0x9f7bf3['rx'][_0x4b34('0xf')](0x0,0x3),_0x184fd3=null,_0xfeeaac=null;_0x24212a=parseInt(_0x24212a);if(isNaN(_0x24212a)){_0x9f7bf3['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x4b34('0x10')});return;}if(_0x24212a!=0xc8){_0x9f7bf3['cb'](null,{'code':_0x24212a,'result':-0x1,'extra':'KO'});return;}_0x184fd3=_0x9f7bf3['rx'][_0x4b34('0xf')](0x4)[_0x4b34('0x11')]('result=','');if(_0x184fd3[_0x4b34('0x12')]('\x20')!=-0x1){_0x184fd3=_0x184fd3[_0x4b34('0x13')](0x0,_0x184fd3['indexOf']('\x20'));}if(_[_0x4b34('0x14')](_0x184fd3,'-1')){_0x184fd3=parseInt(_0x184fd3);}_0xfeeaac=_0x9f7bf3['rx'][_0x4b34('0x15')]('\x20');if(_0xfeeaac['length']==0x3){_0xfeeaac=_0xfeeaac[0x2]['substring'](0x1,_0xfeeaac[0x2][_0x4b34('0x16')]-0x1);}else if(_0xfeeaac[_0x4b34('0x16')]>0x3){var _0x3597a9=/\((.+)\)/;var _0xa75657=_0x9f7bf3['rx'][_0x4b34('0x17')](_0x3597a9);if(_0xa75657){_0xfeeaac=_0xa75657[0x1];}else{_0xfeeaac=null;}}else{_0xfeeaac=null;}_0x9f7bf3['cb'](null,{'code':_0x24212a,'result':_0x184fd3,'extra':_0xfeeaac});}});_0x11b964['on']('error',function(_0x558485){_0x5e7814['emit'](_0x4b34('0x18'),new AGIError(_0x4b34('0x19'),_0x558485['code']));});_0x11b964['on'](_0x4b34('0x1a'),function(){_0x5e7814[_0x4b34('0x9')](_0x4b34('0x1a'),new AGIError(_0x4b34('0x1b')));});_0x11b964['on'](_0x4b34('0x1c'),function(){_0x5e7814[_0x4b34('0x9')](_0x4b34('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x11b964['destroy']();});_0x11b964['pipe'](_0x51f872);this[_0x4b34('0x1d')]=function(_0x57d5b8,_0x267f25){var _0x57d5b8=_0x57d5b8||'',_0x267f25=typeof _0x267f25==_0x4b34('0xe')?_0x267f25:new Function();_0x9f7bf3={'tx':_0x57d5b8,'rx':'','cb':_0x267f25};_0x11b964[_0x4b34('0x1e')](_0x57d5b8+'\x0a');},this[_0x4b34('0x1a')]=function(){_0x11b964[_0x4b34('0x1f')]();};}util[_0x4b34('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x4b34('0x21')][_0x4b34('0x22')]=function(_0x50fc0a){return this[_0x4b34('0x1d')][_0x4b34('0x23')](this,_0x50fc0a);};AGIChannel[_0x4b34('0x21')][_0x4b34('0x24')]=function(){return this[_0x4b34('0x22')]('ANSWER');};AGIChannel[_0x4b34('0x21')][_0x4b34('0x25')]=function(_0xf58c02,_0x3d7b5d,_0x2f7f5e){_0xf58c02=_0xf58c02===undefined?_0x4b34('0x26'):_0xf58c02;_0x3d7b5d=_0x3d7b5d===undefined?'5':_0x3d7b5d;_0x2f7f5e=_0x2f7f5e===undefined?'1':_0x2f7f5e;return this[_0x4b34('0x22')](util[_0x4b34('0x27')](_0x4b34('0x28'),_0xf58c02,_0x3d7b5d*0x3e8,_0x2f7f5e));};AGIChannel[_0x4b34('0x21')][_0x4b34('0x29')]=function(_0x462e0a){_0x462e0a=_0x462e0a||_0x4b34('0x2a');return this[_0x4b34('0x22')](util['format'](_0x4b34('0x2b'),_0x462e0a));};AGIChannel[_0x4b34('0x21')][_0x4b34('0x2c')]=function(_0x37a011,_0xa37c30){if(_[_0x4b34('0x2d')](_0xa37c30)){return this[_0x4b34('0x22')](util[_0x4b34('0x27')](_0x4b34('0x2e'),_0x37a011,_0xa37c30[_0x4b34('0x2f')](',')));}return this['sendRequest'](util[_0x4b34('0x27')](_0x4b34('0x2e'),_0x37a011,_0xa37c30));};AGIChannel['prototype'][_0x4b34('0x30')]=function(_0x3c4d77){return this[_0x4b34('0x22')](util['format']('SET\x20CONTEXT\x20%s',_0x3c4d77));};AGIChannel[_0x4b34('0x21')][_0x4b34('0x31')]=function(_0x44f3fd){return this[_0x4b34('0x22')](util[_0x4b34('0x27')]('SET\x20EXTENSION\x20%s',_0x44f3fd));};AGIChannel['prototype'][_0x4b34('0x32')]=function(_0x2624d1){return this['sendRequest'](util[_0x4b34('0x27')](_0x4b34('0x33'),_0x2624d1));};AGIChannel[_0x4b34('0x21')][_0x4b34('0xa')]=function(){return this['sendRequest'](_0x4b34('0x34'));};AGIChannel[_0x4b34('0x21')]['setVariable']=function(_0x27ec77,_0x1fdf3c){var _0x3f24d5=_[_0x4b34('0x35')](_0x1fdf3c)||_[_0x4b34('0x36')](_0x1fdf3c)?_0x1fdf3c[_0x4b34('0x37')]():_0x1fdf3c;return this[_0x4b34('0x22')](util[_0x4b34('0x27')](_0x4b34('0x38'),_0x27ec77,_0x3f24d5?_0x3f24d5[_0x4b34('0x37')]()[_0x4b34('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x4b34('0x21')][_0x4b34('0x39')]=function(_0x24c1c2,_0x1e8a84){return this[_0x4b34('0x22')](util[_0x4b34('0x27')]('SAY\x20NUMBER\x20%s\x20%s',_0x24c1c2,_0x1e8a84));};AGIChannel[_0x4b34('0x21')][_0x4b34('0x3a')]=function(_0xebf9f0,_0x151a75){return this[_0x4b34('0x22')](util[_0x4b34('0x27')](_0x4b34('0x3b'),_0xebf9f0,_0x151a75));};AGIChannel['prototype'][_0x4b34('0x3c')]=function(_0x205567,_0x22f6c5){return this[_0x4b34('0x22')](util[_0x4b34('0x27')](_0x4b34('0x3d'),_0x205567,_0x22f6c5));};AGIChannel[_0x4b34('0x21')][_0x4b34('0x3e')]=function(_0x7b9df5,_0x3dc5d6,_0x315ff5){_0x3dc5d6=_0x3dc5d6||this[_0x4b34('0x3f')];_0x315ff5=_0x315ff5||0x1;this[_0x4b34('0x30')](_0x7b9df5);this[_0x4b34('0x31')](_0x3dc5d6);this[_0x4b34('0x32')](_0x315ff5);return this['noop'](util[_0x4b34('0x27')](_0x4b34('0x40'),_0x7b9df5,_0x3dc5d6,_0x315ff5));};AGIChannel[_0x4b34('0x21')][_0x4b34('0x41')]=function(_0x9f1d02){return this['sendRequest'](util[_0x4b34('0x27')](_0x4b34('0x42'),_0x9f1d02));};AGIChannel[_0x4b34('0x21')][_0x4b34('0x43')]=function(_0x3f2bfa,_0x474c49,_0x322b15,_0x3d29eb,_0x4f9eee,_0x1a9c93){_0x474c49=_0x474c49||_0x4b34('0x44');_0x322b15=_0x322b15||'';_0x3d29eb=_0x3d29eb===undefined?-0x1:_0x3d29eb==='-1'?-0x1:_0x3d29eb*0x3e8;_0x4f9eee=_0x4f9eee===undefined?'':'s='+_0x4f9eee;_0x1a9c93=_0x1a9c93?_0x4b34('0x45'):'';return this[_0x4b34('0x22')](util[_0x4b34('0x27')](_0x4b34('0x46'),_0x3f2bfa,_0x474c49,_0x322b15,_0x3d29eb,_0x1a9c93,_0x4f9eee));};AGIChannel['prototype']['streamFile']=function(_0x34d317,_0x5e0e97){_0x5e0e97=_0x5e0e97||'';return this['sendRequest'](util[_0x4b34('0x27')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x34d317,_0x5e0e97));};AGIChannel[_0x4b34('0x21')][_0x4b34('0x47')]=function(_0xef62da){return this[_0x4b34('0x2c')]('AGI',_0xef62da);};AGIChannel[_0x4b34('0x21')][_0x4b34('0x48')]=function(_0x28fe0e){return this[_0x4b34('0x2c')](_0x4b34('0x49'),_0x28fe0e);};AGIChannel[_0x4b34('0x21')][_0x4b34('0x18')]=function(_0x3a8c72,_0x26b414){this[_0x4b34('0x29')](util[_0x4b34('0x27')](_0x4b34('0x4a'),_0x3a8c72['id'],_0x3a8c72[_0x4b34('0x4b')],_0x26b414));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x4b34('0x4c')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index f69cd67..5b1f53b 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 _0xd863=['apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format'];(function(_0x5186be,_0x560353){var _0x2b278b=function(_0x66aff6){while(--_0x66aff6){_0x5186be['push'](_0x5186be['shift']());}};_0x2b278b(++_0x560353);}(_0xd863,0x158));var _0x3d86=function(_0x5e1ce9,_0x2fae3e){_0x5e1ce9=_0x5e1ce9-0x0;var _0x41fb67=_0xd863[_0x5e1ce9];return _0x41fb67;};'use strict';var util=require(_0x3d86('0x0'));var error={'E_AGI_UNDEFINED':_0x3d86('0x1'),'E_AGI_ARGUMENT_PORT':_0x3d86('0x2'),'E_AGI_SERVER_ERROR':_0x3d86('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x3d86('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x3d86('0x5'),'E_AGI_SOCKET_ERROR':_0x3d86('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x3d86('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x3d86('0x8'),'E_AGI_IVR_ENTRY':_0x3d86('0x9')};function AGIError(_0x474ed9){var _0x474ed9=_0x474ed9||null,_0x1267bf=_0x1267bf||[],_0x389413=0x1,_0x7b33f6='';if(!error[_0x474ed9]){_0x474ed9=_0x3d86('0xa');}_0x1267bf['push'](error[_0x474ed9]);while(arguments[_0x389413]){_0x1267bf[_0x3d86('0xb')](arguments[_0x389413]);_0x389413++;}_0x7b33f6=util[_0x3d86('0xc')][_0x3d86('0xd')](util,_0x1267bf);this[_0x3d86('0xe')]=_0x7b33f6;this[_0x3d86('0xf')]=_0x474ed9;}module[_0x3d86('0x10')]=AGIError; \ No newline at end of file +var _0x5221=['Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','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','format','apply','message','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.'];(function(_0x1201ce,_0x4b01d){var _0x526a56=function(_0xd5a561){while(--_0xd5a561){_0x1201ce['push'](_0x1201ce['shift']());}};_0x526a56(++_0x4b01d);}(_0x5221,0xb1));var _0x1522=function(_0xc2cdba,_0x409cc2){_0xc2cdba=_0xc2cdba-0x0;var _0x19471d=_0x5221[_0xc2cdba];return _0x19471d;};'use strict';var util=require(_0x1522('0x0'));var error={'E_AGI_UNDEFINED':_0x1522('0x1'),'E_AGI_ARGUMENT_PORT':_0x1522('0x2'),'E_AGI_SERVER_ERROR':_0x1522('0x3'),'E_AGI_SERVER_CLOSE':_0x1522('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x1522('0x5'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x1522('0x6'),'E_AGI_SOCKET_CLOSE':_0x1522('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x1522('0x8'),'E_AGI_COMMAND_EMPTY':_0x1522('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x1522('0xa'),'E_AGI_IVR_ENTRY':_0x1522('0xb')};function AGIError(_0x946576){var _0x946576=_0x946576||null,_0x3a1675=_0x3a1675||[],_0x24deab=0x1,_0x1854c3='';if(!error[_0x946576]){_0x946576=_0x1522('0xc');}_0x3a1675[_0x1522('0xd')](error[_0x946576]);while(arguments[_0x24deab]){_0x3a1675[_0x1522('0xd')](arguments[_0x24deab]);_0x24deab++;}_0x1854c3=util[_0x1522('0xe')][_0x1522('0xf')](util,_0x3a1675);this[_0x1522('0x10')]=_0x1854c3;this['name']=_0x946576;}module[_0x1522('0x11')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index bdf4f20..9f0a7bb 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 _0x8465=['exports','lodash','events','EventEmitter','./error','../../config/environment','redis','localhost','emit','error','message','agi','parse'];(function(_0x44216d,_0x4938a7){var _0xeca523=function(_0x11faf1){while(--_0x11faf1){_0x44216d['push'](_0x44216d['shift']());}};_0xeca523(++_0x4938a7);}(_0x8465,0x1bb));var _0x5846=function(_0x1e1020,_0xd64a27){_0x1e1020=_0x1e1020-0x0;var _0x464719=_0x8465[_0x1e1020];return _0x464719;};'use strict';var _=require(_0x5846('0x0'));var EventEmitter=require(_0x5846('0x1'))[_0x5846('0x2')];var Redis=require('ioredis');var AGIError=require(_0x5846('0x3'));var config=require(_0x5846('0x4'));config[_0x5846('0x5')]=_['defaults'](config[_0x5846('0x5')],{'host':_0x5846('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x5846('0x5')]);sub['subscribe']('agi',function(_0x3bf683){if(_0x3bf683)return eventEmitter[_0x5846('0x7')](_0x5846('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x3bf683));});sub['on'](_0x5846('0x9'),function(_0x83362f,_0x273da){if(_0x83362f!==_0x5846('0xa'))return;try{var _0x5849f3=JSON[_0x5846('0xb')](_0x273da);eventEmitter[_0x5846('0x7')]('projectUpdate',_0x5849f3);}catch(_0x22c8cd){eventEmitter[_0x5846('0x7')](_0x5846('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x22c8cd));}});module[_0x5846('0xc')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xac8e=['agi','error','E_AGI_SERVER_ERROR','message','parse','emit','projectUpdate','exports','events','ioredis','../../config/environment','redis'];(function(_0x485086,_0x54db73){var _0x2432fa=function(_0x2b9289){while(--_0x2b9289){_0x485086['push'](_0x485086['shift']());}};_0x2432fa(++_0x54db73);}(_0xac8e,0x1c4));var _0xeac8=function(_0x43732e,_0x39b51c){_0x43732e=_0x43732e-0x0;var _0x202c74=_0xac8e[_0x43732e];return _0x202c74;};'use strict';var _=require('lodash');var EventEmitter=require(_0xeac8('0x0'))['EventEmitter'];var Redis=require(_0xeac8('0x1'));var AGIError=require('./error');var config=require(_0xeac8('0x2'));config[_0xeac8('0x3')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xeac8('0x3')]);sub['subscribe'](_0xeac8('0x4'),function(_0x23b57f){if(_0x23b57f)return eventEmitter['emit'](_0xeac8('0x5'),new AGIError(_0xeac8('0x6'),_0x23b57f));});sub['on'](_0xeac8('0x7'),function(_0x4884ce,_0x29b6a7){if(_0x4884ce!==_0xeac8('0x4'))return;try{var _0x2cad69=JSON[_0xeac8('0x8')](_0x29b6a7);eventEmitter[_0xeac8('0x9')](_0xeac8('0xa'),_0x2cad69);}catch(_0x5d6abf){eventEmitter[_0xeac8('0x9')](_0xeac8('0x5'),new AGIError('E_AGI_SERVER_ERROR',_0x5d6abf));}});module[_0xeac8('0xb')]={'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 be518db..8da1e3e 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 _0xd677=['menu','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','exports','lodash','../../../config/logger','getdigits','getsecretdigits','vertices','edges','prototype','addVertex','addEdge','push','numberOfEdges','size','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','default'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xd677,0x18c));var _0x7d67=function(_0x340f5f,_0x2cd7ab){_0x340f5f=_0x340f5f-0x0;var _0x2b1219=_0xd677[_0x340f5f];return _0x2b1219;};'use strict';var _=require(_0x7d67('0x0'));var logger=require(_0x7d67('0x1'))('agi');var verticesWithRetry=['menu',_0x7d67('0x2'),_0x7d67('0x3')];var Graph=function(){this[_0x7d67('0x4')]={};this[_0x7d67('0x5')]={};this['numberOfEdges']=0x0;};Graph[_0x7d67('0x6')][_0x7d67('0x7')]=function(_0x5494e1){this[_0x7d67('0x4')][_0x5494e1['id']]=_0x5494e1;this[_0x7d67('0x5')][_0x5494e1['id']]=[];};Graph[_0x7d67('0x6')][_0x7d67('0x8')]=function(_0x41461f,_0x6aed59,_0x144f3f){this[_0x7d67('0x5')][_0x41461f][_0x7d67('0x9')]({'target':_0x6aed59,'condition':_0x144f3f});this[_0x7d67('0xa')]+=0x1;};Graph[_0x7d67('0x6')][_0x7d67('0xb')]=function(){return _[_0x7d67('0xb')](this[_0x7d67('0x4')]);};Graph[_0x7d67('0x6')]['relations']=function(){return this[_0x7d67('0xa')];};Graph['prototype']['getVertex']=function(_0x2582ba){return this[_0x7d67('0x4')][_0x2582ba];};Graph[_0x7d67('0x6')][_0x7d67('0xc')]=function(_0x3a0994,_0x1e7db5){if(!this[_0x7d67('0x4')][_0x3a0994]){return logger[_0x7d67('0xd')](_0x7d67('0xe'));}var _0x18fec9=_0x1e7db5(this[_0x7d67('0x4')][_0x3a0994]);if(!_0x18fec9){return logger[_0x7d67('0xd')](_0x7d67('0xf'));}if(this[_0x7d67('0x5')][_0x3a0994][_0x7d67('0x10')]===0x0){return logger[_0x7d67('0xd')](_0x7d67('0x11'));}for(var _0x207a27=0x0,_0x487787=[],_0x452353=![];_0x207a27\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','stringify','timeout','hangup','find','handleNotFound','production','handleUnpublished'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xa53f,0x10a));var _0xfa53=function(_0x59e533,_0x553f58){_0x59e533=_0x59e533-0x0;var _0x2fe362=_0xa53f[_0x59e533];return _0x2fe362;};'use strict';var _=require(_0xfa53('0x0'));var syncho=require('syncho');var util=require('util');var config=require('../../config/environment');var logger=require(_0xfa53('0x1'))(_0xfa53('0x2'));var utilLicense=require(_0xfa53('0x3'));var rpc=require(_0xfa53('0x4'));var Project=require(_0xfa53('0x5'));var AGIEmitter=require('./events')['EventEmitter'];var projects=[];config[_0xfa53('0x2')]=_[_0xfa53('0x6')](config[_0xfa53('0x2')],{'ip':_0xfa53('0x7'),'port':0x11dd});AGIEmitter['on'](_0xfa53('0x8'),projectUpdateHandler);function connectionHandler(_0x5151a3){process[_0xfa53('0x9')](function(){syncho(function(){try{setChannelVariables(_0x5151a3);agiHandler(_0x5151a3);}catch(_0x5315f5){logger[_0xfa53('0xa')](_0x5315f5[_0xfa53('0xb')]);}});});}function projectUpdateHandler(_0x1494d2){try{var _0x4e501c=_[_0xfa53('0xc')](projects,['id',_0x1494d2['id']]);if(_0x4e501c>-0x1){if(_0x1494d2[_0xfa53('0xd')]===!![]){projects[_0xfa53('0xe')](_0x4e501c,0x1);}else{projects[_0x4e501c]=_0x1494d2;}}else{projects[_0xfa53('0xf')](_0x1494d2);}}catch(_0x5df76c){logger['error'](_0x5df76c['stack']);}}function listeningHandler(){console[_0xfa53('0x10')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0xfa53('0x11')]);logger[_0xfa53('0x12')](util[_0xfa53('0x13')](_0xfa53('0x14'),config[_0xfa53('0x2')]['ip'],config[_0xfa53('0x2')][_0xfa53('0x11')]));}function errorHandler(_0x42ef77){if(_0x42ef77&&_0x42ef77[_0xfa53('0x15')]&&_0x42ef77['message']){logger[_0xfa53('0xa')](util[_0xfa53('0x13')](_0xfa53('0x16'),_0x42ef77[_0xfa53('0x15')],_0x42ef77[_0xfa53('0x17')]));}else{logger['error'](util[_0xfa53('0x13')](_0xfa53('0x18'),_0x42ef77[_0xfa53('0xb')]));}}function closeHandler(){logger[_0xfa53('0x12')](util[_0xfa53('0x13')](_0xfa53('0x19'),this[_0xfa53('0x1a')],this[_0xfa53('0x1b')],this[_0xfa53('0x1c')],this[_0xfa53('0x1d')],this[_0xfa53('0x1e')]));try{createSquareReport(this);}catch(_0x35b982){logger[_0xfa53('0xa')](_0x35b982[_0xfa53('0xb')]);}}function timeoutHandler(){logger['info'](util[_0xfa53('0x13')](_0xfa53('0x1f'),this[_0xfa53('0x1a')],this[_0xfa53('0x1b')],this[_0xfa53('0x1c')],this['dnid'],this[_0xfa53('0x1e')]));}function hangupHandler(){logger[_0xfa53('0x12')](util[_0xfa53('0x13')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xfa53('0x1a')],this[_0xfa53('0x1b')],this[_0xfa53('0x1c')],this[_0xfa53('0x1d')],this[_0xfa53('0x1e')]));this[_0xfa53('0x20')]=!![];}function createSquareReport(_0x577c2e,_0x280654){rpc[_0xfa53('0x21')](_0x577c2e)[_0xfa53('0x22')](function(_0x2e3262){if(_0x280654){_0x280654(null,_0x2e3262);}})[_0xfa53('0x23')](function(_0x90a092){if(_0x280654){_0x280654(null,_0x90a092);}});}function setChannelVariables(_0x29cc7a){for(var _0x3b3c8e in _0x29cc7a){if(_0x29cc7a[_0xfa53('0x24')](_0x3b3c8e)){if(_0x3b3c8e[_0xfa53('0x25')](_0xfa53('0x26'))===0x0){_0x29cc7a[_0x3b3c8e['substring'](0x4)]=_0x29cc7a[_0x3b3c8e];delete _0x29cc7a[_0x3b3c8e];}}}}function agiHandler(_0x4952fe){logger['debug']('variables',JSON[_0xfa53('0x27')](_0x4952fe,null,0x2));logger[_0xfa53('0x12')](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4952fe[_0xfa53('0x1a')],_0x4952fe['calleridname'],_0x4952fe['callerid'],_0x4952fe[_0xfa53('0x1d')],_0x4952fe['uniqueid']));_0x4952fe['on'](_0xfa53('0xa'),errorHandler);_0x4952fe['on']('close',closeHandler);_0x4952fe['on'](_0xfa53('0x28'),timeoutHandler);_0x4952fe[_0xfa53('0x20')]=![];_0x4952fe['on'](_0xfa53('0x29'),hangupHandler);var _0x4edb03=_[_0xfa53('0x2a')](projects,['name',_0x4952fe[_0xfa53('0x1a')]]);if(!_0x4edb03)return Project[_0xfa53('0x2b')](_0x4952fe);if(!_0x4edb03[_0xfa53('0x2c')])return Project[_0xfa53('0x2d')](_0x4952fe);return Project['initialize'](_0x4edb03,_0x4952fe);}function main(){var _0x581d0c;return utilLicense[_0xfa53('0x2e')]()[_0xfa53('0x22')](function(_0x3c0c69){if(!_0x3c0c69)return;if(_0x3c0c69['voice']){if(_0x3c0c69['callysquare']&&_0x3c0c69[_0xfa53('0x2f')]>0x0){logger[_0xfa53('0x12')](util[_0xfa53('0x13')](_0xfa53('0x30'),_0x3c0c69['callysquare']));_0x581d0c=_0x3c0c69['callysquare'];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xfa53('0x12')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x581d0c=-0x1;}})[_0xfa53('0x22')](function(){return Project['getAll']();})[_0xfa53('0x22')](function(_0x114a2b){projects=_0x114a2b;return;})[_0xfa53('0x23')](function(_0x34ac83){logger[_0xfa53('0xa')](_0xfa53('0x31'),_0x34ac83[_0xfa53('0xb')]);})['finally'](function(){var _0x47ee90=require('./server')(config[_0xfa53('0x2')][_0xfa53('0x11')],config[_0xfa53('0x2')]['ip'],_0x581d0c);_0x47ee90['on'](_0xfa53('0xa'),errorHandler);_0x47ee90['on']('listening',listeningHandler);_0x47ee90['on'](_0xfa53('0x32'),connectionHandler);_0x47ee90['on'](_0xfa53('0x33'),closeHandler);});}main(); \ No newline at end of file +var _0xb57d=['projectUpdate','error','stack','findIndex','deleted','splice','push','log','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','message','[%s]\x20%s','name','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','substring','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','hangup','find','production','handleUnpublished','getLicense','voice','[LICENSE]\x20CHANNELS:\x20%s','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','listening','connection','close','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./events','EventEmitter','127.0.0.1'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb57d,0xdd));var _0xdb57=function(_0x39e3c4,_0x4ed9c6){_0x39e3c4=_0x39e3c4-0x0;var _0x212f26=_0xb57d[_0x39e3c4];return _0x212f26;};'use strict';var _=require(_0xdb57('0x0'));var syncho=require(_0xdb57('0x1'));var util=require(_0xdb57('0x2'));var config=require(_0xdb57('0x3'));var logger=require(_0xdb57('0x4'))(_0xdb57('0x5'));var utilLicense=require(_0xdb57('0x6'));var rpc=require(_0xdb57('0x7'));var Project=require('./project');var AGIEmitter=require(_0xdb57('0x8'))[_0xdb57('0x9')];var projects=[];config[_0xdb57('0x5')]=_['defaults'](config[_0xdb57('0x5')],{'ip':_0xdb57('0xa'),'port':0x11dd});AGIEmitter['on'](_0xdb57('0xb'),projectUpdateHandler);function connectionHandler(_0x4f7b8f){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x4f7b8f);agiHandler(_0x4f7b8f);}catch(_0x3d8cf1){logger[_0xdb57('0xc')](_0x3d8cf1[_0xdb57('0xd')]);}});});}function projectUpdateHandler(_0x11bc93){try{var _0x255b92=_[_0xdb57('0xe')](projects,['id',_0x11bc93['id']]);if(_0x255b92>-0x1){if(_0x11bc93[_0xdb57('0xf')]===!![]){projects[_0xdb57('0x10')](_0x255b92,0x1);}else{projects[_0x255b92]=_0x11bc93;}}else{projects[_0xdb57('0x11')](_0x11bc93);}}catch(_0x2bcbe3){logger[_0xdb57('0xc')](_0x2bcbe3[_0xdb57('0xd')]);}}function listeningHandler(){console[_0xdb57('0x12')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xdb57('0x5')]['port']);logger[_0xdb57('0x13')](util[_0xdb57('0x14')](_0xdb57('0x15'),config[_0xdb57('0x5')]['ip'],config['agi'][_0xdb57('0x16')]));}function errorHandler(_0x57e37a){if(_0x57e37a&&_0x57e37a['name']&&_0x57e37a[_0xdb57('0x17')]){logger['error'](util[_0xdb57('0x14')](_0xdb57('0x18'),_0x57e37a[_0xdb57('0x19')],_0x57e37a[_0xdb57('0x17')]));}else{logger[_0xdb57('0xc')](util[_0xdb57('0x14')](_0xdb57('0x1a'),_0x57e37a[_0xdb57('0xd')]));}}function closeHandler(){logger['info'](util[_0xdb57('0x14')](_0xdb57('0x1b'),this[_0xdb57('0x1c')],this[_0xdb57('0x1d')],this[_0xdb57('0x1e')],this['dnid'],this[_0xdb57('0x1f')]));try{createSquareReport(this);}catch(_0x33f71a){logger[_0xdb57('0xc')](_0x33f71a[_0xdb57('0xd')]);}}function timeoutHandler(){logger[_0xdb57('0x13')](util[_0xdb57('0x14')](_0xdb57('0x20'),this[_0xdb57('0x1c')],this[_0xdb57('0x1d')],this[_0xdb57('0x1e')],this[_0xdb57('0x21')],this[_0xdb57('0x1f')]));}function hangupHandler(){logger[_0xdb57('0x13')](util[_0xdb57('0x14')](_0xdb57('0x22'),this[_0xdb57('0x1c')],this[_0xdb57('0x1d')],this[_0xdb57('0x1e')],this[_0xdb57('0x21')],this[_0xdb57('0x1f')]));this[_0xdb57('0x23')]=!![];}function createSquareReport(_0x4cc687,_0x5820d1){rpc[_0xdb57('0x24')](_0x4cc687)[_0xdb57('0x25')](function(_0x17afbf){if(_0x5820d1){_0x5820d1(null,_0x17afbf);}})[_0xdb57('0x26')](function(_0x4ea513){if(_0x5820d1){_0x5820d1(null,_0x4ea513);}});}function setChannelVariables(_0x53d0ce){for(var _0x40decd in _0x53d0ce){if(_0x53d0ce['hasOwnProperty'](_0x40decd)){if(_0x40decd['indexOf']('agi_')===0x0){_0x53d0ce[_0x40decd[_0xdb57('0x27')](0x4)]=_0x53d0ce[_0x40decd];delete _0x53d0ce[_0x40decd];}}}}function agiHandler(_0x1a3626){logger[_0xdb57('0x28')](_0xdb57('0x29'),JSON['stringify'](_0x1a3626,null,0x2));logger['info'](util['format'](_0xdb57('0x2a'),_0x1a3626[_0xdb57('0x1c')],_0x1a3626[_0xdb57('0x1d')],_0x1a3626[_0xdb57('0x1e')],_0x1a3626[_0xdb57('0x21')],_0x1a3626[_0xdb57('0x1f')]));_0x1a3626['on'](_0xdb57('0xc'),errorHandler);_0x1a3626['on']('close',closeHandler);_0x1a3626['on'](_0xdb57('0x2b'),timeoutHandler);_0x1a3626[_0xdb57('0x23')]=![];_0x1a3626['on'](_0xdb57('0x2c'),hangupHandler);var _0x45fbba=_[_0xdb57('0x2d')](projects,[_0xdb57('0x19'),_0x1a3626[_0xdb57('0x1c')]]);if(!_0x45fbba)return Project['handleNotFound'](_0x1a3626);if(!_0x45fbba[_0xdb57('0x2e')])return Project[_0xdb57('0x2f')](_0x1a3626);return Project['initialize'](_0x45fbba,_0x1a3626);}function main(){var _0x127512;return utilLicense[_0xdb57('0x30')]()[_0xdb57('0x25')](function(_0x485522){if(!_0x485522)return;if(_0x485522[_0xdb57('0x31')]){if(_0x485522['callysquare']&&_0x485522['callysquare']>0x0){logger['info'](util[_0xdb57('0x14')](_0xdb57('0x32'),_0x485522[_0xdb57('0x33')]));_0x127512=_0x485522['callysquare'];}else{logger[_0xdb57('0x13')](_0xdb57('0x34'));}}else{logger['info'](_0xdb57('0x35'));_0x127512=-0x1;}})['then'](function(){return Project['getAll']();})[_0xdb57('0x25')](function(_0x376bcb){projects=_0x376bcb;return;})[_0xdb57('0x26')](function(_0x32bd39){logger[_0xdb57('0xc')](_0xdb57('0x36'),_0x32bd39[_0xdb57('0xd')]);})['finally'](function(){var _0x460f49=require('./server')(config[_0xdb57('0x5')][_0xdb57('0x16')],config[_0xdb57('0x5')]['ip'],_0x127512);_0x460f49['on']('error',errorHandler);_0x460f49['on'](_0xdb57('0x37'),listeningHandler);_0x460f49['on'](_0xdb57('0x38'),connectionHandler);_0x460f49['on'](_0xdb57('0x39'),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 1da38f7..b0fc21c 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 _0x6ecc=['error','message','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request'];(function(_0x5c6071,_0x1fed8a){var _0x45b025=function(_0x311f05){while(--_0x311f05){_0x5c6071['push'](_0x5c6071['shift']());}};_0x45b025(++_0x1fed8a);}(_0x6ecc,0xe1));var _0xc6ec=function(_0x11ccff,_0x508477){_0x11ccff=_0x11ccff-0x0;var _0x10827b=_0x6ecc[_0x11ccff];return _0x10827b;};'use strict';var BPromise=require(_0xc6ec('0x0'));var jayson=require(_0xc6ec('0x1'));var client=jayson[_0xc6ec('0x2')][_0xc6ec('0x3')]({'port':0x232b});function request(_0x345f1d,_0x4eee76){return new BPromise(function(_0x2e679a,_0x2d7cfd){return client[_0xc6ec('0x4')](_0x345f1d,_0x4eee76)['then'](function(_0x2e4823){if(_0x2e4823[_0xc6ec('0x5')]){return _0x2d7cfd(_0x2e4823[_0xc6ec('0x5')][_0xc6ec('0x6')]);}else{return _0x2e679a(_0x2e4823['result']);}})[_0xc6ec('0x7')](function(_0x1dff54){return _0x2d7cfd(_0x1dff54);});});}exports[_0xc6ec('0x8')]=function(_0x185e7e,_0x27c0f8){return request(_0xc6ec('0x9'),{'account':_0x185e7e,'message':_0x27c0f8});}; \ No newline at end of file +var _0x1d15=['result','sendMailMessage','SendMail','bluebird','jayson/promise','client','then','error','message'];(function(_0x50387a,_0x2eaaf4){var _0x5c3f4d=function(_0x1d490e){while(--_0x1d490e){_0x50387a['push'](_0x50387a['shift']());}};_0x5c3f4d(++_0x2eaaf4);}(_0x1d15,0x66));var _0x51d1=function(_0x471072,_0x27a8e9){_0x471072=_0x471072-0x0;var _0x1e8454=_0x1d15[_0x471072];return _0x1e8454;};'use strict';var BPromise=require(_0x51d1('0x0'));var jayson=require(_0x51d1('0x1'));var client=jayson[_0x51d1('0x2')]['http']({'port':0x232b});function request(_0x49ba36,_0x5cfeac){return new BPromise(function(_0x595cff,_0x47ff07){return client['request'](_0x49ba36,_0x5cfeac)[_0x51d1('0x3')](function(_0x33cd40){if(_0x33cd40[_0x51d1('0x4')]){return _0x47ff07(_0x33cd40['error'][_0x51d1('0x5')]);}else{return _0x595cff(_0x33cd40[_0x51d1('0x6')]);}})['catch'](function(_0x3c808e){return _0x47ff07(_0x3c808e);});});}exports[_0x51d1('0x7')]=function(_0x226e5c,_0x322ac5){return request(_0x51d1('0x8'),{'account':_0x226e5c,'message':_0x322ac5});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 7083e69..dc6e018 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 _0xf296=['response','code','result','evtHangup','isUndefined','toString','agicommand\x20not\x20found','stack','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','agi','./mailRpc','./graph','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','hasOwnProperty','retry','maxRetry','addVertex','mxCell','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','inspect','start','debug','root','stringify','joinAt','omit','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','clear','vertex','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority'];(function(_0x3ad4c5,_0x3fd451){var _0x2808fd=function(_0x1fd5ab){while(--_0x1fd5ab){_0x3ad4c5['push'](_0x3ad4c5['shift']());}};_0x2808fd(++_0x3fd451);}(_0xf296,0x91));var _0x6f29=function(_0x2fb28c,_0x458fc5){_0x2fb28c=_0x2fb28c-0x0;var _0x22ee82=_0xf296[_0x2fb28c];return _0x22ee82;};'use strict';var _=require(_0x6f29('0x0'));var moment=require(_0x6f29('0x1'));var parser=require(_0x6f29('0x2'));var util=require(_0x6f29('0x3'));var logger=require('../../config/logger')(_0x6f29('0x4'));var rpc=require('./rpc');var mailRpc=require(_0x6f29('0x5'));var Graph=require(_0x6f29('0x6'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x6f29('0x7')]()[_0x6f29('0x8')](function(_0x4a66e3){logger[_0x6f29('0x9')](_0x6f29('0xa'),_0x4a66e3['stack']);return[];});}function addVertex(_0x18f0fb,_0x4e283b,_0x3263d7){_0x4e283b[_0x6f29('0xb')]=_0x3263d7;if(_0x4e283b[_0x6f29('0xc')](_0x6f29('0xd'))){_0x4e283b[_0x6f29('0xe')]=parseInt(_0x4e283b[_0x6f29('0xd')],0xa);}_0x18f0fb[_0x6f29('0xf')](_['omit'](_0x4e283b,_0x6f29('0x10')));}function initGraph(_0x29b875,_0x32c43c){var _0x31af3f=new Graph();for(var _0x459817 in _0x29b875){if(_0x29b875[_0x6f29('0xc')](_0x459817)){if(_[_0x6f29('0x11')](_0x29b875[_0x459817])){for(var _0x28e8a8=0x0;_0x28e8a8<_0x29b875[_0x459817][_0x6f29('0x12')];_0x28e8a8+=0x1){addVertex(_0x31af3f,_0x29b875[_0x459817][_0x28e8a8],_0x459817);}}else{addVertex(_0x31af3f,_0x29b875[_0x459817],_0x459817);}}}for(var _0x5b9704=0x0;_0x5b9704<_0x32c43c[_0x6f29('0x12')];_0x5b9704+=0x1){if(_0x32c43c[_0x5b9704][_0x6f29('0x13')]&&_0x32c43c[_0x5b9704][_0x6f29('0x14')]){_0x31af3f[_0x6f29('0x15')](_0x32c43c[_0x5b9704]['source'],_0x32c43c[_0x5b9704]['target'],_0x32c43c[_0x5b9704][_0x6f29('0x16')]);}}return _0x31af3f;}function getRoot(_0x27cc81){return parser[_0x6f29('0x17')](_0x27cc81,{'object':!![]})[_0x6f29('0x18')]['root'];}function inspect(_0x3eca82){return util[_0x6f29('0x19')](_0x3eca82,{'showHidden':![],'depth':null});}function initialize(_0x300466,_0x19b355){var _0x1af1c9=getRoot(_0x300466['production']);if(!_0x1af1c9||!_0x1af1c9[_0x6f29('0x1a')])return;var _0x37e240,_0x36171e,_0x4f7651;logger[_0x6f29('0x1b')](_0x6f29('0x1c'),JSON[_0x6f29('0x1d')](_0x1af1c9,null,0x2));_0x19b355[_0x6f29('0x1e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x37e240=initGraph(_[_0x6f29('0x1f')](_0x1af1c9,_0x6f29('0x10')),_0x1af1c9[_0x6f29('0x10')]);_0x36171e=new Vertices(_0x19b355,rpc,mailRpc);logger['info'](util[_0x6f29('0x20')](_0x6f29('0x21'),_0x19b355[_0x6f29('0x22')],_0x19b355[_0x6f29('0x23')],_0x19b355[_0x6f29('0x24')],_0x19b355[_0x6f29('0x25')],_0x19b355[_0x6f29('0x26')]));_0x37e240['traverseBFS'](_0x1af1c9['start']['id'],function(_0x122076){try{_0x122076=_0x36171e[_0x6f29('0x27')](_0x122076);logger[_0x6f29('0x1b')](_0x6f29('0x28'),JSON[_0x6f29('0x1d')](_0x122076,null,0x2));if(_0x122076[_0x6f29('0xb')]===_0x6f29('0x29')){logger[_0x6f29('0x2a')](_0x6f29('0x2b'));_0x19b355[_0x6f29('0x2c')]=_0x122076['context']||_0x19b355[_0x6f29('0x2c')];_0x19b355[_0x6f29('0x2d')]=_0x122076['extension'];_0x19b355[_0x6f29('0x2e')]=_0x122076[_0x6f29('0x2e')]?_0x122076[_0x6f29('0x2e')]-0x1:0x1;return null;}else if(_0x122076&&_0x36171e[_0x122076[_0x6f29('0xb')]]){_0x4f7651=_0x36171e[_0x122076[_0x6f29('0xb')]](_0x122076);logger[_0x6f29('0x2a')](_0x6f29('0x2f'),JSON[_0x6f29('0x1d')](_0x4f7651,null,0x2));if(_0x4f7651&&_0x4f7651[_0x6f29('0x30')]===AGI_CODE_SUCCESS&&_0x4f7651[_0x6f29('0x31')]!==AGI_RESULT_ERROR&&!_0x19b355[_0x6f29('0x32')]){logger[_0x6f29('0x1b')](_0x6f29('0x2f'),inspect(_0x4f7651));return _[_0x6f29('0x33')](_0x4f7651['result'])?null:_0x4f7651['result'][_0x6f29('0x34')]();}else{logger[_0x6f29('0x9')](_0x6f29('0x2f'),inspect(_0x4f7651));return null;}}else{logger[_0x6f29('0x9')](_0x6f29('0x35'));return null;}}catch(_0x46817c){logger['error'](_0x46817c[_0x6f29('0x36')]);return null;}});if(_0x1af1c9[_0x6f29('0x37')]){logger[_0x6f29('0x2a')](util[_0x6f29('0x20')](_0x6f29('0x38'),_0x19b355['arg_1'],_0x19b355[_0x6f29('0x23')],_0x19b355[_0x6f29('0x24')],_0x19b355[_0x6f29('0x25')],_0x19b355[_0x6f29('0x26')]));_0x37e240[_0x6f29('0x39')](_0x1af1c9['finally']['id'],function(_0x4a6ce7){try{_0x4a6ce7=_0x36171e['clear'](_0x4a6ce7);logger[_0x6f29('0x1b')](_0x6f29('0x28'),JSON[_0x6f29('0x1d')](_0x4a6ce7,null,0x2));if(_0x4a6ce7&&_0x36171e[_0x4a6ce7['agicommand']]){_0x4f7651=_0x36171e[_0x4a6ce7[_0x6f29('0xb')]](_0x4a6ce7);if(_0x4f7651){logger[_0x6f29('0x1b')](_0x6f29('0x2f'),inspect(_0x4f7651));return _['isUndefined'](_0x4f7651['result'])?null:_0x4f7651[_0x6f29('0x31')]['toString']();}else{logger[_0x6f29('0x9')](_0x6f29('0x2f'),inspect(_0x4f7651));return null;}}else{logger[_0x6f29('0x9')](_0x6f29('0x35'));return null;}}catch(_0x4067bc){logger[_0x6f29('0x9')](_0x4067bc[_0x6f29('0x36')]);return null;}});}logger[_0x6f29('0x2a')](util['format']('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x19b355['arg_1'],_0x19b355[_0x6f29('0x23')],_0x19b355[_0x6f29('0x24')],_0x19b355[_0x6f29('0x25')],_0x19b355[_0x6f29('0x26')]));logger[_0x6f29('0x2a')](util[_0x6f29('0x20')](_0x6f29('0x3a'),_0x19b355[_0x6f29('0x2c')],_0x19b355[_0x6f29('0x2d')],parseInt(_0x19b355[_0x6f29('0x2e')],0xa)+0x1));_0x19b355[_0x6f29('0x3b')](_0x19b355[_0x6f29('0x2c')],_0x19b355[_0x6f29('0x2d')],parseInt(_0x19b355[_0x6f29('0x2e')],0xa)+0x1);_0x19b355[_0x6f29('0x3c')]();}function handleNotFound(_0x4aff0d){logger['error'](util['format'](_0x6f29('0x3d'),_0x4aff0d[_0x6f29('0x22')]));_0x4aff0d[_0x6f29('0x3b')](_0x4aff0d['context'],_0x4aff0d[_0x6f29('0x2d')],parseInt(_0x4aff0d[_0x6f29('0x2e')],0xa)+0x1);_0x4aff0d[_0x6f29('0x3c')]();}function handleUnpublished(_0x132fff){logger[_0x6f29('0x9')](util[_0x6f29('0x20')](_0x6f29('0x3e'),_0x132fff['arg_1']));_0x132fff['continueAt'](_0x132fff['context'],_0x132fff['extension'],parseInt(_0x132fff[_0x6f29('0x2e')],0xa)+0x1);_0x132fff[_0x6f29('0x3c')]();}module[_0x6f29('0x3f')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x2a06=['mxCell','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','uniqueid','traverseBFS','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','agicommand','response','code','evtHangup','isUndefined','toString','finally','format','arg_1','dnid','clear','result','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close','Project\x20%s\x20not\x20found','continueAt','Project\x20%s\x20not\x20published','exports','xml2json','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','stack','hasOwnProperty','retry','omit','length','source','toJson','mxGraphModel','inspect','production','start','debug','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x388e19,_0x1340d5){var _0x239141=function(_0x1261bc){while(--_0x1261bc){_0x388e19['push'](_0x388e19['shift']());}};_0x239141(++_0x1340d5);}(_0x2a06,0x13d));var _0x62a0=function(_0x2121ae,_0x445836){_0x2121ae=_0x2121ae-0x0;var _0x5a9747=_0x2a06[_0x2121ae];return _0x5a9747;};'use strict';var _=require('lodash');var moment=require('moment');var parser=require(_0x62a0('0x0'));var util=require('util');var logger=require(_0x62a0('0x1'))(_0x62a0('0x2'));var rpc=require(_0x62a0('0x3'));var mailRpc=require(_0x62a0('0x4'));var Graph=require(_0x62a0('0x5'));var Vertices=require(_0x62a0('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x62a0('0x7')]()[_0x62a0('0x8')](function(_0x45aeb5){logger[_0x62a0('0x9')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x45aeb5[_0x62a0('0xa')]);return[];});}function addVertex(_0x674901,_0x46f6bc,_0x4d65c1){_0x46f6bc['agicommand']=_0x4d65c1;if(_0x46f6bc[_0x62a0('0xb')](_0x62a0('0xc'))){_0x46f6bc['maxRetry']=parseInt(_0x46f6bc[_0x62a0('0xc')],0xa);}_0x674901['addVertex'](_[_0x62a0('0xd')](_0x46f6bc,'mxCell'));}function initGraph(_0x2afc91,_0x4f3bc1){var _0x311813=new Graph();for(var _0x30f2cc in _0x2afc91){if(_0x2afc91['hasOwnProperty'](_0x30f2cc)){if(_['isArray'](_0x2afc91[_0x30f2cc])){for(var _0xacfc00=0x0;_0xacfc00<_0x2afc91[_0x30f2cc]['length'];_0xacfc00+=0x1){addVertex(_0x311813,_0x2afc91[_0x30f2cc][_0xacfc00],_0x30f2cc);}}else{addVertex(_0x311813,_0x2afc91[_0x30f2cc],_0x30f2cc);}}}for(var _0x4e2ea2=0x0;_0x4e2ea2<_0x4f3bc1[_0x62a0('0xe')];_0x4e2ea2+=0x1){if(_0x4f3bc1[_0x4e2ea2][_0x62a0('0xf')]&&_0x4f3bc1[_0x4e2ea2]['target']){_0x311813['addEdge'](_0x4f3bc1[_0x4e2ea2]['source'],_0x4f3bc1[_0x4e2ea2]['target'],_0x4f3bc1[_0x4e2ea2]['value']);}}return _0x311813;}function getRoot(_0xda7860){return parser[_0x62a0('0x10')](_0xda7860,{'object':!![]})[_0x62a0('0x11')]['root'];}function inspect(_0x25af7e){return util[_0x62a0('0x12')](_0x25af7e,{'showHidden':![],'depth':null});}function initialize(_0xce0340,_0x36db68){var _0x55a955=getRoot(_0xce0340[_0x62a0('0x13')]);if(!_0x55a955||!_0x55a955[_0x62a0('0x14')])return;var _0x47ee3b,_0x5ebf38,_0x4197c4;logger[_0x62a0('0x15')]('root',JSON[_0x62a0('0x16')](_0x55a955,null,0x2));_0x36db68[_0x62a0('0x17')]=moment()['format'](_0x62a0('0x18'));_0x47ee3b=initGraph(_[_0x62a0('0xd')](_0x55a955,'mxCell'),_0x55a955[_0x62a0('0x19')]);_0x5ebf38=new Vertices(_0x36db68,rpc,mailRpc);logger[_0x62a0('0x1a')](util['format'](_0x62a0('0x1b'),_0x36db68['arg_1'],_0x36db68[_0x62a0('0x1c')],_0x36db68[_0x62a0('0x1d')],_0x36db68['dnid'],_0x36db68[_0x62a0('0x1e')]));_0x47ee3b[_0x62a0('0x1f')](_0x55a955['start']['id'],function(_0x522160){try{_0x522160=_0x5ebf38['clear'](_0x522160);logger[_0x62a0('0x15')]('vertex',JSON[_0x62a0('0x16')](_0x522160,null,0x2));if(_0x522160['agicommand']===_0x62a0('0x20')){logger[_0x62a0('0x1a')](_0x62a0('0x21'));_0x36db68[_0x62a0('0x22')]=_0x522160['context']||_0x36db68[_0x62a0('0x22')];_0x36db68[_0x62a0('0x23')]=_0x522160['extension'];_0x36db68['priority']=_0x522160['priority']?_0x522160[_0x62a0('0x24')]-0x1:0x1;return null;}else if(_0x522160&&_0x5ebf38[_0x522160[_0x62a0('0x25')]]){_0x4197c4=_0x5ebf38[_0x522160[_0x62a0('0x25')]](_0x522160);logger[_0x62a0('0x1a')](_0x62a0('0x26'),JSON[_0x62a0('0x16')](_0x4197c4,null,0x2));if(_0x4197c4&&_0x4197c4[_0x62a0('0x27')]===AGI_CODE_SUCCESS&&_0x4197c4['result']!==AGI_RESULT_ERROR&&!_0x36db68[_0x62a0('0x28')]){logger[_0x62a0('0x15')](_0x62a0('0x26'),inspect(_0x4197c4));return _[_0x62a0('0x29')](_0x4197c4['result'])?null:_0x4197c4['result'][_0x62a0('0x2a')]();}else{logger[_0x62a0('0x9')]('response',inspect(_0x4197c4));return null;}}else{logger[_0x62a0('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0x42ceaa){logger[_0x62a0('0x9')](_0x42ceaa['stack']);return null;}});if(_0x55a955[_0x62a0('0x2b')]){logger['info'](util[_0x62a0('0x2c')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x36db68[_0x62a0('0x2d')],_0x36db68[_0x62a0('0x1c')],_0x36db68[_0x62a0('0x1d')],_0x36db68[_0x62a0('0x2e')],_0x36db68['uniqueid']));_0x47ee3b[_0x62a0('0x1f')](_0x55a955[_0x62a0('0x2b')]['id'],function(_0x2a2521){try{_0x2a2521=_0x5ebf38[_0x62a0('0x2f')](_0x2a2521);logger[_0x62a0('0x15')]('vertex',JSON[_0x62a0('0x16')](_0x2a2521,null,0x2));if(_0x2a2521&&_0x5ebf38[_0x2a2521[_0x62a0('0x25')]]){_0x4197c4=_0x5ebf38[_0x2a2521[_0x62a0('0x25')]](_0x2a2521);if(_0x4197c4){logger[_0x62a0('0x15')](_0x62a0('0x26'),inspect(_0x4197c4));return _[_0x62a0('0x29')](_0x4197c4[_0x62a0('0x30')])?null:_0x4197c4[_0x62a0('0x30')]['toString']();}else{logger['error']('response',inspect(_0x4197c4));return null;}}else{logger[_0x62a0('0x9')](_0x62a0('0x31'));return null;}}catch(_0xfb5051){logger[_0x62a0('0x9')](_0xfb5051['stack']);return null;}});}logger[_0x62a0('0x1a')](util[_0x62a0('0x2c')](_0x62a0('0x32'),_0x36db68[_0x62a0('0x2d')],_0x36db68['calleridname'],_0x36db68['callerid'],_0x36db68['dnid'],_0x36db68[_0x62a0('0x1e')]));logger[_0x62a0('0x1a')](util[_0x62a0('0x2c')](_0x62a0('0x33'),_0x36db68['context'],_0x36db68['extension'],parseInt(_0x36db68[_0x62a0('0x24')],0xa)+0x1));_0x36db68['continueAt'](_0x36db68[_0x62a0('0x22')],_0x36db68[_0x62a0('0x23')],parseInt(_0x36db68[_0x62a0('0x24')],0xa)+0x1);_0x36db68[_0x62a0('0x34')]();}function handleNotFound(_0x257619){logger[_0x62a0('0x9')](util[_0x62a0('0x2c')](_0x62a0('0x35'),_0x257619['arg_1']));_0x257619[_0x62a0('0x36')](_0x257619[_0x62a0('0x22')],_0x257619[_0x62a0('0x23')],parseInt(_0x257619[_0x62a0('0x24')],0xa)+0x1);_0x257619['close']();}function handleUnpublished(_0x32cfd2){logger[_0x62a0('0x9')](util[_0x62a0('0x2c')](_0x62a0('0x37'),_0x32cfd2[_0x62a0('0x2d')]));_0x32cfd2[_0x62a0('0x36')](_0x32cfd2[_0x62a0('0x22')],_0x32cfd2[_0x62a0('0x23')],parseInt(_0x32cfd2[_0x62a0('0x24')],0xa)+0x1);_0x32cfd2[_0x62a0('0x34')]();}module[_0x62a0('0x38')]={'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 1bff09c..44024c3 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 _0x3f2b=['split','slice','trim','emit','line','exports','util','Transform','call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','length'];(function(_0x4286c3,_0xf41590){var _0x3520d2=function(_0x10dbd3){while(--_0x10dbd3){_0x4286c3['push'](_0x4286c3['shift']());}};_0x3520d2(++_0xf41590);}(_0x3f2b,0x1f4));var _0xb3f2=function(_0x27a0bf,_0x261918){_0x27a0bf=_0x27a0bf-0x0;var _0x33249f=_0x3f2b[_0x27a0bf];return _0x33249f;};'use strict';var util=require(_0xb3f2('0x0'));var Transform=require('stream')[_0xb3f2('0x1')];function AGIReply(_0x41e901){Transform[_0xb3f2('0x2')](this,_0x41e901);this['_localBuffer']='';this[_0xb3f2('0x3')]=![];}util[_0xb3f2('0x4')](AGIReply,Transform);AGIReply[_0xb3f2('0x5')][_0xb3f2('0x6')]=function(_0x4dc3f6,_0x58de6b,_0x4e3265){var _0x1be817='\x0a',_0x341b53=['\x0a\x0a',_0xb3f2('0x7')],_0x5f4564=-0x1,_0x2bbf7f=-0x1,_0x35e243='',_0x388539=0x0,_0x326c40='',_0x39fb4d='';this[_0xb3f2('0x8')]+=_0x4dc3f6[_0xb3f2('0x9')]();_0x326c40=this['_localBuffer'];if(!this[_0xb3f2('0x3')]){_0x388539=0x0;while(_0x341b53[_0x388539]){while((_0x2bbf7f=_0x326c40[_0xb3f2('0xa')](_0x341b53[_0x388539]))!=-0x1){_0x35e243=_0x341b53[_0x388539];_0x39fb4d=_0x326c40[_0xb3f2('0xb')](0x0,_0x2bbf7f);_0x326c40=_0x326c40[_0xb3f2('0xb')](_0x2bbf7f+_0x35e243[_0xb3f2('0xc')]);var _0x388edc=_0x39fb4d[_0xb3f2('0xd')](_0x1be817),_0x4fa00e=0x0,_0x4561e1={},_0x10bd9c='',_0x1fc7cf='',_0x14e3ec=-0x1;while(_0x388edc[_0x4fa00e]){_0x14e3ec=_0x388edc[_0x4fa00e][_0xb3f2('0xa')](':');if(_0x14e3ec!=-0x1){_0x10bd9c=_0x388edc[_0x4fa00e][_0xb3f2('0xe')](0x0,_0x14e3ec)[_0xb3f2('0xf')]();_0x1fc7cf=_0x388edc[_0x4fa00e]['slice'](_0x14e3ec+0x1)['trim']();if(_0x10bd9c['length']>0x0){_0x4561e1[_0x10bd9c]=_0x1fc7cf;}}else{}_0x4fa00e++;}this[_0xb3f2('0x10')]('headers',_0x4561e1);this[_0xb3f2('0x3')]=!![];}_0x388539++;}this['_localBuffer']=_0x326c40;}else{while((_0x5f4564=_0x326c40[_0xb3f2('0xa')](_0x1be817))!=-0x1){_0x39fb4d=_0x326c40[_0xb3f2('0xb')](0x0,_0x5f4564);this[_0xb3f2('0x10')](_0xb3f2('0x11'),_0x39fb4d);_0x326c40=_0x326c40[_0xb3f2('0xb')](_0x5f4564+_0x1be817[_0xb3f2('0xc')]);}this[_0xb3f2('0x8')]=_0x326c40;}_0x4e3265();};module[_0xb3f2('0x12')]=AGIReply; \ No newline at end of file +var _0x4a3d=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','substring','length','split','indexOf','slice','trim','emit','line'];(function(_0x59d7da,_0x3a28a1){var _0x59447a=function(_0xbc961d){while(--_0xbc961d){_0x59d7da['push'](_0x59d7da['shift']());}};_0x59447a(++_0x3a28a1);}(_0x4a3d,0x79));var _0xd4a3=function(_0x501c4c,_0x3875a6){_0x501c4c=_0x501c4c-0x0;var _0x514e74=_0x4a3d[_0x501c4c];return _0x514e74;};'use strict';var util=require(_0xd4a3('0x0'));var Transform=require(_0xd4a3('0x1'))[_0xd4a3('0x2')];function AGIReply(_0x2532d2){Transform[_0xd4a3('0x3')](this,_0x2532d2);this[_0xd4a3('0x4')]='';this[_0xd4a3('0x5')]=![];}util[_0xd4a3('0x6')](AGIReply,Transform);AGIReply[_0xd4a3('0x7')][_0xd4a3('0x8')]=function(_0x37c24b,_0x8c176c,_0x52ffaf){var _0x523038='\x0a',_0x2449da=['\x0a\x0a',_0xd4a3('0x9')],_0x45baf1=-0x1,_0x5910aa=-0x1,_0x490bc1='',_0x33c34b=0x0,_0x1ad12e='',_0xd3a874='';this[_0xd4a3('0x4')]+=_0x37c24b[_0xd4a3('0xa')]();_0x1ad12e=this[_0xd4a3('0x4')];if(!this[_0xd4a3('0x5')]){_0x33c34b=0x0;while(_0x2449da[_0x33c34b]){while((_0x5910aa=_0x1ad12e['indexOf'](_0x2449da[_0x33c34b]))!=-0x1){_0x490bc1=_0x2449da[_0x33c34b];_0xd3a874=_0x1ad12e[_0xd4a3('0xb')](0x0,_0x5910aa);_0x1ad12e=_0x1ad12e[_0xd4a3('0xb')](_0x5910aa+_0x490bc1[_0xd4a3('0xc')]);var _0x213577=_0xd3a874[_0xd4a3('0xd')](_0x523038),_0x81079a=0x0,_0x1cb7f9={},_0x3e7728='',_0x57bd90='',_0x3548e4=-0x1;while(_0x213577[_0x81079a]){_0x3548e4=_0x213577[_0x81079a][_0xd4a3('0xe')](':');if(_0x3548e4!=-0x1){_0x3e7728=_0x213577[_0x81079a][_0xd4a3('0xf')](0x0,_0x3548e4)[_0xd4a3('0x10')]();_0x57bd90=_0x213577[_0x81079a][_0xd4a3('0xf')](_0x3548e4+0x1)[_0xd4a3('0x10')]();if(_0x3e7728[_0xd4a3('0xc')]>0x0){_0x1cb7f9[_0x3e7728]=_0x57bd90;}}else{}_0x81079a++;}this['emit']('headers',_0x1cb7f9);this[_0xd4a3('0x5')]=!![];}_0x33c34b++;}this[_0xd4a3('0x4')]=_0x1ad12e;}else{while((_0x45baf1=_0x1ad12e[_0xd4a3('0xe')](_0x523038))!=-0x1){_0xd3a874=_0x1ad12e[_0xd4a3('0xb')](0x0,_0x45baf1);this[_0xd4a3('0x11')](_0xd4a3('0x12'),_0xd3a874);_0x1ad12e=_0x1ad12e['substring'](_0x45baf1+_0x523038[_0xd4a3('0xc')]);}this['_localBuffer']=_0x1ad12e;}_0x52ffaf();};module[_0xd4a3('0x13')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 89e19fb..7852f39 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 _0x7a08=['getTrunkById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','http','request','then','error','message','catch','getSquareProjects','GetSquareProjects','name','ShowSquareProject','production','getMailAccountById','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','phone'];(function(_0x36f243,_0x188505){var _0x426436=function(_0x1c8622){while(--_0x1c8622){_0x36f243['push'](_0x36f243['shift']());}};_0x426436(++_0x188505);}(_0x7a08,0x11e));var _0x87a0=function(_0x45dd0e,_0x28e603){_0x45dd0e=_0x45dd0e-0x0;var _0x50e5ca=_0x7a08[_0x45dd0e];return _0x50e5ca;};'use strict';var _=require(_0x87a0('0x0'));var moment=require(_0x87a0('0x1'));var jayson=require('jayson/promise');var client=jayson['client'][_0x87a0('0x2')]({'port':0x2329});function request(_0x5e6791,_0x1b3e4d){return new Promise(function(_0x8fd36d,_0x28c28f){return client[_0x87a0('0x3')](_0x5e6791,_0x1b3e4d)[_0x87a0('0x4')](function(_0x3c26e2){if(_0x3c26e2[_0x87a0('0x5')]){return _0x28c28f(_0x3c26e2[_0x87a0('0x5')][_0x87a0('0x6')]);}else{return _0x8fd36d(_0x3c26e2['result']);}})[_0x87a0('0x7')](function(_0x1bb04b){return _0x28c28f(_0x1bb04b);});});}exports[_0x87a0('0x8')]=function(){return request(_0x87a0('0x9'),{'options':{'raw':![],'attributes':['id',_0x87a0('0xa'),'production']}});};exports['getSquareProject']=function(_0x253737){return request(_0x87a0('0xb'),{'options':{'raw':![],'where':{'name':_0x253737},'attributes':[_0x87a0('0xc')]}});};exports[_0x87a0('0xd')]=function(_0x34ba3a){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x34ba3a},'include':[{'model':_0x87a0('0xe'),'as':_0x87a0('0xf'),'include':[{'model':_0x87a0('0x10'),'as':'CloudProvider'}]}],'attributes':['id',_0x87a0('0xa'),_0x87a0('0x11')],'smtp':!![]}});};exports[_0x87a0('0x12')]=function(_0x45a170){return request('ShowSquareProject',{'options':{'where':{'id':_0x45a170},'attributes':[_0x87a0('0xa')]}});};exports[_0x87a0('0x13')]=function(_0x290a29){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x290a29},'attributes':[_0x87a0('0xa')]}});};exports[_0x87a0('0x14')]=function(_0x3f69f3){return request(_0x87a0('0x15'),{'options':{'where':{'id':_0x3f69f3},'attributes':['name']}});};exports[_0x87a0('0x16')]=function(_0x57a941){return request(_0x87a0('0x17'),{'options':{'where':{'id':_0x57a941},'attributes':[_0x87a0('0x18')]}});};exports[_0x87a0('0x19')]=function(_0x26a72e){return request(_0x87a0('0x1a'),{'options':{'where':{'id':_0x26a72e},'attributes':['name']}});};exports[_0x87a0('0x1b')]=function(_0x57bf72){return request('GetContactByPhone',{'options':{'where':{'phone':_0x57bf72[_0x87a0('0x1c')]},'attributes':['id']}});};exports[_0x87a0('0x1d')]=function(_0x2a42ea){return request('ShowTrunk',{'options':{'where':{'id':_0x2a42ea},'attributes':[_0x87a0('0xa')]}});};exports['getSoundById']=function(_0x5a2c23){return request(_0x87a0('0x1e'),{'options':{'where':{'id':_0x5a2c23},'attributes':[_0x87a0('0x1f')]}});};exports[_0x87a0('0x20')]=function(_0x390bb2){return request(_0x87a0('0x21'),{'options':{'raw':![],'where':{'id':_0x390bb2},'include':[{'model':_0x87a0('0x22'),'as':'Intervals'}]}});};exports[_0x87a0('0x23')]=function(_0x1f59f7){return request('ShowSmsAccount',{'options':{'where':{'id':_0x1f59f7},'attributes':['id',_0x87a0('0xa')]}});};exports[_0x87a0('0x24')]=function(_0x48dfe2){return request(_0x87a0('0x25'),{'body':_0x48dfe2});};exports['createSquareDetailsReport']=function(_0x152ae5){return request(_0x87a0('0x26'),{'body':_0x152ae5});};exports[_0x87a0('0x27')]=function(_0x39ef35){return request(_0x87a0('0x28'),{'body':_[_0x87a0('0x29')](_0x39ef35,{'project_name':_0x39ef35[_0x87a0('0x2a')],'prev_project_name':_0x39ef35[_0x87a0('0x2b')]||'','is_subproject':_0x39ef35[_0x87a0('0x2b')]?!![]:![],'leaveAt':moment()[_0x87a0('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x87a0('0x2d')]=function(_0x15f0f1){return request(_0x87a0('0x2e'),{'body':_0x15f0f1});};exports[_0x87a0('0x2f')]=function(_0x17ee9e){return request(_0x87a0('0x30'),{'body':_0x17ee9e});};exports[_0x87a0('0x31')]=function(_0x55dbf7){return request(_0x87a0('0x32'),{'options':{'raw':![],'where':{'phone':_0x55dbf7[_0x87a0('0x1c')],'ListId':_0x55dbf7[_0x87a0('0x33')]}}})[_0x87a0('0x4')](function(_0x482f6b){if(_0x482f6b){return _0x482f6b;}return request(_0x87a0('0x34'),{'body':_0x55dbf7});});};exports[_0x87a0('0x35')]=function(_0x4c511c){return request(_0x87a0('0x36'),{'options':{'where':{'id':_0x4c511c},'attributes':[_0x87a0('0xa')]}});};exports[_0x87a0('0x37')]=function(_0x50f24d,_0x2f02d1){return request(_0x87a0('0x38'),{'body':{'interface':_0x2f02d1},'options':{'where':_0x50f24d}});};exports[_0x87a0('0x39')]=function(_0x1b3769,_0x40c48a,_0x4b4cf9){return request(_0x87a0('0x3a'),{'body':{'type':_0x40c48a,'uniqueid':_0x4b4cf9},'options':{'where':_0x1b3769}});};exports[_0x87a0('0x3b')]=function(_0x33c335){return request(_0x87a0('0x3c'),{'body':{},'options':{'where':_0x33c335}});};exports[_0x87a0('0x3d')]=function(_0x6710bd){return request(_0x87a0('0x3e'),{'body':{},'options':{'where':_0x6710bd}});}; \ No newline at end of file +var _0x63b6=['GetSquareProjects','name','production','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Interval','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ListId','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','http','request','then','error','message','catch','getSquareProjects'];(function(_0x3598bb,_0x24befa){var _0x13c837=function(_0x3de578){while(--_0x3de578){_0x3598bb['push'](_0x3598bb['shift']());}};_0x13c837(++_0x24befa);}(_0x63b6,0x127));var _0x663b=function(_0x14cc8e,_0x2d41eb){_0x14cc8e=_0x14cc8e-0x0;var _0x16023c=_0x63b6[_0x14cc8e];return _0x16023c;};'use strict';var _=require(_0x663b('0x0'));var moment=require(_0x663b('0x1'));var jayson=require(_0x663b('0x2'));var client=jayson['client'][_0x663b('0x3')]({'port':0x2329});function request(_0x522472,_0x10dcf6){return new Promise(function(_0x5d9f1d,_0x93bab1){return client[_0x663b('0x4')](_0x522472,_0x10dcf6)[_0x663b('0x5')](function(_0x4c6940){if(_0x4c6940[_0x663b('0x6')]){return _0x93bab1(_0x4c6940['error'][_0x663b('0x7')]);}else{return _0x5d9f1d(_0x4c6940['result']);}})[_0x663b('0x8')](function(_0x2976ff){return _0x93bab1(_0x2976ff);});});}exports[_0x663b('0x9')]=function(){return request(_0x663b('0xa'),{'options':{'raw':![],'attributes':['id',_0x663b('0xb'),_0x663b('0xc')]}});};exports['getSquareProject']=function(_0x31106e){return request(_0x663b('0xd'),{'options':{'raw':![],'where':{'name':_0x31106e},'attributes':[_0x663b('0xc')]}});};exports[_0x663b('0xe')]=function(_0x1dd00c){return request(_0x663b('0xf'),{'options':{'raw':![],'where':{'id':_0x1dd00c},'include':[{'model':_0x663b('0x10'),'as':_0x663b('0x11'),'include':[{'model':_0x663b('0x12'),'as':_0x663b('0x12')}]}],'attributes':['id','name','email'],'smtp':!![]}});};exports[_0x663b('0x13')]=function(_0xa5b910){return request(_0x663b('0xd'),{'options':{'where':{'id':_0xa5b910},'attributes':[_0x663b('0xb')]}});};exports[_0x663b('0x14')]=function(_0x13cb09){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x13cb09},'attributes':[_0x663b('0xb')]}});};exports[_0x663b('0x15')]=function(_0x4738e2){return request(_0x663b('0x16'),{'options':{'where':{'id':_0x4738e2},'attributes':[_0x663b('0xb')]}});};exports[_0x663b('0x17')]=function(_0x38578f){return request(_0x663b('0x18'),{'options':{'where':{'id':_0x38578f},'attributes':[_0x663b('0x19')]}});};exports[_0x663b('0x1a')]=function(_0x26a596){return request(_0x663b('0x1b'),{'options':{'where':{'id':_0x26a596},'attributes':[_0x663b('0xb')]}});};exports[_0x663b('0x1c')]=function(_0x4c8a8a){return request(_0x663b('0x1d'),{'options':{'where':{'phone':_0x4c8a8a[_0x663b('0x1e')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x79a64c){return request(_0x663b('0x1f'),{'options':{'where':{'id':_0x79a64c},'attributes':['name']}});};exports['getSoundById']=function(_0x1f7dd9){return request(_0x663b('0x20'),{'options':{'where':{'id':_0x1f7dd9},'attributes':[_0x663b('0x21')]}});};exports[_0x663b('0x22')]=function(_0x50ecbb){return request(_0x663b('0x23'),{'options':{'raw':![],'where':{'id':_0x50ecbb},'include':[{'model':_0x663b('0x24'),'as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x521a89){return request('ShowSmsAccount',{'options':{'where':{'id':_0x521a89},'attributes':['id',_0x663b('0xb')]}});};exports[_0x663b('0x25')]=function(_0x2d1b52){return request(_0x663b('0x26'),{'body':_0x2d1b52});};exports[_0x663b('0x27')]=function(_0x43b58a){return request(_0x663b('0x28'),{'body':_0x43b58a});};exports[_0x663b('0x29')]=function(_0x3eab48){return request('CreateSquareReport',{'body':_[_0x663b('0x2a')](_0x3eab48,{'project_name':_0x3eab48[_0x663b('0x2b')],'prev_project_name':_0x3eab48['arg_2']||'','is_subproject':_0x3eab48[_0x663b('0x2c')]?!![]:![],'leaveAt':moment()['format'](_0x663b('0x2d'))})});};exports[_0x663b('0x2e')]=function(_0x27dd97){return request('CreateSquareRecording',{'body':_0x27dd97});};exports[_0x663b('0x2f')]=function(_0x10f2e0){return request(_0x663b('0x30'),{'body':_0x10f2e0});};exports[_0x663b('0x31')]=function(_0x5a1580){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x5a1580['phone'],'ListId':_0x5a1580[_0x663b('0x32')]}}})[_0x663b('0x5')](function(_0x5ef7ae){if(_0x5ef7ae){return _0x5ef7ae;}return request(_0x663b('0x33'),{'body':_0x5a1580});});};exports['getPauseById']=function(_0x5134c8){return request(_0x663b('0x34'),{'options':{'where':{'id':_0x5134c8},'attributes':[_0x663b('0xb')]}});};exports[_0x663b('0x35')]=function(_0x588fd1,_0x4a165a){return request(_0x663b('0x36'),{'body':{'interface':_0x4a165a},'options':{'where':_0x588fd1}});};exports[_0x663b('0x37')]=function(_0x2e4c3c,_0x38aeb3,_0x429f56){return request(_0x663b('0x38'),{'body':{'type':_0x38aeb3,'uniqueid':_0x429f56},'options':{'where':_0x2e4c3c}});};exports[_0x663b('0x39')]=function(_0x40cb7f){return request(_0x663b('0x3a'),{'body':{},'options':{'where':_0x40cb7f}});};exports[_0x663b('0x3b')]=function(_0x6e7795){return request(_0x663b('0x3c'),{'body':{},'options':{'where':_0x6e7795}});}; \ 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 73003bb..5207fc2 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 _0x7923=['./lex','exports','./polly'];(function(_0x1a014b,_0x48acae){var _0x462258=function(_0x1473be){while(--_0x1473be){_0x1a014b['push'](_0x1a014b['shift']());}};_0x462258(++_0x48acae);}(_0x7923,0x8f));var _0x3792=function(_0x1aa795,_0x7ef1e4){_0x1aa795=_0x1aa795-0x0;var _0x252a82=_0x7923[_0x1aa795];return _0x252a82;};var polly=require(_0x3792('0x0'));var lex=require(_0x3792('0x1'));module[_0x3792('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x095b=['./polly','exports'];(function(_0xf3df17,_0x986f37){var _0x37766d=function(_0x5a2961){while(--_0x5a2961){_0xf3df17['push'](_0xf3df17['shift']());}};_0x37766d(++_0x986f37);}(_0x095b,0x6e));var _0xb095=function(_0x39d31e,_0x4a822d){_0x39d31e=_0x39d31e-0x0;var _0x467a2b=_0x095b[_0x39d31e];return _0x467a2b;};var polly=require(_0xb095('0x0'));var lex=require('./lex');module[_0xb095('0x1')]={'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 1273693..a9ec881 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. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x3d5d4e,_0x33a55d,_0x5527b3,_0x175deb,_0xd002ca,_0x200b2a){return lex(_0x3d5d4e,_0x33a55d,_0x5527b3,_0x175deb,_0xd002ca,_0x200b2a);}; \ No newline at end of file +'use strict';var lex=require('./lib/api');module['exports']=function(_0x2c1d27,_0x4c4c00,_0x4b5765,_0x29e4c8,_0x110824,_0x394a1e){return lex(_0x2c1d27,_0x4c4c00,_0x4b5765,_0x29e4c8,_0x110824,_0x394a1e);}; \ 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 a1f33a1..183e9a7 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(_0x401e1d,_0x36973a){var _0x270200=function(_0x369de8){while(--_0x369de8){_0x401e1d['push'](_0x401e1d['shift']());}};_0x270200(++_0x36973a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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(_0x29fa83,_0x92e849){var _0x2bd96b=function(_0x1899d2){while(--_0x1899d2){_0x29fa83['push'](_0x29fa83['shift']());}};_0x2bd96b(++_0x92e849);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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 a25a057..c79453f 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 _0xcffc=['exports','./lib/api'];(function(_0x487fee,_0x35c911){var _0x2d1cab=function(_0x2738dd){while(--_0x2738dd){_0x487fee['push'](_0x487fee['shift']());}};_0x2d1cab(++_0x35c911);}(_0xcffc,0x13f));var _0xccff=function(_0x698023,_0x20f9ce){_0x698023=_0x698023-0x0;var _0x2a7704=_0xcffc[_0x698023];return _0x2a7704;};'use strict';var polly=require(_0xccff('0x0'));module[_0xccff('0x1')]=function(_0x427e37,_0x49d4bb,_0x31fe33,_0x225813,_0x379579,_0x2b0cad,_0x5f03cb){return polly(_0x427e37,_0x49d4bb,_0x31fe33,_0x225813,_0x379579,_0x2b0cad,_0x5f03cb);}; \ No newline at end of file +var _0x6b79=['./lib/api'];(function(_0x264329,_0x3fc8a2){var _0x37e3dc=function(_0x1c518c){while(--_0x1c518c){_0x264329['push'](_0x264329['shift']());}};_0x37e3dc(++_0x3fc8a2);}(_0x6b79,0x19c));var _0x96b7=function(_0x1ea0e4,_0x303610){_0x1ea0e4=_0x1ea0e4-0x0;var _0x46bb85=_0x6b79[_0x1ea0e4];return _0x46bb85;};'use strict';var polly=require(_0x96b7('0x0'));module['exports']=function(_0xcf3ef,_0x27a95a,_0x568cde,_0x4bb6b9,_0x917bf3,_0x333756,_0x5143d5){return polly(_0xcf3ef,_0x27a95a,_0x568cde,_0x4bb6b9,_0x917bf3,_0x333756,_0x5143d5);}; \ 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 3b793b6..e1b0ce4 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 _0x882a=['randomstring','aws-sdk','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','bluebird'];(function(_0x56b2df,_0x123d50){var _0x21206f=function(_0x3ced14){while(--_0x3ced14){_0x56b2df['push'](_0x56b2df['shift']());}};_0x21206f(++_0x123d50);}(_0x882a,0x83));var _0xa882=function(_0x1161df,_0x25b582){_0x1161df=_0x1161df-0x0;var _0x4594cc=_0x882a[_0x1161df];return _0x4594cc;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xa882('0x0'));var rs=require(_0xa882('0x1'));var AWS=require(_0xa882('0x2'));function pollyResult(_0x76c939,_0xa440f7,_0x351b22){return new BPromise(function(_0x55e154,_0x168810){_0x76c939[_0xa882('0x3')](_0xa440f7,function(_0x242841,_0x237bbd){if(_0x242841){_0x168810(_0x242841);}else if(_0x237bbd){if(_0x237bbd['AudioStream']instanceof Buffer){fs[_0xa882('0x4')](_0x351b22,_0x237bbd[_0xa882('0x5')],function(_0x522feb){if(_0x522feb){_0x168810(_0x522feb);}else{_0x55e154();}});}else{_0x168810(new Error(_0xa882('0x6')));}}else{_0x168810(new Error(_0xa882('0x7')));}});});}module[_0xa882('0x8')]=function(_0x3495c6,_0x4c07b5,_0x4f004c,_0x258dd4,_0x4b7f9f,_0x584dde,_0x5a6a9a){var _0x46c78e=new AWS[(_0xa882('0x9'))]({'accessKeyId':_0x3495c6,'secretAccessKey':_0x4c07b5,'region':_0x4f004c});var _0x477260={'Text':_0x4b7f9f,'TextType':_0x584dde||_0xa882('0xa'),'OutputFormat':_0xa882('0xb'),'VoiceId':_0x258dd4};return pollyResult(_0x46c78e,_0x477260,_0x5a6a9a);}; \ No newline at end of file +var _0x1a63=['bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3'];(function(_0x250514,_0x389eda){var _0x59c25b=function(_0x3ad38b){while(--_0x3ad38b){_0x250514['push'](_0x250514['shift']());}};_0x59c25b(++_0x389eda);}(_0x1a63,0xdc));var _0x31a6=function(_0x3d1d8e,_0x533b1c){_0x3d1d8e=_0x3d1d8e-0x0;var _0x175671=_0x1a63[_0x3d1d8e];return _0x175671;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x31a6('0x0'));var rs=require(_0x31a6('0x1'));var AWS=require(_0x31a6('0x2'));function pollyResult(_0x117815,_0x4b74e9,_0xdeba9d){return new BPromise(function(_0x1b3414,_0x234ccd){_0x117815[_0x31a6('0x3')](_0x4b74e9,function(_0x5cde39,_0x41207c){if(_0x5cde39){_0x234ccd(_0x5cde39);}else if(_0x41207c){if(_0x41207c[_0x31a6('0x4')]instanceof Buffer){fs[_0x31a6('0x5')](_0xdeba9d,_0x41207c[_0x31a6('0x4')],function(_0x3b9e01){if(_0x3b9e01){_0x234ccd(_0x3b9e01);}else{_0x1b3414();}});}else{_0x234ccd(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x234ccd(new Error(_0x31a6('0x6')));}});});}module[_0x31a6('0x7')]=function(_0xa6a852,_0x4fb076,_0x55fa37,_0x37c175,_0x17667a,_0x144290,_0x5abea9){var _0x2e8afc=new AWS[(_0x31a6('0x8'))]({'accessKeyId':_0xa6a852,'secretAccessKey':_0x4fb076,'region':_0x55fa37});var _0x574c5f={'Text':_0x17667a,'TextType':_0x144290||_0x31a6('0x9'),'OutputFormat':_0x31a6('0xa'),'VoiceId':_0x37c175};return pollyResult(_0x2e8afc,_0x574c5f,_0x5abea9);}; \ 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 3a8fbc3..72dbf7a 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 _0x080f=['./lib/api'];(function(_0x489fe3,_0x5ebb81){var _0x592190=function(_0x1612a7){while(--_0x1612a7){_0x489fe3['push'](_0x489fe3['shift']());}};_0x592190(++_0x5ebb81);}(_0x080f,0x17f));var _0xf080=function(_0x1eaa79,_0x204f8f){_0x1eaa79=_0x1eaa79-0x0;var _0x448bed=_0x080f[_0x1eaa79];return _0x448bed;};'use strict';var asr=require(_0xf080('0x0'));module['exports']=function(_0x301948,_0x582b28,_0x4e8a77,_0x40829f){return asr(_0x301948,_0x582b28,_0x4e8a77);}; \ No newline at end of file +var _0xcc69=['exports','./lib/api'];(function(_0x314329,_0x1f7d08){var _0x370e08=function(_0x1184f7){while(--_0x1184f7){_0x314329['push'](_0x314329['shift']());}};_0x370e08(++_0x1f7d08);}(_0xcc69,0xc5));var _0x9cc6=function(_0x167295,_0x555a81){_0x167295=_0x167295-0x0;var _0x400be6=_0xcc69[_0x167295];return _0x400be6;};'use strict';var asr=require(_0x9cc6('0x0'));module[_0x9cc6('0x1')]=function(_0x1de0c8,_0xe03ff2,_0x2a4b5d,_0x242d31){return asr(_0x1de0c8,_0xe03ff2,_0x2a4b5d);}; \ 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 e86ee9e..e8307d8 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 _0xde6c=['undefined','length','lang\x20should\x20be\x20a\x20string','readFileSync','toString','POST','LINEAR16','8000','url','bluebird','exports','string','filepath\x20should\x20be\x20a\x20string'];(function(_0x4be00f,_0x439698){var _0x4fee70=function(_0x576e19){while(--_0x576e19){_0x4be00f['push'](_0x4be00f['shift']());}};_0x4fee70(++_0x439698);}(_0xde6c,0x119));var _0xcde6=function(_0x45b625,_0x165113){_0x45b625=_0x45b625-0x0;var _0x2a1e5c=_0xde6c[_0x45b625];return _0x2a1e5c;};'use strict';var url=require(_0xcde6('0x0'));var BPromise=require(_0xcde6('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xcde6('0x2')]=function(_0x330d58,_0x22fa0d,_0x31ac8c){return new BPromise(function(_0x494a32,_0x145150){var _0x262a54;if(typeof _0x330d58!==_0xcde6('0x3')||_0x330d58['length']===0x0){return _0x145150(_0xcde6('0x4'));}if(typeof _0x22fa0d!==_0xcde6('0x3')||_0x22fa0d['length']===0x0){return _0x145150('key\x20should\x20be\x20a\x20string');}if(typeof _0x31ac8c!==_0xcde6('0x5')&&(typeof _0x31ac8c!=='string'||_0x31ac8c[_0xcde6('0x6')]===0x0)){return _0x145150(_0xcde6('0x7'));}try{_0x262a54=fs[_0xcde6('0x8')](_0x330d58)[_0xcde6('0x9')]('base64');}catch(_0x34eadd){return _0x145150(_0x34eadd);}return _0x494a32({'method':_0xcde6('0xa'),'uri':host+'/v1/speech:recognize?key='+_0x22fa0d,'body':{'config':{'encoding':_0xcde6('0xb'),'sampleRateHertz':_0xcde6('0xc'),'languageCode':_0x31ac8c},'audio':{'content':_0x262a54}},'json':!![]});});}; \ No newline at end of file +var _0xe14d=['bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','8000','url'];(function(_0x59ca6f,_0x355233){var _0x834f04=function(_0x31d0f0){while(--_0x31d0f0){_0x59ca6f['push'](_0x59ca6f['shift']());}};_0x834f04(++_0x355233);}(_0xe14d,0x1ee));var _0xde14=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xe14d[_0x2b7764];return _0x848dcb;};'use strict';var url=require(_0xde14('0x0'));var BPromise=require(_0xde14('0x1'));var fs=require('fs');var host=_0xde14('0x2');module[_0xde14('0x3')]=function(_0x48b392,_0x1c5b4,_0x28965b){return new BPromise(function(_0x4b20e2,_0x1c3e94){var _0x13c24e;if(typeof _0x48b392!==_0xde14('0x4')||_0x48b392[_0xde14('0x5')]===0x0){return _0x1c3e94(_0xde14('0x6'));}if(typeof _0x1c5b4!==_0xde14('0x4')||_0x1c5b4['length']===0x0){return _0x1c3e94('key\x20should\x20be\x20a\x20string');}if(typeof _0x28965b!==_0xde14('0x7')&&(typeof _0x28965b!==_0xde14('0x4')||_0x28965b[_0xde14('0x5')]===0x0)){return _0x1c3e94(_0xde14('0x8'));}try{_0x13c24e=fs[_0xde14('0x9')](_0x48b392)[_0xde14('0xa')](_0xde14('0xb'));}catch(_0x1ce0a2){return _0x1c3e94(_0x1ce0a2);}return _0x4b20e2({'method':'POST','uri':host+_0xde14('0xc')+_0x1c5b4,'body':{'config':{'encoding':_0xde14('0xd'),'sampleRateHertz':_0xde14('0xe'),'languageCode':_0x28965b},'audio':{'content':_0x13c24e}},'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 58ec9d1..93a022d 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 _0xe5a8=['exports'];(function(_0x420665,_0x58c4c7){var _0x1944c2=function(_0x27fbfc){while(--_0x27fbfc){_0x420665['push'](_0x420665['shift']());}};_0x1944c2(++_0x58c4c7);}(_0xe5a8,0x184));var _0x8e5a=function(_0xd2fef4,_0x5741e0){_0xd2fef4=_0xd2fef4-0x0;var _0x13eb62=_0xe5a8[_0xd2fef4];return _0x13eb62;};var asr=require('./asr');module[_0x8e5a('0x0')]={'asr':asr}; \ No newline at end of file +var _0xb9df=['./asr','exports'];(function(_0x8c096f,_0x3aa782){var _0x499fde=function(_0x127524){while(--_0x127524){_0x8c096f['push'](_0x8c096f['shift']());}};_0x499fde(++_0x3aa782);}(_0xb9df,0x78));var _0xfb9d=function(_0x1f49da,_0x58f6bc){_0x1f49da=_0x1f49da-0x0;var _0x22521f=_0xb9df[_0x1f49da];return _0x22521f;};var asr=require(_0xfb9d('0x0'));module[_0xfb9d('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 3acc63f..522e96c 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 _0xdc6c=['path','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','pipe','end','https:','host','request\x20to\x20','data','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','base64','then','readFileSync','toString','googleCloudTTS','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','chmodSync','777','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','jQ1olc','stringify','null','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','writeFileSync','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','name','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','isFallbackIntent','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','intent','displayName','isFallback','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol'];(function(_0xac56ce,_0xb73e4){var _0x5105e1=function(_0x52768d){while(--_0x52768d){_0xac56ce['push'](_0xac56ce['shift']());}};_0x5105e1(++_0xb73e4);}(_0xdc6c,0xf3));var _0xcdc6=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0xdc6c[_0x35007a];return _0x574f68;};'use strict';var apiai=require(_0xcdc6('0x0'));var BPromise=require(_0xcdc6('0x1'));var dialogflow=require(_0xcdc6('0x2'));var fs=require('fs');var http=require(_0xcdc6('0x3'));var https=require('https');var md5=require('md5');var path=require('path');var querystring=require('querystring');var rp=require('request-promise');var rs=require(_0xcdc6('0x4'));var sox=require(_0xcdc6('0x5'));var tts=require(_0xcdc6('0x6'));var urlParse=require(_0xcdc6('0x7'))[_0xcdc6('0x8')];var util=require(_0xcdc6('0x9'));var aws=require(_0xcdc6('0xa'));var google=require(_0xcdc6('0xb'));var sestek=require('./sestek');var tilde=require(_0xcdc6('0xc'));var logger=require(_0xcdc6('0xd'))(_0xcdc6('0xe'));var ISPEECH_API=_0xcdc6('0xf');function downloadFile(_0x2a5688,_0x7afe6f){return new BPromise(function(_0x20effa,_0x5e4cdc){var _0x60e3eb=urlParse(_0x2a5688);var _0x3f8edc=_0x60e3eb[_0xcdc6('0x10')]==='https:'?https:http;var _0x4c031f={'host':_0x60e3eb['host'],'path':_0x60e3eb[_0xcdc6('0x11')],'headers':{'user-agent':'WHAT_EVER'}};_0x3f8edc[_0xcdc6('0x12')](_0x4c031f,function(_0xce95c6){if(_0xce95c6[_0xcdc6('0x13')]!==0xc8){logger[_0xcdc6('0x14')]('request\x20to\x20'+_0x2a5688+_0xcdc6('0x15')+_0xce95c6[_0xcdc6('0x13')]+'\x20('+_0xce95c6[_0xcdc6('0x16')]+')');_0x5e4cdc(new Error('request\x20to\x20'+_0x2a5688+_0xcdc6('0x15')+_0xce95c6[_0xcdc6('0x13')]+'\x20('+_0xce95c6[_0xcdc6('0x16')]+')'));return;}var _0x22ef4e=fs[_0xcdc6('0x17')](_0x7afe6f);_0x22ef4e['on'](_0xcdc6('0x18'),function(){logger[_0xcdc6('0x19')](_0xcdc6('0x1a'));_0x22ef4e[_0xcdc6('0x1b')](_0x20effa);});_0x22ef4e['on']('error',function(_0x12f92d){fs[_0xcdc6('0x1c')](_0x7afe6f);logger[_0xcdc6('0x14')]('download\x20error',_0x12f92d);_0x5e4cdc(_0x12f92d);});_0xce95c6[_0xcdc6('0x1d')](_0x22ef4e);})['on']('error',function(_0x314af4){logger[_0xcdc6('0x14')](_0x314af4);_0x5e4cdc(_0x314af4);})[_0xcdc6('0x1e')]();});}function uploadFile(_0x36a289){return new BPromise(function(_0x3a8f46,_0x5919b7){var _0x3cae64=urlParse(_0x36a289);var _0x51d7db=_0x3cae64[_0xcdc6('0x10')]===_0xcdc6('0x1f')?https:http;var _0x30c8ff={'host':_0x3cae64[_0xcdc6('0x20')],'path':_0x3cae64[_0xcdc6('0x11')],'headers':{'user-agent':'WHAT_EVER'}};_0x51d7db[_0xcdc6('0x12')](_0x30c8ff,function(_0x2cea03){if(_0x2cea03[_0xcdc6('0x13')]!==0xc8){_0x5919b7(new Error(_0xcdc6('0x21')+_0x36a289+_0xcdc6('0x15')+_0x2cea03['statusCode']+'\x20('+_0x2cea03[_0xcdc6('0x16')]+')'));return;}var _0x3084ad='';_0x2cea03['on'](_0xcdc6('0x22'),function(_0x3bcca3){_0x3084ad+=_0x3bcca3;});_0x2cea03['on'](_0xcdc6('0x1e'),function(){_0x3a8f46(_0x3084ad);});})['on']('error',function(_0x5278f0){_0x5919b7(_0x5278f0);})['end']();});}function convertFile(_0x1e8d97,_0x4a391e){return new BPromise(function(_0x3e8c21,_0x39c7fb){var _0x1bcf0f=sox[_0xcdc6('0x23')](_0x1e8d97,_0x4a391e,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1bcf0f['on']('error',function(_0x3aed93){logger[_0xcdc6('0x14')](_0xcdc6('0x24'),_0x3aed93);_0x39c7fb(_0x3aed93);});_0x1bcf0f['on'](_0xcdc6('0x1e'),function(){logger[_0xcdc6('0x19')](_0xcdc6('0x25'));_0x3e8c21();});_0x1bcf0f[_0xcdc6('0x26')]();});}function base64Decode(_0x18fa9e,_0x59a286){var _0x58ee0a=path[_0xcdc6('0x27')](__dirname,_0xcdc6('0x28'),rs[_0xcdc6('0x29')](0x4)+_0xcdc6('0x2a'));fs['writeFileSync'](_0x58ee0a,_0x18fa9e,_0xcdc6('0x2b'));return convertFile(_0x58ee0a,_0x59a286)[_0xcdc6('0x2c')](function(){try{fs['unlink'](_0x58ee0a);fs['chmodSync'](_0x59a286,'777');}catch(_0x275e3e){logger[_0xcdc6('0x14')](_0x275e3e);}return _0x59a286['split']('.')[0x0];});}function base64Encode(_0x208a62){var _0x23820a=fs[_0xcdc6('0x2d')](_0x208a62);return new Buffer(_0x23820a)[_0xcdc6('0x2e')]('base64');}exports[_0xcdc6('0x2f')]=function(_0x3d1301,_0x505f01,_0x521aa4,_0x2e6e23,_0x347a50,_0x53c304){var _0x5e25d4,_0xe6fa7f;var _0x589ad1='https://texttospeech.googleapis.com/v1/';var _0x4aabc7=_0xcdc6('0x30')+_0x3d1301;var _0x453de9={};if(_0x505f01===_0xcdc6('0x31')){_0x453de9[_0xcdc6('0x32')]={'ssml':_0x521aa4};}else{_0x453de9[_0xcdc6('0x32')]={'text':_0x521aa4};};_0x453de9[_0xcdc6('0x33')]={'languageCode':_0x2e6e23,'ssmlGender':_0x347a50};_0x453de9[_0xcdc6('0x34')]={'audioEncoding':_0xcdc6('0x35'),'sampleRateHertz':0x1f40};var _0x1d9a3f={'url':_0x589ad1+_0xcdc6('0x36')+_0x4aabc7,'method':_0xcdc6('0x37'),'json':!![],'body':_0x453de9};return rp(_0x1d9a3f)[_0xcdc6('0x2c')](function(_0x288f63){return new BPromise(function(_0x5759b4,_0x4d33aa){_0x5e25d4=path['resolve'](__dirname,_0xcdc6('0x28'),rs['generate'](0x4)+_0xcdc6('0x38'));var _0x412c55=Buffer[_0xcdc6('0x39')](_0x288f63[_0xcdc6('0x3a')],'base64');return fs['writeFile'](_0x5e25d4,_0x412c55,function(_0x8e698c){_0x4d33aa(_0x8e698c);},function(_0x124b5f){fs[_0xcdc6('0x3b')](_0x5e25d4,_0xcdc6('0x3c'));_0x5759b4(_0x124b5f);});});})['then'](function(_0xcaa765){_0xe6fa7f=path[_0xcdc6('0x27')](__dirname,_0xcdc6('0x28'),rs[_0xcdc6('0x29')](0x4)+'.wav');return convertFile(_0x5e25d4,_0xe6fa7f);})['then'](function(){try{fs[_0xcdc6('0x1c')](_0x5e25d4);fs[_0xcdc6('0x3b')](_0xe6fa7f,_0xcdc6('0x3c'));}catch(_0x2f8808){logger['error'](_0x2f8808);}logger['info']('googleCloudTTS\x20path',_0xe6fa7f[_0xcdc6('0x3d')]('.')[0x0]);return _0xe6fa7f['split']('.')[0x0];});};exports[_0xcdc6('0x3e')]=function(_0xb037fe,_0x4bfb59){var _0x4ad9a2=_0xcdc6('0x3f');var _0x257680,_0xfcb0d3;var _0x5d25ba;var _0x51398b={'encoding':_0xcdc6('0x40'),'method':_0xcdc6('0x37'),'timeout':0x2710,'url':_0x4ad9a2,'headers':{'Content-Type':_0xcdc6('0x41')},'body':'f.req='+encodeURIComponent(JSON['stringify']([[[_0xcdc6('0x42'),JSON[_0xcdc6('0x43')]([_0xb037fe,_0x4bfb59||'en',![],_0xcdc6('0x44')]),null,'generic']]]))};return rp(_0x51398b)['then'](function(_0x3313ce){try{_0x5d25ba=eval(_0x3313ce['slice'](0x5))[0x0][0x2];}catch(_0x44cd66){throw new Error('parse\x20response\x20failed:\x0a'+_0x3313ce[_0xcdc6('0x22')]);}if(!_0x5d25ba){if(_0xb037fe[_0xcdc6('0x45')]>0xc8){throw new Error(_0xcdc6('0x46'));}else{throw new Error(_0xcdc6('0x47')+_0x4bfb59+_0xcdc6('0x48'));}}try{_0x5d25ba=eval(_0x5d25ba)[0x0];}catch(_0xbbfba5){throw new Error(_0xcdc6('0x49')+res[_0xcdc6('0x22')]);}const _0x5473e3=_0x5d25ba;_0x257680=path['resolve'](__dirname,_0xcdc6('0x28'),rs[_0xcdc6('0x29')](0x4)+_0xcdc6('0x38'));fs[_0xcdc6('0x4a')](_0x257680,_0x5d25ba,{'encoding':_0xcdc6('0x2b')});_0xfcb0d3=path[_0xcdc6('0x27')](__dirname,'tmp',rs[_0xcdc6('0x29')](0x4)+'.wav');return convertFile(_0x257680,_0xfcb0d3);})['then'](function(){try{fs['unlink'](_0x257680);fs[_0xcdc6('0x3b')](_0xfcb0d3,'777');}catch(_0xe13158){logger[_0xcdc6('0x14')](_0xe13158);}logger[_0xcdc6('0x19')](_0xcdc6('0x4b'),_0xfcb0d3[_0xcdc6('0x3d')]('.')[0x0]);return _0xfcb0d3[_0xcdc6('0x3d')]('.')[0x0];});};exports['googleASR']=function(_0x9dfa36,_0x152f8a,_0x559097){return google[_0xcdc6('0x4c')](_0x9dfa36,_0x152f8a,_0x559097)[_0xcdc6('0x2c')](function(_0x5570bd){logger[_0xcdc6('0x19')](_0x5570bd[_0xcdc6('0x4d')]);return rp(_0x5570bd);})[_0xcdc6('0x2c')](function(_0x1bc6f2){var _0x5e1f9b='';var _0x34e50b=0x0;try{fs['unlink'](_0x9dfa36);}catch(_0x28db2e){logger[_0xcdc6('0x14')](_0x28db2e);}if(_0x1bc6f2&&_0x1bc6f2[_0xcdc6('0x4e')]){_0x5e1f9b=_0x1bc6f2[_0xcdc6('0x4e')][_0xcdc6('0x4f')](function(_0x49bd4c){return _0x49bd4c&&_0x49bd4c[_0xcdc6('0x50')][0x0]&&_0x49bd4c[_0xcdc6('0x50')][0x0][_0xcdc6('0x51')]?_0x49bd4c[_0xcdc6('0x50')][0x0][_0xcdc6('0x51')]:'';})[_0xcdc6('0x52')]('\x0a');_0x34e50b=_0x1bc6f2[_0xcdc6('0x4e')][_0xcdc6('0x4f')](function(_0x197638){return _0x197638&&_0x197638[_0xcdc6('0x50')][0x0]&&_0x197638[_0xcdc6('0x50')][0x0]['confidence']?_0x197638[_0xcdc6('0x50')][0x0][_0xcdc6('0x53')]:0x0;})[_0xcdc6('0x52')]('\x0a');}logger[_0xcdc6('0x19')](_0xcdc6('0x54'),_0x5e1f9b);logger[_0xcdc6('0x19')](_0xcdc6('0x55'),_0x34e50b);return{'transcript':_0x5e1f9b,'confidence':_0x34e50b};})['catch'](function(_0x4d7348){logger[_0xcdc6('0x14')]('[%s]\x20%s:%s',_0x4d7348[_0xcdc6('0x13')],_0x4d7348[_0xcdc6('0x56')],_0x4d7348['message']);});};exports['googleDialogflow']=function(_0x54ce70,_0x4ae66d,_0x3627dd,_0x5d5154){var _0x4901df=apiai(_0x4ae66d,{'language':_0x5d5154||'en'});return _0x4901df['textRequest'](_0x3627dd,{'sessionId':md5(_0x54ce70)})[_0xcdc6('0x2c')](function(_0x1ed5bf){logger['info'](JSON[_0xcdc6('0x43')](_0x1ed5bf));return{'source':_0x1ed5bf[_0xcdc6('0x57')][_0xcdc6('0x58')],'resolvedQuery':_0x1ed5bf[_0xcdc6('0x57')][_0xcdc6('0x59')],'action':_0x1ed5bf[_0xcdc6('0x57')][_0xcdc6('0x5a')],'actionIncomplete':_0x1ed5bf[_0xcdc6('0x57')][_0xcdc6('0x5b')],'speech':_0x1ed5bf['result'][_0xcdc6('0x5c')][_0xcdc6('0x5d')],'score':_0x1ed5bf[_0xcdc6('0x57')][_0xcdc6('0x5e')],'statusCode':_0x1ed5bf[_0xcdc6('0x5f')][_0xcdc6('0x60')],'endConversation':_0x1ed5bf[_0xcdc6('0x57')][_0xcdc6('0x61')]['endConversation']||![],'isFallbackIntent':_0x1ed5bf[_0xcdc6('0x57')]['metadata'][_0xcdc6('0x62')]};});};exports['googleDialogflowV2']=function(_0x77426f,_0x2f601c,_0x50da57,_0x21a59e,_0x4a2807,_0x26fa34){var _0x2d60a4=_0x21a59e[_0xcdc6('0x63')](/\\n/g,'\x0a');var _0x162c4b={'credentials':{'private_key':_0x2d60a4,'client_email':_0x50da57}};var _0x16420b=new dialogflow[(_0xcdc6('0x64'))](_0x162c4b);var _0x4b4933=_0x16420b[_0xcdc6('0x65')](_0x2f601c,md5(_0x77426f));var _0x4c5875={'session':_0x4b4933,'queryInput':{'text':{'text':_0x4a2807,'languageCode':_0x26fa34}}};return _0x16420b['detectIntent'](_0x4c5875)[_0xcdc6('0x2c')](function(_0x1c36d6){if(_0x1c36d6&&_0x1c36d6[_0xcdc6('0x45')]){logger[_0xcdc6('0x19')](_0xcdc6('0x66'),JSON[_0xcdc6('0x43')](_0x1c36d6));var _0x41b3be=_0x1c36d6[0x0];if(_0x41b3be){var _0x109f68={'action':_0x41b3be['queryResult'][_0xcdc6('0x5a')],'allRequiredParamsPresent':_0x41b3be[_0xcdc6('0x67')]['allRequiredParamsPresent'],'endConversation':_0x41b3be[_0xcdc6('0x67')][_0xcdc6('0x68')]&&_0x41b3be['queryResult'][_0xcdc6('0x68')][_0xcdc6('0x69')]?_0x41b3be['queryResult'][_0xcdc6('0x68')]['fields']['end_conversation']['boolValue']:![],'fulfillmentText':_0x41b3be['queryResult']['fulfillmentText'],'intentName':_0x41b3be[_0xcdc6('0x67')][_0xcdc6('0x6a')][_0xcdc6('0x56')],'intentDisplayName':_0x41b3be[_0xcdc6('0x67')][_0xcdc6('0x6a')][_0xcdc6('0x6b')],'isFallbackIntent':_0x41b3be[_0xcdc6('0x67')]['intent'][_0xcdc6('0x6c')],'languageCode':_0x41b3be[_0xcdc6('0x67')]['languageCode'],'queryText':_0x41b3be[_0xcdc6('0x67')]['queryText'],'responseId':_0x41b3be[_0xcdc6('0x6d')],'score':_0x41b3be['queryResult'][_0xcdc6('0x6e')],'speech':_0x41b3be[_0xcdc6('0x67')]['fulfillmentText'],'providerResponse':JSON[_0xcdc6('0x43')](_0x1c36d6)};return _0x109f68;}}});};exports[_0xcdc6('0x6f')]=function(_0x48d628,_0x24f514,_0x2d35a1,_0x2fca16){return tilde['asr'](_0x48d628,_0x24f514,_0x2d35a1,_0x2fca16)[_0xcdc6('0x2c')](function(_0x59d54f){try{fs[_0xcdc6('0x1c')](_0x48d628);}catch(_0x53a0b9){logger['error'](_0x53a0b9);}logger[_0xcdc6('0x19')](_0xcdc6('0x70'),_0x59d54f[_0xcdc6('0x51')]);logger[_0xcdc6('0x19')](_0xcdc6('0x71'),_0x59d54f[_0xcdc6('0x53')]);return _0x59d54f;});};exports[_0xcdc6('0x72')]=function(_0x37fc32,_0x21c3d1,_0x342e9c,_0x314ecc,_0x257bd8,_0x207813){var _0x321e08=path['resolve'](__dirname,_0xcdc6('0x28'),rs[_0xcdc6('0x29')](0x4)+'.mp3');var _0x4f5c58;return aws[_0xcdc6('0x73')](_0x37fc32,_0x21c3d1,_0x342e9c,_0x314ecc,_0x257bd8,_0x207813,_0x321e08)[_0xcdc6('0x2c')](function(){_0x4f5c58=path[_0xcdc6('0x27')](__dirname,_0xcdc6('0x28'),rs[_0xcdc6('0x29')](0x4)+'.wav');return convertFile(_0x321e08,_0x4f5c58);})['then'](function(){try{fs[_0xcdc6('0x1c')](_0x321e08);fs[_0xcdc6('0x3b')](_0x4f5c58,_0xcdc6('0x3c'));}catch(_0x2b56e2){logger[_0xcdc6('0x14')](_0x2b56e2);}return _0x4f5c58['split']('.')[0x0];});};exports['awsLex']=function(_0x41c493,_0x5ebbc4,_0x103aed,_0x2912bc,_0x1fa819,_0x5f3cae){return aws['lex'](_0x41c493,_0x5ebbc4,_0x103aed,_0x2912bc,_0x1fa819,_0x5f3cae)[_0xcdc6('0x2c')](function(_0x556d48){logger[_0xcdc6('0x19')](JSON['stringify'](_0x556d48));return _0x556d48;});};exports[_0xcdc6('0x74')]=function(_0x5634dd,_0x4581ef,_0x39bf1a,_0x136e31){var _0x519a4a=util[_0xcdc6('0x75')](_0xcdc6('0x76'),ISPEECH_API,_0x5634dd,encodeURIComponent(_0x4581ef),_0x39bf1a,_0x136e31);var _0x53a5d6=path[_0xcdc6('0x27')](__dirname,_0xcdc6('0x28'),rs[_0xcdc6('0x29')](0x4)+_0xcdc6('0x38'));var _0x2537bc;return downloadFile(_0x519a4a,_0x53a5d6)['then'](function(){_0x2537bc=path[_0xcdc6('0x27')](__dirname,_0xcdc6('0x28'),rs[_0xcdc6('0x29')](0x4)+_0xcdc6('0x2a'));return convertFile(_0x53a5d6,_0x2537bc);})['then'](function(){try{fs[_0xcdc6('0x1c')](_0x53a5d6);fs[_0xcdc6('0x3b')](_0x2537bc,_0xcdc6('0x3c'));}catch(_0x2a466a){logger['error'](_0x2a466a);}return _0x2537bc[_0xcdc6('0x3d')]('.')[0x0];});};exports['ispeechASR']=function(_0x4410ff,_0x41037b,_0xc8144a,_0x3a679b){var _0x37906f=util['format'](_0xcdc6('0x77'),ISPEECH_API,_0x41037b,_0xc8144a,base64Encode(_0x4410ff),_0x3a679b?util['format'](_0xcdc6('0x78'),encodeURIComponent(_0x3a679b)):_0xcdc6('0x79'));return uploadFile(_0x37906f)[_0xcdc6('0x2c')](function(_0x48351b){return querystring['parse'](_0x48351b);});};exports[_0xcdc6('0x7a')]=function(_0x4bc9c1,_0x1d66f8){return sestek[_0xcdc6('0x7b')](_0x4bc9c1,_0x1d66f8)[_0xcdc6('0x2c')](function(_0x268165){logger[_0xcdc6('0x19')](JSON['stringify'](_0x268165));var _0x293f7b={'speech':_0x268165['text'],'action':_0x268165['channelData']?_0x268165[_0xcdc6('0x7c')][_0xcdc6('0x7d')]:undefined,'actiondata':_0x268165[_0xcdc6('0x7c')]?_0x268165[_0xcdc6('0x7c')]['CustomActionData']:undefined};if(_0x268165[_0xcdc6('0x7c')]&&_0x268165[_0xcdc6('0x7c')]['AudioFromTts']){return base64Decode(_0x268165[_0xcdc6('0x7c')][_0xcdc6('0x7e')][_0xcdc6('0x7f')],path[_0xcdc6('0x27')](__dirname,_0xcdc6('0x28'),rs['generate'](0x4)+_0xcdc6('0x2a')))[_0xcdc6('0x2c')](function(_0x306d1f){_0x293f7b[_0xcdc6('0x80')]=_0x306d1f;return _0x293f7b;});}return _0x293f7b;});};exports[_0xcdc6('0x81')]=function(){return __dirname;}; \ No newline at end of file +var _0x42ad=['chmodSync','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','audioConfig','text:synthesize','POST','resolve','generate','.mp3','from','audioContent','tmp','then','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','jQ1olc','stringify','generic','slice','parse\x20response\x20failed:\x0a','length','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','textRequest','result','action','fulfillment','speech','score','status','code','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','sestekNDA','text','channelData','CustomAction','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./tilde','../../../config/logger','agi','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','finish\x20download\x20file','unlink','download\x20error','pipe','end','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','.wav','writeFileSync','base64'];(function(_0x68abb4,_0x2f5e53){var _0x214369=function(_0x159a2f){while(--_0x159a2f){_0x68abb4['push'](_0x68abb4['shift']());}};_0x214369(++_0x2f5e53);}(_0x42ad,0x171));var _0xd42a=function(_0x5af717,_0x384580){_0x5af717=_0x5af717-0x0;var _0x4640db=_0x42ad[_0x5af717];return _0x4640db;};'use strict';var apiai=require(_0xd42a('0x0'));var BPromise=require(_0xd42a('0x1'));var dialogflow=require(_0xd42a('0x2'));var fs=require('fs');var http=require(_0xd42a('0x3'));var https=require(_0xd42a('0x4'));var md5=require(_0xd42a('0x5'));var path=require(_0xd42a('0x6'));var querystring=require('querystring');var rp=require(_0xd42a('0x7'));var rs=require(_0xd42a('0x8'));var sox=require(_0xd42a('0x9'));var tts=require(_0xd42a('0xa'));var urlParse=require(_0xd42a('0xb'))[_0xd42a('0xc')];var util=require(_0xd42a('0xd'));var aws=require(_0xd42a('0xe'));var google=require('./google');var sestek=require('./sestek');var tilde=require(_0xd42a('0xf'));var logger=require(_0xd42a('0x10'))(_0xd42a('0x11'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x6ba5e9,_0x4b6d09){return new BPromise(function(_0x2aa1e2,_0x2214bf){var _0x1a33db=urlParse(_0x6ba5e9);var _0x502d2f=_0x1a33db[_0xd42a('0x12')]===_0xd42a('0x13')?https:http;var _0x23b226={'host':_0x1a33db[_0xd42a('0x14')],'path':_0x1a33db[_0xd42a('0x6')],'headers':{'user-agent':_0xd42a('0x15')}};_0x502d2f[_0xd42a('0x16')](_0x23b226,function(_0x3c5cf2){if(_0x3c5cf2[_0xd42a('0x17')]!==0xc8){logger[_0xd42a('0x18')](_0xd42a('0x19')+_0x6ba5e9+'\x20failed,\x20status\x20code\x20=\x20'+_0x3c5cf2[_0xd42a('0x17')]+'\x20('+_0x3c5cf2[_0xd42a('0x1a')]+')');_0x2214bf(new Error(_0xd42a('0x19')+_0x6ba5e9+_0xd42a('0x1b')+_0x3c5cf2[_0xd42a('0x17')]+'\x20('+_0x3c5cf2[_0xd42a('0x1a')]+')'));return;}var _0x1b65f8=fs[_0xd42a('0x1c')](_0x4b6d09);_0x1b65f8['on'](_0xd42a('0x1d'),function(){logger[_0xd42a('0x1e')](_0xd42a('0x1f'));_0x1b65f8['close'](_0x2aa1e2);});_0x1b65f8['on']('error',function(_0x1ccca7){fs[_0xd42a('0x20')](_0x4b6d09);logger[_0xd42a('0x18')](_0xd42a('0x21'),_0x1ccca7);_0x2214bf(_0x1ccca7);});_0x3c5cf2[_0xd42a('0x22')](_0x1b65f8);})['on']('error',function(_0x1203ee){logger[_0xd42a('0x18')](_0x1203ee);_0x2214bf(_0x1203ee);})[_0xd42a('0x23')]();});}function uploadFile(_0xb6c6eb){return new BPromise(function(_0x2756c6,_0x2e4a7a){var _0x125e1a=urlParse(_0xb6c6eb);var _0x1acedf=_0x125e1a[_0xd42a('0x12')]===_0xd42a('0x13')?https:http;var _0x254850={'host':_0x125e1a[_0xd42a('0x14')],'path':_0x125e1a[_0xd42a('0x6')],'headers':{'user-agent':_0xd42a('0x15')}};_0x1acedf[_0xd42a('0x16')](_0x254850,function(_0x463e73){if(_0x463e73[_0xd42a('0x17')]!==0xc8){_0x2e4a7a(new Error(_0xd42a('0x19')+_0xb6c6eb+'\x20failed,\x20status\x20code\x20=\x20'+_0x463e73[_0xd42a('0x17')]+'\x20('+_0x463e73['statusMessage']+')'));return;}var _0x12160a='';_0x463e73['on'](_0xd42a('0x24'),function(_0x1e4f11){_0x12160a+=_0x1e4f11;});_0x463e73['on'](_0xd42a('0x23'),function(){_0x2756c6(_0x12160a);});})['on'](_0xd42a('0x18'),function(_0x14fb95){_0x2e4a7a(_0x14fb95);})[_0xd42a('0x23')]();});}function convertFile(_0x2d0034,_0x24659c){return new BPromise(function(_0xcdc9bb,_0x15d88a){var _0x3b5028=sox[_0xd42a('0x25')](_0x2d0034,_0x24659c,{'sampleRate':0x1f40,'format':_0xd42a('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3b5028['on'](_0xd42a('0x18'),function(_0x3a099f){logger[_0xd42a('0x18')](_0xd42a('0x27'),_0x3a099f);_0x15d88a(_0x3a099f);});_0x3b5028['on'](_0xd42a('0x23'),function(){logger[_0xd42a('0x1e')](_0xd42a('0x28'));_0xcdc9bb();});_0x3b5028[_0xd42a('0x29')]();});}function base64Decode(_0x1bbaa9,_0x1749b4){var _0x167a0a=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0xd42a('0x2a'));fs[_0xd42a('0x2b')](_0x167a0a,_0x1bbaa9,_0xd42a('0x2c'));return convertFile(_0x167a0a,_0x1749b4)['then'](function(){try{fs[_0xd42a('0x20')](_0x167a0a);fs[_0xd42a('0x2d')](_0x1749b4,_0xd42a('0x2e'));}catch(_0x206d8d){logger[_0xd42a('0x18')](_0x206d8d);}return _0x1749b4[_0xd42a('0x2f')]('.')[0x0];});}function base64Encode(_0x1030d5){var _0x4b2595=fs[_0xd42a('0x30')](_0x1030d5);return new Buffer(_0x4b2595)[_0xd42a('0x31')](_0xd42a('0x2c'));}exports['googleCloudTTS']=function(_0x1ad877,_0x3fdf47,_0x2b9aa9,_0x22abb3,_0x259164,_0x268175){var _0x41caab,_0x330ae8;var _0x19815c=_0xd42a('0x32');var _0x159842=_0xd42a('0x33')+_0x1ad877;var _0x207ff4={};if(_0x3fdf47===_0xd42a('0x34')){_0x207ff4[_0xd42a('0x35')]={'ssml':_0x2b9aa9};}else{_0x207ff4[_0xd42a('0x35')]={'text':_0x2b9aa9};};_0x207ff4['voice']={'languageCode':_0x22abb3,'ssmlGender':_0x259164};_0x207ff4[_0xd42a('0x36')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x47eb93={'url':_0x19815c+_0xd42a('0x37')+_0x159842,'method':_0xd42a('0x38'),'json':!![],'body':_0x207ff4};return rp(_0x47eb93)['then'](function(_0x8fc1b2){return new BPromise(function(_0x4c1b5f,_0xeebee){_0x41caab=path[_0xd42a('0x39')](__dirname,'tmp',rs[_0xd42a('0x3a')](0x4)+_0xd42a('0x3b'));var _0xcbade5=Buffer[_0xd42a('0x3c')](_0x8fc1b2[_0xd42a('0x3d')],_0xd42a('0x2c'));return fs['writeFile'](_0x41caab,_0xcbade5,function(_0x45b00b){_0xeebee(_0x45b00b);},function(_0x4887ae){fs[_0xd42a('0x2d')](_0x41caab,_0xd42a('0x2e'));_0x4c1b5f(_0x4887ae);});});})['then'](function(_0x233590){_0x330ae8=path[_0xd42a('0x39')](__dirname,_0xd42a('0x3e'),rs['generate'](0x4)+_0xd42a('0x2a'));return convertFile(_0x41caab,_0x330ae8);})[_0xd42a('0x3f')](function(){try{fs[_0xd42a('0x20')](_0x41caab);fs[_0xd42a('0x2d')](_0x330ae8,'777');}catch(_0x3c3e96){logger[_0xd42a('0x18')](_0x3c3e96);}logger[_0xd42a('0x1e')](_0xd42a('0x40'),_0x330ae8['split']('.')[0x0]);return _0x330ae8[_0xd42a('0x2f')]('.')[0x0];});};exports['googleTTS']=function(_0x589fbe,_0x55db86){var _0x524fac=_0xd42a('0x41');var _0x1907f2,_0x3894d5;var _0x1ae768;var _0x591246={'encoding':_0xd42a('0x42'),'method':'POST','timeout':0x2710,'url':_0x524fac,'headers':{'Content-Type':_0xd42a('0x43')},'body':'f.req='+encodeURIComponent(JSON['stringify']([[[_0xd42a('0x44'),JSON[_0xd42a('0x45')]([_0x589fbe,_0x55db86||'en',![],'null']),null,_0xd42a('0x46')]]]))};return rp(_0x591246)[_0xd42a('0x3f')](function(_0x3e5cac){try{_0x1ae768=eval(_0x3e5cac[_0xd42a('0x47')](0x5))[0x0][0x2];}catch(_0x518d09){throw new Error(_0xd42a('0x48')+_0x3e5cac[_0xd42a('0x24')]);}if(!_0x1ae768){if(_0x589fbe[_0xd42a('0x49')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0xd42a('0x4a')+_0x55db86+_0xd42a('0x4b'));}}try{_0x1ae768=eval(_0x1ae768)[0x0];}catch(_0x1b8001){throw new Error(_0xd42a('0x48')+res[_0xd42a('0x24')]);}const _0x5e905d=_0x1ae768;_0x1907f2=path[_0xd42a('0x39')](__dirname,'tmp',rs[_0xd42a('0x3a')](0x4)+_0xd42a('0x3b'));fs['writeFileSync'](_0x1907f2,_0x1ae768,{'encoding':'base64'});_0x3894d5=path[_0xd42a('0x39')](__dirname,'tmp',rs[_0xd42a('0x3a')](0x4)+'.wav');return convertFile(_0x1907f2,_0x3894d5);})[_0xd42a('0x3f')](function(){try{fs[_0xd42a('0x20')](_0x1907f2);fs[_0xd42a('0x2d')](_0x3894d5,_0xd42a('0x2e'));}catch(_0x47d71b){logger['error'](_0x47d71b);}logger[_0xd42a('0x1e')](_0xd42a('0x4c'),_0x3894d5['split']('.')[0x0]);return _0x3894d5[_0xd42a('0x2f')]('.')[0x0];});};exports[_0xd42a('0x4d')]=function(_0x386f7e,_0x472a77,_0x1a30e5){return google[_0xd42a('0x4e')](_0x386f7e,_0x472a77,_0x1a30e5)[_0xd42a('0x3f')](function(_0x322930){logger[_0xd42a('0x1e')](_0x322930[_0xd42a('0x4f')]);return rp(_0x322930);})[_0xd42a('0x3f')](function(_0x5f1f90){var _0x386a7f='';var _0x47770d=0x0;try{fs[_0xd42a('0x20')](_0x386f7e);}catch(_0x1d9d05){logger[_0xd42a('0x18')](_0x1d9d05);}if(_0x5f1f90&&_0x5f1f90['results']){_0x386a7f=_0x5f1f90[_0xd42a('0x50')][_0xd42a('0x51')](function(_0x2a12b4){return _0x2a12b4&&_0x2a12b4[_0xd42a('0x52')][0x0]&&_0x2a12b4['alternatives'][0x0][_0xd42a('0x53')]?_0x2a12b4['alternatives'][0x0][_0xd42a('0x53')]:'';})[_0xd42a('0x54')]('\x0a');_0x47770d=_0x5f1f90[_0xd42a('0x50')][_0xd42a('0x51')](function(_0x34fc08){return _0x34fc08&&_0x34fc08[_0xd42a('0x52')][0x0]&&_0x34fc08[_0xd42a('0x52')][0x0][_0xd42a('0x55')]?_0x34fc08[_0xd42a('0x52')][0x0][_0xd42a('0x55')]:0x0;})['join']('\x0a');}logger[_0xd42a('0x1e')](_0xd42a('0x56'),_0x386a7f);logger['info'](_0xd42a('0x57'),_0x47770d);return{'transcript':_0x386a7f,'confidence':_0x47770d};})[_0xd42a('0x58')](function(_0x3a7ddc){logger[_0xd42a('0x18')](_0xd42a('0x59'),_0x3a7ddc[_0xd42a('0x17')],_0x3a7ddc[_0xd42a('0x5a')],_0x3a7ddc[_0xd42a('0x5b')]);});};exports['googleDialogflow']=function(_0x344554,_0x5abedc,_0x298d24,_0x254359){var _0x3881c4=apiai(_0x5abedc,{'language':_0x254359||'en'});return _0x3881c4[_0xd42a('0x5c')](_0x298d24,{'sessionId':md5(_0x344554)})[_0xd42a('0x3f')](function(_0x5cc32e){logger['info'](JSON['stringify'](_0x5cc32e));return{'source':_0x5cc32e[_0xd42a('0x5d')]['source'],'resolvedQuery':_0x5cc32e[_0xd42a('0x5d')]['resolvedQuery'],'action':_0x5cc32e[_0xd42a('0x5d')][_0xd42a('0x5e')],'actionIncomplete':_0x5cc32e[_0xd42a('0x5d')]['actionIncomplete'],'speech':_0x5cc32e[_0xd42a('0x5d')][_0xd42a('0x5f')][_0xd42a('0x60')],'score':_0x5cc32e[_0xd42a('0x5d')][_0xd42a('0x61')],'statusCode':_0x5cc32e[_0xd42a('0x62')][_0xd42a('0x63')],'endConversation':_0x5cc32e[_0xd42a('0x5d')][_0xd42a('0x64')]['endConversation']||![],'isFallbackIntent':_0x5cc32e[_0xd42a('0x5d')]['metadata'][_0xd42a('0x65')]};});};exports[_0xd42a('0x66')]=function(_0x48648c,_0x56dc30,_0x29aee7,_0x16280a,_0x1667a5,_0x3b02a0){var _0x2dd4cc=_0x16280a[_0xd42a('0x67')](/\\n/g,'\x0a');var _0x2c43ef={'credentials':{'private_key':_0x2dd4cc,'client_email':_0x29aee7}};var _0x1d6193=new dialogflow[(_0xd42a('0x68'))](_0x2c43ef);var _0x6b0590=_0x1d6193['sessionPath'](_0x56dc30,md5(_0x48648c));var _0xbf77e1={'session':_0x6b0590,'queryInput':{'text':{'text':_0x1667a5,'languageCode':_0x3b02a0}}};return _0x1d6193[_0xd42a('0x69')](_0xbf77e1)[_0xd42a('0x3f')](function(_0x1c20c8){if(_0x1c20c8&&_0x1c20c8[_0xd42a('0x49')]){logger[_0xd42a('0x1e')](_0xd42a('0x6a'),JSON[_0xd42a('0x45')](_0x1c20c8));var _0x395c1d=_0x1c20c8[0x0];if(_0x395c1d){var _0x565bae={'action':_0x395c1d[_0xd42a('0x6b')][_0xd42a('0x5e')],'allRequiredParamsPresent':_0x395c1d[_0xd42a('0x6b')][_0xd42a('0x6c')],'endConversation':_0x395c1d[_0xd42a('0x6b')][_0xd42a('0x6d')]&&_0x395c1d['queryResult'][_0xd42a('0x6d')]['fields']?_0x395c1d[_0xd42a('0x6b')][_0xd42a('0x6d')][_0xd42a('0x6e')][_0xd42a('0x6f')][_0xd42a('0x70')]:![],'fulfillmentText':_0x395c1d[_0xd42a('0x6b')][_0xd42a('0x71')],'intentName':_0x395c1d['queryResult'][_0xd42a('0x72')]['name'],'intentDisplayName':_0x395c1d['queryResult'][_0xd42a('0x72')]['displayName'],'isFallbackIntent':_0x395c1d[_0xd42a('0x6b')][_0xd42a('0x72')][_0xd42a('0x73')],'languageCode':_0x395c1d[_0xd42a('0x6b')][_0xd42a('0x74')],'queryText':_0x395c1d[_0xd42a('0x6b')][_0xd42a('0x75')],'responseId':_0x395c1d[_0xd42a('0x76')],'score':_0x395c1d[_0xd42a('0x6b')][_0xd42a('0x77')],'speech':_0x395c1d['queryResult'][_0xd42a('0x71')],'providerResponse':JSON['stringify'](_0x1c20c8)};return _0x565bae;}}});};exports[_0xd42a('0x78')]=function(_0x2ee82b,_0x3abbe6,_0xbd0d6d,_0x4ab708){return tilde[_0xd42a('0x4e')](_0x2ee82b,_0x3abbe6,_0xbd0d6d,_0x4ab708)[_0xd42a('0x3f')](function(_0x5edce2){try{fs[_0xd42a('0x20')](_0x2ee82b);}catch(_0x243717){logger[_0xd42a('0x18')](_0x243717);}logger[_0xd42a('0x1e')](_0xd42a('0x79'),_0x5edce2[_0xd42a('0x53')]);logger[_0xd42a('0x1e')](_0xd42a('0x7a'),_0x5edce2[_0xd42a('0x55')]);return _0x5edce2;});};exports[_0xd42a('0x7b')]=function(_0xc540ca,_0x236766,_0x44a5df,_0x2fecff,_0x415490,_0x36c303){var _0x52ced5=path[_0xd42a('0x39')](__dirname,'tmp',rs['generate'](0x4)+_0xd42a('0x3b'));var _0x1ba942;return aws['polly'](_0xc540ca,_0x236766,_0x44a5df,_0x2fecff,_0x415490,_0x36c303,_0x52ced5)['then'](function(){_0x1ba942=path[_0xd42a('0x39')](__dirname,_0xd42a('0x3e'),rs[_0xd42a('0x3a')](0x4)+'.wav');return convertFile(_0x52ced5,_0x1ba942);})[_0xd42a('0x3f')](function(){try{fs['unlink'](_0x52ced5);fs[_0xd42a('0x2d')](_0x1ba942,_0xd42a('0x2e'));}catch(_0x519d58){logger[_0xd42a('0x18')](_0x519d58);}return _0x1ba942['split']('.')[0x0];});};exports[_0xd42a('0x7c')]=function(_0x202271,_0x8a78a4,_0x2238f7,_0x1b73cd,_0x3c4956,_0x48d32b){return aws[_0xd42a('0x7d')](_0x202271,_0x8a78a4,_0x2238f7,_0x1b73cd,_0x3c4956,_0x48d32b)['then'](function(_0x547679){logger[_0xd42a('0x1e')](JSON['stringify'](_0x547679));return _0x547679;});};exports[_0xd42a('0x7e')]=function(_0x4b6273,_0xca64a0,_0x36b214,_0x6270df){var _0x2c5b5a=util['format'](_0xd42a('0x7f'),ISPEECH_API,_0x4b6273,encodeURIComponent(_0xca64a0),_0x36b214,_0x6270df);var _0x4106cb=path[_0xd42a('0x39')](__dirname,_0xd42a('0x3e'),rs[_0xd42a('0x3a')](0x4)+'.mp3');var _0x5bf2ec;return downloadFile(_0x2c5b5a,_0x4106cb)[_0xd42a('0x3f')](function(){_0x5bf2ec=path[_0xd42a('0x39')](__dirname,_0xd42a('0x3e'),rs[_0xd42a('0x3a')](0x4)+_0xd42a('0x2a'));return convertFile(_0x4106cb,_0x5bf2ec);})[_0xd42a('0x3f')](function(){try{fs['unlink'](_0x4106cb);fs[_0xd42a('0x2d')](_0x5bf2ec,_0xd42a('0x2e'));}catch(_0x59eb23){logger[_0xd42a('0x18')](_0x59eb23);}return _0x5bf2ec['split']('.')[0x0];});};exports[_0xd42a('0x80')]=function(_0x2a7c75,_0x40022f,_0x415eb5,_0x41f4d0){var _0x3a0189=util[_0xd42a('0x81')](_0xd42a('0x82'),ISPEECH_API,_0x40022f,_0x415eb5,base64Encode(_0x2a7c75),_0x41f4d0?util['format']('model=%s',encodeURIComponent(_0x41f4d0)):'freeform=3');return uploadFile(_0x3a0189)['then'](function(_0x34c31d){return querystring[_0xd42a('0xc')](_0x34c31d);});};exports[_0xd42a('0x83')]=function(_0x41c83c,_0x7df898){return sestek['nda'](_0x41c83c,_0x7df898)['then'](function(_0x157566){logger['info'](JSON[_0xd42a('0x45')](_0x157566));var _0x909e27={'speech':_0x157566[_0xd42a('0x84')],'action':_0x157566[_0xd42a('0x85')]?_0x157566[_0xd42a('0x85')][_0xd42a('0x86')]:undefined,'actiondata':_0x157566[_0xd42a('0x85')]?_0x157566[_0xd42a('0x85')]['CustomActionData']:undefined};if(_0x157566[_0xd42a('0x85')]&&_0x157566['channelData'][_0xd42a('0x87')]){return base64Decode(_0x157566[_0xd42a('0x85')][_0xd42a('0x87')]['Data'],path[_0xd42a('0x39')](__dirname,_0xd42a('0x3e'),rs[_0xd42a('0x3a')](0x4)+'.wav'))[_0xd42a('0x3f')](function(_0x13fc77){_0x909e27[_0xd42a('0x88')]=_0x13fc77;return _0x909e27;});}return _0x909e27;});};exports[_0xd42a('0x89')]=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 a1a67cf..2177e62 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 _0x2d14=['exports','./nda'];(function(_0x87ffc2,_0x38d737){var _0x5179be=function(_0x533e09){while(--_0x533e09){_0x87ffc2['push'](_0x87ffc2['shift']());}};_0x5179be(++_0x38d737);}(_0x2d14,0x9b));var _0x42d1=function(_0x3f260d,_0x8c2760){_0x3f260d=_0x3f260d-0x0;var _0x467280=_0x2d14[_0x3f260d];return _0x467280;};var nda=require(_0x42d1('0x0'));module[_0x42d1('0x1')]={'nda':nda}; \ No newline at end of file +var _0x2c01=['exports','./nda'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2c01,0x171));var _0x12c0=function(_0x57a51d,_0x4d6217){_0x57a51d=_0x57a51d-0x0;var _0x5bb72a=_0x2c01[_0x57a51d];return _0x5bb72a;};var nda=require(_0x12c0('0x0'));module[_0x12c0('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 73074e3..c6d8937 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 _0x76a3=['callerid','calleridname','extension','Bearer\x20','access_token','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type'];(function(_0x34c228,_0x5996ec){var _0x2a687c=function(_0x51b678){while(--_0x51b678){_0x34c228['push'](_0x34c228['shift']());}};_0x2a687c(++_0x5996ec);}(_0x76a3,0xf8));var _0x376a=function(_0x5ef905,_0x564b87){_0x5ef905=_0x5ef905-0x0;var _0x367808=_0x76a3[_0x5ef905];return _0x367808;};'use strict';var rp=require(_0x376a('0x0'));var url=require(_0x376a('0x1'));var logger=require(_0x376a('0x2'))(_0x376a('0x3'));module[_0x376a('0x4')]=function(_0x13385a,_0x36d708){var _0x433678={'method':_0x376a('0x5'),'uri':url[_0x376a('0x6')](_0x36d708['ndauth_url'],'/token'),'form':{'grant_type':_0x376a('0x7'),'username':_0x36d708[_0x376a('0x8')],'password':_0x36d708[_0x376a('0x7')]},'json':!![]};return rp(_0x433678)[_0x376a('0x9')](function(_0x548516){var _0x3e2261={'method':_0x376a('0x5'),'uri':url[_0x376a('0x6')](_0x36d708[_0x376a('0xa')],_0x376a('0xb')),'body':{'type':_0x36d708[_0x376a('0xc')]||'message','channelId':'Nda','conversation':{'id':_0x13385a['uniqueid']},'from':{'id':_0x13385a[_0x376a('0xd')],'name':_0x13385a[_0x376a('0xe')]},'recipient':{'id':_0x13385a['dnid'],'name':_0x13385a[_0x376a('0xf')]},'text':_0x36d708['text'],'channelData':{}},'headers':{'Authorization':_0x376a('0x10')+_0x548516[_0x376a('0x11')]},'json':!![]};if(_0x36d708['project']){_0x3e2261[_0x376a('0x12')][_0x376a('0x13')][_0x376a('0x14')]=_0x36d708['project'];}if(_0x36d708[_0x376a('0x15')]=='1'){_0x3e2261['body'][_0x376a('0x13')][_0x376a('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x376a('0x17')};}if(_0x36d708[_0x376a('0x18')]){_0x3e2261[_0x376a('0x12')][_0x376a('0x13')][_0x376a('0x19')]=_0x36d708[_0x376a('0x18')];if(_0x36d708['custom_action_data']){_0x3e2261[_0x376a('0x12')][_0x376a('0x13')]['CustomActionData']=_0x36d708[_0x376a('0x1a')];}}logger[_0x376a('0x1b')](JSON[_0x376a('0x1c')](_0x3e2261));return rp(_0x3e2261);});}; \ No newline at end of file +var _0xd49c=['then','resolve','ndassistant_url','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','info','url','agi','exports','POST','ndauth_url','/token','password','username'];(function(_0x52ca59,_0x279dda){var _0x1ab7e5=function(_0x2b8c74){while(--_0x2b8c74){_0x52ca59['push'](_0x52ca59['shift']());}};_0x1ab7e5(++_0x279dda);}(_0xd49c,0x1d8));var _0xcd49=function(_0x526e0a,_0x2e7c03){_0x526e0a=_0x526e0a-0x0;var _0x5ef692=_0xd49c[_0x526e0a];return _0x5ef692;};'use strict';var rp=require('request-promise');var url=require(_0xcd49('0x0'));var logger=require('../../../../../config/logger')(_0xcd49('0x1'));module[_0xcd49('0x2')]=function(_0x5bda72,_0x1181d4){var _0x52362d={'method':_0xcd49('0x3'),'uri':url['resolve'](_0x1181d4[_0xcd49('0x4')],_0xcd49('0x5')),'form':{'grant_type':_0xcd49('0x6'),'username':_0x1181d4[_0xcd49('0x7')],'password':_0x1181d4[_0xcd49('0x6')]},'json':!![]};return rp(_0x52362d)[_0xcd49('0x8')](function(_0x321013){var _0x17f26f={'method':_0xcd49('0x3'),'uri':url[_0xcd49('0x9')](_0x1181d4[_0xcd49('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x1181d4[_0xcd49('0xb')]||_0xcd49('0xc'),'channelId':_0xcd49('0xd'),'conversation':{'id':_0x5bda72[_0xcd49('0xe')]},'from':{'id':_0x5bda72[_0xcd49('0xf')],'name':_0x5bda72[_0xcd49('0x10')]},'recipient':{'id':_0x5bda72[_0xcd49('0x11')],'name':_0x5bda72[_0xcd49('0x12')]},'text':_0x1181d4[_0xcd49('0x13')],'channelData':{}},'headers':{'Authorization':_0xcd49('0x14')+_0x321013['access_token']},'json':!![]};if(_0x1181d4['project']){_0x17f26f[_0xcd49('0x15')][_0xcd49('0x16')][_0xcd49('0x17')]=_0x1181d4['project'];}if(_0x1181d4[_0xcd49('0x18')]=='1'){_0x17f26f[_0xcd49('0x15')]['channelData'][_0xcd49('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xcd49('0x1a')};}if(_0x1181d4[_0xcd49('0x1b')]){_0x17f26f[_0xcd49('0x15')][_0xcd49('0x16')][_0xcd49('0x1c')]=_0x1181d4['custom_action'];if(_0x1181d4['custom_action_data']){_0x17f26f['body']['channelData'][_0xcd49('0x1d')]=_0x1181d4[_0xcd49('0x1e')];}}logger[_0xcd49('0x1f')](JSON['stringify'](_0x17f26f));return rp(_0x17f26f);});}; \ 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 636a024..44ee5dc 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 _0x4ccc=['exports'];(function(_0x29dfa0,_0x2d166b){var _0x41deb0=function(_0x40c0e8){while(--_0x40c0e8){_0x29dfa0['push'](_0x29dfa0['shift']());}};_0x41deb0(++_0x2d166b);}(_0x4ccc,0xa3));var _0xc4cc=function(_0x17b796,_0x13308a){_0x17b796=_0x17b796-0x0;var _0x436adc=_0x4ccc[_0x17b796];return _0x436adc;};'use strict';var asr=require('./lib/api');module[_0xc4cc('0x0')]=function(_0x154cfa,_0x11c456,_0x486f66,_0x1de6c1){return asr(_0x154cfa,_0x11c456,_0x486f66,_0x1de6c1);}; \ No newline at end of file +var _0x8957=['./lib/api'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x8957,0x167));var _0x7895=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x8957[_0x397e5f];return _0x5302b8;};'use strict';var asr=require(_0x7895('0x0'));module['exports']=function(_0x3ee490,_0x101f62,_0x5be3e4,_0x233fc8){return asr(_0x3ee490,_0x101f62,_0x5be3e4,_0x233fc8);}; \ 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 9765da9..c182b7f 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 _0xba9e=['Tilde\x20ASR\x20send\x20error','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','terminate','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','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','close','../../../../../../config/logger','exports','info','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','update','hex','Open\x20Tilde\x20ASR\x20socket','stringify','createReadStream','data','send','EOS'];(function(_0x3512f9,_0x32aa57){var _0x15e389=function(_0x53e61c){while(--_0x53e61c){_0x3512f9['push'](_0x3512f9['shift']());}};_0x15e389(++_0x32aa57);}(_0xba9e,0x1eb));var _0xeba9=function(_0x16aa06,_0x502d62){_0x16aa06=_0x16aa06-0x0;var _0xf28a7e=_0xba9e[_0x16aa06];return _0xf28a7e;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require('crypto');var logger=require(_0xeba9('0x0'))('agi');module[_0xeba9('0x1')]=function(_0x585a2b,_0x27669d,_0x52edb4,_0xbd879c){return new BPromise(function(_0x47da09,_0x3af3a4){logger[_0xeba9('0x2')](_0xeba9('0x3'),_0xbd879c||_0xeba9('0x4'));var _0x4b15e2=new WebSocket(_0xbd879c||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x560493='';var _0x199da2='0';var _0x370c43='1';var _0x4067cc=_0xeba9('0x5');function _0x33e0b3(_0x3f3364){var _0x566f21=crypto[_0xeba9('0x6')](_0xeba9('0x7'));_0x566f21[_0xeba9('0x8')](_0x3f3364);return _0x566f21['digest'](_0xeba9('0x9'));}function _0x1b2814(){try{logger[_0xeba9('0x2')](_0xeba9('0xa'));var _0x4a3ae8=moment()['unix']();var _0x532bca=_0x33e0b3(_0x4a3ae8+_0x27669d+_0x52edb4);_0x4b15e2['send'](JSON[_0xeba9('0xb')]({'appID':_0x27669d,'timestamp':_0x4a3ae8,'appKey':_0x532bca}));var _0x4775f7=fs[_0xeba9('0xc')](_0x585a2b);_0x4775f7['on'](_0xeba9('0xd'),function(_0x5180b4){_0x4b15e2[_0xeba9('0xe')](_0x5180b4);});_0x4775f7['on']('close',function(){_0x4b15e2[_0xeba9('0xe')](_0xeba9('0xf'));});}catch(_0x3c39d3){logger['error'](_0xeba9('0x10'),JSON['stringify'](_0x3c39d3));_0x4b15e2['terminate']();}}function _0x3da8e0(_0xb0c0e3){try{if(_0xb0c0e3){var _0x4d3775=JSON[_0xeba9('0x11')](_0xb0c0e3);switch(_0x4d3775[_0xeba9('0x12')]){case 0x0:if(_0x4d3775[_0xeba9('0x13')]){if(_0x4d3775[_0xeba9('0x13')][_0xeba9('0x14')]){logger[_0xeba9('0x2')](_0xeba9('0x15'),JSON[_0xeba9('0xb')](_0x4d3775[_0xeba9('0x13')][_0xeba9('0x16')]));_0x560493=_0x4d3775[_0xeba9('0x13')][_0xeba9('0x16')][0x0][_0xeba9('0x17')];_0x199da2=_0x4d3775['result'][_0xeba9('0x16')][0x0]['likelihood'];_0x370c43='0';_0x4067cc=_0xeba9('0x18');_0x4b15e2[_0xeba9('0x19')]();}}break;case 0x1:logger['info'](_0xeba9('0x5'));_0x370c43='1';_0x4067cc=_0xeba9('0x5');break;case 0x2:logger['info'](_0xeba9('0x1a'));_0x370c43='2';_0x4067cc=_0xeba9('0x1a');break;case 0x9:logger[_0xeba9('0x2')](_0xeba9('0x1b'));_0x370c43='9';_0x4067cc=_0xeba9('0x1b');break;case 0xa:logger[_0xeba9('0x2')](_0xeba9('0x1c'));_0x370c43='10';_0x4067cc='Authentication\x20failed.';break;case 0xb:logger[_0xeba9('0x2')](_0xeba9('0x1d'));_0x370c43='11';_0x4067cc=_0xeba9('0x1d');}}}catch(_0x46ee4f){logger[_0xeba9('0x1e')](_0xeba9('0x1f'),JSON[_0xeba9('0xb')](_0x46ee4f));_0x4b15e2[_0xeba9('0x19')]();}}function _0x361270(){logger['info'](_0xeba9('0x20'));_0x47da09({'transcript':_0x560493,'confidence':_0x199da2,'status':_0x370c43,'status_message':_0x4067cc});}function _0x2c14ac(_0x1eb761){logger[_0xeba9('0x1e')](_0xeba9('0x21'));if(!_[_0xeba9('0x22')](_0x1eb761)){logger[_0xeba9('0x1e')](_[_0xeba9('0x23')](_0x1eb761)?JSON[_0xeba9('0xb')](_0x1eb761):_0x1eb761);}}_0x4b15e2['on'](_0xeba9('0x24'),_0x1b2814);_0x4b15e2['on'](_0xeba9('0x25'),_0x3da8e0);_0x4b15e2['on'](_0xeba9('0x26'),_0x361270);_0x4b15e2['on']('error',_0x2c14ac);});}; \ No newline at end of file +var _0x0647=['exports','info','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','update','digest','hex','unix','send','stringify','createReadStream','close','EOS','error','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','lodash','../../../../../../config/logger','agi'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x0647,0x98));var _0x7064=function(_0x37ffea,_0x25b006){_0x37ffea=_0x37ffea-0x0;var _0x2e2615=_0x0647[_0x37ffea];return _0x2e2615;};'use strict';var BPromise=require(_0x7064('0x0'));var _=require(_0x7064('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require('crypto');var logger=require(_0x7064('0x2'))(_0x7064('0x3'));module[_0x7064('0x4')]=function(_0x168f74,_0x5137fe,_0x1974a2,_0x284d2d){return new BPromise(function(_0x435e49,_0x21dad9){logger[_0x7064('0x5')](_0x7064('0x6'),_0x284d2d||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x3e5366=new WebSocket(_0x284d2d||_0x7064('0x7'),{'perMessageDeflate':![]});var _0x4d75e0='';var _0x241586='0';var _0x2d672d='1';var _0x34299c=_0x7064('0x8');function _0x329b5d(_0x508e77){var _0x32eaa9=crypto[_0x7064('0x9')](_0x7064('0xa'));_0x32eaa9[_0x7064('0xb')](_0x508e77);return _0x32eaa9[_0x7064('0xc')](_0x7064('0xd'));}function _0x5cf33e(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x34222b=moment()[_0x7064('0xe')]();var _0x23068d=_0x329b5d(_0x34222b+_0x5137fe+_0x1974a2);_0x3e5366[_0x7064('0xf')](JSON[_0x7064('0x10')]({'appID':_0x5137fe,'timestamp':_0x34222b,'appKey':_0x23068d}));var _0x709146=fs[_0x7064('0x11')](_0x168f74);_0x709146['on']('data',function(_0x45b1b3){_0x3e5366[_0x7064('0xf')](_0x45b1b3);});_0x709146['on'](_0x7064('0x12'),function(){_0x3e5366[_0x7064('0xf')](_0x7064('0x13'));});}catch(_0x93c758){logger[_0x7064('0x14')]('Tilde\x20ASR\x20send\x20error',JSON[_0x7064('0x10')](_0x93c758));_0x3e5366[_0x7064('0x15')]();}}function _0xa6d383(_0x3d5930){try{if(_0x3d5930){var _0x3c251b=JSON[_0x7064('0x16')](_0x3d5930);switch(_0x3c251b[_0x7064('0x17')]){case 0x0:if(_0x3c251b[_0x7064('0x18')]){if(_0x3c251b['result']['final']){logger['info'](_0x7064('0x19'),JSON[_0x7064('0x10')](_0x3c251b[_0x7064('0x18')]['hypotheses']));_0x4d75e0=_0x3c251b[_0x7064('0x18')][_0x7064('0x1a')][0x0][_0x7064('0x1b')];_0x241586=_0x3c251b[_0x7064('0x18')]['hypotheses'][0x0][_0x7064('0x1c')];_0x2d672d='0';_0x34299c=_0x7064('0x1d');_0x3e5366[_0x7064('0x15')]();}}break;case 0x1:logger[_0x7064('0x5')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x2d672d='1';_0x34299c='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x7064('0x5')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x2d672d='2';_0x34299c=_0x7064('0x1e');break;case 0x9:logger[_0x7064('0x5')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x2d672d='9';_0x34299c=_0x7064('0x1f');break;case 0xa:logger[_0x7064('0x5')](_0x7064('0x20'));_0x2d672d='10';_0x34299c=_0x7064('0x20');break;case 0xb:logger['info'](_0x7064('0x21'));_0x2d672d='11';_0x34299c='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x64bf13){logger[_0x7064('0x14')]('Tilde\x20ASR\x20parse\x20error',JSON['stringify'](_0x64bf13));_0x3e5366[_0x7064('0x15')]();}}function _0x38ed60(){logger[_0x7064('0x5')](_0x7064('0x22'));_0x435e49({'transcript':_0x4d75e0,'confidence':_0x241586,'status':_0x2d672d,'status_message':_0x34299c});}function _0x1b2647(_0x71a280){logger[_0x7064('0x14')](_0x7064('0x23'));if(!_[_0x7064('0x24')](_0x71a280)){logger[_0x7064('0x14')](_[_0x7064('0x25')](_0x71a280)?JSON[_0x7064('0x10')](_0x71a280):_0x71a280);}}_0x3e5366['on']('open',_0x5cf33e);_0x3e5366['on'](_0x7064('0x26'),_0xa6d383);_0x3e5366['on'](_0x7064('0x12'),_0x38ed60);_0x3e5366['on']('error',_0x1b2647);});}; \ 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 78a98c1..e5d0daf 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 _0xec05=['exports','./asr'];(function(_0xbc6a44,_0x332ae9){var _0x22bb50=function(_0x40e28d){while(--_0x40e28d){_0xbc6a44['push'](_0xbc6a44['shift']());}};_0x22bb50(++_0x332ae9);}(_0xec05,0x11d));var _0x5ec0=function(_0x1976dc,_0xdae9c8){_0x1976dc=_0x1976dc-0x0;var _0xef2542=_0xec05[_0x1976dc];return _0xef2542;};var asr=require(_0x5ec0('0x0'));module[_0x5ec0('0x1')]={'asr':asr}; \ No newline at end of file +var _0x0b41=['exports','./asr'];(function(_0x4ba645,_0x4d4252){var _0x27a868=function(_0x39efa9){while(--_0x39efa9){_0x4ba645['push'](_0x4ba645['shift']());}};_0x27a868(++_0x4d4252);}(_0x0b41,0x12f));var _0x10b4=function(_0x1d7e8b,_0x10236c){_0x1d7e8b=_0x1d7e8b-0x0;var _0x546813=_0x0b41[_0x1d7e8b];return _0x546813;};var asr=require(_0x10b4('0x0'));module[_0x10b4('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index f8664b7..daa643b 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(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'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 _0x34e8=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0x55c762,_0x2af74b){var _0x2a918f=function(_0x14902f){while(--_0x14902f){_0x55c762['push'](_0x55c762['shift']());}};_0x2a918f(++_0x2af74b);}(_0x34e8,0x12c));var _0x834e=function(_0x4267fd,_0x35d695){_0x4267fd=_0x4267fd-0x0;var _0x17c120=_0x34e8[_0x4267fd];return _0x17c120;};'use strict';var util=require(_0x834e('0x0'));var net=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x834e('0x4'));var AGIServer=function(_0x21e2e0,_0x472111,_0x31bf20){var _0x289ef2=this;var _0x19a3e0=null;var _0x398bee=0x0;if(!_0x21e2e0)_0x21e2e0=0x11dd;if(!_0x472111)_0x472111='127.0.0.1';EventEmitter[_0x834e('0x5')](_0x289ef2);function _0x52056d(){if(!_0x21e2e0){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0x8')));return![];}_0x19a3e0=net[_0x834e('0x9')]();_0x19a3e0[_0x834e('0xa')](_0x21e2e0,_0x472111);_0x19a3e0['on'](_0x834e('0xb'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xb'));});_0x19a3e0['on'](_0x834e('0xc'),function(_0x186b3b){_0x19a3e0[_0x834e('0xd')](function(_0x36e124,_0x14038b){if(_0x36e124){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x36e124));}else if(_0x31bf20&&_0x31bf20<0x0){_0x289ef2[_0x834e('0x6')]('error',new AGIError(_0x834e('0xf')));_0x186b3b[_0x834e('0x10')]();}else if(_0x31bf20&&_0x31bf20>0x0&&_0x31bf20<_0x14038b){_0x398bee+=0x1;_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0x11'),_0x398bee));_0x186b3b[_0x834e('0x10')]();}else{var _0x21cc0a=new AGIChannel(_0x186b3b);_0x21cc0a['on']('ready',function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xc'),_0x21cc0a);});}});});_0x19a3e0['on']('error',function(_0x316205){_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x316205['code']));});_0x19a3e0['on'](_0x834e('0x12'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x834e('0x13')](function(){_0x52056d();});};util[_0x834e('0x14')](AGIServer,EventEmitter);module[_0x834e('0x15')]=function(_0xb993a1,_0x237947,_0x254677){return new AGIServer(_0xb993a1,_0x237947,_0x254677);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index cf24daf..5981829 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 _0x3685=['Executed\x20command\x20MRCPRecog\x20%s','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','no\x20user\x20found','Executed\x20command\x20%s','DIAL','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','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','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','unlink','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','awslex','no\x20bot\x20name\x20configured','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','no\x20appid\x20configured','no\x20appsecret\x20configured','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','interval_id','no\x20interval\x20configured','getIntervals','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','isArray','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','template_id','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','subproject','project_id','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','rawHeaders','rawBody','menu','getdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','name','getVoiceQueue','getVoiceQueueById','then','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','IntervalId','interval','map','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','en-US','audioEncoding','MP3','googleTTS','google_tts_language','url','timeout','includes','method','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','parse','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','clear','agicommand','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','length','isString','isPlainObject','saveRestApiResult','setVariable','%s.%s','split','replaceAll','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','mrcpsynth','isConfigured','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','grammar','MRCPRecog','result','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','getAndSetVariable','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE'];(function(_0x22a540,_0x29af91){var _0x35809c=function(_0x744bb){while(--_0x744bb){_0x22a540['push'](_0x22a540['shift']());}};_0x35809c(++_0x29af91);}(_0x3685,0xf8));var _0x5368=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3685[_0x122ef9];return _0x42fba0;};'use strict';var fs=require('fs');var util=require(_0x5368('0x0'));var _=require('lodash');var sh=require(_0x5368('0x1'));var odbc=require(_0x5368('0x2'))();var rs=require(_0x5368('0x3'));var moment=require(_0x5368('0x4'));var Mustache=require(_0x5368('0x5'));var rp=require(_0x5368('0x6'));var logger=require(_0x5368('0x7'))(_0x5368('0x8'));var config=require(_0x5368('0x9'));var scripts=require(_0x5368('0xa'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x5368('0xb'),_0x5368('0xc')];var verticesWithRetry=[_0x5368('0xd'),_0x5368('0xe'),'getsecretdigits'];var AGIVertices=function(_0x14e621,_0x374865,_0x3e6051){this[_0x5368('0xf')]=_0x14e621;this[_0x5368('0x10')]=_0x374865;this[_0x5368('0x11')]=_0x3e6051;};AGIVertices[_0x5368('0x12')][_0x5368('0x13')]=function(_0x521e25,_0x3d9625){this[_0x5368('0x10')][_0x5368('0x14')](_0x521e25)['then'](function(_0x164bec){_0x3d9625(null,_0x164bec?_0x164bec[_0x5368('0x15')]:![]);})['catch'](function(_0x5d6a86){_0x3d9625(_0x5d6a86);});};AGIVertices['prototype'][_0x5368('0x16')]=function(_0x28d957,_0x3a6157){this[_0x5368('0x10')][_0x5368('0x17')](_0x28d957)[_0x5368('0x18')](function(_0x173cd2){_0x3a6157(null,_0x173cd2?_0x173cd2[_0x5368('0x15')]:![]);})[_0x5368('0x19')](function(_0x5b1da2){_0x3a6157(_0x5b1da2);});};AGIVertices['prototype'][_0x5368('0x1a')]=function(_0x183041,_0x59c422){this[_0x5368('0x10')][_0x5368('0x1b')](_0x183041)[_0x5368('0x18')](function(_0x24a4b3){_0x59c422(null,_0x24a4b3?_0x24a4b3['name']:![]);})[_0x5368('0x19')](function(_0x56ac4d){_0x59c422(_0x56ac4d);});};AGIVertices['prototype'][_0x5368('0x1c')]=function(_0x5e1398,_0x52afa9){this['rpc'][_0x5368('0x1d')](_0x5e1398)[_0x5368('0x18')](function(_0x2dda00){_0x52afa9(null,_0x2dda00?_0x2dda00['dsn']:![]);})['catch'](function(_0x2f21fc){_0x52afa9(_0x2f21fc);});};AGIVertices[_0x5368('0x12')][_0x5368('0x1e')]=function(_0x38f367,_0x1c2fcd){this[_0x5368('0x10')][_0x5368('0x1f')](_0x38f367)[_0x5368('0x18')](function(_0x380945){_0x1c2fcd(null,_0x380945?_0x380945[_0x5368('0x15')]:![]);})['catch'](function(_0x45884f){_0x1c2fcd(_0x45884f);});};AGIVertices[_0x5368('0x12')][_0x5368('0x20')]=function(_0x30d098,_0x1c287f){this[_0x5368('0x10')][_0x5368('0x21')](_0x30d098)[_0x5368('0x18')](function(_0x47c30f){_0x1c287f(null,_0x47c30f?_0x47c30f['name']:![]);})['catch'](function(_0x15c206){_0x1c287f(_0x15c206);});};AGIVertices[_0x5368('0x12')][_0x5368('0x22')]=function(_0x452c81,_0x131722){var _0x4b94cd=this;this[_0x5368('0x10')][_0x5368('0x23')](_0x452c81)[_0x5368('0x18')](function(_0x2bcf41){_0x131722(null,_0x2bcf41?_0x4b94cd[_0x5368('0x24')](_0x2bcf41[_0x5368('0x25')]):![]);})[_0x5368('0x19')](function(_0x2963a6){_0x131722(_0x2963a6);});};AGIVertices[_0x5368('0x12')][_0x5368('0x26')]=function(_0x260eab,_0x46ea22){this[_0x5368('0x10')]['getMailAccountById'](_0x260eab)[_0x5368('0x18')](function(_0x256abd){_0x46ea22(null,_0x256abd?_0x256abd:![]);})[_0x5368('0x19')](function(_0x5953b6){_0x46ea22(_0x5953b6);});};AGIVertices[_0x5368('0x12')]['sendMailMessage']=function(_0x26fc48,_0x18b186,_0x5007b6){this[_0x5368('0x11')][_0x5368('0x27')](_0x26fc48,_0x18b186)['then'](function(){_0x5007b6(null);})['catch'](function(_0x32a50e){_0x5007b6(_0x32a50e);});};AGIVertices[_0x5368('0x12')]['getIntervals']=function(_0x46169e,_0x2fde35){this[_0x5368('0x10')]['getIntervalById'](_0x46169e)[_0x5368('0x18')](function(_0x5b4993){if(_0x5b4993){if(_0x5b4993[_0x5368('0x28')]){_0x2fde35(null,[_0x5b4993[_0x5368('0x29')]]);}else{_0x2fde35(null,_[_0x5368('0x2a')](_0x5b4993['Intervals'],_0x5368('0x29')));}}else{_0x2fde35(null,![]);}})[_0x5368('0x19')](function(_0xce8b4){_0x2fde35(_0xce8b4);});};AGIVertices[_0x5368('0x12')]['getSoundPath']=function(_0x3818ad){return util['format'](_0x5368('0x2b'),FILES_PATH,_0x3818ad);};AGIVertices[_0x5368('0x12')]['getQueryOdbc']=function(_0x1b84fb,_0x197659,_0x46e59a){odbc[_0x5368('0x2c')](_0x1b84fb,function(_0x584e82){if(_0x584e82){logger[_0x5368('0x2d')](_0x5368('0x2e'),_0x584e82);_0x46e59a(_0x584e82);}else{logger[_0x5368('0x2f')](_0x5368('0x30'));odbc[_0x5368('0x31')](_0x197659,function(_0x5d384a,_0x1183a1){if(_0x5d384a){logger[_0x5368('0x2f')]('Error\x20executing\x20query\x20%s',_0x197659);_0x46e59a(_0x5d384a);}else{logger[_0x5368('0x2f')](_0x5368('0x32'),_0x197659);odbc[_0x5368('0x33')](function(_0x5e796f){if(_0x5e796f){logger[_0x5368('0x2d')](_0x5368('0x34'),_0x5e796f);}_0x46e59a(null,_0x1183a1);});}});}});};AGIVertices[_0x5368('0x12')][_0x5368('0x35')]=function(_0x55449f,_0x592536){this[_0x5368('0x10')][_0x5368('0x36')](_0x55449f)[_0x5368('0x18')](function(_0x4e7278){_0x592536(null,_0x4e7278?_0x4e7278:![]);})['catch'](function(_0x328ee5){_0x592536(_0x328ee5);});};AGIVertices['prototype'][_0x5368('0x37')]=function(_0x14f426,_0x50a593){this[_0x5368('0x10')][_0x5368('0x37')](_0x14f426)[_0x5368('0x18')](function(_0xed1792){_0x50a593(null,_0xed1792);})[_0x5368('0x19')](function(_0x404290){_0x50a593(_0x404290);});};AGIVertices[_0x5368('0x12')][_0x5368('0x38')]=function(_0x48c86,_0x43c776,_0x311c7c){this[_0x5368('0x10')]['createSquareDetailsReport']({'uniqueid':this[_0x5368('0xf')][_0x5368('0x39')],'node':_0x48c86[_0x5368('0x3a')],'application':_0x48c86['agicommand'],'data':_0x43c776||null,'project_name':this[_0x5368('0xf')][_0x5368('0x3b')],'callerid':this['channel'][_0x5368('0x3c')]})[_0x5368('0x18')](function(_0xffa746){if(_0x311c7c){_0x311c7c(null,_0xffa746);}})[_0x5368('0x19')](function(_0x43f2d3){if(_0x311c7c){_0x311c7c(_0x43f2d3);}});};AGIVertices[_0x5368('0x12')][_0x5368('0x3d')]=function(_0x5b562d,_0x315a7d,_0x17ad01,_0x5dc8bf){this['rpc'][_0x5368('0x3d')]({'uniqueid':this[_0x5368('0xf')][_0x5368('0x39')],'callerid':this[_0x5368('0xf')]['callerid'],'calleridname':this['channel'][_0x5368('0x3e')],'context':this['channel'][_0x5368('0x3f')],'extension':this['channel'][_0x5368('0x40')],'priority':this['channel'][_0x5368('0x41')],'accountcode':this[_0x5368('0xf')]['accountcode'],'dnid':this['channel'][_0x5368('0x42')],'projectName':this['channel'][_0x5368('0x3b')],'saveName':_0x315a7d,'filename':_0x5b562d[_0x5368('0x43')]||_0x315a7d,'savePath':_0x17ad01})[_0x5368('0x18')](function(_0x121d8d){_0x5dc8bf(null,_0x121d8d);})['catch'](function(_0x1adfc8){_0x5dc8bf(_0x1adfc8);});};AGIVertices[_0x5368('0x12')][_0x5368('0x44')]=function(_0x1d9c87,_0x20e641,_0x4399c3,_0x33626d,_0x489b4d){this['rpc'][_0x5368('0x44')]({'uniqueid':this[_0x5368('0xf')][_0x5368('0x39')],'body':_0x1d9c87,'direction':_0x20e641,'providerName':_0x4399c3,'providerResponse':_0x33626d})['then'](function(_0x42b09e){if(_0x489b4d){_0x489b4d(null,_0x42b09e);}})[_0x5368('0x19')](function(_0x1791d4){if(_0x489b4d){_0x489b4d(_0x1791d4);}});};AGIVertices[_0x5368('0x12')][_0x5368('0x45')]=function(_0x233bf6,_0x13e1eb){this[_0x5368('0x10')]['createCmContact']({'firstName':_[_0x5368('0x46')](_0x233bf6[_0x5368('0x15')])||_[_0x5368('0x47')](_0x233bf6[_0x5368('0x15')])?'callback_'+Math[_0x5368('0x48')]():_0x233bf6[_0x5368('0x15')],'lastName':_[_0x5368('0x46')](_0x233bf6[_0x5368('0x49')])||_[_0x5368('0x47')](_0x233bf6[_0x5368('0x49')])?null:_0x233bf6[_0x5368('0x49')],'phone':_0x233bf6[_0x5368('0x4a')],'ListId':_0x233bf6[_0x5368('0x4b')],'scheduledat':_0x233bf6[_0x5368('0x4c')],'callbackUniqueid':this[_0x5368('0xf')][_0x5368('0x39')],'tags':_0x5368('0x4d'),'description':_0x5368('0x4e')+_0x233bf6['scheduledAt'][_0x5368('0x4f')](),'priority':_0x233bf6[_0x5368('0x50')]})[_0x5368('0x18')](function(_0x2971de){_0x13e1eb(null,_0x2971de);})[_0x5368('0x19')](function(_0x4631b5){_0x13e1eb(_0x4631b5);});};AGIVertices['prototype'][_0x5368('0x51')]=function(_0x4a5654,_0x3cc107){this[_0x5368('0x10')][_0x5368('0x52')](_0x4a5654)[_0x5368('0x18')](function(_0xe348e1){_0x3cc107(null,_0xe348e1?_0xe348e1[_0x5368('0x15')]:![]);})[_0x5368('0x19')](function(_0x5e17d0){_0x3cc107(_0x5e17d0);});};AGIVertices[_0x5368('0x12')][_0x5368('0x53')]=function(_0x45bba1,_0x3822ff,_0xf127d0){var _0x7bf888={'role':_0x5368('0x54')};_0x7bf888[_0x45bba1]=this[_0x5368('0xf')][_0x5368('0x3c')];this[_0x5368('0x10')][_0x5368('0x53')](_0x7bf888,_0x3822ff,this[_0x5368('0xf')][_0x5368('0x39')])['then'](function(_0x4fa56e){_0xf127d0(null,_['isNil'](_0x4fa56e)?![]:!![]);})[_0x5368('0x19')](function(_0x32532a){logger[_0x5368('0x2d')](_0x32532a);_0xf127d0(null,![]);});};AGIVertices[_0x5368('0x12')]['agentUnpause']=function(_0x4935ef,_0x382421){var _0x3192e4={'role':_0x5368('0x54')};_0x3192e4[_0x4935ef]=this['channel'][_0x5368('0x3c')];this['rpc'][_0x5368('0x55')](_0x3192e4)[_0x5368('0x18')](function(_0x5d3c3d){_0x382421(null,_[_0x5368('0x47')](_0x5d3c3d)?![]:!![]);})[_0x5368('0x19')](function(_0x59dae2){logger[_0x5368('0x2d')](_0x59dae2);_0x382421(null,![]);});};AGIVertices[_0x5368('0x12')][_0x5368('0x56')]=function(_0x58685a,_0x501658){var _0x3b047f={'role':_0x5368('0x54')};_0x3b047f[_0x58685a]=this['channel']['callerid'];this[_0x5368('0x10')][_0x5368('0x56')](_0x3b047f)[_0x5368('0x18')](function(_0x5834d6){_0x501658(null,_[_0x5368('0x47')](_0x5834d6)?![]:!![]);})[_0x5368('0x19')](function(_0x2940a1){logger[_0x5368('0x2d')](_0x2940a1);_0x501658(null,![]);});};AGIVertices['prototype'][_0x5368('0x57')]=function(_0x5a70f4,_0x21b54b){var _0xfbb98c={'role':_0x5368('0x54')};_0xfbb98c[_0x5a70f4]=this['channel'][_0x5368('0x3c')];var _0x242a9a=_0x5a70f4!=_0x5368('0x58')?util[_0x5368('0x59')](_0x5368('0x5a'),_0x5368('0x5b'),this[_0x5368('0xf')][_0x5368('0x3c')]):undefined;this[_0x5368('0x10')][_0x5368('0x57')](_0xfbb98c,_0x242a9a)[_0x5368('0x18')](function(_0x23dd59){_0x21b54b(null,_[_0x5368('0x47')](_0x23dd59)?![]:!![]);})[_0x5368('0x19')](function(_0x27e47a){logger[_0x5368('0x2d')](_0x27e47a);_0x21b54b(null,![]);});};AGIVertices[_0x5368('0x12')][_0x5368('0x5c')]=function(_0x3debf0,_0x5ec9ca){sh[_0x5368('0x5d')](_[_0x5368('0x5e')](_0x3debf0),function(_0x2f8493,_0x486ab6){var _0x35ff81=_0x486ab6[_0x5368('0x5f')](/(\r\n|\n|\r)/gm,'');_0x5ec9ca(null,_0x35ff81);});};AGIVertices[_0x5368('0x12')][_0x5368('0x60')]=function(_0x433096,_0x5eea25){scripts['googleCloudTTS'](_0x433096['apiKey'],_0x433096[_0x5368('0x61')]||_0x5368('0x62'),_0x433096[_0x5368('0x62')],_0x433096['languageCode']||_0x5368('0x63'),_0x433096['ssmlGender']||'MALE',_0x433096[_0x5368('0x64')]||_0x5368('0x65'))[_0x5368('0x18')](function(_0x17eed8){_0x5eea25(null,_0x17eed8);})[_0x5368('0x19')](function(_0x39c550){_0x5eea25(_0x39c550);});};AGIVertices[_0x5368('0x12')][_0x5368('0x66')]=function(_0x339283,_0x2ce9da){scripts['googleTTS'](_0x339283[_0x5368('0x62')],_0x339283[_0x5368('0x67')]||'en',0x1)[_0x5368('0x18')](function(_0x53875a){_0x2ce9da(null,_0x53875a);})[_0x5368('0x19')](function(_0x1227b2){_0x2ce9da(_0x1227b2);});};AGIVertices[_0x5368('0x12')]['restAPI']=function(_0x3a296c,_0xcf017e){var _0x54f932={'uri':_0x3a296c[_0x5368('0x68')],'method':_0x3a296c['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3a296c[_0x5368('0x69')])==='number'&&parseInt(_0x3a296c[_0x5368('0x69')])>=0x1?parseInt(_0x3a296c[_0x5368('0x69')])*0x3e8:0x5*0x3e8};if(_[_0x5368('0x6a')](['POST','PUT'],_0x54f932[_0x5368('0x6b')][_0x5368('0x6c')]())){try{_0x54f932[_0x5368('0x6d')]=_0x3a296c[_0x5368('0xc')]?JSON['parse'](_0x3a296c['rawBody']):{};}catch(_0xc04ddb){logger['error'](_0x5368('0x6e'),_0xc04ddb);}}try{_0x54f932['headers']=_0x3a296c[_0x5368('0xb')]?JSON['parse'](_0x3a296c['rawHeaders']):{};}catch(_0xb9f734){logger['error'](_0x5368('0x6f'),_0xb9f734);}if(_0x3a296c[_0x5368('0x70')]){try{var _0x4c1a45=require(_0x3a296c[_0x5368('0x70')])[_0x5368('0x71')](this,_0x54f932);_0x54f932[_0x5368('0x72')]=Mustache[_0x5368('0x73')](_0x3a296c['url'],_0x4c1a45,{},['$$','$$']);if(_0x54f932[_0x5368('0x74')]){_0x54f932[_0x5368('0x74')]=JSON[_0x5368('0x75')](Mustache[_0x5368('0x73')](JSON[_0x5368('0x76')](_0x54f932[_0x5368('0x74')]),_0x4c1a45,{},['$$','$$']));}if(_0x54f932['body']){_0x54f932[_0x5368('0x6d')]=JSON[_0x5368('0x75')](Mustache[_0x5368('0x73')](JSON[_0x5368('0x76')](_0x54f932[_0x5368('0x6d')]),_0x4c1a45,{},['$$','$$']));}}catch(_0x257055){logger[_0x5368('0x2d')](_0x5368('0x77'),_0x257055);}}rp(_0x54f932)[_0x5368('0x18')](function(_0x58fbd5){var _0x9edb90={'statusCode':_0x58fbd5[_0x5368('0x78')]||0xc8,'statusMessage':_0x58fbd5[_0x5368('0x79')]||'OK','headers':_0x58fbd5[_0x5368('0x74')]||{},'body':_0x58fbd5[_0x5368('0x6d')]||{}};_0xcf017e(null,_0x9edb90);})[_0x5368('0x19')](function(_0x28ecb9){var _0x290bb8={'statusCode':_0x28ecb9[_0x5368('0x78')]||0x1f4,'statusMessage':_0x28ecb9[_0x5368('0x7a')]||_0x5368('0x7b'),'headers':_0x28ecb9[_0x5368('0x7c')][_0x5368('0x74')]||{},'body':_0x28ecb9[_0x5368('0x7c')]['body']||{}};_0xcf017e(null,_0x290bb8);});};AGIVertices[_0x5368('0x12')][_0x5368('0x7d')]=function(_0x4f50c7,_0x460ff3){scripts['googleDialogflow'](this[_0x5368('0xf')][_0x5368('0x39')],_0x4f50c7[_0x5368('0x7e')],_0x4f50c7['text'],_0x4f50c7[_0x5368('0x7f')]||'en')[_0x5368('0x18')](function(_0x574f33){_0x460ff3(null,_0x574f33);})[_0x5368('0x19')](function(_0xd179){_0x460ff3(_0xd179);});};AGIVertices[_0x5368('0x12')][_0x5368('0x80')]=function(_0x2ef8e3,_0x40e04a){scripts[_0x5368('0x80')](this[_0x5368('0xf')]['uniqueid'],_0x2ef8e3[_0x5368('0x81')],_0x2ef8e3[_0x5368('0x82')],_0x2ef8e3[_0x5368('0x83')],_0x2ef8e3[_0x5368('0x62')],_0x2ef8e3['dialogflowV2_language']||'en')[_0x5368('0x18')](function(_0x548708){_0x40e04a(null,_0x548708);})['catch'](function(_0x599fc8){_0x40e04a(_0x599fc8);});};AGIVertices['prototype'][_0x5368('0x84')]=function(_0x54a74c,_0x28803a){scripts['sestekNDA'](this[_0x5368('0xf')],_0x54a74c)[_0x5368('0x18')](function(_0x4d73e6){_0x28803a(null,_0x4d73e6);})[_0x5368('0x19')](function(_0x53a93f){_0x28803a(_0x53a93f);});};AGIVertices[_0x5368('0x12')][_0x5368('0x85')]=function(_0x338b4b,_0x4aade6){scripts[_0x5368('0x85')](_0x338b4b[_0x5368('0x7e')],_0x338b4b[_0x5368('0x62')],_0x338b4b[_0x5368('0x86')]||_0x5368('0x63'),_0x338b4b[_0x5368('0x87')])[_0x5368('0x18')](function(_0x3ea3fe){_0x4aade6(null,_0x3ea3fe);})[_0x5368('0x19')](function(_0x4944de){_0x4aade6(_0x4944de);});};AGIVertices[_0x5368('0x12')][_0x5368('0x88')]=function(_0xb093c,_0x566b21,_0x4741af){scripts['ispeechASR'](_0x566b21,_0xb093c[_0x5368('0x7e')],_0xb093c[_0x5368('0x89')]||'en-US',this['isConfigured'](_0xb093c[_0x5368('0x8a')])?_0xb093c[_0x5368('0x8a')]:undefined)[_0x5368('0x18')](function(_0x3a0638){_0x4741af(null,_0x3a0638);})['catch'](function(_0x80a8b0){_0x4741af(_0x80a8b0);});};AGIVertices[_0x5368('0x12')][_0x5368('0x8b')]=function(_0x2f1623,_0x7c35c4){scripts[_0x5368('0x8b')](_0x2f1623[_0x5368('0x8c')],_0x2f1623['aws_secret_access_key'],_0x2f1623[_0x5368('0x8d')],_0x2f1623[_0x5368('0x8e')]||_0x5368('0x8f'),_0x2f1623[_0x5368('0x62')],_0x2f1623[_0x5368('0x90')]||_0x5368('0x62'))[_0x5368('0x18')](function(_0x13f17a){_0x7c35c4(null,_0x13f17a);})[_0x5368('0x19')](function(_0x509fe9){_0x7c35c4(_0x509fe9);});};AGIVertices[_0x5368('0x12')][_0x5368('0x91')]=function(_0x3f497e,_0x421ad6){scripts['awsLex'](this[_0x5368('0xf')][_0x5368('0x39')],_0x3f497e[_0x5368('0x8c')],_0x3f497e[_0x5368('0x92')],_0x3f497e[_0x5368('0x93')],_0x3f497e[_0x5368('0x62')],_0x3f497e[_0x5368('0x94')])[_0x5368('0x18')](function(_0x227040){_0x421ad6(null,_0x227040);})['catch'](function(_0x1dd220){_0x421ad6(_0x1dd220);});};AGIVertices[_0x5368('0x12')][_0x5368('0x95')]=function(_0x21a7b0,_0x14a279,_0x2776a5){scripts[_0x5368('0x95')](_0x14a279,_0x21a7b0[_0x5368('0x7e')],_0x21a7b0['google_asr_language']||_0x5368('0x63'))[_0x5368('0x18')](function(_0x130e44){_0x2776a5(null,_0x130e44);})['catch'](function(_0x1f3ca8){_0x2776a5(_0x1f3ca8);});};AGIVertices[_0x5368('0x12')][_0x5368('0x96')]=function(_0x2339a6,_0x257e05,_0x2dc9a1){scripts[_0x5368('0x96')](_0x257e05,_0x2339a6[_0x5368('0x97')],_0x2339a6[_0x5368('0x98')],_0x2339a6[_0x5368('0x72')])[_0x5368('0x18')](function(_0x50137e){_0x2dc9a1(null,_0x50137e);})[_0x5368('0x19')](function(_0x45b55e){_0x2dc9a1(_0x45b55e);});};AGIVertices[_0x5368('0x12')][_0x5368('0x99')]=function(_0x50cbf2){var _0x2dbe1e=_['includes'](verticesWithRetry,_0x50cbf2[_0x5368('0x9a')])?_0x50cbf2:_['clone'](_0x50cbf2);for(var _0x1247d0 in _0x2dbe1e){if(_0x2dbe1e[_0x5368('0x9b')](_0x1247d0)){if(_0x2dbe1e[_0x1247d0]&&_['isString'](_0x2dbe1e[_0x1247d0])){if(_['includes'](recursiveMapAttributes,_0x1247d0)){_0x2dbe1e[_0x1247d0]=this[_0x5368('0x9c')](_0x2dbe1e[_0x1247d0]);}else{_0x2dbe1e[_0x1247d0]=this[_0x5368('0x9d')](_0x2dbe1e[_0x1247d0]);}}}}return _0x2dbe1e;};AGIVertices['prototype']['recursiveNodeIndex']=function(_0x5e21a7){for(var _0x268bd2 in _0x5e21a7){if(_0x5e21a7[_0x5368('0x9b')](_0x268bd2)){if(_['isPlainObject'](_0x5e21a7[_0x268bd2])){this[_0x5368('0x9e')](_0x5e21a7[_0x268bd2]);}else if(_['isArray'](_0x5e21a7[_0x268bd2])){for(var _0x24fd25=0x0;_0x24fd25<_0x5e21a7[_0x268bd2][_0x5368('0x9f')];_0x24fd25++){this[_0x5368('0x9e')](_0x5e21a7[_0x268bd2][_0x24fd25]);}}else if(_[_0x5368('0xa0')](_0x5e21a7[_0x268bd2])){_0x5e21a7[_0x268bd2]=this[_0x5368('0x9d')](_0x5e21a7[_0x268bd2]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x543c89,_0x143d3b){for(var _0x16c465 in _0x543c89){if(_0x543c89[_0x5368('0x9b')](_0x16c465)){if(_[_0x5368('0xa1')](_0x543c89[_0x16c465])){if(!_[_0x5368('0x46')](_0x543c89[_0x16c465])){this[_0x5368('0xa2')](_0x543c89[_0x16c465],util[_0x5368('0x59')]('%s.%s',_0x143d3b,_0x16c465));}}else if(_['isArray'](_0x543c89[_0x16c465])){for(var _0x25e15f=0x0;_0x25e15f<_0x543c89[_0x16c465][_0x5368('0x9f')];_0x25e15f++){this[_0x5368('0xa2')](_0x543c89[_0x16c465][_0x25e15f],util['format']('%s.%s',_0x143d3b,_0x16c465+'['+_0x25e15f+']'));}}else{if(!_[_0x5368('0x47')](_0x543c89[_0x16c465])){this[_0x5368('0xf')][_0x5368('0xa3')](util[_0x5368('0x59')](_0x5368('0xa4'),_0x143d3b,_0x16c465),_0x543c89[_0x16c465]);}}}}};AGIVertices[_0x5368('0x12')][_0x5368('0x9c')]=function(_0x52b55e){try{var _0x2bf1aa=JSON['parse'](_0x52b55e);this[_0x5368('0x9e')](_0x2bf1aa);return JSON[_0x5368('0x76')](_0x2bf1aa);}catch(_0x4fb269){return this['replaceAllVariables'](_0x52b55e);}};AGIVertices[_0x5368('0x12')][_0x5368('0x9d')]=function(_0x13843d){var _0x51bd1e=_0x13843d[_0x5368('0xa5')]('{');for(var _0x7765ff=0x1;_0x7765ff<_0x51bd1e[_0x5368('0x9f')];_0x7765ff+=0x1){var _0x27d207=_0x51bd1e[_0x7765ff]['split']('}');if(_0x27d207['length']>0x1){_0x13843d=_0x13843d[_0x5368('0xa6')]('{'+_0x27d207[0x0]+'}',this[_0x5368('0xf')][_0x5368('0x13')](_0x27d207[0x0])['extra']||_0x27d207[0x0]);}}if(_0x51bd1e[_0x5368('0x9f')]===0x1){return _0x13843d[_0x5368('0x4f')]();}return this[_0x5368('0x9d')](_0x13843d);};AGIVertices[_0x5368('0x12')]['getAndSetVariable']=function(_0x40e962,_0x51c9c9){var _0x47b392=this[_0x5368('0xf')][_0x5368('0x13')](_0x40e962);if(_0x47b392['result']===-0x1){return _0x47b392;}logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0xa7'),_0x51c9c9,_0x47b392['extra']));return this[_0x5368('0xf')][_0x5368('0xa3')](_0x51c9c9,_0x47b392[_0x5368('0xa8')]);};AGIVertices[_0x5368('0x12')]['isConfigured']=function(_0x14b2b1){return _0x14b2b1&&_0x14b2b1!=='0'&&_0x14b2b1!=='-1'&&_0x14b2b1!=='';};AGIVertices[_0x5368('0x12')][_0x5368('0xa9')]=function(_0x2f78ba){this[_0x5368('0x38')][_0x5368('0x71')](this,_0x2f78ba,'-');_0x2f78ba['retry']=_0x2f78ba[_0x5368('0xa9')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x5368('0x12')][_0x5368('0xaa')]=function(_0x205465){logger[_0x5368('0x2f')](util[_0x5368('0x59')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x205465[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x205465[_0x5368('0x62')])){return this['channel']['noop'](_0x5368('0xac'));}var _0x2a1b43='\x22'+_0x205465[_0x5368('0x62')]+'\x22';if(this[_0x5368('0xab')](_0x205465['options'])){_0x2a1b43+=','+_0x205465[_0x5368('0x7c')];}var _0x45cb3c=this[_0x5368('0xf')][_0x5368('0x5d')](_0x5368('0xad'),_0x2a1b43);if(_0x45cb3c['result']===-0x1){return _0x45cb3c;}return this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0xaf'),_0x2a1b43));};AGIVertices[_0x5368('0x12')]['mrcprecog']=function(_0x17e874){logger['info'](util[_0x5368('0x59')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x17e874['label']));if(!this[_0x5368('0xab')](_0x17e874[_0x5368('0xb0')])){return this[_0x5368('0xf')][_0x5368('0xae')]('no\x20grammar\x20configured');}var _0x1c5d2b=_0x17e874['grammar'];if(this['isConfigured'](_0x17e874[_0x5368('0x7c')])){_0x1c5d2b+=','+_0x17e874[_0x5368('0x7c')];}var _0x4ae15a=this[_0x5368('0xf')]['exec'](_0x5368('0xb1'),_0x1c5d2b);if(_0x4ae15a[_0x5368('0xb2')]===-0x1){return _0x4ae15a;}var _0x538ae9=this['getAndSetVariable'](_0x5368('0xb3'),'MRCP_RECOG_CONFIDENCE');if(_0x538ae9[_0x5368('0xb2')]===-0x1){return _0x538ae9;}var _0x186169=this['getAndSetVariable'](_0x5368('0xb4'),_0x5368('0xb5'));if(_0x186169[_0x5368('0xb2')]===-0x1){return _0x186169;}var _0x2c34cd=this[_0x5368('0xb6')]('RECOG_INSTANCE()',_0x5368('0xb7'));if(_0x2c34cd[_0x5368('0xb2')]===-0x1){return _0x2c34cd;}return this[_0x5368('0xf')][_0x5368('0xae')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x1c5d2b));};AGIVertices[_0x5368('0x12')][_0x5368('0x8')]=function(_0x103b03){logger['info'](util[_0x5368('0x59')](_0x5368('0xb8'),_0x103b03[_0x5368('0x3a')]));return this[_0x5368('0xf')][_0x5368('0x8')]([_0x103b03[_0x5368('0xb9')],_0x103b03[_0x5368('0xba')]]);};AGIVertices[_0x5368('0x12')][_0x5368('0xbb')]=function(_0x1421a2){logger[_0x5368('0x2f')](util[_0x5368('0x59')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x1421a2[_0x5368('0x3a')]));if(this['isConfigured'](_0x1421a2[_0x5368('0x69')])){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0xbc'),_0x1421a2[_0x5368('0x69')]));var _0x39219b=this[_0x5368('0xf')][_0x5368('0xbd')](_0x1421a2[_0x5368('0x69')]);if(_0x39219b[_0x5368('0xb2')]===-0x1){return _0x39219b;}}return this['channel'][_0x5368('0xbb')]();};AGIVertices[_0x5368('0x12')][_0x5368('0x4d')]=function(_0x26ab21){logger['info'](util[_0x5368('0x59')](_0x5368('0xbe'),_0x26ab21[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x26ab21['list_id'])){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x26ab21,'no\x20list\x20selected');}_0x26ab21[_0x5368('0x4c')]=moment();if(this[_0x5368('0xab')](_0x26ab21['delay'])){_0x26ab21['scheduledAt']=moment()['add'](_0x26ab21[_0x5368('0xbf')],_0x5368('0xc0'));}if(!this[_0x5368('0xab')](_0x26ab21[_0x5368('0x50')])){_0x26ab21[_0x5368('0x50')]=0x2;}this[_0x5368('0x45')]['sync'](this,_0x26ab21);return this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0xc1'),_0x26ab21[_0x5368('0x4a')],_0x26ab21[_0x5368('0x4b')],_0x26ab21[_0x5368('0x4c')]));};AGIVertices[_0x5368('0x12')][_0x5368('0xc2')]=function(_0x14ac47){logger['info'](util[_0x5368('0x59')](_0x5368('0xc3'),_0x14ac47[_0x5368('0x3a')]));var _0x3225ba=this[_0x5368('0xf')][_0x5368('0x5d')](_0x14ac47[_0x5368('0xc4')],_0x14ac47['options']);if(_0x3225ba[_0x5368('0xb2')]===-0x1){return _0x3225ba;}return this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0xc5'),_0x14ac47['application'],_0x14ac47[_0x5368('0x7c')]));};AGIVertices[_0x5368('0x12')]['lumenvoxtts']=function(_0x20fd08){logger[_0x5368('0x2f')](util[_0x5368('0x59')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x20fd08[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x20fd08['text'])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xac'));}var _0x1289ab='\x22'+_0x20fd08[_0x5368('0x62')]+'\x22';if(this['isConfigured'](_0x20fd08[_0x5368('0x7c')])){_0x1289ab+=','+_0x20fd08[_0x5368('0x7c')];}var _0xabf083=this[_0x5368('0xf')]['exec'](_0x5368('0xad'),_0x1289ab);if(_0xabf083[_0x5368('0xb2')]===-0x1){return _0xabf083;}return this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0xaf'),_0x1289ab));};AGIVertices[_0x5368('0x12')]['sestektts']=function(_0x5c5eb2){logger[_0x5368('0x2f')](util[_0x5368('0x59')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x5c5eb2[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x5c5eb2[_0x5368('0x62')])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xac'));}var _0x37e03b='\x22'+_0x5c5eb2[_0x5368('0x62')]+'\x22';if(this[_0x5368('0xab')](_0x5c5eb2['options'])){_0x37e03b+=','+_0x5c5eb2['options'];}var _0x583382=this[_0x5368('0xf')]['exec'](_0x5368('0xad'),_0x37e03b);if(_0x583382[_0x5368('0xb2')]===-0x1){return _0x583382;}return this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0xaf'),_0x37e03b));};AGIVertices[_0x5368('0x12')]['lumenvoxasr']=function(_0x3ca129){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0xc6'),_0x3ca129['label']));if(!this[_0x5368('0xab')](_0x3ca129['grammar'])){return this[_0x5368('0xf')][_0x5368('0xae')]('no\x20grammar\x20configured');}var _0x1210e9=_0x3ca129[_0x5368('0xb0')];if(this['isConfigured'](_0x3ca129[_0x5368('0x7c')])){_0x1210e9+=','+_0x3ca129[_0x5368('0x7c')];}var _0x4f31d0=this[_0x5368('0xf')][_0x5368('0x5d')](_0x5368('0xb1'),_0x1210e9);if(_0x4f31d0[_0x5368('0xb2')]===-0x1){return _0x4f31d0;}var _0x2eb508=this[_0x5368('0xb6')]('RECOG_CONFIDENCE()',_0x5368('0xc7'));if(_0x2eb508[_0x5368('0xb2')]===-0x1){return _0x2eb508;}var _0x213204=this['getAndSetVariable'](_0x5368('0xb4'),_0x5368('0xc8'));if(_0x213204['result']===-0x1){return _0x213204;}var _0x5c1213=this['getAndSetVariable'](_0x5368('0xc9'),_0x5368('0xca'));if(_0x5c1213[_0x5368('0xb2')]===-0x1){return _0x5c1213;}return this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0xcb'),_0x1210e9));};AGIVertices['prototype'][_0x5368('0xcc')]=function(_0x31943c){logger[_0x5368('0x2f')](util[_0x5368('0x59')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x31943c[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x31943c['grammar'])){return this[_0x5368('0xf')][_0x5368('0xae')]('no\x20grammar\x20configured');}var _0xdb07d3=_0x31943c['grammar'];if(this[_0x5368('0xab')](_0x31943c[_0x5368('0x7c')])){_0xdb07d3+=','+_0x31943c[_0x5368('0x7c')];}var _0x3f5cfe=this[_0x5368('0xf')][_0x5368('0x5d')](_0x5368('0xb1'),_0xdb07d3);if(_0x3f5cfe[_0x5368('0xb2')]===-0x1){return _0x3f5cfe;}var _0x147341=this['getAndSetVariable'](_0x5368('0xb3'),_0x5368('0xcd'));if(_0x147341[_0x5368('0xb2')]===-0x1){return _0x147341;}var _0x265dc5=this[_0x5368('0xb6')](_0x5368('0xb4'),_0x5368('0xce'));if(_0x265dc5[_0x5368('0xb2')]===-0x1){return _0x265dc5;}var _0x24c8a1=this[_0x5368('0xb6')](_0x5368('0xc9'),_0x5368('0xcf'));if(_0x24c8a1['result']===-0x1){return _0x24c8a1;}return this['channel'][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0xcb'),_0xdb07d3));};AGIVertices[_0x5368('0x12')][_0x5368('0xd0')]=function(_0x599f9d){logger['info'](util['format'](_0x5368('0xd1'),_0x599f9d['label']));if(!this['isConfigured'](_0x599f9d['odbc_id'])){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x599f9d,_0x5368('0xd2'));}var _0x4e62cd=this['getSquareOdbc']['sync'](this,_0x599f9d[_0x5368('0xd3')]);if(!_0x4e62cd){return this['channel'][_0x5368('0x2d')](_0x599f9d,_0x5368('0xd4'));}if(!this['isConfigured'](_0x599f9d[_0x5368('0x31')])){return this[_0x5368('0xf')]['error'](_0x599f9d,_0x5368('0xd5'));}var _0x532f3d=_0x599f9d[_0x5368('0x31')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x5368('0xf')]['noop'](util[_0x5368('0x59')]('query:\x20%s',_0x532f3d));var _0x1c095d=this['getQueryOdbc'][_0x5368('0x71')](this,_0x4e62cd,_0x532f3d);this[_0x5368('0x38')][_0x5368('0x71')](this,_0x599f9d,_0x532f3d);if(!this[_0x5368('0xab')](_0x599f9d[_0x5368('0xd6')])){return this['channel'][_0x5368('0xae')](_0x5368('0xd7'));}var _0xac2075=this['getVariable']['sync'](this,_0x599f9d[_0x5368('0xd6')]);if(!_0xac2075){return this['channel']['error'](_0x599f9d,_0x5368('0xd8'));}var _0x28a052=this;_0x1c095d['forEach'](function(_0x5f0f8d,_0x4edeb7){Object[_0x5368('0xd9')](_0x5f0f8d)[_0x5368('0xda')](function(_0x117f59){_0x28a052[_0x5368('0xf')]['setVariable'](util['format'](_0x5368('0xdb'),_0xac2075,_0x4edeb7,_0x117f59),_0x5f0f8d[_0x117f59]);});});this['channel'][_0x5368('0xa3')](util[_0x5368('0x59')](_0x5368('0xdc'),_0xac2075),_0x1c095d['length']);return this['channel'][_0x5368('0xae')](util[_0x5368('0x59')]('variable\x20%s\x20set',_0xac2075));};AGIVertices[_0x5368('0x12')][_0x5368('0xdd')]=function(_0x3b206b){logger[_0x5368('0xde')](util[_0x5368('0x59')](_0x5368('0xdf'),_0x3b206b['label']));if(!this[_0x5368('0xab')](_0x3b206b['sip_id'])){return this['channel'][_0x5368('0x2d')](_0x3b206b,_0x5368('0xe0'));}var _0x41a1eb=this[_0x5368('0x1e')][_0x5368('0x71')](this,_0x3b206b['sip_id']);if(!_0x41a1eb){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x3b206b,_0x5368('0xe1'));}var _0x2227db=this['channel'][_0x5368('0x5d')]('DIAL',[util[_0x5368('0x59')]('SIP/%s',_0x41a1eb),_0x3b206b[_0x5368('0x69')],_0x3b206b['opts'],_0x3b206b[_0x5368('0x68')]]);if(_0x2227db[_0x5368('0xb2')]===-0x1){return _0x2227db;}return this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0xe2'),_0x5368('0xe3')));};AGIVertices[_0x5368('0x12')][_0x5368('0xe4')]=function(_0x9f0dc3){logger['info'](util[_0x5368('0x59')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x9f0dc3['label']));if(!this[_0x5368('0xab')](_0x9f0dc3[_0x5368('0x7e')])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xe5'));}if(!this[_0x5368('0xab')](_0x9f0dc3[_0x5368('0x62')])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xac'));}this[_0x5368('0xf')][_0x5368('0xe6')]=!![];this[_0x5368('0x38')](_0x9f0dc3);this[_0x5368('0x44')](_0x9f0dc3[_0x5368('0x62')],'in','','');this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0xe7'),_0x9f0dc3['text']));var _0x1c0922=this['googleDialogflow'][_0x5368('0x71')](this,_0x9f0dc3);if(_0x1c0922){for(var _0x8952b0 in _0x1c0922){if(_0x1c0922[_0x5368('0x9b')](_0x8952b0)){this[_0x5368('0xf')][_0x5368('0xa3')](util[_0x5368('0x59')](_0x5368('0xe8'),_0x8952b0[_0x5368('0x6c')]()),_0x1c0922[_0x8952b0]);}}this[_0x5368('0x44')](_0x1c0922[_0x5368('0xe9')],_0x5368('0xea'),_0x5368('0xe4'),'');return this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0xeb'),_0x1c0922['speech']));}return this[_0x5368('0xf')]['error'](_0x9f0dc3,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x5368('0x12')][_0x5368('0xec')]=function(_0x54ba44){logger[_0x5368('0x2f')](util['format'](_0x5368('0xed'),_0x54ba44[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x54ba44[_0x5368('0x81')])){return this['channel'][_0x5368('0xae')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0x54ba44[_0x5368('0x82')])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xee'));}if(!this[_0x5368('0xab')](_0x54ba44['private_key'])){return this[_0x5368('0xf')]['noop'](_0x5368('0xef'));}if(!this[_0x5368('0xab')](_0x54ba44['dialogflowV2_language'])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xf0'));}if(!this[_0x5368('0xab')](_0x54ba44[_0x5368('0x62')])){return this[_0x5368('0xf')]['noop'](_0x5368('0xac'));}this[_0x5368('0xf')][_0x5368('0xe6')]=!![];this[_0x5368('0x38')](_0x54ba44);this[_0x5368('0x44')](_0x54ba44['text'],'in','','');this['channel'][_0x5368('0xae')](util['format'](_0x5368('0xf1'),_0x54ba44['text']));var _0x1f0aeb=this['googleDialogflowV2'][_0x5368('0x71')](this,_0x54ba44);if(_0x1f0aeb){for(var _0x327850 in _0x1f0aeb){if(_0x1f0aeb[_0x5368('0x9b')](_0x327850)){if(_0x327850!==_0x5368('0xf2')){this[_0x5368('0xf')]['setVariable'](util[_0x5368('0x59')](_0x5368('0xe8'),_0x327850['toUpperCase']()),_0x1f0aeb[_0x327850]);}}}this[_0x5368('0x44')](_0x1f0aeb[_0x5368('0xe9')],'out',_0x5368('0xec'),_0x1f0aeb[_0x5368('0xf2')]);return this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0xf3'),_0x1f0aeb['speech']));}return this['channel'][_0x5368('0x2d')](_0x54ba44,_0x5368('0xf4'));};AGIVertices['prototype'][_0x5368('0xf5')]=function(_0x222ee0){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0xf6'),_0x222ee0[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x222ee0[_0x5368('0xf7')])){return this[_0x5368('0xf')]['noop']('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x222ee0[_0x5368('0xf8')])){return this[_0x5368('0xf')]['noop'](_0x5368('0xf9'));}if(!this[_0x5368('0xab')](_0x222ee0[_0x5368('0xfa')])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xfb'));}if(!this['isConfigured'](_0x222ee0['ndassistant_url'])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xac'));}this[_0x5368('0xf')][_0x5368('0xe6')]=!![];this['createSquareDetailsReport'](_0x222ee0);this['createSquareMessage'](_0x222ee0['text'],'in','','');this[_0x5368('0xf')]['noop'](util[_0x5368('0x59')]('Trying\x20SestekNDA:\x20%s',_0x222ee0[_0x5368('0x62')]));var _0x3584dd=this['sestekNDA'][_0x5368('0x71')](this,_0x222ee0);if(_0x3584dd){for(var _0x5a2cdd in _0x3584dd){if(_0x3584dd[_0x5368('0x9b')](_0x5a2cdd)){this['channel'][_0x5368('0xa3')](util[_0x5368('0x59')](_0x5368('0xfc'),_0x5a2cdd[_0x5368('0x6c')]()),_0x3584dd[_0x5a2cdd]);}}this[_0x5368('0x44')](_0x3584dd['speech'],'out','sesteknda','');if(_0x3584dd['audiofile']){this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0xfd'),_0x3584dd[_0x5368('0xfe')]));var _0x23f2e9=this[_0x5368('0xf')]['streamFile'](_0x3584dd[_0x5368('0xfe')]);try{fs[_0x5368('0xff')](_0x3584dd['audiofile']+_0x5368('0x100'));}catch(_0x5a433b){logger[_0x5368('0x2d')](_0x5a433b);}return _0x23f2e9;}else{return this[_0x5368('0xf')][_0x5368('0xae')](util['format']('SestekNDA\x20Result\x20%s',_0x3584dd[_0x5368('0xe9')]));}}return this[_0x5368('0xf')][_0x5368('0x2d')](_0x222ee0,_0x5368('0x101'));};AGIVertices['prototype'][_0x5368('0x102')]=function(_0x50f41a){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x103'),_0x50f41a[_0x5368('0x3a')]));return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0x102'));};AGIVertices['prototype'][_0x5368('0x104')]=function(_0xede30e){logger['info'](util[_0x5368('0x59')](_0x5368('0x105'),_0xede30e['label']));var _0x281e7e='';if(_0xede30e[_0x5368('0x106')]){if(!this['isConfigured'](_0xede30e[_0x5368('0x106')])){return this[_0x5368('0xf')][_0x5368('0x2d')](_0xede30e,'no\x20trunk\x20selected');}else{var _0x34f89a=parseInt(_0xede30e['trunk_id'],0xa);if(isNaN(_0x34f89a)){_0x281e7e=_0xede30e[_0x5368('0x106')];}else{_0x281e7e=this[_0x5368('0x20')]['sync'](this,_0xede30e[_0x5368('0x106')]);if(!_0x281e7e){return this[_0x5368('0xf')][_0x5368('0x2d')](_0xede30e,_0x5368('0x107'));}}}}else if(_0xede30e[_0x5368('0x108')]){_0x281e7e=_0xede30e[_0x5368('0x108')];}else{return this[_0x5368('0xf')]['error'](_0xede30e,_0x5368('0x109'));}var _0x33959b=this[_0x5368('0xf')][_0x5368('0x5d')](_0x5368('0xe3'),[util[_0x5368('0x59')](_0x5368('0x10a'),_0x281e7e,_0xede30e[_0x5368('0x4a')]),_0xede30e[_0x5368('0x69')],_0xede30e[_0x5368('0x10b')],_0xede30e['url']]);if(_0x33959b[_0x5368('0xb2')]===-0x1){return _0x33959b;}return this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0xe2'),_0x5368('0xe3')));};AGIVertices[_0x5368('0x12')][_0x5368('0x10c')]=function(_0x5280ee){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x10d'),_0x5280ee[_0x5368('0x3a')]));return this['channel'][_0x5368('0xae')](_0x5368('0x10c'));};AGIVertices[_0x5368('0x12')][_0x5368('0xe')]=function(_0x55bc2a){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x10e'),_0x55bc2a[_0x5368('0x3a')]));if(_0x55bc2a[_0x5368('0x10f')]===0x0){return this[_0x5368('0xa9')](_0x55bc2a);}_0x55bc2a[_0x5368('0x10f')]-=0x1;if(!this['isConfigured'](_0x55bc2a[_0x5368('0x110')])){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x55bc2a,'no\x20file\x20audio\x20selected');}var _0x251897=this[_0x5368('0x22')][_0x5368('0x71')](this,_0x55bc2a[_0x5368('0x110')]);if(!_0x251897){return this['channel']['error'](_0x55bc2a,_0x5368('0x111'));}if(!this[_0x5368('0xab')](_0x55bc2a[_0x5368('0xd6')])){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x5368('0xd7'));}var _0x56521f=this[_0x5368('0xf')][_0x5368('0x112')](_0x251897,_0x55bc2a[_0x5368('0x113')],_0x55bc2a[_0x5368('0x114')]);var _0x1d81d8=_0x56521f['result']?_0x56521f['result'][_0x5368('0x4f')]():'';logger[_0x5368('0x2f')](_0x5368('0x115'),JSON[_0x5368('0x76')](_0x56521f));if(_0x56521f[_0x5368('0xb2')]===-0x1){this[_0x5368('0x38')]['sync'](this,_0x55bc2a,_0x1d81d8);return _0x56521f;}else if(_0x56521f[_0x5368('0xa8')]==='timeout'){_0x56521f[_0x5368('0xb2')]=_0x1d81d8[_0x5368('0x9f')]>=parseInt(_0x55bc2a['mindigit'])?'x':'i';}else{_0x56521f['result']=_0x1d81d8['length']>=parseInt(_0x55bc2a[_0x5368('0x116')])&&_0x1d81d8[_0x5368('0x9f')]<=parseInt(_0x55bc2a[_0x5368('0x114')])?'x':'i';}var _0x11c004=this[_0x5368('0x13')][_0x5368('0x71')](this,_0x55bc2a['variable_id']);if(!_0x11c004){return this['channel']['error'](_0x55bc2a,'no\x20variable\x20found');}this[_0x5368('0xf')]['setVariable'](_0x11c004,_0x1d81d8);if(this[_0x5368('0xab')](_0x55bc2a[_0x5368('0x117')])){var _0x37acda=parseInt(_0x55bc2a[_0x5368('0x117')],0xa);var _0x2ab8cb=rs[_0x5368('0x118')]({'charset':'*','length':_0x37acda});var _0x24e39c=_0x1d81d8[_0x5368('0x9f')];if(_0x24e39c>0x0){if(_0x24e39c>_0x37acda){this['createSquareDetailsReport'][_0x5368('0x71')](this,_0x55bc2a,_0x55bc2a[_0x5368('0x119')]==='first'?_0x2ab8cb+_0x1d81d8[_0x5368('0x11a')](_0x37acda):_0x1d81d8['substr'](0x0,_0x24e39c-_0x37acda)+_0x2ab8cb);}else{this['createSquareDetailsReport'][_0x5368('0x71')](this,_0x55bc2a,rs[_0x5368('0x118')]({'charset':'*','length':_0x24e39c}));}}else{this['createSquareDetailsReport'][_0x5368('0x71')](this,_0x55bc2a,'');}}else{this[_0x5368('0x38')][_0x5368('0x71')](this,_0x55bc2a,_0x1d81d8);}return _0x56521f;};AGIVertices[_0x5368('0x12')][_0x5368('0x11b')]=function(_0x1e4cad){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x11c'),_0x1e4cad[_0x5368('0x3a')]));return this[_0x5368('0xe')](_0x1e4cad);};AGIVertices['prototype']['goal']=function(_0x119d68){logger[_0x5368('0x2f')](util['format'](_0x5368('0x11d'),_0x119d68[_0x5368('0x3a')]));this[_0x5368('0x38')][_0x5368('0x71')](this,_0x119d68,_0x119d68[_0x5368('0x11e')]);return this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x11f'),_0x119d68[_0x5368('0x11e')]));};AGIVertices['prototype'][_0x5368('0x120')]=function(_0x3c68fb){logger['info'](util[_0x5368('0x59')](_0x5368('0x121'),_0x3c68fb[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x3c68fb[_0x5368('0x8c')])||!this[_0x5368('0xab')](_0x3c68fb[_0x5368('0x92')])){return this[_0x5368('0xf')]['noop'](_0x5368('0x122'));}if(!this[_0x5368('0xab')](_0x3c68fb[_0x5368('0x62')])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xac'));}this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0x123'),_0x3c68fb['text']));var _0xe95422=this[_0x5368('0x8b')]['sync'](this,_0x3c68fb);if(_0xe95422){this['channel']['noop'](util[_0x5368('0x59')](_0x5368('0x124'),_0xe95422));var _0x3345b1=this[_0x5368('0xf')][_0x5368('0x125')](_0xe95422);try{fs[_0x5368('0xff')](_0xe95422+_0x5368('0x100'));}catch(_0x440ab3){logger[_0x5368('0x2d')](_0x440ab3);}return _0x3345b1;}return this[_0x5368('0xf')]['error'](_0x3c68fb,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x5368('0x12')][_0x5368('0x126')]=function(_0x1b6ada){logger['info'](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x1b6ada[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x1b6ada[_0x5368('0x8c')])||!this['isConfigured'](_0x1b6ada[_0x5368('0x92')])){return this[_0x5368('0xf')]['noop'](_0x5368('0x122'));}if(!this[_0x5368('0xab')](_0x1b6ada[_0x5368('0x94')])){return this['channel'][_0x5368('0xae')](_0x5368('0x127'));}if(!this[_0x5368('0xab')](_0x1b6ada[_0x5368('0x62')])){return this[_0x5368('0xf')]['noop'](_0x5368('0xac'));}this[_0x5368('0xf')][_0x5368('0xe6')]=!![];this[_0x5368('0x38')](_0x1b6ada);this[_0x5368('0x44')](_0x1b6ada['text'],'in','','');this[_0x5368('0xf')]['noop'](util[_0x5368('0x59')]('Trying\x20Amazon\x20Lex:\x20%s',_0x1b6ada[_0x5368('0x62')]));var _0x34a43a=this[_0x5368('0x91')][_0x5368('0x71')](this,_0x1b6ada);if(_0x34a43a){for(var _0x2ca6e2 in _0x34a43a){if(_0x34a43a[_0x5368('0x9b')](_0x2ca6e2)&&_[_0x5368('0xa0')](_0x34a43a[_0x2ca6e2])){this[_0x5368('0xf')][_0x5368('0xa3')](util[_0x5368('0x59')]('AWS_LEX_%s',_0x2ca6e2[_0x5368('0x6c')]()),_0x34a43a[_0x2ca6e2]);}}if(_['isNil'](_0x34a43a[_0x5368('0x7a')])){return this[_0x5368('0xf')]['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x5368('0x44')](_0x34a43a[_0x5368('0x7a')],_0x5368('0xea'),_0x5368('0x128'),'');return this['channel'][_0x5368('0xae')](util['format'](_0x5368('0x129'),_0x34a43a['message']));}}return this['channel'][_0x5368('0x2d')](_0x1b6ada,_0x5368('0x12a'));};AGIVertices[_0x5368('0x12')][_0x5368('0x12b')]=function(_0x1f2692){logger[_0x5368('0x2f')](util['format'](_0x5368('0x12c'),_0x1f2692[_0x5368('0x3a')],_0x1f2692[_0x5368('0x69')]));if(!this[_0x5368('0xab')](_0x1f2692[_0x5368('0x7e')])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xe5'));}var _0x1c9b6c=_0x5368('0x12d');var _0x7c87ab=util[_0x5368('0x59')](_0x5368('0x12e'),FILES_PATH,rs[_0x5368('0x118')](0x4));var _0x45f16=util[_0x5368('0x59')](_0x5368('0xa4'),_0x7c87ab,_0x1c9b6c);var _0x32350=!![];if(_0x1f2692[_0x5368('0x12f')]==='NOBEEP'){_0x32350=![];}var _0xfd4698=this[_0x5368('0xf')][_0x5368('0x130')](_0x7c87ab,_0x1c9b6c,_0x1f2692[_0x5368('0x131')],_0x1f2692[_0x5368('0x69')],undefined,_0x32350);if(_0xfd4698[_0x5368('0xb2')]!==-0x1){this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x132'),_0x45f16));var _0x39cdf9=this[_0x5368('0x95')][_0x5368('0x71')](this,_0x1f2692,_0x45f16);if(_0x39cdf9){for(var _0x55d31f in _0x39cdf9){if(_0x39cdf9[_0x5368('0x9b')](_0x55d31f)){this[_0x5368('0xf')][_0x5368('0xa3')](util[_0x5368('0x59')]('GOOGLE_ASR_%s',_0x55d31f[_0x5368('0x6c')]()),_0x39cdf9[_0x55d31f]);}}return this['channel']['noop'](util[_0x5368('0x59')](_0x5368('0x133'),JSON[_0x5368('0x76')](_0x39cdf9)));}}return _0xfd4698;};AGIVertices['prototype']['tildeasr']=function(_0x1c0b00){logger[_0x5368('0x2f')](util[_0x5368('0x59')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x1c0b00['label']));if(!this[_0x5368('0xab')](_0x1c0b00[_0x5368('0x97')])){return this[_0x5368('0xf')]['noop'](_0x5368('0x134'));}if(!this[_0x5368('0xab')](_0x1c0b00[_0x5368('0x98')])){return this[_0x5368('0xf')]['noop'](_0x5368('0x135'));}var _0x46d905=_0x5368('0x12d');var _0x32581d=util[_0x5368('0x59')](_0x5368('0x12e'),FILES_PATH,rs[_0x5368('0x118')](0x4));var _0x4cca3c=util[_0x5368('0x59')]('%s.%s',_0x32581d,_0x46d905);var _0x172e78=!![];if(_0x1c0b00[_0x5368('0x12f')]===_0x5368('0x136')){_0x172e78=![];}var _0x563927=this['channel'][_0x5368('0x130')](_0x32581d,_0x46d905,_0x1c0b00['intKey'],_0x1c0b00[_0x5368('0x69')],undefined,_0x172e78);if(_0x563927['result']!==-0x1){this[_0x5368('0xf')]['noop'](util['format'](_0x5368('0x137'),_0x4cca3c));var _0x3c3312=this['tildeASR'][_0x5368('0x71')](this,_0x1c0b00,_0x4cca3c);if(_0x3c3312){for(var _0x5c5deb in _0x3c3312){if(_0x3c3312[_0x5368('0x9b')](_0x5c5deb)){this[_0x5368('0xf')][_0x5368('0xa3')](util[_0x5368('0x59')](_0x5368('0x138'),_0x5c5deb[_0x5368('0x6c')]()),_0x3c3312[_0x5c5deb]);}}return this[_0x5368('0xf')][_0x5368('0xae')](util['format']('TildeASR\x20Result\x20%s',JSON[_0x5368('0x76')](_0x3c3312)));}}return _0x563927;};AGIVertices[_0x5368('0x12')][_0x5368('0x139')]=function(_0xfbadd0){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x13a'),_0xfbadd0['label']));return this[_0x5368('0xf')][_0x5368('0x13b')](_0xfbadd0[_0x5368('0x3f')],_0xfbadd0['extension'],_0xfbadd0[_0x5368('0x41')]);};AGIVertices['prototype'][_0x5368('0x13c')]=function(_0x5aff03){logger[_0x5368('0x2f')](util['format'](_0x5368('0x13d'),_0x5aff03[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x5aff03['condition'])){return this['channel']['error'](_0x5aff03,_0x5368('0x13e'));}try{var _0x215a70=eval(_0x5aff03[_0x5368('0x13f')])?'true':'false';this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x140'),_0x5aff03[_0x5368('0x13f')],_0x215a70));return{'code':0xc8,'result':_0x215a70};}catch(_0x1c24dd){return{'code':0xc8,'result':_0x5368('0x141')};}};AGIVertices[_0x5368('0x12')][_0x5368('0x142')]=function(_0x5a7a9c){logger[_0x5368('0x2f')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x5a7a9c[_0x5368('0x3a')]));if(!this['isConfigured'](_0x5a7a9c[_0x5368('0x143')])){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x5a7a9c,_0x5368('0x144'));}var _0x5d49e9=this[_0x5368('0x145')]['sync'](this,_0x5a7a9c[_0x5368('0x143')]);if(!_0x5d49e9){return this['channel'][_0x5368('0x2d')](_0x5a7a9c,'no\x20intervals\x20found');}for(var _0x3abd42=0x0;_0x3abd42<_0x5d49e9[_0x5368('0x9f')];_0x3abd42+=0x1){var _0x1075cf=this[_0x5368('0xf')]['getVariable'](util[_0x5368('0x59')](_0x5368('0x146'),_0x5d49e9[_0x3abd42]));if(_0x1075cf[_0x5368('0xb2')]===-0x1){return _0x1075cf;}logger[_0x5368('0x2f')](util[_0x5368('0x59')]('IFTIME\x20%s\x20%s',_0x5d49e9[_0x3abd42],_0x1075cf['extra']));if(_0x1075cf[_0x5368('0xa8')]==='true'){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x147'),_0x5d49e9[_0x3abd42],_0x5368('0x148')));this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x147'),_0x5d49e9[_0x3abd42],_0x5368('0x148')));return{'code':0xc8,'result':_0x5368('0x148')};}else{logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x147'),_0x5d49e9[_0x3abd42],_0x5368('0x141')));this[_0x5368('0xf')]['noop'](util[_0x5368('0x59')](_0x5368('0x147'),_0x5d49e9[_0x3abd42],'false'));}}return{'code':0xc8,'result':_0x5368('0x141')};};AGIVertices[_0x5368('0x12')][_0x5368('0x149')]=function(_0x521db6){logger[_0x5368('0x2f')](util[_0x5368('0x59')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x521db6['label']));return this[_0x5368('0xf')][_0x5368('0x149')]();};AGIVertices[_0x5368('0x12')][_0x5368('0x14a')]=function(_0x4808a7){logger['info'](util[_0x5368('0x59')](_0x5368('0x14b'),_0x4808a7[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x4808a7[_0x5368('0x7e')])){return this['channel'][_0x5368('0xae')]('no\x20key\x20configured');}var _0x3fb75d='wav';var _0x4f7d0c=util['format'](_0x5368('0x12e'),FILES_PATH,rs[_0x5368('0x118')](0x4));var _0x4d8785=util['format'](_0x5368('0xa4'),_0x4f7d0c,_0x3fb75d);var _0x520d4b=!![];if(_0x4808a7[_0x5368('0x12f')]===_0x5368('0x136')){_0x520d4b=![];}var _0xa1f97b=this[_0x5368('0xf')][_0x5368('0x130')](_0x4f7d0c,_0x3fb75d,_0x4808a7['intKey'],_0x4808a7[_0x5368('0x69')],undefined,_0x520d4b);if(_0xa1f97b[_0x5368('0xb2')]!==-0x1){this[_0x5368('0xf')]['noop'](util[_0x5368('0x59')]('ispeech\x20%s\x20file\x20created',_0x4d8785));var _0x4de0f5=this[_0x5368('0x88')][_0x5368('0x71')](this,_0x4808a7,_0x4d8785);if(_0x4de0f5){for(var _0x234409 in _0x4de0f5){if(_0x4de0f5[_0x5368('0x9b')](_0x234409)){this[_0x5368('0xf')]['setVariable'](util[_0x5368('0x59')](_0x5368('0x14c'),_0x234409[_0x5368('0x6c')]()),_0x4de0f5[_0x234409]);}}return this[_0x5368('0xf')]['noop'](util[_0x5368('0x59')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x4de0f5)));}}return _0xa1f97b;};AGIVertices['prototype'][_0x5368('0x14d')]=function(_0x556266){logger['info'](util['format'](_0x5368('0x14e'),_0x556266[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x556266['key'])){return this[_0x5368('0xf')]['noop'](_0x5368('0xe5'));}if(!this[_0x5368('0xab')](_0x556266[_0x5368('0x62')])){return this['channel'][_0x5368('0xae')](_0x5368('0xac'));}this['channel'][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x14f'),_0x556266[_0x5368('0x62')]));var _0x1a5b5f=this[_0x5368('0x85')][_0x5368('0x71')](this,_0x556266);if(_0x1a5b5f){this[_0x5368('0xf')][_0x5368('0xae')](util['format']('ispeech\x20%s\x20file\x20created',_0x1a5b5f));var _0x49cfa4=this[_0x5368('0xf')][_0x5368('0x125')](_0x1a5b5f,_0x556266['intKey']);try{fs[_0x5368('0xff')](_0x1a5b5f+'.wav');}catch(_0x47d45a){logger[_0x5368('0x2d')](_0x47d45a);}return _0x49cfa4;}return this[_0x5368('0xf')][_0x5368('0x2d')](_0x556266,_0x5368('0x150'));};AGIVertices[_0x5368('0x12')]['login']=function(_0xd2b6bf){logger['info'](util[_0x5368('0x59')](_0x5368('0x151'),_0xd2b6bf[_0x5368('0x3a')]));if(!this['isConfigured'](_0xd2b6bf[_0x5368('0x152')])){return this[_0x5368('0xf')]['error'](_0xd2b6bf,_0x5368('0x153'));}logger['info'](util[_0x5368('0x59')](_0x5368('0x154'),this['channel']['callerid'],_0xd2b6bf['findBy']));var _0x488470=this['agentLogin'][_0x5368('0x71')](this,_0xd2b6bf['findBy']);if(_0x488470){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x155'),this[_0x5368('0xf')][_0x5368('0x3c')],_0xd2b6bf['findBy']));this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x155'),this[_0x5368('0xf')][_0x5368('0x3c')],_0xd2b6bf[_0x5368('0x152')]));return{'code':0xc8,'result':_0x5368('0x156')};}else{logger['info'](util[_0x5368('0x59')](_0x5368('0x157'),this[_0x5368('0xf')][_0x5368('0x3c')],_0xd2b6bf[_0x5368('0x152')]));this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x5368('0x3c')],_0xd2b6bf['findBy']));return{'code':0xc8,'result':_0x5368('0x158')};}};AGIVertices[_0x5368('0x12')]['logout']=function(_0x371452){logger['info'](util[_0x5368('0x59')](_0x5368('0x159'),_0x371452['label']));if(!this[_0x5368('0xab')](_0x371452[_0x5368('0x152')])){return this[_0x5368('0xf')]['error'](_0x371452,_0x5368('0x153'));}logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x154'),this['channel'][_0x5368('0x3c')],_0x371452[_0x5368('0x152')]));var _0x41477b=this[_0x5368('0x56')]['sync'](this,_0x371452[_0x5368('0x152')]);if(_0x41477b){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x155'),this[_0x5368('0xf')]['callerid'],_0x371452[_0x5368('0x152')]));this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x155'),this[_0x5368('0xf')]['callerid'],_0x371452['findBy']));return{'code':0xc8,'result':_0x5368('0x156')};}else{logger['info'](util[_0x5368('0x59')](_0x5368('0x157'),this[_0x5368('0xf')]['callerid'],_0x371452['findBy']));this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x157'),this[_0x5368('0xf')][_0x5368('0x3c')],_0x371452[_0x5368('0x152')]));return{'code':0xc8,'result':_0x5368('0x158')};}};AGIVertices[_0x5368('0x12')][_0x5368('0x15a')]=function(_0x403175){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x15b'),_0x403175[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x403175[_0x5368('0x15c')])){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x403175,_0x5368('0x15d'));}this['channel']['noop'](util['format'](_0x5368('0x15e'),_0x403175[_0x5368('0x15c')]));var _0x19695f=eval(_0x403175[_0x5368('0x15c')]);if(!this['isConfigured'](_0x403175[_0x5368('0xd6')])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xd7'));}var _0x4db42c=this[_0x5368('0x13')]['sync'](this,_0x403175['variable_id']);if(!_0x4db42c){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x403175,_0x5368('0xd8'));}if(_[_0x5368('0x15f')](_0x19695f)){var _0x573e4f=this;_0x19695f[_0x5368('0xda')](function(_0x15e216,_0x2b4e89){_0x573e4f[_0x5368('0xf')][_0x5368('0xa3')](util[_0x5368('0x59')](_0x5368('0x160'),_0x4db42c,_0x2b4e89),_0x15e216);});return this[_0x5368('0xf')]['noop'](util['format'](_0x5368('0x161'),_0x4db42c));}else{return this[_0x5368('0xf')][_0x5368('0xa3')](_0x4db42c,_0x19695f);}};AGIVertices[_0x5368('0x12')][_0x5368('0xd')]=function(_0x3e1661){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x162'),_0x3e1661['label']));if(_0x3e1661[_0x5368('0x10f')]===0x0){return this['maxRetry'](_0x3e1661);}_0x3e1661[_0x5368('0x10f')]-=0x1;if(!this[_0x5368('0xab')](_0x3e1661[_0x5368('0x110')])){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x3e1661,'no\x20file\x20audio\x20selected');}var _0xe04abc=this['getSound'][_0x5368('0x71')](this,_0x3e1661[_0x5368('0x110')]);if(!_0xe04abc){return this['channel'][_0x5368('0x2d')](_0x3e1661,_0x5368('0x111'));}var _0x107153=this['channel'][_0x5368('0x112')](_0xe04abc,_0x3e1661[_0x5368('0x113')],_0x3e1661[_0x5368('0x163')]);var _0x85e78d=_0x107153[_0x5368('0xb2')];if(_0x107153[_0x5368('0xb2')]===-0x1){this[_0x5368('0x38')]['sync'](this,_0x3e1661,'-1');return _0x107153;}else if(_0x107153[_0x5368('0xa8')]===_0x5368('0x69')){_0x107153[_0x5368('0xb2')]=_0x107153['result'][_0x5368('0x9f')]>0x0?_0x107153[_0x5368('0xb2')]:'t';}else if(_[_0x5368('0x46')](_0x107153[_0x5368('0xb2')])){_0x107153[_0x5368('0xb2')]='#';_0x85e78d='#';}if(!this[_0x5368('0xab')](_0x3e1661[_0x5368('0xd6')])){this['channel'][_0x5368('0xae')](_0x5368('0xd7'));}else{var _0x95f32f=this['getVariable'][_0x5368('0x71')](this,_0x3e1661[_0x5368('0xd6')]);if(!_0x95f32f){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x3e1661,_0x5368('0xd8'));}this[_0x5368('0xf')][_0x5368('0xa3')](_0x95f32f,_0x85e78d);}this[_0x5368('0x38')][_0x5368('0x71')](this,_0x3e1661,_0x85e78d);return _0x107153;};AGIVertices[_0x5368('0x12')]['noop']=function(_0x4acf05){logger['info'](util[_0x5368('0x59')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x4acf05[_0x5368('0x3a')]));return this[_0x5368('0xf')][_0x5368('0xae')](_0x4acf05[_0x5368('0x164')]||_0x4acf05[_0x5368('0x3a')]);};AGIVertices[_0x5368('0x12')]['pause']=function(_0x23ff7e){logger['info'](util[_0x5368('0x59')](_0x5368('0x165'),_0x23ff7e[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x23ff7e[_0x5368('0x152')])){return this[_0x5368('0xf')]['error'](_0x23ff7e,_0x5368('0x153'));}logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x154'),this['channel']['callerid'],_0x23ff7e[_0x5368('0x152')]));var _0x33a274=this[_0x5368('0x51')][_0x5368('0x71')](this,_0x23ff7e[_0x5368('0x166')]);var _0xf09bcf=this['agentPause'][_0x5368('0x71')](this,_0x23ff7e[_0x5368('0x152')],_0x33a274);if(_0xf09bcf){logger['info'](util[_0x5368('0x59')](_0x5368('0x155'),this['channel']['callerid'],_0x23ff7e[_0x5368('0x152')]));this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0x155'),this['channel'][_0x5368('0x3c')],_0x23ff7e[_0x5368('0x152')]));return{'code':0xc8,'result':_0x5368('0x156')};}else{logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x157'),this[_0x5368('0xf')][_0x5368('0x3c')],_0x23ff7e['findBy']));this[_0x5368('0xf')]['noop'](util[_0x5368('0x59')](_0x5368('0x155'),this['channel'][_0x5368('0x3c')],_0x23ff7e['findBy']));return{'code':0xc8,'result':_0x5368('0x158')};}};AGIVertices[_0x5368('0x12')][_0x5368('0x167')]=function(_0x3b0bb5){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x168'),_0x3b0bb5['label']));if(!this['isConfigured'](_0x3b0bb5[_0x5368('0x110')])){return this['channel'][_0x5368('0x2d')](_0x3b0bb5,'no\x20file\x20audio\x20selected');}var _0x3a0735=this['getSound'][_0x5368('0x71')](this,_0x3b0bb5['file_id']);if(!_0x3a0735){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x3b0bb5,'no\x20file\x20audio\x20found');}var _0x47b350=this[_0x5368('0xf')][_0x5368('0x5d')]('PLAYBACK',[_0x3a0735,_0x3b0bb5['opts']]);if(_0x47b350['result']===-0x1){return _0x47b350;}return this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0xc5'),_0x5368('0x169'),_0x3a0735));};AGIVertices[_0x5368('0x12')][_0x5368('0x16a')]=function(_0x49710c){logger[_0x5368('0x2f')](util['format'](_0x5368('0x16b'),_0x49710c[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x49710c[_0x5368('0x16c')])){return this[_0x5368('0xf')]['error'](_0x49710c,_0x5368('0x16d'));}var _0x554ece='';var _0x18e065=parseInt(_0x49710c[_0x5368('0x16c')],0xa);if(isNaN(_0x18e065)){_0x554ece=_0x49710c[_0x5368('0x16c')];}else{_0x554ece=this[_0x5368('0x16')][_0x5368('0x71')](this,_0x49710c[_0x5368('0x16c')]);if(!_0x554ece){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x49710c,_0x5368('0x16e'));}}var _0x12f783='';if(this[_0x5368('0xab')](_0x49710c[_0x5368('0x110')])){var _0x1f59a5=this['getSound'][_0x5368('0x71')](this,_0x49710c[_0x5368('0x110')]);if(_0x1f59a5){_0x12f783=_0x1f59a5;}}this[_0x5368('0x38')][_0x5368('0x71')](this,_0x49710c,_0x554ece);if(_0x49710c[_0x5368('0x10b')][_0x5368('0x16f')]('x')<0x0){_0x49710c[_0x5368('0x10b')]+='x';}if(_0x49710c[_0x5368('0x10b')][_0x5368('0x16f')]('X')<0x0){_0x49710c['opts']+='X';}this[_0x5368('0xf')][_0x5368('0xa3')](_0x5368('0x170'),_0x554ece?_0x554ece[_0x5368('0x171')]():'');var _0x354dcf=this[_0x5368('0xf')][_0x5368('0x5d')](_0x5368('0x172'),[_0x554ece,_0x49710c[_0x5368('0x10b')],_0x49710c[_0x5368('0x68')],_0x12f783,_0x49710c[_0x5368('0x69')],_0x49710c['agi'],_0x49710c[_0x5368('0x173')],_0x49710c[_0x5368('0x174')],'',_0x49710c[_0x5368('0x175')]]);if(_0x354dcf[_0x5368('0xb2')]===-0x1){return _0x354dcf;}return this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')]('Executed\x20command\x20%s\x20%s',_0x5368('0x172'),_0x554ece));};AGIVertices[_0x5368('0x12')]['record']=function(_0x2bd076){logger[_0x5368('0x2f')](util['format'](_0x5368('0x176'),_0x2bd076['label']));var _0x4ec64a=_0x2bd076[_0x5368('0x177')]||_0x5368('0x12d');var _0x451c98=util[_0x5368('0x59')]('%s_%s',this[_0x5368('0xf')][_0x5368('0x39')],rs[_0x5368('0x118')](0x5));var _0x330dec=util[_0x5368('0x59')](_0x5368('0x178'),FILES_PATH,_0x451c98,_0x4ec64a);var _0x5a506d=util['format'](_0x5368('0x12e'),FILES_PATH,_0x451c98);this[_0x5368('0x3d')][_0x5368('0x71')](this,_0x2bd076,_0x451c98,_0x330dec);this['channel']['setVariable'](_0x5368('0x179'),_0x451c98);logger[_0x5368('0x2f')](_0x5368('0x17a'),_0x5a506d,_0x4ec64a,_0x2bd076[_0x5368('0x17b')],_0x2bd076[_0x5368('0x69')]);return this['channel'][_0x5368('0x130')](_0x5a506d,_0x4ec64a,_0x2bd076['escape_digits'],_0x2bd076[_0x5368('0x69')],undefined,!![]);};AGIVertices['prototype'][_0x5368('0x17c')]=function(_0x4eeb36){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x17d'),_0x4eeb36[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x4eeb36['url'])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0x17e'));}var _0xd8540a=this['restAPI'][_0x5368('0x71')](this,_0x4eeb36);logger['info'](util[_0x5368('0x59')](_0x5368('0x17f'),util[_0x5368('0x180')](_0xd8540a,{'showHidden':![],'depth':null})));if(!this[_0x5368('0xab')](_0x4eeb36[_0x5368('0xd6')])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0x181'));}var _0x1db020=this[_0x5368('0x13')]['sync'](this,_0x4eeb36[_0x5368('0xd6')]);if(!_0x1db020){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x4eeb36,'no\x20variable\x20found');}this[_0x5368('0xf')][_0x5368('0xa3')](util[_0x5368('0x59')](_0x5368('0x182'),_0x1db020),_0xd8540a[_0x5368('0x78')]?_0xd8540a[_0x5368('0x78')]:'200');this['channel']['setVariable'](util[_0x5368('0x59')]('%s_STATUS_MESSAGE',_0x1db020),_0xd8540a[_0x5368('0x79')]?_0xd8540a[_0x5368('0x79')]:'OK');if(_0xd8540a[_0x5368('0x6d')]){try{this[_0x5368('0xa2')](_0xd8540a[_0x5368('0x6d')],_0x1db020);}catch(_0x3d7689){logger[_0x5368('0x2d')](util['format'](_0x5368('0x183'),_0x1db020));}}return this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0x184'),_0x1db020));};AGIVertices[_0x5368('0x12')][_0x5368('0x185')]=function(_0x4030d4){logger[_0x5368('0x2f')](util[_0x5368('0x59')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x4030d4['label']));return this[_0x5368('0xf')][_0x5368('0x186')](_0x4030d4[_0x5368('0x187')]['replace'](/\s+/g,''),_0x4030d4[_0x5368('0x17b')]);};AGIVertices['prototype']['saynumber']=function(_0xfbf8df){logger[_0x5368('0x2f')](util['format'](_0x5368('0x188'),_0xfbf8df['label']));return this[_0x5368('0xf')]['sayNumber'](_0xfbf8df[_0x5368('0x189')][_0x5368('0x5f')](/\s+/g,''),_0xfbf8df[_0x5368('0x17b')]);};AGIVertices[_0x5368('0x12')][_0x5368('0x18a')]=function(_0x214200){logger[_0x5368('0x2f')](util['format'](_0x5368('0x18b'),_0x214200[_0x5368('0x3a')]));return this[_0x5368('0xf')]['sayPhonetic'](_0x214200[_0x5368('0x62')],_0x214200[_0x5368('0x17b')]);};AGIVertices['prototype'][_0x5368('0x18c')]=function(_0x2761f4){logger['info'](util['format'](_0x5368('0x18d'),_0x2761f4[_0x5368('0x3a')]));if(!this['isConfigured'](_0x2761f4[_0x5368('0x18e')])){return this['channel'][_0x5368('0xae')](_0x5368('0x18f'));}var _0x1d44c4=this['getMailAccount'][_0x5368('0x71')](this,_0x2761f4[_0x5368('0x18e')]);if(!_0x1d44c4||!_0x1d44c4['Smtp']){return this[_0x5368('0xf')]['error'](_0x2761f4,'no\x20mail\x20account\x20found');}var _0x11be20={'from':util[_0x5368('0x59')](_0x5368('0x190'),_0x1d44c4['name'],_0x1d44c4[_0x5368('0x191')]||_0x1d44c4[_0x5368('0x192')][_0x5368('0x193')]),'to':_0x2761f4['to']||'','cc':_0x2761f4['cc']||'','bcc':_0x2761f4[_0x5368('0x194')]||'','subject':_0x2761f4['subject'],'html':_0x2761f4[_0x5368('0x62')],'text':_0x2761f4[_0x5368('0x62')]};if(this[_0x5368('0xab')](_0x2761f4[_0x5368('0x195')])){}logger[_0x5368('0xde')](_0x5368('0x196'),JSON[_0x5368('0x76')](_0x11be20));this[_0x5368('0x38')][_0x5368('0x71')](this,_0x2761f4,_0x2761f4[_0x5368('0x18e')]);this['channel'][_0x5368('0xae')](util[_0x5368('0x59')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x1d44c4[_0x5368('0x15')]));this[_0x5368('0x27')][_0x5368('0x71')](this,_0x1d44c4['smtpOptions'],_0x11be20);return this['channel'][_0x5368('0xae')](_0x5368('0x197'));};AGIVertices[_0x5368('0x12')]['sendFax']=function(_0x58fba2){logger[_0x5368('0x2f')](util[_0x5368('0x59')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x58fba2[_0x5368('0x3a')]));return this['channel'][_0x5368('0xae')](_0x5368('0x198'));};AGIVertices[_0x5368('0x12')][_0x5368('0x199')]=function(_0xd6b618){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x19a'),_0xd6b618['label']));if(!this[_0x5368('0xab')](_0xd6b618['sms_account_id'])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0x19b'));}var _0x17c060=this[_0x5368('0x35')][_0x5368('0x71')](this,_0xd6b618['sms_account_id']);if(!_0x17c060){return this[_0x5368('0xf')][_0x5368('0x2d')](_0xd6b618,_0x5368('0x19c'));}var _0x48a79c={'body':_0xd6b618[_0x5368('0x19d')],'phone':_0xd6b618['to']||'','SmsAccountId':_0x17c060['id']};logger[_0x5368('0xde')](_0x5368('0x19e'),JSON['stringify'](_0x48a79c));this['createSquareDetailsReport']['sync'](this,_0xd6b618,_0xd6b618['sms_account_id']);this['channel'][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x19f'),_0x17c060['name']));this[_0x5368('0x37')]['sync'](this,_0x48a79c);return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0x1a0'));};AGIVertices['prototype']['set']=function(_0x500769){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x1a1'),_0x500769[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x500769[_0x5368('0xd6')])){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x500769,_0x5368('0x1a2'));}var _0x48d159=this[_0x5368('0x13')][_0x5368('0x71')](this,_0x500769[_0x5368('0xd6')]);if(!_0x48d159){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x500769,_0x5368('0xd8'));}return this['channel']['setVariable'](_0x48d159,_0x500769[_0x5368('0x1a3')]);};AGIVertices['prototype']['start']=function(_0x55ebc4){logger[_0x5368('0x2f')](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x55ebc4[_0x5368('0x3a')]));this[_0x5368('0xf')][_0x5368('0xae')]('START\x20CALLY\x20SQUARE');var _0x34a155=this[_0x5368('0xf')][_0x5368('0x13')](_0x5368('0x1a4'));if(!_[_0x5368('0x46')](_0x34a155['extra'])){this[_0x5368('0xf')]['uniqueid']=_0x34a155[_0x5368('0xa8')];}if(_0x55ebc4[_0x5368('0xbb')]===_0x5368('0x1a5')){this['channel']['noop'](_0x5368('0x1a6'));return this[_0x5368('0xf')][_0x5368('0xbb')]();}return this[_0x5368('0xf')]['noop'](_0x5368('0x1a7'));};AGIVertices['prototype'][_0x5368('0x1a8')]=function(_0x56fb0d){logger[_0x5368('0x2f')](util['format']('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x56fb0d[_0x5368('0x3a')]));if(!this['isConfigured'](_0x56fb0d['project_id'])){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x56fb0d,'no\x20subproject\x20selected');}var _0xa07511=this[_0x5368('0x1a')][_0x5368('0x71')](this,_0x56fb0d['project_id']);if(!this[_0x5368('0xab')](_0xa07511)){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x56fb0d,util[_0x5368('0x59')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x56fb0d[_0x5368('0x1a9')]));}if(_0xa07511===this[_0x5368('0xf')][_0x5368('0x3b')]){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x56fb0d,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport'][_0x5368('0x71')](this,_0x56fb0d,_0xa07511);var _0x13230e=this[_0x5368('0xf')][_0x5368('0x5d')](_0x5368('0x1aa'),util[_0x5368('0x59')](_0x5368('0x1ab'),config[_0x5368('0x8')][_0x5368('0x1ac')]||'127.0.0.1',_0xa07511,this['channel'][_0x5368('0x3b')]));if(_0x13230e['result']===-0x1){return _0x13230e;}return this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0xc5'),_0x5368('0x1aa'),_0xa07511));};AGIVertices[_0x5368('0x12')][_0x5368('0x1ad')]=function(_0x1ec487){logger[_0x5368('0x2f')](util['format'](_0x5368('0x1ae'),_0x1ec487[_0x5368('0x3a')]));var _0x173525=this[_0x5368('0x5c')]['sync'](this,_0x1ec487['command']);this['createSquareDetailsReport'][_0x5368('0x71')](this,_0x1ec487,_0x1ec487[_0x5368('0xb9')]);if(this[_0x5368('0xab')](_0x1ec487[_0x5368('0xd6')])){var _0x2eb8ff=this[_0x5368('0x13')][_0x5368('0x71')](this,_0x1ec487[_0x5368('0xd6')]);if(_0x2eb8ff){this[_0x5368('0xf')][_0x5368('0xa3')](_0x2eb8ff,_0x173525);return this[_0x5368('0xf')]['noop'](util[_0x5368('0x59')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x1ec487['command'],_0x2eb8ff));}}return this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x1af'),_0x1ec487['command']));};AGIVertices[_0x5368('0x12')][_0x5368('0x1b0')]=function(_0x2869bb){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x1b1'),_0x2869bb[_0x5368('0x3a')]));_0x2869bb[_0x5368('0x62')]=_0x2869bb[_0x5368('0x62')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x5368('0xab')](_0x2869bb[_0x5368('0x1b2')])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0x1b3'));}if(!this[_0x5368('0xab')](_0x2869bb[_0x5368('0x62')])){return this[_0x5368('0xf')]['noop']('no\x20text\x20configured');}this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x1b4'),_0x2869bb[_0x5368('0x62')]));var _0x4b17fb=this[_0x5368('0x60')]['sync'](this,_0x2869bb);if(_0x4b17fb){this['channel']['noop'](util[_0x5368('0x59')](_0x5368('0x1b5'),_0x4b17fb));var _0x536990=this[_0x5368('0xf')]['streamFile'](_0x4b17fb);try{fs[_0x5368('0xff')](_0x4b17fb+'.wav');}catch(_0x2f0916){logger['error'](_0x2f0916);}return _0x536990;}return this['channel'][_0x5368('0x2d')](_0x2869bb,_0x5368('0x1b6'));};AGIVertices[_0x5368('0x12')]['tts']=function(_0x4ba0c7){logger['info'](util[_0x5368('0x59')](_0x5368('0x1b7'),_0x4ba0c7[_0x5368('0x3a')]));_0x4ba0c7['text']=_0x4ba0c7[_0x5368('0x62')][_0x5368('0x5f')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x5368('0xab')](_0x4ba0c7[_0x5368('0x62')])){return this[_0x5368('0xf')][_0x5368('0xae')]('no\x20text\x20configured');}this['channel'][_0x5368('0xae')](util['format'](_0x5368('0x1b8'),_0x4ba0c7[_0x5368('0x62')]));var _0x3c90d6=this[_0x5368('0x66')][_0x5368('0x71')](this,_0x4ba0c7);if(_0x3c90d6){this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0x1b9'),_0x3c90d6));var _0x507dda=this[_0x5368('0xf')][_0x5368('0x125')](_0x3c90d6);try{fs[_0x5368('0xff')](_0x3c90d6+_0x5368('0x100'));}catch(_0x2ee236){logger[_0x5368('0x2d')](_0x2ee236);}return _0x507dda;}return this[_0x5368('0xf')][_0x5368('0x2d')](_0x4ba0c7,_0x5368('0x1ba'));};AGIVertices['prototype'][_0x5368('0x1bb')]=function(_0x5ef8a0){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x1bc'),_0x5ef8a0['label']));if(!this[_0x5368('0xab')](_0x5ef8a0['findBy'])){return this['channel'][_0x5368('0x2d')](_0x5ef8a0,_0x5368('0x153'));}logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x154'),this[_0x5368('0xf')][_0x5368('0x3c')],_0x5ef8a0['findBy']));var _0x5c37c1=this[_0x5368('0x55')]['sync'](this,_0x5ef8a0[_0x5368('0x152')]);if(_0x5c37c1){logger[_0x5368('0x2f')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x5368('0xf')][_0x5368('0x3c')],_0x5ef8a0[_0x5368('0x152')]));this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x155'),this[_0x5368('0xf')][_0x5368('0x3c')],_0x5ef8a0[_0x5368('0x152')]));return{'code':0xc8,'result':_0x5368('0x156')};}else{logger['info'](util[_0x5368('0x59')](_0x5368('0x157'),this[_0x5368('0xf')]['callerid'],_0x5ef8a0[_0x5368('0x152')]));this['channel'][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x157'),this[_0x5368('0xf')][_0x5368('0x3c')],_0x5ef8a0[_0x5368('0x152')]));return{'code':0xc8,'result':_0x5368('0x158')};}};AGIVertices[_0x5368('0x12')][_0x5368('0x1bd')]=function(_0x2fabbc){logger[_0x5368('0x2f')](util['format']('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x2fabbc[_0x5368('0x3a')]));var _0x219e77=this['channel'][_0x5368('0x5d')]('VOICEMAIL',[_0x2fabbc[_0x5368('0x1be')],_0x2fabbc[_0x5368('0x7c')]]);if(_0x219e77[_0x5368('0xb2')]===-0x1){return _0x219e77;}return this[_0x5368('0xf')]['noop'](util[_0x5368('0x59')](_0x5368('0xc5'),'VOICEMAIL',_0x2fabbc['mailbox']));};AGIVertices[_0x5368('0x12')][_0x5368('0x1bf')]=function(_0x4b0729){logger[_0x5368('0x2f')](util['format'](_0x5368('0x1c0'),_0x4b0729['label']));if(!this[_0x5368('0xab')](_0x4b0729['variable_id'])){return this['channel'][_0x5368('0x2d')](_0x4b0729,_0x5368('0x1a2'));}var _0x433413=this[_0x5368('0x13')][_0x5368('0x71')](this,_0x4b0729[_0x5368('0xd6')]);if(!_0x433413){return this['channel'][_0x5368('0x2d')](_0x4b0729,_0x5368('0xd8'));}var _0x708d77=this['channel']['getVariable'](_0x433413);return{'code':0xc8,'result':_0x708d77[_0x5368('0xa8')]?_0x708d77[_0x5368('0xa8')]:'-'};};String[_0x5368('0x12')][_0x5368('0xa6')]=function(_0x17e661,_0x396e88){return this[_0x5368('0xa5')](_0x17e661)[_0x5368('0x1c1')](_0x396e88);};module[_0x5368('0x1c2')]=AGIVertices; \ No newline at end of file +var _0x72b1=['audioEncoding','google_tts_language','restAPI','url','method','timeout','number','POST','PUT','toUpperCase','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','body','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','en-US','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','appid','appsecret','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','toString','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','result','Executed\x20command\x20MRCPSynth\x20%s','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_INPUT()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','no\x20database\x20selected','getSquareOdbc','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','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','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','mindigit','no\x20variable\x20found','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','beep','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','continueAt','context','condition','no\x20condition\x20configured','true','false','gotoiftime','no\x20interval\x20configured','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','AGENT\x20%s\x20NOT\x20FOUND\x20BY','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','success','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','recordFile','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','\x22%s\x22\x20<%s>','email','bcc','subject','template_id','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','sms_account_id','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','googleTTS','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','vswitch','join','exports','util','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getsecretdigits','channel','rpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getSquareProject','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervals','IntervalId','map','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccountById','createSmsMessage','createSquareDetailsReport','agicommand','callerid','createSquareRecording','uniqueid','calleridname','extension','priority','accountcode','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','phone','list_id','scheduledAt','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','MALE'];(function(_0x5bf2b3,_0xfcd364){var _0x5e8a9b=function(_0x43546b){while(--_0x43546b){_0x5bf2b3['push'](_0x5bf2b3['shift']());}};_0x5e8a9b(++_0xfcd364);}(_0x72b1,0x16e));var _0x172b=function(_0x35b614,_0x1bf17f){_0x35b614=_0x35b614-0x0;var _0x3ff461=_0x72b1[_0x35b614];return _0x3ff461;};'use strict';var fs=require('fs');var util=require(_0x172b('0x0'));var _=require('lodash');var sh=require(_0x172b('0x1'));var odbc=require(_0x172b('0x2'))();var rs=require(_0x172b('0x3'));var moment=require(_0x172b('0x4'));var Mustache=require(_0x172b('0x5'));var rp=require(_0x172b('0x6'));var logger=require(_0x172b('0x7'))('agi');var config=require(_0x172b('0x8'));var scripts=require(_0x172b('0x9'));var FILES_PATH=_0x172b('0xa');var recursiveMapAttributes=[_0x172b('0xb'),'rawBody'];var verticesWithRetry=[_0x172b('0xc'),'getdigits',_0x172b('0xd')];var AGIVertices=function(_0x531b10,_0x6680e0,_0x2238f1){this[_0x172b('0xe')]=_0x531b10;this[_0x172b('0xf')]=_0x6680e0;this['mailRpc']=_0x2238f1;};AGIVertices[_0x172b('0x10')][_0x172b('0x11')]=function(_0x28aaad,_0x161c7c){this[_0x172b('0xf')][_0x172b('0x12')](_0x28aaad)[_0x172b('0x13')](function(_0x5a171f){_0x161c7c(null,_0x5a171f?_0x5a171f[_0x172b('0x14')]:![]);})[_0x172b('0x15')](function(_0xdf832e){_0x161c7c(_0xdf832e);});};AGIVertices['prototype'][_0x172b('0x16')]=function(_0x4a98e2,_0x2611c2){this[_0x172b('0xf')]['getVoiceQueueById'](_0x4a98e2)[_0x172b('0x13')](function(_0x3452f2){_0x2611c2(null,_0x3452f2?_0x3452f2[_0x172b('0x14')]:![]);})[_0x172b('0x15')](function(_0x5b0ab1){_0x2611c2(_0x5b0ab1);});};AGIVertices['prototype'][_0x172b('0x17')]=function(_0x34be39,_0x36af74){this[_0x172b('0xf')]['getSquareProjectById'](_0x34be39)['then'](function(_0x10c80b){_0x36af74(null,_0x10c80b?_0x10c80b[_0x172b('0x14')]:![]);})[_0x172b('0x15')](function(_0xba7825){_0x36af74(_0xba7825);});};AGIVertices[_0x172b('0x10')]['getSquareOdbc']=function(_0x304b96,_0x2d24f9){this[_0x172b('0xf')][_0x172b('0x18')](_0x304b96)[_0x172b('0x13')](function(_0x266b13){_0x2d24f9(null,_0x266b13?_0x266b13[_0x172b('0x19')]:![]);})['catch'](function(_0x4edaad){_0x2d24f9(_0x4edaad);});};AGIVertices['prototype']['getUser']=function(_0x13cfc7,_0x4c8090){this[_0x172b('0xf')][_0x172b('0x1a')](_0x13cfc7)[_0x172b('0x13')](function(_0x256fb5){_0x4c8090(null,_0x256fb5?_0x256fb5[_0x172b('0x14')]:![]);})[_0x172b('0x15')](function(_0x507b99){_0x4c8090(_0x507b99);});};AGIVertices[_0x172b('0x10')][_0x172b('0x1b')]=function(_0x5ea2b2,_0x3858fc){this[_0x172b('0xf')][_0x172b('0x1c')](_0x5ea2b2)[_0x172b('0x13')](function(_0x356c83){_0x3858fc(null,_0x356c83?_0x356c83[_0x172b('0x14')]:![]);})[_0x172b('0x15')](function(_0x5ee442){_0x3858fc(_0x5ee442);});};AGIVertices[_0x172b('0x10')][_0x172b('0x1d')]=function(_0x5c8603,_0x4263a1){var _0x320253=this;this[_0x172b('0xf')][_0x172b('0x1e')](_0x5c8603)[_0x172b('0x13')](function(_0x4bea8e){_0x4263a1(null,_0x4bea8e?_0x320253[_0x172b('0x1f')](_0x4bea8e[_0x172b('0x20')]):![]);})['catch'](function(_0x5db251){_0x4263a1(_0x5db251);});};AGIVertices[_0x172b('0x10')][_0x172b('0x21')]=function(_0x1a80d6,_0x17bce6){this[_0x172b('0xf')][_0x172b('0x22')](_0x1a80d6)[_0x172b('0x13')](function(_0xd4a668){_0x17bce6(null,_0xd4a668?_0xd4a668:![]);})[_0x172b('0x15')](function(_0x239161){_0x17bce6(_0x239161);});};AGIVertices[_0x172b('0x10')][_0x172b('0x23')]=function(_0x289962,_0x30abd3,_0x32e35b){this[_0x172b('0x24')][_0x172b('0x23')](_0x289962,_0x30abd3)[_0x172b('0x13')](function(){_0x32e35b(null);})[_0x172b('0x15')](function(_0x2cd3fd){_0x32e35b(_0x2cd3fd);});};AGIVertices[_0x172b('0x10')][_0x172b('0x25')]=function(_0x1a6707,_0x20f962){this[_0x172b('0xf')]['getIntervalById'](_0x1a6707)[_0x172b('0x13')](function(_0x27e493){if(_0x27e493){if(_0x27e493[_0x172b('0x26')]){_0x20f962(null,[_0x27e493['interval']]);}else{_0x20f962(null,_[_0x172b('0x27')](_0x27e493['Intervals'],'interval'));}}else{_0x20f962(null,![]);}})['catch'](function(_0x1009ae){_0x20f962(_0x1009ae);});};AGIVertices['prototype']['getSoundPath']=function(_0x38e5cb){return util[_0x172b('0x28')](_0x172b('0x29'),FILES_PATH,_0x38e5cb);};AGIVertices['prototype'][_0x172b('0x2a')]=function(_0x1f5516,_0x3ff036,_0x3c0e6a){odbc[_0x172b('0x2b')](_0x1f5516,function(_0x3043ec){if(_0x3043ec){logger[_0x172b('0x2c')](_0x172b('0x2d'),_0x3043ec);_0x3c0e6a(_0x3043ec);}else{logger[_0x172b('0x2e')](_0x172b('0x2f'));odbc[_0x172b('0x30')](_0x3ff036,function(_0x27c5d8,_0x2e45fe){if(_0x27c5d8){logger[_0x172b('0x2e')](_0x172b('0x31'),_0x3ff036);_0x3c0e6a(_0x27c5d8);}else{logger[_0x172b('0x2e')](_0x172b('0x32'),_0x3ff036);odbc[_0x172b('0x33')](function(_0x47821e){if(_0x47821e){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x47821e);}_0x3c0e6a(null,_0x2e45fe);});}});}});};AGIVertices[_0x172b('0x10')]['getSmsAccount']=function(_0x5e8ff6,_0x5321e0){this[_0x172b('0xf')][_0x172b('0x34')](_0x5e8ff6)[_0x172b('0x13')](function(_0x54e62d){_0x5321e0(null,_0x54e62d?_0x54e62d:![]);})[_0x172b('0x15')](function(_0x46d868){_0x5321e0(_0x46d868);});};AGIVertices[_0x172b('0x10')]['createSmsMessage']=function(_0x3cff36,_0x5b2454){this[_0x172b('0xf')][_0x172b('0x35')](_0x3cff36)[_0x172b('0x13')](function(_0xc45ecd){_0x5b2454(null,_0xc45ecd);})[_0x172b('0x15')](function(_0x224c4e){_0x5b2454(_0x224c4e);});};AGIVertices[_0x172b('0x10')]['createSquareDetailsReport']=function(_0x177250,_0x5e036e,_0x370045){this[_0x172b('0xf')][_0x172b('0x36')]({'uniqueid':this[_0x172b('0xe')]['uniqueid'],'node':_0x177250['label'],'application':_0x177250[_0x172b('0x37')],'data':_0x5e036e||null,'project_name':this['channel']['arg_1'],'callerid':this['channel'][_0x172b('0x38')]})[_0x172b('0x13')](function(_0x340bce){if(_0x370045){_0x370045(null,_0x340bce);}})[_0x172b('0x15')](function(_0x4a3e63){if(_0x370045){_0x370045(_0x4a3e63);}});};AGIVertices[_0x172b('0x10')][_0x172b('0x39')]=function(_0x271fc2,_0x17793c,_0x4459d2,_0x464b4d){this[_0x172b('0xf')][_0x172b('0x39')]({'uniqueid':this[_0x172b('0xe')][_0x172b('0x3a')],'callerid':this[_0x172b('0xe')][_0x172b('0x38')],'calleridname':this['channel'][_0x172b('0x3b')],'context':this[_0x172b('0xe')]['context'],'extension':this['channel'][_0x172b('0x3c')],'priority':this[_0x172b('0xe')][_0x172b('0x3d')],'accountcode':this['channel'][_0x172b('0x3e')],'dnid':this['channel']['dnid'],'projectName':this[_0x172b('0xe')][_0x172b('0x3f')],'saveName':_0x17793c,'filename':_0x271fc2[_0x172b('0x40')]||_0x17793c,'savePath':_0x4459d2})[_0x172b('0x13')](function(_0x24ab0c){_0x464b4d(null,_0x24ab0c);})[_0x172b('0x15')](function(_0x3131eb){_0x464b4d(_0x3131eb);});};AGIVertices[_0x172b('0x10')][_0x172b('0x41')]=function(_0x2aeb62,_0x495cca,_0x4c7470,_0x382075,_0x29ee62){this['rpc']['createSquareMessage']({'uniqueid':this[_0x172b('0xe')][_0x172b('0x3a')],'body':_0x2aeb62,'direction':_0x495cca,'providerName':_0x4c7470,'providerResponse':_0x382075})[_0x172b('0x13')](function(_0xe6e09c){if(_0x29ee62){_0x29ee62(null,_0xe6e09c);}})[_0x172b('0x15')](function(_0x1e1793){if(_0x29ee62){_0x29ee62(_0x1e1793);}});};AGIVertices['prototype'][_0x172b('0x42')]=function(_0x5f29d4,_0x5f22eb){this[_0x172b('0xf')][_0x172b('0x42')]({'firstName':_[_0x172b('0x43')](_0x5f29d4['name'])||_[_0x172b('0x44')](_0x5f29d4[_0x172b('0x14')])?_0x172b('0x45')+Math['random']():_0x5f29d4['name'],'lastName':_[_0x172b('0x43')](_0x5f29d4[_0x172b('0x46')])||_[_0x172b('0x44')](_0x5f29d4[_0x172b('0x46')])?null:_0x5f29d4[_0x172b('0x46')],'phone':_0x5f29d4[_0x172b('0x47')],'ListId':_0x5f29d4[_0x172b('0x48')],'scheduledat':_0x5f29d4[_0x172b('0x49')],'callbackUniqueid':this['channel'][_0x172b('0x3a')],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x5f29d4[_0x172b('0x49')]['toString'](),'priority':_0x5f29d4[_0x172b('0x4a')]})[_0x172b('0x13')](function(_0xea96a6){_0x5f22eb(null,_0xea96a6);})['catch'](function(_0x2cc8c7){_0x5f22eb(_0x2cc8c7);});};AGIVertices['prototype'][_0x172b('0x4b')]=function(_0x4456b3,_0x567de5){this[_0x172b('0xf')]['getPauseById'](_0x4456b3)[_0x172b('0x13')](function(_0x436ad1){_0x567de5(null,_0x436ad1?_0x436ad1[_0x172b('0x14')]:![]);})[_0x172b('0x15')](function(_0x1831b7){_0x567de5(_0x1831b7);});};AGIVertices['prototype'][_0x172b('0x4c')]=function(_0x151b3b,_0x117afb,_0x23a430){var _0x535c3f={'role':_0x172b('0x4d')};_0x535c3f[_0x151b3b]=this['channel'][_0x172b('0x38')];this[_0x172b('0xf')][_0x172b('0x4c')](_0x535c3f,_0x117afb,this[_0x172b('0xe')][_0x172b('0x3a')])[_0x172b('0x13')](function(_0x595f84){_0x23a430(null,_[_0x172b('0x44')](_0x595f84)?![]:!![]);})[_0x172b('0x15')](function(_0x428b13){logger['error'](_0x428b13);_0x23a430(null,![]);});};AGIVertices[_0x172b('0x10')]['agentUnpause']=function(_0x4eff2b,_0xe975c){var _0x216b6e={'role':_0x172b('0x4d')};_0x216b6e[_0x4eff2b]=this[_0x172b('0xe')][_0x172b('0x38')];this[_0x172b('0xf')][_0x172b('0x4e')](_0x216b6e)[_0x172b('0x13')](function(_0x192cac){_0xe975c(null,_[_0x172b('0x44')](_0x192cac)?![]:!![]);})['catch'](function(_0x3aa5d5){logger[_0x172b('0x2c')](_0x3aa5d5);_0xe975c(null,![]);});};AGIVertices[_0x172b('0x10')][_0x172b('0x4f')]=function(_0x1f1f3c,_0xb4cf50){var _0x32d480={'role':_0x172b('0x4d')};_0x32d480[_0x1f1f3c]=this[_0x172b('0xe')][_0x172b('0x38')];this[_0x172b('0xf')]['agentLogout'](_0x32d480)[_0x172b('0x13')](function(_0x248b32){_0xb4cf50(null,_[_0x172b('0x44')](_0x248b32)?![]:!![]);})[_0x172b('0x15')](function(_0x28f620){logger[_0x172b('0x2c')](_0x28f620);_0xb4cf50(null,![]);});};AGIVertices['prototype'][_0x172b('0x50')]=function(_0x27d20f,_0x3999dc){var _0x114317={'role':_0x172b('0x4d')};_0x114317[_0x27d20f]=this[_0x172b('0xe')][_0x172b('0x38')];var _0x5728d3=_0x27d20f!='internal'?util[_0x172b('0x28')](_0x172b('0x51'),_0x172b('0x52'),this[_0x172b('0xe')][_0x172b('0x38')]):undefined;this['rpc'][_0x172b('0x50')](_0x114317,_0x5728d3)[_0x172b('0x13')](function(_0x493d1d){_0x3999dc(null,_[_0x172b('0x44')](_0x493d1d)?![]:!![]);})[_0x172b('0x15')](function(_0x49cb5b){logger[_0x172b('0x2c')](_0x49cb5b);_0x3999dc(null,![]);});};AGIVertices[_0x172b('0x10')][_0x172b('0x53')]=function(_0x3d7494,_0x52b76e){sh[_0x172b('0x54')](_[_0x172b('0x55')](_0x3d7494),function(_0x4a36d2,_0x8217d5){var _0x4f0ca0=_0x8217d5[_0x172b('0x56')](/(\r\n|\n|\r)/gm,'');_0x52b76e(null,_0x4f0ca0);});};AGIVertices[_0x172b('0x10')]['googleCloudTTS']=function(_0xc173d9,_0x1527f9){scripts[_0x172b('0x57')](_0xc173d9[_0x172b('0x58')],_0xc173d9[_0x172b('0x59')]||'text',_0xc173d9[_0x172b('0x5a')],_0xc173d9[_0x172b('0x5b')]||'en-US',_0xc173d9['ssmlGender']||_0x172b('0x5c'),_0xc173d9[_0x172b('0x5d')]||'MP3')[_0x172b('0x13')](function(_0x2a2a1c){_0x1527f9(null,_0x2a2a1c);})[_0x172b('0x15')](function(_0xf51434){_0x1527f9(_0xf51434);});};AGIVertices[_0x172b('0x10')]['googleTTS']=function(_0x5ceeee,_0x5a84eb){scripts['googleTTS'](_0x5ceeee['text'],_0x5ceeee[_0x172b('0x5e')]||'en',0x1)[_0x172b('0x13')](function(_0x5d278e){_0x5a84eb(null,_0x5d278e);})[_0x172b('0x15')](function(_0x10d665){_0x5a84eb(_0x10d665);});};AGIVertices[_0x172b('0x10')][_0x172b('0x5f')]=function(_0x1d7de8,_0x21e7cb){var _0x5aca7f={'uri':_0x1d7de8[_0x172b('0x60')],'method':_0x1d7de8[_0x172b('0x61')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x1d7de8[_0x172b('0x62')])===_0x172b('0x63')&&parseInt(_0x1d7de8[_0x172b('0x62')])>=0x1?parseInt(_0x1d7de8[_0x172b('0x62')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x172b('0x64'),_0x172b('0x65')],_0x5aca7f[_0x172b('0x61')][_0x172b('0x66')]())){try{_0x5aca7f['body']=_0x1d7de8[_0x172b('0x67')]?JSON['parse'](_0x1d7de8[_0x172b('0x67')]):{};}catch(_0x4395a4){logger[_0x172b('0x2c')](_0x172b('0x68'),_0x4395a4);}}try{_0x5aca7f[_0x172b('0x69')]=_0x1d7de8[_0x172b('0xb')]?JSON[_0x172b('0x6a')](_0x1d7de8[_0x172b('0xb')]):{};}catch(_0x18d283){logger['error'](_0x172b('0x6b'),_0x18d283);}if(_0x1d7de8['computedVariables']){try{var _0x14b45a=require(_0x1d7de8[_0x172b('0x6c')])[_0x172b('0x6d')](this,_0x5aca7f);_0x5aca7f[_0x172b('0x6e')]=Mustache[_0x172b('0x6f')](_0x1d7de8['url'],_0x14b45a,{},['$$','$$']);if(_0x5aca7f[_0x172b('0x69')]){_0x5aca7f[_0x172b('0x69')]=JSON['parse'](Mustache[_0x172b('0x6f')](JSON[_0x172b('0x70')](_0x5aca7f[_0x172b('0x69')]),_0x14b45a,{},['$$','$$']));}if(_0x5aca7f['body']){_0x5aca7f[_0x172b('0x71')]=JSON[_0x172b('0x6a')](Mustache[_0x172b('0x6f')](JSON[_0x172b('0x70')](_0x5aca7f[_0x172b('0x71')]),_0x14b45a,{},['$$','$$']));}}catch(_0x297a90){logger[_0x172b('0x2c')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x297a90);}}rp(_0x5aca7f)[_0x172b('0x13')](function(_0x28cfb1){var _0x3de80c={'statusCode':_0x28cfb1[_0x172b('0x72')]||0xc8,'statusMessage':_0x28cfb1[_0x172b('0x73')]||'OK','headers':_0x28cfb1[_0x172b('0x69')]||{},'body':_0x28cfb1[_0x172b('0x71')]||{}};_0x21e7cb(null,_0x3de80c);})[_0x172b('0x15')](function(_0x4d1c19){var _0x13403a={'statusCode':_0x4d1c19[_0x172b('0x72')]||0x1f4,'statusMessage':_0x4d1c19[_0x172b('0x74')]||_0x172b('0x75'),'headers':_0x4d1c19[_0x172b('0x76')][_0x172b('0x69')]||{},'body':_0x4d1c19[_0x172b('0x76')][_0x172b('0x71')]||{}};_0x21e7cb(null,_0x13403a);});};AGIVertices[_0x172b('0x10')][_0x172b('0x77')]=function(_0x14bf75,_0x5650d8){scripts['googleDialogflow'](this['channel'][_0x172b('0x3a')],_0x14bf75[_0x172b('0x78')],_0x14bf75['text'],_0x14bf75['dialogflow_language']||'en')['then'](function(_0x304086){_0x5650d8(null,_0x304086);})[_0x172b('0x15')](function(_0x2afc0a){_0x5650d8(_0x2afc0a);});};AGIVertices['prototype'][_0x172b('0x79')]=function(_0x400871,_0x465847){scripts[_0x172b('0x79')](this[_0x172b('0xe')]['uniqueid'],_0x400871['dialogflowV2_project_id'],_0x400871[_0x172b('0x7a')],_0x400871['private_key'],_0x400871[_0x172b('0x5a')],_0x400871[_0x172b('0x7b')]||'en')[_0x172b('0x13')](function(_0x158649){_0x465847(null,_0x158649);})['catch'](function(_0x4c3b26){_0x465847(_0x4c3b26);});};AGIVertices[_0x172b('0x10')]['sestekNDA']=function(_0x5e277d,_0x504fa6){scripts[_0x172b('0x7c')](this[_0x172b('0xe')],_0x5e277d)[_0x172b('0x13')](function(_0x13b174){_0x504fa6(null,_0x13b174);})['catch'](function(_0xbcbfb5){_0x504fa6(_0xbcbfb5);});};AGIVertices['prototype'][_0x172b('0x7d')]=function(_0x431f24,_0x4be1c4){scripts[_0x172b('0x7d')](_0x431f24[_0x172b('0x78')],_0x431f24[_0x172b('0x5a')],_0x431f24['ispeech_tts_language']||_0x172b('0x7e'),_0x431f24['speed'])[_0x172b('0x13')](function(_0x2407f3){_0x4be1c4(null,_0x2407f3);})['catch'](function(_0x4e119b){_0x4be1c4(_0x4e119b);});};AGIVertices['prototype'][_0x172b('0x7f')]=function(_0x2d2af4,_0x89a77,_0x2ec91d){scripts[_0x172b('0x7f')](_0x89a77,_0x2d2af4['key'],_0x2d2af4[_0x172b('0x80')]||_0x172b('0x7e'),this[_0x172b('0x81')](_0x2d2af4[_0x172b('0x82')])?_0x2d2af4['model']:undefined)[_0x172b('0x13')](function(_0x3b567b){_0x2ec91d(null,_0x3b567b);})[_0x172b('0x15')](function(_0x35e5e4){_0x2ec91d(_0x35e5e4);});};AGIVertices[_0x172b('0x10')]['awsPolly']=function(_0x47331d,_0x147422){scripts[_0x172b('0x83')](_0x47331d[_0x172b('0x84')],_0x47331d[_0x172b('0x85')],_0x47331d[_0x172b('0x86')],_0x47331d[_0x172b('0x87')]||'Amy',_0x47331d[_0x172b('0x5a')],_0x47331d[_0x172b('0x88')]||'text')[_0x172b('0x13')](function(_0x7c5b38){_0x147422(null,_0x7c5b38);})[_0x172b('0x15')](function(_0x38ff90){_0x147422(_0x38ff90);});};AGIVertices[_0x172b('0x10')]['awsLex']=function(_0x269630,_0x4007d9){scripts[_0x172b('0x89')](this[_0x172b('0xe')][_0x172b('0x3a')],_0x269630['aws_access_key_id'],_0x269630[_0x172b('0x85')],_0x269630[_0x172b('0x8a')],_0x269630[_0x172b('0x5a')],_0x269630[_0x172b('0x8b')])['then'](function(_0x1c3c5d){_0x4007d9(null,_0x1c3c5d);})[_0x172b('0x15')](function(_0x4f0025){_0x4007d9(_0x4f0025);});};AGIVertices[_0x172b('0x10')]['googleASR']=function(_0xec6d1b,_0x2e6d4a,_0x43fc98){scripts[_0x172b('0x8c')](_0x2e6d4a,_0xec6d1b['key'],_0xec6d1b[_0x172b('0x8d')]||'en-US')[_0x172b('0x13')](function(_0x2fdcb8){_0x43fc98(null,_0x2fdcb8);})['catch'](function(_0x3fa922){_0x43fc98(_0x3fa922);});};AGIVertices[_0x172b('0x10')]['tildeASR']=function(_0x2720e,_0x461061,_0x4ad498){scripts[_0x172b('0x8e')](_0x461061,_0x2720e[_0x172b('0x8f')],_0x2720e[_0x172b('0x90')],_0x2720e[_0x172b('0x6e')])[_0x172b('0x13')](function(_0xb033a8){_0x4ad498(null,_0xb033a8);})[_0x172b('0x15')](function(_0xbed80a){_0x4ad498(_0xbed80a);});};AGIVertices[_0x172b('0x10')]['clear']=function(_0x39a707){var _0x36d5a4=_[_0x172b('0x91')](verticesWithRetry,_0x39a707[_0x172b('0x37')])?_0x39a707:_[_0x172b('0x92')](_0x39a707);for(var _0x480be5 in _0x36d5a4){if(_0x36d5a4[_0x172b('0x93')](_0x480be5)){if(_0x36d5a4[_0x480be5]&&_[_0x172b('0x94')](_0x36d5a4[_0x480be5])){if(_[_0x172b('0x91')](recursiveMapAttributes,_0x480be5)){_0x36d5a4[_0x480be5]=this[_0x172b('0x95')](_0x36d5a4[_0x480be5]);}else{_0x36d5a4[_0x480be5]=this[_0x172b('0x96')](_0x36d5a4[_0x480be5]);}}}}return _0x36d5a4;};AGIVertices['prototype'][_0x172b('0x97')]=function(_0xcff71c){for(var _0x167286 in _0xcff71c){if(_0xcff71c['hasOwnProperty'](_0x167286)){if(_[_0x172b('0x98')](_0xcff71c[_0x167286])){this[_0x172b('0x97')](_0xcff71c[_0x167286]);}else if(_[_0x172b('0x99')](_0xcff71c[_0x167286])){for(var _0x525464=0x0;_0x525464<_0xcff71c[_0x167286][_0x172b('0x9a')];_0x525464++){this[_0x172b('0x97')](_0xcff71c[_0x167286][_0x525464]);}}else if(_[_0x172b('0x94')](_0xcff71c[_0x167286])){_0xcff71c[_0x167286]=this[_0x172b('0x96')](_0xcff71c[_0x167286]);}}}};AGIVertices[_0x172b('0x10')]['saveRestApiResult']=function(_0x41a9a4,_0x44fa8e){for(var _0x251df0 in _0x41a9a4){if(_0x41a9a4[_0x172b('0x93')](_0x251df0)){if(_[_0x172b('0x98')](_0x41a9a4[_0x251df0])){if(!_[_0x172b('0x43')](_0x41a9a4[_0x251df0])){this[_0x172b('0x9b')](_0x41a9a4[_0x251df0],util['format'](_0x172b('0x9c'),_0x44fa8e,_0x251df0));}}else if(_[_0x172b('0x99')](_0x41a9a4[_0x251df0])){for(var _0x3d8dd1=0x0;_0x3d8dd1<_0x41a9a4[_0x251df0]['length'];_0x3d8dd1++){this['saveRestApiResult'](_0x41a9a4[_0x251df0][_0x3d8dd1],util[_0x172b('0x28')]('%s.%s',_0x44fa8e,_0x251df0+'['+_0x3d8dd1+']'));}}else{if(!_[_0x172b('0x44')](_0x41a9a4[_0x251df0])){this['channel'][_0x172b('0x9d')](util[_0x172b('0x28')](_0x172b('0x9c'),_0x44fa8e,_0x251df0),_0x41a9a4[_0x251df0]);}}}}};AGIVertices['prototype'][_0x172b('0x95')]=function(_0x2234cc){try{var _0x2981d3=JSON[_0x172b('0x6a')](_0x2234cc);this[_0x172b('0x97')](_0x2981d3);return JSON[_0x172b('0x70')](_0x2981d3);}catch(_0x5227b2){return this[_0x172b('0x96')](_0x2234cc);}};AGIVertices[_0x172b('0x10')][_0x172b('0x96')]=function(_0x3c93f2){var _0xd06ce7=_0x3c93f2[_0x172b('0x9e')]('{');for(var _0x302af1=0x1;_0x302af1<_0xd06ce7['length'];_0x302af1+=0x1){var _0x22100f=_0xd06ce7[_0x302af1]['split']('}');if(_0x22100f[_0x172b('0x9a')]>0x1){_0x3c93f2=_0x3c93f2[_0x172b('0x9f')]('{'+_0x22100f[0x0]+'}',this['channel'][_0x172b('0x11')](_0x22100f[0x0])['extra']||_0x22100f[0x0]);}}if(_0xd06ce7[_0x172b('0x9a')]===0x1){return _0x3c93f2[_0x172b('0xa0')]();}return this[_0x172b('0x96')](_0x3c93f2);};AGIVertices[_0x172b('0x10')][_0x172b('0xa1')]=function(_0x19c318,_0x3a3626){var _0x688079=this[_0x172b('0xe')]['getVariable'](_0x19c318);if(_0x688079['result']===-0x1){return _0x688079;}logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0xa2'),_0x3a3626,_0x688079[_0x172b('0xa3')]));return this[_0x172b('0xe')]['setVariable'](_0x3a3626,_0x688079[_0x172b('0xa3')]);};AGIVertices['prototype'][_0x172b('0x81')]=function(_0x3fb683){return _0x3fb683&&_0x3fb683!=='0'&&_0x3fb683!=='-1'&&_0x3fb683!=='';};AGIVertices[_0x172b('0x10')][_0x172b('0xa4')]=function(_0x2ac8de){this['createSquareDetailsReport'][_0x172b('0x6d')](this,_0x2ac8de,'-');_0x2ac8de[_0x172b('0xa5')]=_0x2ac8de[_0x172b('0xa4')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x172b('0x10')][_0x172b('0xa6')]=function(_0xda2b81){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0xa7'),_0xda2b81[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0xda2b81['text'])){return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0xaa'));}var _0x4fc108='\x22'+_0xda2b81[_0x172b('0x5a')]+'\x22';if(this[_0x172b('0x81')](_0xda2b81[_0x172b('0x76')])){_0x4fc108+=','+_0xda2b81[_0x172b('0x76')];}var _0x2ef854=this['channel'][_0x172b('0x54')]('MRCPSynth',_0x4fc108);if(_0x2ef854[_0x172b('0xab')]===-0x1){return _0x2ef854;}return this[_0x172b('0xe')][_0x172b('0xa9')](util['format'](_0x172b('0xac'),_0x4fc108));};AGIVertices[_0x172b('0x10')]['mrcprecog']=function(_0x320f83){logger[_0x172b('0x2e')](util[_0x172b('0x28')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x320f83[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x320f83[_0x172b('0xad')])){return this[_0x172b('0xe')]['noop'](_0x172b('0xae'));}var _0x106e9c=_0x320f83['grammar'];if(this[_0x172b('0x81')](_0x320f83[_0x172b('0x76')])){_0x106e9c+=','+_0x320f83[_0x172b('0x76')];}var _0x2f7abc=this[_0x172b('0xe')]['exec'](_0x172b('0xaf'),_0x106e9c);if(_0x2f7abc[_0x172b('0xab')]===-0x1){return _0x2f7abc;}var _0x2a3d38=this[_0x172b('0xa1')](_0x172b('0xb0'),'MRCP_RECOG_CONFIDENCE');if(_0x2a3d38['result']===-0x1){return _0x2a3d38;}var _0x1ff832=this[_0x172b('0xa1')]('RECOG_INPUT()',_0x172b('0xb1'));if(_0x1ff832['result']===-0x1){return _0x1ff832;}var _0x2b5956=this[_0x172b('0xa1')](_0x172b('0xb2'),_0x172b('0xb3'));if(_0x2b5956['result']===-0x1){return _0x2b5956;}return this[_0x172b('0xe')]['noop'](util[_0x172b('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x106e9c));};AGIVertices['prototype'][_0x172b('0xb4')]=function(_0x2618ab){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0xb5'),_0x2618ab[_0x172b('0xa8')]));return this[_0x172b('0xe')][_0x172b('0xb4')]([_0x2618ab[_0x172b('0xb6')],_0x2618ab[_0x172b('0xb7')]]);};AGIVertices[_0x172b('0x10')][_0x172b('0xb8')]=function(_0x15295a){logger[_0x172b('0x2e')](util['format'](_0x172b('0xb9'),_0x15295a[_0x172b('0xa8')]));if(this[_0x172b('0x81')](_0x15295a[_0x172b('0x62')])){logger[_0x172b('0x2e')](util[_0x172b('0x28')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x15295a[_0x172b('0x62')]));var _0x3c1e6d=this[_0x172b('0xe')][_0x172b('0xba')](_0x15295a[_0x172b('0x62')]);if(_0x3c1e6d[_0x172b('0xab')]===-0x1){return _0x3c1e6d;}}return this[_0x172b('0xe')]['answer']();};AGIVertices[_0x172b('0x10')][_0x172b('0xbb')]=function(_0x1f4d11){logger['info'](util[_0x172b('0x28')](_0x172b('0xbc'),_0x1f4d11[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x1f4d11[_0x172b('0x48')])){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x1f4d11,_0x172b('0xbd'));}_0x1f4d11[_0x172b('0x49')]=moment();if(this[_0x172b('0x81')](_0x1f4d11[_0x172b('0xbe')])){_0x1f4d11[_0x172b('0x49')]=moment()[_0x172b('0xbf')](_0x1f4d11['delay'],_0x172b('0xc0'));}if(!this[_0x172b('0x81')](_0x1f4d11['callback_priority'])){_0x1f4d11['callback_priority']=0x2;}this[_0x172b('0x42')][_0x172b('0x6d')](this,_0x1f4d11);return this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0xc1'),_0x1f4d11[_0x172b('0x47')],_0x1f4d11[_0x172b('0x48')],_0x1f4d11['scheduledAt']));};AGIVertices['prototype'][_0x172b('0xc2')]=function(_0x3e35cb){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0xc3'),_0x3e35cb[_0x172b('0xa8')]));var _0x5df397=this[_0x172b('0xe')]['exec'](_0x3e35cb[_0x172b('0xc4')],_0x3e35cb[_0x172b('0x76')]);if(_0x5df397[_0x172b('0xab')]===-0x1){return _0x5df397;}return this[_0x172b('0xe')]['noop'](util[_0x172b('0x28')]('Executed\x20command\x20%s\x20%s',_0x3e35cb[_0x172b('0xc4')],_0x3e35cb[_0x172b('0x76')]));};AGIVertices[_0x172b('0x10')]['lumenvoxtts']=function(_0x405339){logger['info'](util[_0x172b('0x28')](_0x172b('0xc5'),_0x405339[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x405339[_0x172b('0x5a')])){return this[_0x172b('0xe')]['noop']('no\x20text\x20configured');}var _0x1d3abe='\x22'+_0x405339[_0x172b('0x5a')]+'\x22';if(this[_0x172b('0x81')](_0x405339[_0x172b('0x76')])){_0x1d3abe+=','+_0x405339[_0x172b('0x76')];}var _0x4baa17=this[_0x172b('0xe')][_0x172b('0x54')]('MRCPSynth',_0x1d3abe);if(_0x4baa17['result']===-0x1){return _0x4baa17;}return this[_0x172b('0xe')][_0x172b('0xa9')](util['format'](_0x172b('0xac'),_0x1d3abe));};AGIVertices[_0x172b('0x10')][_0x172b('0xc6')]=function(_0x5a3d03){logger['info'](util[_0x172b('0x28')](_0x172b('0xc7'),_0x5a3d03[_0x172b('0xa8')]));if(!this['isConfigured'](_0x5a3d03['text'])){return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0xaa'));}var _0x5a0e3d='\x22'+_0x5a3d03[_0x172b('0x5a')]+'\x22';if(this['isConfigured'](_0x5a3d03[_0x172b('0x76')])){_0x5a0e3d+=','+_0x5a3d03[_0x172b('0x76')];}var _0x3114c3=this[_0x172b('0xe')][_0x172b('0x54')]('MRCPSynth',_0x5a0e3d);if(_0x3114c3[_0x172b('0xab')]===-0x1){return _0x3114c3;}return this[_0x172b('0xe')][_0x172b('0xa9')](util['format'](_0x172b('0xac'),_0x5a0e3d));};AGIVertices[_0x172b('0x10')][_0x172b('0xc8')]=function(_0x298ece){logger[_0x172b('0x2e')](util['format'](_0x172b('0xc9'),_0x298ece[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x298ece[_0x172b('0xad')])){return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0xae'));}var _0x20a31c=_0x298ece[_0x172b('0xad')];if(this[_0x172b('0x81')](_0x298ece['options'])){_0x20a31c+=','+_0x298ece[_0x172b('0x76')];}var _0x201495=this[_0x172b('0xe')][_0x172b('0x54')](_0x172b('0xaf'),_0x20a31c);if(_0x201495[_0x172b('0xab')]===-0x1){return _0x201495;}var _0x5d74de=this['getAndSetVariable'](_0x172b('0xb0'),'LUMENVOX_ASR_CONFIDENCE');if(_0x5d74de[_0x172b('0xab')]===-0x1){return _0x5d74de;}var _0x556af6=this[_0x172b('0xa1')](_0x172b('0xca'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x556af6[_0x172b('0xab')]===-0x1){return _0x556af6;}var _0x5eb774=this['getAndSetVariable']('RECOG_INSTANCE()',_0x172b('0xcb'));if(_0x5eb774[_0x172b('0xab')]===-0x1){return _0x5eb774;}return this[_0x172b('0xe')]['noop'](util[_0x172b('0x28')](_0x172b('0xcc'),_0x20a31c));};AGIVertices[_0x172b('0x10')][_0x172b('0xcd')]=function(_0x11bc2b){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0xce'),_0x11bc2b[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x11bc2b[_0x172b('0xad')])){return this['channel'][_0x172b('0xa9')]('no\x20grammar\x20configured');}var _0x3cab89=_0x11bc2b[_0x172b('0xad')];if(this[_0x172b('0x81')](_0x11bc2b['options'])){_0x3cab89+=','+_0x11bc2b[_0x172b('0x76')];}var _0x347c7b=this[_0x172b('0xe')][_0x172b('0x54')](_0x172b('0xaf'),_0x3cab89);if(_0x347c7b[_0x172b('0xab')]===-0x1){return _0x347c7b;}var _0x2f89f8=this['getAndSetVariable'](_0x172b('0xb0'),_0x172b('0xcf'));if(_0x2f89f8[_0x172b('0xab')]===-0x1){return _0x2f89f8;}var _0x17806c=this[_0x172b('0xa1')](_0x172b('0xca'),'SESTEK_ASR_TRANSCRIPT');if(_0x17806c['result']===-0x1){return _0x17806c;}var _0x2de66d=this['getAndSetVariable'](_0x172b('0xb2'),'SESTEK_ASR_INSTANCE');if(_0x2de66d['result']===-0x1){return _0x2de66d;}return this[_0x172b('0xe')][_0x172b('0xa9')](util['format'](_0x172b('0xcc'),_0x3cab89));};AGIVertices[_0x172b('0x10')]['database']=function(_0x5b86a0){logger['info'](util[_0x172b('0x28')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x5b86a0[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x5b86a0['odbc_id'])){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x5b86a0,_0x172b('0xd0'));}var _0x1594f3=this[_0x172b('0xd1')]['sync'](this,_0x5b86a0[_0x172b('0xd2')]);if(!_0x1594f3){return this['channel'][_0x172b('0x2c')](_0x5b86a0,_0x172b('0xd3'));}if(!this[_0x172b('0x81')](_0x5b86a0[_0x172b('0x30')])){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x5b86a0,_0x172b('0xd4'));}var _0x39abd7=_0x5b86a0[_0x172b('0x30')][_0x172b('0x56')](/(\r\n|\n|\r)/gm,'\x20');this[_0x172b('0xe')]['noop'](util[_0x172b('0x28')](_0x172b('0xd5'),_0x39abd7));var _0x117828=this['getQueryOdbc'][_0x172b('0x6d')](this,_0x1594f3,_0x39abd7);this[_0x172b('0x36')][_0x172b('0x6d')](this,_0x5b86a0,_0x39abd7);if(!this[_0x172b('0x81')](_0x5b86a0[_0x172b('0xd6')])){return this[_0x172b('0xe')]['noop'](_0x172b('0xd7'));}var _0x3dd9e4=this['getVariable'][_0x172b('0x6d')](this,_0x5b86a0['variable_id']);if(!_0x3dd9e4){return this[_0x172b('0xe')]['error'](_0x5b86a0,'no\x20variable\x20found');}var _0x292d70=this;_0x117828[_0x172b('0xd8')](function(_0x55b36d,_0x46eaa4){Object[_0x172b('0xd9')](_0x55b36d)[_0x172b('0xd8')](function(_0x4d67ba){_0x292d70[_0x172b('0xe')][_0x172b('0x9d')](util[_0x172b('0x28')](_0x172b('0xda'),_0x3dd9e4,_0x46eaa4,_0x4d67ba),_0x55b36d[_0x4d67ba]);});});this[_0x172b('0xe')][_0x172b('0x9d')](util[_0x172b('0x28')](_0x172b('0xdb'),_0x3dd9e4),_0x117828[_0x172b('0x9a')]);return this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0xdc'),_0x3dd9e4));};AGIVertices['prototype'][_0x172b('0xdd')]=function(_0x25c024){logger[_0x172b('0xde')](util[_0x172b('0x28')](_0x172b('0xdf'),_0x25c024['label']));if(!this[_0x172b('0x81')](_0x25c024[_0x172b('0xe0')])){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x25c024,_0x172b('0xe1'));}var _0x31b436=this[_0x172b('0xe2')][_0x172b('0x6d')](this,_0x25c024['sip_id']);if(!_0x31b436){return this[_0x172b('0xe')]['error'](_0x25c024,'no\x20user\x20found');}var _0x1959dc=this[_0x172b('0xe')][_0x172b('0x54')](_0x172b('0xe3'),[util[_0x172b('0x28')](_0x172b('0xe4'),_0x31b436),_0x25c024[_0x172b('0x62')],_0x25c024[_0x172b('0xe5')],_0x25c024['url']]);if(_0x1959dc[_0x172b('0xab')]===-0x1){return _0x1959dc;}return this[_0x172b('0xe')][_0x172b('0xa9')](util['format'](_0x172b('0xe6'),_0x172b('0xe3')));};AGIVertices[_0x172b('0x10')][_0x172b('0xe7')]=function(_0xdf3b3f){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0xe8'),_0xdf3b3f[_0x172b('0xa8')]));if(!this['isConfigured'](_0xdf3b3f[_0x172b('0x78')])){return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0xe9'));}if(!this['isConfigured'](_0xdf3b3f[_0x172b('0x5a')])){return this[_0x172b('0xe')][_0x172b('0xa9')]('no\x20text\x20configured');}this['channel'][_0x172b('0xea')]=!![];this[_0x172b('0x36')](_0xdf3b3f);this['createSquareMessage'](_0xdf3b3f[_0x172b('0x5a')],'in','','');this[_0x172b('0xe')]['noop'](util[_0x172b('0x28')](_0x172b('0xeb'),_0xdf3b3f[_0x172b('0x5a')]));var _0x6f589e=this[_0x172b('0x77')]['sync'](this,_0xdf3b3f);if(_0x6f589e){for(var _0x26d6a8 in _0x6f589e){if(_0x6f589e[_0x172b('0x93')](_0x26d6a8)){this[_0x172b('0xe')][_0x172b('0x9d')](util[_0x172b('0x28')](_0x172b('0xec'),_0x26d6a8['toUpperCase']()),_0x6f589e[_0x26d6a8]);}}this[_0x172b('0x41')](_0x6f589e[_0x172b('0xed')],_0x172b('0xee'),_0x172b('0xe7'),'');return this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0xef'),_0x6f589e['speech']));}return this[_0x172b('0xe')][_0x172b('0x2c')](_0xdf3b3f,_0x172b('0xf0'));};AGIVertices[_0x172b('0x10')][_0x172b('0xf1')]=function(_0x4e2647){logger['info'](util[_0x172b('0x28')](_0x172b('0xf2'),_0x4e2647['label']));if(!this[_0x172b('0x81')](_0x4e2647['dialogflowV2_project_id'])){return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0xf3'));}if(!this[_0x172b('0x81')](_0x4e2647[_0x172b('0x7a')])){return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0xf4'));}if(!this[_0x172b('0x81')](_0x4e2647[_0x172b('0xf5')])){return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0xf6'));}if(!this[_0x172b('0x81')](_0x4e2647[_0x172b('0x7b')])){return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0xf7'));}if(!this[_0x172b('0x81')](_0x4e2647['text'])){return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0xaa'));}this['channel']['bot']=!![];this[_0x172b('0x36')](_0x4e2647);this[_0x172b('0x41')](_0x4e2647[_0x172b('0x5a')],'in','','');this[_0x172b('0xe')]['noop'](util[_0x172b('0x28')](_0x172b('0xf8'),_0x4e2647['text']));var _0xbe95c9=this[_0x172b('0x79')]['sync'](this,_0x4e2647);if(_0xbe95c9){for(var _0x42929a in _0xbe95c9){if(_0xbe95c9[_0x172b('0x93')](_0x42929a)){if(_0x42929a!==_0x172b('0xf9')){this[_0x172b('0xe')]['setVariable'](util[_0x172b('0x28')]('DIALOGFLOW_%s',_0x42929a[_0x172b('0x66')]()),_0xbe95c9[_0x42929a]);}}}this[_0x172b('0x41')](_0xbe95c9['speech'],_0x172b('0xee'),_0x172b('0xf1'),_0xbe95c9[_0x172b('0xf9')]);return this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0xfa'),_0xbe95c9[_0x172b('0xed')]));}return this['channel'][_0x172b('0x2c')](_0x4e2647,_0x172b('0xfb'));};AGIVertices[_0x172b('0x10')][_0x172b('0xfc')]=function(_0xe538e9){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0xfd'),_0xe538e9[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0xe538e9[_0x172b('0xfe')])){return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0xff'));}if(!this[_0x172b('0x81')](_0xe538e9['username'])){return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0x100'));}if(!this[_0x172b('0x81')](_0xe538e9[_0x172b('0x101')])){return this[_0x172b('0xe')][_0x172b('0xa9')]('no\x20password\x20configured');}if(!this[_0x172b('0x81')](_0xe538e9['ndassistant_url'])){return this[_0x172b('0xe')]['noop'](_0x172b('0xaa'));}this[_0x172b('0xe')]['bot']=!![];this[_0x172b('0x36')](_0xe538e9);this['createSquareMessage'](_0xe538e9[_0x172b('0x5a')],'in','','');this['channel'][_0x172b('0xa9')](util['format'](_0x172b('0x102'),_0xe538e9[_0x172b('0x5a')]));var _0x50efdd=this['sestekNDA'][_0x172b('0x6d')](this,_0xe538e9);if(_0x50efdd){for(var _0x281e28 in _0x50efdd){if(_0x50efdd[_0x172b('0x93')](_0x281e28)){this[_0x172b('0xe')][_0x172b('0x9d')](util['format'](_0x172b('0x103'),_0x281e28[_0x172b('0x66')]()),_0x50efdd[_0x281e28]);}}this['createSquareMessage'](_0x50efdd[_0x172b('0xed')],_0x172b('0xee'),_0x172b('0xfc'),'');if(_0x50efdd[_0x172b('0x104')]){this['channel']['noop'](util[_0x172b('0x28')](_0x172b('0x105'),_0x50efdd['audiofile']));var _0x37f79a=this[_0x172b('0xe')][_0x172b('0x106')](_0x50efdd[_0x172b('0x104')]);try{fs[_0x172b('0x107')](_0x50efdd[_0x172b('0x104')]+_0x172b('0x108'));}catch(_0x22b7ca){logger[_0x172b('0x2c')](_0x22b7ca);}return _0x37f79a;}else{return this['channel']['noop'](util[_0x172b('0x28')](_0x172b('0x109'),_0x50efdd['speech']));}}return this[_0x172b('0xe')][_0x172b('0x2c')](_0xe538e9,_0x172b('0x10a'));};AGIVertices[_0x172b('0x10')][_0x172b('0x10b')]=function(_0x1d791e){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x10c'),_0x1d791e['label']));return this[_0x172b('0xe')]['noop'](_0x172b('0x10b'));};AGIVertices[_0x172b('0x10')]['ext_dial']=function(_0x4d5557){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x10d'),_0x4d5557[_0x172b('0xa8')]));var _0x2d6eca='';if(_0x4d5557[_0x172b('0x10e')]){if(!this['isConfigured'](_0x4d5557['trunk_id'])){return this[_0x172b('0xe')]['error'](_0x4d5557,'no\x20trunk\x20selected');}else{var _0x48b3d6=parseInt(_0x4d5557[_0x172b('0x10e')],0xa);if(isNaN(_0x48b3d6)){_0x2d6eca=_0x4d5557[_0x172b('0x10e')];}else{_0x2d6eca=this[_0x172b('0x1b')][_0x172b('0x6d')](this,_0x4d5557[_0x172b('0x10e')]);if(!_0x2d6eca){return this[_0x172b('0xe')]['error'](_0x4d5557,'no\x20trunk\x20found');}}}}else if(_0x4d5557[_0x172b('0x10f')]){_0x2d6eca=_0x4d5557[_0x172b('0x10f')];}else{return this[_0x172b('0xe')]['error'](_0x4d5557,_0x172b('0x110'));}var _0x3e9e4b=this[_0x172b('0xe')]['exec']('DIAL',[util['format'](_0x172b('0x111'),_0x2d6eca,_0x4d5557[_0x172b('0x47')]),_0x4d5557[_0x172b('0x62')],_0x4d5557[_0x172b('0xe5')],_0x4d5557[_0x172b('0x60')]]);if(_0x3e9e4b['result']===-0x1){return _0x3e9e4b;}return this['channel'][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0xe6'),_0x172b('0xe3')));};AGIVertices[_0x172b('0x10')][_0x172b('0x112')]=function(_0x19cb81){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x113'),_0x19cb81['label']));return this[_0x172b('0xe')][_0x172b('0xa9')]('finally');};AGIVertices[_0x172b('0x10')][_0x172b('0x114')]=function(_0x1d47dc){logger['info'](util[_0x172b('0x28')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x1d47dc['label']));if(_0x1d47dc[_0x172b('0xa5')]===0x0){return this[_0x172b('0xa4')](_0x1d47dc);}_0x1d47dc['retry']-=0x1;if(!this['isConfigured'](_0x1d47dc[_0x172b('0x115')])){return this['channel'][_0x172b('0x2c')](_0x1d47dc,_0x172b('0x116'));}var _0x461e16=this[_0x172b('0x1d')][_0x172b('0x6d')](this,_0x1d47dc[_0x172b('0x115')]);if(!_0x461e16){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x1d47dc,_0x172b('0x117'));}if(!this[_0x172b('0x81')](_0x1d47dc[_0x172b('0xd6')])){return this[_0x172b('0xe')][_0x172b('0x2c')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x459d41=this[_0x172b('0xe')][_0x172b('0x118')](_0x461e16,_0x1d47dc[_0x172b('0x119')],_0x1d47dc[_0x172b('0x11a')]);var _0x14d545=_0x459d41[_0x172b('0xab')]?_0x459d41[_0x172b('0xab')]['toString']():'';logger[_0x172b('0x2e')]('test',JSON['stringify'](_0x459d41));if(_0x459d41[_0x172b('0xab')]===-0x1){this[_0x172b('0x36')][_0x172b('0x6d')](this,_0x1d47dc,_0x14d545);return _0x459d41;}else if(_0x459d41[_0x172b('0xa3')]===_0x172b('0x62')){_0x459d41[_0x172b('0xab')]=_0x14d545[_0x172b('0x9a')]>=parseInt(_0x1d47dc[_0x172b('0x11b')])?'x':'i';}else{_0x459d41[_0x172b('0xab')]=_0x14d545['length']>=parseInt(_0x1d47dc[_0x172b('0x11b')])&&_0x14d545[_0x172b('0x9a')]<=parseInt(_0x1d47dc[_0x172b('0x11a')])?'x':'i';}var _0x2d34d2=this[_0x172b('0x11')][_0x172b('0x6d')](this,_0x1d47dc[_0x172b('0xd6')]);if(!_0x2d34d2){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x1d47dc,_0x172b('0x11c'));}this[_0x172b('0xe')][_0x172b('0x9d')](_0x2d34d2,_0x14d545);if(this[_0x172b('0x81')](_0x1d47dc[_0x172b('0x11d')])){var _0x5988b8=parseInt(_0x1d47dc[_0x172b('0x11d')],0xa);var _0x3e6594=rs['generate']({'charset':'*','length':_0x5988b8});var _0xf78999=_0x14d545[_0x172b('0x9a')];if(_0xf78999>0x0){if(_0xf78999>_0x5988b8){this['createSquareDetailsReport']['sync'](this,_0x1d47dc,_0x1d47dc[_0x172b('0x11e')]===_0x172b('0x11f')?_0x3e6594+_0x14d545[_0x172b('0x120')](_0x5988b8):_0x14d545[_0x172b('0x120')](0x0,_0xf78999-_0x5988b8)+_0x3e6594);}else{this[_0x172b('0x36')]['sync'](this,_0x1d47dc,rs[_0x172b('0x121')]({'charset':'*','length':_0xf78999}));}}else{this['createSquareDetailsReport']['sync'](this,_0x1d47dc,'');}}else{this['createSquareDetailsReport'][_0x172b('0x6d')](this,_0x1d47dc,_0x14d545);}return _0x459d41;};AGIVertices[_0x172b('0x10')][_0x172b('0xd')]=function(_0x4c2f41){logger[_0x172b('0x2e')](util['format'](_0x172b('0x122'),_0x4c2f41[_0x172b('0xa8')]));return this[_0x172b('0x114')](_0x4c2f41);};AGIVertices[_0x172b('0x10')][_0x172b('0x123')]=function(_0x392f65){logger[_0x172b('0x2e')](util['format'](_0x172b('0x124'),_0x392f65[_0x172b('0xa8')]));this[_0x172b('0x36')][_0x172b('0x6d')](this,_0x392f65,_0x392f65[_0x172b('0x125')]);return this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x126'),_0x392f65[_0x172b('0x125')]));};AGIVertices[_0x172b('0x10')]['awspolly']=function(_0xd7b8fc){logger[_0x172b('0x2e')](util[_0x172b('0x28')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0xd7b8fc['label']));if(!this['isConfigured'](_0xd7b8fc[_0x172b('0x84')])||!this[_0x172b('0x81')](_0xd7b8fc[_0x172b('0x85')])){return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0x127'));}if(!this[_0x172b('0x81')](_0xd7b8fc['text'])){return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0xaa'));}this['channel'][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x128'),_0xd7b8fc['text']));var _0x398891=this[_0x172b('0x83')][_0x172b('0x6d')](this,_0xd7b8fc);if(_0x398891){this['channel']['noop'](util[_0x172b('0x28')](_0x172b('0x129'),_0x398891));var _0x3bbc67=this[_0x172b('0xe')]['streamFile'](_0x398891);try{fs['unlink'](_0x398891+'.wav');}catch(_0x447162){logger[_0x172b('0x2c')](_0x447162);}return _0x3bbc67;}return this[_0x172b('0xe')]['error'](_0xd7b8fc,_0x172b('0x12a'));};AGIVertices['prototype'][_0x172b('0x12b')]=function(_0x5e751a){logger[_0x172b('0x2e')](util[_0x172b('0x28')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x5e751a[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x5e751a[_0x172b('0x84')])||!this[_0x172b('0x81')](_0x5e751a[_0x172b('0x85')])){return this['channel']['noop'](_0x172b('0x127'));}if(!this[_0x172b('0x81')](_0x5e751a[_0x172b('0x8b')])){return this[_0x172b('0xe')]['noop']('no\x20bot\x20name\x20configured');}if(!this[_0x172b('0x81')](_0x5e751a[_0x172b('0x5a')])){return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0xaa'));}this['channel'][_0x172b('0xea')]=!![];this[_0x172b('0x36')](_0x5e751a);this[_0x172b('0x41')](_0x5e751a['text'],'in','','');this['channel'][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x12c'),_0x5e751a[_0x172b('0x5a')]));var _0x13da2d=this['awsLex'][_0x172b('0x6d')](this,_0x5e751a);if(_0x13da2d){for(var _0x3fc4c7 in _0x13da2d){if(_0x13da2d[_0x172b('0x93')](_0x3fc4c7)&&_['isString'](_0x13da2d[_0x3fc4c7])){this['channel'][_0x172b('0x9d')](util['format'](_0x172b('0x12d'),_0x3fc4c7[_0x172b('0x66')]()),_0x13da2d[_0x3fc4c7]);}}if(_['isNil'](_0x13da2d[_0x172b('0x74')])){return this['channel'][_0x172b('0xa9')](_0x172b('0x12e'));}else{this['createSquareMessage'](_0x13da2d[_0x172b('0x74')],_0x172b('0xee'),_0x172b('0x12f'),'');return this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')]('Amazon\x20Lex\x20Result\x20%s',_0x13da2d[_0x172b('0x74')]));}}return this[_0x172b('0xe')][_0x172b('0x2c')](_0x5e751a,_0x172b('0x130'));};AGIVertices['prototype'][_0x172b('0x131')]=function(_0x43a3a0){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x132'),_0x43a3a0[_0x172b('0xa8')],_0x43a3a0[_0x172b('0x62')]));if(!this[_0x172b('0x81')](_0x43a3a0[_0x172b('0x78')])){return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0xe9'));}var _0x58cb83=_0x172b('0x133');var _0x41dad8=util[_0x172b('0x28')](_0x172b('0x134'),FILES_PATH,rs['generate'](0x4));var _0x547477=util['format'](_0x172b('0x9c'),_0x41dad8,_0x58cb83);var _0x534f48=!![];if(_0x43a3a0['beep']===_0x172b('0x135')){_0x534f48=![];}var _0x208527=this[_0x172b('0xe')]['recordFile'](_0x41dad8,_0x58cb83,_0x43a3a0[_0x172b('0x136')],_0x43a3a0[_0x172b('0x62')],undefined,_0x534f48);if(_0x208527[_0x172b('0xab')]!==-0x1){this['channel'][_0x172b('0xa9')](util['format'](_0x172b('0x137'),_0x547477));var _0x3318ff=this[_0x172b('0x8c')]['sync'](this,_0x43a3a0,_0x547477);if(_0x3318ff){for(var _0x9eccb7 in _0x3318ff){if(_0x3318ff[_0x172b('0x93')](_0x9eccb7)){this[_0x172b('0xe')][_0x172b('0x9d')](util[_0x172b('0x28')](_0x172b('0x138'),_0x9eccb7[_0x172b('0x66')]()),_0x3318ff[_0x9eccb7]);}}return this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')]('GoogleASR\x20Result\x20%s',JSON[_0x172b('0x70')](_0x3318ff)));}}return _0x208527;};AGIVertices[_0x172b('0x10')]['tildeasr']=function(_0x5a13d2){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x139'),_0x5a13d2[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x5a13d2['appid'])){return this[_0x172b('0xe')]['noop'](_0x172b('0x13a'));}if(!this['isConfigured'](_0x5a13d2[_0x172b('0x90')])){return this[_0x172b('0xe')]['noop'](_0x172b('0x13b'));}var _0x1dcf0d=_0x172b('0x133');var _0x1de2d6=util[_0x172b('0x28')](_0x172b('0x134'),FILES_PATH,rs['generate'](0x4));var _0x5c44d2=util['format'](_0x172b('0x9c'),_0x1de2d6,_0x1dcf0d);var _0x2d38ed=!![];if(_0x5a13d2[_0x172b('0x13c')]===_0x172b('0x135')){_0x2d38ed=![];}var _0x33311c=this[_0x172b('0xe')]['recordFile'](_0x1de2d6,_0x1dcf0d,_0x5a13d2['intKey'],_0x5a13d2[_0x172b('0x62')],undefined,_0x2d38ed);if(_0x33311c[_0x172b('0xab')]!==-0x1){this['channel'][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x13d'),_0x5c44d2));var _0x21b951=this[_0x172b('0x8e')]['sync'](this,_0x5a13d2,_0x5c44d2);if(_0x21b951){for(var _0x3c14b5 in _0x21b951){if(_0x21b951['hasOwnProperty'](_0x3c14b5)){this['channel'][_0x172b('0x9d')](util[_0x172b('0x28')]('TILDE_ASR_%s',_0x3c14b5['toUpperCase']()),_0x21b951[_0x3c14b5]);}}return this['channel'][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x13e'),JSON[_0x172b('0x70')](_0x21b951)));}}return _0x33311c;};AGIVertices[_0x172b('0x10')]['gotoc']=function(_0x23b0a6){logger[_0x172b('0x2e')](util[_0x172b('0x28')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x23b0a6[_0x172b('0xa8')]));return this[_0x172b('0xe')][_0x172b('0x13f')](_0x23b0a6[_0x172b('0x140')],_0x23b0a6[_0x172b('0x3c')],_0x23b0a6[_0x172b('0x3d')]);};AGIVertices[_0x172b('0x10')]['gotoif']=function(_0x4507dc){logger[_0x172b('0x2e')](util[_0x172b('0x28')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x4507dc[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x4507dc[_0x172b('0x141')])){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x4507dc,_0x172b('0x142'));}try{var _0x569620=eval(_0x4507dc[_0x172b('0x141')])?_0x172b('0x143'):_0x172b('0x144');this[_0x172b('0xe')][_0x172b('0xa9')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x4507dc['condition'],_0x569620));return{'code':0xc8,'result':_0x569620};}catch(_0x373547){return{'code':0xc8,'result':_0x172b('0x144')};}};AGIVertices[_0x172b('0x10')][_0x172b('0x145')]=function(_0x55def4){logger[_0x172b('0x2e')](util[_0x172b('0x28')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x55def4['label']));if(!this[_0x172b('0x81')](_0x55def4['interval_id'])){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x55def4,_0x172b('0x146'));}var _0x87a959=this[_0x172b('0x25')][_0x172b('0x6d')](this,_0x55def4[_0x172b('0x147')]);if(!_0x87a959){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x55def4,'no\x20intervals\x20found');}for(var _0x1a18b1=0x0;_0x1a18b1<_0x87a959[_0x172b('0x9a')];_0x1a18b1+=0x1){var _0x18896b=this['channel'][_0x172b('0x11')](util[_0x172b('0x28')](_0x172b('0x148'),_0x87a959[_0x1a18b1]));if(_0x18896b[_0x172b('0xab')]===-0x1){return _0x18896b;}logger[_0x172b('0x2e')](util[_0x172b('0x28')]('IFTIME\x20%s\x20%s',_0x87a959[_0x1a18b1],_0x18896b[_0x172b('0xa3')]));if(_0x18896b[_0x172b('0xa3')]===_0x172b('0x143')){logger['info'](util['format'](_0x172b('0x149'),_0x87a959[_0x1a18b1],'true'));this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x149'),_0x87a959[_0x1a18b1],_0x172b('0x143')));return{'code':0xc8,'result':_0x172b('0x143')};}else{logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x149'),_0x87a959[_0x1a18b1],'false'));this[_0x172b('0xe')][_0x172b('0xa9')](util['format'](_0x172b('0x149'),_0x87a959[_0x1a18b1],_0x172b('0x144')));}}return{'code':0xc8,'result':_0x172b('0x144')};};AGIVertices['prototype'][_0x172b('0x14a')]=function(_0xfd3ba4){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x14b'),_0xfd3ba4[_0x172b('0xa8')]));return this[_0x172b('0xe')]['hangup']();};AGIVertices[_0x172b('0x10')][_0x172b('0x14c')]=function(_0x361e45){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x14d'),_0x361e45[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x361e45[_0x172b('0x78')])){return this['channel'][_0x172b('0xa9')](_0x172b('0xe9'));}var _0x34e57c='wav';var _0x3efe1b=util[_0x172b('0x28')](_0x172b('0x134'),FILES_PATH,rs[_0x172b('0x121')](0x4));var _0x12e61b=util[_0x172b('0x28')]('%s.%s',_0x3efe1b,_0x34e57c);var _0x1cedae=!![];if(_0x361e45[_0x172b('0x13c')]===_0x172b('0x135')){_0x1cedae=![];}var _0x5a33b5=this[_0x172b('0xe')]['recordFile'](_0x3efe1b,_0x34e57c,_0x361e45[_0x172b('0x136')],_0x361e45[_0x172b('0x62')],undefined,_0x1cedae);if(_0x5a33b5[_0x172b('0xab')]!==-0x1){this[_0x172b('0xe')][_0x172b('0xa9')](util['format'](_0x172b('0x14e'),_0x12e61b));var _0x525e97=this[_0x172b('0x7f')]['sync'](this,_0x361e45,_0x12e61b);if(_0x525e97){for(var _0x3d3907 in _0x525e97){if(_0x525e97[_0x172b('0x93')](_0x3d3907)){this[_0x172b('0xe')]['setVariable'](util[_0x172b('0x28')](_0x172b('0x14f'),_0x3d3907[_0x172b('0x66')]()),_0x525e97[_0x3d3907]);}}return this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x150'),JSON[_0x172b('0x70')](_0x525e97)));}}return _0x5a33b5;};AGIVertices[_0x172b('0x10')][_0x172b('0x151')]=function(_0x2f2719){logger[_0x172b('0x2e')](util['format'](_0x172b('0x152'),_0x2f2719[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x2f2719[_0x172b('0x78')])){return this['channel'][_0x172b('0xa9')](_0x172b('0xe9'));}if(!this[_0x172b('0x81')](_0x2f2719[_0x172b('0x5a')])){return this['channel'][_0x172b('0xa9')]('no\x20text\x20configured');}this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x153'),_0x2f2719[_0x172b('0x5a')]));var _0x791826=this['ispeechTTS'][_0x172b('0x6d')](this,_0x2f2719);if(_0x791826){this[_0x172b('0xe')]['noop'](util[_0x172b('0x28')](_0x172b('0x14e'),_0x791826));var _0x397c21=this['channel']['streamFile'](_0x791826,_0x2f2719[_0x172b('0x136')]);try{fs['unlink'](_0x791826+_0x172b('0x108'));}catch(_0x1ccb74){logger['error'](_0x1ccb74);}return _0x397c21;}return this[_0x172b('0xe')]['error'](_0x2f2719,_0x172b('0x154'));};AGIVertices['prototype'][_0x172b('0x155')]=function(_0x2fabba){logger[_0x172b('0x2e')](util[_0x172b('0x28')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x2fabba[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x2fabba[_0x172b('0x156')])){return this['channel'][_0x172b('0x2c')](_0x2fabba,_0x172b('0x157'));}logger['info'](util['format'](_0x172b('0x158'),this[_0x172b('0xe')][_0x172b('0x38')],_0x2fabba[_0x172b('0x156')]));var _0x4e0df2=this['agentLogin']['sync'](this,_0x2fabba[_0x172b('0x156')]);if(_0x4e0df2){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x159'),this[_0x172b('0xe')][_0x172b('0x38')],_0x2fabba[_0x172b('0x156')]));this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x159'),this[_0x172b('0xe')][_0x172b('0x38')],_0x2fabba['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x172b('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x172b('0x38')],_0x2fabba['findBy']));this[_0x172b('0xe')]['noop'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x2fabba[_0x172b('0x156')]));return{'code':0xc8,'result':_0x172b('0x15a')};}};AGIVertices['prototype'][_0x172b('0x15b')]=function(_0x25628e){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x15c'),_0x25628e[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x25628e[_0x172b('0x156')])){return this[_0x172b('0xe')]['error'](_0x25628e,_0x172b('0x157'));}logger['info'](util[_0x172b('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x172b('0xe')]['callerid'],_0x25628e[_0x172b('0x156')]));var _0x167287=this[_0x172b('0x4f')][_0x172b('0x6d')](this,_0x25628e[_0x172b('0x156')]);if(_0x167287){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x159'),this[_0x172b('0xe')][_0x172b('0x38')],_0x25628e[_0x172b('0x156')]));this[_0x172b('0xe')][_0x172b('0xa9')](util['format'](_0x172b('0x159'),this[_0x172b('0xe')][_0x172b('0x38')],_0x25628e['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x172b('0x2e')](util[_0x172b('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x172b('0xe')][_0x172b('0x38')],_0x25628e[_0x172b('0x156')]));this[_0x172b('0xe')][_0x172b('0xa9')](util['format'](_0x172b('0x15d'),this[_0x172b('0xe')]['callerid'],_0x25628e[_0x172b('0x156')]));return{'code':0xc8,'result':_0x172b('0x15a')};}};AGIVertices[_0x172b('0x10')]['math']=function(_0x2e346c){logger['info'](util['format'](_0x172b('0x15e'),_0x2e346c['label']));if(!this['isConfigured'](_0x2e346c[_0x172b('0x15f')])){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x2e346c,_0x172b('0x160'));}this['channel']['noop'](util[_0x172b('0x28')](_0x172b('0x161'),_0x2e346c[_0x172b('0x15f')]));var _0x853cb4=eval(_0x2e346c[_0x172b('0x15f')]);if(!this['isConfigured'](_0x2e346c[_0x172b('0xd6')])){return this[_0x172b('0xe')][_0x172b('0xa9')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x18a118=this['getVariable'][_0x172b('0x6d')](this,_0x2e346c[_0x172b('0xd6')]);if(!_0x18a118){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x2e346c,_0x172b('0x11c'));}if(_[_0x172b('0x99')](_0x853cb4)){var _0x54a6b9=this;_0x853cb4[_0x172b('0xd8')](function(_0x35d02c,_0x32f6ec){_0x54a6b9['channel']['setVariable'](util[_0x172b('0x28')](_0x172b('0x162'),_0x18a118,_0x32f6ec),_0x35d02c);});return this['channel'][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x163'),_0x18a118));}else{return this['channel'][_0x172b('0x9d')](_0x18a118,_0x853cb4);}};AGIVertices['prototype'][_0x172b('0xc')]=function(_0x17bfe1){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x164'),_0x17bfe1['label']));if(_0x17bfe1[_0x172b('0xa5')]===0x0){return this['maxRetry'](_0x17bfe1);}_0x17bfe1[_0x172b('0xa5')]-=0x1;if(!this[_0x172b('0x81')](_0x17bfe1[_0x172b('0x115')])){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x17bfe1,_0x172b('0x116'));}var _0x35af96=this['getSound'][_0x172b('0x6d')](this,_0x17bfe1[_0x172b('0x115')]);if(!_0x35af96){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x17bfe1,'no\x20file\x20audio\x20found');}var _0x2b9d0d=this[_0x172b('0xe')][_0x172b('0x118')](_0x35af96,_0x17bfe1['response'],_0x17bfe1[_0x172b('0x165')]);var _0x4e6693=_0x2b9d0d['result'];if(_0x2b9d0d[_0x172b('0xab')]===-0x1){this[_0x172b('0x36')][_0x172b('0x6d')](this,_0x17bfe1,'-1');return _0x2b9d0d;}else if(_0x2b9d0d[_0x172b('0xa3')]===_0x172b('0x62')){_0x2b9d0d['result']=_0x2b9d0d[_0x172b('0xab')][_0x172b('0x9a')]>0x0?_0x2b9d0d[_0x172b('0xab')]:'t';}else if(_[_0x172b('0x43')](_0x2b9d0d[_0x172b('0xab')])){_0x2b9d0d[_0x172b('0xab')]='#';_0x4e6693='#';}if(!this['isConfigured'](_0x17bfe1[_0x172b('0xd6')])){this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0xd7'));}else{var _0x150619=this['getVariable'][_0x172b('0x6d')](this,_0x17bfe1[_0x172b('0xd6')]);if(!_0x150619){return this['channel'][_0x172b('0x2c')](_0x17bfe1,_0x172b('0x11c'));}this[_0x172b('0xe')][_0x172b('0x9d')](_0x150619,_0x4e6693);}this['createSquareDetailsReport'][_0x172b('0x6d')](this,_0x17bfe1,_0x4e6693);return _0x2b9d0d;};AGIVertices[_0x172b('0x10')][_0x172b('0xa9')]=function(_0x4ec96f){logger[_0x172b('0x2e')](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x4ec96f[_0x172b('0xa8')]));return this[_0x172b('0xe')][_0x172b('0xa9')](_0x4ec96f[_0x172b('0x166')]||_0x4ec96f['label']);};AGIVertices['prototype'][_0x172b('0x167')]=function(_0x59f032){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x168'),_0x59f032[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x59f032[_0x172b('0x156')])){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x59f032,_0x172b('0x157'));}logger[_0x172b('0x2e')](util['format'](_0x172b('0x158'),this[_0x172b('0xe')][_0x172b('0x38')],_0x59f032[_0x172b('0x156')]));var _0xeef729=this['getPause'][_0x172b('0x6d')](this,_0x59f032[_0x172b('0x169')]);var _0x5a86ee=this['agentPause']['sync'](this,_0x59f032[_0x172b('0x156')],_0xeef729);if(_0x5a86ee){logger['info'](util[_0x172b('0x28')](_0x172b('0x159'),this['channel'][_0x172b('0x38')],_0x59f032['findBy']));this[_0x172b('0xe')][_0x172b('0xa9')](util['format'](_0x172b('0x159'),this['channel'][_0x172b('0x38')],_0x59f032[_0x172b('0x156')]));return{'code':0xc8,'result':_0x172b('0x16a')};}else{logger[_0x172b('0x2e')](util['format'](_0x172b('0x15d'),this[_0x172b('0xe')]['callerid'],_0x59f032[_0x172b('0x156')]));this['channel'][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x159'),this[_0x172b('0xe')][_0x172b('0x38')],_0x59f032[_0x172b('0x156')]));return{'code':0xc8,'result':_0x172b('0x15a')};}};AGIVertices[_0x172b('0x10')][_0x172b('0x16b')]=function(_0x13889d){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x16c'),_0x13889d[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x13889d[_0x172b('0x115')])){return this['channel'][_0x172b('0x2c')](_0x13889d,'no\x20file\x20audio\x20selected');}var _0x571299=this[_0x172b('0x1d')][_0x172b('0x6d')](this,_0x13889d[_0x172b('0x115')]);if(!_0x571299){return this[_0x172b('0xe')]['error'](_0x13889d,'no\x20file\x20audio\x20found');}var _0x202e52=this[_0x172b('0xe')][_0x172b('0x54')]('PLAYBACK',[_0x571299,_0x13889d[_0x172b('0xe5')]]);if(_0x202e52[_0x172b('0xab')]===-0x1){return _0x202e52;}return this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x16d'),_0x172b('0x16e'),_0x571299));};AGIVertices['prototype']['queue']=function(_0x270b8d){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x16f'),_0x270b8d[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x270b8d[_0x172b('0x170')])){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x270b8d,'no\x20queue\x20selected');}var _0x3e76b7='';var _0x9edd84=parseInt(_0x270b8d[_0x172b('0x170')],0xa);if(isNaN(_0x9edd84)){_0x3e76b7=_0x270b8d[_0x172b('0x170')];}else{_0x3e76b7=this[_0x172b('0x16')][_0x172b('0x6d')](this,_0x270b8d[_0x172b('0x170')]);if(!_0x3e76b7){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x270b8d,_0x172b('0x171'));}}var _0x1e1e5c='';if(this['isConfigured'](_0x270b8d[_0x172b('0x115')])){var _0x4e5041=this[_0x172b('0x1d')][_0x172b('0x6d')](this,_0x270b8d[_0x172b('0x115')]);if(_0x4e5041){_0x1e1e5c=_0x4e5041;}}this[_0x172b('0x36')]['sync'](this,_0x270b8d,_0x3e76b7);if(_0x270b8d[_0x172b('0xe5')]['indexOf']('x')<0x0){_0x270b8d[_0x172b('0xe5')]+='x';}if(_0x270b8d[_0x172b('0xe5')][_0x172b('0x172')]('X')<0x0){_0x270b8d[_0x172b('0xe5')]+='X';}this[_0x172b('0xe')]['setVariable'](_0x172b('0x173'),_0x3e76b7?_0x3e76b7[_0x172b('0x174')]():'');var _0x583441=this[_0x172b('0xe')][_0x172b('0x54')](_0x172b('0x175'),[_0x3e76b7,_0x270b8d['opts'],_0x270b8d['url'],_0x1e1e5c,_0x270b8d[_0x172b('0x62')],_0x270b8d['agi'],_0x270b8d[_0x172b('0x176')],_0x270b8d[_0x172b('0x177')],'',_0x270b8d[_0x172b('0x178')]]);if(_0x583441[_0x172b('0xab')]===-0x1){return _0x583441;}return this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x16d'),_0x172b('0x175'),_0x3e76b7));};AGIVertices['prototype'][_0x172b('0x179')]=function(_0xe38d9){logger[_0x172b('0x2e')](util[_0x172b('0x28')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0xe38d9[_0x172b('0xa8')]));var _0x5a4dfe=_0xe38d9[_0x172b('0x17a')]||_0x172b('0x133');var _0x5bc30d=util['format'](_0x172b('0x17b'),this[_0x172b('0xe')][_0x172b('0x3a')],rs[_0x172b('0x121')](0x5));var _0x5767d9=util[_0x172b('0x28')](_0x172b('0x17c'),FILES_PATH,_0x5bc30d,_0x5a4dfe);var _0x51c39a=util[_0x172b('0x28')]('%s/recordings/%s',FILES_PATH,_0x5bc30d);this['createSquareRecording']['sync'](this,_0xe38d9,_0x5bc30d,_0x5767d9);this[_0x172b('0xe')][_0x172b('0x9d')](_0x172b('0x17d'),_0x5bc30d);logger['info'](_0x172b('0x17e'),_0x51c39a,_0x5a4dfe,_0xe38d9[_0x172b('0x17f')],_0xe38d9['timeout']);return this[_0x172b('0xe')][_0x172b('0x180')](_0x51c39a,_0x5a4dfe,_0xe38d9[_0x172b('0x17f')],_0xe38d9[_0x172b('0x62')],undefined,!![]);};AGIVertices[_0x172b('0x10')]['restapi']=function(_0xe3cd4a){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x181'),_0xe3cd4a[_0x172b('0xa8')]));if(!this['isConfigured'](_0xe3cd4a[_0x172b('0x60')])){return this[_0x172b('0xe')]['noop'](_0x172b('0x182'));}var _0x2615f3=this[_0x172b('0x5f')][_0x172b('0x6d')](this,_0xe3cd4a);logger[_0x172b('0x2e')](util[_0x172b('0x28')]('Response:',util[_0x172b('0x183')](_0x2615f3,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0xe3cd4a[_0x172b('0xd6')])){return this[_0x172b('0xe')]['noop'](_0x172b('0x184'));}var _0x4dc66a=this[_0x172b('0x11')][_0x172b('0x6d')](this,_0xe3cd4a[_0x172b('0xd6')]);if(!_0x4dc66a){return this['channel'][_0x172b('0x2c')](_0xe3cd4a,_0x172b('0x11c'));}this[_0x172b('0xe')][_0x172b('0x9d')](util[_0x172b('0x28')]('%s_STATUS_CODE',_0x4dc66a),_0x2615f3[_0x172b('0x72')]?_0x2615f3['statusCode']:_0x172b('0x185'));this[_0x172b('0xe')][_0x172b('0x9d')](util[_0x172b('0x28')](_0x172b('0x186'),_0x4dc66a),_0x2615f3['statusMessage']?_0x2615f3['statusMessage']:'OK');if(_0x2615f3['body']){try{this[_0x172b('0x9b')](_0x2615f3[_0x172b('0x71')],_0x4dc66a);}catch(_0x22f589){logger['error'](util['format'](_0x172b('0x187'),_0x4dc66a));}}return this['channel'][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0xdc'),_0x4dc66a));};AGIVertices[_0x172b('0x10')]['saydigits']=function(_0x194089){logger[_0x172b('0x2e')](util[_0x172b('0x28')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x194089[_0x172b('0xa8')]));return this[_0x172b('0xe')][_0x172b('0x188')](_0x194089['digits'][_0x172b('0x56')](/\s+/g,''),_0x194089[_0x172b('0x17f')]);};AGIVertices[_0x172b('0x10')][_0x172b('0x189')]=function(_0xbd0dd8){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x18a'),_0xbd0dd8[_0x172b('0xa8')]));return this[_0x172b('0xe')][_0x172b('0x18b')](_0xbd0dd8[_0x172b('0x63')][_0x172b('0x56')](/\s+/g,''),_0xbd0dd8['escape_digits']);};AGIVertices[_0x172b('0x10')][_0x172b('0x18c')]=function(_0x4da201){logger['info'](util[_0x172b('0x28')](_0x172b('0x18d'),_0x4da201['label']));return this[_0x172b('0xe')][_0x172b('0x18e')](_0x4da201[_0x172b('0x5a')],_0x4da201['escape_digits']);};AGIVertices[_0x172b('0x10')][_0x172b('0x18f')]=function(_0x56639c){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x190'),_0x56639c[_0x172b('0xa8')]));if(!this['isConfigured'](_0x56639c[_0x172b('0x191')])){return this[_0x172b('0xe')][_0x172b('0xa9')]('no\x20mail\x20account\x20configured');}var _0x5ca8a4=this[_0x172b('0x21')][_0x172b('0x6d')](this,_0x56639c[_0x172b('0x191')]);if(!_0x5ca8a4||!_0x5ca8a4[_0x172b('0x192')]){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x56639c,'no\x20mail\x20account\x20found');}var _0x148ffb={'from':util[_0x172b('0x28')](_0x172b('0x193'),_0x5ca8a4[_0x172b('0x14')],_0x5ca8a4[_0x172b('0x194')]||_0x5ca8a4[_0x172b('0x192')]['user']),'to':_0x56639c['to']||'','cc':_0x56639c['cc']||'','bcc':_0x56639c[_0x172b('0x195')]||'','subject':_0x56639c[_0x172b('0x196')],'html':_0x56639c['text'],'text':_0x56639c['text']};if(this['isConfigured'](_0x56639c[_0x172b('0x197')])){}logger[_0x172b('0xde')]('sendMail\x20message',JSON[_0x172b('0x70')](_0x148ffb));this[_0x172b('0x36')]['sync'](this,_0x56639c,_0x56639c[_0x172b('0x191')]);this['channel'][_0x172b('0xa9')](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x5ca8a4[_0x172b('0x14')]));this['sendMailMessage'][_0x172b('0x6d')](this,_0x5ca8a4[_0x172b('0x198')],_0x148ffb);return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0x199'));};AGIVertices[_0x172b('0x10')]['sendFax']=function(_0x50f780){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x19a'),_0x50f780['label']));return this[_0x172b('0xe')]['noop'](_0x172b('0x19b'));};AGIVertices[_0x172b('0x10')]['sendSMS']=function(_0x4e68df){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x19c'),_0x4e68df[_0x172b('0xa8')]));if(!this['isConfigured'](_0x4e68df['sms_account_id'])){return this[_0x172b('0xe')]['noop'](_0x172b('0x19d'));}var _0x37c184=this[_0x172b('0x19e')][_0x172b('0x6d')](this,_0x4e68df['sms_account_id']);if(!_0x37c184){return this[_0x172b('0xe')]['error'](_0x4e68df,_0x172b('0x19f'));}var _0x1de3d2={'body':_0x4e68df[_0x172b('0x1a0')],'phone':_0x4e68df['to']||'','SmsAccountId':_0x37c184['id']};logger[_0x172b('0xde')](_0x172b('0x1a1'),JSON['stringify'](_0x1de3d2));this[_0x172b('0x36')][_0x172b('0x6d')](this,_0x4e68df,_0x4e68df[_0x172b('0x1a2')]);this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x37c184[_0x172b('0x14')]));this['createSmsMessage'][_0x172b('0x6d')](this,_0x1de3d2);return this['channel']['noop'](_0x172b('0x1a3'));};AGIVertices[_0x172b('0x10')][_0x172b('0x1a4')]=function(_0x3ca8f5){logger[_0x172b('0x2e')](util['format'](_0x172b('0x1a5'),_0x3ca8f5[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x3ca8f5[_0x172b('0xd6')])){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x3ca8f5,_0x172b('0x1a6'));}var _0x3f6f23=this[_0x172b('0x11')][_0x172b('0x6d')](this,_0x3ca8f5[_0x172b('0xd6')]);if(!_0x3f6f23){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x3ca8f5,_0x172b('0x11c'));}return this[_0x172b('0xe')][_0x172b('0x9d')](_0x3f6f23,_0x3ca8f5[_0x172b('0x1a7')]);};AGIVertices[_0x172b('0x10')]['start']=function(_0x44653c){logger['info'](util[_0x172b('0x28')](_0x172b('0x1a8'),_0x44653c[_0x172b('0xa8')]));this['channel'][_0x172b('0xa9')](_0x172b('0x1a9'));var _0x21f6d0=this['channel'][_0x172b('0x11')](_0x172b('0x1aa'));if(!_[_0x172b('0x43')](_0x21f6d0['extra'])){this[_0x172b('0xe')][_0x172b('0x3a')]=_0x21f6d0['extra'];}if(_0x44653c[_0x172b('0xb8')]==='yes'){this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0x1ab'));return this[_0x172b('0xe')]['answer']();}return this['channel'][_0x172b('0xa9')](_0x172b('0x1ac'));};AGIVertices[_0x172b('0x10')][_0x172b('0x1ad')]=function(_0x20b324){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x1ae'),_0x20b324[_0x172b('0xa8')]));if(!this['isConfigured'](_0x20b324[_0x172b('0x1af')])){return this[_0x172b('0xe')]['error'](_0x20b324,_0x172b('0x1b0'));}var _0x45f787=this[_0x172b('0x17')][_0x172b('0x6d')](this,_0x20b324[_0x172b('0x1af')]);if(!this[_0x172b('0x81')](_0x45f787)){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x20b324,util[_0x172b('0x28')](_0x172b('0x1b1'),_0x20b324[_0x172b('0x1af')]));}if(_0x45f787===this[_0x172b('0xe')][_0x172b('0x3f')]){return this['channel'][_0x172b('0x2c')](_0x20b324,_0x172b('0x1b2'));}this[_0x172b('0x36')]['sync'](this,_0x20b324,_0x45f787);var _0x1218b4=this[_0x172b('0xe')][_0x172b('0x54')](_0x172b('0x1b3'),util[_0x172b('0x28')](_0x172b('0x1b4'),config[_0x172b('0xb4')][_0x172b('0x1b5')]||_0x172b('0x1b6'),_0x45f787,this[_0x172b('0xe')][_0x172b('0x3f')]));if(_0x1218b4[_0x172b('0xab')]===-0x1){return _0x1218b4;}return this[_0x172b('0xe')][_0x172b('0xa9')](util['format']('Executed\x20command\x20%s\x20%s',_0x172b('0x1b3'),_0x45f787));};AGIVertices[_0x172b('0x10')]['system']=function(_0x597b1c){logger[_0x172b('0x2e')](util['format'](_0x172b('0x1b7'),_0x597b1c['label']));var _0x3a72c5=this[_0x172b('0x53')][_0x172b('0x6d')](this,_0x597b1c[_0x172b('0xb6')]);this[_0x172b('0x36')]['sync'](this,_0x597b1c,_0x597b1c['command']);if(this[_0x172b('0x81')](_0x597b1c[_0x172b('0xd6')])){var _0xdd208a=this[_0x172b('0x11')][_0x172b('0x6d')](this,_0x597b1c[_0x172b('0xd6')]);if(_0xdd208a){this['channel'][_0x172b('0x9d')](_0xdd208a,_0x3a72c5);return this['channel'][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x1b8'),_0x597b1c[_0x172b('0xb6')],_0xdd208a));}}return this[_0x172b('0xe')]['noop'](util[_0x172b('0x28')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x597b1c[_0x172b('0xb6')]));};AGIVertices[_0x172b('0x10')][_0x172b('0x1b9')]=function(_0xdf52a0){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x1ba'),_0xdf52a0[_0x172b('0xa8')]));_0xdf52a0[_0x172b('0x5a')]=_0xdf52a0[_0x172b('0x5a')][_0x172b('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0xdf52a0['apiKey'])){return this['channel'][_0x172b('0xa9')](_0x172b('0x1bb'));}if(!this[_0x172b('0x81')](_0xdf52a0[_0x172b('0x5a')])){return this[_0x172b('0xe')][_0x172b('0xa9')]('no\x20text\x20configured');}this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x1bc'),_0xdf52a0['text']));var _0x2e93af=this['googleCloudTTS'][_0x172b('0x6d')](this,_0xdf52a0);if(_0x2e93af){this[_0x172b('0xe')][_0x172b('0xa9')](util['format'](_0x172b('0x1bd'),_0x2e93af));var _0x3ca278=this['channel']['streamFile'](_0x2e93af);try{fs[_0x172b('0x107')](_0x2e93af+'.wav');}catch(_0x304580){logger[_0x172b('0x2c')](_0x304580);}return _0x3ca278;}return this[_0x172b('0xe')]['error'](_0xdf52a0,_0x172b('0x1be'));};AGIVertices[_0x172b('0x10')][_0x172b('0x1bf')]=function(_0x2b2625){logger['info'](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x2b2625['label']));_0x2b2625['text']=_0x2b2625[_0x172b('0x5a')][_0x172b('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x172b('0x81')](_0x2b2625[_0x172b('0x5a')])){return this[_0x172b('0xe')]['noop'](_0x172b('0xaa'));}this[_0x172b('0xe')][_0x172b('0xa9')](util['format'](_0x172b('0x1c0'),_0x2b2625[_0x172b('0x5a')]));var _0x349484=this[_0x172b('0x1c1')]['sync'](this,_0x2b2625);if(_0x349484){this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x1c2'),_0x349484));var _0x431f84=this['channel'][_0x172b('0x106')](_0x349484);try{fs[_0x172b('0x107')](_0x349484+'.wav');}catch(_0x3e098e){logger[_0x172b('0x2c')](_0x3e098e);}return _0x431f84;}return this[_0x172b('0xe')][_0x172b('0x2c')](_0x2b2625,_0x172b('0x1c3'));};AGIVertices[_0x172b('0x10')][_0x172b('0x1c4')]=function(_0x7db1f1){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x1c5'),_0x7db1f1['label']));if(!this['isConfigured'](_0x7db1f1[_0x172b('0x156')])){return this['channel'][_0x172b('0x2c')](_0x7db1f1,_0x172b('0x157'));}logger['info'](util[_0x172b('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x172b('0xe')][_0x172b('0x38')],_0x7db1f1[_0x172b('0x156')]));var _0x1a41bb=this[_0x172b('0x4e')][_0x172b('0x6d')](this,_0x7db1f1[_0x172b('0x156')]);if(_0x1a41bb){logger[_0x172b('0x2e')](util['format'](_0x172b('0x159'),this[_0x172b('0xe')][_0x172b('0x38')],_0x7db1f1[_0x172b('0x156')]));this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x159'),this[_0x172b('0xe')][_0x172b('0x38')],_0x7db1f1[_0x172b('0x156')]));return{'code':0xc8,'result':'success'};}else{logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x15d'),this[_0x172b('0xe')][_0x172b('0x38')],_0x7db1f1[_0x172b('0x156')]));this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x172b('0xe')][_0x172b('0x38')],_0x7db1f1['findBy']));return{'code':0xc8,'result':_0x172b('0x15a')};}};AGIVertices[_0x172b('0x10')]['voicemail']=function(_0x28d10a){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x1c6'),_0x28d10a[_0x172b('0xa8')]));var _0x3cddc5=this[_0x172b('0xe')][_0x172b('0x54')]('VOICEMAIL',[_0x28d10a['mailbox'],_0x28d10a[_0x172b('0x76')]]);if(_0x3cddc5[_0x172b('0xab')]===-0x1){return _0x3cddc5;}return this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x16d'),_0x172b('0x1c7'),_0x28d10a['mailbox']));};AGIVertices[_0x172b('0x10')][_0x172b('0x1c8')]=function(_0x3b669d){logger[_0x172b('0x2e')](util[_0x172b('0x28')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x3b669d['label']));if(!this[_0x172b('0x81')](_0x3b669d[_0x172b('0xd6')])){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x3b669d,_0x172b('0x1a6'));}var _0x3032bf=this['getVariable']['sync'](this,_0x3b669d[_0x172b('0xd6')]);if(!_0x3032bf){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x3b669d,'no\x20variable\x20found');}var _0x11d357=this[_0x172b('0xe')]['getVariable'](_0x3032bf);return{'code':0xc8,'result':_0x11d357[_0x172b('0xa3')]?_0x11d357[_0x172b('0xa3')]:'-'};};String[_0x172b('0x10')][_0x172b('0x9f')]=function(_0x2e23e3,_0x369582){return this[_0x172b('0x9e')](_0x2e23e3)[_0x172b('0x1c9')](_0x369582);};module[_0x172b('0x1ca')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index cafa459..be31d6c 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 _0xb1dd=['attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','update','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','finally','queue','ACW','mandatoryDisposition','name','mandatoryDispositionPause','Action','QueuePause','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','[ACW][START]\x20%s','message','stopAcw','[%s][TIMER][STOP][AGENT:%s]','[ACW][TIMERS]','acw','interface','destlinkedid','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','startAcw','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','origtransfereruniqueid','transfereeuniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','stringify','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','moment','../ami','../../../config/logger','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0xb1dd,0x9b));var _0xdb1d=function(_0x4a7eeb,_0x328fba){_0x4a7eeb=_0x4a7eeb-0x0;var _0x294879=_0xb1dd[_0x4a7eeb];return _0x294879;};'use strict';var _=require('lodash');var moment=require(_0xdb1d('0x0'));var ami=require(_0xdb1d('0x1'));var logger=require(_0xdb1d('0x2'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xdb1d('0x3'));function Acw(_0xe7606b){this[_0xdb1d('0x4')]=_0xe7606b[_0xdb1d('0x4')];this[_0xdb1d('0x5')]=_0xe7606b['agents'];this[_0xdb1d('0x6')]=_0xe7606b['timers'];this[_0xdb1d('0x7')]={};ami['on']('agentconnect',this[_0xdb1d('0x8')][_0xdb1d('0x9')](this));ami['on'](_0xdb1d('0xa'),this[_0xdb1d('0xb')][_0xdb1d('0x9')](this));ami['on']('hangup',this[_0xdb1d('0xc')][_0xdb1d('0x9')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0xdb1d('0x9')](this));ami['on'](_0xdb1d('0xd'),this[_0xdb1d('0xe')][_0xdb1d('0x9')](this));ami['on'](_0xdb1d('0xf'),this[_0xdb1d('0x10')][_0xdb1d('0x9')](this));ami['on'](_0xdb1d('0x11'),this[_0xdb1d('0x12')][_0xdb1d('0x9')](this));}function getDiff(_0x268f8b){var _0x11eccc=moment()[_0xdb1d('0x13')](0x0);var _0x3378db=moment(_0x268f8b)[_0xdb1d('0x13')](0x0);return _0x11eccc[_0xdb1d('0x14')](_0x3378db,_0xdb1d('0x15'));}Acw[_0xdb1d('0x16')][_0xdb1d('0x17')]=function(_0x491f98,_0x16bb14){var _0x52c495=this;var _0x3c6a96=getDiff(_0x52c495[_0xdb1d('0x6')][_0x491f98][_0xdb1d('0x18')]);clearTimeout(_0x52c495[_0xdb1d('0x6')][_0x491f98][_0xdb1d('0x19')]);_0x52c495[_0xdb1d('0x6')][_0x491f98][_0xdb1d('0x19')]=![];return RpcVoiceAgentReport[_0xdb1d('0x1a')]({'acwtime':_0x3c6a96},_0x52c495[_0xdb1d('0x6')][_0x491f98]['uniqueid'],_0x491f98)[_0xdb1d('0x1b')](function(_0x126830){logger[_0xdb1d('0x1c')](_0xdb1d('0x1d'),_0x16bb14,_0x3c6a96,_0x126830);})[_0xdb1d('0x1e')](function(_0x57d01a){logger[_0xdb1d('0x1f')]('[%s][UPDATE][ERRORS:%s]',_0x16bb14,_0x57d01a);})[_0xdb1d('0x20')](function(){delete _0x52c495[_0xdb1d('0x6')][_0x491f98];});};Acw[_0xdb1d('0x16')]['startAcw']=function(_0x1745cb){try{var _0x3f819c=this;var _0x54813d=this[_0xdb1d('0x7')][_0x1745cb]['interface'];var _0x4d1cae=this[_0xdb1d('0x7')][_0x1745cb][_0xdb1d('0x21')];var _0x5beced=this[_0xdb1d('0x4')][_0x4d1cae];var _0x45be96=![];var _0x2de8b4=_0xdb1d('0x22');if(_0x5beced[_0xdb1d('0x23')]&&_0x5beced['mandatoryDispositionPause'][_0xdb1d('0x24')]){_0x45be96=!![];_0x2de8b4=_0x5beced[_0xdb1d('0x25')][_0xdb1d('0x24')];}return ami[_0xdb1d('0x26')]({'action':_0xdb1d('0x27'),'interface':_0x54813d,'paused':!![],'reason':_0x2de8b4})['then'](function(){if(_0x3f819c[_0xdb1d('0x5')][_0x54813d]){return RpcUser[_0xdb1d('0x28')](_0x3f819c[_0xdb1d('0x5')][_0x54813d]['id'])[_0xdb1d('0x1b')](function(_0x4ec640){if(!_0x4ec640||_0x4ec640[_0xdb1d('0x29')]){logger[_0xdb1d('0x1c')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x1745cb,_0x54813d,_0x4d1cae);return;}logger[_0xdb1d('0x1c')](_0xdb1d('0x2a'),_0x1745cb,_0x54813d,_0x4d1cae);var _0x322946=_0x3f819c[_0xdb1d('0x7')][_0x1745cb]['attended']&&_0x3f819c['channels'][_0x1745cb]['destlinkedid']?_0x3f819c['channels'][_0x1745cb]['destlinkedid']:_0x1745cb;return RpcUser[_0xdb1d('0x2b')](_0x3f819c[_0xdb1d('0x5')][_0x54813d],_0x2de8b4,_0x322946)[_0xdb1d('0x1b')](function(_0x3c4d12){_0x3f819c['voiceQueues'][_0x4d1cae]['available']-=0x1;_0x3f819c[_0xdb1d('0x4')][_0x4d1cae]['paused']+=0x1;return _0x3c4d12;});})['then'](function(_0x1f24e0){if(_0x45be96||!_0x1f24e0){return;}_0x3f819c[_0xdb1d('0x6')][_0x54813d]={};logger[_0xdb1d('0x1c')](_0xdb1d('0x2c'),_0x1745cb,_0x3f819c['voiceQueues'][_0x4d1cae]['acwTimeout'],_0x54813d,_0x4d1cae);_0x3f819c[_0xdb1d('0x6')][_0x54813d]['timer']=setTimeout(_0x3f819c['stopAcw'][_0xdb1d('0x9')](_0x3f819c,_0x54813d),_0x3f819c[_0xdb1d('0x4')][_0x4d1cae][_0xdb1d('0x2d')]*0x3e8);_0x3f819c[_0xdb1d('0x6')][_0x54813d]['lastPauseAt']=moment()[_0xdb1d('0x2e')](_0xdb1d('0x2f'));_0x3f819c[_0xdb1d('0x6')][_0x54813d][_0xdb1d('0x30')]=_0x1745cb;_0x3f819c['timers'][_0x54813d][_0xdb1d('0x21')]=_0x4d1cae;_0x3f819c['timers'][_0x54813d][_0xdb1d('0x17')]=_0x3f819c[_0xdb1d('0x17')][_0xdb1d('0x9')](_0x3f819c,_0x54813d,_0x1745cb);});}})[_0xdb1d('0x1e')](function(){logger['error'](_0xdb1d('0x2c'),_0x1745cb,_0x3f819c[_0xdb1d('0x4')][_0x4d1cae][_0xdb1d('0x2d')],_0x54813d,_0x4d1cae);})[_0xdb1d('0x20')](function(){delete _0x3f819c[_0xdb1d('0x7')][_0x1745cb];});}catch(_0x33d0c0){logger['error'](_0xdb1d('0x31'),_0x33d0c0[_0xdb1d('0x32')]);}};Acw['prototype'][_0xdb1d('0x33')]=function(_0x315a0f){try{var _0x35bb2c=this;if(_0x35bb2c[_0xdb1d('0x6')][_0x315a0f]){_0x35bb2c[_0xdb1d('0x6')][_0x315a0f]['timer']=![];var _0x45886f=_0x35bb2c[_0xdb1d('0x6')][_0x315a0f][_0xdb1d('0x30')];var _0x1474f7=_0x35bb2c[_0xdb1d('0x6')][_0x315a0f]['queue'];var _0x5c5e8c=_0x35bb2c['voiceQueues'][_0x1474f7][_0xdb1d('0x2d')];logger[_0xdb1d('0x1c')](_0xdb1d('0x34'),_0x45886f,_0x315a0f);RpcUser[_0xdb1d('0x28')](this[_0xdb1d('0x5')][_0x315a0f]['id'])[_0xdb1d('0x1b')](function(_0x4fcfa1){if(_0x4fcfa1['pauseType']===_0xdb1d('0x22')){return RpcUser['saveUnpause'](_0x35bb2c[_0xdb1d('0x5')][_0x315a0f]);}});RpcVoiceAgentReport[_0xdb1d('0x1a')]({'acwtime':_0x5c5e8c,'agentacw':!![]},_0x45886f,_0x315a0f)[_0xdb1d('0x1b')](function(_0x30e9a1){logger[_0xdb1d('0x1c')]('[%s][UPDATE][ACWTIME:%s]',_0x45886f,_0x5c5e8c,_0x30e9a1);})[_0xdb1d('0x1e')](function(_0x565e18){logger[_0xdb1d('0x1f')]('[%s][UPDATE][ERRORS:%s]',_0x45886f,_0x565e18);});}else{logger[_0xdb1d('0x1f')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x315a0f);if(_0x35bb2c[_0xdb1d('0x6')]){logger['info'](_0xdb1d('0x35'),JSON['stringify'](_0x35bb2c[_0xdb1d('0x6')]));}}}catch(_0x31860c){logger[_0xdb1d('0x1f')]('[ACW][STOP]\x20%s',_0x31860c[_0xdb1d('0x32')]);}};Acw[_0xdb1d('0x16')][_0xdb1d('0x8')]=function(_0x1b3aca){try{if(this[_0xdb1d('0x4')][_0x1b3aca[_0xdb1d('0x21')]]&&(this['voiceQueues'][_0x1b3aca[_0xdb1d('0x21')]][_0xdb1d('0x36')]||this['voiceQueues'][_0x1b3aca[_0xdb1d('0x21')]][_0xdb1d('0x23')])){if(this[_0xdb1d('0x5')][_0x1b3aca[_0xdb1d('0x37')]]){this[_0xdb1d('0x7')][_0x1b3aca[_0xdb1d('0x30')]]={'queue':_0x1b3aca[_0xdb1d('0x21')],'interface':_0x1b3aca['interface'],'destlinkedid':_0x1b3aca[_0xdb1d('0x38')]};}}}catch(_0x1d4002){logger[_0xdb1d('0x1f')](_0xdb1d('0x39'),_0x1d4002['message']);}};Acw['prototype'][_0xdb1d('0x12')]=function(_0x2b20a9){try{if(this[_0xdb1d('0x4')][_0x2b20a9[_0xdb1d('0x21')]]&&(this['voiceQueues'][_0x2b20a9['queue']][_0xdb1d('0x36')]||this['voiceQueues'][_0x2b20a9[_0xdb1d('0x21')]][_0xdb1d('0x23')])){if(this[_0xdb1d('0x5')][_0x2b20a9[_0xdb1d('0x37')]]){this[_0xdb1d('0x7')][_0x2b20a9['uniqueid']]={'queue':_0x2b20a9[_0xdb1d('0x21')],'interface':_0x2b20a9['interface']};}}}catch(_0x38445d){logger[_0xdb1d('0x1f')](_0xdb1d('0x3a'),_0x38445d[_0xdb1d('0x32')]);}};Acw['prototype'][_0xdb1d('0xb')]=function(_0x371b80){try{if(this[_0xdb1d('0x7')][_0x371b80['uniqueid']]&&_[_0xdb1d('0x3b')](this[_0xdb1d('0x7')][_0x371b80['uniqueid']][_0xdb1d('0x3c')])){logger[_0xdb1d('0x1c')](_0xdb1d('0x3d'),_0x371b80[_0xdb1d('0x30')]);this['startAcw'](_0x371b80[_0xdb1d('0x30')]);}else if(this[_0xdb1d('0x7')][_0x371b80[_0xdb1d('0x3e')]]&&_[_0xdb1d('0x3b')](this[_0xdb1d('0x7')][_0x371b80['linkedid']][_0xdb1d('0x3c')])){logger[_0xdb1d('0x1c')](_0xdb1d('0x3f'),_0x371b80['linkedid']);this['startAcw'](_0x371b80[_0xdb1d('0x3e')]);}}catch(_0x3c141f){logger[_0xdb1d('0x1f')](_0xdb1d('0x40'),_0x3c141f[_0xdb1d('0x32')]);}};Acw[_0xdb1d('0x16')][_0xdb1d('0xc')]=function(_0x53540a){try{if(this[_0xdb1d('0x7')][_0x53540a[_0xdb1d('0x30')]]&&this[_0xdb1d('0x7')][_0x53540a[_0xdb1d('0x30')]]['attended']){logger[_0xdb1d('0x1c')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x53540a['uniqueid']);this[_0xdb1d('0x41')](_0x53540a[_0xdb1d('0x30')]);}else if(this[_0xdb1d('0x7')][_0x53540a[_0xdb1d('0x3e')]]&&this['channels'][_0x53540a['linkedid']]['attended']){logger[_0xdb1d('0x1c')](_0xdb1d('0x42'),_0x53540a[_0xdb1d('0x3e')]);this[_0xdb1d('0x41')](_0x53540a[_0xdb1d('0x3e')]);}}catch(_0x70a2f5){logger[_0xdb1d('0x1f')]('[ACW][syncHangup]\x20%s',_0x70a2f5[_0xdb1d('0x32')]);}};Acw['prototype'][_0xdb1d('0xe')]=function(_0x392a7d){try{if(!_[_0xdb1d('0x43')](this[_0xdb1d('0x7')][_0x392a7d['transfereeuniqueid']])){this[_0xdb1d('0x41')](_0x392a7d['transfereeuniqueid']);if(this[_0xdb1d('0x7')][_0x392a7d[_0xdb1d('0x44')]]){this[_0xdb1d('0x7')][_0x392a7d[_0xdb1d('0x44')]][_0xdb1d('0x3c')]=!![];this[_0xdb1d('0x7')][_0x392a7d[_0xdb1d('0x45')]]=this[_0xdb1d('0x7')][_0x392a7d[_0xdb1d('0x44')]];this[_0xdb1d('0x46')](_0x392a7d['secondtransfereruniqueid']);}}else if(!_[_0xdb1d('0x43')](this[_0xdb1d('0x7')][_0x392a7d[_0xdb1d('0x45')]])){this[_0xdb1d('0x41')](_0x392a7d['transfertargetuniqueid']);if(this[_0xdb1d('0x7')][_0x392a7d[_0xdb1d('0x47')]]){this[_0xdb1d('0x7')][_0x392a7d[_0xdb1d('0x47')]][_0xdb1d('0x3c')]=!![];this[_0xdb1d('0x7')][_0x392a7d[_0xdb1d('0x48')]]=this['channels'][_0x392a7d['origtransfereruniqueid']];this['deleteChannelAfterTimeout'](_0x392a7d[_0xdb1d('0x47')]);}}}catch(_0x1b0cb0){logger[_0xdb1d('0x1f')](_0xdb1d('0x49'),_0x1b0cb0[_0xdb1d('0x32')]);}};Acw[_0xdb1d('0x16')][_0xdb1d('0x10')]=function(_0x59d3a3){try{if(this[_0xdb1d('0x7')][_0x59d3a3[_0xdb1d('0x4a')]]){logger['info'](_0xdb1d('0x4b'),JSON['stringify'](_0x59d3a3['transfereruniqueid']));this[_0xdb1d('0x41')](_0x59d3a3[_0xdb1d('0x4a')]);}else if(this[_0xdb1d('0x7')][_0x59d3a3[_0xdb1d('0x4c')]]){logger[_0xdb1d('0x1c')](_0xdb1d('0x4d'),JSON[_0xdb1d('0x4e')](_0x59d3a3[_0xdb1d('0x4c')]));this['startAcw'](_0x59d3a3[_0xdb1d('0x4c')]);}}catch(_0x3c2e01){logger[_0xdb1d('0x1f')](_0xdb1d('0x4f'),_0x3c2e01['message']);}};Acw['prototype'][_0xdb1d('0x50')]=function(_0x226820){try{if(this[_0xdb1d('0x4')][_0x226820[_0xdb1d('0x21')]]&&this[_0xdb1d('0x4')][_0x226820[_0xdb1d('0x21')]][_0xdb1d('0x51')]==='all'){if(this[_0xdb1d('0x5')][_0x226820[_0xdb1d('0x37')]]){logger['info']('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x226820[_0xdb1d('0x30')],_0x226820[_0xdb1d('0x37')],_0x226820[_0xdb1d('0x21')]);return RpcUser['savePause'](this['agents'][_0x226820['interface']],_0xdb1d('0x52'),_0x226820[_0xdb1d('0x30')]);}}}catch(_0x19f0ea){logger[_0xdb1d('0x1f')](_0xdb1d('0x53'),_0x19f0ea[_0xdb1d('0x32')]);}};Acw[_0xdb1d('0x16')][_0xdb1d('0x46')]=function(_0x47cdd2,_0xa813b=0x2710){if(this[_0xdb1d('0x7')][_0x47cdd2]){setTimeout(()=>{delete this['channels'][_0x47cdd2];},_0xa813b);}};module['exports']=Acw; \ No newline at end of file +var _0x7c29=['[%s][UPDATE][ERRORS:%s]','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','available','paused','acwTimeout','stopAcw','lastPauseAt','queue','finally','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','pauseType','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','message','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','isNil','origtransfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','timer','update','uniqueid','info','catch','error'];(function(_0x1ab0e6,_0x17ba8d){var _0x248815=function(_0x5d2b40){while(--_0x5d2b40){_0x1ab0e6['push'](_0x1ab0e6['shift']());}};_0x248815(++_0x17ba8d);}(_0x7c29,0x14a));var _0x97c2=function(_0x136b08,_0x163ae6){_0x136b08=_0x136b08-0x0;var _0x3fcac8=_0x7c29[_0x136b08];return _0x3fcac8;};'use strict';var _=require(_0x97c2('0x0'));var moment=require(_0x97c2('0x1'));var ami=require(_0x97c2('0x2'));var logger=require(_0x97c2('0x3'))(_0x97c2('0x4'));var RpcUser=require(_0x97c2('0x5'));var RpcVoiceAgentReport=require(_0x97c2('0x6'));function Acw(_0x261f5d){this[_0x97c2('0x7')]=_0x261f5d[_0x97c2('0x7')];this[_0x97c2('0x8')]=_0x261f5d['agents'];this['timers']=_0x261f5d[_0x97c2('0x9')];this[_0x97c2('0xa')]={};ami['on'](_0x97c2('0xb'),this[_0x97c2('0xc')][_0x97c2('0xd')](this));ami['on'](_0x97c2('0xe'),this['syncHangupRequest']['bind'](this));ami['on'](_0x97c2('0xf'),this['syncHangup']['bind'](this));ami['on'](_0x97c2('0x10'),this[_0x97c2('0x11')][_0x97c2('0xd')](this));ami['on'](_0x97c2('0x12'),this[_0x97c2('0x13')][_0x97c2('0xd')](this));ami['on'](_0x97c2('0x14'),this[_0x97c2('0x15')][_0x97c2('0xd')](this));ami['on'](_0x97c2('0x16'),this['syncAgentConnectPreview'][_0x97c2('0xd')](this));}function getDiff(_0x1e6b26){var _0xcc9971=moment()[_0x97c2('0x17')](0x0);var _0x222766=moment(_0x1e6b26)[_0x97c2('0x17')](0x0);return _0xcc9971[_0x97c2('0x18')](_0x222766,_0x97c2('0x19'));}Acw[_0x97c2('0x1a')][_0x97c2('0x1b')]=function(_0x3227b7,_0x4c1e12){var _0x101e6f=this;var _0x5305ee=getDiff(_0x101e6f[_0x97c2('0x9')][_0x3227b7]['lastPauseAt']);clearTimeout(_0x101e6f[_0x97c2('0x9')][_0x3227b7][_0x97c2('0x1c')]);_0x101e6f[_0x97c2('0x9')][_0x3227b7][_0x97c2('0x1c')]=![];return RpcVoiceAgentReport[_0x97c2('0x1d')]({'acwtime':_0x5305ee},_0x101e6f[_0x97c2('0x9')][_0x3227b7][_0x97c2('0x1e')],_0x3227b7)['then'](function(_0x204418){logger[_0x97c2('0x1f')]('[%s][UPDATE][ACWTIME:%s]',_0x4c1e12,_0x5305ee,_0x204418);})[_0x97c2('0x20')](function(_0x333192){logger[_0x97c2('0x21')](_0x97c2('0x22'),_0x4c1e12,_0x333192);})['finally'](function(){delete _0x101e6f[_0x97c2('0x9')][_0x3227b7];});};Acw[_0x97c2('0x1a')][_0x97c2('0x23')]=function(_0x4fc6eb){try{var _0x325d69=this;var _0x8a8359=this[_0x97c2('0xa')][_0x4fc6eb][_0x97c2('0x24')];var _0x2093f5=this[_0x97c2('0xa')][_0x4fc6eb]['queue'];var _0x5772ba=this[_0x97c2('0x7')][_0x2093f5];var _0x4f48a1=![];var _0x1299fb=_0x97c2('0x25');if(_0x5772ba[_0x97c2('0x26')]&&_0x5772ba[_0x97c2('0x27')][_0x97c2('0x28')]){_0x4f48a1=!![];_0x1299fb=_0x5772ba[_0x97c2('0x27')]['name'];}return ami['Action']({'action':_0x97c2('0x29'),'interface':_0x8a8359,'paused':!![],'reason':_0x1299fb})[_0x97c2('0x2a')](function(){if(_0x325d69[_0x97c2('0x8')][_0x8a8359]){return RpcUser[_0x97c2('0x2b')](_0x325d69[_0x97c2('0x8')][_0x8a8359]['id'])[_0x97c2('0x2a')](function(_0x32d869){if(!_0x32d869||_0x32d869[_0x97c2('0x2c')]){logger['info'](_0x97c2('0x2d'),_0x4fc6eb,_0x8a8359,_0x2093f5);return;}logger[_0x97c2('0x1f')](_0x97c2('0x2e'),_0x4fc6eb,_0x8a8359,_0x2093f5);var _0x2af643=_0x325d69[_0x97c2('0xa')][_0x4fc6eb][_0x97c2('0x2f')]&&_0x325d69[_0x97c2('0xa')][_0x4fc6eb]['destlinkedid']?_0x325d69[_0x97c2('0xa')][_0x4fc6eb][_0x97c2('0x30')]:_0x4fc6eb;return RpcUser['savePause'](_0x325d69[_0x97c2('0x8')][_0x8a8359],_0x1299fb,_0x2af643)[_0x97c2('0x2a')](function(_0x1e24ae){_0x325d69['voiceQueues'][_0x2093f5][_0x97c2('0x31')]-=0x1;_0x325d69[_0x97c2('0x7')][_0x2093f5][_0x97c2('0x32')]+=0x1;return _0x1e24ae;});})[_0x97c2('0x2a')](function(_0x162ff7){if(_0x4f48a1||!_0x162ff7){return;}_0x325d69[_0x97c2('0x9')][_0x8a8359]={};logger[_0x97c2('0x1f')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x4fc6eb,_0x325d69[_0x97c2('0x7')][_0x2093f5][_0x97c2('0x33')],_0x8a8359,_0x2093f5);_0x325d69['timers'][_0x8a8359]['timer']=setTimeout(_0x325d69[_0x97c2('0x34')][_0x97c2('0xd')](_0x325d69,_0x8a8359),_0x325d69[_0x97c2('0x7')][_0x2093f5]['acwTimeout']*0x3e8);_0x325d69[_0x97c2('0x9')][_0x8a8359][_0x97c2('0x35')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x325d69[_0x97c2('0x9')][_0x8a8359][_0x97c2('0x1e')]=_0x4fc6eb;_0x325d69[_0x97c2('0x9')][_0x8a8359][_0x97c2('0x36')]=_0x2093f5;_0x325d69[_0x97c2('0x9')][_0x8a8359][_0x97c2('0x1b')]=_0x325d69[_0x97c2('0x1b')][_0x97c2('0xd')](_0x325d69,_0x8a8359,_0x4fc6eb);});}})[_0x97c2('0x20')](function(){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x4fc6eb,_0x325d69[_0x97c2('0x7')][_0x2093f5]['acwTimeout'],_0x8a8359,_0x2093f5);})[_0x97c2('0x37')](function(){delete _0x325d69['channels'][_0x4fc6eb];});}catch(_0x1ca49d){logger[_0x97c2('0x21')](_0x97c2('0x38'),_0x1ca49d['message']);}};Acw['prototype']['stopAcw']=function(_0x4c82dc){try{var _0x42199c=this;if(_0x42199c[_0x97c2('0x9')][_0x4c82dc]){_0x42199c[_0x97c2('0x9')][_0x4c82dc]['timer']=![];var _0x3e6b14=_0x42199c[_0x97c2('0x9')][_0x4c82dc][_0x97c2('0x1e')];var _0x43e51d=_0x42199c[_0x97c2('0x9')][_0x4c82dc]['queue'];var _0x34db54=_0x42199c['voiceQueues'][_0x43e51d]['acwTimeout'];logger[_0x97c2('0x1f')](_0x97c2('0x39'),_0x3e6b14,_0x4c82dc);RpcUser[_0x97c2('0x2b')](this[_0x97c2('0x8')][_0x4c82dc]['id'])[_0x97c2('0x2a')](function(_0x33317a){if(_0x33317a[_0x97c2('0x3a')]==='ACW'){return RpcUser[_0x97c2('0x3b')](_0x42199c['agents'][_0x4c82dc]);}});RpcVoiceAgentReport[_0x97c2('0x1d')]({'acwtime':_0x34db54,'agentacw':!![]},_0x3e6b14,_0x4c82dc)[_0x97c2('0x2a')](function(_0x1faae8){logger[_0x97c2('0x1f')](_0x97c2('0x3c'),_0x3e6b14,_0x34db54,_0x1faae8);})[_0x97c2('0x20')](function(_0x10497d){logger[_0x97c2('0x21')](_0x97c2('0x22'),_0x3e6b14,_0x10497d);});}else{logger[_0x97c2('0x21')](_0x97c2('0x3d'),_0x4c82dc);if(_0x42199c[_0x97c2('0x9')]){logger[_0x97c2('0x1f')]('[ACW][TIMERS]',JSON['stringify'](_0x42199c['timers']));}}}catch(_0x46eb0c){logger[_0x97c2('0x21')]('[ACW][STOP]\x20%s',_0x46eb0c[_0x97c2('0x3e')]);}};Acw['prototype'][_0x97c2('0xc')]=function(_0x4966eb){try{if(this[_0x97c2('0x7')][_0x4966eb[_0x97c2('0x36')]]&&(this[_0x97c2('0x7')][_0x4966eb[_0x97c2('0x36')]]['acw']||this[_0x97c2('0x7')][_0x4966eb[_0x97c2('0x36')]][_0x97c2('0x26')])){if(this['agents'][_0x4966eb[_0x97c2('0x24')]]){this[_0x97c2('0xa')][_0x4966eb['uniqueid']]={'queue':_0x4966eb[_0x97c2('0x36')],'interface':_0x4966eb['interface'],'destlinkedid':_0x4966eb['destlinkedid']};}}}catch(_0x179e60){logger['error'](_0x97c2('0x3f'),_0x179e60['message']);}};Acw[_0x97c2('0x1a')][_0x97c2('0x40')]=function(_0xf0f3a9){try{if(this[_0x97c2('0x7')][_0xf0f3a9[_0x97c2('0x36')]]&&(this[_0x97c2('0x7')][_0xf0f3a9[_0x97c2('0x36')]][_0x97c2('0x4')]||this[_0x97c2('0x7')][_0xf0f3a9[_0x97c2('0x36')]][_0x97c2('0x26')])){if(this[_0x97c2('0x8')][_0xf0f3a9['interface']]){this[_0x97c2('0xa')][_0xf0f3a9[_0x97c2('0x1e')]]={'queue':_0xf0f3a9[_0x97c2('0x36')],'interface':_0xf0f3a9['interface']};}}}catch(_0x4e519c){logger['error'](_0x97c2('0x41'),_0x4e519c[_0x97c2('0x3e')]);}};Acw[_0x97c2('0x1a')][_0x97c2('0x42')]=function(_0x52c0ed){try{if(this['channels'][_0x52c0ed[_0x97c2('0x1e')]]&&_[_0x97c2('0x43')](this['channels'][_0x52c0ed[_0x97c2('0x1e')]][_0x97c2('0x2f')])){logger[_0x97c2('0x1f')](_0x97c2('0x44'),_0x52c0ed[_0x97c2('0x1e')]);this[_0x97c2('0x23')](_0x52c0ed[_0x97c2('0x1e')]);}else if(this[_0x97c2('0xa')][_0x52c0ed['linkedid']]&&_['isUndefined'](this[_0x97c2('0xa')][_0x52c0ed[_0x97c2('0x45')]][_0x97c2('0x2f')])){logger['info'](_0x97c2('0x46'),_0x52c0ed[_0x97c2('0x45')]);this[_0x97c2('0x23')](_0x52c0ed[_0x97c2('0x45')]);}}catch(_0x3294d0){logger[_0x97c2('0x21')]('[ACW][syncHangupRequest]\x20%s',_0x3294d0[_0x97c2('0x3e')]);}};Acw['prototype'][_0x97c2('0x47')]=function(_0x598b77){try{if(this[_0x97c2('0xa')][_0x598b77[_0x97c2('0x1e')]]&&this[_0x97c2('0xa')][_0x598b77[_0x97c2('0x1e')]][_0x97c2('0x2f')]){logger[_0x97c2('0x1f')](_0x97c2('0x48'),_0x598b77[_0x97c2('0x1e')]);this['startAcw'](_0x598b77[_0x97c2('0x1e')]);}else if(this[_0x97c2('0xa')][_0x598b77[_0x97c2('0x45')]]&&this[_0x97c2('0xa')][_0x598b77[_0x97c2('0x45')]][_0x97c2('0x2f')]){logger[_0x97c2('0x1f')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x598b77[_0x97c2('0x45')]);this['startAcw'](_0x598b77[_0x97c2('0x45')]);}}catch(_0x107317){logger[_0x97c2('0x21')](_0x97c2('0x49'),_0x107317[_0x97c2('0x3e')]);}};Acw['prototype'][_0x97c2('0x13')]=function(_0x155c1c){try{if(!_['isNil'](this[_0x97c2('0xa')][_0x155c1c['transfereeuniqueid']])){this[_0x97c2('0x23')](_0x155c1c[_0x97c2('0x4a')]);if(this[_0x97c2('0xa')][_0x155c1c[_0x97c2('0x4b')]]){this[_0x97c2('0xa')][_0x155c1c[_0x97c2('0x4b')]][_0x97c2('0x2f')]=!![];this[_0x97c2('0xa')][_0x155c1c[_0x97c2('0x4c')]]=this[_0x97c2('0xa')][_0x155c1c[_0x97c2('0x4b')]];this[_0x97c2('0x4d')](_0x155c1c[_0x97c2('0x4b')]);}}else if(!_[_0x97c2('0x4e')](this['channels'][_0x155c1c[_0x97c2('0x4c')]])){this[_0x97c2('0x23')](_0x155c1c[_0x97c2('0x4c')]);if(this[_0x97c2('0xa')][_0x155c1c[_0x97c2('0x4f')]]){this[_0x97c2('0xa')][_0x155c1c['origtransfereruniqueid']][_0x97c2('0x2f')]=!![];this[_0x97c2('0xa')][_0x155c1c['transfereeuniqueid']]=this['channels'][_0x155c1c['origtransfereruniqueid']];this[_0x97c2('0x4d')](_0x155c1c['origtransfereruniqueid']);}}}catch(_0x7e3568){logger[_0x97c2('0x21')]('[ACW][syncAttendedTransfer]\x20%s',_0x7e3568['message']);}};Acw[_0x97c2('0x1a')][_0x97c2('0x15')]=function(_0x32a0be){try{if(this[_0x97c2('0xa')][_0x32a0be['transfereruniqueid']]){logger[_0x97c2('0x1f')](_0x97c2('0x50'),JSON[_0x97c2('0x51')](_0x32a0be['transfereruniqueid']));this[_0x97c2('0x23')](_0x32a0be[_0x97c2('0x52')]);}else if(this['channels'][_0x32a0be['transfererlinkedid']]){logger[_0x97c2('0x1f')](_0x97c2('0x53'),JSON['stringify'](_0x32a0be['transfererlinkedid']));this[_0x97c2('0x23')](_0x32a0be[_0x97c2('0x54')]);}}catch(_0x598781){logger[_0x97c2('0x21')](_0x97c2('0x55'),_0x598781['message']);}};Acw[_0x97c2('0x1a')][_0x97c2('0x11')]=function(_0x4dbdec){try{if(this['voiceQueues'][_0x4dbdec['queue']]&&this[_0x97c2('0x7')][_0x4dbdec[_0x97c2('0x36')]][_0x97c2('0x56')]==='all'){if(this[_0x97c2('0x8')][_0x4dbdec[_0x97c2('0x24')]]){logger[_0x97c2('0x1f')](_0x97c2('0x57'),_0x4dbdec[_0x97c2('0x1e')],_0x4dbdec[_0x97c2('0x24')],_0x4dbdec[_0x97c2('0x36')]);return RpcUser[_0x97c2('0x58')](this[_0x97c2('0x8')][_0x4dbdec[_0x97c2('0x24')]],_0x97c2('0x59'),_0x4dbdec[_0x97c2('0x1e')]);}}}catch(_0x5dfef0){logger[_0x97c2('0x21')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x5dfef0[_0x97c2('0x3e')]);}};Acw[_0x97c2('0x1a')][_0x97c2('0x4d')]=function(_0x12217b,_0x50ca37=0x2710){if(this[_0x97c2('0xa')][_0x12217b]){setTimeout(()=>{delete this['channels'][_0x12217b];},_0x50ca37);}};module[_0x97c2('0x5a')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 1b65a60..32e155b 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 _0x346b=['exports','asterisk-manager','bluebird','ami','asterisk','port','password','keepConnected','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','username','actionSipShowRegistry','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch'];(function(_0x3ee8db,_0x2d91af){var _0x3fa1a3=function(_0x28fef3){while(--_0x28fef3){_0x3ee8db['push'](_0x3ee8db['shift']());}};_0x3fa1a3(++_0x2d91af);}(_0x346b,0x157));var _0xb346=function(_0x14ec70,_0x24f0ff){_0x14ec70=_0x14ec70-0x0;var _0x5c1b44=_0x346b[_0x14ec70];return _0x5c1b44;};'use strict';var Manager=require(_0xb346('0x0'));var BPromise=require(_0xb346('0x1'));var util=require('util');var logger=require('../../config/logger')(_0xb346('0x2'));var config=require('../../config/environment');var ami=new Manager(config[_0xb346('0x3')][_0xb346('0x4')],config['asterisk']['ip'],config[_0xb346('0x3')]['username'],config['asterisk'][_0xb346('0x5')],!![]);ami[_0xb346('0x6')]();ami['Action']=BPromise[_0xb346('0x7')](ami[_0xb346('0x8')]);function error(_0x459be9){logger[_0xb346('0x9')](util['format'](_0xb346('0xa'),config[_0xb346('0x3')]['username'],config[_0xb346('0x3')]['ip'],config[_0xb346('0x3')]['port'],util[_0xb346('0xb')](_0x459be9,![],null)));}function close(){logger[_0xb346('0x9')](util[_0xb346('0xc')](_0xb346('0xd'),config['asterisk'][_0xb346('0xe')],config['asterisk']['ip'],config[_0xb346('0x3')]['port']));}ami[_0xb346('0xf')]=function(){return function(){return ami[_0xb346('0x10')]({'action':_0xb346('0x11')});};};ami[_0xb346('0x12')]=function(){return function(){return ami['Action']({'action':_0xb346('0x13')});};};ami[_0xb346('0x14')]=function(){return function(){return ami['Action']({'action':_0xb346('0x15')});};};ami[_0xb346('0x16')]=function(){return function(){return ami[_0xb346('0x10')]({'action':_0xb346('0x17')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xb346('0x10')]({'action':_0xb346('0x18')});};};function connect(){logger[_0xb346('0x19')](util[_0xb346('0xc')](_0xb346('0x1a'),config[_0xb346('0x3')][_0xb346('0xe')],config[_0xb346('0x3')]['ip'],config[_0xb346('0x3')][_0xb346('0x4')]));ami['once'](_0xb346('0x9'),error);ami[_0xb346('0x1b')](_0xb346('0x1c'),close);}ami['on'](_0xb346('0x1d'),connect);ami['on'](_0xb346('0x1e'),function(_0x116391){logger[_0xb346('0x19')](util['format'](_0xb346('0x1f'),config[_0xb346('0x3')][_0xb346('0xe')],config['asterisk']['ip'],config[_0xb346('0x3')][_0xb346('0x4')],util[_0xb346('0xb')](_0x116391,![],null)));});ami['on'](_0xb346('0x20'),function(){logger['info'](util[_0xb346('0xc')](_0xb346('0x21'),config[_0xb346('0x3')][_0xb346('0xe')],config[_0xb346('0x3')]['ip'],config['asterisk']['port']));return Promise[_0xb346('0x22')]()[_0xb346('0x23')](ami[_0xb346('0xf')]())['then'](ami[_0xb346('0x12')]())['then'](ami[_0xb346('0x14')]())['then'](ami[_0xb346('0x16')]())[_0xb346('0x23')](ami['actionCoreShowChannels']())[_0xb346('0x24')](function(_0x4c81df){logger[_0xb346('0x9')]('[ami.js][fullybooted]',util[_0xb346('0xb')](_0x4c81df,{'showHidden':![],'depth':null}));});});ami['once'](_0xb346('0x9'),error);ami[_0xb346('0x1b')](_0xb346('0x1c'),close);module[_0xb346('0x25')]=ami; \ No newline at end of file +var _0x82dc=['Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','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','actionDeviceStateList','then','actionQueueSummary','once','exports','asterisk-manager','bluebird','util','../../config/logger','../../config/environment','asterisk','port','username','password','keepConnected','Action','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','error'];(function(_0xf86cb5,_0x1df013){var _0x344176=function(_0x5cc43a){while(--_0x5cc43a){_0xf86cb5['push'](_0xf86cb5['shift']());}};_0x344176(++_0x1df013);}(_0x82dc,0x192));var _0xc82d=function(_0x5dc3c1,_0x139ce3){_0x5dc3c1=_0x5dc3c1-0x0;var _0x247100=_0x82dc[_0x5dc3c1];return _0x247100;};'use strict';var Manager=require(_0xc82d('0x0'));var BPromise=require(_0xc82d('0x1'));var util=require(_0xc82d('0x2'));var logger=require(_0xc82d('0x3'))('ami');var config=require(_0xc82d('0x4'));var ami=new Manager(config[_0xc82d('0x5')][_0xc82d('0x6')],config['asterisk']['ip'],config[_0xc82d('0x5')][_0xc82d('0x7')],config[_0xc82d('0x5')][_0xc82d('0x8')],!![]);ami[_0xc82d('0x9')]();ami[_0xc82d('0xa')]=BPromise['promisify'](ami[_0xc82d('0xb')]);function error(_0x22da39){logger['error'](util[_0xc82d('0xc')](_0xc82d('0xd'),config['asterisk'][_0xc82d('0x7')],config[_0xc82d('0x5')]['ip'],config[_0xc82d('0x5')][_0xc82d('0x6')],util[_0xc82d('0xe')](_0x22da39,![],null)));}function close(){logger[_0xc82d('0xf')](util[_0xc82d('0xc')](_0xc82d('0x10'),config[_0xc82d('0x5')][_0xc82d('0x7')],config['asterisk']['ip'],config[_0xc82d('0x5')][_0xc82d('0x6')]));}ami[_0xc82d('0x11')]=function(){return function(){return ami[_0xc82d('0xa')]({'action':_0xc82d('0x12')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xc82d('0xa')]({'action':_0xc82d('0x13')});};};ami[_0xc82d('0x14')]=function(){return function(){return ami[_0xc82d('0xa')]({'action':_0xc82d('0x15')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0xc82d('0x16')});};};ami[_0xc82d('0x17')]=function(){return function(){return ami[_0xc82d('0xa')]({'action':_0xc82d('0x18')});};};function connect(){logger[_0xc82d('0x19')](util[_0xc82d('0xc')](_0xc82d('0x1a'),config['asterisk'][_0xc82d('0x7')],config[_0xc82d('0x5')]['ip'],config[_0xc82d('0x5')][_0xc82d('0x6')]));ami['once'](_0xc82d('0xf'),error);ami['once'](_0xc82d('0x1b'),close);}ami['on'](_0xc82d('0x1c'),connect);ami['on'](_0xc82d('0x1d'),function(_0x49248a){logger[_0xc82d('0x19')](util[_0xc82d('0xc')](_0xc82d('0x1e'),config[_0xc82d('0x5')]['username'],config[_0xc82d('0x5')]['ip'],config[_0xc82d('0x5')][_0xc82d('0x6')],util[_0xc82d('0xe')](_0x49248a,![],null)));});ami['on'](_0xc82d('0x1f'),function(){logger['info'](util[_0xc82d('0xc')](_0xc82d('0x20'),config[_0xc82d('0x5')][_0xc82d('0x7')],config[_0xc82d('0x5')]['ip'],config[_0xc82d('0x5')][_0xc82d('0x6')]));return Promise['resolve']()['then'](ami[_0xc82d('0x11')]())['then'](ami[_0xc82d('0x21')]())['then'](ami['actionSipPeerStatus']())[_0xc82d('0x22')](ami[_0xc82d('0x23')]())[_0xc82d('0x22')](ami['actionCoreShowChannels']())['catch'](function(_0xcbcd40){logger[_0xc82d('0xf')]('[ami.js][fullybooted]',util[_0xc82d('0xe')](_0xcbcd40,{'showHidden':![],'depth':null}));});});ami[_0xc82d('0x24')](_0xc82d('0xf'),error);ami[_0xc82d('0x24')](_0xc82d('0x1b'),close);module[_0xc82d('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 7d32509..ab81a2a 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 _0xb43b=['catch','exports','jayson/promise','bluebird','ami','client','http','rpc','memberReport','error','message','result'];(function(_0x251669,_0x4cfefe){var _0x476916=function(_0x3f4e9b){while(--_0x3f4e9b){_0x251669['push'](_0x251669['shift']());}};_0x476916(++_0x4cfefe);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1a022a,_0x5a16a0){_0x1a022a=_0x1a022a-0x0;var _0x403f91=_0xb43b[_0x1a022a];return _0x403f91;};'use strict';var jayson=require(_0xbb43('0x0'));var BPromise=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var client=jayson[_0xbb43('0x3')][_0xbb43('0x4')]({'port':0x2329});client['Request']=function(_0x131e9e,_0x41aff6){return new BPromise(function(_0x351254,_0x16432a){return client['request'](_0x131e9e,_0x41aff6)['then'](function(_0x378df5){logger['debug'](_0xbb43('0x5'),_0xbb43('0x6'),_0x131e9e,_0x41aff6,_0x378df5);if(_0x378df5[_0xbb43('0x7')]){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x378df5[_0xbb43('0x7')][_0xbb43('0x8')],_0x41aff6);return _0x16432a(_0x378df5['error'][_0xbb43('0x8')]);}else{return _0x351254(_0x378df5[_0xbb43('0x9')]);}})[_0xbb43('0xa')](function(_0x5e3611){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x5e3611,_0x41aff6);return _0x16432a(_0x5e3611);});});};module[_0xbb43('0xb')]=client; \ No newline at end of file +var _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x44b3bd,_0x44c97d){_0x44b3bd=_0x44b3bd-0x0;var _0x1efc4a=_0xcb91[_0x44b3bd];return _0x1efc4a;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var client=jayson[_0x1cb9('0x2')][_0x1cb9('0x3')]({'port':0x2329});client['Request']=function(_0x8c392f,_0x2c17b8){return new BPromise(function(_0x545a34,_0x13d5fd){return client[_0x1cb9('0x4')](_0x8c392f,_0x2c17b8)['then'](function(_0x226b69){logger[_0x1cb9('0x5')]('rpc',_0x1cb9('0x6'),_0x8c392f,_0x2c17b8,_0x226b69);if(_0x226b69[_0x1cb9('0x7')]){logger['error'](_0x1cb9('0x8'),'memberReport',_0x8c392f,_0x226b69['error'][_0x1cb9('0x9')],_0x2c17b8);return _0x13d5fd(_0x226b69[_0x1cb9('0x7')][_0x1cb9('0x9')]);}else{return _0x545a34(_0x226b69[_0x1cb9('0xa')]);}})[_0x1cb9('0xb')](function(_0x50ce71){logger[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x1cb9('0x6'),_0x8c392f,_0x50ce71,_0x2c17b8);return _0x13d5fd(_0x50ce71);});});};module[_0x1cb9('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index e12b99d..90d95f9 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 _0xc092=['run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','pick','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','exten','xcally-motion-dialer','value','HANGUP','membername','AMD','buildObj','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','outboundAnswerAgiCallsDay','Machine','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','dialMachineRetryFrequency','custom:amd','countagentrejectretry','reason\x2019\x20machine....','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','cause-txt','Normal\x20Clearing','outboundUnknownCallsDay','running','getQueueCampaignStatusMessage','statusMessage','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','filter','dialPreviewRecallmeReminder','online','map','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','No\x20such\x20channel','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','Agent','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','isOutboundQueue','XMD-VOICEQUEUEID','Contact','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','TrunkBackup','XMD-ORIGINATECALLERIDNAME','extractCalleridName','variables','trim','dialCutDigit','substring','SIP/%s/%s%s','dialPrefix','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','nosuchnumber','[syncAgentComplete][createHistory][0]','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalMaxThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','Max\x20Drop\x20','avgHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','predictiveIntervalAvailable','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','dialPredictiveOptimization','loggedIn','predictiveIntervalPauses','outboundQueuePauses','[CatchErlangB]','busyFactor','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','temp','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','maxNumberOriginate','not_inuse','getContactDialer','checkContactEmpty','countReScheduled','[countReScheduled]\x20','checkContactBlack','[getContactDialer2]','dialLimitQueue','[handlePredictive][limitChannel]','tryOriginatePredictive','checkIsBlackList','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','erlangb','exports','util','lodash','uuid','./utils','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','redis','localhost','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','./models/action','./models/history','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','tail','finally','sequence','preview','voiceQueues','campaigns','agents','channels','actions','uniqueId','optionPredictive','startPredictive','startProgressive','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','inspect','format','voice:queue:%s','name','voice_queue:save','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','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\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','merge','getSeconds','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','contactsRescheduled','message','CAMPAIGN_STATUS','[getContactDialer2][ReScheduled]','NO_AVAILABLE_CONTACTS','endtime','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','stringify','Interval','NULL_INTERVAL','Intervals','\x20INTERVAL_IS_NULL','isEmpty','isIVRCampaignActive','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','prototype','isTrunkReachable','active','trunks','SIP/%s','status','reachable','checkIsTrunkReachable','Trunk','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','Action','interval','then','content','indexOf','true','push','command','iftime\x20%s,%s','catch','all','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','isGlobal','AMI\x20IfTime','uniqueid','ivr','queue','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','updateOriginated','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','statedesc','Drop','dropreason','countdropretry','dialDropRetryFrequency','verifyAdditionalPhones','voiceQueue','additional','queueCallerAbandonCreateState','rescheduleContact','ContactId','ListId','VoiceQueueId','[rescheduleContact][Drop]','state','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','countglobal','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','dialAbandonedMaxRetry','add','minutes','CampaignId','[syncAgentComplete][createHistory][11]','channel','syncQueueMember','actionid','strategy','rrmemory','isNil','locked','paused','stateinterface','idHopper','roundrobin'];(function(_0x191154,_0x56f74c){var _0x3dcd73=function(_0x51c321){while(--_0x51c321){_0x191154['push'](_0x191154['shift']());}};_0x3dcd73(++_0x56f74c);}(_0xc092,0x122));var _0x2c09=function(_0x3b9558,_0x7ca311){_0x3b9558=_0x3b9558-0x0;var _0x3df7e8=_0xc092[_0x3b9558];return _0x3df7e8;};'use strict';var util=require(_0x2c09('0x0'));var _=require(_0x2c09('0x1'));var uuid=require(_0x2c09('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require('ioredis');var utils=require(_0x2c09('0x3'));var hopperUtils=require('./utils/hopper');var ut=require(_0x2c09('0x4'));var config=require(_0x2c09('0x5'));var logger=require(_0x2c09('0x6'))('dialer');var loggerBooked=require(_0x2c09('0x6'))(_0x2c09('0x7'));var loggerPredictive=require(_0x2c09('0x6'))(_0x2c09('0x8'));var loggerPredictiveCalls=require(_0x2c09('0x6'))(_0x2c09('0x9'));var loggerSyncQueueSummary=require(_0x2c09('0x6'))(_0x2c09('0xa'));var ami=require(_0x2c09('0xb'));config['redis']=_[_0x2c09('0xc')](config[_0x2c09('0xd')],{'host':_0x2c09('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2c09('0xd')]));var cmHopper=require(_0x2c09('0xf'));var voiceQueueRt=require(_0x2c09('0x10'));var RpcSetting=require(_0x2c09('0x11'));var Interval=require('../rpc/interval');var Action=require(_0x2c09('0x12'));var History=require(_0x2c09('0x13'));var Final=require('./models/final');var AgentComplete=require(_0x2c09('0x14'));var QueueCallerAbandon=require(_0x2c09('0x15'));var Hangup=require(_0x2c09('0x16'));var ipAgi=process[_0x2c09('0x17')][_0x2c09('0x18')]||_0x2c09('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x1e8e3f){this[_0x2c09('0x1a')]=this[_0x2c09('0x1a')]?this[_0x2c09('0x1a')][_0x2c09('0x1b')](_0x1e8e3f):_0x1e8e3f();};function Dialer(_0x14e032,_0x27ccf4){this[_0x2c09('0x1c')]=new Sequence();this[_0x2c09('0x1d')]=_0x27ccf4;this[_0x2c09('0x1e')]=_0x14e032[_0x2c09('0x1e')];this[_0x2c09('0x1f')]=_0x14e032['campaigns'];this[_0x2c09('0x20')]=_0x14e032['agents'];this['trunks']=_0x14e032['trunks'];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this[_0x2c09('0x21')]={};this[_0x2c09('0x22')]={};this['contactsId']={};this[_0x2c09('0x23')]={};this[_0x2c09('0x24')]={};this[_0x2c09('0x25')]={};this[_0x2c09('0x26')]={};this['ivrOriginated']={};this[_0x2c09('0x27')]={};this[_0x2c09('0x28')]={};this[_0x2c09('0x29')]={};ami['on'](_0x2c09('0x2a'),this[_0x2c09('0x2b')]['bind'](this));ami['on'](_0x2c09('0x2c'),this[_0x2c09('0x2d')][_0x2c09('0x2e')](this));ami['on'](_0x2c09('0x2f'),this[_0x2c09('0x30')][_0x2c09('0x2e')](this));ami['on'](_0x2c09('0x31'),this[_0x2c09('0x32')][_0x2c09('0x2e')](this));ami['on']('custom:queuesummary',this[_0x2c09('0xa')][_0x2c09('0x2e')](this));ami['on'](_0x2c09('0x33'),this[_0x2c09('0x34')][_0x2c09('0x2e')](this));ami['on'](_0x2c09('0x35'),this[_0x2c09('0x36')][_0x2c09('0x2e')](this));ami['on'](_0x2c09('0x37'),this[_0x2c09('0x38')][_0x2c09('0x2e')](this));ami['on']('varset',this[_0x2c09('0x39')][_0x2c09('0x2e')](this));ami['on'](_0x2c09('0x3a'),this['syncQueueMember'][_0x2c09('0x2e')](this));ami['on']('queuestatuscomplete',this[_0x2c09('0x3b')][_0x2c09('0x2e')](this));this[_0x2c09('0x3c')]();this[_0x2c09('0x3d')]();RpcSetting['getSettings']()['then'](function(_0x3f0226){previewRecallmeReminderInterval=_0x3f0226[_0x2c09('0x3e')];});}function isNotNull(_0x526524){return _0x526524!==null&&!_[_0x2c09('0x3f')](_0x526524);}function msgResponse(_0x313509,_0x28ac3a,_0xfdd8b0){return{'action':_0x313509,'response':_0x28ac3a,'message':_0xfdd8b0,'stack':_0xfdd8b0};}function emit(_0x1950b7,_0xfab2fe,_0x24139c){io['to'](_0x1950b7)[_0x2c09('0x40')](_0xfab2fe,_0x24139c);}function emitOutboundVoiceQueueSummary(_0x212774){if(_0x212774[_0x2c09('0x41')]===_0x2c09('0x42')){logger[_0x2c09('0x43')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x2c09('0x44')](_0x212774,{'showHidden':![],'depth':null}));emit(util[_0x2c09('0x45')](_0x2c09('0x46'),_0x212774[_0x2c09('0x47')]),_0x2c09('0x48'),_0x212774);}}function checkGetDataPredictive(_0x43ea01){if(isNotNull(_0x43ea01)&&!_['isEmpty'](_0x43ea01)){loggerPredictive[_0x2c09('0x49')](_0x2c09('0x4a'));loggerPredictive[_0x2c09('0x49')](_0x2c09('0x4b'),_0x43ea01[_0x2c09('0x4c')]);loggerPredictive['info'](_0x2c09('0x4d'),_0x43ea01[_0x2c09('0x4e')]);loggerPredictive[_0x2c09('0x49')](_0x2c09('0x4f'),_0x43ea01[_0x2c09('0x50')]);loggerPredictive[_0x2c09('0x49')](_0x2c09('0x51'),_0x43ea01[_0x2c09('0x52')]);loggerPredictive[_0x2c09('0x49')](_0x2c09('0x53'),_0x43ea01[_0x2c09('0x54')]);loggerPredictive[_0x2c09('0x49')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x43ea01[_0x2c09('0x55')]);loggerPredictive[_0x2c09('0x49')](_0x2c09('0x56'));if(_0x43ea01['predictiveIntervalTotalCalls']>0x0){if(!_[_0x2c09('0x3f')](_0x43ea01[_0x2c09('0x55')])&&_0x43ea01['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x2c09('0x49')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x2c09('0x3f')](_0x43ea01[_0x2c09('0x54')])&&_0x43ea01[_0x2c09('0x54')]>0x0){return!![];}loggerPredictive[_0x2c09('0x49')](_0x2c09('0x57'));}else{loggerPredictive[_0x2c09('0x49')](_0x2c09('0x58'));}}else{loggerPredictive[_0x2c09('0x49')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x5ca757){return function(_0x38be36){loggerPredictive[_0x2c09('0x49')](_0x2c09('0x59'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x38be36[_0x2c09('0x5a')]);loggerPredictive['info'](_0x2c09('0x5b'),_0x38be36[_0x2c09('0x5c')]);loggerPredictive[_0x2c09('0x49')](_0x2c09('0x5d'),_0x38be36[_0x2c09('0x5e')]);loggerPredictive[_0x2c09('0x49')](_0x2c09('0x5f'),_0x38be36['erlangBusyFactor']);loggerPredictive[_0x2c09('0x49')](_0x2c09('0x5d'),_0x38be36[_0x2c09('0x5e')]);loggerPredictive[_0x2c09('0x49')]('---------------------------');_[_0x2c09('0x60')](_0x5ca757,_0x38be36);};}function ifInterval(_0x5dd50f,_0x2637b6){if(_['isUndefined'](_0x2637b6)){return![];}return utils[_0x2c09('0x61')](undefined,_0x2637b6)<_0x5dd50f*0x3c;}function clearPredictiveAttributes(_0x5ad14d){if(_0x5ad14d[_0x2c09('0x26')]){_0x5ad14d['startProgressive']=undefined;loggerPredictive[_0x2c09('0x43')](_0x5ad14d[_0x2c09('0x47')],'startProgressive\x20value\x20cleared');}if(_0x5ad14d[_0x2c09('0x25')]){_0x5ad14d[_0x2c09('0x25')]=undefined;loggerPredictive['debug'](_0x5ad14d[_0x2c09('0x47')],_0x2c09('0x62'));}if(_0x5ad14d[_0x2c09('0x63')]){clearInterval(_0x5ad14d[_0x2c09('0x63')]);_0x5ad14d[_0x2c09('0x63')]=undefined;loggerPredictive[_0x2c09('0x43')](_0x5ad14d[_0x2c09('0x47')],_0x2c09('0x64'));}}function loggerCatchPredictive(_0x29079c,_0x4c907e){return function(_0x5cece8){loggerPredictive[_0x2c09('0x65')](_0x4c907e[_0x2c09('0x47')],_0x29079c);loggerPredictive[_0x2c09('0x65')](_0x5cece8[_0x2c09('0x66')]);clearPredictiveAttributes(_0x4c907e);};}function loggerCatch(_0x57a630){return function(_0x379276){logger[_0x2c09('0x65')](_0x57a630,util[_0x2c09('0x44')](_0x379276,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x4f8d0c,_0x1011f4,_0x49bbc5){return function(_0x471c99){utils[_0x2c09('0x67')](_0x1011f4,_0x49bbc5,0x0);_0x1011f4['temp']=0x0;logger[_0x2c09('0x65')](_0x4f8d0c,util[_0x2c09('0x44')](_0x471c99,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2de3f7){return function(_0x23706c){if(isNotNull(_0x23706c)&&isNotNull(_0x23706c[0x0])){if(_0x23706c[0x0][_0x2c09('0x68')]>0x0){_0x2de3f7[_0x2c09('0x69')]=utils[_0x2c09('0x6a')]['CONTACTS_RESCHEDULED'];logger['info'](_0x2c09('0x6b')+_0x2de3f7[_0x2c09('0x47')],_0x23706c[0x0][_0x2c09('0x68')],'contacts');}else{_0x2de3f7[_0x2c09('0x69')]=utils[_0x2c09('0x6a')][_0x2c09('0x6c')];logger['info']('[getContactDialer2][Empty]'+_0x2de3f7[_0x2c09('0x47')]);}}};}function createObjHistory(_0x1baae3,_0x2b7a65,_0x3d9fa4,_0x284ee9,_0x5d77e4){_0x1baae3[_0x2c09('0x69')]=_0x3d9fa4;var _0x580bf4=new Action(_0x1baae3,_0x2b7a65);var _0x1a05cd=new History(_0x580bf4);_0x1a05cd['state']=_0x284ee9;_0x1a05cd['statedesc']=_0x5d77e4;_0x1a05cd[_0x2c09('0x6d')]=_0x580bf4['starttime'];return _0x1a05cd;}function unlockQueueStatus(_0x4993c8,_0x269bbf){setTimeout(function(){if(_[_0x2c09('0x3f')](_0x4993c8['queueStatusComplete'])){loggerBooked['error'](_0x2c09('0x6e'),_0x269bbf);}_0x4993c8[_0x2c09('0x6f')]=!![];loggerBooked[_0x2c09('0x49')](_0x2c09('0x70'),_0x269bbf,JSON[_0x2c09('0x71')](_['pick'](_0x4993c8,['name',_0x2c09('0x6f')])));},0x1f3);}function checkInterval(_0x32d767){return function(){if(!isNotNull(_0x32d767[_0x2c09('0x72')])){_0x32d767[_0x2c09('0x69')]=utils[_0x2c09('0x6a')][_0x2c09('0x73')];throw _0x32d767[_0x2c09('0x47')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x32d767[_0x2c09('0x72')][_0x2c09('0x74')])){_0x32d767[_0x2c09('0x69')]=utils[_0x2c09('0x6a')][_0x2c09('0x73')];throw _0x32d767[_0x2c09('0x47')]+_0x2c09('0x75');}if(!isNotNull(_[_0x2c09('0x76')](_0x32d767[_0x2c09('0x72')][_0x2c09('0x74')]))){_0x32d767[_0x2c09('0x69')]=utils['CAMPAIGN_STATUS'][_0x2c09('0x73')];throw _0x32d767[_0x2c09('0x47')]+_0x2c09('0x75');}};}function checkIsIVRCampaignActive(_0x5c17e9){return function(){if(!utils[_0x2c09('0x77')](_0x5c17e9)){_0x5c17e9[_0x2c09('0x69')]=utils[_0x2c09('0x6a')]['INACTIVE'];throw _0x5c17e9[_0x2c09('0x47')]+_0x2c09('0x78');}};}function emitCampaignSummary(_0x420c79){if(utils[_0x2c09('0x79')](_0x420c79)){emit(util['format'](_0x2c09('0x7a'),_0x420c79[_0x2c09('0x47')]),_0x2c09('0x7b'),_0x420c79);}}function loggerCatchQueueSummary(_0x2d15c0,_0x4437ab){return function(_0x2da3ab){clearPredictiveAttributes(_0x4437ab);emitCampaignSummary(_0x4437ab);loggerSyncQueueSummary[_0x2c09('0x43')](_0x2d15c0,util[_0x2c09('0x44')](_0x2da3ab,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x57842d){if(_0x57842d[_0x2c09('0x7c')]){if(_0x57842d[_0x2c09('0x7d')]===0x0){_0x57842d[_0x2c09('0x7c')]=![];_0x57842d[_0x2c09('0x69')]=utils[_0x2c09('0x6a')][_0x2c09('0x7e')];loggerSyncQueueSummary['debug'](_0x2c09('0x7f'),_0x57842d[_0x2c09('0x47')],_0x2c09('0x80'));}else{_0x57842d[_0x2c09('0x69')]=utils['CAMPAIGN_STATUS'][_0x2c09('0x81')];loggerSyncQueueSummary[_0x2c09('0x43')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x57842d[_0x2c09('0x47')],_0x2c09('0x82'));}emitCampaignSummary(_0x57842d);}}function myreject(_0x1376a6){return function(_0x3c4dbf){return _0x1376a6(msgResponse(_0x2c09('0x83'),_0x2c09('0x84'),JSON[_0x2c09('0x71')](_0x3c4dbf)));};}Dialer[_0x2c09('0x85')][_0x2c09('0x86')]=function(_0xf230f3){return!_[_0x2c09('0x3f')](_0xf230f3)&&_0xf230f3&&!_['isUndefined'](_0xf230f3[_0x2c09('0x47')])&&!_[_0x2c09('0x3f')](_0xf230f3[_0x2c09('0x87')])&&_0xf230f3[_0x2c09('0x87')]&&(this[_0x2c09('0x88')][util[_0x2c09('0x45')](_0x2c09('0x89'),_0xf230f3['name'])][_0x2c09('0x8a')]===_0x2c09('0x8b')||this[_0x2c09('0x88')][util[_0x2c09('0x45')]('SIP/%s',_0xf230f3[_0x2c09('0x47')])][_0x2c09('0x8a')]==='unmonitored');};Dialer[_0x2c09('0x85')][_0x2c09('0x8c')]=function(_0x55cc0e){var _0xad0ab6=this;return function(){if(!_0xad0ab6[_0x2c09('0x86')](_0x55cc0e[_0x2c09('0x8d')])){if(!_0xad0ab6[_0x2c09('0x86')](_0x55cc0e['TrunkBackup'])){_0x55cc0e['message']=utils['CAMPAIGN_STATUS']['TRUNK_NOT_REACHABLE'];throw _0x55cc0e[_0x2c09('0x47')]+_0x2c09('0x8e');}}};};Dialer[_0x2c09('0x85')][_0x2c09('0x8f')]=function(_0x51f462,_0x2fd4a3,_0x114e91,_0x18ed5d){var _0xbe34bd=this;return function(){var _0xe41312=!![];return _0xbe34bd['ifTimeIvr'](_0x51f462,_0x2fd4a3,_0x114e91,_0x18ed5d,_0xe41312);};};Dialer['prototype'][_0x2c09('0x90')]=function(_0xc0aaa6,_0x4e6066,_0x568eeb,_0x195004){var _0x1d3d83=this;return function(){var _0x3f3b88=![];return _0x1d3d83[_0x2c09('0x91')](_0xc0aaa6[_0x2c09('0x74')],_0x4e6066,_0x568eeb,_0x195004,_0x3f3b88);};};Dialer['prototype'][_0x2c09('0x91')]=function(_0x5e4bf0,_0x971b42,_0x201767,_0x5cf094,_0x268b44){var _0x40300a=[];return new Promise(function(_0x472b5b,_0x5f50ab){if(!isNotNull(_0x5e4bf0)){_0x5cf094[_0x2c09('0x69')]=utils[_0x2c09('0x6a')][_0x2c09('0x73')];return _0x5f50ab(msgResponse(_0x2c09('0x92'),_0x2c09('0x93'),_0x201767+_0x2c09('0x94')));}if(_[_0x2c09('0x76')](_0x5e4bf0)){_0x5cf094['message']=utils[_0x2c09('0x6a')][_0x2c09('0x95')];return _0x5f50ab(msgResponse(_0x2c09('0x92'),_0x2c09('0x93'),_0x201767+_0x2c09('0x96')));}if(_0x971b42&&_[_0x2c09('0x3f')](config[_0x2c09('0x97')][_0x971b42])){_0x5cf094[_0x2c09('0x69')]=utils[_0x2c09('0x6a')][_0x2c09('0x98')];return _0x5f50ab(msgResponse(_0x2c09('0x92'),_0x2c09('0x93'),_0x201767+_0x2c09('0x99')+_0x971b42));}if(_[_0x2c09('0x9a')](_0x5e4bf0)){for(var _0x1a760a=0x0;_0x1a760a<_0x5e4bf0['length'];_0x1a760a+=0x1){_0x40300a['push'](ami[_0x2c09('0x9b')]({'action':'command','command':util[_0x2c09('0x45')]('iftime\x20%s,%s',_0x5e4bf0[_0x1a760a][_0x2c09('0x9c')],!_[_0x2c09('0x3f')](config[_0x2c09('0x97')][_0x971b42])?_0x971b42:'')})[_0x2c09('0x9d')](function(_0x21009c){return _0x21009c[_0x2c09('0x9e')][_0x2c09('0x9f')](_0x2c09('0xa0'))>=0x0;})['catch'](myreject(_0x5f50ab)));}}else{_0x40300a[_0x2c09('0xa1')](ami[_0x2c09('0x9b')]({'action':_0x2c09('0xa2'),'command':util[_0x2c09('0x45')](_0x2c09('0xa3'),_0x5e4bf0,!_[_0x2c09('0x3f')](config['timezones'][_0x971b42])?_0x971b42:'')})[_0x2c09('0x9d')](function(_0x340e74){return _0x340e74[_0x2c09('0x9e')]['indexOf'](_0x2c09('0xa0'))>=0x0;})[_0x2c09('0xa4')](myreject(_0x5f50ab)));}Promise[_0x2c09('0xa5')](_0x40300a)[_0x2c09('0x9d')](function(_0x367af8){var _0x1e5500=_['some'](_0x367af8);if(_0x1e5500){return _0x472b5b(_0x1e5500);}else{_0x5cf094[_0x2c09('0x69')]=_0x268b44?utils[_0x2c09('0x6a')][_0x2c09('0xa6')]:utils[_0x2c09('0x6a')][_0x2c09('0xa7')];return _0x5f50ab(msgResponse(_0x2c09('0xa8'),_0x2c09('0x93'),_0x2c09('0xa9')+_0x268b44+'\x20'+_0x201767+_0x2c09('0xaa')+util[_0x2c09('0x44')](_0x5e4bf0,{'showHidden':![],'depth':null})+_0x2c09('0xab')+_0x971b42));}})[_0x2c09('0xa4')](function(_0x6b8d08){return _0x5f50ab(msgResponse('ifTime',_0x2c09('0x93'),JSON[_0x2c09('0x71')](_0x6b8d08)));});});};Dialer[_0x2c09('0x85')][_0x2c09('0x3c')]=function(){var _0x55cfa5=this;return cmHopper[_0x2c09('0xac')]({'active':![]},{'where':{'active':!![]}})[_0x2c09('0x9d')](function(){setInterval(function(){_0x55cfa5[_0x2c09('0xad')]();},0x3e8);});};Dialer[_0x2c09('0x85')][_0x2c09('0xad')]=function(){var _0x26425c=this;var _0x4f0533;for(var _0x3965fd in this[_0x2c09('0x1f')]){if(typeof this['campaigns'][_0x3965fd]!==_0x2c09('0xae')){_0x4f0533=this[_0x2c09('0x1f')][_0x3965fd];if(utils[_0x2c09('0x79')](_0x4f0533)&&utils[_0x2c09('0x77')](_0x4f0533)){_0x4f0533[_0x2c09('0x7c')]=!![];Promise[_0x2c09('0xaf')]()[_0x2c09('0x9d')](checkIsIVRCampaignActive(_0x4f0533))['then'](checkInterval(_0x4f0533))[_0x2c09('0x9d')](_0x26425c[_0x2c09('0x8c')](_0x4f0533))['then'](_0x26425c[_0x2c09('0x8f')](_0x4f0533[_0x2c09('0xb0')],_0x4f0533[_0x2c09('0xb1')],_0x4f0533[_0x2c09('0x47')],_0x4f0533))['then'](_0x26425c[_0x2c09('0x90')](_0x4f0533[_0x2c09('0x72')],_0x4f0533[_0x2c09('0xb1')],_0x4f0533[_0x2c09('0x47')],_0x4f0533))[_0x2c09('0x9d')](_0x26425c[_0x2c09('0xb2')](_0x4f0533))['catch'](loggerCatchQueueSummary(_0x2c09('0xb3'),_0x4f0533));}else{notSendMessagesCampaign(_0x4f0533);}}}};Dialer[_0x2c09('0x85')][_0x2c09('0xb4')]=function(_0x1f52bc){if(_0x1f52bc[_0x2c09('0xb5')]!==_0x2c09('0x8')){clearPredictiveAttributes(_0x1f52bc);}switch(_0x1f52bc[_0x2c09('0xb5')]){case _0x2c09('0xb6'):this[_0x2c09('0xb7')](_0x1f52bc,0x1);break;case'power':this['handlePower'](_0x1f52bc,_0x1f52bc['dialPowerLevel']);break;case _0x2c09('0x8'):this[_0x2c09('0x8')](_0x1f52bc);break;case'booked':this['handlePower'](_0x1f52bc,0x1);break;default:logger[_0x2c09('0x65')](_0x2c09('0xb8'),_0x1f52bc[_0x2c09('0x47')],_0x2c09('0xb9'));}};Dialer[_0x2c09('0x85')]['ifTime']=function(_0x4ce8ec,_0xe8260d){var _0x241766=_0x4ce8ec[_0x2c09('0xb1')];var _0xed15b5=_0xe8260d?_0x4ce8ec[_0x2c09('0xb0')]:_0x4ce8ec[_0x2c09('0x72')]['Intervals'];logger[_0x2c09('0xba')](_0x2c09('0xbb'),_0xed15b5,_0x241766,_0x4ce8ec[_0x2c09('0x47')],util['format'](_0x2c09('0xbc'),_0x4ce8ec[_0x2c09('0x47')],_0x4ce8ec['id']));var _0x9a3cec=null;return Interval[_0x2c09('0xbd')](_0xed15b5,_0x241766)[_0x2c09('0x9d')](function(_0x1e4f54){if(_0x1e4f54===!![]){return _0x1e4f54;}else{_0x4ce8ec['message']=_0xe8260d?utils[_0x2c09('0x6a')]['OVERTIME_GLOBAL_INTERVAL']:utils['CAMPAIGN_STATUS'][_0x2c09('0xa7')];_0x9a3cec=msgResponse(_0x2c09('0xa8'),_0x2c09('0x93'),_0x2c09('0xa9')+_0xe8260d+'\x20'+_0x4ce8ec[_0x2c09('0x47')]+_0x2c09('0xaa')+util['inspect'](_0xed15b5,{'showHidden':![],'depth':null})+_0x2c09('0xab')+_0x241766);}if(_0x9a3cec!==null){logger[_0x2c09('0xba')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x9a3cec);_0x9a3cec[_0x2c09('0xbe')]=_0xe8260d;throw _0x9a3cec;}})[_0x2c09('0xa4')](function(_0x54ecf7){logger[_0x2c09('0x65')](_0x2c09('0xbf'),_0x54ecf7);throw msgResponse(_0x2c09('0x83'),_0x2c09('0x84'),util[_0x2c09('0x44')](_0x54ecf7,{'showHidden':![],'depth':null}));});};Dialer[_0x2c09('0x85')][_0x2c09('0x2b')]=function(_0xf9eb51){if(this[_0x2c09('0x1e')][_0xf9eb51['queue']]){if(this[_0x2c09('0x23')][_0xf9eb51['uniqueid']]&&this[_0x2c09('0x23')][_0xf9eb51[_0x2c09('0xc0')]]['type']!==_0x2c09('0xc1')){this['updateOriginated'](this[_0x2c09('0x1e')][_0xf9eb51[_0x2c09('0xc2')]]);this[_0x2c09('0x23')][_0xf9eb51[_0x2c09('0xc0')]][_0x2c09('0xc3')]=moment()[_0x2c09('0x45')](_0x2c09('0xc4'));}}};Dialer[_0x2c09('0x85')]['syncAgentComplete']=function(_0x368d51){var _0x55bd77=this[_0x2c09('0x23')][_0x368d51['uniqueid']];if(this[_0x2c09('0x1e')][_0x368d51[_0x2c09('0xc2')]]){if(_0x55bd77&&_0x55bd77['type']!==_0x2c09('0xc1')){delete this[_0x2c09('0x23')][_0x368d51[_0x2c09('0xc0')]];this[_0x2c09('0x1e')][_0x368d51[_0x2c09('0xc2')]][_0x2c09('0xc5')]+=0x1;var _0x354952=new AgentComplete(_0x55bd77,_0x368d51);if(_0x368d51[_0x2c09('0xc6')]===_0x2c09('0xc7')){_0x354952[_0x2c09('0xc8')]=this[_0x2c09('0x1e')][_0x368d51[_0x2c09('0xc2')]][_0x2c09('0xc9')]&&this[_0x2c09('0x1e')][_0x368d51[_0x2c09('0xc2')]]['dialAgiAfterHangupAgent']?moment()[_0x2c09('0x45')](_0x2c09('0xc4')):undefined;}hopperUtils[_0x2c09('0xca')](_0x354952)[_0x2c09('0xa4')](loggerCatch(_0x2c09('0xcb')));hopperUtils[_0x2c09('0xcc')](_0x354952)[_0x2c09('0xa4')](loggerCatch(_0x2c09('0xcd')));}}};Dialer[_0x2c09('0x85')][_0x2c09('0x2d')]=function(_0x1c9a7c){var _0x28a82a=this['uniqueId'][_0x1c9a7c[_0x2c09('0xc0')]];var _0x7670b2=this;var _0x37bb32=![];var _0x492378;var _0x27c16e;if(this[_0x2c09('0x1e')][_0x1c9a7c[_0x2c09('0xc2')]]){if(_0x28a82a&&_0x28a82a['type']!=='ivr'){delete this['uniqueId'][_0x1c9a7c[_0x2c09('0xc0')]];this[_0x2c09('0xce')](this[_0x2c09('0x1e')][_0x1c9a7c[_0x2c09('0xc2')]]);_0x28a82a[_0x2c09('0xcf')]=moment()[_0x2c09('0x45')](_0x2c09('0xc4'));var _0x26d315=new QueueCallerAbandon(_0x28a82a,_0x1c9a7c);if(utils[_0x2c09('0x61')](_0x28a82a[_0x2c09('0xcf')],_0x28a82a[_0x2c09('0xd0')])>=_0x28a82a[_0x2c09('0xd1')]){this[_0x2c09('0x1e')][_0x1c9a7c['queue']][_0x2c09('0x50')]+=0x1;this[_0x2c09('0x1e')][_0x1c9a7c['queue']]['outboundDropCallsDayTimeout']+=0x1;this[_0x2c09('0x1e')][_0x1c9a7c[_0x2c09('0xc2')]][_0x2c09('0xd2')]+=0x1;_0x26d315['state']=0xa;_0x26d315[_0x2c09('0xd3')]=_0x2c09('0xd4');_0x26d315[_0x2c09('0xd5')]='TIMEOUT';_0x26d315[_0x2c09('0xc8')]=this[_0x2c09('0x1e')][_0x1c9a7c['queue']]['dialQueueProject2']?moment()[_0x2c09('0x45')](_0x2c09('0xc4')):undefined;_0x26d315[_0x2c09('0xd6')]+=0x1;_0x26d315['countglobal']+=0x1;_0x492378=this[_0x2c09('0x1e')][_0x1c9a7c[_0x2c09('0xc2')]][_0x2c09('0xd7')];_0x27c16e=this['voiceQueues'][_0x1c9a7c[_0x2c09('0xc2')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x2c09('0xd8')](_0x26d315,_0x26d315['state'],_0x28a82a[_0x2c09('0xd9')])[_0x2c09('0x9d')](function(_0x42e80f){_0x37bb32=_0x42e80f[_0x2c09('0xda')]==0x1;if(_0x26d315[_0x2c09('0xd6')]>=_0x7670b2['voiceQueues'][_0x1c9a7c[_0x2c09('0xc2')]]['dialDropMaxRetry']){_0x7670b2[_0x2c09('0xdb')](_0x26d315,_0x42e80f[_0x2c09('0xda')]);}else{hopperUtils[_0x2c09('0xdc')]({'active':![],'countdropretry':_0x26d315[_0x2c09('0xd6')],'scheduledat':moment()['add'](_0x7670b2[_0x2c09('0x1e')][_0x1c9a7c[_0x2c09('0xc2')]][_0x2c09('0xd7')],'minutes')[_0x2c09('0x45')](_0x2c09('0xc4')),'ContactId':_0x28a82a[_0x2c09('0xdd')],'ListId':_0x28a82a[_0x2c09('0xde')],'VoiceQueueId':_0x28a82a[_0x2c09('0xdf')]||undefined,'CampaignId':_0x28a82a['CampaignId']||undefined})['catch'](loggerCatch(_0x2c09('0xe0')));var _0x4fee7c=new History(_0x26d315);_0x4fee7c[_0x2c09('0xe1')]=0xa;_0x4fee7c[_0x2c09('0xd3')]=_0x2c09('0xd4');_0x4fee7c[_0x2c09('0xe2')]=moment()['format'](_0x2c09('0xc4'));_0x4fee7c[_0x2c09('0x6d')]=_0x4fee7c[_0x2c09('0xe2')];_0x4fee7c[_0x2c09('0xe3')]=_0x26d315[_0x2c09('0xe3')];_0x4fee7c['calleridnum']=_0x26d315[_0x2c09('0xe4')];hopperUtils[_0x2c09('0xca')](_0x4fee7c)[_0x2c09('0xa4')](loggerCatch(_0x2c09('0xe5')));}})[_0x2c09('0x9d')](function(){if(_0x37bb32)hopperUtils[_0x2c09('0xe6')](_0x26d315,_0x492378,_0x27c16e)[_0x2c09('0x9d')](function(){return 0x1;});});}else{this[_0x2c09('0x1e')][_0x1c9a7c[_0x2c09('0xc2')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x2c09('0x1e')][_0x1c9a7c[_0x2c09('0xc2')]][_0x2c09('0xe7')]+=0x1;_0x26d315[_0x2c09('0xe1')]=0xb;_0x26d315[_0x2c09('0xd3')]=_0x2c09('0xe8');_0x26d315[_0x2c09('0xd5')]=_0x2c09('0xe9');_0x26d315[_0x2c09('0xea')]+=0x1;_0x26d315[_0x2c09('0xeb')]+=0x1;_0x492378=this[_0x2c09('0x1e')][_0x1c9a7c[_0x2c09('0xc2')]][_0x2c09('0xec')];_0x27c16e=this[_0x2c09('0x1e')][_0x1c9a7c[_0x2c09('0xc2')]][_0x2c09('0xed')];hopperUtils[_0x2c09('0xd8')](_0x26d315,_0x26d315['state'],_0x28a82a[_0x2c09('0xd9')])[_0x2c09('0x9d')](function(_0x496705){if(_0x26d315[_0x2c09('0xea')]>=_0x7670b2[_0x2c09('0x1e')][_0x1c9a7c[_0x2c09('0xc2')]][_0x2c09('0xee')]){_0x7670b2[_0x2c09('0xdb')](_0x26d315,_0x496705[_0x2c09('0xda')]);}else{hopperUtils[_0x2c09('0xdc')]({'active':![],'countabandonedretry':_0x26d315['countabandonedretry'],'scheduledat':moment()[_0x2c09('0xef')](_0x7670b2[_0x2c09('0x1e')][_0x1c9a7c['queue']]['dialAbandonedRetryFrequency'],_0x2c09('0xf0'))[_0x2c09('0x45')](_0x2c09('0xc4')),'ContactId':_0x28a82a[_0x2c09('0xdd')],'ListId':_0x28a82a['ListId'],'VoiceQueueId':_0x28a82a[_0x2c09('0xdf')]||undefined,'CampaignId':_0x28a82a[_0x2c09('0xf1')]||undefined})[_0x2c09('0xa4')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x17245c=new History(_0x26d315);_0x17245c[_0x2c09('0xe1')]=0xb;_0x17245c[_0x2c09('0xd3')]=_0x2c09('0xe8');_0x17245c[_0x2c09('0xe2')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x17245c[_0x2c09('0x6d')]=_0x17245c[_0x2c09('0xe2')];_0x17245c[_0x2c09('0xe3')]=_0x26d315[_0x2c09('0xe3')];_0x17245c[_0x2c09('0xe4')]=_0x26d315[_0x2c09('0xe4')];hopperUtils[_0x2c09('0xca')](_0x17245c)['catch'](loggerCatch(_0x2c09('0xf2')));}})[_0x2c09('0x9d')](function(){if(_0x37bb32)hopperUtils[_0x2c09('0xe6')](_0x26d315,_0x492378,_0x27c16e)['then'](function(){return 0x1;});});}}}};Dialer[_0x2c09('0x85')]['syncNewExten']=function(_0x10d777){if(this['actions'][_0x10d777['uniqueid']]){this[_0x2c09('0x22')][_0x10d777[_0x2c09('0xc0')]][_0x2c09('0xf3')]=_0x10d777[_0x2c09('0xf3')];}if(this[_0x2c09('0x23')][_0x10d777[_0x2c09('0xc0')]]){this[_0x2c09('0x23')][_0x10d777[_0x2c09('0xc0')]][_0x2c09('0xf3')]=_0x10d777[_0x2c09('0xf3')];}};Dialer['prototype'][_0x2c09('0xf4')]=function(_0x27d869){if(!this[_0x2c09('0x22')][_0x27d869[_0x2c09('0xf5')]]){return;}var _0x231c1d=this['voiceQueues'][this[_0x2c09('0x22')][_0x27d869['actionid']][_0x2c09('0xc2')]][_0x2c09('0xf6')]||_0x2c09('0xf7');if(_0x231c1d==='roundrobin'){if(this[_0x2c09('0x22')][_0x27d869[_0x2c09('0xf5')]]&&_[_0x2c09('0xf8')](this[_0x2c09('0x22')][_0x27d869[_0x2c09('0xf5')]][_0x2c09('0xf9')])&&_0x27d869[_0x2c09('0x8a')]==='1'&&_0x27d869[_0x2c09('0xfa')]==='0'){if(this[_0x2c09('0x20')][_0x27d869[_0x2c09('0xfb')]]){if(!this['agents'][_0x27d869[_0x2c09('0xfb')]][_0x2c09('0xf9')]){this[_0x2c09('0x20')][_0x27d869[_0x2c09('0xfb')]][_0x2c09('0xf9')]=!![];this[_0x2c09('0x22')][_0x27d869[_0x2c09('0xf5')]]['locked']=!![];this[_0x2c09('0x22')][_0x27d869['actionid']]['stateinterface']=_0x27d869['stateinterface'];}}}}else if(_0x231c1d===_0x2c09('0xf7')){if(this['actions'][_0x27d869[_0x2c09('0xf5')]]){if(this[_0x2c09('0x20')][_0x27d869[_0x2c09('0xfb')]]){this[_0x2c09('0x22')][_0x27d869[_0x2c09('0xf5')]][_0x2c09('0xfb')]=_0x27d869[_0x2c09('0xfb')];if(_[_0x2c09('0xf8')](this['queueBooked'][this[_0x2c09('0x22')][_0x27d869['actionid']][_0x2c09('0xc2')]])){this[_0x2c09('0x27')][this['actions'][_0x27d869[_0x2c09('0xf5')]][_0x2c09('0xc2')]]=[];}this[_0x2c09('0x27')][this[_0x2c09('0x22')][_0x27d869[_0x2c09('0xf5')]][_0x2c09('0xc2')]][_0x2c09('0xa1')](_[_0x2c09('0x60')](_['pick'](this[_0x2c09('0x22')][_0x27d869[_0x2c09('0xf5')]],[_0x2c09('0xfc'),'stateinterface']),{'status':_0x27d869['status'],'paused':_0x27d869[_0x2c09('0xfa')]}));}}}};Dialer[_0x2c09('0x85')]['syncQueueStatusComplete']=function(_0x475d03){if(!this['actions'][_0x475d03['actionid']]){return;}var _0x1349c8=this;var _0x32083f=this[_0x2c09('0x1e')][this['actions'][_0x475d03[_0x2c09('0xf5')]][_0x2c09('0xc2')]];var _0x1ec62c=_0x32083f[_0x2c09('0xf6')]||'rrmemory';if(_0x1ec62c===_0x2c09('0xfd')){if(this[_0x2c09('0x22')][_0x475d03['actionid']]&&this[_0x2c09('0x22')][_0x475d03[_0x2c09('0xf5')]]['stateinterface']){this['preview'][_0x2c09('0xfe')](this[_0x2c09('0x22')][_0x475d03['actionid']][_0x2c09('0xfc')],this['actions'][_0x475d03[_0x2c09('0xf5')]][_0x2c09('0xfb')])[_0x2c09('0xa4')](function(_0x5b5775){logger['error'](_0x2c09('0xff'),util[_0x2c09('0x44')](_0x5b5775,{'showHidden':![],'depth':null}));})[_0x2c09('0x1b')](function(){_0x1349c8[_0x2c09('0xce')](_0x1349c8[_0x2c09('0x1e')][_0x1349c8['actions'][_0x475d03[_0x2c09('0xf5')]][_0x2c09('0xc2')]]);_0x1349c8['agents'][_0x1349c8['actions'][_0x475d03['actionid']][_0x2c09('0xfb')]]['locked']=![];delete _0x1349c8[_0x2c09('0x22')][_0x475d03[_0x2c09('0xf5')]];unlockQueueStatus(_0x32083f);});}else{this['updateOriginated'](this[_0x2c09('0x1e')][this[_0x2c09('0x22')][_0x475d03['actionid']][_0x2c09('0xc2')]]);hopperUtils[_0x2c09('0xdc')]({'active':![],'ContactId':this[_0x2c09('0x22')][_0x475d03[_0x2c09('0xf5')]]['ContactId'],'ListId':this[_0x2c09('0x22')][_0x475d03[_0x2c09('0xf5')]][_0x2c09('0xde')],'VoiceQueueId':this[_0x2c09('0x22')][_0x475d03[_0x2c09('0xf5')]][_0x2c09('0xdf')]||undefined,'CampaignId':this['actions'][_0x475d03['actionid']][_0x2c09('0xf1')]||undefined})['catch'](loggerCatch(_0x2c09('0x100')));delete this[_0x2c09('0x22')][_0x475d03[_0x2c09('0xf5')]];unlockQueueStatus(_0x32083f);}}else if(_0x1ec62c===_0x2c09('0xf7')){var _0x1f7401;if(this[_0x2c09('0x22')][_0x475d03[_0x2c09('0xf5')]]&&!_[_0x2c09('0x76')](this[_0x2c09('0x27')][this['actions'][_0x475d03[_0x2c09('0xf5')]][_0x2c09('0xc2')]])){if(this[_0x2c09('0x28')][_0x1349c8[_0x2c09('0x22')][_0x475d03[_0x2c09('0xf5')]][_0x2c09('0xc2')]]){this[_0x2c09('0x28')][_0x1349c8['actions'][_0x475d03[_0x2c09('0xf5')]][_0x2c09('0xc2')]]=this[_0x2c09('0x28')][this[_0x2c09('0x22')][_0x475d03['actionid']][_0x2c09('0xc2')]]?this['queueBookedRR'][this[_0x2c09('0x22')][_0x475d03[_0x2c09('0xf5')]][_0x2c09('0xc2')]]:this[_0x2c09('0x27')][this[_0x2c09('0x22')][_0x475d03['actionid']][_0x2c09('0xc2')]]?this[_0x2c09('0x27')][this[_0x2c09('0x22')][_0x475d03['actionid']]['queue']][_0x2c09('0x101')]||0x0:0x0;}this[_0x2c09('0x27')][this[_0x2c09('0x22')][_0x475d03[_0x2c09('0xf5')]][_0x2c09('0xc2')]][_0x2c09('0x101')]=this[_0x2c09('0x28')][this[_0x2c09('0x22')][_0x475d03['actionid']][_0x2c09('0xc2')]];for(var _0x2fb405=0x0;_0x2fb405=_0x3fd7e2[_0x2c09('0x126')]){_0x57b466[_0x2c09('0x127')](_0xf91204,_0x4b0cb5,_0x1d1327,_0x2c09('0x128'));}else{if(_0xf91204['countmachineretry']>=_0x3fd7e2[_0x2c09('0x129')]){_0x57b466[_0x2c09('0x12a')](_0xf91204,_0x4b0cb5,_0x1d1327,'reason\x2019\x20machine....');}else{hopperUtils[_0x2c09('0xdc')]({'active':![],'countmachineretry':_0xf91204[_0x2c09('0x125')],'scheduledat':moment()['add'](_0x3fd7e2[_0x2c09('0x12b')],_0x2c09('0xf0'))[_0x2c09('0x45')](_0x2c09('0xc4')),'ContactId':_0xf91204[_0x2c09('0xdd')],'ListId':_0xf91204[_0x2c09('0xde')],'VoiceQueueId':_0xf91204[_0x2c09('0xdf')]||undefined,'CampaignId':_0xf91204[_0x2c09('0xf1')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x4b0cb5({'reschedule':0x1});}}});}if(_0x252267['type']===_0x2c09('0xc1')&&this[_0x2c09('0x1f')][_0x252267['queue']][_0x2c09('0x11c')]&&_0xe763ee['value']===_0x2c09('0x115')){delete this[_0x2c09('0x23')][_0xe763ee[_0x2c09('0xc0')]];this['updateOriginated'](this['campaigns'][_0x252267['queue']]);_0x132a3d=new Hangup(_0x252267,_0xe763ee);_0x132a3d['state']=0x12;_0x132a3d[_0x2c09('0xd3')]='HangupInAMD';_0x132a3d[_0x2c09('0x116')]=_0x2c09('0x117');ami['emit']('custom:amd',ut[_0x2c09('0x118')](_0x132a3d,_0x2c09('0x120')));this['saveInDb'](_0x132a3d,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x252267[_0x2c09('0x41')]===_0x2c09('0xc1')&&this[_0x2c09('0x1f')][_0x252267[_0x2c09('0xc2')]][_0x2c09('0x11c')]&&_0xe763ee[_0x2c09('0x114')]===_0x2c09('0x11d')){return new Promise(function(_0x557294,_0x3c7c60){delete _0x57b466['uniqueId'][_0xe763ee[_0x2c09('0xc0')]];_0x57b466['updateOriginated'](_0x57b466[_0x2c09('0x1f')][_0x252267['queue']]);_0x57b466[_0x2c09('0x1f')][_0x252267[_0x2c09('0xc2')]][_0x2c09('0xc5')]+=0x1;_0x57b466[_0x2c09('0x1f')][_0x252267['queue']][_0x2c09('0x11e')]+=0x1;var _0x4fd592=_0x57b466['campaigns'][_0x252267['queue']];var _0x567384=new Hangup(_0x252267,_0xe763ee);_0x567384[_0x2c09('0xe1')]=0x13;_0x567384[_0x2c09('0xd3')]=_0x2c09('0x11f');_0x567384[_0x2c09('0x116')]='AMD';_0x567384[_0x2c09('0x125')]+=0x1;_0x567384['countglobal']+=0x1;_0x567384[_0x2c09('0x120')]=!![];ami[_0x2c09('0x40')](_0x2c09('0x12c'),ut[_0x2c09('0x118')](_0x567384,_0x2c09('0x120')));hopperUtils[_0x2c09('0xca')](_0x567384)[_0x2c09('0xa4')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x567384['countbusyretry']+_0x567384[_0x2c09('0x122')]+_0x567384[_0x2c09('0x123')]+_0x567384['countnosuchnumberretry']+_0x567384[_0x2c09('0xd6')]+_0x567384[_0x2c09('0xea')]+_0x567384['countmachineretry']+_0x567384[_0x2c09('0x12d')]>=_0x4fd592[_0x2c09('0x126')]){_0x57b466[_0x2c09('0x127')](_0x567384,_0x557294,_0x3c7c60,_0x2c09('0x128'));}else{if(_0x567384[_0x2c09('0x125')]>=_0x4fd592[_0x2c09('0x129')]){_0x57b466[_0x2c09('0x12a')](_0x567384,_0x557294,_0x3c7c60,_0x2c09('0x12e'));}else{hopperUtils[_0x2c09('0xdc')]({'active':![],'countmachineretry':_0x567384[_0x2c09('0x125')],'scheduledat':moment()[_0x2c09('0xef')](_0x4fd592[_0x2c09('0x12b')],'minutes')[_0x2c09('0x45')](_0x2c09('0xc4')),'ContactId':_0x567384[_0x2c09('0xdd')],'ListId':_0x567384['ListId'],'VoiceQueueId':_0x567384['VoiceQueueId']||undefined,'CampaignId':_0x567384[_0x2c09('0xf1')]||undefined})[_0x2c09('0xa4')](loggerCatch(_0x2c09('0x12f')));_0x557294({'reschedule':0x1});}}});}}};Dialer[_0x2c09('0x85')]['syncHangup']=function(_0x110739){var _0x184c60=this['uniqueId'][_0x110739['uniqueid']];var _0x475988;if(_0x184c60&&_0x184c60[_0x2c09('0x41')]===_0x2c09('0xc1')){delete this['uniqueId'][_0x110739['uniqueid']];this[_0x2c09('0xce')](this['campaigns'][_0x184c60['queue']]);this[_0x2c09('0x1f')][_0x184c60[_0x2c09('0xc2')]][_0x2c09('0x130')]+=0x1;_0x475988=new Hangup(_0x184c60,_0x110739);hopperUtils[_0x2c09('0xca')](_0x475988)[_0x2c09('0xa4')](loggerCatch(_0x2c09('0x131')));hopperUtils['moveContactManagedDialer'](_0x475988)[_0x2c09('0xa4')](loggerCatch(_0x2c09('0x132')));}if(_0x184c60&&_0x184c60[_0x2c09('0x41')]!==_0x2c09('0xc1')&&isNotNull(this[_0x2c09('0x1e')][_0x184c60[_0x2c09('0xc2')]][_0x2c09('0x133')])){delete this[_0x2c09('0x23')][_0x110739[_0x2c09('0xc0')]];this['updateOriginated'](this[_0x2c09('0x1e')][_0x184c60[_0x2c09('0xc2')]]);this[_0x2c09('0x1e')][_0x184c60[_0x2c09('0xc2')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x184c60[_0x2c09('0xc2')]][_0x2c09('0x11e')]+=0x1;_0x475988=new Hangup(_0x184c60,_0x110739);_0x475988[_0x2c09('0xe1')]=0x10;_0x475988[_0x2c09('0xd3')]=_0x2c09('0x134');_0x475988[_0x2c09('0x116')]='AGI';hopperUtils[_0x2c09('0xca')](_0x475988)['catch'](loggerCatch(_0x2c09('0x131')));hopperUtils[_0x2c09('0xcc')](_0x475988)[_0x2c09('0xa4')](loggerCatch(_0x2c09('0x132')));}if(_0x184c60&&_0x184c60['type']!==_0x2c09('0xc1')&&!isNotNull(this[_0x2c09('0x1e')][_0x184c60[_0x2c09('0xc2')]][_0x2c09('0x133')])){if(_0x110739[_0x2c09('0x135')]===_0x2c09('0x136')){delete this[_0x2c09('0x23')][_0x110739[_0x2c09('0xc0')]];this['voiceQueues'][_0x184c60[_0x2c09('0xc2')]][_0x2c09('0xc5')]+=0x1;const _0xeb4576=new AgentComplete(_0x184c60,_0x110739);_0xeb4576[_0x2c09('0xf1')]=this[_0x2c09('0x1e')][_0x184c60[_0x2c09('0xc2')]]['id'];hopperUtils[_0x2c09('0xca')](_0xeb4576)[_0x2c09('0xa4')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils['moveContactManagedDialer'](_0xeb4576)['catch'](loggerCatch(_0x2c09('0xcd')));}else{delete this[_0x2c09('0x23')][_0x110739['uniqueid']];this[_0x2c09('0xce')](this[_0x2c09('0x1e')][_0x184c60[_0x2c09('0xc2')]]);this[_0x2c09('0x1e')][_0x184c60[_0x2c09('0xc2')]][_0x2c09('0x137')]+=0x1;_0x475988=new Hangup(_0x184c60,_0x110739);_0x475988[_0x2c09('0xe1')]=0xc;_0x475988[_0x2c09('0xd3')]=_0x110739[_0x2c09('0x135')];_0x475988[_0x2c09('0x116')]='Unknow';hopperUtils['createHistory'](_0x475988)[_0x2c09('0xa4')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x475988)['catch'](loggerCatch(_0x2c09('0x132')));}}};Dialer[_0x2c09('0x85')]['syncQueueSummary']=function(_0x1f5fd4){var _0x5b73e0=this;if(!_0x5b73e0[_0x2c09('0x29')][_0x1f5fd4['name']]){_0x5b73e0[_0x2c09('0x29')][_0x1f5fd4[_0x2c09('0x47')]]={'running':![]};}else if(_0x5b73e0[_0x2c09('0x29')][_0x1f5fd4[_0x2c09('0x47')]]['running']===!![]){return;}else if(_0x5b73e0['queuesSummary'][_0x1f5fd4['name']][_0x2c09('0x138')]===![]){_0x5b73e0[_0x2c09('0x29')][_0x1f5fd4[_0x2c09('0x47')]][_0x2c09('0x138')]=!![];}var _0x3f7fa5=_0x5b73e0[_0x2c09('0x1e')][_0x1f5fd4['name']];var _0x1f5c27=_0x3f7fa5['message']!==utils['CAMPAIGN_STATUS'][_0x2c09('0x7e')];var _0x238e4f=utils['isPreviewCampaign'](_0x3f7fa5);_0x3f7fa5['statusMessage']=utils[_0x2c09('0x139')](_0x3f7fa5,_0x5b73e0['trunks']);Promise[_0x2c09('0xaf')]()['then'](function(){if(_0x3f7fa5[_0x2c09('0x13a')]===utils[_0x2c09('0x6a')][_0x2c09('0x7e')]){if(_0x1f5c27){clearPredictiveAttributes(_0x3f7fa5);_0x1f5fd4['startPredictive']=undefined;_0x1f5fd4['startProgressive']=undefined;}if(_0x3f7fa5['statusMessage']===utils[_0x2c09('0x6a')][_0x2c09('0x7e')]){_0x1f5fd4[_0x2c09('0x13b')]=0x0;_0x1f5fd4[_0x2c09('0xfa')]=0x0;_0x1f5fd4[_0x2c09('0x13c')]=0x0;_0x1f5fd4[_0x2c09('0x13d')]=0x0;_0x1f5fd4[_0x2c09('0x13e')]=0x0;}}else if(_0x3f7fa5['statusMessage']===utils['CAMPAIGN_STATUS'][_0x2c09('0x13f')]&&!_0x238e4f){return _0x5b73e0[_0x2c09('0x92')](_0x3f7fa5,!![])['then'](function(){return _0x5b73e0[_0x2c09('0x92')](_0x3f7fa5,![]);})['then'](function(){return _0x5b73e0[_0x2c09('0xb4')](_0x3f7fa5);})[_0x2c09('0xa4')](function(_0x3b885c){loggerSyncQueueSummary['debug'](_0x2c09('0x140'),util[_0x2c09('0x44')](_0x3b885c,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x3f7fa5);});}else{clearPredictiveAttributes(_0x3f7fa5);}})[_0x2c09('0x9d')](function(){var _0x662bd3=_0x1f5fd4[_0x2c09('0x141')](_0x3f7fa5);if(_0x662bd3||_0x3f7fa5[_0x2c09('0x142')]){_0x3f7fa5['queueSummaryCountersUpdated']=![];_0x1f5fd4[_0x2c09('0x143')](_0x3f7fa5);Object[_0x2c09('0x144')](_0x3f7fa5,_0x1f5fd4);emitOutboundVoiceQueueSummary(_0x1f5fd4);}_0x5b73e0[_0x2c09('0x29')][_0x3f7fa5[_0x2c09('0x47')]][_0x2c09('0x138')]=![];})[_0x2c09('0xa4')](function(_0x1255ef){logger[_0x2c09('0x65')](_0x2c09('0x140'),util[_0x2c09('0x44')](_0x1255ef,{'showHidden':![],'depth':null}));_0x5b73e0[_0x2c09('0x29')][_0x3f7fa5[_0x2c09('0x47')]][_0x2c09('0x138')]=![];});};Dialer[_0x2c09('0x85')][_0x2c09('0x34')]=_['throttle'](function(){var _0x28c646=_[_0x2c09('0x145')](this[_0x2c09('0x1e')],function(_0x2bc302){return _0x2bc302[_0x2c09('0x146')];});var _0x3f6e10=_[_0x2c09('0x145')](this[_0x2c09('0x20')],function(_0x26f6d7){return _0x26f6d7[_0x2c09('0x147')]&&_0x26f6d7[_0x2c09('0x8a')]===_0x2c09('0x8b');});if(_0x28c646[_0x2c09('0x102')]>0x0&&_0x3f6e10[_0x2c09('0x102')]>0x0){return Promise[_0x2c09('0xaf')]()[_0x2c09('0x9d')](cmHopper['handlePreviewRecallNotifications'](_[_0x2c09('0x148')](_0x28c646,'id'),previewRecallmeReminderInterval,_[_0x2c09('0x148')](_0x3f6e10,'id')))['then'](function(_0x26962f){for(var _0x5db53b=0x0;_0x5db53b<_0x26962f[_0x2c09('0x102')];_0x5db53b++){var _0x56417c=_0x26962f[_0x5db53b]['Agent'][_0x2c09('0x47')];if(_0x56417c)io['to'](util[_0x2c09('0x45')](_0x2c09('0x149'),_0x56417c))[_0x2c09('0x40')](_0x2c09('0x14a'),{'hopper':_0x26962f[_0x5db53b]});}})[_0x2c09('0xa4')](function(_0x11230b){logger[_0x2c09('0x65')](_0x2c09('0x14b'),_0x11230b);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x2c09('0x85')][_0x2c09('0x3d')]=function(){var _0x4fa3ba=this;setInterval(function(){_0x4fa3ba[_0x2c09('0x14c')](_0x4fa3ba['uniqueId'],_0x2c09('0x14d'));_0x4fa3ba[_0x2c09('0x14c')](_0x4fa3ba[_0x2c09('0x22')],'[actions]');},0x32c8);};Dialer[_0x2c09('0x85')][_0x2c09('0x14c')]=function(_0x492c13,_0x292f4d){var _0x4ba159=this;for(var _0x413484 in _0x492c13){if(typeof _0x492c13[_0x413484]!==_0x2c09('0xae')){this['sequence']['enqueue'](function(){if(!_[_0x2c09('0xf8')](_0x492c13[_0x413484])){return ami[_0x2c09('0x9b')]({'action':'status','channel':_0x492c13[_0x413484][_0x2c09('0xf3')]})[_0x2c09('0xa4')](function(_0x377050){if(_0x377050[_0x2c09('0x69')]===_0x2c09('0x14e')){setTimeout(function(){if(_0x492c13[_0x413484]&&_0x492c13[_0x413484][_0x2c09('0x41')]!==_0x2c09('0xc1')){_0x4ba159[_0x2c09('0xce')](_0x4ba159[_0x2c09('0x1e')][_0x492c13[_0x413484]['queue']]);logger[_0x2c09('0x65')]('[Dialer][checkChannel]',_0x292f4d,_0x413484,_0x492c13[_0x413484][_0x2c09('0xc2')]);delete _0x492c13[_0x413484];}if(_0x492c13[_0x413484]&&_0x492c13[_0x413484][_0x2c09('0x41')]===_0x2c09('0xc1')){_0x4ba159[_0x2c09('0xce')](_0x4ba159['campaigns'][_0x492c13[_0x413484][_0x2c09('0xc2')]]);logger[_0x2c09('0x65')](_0x2c09('0x14f'),_0x292f4d,_0x413484,_0x492c13[_0x413484][_0x2c09('0xc2')]);delete _0x492c13[_0x413484];}},0x2328);}});}});}}};Dialer[_0x2c09('0x85')]['getVoiceQueueRtPauses']=function(_0x2a45ee){return Promise[_0x2c09('0xaf')]()[_0x2c09('0x9d')](voiceQueueRt[_0x2c09('0x150')](_0x2a45ee))['catch'](loggerCatch(_0x2c09('0x151')));};Dialer[_0x2c09('0x85')][_0x2c09('0xce')]=function(_0x1f6d0d){if(!_['isUndefined'](_0x1f6d0d)&&_0x1f6d0d!==null){if(typeof _0x1f6d0d[_0x2c09('0x7d')]!=='undefined'){if(_0x1f6d0d[_0x2c09('0x7d')]>0x0){_0x1f6d0d['originated']-=0x1;}else{logger[_0x2c09('0x65')](_0x2c09('0x152'));}}}else{logger[_0x2c09('0x65')](_0x2c09('0x153'));}};Dialer[_0x2c09('0x85')]['loggerHandler']=function(_0x243a66,_0x4aa21f){var _0x591e7d=this;return function(_0x3abfaa){_0x591e7d[_0x2c09('0xce')](_0x4aa21f);logger[_0x2c09('0x65')](_0x243a66,util[_0x2c09('0x44')](_0x3abfaa,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x53ecdd,_0x2cb837,_0x19db80){var _0x2edf34={'state':0x19,'statedesc':_0x2c09('0x154')};this[_0x2c09('0xce')](_0x2cb837);this[_0x2c09('0x119')](_[_0x2c09('0x60')](_0x2edf34,_['pick'](_0x19db80,[_0x2c09('0xdd'),_0x2c09('0xde'),_0x2c09('0x155'),_0x2c09('0xdf'),_0x2c09('0xf1')])),_0x2c09('0x156'),_0x2c09('0x157'));logger[_0x2c09('0x65')](_0x53ecdd);};Dialer['prototype'][_0x2c09('0x119')]=function(_0xe47d4e,_0x35dfd9,_0x567425){hopperUtils[_0x2c09('0xca')](_0xe47d4e)['catch'](loggerCatch(_0x35dfd9));hopperUtils[_0x2c09('0xcc')](_0xe47d4e)[_0x2c09('0xa4')](loggerCatch(_0x567425));};Dialer[_0x2c09('0x85')][_0x2c09('0xdb')]=function(_0x5f33a8,_0x4f0507){hopperUtils[_0x2c09('0xca')](_0x5f33a8)['catch'](loggerCatch(_0x2c09('0xcb')));if(_0x4f0507==0x0){hopperUtils[_0x2c09('0xcc')](_0x5f33a8)[_0x2c09('0xa4')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer['prototype']['checkPreviewRecallReminder']=function(_0x2d1bac){return Promise[_0x2c09('0xaf')]()[_0x2c09('0x9d')](cmHopper['handlePreviewRecallNotifications'](_0x2d1bac['id'],previewRecallmeReminderInterval))[_0x2c09('0x9d')](function(_0x40e478){for(var _0x10887f=0x0;_0x10887f<_0x40e478[_0x2c09('0x102')];_0x10887f++){var _0x16fef0=_0x40e478[_0x10887f][_0x2c09('0x158')][_0x2c09('0x47')];if(_0x16fef0)io['to'](util[_0x2c09('0x45')](_0x2c09('0x149'),_0x16fef0))['emit'](_0x2c09('0x14a'),{'hopper':_0x40e478[_0x10887f]});}})[_0x2c09('0xa4')](function(){});};Dialer['prototype'][_0x2c09('0xb2')]=function(_0x57af0b){var _0x494948=this;return function(){_0x494948['handleIvr'](_0x57af0b);};};Dialer['prototype'][_0x2c09('0x159')]=function(_0x572e2c,_0x463a95){var _0x4b57d3=this;var _0x10c421=uuid['v4']();this[_0x2c09('0x22')][_0x10c421]=new Action(_0x572e2c,_0x463a95,_0x10c421);return new Promise(function(_0x2967cf,_0x3359d9){if(_[_0x2c09('0x3f')](_0x572e2c)&&typeof _0x572e2c!==_0x2c09('0x15a')){return _0x3359d9(msgResponse('originate','Failure',_0x2c09('0x15b')));}if(_[_0x2c09('0x3f')](_0x463a95[_0x2c09('0x15c')])||_0x463a95[_0x2c09('0x15c')]===null){return _0x3359d9(msgResponse(_0x2c09('0x15d'),_0x2c09('0x93'),_0x2c09('0x15e')));}var _0x4ca9ad={'XMD-CALLERID':_0x4b57d3[_0x2c09('0x22')][_0x10c421][_0x2c09('0x15f')](),'XMD-AGI':_0x572e2c[_0x2c09('0x133')]?util['format'](_0x2c09('0x160'),ipAgi,_0x572e2c[_0x2c09('0x133')]):_0x2c09('0x161'),'XMD-AGIAFTER':_0x572e2c[_0x2c09('0xc9')]?util[_0x2c09('0x45')](_0x2c09('0x160'),ipAgi,_0x572e2c['dialQueueProject2']):_0x2c09('0x161'),'XMD-QUEUE':utils['isOutboundQueue'](_0x572e2c)?util[_0x2c09('0x45')](_0x2c09('0x162'),_0x572e2c[_0x2c09('0x47')],_0x572e2c[_0x2c09('0x163')]||'',_0x572e2c[_0x2c09('0x164')]?'c':'',_0x572e2c['dialQueueTimeout']||0x3):_0x2c09('0x161'),'XMD-CONTACTID':_0x463a95[_0x2c09('0xdd')],'XMD-CDRTYPE':_0x2c09('0x165'),'CALLERID(all)':_0x4b57d3['actions'][_0x10c421][_0x2c09('0x15f')](),'XMD-AMD':_0x572e2c['dialAMDActive']?_0x2c09('0x13f'):_0x2c09('0x161'),'XMD-DESTINATION':_0x2c09('0x113')};if(_0x572e2c[_0x2c09('0x11c')]){_0x4ca9ad[_0x2c09('0x166')]=_0x572e2c[_0x2c09('0x167')]||0x9c4;_0x4ca9ad['XMD-AMDGREETING']=_0x572e2c[_0x2c09('0x168')]||0x5dc;_0x4ca9ad['XMD-AMDAFTERGREETINGSILENCE']=_0x572e2c[_0x2c09('0x169')]||0x320;_0x4ca9ad[_0x2c09('0x16a')]=_0x572e2c[_0x2c09('0x16b')]||0x1388;_0x4ca9ad[_0x2c09('0x16c')]=_0x572e2c[_0x2c09('0x16d')]||0x64;_0x4ca9ad[_0x2c09('0x16e')]=_0x572e2c['dialAMDBetweenWordsSilence']||0x32;_0x4ca9ad[_0x2c09('0x16f')]=_0x572e2c['dialAMDMaximumNumberOfWords']||0x3;_0x4ca9ad[_0x2c09('0x170')]=_0x572e2c['dialAMDSilenceThreshold']||0x100;_0x4ca9ad[_0x2c09('0x171')]=_0x572e2c[_0x2c09('0x172')]||0x1388;}if(utils[_0x2c09('0x173')](_0x572e2c)){_0x4ca9ad[_0x2c09('0x174')]=_0x463a95[_0x2c09('0xdf')];}else{_0x4ca9ad['XMD-CAMPAIGNID']=_0x463a95['CampaignId'];}var _0x1273b0=utils['setXMDContactVariables'](_0x463a95[_0x2c09('0x175')]);Object[_0x2c09('0x144')](_0x4ca9ad,_0x1273b0);var _0x2e5652=_0x4b57d3['isTrunkReachable'](_0x572e2c[_0x2c09('0x8d')])?utils['getCallerId'](_0x572e2c[_0x2c09('0x8d')][_0x2c09('0x176')],_0x572e2c[_0x2c09('0x177')],_0x572e2c[_0x2c09('0x178')]>0x0?utils[_0x2c09('0x179')](_0x572e2c[_0x2c09('0x17a')],_0x572e2c[_0x2c09('0x178')]):_0x572e2c[_0x2c09('0x17a')]):utils[_0x2c09('0x17b')](_['isNil'](_0x572e2c[_0x2c09('0x17c')])?_0x572e2c['Trunk'][_0x2c09('0x176')]:_0x572e2c[_0x2c09('0x17c')][_0x2c09('0x176')],_0x572e2c[_0x2c09('0x177')],_0x572e2c[_0x2c09('0x178')]>0x0?utils['getCallerIdRandom'](_0x572e2c[_0x2c09('0x17a')],_0x572e2c[_0x2c09('0x178')]):_0x572e2c[_0x2c09('0x17a')]);if(_0x2e5652){_0x4ca9ad[_0x2c09('0x17d')]=_0x4b57d3['actions'][_0x10c421]['originatecalleridname']=utils[_0x2c09('0x17e')](_0x2e5652);_0x4ca9ad['XMD-ORIGINATECALLERIDNUM']=_0x463a95['phone'];}_0x572e2c[_0x2c09('0x17f')]=_0x4ca9ad;return ami['Action']({'actionid':_0x10c421,'action':_0x2c09('0x15d'),'channel':_0x4b57d3[_0x2c09('0x86')](_0x572e2c[_0x2c09('0x8d')])?util[_0x2c09('0x45')]('SIP/%s/%s%s',_0x572e2c[_0x2c09('0x8d')]['name'],isNotNull(_0x572e2c['dialPrefix'])?_0x572e2c['dialPrefix'][_0x2c09('0x180')]()||'':'',_0x572e2c[_0x2c09('0x181')]>0x0?_0x463a95[_0x2c09('0x15c')][_0x2c09('0x182')](_0x572e2c[_0x2c09('0x181')]):_0x463a95[_0x2c09('0x15c')]):util['format'](_0x2c09('0x183'),_[_0x2c09('0xf8')](_0x572e2c[_0x2c09('0x17c')])?_0x572e2c['Trunk'][_0x2c09('0x47')]:_0x572e2c['TrunkBackup']['name'],isNotNull(_0x572e2c[_0x2c09('0x184')])?_0x572e2c[_0x2c09('0x184')]['trim']()||'':'',_0x572e2c[_0x2c09('0x181')]>0x0?_0x463a95[_0x2c09('0x15c')]['substring'](_0x572e2c[_0x2c09('0x181')]):_0x463a95[_0x2c09('0x15c')]),'callerid':_0x2e5652,'Exten':_0x2c09('0x113'),'Context':'from-sip','Priority':'1','variable':_0x4ca9ad,'timeout':(_0x572e2c[_0x2c09('0x185')]||0x1e)*0x3e8,'async':!![],'channelid':_0x10c421})[_0x2c09('0x9d')](function(_0x151c26){return _0x2967cf(_0x151c26);})[_0x2c09('0xa4')](function(_0x1f5be6){_0x572e2c[_0x2c09('0x186')]+=0x1;var _0x40d608=new History(_0x4b57d3[_0x2c09('0x22')][_0x10c421]);logger['error'](util[_0x2c09('0x45')](_0x2c09('0x187'),JSON[_0x2c09('0x71')](_0x1f5be6)));_0x40d608[_0x2c09('0xe1')]=0xe;_0x40d608[_0x2c09('0xd3')]=_0x2c09('0x188');_0x40d608[_0x2c09('0xe2')]=moment()['format'](_0x2c09('0xc4'));_0x40d608[_0x2c09('0x6d')]=_0x40d608[_0x2c09('0xe2')];hopperUtils[_0x2c09('0xca')](_0x40d608)['catch'](loggerCatch(_0x2c09('0x189')));_0x4b57d3[_0x2c09('0xcc')](_0x40d608)[_0x2c09('0xa4')](loggerCatch(_0x2c09('0x189')))[_0x2c09('0x1b')](function(){delete _0x4b57d3['actions'][_0x10c421];return _0x3359d9(msgResponse('originate',_0x2c09('0x84'),_0x2c09('0x18a')));});});});};Dialer[_0x2c09('0x85')][_0x2c09('0x18b')]=function(_0x5d464e,_0x5ab359,_0x43facd){var _0x1bd07e=new History(_0x5ab359);if(_0x1bd07e[_0x2c09('0x121')]+_0x1bd07e['countcongestionretry']+_0x1bd07e[_0x2c09('0x123')]+_0x1bd07e[_0x2c09('0x124')]+_0x1bd07e[_0x2c09('0xd6')]+_0x1bd07e['countabandonedretry']+_0x1bd07e[_0x2c09('0x125')]+_0x1bd07e[_0x2c09('0x12d')]>=_0x43facd[_0x2c09('0x126')]-0x1){return!![];}switch(_0x5d464e){case 0x3:if(_0x1bd07e['countnoanswerretry']>=_0x43facd['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0x2c09('0xdc')]({'active':![],'countnoanswerretry':_0x1bd07e[_0x2c09('0x123')]+=0x1,'scheduledat':moment()[_0x2c09('0xef')](_0x43facd[_0x2c09('0x18c')],_0x2c09('0xf0'))[_0x2c09('0x45')](_0x2c09('0xc4')),'ContactId':_0x1bd07e[_0x2c09('0xdd')],'ListId':_0x1bd07e[_0x2c09('0xde')],'VoiceQueueId':_0x1bd07e[_0x2c09('0xdf')]||undefined,'CampaignId':_0x1bd07e[_0x2c09('0xf1')]||undefined})[_0x2c09('0xa4')](loggerCatch(_0x2c09('0x18d')));break;case 0x5:if(_0x1bd07e[_0x2c09('0x121')]>=_0x43facd['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0x2c09('0xdc')]({'active':![],'countbusyretry':_0x1bd07e[_0x2c09('0x121')]+=0x1,'scheduledat':moment()[_0x2c09('0xef')](_0x43facd[_0x2c09('0x18e')],_0x2c09('0xf0'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1bd07e[_0x2c09('0xdd')],'ListId':_0x1bd07e['ListId'],'VoiceQueueId':_0x1bd07e[_0x2c09('0xdf')]||undefined,'CampaignId':_0x1bd07e[_0x2c09('0xf1')]||undefined})[_0x2c09('0xa4')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x1bd07e[_0x2c09('0x122')]>=_0x43facd[_0x2c09('0x18f')]-0x1){return!![];}hopperUtils[_0x2c09('0xdc')]({'active':![],'countcongestionretry':_0x1bd07e[_0x2c09('0x122')]+=0x1,'scheduledat':moment()[_0x2c09('0xef')](_0x43facd[_0x2c09('0x190')],_0x2c09('0xf0'))[_0x2c09('0x45')](_0x2c09('0xc4')),'ContactId':_0x1bd07e['ContactId'],'ListId':_0x1bd07e[_0x2c09('0xde')],'VoiceQueueId':_0x1bd07e['VoiceQueueId']||undefined,'CampaignId':_0x1bd07e['CampaignId']||undefined})['catch'](loggerCatch(_0x2c09('0x191')));break;case 0x0:if(_0x1bd07e[_0x2c09('0x124')]>=_0x43facd['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0x2c09('0xdc')]({'active':![],'countnosuchnumberretry':_0x1bd07e[_0x2c09('0x124')]+=0x1,'scheduledat':moment()[_0x2c09('0xef')](_0x43facd[_0x2c09('0x192')],_0x2c09('0xf0'))[_0x2c09('0x45')](_0x2c09('0xc4')),'ContactId':_0x1bd07e[_0x2c09('0xdd')],'ListId':_0x1bd07e[_0x2c09('0xde')],'VoiceQueueId':_0x1bd07e['VoiceQueueId']||undefined,'CampaignId':_0x1bd07e[_0x2c09('0xf1')]||undefined})[_0x2c09('0xa4')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x1bd07e['countdropretry']>=_0x43facd[_0x2c09('0x193')]-0x1){return!![];}hopperUtils[_0x2c09('0xdc')]({'active':![],'countdropretry':_0x1bd07e[_0x2c09('0xd6')]+=0x1,'scheduledat':moment()[_0x2c09('0xef')](_0x43facd[_0x2c09('0xd7')],_0x2c09('0xf0'))[_0x2c09('0x45')](_0x2c09('0xc4')),'ContactId':_0x1bd07e[_0x2c09('0xdd')],'ListId':_0x1bd07e['ListId'],'VoiceQueueId':_0x1bd07e['VoiceQueueId']||undefined,'CampaignId':_0x1bd07e['CampaignId']||undefined})[_0x2c09('0xa4')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x1bd07e[_0x2c09('0xea')]>=_0x43facd[_0x2c09('0xee')]-0x1){return!![];}hopperUtils[_0x2c09('0xdc')]({'active':![],'countabandonedretry':_0x1bd07e['countabandonedretry']+=0x1,'scheduledat':moment()[_0x2c09('0xef')](_0x43facd[_0x2c09('0xec')],_0x2c09('0xf0'))[_0x2c09('0x45')](_0x2c09('0xc4')),'ContactId':_0x1bd07e['ContactId'],'ListId':_0x1bd07e[_0x2c09('0xde')],'VoiceQueueId':_0x1bd07e['VoiceQueueId']||undefined,'CampaignId':_0x1bd07e[_0x2c09('0xf1')]||undefined})[_0x2c09('0xa4')](loggerCatch(_0x2c09('0x194')));break;case 0x13:if(_0x1bd07e[_0x2c09('0x125')]>=_0x43facd['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x2c09('0xdc')]({'active':![],'countmachineretry':_0x1bd07e[_0x2c09('0x125')]+=0x1,'scheduledat':moment()[_0x2c09('0xef')](_0x43facd[_0x2c09('0x12b')],'minutes')[_0x2c09('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1bd07e[_0x2c09('0xdd')],'ListId':_0x1bd07e[_0x2c09('0xde')],'VoiceQueueId':_0x1bd07e['VoiceQueueId']||undefined,'CampaignId':_0x1bd07e['CampaignId']||undefined})['catch'](loggerCatch(_0x2c09('0x12f')));break;case 0x14:if(_0x1bd07e[_0x2c09('0x12d')]>=_0x43facd[_0x2c09('0x195')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x1bd07e['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0x43facd[_0x2c09('0x196')],_0x2c09('0xf0'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1bd07e[_0x2c09('0xdd')],'ListId':_0x1bd07e[_0x2c09('0xde')],'VoiceQueueId':_0x1bd07e[_0x2c09('0xdf')]||undefined,'CampaignId':_0x1bd07e['CampaignId']||undefined})['catch'](loggerCatch(_0x2c09('0x197')));break;default:return!![];}};Dialer['prototype'][_0x2c09('0x10f')]=function(_0x52da9d,_0x3e63f5,_0x26bfc3){var _0x1011cc=this;var _0x381611=new History(_0x52da9d);var _0x3f3fd1=![];var _0xddd60a;var _0x56a215;return new Promise(function(_0x2e2ca6,_0x44f340){if(_[_0x2c09('0x3f')](_0x3e63f5)&&typeof _0x3e63f5!==_0x2c09('0x15a')){return _0x44f340(msgResponse(_0x2c09('0x198'),_0x2c09('0x93'),_0x2c09('0x199')));}if(_[_0x2c09('0x3f')](_0x26bfc3)&&typeof _0x26bfc3!=='object'){return _0x44f340(msgResponse(_0x2c09('0x198'),'Failure',_0x2c09('0x19a')));}hopperUtils[_0x2c09('0xd8')](_0x381611,_0x26bfc3['reason'],_0x3e63f5)[_0x2c09('0x9d')](function(_0x267ac2){if(_0x267ac2['additional']==0x1)_0x3f3fd1=!![];switch(_0x26bfc3[_0x2c09('0xc6')]){case'0':_0x3e63f5[_0x2c09('0x19b')]+=0x1;_0x381611['state']=0x0;_0x381611[_0x2c09('0xd3')]='NoSuchNumber';_0x381611[_0x2c09('0x124')]+=0x1;_0x381611['countglobal']+=0x1;ami[_0x2c09('0x40')]('custom:agentnosuchnumber',ut[_0x2c09('0x118')](_0x52da9d,_0x2c09('0x19c')));_0xddd60a=_0x3e63f5[_0x2c09('0x192')];_0x56a215=_0x3e63f5[_0x2c09('0xed')];hopperUtils[_0x2c09('0xca')](_0x381611)['catch'](loggerCatch(_0x2c09('0x19d')));if(_0x1011cc[_0x2c09('0x18b')](0x0,_0x52da9d,_0x3e63f5)&&!_0x3f3fd1){if(_0x381611[_0x2c09('0x124')]>=_0x3e63f5['dialNoSuchNumberMaxRetry']){_0x1011cc[_0x2c09('0x12a')](_0x381611,_0x2e2ca6,_0x44f340,'reason\x200\x20no\x20such\x20number....');}else{_0x1011cc[_0x2c09('0x127')](_0x381611,_0x2e2ca6,_0x44f340,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x3e63f5[_0x2c09('0x19e')]+=0x1;_0x381611[_0x2c09('0xe1')]=0x3;_0x381611[_0x2c09('0xd3')]='NoAnswer';_0x381611['countnoanswerretry']+=0x1;_0x381611[_0x2c09('0xeb')]+=0x1;var _0x531611=ut[_0x2c09('0x19f')](_0x52da9d,_0x3e63f5);ami[_0x2c09('0x40')]('custom:agentnoanswer',_0x531611);_0xddd60a=_0x3e63f5[_0x2c09('0x18c')];_0x56a215=_0x3e63f5[_0x2c09('0xed')];hopperUtils[_0x2c09('0xca')](_0x381611)['catch'](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x1011cc['checkRetriveMax'](0x3,_0x52da9d,_0x3e63f5)&&!_0x3f3fd1){if(_0x381611['countnoanswerretry']>=_0x3e63f5[_0x2c09('0x1a0')]){_0x1011cc['createStateFinal'](_0x381611,_0x2e2ca6,_0x44f340,_0x2c09('0x1a1'));}else{_0x1011cc[_0x2c09('0x127')](_0x381611,_0x2e2ca6,_0x44f340,_0x2c09('0x1a1'));}}break;case'5':_0x3e63f5['outboundBusyCallsDay']+=0x1;_0x381611[_0x2c09('0xe1')]=0x5;_0x381611['statedesc']=_0x2c09('0x1a2');_0x381611['countbusyretry']+=0x1;_0x381611[_0x2c09('0xeb')]+=0x1;ami[_0x2c09('0x40')](_0x2c09('0x1a3'),ut[_0x2c09('0x118')](_0x52da9d,_0x2c09('0x1a4')));_0xddd60a=_0x3e63f5[_0x2c09('0x18e')];_0x56a215=_0x3e63f5['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x381611)[_0x2c09('0xa4')](loggerCatch(_0x2c09('0x1a5')));if(_0x1011cc['checkRetriveMax'](0x5,_0x52da9d,_0x3e63f5)&&!_0x3f3fd1){if(_0x381611[_0x2c09('0x121')]>=_0x3e63f5['dialBusyMaxRetry']){_0x1011cc[_0x2c09('0x12a')](_0x381611,_0x2e2ca6,_0x44f340,_0x2c09('0x1a6'));}else{_0x1011cc['stateGlobal'](_0x381611,_0x2e2ca6,_0x44f340,_0x2c09('0x1a6'));}}break;case'8':_0x3e63f5['outboundCongestionCallsDay']+=0x1;_0x381611[_0x2c09('0xe1')]=0x8;_0x381611[_0x2c09('0xd3')]=_0x2c09('0x1a7');_0x381611[_0x2c09('0x122')]+=0x1;_0x381611[_0x2c09('0xeb')]+=0x1;_0xddd60a=_0x3e63f5[_0x2c09('0x190')];_0x56a215=_0x3e63f5['callAdditionalPhoneAfterMin'];ami[_0x2c09('0x40')]('custom:agentcongestion',ut['buildObj'](_0x52da9d,'congestion'));hopperUtils[_0x2c09('0xca')](_0x381611)[_0x2c09('0xa4')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x1011cc['checkRetriveMax'](0x8,_0x52da9d,_0x3e63f5)&&!_0x3f3fd1){if(_0x381611[_0x2c09('0x122')]>=_0x3e63f5[_0x2c09('0x18f')]){_0x1011cc[_0x2c09('0x12a')](_0x381611,_0x2e2ca6,_0x44f340,'reason\x208\x20congestion');}else{_0x1011cc[_0x2c09('0x127')](_0x381611,_0x2e2ca6,_0x44f340,_0x2c09('0x1a8'));}}break;case'11':_0x3e63f5[_0x2c09('0x1a9')]+=0x1;_0x381611[_0x2c09('0xe1')]=0xb;_0x381611['statedesc']=_0x2c09('0xe8');_0x381611[_0x2c09('0xea')]+=0x1;_0x381611['countglobal']+=0x1;_0xddd60a=_0x3e63f5[_0x2c09('0xec')];_0x56a215=_0x3e63f5[_0x2c09('0xed')];hopperUtils[_0x2c09('0xca')](_0x381611)[_0x2c09('0xa4')](loggerCatch(_0x2c09('0xf2')));if(_0x1011cc['checkRetriveMax'](0xb,_0x52da9d,_0x3e63f5)&&!_0x3f3fd1){if(_0x381611[_0x2c09('0xea')]>=_0x3e63f5['dialAbandonedMaxRetry']){_0x1011cc['createStateFinal'](_0x381611,_0x2e2ca6,_0x44f340,'reason\x2011\x20abandoned');}else{_0x1011cc[_0x2c09('0x127')](_0x381611,_0x2e2ca6,_0x44f340,_0x2c09('0x1aa'));}}break;case'20':_0x3e63f5['outboundRejectCallsDay']+=0x1;_0x381611['state']=0x14;_0x381611['statedesc']=_0x2c09('0x1ab');_0x381611['countagentrejectretry']+=0x1;_0x381611['countglobal']+=0x1;_0xddd60a=_0x3e63f5['dialAgentRejectRetryFrequency'];_0x56a215=_0x3e63f5[_0x2c09('0xed')];ami[_0x2c09('0x40')](_0x2c09('0x1ac'),ut[_0x2c09('0x118')](_0x52da9d,_0x2c09('0x1ad')));hopperUtils[_0x2c09('0xca')](_0x381611)[_0x2c09('0xa4')](loggerCatch(_0x2c09('0x1ae')));if(_0x1011cc[_0x2c09('0x18b')](0x14,_0x52da9d,_0x3e63f5)&&!_0x3f3fd1){if(_0x381611[_0x2c09('0x12d')]>=_0x3e63f5[_0x2c09('0x195')]){_0x1011cc[_0x2c09('0x12a')](_0x381611,_0x2e2ca6,_0x44f340,_0x2c09('0x1af'));}else{_0x1011cc[_0x2c09('0x127')](_0x381611,_0x2e2ca6,_0x44f340,_0x2c09('0x1af'));}}break;default:_0x3e63f5[_0x2c09('0x137')]+=0x1;_0x381611[_0x2c09('0xe1')]=0xc;_0x381611[_0x2c09('0xd3')]=_0x26bfc3['reason'];_0xddd60a=_0x3e63f5[_0x2c09('0x196')];_0x56a215=_0x3e63f5['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x381611)[_0x2c09('0xa4')](loggerCatch(_0x2c09('0x1b0')));if(_0x1011cc[_0x2c09('0x18b')](_0x26bfc3['reason'],_0x52da9d,_0x3e63f5)&&!_0x3f3fd1){if(_0x381611[_0x2c09('0x121')]+_0x381611[_0x2c09('0x122')]+_0x381611[_0x2c09('0x123')]+_0x381611[_0x2c09('0x124')]+_0x381611[_0x2c09('0xd6')]+_0x381611[_0x2c09('0xea')]+_0x381611[_0x2c09('0x125')]+_0x381611[_0x2c09('0x12d')]>=_0x3e63f5[_0x2c09('0x126')]){_0x1011cc[_0x2c09('0x127')](_0x381611,_0x2e2ca6,_0x44f340,_0x26bfc3['reason']);}else{_0x1011cc[_0x2c09('0x12a')](_0x381611,_0x2e2ca6,_0x44f340,_0x26bfc3[_0x2c09('0xc6')]);}}}})[_0x2c09('0x9d')](function(){if(_0x3f3fd1){hopperUtils[_0x2c09('0xe6')](_0x381611,_0xddd60a,_0x56a215)[_0x2c09('0x9d')](function(){return _0x2e2ca6(0x1);});}});});};Dialer[_0x2c09('0x85')]['stateGlobal']=function(_0x47a46b,_0x280161,_0x5a74f8,_0xa45ae5){var _0x38e27b=new Final(_0x47a46b);_0x38e27b['state']=0xf;_0x38e27b['statedesc']=_0x2c09('0x1b1');this['createStateFinal'](_0x38e27b,_0x280161,_0x5a74f8,_0xa45ae5);};Dialer[_0x2c09('0x85')][_0x2c09('0x12a')]=function(_0x574bf4,_0x313abe,_0x4b8e94,_0x2441c9){hopperUtils[_0x2c09('0xcc')](_0x574bf4)['then'](function(){return _0x313abe(msgResponse('[callProgressDetecting]','Success',_0x2441c9));})[_0x2c09('0xa4')](function(){return _0x4b8e94(msgResponse(_0x2c09('0x1b2'),_0x2c09('0x93'),_0x2c09('0x1b3')));});};Dialer[_0x2c09('0x85')]['predictive']=function(_0x4d274c){var _0x3a1999=_0x4d274c[_0x2c09('0x1b4')]/0x64;var _0x2f13f0=_0x4d274c['outboundDropCallsDayTimeout']/(_0x4d274c[_0x2c09('0x1b5')]+_0x4d274c[_0x2c09('0xc5')]);var _0x4d56db=Math[_0x2c09('0x1b6')](_0x4d274c['predictiveIntervalAvailable']*(_0x4d274c[_0x2c09('0x1b7')]/0x64));var _0x2a7df4=Math[_0x2c09('0x1b6')](_0x4d274c['predictiveIntervalAvailable']*(_0x4d274c['predictiveIntervalMinThreshold']/0x64));var _0x4dbb18=_0x4d274c[_0x2c09('0x13b')]+_0x4d274c[_0x2c09('0x13d')];var _0x46a9f4=Math[_0x2c09('0x1b8')](_0x4d274c[_0x2c09('0x5a')]*_0x4d274c[_0x2c09('0x5e')]*_0x4d274c[_0x2c09('0x1b9')]*_0x4d274c[_0x2c09('0x1ba')]);if(_['isUndefined'](_0x4d274c[_0x2c09('0x26')])){if(!_['isUndefined'](_0x4d274c['startPredictive'])){_0x4d274c[_0x2c09('0x25')]=undefined;loggerPredictive[_0x2c09('0x65')](_0x2c09('0x1bb'),_0x2c09('0x1bc'));}if(!_[_0x2c09('0x3f')](_0x4d274c[_0x2c09('0x63')])){loggerPredictive[_0x2c09('0x65')](_0x2c09('0x1bb'),_0x2c09('0x1bd'));clearInterval(_0x4d274c[_0x2c09('0x63')]);_0x4d274c[_0x2c09('0x63')]=undefined;}_0x4d274c['startProgressive']=moment()[_0x2c09('0x45')](_0x2c09('0xc4'));loggerPredictive[_0x2c09('0x49')](_0x4d274c[_0x2c09('0x47')],_0x2c09('0x1be'),_0x4d274c[_0x2c09('0x26')]);this[_0x2c09('0xb7')](_0x4d274c,0x1);}else if(ifInterval(_0x4d274c[_0x2c09('0x1bf')],_0x4d274c['startProgressive'])){this['handlePower'](_0x4d274c,0x1);loggerPredictiveCalls[_0x2c09('0x49')](_0x2c09('0x1c0'),_0x4d274c[_0x2c09('0x26')],_0x4d274c[_0x2c09('0x47')]);_0x4d274c[_0x2c09('0x5a')]=0x0;_0x4d274c['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x3a1999<_0x2f13f0&&_0x4d274c['dialPredictiveOptimization']==='dropRate'){clearPredictiveAttributes(_0x4d274c);loggerPredictive['info'](_0x2c09('0x1c1'),_0x2c09('0x1c2'),_0x2f13f0,_0x2c09('0x26'),_0x4d274c['name']);}else if(_0x46a9f4<_0x4d274c[_0x2c09('0xd2')]&&_0x4d274c['dialPredictiveOptimization']===_0x2c09('0x1c3')){clearPredictiveAttributes(_0x4d274c);loggerPredictive[_0x2c09('0x49')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x2c09('0x1c4'),_0x46a9f4,'Drop\x20in\x20this\x20interval',_0x4d274c[_0x2c09('0xd2')],_0x2c09('0x26'),_0x4d274c[_0x2c09('0x47')]);}else if(!ifInterval(_0x4d274c[_0x2c09('0x1bf')],_0x4d274c[_0x2c09('0x26')])&&_['isUndefined'](_0x4d274c[_0x2c09('0x25')])&&!_[_0x2c09('0x3f')](_0x4d274c[_0x2c09('0x26')])){_0x4d274c[_0x2c09('0x25')]=moment()['format'](_0x2c09('0xc4'));loggerPredictive[_0x2c09('0x49')](_0x4d274c[_0x2c09('0x47')],'started\x20in\x20predictive\x20at',_0x4d274c[_0x2c09('0x25')]);hopperUtils[_0x2c09('0x1c5')](_0x4d274c[_0x2c09('0x1bf')])[_0x2c09('0x9d')](this['getDataPredictive'](_0x4d274c))['then'](mergeDataErlangB(_0x4d274c))[_0x2c09('0x9d')](this[_0x2c09('0x1c6')](_0x4d274c))[_0x2c09('0xa4')](loggerCatchPredictive(_0x2c09('0x1c7'),_0x4d274c));}else if(!ifInterval(_0x4d274c[_0x2c09('0x1bf')],_0x4d274c['startPredictive'])){_0x4d274c['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x4d274c[_0x2c09('0x25')]=moment()['format'](_0x2c09('0xc4'));loggerPredictive[_0x2c09('0x49')](_0x4d274c[_0x2c09('0x47')],_0x2c09('0x1c8'),_0x4d274c[_0x2c09('0x25')]);clearInterval(_0x4d274c[_0x2c09('0x63')]);_0x4d274c['handlePredictive']=undefined;hopperUtils[_0x2c09('0x1c5')](_0x4d274c[_0x2c09('0x1bf')])[_0x2c09('0x9d')](this[_0x2c09('0x1c9')](_0x4d274c))[_0x2c09('0x9d')](mergeDataErlangB(_0x4d274c))[_0x2c09('0x9d')](this[_0x2c09('0x1c6')](_0x4d274c))['catch'](loggerCatchPredictive(_0x2c09('0x1ca'),_0x4d274c));}else if(_0x4d274c[_0x2c09('0x1cb')]&&_0x4dbb18<_0x4d274c['predictiveIntervalAvailable']-_0x2a7df4){clearPredictiveAttributes(_0x4d274c);loggerPredictive[_0x2c09('0x49')](_0x4d274c[_0x2c09('0x47')],_0x2c09('0x1cc'),_0x4dbb18,_0x2c09('0x1cd'),_0x4d274c[_0x2c09('0x1cb')],'-',_0x2a7df4,'=',_0x4d274c[_0x2c09('0x1cb')]-_0x2a7df4,')');}else if(_0x4d274c[_0x2c09('0x1cb')]&&_0x4dbb18>_0x4d274c[_0x2c09('0x1cb')]+_0x4d56db){clearPredictiveAttributes(_0x4d274c);loggerPredictive[_0x2c09('0x49')](_0x4d274c[_0x2c09('0x47')],_0x2c09('0x1cc'),_0x4dbb18,_0x2c09('0x1ce'),_0x4d274c['predictiveIntervalAvailable'],'+',_0x4d56db,'=',_0x4d274c[_0x2c09('0x1cb')]+_0x4d56db,')');}};Dialer[_0x2c09('0x85')][_0x2c09('0x1c9')]=function(_0xa65610){var _0x1d7048=this;return function(_0x7c19aa){return new Promise(function(_0x1be0a0,_0x3b4ed3){_['merge'](_0xa65610,_0x7c19aa[0x0]);if(checkGetDataPredictive(_0x7c19aa[0x0])){var _0x4b244f=_0xa65610['predictiveIntervalAvailable']=_0xa65610['talking']+_0xa65610[_0x2c09('0x13b')];var _0x34c56e=_0xa65610[_0x2c09('0x1bf')]*0x3c;var _0x50d028=_0x7c19aa[0x0][_0x2c09('0x55')]+_0x7c19aa[0x0][_0x2c09('0x54')];var _0x523654=(_0x7c19aa[0x0][_0x2c09('0x4e')]+_0x7c19aa[0x0][_0x2c09('0x50')]+_0x7c19aa[0x0][_0x2c09('0x52')])/_0x7c19aa[0x0][_0x2c09('0x4c')];_0xa65610[_0x2c09('0x1b9')]=_0x523654>0x0?_0x523654:0x1;switch(_0xa65610['dialPredictiveOptimization']){case _0x2c09('0x1c3'):var _0x5f3762=_0xa65610['dialPredictiveOptimizationPercentage']/0x64;return _0x1d7048[_0x2c09('0x1cf')](_0x4b244f,_0x34c56e,_0x50d028,_0x523654,_0x5f3762)[_0x2c09('0x9d')](function(_0x5aa5c7){return _0x1be0a0(_0x5aa5c7);});case _0x2c09('0x1d0'):var _0xe73718=_0xa65610[_0x2c09('0x1b4')]/0x64;return _0x1d7048['busyFactor'](_0x4b244f,_0x34c56e,_0x50d028,_0x523654,_0xe73718)[_0x2c09('0x9d')](function(_0x1c99f3){return _0x1be0a0(_0x1c99f3);});default:return _0x3b4ed3(msgResponse('[getDataPredictive]',_0x2c09('0x93'),_0x2c09('0x1d1')));}}else{return _0x3b4ed3(msgResponse(_0x2c09('0x1d2'),'Failure',_0x2c09('0x1d3')));}});};};Dialer[_0x2c09('0x85')][_0x2c09('0x1d4')]=function(_0x3641b4){var _0x3c414c=this;return function(_0x273874){return new Promise(function(_0x5af621,_0x1518c0){_[_0x2c09('0x60')](_0x3641b4,_0x273874[0x0]);if(checkGetDataPredictive(_0x273874[0x0])){loggerPredictive[_0x2c09('0x49')](JSON[_0x2c09('0x71')](_0x273874[0x0]));if(_0x3641b4[_0x2c09('0x1d5')]===_0x2c09('0x1c3')){return _0x3c414c[_0x2c09('0x150')](_0x3641b4['id'])[_0x2c09('0x9d')](function(_0x2b1429){var _0x3388e9=_0x3641b4[_0x2c09('0x1d6')]-_0x2b1429[0x0]['outboundQueuePauses'];var _0x548ec5=_0x3641b4[_0x2c09('0x1bf')]*0x3c;var _0x25f944=_0x273874[0x0][_0x2c09('0x55')]+_0x273874[0x0]['predictiveIntervalAvgHoldtime'];var _0x46e02b=(_0x273874[0x0]['predictiveIntervalAnsweredCalls']+_0x273874[0x0][_0x2c09('0x50')]+_0x273874[0x0][_0x2c09('0x52')])/_0x273874[0x0][_0x2c09('0x4c')];var _0x5bd551=_0x3641b4['dialPredictiveOptimizationPercentage']/0x64;_0x3641b4[_0x2c09('0x1d7')]=_0x2b1429[0x0][_0x2c09('0x1d8')]||0x0;_0x3641b4[_0x2c09('0x1b9')]=_0x46e02b>0x0?_0x46e02b:0x1;return _0x3c414c[_0x2c09('0x1cf')](_0x3388e9,_0x548ec5,_0x25f944,_0x46e02b,_0x5bd551);})['then'](function(_0x1ac974){return _0x5af621(_0x1ac974);})['catch'](function(_0x3211c7){return _0x1518c0(msgResponse(_0x2c09('0x1d9'),_0x2c09('0x93'),JSON['stringify'](_0x3211c7)));});}if(_0x3641b4['dialPredictiveOptimization']===_0x2c09('0x1d0')){return _0x3c414c[_0x2c09('0x150')](_0x3641b4['id'])[_0x2c09('0x9d')](function(_0x318e7d){var _0x36a043=_0x3641b4[_0x2c09('0x1d6')]-_0x318e7d[0x0][_0x2c09('0x1d8')];var _0x31da9d=_0x3641b4[_0x2c09('0x1bf')]*0x3c;var _0x23a19b=_0x273874[0x0][_0x2c09('0x55')]+_0x273874[0x0][_0x2c09('0x54')];var _0x44366b=(_0x273874[0x0][_0x2c09('0x4e')]+_0x273874[0x0][_0x2c09('0x50')]+_0x273874[0x0][_0x2c09('0x52')])/_0x273874[0x0][_0x2c09('0x4c')];var _0x15d6e8=_0x3641b4[_0x2c09('0x1b4')]/0x64;_0x3641b4[_0x2c09('0x1d7')]=_0x318e7d[0x0][_0x2c09('0x1d8')]||0x0;_0x3641b4[_0x2c09('0x1b9')]=_0x44366b>0x0?_0x44366b:0x1;return _0x3c414c[_0x2c09('0x1da')](_0x36a043,_0x31da9d,_0x23a19b,_0x44366b,_0x15d6e8);})[_0x2c09('0x9d')](function(_0x532716){return _0x5af621(_0x532716);})[_0x2c09('0xa4')](function(_0x1d4ba4){return _0x1518c0(msgResponse(_0x2c09('0x1d9'),_0x2c09('0x93'),JSON[_0x2c09('0x71')](_0x1d4ba4)));});}}else{return _0x1518c0(msgResponse('[getDataPredictive]',_0x2c09('0x93'),_0x2c09('0x1d3')));}});};};Dialer[_0x2c09('0x85')][_0x2c09('0x1c6')]=function(_0xec78dc){var _0x2cfbe2=this;return function(){var _0x5a1d5e=0x0;var _0x85c150=Math[_0x2c09('0x1b8')](_0xec78dc[_0x2c09('0x5c')]*0x3e8);if(_0x85c150>0x0){_0x85c150=_0x85c150<0x64?0x64:_0x85c150;loggerPredictive[_0x2c09('0x49')](_0xec78dc['name'],_0x2c09('0x1db'),_0x85c150,_0x2c09('0x1dc'));_0xec78dc['handlePredictive']=setInterval(function(){_0x2cfbe2[_0x2c09('0x63')](_0xec78dc);loggerPredictiveCalls[_0x2c09('0x49')](_0x2c09('0x1dd'),_0x5a1d5e+=0x1);},_0x85c150);}else{loggerPredictive[_0x2c09('0x49')](_0xec78dc[_0x2c09('0x47')],_0x2c09('0x1de'));}};};Dialer['prototype']['checkContactBlack']=function(_0x4a9aef,_0x2122ce){var _0x4894a7=this;return function(_0x498402){if(_[_0x2c09('0x76')](_0x498402)){if(_[_0x2c09('0xf8')](_0x2122ce['UserId'])||!_0x2122ce[_0x2c09('0x1df')]){if(_0x4a9aef[_0x2c09('0xb5')]===_0x2c09('0x7')){_0x4a9aef[_0x2c09('0x6f')]=_['isUndefined'](_0x4a9aef[_0x2c09('0x6f')])?!![]:_0x4a9aef['queueStatusComplete'];var _0x93be1e=uuid['v4']();_0x4894a7['actions'][_0x93be1e]=new Action(_0x4a9aef,_0x2122ce,_0x93be1e);loggerBooked[_0x2c09('0x49')](_0x2c09('0x1e0'),_0x93be1e,_0x2c09('0x1e1'),JSON[_0x2c09('0x71')](_0x4a9aef[_0x2c09('0x6f')]),_0x2c09('0x1e2'),_0x4a9aef[_0x2c09('0x47')]);if(_0x4a9aef['queueStatusComplete']){_0x4a9aef['queueStatusComplete']=![];_0x4894a7['queueBooked'][_0x4894a7['actions'][_0x93be1e][_0x2c09('0xc2')]]=[];ami[_0x2c09('0x9b')]({'actionid':_0x93be1e,'action':_0x2c09('0x1e3'),'queue':_0x4a9aef[_0x2c09('0x47')]})['catch'](function(){_0x4894a7[_0x2c09('0xce')](_0x4a9aef);hopperUtils[_0x2c09('0xdc')]({'active':![],'ContactId':_0x4894a7['actions'][_0x93be1e]['ContactId'],'ListId':_0x4894a7[_0x2c09('0x22')][_0x93be1e][_0x2c09('0xde')],'VoiceQueueId':_0x4894a7['actions'][_0x93be1e]['VoiceQueueId']||undefined,'CampaignId':_0x4894a7[_0x2c09('0x22')][_0x93be1e]['CampaignId']||undefined})[_0x2c09('0xa4')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x4894a7[_0x2c09('0x22')][_0x93be1e];});}else{loggerBooked[_0x2c09('0x49')](_0x2c09('0x1e4'),JSON['stringify'](_0x4a9aef['queueStatusComplete']),_0x2c09('0x1e2'),_0x4a9aef[_0x2c09('0x47')]);_0x4894a7['updateOriginated'](_0x4a9aef);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x4894a7[_0x2c09('0x22')][_0x93be1e][_0x2c09('0xdd')],'ListId':_0x4894a7[_0x2c09('0x22')][_0x93be1e][_0x2c09('0xde')],'VoiceQueueId':_0x4894a7['actions'][_0x93be1e]['VoiceQueueId']||undefined,'CampaignId':_0x4894a7[_0x2c09('0x22')][_0x93be1e]['CampaignId']||undefined})['catch'](loggerCatch(_0x2c09('0x1e5')));delete _0x4894a7['actions'][_0x93be1e];}}else{return _0x4894a7[_0x2c09('0x159')](_0x4a9aef,_0x2122ce);}}else{if(utils[_0x2c09('0x61')](undefined,_0x2122ce[_0x2c09('0x1e6')])<_0x4a9aef['dialRecallMeTimeout']*0x3c){if(_0x2122ce[_0x2c09('0x158')]&&!_0x2122ce[_0x2c09('0x158')][_0x2c09('0x1e7')]){_0x4894a7['preview']['run'](_0x2122ce['id'])[_0x2c09('0x1b')](function(){_0x4894a7[_0x2c09('0xce')](_0x4a9aef);});}else{hopperUtils['unlockContact']({'active':![]},_0x2122ce['id'],0x1)[_0x2c09('0x1b')](function(){_0x4894a7[_0x2c09('0xce')](_0x4a9aef);});}}else{_0x4a9aef[_0x2c09('0x1e8')]+=0x1;_0x4894a7[_0x2c09('0xce')](_0x4a9aef);if(_0x4a9aef[_0x2c09('0x1e9')]){hopperUtils[_0x2c09('0xdc')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2122ce['ContactId'],'ListId':_0x2122ce[_0x2c09('0xde')],'VoiceQueueId':_0x2122ce[_0x2c09('0xdf')]||undefined,'CampaignId':_0x2122ce[_0x2c09('0xf1')]||undefined})[_0x2c09('0xa4')](loggerCatch(_0x2c09('0x1ea')));hopperUtils[_0x2c09('0xca')](createObjHistory(_0x4a9aef,_0x2122ce,utils[_0x2c09('0x6a')][_0x2c09('0x1eb')],0x17,_0x2c09('0x1ec')))[_0x2c09('0xa4')](loggerCatch(_0x2c09('0x1ed')));}else{_0x4894a7[_0x2c09('0x119')](createObjHistory(_0x4a9aef,_0x2122ce,utils[_0x2c09('0x6a')][_0x2c09('0x1ee')],0x16,_0x2c09('0x1ef')),_0x2c09('0x1f0'),_0x2c09('0x1f1'));}}}}else{_0x4a9aef[_0x2c09('0x1f2')]+=0x1;_0x4894a7[_0x2c09('0x119')](createObjHistory(_0x4a9aef,_0x2122ce,utils[_0x2c09('0x6a')][_0x2c09('0x1f3')],0xd,_0x2c09('0x1f4')),_0x2c09('0x1f5'),_0x2c09('0x1f6'));throw _0x2c09('0x1f7');}};};Dialer[_0x2c09('0x85')][_0x2c09('0x1f8')]=function(_0x276305){var _0xb9f79=this;var _0xbf5ba4=_0x276305[_0x2c09('0x1f9')]-_0x276305[_0x2c09('0x7d')];emitCampaignSummary(_0x276305);if(_0xbf5ba4>0x0&&_0x276305['temp']==0x0){if(_0xbf5ba4>this['maxNumberOriginate']){_0xbf5ba4=this['maxNumberOriginate'];}_0x276305[_0x2c09('0x1fa')]=0x1;hopperUtils['getContactDialerIvr'](_0x276305,_0xbf5ba4)[_0x2c09('0x9d')](function(_0x4cc6c3){_0x276305['temp']=0x0;if(_0x4cc6c3){if(!utils['checkContactEmpty'](_0x4cc6c3)){_0x276305[_0x2c09('0x69')]=utils[_0x2c09('0x6a')][_0x2c09('0x6c')];logger[_0x2c09('0x49')](_0x2c09('0x1fb')+_0x276305['name']);}else{_0x276305['originated']+=_0x4cc6c3[_0x2c09('0x102')];_0x276305[_0x2c09('0x69')]=utils[_0x2c09('0x6a')][_0x2c09('0x1fc')];for(var _0x4ac80e=0x0;_0x4ac80e<_0x4cc6c3[_0x2c09('0x102')];_0x4ac80e+=0x1){_0x276305[_0x2c09('0x1fd')]+=0x1;if(_[_0x2c09('0xf8')](_0x4cc6c3[_0x4ac80e])||_[_0x2c09('0xf8')](_0x4cc6c3[_0x4ac80e][_0x2c09('0x175')])||_[_0x2c09('0xf8')](_0x4cc6c3[_0x4ac80e]['phone'])){_0xb9f79[_0x2c09('0x1fe')](_0x2c09('0x1ff'),_0x276305,_0x4cc6c3[_0x4ac80e]);}else{hopperUtils[_0x2c09('0x200')](_[_0x2c09('0x105')](_0x4cc6c3[_0x4ac80e],[_0x2c09('0xf1'),_0x2c09('0x15c')]))[_0x2c09('0x9d')](_0xb9f79['checkContactBlack'](_0x276305,_0x4cc6c3[_0x4ac80e]))['catch'](_0xb9f79[_0x2c09('0x201')](_0x2c09('0x202'),_0x276305));}}}}})[_0x2c09('0xa4')](loggerGetContactDialer(_0x2c09('0x203'),_0x276305,_0xbf5ba4));}};Dialer[_0x2c09('0x85')][_0x2c09('0xb7')]=function(_0x166a24,_0x421bda){var _0x3977f8=this;var _0x7b7c31=[];if(_0x421bda<0x1||_0x166a24[_0x2c09('0xb5')]==='booked'){_0x421bda=0x1;}var _0x7d5a41=Math[_0x2c09('0x1b8')](_0x166a24[_0x2c09('0x13b')]*_0x421bda)-_0x166a24[_0x2c09('0x7d')];if(_0x166a24['dialLimitQueue']>0x0){var _0x18abc9=_0x166a24['dialLimitQueue']-_0x166a24[_0x2c09('0x7d')]-_0x166a24[_0x2c09('0x13d')]-_0x166a24['pTalking'];if(_0x7d5a41>_0x18abc9){_0x7d5a41=_0x18abc9;}}if(_0x7d5a41>0x0&&_0x166a24[_0x2c09('0x1fa')]==0x0){if(_0x166a24[_0x2c09('0xb5')]===_0x2c09('0x7')){_0x7d5a41=0x1;}if(_0x7d5a41>this[_0x2c09('0x204')]){_0x7d5a41=this[_0x2c09('0x204')];}for(var _0xa65de1 in this['agents']){if(typeof this[_0x2c09('0x20')][_0xa65de1]!==_0x2c09('0xae')){if(this[_0x2c09('0x20')][_0xa65de1][_0x2c09('0xe1')]===_0x2c09('0x205')&&this[_0x2c09('0x20')][_0xa65de1][_0x2c09('0x8a')]===_0x2c09('0x8b')){_0x7b7c31[_0x2c09('0xa1')](this[_0x2c09('0x20')][_0xa65de1]['id']);}}}_0x166a24['temp']=0x1;hopperUtils[_0x2c09('0x206')](_0x166a24,_0x7b7c31,_0x7d5a41)[_0x2c09('0x9d')](function(_0x3a99f8){_0x166a24[_0x2c09('0x1fa')]=0x0;if(_0x3a99f8){if(!utils[_0x2c09('0x207')](_0x3a99f8)){hopperUtils[_0x2c09('0x208')](_0x166a24)[_0x2c09('0x9d')](sendMessageReschedule(_0x166a24))[_0x2c09('0xa4')](loggerCatch(_0x2c09('0x209')));}else{_0x166a24[_0x2c09('0x7d')]+=_0x3a99f8['length'];_0x166a24[_0x2c09('0x69')]=_0x166a24[_0x2c09('0xb5')]===_0x2c09('0x7')?utils[_0x2c09('0x6a')][_0x2c09('0x13f')]:utils[_0x2c09('0x6a')][_0x2c09('0x1fc')];for(var _0x11ee16=0x0;_0x11ee16<_0x3a99f8[_0x2c09('0x102')];_0x11ee16+=0x1){if(_[_0x2c09('0xf8')](_0x3a99f8[_0x11ee16])||_[_0x2c09('0xf8')](_0x3a99f8[_0x11ee16][_0x2c09('0x175')])||_['isNil'](_0x3a99f8[_0x11ee16][_0x2c09('0x15c')])){_0x3977f8[_0x2c09('0x1fe')](_0x2c09('0x1ff'),_0x166a24,_0x3a99f8[_0x11ee16]);}else{hopperUtils['checkIsBlackList'](_[_0x2c09('0x105')](_0x3a99f8[_0x11ee16],['VoiceQueueId','phone']))[_0x2c09('0x9d')](_0x3977f8[_0x2c09('0x20a')](_0x166a24,_0x3a99f8[_0x11ee16]))['catch'](_0x3977f8['loggerHandler'](_0x2c09('0x1ff'),_0x166a24));}}}}})[_0x2c09('0xa4')](loggerGetContactDialer(_0x2c09('0x20b'),_0x166a24,_0x7d5a41));}};Dialer[_0x2c09('0x85')]['handlePredictive']=function(_0x19bbf1){if(_0x19bbf1[_0x2c09('0x20c')]>0x0){var _0x4559e9=_0x19bbf1[_0x2c09('0x20c')]-_0x19bbf1[_0x2c09('0x7d')]-_0x19bbf1[_0x2c09('0x13d')];if(_0x4559e9>0x0&&_0x19bbf1[_0x2c09('0x1fa')]==0x0){this['tryOriginatePredictive'](_0x19bbf1);}else{loggerPredictiveCalls[_0x2c09('0x49')](_0x2c09('0x20d'));}}else{this['tryOriginatePredictive'](_0x19bbf1);}};Dialer[_0x2c09('0x85')][_0x2c09('0x20e')]=function(_0x863ac7){var _0x56c544=this;var _0x3d316c=[];_0x863ac7[_0x2c09('0x7d')]+=0x1;for(var _0x17c9c2 in this[_0x2c09('0x20')]){if(typeof this['agents'][_0x17c9c2]!==_0x2c09('0xae')){if(this[_0x2c09('0x20')][_0x17c9c2][_0x2c09('0xe1')]===_0x2c09('0x205')&&this[_0x2c09('0x20')][_0x17c9c2][_0x2c09('0x8a')]===_0x2c09('0x8b')){_0x3d316c['push'](this[_0x2c09('0x20')][_0x17c9c2]['id']);}}}_0x863ac7['temp']=0x1;return this['getContactDialer'](_0x863ac7['id'],_0x3d316c,0x1,_0x863ac7['dialOrderByScheduledAt'],_0x863ac7)[_0x2c09('0x9d')](function(_0x4d7d80){_0x863ac7[_0x2c09('0x1fa')]=0x1;if(_0x4d7d80){if(!utils[_0x2c09('0x207')](_0x4d7d80)){utils[_0x2c09('0x67')](_0x863ac7,0x1,0x0);return hopperUtils['countReScheduled'](_0x863ac7)[_0x2c09('0x9d')](sendMessageReschedule(_0x863ac7))['catch'](loggerCatch(_0x2c09('0x209')));}else{_0x863ac7['message']=utils[_0x2c09('0x6a')][_0x2c09('0x1fc')];if(_[_0x2c09('0xf8')](_0x4d7d80[0x0])||_[_0x2c09('0xf8')](_0x4d7d80[0x0][_0x2c09('0x175')])||_[_0x2c09('0xf8')](_0x4d7d80[0x0][_0x2c09('0x15c')])){_0x56c544[_0x2c09('0x1fe')](_0x2c09('0x1ff'),_0x863ac7,_0x4d7d80[0x0]);}else{return hopperUtils[_0x2c09('0x20f')](_['pick'](_0x4d7d80[0x0],[_0x2c09('0xdf'),_0x2c09('0x15c')]))['then'](_0x56c544[_0x2c09('0x20a')](_0x863ac7,_0x4d7d80[0x0]))[_0x2c09('0xa4')](_0x56c544['loggerHandler'](_0x2c09('0x210'),_0x863ac7));}}}})[_0x2c09('0xa4')](loggerGetContactDialer('[getContactDialerPredictive]',_0x863ac7,0x1));};Dialer['prototype'][_0x2c09('0x1cf')]=function(_0x453373,_0x16e3ae,_0x3098ae,_0x20c737,_0x2ef9fd,_0x5dd29a){loggerPredictive[_0x2c09('0x49')](_0x2c09('0x211'));loggerPredictive[_0x2c09('0x49')](_0x2c09('0x212'),_0x453373);loggerPredictive[_0x2c09('0x49')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x16e3ae);loggerPredictive['info']('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',_0x3098ae);loggerPredictive[_0x2c09('0x49')](_0x2c09('0x213'),_0x20c737);loggerPredictive[_0x2c09('0x49')](_0x2c09('0x214'),_0x2ef9fd);loggerPredictive[_0x2c09('0x49')](_0x2c09('0x56'));return new Promise(function(_0xefa0ff,_0x2b3c3f){if(_0x453373<=0x0||isNaN(_0x453373)){return _0x2b3c3f(msgResponse(_0x2c09('0x215'),_0x2c09('0x84'),_0x2c09('0x216')+_0x453373));}if(_0x3098ae<=0x0||isNaN(_0x3098ae)){return _0x2b3c3f(msgResponse(_0x2c09('0x215'),'Error','Ts\x20=\x20'+_0x3098ae));}if(_0x20c737<=0x0||isNaN(_0x20c737)){return _0x2b3c3f(msgResponse(_0x2c09('0x215'),_0x2c09('0x84'),_0x2c09('0x217')+_0x20c737));}if(_0x16e3ae<=0x0||isNaN(_0x16e3ae)){return _0x2b3c3f(msgResponse(_0x2c09('0x215'),_0x2c09('0x84'),_0x2c09('0x218')+_0x16e3ae));}if(_0x2ef9fd<=0x0||isNaN(_0x2ef9fd)){return _0x2b3c3f(msgResponse(_0x2c09('0x215'),'Error','Amax\x20=\x20'+_0x2ef9fd));}_0x5dd29a=_0x5dd29a||0x0;var _0x1aac6e=0x1/_0x3098ae;var _0x5c899a=0x0;var _0x348d13=0x0;var _0x4e5c2b=0x0;var _0x1834e9=0x0;for(var _0x57d378=0x0;_0x4e5c2b<_0x2ef9fd;_0x57d378+=0x1){_0x348d13=_0x57d378/_0x16e3ae;_0x5c899a=(_0x20c737*_0x348d13+_0x5dd29a)/_0x1aac6e;_0x4e5c2b=utils['erlangb'](_0x5c899a,_0x453373);_0x1834e9=_0x5c899a/_0x453373*(0x1-utils['erlangb'](_0x5c899a,_0x453373));}return _0xefa0ff({'erlangCalls':_0x57d378,'erlangCallToSecond':_0x16e3ae/_0x57d378,'erlangAbandonmentRate':_0x4e5c2b,'erlangBusyFactor':_0x1834e9});});};Dialer[_0x2c09('0x85')]['busyFactor']=function(_0x418b8a,_0x27c5c4,_0x5617b8,_0x421616,_0x4f9e8c,_0x2d109e){loggerPredictive[_0x2c09('0x49')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive['info'](_0x2c09('0x212'),_0x418b8a);loggerPredictive[_0x2c09('0x49')](_0x2c09('0x219'),_0x27c5c4);loggerPredictive['info'](_0x2c09('0x21a'),_0x5617b8);loggerPredictive['info'](_0x2c09('0x213'),_0x421616);loggerPredictive[_0x2c09('0x49')](_0x2c09('0x21b'),_0x4f9e8c);loggerPredictive[_0x2c09('0x49')](_0x2c09('0x56'));return new Promise(function(_0x5928ed,_0x315637){if(_0x418b8a<=0x0||isNaN(_0x418b8a)){return _0x315637(msgResponse(_0x2c09('0x21c'),'Error',_0x2c09('0x216')+_0x418b8a));}if(_0x5617b8<=0x0||isNaN(_0x5617b8)){return _0x315637(msgResponse(_0x2c09('0x21c'),'Error',_0x2c09('0x21d')+_0x5617b8));}if(_0x421616<=0x0||isNaN(_0x421616)){return _0x315637(msgResponse(_0x2c09('0x21c'),_0x2c09('0x84'),'p\x20=\x20'+_0x421616));}if(_0x27c5c4<=0x0||isNaN(_0x27c5c4)){return _0x315637(msgResponse(_0x2c09('0x21c'),'Error','interval\x20=\x20'+_0x27c5c4));}if(_0x4f9e8c<=0x0||isNaN(_0x4f9e8c)){return _0x315637(msgResponse(_0x2c09('0x21c'),_0x2c09('0x84'),'Umin\x20=\x20'+_0x4f9e8c));}_0x2d109e=_0x2d109e||0x0;var _0x4cb61f=0x1/_0x5617b8;var _0x383781=0x0;var _0x988ba2=0x0;var _0x209283=0x0;var _0x12f885=0x0;for(var _0x409be3=0x0;_0x12f885<_0x4f9e8c;_0x409be3+=0x1){_0x988ba2=_0x409be3/_0x27c5c4;_0x383781=(_0x421616*_0x988ba2+_0x2d109e)/_0x4cb61f;_0x209283=utils[_0x2c09('0x21e')](_0x383781,_0x418b8a);_0x12f885=_0x383781/_0x418b8a*(0x1-utils[_0x2c09('0x21e')](_0x383781,_0x418b8a));}return _0x5928ed({'erlangCalls':_0x409be3,'erlangCallToSecond':_0x27c5c4/_0x409be3,'erlangAbandonmentRate':_0x209283,'erlangBusyFactor':_0x12f885});});};module[_0x2c09('0x21f')]=Dialer; \ No newline at end of file +var _0x3680=['contact\x20is\x20undefine','getCaller','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','custom:agentnoanswer','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','createStateFinal','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','erlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','dialPredictiveOptimizationPercentage','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','loggedIn','floor','erlangCallToSecond','one\x20call\x20every:','milliseconds','checkContactBlack','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','scheduledat','voicePause','run','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','temp','checkContactEmpty','NO_AVAILABLE_CONTACTS','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','getContactDialer','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','checkContactLowerLimitOriginate','countReScheduled','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','abandonmentRate','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\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','exports','util','lodash','uuid','moment','ioredis','./utils','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','redis','defaults','localhost','socket.io-emitter','../rpc/voiceQueueRt','../rpc/setting','./models/final','./models/agentComplete','./models/queueCallerAbandon','XCALLY_IP_AGI','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','syncQueueSummaryComplete','syncHangup','newexten','varset','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','name','-----\x20Stats\x20Predictive\x20---','info','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','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','predictiveIntervalAvgHoldtime','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','startProgressive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','contactsRescheduled','message','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','CAMPAIGN_STATUS','[getContactDialer2][Empty]','state','statedesc','endtime','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','queueStatusComplete','Interval','Intervals','NULL_INTERVAL','\x20INTERVAL_IS_NULL','isEmpty','isIVRCampaignActive','isIVRCampaign','campaign:ivr:%s','sendMessageOneNotActive','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','[ifTime][Action]','isTrunkReachable','active','reachable','status','unmonitored','prototype','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','interval','timezones','true','iftime\x20%s,%s','content','indexOf','catch','all','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncCampaigns]','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','silly','isGlobal','AMI\x20IfTime','Error','uniqueId','uniqueid','ivr','updateOriginated','queue','outboundAnswerCallsDay','agent','agiafterat','dialQueueProject2','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','getSeconds','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','countdropretry','countglobal','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','dialDropRetryFrequency','minutes','ContactId','ListId','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','createHistory','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','add','CampaignId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','actions','channel','strategy','rrmemory','roundrobin','actionid','isNil','stateinterface','locked','idHopper','paused','[Catch][Preview][syncQueueStatusComplete]','VoiceQueueId','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','responsetime','response','Success','[callProgressDetecting]\x20','variable','amdstatus','exten','dialAMDActive','value','HANGUP','HangupInAMD','membername','AMD','custom:amd','buildObj','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','outboundAnswerAgiCallsDay','Machine','countmachineretry','amd','countbusyretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncAgentComplete][createHistory][0]','countcongestionretry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','cause-txt','Unknow','running','isPreviewCampaign','statusMessage','available','inUse','talking','pTalking','ACTIVE','checkDialMethod','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','online','handlePreviewRecallNotifications','map','Agent','user:%s','clearZombieChannels','[uniqueid]','No\x20such\x20channel','[Dialer][checkChannel]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','UserId','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','checkPreviewRecallReminder','launchHandleIvr','originate','voiceQueue\x20is\x20undefine','phone'];(function(_0x10ca66,_0x23a244){var _0x1a7d93=function(_0x408ea5){while(--_0x408ea5){_0x10ca66['push'](_0x10ca66['shift']());}};_0x1a7d93(++_0x23a244);}(_0x3680,0xcd));var _0x0368=function(_0x4a474c,_0x4ca5f5){_0x4a474c=_0x4a474c-0x0;var _0x1958bb=_0x3680[_0x4a474c];return _0x1958bb;};'use strict';var util=require(_0x0368('0x0'));var _=require(_0x0368('0x1'));var uuid=require(_0x0368('0x2'));var moment=require(_0x0368('0x3'));var rr=require('rr');var Redis=require(_0x0368('0x4'));var utils=require(_0x0368('0x5'));var hopperUtils=require('./utils/hopper');var ut=require(_0x0368('0x6'));var config=require(_0x0368('0x7'));var logger=require(_0x0368('0x8'))(_0x0368('0x9'));var loggerBooked=require('../../../config/logger')(_0x0368('0xa'));var loggerPredictive=require(_0x0368('0x8'))(_0x0368('0xb'));var loggerPredictiveCalls=require(_0x0368('0x8'))(_0x0368('0xc'));var loggerSyncQueueSummary=require(_0x0368('0x8'))('syncQueueSummary');var ami=require('../ami');config[_0x0368('0xd')]=_[_0x0368('0xe')](config[_0x0368('0xd')],{'host':_0x0368('0xf'),'port':0x18eb});var io=require(_0x0368('0x10'))(new Redis(config[_0x0368('0xd')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0x0368('0x11'));var RpcSetting=require(_0x0368('0x12'));var Interval=require('../rpc/interval');var Action=require('./models/action');var History=require('./models/history');var Final=require(_0x0368('0x13'));var AgentComplete=require(_0x0368('0x14'));var QueueCallerAbandon=require(_0x0368('0x15'));var Hangup=require('./models/hangup');var ipAgi=process['env'][_0x0368('0x16')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x0368('0x17')]=function(_0x4ca307){this[_0x0368('0x18')]=this['tail']?this[_0x0368('0x18')][_0x0368('0x19')](_0x4ca307):_0x4ca307();};function Dialer(_0x4047b5,_0x9135df){this['sequence']=new Sequence();this[_0x0368('0x1a')]=_0x9135df;this['voiceQueues']=_0x4047b5[_0x0368('0x1b')];this['campaigns']=_0x4047b5[_0x0368('0x1c')];this[_0x0368('0x1d')]=_0x4047b5[_0x0368('0x1d')];this['trunks']=_0x4047b5[_0x0368('0x1e')];this['maxNumberOriginate']=config[_0x0368('0x1f')]||0x2;this[_0x0368('0x20')]={};this['actions']={};this[_0x0368('0x21')]={};this['uniqueId']={};this[_0x0368('0x22')]={};this[_0x0368('0x23')]={};this[_0x0368('0x24')]={};this[_0x0368('0x25')]={};this[_0x0368('0x26')]={};this[_0x0368('0x27')]={};this[_0x0368('0x28')]={};ami['on'](_0x0368('0x29'),this[_0x0368('0x2a')][_0x0368('0x2b')](this));ami['on']('queuecallerabandon',this[_0x0368('0x2c')][_0x0368('0x2b')](this));ami['on'](_0x0368('0x2d'),this[_0x0368('0x2e')][_0x0368('0x2b')](this));ami['on'](_0x0368('0x2f'),this[_0x0368('0x30')][_0x0368('0x2b')](this));ami['on'](_0x0368('0x31'),this[_0x0368('0x32')]['bind'](this));ami['on']('custom:queuesummarycomplete',this[_0x0368('0x33')][_0x0368('0x2b')](this));ami['on']('hangup',this[_0x0368('0x34')][_0x0368('0x2b')](this));ami['on'](_0x0368('0x35'),this['syncNewExten'][_0x0368('0x2b')](this));ami['on'](_0x0368('0x36'),this[_0x0368('0x37')][_0x0368('0x2b')](this));ami['on'](_0x0368('0x38'),this['syncQueueMember']['bind'](this));ami['on'](_0x0368('0x39'),this[_0x0368('0x3a')][_0x0368('0x2b')](this));this[_0x0368('0x3b')]();this[_0x0368('0x3c')]();RpcSetting['getSettings']()[_0x0368('0x3d')](function(_0x4fefcd){previewRecallmeReminderInterval=_0x4fefcd[_0x0368('0x3e')];});}function isNotNull(_0x3ae77c){return _0x3ae77c!==null&&!_[_0x0368('0x3f')](_0x3ae77c);}function msgResponse(_0x3c2ed4,_0x552b58,_0x1d0cc7){return{'action':_0x3c2ed4,'response':_0x552b58,'message':_0x1d0cc7,'stack':_0x1d0cc7};}function emit(_0x5b9c6c,_0x70800c,_0x1fd73a){io['to'](_0x5b9c6c)[_0x0368('0x40')](_0x70800c,_0x1fd73a);}function emitOutboundVoiceQueueSummary(_0x1c7985){if(_0x1c7985[_0x0368('0x41')]===_0x0368('0x42')){logger[_0x0368('0x43')](_0x0368('0x44'),util[_0x0368('0x45')](_0x1c7985,{'showHidden':![],'depth':null}));emit(util[_0x0368('0x46')]('voice:queue:%s',_0x1c7985[_0x0368('0x47')]),'voice_queue:save',_0x1c7985);}}function checkGetDataPredictive(_0x68ad88){if(isNotNull(_0x68ad88)&&!_['isEmpty'](_0x68ad88)){loggerPredictive['info'](_0x0368('0x48'));loggerPredictive[_0x0368('0x49')](_0x0368('0x4a'),_0x68ad88[_0x0368('0x4b')]);loggerPredictive[_0x0368('0x49')](_0x0368('0x4c'),_0x68ad88['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0x0368('0x4d'),_0x68ad88[_0x0368('0x4e')]);loggerPredictive['info'](_0x0368('0x4f'),_0x68ad88[_0x0368('0x50')]);loggerPredictive['info'](_0x0368('0x51'),_0x68ad88['predictiveIntervalAvgHoldtime']);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x68ad88[_0x0368('0x52')]);loggerPredictive['info'](_0x0368('0x53'));if(_0x68ad88[_0x0368('0x4b')]>0x0){if(!_[_0x0368('0x3f')](_0x68ad88[_0x0368('0x52')])&&_0x68ad88['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x0368('0x49')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x0368('0x3f')](_0x68ad88[_0x0368('0x54')])&&_0x68ad88['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x0368('0x49')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x0368('0x49')](_0x0368('0x55'));}}else{loggerPredictive[_0x0368('0x49')](_0x0368('0x56'));}return![];}function mergeDataErlangB(_0x422914){return function(_0x206d37){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0x0368('0x57'),_0x206d37['erlangCalls']);loggerPredictive['info'](_0x0368('0x58'),_0x206d37['erlangCallToSecond']);loggerPredictive[_0x0368('0x49')](_0x0368('0x59'),_0x206d37[_0x0368('0x5a')]);loggerPredictive[_0x0368('0x49')](_0x0368('0x5b'),_0x206d37[_0x0368('0x5c')]);loggerPredictive[_0x0368('0x49')](_0x0368('0x59'),_0x206d37[_0x0368('0x5a')]);loggerPredictive[_0x0368('0x49')](_0x0368('0x53'));_[_0x0368('0x5d')](_0x422914,_0x206d37);};}function ifInterval(_0x4a4d1f,_0x4d0376){if(_[_0x0368('0x3f')](_0x4d0376)){return![];}return utils['getSeconds'](undefined,_0x4d0376)<_0x4a4d1f*0x3c;}function clearPredictiveAttributes(_0x19f02c){if(_0x19f02c[_0x0368('0x24')]){_0x19f02c[_0x0368('0x24')]=undefined;loggerPredictive['debug'](_0x19f02c[_0x0368('0x47')],_0x0368('0x5e'));}if(_0x19f02c[_0x0368('0x23')]){_0x19f02c[_0x0368('0x23')]=undefined;loggerPredictive['debug'](_0x19f02c[_0x0368('0x47')],'startPredictive\x20value\x20cleared');}if(_0x19f02c[_0x0368('0x5f')]){clearInterval(_0x19f02c[_0x0368('0x5f')]);_0x19f02c[_0x0368('0x5f')]=undefined;loggerPredictive['debug'](_0x19f02c[_0x0368('0x47')],_0x0368('0x60'));}}function loggerCatchPredictive(_0x4d3fac,_0x1e463){return function(_0x1dd82a){loggerPredictive[_0x0368('0x61')](_0x1e463[_0x0368('0x47')],_0x4d3fac);loggerPredictive[_0x0368('0x61')](_0x1dd82a[_0x0368('0x62')]);clearPredictiveAttributes(_0x1e463);};}function loggerCatch(_0x2e2ec3){return function(_0x569222){logger[_0x0368('0x61')](_0x2e2ec3,util['inspect'](_0x569222,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x2e6974,_0xafcc3c,_0x3658c4){return function(_0x4016b3){utils['checkContactLowerLimitOriginate'](_0xafcc3c,_0x3658c4,0x0);_0xafcc3c['temp']=0x0;logger['error'](_0x2e6974,util[_0x0368('0x45')](_0x4016b3,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x47ee98){return function(_0x1a5092){if(isNotNull(_0x1a5092)&&isNotNull(_0x1a5092[0x0])){if(_0x1a5092[0x0][_0x0368('0x63')]>0x0){_0x47ee98[_0x0368('0x64')]=utils['CAMPAIGN_STATUS'][_0x0368('0x65')];logger[_0x0368('0x49')](_0x0368('0x66')+_0x47ee98[_0x0368('0x47')],_0x1a5092[0x0][_0x0368('0x63')],_0x0368('0x67'));}else{_0x47ee98[_0x0368('0x64')]=utils[_0x0368('0x68')]['NO_AVAILABLE_CONTACTS'];logger[_0x0368('0x49')](_0x0368('0x69')+_0x47ee98[_0x0368('0x47')]);}}};}function createObjHistory(_0x180749,_0x27a7b0,_0x2413d3,_0x4ff3c0,_0x36213f){_0x180749['message']=_0x2413d3;var _0x33a19d=new Action(_0x180749,_0x27a7b0);var _0x713da0=new History(_0x33a19d);_0x713da0[_0x0368('0x6a')]=_0x4ff3c0;_0x713da0[_0x0368('0x6b')]=_0x36213f;_0x713da0[_0x0368('0x6c')]=_0x33a19d['starttime'];return _0x713da0;}function unlockQueueStatus(_0x4dd499,_0x49e0ee){setTimeout(function(){if(_['isUndefined'](_0x4dd499['queueStatusComplete'])){loggerBooked[_0x0368('0x61')](_0x0368('0x6d'),_0x49e0ee);}_0x4dd499['queueStatusComplete']=!![];loggerBooked['info'](_0x0368('0x6e'),_0x49e0ee,JSON[_0x0368('0x6f')](_[_0x0368('0x70')](_0x4dd499,[_0x0368('0x47'),_0x0368('0x71')])));},0x1f3);}function checkInterval(_0x429afc){return function(){if(!isNotNull(_0x429afc[_0x0368('0x72')])){_0x429afc[_0x0368('0x64')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x429afc[_0x0368('0x47')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x429afc[_0x0368('0x72')][_0x0368('0x73')])){_0x429afc[_0x0368('0x64')]=utils['CAMPAIGN_STATUS'][_0x0368('0x74')];throw _0x429afc[_0x0368('0x47')]+_0x0368('0x75');}if(!isNotNull(_[_0x0368('0x76')](_0x429afc[_0x0368('0x72')][_0x0368('0x73')]))){_0x429afc[_0x0368('0x64')]=utils[_0x0368('0x68')]['NULL_INTERVAL'];throw _0x429afc[_0x0368('0x47')]+_0x0368('0x75');}};}function checkIsIVRCampaignActive(_0x41eb62){return function(){if(!utils[_0x0368('0x77')](_0x41eb62)){_0x41eb62[_0x0368('0x64')]=utils['CAMPAIGN_STATUS']['INACTIVE'];throw _0x41eb62['name']+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x273fbf){if(utils[_0x0368('0x78')](_0x273fbf)){emit(util[_0x0368('0x46')](_0x0368('0x79'),_0x273fbf[_0x0368('0x47')]),'campaign:save',_0x273fbf);}}function loggerCatchQueueSummary(_0x5b99f5,_0x3d6fe0){return function(_0x1c8b08){clearPredictiveAttributes(_0x3d6fe0);emitCampaignSummary(_0x3d6fe0);loggerSyncQueueSummary['debug'](_0x5b99f5,util['inspect'](_0x1c8b08,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x1d5b63){if(_0x1d5b63[_0x0368('0x7a')]){if(_0x1d5b63['originated']===0x0){_0x1d5b63[_0x0368('0x7a')]=![];_0x1d5b63[_0x0368('0x64')]=utils['CAMPAIGN_STATUS'][_0x0368('0x7b')];loggerSyncQueueSummary[_0x0368('0x43')](_0x0368('0x7c'),_0x1d5b63[_0x0368('0x47')],'is\x20not\x20active');}else{_0x1d5b63[_0x0368('0x64')]=utils[_0x0368('0x68')]['DISACTIVED'];loggerSyncQueueSummary[_0x0368('0x43')](_0x0368('0x7c'),_0x1d5b63['name'],_0x0368('0x7d'));}emitCampaignSummary(_0x1d5b63);}}function myreject(_0x35f1f9){return function(_0x46fc32){return _0x35f1f9(msgResponse(_0x0368('0x7e'),'Error',JSON[_0x0368('0x6f')](_0x46fc32)));};}Dialer['prototype'][_0x0368('0x7f')]=function(_0x553dc5){return!_[_0x0368('0x3f')](_0x553dc5)&&_0x553dc5&&!_[_0x0368('0x3f')](_0x553dc5[_0x0368('0x47')])&&!_[_0x0368('0x3f')](_0x553dc5[_0x0368('0x80')])&&_0x553dc5[_0x0368('0x80')]&&(this[_0x0368('0x1e')][util[_0x0368('0x46')]('SIP/%s',_0x553dc5['name'])]['status']===_0x0368('0x81')||this[_0x0368('0x1e')][util['format']('SIP/%s',_0x553dc5[_0x0368('0x47')])][_0x0368('0x82')]===_0x0368('0x83'));};Dialer[_0x0368('0x84')]['checkIsTrunkReachable']=function(_0x1a3e5f){var _0x8af22=this;return function(){if(!_0x8af22[_0x0368('0x7f')](_0x1a3e5f[_0x0368('0x85')])){if(!_0x8af22[_0x0368('0x7f')](_0x1a3e5f[_0x0368('0x86')])){_0x1a3e5f['message']=utils[_0x0368('0x68')][_0x0368('0x87')];throw _0x1a3e5f[_0x0368('0x47')]+_0x0368('0x88');}}};};Dialer[_0x0368('0x84')][_0x0368('0x89')]=function(_0x20432a,_0x1c598e,_0x20ca1a,_0x35229f){var _0x2fd094=this;return function(){var _0x190aee=!![];return _0x2fd094['ifTimeIvr'](_0x20432a,_0x1c598e,_0x20ca1a,_0x35229f,_0x190aee);};};Dialer[_0x0368('0x84')]['checkIfTimeIntervals']=function(_0x4b1405,_0x36a193,_0x5da592,_0x40d493){var _0x30d189=this;return function(){var _0x5d27b5=![];return _0x30d189[_0x0368('0x8a')](_0x4b1405[_0x0368('0x73')],_0x36a193,_0x5da592,_0x40d493,_0x5d27b5);};};Dialer[_0x0368('0x84')][_0x0368('0x8a')]=function(_0x1e31b0,_0x55c111,_0x2f5494,_0x490c04,_0x19a637){var _0x4c49f2=[];return new Promise(function(_0x503382,_0x33fa5e){if(!isNotNull(_0x1e31b0)){_0x490c04[_0x0368('0x64')]=utils[_0x0368('0x68')][_0x0368('0x74')];return _0x33fa5e(msgResponse(_0x0368('0x8b'),_0x0368('0x8c'),_0x2f5494+_0x0368('0x8d')));}if(_[_0x0368('0x76')](_0x1e31b0)){_0x490c04[_0x0368('0x64')]=utils[_0x0368('0x68')]['EMPTY_INTERVAL'];return _0x33fa5e(msgResponse(_0x0368('0x8b'),_0x0368('0x8c'),_0x2f5494+_0x0368('0x8e')));}if(_0x55c111&&_['isUndefined'](config['timezones'][_0x55c111])){_0x490c04['message']=utils[_0x0368('0x68')][_0x0368('0x8f')];return _0x33fa5e(msgResponse('ifTime','Failure',_0x2f5494+_0x0368('0x90')+_0x55c111));}if(_[_0x0368('0x91')](_0x1e31b0)){for(var _0x3a3b91=0x0;_0x3a3b91<_0x1e31b0[_0x0368('0x92')];_0x3a3b91+=0x1){_0x4c49f2[_0x0368('0x93')](ami[_0x0368('0x94')]({'action':_0x0368('0x95'),'command':util[_0x0368('0x46')]('iftime\x20%s,%s',_0x1e31b0[_0x3a3b91][_0x0368('0x96')],!_[_0x0368('0x3f')](config[_0x0368('0x97')][_0x55c111])?_0x55c111:'')})[_0x0368('0x3d')](function(_0x25d4ab){return _0x25d4ab['content']['indexOf'](_0x0368('0x98'))>=0x0;})['catch'](myreject(_0x33fa5e)));}}else{_0x4c49f2['push'](ami[_0x0368('0x94')]({'action':'command','command':util['format'](_0x0368('0x99'),_0x1e31b0,!_[_0x0368('0x3f')](config[_0x0368('0x97')][_0x55c111])?_0x55c111:'')})[_0x0368('0x3d')](function(_0x17bf29){return _0x17bf29[_0x0368('0x9a')][_0x0368('0x9b')](_0x0368('0x98'))>=0x0;})[_0x0368('0x9c')](myreject(_0x33fa5e)));}Promise[_0x0368('0x9d')](_0x4c49f2)[_0x0368('0x3d')](function(_0x3b0558){var _0xf586eb=_['some'](_0x3b0558);if(_0xf586eb){return _0x503382(_0xf586eb);}else{_0x490c04['message']=_0x19a637?utils[_0x0368('0x68')][_0x0368('0x9e')]:utils[_0x0368('0x68')][_0x0368('0x9f')];return _0x33fa5e(msgResponse('[ifTime][promiseAll]',_0x0368('0x8c'),_0x0368('0xa0')+_0x19a637+'\x20'+_0x2f5494+_0x0368('0xa1')+util[_0x0368('0x45')](_0x1e31b0,{'showHidden':![],'depth':null})+_0x0368('0xa2')+_0x55c111));}})[_0x0368('0x9c')](function(_0x53eadd){return _0x33fa5e(msgResponse(_0x0368('0x8b'),_0x0368('0x8c'),JSON['stringify'](_0x53eadd)));});});};Dialer['prototype']['loopCampaigns']=function(){var _0x2cd2fd=this;return cmHopper[_0x0368('0xa3')]({'active':![]},{'where':{'active':!![]}})[_0x0368('0x3d')](function(){setInterval(function(){_0x2cd2fd[_0x0368('0xa4')]();},0x3e8);});};Dialer[_0x0368('0x84')][_0x0368('0xa4')]=function(){var _0x283aac=this;var _0x5f4609;for(var _0x1b568d in this[_0x0368('0x1c')]){if(typeof this['campaigns'][_0x1b568d]!==_0x0368('0xa5')){_0x5f4609=this['campaigns'][_0x1b568d];if(utils['isIVRCampaign'](_0x5f4609)&&utils[_0x0368('0x77')](_0x5f4609)){_0x5f4609[_0x0368('0x7a')]=!![];Promise[_0x0368('0xa6')]()['then'](checkIsIVRCampaignActive(_0x5f4609))[_0x0368('0x3d')](checkInterval(_0x5f4609))[_0x0368('0x3d')](_0x283aac[_0x0368('0xa7')](_0x5f4609))[_0x0368('0x3d')](_0x283aac[_0x0368('0x89')](_0x5f4609[_0x0368('0xa8')],_0x5f4609[_0x0368('0xa9')],_0x5f4609[_0x0368('0x47')],_0x5f4609))[_0x0368('0x3d')](_0x283aac['checkIfTimeIntervals'](_0x5f4609[_0x0368('0x72')],_0x5f4609['dialTimezone'],_0x5f4609[_0x0368('0x47')],_0x5f4609))[_0x0368('0x3d')](_0x283aac['launchHandleIvr'](_0x5f4609))[_0x0368('0x9c')](loggerCatchQueueSummary(_0x0368('0xaa'),_0x5f4609));}else{notSendMessagesCampaign(_0x5f4609);}}}};Dialer[_0x0368('0x84')]['checkDialMethod']=function(_0x54985a){if(_0x54985a[_0x0368('0xab')]!==_0x0368('0xb')){clearPredictiveAttributes(_0x54985a);}switch(_0x54985a[_0x0368('0xab')]){case _0x0368('0xac'):this[_0x0368('0xad')](_0x54985a,0x1);break;case _0x0368('0xae'):this[_0x0368('0xad')](_0x54985a,_0x54985a[_0x0368('0xaf')]);break;case _0x0368('0xb'):this[_0x0368('0xb')](_0x54985a);break;case'booked':this['handlePower'](_0x54985a,0x1);break;default:logger[_0x0368('0x61')](_0x0368('0xb0'),_0x54985a[_0x0368('0x47')],'method\x20not\x20recognized');}};Dialer['prototype']['ifTime']=function(_0x4cb5a0,_0x34e33b){var _0x27f300=_0x4cb5a0['dialTimezone'];var _0x5b461f=_0x34e33b?_0x4cb5a0[_0x0368('0xa8')]:_0x4cb5a0[_0x0368('0x72')][_0x0368('0x73')];logger['silly'](_0x0368('0xb1'),_0x5b461f,_0x27f300,_0x4cb5a0[_0x0368('0x47')],util[_0x0368('0x46')](_0x0368('0xb2'),_0x4cb5a0[_0x0368('0x47')],_0x4cb5a0['id']));var _0x491896=null;return Interval['intervalIftime'](_0x5b461f,_0x27f300)[_0x0368('0x3d')](function(_0x5082a7){if(_0x5082a7===!![]){return _0x5082a7;}else{_0x4cb5a0[_0x0368('0x64')]=_0x34e33b?utils[_0x0368('0x68')][_0x0368('0x9e')]:utils[_0x0368('0x68')][_0x0368('0x9f')];_0x491896=msgResponse('[ifTime][promiseAll]',_0x0368('0x8c'),_0x0368('0xa0')+_0x34e33b+'\x20'+_0x4cb5a0[_0x0368('0x47')]+'\x20Interval\x20is\x20overtime:\x20'+util[_0x0368('0x45')](_0x5b461f,{'showHidden':![],'depth':null})+_0x0368('0xa2')+_0x27f300);}if(_0x491896!==null){logger[_0x0368('0xb3')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x491896);_0x491896[_0x0368('0xb4')]=_0x34e33b;throw _0x491896;}})[_0x0368('0x9c')](function(_0x5683b8){logger[_0x0368('0x61')](_0x0368('0xb5'),_0x5683b8);throw msgResponse(_0x0368('0x7e'),_0x0368('0xb6'),util[_0x0368('0x45')](_0x5683b8,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0x0368('0x2a')]=function(_0x1dcbe7){if(this[_0x0368('0x1b')][_0x1dcbe7['queue']]){if(this[_0x0368('0xb7')][_0x1dcbe7['uniqueid']]&&this[_0x0368('0xb7')][_0x1dcbe7[_0x0368('0xb8')]][_0x0368('0x41')]!==_0x0368('0xb9')){this[_0x0368('0xba')](this[_0x0368('0x1b')][_0x1dcbe7[_0x0368('0xbb')]]);this[_0x0368('0xb7')][_0x1dcbe7['uniqueid']]['answertime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x0368('0x84')][_0x0368('0x30')]=function(_0xb22fbc){var _0x54cbc8=this[_0x0368('0xb7')][_0xb22fbc[_0x0368('0xb8')]];if(this[_0x0368('0x1b')][_0xb22fbc['queue']]){if(_0x54cbc8&&_0x54cbc8[_0x0368('0x41')]!==_0x0368('0xb9')){delete this[_0x0368('0xb7')][_0xb22fbc[_0x0368('0xb8')]];this['voiceQueues'][_0xb22fbc[_0x0368('0xbb')]][_0x0368('0xbc')]+=0x1;var _0x292229=new AgentComplete(_0x54cbc8,_0xb22fbc);if(_0xb22fbc['reason']===_0x0368('0xbd')){_0x292229[_0x0368('0xbe')]=this['voiceQueues'][_0xb22fbc[_0x0368('0xbb')]][_0x0368('0xbf')]&&this[_0x0368('0x1b')][_0xb22fbc[_0x0368('0xbb')]]['dialAgiAfterHangupAgent']?moment()[_0x0368('0x46')](_0x0368('0xc0')):undefined;}hopperUtils['createHistory'](_0x292229)['catch'](loggerCatch(_0x0368('0xc1')));hopperUtils[_0x0368('0xc2')](_0x292229)[_0x0368('0x9c')](loggerCatch(_0x0368('0xc3')));}}};Dialer['prototype'][_0x0368('0x2c')]=function(_0x322ab1){var _0x192fc7=this[_0x0368('0xb7')][_0x322ab1[_0x0368('0xb8')]];var _0x47302f=this;var _0x597a41=![];var _0x4cde32;var _0xde1237;if(this[_0x0368('0x1b')][_0x322ab1[_0x0368('0xbb')]]){if(_0x192fc7&&_0x192fc7['type']!==_0x0368('0xb9')){delete this[_0x0368('0xb7')][_0x322ab1[_0x0368('0xb8')]];this[_0x0368('0xba')](this[_0x0368('0x1b')][_0x322ab1[_0x0368('0xbb')]]);_0x192fc7[_0x0368('0xc4')]=moment()[_0x0368('0x46')](_0x0368('0xc0'));var _0x31ae6d=new QueueCallerAbandon(_0x192fc7,_0x322ab1);if(utils[_0x0368('0xc5')](_0x192fc7['droptime'],_0x192fc7['responsetime'])>=_0x192fc7[_0x0368('0xc6')]){this[_0x0368('0x1b')][_0x322ab1[_0x0368('0xbb')]][_0x0368('0x4e')]+=0x1;this[_0x0368('0x1b')][_0x322ab1['queue']]['outboundDropCallsDayTimeout']+=0x1;this[_0x0368('0x1b')][_0x322ab1['queue']][_0x0368('0xc7')]+=0x1;_0x31ae6d[_0x0368('0x6a')]=0xa;_0x31ae6d[_0x0368('0x6b')]=_0x0368('0xc8');_0x31ae6d[_0x0368('0xc9')]='TIMEOUT';_0x31ae6d[_0x0368('0xbe')]=this[_0x0368('0x1b')][_0x322ab1[_0x0368('0xbb')]][_0x0368('0xbf')]?moment()[_0x0368('0x46')](_0x0368('0xc0')):undefined;_0x31ae6d[_0x0368('0xca')]+=0x1;_0x31ae6d[_0x0368('0xcb')]+=0x1;_0x4cde32=this[_0x0368('0x1b')][_0x322ab1[_0x0368('0xbb')]]['dialDropRetryFrequency'];_0xde1237=this[_0x0368('0x1b')][_0x322ab1[_0x0368('0xbb')]][_0x0368('0xcc')];hopperUtils[_0x0368('0xcd')](_0x31ae6d,_0x31ae6d[_0x0368('0x6a')],_0x192fc7[_0x0368('0xce')])[_0x0368('0x3d')](function(_0x495377){_0x597a41=_0x495377[_0x0368('0xcf')]==0x1;if(_0x31ae6d[_0x0368('0xca')]>=_0x47302f[_0x0368('0x1b')][_0x322ab1[_0x0368('0xbb')]][_0x0368('0xd0')]){_0x47302f[_0x0368('0xd1')](_0x31ae6d,_0x495377[_0x0368('0xcf')]);}else{hopperUtils[_0x0368('0xd2')]({'active':![],'countdropretry':_0x31ae6d[_0x0368('0xca')],'scheduledat':moment()['add'](_0x47302f[_0x0368('0x1b')][_0x322ab1['queue']][_0x0368('0xd3')],_0x0368('0xd4'))[_0x0368('0x46')](_0x0368('0xc0')),'ContactId':_0x192fc7[_0x0368('0xd5')],'ListId':_0x192fc7[_0x0368('0xd6')],'VoiceQueueId':_0x192fc7['VoiceQueueId']||undefined,'CampaignId':_0x192fc7['CampaignId']||undefined})[_0x0368('0x9c')](loggerCatch(_0x0368('0xd7')));var _0xdc3df0=new History(_0x31ae6d);_0xdc3df0[_0x0368('0x6a')]=0xa;_0xdc3df0[_0x0368('0x6b')]=_0x0368('0xc8');_0xdc3df0[_0x0368('0xd8')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xdc3df0['endtime']=_0xdc3df0[_0x0368('0xd8')];_0xdc3df0[_0x0368('0xd9')]=_0x31ae6d[_0x0368('0xd9')];_0xdc3df0[_0x0368('0xda')]=_0x31ae6d[_0x0368('0xda')];hopperUtils[_0x0368('0xdb')](_0xdc3df0)[_0x0368('0x9c')](loggerCatch(_0x0368('0xdc')));}})[_0x0368('0x3d')](function(){if(_0x597a41)hopperUtils[_0x0368('0xdd')](_0x31ae6d,_0x4cde32,_0xde1237)[_0x0368('0x3d')](function(){return 0x1;});});}else{this[_0x0368('0x1b')][_0x322ab1[_0x0368('0xbb')]][_0x0368('0x50')]+=0x1;this[_0x0368('0x1b')][_0x322ab1[_0x0368('0xbb')]][_0x0368('0xde')]+=0x1;_0x31ae6d[_0x0368('0x6a')]=0xb;_0x31ae6d[_0x0368('0x6b')]=_0x0368('0xdf');_0x31ae6d[_0x0368('0xc9')]='CALLEREXIT';_0x31ae6d[_0x0368('0xe0')]+=0x1;_0x31ae6d[_0x0368('0xcb')]+=0x1;_0x4cde32=this[_0x0368('0x1b')][_0x322ab1['queue']][_0x0368('0xe1')];_0xde1237=this[_0x0368('0x1b')][_0x322ab1[_0x0368('0xbb')]][_0x0368('0xcc')];hopperUtils[_0x0368('0xcd')](_0x31ae6d,_0x31ae6d[_0x0368('0x6a')],_0x192fc7['voiceQueue'])[_0x0368('0x3d')](function(_0x46331c){if(_0x31ae6d[_0x0368('0xe0')]>=_0x47302f[_0x0368('0x1b')][_0x322ab1[_0x0368('0xbb')]][_0x0368('0xe2')]){_0x47302f[_0x0368('0xd1')](_0x31ae6d,_0x46331c[_0x0368('0xcf')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x31ae6d[_0x0368('0xe0')],'scheduledat':moment()[_0x0368('0xe3')](_0x47302f[_0x0368('0x1b')][_0x322ab1[_0x0368('0xbb')]][_0x0368('0xe1')],_0x0368('0xd4'))[_0x0368('0x46')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x192fc7[_0x0368('0xd5')],'ListId':_0x192fc7['ListId'],'VoiceQueueId':_0x192fc7['VoiceQueueId']||undefined,'CampaignId':_0x192fc7[_0x0368('0xe4')]||undefined})['catch'](loggerCatch(_0x0368('0xe5')));var _0xb6fd47=new History(_0x31ae6d);_0xb6fd47[_0x0368('0x6a')]=0xb;_0xb6fd47[_0x0368('0x6b')]=_0x0368('0xdf');_0xb6fd47[_0x0368('0xd8')]=moment()[_0x0368('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0xb6fd47['endtime']=_0xb6fd47[_0x0368('0xd8')];_0xb6fd47['calleridname']=_0x31ae6d[_0x0368('0xd9')];_0xb6fd47[_0x0368('0xda')]=_0x31ae6d[_0x0368('0xda')];hopperUtils[_0x0368('0xdb')](_0xb6fd47)[_0x0368('0x9c')](loggerCatch(_0x0368('0xe6')));}})[_0x0368('0x3d')](function(){if(_0x597a41)hopperUtils[_0x0368('0xdd')](_0x31ae6d,_0x4cde32,_0xde1237)['then'](function(){return 0x1;});});}}}};Dialer[_0x0368('0x84')][_0x0368('0xe7')]=function(_0x2d6300){if(this[_0x0368('0xe8')][_0x2d6300[_0x0368('0xb8')]]){this[_0x0368('0xe8')][_0x2d6300[_0x0368('0xb8')]]['channel']=_0x2d6300[_0x0368('0xe9')];}if(this['uniqueId'][_0x2d6300[_0x0368('0xb8')]]){this['uniqueId'][_0x2d6300['uniqueid']]['channel']=_0x2d6300[_0x0368('0xe9')];}};Dialer[_0x0368('0x84')]['syncQueueMember']=function(_0x52db78){if(!this[_0x0368('0xe8')][_0x52db78['actionid']]){return;}var _0x525877=this[_0x0368('0x1b')][this[_0x0368('0xe8')][_0x52db78['actionid']][_0x0368('0xbb')]][_0x0368('0xea')]||_0x0368('0xeb');if(_0x525877===_0x0368('0xec')){if(this[_0x0368('0xe8')][_0x52db78[_0x0368('0xed')]]&&_[_0x0368('0xee')](this[_0x0368('0xe8')][_0x52db78['actionid']]['locked'])&&_0x52db78[_0x0368('0x82')]==='1'&&_0x52db78['paused']==='0'){if(this[_0x0368('0x1d')][_0x52db78['stateinterface']]){if(!this[_0x0368('0x1d')][_0x52db78['stateinterface']]['locked']){this[_0x0368('0x1d')][_0x52db78[_0x0368('0xef')]][_0x0368('0xf0')]=!![];this[_0x0368('0xe8')][_0x52db78[_0x0368('0xed')]]['locked']=!![];this['actions'][_0x52db78[_0x0368('0xed')]][_0x0368('0xef')]=_0x52db78[_0x0368('0xef')];}}}}else if(_0x525877===_0x0368('0xeb')){if(this[_0x0368('0xe8')][_0x52db78[_0x0368('0xed')]]){if(this[_0x0368('0x1d')][_0x52db78[_0x0368('0xef')]]){this[_0x0368('0xe8')][_0x52db78[_0x0368('0xed')]][_0x0368('0xef')]=_0x52db78['stateinterface'];if(_['isNil'](this[_0x0368('0x26')][this['actions'][_0x52db78[_0x0368('0xed')]]['queue']])){this[_0x0368('0x26')][this['actions'][_0x52db78['actionid']][_0x0368('0xbb')]]=[];}this[_0x0368('0x26')][this[_0x0368('0xe8')][_0x52db78['actionid']][_0x0368('0xbb')]][_0x0368('0x93')](_[_0x0368('0x5d')](_[_0x0368('0x70')](this[_0x0368('0xe8')][_0x52db78[_0x0368('0xed')]],[_0x0368('0xf1'),_0x0368('0xef')]),{'status':_0x52db78[_0x0368('0x82')],'paused':_0x52db78[_0x0368('0xf2')]}));}}}};Dialer[_0x0368('0x84')][_0x0368('0x3a')]=function(_0x192574){if(!this[_0x0368('0xe8')][_0x192574[_0x0368('0xed')]]){return;}var _0x107a94=this;var _0x3dce49=this[_0x0368('0x1b')][this['actions'][_0x192574[_0x0368('0xed')]][_0x0368('0xbb')]];var _0xb36709=_0x3dce49[_0x0368('0xea')]||_0x0368('0xeb');if(_0xb36709===_0x0368('0xec')){if(this['actions'][_0x192574['actionid']]&&this[_0x0368('0xe8')][_0x192574[_0x0368('0xed')]][_0x0368('0xef')]){this['preview']['run'](this['actions'][_0x192574[_0x0368('0xed')]][_0x0368('0xf1')],this[_0x0368('0xe8')][_0x192574[_0x0368('0xed')]][_0x0368('0xef')])[_0x0368('0x9c')](function(_0x1ff975){logger[_0x0368('0x61')](_0x0368('0xf3'),util[_0x0368('0x45')](_0x1ff975,{'showHidden':![],'depth':null}));})[_0x0368('0x19')](function(){_0x107a94[_0x0368('0xba')](_0x107a94[_0x0368('0x1b')][_0x107a94[_0x0368('0xe8')][_0x192574[_0x0368('0xed')]][_0x0368('0xbb')]]);_0x107a94['agents'][_0x107a94[_0x0368('0xe8')][_0x192574[_0x0368('0xed')]][_0x0368('0xef')]][_0x0368('0xf0')]=![];delete _0x107a94[_0x0368('0xe8')][_0x192574[_0x0368('0xed')]];unlockQueueStatus(_0x3dce49);});}else{this[_0x0368('0xba')](this[_0x0368('0x1b')][this['actions'][_0x192574[_0x0368('0xed')]][_0x0368('0xbb')]]);hopperUtils[_0x0368('0xd2')]({'active':![],'ContactId':this[_0x0368('0xe8')][_0x192574[_0x0368('0xed')]][_0x0368('0xd5')],'ListId':this[_0x0368('0xe8')][_0x192574[_0x0368('0xed')]][_0x0368('0xd6')],'VoiceQueueId':this[_0x0368('0xe8')][_0x192574['actionid']][_0x0368('0xf4')]||undefined,'CampaignId':this['actions'][_0x192574[_0x0368('0xed')]][_0x0368('0xe4')]||undefined})['catch'](loggerCatch(_0x0368('0xf5')));delete this[_0x0368('0xe8')][_0x192574['actionid']];unlockQueueStatus(_0x3dce49);}}else if(_0xb36709==='rrmemory'){var _0x2301c6;if(this[_0x0368('0xe8')][_0x192574['actionid']]&&!_[_0x0368('0x76')](this['queueBooked'][this[_0x0368('0xe8')][_0x192574[_0x0368('0xed')]][_0x0368('0xbb')]])){if(this['queueBookedRR'][_0x107a94[_0x0368('0xe8')][_0x192574[_0x0368('0xed')]][_0x0368('0xbb')]]){this[_0x0368('0x27')][_0x107a94['actions'][_0x192574['actionid']]['queue']]=this[_0x0368('0x27')][this[_0x0368('0xe8')][_0x192574[_0x0368('0xed')]]['queue']]?this[_0x0368('0x27')][this[_0x0368('0xe8')][_0x192574['actionid']][_0x0368('0xbb')]]:this[_0x0368('0x26')][this[_0x0368('0xe8')][_0x192574['actionid']][_0x0368('0xbb')]]?this[_0x0368('0x26')][this[_0x0368('0xe8')][_0x192574[_0x0368('0xed')]][_0x0368('0xbb')]][_0x0368('0xf6')]||0x0:0x0;}this['queueBooked'][this['actions'][_0x192574['actionid']][_0x0368('0xbb')]][_0x0368('0xf6')]=this[_0x0368('0x27')][this[_0x0368('0xe8')][_0x192574[_0x0368('0xed')]][_0x0368('0xbb')]];for(var _0x3a69d1=0x0;_0x3a69d1=_0x4c0e75[_0x0368('0x119')]){_0x20d6cc[_0x0368('0x11a')](_0x47df67,_0x57959a,_0xdc233a,'reason19\x20machine....');}else{if(_0x47df67[_0x0368('0x113')]>=_0x4c0e75[_0x0368('0x11b')]){_0x20d6cc['createStateFinal'](_0x47df67,_0x57959a,_0xdc233a,_0x0368('0x11c'));}else{hopperUtils[_0x0368('0xd2')]({'active':![],'countmachineretry':_0x47df67[_0x0368('0x113')],'scheduledat':moment()[_0x0368('0xe3')](_0x4c0e75[_0x0368('0x11d')],_0x0368('0xd4'))[_0x0368('0x46')](_0x0368('0xc0')),'ContactId':_0x47df67[_0x0368('0xd5')],'ListId':_0x47df67['ListId'],'VoiceQueueId':_0x47df67[_0x0368('0xf4')]||undefined,'CampaignId':_0x47df67['CampaignId']||undefined})[_0x0368('0x9c')](loggerCatch(_0x0368('0x11e')));_0x57959a({'reschedule':0x1});}}});}if(_0x26d3d6[_0x0368('0x41')]===_0x0368('0xb9')&&this[_0x0368('0x1c')][_0x26d3d6[_0x0368('0xbb')]][_0x0368('0x105')]&&_0xcec864[_0x0368('0x106')]===_0x0368('0x107')){delete this[_0x0368('0xb7')][_0xcec864[_0x0368('0xb8')]];this[_0x0368('0xba')](this[_0x0368('0x1c')][_0x26d3d6['queue']]);_0x18661c=new Hangup(_0x26d3d6,_0xcec864);_0x18661c['state']=0x12;_0x18661c[_0x0368('0x6b')]=_0x0368('0x108');_0x18661c[_0x0368('0x109')]=_0x0368('0x10a');ami[_0x0368('0x40')](_0x0368('0x10b'),ut[_0x0368('0x10c')](_0x18661c,_0x0368('0x114')));this[_0x0368('0x10d')](_0x18661c,_0x0368('0x11f'),'[syncHangupInAMDIvr]');}if(_0x26d3d6[_0x0368('0x41')]==='ivr'&&this[_0x0368('0x1c')][_0x26d3d6[_0x0368('0xbb')]][_0x0368('0x105')]&&_0xcec864[_0x0368('0x106')]===_0x0368('0x110')){return new Promise(function(_0x5325a2,_0x3aaaa4){delete _0x20d6cc['uniqueId'][_0xcec864[_0x0368('0xb8')]];_0x20d6cc[_0x0368('0xba')](_0x20d6cc[_0x0368('0x1c')][_0x26d3d6[_0x0368('0xbb')]]);_0x20d6cc[_0x0368('0x1c')][_0x26d3d6[_0x0368('0xbb')]][_0x0368('0xbc')]+=0x1;_0x20d6cc[_0x0368('0x1c')][_0x26d3d6[_0x0368('0xbb')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x1d08c2=_0x20d6cc['campaigns'][_0x26d3d6[_0x0368('0xbb')]];var _0x3c9e9b=new Hangup(_0x26d3d6,_0xcec864);_0x3c9e9b[_0x0368('0x6a')]=0x13;_0x3c9e9b[_0x0368('0x6b')]='Machine';_0x3c9e9b[_0x0368('0x109')]=_0x0368('0x10a');_0x3c9e9b[_0x0368('0x113')]+=0x1;_0x3c9e9b['countglobal']+=0x1;_0x3c9e9b[_0x0368('0x114')]=!![];ami[_0x0368('0x40')](_0x0368('0x10b'),ut[_0x0368('0x10c')](_0x3c9e9b,_0x0368('0x114')));hopperUtils[_0x0368('0xdb')](_0x3c9e9b)[_0x0368('0x9c')](loggerCatch(_0x0368('0x120')));if(_0x3c9e9b[_0x0368('0x115')]+_0x3c9e9b[_0x0368('0x121')]+_0x3c9e9b[_0x0368('0x116')]+_0x3c9e9b[_0x0368('0x117')]+_0x3c9e9b['countdropretry']+_0x3c9e9b['countabandonedretry']+_0x3c9e9b[_0x0368('0x113')]+_0x3c9e9b[_0x0368('0x118')]>=_0x1d08c2[_0x0368('0x119')]){_0x20d6cc['stateGlobal'](_0x3c9e9b,_0x5325a2,_0x3aaaa4,'reason19\x20machine....');}else{if(_0x3c9e9b['countmachineretry']>=_0x1d08c2[_0x0368('0x11b')]){_0x20d6cc['createStateFinal'](_0x3c9e9b,_0x5325a2,_0x3aaaa4,'reason\x2019\x20machine....');}else{hopperUtils[_0x0368('0xd2')]({'active':![],'countmachineretry':_0x3c9e9b[_0x0368('0x113')],'scheduledat':moment()[_0x0368('0xe3')](_0x1d08c2[_0x0368('0x11d')],_0x0368('0xd4'))[_0x0368('0x46')](_0x0368('0xc0')),'ContactId':_0x3c9e9b[_0x0368('0xd5')],'ListId':_0x3c9e9b['ListId'],'VoiceQueueId':_0x3c9e9b[_0x0368('0xf4')]||undefined,'CampaignId':_0x3c9e9b[_0x0368('0xe4')]||undefined})[_0x0368('0x9c')](loggerCatch(_0x0368('0x11e')));_0x5325a2({'reschedule':0x1});}}});}}};Dialer[_0x0368('0x84')][_0x0368('0x34')]=function(_0x1e6c87){var _0x5a6fb7=this[_0x0368('0xb7')][_0x1e6c87[_0x0368('0xb8')]];var _0x281901;if(_0x5a6fb7&&_0x5a6fb7[_0x0368('0x41')]===_0x0368('0xb9')){delete this[_0x0368('0xb7')][_0x1e6c87[_0x0368('0xb8')]];this[_0x0368('0xba')](this['campaigns'][_0x5a6fb7[_0x0368('0xbb')]]);this['campaigns'][_0x5a6fb7['queue']][_0x0368('0x122')]+=0x1;_0x281901=new Hangup(_0x5a6fb7,_0x1e6c87);hopperUtils['createHistory'](_0x281901)[_0x0368('0x9c')](loggerCatch(_0x0368('0x123')));hopperUtils[_0x0368('0xc2')](_0x281901)[_0x0368('0x9c')](loggerCatch(_0x0368('0x124')));}if(_0x5a6fb7&&_0x5a6fb7[_0x0368('0x41')]!==_0x0368('0xb9')&&isNotNull(this[_0x0368('0x1b')][_0x5a6fb7[_0x0368('0xbb')]]['dialQueueProject'])){delete this[_0x0368('0xb7')][_0x1e6c87[_0x0368('0xb8')]];this['updateOriginated'](this[_0x0368('0x1b')][_0x5a6fb7[_0x0368('0xbb')]]);this[_0x0368('0x1b')][_0x5a6fb7['queue']]['outboundAnswerCallsDay']+=0x1;this[_0x0368('0x1b')][_0x5a6fb7[_0x0368('0xbb')]][_0x0368('0x111')]+=0x1;_0x281901=new Hangup(_0x5a6fb7,_0x1e6c87);_0x281901[_0x0368('0x6a')]=0x10;_0x281901[_0x0368('0x6b')]=_0x0368('0x125');_0x281901[_0x0368('0x109')]=_0x0368('0x126');hopperUtils[_0x0368('0xdb')](_0x281901)['catch'](loggerCatch(_0x0368('0x123')));hopperUtils['moveContactManagedDialer'](_0x281901)[_0x0368('0x9c')](loggerCatch(_0x0368('0x124')));}if(_0x5a6fb7&&_0x5a6fb7['type']!=='ivr'&&!isNotNull(this[_0x0368('0x1b')][_0x5a6fb7[_0x0368('0xbb')]][_0x0368('0x127')])){if(_0x1e6c87[_0x0368('0x128')]==='Normal\x20Clearing'){delete this[_0x0368('0xb7')][_0x1e6c87[_0x0368('0xb8')]];this[_0x0368('0x1b')][_0x5a6fb7[_0x0368('0xbb')]][_0x0368('0xbc')]+=0x1;const _0x1946f2=new AgentComplete(_0x5a6fb7,_0x1e6c87);_0x1946f2[_0x0368('0xe4')]=this[_0x0368('0x1b')][_0x5a6fb7[_0x0368('0xbb')]]['id'];hopperUtils['createHistory'](_0x1946f2)[_0x0368('0x9c')](loggerCatch(_0x0368('0xc1')));hopperUtils[_0x0368('0xc2')](_0x1946f2)[_0x0368('0x9c')](loggerCatch(_0x0368('0xc3')));}else{delete this[_0x0368('0xb7')][_0x1e6c87['uniqueid']];this[_0x0368('0xba')](this['voiceQueues'][_0x5a6fb7[_0x0368('0xbb')]]);this[_0x0368('0x1b')][_0x5a6fb7[_0x0368('0xbb')]]['outboundUnknownCallsDay']+=0x1;_0x281901=new Hangup(_0x5a6fb7,_0x1e6c87);_0x281901[_0x0368('0x6a')]=0xc;_0x281901[_0x0368('0x6b')]=_0x1e6c87[_0x0368('0x128')];_0x281901[_0x0368('0x109')]=_0x0368('0x129');hopperUtils['createHistory'](_0x281901)[_0x0368('0x9c')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x0368('0xc2')](_0x281901)['catch'](loggerCatch(_0x0368('0x124')));}}};Dialer[_0x0368('0x84')][_0x0368('0x32')]=function(_0x459518){var _0x161b07=this;if(!_0x161b07['queuesSummary'][_0x459518[_0x0368('0x47')]]){_0x161b07[_0x0368('0x28')][_0x459518[_0x0368('0x47')]]={'running':![]};}else if(_0x161b07[_0x0368('0x28')][_0x459518[_0x0368('0x47')]][_0x0368('0x12a')]===!![]){return;}else if(_0x161b07[_0x0368('0x28')][_0x459518[_0x0368('0x47')]][_0x0368('0x12a')]===![]){_0x161b07[_0x0368('0x28')][_0x459518['name']]['running']=!![];}var _0xdf4a2a=_0x161b07[_0x0368('0x1b')][_0x459518[_0x0368('0x47')]];var _0x217fcf=_0xdf4a2a[_0x0368('0x64')]!==utils[_0x0368('0x68')]['INACTIVE'];var _0x2cb352=utils[_0x0368('0x12b')](_0xdf4a2a);_0xdf4a2a[_0x0368('0x12c')]=utils['getQueueCampaignStatusMessage'](_0xdf4a2a,_0x161b07['trunks']);Promise[_0x0368('0xa6')]()[_0x0368('0x3d')](function(){if(_0xdf4a2a[_0x0368('0x12c')]===utils[_0x0368('0x68')][_0x0368('0x7b')]){if(_0x217fcf){clearPredictiveAttributes(_0xdf4a2a);_0x459518[_0x0368('0x23')]=undefined;_0x459518[_0x0368('0x24')]=undefined;}if(_0xdf4a2a[_0x0368('0x12c')]===utils['CAMPAIGN_STATUS'][_0x0368('0x7b')]){_0x459518[_0x0368('0x12d')]=0x0;_0x459518['paused']=0x0;_0x459518[_0x0368('0x12e')]=0x0;_0x459518[_0x0368('0x12f')]=0x0;_0x459518[_0x0368('0x130')]=0x0;}}else if(_0xdf4a2a[_0x0368('0x12c')]===utils['CAMPAIGN_STATUS'][_0x0368('0x131')]&&!_0x2cb352){return _0x161b07[_0x0368('0x8b')](_0xdf4a2a,!![])[_0x0368('0x3d')](function(){return _0x161b07['ifTime'](_0xdf4a2a,![]);})[_0x0368('0x3d')](function(){return _0x161b07[_0x0368('0x132')](_0xdf4a2a);})[_0x0368('0x9c')](function(_0x547417){loggerSyncQueueSummary[_0x0368('0x43')](_0x0368('0x133'),util[_0x0368('0x45')](_0x547417,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0xdf4a2a);});}else{clearPredictiveAttributes(_0xdf4a2a);}})[_0x0368('0x3d')](function(){var _0x5beecf=_0x459518[_0x0368('0x134')](_0xdf4a2a);if(_0x5beecf||_0xdf4a2a[_0x0368('0x135')]){_0xdf4a2a[_0x0368('0x135')]=![];_0x459518[_0x0368('0x136')](_0xdf4a2a);Object[_0x0368('0x137')](_0xdf4a2a,_0x459518);emitOutboundVoiceQueueSummary(_0x459518);}_0x161b07[_0x0368('0x28')][_0xdf4a2a[_0x0368('0x47')]]['running']=![];})['catch'](function(_0x35a609){logger['error'](_0x0368('0x133'),util['inspect'](_0x35a609,{'showHidden':![],'depth':null}));_0x161b07['queuesSummary'][_0xdf4a2a[_0x0368('0x47')]][_0x0368('0x12a')]=![];});};Dialer['prototype'][_0x0368('0x33')]=_[_0x0368('0x138')](function(){var _0x4a2049=_[_0x0368('0x139')](this[_0x0368('0x1b')],function(_0x4ff110){return _0x4ff110['dialPreviewRecallmeReminder'];});var _0x26a74c=_[_0x0368('0x139')](this[_0x0368('0x1d')],function(_0x5df72a){return _0x5df72a[_0x0368('0x13a')]&&_0x5df72a[_0x0368('0x82')]===_0x0368('0x81');});if(_0x4a2049[_0x0368('0x92')]>0x0&&_0x26a74c[_0x0368('0x92')]>0x0){return Promise[_0x0368('0xa6')]()[_0x0368('0x3d')](cmHopper[_0x0368('0x13b')](_[_0x0368('0x13c')](_0x4a2049,'id'),previewRecallmeReminderInterval,_['map'](_0x26a74c,'id')))['then'](function(_0x3023d2){for(var _0x39a8e9=0x0;_0x39a8e9<_0x3023d2[_0x0368('0x92')];_0x39a8e9++){var _0x272ad6=_0x3023d2[_0x39a8e9][_0x0368('0x13d')][_0x0368('0x47')];if(_0x272ad6)io['to'](util[_0x0368('0x46')](_0x0368('0x13e'),_0x272ad6))[_0x0368('0x40')]('user:dialPreviewRecallReminder',{'hopper':_0x3023d2[_0x39a8e9]});}})[_0x0368('0x9c')](function(_0x488653){logger[_0x0368('0x61')]('checkPreviewRecallReminder',_0x488653);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x0368('0x84')]['loopClearZombieChannels']=function(){var _0x501110=this;setInterval(function(){_0x501110[_0x0368('0x13f')](_0x501110[_0x0368('0xb7')],_0x0368('0x140'));_0x501110[_0x0368('0x13f')](_0x501110[_0x0368('0xe8')],'[actions]');},0x32c8);};Dialer[_0x0368('0x84')][_0x0368('0x13f')]=function(_0x2d928d,_0xb718ee){var _0x556961=this;for(var _0x59c349 in _0x2d928d){if(typeof _0x2d928d[_0x59c349]!=='undefined'){this['sequence']['enqueue'](function(){if(!_[_0x0368('0xee')](_0x2d928d[_0x59c349])){return ami[_0x0368('0x94')]({'action':_0x0368('0x82'),'channel':_0x2d928d[_0x59c349]['channel']})[_0x0368('0x9c')](function(_0x51877f){if(_0x51877f['message']===_0x0368('0x141')){setTimeout(function(){if(_0x2d928d[_0x59c349]&&_0x2d928d[_0x59c349][_0x0368('0x41')]!==_0x0368('0xb9')){_0x556961[_0x0368('0xba')](_0x556961[_0x0368('0x1b')][_0x2d928d[_0x59c349][_0x0368('0xbb')]]);logger['error'](_0x0368('0x142'),_0xb718ee,_0x59c349,_0x2d928d[_0x59c349][_0x0368('0xbb')]);delete _0x2d928d[_0x59c349];}if(_0x2d928d[_0x59c349]&&_0x2d928d[_0x59c349][_0x0368('0x41')]===_0x0368('0xb9')){_0x556961[_0x0368('0xba')](_0x556961['campaigns'][_0x2d928d[_0x59c349]['queue']]);logger[_0x0368('0x61')]('[Dialer][checkChannel][ivr]',_0xb718ee,_0x59c349,_0x2d928d[_0x59c349]['queue']);delete _0x2d928d[_0x59c349];}},0x2328);}});}});}}};Dialer[_0x0368('0x84')][_0x0368('0x143')]=function(_0x433dd8){return Promise[_0x0368('0xa6')]()[_0x0368('0x3d')](voiceQueueRt[_0x0368('0x143')](_0x433dd8))['catch'](loggerCatch(_0x0368('0x144')));};Dialer[_0x0368('0x84')][_0x0368('0xba')]=function(_0x2c8e5b){if(!_[_0x0368('0x3f')](_0x2c8e5b)&&_0x2c8e5b!==null){if(typeof _0x2c8e5b[_0x0368('0x145')]!==_0x0368('0xa5')){if(_0x2c8e5b[_0x0368('0x145')]>0x0){_0x2c8e5b['originated']-=0x1;}else{logger[_0x0368('0x61')](_0x0368('0x146'));}}}else{logger['error'](_0x0368('0x147'));}};Dialer['prototype'][_0x0368('0x148')]=function(_0x3ccba2,_0x3b266a){var _0x24bc69=this;return function(_0x35a14c){_0x24bc69['updateOriginated'](_0x3b266a);logger[_0x0368('0x61')](_0x3ccba2,util['inspect'](_0x35a14c,{'showHidden':![],'depth':null}));};};Dialer[_0x0368('0x84')][_0x0368('0x149')]=function(_0x22ce29,_0x3f438e,_0x2b3267){var _0x4923e8={'state':0x19,'statedesc':_0x0368('0x14a')};this[_0x0368('0xba')](_0x3f438e);this[_0x0368('0x10d')](_['merge'](_0x4923e8,_['pick'](_0x2b3267,[_0x0368('0xd5'),_0x0368('0xd6'),_0x0368('0x14b'),_0x0368('0xf4'),'CampaignId'])),'[emptyContact][createHistory]',_0x0368('0x14c'));logger[_0x0368('0x61')](_0x22ce29);};Dialer[_0x0368('0x84')][_0x0368('0x10d')]=function(_0x1fbb22,_0xfc8d4b,_0x1fdbc6){hopperUtils[_0x0368('0xdb')](_0x1fbb22)['catch'](loggerCatch(_0xfc8d4b));hopperUtils['moveContactManagedDialer'](_0x1fbb22)[_0x0368('0x9c')](loggerCatch(_0x1fdbc6));};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x52bb15,_0x31d126){hopperUtils[_0x0368('0xdb')](_0x52bb15)[_0x0368('0x9c')](loggerCatch(_0x0368('0xc1')));if(_0x31d126==0x0){hopperUtils[_0x0368('0xc2')](_0x52bb15)[_0x0368('0x9c')](loggerCatch(_0x0368('0x14d')));}};Dialer[_0x0368('0x84')][_0x0368('0x14e')]=function(_0xeaa516){return Promise[_0x0368('0xa6')]()[_0x0368('0x3d')](cmHopper[_0x0368('0x13b')](_0xeaa516['id'],previewRecallmeReminderInterval))[_0x0368('0x3d')](function(_0x4b99c8){for(var _0x56f5d1=0x0;_0x56f5d1<_0x4b99c8[_0x0368('0x92')];_0x56f5d1++){var _0x43a2c7=_0x4b99c8[_0x56f5d1][_0x0368('0x13d')]['name'];if(_0x43a2c7)io['to'](util[_0x0368('0x46')](_0x0368('0x13e'),_0x43a2c7))[_0x0368('0x40')]('user:dialPreviewRecallReminder',{'hopper':_0x4b99c8[_0x56f5d1]});}})[_0x0368('0x9c')](function(){});};Dialer['prototype'][_0x0368('0x14f')]=function(_0x36351f){var _0x195df7=this;return function(){_0x195df7['handleIvr'](_0x36351f);};};Dialer[_0x0368('0x84')]['actionOriginate']=function(_0x2db29e,_0x20a544){var _0x275dff=this;var _0x1ed676=uuid['v4']();this[_0x0368('0xe8')][_0x1ed676]=new Action(_0x2db29e,_0x20a544,_0x1ed676);return new Promise(function(_0x45a2f0,_0x30a785){if(_['isUndefined'](_0x2db29e)&&typeof _0x2db29e!=='object'){return _0x30a785(msgResponse(_0x0368('0x150'),_0x0368('0x8c'),_0x0368('0x151')));}if(_[_0x0368('0x3f')](_0x20a544[_0x0368('0x152')])||_0x20a544['phone']===null){return _0x30a785(msgResponse(_0x0368('0x150'),_0x0368('0x8c'),_0x0368('0x153')));}var _0x3d6491={'XMD-CALLERID':_0x275dff[_0x0368('0xe8')][_0x1ed676][_0x0368('0x154')](),'XMD-AGI':_0x2db29e['dialQueueProject']?util[_0x0368('0x46')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2db29e[_0x0368('0x127')]):_0x0368('0x155'),'XMD-AGIAFTER':_0x2db29e[_0x0368('0xbf')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x2db29e[_0x0368('0xbf')]):_0x0368('0x155'),'XMD-QUEUE':utils['isOutboundQueue'](_0x2db29e)?util[_0x0368('0x46')](_0x0368('0x156'),_0x2db29e[_0x0368('0x47')],_0x2db29e[_0x0368('0x157')]||'',_0x2db29e[_0x0368('0x158')]?'c':'',_0x2db29e[_0x0368('0xc6')]||0x3):_0x0368('0x155'),'XMD-CONTACTID':_0x20a544[_0x0368('0xd5')],'XMD-CDRTYPE':_0x0368('0x9'),'CALLERID(all)':_0x275dff[_0x0368('0xe8')][_0x1ed676][_0x0368('0x154')](),'XMD-AMD':_0x2db29e[_0x0368('0x105')]?_0x0368('0x131'):_0x0368('0x155'),'XMD-DESTINATION':_0x0368('0x159')};if(_0x2db29e['dialAMDActive']){_0x3d6491[_0x0368('0x15a')]=_0x2db29e[_0x0368('0x15b')]||0x9c4;_0x3d6491[_0x0368('0x15c')]=_0x2db29e['dialAMDGreeting']||0x5dc;_0x3d6491[_0x0368('0x15d')]=_0x2db29e['dialAMDAfterGreetingSilence']||0x320;_0x3d6491[_0x0368('0x15e')]=_0x2db29e[_0x0368('0x15f')]||0x1388;_0x3d6491['XMD-AMDMINWORDLENGTH']=_0x2db29e[_0x0368('0x160')]||0x64;_0x3d6491[_0x0368('0x161')]=_0x2db29e[_0x0368('0x162')]||0x32;_0x3d6491[_0x0368('0x163')]=_0x2db29e[_0x0368('0x164')]||0x3;_0x3d6491[_0x0368('0x165')]=_0x2db29e[_0x0368('0x166')]||0x100;_0x3d6491[_0x0368('0x167')]=_0x2db29e['dialAMDMaximumWordLength']||0x1388;}if(utils['isOutboundQueue'](_0x2db29e)){_0x3d6491[_0x0368('0x168')]=_0x20a544['VoiceQueueId'];}else{_0x3d6491[_0x0368('0x169')]=_0x20a544[_0x0368('0xe4')];}var _0x40ef22=utils[_0x0368('0x16a')](_0x20a544[_0x0368('0x16b')]);Object[_0x0368('0x137')](_0x3d6491,_0x40ef22);var _0x181cd2=_0x275dff[_0x0368('0x7f')](_0x2db29e[_0x0368('0x85')])?utils['getCallerId'](_0x2db29e[_0x0368('0x85')][_0x0368('0x16c')],_0x2db29e[_0x0368('0x16d')],_0x2db29e[_0x0368('0x16e')]>0x0?utils[_0x0368('0x16f')](_0x2db29e[_0x0368('0x170')],_0x2db29e['dialRandomLastDigitCallerIdNumber']):_0x2db29e[_0x0368('0x170')]):utils['getCallerId'](_[_0x0368('0xee')](_0x2db29e[_0x0368('0x86')])?_0x2db29e[_0x0368('0x85')]['callerid']:_0x2db29e[_0x0368('0x86')][_0x0368('0x16c')],_0x2db29e['dialOriginateCallerIdName'],_0x2db29e[_0x0368('0x16e')]>0x0?utils['getCallerIdRandom'](_0x2db29e[_0x0368('0x170')],_0x2db29e[_0x0368('0x16e')]):_0x2db29e[_0x0368('0x170')]);if(_0x181cd2){_0x3d6491[_0x0368('0x171')]=_0x275dff[_0x0368('0xe8')][_0x1ed676][_0x0368('0x172')]=utils[_0x0368('0x173')](_0x181cd2);_0x3d6491[_0x0368('0x174')]=_0x20a544[_0x0368('0x152')];}_0x2db29e['variables']=_0x3d6491;return ami[_0x0368('0x94')]({'actionid':_0x1ed676,'action':_0x0368('0x150'),'channel':_0x275dff['isTrunkReachable'](_0x2db29e[_0x0368('0x85')])?util[_0x0368('0x46')](_0x0368('0x175'),_0x2db29e[_0x0368('0x85')]['name'],isNotNull(_0x2db29e['dialPrefix'])?_0x2db29e[_0x0368('0x176')][_0x0368('0x177')]()||'':'',_0x2db29e[_0x0368('0x178')]>0x0?_0x20a544['phone']['substring'](_0x2db29e[_0x0368('0x178')]):_0x20a544['phone']):util[_0x0368('0x46')](_0x0368('0x175'),_['isNil'](_0x2db29e[_0x0368('0x86')])?_0x2db29e[_0x0368('0x85')]['name']:_0x2db29e['TrunkBackup'][_0x0368('0x47')],isNotNull(_0x2db29e[_0x0368('0x176')])?_0x2db29e[_0x0368('0x176')][_0x0368('0x177')]()||'':'',_0x2db29e['dialCutDigit']>0x0?_0x20a544[_0x0368('0x152')]['substring'](_0x2db29e['dialCutDigit']):_0x20a544[_0x0368('0x152')]),'callerid':_0x181cd2,'Exten':'xcally-motion-dialer','Context':_0x0368('0x179'),'Priority':'1','variable':_0x3d6491,'timeout':(_0x2db29e[_0x0368('0x17a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1ed676})['then'](function(_0x1d0029){return _0x45a2f0(_0x1d0029);})[_0x0368('0x9c')](function(_0x2d0c57){_0x2db29e[_0x0368('0x17b')]+=0x1;var _0x49a93d=new History(_0x275dff[_0x0368('0xe8')][_0x1ed676]);logger[_0x0368('0x61')](util[_0x0368('0x46')](_0x0368('0x17c'),JSON['stringify'](_0x2d0c57)));_0x49a93d[_0x0368('0x6a')]=0xe;_0x49a93d['statedesc']='OriginateError';_0x49a93d['starttime']=moment()['format'](_0x0368('0xc0'));_0x49a93d[_0x0368('0x6c')]=_0x49a93d[_0x0368('0xd8')];hopperUtils['createHistory'](_0x49a93d)['catch'](loggerCatch(_0x0368('0x17d')));_0x275dff[_0x0368('0xc2')](_0x49a93d)[_0x0368('0x9c')](loggerCatch(_0x0368('0x17d')))['finally'](function(){delete _0x275dff[_0x0368('0xe8')][_0x1ed676];return _0x30a785(msgResponse(_0x0368('0x150'),_0x0368('0xb6'),_0x0368('0x17e')));});});});};Dialer[_0x0368('0x84')][_0x0368('0x17f')]=function(_0xb36c36,_0x261b96,_0x3a5250){var _0x5315b4=new History(_0x261b96);if(_0x5315b4[_0x0368('0x115')]+_0x5315b4[_0x0368('0x121')]+_0x5315b4[_0x0368('0x116')]+_0x5315b4['countnosuchnumberretry']+_0x5315b4['countdropretry']+_0x5315b4[_0x0368('0xe0')]+_0x5315b4[_0x0368('0x113')]+_0x5315b4[_0x0368('0x118')]>=_0x3a5250[_0x0368('0x119')]-0x1){return!![];}switch(_0xb36c36){case 0x3:if(_0x5315b4['countnoanswerretry']>=_0x3a5250['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0x0368('0xd2')]({'active':![],'countnoanswerretry':_0x5315b4[_0x0368('0x116')]+=0x1,'scheduledat':moment()[_0x0368('0xe3')](_0x3a5250['dialNoAnswerRetryFrequency'],_0x0368('0xd4'))['format'](_0x0368('0xc0')),'ContactId':_0x5315b4['ContactId'],'ListId':_0x5315b4[_0x0368('0xd6')],'VoiceQueueId':_0x5315b4[_0x0368('0xf4')]||undefined,'CampaignId':_0x5315b4[_0x0368('0xe4')]||undefined})[_0x0368('0x9c')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x5315b4[_0x0368('0x115')]>=_0x3a5250[_0x0368('0x180')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x5315b4['countbusyretry']+=0x1,'scheduledat':moment()[_0x0368('0xe3')](_0x3a5250[_0x0368('0x181')],_0x0368('0xd4'))[_0x0368('0x46')](_0x0368('0xc0')),'ContactId':_0x5315b4[_0x0368('0xd5')],'ListId':_0x5315b4['ListId'],'VoiceQueueId':_0x5315b4[_0x0368('0xf4')]||undefined,'CampaignId':_0x5315b4[_0x0368('0xe4')]||undefined})[_0x0368('0x9c')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x5315b4['countcongestionretry']>=_0x3a5250[_0x0368('0x182')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x5315b4['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x3a5250[_0x0368('0x183')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5315b4[_0x0368('0xd5')],'ListId':_0x5315b4[_0x0368('0xd6')],'VoiceQueueId':_0x5315b4[_0x0368('0xf4')]||undefined,'CampaignId':_0x5315b4['CampaignId']||undefined})['catch'](loggerCatch(_0x0368('0x184')));break;case 0x0:if(_0x5315b4[_0x0368('0x117')]>=_0x3a5250[_0x0368('0x185')]-0x1){return!![];}else{hopperUtils[_0x0368('0xd2')]({'active':![],'countnosuchnumberretry':_0x5315b4[_0x0368('0x117')]+=0x1,'scheduledat':moment()['add'](_0x3a5250[_0x0368('0x186')],_0x0368('0xd4'))['format'](_0x0368('0xc0')),'ContactId':_0x5315b4[_0x0368('0xd5')],'ListId':_0x5315b4[_0x0368('0xd6')],'VoiceQueueId':_0x5315b4[_0x0368('0xf4')]||undefined,'CampaignId':_0x5315b4['CampaignId']||undefined})[_0x0368('0x9c')](loggerCatch(_0x0368('0x187')));}break;case 0xa:if(_0x5315b4[_0x0368('0xca')]>=_0x3a5250[_0x0368('0xd0')]-0x1){return!![];}hopperUtils[_0x0368('0xd2')]({'active':![],'countdropretry':_0x5315b4[_0x0368('0xca')]+=0x1,'scheduledat':moment()[_0x0368('0xe3')](_0x3a5250[_0x0368('0xd3')],'minutes')[_0x0368('0x46')](_0x0368('0xc0')),'ContactId':_0x5315b4[_0x0368('0xd5')],'ListId':_0x5315b4[_0x0368('0xd6')],'VoiceQueueId':_0x5315b4['VoiceQueueId']||undefined,'CampaignId':_0x5315b4[_0x0368('0xe4')]||undefined})[_0x0368('0x9c')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x5315b4[_0x0368('0xe0')]>=_0x3a5250[_0x0368('0xe2')]-0x1){return!![];}hopperUtils[_0x0368('0xd2')]({'active':![],'countabandonedretry':_0x5315b4[_0x0368('0xe0')]+=0x1,'scheduledat':moment()[_0x0368('0xe3')](_0x3a5250[_0x0368('0xe1')],_0x0368('0xd4'))[_0x0368('0x46')](_0x0368('0xc0')),'ContactId':_0x5315b4['ContactId'],'ListId':_0x5315b4[_0x0368('0xd6')],'VoiceQueueId':_0x5315b4['VoiceQueueId']||undefined,'CampaignId':_0x5315b4[_0x0368('0xe4')]||undefined})[_0x0368('0x9c')](loggerCatch(_0x0368('0xe5')));break;case 0x13:if(_0x5315b4[_0x0368('0x113')]>=_0x3a5250['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x0368('0xd2')]({'active':![],'countmachineretry':_0x5315b4['countmachineretry']+=0x1,'scheduledat':moment()[_0x0368('0xe3')](_0x3a5250[_0x0368('0x11d')],'minutes')[_0x0368('0x46')](_0x0368('0xc0')),'ContactId':_0x5315b4[_0x0368('0xd5')],'ListId':_0x5315b4['ListId'],'VoiceQueueId':_0x5315b4[_0x0368('0xf4')]||undefined,'CampaignId':_0x5315b4[_0x0368('0xe4')]||undefined})[_0x0368('0x9c')](loggerCatch(_0x0368('0x11e')));break;case 0x14:if(_0x5315b4[_0x0368('0x118')]>=_0x3a5250['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x0368('0xd2')]({'active':![],'countagentrejectretry':_0x5315b4[_0x0368('0x118')]+=0x1,'scheduledat':moment()[_0x0368('0xe3')](_0x3a5250['dialAgentRejectRetryFrequency'],'minutes')['format'](_0x0368('0xc0')),'ContactId':_0x5315b4[_0x0368('0xd5')],'ListId':_0x5315b4[_0x0368('0xd6')],'VoiceQueueId':_0x5315b4[_0x0368('0xf4')]||undefined,'CampaignId':_0x5315b4[_0x0368('0xe4')]||undefined})['catch'](loggerCatch(_0x0368('0x188')));break;default:return!![];}};Dialer[_0x0368('0x84')]['callProgressDetecting']=function(_0x5a6252,_0x56ebe9,_0x37d694){var _0x6bc1f1=this;var _0x23ccaf=new History(_0x5a6252);var _0x285f46=![];var _0x5c7409;var _0x5c79eb;return new Promise(function(_0xdf20eb,_0x2f7cb4){if(_[_0x0368('0x3f')](_0x56ebe9)&&typeof _0x56ebe9!==_0x0368('0x189')){return _0x2f7cb4(msgResponse(_0x0368('0x18a'),_0x0368('0x8c'),_0x0368('0x18b')));}if(_[_0x0368('0x3f')](_0x37d694)&&typeof _0x37d694!==_0x0368('0x189')){return _0x2f7cb4(msgResponse(_0x0368('0x18a'),_0x0368('0x8c'),_0x0368('0x18c')));}hopperUtils['verifyAdditionalPhones'](_0x23ccaf,_0x37d694['reason'],_0x56ebe9)[_0x0368('0x3d')](function(_0x3d418e){if(_0x3d418e[_0x0368('0xcf')]==0x1)_0x285f46=!![];switch(_0x37d694[_0x0368('0x18d')]){case'0':_0x56ebe9[_0x0368('0x18e')]+=0x1;_0x23ccaf['state']=0x0;_0x23ccaf[_0x0368('0x6b')]=_0x0368('0x18f');_0x23ccaf[_0x0368('0x117')]+=0x1;_0x23ccaf[_0x0368('0xcb')]+=0x1;ami['emit'](_0x0368('0x190'),ut[_0x0368('0x10c')](_0x5a6252,'nosuchnumber'));_0x5c7409=_0x56ebe9[_0x0368('0x186')];_0x5c79eb=_0x56ebe9[_0x0368('0xcc')];hopperUtils[_0x0368('0xdb')](_0x23ccaf)[_0x0368('0x9c')](loggerCatch(_0x0368('0x120')));if(_0x6bc1f1[_0x0368('0x17f')](0x0,_0x5a6252,_0x56ebe9)&&!_0x285f46){if(_0x23ccaf['countnosuchnumberretry']>=_0x56ebe9[_0x0368('0x185')]){_0x6bc1f1['createStateFinal'](_0x23ccaf,_0xdf20eb,_0x2f7cb4,_0x0368('0x191'));}else{_0x6bc1f1[_0x0368('0x11a')](_0x23ccaf,_0xdf20eb,_0x2f7cb4,_0x0368('0x191'));}}break;case'3':_0x56ebe9[_0x0368('0x192')]+=0x1;_0x23ccaf[_0x0368('0x6a')]=0x3;_0x23ccaf[_0x0368('0x6b')]='NoAnswer';_0x23ccaf[_0x0368('0x116')]+=0x1;_0x23ccaf[_0x0368('0xcb')]+=0x1;var _0x2564ac=ut['buildNoAnswerEventPayload'](_0x5a6252,_0x56ebe9);ami[_0x0368('0x40')](_0x0368('0x193'),_0x2564ac);_0x5c7409=_0x56ebe9[_0x0368('0x194')];_0x5c79eb=_0x56ebe9[_0x0368('0xcc')];hopperUtils[_0x0368('0xdb')](_0x23ccaf)[_0x0368('0x9c')](loggerCatch(_0x0368('0x195')));if(_0x6bc1f1[_0x0368('0x17f')](0x3,_0x5a6252,_0x56ebe9)&&!_0x285f46){if(_0x23ccaf[_0x0368('0x116')]>=_0x56ebe9[_0x0368('0x196')]){_0x6bc1f1[_0x0368('0x197')](_0x23ccaf,_0xdf20eb,_0x2f7cb4,_0x0368('0x198'));}else{_0x6bc1f1['stateGlobal'](_0x23ccaf,_0xdf20eb,_0x2f7cb4,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x56ebe9['outboundBusyCallsDay']+=0x1;_0x23ccaf[_0x0368('0x6a')]=0x5;_0x23ccaf['statedesc']=_0x0368('0x199');_0x23ccaf['countbusyretry']+=0x1;_0x23ccaf[_0x0368('0xcb')]+=0x1;ami[_0x0368('0x40')](_0x0368('0x19a'),ut[_0x0368('0x10c')](_0x5a6252,_0x0368('0x19b')));_0x5c7409=_0x56ebe9[_0x0368('0x181')];_0x5c79eb=_0x56ebe9[_0x0368('0xcc')];hopperUtils['createHistory'](_0x23ccaf)[_0x0368('0x9c')](loggerCatch(_0x0368('0x19c')));if(_0x6bc1f1[_0x0368('0x17f')](0x5,_0x5a6252,_0x56ebe9)&&!_0x285f46){if(_0x23ccaf['countbusyretry']>=_0x56ebe9[_0x0368('0x180')]){_0x6bc1f1[_0x0368('0x197')](_0x23ccaf,_0xdf20eb,_0x2f7cb4,_0x0368('0x19d'));}else{_0x6bc1f1[_0x0368('0x11a')](_0x23ccaf,_0xdf20eb,_0x2f7cb4,_0x0368('0x19d'));}}break;case'8':_0x56ebe9[_0x0368('0x19e')]+=0x1;_0x23ccaf['state']=0x8;_0x23ccaf['statedesc']=_0x0368('0x19f');_0x23ccaf[_0x0368('0x121')]+=0x1;_0x23ccaf[_0x0368('0xcb')]+=0x1;_0x5c7409=_0x56ebe9[_0x0368('0x183')];_0x5c79eb=_0x56ebe9['callAdditionalPhoneAfterMin'];ami[_0x0368('0x40')]('custom:agentcongestion',ut[_0x0368('0x10c')](_0x5a6252,_0x0368('0x1a0')));hopperUtils['createHistory'](_0x23ccaf)[_0x0368('0x9c')](loggerCatch(_0x0368('0x1a1')));if(_0x6bc1f1[_0x0368('0x17f')](0x8,_0x5a6252,_0x56ebe9)&&!_0x285f46){if(_0x23ccaf[_0x0368('0x121')]>=_0x56ebe9['dialCongestionMaxRetry']){_0x6bc1f1[_0x0368('0x197')](_0x23ccaf,_0xdf20eb,_0x2f7cb4,_0x0368('0x1a2'));}else{_0x6bc1f1[_0x0368('0x11a')](_0x23ccaf,_0xdf20eb,_0x2f7cb4,'reason\x208\x20congestion');}}break;case'11':_0x56ebe9[_0x0368('0x1a3')]+=0x1;_0x23ccaf[_0x0368('0x6a')]=0xb;_0x23ccaf[_0x0368('0x6b')]='Abandoned';_0x23ccaf[_0x0368('0xe0')]+=0x1;_0x23ccaf['countglobal']+=0x1;_0x5c7409=_0x56ebe9[_0x0368('0xe1')];_0x5c79eb=_0x56ebe9['callAdditionalPhoneAfterMin'];hopperUtils[_0x0368('0xdb')](_0x23ccaf)[_0x0368('0x9c')](loggerCatch(_0x0368('0xe6')));if(_0x6bc1f1[_0x0368('0x17f')](0xb,_0x5a6252,_0x56ebe9)&&!_0x285f46){if(_0x23ccaf[_0x0368('0xe0')]>=_0x56ebe9[_0x0368('0xe2')]){_0x6bc1f1[_0x0368('0x197')](_0x23ccaf,_0xdf20eb,_0x2f7cb4,'reason\x2011\x20abandoned');}else{_0x6bc1f1[_0x0368('0x11a')](_0x23ccaf,_0xdf20eb,_0x2f7cb4,_0x0368('0x1a4'));}}break;case'20':_0x56ebe9[_0x0368('0x1a5')]+=0x1;_0x23ccaf[_0x0368('0x6a')]=0x14;_0x23ccaf[_0x0368('0x6b')]=_0x0368('0x1a6');_0x23ccaf[_0x0368('0x118')]+=0x1;_0x23ccaf['countglobal']+=0x1;_0x5c7409=_0x56ebe9[_0x0368('0x1a7')];_0x5c79eb=_0x56ebe9[_0x0368('0xcc')];ami['emit'](_0x0368('0x1a8'),ut[_0x0368('0x10c')](_0x5a6252,_0x0368('0x1a9')));hopperUtils[_0x0368('0xdb')](_0x23ccaf)[_0x0368('0x9c')](loggerCatch(_0x0368('0x1aa')));if(_0x6bc1f1[_0x0368('0x17f')](0x14,_0x5a6252,_0x56ebe9)&&!_0x285f46){if(_0x23ccaf[_0x0368('0x118')]>=_0x56ebe9[_0x0368('0x1ab')]){_0x6bc1f1[_0x0368('0x197')](_0x23ccaf,_0xdf20eb,_0x2f7cb4,_0x0368('0x1ac'));}else{_0x6bc1f1['stateGlobal'](_0x23ccaf,_0xdf20eb,_0x2f7cb4,_0x0368('0x1ac'));}}break;default:_0x56ebe9[_0x0368('0x1ad')]+=0x1;_0x23ccaf[_0x0368('0x6a')]=0xc;_0x23ccaf[_0x0368('0x6b')]=_0x37d694[_0x0368('0x18d')];_0x5c7409=_0x56ebe9[_0x0368('0x1a7')];_0x5c79eb=_0x56ebe9[_0x0368('0xcc')];hopperUtils[_0x0368('0xdb')](_0x23ccaf)[_0x0368('0x9c')](loggerCatch(_0x0368('0x1ae')));if(_0x6bc1f1[_0x0368('0x17f')](_0x37d694[_0x0368('0x18d')],_0x5a6252,_0x56ebe9)&&!_0x285f46){if(_0x23ccaf[_0x0368('0x115')]+_0x23ccaf[_0x0368('0x121')]+_0x23ccaf[_0x0368('0x116')]+_0x23ccaf[_0x0368('0x117')]+_0x23ccaf[_0x0368('0xca')]+_0x23ccaf['countabandonedretry']+_0x23ccaf['countmachineretry']+_0x23ccaf[_0x0368('0x118')]>=_0x56ebe9[_0x0368('0x119')]){_0x6bc1f1[_0x0368('0x11a')](_0x23ccaf,_0xdf20eb,_0x2f7cb4,_0x37d694[_0x0368('0x18d')]);}else{_0x6bc1f1[_0x0368('0x197')](_0x23ccaf,_0xdf20eb,_0x2f7cb4,_0x37d694[_0x0368('0x18d')]);}}}})[_0x0368('0x3d')](function(){if(_0x285f46){hopperUtils['swapAdditionalPhones'](_0x23ccaf,_0x5c7409,_0x5c79eb)['then'](function(){return _0xdf20eb(0x1);});}});});};Dialer[_0x0368('0x84')][_0x0368('0x11a')]=function(_0x13ac64,_0x32cda7,_0x384959,_0x46be75){var _0x59f699=new Final(_0x13ac64);_0x59f699[_0x0368('0x6a')]=0xf;_0x59f699['statedesc']=_0x0368('0x1af');this[_0x0368('0x197')](_0x59f699,_0x32cda7,_0x384959,_0x46be75);};Dialer[_0x0368('0x84')]['createStateFinal']=function(_0x2e20b8,_0x5d921d,_0x20e296,_0x50e52e){hopperUtils[_0x0368('0xc2')](_0x2e20b8)[_0x0368('0x3d')](function(){return _0x5d921d(msgResponse(_0x0368('0x18a'),_0x0368('0x100'),_0x50e52e));})['catch'](function(){return _0x20e296(msgResponse(_0x0368('0x1b0'),'Failure',_0x0368('0x1b1')));});};Dialer[_0x0368('0x84')][_0x0368('0xb')]=function(_0x4693ee){var _0x146521=_0x4693ee['dialPredictiveOptimizationPercentage']/0x64;var _0x2ee106=_0x4693ee[_0x0368('0x1b2')]/(_0x4693ee[_0x0368('0x1b2')]+_0x4693ee[_0x0368('0xbc')]);var _0x4168e9=Math[_0x0368('0x1b3')](_0x4693ee[_0x0368('0x1b4')]*(_0x4693ee[_0x0368('0x1b5')]/0x64));var _0x1353fc=Math[_0x0368('0x1b3')](_0x4693ee['predictiveIntervalAvailable']*(_0x4693ee['predictiveIntervalMinThreshold']/0x64));var _0x18af01=_0x4693ee[_0x0368('0x12d')]+_0x4693ee[_0x0368('0x12f')];var _0x261777=Math['floor'](_0x4693ee[_0x0368('0x1b6')]*_0x4693ee[_0x0368('0x5a')]*_0x4693ee[_0x0368('0x1b7')]*_0x4693ee[_0x0368('0x1b8')]);if(_[_0x0368('0x3f')](_0x4693ee[_0x0368('0x24')])){if(!_['isUndefined'](_0x4693ee[_0x0368('0x23')])){_0x4693ee[_0x0368('0x23')]=undefined;loggerPredictive[_0x0368('0x61')]('[startMethodPredictive][StartProgressive]',_0x0368('0x1b9'));}if(!_[_0x0368('0x3f')](_0x4693ee[_0x0368('0x5f')])){loggerPredictive['error'](_0x0368('0x1ba'),_0x0368('0x1bb'));clearInterval(_0x4693ee['handlePredictive']);_0x4693ee[_0x0368('0x5f')]=undefined;}_0x4693ee[_0x0368('0x24')]=moment()[_0x0368('0x46')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x0368('0x49')](_0x4693ee[_0x0368('0x47')],_0x0368('0x1bc'),_0x4693ee[_0x0368('0x24')]);this[_0x0368('0xad')](_0x4693ee,0x1);}else if(ifInterval(_0x4693ee[_0x0368('0x1bd')],_0x4693ee[_0x0368('0x24')])){this[_0x0368('0xad')](_0x4693ee,0x1);loggerPredictiveCalls[_0x0368('0x49')](_0x0368('0x1be'),_0x4693ee[_0x0368('0x24')],_0x4693ee['name']);_0x4693ee['erlangCalls']=0x0;_0x4693ee['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x146521<_0x2ee106&&_0x4693ee[_0x0368('0x1bf')]==='dropRate'){clearPredictiveAttributes(_0x4693ee);loggerPredictive[_0x0368('0x49')](_0x0368('0x1c0'),_0x0368('0x1c1'),_0x2ee106,_0x0368('0x24'),_0x4693ee['name']);}else if(_0x261777<_0x4693ee[_0x0368('0xc7')]&&_0x4693ee['dialPredictiveOptimization']===_0x0368('0x1c2')){clearPredictiveAttributes(_0x4693ee);loggerPredictive['info'](_0x0368('0x1c3'),_0x0368('0x1c4'),_0x261777,_0x0368('0x1c5'),_0x4693ee['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x4693ee[_0x0368('0x47')]);}else if(!ifInterval(_0x4693ee['dialPredictiveInterval'],_0x4693ee[_0x0368('0x24')])&&_[_0x0368('0x3f')](_0x4693ee['startPredictive'])&&!_[_0x0368('0x3f')](_0x4693ee[_0x0368('0x24')])){_0x4693ee[_0x0368('0x23')]=moment()[_0x0368('0x46')](_0x0368('0xc0'));loggerPredictive[_0x0368('0x49')](_0x4693ee[_0x0368('0x47')],'started\x20in\x20predictive\x20at',_0x4693ee[_0x0368('0x23')]);hopperUtils[_0x0368('0x1c6')](_0x4693ee[_0x0368('0x1bd')])[_0x0368('0x3d')](this['getDataPredictive'](_0x4693ee))['then'](mergeDataErlangB(_0x4693ee))[_0x0368('0x3d')](this[_0x0368('0x1c7')](_0x4693ee))['catch'](loggerCatchPredictive(_0x0368('0x1c8'),_0x4693ee));}else if(!ifInterval(_0x4693ee[_0x0368('0x1bd')],_0x4693ee[_0x0368('0x23')])){_0x4693ee[_0x0368('0xc7')]=0x0;_0x4693ee[_0x0368('0x23')]=moment()['format'](_0x0368('0xc0'));loggerPredictive[_0x0368('0x49')](_0x4693ee[_0x0368('0x47')],_0x0368('0x1c9'),_0x4693ee[_0x0368('0x23')]);clearInterval(_0x4693ee[_0x0368('0x5f')]);_0x4693ee[_0x0368('0x5f')]=undefined;hopperUtils['avgHandleTime'](_0x4693ee['dialPredictiveInterval'])['then'](this[_0x0368('0x1ca')](_0x4693ee))[_0x0368('0x3d')](mergeDataErlangB(_0x4693ee))[_0x0368('0x3d')](this[_0x0368('0x1c7')](_0x4693ee))['catch'](loggerCatchPredictive(_0x0368('0x1cb'),_0x4693ee));}else if(_0x4693ee['predictiveIntervalAvailable']&&_0x18af01<_0x4693ee[_0x0368('0x1b4')]-_0x1353fc){clearPredictiveAttributes(_0x4693ee);loggerPredictive[_0x0368('0x49')](_0x4693ee[_0x0368('0x47')],_0x0368('0x1cc'),_0x18af01,_0x0368('0x1cd'),_0x4693ee['predictiveIntervalAvailable'],'-',_0x1353fc,'=',_0x4693ee[_0x0368('0x1b4')]-_0x1353fc,')');}else if(_0x4693ee['predictiveIntervalAvailable']&&_0x18af01>_0x4693ee[_0x0368('0x1b4')]+_0x4168e9){clearPredictiveAttributes(_0x4693ee);loggerPredictive['info'](_0x4693ee[_0x0368('0x47')],_0x0368('0x1cc'),_0x18af01,_0x0368('0x1ce'),_0x4693ee['predictiveIntervalAvailable'],'+',_0x4168e9,'=',_0x4693ee['predictiveIntervalAvailable']+_0x4168e9,')');}};Dialer[_0x0368('0x84')][_0x0368('0x1ca')]=function(_0x486d17){var _0x18bd7f=this;return function(_0x383d27){return new Promise(function(_0x4f2b92,_0x40cc2f){_[_0x0368('0x5d')](_0x486d17,_0x383d27[0x0]);if(checkGetDataPredictive(_0x383d27[0x0])){var _0x4f0d70=_0x486d17[_0x0368('0x1b4')]=_0x486d17[_0x0368('0x12f')]+_0x486d17[_0x0368('0x12d')];var _0x1fa563=_0x486d17[_0x0368('0x1bd')]*0x3c;var _0x393e0c=_0x383d27[0x0][_0x0368('0x52')]+_0x383d27[0x0][_0x0368('0x54')];var _0x2dfaca=(_0x383d27[0x0][_0x0368('0x1cf')]+_0x383d27[0x0][_0x0368('0x4e')]+_0x383d27[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x383d27[0x0][_0x0368('0x4b')];_0x486d17[_0x0368('0x1b7')]=_0x2dfaca>0x0?_0x2dfaca:0x1;switch(_0x486d17[_0x0368('0x1bf')]){case _0x0368('0x1c2'):var _0x477182=_0x486d17[_0x0368('0x1d0')]/0x64;return _0x18bd7f['abandonmentRate'](_0x4f0d70,_0x1fa563,_0x393e0c,_0x2dfaca,_0x477182)[_0x0368('0x3d')](function(_0x5af98b){return _0x4f2b92(_0x5af98b);});case _0x0368('0x1d1'):var _0x1d8e84=_0x486d17[_0x0368('0x1d0')]/0x64;return _0x18bd7f[_0x0368('0x1d2')](_0x4f0d70,_0x1fa563,_0x393e0c,_0x2dfaca,_0x1d8e84)[_0x0368('0x3d')](function(_0x2ec4c9){return _0x4f2b92(_0x2ec4c9);});default:return _0x40cc2f(msgResponse(_0x0368('0x1d3'),'Failure',_0x0368('0x1d4')));}}else{return _0x40cc2f(msgResponse('[getDataPredictive]',_0x0368('0x8c'),_0x0368('0x1d5')));}});};};Dialer[_0x0368('0x84')][_0x0368('0x1d6')]=function(_0x7aa4b7){var _0x4715b1=this;return function(_0x345545){return new Promise(function(_0x8bb643,_0x98129f){_[_0x0368('0x5d')](_0x7aa4b7,_0x345545[0x0]);if(checkGetDataPredictive(_0x345545[0x0])){loggerPredictive[_0x0368('0x49')](JSON[_0x0368('0x6f')](_0x345545[0x0]));if(_0x7aa4b7[_0x0368('0x1bf')]==='dropRate'){return _0x4715b1['getVoiceQueueRtPauses'](_0x7aa4b7['id'])[_0x0368('0x3d')](function(_0x51ffb6){var _0x136274=_0x7aa4b7['loggedIn']-_0x51ffb6[0x0][_0x0368('0x1d7')];var _0x45ca99=_0x7aa4b7[_0x0368('0x1bd')]*0x3c;var _0x570310=_0x345545[0x0][_0x0368('0x52')]+_0x345545[0x0][_0x0368('0x54')];var _0x54f9b9=(_0x345545[0x0][_0x0368('0x1cf')]+_0x345545[0x0][_0x0368('0x4e')]+_0x345545[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x345545[0x0][_0x0368('0x4b')];var _0x20a6f=_0x7aa4b7['dialPredictiveOptimizationPercentage']/0x64;_0x7aa4b7[_0x0368('0x1d8')]=_0x51ffb6[0x0][_0x0368('0x1d7')]||0x0;_0x7aa4b7['predictiveIntervalHitRate']=_0x54f9b9>0x0?_0x54f9b9:0x1;return _0x4715b1['abandonmentRate'](_0x136274,_0x45ca99,_0x570310,_0x54f9b9,_0x20a6f);})['then'](function(_0x413e40){return _0x8bb643(_0x413e40);})[_0x0368('0x9c')](function(_0x131bbb){return _0x98129f(msgResponse(_0x0368('0x1d9'),_0x0368('0x8c'),JSON['stringify'](_0x131bbb)));});}if(_0x7aa4b7[_0x0368('0x1bf')]==='agentBusyFactor'){return _0x4715b1['getVoiceQueueRtPauses'](_0x7aa4b7['id'])[_0x0368('0x3d')](function(_0x253bb2){var _0x341ae4=_0x7aa4b7[_0x0368('0x1da')]-_0x253bb2[0x0][_0x0368('0x1d7')];var _0x54ad7e=_0x7aa4b7[_0x0368('0x1bd')]*0x3c;var _0x50d9c6=_0x345545[0x0][_0x0368('0x52')]+_0x345545[0x0][_0x0368('0x54')];var _0x37087d=(_0x345545[0x0][_0x0368('0x1cf')]+_0x345545[0x0][_0x0368('0x4e')]+_0x345545[0x0][_0x0368('0x50')])/_0x345545[0x0][_0x0368('0x4b')];var _0x160cb7=_0x7aa4b7[_0x0368('0x1d0')]/0x64;_0x7aa4b7[_0x0368('0x1d8')]=_0x253bb2[0x0][_0x0368('0x1d7')]||0x0;_0x7aa4b7[_0x0368('0x1b7')]=_0x37087d>0x0?_0x37087d:0x1;return _0x4715b1[_0x0368('0x1d2')](_0x341ae4,_0x54ad7e,_0x50d9c6,_0x37087d,_0x160cb7);})['then'](function(_0x2ca694){return _0x8bb643(_0x2ca694);})[_0x0368('0x9c')](function(_0x3da2d0){return _0x98129f(msgResponse(_0x0368('0x1d9'),_0x0368('0x8c'),JSON[_0x0368('0x6f')](_0x3da2d0)));});}}else{return _0x98129f(msgResponse(_0x0368('0x1d3'),_0x0368('0x8c'),_0x0368('0x1d5')));}});};};Dialer[_0x0368('0x84')][_0x0368('0x1c7')]=function(_0x24ef7a){var _0x501810=this;return function(){var _0x4c6b88=0x0;var _0x55be5a=Math[_0x0368('0x1db')](_0x24ef7a[_0x0368('0x1dc')]*0x3e8);if(_0x55be5a>0x0){_0x55be5a=_0x55be5a<0x64?0x64:_0x55be5a;loggerPredictive[_0x0368('0x49')](_0x24ef7a[_0x0368('0x47')],_0x0368('0x1dd'),_0x55be5a,_0x0368('0x1de'));_0x24ef7a[_0x0368('0x5f')]=setInterval(function(){_0x501810[_0x0368('0x5f')](_0x24ef7a);loggerPredictiveCalls['info']('[handlePredictive]',_0x4c6b88+=0x1);},_0x55be5a);}else{loggerPredictive[_0x0368('0x49')](_0x24ef7a[_0x0368('0x47')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x0368('0x84')][_0x0368('0x1df')]=function(_0x1548fd,_0x262450){var _0x2da68c=this;return function(_0x730775){if(_[_0x0368('0x76')](_0x730775)){if(_[_0x0368('0xee')](_0x262450['UserId'])||!_0x262450[_0x0368('0x1e0')]){if(_0x1548fd[_0x0368('0xab')]==='booked'){_0x1548fd['queueStatusComplete']=_['isUndefined'](_0x1548fd[_0x0368('0x71')])?!![]:_0x1548fd[_0x0368('0x71')];var _0x33f1f9=uuid['v4']();_0x2da68c[_0x0368('0xe8')][_0x33f1f9]=new Action(_0x1548fd,_0x262450,_0x33f1f9);loggerBooked['info'](_0x0368('0x1e1'),_0x33f1f9,'queueStatusComplete:\x20',JSON['stringify'](_0x1548fd[_0x0368('0x71')]),_0x0368('0x1e2'),_0x1548fd[_0x0368('0x47')]);if(_0x1548fd[_0x0368('0x71')]){_0x1548fd[_0x0368('0x71')]=![];_0x2da68c[_0x0368('0x26')][_0x2da68c[_0x0368('0xe8')][_0x33f1f9][_0x0368('0xbb')]]=[];ami[_0x0368('0x94')]({'actionid':_0x33f1f9,'action':_0x0368('0x1e3'),'queue':_0x1548fd[_0x0368('0x47')]})['catch'](function(){_0x2da68c[_0x0368('0xba')](_0x1548fd);hopperUtils[_0x0368('0xd2')]({'active':![],'ContactId':_0x2da68c['actions'][_0x33f1f9][_0x0368('0xd5')],'ListId':_0x2da68c[_0x0368('0xe8')][_0x33f1f9][_0x0368('0xd6')],'VoiceQueueId':_0x2da68c[_0x0368('0xe8')][_0x33f1f9][_0x0368('0xf4')]||undefined,'CampaignId':_0x2da68c['actions'][_0x33f1f9][_0x0368('0xe4')]||undefined})[_0x0368('0x9c')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x2da68c[_0x0368('0xe8')][_0x33f1f9];});}else{loggerBooked['info'](_0x0368('0x1e4'),JSON['stringify'](_0x1548fd['queueStatusComplete']),'Queue:\x20',_0x1548fd[_0x0368('0x47')]);_0x2da68c[_0x0368('0xba')](_0x1548fd);hopperUtils[_0x0368('0xd2')]({'active':![],'ContactId':_0x2da68c[_0x0368('0xe8')][_0x33f1f9]['ContactId'],'ListId':_0x2da68c[_0x0368('0xe8')][_0x33f1f9][_0x0368('0xd6')],'VoiceQueueId':_0x2da68c[_0x0368('0xe8')][_0x33f1f9]['VoiceQueueId']||undefined,'CampaignId':_0x2da68c['actions'][_0x33f1f9][_0x0368('0xe4')]||undefined})[_0x0368('0x9c')](loggerCatch(_0x0368('0x1e5')));delete _0x2da68c['actions'][_0x33f1f9];}}else{return _0x2da68c[_0x0368('0x1e6')](_0x1548fd,_0x262450);}}else{if(utils['getSeconds'](undefined,_0x262450[_0x0368('0x1e7')])<_0x1548fd['dialRecallMeTimeout']*0x3c){if(_0x262450[_0x0368('0x13d')]&&!_0x262450[_0x0368('0x13d')][_0x0368('0x1e8')]){_0x2da68c[_0x0368('0x1a')][_0x0368('0x1e9')](_0x262450['id'])[_0x0368('0x19')](function(){_0x2da68c[_0x0368('0xba')](_0x1548fd);});}else{hopperUtils[_0x0368('0x1ea')]({'active':![]},_0x262450['id'],0x1)['finally'](function(){_0x2da68c[_0x0368('0xba')](_0x1548fd);});}}else{_0x1548fd[_0x0368('0x1eb')]+=0x1;_0x2da68c['updateOriginated'](_0x1548fd);if(_0x1548fd[_0x0368('0x1ec')]){hopperUtils[_0x0368('0xd2')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x262450[_0x0368('0xd5')],'ListId':_0x262450[_0x0368('0xd6')],'VoiceQueueId':_0x262450['VoiceQueueId']||undefined,'CampaignId':_0x262450['CampaignId']||undefined})[_0x0368('0x9c')](loggerCatch(_0x0368('0x1ed')));hopperUtils[_0x0368('0xdb')](createObjHistory(_0x1548fd,_0x262450,utils['CAMPAIGN_STATUS'][_0x0368('0x1ee')],0x17,'RecallInQueue'))['catch'](loggerCatch(_0x0368('0x1ef')));}else{_0x2da68c[_0x0368('0x10d')](createObjHistory(_0x1548fd,_0x262450,utils[_0x0368('0x68')][_0x0368('0x1f0')],0x16,'RecallFailedTimeout'),_0x0368('0x1f1'),'[Originate][HistoryRecallClose]');}}}}else{_0x1548fd[_0x0368('0x1f2')]+=0x1;_0x2da68c['saveInDb'](createObjHistory(_0x1548fd,_0x262450,utils[_0x0368('0x68')][_0x0368('0x1f3')],0xd,_0x0368('0x1f4')),_0x0368('0x1f5'),_0x0368('0x1f6'));throw _0x0368('0x1f7');}};};Dialer[_0x0368('0x84')][_0x0368('0x1f8')]=function(_0x32d6aa){var _0x28e6ec=this;var _0x49b5cd=_0x32d6aa[_0x0368('0x1f9')]-_0x32d6aa['originated'];emitCampaignSummary(_0x32d6aa);if(_0x49b5cd>0x0&&_0x32d6aa[_0x0368('0x1fa')]==0x0){if(_0x49b5cd>this[_0x0368('0x1f')]){_0x49b5cd=this[_0x0368('0x1f')];}_0x32d6aa[_0x0368('0x1fa')]=0x1;hopperUtils['getContactDialerIvr'](_0x32d6aa,_0x49b5cd)[_0x0368('0x3d')](function(_0x106079){_0x32d6aa[_0x0368('0x1fa')]=0x0;if(_0x106079){if(!utils[_0x0368('0x1fb')](_0x106079)){_0x32d6aa[_0x0368('0x64')]=utils['CAMPAIGN_STATUS'][_0x0368('0x1fc')];logger[_0x0368('0x49')]('[getContactCampaign2][Empty]'+_0x32d6aa[_0x0368('0x47')]);}else{_0x32d6aa[_0x0368('0x145')]+=_0x106079[_0x0368('0x92')];_0x32d6aa[_0x0368('0x64')]=utils['CAMPAIGN_STATUS'][_0x0368('0x1fd')];for(var _0x3d7ef8=0x0;_0x3d7ef8<_0x106079['length'];_0x3d7ef8+=0x1){_0x32d6aa[_0x0368('0x1fe')]+=0x1;if(_[_0x0368('0xee')](_0x106079[_0x3d7ef8])||_[_0x0368('0xee')](_0x106079[_0x3d7ef8][_0x0368('0x16b')])||_[_0x0368('0xee')](_0x106079[_0x3d7ef8][_0x0368('0x152')])){_0x28e6ec[_0x0368('0x149')](_0x0368('0x1ff'),_0x32d6aa,_0x106079[_0x3d7ef8]);}else{hopperUtils[_0x0368('0x200')](_[_0x0368('0x70')](_0x106079[_0x3d7ef8],['CampaignId',_0x0368('0x152')]))[_0x0368('0x3d')](_0x28e6ec[_0x0368('0x1df')](_0x32d6aa,_0x106079[_0x3d7ef8]))['catch'](_0x28e6ec[_0x0368('0x148')](_0x0368('0x201'),_0x32d6aa));}}}}})[_0x0368('0x9c')](loggerGetContactDialer('[getContactCampaign2]',_0x32d6aa,_0x49b5cd));}};Dialer[_0x0368('0x84')][_0x0368('0xad')]=function(_0x532677,_0x16a32c){var _0x11b1ba=this;var _0xc3855e=[];if(_0x16a32c<0x1||_0x532677[_0x0368('0xab')]===_0x0368('0xa')){_0x16a32c=0x1;}var _0x3f81e4=Math[_0x0368('0x1db')](_0x532677[_0x0368('0x12d')]*_0x16a32c)-_0x532677[_0x0368('0x145')];if(_0x532677[_0x0368('0x202')]>0x0){var _0x5405ff=_0x532677['dialLimitQueue']-_0x532677[_0x0368('0x145')]-_0x532677[_0x0368('0x12f')]-_0x532677[_0x0368('0x130')];if(_0x3f81e4>_0x5405ff){_0x3f81e4=_0x5405ff;}}if(_0x3f81e4>0x0&&_0x532677[_0x0368('0x1fa')]==0x0){if(_0x532677['dialMethod']===_0x0368('0xa')){_0x3f81e4=0x1;}if(_0x3f81e4>this['maxNumberOriginate']){_0x3f81e4=this['maxNumberOriginate'];}for(var _0x554e28 in this['agents']){if(typeof this[_0x0368('0x1d')][_0x554e28]!==_0x0368('0xa5')){if(this[_0x0368('0x1d')][_0x554e28]['state']===_0x0368('0x203')&&this['agents'][_0x554e28][_0x0368('0x82')]===_0x0368('0x81')){_0xc3855e[_0x0368('0x93')](this[_0x0368('0x1d')][_0x554e28]['id']);}}}_0x532677[_0x0368('0x1fa')]=0x1;hopperUtils[_0x0368('0x204')](_0x532677,_0xc3855e,_0x3f81e4)[_0x0368('0x3d')](function(_0x4620aa){_0x532677[_0x0368('0x1fa')]=0x0;if(_0x4620aa){if(!utils['checkContactEmpty'](_0x4620aa)){hopperUtils['countReScheduled'](_0x532677)[_0x0368('0x3d')](sendMessageReschedule(_0x532677))[_0x0368('0x9c')](loggerCatch(_0x0368('0x205')));}else{_0x532677[_0x0368('0x145')]+=_0x4620aa[_0x0368('0x92')];_0x532677[_0x0368('0x64')]=_0x532677[_0x0368('0xab')]===_0x0368('0xa')?utils[_0x0368('0x68')]['ACTIVE']:utils[_0x0368('0x68')]['RUNNING'];for(var _0x57a2c8=0x0;_0x57a2c8<_0x4620aa['length'];_0x57a2c8+=0x1){if(_[_0x0368('0xee')](_0x4620aa[_0x57a2c8])||_[_0x0368('0xee')](_0x4620aa[_0x57a2c8][_0x0368('0x16b')])||_[_0x0368('0xee')](_0x4620aa[_0x57a2c8][_0x0368('0x152')])){_0x11b1ba[_0x0368('0x149')]('[actionOriginate]\x20',_0x532677,_0x4620aa[_0x57a2c8]);}else{hopperUtils[_0x0368('0x206')](_[_0x0368('0x70')](_0x4620aa[_0x57a2c8],['VoiceQueueId','phone']))['then'](_0x11b1ba['checkContactBlack'](_0x532677,_0x4620aa[_0x57a2c8]))['catch'](_0x11b1ba[_0x0368('0x148')]('[actionOriginate]\x20',_0x532677));}}}}})[_0x0368('0x9c')](loggerGetContactDialer(_0x0368('0x207'),_0x532677,_0x3f81e4));}};Dialer[_0x0368('0x84')][_0x0368('0x5f')]=function(_0x3db8bc){if(_0x3db8bc['dialLimitQueue']>0x0){var _0x2eac4f=_0x3db8bc['dialLimitQueue']-_0x3db8bc[_0x0368('0x145')]-_0x3db8bc[_0x0368('0x12f')];if(_0x2eac4f>0x0&&_0x3db8bc[_0x0368('0x1fa')]==0x0){this[_0x0368('0x208')](_0x3db8bc);}else{loggerPredictiveCalls['info'](_0x0368('0x209'));}}else{this[_0x0368('0x208')](_0x3db8bc);}};Dialer[_0x0368('0x84')][_0x0368('0x208')]=function(_0x5f29f1){var _0x207345=this;var _0xc66f98=[];_0x5f29f1['originated']+=0x1;for(var _0x1aa330 in this[_0x0368('0x1d')]){if(typeof this[_0x0368('0x1d')][_0x1aa330]!==_0x0368('0xa5')){if(this[_0x0368('0x1d')][_0x1aa330]['state']==='not_inuse'&&this[_0x0368('0x1d')][_0x1aa330][_0x0368('0x82')]==='reachable'){_0xc66f98[_0x0368('0x93')](this[_0x0368('0x1d')][_0x1aa330]['id']);}}}_0x5f29f1['temp']=0x1;return this[_0x0368('0x204')](_0x5f29f1['id'],_0xc66f98,0x1,_0x5f29f1['dialOrderByScheduledAt'],_0x5f29f1)[_0x0368('0x3d')](function(_0x4139eb){_0x5f29f1[_0x0368('0x1fa')]=0x1;if(_0x4139eb){if(!utils['checkContactEmpty'](_0x4139eb)){utils[_0x0368('0x20a')](_0x5f29f1,0x1,0x0);return hopperUtils[_0x0368('0x20b')](_0x5f29f1)[_0x0368('0x3d')](sendMessageReschedule(_0x5f29f1))[_0x0368('0x9c')](loggerCatch(_0x0368('0x205')));}else{_0x5f29f1[_0x0368('0x64')]=utils[_0x0368('0x68')][_0x0368('0x1fd')];if(_['isNil'](_0x4139eb[0x0])||_[_0x0368('0xee')](_0x4139eb[0x0][_0x0368('0x16b')])||_[_0x0368('0xee')](_0x4139eb[0x0][_0x0368('0x152')])){_0x207345[_0x0368('0x149')]('[actionOriginate]\x20',_0x5f29f1,_0x4139eb[0x0]);}else{return hopperUtils[_0x0368('0x206')](_['pick'](_0x4139eb[0x0],[_0x0368('0xf4'),_0x0368('0x152')]))[_0x0368('0x3d')](_0x207345['checkContactBlack'](_0x5f29f1,_0x4139eb[0x0]))['catch'](_0x207345[_0x0368('0x148')](_0x0368('0x20c'),_0x5f29f1));}}}})['catch'](loggerGetContactDialer(_0x0368('0x20d'),_0x5f29f1,0x1));};Dialer['prototype'][_0x0368('0x20e')]=function(_0x3fdbe3,_0x4d1786,_0x3de1d5,_0x2ca59c,_0x22921a,_0x13e7cc){loggerPredictive[_0x0368('0x49')](_0x0368('0x20f'));loggerPredictive[_0x0368('0x49')](_0x0368('0x210'),_0x3fdbe3);loggerPredictive[_0x0368('0x49')](_0x0368('0x211'),_0x4d1786);loggerPredictive[_0x0368('0x49')](_0x0368('0x212'),_0x3de1d5);loggerPredictive[_0x0368('0x49')](_0x0368('0x213'),_0x2ca59c);loggerPredictive[_0x0368('0x49')](_0x0368('0x214'),_0x22921a);loggerPredictive[_0x0368('0x49')](_0x0368('0x53'));return new Promise(function(_0x466c6b,_0x505a23){if(_0x3fdbe3<=0x0||isNaN(_0x3fdbe3)){return _0x505a23(msgResponse(_0x0368('0x215'),_0x0368('0xb6'),'m\x20=\x20'+_0x3fdbe3));}if(_0x3de1d5<=0x0||isNaN(_0x3de1d5)){return _0x505a23(msgResponse(_0x0368('0x215'),_0x0368('0xb6'),_0x0368('0x216')+_0x3de1d5));}if(_0x2ca59c<=0x0||isNaN(_0x2ca59c)){return _0x505a23(msgResponse(_0x0368('0x215'),_0x0368('0xb6'),_0x0368('0x217')+_0x2ca59c));}if(_0x4d1786<=0x0||isNaN(_0x4d1786)){return _0x505a23(msgResponse('[abandonmentRate]',_0x0368('0xb6'),_0x0368('0x218')+_0x4d1786));}if(_0x22921a<=0x0||isNaN(_0x22921a)){return _0x505a23(msgResponse(_0x0368('0x215'),_0x0368('0xb6'),_0x0368('0x219')+_0x22921a));}_0x13e7cc=_0x13e7cc||0x0;var _0x170b46=0x1/_0x3de1d5;var _0xc60fec=0x0;var _0x52bb4c=0x0;var _0x4fa9eb=0x0;var _0x1a9fd5=0x0;for(var _0x1c011e=0x0;_0x4fa9eb<_0x22921a;_0x1c011e+=0x1){_0x52bb4c=_0x1c011e/_0x4d1786;_0xc60fec=(_0x2ca59c*_0x52bb4c+_0x13e7cc)/_0x170b46;_0x4fa9eb=utils[_0x0368('0x21a')](_0xc60fec,_0x3fdbe3);_0x1a9fd5=_0xc60fec/_0x3fdbe3*(0x1-utils[_0x0368('0x21a')](_0xc60fec,_0x3fdbe3));}return _0x466c6b({'erlangCalls':_0x1c011e,'erlangCallToSecond':_0x4d1786/_0x1c011e,'erlangAbandonmentRate':_0x4fa9eb,'erlangBusyFactor':_0x1a9fd5});});};Dialer[_0x0368('0x84')][_0x0368('0x1d2')]=function(_0x382411,_0x2beedc,_0x248440,_0x58c096,_0x4bfce8,_0x5a4d39){loggerPredictive['info'](_0x0368('0x21b'));loggerPredictive['info'](_0x0368('0x210'),_0x382411);loggerPredictive[_0x0368('0x49')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2beedc);loggerPredictive[_0x0368('0x49')]('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',_0x248440);loggerPredictive[_0x0368('0x49')](_0x0368('0x213'),_0x58c096);loggerPredictive[_0x0368('0x49')](_0x0368('0x21c'),_0x4bfce8);loggerPredictive[_0x0368('0x49')](_0x0368('0x53'));return new Promise(function(_0x24a36e,_0x13f6b8){if(_0x382411<=0x0||isNaN(_0x382411)){return _0x13f6b8(msgResponse(_0x0368('0x21d'),_0x0368('0xb6'),'m\x20=\x20'+_0x382411));}if(_0x248440<=0x0||isNaN(_0x248440)){return _0x13f6b8(msgResponse(_0x0368('0x21d'),_0x0368('0xb6'),_0x0368('0x216')+_0x248440));}if(_0x58c096<=0x0||isNaN(_0x58c096)){return _0x13f6b8(msgResponse(_0x0368('0x21d'),'Error',_0x0368('0x217')+_0x58c096));}if(_0x2beedc<=0x0||isNaN(_0x2beedc)){return _0x13f6b8(msgResponse('[busyFactor]','Error',_0x0368('0x218')+_0x2beedc));}if(_0x4bfce8<=0x0||isNaN(_0x4bfce8)){return _0x13f6b8(msgResponse(_0x0368('0x21d'),_0x0368('0xb6'),_0x0368('0x21e')+_0x4bfce8));}_0x5a4d39=_0x5a4d39||0x0;var _0x527973=0x1/_0x248440;var _0x507a40=0x0;var _0x2800a2=0x0;var _0x463422=0x0;var _0x3501c7=0x0;for(var _0x5e383b=0x0;_0x3501c7<_0x4bfce8;_0x5e383b+=0x1){_0x2800a2=_0x5e383b/_0x2beedc;_0x507a40=(_0x58c096*_0x2800a2+_0x5a4d39)/_0x527973;_0x463422=utils[_0x0368('0x21a')](_0x507a40,_0x382411);_0x3501c7=_0x507a40/_0x382411*(0x1-utils[_0x0368('0x21a')](_0x507a40,_0x382411));}return _0x24a36e({'erlangCalls':_0x5e383b,'erlangCallToSecond':_0x2beedc/_0x5e383b,'erlangAbandonmentRate':_0x463422,'erlangBusyFactor':_0x3501c7});});};module[_0x0368('0x21f')]=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 8cac14c..508f43f 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 _0x28f8=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','prototype','getQueue','exports','util','lodash','moment','isNil','string','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x16e1ab,_0x2aa823){var _0x2d311e=function(_0x3f08bb){while(--_0x3f08bb){_0x16e1ab['push'](_0x16e1ab['shift']());}};_0x2d311e(++_0x2aa823);}(_0x28f8,0xa7));var _0x828f=function(_0x387dc1,_0x3ba649){_0x387dc1=_0x387dc1-0x0;var _0x17567c=_0x28f8[_0x387dc1];return _0x17567c;};'use strict';var util=require(_0x828f('0x0'));var _=require(_0x828f('0x1'));var moment=require(_0x828f('0x2'));function checkNameSurname(_0x54507d,_0x1aaca5,_0x4cb03a){var _0x4dff72='';if(!_[_0x828f('0x3')](_0x1aaca5)&&_0x828f('0x4')===typeof _0x1aaca5){_0x4dff72+=_0x1aaca5;}if(!_[_0x828f('0x3')](_0x4cb03a)&&_0x828f('0x4')===typeof _0x4cb03a){_0x4dff72+='\x20'+_0x4cb03a;}if(_0x4dff72!==''){return _0x4dff72;}return _0x54507d;}function Action(_0x580c92,_0x2222b4,_0x242fd6){this['voiceQueue']=_0x580c92;this[_0x828f('0x5')]=_0x242fd6||undefined;this[_0x828f('0x6')]=checkNameSurname(_0x2222b4[_0x828f('0x7')][_0x828f('0x8')],_0x2222b4[_0x828f('0x7')][_0x828f('0x9')],_0x2222b4[_0x828f('0x7')][_0x828f('0xa')]);this[_0x828f('0xb')]=_0x2222b4['phone'];this[_0x828f('0xc')]=_0x580c92[_0x828f('0x6')];this['active']=_0x2222b4[_0x828f('0xd')]||![];this[_0x828f('0xe')]=_0x580c92[_0x828f('0xe')];this[_0x828f('0xf')]=_0x580c92[_0x828f('0xf')]||0x3;this[_0x828f('0x10')]=_0x2222b4[_0x828f('0x10')];this['countbusyretry']=_0x2222b4[_0x828f('0x11')];this[_0x828f('0x12')]=_0x2222b4['countcongestionretry'];this[_0x828f('0x13')]=_0x2222b4[_0x828f('0x13')];this[_0x828f('0x14')]=_0x2222b4['countnosuchnumberretry'];this['countdropretry']=_0x2222b4[_0x828f('0x15')];this[_0x828f('0x16')]=_0x2222b4[_0x828f('0x16')];this[_0x828f('0x17')]=_0x2222b4[_0x828f('0x17')];this[_0x828f('0x18')]=_0x2222b4[_0x828f('0x18')];this[_0x828f('0x19')]=_0x2222b4['ContactId'];this[_0x828f('0x1a')]=_0x2222b4['ListId'];this[_0x828f('0x1b')]=_0x2222b4[_0x828f('0x1b')];this['VoiceQueueId']=_0x2222b4[_0x828f('0x1c')];this[_0x828f('0x1d')]=_0x2222b4['CampaignId'];this[_0x828f('0x1e')]=_0x2222b4['id'];this[_0x828f('0x1f')]=_0x2222b4[_0x828f('0x7')][_0x828f('0x9')]||'';this[_0x828f('0x20')]=moment()[_0x828f('0x21')](_0x828f('0x22'));this['callback']=_0x2222b4[_0x828f('0x23')];this[_0x828f('0x24')]=_0x2222b4[_0x828f('0x24')];this['callbackat']=_0x2222b4[_0x828f('0x25')];this[_0x828f('0x26')]=_0x2222b4[_0x828f('0x26')];this[_0x828f('0x27')]='';this['originatecalleridname']='';}Action['prototype'][_0x828f('0x28')]=function(){return util['format'](_0x828f('0x29'),this[_0x828f('0x6')],this[_0x828f('0x2a')][_0x828f('0x2b')]>0x0?this['number']['substring'](this['voiceQueue'][_0x828f('0x2b')]):this['number']);};Action[_0x828f('0x2c')][_0x828f('0x2d')]=function(){return this[_0x828f('0xc')];};module[_0x828f('0x2e')]=Action; \ No newline at end of file +var _0xb288=['number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','getCaller','dialCutDigit','substring','prototype','getQueue','exports','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xb288,0xa5));var _0x8b28=function(_0x1cb10f,_0xa8d671){_0x1cb10f=_0x1cb10f-0x0;var _0x48ae7c=_0xb288[_0x1cb10f];return _0x48ae7c;};'use strict';var util=require('util');var _=require(_0x8b28('0x0'));var moment=require(_0x8b28('0x1'));function checkNameSurname(_0x1aab2f,_0xa978c0,_0x47e6e6){var _0x3da5df='';if(!_[_0x8b28('0x2')](_0xa978c0)&&_0x8b28('0x3')===typeof _0xa978c0){_0x3da5df+=_0xa978c0;}if(!_[_0x8b28('0x2')](_0x47e6e6)&&_0x8b28('0x3')===typeof _0x47e6e6){_0x3da5df+='\x20'+_0x47e6e6;}if(_0x3da5df!==''){return _0x3da5df;}return _0x1aab2f;}function Action(_0x3c9f58,_0x397273,_0x7736db){this[_0x8b28('0x4')]=_0x3c9f58;this[_0x8b28('0x5')]=_0x7736db||undefined;this[_0x8b28('0x6')]=checkNameSurname(_0x397273[_0x8b28('0x7')][_0x8b28('0x8')],_0x397273[_0x8b28('0x7')][_0x8b28('0x9')],_0x397273['Contact'][_0x8b28('0xa')]);this[_0x8b28('0xb')]=_0x397273['phone'];this[_0x8b28('0xc')]=_0x3c9f58[_0x8b28('0x6')];this[_0x8b28('0xd')]=_0x397273[_0x8b28('0xd')]||![];this['type']=_0x3c9f58[_0x8b28('0xe')];this[_0x8b28('0xf')]=_0x3c9f58['dialQueueTimeout']||0x3;this['scheduledat']=_0x397273[_0x8b28('0x10')];this[_0x8b28('0x11')]=_0x397273[_0x8b28('0x11')];this[_0x8b28('0x12')]=_0x397273[_0x8b28('0x12')];this[_0x8b28('0x13')]=_0x397273[_0x8b28('0x13')];this[_0x8b28('0x14')]=_0x397273[_0x8b28('0x14')];this['countdropretry']=_0x397273[_0x8b28('0x15')];this[_0x8b28('0x16')]=_0x397273[_0x8b28('0x16')];this[_0x8b28('0x17')]=_0x397273[_0x8b28('0x17')];this[_0x8b28('0x18')]=_0x397273['countagentrejectretry'];this['ContactId']=_0x397273['ContactId'];this[_0x8b28('0x19')]=_0x397273[_0x8b28('0x19')];this[_0x8b28('0x1a')]=_0x397273[_0x8b28('0x1a')];this[_0x8b28('0x1b')]=_0x397273[_0x8b28('0x1b')];this[_0x8b28('0x1c')]=_0x397273[_0x8b28('0x1c')];this[_0x8b28('0x1d')]=_0x397273['id'];this['ContactFirstName']=_0x397273[_0x8b28('0x7')][_0x8b28('0x9')]||'';this[_0x8b28('0x1e')]=moment()[_0x8b28('0x1f')](_0x8b28('0x20'));this[_0x8b28('0x21')]=_0x397273[_0x8b28('0x21')];this[_0x8b28('0x22')]=_0x397273['callbackuniqueid'];this[_0x8b28('0x23')]=_0x397273['callbackat'];this[_0x8b28('0x24')]=_0x397273[_0x8b28('0x24')];this[_0x8b28('0x25')]='';this['originatecalleridname']='';}Action['prototype'][_0x8b28('0x26')]=function(){return util[_0x8b28('0x1f')]('\x22%s\x22\x20<%s>',this[_0x8b28('0x6')],this['voiceQueue'][_0x8b28('0x27')]>0x0?this[_0x8b28('0xb')][_0x8b28('0x28')](this[_0x8b28('0x4')][_0x8b28('0x27')]):this[_0x8b28('0xb')]);};Action[_0x8b28('0x29')][_0x8b28('0x2a')]=function(){return this[_0x8b28('0xc')];};module[_0x8b28('0x2b')]=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 6fbac37..5fd9dac 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 _0x4246=['scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','ringtime','getSeconds','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','Answer'];(function(_0x58128a,_0x8ab991){var _0x56f353=function(_0x925531){while(--_0x925531){_0x58128a['push'](_0x58128a['shift']());}};_0x56f353(++_0x8ab991);}(_0x4246,0xd4));var _0x6424=function(_0x2f80e7,_0x349c8d){_0x2f80e7=_0x2f80e7-0x0;var _0x5a7fa2=_0x4246[_0x2f80e7];return _0x5a7fa2;};'use strict';var moment=require(_0x6424('0x0'));var utils=require(_0x6424('0x1'));function AgentComplete(_0x46ed1c,_0x1660e2){this['state']=0x4;this['statedesc']=_0x6424('0x2');this[_0x6424('0x3')]=_0x46ed1c[_0x6424('0x3')];this[_0x6424('0x4')]=_0x46ed1c[_0x6424('0x4')];this['campaigntype']=_0x46ed1c[_0x6424('0x4')]===_0x6424('0x5')?_0x6424('0x6'):_0x46ed1c[_0x6424('0x4')];this[_0x6424('0x7')]=_0x46ed1c[_0x6424('0x7')];this[_0x6424('0x8')]=_0x46ed1c[_0x6424('0x8')];this[_0x6424('0x9')]=_0x46ed1c[_0x6424('0x9')];this['countglobal']=_0x46ed1c['countbusyretry']+_0x46ed1c[_0x6424('0x8')]+_0x46ed1c['countnoanswerretry']+_0x46ed1c[_0x6424('0xa')]+_0x46ed1c[_0x6424('0xb')]+_0x46ed1c['countabandonedretry']+_0x46ed1c[_0x6424('0xc')]+_0x46ed1c['countagentrejectretry'];this[_0x6424('0xa')]=_0x46ed1c[_0x6424('0xa')];this[_0x6424('0xb')]=_0x46ed1c['countdropretry'];this[_0x6424('0xd')]=_0x46ed1c[_0x6424('0xd')];this[_0x6424('0xc')]=_0x46ed1c[_0x6424('0xc')];this[_0x6424('0xe')]=_0x46ed1c[_0x6424('0xe')];this['uniqueid']=_0x1660e2[_0x6424('0xf')];this[_0x6424('0x10')]=_0x46ed1c[_0x6424('0x11')];this[_0x6424('0x12')]=_0x46ed1c[_0x6424('0x13')];this[_0x6424('0x14')]=_0x46ed1c[_0x6424('0x14')];this[_0x6424('0x15')]=_0x46ed1c[_0x6424('0x15')];this['answertime']=_0x46ed1c[_0x6424('0x16')];this[_0x6424('0x17')]=moment()[_0x6424('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6424('0x19')]=utils[_0x6424('0x1a')](_0x46ed1c[_0x6424('0x15')],_0x46ed1c[_0x6424('0x14')]);this['holdtime']=utils['getSeconds'](_0x46ed1c[_0x6424('0x16')],_0x46ed1c[_0x6424('0x15')]);this[_0x6424('0x1b')]=utils[_0x6424('0x1a')](this[_0x6424('0x17')],_0x46ed1c[_0x6424('0x16')]);this[_0x6424('0x6')]=_0x1660e2[_0x6424('0x6')];this['membername']=_0x1660e2[_0x6424('0x1c')];this['reason']=_0x1660e2[_0x6424('0x1d')];this[_0x6424('0x1e')]=_0x46ed1c[_0x6424('0x1e')];this[_0x6424('0x1f')]=_0x46ed1c[_0x6424('0x1f')];this[_0x6424('0x20')]=_0x46ed1c[_0x6424('0x20')];this['recallme']=_0x46ed1c[_0x6424('0x21')];this[_0x6424('0x22')]=_0x46ed1c['ContactId'];this[_0x6424('0x23')]=_0x46ed1c['ListId'];this[_0x6424('0x24')]=_0x46ed1c['UserId'];this[_0x6424('0x25')]=_0x46ed1c[_0x6424('0x25')];this[_0x6424('0x26')]=_0x46ed1c[_0x6424('0x26')];this['originatecalleridnum']=_0x46ed1c[_0x6424('0x27')]||'';this[_0x6424('0x28')]=_0x46ed1c[_0x6424('0x28')]||'';this['agiafterat']=_0x46ed1c[_0x6424('0x29')];}module[_0x6424('0x2a')]=AgentComplete; \ No newline at end of file +var _0xd6fa=['countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','answertime','format','ringtime','holdtime','getSeconds','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','state','statedesc','scheduledat','campaigntype','type','outbound','queue'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xd6fa,0x7c));var _0xad6f=function(_0x2d3d0d,_0x67ac82){_0x2d3d0d=_0x2d3d0d-0x0;var _0xca35b6=_0xd6fa[_0x2d3d0d];return _0xca35b6;};'use strict';var moment=require('moment');var utils=require(_0xad6f('0x0'));function AgentComplete(_0x504cfd,_0x1bd4d1){this[_0xad6f('0x1')]=0x4;this[_0xad6f('0x2')]='Answer';this[_0xad6f('0x3')]=_0x504cfd['scheduledat'];this['type']=_0x504cfd['type'];this[_0xad6f('0x4')]=_0x504cfd[_0xad6f('0x5')]===_0xad6f('0x6')?_0xad6f('0x7'):_0x504cfd[_0xad6f('0x5')];this['countbusyretry']=_0x504cfd['countbusyretry'];this['countcongestionretry']=_0x504cfd[_0xad6f('0x8')];this[_0xad6f('0x9')]=_0x504cfd[_0xad6f('0x9')];this[_0xad6f('0xa')]=_0x504cfd[_0xad6f('0xb')]+_0x504cfd[_0xad6f('0x8')]+_0x504cfd[_0xad6f('0x9')]+_0x504cfd[_0xad6f('0xc')]+_0x504cfd['countdropretry']+_0x504cfd[_0xad6f('0xd')]+_0x504cfd[_0xad6f('0xe')]+_0x504cfd[_0xad6f('0xf')];this[_0xad6f('0xc')]=_0x504cfd['countnosuchnumberretry'];this[_0xad6f('0x10')]=_0x504cfd['countdropretry'];this['countabandonedretry']=_0x504cfd[_0xad6f('0xd')];this[_0xad6f('0xe')]=_0x504cfd['countmachineretry'];this['countagentrejectretry']=_0x504cfd[_0xad6f('0xf')];this[_0xad6f('0x11')]=_0x1bd4d1['uniqueid'];this[_0xad6f('0x12')]=_0x504cfd['name'];this[_0xad6f('0x13')]=_0x504cfd[_0xad6f('0x14')];this[_0xad6f('0x15')]=_0x504cfd[_0xad6f('0x15')];this['responsetime']=_0x504cfd[_0xad6f('0x16')];this[_0xad6f('0x17')]=_0x504cfd['answertime'];this['endtime']=moment()[_0xad6f('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xad6f('0x19')]=utils['getSeconds'](_0x504cfd[_0xad6f('0x16')],_0x504cfd['starttime']);this[_0xad6f('0x1a')]=utils[_0xad6f('0x1b')](_0x504cfd['answertime'],_0x504cfd[_0xad6f('0x16')]);this[_0xad6f('0x1c')]=utils[_0xad6f('0x1b')](this['endtime'],_0x504cfd[_0xad6f('0x17')]);this[_0xad6f('0x7')]=_0x1bd4d1[_0xad6f('0x7')];this[_0xad6f('0x1d')]=_0x1bd4d1[_0xad6f('0x1d')];this[_0xad6f('0x1e')]=_0x1bd4d1[_0xad6f('0x1e')];this['callback']=_0x504cfd[_0xad6f('0x1f')];this[_0xad6f('0x20')]=_0x504cfd['callbackuniqueid'];this['callbackat']=_0x504cfd[_0xad6f('0x21')];this[_0xad6f('0x22')]=_0x504cfd[_0xad6f('0x22')];this[_0xad6f('0x23')]=_0x504cfd[_0xad6f('0x23')];this[_0xad6f('0x24')]=_0x504cfd['ListId'];this[_0xad6f('0x25')]=_0x504cfd[_0xad6f('0x25')];this[_0xad6f('0x26')]=_0x504cfd[_0xad6f('0x26')];this[_0xad6f('0x27')]=_0x504cfd['CampaignId'];this['originatecalleridnum']=_0x504cfd[_0xad6f('0x28')]||'';this[_0xad6f('0x29')]=_0x504cfd[_0xad6f('0x29')]||'';this[_0xad6f('0x2a')]=_0x504cfd[_0xad6f('0x2a')];}module[_0xad6f('0x2b')]=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 ee88087..65f203c 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 _0xe416=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','callback'];(function(_0xd2dfeb,_0x51aa27){var _0x313172=function(_0x4cc2ba){while(--_0x4cc2ba){_0xd2dfeb['push'](_0xd2dfeb['shift']());}};_0x313172(++_0x51aa27);}(_0xe416,0xb7));var _0x6e41=function(_0x51b218,_0x1b7fce){_0x51b218=_0x51b218-0x0;var _0x45b01a=_0xe416[_0x51b218];return _0x45b01a;};'use strict';function Final(_0x18ac4d){this[_0x6e41('0x0')]=_0x18ac4d['uniqueid'];this['scheduledat']=_0x18ac4d[_0x6e41('0x1')];this[_0x6e41('0x2')]=_0x18ac4d['type'];this['campaigntype']=_0x18ac4d[_0x6e41('0x2')]===_0x6e41('0x3')?_0x6e41('0x4'):_0x18ac4d[_0x6e41('0x2')];this[_0x6e41('0x5')]=_0x18ac4d[_0x6e41('0x5')];this[_0x6e41('0x6')]=_0x18ac4d[_0x6e41('0x6')];this[_0x6e41('0x7')]=_0x18ac4d[_0x6e41('0x7')];this[_0x6e41('0x8')]=_0x18ac4d[_0x6e41('0x5')]+_0x18ac4d[_0x6e41('0x6')]+_0x18ac4d['countnoanswerretry']+_0x18ac4d[_0x6e41('0x9')]+_0x18ac4d[_0x6e41('0xa')]+_0x18ac4d['countabandonedretry']+_0x18ac4d[_0x6e41('0xb')]+_0x18ac4d[_0x6e41('0xc')];this[_0x6e41('0x9')]=_0x18ac4d[_0x6e41('0x9')];this['countdropretry']=_0x18ac4d[_0x6e41('0xa')];this[_0x6e41('0xd')]=_0x18ac4d[_0x6e41('0xd')];this[_0x6e41('0xb')]=_0x18ac4d[_0x6e41('0xb')];this[_0x6e41('0xc')]=_0x18ac4d[_0x6e41('0xc')];this[_0x6e41('0x4')]=_0x18ac4d['queue'];this[_0x6e41('0xe')]=_0x18ac4d[_0x6e41('0xe')];this[_0x6e41('0xf')]=_0x18ac4d[_0x6e41('0xf')];this['starttime']=_0x18ac4d[_0x6e41('0x10')];this[_0x6e41('0x11')]=_0x18ac4d[_0x6e41('0x11')];this['endtime']=_0x18ac4d[_0x6e41('0x11')];this[_0x6e41('0x12')]=_0x18ac4d[_0x6e41('0x12')]||0x0;this[_0x6e41('0x13')]=_0x18ac4d[_0x6e41('0x13')]||0x0;this['talktime']=_0x18ac4d['talktime']||0x0;this[_0x6e41('0x14')]=_0x18ac4d['callback'];this[_0x6e41('0x15')]=_0x18ac4d['callbackuniqueid'];this[_0x6e41('0x16')]=_0x18ac4d[_0x6e41('0x16')];this[_0x6e41('0x17')]=_0x18ac4d[_0x6e41('0x17')];this[_0x6e41('0x18')]=_0x18ac4d[_0x6e41('0x18')];this[_0x6e41('0x19')]=_0x18ac4d[_0x6e41('0x19')];this[_0x6e41('0x1a')]=_0x18ac4d[_0x6e41('0x1a')];this[_0x6e41('0x1b')]=_0x18ac4d[_0x6e41('0x1b')];this[_0x6e41('0x1c')]=_0x18ac4d[_0x6e41('0x1c')];this[_0x6e41('0x1d')]=_0x18ac4d[_0x6e41('0x1d')]||'';this[_0x6e41('0x1e')]=_0x18ac4d[_0x6e41('0x1e')]||'';this[_0x6e41('0x1f')]=_0x18ac4d[_0x6e41('0x1f')];this[_0x6e41('0x20')]=_0x18ac4d[_0x6e41('0x20')];}module[_0x6e41('0x21')]=Final; \ No newline at end of file +var _0xcde8=['countmachineretry','countagentrejectretry','calleridname','calleridnum','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x17e666,_0x415452){var _0x5e63cb=function(_0x3d2a95){while(--_0x3d2a95){_0x17e666['push'](_0x17e666['shift']());}};_0x5e63cb(++_0x415452);}(_0xcde8,0x15f));var _0x8cde=function(_0x592c46,_0x3255c8){_0x592c46=_0x592c46-0x0;var _0x3decaf=_0xcde8[_0x592c46];return _0x3decaf;};'use strict';function Final(_0x337fe3){this[_0x8cde('0x0')]=_0x337fe3['uniqueid'];this[_0x8cde('0x1')]=_0x337fe3[_0x8cde('0x1')];this[_0x8cde('0x2')]=_0x337fe3['type'];this[_0x8cde('0x3')]=_0x337fe3[_0x8cde('0x2')]===_0x8cde('0x4')?_0x8cde('0x5'):_0x337fe3[_0x8cde('0x2')];this['countbusyretry']=_0x337fe3[_0x8cde('0x6')];this[_0x8cde('0x7')]=_0x337fe3[_0x8cde('0x7')];this[_0x8cde('0x8')]=_0x337fe3[_0x8cde('0x8')];this['countglobal']=_0x337fe3[_0x8cde('0x6')]+_0x337fe3[_0x8cde('0x7')]+_0x337fe3[_0x8cde('0x8')]+_0x337fe3[_0x8cde('0x9')]+_0x337fe3[_0x8cde('0xa')]+_0x337fe3[_0x8cde('0xb')]+_0x337fe3[_0x8cde('0xc')]+_0x337fe3[_0x8cde('0xd')];this[_0x8cde('0x9')]=_0x337fe3[_0x8cde('0x9')];this[_0x8cde('0xa')]=_0x337fe3['countdropretry'];this[_0x8cde('0xb')]=_0x337fe3[_0x8cde('0xb')];this['countmachineretry']=_0x337fe3[_0x8cde('0xc')];this[_0x8cde('0xd')]=_0x337fe3[_0x8cde('0xd')];this['queue']=_0x337fe3[_0x8cde('0x5')];this[_0x8cde('0xe')]=_0x337fe3[_0x8cde('0xe')];this[_0x8cde('0xf')]=_0x337fe3['calleridnum'];this['starttime']=_0x337fe3['starttime'];this[_0x8cde('0x10')]=_0x337fe3[_0x8cde('0x10')];this[_0x8cde('0x11')]=_0x337fe3[_0x8cde('0x10')];this['ringtime']=_0x337fe3['ringtime']||0x0;this[_0x8cde('0x12')]=_0x337fe3[_0x8cde('0x12')]||0x0;this[_0x8cde('0x13')]=_0x337fe3[_0x8cde('0x13')]||0x0;this[_0x8cde('0x14')]=_0x337fe3[_0x8cde('0x14')];this[_0x8cde('0x15')]=_0x337fe3[_0x8cde('0x15')];this[_0x8cde('0x16')]=_0x337fe3[_0x8cde('0x16')];this[_0x8cde('0x17')]=_0x337fe3['recallme'];this[_0x8cde('0x18')]=_0x337fe3['ContactId'];this['ListId']=_0x337fe3['ListId'];this['UserId']=_0x337fe3[_0x8cde('0x19')];this[_0x8cde('0x1a')]=_0x337fe3[_0x8cde('0x1a')];this['CampaignId']=_0x337fe3[_0x8cde('0x1b')];this[_0x8cde('0x1c')]=_0x337fe3['originatecalleridnum']||'';this[_0x8cde('0x1d')]=_0x337fe3['originatecalleridname']||'';this[_0x8cde('0x1e')]=_0x337fe3['state'];this[_0x8cde('0x1f')]=_0x337fe3[_0x8cde('0x1f')];}module[_0x8cde('0x20')]=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 605957e..c1efe7a 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 _0x9837=['responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','exports','moment','state','statedesc','type','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','name','calleridnum','number','starttime'];(function(_0x267656,_0x3e273e){var _0x2a4d02=function(_0x8c63ad){while(--_0x8c63ad){_0x267656['push'](_0x267656['shift']());}};_0x2a4d02(++_0x3e273e);}(_0x9837,0x84));var _0x7983=function(_0x24d34e,_0x5addea){_0x24d34e=_0x24d34e-0x0;var _0x50e117=_0x9837[_0x24d34e];return _0x50e117;};'use strict';var moment=require(_0x7983('0x0'));var utils=require('../utils');function Hangup(_0x49db9e,_0x4fcaba){this[_0x7983('0x1')]=0x4;this[_0x7983('0x2')]='Answer';this['scheduledat']=_0x49db9e['scheduledat'];this[_0x7983('0x3')]=_0x49db9e[_0x7983('0x3')];this['campaigntype']=_0x49db9e[_0x7983('0x3')]===_0x7983('0x4')?_0x7983('0x5'):_0x49db9e[_0x7983('0x3')];this['amd']=_0x49db9e[_0x7983('0x6')]||![];this[_0x7983('0x7')]=_0x49db9e[_0x7983('0x7')];this[_0x7983('0x8')]=_0x49db9e[_0x7983('0x8')];this[_0x7983('0x9')]=_0x49db9e['countnoanswerretry'];this['countglobal']=_0x49db9e[_0x7983('0x7')]+_0x49db9e[_0x7983('0x8')]+_0x49db9e[_0x7983('0x9')]+_0x49db9e['countnosuchnumberretry']+_0x49db9e[_0x7983('0xa')]+_0x49db9e[_0x7983('0xb')]+_0x49db9e[_0x7983('0xc')]+_0x49db9e[_0x7983('0xd')];this['countnosuchnumberretry']=_0x49db9e[_0x7983('0xe')];this[_0x7983('0xa')]=_0x49db9e[_0x7983('0xa')];this[_0x7983('0xb')]=_0x49db9e[_0x7983('0xb')];this[_0x7983('0xc')]=_0x49db9e[_0x7983('0xc')];this[_0x7983('0xd')]=_0x49db9e[_0x7983('0xd')];this[_0x7983('0xf')]=_0x4fcaba[_0x7983('0xf')];this['calleridname']=_0x49db9e[_0x7983('0x10')];this[_0x7983('0x11')]=_0x49db9e[_0x7983('0x12')];this[_0x7983('0x13')]=_0x49db9e[_0x7983('0x13')];this[_0x7983('0x14')]=_0x49db9e[_0x7983('0x14')];this[_0x7983('0x15')]=moment()[_0x7983('0x16')](_0x7983('0x17'));this['ringtime']=utils['getSeconds'](_0x49db9e[_0x7983('0x14')],_0x49db9e[_0x7983('0x13')]);this[_0x7983('0x18')]=0x0;this[_0x7983('0x19')]=utils['getSeconds'](this[_0x7983('0x15')],_0x49db9e[_0x7983('0x14')]);this['queue']=_0x49db9e[_0x7983('0x5')];this[_0x7983('0x1a')]=_0x7983('0x1b');this['reason']=_0x4fcaba[_0x7983('0x1c')];this[_0x7983('0x1d')]=_0x49db9e[_0x7983('0x1d')];this[_0x7983('0x1e')]=_0x49db9e[_0x7983('0x1e')];this[_0x7983('0x1f')]=_0x49db9e[_0x7983('0x1f')];this[_0x7983('0x20')]=_0x49db9e[_0x7983('0x20')];this[_0x7983('0x21')]=_0x49db9e[_0x7983('0x21')];this[_0x7983('0x22')]=_0x49db9e[_0x7983('0x22')];this['UserId']=_0x49db9e[_0x7983('0x23')];this[_0x7983('0x24')]=_0x49db9e[_0x7983('0x24')];this['CampaignId']=_0x49db9e['CampaignId'];}module[_0x7983('0x25')]=Hangup; \ No newline at end of file +var _0x9a07=['scheduledat','type','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','exports','moment','../utils','state','statedesc','Answer'];(function(_0x2d8a23,_0x522080){var _0xd7bce1=function(_0x6adbdd){while(--_0x6adbdd){_0x2d8a23['push'](_0x2d8a23['shift']());}};_0xd7bce1(++_0x522080);}(_0x9a07,0x175));var _0x79a0=function(_0xc1c1ce,_0x4d7608){_0xc1c1ce=_0xc1c1ce-0x0;var _0x5f3715=_0x9a07[_0xc1c1ce];return _0x5f3715;};'use strict';var moment=require(_0x79a0('0x0'));var utils=require(_0x79a0('0x1'));function Hangup(_0x1763c0,_0x16fae0){this[_0x79a0('0x2')]=0x4;this[_0x79a0('0x3')]=_0x79a0('0x4');this[_0x79a0('0x5')]=_0x1763c0['scheduledat'];this[_0x79a0('0x6')]=_0x1763c0[_0x79a0('0x6')];this['campaigntype']=_0x1763c0['type']===_0x79a0('0x7')?_0x79a0('0x8'):_0x1763c0[_0x79a0('0x6')];this['amd']=_0x1763c0[_0x79a0('0x9')]||![];this[_0x79a0('0xa')]=_0x1763c0['countbusyretry'];this[_0x79a0('0xb')]=_0x1763c0['countcongestionretry'];this['countnoanswerretry']=_0x1763c0[_0x79a0('0xc')];this[_0x79a0('0xd')]=_0x1763c0[_0x79a0('0xa')]+_0x1763c0[_0x79a0('0xb')]+_0x1763c0[_0x79a0('0xc')]+_0x1763c0[_0x79a0('0xe')]+_0x1763c0[_0x79a0('0xf')]+_0x1763c0[_0x79a0('0x10')]+_0x1763c0['countmachineretry']+_0x1763c0[_0x79a0('0x11')];this[_0x79a0('0xe')]=_0x1763c0[_0x79a0('0xe')];this[_0x79a0('0xf')]=_0x1763c0[_0x79a0('0xf')];this[_0x79a0('0x10')]=_0x1763c0[_0x79a0('0x10')];this['countmachineretry']=_0x1763c0[_0x79a0('0x12')];this['countagentrejectretry']=_0x1763c0[_0x79a0('0x11')];this['uniqueid']=_0x16fae0['uniqueid'];this[_0x79a0('0x13')]=_0x1763c0[_0x79a0('0x14')];this[_0x79a0('0x15')]=_0x1763c0['number'];this[_0x79a0('0x16')]=_0x1763c0[_0x79a0('0x16')];this['responsetime']=_0x1763c0[_0x79a0('0x17')];this[_0x79a0('0x18')]=moment()[_0x79a0('0x19')](_0x79a0('0x1a'));this[_0x79a0('0x1b')]=utils[_0x79a0('0x1c')](_0x1763c0[_0x79a0('0x17')],_0x1763c0[_0x79a0('0x16')]);this[_0x79a0('0x1d')]=0x0;this[_0x79a0('0x1e')]=utils['getSeconds'](this[_0x79a0('0x18')],_0x1763c0[_0x79a0('0x17')]);this[_0x79a0('0x8')]=_0x1763c0[_0x79a0('0x8')];this[_0x79a0('0x1f')]='IVR';this['reason']=_0x16fae0[_0x79a0('0x20')];this[_0x79a0('0x21')]=_0x1763c0['callback'];this[_0x79a0('0x22')]=_0x1763c0[_0x79a0('0x22')];this[_0x79a0('0x23')]=_0x1763c0[_0x79a0('0x23')];this['recallme']=_0x1763c0[_0x79a0('0x24')];this[_0x79a0('0x25')]=_0x1763c0[_0x79a0('0x25')];this[_0x79a0('0x26')]=_0x1763c0[_0x79a0('0x26')];this[_0x79a0('0x27')]=_0x1763c0['UserId'];this[_0x79a0('0x28')]=_0x1763c0[_0x79a0('0x28')];this['CampaignId']=_0x1763c0['CampaignId'];}module[_0x79a0('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 d7391d1..84a31d2 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 _0xe2f2=['responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','number','starttime'];(function(_0x239189,_0x1f8fab){var _0x5a545d=function(_0x576228){while(--_0x576228){_0x239189['push'](_0x239189['shift']());}};_0x5a545d(++_0x1f8fab);}(_0xe2f2,0x9f));var _0x2e2f=function(_0x334ab5,_0x33d31b){_0x334ab5=_0x334ab5-0x0;var _0x36303c=_0xe2f2[_0x334ab5];return _0x36303c;};'use strict';var utils=require('../utils');function History(_0x70e0f){this[_0x2e2f('0x0')]=_0x70e0f[_0x2e2f('0x0')];this[_0x2e2f('0x1')]=_0x70e0f['scheduledat']||undefined;this[_0x2e2f('0x2')]=_0x70e0f[_0x2e2f('0x2')];this['campaigntype']=_0x70e0f[_0x2e2f('0x2')]===_0x2e2f('0x3')?'queue':_0x70e0f[_0x2e2f('0x2')];this[_0x2e2f('0x4')]=_0x70e0f[_0x2e2f('0x4')];this[_0x2e2f('0x5')]=_0x70e0f[_0x2e2f('0x5')];this[_0x2e2f('0x6')]=_0x70e0f[_0x2e2f('0x6')];this[_0x2e2f('0x7')]=_0x70e0f[_0x2e2f('0x4')]+_0x70e0f['countcongestionretry']+_0x70e0f[_0x2e2f('0x6')]+_0x70e0f[_0x2e2f('0x8')]+_0x70e0f[_0x2e2f('0x9')]+_0x70e0f[_0x2e2f('0xa')]+_0x70e0f[_0x2e2f('0xb')]+_0x70e0f['countagentrejectretry'];this[_0x2e2f('0x8')]=_0x70e0f[_0x2e2f('0x8')];this['countdropretry']=_0x70e0f['countdropretry'];this[_0x2e2f('0xa')]=_0x70e0f[_0x2e2f('0xa')];this['countmachineretry']=_0x70e0f[_0x2e2f('0xb')];this[_0x2e2f('0xc')]=_0x70e0f['countagentrejectretry'];this['queue']=_0x70e0f['queue'];this['calleridname']=_0x70e0f[_0x2e2f('0xd')];this['calleridnum']=_0x70e0f[_0x2e2f('0xe')];this[_0x2e2f('0xf')]=_0x70e0f[_0x2e2f('0xf')];this[_0x2e2f('0x10')]=_0x70e0f[_0x2e2f('0x10')];this[_0x2e2f('0x11')]=_0x70e0f['responsetime'];this[_0x2e2f('0x12')]=utils[_0x2e2f('0x13')](_0x70e0f[_0x2e2f('0x10')],_0x70e0f['starttime']);this[_0x2e2f('0x14')]=0x0;this[_0x2e2f('0x15')]=0x0;this[_0x2e2f('0x16')]=_0x70e0f[_0x2e2f('0x16')];this[_0x2e2f('0x17')]=_0x70e0f['callbackuniqueid'];this[_0x2e2f('0x18')]=_0x70e0f[_0x2e2f('0x18')];this['recallme']=_0x70e0f['recallme'];this[_0x2e2f('0x19')]=_0x70e0f[_0x2e2f('0x19')];this[_0x2e2f('0x1a')]=_0x70e0f[_0x2e2f('0x1a')];this[_0x2e2f('0x1b')]=_0x70e0f['UserId'];this['VoiceQueueId']=_0x70e0f[_0x2e2f('0x1c')];this[_0x2e2f('0x1d')]=_0x70e0f[_0x2e2f('0x1d')];this[_0x2e2f('0x1e')]=_0x70e0f['originatecalleridnum']||'';this[_0x2e2f('0x1f')]=_0x70e0f[_0x2e2f('0x1f')]||'';this[_0x2e2f('0x20')]=_0x70e0f[_0x2e2f('0x20')];this[_0x2e2f('0x21')]=_0x70e0f[_0x2e2f('0x21')];}module[_0x2e2f('0x22')]=History; \ No newline at end of file +var _0xf22f=['countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','endtime','responsetime','ringtime','getSeconds','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','queue','countcongestionretry','countnoanswerretry'];(function(_0x4b2e6f,_0x1e2bf5){var _0x3bda6f=function(_0x44d545){while(--_0x44d545){_0x4b2e6f['push'](_0x4b2e6f['shift']());}};_0x3bda6f(++_0x1e2bf5);}(_0xf22f,0x94));var _0xff22=function(_0x308888,_0x4610f0){_0x308888=_0x308888-0x0;var _0x4dc534=_0xf22f[_0x308888];return _0x4dc534;};'use strict';var utils=require(_0xff22('0x0'));function History(_0x42634e){this[_0xff22('0x1')]=_0x42634e[_0xff22('0x1')];this[_0xff22('0x2')]=_0x42634e['scheduledat']||undefined;this[_0xff22('0x3')]=_0x42634e[_0xff22('0x3')];this[_0xff22('0x4')]=_0x42634e[_0xff22('0x3')]==='outbound'?_0xff22('0x5'):_0x42634e[_0xff22('0x3')];this['countbusyretry']=_0x42634e['countbusyretry'];this[_0xff22('0x6')]=_0x42634e[_0xff22('0x6')];this[_0xff22('0x7')]=_0x42634e[_0xff22('0x7')];this[_0xff22('0x8')]=_0x42634e[_0xff22('0x9')]+_0x42634e[_0xff22('0x6')]+_0x42634e[_0xff22('0x7')]+_0x42634e[_0xff22('0xa')]+_0x42634e[_0xff22('0xb')]+_0x42634e['countabandonedretry']+_0x42634e[_0xff22('0xc')]+_0x42634e['countagentrejectretry'];this[_0xff22('0xa')]=_0x42634e[_0xff22('0xa')];this[_0xff22('0xb')]=_0x42634e[_0xff22('0xb')];this[_0xff22('0xd')]=_0x42634e['countabandonedretry'];this['countmachineretry']=_0x42634e[_0xff22('0xc')];this[_0xff22('0xe')]=_0x42634e[_0xff22('0xe')];this['queue']=_0x42634e['queue'];this[_0xff22('0xf')]=_0x42634e[_0xff22('0x10')];this[_0xff22('0x11')]=_0x42634e[_0xff22('0x12')];this[_0xff22('0x13')]=_0x42634e[_0xff22('0x13')];this['responsetime']=_0x42634e['responsetime'];this[_0xff22('0x14')]=_0x42634e[_0xff22('0x15')];this[_0xff22('0x16')]=utils[_0xff22('0x17')](_0x42634e[_0xff22('0x15')],_0x42634e[_0xff22('0x13')]);this['holdtime']=0x0;this[_0xff22('0x18')]=0x0;this['callback']=_0x42634e[_0xff22('0x19')];this['callbackuniqueid']=_0x42634e[_0xff22('0x1a')];this[_0xff22('0x1b')]=_0x42634e[_0xff22('0x1b')];this[_0xff22('0x1c')]=_0x42634e[_0xff22('0x1c')];this[_0xff22('0x1d')]=_0x42634e[_0xff22('0x1d')];this[_0xff22('0x1e')]=_0x42634e[_0xff22('0x1e')];this[_0xff22('0x1f')]=_0x42634e['UserId'];this[_0xff22('0x20')]=_0x42634e[_0xff22('0x20')];this[_0xff22('0x21')]=_0x42634e[_0xff22('0x21')];this['originatecalleridnum']=_0x42634e[_0xff22('0x22')]||'';this[_0xff22('0x23')]=_0x42634e[_0xff22('0x23')]||'';this[_0xff22('0x24')]=_0x42634e[_0xff22('0x24')];this[_0xff22('0x25')]=_0x42634e[_0xff22('0x25')];}module[_0xff22('0x26')]=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 400e201..f374afa 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 _0x1391=['originatecalleridname','agiafterat','statedesc','exports','scheduledat','type','campaigntype','outbound','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','queue','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','originatecalleridnum'];(function(_0xe80ab0,_0x5a4886){var _0x35d631=function(_0x4c418b){while(--_0x4c418b){_0xe80ab0['push'](_0xe80ab0['shift']());}};_0x35d631(++_0x5a4886);}(_0x1391,0x1b1));var _0x1139=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x1391[_0x491a7f];return _0x3d8f44;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x1573a8,_0x14b320){this[_0x1139('0x0')]=_0x1573a8['scheduledat'];this[_0x1139('0x1')]=_0x1573a8[_0x1139('0x1')];this[_0x1139('0x2')]=_0x1573a8['type']===_0x1139('0x3')?'queue':_0x1573a8[_0x1139('0x1')];this['countbusyretry']=_0x1573a8['countbusyretry'];this[_0x1139('0x4')]=_0x1573a8[_0x1139('0x4')];this[_0x1139('0x5')]=_0x1573a8['countnoanswerretry'];this[_0x1139('0x6')]=_0x1573a8[_0x1139('0x7')]+_0x1573a8['countcongestionretry']+_0x1573a8[_0x1139('0x5')]+_0x1573a8[_0x1139('0x8')]+_0x1573a8['countdropretry']+_0x1573a8['countabandonedretry']+_0x1573a8[_0x1139('0x9')]+_0x1573a8['countagentrejectretry'];this[_0x1139('0x8')]=_0x1573a8[_0x1139('0x8')];this['countdropretry']=_0x1573a8['countdropretry'];this[_0x1139('0xa')]=_0x1573a8['countabandonedretry'];this['countmachineretry']=_0x1573a8[_0x1139('0x9')];this[_0x1139('0xb')]=_0x1573a8['countagentrejectretry'];this[_0x1139('0xc')]=_0x14b320[_0x1139('0xc')];this[_0x1139('0xd')]=_0x1573a8[_0x1139('0xe')];this['calleridnum']=_0x1573a8[_0x1139('0xf')];this[_0x1139('0x10')]=_0x1573a8['starttime'];this[_0x1139('0x11')]=_0x1573a8[_0x1139('0x11')];this['droptime']=_0x1573a8[_0x1139('0x12')];this['dropreason']=_0x1573a8[_0x1139('0x13')];this[_0x1139('0x14')]=this[_0x1139('0x12')];this[_0x1139('0x15')]=utils[_0x1139('0x16')](_0x1573a8[_0x1139('0x11')],_0x1573a8[_0x1139('0x10')]);this[_0x1139('0x17')]=utils[_0x1139('0x16')](this[_0x1139('0x12')],_0x1573a8['responsetime']);this['talktime']=0x0;this[_0x1139('0x18')]=_0x14b320[_0x1139('0x18')];this['membername']=_0x14b320[_0x1139('0x19')];this[_0x1139('0x1a')]=_0x14b320['reason'];this[_0x1139('0x1b')]=_0x1573a8['callback'];this[_0x1139('0x1c')]=_0x1573a8['callbackuniqueid'];this[_0x1139('0x1d')]=_0x1573a8[_0x1139('0x1d')];this[_0x1139('0x1e')]=_0x1573a8[_0x1139('0x1e')];this['ContactId']=_0x1573a8['ContactId'];this[_0x1139('0x1f')]=_0x1573a8[_0x1139('0x1f')];this['UserId']=_0x1573a8[_0x1139('0x20')];this[_0x1139('0x21')]=_0x1573a8['VoiceQueueId'];this['CampaignId']=_0x1573a8['CampaignId'];this[_0x1139('0x22')]=_0x1573a8[_0x1139('0x22')]||'';this[_0x1139('0x23')]=_0x1573a8['originatecalleridname']||'';this[_0x1139('0x24')]=_0x1573a8[_0x1139('0x24')];this['state']=_0x1573a8['state'];this[_0x1139('0x25')]=_0x1573a8[_0x1139('0x25')];}module[_0x1139('0x26')]=QueueCallerAbandon; \ No newline at end of file +var _0xc281=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','calleridnum','starttime','responsetime','droptime','dropreason','getSeconds','talktime','membername','connectedlinename','reason'];(function(_0x5496fa,_0x335f20){var _0x120796=function(_0x34b0b4){while(--_0x34b0b4){_0x5496fa['push'](_0x5496fa['shift']());}};_0x120796(++_0x335f20);}(_0xc281,0x1c7));var _0x1c28=function(_0x529059,_0x294a33){_0x529059=_0x529059-0x0;var _0x156bc2=_0xc281[_0x529059];return _0x156bc2;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x2dcaa4,_0x22b038){this[_0x1c28('0x0')]=_0x2dcaa4[_0x1c28('0x0')];this[_0x1c28('0x1')]=_0x2dcaa4[_0x1c28('0x1')];this[_0x1c28('0x2')]=_0x2dcaa4['type']===_0x1c28('0x3')?_0x1c28('0x4'):_0x2dcaa4[_0x1c28('0x1')];this['countbusyretry']=_0x2dcaa4[_0x1c28('0x5')];this[_0x1c28('0x6')]=_0x2dcaa4['countcongestionretry'];this[_0x1c28('0x7')]=_0x2dcaa4[_0x1c28('0x7')];this[_0x1c28('0x8')]=_0x2dcaa4[_0x1c28('0x5')]+_0x2dcaa4[_0x1c28('0x6')]+_0x2dcaa4[_0x1c28('0x7')]+_0x2dcaa4[_0x1c28('0x9')]+_0x2dcaa4[_0x1c28('0xa')]+_0x2dcaa4[_0x1c28('0xb')]+_0x2dcaa4['countmachineretry']+_0x2dcaa4[_0x1c28('0xc')];this[_0x1c28('0x9')]=_0x2dcaa4[_0x1c28('0x9')];this['countdropretry']=_0x2dcaa4[_0x1c28('0xa')];this['countabandonedretry']=_0x2dcaa4['countabandonedretry'];this['countmachineretry']=_0x2dcaa4['countmachineretry'];this[_0x1c28('0xc')]=_0x2dcaa4['countagentrejectretry'];this[_0x1c28('0xd')]=_0x22b038['uniqueid'];this[_0x1c28('0xe')]=_0x2dcaa4['name'];this[_0x1c28('0xf')]=_0x2dcaa4['number'];this[_0x1c28('0x10')]=_0x2dcaa4[_0x1c28('0x10')];this['responsetime']=_0x2dcaa4[_0x1c28('0x11')];this[_0x1c28('0x12')]=_0x2dcaa4[_0x1c28('0x12')];this[_0x1c28('0x13')]=_0x2dcaa4[_0x1c28('0x13')];this['endtime']=this['droptime'];this['ringtime']=utils[_0x1c28('0x14')](_0x2dcaa4[_0x1c28('0x11')],_0x2dcaa4['starttime']);this['holdtime']=utils[_0x1c28('0x14')](this['droptime'],_0x2dcaa4['responsetime']);this[_0x1c28('0x15')]=0x0;this[_0x1c28('0x4')]=_0x22b038[_0x1c28('0x4')];this[_0x1c28('0x16')]=_0x22b038[_0x1c28('0x17')];this[_0x1c28('0x18')]=_0x22b038[_0x1c28('0x18')];this[_0x1c28('0x19')]=_0x2dcaa4['callback'];this[_0x1c28('0x1a')]=_0x2dcaa4[_0x1c28('0x1a')];this[_0x1c28('0x1b')]=_0x2dcaa4[_0x1c28('0x1b')];this[_0x1c28('0x1c')]=_0x2dcaa4[_0x1c28('0x1c')];this[_0x1c28('0x1d')]=_0x2dcaa4[_0x1c28('0x1d')];this[_0x1c28('0x1e')]=_0x2dcaa4[_0x1c28('0x1e')];this[_0x1c28('0x1f')]=_0x2dcaa4[_0x1c28('0x1f')];this[_0x1c28('0x20')]=_0x2dcaa4[_0x1c28('0x20')];this[_0x1c28('0x21')]=_0x2dcaa4['CampaignId'];this[_0x1c28('0x22')]=_0x2dcaa4['originatecalleridnum']||'';this[_0x1c28('0x23')]=_0x2dcaa4['originatecalleridname']||'';this[_0x1c28('0x24')]=_0x2dcaa4['agiafterat'];this[_0x1c28('0x25')]=_0x2dcaa4[_0x1c28('0x25')];this[_0x1c28('0x26')]=_0x2dcaa4['statedesc'];}module[_0x1c28('0x27')]=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 6c5e2d6..b222263 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 _0x430c=['[checkIsBlackList]','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory','util','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','dialOrderByScheduledAt','temp','error','[getContactDialer]','getContactDialer','getContactDialerIvr','[getContactDialerIvr]','catch','[countReScheduled]','countReScheduled','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]'];(function(_0x644560,_0x1783aa){var _0x41b76b=function(_0xff8c89){while(--_0xff8c89){_0x644560['push'](_0x644560['shift']());}};_0x41b76b(++_0x1783aa);}(_0x430c,0x1a1));var _0xc430=function(_0x5b8b97,_0x6b4dfa){_0x5b8b97=_0x5b8b97-0x0;var _0x1fdf84=_0x430c[_0x5b8b97];return _0x1fdf84;};'use strict';var util=require(_0xc430('0x0'));var logger=require('../../../../config/logger')('dialer');var cmHopper=require(_0xc430('0x1'));var cmHopperAdditionalPhone=require(_0xc430('0x2'));var cmHopperBlack=require(_0xc430('0x3'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x4f0118){return util['inspect'](_0x4f0118,{'showHidden':![],'depth':null});}function getContactDialer(_0x47d8b9,_0x338a82,_0x2408f5){return cmHopper['getContactDialer'](_0x47d8b9['id'],_0x338a82,_0x2408f5,_0x47d8b9[_0xc430('0x4')])['catch'](function(_0x212354){_0x47d8b9[_0xc430('0x5')]=0x0;logger[_0xc430('0x6')](_0xc430('0x7'),inspectError(_0x212354));});}exports[_0xc430('0x8')]=getContactDialer;function getContactDialerIvr(_0x11f4b0,_0x861581){return cmHopper[_0xc430('0x9')](_0x11f4b0['id'],_0x861581,_0x11f4b0[_0xc430('0x4')])['catch'](function(_0x97fa5b){_0x11f4b0[_0xc430('0x5')]=0x0;logger['error'](_0xc430('0xa'),inspectError(_0x97fa5b));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x3b84bc){return cmHopper['countReScheduled'](_0x3b84bc)[_0xc430('0xb')](function(_0x8aa2e6){logger[_0xc430('0x6')](_0xc430('0xc'),inspectError(_0x8aa2e6));});}exports[_0xc430('0xd')]=countReScheduled;function rescheduleContact(_0x2777af){return cmHopper[_0xc430('0xe')](_0x2777af)['catch'](function(_0x4e9134){logger[_0xc430('0x6')](_0xc430('0xf'),inspectError(_0x4e9134));});}exports[_0xc430('0xe')]=rescheduleContact;function unlockContact(_0x2ef538,_0x31d3b7,_0x55cc6c){return cmHopper[_0xc430('0x10')](_0x2ef538,_0x31d3b7,_0x55cc6c)['catch'](function(_0x4bf91f){logger[_0xc430('0x6')](_0xc430('0x11'),inspectError(_0x4bf91f));});}exports[_0xc430('0x10')]=unlockContact;function moveContactManagedDialer(_0x5830b0){return cmHopper['moveContactManagedDialer'](_0x5830b0)[_0xc430('0xb')](function(_0x4c1937){logger[_0xc430('0x6')]('[moveContactManagedDialer]',inspectError(_0x4c1937));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x2f3203){return cmHopperBlack['checkIsBlackList'](_0x2f3203)[_0xc430('0xb')](function(_0x1eae3b){logger[_0xc430('0x6')](_0xc430('0x12'),inspectError(_0x1eae3b));});}exports[_0xc430('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x5af282){return cmHopperBlack[_0xc430('0x14')](_0x5af282)['catch'](function(_0x4d2d43){logger[_0xc430('0x6')](_0xc430('0x15'),inspectError(_0x4d2d43));});}exports[_0xc430('0x14')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x56dd16,_0x3fd56b,_0x57d26e){return cmHopperAdditionalPhone[_0xc430('0x16')](_0x56dd16,_0x3fd56b,_0x57d26e)[_0xc430('0xb')](function(_0x4efecd){logger[_0xc430('0x6')](_0xc430('0x17'),inspectError(_0x4efecd));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x2f9af4,_0x59c498,_0x3aa85e){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x2f9af4,_0x59c498,_0x3aa85e)[_0xc430('0xb')](function(_0x21e28a){logger['error'](_0xc430('0x18'),inspectError(_0x21e28a));});}exports[_0xc430('0x19')]=swapAdditionalPhones;function avgHandleTime(_0x2c0422){return cmHopperHistory[_0xc430('0x1a')](_0x2c0422)[_0xc430('0xb')](function(_0x57cd72){logger[_0xc430('0x6')](_0xc430('0x1b'),inspectError(_0x57cd72));});}exports[_0xc430('0x1a')]=avgHandleTime;function createHistory(_0x1591e3){return cmHopperHistory['createHistory'](_0x1591e3)[_0xc430('0xb')](function(_0x4cf56c){logger[_0xc430('0x6')]('[createHistory]',inspectError(_0x4cf56c));});}exports[_0xc430('0x1c')]=createHistory; \ No newline at end of file +var _0xfdbd=['[createHistory]','createHistory','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','error','[getContactDialer]','getContactDialerIvr','catch','temp','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','[unlockContact]','[moveContactManagedDialer]','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','[avgHandleTime]','avgHandleTime'];(function(_0x3d60f3,_0x56afd9){var _0x5b3695=function(_0x25c588){while(--_0x25c588){_0x3d60f3['push'](_0x3d60f3['shift']());}};_0x5b3695(++_0x56afd9);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x548200,_0x3241b8){_0x548200=_0x548200-0x0;var _0x1a6d74=_0xfdbd[_0x548200];return _0x1a6d74;};'use strict';var util=require(_0xdfdb('0x0'));var logger=require(_0xdfdb('0x1'))(_0xdfdb('0x2'));var cmHopper=require(_0xdfdb('0x3'));var cmHopperAdditionalPhone=require(_0xdfdb('0x4'));var cmHopperBlack=require(_0xdfdb('0x5'));var cmHopperHistory=require(_0xdfdb('0x6'));function inspectError(_0x66533b){return util[_0xdfdb('0x7')](_0x66533b,{'showHidden':![],'depth':null});}function getContactDialer(_0x5945e0,_0x3f5b2d,_0x4a4a3f){return cmHopper[_0xdfdb('0x8')](_0x5945e0['id'],_0x3f5b2d,_0x4a4a3f,_0x5945e0[_0xdfdb('0x9')])['catch'](function(_0x556dc0){_0x5945e0['temp']=0x0;logger[_0xdfdb('0xa')](_0xdfdb('0xb'),inspectError(_0x556dc0));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x11d845,_0x444c19){return cmHopper[_0xdfdb('0xc')](_0x11d845['id'],_0x444c19,_0x11d845[_0xdfdb('0x9')])[_0xdfdb('0xd')](function(_0x1ace28){_0x11d845[_0xdfdb('0xe')]=0x0;logger['error'](_0xdfdb('0xf'),inspectError(_0x1ace28));});}exports[_0xdfdb('0xc')]=getContactDialerIvr;function countReScheduled(_0x527c05){return cmHopper[_0xdfdb('0x10')](_0x527c05)[_0xdfdb('0xd')](function(_0x2bee3b){logger[_0xdfdb('0xa')](_0xdfdb('0x11'),inspectError(_0x2bee3b));});}exports[_0xdfdb('0x10')]=countReScheduled;function rescheduleContact(_0xf5d903){return cmHopper[_0xdfdb('0x12')](_0xf5d903)['catch'](function(_0x48a66a){logger[_0xdfdb('0xa')]('[rescheduleContact]',inspectError(_0x48a66a));});}exports[_0xdfdb('0x12')]=rescheduleContact;function unlockContact(_0x9f3039,_0x11a56a,_0x40bc8a){return cmHopper[_0xdfdb('0x13')](_0x9f3039,_0x11a56a,_0x40bc8a)[_0xdfdb('0xd')](function(_0x54ff23){logger['error'](_0xdfdb('0x14'),inspectError(_0x54ff23));});}exports[_0xdfdb('0x13')]=unlockContact;function moveContactManagedDialer(_0x2c1070){return cmHopper['moveContactManagedDialer'](_0x2c1070)[_0xdfdb('0xd')](function(_0xb677b1){logger[_0xdfdb('0xa')](_0xdfdb('0x15'),inspectError(_0xb677b1));});}exports[_0xdfdb('0x16')]=moveContactManagedDialer;function checkIsBlackList(_0x2294de){return cmHopperBlack[_0xdfdb('0x17')](_0x2294de)[_0xdfdb('0xd')](function(_0x5b8cb5){logger[_0xdfdb('0xa')](_0xdfdb('0x18'),inspectError(_0x5b8cb5));});}exports[_0xdfdb('0x17')]=checkIsBlackList;function checkIsBlackListIvr(_0x5cc70b){return cmHopperBlack[_0xdfdb('0x19')](_0x5cc70b)[_0xdfdb('0xd')](function(_0x2c7dd1){logger['error'](_0xdfdb('0x1a'),inspectError(_0x2c7dd1));});}exports[_0xdfdb('0x19')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x334cdd,_0x489fd4,_0x2a80c1){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x334cdd,_0x489fd4,_0x2a80c1)[_0xdfdb('0xd')](function(_0x145350){logger[_0xdfdb('0xa')](_0xdfdb('0x1b'),inspectError(_0x145350));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x4c253e,_0x4363d8,_0x956843){return cmHopperAdditionalPhone[_0xdfdb('0x1c')](_0x4c253e,_0x4363d8,_0x956843)[_0xdfdb('0xd')](function(_0x305954){logger['error'](_0xdfdb('0x1d'),inspectError(_0x305954));});}exports[_0xdfdb('0x1c')]=swapAdditionalPhones;function avgHandleTime(_0xdf3a5c){return cmHopperHistory['avgHandleTime'](_0xdf3a5c)[_0xdfdb('0xd')](function(_0x5df454){logger[_0xdfdb('0xa')](_0xdfdb('0x1e'),inspectError(_0x5df454));});}exports[_0xdfdb('0x1f')]=avgHandleTime;function createHistory(_0x513fa0){return cmHopperHistory['createHistory'](_0x513fa0)[_0xdfdb('0xd')](function(_0xc56435){logger[_0xdfdb('0xa')](_0xdfdb('0x20'),inspectError(_0xc56435));});}exports[_0xdfdb('0x21')]=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 299f31e..9882f56 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 _0x3540=['loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','reachable','unmonitored','TrunkBackup','status','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','match','extractCalleridName','string','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','tags','updatedAt','undefined','description','XMD-','toUpperCase','toString','setXMDContactVariables','lodash','moment','../../../../config/logger','dialer','timezones','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','active','isIVRCampaignActive','milliseconds','seconds','message','available'];(function(_0x52732e,_0x3abb82){var _0x243c98=function(_0x25bb94){while(--_0x25bb94){_0x52732e['push'](_0x52732e['shift']());}};_0x243c98(++_0x3abb82);}(_0x3540,0x92));var _0x0354=function(_0x1bee7a,_0xacfa2a){_0x1bee7a=_0x1bee7a-0x0;var _0x5d69d7=_0x3540[_0x1bee7a];return _0x5d69d7;};'use strict';var _=require(_0x0354('0x0'));var moment=require(_0x0354('0x1'));var util=require('util');var logger=require(_0x0354('0x2'))(_0x0354('0x3'));var timezones=require('../../../../config/environment/shared')[_0x0354('0x4')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x0354('0x5'),'EMPTY_INTERVAL':_0x0354('0x6'),'INACTIVE':_0x0354('0x7'),'NO_AGENTS_LOGGED':_0x0354('0x8'),'NO_AVAILABLE_CONTACTS':_0x0354('0x9'),'NULL_INTERVAL':_0x0354('0xa'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x0354('0xb'),'QUEUE_RECALL':_0x0354('0xc'),'RECALL_TIMEOUT':_0x0354('0xd'),'RUNNING':_0x0354('0xe'),'UNKNOWN_TIMEZONE':_0x0354('0xf'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0x0354('0x10')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x1a5c5f){return _0x1a5c5f[_0x0354('0x11')]===_0x0354('0x12');}exports[_0x0354('0x13')]=isPreviewCampaign;function isIVRCampaign(_0x276c39){return _0x276c39[_0x0354('0x14')]===_0x0354('0x15');}exports[_0x0354('0x16')]=isIVRCampaign;function isOutboundQueue(_0x55d1e0){return _0x55d1e0[_0x0354('0x14')]===_0x0354('0x17');}exports[_0x0354('0x18')]=isOutboundQueue;function isQueueCampaignActive(_0x226fe9){return _0x226fe9[_0x0354('0x19')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x57a83d){return _0x57a83d[_0x0354('0x1a')];}exports[_0x0354('0x1b')]=isIVRCampaignActive;function getSeconds(_0x10b2ad,_0x20e3ec){var _0x509279=moment(_0x10b2ad)[_0x0354('0x1c')](0x0);var _0x39dcf9=moment(_0x20e3ec)[_0x0354('0x1c')](0x0);return _0x509279['diff'](_0x39dcf9,_0x0354('0x1d'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x2f0e40,_0x299f65){var _0x595d88=![];var _0x5b0a69=_0x2f0e40['dialMethod']!==_0x299f65[_0x0354('0x11')]||_0x2f0e40[_0x0354('0x19')]!==_0x299f65[_0x0354('0x19')]||_0x2f0e40['message']!==_0x299f65[_0x0354('0x1e')];var _0x3146e7=_0x2f0e40[_0x0354('0x1f')]!==_0x299f65[_0x0354('0x1f')]||_0x2f0e40[_0x0354('0x20')]!==_0x299f65[_0x0354('0x20')]||_0x2f0e40['loggedInDb']!==_0x299f65[_0x0354('0x21')]||_0x2f0e40[_0x0354('0x22')]!==_0x299f65[_0x0354('0x22')]||_0x2f0e40[_0x0354('0x23')]!==_0x299f65[_0x0354('0x23')]||_0x2f0e40[_0x0354('0x24')]!==_0x299f65['pTalking']||_0x2f0e40['waiting']!==_0x299f65[_0x0354('0x25')]||_0x2f0e40[_0x0354('0x26')]!==_0x299f65[_0x0354('0x26')]||_0x2f0e40[_0x0354('0x27')]!==_0x299f65[_0x0354('0x27')];if(_0x2f0e40[_0x0354('0x28')]&&_0x299f65[_0x0354('0x28')]){_0x595d88=_0x2f0e40[_0x0354('0x28')]['name']!==_0x299f65[_0x0354('0x28')][_0x0354('0x29')]||_0x2f0e40[_0x0354('0x28')][_0x0354('0x1a')]!==_0x299f65['Trunk'][_0x0354('0x1a')];}return _0x5b0a69||_0x3146e7||_0x595d88;}exports[_0x0354('0x2a')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x45da62){var _0x4984ce=null;var _0x8ba5b1=_0x45da62[_0x0354('0x2b')];if(_[_0x0354('0x2c')](_0x45da62[_0x0354('0x2d')])||_['isNil'](_0x45da62[_0x0354('0x2e')])||_[_0x0354('0x2c')](_0x45da62[_0x0354('0x2e')][_0x0354('0x2f')])){_0x4984ce=CAMPAIGN_STATUS[_0x0354('0x30')];}else if(_[_0x0354('0x31')](_0x45da62[_0x0354('0x2d')])||_[_0x0354('0x31')](_0x45da62[_0x0354('0x2e')]['Intervals'])){_0x4984ce=CAMPAIGN_STATUS[_0x0354('0x32')];}else if(_0x8ba5b1&&!timezones[_0x8ba5b1]){_0x4984ce=CAMPAIGN_STATUS[_0x0354('0x33')];}return _0x4984ce;}function checkAnyValidTrunk(_0x317fe2,_0x1507b0){var _0x54753a=null;var _0x2d78c4='SIP/';var _0x2a60e3=[_0x0354('0x34'),_0x0354('0x35')];var _0x5a8ad2=!![];if(_0x317fe2[_0x0354('0x28')]&&_0x317fe2[_0x0354('0x28')][_0x0354('0x1a')]){_0x2d78c4+=_0x317fe2[_0x0354('0x28')]['name'];_0x54753a=_0x1507b0[_0x2d78c4];_0x5a8ad2=_0x2a60e3['includes'](_0x54753a['status']);}else if(_0x317fe2[_0x0354('0x36')]&&_0x317fe2[_0x0354('0x36')][_0x0354('0x1a')]){_0x2d78c4+=_0x317fe2[_0x0354('0x36')]['name'];_0x54753a=_0x1507b0[_0x2d78c4];_0x5a8ad2=_0x2a60e3['includes'](_0x54753a[_0x0354('0x37')]);}return _0x5a8ad2;}function getQueueCampaignStatusMessage(_0x4d5a53,_0x27c7a0){var _0xbbce55=CAMPAIGN_STATUS['ACTIVE'];var _0x2f9eec=isPreviewCampaign(_0x4d5a53);if(!isQueueCampaignActive(_0x4d5a53)){if(_0x2f9eec){_0xbbce55=CAMPAIGN_STATUS[_0x0354('0x38')];}else{if(_0x4d5a53[_0x0354('0x27')]===0x0&&_0x4d5a53[_0x0354('0x23')]===0x0&&_0x4d5a53[_0x0354('0x25')]===0x0&&(_0x4d5a53[_0x0354('0x24')]||0x0)===0x0){_0xbbce55=CAMPAIGN_STATUS[_0x0354('0x38')];}else{_0xbbce55=CAMPAIGN_STATUS[_0x0354('0x39')];}}}else if(_0x4d5a53[_0x0354('0x20')]===0x0){_0xbbce55=CAMPAIGN_STATUS[_0x0354('0x3a')];}else if(!checkAnyValidTrunk(_0x4d5a53,_0x27c7a0)){_0xbbce55=CAMPAIGN_STATUS[_0x0354('0x3b')];}else if(!isPreviewCampaign(_0x4d5a53)){var _0x4fe875=checkAnyValidQueueCampaignInterval(_0x4d5a53);if(_0x4fe875){_0xbbce55=_0x4fe875;}}return _0xbbce55;}exports[_0x0354('0x3c')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x42e600){var _0x3ad9ad=CAMPAIGN_STATUS[_0x0354('0x39')];if(_0x42e600[_0x0354('0x27')]===0x0&&_0x42e600['talking']===0x0&&_0x42e600[_0x0354('0x25')]===0x0&&(_0x42e600[_0x0354('0x24')]||0x0)===0x0){_0x3ad9ad=CAMPAIGN_STATUS[_0x0354('0x38')];}return _0x3ad9ad;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0xebc667){var _0xcd22fe=_0xebc667[_0x0354('0x3d')](/"(.*?)"/);return _0xcd22fe?_0xcd22fe[0x1]:_0xebc667;}exports[_0x0354('0x3e')]=extractCalleridName;function getCallerId(_0x867a6d,_0x2f7938,_0x5a26fb){if(!_['isUndefined'](_0x5a26fb)&&typeof _0x5a26fb===_0x0354('0x3f')&&!_[_0x0354('0x31')](_0x5a26fb)){if(!_[_0x0354('0x40')](_0x2f7938)&&typeof _0x2f7938===_0x0354('0x3f')&&!_[_0x0354('0x31')](_0x2f7938)){return util[_0x0354('0x41')](_0x0354('0x42'),_0x2f7938,_0x5a26fb);}return util[_0x0354('0x41')](_0x0354('0x42'),_0x5a26fb,_0x5a26fb);}if(!_[_0x0354('0x40')](_0x867a6d)&&typeof _0x867a6d==='string'&&!_[_0x0354('0x31')](_0x867a6d)){return _0x867a6d;}return _0x0354('0x43');}exports[_0x0354('0x44')]=getCallerId;function getCallerIdRandom(_0x1366f1,_0x3b00c3){var _0x5e0d24;var _0x27595f;var _0x5cfa7;if(_0x3b00c3<=0x0){_0x3b00c3=0x1;}_0x5e0d24=new RegExp(_0x0354('0x45')+_0x3b00c3+'}$');_0x27595f=Math[_0x0354('0x46')](0xa,_0x3b00c3-0x1);_0x5cfa7=Math[_0x0354('0x46')](0xa,_0x3b00c3)-0x1;return util[_0x0354('0x41')]('%s',_[_0x0354('0x47')](_0x1366f1,_0x5e0d24,_[_0x0354('0x48')](_0x27595f,_0x5cfa7)['toString']()));}exports[_0x0354('0x49')]=getCallerIdRandom;function decrementOriginate(_0x3b2aba){if(_0x3b2aba[_0x0354('0x27')]&&_0x3b2aba[_0x0354('0x27')]>0x0){_0x3b2aba['originated']-=0x1;}else{logger['error'](_0x0354('0x4a'));}}exports[_0x0354('0x4b')]=decrementOriginate;function checkContactEmpty(_0x1639eb){return _0x1639eb&&_0x1639eb[_0x0354('0x4c')]>0x0;}exports[_0x0354('0x4d')]=checkContactEmpty;function erlangb(_0x487cc5,_0x57c96f){if(_0x57c96f===0x0){return 0x0;}var _0xbaea31=0x1;for(var _0x465b8=0x1;_0x465b8<=_0x57c96f;_0x465b8+=0x1){_0xbaea31=0x1+_0xbaea31*_0x465b8/_0x487cc5;}return 0x1/_0xbaea31;}exports[_0x0354('0x4e')]=erlangb;function checkContactLowerLimitOriginate(_0x56732c,_0x4c8d74,_0x1820d6){if(_0x4c8d74>_0x1820d6){for(var _0x4889ca=0x0;_0x4889ca<_0x4c8d74-_0x1820d6;_0x4889ca+=0x1){decrementOriginate(_0x56732c);}}}exports[_0x0354('0x4f')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x5b93e4){var _0x55fbf2={};var _0x3111ae=['id',_0x0354('0x50'),_0x0354('0x51'),_0x0354('0x52')];const _0x7a884c=0xfa;if(_0x5b93e4){for(var _0x28356a in _0x5b93e4){if(typeof _0x5b93e4[_0x28356a]!==_0x0354('0x53')){if(!_[_0x0354('0x2c')](_0x5b93e4[_0x28356a])&&!_0x3111ae['includes'](_0x28356a)){if(_0x28356a===_0x0354('0x54')&&_0x5b93e4[_0x28356a][_0x0354('0x4c')]>_0x7a884c){_0x55fbf2[_0x0354('0x55')+_0x28356a[_0x0354('0x56')]()]=_0x5b93e4[_0x28356a][_0x0354('0x57')]()['substring'](0x0,_0x7a884c);}else{_0x55fbf2['XMD-'+_0x28356a[_0x0354('0x56')]()]=_0x5b93e4[_0x28356a];}}}}}return _0x55fbf2;}exports[_0x0354('0x58')]=setXMDContactVariables; \ No newline at end of file +var _0x2a65=['AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','getSeconds','dialActive','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','dialTimezone','isNil','dialGlobalInterval','Interval','NULL_INTERVAL','isEmpty','Intervals','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','extractCalleridName','isUndefined','string','format','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','checkContactLowerLimitOriginate','createdAt','updatedAt','undefined','description','XMD-','toUpperCase','setXMDContactVariables','moment','util','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE'];(function(_0x1864af,_0x435d6c){var _0x43e614=function(_0x15ee0c){while(--_0x15ee0c){_0x1864af['push'](_0x1864af['shift']());}};_0x43e614(++_0x435d6c);}(_0x2a65,0x101));var _0x52a6=function(_0x5d8987,_0x14d054){_0x5d8987=_0x5d8987-0x0;var _0x2997eb=_0x2a65[_0x5d8987];return _0x2997eb;};'use strict';var _=require('lodash');var moment=require(_0x52a6('0x0'));var util=require(_0x52a6('0x1'));var logger=require('../../../../config/logger')('dialer');var timezones=require('../../../../config/environment/shared')[_0x52a6('0x2')];var CAMPAIGN_STATUS={'ACTIVE':_0x52a6('0x3'),'BLACKLIST':_0x52a6('0x4'),'CONTACTS_RESCHEDULED':_0x52a6('0x5'),'DEACTIVATED':_0x52a6('0x6'),'DISACTIVED':_0x52a6('0x7'),'EMPTY_INTERVAL':_0x52a6('0x8'),'INACTIVE':_0x52a6('0x9'),'NO_AGENTS_LOGGED':_0x52a6('0xa'),'NO_AVAILABLE_CONTACTS':_0x52a6('0xb'),'NULL_INTERVAL':_0x52a6('0xc'),'OVERTIME_INTERVAL':_0x52a6('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0x52a6('0xe'),'QUEUE_RECALL':_0x52a6('0xf'),'RECALL_TIMEOUT':_0x52a6('0x10'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0x52a6('0x11'),'UNREACHABLE_TRUNK':_0x52a6('0x12')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x28cc4f){return _0x28cc4f[_0x52a6('0x13')]===_0x52a6('0x14');}exports[_0x52a6('0x15')]=isPreviewCampaign;function isIVRCampaign(_0x3c44ca){return _0x3c44ca[_0x52a6('0x16')]===_0x52a6('0x17');}exports[_0x52a6('0x18')]=isIVRCampaign;function isOutboundQueue(_0xa5b702){return _0xa5b702[_0x52a6('0x16')]===_0x52a6('0x19');}exports[_0x52a6('0x1a')]=isOutboundQueue;function isQueueCampaignActive(_0x30f413){return _0x30f413['dialActive'];}exports[_0x52a6('0x1b')]=isQueueCampaignActive;function isIVRCampaignActive(_0x338ac5){return _0x338ac5[_0x52a6('0x1c')];}exports[_0x52a6('0x1d')]=isIVRCampaignActive;function getSeconds(_0x4557c2,_0x152e00){var _0x18b1a0=moment(_0x4557c2)[_0x52a6('0x1e')](0x0);var _0x2cb0fa=moment(_0x152e00)[_0x52a6('0x1e')](0x0);return _0x18b1a0[_0x52a6('0x1f')](_0x2cb0fa,'seconds');}exports[_0x52a6('0x20')]=getSeconds;function hasQueueCampaignDataChanged(_0x43ac50,_0x51c764){var _0x2a614e=![];var _0x52a62d=_0x43ac50['dialMethod']!==_0x51c764[_0x52a6('0x13')]||_0x43ac50[_0x52a6('0x21')]!==_0x51c764[_0x52a6('0x21')]||_0x43ac50[_0x52a6('0x22')]!==_0x51c764[_0x52a6('0x22')];var _0x4ee993=_0x43ac50[_0x52a6('0x23')]!==_0x51c764[_0x52a6('0x23')]||_0x43ac50['loggedIn']!==_0x51c764[_0x52a6('0x24')]||_0x43ac50[_0x52a6('0x25')]!==_0x51c764['loggedInDb']||_0x43ac50[_0x52a6('0x26')]!==_0x51c764[_0x52a6('0x26')]||_0x43ac50[_0x52a6('0x27')]!==_0x51c764[_0x52a6('0x27')]||_0x43ac50[_0x52a6('0x28')]!==_0x51c764[_0x52a6('0x28')]||_0x43ac50[_0x52a6('0x29')]!==_0x51c764[_0x52a6('0x29')]||_0x43ac50[_0x52a6('0x2a')]!==_0x51c764['inUse']||_0x43ac50[_0x52a6('0x2b')]!==_0x51c764[_0x52a6('0x2b')];if(_0x43ac50[_0x52a6('0x2c')]&&_0x51c764[_0x52a6('0x2c')]){_0x2a614e=_0x43ac50[_0x52a6('0x2c')]['name']!==_0x51c764[_0x52a6('0x2c')][_0x52a6('0x2d')]||_0x43ac50[_0x52a6('0x2c')][_0x52a6('0x1c')]!==_0x51c764[_0x52a6('0x2c')][_0x52a6('0x1c')];}return _0x52a62d||_0x4ee993||_0x2a614e;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x1776fb){var _0x2eda17=null;var _0x209b86=_0x1776fb[_0x52a6('0x2e')];if(_[_0x52a6('0x2f')](_0x1776fb[_0x52a6('0x30')])||_[_0x52a6('0x2f')](_0x1776fb[_0x52a6('0x31')])||_[_0x52a6('0x2f')](_0x1776fb['Interval']['Intervals'])){_0x2eda17=CAMPAIGN_STATUS[_0x52a6('0x32')];}else if(_['isEmpty'](_0x1776fb[_0x52a6('0x30')])||_[_0x52a6('0x33')](_0x1776fb[_0x52a6('0x31')][_0x52a6('0x34')])){_0x2eda17=CAMPAIGN_STATUS[_0x52a6('0x35')];}else if(_0x209b86&&!timezones[_0x209b86]){_0x2eda17=CAMPAIGN_STATUS[_0x52a6('0x36')];}return _0x2eda17;}function checkAnyValidTrunk(_0x5ae33e,_0x522881){var _0x52f1c5=null;var _0xd0bfb3='SIP/';var _0x484617=[_0x52a6('0x37'),_0x52a6('0x38')];var _0x3884da=!![];if(_0x5ae33e['Trunk']&&_0x5ae33e[_0x52a6('0x2c')][_0x52a6('0x1c')]){_0xd0bfb3+=_0x5ae33e[_0x52a6('0x2c')][_0x52a6('0x2d')];_0x52f1c5=_0x522881[_0xd0bfb3];_0x3884da=_0x484617[_0x52a6('0x39')](_0x52f1c5[_0x52a6('0x3a')]);}else if(_0x5ae33e[_0x52a6('0x3b')]&&_0x5ae33e[_0x52a6('0x3b')][_0x52a6('0x1c')]){_0xd0bfb3+=_0x5ae33e['TrunkBackup'][_0x52a6('0x2d')];_0x52f1c5=_0x522881[_0xd0bfb3];_0x3884da=_0x484617['includes'](_0x52f1c5[_0x52a6('0x3a')]);}return _0x3884da;}function getQueueCampaignStatusMessage(_0x256b79,_0x35a715){var _0x1229ee=CAMPAIGN_STATUS[_0x52a6('0x3')];var _0x58abaa=isPreviewCampaign(_0x256b79);if(!isQueueCampaignActive(_0x256b79)){if(_0x58abaa){_0x1229ee=CAMPAIGN_STATUS[_0x52a6('0x3c')];}else{if(_0x256b79[_0x52a6('0x2b')]===0x0&&_0x256b79[_0x52a6('0x27')]===0x0&&_0x256b79[_0x52a6('0x29')]===0x0&&(_0x256b79[_0x52a6('0x28')]||0x0)===0x0){_0x1229ee=CAMPAIGN_STATUS[_0x52a6('0x3c')];}else{_0x1229ee=CAMPAIGN_STATUS[_0x52a6('0x3d')];}}}else if(_0x256b79[_0x52a6('0x24')]===0x0){_0x1229ee=CAMPAIGN_STATUS[_0x52a6('0x3e')];}else if(!checkAnyValidTrunk(_0x256b79,_0x35a715)){_0x1229ee=CAMPAIGN_STATUS[_0x52a6('0x3f')];}else if(!isPreviewCampaign(_0x256b79)){var _0x161bb4=checkAnyValidQueueCampaignInterval(_0x256b79);if(_0x161bb4){_0x1229ee=_0x161bb4;}}return _0x1229ee;}exports[_0x52a6('0x40')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x2e96bc){var _0xfc9e70=CAMPAIGN_STATUS['DISACTIVED'];if(_0x2e96bc[_0x52a6('0x2b')]===0x0&&_0x2e96bc[_0x52a6('0x27')]===0x0&&_0x2e96bc[_0x52a6('0x29')]===0x0&&(_0x2e96bc['pTalking']||0x0)===0x0){_0xfc9e70=CAMPAIGN_STATUS[_0x52a6('0x3c')];}return _0xfc9e70;}exports[_0x52a6('0x41')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0xbc6be0){var _0x16b20d=_0xbc6be0['match'](/"(.*?)"/);return _0x16b20d?_0x16b20d[0x1]:_0xbc6be0;}exports[_0x52a6('0x42')]=extractCalleridName;function getCallerId(_0xed10b9,_0x20d678,_0x20a387){if(!_[_0x52a6('0x43')](_0x20a387)&&typeof _0x20a387===_0x52a6('0x44')&&!_[_0x52a6('0x33')](_0x20a387)){if(!_[_0x52a6('0x43')](_0x20d678)&&typeof _0x20d678==='string'&&!_[_0x52a6('0x33')](_0x20d678)){return util[_0x52a6('0x45')]('\x22%s\x22\x20<%s>',_0x20d678,_0x20a387);}return util[_0x52a6('0x45')]('\x22%s\x22\x20<%s>',_0x20a387,_0x20a387);}if(!_[_0x52a6('0x43')](_0xed10b9)&&typeof _0xed10b9==='string'&&!_[_0x52a6('0x33')](_0xed10b9)){return _0xed10b9;}return'\x22\x22\x20<>';}exports[_0x52a6('0x46')]=getCallerId;function getCallerIdRandom(_0x2fb245,_0xf6e6dd){var _0x467862;var _0x441539;var _0x472eab;if(_0xf6e6dd<=0x0){_0xf6e6dd=0x1;}_0x467862=new RegExp(_0x52a6('0x47')+_0xf6e6dd+'}$');_0x441539=Math[_0x52a6('0x48')](0xa,_0xf6e6dd-0x1);_0x472eab=Math[_0x52a6('0x48')](0xa,_0xf6e6dd)-0x1;return util[_0x52a6('0x45')]('%s',_[_0x52a6('0x49')](_0x2fb245,_0x467862,_[_0x52a6('0x4a')](_0x441539,_0x472eab)[_0x52a6('0x4b')]()));}exports[_0x52a6('0x4c')]=getCallerIdRandom;function decrementOriginate(_0xe8e4cc){if(_0xe8e4cc[_0x52a6('0x2b')]&&_0xe8e4cc[_0x52a6('0x2b')]>0x0){_0xe8e4cc[_0x52a6('0x2b')]-=0x1;}else{logger['error'](_0x52a6('0x4d'));}}exports[_0x52a6('0x4e')]=decrementOriginate;function checkContactEmpty(_0x4b6674){return _0x4b6674&&_0x4b6674[_0x52a6('0x4f')]>0x0;}exports[_0x52a6('0x50')]=checkContactEmpty;function erlangb(_0x56f3b2,_0x4b5cca){if(_0x4b5cca===0x0){return 0x0;}var _0x50b1ba=0x1;for(var _0x59bdf8=0x1;_0x59bdf8<=_0x4b5cca;_0x59bdf8+=0x1){_0x50b1ba=0x1+_0x50b1ba*_0x59bdf8/_0x56f3b2;}return 0x1/_0x50b1ba;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x490b6f,_0x506f99,_0x3fe07a){if(_0x506f99>_0x3fe07a){for(var _0x42b579=0x0;_0x42b579<_0x506f99-_0x3fe07a;_0x42b579+=0x1){decrementOriginate(_0x490b6f);}}}exports[_0x52a6('0x51')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x3655bf){var _0x165987={};var _0x23f90f=['id',_0x52a6('0x52'),'tags',_0x52a6('0x53')];const _0x6673f6=0xfa;if(_0x3655bf){for(var _0x168ee0 in _0x3655bf){if(typeof _0x3655bf[_0x168ee0]!==_0x52a6('0x54')){if(!_[_0x52a6('0x2f')](_0x3655bf[_0x168ee0])&&!_0x23f90f[_0x52a6('0x39')](_0x168ee0)){if(_0x168ee0===_0x52a6('0x55')&&_0x3655bf[_0x168ee0][_0x52a6('0x4f')]>_0x6673f6){_0x165987[_0x52a6('0x56')+_0x168ee0[_0x52a6('0x57')]()]=_0x3655bf[_0x168ee0][_0x52a6('0x4b')]()['substring'](0x0,_0x6673f6);}else{_0x165987[_0x52a6('0x56')+_0x168ee0['toUpperCase']()]=_0x3655bf[_0x168ee0];}}}}}return _0x165987;}exports[_0x52a6('0x58')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 59de0e4..5bfb40d 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(_0x3f4875,_0x1eee06){var _0x1727cf=function(_0x92fc15){while(--_0x92fc15){_0x3f4875['push'](_0x3f4875['shift']());}};_0x1727cf(++_0x1eee06);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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(_0xafd01e,_0x3ba3ec){var _0x5e0d3c=function(_0x47ca3d){while(--_0x47ca3d){_0xafd01e['push'](_0xafd01e['shift']());}};_0x5e0d3c(++_0x3ba3ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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 f28c5b6..2601099 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 _0x39fd=['[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','path','execute','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','.pdf','isTrunkReachable','isNil','active','SIP/%s','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','bluebird','moment','./util/gs','fax','../ami','./channel','./util/util','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','bind','syncVarSet','newstate','syncNewState','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','[Fax][Message][Error][Updated]','logger'];(function(_0x39b5c7,_0x59e89e){var _0x594a85=function(_0x78002){while(--_0x78002){_0x39b5c7['push'](_0x39b5c7['shift']());}};_0x594a85(++_0x59e89e);}(_0x39fd,0xa2));var _0xd39f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x39fd[_0x4a9fb1];return _0x348672;};'use strict';var util=require(_0xd39f('0x0'));var _=require(_0xd39f('0x1'));var BPromise=require(_0xd39f('0x2'));var uuid=require('uuid');var moment=require(_0xd39f('0x3'));var path=require('path');var tiff2pdf=require('tiff2pdf');var gs=require(_0xd39f('0x4'));var logger=require('../../../config/logger')(_0xd39f('0x5'));var ami=require(_0xd39f('0x6'));var rpcDb=require('./rpcDb');var Channel=require(_0xd39f('0x7'));var ut=require(_0xd39f('0x8'));var Action=require(_0xd39f('0x9'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xd39f('0xa'));var faxMessage=require(_0xd39f('0xb'));function Fax(_0x5ecb24){this[_0xd39f('0xc')]={};this['faxAccounts']=_0x5ecb24[_0xd39f('0xd')];this['trunks']=_0x5ecb24[_0xd39f('0xe')];this[_0xd39f('0xf')]={};ami['on'](_0xd39f('0x10'),this['syncNewchannel'][_0xd39f('0x11')](this));ami['on']('varset',this[_0xd39f('0x12')][_0xd39f('0x11')](this));ami['on'](_0xd39f('0x13'),this[_0xd39f('0x14')]['bind'](this));ami['on']('newexten',this['syncNewExten'][_0xd39f('0x11')](this));ami['on']('faxstatus',this[_0xd39f('0x15')][_0xd39f('0x11')](this));ami['on'](_0xd39f('0x16'),this[_0xd39f('0x17')][_0xd39f('0x11')](this));ami['on'](_0xd39f('0x18'),this[_0xd39f('0x19')]['bind'](this));ami['on'](_0xd39f('0x1a'),this[_0xd39f('0x1b')]['bind'](this));}Fax[_0xd39f('0x1c')]['syncNewchannel']=function(_0xb3c112){if(_0xb3c112[_0xd39f('0x1d')]===_0xd39f('0x1e')){for(var _0x3e1a71 in this[_0xd39f('0xd')]){if(this[_0xd39f('0xd')][_0xd39f('0x1f')](_0x3e1a71)){if(_0xb3c112['exten']===this['faxAccounts'][_0x3e1a71][_0xd39f('0x20')]){this['channels'][_0xb3c112['uniqueid']]={};this[_0xd39f('0xc')][_0xb3c112[_0xd39f('0x21')]][_0xd39f('0x22')]=_0xb3c112[_0xd39f('0x22')];this[_0xd39f('0xc')][_0xb3c112[_0xd39f('0x21')]]['id']=this[_0xd39f('0xd')][_0x3e1a71]['id'];this[_0xd39f('0xc')][_0xb3c112['uniqueid']][_0xd39f('0x23')]=this[_0xd39f('0xd')][_0x3e1a71]['name'];logger['info'](_0xb3c112[_0xd39f('0x21')],_0xd39f('0x24'));}}}}if(this[_0xd39f('0xf')][_0xb3c112[_0xd39f('0x21')]]){this[_0xd39f('0xc')][_0xb3c112['uniqueid']]={};this['channels'][_0xb3c112[_0xd39f('0x21')]][_0xd39f('0x22')]=_0xb3c112[_0xd39f('0x22')];logger[_0xd39f('0x25')](_0xb3c112[_0xd39f('0x21')],_0xd39f('0x24'));}};Fax['prototype'][_0xd39f('0x12')]=function(_0x46e542){if(this[_0xd39f('0xc')][_0x46e542['uniqueid']]){for(var _0xfa8161 in _0x46e542[_0xd39f('0x26')]){if(_0x46e542[_0xd39f('0x26')][_0xd39f('0x1f')](_0xfa8161)){this[_0xd39f('0xc')][_0x46e542[_0xd39f('0x21')]][_0xfa8161]=_0x46e542[_0xd39f('0x27')];}}}};Fax[_0xd39f('0x1c')]['syncNewState']=function(_0x4a6ec6){if(this[_0xd39f('0xc')][_0x4a6ec6[_0xd39f('0x21')]]){this['channels'][_0x4a6ec6['uniqueid']][_0xd39f('0x28')]=_0x4a6ec6[_0xd39f('0x28')];this['channels'][_0x4a6ec6['uniqueid']][_0xd39f('0x29')]=_0x4a6ec6[_0xd39f('0x29')];}};Fax[_0xd39f('0x1c')][_0xd39f('0x2a')]=function(_0x6f9232){if(this[_0xd39f('0xc')][_0x6f9232[_0xd39f('0x21')]]){for(var _0x1a22ab in _0x6f9232[_0xd39f('0x26')]){if(_0x6f9232[_0xd39f('0x26')][_0xd39f('0x1f')](_0x1a22ab)){this['channels'][_0x6f9232[_0xd39f('0x21')]][_0x1a22ab]=_0x6f9232['value'];}}}};Fax[_0xd39f('0x1c')][_0xd39f('0x15')]=function(_0x1b95d8){if(this[_0xd39f('0xc')][_0x1b95d8['uniqueid']]){this['channels'][_0x1b95d8[_0xd39f('0x21')]][_0xd39f('0x2b')]=_0x1b95d8[_0xd39f('0x2b')];this[_0xd39f('0xc')][_0x1b95d8[_0xd39f('0x21')]]['status']=_0x1b95d8[_0xd39f('0x2c')];this[_0xd39f('0xc')][_0x1b95d8[_0xd39f('0x21')]][_0xd39f('0x20')]=_0x1b95d8['localstationid'];this[_0xd39f('0xc')][_0x1b95d8[_0xd39f('0x21')]][_0xd39f('0x2d')]=_0x1b95d8[_0xd39f('0x2d')];logger[_0xd39f('0x25')](_0x1b95d8[_0xd39f('0x21')],_0xd39f('0x2e'));}};Fax[_0xd39f('0x1c')][_0xd39f('0x17')]=function(_0x41d09e){var _0x3ffa71=this;if(this['channels'][_0x41d09e['uniqueid']]){var _0x40531e=this[_0xd39f('0xc')][_0x41d09e[_0xd39f('0x21')]]['id'];this[_0xd39f('0xc')][_0x41d09e[_0xd39f('0x21')]][_0xd39f('0x2f')]=_0x41d09e[_0xd39f('0x2f')];this[_0xd39f('0xc')][_0x41d09e[_0xd39f('0x21')]]['pagestransferred']=_0x41d09e[_0xd39f('0x30')];this[_0xd39f('0xc')][_0x41d09e[_0xd39f('0x21')]][_0xd39f('0x20')]=_0x41d09e[_0xd39f('0x20')];this[_0xd39f('0xc')][_0x41d09e[_0xd39f('0x21')]]['resolution']=_0x41d09e['resolution'];this[_0xd39f('0xc')][_0x41d09e[_0xd39f('0x21')]]['transferrate']=_0x41d09e[_0xd39f('0x31')];this[_0xd39f('0xc')][_0x41d09e[_0xd39f('0x21')]]['filename']=_0x41d09e[_0xd39f('0x2d')];this[_0xd39f('0xc')][_0x41d09e[_0xd39f('0x21')]][_0xd39f('0x32')]=_0x41d09e['calleridnum'];if(this['channels'][_0x41d09e[_0xd39f('0x21')]]['pagestransferred']>0x0){tiff2pdf(_0x41d09e['filename'],_0xd39f('0x33'),function(_0x510eea){logger[_0xd39f('0x25')](_0x41d09e[_0xd39f('0x21')],_0xd39f('0x34'),_0x510eea[_0xd39f('0x35')]);attachment['create']({'name':path[_0xd39f('0x36')](_0x41d09e[_0xd39f('0x2d')])[_0xd39f('0x23')],'basename':path[_0xd39f('0x36')](_0x41d09e[_0xd39f('0x2d')])[_0xd39f('0x23')]+'.pdf','type':'application/pdf'})[_0xd39f('0x37')](function(_0x17ee6e){faxAccount[_0xd39f('0x38')](_0x40531e,{'from':_0x41d09e[_0xd39f('0x32')],'mapKey':'fax','body':path[_0xd39f('0x36')](_0x41d09e[_0xd39f('0x2d')])[_0xd39f('0x23')]+'.pdf','AttachmentId':_0x17ee6e['id']})[_0xd39f('0x39')](function(_0x25f2d3){logger[_0xd39f('0x3a')](_0x41d09e[_0xd39f('0x21')],_0xd39f('0x3b'),JSON[_0xd39f('0x3c')](_0x25f2d3));});})['catch'](function(_0x5674a2){logger['error'](_0x41d09e[_0xd39f('0x21')],_0xd39f('0x3d'),JSON[_0xd39f('0x3c')](_0x5674a2));});});}logger['info'](_0x41d09e['uniqueid'],'\x20receiveFax\x20');}};Fax[_0xd39f('0x1c')]['syncOriginateResponse']=function(_0x3d08f9){if(this[_0xd39f('0xf')][_0x3d08f9[_0xd39f('0x21')]]){_[_0xd39f('0x3e')](this['channels'][_0x3d08f9[_0xd39f('0x21')]],_[_0xd39f('0x3f')](_0x3d08f9,[_0xd39f('0x40'),_0xd39f('0x41')]));}};function updateStatus(_0x234e2b){if(_0x234e2b[_0xd39f('0x42')]){faxMessage[_0xd39f('0x43')](_0x234e2b[_0xd39f('0x42')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xd39f('0x37')](function(_0x50cb1d){ut['logger'](_0xd39f('0x44'),_0x50cb1d);})[_0xd39f('0x39')](function(_0x43902f){ut[_0xd39f('0x45')](_0xd39f('0x46'),_0x43902f);});}else{ut[_0xd39f('0x45')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0xd39f('0x1c')][_0xd39f('0x47')]=function(_0x68e448,_0x2eeb18,_0x5c9941){var _0xd9f56b=this;var _0x12a932={};if(_0x2eeb18){_0x12a932={'read':_0x2eeb18};}else{_0x12a932={'failMessage':_0x5c9941};}if(this[_0xd39f('0xf')][_0x68e448]['AttachmentId']){faxMessage[_0xd39f('0x43')](this['actions'][_0x68e448]['AttachmentId'],_0x12a932)[_0xd39f('0x37')](function(_0x26e9c3){ut['logger'](_0xd39f('0x48'),_0x26e9c3);})['catch'](function(_0x53f381){ut['logger']('[Fax][Message][NoUpdate1]',_0x53f381);})[_0xd39f('0x49')](function(){delete _0xd9f56b[_0xd39f('0xc')][_0x68e448];delete _0xd9f56b[_0xd39f('0xf')][_0x68e448];});}else{ut[_0xd39f('0x45')](_0xd39f('0x4a'));this[_0xd39f('0x4b')](_0x68e448);delete this[_0xd39f('0xf')][_0x68e448];}};Fax[_0xd39f('0x1c')]['syncHangup']=function(_0x439b9f){var _0x200e83=this;if(this['channels'][_0x439b9f[_0xd39f('0x21')]]){if(this[_0xd39f('0xf')][_0x439b9f[_0xd39f('0x21')]]){this[_0xd39f('0xc')][_0x439b9f['uniqueid']]['id']=this['actions'][_0x439b9f[_0xd39f('0x21')]]['id'];this['channels'][_0x439b9f[_0xd39f('0x21')]]['name']=this[_0xd39f('0xf')][_0x439b9f[_0xd39f('0x21')]][_0xd39f('0x23')];}logger[_0xd39f('0x25')](_0x439b9f[_0xd39f('0x21')],this[_0xd39f('0xf')][_0x439b9f[_0xd39f('0x21')]]?_0xd39f('0x4c'):_0xd39f('0x4d'),JSON[_0xd39f('0x3c')](this[_0xd39f('0xc')][_0x439b9f[_0xd39f('0x21')]]));if(this[_0xd39f('0xf')][_0x439b9f[_0xd39f('0x21')]]){if(this[_0xd39f('0xc')][_0x439b9f[_0xd39f('0x21')]][_0xd39f('0x4e')]>0x0&&this[_0xd39f('0xc')][_0x439b9f[_0xd39f('0x21')]][_0xd39f('0x4f')]===_0xd39f('0x50')){this[_0xd39f('0x47')](_0x439b9f[_0xd39f('0x21')],!![]);}else{this[_0xd39f('0x47')](_0x439b9f[_0xd39f('0x21')],![],this[_0xd39f('0xc')][_0x439b9f[_0xd39f('0x21')]][_0xd39f('0x51')]?_0xd39f('0x52')+this[_0xd39f('0xc')][_0x439b9f[_0xd39f('0x21')]][_0xd39f('0x51')]:_0xd39f('0x53'));}}}};Fax['prototype'][_0xd39f('0x54')]=function(_0x4a6c0e){var _0xb1271e=this;return new BPromise(function(_0x52450f,_0x31068a){_0xb1271e[_0xd39f('0x55')](_0x4a6c0e,_0xb1271e[_0xd39f('0xd')][_0x4a6c0e['FaxAccountId']])['then'](function(_0x377c5e){ut[_0xd39f('0x45')](_0xd39f('0x56'),_0x377c5e);_0x52450f(ut['message'](_0xd39f('0x57')));})[_0xd39f('0x39')](function(_0x4ea63f){ut[_0xd39f('0x45')](_0xd39f('0x58'),_0x4ea63f);updateStatus(_0x4a6c0e);_0x31068a(ut['message'](_0xd39f('0x59')));});});};Fax[_0xd39f('0x1c')]['checkAfterSend']=function(_0x1f8e42){var _0x589200=this;return new BPromise(function(_0x4a3c93,_0xb9ecb4){var _0x193cd1=_0x589200[_0xd39f('0x5a')](_0x589200[_0xd39f('0xd')][_0x1f8e42['FaxAccountId']][_0xd39f('0x5b')],_0x1f8e42);if(_0x193cd1[_0xd39f('0x5c')]){_0x4a3c93(ut['message'](_0xd39f('0x5d')));}else{_0xb9ecb4(ut[_0xd39f('0x35')](_0x193cd1[_0xd39f('0x35')]));}});};function originate(_0x526061,_0x3cb5db,_0x5c6537){return new BPromise(function(_0x1f9081,_0x344ce8){if(_0x5c6537){var _0x31ee53=util[_0xd39f('0x5e')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0xd39f('0x36')](_0x526061[_0xd39f('0x5f')])[_0xd39f('0x23')],_0x526061[_0xd39f('0x5f')]);gs[_0xd39f('0x60')](_0x31ee53)[_0xd39f('0x37')](function(){_0x526061[_0xd39f('0x5f')]=util[_0xd39f('0x5e')]('%s/%s.tif',path[_0xd39f('0x36')](_0x526061[_0xd39f('0x5f')])[_0xd39f('0x61')],path[_0xd39f('0x36')](_0x526061[_0xd39f('0x5f')])[_0xd39f('0x23')]);_0x3cb5db['XMF-PATH']=_0x526061[_0xd39f('0x5f')];ut['logger'](_0xd39f('0x62'),'');ami['Action'](ut['variablesAction'](_0x526061,_0x3cb5db))[_0xd39f('0x37')](function(_0x3f3b33){_0x1f9081(_0x3f3b33);})['catch'](function(_0x420791){_0x344ce8(_0x420791);});})[_0xd39f('0x39')](function(_0x4e8575){_0x344ce8(_0x4e8575);});}else{ami[_0xd39f('0x63')](ut[_0xd39f('0x64')](_0x526061,_0x3cb5db))['then'](function(_0x4a5f06){_0x1f9081(_0x4a5f06);})[_0xd39f('0x39')](function(_0x578721){_0x344ce8(_0x578721);});}});}Fax[_0xd39f('0x1c')][_0xd39f('0x55')]=function(_0x139e66,_0x2b34a){var _0x1bc8c2=this;return new BPromise(function(_0x4533a7,_0x55f13a){var _0x41c110=uuid['v4']();var _0x2be5e3=ut[_0xd39f('0x65')](_0x139e66,_0x2b34a);_0x1bc8c2['actions'][_0x41c110]=new Action(_0x41c110,_0x2b34a,_0x139e66);var _0x2b9a84=_0x1bc8c2[_0xd39f('0xf')][_0x41c110];if(path[_0xd39f('0x36')](_0x139e66[_0xd39f('0x5f')])[_0xd39f('0x66')]===_0xd39f('0x67')){originate(_0x2b9a84,_0x2be5e3,!![])[_0xd39f('0x37')](function(_0x4ef0e1){_0x4533a7(_0x4ef0e1);})['catch'](function(_0x30460a){_0x55f13a(_0x30460a);});}else{originate(_0x2b9a84,_0x2be5e3,![])[_0xd39f('0x37')](function(_0x33165b){_0x4533a7(_0x33165b);})[_0xd39f('0x39')](function(_0x19c40c){_0x55f13a(_0x19c40c);});}});};Fax[_0xd39f('0x1c')][_0xd39f('0x68')]=function(_0x59c33c){return!_[_0xd39f('0x69')](_0x59c33c)&&!_[_0xd39f('0x69')](_0x59c33c['name'])&&!_[_0xd39f('0x69')](_0x59c33c[_0xd39f('0x6a')])&&_0x59c33c[_0xd39f('0x6a')]&&!_[_0xd39f('0x69')](this['trunks'][util[_0xd39f('0x5e')](_0xd39f('0x6b'),_0x59c33c['name'])])&&!_['isNil'](this[_0xd39f('0xe')][util[_0xd39f('0x5e')](_0xd39f('0x6b'),_0x59c33c[_0xd39f('0x23')])][_0xd39f('0x2c')])&&(this[_0xd39f('0xe')][util[_0xd39f('0x5e')](_0xd39f('0x6b'),_0x59c33c[_0xd39f('0x23')])][_0xd39f('0x2c')]==='reachable'||this[_0xd39f('0xe')][util[_0xd39f('0x5e')](_0xd39f('0x6b'),_0x59c33c[_0xd39f('0x23')])][_0xd39f('0x2c')]==='unmonitored');};Fax[_0xd39f('0x1c')][_0xd39f('0x5a')]=function(_0x5646a7,_0x1a05af){if(!this[_0xd39f('0x68')](_0x5646a7)){ut[_0xd39f('0x45')](_0xd39f('0x6c'),_['isNil'](_0x5646a7)?'':_0x5646a7['name']+_0xd39f('0x6d'));return{'isValid':![],'message':_0xd39f('0x6e')};}if(_[_0xd39f('0x69')](_0x1a05af[_0xd39f('0x5')])){ut[_0xd39f('0x45')](_0xd39f('0x6f'),JSON[_0xd39f('0x3c')](_0x1a05af));return{'isValid':![],'message':_0xd39f('0x70')};}if(_[_0xd39f('0x69')](_0x1a05af[_0xd39f('0x5f')])){ut[_0xd39f('0x45')](_0xd39f('0x71'),JSON[_0xd39f('0x3c')](_0x1a05af));return{'isValid':![],'message':_0xd39f('0x72')};}return{'isValid':!![],'message':'Is\x20Valid'};};Fax[_0xd39f('0x1c')][_0xd39f('0x4b')]=function(_0x169b19,_0x36b72f=0x2710){if(this['channels'][_0x169b19]){setTimeout(()=>{delete this[_0xd39f('0xc')][_0x169b19];},_0x36b72f);}};module[_0xd39f('0x73')]=Fax; \ No newline at end of file +var _0x9f09=['notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','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]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkTrunk','Trunk','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','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','ext','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','lodash','bluebird','uuid','path','tiff2pdf','fax','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','newexten','faxstatus','receivefax','syncReceiveFax','syncOriginateResponse','prototype','from-voip-provider','faxAccounts','hasOwnProperty','exten','localstationid','uniqueid','channel','channels','name','info','\x20syncNewchannel\x20','variable','value','syncNewState','channelstate','channelstatedesc','syncNewExten','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then'];(function(_0x7c2bce,_0x370cf3){var _0xc7ae58=function(_0x1ad430){while(--_0x1ad430){_0x7c2bce['push'](_0x7c2bce['shift']());}};_0xc7ae58(++_0x370cf3);}(_0x9f09,0xb6));var _0x99f0=function(_0x15d184,_0x27104f){_0x15d184=_0x15d184-0x0;var _0x3b8752=_0x9f09[_0x15d184];return _0x3b8752;};'use strict';var util=require('util');var _=require(_0x99f0('0x0'));var BPromise=require(_0x99f0('0x1'));var uuid=require(_0x99f0('0x2'));var moment=require('moment');var path=require(_0x99f0('0x3'));var tiff2pdf=require(_0x99f0('0x4'));var gs=require('./util/gs');var logger=require('../../../config/logger')(_0x99f0('0x5'));var ami=require(_0x99f0('0x6'));var rpcDb=require(_0x99f0('0x7'));var Channel=require('./channel');var ut=require(_0x99f0('0x8'));var Action=require(_0x99f0('0x9'));var faxAccount=require(_0x99f0('0xa'));var attachment=require(_0x99f0('0xb'));var faxMessage=require(_0x99f0('0xc'));function Fax(_0xc24a25){this['channels']={};this['faxAccounts']=_0xc24a25['faxAccounts'];this[_0x99f0('0xd')]=_0xc24a25['trunks'];this[_0x99f0('0xe')]={};ami['on'](_0x99f0('0xf'),this[_0x99f0('0x10')][_0x99f0('0x11')](this));ami['on'](_0x99f0('0x12'),this[_0x99f0('0x13')][_0x99f0('0x11')](this));ami['on'](_0x99f0('0x14'),this['syncNewState'][_0x99f0('0x11')](this));ami['on'](_0x99f0('0x15'),this['syncNewExten'][_0x99f0('0x11')](this));ami['on'](_0x99f0('0x16'),this['syncFaxStatus']['bind'](this));ami['on'](_0x99f0('0x17'),this[_0x99f0('0x18')][_0x99f0('0x11')](this));ami['on']('hangup',this['syncHangup'][_0x99f0('0x11')](this));ami['on']('originateresponse',this[_0x99f0('0x19')][_0x99f0('0x11')](this));}Fax[_0x99f0('0x1a')]['syncNewchannel']=function(_0x358fe6){if(_0x358fe6['context']===_0x99f0('0x1b')){for(var _0x2f06bc in this[_0x99f0('0x1c')]){if(this[_0x99f0('0x1c')][_0x99f0('0x1d')](_0x2f06bc)){if(_0x358fe6[_0x99f0('0x1e')]===this[_0x99f0('0x1c')][_0x2f06bc][_0x99f0('0x1f')]){this['channels'][_0x358fe6[_0x99f0('0x20')]]={};this['channels'][_0x358fe6[_0x99f0('0x20')]][_0x99f0('0x21')]=_0x358fe6[_0x99f0('0x21')];this['channels'][_0x358fe6[_0x99f0('0x20')]]['id']=this[_0x99f0('0x1c')][_0x2f06bc]['id'];this[_0x99f0('0x22')][_0x358fe6['uniqueid']][_0x99f0('0x23')]=this[_0x99f0('0x1c')][_0x2f06bc]['name'];logger[_0x99f0('0x24')](_0x358fe6[_0x99f0('0x20')],_0x99f0('0x25'));}}}}if(this[_0x99f0('0xe')][_0x358fe6[_0x99f0('0x20')]]){this[_0x99f0('0x22')][_0x358fe6['uniqueid']]={};this['channels'][_0x358fe6['uniqueid']][_0x99f0('0x21')]=_0x358fe6[_0x99f0('0x21')];logger['info'](_0x358fe6['uniqueid'],_0x99f0('0x25'));}};Fax[_0x99f0('0x1a')][_0x99f0('0x13')]=function(_0x5383d0){if(this[_0x99f0('0x22')][_0x5383d0[_0x99f0('0x20')]]){for(var _0x1d9d22 in _0x5383d0[_0x99f0('0x26')]){if(_0x5383d0[_0x99f0('0x26')][_0x99f0('0x1d')](_0x1d9d22)){this[_0x99f0('0x22')][_0x5383d0[_0x99f0('0x20')]][_0x1d9d22]=_0x5383d0[_0x99f0('0x27')];}}}};Fax[_0x99f0('0x1a')][_0x99f0('0x28')]=function(_0x20de41){if(this['channels'][_0x20de41[_0x99f0('0x20')]]){this[_0x99f0('0x22')][_0x20de41[_0x99f0('0x20')]][_0x99f0('0x29')]=_0x20de41[_0x99f0('0x29')];this[_0x99f0('0x22')][_0x20de41[_0x99f0('0x20')]][_0x99f0('0x2a')]=_0x20de41[_0x99f0('0x2a')];}};Fax[_0x99f0('0x1a')][_0x99f0('0x2b')]=function(_0x1db94b){if(this[_0x99f0('0x22')][_0x1db94b['uniqueid']]){for(var _0x111766 in _0x1db94b[_0x99f0('0x26')]){if(_0x1db94b[_0x99f0('0x26')][_0x99f0('0x1d')](_0x111766)){this[_0x99f0('0x22')][_0x1db94b[_0x99f0('0x20')]][_0x111766]=_0x1db94b['value'];}}}};Fax[_0x99f0('0x1a')][_0x99f0('0x2c')]=function(_0x260f7f){if(this['channels'][_0x260f7f[_0x99f0('0x20')]]){this[_0x99f0('0x22')][_0x260f7f['uniqueid']]['operation']=_0x260f7f[_0x99f0('0x2d')];this[_0x99f0('0x22')][_0x260f7f[_0x99f0('0x20')]]['status']=_0x260f7f[_0x99f0('0x2e')];this[_0x99f0('0x22')][_0x260f7f['uniqueid']][_0x99f0('0x1f')]=_0x260f7f['localstationid'];this[_0x99f0('0x22')][_0x260f7f[_0x99f0('0x20')]][_0x99f0('0x2f')]=_0x260f7f['filename'];logger['info'](_0x260f7f['uniqueid'],_0x99f0('0x30'));}};Fax['prototype']['syncReceiveFax']=function(_0x431169){var _0x15cd16=this;if(this[_0x99f0('0x22')][_0x431169[_0x99f0('0x20')]]){var _0x54f961=this['channels'][_0x431169[_0x99f0('0x20')]]['id'];this[_0x99f0('0x22')][_0x431169['uniqueid']][_0x99f0('0x31')]=_0x431169[_0x99f0('0x31')];this['channels'][_0x431169['uniqueid']][_0x99f0('0x32')]=_0x431169['pagestransferred'];this[_0x99f0('0x22')][_0x431169['uniqueid']]['localstationid']=_0x431169[_0x99f0('0x1f')];this[_0x99f0('0x22')][_0x431169[_0x99f0('0x20')]]['resolution']=_0x431169['resolution'];this['channels'][_0x431169[_0x99f0('0x20')]][_0x99f0('0x33')]=_0x431169[_0x99f0('0x33')];this[_0x99f0('0x22')][_0x431169['uniqueid']]['filename']=_0x431169[_0x99f0('0x2f')];this[_0x99f0('0x22')][_0x431169[_0x99f0('0x20')]]['calleridnum']=_0x431169[_0x99f0('0x34')];if(this[_0x99f0('0x22')][_0x431169[_0x99f0('0x20')]][_0x99f0('0x32')]>0x0){tiff2pdf(_0x431169['filename'],_0x99f0('0x35'),function(_0x52f679){logger['info'](_0x431169[_0x99f0('0x20')],_0x99f0('0x36'),_0x52f679[_0x99f0('0x37')]);attachment['create']({'name':path[_0x99f0('0x38')](_0x431169[_0x99f0('0x2f')])['name'],'basename':path[_0x99f0('0x38')](_0x431169[_0x99f0('0x2f')])[_0x99f0('0x23')]+_0x99f0('0x39'),'type':_0x99f0('0x3a')})[_0x99f0('0x3b')](function(_0x187c4c){faxAccount[_0x99f0('0x3c')](_0x54f961,{'from':_0x431169[_0x99f0('0x34')],'mapKey':_0x99f0('0x5'),'body':path[_0x99f0('0x38')](_0x431169['filename'])[_0x99f0('0x23')]+_0x99f0('0x39'),'AttachmentId':_0x187c4c['id']})[_0x99f0('0x3d')](function(_0x58363e){logger[_0x99f0('0x3e')](_0x431169[_0x99f0('0x20')],_0x99f0('0x3f'),JSON[_0x99f0('0x40')](_0x58363e));});})[_0x99f0('0x3d')](function(_0x29152c){logger[_0x99f0('0x3e')](_0x431169[_0x99f0('0x20')],_0x99f0('0x41'),JSON[_0x99f0('0x40')](_0x29152c));});});}logger[_0x99f0('0x24')](_0x431169[_0x99f0('0x20')],_0x99f0('0x41'));}};Fax[_0x99f0('0x1a')][_0x99f0('0x19')]=function(_0x445f3c){if(this[_0x99f0('0xe')][_0x445f3c['uniqueid']]){_[_0x99f0('0x42')](this[_0x99f0('0x22')][_0x445f3c[_0x99f0('0x20')]],_[_0x99f0('0x43')](_0x445f3c,[_0x99f0('0x44'),_0x99f0('0x45')]));}};function updateStatus(_0x77e83d){if(_0x77e83d[_0x99f0('0x46')]){faxMessage[_0x99f0('0x47')](_0x77e83d['AttachmentId'],{'failMessage':_0x99f0('0x48')})[_0x99f0('0x3b')](function(_0x519cb9){ut[_0x99f0('0x49')](_0x99f0('0x4a'),_0x519cb9);})[_0x99f0('0x3d')](function(_0x4536cc){ut[_0x99f0('0x49')](_0x99f0('0x4b'),_0x4536cc);});}else{ut[_0x99f0('0x49')](_0x99f0('0x4c'));}}Fax[_0x99f0('0x1a')][_0x99f0('0x4d')]=function(_0x569144,_0x1d474e,_0x5eefda){var _0x36acf=this;var _0x284173={};if(_0x1d474e){_0x284173={'read':_0x1d474e};}else{_0x284173={'failMessage':_0x5eefda};}if(this[_0x99f0('0xe')][_0x569144]['AttachmentId']){faxMessage['update'](this[_0x99f0('0xe')][_0x569144]['AttachmentId'],_0x284173)[_0x99f0('0x3b')](function(_0x48855f){ut[_0x99f0('0x49')](_0x99f0('0x4e'),_0x48855f);})[_0x99f0('0x3d')](function(_0x4fee93){ut[_0x99f0('0x49')](_0x99f0('0x4f'),_0x4fee93);})[_0x99f0('0x50')](function(){delete _0x36acf[_0x99f0('0x22')][_0x569144];delete _0x36acf[_0x99f0('0xe')][_0x569144];});}else{ut[_0x99f0('0x49')](_0x99f0('0x51'));this[_0x99f0('0x52')](_0x569144);delete this[_0x99f0('0xe')][_0x569144];}};Fax['prototype'][_0x99f0('0x53')]=function(_0x4bf20e){var _0x46d761=this;if(this[_0x99f0('0x22')][_0x4bf20e['uniqueid']]){if(this[_0x99f0('0xe')][_0x4bf20e[_0x99f0('0x20')]]){this[_0x99f0('0x22')][_0x4bf20e[_0x99f0('0x20')]]['id']=this[_0x99f0('0xe')][_0x4bf20e['uniqueid']]['id'];this[_0x99f0('0x22')][_0x4bf20e[_0x99f0('0x20')]][_0x99f0('0x23')]=this[_0x99f0('0xe')][_0x4bf20e['uniqueid']][_0x99f0('0x23')];}logger[_0x99f0('0x24')](_0x4bf20e[_0x99f0('0x20')],this[_0x99f0('0xe')][_0x4bf20e[_0x99f0('0x20')]]?_0x99f0('0x54'):_0x99f0('0x55'),JSON[_0x99f0('0x40')](this[_0x99f0('0x22')][_0x4bf20e[_0x99f0('0x20')]]));if(this[_0x99f0('0xe')][_0x4bf20e[_0x99f0('0x20')]]){if(this[_0x99f0('0x22')][_0x4bf20e[_0x99f0('0x20')]]['faxpages']>0x0&&this[_0x99f0('0x22')][_0x4bf20e[_0x99f0('0x20')]][_0x99f0('0x16')]===_0x99f0('0x56')){this[_0x99f0('0x4d')](_0x4bf20e['uniqueid'],!![]);}else{this[_0x99f0('0x4d')](_0x4bf20e[_0x99f0('0x20')],![],this['channels'][_0x4bf20e['uniqueid']][_0x99f0('0x57')]?_0x99f0('0x58')+this[_0x99f0('0x22')][_0x4bf20e[_0x99f0('0x20')]][_0x99f0('0x57')]:_0x99f0('0x59'));}}}};Fax[_0x99f0('0x1a')]['send']=function(_0x3315b9){var _0x313dd4=this;return new BPromise(function(_0x28a48c,_0x403e3d){_0x313dd4['execOriginate'](_0x3315b9,_0x313dd4[_0x99f0('0x1c')][_0x3315b9['FaxAccountId']])[_0x99f0('0x3b')](function(_0x17e176){ut[_0x99f0('0x49')](_0x99f0('0x5a'),_0x17e176);_0x28a48c(ut[_0x99f0('0x37')](_0x99f0('0x5b')));})[_0x99f0('0x3d')](function(_0x5d401c){ut[_0x99f0('0x49')](_0x99f0('0x5c'),_0x5d401c);updateStatus(_0x3315b9);_0x403e3d(ut[_0x99f0('0x37')]('Fax\x20failed'));});});};Fax[_0x99f0('0x1a')]['checkAfterSend']=function(_0x36bd58){var _0x102620=this;return new BPromise(function(_0x4cbd75,_0x9a2bd2){var _0xc2bd07=_0x102620[_0x99f0('0x5d')](_0x102620[_0x99f0('0x1c')][_0x36bd58['FaxAccountId']][_0x99f0('0x5e')],_0x36bd58);if(_0xc2bd07['isValid']){_0x4cbd75(ut[_0x99f0('0x37')](_0x99f0('0x5f')));}else{_0x9a2bd2(ut[_0x99f0('0x37')](_0xc2bd07['message']));}});};function originate(_0x37bd0c,_0x51d3f7,_0x2f2920){return new BPromise(function(_0x27f738,_0xd22ec0){if(_0x2f2920){var _0x5c31ad=util[_0x99f0('0x60')](_0x99f0('0x61'),path['parse'](_0x37bd0c['path'])[_0x99f0('0x23')],_0x37bd0c[_0x99f0('0x3')]);gs[_0x99f0('0x62')](_0x5c31ad)['then'](function(){_0x37bd0c['path']=util[_0x99f0('0x60')](_0x99f0('0x63'),path['parse'](_0x37bd0c[_0x99f0('0x3')])['dir'],path[_0x99f0('0x38')](_0x37bd0c[_0x99f0('0x3')])['name']);_0x51d3f7[_0x99f0('0x64')]=_0x37bd0c[_0x99f0('0x3')];ut['logger'](_0x99f0('0x65'),'');ami[_0x99f0('0x66')](ut['variablesAction'](_0x37bd0c,_0x51d3f7))['then'](function(_0x9f6b8c){_0x27f738(_0x9f6b8c);})['catch'](function(_0x44c87d){_0xd22ec0(_0x44c87d);});})[_0x99f0('0x3d')](function(_0x4cd36b){_0xd22ec0(_0x4cd36b);});}else{ami['Action'](ut[_0x99f0('0x67')](_0x37bd0c,_0x51d3f7))[_0x99f0('0x3b')](function(_0x452827){_0x27f738(_0x452827);})[_0x99f0('0x3d')](function(_0x5ad110){_0xd22ec0(_0x5ad110);});}});}Fax[_0x99f0('0x1a')][_0x99f0('0x68')]=function(_0x528333,_0xbd41a9){var _0x49f44a=this;return new BPromise(function(_0x46d191,_0x62952b){var _0x1eea13=uuid['v4']();var _0xafec9d=ut['addVariables'](_0x528333,_0xbd41a9);_0x49f44a[_0x99f0('0xe')][_0x1eea13]=new Action(_0x1eea13,_0xbd41a9,_0x528333);var _0x3292a4=_0x49f44a['actions'][_0x1eea13];if(path[_0x99f0('0x38')](_0x528333[_0x99f0('0x3')])[_0x99f0('0x69')]===_0x99f0('0x39')){originate(_0x3292a4,_0xafec9d,!![])['then'](function(_0x15339d){_0x46d191(_0x15339d);})[_0x99f0('0x3d')](function(_0x52e98a){_0x62952b(_0x52e98a);});}else{originate(_0x3292a4,_0xafec9d,![])[_0x99f0('0x3b')](function(_0x6eb966){_0x46d191(_0x6eb966);})[_0x99f0('0x3d')](function(_0x54d934){_0x62952b(_0x54d934);});}});};Fax[_0x99f0('0x1a')]['isTrunkReachable']=function(_0x20e5ed){return!_['isNil'](_0x20e5ed)&&!_[_0x99f0('0x6a')](_0x20e5ed[_0x99f0('0x23')])&&!_['isNil'](_0x20e5ed[_0x99f0('0x6b')])&&_0x20e5ed[_0x99f0('0x6b')]&&!_[_0x99f0('0x6a')](this['trunks'][util['format'](_0x99f0('0x6c'),_0x20e5ed[_0x99f0('0x23')])])&&!_[_0x99f0('0x6a')](this[_0x99f0('0xd')][util[_0x99f0('0x60')]('SIP/%s',_0x20e5ed[_0x99f0('0x23')])]['status'])&&(this[_0x99f0('0xd')][util['format'](_0x99f0('0x6c'),_0x20e5ed['name'])]['status']===_0x99f0('0x6d')||this[_0x99f0('0xd')][util[_0x99f0('0x60')](_0x99f0('0x6c'),_0x20e5ed[_0x99f0('0x23')])]['status']===_0x99f0('0x6e'));};Fax[_0x99f0('0x1a')][_0x99f0('0x5d')]=function(_0x12bfe8,_0x166f91){if(!this[_0x99f0('0x6f')](_0x12bfe8)){ut['logger'](_0x99f0('0x70'),_[_0x99f0('0x6a')](_0x12bfe8)?'':_0x12bfe8[_0x99f0('0x23')]+_0x99f0('0x71'));return{'isValid':![],'message':_0x99f0('0x72')};}if(_[_0x99f0('0x6a')](_0x166f91['fax'])){ut['logger'](_0x99f0('0x73'),JSON[_0x99f0('0x40')](_0x166f91));return{'isValid':![],'message':_0x99f0('0x74')};}if(_[_0x99f0('0x6a')](_0x166f91[_0x99f0('0x3')])){ut['logger'](_0x99f0('0x75'),JSON[_0x99f0('0x40')](_0x166f91));return{'isValid':![],'message':_0x99f0('0x76')};}return{'isValid':!![],'message':_0x99f0('0x77')};};Fax['prototype'][_0x99f0('0x52')]=function(_0x43ef03,_0x18bc59=0x2710){if(this['channels'][_0x43ef03]){setTimeout(()=>{delete this[_0x99f0('0x22')][_0x43ef03];},_0x18bc59);}};module[_0x99f0('0x78')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index b5c3ab3..3229bcf 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 _0x6654=['lodash','../rpc/faxAccount','error','notify','resolve','then','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview'];(function(_0x5ea451,_0x52741e){var _0x437c02=function(_0x464bd3){while(--_0x464bd3){_0x5ea451['push'](_0x5ea451['shift']());}};_0x437c02(++_0x52741e);}(_0x6654,0x98));var _0x4665=function(_0x2d66d5,_0x4d71d1){_0x2d66d5=_0x2d66d5-0x0;var _0x128e84=_0x6654[_0x2d66d5];return _0x128e84;};'use strict';var util=require(_0x4665('0x0'));var BPromise=require(_0x4665('0x1'));var logger=require(_0x4665('0x2'))(_0x4665('0x3'));var _=require(_0x4665('0x4'));var faxAccount=require(_0x4665('0x5'));function loggerCatch(_0x21dc90){return function(_0x5549ce){logger[_0x4665('0x6')](_0x21dc90,util['inspect'](_0x5549ce,{'showHidden':![],'depth':null}));};}exports[_0x4665('0x7')]=function(_0x47141e,_0x3072d1){return BPromise[_0x4665('0x8')]()[_0x4665('0x9')](faxAccount['notify'](_0x47141e,_0x3072d1))[_0x4665('0xa')](loggerCatch(_0x4665('0xb')));}; \ No newline at end of file +var _0x82b8=['util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve','then','catch','[Notify]\x20'];(function(_0x877b71,_0x462389){var _0x38e64d=function(_0xf99d03){while(--_0xf99d03){_0x877b71['push'](_0x877b71['shift']());}};_0x38e64d(++_0x462389);}(_0x82b8,0xdd));var _0x882b=function(_0x356dde,_0x32ab07){_0x356dde=_0x356dde-0x0;var _0x316411=_0x82b8[_0x356dde];return _0x316411;};'use strict';var util=require(_0x882b('0x0'));var BPromise=require(_0x882b('0x1'));var logger=require(_0x882b('0x2'))(_0x882b('0x3'));var _=require(_0x882b('0x4'));var faxAccount=require(_0x882b('0x5'));function loggerCatch(_0x316c28){return function(_0x4a1d23){logger[_0x882b('0x6')](_0x316c28,util[_0x882b('0x7')](_0x4a1d23,{'showHidden':![],'depth':null}));};}exports[_0x882b('0x8')]=function(_0x3a3c5a,_0xc8dc4b){return BPromise[_0x882b('0x9')]()[_0x882b('0xa')](faxAccount[_0x882b('0x8')](_0x3a3c5a,_0xc8dc4b))[_0x882b('0xb')](loggerCatch(_0x882b('0xc')));}; \ 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 818db45..c05d3bc 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 _0x9379=['Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','exec','execute','info'];(function(_0x375645,_0xe5e13b){var _0x4f53ac=function(_0x3e7ef3){while(--_0x3e7ef3){_0x375645['push'](_0x375645['shift']());}};_0x4f53ac(++_0xe5e13b);}(_0x9379,0x157));var _0x9937=function(_0x545699,_0x41b0cf){_0x545699=_0x545699-0x0;var _0x364bcc=_0x9379[_0x545699];return _0x364bcc;};'use strict';var util=require(_0x9937('0x0'));var logger=require(_0x9937('0x1'))(_0x9937('0x2'));var BPromise=require(_0x9937('0x3'));var exec=require('child_process')[_0x9937('0x4')];exports[_0x9937('0x5')]=function(_0x35306d){return new BPromise(function(_0x31fb15,_0x229778){exec(_0x35306d,function(_0x32a13e,_0x4cce90,_0x4cb09c){logger[_0x9937('0x6')](_0x9937('0x7'),_0x4cce90);if(_0x32a13e){logger[_0x9937('0x6')](_0x9937('0x7'),_0x9937('0x8'),util[_0x9937('0x9')](_0x32a13e,{'showHidden':![],'depth':null}),_0x4cce90,_0x4cb09c);_0x229778(_0x32a13e);}_0x31fb15(_0x4cce90);});});}; \ No newline at end of file +var _0x1bc0=['fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x1bc0,0x11c));var _0x01bc=function(_0x530dad,_0x2797a1){_0x530dad=_0x530dad-0x0;var _0x3357e9=_0x1bc0[_0x530dad];return _0x3357e9;};'use strict';var util=require(_0x01bc('0x0'));var logger=require(_0x01bc('0x1'))(_0x01bc('0x2'));var BPromise=require(_0x01bc('0x3'));var exec=require(_0x01bc('0x4'))[_0x01bc('0x5')];exports[_0x01bc('0x6')]=function(_0x4e2650){return new BPromise(function(_0x56f03f,_0x1e1095){exec(_0x4e2650,function(_0x591b53,_0x511120,_0x29389b){logger[_0x01bc('0x7')]('Exec\x20gs',_0x511120);if(_0x591b53){logger['info'](_0x01bc('0x8'),_0x01bc('0x9'),util[_0x01bc('0xa')](_0x591b53,{'showHidden':![],'depth':null}),_0x511120,_0x29389b);_0x1e1095(_0x591b53);}_0x56f03f(_0x511120);});});}; \ 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 9c4a875..80d796d 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 _0xa716=['info','inspect','addVariables','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','localstationid','variablesAction','uniqueid','originate','xcally-motion-fax','\x22%s\x22\x20<%s>','headerinfo','lodash','moment','../../../../config/logger','logger'];(function(_0x15b939,_0x4a4fca){var _0x2da954=function(_0x3d4b97){while(--_0x3d4b97){_0x15b939['push'](_0x15b939['shift']());}};_0x2da954(++_0x4a4fca);}(_0xa716,0x10d));var _0x6a71=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa716[_0x19950b];return _0x3c6b41;};'use strict';var util=require('util');var _=require(_0x6a71('0x0'));var moment=require(_0x6a71('0x1'));var logger=require(_0x6a71('0x2'))('fax');exports['message']=function(_0x410106){return{'message':_0x410106};};exports[_0x6a71('0x3')]=function(_0x38388f,_0x24111b){logger[_0x6a71('0x4')](_0x38388f,util[_0x6a71('0x5')](_0x24111b,{'showHidden':![],'depth':null}));};exports[_0x6a71('0x6')]=function(_0x424baf,_0x55b1a4){var _0x124e92={'XMF-ECM':_0x55b1a4['ecm'],'XMF-HEADERINFO':_0x55b1a4['headerinfo'],'XMF-MINRATE':_0x55b1a4[_0x6a71('0x7')],'XMF-MAXRATE':_0x55b1a4[_0x6a71('0x8')],'XMF-MODEM':util[_0x6a71('0x9')](_0x6a71('0xa'),_0x55b1a4[_0x6a71('0xb')]),'XMF-GATEWAY':_0x55b1a4[_0x6a71('0xc')],'XMF-FAXDETECT':_0x55b1a4[_0x6a71('0xd')],'XMF-T38TIMEOUT':_0x55b1a4['t38timeout'],'XMF-LOCALSTATIONID':_0x55b1a4[_0x6a71('0xe')],'XMF-PATH':_0x424baf['path']};return _0x124e92;};exports[_0x6a71('0xf')]=function(_0x12229d,_0x1ef517){return{'actionid':_0x12229d[_0x6a71('0x10')],'action':_0x6a71('0x11'),'channel':_0x12229d['channel'],'Exten':_0x6a71('0x12'),'Context':'from-sip','Priority':'1','callerid':util['format'](_0x6a71('0x13'),_0x12229d[_0x6a71('0x14')]?_0x12229d[_0x6a71('0x14')]:'',_0x12229d[_0x6a71('0xe')]),'variable':_0x1ef517,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x12229d['uniqueid']};}; \ No newline at end of file +var _0xb366=['path','variablesAction','uniqueid','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','util','moment','../../../../config/logger','message','info','inspect','addVariables','minrate','maxrate','format','\x22%s\x22','modem','gateway','t38timeout','localstationid'];(function(_0x5e4f42,_0x296563){var _0x24a54e=function(_0x3e2b49){while(--_0x3e2b49){_0x5e4f42['push'](_0x5e4f42['shift']());}};_0x24a54e(++_0x296563);}(_0xb366,0x1d4));var _0x6b36=function(_0x5f2643,_0x2f987f){_0x5f2643=_0x5f2643-0x0;var _0x2d05dc=_0xb366[_0x5f2643];return _0x2d05dc;};'use strict';var util=require(_0x6b36('0x0'));var _=require('lodash');var moment=require(_0x6b36('0x1'));var logger=require(_0x6b36('0x2'))('fax');exports[_0x6b36('0x3')]=function(_0x442899){return{'message':_0x442899};};exports['logger']=function(_0x565120,_0x436eea){logger[_0x6b36('0x4')](_0x565120,util[_0x6b36('0x5')](_0x436eea,{'showHidden':![],'depth':null}));};exports[_0x6b36('0x6')]=function(_0x36ae1c,_0x203e7c){var _0x1eaff7={'XMF-ECM':_0x203e7c['ecm'],'XMF-HEADERINFO':_0x203e7c['headerinfo'],'XMF-MINRATE':_0x203e7c[_0x6b36('0x7')],'XMF-MAXRATE':_0x203e7c[_0x6b36('0x8')],'XMF-MODEM':util[_0x6b36('0x9')](_0x6b36('0xa'),_0x203e7c[_0x6b36('0xb')]),'XMF-GATEWAY':_0x203e7c[_0x6b36('0xc')],'XMF-FAXDETECT':_0x203e7c['faxdetect'],'XMF-T38TIMEOUT':_0x203e7c[_0x6b36('0xd')],'XMF-LOCALSTATIONID':_0x203e7c[_0x6b36('0xe')],'XMF-PATH':_0x36ae1c[_0x6b36('0xf')]};return _0x1eaff7;};exports[_0x6b36('0x10')]=function(_0x47f194,_0x2f00e1){return{'actionid':_0x47f194[_0x6b36('0x11')],'action':'originate','channel':_0x47f194[_0x6b36('0x12')],'Exten':_0x6b36('0x13'),'Context':_0x6b36('0x14'),'Priority':'1','callerid':util['format'](_0x6b36('0x15'),_0x47f194[_0x6b36('0x16')]?_0x47f194['headerinfo']:'',_0x47f194['localstationid']),'variable':_0x2f00e1,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x47f194[_0x6b36('0x11')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 5c09a48..8a2b0ef 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 _0x09fb=['./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','listen','sync','[index.js][main]','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview'];(function(_0x543616,_0x4c4f3d){var _0x1a6661=function(_0x3f9780){while(--_0x3f9780){_0x543616['push'](_0x543616['shift']());}};_0x1a6661(++_0x4c4f3d);}(_0x09fb,0x14c));var _0xb09f=function(_0x401882,_0x5885d0){_0x401882=_0x401882-0x0;var _0x4245a5=_0x09fb[_0x401882];return _0x4245a5;};'use strict';var util=require('util');var moment=require(_0xb09f('0x0'));var server=require(_0xb09f('0x1'));var Realtime=require(_0xb09f('0x2'));var Report=require(_0xb09f('0x3'));var Acw=require(_0xb09f('0x4'));var Trigger=require(_0xb09f('0x5'));var Dialer=require(_0xb09f('0x6'));var Preview=require(_0xb09f('0x7'));var Fax=require(_0xb09f('0x8'));var user=require(_0xb09f('0x9'));var voiceQueue=require(_0xb09f('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xb09f('0xb'));var trunk=require(_0xb09f('0xc'));var trigger=require(_0xb09f('0xd'));var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xb09f('0xe'));var voiceExtension=require(_0xb09f('0xf'));var faxAccount=require(_0xb09f('0x10'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xb09f('0x11'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0xb09f('0x12'));var desk=require(_0xb09f('0x13'));var zoho=require(_0xb09f('0x14'));var vtiger=require(_0xb09f('0x15'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xb09f('0x16'));var dynamics365=require(_0xb09f('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xb09f('0x18'))(_0xb09f('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xb09f('0x1a')](_0xb09f('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xb09f('0x1a')](_0xb09f('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xb09f('0x1c')]()[_0xb09f('0x1d')](user[_0xb09f('0x1e')]())['then'](realtime[_0xb09f('0x1f')]())['then'](user[_0xb09f('0x20')]())[_0xb09f('0x1d')](realtime[_0xb09f('0x21')]())[_0xb09f('0x1d')](trunk[_0xb09f('0x22')]())[_0xb09f('0x1d')](realtime['initTrunks']())[_0xb09f('0x1d')](voiceQueue[_0xb09f('0x23')]())[_0xb09f('0x1d')](realtime['initVoiceQueues']())['then'](trigger['getTriggers']())[_0xb09f('0x1d')](realtime['initTriggers']())[_0xb09f('0x1d')](template[_0xb09f('0x24')]())['then'](realtime[_0xb09f('0x25')]())[_0xb09f('0x1d')](zendesk[_0xb09f('0x26')]())[_0xb09f('0x1d')](realtime[_0xb09f('0x27')]())[_0xb09f('0x1d')](salesforce['getSalesforceAccounts']())[_0xb09f('0x1d')](realtime[_0xb09f('0x28')]())[_0xb09f('0x1d')](sugarcrm[_0xb09f('0x29')]())[_0xb09f('0x1d')](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0xb09f('0x2a')]())[_0xb09f('0x1d')](realtime['initFreshdeskAccounts']())[_0xb09f('0x1d')](desk['getDeskAccounts']())[_0xb09f('0x1d')](realtime[_0xb09f('0x2b')]())[_0xb09f('0x1d')](zoho[_0xb09f('0x2c')]())[_0xb09f('0x1d')](realtime[_0xb09f('0x2d')]())[_0xb09f('0x1d')](vtiger[_0xb09f('0x2e')]())[_0xb09f('0x1d')](realtime[_0xb09f('0x2f')]())[_0xb09f('0x1d')](freshsales['getFreshsalesAccounts']())[_0xb09f('0x1d')](realtime['initFreshsalesAccounts']())[_0xb09f('0x1d')](servicenow[_0xb09f('0x30')]())['then'](realtime[_0xb09f('0x31')]())[_0xb09f('0x1d')](dynamics365[_0xb09f('0x32')]())[_0xb09f('0x1d')](realtime[_0xb09f('0x33')]())['then'](campaign['getCampaigns']())['then'](realtime['initCampaigns']())['then'](voiceExtension[_0xb09f('0x34')]())[_0xb09f('0x1d')](realtime[_0xb09f('0x35')]())[_0xb09f('0x1d')](faxAccount[_0xb09f('0x36')]())['then'](realtime['initFaxAccounts']())[_0xb09f('0x1d')](function(){return realtime;});}function initParams(){return Promise[_0xb09f('0x1c')]()[_0xb09f('0x1d')](voiceQueueReport[_0xb09f('0x37')]())[_0xb09f('0x1d')](realtime[_0xb09f('0x38')]())[_0xb09f('0x1d')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xb09f('0x1d')](realtime[_0xb09f('0x39')]())['then'](cmHopperHistory[_0xb09f('0x3a')]())[_0xb09f('0x1d')](realtime[_0xb09f('0x3b')]())['then'](voiceCallReport[_0xb09f('0x3c')]())[_0xb09f('0x1d')](realtime[_0xb09f('0x3d')]())[_0xb09f('0x3e')](function(_0x53ca26){logger[_0xb09f('0x3f')](_0xb09f('0x40'),util['inspect'](_0x53ca26,{'showHidden':![],'depth':null}));});}function main(){return server[_0xb09f('0x41')](realtime,preview,fax)[_0xb09f('0x1d')](function(){return initRealtime();})[_0xb09f('0x1d')](function(){return initParams();})[_0xb09f('0x1d')](function(){report[_0xb09f('0x42')]();setInterval(initRealtime,0x1388);})[_0xb09f('0x3e')](function(_0x10b8b1){logger[_0xb09f('0x3f')](_0xb09f('0x43'),util['inspect'](_0x10b8b1,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x91a7=['inspect','listen','sync','catch','[index.js][main]','util','moment','./server','./realtime','./report','./acw','./trigger','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','getVoiceQueueHopperHistory','getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]'];(function(_0x34ad09,_0xba8f16){var _0x4c8431=function(_0x78b555){while(--_0x78b555){_0x34ad09['push'](_0x34ad09['shift']());}};_0x4c8431(++_0xba8f16);}(_0x91a7,0x129));var _0x791a=function(_0x4bab2c,_0x161460){_0x4bab2c=_0x4bab2c-0x0;var _0x3ddbcf=_0x91a7[_0x4bab2c];return _0x3ddbcf;};'use strict';var util=require(_0x791a('0x0'));var moment=require(_0x791a('0x1'));var server=require(_0x791a('0x2'));var Realtime=require(_0x791a('0x3'));var Report=require(_0x791a('0x4'));var Acw=require(_0x791a('0x5'));var Trigger=require(_0x791a('0x6'));var Dialer=require('./dialer');var Preview=require('./preview');var Fax=require(_0x791a('0x7'));var user=require(_0x791a('0x8'));var voiceQueue=require(_0x791a('0x9'));var voiceQueueReport=require(_0x791a('0xa'));var voiceCallReport=require(_0x791a('0xb'));var trunk=require(_0x791a('0xc'));var trigger=require('./rpc/trigger');var template=require(_0x791a('0xd'));var cmHopperHistory=require(_0x791a('0xe'));var campaign=require(_0x791a('0xf'));var voiceExtension=require(_0x791a('0x10'));var faxAccount=require(_0x791a('0x11'));var zendesk=require(_0x791a('0x12'));var salesforce=require(_0x791a('0x13'));var sugarcrm=require(_0x791a('0x14'));var freshdesk=require(_0x791a('0x15'));var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x791a('0x16'));var freshsales=require(_0x791a('0x17'));var servicenow=require(_0x791a('0x18'));var dynamics365=require(_0x791a('0x19'));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')(_0x791a('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x791a('0x1b')](_0x791a('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x791a('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x791a('0x1d')]()[_0x791a('0x1e')](user[_0x791a('0x1f')]())['then'](realtime[_0x791a('0x20')]())[_0x791a('0x1e')](user[_0x791a('0x21')]())['then'](realtime[_0x791a('0x22')]())[_0x791a('0x1e')](trunk['getTrunks']())['then'](realtime[_0x791a('0x23')]())[_0x791a('0x1e')](voiceQueue[_0x791a('0x24')]())[_0x791a('0x1e')](realtime['initVoiceQueues']())['then'](trigger[_0x791a('0x25')]())[_0x791a('0x1e')](realtime[_0x791a('0x26')]())['then'](template[_0x791a('0x27')]())[_0x791a('0x1e')](realtime[_0x791a('0x28')]())[_0x791a('0x1e')](zendesk[_0x791a('0x29')]())['then'](realtime[_0x791a('0x2a')]())[_0x791a('0x1e')](salesforce[_0x791a('0x2b')]())[_0x791a('0x1e')](realtime['initSalesforceAccounts']())[_0x791a('0x1e')](sugarcrm[_0x791a('0x2c')]())[_0x791a('0x1e')](realtime['initSugarcrmAccounts']())[_0x791a('0x1e')](freshdesk[_0x791a('0x2d')]())[_0x791a('0x1e')](realtime[_0x791a('0x2e')]())[_0x791a('0x1e')](desk[_0x791a('0x2f')]())['then'](realtime[_0x791a('0x30')]())[_0x791a('0x1e')](zoho[_0x791a('0x31')]())[_0x791a('0x1e')](realtime[_0x791a('0x32')]())[_0x791a('0x1e')](vtiger[_0x791a('0x33')]())[_0x791a('0x1e')](realtime[_0x791a('0x34')]())[_0x791a('0x1e')](freshsales[_0x791a('0x35')]())[_0x791a('0x1e')](realtime[_0x791a('0x36')]())[_0x791a('0x1e')](servicenow[_0x791a('0x37')]())[_0x791a('0x1e')](realtime['initServicenowAccounts']())[_0x791a('0x1e')](dynamics365[_0x791a('0x38')]())[_0x791a('0x1e')](realtime[_0x791a('0x39')]())[_0x791a('0x1e')](campaign[_0x791a('0x3a')]())['then'](realtime[_0x791a('0x3b')]())['then'](voiceExtension[_0x791a('0x3c')]())['then'](realtime[_0x791a('0x3d')]())['then'](faxAccount[_0x791a('0x3e')]())[_0x791a('0x1e')](realtime['initFaxAccounts']())[_0x791a('0x1e')](function(){return realtime;});}function initParams(){return Promise[_0x791a('0x1d')]()[_0x791a('0x1e')](voiceQueueReport['getVoiceQueueReports']())[_0x791a('0x1e')](realtime['initVoiceQueueReports']())[_0x791a('0x1e')](cmHopperHistory[_0x791a('0x3f')]())[_0x791a('0x1e')](realtime['initVoiceQueueHopperHistory']())[_0x791a('0x1e')](cmHopperHistory['getCampaignHopperHistory']())[_0x791a('0x1e')](realtime['initCampaignHopperHistory']())[_0x791a('0x1e')](voiceCallReport[_0x791a('0x40')]())[_0x791a('0x1e')](realtime[_0x791a('0x41')]())['catch'](function(_0x514239){logger[_0x791a('0x42')](_0x791a('0x43'),util[_0x791a('0x44')](_0x514239,{'showHidden':![],'depth':null}));});}function main(){return server[_0x791a('0x45')](realtime,preview,fax)[_0x791a('0x1e')](function(){return initRealtime();})['then'](function(){return initParams();})[_0x791a('0x1e')](function(){report[_0x791a('0x46')]();setInterval(initRealtime,0x1388);})[_0x791a('0x47')](function(_0x5ac0f1){logger[_0x791a('0x42')](_0x791a('0x48'),util[_0x791a('0x44')](_0x5ac0f1,{'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 69a5552..d2223b0 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 _0x3fd8=['voiceStatusQueue','local','updateStatusRealtime','toLowerCase','idle','inuse','voiceStatus','statePause','toNumber','accountcode','status','onhold','stringify','format','user:%s','user:ami:update','omit','emit','user:presence','lodash','md5','ioredis','../../../config/environment','redis','socket.io-emitter','name','email','fullname','state','unknown','stateTime','address','mobile','online','voiceStatusTime','voiceStatusCallerIdNumber'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x3fd8,0xa3));var _0x83fd=function(_0x1b62ca,_0x3f621a){_0x1b62ca=_0x1b62ca-0x0;var _0x2f71a9=_0x3fd8[_0x1b62ca];return _0x2f71a9;};'use strict';var _=require(_0x83fd('0x0'));var util=require('util');var moment=require('moment');var md5=require(_0x83fd('0x1'));var Redis=require(_0x83fd('0x2'));var config=require(_0x83fd('0x3'));config[_0x83fd('0x4')]=_['defaults'](config[_0x83fd('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x83fd('0x5'))(new Redis(config[_0x83fd('0x4')]));function Agent(_0x4d948c){this['id']=_0x4d948c['id']||0x0;this[_0x83fd('0x6')]=_0x4d948c[_0x83fd('0x6')]||'';this[_0x83fd('0x7')]=_0x4d948c[_0x83fd('0x7')]||'';this['accountcode']=_0x4d948c['accountcode']||'';this['fullname']=_0x4d948c[_0x83fd('0x8')]||'';this[_0x83fd('0x9')]=_0x83fd('0xa');this[_0x83fd('0xb')]=0x0;this['status']=_0x83fd('0xa');this[_0x83fd('0xc')]='';this['phone']='';this[_0x83fd('0xd')]='';this['interface']='';this[_0x83fd('0xe')]=_0x4d948c[_0x83fd('0xe')]||![];this['voiceStatus']=_0x83fd('0xa');this[_0x83fd('0xf')]=0x0;this[_0x83fd('0x10')]='';this[_0x83fd('0x11')]='';this['onhold']=![];this[_0x83fd('0x12')]=![];this['md5']='';}Agent['prototype'][_0x83fd('0x13')]=function(_0x2d99b4){var _0x68ef17;if(_0x2d99b4&&_0x2d99b4[_0x83fd('0x9')]){_0x68ef17=_0x2d99b4['state'][_0x83fd('0x14')]();switch(_0x68ef17){case'not_inuse':_0x68ef17=_0x83fd('0x15');break;case _0x83fd('0x16'):_0x68ef17='talking';break;}}if(_0x68ef17&&this[_0x83fd('0x17')]!==_0x68ef17||_0x2d99b4[_0x83fd('0x18')]){this[_0x83fd('0xf')]=_[_0x83fd('0x19')](moment()['format']('x'));}if(_0x68ef17){this[_0x83fd('0x17')]=_0x68ef17;}var _0x2db2ab={'id':this['id'],'name':this[_0x83fd('0x6')],'email':this[_0x83fd('0x7')],'accountcode':this[_0x83fd('0x1a')],'fullname':this[_0x83fd('0x8')],'state':this[_0x83fd('0x9')],'stateTime':this['stateTime'],'status':this[_0x83fd('0x1b')],'address':this[_0x83fd('0xc')],'online':this[_0x83fd('0xe')],'voiceStatus':this[_0x83fd('0x17')],'voiceStatusTime':this[_0x83fd('0xf')],'voiceStatusCallerIdNumber':this[_0x83fd('0x10')],'voiceStatusQueue':this[_0x83fd('0x11')],'interface':this['interface'],'onhold':this[_0x83fd('0x1c')]};var _0x606062=md5(JSON[_0x83fd('0x1d')](_0x2db2ab));if(this['md5']!==_0x606062){this[_0x83fd('0x1')]=_0x606062;io['to'](util[_0x83fd('0x1e')](_0x83fd('0x1f'),_0x2db2ab[_0x83fd('0x6')]))['emit'](_0x83fd('0x20'),_[_0x83fd('0x21')](_0x2db2ab,[_0x83fd('0xe')]));io[_0x83fd('0x22')](_0x83fd('0x23'),_0x2db2ab);}};module['exports']=Agent; \ No newline at end of file +var _0x6ac7=['fullname','state','status','address','phone','mobile','interface','online','voiceStatus','unknown','voiceStatusTime','voiceStatusQueue','onhold','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','talking','statePause','toNumber','voiceStatusCallerIdNumber','format','user:%s','emit','user:ami:update','omit','user:presence','exports','lodash','util','moment','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6ac7,0x1e0));var _0x76ac=function(_0x27004a,_0x5a4589){_0x27004a=_0x27004a-0x0;var _0x265821=_0x6ac7[_0x27004a];return _0x265821;};'use strict';var _=require(_0x76ac('0x0'));var util=require(_0x76ac('0x1'));var moment=require(_0x76ac('0x2'));var md5=require(_0x76ac('0x3'));var Redis=require('ioredis');var config=require(_0x76ac('0x4'));config[_0x76ac('0x5')]=_[_0x76ac('0x6')](config[_0x76ac('0x5')],{'host':_0x76ac('0x7'),'port':0x18eb});var io=require(_0x76ac('0x8'))(new Redis(config['redis']));function Agent(_0x3a9456){this['id']=_0x3a9456['id']||0x0;this[_0x76ac('0x9')]=_0x3a9456['name']||'';this[_0x76ac('0xa')]=_0x3a9456[_0x76ac('0xa')]||'';this[_0x76ac('0xb')]=_0x3a9456[_0x76ac('0xb')]||'';this[_0x76ac('0xc')]=_0x3a9456[_0x76ac('0xc')]||'';this[_0x76ac('0xd')]='unknown';this['stateTime']=0x0;this[_0x76ac('0xe')]='unknown';this[_0x76ac('0xf')]='';this[_0x76ac('0x10')]='';this[_0x76ac('0x11')]='';this[_0x76ac('0x12')]='';this[_0x76ac('0x13')]=_0x3a9456['online']||![];this[_0x76ac('0x14')]=_0x76ac('0x15');this[_0x76ac('0x16')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x76ac('0x17')]='';this[_0x76ac('0x18')]=![];this['local']=![];this[_0x76ac('0x3')]='';}Agent[_0x76ac('0x19')][_0x76ac('0x1a')]=function(_0x16e986){var _0x5cd4b7;if(_0x16e986&&_0x16e986['state']){_0x5cd4b7=_0x16e986[_0x76ac('0xd')][_0x76ac('0x1b')]();switch(_0x5cd4b7){case _0x76ac('0x1c'):_0x5cd4b7=_0x76ac('0x1d');break;case'inuse':_0x5cd4b7=_0x76ac('0x1e');break;}}if(_0x5cd4b7&&this[_0x76ac('0x14')]!==_0x5cd4b7||_0x16e986[_0x76ac('0x1f')]){this[_0x76ac('0x16')]=_[_0x76ac('0x20')](moment()['format']('x'));}if(_0x5cd4b7){this[_0x76ac('0x14')]=_0x5cd4b7;}var _0x560549={'id':this['id'],'name':this[_0x76ac('0x9')],'email':this[_0x76ac('0xa')],'accountcode':this['accountcode'],'fullname':this[_0x76ac('0xc')],'state':this[_0x76ac('0xd')],'stateTime':this['stateTime'],'status':this['status'],'address':this[_0x76ac('0xf')],'online':this['online'],'voiceStatus':this[_0x76ac('0x14')],'voiceStatusTime':this[_0x76ac('0x16')],'voiceStatusCallerIdNumber':this[_0x76ac('0x21')],'voiceStatusQueue':this[_0x76ac('0x17')],'interface':this[_0x76ac('0x12')],'onhold':this[_0x76ac('0x18')]};var _0xbb4a66=md5(JSON['stringify'](_0x560549));if(this[_0x76ac('0x3')]!==_0xbb4a66){this[_0x76ac('0x3')]=_0xbb4a66;io['to'](util[_0x76ac('0x22')](_0x76ac('0x23'),_0x560549[_0x76ac('0x9')]))[_0x76ac('0x24')](_0x76ac('0x25'),_[_0x76ac('0x26')](_0x560549,[_0x76ac('0x13')]));io['emit'](_0x76ac('0x27'),_0x560549);}};module[_0x76ac('0x28')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 5c1802f..cf87316 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 _0xe6e6=['dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xe6e6,0x79));var _0x6e6e=function(_0x25e495,_0x239afd){_0x25e495=_0x25e495-0x0;var _0x138bc7=_0xe6e6[_0x25e495];return _0x138bc7;};'use strict';function Campaign(_0x461f03){this['id']=_0x461f03['id']||0x0;this[_0x6e6e('0x0')]=_0x461f03[_0x6e6e('0x0')]||'';this[_0x6e6e('0x1')]=_0x461f03[_0x6e6e('0x1')]||_0x6e6e('0x2');this['originated']=0x0;this[_0x6e6e('0x3')]=0x0;this[_0x6e6e('0x4')]=0x0;this[_0x6e6e('0x5')]=0x0;this[_0x6e6e('0x6')]='';this[_0x6e6e('0x7')]=!![];this[_0x6e6e('0x8')]=_0x461f03[_0x6e6e('0x8')];this['limitCalls']=_0x461f03[_0x6e6e('0x9')];this[_0x6e6e('0xa')]=_0x461f03[_0x6e6e('0xa')]||null;this[_0x6e6e('0xb')]=_0x461f03['dialGlobalInterval']?_0x461f03[_0x6e6e('0xb')]:null;this[_0x6e6e('0xc')]=_0x461f03[_0x6e6e('0xc')];this[_0x6e6e('0xd')]=_0x461f03['dialOriginateCallerIdNumber'];this[_0x6e6e('0xe')]=_0x461f03['dialOriginateTimeout']||0x1e;this[_0x6e6e('0xf')]=_0x461f03[_0x6e6e('0xf')];this[_0x6e6e('0x10')]=_0x461f03[_0x6e6e('0x10')];this[_0x6e6e('0x11')]=_0x461f03[_0x6e6e('0x11')];this[_0x6e6e('0x12')]=_0x461f03[_0x6e6e('0x12')];this[_0x6e6e('0x13')]=_0x461f03[_0x6e6e('0x13')];this['dialNoAnswerRetryFrequency']=_0x461f03[_0x6e6e('0x14')];this[_0x6e6e('0x15')]=_0x461f03[_0x6e6e('0x15')];this['dialNoSuchNumberMaxRetry']=_0x461f03[_0x6e6e('0x16')]||0x3;this[_0x6e6e('0x17')]=_0x461f03[_0x6e6e('0x17')]||0x96;this[_0x6e6e('0x18')]=_0x461f03[_0x6e6e('0x18')]||0x3;this[_0x6e6e('0x19')]=_0x461f03[_0x6e6e('0x19')]||0x96;this[_0x6e6e('0x1a')]=_0x461f03['dialAbandonedMaxRetry']||0x3;this[_0x6e6e('0x1b')]=_0x461f03[_0x6e6e('0x1b')]||0x96;this['dialMachineMaxRetry']=_0x461f03['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x461f03[_0x6e6e('0x1c')]||0x96;this[_0x6e6e('0x1d')]=_0x461f03[_0x6e6e('0x1d')]||0x3;this[_0x6e6e('0x1e')]=_0x461f03['dialAgentRejectRetryFrequency']||0x96;this['dialOrderByScheduledAt']=_0x461f03[_0x6e6e('0x1f')]||_0x6e6e('0x20');this[_0x6e6e('0x21')]=_0x461f03[_0x6e6e('0x21')]||undefined;this[_0x6e6e('0x22')]=_0x461f03[_0x6e6e('0x22')]||undefined;this['dialCutDigit']=_0x461f03[_0x6e6e('0x23')]||undefined;this['TrunkBackup']=_0x461f03[_0x6e6e('0x24')]?_0x461f03[_0x6e6e('0x24')]:undefined;this['Trunk']=_0x461f03[_0x6e6e('0x25')]?_0x461f03[_0x6e6e('0x25')]:undefined;this[_0x6e6e('0x26')]=_0x461f03[_0x6e6e('0x26')]?_0x461f03[_0x6e6e('0x26')]:undefined;this[_0x6e6e('0x27')]=_0x461f03[_0x6e6e('0x27')]?_0x461f03[_0x6e6e('0x27')]:undefined;this[_0x6e6e('0x28')]=_0x461f03[_0x6e6e('0x27')]?_0x461f03['SquareProject'][_0x6e6e('0x0')]:undefined;this[_0x6e6e('0x29')]=_0x461f03[_0x6e6e('0x29')]||![];this[_0x6e6e('0x2a')]=_0x461f03['dialAMDInitialSilence'];this[_0x6e6e('0x2b')]=_0x461f03[_0x6e6e('0x2b')];this[_0x6e6e('0x2c')]=_0x461f03['dialAMDAfterGreetingSilence'];this[_0x6e6e('0x2d')]=_0x461f03[_0x6e6e('0x2d')];this[_0x6e6e('0x2e')]=_0x461f03['dialAMDMinWordLength'];this[_0x6e6e('0x2f')]=_0x461f03[_0x6e6e('0x2f')];this['dialAMDMaximumNumberOfWords']=_0x461f03[_0x6e6e('0x30')];this[_0x6e6e('0x31')]=_0x461f03[_0x6e6e('0x31')];this[_0x6e6e('0x32')]=_0x461f03['dialAMDMaximumWordLength'];}module[_0x6e6e('0x33')]=Campaign; \ No newline at end of file +var _0x0591=['dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength'];(function(_0x4fe17b,_0x3399c9){var _0x2973f3=function(_0x11cb84){while(--_0x11cb84){_0x4fe17b['push'](_0x4fe17b['shift']());}};_0x2973f3(++_0x3399c9);}(_0x0591,0x171));var _0x1059=function(_0x41f2f5,_0x14f33c){_0x41f2f5=_0x41f2f5-0x0;var _0x3d49f1=_0x0591[_0x41f2f5];return _0x3d49f1;};'use strict';function Campaign(_0x73f801){this['id']=_0x73f801['id']||0x0;this[_0x1059('0x0')]=_0x73f801[_0x1059('0x0')]||'';this[_0x1059('0x1')]=_0x73f801[_0x1059('0x1')]||_0x1059('0x2');this[_0x1059('0x3')]=0x0;this[_0x1059('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this[_0x1059('0x5')]='';this[_0x1059('0x6')]=!![];this[_0x1059('0x7')]=_0x73f801[_0x1059('0x7')];this[_0x1059('0x8')]=_0x73f801['limitCalls'];this[_0x1059('0x9')]=_0x73f801[_0x1059('0x9')]||null;this[_0x1059('0xa')]=_0x73f801['dialGlobalInterval']?_0x73f801[_0x1059('0xa')]:null;this[_0x1059('0xb')]=_0x73f801['dialOriginateCallerIdName'];this[_0x1059('0xc')]=_0x73f801['dialOriginateCallerIdNumber'];this[_0x1059('0xd')]=_0x73f801[_0x1059('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x73f801[_0x1059('0xe')];this[_0x1059('0xf')]=_0x73f801[_0x1059('0xf')];this['dialBusyMaxRetry']=_0x73f801[_0x1059('0x10')];this['dialBusyRetryFrequency']=_0x73f801[_0x1059('0x11')];this[_0x1059('0x12')]=_0x73f801['dialNoAnswerMaxRetry'];this[_0x1059('0x13')]=_0x73f801[_0x1059('0x13')];this[_0x1059('0x14')]=_0x73f801[_0x1059('0x14')];this[_0x1059('0x15')]=_0x73f801[_0x1059('0x15')]||0x3;this[_0x1059('0x16')]=_0x73f801[_0x1059('0x16')]||0x96;this[_0x1059('0x17')]=_0x73f801[_0x1059('0x17')]||0x3;this[_0x1059('0x18')]=_0x73f801[_0x1059('0x18')]||0x96;this[_0x1059('0x19')]=_0x73f801[_0x1059('0x19')]||0x3;this[_0x1059('0x1a')]=_0x73f801[_0x1059('0x1a')]||0x96;this['dialMachineMaxRetry']=_0x73f801[_0x1059('0x1b')]||0x3;this[_0x1059('0x1c')]=_0x73f801[_0x1059('0x1c')]||0x96;this[_0x1059('0x1d')]=_0x73f801[_0x1059('0x1d')]||0x3;this[_0x1059('0x1e')]=_0x73f801[_0x1059('0x1e')]||0x96;this[_0x1059('0x1f')]=_0x73f801[_0x1059('0x1f')]||_0x1059('0x20');this[_0x1059('0x21')]=_0x73f801[_0x1059('0x21')]||undefined;this[_0x1059('0x22')]=_0x73f801[_0x1059('0x22')]||undefined;this[_0x1059('0x23')]=_0x73f801['dialCutDigit']||undefined;this[_0x1059('0x24')]=_0x73f801[_0x1059('0x24')]?_0x73f801['TrunkBackup']:undefined;this[_0x1059('0x25')]=_0x73f801[_0x1059('0x25')]?_0x73f801['Trunk']:undefined;this['Interval']=_0x73f801[_0x1059('0x26')]?_0x73f801['Interval']:undefined;this[_0x1059('0x27')]=_0x73f801[_0x1059('0x27')]?_0x73f801[_0x1059('0x27')]:undefined;this[_0x1059('0x28')]=_0x73f801[_0x1059('0x27')]?_0x73f801[_0x1059('0x27')][_0x1059('0x0')]:undefined;this[_0x1059('0x29')]=_0x73f801[_0x1059('0x29')]||![];this['dialAMDInitialSilence']=_0x73f801[_0x1059('0x2a')];this[_0x1059('0x2b')]=_0x73f801['dialAMDGreeting'];this[_0x1059('0x2c')]=_0x73f801[_0x1059('0x2c')];this[_0x1059('0x2d')]=_0x73f801[_0x1059('0x2d')];this[_0x1059('0x2e')]=_0x73f801[_0x1059('0x2e')];this[_0x1059('0x2f')]=_0x73f801[_0x1059('0x2f')];this[_0x1059('0x30')]=_0x73f801[_0x1059('0x30')];this[_0x1059('0x31')]=_0x73f801[_0x1059('0x31')];this['dialAMDMaximumWordLength']=_0x73f801[_0x1059('0x32')];}module[_0x1059('0x33')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 551aebe..1d5593f 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 _0x1537=['disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferType','mohtime','exports','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','uniqueid','exten','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','holdtime','tag'];(function(_0x526bda,_0x3d2f95){var _0x929204=function(_0x3ca2c9){while(--_0x3ca2c9){_0x526bda['push'](_0x526bda['shift']());}};_0x929204(++_0x3d2f95);}(_0x1537,0x132));var _0x7153=function(_0x34cc1d,_0x5574f0){_0x34cc1d=_0x34cc1d-0x0;var _0x38f595=_0x1537[_0x34cc1d];return _0x38f595;};'use strict';function Channel(){this[_0x7153('0x0')]=null;this[_0x7153('0x1')]='';this['destinationchannel']='';this[_0x7153('0x2')]=0x0;this[_0x7153('0x3')]='';this[_0x7153('0x4')]=undefined;this[_0x7153('0x5')]=undefined;this[_0x7153('0x6')]=0x0;this['context']='';this[_0x7153('0x7')]=0x0;this['linkedid']=0x0;this[_0x7153('0x8')]=0x0;this['answered']=![];this[_0x7153('0x9')]=null;this[_0x7153('0xa')]=null;this[_0x7153('0xb')]=![];this[_0x7153('0xc')]=![];this[_0x7153('0xd')]='';this[_0x7153('0xe')]='';this[_0x7153('0xf')]=0x0;this['billableseconds']=0x0;this[_0x7153('0x10')]=0x0;this['type']=null;this[_0x7153('0x11')]=null;this[_0x7153('0x12')]=null;this[_0x7153('0x13')]=![];this[_0x7153('0x14')]=null;this[_0x7153('0x15')]=null;this[_0x7153('0x16')]=[];this[_0x7153('0x17')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x7153('0x18')]=undefined;this[_0x7153('0x19')]=0x0;}module[_0x7153('0x1a')]=Channel; \ No newline at end of file +var _0xff99=['billableseconds','holdtime','type','tag','disposition','monitor','queue','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','channel','calleridnum','accountcode','context','uniqueid','linkedid','answertime','endtime','unmanaged','abandoned','lastdata'];(function(_0x338f73,_0x1945c8){var _0x163fdf=function(_0x4cd033){while(--_0x4cd033){_0x338f73['push'](_0x338f73['shift']());}};_0x163fdf(++_0x1945c8);}(_0xff99,0x129));var _0x9ff9=function(_0x105089,_0x147509){_0x105089=_0x105089-0x0;var _0x3d3eec=_0xff99[_0x105089];return _0x3d3eec;};'use strict';function Channel(){this['starttime']=null;this[_0x9ff9('0x0')]='';this['destinationchannel']='';this[_0x9ff9('0x1')]=0x0;this['calleridname']='';this['connectedlinenum']=undefined;this['connectedlinename']=undefined;this[_0x9ff9('0x2')]=0x0;this[_0x9ff9('0x3')]='';this[_0x9ff9('0x4')]=0x0;this[_0x9ff9('0x5')]=0x0;this['exten']=0x0;this['answered']=![];this[_0x9ff9('0x6')]=null;this[_0x9ff9('0x7')]=null;this[_0x9ff9('0x8')]=![];this[_0x9ff9('0x9')]=![];this['lastapplication']='';this[_0x9ff9('0xa')]='';this['duration']=0x0;this[_0x9ff9('0xb')]=0x0;this[_0x9ff9('0xc')]=0x0;this[_0x9ff9('0xd')]=null;this[_0x9ff9('0xe')]=null;this[_0x9ff9('0xf')]=null;this[_0x9ff9('0x10')]=![];this['monitorFilename']=null;this[_0x9ff9('0x11')]=null;this['monitors']=[];this[_0x9ff9('0x12')]=undefined;this[_0x9ff9('0x13')]=undefined;this[_0x9ff9('0x14')]=undefined;this[_0x9ff9('0x15')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 55fabfc..72ede85 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 _0xbeec=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports'];(function(_0xf91841,_0x182ae3){var _0x4b9c44=function(_0x2e216e){while(--_0x2e216e){_0xf91841['push'](_0xf91841['shift']());}};_0x4b9c44(++_0x182ae3);}(_0xbeec,0x1ee));var _0xcbee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbeec[_0x3dd15e];return _0x231fd0;};'use strict';function DeskAccount(_0x18ffcc){this['id']=_0x18ffcc['id']||0x0;this[_0xcbee('0x0')]=_0x18ffcc['name']||'';this[_0xcbee('0x1')]=_0x18ffcc['username']||'';this['remoteUri']=_0x18ffcc[_0xcbee('0x2')]||'';this[_0xcbee('0x3')]=_0x18ffcc['authType']||'';this['password']=_0x18ffcc[_0xcbee('0x4')]||'';this['consumerKey']=_0x18ffcc[_0xcbee('0x5')]||'';this[_0xcbee('0x6')]=_0x18ffcc[_0xcbee('0x6')]||'';this['token']=_0x18ffcc[_0xcbee('0x7')]||'';this['tokenSecret']=_0x18ffcc[_0xcbee('0x8')]||'';this[_0xcbee('0x9')]=_0x18ffcc[_0xcbee('0x9')]||'';this[_0xcbee('0xa')]=_0x18ffcc[_0xcbee('0xa')]||'';this[_0xcbee('0xb')]=_0x18ffcc[_0xcbee('0xb')]||{};}module[_0xcbee('0xc')]=DeskAccount; \ No newline at end of file +var _0x2e32=['Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl'];(function(_0x26991c,_0x522f1d){var _0x5df01f=function(_0x3dd683){while(--_0x3dd683){_0x26991c['push'](_0x26991c['shift']());}};_0x5df01f(++_0x522f1d);}(_0x2e32,0x147));var _0x22e3=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x2e32[_0x4e9d3c];return _0x2d0825;};'use strict';function DeskAccount(_0x24e53b){this['id']=_0x24e53b['id']||0x0;this[_0x22e3('0x0')]=_0x24e53b[_0x22e3('0x0')]||'';this[_0x22e3('0x1')]=_0x24e53b[_0x22e3('0x1')]||'';this[_0x22e3('0x2')]=_0x24e53b[_0x22e3('0x2')]||'';this['authType']=_0x24e53b[_0x22e3('0x3')]||'';this['password']=_0x24e53b[_0x22e3('0x4')]||'';this[_0x22e3('0x5')]=_0x24e53b[_0x22e3('0x5')]||'';this['consumerSecret']=_0x24e53b[_0x22e3('0x6')]||'';this[_0x22e3('0x7')]=_0x24e53b[_0x22e3('0x7')]||'';this[_0x22e3('0x8')]=_0x24e53b[_0x22e3('0x8')]||'';this[_0x22e3('0x9')]=_0x24e53b[_0x22e3('0x9')]||'';this[_0x22e3('0xa')]=_0x24e53b['serverUrl']||'';this[_0x22e3('0xb')]=_0x24e53b[_0x22e3('0xb')]||{};}module[_0x22e3('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 2f9ddc8..63347c9 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 _0xa4a2=['password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','name','username'];(function(_0x5a0885,_0x47f82f){var _0x529bee=function(_0x55d3c6){while(--_0x55d3c6){_0x5a0885['push'](_0x5a0885['shift']());}};_0x529bee(++_0x47f82f);}(_0xa4a2,0x1cc));var _0x2a4a=function(_0x8d5a2,_0x19e7b0){_0x8d5a2=_0x8d5a2-0x0;var _0x5d2b2e=_0xa4a2[_0x8d5a2];return _0x5d2b2e;};'use strict';function Dynamics365Account(_0x45324e){this['id']=_0x45324e['id']||0x0;this['name']=_0x45324e[_0x2a4a('0x0')]||'';this['username']=_0x45324e[_0x2a4a('0x1')]||'';this[_0x2a4a('0x2')]=_0x45324e[_0x2a4a('0x2')]||'';this[_0x2a4a('0x3')]=_0x45324e[_0x2a4a('0x3')]||'';this[_0x2a4a('0x4')]=_0x45324e[_0x2a4a('0x4')]||'';this['clientId']=_0x45324e[_0x2a4a('0x5')]||'';this[_0x2a4a('0x6')]=_0x45324e['clientSecret']||{};this[_0x2a4a('0x7')]=_0x45324e['serverUrl']||'';this[_0x2a4a('0x8')]=_0x45324e[_0x2a4a('0x8')]||![];this[_0x2a4a('0x9')]=_0x45324e['Configurations']||{};this[_0x2a4a('0xa')]=_0x45324e[_0x2a4a('0xa')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x782a=['Configurations','CloudProvider','exports','name','password','remoteUri','clientId','clientSecret','serverUrl','modernAuthentication'];(function(_0x18bc67,_0x446533){var _0x22dea0=function(_0x42ab5e){while(--_0x42ab5e){_0x18bc67['push'](_0x18bc67['shift']());}};_0x22dea0(++_0x446533);}(_0x782a,0x1e3));var _0xa782=function(_0x261fc3,_0x2c4a8e){_0x261fc3=_0x261fc3-0x0;var _0x2a6fed=_0x782a[_0x261fc3];return _0x2a6fed;};'use strict';function Dynamics365Account(_0x511827){this['id']=_0x511827['id']||0x0;this['name']=_0x511827[_0xa782('0x0')]||'';this['username']=_0x511827['username']||'';this[_0xa782('0x1')]=_0x511827[_0xa782('0x1')]||'';this[_0xa782('0x2')]=_0x511827[_0xa782('0x2')]||'';this['tenantId']=_0x511827['tenantId']||'';this[_0xa782('0x3')]=_0x511827[_0xa782('0x3')]||'';this[_0xa782('0x4')]=_0x511827[_0xa782('0x4')]||{};this[_0xa782('0x5')]=_0x511827[_0xa782('0x5')]||'';this[_0xa782('0x6')]=_0x511827[_0xa782('0x6')]||![];this[_0xa782('0x7')]=_0x511827[_0xa782('0x7')]||{};this[_0xa782('0x8')]=_0x511827['CloudProvider']||{};}module[_0xa782('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index d708936..eae183b 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 _0x6152=['modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','minrate','maxrate'];(function(_0x36832f,_0x270f35){var _0x496c6a=function(_0x1fe6c3){while(--_0x1fe6c3){_0x36832f['push'](_0x36832f['shift']());}};_0x496c6a(++_0x270f35);}(_0x6152,0x170));var _0x2615=function(_0x301430,_0x1f5424){_0x301430=_0x301430-0x0;var _0x5d16a6=_0x6152[_0x301430];return _0x5d16a6;};'use strict';function FaxAccount(_0x366760){this['id']=_0x366760['id']||0x0;this[_0x2615('0x0')]=_0x366760['name']||'';this[_0x2615('0x1')]=_0x366760[_0x2615('0x1')];this[_0x2615('0x2')]=_0x366760[_0x2615('0x2')];this[_0x2615('0x3')]=_0x366760[_0x2615('0x3')];this['localstationid']=_0x366760['localstationid'];this[_0x2615('0x4')]=_0x366760[_0x2615('0x4')]||0x960;this['maxrate']=_0x366760[_0x2615('0x5')]||0x3840;this[_0x2615('0x6')]=_0x366760['modem']||_0x2615('0x7');this[_0x2615('0x8')]=_0x366760['gateway']||'no';this['faxdetect']=_0x366760[_0x2615('0x9')]||'no';this[_0x2615('0xa')]=_0x366760[_0x2615('0xa')]||0x1388;this['tech']=_0x366760[_0x2615('0xb')]||_0x2615('0xc');this[_0x2615('0xd')]=_0x366760[_0x2615('0xd')]?_0x366760[_0x2615('0xd')]:undefined;this['ListId']=_0x366760[_0x2615('0xe')];this[_0x2615('0xf')]=_0x366760['key'];}module[_0x2615('0x10')]=FaxAccount; \ No newline at end of file +var _0x64ce=['exports','name','description','ecm','headerinfo','localstationid','minrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key'];(function(_0x3a9f51,_0x19308a){var _0x314466=function(_0x3ae626){while(--_0x3ae626){_0x3a9f51['push'](_0x3a9f51['shift']());}};_0x314466(++_0x19308a);}(_0x64ce,0x1a1));var _0xe64c=function(_0x41032b,_0x5145d1){_0x41032b=_0x41032b-0x0;var _0x29d8d2=_0x64ce[_0x41032b];return _0x29d8d2;};'use strict';function FaxAccount(_0xe5cafb){this['id']=_0xe5cafb['id']||0x0;this[_0xe64c('0x0')]=_0xe5cafb[_0xe64c('0x0')]||'';this[_0xe64c('0x1')]=_0xe5cafb[_0xe64c('0x1')];this[_0xe64c('0x2')]=_0xe5cafb['ecm'];this[_0xe64c('0x3')]=_0xe5cafb[_0xe64c('0x3')];this['localstationid']=_0xe5cafb[_0xe64c('0x4')];this[_0xe64c('0x5')]=_0xe5cafb[_0xe64c('0x5')]||0x960;this['maxrate']=_0xe5cafb['maxrate']||0x3840;this[_0xe64c('0x6')]=_0xe5cafb[_0xe64c('0x6')]||'v17,v27,v29';this[_0xe64c('0x7')]=_0xe5cafb[_0xe64c('0x7')]||'no';this[_0xe64c('0x8')]=_0xe5cafb[_0xe64c('0x8')]||'no';this['t38timeout']=_0xe5cafb[_0xe64c('0x9')]||0x1388;this['tech']=_0xe5cafb[_0xe64c('0xa')]||_0xe64c('0xb');this[_0xe64c('0xc')]=_0xe5cafb['Trunk']?_0xe5cafb['Trunk']:undefined;this[_0xe64c('0xd')]=_0xe5cafb[_0xe64c('0xd')];this[_0xe64c('0xe')]=_0xe5cafb['key'];}module[_0xe64c('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 632fecb..5756e72 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 _0xf3d5=['remoteUri','serverUrl','Configurations','exports','name','username','token'];(function(_0x151721,_0x20d5bc){var _0x2deaa7=function(_0x499812){while(--_0x499812){_0x151721['push'](_0x151721['shift']());}};_0x2deaa7(++_0x20d5bc);}(_0xf3d5,0x162));var _0x5f3d=function(_0xfc3f65,_0x21f988){_0xfc3f65=_0xfc3f65-0x0;var _0xc3d341=_0xf3d5[_0xfc3f65];return _0xc3d341;};'use strict';function FreshdeskAccount(_0x2575f5){this['id']=_0x2575f5['id']||0x0;this[_0x5f3d('0x0')]=_0x2575f5[_0x5f3d('0x0')]||'';this[_0x5f3d('0x1')]=_0x2575f5['username']||'';this['apiKey']=_0x2575f5[_0x5f3d('0x2')]||'';this[_0x5f3d('0x3')]=_0x2575f5[_0x5f3d('0x3')]||'';this[_0x5f3d('0x4')]=_0x2575f5[_0x5f3d('0x4')]||'';this[_0x5f3d('0x5')]=_0x2575f5[_0x5f3d('0x5')]||{};}module[_0x5f3d('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x7ffa=['Configurations','name','username','apiKey','remoteUri','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7ffa,0x15d));var _0xa7ff=function(_0x2a6393,_0x12a2a8){_0x2a6393=_0x2a6393-0x0;var _0x495588=_0x7ffa[_0x2a6393];return _0x495588;};'use strict';function FreshdeskAccount(_0x22a3ec){this['id']=_0x22a3ec['id']||0x0;this[_0xa7ff('0x0')]=_0x22a3ec[_0xa7ff('0x0')]||'';this[_0xa7ff('0x1')]=_0x22a3ec[_0xa7ff('0x1')]||'';this[_0xa7ff('0x2')]=_0x22a3ec['token']||'';this[_0xa7ff('0x3')]=_0x22a3ec[_0xa7ff('0x3')]||'';this[_0xa7ff('0x4')]=_0x22a3ec[_0xa7ff('0x4')]||'';this[_0xa7ff('0x5')]=_0x22a3ec[_0xa7ff('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index d1f539e..06be999 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 _0xe700=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0xe700,0x75));var _0x0e70=function(_0x27e46d,_0x188bab){_0x27e46d=_0x27e46d-0x0;var _0x4c9cef=_0xe700[_0x27e46d];return _0x4c9cef;};'use strict';function FreshsalesAccount(_0x3600e2){this['id']=_0x3600e2['id']||0x0;this[_0x0e70('0x0')]=_0x3600e2[_0x0e70('0x0')]||'';this[_0x0e70('0x1')]=_0x3600e2[_0x0e70('0x1')]||'';this[_0x0e70('0x2')]=_0x3600e2[_0x0e70('0x3')]||'';this[_0x0e70('0x4')]=_0x3600e2[_0x0e70('0x4')]||'';this[_0x0e70('0x5')]=_0x3600e2['serverUrl']||'';this[_0x0e70('0x6')]=_0x3600e2['Configurations']||{};}module[_0x0e70('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x79d3=['exports','name','username','apiKey','remoteUri','serverUrl','Configurations'];(function(_0x366120,_0x4fe15f){var _0x5115be=function(_0xb6052a){while(--_0xb6052a){_0x366120['push'](_0x366120['shift']());}};_0x5115be(++_0x4fe15f);}(_0x79d3,0x15f));var _0x379d=function(_0x2a5262,_0x578588){_0x2a5262=_0x2a5262-0x0;var _0x483802=_0x79d3[_0x2a5262];return _0x483802;};'use strict';function FreshsalesAccount(_0x439d8d){this['id']=_0x439d8d['id']||0x0;this['name']=_0x439d8d[_0x379d('0x0')]||'';this['username']=_0x439d8d[_0x379d('0x1')]||'';this[_0x379d('0x2')]=_0x439d8d['token']||'';this[_0x379d('0x3')]=_0x439d8d[_0x379d('0x3')]||'';this[_0x379d('0x4')]=_0x439d8d[_0x379d('0x4')]||'';this[_0x379d('0x5')]=_0x439d8d[_0x379d('0x5')]||{};}module[_0x379d('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 b82dbfb..565d0fa 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 _0xe620=['uniqueid','calleridname','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','context','exten','priority','holdtime','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type'];(function(_0x5afc49,_0x5d8655){var _0x8c23fb=function(_0x296c1a){while(--_0x296c1a){_0x5afc49['push'](_0x5afc49['shift']());}};_0x8c23fb(++_0x5d8655);}(_0xe620,0x167));var _0x0e62=function(_0x32a22d,_0x17b134){_0x32a22d=_0x32a22d-0x0;var _0x302d10=_0xe620[_0x32a22d];return _0x302d10;};'use strict';function QueueReport(){this[_0x0e62('0x0')]='inbound';this[_0x0e62('0x1')]='';this['calleridnum']='';this[_0x0e62('0x2')]='';this['queue']='';this['queuecallerjoinAt']=null;this[_0x0e62('0x3')]=null;this[_0x0e62('0x4')]=0x1;this['count']=0x1;this[_0x0e62('0x5')]=![];this[_0x0e62('0x6')]=null;this[_0x0e62('0x7')]=![];this[_0x0e62('0x8')]=null;this['queuecallerexit']=![];this[_0x0e62('0x9')]=null;this[_0x0e62('0xa')]=0x1;this[_0x0e62('0xb')]='';this[_0x0e62('0xc')]='';this[_0x0e62('0xd')]='';this['accountcode']='';this[_0x0e62('0xe')]='';this[_0x0e62('0xf')]='';this[_0x0e62('0x10')]='';this[_0x0e62('0x11')]=0x0;this['assigned']=![];this[_0x0e62('0x12')]='';this[_0x0e62('0x13')]=_0x0e62('0x14');this[_0x0e62('0x15')]=0x0;this[_0x0e62('0x16')]={};}module[_0x0e62('0x17')]=QueueReport; \ No newline at end of file +var _0xa6ab=['position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','mohtime','variables','exports','type','inbound','calleridnum','queuecallerjoinAt','queuecallerleaveAt'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xa6ab,0xb1));var _0xba6a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa6ab[_0x20a584];return _0x4b41a8;};'use strict';function QueueReport(){this[_0xba6a('0x0')]=_0xba6a('0x1');this['uniqueid']='';this[_0xba6a('0x2')]='';this['calleridname']='';this['queue']='';this[_0xba6a('0x3')]=null;this[_0xba6a('0x4')]=null;this[_0xba6a('0x5')]=0x1;this[_0xba6a('0x6')]=0x1;this[_0xba6a('0x7')]=![];this[_0xba6a('0x8')]=null;this[_0xba6a('0x9')]=![];this[_0xba6a('0xa')]=null;this[_0xba6a('0xb')]=![];this[_0xba6a('0xc')]=null;this[_0xba6a('0xd')]=0x1;this[_0xba6a('0xe')]='';this[_0xba6a('0xf')]='';this['connectedlinename']='';this[_0xba6a('0x10')]='';this[_0xba6a('0x11')]='';this[_0xba6a('0x12')]='';this[_0xba6a('0x13')]='';this[_0xba6a('0x14')]=0x0;this[_0xba6a('0x15')]=![];this[_0xba6a('0x16')]='';this['motionChannel']='voice';this[_0xba6a('0x17')]=0x0;this[_0xba6a('0x18')]={};}module[_0xba6a('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 1f6b41c..90c5177 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 _0xb2ed=['Configurations','exports','name','username','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl'];(function(_0x5ed7d3,_0x2213e5){var _0x1312cd=function(_0x37036d){while(--_0x37036d){_0x5ed7d3['push'](_0x5ed7d3['shift']());}};_0x1312cd(++_0x2213e5);}(_0xb2ed,0x120));var _0xdb2e=function(_0x43a1b8,_0x1c90c8){_0x43a1b8=_0x43a1b8-0x0;var _0x324ecc=_0xb2ed[_0x43a1b8];return _0x324ecc;};'use strict';function SalesforceAccount(_0x39dab2){this['id']=_0x39dab2['id']||0x0;this[_0xdb2e('0x0')]=_0x39dab2['name']||'';this[_0xdb2e('0x1')]=_0x39dab2[_0xdb2e('0x1')]||'';this['remoteUri']=_0x39dab2['remoteUri']||'';this[_0xdb2e('0x2')]=_0x39dab2[_0xdb2e('0x2')]||'';this[_0xdb2e('0x3')]=_0x39dab2[_0xdb2e('0x3')]||'';this[_0xdb2e('0x4')]=_0x39dab2[_0xdb2e('0x4')]||'';this[_0xdb2e('0x5')]=_0x39dab2[_0xdb2e('0x5')]||'';this[_0xdb2e('0x6')]=_0x39dab2['type']||_0xdb2e('0x7');this[_0xdb2e('0x8')]=_0x39dab2[_0xdb2e('0x8')]||'';this[_0xdb2e('0x9')]=_0x39dab2[_0xdb2e('0x9')]||{};}module[_0xdb2e('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x0221=['clientId','clientSecret','securityToken','type','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x4666e0,_0x55bc41){var _0x172a88=function(_0x2fab85){while(--_0x2fab85){_0x4666e0['push'](_0x4666e0['shift']());}};_0x172a88(++_0x55bc41);}(_0x0221,0xc5));var _0x1022=function(_0x11b0d8,_0x5591a2){_0x11b0d8=_0x11b0d8-0x0;var _0x1438d3=_0x0221[_0x11b0d8];return _0x1438d3;};'use strict';function SalesforceAccount(_0x1077b2){this['id']=_0x1077b2['id']||0x0;this[_0x1022('0x0')]=_0x1077b2[_0x1022('0x0')]||'';this[_0x1022('0x1')]=_0x1077b2['username']||'';this[_0x1022('0x2')]=_0x1077b2[_0x1022('0x2')]||'';this['password']=_0x1077b2['password']||'';this['clientId']=_0x1077b2[_0x1022('0x3')]||'';this['clientSecret']=_0x1077b2[_0x1022('0x4')]||'';this[_0x1022('0x5')]=_0x1077b2[_0x1022('0x5')]||'';this[_0x1022('0x6')]=_0x1077b2[_0x1022('0x6')]||'integrationTab';this[_0x1022('0x7')]=_0x1077b2[_0x1022('0x7')]||'';this[_0x1022('0x8')]=_0x1077b2[_0x1022('0x8')]||{};}module[_0x1022('0x9')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 56d295c..912120f 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 _0x46b0=['remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x7c3555,_0x514fd9){var _0x49c4dc=function(_0x3530fb){while(--_0x3530fb){_0x7c3555['push'](_0x7c3555['shift']());}};_0x49c4dc(++_0x514fd9);}(_0x46b0,0x17e));var _0x046b=function(_0x31e280,_0x227714){_0x31e280=_0x31e280-0x0;var _0x1ee419=_0x46b0[_0x31e280];return _0x1ee419;};'use strict';function ServicenowAccount(_0x31e3f9){this['id']=_0x31e3f9['id']||0x0;this[_0x046b('0x0')]=_0x31e3f9[_0x046b('0x0')]||'';this[_0x046b('0x1')]=_0x31e3f9[_0x046b('0x1')]||'';this['password']=_0x31e3f9['password']||'';this[_0x046b('0x2')]=_0x31e3f9[_0x046b('0x2')]||'';this[_0x046b('0x3')]=_0x31e3f9['serverUrl']||'';this[_0x046b('0x4')]=_0x31e3f9[_0x046b('0x4')]||{};}module[_0x046b('0x5')]=ServicenowAccount; \ No newline at end of file +var _0x63c1=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x63c1,0x19c));var _0x163c=function(_0x56c04e,_0x555064){_0x56c04e=_0x56c04e-0x0;var _0x43024b=_0x63c1[_0x56c04e];return _0x43024b;};'use strict';function ServicenowAccount(_0x302171){this['id']=_0x302171['id']||0x0;this[_0x163c('0x0')]=_0x302171[_0x163c('0x0')]||'';this[_0x163c('0x1')]=_0x302171[_0x163c('0x1')]||'';this[_0x163c('0x2')]=_0x302171['password']||'';this[_0x163c('0x3')]=_0x302171[_0x163c('0x3')]||'';this[_0x163c('0x4')]=_0x302171[_0x163c('0x4')]||'';this['Configurations']=_0x302171[_0x163c('0x5')]||{};}module[_0x163c('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 02e5520..52bcbb2 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 _0x095c=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x357c00,_0x34f8e5){var _0x226bc2=function(_0xf11862){while(--_0xf11862){_0x357c00['push'](_0x357c00['shift']());}};_0x226bc2(++_0x34f8e5);}(_0x095c,0x1e6));var _0xc095=function(_0x22af85,_0x4eb048){_0x22af85=_0x22af85-0x0;var _0x78cf92=_0x095c[_0x22af85];return _0x78cf92;};'use strict';function SugarcrmAccount(_0x28532d){this['id']=_0x28532d['id']||0x0;this[_0xc095('0x0')]=_0x28532d[_0xc095('0x0')]||'';this['username']=_0x28532d[_0xc095('0x1')]||'';this[_0xc095('0x2')]=_0x28532d['password']||'';this[_0xc095('0x3')]=_0x28532d[_0xc095('0x3')]||'';this[_0xc095('0x4')]=_0x28532d[_0xc095('0x4')]||'';this['Configurations']=_0x28532d[_0xc095('0x5')]||{};}module[_0xc095('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x1349=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1349,0x69));var _0x9134=function(_0x2db798,_0x4308c8){_0x2db798=_0x2db798-0x0;var _0x2aaffe=_0x1349[_0x2db798];return _0x2aaffe;};'use strict';function SugarcrmAccount(_0x55aff4){this['id']=_0x55aff4['id']||0x0;this[_0x9134('0x0')]=_0x55aff4[_0x9134('0x0')]||'';this[_0x9134('0x1')]=_0x55aff4[_0x9134('0x1')]||'';this[_0x9134('0x2')]=_0x55aff4[_0x9134('0x2')]||'';this[_0x9134('0x3')]=_0x55aff4[_0x9134('0x3')]||'';this[_0x9134('0x4')]=_0x55aff4[_0x9134('0x4')]||'';this[_0x9134('0x5')]=_0x55aff4['Configurations']||{};}module[_0x9134('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 54ffe0a..e007be8 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 _0x8322=['name','accountcode','state','unknown','stateTime','status'];(function(_0x3cfb0d,_0x4df584){var _0x3486b4=function(_0x1b0939){while(--_0x1b0939){_0x3cfb0d['push'](_0x3cfb0d['shift']());}};_0x3486b4(++_0x4df584);}(_0x8322,0x186));var _0x2832=function(_0x1bd3ab,_0x352c42){_0x1bd3ab=_0x1bd3ab-0x0;var _0x37e394=_0x8322[_0x1bd3ab];return _0x37e394;};'use strict';function Telephone(_0x578fba){this['id']=_0x578fba['id']||0x0;this[_0x2832('0x0')]=_0x578fba[_0x2832('0x0')]||'';this[_0x2832('0x1')]=_0x578fba[_0x2832('0x1')]||'';this[_0x2832('0x2')]=_0x2832('0x3');this[_0x2832('0x4')]=0x0;this[_0x2832('0x5')]=_0x2832('0x3');this['address']='';}module['exports']=Telephone; \ No newline at end of file +var _0xa249=['accountcode','unknown','status','name'];(function(_0x479323,_0x1e0eae){var _0x260ea0=function(_0x381dca){while(--_0x381dca){_0x479323['push'](_0x479323['shift']());}};_0x260ea0(++_0x1e0eae);}(_0xa249,0x183));var _0x9a24=function(_0x1700ea,_0x3a4c49){_0x1700ea=_0x1700ea-0x0;var _0x47c2d9=_0xa249[_0x1700ea];return _0x47c2d9;};'use strict';function Telephone(_0x2bc00e){this['id']=_0x2bc00e['id']||0x0;this[_0x9a24('0x0')]=_0x2bc00e['name']||'';this[_0x9a24('0x1')]=_0x2bc00e[_0x9a24('0x1')]||'';this['state']=_0x9a24('0x2');this['stateTime']=0x0;this[_0x9a24('0x3')]='unknown';this['address']='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 94ae16e..7f38d0f 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x596851,_0x57cec1){var _0x10a700=function(_0x5a87e0){while(--_0x5a87e0){_0x596851['push'](_0x596851['shift']());}};_0x10a700(++_0x57cec1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x549fee,_0x573e8f){var _0x234388=function(_0x462907){while(--_0x462907){_0x549fee['push'](_0x549fee['shift']());}};_0x234388(++_0x573e8f);}(_0xb10b,0x12a));var _0xbb10=function(_0x10d34b,_0x4fef76){_0x10d34b=_0x10d34b-0x0;var _0x92b0bf=_0xb10b[_0x10d34b];return _0x92b0bf;};'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 diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 2dad10e..ce2b7d5 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 _0x757a=['name','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x293967,_0x3a27c6){var _0x1dcd88=function(_0x440aeb){while(--_0x440aeb){_0x293967['push'](_0x293967['shift']());}};_0x1dcd88(++_0x3a27c6);}(_0x757a,0xde));var _0xa757=function(_0x5c9014,_0x4afecd){_0x5c9014=_0x5c9014-0x0;var _0x33813a=_0x757a[_0x5c9014];return _0x33813a;};'use strict';function Trigger(_0x1acf7d){this['id']=_0x1acf7d['id']||0x0;this[_0xa757('0x0')]=_0x1acf7d[_0xa757('0x0')]||'';this['channel']=_0x1acf7d['channel']||'voice';this[_0xa757('0x1')]=_0x1acf7d[_0xa757('0x1')]||![];this[_0xa757('0x2')]=_0x1acf7d[_0xa757('0x2')]||[];this[_0xa757('0x3')]=_0x1acf7d[_0xa757('0x3')]||[];this['Actions']=_0x1acf7d[_0xa757('0x4')]||[];}module[_0xa757('0x5')]=Trigger; \ No newline at end of file +var _0x5f2f=['AnyConditions','Actions','exports','name','channel','voice','status'];(function(_0x1e13fd,_0x4c6abc){var _0x4c7bc8=function(_0x2d3219){while(--_0x2d3219){_0x1e13fd['push'](_0x1e13fd['shift']());}};_0x4c7bc8(++_0x4c6abc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x10304b,_0x507d1d){_0x10304b=_0x10304b-0x0;var _0xa1474e=_0x5f2f[_0x10304b];return _0xa1474e;};'use strict';function Trigger(_0x7c86d8){this['id']=_0x7c86d8['id']||0x0;this[_0xf5f2('0x0')]=_0x7c86d8[_0xf5f2('0x0')]||'';this[_0xf5f2('0x1')]=_0x7c86d8[_0xf5f2('0x1')]||_0xf5f2('0x2');this[_0xf5f2('0x3')]=_0x7c86d8[_0xf5f2('0x3')]||![];this['AllConditions']=_0x7c86d8['AllConditions']||[];this[_0xf5f2('0x4')]=_0x7c86d8[_0xf5f2('0x4')]||[];this[_0xf5f2('0x5')]=_0x7c86d8[_0xf5f2('0x5')]||[];}module[_0xf5f2('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index a7fff49..49d7d1c 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 _0x3ac1=['status','registry','indexOf','split','port','domain','domainport','refresh','stateRegistry','registrationtime','defaultuser','exports','active','name','unknown','stateTime'];(function(_0x3df25f,_0x10b54f){var _0x544a5c=function(_0x1add18){while(--_0x1add18){_0x3df25f['push'](_0x3df25f['shift']());}};_0x544a5c(++_0x10b54f);}(_0x3ac1,0x15c));var _0x13ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ac1[_0x3dd15e];return _0x231fd0;};'use strict';function Trunk(_0x5688f7){this['id']=_0x5688f7['id']||0x0;this['active']=_0x5688f7[_0x13ac('0x0')]||![];this['name']=_0x5688f7[_0x13ac('0x1')]||'';this['state']=_0x13ac('0x2');this[_0x13ac('0x3')]=0x0;this[_0x13ac('0x4')]=_0x13ac('0x2');this[_0x13ac('0x5')]=_0x5688f7[_0x13ac('0x5')]&&_0x5688f7['registry'][_0x13ac('0x6')](':')?_0x5688f7[_0x13ac('0x5')][_0x13ac('0x7')](':')[0x0]:'';this['host']='';this[_0x13ac('0x8')]='';this[_0x13ac('0x9')]='';this[_0x13ac('0xa')]='';this[_0x13ac('0xb')]='';this[_0x13ac('0xc')]=_0x13ac('0x2');this[_0x13ac('0xd')]='';this['address']='';this[_0x13ac('0xe')]=_0x5688f7['defaultuser']||'';}module[_0x13ac('0xf')]=Trunk; \ No newline at end of file +var _0x922e=['indexOf','split','host','port','domainport','refresh','address','defaultuser','exports','active','name','state','unknown','stateTime','status','registry'];(function(_0x2b9a41,_0x4f2b1f){var _0x50d057=function(_0x39b628){while(--_0x39b628){_0x2b9a41['push'](_0x2b9a41['shift']());}};_0x50d057(++_0x4f2b1f);}(_0x922e,0x1c9));var _0xe922=function(_0x1e1bf,_0x4791b5){_0x1e1bf=_0x1e1bf-0x0;var _0x4fa851=_0x922e[_0x1e1bf];return _0x4fa851;};'use strict';function Trunk(_0x5565fc){this['id']=_0x5565fc['id']||0x0;this[_0xe922('0x0')]=_0x5565fc['active']||![];this['name']=_0x5565fc[_0xe922('0x1')]||'';this[_0xe922('0x2')]=_0xe922('0x3');this[_0xe922('0x4')]=0x0;this[_0xe922('0x5')]=_0xe922('0x3');this[_0xe922('0x6')]=_0x5565fc[_0xe922('0x6')]&&_0x5565fc[_0xe922('0x6')][_0xe922('0x7')](':')?_0x5565fc[_0xe922('0x6')][_0xe922('0x8')](':')[0x0]:'';this[_0xe922('0x9')]='';this[_0xe922('0xa')]='';this['domain']='';this[_0xe922('0xb')]='';this[_0xe922('0xc')]='';this['stateRegistry']=_0xe922('0x3');this['registrationtime']='';this[_0xe922('0xd')]='';this['defaultuser']=_0x5565fc[_0xe922('0xe')]||'';}module[_0xe922('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 cfd9e16..a83504a 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 _0xd7fb=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x41e44d,_0xaa2219){var _0x43562e=function(_0x183388){while(--_0x183388){_0x41e44d['push'](_0x41e44d['shift']());}};_0x43562e(++_0xaa2219);}(_0xd7fb,0x1cc));var _0xbd7f=function(_0x5a12cb,_0x33562f){_0x5a12cb=_0x5a12cb-0x0;var _0x283e61=_0xd7fb[_0x5a12cb];return _0x283e61;};'use strict';function voiceExtension(_0x537fac){this['id']=_0x537fac['id']||0x0;this[_0xbd7f('0x0')]=_0x537fac['exten']||'';this[_0xbd7f('0x1')]=_0x537fac[_0xbd7f('0x1')]||_0xbd7f('0x2');this[_0xbd7f('0x3')]=_0x537fac[_0xbd7f('0x3')]||![];}module[_0xbd7f('0x4')]=voiceExtension; \ No newline at end of file +var _0xc614=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x47072e,_0x5da3db){var _0x37822a=function(_0x411f06){while(--_0x411f06){_0x47072e['push'](_0x47072e['shift']());}};_0x37822a(++_0x5da3db);}(_0xc614,0x1b7));var _0x4c61=function(_0x39b95f,_0x2ddcb0){_0x39b95f=_0x39b95f-0x0;var _0x40bfed=_0xc614[_0x39b95f];return _0x40bfed;};'use strict';function voiceExtension(_0x5886cd){this['id']=_0x5886cd['id']||0x0;this[_0x4c61('0x0')]=_0x5886cd['exten']||'';this[_0x4c61('0x1')]=_0x5886cd[_0x4c61('0x1')]||_0x4c61('0x2');this[_0x4c61('0x3')]=_0x5886cd[_0x4c61('0x3')]||![];}module[_0x4c61('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 d2536e8..853307e 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 _0x4932=['dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialCutDigit','queueStatusComplete','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','linear','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','loggedIn','notInUse','onHold','paused','ringInUse','talking','unavailable','acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','originated','temp','dialTimezone'];(function(_0x2764bd,_0x4ce81c){var _0x3e166f=function(_0x441ad7){while(--_0x441ad7){_0x2764bd['push'](_0x2764bd['shift']());}};_0x3e166f(++_0x4ce81c);}(_0x4932,0x164));var _0x2493=function(_0x36632d,_0x88a327){_0x36632d=_0x36632d-0x0;var _0xa585a5=_0x4932[_0x36632d];return _0xa585a5;};'use strict';var monitorFormat={'wav':_0x2493('0x0'),'wav49':_0x2493('0x1'),'gsm':_0x2493('0x2')};var strategy={'fewestcalls':_0x2493('0x3'),'leastrecent':'leastrecent','linear':_0x2493('0x4'),'random':_0x2493('0x5'),'ringall':_0x2493('0x6'),'rr':_0x2493('0x7'),'rrmemory':_0x2493('0x8'),'rrordered':_0x2493('0x9'),'wrandom':_0x2493('0xa')};function VoiceQueue(_0x224abc){this['id']=_0x224abc['id']||0x0;this['name']=_0x224abc[_0x2493('0xb')]||'';this['monitor_format']=_0x224abc[_0x2493('0xc')]||'';this[_0x2493('0xd')]=_0x224abc[_0x2493('0xd')]||_0x2493('0xe');this[_0x2493('0xf')]=0x0;this[_0x2493('0x10')]=0x0;this[_0x2493('0x11')]=0x0;this['sumDuration']=0x0;this[_0x2493('0x12')]=0x0;this[_0x2493('0x13')]=0x0;this[_0x2493('0x14')]=0x0;this[_0x2493('0x15')]=0x0;this[_0x2493('0x16')]=0x0;this[_0x2493('0x17')]=0x0;this[_0x2493('0x18')]=0x0;this['invalid']=0x0;this[_0x2493('0x19')]=0x0;this[_0x2493('0x1a')]=0x0;this[_0x2493('0x1b')]=0x0;this[_0x2493('0x1c')]=0x0;this['ringing']=0x0;this[_0x2493('0x1d')]=0x0;this[_0x2493('0x1e')]=0x0;this[_0x2493('0x1f')]=0x0;this['unknown']=0x0;this[_0x2493('0x20')]=_0x224abc[_0x2493('0x20')]||![];this[_0x2493('0x21')]=_0x224abc['acwTimeout']||0xa;this[_0x2493('0x22')]=_0x224abc[_0x2493('0x22')]||'no';this[_0x2493('0x23')]=!![];this['message']='';this[_0x2493('0x24')]='';this[_0x2493('0x25')]=0x0;this[_0x2493('0x26')]=0x0;this[_0x2493('0x27')]=_0x224abc[_0x2493('0x27')]||null;this['dialGlobalInterval']=_0x224abc[_0x2493('0x28')]?_0x224abc['dialGlobalInterval']:null;this[_0x2493('0x29')]=_0x224abc['dialActive'];this['dialMethod']=_0x224abc[_0x2493('0x2a')]||_0x2493('0x2b');this['dialLimitChannel']=_0x224abc[_0x2493('0x2c')]||0x0;this['dialLimitQueue']=_0x224abc[_0x2493('0x2d')]||0x0;this['dialPowerLevel']=_0x224abc[_0x2493('0x2e')]||0x1;this[_0x2493('0x2f')]=_0x224abc[_0x2493('0x2f')]||'dropRate';this[_0x2493('0x30')]=_0x224abc['dialPredictiveOptimizationPercentage']||0.03;this[_0x2493('0x31')]=_0x224abc[_0x2493('0x31')]||0x258;this['dialOriginateCallerIdName']=_0x224abc['dialOriginateCallerIdName']||_0x2493('0x32');this[_0x2493('0x33')]=_0x224abc[_0x2493('0x33')]||_0x2493('0x32');this[_0x2493('0x34')]=_0x224abc['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x224abc[_0x2493('0x35')]||_0x2493('0x36');this['dialQueueTimeout']=_0x224abc[_0x2493('0x37')]||0x3;this[_0x2493('0x38')]=_0x224abc[_0x2493('0x38')]||undefined;this['dialCongestionMaxRetry']=_0x224abc['dialCongestionMaxRetry']||0x3;this[_0x2493('0x39')]=_0x224abc[_0x2493('0x39')]||0x96;this['dialBusyMaxRetry']=_0x224abc[_0x2493('0x3a')]||0x3;this[_0x2493('0x3b')]=_0x224abc[_0x2493('0x3b')]||0x96;this[_0x2493('0x3c')]=_0x224abc[_0x2493('0x3c')]||0x3;this[_0x2493('0x3d')]=_0x224abc[_0x2493('0x3d')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x224abc[_0x2493('0x3e')]||0x3;this[_0x2493('0x3f')]=_0x224abc[_0x2493('0x3f')]||0x96;this[_0x2493('0x40')]=_0x224abc[_0x2493('0x40')]||0x3;this[_0x2493('0x41')]=_0x224abc[_0x2493('0x41')]||0x96;this[_0x2493('0x42')]=_0x224abc[_0x2493('0x42')]||0x3;this[_0x2493('0x43')]=_0x224abc[_0x2493('0x43')]||0x96;this['dialMachineMaxRetry']=_0x224abc[_0x2493('0x44')]||0x3;this[_0x2493('0x45')]=_0x224abc[_0x2493('0x45')]||0x96;this[_0x2493('0x46')]=_0x224abc[_0x2493('0x46')]||0x3;this['dialAgentRejectRetryFrequency']=_0x224abc[_0x2493('0x47')]||0x96;this['callAdditionalPhoneAfterMin']=_0x224abc[_0x2493('0x48')]||0x3;this[_0x2493('0x49')]=_0x224abc[_0x2493('0x49')]||0x4;this['Trunk']=_0x224abc[_0x2493('0x4a')]?_0x224abc['Trunk']:undefined;this[_0x2493('0x4b')]=_0x224abc[_0x2493('0x4b')]?_0x224abc['TrunkBackup']:undefined;this[_0x2493('0x4c')]=_0x224abc[_0x2493('0x4c')]||undefined;this[_0x2493('0x4d')]=_0x224abc['Interval']?_0x224abc['Interval']:undefined;this['dialOrderByScheduledAt']=_0x224abc[_0x2493('0x4e')]||_0x2493('0x4f');this['dialRandomLastDigitCallerIdNumber']=_0x224abc['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x2493('0x50')]=_0x224abc['dialCutDigit']||undefined;this['strategy']=strategy[_0x224abc['strategy']];this[_0x2493('0x51')]=!![];this[_0x2493('0x52')]=_0x224abc[_0x2493('0x52')]||![];this['dialAMDInitialSilence']=_0x224abc['dialAMDInitialSilence'];this[_0x2493('0x53')]=_0x224abc[_0x2493('0x53')];this[_0x2493('0x54')]=_0x224abc[_0x2493('0x54')];this[_0x2493('0x55')]=_0x224abc[_0x2493('0x55')];this['dialAMDMinWordLength']=_0x224abc[_0x2493('0x56')];this[_0x2493('0x57')]=_0x224abc['dialAMDBetweenWordsSilence'];this[_0x2493('0x58')]=_0x224abc[_0x2493('0x58')];this[_0x2493('0x59')]=_0x224abc[_0x2493('0x59')];this[_0x2493('0x5a')]=_0x224abc[_0x2493('0x5a')];this[_0x2493('0x5b')]=0x0;this[_0x2493('0x5c')]=0x0;this[_0x2493('0x5d')]=_0x224abc[_0x2493('0x5d')];this[_0x2493('0x5e')]=0x0;this[_0x2493('0x5f')]=0x0;this[_0x2493('0x60')]=0x0;this[_0x2493('0x61')]=0x0;this[_0x2493('0x62')]=0x0;this[_0x2493('0x63')]=0x0;this[_0x2493('0x64')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x2493('0x65')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x2493('0x66')]=0x0;this[_0x2493('0x67')]=0x0;this[_0x2493('0x68')]=0x0;this[_0x2493('0x69')]=undefined;this['startPredictive']=undefined;this[_0x2493('0x6a')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x2493('0x6b')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x2493('0x6c')]=0x0;this[_0x2493('0x6d')]=0x0;this[_0x2493('0x6e')]=0x0;this[_0x2493('0x6f')]=0x0;this[_0x2493('0x70')]=_0x224abc[_0x2493('0x71')]||0x14;this['predictiveIntervalMinThreshold']=_0x224abc[_0x2493('0x71')]||0xa;this[_0x2493('0x72')]=0x0;this[_0x2493('0x73')]=0x0;this[_0x2493('0x74')]=0x1;this[_0x2493('0x75')]=0x0;this[_0x2493('0x76')]=0x0;this[_0x2493('0x77')]=0x0;this[_0x2493('0x78')]=0x0;this['dialRecallMeTimeout']=_0x224abc[_0x2493('0x79')]||0x1e;this[_0x2493('0x7a')]=_0x224abc['dialRecallInQueue']||![];this[_0x2493('0x7b')]=!!_0x224abc['dialPreviewAutoRecallMe']||![];this[_0x2493('0x7c')]=!!_0x224abc['dialPreviewRecallmeReminder']||![];this['dialQueueProject2']=_0x224abc[_0x2493('0x7d')]||undefined;this[_0x2493('0x7e')]=_0x224abc[_0x2493('0x7e')]||![];this[_0x2493('0x7f')]=_0x224abc[_0x2493('0x7f')]||![];this[_0x2493('0xc')]=monitorFormat[_0x224abc[_0x2493('0xc')]]?monitorFormat[_0x224abc[_0x2493('0xc')]]:undefined;this['mandatoryDisposition']=_0x224abc[_0x2493('0x80')]||![];this[_0x2493('0x81')]=_0x224abc[_0x2493('0x81')]?_0x224abc[_0x2493('0x81')]:undefined;this[_0x2493('0x82')]=![];}module[_0x2493('0x83')]=VoiceQueue; \ No newline at end of file +var _0xe202=['outboundBusyCallsDay','outboundCongestionCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','leastrecent','ringall','roundrobin','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumHoldTime','sumBillable','unmanaged','abandoned','available','inUse','loggedIn','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','dialTimezone','dialGlobalInterval','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialRandomLastDigitCallerIdNumber','dialCutDigit','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay'];(function(_0x505df9,_0x14138e){var _0x1cc025=function(_0x5d2a1f){while(--_0x5d2a1f){_0x505df9['push'](_0x505df9['shift']());}};_0x1cc025(++_0x14138e);}(_0xe202,0x194));var _0x2e20=function(_0x13c315,_0x71739b){_0x13c315=_0x13c315-0x0;var _0x4a3246=_0xe202[_0x13c315];return _0x4a3246;};'use strict';var monitorFormat={'wav':_0x2e20('0x0'),'wav49':_0x2e20('0x1'),'gsm':_0x2e20('0x2')};var strategy={'fewestcalls':_0x2e20('0x3'),'leastrecent':_0x2e20('0x4'),'linear':'linear','random':'random','ringall':_0x2e20('0x5'),'rr':_0x2e20('0x6'),'rrmemory':'rrmemory','rrordered':_0x2e20('0x7'),'wrandom':_0x2e20('0x8')};function VoiceQueue(_0xacf618){this['id']=_0xacf618['id']||0x0;this[_0x2e20('0x9')]=_0xacf618[_0x2e20('0x9')]||'';this['monitor_format']=_0xacf618[_0x2e20('0xa')]||'';this['type']=_0xacf618[_0x2e20('0xb')]||_0x2e20('0xc');this[_0x2e20('0xd')]=0x0;this[_0x2e20('0xe')]=0x0;this[_0x2e20('0xf')]=0x0;this['sumDuration']=0x0;this[_0x2e20('0x10')]=0x0;this[_0x2e20('0x11')]=0x0;this[_0x2e20('0x12')]=0x0;this[_0x2e20('0x13')]=0x0;this[_0x2e20('0x14')]=0x0;this['busy']=0x0;this[_0x2e20('0x15')]=0x0;this['invalid']=0x0;this[_0x2e20('0x16')]=0x0;this[_0x2e20('0x17')]=0x0;this[_0x2e20('0x18')]=0x0;this[_0x2e20('0x19')]=0x0;this[_0x2e20('0x1a')]=0x0;this[_0x2e20('0x1b')]=0x0;this[_0x2e20('0x1c')]=0x0;this[_0x2e20('0x1d')]=0x0;this[_0x2e20('0x1e')]=0x0;this[_0x2e20('0x1f')]=_0xacf618[_0x2e20('0x1f')]||![];this[_0x2e20('0x20')]=_0xacf618['acwTimeout']||0xa;this['autopause']=_0xacf618[_0x2e20('0x21')]||'no';this[_0x2e20('0x22')]=!![];this[_0x2e20('0x23')]='';this['statusMessage']='';this['originated']=0x0;this['temp']=0x0;this[_0x2e20('0x24')]=_0xacf618[_0x2e20('0x24')]||null;this[_0x2e20('0x25')]=_0xacf618[_0x2e20('0x25')]?_0xacf618[_0x2e20('0x25')]:null;this['dialActive']=_0xacf618['dialActive'];this['dialMethod']=_0xacf618[_0x2e20('0x26')]||_0x2e20('0x27');this[_0x2e20('0x28')]=_0xacf618['dialLimitChannel']||0x0;this[_0x2e20('0x29')]=_0xacf618[_0x2e20('0x29')]||0x0;this[_0x2e20('0x2a')]=_0xacf618[_0x2e20('0x2a')]||0x1;this[_0x2e20('0x2b')]=_0xacf618[_0x2e20('0x2b')]||_0x2e20('0x2c');this['dialPredictiveOptimizationPercentage']=_0xacf618['dialPredictiveOptimizationPercentage']||0.03;this[_0x2e20('0x2d')]=_0xacf618['dialPredictiveInterval']||0x258;this[_0x2e20('0x2e')]=_0xacf618[_0x2e20('0x2e')]||_0x2e20('0x2f');this[_0x2e20('0x30')]=_0xacf618[_0x2e20('0x30')]||_0x2e20('0x2f');this['dialOriginateTimeout']=_0xacf618['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0xacf618[_0x2e20('0x31')]||_0x2e20('0x32');this['dialQueueTimeout']=_0xacf618[_0x2e20('0x33')]||0x3;this[_0x2e20('0x34')]=_0xacf618['dialQueueProject']||undefined;this[_0x2e20('0x35')]=_0xacf618[_0x2e20('0x35')]||0x3;this[_0x2e20('0x36')]=_0xacf618[_0x2e20('0x36')]||0x96;this[_0x2e20('0x37')]=_0xacf618[_0x2e20('0x37')]||0x3;this['dialBusyRetryFrequency']=_0xacf618[_0x2e20('0x38')]||0x96;this['dialNoAnswerMaxRetry']=_0xacf618['dialNoAnswerMaxRetry']||0x3;this[_0x2e20('0x39')]=_0xacf618[_0x2e20('0x39')]||0x96;this['dialNoSuchNumberMaxRetry']=_0xacf618[_0x2e20('0x3a')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0xacf618[_0x2e20('0x3b')]||0x96;this['dialDropMaxRetry']=_0xacf618[_0x2e20('0x3c')]||0x3;this['dialDropRetryFrequency']=_0xacf618[_0x2e20('0x3d')]||0x96;this[_0x2e20('0x3e')]=_0xacf618['dialAbandonedMaxRetry']||0x3;this[_0x2e20('0x3f')]=_0xacf618[_0x2e20('0x3f')]||0x96;this['dialMachineMaxRetry']=_0xacf618[_0x2e20('0x40')]||0x3;this['dialMachineRetryFrequency']=_0xacf618[_0x2e20('0x41')]||0x96;this[_0x2e20('0x42')]=_0xacf618[_0x2e20('0x42')]||0x3;this[_0x2e20('0x43')]=_0xacf618[_0x2e20('0x43')]||0x96;this['callAdditionalPhoneAfterMin']=_0xacf618[_0x2e20('0x44')]||0x3;this[_0x2e20('0x45')]=_0xacf618[_0x2e20('0x45')]||0x4;this[_0x2e20('0x46')]=_0xacf618[_0x2e20('0x46')]?_0xacf618[_0x2e20('0x46')]:undefined;this[_0x2e20('0x47')]=_0xacf618[_0x2e20('0x47')]?_0xacf618[_0x2e20('0x47')]:undefined;this[_0x2e20('0x48')]=_0xacf618[_0x2e20('0x48')]||undefined;this[_0x2e20('0x49')]=_0xacf618[_0x2e20('0x49')]?_0xacf618['Interval']:undefined;this['dialOrderByScheduledAt']=_0xacf618['dialOrderByScheduledAt']||'DESC';this[_0x2e20('0x4a')]=_0xacf618[_0x2e20('0x4a')]||undefined;this[_0x2e20('0x4b')]=_0xacf618[_0x2e20('0x4b')]||undefined;this['strategy']=strategy[_0xacf618['strategy']];this[_0x2e20('0x4c')]=!![];this[_0x2e20('0x4d')]=_0xacf618['dialAMDActive']||![];this['dialAMDInitialSilence']=_0xacf618[_0x2e20('0x4e')];this[_0x2e20('0x4f')]=_0xacf618['dialAMDGreeting'];this[_0x2e20('0x50')]=_0xacf618[_0x2e20('0x50')];this['dialAMDTotalAnalysisTime']=_0xacf618['dialAMDTotalAnalysisTime'];this[_0x2e20('0x51')]=_0xacf618[_0x2e20('0x51')];this[_0x2e20('0x52')]=_0xacf618[_0x2e20('0x52')];this['dialAMDMaximumNumberOfWords']=_0xacf618['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0xacf618['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0xacf618[_0x2e20('0x53')];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this[_0x2e20('0x54')]=_0xacf618[_0x2e20('0x54')];this[_0x2e20('0x55')]=0x0;this[_0x2e20('0x56')]=0x0;this[_0x2e20('0x57')]=0x0;this[_0x2e20('0x58')]=0x0;this[_0x2e20('0x59')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x2e20('0x5a')]=0x0;this[_0x2e20('0x5b')]=0x0;this[_0x2e20('0x5c')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x2e20('0x5d')]=0x0;this[_0x2e20('0x5e')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x2e20('0x5f')]=undefined;this[_0x2e20('0x60')]=undefined;this[_0x2e20('0x61')]=undefined;this[_0x2e20('0x62')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x2e20('0x63')]=0x0;this[_0x2e20('0x64')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x2e20('0x65')]=0x0;this[_0x2e20('0x66')]=0x0;this[_0x2e20('0x67')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x2e20('0x68')]=_0xacf618[_0x2e20('0x69')]||0x14;this[_0x2e20('0x6a')]=_0xacf618[_0x2e20('0x69')]||0xa;this[_0x2e20('0x6b')]=0x0;this[_0x2e20('0x6c')]=0x0;this[_0x2e20('0x6d')]=0x1;this[_0x2e20('0x6e')]=0x0;this[_0x2e20('0x6f')]=0x0;this[_0x2e20('0x70')]=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0xacf618[_0x2e20('0x71')]||0x1e;this[_0x2e20('0x72')]=_0xacf618['dialRecallInQueue']||![];this['dialPreviewAutoRecallMe']=!!_0xacf618[_0x2e20('0x73')]||![];this[_0x2e20('0x74')]=!!_0xacf618[_0x2e20('0x74')]||![];this[_0x2e20('0x75')]=_0xacf618[_0x2e20('0x75')]||undefined;this[_0x2e20('0x76')]=_0xacf618['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0xacf618[_0x2e20('0x77')]||![];this[_0x2e20('0xa')]=monitorFormat[_0xacf618['monitor_format']]?monitorFormat[_0xacf618[_0x2e20('0xa')]]:undefined;this['mandatoryDisposition']=_0xacf618['mandatoryDisposition']||![];this[_0x2e20('0x78')]=_0xacf618[_0x2e20('0x78')]?_0xacf618[_0x2e20('0x78')]:undefined;this[_0x2e20('0x79')]=![];}module[_0x2e20('0x7a')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 8bd858d..bb00747 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 _0xfa45=['queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue','preview','exports','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','inUse','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','callers','length','SIP/','online','includes','status','dialMethod','booked'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xfa45,0x11b));var _0x5fa4=function(_0x40671a,_0x3f74a2){_0x40671a=_0x40671a-0x0;var _0x3ddfc1=_0xfa45[_0x40671a];return _0x3ddfc1;};'use strict';var INBOUND_COUNTERS=[_0x5fa4('0x0'),_0x5fa4('0x1'),_0x5fa4('0x2'),_0x5fa4('0x3'),_0x5fa4('0x4'),_0x5fa4('0x5'),_0x5fa4('0x6')];var OUTBOUND_COUNTERS=['available',_0x5fa4('0x7'),'inUse',_0x5fa4('0x1'),_0x5fa4('0x2'),_0x5fa4('0x8'),_0x5fa4('0x9'),_0x5fa4('0xa'),_0x5fa4('0xb'),_0x5fa4('0xc'),_0x5fa4('0xd'),_0x5fa4('0xe'),_0x5fa4('0xf'),'outboundReCallsDay',_0x5fa4('0x10'),'outboundUnknownCallsDay',_0x5fa4('0x3'),_0x5fa4('0x11'),_0x5fa4('0x5'),_0x5fa4('0x12'),_0x5fa4('0x13'),_0x5fa4('0x14'),_0x5fa4('0x6')];function VoiceQueueSummary(_0x18ae74){this['id']=_0x18ae74['id'];this['name']=_0x18ae74[_0x5fa4('0x15')];this['strategy']=_0x18ae74[_0x5fa4('0x16')];this[_0x5fa4('0x17')]=_0x18ae74[_0x5fa4('0x17')]||0x0;this[_0x5fa4('0x7')]=_0x18ae74[_0x5fa4('0x7')]||0x0;this['available']=_0x18ae74[_0x5fa4('0x0')]||0x0;this[_0x5fa4('0x18')]=_0x18ae74['busy']||0x0;this[_0x5fa4('0x19')]=_0x18ae74[_0x5fa4('0x19')]||0x0;this['invalid']=_0x18ae74[_0x5fa4('0x1a')]||0x0;this['loggedIn']=_0x18ae74['loggedIn']||0x0;this[_0x5fa4('0x2')]=_0x18ae74[_0x5fa4('0x2')]||0x0;this[_0x5fa4('0x1b')]=_0x18ae74[_0x5fa4('0x1b')]||0x0;this[_0x5fa4('0x1c')]=_0x18ae74[_0x5fa4('0x1c')]||0x0;this['paused']=_0x18ae74[_0x5fa4('0x3')]||0x0;this[_0x5fa4('0x4')]=_0x18ae74[_0x5fa4('0x4')]||0x0;this[_0x5fa4('0x1d')]=_0x18ae74[_0x5fa4('0x1d')];this[_0x5fa4('0x12')]=_0x18ae74[_0x5fa4('0x12')];this[_0x5fa4('0x13')]=_0x18ae74[_0x5fa4('0x13')];this[_0x5fa4('0x1e')]=_0x18ae74[_0x5fa4('0x1e')]||0x0;this[_0x5fa4('0x5')]=_0x18ae74['talking']||0x0;this['total']=_0x18ae74[_0x5fa4('0x14')]||0x0;this[_0x5fa4('0x1f')]=_0x18ae74[_0x5fa4('0x1f')];this[_0x5fa4('0x20')]=_0x18ae74['unavailable']||0x0;this['unknown']=_0x18ae74[_0x5fa4('0x21')]||0x0;this['unmanaged']=_0x18ae74[_0x5fa4('0x22')]||0x0;this[_0x5fa4('0x6')]=_0x18ae74[_0x5fa4('0x6')]||0x0;if(_0x18ae74[_0x5fa4('0x1f')]==='outbound'){this[_0x5fa4('0x11')]=_0x18ae74[_0x5fa4('0x11')]||0x0;this[_0x5fa4('0x23')]=_0x18ae74[_0x5fa4('0x23')];this['dialMethod']=_0x18ae74['dialMethod'];this[_0x5fa4('0x24')]=_0x18ae74[_0x5fa4('0x24')];this[_0x5fa4('0x25')]=_0x18ae74[_0x5fa4('0x25')];this['dialOriginateTimeout']=_0x18ae74[_0x5fa4('0x26')];this[_0x5fa4('0x27')]=_0x18ae74[_0x5fa4('0x27')];this[_0x5fa4('0x28')]=_0x18ae74['temp'];this['outboundAnswerAgiCallsDay']=_0x18ae74[_0x5fa4('0x29')];this[_0x5fa4('0xa')]=_0x18ae74[_0x5fa4('0xa')];this[_0x5fa4('0xb')]=_0x18ae74['outboundBlacklistCallsDay'];this[_0x5fa4('0xc')]=_0x18ae74[_0x5fa4('0xc')];this[_0x5fa4('0xd')]=_0x18ae74[_0x5fa4('0xd')];this[_0x5fa4('0x2a')]=_0x18ae74[_0x5fa4('0x2a')];this[_0x5fa4('0x2b')]=_0x18ae74[_0x5fa4('0x2b')];this[_0x5fa4('0x2c')]=_0x18ae74['outboundDropCallsDayTimeout'];this[_0x5fa4('0xe')]=_0x18ae74[_0x5fa4('0xe')];this[_0x5fa4('0xf')]=_0x18ae74['outboundNoSuchCallsDay'];this[_0x5fa4('0x2d')]=_0x18ae74[_0x5fa4('0x2d')];this[_0x5fa4('0x2e')]=_0x18ae74[_0x5fa4('0x2e')];this[_0x5fa4('0x10')]=_0x18ae74[_0x5fa4('0x10')];this['outboundUnknownCallsDay']=_0x18ae74[_0x5fa4('0x2f')];this[_0x5fa4('0x30')]=_0x18ae74[_0x5fa4('0x30')];this[_0x5fa4('0x31')]=_0x18ae74[_0x5fa4('0x31')];this['predictiveIntervalAvgTalktime']=_0x18ae74[_0x5fa4('0x32')];this[_0x5fa4('0x33')]=_0x18ae74['predictiveIntervalDroppedCallsCallersExit'];this[_0x5fa4('0x34')]=_0x18ae74['predictiveIntervalDroppedCallsTimeout'];this[_0x5fa4('0x35')]=_0x18ae74['predictiveIntervalErlangCalls'];this[_0x5fa4('0x36')]=_0x18ae74[_0x5fa4('0x36')];this['predictiveIntervalHitRate']=_0x18ae74['predictiveIntervalHitRate'];this['predictiveIntervalMultiplicativeFactor']=_0x18ae74[_0x5fa4('0x37')];this[_0x5fa4('0x38')]=_0x18ae74[_0x5fa4('0x38')];this[_0x5fa4('0x39')]=_0x18ae74['predictiveIntervalAvailable'];this['predictiveIntervalTotalCalls']=_0x18ae74[_0x5fa4('0x3a')];this[_0x5fa4('0x8')]=_0x18ae74[_0x5fa4('0x8')];this['erlangCalls']=_0x18ae74[_0x5fa4('0x3b')];this[_0x5fa4('0x3c')]=_0x18ae74[_0x5fa4('0x3c')];this['erlangAbandonmentRate']=_0x18ae74[_0x5fa4('0x3d')];this[_0x5fa4('0x3e')]=_0x18ae74['erlangBusyFactor'];this[_0x5fa4('0x3f')]=_0x18ae74['startPredictive'];this[_0x5fa4('0x40')]=_0x18ae74[_0x5fa4('0x40')];this[_0x5fa4('0x41')]=_0x18ae74[_0x5fa4('0x41')];this['statusMessage']=_0x18ae74[_0x5fa4('0x42')];}if(_0x18ae74[_0x5fa4('0x43')]){this[_0x5fa4('0x43')]={'id':_0x18ae74[_0x5fa4('0x43')]['id'],'name':_0x18ae74['Trunk'][_0x5fa4('0x15')],'active':_0x18ae74[_0x5fa4('0x43')][_0x5fa4('0x44')],'callerid':_0x18ae74[_0x5fa4('0x43')][_0x5fa4('0x45')]};}}VoiceQueueSummary[_0x5fa4('0x46')][_0x5fa4('0x47')]=function(_0x41683c,_0x2d8f0f,_0x530745,_0x1b0476){this[_0x5fa4('0x2')]=0x0;this[_0x5fa4('0x5')]=0x0;this[_0x5fa4('0x3')]=0x0;this[_0x5fa4('0x21')]=0x0;this[_0x5fa4('0x1c')]=0x0;this[_0x5fa4('0x19')]=0x0;this[_0x5fa4('0x18')]=0x0;this[_0x5fa4('0x1a')]=0x0;this[_0x5fa4('0x20')]=0x0;this[_0x5fa4('0x4')]=0x0;this[_0x5fa4('0x1d')]=0x0;this['onHold']=0x0;if(_0x530745){if(_0x530745[_0x5fa4('0x0')]){this[_0x5fa4('0x0')]=Number(_0x530745[_0x5fa4('0x0')]);}if(_0x530745[_0x5fa4('0x48')]){this[_0x5fa4('0x1')]=Number(_0x530745['loggedin']);}if(_0x530745[_0x5fa4('0x49')]){this[_0x5fa4('0x6')]=Number(_0x530745[_0x5fa4('0x49')]);}}for(var _0x3564a=0x0;_0x3564a<_0x41683c[_0x5fa4('0x4a')];_0x3564a++){var _0x343050=_0x2d8f0f[_0x5fa4('0x4b')+_0x41683c[_0x3564a][_0x5fa4('0x15')]];if(_0x343050&&_0x343050[_0x5fa4('0x4c')]){this[_0x5fa4('0x2')]+=0x1;}if(_0x41683c[_0x3564a]['incall']==='1'){this[_0x5fa4('0x5')]+=0x1;}if(_0x41683c[_0x3564a][_0x5fa4('0x3')]==='1'&&!['2','7','8'][_0x5fa4('0x4d')](_0x41683c[_0x3564a][_0x5fa4('0x4e')])){this[_0x5fa4('0x3')]+=0x1;}switch(_0x41683c[_0x3564a][_0x5fa4('0x4e')]){case'0':this[_0x5fa4('0x21')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x5fa4('0x18')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x5fa4('0x20')]+=0x1;break;case'6':this[_0x5fa4('0x4')]+=0x1;break;case'7':this[_0x5fa4('0x1d')]+=0x1;break;case'8':this[_0x5fa4('0x1b')]+=0x1;break;}}if(this[_0x5fa4('0x4f')]===_0x5fa4('0x50')){var _0x3c15f8=Object['keys'](_0x1b0476);for(var _0x6e95a=0x0;_0x6e95a<_0x3c15f8[_0x5fa4('0x4a')];_0x6e95a++){var _0x3e1713=_0x3c15f8[_0x6e95a];var _0x56524d=_0x1b0476[_0x3e1713];if(_0x56524d[_0x5fa4('0x51')]===this['name']&&_0x56524d[_0x5fa4('0x1f')]===_0x5fa4('0x52')&&_0x56524d[_0x5fa4('0x53')]===_0x5fa4('0x54')){this[_0x5fa4('0x5')]+=0x1;}}if(this[_0x5fa4('0x5')]>this[_0x5fa4('0x19')]){this['talking']=this[_0x5fa4('0x19')];}this[_0x5fa4('0x11')]=0x0;}return this;};VoiceQueueSummary[_0x5fa4('0x46')][_0x5fa4('0x55')]=function(_0xe060e6){var _0x53f975=![];if(_0xe060e6){_0x53f975=INBOUND_COUNTERS[_0x5fa4('0x56')](function(_0x3588ef){return this[_0x3588ef]!==_0xe060e6[_0x3588ef];},this);}return _0x53f975;};VoiceQueueSummary[_0x5fa4('0x46')][_0x5fa4('0x57')]=function(_0x51b344){var _0x2eb78e=![];var _0x408669=![];var _0x4a4660=![];if(_0x51b344){_0x2eb78e=this[_0x5fa4('0x4f')]!==_0x51b344[_0x5fa4('0x4f')]||this['dialActive']!==_0x51b344[_0x5fa4('0x23')]||this[_0x5fa4('0x41')]!==_0x51b344[_0x5fa4('0x41')]||this[_0x5fa4('0x42')]!==_0x51b344[_0x5fa4('0x42')];_0x408669=OUTBOUND_COUNTERS[_0x5fa4('0x56')](function(_0x110b49){return this[_0x110b49]!==_0x51b344[_0x110b49];},this);if(this[_0x5fa4('0x43')]&&_0x51b344[_0x5fa4('0x43')]){_0x4a4660=this[_0x5fa4('0x43')][_0x5fa4('0x15')]!==_0x51b344['Trunk'][_0x5fa4('0x15')]||this[_0x5fa4('0x43')][_0x5fa4('0x44')]!==_0x51b344[_0x5fa4('0x43')]['active'];}}return _0x2eb78e||_0x408669||_0x4a4660;};VoiceQueueSummary[_0x5fa4('0x46')][_0x5fa4('0x58')]=function(_0x1e5378){this[_0x5fa4('0x7')]=_0x1e5378[_0x5fa4('0x7')];this[_0x5fa4('0x41')]=_0x1e5378['message'];this[_0x5fa4('0x42')]=_0x1e5378['statusMessage'];this[_0x5fa4('0x8')]=_0x1e5378[_0x5fa4('0x8')];this[_0x5fa4('0x9')]=_0x1e5378[_0x5fa4('0x9')];this[_0x5fa4('0xa')]=_0x1e5378[_0x5fa4('0xa')];this[_0x5fa4('0xb')]=_0x1e5378[_0x5fa4('0xb')];this[_0x5fa4('0xc')]=_0x1e5378[_0x5fa4('0xc')];this[_0x5fa4('0xd')]=_0x1e5378['outboundCongestionCallsDay'];this[_0x5fa4('0xe')]=_0x1e5378['outboundNoAnswerCallsDay'];this[_0x5fa4('0xf')]=_0x1e5378[_0x5fa4('0xf')];this[_0x5fa4('0x2e')]=_0x1e5378['outboundReCallsDay'];this[_0x5fa4('0x10')]=_0x1e5378[_0x5fa4('0x10')];this[_0x5fa4('0x2f')]=_0x1e5378['outboundUnknownCallsDay'];this['sumBillable']=_0x1e5378[_0x5fa4('0x12')];this['sumDuration']=_0x1e5378[_0x5fa4('0x13')];this['total']=_0x1e5378['total'];if(this[_0x5fa4('0x4f')]===_0x5fa4('0x59')){this[_0x5fa4('0x11')]=_0x1e5378['pTalking'];}};module[_0x5fa4('0x5a')]=VoiceQueueSummary; \ No newline at end of file +var _0x68f5=['active','loggedin','callers','length','SIP/','online','incall','includes','busy','dialMethod','booked','keys','queue','dialer','exten','xcally-motion-preview','prototype','compareToInboundQueue','some','compareToOutboundQueue','preview','available','loggedIn','loggedInDb','ringing','talking','waiting','answered','originated','outboundAbandonedCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','outboundUnknownCallsDay','paused','sumBillable','sumDuration','total','name','strategy','abandoned','inUse','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','pTalking','dialActive','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','message','statusMessage','Trunk'];(function(_0x4578c8,_0x56ad28){var _0x1dd636=function(_0x381355){while(--_0x381355){_0x4578c8['push'](_0x4578c8['shift']());}};_0x1dd636(++_0x56ad28);}(_0x68f5,0x11a));var _0x568f=function(_0x3508b2,_0x29aaef){_0x3508b2=_0x3508b2-0x0;var _0x10280c=_0x68f5[_0x3508b2];return _0x10280c;};'use strict';var INBOUND_COUNTERS=[_0x568f('0x0'),_0x568f('0x1'),_0x568f('0x2'),'paused',_0x568f('0x3'),_0x568f('0x4'),_0x568f('0x5')];var OUTBOUND_COUNTERS=[_0x568f('0x0'),_0x568f('0x6'),'inUse',_0x568f('0x1'),_0x568f('0x2'),_0x568f('0x7'),_0x568f('0x8'),'outboundAnswerCallsDay','outboundBlacklistCallsDay',_0x568f('0x9'),_0x568f('0xa'),_0x568f('0xb'),'outboundNoSuchCallsDay',_0x568f('0xc'),'outboundRejectCallsDay',_0x568f('0xd'),_0x568f('0xe'),'pTalking',_0x568f('0x4'),_0x568f('0xf'),_0x568f('0x10'),_0x568f('0x11'),_0x568f('0x5')];function VoiceQueueSummary(_0x339bdd){this['id']=_0x339bdd['id'];this[_0x568f('0x12')]=_0x339bdd[_0x568f('0x12')];this[_0x568f('0x13')]=_0x339bdd['strategy'];this[_0x568f('0x14')]=_0x339bdd[_0x568f('0x14')]||0x0;this[_0x568f('0x6')]=_0x339bdd[_0x568f('0x6')]||0x0;this['available']=_0x339bdd[_0x568f('0x0')]||0x0;this['busy']=_0x339bdd['busy']||0x0;this[_0x568f('0x15')]=_0x339bdd[_0x568f('0x15')]||0x0;this[_0x568f('0x16')]=_0x339bdd[_0x568f('0x16')]||0x0;this[_0x568f('0x1')]=_0x339bdd[_0x568f('0x1')]||0x0;this[_0x568f('0x2')]=_0x339bdd[_0x568f('0x2')]||0x0;this[_0x568f('0x17')]=_0x339bdd[_0x568f('0x17')]||0x0;this[_0x568f('0x18')]=_0x339bdd['notInUse']||0x0;this[_0x568f('0xe')]=_0x339bdd[_0x568f('0xe')]||0x0;this[_0x568f('0x3')]=_0x339bdd[_0x568f('0x3')]||0x0;this[_0x568f('0x19')]=_0x339bdd[_0x568f('0x19')];this[_0x568f('0xf')]=_0x339bdd[_0x568f('0xf')];this[_0x568f('0x10')]=_0x339bdd[_0x568f('0x10')];this[_0x568f('0x1a')]=_0x339bdd[_0x568f('0x1a')]||0x0;this[_0x568f('0x4')]=_0x339bdd[_0x568f('0x4')]||0x0;this[_0x568f('0x11')]=_0x339bdd[_0x568f('0x11')]||0x0;this[_0x568f('0x1b')]=_0x339bdd[_0x568f('0x1b')];this[_0x568f('0x1c')]=_0x339bdd[_0x568f('0x1c')]||0x0;this[_0x568f('0x1d')]=_0x339bdd[_0x568f('0x1d')]||0x0;this[_0x568f('0x1e')]=_0x339bdd[_0x568f('0x1e')]||0x0;this[_0x568f('0x5')]=_0x339bdd[_0x568f('0x5')]||0x0;if(_0x339bdd['type']==='outbound'){this[_0x568f('0x1f')]=_0x339bdd[_0x568f('0x1f')]||0x0;this[_0x568f('0x20')]=_0x339bdd[_0x568f('0x20')];this['dialMethod']=_0x339bdd['dialMethod'];this[_0x568f('0x21')]=_0x339bdd['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x339bdd['dialOriginateCallerIdNumber'];this[_0x568f('0x22')]=_0x339bdd['dialOriginateTimeout'];this[_0x568f('0x23')]=_0x339bdd['dialPrefix'];this[_0x568f('0x24')]=_0x339bdd[_0x568f('0x24')];this[_0x568f('0x25')]=_0x339bdd['outboundAnswerAgiCallsDay'];this[_0x568f('0x26')]=_0x339bdd[_0x568f('0x26')];this['outboundBlacklistCallsDay']=_0x339bdd[_0x568f('0x27')];this['outboundBusyCallsDay']=_0x339bdd[_0x568f('0x9')];this['outboundCongestionCallsDay']=_0x339bdd['outboundCongestionCallsDay'];this[_0x568f('0x28')]=_0x339bdd[_0x568f('0x28')];this[_0x568f('0x29')]=_0x339bdd[_0x568f('0x29')];this[_0x568f('0x2a')]=_0x339bdd[_0x568f('0x2a')];this[_0x568f('0xb')]=_0x339bdd[_0x568f('0xb')];this['outboundNoSuchCallsDay']=_0x339bdd[_0x568f('0x2b')];this[_0x568f('0x2c')]=_0x339bdd[_0x568f('0x2c')];this[_0x568f('0xc')]=_0x339bdd['outboundReCallsDay'];this[_0x568f('0x2d')]=_0x339bdd[_0x568f('0x2d')];this[_0x568f('0xd')]=_0x339bdd[_0x568f('0xd')];this[_0x568f('0x2e')]=_0x339bdd[_0x568f('0x2e')];this[_0x568f('0x2f')]=_0x339bdd['predictiveIntervalAvgHoldtime'];this[_0x568f('0x30')]=_0x339bdd[_0x568f('0x30')];this[_0x568f('0x31')]=_0x339bdd[_0x568f('0x31')];this[_0x568f('0x32')]=_0x339bdd['predictiveIntervalDroppedCallsTimeout'];this['predictiveIntervalErlangCalls']=_0x339bdd[_0x568f('0x33')];this[_0x568f('0x34')]=_0x339bdd[_0x568f('0x34')];this[_0x568f('0x35')]=_0x339bdd[_0x568f('0x35')];this['predictiveIntervalMultiplicativeFactor']=_0x339bdd[_0x568f('0x36')];this[_0x568f('0x37')]=_0x339bdd[_0x568f('0x37')];this[_0x568f('0x38')]=_0x339bdd[_0x568f('0x38')];this[_0x568f('0x39')]=_0x339bdd[_0x568f('0x39')];this[_0x568f('0x7')]=_0x339bdd[_0x568f('0x7')];this[_0x568f('0x3a')]=_0x339bdd[_0x568f('0x3a')];this[_0x568f('0x3b')]=_0x339bdd[_0x568f('0x3b')];this[_0x568f('0x3c')]=_0x339bdd[_0x568f('0x3c')];this['erlangBusyFactor']=_0x339bdd[_0x568f('0x3d')];this['startPredictive']=_0x339bdd['startPredictive'];this[_0x568f('0x3e')]=_0x339bdd['startProgressive'];this[_0x568f('0x3f')]=_0x339bdd[_0x568f('0x3f')];this['statusMessage']=_0x339bdd[_0x568f('0x40')];}if(_0x339bdd[_0x568f('0x41')]){this[_0x568f('0x41')]={'id':_0x339bdd[_0x568f('0x41')]['id'],'name':_0x339bdd[_0x568f('0x41')]['name'],'active':_0x339bdd[_0x568f('0x41')][_0x568f('0x42')],'callerid':_0x339bdd['Trunk']['callerid']};}}VoiceQueueSummary['prototype']['createReport']=function(_0x3bcf12,_0x36bd1a,_0x3366e1,_0xead285){this[_0x568f('0x2')]=0x0;this['talking']=0x0;this[_0x568f('0xe')]=0x0;this[_0x568f('0x1d')]=0x0;this[_0x568f('0x18')]=0x0;this['inUse']=0x0;this['busy']=0x0;this[_0x568f('0x16')]=0x0;this['unavailable']=0x0;this[_0x568f('0x3')]=0x0;this[_0x568f('0x19')]=0x0;this['onHold']=0x0;if(_0x3366e1){if(_0x3366e1[_0x568f('0x0')]){this[_0x568f('0x0')]=Number(_0x3366e1[_0x568f('0x0')]);}if(_0x3366e1['loggedin']){this['loggedIn']=Number(_0x3366e1[_0x568f('0x43')]);}if(_0x3366e1[_0x568f('0x44')]){this['waiting']=Number(_0x3366e1['callers']);}}for(var _0x2c7c78=0x0;_0x2c7c78<_0x3bcf12[_0x568f('0x45')];_0x2c7c78++){var _0x5cd63a=_0x36bd1a[_0x568f('0x46')+_0x3bcf12[_0x2c7c78]['name']];if(_0x5cd63a&&_0x5cd63a[_0x568f('0x47')]){this['loggedInDb']+=0x1;}if(_0x3bcf12[_0x2c7c78][_0x568f('0x48')]==='1'){this[_0x568f('0x4')]+=0x1;}if(_0x3bcf12[_0x2c7c78][_0x568f('0xe')]==='1'&&!['2','7','8'][_0x568f('0x49')](_0x3bcf12[_0x2c7c78]['status'])){this[_0x568f('0xe')]+=0x1;}switch(_0x3bcf12[_0x2c7c78]['status']){case'0':this[_0x568f('0x1d')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x568f('0x4a')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x568f('0x1c')]+=0x1;break;case'6':this[_0x568f('0x3')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0x568f('0x17')]+=0x1;break;}}if(this[_0x568f('0x4b')]===_0x568f('0x4c')){var _0x4fa4a4=Object[_0x568f('0x4d')](_0xead285);for(var _0x1fe7c5=0x0;_0x1fe7c5<_0x4fa4a4[_0x568f('0x45')];_0x1fe7c5++){var _0x34336f=_0x4fa4a4[_0x1fe7c5];var _0x4e109e=_0xead285[_0x34336f];if(_0x4e109e[_0x568f('0x4e')]===this[_0x568f('0x12')]&&_0x4e109e['type']===_0x568f('0x4f')&&_0x4e109e[_0x568f('0x50')]===_0x568f('0x51')){this[_0x568f('0x4')]+=0x1;}}if(this[_0x568f('0x4')]>this['inUse']){this[_0x568f('0x4')]=this['inUse'];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0x568f('0x52')][_0x568f('0x53')]=function(_0x4513a0){var _0x49943e=![];if(_0x4513a0){_0x49943e=INBOUND_COUNTERS[_0x568f('0x54')](function(_0x379f87){return this[_0x379f87]!==_0x4513a0[_0x379f87];},this);}return _0x49943e;};VoiceQueueSummary['prototype'][_0x568f('0x55')]=function(_0x5ed4d8){var _0x1abd9f=![];var _0x146dc8=![];var _0x28cd48=![];if(_0x5ed4d8){_0x1abd9f=this[_0x568f('0x4b')]!==_0x5ed4d8[_0x568f('0x4b')]||this[_0x568f('0x20')]!==_0x5ed4d8[_0x568f('0x20')]||this[_0x568f('0x3f')]!==_0x5ed4d8[_0x568f('0x3f')]||this[_0x568f('0x40')]!==_0x5ed4d8[_0x568f('0x40')];_0x146dc8=OUTBOUND_COUNTERS[_0x568f('0x54')](function(_0x4fdcd8){return this[_0x4fdcd8]!==_0x5ed4d8[_0x4fdcd8];},this);if(this[_0x568f('0x41')]&&_0x5ed4d8[_0x568f('0x41')]){_0x28cd48=this[_0x568f('0x41')][_0x568f('0x12')]!==_0x5ed4d8[_0x568f('0x41')][_0x568f('0x12')]||this[_0x568f('0x41')]['active']!==_0x5ed4d8[_0x568f('0x41')][_0x568f('0x42')];}}return _0x1abd9f||_0x146dc8||_0x28cd48;};VoiceQueueSummary[_0x568f('0x52')]['updateReportFromOutboundQueue']=function(_0x29cc1f){this[_0x568f('0x6')]=_0x29cc1f[_0x568f('0x6')];this[_0x568f('0x3f')]=_0x29cc1f[_0x568f('0x3f')];this[_0x568f('0x40')]=_0x29cc1f[_0x568f('0x40')];this[_0x568f('0x7')]=_0x29cc1f['originated'];this[_0x568f('0x8')]=_0x29cc1f[_0x568f('0x8')];this[_0x568f('0x26')]=_0x29cc1f['outboundAnswerCallsDay'];this[_0x568f('0x27')]=_0x29cc1f[_0x568f('0x27')];this[_0x568f('0x9')]=_0x29cc1f[_0x568f('0x9')];this[_0x568f('0xa')]=_0x29cc1f[_0x568f('0xa')];this[_0x568f('0xb')]=_0x29cc1f[_0x568f('0xb')];this[_0x568f('0x2b')]=_0x29cc1f[_0x568f('0x2b')];this[_0x568f('0xc')]=_0x29cc1f[_0x568f('0xc')];this[_0x568f('0x2d')]=_0x29cc1f[_0x568f('0x2d')];this[_0x568f('0xd')]=_0x29cc1f[_0x568f('0xd')];this[_0x568f('0xf')]=_0x29cc1f[_0x568f('0xf')];this['sumDuration']=_0x29cc1f[_0x568f('0x10')];this[_0x568f('0x11')]=_0x29cc1f[_0x568f('0x11')];if(this[_0x568f('0x4b')]===_0x568f('0x56')){this[_0x568f('0x1f')]=_0x29cc1f[_0x568f('0x1f')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 5076316..f97b818 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 _0x18c9=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x1097d7,_0x1bf6df){var _0x140177=function(_0x5ea0c2){while(--_0x5ea0c2){_0x1097d7['push'](_0x1097d7['shift']());}};_0x140177(++_0x1bf6df);}(_0x18c9,0x72));var _0x918c=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x18c9[_0x50aa2e];return _0x5e07f0;};'use strict';function VtigerAccount(_0x50af68){this['id']=_0x50af68['id']||0x0;this[_0x918c('0x0')]=_0x50af68[_0x918c('0x0')]||'';this[_0x918c('0x1')]=_0x50af68[_0x918c('0x1')]||'';this['accessKey']=_0x50af68[_0x918c('0x2')]||'';this[_0x918c('0x3')]=_0x50af68[_0x918c('0x3')]||'';this[_0x918c('0x4')]=_0x50af68['serverUrl']||'';this[_0x918c('0x5')]=_0x50af68[_0x918c('0x5')]||{};}module[_0x918c('0x6')]=VtigerAccount; \ No newline at end of file +var _0x547b=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x1488cd,_0x25a893){var _0x63fa13=function(_0x57dd1c){while(--_0x57dd1c){_0x1488cd['push'](_0x1488cd['shift']());}};_0x63fa13(++_0x25a893);}(_0x547b,0xd0));var _0xb547=function(_0x5b4c8d,_0x547cb1){_0x5b4c8d=_0x5b4c8d-0x0;var _0x549420=_0x547b[_0x5b4c8d];return _0x549420;};'use strict';function VtigerAccount(_0x5022b1){this['id']=_0x5022b1['id']||0x0;this[_0xb547('0x0')]=_0x5022b1['name']||'';this[_0xb547('0x1')]=_0x5022b1[_0xb547('0x1')]||'';this['accessKey']=_0x5022b1[_0xb547('0x2')]||'';this['remoteUri']=_0x5022b1[_0xb547('0x3')]||'';this['serverUrl']=_0x5022b1[_0xb547('0x4')]||'';this[_0xb547('0x5')]=_0x5022b1[_0xb547('0x5')]||{};}module[_0xb547('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 0cd1efa..ed96a18 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 _0x5c24=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x5c24,0xe4));var _0x45c2=function(_0x503306,_0x356f2f){_0x503306=_0x503306-0x0;var _0x44a99d=_0x5c24[_0x503306];return _0x44a99d;};'use strict';function ZendeskAccount(_0x55c438){this['id']=_0x55c438['id']||0x0;this['name']=_0x55c438[_0x45c2('0x0')]||'';this[_0x45c2('0x1')]=_0x55c438[_0x45c2('0x1')]||'';this['password']=_0x55c438[_0x45c2('0x2')]||'';this[_0x45c2('0x3')]=_0x55c438['token']||'';this[_0x45c2('0x4')]=_0x55c438[_0x45c2('0x4')]||'';this[_0x45c2('0x5')]=_0x55c438[_0x45c2('0x5')]||'';this[_0x45c2('0x6')]=_0x55c438[_0x45c2('0x6')]||_0x45c2('0x7');this[_0x45c2('0x8')]=_0x55c438[_0x45c2('0x8')]||'';this[_0x45c2('0x9')]=_0x55c438['Configurations']||{};}module[_0x45c2('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x8993=['authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x8993,0x1dc));var _0x3899=function(_0x51dfdf,_0x312b0d){_0x51dfdf=_0x51dfdf-0x0;var _0x469694=_0x8993[_0x51dfdf];return _0x469694;};'use strict';function ZendeskAccount(_0x183cd0){this['id']=_0x183cd0['id']||0x0;this[_0x3899('0x0')]=_0x183cd0[_0x3899('0x0')]||'';this[_0x3899('0x1')]=_0x183cd0[_0x3899('0x1')]||'';this[_0x3899('0x2')]=_0x183cd0[_0x3899('0x2')]||'';this['token']=_0x183cd0[_0x3899('0x3')]||'';this['remoteUri']=_0x183cd0['remoteUri']||'';this[_0x3899('0x4')]=_0x183cd0[_0x3899('0x4')]||'';this[_0x3899('0x5')]=_0x183cd0[_0x3899('0x5')]||_0x3899('0x6');this[_0x3899('0x7')]=_0x183cd0['serverUrl']||'';this['Configurations']=_0x183cd0[_0x3899('0x8')]||{};}module[_0x3899('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 41bc712..7219d63 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 _0x9555=['clientSecret','code','refreshToken','Configurations','exports','name','description','host','zone','clientId'];(function(_0x4048e8,_0xad9040){var _0x1c843d=function(_0x23480f){while(--_0x23480f){_0x4048e8['push'](_0x4048e8['shift']());}};_0x1c843d(++_0xad9040);}(_0x9555,0xe1));var _0x5955=function(_0x2d47a3,_0x483bb3){_0x2d47a3=_0x2d47a3-0x0;var _0x50a7f6=_0x9555[_0x2d47a3];return _0x50a7f6;};'use strict';function ZohoAccount(_0x5d4a8d){this['id']=_0x5d4a8d['id']||0x0;this[_0x5955('0x0')]=_0x5d4a8d['name']||'';this[_0x5955('0x1')]=_0x5d4a8d['description']||'';this['host']=_0x5d4a8d[_0x5955('0x2')]||'';this[_0x5955('0x3')]=_0x5d4a8d['zone']||'';this[_0x5955('0x4')]=_0x5d4a8d[_0x5955('0x4')]||'';this[_0x5955('0x5')]=_0x5d4a8d['clientSecret']||'';this['serverUrl']=_0x5d4a8d['serverUrl']||'';this[_0x5955('0x6')]=_0x5d4a8d['code']||'';this[_0x5955('0x7')]=_0x5d4a8d[_0x5955('0x7')]||'';this[_0x5955('0x8')]=_0x5d4a8d[_0x5955('0x8')]||{};}module[_0x5955('0x9')]=ZohoAccount; \ No newline at end of file +var _0x56de=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x56de,0x96));var _0xe56d=function(_0x4cbfe5,_0x5409f8){_0x4cbfe5=_0x4cbfe5-0x0;var _0x3ad670=_0x56de[_0x4cbfe5];return _0x3ad670;};'use strict';function ZohoAccount(_0x43a3ab){this['id']=_0x43a3ab['id']||0x0;this[_0xe56d('0x0')]=_0x43a3ab['name']||'';this[_0xe56d('0x1')]=_0x43a3ab[_0xe56d('0x1')]||'';this[_0xe56d('0x2')]=_0x43a3ab[_0xe56d('0x2')]||'';this[_0xe56d('0x3')]=_0x43a3ab[_0xe56d('0x3')]||'';this[_0xe56d('0x4')]=_0x43a3ab[_0xe56d('0x4')]||'';this[_0xe56d('0x5')]=_0x43a3ab[_0xe56d('0x5')]||'';this[_0xe56d('0x6')]=_0x43a3ab[_0xe56d('0x6')]||'';this['code']=_0x43a3ab[_0xe56d('0x7')]||'';this[_0xe56d('0x8')]=_0x43a3ab['refreshToken']||'';this[_0xe56d('0x9')]=_0x43a3ab[_0xe56d('0x9')]||{};}module[_0xe56d('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 452fc84..8c63272 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 _0xa456=['originatecalleridnum','originatecalleridname','getCaller','format','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','type','campaigntype','dialAnswer','membername','name','channelAgent','calleridname','Contact','phone','lastName','active','calleridnum','scheduledat','countcongestionretry','countnoanswerretry','countbusyretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','Agent','VoiceQueueId'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa456,0x142));var _0x6a45=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xa456[_0x2c7618];return _0x5ce3f0;};'use strict';var util=require(_0x6a45('0x0'));var _=require(_0x6a45('0x1'));var moment=require(_0x6a45('0x2'));function checkNameSurname(_0xd5464e,_0x587626,_0x3bfbe6){var _0x206f6b='';if(!_[_0x6a45('0x3')](_0x587626)&&'string'===typeof _0x587626){_0x206f6b+=_0x587626;}if(!_[_0x6a45('0x3')](_0x3bfbe6)&&_0x6a45('0x4')===typeof _0x3bfbe6){_0x206f6b+='\x20'+_0x3bfbe6;}if(_0x206f6b!==''){return _0x206f6b;}return _0xd5464e;}function Action(_0x1e5882,_0x14da6b,_0x4dfbfa,_0x25cf8d,_0x26bfc0){this[_0x6a45('0x5')]=_0x4dfbfa||undefined;this[_0x6a45('0x6')]=_0x1e5882['id'];this[_0x6a45('0x7')]=_0x14da6b['name'];this[_0x6a45('0x8')]=_0x14da6b['type'];this[_0x6a45('0x9')]=_0x6a45('0x7');this[_0x6a45('0xa')]=![];this[_0x6a45('0xb')]=_[_0x6a45('0x3')](_0x1e5882['Agent'])?undefined:_0x1e5882['Agent'][_0x6a45('0xc')];this[_0x6a45('0xd')]=this['membername']?util['format']('SIP/%s',this[_0x6a45('0xb')]):_0x25cf8d||undefined;this[_0x6a45('0xe')]=checkNameSurname(_0x1e5882[_0x6a45('0xf')][_0x6a45('0x10')],_0x1e5882[_0x6a45('0xf')]['firstName'],_0x1e5882['Contact'][_0x6a45('0x11')]);this[_0x6a45('0x12')]=_0x1e5882['active']||![];this[_0x6a45('0x13')]=_0x1e5882[_0x6a45('0x10')];this[_0x6a45('0x14')]=_0x1e5882[_0x6a45('0x14')];this['countbusyretry']=_0x1e5882['countbusyretry']||0x0;this['countcongestionretry']=_0x1e5882[_0x6a45('0x15')]||0x0;this[_0x6a45('0x16')]=_0x1e5882[_0x6a45('0x16')]||0x0;this['countglobal']=(_0x1e5882[_0x6a45('0x17')]||0x0)+(_0x1e5882[_0x6a45('0x15')]||0x0)+(_0x1e5882[_0x6a45('0x16')]||0x0)+(_0x1e5882['countnosuchnumberretry']||0x0)+(_0x1e5882['countdropretry']||0x0)+(_0x1e5882['countabandonedretry']||0x0)+(_0x1e5882[_0x6a45('0x18')]||0x0)+(_0x1e5882[_0x6a45('0x19')]||0x0);this['countnosuchnumberretry']=_0x1e5882[_0x6a45('0x1a')]||0x0;this[_0x6a45('0x1b')]=_0x1e5882['countdropretry']||0x0;this[_0x6a45('0x1c')]=_0x1e5882[_0x6a45('0x1c')]||0x0;this[_0x6a45('0x18')]=_0x1e5882[_0x6a45('0x18')]||0x0;this[_0x6a45('0x19')]=_0x1e5882['countagentrejectretry']||0x0;this['callback']=_0x1e5882[_0x6a45('0x1d')];this[_0x6a45('0x1e')]=_0x1e5882[_0x6a45('0x1e')];this[_0x6a45('0x1f')]=_0x1e5882[_0x6a45('0x1f')];this[_0x6a45('0x20')]=_0x1e5882[_0x6a45('0x20')];this[_0x6a45('0x21')]=_0x1e5882[_0x6a45('0x21')];this[_0x6a45('0x22')]=_0x1e5882[_0x6a45('0x22')];this[_0x6a45('0x23')]=_['isNil'](_0x1e5882[_0x6a45('0x24')])?_0x1e5882['UserId']:_0x1e5882[_0x6a45('0x24')]['id'];this[_0x6a45('0x25')]=_0x1e5882[_0x6a45('0x25')];this[_0x6a45('0x26')]='';this[_0x6a45('0x27')]='';}Action['prototype'][_0x6a45('0x28')]=function(){return util[_0x6a45('0x29')](_0x6a45('0x2a'),this[_0x6a45('0xe')],this[_0x6a45('0x2b')]);};module[_0x6a45('0x2c')]=Action; \ No newline at end of file +var _0xa456=['originatecalleridnum','originatecalleridname','getCaller','format','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','type','campaigntype','dialAnswer','membername','name','channelAgent','calleridname','Contact','phone','lastName','active','calleridnum','scheduledat','countcongestionretry','countnoanswerretry','countbusyretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','Agent','VoiceQueueId'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xa456,0x142));var _0x6a45=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0xa456[_0x2f45ea];return _0x485a84;};'use strict';var util=require(_0x6a45('0x0'));var _=require(_0x6a45('0x1'));var moment=require(_0x6a45('0x2'));function checkNameSurname(_0xd5464e,_0x587626,_0x3bfbe6){var _0x206f6b='';if(!_[_0x6a45('0x3')](_0x587626)&&'string'===typeof _0x587626){_0x206f6b+=_0x587626;}if(!_[_0x6a45('0x3')](_0x3bfbe6)&&_0x6a45('0x4')===typeof _0x3bfbe6){_0x206f6b+='\x20'+_0x3bfbe6;}if(_0x206f6b!==''){return _0x206f6b;}return _0xd5464e;}function Action(_0x1e5882,_0x14da6b,_0x4dfbfa,_0x25cf8d,_0x26bfc0){this[_0x6a45('0x5')]=_0x4dfbfa||undefined;this[_0x6a45('0x6')]=_0x1e5882['id'];this[_0x6a45('0x7')]=_0x14da6b['name'];this[_0x6a45('0x8')]=_0x14da6b['type'];this[_0x6a45('0x9')]=_0x6a45('0x7');this[_0x6a45('0xa')]=![];this[_0x6a45('0xb')]=_[_0x6a45('0x3')](_0x1e5882['Agent'])?undefined:_0x1e5882['Agent'][_0x6a45('0xc')];this[_0x6a45('0xd')]=this['membername']?util['format']('SIP/%s',this[_0x6a45('0xb')]):_0x25cf8d||undefined;this[_0x6a45('0xe')]=checkNameSurname(_0x1e5882[_0x6a45('0xf')][_0x6a45('0x10')],_0x1e5882[_0x6a45('0xf')]['firstName'],_0x1e5882['Contact'][_0x6a45('0x11')]);this[_0x6a45('0x12')]=_0x1e5882['active']||![];this[_0x6a45('0x13')]=_0x1e5882[_0x6a45('0x10')];this[_0x6a45('0x14')]=_0x1e5882[_0x6a45('0x14')];this['countbusyretry']=_0x1e5882['countbusyretry']||0x0;this['countcongestionretry']=_0x1e5882[_0x6a45('0x15')]||0x0;this[_0x6a45('0x16')]=_0x1e5882[_0x6a45('0x16')]||0x0;this['countglobal']=(_0x1e5882[_0x6a45('0x17')]||0x0)+(_0x1e5882[_0x6a45('0x15')]||0x0)+(_0x1e5882[_0x6a45('0x16')]||0x0)+(_0x1e5882['countnosuchnumberretry']||0x0)+(_0x1e5882['countdropretry']||0x0)+(_0x1e5882['countabandonedretry']||0x0)+(_0x1e5882[_0x6a45('0x18')]||0x0)+(_0x1e5882[_0x6a45('0x19')]||0x0);this['countnosuchnumberretry']=_0x1e5882[_0x6a45('0x1a')]||0x0;this[_0x6a45('0x1b')]=_0x1e5882['countdropretry']||0x0;this[_0x6a45('0x1c')]=_0x1e5882[_0x6a45('0x1c')]||0x0;this[_0x6a45('0x18')]=_0x1e5882[_0x6a45('0x18')]||0x0;this[_0x6a45('0x19')]=_0x1e5882['countagentrejectretry']||0x0;this['callback']=_0x1e5882[_0x6a45('0x1d')];this[_0x6a45('0x1e')]=_0x1e5882[_0x6a45('0x1e')];this[_0x6a45('0x1f')]=_0x1e5882[_0x6a45('0x1f')];this[_0x6a45('0x20')]=_0x1e5882[_0x6a45('0x20')];this[_0x6a45('0x21')]=_0x1e5882[_0x6a45('0x21')];this[_0x6a45('0x22')]=_0x1e5882[_0x6a45('0x22')];this[_0x6a45('0x23')]=_['isNil'](_0x1e5882[_0x6a45('0x24')])?_0x1e5882['UserId']:_0x1e5882[_0x6a45('0x24')]['id'];this[_0x6a45('0x25')]=_0x1e5882[_0x6a45('0x25')];this[_0x6a45('0x26')]='';this[_0x6a45('0x27')]='';}Action['prototype'][_0x6a45('0x28')]=function(){return util[_0x6a45('0x29')](_0x6a45('0x2a'),this[_0x6a45('0xe')],this[_0x6a45('0x2b')]);};module[_0x6a45('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 102ae45..abefc29 100644 --- a/server/services/ami/preview/index.js +++ b/server/services/ami/preview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x1c8640,_0xf43860){var _0x31cc47=function(_0x60c762){while(--_0x60c762){_0x1c8640['push'](_0x1c8640['shift']());}};_0x31cc47(++_0xf43860);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file +var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x347516,_0x4bab72){var _0x11f26a=function(_0x2097ce){while(--_0x2097ce){_0x347516['push'](_0x347516['shift']());}};_0x11f26a(++_0x4bab72);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index a4a23e5..6722fed 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 _0x7d09=['getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','membername','context','from-sip','holdtime','assigned','lastAssignedTo','COMPLETED','getContactRecallMe','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','inspect','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20'];(function(_0x45a813,_0x13e302){var _0x41e082=function(_0x9488b5){while(--_0x9488b5){_0x45a813['push'](_0x45a813['shift']());}};_0x41e082(++_0x13e302);}(_0x7d09,0x142));var _0x97d0=function(_0xd050c6,_0x58ffb4){_0xd050c6=_0xd050c6-0x0;var _0x7278a=_0x7d09[_0xd050c6];return _0x7278a;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x97d0('0x0'));var cmHopper=require(_0x97d0('0x1'));var cmHopperHistory=require(_0x97d0('0x2'));var cmHopperBlack=require(_0x97d0('0x3'));var agentReportPreview=require(_0x97d0('0x4'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x105ed){return function(_0x17eb74){logger['error'](_0x105ed,util[_0x97d0('0x5')](_0x17eb74,{'showHidden':![],'depth':null}));};}function create(_0x5f3d6c){return cmHopperHistory[_0x97d0('0x6')](_0x5f3d6c)[_0x97d0('0x7')](loggerCatch(_0x97d0('0x8')));}function createAgent(_0x2a5637){return BPromise[_0x97d0('0x9')]()[_0x97d0('0xa')](agentReportPreview[_0x97d0('0x6')](_0x2a5637))['catch'](loggerCatch(_0x97d0('0x8')));}function moveContact(_0x441023){return cmHopper[_0x97d0('0xb')](_0x441023,!![])[_0x97d0('0x7')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x97d0('0xc')]=function(_0x1e878b){return cmHopperBlack['checkIsBlackList'](_0x1e878b)[_0x97d0('0x7')](loggerCatch(_0x97d0('0xd')));};exports[_0x97d0('0xe')]=function(_0x1c04b1){return BPromise[_0x97d0('0x9')]()[_0x97d0('0xa')](cmHopper[_0x97d0('0xe')](_0x1c04b1))[_0x97d0('0x7')](loggerCatch('[getContactPreview]\x20'));};exports[_0x97d0('0x6')]=function(_0x3840ae,_0x4a2ff8){create(_0x3840ae)[_0x97d0('0x7')](loggerCatch(_0x4a2ff8));moveContact(_0x3840ae)[_0x97d0('0x7')](loggerCatch(_0x4a2ff8));};exports[_0x97d0('0xf')]=function(_0x3b500d,_0x200a57){createAgent(_0x3b500d)[_0x97d0('0x7')](loggerCatch(_0x200a57));};exports[_0x97d0('0x10')]=function(_0x2a38e3,_0x463e71){create(_0x2a38e3)[_0x97d0('0x7')](loggerCatch(_0x463e71));};exports[_0x97d0('0x11')]=function(_0x2a6fed,_0x146f84){moveContact(_0x2a6fed)[_0x97d0('0x7')](loggerCatch(_0x146f84));};exports['rescheduleContact']=function(_0x4be7dd,_0x3bfda3,_0x1d5e5a){if(_0x3bfda3){_0x4be7dd[_0x97d0('0x12')]=null;}if(_0x1d5e5a){_0x4be7dd[_0x97d0('0x13')]=![];}return cmHopper[_0x97d0('0x14')](_0x4be7dd)[_0x97d0('0x7')](loggerCatch(_0x97d0('0x15')));};exports['countReScheduled']=function(_0x483361){return cmHopper['countReScheduled'](_0x483361)[_0x97d0('0x7')](loggerCatch(_0x97d0('0x16')));};exports[_0x97d0('0x17')]=function(_0x4c495b){return cmHopper[_0x97d0('0x17')]({'UserId':null},_0x4c495b,0x1)[_0x97d0('0x7')](loggerCatch('[unlockContact]\x20'));};exports[_0x97d0('0x18')]=function(_0xdd1058){return cmHopper[_0x97d0('0x17')]({'active':![]},_0xdd1058,0x1)[_0x97d0('0x7')](loggerCatch(_0x97d0('0x19')));};exports['crateCustomerReportQueue']=function(_0xaa759f){var _0x412dce={};_0x412dce[_0x97d0('0x1a')]=_0xaa759f[_0x97d0('0x1a')];_0x412dce[_0x97d0('0x1b')]=_0xaa759f['uniqueid'];_0x412dce[_0x97d0('0x1c')]=_0xaa759f['calleridnum'];_0x412dce[_0x97d0('0x1d')]=_0xaa759f[_0x97d0('0x1d')];_0x412dce['queue']=_0xaa759f['queue'];_0x412dce[_0x97d0('0x1e')]=_0xaa759f[_0x97d0('0x1f')];_0x412dce['queuecallerleaveAt']=_0xaa759f[_0x97d0('0x1f')];_0x412dce[_0x97d0('0x20')]=0x1;_0x412dce[_0x97d0('0x21')]=_0xaa759f['endtime'];_0x412dce['connectedlinename']=_0xaa759f[_0x97d0('0x22')];_0x412dce[_0x97d0('0x23')]=_0x97d0('0x24');_0x412dce['exten']='xcally-motion-preview';_0x412dce[_0x97d0('0x25')]=0x0;_0x412dce[_0x97d0('0x26')]=0x1;_0x412dce[_0x97d0('0x27')]=_0xaa759f[_0x97d0('0x22')];_0x412dce['queuecallerexitreason']=_0x97d0('0x28');return BPromise[_0x97d0('0x9')]()[_0x97d0('0xa')](voiceQueueReport['create'](_0x412dce))[_0x97d0('0x7')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x97d0('0x29')]=function(_0x51fafb,_0x2ef64c){return BPromise[_0x97d0('0x9')]()['then'](cmHopper[_0x97d0('0x29')](_0x51fafb,_0x2ef64c))[_0x97d0('0x7')](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x1d63f6){return cmHopper[_0x97d0('0x14')](_0x1d63f6,!![],!![])[_0x97d0('0x7')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0x22bb=['queuecallerjoinAt','answertime','queuecallerleaveAt','endtime','connectedlinename','membername','exten','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','inspect','createHistory','resolve','then','catch','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue'];(function(_0x3f88bc,_0xe38cf5){var _0x4df1c4=function(_0x111de1){while(--_0x111de1){_0x3f88bc['push'](_0x3f88bc['shift']());}};_0x4df1c4(++_0xe38cf5);}(_0x22bb,0xb7));var _0xb22b=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x22bb[_0x3511d3];return _0x5d6321;};'use strict';var util=require(_0xb22b('0x0'));var BPromise=require(_0xb22b('0x1'));var logger=require(_0xb22b('0x2'))(_0xb22b('0x3'));var cmHopper=require(_0xb22b('0x4'));var cmHopperHistory=require(_0xb22b('0x5'));var cmHopperBlack=require(_0xb22b('0x6'));var agentReportPreview=require(_0xb22b('0x7'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x54d11e){return function(_0x2b6e5d){logger[_0xb22b('0x8')](_0x54d11e,util[_0xb22b('0x9')](_0x2b6e5d,{'showHidden':![],'depth':null}));};}function create(_0x3ab4fb){return cmHopperHistory[_0xb22b('0xa')](_0x3ab4fb)['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x487e70){return BPromise[_0xb22b('0xb')]()[_0xb22b('0xc')](agentReportPreview[_0xb22b('0xa')](_0x487e70))[_0xb22b('0xd')](loggerCatch(_0xb22b('0xe')));}function moveContact(_0x423875){return cmHopper['moveContactManagedDialer'](_0x423875,!![])[_0xb22b('0xd')](loggerCatch(_0xb22b('0xf')));}exports['checkIsBlackList']=function(_0x362e18){return cmHopperBlack[_0xb22b('0x10')](_0x362e18)[_0xb22b('0xd')](loggerCatch(_0xb22b('0x11')));};exports[_0xb22b('0x12')]=function(_0x1485f){return BPromise[_0xb22b('0xb')]()[_0xb22b('0xc')](cmHopper[_0xb22b('0x12')](_0x1485f))[_0xb22b('0xd')](loggerCatch(_0xb22b('0x13')));};exports[_0xb22b('0xa')]=function(_0x23e2cb,_0xf326e6){create(_0x23e2cb)[_0xb22b('0xd')](loggerCatch(_0xf326e6));moveContact(_0x23e2cb)[_0xb22b('0xd')](loggerCatch(_0xf326e6));};exports[_0xb22b('0x14')]=function(_0x3d2f34,_0x35eaec){createAgent(_0x3d2f34)[_0xb22b('0xd')](loggerCatch(_0x35eaec));};exports[_0xb22b('0x15')]=function(_0x1e3488,_0x59c0db){create(_0x1e3488)[_0xb22b('0xd')](loggerCatch(_0x59c0db));};exports[_0xb22b('0x16')]=function(_0x15f214,_0x4ebc6c){moveContact(_0x15f214)[_0xb22b('0xd')](loggerCatch(_0x4ebc6c));};exports[_0xb22b('0x17')]=function(_0x1647b0,_0x26eac1,_0xda0571){if(_0x26eac1){_0x1647b0[_0xb22b('0x18')]=null;}if(_0xda0571){_0x1647b0[_0xb22b('0x19')]=![];}return cmHopper[_0xb22b('0x17')](_0x1647b0)[_0xb22b('0xd')](loggerCatch(_0xb22b('0x1a')));};exports[_0xb22b('0x1b')]=function(_0x2f6ea3){return cmHopper[_0xb22b('0x1b')](_0x2f6ea3)[_0xb22b('0xd')](loggerCatch(_0xb22b('0x1c')));};exports[_0xb22b('0x1d')]=function(_0x24798b){return cmHopper[_0xb22b('0x1d')]({'UserId':null},_0x24798b,0x1)['catch'](loggerCatch(_0xb22b('0x1e')));};exports['disableContact']=function(_0x242e7e){return cmHopper[_0xb22b('0x1d')]({'active':![]},_0x242e7e,0x1)['catch'](loggerCatch('[activeContact]\x20'));};exports[_0xb22b('0x1f')]=function(_0x1f8e3b){var _0x20f006={};_0x20f006[_0xb22b('0x20')]=_0x1f8e3b[_0xb22b('0x20')];_0x20f006[_0xb22b('0x21')]=_0x1f8e3b[_0xb22b('0x21')];_0x20f006[_0xb22b('0x22')]=_0x1f8e3b[_0xb22b('0x22')];_0x20f006[_0xb22b('0x23')]=_0x1f8e3b[_0xb22b('0x23')];_0x20f006[_0xb22b('0x24')]=_0x1f8e3b[_0xb22b('0x24')];_0x20f006[_0xb22b('0x25')]=_0x1f8e3b[_0xb22b('0x26')];_0x20f006[_0xb22b('0x27')]=_0x1f8e3b[_0xb22b('0x26')];_0x20f006['queuecallercomplete']=0x1;_0x20f006['queuecallercompleteAt']=_0x1f8e3b[_0xb22b('0x28')];_0x20f006[_0xb22b('0x29')]=_0x1f8e3b[_0xb22b('0x2a')];_0x20f006['context']='from-sip';_0x20f006[_0xb22b('0x2b')]='xcally-motion-preview';_0x20f006[_0xb22b('0x2c')]=0x0;_0x20f006[_0xb22b('0x2d')]=0x1;_0x20f006[_0xb22b('0x2e')]=_0x1f8e3b[_0xb22b('0x2a')];_0x20f006[_0xb22b('0x2f')]=_0xb22b('0x30');return BPromise[_0xb22b('0xb')]()[_0xb22b('0xc')](voiceQueueReport[_0xb22b('0x31')](_0x20f006))[_0xb22b('0xd')](loggerCatch(_0xb22b('0x32')));};exports[_0xb22b('0x33')]=function(_0x575582,_0x154973){return BPromise[_0xb22b('0xb')]()[_0xb22b('0xc')](cmHopper[_0xb22b('0x33')](_0x575582,_0x154973))[_0xb22b('0xd')](loggerCatch(_0xb22b('0x34')));};exports[_0xb22b('0x35')]=function(_0x298d23){return cmHopper[_0xb22b('0x17')](_0x298d23,!![],!![])['catch'](loggerCatch(_0xb22b('0x36')));}; \ 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 66af823..9f99279 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 _0x570f=['uniqueid','from-sip','timeout','totalGlobal','countbusyretry','countnoanswerretry','cloneAction','clone','scheduledAt','active','scheduledat','add','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','push','getDiff','milliseconds','diff','seconds','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','channelAgent','countglobal','callbackuniqueid','callbackat','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosloss','bridgepeer','\x5cw{0,','pow','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','util','moment','../../../../config/logger','preview','env','127.0.0.1','../../dialer/utils','error','inspect','logger','info','loggerError','logger2','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','endtime','logAgent','ringtime','getSeconds','responsetime','logLookAgent','membername','UserId','talktime','answertime','isFailure','variablesAction','RECALL','BOOKED'];(function(_0x102881,_0x58d723){var _0x5c63d0=function(_0x955c59){while(--_0x955c59){_0x102881['push'](_0x102881['shift']());}};_0x5c63d0(++_0x58d723);}(_0x570f,0xd3));var _0xf570=function(_0xef5f0f,_0x35b798){_0xef5f0f=_0xef5f0f-0x0;var _0xd3b8d=_0x570f[_0xef5f0f];return _0xd3b8d;};'use strict';var util=require(_0xf570('0x0'));var _=require('lodash');var moment=require(_0xf570('0x1'));var logger=require(_0xf570('0x2'))(_0xf570('0x3'));var ipAgi=process[_0xf570('0x4')]['XCALLY_IP_AGI']||_0xf570('0x5');var utils=require(_0xf570('0x6'));exports['loggerCatch']=function(_0x145e38){return function(_0x36a984){logger[_0xf570('0x7')](_0x145e38,util[_0xf570('0x8')](_0x36a984,{'showHidden':![],'depth':null}));};};exports[_0xf570('0x9')]=function(_0x218013,_0x58fa14){logger[_0xf570('0xa')](_0x218013,util[_0xf570('0x8')](_0x58fa14,{'showHidden':![],'depth':null}));};exports[_0xf570('0xb')]=function(_0x240686,_0x16b907){logger[_0xf570('0x7')](_0x240686,util['inspect'](_0x16b907,{'showHidden':![],'depth':null}));};exports[_0xf570('0xc')]=function(_0x22caad){return function(_0x4566cd){logger[_0xf570('0xa')](_0x22caad,util[_0xf570('0x8')](_0x4566cd,{'showHidden':![],'depth':null}));};};exports[_0xf570('0xd')]=function(_0x5d474d,_0x5dc181,_0xf82263){return{'message':_0x5d474d,'unlock':_0x5dc181,'active':_0xf82263};};exports['getCallerId']=function(_0x2f1e64,_0x115030,_0x1023a3){if(!_[_0xf570('0xe')](_0x1023a3)&&_0xf570('0xf')===typeof _0x1023a3&&!_[_0xf570('0x10')](_0x1023a3)){if(!_['isUndefined'](_0x115030)&&_0xf570('0xf')===typeof _0x115030&&!_['isEmpty'](_0x115030)){return util[_0xf570('0x11')](_0xf570('0x12'),_0x115030,_0x1023a3);}return util[_0xf570('0x11')]('\x22%s\x22\x20<%s>',_0x1023a3,_0x1023a3);}if(!_[_0xf570('0xe')](_0x2f1e64)&&_0xf570('0xf')===typeof _0x2f1e64&&!_[_0xf570('0x10')](_0x2f1e64)){return _0x2f1e64;}return'\x22\x22\x20<>';};exports[_0xf570('0x13')]=function(_0x2e2464){if(_[_0xf570('0x14')](_0x2e2464)){return![];}return _0x2e2464;};exports[_0xf570('0x15')]=function(_0x13dc02,_0xbb1e96,_0x3cae1d,_0x5ce994,_0x3e857a,_0x3cf1e8){var _0x275183={'XMD-QUEUE':_0xbb1e96[_0xf570('0x16')]?_0xbb1e96[_0xf570('0x16')][_0xf570('0x17')]:'','XMD-CALLERID':_0x5ce994,'XMD-CALLERID-PREVIEW':_0x3cf1e8?util[_0xf570('0x11')](_0xf570('0x12'),_0x3cf1e8[_0xf570('0x18')],_0x3cf1e8[_0xf570('0x19')]):_0x5ce994,'XMD-DIALID':_0x3e857a,'XMD-CONTACTID':_0xbb1e96['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x5ce994,'XMD-VOICEQUEUEID':_0xbb1e96[_0xf570('0x1a')],'XMD-DIALCHANNEL':_0x3cae1d,'XMD-DIALTIMEOUT':_0x13dc02['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xf570('0x11')](_0xf570('0x1b'),_0x13dc02[_0xf570('0x1c')]?'g':'',_[_0xf570('0x10')](_0x13dc02['monitor_format'])?'':_0xf570('0x1d')),'XMD-DIALURL':_0x13dc02[_0xf570('0x1e')]||'','XMD-AGI':_0x13dc02[_0xf570('0x1f')]?util[_0xf570('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x13dc02[_0xf570('0x1f')]):_0xf570('0x20'),'XMD-AGIAFTER':_0x13dc02[_0xf570('0x1c')]?util[_0xf570('0x11')](_0xf570('0x21'),ipAgi,_0x13dc02['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x3cf1e8?_0x3cf1e8[_0xf570('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x3cf1e8?_0x3cf1e8[_0xf570('0x23')]:'','XMD-DESTINATION':_0xf570('0x24'),'SIPADDHEADER':_0xf570('0x25')};if(!_[_0xf570('0x10')](_0x13dc02[_0xf570('0x26')])){_0x275183[util[_0xf570('0x11')]('%s',_0xf570('0x27'))]=_0x13dc02[_0xf570('0x26')];_0x275183[util[_0xf570('0x11')]('%s',_0xf570('0x28'))]=_0x3e857a;}return _0x275183;};exports[_0xf570('0x29')]=function(_0x115786){var _0xdff8b7={};for(var _0x1da6fc in _0x115786){if(_0x115786[_0xf570('0x2a')](_0x1da6fc)){_0xdff8b7[util['format']('%s',_['toLower'](_0x1da6fc))]=_0x115786[_0x1da6fc];}}return{'variables':_0xdff8b7};};exports[_0xf570('0x2b')]=function(_0x4599b2,_0x546c24){if(!_[_0xf570('0x14')](_0x4599b2)){if(_0x4599b2[_0xf570('0x2a')](_0xf570('0x2c'))){if(_0x4599b2[_0xf570('0x2c')]>0x0){_0x4599b2[_0xf570('0x2c')]-=0x1;}else{logger[_0xf570('0x7')](_0xf570('0x2d'),_0x546c24);}}}else{logger[_0xf570('0x7')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x546c24);}};exports[_0xf570('0x2e')]=function(_0x4f46e0){var _0x2ab681=moment()[_0xf570('0x11')](_0xf570('0x2f'));_0x4f46e0[_0xf570('0x30')]=0xd;_0x4f46e0[_0xf570('0x31')]='Blacklist';_0x4f46e0[_0xf570('0x32')]=_0x2ab681;_0x4f46e0['responsetime']=_0x2ab681;_0x4f46e0[_0xf570('0x33')]=_0x2ab681;};exports[_0xf570('0x34')]=function(_0x472f3a,_0x2adfd0,_0x4e4e22){var _0x13b659=moment()['format'](_0xf570('0x2f'));_0x472f3a[_0xf570('0x30')]=_0x2adfd0;_0x472f3a[_0xf570('0x31')]=_0x4e4e22;_0x472f3a['responsetime']=_0x13b659;_0x472f3a[_0xf570('0x35')]=utils[_0xf570('0x36')](_0x472f3a[_0xf570('0x37')],_0x472f3a[_0xf570('0x32')]);};exports[_0xf570('0x38')]=function(_0x173cb6,_0x269c66,_0x27ae97){_0x173cb6[_0xf570('0x39')]=_0x269c66;_0x173cb6[_0xf570('0x3a')]=_0x27ae97;};exports['logCustomer']=function(_0x4f39ae,_0x473358,_0x3f2c8b){var _0x223041=moment()[_0xf570('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x4f39ae[_0xf570('0x30')]=_0x473358;_0x4f39ae[_0xf570('0x31')]=_0x3f2c8b;_0x4f39ae[_0xf570('0x37')]=_0x4f39ae[_0xf570('0x37')]?_0x4f39ae[_0xf570('0x37')]:_0x223041;_0x4f39ae[_0xf570('0x33')]=_0x4f39ae[_0xf570('0x33')]?_0x4f39ae['endtime']:_0x223041;_0x4f39ae[_0xf570('0x35')]=utils[_0xf570('0x36')](_0x4f39ae[_0xf570('0x37')]||0x0,_0x4f39ae[_0xf570('0x32')]||0x0);_0x4f39ae[_0xf570('0x3b')]=_0x4f39ae[_0xf570('0x3c')]?utils[_0xf570('0x36')](_0x4f39ae[_0xf570('0x33')],_0x4f39ae['answertime']):0x0;};exports[_0xf570('0x3d')]=function(_0x1c6ce7){return _0x1c6ce7==='Failure';};exports[_0xf570('0x3e')]=function(_0x2ee9f7,_0x564640,_0xa24024,_0x35b268,_0x44ba0c){var _0x5defb1=_0x35b268?_0xf570('0x3f'):_0x2ee9f7[_0xf570('0x18')];_0x5defb1=_0x44ba0c?_0xf570('0x40'):_0x5defb1;return{'actionid':_0x2ee9f7[_0xf570('0x41')],'action':'originate','channel':_0x2ee9f7['channelAgent'],'callerid':util['format'](_0xf570('0x12'),_0x5defb1,_0x2ee9f7[_0xf570('0x19')]),'Exten':_0xf570('0x24'),'Context':_0xf570('0x42'),'Priority':'1','variable':_0xa24024,'timeout':(_0x564640[_0xf570('0x43')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2ee9f7[_0xf570('0x41')]};};exports[_0xf570('0x44')]=function(_0x33574e){return _0x33574e[_0xf570('0x45')]+_0x33574e['countcongestionretry']+_0x33574e[_0xf570('0x46')]+_0x33574e['countagentrejectretry']+_0x33574e['countnosuchnumberretry'];};exports[_0xf570('0x47')]=function(_0x48ff37){var _0x2113d0=_[_0xf570('0x48')](_0x48ff37);_0x2113d0[_0xf570('0x30')]=0xf;_0x2113d0['statedesc']='Global';return _0x2113d0;};exports[_0xf570('0x49')]=function(_0x4a5cd9,_0x4553fc,_0x4c04b8){var _0x1847a1={};_0x1847a1[_0x4553fc]=_0x4a5cd9[_0x4553fc];_0x1847a1[_0xf570('0x4a')]=![];_0x1847a1[_0xf570('0x4b')]=moment()[_0xf570('0x4c')](_0x4c04b8,'minutes')[_0xf570('0x11')](_0xf570('0x2f'));_0x1847a1[_0xf570('0x4d')]=_0x4a5cd9['ContactId'];_0x1847a1[_0xf570('0x4e')]=_0x4a5cd9[_0xf570('0x4e')];_0x1847a1['VoiceQueueId']=_0x4a5cd9[_0xf570('0x1a')]||undefined;return _0x1847a1;};exports[_0xf570('0x4f')]=function(_0x4ea436,_0x5bb15b){if(!_['isNil'](_0x4ea436)){if(_0x4ea436[_0xf570('0x50')]>0x0){_0x4ea436[_0xf570('0x50')]-=0x1;}else{logger[_0xf570('0x7')](_0x5bb15b,_0xf570('0x51'));}}else{logger[_0xf570('0x7')](_0x5bb15b,_0xf570('0x52'));}};exports[_0xf570('0x53')]=function(_0x43ed0f){if(_0x43ed0f<=0x0){return!![];}return![];};function buildObj(_0x5d1009,_0x2fd858,_0x122cd7){_0x5d1009[_0xf570('0x54')]=_0x2fd858;_0x5d1009[_0xf570('0x17')]=_0x5d1009[_0xf570('0x55')];_0x5d1009[_0xf570('0x56')]=_0x5d1009['channelAgent'];_0x5d1009[_0xf570('0x57')]=_0xf570('0x58');if(_0x122cd7){_0x5d1009[_0xf570('0x59')]=_0x122cd7['mandatoryDisposition'];}return _0x5d1009;}exports[_0xf570('0x5a')]=buildObj;exports[_0xf570('0x5b')]=function(_0xee26ca){var _0x517702=[];for(var _0x1e4695 in _0xee26ca){if(_0xee26ca[_0xf570('0x2a')](_0x1e4695)){if(!_['isNil'](_0xee26ca[_0x1e4695])&&_0xee26ca[_0x1e4695][_0xf570('0x30')]===_0xf570('0x5c')&&_0xee26ca[_0x1e4695]['status']==='reachable'){_0x517702[_0xf570('0x5d')](_0xee26ca[_0x1e4695]['id']);}}}return _0x517702;};exports[_0xf570('0x5e')]=function(_0x526d29){var _0x524b27=moment()[_0xf570('0x5f')](0x0);var _0x2a619e=moment(_0x526d29)[_0xf570('0x5f')](0x0);return _0x524b27[_0xf570('0x60')](_0x2a619e,_0xf570('0x61'));};exports['createBody']=function(_0x4d55b3){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4d55b3['ContactId'],'ListId':_0x4d55b3['ListId'],'VoiceQueueId':_0x4d55b3[_0xf570('0x1a')]||undefined,'CampaignId':_0x4d55b3[_0xf570('0x62')]||undefined};};exports[_0xf570('0x63')]=function(_0x118988){if(_0x118988==='uniqueid'||_0x118988===_0xf570('0x64')||_0x118988===_0xf570('0x55')||_0x118988===_0xf570('0x65')||_0x118988===_0xf570('0x66')||_0x118988===_0xf570('0x67')||_0x118988==='membername'||_0x118988===_0xf570('0x68')||_0x118988===_0xf570('0x18')||_0x118988===_0xf570('0x4a')||_0x118988===_0xf570('0x19')||_0x118988==='scheduledat'||_0x118988===_0xf570('0x45')||_0x118988==='countcongestionretry'||_0x118988==='countnoanswerretry'||_0x118988===_0xf570('0x69')||_0x118988==='callback'||_0x118988===_0xf570('0x6a')||_0x118988===_0xf570('0x6b')||_0x118988==='recallme'||_0x118988===_0xf570('0x4d')||_0x118988===_0xf570('0x4e')||_0x118988==='UserId'||_0x118988===_0xf570('0x1a')||_0x118988==='sipcallid'||_0x118988===_0xf570('0x6c')||_0x118988===_0xf570('0x6d')||_0x118988==='xmd-phone'||_0x118988===_0xf570('0x6e')||_0x118988===_0xf570('0x6f')||_0x118988===_0xf570('0x70')||_0x118988===_0xf570('0x71')||_0x118988==='xmd-dialid'||_0x118988===_0xf570('0x72')||_0x118988===_0xf570('0x73')||_0x118988===_0xf570('0x74')||_0x118988===_0xf570('0x75')||_0x118988===_0xf570('0x76')||_0x118988==='xmd-agi'||_0x118988===_0xf570('0x77')||_0x118988===_0xf570('0x78')||_0x118988===_0xf570('0x79')||_0x118988===_0xf570('0x7a')||_0x118988==='rtpaudioqosloss'||_0x118988===_0xf570('0x7b')||_0x118988==='rtpaudioqosrtt'||_0x118988===_0xf570('0x7c')||_0x118988==='rtpaudioqos'||_0x118988===_0xf570('0x78')||_0x118988===_0xf570('0x79')||_0x118988===_0xf570('0x7a')||_0x118988===_0xf570('0x7d')||_0x118988==='rtpaudioqoslossbridged'||_0x118988==='rtpaudioqosrtt'||_0x118988==='rtpaudioqosrttbridged'||_0x118988===_0xf570('0x7e')||_0x118988==='bridgepvtcallid'||_0x118988===_0xf570('0x30')||_0x118988===_0xf570('0x31')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x33c904,_0x5261c0){var _0x528927,_0x6d5b82,_0x298751;if(_0x5261c0<=0x0){_0x5261c0=0x1;}_0x528927=new RegExp(_0xf570('0x7f')+_0x5261c0+'}$');_0x6d5b82=Math[_0xf570('0x80')](0xa,_0x5261c0-0x1);_0x298751=Math[_0xf570('0x80')](0xa,_0x5261c0)-0x1;return util[_0xf570('0x11')]('%s',_['replace'](_0x33c904,_0x528927,_[_0xf570('0x81')](_0x6d5b82,_0x298751)));};exports[_0xf570('0x82')]=function(_0x47a14c){var _0x21d023=_0x47a14c[_0xf570('0x83')](/"(.*?)"/);return _0x21d023?_0x21d023[0x1]:_0x47a14c;};exports[_0xf570('0x84')]=function(_0x25f7a9){var _0x23e15d=_0x25f7a9[_0xf570('0x83')](/<(.*?)>/);return _0x23e15d?_0x23e15d[0x1]:_0x25f7a9;};function buildNoAnswerEventPayload(_0xb2a035,_0x4e46b3){var _0x452de5=buildObj(_0xb2a035,_0xf570('0x85'));if(!_[_0xf570('0x10')](_0x4e46b3[_0xf570('0x86')])){Object[_0xf570('0x87')](_0x4e46b3[_0xf570('0x86')])[_0xf570('0x88')](function(_0x5b6b11){_0x452de5[_0x5b6b11[_0xf570('0x89')]()]=_0x4e46b3['variables'][_0x5b6b11];});}return _0x452de5;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file +var _0xccd5=['status','reachable','push','getDiff','milliseconds','diff','seconds','createBody','type','campaigntype','dialAnswer','countcongestionretry','countglobal','callback','callbackuniqueid','recallme','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosloss','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','extractCalleridNumber','keys','forEach','toLowerCase','variables','buildNoAnswerEventPayload','util','moment','../../../../config/logger','preview','env','127.0.0.1','../../dialer/utils','logger','info','inspect','error','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridname','calleridnum','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','updateOriginated','isNil','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','statedesc','Blacklist','starttime','responsetime','logAgent','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','logLookAgent','membername','UserId','state','endtime','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','xcally-motion-preview','timeout','totalGlobal','countnoanswerretry','countnosuchnumberretry','cloneAction','Global','scheduledAt','active','scheduledat','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','agentReadyId','not_inuse'];(function(_0xe2756c,_0x584379){var _0x2f7db3=function(_0x43125e){while(--_0x43125e){_0xe2756c['push'](_0xe2756c['shift']());}};_0x2f7db3(++_0x584379);}(_0xccd5,0xbe));var _0x5ccd=function(_0x458928,_0x18abb0){_0x458928=_0x458928-0x0;var _0x2d584f=_0xccd5[_0x458928];return _0x2d584f;};'use strict';var util=require(_0x5ccd('0x0'));var _=require('lodash');var moment=require(_0x5ccd('0x1'));var logger=require(_0x5ccd('0x2'))(_0x5ccd('0x3'));var ipAgi=process[_0x5ccd('0x4')]['XCALLY_IP_AGI']||_0x5ccd('0x5');var utils=require(_0x5ccd('0x6'));exports['loggerCatch']=function(_0x25fefd){return function(_0x3bce76){logger['error'](_0x25fefd,util['inspect'](_0x3bce76,{'showHidden':![],'depth':null}));};};exports[_0x5ccd('0x7')]=function(_0x355ee0,_0x41e183){logger[_0x5ccd('0x8')](_0x355ee0,util[_0x5ccd('0x9')](_0x41e183,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x587685,_0x2325b1){logger[_0x5ccd('0xa')](_0x587685,util[_0x5ccd('0x9')](_0x2325b1,{'showHidden':![],'depth':null}));};exports[_0x5ccd('0xb')]=function(_0x394ca9){return function(_0x2f25c6){logger[_0x5ccd('0x8')](_0x394ca9,util[_0x5ccd('0x9')](_0x2f25c6,{'showHidden':![],'depth':null}));};};exports[_0x5ccd('0xc')]=function(_0x54e6e1,_0xf2625a,_0x25c62f){return{'message':_0x54e6e1,'unlock':_0xf2625a,'active':_0x25c62f};};exports[_0x5ccd('0xd')]=function(_0x427dbf,_0x639b9e,_0x1ba01f){if(!_[_0x5ccd('0xe')](_0x1ba01f)&&_0x5ccd('0xf')===typeof _0x1ba01f&&!_[_0x5ccd('0x10')](_0x1ba01f)){if(!_[_0x5ccd('0xe')](_0x639b9e)&&_0x5ccd('0xf')===typeof _0x639b9e&&!_['isEmpty'](_0x639b9e)){return util[_0x5ccd('0x11')](_0x5ccd('0x12'),_0x639b9e,_0x1ba01f);}return util[_0x5ccd('0x11')]('\x22%s\x22\x20<%s>',_0x1ba01f,_0x1ba01f);}if(!_['isUndefined'](_0x427dbf)&&_0x5ccd('0xf')===typeof _0x427dbf&&!_[_0x5ccd('0x10')](_0x427dbf)){return _0x427dbf;}return _0x5ccd('0x13');};exports[_0x5ccd('0x14')]=function(_0x254586){if(_['isNil'](_0x254586)){return![];}return _0x254586;};exports[_0x5ccd('0x15')]=function(_0x32c103,_0x4a25d7,_0x2396dc,_0x3bd7aa,_0x435066,_0xf10169){var _0xe0600c={'XMD-QUEUE':_0x4a25d7[_0x5ccd('0x16')]?_0x4a25d7['Queue'][_0x5ccd('0x17')]:'','XMD-CALLERID':_0x3bd7aa,'XMD-CALLERID-PREVIEW':_0xf10169?util[_0x5ccd('0x11')](_0x5ccd('0x12'),_0xf10169[_0x5ccd('0x18')],_0xf10169[_0x5ccd('0x19')]):_0x3bd7aa,'XMD-DIALID':_0x435066,'XMD-CONTACTID':_0x4a25d7['ContactId'],'XMD-CDRTYPE':_0x5ccd('0x1a'),'CALLERID(all)':_0x3bd7aa,'XMD-VOICEQUEUEID':_0x4a25d7[_0x5ccd('0x1b')],'XMD-DIALCHANNEL':_0x2396dc,'XMD-DIALTIMEOUT':_0x32c103['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util['format'](_0x5ccd('0x1c'),_0x32c103[_0x5ccd('0x1d')]?'g':'',_[_0x5ccd('0x10')](_0x32c103[_0x5ccd('0x1e')])?'':_0x5ccd('0x1f')),'XMD-DIALURL':_0x32c103['dialPreviewUrl']||'','XMD-AGI':_0x32c103['dialQueueProject']?util[_0x5ccd('0x11')](_0x5ccd('0x20'),ipAgi,_0x32c103[_0x5ccd('0x21')]):_0x5ccd('0x22'),'XMD-AGIAFTER':_0x32c103['dialQueueProject2']?util[_0x5ccd('0x11')](_0x5ccd('0x20'),ipAgi,_0x32c103[_0x5ccd('0x1d')]):_0x5ccd('0x22'),'XMD-ORIGINATECALLERIDNUM':_0xf10169?_0xf10169[_0x5ccd('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0xf10169?_0xf10169[_0x5ccd('0x24')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x5ccd('0x25')};if(!_['isEmpty'](_0x32c103[_0x5ccd('0x1e')])){_0xe0600c[util[_0x5ccd('0x11')]('%s',_0x5ccd('0x26'))]=_0x32c103['monitor_format'];_0xe0600c[util['format']('%s',_0x5ccd('0x27'))]=_0x435066;}return _0xe0600c;};exports[_0x5ccd('0x28')]=function(_0x570226){var _0x1874c2={};for(var _0x1e3cdc in _0x570226){if(_0x570226[_0x5ccd('0x29')](_0x1e3cdc)){_0x1874c2[util[_0x5ccd('0x11')]('%s',_[_0x5ccd('0x2a')](_0x1e3cdc))]=_0x570226[_0x1e3cdc];}}return{'variables':_0x1874c2};};exports[_0x5ccd('0x2b')]=function(_0x2d2fde,_0x1eaf61){if(!_[_0x5ccd('0x2c')](_0x2d2fde)){if(_0x2d2fde['hasOwnProperty'](_0x5ccd('0x2d'))){if(_0x2d2fde[_0x5ccd('0x2d')]>0x0){_0x2d2fde[_0x5ccd('0x2d')]-=0x1;}else{logger[_0x5ccd('0xa')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x1eaf61);}}}else{logger[_0x5ccd('0xa')](_0x5ccd('0x2e'),_0x1eaf61);}};exports[_0x5ccd('0x2f')]=function(_0x388a7e){var _0x121e68=moment()[_0x5ccd('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x388a7e['state']=0xd;_0x388a7e[_0x5ccd('0x30')]=_0x5ccd('0x31');_0x388a7e[_0x5ccd('0x32')]=_0x121e68;_0x388a7e[_0x5ccd('0x33')]=_0x121e68;_0x388a7e['endtime']=_0x121e68;};exports[_0x5ccd('0x34')]=function(_0x422844,_0x3db979,_0x1ffb5a){var _0x215e8d=moment()['format'](_0x5ccd('0x35'));_0x422844['state']=_0x3db979;_0x422844[_0x5ccd('0x30')]=_0x1ffb5a;_0x422844[_0x5ccd('0x33')]=_0x215e8d;_0x422844[_0x5ccd('0x36')]=utils[_0x5ccd('0x37')](_0x422844['responsetime'],_0x422844['starttime']);};exports[_0x5ccd('0x38')]=function(_0xb5743c,_0x10c7ac,_0x911426){_0xb5743c[_0x5ccd('0x39')]=_0x10c7ac;_0xb5743c[_0x5ccd('0x3a')]=_0x911426;};exports['logCustomer']=function(_0x743311,_0x25f463,_0x47d77d){var _0x862ee6=moment()[_0x5ccd('0x11')](_0x5ccd('0x35'));_0x743311[_0x5ccd('0x3b')]=_0x25f463;_0x743311['statedesc']=_0x47d77d;_0x743311[_0x5ccd('0x33')]=_0x743311[_0x5ccd('0x33')]?_0x743311[_0x5ccd('0x33')]:_0x862ee6;_0x743311[_0x5ccd('0x3c')]=_0x743311[_0x5ccd('0x3c')]?_0x743311['endtime']:_0x862ee6;_0x743311['ringtime']=utils[_0x5ccd('0x37')](_0x743311[_0x5ccd('0x33')]||0x0,_0x743311[_0x5ccd('0x32')]||0x0);_0x743311[_0x5ccd('0x3d')]=_0x743311[_0x5ccd('0x3e')]?utils[_0x5ccd('0x37')](_0x743311[_0x5ccd('0x3c')],_0x743311[_0x5ccd('0x3e')]):0x0;};exports[_0x5ccd('0x3f')]=function(_0x2b9595){return _0x2b9595===_0x5ccd('0x40');};exports[_0x5ccd('0x41')]=function(_0x11b623,_0x27d40c,_0x3e09f8,_0x5333b1,_0x46ea6b){var _0x38df9c=_0x5333b1?_0x5ccd('0x42'):_0x11b623[_0x5ccd('0x18')];_0x38df9c=_0x46ea6b?_0x5ccd('0x43'):_0x38df9c;return{'actionid':_0x11b623[_0x5ccd('0x44')],'action':_0x5ccd('0x45'),'channel':_0x11b623[_0x5ccd('0x46')],'callerid':util[_0x5ccd('0x11')](_0x5ccd('0x12'),_0x38df9c,_0x11b623[_0x5ccd('0x19')]),'Exten':_0x5ccd('0x47'),'Context':'from-sip','Priority':'1','variable':_0x3e09f8,'timeout':(_0x27d40c[_0x5ccd('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x11b623['uniqueid']};};exports[_0x5ccd('0x49')]=function(_0x10aab5){return _0x10aab5['countbusyretry']+_0x10aab5['countcongestionretry']+_0x10aab5[_0x5ccd('0x4a')]+_0x10aab5['countagentrejectretry']+_0x10aab5[_0x5ccd('0x4b')];};exports[_0x5ccd('0x4c')]=function(_0x35301c){var _0x4be2bf=_['clone'](_0x35301c);_0x4be2bf[_0x5ccd('0x3b')]=0xf;_0x4be2bf[_0x5ccd('0x30')]=_0x5ccd('0x4d');return _0x4be2bf;};exports[_0x5ccd('0x4e')]=function(_0x1beaf8,_0x569153,_0x1cfd08){var _0x43eff0={};_0x43eff0[_0x569153]=_0x1beaf8[_0x569153];_0x43eff0[_0x5ccd('0x4f')]=![];_0x43eff0[_0x5ccd('0x50')]=moment()['add'](_0x1cfd08,_0x5ccd('0x51'))[_0x5ccd('0x11')](_0x5ccd('0x35'));_0x43eff0[_0x5ccd('0x52')]=_0x1beaf8[_0x5ccd('0x52')];_0x43eff0['ListId']=_0x1beaf8[_0x5ccd('0x53')];_0x43eff0[_0x5ccd('0x1b')]=_0x1beaf8[_0x5ccd('0x1b')]||undefined;return _0x43eff0;};exports[_0x5ccd('0x54')]=function(_0x4af79f,_0x39fb12){if(!_['isNil'](_0x4af79f)){if(_0x4af79f[_0x5ccd('0x55')]>0x0){_0x4af79f[_0x5ccd('0x55')]-=0x1;}else{logger[_0x5ccd('0xa')](_0x39fb12,_0x5ccd('0x56'));}}else{logger[_0x5ccd('0xa')](_0x39fb12,_0x5ccd('0x57'));}};exports[_0x5ccd('0x58')]=function(_0x2da3f7){if(_0x2da3f7<=0x0){return!![];}return![];};function buildObj(_0x35797c,_0x33ee4e,_0x33505c){_0x35797c[_0x5ccd('0x59')]=_0x33ee4e;_0x35797c[_0x5ccd('0x17')]=_0x35797c[_0x5ccd('0x5a')];_0x35797c[_0x5ccd('0x5b')]=_0x35797c['channelAgent'];_0x35797c[_0x5ccd('0x5c')]=_0x5ccd('0x5d');if(_0x33505c){_0x35797c['mandatoryDisposition']=_0x33505c['mandatoryDisposition'];}return _0x35797c;}exports['buildObj']=buildObj;exports[_0x5ccd('0x5e')]=function(_0x44043f){var _0x52e55a=[];for(var _0x4e8875 in _0x44043f){if(_0x44043f['hasOwnProperty'](_0x4e8875)){if(!_['isNil'](_0x44043f[_0x4e8875])&&_0x44043f[_0x4e8875][_0x5ccd('0x3b')]===_0x5ccd('0x5f')&&_0x44043f[_0x4e8875][_0x5ccd('0x60')]===_0x5ccd('0x61')){_0x52e55a[_0x5ccd('0x62')](_0x44043f[_0x4e8875]['id']);}}}return _0x52e55a;};exports[_0x5ccd('0x63')]=function(_0x3cf47c){var _0x1e28a5=moment()[_0x5ccd('0x64')](0x0);var _0x2023f5=moment(_0x3cf47c)[_0x5ccd('0x64')](0x0);return _0x1e28a5[_0x5ccd('0x65')](_0x2023f5,_0x5ccd('0x66'));};exports[_0x5ccd('0x67')]=function(_0x439071){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x439071['ContactId'],'ListId':_0x439071[_0x5ccd('0x53')],'VoiceQueueId':_0x439071[_0x5ccd('0x1b')]||undefined,'CampaignId':_0x439071['CampaignId']||undefined};};exports['filterKey']=function(_0x3096cf){if(_0x3096cf==='uniqueid'||_0x3096cf==='idContact'||_0x3096cf===_0x5ccd('0x5a')||_0x3096cf===_0x5ccd('0x68')||_0x3096cf===_0x5ccd('0x69')||_0x3096cf===_0x5ccd('0x6a')||_0x3096cf===_0x5ccd('0x39')||_0x3096cf===_0x5ccd('0x46')||_0x3096cf==='calleridname'||_0x3096cf===_0x5ccd('0x4f')||_0x3096cf==='calleridnum'||_0x3096cf===_0x5ccd('0x50')||_0x3096cf==='countbusyretry'||_0x3096cf===_0x5ccd('0x6b')||_0x3096cf===_0x5ccd('0x4a')||_0x3096cf===_0x5ccd('0x6c')||_0x3096cf===_0x5ccd('0x6d')||_0x3096cf===_0x5ccd('0x6e')||_0x3096cf==='callbackat'||_0x3096cf===_0x5ccd('0x6f')||_0x3096cf==='ContactId'||_0x3096cf===_0x5ccd('0x53')||_0x3096cf===_0x5ccd('0x3a')||_0x3096cf===_0x5ccd('0x1b')||_0x3096cf===_0x5ccd('0x70')||_0x3096cf===_0x5ccd('0x71')||_0x3096cf==='xmd-queue'||_0x3096cf===_0x5ccd('0x72')||_0x3096cf===_0x5ccd('0x73')||_0x3096cf===_0x5ccd('0x74')||_0x3096cf==='xmd-dialtimeout'||_0x3096cf===_0x5ccd('0x75')||_0x3096cf==='xmd-dialid'||_0x3096cf===_0x5ccd('0x76')||_0x3096cf===_0x5ccd('0x77')||_0x3096cf==='xmd-cdrtype'||_0x3096cf===_0x5ccd('0x78')||_0x3096cf===_0x5ccd('0x79')||_0x3096cf===_0x5ccd('0x7a')||_0x3096cf===_0x5ccd('0x7b')||_0x3096cf===_0x5ccd('0x7c')||_0x3096cf===_0x5ccd('0x7d')||_0x3096cf==='rtpaudioqosjitterbridged'||_0x3096cf==='rtpaudioqosloss'||_0x3096cf===_0x5ccd('0x7e')||_0x3096cf===_0x5ccd('0x7f')||_0x3096cf===_0x5ccd('0x80')||_0x3096cf===_0x5ccd('0x7b')||_0x3096cf==='rtpaudioqosbridged'||_0x3096cf===_0x5ccd('0x7d')||_0x3096cf==='rtpaudioqosjitterbridged'||_0x3096cf===_0x5ccd('0x81')||_0x3096cf==='rtpaudioqoslossbridged'||_0x3096cf===_0x5ccd('0x7f')||_0x3096cf===_0x5ccd('0x80')||_0x3096cf===_0x5ccd('0x82')||_0x3096cf==='bridgepvtcallid'||_0x3096cf==='state'||_0x3096cf===_0x5ccd('0x30')){return![];}return!![];};exports[_0x5ccd('0x83')]=function(_0xd04f70,_0x2a26af){var _0x56f59e,_0x452a1b,_0xa2c628;if(_0x2a26af<=0x0){_0x2a26af=0x1;}_0x56f59e=new RegExp(_0x5ccd('0x84')+_0x2a26af+'}$');_0x452a1b=Math[_0x5ccd('0x85')](0xa,_0x2a26af-0x1);_0xa2c628=Math['pow'](0xa,_0x2a26af)-0x1;return util[_0x5ccd('0x11')]('%s',_['replace'](_0xd04f70,_0x56f59e,_[_0x5ccd('0x86')](_0x452a1b,_0xa2c628)));};exports[_0x5ccd('0x87')]=function(_0x2d7e4b){var _0x3e661d=_0x2d7e4b[_0x5ccd('0x88')](/"(.*?)"/);return _0x3e661d?_0x3e661d[0x1]:_0x2d7e4b;};exports[_0x5ccd('0x89')]=function(_0x422f44){var _0xcd3cf5=_0x422f44['match'](/<(.*?)>/);return _0xcd3cf5?_0xcd3cf5[0x1]:_0x422f44;};function buildNoAnswerEventPayload(_0x4391ff,_0x589d7a){var _0x3dac10=buildObj(_0x4391ff,'noanswer');if(!_[_0x5ccd('0x10')](_0x589d7a['variables'])){Object[_0x5ccd('0x8a')](_0x589d7a['variables'])[_0x5ccd('0x8b')](function(_0x316971){_0x3dac10[_0x316971[_0x5ccd('0x8c')]()]=_0x589d7a[_0x5ccd('0x8d')][_0x316971];});}return _0x3dac10;}exports[_0x5ccd('0x8e')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index e477799..c230e3a 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 _0xf558=['string','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect'];(function(_0x127f73,_0xcdeb76){var _0x24c908=function(_0x492b24){while(--_0x492b24){_0x127f73['push'](_0x127f73['shift']());}};_0x24c908(++_0xcdeb76);}(_0xf558,0xe1));var _0x8f55=function(_0x105114,_0x213db9){_0x105114=_0x105114-0x0;var _0xea4357=_0xf558[_0x105114];return _0xea4357;};'use strict';exports['queueadd']={'queue':{'type':_0x8f55('0x0'),'required':!![]},'interface':{'type':_0x8f55('0x0'),'required':!![]},'membername':{'type':_0x8f55('0x0'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x8f55('0x1'),'required':![]}};exports[_0x8f55('0x2')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x8f55('0x0'),'required':!![]}};exports[_0x8f55('0x3')]={'interface':{'type':_0x8f55('0x0'),'required':!![]},'paused':{'type':_0x8f55('0x1')},'reason':{'type':_0x8f55('0x0'),'required':![]}};exports[_0x8f55('0x4')]={'module':{'type':_0x8f55('0x0'),'required':![]}};exports[_0x8f55('0x5')]={'uniqueid':{'type':_0x8f55('0x0'),'required':!![]}};exports[_0x8f55('0x6')]={'uniqueid':{'type':_0x8f55('0x0'),'required':!![]},'filename':{'type':_0x8f55('0x0')},'format':{'type':'string'},'mixmonitorid':{'type':_0x8f55('0x0')}};exports[_0x8f55('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x8f55('0x8')]={'uniqueid':{'type':_0x8f55('0x0'),'required':!![]},'exten':{'type':_0x8f55('0x0'),'required':!![]},'context':{'type':_0x8f55('0x0')}}; \ No newline at end of file +var _0xd3e5=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd3e5,0x115));var _0x5d3e=function(_0x5546f5,_0x53cbed){_0x5546f5=_0x5546f5-0x0;var _0x2227c0=_0xd3e5[_0x5546f5];return _0x2227c0;};'use strict';exports[_0x5d3e('0x0')]={'queue':{'type':_0x5d3e('0x1'),'required':!![]},'interface':{'type':_0x5d3e('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x5d3e('0x2'),'required':![]},'paused':{'type':_0x5d3e('0x3'),'required':![]}};exports[_0x5d3e('0x4')]={'queue':{'type':_0x5d3e('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0x5d3e('0x1'),'required':!![]},'paused':{'type':_0x5d3e('0x3')},'reason':{'type':'string','required':![]}};exports[_0x5d3e('0x5')]={'module':{'type':_0x5d3e('0x1'),'required':![]}};exports[_0x5d3e('0x6')]={'uniqueid':{'type':_0x5d3e('0x1'),'required':!![]}};exports[_0x5d3e('0x7')]={'uniqueid':{'type':_0x5d3e('0x1'),'required':!![]},'filename':{'type':_0x5d3e('0x1')},'format':{'type':_0x5d3e('0x1')},'mixmonitorid':{'type':_0x5d3e('0x1')}};exports[_0x5d3e('0x8')]={'uniqueid':{'type':_0x5d3e('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x5d3e('0x1'),'required':!![]},'exten':{'type':_0x5d3e('0x1'),'required':!![]},'context':{'type':_0x5d3e('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 6df7395..0089132 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 _0x5f66=['diff','seconds','disposition','ANSWERED','outbound','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','telephones','trunks','voiceQueues','triggers','templates','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','isNil','format','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','name','isUndefined','initTelephones','SIP/%s','initTriggers','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','sumDuration','queuecallercompleteAt','queuecallerexitAt'];(function(_0x540af5,_0x311efd){var _0x1d462a=function(_0x50b85f){while(--_0x50b85f){_0x540af5['push'](_0x540af5['shift']());}};_0x1d462a(++_0x311efd);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x5f66[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var util=require('util');var Agent=require(_0x65f6('0x1'));var Telephone=require(_0x65f6('0x2'));var Trunk=require(_0x65f6('0x3'));var VoiceQueue=require(_0x65f6('0x4'));var Trigger=require(_0x65f6('0x5'));var Template=require('../model/template');var Campaign=require(_0x65f6('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x65f6('0x7'));var SalesforceAccount=require(_0x65f6('0x8'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x65f6('0x9'));var DeskAccount=require(_0x65f6('0xa'));var VtigerAccount=require(_0x65f6('0xb'));var ServicenowAccount=require(_0x65f6('0xc'));var Dynamics365Account=require(_0x65f6('0xd'));var FreshsalesAccount=require(_0x65f6('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this['agents']={};this[_0x65f6('0xf')]={};this[_0x65f6('0x10')]={};this[_0x65f6('0x11')]={};this[_0x65f6('0x12')]={};this['campaigns']={};this[_0x65f6('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x65f6('0x14')]={};this['queueChannels']={};this[_0x65f6('0x15')]={};this['timers']={};this[_0x65f6('0x16')]={};this[_0x65f6('0x17')]={};this[_0x65f6('0x18')]={};this[_0x65f6('0x19')]={};this[_0x65f6('0x1a')]={};this[_0x65f6('0x1b')]={};this[_0x65f6('0x1c')]={};this[_0x65f6('0x1d')]={};this[_0x65f6('0x1e')]={};this[_0x65f6('0x1f')]={};this['freshsalesAccounts']={};this[_0x65f6('0x20')]={};}function freeIsNotKey(_0x49a913,_0x5dd324,_0x1693e6){var _0x5c69f8=_[_0x65f6('0x21')](_0x49a913,function(_0x1c955c){return _0x1c955c[_0x1693e6];});for(var _0x1b1cbb in _0x5dd324){if(_0x5dd324[_0x65f6('0x22')](_0x1b1cbb)){if(!_0x5c69f8[_0x1b1cbb]){delete _0x5dd324[_0x1b1cbb];}}}}function freeIsNotKeySip(_0xc8660c,_0x18380e){var _0x495dd6=_['mapKeys'](_0xc8660c,function(_0x2d538c){return util['format']('SIP/%s',_0x2d538c['name']);});for(var _0x365159 in _0x18380e){if(_0x18380e[_0x65f6('0x22')](_0x365159)){if(!_0x495dd6[_0x365159]){delete _0x18380e[_0x365159];}}}}function freeIsNotKeyAgent(_0x5114a4,_0x39e19f){var _0x270893=_[_0x65f6('0x21')](_0x5114a4,function(_0x3876ed){var _0x219ab2=_[_0x65f6('0x23')](_0x3876ed['interface'])?util[_0x65f6('0x24')]('SIP/%s',_0x3876ed['name']):_0x3876ed[_0x65f6('0x25')];return _0x219ab2;});for(var _0xd173f4 in _0x39e19f){if(_0x39e19f['hasOwnProperty'](_0xd173f4)){if(!_0x270893[_0xd173f4]){delete _0x39e19f[_0xd173f4];}}}}function clearVoiceCallReports(_0x1eeaaa){_0x1eeaaa[_0x65f6('0x26')]=0x0;_0x1eeaaa[_0x65f6('0x27')]=0x0;_0x1eeaaa[_0x65f6('0x28')]=0x0;_0x1eeaaa['sumDuration']=0x0;_0x1eeaaa[_0x65f6('0x29')]=0x0;}function clearCampaigns(_0x59ea32){if(!_[_0x65f6('0x2a')](_0x59ea32)){for(var _0x5963e0 in _0x59ea32){if(_0x59ea32['hasOwnProperty'](_0x5963e0)){_0x59ea32[_0x5963e0]['ivrTotalCallsDays']=0x0;_0x59ea32[_0x5963e0][_0x65f6('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x16cde8){if(!_['isEmpty'](_0x16cde8)){for(var _0x296cd9 in _0x16cde8){if(_0x16cde8[_0x65f6('0x22')](_0x296cd9)){_0x16cde8[_0x296cd9]['total']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x27')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2c')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2d')]=0x0;_0x16cde8[_0x296cd9]['sumHoldTime']=0x0;_0x16cde8[_0x296cd9]['sumDuration']=0x0;_0x16cde8[_0x296cd9]['sumBillable']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2e')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2f')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x30')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x31')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x32')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x33')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x34')]=0x0;_0x16cde8[_0x296cd9]['outboundDropCallsDayCallersExit']=0x0;_0x16cde8[_0x296cd9]['outboundBlacklistCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x35')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x36')]=0x0;_0x16cde8[_0x296cd9]['outboundReCallsDay']=0x0;_0x16cde8[_0x296cd9]['outboundAnswerAgiCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x37')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x38')]=!![];}}}}Realtime[_0x65f6('0x39')][_0x65f6('0x3a')]=function(_0x1217fd,_0x2d32be){for(var _0x5792a0 in _0x2d32be){if(_0x1217fd[_0x65f6('0x22')](_0x5792a0)){_0x1217fd[_0x5792a0]=_0x2d32be[_0x5792a0];}}};Realtime[_0x65f6('0x39')][_0x65f6('0x3b')]=function(){var _0x4bc037=this;return function(_0x217f35){if(_0x217f35){freeIsNotKeyAgent(_0x217f35,_0x4bc037[_0x65f6('0x3c')]);for(var _0xbaed3c=0x0,_0x45510a={};_0xbaed3c<_0x217f35[_0x65f6('0x3d')];_0xbaed3c+=0x1){_0x45510a=_0x217f35[_0xbaed3c];var _0x2f054c=_['isNil'](_0x45510a[_0x65f6('0x25')])?util[_0x65f6('0x24')]('SIP/%s',_0x45510a[_0x65f6('0x3e')]):_0x45510a['interface'];if(_[_0x65f6('0x3f')](_0x4bc037['agents'][_0x2f054c])){_0x4bc037[_0x65f6('0x3c')][_0x2f054c]=new Agent(_0x45510a);}else{_0x4bc037[_0x65f6('0x3a')](_0x4bc037['agents'][_0x2f054c],_0x45510a);}}}return _0x4bc037[_0x65f6('0x3c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x40')]=function(){var _0x515648=this;return function(_0x582c7e){if(_0x582c7e){freeIsNotKeySip(_0x582c7e,_0x515648[_0x65f6('0xf')]);for(var _0x4c0df4=0x0,_0x26de30={};_0x4c0df4<_0x582c7e['length'];_0x4c0df4+=0x1){_0x26de30=_0x582c7e[_0x4c0df4];if(_[_0x65f6('0x3f')](_0x515648[_0x65f6('0xf')][util['format'](_0x65f6('0x41'),_0x26de30['name'])])){_0x515648['telephones'][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])]=new Telephone(_0x26de30);}else{_0x515648[_0x65f6('0x3a')](_0x515648[_0x65f6('0xf')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])],_0x26de30);}}}return _0x515648['telephones'];};};Realtime[_0x65f6('0x39')]['initTrunks']=function(){var _0x12a589=this;return function(_0xa4394a){if(_0xa4394a){freeIsNotKeySip(_0xa4394a,_0x12a589[_0x65f6('0x10')]);for(var _0x2ea7f7=0x0,_0x5ef5c2={};_0x2ea7f7<_0xa4394a[_0x65f6('0x3d')];_0x2ea7f7+=0x1){_0x5ef5c2=_0xa4394a[_0x2ea7f7];if(_[_0x65f6('0x3f')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])])){_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2['name'])]=new Trunk(_0x5ef5c2);}else{_0x12a589[_0x65f6('0x3a')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])],_0x5ef5c2);}}}return _0x12a589[_0x65f6('0x10')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x42')]=function(){var _0x461393=this;return function(_0x2abbed){if(_0x2abbed){freeIsNotKey(_0x2abbed,_0x461393[_0x65f6('0x12')],'id');for(var _0x2c008a=0x0,_0x6c4d94={};_0x2c008a<_0x2abbed[_0x65f6('0x3d')];_0x2c008a+=0x1){_0x6c4d94=_0x2abbed[_0x2c008a];if(_[_0x65f6('0x3f')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']])){_0x461393['triggers'][_0x6c4d94['id']]=new Trigger(_0x6c4d94);}else{_0x461393[_0x65f6('0x3a')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']],_0x6c4d94);}}}return _0x461393[_0x65f6('0x12')];};};Realtime[_0x65f6('0x39')]['initTemplates']=function(){var _0x1bf5bf=this;return function(_0x2d0dac){if(_0x2d0dac){freeIsNotKey(_0x2d0dac,_0x1bf5bf[_0x65f6('0x13')],'id');for(var _0x5e69b4=0x0,_0x2dbab3={};_0x5e69b4<_0x2d0dac[_0x65f6('0x3d')];_0x5e69b4+=0x1){_0x2dbab3=_0x2d0dac[_0x5e69b4];if(_[_0x65f6('0x3f')](_0x1bf5bf[_0x65f6('0x13')][_0x2dbab3['id']])){_0x1bf5bf['templates'][_0x2dbab3['id']]=new Template(_0x2dbab3);}else{_0x1bf5bf[_0x65f6('0x3a')](_0x1bf5bf['templates'][_0x2dbab3['id']],_0x2dbab3);}}}return _0x1bf5bf[_0x65f6('0x13')];};};Realtime[_0x65f6('0x39')]['initZendeskAccounts']=function(){var _0xf754ee=this;return function(_0x5085db){if(_0x5085db){freeIsNotKey(_0x5085db,_0xf754ee[_0x65f6('0x17')],'id');for(var _0x4d9b76=0x0,_0x2d1706={};_0x4d9b76<_0x5085db[_0x65f6('0x3d')];_0x4d9b76+=0x1){_0x2d1706=_0x5085db[_0x4d9b76];if(_[_0x65f6('0x3f')](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']])){_0xf754ee['zendeskAccounts'][_0x2d1706['id']]=new ZendeskAccount(_0x2d1706);}else{_0xf754ee['mergeFromDatabase'](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']],_0x2d1706);}}}return _0xf754ee[_0x65f6('0x17')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x43')]=function(){var _0x3b907c=this;return function(_0x2d6ab9){if(_0x2d6ab9){freeIsNotKey(_0x2d6ab9,_0x3b907c[_0x65f6('0x18')],'id');for(var _0x41690c=0x0,_0x414f49={};_0x41690c<_0x2d6ab9['length'];_0x41690c+=0x1){_0x414f49=_0x2d6ab9[_0x41690c];if(_[_0x65f6('0x3f')](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']])){_0x3b907c[_0x65f6('0x18')][_0x414f49['id']]=new SalesforceAccount(_0x414f49);}else{_0x3b907c['mergeFromDatabase'](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']],_0x414f49);}}}return _0x3b907c[_0x65f6('0x18')];};};Realtime['prototype'][_0x65f6('0x44')]=function(){var _0x253d52=this;return function(_0x57eb04){if(_0x57eb04){freeIsNotKey(_0x57eb04,_0x253d52[_0x65f6('0x1a')],'id');for(var _0x4f96c4=0x0,_0x247be3={};_0x4f96c4<_0x57eb04[_0x65f6('0x3d')];_0x4f96c4+=0x1){_0x247be3=_0x57eb04[_0x4f96c4];if(_[_0x65f6('0x3f')](_0x253d52['freshdeskAccounts'][_0x247be3['id']])){_0x253d52[_0x65f6('0x1a')][_0x247be3['id']]=new FreshdeskAccount(_0x247be3);}else{_0x253d52[_0x65f6('0x3a')](_0x253d52['freshdeskAccounts'][_0x247be3['id']],_0x247be3);}}}return _0x253d52[_0x65f6('0x1a')];};};Realtime[_0x65f6('0x39')]['initZohoAccounts']=function(){var _0x34d6a9=this;return function(_0x344c0e){if(_0x344c0e){freeIsNotKey(_0x344c0e,_0x34d6a9[_0x65f6('0x1b')],'id');for(var _0x25d504=0x0,_0x234fa7={};_0x25d504<_0x344c0e[_0x65f6('0x3d')];_0x25d504+=0x1){_0x234fa7=_0x344c0e[_0x25d504];if(_[_0x65f6('0x3f')](_0x34d6a9[_0x65f6('0x1b')][_0x234fa7['id']])){_0x34d6a9['zohoAccounts'][_0x234fa7['id']]=new ZohoAccount(_0x234fa7);}else{_0x34d6a9['mergeFromDatabase'](_0x34d6a9['zohoAccounts'][_0x234fa7['id']],_0x234fa7);}}}return _0x34d6a9[_0x65f6('0x1b')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x45')]=function(){var _0x20c322=this;return function(_0x545445){if(_0x545445){freeIsNotKey(_0x545445,_0x20c322[_0x65f6('0x1c')],'id');for(var _0x2032b9=0x0,_0x9ff849={};_0x2032b9<_0x545445['length'];_0x2032b9+=0x1){_0x9ff849=_0x545445[_0x2032b9];if(_[_0x65f6('0x3f')](_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']])){_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']]=new DeskAccount(_0x9ff849);}else{_0x20c322['mergeFromDatabase'](_0x20c322['deskAccounts'][_0x9ff849['id']],_0x9ff849);}}}return _0x20c322[_0x65f6('0x1c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x46')]=function(){var _0x39364f=this;return function(_0x2a76b3){if(_0x2a76b3){freeIsNotKey(_0x2a76b3,_0x39364f[_0x65f6('0x19')],'id');for(var _0x35d77f=0x0,_0x138334={};_0x35d77f<_0x2a76b3[_0x65f6('0x3d')];_0x35d77f+=0x1){_0x138334=_0x2a76b3[_0x35d77f];if(_[_0x65f6('0x3f')](_0x39364f[_0x65f6('0x19')][_0x138334['id']])){_0x39364f[_0x65f6('0x19')][_0x138334['id']]=new SugarcrmAccount(_0x138334);}else{_0x39364f[_0x65f6('0x3a')](_0x39364f[_0x65f6('0x19')][_0x138334['id']],_0x138334);}}}return _0x39364f['sugarcrmAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x47')]=function(){var _0x42a805=this;return function(_0x4b4efe){if(_0x4b4efe){freeIsNotKey(_0x4b4efe,_0x42a805[_0x65f6('0x1d')],'id');for(var _0x16dec0=0x0,_0x4638c9={};_0x16dec0<_0x4b4efe[_0x65f6('0x3d')];_0x16dec0+=0x1){_0x4638c9=_0x4b4efe[_0x16dec0];if(_['isUndefined'](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']])){_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']]=new VtigerAccount(_0x4638c9);}else{_0x42a805[_0x65f6('0x3a')](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']],_0x4638c9);}}}return _0x42a805['vtigerAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x48')]=function(){var _0x5c55e4=this;return function(_0x28682b){if(_0x28682b){freeIsNotKey(_0x28682b,_0x5c55e4[_0x65f6('0x1e')],'id');for(var _0x36c316=0x0,_0x51549d={};_0x36c316<_0x28682b[_0x65f6('0x3d')];_0x36c316+=0x1){_0x51549d=_0x28682b[_0x36c316];if(_[_0x65f6('0x3f')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']])){_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']]=new ServicenowAccount(_0x51549d);}else{_0x5c55e4[_0x65f6('0x3a')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']],_0x51549d);}}}return _0x5c55e4['servicenowAccounts'];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x336a7d=this;return function(_0x367d95){if(_0x367d95){freeIsNotKey(_0x367d95,_0x336a7d[_0x65f6('0x1f')],'id');for(var _0x471bec=0x0,_0xab6f0={};_0x471bec<_0x367d95[_0x65f6('0x3d')];_0x471bec+=0x1){_0xab6f0=_0x367d95[_0x471bec];if(_['isUndefined'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']])){_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']]=new Dynamics365Account(_0xab6f0);}else{_0x336a7d['mergeFromDatabase'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']],_0xab6f0);}}}return _0x336a7d[_0x65f6('0x1f')];};};Realtime[_0x65f6('0x39')]['initFreshsalesAccounts']=function(){var _0x23c441=this;return function(_0x448c9a){if(_0x448c9a){freeIsNotKey(_0x448c9a,_0x23c441['freshsalesAccounts'],'id');for(var _0x271d76=0x0,_0x3edc6b={};_0x271d76<_0x448c9a[_0x65f6('0x3d')];_0x271d76+=0x1){_0x3edc6b=_0x448c9a[_0x271d76];if(_[_0x65f6('0x3f')](_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']])){_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']]=new FreshsalesAccount(_0x3edc6b);}else{_0x23c441[_0x65f6('0x3a')](_0x23c441['freshsalesAccounts'][_0x3edc6b['id']],_0x3edc6b);}}}return _0x23c441['freshsalesAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4a')]=function(){var _0x4a9524=this;return function(_0x417ba5){for(var _0x5f3df9=0x0;_0x5f3df9<_0x417ba5[_0x65f6('0x3d')];_0x5f3df9+=0x1){_['merge'](_0x4a9524[_0x65f6('0x11')][_0x417ba5[_0x5f3df9][_0x65f6('0x3e')]],_0x417ba5[_0x5f3df9]);}return _0x4a9524[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4b')]=function(){var _0x264e6c=this;return function(_0x1aaf75){clearVoiceQueues(_0x264e6c[_0x65f6('0x11')]);if(_0x1aaf75){_0x1aaf75=_[_0x65f6('0x4c')](_0x1aaf75,'uniqueid');for(var _0x480190 in _0x1aaf75){if(_0x1aaf75[_0x65f6('0x22')](_0x480190)){for(var _0x13ee4b=0x0;_0x13ee4b<_0x1aaf75[_0x480190][_0x65f6('0x3d')];_0x13ee4b+=0x1){var _0x51497f=_0x1aaf75[_0x480190][_0x13ee4b]['queue'];if(_0x264e6c[_0x65f6('0x11')][_0x51497f]){if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4d')]){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x2c')]+=0x1;}if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4e')]){_0x264e6c[_0x65f6('0x11')][_0x51497f]['abandoned']+=0x1;}_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4f')])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;if(_0x13ee4b===_0x1aaf75[_0x480190][_0x65f6('0x3d')]-0x1){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x52')]||_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerabandonAt']||_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x53')])[_0x65f6('0x54')](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x26')]+=0x1;if(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercomplete']){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x27')]+=0x1;_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x29')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercompleteAt'])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerleaveAt']),_0x65f6('0x55'))||0x0;}}else{_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]||0x0;}}}}}}return _0x264e6c[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')]['initVoiceCallReports']=function(){var _0x40d0f7=this;return function(_0x15809e){clearVoiceCallReports(_0x40d0f7['outbound']);if(_0x15809e){for(var _0x758e80=0x0;_0x758e80<_0x15809e[_0x65f6('0x3d')];_0x758e80+=0x1){_0x40d0f7['outbound'][_0x65f6('0x26')]+=0x1;_0x40d0f7['outbound'][_0x65f6('0x51')]+=_0x15809e[_0x758e80]['duration'];if(_0x15809e[_0x758e80][_0x65f6('0x56')]===_0x65f6('0x57')){_0x40d0f7['outbound'][_0x65f6('0x27')]+=0x1;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x28')]+=_0x15809e[_0x758e80][_0x65f6('0x59')]-_0x15809e[_0x758e80][_0x65f6('0x5a')]||0x0;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x29')]+=_0x15809e[_0x758e80][_0x65f6('0x5a')];}}}return _0x40d0f7[_0x65f6('0x58')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x5b')]=function(){var _0x574d84=this;return function(_0x10a661){if(_0x10a661){freeIsNotKey(_0x10a661,_0x574d84[_0x65f6('0x5c')],_0x65f6('0x3e'));for(var _0x219e42=0x0,_0x5694f9={};_0x219e42<_0x10a661[_0x65f6('0x3d')];_0x219e42+=0x1){_0x5694f9=_0x10a661[_0x219e42];if(_[_0x65f6('0x3f')](_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]])){_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]]=new Campaign(_0x5694f9);}else{_0x574d84['mergeFromDatabase'](_0x574d84[_0x65f6('0x5c')][_0x5694f9[_0x65f6('0x3e')]],_0x5694f9);_0x574d84['campaigns'][_0x5694f9['name']][_0x65f6('0x5d')]=_0x5694f9[_0x65f6('0x5e')]?_0x5694f9['SquareProject'][_0x65f6('0x3e')]:undefined;}}}return _0x574d84[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')]['initVoiceExtensions']=function(){var _0x1348ec=this;return function(_0x246510){if(_0x246510){freeIsNotKey(_0x246510,_0x1348ec['voiceExtensions'],'id');for(var _0x36b8de=0x0,_0x504b39={};_0x36b8de<_0x246510[_0x65f6('0x3d')];_0x36b8de+=0x1){_0x504b39=_0x246510[_0x36b8de];if(_['isUndefined'](_0x1348ec['voiceExtensions'][_0x504b39['id']])){_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']]=new VoiceExtension(_0x504b39);}else{_0x1348ec[_0x65f6('0x3a')](_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']],_0x504b39);}}}return _0x1348ec[_0x65f6('0x5f')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x60')]=function(){var _0x1ac46f=this;return function(_0x1f4e2c){clearCampaigns(_0x1ac46f['campaigns']);for(var _0x494904=0x0;_0x494904<_0x1f4e2c[_0x65f6('0x3d')];_0x494904+=0x1){_['merge'](_0x1ac46f[_0x65f6('0x5c')][_0x1f4e2c[_0x494904][_0x65f6('0x3e')]],_0x1f4e2c[_0x494904]);}return _0x1ac46f[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x61')]=function(){var _0x56bd9d=this;return function(_0x398cac){if(_0x398cac){freeIsNotKey(_0x398cac,_0x56bd9d[_0x65f6('0x20')],'id');for(var _0x14c908=0x0,_0x576ecd={};_0x14c908<_0x398cac[_0x65f6('0x3d')];_0x14c908+=0x1){_0x576ecd=_0x398cac[_0x14c908];if(_[_0x65f6('0x3f')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']])){_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']]=new FaxAccount(_0x576ecd);}else{_0x56bd9d[_0x65f6('0x3a')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']],_0x576ecd);}}}return _0x56bd9d['faxAccounts'];};};Realtime['prototype'][_0x65f6('0x62')]=function(){var _0x10d744=this;return function(_0x10c916){if(_0x10c916){freeIsNotKey(_0x10c916,_0x10d744[_0x65f6('0x11')],'name');for(var _0x4bda86=0x0,_0x336076={};_0x4bda86<_0x10c916[_0x65f6('0x3d')];_0x4bda86+=0x1){_0x336076=_0x10c916[_0x4bda86];if(_[_0x65f6('0x3f')](_0x10d744[_0x65f6('0x11')][_0x336076[_0x65f6('0x3e')]])){_0x10d744[_0x65f6('0x11')][_0x336076['name']]=new VoiceQueue(_0x336076);}else{_0x10d744['mergeFromDatabase'](_0x10d744['voiceQueues'][_0x336076[_0x65f6('0x3e')]],_0x336076);}}}return _0x10d744[_0x65f6('0x11')];};};module[_0x65f6('0x63')]=Realtime; \ No newline at end of file +var _0x0b0e=['total','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isNil','SIP/%s','isUndefined','prototype','initTelephones','initTrunks','trunks','initTriggers','initTemplates','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','lodash','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','name','hasOwnProperty','format','interface'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0b0e,0x187));var _0xe0b0=function(_0x109946,_0x3494b7){_0x109946=_0x109946-0x0;var _0x4ed20b=_0x0b0e[_0x109946];return _0x4ed20b;};'use strict';var _=require(_0xe0b0('0x0'));var moment=require('moment');var util=require(_0xe0b0('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xe0b0('0x2'));var Trunk=require(_0xe0b0('0x3'));var VoiceQueue=require(_0xe0b0('0x4'));var Trigger=require(_0xe0b0('0x5'));var Template=require(_0xe0b0('0x6'));var Campaign=require(_0xe0b0('0x7'));var VoiceExtension=require(_0xe0b0('0x8'));var ZendeskAccount=require(_0xe0b0('0x9'));var SalesforceAccount=require(_0xe0b0('0xa'));var FreshdeskAccount=require(_0xe0b0('0xb'));var SugarcrmAccount=require(_0xe0b0('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xe0b0('0xd'));var ServicenowAccount=require(_0xe0b0('0xe'));var Dynamics365Account=require(_0xe0b0('0xf'));var FreshsalesAccount=require(_0xe0b0('0x10'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xe0b0('0x11')]={};this[_0xe0b0('0x12')]={};this['trunks']={};this[_0xe0b0('0x13')]={};this[_0xe0b0('0x14')]={};this['campaigns']={};this[_0xe0b0('0x15')]={};this[_0xe0b0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe0b0('0x17')]={};this['channels']={};this[_0xe0b0('0x18')]={};this[_0xe0b0('0x19')]={};this[_0xe0b0('0x1a')]={};this[_0xe0b0('0x1b')]={};this[_0xe0b0('0x1c')]={};this['salesforceAccounts']={};this[_0xe0b0('0x1d')]={};this[_0xe0b0('0x1e')]={};this[_0xe0b0('0x1f')]={};this[_0xe0b0('0x20')]={};this[_0xe0b0('0x21')]={};this['servicenowAccounts']={};this[_0xe0b0('0x22')]={};this['freshsalesAccounts']={};this[_0xe0b0('0x23')]={};}function freeIsNotKey(_0xadee6e,_0x519ae8,_0x11fdca){var _0x4a4cc0=_[_0xe0b0('0x24')](_0xadee6e,function(_0x100204){return _0x100204[_0x11fdca];});for(var _0x56bcc7 in _0x519ae8){if(_0x519ae8['hasOwnProperty'](_0x56bcc7)){if(!_0x4a4cc0[_0x56bcc7]){delete _0x519ae8[_0x56bcc7];}}}}function freeIsNotKeySip(_0x46bb44,_0x50a441){var _0x4df8da=_['mapKeys'](_0x46bb44,function(_0x1920ee){return util['format']('SIP/%s',_0x1920ee[_0xe0b0('0x25')]);});for(var _0x59dff5 in _0x50a441){if(_0x50a441[_0xe0b0('0x26')](_0x59dff5)){if(!_0x4df8da[_0x59dff5]){delete _0x50a441[_0x59dff5];}}}}function freeIsNotKeyAgent(_0x5dba2f,_0x2c84cc){var _0x1cd7c4=_[_0xe0b0('0x24')](_0x5dba2f,function(_0x310a6d){var _0x2cf6a1=_['isNil'](_0x310a6d['interface'])?util[_0xe0b0('0x27')]('SIP/%s',_0x310a6d[_0xe0b0('0x25')]):_0x310a6d[_0xe0b0('0x28')];return _0x2cf6a1;});for(var _0x513e63 in _0x2c84cc){if(_0x2c84cc[_0xe0b0('0x26')](_0x513e63)){if(!_0x1cd7c4[_0x513e63]){delete _0x2c84cc[_0x513e63];}}}}function clearVoiceCallReports(_0x503883){_0x503883[_0xe0b0('0x29')]=0x0;_0x503883['answered']=0x0;_0x503883[_0xe0b0('0x2a')]=0x0;_0x503883['sumDuration']=0x0;_0x503883[_0xe0b0('0x2b')]=0x0;}function clearCampaigns(_0x4de537){if(!_[_0xe0b0('0x2c')](_0x4de537)){for(var _0x4aafbe in _0x4de537){if(_0x4de537[_0xe0b0('0x26')](_0x4aafbe)){_0x4de537[_0x4aafbe]['ivrTotalCallsDays']=0x0;_0x4de537[_0x4aafbe][_0xe0b0('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x3c3bc2){if(!_[_0xe0b0('0x2c')](_0x3c3bc2)){for(var _0x1d91ad in _0x3c3bc2){if(_0x3c3bc2[_0xe0b0('0x26')](_0x1d91ad)){_0x3c3bc2[_0x1d91ad][_0xe0b0('0x29')]=0x0;_0x3c3bc2[_0x1d91ad]['answered']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2e')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2f')]=0x0;_0x3c3bc2[_0x1d91ad]['sumHoldTime']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x30')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2b')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x32')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x33')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x34')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x35')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundUnknownCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x36')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x37')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundBlacklistCallsDay']=0x0;_0x3c3bc2[_0x1d91ad]['outboundOriginateFailureCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x38')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x39')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3a')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3b')]=!![];}}}}Realtime['prototype'][_0xe0b0('0x3c')]=function(_0x3231fc,_0x7867c4){for(var _0x29d725 in _0x7867c4){if(_0x3231fc[_0xe0b0('0x26')](_0x29d725)){_0x3231fc[_0x29d725]=_0x7867c4[_0x29d725];}}};Realtime['prototype'][_0xe0b0('0x3d')]=function(){var _0x208945=this;return function(_0xfc51d3){if(_0xfc51d3){freeIsNotKeyAgent(_0xfc51d3,_0x208945[_0xe0b0('0x11')]);for(var _0x3575bc=0x0,_0x12eeb8={};_0x3575bc<_0xfc51d3[_0xe0b0('0x3e')];_0x3575bc+=0x1){_0x12eeb8=_0xfc51d3[_0x3575bc];var _0x20908f=_[_0xe0b0('0x3f')](_0x12eeb8[_0xe0b0('0x28')])?util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x12eeb8[_0xe0b0('0x25')]):_0x12eeb8[_0xe0b0('0x28')];if(_[_0xe0b0('0x41')](_0x208945['agents'][_0x20908f])){_0x208945[_0xe0b0('0x11')][_0x20908f]=new Agent(_0x12eeb8);}else{_0x208945[_0xe0b0('0x3c')](_0x208945[_0xe0b0('0x11')][_0x20908f],_0x12eeb8);}}}return _0x208945[_0xe0b0('0x11')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x43')]=function(){var _0x12024d=this;return function(_0x533fc7){if(_0x533fc7){freeIsNotKeySip(_0x533fc7,_0x12024d['telephones']);for(var _0x549d9a=0x0,_0x5317df={};_0x549d9a<_0x533fc7[_0xe0b0('0x3e')];_0x549d9a+=0x1){_0x5317df=_0x533fc7[_0x549d9a];if(_[_0xe0b0('0x41')](_0x12024d[_0xe0b0('0x12')][util['format'](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])])){_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')]('SIP/%s',_0x5317df[_0xe0b0('0x25')])]=new Telephone(_0x5317df);}else{_0x12024d[_0xe0b0('0x3c')](_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])],_0x5317df);}}}return _0x12024d[_0xe0b0('0x12')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x44')]=function(){var _0x54f251=this;return function(_0x3e349b){if(_0x3e349b){freeIsNotKeySip(_0x3e349b,_0x54f251['trunks']);for(var _0x34178d=0x0,_0x2d5f47={};_0x34178d<_0x3e349b[_0xe0b0('0x3e')];_0x34178d+=0x1){_0x2d5f47=_0x3e349b[_0x34178d];if(_[_0xe0b0('0x41')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])])){_0x54f251[_0xe0b0('0x45')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])]=new Trunk(_0x2d5f47);}else{_0x54f251[_0xe0b0('0x3c')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47['name'])],_0x2d5f47);}}}return _0x54f251['trunks'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x46')]=function(){var _0x56e7df=this;return function(_0x18a59d){if(_0x18a59d){freeIsNotKey(_0x18a59d,_0x56e7df[_0xe0b0('0x14')],'id');for(var _0x6bca5c=0x0,_0x1c869d={};_0x6bca5c<_0x18a59d[_0xe0b0('0x3e')];_0x6bca5c+=0x1){_0x1c869d=_0x18a59d[_0x6bca5c];if(_['isUndefined'](_0x56e7df['triggers'][_0x1c869d['id']])){_0x56e7df['triggers'][_0x1c869d['id']]=new Trigger(_0x1c869d);}else{_0x56e7df[_0xe0b0('0x3c')](_0x56e7df[_0xe0b0('0x14')][_0x1c869d['id']],_0x1c869d);}}}return _0x56e7df['triggers'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x47')]=function(){var _0x14197b=this;return function(_0x5f037d){if(_0x5f037d){freeIsNotKey(_0x5f037d,_0x14197b[_0xe0b0('0x15')],'id');for(var _0x5c6f94=0x0,_0x57d4b0={};_0x5c6f94<_0x5f037d[_0xe0b0('0x3e')];_0x5c6f94+=0x1){_0x57d4b0=_0x5f037d[_0x5c6f94];if(_[_0xe0b0('0x41')](_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']])){_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']]=new Template(_0x57d4b0);}else{_0x14197b[_0xe0b0('0x3c')](_0x14197b['templates'][_0x57d4b0['id']],_0x57d4b0);}}}return _0x14197b[_0xe0b0('0x15')];};};Realtime[_0xe0b0('0x42')]['initZendeskAccounts']=function(){var _0x50c805=this;return function(_0x5ddad1){if(_0x5ddad1){freeIsNotKey(_0x5ddad1,_0x50c805[_0xe0b0('0x1c')],'id');for(var _0x2184d3=0x0,_0x2419ce={};_0x2184d3<_0x5ddad1[_0xe0b0('0x3e')];_0x2184d3+=0x1){_0x2419ce=_0x5ddad1[_0x2184d3];if(_['isUndefined'](_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']])){_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']]=new ZendeskAccount(_0x2419ce);}else{_0x50c805['mergeFromDatabase'](_0x50c805['zendeskAccounts'][_0x2419ce['id']],_0x2419ce);}}}return _0x50c805[_0xe0b0('0x1c')];};};Realtime[_0xe0b0('0x42')]['initSalesforceAccounts']=function(){var _0x2b1917=this;return function(_0x27fd31){if(_0x27fd31){freeIsNotKey(_0x27fd31,_0x2b1917['salesforceAccounts'],'id');for(var _0x5cb2b6=0x0,_0x123ad2={};_0x5cb2b6<_0x27fd31['length'];_0x5cb2b6+=0x1){_0x123ad2=_0x27fd31[_0x5cb2b6];if(_[_0xe0b0('0x41')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']])){_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']]=new SalesforceAccount(_0x123ad2);}else{_0x2b1917[_0xe0b0('0x3c')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']],_0x123ad2);}}}return _0x2b1917[_0xe0b0('0x48')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x2ef908=this;return function(_0x5d380a){if(_0x5d380a){freeIsNotKey(_0x5d380a,_0x2ef908['freshdeskAccounts'],'id');for(var _0x249d9a=0x0,_0x222174={};_0x249d9a<_0x5d380a['length'];_0x249d9a+=0x1){_0x222174=_0x5d380a[_0x249d9a];if(_['isUndefined'](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']])){_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']]=new FreshdeskAccount(_0x222174);}else{_0x2ef908[_0xe0b0('0x3c')](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']],_0x222174);}}}return _0x2ef908[_0xe0b0('0x1e')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x49')]=function(){var _0x4ebb0f=this;return function(_0x22c7bc){if(_0x22c7bc){freeIsNotKey(_0x22c7bc,_0x4ebb0f['zohoAccounts'],'id');for(var _0x17b3d4=0x0,_0x54106c={};_0x17b3d4<_0x22c7bc['length'];_0x17b3d4+=0x1){_0x54106c=_0x22c7bc[_0x17b3d4];if(_[_0xe0b0('0x41')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']])){_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']]=new ZohoAccount(_0x54106c);}else{_0x4ebb0f[_0xe0b0('0x3c')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']],_0x54106c);}}}return _0x4ebb0f[_0xe0b0('0x1f')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4a')]=function(){var _0x2e1c9b=this;return function(_0x4e0d87){if(_0x4e0d87){freeIsNotKey(_0x4e0d87,_0x2e1c9b[_0xe0b0('0x20')],'id');for(var _0x57ccc9=0x0,_0x2b5553={};_0x57ccc9<_0x4e0d87[_0xe0b0('0x3e')];_0x57ccc9+=0x1){_0x2b5553=_0x4e0d87[_0x57ccc9];if(_[_0xe0b0('0x41')](_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']])){_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']]=new DeskAccount(_0x2b5553);}else{_0x2e1c9b[_0xe0b0('0x3c')](_0x2e1c9b['deskAccounts'][_0x2b5553['id']],_0x2b5553);}}}return _0x2e1c9b[_0xe0b0('0x20')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4b')]=function(){var _0x271445=this;return function(_0x3bb6d6){if(_0x3bb6d6){freeIsNotKey(_0x3bb6d6,_0x271445[_0xe0b0('0x1d')],'id');for(var _0x234cb7=0x0,_0x1a60d2={};_0x234cb7<_0x3bb6d6[_0xe0b0('0x3e')];_0x234cb7+=0x1){_0x1a60d2=_0x3bb6d6[_0x234cb7];if(_[_0xe0b0('0x41')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']])){_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']]=new SugarcrmAccount(_0x1a60d2);}else{_0x271445[_0xe0b0('0x3c')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']],_0x1a60d2);}}}return _0x271445[_0xe0b0('0x1d')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4c')]=function(){var _0x155738=this;return function(_0x5aa79b){if(_0x5aa79b){freeIsNotKey(_0x5aa79b,_0x155738[_0xe0b0('0x21')],'id');for(var _0xe7fbac=0x0,_0x1182dc={};_0xe7fbac<_0x5aa79b[_0xe0b0('0x3e')];_0xe7fbac+=0x1){_0x1182dc=_0x5aa79b[_0xe7fbac];if(_[_0xe0b0('0x41')](_0x155738[_0xe0b0('0x21')][_0x1182dc['id']])){_0x155738[_0xe0b0('0x21')][_0x1182dc['id']]=new VtigerAccount(_0x1182dc);}else{_0x155738['mergeFromDatabase'](_0x155738['vtigerAccounts'][_0x1182dc['id']],_0x1182dc);}}}return _0x155738[_0xe0b0('0x21')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4d')]=function(){var _0x47ecc1=this;return function(_0x117d20){if(_0x117d20){freeIsNotKey(_0x117d20,_0x47ecc1[_0xe0b0('0x4e')],'id');for(var _0x309efb=0x0,_0x3d820c={};_0x309efb<_0x117d20[_0xe0b0('0x3e')];_0x309efb+=0x1){_0x3d820c=_0x117d20[_0x309efb];if(_['isUndefined'](_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']])){_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']]=new ServicenowAccount(_0x3d820c);}else{_0x47ecc1[_0xe0b0('0x3c')](_0x47ecc1['servicenowAccounts'][_0x3d820c['id']],_0x3d820c);}}}return _0x47ecc1[_0xe0b0('0x4e')];};};Realtime[_0xe0b0('0x42')]['initDynamics365Accounts']=function(){var _0x1bd249=this;return function(_0x4c5478){if(_0x4c5478){freeIsNotKey(_0x4c5478,_0x1bd249['dynamics365Accounts'],'id');for(var _0x4474ac=0x0,_0x57b51e={};_0x4474ac<_0x4c5478['length'];_0x4474ac+=0x1){_0x57b51e=_0x4c5478[_0x4474ac];if(_[_0xe0b0('0x41')](_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']])){_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']]=new Dynamics365Account(_0x57b51e);}else{_0x1bd249[_0xe0b0('0x3c')](_0x1bd249['dynamics365Accounts'][_0x57b51e['id']],_0x57b51e);}}}return _0x1bd249[_0xe0b0('0x22')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4f')]=function(){var _0x41ec8e=this;return function(_0x1b29c){if(_0x1b29c){freeIsNotKey(_0x1b29c,_0x41ec8e[_0xe0b0('0x50')],'id');for(var _0xc5e88c=0x0,_0x224f1e={};_0xc5e88c<_0x1b29c['length'];_0xc5e88c+=0x1){_0x224f1e=_0x1b29c[_0xc5e88c];if(_['isUndefined'](_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']])){_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']]=new FreshsalesAccount(_0x224f1e);}else{_0x41ec8e[_0xe0b0('0x3c')](_0x41ec8e['freshsalesAccounts'][_0x224f1e['id']],_0x224f1e);}}}return _0x41ec8e['freshsalesAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x51')]=function(){var _0x5d7cf4=this;return function(_0x5eca3d){for(var _0x691136=0x0;_0x691136<_0x5eca3d[_0xe0b0('0x3e')];_0x691136+=0x1){_[_0xe0b0('0x52')](_0x5d7cf4[_0xe0b0('0x13')][_0x5eca3d[_0x691136][_0xe0b0('0x25')]],_0x5eca3d[_0x691136]);}return _0x5d7cf4[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x53')]=function(){var _0x51f209=this;return function(_0x1daff7){clearVoiceQueues(_0x51f209[_0xe0b0('0x13')]);if(_0x1daff7){_0x1daff7=_[_0xe0b0('0x54')](_0x1daff7,'uniqueid');for(var _0x4fbf44 in _0x1daff7){if(_0x1daff7['hasOwnProperty'](_0x4fbf44)){for(var _0x56ee83=0x0;_0x56ee83<_0x1daff7[_0x4fbf44]['length'];_0x56ee83+=0x1){var _0x567c06=_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x55')];if(_0x51f209['voiceQueues'][_0x567c06]){if(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexit']){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2e')]+=0x1;}if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x56')]){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2f')]+=0x1;}_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')])['diff'](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x58')]),_0xe0b0('0x59'))||0x0;if(_0x56ee83===_0x1daff7[_0x4fbf44][_0xe0b0('0x3e')]-0x1){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5a')]||_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5b')]||_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexitAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerjoinAt']),_0xe0b0('0x59'))||0x0;_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x29')]+=0x1;if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5d')]){_0x51f209['voiceQueues'][_0x567c06][_0xe0b0('0x5e')]+=0x1;_0x51f209[_0xe0b0('0x13')][_0x567c06]['sumBillable']+=moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallercompleteAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')]),_0xe0b0('0x59'))||0x0;}}else{_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]||0x0;}}}}}}return _0x51f209[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x5f')]=function(){var _0x5a63e6=this;return function(_0x4c512b){clearVoiceCallReports(_0x5a63e6[_0xe0b0('0x16')]);if(_0x4c512b){for(var _0x4880d5=0x0;_0x4880d5<_0x4c512b['length'];_0x4880d5+=0x1){_0x5a63e6['outbound']['total']+=0x1;_0x5a63e6[_0xe0b0('0x16')]['sumDuration']+=_0x4c512b[_0x4880d5][_0xe0b0('0x60')];if(_0x4c512b[_0x4880d5][_0xe0b0('0x61')]===_0xe0b0('0x62')){_0x5a63e6[_0xe0b0('0x16')]['answered']+=0x1;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2a')]+=_0x4c512b[_0x4880d5]['duration']-_0x4c512b[_0x4880d5][_0xe0b0('0x63')]||0x0;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2b')]+=_0x4c512b[_0x4880d5][_0xe0b0('0x63')];}}}return _0x5a63e6[_0xe0b0('0x16')];};};Realtime['prototype']['initCampaigns']=function(){var _0x55aef7=this;return function(_0x545694){if(_0x545694){freeIsNotKey(_0x545694,_0x55aef7['campaigns'],_0xe0b0('0x25'));for(var _0x567e1a=0x0,_0x3c09af={};_0x567e1a<_0x545694['length'];_0x567e1a+=0x1){_0x3c09af=_0x545694[_0x567e1a];if(_[_0xe0b0('0x41')](_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]])){_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]]=new Campaign(_0x3c09af);}else{_0x55aef7[_0xe0b0('0x3c')](_0x55aef7['campaigns'][_0x3c09af['name']],_0x3c09af);_0x55aef7['campaigns'][_0x3c09af['name']][_0xe0b0('0x65')]=_0x3c09af[_0xe0b0('0x66')]?_0x3c09af[_0xe0b0('0x66')][_0xe0b0('0x25')]:undefined;}}}return _0x55aef7[_0xe0b0('0x64')];};};Realtime['prototype'][_0xe0b0('0x67')]=function(){var _0x39a07b=this;return function(_0xf77616){if(_0xf77616){freeIsNotKey(_0xf77616,_0x39a07b[_0xe0b0('0x17')],'id');for(var _0x154e6d=0x0,_0x2a5082={};_0x154e6d<_0xf77616[_0xe0b0('0x3e')];_0x154e6d+=0x1){_0x2a5082=_0xf77616[_0x154e6d];if(_[_0xe0b0('0x41')](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']])){_0x39a07b['voiceExtensions'][_0x2a5082['id']]=new VoiceExtension(_0x2a5082);}else{_0x39a07b['mergeFromDatabase'](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']],_0x2a5082);}}}return _0x39a07b[_0xe0b0('0x17')];};};Realtime['prototype'][_0xe0b0('0x68')]=function(){var _0x4593f1=this;return function(_0x44c475){clearCampaigns(_0x4593f1[_0xe0b0('0x64')]);for(var _0x7358ce=0x0;_0x7358ce<_0x44c475[_0xe0b0('0x3e')];_0x7358ce+=0x1){_[_0xe0b0('0x52')](_0x4593f1[_0xe0b0('0x64')][_0x44c475[_0x7358ce]['name']],_0x44c475[_0x7358ce]);}return _0x4593f1['campaigns'];};};Realtime['prototype'][_0xe0b0('0x69')]=function(){var _0x90d471=this;return function(_0x5d2365){if(_0x5d2365){freeIsNotKey(_0x5d2365,_0x90d471[_0xe0b0('0x23')],'id');for(var _0x448694=0x0,_0x396eec={};_0x448694<_0x5d2365[_0xe0b0('0x3e')];_0x448694+=0x1){_0x396eec=_0x5d2365[_0x448694];if(_['isUndefined'](_0x90d471['faxAccounts'][_0x396eec['id']])){_0x90d471['faxAccounts'][_0x396eec['id']]=new FaxAccount(_0x396eec);}else{_0x90d471[_0xe0b0('0x3c')](_0x90d471[_0xe0b0('0x23')][_0x396eec['id']],_0x396eec);}}}return _0x90d471['faxAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x6a')]=function(){var _0x5547ee=this;return function(_0x576482){if(_0x576482){freeIsNotKey(_0x576482,_0x5547ee[_0xe0b0('0x13')],'name');for(var _0x251195=0x0,_0x5f06c0={};_0x251195<_0x576482[_0xe0b0('0x3e')];_0x251195+=0x1){_0x5f06c0=_0x576482[_0x251195];if(_[_0xe0b0('0x41')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]])){_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]]=new VoiceQueue(_0x5f06c0);}else{_0x5547ee[_0xe0b0('0x3c')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]],_0x5f06c0);}}}return _0x5547ee['voiceQueues'];};};module[_0xe0b0('0x6b')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 029861c..39c9adc 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 _0xadd1=['mergeDBDataToRealtime'];(function(_0xc7ab24,_0x12c8af){var _0x19dcd9=function(_0x3c9432){while(--_0x3c9432){_0xc7ab24['push'](_0xc7ab24['shift']());}};_0x19dcd9(++_0x12c8af);}(_0xadd1,0xc4));var _0x1add=function(_0x3a3bcb,_0x37e5af){_0x3a3bcb=_0x3a3bcb-0x0;var _0x383775=_0xadd1[_0x3a3bcb];return _0x383775;};'use strict';function mergeDBDataToRealtime(_0x5f80cb,_0x2087b4){var _0x3e8dc8=Object['assign']({},_0x5f80cb);for(var _0xef4069 in _0x2087b4){if(_0x3e8dc8['hasOwnProperty'](_0xef4069)){_0x3e8dc8[_0xef4069]=_0x2087b4[_0xef4069];}}return _0x3e8dc8;}exports[_0x1add('0x0')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x2901=['assign','mergeDBDataToRealtime'];(function(_0xbc7f5a,_0x3056fe){var _0x4c0f5f=function(_0x15e1ee){while(--_0x15e1ee){_0xbc7f5a['push'](_0xbc7f5a['shift']());}};_0x4c0f5f(++_0x3056fe);}(_0x2901,0x82));var _0x1290=function(_0x5c4e4b,_0x1cae04){_0x5c4e4b=_0x5c4e4b-0x0;var _0x10680f=_0x2901[_0x5c4e4b];return _0x10680f;};'use strict';function mergeDBDataToRealtime(_0x2e1920,_0xf5aeab){var _0x3ceaf0=Object[_0x1290('0x0')]({},_0x2e1920);for(var _0x1b398e in _0xf5aeab){if(_0x3ceaf0['hasOwnProperty'](_0x1b398e)){_0x3ceaf0[_0x1b398e]=_0xf5aeab[_0x1b398e];}}return _0x3ceaf0;}exports[_0x1290('0x1')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 33e4df5..2ea55af 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 _0x9ed4=['agents','telephones','prototype','xdr','voiceQueueReport','custom:voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','connectedlinenum','assigned','lastAssignedTo','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','length','getCallType','split','calleridnum','outbound','internal','voiceCallReport','destination','exten','type','lastapplication','lastdata','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','originatecalleridnum','destinationchannel','channel','calleridpreview','disposition','\x22%s\x22\x20<%s>','linkedid','transfers','transfereelinkedid','UserId','monitor','monitors','createdAt','calleridname','connectedlinename','membername','isArray','startsWith','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','realtime'];(function(_0x2a2794,_0x5540a8){var _0x5741ac=function(_0x5b581c){while(--_0x5b581c){_0x2a2794['push'](_0x2a2794['shift']());}};_0x5741ac(++_0x5540a8);}(_0x9ed4,0x162));var _0x49ed=function(_0x5c9cd1,_0x37ab0b){_0x5c9cd1=_0x5c9cd1-0x0;var _0x1b4d68=_0x9ed4[_0x5c9cd1];return _0x1b4d68;};'use strict';var _=require(_0x49ed('0x0'));var moment=require(_0x49ed('0x1'));var util=require(_0x49ed('0x2'));var config=require(_0x49ed('0x3'));var ami=require(_0x49ed('0x4'));var RpcVoiceAgentReport=require(_0x49ed('0x5'));var RpcVoiceCallReport=require(_0x49ed('0x6'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x49ed('0x7'));var RpcVoiceQueueReport=require(_0x49ed('0x8'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x49ed('0x9'));var VoiceQueueReport=require(_0x49ed('0xa'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x49ed('0xb'));var VoiceDialReport=require(_0x49ed('0xc'));var UserReport=require('./userReport');function Report(_0x27be57){this[_0x49ed('0xd')]=_0x27be57;this['agents']=_0x27be57[_0x49ed('0xe')];this[_0x49ed('0xf')]=_0x27be57['telephones'];}Report[_0x49ed('0x10')]['sync']=function(_0x4ac477){var _0x255c73=new VoiceQueueReport(this[_0x49ed('0xd')]);var _0x1494a8=new VoiceAgentReport(this['realtime']);var _0xa76ad=new VoiceDialReport(this[_0x49ed('0xd')]);var _0x142077=new VoiceCallReport(this[_0x49ed('0xd')]);var _0x32b80a=new UserReport(this[_0x49ed('0xd')]);if(config[_0x49ed('0x11')]&&config[_0x49ed('0x11')]['disabled']){ami['on']('custom:voiceQueueReport',this[_0x49ed('0x12')]['bind'](this));ami['on'](_0x49ed('0x13'),this['voiceCallReport'][_0x49ed('0x14')](this));ami['on'](_0x49ed('0x15'),this[_0x49ed('0x16')]['bind'](this));ami['on'](_0x49ed('0x17'),this[_0x49ed('0x18')]['bind'](this));ami['on'](_0x49ed('0x19'),this[_0x49ed('0x1a')]['bind'](this));ami['on'](_0x49ed('0x1b'),this[_0x49ed('0x1c')][_0x49ed('0x14')](this));}};Report[_0x49ed('0x10')][_0x49ed('0x1d')]=function(_0x5e2f97){var _0x8c18b8;_0x8c18b8=_[_0x49ed('0x1e')](this[_0x49ed('0xe')],function(_0x1d1f90){return _0x1d1f90[_0x49ed('0x1f')]==_0x5e2f97||_0x1d1f90[_0x49ed('0x20')]==_0x5e2f97;});if(_[_0x49ed('0x21')](_0x8c18b8)){var _0x51e87f=_[_0x49ed('0x1e')](this[_0x49ed('0xf')],function(_0x5e33d3){return _0x5e33d3['accountcode']==_0x5e2f97||_0x5e33d3[_0x49ed('0x20')]==_0x5e2f97;});if(_0x51e87f){_0x8c18b8=_[_0x49ed('0x1e')](this[_0x49ed('0xe')],function(_0x498e16){return _0x498e16[_0x49ed('0x22')]==util[_0x49ed('0x23')]('SIP/%s',_0x51e87f['name']);});}}return _0x8c18b8;};Report[_0x49ed('0x10')][_0x49ed('0x12')]=function(_0x381049){for(var _0xa0bf18=0x0;_0xa0bf18<_0x381049['length'];_0xa0bf18+=0x1){var _0x93d7c7=this[_0x49ed('0x1d')](_0x381049[_0xa0bf18][_0x49ed('0x24')]);if(_0x93d7c7){_0x381049[_0xa0bf18][_0x49ed('0x1f')]=_0x93d7c7['accountcode'];_0x381049[_0xa0bf18][_0x49ed('0x25')]=!![];_0x381049[_0xa0bf18][_0x49ed('0x26')]=_0x93d7c7[_0x49ed('0x20')];_0x381049[_0xa0bf18]['interface']=_[_0x49ed('0x21')](_0x93d7c7[_0x49ed('0x22')])?util[_0x49ed('0x23')](_0x49ed('0x27'),_0x93d7c7[_0x49ed('0x20')]):_0x93d7c7['interface'];if(_0x381049[_0xa0bf18][_0x49ed('0x28')]){_0x381049[_0xa0bf18][_0x49ed('0x29')]=moment()['format'](_0x49ed('0x2a'));}if(_0x381049[_0xa0bf18][_0x49ed('0x2b')]){_0x381049[_0xa0bf18][_0x49ed('0x2c')]=moment()[_0x49ed('0x23')](_0x49ed('0x2a'));}RpcMemberReport[_0x49ed('0x12')](_0x381049[_0xa0bf18]);}RpcVoiceQueueReport[_0x49ed('0x2d')](_0x381049[_0xa0bf18]);}};function extractCalleridNumber(_0xefadc6){var _0x49b97c=_0xefadc6[_0x49ed('0x2e')](/<(.*?)>/);return _0x49b97c?_0x49b97c[0x1]:_0xefadc6;}Report[_0x49ed('0x10')][_0x49ed('0x2f')]=function(_0xc78df7){for(var _0x5caa9d=0x0;_0x5caa9d','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','isNil','UserId','membername','monitors','monitorFilename','filename','createdAt','connectedlinename','xcally-motion-dialer','voiceAgentReport','isArray','forEach','startsWith','indexOf','mobile','phone','substring','transfererlinkedid','exports','moment','util','../../../config/environment','../ami','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','realtime'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd343,0x10d));var _0x3d34=function(_0x178bfb,_0x1091f8){_0x178bfb=_0x178bfb-0x0;var _0xc4c29b=_0xd343[_0x178bfb];return _0xc4c29b;};'use strict';var _=require('lodash');var moment=require(_0x3d34('0x0'));var util=require(_0x3d34('0x1'));var config=require(_0x3d34('0x2'));var ami=require(_0x3d34('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x3d34('0x4'));var RpcMemberReport=require(_0x3d34('0x5'));var RpcVoiceQueueReport=require(_0x3d34('0x6'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x3d34('0x7'));var VoiceQueueReport=require(_0x3d34('0x8'));var VoiceCallReport=require(_0x3d34('0x9'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x3d34('0xa'));var UserReport=require(_0x3d34('0xb'));function Report(_0x2c27a6){this[_0x3d34('0xc')]=_0x2c27a6;this[_0x3d34('0xd')]=_0x2c27a6['agents'];this[_0x3d34('0xe')]=_0x2c27a6[_0x3d34('0xe')];}Report[_0x3d34('0xf')][_0x3d34('0x10')]=function(_0x4419f7){var _0x140edd=new VoiceQueueReport(this[_0x3d34('0xc')]);var _0x21d1e6=new VoiceAgentReport(this[_0x3d34('0xc')]);var _0x5086d7=new VoiceDialReport(this['realtime']);var _0x2c5cde=new VoiceCallReport(this[_0x3d34('0xc')]);var _0x3aa7e8=new UserReport(this[_0x3d34('0xc')]);if(config[_0x3d34('0x11')]&&config[_0x3d34('0x11')][_0x3d34('0x12')]){ami['on'](_0x3d34('0x13'),this['voiceQueueReport'][_0x3d34('0x14')](this));ami['on'](_0x3d34('0x15'),this[_0x3d34('0x16')]['bind'](this));ami['on'](_0x3d34('0x17'),this['voiceAgentReport']['bind'](this));ami['on'](_0x3d34('0x18'),this[_0x3d34('0x19')][_0x3d34('0x14')](this));ami['on'](_0x3d34('0x1a'),this[_0x3d34('0x1b')][_0x3d34('0x14')](this));ami['on'](_0x3d34('0x1c'),this[_0x3d34('0x1d')][_0x3d34('0x14')](this));}};Report['prototype'][_0x3d34('0x1e')]=function(_0x5eb4db){var _0x2fac68;_0x2fac68=_['find'](this[_0x3d34('0xd')],function(_0x4d5f7d){return _0x4d5f7d[_0x3d34('0x1f')]==_0x5eb4db||_0x4d5f7d[_0x3d34('0x20')]==_0x5eb4db;});if(_['isNil'](_0x2fac68)){var _0x5c27fe=_[_0x3d34('0x21')](this['telephones'],function(_0xbf65e){return _0xbf65e[_0x3d34('0x1f')]==_0x5eb4db||_0xbf65e[_0x3d34('0x20')]==_0x5eb4db;});if(_0x5c27fe){_0x2fac68=_[_0x3d34('0x21')](this['agents'],function(_0x3ea737){return _0x3ea737[_0x3d34('0x22')]==util[_0x3d34('0x23')](_0x3d34('0x24'),_0x5c27fe[_0x3d34('0x20')]);});}}return _0x2fac68;};Report[_0x3d34('0xf')][_0x3d34('0x25')]=function(_0xa54f78){for(var _0x42e5b3=0x0;_0x42e5b3<_0xa54f78[_0x3d34('0x26')];_0x42e5b3+=0x1){var _0x21c0f9=this[_0x3d34('0x1e')](_0xa54f78[_0x42e5b3][_0x3d34('0x27')]);if(_0x21c0f9){_0xa54f78[_0x42e5b3]['accountcode']=_0x21c0f9[_0x3d34('0x1f')];_0xa54f78[_0x42e5b3][_0x3d34('0x28')]=!![];_0xa54f78[_0x42e5b3][_0x3d34('0x29')]=_0x21c0f9[_0x3d34('0x20')];_0xa54f78[_0x42e5b3][_0x3d34('0x22')]=_['isNil'](_0x21c0f9[_0x3d34('0x22')])?util[_0x3d34('0x23')]('SIP/%s',_0x21c0f9[_0x3d34('0x20')]):_0x21c0f9[_0x3d34('0x22')];if(_0xa54f78[_0x42e5b3][_0x3d34('0x2a')]){_0xa54f78[_0x42e5b3][_0x3d34('0x2b')]=moment()[_0x3d34('0x23')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0xa54f78[_0x42e5b3][_0x3d34('0x2c')]){_0xa54f78[_0x42e5b3][_0x3d34('0x2d')]=moment()['format'](_0x3d34('0x2e'));}RpcMemberReport['voiceQueueReport'](_0xa54f78[_0x42e5b3]);}RpcVoiceQueueReport[_0x3d34('0x2f')](_0xa54f78[_0x42e5b3]);}};function extractCalleridNumber(_0x3168bd){var _0x2aa2f8=_0x3168bd[_0x3d34('0x30')](/<(.*?)>/);return _0x2aa2f8?_0x2aa2f8[0x1]:_0x3168bd;}Report[_0x3d34('0xf')][_0x3d34('0x31')]=function(_0x206d2e){for(var _0x4bcb78=0x0;_0x4bcb78{delete this['channels'][_0x211328];},_0x4f0241);}};module[_0xc7cc('0x9b')]=VoiceAgentReport; \ No newline at end of file +var _0x9522=['[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]\x20event:','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','deleteChannelAfterTimeout','lodash','moment','util','ioredis','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','bind','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','musiconholdstop','attendedtransfer','blindtransfer','syncBlindTransfer','prototype','emit','isUndefined','syncAgentCalled','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','destuniqueid','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','queue','variables','format','called','mandatoryDisposition','type','inbound','voice','assign','omit','event','privilege','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','YYYY-MM-DD\x20HH:mm:ss','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','interface','pick','destconnectedlinenum','accountcode','exten','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','lastevent','reason','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','name','user:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','agentconnectAt','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','transfer','agent','talktime','acw','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','destaccountcode','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','values','custom:voiceAgentReport','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring'];(function(_0x2e51b0,_0x3671c6){var _0xb4d41f=function(_0x2736c5){while(--_0x2736c5){_0x2e51b0['push'](_0x2e51b0['shift']());}};_0xb4d41f(++_0x3671c6);}(_0x9522,0x13a));var _0x2952=function(_0xbf171b,_0x21c916){_0xbf171b=_0xbf171b-0x0;var _0x21ab7e=_0x9522[_0xbf171b];return _0x21ab7e;};'use strict';var _=require(_0x2952('0x0'));var moment=require(_0x2952('0x1'));var util=require(_0x2952('0x2'));var Redis=require(_0x2952('0x3'));var config=require(_0x2952('0x4'));var logger=require('../../../config/logger')(_0x2952('0x5'));var ami=require(_0x2952('0x6'));config[_0x2952('0x7')]=_[_0x2952('0x8')](config['redis'],{'host':_0x2952('0x9'),'port':0x18eb});var io=require(_0x2952('0xa'))(new Redis(config[_0x2952('0x7')]));function VoiceAgentReport(_0xa9cdb5){this[_0x2952('0xb')]={};this['voiceChannels']=_0xa9cdb5[_0x2952('0xb')];this[_0x2952('0xc')]=_0xa9cdb5['voiceQueues'];this[_0x2952('0xd')]=_0xa9cdb5['agents'];this['variables']={};ami['on']('agentcalled',this['syncAgentCalled'][_0x2952('0xe')](this));ami['on']('agentconnect',this['syncAgentConnect'][_0x2952('0xe')](this));ami['on'](_0x2952('0xf'),this[_0x2952('0x10')]['bind'](this));ami['on'](_0x2952('0x11'),this[_0x2952('0x12')][_0x2952('0xe')](this));ami['on'](_0x2952('0x13'),this[_0x2952('0x14')][_0x2952('0xe')](this));ami['on'](_0x2952('0x15'),this[_0x2952('0x16')][_0x2952('0xe')](this));ami['on'](_0x2952('0x17'),this[_0x2952('0x18')][_0x2952('0xe')](this));ami['on'](_0x2952('0x19'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0x2952('0x1a'),this['syncMusicOnHoldStop'][_0x2952('0xe')](this));ami['on'](_0x2952('0x1b'),this['syncAttendedTransfer'][_0x2952('0xe')](this));ami['on'](_0x2952('0x1c'),this[_0x2952('0x1d')][_0x2952('0xe')](this));}VoiceAgentReport[_0x2952('0x1e')]['emit']=function(_0x3b1607,_0x2fc690,_0x5ce379){io['to'](_0x3b1607)[_0x2952('0x1f')](_0x2fc690,_0x5ce379);};VoiceAgentReport[_0x2952('0x1e')]['isNotNull']=function(_0x4c217e){return _0x4c217e!==null&&!_[_0x2952('0x20')](_0x4c217e);};VoiceAgentReport[_0x2952('0x1e')][_0x2952('0x21')]=function(_0x5d9a93){try{if(this[_0x2952('0x22')](_0x5d9a93)){logger[_0x2952('0x23')](_0x2952('0x24'),_0x5d9a93['uniqueid'],_0x5d9a93[_0x2952('0x25')],_0x5d9a93[_0x2952('0x26')]);logger['debug'](_0x2952('0x27'),_0x5d9a93['uniqueid'],util[_0x2952('0x28')](_0x5d9a93,{'showHidden':![],'depth':null}));if(_[_0x2952('0x20')](this[_0x2952('0xb')][_0x5d9a93[_0x2952('0x29')]])){this['channels'][_0x5d9a93[_0x2952('0x29')]]={};}var _0x22f596=this['agents'][_0x5d9a93['interface']];var _0x9163d0=this['channels'][_0x5d9a93[_0x2952('0x29')]][_0x5d9a93[_0x2952('0x26')]];var _0xee7725=this[_0x2952('0xc')][_0x5d9a93[_0x2952('0x2a')]];var _0x4078e0=this[_0x2952('0x2b')][_0x5d9a93['uniqueid']];if(_[_0x2952('0x20')](_0x9163d0)){_0x9163d0={'agentcalledAt':moment()[_0x2952('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x2952('0x2d'),'mandatoryDisposition':_0xee7725&&_0xee7725['mandatoryDisposition']?_0xee7725[_0x2952('0x2e')]:![],'type':_0xee7725&&_0xee7725[_0x2952('0x2f')]?_0xee7725[_0x2952('0x2f')]:_0x2952('0x30'),'variables':_0x4078e0,'motionChannel':_0x2952('0x31')};}Object[_0x2952('0x32')](_0x9163d0,_[_0x2952('0x33')](_0x5d9a93,[_0x2952('0x34'),_0x2952('0x35')]));this['channels'][_0x5d9a93[_0x2952('0x29')]][_0x5d9a93['destuniqueid']]=_0x9163d0;logger[_0x2952('0x36')](_0x2952('0x37'),_0x5d9a93[_0x2952('0x29')],util['inspect'](_0x9163d0,{'showHidden':![],'depth':null}));ami['emit'](_0x2952('0x38'),_0x9163d0);var _0x5e7077={'id':_0x22f596['id'],'calleridnum':_0x9163d0[_0x2952('0x39')],'queue':_0x9163d0[_0x2952('0x2a')],'variables':_0x9163d0[_0x2952('0x2b')],'uniqueid':_0x5d9a93[_0x2952('0x29')]};logger['debug'](_0x2952('0x3a'),_0x5d9a93[_0x2952('0x29')],util[_0x2952('0x28')](_0x5e7077,{'showHidden':![],'depth':null}));this[_0x2952('0x1f')](util[_0x2952('0x2c')](_0x2952('0x3b'),_0x5d9a93[_0x2952('0x25')]),_0x2952('0x3c'),_0x5e7077);}}catch(_0x35bc82){logger[_0x2952('0x3d')](_0x2952('0x3e'),_0x5d9a93[_0x2952('0x29')],util[_0x2952('0x28')](_0x35bc82,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2952('0x1e')][_0x2952('0x3f')]=function(_0x39ffeb){try{if(this[_0x2952('0x22')](_0x39ffeb)){if(this['channels'][_0x39ffeb['uniqueid']]){for(var _0x1cdcc2 in this[_0x2952('0xb')][_0x39ffeb[_0x2952('0x29')]]){if(this['channels'][_0x39ffeb[_0x2952('0x29')]][_0x2952('0x40')](_0x1cdcc2)){if(_0x39ffeb[_0x2952('0x26')]===_0x1cdcc2){logger[_0x2952('0x23')](_0x2952('0x41'),_0x39ffeb[_0x2952('0x29')],_0x39ffeb[_0x2952('0x25')],_0x39ffeb[_0x2952('0x26')]);this[_0x2952('0xb')][_0x39ffeb[_0x2952('0x29')]][_0x1cdcc2]['agentconnectAt']=moment()['format'](_0x2952('0x42'));this['channels'][_0x39ffeb[_0x2952('0x29')]][_0x1cdcc2][_0x2952('0x43')]=_0x39ffeb[_0x2952('0x43')];this['channels'][_0x39ffeb[_0x2952('0x29')]][_0x1cdcc2]['connectedlinenum']=_0x39ffeb[_0x2952('0x44')];this['channels'][_0x39ffeb['uniqueid']][_0x1cdcc2][_0x2952('0x45')]=_0x39ffeb[_0x2952('0x45')];this['channels'][_0x39ffeb[_0x2952('0x29')]][_0x1cdcc2][_0x2952('0x46')]=_0x39ffeb[_0x2952('0x46')];this['channels'][_0x39ffeb[_0x2952('0x29')]][_0x1cdcc2]['holdtime']=_0x39ffeb['holdtime'];this['channels'][_0x39ffeb['uniqueid']][_0x1cdcc2]['lastevent']='connect';_['merge'](this[_0x2952('0xd')][_0x39ffeb[_0x2952('0x47')]],_[_0x2952('0x48')](_0x39ffeb,[_0x2952('0x2a'),_0x2952('0x49')]));var _0x54c3ca=this[_0x2952('0xd')][_0x39ffeb['interface']];var _0x41d606={'id':_0x54c3ca['id'],'name':_0x54c3ca['name'],'agentconnected':!![],'destaccountcode':_0x54c3ca[_0x2952('0x4a')],'destconnectedlinenum':this[_0x2952('0xb')][_0x39ffeb['uniqueid']][_0x39ffeb[_0x2952('0x26')]][_0x2952('0x4b')],'queue':this[_0x2952('0xb')][_0x39ffeb['uniqueid']][_0x39ffeb['destuniqueid']]['queue'],'uniqueid':this[_0x2952('0xb')][_0x39ffeb['uniqueid']][_0x39ffeb[_0x2952('0x26')]][_0x2952('0x29')]};ami['emit']('custom:agentconnect',this['channels'][_0x39ffeb[_0x2952('0x29')]][_0x39ffeb[_0x2952('0x26')]]);this[_0x2952('0x1f')](util[_0x2952('0x2c')](_0x2952('0x3b'),_0x39ffeb['membername']),'user:agentconnect',_0x41d606);}else if(!this['channels'][_0x39ffeb[_0x2952('0x29')]][_0x1cdcc2]['agentringnoanswer']&&!this['channels'][_0x39ffeb[_0x2952('0x29')]][_0x1cdcc2]['agentcomplete']){logger[_0x2952('0x23')](_0x2952('0x4c'),_0x39ffeb[_0x2952('0x29')],this[_0x2952('0xb')][_0x39ffeb['uniqueid']][_0x1cdcc2]['membername'],_0x1cdcc2);this[_0x2952('0xb')][_0x39ffeb[_0x2952('0x29')]][_0x1cdcc2][_0x2952('0xf')]=!![];this[_0x2952('0xb')][_0x39ffeb['uniqueid']][_0x1cdcc2][_0x2952('0x4d')]=moment()[_0x2952('0x2c')](_0x2952('0x42'));this['channels'][_0x39ffeb[_0x2952('0x29')]][_0x1cdcc2]['answeredelsewheredestinationuniqueid']=_0x39ffeb['destuniqueid'];this[_0x2952('0xb')][_0x39ffeb[_0x2952('0x29')]][_0x1cdcc2]['answeredelsewheremembername']=_0x39ffeb[_0x2952('0x25')];this[_0x2952('0xb')][_0x39ffeb[_0x2952('0x29')]][_0x1cdcc2][_0x2952('0x4e')]='answered_elsewhere';this[_0x2952('0xb')][_0x39ffeb[_0x2952('0x29')]][_0x1cdcc2][_0x2952('0x4f')]=_0x2952('0x50');logger[_0x2952('0x36')](_0x2952('0x51'),_0x39ffeb[_0x2952('0x29')],util[_0x2952('0x28')](this[_0x2952('0xb')][_0x39ffeb[_0x2952('0x29')]][_0x1cdcc2],{'showHidden':![],'depth':null}));ami[_0x2952('0x1f')](_0x2952('0x52'),this[_0x2952('0xb')][_0x39ffeb['uniqueid']][_0x1cdcc2]);}else{logger[_0x2952('0x36')](_0x2952('0x53'),_0x39ffeb['uniqueid']);}}}}}}catch(_0x33b343){logger[_0x2952('0x3d')](_0x2952('0x54'),_0x39ffeb[_0x2952('0x29')],util[_0x2952('0x28')](_0x33b343,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2952('0x1e')][_0x2952('0x10')]=function(_0xdf13e6){try{if(this['isNotNull'](_0xdf13e6)){logger[_0x2952('0x36')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0xdf13e6[_0x2952('0x29')],util[_0x2952('0x28')](_0xdf13e6,{'showHidden':![],'depth':null}));if(this[_0x2952('0xb')][_0xdf13e6['uniqueid']]&&this['channels'][_0xdf13e6[_0x2952('0x29')]][_0xdf13e6[_0x2952('0x26')]]){logger[_0x2952('0x23')](_0x2952('0x55'),_0xdf13e6[_0x2952('0x29')],_0xdf13e6[_0x2952('0x25')],_0xdf13e6[_0x2952('0x26')]);var _0x14c8b5=this['agents'][_0xdf13e6[_0x2952('0x47')]];var _0x5a7544=this['channels'][_0xdf13e6['uniqueid']][_0xdf13e6[_0x2952('0x26')]];_0x5a7544['agentringnoanswer']=!![];_0x5a7544[_0x2952('0x4d')]=moment()[_0x2952('0x2c')](_0x2952('0x42'));_0x5a7544['lastevent']=_0x2952('0x56');_0x5a7544[_0x2952('0x4f')]=_0x2952('0x56');var _0x402cd4={'id':_0x14c8b5['id'],'name':_0x14c8b5[_0x2952('0x57')],'queue':_0x5a7544[_0x2952('0x2a')],'uniqueid':_0x5a7544['uniqueid']};logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0xdf13e6['uniqueid'],util['inspect'](_0x402cd4,{'showHidden':![],'depth':null}));this[_0x2952('0x1f')](util[_0x2952('0x2c')](_0x2952('0x3b'),_0x14c8b5[_0x2952('0x57')]),_0x2952('0x58'),_0x402cd4);ami[_0x2952('0x1f')]('custom:agentringnoanswer',_0x5a7544);this['channels'][_0xdf13e6[_0x2952('0x29')]][_0xdf13e6[_0x2952('0x26')]]=Object[_0x2952('0x32')]({},_0x5a7544);}}}catch(_0x36ea4b){logger[_0x2952('0x3d')](_0x2952('0x59'),_0xdf13e6[_0x2952('0x29')],util['inspect'](_0x36ea4b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2952('0x1e')][_0x2952('0x12')]=function(_0x1b346c){try{if(this[_0x2952('0x22')](_0x1b346c)){logger[_0x2952('0x36')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x1b346c['uniqueid'],util[_0x2952('0x28')](_0x1b346c,{'showHidden':![],'depth':null}));if(this[_0x2952('0xb')][_0x1b346c[_0x2952('0x29')]]){for(var _0x3feb61 in this[_0x2952('0xb')][_0x1b346c[_0x2952('0x29')]]){if(this[_0x2952('0xb')][_0x1b346c['uniqueid']][_0x2952('0x40')](_0x3feb61)&&!this['channels'][_0x1b346c[_0x2952('0x29')]][_0x3feb61][_0x2952('0xf')]&&!this[_0x2952('0xb')][_0x1b346c[_0x2952('0x29')]][_0x3feb61][_0x2952('0x13')]){logger[_0x2952('0x23')](_0x2952('0x5a'),_0x1b346c[_0x2952('0x29')],this[_0x2952('0xb')][_0x1b346c[_0x2952('0x29')]][_0x3feb61][_0x2952('0x25')],_0x3feb61);this['channels'][_0x1b346c['uniqueid']][_0x3feb61]['agentringnoanswer']=!![];this['channels'][_0x1b346c[_0x2952('0x29')]][_0x3feb61]['agentringnoanswerAt']=moment()['format'](_0x2952('0x42'));this['channels'][_0x1b346c['uniqueid']][_0x3feb61]['lastevent']='abandoned';this[_0x2952('0xb')][_0x1b346c[_0x2952('0x29')]][_0x3feb61][_0x2952('0x4f')]=_0x2952('0x5b');logger[_0x2952('0x36')](_0x2952('0x5c'),_0x1b346c[_0x2952('0x29')],util['inspect'](this[_0x2952('0xb')][_0x1b346c[_0x2952('0x29')]][_0x3feb61],{'showHidden':![],'depth':null}));ami[_0x2952('0x1f')](_0x2952('0x5d'),this[_0x2952('0xb')][_0x1b346c[_0x2952('0x29')]][_0x3feb61]);}}}}}catch(_0x1870a4){logger['error'](_0x2952('0x5e'),_0x1b346c[_0x2952('0x29')],util[_0x2952('0x28')](_0x1870a4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2952('0x1e')][_0x2952('0x14')]=function(_0x43df93){try{if(this[_0x2952('0x22')](_0x43df93)){logger[_0x2952('0x36')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x43df93[_0x2952('0x29')],util['inspect'](_0x43df93,{'showHidden':![],'depth':null}));if(this['channels'][_0x43df93[_0x2952('0x29')]]){for(var _0x5102f6 in this['channels'][_0x43df93[_0x2952('0x29')]]){if(this[_0x2952('0xb')][_0x43df93[_0x2952('0x29')]][_0x2952('0x40')](_0x5102f6)){if(this['channels'][_0x43df93['uniqueid']][_0x5102f6][_0x2952('0x5f')]&&!this[_0x2952('0xb')][_0x43df93[_0x2952('0x29')]][_0x5102f6][_0x2952('0x13')]){logger[_0x2952('0x23')](_0x2952('0x60'),_0x43df93['uniqueid'],this[_0x2952('0xb')][_0x43df93[_0x2952('0x29')]][_0x5102f6][_0x2952('0x25')],_0x5102f6);this[_0x2952('0xb')][_0x43df93['uniqueid']][_0x5102f6][_0x2952('0x13')]=!![];this[_0x2952('0xb')][_0x43df93[_0x2952('0x29')]][_0x5102f6]['agentcompleteAt']=moment()[_0x2952('0x2c')](_0x2952('0x42'));this['channels'][_0x43df93[_0x2952('0x29')]][_0x5102f6][_0x2952('0x4e')]=_0x2952('0x61');this[_0x2952('0xb')][_0x43df93[_0x2952('0x29')]][_0x5102f6]['reason']=_0x43df93[_0x2952('0x4f')]==_0x2952('0x62')?_0x2952('0x63'):_0x43df93[_0x2952('0x4f')];this[_0x2952('0xb')][_0x43df93[_0x2952('0x29')]][_0x5102f6][_0x2952('0x64')]=_0x43df93[_0x2952('0x64')];if(this['voiceQueues'][_0x43df93[_0x2952('0x2a')]]&&this['voiceQueues'][_0x43df93['queue']][_0x2952('0x65')]){this[_0x2952('0xb')][_0x43df93[_0x2952('0x29')]][_0x5102f6]['acwtime']=this[_0x2952('0xc')][_0x43df93['queue']]['acwTimeout'];this['channels'][_0x43df93[_0x2952('0x29')]][_0x5102f6][_0x2952('0x66')]=!![];}this['agents'][_0x43df93[_0x2952('0x47')]]=_['omit'](this[_0x2952('0xd')][_0x43df93['interface']],[_0x2952('0x2a'),_0x2952('0x49')]);logger['debug'](_0x2952('0x67'),_0x43df93['uniqueid'],util['inspect'](this['channels'][_0x43df93['uniqueid']][_0x5102f6],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcomplete',this[_0x2952('0xb')][_0x43df93[_0x2952('0x29')]][_0x5102f6]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x43df93[_0x2952('0x29')],util[_0x2952('0x28')]({'id':this[_0x2952('0xd')][_0x43df93[_0x2952('0x47')]]['id'],'destaccountcode':_0x43df93[_0x2952('0x68')]},{'showHidden':![],'depth':null}));this[_0x2952('0x1f')](util[_0x2952('0x2c')](_0x2952('0x3b'),_0x43df93[_0x2952('0x25')]),'user:agentcomplete',{'id':this[_0x2952('0xd')][_0x43df93[_0x2952('0x47')]]['id'],'destaccountcode':Number(_0x43df93[_0x2952('0x68')])});}}}}}}catch(_0x13f39f){logger[_0x2952('0x3d')]('[%s][voiceAgentReport][agentcomplete]',_0x43df93[_0x2952('0x29')],util['inspect'](_0x13f39f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2952('0x1e')][_0x2952('0x16')]=function(_0x45c01d){try{if(this[_0x2952('0x22')](_0x45c01d)){logger['debug'](_0x2952('0x69'),_0x45c01d[_0x2952('0x29')],util['inspect'](_0x45c01d,{'showHidden':![],'depth':null}));this[_0x2952('0x6a')](_0x45c01d[_0x2952('0x29')],_[_0x2952('0x6b')](_0x45c01d[_0x2952('0x6c')])[0x0],_0x45c01d['value']);if(this['channels'][_0x45c01d[_0x2952('0x29')]]){for(var _0x5e8352 in this['channels'][_0x45c01d[_0x2952('0x29')]]){if(this[_0x2952('0xb')][_0x45c01d[_0x2952('0x29')]][_0x2952('0x40')](_0x5e8352)){logger[_0x2952('0x23')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x45c01d[_0x2952('0x29')],_0x5e8352,_[_0x2952('0x6b')](_0x45c01d[_0x2952('0x6c')])[0x0],_0x45c01d[_0x2952('0x6d')]);if(_[_0x2952('0x20')](this[_0x2952('0xb')][_0x45c01d[_0x2952('0x29')]][_0x5e8352][_0x2952('0x2b')])){this[_0x2952('0xb')][_0x45c01d[_0x2952('0x29')]][_0x5e8352][_0x2952('0x2b')]={};}this[_0x2952('0xb')][_0x45c01d[_0x2952('0x29')]][_0x5e8352][_0x2952('0x2b')]=this[_0x2952('0x2b')][_0x45c01d[_0x2952('0x29')]];}}}}}catch(_0x297d56){logger[_0x2952('0x3d')](_0x2952('0x6e'),_0x45c01d[_0x2952('0x29')],util[_0x2952('0x28')](_0x297d56,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2952('0x1e')][_0x2952('0x6a')]=function(_0x8c76ff,_0x19929a,_0x31c8b8){var _0xe79875=['rtpaudioqos',_0x2952('0x6f'),'rtpaudioqosjitter',_0x2952('0x70'),_0x2952('0x71'),'rtpaudioqoslossbridged',_0x2952('0x72'),_0x2952('0x73'),'sipcallid',_0x2952('0x74'),_0x2952('0x75'),_0x2952('0x76'),_0x2952('0x77'),_0x2952('0x78'),'memberinterface',_0x2952('0x79'),_0x2952('0x25'),_0x2952('0x7a'),_0x2952('0x7b')];if(!_[_0x2952('0x7c')](_0x19929a)&&!_['includes'](_0xe79875,_0x19929a)){if(_[_0x2952('0x20')](this['variables'][_0x8c76ff])){this[_0x2952('0x2b')][_0x8c76ff]={};}this['variables'][_0x8c76ff][_0x19929a]=_0x31c8b8;}};VoiceAgentReport[_0x2952('0x1e')][_0x2952('0x18')]=function(_0x31e564){try{if(this[_0x2952('0x22')](_0x31e564)){logger['debug'](_0x2952('0x7d'),_0x31e564['uniqueid'],util[_0x2952('0x28')](_0x31e564,{'showHidden':![],'depth':null}));if(this['channels'][_0x31e564[_0x2952('0x29')]]){for(var _0x336635 in this['channels'][_0x31e564[_0x2952('0x29')]]){if(this['channels'][_0x31e564[_0x2952('0x29')]]['hasOwnProperty'](_0x336635)){if(this[_0x2952('0xb')][_0x31e564[_0x2952('0x29')]][_0x336635][_0x2952('0x4f')]==_0x2952('0x62')&&this[_0x2952('0xb')][_0x31e564[_0x2952('0x29')]][_0x336635][_0x2952('0x13')]){logger['info'](_0x2952('0x7e'),_0x31e564['uniqueid'],_0x336635);this[_0x2952('0xb')][_0x31e564[_0x2952('0x29')]][_0x336635]['agentcompleteAt']=moment()['format'](_0x2952('0x42'));}}}logger[_0x2952('0x36')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x31e564[_0x2952('0x29')],util[_0x2952('0x28')](_[_0x2952('0x7f')](this[_0x2952('0xb')][_0x31e564[_0x2952('0x29')]]),{'showHidden':![],'depth':null}));ami[_0x2952('0x1f')](_0x2952('0x80'),_[_0x2952('0x7f')](this[_0x2952('0xb')][_0x31e564['uniqueid']]));this['deleteChannelAfterTimeout'](_0x31e564['uniqueid']);}if(this[_0x2952('0x2b')][_0x31e564['uniqueid']]){delete this[_0x2952('0x2b')][_0x31e564[_0x2952('0x29')]];}}}catch(_0x3fb1f9){logger[_0x2952('0x3d')]('[%s][voiceAgentReport][hangup]',_0x31e564[_0x2952('0x29')],util[_0x2952('0x28')](_0x3fb1f9,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x2952('0x81')]=function(_0x40d02c){try{if(this[_0x2952('0x22')](_0x40d02c)){logger[_0x2952('0x36')](_0x2952('0x82'),_0x40d02c['uniqueid'],util['inspect'](_0x40d02c,{'showHidden':![],'depth':null}));if(this[_0x2952('0xb')][_0x40d02c['transfereeuniqueid']]){for(var _0x318002 in this[_0x2952('0xb')][_0x40d02c[_0x2952('0x83')]]){if(this[_0x2952('0xb')][_0x40d02c[_0x2952('0x83')]][_0x2952('0x40')](_0x318002)){if(_0x40d02c[_0x2952('0x84')]===_0x318002){logger['info'](_0x2952('0x85'),_0x40d02c['uniqueid'],this[_0x2952('0xb')][_0x40d02c[_0x2952('0x83')]][_0x318002][_0x2952('0x25')],_0x318002);var _0x33fb55=moment();this[_0x2952('0xb')][_0x40d02c[_0x2952('0x83')]][_0x318002]['agentcomplete']=!![];this[_0x2952('0xb')][_0x40d02c['transfereeuniqueid']][_0x318002][_0x2952('0x86')]=moment()['format'](_0x2952('0x42'));this[_0x2952('0xb')][_0x40d02c[_0x2952('0x83')]][_0x318002][_0x2952('0x4e')]=_0x2952('0x61');this[_0x2952('0xb')][_0x40d02c['transfereeuniqueid']][_0x318002]['reason']='transfer';this['channels'][_0x40d02c[_0x2952('0x83')]][_0x318002][_0x2952('0x64')]=_0x33fb55[_0x2952('0x87')](this[_0x2952('0xb')][_0x40d02c[_0x2952('0x83')]][_0x318002][_0x2952('0x5f')],_0x2952('0x88'));}}}}if(this[_0x2952('0xb')][_0x40d02c[_0x2952('0x89')]]){var _0x18c59e=this[_0x2952('0xb')][_0x40d02c[_0x2952('0x89')]];this[_0x2952('0xb')][_0x40d02c['secondtransfereruniqueid']]=this['channels'][_0x40d02c[_0x2952('0x83')]];this['channels'][_0x40d02c['transfereeuniqueid']]=_0x18c59e;}}}catch(_0xeb106a){logger['error']('[%s][voiceAgentReport][attendedtransfer]',_0x40d02c[_0x2952('0x29')],util['inspect'](_0xeb106a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2952('0x1e')][_0x2952('0x1d')]=function(_0x38a038){try{if(this[_0x2952('0x22')](_0x38a038)){logger[_0x2952('0x36')](_0x2952('0x8a'),_0x38a038[_0x2952('0x29')],util[_0x2952('0x28')](_0x38a038,{'showHidden':![],'depth':null}));if(this[_0x2952('0xb')][_0x38a038[_0x2952('0x83')]]){for(var _0x60172d in this[_0x2952('0xb')][_0x38a038[_0x2952('0x83')]]){if(this['channels'][_0x38a038[_0x2952('0x83')]][_0x2952('0x40')](_0x60172d)){if(_0x38a038[_0x2952('0x8b')]===_0x60172d){logger['info']('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x38a038['uniqueid'],this[_0x2952('0xb')][_0x38a038[_0x2952('0x83')]][_0x60172d][_0x2952('0x25')],_0x60172d);var _0x324a85=moment();this['channels'][_0x38a038['transfereeuniqueid']][_0x60172d][_0x2952('0x13')]=!![];this[_0x2952('0xb')][_0x38a038[_0x2952('0x83')]][_0x60172d][_0x2952('0x86')]=_0x324a85;this[_0x2952('0xb')][_0x38a038[_0x2952('0x83')]][_0x60172d]['lastevent']=_0x2952('0x61');this['channels'][_0x38a038[_0x2952('0x83')]][_0x60172d][_0x2952('0x4f')]=_0x2952('0x62');this[_0x2952('0xb')][_0x38a038[_0x2952('0x83')]][_0x60172d][_0x2952('0x64')]=_0x324a85['diff'](this[_0x2952('0xb')][_0x38a038[_0x2952('0x83')]][_0x60172d][_0x2952('0x5f')],_0x2952('0x88'));}}}}}}catch(_0x2513f5){logger[_0x2952('0x3d')](_0x2952('0x8c'),_0x38a038[_0x2952('0x29')],util['inspect'](_0x2513f5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2952('0x1e')][_0x2952('0x8d')]=function(_0x2f3323){var _0x53c914='';try{if(this[_0x2952('0x22')](_0x2f3323)){logger[_0x2952('0x36')](_0x2952('0x8e'),_0x2f3323[_0x2952('0x29')],util[_0x2952('0x28')](_0x2f3323,{'showHidden':![],'depth':null}));if(_0x2f3323[_0x2952('0x8f')]){_0x53c914=_0x2f3323[_0x2952('0x8f')][_0x2952('0x90')](0x0,_0x2f3323[_0x2952('0x8f')]['lastIndexOf']('-'));if(this[_0x2952('0xd')][_0x53c914]){logger['info'](_0x2952('0x91'),_0x2f3323[_0x2952('0x29')],_0x53c914);this[_0x2952('0xd')][_0x53c914][_0x2952('0x92')]=!![];}}}}catch(_0x2ca976){logger[_0x2952('0x3d')](_0x2952('0x93'),_0x2f3323[_0x2952('0x29')],util[_0x2952('0x28')](_0x2ca976,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x2952('0x94')]=function(_0x5a8edc){var _0x5c1862='';try{if(this['isNotNull'](_0x5a8edc)){logger[_0x2952('0x36')](_0x2952('0x95'),_0x5a8edc[_0x2952('0x29')],util[_0x2952('0x28')](_0x5a8edc,{'showHidden':![],'depth':null}));if(_0x5a8edc[_0x2952('0x8f')]){_0x5c1862=_0x5a8edc[_0x2952('0x8f')][_0x2952('0x90')](0x0,_0x5a8edc[_0x2952('0x8f')][_0x2952('0x96')]('-'));if(this['agents'][_0x5c1862]){logger['info'](_0x2952('0x97'),_0x5a8edc['uniqueid'],_0x5c1862);this['agents'][_0x5c1862][_0x2952('0x92')]=![];}}}}catch(_0x1516d7){logger['error']('[%s][voiceAgentReport][musiconholdstop]',_0x5a8edc[_0x2952('0x29')],util[_0x2952('0x28')](_0x1516d7,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x2952('0x98')]=function(_0x31d94a,_0x56e980=0x2710){if(this[_0x2952('0xb')][_0x31d94a]){setTimeout(()=>{delete this['channels'][_0x31d94a];},_0x56e980);}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index fbc08f5..739bdc0 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x256e=['newchannel','syncNewChannel','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','isNotNull','isUndefined','prototype','emit','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','keys','context','from-sip','split','exten','connectedlinenum','format','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','pick','channel','undefined','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','appdata','applicationdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','merge','includes','lastapplication','lastdata','startsWith','match','type','[%s][voiceCallReport][newstate]\x20event:','channelstate','answered','answertime','holdtime','diff','connectedlinename','membername','destinationchannel','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','syncMixMonitorFilename','monitor','endsWith','.wav49','.WAV','monitorFilename','monitors','isNil','push','rec','[%s][voiceCallReport][varset]\x20event:','variable','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','xmd-cdrtype','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','mixmonitor_filename','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','resolve','then','getSettings','stopRecordingOnTransfer','Action','catch','finally','webbar:stopmonitors','BlindTransfer','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','syncAttendedTransfer','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transfertargetcalleridnum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','origtransfererlinkedid','some','outbound','transferToInternal','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]','mohtime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','exports','util','path','ioredis','../../../config/environment','ami','set','queue','agi','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','channels','agents','blindTransfers','coreshowchannel','bind','newexten','syncNewExten'];(function(_0x8b97b4,_0x382038){var _0x2ed10e=function(_0x21842e){while(--_0x21842e){_0x8b97b4['push'](_0x8b97b4['shift']());}};_0x2ed10e(++_0x382038);}(_0x256e,0xa7));var _0xe256=function(_0x17976a,_0x3171aa){_0x17976a=_0x17976a-0x0;var _0x19325b=_0x256e[_0x17976a];return _0x19325b;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xe256('0x0'));var path=require(_0xe256('0x1'));var Redis=require(_0xe256('0x2'));var config=require(_0xe256('0x3'));var logger=require('../../../config/logger')(_0xe256('0x4'));var ami=require('../ami');var Channel=require('../model/channel');var RpcSetting=require('../rpc/setting');var applications=[_0xe256('0x5'),_0xe256('0x6'),_0xe256('0x7'),'dial',_0xe256('0x8'),_0xe256('0x9')];var dispositions=[_0xe256('0xa'),_0xe256('0xb'),'FAILED',_0xe256('0xa'),_0xe256('0xa'),_0xe256('0xa'),_0xe256('0xc'),_0xe256('0xd'),_0xe256('0xb'),_0xe256('0xb'),_0xe256('0xb')];config[_0xe256('0xe')]=_[_0xe256('0xf')](config[_0xe256('0xe')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceCallReport(_0xaaf609){this[_0xe256('0x10')]=_0xaaf609[_0xe256('0x10')];this[_0xe256('0x11')]=_0xaaf609['agents'];this[_0xe256('0x12')]={};ami['on'](_0xe256('0x13'),this['syncNewExten'][_0xe256('0x14')](this));ami['on'](_0xe256('0x15'),this[_0xe256('0x16')][_0xe256('0x14')](this));ami['on'](_0xe256('0x17'),this[_0xe256('0x18')]['bind'](this));ami['on']('newstate',this[_0xe256('0x19')][_0xe256('0x14')](this));ami['on'](_0xe256('0x1a'),this[_0xe256('0x1b')][_0xe256('0x14')](this));ami['on'](_0xe256('0x1c'),this[_0xe256('0x1d')][_0xe256('0x14')](this));ami['on'](_0xe256('0x1e'),this[_0xe256('0x1f')][_0xe256('0x14')](this));ami['on'](_0xe256('0x20'),this['syncAttendedTransfer'][_0xe256('0x14')](this));ami['on'](_0xe256('0x21'),this[_0xe256('0x22')][_0xe256('0x14')](this));ami['on'](_0xe256('0x23'),this[_0xe256('0x24')]['bind'](this));ami['on']('musiconholdstop',this[_0xe256('0x25')][_0xe256('0x14')](this));try{logger[_0xe256('0x26')](_0xe256('0x27'));ami[_0xe256('0x28')]();}catch(_0x176ef1){logger[_0xe256('0x29')](_0xe256('0x2a'),util[_0xe256('0x2b')](_0x176ef1,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0xe256('0x2c')]=function(_0x2b2853){return _0x2b2853!==null&&!_[_0xe256('0x2d')](_0x2b2853);};VoiceCallReport[_0xe256('0x2e')][_0xe256('0x2f')]=function(_0x343d72,_0x59a46b,_0x2921b7){io['to'](_0x343d72)[_0xe256('0x2f')](_0x59a46b,_0x2921b7);};VoiceCallReport['prototype'][_0xe256('0x1f')]=function(_0x1dcef3){try{if(this['isNotNull'](_0x1dcef3)){logger['info']('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x1dcef3[_0xe256('0x30')],_0x1dcef3[_0xe256('0x31')],_0x1dcef3[_0xe256('0x32')]);logger[_0xe256('0x33')](_0xe256('0x34'),_0x1dcef3[_0xe256('0x30')],util[_0xe256('0x2b')](_0x1dcef3,{'showHidden':![],'depth':null}));if(_0x1dcef3[_0xe256('0x30')]===_0x1dcef3[_0xe256('0x35')]){if(!_['isUndefined'](this[_0xe256('0x10')][_0x1dcef3[_0xe256('0x30')]])){_['merge'](this[_0xe256('0x10')][_0x1dcef3[_0xe256('0x30')]],_['pick'](_0x1dcef3,_[_0xe256('0x36')](this['channels'][_0x1dcef3[_0xe256('0x30')]])));}}if(_0x1dcef3[_0xe256('0x37')]===_0xe256('0x38')){var _0x133cf5=this[_0xe256('0x11')][_0x1dcef3['channel'][_0xe256('0x39')]('-')[0x0]];if(_0x133cf5){if(_0x1dcef3[_0xe256('0x3a')]=='xcally-motion-preview'){_0x133cf5['destconnectedlinenum']=_0x1dcef3[_0xe256('0x3b')];this[_0xe256('0x2f')](util[_0xe256('0x3c')](_0xe256('0x3d'),_0x133cf5[_0xe256('0x3e')]),_0xe256('0x3f'),{'id':_0x133cf5['id'],'destaccountcode':_0x133cf5[_0xe256('0x40')],'destconnectedlinenum':_0x1dcef3['connectedlinenum']});}}}}}catch(_0x46e29e){logger[_0xe256('0x29')](_0xe256('0x41'),_0x1dcef3[_0xe256('0x30')],util[_0xe256('0x2b')](_0x46e29e,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewChannel']=function(_0x36a5b0){try{if(this[_0xe256('0x2c')](_0x36a5b0)){logger['debug'](_0xe256('0x42'),_0x36a5b0[_0xe256('0x30')],util[_0xe256('0x2b')](_0x36a5b0,{'showHidden':![],'depth':null}));if(this[_0xe256('0x10')][_0x36a5b0[_0xe256('0x30')]]){return;}if(_0x36a5b0['channel']===_0xe256('0x43')){return;}if(_0x36a5b0[_0xe256('0x30')]!==_0x36a5b0[_0xe256('0x35')]&&!this[_0xe256('0x12')][_0x36a5b0[_0xe256('0x35')]]){return;}logger[_0xe256('0x26')](_0xe256('0x44'),_0x36a5b0['uniqueid'],_0x36a5b0['context'],_0x36a5b0[_0xe256('0x3a')]);this['channels'][_0x36a5b0[_0xe256('0x30')]]=new Channel();this[_0xe256('0x10')][_0x36a5b0[_0xe256('0x30')]][_0xe256('0x45')]=moment()['format'](_0xe256('0x46'));this[_0xe256('0x10')][_0x36a5b0['uniqueid']][_0xe256('0x47')]=dispositions[_[_0xe256('0x48')](_0x36a5b0['channelstate'])];_['merge'](this[_0xe256('0x10')][_0x36a5b0[_0xe256('0x30')]],_[_0xe256('0x49')](_0x36a5b0,_[_0xe256('0x36')](this[_0xe256('0x10')][_0x36a5b0['uniqueid']])));if(_0x36a5b0['context']===_0xe256('0x38')){var _0x5c521f=this['agents'][_0x36a5b0[_0xe256('0x4a')][_0xe256('0x39')]('-')[0x0]];if(_0x5c521f&&typeof _0x5c521f['destconnectedlinenum']===_0xe256('0x4b')){_0x5c521f[_0xe256('0x4c')]=_0x36a5b0['exten'];logger[_0xe256('0x33')](_0xe256('0x4d'),_0x36a5b0[_0xe256('0x30')],util[_0xe256('0x2b')]({'id':_0x5c521f['id'],'destaccountcode':_0x5c521f[_0xe256('0x40')],'destconnectedlinenum':_0x36a5b0[_0xe256('0x3a')]},{'showHidden':![],'depth':null}));this[_0xe256('0x2f')](util[_0xe256('0x3c')](_0xe256('0x3d'),_0x5c521f[_0xe256('0x3e')]),_0xe256('0x3f'),{'id':_0x5c521f['id'],'destaccountcode':_0x5c521f[_0xe256('0x40')],'destconnectedlinenum':_0x36a5b0[_0xe256('0x3a')]});}}}}catch(_0x289935){logger['error'](_0xe256('0x4e'),_0x36a5b0[_0xe256('0x30')],util['inspect'](_0x289935,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xe256('0x16')]=function(_0xe5fb9f){try{if(this[_0xe256('0x2c')](_0xe5fb9f)){logger['debug'](_0xe256('0x4f'),_0xe5fb9f[_0xe256('0x30')],util[_0xe256('0x2b')](_0xe5fb9f,{'showHidden':![],'depth':null}));if(_0xe5fb9f[_0xe256('0x4a')]===_0xe256('0x43')||_0xe5fb9f[_0xe256('0x3a')]==='h')return;if(_0xe5fb9f[_0xe256('0x30')]===_0xe5fb9f[_0xe256('0x35')]||this['blindTransfers'][_0xe5fb9f[_0xe256('0x35')]]){_0xe5fb9f[_0xe256('0x50')]=_0xe5fb9f['application']?_0xe5fb9f[_0xe256('0x50')][_0xe256('0x51')]():undefined;_0xe5fb9f['applicationdata']=_0xe5fb9f[_0xe256('0x52')]||_0xe5fb9f[_0xe256('0x53')];if(_0xe5fb9f[_0xe256('0x52')]&&_0xe5fb9f['application']!==_0xe256('0x6')){_0xe5fb9f[_0xe256('0x53')]=_0xe5fb9f[_0xe256('0x53')][_0xe256('0x51')]();}logger[_0xe256('0x26')](_0xe256('0x54'),_0xe5fb9f[_0xe256('0x30')],_0xe5fb9f['application'],_0xe5fb9f[_0xe256('0x53')]);if(_[_0xe256('0x2d')](this[_0xe256('0x10')][_0xe5fb9f[_0xe256('0x30')]])){this[_0xe256('0x10')][_0xe5fb9f[_0xe256('0x30')]]=new Channel();this[_0xe256('0x10')][_0xe5fb9f[_0xe256('0x30')]][_0xe256('0x45')]=_0xe5fb9f[_0xe256('0x55')]?moment()[_0xe256('0x56')](moment[_0xe256('0x55')](_0xe5fb9f[_0xe256('0x55')])[_0xe256('0x57')](),_0xe256('0x57'))[_0xe256('0x3c')](_0xe256('0x46')):moment()[_0xe256('0x3c')](_0xe256('0x46'));this[_0xe256('0x10')][_0xe5fb9f['uniqueid']]['disposition']=_0xe256('0xa');}_[_0xe256('0x58')](this[_0xe256('0x10')][_0xe5fb9f[_0xe256('0x30')]],_[_0xe256('0x49')](_0xe5fb9f,_[_0xe256('0x36')](this[_0xe256('0x10')][_0xe5fb9f[_0xe256('0x30')]])));if(_[_0xe256('0x59')](applications,_0xe5fb9f[_0xe256('0x50')])){this[_0xe256('0x10')][_0xe5fb9f[_0xe256('0x30')]][_0xe256('0x5a')]=_0xe5fb9f[_0xe256('0x50')];this['channels'][_0xe5fb9f[_0xe256('0x30')]][_0xe256('0x5b')]=_0xe5fb9f[_0xe256('0x53')];if(_0xe5fb9f[_0xe256('0x50')]===_0xe256('0x5')&&_[_0xe256('0x5c')](_0xe5fb9f[_0xe256('0x53')][_0xe256('0x51')](),'cdr(')){var _0x3ca65e=_0xe5fb9f['applicationdata'][_0xe256('0x39')]('=');var _0x26094b=_0x3ca65e[0x0][_0xe256('0x51')]()[_0xe256('0x5d')](/cdr\((.*)\)/);if(_0x26094b){if(_0x26094b[0x1]===_0xe256('0x5e')&&!_['isNil'](this[_0xe256('0x10')][_0xe5fb9f[_0xe256('0x30')]][_0x26094b[0x1]]))return;this[_0xe256('0x10')][_0xe5fb9f['uniqueid']][_0x26094b[0x1]]=_0x3ca65e[0x1];}}else if(_0xe5fb9f[_0xe256('0x50')]===_0xe256('0x6')){this['channels'][_0xe5fb9f[_0xe256('0x30')]][_0xe256('0x6')]=_0xe5fb9f[_0xe256('0x53')][_0xe256('0x39')](',')[0x0];}}}}}catch(_0xd4fe8e){logger[_0xe256('0x29')]('[%s][voiceCallReport][newexten]',_0xe5fb9f[_0xe256('0x30')],util[_0xe256('0x2b')](_0xd4fe8e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe256('0x2e')]['syncNewState']=function(_0x4d5384){try{if(this[_0xe256('0x2c')](_0x4d5384)){logger[_0xe256('0x26')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x4d5384[_0xe256('0x30')],_0x4d5384[_0xe256('0x35')],_0x4d5384[_0xe256('0x31')],_0x4d5384[_0xe256('0x32')]);logger['debug'](_0xe256('0x5f'),_0x4d5384[_0xe256('0x30')],util[_0xe256('0x2b')](_0x4d5384,{'showHidden':![],'depth':null}));if(_0x4d5384[_0xe256('0x60')]!=='6')return;var _0x402429=this[_0xe256('0x11')][_0x4d5384[_0xe256('0x4a')]['split']('-')[0x0]];if(_0x4d5384[_0xe256('0x30')]!==_0x4d5384['linkedid']){var _0x185e74=moment();if(this['channels'][_0x4d5384['linkedid']]){if(!this['channels'][_0x4d5384['linkedid']][_0xe256('0x61')]){this[_0xe256('0x10')][_0x4d5384['linkedid']][_0xe256('0x61')]=!![];this[_0xe256('0x10')][_0x4d5384[_0xe256('0x35')]][_0xe256('0x62')]=_0x185e74['format'](_0xe256('0x46'));if(this[_0xe256('0x10')][_0x4d5384[_0xe256('0x35')]]['starttime']){this[_0xe256('0x10')][_0x4d5384[_0xe256('0x35')]][_0xe256('0x63')]=_0x185e74[_0xe256('0x64')](this[_0xe256('0x10')][_0x4d5384[_0xe256('0x35')]][_0xe256('0x45')],'seconds');}}this[_0xe256('0x10')][_0x4d5384['linkedid']][_0xe256('0x35')]=_0x4d5384['uniqueid'];if(_0x4d5384[_0xe256('0x32')]!=='xcally-motion-preview'){this[_0xe256('0x10')][_0x4d5384[_0xe256('0x35')]]['connectedlinenum']=_0x4d5384[_0xe256('0x32')];}this[_0xe256('0x10')][_0x4d5384['linkedid']][_0xe256('0x65')]=_0x4d5384[_0xe256('0x31')];this['channels'][_0x4d5384['linkedid']]['destinationchannel']=_0x4d5384['channel'];this[_0xe256('0x10')][_0x4d5384[_0xe256('0x35')]][_0xe256('0x47')]=dispositions[_[_0xe256('0x48')](_0x4d5384[_0xe256('0x60')])];if(_0x402429){this[_0xe256('0x10')][_0x4d5384['linkedid']]['UserId']=_0x402429['id'];this[_0xe256('0x10')][_0x4d5384[_0xe256('0x35')]][_0xe256('0x66')]=_0x402429['name'];}}if(this[_0xe256('0x10')][_0x4d5384[_0xe256('0x30')]]){if(!this[_0xe256('0x10')][_0x4d5384[_0xe256('0x30')]][_0xe256('0x61')]){this[_0xe256('0x10')][_0x4d5384[_0xe256('0x30')]][_0xe256('0x61')]=!![];this[_0xe256('0x10')][_0x4d5384[_0xe256('0x30')]][_0xe256('0x62')]=_0x185e74[_0xe256('0x3c')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0xe256('0x10')][_0x4d5384[_0xe256('0x30')]][_0xe256('0x45')]){this[_0xe256('0x10')][_0x4d5384[_0xe256('0x30')]][_0xe256('0x63')]=_0x185e74[_0xe256('0x64')](this[_0xe256('0x10')][_0x4d5384['uniqueid']][_0xe256('0x45')],_0xe256('0x57'));}}if(_0x4d5384[_0xe256('0x32')]!=='xcally-motion-preview'){this[_0xe256('0x10')][_0x4d5384[_0xe256('0x30')]][_0xe256('0x3b')]=_0x4d5384[_0xe256('0x32')];}this[_0xe256('0x10')][_0x4d5384['uniqueid']][_0xe256('0x65')]=_0x4d5384[_0xe256('0x31')];this[_0xe256('0x10')][_0x4d5384[_0xe256('0x30')]][_0xe256('0x67')]=_0x4d5384[_0xe256('0x4a')];this[_0xe256('0x10')][_0x4d5384['uniqueid']]['disposition']=dispositions[_[_0xe256('0x48')](_0x4d5384['channelstate'])];}}else{if(this['channels'][_0x4d5384[_0xe256('0x30')]]){if(_0x402429){this[_0xe256('0x10')][_0x4d5384[_0xe256('0x30')]]['UserId']=_0x402429['id'];this[_0xe256('0x10')][_0x4d5384[_0xe256('0x30')]]['membername']=_0x402429[_0xe256('0x3e')];}}}if(_0x4d5384[_0xe256('0x37')]===_0xe256('0x38')){if(_0x402429){_0x402429[_0xe256('0x4c')]=_0x4d5384['exten'];var _0x81c771;if(this['channels'][_0x4d5384['uniqueid']]){_0x81c771=this[_0xe256('0x10')][_0x4d5384[_0xe256('0x30')]][_0xe256('0x6')];}else if(this[_0xe256('0x10')][_0x4d5384[_0xe256('0x35')]]){_0x81c771=this['channels'][_0x4d5384[_0xe256('0x35')]][_0xe256('0x6')];}_0x402429[_0xe256('0x6')]=_0x81c771;var _0x1632bc={'id':_0x402429['id'],'name':_0x402429[_0xe256('0x3e')],'agentconnected':!![],'destaccountcode':_0x402429[_0xe256('0x40')],'destconnectedlinenum':_0x4d5384['exten'],'queue':_0x81c771||undefined,'uniqueid':_0x4d5384[_0xe256('0x35')]};logger[_0xe256('0x33')](_0xe256('0x68'),_0x4d5384[_0xe256('0x30')],util[_0xe256('0x2b')](_0x1632bc,{'showHidden':![],'depth':null}));this['emit'](util[_0xe256('0x3c')](_0xe256('0x3d'),_0x402429['name']),_0xe256('0x3f'),_0x1632bc);}}}}catch(_0xd94c1c){logger['error']('[%s][voiceCallReport][newstate]',_0x4d5384['uniqueid'],util[_0xe256('0x2b')](_0xd94c1c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe256('0x2e')][_0xe256('0x69')]=function(_0x23cd2c,_0x4984f5){try{if(this[_0xe256('0x10')][_0x23cd2c]){logger[_0xe256('0x26')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x23cd2c,_0x4984f5);this['channels'][_0x23cd2c][_0xe256('0x6a')]=!![];if(_[_0xe256('0x6b')](_0x4984f5,'.wav49')){_0x4984f5=_0x4984f5['replace'](_0xe256('0x6c'),_0xe256('0x6d'));}this[_0xe256('0x10')][_0x23cd2c][_0xe256('0x6e')]=_0x4984f5;var _0x2d39c2=_['find'](this[_0xe256('0x10')][_0x23cd2c][_0xe256('0x6f')],{'filename':_0x4984f5});if(_[_0xe256('0x70')](_0x2d39c2)){this[_0xe256('0x10')][_0x23cd2c][_0xe256('0x6f')][_0xe256('0x71')]({'filename':_0x4984f5,'createdAt':moment()[_0xe256('0x3c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0xe256('0x72')});}}}catch(_0x3b009b){logger['error']('[%s][voiceCallReport][mixMonitorFilename]',_0x23cd2c,util['inspect'](_0x3b009b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe256('0x2e')][_0xe256('0x1b')]=function(_0xcb2a17){try{if(this[_0xe256('0x2c')](_0xcb2a17)){logger[_0xe256('0x33')](_0xe256('0x73'),_0xcb2a17[_0xe256('0x30')],util[_0xe256('0x2b')](_0xcb2a17,{'showHidden':![],'depth':null}));if(this[_0xe256('0x10')][_0xcb2a17['uniqueid']]&&_0xcb2a17[_0xe256('0x4a')]!='OutgoingSpoolFailed'){if(this['isNotNull'](_0xcb2a17[_0xe256('0x74')])){if(this[_0xe256('0x2c')](_0xcb2a17['variable']['mixmonitor_filename'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0xcb2a17['uniqueid'],_0xcb2a17[_0xe256('0x75')]);this[_0xe256('0x69')](_0xcb2a17[_0xe256('0x30')],_0xcb2a17[_0xe256('0x75')]);}else if(this['isNotNull'](_0xcb2a17['variable']['xmd-phone'])){logger[_0xe256('0x26')](_0xe256('0x76'),_0xcb2a17['uniqueid'],_0xcb2a17[_0xe256('0x75')]);this[_0xe256('0x10')][_0xcb2a17[_0xe256('0x30')]][_0xe256('0x32')]=_0xcb2a17[_0xe256('0x75')];}else if(this[_0xe256('0x2c')](_0xcb2a17['variable'][_0xe256('0x77')])){logger[_0xe256('0x26')](_0xe256('0x78'),_0xcb2a17[_0xe256('0x30')],_0xcb2a17[_0xe256('0x75')]);this[_0xe256('0x10')][_0xcb2a17['uniqueid']]['callerid']=_0xcb2a17[_0xe256('0x75')];}else if(this['isNotNull'](_0xcb2a17['variable'][_0xe256('0x79')])){logger[_0xe256('0x26')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0xcb2a17[_0xe256('0x30')],_0xcb2a17[_0xe256('0x75')]);this['channels'][_0xcb2a17[_0xe256('0x30')]]['type']=_0xcb2a17[_0xe256('0x75')];}else if(this['isNotNull'](_0xcb2a17[_0xe256('0x74')][_0xe256('0x7a')])){logger[_0xe256('0x26')](_0xe256('0x7b'),_0xcb2a17[_0xe256('0x30')],_0xcb2a17[_0xe256('0x75')]['split'](',')[0x0]);this[_0xe256('0x10')][_0xcb2a17['uniqueid']][_0xe256('0x6')]=_0xcb2a17[_0xe256('0x75')][_0xe256('0x39')](',')[0x0];}else if(this[_0xe256('0x2c')](_0xcb2a17[_0xe256('0x74')][_0xe256('0x7c')])){logger[_0xe256('0x26')](_0xe256('0x7d'),_0xcb2a17['uniqueid'],_0xcb2a17['value']);this['channels'][_0xcb2a17[_0xe256('0x30')]][_0xe256('0x7e')]=_0xcb2a17[_0xe256('0x75')];}else if(this[_0xe256('0x2c')](_0xcb2a17[_0xe256('0x74')]['xmd-destination'])){logger[_0xe256('0x26')](_0xe256('0x7f'),_0xcb2a17[_0xe256('0x30')],_0xcb2a17[_0xe256('0x75')]);this[_0xe256('0x10')][_0xcb2a17[_0xe256('0x30')]][_0xe256('0x80')]=_0xcb2a17[_0xe256('0x75')];}else if(this[_0xe256('0x2c')](_0xcb2a17[_0xe256('0x74')][_0xe256('0x81')])){logger[_0xe256('0x26')](_0xe256('0x82'),_0xcb2a17[_0xe256('0x30')],_0xcb2a17[_0xe256('0x75')]);this[_0xe256('0x10')][_0xcb2a17[_0xe256('0x30')]][_0xe256('0x83')]=_0xcb2a17['value'];}else if(this['isNotNull'](_0xcb2a17[_0xe256('0x74')][_0xe256('0x84')])){logger['info'](_0xe256('0x85'),_0xcb2a17[_0xe256('0x30')],_0xcb2a17['value']);this[_0xe256('0x10')][_0xcb2a17['uniqueid']][_0xe256('0x6')]=_0xcb2a17['value'];}else if(this[_0xe256('0x2c')](_0xcb2a17[_0xe256('0x74')][_0xe256('0x86')])){logger[_0xe256('0x26')](_0xe256('0x87'),_0xcb2a17['uniqueid'],_0xcb2a17[_0xe256('0x75')]);this['channels'][_0xcb2a17[_0xe256('0x30')]]['sipcalluniqueid']=_0xcb2a17[_0xe256('0x75')];}}}else if(this['isNotNull'](_0xcb2a17['variable'][_0xe256('0x88')])){if(_0xcb2a17[_0xe256('0x75')]){var _0x57f7fd=path[_0xe256('0x89')](_0xcb2a17[_0xe256('0x75')])[_0xe256('0x3e')];logger['info'](_0xe256('0x8a'),_0x57f7fd,_0xcb2a17[_0xe256('0x75')]);this[_0xe256('0x69')](_0x57f7fd,_0xcb2a17[_0xe256('0x75')]);}}else if(this[_0xe256('0x10')][_0xcb2a17[_0xe256('0x35')]]){if(this[_0xe256('0x2c')](_0xcb2a17[_0xe256('0x74')])){if(this[_0xe256('0x2c')](_0xcb2a17[_0xe256('0x74')][_0xe256('0x86')])){logger['info'](_0xe256('0x87'),_0xcb2a17[_0xe256('0x35')],_0xcb2a17[_0xe256('0x75')]);this['channels'][_0xcb2a17[_0xe256('0x35')]][_0xe256('0x8b')]=_0xcb2a17[_0xe256('0x75')];}}}}}catch(_0x4950db){logger[_0xe256('0x29')]('[%s][voiceCallReport][varset]',_0xcb2a17[_0xe256('0x30')],util['inspect'](_0x4950db,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncHangup']=function(_0x36f3e7){try{if(this[_0xe256('0x2c')](_0x36f3e7)){logger[_0xe256('0x33')](_0xe256('0x8c'),_0x36f3e7[_0xe256('0x30')],util[_0xe256('0x2b')](_0x36f3e7,{'showHidden':![],'depth':null}));if(this[_0xe256('0x12')][_0x36f3e7[_0xe256('0x35')]]){if(this[_0xe256('0x10')][this['blindTransfers'][_0x36f3e7[_0xe256('0x35')]]['linkedid']]){this['channels'][this['blindTransfers'][_0x36f3e7[_0xe256('0x35')]][_0xe256('0x35')]][_0xe256('0x30')]=_0x36f3e7['uniqueid'];this[_0xe256('0x10')][this[_0xe256('0x12')][_0x36f3e7[_0xe256('0x35')]]['linkedid']]['answered']=this[_0xe256('0x10')][_0x36f3e7[_0xe256('0x30')]][_0xe256('0x61')];this['channels'][this[_0xe256('0x12')][_0x36f3e7[_0xe256('0x35')]][_0xe256('0x35')]][_0xe256('0x62')]=this[_0xe256('0x10')][_0x36f3e7['uniqueid']]['answertime'];this[_0xe256('0x10')][this['blindTransfers'][_0x36f3e7[_0xe256('0x35')]][_0xe256('0x35')]][_0xe256('0x67')]=this['channels'][this[_0xe256('0x12')][_0x36f3e7['linkedid']][_0xe256('0x35')]][_0xe256('0x4a')];this[_0xe256('0x10')][this['blindTransfers'][_0x36f3e7[_0xe256('0x35')]][_0xe256('0x35')]]['disposition']=this[_0xe256('0x10')][_0x36f3e7['uniqueid']][_0xe256('0x47')];this['channels'][_0x36f3e7[_0xe256('0x30')]]=this['channels'][this['blindTransfers'][_0x36f3e7['linkedid']]['linkedid']];this[_0xe256('0x8d')](this[_0xe256('0x12')][_0x36f3e7[_0xe256('0x35')]]['linkedid']);}else if(this[_0xe256('0x10')][this['blindTransfers'][_0x36f3e7[_0xe256('0x35')]][_0xe256('0x30')]]){this[_0xe256('0x10')][this[_0xe256('0x12')][_0x36f3e7[_0xe256('0x35')]][_0xe256('0x30')]][_0xe256('0x30')]=[this['channels'][this[_0xe256('0x12')][_0x36f3e7[_0xe256('0x35')]][_0xe256('0x30')]][_0xe256('0x35')],this[_0xe256('0x10')][this[_0xe256('0x12')][_0x36f3e7[_0xe256('0x35')]][_0xe256('0x30')]]['linkedid']=this[_0xe256('0x10')][this[_0xe256('0x12')][_0x36f3e7[_0xe256('0x35')]][_0xe256('0x30')]][_0xe256('0x30')]][0x0];this[_0xe256('0x10')][this[_0xe256('0x12')][_0x36f3e7[_0xe256('0x35')]][_0xe256('0x30')]][_0xe256('0x61')]=this[_0xe256('0x10')][_0x36f3e7[_0xe256('0x30')]][_0xe256('0x61')];this['channels'][this['blindTransfers'][_0x36f3e7[_0xe256('0x35')]][_0xe256('0x30')]][_0xe256('0x62')]=this['channels'][_0x36f3e7[_0xe256('0x30')]]['answertime'];this[_0xe256('0x10')][this[_0xe256('0x12')][_0x36f3e7[_0xe256('0x35')]][_0xe256('0x30')]][_0xe256('0x67')]=this['channels'][this[_0xe256('0x12')][_0x36f3e7[_0xe256('0x35')]][_0xe256('0x30')]]['channel'];this[_0xe256('0x10')][this[_0xe256('0x12')][_0x36f3e7['linkedid']]['uniqueid']]['disposition']=this[_0xe256('0x10')][_0x36f3e7['uniqueid']][_0xe256('0x47')];this[_0xe256('0x10')][_0x36f3e7['uniqueid']]=this['channels'][this[_0xe256('0x12')][_0x36f3e7[_0xe256('0x35')]]['uniqueid']];this[_0xe256('0x8d')](this[_0xe256('0x12')][_0x36f3e7[_0xe256('0x35')]][_0xe256('0x30')]);}}if(this[_0xe256('0x10')][_0x36f3e7['uniqueid']]){logger[_0xe256('0x26')](_0xe256('0x8e'),_0x36f3e7[_0xe256('0x30')],_0x36f3e7['cause-txt']);var _0x3a8129=moment();this[_0xe256('0x10')][_0x36f3e7[_0xe256('0x30')]]['endtime']=_0x3a8129[_0xe256('0x3c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xe256('0x10')][_0x36f3e7[_0xe256('0x30')]]['duration']=_0x3a8129[_0xe256('0x64')](this[_0xe256('0x10')][_0x36f3e7[_0xe256('0x30')]][_0xe256('0x45')],_0xe256('0x57'));if(this[_0xe256('0x10')][_0x36f3e7[_0xe256('0x30')]][_0xe256('0x61')]){this[_0xe256('0x10')][_0x36f3e7[_0xe256('0x30')]][_0xe256('0x8f')]=_0x3a8129[_0xe256('0x64')](this[_0xe256('0x10')][_0x36f3e7['uniqueid']]['answertime'],_0xe256('0x57'));this['channels'][_0x36f3e7[_0xe256('0x30')]][_0xe256('0x63')]=this[_0xe256('0x10')][_0x36f3e7[_0xe256('0x30')]][_0xe256('0x55')]-this[_0xe256('0x10')][_0x36f3e7[_0xe256('0x30')]][_0xe256('0x8f')];}if(_0x36f3e7[_0xe256('0x37')]===_0xe256('0x38')){if(this[_0xe256('0x11')][_0x36f3e7[_0xe256('0x4a')][_0xe256('0x39')]('-')[0x0]]){this[_0xe256('0x11')][_0x36f3e7[_0xe256('0x4a')][_0xe256('0x39')]('-')[0x0]]=_[_0xe256('0x90')](this[_0xe256('0x11')][_0x36f3e7['channel'][_0xe256('0x39')]('-')[0x0]],[_0xe256('0x4c')]);logger[_0xe256('0x33')](_0xe256('0x91'),_0x36f3e7[_0xe256('0x30')],util['inspect']({'id':this[_0xe256('0x11')][_0x36f3e7['channel'][_0xe256('0x39')]('-')[0x0]]['id'],'destaccountcode':this[_0xe256('0x11')][_0x36f3e7[_0xe256('0x4a')][_0xe256('0x39')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0xe256('0x2f')](util['format']('user:%s',this['agents'][_0x36f3e7[_0xe256('0x4a')][_0xe256('0x39')]('-')[0x0]][_0xe256('0x3e')]),_0xe256('0x92'),{'id':this[_0xe256('0x11')][_0x36f3e7['channel'][_0xe256('0x39')]('-')[0x0]]['id'],'destaccountcode':this[_0xe256('0x11')][_0x36f3e7[_0xe256('0x4a')][_0xe256('0x39')]('-')[0x0]][_0xe256('0x40')]});for(var _0x586324=0x0;_0x586324{delete this[_0xe256('0x10')][_0x42368d];},_0x4c0cef);}};module[_0xe256('0xbd')]=VoiceCallReport; \ No newline at end of file +var _0x4d16=['endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','[%s][voiceCallReport][varset]\x20event:','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','mixmonitor_filename','parse','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20event:','answertime','destinationchannel','cause-txt','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','transferToInternal','isEmpty','getSettings','then','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','outbound','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','origtransfereruniqueid','ATTENDED','some','origtransfererlinkedid','[%s][voiceCallReport][attendedtransfer]','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','deleteChannelAfterTimeout','moment','path','ioredis','../../../config/environment','ami','../ami','../model/channel','../rpc/setting','set','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','BUSY','redis','defaults','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','syncNewChannel','syncNewState','varset','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isUndefined','emit','isNotNull','uniqueid','calleridname','calleridnum','debug','linkedid','merge','context','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:%s','accountcode','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','blindTransfers','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','YYYY-MM-DD\x20HH:mm:ss','disposition','pick','keys','from-sip','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','name','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','subtract','duration','includes','lastapplication','lastdata','startsWith','cdr(','match','type','isNil','queue','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','channelstate','answered','starttime','seconds','connectedlinename','toNumber','UserId','membername','holdtime','diff','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor'];(function(_0x6a40a,_0x3264b6){var _0x828d2f=function(_0x53abab){while(--_0x53abab){_0x6a40a['push'](_0x6a40a['shift']());}};_0x828d2f(++_0x3264b6);}(_0x4d16,0x121));var _0x64d1=function(_0x4f6260,_0x229b9d){_0x4f6260=_0x4f6260-0x0;var _0x33bd04=_0x4d16[_0x4f6260];return _0x33bd04;};'use strict';var _=require('lodash');var moment=require(_0x64d1('0x0'));var util=require('util');var path=require(_0x64d1('0x1'));var Redis=require(_0x64d1('0x2'));var config=require(_0x64d1('0x3'));var logger=require('../../../config/logger')(_0x64d1('0x4'));var ami=require(_0x64d1('0x5'));var Channel=require(_0x64d1('0x6'));var RpcSetting=require(_0x64d1('0x7'));var applications=[_0x64d1('0x8'),'queue',_0x64d1('0x9'),_0x64d1('0xa'),_0x64d1('0xb'),_0x64d1('0xc')];var dispositions=['NO\x20ANSWER',_0x64d1('0xd'),_0x64d1('0xd'),_0x64d1('0xe'),_0x64d1('0xe'),'NO\x20ANSWER','ANSWERED',_0x64d1('0xf'),_0x64d1('0xd'),_0x64d1('0xd'),_0x64d1('0xd')];config[_0x64d1('0x10')]=_[_0x64d1('0x11')](config[_0x64d1('0x10')],{'host':'localhost','port':0x18eb});var io=require(_0x64d1('0x12'))(new Redis(config[_0x64d1('0x10')]));function VoiceCallReport(_0x438a2c){this[_0x64d1('0x13')]=_0x438a2c[_0x64d1('0x13')];this[_0x64d1('0x14')]=_0x438a2c['agents'];this['blindTransfers']={};ami['on'](_0x64d1('0x15'),this[_0x64d1('0x16')][_0x64d1('0x17')](this));ami['on'](_0x64d1('0x18'),this['syncNewExten'][_0x64d1('0x17')](this));ami['on']('newchannel',this[_0x64d1('0x19')][_0x64d1('0x17')](this));ami['on']('newstate',this[_0x64d1('0x1a')][_0x64d1('0x17')](this));ami['on'](_0x64d1('0x1b'),this['syncVarSet']['bind'](this));ami['on'](_0x64d1('0x1c'),this[_0x64d1('0x1d')][_0x64d1('0x17')](this));ami['on'](_0x64d1('0x1e'),this[_0x64d1('0x1f')]['bind'](this));ami['on'](_0x64d1('0x20'),this[_0x64d1('0x21')]['bind'](this));ami['on'](_0x64d1('0x22'),this['syncBlindTransfer'][_0x64d1('0x17')](this));ami['on'](_0x64d1('0x23'),this[_0x64d1('0x24')]['bind'](this));ami['on'](_0x64d1('0x25'),this[_0x64d1('0x26')][_0x64d1('0x17')](this));try{logger[_0x64d1('0x27')](_0x64d1('0x28'));ami['actionCoreShowChannels']();}catch(_0x4562bb){logger[_0x64d1('0x29')](_0x64d1('0x2a'),util[_0x64d1('0x2b')](_0x4562bb,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x64d1('0x2c')]['isNotNull']=function(_0x16df5a){return _0x16df5a!==null&&!_[_0x64d1('0x2d')](_0x16df5a);};VoiceCallReport[_0x64d1('0x2c')][_0x64d1('0x2e')]=function(_0x1c4ee4,_0x5290ef,_0x1c8c28){io['to'](_0x1c4ee4)[_0x64d1('0x2e')](_0x5290ef,_0x1c8c28);};VoiceCallReport['prototype'][_0x64d1('0x1f')]=function(_0x3d19ca){try{if(this[_0x64d1('0x2f')](_0x3d19ca)){logger['info']('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x3d19ca[_0x64d1('0x30')],_0x3d19ca[_0x64d1('0x31')],_0x3d19ca[_0x64d1('0x32')]);logger[_0x64d1('0x33')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x3d19ca[_0x64d1('0x30')],util['inspect'](_0x3d19ca,{'showHidden':![],'depth':null}));if(_0x3d19ca[_0x64d1('0x30')]===_0x3d19ca[_0x64d1('0x34')]){if(!_[_0x64d1('0x2d')](this['channels'][_0x3d19ca[_0x64d1('0x30')]])){_[_0x64d1('0x35')](this[_0x64d1('0x13')][_0x3d19ca[_0x64d1('0x30')]],_['pick'](_0x3d19ca,_['keys'](this[_0x64d1('0x13')][_0x3d19ca['uniqueid']])));}}if(_0x3d19ca[_0x64d1('0x36')]==='from-sip'){var _0x36def0=this[_0x64d1('0x14')][_0x3d19ca[_0x64d1('0x37')][_0x64d1('0x38')]('-')[0x0]];if(_0x36def0){if(_0x3d19ca[_0x64d1('0x39')]==_0x64d1('0x3a')){_0x36def0[_0x64d1('0x3b')]=_0x3d19ca[_0x64d1('0x3c')];this[_0x64d1('0x2e')](util[_0x64d1('0x3d')](_0x64d1('0x3e'),_0x36def0['name']),'user:agentconnect',{'id':_0x36def0['id'],'destaccountcode':_0x36def0[_0x64d1('0x3f')],'destconnectedlinenum':_0x3d19ca[_0x64d1('0x3c')]});}}}}}catch(_0x30ef68){logger[_0x64d1('0x29')]('[%s][voiceCallReport][newcallerid]',_0x3d19ca[_0x64d1('0x30')],util[_0x64d1('0x2b')](_0x30ef68,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x64d1('0x2c')][_0x64d1('0x19')]=function(_0x4b50de){try{if(this[_0x64d1('0x2f')](_0x4b50de)){logger[_0x64d1('0x33')](_0x64d1('0x40'),_0x4b50de[_0x64d1('0x30')],util[_0x64d1('0x2b')](_0x4b50de,{'showHidden':![],'depth':null}));if(this[_0x64d1('0x13')][_0x4b50de[_0x64d1('0x30')]]){return;}if(_0x4b50de[_0x64d1('0x37')]===_0x64d1('0x41')){return;}if(_0x4b50de[_0x64d1('0x30')]!==_0x4b50de[_0x64d1('0x34')]&&!this[_0x64d1('0x42')][_0x4b50de[_0x64d1('0x34')]]){return;}logger[_0x64d1('0x27')](_0x64d1('0x43'),_0x4b50de['uniqueid'],_0x4b50de[_0x64d1('0x36')],_0x4b50de['exten']);this[_0x64d1('0x13')][_0x4b50de[_0x64d1('0x30')]]=new Channel();this[_0x64d1('0x13')][_0x4b50de[_0x64d1('0x30')]]['starttime']=moment()['format'](_0x64d1('0x44'));this[_0x64d1('0x13')][_0x4b50de['uniqueid']][_0x64d1('0x45')]=dispositions[_['toNumber'](_0x4b50de['channelstate'])];_[_0x64d1('0x35')](this['channels'][_0x4b50de[_0x64d1('0x30')]],_[_0x64d1('0x46')](_0x4b50de,_[_0x64d1('0x47')](this[_0x64d1('0x13')][_0x4b50de['uniqueid']])));if(_0x4b50de[_0x64d1('0x36')]===_0x64d1('0x48')){var _0x4ea157=this[_0x64d1('0x14')][_0x4b50de[_0x64d1('0x37')]['split']('-')[0x0]];if(_0x4ea157&&typeof _0x4ea157['destconnectedlinenum']===_0x64d1('0x49')){_0x4ea157['destconnectedlinenum']=_0x4b50de['exten'];logger[_0x64d1('0x33')](_0x64d1('0x4a'),_0x4b50de['uniqueid'],util[_0x64d1('0x2b')]({'id':_0x4ea157['id'],'destaccountcode':_0x4ea157[_0x64d1('0x3f')],'destconnectedlinenum':_0x4b50de[_0x64d1('0x39')]},{'showHidden':![],'depth':null}));this[_0x64d1('0x2e')](util[_0x64d1('0x3d')]('user:%s',_0x4ea157[_0x64d1('0x4b')]),'user:agentconnect',{'id':_0x4ea157['id'],'destaccountcode':_0x4ea157[_0x64d1('0x3f')],'destconnectedlinenum':_0x4b50de[_0x64d1('0x39')]});}}}}catch(_0x5eb99e){logger['error']('[%s][voiceCallReport][newchannel]',_0x4b50de[_0x64d1('0x30')],util[_0x64d1('0x2b')](_0x5eb99e,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x64d1('0x16')]=function(_0x58bf1f){try{if(this[_0x64d1('0x2f')](_0x58bf1f)){logger[_0x64d1('0x33')](_0x64d1('0x4c'),_0x58bf1f[_0x64d1('0x30')],util[_0x64d1('0x2b')](_0x58bf1f,{'showHidden':![],'depth':null}));if(_0x58bf1f['channel']==='OutgoingSpoolFailed'||_0x58bf1f[_0x64d1('0x39')]==='h')return;if(_0x58bf1f[_0x64d1('0x30')]===_0x58bf1f[_0x64d1('0x34')]||this[_0x64d1('0x42')][_0x58bf1f['linkedid']]){_0x58bf1f[_0x64d1('0x4d')]=_0x58bf1f[_0x64d1('0x4d')]?_0x58bf1f[_0x64d1('0x4d')][_0x64d1('0x4e')]():undefined;_0x58bf1f['applicationdata']=_0x58bf1f['appdata']||_0x58bf1f[_0x64d1('0x4f')];if(_0x58bf1f['appdata']&&_0x58bf1f[_0x64d1('0x4d')]!=='queue'){_0x58bf1f['applicationdata']=_0x58bf1f[_0x64d1('0x4f')]['toLowerCase']();}logger['info'](_0x64d1('0x50'),_0x58bf1f[_0x64d1('0x30')],_0x58bf1f[_0x64d1('0x4d')],_0x58bf1f[_0x64d1('0x4f')]);if(_[_0x64d1('0x2d')](this['channels'][_0x58bf1f[_0x64d1('0x30')]])){this[_0x64d1('0x13')][_0x58bf1f[_0x64d1('0x30')]]=new Channel();this[_0x64d1('0x13')][_0x58bf1f[_0x64d1('0x30')]]['starttime']=_0x58bf1f['duration']?moment()[_0x64d1('0x51')](moment[_0x64d1('0x52')](_0x58bf1f[_0x64d1('0x52')])['seconds'](),'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss'):moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x64d1('0x13')][_0x58bf1f[_0x64d1('0x30')]][_0x64d1('0x45')]=_0x64d1('0xe');}_['merge'](this[_0x64d1('0x13')][_0x58bf1f[_0x64d1('0x30')]],_[_0x64d1('0x46')](_0x58bf1f,_['keys'](this[_0x64d1('0x13')][_0x58bf1f[_0x64d1('0x30')]])));if(_[_0x64d1('0x53')](applications,_0x58bf1f[_0x64d1('0x4d')])){this['channels'][_0x58bf1f['uniqueid']][_0x64d1('0x54')]=_0x58bf1f[_0x64d1('0x4d')];this[_0x64d1('0x13')][_0x58bf1f[_0x64d1('0x30')]][_0x64d1('0x55')]=_0x58bf1f[_0x64d1('0x4f')];if(_0x58bf1f[_0x64d1('0x4d')]===_0x64d1('0x8')&&_[_0x64d1('0x56')](_0x58bf1f['applicationdata']['toLowerCase'](),_0x64d1('0x57'))){var _0x2190ef=_0x58bf1f[_0x64d1('0x4f')][_0x64d1('0x38')]('=');var _0x24c173=_0x2190ef[0x0]['toLowerCase']()[_0x64d1('0x58')](/cdr\((.*)\)/);if(_0x24c173){if(_0x24c173[0x1]===_0x64d1('0x59')&&!_[_0x64d1('0x5a')](this[_0x64d1('0x13')][_0x58bf1f[_0x64d1('0x30')]][_0x24c173[0x1]]))return;this[_0x64d1('0x13')][_0x58bf1f[_0x64d1('0x30')]][_0x24c173[0x1]]=_0x2190ef[0x1];}}else if(_0x58bf1f[_0x64d1('0x4d')]===_0x64d1('0x5b')){this[_0x64d1('0x13')][_0x58bf1f[_0x64d1('0x30')]][_0x64d1('0x5b')]=_0x58bf1f[_0x64d1('0x4f')]['split'](',')[0x0];}}}}}catch(_0x3057d1){logger[_0x64d1('0x29')](_0x64d1('0x5c'),_0x58bf1f[_0x64d1('0x30')],util['inspect'](_0x3057d1,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x64d1('0x1a')]=function(_0x5ee8b7){try{if(this[_0x64d1('0x2f')](_0x5ee8b7)){logger[_0x64d1('0x27')](_0x64d1('0x5d'),_0x5ee8b7[_0x64d1('0x30')],_0x5ee8b7[_0x64d1('0x34')],_0x5ee8b7[_0x64d1('0x31')],_0x5ee8b7['calleridnum']);logger[_0x64d1('0x33')](_0x64d1('0x5e'),_0x5ee8b7[_0x64d1('0x30')],util[_0x64d1('0x2b')](_0x5ee8b7,{'showHidden':![],'depth':null}));if(_0x5ee8b7[_0x64d1('0x5f')]!=='6')return;var _0x171710=this['agents'][_0x5ee8b7[_0x64d1('0x37')][_0x64d1('0x38')]('-')[0x0]];if(_0x5ee8b7['uniqueid']!==_0x5ee8b7[_0x64d1('0x34')]){var _0x29ebab=moment();if(this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x34')]]){if(!this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x34')]]['answered']){this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x34')]][_0x64d1('0x60')]=!![];this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x34')]]['answertime']=_0x29ebab[_0x64d1('0x3d')](_0x64d1('0x44'));if(this[_0x64d1('0x13')][_0x5ee8b7['linkedid']][_0x64d1('0x61')]){this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x34')]]['holdtime']=_0x29ebab['diff'](this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x34')]][_0x64d1('0x61')],_0x64d1('0x62'));}}this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x34')]][_0x64d1('0x34')]=_0x5ee8b7[_0x64d1('0x30')];if(_0x5ee8b7[_0x64d1('0x32')]!=='xcally-motion-preview'){this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x34')]][_0x64d1('0x3c')]=_0x5ee8b7[_0x64d1('0x32')];}this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x34')]][_0x64d1('0x63')]=_0x5ee8b7['calleridname'];this['channels'][_0x5ee8b7['linkedid']]['destinationchannel']=_0x5ee8b7[_0x64d1('0x37')];this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x34')]]['disposition']=dispositions[_[_0x64d1('0x64')](_0x5ee8b7['channelstate'])];if(_0x171710){this['channels'][_0x5ee8b7[_0x64d1('0x34')]][_0x64d1('0x65')]=_0x171710['id'];this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x34')]][_0x64d1('0x66')]=_0x171710['name'];}}if(this['channels'][_0x5ee8b7[_0x64d1('0x30')]]){if(!this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x30')]][_0x64d1('0x60')]){this['channels'][_0x5ee8b7[_0x64d1('0x30')]][_0x64d1('0x60')]=!![];this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x30')]]['answertime']=_0x29ebab['format'](_0x64d1('0x44'));if(this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x30')]][_0x64d1('0x61')]){this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x30')]][_0x64d1('0x67')]=_0x29ebab[_0x64d1('0x68')](this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x30')]][_0x64d1('0x61')],'seconds');}}if(_0x5ee8b7[_0x64d1('0x32')]!=='xcally-motion-preview'){this[_0x64d1('0x13')][_0x5ee8b7['uniqueid']]['connectedlinenum']=_0x5ee8b7[_0x64d1('0x32')];}this['channels'][_0x5ee8b7[_0x64d1('0x30')]][_0x64d1('0x63')]=_0x5ee8b7['calleridname'];this[_0x64d1('0x13')][_0x5ee8b7['uniqueid']]['destinationchannel']=_0x5ee8b7[_0x64d1('0x37')];this[_0x64d1('0x13')][_0x5ee8b7['uniqueid']][_0x64d1('0x45')]=dispositions[_[_0x64d1('0x64')](_0x5ee8b7[_0x64d1('0x5f')])];}}else{if(this[_0x64d1('0x13')][_0x5ee8b7['uniqueid']]){if(_0x171710){this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x30')]][_0x64d1('0x65')]=_0x171710['id'];this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x30')]][_0x64d1('0x66')]=_0x171710[_0x64d1('0x4b')];}}}if(_0x5ee8b7[_0x64d1('0x36')]===_0x64d1('0x48')){if(_0x171710){_0x171710[_0x64d1('0x3b')]=_0x5ee8b7[_0x64d1('0x39')];var _0x51695a;if(this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x30')]]){_0x51695a=this[_0x64d1('0x13')][_0x5ee8b7['uniqueid']][_0x64d1('0x5b')];}else if(this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x34')]]){_0x51695a=this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x34')]]['queue'];}_0x171710[_0x64d1('0x5b')]=_0x51695a;var _0x5e0219={'id':_0x171710['id'],'name':_0x171710[_0x64d1('0x4b')],'agentconnected':!![],'destaccountcode':_0x171710[_0x64d1('0x3f')],'destconnectedlinenum':_0x5ee8b7[_0x64d1('0x39')],'queue':_0x51695a||undefined,'uniqueid':_0x5ee8b7[_0x64d1('0x34')]};logger[_0x64d1('0x33')](_0x64d1('0x69'),_0x5ee8b7[_0x64d1('0x30')],util[_0x64d1('0x2b')](_0x5e0219,{'showHidden':![],'depth':null}));this[_0x64d1('0x2e')](util['format'](_0x64d1('0x3e'),_0x171710['name']),_0x64d1('0x6a'),_0x5e0219);}}}}catch(_0x5bb8dd){logger['error'](_0x64d1('0x6b'),_0x5ee8b7[_0x64d1('0x30')],util[_0x64d1('0x2b')](_0x5bb8dd,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x64d1('0x2c')][_0x64d1('0x6c')]=function(_0x46c9ec,_0x530f60){try{if(this[_0x64d1('0x13')][_0x46c9ec]){logger[_0x64d1('0x27')](_0x64d1('0x6d'),_0x46c9ec,_0x530f60);this[_0x64d1('0x13')][_0x46c9ec][_0x64d1('0x6e')]=!![];if(_[_0x64d1('0x6f')](_0x530f60,_0x64d1('0x70'))){_0x530f60=_0x530f60[_0x64d1('0x71')](_0x64d1('0x70'),_0x64d1('0x72'));}this['channels'][_0x46c9ec][_0x64d1('0x73')]=_0x530f60;var _0x330477=_[_0x64d1('0x74')](this[_0x64d1('0x13')][_0x46c9ec][_0x64d1('0x75')],{'filename':_0x530f60});if(_[_0x64d1('0x5a')](_0x330477)){this[_0x64d1('0x13')][_0x46c9ec]['monitors'][_0x64d1('0x76')]({'filename':_0x530f60,'createdAt':moment()[_0x64d1('0x3d')](_0x64d1('0x44')),'mixmonitorid':'','status':_0x64d1('0x77')});}}}catch(_0x48405a){logger[_0x64d1('0x29')](_0x64d1('0x78'),_0x46c9ec,util[_0x64d1('0x2b')](_0x48405a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x64d1('0x2c')][_0x64d1('0x79')]=function(_0x25ffed){try{if(this[_0x64d1('0x2f')](_0x25ffed)){logger[_0x64d1('0x33')](_0x64d1('0x7a'),_0x25ffed[_0x64d1('0x30')],util[_0x64d1('0x2b')](_0x25ffed,{'showHidden':![],'depth':null}));if(this['channels'][_0x25ffed[_0x64d1('0x30')]]&&_0x25ffed[_0x64d1('0x37')]!=_0x64d1('0x41')){if(this[_0x64d1('0x2f')](_0x25ffed['variable'])){if(this[_0x64d1('0x2f')](_0x25ffed[_0x64d1('0x7b')]['mixmonitor_filename'])){logger[_0x64d1('0x27')](_0x64d1('0x7c'),_0x25ffed['uniqueid'],_0x25ffed[_0x64d1('0x7d')]);this[_0x64d1('0x6c')](_0x25ffed[_0x64d1('0x30')],_0x25ffed[_0x64d1('0x7d')]);}else if(this['isNotNull'](_0x25ffed['variable'][_0x64d1('0x7e')])){logger[_0x64d1('0x27')](_0x64d1('0x7f'),_0x25ffed['uniqueid'],_0x25ffed[_0x64d1('0x7d')]);this[_0x64d1('0x13')][_0x25ffed[_0x64d1('0x30')]][_0x64d1('0x32')]=_0x25ffed[_0x64d1('0x7d')];}else if(this['isNotNull'](_0x25ffed[_0x64d1('0x7b')]['xmd-callerid'])){logger[_0x64d1('0x27')](_0x64d1('0x80'),_0x25ffed['uniqueid'],_0x25ffed[_0x64d1('0x7d')]);this['channels'][_0x25ffed['uniqueid']]['callerid']=_0x25ffed[_0x64d1('0x7d')];}else if(this[_0x64d1('0x2f')](_0x25ffed['variable']['xmd-cdrtype'])){logger[_0x64d1('0x27')](_0x64d1('0x81'),_0x25ffed[_0x64d1('0x30')],_0x25ffed[_0x64d1('0x7d')]);this[_0x64d1('0x13')][_0x25ffed['uniqueid']][_0x64d1('0x59')]=_0x25ffed['value'];}else if(this[_0x64d1('0x2f')](_0x25ffed['variable'][_0x64d1('0x82')])){logger[_0x64d1('0x27')](_0x64d1('0x83'),_0x25ffed[_0x64d1('0x30')],_0x25ffed['value'][_0x64d1('0x38')](',')[0x0]);this[_0x64d1('0x13')][_0x25ffed[_0x64d1('0x30')]][_0x64d1('0x5b')]=_0x25ffed[_0x64d1('0x7d')][_0x64d1('0x38')](',')[0x0];}else if(this[_0x64d1('0x2f')](_0x25ffed[_0x64d1('0x7b')][_0x64d1('0x84')])){logger[_0x64d1('0x27')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x25ffed['uniqueid'],_0x25ffed['value']);this[_0x64d1('0x13')][_0x25ffed[_0x64d1('0x30')]][_0x64d1('0x85')]=_0x25ffed['value'];}else if(this[_0x64d1('0x2f')](_0x25ffed[_0x64d1('0x7b')][_0x64d1('0x86')])){logger['info'](_0x64d1('0x87'),_0x25ffed[_0x64d1('0x30')],_0x25ffed[_0x64d1('0x7d')]);this[_0x64d1('0x13')][_0x25ffed[_0x64d1('0x30')]][_0x64d1('0x88')]=_0x25ffed[_0x64d1('0x7d')];}else if(this[_0x64d1('0x2f')](_0x25ffed[_0x64d1('0x7b')][_0x64d1('0x89')])){logger[_0x64d1('0x27')](_0x64d1('0x8a'),_0x25ffed[_0x64d1('0x30')],_0x25ffed[_0x64d1('0x7d')]);this['channels'][_0x25ffed[_0x64d1('0x30')]][_0x64d1('0x8b')]=_0x25ffed[_0x64d1('0x7d')];}else if(this[_0x64d1('0x2f')](_0x25ffed[_0x64d1('0x7b')]['xmcs-queue'])){logger['info'](_0x64d1('0x8c'),_0x25ffed['uniqueid'],_0x25ffed[_0x64d1('0x7d')]);this[_0x64d1('0x13')][_0x25ffed[_0x64d1('0x30')]][_0x64d1('0x5b')]=_0x25ffed['value'];}else if(this[_0x64d1('0x2f')](_0x25ffed[_0x64d1('0x7b')][_0x64d1('0x8d')])){logger[_0x64d1('0x27')](_0x64d1('0x8e'),_0x25ffed['uniqueid'],_0x25ffed['value']);this['channels'][_0x25ffed[_0x64d1('0x30')]]['sipcalluniqueid']=_0x25ffed[_0x64d1('0x7d')];}}}else if(this['isNotNull'](_0x25ffed[_0x64d1('0x7b')][_0x64d1('0x8f')])){if(_0x25ffed[_0x64d1('0x7d')]){var _0x57ee58=path[_0x64d1('0x90')](_0x25ffed[_0x64d1('0x7d')])[_0x64d1('0x4b')];logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x57ee58,_0x25ffed[_0x64d1('0x7d')]);this[_0x64d1('0x6c')](_0x57ee58,_0x25ffed[_0x64d1('0x7d')]);}}else if(this[_0x64d1('0x13')][_0x25ffed[_0x64d1('0x34')]]){if(this[_0x64d1('0x2f')](_0x25ffed[_0x64d1('0x7b')])){if(this[_0x64d1('0x2f')](_0x25ffed[_0x64d1('0x7b')][_0x64d1('0x8d')])){logger[_0x64d1('0x27')](_0x64d1('0x8e'),_0x25ffed[_0x64d1('0x34')],_0x25ffed[_0x64d1('0x7d')]);this[_0x64d1('0x13')][_0x25ffed[_0x64d1('0x34')]][_0x64d1('0x91')]=_0x25ffed[_0x64d1('0x7d')];}}}}}catch(_0x36bddc){logger[_0x64d1('0x29')]('[%s][voiceCallReport][varset]',_0x25ffed[_0x64d1('0x30')],util[_0x64d1('0x2b')](_0x36bddc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x64d1('0x2c')]['syncHangup']=function(_0x502d32){try{if(this[_0x64d1('0x2f')](_0x502d32)){logger[_0x64d1('0x33')](_0x64d1('0x92'),_0x502d32['uniqueid'],util[_0x64d1('0x2b')](_0x502d32,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x502d32[_0x64d1('0x34')]]){if(this['channels'][this[_0x64d1('0x42')][_0x502d32[_0x64d1('0x34')]]['linkedid']]){this['channels'][this[_0x64d1('0x42')][_0x502d32[_0x64d1('0x34')]]['linkedid']][_0x64d1('0x30')]=_0x502d32[_0x64d1('0x30')];this[_0x64d1('0x13')][this[_0x64d1('0x42')][_0x502d32[_0x64d1('0x34')]][_0x64d1('0x34')]][_0x64d1('0x60')]=this[_0x64d1('0x13')][_0x502d32['uniqueid']][_0x64d1('0x60')];this[_0x64d1('0x13')][this[_0x64d1('0x42')][_0x502d32[_0x64d1('0x34')]]['linkedid']][_0x64d1('0x93')]=this[_0x64d1('0x13')][_0x502d32['uniqueid']][_0x64d1('0x93')];this['channels'][this[_0x64d1('0x42')][_0x502d32[_0x64d1('0x34')]]['linkedid']][_0x64d1('0x94')]=this[_0x64d1('0x13')][this[_0x64d1('0x42')][_0x502d32[_0x64d1('0x34')]][_0x64d1('0x34')]]['channel'];this[_0x64d1('0x13')][this[_0x64d1('0x42')][_0x502d32['linkedid']][_0x64d1('0x34')]][_0x64d1('0x45')]=this[_0x64d1('0x13')][_0x502d32[_0x64d1('0x30')]][_0x64d1('0x45')];this[_0x64d1('0x13')][_0x502d32['uniqueid']]=this[_0x64d1('0x13')][this['blindTransfers'][_0x502d32['linkedid']][_0x64d1('0x34')]];this['deleteChannelAfterTimeout'](this['blindTransfers'][_0x502d32[_0x64d1('0x34')]]['linkedid']);}else if(this['channels'][this['blindTransfers'][_0x502d32[_0x64d1('0x34')]][_0x64d1('0x30')]]){this[_0x64d1('0x13')][this['blindTransfers'][_0x502d32[_0x64d1('0x34')]][_0x64d1('0x30')]][_0x64d1('0x30')]=[this['channels'][this[_0x64d1('0x42')][_0x502d32[_0x64d1('0x34')]][_0x64d1('0x30')]][_0x64d1('0x34')],this[_0x64d1('0x13')][this['blindTransfers'][_0x502d32[_0x64d1('0x34')]][_0x64d1('0x30')]][_0x64d1('0x34')]=this[_0x64d1('0x13')][this[_0x64d1('0x42')][_0x502d32[_0x64d1('0x34')]]['uniqueid']][_0x64d1('0x30')]][0x0];this[_0x64d1('0x13')][this[_0x64d1('0x42')][_0x502d32[_0x64d1('0x34')]][_0x64d1('0x30')]][_0x64d1('0x60')]=this[_0x64d1('0x13')][_0x502d32[_0x64d1('0x30')]][_0x64d1('0x60')];this[_0x64d1('0x13')][this[_0x64d1('0x42')][_0x502d32[_0x64d1('0x34')]]['uniqueid']][_0x64d1('0x93')]=this['channels'][_0x502d32['uniqueid']][_0x64d1('0x93')];this[_0x64d1('0x13')][this[_0x64d1('0x42')][_0x502d32['linkedid']][_0x64d1('0x30')]][_0x64d1('0x94')]=this[_0x64d1('0x13')][this['blindTransfers'][_0x502d32['linkedid']][_0x64d1('0x30')]][_0x64d1('0x37')];this['channels'][this[_0x64d1('0x42')][_0x502d32[_0x64d1('0x34')]][_0x64d1('0x30')]]['disposition']=this[_0x64d1('0x13')][_0x502d32[_0x64d1('0x30')]][_0x64d1('0x45')];this[_0x64d1('0x13')][_0x502d32[_0x64d1('0x30')]]=this[_0x64d1('0x13')][this[_0x64d1('0x42')][_0x502d32[_0x64d1('0x34')]]['uniqueid']];this['deleteChannelAfterTimeout'](this[_0x64d1('0x42')][_0x502d32[_0x64d1('0x34')]]['uniqueid']);}}if(this[_0x64d1('0x13')][_0x502d32[_0x64d1('0x30')]]){logger['info']('[%s][voiceCallReport][hangup]\x20reason:%s',_0x502d32['uniqueid'],_0x502d32[_0x64d1('0x95')]);var _0x103786=moment();this[_0x64d1('0x13')][_0x502d32[_0x64d1('0x30')]]['endtime']=_0x103786[_0x64d1('0x3d')](_0x64d1('0x44'));this[_0x64d1('0x13')][_0x502d32[_0x64d1('0x30')]][_0x64d1('0x52')]=_0x103786['diff'](this[_0x64d1('0x13')][_0x502d32['uniqueid']]['starttime'],_0x64d1('0x62'));if(this[_0x64d1('0x13')][_0x502d32[_0x64d1('0x30')]][_0x64d1('0x60')]){this[_0x64d1('0x13')][_0x502d32['uniqueid']]['billableseconds']=_0x103786[_0x64d1('0x68')](this[_0x64d1('0x13')][_0x502d32[_0x64d1('0x30')]][_0x64d1('0x93')],_0x64d1('0x62'));this[_0x64d1('0x13')][_0x502d32['uniqueid']][_0x64d1('0x67')]=this[_0x64d1('0x13')][_0x502d32[_0x64d1('0x30')]][_0x64d1('0x52')]-this[_0x64d1('0x13')][_0x502d32['uniqueid']][_0x64d1('0x96')];}if(_0x502d32[_0x64d1('0x36')]===_0x64d1('0x48')){if(this['agents'][_0x502d32[_0x64d1('0x37')][_0x64d1('0x38')]('-')[0x0]]){this[_0x64d1('0x14')][_0x502d32[_0x64d1('0x37')][_0x64d1('0x38')]('-')[0x0]]=_[_0x64d1('0x97')](this['agents'][_0x502d32[_0x64d1('0x37')][_0x64d1('0x38')]('-')[0x0]],['destconnectedlinenum']);logger['debug'](_0x64d1('0x98'),_0x502d32[_0x64d1('0x30')],util['inspect']({'id':this[_0x64d1('0x14')][_0x502d32['channel'][_0x64d1('0x38')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x502d32[_0x64d1('0x37')][_0x64d1('0x38')]('-')[0x0]][_0x64d1('0x3f')]},{'showHidden':![],'depth':null}));this[_0x64d1('0x2e')](util[_0x64d1('0x3d')](_0x64d1('0x3e'),this[_0x64d1('0x14')][_0x502d32[_0x64d1('0x37')][_0x64d1('0x38')]('-')[0x0]][_0x64d1('0x4b')]),_0x64d1('0x99'),{'id':this['agents'][_0x502d32[_0x64d1('0x37')][_0x64d1('0x38')]('-')[0x0]]['id'],'destaccountcode':this[_0x64d1('0x14')][_0x502d32[_0x64d1('0x37')]['split']('-')[0x0]][_0x64d1('0x3f')]});for(var _0x3e7dfd=0x0;_0x3e7dfd{delete this['channels'][_0x4ed0d6];},_0x10fd2d);}};module['exports']=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 1f964e4..f4e4b8c 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34f3=['custom:dialbegin','error','syncDialEnd','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','voice_outbound_channel:save','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','variable','value','outboundrouteid','voice','keys','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberpenalty','includes','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','format','duration','diff','starttime','seconds','complete','answered','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','toLowerCase','set','cdr(','application','applicationdata','split','match','[%s][voiceDialReport][newexten]','lodash','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','channels','outboundChannels','outbound','applications','variables','dialbegin','syncDialBegin','dialend','bind','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:'];(function(_0x375126,_0x514a8e){var _0x1f76bb=function(_0x22f2d0){while(--_0x22f2d0){_0x375126['push'](_0x375126['shift']());}};_0x1f76bb(++_0x514a8e);}(_0x34f3,0xbb));var _0x334f=function(_0x28f2dc,_0x1fff9d){_0x28f2dc=_0x28f2dc-0x0;var _0x5d471b=_0x34f3[_0x28f2dc];return _0x5d471b;};'use strict';var _=require(_0x334f('0x0'));var moment=require('moment');var util=require('util');var Redis=require('ioredis');var config=require(_0x334f('0x1'));var logger=require(_0x334f('0x2'))(_0x334f('0x3'));var ami=require(_0x334f('0x4'));config[_0x334f('0x5')]=_[_0x334f('0x6')](config[_0x334f('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x334f('0x7'))(new Redis(config['redis']));function VoiceDialReport(_0x4410fa){this[_0x334f('0x8')]=_0x4410fa[_0x334f('0x9')];this['outbound']=_0x4410fa[_0x334f('0xa')];this[_0x334f('0xb')]={};this[_0x334f('0xc')]={};ami['on'](_0x334f('0xd'),this[_0x334f('0xe')]['bind'](this));ami['on'](_0x334f('0xf'),this['syncDialEnd'][_0x334f('0x10')](this));ami['on']('varset',this[_0x334f('0x11')]['bind'](this));ami['on'](_0x334f('0x12'),this[_0x334f('0x13')][_0x334f('0x10')](this));}VoiceDialReport[_0x334f('0x14')][_0x334f('0x15')]=function(_0x4dc414){return _0x4dc414!==null&&!_[_0x334f('0x16')](_0x4dc414);};VoiceDialReport[_0x334f('0x14')][_0x334f('0x17')]=function(_0x3c1e9c,_0x20daae,_0x5a7f1e){io['to'](_0x3c1e9c)[_0x334f('0x17')](_0x20daae,_0x5a7f1e);};VoiceDialReport[_0x334f('0x14')][_0x334f('0xe')]=function(_0x20de84){try{if(this[_0x334f('0x15')](_0x20de84)){logger[_0x334f('0x18')](_0x334f('0x19'),_0x20de84[_0x334f('0x1a')],util[_0x334f('0x1b')](_0x20de84,{'showHidden':![],'depth':null}));if(this[_0x334f('0x8')][_0x20de84[_0x334f('0x1a')]]){_[_0x334f('0x1c')](this['channels'][_0x20de84[_0x334f('0x1a')]],{'starttime':moment()['format'](_0x334f('0x1d')),'lastevent':_0x334f('0x1e'),'interface':_0x20de84[_0x334f('0x1f')][_0x334f('0x20')](0x0,_0x20de84[_0x334f('0x1f')][_0x334f('0x21')]('-')),'membername':_0x20de84[_0x334f('0x1f')][_0x334f('0x20')](_0x20de84[_0x334f('0x1f')][_0x334f('0x21')]('/')+0x1,_0x20de84[_0x334f('0x1f')][_0x334f('0x21')]('-'))},_[_0x334f('0x22')](_0x20de84,[_0x334f('0x23'),_0x334f('0x24')]));logger[_0x334f('0x25')](_0x334f('0x26'),_0x20de84['uniqueid'],this[_0x334f('0x8')][_0x20de84[_0x334f('0x1a')]][_0x334f('0x27')],this['channels'][_0x20de84[_0x334f('0x1a')]]['interface']);logger['debug'](_0x334f('0x28'),_0x20de84[_0x334f('0x1a')],util['inspect'](this[_0x334f('0x8')][_0x20de84[_0x334f('0x1a')]],{'showHidden':![],'depth':null}));if(this['applications'][_0x20de84[_0x334f('0x1a')]])_['merge'](this['channels'][_0x20de84[_0x334f('0x1a')]],this[_0x334f('0xb')][_0x20de84[_0x334f('0x1a')]]);this[_0x334f('0x17')](_0x334f('0x29'),'voice_outbound_channel:save',this['channels'][_0x20de84['uniqueid']]);logger['debug'](_0x334f('0x2a'),_0x20de84[_0x334f('0x1a')],util['inspect'](this['channels'][_0x20de84[_0x334f('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x334f('0x17')](_0x334f('0x2b'),this[_0x334f('0x8')][_0x20de84['uniqueid']]);}}}catch(_0x3b4f05){logger[_0x334f('0x2c')]('[%s][voiceDialReport][dialbegin]',_0x20de84[_0x334f('0x1a')],util[_0x334f('0x1b')](_0x3b4f05,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x334f('0x14')][_0x334f('0x2d')]=function(_0x22642d){try{if(this[_0x334f('0x15')](_0x22642d)){logger[_0x334f('0x18')]('[%s][voiceDialReport][dialend]\x20event:',_0x22642d[_0x334f('0x1a')],util[_0x334f('0x1b')](_0x22642d,{'showHidden':![],'depth':null}));if(this[_0x334f('0x8')][_0x22642d[_0x334f('0x1a')]]){this[_0x334f('0x8')][_0x22642d[_0x334f('0x1a')]]['dialstatus']=_0x22642d[_0x334f('0x2e')];if(_0x22642d[_0x334f('0x2e')]===_0x334f('0x2f')){this[_0x334f('0x8')][_0x22642d[_0x334f('0x1a')]][_0x334f('0x30')]=_0x22642d[_0x334f('0x30')];this['channels'][_0x22642d[_0x334f('0x1a')]][_0x334f('0x31')]=_0x22642d[_0x334f('0x31')];this[_0x334f('0x8')][_0x22642d[_0x334f('0x1a')]][_0x334f('0x32')]=moment()['format'](_0x334f('0x1d'));this['channels'][_0x22642d[_0x334f('0x1a')]][_0x334f('0x33')]='connect';logger[_0x334f('0x25')](_0x334f('0x34'),_0x22642d[_0x334f('0x1a')],_0x22642d[_0x334f('0x1f')]['substring'](_0x22642d[_0x334f('0x1f')][_0x334f('0x21')]('/')+0x1,_0x22642d['channel'][_0x334f('0x21')]('-')));logger[_0x334f('0x18')](_0x334f('0x35'),_0x22642d[_0x334f('0x1a')],util[_0x334f('0x1b')](this[_0x334f('0x8')][_0x22642d['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x334f('0x36'),this['channels'][_0x22642d[_0x334f('0x1a')]]);}logger[_0x334f('0x18')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x22642d[_0x334f('0x1a')],util[_0x334f('0x1b')](this[_0x334f('0x8')][_0x22642d['uniqueid']],{'showHidden':![],'depth':null}));this[_0x334f('0x17')](_0x334f('0x29'),_0x334f('0x37'),this[_0x334f('0x8')][_0x22642d[_0x334f('0x1a')]]);}}}catch(_0x3286b4){logger[_0x334f('0x2c')](_0x334f('0x38'),_0x22642d['uniqueid'],util[_0x334f('0x1b')](_0x3286b4,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x334f('0x14')][_0x334f('0x11')]=function(_0x854227){try{if(this[_0x334f('0x15')](_0x854227)){logger[_0x334f('0x18')](_0x334f('0x39'),_0x854227[_0x334f('0x1a')],util['inspect'](_0x854227,{'showHidden':![],'depth':null}));this[_0x334f('0x3a')](_0x854227[_0x334f('0x1a')],_['keys'](_0x854227[_0x334f('0x3b')])[0x0],_0x854227[_0x334f('0x3c')]);if(this[_0x334f('0x15')](_0x854227[_0x334f('0x3b')])&&this['isNotNull'](_0x854227[_0x334f('0x3b')][_0x334f('0x3d')])){if(_[_0x334f('0x16')](this[_0x334f('0x8')][_0x854227[_0x334f('0x1a')]])){this[_0x334f('0x8')][_0x854227[_0x334f('0x1a')]]={'routeId':_0x854227[_0x334f('0x3c')],'variables':this[_0x334f('0xc')][_0x854227['uniqueid']],'motionChannel':_0x334f('0x3e')};logger['info']('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x854227[_0x334f('0x1a')],_0x854227[_0x334f('0x3b')][_0x334f('0x3d')],_[_0x334f('0x3f')](_0x854227[_0x334f('0x3b')])[0x0],_0x854227['value']);logger[_0x334f('0x18')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x854227[_0x334f('0x1a')],util[_0x334f('0x1b')](this[_0x334f('0x8')][_0x854227[_0x334f('0x1a')]],{'showHidden':![],'depth':null}));this[_0x334f('0x17')](_0x334f('0x29'),_0x334f('0x37'),this[_0x334f('0x8')][_0x854227[_0x334f('0x1a')]]);}}}}catch(_0x319065){logger['error'](_0x334f('0x40'),_0x854227['uniqueid'],util['inspect'](_0x319065,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x334f('0x14')][_0x334f('0x3a')]=function(_0x13d3d2,_0x1e81ed,_0x5d525c){var _0x420a1e=[_0x334f('0x41'),_0x334f('0x42'),_0x334f('0x43'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0x334f('0x44'),_0x334f('0x45'),_0x334f('0x46'),'sipcallid',_0x334f('0x47'),_0x334f('0x48'),'bridgepvtcallid',_0x334f('0x49'),_0x334f('0x4a'),_0x334f('0x4b'),'memberlastcall',_0x334f('0x27'),_0x334f('0x4c'),'memberrealtime'];if(!_['isNil'](_0x1e81ed)&&!_[_0x334f('0x4d')](_0x420a1e,_0x1e81ed)){if(_[_0x334f('0x16')](this['variables'][_0x13d3d2])){this['variables'][_0x13d3d2]={};}this['variables'][_0x13d3d2][_0x1e81ed]=_0x5d525c;}};VoiceDialReport[_0x334f('0x14')][_0x334f('0x13')]=function(_0x13aaad){try{if(this[_0x334f('0x15')](_0x13aaad)){logger['debug']('[%s][voiceDialReport][hangup]\x20event:',_0x13aaad['uniqueid'],util[_0x334f('0x1b')](_0x13aaad,{'showHidden':![],'depth':null}));if(this['channels'][_0x13aaad[_0x334f('0x1a')]]){logger[_0x334f('0x25')](_0x334f('0x4e'),_0x13aaad[_0x334f('0x1a')],_0x13aaad[_0x334f('0x4f')]);this[_0x334f('0x8')][_0x13aaad[_0x334f('0x1a')]][_0x334f('0x50')]=moment()[_0x334f('0x51')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x334f('0x8')][_0x13aaad[_0x334f('0x1a')]][_0x334f('0x52')]=moment(this[_0x334f('0x8')][_0x13aaad[_0x334f('0x1a')]][_0x334f('0x50')])[_0x334f('0x53')](this[_0x334f('0x8')][_0x13aaad[_0x334f('0x1a')]][_0x334f('0x54')],_0x334f('0x55'));this[_0x334f('0x8')][_0x13aaad[_0x334f('0x1a')]][_0x334f('0x33')]=_0x334f('0x56');this[_0x334f('0xa')]['total']+=0x1;if(this[_0x334f('0x8')][_0x13aaad[_0x334f('0x1a')]][_0x334f('0x32')]){this[_0x334f('0xa')][_0x334f('0x57')]+=0x1;this['channels'][_0x13aaad['uniqueid']][_0x334f('0x58')]=moment(this[_0x334f('0x8')][_0x13aaad[_0x334f('0x1a')]][_0x334f('0x32')])[_0x334f('0x53')](this[_0x334f('0x8')][_0x13aaad[_0x334f('0x1a')]][_0x334f('0x54')],_0x334f('0x55'));this['channels'][_0x13aaad[_0x334f('0x1a')]][_0x334f('0x59')]=moment(this[_0x334f('0x8')][_0x13aaad[_0x334f('0x1a')]][_0x334f('0x50')])[_0x334f('0x53')](this['channels'][_0x13aaad[_0x334f('0x1a')]]['answertime'],_0x334f('0x55'));this[_0x334f('0xa')][_0x334f('0x5a')]+=this['channels'][_0x13aaad[_0x334f('0x1a')]]['holdtime']||0x0;this['outbound'][_0x334f('0x5b')]+=this[_0x334f('0x8')][_0x13aaad[_0x334f('0x1a')]]['billableseconds'];}this[_0x334f('0xa')][_0x334f('0x5c')]+=this[_0x334f('0x8')][_0x13aaad[_0x334f('0x1a')]][_0x334f('0x52')];logger[_0x334f('0x18')](_0x334f('0x5d'),_0x13aaad[_0x334f('0x1a')],util['inspect'](this[_0x334f('0x8')][_0x13aaad[_0x334f('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x334f('0x17')](_0x334f('0x5e'),this['channels'][_0x13aaad[_0x334f('0x1a')]]);logger['debug'](_0x334f('0x5f'),_0x13aaad[_0x334f('0x1a')],util[_0x334f('0x1b')](this['channels'][_0x13aaad[_0x334f('0x1a')]],{'showHidden':![],'depth':null}));ami['emit']('custom:dialend',this[_0x334f('0x8')][_0x13aaad[_0x334f('0x1a')]]);logger[_0x334f('0x18')](_0x334f('0x60'),_0x13aaad[_0x334f('0x1a')],util[_0x334f('0x1b')](this['channels'][_0x13aaad[_0x334f('0x1a')]],{'showHidden':![],'depth':null}));this['emit'](_0x334f('0x29'),_0x334f('0x61'),this[_0x334f('0xa')]);logger[_0x334f('0x25')](_0x334f('0x62'),JSON[_0x334f('0x63')](this[_0x334f('0x8')][_0x13aaad['uniqueid']]));logger[_0x334f('0x18')](_0x334f('0x64'),_0x13aaad['uniqueid'],util[_0x334f('0x1b')](this['channels'][_0x13aaad['uniqueid']],{'showHidden':![],'depth':null}));this[_0x334f('0x17')]('voice:outbound',_0x334f('0x65'),this['channels'][_0x13aaad['uniqueid']]);this[_0x334f('0x66')](_0x13aaad[_0x334f('0x1a')]);}else if(this[_0x334f('0x8')][_0x13aaad[_0x334f('0x67')]]){this['channels'][_0x13aaad['linkedid']][_0x334f('0x1a')]=this[_0x334f('0x8')][_0x13aaad[_0x334f('0x67')]]['destuniqueid'];}if(this[_0x334f('0xc')][_0x13aaad[_0x334f('0x1a')]]){delete this[_0x334f('0xc')][_0x13aaad['uniqueid']];}}}catch(_0x2dcdba){logger[_0x334f('0x2c')](_0x334f('0x68'),_0x13aaad[_0x334f('0x1a')],util[_0x334f('0x1b')](_0x2dcdba,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x334f('0x14')][_0x334f('0x69')]=function(_0x5a363a){try{if(this['isNotNull'](_0x5a363a)){logger[_0x334f('0x18')](_0x334f('0x6a'),_0x5a363a['uniqueid'],util['inspect'](_0x5a363a,{'showHidden':![],'depth':null}));if(_0x5a363a['application'][_0x334f('0x6b')]()===_0x334f('0x6c')){_0x5a363a['applicationdata']=(_0x5a363a['appdata']||_0x5a363a['applicationdata'])['toLowerCase']();if(_['startsWith'](_0x5a363a['applicationdata'],_0x334f('0x6d'))){if(_[_0x334f('0x16')](this[_0x334f('0xb')][_0x5a363a[_0x334f('0x1a')]]))this[_0x334f('0xb')][_0x5a363a[_0x334f('0x1a')]]={};logger[_0x334f('0x25')]('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x5a363a['uniqueid'],_0x5a363a[_0x334f('0x6e')],_0x5a363a[_0x334f('0x6f')]);var _0x2d543f=_0x5a363a['applicationdata'][_0x334f('0x70')]('=');var _0x4db970=_0x2d543f[0x0][_0x334f('0x71')](/cdr\((.*)\)/);if(_0x4db970)this[_0x334f('0xb')][_0x5a363a[_0x334f('0x1a')]][_0x4db970[0x1]]=_0x2d543f[0x1];}}}}catch(_0x1fc0c7){logger[_0x334f('0x2c')](_0x334f('0x72'),_0x5a363a['uniqueid'],util[_0x334f('0x1b')](_0x1fc0c7,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['deleteChannelAfterTimeout']=function(_0x2f763c,_0x25c649=0x2710){if(this[_0x334f('0x8')][_0x2f763c]){setTimeout(()=>{delete this[_0x334f('0x8')][_0x2f763c];},_0x25c649);}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0x5715=['prototype','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','channels','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','omit','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','connectedlinenum','connectedlinename','answertime','format','lastevent','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','lastIndexOf','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]\x20event:','keys','variable','outboundrouteid','value','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','[%s][voiceDialReport][hangup]\x20event:','cause-txt','endtime','duration','diff','starttime','seconds','complete','total','answered','holdtime','billableseconds','sumHoldTime','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','custom:dialend','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','appdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','match','[%s][voiceDialReport][newexten]','exports','lodash','moment','ioredis','../../../config/logger','ami','../ami','redis','defaults','localhost','outbound','applications','variables','dialbegin','syncDialBegin','bind','syncDialEnd','varset','syncVarSet','hangup','syncHangup','isNotNull','isUndefined'];(function(_0x122e11,_0x23aed6){var _0x45388d=function(_0x5b8893){while(--_0x5b8893){_0x122e11['push'](_0x122e11['shift']());}};_0x45388d(++_0x23aed6);}(_0x5715,0xd4));var _0x5571=function(_0x18f64a,_0x1c8248){_0x18f64a=_0x18f64a-0x0;var _0x44687f=_0x5715[_0x18f64a];return _0x44687f;};'use strict';var _=require(_0x5571('0x0'));var moment=require(_0x5571('0x1'));var util=require('util');var Redis=require(_0x5571('0x2'));var config=require('../../../config/environment');var logger=require(_0x5571('0x3'))(_0x5571('0x4'));var ami=require(_0x5571('0x5'));config[_0x5571('0x6')]=_[_0x5571('0x7')](config[_0x5571('0x6')],{'host':_0x5571('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5571('0x6')]));function VoiceDialReport(_0x1409f5){this['channels']=_0x1409f5['outboundChannels'];this[_0x5571('0x9')]=_0x1409f5[_0x5571('0x9')];this[_0x5571('0xa')]={};this[_0x5571('0xb')]={};ami['on'](_0x5571('0xc'),this[_0x5571('0xd')][_0x5571('0xe')](this));ami['on']('dialend',this[_0x5571('0xf')][_0x5571('0xe')](this));ami['on'](_0x5571('0x10'),this[_0x5571('0x11')][_0x5571('0xe')](this));ami['on'](_0x5571('0x12'),this[_0x5571('0x13')][_0x5571('0xe')](this));}VoiceDialReport['prototype'][_0x5571('0x14')]=function(_0x434272){return _0x434272!==null&&!_[_0x5571('0x15')](_0x434272);};VoiceDialReport[_0x5571('0x16')][_0x5571('0x17')]=function(_0x4ab197,_0x1958ca,_0x4c91cc){io['to'](_0x4ab197)['emit'](_0x1958ca,_0x4c91cc);};VoiceDialReport[_0x5571('0x16')][_0x5571('0xd')]=function(_0x35474a){try{if(this['isNotNull'](_0x35474a)){logger[_0x5571('0x18')](_0x5571('0x19'),_0x35474a[_0x5571('0x1a')],util[_0x5571('0x1b')](_0x35474a,{'showHidden':![],'depth':null}));if(this['channels'][_0x35474a[_0x5571('0x1a')]]){_[_0x5571('0x1c')](this[_0x5571('0x1d')][_0x35474a[_0x5571('0x1a')]],{'starttime':moment()['format'](_0x5571('0x1e')),'lastevent':_0x5571('0x1f'),'interface':_0x35474a[_0x5571('0x20')]['substring'](0x0,_0x35474a[_0x5571('0x20')]['lastIndexOf']('-')),'membername':_0x35474a['channel'][_0x5571('0x21')](_0x35474a[_0x5571('0x20')]['lastIndexOf']('/')+0x1,_0x35474a[_0x5571('0x20')]['lastIndexOf']('-'))},_[_0x5571('0x22')](_0x35474a,['event','privilege']));logger[_0x5571('0x23')](_0x5571('0x24'),_0x35474a['uniqueid'],this[_0x5571('0x1d')][_0x35474a['uniqueid']][_0x5571('0x25')],this[_0x5571('0x1d')][_0x35474a[_0x5571('0x1a')]][_0x5571('0x26')]);logger[_0x5571('0x18')](_0x5571('0x27'),_0x35474a[_0x5571('0x1a')],util[_0x5571('0x1b')](this['channels'][_0x35474a[_0x5571('0x1a')]],{'showHidden':![],'depth':null}));if(this[_0x5571('0xa')][_0x35474a[_0x5571('0x1a')]])_[_0x5571('0x1c')](this[_0x5571('0x1d')][_0x35474a[_0x5571('0x1a')]],this['applications'][_0x35474a['uniqueid']]);this['emit'](_0x5571('0x28'),_0x5571('0x29'),this['channels'][_0x35474a['uniqueid']]);logger[_0x5571('0x18')](_0x5571('0x2a'),_0x35474a['uniqueid'],util['inspect'](this[_0x5571('0x1d')][_0x35474a[_0x5571('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x5571('0x17')](_0x5571('0x2b'),this[_0x5571('0x1d')][_0x35474a[_0x5571('0x1a')]]);}}}catch(_0x2208d9){logger[_0x5571('0x2c')](_0x5571('0x2d'),_0x35474a[_0x5571('0x1a')],util['inspect'](_0x2208d9,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5571('0x16')][_0x5571('0xf')]=function(_0x38d27b){try{if(this[_0x5571('0x14')](_0x38d27b)){logger[_0x5571('0x18')](_0x5571('0x2e'),_0x38d27b['uniqueid'],util['inspect'](_0x38d27b,{'showHidden':![],'depth':null}));if(this[_0x5571('0x1d')][_0x38d27b[_0x5571('0x1a')]]){this[_0x5571('0x1d')][_0x38d27b['uniqueid']][_0x5571('0x2f')]=_0x38d27b[_0x5571('0x2f')];if(_0x38d27b['dialstatus']==='ANSWER'){this[_0x5571('0x1d')][_0x38d27b[_0x5571('0x1a')]]['connectedlinenum']=_0x38d27b[_0x5571('0x30')];this['channels'][_0x38d27b[_0x5571('0x1a')]][_0x5571('0x31')]=_0x38d27b['connectedlinename'];this['channels'][_0x38d27b['uniqueid']][_0x5571('0x32')]=moment()[_0x5571('0x33')](_0x5571('0x1e'));this[_0x5571('0x1d')][_0x38d27b['uniqueid']][_0x5571('0x34')]='connect';logger[_0x5571('0x23')](_0x5571('0x35'),_0x38d27b[_0x5571('0x1a')],_0x38d27b[_0x5571('0x20')][_0x5571('0x21')](_0x38d27b[_0x5571('0x20')]['lastIndexOf']('/')+0x1,_0x38d27b[_0x5571('0x20')][_0x5571('0x36')]('-')));logger['debug'](_0x5571('0x37'),_0x38d27b['uniqueid'],util[_0x5571('0x1b')](this[_0x5571('0x1d')][_0x38d27b['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x5571('0x17')](_0x5571('0x38'),this[_0x5571('0x1d')][_0x38d27b[_0x5571('0x1a')]]);}logger[_0x5571('0x18')](_0x5571('0x39'),_0x38d27b[_0x5571('0x1a')],util[_0x5571('0x1b')](this[_0x5571('0x1d')][_0x38d27b[_0x5571('0x1a')]],{'showHidden':![],'depth':null}));this[_0x5571('0x17')](_0x5571('0x28'),_0x5571('0x29'),this[_0x5571('0x1d')][_0x38d27b[_0x5571('0x1a')]]);}}}catch(_0x18b68c){logger[_0x5571('0x2c')]('[%s][voiceDialReport][dialend]',_0x38d27b['uniqueid'],util[_0x5571('0x1b')](_0x18b68c,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5571('0x16')][_0x5571('0x11')]=function(_0x4c4af9){try{if(this[_0x5571('0x14')](_0x4c4af9)){logger[_0x5571('0x18')](_0x5571('0x3a'),_0x4c4af9[_0x5571('0x1a')],util[_0x5571('0x1b')](_0x4c4af9,{'showHidden':![],'depth':null}));this['addVariable'](_0x4c4af9[_0x5571('0x1a')],_[_0x5571('0x3b')](_0x4c4af9['variable'])[0x0],_0x4c4af9['value']);if(this[_0x5571('0x14')](_0x4c4af9[_0x5571('0x3c')])&&this[_0x5571('0x14')](_0x4c4af9[_0x5571('0x3c')][_0x5571('0x3d')])){if(_[_0x5571('0x15')](this['channels'][_0x4c4af9[_0x5571('0x1a')]])){this[_0x5571('0x1d')][_0x4c4af9[_0x5571('0x1a')]]={'routeId':_0x4c4af9[_0x5571('0x3e')],'variables':this['variables'][_0x4c4af9[_0x5571('0x1a')]],'motionChannel':'voice'};logger[_0x5571('0x23')](_0x5571('0x3f'),_0x4c4af9['uniqueid'],_0x4c4af9[_0x5571('0x3c')]['outboundrouteid'],_[_0x5571('0x3b')](_0x4c4af9['variable'])[0x0],_0x4c4af9[_0x5571('0x3e')]);logger[_0x5571('0x18')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x4c4af9['uniqueid'],util[_0x5571('0x1b')](this[_0x5571('0x1d')][_0x4c4af9[_0x5571('0x1a')]],{'showHidden':![],'depth':null}));this[_0x5571('0x17')]('voice:outbound',_0x5571('0x29'),this[_0x5571('0x1d')][_0x4c4af9['uniqueid']]);}}}}catch(_0xf5e32d){logger[_0x5571('0x2c')](_0x5571('0x40'),_0x4c4af9[_0x5571('0x1a')],util[_0x5571('0x1b')](_0xf5e32d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5571('0x16')][_0x5571('0x41')]=function(_0x2a350f,_0x844968,_0x1dc296){var _0xe491d=[_0x5571('0x42'),_0x5571('0x43'),_0x5571('0x44'),'rtpaudioqosjitterbridged',_0x5571('0x45'),_0x5571('0x46'),_0x5571('0x47'),'rtpaudioqosrttbridged',_0x5571('0x48'),_0x5571('0x49'),'bridgepeer',_0x5571('0x4a'),'membercalls',_0x5571('0x4b'),_0x5571('0x4c'),_0x5571('0x4d'),_0x5571('0x25'),_0x5571('0x4e'),_0x5571('0x4f')];if(!_['isNil'](_0x844968)&&!_['includes'](_0xe491d,_0x844968)){if(_['isUndefined'](this[_0x5571('0xb')][_0x2a350f])){this['variables'][_0x2a350f]={};}this[_0x5571('0xb')][_0x2a350f][_0x844968]=_0x1dc296;}};VoiceDialReport[_0x5571('0x16')]['syncHangup']=function(_0x4565b2){try{if(this[_0x5571('0x14')](_0x4565b2)){logger[_0x5571('0x18')](_0x5571('0x50'),_0x4565b2[_0x5571('0x1a')],util[_0x5571('0x1b')](_0x4565b2,{'showHidden':![],'depth':null}));if(this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x1a')]]){logger[_0x5571('0x23')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x4565b2[_0x5571('0x1a')],_0x4565b2[_0x5571('0x51')]);this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x1a')]][_0x5571('0x52')]=moment()['format'](_0x5571('0x1e'));this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x1a')]][_0x5571('0x53')]=moment(this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x1a')]][_0x5571('0x52')])[_0x5571('0x54')](this['channels'][_0x4565b2[_0x5571('0x1a')]][_0x5571('0x55')],_0x5571('0x56'));this['channels'][_0x4565b2[_0x5571('0x1a')]][_0x5571('0x34')]=_0x5571('0x57');this[_0x5571('0x9')][_0x5571('0x58')]+=0x1;if(this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x1a')]]['answertime']){this[_0x5571('0x9')][_0x5571('0x59')]+=0x1;this['channels'][_0x4565b2[_0x5571('0x1a')]][_0x5571('0x5a')]=moment(this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x1a')]][_0x5571('0x32')])[_0x5571('0x54')](this[_0x5571('0x1d')][_0x4565b2['uniqueid']]['starttime'],'seconds');this[_0x5571('0x1d')][_0x4565b2['uniqueid']][_0x5571('0x5b')]=moment(this[_0x5571('0x1d')][_0x4565b2['uniqueid']][_0x5571('0x52')])['diff'](this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x1a')]][_0x5571('0x32')],'seconds');this[_0x5571('0x9')][_0x5571('0x5c')]+=this['channels'][_0x4565b2[_0x5571('0x1a')]][_0x5571('0x5a')]||0x0;this['outbound']['sumBillable']+=this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x1a')]][_0x5571('0x5b')];}this[_0x5571('0x9')][_0x5571('0x5d')]+=this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x1a')]][_0x5571('0x53')];logger['debug'](_0x5571('0x5e'),_0x4565b2['uniqueid'],util[_0x5571('0x1b')](this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x5571('0x17')](_0x5571('0x5f'),this[_0x5571('0x1d')][_0x4565b2['uniqueid']]);logger[_0x5571('0x18')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x4565b2['uniqueid'],util[_0x5571('0x1b')](this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x5571('0x17')](_0x5571('0x60'),this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x1a')]]);logger[_0x5571('0x18')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x4565b2[_0x5571('0x1a')],util[_0x5571('0x1b')](this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x1a')]],{'showHidden':![],'depth':null}));this['emit'](_0x5571('0x28'),'voice_outbound:save',this[_0x5571('0x9')]);logger[_0x5571('0x23')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0x5571('0x61')](this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x1a')]]));logger[_0x5571('0x18')](_0x5571('0x62'),_0x4565b2['uniqueid'],util[_0x5571('0x1b')](this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x1a')]],{'showHidden':![],'depth':null}));this[_0x5571('0x17')]('voice:outbound',_0x5571('0x63'),this[_0x5571('0x1d')][_0x4565b2['uniqueid']]);this[_0x5571('0x64')](_0x4565b2[_0x5571('0x1a')]);}else if(this[_0x5571('0x1d')][_0x4565b2['linkedid']]){this['channels'][_0x4565b2[_0x5571('0x65')]]['uniqueid']=this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x65')]][_0x5571('0x66')];}if(this[_0x5571('0xb')][_0x4565b2[_0x5571('0x1a')]]){delete this['variables'][_0x4565b2[_0x5571('0x1a')]];}}}catch(_0x583c5d){logger[_0x5571('0x2c')](_0x5571('0x67'),_0x4565b2['uniqueid'],util['inspect'](_0x583c5d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5571('0x16')][_0x5571('0x68')]=function(_0x4b69a2){try{if(this[_0x5571('0x14')](_0x4b69a2)){logger[_0x5571('0x18')](_0x5571('0x69'),_0x4b69a2[_0x5571('0x1a')],util[_0x5571('0x1b')](_0x4b69a2,{'showHidden':![],'depth':null}));if(_0x4b69a2[_0x5571('0x6a')][_0x5571('0x6b')]()===_0x5571('0x6c')){_0x4b69a2[_0x5571('0x6d')]=(_0x4b69a2[_0x5571('0x6e')]||_0x4b69a2['applicationdata'])[_0x5571('0x6b')]();if(_[_0x5571('0x6f')](_0x4b69a2[_0x5571('0x6d')],_0x5571('0x70'))){if(_[_0x5571('0x15')](this[_0x5571('0xa')][_0x4b69a2[_0x5571('0x1a')]]))this[_0x5571('0xa')][_0x4b69a2['uniqueid']]={};logger[_0x5571('0x23')](_0x5571('0x71'),_0x4b69a2[_0x5571('0x1a')],_0x4b69a2['application'],_0x4b69a2[_0x5571('0x6d')]);var _0x451a43=_0x4b69a2[_0x5571('0x6d')]['split']('=');var _0x38cc1f=_0x451a43[0x0][_0x5571('0x72')](/cdr\((.*)\)/);if(_0x38cc1f)this[_0x5571('0xa')][_0x4b69a2['uniqueid']][_0x38cc1f[0x1]]=_0x451a43[0x1];}}}}catch(_0x2dc1c8){logger[_0x5571('0x2c')](_0x5571('0x73'),_0x4b69a2[_0x5571('0x1a')],util['inspect'](_0x2dc1c8,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5571('0x16')][_0x5571('0x64')]=function(_0x51f656,_0x4081d0=0x2710){if(this[_0x5571('0x1d')][_0x51f656]){setTimeout(()=>{delete this[_0x5571('0x1d')][_0x51f656];},_0x4081d0);}};module[_0x5571('0x74')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 40028a4..03abcd2 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x19a6=['queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][agentconnect]','last','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','membername','queuecallerexitAt','transfer','reason','startsWith','local/','linkedid','seconds','FORWARDTRANSFER','transfertype','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','syncVarSet','addVariable','keys','variable','value','CONTINUE','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','handleHangup','length','diff','ATTENDEDTRANSFER','COMPLETEDBYAGENT','sumDuration','milliseconds','total','answered','sumBillable','unmanaged','lastevent','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','sumHoldTime','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','hangup','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','[%s][voiceQueueReport][handleHangup]','[%s][voiceQueueReport][hangup]','cause-txt','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','deleteChannelAfterTimeout','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','switch','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transferuniqueid','transfertargetuniqueid','transferexten','origtransfererexten','ATTENDED','origtransfereruniqueid','transferid','syncBlindTransfer','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','mohstarttime','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','appdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceQueueReport][newexten]','exports','moment','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','realtime','agents','channels','queueChannels','voiceQueues','campaigns','summary','variables','syncQueueSummaryComplete','bind','queuemember','syncQueueMember','queuestatuscomplete','queuecallerjoin','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','syncHangup','syncFullyBooted','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','blindtransfer','loopQueueSummary','loopQueueShow','isEmpty','originated','pTalking','hasOwnProperty','unlockRR','queuecallerexit','queuecallerabandon','queuecallercomplete','clearZombieChannels','status','channel','catch','message','error','[%s][voiceQueueReport][checkChannel]','queueReports','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','inspect','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][','uniqueid','voice_queue_channel:save','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','format','voice:queue:%s','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','voice_queue:save','isNotNull','isUndefined','Action','queues','[voiceQueueReport][queues]','isRunning','queuesummary','then','actionid','[voiceQueueReport][queuesummary]','createQueueSummaryReport','createReport','handleInboundQueueSummaryReport','compareToInboundQueue','assign','syncQueueStatusComplete','queuestatus','queue','outbound','custom:queuesummary','statusRequests','completeEvent','push','syncQueueSummary','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','position','count','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','[%s][voiceQueueReport][queuecallerabandon]'];(function(_0x212d2a,_0x254b0a){var _0x207b05=function(_0x516b41){while(--_0x516b41){_0x212d2a['push'](_0x212d2a['shift']());}};_0x207b05(++_0x254b0a);}(_0x19a6,0x7a));var _0x619a=function(_0x292293,_0x522030){_0x292293=_0x292293-0x0;var _0x46db09=_0x19a6[_0x292293];return _0x46db09;};'use strict';var _=require('lodash');var moment=require(_0x619a('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0x619a('0x1'));var logger=require(_0x619a('0x2'))(_0x619a('0x3'));var ami=require(_0x619a('0x4'));var QueueReport=require(_0x619a('0x5'));var VoiceQueueSummary=require('../model/voiceQueueSummary');config[_0x619a('0x6')]=_[_0x619a('0x7')](config[_0x619a('0x6')],{'host':_0x619a('0x8'),'port':0x18eb});var io=require(_0x619a('0x9'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x619a('0xa')][_0x619a('0xb')]=function(_0x47d94c){this[_0x619a('0xc')]=this[_0x619a('0xc')]?this[_0x619a('0xc')][_0x619a('0xd')](_0x47d94c):_0x47d94c();};function VoiceQueueReport(_0x1ef7d9){this[_0x619a('0xe')]=new Sequence();this['queueReports']={};this[_0x619a('0xf')]=_0x1ef7d9;this['agents']=_0x1ef7d9[_0x619a('0x10')];this[_0x619a('0x11')]=_0x1ef7d9[_0x619a('0x12')];this[_0x619a('0x13')]=_0x1ef7d9[_0x619a('0x13')];this[_0x619a('0x14')]=_0x1ef7d9[_0x619a('0x14')];this[_0x619a('0x15')]=initializeSummary();this[_0x619a('0x16')]={};ami['on']('queuesummary',this['syncQueueSummary']['bind'](this));ami['on']('queuesummarycomplete',this[_0x619a('0x17')][_0x619a('0x18')](this));ami['on'](_0x619a('0x19'),this[_0x619a('0x1a')][_0x619a('0x18')](this));ami['on'](_0x619a('0x1b'),this['syncQueueStatusComplete'][_0x619a('0x18')](this));ami['on'](_0x619a('0x1c'),this['syncQueueCallerJoin'][_0x619a('0x18')](this));ami['on']('queuecallerabandon',this[_0x619a('0x1d')][_0x619a('0x18')](this));ami['on'](_0x619a('0x1e'),this[_0x619a('0x1f')][_0x619a('0x18')](this));ami['on'](_0x619a('0x20'),this[_0x619a('0x21')][_0x619a('0x18')](this));ami['on'](_0x619a('0x22'),this[_0x619a('0x23')][_0x619a('0x18')](this));ami['on']('varset',this['syncVarSet'][_0x619a('0x18')](this));ami['on']('hangup',this[_0x619a('0x24')]['bind'](this));ami['on']('fullybooted',this[_0x619a('0x25')][_0x619a('0x18')](this));ami['on']('musiconholdstart',this[_0x619a('0x26')][_0x619a('0x18')](this));ami['on']('musiconholdstop',this[_0x619a('0x27')][_0x619a('0x18')](this));ami['on'](_0x619a('0x28'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0x619a('0x29'),this['syncBlindTransfer']['bind'](this));this[_0x619a('0x2a')]();this[_0x619a('0x2b')]();}function clearChannels(_0x556c96){if(!_[_0x619a('0x2c')](_0x556c96)){for(var _0x2e9d77 in _0x556c96){if(_0x556c96['hasOwnProperty'](_0x2e9d77)){delete _0x556c96[_0x2e9d77];}}}}function clearCampaigns(_0x27da56){if(!_[_0x619a('0x2c')](_0x27da56)){for(var _0x308a9b in _0x27da56){if(_0x27da56['hasOwnProperty'](_0x308a9b)){_0x27da56[_0x308a9b]['originated']=0x0;}}}}function clearVoiceQueues(_0x480231){if(!_['isEmpty'](_0x480231)){for(var _0x222960 in _0x480231){if(_0x480231['hasOwnProperty'](_0x222960)){_0x480231[_0x222960][_0x619a('0x2d')]=0x0;_0x480231[_0x222960]['talking']=0x0;_0x480231[_0x222960][_0x619a('0x2e')]=0x0;_0x480231[_0x222960]['waiting']=0x0;_0x480231[_0x222960]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x627163){if(!_[_0x619a('0x2c')](_0x627163)){for(var _0x2560b9 in _0x627163){if(_0x627163[_0x619a('0x2f')](_0x2560b9)){_0x627163[_0x2560b9][_0x619a('0x30')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x4898fb){return _0x4898fb[_0x619a('0x31')]||_0x4898fb[_0x619a('0x32')]||_0x4898fb[_0x619a('0x33')];}VoiceQueueReport[_0x619a('0xa')][_0x619a('0x34')]=function(){var _0x12d551=this;for(var _0x4a661d in this['channels']){if(this['channels'][_0x619a('0x2f')](_0x4a661d)&&!this[_0x619a('0x11')][_0x4a661d]['switch']){this['sequence'][_0x619a('0xb')](function(){if(!_['isNil'](_0x12d551[_0x619a('0x11')][_0x4a661d])){return ami['Action']({'action':_0x619a('0x35'),'channel':_0x12d551[_0x619a('0x11')][_0x4a661d][_0x619a('0x36')]})[_0x619a('0x37')](function(_0x3bfcce){if(_0x3bfcce[_0x619a('0x38')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x12d551[_0x619a('0x11')][_0x4a661d]){delete _0x12d551['channels'][_0x4a661d];logger[_0x619a('0x39')](_0x619a('0x3a'),_0x4a661d,util['inspect'](_0x3bfcce,{'showHidden':![],'depth':null}));}if(_0x12d551[_0x619a('0x3b')][_0x4a661d]){delete _0x12d551[_0x619a('0x3b')][_0x4a661d];logger[_0x619a('0x39')](_0x619a('0x3c'),_0x4a661d,util['inspect'](_0x3bfcce,{'showHidden':![],'depth':null}));}if(_0x12d551[_0x619a('0x16')][_0x4a661d]){delete _0x12d551['variables'][_0x4a661d];logger[_0x619a('0x39')](_0x619a('0x3d'),_0x4a661d,util[_0x619a('0x3e')](_0x3bfcce,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x619a('0xa')][_0x619a('0x25')]=function(){logger[_0x619a('0x39')](_0x619a('0x3f'));clearChannels(this[_0x619a('0x11')]);this[_0x619a('0x40')](this['queueReports']);clearAgentBooked(this[_0x619a('0x10')]);clearVoiceQueues(this[_0x619a('0x13')]);clearCampaigns(this[_0x619a('0x14')]);this[_0x619a('0x15')]=initializeSummary();};VoiceQueueReport['prototype']['clearQueueReport']=function(_0x3b9b2f){var _0x1e6970=this;if(!_['isEmpty'](_0x3b9b2f)){for(var _0x37d21e in _0x3b9b2f){if(_0x3b9b2f[_0x619a('0x2f')](_0x37d21e)){_0x1e6970[_0x619a('0x41')](_0x3b9b2f[_0x37d21e],_0x619a('0x42'));delete _0x3b9b2f[_0x37d21e];}}}};VoiceQueueReport['prototype'][_0x619a('0x43')]=function(_0x39b178,_0x30a5f8,_0xa3b4c6){io['to'](_0x39b178)[_0x619a('0x43')](_0x30a5f8,_0xa3b4c6);};VoiceQueueReport['prototype'][_0x619a('0x44')]=function(_0x2a8840,_0x3ed39a){logger[_0x619a('0x45')](_0x619a('0x46')+_0x3ed39a+']\x20sending\x20voice_queue_channel:save\x20event:',_0x2a8840[_0x619a('0x47')],util[_0x619a('0x3e')](_0x2a8840,{'showHidden':![],'depth':null}));this['emit'](util['format']('voice:queue:%s',_0x2a8840['queue']),_0x619a('0x48'),_0x2a8840);io[_0x619a('0x43')](_0x619a('0x49'),_0x2a8840);};VoiceQueueReport[_0x619a('0xa')][_0x619a('0x41')]=function(_0x4f8b4a,_0x12857c){logger[_0x619a('0x45')](_0x619a('0x46')+_0x12857c+_0x619a('0x4a'),_0x4f8b4a[_0x619a('0x47')],util['inspect'](_0x4f8b4a,{'showHidden':![],'depth':null}));if(_0x4f8b4a[_0x619a('0x4b')]==='ATTENDEDTRANSFER'){return;}this['emit'](util[_0x619a('0x4c')](_0x619a('0x4d'),_0x4f8b4a['queue']),'voice_queue_channel:remove',_0x4f8b4a);io['emit'](_0x619a('0x4e'),_0x4f8b4a);};VoiceQueueReport['prototype'][_0x619a('0x4f')]=function(_0x4bb6cc){if(_0x4bb6cc[_0x619a('0x50')]===_0x619a('0x51')){logger[_0x619a('0x45')](_0x619a('0x52'),util['inspect'](_0x4bb6cc,{'showHidden':![],'depth':null}));this[_0x619a('0x43')](util[_0x619a('0x4c')]('voice:queue:%s',_0x4bb6cc[_0x619a('0x53')]),_0x619a('0x54'),_0x4bb6cc);}};VoiceQueueReport['prototype'][_0x619a('0x55')]=function(_0x55ad5c){return _0x55ad5c!==null&&!_[_0x619a('0x56')](_0x55ad5c);};VoiceQueueReport[_0x619a('0xa')]['loopQueueShow']=function(){var _0x854270=this;setInterval(function(){_0x854270['clearZombieChannels']();ami[_0x619a('0x57')]({'action':_0x619a('0x58')})['catch'](function(_0x4f1b00){logger[_0x619a('0x39')](_0x619a('0x59'),util[_0x619a('0x3e')](_0x4f1b00,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x619a('0xa')]['loopQueueSummary']=function(){var _0x3d6763=this;setInterval(function(){if(!_0x3d6763['summary'][_0x619a('0x5a')]){return ami[_0x619a('0x57')]({'action':_0x619a('0x5b')})[_0x619a('0x5c')](function(_0x59cd4d){_0x3d6763[_0x619a('0x15')]['id']=_0x59cd4d[_0x619a('0x5d')];_0x3d6763[_0x619a('0x15')][_0x619a('0x5a')]=!![];_0x3d6763[_0x619a('0x15')]['queuestatus'][_0x59cd4d[_0x619a('0x5d')]]={};})[_0x619a('0x37')](function(_0x827bf5){logger['error'](_0x619a('0x5e'),util['inspect'](_0x827bf5,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x619a('0xa')][_0x619a('0x5f')]=function(_0x12184f,_0x169055){var _0x3eb50f;if(this[_0x619a('0x15')]&&this[_0x619a('0x15')][_0x619a('0x58')]&&this[_0x619a('0x15')][_0x619a('0x58')][_0x12184f[_0x619a('0x53')]]){_0x3eb50f=this[_0x619a('0x15')][_0x619a('0x58')][_0x12184f[_0x619a('0x53')]]['summaryEvent'];}var _0xef6bdc=new VoiceQueueSummary(_0x12184f);return _0xef6bdc[_0x619a('0x60')](_0x169055[_0x619a('0x10')],this[_0x619a('0x10')],_0x3eb50f,this[_0x619a('0xf')][_0x619a('0x11')]);};VoiceQueueReport[_0x619a('0xa')][_0x619a('0x61')]=function(_0x170ccf,_0x147e01){var _0x63cd2b=this[_0x619a('0x5f')](_0x170ccf,_0x147e01);var _0x23e676=![];_0x23e676=_0x63cd2b[_0x619a('0x62')](_0x170ccf);if(_0x23e676){Object[_0x619a('0x63')](_0x170ccf,_0x63cd2b);this[_0x619a('0xf')][_0x619a('0x13')][_0x170ccf[_0x619a('0x53')]]=_0x170ccf;this[_0x619a('0x4f')](_0x63cd2b);}};VoiceQueueReport[_0x619a('0xa')][_0x619a('0x64')]=function(_0x358670){var _0x3e8853=null;var _0x5a24c6=this[_0x619a('0x15')]['id'];if(this[_0x619a('0x15')][_0x619a('0x65')][_0x5a24c6]){_0x3e8853=this['summary'][_0x619a('0x65')][_0x5a24c6][_0x358670['actionid']];}if(!_0x3e8853){this[_0x619a('0x15')]=initializeSummary();return;}var _0x2515b5=this['voiceQueues'][_0x3e8853[_0x619a('0x66')]];if(_0x2515b5[_0x619a('0x50')]===_0x619a('0x51')){this[_0x619a('0x61')](_0x2515b5,_0x3e8853);}else if(_0x2515b5[_0x619a('0x50')]===_0x619a('0x67')){var _0x59cab6=this['createQueueSummaryReport'](_0x2515b5,_0x3e8853);ami['emit'](_0x619a('0x68'),_0x59cab6);}this[_0x619a('0x15')]['statusRequests']-=0x1;var _0x57a459=this[_0x619a('0x15')][_0x619a('0x69')]>0x0?!![]:![];if(!_0x57a459){return this[_0x619a('0x17')](this[_0x619a('0x15')][_0x619a('0x6a')]);}};VoiceQueueReport[_0x619a('0xa')][_0x619a('0x1a')]=function(_0x50d485){var _0x3dc013=this[_0x619a('0x15')]['id'];if(this[_0x619a('0x15')][_0x619a('0x65')][_0x3dc013]&&this[_0x619a('0x15')][_0x619a('0x65')][_0x3dc013][_0x50d485[_0x619a('0x5d')]]){this[_0x619a('0x15')][_0x619a('0x65')][_0x3dc013][_0x50d485[_0x619a('0x5d')]]['agents'][_0x619a('0x6b')](_0x50d485);}};VoiceQueueReport[_0x619a('0xa')][_0x619a('0x6c')]=function(_0x1bfad1){var _0x1af4f4=this;try{if(this[_0x619a('0x55')](_0x1bfad1)&&this['isNotNull'](_0x1bfad1['queue'])){logger[_0x619a('0x45')](_0x619a('0x6d'),util[_0x619a('0x3e')](_0x1bfad1,{'showHidden':![],'depth':null}));var _0x261e52=this[_0x619a('0x13')][_0x1bfad1[_0x619a('0x66')]];if(_0x261e52){logger[_0x619a('0x45')](_0x619a('0x6e'),_0x261e52[_0x619a('0x53')]);this[_0x619a('0x15')][_0x619a('0x58')][_0x261e52[_0x619a('0x53')]]={'summaryEvent':_0x1bfad1};this['summary'][_0x619a('0x69')]+=0x1;return ami['Action']({'action':_0x619a('0x65'),'queue':_0x261e52[_0x619a('0x53')]})['then'](function(_0x4305e1){if(!_0x1af4f4['summary']['queuestatus'][_0x1bfad1['actionid']]){_0x1af4f4[_0x619a('0x15')][_0x619a('0x65')][_0x1bfad1[_0x619a('0x5d')]]={};}_0x1af4f4['summary']['queuestatus'][_0x1bfad1[_0x619a('0x5d')]][_0x4305e1[_0x619a('0x5d')]]={'queue':_0x261e52['name'],'agents':[]};})[_0x619a('0x37')](function(_0x26680f){throw _0x26680f;});}}}catch(_0x1ae3ee){logger[_0x619a('0x39')]('[voiceQueueReport][queuesummary]',util[_0x619a('0x3e')](_0x1ae3ee,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x619a('0xa')]['syncQueueSummaryComplete']=function(_0x511aa9){if(this['summary'][_0x619a('0x69')]>0x0){this[_0x619a('0x15')]['completeEvent']=_0x511aa9;return;}logger[_0x619a('0x45')](_0x619a('0x6f'),util[_0x619a('0x3e')](_0x511aa9,{'showHidden':![],'depth':null}));this[_0x619a('0x15')]=initializeSummary();ami[_0x619a('0x43')]('custom:queuesummarycomplete',{});};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x1e1cb7){try{if(this[_0x619a('0x55')](_0x1e1cb7)){logger[_0x619a('0x45')](_0x619a('0x70'),_0x1e1cb7[_0x619a('0x47')],util[_0x619a('0x3e')](_0x1e1cb7,{'showHidden':![],'depth':null}));if(_[_0x619a('0x56')](this[_0x619a('0x3b')][_0x1e1cb7[_0x619a('0x47')]])){this['queueReports'][_0x1e1cb7['uniqueid']]=[];}if(_[_0x619a('0x56')](this[_0x619a('0x11')][_0x1e1cb7[_0x619a('0x47')]])){this[_0x619a('0x11')][_0x1e1cb7[_0x619a('0x47')]]={};}var _0x3aa819=new QueueReport();_0x3aa819['queue']=_0x1e1cb7[_0x619a('0x66')];_0x3aa819[_0x619a('0x50')]=this[_0x619a('0x13')][_0x3aa819[_0x619a('0x66')]]&&this[_0x619a('0x13')][_0x3aa819[_0x619a('0x66')]][_0x619a('0x50')]?this[_0x619a('0x13')][_0x3aa819[_0x619a('0x66')]]['type']||_0x619a('0x51'):_0x619a('0x51');_0x3aa819[_0x619a('0x71')]=moment()[_0x619a('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x3aa819['position']=_0x1e1cb7[_0x619a('0x72')];_0x3aa819[_0x619a('0x73')]=_0x1e1cb7['count'];_0x3aa819[_0x619a('0x47')]=_0x1e1cb7['uniqueid'];logger[_0x619a('0x74')](_0x619a('0x75'),_0x3aa819['queue'],_0x3aa819[_0x619a('0x50')]);Object[_0x619a('0x63')](_0x3aa819,_[_0x619a('0x76')](_0x1e1cb7,_['keys'](_0x3aa819)));this['queueReports'][_0x1e1cb7['uniqueid']][_0x619a('0x6b')](_0x3aa819);this[_0x619a('0x11')][_0x1e1cb7[_0x619a('0x47')]]=_0x3aa819;this[_0x619a('0x44')](_0x3aa819,_0x619a('0x1c'));}}catch(_0x37f47b){logger[_0x619a('0x39')](_0x619a('0x70'),_0x1e1cb7['uniqueid'],util[_0x619a('0x3e')](_0x37f47b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x619a('0x1d')]=function(_0x460d7e){try{if(this[_0x619a('0x55')](_0x460d7e)){logger[_0x619a('0x45')](_0x619a('0x77'),_0x460d7e[_0x619a('0x47')],util[_0x619a('0x3e')](_0x460d7e,{'showHidden':![],'depth':null}));if(this[_0x619a('0x3b')][_0x460d7e[_0x619a('0x47')]]){var _0x1461b6=_['last'](this[_0x619a('0x3b')][_0x460d7e[_0x619a('0x47')]]);_0x1461b6[_0x619a('0x33')]=![];_0x1461b6[_0x619a('0x78')]=null;_0x1461b6['holdtime']=_0x460d7e[_0x619a('0x79')];_0x1461b6['originalposition']=_0x460d7e[_0x619a('0x7a')];_0x1461b6[_0x619a('0x32')]=!![];_0x1461b6[_0x619a('0x7b')]=moment()[_0x619a('0x4c')](_0x619a('0x7c'));_0x1461b6[_0x619a('0x4b')]=_0x619a('0x7d');_0x1461b6[_0x619a('0x7e')]=null;logger[_0x619a('0x74')](_0x619a('0x7f'),_0x1461b6[_0x619a('0x66')],_0x1461b6[_0x619a('0x50')]);this[_0x619a('0x11')][_0x460d7e[_0x619a('0x47')]]=_0x1461b6;this['emitVoiceQueueChannelRemove'](_0x1461b6,'queuecallerabandon');}}}catch(_0x3717fd){logger[_0x619a('0x39')](_0x619a('0x77'),_0x460d7e[_0x619a('0x47')],util[_0x619a('0x3e')](_0x3717fd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x619a('0xa')]['syncQueueCallerLeave']=function(_0xf39fbd){try{if(this[_0x619a('0x55')](_0xf39fbd)){logger[_0x619a('0x45')](_0x619a('0x80'),_0xf39fbd[_0x619a('0x47')],util[_0x619a('0x3e')](_0xf39fbd,{'showHidden':![],'depth':null}));if(this['queueReports'][_0xf39fbd['uniqueid']]){var _0x1305c4=_['last'](this['queueReports'][_0xf39fbd[_0x619a('0x47')]]);_0x1305c4[_0x619a('0x81')]=moment()[_0x619a('0x4c')](_0x619a('0x7c'));_0x1305c4['connectedlinenum']=_0xf39fbd[_0x619a('0x82')];_0x1305c4[_0x619a('0x83')]=_0xf39fbd['connectedlinename'];logger[_0x619a('0x74')](_0x619a('0x84'),_0x1305c4['queue'],_0x1305c4[_0x619a('0x50')],_0xf39fbd[_0x619a('0x82')],_0xf39fbd[_0x619a('0x83')]);this[_0x619a('0x11')][_0xf39fbd[_0x619a('0x47')]]=_0x1305c4;this[_0x619a('0x44')](_0x1305c4,_0x619a('0x1e'));}}}catch(_0x2e0097){logger[_0x619a('0x39')]('[%s][voiceQueueReport][queuecallerleave]',_0xf39fbd[_0x619a('0x47')],util['inspect'](_0x2e0097,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentConnect']=function(_0x23ea5d){try{if(this[_0x619a('0x55')](_0x23ea5d)){logger[_0x619a('0x45')](_0x619a('0x85'),_0x23ea5d['uniqueid'],util[_0x619a('0x3e')](_0x23ea5d,{'showHidden':![],'depth':null}));if(this[_0x619a('0x3b')][_0x23ea5d['uniqueid']]){var _0x115131=_[_0x619a('0x86')](this[_0x619a('0x3b')][_0x23ea5d['uniqueid']]);_0x115131[_0x619a('0x33')]=!![];_0x115131['queuecallerexitreason']='COMPLETEDBYAGENT';logger[_0x619a('0x74')](_0x619a('0x87'),_0x115131['queue'],_0x115131[_0x619a('0x50')]);}}}catch(_0x27f902){logger['error']('[%s][voiceQueueReport][agentconnect]',_0x23ea5d[_0x619a('0x47')],util[_0x619a('0x3e')](_0x27f902,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x361459){try{if(this[_0x619a('0x55')](_0x361459)){logger[_0x619a('0x45')](_0x619a('0x88'),_0x361459[_0x619a('0x47')],util[_0x619a('0x3e')](_0x361459,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x361459[_0x619a('0x47')]]){var _0x4a99a1=_[_0x619a('0x86')](this[_0x619a('0x3b')][_0x361459[_0x619a('0x47')]]);_0x4a99a1[_0x619a('0x32')]=![];_0x4a99a1[_0x619a('0x7b')]=null;_0x4a99a1[_0x619a('0x89')]=!![];_0x4a99a1['lastAssignedTo']=_0x361459[_0x619a('0x8a')];_0x4a99a1[_0x619a('0x79')]=_0x361459[_0x619a('0x79')];_0x4a99a1[_0x619a('0x33')]=!![];_0x4a99a1[_0x619a('0x31')]=![];_0x4a99a1[_0x619a('0x8b')]=null;if(!_0x4a99a1[_0x619a('0x8c')]){if(_0x361459[_0x619a('0x8d')]==_0x619a('0x8c')){_0x4a99a1['queuecallerexitreason']='COMPLETED';logger[_0x619a('0x74')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x4a99a1[_0x619a('0x66')],_0x4a99a1[_0x619a('0x50')]);}else{if(_[_0x619a('0x8e')](_0x361459[_0x619a('0x36')]['toLowerCase'](),_0x619a('0x8f'))){if(this['queueReports'][_0x361459[_0x619a('0x90')]]){var _0x4097ae=_[_0x619a('0x86')](this[_0x619a('0x3b')][_0x361459['linkedid']]);_0x4097ae['queuecallercomplete']=![];_0x4097ae['queuecallerexit']=!![];_0x4097ae['queuecallerexitAt']=moment(_0x4a99a1['queuecallerjoinAt'])['add'](_0x361459[_0x619a('0x79')],_0x619a('0x91'))[_0x619a('0x4c')](_0x619a('0x7c'));_0x4097ae[_0x619a('0x4b')]=_0x619a('0x92');_0x4097ae['transfer']=!![];_0x4097ae[_0x619a('0x93')]='FORWARD';_0x4097ae['transferexten']=_0x361459['destexten'];_0x4097ae['transferuniqueid']=_0x361459['uniqueid'];logger[_0x619a('0x74')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x4097ae[_0x619a('0x66')],_0x4097ae[_0x619a('0x50')]);var _0x18feb8=this['queueReports'][_0x361459[_0x619a('0x90')]];this[_0x619a('0x3b')][_0x361459[_0x619a('0x90')]]=this['queueReports'][_0x361459[_0x619a('0x47')]];this[_0x619a('0x3b')][_0x361459[_0x619a('0x47')]]=_0x18feb8;}}else{_0x4a99a1[_0x619a('0x4b')]=_0x619a('0x94')+_0x361459[_0x619a('0x8d')][_0x619a('0x95')]();logger[_0x619a('0x74')](_0x619a('0x96'),_0x4a99a1[_0x619a('0x66')],_0x4a99a1['type'],_0x4a99a1['queuecallerexitreason']);}}}this[_0x619a('0x11')][_0x361459[_0x619a('0x47')]]=_0x4a99a1;}}}catch(_0x3c28bd){logger['error'](_0x619a('0x88'),_0x361459[_0x619a('0x47')],util[_0x619a('0x3e')](_0x3c28bd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x619a('0xa')][_0x619a('0x97')]=function(_0x49b4aa){try{if(this[_0x619a('0x55')](_0x49b4aa)){logger[_0x619a('0x45')]('[%s][voiceQueueReport][varset]',_0x49b4aa[_0x619a('0x47')],util[_0x619a('0x3e')](_0x49b4aa,{'showHidden':![],'depth':null}));this[_0x619a('0x98')](_0x49b4aa['uniqueid'],_[_0x619a('0x99')](_0x49b4aa[_0x619a('0x9a')])[0x0],_0x49b4aa[_0x619a('0x9b')]);if(this['queueReports'][_0x49b4aa['uniqueid']]){var _0x23af52=_['last'](this[_0x619a('0x3b')][_0x49b4aa['uniqueid']]);if(_0x23af52){if(this[_0x619a('0x55')](_0x49b4aa[_0x619a('0x9a')])&&this[_0x619a('0x55')](_0x49b4aa[_0x619a('0x9a')][_0x619a('0x65')])){switch(_0x49b4aa['value']){case _0x619a('0x9c'):_0x23af52[_0x619a('0x31')]=![];_0x23af52[_0x619a('0x8b')]=null;break;case'TIMEOUT':_0x23af52['lastevent']=_0x619a('0x9d');_0x23af52[_0x619a('0x31')]=!![];_0x23af52[_0x619a('0x8b')]=moment()[_0x619a('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x23af52[_0x619a('0x81')]=moment()[_0x619a('0x4c')](_0x619a('0x7c'));logger[_0x619a('0x45')](_0x619a('0x9e'),_0x49b4aa['uniqueid'],util[_0x619a('0x3e')](_0x23af52,{'showHidden':![],'depth':null}));ami[_0x619a('0x43')](_0x619a('0x9f'),_0x23af52);break;default:_0x23af52[_0x619a('0x31')]=!![];_0x23af52[_0x619a('0x8b')]=moment()[_0x619a('0x4c')](_0x619a('0x7c'));_0x23af52[_0x619a('0x81')]=moment()[_0x619a('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');}_0x23af52['queuecallerabandon']=![];_0x23af52['queuecallerabandonAt']=null;_0x23af52[_0x619a('0x4b')]=_0x49b4aa[_0x619a('0x9b')];this[_0x619a('0x11')][_0x49b4aa[_0x619a('0x47')]]=_0x23af52;this[_0x619a('0x41')](_0x23af52,'varset');}else if(this[_0x619a('0x55')](_0x49b4aa[_0x619a('0x9a')])&&this[_0x619a('0x55')](_0x49b4aa[_0x619a('0x9a')][_0x619a('0xa0')])){if(!_0x23af52[_0x619a('0x32')]){_0x23af52[_0x619a('0x31')]=!![];_0x23af52[_0x619a('0x8b')]=moment()[_0x619a('0x4c')](_0x619a('0x7c'));_0x23af52[_0x619a('0x4b')]=_0x619a('0xa1');_0x23af52[_0x619a('0x81')]=moment()['format'](_0x619a('0x7c'));this['channels'][_0x49b4aa['uniqueid']]=_0x23af52;}}logger[_0x619a('0x74')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x49b4aa['uniqueid'],_0x23af52[_0x619a('0x66')],_0x23af52[_0x619a('0x50')],_[_0x619a('0x99')](_0x49b4aa['variable'])[0x0],_0x49b4aa['value']);_0x23af52[_0x619a('0x16')]=this[_0x619a('0x16')][_0x49b4aa[_0x619a('0x47')]];}}}}catch(_0x36b363){logger[_0x619a('0x39')](_0x619a('0xa2'),_0x49b4aa[_0x619a('0x47')],util[_0x619a('0x3e')](_0x36b363,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x619a('0xa')][_0x619a('0x98')]=function(_0x5c5d1c,_0x2ca5c8,_0x4a332c){var _0xe48e6=['rtpaudioqos',_0x619a('0xa3'),_0x619a('0xa4'),_0x619a('0xa5'),_0x619a('0xa6'),_0x619a('0xa7'),'rtpaudioqosrtt',_0x619a('0xa8'),_0x619a('0xa9'),'sipuri','bridgepeer',_0x619a('0xaa'),_0x619a('0xab'),_0x619a('0xac'),_0x619a('0xad'),'memberlastcall',_0x619a('0x8a'),_0x619a('0xae'),_0x619a('0xaf')];if(!_[_0x619a('0xb0')](_0x2ca5c8)&&!_[_0x619a('0xb1')](_0xe48e6,_0x2ca5c8)){if(_[_0x619a('0x56')](this[_0x619a('0x16')][_0x5c5d1c])){this['variables'][_0x5c5d1c]={};}this[_0x619a('0x16')][_0x5c5d1c][_0x2ca5c8]=_0x4a332c;}};VoiceQueueReport['prototype'][_0x619a('0xb2')]=function(_0x4061a9,_0x1651d4,_0x2805f1){try{var _0xf61a25={};if(this[_0x619a('0x3b')][_0x4061a9]){for(var _0x13a49b=0x0;_0x13a49b{delete this[_0x619a('0x11')][_0x2decc3];},_0xb57c6c);}};module[_0x619a('0xf1')]=VoiceQueueReport; \ No newline at end of file +var _0x4e46=['[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentconnect]','assigned','membername','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','local/','linkedid','queuecallerexitAt','add','seconds','transfertype','FORWARD','transferexten','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','addVariable','variable','value','CONTINUE','TIMEOUT','lastevent','timeout','custom:timeout','queuecallerleaveAt','[%s][voiceQueueReport][varset]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','handleHangup','length','sumHoldTime','diff','sumDuration','milliseconds','total','answered','sumBillable','queuecallercompleteAt','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','cause-txt','cause','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','deleteChannelAfterTimeout','[%s][voiceQueueReport][hangup]','[%s][voiceQueueReport][attendedtransfer]','secondtransfererexten','transferuniqueid','secondtransfereruniqueid','ATTENDED','transfereeuniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','mohtime','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','applicationdata','appdata','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceQueueReport][newexten]','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','../model/voiceQueueSummary','localhost','socket.io-emitter','enqueue','tail','finally','sequence','queueReports','realtime','agents','channels','queueChannels','voiceQueues','campaigns','summary','queuesummary','syncQueueSummary','queuesummarycomplete','syncQueueSummaryComplete','bind','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','queuecallerleave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','originated','hasOwnProperty','talking','pTalking','queueStatusComplete','unlockRR','queuecallerexit','queuecallercomplete','prototype','clearZombieChannels','switch','isNil','channel','error','inspect','[%s][voiceQueueReport][checkQueueReport]','variables','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emit','emitVoiceQueueChannelSave',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','voice_queue_presence:save','emitVoiceQueueChannelRemove','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','ATTENDEDTRANSFER','voice_queue_channel:remove','voice_queue_presence:remove','type','inbound','name','voice_queue:save','isNotNull','isUndefined','Action','queues','catch','[voiceQueueReport][queues]','isRunning','then','actionid','[voiceQueueReport][queuesummary]','summaryEvent','createReport','handleInboundQueueSummaryReport','assign','queuestatus','queue','outbound','custom:queuesummary','statusRequests','completeEvent','push','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','keys','[%s][voiceQueueReport][queuecallerjoin]','syncQueueCallerAbandon','[%s][voiceQueueReport][queuecallerabandon]','last','holdtime','originalposition','queuecallerabandonAt','ABANDONED','lastAssignedTo','info','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','syncQueueCallerLeave','[%s][voiceQueueReport][queuecallerleave]','connectedlinenum','connectedlinename','COMPLETEDBYAGENT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e46,0x68));var _0x64e4=function(_0x209d87,_0x203554){_0x209d87=_0x209d87-0x0;var _0x17eeb3=_0x4e46[_0x209d87];return _0x17eeb3;};'use strict';var _=require(_0x64e4('0x0'));var moment=require(_0x64e4('0x1'));var util=require(_0x64e4('0x2'));var Redis=require('ioredis');var config=require(_0x64e4('0x3'));var logger=require(_0x64e4('0x4'))(_0x64e4('0x5'));var ami=require(_0x64e4('0x6'));var QueueReport=require(_0x64e4('0x7'));var VoiceQueueSummary=require(_0x64e4('0x8'));config['redis']=_['defaults'](config['redis'],{'host':_0x64e4('0x9'),'port':0x18eb});var io=require(_0x64e4('0xa'))(new Redis(config['redis']));var Sequence=function(){};Sequence['prototype'][_0x64e4('0xb')]=function(_0x20a681){this[_0x64e4('0xc')]=this['tail']?this[_0x64e4('0xc')][_0x64e4('0xd')](_0x20a681):_0x20a681();};function VoiceQueueReport(_0x4d5b4c){this[_0x64e4('0xe')]=new Sequence();this[_0x64e4('0xf')]={};this[_0x64e4('0x10')]=_0x4d5b4c;this[_0x64e4('0x11')]=_0x4d5b4c[_0x64e4('0x11')];this[_0x64e4('0x12')]=_0x4d5b4c[_0x64e4('0x13')];this[_0x64e4('0x14')]=_0x4d5b4c['voiceQueues'];this['campaigns']=_0x4d5b4c[_0x64e4('0x15')];this[_0x64e4('0x16')]=initializeSummary();this['variables']={};ami['on'](_0x64e4('0x17'),this[_0x64e4('0x18')]['bind'](this));ami['on'](_0x64e4('0x19'),this[_0x64e4('0x1a')][_0x64e4('0x1b')](this));ami['on'](_0x64e4('0x1c'),this[_0x64e4('0x1d')][_0x64e4('0x1b')](this));ami['on'](_0x64e4('0x1e'),this[_0x64e4('0x1f')][_0x64e4('0x1b')](this));ami['on'](_0x64e4('0x20'),this[_0x64e4('0x21')]['bind'](this));ami['on'](_0x64e4('0x22'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x64e4('0x23'),this['syncQueueCallerLeave'][_0x64e4('0x1b')](this));ami['on'](_0x64e4('0x24'),this[_0x64e4('0x25')][_0x64e4('0x1b')](this));ami['on'](_0x64e4('0x26'),this[_0x64e4('0x27')]['bind'](this));ami['on'](_0x64e4('0x28'),this[_0x64e4('0x29')][_0x64e4('0x1b')](this));ami['on'](_0x64e4('0x2a'),this[_0x64e4('0x2b')][_0x64e4('0x1b')](this));ami['on'](_0x64e4('0x2c'),this[_0x64e4('0x2d')][_0x64e4('0x1b')](this));ami['on']('musiconholdstart',this[_0x64e4('0x2e')][_0x64e4('0x1b')](this));ami['on'](_0x64e4('0x2f'),this[_0x64e4('0x30')]['bind'](this));ami['on']('attendedtransfer',this[_0x64e4('0x31')][_0x64e4('0x1b')](this));ami['on']('blindtransfer',this[_0x64e4('0x32')]['bind'](this));this[_0x64e4('0x33')]();this[_0x64e4('0x34')]();}function clearChannels(_0x3233f3){if(!_[_0x64e4('0x35')](_0x3233f3)){for(var _0x3bee4d in _0x3233f3){if(_0x3233f3['hasOwnProperty'](_0x3bee4d)){delete _0x3233f3[_0x3bee4d];}}}}function clearCampaigns(_0x1ea84f){if(!_[_0x64e4('0x35')](_0x1ea84f)){for(var _0x29ecbd in _0x1ea84f){if(_0x1ea84f['hasOwnProperty'](_0x29ecbd)){_0x1ea84f[_0x29ecbd][_0x64e4('0x36')]=0x0;}}}}function clearVoiceQueues(_0x205e29){if(!_['isEmpty'](_0x205e29)){for(var _0x1e8ff5 in _0x205e29){if(_0x205e29[_0x64e4('0x37')](_0x1e8ff5)){_0x205e29[_0x1e8ff5][_0x64e4('0x36')]=0x0;_0x205e29[_0x1e8ff5][_0x64e4('0x38')]=0x0;_0x205e29[_0x1e8ff5][_0x64e4('0x39')]=0x0;_0x205e29[_0x1e8ff5]['waiting']=0x0;_0x205e29[_0x1e8ff5][_0x64e4('0x3a')]=!![];}}}}function clearAgentBooked(_0x315dd9){if(!_[_0x64e4('0x35')](_0x315dd9)){for(var _0x114ff6 in _0x315dd9){if(_0x315dd9['hasOwnProperty'](_0x114ff6)){_0x315dd9[_0x114ff6][_0x64e4('0x3b')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x2a39cb){return _0x2a39cb[_0x64e4('0x3c')]||_0x2a39cb[_0x64e4('0x22')]||_0x2a39cb[_0x64e4('0x3d')];}VoiceQueueReport[_0x64e4('0x3e')][_0x64e4('0x3f')]=function(){var _0x51c6dd=this;for(var _0x42d90f in this['channels']){if(this[_0x64e4('0x12')]['hasOwnProperty'](_0x42d90f)&&!this[_0x64e4('0x12')][_0x42d90f][_0x64e4('0x40')]){this[_0x64e4('0xe')]['enqueue'](function(){if(!_[_0x64e4('0x41')](_0x51c6dd[_0x64e4('0x12')][_0x42d90f])){return ami['Action']({'action':'status','channel':_0x51c6dd[_0x64e4('0x12')][_0x42d90f][_0x64e4('0x42')]})['catch'](function(_0xb1f020){if(_0xb1f020['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x51c6dd[_0x64e4('0x12')][_0x42d90f]){delete _0x51c6dd['channels'][_0x42d90f];logger[_0x64e4('0x43')]('[%s][voiceQueueReport][checkChannel]',_0x42d90f,util[_0x64e4('0x44')](_0xb1f020,{'showHidden':![],'depth':null}));}if(_0x51c6dd[_0x64e4('0xf')][_0x42d90f]){delete _0x51c6dd[_0x64e4('0xf')][_0x42d90f];logger[_0x64e4('0x43')](_0x64e4('0x45'),_0x42d90f,util[_0x64e4('0x44')](_0xb1f020,{'showHidden':![],'depth':null}));}if(_0x51c6dd[_0x64e4('0x46')][_0x42d90f]){delete _0x51c6dd[_0x64e4('0x46')][_0x42d90f];logger[_0x64e4('0x43')]('[%s][voiceQueueReport][checkVariables]',_0x42d90f,util[_0x64e4('0x44')](_0xb1f020,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x64e4('0x3e')]['syncFullyBooted']=function(){logger[_0x64e4('0x43')](_0x64e4('0x47'));clearChannels(this[_0x64e4('0x12')]);this[_0x64e4('0x48')](this[_0x64e4('0xf')]);clearAgentBooked(this[_0x64e4('0x11')]);clearVoiceQueues(this[_0x64e4('0x14')]);clearCampaigns(this[_0x64e4('0x15')]);this['summary']=initializeSummary();};VoiceQueueReport[_0x64e4('0x3e')][_0x64e4('0x48')]=function(_0x324038){var _0x33a209=this;if(!_[_0x64e4('0x35')](_0x324038)){for(var _0x467598 in _0x324038){if(_0x324038[_0x64e4('0x37')](_0x467598)){_0x33a209['emitVoiceQueueChannelRemove'](_0x324038[_0x467598],'clearqueuereport');delete _0x324038[_0x467598];}}}};VoiceQueueReport[_0x64e4('0x3e')][_0x64e4('0x49')]=function(_0x35ed1f,_0x5914ca,_0x1d4f65){io['to'](_0x35ed1f)[_0x64e4('0x49')](_0x5914ca,_0x1d4f65);};VoiceQueueReport[_0x64e4('0x3e')][_0x64e4('0x4a')]=function(_0x17cf5c,_0x3d63fd){logger['debug']('[%s][voiceQueueReport]['+_0x3d63fd+_0x64e4('0x4b'),_0x17cf5c[_0x64e4('0x4c')],util[_0x64e4('0x44')](_0x17cf5c,{'showHidden':![],'depth':null}));this[_0x64e4('0x49')](util[_0x64e4('0x4d')](_0x64e4('0x4e'),_0x17cf5c['queue']),'voice_queue_channel:save',_0x17cf5c);io[_0x64e4('0x49')](_0x64e4('0x4f'),_0x17cf5c);};VoiceQueueReport['prototype'][_0x64e4('0x50')]=function(_0x23102c,_0x3718d4){logger[_0x64e4('0x51')](_0x64e4('0x52')+_0x3718d4+_0x64e4('0x53'),_0x23102c[_0x64e4('0x4c')],util['inspect'](_0x23102c,{'showHidden':![],'depth':null}));if(_0x23102c[_0x64e4('0x54')]===_0x64e4('0x55')){return;}this[_0x64e4('0x49')](util[_0x64e4('0x4d')](_0x64e4('0x4e'),_0x23102c['queue']),_0x64e4('0x56'),_0x23102c);io[_0x64e4('0x49')](_0x64e4('0x57'),_0x23102c);};VoiceQueueReport['prototype']['emitInboundVoiceQueueSummary']=function(_0x3e7d98){if(_0x3e7d98[_0x64e4('0x58')]===_0x64e4('0x59')){logger[_0x64e4('0x51')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x64e4('0x44')](_0x3e7d98,{'showHidden':![],'depth':null}));this[_0x64e4('0x49')](util[_0x64e4('0x4d')](_0x64e4('0x4e'),_0x3e7d98[_0x64e4('0x5a')]),_0x64e4('0x5b'),_0x3e7d98);}};VoiceQueueReport['prototype'][_0x64e4('0x5c')]=function(_0x38ddb2){return _0x38ddb2!==null&&!_[_0x64e4('0x5d')](_0x38ddb2);};VoiceQueueReport[_0x64e4('0x3e')]['loopQueueShow']=function(){var _0x33ebc3=this;setInterval(function(){_0x33ebc3['clearZombieChannels']();ami[_0x64e4('0x5e')]({'action':_0x64e4('0x5f')})[_0x64e4('0x60')](function(_0x353f39){logger['error'](_0x64e4('0x61'),util[_0x64e4('0x44')](_0x353f39,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x64e4('0x3e')][_0x64e4('0x33')]=function(){var _0x442cc0=this;setInterval(function(){if(!_0x442cc0['summary'][_0x64e4('0x62')]){return ami[_0x64e4('0x5e')]({'action':_0x64e4('0x17')})[_0x64e4('0x63')](function(_0x261565){_0x442cc0[_0x64e4('0x16')]['id']=_0x261565[_0x64e4('0x64')];_0x442cc0[_0x64e4('0x16')]['isRunning']=!![];_0x442cc0['summary']['queuestatus'][_0x261565[_0x64e4('0x64')]]={};})[_0x64e4('0x60')](function(_0x376392){logger[_0x64e4('0x43')](_0x64e4('0x65'),util[_0x64e4('0x44')](_0x376392,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype']['createQueueSummaryReport']=function(_0x221d05,_0x37abae){var _0x9aa769;if(this['summary']&&this[_0x64e4('0x16')][_0x64e4('0x5f')]&&this['summary'][_0x64e4('0x5f')][_0x221d05['name']]){_0x9aa769=this['summary']['queues'][_0x221d05[_0x64e4('0x5a')]][_0x64e4('0x66')];}var _0x30cf08=new VoiceQueueSummary(_0x221d05);return _0x30cf08[_0x64e4('0x67')](_0x37abae['agents'],this[_0x64e4('0x11')],_0x9aa769,this[_0x64e4('0x10')][_0x64e4('0x12')]);};VoiceQueueReport['prototype'][_0x64e4('0x68')]=function(_0x2291ff,_0x3ffdb2){var _0x5883c1=this['createQueueSummaryReport'](_0x2291ff,_0x3ffdb2);var _0x78b348=![];_0x78b348=_0x5883c1['compareToInboundQueue'](_0x2291ff);if(_0x78b348){Object[_0x64e4('0x69')](_0x2291ff,_0x5883c1);this['realtime'][_0x64e4('0x14')][_0x2291ff['name']]=_0x2291ff;this['emitInboundVoiceQueueSummary'](_0x5883c1);}};VoiceQueueReport[_0x64e4('0x3e')][_0x64e4('0x1f')]=function(_0x6e1b35){var _0x1bfaa7=null;var _0x57f036=this[_0x64e4('0x16')]['id'];if(this[_0x64e4('0x16')][_0x64e4('0x6a')][_0x57f036]){_0x1bfaa7=this[_0x64e4('0x16')][_0x64e4('0x6a')][_0x57f036][_0x6e1b35['actionid']];}if(!_0x1bfaa7){this['summary']=initializeSummary();return;}var _0x292d66=this['voiceQueues'][_0x1bfaa7[_0x64e4('0x6b')]];if(_0x292d66['type']===_0x64e4('0x59')){this[_0x64e4('0x68')](_0x292d66,_0x1bfaa7);}else if(_0x292d66[_0x64e4('0x58')]===_0x64e4('0x6c')){var _0x724ee2=this['createQueueSummaryReport'](_0x292d66,_0x1bfaa7);ami[_0x64e4('0x49')](_0x64e4('0x6d'),_0x724ee2);}this[_0x64e4('0x16')][_0x64e4('0x6e')]-=0x1;var _0x49359f=this[_0x64e4('0x16')][_0x64e4('0x6e')]>0x0?!![]:![];if(!_0x49359f){return this[_0x64e4('0x1a')](this[_0x64e4('0x16')][_0x64e4('0x6f')]);}};VoiceQueueReport[_0x64e4('0x3e')][_0x64e4('0x1d')]=function(_0x533f6d){var _0x446012=this[_0x64e4('0x16')]['id'];if(this[_0x64e4('0x16')][_0x64e4('0x6a')][_0x446012]&&this[_0x64e4('0x16')][_0x64e4('0x6a')][_0x446012][_0x533f6d[_0x64e4('0x64')]]){this[_0x64e4('0x16')][_0x64e4('0x6a')][_0x446012][_0x533f6d['actionid']][_0x64e4('0x11')][_0x64e4('0x70')](_0x533f6d);}};VoiceQueueReport[_0x64e4('0x3e')]['syncQueueSummary']=function(_0x519817){var _0x1d64aa=this;try{if(this['isNotNull'](_0x519817)&&this[_0x64e4('0x5c')](_0x519817[_0x64e4('0x6b')])){logger['debug']('[voiceQueueReport][queuesummary]\x20event:',util[_0x64e4('0x44')](_0x519817,{'showHidden':![],'depth':null}));var _0xf2e17f=this[_0x64e4('0x14')][_0x519817[_0x64e4('0x6b')]];if(_0xf2e17f){logger[_0x64e4('0x51')](_0x64e4('0x71'),_0xf2e17f[_0x64e4('0x5a')]);this['summary'][_0x64e4('0x5f')][_0xf2e17f[_0x64e4('0x5a')]]={'summaryEvent':_0x519817};this[_0x64e4('0x16')]['statusRequests']+=0x1;return ami[_0x64e4('0x5e')]({'action':'queuestatus','queue':_0xf2e17f['name']})[_0x64e4('0x63')](function(_0x4ef929){if(!_0x1d64aa[_0x64e4('0x16')][_0x64e4('0x6a')][_0x519817[_0x64e4('0x64')]]){_0x1d64aa[_0x64e4('0x16')][_0x64e4('0x6a')][_0x519817[_0x64e4('0x64')]]={};}_0x1d64aa[_0x64e4('0x16')][_0x64e4('0x6a')][_0x519817[_0x64e4('0x64')]][_0x4ef929[_0x64e4('0x64')]]={'queue':_0xf2e17f[_0x64e4('0x5a')],'agents':[]};})[_0x64e4('0x60')](function(_0x216451){throw _0x216451;});}}}catch(_0x16d78b){logger[_0x64e4('0x43')](_0x64e4('0x65'),util[_0x64e4('0x44')](_0x16d78b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x64e4('0x3e')][_0x64e4('0x1a')]=function(_0x452775){if(this[_0x64e4('0x16')][_0x64e4('0x6e')]>0x0){this['summary'][_0x64e4('0x6f')]=_0x452775;return;}logger[_0x64e4('0x51')](_0x64e4('0x72'),util[_0x64e4('0x44')](_0x452775,{'showHidden':![],'depth':null}));this[_0x64e4('0x16')]=initializeSummary();ami['emit'](_0x64e4('0x73'),{});};VoiceQueueReport['prototype'][_0x64e4('0x21')]=function(_0x4562db){try{if(this[_0x64e4('0x5c')](_0x4562db)){logger[_0x64e4('0x51')]('[%s][voiceQueueReport][queuecallerjoin]',_0x4562db[_0x64e4('0x4c')],util[_0x64e4('0x44')](_0x4562db,{'showHidden':![],'depth':null}));if(_[_0x64e4('0x5d')](this[_0x64e4('0xf')][_0x4562db[_0x64e4('0x4c')]])){this['queueReports'][_0x4562db[_0x64e4('0x4c')]]=[];}if(_[_0x64e4('0x5d')](this[_0x64e4('0x12')][_0x4562db['uniqueid']])){this[_0x64e4('0x12')][_0x4562db[_0x64e4('0x4c')]]={};}var _0x315d5a=new QueueReport();_0x315d5a[_0x64e4('0x6b')]=_0x4562db['queue'];_0x315d5a['type']=this[_0x64e4('0x14')][_0x315d5a[_0x64e4('0x6b')]]&&this[_0x64e4('0x14')][_0x315d5a[_0x64e4('0x6b')]]['type']?this[_0x64e4('0x14')][_0x315d5a[_0x64e4('0x6b')]]['type']||_0x64e4('0x59'):_0x64e4('0x59');_0x315d5a[_0x64e4('0x74')]=moment()[_0x64e4('0x4d')](_0x64e4('0x75'));_0x315d5a[_0x64e4('0x76')]=_0x4562db['position'];_0x315d5a[_0x64e4('0x77')]=_0x4562db[_0x64e4('0x77')];_0x315d5a[_0x64e4('0x4c')]=_0x4562db['uniqueid'];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x315d5a[_0x64e4('0x6b')],_0x315d5a['type']);Object['assign'](_0x315d5a,_['pick'](_0x4562db,_[_0x64e4('0x78')](_0x315d5a)));this[_0x64e4('0xf')][_0x4562db['uniqueid']][_0x64e4('0x70')](_0x315d5a);this[_0x64e4('0x12')][_0x4562db[_0x64e4('0x4c')]]=_0x315d5a;this[_0x64e4('0x4a')](_0x315d5a,_0x64e4('0x20'));}}catch(_0x444ea9){logger[_0x64e4('0x43')](_0x64e4('0x79'),_0x4562db[_0x64e4('0x4c')],util[_0x64e4('0x44')](_0x444ea9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x64e4('0x3e')][_0x64e4('0x7a')]=function(_0x283b6a){try{if(this[_0x64e4('0x5c')](_0x283b6a)){logger['debug'](_0x64e4('0x7b'),_0x283b6a[_0x64e4('0x4c')],util['inspect'](_0x283b6a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x283b6a[_0x64e4('0x4c')]]){var _0x443ae8=_[_0x64e4('0x7c')](this[_0x64e4('0xf')][_0x283b6a[_0x64e4('0x4c')]]);_0x443ae8[_0x64e4('0x3d')]=![];_0x443ae8['queuecallercompleteAt']=null;_0x443ae8[_0x64e4('0x7d')]=_0x283b6a[_0x64e4('0x7d')];_0x443ae8['originalposition']=_0x283b6a[_0x64e4('0x7e')];_0x443ae8[_0x64e4('0x22')]=!![];_0x443ae8[_0x64e4('0x7f')]=moment()[_0x64e4('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x443ae8[_0x64e4('0x54')]=_0x64e4('0x80');_0x443ae8[_0x64e4('0x81')]=null;logger[_0x64e4('0x82')](_0x64e4('0x83'),_0x443ae8['queue'],_0x443ae8[_0x64e4('0x58')]);this[_0x64e4('0x12')][_0x283b6a['uniqueid']]=_0x443ae8;this['emitVoiceQueueChannelRemove'](_0x443ae8,_0x64e4('0x22'));}}}catch(_0x21ad53){logger[_0x64e4('0x43')](_0x64e4('0x7b'),_0x283b6a[_0x64e4('0x4c')],util['inspect'](_0x21ad53,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x64e4('0x84')]=function(_0x4d5838){try{if(this[_0x64e4('0x5c')](_0x4d5838)){logger[_0x64e4('0x51')](_0x64e4('0x85'),_0x4d5838[_0x64e4('0x4c')],util[_0x64e4('0x44')](_0x4d5838,{'showHidden':![],'depth':null}));if(this[_0x64e4('0xf')][_0x4d5838[_0x64e4('0x4c')]]){var _0x3d1363=_[_0x64e4('0x7c')](this[_0x64e4('0xf')][_0x4d5838[_0x64e4('0x4c')]]);_0x3d1363['queuecallerleaveAt']=moment()[_0x64e4('0x4d')](_0x64e4('0x75'));_0x3d1363['connectedlinenum']=_0x4d5838[_0x64e4('0x86')];_0x3d1363[_0x64e4('0x87')]=_0x4d5838[_0x64e4('0x87')];logger[_0x64e4('0x82')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x3d1363['queue'],_0x3d1363['type'],_0x4d5838[_0x64e4('0x86')],_0x4d5838[_0x64e4('0x87')]);this[_0x64e4('0x12')][_0x4d5838[_0x64e4('0x4c')]]=_0x3d1363;this[_0x64e4('0x4a')](_0x3d1363,_0x64e4('0x23'));}}}catch(_0x3c5f78){logger[_0x64e4('0x43')](_0x64e4('0x85'),_0x4d5838[_0x64e4('0x4c')],util[_0x64e4('0x44')](_0x3c5f78,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x64e4('0x27')]=function(_0x4d12fc){try{if(this[_0x64e4('0x5c')](_0x4d12fc)){logger[_0x64e4('0x51')]('[%s][voiceQueueReport][agentconnect]',_0x4d12fc[_0x64e4('0x4c')],util['inspect'](_0x4d12fc,{'showHidden':![],'depth':null}));if(this[_0x64e4('0xf')][_0x4d12fc[_0x64e4('0x4c')]]){var _0x4cb103=_['last'](this[_0x64e4('0xf')][_0x4d12fc[_0x64e4('0x4c')]]);_0x4cb103[_0x64e4('0x3d')]=!![];_0x4cb103[_0x64e4('0x54')]=_0x64e4('0x88');logger[_0x64e4('0x82')](_0x64e4('0x89'),_0x4cb103[_0x64e4('0x6b')],_0x4cb103[_0x64e4('0x58')]);}}}catch(_0x5ea95d){logger[_0x64e4('0x43')](_0x64e4('0x8a'),_0x4d12fc[_0x64e4('0x4c')],util[_0x64e4('0x44')](_0x5ea95d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x64e4('0x3e')][_0x64e4('0x25')]=function(_0x31c0c7){try{if(this[_0x64e4('0x5c')](_0x31c0c7)){logger[_0x64e4('0x51')]('[%s][voiceQueueReport][agentcomplete]',_0x31c0c7[_0x64e4('0x4c')],util[_0x64e4('0x44')](_0x31c0c7,{'showHidden':![],'depth':null}));if(this[_0x64e4('0xf')][_0x31c0c7['uniqueid']]){var _0x4d40f2=_['last'](this['queueReports'][_0x31c0c7[_0x64e4('0x4c')]]);_0x4d40f2[_0x64e4('0x22')]=![];_0x4d40f2[_0x64e4('0x7f')]=null;_0x4d40f2[_0x64e4('0x8b')]=!![];_0x4d40f2[_0x64e4('0x81')]=_0x31c0c7[_0x64e4('0x8c')];_0x4d40f2[_0x64e4('0x7d')]=_0x31c0c7[_0x64e4('0x7d')];_0x4d40f2[_0x64e4('0x3d')]=!![];_0x4d40f2[_0x64e4('0x3c')]=![];_0x4d40f2['queuecallerexitAt']=null;if(!_0x4d40f2[_0x64e4('0x8d')]){if(_0x31c0c7[_0x64e4('0x8e')]==_0x64e4('0x8d')){_0x4d40f2[_0x64e4('0x54')]=_0x64e4('0x8f');logger[_0x64e4('0x82')](_0x64e4('0x90'),_0x4d40f2['queue'],_0x4d40f2['type']);}else{if(_[_0x64e4('0x91')](_0x31c0c7[_0x64e4('0x42')][_0x64e4('0x92')](),_0x64e4('0x93'))){if(this[_0x64e4('0xf')][_0x31c0c7['linkedid']]){var _0x21da38=_[_0x64e4('0x7c')](this['queueReports'][_0x31c0c7[_0x64e4('0x94')]]);_0x21da38[_0x64e4('0x3d')]=![];_0x21da38[_0x64e4('0x3c')]=!![];_0x21da38[_0x64e4('0x95')]=moment(_0x4d40f2[_0x64e4('0x74')])[_0x64e4('0x96')](_0x31c0c7[_0x64e4('0x7d')],_0x64e4('0x97'))['format'](_0x64e4('0x75'));_0x21da38[_0x64e4('0x54')]='FORWARDTRANSFER';_0x21da38[_0x64e4('0x8d')]=!![];_0x21da38[_0x64e4('0x98')]=_0x64e4('0x99');_0x21da38[_0x64e4('0x9a')]=_0x31c0c7['destexten'];_0x21da38['transferuniqueid']=_0x31c0c7[_0x64e4('0x4c')];logger[_0x64e4('0x82')](_0x64e4('0x9b'),_0x21da38[_0x64e4('0x6b')],_0x21da38['type']);var _0x37eebf=this[_0x64e4('0xf')][_0x31c0c7[_0x64e4('0x94')]];this[_0x64e4('0xf')][_0x31c0c7[_0x64e4('0x94')]]=this['queueReports'][_0x31c0c7[_0x64e4('0x4c')]];this[_0x64e4('0xf')][_0x31c0c7['uniqueid']]=_0x37eebf;}}else{_0x4d40f2[_0x64e4('0x54')]=_0x64e4('0x9c')+_0x31c0c7[_0x64e4('0x8e')][_0x64e4('0x9d')]();logger[_0x64e4('0x82')](_0x64e4('0x9e'),_0x4d40f2[_0x64e4('0x6b')],_0x4d40f2[_0x64e4('0x58')],_0x4d40f2[_0x64e4('0x54')]);}}}this[_0x64e4('0x12')][_0x31c0c7[_0x64e4('0x4c')]]=_0x4d40f2;}}}catch(_0x9dbbbf){logger[_0x64e4('0x43')]('[%s][voiceQueueReport][agentcomplete]',_0x31c0c7[_0x64e4('0x4c')],util[_0x64e4('0x44')](_0x9dbbbf,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x64e4('0x3e')][_0x64e4('0x29')]=function(_0x85d36b){try{if(this['isNotNull'](_0x85d36b)){logger[_0x64e4('0x51')]('[%s][voiceQueueReport][varset]',_0x85d36b[_0x64e4('0x4c')],util[_0x64e4('0x44')](_0x85d36b,{'showHidden':![],'depth':null}));this[_0x64e4('0x9f')](_0x85d36b[_0x64e4('0x4c')],_[_0x64e4('0x78')](_0x85d36b[_0x64e4('0xa0')])[0x0],_0x85d36b[_0x64e4('0xa1')]);if(this['queueReports'][_0x85d36b[_0x64e4('0x4c')]]){var _0x2347f0=_[_0x64e4('0x7c')](this[_0x64e4('0xf')][_0x85d36b['uniqueid']]);if(_0x2347f0){if(this[_0x64e4('0x5c')](_0x85d36b[_0x64e4('0xa0')])&&this['isNotNull'](_0x85d36b[_0x64e4('0xa0')]['queuestatus'])){switch(_0x85d36b[_0x64e4('0xa1')]){case _0x64e4('0xa2'):_0x2347f0[_0x64e4('0x3c')]=![];_0x2347f0['queuecallerexitAt']=null;break;case _0x64e4('0xa3'):_0x2347f0[_0x64e4('0xa4')]=_0x64e4('0xa5');_0x2347f0[_0x64e4('0x3c')]=!![];_0x2347f0['queuecallerexitAt']=moment()[_0x64e4('0x4d')](_0x64e4('0x75'));_0x2347f0['queuecallerleaveAt']=moment()[_0x64e4('0x4d')](_0x64e4('0x75'));logger[_0x64e4('0x51')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x85d36b[_0x64e4('0x4c')],util[_0x64e4('0x44')](_0x2347f0,{'showHidden':![],'depth':null}));ami[_0x64e4('0x49')](_0x64e4('0xa6'),_0x2347f0);break;default:_0x2347f0[_0x64e4('0x3c')]=!![];_0x2347f0['queuecallerexitAt']=moment()[_0x64e4('0x4d')](_0x64e4('0x75'));_0x2347f0[_0x64e4('0xa7')]=moment()[_0x64e4('0x4d')](_0x64e4('0x75'));}_0x2347f0[_0x64e4('0x22')]=![];_0x2347f0[_0x64e4('0x7f')]=null;_0x2347f0[_0x64e4('0x54')]=_0x85d36b[_0x64e4('0xa1')];this[_0x64e4('0x12')][_0x85d36b['uniqueid']]=_0x2347f0;this[_0x64e4('0x50')](_0x2347f0,_0x64e4('0x28'));}else if(this['isNotNull'](_0x85d36b['variable'])&&this[_0x64e4('0x5c')](_0x85d36b[_0x64e4('0xa0')]['queueposition'])){if(!_0x2347f0[_0x64e4('0x22')]){_0x2347f0[_0x64e4('0x3c')]=!![];_0x2347f0[_0x64e4('0x95')]=moment()[_0x64e4('0x4d')](_0x64e4('0x75'));_0x2347f0[_0x64e4('0x54')]='EXITWITHKEY';_0x2347f0[_0x64e4('0xa7')]=moment()[_0x64e4('0x4d')](_0x64e4('0x75'));this[_0x64e4('0x12')][_0x85d36b[_0x64e4('0x4c')]]=_0x2347f0;}}logger[_0x64e4('0x82')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x85d36b['uniqueid'],_0x2347f0['queue'],_0x2347f0[_0x64e4('0x58')],_[_0x64e4('0x78')](_0x85d36b[_0x64e4('0xa0')])[0x0],_0x85d36b[_0x64e4('0xa1')]);_0x2347f0[_0x64e4('0x46')]=this[_0x64e4('0x46')][_0x85d36b['uniqueid']];}}}}catch(_0x3a4134){logger['error'](_0x64e4('0xa8'),_0x85d36b[_0x64e4('0x4c')],util[_0x64e4('0x44')](_0x3a4134,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x64e4('0x3e')]['addVariable']=function(_0x58bf0a,_0x53f38b,_0x55638c){var _0x87d324=[_0x64e4('0xa9'),'rtpaudioqosbridged',_0x64e4('0xaa'),_0x64e4('0xab'),'rtpaudioqosloss',_0x64e4('0xac'),_0x64e4('0xad'),_0x64e4('0xae'),_0x64e4('0xaf'),_0x64e4('0xb0'),_0x64e4('0xb1'),_0x64e4('0xb2'),_0x64e4('0xb3'),_0x64e4('0xb4'),_0x64e4('0xb5'),_0x64e4('0xb6'),_0x64e4('0x8c'),_0x64e4('0xb7'),_0x64e4('0xb8')];if(!_[_0x64e4('0x41')](_0x53f38b)&&!_['includes'](_0x87d324,_0x53f38b)){if(_[_0x64e4('0x5d')](this[_0x64e4('0x46')][_0x58bf0a])){this[_0x64e4('0x46')][_0x58bf0a]={};}this[_0x64e4('0x46')][_0x58bf0a][_0x53f38b]=_0x55638c;}};VoiceQueueReport['prototype'][_0x64e4('0xb9')]=function(_0x4778d3,_0x4a68db,_0x4e47a2){try{var _0x425788={};if(this[_0x64e4('0xf')][_0x4778d3]){for(var _0x28a206=0x0;_0x28a206{delete this[_0x64e4('0x12')][_0x5b8fbd];},_0x3518de);}};module[_0x64e4('0xf0')]=VoiceQueueReport; \ No newline at end of file diff --git a/server/services/ami/rpc/agentReportPreview.js b/server/services/ami/rpc/agentReportPreview.js index 83a4318..2d5284b 100644 --- a/server/services/ami/rpc/agentReportPreview.js +++ b/server/services/ami/rpc/agentReportPreview.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4e32=['campaign','Request','CreateReportAgentPreview','createHistory'];(function(_0x51d563,_0x59d225){var _0x3042f0=function(_0x3f1bf9){while(--_0x3f1bf9){_0x51d563['push'](_0x51d563['shift']());}};_0x3042f0(++_0x59d225);}(_0x4e32,0x183));var _0x24e3=function(_0x46fbea,_0x5a1b2f){_0x46fbea=_0x46fbea-0x0;var _0x44aec5=_0x4e32[_0x46fbea];return _0x44aec5;};'use strict';var client=require('../client');exports[_0x24e3('0x0')]=function(_0x55b358){return function(){_0x55b358[_0x24e3('0x1')]=_0x55b358['queue'];return client[_0x24e3('0x2')](_0x24e3('0x3'),{'body':_0x55b358,'log':_0x24e3('0x3')});};}; \ No newline at end of file +var _0x1fa0=['queue','Request','CreateReportAgentPreview','../client'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x1fa0,0x107));var _0x01fa=function(_0xbd2a8d,_0x451894){_0xbd2a8d=_0xbd2a8d-0x0;var _0x5dc929=_0x1fa0[_0xbd2a8d];return _0x5dc929;};'use strict';var client=require(_0x01fa('0x0'));exports['createHistory']=function(_0x40d9c7){return function(){_0x40d9c7['campaign']=_0x40d9c7[_0x01fa('0x1')];return client[_0x01fa('0x2')](_0x01fa('0x3'),{'body':_0x40d9c7,'log':_0x01fa('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index 85388f8..afaac60 100644 --- a/server/services/ami/rpc/attachment.js +++ b/server/services/ami/rpc/attachment.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcd3b=['CreateAttachment','../client','Request'];(function(_0x4c6831,_0x114a59){var _0x2a0365=function(_0x1d0a4d){while(--_0x1d0a4d){_0x4c6831['push'](_0x4c6831['shift']());}};_0x2a0365(++_0x114a59);}(_0xcd3b,0x19c));var _0xbcd3=function(_0x526b84,_0x4669a0){_0x526b84=_0x526b84-0x0;var _0x3bb8fa=_0xcd3b[_0x526b84];return _0x3bb8fa;};'use strict';var client=require(_0xbcd3('0x0'));exports['create']=function(_0x30db39){return client[_0xbcd3('0x1')](_0xbcd3('0x2'),{'body':_0x30db39,'log':_0xbcd3('0x2')});}; \ No newline at end of file +var _0xd3d3=['Request'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xd3d3,0x19a));var _0x3d3d=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd3d3[_0x3ab51d];return _0x29a04e;};'use strict';var client=require('../client');exports['create']=function(_0x12ce2a){return client[_0x3d3d('0x0')]('CreateAttachment',{'body':_0x12ce2a,'log':'CreateAttachment'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index 493a958..9c49ffa 100644 --- a/server/services/ami/rpc/campaign.js +++ b/server/services/ami/rpc/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialCutDigit','Trunk','callerid','active','TrunkBackup','Interval','SquareProject','getCampaign','getCampaigns','GetCampaign','name','type','limitCalls','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectRetryFrequency','dialTimezone','dialGlobalInterval','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDMinWordLength'];(function(_0x12d2d1,_0x175120){var _0x1cb7b4=function(_0x11d432){while(--_0x11d432){_0x12d2d1['push'](_0x12d2d1['shift']());}};_0x1cb7b4(++_0x175120);}(_0xadb5,0xad));var _0x5adb=function(_0x524f31,_0x1a066b){_0x524f31=_0x524f31-0x0;var _0x35c729=_0xadb5[_0x524f31];return _0x35c729;};'use strict';var client=require('../client');exports[_0x5adb('0x0')]=function(){return function(){return client['Request'](_0x5adb('0x1'),{'options':{'raw':![],'attributes':['id',_0x5adb('0x2'),_0x5adb('0x3'),'active',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6'),'dialOriginateTimeout',_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'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0x5adb('0x15'),_0x5adb('0x16'),_0x5adb('0x17'),'dialAMDActive',_0x5adb('0x18'),'dialAMDGreeting',_0x5adb('0x19'),'dialAMDTotalAnalysisTime',_0x5adb('0x1a'),_0x5adb('0x1b'),_0x5adb('0x1c'),'dialAMDSilenceThreshold',_0x5adb('0x1d'),_0x5adb('0x1e'),_0x5adb('0x1f'),'dialRandomLastDigitCallerIdNumber',_0x5adb('0x20')],'include':[{'model':'Trunk','as':_0x5adb('0x21'),'attributes':['id',_0x5adb('0x2'),_0x5adb('0x22'),_0x5adb('0x23')]},{'model':_0x5adb('0x21'),'as':_0x5adb('0x24'),'attributes':['id',_0x5adb('0x2'),_0x5adb('0x22'),_0x5adb('0x23')]},{'model':'Interval','as':_0x5adb('0x25'),'attributes':['id','name'],'include':[{'model':_0x5adb('0x25'),'as':'Intervals','attributes':['id',_0x5adb('0x2'),'interval']}]},{'model':'SquareProject','as':_0x5adb('0x26'),'attributes':['id',_0x5adb('0x2')]}]},'log':_0x5adb('0x27')});};}; \ No newline at end of file +var _0x5f2f=['dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialTimezone','dialGlobalInterval','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','Trunk','callerid','TrunkBackup','Interval','Intervals','interval','SquareProject','../client','getCampaigns','Request','GetCampaign','name','type','active','limitCalls'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x5f2f,0x73));var _0xf5f2=function(_0x29dfc7,_0x5d32a5){_0x29dfc7=_0x29dfc7-0x0;var _0x22d34a=_0x5f2f[_0x29dfc7];return _0x22d34a;};'use strict';var client=require(_0xf5f2('0x0'));exports[_0xf5f2('0x1')]=function(){return function(){return client[_0xf5f2('0x2')](_0xf5f2('0x3'),{'options':{'raw':![],'attributes':['id',_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6'),_0xf5f2('0x7'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber',_0xf5f2('0x8'),_0xf5f2('0x9'),_0xf5f2('0xa'),_0xf5f2('0xb'),_0xf5f2('0xc'),_0xf5f2('0xd'),'dialNoAnswerRetryFrequency',_0xf5f2('0xe'),_0xf5f2('0xf'),_0xf5f2('0x10'),'dialDropMaxRetry',_0xf5f2('0x11'),_0xf5f2('0x12'),_0xf5f2('0x13'),'dialMachineMaxRetry',_0xf5f2('0x14'),'dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency',_0xf5f2('0x15'),_0xf5f2('0x16'),'dialAMDActive',_0xf5f2('0x17'),_0xf5f2('0x18'),_0xf5f2('0x19'),_0xf5f2('0x1a'),_0xf5f2('0x1b'),_0xf5f2('0x1c'),'dialAMDMaximumNumberOfWords',_0xf5f2('0x1d'),_0xf5f2('0x1e'),_0xf5f2('0x1f'),_0xf5f2('0x20'),_0xf5f2('0x21'),'dialCutDigit'],'include':[{'model':_0xf5f2('0x22'),'as':_0xf5f2('0x22'),'attributes':['id',_0xf5f2('0x4'),_0xf5f2('0x23'),_0xf5f2('0x6')]},{'model':_0xf5f2('0x22'),'as':_0xf5f2('0x24'),'attributes':['id',_0xf5f2('0x4'),_0xf5f2('0x23'),_0xf5f2('0x6')]},{'model':_0xf5f2('0x25'),'as':_0xf5f2('0x25'),'attributes':['id',_0xf5f2('0x4')],'include':[{'model':_0xf5f2('0x25'),'as':_0xf5f2('0x26'),'attributes':['id',_0xf5f2('0x4'),_0xf5f2('0x27')]}]},{'model':'SquareProject','as':_0xf5f2('0x28'),'attributes':['id',_0xf5f2('0x4')]}]},'log':'getCampaign'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index b29a365..920e3c9 100644 --- a/server/services/ami/rpc/cmContact.js +++ b/server/services/ami/rpc/cmContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c54=['CreateCmContact','getContacts','GetCmContact','createContact','Request'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x8c54,0xe9));var _0x48c5=function(_0x1006c4,_0x300b60){_0x1006c4=_0x1006c4-0x0;var _0x196fa5=_0x8c54[_0x1006c4];return _0x196fa5;};'use strict';var client=require('../client');exports[_0x48c5('0x0')]=function(_0x2ee22c){return function(){return client[_0x48c5('0x1')](_0x48c5('0x2'),{'body':_0x2ee22c,'log':_0x48c5('0x2')});};};exports[_0x48c5('0x3')]=function(_0x3747fe){return function(){return client[_0x48c5('0x1')](_0x48c5('0x4'),{'options':_0x3747fe,'log':_0x48c5('0x4')});};}; \ No newline at end of file +var _0x1f14=['GetCmContact','../client','createContact','CreateCmContact','Request'];(function(_0x392bb0,_0xb9b525){var _0x1dbb37=function(_0x2c5e61){while(--_0x2c5e61){_0x392bb0['push'](_0x392bb0['shift']());}};_0x1dbb37(++_0xb9b525);}(_0x1f14,0x8d));var _0x41f1=function(_0x18959c,_0x4e84da){_0x18959c=_0x18959c-0x0;var _0x18c9a7=_0x1f14[_0x18959c];return _0x18c9a7;};'use strict';var client=require(_0x41f1('0x0'));exports[_0x41f1('0x1')]=function(_0x1f1c68){return function(){return client['Request'](_0x41f1('0x2'),{'body':_0x1f1c68,'log':_0x41f1('0x2')});};};exports['getContacts']=function(_0x84d534){return function(){return client[_0x41f1('0x3')](_0x41f1('0x4'),{'options':_0x84d534,'log':_0x41f1('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index 6c5a0b7..1047163 100644 --- a/server/services/ami/rpc/cmHopper.js +++ b/server/services/ami/rpc/cmHopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3714=['DESC','ASC','getContactDialerIvr','scheduledat','GetContactDialerIvr','moveContactManagedDialer','MoveContactManagedDialer','countReScheduled','CountReScheduled','getContactPreview','GetCmHopperPreview','User','name','VoiceQueue','Queue','unlockContact','getContactRecallMe','GetContactRecallMe','voicePause','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','moment','Request','CmContact','Contact','getCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','UpdateCmHopper','rescheduleContact','ContactId','ListId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','priority'];(function(_0x53ee22,_0x4465c5){var _0x792275=function(_0xe0fbe4){while(--_0xe0fbe4){_0x53ee22['push'](_0x53ee22['shift']());}};_0x792275(++_0x4465c5);}(_0x3714,0x95));var _0x4371=function(_0x246898,_0x4e02fc){_0x246898=_0x246898-0x0;var _0x2e9ee4=_0x3714[_0x246898];return _0x2e9ee4;};'use strict';var client=require(_0x4371('0x0'));var moment=require(_0x4371('0x1'));exports['getContacts']=function(_0x1e969d,_0x3f7fa8){return function(){return client[_0x4371('0x2')]('GetCmHopper',{'options':{'where':{'VoiceQueueId':_0x1e969d},'include':[{'model':_0x4371('0x3'),'as':_0x4371('0x4')}],'limit':_0x3f7fa8,'raw':![]},'log':_0x4371('0x5')});};};exports['updateContacts']=function(_0x10028c,_0x5650a7,_0x349031){return function(){return client[_0x4371('0x2')]('UpdateCmHopper',{'body':_0x10028c,'options':{'where':{'VoiceQueueId':_0x5650a7,'scheduledat':{'$lte':moment()[_0x4371('0x6')](_0x4371('0x7'))}},'limit':_0x349031},'log':_0x4371('0x8')});};};exports[_0x4371('0x9')]=function(_0x4a2544){return client[_0x4371('0x2')]('UpdateCmHopper',{'body':_0x4a2544,'options':{'where':{'ContactId':_0x4a2544[_0x4371('0xa')],'ListId':_0x4a2544[_0x4371('0xb')],'VoiceQueueId':_0x4a2544[_0x4371('0xc')],'CampaignId':_0x4a2544[_0x4371('0xd')]}},'log':'rescheduleContact'});};exports[_0x4371('0xe')]=function(_0x263143,_0x48ef33,_0xe5b862){return function(){return client[_0x4371('0x2')](_0x4371('0xf'),{'options':{'where':{'VoiceQueueId':_0x263143,'ListId':_0x48ef33,'ContactId':_0xe5b862}},'log':_0x4371('0xf')});};};exports[_0x4371('0x10')]=function(_0x48f881,_0x447bad,_0x3ebaaa,_0x3decc7){return client[_0x4371('0x2')](_0x4371('0x11'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x48f881,'active':![],'scheduledat':{'$lte':moment()['format'](_0x4371('0x7'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x447bad}}]},'order':[[_0x4371('0x12'),_0x4371('0x13')],['scheduledat',_0x3decc7],['id',_0x4371('0x14')]],'raw':!![],'limit':_0x3ebaaa},'log':_0x4371('0x11')});};exports[_0x4371('0x15')]=function(_0xa229c4,_0xa5b63f,_0x41a55f){return client[_0x4371('0x2')](_0x4371('0x11'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0xa229c4,'active':![],'scheduledat':{'$lte':moment()[_0x4371('0x6')](_0x4371('0x7'))}},'include':[{'model':_0x4371('0x3'),'as':_0x4371('0x4')}],'order':[[_0x4371('0x12'),'DESC'],[_0x4371('0x16'),_0x41a55f],['id',_0x4371('0x14')]],'raw':!![],'limit':_0xa5b63f},'log':_0x4371('0x17')});};exports[_0x4371('0x18')]=function(_0x2ad3cf,_0x4c40fe){_0x2ad3cf['campaign']=_0x2ad3cf['queue'];return client[_0x4371('0x2')]('MoveContactManagedDialer',{'body':_0x2ad3cf,'options':{'where':{'ContactId':_0x2ad3cf[_0x4371('0xa')],'ListId':_0x2ad3cf[_0x4371('0xb')],'VoiceQueueId':_0x2ad3cf[_0x4371('0xc')],'CampaignId':_0x2ad3cf[_0x4371('0xd')],'active':_0x4c40fe?undefined:!![]}},'log':_0x4371('0x19')});};exports[_0x4371('0x1a')]=function(_0x1b245d){return client[_0x4371('0x2')](_0x4371('0x1b'),{'options':{'where':{'VoiceQueueId':_0x1b245d['id']?_0x1b245d['id']||null:null}},'log':_0x4371('0x1a')});};exports[_0x4371('0x1c')]=function(_0x6478bf){return function(){return client[_0x4371('0x2')](_0x4371('0x1d'),{'options':{'where':{'id':_0x6478bf},'include':[{'model':_0x4371('0x3'),'as':'Contact'},{'model':_0x4371('0x1e'),'as':'Agent','attributes':['id',_0x4371('0x1f')]},{'model':_0x4371('0x20'),'as':_0x4371('0x21'),'attributes':['id',_0x4371('0x1f')]}],'raw':!![]},'log':_0x4371('0x5')});};};exports[_0x4371('0x22')]=function(_0x479e2c,_0x54b4ec,_0x137d76){return client[_0x4371('0x2')]('UpdateCmHopper',{'body':_0x479e2c,'options':{'where':{'id':_0x54b4ec},'limit':_0x137d76},'log':_0x4371('0x8')});};exports[_0x4371('0x23')]=function(_0x2e7cd7,_0x3acddd){return function(){return client[_0x4371('0x2')](_0x4371('0x24'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x2e7cd7,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x4371('0x6')](_0x4371('0x7'))},'UserId':{'$in':_0x3acddd}},'order':[[_0x4371('0x12'),_0x4371('0x13')],[_0x4371('0x16'),_0x4371('0x13')],['id','ASC']],'include':[{'model':_0x4371('0x3'),'as':_0x4371('0x4')},{'model':_0x4371('0x1e'),'as':'Agent','attributes':['id','name',_0x4371('0x25')]}],'group':'db.CmHopper.UserId','raw':!![]},'log':_0x4371('0x11')});};};exports[_0x4371('0x26')]=function(_0x2fc70c,_0x899a78){return client[_0x4371('0x2')](_0x4371('0x27'),{'body':_0x2fc70c,'options':_0x899a78||{},'log':_0x4371('0x27')});};exports[_0x4371('0x28')]=function(_0x5775c8,_0x346a78,_0x1af2a1){return function(){return client[_0x4371('0x2')](_0x4371('0x29'),{'body':{'where':{'voiceQueueIds':_0x5775c8,'interval':_0x346a78,'availableAgentsIds':_0x1af2a1}},'log':'handlePreviewRecallNotifications'});};}; \ No newline at end of file +var _0xaa48=['CmHopperHandlePreviewRecallNotifications','handlePreviewRecallNotifications','../client','moment','getContacts','Request','GetCmHopper','CmContact','Contact','getCmHopper','updateContacts','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','ContactId','ListId','CampaignId','rescheduleContact','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','priority','DESC','scheduledat','ASC','moveContactManagedDialer','campaign','queue','MoveContactManagedDialer','VoiceQueueId','CountReScheduled','getContactPreview','GetCmHopperPreview','User','name','VoiceQueue','unlockContact','GetContactRecallMe','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls'];(function(_0x1b3d5f,_0x463d39){var _0x38ff9f=function(_0x1ca4ee){while(--_0x1ca4ee){_0x1b3d5f['push'](_0x1b3d5f['shift']());}};_0x38ff9f(++_0x463d39);}(_0xaa48,0x15a));var _0x8aa4=function(_0x1c89c2,_0x5efd57){_0x1c89c2=_0x1c89c2-0x0;var _0x219ae8=_0xaa48[_0x1c89c2];return _0x219ae8;};'use strict';var client=require(_0x8aa4('0x0'));var moment=require(_0x8aa4('0x1'));exports[_0x8aa4('0x2')]=function(_0x50d619,_0x1a93a7){return function(){return client[_0x8aa4('0x3')](_0x8aa4('0x4'),{'options':{'where':{'VoiceQueueId':_0x50d619},'include':[{'model':_0x8aa4('0x5'),'as':_0x8aa4('0x6')}],'limit':_0x1a93a7,'raw':![]},'log':_0x8aa4('0x7')});};};exports[_0x8aa4('0x8')]=function(_0x469f03,_0x141d8b,_0x14614c){return function(){return client[_0x8aa4('0x3')](_0x8aa4('0x9'),{'body':_0x469f03,'options':{'where':{'VoiceQueueId':_0x141d8b,'scheduledat':{'$lte':moment()[_0x8aa4('0xa')](_0x8aa4('0xb'))}},'limit':_0x14614c},'log':_0x8aa4('0x9')});};};exports['rescheduleContact']=function(_0x33a427){return client[_0x8aa4('0x3')]('UpdateCmHopper',{'body':_0x33a427,'options':{'where':{'ContactId':_0x33a427[_0x8aa4('0xc')],'ListId':_0x33a427[_0x8aa4('0xd')],'VoiceQueueId':_0x33a427['VoiceQueueId'],'CampaignId':_0x33a427[_0x8aa4('0xe')]}},'log':_0x8aa4('0xf')});};exports[_0x8aa4('0x10')]=function(_0x38ecc6,_0x1a664b,_0x3a64ed){return function(){return client[_0x8aa4('0x3')](_0x8aa4('0x11'),{'options':{'where':{'VoiceQueueId':_0x38ecc6,'ListId':_0x1a664b,'ContactId':_0x3a64ed}},'log':_0x8aa4('0x11')});};};exports[_0x8aa4('0x12')]=function(_0x569c43,_0x5951ce,_0x3143f7,_0x455a80){return client[_0x8aa4('0x3')](_0x8aa4('0x13'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x569c43,'active':![],'scheduledat':{'$lte':moment()[_0x8aa4('0xa')](_0x8aa4('0xb'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x5951ce}}]},'order':[[_0x8aa4('0x14'),_0x8aa4('0x15')],[_0x8aa4('0x16'),_0x455a80],['id',_0x8aa4('0x17')]],'raw':!![],'limit':_0x3143f7},'log':'GetContactDialer'});};exports['getContactDialerIvr']=function(_0x5d1819,_0x26542e,_0x188e24){return client[_0x8aa4('0x3')](_0x8aa4('0x13'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x5d1819,'active':![],'scheduledat':{'$lte':moment()['format'](_0x8aa4('0xb'))}},'include':[{'model':_0x8aa4('0x5'),'as':'Contact'}],'order':[[_0x8aa4('0x14'),'DESC'],['scheduledat',_0x188e24],['id',_0x8aa4('0x17')]],'raw':!![],'limit':_0x26542e},'log':'GetContactDialerIvr'});};exports[_0x8aa4('0x18')]=function(_0x2df294,_0x521b69){_0x2df294[_0x8aa4('0x19')]=_0x2df294[_0x8aa4('0x1a')];return client['Request'](_0x8aa4('0x1b'),{'body':_0x2df294,'options':{'where':{'ContactId':_0x2df294[_0x8aa4('0xc')],'ListId':_0x2df294[_0x8aa4('0xd')],'VoiceQueueId':_0x2df294[_0x8aa4('0x1c')],'CampaignId':_0x2df294[_0x8aa4('0xe')],'active':_0x521b69?undefined:!![]}},'log':'MoveContactManagedDialer'});};exports['countReScheduled']=function(_0x4c429f){return client['Request'](_0x8aa4('0x1d'),{'options':{'where':{'VoiceQueueId':_0x4c429f['id']?_0x4c429f['id']||null:null}},'log':'countReScheduled'});};exports[_0x8aa4('0x1e')]=function(_0x3e4d24){return function(){return client[_0x8aa4('0x3')](_0x8aa4('0x1f'),{'options':{'where':{'id':_0x3e4d24},'include':[{'model':'CmContact','as':'Contact'},{'model':_0x8aa4('0x20'),'as':'Agent','attributes':['id',_0x8aa4('0x21')]},{'model':_0x8aa4('0x22'),'as':'Queue','attributes':['id',_0x8aa4('0x21')]}],'raw':!![]},'log':'getCmHopper'});};};exports[_0x8aa4('0x23')]=function(_0x54aa95,_0x46024e,_0x31ebb4){return client[_0x8aa4('0x3')](_0x8aa4('0x9'),{'body':_0x54aa95,'options':{'where':{'id':_0x46024e},'limit':_0x31ebb4},'log':_0x8aa4('0x9')});};exports['getContactRecallMe']=function(_0x5d4894,_0x5f1028){return function(){return client[_0x8aa4('0x3')](_0x8aa4('0x24'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x5d4894,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()['format'](_0x8aa4('0xb'))},'UserId':{'$in':_0x5f1028}},'order':[[_0x8aa4('0x14'),_0x8aa4('0x15')],[_0x8aa4('0x16'),_0x8aa4('0x15')],['id',_0x8aa4('0x17')]],'include':[{'model':'CmContact','as':_0x8aa4('0x6')},{'model':'User','as':'Agent','attributes':['id',_0x8aa4('0x21'),_0x8aa4('0x25')]}],'group':_0x8aa4('0x26'),'raw':!![]},'log':_0x8aa4('0x13')});};};exports[_0x8aa4('0x27')]=function(_0x481800,_0x342938){return client[_0x8aa4('0x3')](_0x8aa4('0x28'),{'body':_0x481800,'options':_0x342938||{},'log':'ResetActiveCalls'});};exports['handlePreviewRecallNotifications']=function(_0x5ab8a3,_0x541cd9,_0x3eceb8){return function(){return client[_0x8aa4('0x3')](_0x8aa4('0x29'),{'body':{'where':{'voiceQueueIds':_0x5ab8a3,'interval':_0x541cd9,'availableAgentsIds':_0x3eceb8}},'log':_0x8aa4('0x2a')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index 9d7ed38..cb1ca2b 100644 --- a/server/services/ami/rpc/cmHopperAdditionalPhone.js +++ b/server/services/ami/rpc/cmHopperAdditionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6496=['SwapAdditionalPhones','incrementPreviewCounters','Request','IncrementPreviewCounters','../client','VerifyAdditionalPhones'];(function(_0x5dae73,_0x3c6ddb){var _0x518ddb=function(_0x4ab39f){while(--_0x4ab39f){_0x5dae73['push'](_0x5dae73['shift']());}};_0x518ddb(++_0x3c6ddb);}(_0x6496,0xe8));var _0x6649=function(_0x5674fc,_0x2b623b){_0x5674fc=_0x5674fc-0x0;var _0x2444a5=_0x6496[_0x5674fc];return _0x2444a5;};'use strict';var client=require(_0x6649('0x0'));exports['verifyAdditionalPhones']=function(_0x18f06d,_0x5a5b28,_0x2da1bb){return client['Request']('VerifyAdditionalPhones',{'body':_0x18f06d,'reason':_0x5a5b28,'entity':_0x2da1bb,'log':_0x6649('0x1')});};exports['swapAdditionalPhones']=function(_0x116cf0,_0x3a8d35,_0x3580d5){return client['Request'](_0x6649('0x2'),{'body':_0x116cf0,'duration':_0x3a8d35,'waitTime':_0x3580d5,'log':_0x6649('0x2')});};exports[_0x6649('0x3')]=function(_0xcadf18){return function(){return client[_0x6649('0x4')]('IncrementPreviewCounters',{'body':_0xcadf18,'log':_0x6649('0x5')});};}; \ No newline at end of file +var _0xfd8d=['Request','VerifyAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters','../client','verifyAdditionalPhones'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfd8d,0x171));var _0xdfd8=function(_0x47c9b1,_0x5751df){_0x47c9b1=_0x47c9b1-0x0;var _0x432c41=_0xfd8d[_0x47c9b1];return _0x432c41;};'use strict';var client=require(_0xdfd8('0x0'));exports[_0xdfd8('0x1')]=function(_0x30861b,_0x44ab09,_0x431033){return client[_0xdfd8('0x2')](_0xdfd8('0x3'),{'body':_0x30861b,'reason':_0x44ab09,'entity':_0x431033,'log':_0xdfd8('0x3')});};exports['swapAdditionalPhones']=function(_0x27a668,_0xff6728,_0x12d3ae){return client[_0xdfd8('0x2')](_0xdfd8('0x4'),{'body':_0x27a668,'duration':_0xff6728,'waitTime':_0x12d3ae,'log':'SwapAdditionalPhones'});};exports[_0xdfd8('0x5')]=function(_0x4c31a7){return function(){return client['Request'](_0xdfd8('0x6'),{'body':_0x4c31a7,'log':_0xdfd8('0x6')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index 501cbdc..e321a92 100644 --- a/server/services/ami/rpc/cmHopperBlack.js +++ b/server/services/ami/rpc/cmHopperBlack.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x69aa=['phone','checkIsBlackListIvr','Request','CampaignId','GetCmHopperBlackIvr','../client','checkIsBlackList','VoiceQueueId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x69aa,0x1ed));var _0xa69a=function(_0x53901e,_0x46c63f){_0x53901e=_0x53901e-0x0;var _0x59460a=_0x69aa[_0x53901e];return _0x59460a;};'use strict';var client=require(_0xa69a('0x0'));exports[_0xa69a('0x1')]=function(_0x2d2123){return client['Request']('GetCmHopperBlack',{'options':{'where':{'VoiceQueueId':_0x2d2123[_0xa69a('0x2')],'phone':_0x2d2123[_0xa69a('0x3')]},'raw':![]},'log':'GetCmHopperBlack'});};exports[_0xa69a('0x4')]=function(_0x2643a2){return client[_0xa69a('0x5')]('GetCmHopperBlack',{'options':{'where':{'CampaignId':_0x2643a2[_0xa69a('0x6')],'phone':_0x2643a2[_0xa69a('0x3')]},'raw':![]},'log':_0xa69a('0x7')});}; \ No newline at end of file +var _0x2f88=['checkIsBlackListIvr','Request','CampaignId','GetCmHopperBlackIvr','../client','checkIsBlackList'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x2f88,0x1a8));var _0x82f8=function(_0x350c9f,_0x136785){_0x350c9f=_0x350c9f-0x0;var _0x25a5c3=_0x2f88[_0x350c9f];return _0x25a5c3;};'use strict';var client=require(_0x82f8('0x0'));exports[_0x82f8('0x1')]=function(_0x206472){return client['Request']('GetCmHopperBlack',{'options':{'where':{'VoiceQueueId':_0x206472['VoiceQueueId'],'phone':_0x206472['phone']},'raw':![]},'log':'GetCmHopperBlack'});};exports[_0x82f8('0x2')]=function(_0x4e745a){return client[_0x82f8('0x3')]('GetCmHopperBlack',{'options':{'where':{'CampaignId':_0x4e745a[_0x82f8('0x4')],'phone':_0x4e745a['phone']},'raw':![]},'log':_0x82f8('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index 7f31329..dfdf0ff 100644 --- a/server/services/ami/rpc/cmHopperFinal.js +++ b/server/services/ami/rpc/cmHopperFinal.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7ba9=['createContact','queue','CreateCmHopperFinal','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7ba9,0xfb));var _0x97ba=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x7ba9[_0x38a7ac];return _0x53061a;};'use strict';var client=require(_0x97ba('0x0'));exports[_0x97ba('0x1')]=function(_0x353777){return function(){_0x353777['campaign']=_0x353777[_0x97ba('0x2')];return client['Request']('CreateCmHopperFinal',{'body':_0x353777,'log':_0x97ba('0x3')});};}; \ No newline at end of file +'use strict';var client=require('../client');exports['createContact']=function(_0x5a3e52){return function(){_0x5a3e52['campaign']=_0x5a3e52['queue'];return client['Request']('CreateCmHopperFinal',{'body':_0x5a3e52,'log':'CreateCmHopperFinal'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index 42c8821..a531ea1 100644 --- a/server/services/ami/rpc/cmHopperHistory.js +++ b/server/services/ami/rpc/cmHopperHistory.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd73e=['campaign','Request','CreateCmHopperHistory','avgHandleTime','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','startOf','day','ivr','GetCampaignHopperHistory','../client','moment','createHistory'];(function(_0x4de927,_0x3211aa){var _0x1813fa=function(_0x3b1479){while(--_0x3b1479){_0x4de927['push'](_0x4de927['shift']());}};_0x1813fa(++_0x3211aa);}(_0xd73e,0x165));var _0xed73=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd73e[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xed73('0x0'));var moment=require(_0xed73('0x1'));exports[_0xed73('0x2')]=function(_0x8238f4){_0x8238f4[_0xed73('0x3')]=_0x8238f4['queue'];return client[_0xed73('0x4')](_0xed73('0x5'),{'body':_0x8238f4,'log':_0xed73('0x5')});};exports[_0xed73('0x6')]=function(_0x2fbba7){return client[_0xed73('0x4')]('AvgHandleTime',{'options':{'where':{'endtime':{'$between':[moment()[_0xed73('0x7')](_0x2fbba7,_0xed73('0x8'))[_0xed73('0x9')](_0xed73('0xa')),moment()['format'](_0xed73('0xa'))]}},'raw':![]},'log':_0xed73('0xb')});};exports[_0xed73('0xc')]=function(){return function(){return client[_0xed73('0x4')](_0xed73('0xd'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xed73('0xe')]('day')[_0xed73('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0xed73('0xf'))[_0xed73('0x9')](_0xed73('0xa'))]},'campaigntype':'queue'},'raw':![]},'log':_0xed73('0xd')});};};exports['getCampaignHopperHistory']=function(){return function(){return client[_0xed73('0x4')]('GetCampaignHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()[_0xed73('0xe')](_0xed73('0xf'))[_0xed73('0x9')](_0xed73('0xa')),moment()['endOf']('day')['format']('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':_0xed73('0x10')},'raw':![]},'log':_0xed73('0x11')});};}; \ No newline at end of file +var _0x776b=['minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','GetVoiceQueueHopperHistory','getCampaignHopperHistory','GetCampaignHopperHistory','startOf','endOf','day','ivr','../client','moment','createHistory','campaign','Request','CreateCmHopperHistory','AvgHandleTime'];(function(_0x333940,_0x8ba408){var _0x3f85fa=function(_0x30febb){while(--_0x30febb){_0x333940['push'](_0x333940['shift']());}};_0x3f85fa(++_0x8ba408);}(_0x776b,0x12b));var _0xb776=function(_0x5167e3,_0x1d4dd9){_0x5167e3=_0x5167e3-0x0;var _0x335c8c=_0x776b[_0x5167e3];return _0x335c8c;};'use strict';var client=require(_0xb776('0x0'));var moment=require(_0xb776('0x1'));exports[_0xb776('0x2')]=function(_0x3399cc){_0x3399cc[_0xb776('0x3')]=_0x3399cc['queue'];return client[_0xb776('0x4')](_0xb776('0x5'),{'body':_0x3399cc,'log':_0xb776('0x5')});};exports['avgHandleTime']=function(_0x24d47c){return client[_0xb776('0x4')](_0xb776('0x6'),{'options':{'where':{'endtime':{'$between':[moment()['subtract'](_0x24d47c,_0xb776('0x7'))[_0xb776('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['format'](_0xb776('0x9'))]}},'raw':![]},'log':_0xb776('0xa')});};exports['getVoiceQueueHopperHistory']=function(){return function(){return client[_0xb776('0x4')]('GetVoiceQueueHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()['startOf']('day')[_0xb776('0x8')](_0xb776('0x9')),moment()['endOf']('day')['format'](_0xb776('0x9'))]},'campaigntype':'queue'},'raw':![]},'log':_0xb776('0xb')});};};exports[_0xb776('0xc')]=function(){return function(){return client[_0xb776('0x4')](_0xb776('0xd'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xb776('0xe')]('day')['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xb776('0xf')](_0xb776('0x10'))[_0xb776('0x8')]('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':_0xb776('0x11')},'raw':![]},'log':'GetCampaignHopperHistory'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index 8966fdf..ee6af65 100644 --- a/server/services/ami/rpc/faxAccount.js +++ b/server/services/ami/rpc/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5b12=['gateway','tech','TrunkId','ListId','key','Trunk','callerid','getFaxAccount','notify','NotifyFaxAccount','../client','getFaxAccounts','Request','name','ecm','headerinfo','minrate'];(function(_0xb15188,_0x120f18){var _0x3a685e=function(_0x1bdae3){while(--_0x1bdae3){_0xb15188['push'](_0xb15188['shift']());}};_0x3a685e(++_0x120f18);}(_0x5b12,0xa3));var _0x25b1=function(_0x5f202e,_0x270802){_0x5f202e=_0x5f202e-0x0;var _0x217ba4=_0x5b12[_0x5f202e];return _0x217ba4;};'use strict';var client=require(_0x25b1('0x0'));exports[_0x25b1('0x1')]=function(){return function(){return client[_0x25b1('0x2')]('GetFaxAccount',{'options':{'raw':![],'attributes':['id',_0x25b1('0x3'),'description',_0x25b1('0x4'),_0x25b1('0x5'),'localstationid',_0x25b1('0x6'),'maxrate','modem',_0x25b1('0x7'),'faxdetect','t38timeout',_0x25b1('0x8'),_0x25b1('0x9'),_0x25b1('0xa'),_0x25b1('0xb')],'include':[{'model':_0x25b1('0xc'),'as':_0x25b1('0xc'),'attributes':['id',_0x25b1('0x3'),_0x25b1('0xd'),'active']}]},'log':_0x25b1('0xe')});};};exports[_0x25b1('0xf')]=function(_0x2cee35,_0x34abe5){return client[_0x25b1('0x2')](_0x25b1('0x10'),{'account':{'id':_0x2cee35},'body':_0x34abe5,'log':_0x25b1('0x10')});}; \ No newline at end of file +var _0xa7b5=['TrunkId','ListId','key','Trunk','getFaxAccount','NotifyFaxAccount','../client','Request','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech'];(function(_0x356ef7,_0x163d2a){var _0x4cec0d=function(_0x390259){while(--_0x390259){_0x356ef7['push'](_0x356ef7['shift']());}};_0x4cec0d(++_0x163d2a);}(_0xa7b5,0x15a));var _0x5a7b=function(_0xde28d8,_0x15c8be){_0xde28d8=_0xde28d8-0x0;var _0x2d221d=_0xa7b5[_0xde28d8];return _0x2d221d;};'use strict';var client=require(_0x5a7b('0x0'));exports['getFaxAccounts']=function(){return function(){return client[_0x5a7b('0x1')]('GetFaxAccount',{'options':{'raw':![],'attributes':['id',_0x5a7b('0x2'),_0x5a7b('0x3'),_0x5a7b('0x4'),_0x5a7b('0x5'),_0x5a7b('0x6'),_0x5a7b('0x7'),_0x5a7b('0x8'),_0x5a7b('0x9'),_0x5a7b('0xa'),_0x5a7b('0xb'),_0x5a7b('0xc'),_0x5a7b('0xd'),_0x5a7b('0xe'),_0x5a7b('0xf'),_0x5a7b('0x10')],'include':[{'model':_0x5a7b('0x11'),'as':_0x5a7b('0x11'),'attributes':['id',_0x5a7b('0x2'),'callerid','active']}]},'log':_0x5a7b('0x12')});};};exports['notify']=function(_0xfd7963,_0xe679a2){return client[_0x5a7b('0x1')](_0x5a7b('0x13'),{'account':{'id':_0xfd7963},'body':_0xe679a2,'log':_0x5a7b('0x13')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index 00a81da..b0b8153 100644 --- a/server/services/ami/rpc/faxMessage.js +++ b/server/services/ami/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x73c4=['Request','UpdateFaxMessage','../client','update'];(function(_0xa483b6,_0xfcdf3b){var _0x563dc6=function(_0x598d43){while(--_0x598d43){_0xa483b6['push'](_0xa483b6['shift']());}};_0x563dc6(++_0xfcdf3b);}(_0x73c4,0xae));var _0x473c=function(_0x1aba25,_0x1faed1){_0x1aba25=_0x1aba25-0x0;var _0x47d997=_0x73c4[_0x1aba25];return _0x47d997;};'use strict';var client=require(_0x473c('0x0'));exports[_0x473c('0x1')]=function(_0x543d77,_0x2ee56f){return client[_0x473c('0x2')](_0x473c('0x3'),{'body':_0x2ee56f,'options':{'where':{'AttachmentId':_0x543d77}},'log':_0x473c('0x3')});}; \ No newline at end of file +var _0xfaa6=['../client','update','Request','UpdateFaxMessage'];(function(_0x9860e6,_0x238ca3){var _0x49ec8f=function(_0x3c41cd){while(--_0x3c41cd){_0x9860e6['push'](_0x9860e6['shift']());}};_0x49ec8f(++_0x238ca3);}(_0xfaa6,0x1e8));var _0x6faa=function(_0x43b487,_0x21893a){_0x43b487=_0x43b487-0x0;var _0x2f707a=_0xfaa6[_0x43b487];return _0x2f707a;};'use strict';var client=require(_0x6faa('0x0'));exports[_0x6faa('0x1')]=function(_0x451a4d,_0x87c535){return client[_0x6faa('0x2')](_0x6faa('0x3'),{'body':_0x87c535,'options':{'where':{'AttachmentId':_0x451a4d}},'log':_0x6faa('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/desk.js b/server/services/ami/rpc/integrations/desk.js index 5ea151a..2810586 100644 --- a/server/services/ami/rpc/integrations/desk.js +++ b/server/services/ami/rpc/integrations/desk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe600=['GetDeskAccount','getDeskAccounts','Request','name','username','password','remoteUri','type','serverUrl','DeskConfiguration','Subjects','content','variableName','Variable','DeskField','Descriptions','key','keyType','keyContent','Fields','idField','nameField','customField','Tag','Tags'];(function(_0x518901,_0x5722bf){var _0x168d76=function(_0x3ca87d){while(--_0x3ca87d){_0x518901['push'](_0x518901['shift']());}};_0x168d76(++_0x5722bf);}(_0xe600,0x65));var _0x0e60=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe600[_0x321bb2];return _0x9c12ed;};'use strict';var client=require('../../client');exports[_0x0e60('0x0')]=function(){return function(_0x19b930){return client[_0x0e60('0x1')]('GetDeskAccount',{'options':{'raw':![],'attributes':['id',_0x0e60('0x2'),'description',_0x0e60('0x3'),_0x0e60('0x4'),_0x0e60('0x5'),'authType',_0x0e60('0x6'),_0x0e60('0x7')],'include':[{'model':_0x0e60('0x8'),'as':'Configurations','attributes':['id',_0x0e60('0x2')],'include':[{'model':'DeskField','as':_0x0e60('0x9'),'attributes':['id','type',_0x0e60('0xa'),_0x0e60('0xb')],'include':[{'model':_0x0e60('0xc'),'as':_0x0e60('0xc'),'attributes':['id',_0x0e60('0x2')]}]},{'model':_0x0e60('0xd'),'as':_0x0e60('0xe'),'attributes':['id',_0x0e60('0x6'),'content',_0x0e60('0xf'),_0x0e60('0x10'),_0x0e60('0x11'),_0x0e60('0xb')],'include':[{'model':'Variable','as':_0x0e60('0xc'),'attributes':['id',_0x0e60('0x2')]}]},{'model':_0x0e60('0xd'),'as':_0x0e60('0x12'),'attributes':['id',_0x0e60('0x6'),_0x0e60('0xa'),_0x0e60('0x13'),_0x0e60('0x14'),_0x0e60('0x15'),_0x0e60('0xb')],'include':[{'model':'Variable','as':_0x0e60('0xc'),'attributes':['id',_0x0e60('0x2')]}]},{'model':_0x0e60('0x16'),'as':_0x0e60('0x17'),'attributes':['id',_0x0e60('0x2')]}]}]},'log':_0x0e60('0x18')});};}; \ No newline at end of file +var _0x4832=['content','variableName','Variable','key','keyType','keyContent','Fields','idField','customField','Tags','../../client','getDeskAccounts','GetDeskAccount','name','description','username','password','remoteUri','authType','type','DeskConfiguration','Configurations','DeskField','Subjects'];(function(_0x3976a4,_0x3d2578){var _0x54d528=function(_0x199615){while(--_0x199615){_0x3976a4['push'](_0x3976a4['shift']());}};_0x54d528(++_0x3d2578);}(_0x4832,0xfa));var _0x2483=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x4832[_0x2b10c6];return _0x3789d2;};'use strict';var client=require(_0x2483('0x0'));exports[_0x2483('0x1')]=function(){return function(_0x13b2e6){return client['Request'](_0x2483('0x2'),{'options':{'raw':![],'attributes':['id',_0x2483('0x3'),_0x2483('0x4'),_0x2483('0x5'),_0x2483('0x6'),_0x2483('0x7'),_0x2483('0x8'),_0x2483('0x9'),'serverUrl'],'include':[{'model':_0x2483('0xa'),'as':_0x2483('0xb'),'attributes':['id',_0x2483('0x3')],'include':[{'model':_0x2483('0xc'),'as':_0x2483('0xd'),'attributes':['id','type',_0x2483('0xe'),_0x2483('0xf')],'include':[{'model':'Variable','as':_0x2483('0x10'),'attributes':['id',_0x2483('0x3')]}]},{'model':'DeskField','as':'Descriptions','attributes':['id',_0x2483('0x9'),'content',_0x2483('0x11'),_0x2483('0x12'),_0x2483('0x13'),_0x2483('0xf')],'include':[{'model':'Variable','as':_0x2483('0x10'),'attributes':['id',_0x2483('0x3')]}]},{'model':_0x2483('0xc'),'as':_0x2483('0x14'),'attributes':['id',_0x2483('0x9'),_0x2483('0xe'),_0x2483('0x15'),'nameField',_0x2483('0x16'),_0x2483('0xf')],'include':[{'model':_0x2483('0x10'),'as':_0x2483('0x10'),'attributes':['id',_0x2483('0x3')]}]},{'model':'Tag','as':_0x2483('0x17'),'attributes':['id',_0x2483('0x3')]}]}]},'log':_0x2483('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/dynamics365.js b/server/services/ami/rpc/integrations/dynamics365.js index 93dadd0..1d2c1ae 100644 --- a/server/services/ami/rpc/integrations/dynamics365.js +++ b/server/services/ami/rpc/integrations/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa2cb=['keyType','keyContent','Fields','idField','nameField','customField','CloudProvider','data5','data7','../../client','getDynamics365Accounts','Request','GetDynamics365Account','name','username','password','description','Dynamics365Configuration','ticketType','additionalSearchContact','openNewTab','Subjects','type','content','variableName','Variable','Dynamics365Field','Descriptions','key'];(function(_0x5e03c1,_0x55a077){var _0x1b3c3f=function(_0x1e2ed2){while(--_0x1e2ed2){_0x5e03c1['push'](_0x5e03c1['shift']());}};_0x1b3c3f(++_0x55a077);}(_0xa2cb,0x7d));var _0xba2c=function(_0x170d33,_0x278a5e){_0x170d33=_0x170d33-0x0;var _0x11328a=_0xa2cb[_0x170d33];return _0x11328a;};'use strict';var client=require(_0xba2c('0x0'));exports[_0xba2c('0x1')]=function(){return function(_0x48e37a){return client[_0xba2c('0x2')](_0xba2c('0x3'),{'options':{'raw':![],'attributes':['id',_0xba2c('0x4'),_0xba2c('0x5'),_0xba2c('0x6'),'remoteUri','tenantId','clientId','clientSecret','serverUrl',_0xba2c('0x7'),'modernAuthentication'],'include':[{'model':_0xba2c('0x8'),'as':'Configurations','attributes':['id',_0xba2c('0x4'),_0xba2c('0x9'),'moduleCreate',_0xba2c('0xa'),_0xba2c('0xb')],'include':[{'model':'Dynamics365Field','as':_0xba2c('0xc'),'attributes':['id',_0xba2c('0xd'),_0xba2c('0xe'),_0xba2c('0xf')],'include':[{'model':'Variable','as':_0xba2c('0x10'),'attributes':['id',_0xba2c('0x4')]}]},{'model':_0xba2c('0x11'),'as':_0xba2c('0x12'),'attributes':['id',_0xba2c('0xd'),_0xba2c('0xe'),_0xba2c('0x13'),_0xba2c('0x14'),_0xba2c('0x15'),_0xba2c('0xf')],'include':[{'model':'Variable','as':_0xba2c('0x10'),'attributes':['id',_0xba2c('0x4')]}]},{'model':_0xba2c('0x11'),'as':_0xba2c('0x16'),'attributes':['id',_0xba2c('0xd'),_0xba2c('0xe'),_0xba2c('0x17'),_0xba2c('0x18'),_0xba2c('0x19'),'variableName'],'include':[{'model':_0xba2c('0x10'),'as':_0xba2c('0x10'),'attributes':['id',_0xba2c('0x4')]}]}]},{'model':_0xba2c('0x1a'),'as':_0xba2c('0x1a'),'attributes':['id','data2',_0xba2c('0x1b'),_0xba2c('0x1c')]}]},'log':'GetDynamics365Account'});};}; \ No newline at end of file +var _0xc06d=['Dynamics365Field','content','Variable','Descriptions','type','keyType','keyContent','variableName','Fields','idField','nameField','customField','CloudProvider','data2','data5','GetDynamics365Account','../../client','getDynamics365Accounts','Request','name','username','tenantId','clientSecret','serverUrl','Dynamics365Configuration','Configurations','ticketType','moduleCreate','additionalSearchContact','openNewTab'];(function(_0x4b1d03,_0x3860f5){var _0x3b799c=function(_0x4863f6){while(--_0x4863f6){_0x4b1d03['push'](_0x4b1d03['shift']());}};_0x3b799c(++_0x3860f5);}(_0xc06d,0x15a));var _0xdc06=function(_0x23c5ac,_0x2945b4){_0x23c5ac=_0x23c5ac-0x0;var _0x2fdba0=_0xc06d[_0x23c5ac];return _0x2fdba0;};'use strict';var client=require(_0xdc06('0x0'));exports[_0xdc06('0x1')]=function(){return function(_0x3d4a6a){return client[_0xdc06('0x2')]('GetDynamics365Account',{'options':{'raw':![],'attributes':['id',_0xdc06('0x3'),_0xdc06('0x4'),'password','remoteUri',_0xdc06('0x5'),'clientId',_0xdc06('0x6'),_0xdc06('0x7'),'description','modernAuthentication'],'include':[{'model':_0xdc06('0x8'),'as':_0xdc06('0x9'),'attributes':['id','name',_0xdc06('0xa'),_0xdc06('0xb'),_0xdc06('0xc'),_0xdc06('0xd')],'include':[{'model':_0xdc06('0xe'),'as':'Subjects','attributes':['id','type',_0xdc06('0xf'),'variableName'],'include':[{'model':_0xdc06('0x10'),'as':_0xdc06('0x10'),'attributes':['id',_0xdc06('0x3')]}]},{'model':_0xdc06('0xe'),'as':_0xdc06('0x11'),'attributes':['id',_0xdc06('0x12'),'content','key',_0xdc06('0x13'),_0xdc06('0x14'),_0xdc06('0x15')],'include':[{'model':'Variable','as':_0xdc06('0x10'),'attributes':['id',_0xdc06('0x3')]}]},{'model':_0xdc06('0xe'),'as':_0xdc06('0x16'),'attributes':['id',_0xdc06('0x12'),'content',_0xdc06('0x17'),_0xdc06('0x18'),_0xdc06('0x19'),_0xdc06('0x15')],'include':[{'model':_0xdc06('0x10'),'as':_0xdc06('0x10'),'attributes':['id',_0xdc06('0x3')]}]}]},{'model':'CloudProvider','as':_0xdc06('0x1a'),'attributes':['id',_0xdc06('0x1b'),_0xdc06('0x1c'),'data7']}]},'log':_0xdc06('0x1d')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshdesk.js b/server/services/ami/rpc/integrations/freshdesk.js index eaa1a67..be22c2b 100644 --- a/server/services/ami/rpc/integrations/freshdesk.js +++ b/server/services/ami/rpc/integrations/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d62=['name','Tag','FreshdeskField','Subjects','type','variableName','Variable','Descriptions','content','keyType','keyContent','idField','nameField','customField','../../client','getFreshdeskAccounts','Request','GetFreshdeskAccount','username','apiKey','remoteUri','serverUrl','FreshdeskConfiguration'];(function(_0x5da63e,_0x4d3503){var _0x442aca=function(_0x6d5bca){while(--_0x6d5bca){_0x5da63e['push'](_0x5da63e['shift']());}};_0x442aca(++_0x4d3503);}(_0x9d62,0xaf));var _0x29d6=function(_0x1b1d27,_0x2e65a7){_0x1b1d27=_0x1b1d27-0x0;var _0x53f520=_0x9d62[_0x1b1d27];return _0x53f520;};'use strict';var client=require(_0x29d6('0x0'));exports[_0x29d6('0x1')]=function(){return function(_0x2eafa1){return client[_0x29d6('0x2')](_0x29d6('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x29d6('0x4'),_0x29d6('0x5'),_0x29d6('0x6'),_0x29d6('0x7')],'include':[{'model':_0x29d6('0x8'),'as':'Configurations','attributes':['id',_0x29d6('0x9')],'include':[{'model':_0x29d6('0xa'),'attributes':['id',_0x29d6('0x9')]},{'model':_0x29d6('0xb'),'as':_0x29d6('0xc'),'attributes':['id',_0x29d6('0xd'),'content',_0x29d6('0xe')],'include':[{'model':_0x29d6('0xf'),'as':_0x29d6('0xf'),'attributes':['id',_0x29d6('0x9')]}]},{'model':_0x29d6('0xb'),'as':_0x29d6('0x10'),'attributes':['id',_0x29d6('0xd'),_0x29d6('0x11'),'key',_0x29d6('0x12'),_0x29d6('0x13'),_0x29d6('0xe')],'include':[{'model':_0x29d6('0xf'),'as':_0x29d6('0xf'),'attributes':['id',_0x29d6('0x9')]}]},{'model':_0x29d6('0xb'),'as':'Fields','attributes':['id',_0x29d6('0xd'),'content',_0x29d6('0x14'),_0x29d6('0x15'),_0x29d6('0x16'),_0x29d6('0xe')],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]}]}]},'log':_0x29d6('0x3')});};}; \ No newline at end of file +var _0xb264=['name','FreshdeskField','type','content','variableName','Variable','Descriptions','key','keyContent','Fields','nameField','GetFreshdeskAccount','../../client','getFreshdeskAccounts','Request','username','apiKey','remoteUri','serverUrl','FreshdeskConfiguration','Configurations'];(function(_0x30adc4,_0x315a03){var _0x7da095=function(_0x5df479){while(--_0x5df479){_0x30adc4['push'](_0x30adc4['shift']());}};_0x7da095(++_0x315a03);}(_0xb264,0x108));var _0x4b26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb264[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x4b26('0x0'));exports[_0x4b26('0x1')]=function(){return function(_0x53d2eb){return client[_0x4b26('0x2')]('GetFreshdeskAccount',{'options':{'raw':![],'attributes':['id','name',_0x4b26('0x3'),_0x4b26('0x4'),_0x4b26('0x5'),_0x4b26('0x6')],'include':[{'model':_0x4b26('0x7'),'as':_0x4b26('0x8'),'attributes':['id',_0x4b26('0x9')],'include':[{'model':'Tag','attributes':['id',_0x4b26('0x9')]},{'model':_0x4b26('0xa'),'as':'Subjects','attributes':['id',_0x4b26('0xb'),_0x4b26('0xc'),_0x4b26('0xd')],'include':[{'model':'Variable','as':_0x4b26('0xe'),'attributes':['id',_0x4b26('0x9')]}]},{'model':_0x4b26('0xa'),'as':_0x4b26('0xf'),'attributes':['id',_0x4b26('0xb'),'content',_0x4b26('0x10'),'keyType',_0x4b26('0x11'),_0x4b26('0xd')],'include':[{'model':_0x4b26('0xe'),'as':_0x4b26('0xe'),'attributes':['id',_0x4b26('0x9')]}]},{'model':'FreshdeskField','as':_0x4b26('0x12'),'attributes':['id',_0x4b26('0xb'),'content','idField',_0x4b26('0x13'),'customField',_0x4b26('0xd')],'include':[{'model':_0x4b26('0xe'),'as':_0x4b26('0xe'),'attributes':['id','name']}]}]}]},'log':_0x4b26('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshsales.js b/server/services/ami/rpc/integrations/freshsales.js index c8d720a..e7a74c5 100644 --- a/server/services/ami/rpc/integrations/freshsales.js +++ b/server/services/ami/rpc/integrations/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d58=['username','remoteUri','serverUrl','Configurations','FreshsalesField','Subjects','content','variableName','Variable','Descriptions','type','keyContent','GetFreshsalesccount','name'];(function(_0x4ab766,_0xd65436){var _0x4ea49e=function(_0x3da8fc){while(--_0x3da8fc){_0x4ab766['push'](_0x4ab766['shift']());}};_0x4ea49e(++_0xd65436);}(_0x5d58,0x187));var _0x85d5=function(_0x30c919,_0x1361a3){_0x30c919=_0x30c919-0x0;var _0x31f8f2=_0x5d58[_0x30c919];return _0x31f8f2;};'use strict';var client=require('../../client');exports['getFreshsalesAccounts']=function(){return function(_0x5e2da7){return client['Request']('GetFreshsalesAccount',{'options':{'raw':![],'attributes':['id',_0x85d5('0x0'),_0x85d5('0x1'),'apiKey',_0x85d5('0x2'),_0x85d5('0x3')],'include':[{'model':'FreshsalesConfiguration','as':_0x85d5('0x4'),'attributes':['id',_0x85d5('0x0')],'include':[{'model':_0x85d5('0x5'),'as':_0x85d5('0x6'),'attributes':['id','type',_0x85d5('0x7'),_0x85d5('0x8')],'include':[{'model':'Variable','as':_0x85d5('0x9'),'attributes':['id','name']}]},{'model':_0x85d5('0x5'),'as':_0x85d5('0xa'),'attributes':['id',_0x85d5('0xb'),'content','key','keyType',_0x85d5('0xc'),_0x85d5('0x8')],'include':[{'model':_0x85d5('0x9'),'as':_0x85d5('0x9'),'attributes':['id',_0x85d5('0x0')]}]}]}]},'log':_0x85d5('0xd')});};}; \ No newline at end of file +var _0x8c46=['FreshsalesField','Subjects','type','variableName','Variable','Descriptions','keyType','keyContent','GetFreshsalesccount','../../client','Request','username','apiKey','remoteUri','serverUrl','FreshsalesConfiguration','Configurations','name'];(function(_0x3d34f0,_0x4a5dc0){var _0x135ecd=function(_0x9a81d5){while(--_0x9a81d5){_0x3d34f0['push'](_0x3d34f0['shift']());}};_0x135ecd(++_0x4a5dc0);}(_0x8c46,0x171));var _0x68c4=function(_0x1035ab,_0x2f9249){_0x1035ab=_0x1035ab-0x0;var _0x451ef1=_0x8c46[_0x1035ab];return _0x451ef1;};'use strict';var client=require(_0x68c4('0x0'));exports['getFreshsalesAccounts']=function(){return function(_0x51f442){return client[_0x68c4('0x1')]('GetFreshsalesAccount',{'options':{'raw':![],'attributes':['id','name',_0x68c4('0x2'),_0x68c4('0x3'),_0x68c4('0x4'),_0x68c4('0x5')],'include':[{'model':_0x68c4('0x6'),'as':_0x68c4('0x7'),'attributes':['id',_0x68c4('0x8')],'include':[{'model':_0x68c4('0x9'),'as':_0x68c4('0xa'),'attributes':['id',_0x68c4('0xb'),'content',_0x68c4('0xc')],'include':[{'model':_0x68c4('0xd'),'as':_0x68c4('0xd'),'attributes':['id','name']}]},{'model':_0x68c4('0x9'),'as':_0x68c4('0xe'),'attributes':['id',_0x68c4('0xb'),'content','key',_0x68c4('0xf'),_0x68c4('0x10'),'variableName'],'include':[{'model':'Variable','as':_0x68c4('0xd'),'attributes':['id',_0x68c4('0x8')]}]}]}]},'log':_0x68c4('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/salesforce.js b/server/services/ami/rpc/integrations/salesforce.js index d0ba6a7..1b95123 100644 --- a/server/services/ami/rpc/integrations/salesforce.js +++ b/server/services/ami/rpc/integrations/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['Request','GetSalesforceAccount','name','username','remoteUri','clientId','clientSecret','securityToken','serverUrl','type','SalesforceConfiguration','Configurations','moduleCreate','leadId','additionalSearchAccount','additionalSearchContact','additionalSearchLead','SalesforceField','Subjects','Variable','Descriptions','Fields','getSalesforceAccounts'];(function(_0x25766f,_0x602740){var _0xc88ed1=function(_0x4b4f7f){while(--_0x4b4f7f){_0x25766f['push'](_0x25766f['shift']());}};_0xc88ed1(++_0x602740);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var client=require('../../client');exports[_0x0baf('0x0')]=function(){return function(_0x2a3620){return client[_0x0baf('0x1')](_0x0baf('0x2'),{'options':{'raw':![],'attributes':['id',_0x0baf('0x3'),_0x0baf('0x4'),'password',_0x0baf('0x5'),_0x0baf('0x6'),_0x0baf('0x7'),_0x0baf('0x8'),_0x0baf('0x9'),_0x0baf('0xa')],'include':[{'model':_0x0baf('0xb'),'as':_0x0baf('0xc'),'attributes':['id',_0x0baf('0x3'),'moduleSearch',_0x0baf('0xd'),'ticketType',_0x0baf('0xe'),_0x0baf('0xf'),_0x0baf('0x10'),_0x0baf('0x11')],'include':[{'model':_0x0baf('0x12'),'as':_0x0baf('0x13'),'include':[{'model':_0x0baf('0x14'),'as':_0x0baf('0x14'),'attributes':['id',_0x0baf('0x3')]}]},{'model':_0x0baf('0x12'),'as':_0x0baf('0x15'),'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x0baf('0x3')]}]},{'model':_0x0baf('0x12'),'as':_0x0baf('0x16'),'include':[{'model':_0x0baf('0x14'),'as':'Variable','attributes':['id',_0x0baf('0x3')]}]}]}]},'log':'GetSalesforceAccount'});};}; \ No newline at end of file +var _0xa3d4=['type','SalesforceConfiguration','Configurations','name','moduleSearch','moduleCreate','ticketType','leadId','SalesforceField','Subjects','Variable','Descriptions','Fields','../../client','Request','GetSalesforceAccount','username','serverUrl'];(function(_0x7bd0ef,_0x4f08dd){var _0x323e43=function(_0xa8b583){while(--_0xa8b583){_0x7bd0ef['push'](_0x7bd0ef['shift']());}};_0x323e43(++_0x4f08dd);}(_0xa3d4,0x151));var _0x4a3d=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xa3d4[_0x4d613c];return _0x301fe3;};'use strict';var client=require(_0x4a3d('0x0'));exports['getSalesforceAccounts']=function(){return function(_0x159971){return client[_0x4a3d('0x1')](_0x4a3d('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x4a3d('0x3'),'password','remoteUri','clientId','clientSecret','securityToken',_0x4a3d('0x4'),_0x4a3d('0x5')],'include':[{'model':_0x4a3d('0x6'),'as':_0x4a3d('0x7'),'attributes':['id',_0x4a3d('0x8'),_0x4a3d('0x9'),_0x4a3d('0xa'),_0x4a3d('0xb'),_0x4a3d('0xc'),'additionalSearchAccount','additionalSearchContact','additionalSearchLead'],'include':[{'model':_0x4a3d('0xd'),'as':_0x4a3d('0xe'),'include':[{'model':_0x4a3d('0xf'),'as':_0x4a3d('0xf'),'attributes':['id',_0x4a3d('0x8')]}]},{'model':_0x4a3d('0xd'),'as':_0x4a3d('0x10'),'include':[{'model':_0x4a3d('0xf'),'as':_0x4a3d('0xf'),'attributes':['id',_0x4a3d('0x8')]}]},{'model':_0x4a3d('0xd'),'as':_0x4a3d('0x11'),'include':[{'model':_0x4a3d('0xf'),'as':_0x4a3d('0xf'),'attributes':['id',_0x4a3d('0x8')]}]}]}]},'log':_0x4a3d('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/servicenow.js b/server/services/ami/rpc/integrations/servicenow.js index 8a78225..1223c51 100644 --- a/server/services/ami/rpc/integrations/servicenow.js +++ b/server/services/ami/rpc/integrations/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['Variable','key','keyType','keyContent','Fields','nameField','../../client','getServicenowAccounts','Request','GetServicenowAccount','name','username','password','remoteUri','serverUrl','ServicenowField','Subjects','type','content','variableName'];(function(_0x5390db,_0x53e0b9){var _0x4e8ddd=function(_0x4f7949){while(--_0x4f7949){_0x5390db['push'](_0x5390db['shift']());}};_0x4e8ddd(++_0x53e0b9);}(_0x2ef3,0xba));var _0x32ef=function(_0x4325c9,_0x50640e){_0x4325c9=_0x4325c9-0x0;var _0x18352b=_0x2ef3[_0x4325c9];return _0x18352b;};'use strict';var client=require(_0x32ef('0x0'));exports[_0x32ef('0x1')]=function(){return function(_0x47513a){return client[_0x32ef('0x2')](_0x32ef('0x3'),{'options':{'raw':![],'attributes':['id',_0x32ef('0x4'),'description',_0x32ef('0x5'),_0x32ef('0x6'),'email',_0x32ef('0x7'),_0x32ef('0x8')],'include':[{'model':'ServicenowConfiguration','as':'Configurations','attributes':['id',_0x32ef('0x4')],'include':[{'model':_0x32ef('0x9'),'as':_0x32ef('0xa'),'attributes':['id',_0x32ef('0xb'),_0x32ef('0xc'),_0x32ef('0xd')],'include':[{'model':_0x32ef('0xe'),'as':_0x32ef('0xe'),'attributes':['id',_0x32ef('0x4')]}]},{'model':_0x32ef('0x9'),'as':'Descriptions','attributes':['id','type',_0x32ef('0xc'),_0x32ef('0xf'),_0x32ef('0x10'),_0x32ef('0x11'),'variableName'],'include':[{'model':_0x32ef('0xe'),'as':'Variable','attributes':['id',_0x32ef('0x4')]}]},{'model':'ServicenowField','as':_0x32ef('0x12'),'attributes':['id',_0x32ef('0xb'),'content','idField',_0x32ef('0x13'),'customField',_0x32ef('0xd')],'include':[{'model':_0x32ef('0xe'),'as':_0x32ef('0xe'),'attributes':['id',_0x32ef('0x4')]}]}]}]},'log':'GetServicenowkAccount'});};}; \ No newline at end of file +var _0xabce=['password','email','ServicenowConfiguration','name','Subjects','type','content','Variable','ServicenowField','Descriptions','key','keyType','keyContent','variableName','Fields','idField','nameField','../../client','getServicenowAccounts','Request','GetServicenowAccount','username'];(function(_0x1d6a5f,_0x6ad489){var _0x1ad86c=function(_0x562227){while(--_0x562227){_0x1d6a5f['push'](_0x1d6a5f['shift']());}};_0x1ad86c(++_0x6ad489);}(_0xabce,0x103));var _0xeabc=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xabce[_0x32d457];return _0x338386;};'use strict';var client=require(_0xeabc('0x0'));exports[_0xeabc('0x1')]=function(){return function(_0x357cda){return client[_0xeabc('0x2')](_0xeabc('0x3'),{'options':{'raw':![],'attributes':['id','name','description',_0xeabc('0x4'),_0xeabc('0x5'),_0xeabc('0x6'),'remoteUri','serverUrl'],'include':[{'model':_0xeabc('0x7'),'as':'Configurations','attributes':['id',_0xeabc('0x8')],'include':[{'model':'ServicenowField','as':_0xeabc('0x9'),'attributes':['id',_0xeabc('0xa'),_0xeabc('0xb'),'variableName'],'include':[{'model':_0xeabc('0xc'),'as':_0xeabc('0xc'),'attributes':['id',_0xeabc('0x8')]}]},{'model':_0xeabc('0xd'),'as':_0xeabc('0xe'),'attributes':['id',_0xeabc('0xa'),_0xeabc('0xb'),_0xeabc('0xf'),_0xeabc('0x10'),_0xeabc('0x11'),_0xeabc('0x12')],'include':[{'model':_0xeabc('0xc'),'as':_0xeabc('0xc'),'attributes':['id',_0xeabc('0x8')]}]},{'model':_0xeabc('0xd'),'as':_0xeabc('0x13'),'attributes':['id','type',_0xeabc('0xb'),_0xeabc('0x14'),_0xeabc('0x15'),'customField','variableName'],'include':[{'model':_0xeabc('0xc'),'as':_0xeabc('0xc'),'attributes':['id',_0xeabc('0x8')]}]}]}]},'log':'GetServicenowkAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/sugarcrm.js b/server/services/ami/rpc/integrations/sugarcrm.js index f73ddc3..bf3b821 100644 --- a/server/services/ami/rpc/integrations/sugarcrm.js +++ b/server/services/ami/rpc/integrations/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda2d=['Subjects','type','content','variableName','Variable','key','keyType','keyContent','idField','nameField','customField','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','serverUrl','SugarcrmConfiguration','Configurations','SugarcrmField'];(function(_0x594ece,_0x2a1f27){var _0x471bc4=function(_0x31941c){while(--_0x31941c){_0x594ece['push'](_0x594ece['shift']());}};_0x471bc4(++_0x2a1f27);}(_0xda2d,0x102));var _0xdda2=function(_0xa2813c,_0x2352c6){_0xa2813c=_0xa2813c-0x0;var _0x15f6ce=_0xda2d[_0xa2813c];return _0x15f6ce;};'use strict';var client=require('../../client');exports[_0xdda2('0x0')]=function(){return function(_0x35f029){return client[_0xdda2('0x1')](_0xdda2('0x2'),{'options':{'raw':![],'attributes':['id',_0xdda2('0x3'),'username','password','remoteUri',_0xdda2('0x4')],'include':[{'model':_0xdda2('0x5'),'as':_0xdda2('0x6'),'attributes':['id',_0xdda2('0x3')],'include':[{'model':_0xdda2('0x7'),'as':_0xdda2('0x8'),'attributes':['id',_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0xb')],'include':[{'model':_0xdda2('0xc'),'as':'Variable','attributes':['id',_0xdda2('0x3')]}]},{'model':_0xdda2('0x7'),'as':'Descriptions','attributes':['id',_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0xd'),_0xdda2('0xe'),_0xdda2('0xf'),_0xdda2('0xb')],'include':[{'model':_0xdda2('0xc'),'as':_0xdda2('0xc'),'attributes':['id','name']}]},{'model':'SugarcrmField','as':'Fields','attributes':['id',_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0x10'),_0xdda2('0x11'),_0xdda2('0x12'),_0xdda2('0xb')],'include':[{'model':_0xdda2('0xc'),'as':'Variable','attributes':['id',_0xdda2('0x3')]}]}]}]},'log':'GetSugarcrmAccount'});};}; \ No newline at end of file +var _0x2032=['GetSugarcrmAccount','getSugarcrmAccounts','Request','name','username','remoteUri','serverUrl','SugarcrmConfiguration','Configurations','SugarcrmField','Subjects','type','content','variableName','Variable','key','keyContent','customField'];(function(_0x2740ec,_0x4629fb){var _0x54daae=function(_0x1b18c0){while(--_0x1b18c0){_0x2740ec['push'](_0x2740ec['shift']());}};_0x54daae(++_0x4629fb);}(_0x2032,0xd9));var _0x2203=function(_0x4f2171,_0x32b221){_0x4f2171=_0x4f2171-0x0;var _0x29db8f=_0x2032[_0x4f2171];return _0x29db8f;};'use strict';var client=require('../../client');exports[_0x2203('0x0')]=function(){return function(_0x1e103d){return client[_0x2203('0x1')]('GetSugarcrmAccount',{'options':{'raw':![],'attributes':['id',_0x2203('0x2'),_0x2203('0x3'),'password',_0x2203('0x4'),_0x2203('0x5')],'include':[{'model':_0x2203('0x6'),'as':_0x2203('0x7'),'attributes':['id',_0x2203('0x2')],'include':[{'model':_0x2203('0x8'),'as':_0x2203('0x9'),'attributes':['id',_0x2203('0xa'),_0x2203('0xb'),_0x2203('0xc')],'include':[{'model':_0x2203('0xd'),'as':'Variable','attributes':['id','name']}]},{'model':_0x2203('0x8'),'as':'Descriptions','attributes':['id',_0x2203('0xa'),_0x2203('0xb'),_0x2203('0xe'),'keyType',_0x2203('0xf'),'variableName'],'include':[{'model':_0x2203('0xd'),'as':'Variable','attributes':['id',_0x2203('0x2')]}]},{'model':_0x2203('0x8'),'as':'Fields','attributes':['id','type','content','idField','nameField',_0x2203('0x10'),'variableName'],'include':[{'model':'Variable','as':_0x2203('0xd'),'attributes':['id',_0x2203('0x2')]}]}]}]},'log':_0x2203('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/vtiger.js b/server/services/ami/rpc/integrations/vtiger.js index e39c3cb..8cac27e 100644 --- a/server/services/ami/rpc/integrations/vtiger.js +++ b/server/services/ami/rpc/integrations/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x228c=['type','content','variableName','Variable','VtigerField','key','keyType','keyContent','Fields','customField','../../client','Request','GetVtigerAccount','name','serverUrl','VtigerConfiguration'];(function(_0x536371,_0xad2fec){var _0x2f27b4=function(_0x1a3d68){while(--_0x1a3d68){_0x536371['push'](_0x536371['shift']());}};_0x2f27b4(++_0xad2fec);}(_0x228c,0xba));var _0xc228=function(_0x1269f8,_0xf0b86b){_0x1269f8=_0x1269f8-0x0;var _0x441e03=_0x228c[_0x1269f8];return _0x441e03;};'use strict';var client=require(_0xc228('0x0'));exports['getVtigerAccounts']=function(){return function(_0x3c14e1){return client[_0xc228('0x1')](_0xc228('0x2'),{'options':{'raw':![],'attributes':['id',_0xc228('0x3'),'description','username','accessKey','remoteUri',_0xc228('0x4')],'include':[{'model':_0xc228('0x5'),'as':'Configurations','attributes':['id',_0xc228('0x3')],'include':[{'model':'VtigerField','as':'Subjects','attributes':['id',_0xc228('0x6'),_0xc228('0x7'),_0xc228('0x8')],'include':[{'model':_0xc228('0x9'),'as':_0xc228('0x9'),'attributes':['id',_0xc228('0x3')]}]},{'model':_0xc228('0xa'),'as':'Descriptions','attributes':['id','type',_0xc228('0x7'),_0xc228('0xb'),_0xc228('0xc'),_0xc228('0xd'),_0xc228('0x8')],'include':[{'model':_0xc228('0x9'),'as':_0xc228('0x9'),'attributes':['id',_0xc228('0x3')]}]},{'model':'VtigerField','as':_0xc228('0xe'),'attributes':['id',_0xc228('0x6'),'content','idField','nameField',_0xc228('0xf'),'variableName'],'include':[{'model':_0xc228('0x9'),'as':_0xc228('0x9'),'attributes':['id',_0xc228('0x3')]}]}]}]},'log':_0xc228('0x2')});};}; \ No newline at end of file +var _0x86eb=['Subjects','variableName','Variable','VtigerField','Descriptions','content','keyType','keyContent','Fields','type','nameField','customField','getVtigerAccounts','Request','GetVtigerAccount','name','username','accessKey','VtigerConfiguration'];(function(_0x46952d,_0x5a4c42){var _0x4652cb=function(_0x254095){while(--_0x254095){_0x46952d['push'](_0x46952d['shift']());}};_0x4652cb(++_0x5a4c42);}(_0x86eb,0x188));var _0xb86e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x86eb[_0x122ef9];return _0x42fba0;};'use strict';var client=require('../../client');exports[_0xb86e('0x0')]=function(){return function(_0x53e535){return client[_0xb86e('0x1')](_0xb86e('0x2'),{'options':{'raw':![],'attributes':['id',_0xb86e('0x3'),'description',_0xb86e('0x4'),_0xb86e('0x5'),'remoteUri','serverUrl'],'include':[{'model':_0xb86e('0x6'),'as':'Configurations','attributes':['id','name'],'include':[{'model':'VtigerField','as':_0xb86e('0x7'),'attributes':['id','type','content',_0xb86e('0x8')],'include':[{'model':_0xb86e('0x9'),'as':_0xb86e('0x9'),'attributes':['id',_0xb86e('0x3')]}]},{'model':_0xb86e('0xa'),'as':_0xb86e('0xb'),'attributes':['id','type',_0xb86e('0xc'),'key',_0xb86e('0xd'),_0xb86e('0xe'),'variableName'],'include':[{'model':_0xb86e('0x9'),'as':_0xb86e('0x9'),'attributes':['id','name']}]},{'model':_0xb86e('0xa'),'as':_0xb86e('0xf'),'attributes':['id',_0xb86e('0x10'),_0xb86e('0xc'),'idField',_0xb86e('0x11'),_0xb86e('0x12'),'variableName'],'include':[{'model':_0xb86e('0x9'),'as':_0xb86e('0x9'),'attributes':['id',_0xb86e('0x3')]}]}]}]},'log':_0xb86e('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zendesk.js b/server/services/ami/rpc/integrations/zendesk.js index b31413f..394baf2 100644 --- a/server/services/ami/rpc/integrations/zendesk.js +++ b/server/services/ami/rpc/integrations/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6f2=['Variable','Descriptions','key','keyType','keyContent','variableName','Fields','idField','nameField','customField','../../client','getZendeskAccounts','Request','GetZendeskAccount','name','username','token','serverUrl','type','ZendeskConfiguration','Configurations','Tag','ZendeskField','content'];(function(_0x241246,_0x2937ba){var _0x4d7043=function(_0x393fa6){while(--_0x393fa6){_0x241246['push'](_0x241246['shift']());}};_0x4d7043(++_0x2937ba);}(_0xd6f2,0x6a));var _0x2d6f=function(_0x28031b,_0x2dff75){_0x28031b=_0x28031b-0x0;var _0x20913d=_0xd6f2[_0x28031b];return _0x20913d;};'use strict';var client=require(_0x2d6f('0x0'));exports[_0x2d6f('0x1')]=function(){return function(_0x34d86b){return client[_0x2d6f('0x2')](_0x2d6f('0x3'),{'options':{'raw':![],'attributes':['id',_0x2d6f('0x4'),_0x2d6f('0x5'),'password',_0x2d6f('0x6'),'remoteUri','authType',_0x2d6f('0x7'),_0x2d6f('0x8')],'include':[{'model':_0x2d6f('0x9'),'as':_0x2d6f('0xa'),'attributes':['id','name'],'include':[{'model':_0x2d6f('0xb'),'attributes':['id',_0x2d6f('0x4')]},{'model':_0x2d6f('0xc'),'as':'Subjects','attributes':['id','type',_0x2d6f('0xd'),'variableName'],'include':[{'model':_0x2d6f('0xe'),'as':'Variable','attributes':['id',_0x2d6f('0x4')]}]},{'model':_0x2d6f('0xc'),'as':_0x2d6f('0xf'),'attributes':['id',_0x2d6f('0x8'),_0x2d6f('0xd'),_0x2d6f('0x10'),_0x2d6f('0x11'),_0x2d6f('0x12'),_0x2d6f('0x13')],'include':[{'model':_0x2d6f('0xe'),'as':_0x2d6f('0xe'),'attributes':['id',_0x2d6f('0x4')]}]},{'model':_0x2d6f('0xc'),'as':_0x2d6f('0x14'),'attributes':['id',_0x2d6f('0x8'),_0x2d6f('0xd'),_0x2d6f('0x15'),_0x2d6f('0x16'),_0x2d6f('0x17'),'variableName'],'include':[{'model':_0x2d6f('0xe'),'as':_0x2d6f('0xe'),'attributes':['id',_0x2d6f('0x4')]}]}]}]},'log':'GetZendeskAccount'});};}; \ No newline at end of file +var _0xabdb=['ZendeskField','Subjects','variableName','Variable','Descriptions','content','key','keyType','Fields','idField','customField','getZendeskAccounts','Request','GetZendeskAccount','username','password','token','remoteUri','authType','type','ZendeskConfiguration','name','Tag'];(function(_0x332f74,_0x383385){var _0x3a5115=function(_0x59de59){while(--_0x59de59){_0x332f74['push'](_0x332f74['shift']());}};_0x3a5115(++_0x383385);}(_0xabdb,0x14d));var _0xbabd=function(_0x31e80d,_0x10ef41){_0x31e80d=_0x31e80d-0x0;var _0x4dc249=_0xabdb[_0x31e80d];return _0x4dc249;};'use strict';var client=require('../../client');exports[_0xbabd('0x0')]=function(){return function(_0x36e8b6){return client[_0xbabd('0x1')](_0xbabd('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xbabd('0x3'),_0xbabd('0x4'),_0xbabd('0x5'),_0xbabd('0x6'),_0xbabd('0x7'),'serverUrl',_0xbabd('0x8')],'include':[{'model':_0xbabd('0x9'),'as':'Configurations','attributes':['id',_0xbabd('0xa')],'include':[{'model':_0xbabd('0xb'),'attributes':['id',_0xbabd('0xa')]},{'model':_0xbabd('0xc'),'as':_0xbabd('0xd'),'attributes':['id','type','content',_0xbabd('0xe')],'include':[{'model':_0xbabd('0xf'),'as':_0xbabd('0xf'),'attributes':['id','name']}]},{'model':_0xbabd('0xc'),'as':_0xbabd('0x10'),'attributes':['id',_0xbabd('0x8'),_0xbabd('0x11'),_0xbabd('0x12'),_0xbabd('0x13'),'keyContent',_0xbabd('0xe')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0xbabd('0xa')]}]},{'model':_0xbabd('0xc'),'as':_0xbabd('0x14'),'attributes':['id','type','content',_0xbabd('0x15'),'nameField',_0xbabd('0x16'),_0xbabd('0xe')],'include':[{'model':_0xbabd('0xf'),'as':'Variable','attributes':['id',_0xbabd('0xa')]}]}]}]},'log':_0xbabd('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zoho.js b/server/services/ami/rpc/integrations/zoho.js index 9886903..9bb6df1 100644 --- a/server/services/ami/rpc/integrations/zoho.js +++ b/server/services/ami/rpc/integrations/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2c56=['nameField','customField','../../client','getZohoAccounts','Request','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','ZohoConfiguration','Configurations','name','moduleCreate','moduleSearch','ZohoField','Subjects','type','content','variableName','Variable','Descriptions','key','keyType','Fields','idField'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x2c56,0x124));var _0x62c5=function(_0x4d8536,_0x2acb73){_0x4d8536=_0x4d8536-0x0;var _0x496b14=_0x2c56[_0x4d8536];return _0x496b14;};'use strict';var client=require(_0x62c5('0x0'));exports[_0x62c5('0x1')]=function(){return function(_0xdbab23){return client[_0x62c5('0x2')]('GetZohoAccount',{'options':{'raw':![],'attributes':['id','name',_0x62c5('0x3'),_0x62c5('0x4'),_0x62c5('0x5'),_0x62c5('0x6'),_0x62c5('0x7'),_0x62c5('0x8'),_0x62c5('0x9'),_0x62c5('0xa')],'include':[{'model':_0x62c5('0xb'),'as':_0x62c5('0xc'),'attributes':['id',_0x62c5('0xd'),_0x62c5('0xe'),_0x62c5('0xf'),_0x62c5('0x3')],'include':[{'model':_0x62c5('0x10'),'as':_0x62c5('0x11'),'attributes':['id',_0x62c5('0x12'),_0x62c5('0x13'),_0x62c5('0x14')],'include':[{'model':_0x62c5('0x15'),'as':_0x62c5('0x15'),'attributes':['id','name']}]},{'model':_0x62c5('0x10'),'as':_0x62c5('0x16'),'attributes':['id',_0x62c5('0x12'),_0x62c5('0x13'),_0x62c5('0x17'),_0x62c5('0x18'),'keyContent',_0x62c5('0x14')],'include':[{'model':_0x62c5('0x15'),'as':_0x62c5('0x15'),'attributes':['id',_0x62c5('0xd')]}]},{'model':_0x62c5('0x10'),'as':_0x62c5('0x19'),'attributes':['id',_0x62c5('0x12'),'content',_0x62c5('0x1a'),_0x62c5('0x1b'),_0x62c5('0x1c'),'variableName'],'include':[{'model':'Variable','as':_0x62c5('0x15'),'attributes':['id',_0x62c5('0xd')]}]}]}]},'log':'GetZohoAccount'});};}; \ No newline at end of file +var _0xa551=['../../client','getZohoAccounts','Request','GetZohoAccount','name','description','host','zone','clientId','serverUrl','code','refreshToken','ZohoConfiguration','Configurations','moduleSearch','ZohoField','Subjects','type','content','variableName','Variable','keyContent','Fields','nameField','customField'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0xa551,0x96));var _0x1a55=function(_0x117625,_0x11f259){_0x117625=_0x117625-0x0;var _0x137ae3=_0xa551[_0x117625];return _0x137ae3;};'use strict';var client=require(_0x1a55('0x0'));exports[_0x1a55('0x1')]=function(){return function(_0x33454e){return client[_0x1a55('0x2')](_0x1a55('0x3'),{'options':{'raw':![],'attributes':['id',_0x1a55('0x4'),_0x1a55('0x5'),_0x1a55('0x6'),_0x1a55('0x7'),_0x1a55('0x8'),'clientSecret',_0x1a55('0x9'),_0x1a55('0xa'),_0x1a55('0xb')],'include':[{'model':_0x1a55('0xc'),'as':_0x1a55('0xd'),'attributes':['id','name','moduleCreate',_0x1a55('0xe'),_0x1a55('0x5')],'include':[{'model':_0x1a55('0xf'),'as':_0x1a55('0x10'),'attributes':['id',_0x1a55('0x11'),_0x1a55('0x12'),_0x1a55('0x13')],'include':[{'model':_0x1a55('0x14'),'as':_0x1a55('0x14'),'attributes':['id',_0x1a55('0x4')]}]},{'model':_0x1a55('0xf'),'as':'Descriptions','attributes':['id',_0x1a55('0x11'),_0x1a55('0x12'),'key','keyType',_0x1a55('0x15'),_0x1a55('0x13')],'include':[{'model':_0x1a55('0x14'),'as':_0x1a55('0x14'),'attributes':['id',_0x1a55('0x4')]}]},{'model':_0x1a55('0xf'),'as':_0x1a55('0x16'),'attributes':['id','type',_0x1a55('0x12'),'idField',_0x1a55('0x17'),_0x1a55('0x18'),_0x1a55('0x13')],'include':[{'model':'Variable','as':_0x1a55('0x14'),'attributes':['id',_0x1a55('0x4')]}]}]}]},'log':_0x1a55('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index 2283bc7..0022a8c 100644 --- a/server/services/ami/rpc/interval.js +++ b/server/services/ami/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa814=['concat','Request','IntervalIftime','intervalIftime','../../../config/logger','dialer','../client','replace','trim','silly','intervalIftime\x20called\x20with','every','number','string','length','map','interval'];(function(_0x495b26,_0x3a0338){var _0x1e6a0e=function(_0x3bd0d8){while(--_0x3bd0d8){_0x495b26['push'](_0x495b26['shift']());}};_0x1e6a0e(++_0x3a0338);}(_0xa814,0x9d));var _0x4a81=function(_0x36f5d0,_0x21f87f){_0x36f5d0=_0x36f5d0-0x0;var _0x2656c3=_0xa814[_0x36f5d0];return _0x2656c3;};var logger=require(_0x4a81('0x0'))(_0x4a81('0x1'));var client=require(_0x4a81('0x2'));function intervalIftime(_0x2e4b3a,_0x19eb87){const _0x4b4203=new Error()['stack'][_0x4a81('0x3')](/^Error/,'')[_0x4a81('0x4')]();logger[_0x4a81('0x5')](_0x4a81('0x6'),_0x2e4b3a,_0x19eb87,_0x4b4203);const _0x3bb213=Array['isArray'](_0x2e4b3a);if(!_0x2e4b3a||_0x3bb213&&_0x2e4b3a['length']===0x0){return Promise['resolve'](![]);}else{var _0x4104e0=[];var _0x27a579=[];var _0x4ffc46=_0x3bb213?_0x2e4b3a:[_0x2e4b3a];var _0x16b8dc=_0x4ffc46[_0x4a81('0x7')](function(_0x157429){return typeof _0x157429===_0x4a81('0x8');});var _0x444525=_0x4ffc46['every'](function(_0x5ce2e7){return typeof _0x5ce2e7===_0x4a81('0x9');});if(!_0x16b8dc&&!_0x444525){_0x4104e0=_0x4ffc46['map'](function(_0x2ac0a4){return _0x2ac0a4['id'];});if(_0x4104e0[_0x4a81('0xa')]===0x0){_0x27a579=_0x4ffc46[_0x4a81('0xb')](function(_0x216ed2){return _0x216ed2[_0x4a81('0xc')];});}}else{if(_0x16b8dc){_0x4104e0=_0x4104e0['concat'](_0x4ffc46);}if(_0x444525){_0x27a579=_0x27a579[_0x4a81('0xd')](_0x4ffc46);}}return client[_0x4a81('0xe')](_0x4a81('0xf'),{'intervalIds':_0x4104e0,'intervals':_0x27a579,'timezone':_0x19eb87,'log':_0x4a81('0xf')});}}exports[_0x4a81('0x10')]=intervalIftime; \ No newline at end of file +var _0x08bc=['../../../config/logger','dialer','replace','trim','silly','isArray','resolve','every','string','map','length','concat','IntervalIftime','intervalIftime'];(function(_0x3cc8b2,_0x18cdb1){var _0x19a23e=function(_0x176fe0){while(--_0x176fe0){_0x3cc8b2['push'](_0x3cc8b2['shift']());}};_0x19a23e(++_0x18cdb1);}(_0x08bc,0x126));var _0xc08b=function(_0x6dfbaa,_0x31eede){_0x6dfbaa=_0x6dfbaa-0x0;var _0xfbe02=_0x08bc[_0x6dfbaa];return _0xfbe02;};var logger=require(_0xc08b('0x0'))(_0xc08b('0x1'));var client=require('../client');function intervalIftime(_0x1b831f,_0x41ed60){const _0x320070=new Error()['stack'][_0xc08b('0x2')](/^Error/,'')[_0xc08b('0x3')]();logger[_0xc08b('0x4')]('intervalIftime\x20called\x20with',_0x1b831f,_0x41ed60,_0x320070);const _0x43469f=Array[_0xc08b('0x5')](_0x1b831f);if(!_0x1b831f||_0x43469f&&_0x1b831f['length']===0x0){return Promise[_0xc08b('0x6')](![]);}else{var _0x27c5a6=[];var _0x1a0447=[];var _0x24c06f=_0x43469f?_0x1b831f:[_0x1b831f];var _0x5941ed=_0x24c06f['every'](function(_0x2ae83c){return typeof _0x2ae83c==='number';});var _0x3d3a4b=_0x24c06f[_0xc08b('0x7')](function(_0x22010d){return typeof _0x22010d===_0xc08b('0x8');});if(!_0x5941ed&&!_0x3d3a4b){_0x27c5a6=_0x24c06f[_0xc08b('0x9')](function(_0x211867){return _0x211867['id'];});if(_0x27c5a6[_0xc08b('0xa')]===0x0){_0x1a0447=_0x24c06f[_0xc08b('0x9')](function(_0x1c3c11){return _0x1c3c11['interval'];});}}else{if(_0x5941ed){_0x27c5a6=_0x27c5a6[_0xc08b('0xb')](_0x24c06f);}if(_0x3d3a4b){_0x1a0447=_0x1a0447[_0xc08b('0xb')](_0x24c06f);}}return client['Request'](_0xc08b('0xc'),{'intervalIds':_0x27c5a6,'intervals':_0x1a0447,'timezone':_0x41ed60,'log':_0xc08b('0xc')});}}exports[_0xc08b('0xd')]=intervalIftime; \ No newline at end of file diff --git a/server/services/ami/rpc/memberReport.js b/server/services/ami/rpc/memberReport.js index 324a326..d15bdfa 100644 --- a/server/services/ami/rpc/memberReport.js +++ b/server/services/ami/rpc/memberReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x23ae=['queuecallerexitAt','CreateMemberReport','lastAssignedTo','isNil','format','SIP/%s','interface','TALKING','queuecallerleaveAt','diff','seconds','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','Request','voice','membername','endtime','starttime','outbound','dialstring','moment','../client','voiceQueueReport','queuecallercompleteAt'];(function(_0x3c34e8,_0xf4972a){var _0x336297=function(_0x44c400){while(--_0x44c400){_0x3c34e8['push'](_0x3c34e8['shift']());}};_0x336297(++_0xf4972a);}(_0x23ae,0xe4));var _0xe23a=function(_0x305b12,_0x5ecd09){_0x305b12=_0x305b12-0x0;var _0x4141de=_0x23ae[_0x305b12];return _0x4141de;};'use strict';var moment=require(_0xe23a('0x0'));var _=require('lodash');var util=require('util');var client=require(_0xe23a('0x1'));exports[_0xe23a('0x2')]=function(_0x4f9107){var _0x361e97=_0x4f9107[_0xe23a('0x3')]||_0x4f9107[_0xe23a('0x4')];return client['Request'](_0xe23a('0x5'),{'body':{'channel':'voice','membername':_0x4f9107[_0xe23a('0x6')],'interface':_[_0xe23a('0x7')](_0x4f9107['interface'])?util[_0xe23a('0x8')](_0xe23a('0x9'),_0x4f9107[_0xe23a('0x6')]):_0x4f9107[_0xe23a('0xa')],'type':_0xe23a('0xb'),'enterAt':_0x4f9107[_0xe23a('0xc')],'exitAt':_0x361e97,'duration':moment(_0x361e97)[_0xe23a('0xd')](_0x4f9107[_0xe23a('0xc')],_0xe23a('0xe')),'data1':'inbound','data2':_0x4f9107[_0xe23a('0xf')],'data3':_0x4f9107[_0xe23a('0x10')],'data4':null,'data5':_0x4f9107[_0xe23a('0x11')],'role':_0xe23a('0x12'),'internal':_0x4f9107[_0xe23a('0x13')]?_[_0xe23a('0x14')](_0x4f9107['accountcode']):undefined,'uniqueid':_0x4f9107[_0xe23a('0x15')]},'log':_0xe23a('0x5')});};exports['voiceDialReport']=function(_0x201674){return client[_0xe23a('0x16')](_0xe23a('0x5'),{'body':{'channel':_0xe23a('0x17'),'membername':_0x201674[_0xe23a('0x18')],'interface':_0x201674[_0xe23a('0xa')],'type':'TALKING','enterAt':_0x201674['starttime'],'exitAt':_0x201674[_0xe23a('0x19')],'duration':moment(_0x201674['endtime'])[_0xe23a('0xd')](_0x201674['starttime'],_0xe23a('0xe'))>=0x0?moment(_0x201674[_0xe23a('0x19')])[_0xe23a('0xd')](_0x201674[_0xe23a('0x1a')],_0xe23a('0xe')):null,'data1':_0xe23a('0x1b'),'data2':_0x201674[_0xe23a('0x13')],'data3':_0x201674[_0xe23a('0x10')],'data4':_0x201674[_0xe23a('0x1c')]||null,'role':_0xe23a('0x12'),'internal':_0x201674['accountcode']?_[_0xe23a('0x14')](_0x201674[_0xe23a('0x13')]):undefined,'uniqueid':_0x201674[_0xe23a('0x15')]},'log':_0xe23a('0x5')});}; \ No newline at end of file +var _0x171b=['CreateMemberReport','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','voiceDialReport','voice','starttime','endtime','seconds','dialstring','lodash','util','../client','queuecallercompleteAt','queuecallerexitAt'];(function(_0xf15036,_0x52e137){var _0x2985dd=function(_0x2d2dca){while(--_0x2d2dca){_0xf15036['push'](_0xf15036['shift']());}};_0x2985dd(++_0x52e137);}(_0x171b,0x109));var _0xb171=function(_0x19f7d6,_0x111ba6){_0x19f7d6=_0x19f7d6-0x0;var _0x1268c6=_0x171b[_0x19f7d6];return _0x1268c6;};'use strict';var moment=require('moment');var _=require(_0xb171('0x0'));var util=require(_0xb171('0x1'));var client=require(_0xb171('0x2'));exports['voiceQueueReport']=function(_0xbb208d){var _0x261d7a=_0xbb208d[_0xb171('0x3')]||_0xbb208d[_0xb171('0x4')];return client['Request'](_0xb171('0x5'),{'body':{'channel':'voice','membername':_0xbb208d[_0xb171('0x6')],'interface':_[_0xb171('0x7')](_0xbb208d[_0xb171('0x8')])?util[_0xb171('0x9')](_0xb171('0xa'),_0xbb208d['lastAssignedTo']):_0xbb208d[_0xb171('0x8')],'type':_0xb171('0xb'),'enterAt':_0xbb208d['queuecallerleaveAt'],'exitAt':_0x261d7a,'duration':moment(_0x261d7a)['diff'](_0xbb208d[_0xb171('0xc')],'seconds'),'data1':_0xb171('0xd'),'data2':_0xbb208d[_0xb171('0xe')],'data3':_0xbb208d[_0xb171('0xf')],'data4':null,'data5':_0xbb208d[_0xb171('0x10')],'role':_0xb171('0x11'),'internal':_0xbb208d[_0xb171('0x12')]?_[_0xb171('0x13')](_0xbb208d[_0xb171('0x12')]):undefined,'uniqueid':_0xbb208d[_0xb171('0x14')]},'log':'CreateMemberReport'});};exports[_0xb171('0x15')]=function(_0x3ee6ac){return client['Request'](_0xb171('0x5'),{'body':{'channel':_0xb171('0x16'),'membername':_0x3ee6ac['membername'],'interface':_0x3ee6ac[_0xb171('0x8')],'type':_0xb171('0xb'),'enterAt':_0x3ee6ac[_0xb171('0x17')],'exitAt':_0x3ee6ac[_0xb171('0x18')],'duration':moment(_0x3ee6ac[_0xb171('0x18')])['diff'](_0x3ee6ac[_0xb171('0x17')],'seconds')>=0x0?moment(_0x3ee6ac['endtime'])['diff'](_0x3ee6ac['starttime'],_0xb171('0x19')):null,'data1':'outbound','data2':_0x3ee6ac[_0xb171('0x12')],'data3':_0x3ee6ac['exten'],'data4':_0x3ee6ac[_0xb171('0x1a')]||null,'role':_0xb171('0x11'),'internal':_0x3ee6ac[_0xb171('0x12')]?_[_0xb171('0x13')](_0x3ee6ac[_0xb171('0x12')]):undefined,'uniqueid':_0x3ee6ac[_0xb171('0x14')]},'log':_0xb171('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 8b09525..f7f8d25 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 _0x4628=['GetSettings','../client','getSettings','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x4628,0xd3));var _0x8462=function(_0x9b9234,_0x3b8f3b){_0x9b9234=_0x9b9234-0x0;var _0x89e7c2=_0x4628[_0x9b9234];return _0x89e7c2;};'use strict';var client=require(_0x8462('0x0'));exports[_0x8462('0x1')]=function(){return client['Request'](_0x8462('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x8462('0x3'),_0x8462('0x4')]},'log':_0x8462('0x5')});}; \ No newline at end of file +var _0x3d45=['Request','ShowSetting','stopRecordingOnTransfer','GetSettings','../client','getSettings'];(function(_0xe9d9ad,_0x4e0bed){var _0x4194e7=function(_0x367405){while(--_0x367405){_0xe9d9ad['push'](_0xe9d9ad['shift']());}};_0x4194e7(++_0x4e0bed);}(_0x3d45,0x1d2));var _0x53d4=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3d45[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0x53d4('0x0'));exports[_0x53d4('0x1')]=function(){return client[_0x53d4('0x2')](_0x53d4('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x53d4('0x4'),'previewRecallmeReminderInterval']},'log':_0x53d4('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index db2d87c..9f213a2 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 _0xf44e=['html','../client','GetTemplate','name'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf44e,0x1d5));var _0xef44=function(_0xcb76eb,_0x165b2d){_0xcb76eb=_0xcb76eb-0x0;var _0x414ae8=_0xf44e[_0xcb76eb];return _0x414ae8;};'use strict';var client=require(_0xef44('0x0'));exports['getTemplates']=function(_0x1201e3){return function(_0x7f026a){return client['Request'](_0xef44('0x1'),{'options':{'raw':!![],'attributes':['id',_0xef44('0x2'),_0xef44('0x3')]},'log':_0xef44('0x1')});};}; \ No newline at end of file +var _0x012d=['GetTemplate','Request','name'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x012d,0x14e));var _0xd012=function(_0x41f4b1,_0x5a0b5f){_0x41f4b1=_0x41f4b1-0x0;var _0x3b8811=_0x012d[_0x41f4b1];return _0x3b8811;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x4e70c8){return function(_0xca421){return client[_0xd012('0x0')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xd012('0x1'),'html']},'log':_0xd012('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 29293e5..b0464df 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 _0x0699=['channel','status','Condition','AllConditions','field','operator','value','AnyConditions','action','data2','data3','data4','data5','data6','../client','Request','GetTrigger','name'];(function(_0x5960f6,_0x3a8ce3){var _0x2019d6=function(_0x3d9cb2){while(--_0x3d9cb2){_0x5960f6['push'](_0x5960f6['shift']());}};_0x2019d6(++_0x3a8ce3);}(_0x0699,0x11c));var _0x9069=function(_0x14ce9f,_0x1dd05b){_0x14ce9f=_0x14ce9f-0x0;var _0x5237d8=_0x0699[_0x14ce9f];return _0x5237d8;};'use strict';var client=require(_0x9069('0x0'));exports['getTriggers']=function(_0x4924f9){return function(_0x122620){return client[_0x9069('0x1')](_0x9069('0x2'),{'options':{'raw':![],'attributes':['id',_0x9069('0x3'),_0x9069('0x4'),_0x9069('0x5')],'include':[{'model':_0x9069('0x6'),'as':_0x9069('0x7'),'attributes':['id',_0x9069('0x8'),_0x9069('0x9'),_0x9069('0xa')]},{'model':_0x9069('0x6'),'as':_0x9069('0xb'),'attributes':['id',_0x9069('0x8'),_0x9069('0x9'),_0x9069('0xa')]},{'model':'Action','as':'Actions','attributes':['id',_0x9069('0xc'),'data1',_0x9069('0xd'),_0x9069('0xe'),_0x9069('0xf'),_0x9069('0x10'),_0x9069('0x11'),'data7']}]},'log':_0x9069('0x2')});};}; \ No newline at end of file +var _0x4199=['value','Condition','Actions','action','data1','data2','data6','../client','Request','GetTrigger','channel','status','field','operator'];(function(_0x3566ea,_0x50e87d){var _0x24c0b9=function(_0x1f22a5){while(--_0x1f22a5){_0x3566ea['push'](_0x3566ea['shift']());}};_0x24c0b9(++_0x50e87d);}(_0x4199,0x103));var _0x9419=function(_0x3d60b5,_0x22a302){_0x3d60b5=_0x3d60b5-0x0;var _0x2efeb1=_0x4199[_0x3d60b5];return _0x2efeb1;};'use strict';var client=require(_0x9419('0x0'));exports['getTriggers']=function(_0x224624){return function(_0x2f1712){return client[_0x9419('0x1')](_0x9419('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x9419('0x3'),_0x9419('0x4')],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0x9419('0x5'),_0x9419('0x6'),_0x9419('0x7')]},{'model':_0x9419('0x8'),'as':'AnyConditions','attributes':['id',_0x9419('0x5'),_0x9419('0x6'),_0x9419('0x7')]},{'model':'Action','as':_0x9419('0x9'),'attributes':['id',_0x9419('0xa'),_0x9419('0xb'),_0x9419('0xc'),'data3','data4','data5',_0x9419('0xd'),'data7']}]},'log':_0x9419('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index b6d7108..aae86b9 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 _0xcfe5=['defaultuser','GetTrunk','../client','getTrunks','name'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xcfe5,0x1c9));var _0x5cfe=function(_0x12c0ea,_0x2ed696){_0x12c0ea=_0x12c0ea-0x0;var _0x276352=_0xcfe5[_0x12c0ea];return _0x276352;};'use strict';var client=require(_0x5cfe('0x0'));exports[_0x5cfe('0x1')]=function(_0x496735){return function(_0x5bae5d){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x5cfe('0x2'),'registry',_0x5cfe('0x3')]},'log':_0x5cfe('0x4')});};}; \ No newline at end of file +var _0x28c8=['defaultuser','Request','GetTrunk','name','registry'];(function(_0x555534,_0x31cf19){var _0x45f89a=function(_0x1b235b){while(--_0x1b235b){_0x555534['push'](_0x555534['shift']());}};_0x45f89a(++_0x31cf19);}(_0x28c8,0x119));var _0x828c=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0x28c8[_0x2ec2bf];return _0x2c279c;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x10384e){return function(_0x2e7170){return client[_0x828c('0x0')](_0x828c('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x828c('0x2'),_0x828c('0x3'),_0x828c('0x4')]},'log':_0x828c('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index ff2d3a2..6416125 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(_0x15b15f,_0x57a469){var _0x3b4a17=function(_0x3a1791){while(--_0x3a1791){_0x15b15f['push'](_0x15b15f['shift']());}};_0x3b4a17(++_0x57a469);}(_0xedd9,0xfc));var _0x9edd=function(_0x196f45,_0x359fa4){_0x196f45=_0x196f45-0x0;var _0x54eb34=_0xedd9[_0x196f45];return _0x54eb34;};'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 _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xe706,0xa3));var _0x6e70=function(_0x3d0247,_0x2e5a09){_0x3d0247=_0x3d0247-0x0;var _0x5d2f3a=_0xe706[_0x3d0247];return _0x5d2f3a;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index cd49ded..fe2f64e 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 _0x9df3=['Request','UpdateVoiceAgentReport','../client','CreateVoiceAgentReport','update'];(function(_0x10d52b,_0xc6a4f1){var _0x2bf44a=function(_0x286009){while(--_0x286009){_0x10d52b['push'](_0x10d52b['shift']());}};_0x2bf44a(++_0xc6a4f1);}(_0x9df3,0x1ab));var _0x39df=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9df3[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x39df('0x0'));exports['create']=function(_0x347531){return client['Request'](_0x39df('0x1'),{'body':_0x347531,'log':_0x39df('0x1')});};exports[_0x39df('0x2')]=function(_0x1aa933,_0x1965e3,_0x499273){return client[_0x39df('0x3')](_0x39df('0x4'),{'body':_0x1aa933,'options':{'where':{'uniqueid':_0x1965e3,'interface':_0x499273,'agentcomplete':!![]}},'log':_0x39df('0x4')});}; \ No newline at end of file +var _0x9488=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x9488,0x1bd));var _0x8948=function(_0x3f69d2,_0x451c9c){_0x3f69d2=_0x3f69d2-0x0;var _0x1b5ce9=_0x9488[_0x3f69d2];return _0x1b5ce9;};'use strict';var client=require(_0x8948('0x0'));exports[_0x8948('0x1')]=function(_0x121351){return client[_0x8948('0x2')](_0x8948('0x3'),{'body':_0x121351,'log':_0x8948('0x3')});};exports[_0x8948('0x4')]=function(_0x4fafbb,_0x56865c,_0x347cb5){return client['Request']('UpdateVoiceAgentReport',{'body':_0x4fafbb,'options':{'where':{'uniqueid':_0x56865c,'interface':_0x347cb5,'agentcomplete':!![]}},'log':_0x8948('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index f26ce67..784a6d9 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 _0x8c78=['YYYY-MM-DD\x20HH:mm:ss','type','billableseconds','GetVoiceCallReports','moment','lodash','../client','create','Request','CreateVoiceCallReport','calleridnum','context','callerid','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','endOf'];(function(_0x4d78cc,_0x14c808){var _0x46dd44=function(_0x5b3f6e){while(--_0x5b3f6e){_0x4d78cc['push'](_0x4d78cc['shift']());}};_0x46dd44(++_0x14c808);}(_0x8c78,0x90));var _0x88c7=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x8c78[_0x432682];return _0x463d05;};'use strict';var moment=require(_0x88c7('0x0'));var util=require('util');var _=require(_0x88c7('0x1'));var client=require(_0x88c7('0x2'));exports[_0x88c7('0x3')]=function(_0x1d52b7){return client[_0x88c7('0x4')](_0x88c7('0x5'),{'body':_['merge'](_0x1d52b7,{'source':_0x1d52b7[_0x88c7('0x6')],'destinationcontext':_0x1d52b7[_0x88c7('0x7')],'callerid':_0x1d52b7[_0x88c7('0x8')],'amaflags':'DOCUMENTATION'}),'log':_0x88c7('0x5')});};exports[_0x88c7('0x9')]=function(){return function(){return client['Request'](_0x88c7('0xa'),{'options':{'where':{'type':[_0x88c7('0xb')],'createdAt':{'$between':[moment()[_0x88c7('0xc')](_0x88c7('0xd'))[_0x88c7('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x88c7('0xf')]('day')['format'](_0x88c7('0x10'))]}},'attributes':[_0x88c7('0x11'),'disposition','duration',_0x88c7('0x12')]},'log':_0x88c7('0x13')});};}; \ No newline at end of file +var _0x0f38=['type','disposition','duration','moment','util','lodash','../client','create','Request','merge','calleridnum','context','callerid','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xfe9896,_0x55fa21){var _0xc09a54=function(_0x4fab6e){while(--_0x4fab6e){_0xfe9896['push'](_0xfe9896['shift']());}};_0xc09a54(++_0x55fa21);}(_0x0f38,0x153));var _0x80f3=function(_0x425309,_0x14f780){_0x425309=_0x425309-0x0;var _0x297cc4=_0x0f38[_0x425309];return _0x297cc4;};'use strict';var moment=require(_0x80f3('0x0'));var util=require(_0x80f3('0x1'));var _=require(_0x80f3('0x2'));var client=require(_0x80f3('0x3'));exports[_0x80f3('0x4')]=function(_0x5a1b13){return client[_0x80f3('0x5')]('CreateVoiceCallReport',{'body':_[_0x80f3('0x6')](_0x5a1b13,{'source':_0x5a1b13[_0x80f3('0x7')],'destinationcontext':_0x5a1b13[_0x80f3('0x8')],'callerid':_0x5a1b13[_0x80f3('0x9')],'amaflags':_0x80f3('0xa')}),'log':_0x80f3('0xb')});};exports[_0x80f3('0xc')]=function(){return function(){return client[_0x80f3('0x5')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x80f3('0xd')],'createdAt':{'$between':[moment()[_0x80f3('0xe')](_0x80f3('0xf'))[_0x80f3('0x10')](_0x80f3('0x11')),moment()['endOf'](_0x80f3('0xf'))['format'](_0x80f3('0x11'))]}},'attributes':[_0x80f3('0x12'),_0x80f3('0x13'),_0x80f3('0x14'),'billableseconds']},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 2a2774b..b066e09 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 _0x7040=['CreateVoiceDialReport','create','Request'];(function(_0xdd2c1,_0x4afb4c){var _0x257c70=function(_0xb93bee){while(--_0xb93bee){_0xdd2c1['push'](_0xdd2c1['shift']());}};_0x257c70(++_0x4afb4c);}(_0x7040,0xfa));var _0x0704=function(_0x5a649c,_0x687bd2){_0x5a649c=_0x5a649c-0x0;var _0x2e6830=_0x7040[_0x5a649c];return _0x2e6830;};'use strict';var client=require('../client');exports[_0x0704('0x0')]=function(_0x18b051){return client[_0x0704('0x1')]('CreateVoiceDialReport',{'body':_0x18b051,'log':_0x0704('0x2')});}; \ No newline at end of file +var _0xd3db=['CreateVoiceDialReport','../client','create'];(function(_0x18d8e9,_0x2d9568){var _0x1b9102=function(_0x4ecf17){while(--_0x4ecf17){_0x18d8e9['push'](_0x18d8e9['shift']());}};_0x1b9102(++_0x2d9568);}(_0xd3db,0x64));var _0xbd3d=function(_0x50606b,_0x124573){_0x50606b=_0x50606b-0x0;var _0x3929a9=_0xd3db[_0x50606b];return _0x3929a9;};'use strict';var client=require(_0xbd3d('0x0'));exports[_0xbd3d('0x1')]=function(_0x73e42b){return client['Request'](_0xbd3d('0x2'),{'body':_0x73e42b,'log':_0xbd3d('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index aea2ac1..6ef2af3 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 _0x2dae=['exten','recordingFormat','getVoiceExtensions','../client','Request','GetVoiceExtension'];(function(_0x427205,_0x1839db){var _0x8da4f4=function(_0x343b11){while(--_0x343b11){_0x427205['push'](_0x427205['shift']());}};_0x8da4f4(++_0x1839db);}(_0x2dae,0xc3));var _0xe2da=function(_0xf44d98,_0x12a472){_0xf44d98=_0xf44d98-0x0;var _0x5ebb04=_0x2dae[_0xf44d98];return _0x5ebb04;};'use strict';var client=require(_0xe2da('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0xe2da('0x1')](_0xe2da('0x2'),{'options':{'raw':!![],'attributes':['id',_0xe2da('0x3'),_0xe2da('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xe2da('0x5')});};}; \ No newline at end of file +var _0xbee3=['getVoiceExtensions','exten','recordingFormat'];(function(_0x26bcec,_0xe13f50){var _0x1049dc=function(_0x4c0d9b){while(--_0x4c0d9b){_0x26bcec['push'](_0x26bcec['shift']());}};_0x1049dc(++_0xe13f50);}(_0xbee3,0xd5));var _0x3bee=function(_0x186378,_0x4579d1){_0x186378=_0x186378-0x0;var _0x48788d=_0xbee3[_0x186378];return _0x48788d;};'use strict';var client=require('../client');exports[_0x3bee('0x0')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x3bee('0x1'),_0x3bee('0x2')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index b94ca4d..16508a3 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 _0x9c1e=['dialQueueTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','callerid','active','Pause','TrunkBackup','Interval','GetVoiceQueue','name','acw','acwTimeout','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions'];(function(_0x8f86c7,_0x407bdd){var _0x5c3526=function(_0x487ba5){while(--_0x487ba5){_0x8f86c7['push'](_0x8f86c7['shift']());}};_0x5c3526(++_0x407bdd);}(_0x9c1e,0xd3));var _0xe9c1=function(_0x369d84,_0x33d80e){_0x369d84=_0x369d84-0x0;var _0x592bfd=_0x9c1e[_0x369d84];return _0x592bfd;};'use strict';var client=require('../client');exports['getVoiceQueues']=function(){return function(){return client['Request'](_0xe9c1('0x0'),{'options':{'raw':![],'attributes':['id',_0xe9c1('0x1'),_0xe9c1('0x2'),_0xe9c1('0x3'),'autopause',_0xe9c1('0x4'),_0xe9c1('0x5'),_0xe9c1('0x6'),'dialMethod',_0xe9c1('0x7'),_0xe9c1('0x8'),_0xe9c1('0x9'),_0xe9c1('0xa'),_0xe9c1('0xb'),_0xe9c1('0xc'),_0xe9c1('0xd'),_0xe9c1('0xe'),_0xe9c1('0xf'),_0xe9c1('0x10'),_0xe9c1('0x11'),'dialQueueProject',_0xe9c1('0x12'),'dialCongestionRetryFrequency',_0xe9c1('0x13'),'dialBusyRetryFrequency','dialNoAnswerMaxRetry',_0xe9c1('0x14'),_0xe9c1('0x15'),_0xe9c1('0x16'),_0xe9c1('0x17'),'dialPrefix',_0xe9c1('0x18'),'dialAMDActive',_0xe9c1('0x19'),_0xe9c1('0x1a'),_0xe9c1('0x1b'),_0xe9c1('0x1c'),'dialAMDMinWordLength',_0xe9c1('0x1d'),_0xe9c1('0x1e'),_0xe9c1('0x1f'),_0xe9c1('0x20'),_0xe9c1('0x21'),_0xe9c1('0x22'),'dialRecallInQueue',_0xe9c1('0x23'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0xe9c1('0x24'),_0xe9c1('0x4'),_0xe9c1('0x25'),_0xe9c1('0x26'),_0xe9c1('0x27'),_0xe9c1('0x28'),'dialNoSuchNumberRetryFrequency',_0xe9c1('0x29'),_0xe9c1('0x2a'),_0xe9c1('0x2b'),_0xe9c1('0x2c'),_0xe9c1('0x2d'),_0xe9c1('0x2e'),_0xe9c1('0x2f'),_0xe9c1('0x30'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0xe9c1('0x31'),_0xe9c1('0x32'),'dialPreviewRecallmeReminder'],'include':[{'model':'Trunk','as':_0xe9c1('0x33'),'attributes':['id',_0xe9c1('0x1'),_0xe9c1('0x34'),_0xe9c1('0x35')]},{'model':_0xe9c1('0x36'),'as':'mandatoryDispositionPause','attributes':['id',_0xe9c1('0x1')]},{'model':_0xe9c1('0x33'),'as':_0xe9c1('0x37'),'attributes':['id','name',_0xe9c1('0x34'),_0xe9c1('0x35')]},{'model':_0xe9c1('0x38'),'as':_0xe9c1('0x38'),'attributes':['id',_0xe9c1('0x1')],'include':[{'model':_0xe9c1('0x38'),'as':'Intervals','attributes':['id',_0xe9c1('0x1'),'interval']}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x4ab0=['dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','monitor_format','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry'];(function(_0x372df5,_0x4c3340){var _0x55d332=function(_0x3890ca){while(--_0x3890ca){_0x372df5['push'](_0x372df5['shift']());}};_0x55d332(++_0x4c3340);}(_0x4ab0,0x6a));var _0x04ab=function(_0xb83ddf,_0x4da5a8){_0xb83ddf=_0xb83ddf-0x0;var _0x47f5fc=_0x4ab0[_0xb83ddf];return _0x47f5fc;};'use strict';var client=require(_0x04ab('0x0'));exports[_0x04ab('0x1')]=function(){return function(){return client[_0x04ab('0x2')](_0x04ab('0x3'),{'options':{'raw':![],'attributes':['id',_0x04ab('0x4'),_0x04ab('0x5'),'acwTimeout','autopause',_0x04ab('0x6'),'type',_0x04ab('0x7'),_0x04ab('0x8'),_0x04ab('0x9'),_0x04ab('0xa'),_0x04ab('0xb'),'dialPredictiveOptimization',_0x04ab('0xc'),_0x04ab('0xd'),_0x04ab('0xe'),_0x04ab('0xf'),_0x04ab('0x10'),_0x04ab('0x11'),_0x04ab('0x12'),'dialQueueProject',_0x04ab('0x13'),_0x04ab('0x14'),_0x04ab('0x15'),_0x04ab('0x16'),_0x04ab('0x17'),_0x04ab('0x18'),_0x04ab('0x19'),_0x04ab('0x1a'),'dialGlobalInterval','dialPrefix',_0x04ab('0x1b'),_0x04ab('0x1c'),_0x04ab('0x1d'),_0x04ab('0x1e'),_0x04ab('0x1f'),_0x04ab('0x20'),_0x04ab('0x21'),_0x04ab('0x22'),_0x04ab('0x23'),_0x04ab('0x24'),_0x04ab('0x25'),'timeout',_0x04ab('0x26'),_0x04ab('0x27'),_0x04ab('0x28'),'dialAgiAfterHangupAgent',_0x04ab('0x29'),_0x04ab('0x2a'),_0x04ab('0x6'),_0x04ab('0x2b'),_0x04ab('0x2c'),_0x04ab('0x2d'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry',_0x04ab('0x2e'),_0x04ab('0x2f'),_0x04ab('0x30'),_0x04ab('0x31'),_0x04ab('0x32'),_0x04ab('0x33'),'dialAgentRejectRetryFrequency','mandatoryDisposition',_0x04ab('0x34'),'dialPredictiveIntervalMinThreshold',_0x04ab('0x35'),_0x04ab('0x36')],'include':[{'model':_0x04ab('0x37'),'as':_0x04ab('0x37'),'attributes':['id',_0x04ab('0x4'),_0x04ab('0x38'),_0x04ab('0x39')]},{'model':_0x04ab('0x3a'),'as':_0x04ab('0x3b'),'attributes':['id',_0x04ab('0x4')]},{'model':_0x04ab('0x37'),'as':_0x04ab('0x3c'),'attributes':['id','name',_0x04ab('0x38'),_0x04ab('0x39')]},{'model':_0x04ab('0x3d'),'as':'Interval','attributes':['id',_0x04ab('0x4')],'include':[{'model':_0x04ab('0x3d'),'as':_0x04ab('0x3e'),'attributes':['id',_0x04ab('0x4'),_0x04ab('0x3f')]}]}]},'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 1ab425e..278c518 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(_0x54812d,_0x464538){var _0x29ec8b=function(_0x1de623){while(--_0x1de623){_0x54812d['push'](_0x54812d['shift']());}};_0x29ec8b(++_0x464538);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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(_0x9163cc,_0x496654){var _0x3093fd=function(_0x12613e){while(--_0x12613e){_0x9163cc['push'](_0x9163cc['shift']());}};_0x3093fd(++_0x496654);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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 d986bc2..48b14af 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 _0xb30b=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x1c8d7f,_0x21734c){var _0x380dcb=function(_0x337ae5){while(--_0x337ae5){_0x1c8d7f['push'](_0x1c8d7f['shift']());}};_0x380dcb(++_0x21734c);}(_0xb30b,0x151));var _0xbb30=function(_0x4724ba,_0x372142){_0x4724ba=_0x4724ba-0x0;var _0x3c2f63=_0xb30b[_0x4724ba];return _0x3c2f63;};'use strict';var client=require(_0xbb30('0x0'));exports[_0xbb30('0x1')]=function(_0x54a1b7){return function(){return client[_0xbb30('0x2')](_0xbb30('0x3'),{'options':{'where':{'VoiceQueueId':_0x54a1b7,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xe674=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x306078,_0x4d9029){var _0x4b92bc=function(_0x987485){while(--_0x987485){_0x306078['push'](_0x306078['shift']());}};_0x4b92bc(++_0x4d9029);}(_0xe674,0x1ca));var _0x4e67=function(_0x5d6637,_0x518a51){_0x5d6637=_0x5d6637-0x0;var _0x2b21bb=_0xe674[_0x5d6637];return _0x2b21bb;};'use strict';var client=require('../client');exports[_0x4e67('0x0')]=function(_0x2d3118){return function(){return client[_0x4e67('0x1')](_0x4e67('0x2'),{'options':{'where':{'VoiceQueueId':_0x2d3118,'paused':!![]},'raw':!![]},'log':_0x4e67('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index bcb83c6..290a7c2 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 _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0xa1c7a5,_0x515dbc){var _0x2c4a9c=function(_0x31d933){while(--_0x31d933){_0xa1c7a5['push'](_0xa1c7a5['shift']());}};_0x2c4a9c(++_0x515dbc);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x23e3aa,_0xda962a){var _0x450fda=function(_0x5890d3){while(--_0x5890d3){_0x23e3aa['push'](_0x23e3aa['shift']());}};_0x450fda(++_0xda962a);}(_0x7a54,0x106));var _0x47a5=function(_0x4749f0,_0x2e9cea){_0x4749f0=_0x4749f0-0x0;var _0x25ce88=_0x7a54[_0x4749f0];return _0x25ce88;};'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 c0619a0..7cef44c 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 _0x6a95=['transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereecontext','transfereeexten','isexternal','context','blind','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6a95,0x1b3));var _0x56a9=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x6a95[_0x45e98e];return _0x374dba;};'use strict';var client=require(_0x56a9('0x0'));exports[_0x56a9('0x1')]={};exports[_0x56a9('0x2')]=function(_0x28d820){return client[_0x56a9('0x3')](_0x56a9('0x4'),{'body':{'result':_0x28d820[_0x56a9('0x5')],'transfererchannel':_0x28d820[_0x56a9('0x6')],'transferercalleridnum':_0x28d820['transferercalleridnum'],'transferercalleridname':_0x28d820[_0x56a9('0x7')],'transfererconnectedlinenum':_0x28d820[_0x56a9('0x8')],'transfererconnectedlinename':_0x28d820[_0x56a9('0x9')],'transfereraccountcode':_0x28d820['transfereraccountcode'],'transferercontext':_0x28d820[_0x56a9('0xa')],'transfererexten':_0x28d820[_0x56a9('0xb')],'transfererlinkedid':_0x28d820[_0x56a9('0xc')],'transfereechannel':_0x28d820[_0x56a9('0xd')],'transfereecalleridnum':_0x28d820['transfereecalleridnum'],'transfereecalleridname':_0x28d820[_0x56a9('0xe')],'transfereeconnectedlinenum':_0x28d820[_0x56a9('0xf')],'transfereeconnectedlinename':_0x28d820['transfereeconnectedlinename'],'transfereeaccountcode':_0x28d820['transfereeaccountcode'],'transfereecontext':_0x28d820[_0x56a9('0x10')],'transfereeexten':_0x28d820[_0x56a9('0x11')],'transfereelinkedid':_0x28d820['transfereelinkedid'],'isexternal':_0x28d820[_0x56a9('0x12')],'context':_0x28d820[_0x56a9('0x13')],'extension':_0x28d820['extension'],'type':_0x56a9('0x14')},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x406503){return client['Request'](_0x56a9('0x4'),{'body':{'result':_0x406503['result'],'transfererchannel':_0x406503[_0x56a9('0x15')],'transferercalleridnum':_0x406503[_0x56a9('0x16')],'transferercalleridname':_0x406503[_0x56a9('0x17')],'transfererconnectedlinenum':_0x406503[_0x56a9('0x18')],'transfererconnectedlinename':_0x406503[_0x56a9('0x19')],'transfereraccountcode':_0x406503['origtransfereraccountcode'],'transferercontext':_0x406503[_0x56a9('0x1a')],'transfererexten':_0x406503[_0x56a9('0x1b')],'transfererlinkedid':_0x406503[_0x56a9('0x1c')],'transfereechannel':_0x406503[_0x56a9('0x1d')],'transfereecalleridnum':_0x406503[_0x56a9('0x1e')],'transfereecalleridname':_0x406503[_0x56a9('0x1f')],'transfereeconnectedlinenum':_0x406503[_0x56a9('0x20')],'transfereeconnectedlinename':_0x406503[_0x56a9('0x21')],'transfereeaccountcode':_0x406503['transfertargetaccountcode'],'transfereecontext':_0x406503[_0x56a9('0x22')],'transfereeexten':_0x406503[_0x56a9('0x23')],'transfereelinkedid':_0x406503[_0x56a9('0x24')],'isexternal':_0x406503[_0x56a9('0x12')],'context':_0x406503['origtransferercontext'],'extension':_0x406503[_0x56a9('0x25')],'type':_0x56a9('0x26')},'log':_0x56a9('0x4')});}; \ No newline at end of file +var _0x3295=['blindTransfer','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','CreateVoiceTransferReport','attendedTransfer','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','origtransferercontext','origtransfererexten','attended','../client','transfers'];(function(_0x5e8334,_0x7acd7f){var _0x55897c=function(_0x442ad7){while(--_0x442ad7){_0x5e8334['push'](_0x5e8334['shift']());}};_0x55897c(++_0x7acd7f);}(_0x3295,0x15d));var _0x5329=function(_0x2a55f8,_0x540ac4){_0x2a55f8=_0x2a55f8-0x0;var _0x245efd=_0x3295[_0x2a55f8];return _0x245efd;};'use strict';var client=require(_0x5329('0x0'));exports[_0x5329('0x1')]={};exports[_0x5329('0x2')]=function(_0x3edb34){return client[_0x5329('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x3edb34[_0x5329('0x4')],'transfererchannel':_0x3edb34[_0x5329('0x5')],'transferercalleridnum':_0x3edb34[_0x5329('0x6')],'transferercalleridname':_0x3edb34[_0x5329('0x7')],'transfererconnectedlinenum':_0x3edb34[_0x5329('0x8')],'transfererconnectedlinename':_0x3edb34[_0x5329('0x9')],'transfereraccountcode':_0x3edb34[_0x5329('0xa')],'transferercontext':_0x3edb34[_0x5329('0xb')],'transfererexten':_0x3edb34[_0x5329('0xc')],'transfererlinkedid':_0x3edb34['transfererlinkedid'],'transfereechannel':_0x3edb34['transfereechannel'],'transfereecalleridnum':_0x3edb34['transfereecalleridnum'],'transfereecalleridname':_0x3edb34[_0x5329('0xd')],'transfereeconnectedlinenum':_0x3edb34[_0x5329('0xe')],'transfereeconnectedlinename':_0x3edb34[_0x5329('0xf')],'transfereeaccountcode':_0x3edb34[_0x5329('0x10')],'transfereecontext':_0x3edb34[_0x5329('0x11')],'transfereeexten':_0x3edb34[_0x5329('0x12')],'transfereelinkedid':_0x3edb34[_0x5329('0x13')],'isexternal':_0x3edb34[_0x5329('0x14')],'context':_0x3edb34[_0x5329('0x15')],'extension':_0x3edb34[_0x5329('0x16')],'type':_0x5329('0x17')},'log':_0x5329('0x18')});};exports[_0x5329('0x19')]=function(_0xc6a4d3){return client[_0x5329('0x3')](_0x5329('0x18'),{'body':{'result':_0xc6a4d3[_0x5329('0x4')],'transfererchannel':_0xc6a4d3['origtransfererchannel'],'transferercalleridnum':_0xc6a4d3[_0x5329('0x1a')],'transferercalleridname':_0xc6a4d3[_0x5329('0x1b')],'transfererconnectedlinenum':_0xc6a4d3[_0x5329('0x1c')],'transfererconnectedlinename':_0xc6a4d3[_0x5329('0x1d')],'transfereraccountcode':_0xc6a4d3[_0x5329('0x1e')],'transferercontext':_0xc6a4d3['secondtransferercontext'],'transfererexten':_0xc6a4d3['secondtransfererexten'],'transfererlinkedid':_0xc6a4d3['origtransfererlinkedid'],'transfereechannel':_0xc6a4d3[_0x5329('0x1f')],'transfereecalleridnum':_0xc6a4d3[_0x5329('0x20')],'transfereecalleridname':_0xc6a4d3['transfertargetcalleridname'],'transfereeconnectedlinenum':_0xc6a4d3[_0x5329('0x21')],'transfereeconnectedlinename':_0xc6a4d3[_0x5329('0x22')],'transfereeaccountcode':_0xc6a4d3['transfertargetaccountcode'],'transfereecontext':_0xc6a4d3['transfertargetcontext'],'transfereeexten':_0xc6a4d3[_0x5329('0x23')],'transfereelinkedid':_0xc6a4d3['transfertargetlinkedid'],'isexternal':_0xc6a4d3['isexternal'],'context':_0xc6a4d3[_0x5329('0x24')],'extension':_0xc6a4d3[_0x5329('0x25')],'type':_0x5329('0x26')},'log':_0x5329('0x18')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 49b8f62..cee2fcf 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x5189cf,_0x144c74){var _0x1ccf87=function(_0x1c4e0f){while(--_0x1c4e0f){_0x5189cf['push'](_0x5189cf['shift']());}};_0x1ccf87(++_0x144c74);}(_0xb10b,0x12a));var _0xbb10=function(_0x11afe7,_0x2dcbae){_0x11afe7=_0x11afe7-0x0;var _0x2967b5=_0xb10b[_0x11afe7];return _0x2967b5;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x5cb586,_0x13591d){var _0x12049e=function(_0x10fe70){while(--_0x10fe70){_0x5cb586['push'](_0x5cb586['shift']());}};_0x12049e(++_0x13591d);}(_0xb10b,0x12a));var _0xbb10=function(_0x461f4c,_0x4c293d){_0x461f4c=_0x461f4c-0x0;var _0x299260=_0xb10b[_0x461f4c];return _0x299260;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 9c3950f..17e6286 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 _0x63e5=['util','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','stringify','exec','data2','isNil','data5','xmd-contactid','data3','split','$or','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','ListId','createdAt','scheduledAt','resolve','then','length','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','phone','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash'];(function(_0x1ebb10,_0x156b3e){var _0x20d709=function(_0x4cc093){while(--_0x4cc093){_0x1ebb10['push'](_0x1ebb10['shift']());}};_0x20d709(++_0x156b3e);}(_0x63e5,0xd3));var _0x563e=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x63e5[_0x45783c];return _0x1161da;};'use strict';var _=require(_0x563e('0x0'));var BPromise=require('bluebird');var Redis=require('ioredis');var util=require(_0x563e('0x1'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x563e('0x2'));var cmContactRpc=require(_0x563e('0x3'));config[_0x563e('0x4')]=_[_0x563e('0x5')](config[_0x563e('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x563e('0x6'))(new Redis(config[_0x563e('0x4')]));function emit(_0x3bfd3c,_0x5815ed,_0x60c6d,_0xed22f,_0x235db9){logger[_0x563e('0x7')](_0x563e('0x8'),_0x3bfd3c,_0x5815ed['id'],_0x60c6d,_0xed22f,JSON[_0x563e('0x9')](_0x235db9));io['to'](_0x60c6d)['emit'](_0xed22f,_0x235db9);}exports[_0x563e('0xa')]=function(_0xb6b2ad,_0x46050d,_0x21a8da,_0x2d161a){var _0x51e29f,_0x42e2e2;var _0x41a6b3={};var _0x47c97f;var _0x440530=Number(_0x21a8da['data1']);var _0x3eb726=_0x21a8da[_0x563e('0xb')]?Boolean(Number(_0x21a8da['data2'])):![];var _0x5bfdce;var _0x104550=![];if(!_[_0x563e('0xc')](_0x21a8da['data5'])){if(_0x21a8da[_0x563e('0xd')]=='1')_0x104550=!![];}if(!_0x104550){if(_0x2d161a[_0x563e('0xe')]){_0x41a6b3['id']=_0x2d161a[_0x563e('0xe')];}}if(!_0x41a6b3['id']){_0x41a6b3['ListId']=_0x440530;_0x5bfdce=_0x21a8da['data3']&&_0x21a8da[_0x563e('0xf')]!=='0'?_0x21a8da[_0x563e('0xf')][_0x563e('0x10')](','):['phone'];_0x41a6b3[_0x563e('0x11')]=_['map'](_0x5bfdce,function(_0x595bb8){var _0x419683={};_0x419683[_0x595bb8]=_0x2d161a[_0x563e('0x12')]?_0x2d161a[_0x563e('0x13')]:_0x2d161a[_0x563e('0x14')];return _0x419683;});_0x47c97f=_0x2d161a[_0x563e('0x12')]?_0x2d161a[_0x563e('0x13')]:_0x2d161a[_0x563e('0x14')];}var _0xd150a3=['id',_0x563e('0x15'),_0x563e('0x16'),'phone',_0x563e('0x17'),_0x563e('0x18'),_0x563e('0x19'),_0x563e('0x1a'),_0x563e('0x1b'),'updatedAt'];var _0x2ccd4c=_['union'](_0xd150a3,_0x5bfdce);BPromise[_0x563e('0x1c')]()['then'](cmContactRpc['getContacts']({'attributes':_0x2ccd4c,'where':_0x41a6b3,'phone':_0x47c97f}))[_0x563e('0x1d')](function(_0x5fa2c4){_0x42e2e2=_0x5fa2c4;if(!_['isEmpty'](_0x42e2e2)){if(_0x42e2e2[_0x563e('0x1e')]===0x1){_0x51e29f=_0x42e2e2[0x0];logger[_0x563e('0x7')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x2d161a['uniqueid'],_0x46050d['id'],_0x51e29f['id']);}else{logger['info'](_0x563e('0x1f'),_0x2d161a[_0x563e('0x20')],_0x46050d['id'],_[_0x563e('0x21')](_0x42e2e2,'id')[_0x563e('0x22')](','));}return;}else{logger[_0x563e('0x7')](_0x563e('0x23'),_0x2d161a['uniqueid'],_0x46050d['id']);var _0x4fcb90={'ListId':_0x440530};var _0x350744=_0x21a8da['data4']&&_0x21a8da[_0x563e('0x24')]!=='0'?_0x21a8da['data4']:_0x563e('0x25');if(_0x3eb726){logger[_0x563e('0x7')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x2d161a[_0x563e('0x20')],_0x46050d['id']);_0x4fcb90[_0x350744]=_[_0x563e('0xc')](_0x2d161a[_0x563e('0x12')])?_0x2d161a[_0x563e('0x14')]:_0x2d161a[_0x563e('0x13')];if(_['isNil'](_0x2d161a[_0x563e('0x12')])){_0x4fcb90[_0x563e('0x15')]=_0x2d161a['calleridname']&&_0x2d161a[_0x563e('0x26')]!==_0x563e('0x27')?_0x2d161a[_0x563e('0x26')]:_0x563e('0x28');}else{_0x4fcb90[_0x563e('0x15')]=_0x2d161a[_0x563e('0x29')]&&_0x2d161a[_0x563e('0x29')]!==_0x563e('0x27')?_0x2d161a[_0x563e('0x29')]:_0x563e('0x28');}return BPromise[_0x563e('0x1c')]()['then'](cmContactRpc[_0x563e('0x2a')](_0x4fcb90))[_0x563e('0x1d')](function(_0xed82cc){_0x51e29f=_0xed82cc;_0x42e2e2[_0x563e('0x2b')](_0xed82cc);if(_0x51e29f){logger[_0x563e('0x7')](_0x563e('0x2c'),_0x2d161a[_0x563e('0x20')],_0x46050d['id'],_0x51e29f['id']);}return;});}else{logger[_0x563e('0x7')](_0x563e('0x2d'),_0x2d161a[_0x563e('0x20')],_0x46050d['id']);_0x4fcb90[_0x350744]=_[_0x563e('0xc')](_0x2d161a[_0x563e('0x12')])?_0x2d161a[_0x563e('0x14')]:_0x2d161a[_0x563e('0x13')];if(_[_0x563e('0xc')](_0x2d161a[_0x563e('0x12')])){_0x4fcb90['firstName']=_0x2d161a['calleridname']&&_0x2d161a[_0x563e('0x26')]!==_0x563e('0x27')?_0x2d161a[_0x563e('0x26')]:'Unknown';}else{_0x4fcb90[_0x563e('0x15')]=_0x2d161a['destcalleridname']&&_0x2d161a['destcalleridname']!==_0x563e('0x27')?_0x2d161a['destcalleridname']:_0x563e('0x28');}_0x51e29f=_0x4fcb90;_0x42e2e2['push'](_0x4fcb90);return;}}})[_0x563e('0x1d')](function(){if(_0xb6b2ad){emit(_0x2d161a['uniqueid'],_0x46050d,util[_0x563e('0x2e')](_0x563e('0x2f'),_0xb6b2ad[_0x563e('0x30')]),util['format'](_0x563e('0x31'),_0x21a8da[_0x563e('0x32')][_0x563e('0x33')]()),{'evt':_[_0x563e('0x34')](_0x2d161a,{'autoCreate':_0x3eb726}),'contact':_0x51e29f===undefined?{}:_0x51e29f,'contacts':_0x42e2e2[_0x563e('0x1e')]===0x0?undefined:_0x42e2e2});}});}; \ No newline at end of file +var _0xde09=['format','trigger:%s','action','toLowerCase','merge','lodash','ioredis','util','../../../../config/environment','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','stringify','emit','exec','data1','data2','data5','xmd-contactid','ListId','data3','phone','$or','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','union','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','destcalleridname','Unknown','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled'];(function(_0x3b185f,_0x549c61){var _0x32dd6a=function(_0x49495f){while(--_0x49495f){_0x3b185f['push'](_0x3b185f['shift']());}};_0x32dd6a(++_0x549c61);}(_0xde09,0x1c5));var _0x9de0=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xde09[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0x9de0('0x0'));var BPromise=require('bluebird');var Redis=require(_0x9de0('0x1'));var util=require(_0x9de0('0x2'));var config=require(_0x9de0('0x3'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x9de0('0x4'));config[_0x9de0('0x5')]=_[_0x9de0('0x6')](config[_0x9de0('0x5')],{'host':_0x9de0('0x7'),'port':0x18eb});var io=require(_0x9de0('0x8'))(new Redis(config[_0x9de0('0x5')]));function emit(_0x7cf0a3,_0x51f667,_0x33e0ac,_0x27e8c8,_0xc23825){logger[_0x9de0('0x9')]('[CM][%s][%s]',_0x7cf0a3,_0x51f667['id'],_0x33e0ac,_0x27e8c8,JSON[_0x9de0('0xa')](_0xc23825));io['to'](_0x33e0ac)[_0x9de0('0xb')](_0x27e8c8,_0xc23825);}exports[_0x9de0('0xc')]=function(_0x1f81bd,_0x4fc7e6,_0x1b1610,_0x213951){var _0x2c3e08,_0x246192;var _0x5f4ace={};var _0x241a6d;var _0x1eaded=Number(_0x1b1610[_0x9de0('0xd')]);var _0x21ac8f=_0x1b1610[_0x9de0('0xe')]?Boolean(Number(_0x1b1610[_0x9de0('0xe')])):![];var _0x2c84cb;var _0x4facd4=![];if(!_['isNil'](_0x1b1610[_0x9de0('0xf')])){if(_0x1b1610[_0x9de0('0xf')]=='1')_0x4facd4=!![];}if(!_0x4facd4){if(_0x213951[_0x9de0('0x10')]){_0x5f4ace['id']=_0x213951['xmd-contactid'];}}if(!_0x5f4ace['id']){_0x5f4ace[_0x9de0('0x11')]=_0x1eaded;_0x2c84cb=_0x1b1610[_0x9de0('0x12')]&&_0x1b1610[_0x9de0('0x12')]!=='0'?_0x1b1610[_0x9de0('0x12')]['split'](','):[_0x9de0('0x13')];_0x5f4ace[_0x9de0('0x14')]=_['map'](_0x2c84cb,function(_0x59235b){var _0x3d3f9b={};_0x3d3f9b[_0x59235b]=_0x213951[_0x9de0('0x15')]?_0x213951[_0x9de0('0x16')]:_0x213951['calleridnum'];return _0x3d3f9b;});_0x241a6d=_0x213951[_0x9de0('0x15')]?_0x213951[_0x9de0('0x16')]:_0x213951[_0x9de0('0x17')];}var _0x5340e6=['id',_0x9de0('0x18'),_0x9de0('0x19'),_0x9de0('0x13'),_0x9de0('0x1a'),_0x9de0('0x1b'),_0x9de0('0x11'),_0x9de0('0x1c'),_0x9de0('0x1d'),'updatedAt'];var _0x459eaa=_[_0x9de0('0x1e')](_0x5340e6,_0x2c84cb);BPromise['resolve']()[_0x9de0('0x1f')](cmContactRpc[_0x9de0('0x20')]({'attributes':_0x459eaa,'where':_0x5f4ace,'phone':_0x241a6d}))[_0x9de0('0x1f')](function(_0x1b08a3){_0x246192=_0x1b08a3;if(!_[_0x9de0('0x21')](_0x246192)){if(_0x246192[_0x9de0('0x22')]===0x1){_0x2c3e08=_0x246192[0x0];logger[_0x9de0('0x9')](_0x9de0('0x23'),_0x213951[_0x9de0('0x24')],_0x4fc7e6['id'],_0x2c3e08['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x213951[_0x9de0('0x24')],_0x4fc7e6['id'],_[_0x9de0('0x25')](_0x246192,'id')[_0x9de0('0x26')](','));}return;}else{logger[_0x9de0('0x9')](_0x9de0('0x27'),_0x213951[_0x9de0('0x24')],_0x4fc7e6['id']);var _0x4cbd93={'ListId':_0x1eaded};var _0x71fd35=_0x1b1610[_0x9de0('0x28')]&&_0x1b1610[_0x9de0('0x28')]!=='0'?_0x1b1610[_0x9de0('0x28')]:_0x9de0('0x13');if(_0x21ac8f){logger['info'](_0x9de0('0x29'),_0x213951[_0x9de0('0x24')],_0x4fc7e6['id']);_0x4cbd93[_0x71fd35]=_['isNil'](_0x213951[_0x9de0('0x15')])?_0x213951[_0x9de0('0x17')]:_0x213951[_0x9de0('0x16')];if(_[_0x9de0('0x2a')](_0x213951[_0x9de0('0x15')])){_0x4cbd93[_0x9de0('0x18')]=_0x213951[_0x9de0('0x2b')]&&_0x213951[_0x9de0('0x2b')]!==_0x9de0('0x2c')?_0x213951[_0x9de0('0x2b')]:'Unknown';}else{_0x4cbd93[_0x9de0('0x18')]=_0x213951[_0x9de0('0x2d')]&&_0x213951[_0x9de0('0x2d')]!==_0x9de0('0x2c')?_0x213951[_0x9de0('0x2d')]:_0x9de0('0x2e');}return BPromise['resolve']()[_0x9de0('0x1f')](cmContactRpc[_0x9de0('0x2f')](_0x4cbd93))['then'](function(_0x540b6d){_0x2c3e08=_0x540b6d;_0x246192[_0x9de0('0x30')](_0x540b6d);if(_0x2c3e08){logger[_0x9de0('0x9')](_0x9de0('0x31'),_0x213951['uniqueid'],_0x4fc7e6['id'],_0x2c3e08['id']);}return;});}else{logger[_0x9de0('0x9')](_0x9de0('0x32'),_0x213951[_0x9de0('0x24')],_0x4fc7e6['id']);_0x4cbd93[_0x71fd35]=_[_0x9de0('0x2a')](_0x213951[_0x9de0('0x15')])?_0x213951[_0x9de0('0x17')]:_0x213951[_0x9de0('0x16')];if(_['isNil'](_0x213951[_0x9de0('0x15')])){_0x4cbd93[_0x9de0('0x18')]=_0x213951['calleridname']&&_0x213951[_0x9de0('0x2b')]!==_0x9de0('0x2c')?_0x213951['calleridname']:'Unknown';}else{_0x4cbd93['firstName']=_0x213951[_0x9de0('0x2d')]&&_0x213951[_0x9de0('0x2d')]!==_0x9de0('0x2c')?_0x213951[_0x9de0('0x2d')]:_0x9de0('0x2e');}_0x2c3e08=_0x4cbd93;_0x246192[_0x9de0('0x30')](_0x4cbd93);return;}}})['then'](function(){if(_0x1f81bd){emit(_0x213951['uniqueid'],_0x4fc7e6,util[_0x9de0('0x33')]('user:%s',_0x1f81bd['name']),util[_0x9de0('0x33')](_0x9de0('0x34'),_0x1b1610[_0x9de0('0x35')][_0x9de0('0x36')]()),{'evt':_[_0x9de0('0x37')](_0x213951,{'autoCreate':_0x21ac8f}),'contact':_0x2c3e08===undefined?{}:_0x2c3e08,'contacts':_0x246192['length']===0x0?undefined:_0x246192});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 6bab087..3312f26 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 _0xd769=['exec','urlforward','buildUri','replace','checkTrigger','channel','checkConditions','AnyConditions','some','evt','field','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','event','queue','agent','membername','lastevent','routeId','mailSubstatus','null','substatus','undefined','offlineMessage','equals','exports','util','lodash','url','ioredis','./urlforward','./integration','./script','../../../config/environment','../../../config/logger','trigger','redis','socket.io-emitter','popup','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialconnect','custom:dialend','syncAgentDial','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','info','stringify','clone','motionChannel','voice','debug','inspect','checkTriggers','hasOwnProperty','status','merge','variables','Actions','length','interface','action','toLowerCase','contactmanager','browser','data1','TemplateId','data2','render','html','template\x20not\x20found','isNil','data3','uriLocation','data4','windowWidth','data5','windowHeight','data6','winApplication','winArguments','format','user:%s','trigger:%s:%s','jscripty','trigger:%s','name'];(function(_0x1dad70,_0x156649){var _0x14771d=function(_0x4186d5){while(--_0x4186d5){_0x1dad70['push'](_0x1dad70['shift']());}};_0x14771d(++_0x156649);}(_0xd769,0x19a));var _0x9d76=function(_0x48eb69,_0x515965){_0x48eb69=_0x48eb69-0x0;var _0x24861f=_0xd769[_0x48eb69];return _0x24861f;};'use strict';var util=require(_0x9d76('0x0'));var _=require(_0x9d76('0x1'));var url=require(_0x9d76('0x2'));var Mustache=require('mustache');var Redis=require(_0x9d76('0x3'));var urlforward=require(_0x9d76('0x4'));var integration=require(_0x9d76('0x5'));var cmContact=require('./cmContact');var script=require(_0x9d76('0x6'));var config=require(_0x9d76('0x7'));var logger=require(_0x9d76('0x8'))(_0x9d76('0x9'));var ami=require('../ami');config[_0x9d76('0xa')]=_['defaults'](config[_0x9d76('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x9d76('0xb'))(new Redis(config['redis']));var operators={'equals':function(_0x284910,_0x3b27f4){return _0x284910==_0x3b27f4;},'not_equals':function(_0x1b50b5,_0x5c2e61){return _0x1b50b5!=_0x5c2e61;}};var barAndWebActions=[_0x9d76('0xc'),_0x9d76('0x2'),'winapp'];function Trigger(_0x472486){this[_0x9d76('0xd')]=_0x472486[_0x9d76('0xd')];this[_0x9d76('0xe')]=_0x472486[_0x9d76('0xe')];this[_0x9d76('0xf')]=_0x472486[_0x9d76('0xf')];this[_0x9d76('0x10')]=_0x472486[_0x9d76('0x10')];this[_0x9d76('0x11')]=_0x472486[_0x9d76('0x11')];this[_0x9d76('0x12')]=_0x472486[_0x9d76('0x12')];this[_0x9d76('0x13')]=_0x472486[_0x9d76('0x13')];this[_0x9d76('0x14')]=_0x472486[_0x9d76('0x14')];this[_0x9d76('0x15')]=_0x472486['sugarcrmAccounts'];this[_0x9d76('0x16')]=_0x472486[_0x9d76('0x16')];this[_0x9d76('0x17')]=_0x472486[_0x9d76('0x17')];this['vtigerAccounts']=_0x472486[_0x9d76('0x18')];this[_0x9d76('0x19')]=_0x472486['servicenowAccounts'];this[_0x9d76('0x1a')]=_0x472486['dynamics365Accounts'];this['freshsalesAccounts']=_0x472486[_0x9d76('0x1b')];this[_0x9d76('0x1c')]={'zendesk':this[_0x9d76('0x12')],'salesforce':this[_0x9d76('0x14')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0x9d76('0x15')],'zoho':this[_0x9d76('0x16')],'desk':this[_0x9d76('0x17')],'vtiger':this['vtigerAccounts'],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0x9d76('0x1b')],'servicenow':this[_0x9d76('0x19')]};ami['on'](_0x9d76('0x1d'),this['syncCustomEvent']['bind'](this));ami['on']('custom:agentconnect',this[_0x9d76('0x1e')][_0x9d76('0x1f')](this));ami['on']('custom:agentringnoanswer',this[_0x9d76('0x1e')][_0x9d76('0x1f')](this));ami['on'](_0x9d76('0x20'),this[_0x9d76('0x1e')][_0x9d76('0x1f')](this));ami['on'](_0x9d76('0x21'),this['syncCustomEvent'][_0x9d76('0x1f')](this));ami['on'](_0x9d76('0x22'),this[_0x9d76('0x1e')][_0x9d76('0x1f')](this));ami['on'](_0x9d76('0x23'),this[_0x9d76('0x1e')][_0x9d76('0x1f')](this));ami['on'](_0x9d76('0x24'),this[_0x9d76('0x1e')][_0x9d76('0x1f')](this));ami['on'](_0x9d76('0x25'),this['syncCustomEvent']['bind'](this));ami['on'](_0x9d76('0x26'),this['syncCustomEvent'][_0x9d76('0x1f')](this));ami['on'](_0x9d76('0x27'),this[_0x9d76('0x1e')][_0x9d76('0x1f')](this));ami['on'](_0x9d76('0x28'),this[_0x9d76('0x1e')]['bind'](this));ami['on']('custom:dialbegin',this['syncAgentDial'][_0x9d76('0x1f')](this));ami['on'](_0x9d76('0x29'),this['syncAgentDial'][_0x9d76('0x1f')](this));ami['on'](_0x9d76('0x2a'),this[_0x9d76('0x2b')][_0x9d76('0x1f')](this));ami['on'](_0x9d76('0x2c'),this[_0x9d76('0x1e')]['bind'](this));ami['on'](_0x9d76('0x2d'),this[_0x9d76('0x1e')]['bind'](this));ami['on']('custom:substatus',this[_0x9d76('0x1e')]['bind'](this));ami['on'](_0x9d76('0x2e'),this[_0x9d76('0x1e')][_0x9d76('0x1f')](this));ami['on'](_0x9d76('0x2f'),this[_0x9d76('0x1e')][_0x9d76('0x1f')](this));ami['on'](_0x9d76('0x30'),this[_0x9d76('0x1e')]['bind'](this));ami['on'](_0x9d76('0x31'),this[_0x9d76('0x1e')][_0x9d76('0x1f')](this));ami['on'](_0x9d76('0x32'),this['syncCustomEvent']['bind'](this));}Trigger[_0x9d76('0x33')][_0x9d76('0x34')]=function(_0x48b810,_0x256d24,_0x1a4fc7){logger[_0x9d76('0x35')](_0x48b810,_0x256d24,JSON[_0x9d76('0x36')](_0x1a4fc7));io['to'](_0x48b810)[_0x9d76('0x34')](_0x256d24,_0x1a4fc7);};Trigger[_0x9d76('0x33')][_0x9d76('0x1e')]=function(_0x3086bb){var _0x496d3a=_[_0x9d76('0x37')](_0x3086bb);if(typeof _0x496d3a[_0x9d76('0x38')]==='undefined'){_0x496d3a[_0x9d76('0x38')]=_0x9d76('0x39');}logger[_0x9d76('0x3a')](_0x9d76('0x1e'),util[_0x9d76('0x3b')](_0x496d3a,{'showHidden':!![],'depth':null}));this[_0x9d76('0x3c')](_0x496d3a);};Trigger[_0x9d76('0x33')]['syncAgentDial']=function(_0xcd85ff){if(this[_0x9d76('0xe')][_0xcd85ff['interface']]){this['syncCustomEvent'](_0xcd85ff);}};Trigger[_0x9d76('0x33')][_0x9d76('0x3c')]=function(_0x24ddc7){var _0x21dd34;for(var _0x3022e1 in this['triggers']){if(this[_0x9d76('0xd')][_0x9d76('0x3d')](_0x3022e1)){if(this[_0x9d76('0xd')][_0x3022e1][_0x9d76('0x3e')]){_0x21dd34=this['checkTrigger'](this[_0x9d76('0xd')][_0x3022e1],_0x24ddc7);if(_0x21dd34){_[_0x9d76('0x3f')](_0x24ddc7,_0x24ddc7[_0x9d76('0x40')]);for(var _0x2d9ae0=0x0,_0x3288a4,_0x530916,_0x59ef04;_0x2d9ae00x0){_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(_0x262f76,_0x3abb6f){var _0x151c5b=function(_0x36003c){while(--_0x36003c){_0x262f76['push'](_0x262f76['shift']());}};_0x151c5b(++_0x3abb6f);}(_0x3e74,0x175));var _0x43e7=function(_0x9d366e,_0x53cafc){_0x9d366e=_0x9d366e-0x0;var _0x244b01=_0x3e74[_0x9d366e];return _0x244b01;};'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 ef8b5c9..5e93e96 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 _0x45b1=['unmanaged','%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]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:','ticketId',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','POST','clientId','username','password','clientSecret','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','userEmail','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','userId','systemuserid','catch','toLowerCase','calleridnum','odata-entityid','substring','lastIndexOf','message','outbound','destcalleridnum','telephone1','GET','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','enduserId','contactid','forEach','includes','string','picklist','nameField','idField','indexOf','content','ticketType','incident','incidents','getString','Subjects','Descriptions','/systemusers(','Fields','callDirection','queue','/contacts(','phonecalls','assign','headers','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','modernAuthentication','stripTrailingSlash','serverUrl'];(function(_0xab95a0,_0x12302a){var _0x17bbe8=function(_0x57adf5){while(--_0x57adf5){_0xab95a0['push'](_0xab95a0['shift']());}};_0x17bbe8(++_0x12302a);}(_0x45b1,0x163));var _0x145b=function(_0x1033d3,_0x4ed970){_0x1033d3=_0x1033d3-0x0;var _0x29516a=_0x45b1[_0x1033d3];return _0x29516a;};'use strict';var _=require(_0x145b('0x0'));var rp=require('request-promise');var util=require(_0x145b('0x1'));var intUtil=require('./util');var md5=require('md5');var Redis=require(_0x145b('0x2'));var logger=require(_0x145b('0x3'))(_0x145b('0x4'));var config=require(_0x145b('0x5'));config['redis']=_[_0x145b('0x6')](config[_0x145b('0x7')],{'host':_0x145b('0x8'),'port':0x18eb});var io=require(_0x145b('0x9'))(new Redis(config['redis']));function getAuthToken(_0x20e05e,_0x22ba8f,_0x394bf4){if(_0x20e05e['modernAuthentication']){_0x20e05e[_0x145b('0xa')]=_0x20e05e[_0x145b('0xb')][_0x145b('0xc')];_0x20e05e[_0x145b('0xd')]=_0x20e05e[_0x145b('0xb')][_0x145b('0xe')];return Promise[_0x145b('0xf')](_0x20e05e[_0x145b('0xb')][_0x145b('0x10')]);}var _0x26d77c={'method':_0x145b('0x11'),'uri':_0x22ba8f,'form':{'client_id':_0x20e05e[_0x145b('0x12')],'resource':_0x20e05e[_0x145b('0xa')],'username':_0x20e05e[_0x145b('0x13')],'password':_0x20e05e[_0x145b('0x14')],'grant_type':_0x145b('0x14'),'client_secret':_0x20e05e[_0x145b('0x15')]},'json':!![]};return rp(_0x26d77c)[_0x145b('0x16')](function(_0x236946){return _0x236946[_0x145b('0x17')];})['catch'](function(_0x4a972b){logger[_0x145b('0x18')]('['+[_0x394bf4[_0x145b('0x19')]()]+_0x145b('0x1a'));return _0x4a972b['message'];});}function getUser(_0xb00d69,_0x91b59a,_0x12ed27,_0x498bb2,_0xf79cad,_0x400b7d){return new Promise(function(_0x27af7f,_0x144a77){return getAuthToken(_0x91b59a,_0x498bb2,_0x400b7d)[_0x145b('0x16')](function(_0x231ba2){var _0x248fa9={'method':'GET','uri':_0xf79cad+_0x145b('0x1b'),'headers':{'Authorization':_0x145b('0x1c')+_0x231ba2,'OData-Version':_0x145b('0x1d')},'json':!![]};return rp(_0x248fa9);})[_0x145b('0x16')](function(_0x47f1fe){var _0x41789a=_0x47f1fe[_0x145b('0x1e')];var _0x6a6502=![];var _0x44ef8c=null;if(!_['isNil'](_0x12ed27)){if(intUtil[_0x145b('0x1f')](_0x12ed27['email'])){_0xb00d69[_0x145b('0x20')]=_0x12ed27[_0x145b('0x21')];for(_0x44ef8c=0x0;_0x44ef8c<_0x41789a[_0x145b('0x22')];_0x44ef8c++){if(_0x41789a[_0x44ef8c][_0x145b('0x23')]===_0x12ed27[_0x145b('0x21')]&&!_0x41789a[_0x44ef8c][_0x145b('0x24')]){_0x6a6502=!![];logger[_0x145b('0x25')]('['+[_0x400b7d[_0x145b('0x19')]()]+_0x145b('0x26')+_0x41789a[_0x44ef8c]['systemuserid']+'!');_0xb00d69[_0x145b('0x27')]=_0x41789a[_0x44ef8c][_0x145b('0x28')];}}}}if(!_0x6a6502){logger['info']('['+[_0x400b7d[_0x145b('0x19')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0xb00d69['userEmail']=_0x91b59a[_0x145b('0x13')];for(_0x44ef8c=0x0;_0x44ef8c<_0x41789a[_0x145b('0x22')];_0x44ef8c++){if(_0x41789a[_0x44ef8c][_0x145b('0x23')]===_0x91b59a[_0x145b('0x13')]){_0xb00d69[_0x145b('0x27')]=_0x41789a[_0x44ef8c]['systemuserid'];}}}_0x27af7f(_0xb00d69);})[_0x145b('0x29')](function(_0x51ca70){_0x144a77(_0x51ca70['message']);});});}function createEndUser(_0x2e4b8d,_0x12ae62,_0x298164,_0x4ab12f,_0x46f68f,_0x6d9c66,_0x386ab7){return new Promise(function(_0x5c00d0,_0x48b3f6){return getAuthToken(_0x12ae62,_0x298164,_0x6d9c66)[_0x145b('0x16')](function(_0x202e8f){var _0x27e845=_0x6d9c66[_0x145b('0x2a')]()==='outbound'?_0x46f68f['destcalleridnum']:_0x46f68f[_0x145b('0x2b')];var _0x1b9f99={'method':_0x145b('0x11'),'uri':_0x4ab12f+'contacts','body':{'fullname':_0x27e845,'firstname':_0x27e845,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x2e4b8d[_0x145b('0x27')]+')'},'headers':{'Authorization':_0x145b('0x1c')+_0x202e8f,'OData-Version':_0x145b('0x1d')},'json':!![],'resolveWithFullResponse':!![]};_0x1b9f99['body'][_0x386ab7]=_0x27e845;return rp(_0x1b9f99);})[_0x145b('0x16')](function(_0x4b7b39){var _0x172ac8=_0x4b7b39['headers'][_0x145b('0x2c')];var _0x236d25=_0x172ac8[_0x145b('0x2d')](_0x172ac8[_0x145b('0x2e')]('(')+0x1,_0x172ac8['lastIndexOf'](')'));_0x2e4b8d['enduserId']=_0x236d25;_0x5c00d0(_0x2e4b8d);})[_0x145b('0x29')](function(_0x55e0fe){_0x48b3f6(_0x55e0fe[_0x145b('0x2f')]);});});}function getEndUser(_0x362141,_0x4ec7bd,_0x3484b6,_0xfac5f5,_0x25a9d4,_0x3f93a6,_0x443c55,_0x5250c4){var _0x1379a7=_0x3f93a6[_0x145b('0x2a')]()===_0x145b('0x30')?_0x25a9d4[_0x145b('0x31')]:_0x25a9d4[_0x145b('0x2b')];return getAuthToken(_0x4ec7bd,_0x3484b6,_0x3f93a6)[_0x145b('0x16')](function(_0x2c5ae3){_0x5250c4=_0x5250c4?_0x5250c4:_0x145b('0x32');var _0x3daabd={'method':_0x145b('0x33'),'uri':_0xfac5f5+_0x145b('0x34')+_0x5250c4+_0x145b('0x35')+_0x5250c4+_0x145b('0x36')+_0x1379a7[_0x145b('0x37')]('+',_0x145b('0x38'))+'\x27','headers':{'Authorization':_0x145b('0x1c')+_0x2c5ae3,'If-None-Match':null,'OData-Version':_0x145b('0x1d')},'json':!![]};return rp(_0x3daabd);})[_0x145b('0x16')](function(_0x168106){var _0x495b2c=![];if(!_0x168106)return _0x495b2c;var _0x499408=_0x168106[_0x145b('0x1e')];for(var _0x298865=0x0;_0x298865<_0x499408[_0x145b('0x22')];_0x298865++){if(_0x499408[_0x298865][_0x5250c4]===_0x1379a7){_0x495b2c=!![];_0x362141[_0x145b('0x39')]=_0x499408[_0x298865][_0x145b('0x3a')];}}return _0x495b2c;})[_0x145b('0x16')](function(_0xe6ca02){if(_0xe6ca02)return _0x362141;if(_0x443c55==='nothing'){logger[_0x145b('0x25')]('['+[_0x3f93a6[_0x145b('0x19')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x362141;}return createEndUser(_0x362141,_0x4ec7bd,_0x3484b6,_0xfac5f5,_0x25a9d4,_0x3f93a6,_0x5250c4)[_0x145b('0x16')](function(_0xd3b098){logger['info']('['+[_0x3f93a6[_0x145b('0x19')]()]+']\x20Enduser\x20created!',_0xd3b098['enduserId']);return _0xd3b098;});});}function getCustomFields(_0x4b0e5f,_0xd5fa1a,_0x3e3ba9){var _0x3d49c3={};if(_0x4b0e5f[_0x145b('0x22')]>0x0){_[_0x145b('0x3b')](_0x4b0e5f,function(_0x4eed74){if(_[_0x145b('0x3c')]([_0x145b('0x3d'),_0x145b('0x3e')],_0x4eed74['type'])&&_0x4eed74[_0x145b('0x3f')]&&!_0x4eed74['customField']){var _0x1c9964=_0x4eed74[_0x145b('0x40')][_0x145b('0x2a')]();var _0x5bea55=_0x1c9964[_0x145b('0x2d')](0x0,_0x1c9964[_0x145b('0x41')]('_'));var _0x21ceb0=_0x1c9964[_0x145b('0x2d')](_0x1c9964[_0x145b('0x41')]('_')+0x1);if(_0x5bea55===_0x3e3ba9){_0x3d49c3[_0x21ceb0]=_0x4eed74[_0x145b('0x42')];}}});}return _0x3d49c3;}function getTicket(_0x55133d,_0x156a2a,_0x6514dc,_0x4ef1ef,_0x597acd,_0x49d80a,_0x33844b){return new Promise(function(_0x26fd4d,_0x4f802f){var _0x1aa144;return getAuthToken(_0x156a2a,_0x6514dc,_0x33844b)[_0x145b('0x16')](function(_0x4d38ea){if(_0x49d80a[_0x145b('0x43')]===_0x145b('0x44')){_0x1aa144={'method':'POST','uri':_0x4ef1ef+_0x145b('0x45'),'body':Object['assign']({},{'title':intUtil[_0x145b('0x46')](_0x49d80a[_0x145b('0x47')],_0x597acd,'\x20'),'description':intUtil[_0x145b('0x46')](_0x49d80a[_0x145b('0x48')],_0x597acd,'\x0a'),'customerid_contact@odata.bind':_0x55133d['enduserId']?'/contacts('+_0x55133d[_0x145b('0x39')]+')':undefined,'ownerid@odata.bind':_0x145b('0x49')+_0x55133d[_0x145b('0x27')]+')','caseorigincode':'1'},getCustomFields(_0x49d80a[_0x145b('0x4a')],_0x597acd,_0x49d80a[_0x145b('0x43')])),'headers':{'Authorization':'Bearer\x20'+_0x4d38ea,'OData-Version':_0x145b('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x49d80a[_0x145b('0x43')]==='phonecall'){var _0x4d9684=_0x55133d['enduserId']?[{'partyid_systemuser@odata.bind':_0x145b('0x49')+_0x55133d[_0x145b('0x27')]+')','participationtypemask':_0x55133d[_0x145b('0x4b')]===_0x145b('0x4c')?0x2:0x1},{'partyid_contact@odata.bind':_0x145b('0x4d')+_0x55133d[_0x145b('0x39')]+')','participationtypemask':_0x55133d[_0x145b('0x4b')]===_0x145b('0x4c')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x145b('0x49')+_0x55133d[_0x145b('0x27')]+')','participationtypemask':_0x55133d[_0x145b('0x4b')]===_0x145b('0x4c')?0x2:0x1}];_0x1aa144={'method':_0x145b('0x11'),'uri':_0x4ef1ef+_0x145b('0x4e'),'body':Object[_0x145b('0x4f')]({},{'subject':intUtil[_0x145b('0x46')](_0x49d80a[_0x145b('0x47')],_0x597acd,'\x20'),'phonenumber':String(_0x597acd[_0x145b('0x2b')]),'description':intUtil['getString'](_0x49d80a[_0x145b('0x48')],_0x597acd,'\x0a'),'regardingobjectid_contact@odata.bind':_0x55133d[_0x145b('0x39')]?_0x145b('0x4d')+_0x55133d[_0x145b('0x39')]+')':undefined,'ownerid@odata.bind':_0x145b('0x49')+_0x55133d[_0x145b('0x27')]+')','directioncode':_0x55133d['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':_0x4d9684},getCustomFields(_0x49d80a[_0x145b('0x4a')],_0x597acd,_0x49d80a['ticketType'])),'headers':{'Authorization':_0x145b('0x1c')+_0x4d38ea,'OData-Version':_0x145b('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1aa144);})[_0x145b('0x16')](function(_0x26f060){var _0x1a5255=_0x26f060[_0x145b('0x50')][_0x145b('0x2c')];var _0x2c5cb7=_0x1a5255[_0x145b('0x2d')](_0x1a5255[_0x145b('0x2e')]('(')+0x1,_0x1a5255['lastIndexOf'](')'));_0x55133d['ticketId']=_0x2c5cb7;_0x26fd4d(_0x55133d);})[_0x145b('0x29')](function(_0x4513a0){_0x4f802f(_0x4513a0[_0x145b('0x2f')]);});});}function emit(_0x58aa39,_0x1eace6,_0x2cd26d,_0x3a8b59){var _0xb45088={'uri':util[_0x145b('0x51')](_0x145b('0x52'),_0x58aa39,_0x2cd26d,_0x3a8b59)};io['to'](util[_0x145b('0x51')](_0x145b('0x53'),_0x1eace6))[_0x145b('0x54')](_0x145b('0x55'),_0xb45088);}exports['cs']=function(_0xa1860c,_0x2c2acc,_0x81949e,_0x6a924e,_0x203f1e,_0x36f30d,_0x336b30,_0x271472){var _0xe85fba={};_0x36f30d[_0x145b('0xa')]=_0x36f30d[_0x145b('0x56')]?intUtil[_0x145b('0x57')](_0x36f30d[_0x145b('0xb')]['data7']):intUtil[_0x145b('0x57')](_0x36f30d[_0x145b('0xa')]);_0x36f30d[_0x145b('0x58')]=intUtil[_0x145b('0x57')](_0x36f30d[_0x145b('0x58')]);_0xe85fba[_0x145b('0x4b')]=_0x271472===_0x145b('0x4c')||_0x271472===_0x145b('0x59')?_0x145b('0x4c'):_0x145b('0x30');var _0x356b83=_0x36f30d[_0x145b('0x56')]?util['format']('%s/api/data/v9.0/',_0x36f30d[_0x145b('0xb')][_0x145b('0xc')]):util[_0x145b('0x51')](_0x145b('0x5a'),_0x36f30d['remoteUri']);var _0x4c30de=util['format'](_0x145b('0x5b'),_0x36f30d[_0x145b('0xd')]);var _0x4e3596=util[_0x145b('0x51')](_0x145b('0x5c'),_0x36f30d[_0x145b('0x58')],_0x2c2acc[_0x145b('0x5d')],md5(_0x2c2acc[_0x145b('0x5d')]));if(_0x203f1e&&_0x203f1e[_0x145b('0x5e')]){logger[_0x145b('0x25')](_0x145b('0x5f'),_0x145b('0x60'));_0x2c2acc[_0x145b('0x61')]=_0x4e3596;}else if(_0x336b30&&_0x336b30['recordingFormat']&&_0x336b30[_0x145b('0x62')]!=='none'){logger['info'](_0x145b('0x63'),_0x145b('0x60'));_0x2c2acc[_0x145b('0x61')]=_0x4e3596;}else{_0x2c2acc[_0x145b('0x61')]='';}return getUser(_0xe85fba,_0x36f30d,_0x6a924e,_0x4c30de,_0x356b83,_0x271472)['then'](function(_0x327357){logger[_0x145b('0x25')]('['+_0x271472[_0x145b('0x19')]()+_0x145b('0x64'),_0x327357['userId']);logger[_0x145b('0x25')]('['+_0x271472['toUpperCase']()+_0x145b('0x65'),_0x327357[_0x145b('0x20')]);return getEndUser(_0x327357,_0x36f30d,_0x4c30de,_0x356b83,_0x2c2acc,_0x271472,_0x81949e[_0x145b('0x66')],_0x81949e[_0x145b('0x67')]);})[_0x145b('0x16')](function(_0x540856){logger[_0x145b('0x25')]('['+_0x271472[_0x145b('0x19')]()+_0x145b('0x68'),_0x540856['enduserId']);logger[_0x145b('0x25')]('['+_0x271472[_0x145b('0x19')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x2c2acc[_0x145b('0x2b')]);return getTicket(_0x540856,_0x36f30d,_0x4c30de,_0x356b83,_0x2c2acc,_0x81949e,_0x271472);})[_0x145b('0x16')](function(_0x12d679){logger[_0x145b('0x25')](util[_0x145b('0x51')]('['+_0x271472[_0x145b('0x19')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x81949e['ticketType'],_0x12d679[_0x145b('0x69')]));logger['info'](util[_0x145b('0x51')]('['+_0x271472[_0x145b('0x19')]()+_0x145b('0x6a'),_0x271472));if(_0x271472!==_0x145b('0x59')&&_0x81949e[_0x145b('0x6b')]){logger[_0x145b('0x25')]('['+_0x271472[_0x145b('0x19')]()+']',_0x145b('0x6c'));emit(_0x36f30d[_0x145b('0xa')],_0x6a924e[_0x145b('0x6d')],_0x81949e[_0x145b('0x43')],_0x12d679[_0x145b('0x69')]);}})[_0x145b('0x29')](function(_0x1f5777){logger[_0x145b('0x18')]('['+_0x271472[_0x145b('0x19')]()+_0x145b('0x6e'),_0x1f5777['message']);console[_0x145b('0x18')]('Error\x20running\x20Dynamics365\x20integration',_0x1f5777);});}; \ No newline at end of file +var _0xe5f9=['request-promise','./util','ioredis','dynamics365','redis','socket.io-emitter','CloudProvider','tenantId','data2','resolve','POST','clientId','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','destcalleridnum','calleridnum','body','headers','odata-entityid','substring','lastIndexOf','telephone1','contacts?$select=','&$filter=','%2b','enduserId','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','customField','idField','indexOf','incident','assign','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields','ticketType','callDirection','queue','phonecalls','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','remoteUri','modernAuthentication','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','data7','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash'];(function(_0x5c7284,_0xec1930){var _0x235ebf=function(_0x56f72d){while(--_0x56f72d){_0x5c7284['push'](_0x5c7284['shift']());}};_0x235ebf(++_0xec1930);}(_0xe5f9,0x143));var _0x9e5f=function(_0x57efb2,_0x39bdbb){_0x57efb2=_0x57efb2-0x0;var _0x3082e6=_0xe5f9[_0x57efb2];return _0x3082e6;};'use strict';var _=require(_0x9e5f('0x0'));var rp=require(_0x9e5f('0x1'));var util=require('util');var intUtil=require(_0x9e5f('0x2'));var md5=require('md5');var Redis=require(_0x9e5f('0x3'));var logger=require('../../../../config/logger')(_0x9e5f('0x4'));var config=require('../../../../config/environment');config[_0x9e5f('0x5')]=_['defaults'](config[_0x9e5f('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x9e5f('0x6'))(new Redis(config[_0x9e5f('0x5')]));function getAuthToken(_0x132d0b,_0x2900ab,_0x1fef72){if(_0x132d0b['modernAuthentication']){_0x132d0b['remoteUri']=_0x132d0b[_0x9e5f('0x7')]['data7'];_0x132d0b[_0x9e5f('0x8')]=_0x132d0b[_0x9e5f('0x7')][_0x9e5f('0x9')];return Promise[_0x9e5f('0xa')](_0x132d0b['CloudProvider']['data5']);}var _0x55e2a7={'method':_0x9e5f('0xb'),'uri':_0x2900ab,'form':{'client_id':_0x132d0b[_0x9e5f('0xc')],'resource':_0x132d0b['remoteUri'],'username':_0x132d0b[_0x9e5f('0xd')],'password':_0x132d0b[_0x9e5f('0xe')],'grant_type':_0x9e5f('0xe'),'client_secret':_0x132d0b[_0x9e5f('0xf')]},'json':!![]};return rp(_0x55e2a7)[_0x9e5f('0x10')](function(_0x5c73ca){return _0x5c73ca[_0x9e5f('0x11')];})[_0x9e5f('0x12')](function(_0x4f31f1){logger[_0x9e5f('0x13')]('['+[_0x1fef72[_0x9e5f('0x14')]()]+_0x9e5f('0x15'));return _0x4f31f1[_0x9e5f('0x16')];});}function getUser(_0xc7270d,_0x237792,_0x3c7202,_0x3dae46,_0x299287,_0x38f185){return new Promise(function(_0x112f80,_0x722717){return getAuthToken(_0x237792,_0x3dae46,_0x38f185)[_0x9e5f('0x10')](function(_0x44cd76){var _0x34ebf9={'method':_0x9e5f('0x17'),'uri':_0x299287+_0x9e5f('0x18'),'headers':{'Authorization':_0x9e5f('0x19')+_0x44cd76,'OData-Version':_0x9e5f('0x1a')},'json':!![]};return rp(_0x34ebf9);})[_0x9e5f('0x10')](function(_0x16f97e){var _0x5ae9f6=_0x16f97e[_0x9e5f('0x1b')];var _0x3144e7=![];var _0x3fb458=null;if(!_[_0x9e5f('0x1c')](_0x3c7202)){if(intUtil[_0x9e5f('0x1d')](_0x3c7202[_0x9e5f('0x1e')])){_0xc7270d[_0x9e5f('0x1f')]=_0x3c7202[_0x9e5f('0x1e')];for(_0x3fb458=0x0;_0x3fb458<_0x5ae9f6[_0x9e5f('0x20')];_0x3fb458++){if(_0x5ae9f6[_0x3fb458][_0x9e5f('0x21')]===_0x3c7202[_0x9e5f('0x1e')]&&!_0x5ae9f6[_0x3fb458][_0x9e5f('0x22')]){_0x3144e7=!![];logger[_0x9e5f('0x23')]('['+[_0x38f185[_0x9e5f('0x14')]()]+']\x20Agent\x20found\x20'+_0x5ae9f6[_0x3fb458][_0x9e5f('0x24')]+'!');_0xc7270d[_0x9e5f('0x25')]=_0x5ae9f6[_0x3fb458][_0x9e5f('0x24')];}}}}if(!_0x3144e7){logger[_0x9e5f('0x23')]('['+[_0x38f185[_0x9e5f('0x14')]()]+_0x9e5f('0x26'));_0xc7270d[_0x9e5f('0x1f')]=_0x237792[_0x9e5f('0xd')];for(_0x3fb458=0x0;_0x3fb458<_0x5ae9f6[_0x9e5f('0x20')];_0x3fb458++){if(_0x5ae9f6[_0x3fb458]['internalemailaddress']===_0x237792[_0x9e5f('0xd')]){_0xc7270d[_0x9e5f('0x25')]=_0x5ae9f6[_0x3fb458][_0x9e5f('0x24')];}}}_0x112f80(_0xc7270d);})[_0x9e5f('0x12')](function(_0x3cbe45){_0x722717(_0x3cbe45[_0x9e5f('0x16')]);});});}function createEndUser(_0x40445d,_0x31ac77,_0x338b64,_0x3fd500,_0x4621be,_0x2b7c71,_0x2a9c94){return new Promise(function(_0x351fc7,_0x17ae2c){return getAuthToken(_0x31ac77,_0x338b64,_0x2b7c71)[_0x9e5f('0x10')](function(_0x44a889){var _0x207d34=_0x2b7c71[_0x9e5f('0x27')]()===_0x9e5f('0x28')?_0x4621be[_0x9e5f('0x29')]:_0x4621be[_0x9e5f('0x2a')];var _0x26b3c8={'method':_0x9e5f('0xb'),'uri':_0x3fd500+'contacts','body':{'fullname':_0x207d34,'firstname':_0x207d34,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x40445d[_0x9e5f('0x25')]+')'},'headers':{'Authorization':_0x9e5f('0x19')+_0x44a889,'OData-Version':_0x9e5f('0x1a')},'json':!![],'resolveWithFullResponse':!![]};_0x26b3c8[_0x9e5f('0x2b')][_0x2a9c94]=_0x207d34;return rp(_0x26b3c8);})['then'](function(_0x3525b3){var _0x513fa3=_0x3525b3[_0x9e5f('0x2c')][_0x9e5f('0x2d')];var _0x30241a=_0x513fa3[_0x9e5f('0x2e')](_0x513fa3[_0x9e5f('0x2f')]('(')+0x1,_0x513fa3['lastIndexOf'](')'));_0x40445d['enduserId']=_0x30241a;_0x351fc7(_0x40445d);})[_0x9e5f('0x12')](function(_0x11038b){_0x17ae2c(_0x11038b[_0x9e5f('0x16')]);});});}function getEndUser(_0x25f3ba,_0x3a2cc0,_0x354a45,_0x4c4125,_0x2d5e8c,_0x4d35f2,_0x1ab04d,_0x24e7d2){var _0x3a0cfa=_0x4d35f2['toLowerCase']()===_0x9e5f('0x28')?_0x2d5e8c['destcalleridnum']:_0x2d5e8c[_0x9e5f('0x2a')];return getAuthToken(_0x3a2cc0,_0x354a45,_0x4d35f2)[_0x9e5f('0x10')](function(_0x58056a){_0x24e7d2=_0x24e7d2?_0x24e7d2:_0x9e5f('0x30');var _0x424502={'method':_0x9e5f('0x17'),'uri':_0x4c4125+_0x9e5f('0x31')+_0x24e7d2+_0x9e5f('0x32')+_0x24e7d2+'\x20eq\x20\x27'+_0x3a0cfa['replace']('+',_0x9e5f('0x33'))+'\x27','headers':{'Authorization':_0x9e5f('0x19')+_0x58056a,'If-None-Match':null,'OData-Version':_0x9e5f('0x1a')},'json':!![]};return rp(_0x424502);})[_0x9e5f('0x10')](function(_0x73bdba){var _0x5e334f=![];if(!_0x73bdba)return _0x5e334f;var _0x57d5a1=_0x73bdba[_0x9e5f('0x1b')];for(var _0x3fed59=0x0;_0x3fed59<_0x57d5a1[_0x9e5f('0x20')];_0x3fed59++){if(_0x57d5a1[_0x3fed59][_0x24e7d2]===_0x3a0cfa){_0x5e334f=!![];_0x25f3ba[_0x9e5f('0x34')]=_0x57d5a1[_0x3fed59]['contactid'];}}return _0x5e334f;})[_0x9e5f('0x10')](function(_0x2b36e0){if(_0x2b36e0)return _0x25f3ba;if(_0x1ab04d===_0x9e5f('0x35')){logger[_0x9e5f('0x23')]('['+[_0x4d35f2['toUpperCase']()]+_0x9e5f('0x36'));return _0x25f3ba;}return createEndUser(_0x25f3ba,_0x3a2cc0,_0x354a45,_0x4c4125,_0x2d5e8c,_0x4d35f2,_0x24e7d2)[_0x9e5f('0x10')](function(_0xa3ff30){logger[_0x9e5f('0x23')]('['+[_0x4d35f2['toUpperCase']()]+_0x9e5f('0x37'),_0xa3ff30[_0x9e5f('0x34')]);return _0xa3ff30;});});}function getCustomFields(_0x34af65,_0x3d81e0,_0x3517d1){var _0x52edfc={};if(_0x34af65[_0x9e5f('0x20')]>0x0){_[_0x9e5f('0x38')](_0x34af65,function(_0x4b3af7){if(_[_0x9e5f('0x39')]([_0x9e5f('0x3a'),_0x9e5f('0x3b')],_0x4b3af7[_0x9e5f('0x3c')])&&_0x4b3af7[_0x9e5f('0x3d')]&&!_0x4b3af7[_0x9e5f('0x3e')]){var _0x474d40=_0x4b3af7[_0x9e5f('0x3f')][_0x9e5f('0x27')]();var _0x4c39c6=_0x474d40['substring'](0x0,_0x474d40[_0x9e5f('0x40')]('_'));var _0x46f1df=_0x474d40[_0x9e5f('0x2e')](_0x474d40['indexOf']('_')+0x1);if(_0x4c39c6===_0x3517d1){_0x52edfc[_0x46f1df]=_0x4b3af7['content'];}}});}return _0x52edfc;}function getTicket(_0x2267f6,_0x6acbd2,_0x521599,_0x9bd7d9,_0x7885e8,_0x2112f6,_0x27dab0){return new Promise(function(_0xfb639,_0x105434){var _0x1fa3eb;return getAuthToken(_0x6acbd2,_0x521599,_0x27dab0)[_0x9e5f('0x10')](function(_0x2e6533){if(_0x2112f6['ticketType']===_0x9e5f('0x41')){_0x1fa3eb={'method':_0x9e5f('0xb'),'uri':_0x9bd7d9+'incidents','body':Object[_0x9e5f('0x42')]({},{'title':intUtil[_0x9e5f('0x43')](_0x2112f6[_0x9e5f('0x44')],_0x7885e8,'\x20'),'description':intUtil[_0x9e5f('0x43')](_0x2112f6[_0x9e5f('0x45')],_0x7885e8,'\x0a'),'customerid_contact@odata.bind':_0x2267f6['enduserId']?_0x9e5f('0x46')+_0x2267f6[_0x9e5f('0x34')]+')':undefined,'ownerid@odata.bind':_0x9e5f('0x47')+_0x2267f6[_0x9e5f('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x2112f6[_0x9e5f('0x48')],_0x7885e8,_0x2112f6[_0x9e5f('0x49')])),'headers':{'Authorization':_0x9e5f('0x19')+_0x2e6533,'OData-Version':_0x9e5f('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2112f6[_0x9e5f('0x49')]==='phonecall'){var _0x4b42da=_0x2267f6[_0x9e5f('0x34')]?[{'partyid_systemuser@odata.bind':_0x9e5f('0x47')+_0x2267f6[_0x9e5f('0x25')]+')','participationtypemask':_0x2267f6[_0x9e5f('0x4a')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x9e5f('0x46')+_0x2267f6[_0x9e5f('0x34')]+')','participationtypemask':_0x2267f6[_0x9e5f('0x4a')]===_0x9e5f('0x4b')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x2267f6['userId']+')','participationtypemask':_0x2267f6[_0x9e5f('0x4a')]===_0x9e5f('0x4b')?0x2:0x1}];_0x1fa3eb={'method':'POST','uri':_0x9bd7d9+_0x9e5f('0x4c'),'body':Object[_0x9e5f('0x42')]({},{'subject':intUtil[_0x9e5f('0x43')](_0x2112f6[_0x9e5f('0x44')],_0x7885e8,'\x20'),'phonenumber':String(_0x7885e8[_0x9e5f('0x2a')]),'description':intUtil['getString'](_0x2112f6[_0x9e5f('0x45')],_0x7885e8,'\x0a'),'regardingobjectid_contact@odata.bind':_0x2267f6[_0x9e5f('0x34')]?_0x9e5f('0x46')+_0x2267f6[_0x9e5f('0x34')]+')':undefined,'ownerid@odata.bind':_0x9e5f('0x47')+_0x2267f6['userId']+')','directioncode':_0x2267f6[_0x9e5f('0x4a')]===_0x9e5f('0x4b')?![]:!![],'phonecall_activity_parties':_0x4b42da},getCustomFields(_0x2112f6[_0x9e5f('0x48')],_0x7885e8,_0x2112f6[_0x9e5f('0x49')])),'headers':{'Authorization':'Bearer\x20'+_0x2e6533,'OData-Version':_0x9e5f('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1fa3eb);})[_0x9e5f('0x10')](function(_0x2fb9dd){var _0x37b08a=_0x2fb9dd[_0x9e5f('0x2c')][_0x9e5f('0x2d')];var _0x5cc285=_0x37b08a['substring'](_0x37b08a[_0x9e5f('0x2f')]('(')+0x1,_0x37b08a[_0x9e5f('0x2f')](')'));_0x2267f6[_0x9e5f('0x4d')]=_0x5cc285;_0xfb639(_0x2267f6);})['catch'](function(_0x3c779e){_0x105434(_0x3c779e[_0x9e5f('0x16')]);});});}function emit(_0x4dd14f,_0x4b753b,_0x4f95ed,_0x15dcf8){var _0x4326ec={'uri':util[_0x9e5f('0x4e')](_0x9e5f('0x4f'),_0x4dd14f,_0x4f95ed,_0x15dcf8)};io['to'](util[_0x9e5f('0x4e')](_0x9e5f('0x50'),_0x4b753b))[_0x9e5f('0x51')](_0x9e5f('0x52'),_0x4326ec);}exports['cs']=function(_0x383859,_0x52438b,_0x892fe,_0x446bb3,_0x505e59,_0x5c2d48,_0x6fc11c,_0x5151c6){var _0x275b06={};_0x5c2d48[_0x9e5f('0x53')]=_0x5c2d48[_0x9e5f('0x54')]?intUtil[_0x9e5f('0x55')](_0x5c2d48[_0x9e5f('0x7')]['data7']):intUtil[_0x9e5f('0x55')](_0x5c2d48[_0x9e5f('0x53')]);_0x5c2d48[_0x9e5f('0x56')]=intUtil['stripTrailingSlash'](_0x5c2d48['serverUrl']);_0x275b06[_0x9e5f('0x4a')]=_0x5151c6===_0x9e5f('0x4b')||_0x5151c6===_0x9e5f('0x57')?'queue':_0x9e5f('0x28');var _0x48d6e8=_0x5c2d48[_0x9e5f('0x54')]?util[_0x9e5f('0x4e')](_0x9e5f('0x58'),_0x5c2d48['CloudProvider'][_0x9e5f('0x59')]):util[_0x9e5f('0x4e')](_0x9e5f('0x58'),_0x5c2d48[_0x9e5f('0x53')]);var _0x4fffc5=util['format'](_0x9e5f('0x5a'),_0x5c2d48[_0x9e5f('0x8')]);var _0x130c1b=util[_0x9e5f('0x4e')](_0x9e5f('0x5b'),_0x5c2d48[_0x9e5f('0x56')],_0x52438b[_0x9e5f('0x5c')],md5(_0x52438b[_0x9e5f('0x5c')]));if(_0x505e59&&_0x505e59[_0x9e5f('0x5d')]){logger[_0x9e5f('0x23')](_0x9e5f('0x5e'),'Recording\x20is\x20enabled!');_0x52438b[_0x9e5f('0x5f')]=_0x130c1b;}else if(_0x6fc11c&&_0x6fc11c[_0x9e5f('0x60')]&&_0x6fc11c['recordingFormat']!=='none'){logger['info'](_0x9e5f('0x61'),_0x9e5f('0x62'));_0x52438b[_0x9e5f('0x5f')]=_0x130c1b;}else{_0x52438b[_0x9e5f('0x5f')]='';}return getUser(_0x275b06,_0x5c2d48,_0x446bb3,_0x4fffc5,_0x48d6e8,_0x5151c6)[_0x9e5f('0x10')](function(_0x28d9df){logger['info']('['+_0x5151c6['toUpperCase']()+_0x9e5f('0x63'),_0x28d9df[_0x9e5f('0x25')]);logger[_0x9e5f('0x23')]('['+_0x5151c6['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x28d9df['userEmail']);return getEndUser(_0x28d9df,_0x5c2d48,_0x4fffc5,_0x48d6e8,_0x52438b,_0x5151c6,_0x892fe[_0x9e5f('0x64')],_0x892fe['additionalSearchContact']);})[_0x9e5f('0x10')](function(_0x5b8add){logger[_0x9e5f('0x23')]('['+_0x5151c6['toUpperCase']()+_0x9e5f('0x65'),_0x5b8add['enduserId']);logger[_0x9e5f('0x23')]('['+_0x5151c6['toUpperCase']()+_0x9e5f('0x66'),_0x52438b[_0x9e5f('0x2a')]);return getTicket(_0x5b8add,_0x5c2d48,_0x4fffc5,_0x48d6e8,_0x52438b,_0x892fe,_0x5151c6);})[_0x9e5f('0x10')](function(_0x323f7e){logger[_0x9e5f('0x23')](util[_0x9e5f('0x4e')]('['+_0x5151c6[_0x9e5f('0x14')]()+_0x9e5f('0x67'),_0x892fe[_0x9e5f('0x49')],_0x323f7e[_0x9e5f('0x4d')]));logger['info'](util[_0x9e5f('0x4e')]('['+_0x5151c6[_0x9e5f('0x14')]()+']\x20Call\x20direction:\x20%s',_0x5151c6));if(_0x5151c6!==_0x9e5f('0x57')&&_0x892fe['openNewTab']){logger[_0x9e5f('0x23')]('['+_0x5151c6['toUpperCase']()+']',_0x9e5f('0x68'));emit(_0x5c2d48[_0x9e5f('0x53')],_0x446bb3[_0x9e5f('0x69')],_0x892fe['ticketType'],_0x323f7e['ticketId']);}})['catch'](function(_0xe6efa4){logger[_0x9e5f('0x13')]('['+_0x5151c6[_0x9e5f('0x14')]()+_0x9e5f('0x6a'),_0xe6efa4[_0x9e5f('0x16')]);console[_0x9e5f('0x13')](_0x9e5f('0x6b'),_0xe6efa4);});}; \ 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 9bcb5a2..d2cc4f2 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 _0x08d0=['%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20found!','POST','Enduser\x20created.','apiKey','toString','base64','debug','stringify','defaults','GET','map','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','push','variableName','customVariable','name','Variable','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','unmanaged','lastevent','toUpperCase','error','lodash','request-promise','md5','ioredis','./util','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','
','Tags','Fields','custom_fields','mapValues','keyBy','value'];(function(_0x527fd3,_0x3c9671){var _0x399389=function(_0x31eb27){while(--_0x31eb27){_0x527fd3['push'](_0x527fd3['shift']());}};_0x399389(++_0x3c9671);}(_0x08d0,0x9c));var _0x008d=function(_0x2818d5,_0x5eea29){_0x2818d5=_0x2818d5-0x0;var _0xf68add=_0x08d0[_0x2818d5];return _0xf68add;};'use strict';var _=require(_0x008d('0x0'));var rp=require(_0x008d('0x1'));var md5=require(_0x008d('0x2'));var util=require('util');var Redis=require(_0x008d('0x3'));var intUtil=require(_0x008d('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x008d('0x5'));config[_0x008d('0x6')]=_['defaults'](config['redis'],{'host':_0x008d('0x7'),'port':0x18eb});var io=require(_0x008d('0x8'))(new Redis(config[_0x008d('0x6')]));var headers={'Content-Type':_0x008d('0x9'),'Accept':_0x008d('0x9')};function emit(_0x3b44c6,_0x58bce7,_0x413a21){io['to'](_0x3b44c6)[_0x008d('0xa')](_0x58bce7,_0x413a21);}function getTicket(_0x153975,_0x3c1a88,_0x8d7215,_0x3f652c,_0x36d6f6){logger[_0x008d('0xb')](_0x008d('0xc'));var _0x4a1854=_[_0x008d('0xd')]({'responder_id':_0x3c1a88['id'],'requester_id':_0x8d7215['id'],'name':util[_0x008d('0xe')](_0x008d('0xf'),_0x36d6f6[_0x008d('0x10')]),'phone':_0x36d6f6[_0x008d('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x008d('0x12')](_0x3f652c['Subjects'],_0x36d6f6,'\x20'),'description':intUtil[_0x008d('0x12')](_0x3f652c['Descriptions'],_0x36d6f6,_0x008d('0x13')),'tags':getTags(_0x3f652c[_0x008d('0x14')],'name')},getCustomFields(_0x3f652c[_0x008d('0x15')],_0x36d6f6));_0x4a1854[_0x008d('0x16')]=_[_0x008d('0x17')](_[_0x008d('0x18')](_0x4a1854['custom_fields'],'id'),_0x008d('0x19'));return request({'uri':util[_0x008d('0xe')](_0x008d('0x1a'),_0x153975[_0x008d('0x1b')]),'method':'POST','body':_0x4a1854})[_0x008d('0x1c')](function(_0x52fa42){logger[_0x008d('0xb')](_0x008d('0x1d'));return _0x52fa42;});}function getUser(_0x51a56b,_0x321655){if(intUtil[_0x008d('0x1e')](_0x321655)){return request({'uri':util[_0x008d('0xe')](_0x008d('0x1f'),_0x51a56b[_0x008d('0x1b')]),'qs':{'email':_0x321655}})[_0x008d('0x1c')](function(_0x361dac){if(_0x361dac[_0x008d('0x20')]){logger[_0x008d('0xb')](_0x008d('0x21'));return _[_0x008d('0x22')](_0x361dac,function(_0x505eb4){return _0x505eb4[_0x008d('0x23')][_0x008d('0x24')]===_0x321655;});}else{logger[_0x008d('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/api/v2/agents/me',_0x51a56b[_0x008d('0x1b')])})[_0x008d('0x1c')](function(_0x1c47c7){logger[_0x008d('0xb')](_0x008d('0x25'));return _0x1c47c7;});}});}else{logger[_0x008d('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x008d('0xe')]('%s/api/v2/agents/me',_0x51a56b[_0x008d('0x1b')])})[_0x008d('0x1c')](function(_0x74c51d){logger['info'](_0x008d('0x25'));return _0x74c51d;});}}function getEndUser(_0x3d4c21,_0x2df696,_0x5444c3){logger[_0x008d('0xb')]('Searching\x20enduser\x20with\x20phone',_0x5444c3);return request({'uri':util[_0x008d('0xe')](_0x008d('0x26'),_0x3d4c21[_0x008d('0x1b')]),'qs':{'phone':_0x5444c3}})[_0x008d('0x1c')](function(_0xdbda5d){if(_0xdbda5d['length']){logger[_0x008d('0xb')](_0x008d('0x27'));return _[_0x008d('0x22')](_0xdbda5d,{'phone':_0x5444c3});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x008d('0x26'),_0x3d4c21[_0x008d('0x1b')]),'method':_0x008d('0x28'),'body':{'name':_0x2df696,'phone':_0x5444c3}})[_0x008d('0x1c')](function(_0x56979a){logger['info'](_0x008d('0x29'));return _0x56979a;});}});}function getAuth(_0x478307){return util[_0x008d('0xe')]('Basic\x20%s',new Buffer(_0x478307[_0x008d('0x2a')]+':X')[_0x008d('0x2b')](_0x008d('0x2c')));}function request(_0x6f3e86){logger[_0x008d('0x2d')]('[HTTP]',JSON[_0x008d('0x2e')](_0x6f3e86));return rp(_[_0x008d('0x2f')](_0x6f3e86,{'method':_0x008d('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x545893,_0x613016){var _0x445365=[];if(_0x545893&&_0x545893[_0x008d('0x20')]>0x0){_0x445365=_[_0x008d('0x31')](_0x545893,_0x613016);}return _0x445365;}function getCustomFields(_0x418767,_0x590109){var _0x1a7bce=[];var _0x13726c={'custom_fields':[]};if(_0x418767[_0x008d('0x20')]>0x0){_['forEach'](_0x418767,function(_0x11ca5b){if(_[_0x008d('0x32')]([_0x008d('0x33'),_0x008d('0x34')],_0x11ca5b[_0x008d('0x35')])&&_0x11ca5b[_0x008d('0x36')]&&!_0x11ca5b[_0x008d('0x37')]){_0x13726c[_0x11ca5b['nameField'][_0x008d('0x38')]()]=_0x11ca5b[_0x008d('0x39')][_0x008d('0x2b')]();}else if(_[_0x008d('0x32')]([_0x008d('0x33'),_0x008d('0x34')],_0x11ca5b[_0x008d('0x35')])&&_0x11ca5b[_0x008d('0x3a')]&&_0x11ca5b['customField']){_0x13726c['custom_fields'][_0x008d('0x3b')]({'id':_0x11ca5b[_0x008d('0x3a')],'value':_0x11ca5b['content'][_0x008d('0x2b')]()});}else if(_0x11ca5b[_0x008d('0x35')]==='variable'&&_0x11ca5b[_0x008d('0x3c')]&&_0x11ca5b[_0x008d('0x3a')]&&_0x11ca5b[_0x008d('0x37')]){_0x590109[_0x11ca5b[_0x008d('0x3c')]]&&_0x13726c['custom_fields'][_0x008d('0x3b')]({'id':_0x11ca5b[_0x008d('0x3a')],'value':_0x590109[_0x11ca5b[_0x008d('0x3c')]][_0x008d('0x2b')]()});}else if(_0x11ca5b['type']===_0x008d('0x3d')&&_0x11ca5b['Variable']&&_0x11ca5b['Variable'][_0x008d('0x3e')]&&_0x11ca5b[_0x008d('0x3a')]&&_0x11ca5b[_0x008d('0x37')]){_0x590109[_0x11ca5b[_0x008d('0x3f')][_0x008d('0x3e')][_0x008d('0x38')]()]&&_0x13726c[_0x008d('0x16')][_0x008d('0x3b')]({'id':_0x11ca5b[_0x008d('0x3a')],'value':_0x590109[_0x11ca5b[_0x008d('0x3f')][_0x008d('0x3e')][_0x008d('0x38')]()][_0x008d('0x2b')]()});}});}return _0x13726c;}exports[_0x008d('0x40')]=function(_0x439bb8,_0x18345a,_0x1839ec,_0x3d225c,_0x94e6b0,_0x165929){var _0x4f6681,_0x2de7f6;_0x165929[_0x008d('0x1b')]=intUtil[_0x008d('0x41')](_0x165929[_0x008d('0x1b')]);_0x165929['serverUrl']=intUtil[_0x008d('0x41')](_0x165929['serverUrl']);if(_0x94e6b0&&_0x94e6b0[_0x008d('0x42')]){logger[_0x008d('0xb')](_0x008d('0x43'),_0x008d('0x44'));_0x18345a[_0x008d('0x45')]=util[_0x008d('0xe')](_0x008d('0x46'),_0x165929[_0x008d('0x47')],_0x18345a[_0x008d('0x48')],md5(_0x18345a['uniqueid']));}else{_0x18345a[_0x008d('0x45')]='';}headers[_0x008d('0x49')]=getAuth(_0x165929);return getUser(_0x165929,_0x3d225c[_0x008d('0x24')])[_0x008d('0x1c')](function(_0x384933){_0x4f6681=_0x384933;logger['info'](_0x008d('0x4a'),_0x4f6681['id']);return getEndUser(_0x165929,_0x18345a[_0x008d('0x10')],_0x18345a[_0x008d('0x11')]);})[_0x008d('0x1c')](function(_0x5c3dcd){_0x2de7f6=_0x5c3dcd;logger[_0x008d('0xb')](_0x008d('0x4b'),_0x2de7f6['id']);return getTicket(_0x165929,_0x4f6681,_0x2de7f6,_0x1839ec,_0x18345a);})['then'](function(_0x49f617){if(_0x49f617&&_0x49f617['id']){logger['info'](_0x008d('0x1d'));logger[_0x008d('0xb')](_0x008d('0x4c'),_0x49f617['id']);logger['info'](_0x008d('0x43'),_0x008d('0x4d'));emit(util[_0x008d('0xe')](_0x008d('0x4e'),_0x3d225c[_0x008d('0x3e')]),_0x008d('0x4f'),{'uri':util[_0x008d('0xe')](_0x008d('0x50'),_0x165929[_0x008d('0x1b')],_0x49f617['id'])});}})[_0x008d('0x51')](function(_0x1abeb2){logger['error']('[QUEUE]',JSON[_0x008d('0x2e')](_0x1abeb2));});};exports[_0x008d('0x52')]=function(_0x4dba3d,_0x142c58,_0x8bb4fd,_0x4bf7ed,_0x33d02b,_0x45dd07,_0x5444b5){var _0x32aae3,_0x4085b6;_0x45dd07['remoteUri']=intUtil[_0x008d('0x41')](_0x45dd07[_0x008d('0x1b')]);_0x45dd07[_0x008d('0x47')]=intUtil[_0x008d('0x41')](_0x45dd07[_0x008d('0x47')]);if(_0x5444b5&&_0x5444b5[_0x008d('0x53')]&&_0x5444b5['recordingFormat']!==_0x008d('0x54')){logger[_0x008d('0xb')](_0x008d('0x55'),_0x008d('0x44'));_0x142c58[_0x008d('0x45')]=util[_0x008d('0xe')](_0x008d('0x46'),_0x45dd07[_0x008d('0x47')],_0x142c58[_0x008d('0x48')],md5(_0x142c58[_0x008d('0x48')]));}headers[_0x008d('0x49')]=getAuth(_0x45dd07);return getUser(_0x45dd07,_0x4bf7ed['email'])[_0x008d('0x1c')](function(_0x13c45e){_0x32aae3=_0x13c45e;logger['info'](_0x008d('0x4a'),_0x32aae3['id']);return getEndUser(_0x45dd07,_0x142c58['destcalleridname'],_0x142c58[_0x008d('0x56')]);})[_0x008d('0x1c')](function(_0x104a2f){_0x4085b6=_0x104a2f;logger[_0x008d('0xb')]('The\x20Enduser\x20ID\x20is:',_0x4085b6['id']);return getTicket(_0x45dd07,_0x32aae3,_0x4085b6,_0x8bb4fd,_0x142c58);})[_0x008d('0x1c')](function(_0x28b98b){if(_0x28b98b&&_0x28b98b['id']){logger[_0x008d('0xb')](_0x008d('0x1d'));logger[_0x008d('0xb')](_0x008d('0x4c'),_0x28b98b['id']);logger['info']('[OUTBOUND]',_0x008d('0x4d'));emit(util['format']('user:%s',_0x4bf7ed[_0x008d('0x3e')]),_0x008d('0x4f'),{'uri':util[_0x008d('0xe')](_0x008d('0x50'),_0x45dd07[_0x008d('0x1b')],_0x28b98b['id'])});}})['catch'](function(_0x3e459c){logger['error'](_0x008d('0x55'),JSON[_0x008d('0x2e')](_0x3e459c));});};exports[_0x008d('0x57')]=function(_0x5e8032,_0x5a058f,_0x3153a1,_0x160200,_0x5c31fa,_0x2eb654){var _0x443348,_0xce4a59;_0x2eb654[_0x008d('0x1b')]=intUtil[_0x008d('0x41')](_0x2eb654[_0x008d('0x1b')]);_0x2eb654['serverUrl']=intUtil[_0x008d('0x41')](_0x2eb654[_0x008d('0x47')]);if(_0x5c31fa&&_0x5c31fa[_0x008d('0x42')]){logger[_0x008d('0xb')]('['+_0x5a058f[_0x008d('0x58')][_0x008d('0x59')]()+']','Recording\x20is\x20enabled!');_0x5a058f[_0x008d('0x45')]=util[_0x008d('0xe')](_0x008d('0x46'),_0x2eb654['serverUrl'],_0x5a058f[_0x008d('0x48')],md5(_0x5a058f[_0x008d('0x48')]));}else{_0x5a058f['recordingURL']='';}headers[_0x008d('0x49')]=getAuth(_0x2eb654);return getUser(_0x2eb654,'')[_0x008d('0x1c')](function(_0x12139b){_0x443348=_0x12139b;logger[_0x008d('0xb')](_0x008d('0x4a'),_0x443348['id']);return getEndUser(_0x2eb654,_0x5a058f[_0x008d('0x10')],_0x5a058f[_0x008d('0x11')]);})['then'](function(_0x27c8a6){_0xce4a59=_0x27c8a6;logger[_0x008d('0xb')](_0x008d('0x4b'),_0xce4a59['id']);return getTicket(_0x2eb654,_0x443348,_0xce4a59,_0x3153a1,_0x5a058f);})[_0x008d('0x1c')](function(_0x415100){if(_0x415100){logger[_0x008d('0xb')](_0x008d('0x1d'));logger[_0x008d('0xb')](_0x008d('0x4c'),_0x415100['id']);}})['catch'](function(_0x4fe905){logger[_0x008d('0x5a')]('['+_0x5a058f['lastevent'][_0x008d('0x59')]()+']',JSON['stringify'](_0x4fe905));});}; \ No newline at end of file +var _0x2f75=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lastevent','lodash','request-promise','md5','util','ioredis','./util','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','content','idField','push','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','outbound','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','unmanaged','toUpperCase'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x2f75,0xba));var _0x52f7=function(_0x41d6dd,_0x2b3b8e){_0x41d6dd=_0x41d6dd-0x0;var _0x5c6146=_0x2f75[_0x41d6dd];return _0x5c6146;};'use strict';var _=require(_0x52f7('0x0'));var rp=require(_0x52f7('0x1'));var md5=require(_0x52f7('0x2'));var util=require(_0x52f7('0x3'));var Redis=require(_0x52f7('0x4'));var intUtil=require(_0x52f7('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x52f7('0x6'));config[_0x52f7('0x7')]=_[_0x52f7('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x52f7('0x9'))(new Redis(config['redis']));var headers={'Content-Type':_0x52f7('0xa'),'Accept':'application/json'};function emit(_0xd49c93,_0x1f3ea9,_0x317170){io['to'](_0xd49c93)[_0x52f7('0xb')](_0x1f3ea9,_0x317170);}function getTicket(_0xf90ca5,_0x4fddb5,_0x5ae49c,_0x1bc90a,_0x391f64){logger[_0x52f7('0xc')](_0x52f7('0xd'));var _0x4595df=_['merge']({'responder_id':_0x4fddb5['id'],'requester_id':_0x5ae49c['id'],'name':util[_0x52f7('0xe')](_0x52f7('0xf'),_0x391f64[_0x52f7('0x10')]),'phone':_0x391f64[_0x52f7('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x52f7('0x12')](_0x1bc90a[_0x52f7('0x13')],_0x391f64,'\x20'),'description':intUtil[_0x52f7('0x12')](_0x1bc90a[_0x52f7('0x14')],_0x391f64,_0x52f7('0x15')),'tags':getTags(_0x1bc90a[_0x52f7('0x16')],_0x52f7('0x17'))},getCustomFields(_0x1bc90a[_0x52f7('0x18')],_0x391f64));_0x4595df[_0x52f7('0x19')]=_['mapValues'](_[_0x52f7('0x1a')](_0x4595df[_0x52f7('0x19')],'id'),_0x52f7('0x1b'));return request({'uri':util[_0x52f7('0xe')](_0x52f7('0x1c'),_0xf90ca5[_0x52f7('0x1d')]),'method':_0x52f7('0x1e'),'body':_0x4595df})[_0x52f7('0x1f')](function(_0x340219){logger[_0x52f7('0xc')](_0x52f7('0x20'));return _0x340219;});}function getUser(_0x4c6693,_0x27a7df){if(intUtil[_0x52f7('0x21')](_0x27a7df)){return request({'uri':util[_0x52f7('0xe')](_0x52f7('0x22'),_0x4c6693[_0x52f7('0x1d')]),'qs':{'email':_0x27a7df}})[_0x52f7('0x1f')](function(_0x347738){if(_0x347738[_0x52f7('0x23')]){logger[_0x52f7('0xc')](_0x52f7('0x24'));return _[_0x52f7('0x25')](_0x347738,function(_0x9d7b62){return _0x9d7b62['contact'][_0x52f7('0x26')]===_0x27a7df;});}else{logger[_0x52f7('0xc')](_0x52f7('0x27'));return request({'uri':util[_0x52f7('0xe')](_0x52f7('0x28'),_0x4c6693[_0x52f7('0x1d')])})[_0x52f7('0x1f')](function(_0x3af519){logger[_0x52f7('0xc')](_0x52f7('0x29'));return _0x3af519;});}});}else{logger[_0x52f7('0xc')](_0x52f7('0x2a'));return request({'uri':util['format'](_0x52f7('0x28'),_0x4c6693[_0x52f7('0x1d')])})[_0x52f7('0x1f')](function(_0x20a666){logger[_0x52f7('0xc')](_0x52f7('0x29'));return _0x20a666;});}}function getEndUser(_0x4a3af9,_0x43a0ba,_0x469e4e){logger['info'](_0x52f7('0x2b'),_0x469e4e);return request({'uri':util[_0x52f7('0xe')](_0x52f7('0x2c'),_0x4a3af9[_0x52f7('0x1d')]),'qs':{'phone':_0x469e4e}})[_0x52f7('0x1f')](function(_0xf5ecc2){if(_0xf5ecc2[_0x52f7('0x23')]){logger[_0x52f7('0xc')](_0x52f7('0x2d'));return _['find'](_0xf5ecc2,{'phone':_0x469e4e});}else{logger[_0x52f7('0xc')](_0x52f7('0x2e'));return request({'uri':util['format'](_0x52f7('0x2c'),_0x4a3af9[_0x52f7('0x1d')]),'method':_0x52f7('0x1e'),'body':{'name':_0x43a0ba,'phone':_0x469e4e}})[_0x52f7('0x1f')](function(_0x5592ef){logger[_0x52f7('0xc')](_0x52f7('0x2f'));return _0x5592ef;});}});}function getAuth(_0x49805a){return util[_0x52f7('0xe')]('Basic\x20%s',new Buffer(_0x49805a[_0x52f7('0x30')]+':X')[_0x52f7('0x31')]('base64'));}function request(_0x50069c){logger['debug']('[HTTP]',JSON[_0x52f7('0x32')](_0x50069c));return rp(_[_0x52f7('0x8')](_0x50069c,{'method':_0x52f7('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x2cf4a1,_0x48c512){var _0x2a285=[];if(_0x2cf4a1&&_0x2cf4a1[_0x52f7('0x23')]>0x0){_0x2a285=_[_0x52f7('0x34')](_0x2cf4a1,_0x48c512);}return _0x2a285;}function getCustomFields(_0x4dd68d,_0x34ac48){var _0x2e095b=[];var _0x2c5778={'custom_fields':[]};if(_0x4dd68d[_0x52f7('0x23')]>0x0){_[_0x52f7('0x35')](_0x4dd68d,function(_0x13b9c7){if(_[_0x52f7('0x36')]([_0x52f7('0x37'),_0x52f7('0x38')],_0x13b9c7[_0x52f7('0x39')])&&_0x13b9c7[_0x52f7('0x3a')]&&!_0x13b9c7[_0x52f7('0x3b')]){_0x2c5778[_0x13b9c7['nameField']['toLowerCase']()]=_0x13b9c7[_0x52f7('0x3c')]['toString']();}else if(_[_0x52f7('0x36')](['string','picklist'],_0x13b9c7['type'])&&_0x13b9c7[_0x52f7('0x3d')]&&_0x13b9c7['customField']){_0x2c5778[_0x52f7('0x19')][_0x52f7('0x3e')]({'id':_0x13b9c7[_0x52f7('0x3d')],'value':_0x13b9c7['content'][_0x52f7('0x31')]()});}else if(_0x13b9c7[_0x52f7('0x39')]==='variable'&&_0x13b9c7[_0x52f7('0x3f')]&&_0x13b9c7['idField']&&_0x13b9c7['customField']){_0x34ac48[_0x13b9c7['variableName']]&&_0x2c5778['custom_fields']['push']({'id':_0x13b9c7['idField'],'value':_0x34ac48[_0x13b9c7[_0x52f7('0x3f')]][_0x52f7('0x31')]()});}else if(_0x13b9c7['type']===_0x52f7('0x40')&&_0x13b9c7[_0x52f7('0x41')]&&_0x13b9c7[_0x52f7('0x41')][_0x52f7('0x17')]&&_0x13b9c7[_0x52f7('0x3d')]&&_0x13b9c7[_0x52f7('0x3b')]){_0x34ac48[_0x13b9c7[_0x52f7('0x41')][_0x52f7('0x17')][_0x52f7('0x42')]()]&&_0x2c5778[_0x52f7('0x19')][_0x52f7('0x3e')]({'id':_0x13b9c7[_0x52f7('0x3d')],'value':_0x34ac48[_0x13b9c7[_0x52f7('0x41')][_0x52f7('0x17')][_0x52f7('0x42')]()][_0x52f7('0x31')]()});}});}return _0x2c5778;}exports[_0x52f7('0x43')]=function(_0x576ed5,_0x512cc5,_0x91c6fc,_0x26040c,_0x43ad7d,_0x19b3d8){var _0x5c780e,_0x1d3956;_0x19b3d8[_0x52f7('0x1d')]=intUtil[_0x52f7('0x44')](_0x19b3d8[_0x52f7('0x1d')]);_0x19b3d8[_0x52f7('0x45')]=intUtil[_0x52f7('0x44')](_0x19b3d8[_0x52f7('0x45')]);if(_0x43ad7d&&_0x43ad7d[_0x52f7('0x46')]){logger['info']('[QUEUE]',_0x52f7('0x47'));_0x512cc5[_0x52f7('0x48')]=util[_0x52f7('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x19b3d8[_0x52f7('0x45')],_0x512cc5[_0x52f7('0x49')],md5(_0x512cc5[_0x52f7('0x49')]));}else{_0x512cc5[_0x52f7('0x48')]='';}headers[_0x52f7('0x4a')]=getAuth(_0x19b3d8);return getUser(_0x19b3d8,_0x26040c[_0x52f7('0x26')])[_0x52f7('0x1f')](function(_0x55e88e){_0x5c780e=_0x55e88e;logger[_0x52f7('0xc')](_0x52f7('0x4b'),_0x5c780e['id']);return getEndUser(_0x19b3d8,_0x512cc5[_0x52f7('0x10')],_0x512cc5[_0x52f7('0x11')]);})[_0x52f7('0x1f')](function(_0x101df6){_0x1d3956=_0x101df6;logger[_0x52f7('0xc')]('The\x20Enduser\x20ID\x20is:',_0x1d3956['id']);return getTicket(_0x19b3d8,_0x5c780e,_0x1d3956,_0x91c6fc,_0x512cc5);})[_0x52f7('0x1f')](function(_0x511f23){if(_0x511f23&&_0x511f23['id']){logger[_0x52f7('0xc')]('Ticket\x20created!');logger[_0x52f7('0xc')](_0x52f7('0x4c'),_0x511f23['id']);logger[_0x52f7('0xc')](_0x52f7('0x4d'),_0x52f7('0x4e'));emit(util[_0x52f7('0xe')](_0x52f7('0x4f'),_0x26040c['name']),_0x52f7('0x50'),{'uri':util['format'](_0x52f7('0x51'),_0x19b3d8[_0x52f7('0x1d')],_0x511f23['id'])});}})[_0x52f7('0x52')](function(_0x471ba3){logger['error'](_0x52f7('0x4d'),JSON[_0x52f7('0x32')](_0x471ba3));});};exports[_0x52f7('0x53')]=function(_0x3aa42e,_0x5160dc,_0x4082ab,_0x193c4a,_0x7ade,_0x9c25e3,_0x2b1c66){var _0x584e25,_0x39c9e7;_0x9c25e3[_0x52f7('0x1d')]=intUtil['stripTrailingSlash'](_0x9c25e3[_0x52f7('0x1d')]);_0x9c25e3[_0x52f7('0x45')]=intUtil['stripTrailingSlash'](_0x9c25e3[_0x52f7('0x45')]);if(_0x2b1c66&&_0x2b1c66['recordingFormat']&&_0x2b1c66['recordingFormat']!==_0x52f7('0x54')){logger[_0x52f7('0xc')](_0x52f7('0x55'),_0x52f7('0x47'));_0x5160dc['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x9c25e3[_0x52f7('0x45')],_0x5160dc['uniqueid'],md5(_0x5160dc[_0x52f7('0x49')]));}headers[_0x52f7('0x4a')]=getAuth(_0x9c25e3);return getUser(_0x9c25e3,_0x193c4a[_0x52f7('0x26')])[_0x52f7('0x1f')](function(_0x4535db){_0x584e25=_0x4535db;logger[_0x52f7('0xc')]('The\x20User\x20ID\x20is:',_0x584e25['id']);return getEndUser(_0x9c25e3,_0x5160dc[_0x52f7('0x56')],_0x5160dc['destcalleridnum']);})[_0x52f7('0x1f')](function(_0xc0c0d6){_0x39c9e7=_0xc0c0d6;logger['info'](_0x52f7('0x57'),_0x39c9e7['id']);return getTicket(_0x9c25e3,_0x584e25,_0x39c9e7,_0x4082ab,_0x5160dc);})['then'](function(_0x1b6093){if(_0x1b6093&&_0x1b6093['id']){logger[_0x52f7('0xc')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x1b6093['id']);logger[_0x52f7('0xc')](_0x52f7('0x55'),_0x52f7('0x4e'));emit(util[_0x52f7('0xe')]('user:%s',_0x193c4a[_0x52f7('0x17')]),_0x52f7('0x50'),{'uri':util[_0x52f7('0xe')]('%s/helpdesk/tickets/%d',_0x9c25e3['remoteUri'],_0x1b6093['id'])});}})[_0x52f7('0x52')](function(_0x2d1cdb){logger['error'](_0x52f7('0x55'),JSON[_0x52f7('0x32')](_0x2d1cdb));});};exports[_0x52f7('0x58')]=function(_0x1bdebf,_0x32e943,_0x4e606e,_0x56cafb,_0x119571,_0x16f491){var _0x29f2d2,_0x4b9043;_0x16f491['remoteUri']=intUtil[_0x52f7('0x44')](_0x16f491[_0x52f7('0x1d')]);_0x16f491[_0x52f7('0x45')]=intUtil[_0x52f7('0x44')](_0x16f491['serverUrl']);if(_0x119571&&_0x119571[_0x52f7('0x46')]){logger[_0x52f7('0xc')]('['+_0x32e943['lastevent'][_0x52f7('0x59')]()+']',_0x52f7('0x47'));_0x32e943[_0x52f7('0x48')]=util[_0x52f7('0xe')](_0x52f7('0x5a'),_0x16f491[_0x52f7('0x45')],_0x32e943[_0x52f7('0x49')],md5(_0x32e943['uniqueid']));}else{_0x32e943[_0x52f7('0x48')]='';}headers[_0x52f7('0x4a')]=getAuth(_0x16f491);return getUser(_0x16f491,'')['then'](function(_0x40b441){_0x29f2d2=_0x40b441;logger['info'](_0x52f7('0x4b'),_0x29f2d2['id']);return getEndUser(_0x16f491,_0x32e943[_0x52f7('0x10')],_0x32e943['calleridnum']);})['then'](function(_0x4bd3d3){_0x4b9043=_0x4bd3d3;logger[_0x52f7('0xc')](_0x52f7('0x57'),_0x4b9043['id']);return getTicket(_0x16f491,_0x29f2d2,_0x4b9043,_0x4e606e,_0x32e943);})['then'](function(_0x62b0f5){if(_0x62b0f5){logger[_0x52f7('0xc')](_0x52f7('0x20'));logger[_0x52f7('0xc')]('The\x20Ticket\x20ID\x20is:',_0x62b0f5['id']);}})[_0x52f7('0x52')](function(_0x37442e){logger['error']('['+_0x32e943[_0x52f7('0x5b')][_0x52f7('0x59')]()+']',JSON[_0x52f7('0x32')](_0x37442e));});}; \ 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 c5c785c..31ae3e2 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 _0xad1b=['unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','then','length','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','Admin\x20selected','userEmail','adminEmail','userId','/api/lookup?q=','&entities=contact','contacts','format','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','/api/contacts','contactNumber','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','getString','Subjects','Descriptions','Contact','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','destcalleridnum','queue'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xad1b,0xb4));var _0xbad1=function(_0x1324f2,_0x54accc){_0x1324f2=_0x1324f2-0x0;var _0x5260b4=_0xad1b[_0x1324f2];return _0x5260b4;};'use strict';var _=require(_0xbad1('0x0'));var rp=require(_0xbad1('0x1'));var md5=require(_0xbad1('0x2'));var util=require(_0xbad1('0x3'));var moment=require(_0xbad1('0x4'));var Promise=require(_0xbad1('0x5'));var Redis=require(_0xbad1('0x6'));var intUtil=require(_0xbad1('0x7'));var config=require(_0xbad1('0x8'));var logger=require(_0xbad1('0x9'))(_0xbad1('0xa'));config['redis']=_[_0xbad1('0xb')](config[_0xbad1('0xc')],{'host':_0xbad1('0xd'),'port':0x18eb});var io=require(_0xbad1('0xe'))(new Redis(config['redis']));function getAdminId(_0x5be4ea,_0x8fdae2,_0x5ca00e,_0x3168d7){return new Promise(function(_0x4d6790,_0x5d1814){var _0x3ba214=![];var _0x2f4f54={'method':_0xbad1('0xf'),'uri':_0x3168d7+_0xbad1('0x10'),'json':!![]};_0x2f4f54[_0xbad1('0x11')]=_0x5ca00e;logger[_0xbad1('0x12')]('Getting\x20admin\x20information');return rp(_0x2f4f54)[_0xbad1('0x13')](function(_0x8dd568){if(_0x8dd568){var _0x443f15=_0x8dd568['users'];var _0x4202fc=null;for(_0x4202fc=0x0;_0x4202fc<_0x443f15[_0xbad1('0x14')];_0x4202fc++){if(_0x443f15[_0x4202fc][_0xbad1('0x15')]===_0x5be4ea['adminEmail']){_0x5be4ea[_0xbad1('0x16')]=_0x443f15[_0x4202fc]['id'];_0x3ba214=!![];}}if(_0x3ba214){logger['info'](_0xbad1('0x17'),_0x5be4ea[_0xbad1('0x16')]);_0x4d6790(_0x5be4ea);}else{_0x5d1814({'statusCode':0x194,'message':_0xbad1('0x18')});}}else{_0x5d1814({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xbad1('0x19')](function(_0x3674e3){logger[_0xbad1('0x1a')]('['+[_0x8fdae2[_0xbad1('0x1b')]()]+']',_0x3674e3[_0xbad1('0x1c')]);_0x5d1814(_0x3674e3);});});}function getUser(_0x2fd25e,_0x2edfbc,_0x58f65e){return function(_0x110498){return new Promise(function(_0x4ba6f9,_0x490ed0){var _0x4d57b5={'method':_0xbad1('0xf'),'uri':_0x58f65e+_0xbad1('0x10'),'json':!![]};_0x4d57b5['headers']=_0x2edfbc;logger[_0xbad1('0x12')](_0xbad1('0x1d'));return rp(_0x4d57b5)[_0xbad1('0x13')](function(_0xb569e8){if(_0xb569e8){var _0x1f2961=_0xb569e8['users'];var _0x429fbd=![];var _0x577e4b=null;if(_0x110498[_0xbad1('0x1e')]!==null){logger[_0xbad1('0x12')](_0xbad1('0x1f'),_0x110498[_0xbad1('0x1e')]);_0x110498['userEmail']=_0x110498[_0xbad1('0x1e')];for(_0x577e4b=0x0;_0x577e4b<_0x1f2961['length'];_0x577e4b++){if(_0x1f2961[_0x577e4b][_0xbad1('0x15')]===_0x110498[_0xbad1('0x1e')]){_0x429fbd=!![];_0x110498['userId']=_0x1f2961[_0x577e4b]['id'];logger['info']('User\x20found:',_0x110498['userId']);}}}if(!_0x429fbd){logger[_0xbad1('0x12')](_0xbad1('0x20'));_0x110498[_0xbad1('0x21')]=_0x110498[_0xbad1('0x22')];_0x110498[_0xbad1('0x23')]=_0x110498[_0xbad1('0x16')];_0x429fbd=!![];}if(_0x429fbd){_0x4ba6f9(_0x110498);}else{_0x490ed0({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x490ed0({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xbad1('0x19')](function(_0x148e9e){logger['error']('['+[_0x2fd25e[_0xbad1('0x1b')]()]+']',_0x148e9e[_0xbad1('0x1c')]);_0x490ed0(_0x148e9e);});});};}function searchContact(_0xa6e099,_0x32b332,_0x56b134,_0x20600c){return new Promise(function(_0x4f62d7,_0x338145){var _0x5a3bcb={'method':_0xbad1('0xf'),'headers':_0x32b332,'uri':_0xa6e099+_0xbad1('0x24')+_0x20600c+'&f='+_0x56b134+_0xbad1('0x25'),'json':!![]};rp(_0x5a3bcb)[_0xbad1('0x13')](function(_0x2f2533){var _0x72e740=_['find'](_0x2f2533[_0xbad1('0x26')][_0xbad1('0x26')],[_0x56b134,_0x20600c]);_0x4f62d7(_0x72e740);})[_0xbad1('0x19')](function(_0x521561){_0x338145(_0x521561);});});}function getEndUser(_0x51a1f5,_0x3a8f34,_0x3f9517){return function(_0x36e171){return new Promise(function(_0x155151,_0x2a0900){logger['info'](util[_0xbad1('0x27')]('Searching\x20contact\x20with\x20phone\x20%s',_0x36e171['contactNumber']));searchContact(_0x3f9517,_0x3a8f34,_0xbad1('0x28'),_0x36e171['contactNumber'])[_0xbad1('0x13')](function(_0x261da9){if(_0x261da9){_0x36e171[_0xbad1('0x29')]=_0x261da9['id'];logger['info'](_0xbad1('0x2a'),_0x36e171[_0xbad1('0x29')]);return _0x155151(_0x36e171);}searchContact(_0x3f9517,_0x3a8f34,_0xbad1('0x2b'),_0x36e171['contactNumber'])[_0xbad1('0x13')](function(_0x4c1bbd){if(_0x4c1bbd){_0x36e171[_0xbad1('0x29')]=_0x4c1bbd['id'];logger[_0xbad1('0x12')](_0xbad1('0x2c'),_0x36e171['endUserId']);return _0x155151(_0x36e171);}createEndUser(_0x36e171,_0x51a1f5,_0x3a8f34,_0x3f9517)['then'](function(_0x514c90){logger[_0xbad1('0x12')]('Contact\x20created:',_0x514c90[_0xbad1('0x29')]);return _0x155151(_0x514c90);});});})['catch'](function(_0x1d29be){_0x2a0900(_0x1d29be);});});};}function createEndUser(_0x27d50c,_0x145a9d,_0xb32871,_0x5ef217){return new Promise(function(_0x298356,_0x3dc2af){var _0x20d9d2=moment();var _0x169fb7={'method':'POST','uri':_0x5ef217+_0xbad1('0x2d'),'body':{'contact':{'last_name':_0x27d50c[_0xbad1('0x2e')],'work_number':_0x27d50c[_0xbad1('0x2e')],'mobile_number':_0x27d50c[_0xbad1('0x2e')],'owner_id':_0x27d50c['userId'],'created_at':_0x20d9d2[_0xbad1('0x27')](_0xbad1('0x2f'))}},'json':!![]};_0x169fb7[_0xbad1('0x11')]=_0xb32871;logger['info'](_0xbad1('0x30'));return rp(_0x169fb7)[_0xbad1('0x13')](function(_0x5a80f1){_0x27d50c[_0xbad1('0x29')]=_0x5a80f1[_0xbad1('0x31')]['id'];_0x298356(_0x27d50c);})[_0xbad1('0x19')](function(_0x1e0b85){logger[_0xbad1('0x1a')]('['+[_0x145a9d[_0xbad1('0x1b')]()]+']',_0x1e0b85[_0xbad1('0x1c')]);_0x3dc2af(_0x1e0b85[_0xbad1('0x1c')]);});});}function getTicket(_0x3bdbaf,_0x7deafc,_0xa30e0e,_0x13435b,_0x1f07a8){return function(_0x4b077e){logger[_0xbad1('0x12')](_0xbad1('0x32'));return new Promise(function(_0x12f99e,_0x4ce7da){var _0x361e5e=moment();var _0x1ff751={'method':_0xbad1('0x33'),'uri':_0xa30e0e+'/api/tasks','body':{'title':intUtil[_0xbad1('0x34')](_0x13435b[_0xbad1('0x35')],_0x1f07a8,'\x20'),'description':intUtil[_0xbad1('0x34')](_0x13435b[_0xbad1('0x36')],_0x1f07a8,'\x0a'),'owner_id':_0x4b077e['userId'],'creater_id':_0x4b077e[_0xbad1('0x16')],'targetable_id':_0x4b077e[_0xbad1('0x29')],'targetable_type':_0xbad1('0x37'),'created_at':_0x361e5e[_0xbad1('0x27')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x361e5e['add'](0x1e,'m')['format'](_0xbad1('0x2f'))},'json':!![]};_0x1ff751['headers']=_0x7deafc;return rp(_0x1ff751)[_0xbad1('0x13')](function(_0x2895bb){_0x4b077e[_0xbad1('0x38')]=_0x2895bb[_0xbad1('0x39')]['id'];logger[_0xbad1('0x12')](_0xbad1('0x3a'),_0x4b077e[_0xbad1('0x38')]);_0x12f99e(_0x4b077e);})[_0xbad1('0x19')](function(_0x3823a9){logger[_0xbad1('0x1a')]('['+[_0x3bdbaf[_0xbad1('0x1b')]()]+']',_0x3823a9[_0xbad1('0x1c')]);_0x4ce7da(_0x3823a9['message']);});});};}function emit(_0x2db740,_0x426de4,_0x19ff58){var _0x216796={'uri':_0x2db740+_0xbad1('0x3b')+_0x19ff58};io['to'](util[_0xbad1('0x27')](_0xbad1('0x3c'),_0x426de4))[_0xbad1('0x3d')]('trigger:browser:url',_0x216796);}exports['cs']=function(_0x4de449,_0x15dbaa,_0x591f3a,_0x5d86b7,_0x316dc0,_0x850326,_0x586c27,_0x145062){var _0x396856={};var _0x50313d={'Authorization':'Token\x20token='+_0x850326['apiKey']};_0x850326['remoteUri']=intUtil['stripTrailingSlash'](_0x850326[_0xbad1('0x3e')]);_0x850326[_0xbad1('0x3f')]=intUtil[_0xbad1('0x40')](_0x850326[_0xbad1('0x3f')]);var _0x390d02=_0x850326['remoteUri'];_0x396856[_0xbad1('0x22')]=_0x850326[_0xbad1('0x41')];_0x396856['contactNumber']=_0x145062[_0xbad1('0x42')]()==='outbound'?_0x15dbaa[_0xbad1('0x43')]:_0x15dbaa['calleridnum'];_0x396856['callDirection']=_0x145062===_0xbad1('0x44')||_0x145062===_0xbad1('0x45')?_0xbad1('0x44'):'outbound';if(_0x5d86b7){_0x396856[_0xbad1('0x1e')]=_0x5d86b7[_0xbad1('0x15')];}var _0x1bbf19=util['format'](_0xbad1('0x46'),_0x850326['serverUrl'],_0x15dbaa[_0xbad1('0x47')],md5(_0x15dbaa[_0xbad1('0x47')]));if(_0x316dc0&&_0x316dc0[_0xbad1('0x48')]){logger[_0xbad1('0x12')](_0xbad1('0x49'),_0xbad1('0x4a'));_0x15dbaa[_0xbad1('0x4b')]=_0x1bbf19;}else if(_0x586c27&&_0x586c27[_0xbad1('0x4c')]&&_0x586c27[_0xbad1('0x4c')]!==_0xbad1('0x4d')){logger[_0xbad1('0x12')](_0xbad1('0x4e'),_0xbad1('0x4a'));_0x15dbaa['recordingURL']=_0x1bbf19;}else{_0x15dbaa[_0xbad1('0x4b')]='';}return getAdminId(_0x396856,_0x145062,_0x50313d,_0x390d02)[_0xbad1('0x13')](getUser(_0x145062,_0x50313d,_0x390d02))[_0xbad1('0x13')](getEndUser(_0x145062,_0x50313d,_0x390d02))[_0xbad1('0x13')](getTicket(_0x145062,_0x50313d,_0x390d02,_0x591f3a,_0x15dbaa))[_0xbad1('0x13')](function(_0x202bd1){logger[_0xbad1('0x12')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x202bd1['ticketId']));if(_0x145062!==_0xbad1('0x45')){logger['info']('['+[_0x145062[_0xbad1('0x1b')]()]+']',_0xbad1('0x4f'));emit(_0x390d02,_0x5d86b7[_0xbad1('0x50')],_0x202bd1[_0xbad1('0x29')]);}})[_0xbad1('0x19')](function(_0x176112){logger['error']('['+[_0x145062['toUpperCase']()]+_0xbad1('0x51'),util[_0xbad1('0x52')](_0x176112,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1b72=['Contact\x20created:','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','Task\x20created:','toUpperCase','/contacts/','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','name','inspect','lodash','request-promise','md5','util','moment','ioredis','./util','../../../../config/logger','freshsales','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','message','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20found\x20work_number:'];(function(_0x50ea6f,_0x39bf1e){var _0x5c52b7=function(_0x26158b){while(--_0x26158b){_0x50ea6f['push'](_0x50ea6f['shift']());}};_0x5c52b7(++_0x39bf1e);}(_0x1b72,0x129));var _0x21b7=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x1b72[_0x24f31b];return _0x488401;};'use strict';var _=require(_0x21b7('0x0'));var rp=require(_0x21b7('0x1'));var md5=require(_0x21b7('0x2'));var util=require(_0x21b7('0x3'));var moment=require(_0x21b7('0x4'));var Promise=require('bluebird');var Redis=require(_0x21b7('0x5'));var intUtil=require(_0x21b7('0x6'));var config=require('../../../../config/environment');var logger=require(_0x21b7('0x7'))(_0x21b7('0x8'));config['redis']=_['defaults'](config['redis'],{'host':_0x21b7('0x9'),'port':0x18eb});var io=require(_0x21b7('0xa'))(new Redis(config['redis']));function getAdminId(_0x2b0ff7,_0x6677d8,_0x2742e0,_0x47af48){return new Promise(function(_0x3fbd9a,_0x3d1404){var _0x49f04c=![];var _0x5e60c8={'method':_0x21b7('0xb'),'uri':_0x47af48+_0x21b7('0xc'),'json':!![]};_0x5e60c8[_0x21b7('0xd')]=_0x2742e0;logger[_0x21b7('0xe')]('Getting\x20admin\x20information');return rp(_0x5e60c8)[_0x21b7('0xf')](function(_0x3a5ba7){if(_0x3a5ba7){var _0x6f2177=_0x3a5ba7[_0x21b7('0x10')];var _0x252996=null;for(_0x252996=0x0;_0x252996<_0x6f2177[_0x21b7('0x11')];_0x252996++){if(_0x6f2177[_0x252996][_0x21b7('0x12')]===_0x2b0ff7[_0x21b7('0x13')]){_0x2b0ff7[_0x21b7('0x14')]=_0x6f2177[_0x252996]['id'];_0x49f04c=!![];}}if(_0x49f04c){logger[_0x21b7('0xe')](_0x21b7('0x15'),_0x2b0ff7[_0x21b7('0x14')]);_0x3fbd9a(_0x2b0ff7);}else{_0x3d1404({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x3d1404({'statusCode':0x194,'message':_0x21b7('0x16')});}})[_0x21b7('0x17')](function(_0x5c28c1){logger[_0x21b7('0x18')]('['+[_0x6677d8['toUpperCase']()]+']',_0x5c28c1[_0x21b7('0x19')]);_0x3d1404(_0x5c28c1);});});}function getUser(_0x517b3f,_0x3c248f,_0x428fa7){return function(_0x429721){return new Promise(function(_0x59954f,_0x49e67b){var _0x56e5b1={'method':_0x21b7('0xb'),'uri':_0x428fa7+_0x21b7('0xc'),'json':!![]};_0x56e5b1['headers']=_0x3c248f;logger[_0x21b7('0xe')](_0x21b7('0x1a'));return rp(_0x56e5b1)[_0x21b7('0xf')](function(_0x274201){if(_0x274201){var _0x3bd5f3=_0x274201[_0x21b7('0x10')];var _0x4f28ec=![];var _0x5dc52d=null;if(_0x429721['agentEmail']!==null){logger[_0x21b7('0xe')](_0x21b7('0x1b'),_0x429721[_0x21b7('0x1c')]);_0x429721[_0x21b7('0x1d')]=_0x429721[_0x21b7('0x1c')];for(_0x5dc52d=0x0;_0x5dc52d<_0x3bd5f3[_0x21b7('0x11')];_0x5dc52d++){if(_0x3bd5f3[_0x5dc52d][_0x21b7('0x12')]===_0x429721[_0x21b7('0x1c')]){_0x4f28ec=!![];_0x429721[_0x21b7('0x1e')]=_0x3bd5f3[_0x5dc52d]['id'];logger[_0x21b7('0xe')](_0x21b7('0x1f'),_0x429721[_0x21b7('0x1e')]);}}}if(!_0x4f28ec){logger[_0x21b7('0xe')](_0x21b7('0x20'));_0x429721[_0x21b7('0x1d')]=_0x429721[_0x21b7('0x13')];_0x429721[_0x21b7('0x1e')]=_0x429721[_0x21b7('0x14')];_0x4f28ec=!![];}if(_0x4f28ec){_0x59954f(_0x429721);}else{_0x49e67b({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x49e67b({'statusCode':0x194,'message':_0x21b7('0x16')});}})['catch'](function(_0x124f79){logger[_0x21b7('0x18')]('['+[_0x517b3f['toUpperCase']()]+']',_0x124f79['message']);_0x49e67b(_0x124f79);});});};}function searchContact(_0x2c0a65,_0x41b70f,_0x13865f,_0x3df029){return new Promise(function(_0x10dfea,_0x31a335){var _0x3476b5={'method':_0x21b7('0xb'),'headers':_0x41b70f,'uri':_0x2c0a65+'/api/lookup?q='+_0x3df029+_0x21b7('0x21')+_0x13865f+_0x21b7('0x22'),'json':!![]};rp(_0x3476b5)[_0x21b7('0xf')](function(_0x274638){var _0x47fde9=_[_0x21b7('0x23')](_0x274638[_0x21b7('0x24')][_0x21b7('0x24')],[_0x13865f,_0x3df029]);_0x10dfea(_0x47fde9);})[_0x21b7('0x17')](function(_0x1301a8){_0x31a335(_0x1301a8);});});}function getEndUser(_0x3c0efa,_0x48dbd0,_0x5d0d7d){return function(_0x27de18){return new Promise(function(_0x4454fd,_0x4586df){logger[_0x21b7('0xe')](util['format'](_0x21b7('0x25'),_0x27de18['contactNumber']));searchContact(_0x5d0d7d,_0x48dbd0,'mobile_number',_0x27de18[_0x21b7('0x26')])['then'](function(_0x159a73){if(_0x159a73){_0x27de18['endUserId']=_0x159a73['id'];logger[_0x21b7('0xe')](_0x21b7('0x27'),_0x27de18[_0x21b7('0x28')]);return _0x4454fd(_0x27de18);}searchContact(_0x5d0d7d,_0x48dbd0,_0x21b7('0x29'),_0x27de18[_0x21b7('0x26')])[_0x21b7('0xf')](function(_0x4fcea4){if(_0x4fcea4){_0x27de18[_0x21b7('0x28')]=_0x4fcea4['id'];logger[_0x21b7('0xe')](_0x21b7('0x2a'),_0x27de18[_0x21b7('0x28')]);return _0x4454fd(_0x27de18);}createEndUser(_0x27de18,_0x3c0efa,_0x48dbd0,_0x5d0d7d)[_0x21b7('0xf')](function(_0xcbf309){logger[_0x21b7('0xe')](_0x21b7('0x2b'),_0xcbf309['endUserId']);return _0x4454fd(_0xcbf309);});});})[_0x21b7('0x17')](function(_0x30bc1e){_0x4586df(_0x30bc1e);});});};}function createEndUser(_0x335277,_0x31f0ad,_0x5ae707,_0x30dd6d){return new Promise(function(_0x213d70,_0x5a773c){var _0x53ca40=moment();var _0x58f897={'method':'POST','uri':_0x30dd6d+_0x21b7('0x2c'),'body':{'contact':{'last_name':_0x335277['contactNumber'],'work_number':_0x335277[_0x21b7('0x26')],'mobile_number':_0x335277[_0x21b7('0x26')],'owner_id':_0x335277['userId'],'created_at':_0x53ca40[_0x21b7('0x2d')](_0x21b7('0x2e'))}},'json':!![]};_0x58f897[_0x21b7('0xd')]=_0x5ae707;logger[_0x21b7('0xe')](_0x21b7('0x2f'));return rp(_0x58f897)['then'](function(_0x34b2b8){_0x335277[_0x21b7('0x28')]=_0x34b2b8[_0x21b7('0x30')]['id'];_0x213d70(_0x335277);})['catch'](function(_0x33ae67){logger[_0x21b7('0x18')]('['+[_0x31f0ad['toUpperCase']()]+']',_0x33ae67[_0x21b7('0x19')]);_0x5a773c(_0x33ae67['message']);});});}function getTicket(_0x1eefbb,_0x59c746,_0x8bf7b4,_0x3758c3,_0x1a9fc4){return function(_0x501b6c){logger['info'](_0x21b7('0x31'));return new Promise(function(_0x45ad4b,_0x55f309){var _0x49e156=moment();var _0x5395f8={'method':'POST','uri':_0x8bf7b4+_0x21b7('0x32'),'body':{'title':intUtil[_0x21b7('0x33')](_0x3758c3[_0x21b7('0x34')],_0x1a9fc4,'\x20'),'description':intUtil[_0x21b7('0x33')](_0x3758c3[_0x21b7('0x35')],_0x1a9fc4,'\x0a'),'owner_id':_0x501b6c[_0x21b7('0x1e')],'creater_id':_0x501b6c[_0x21b7('0x14')],'targetable_id':_0x501b6c[_0x21b7('0x28')],'targetable_type':_0x21b7('0x36'),'created_at':_0x49e156[_0x21b7('0x2d')](_0x21b7('0x2e')),'due_date':_0x49e156[_0x21b7('0x37')](0x1e,'m')[_0x21b7('0x2d')](_0x21b7('0x2e'))},'json':!![]};_0x5395f8[_0x21b7('0xd')]=_0x59c746;return rp(_0x5395f8)['then'](function(_0x6b6190){_0x501b6c[_0x21b7('0x38')]=_0x6b6190['task']['id'];logger[_0x21b7('0xe')](_0x21b7('0x39'),_0x501b6c[_0x21b7('0x38')]);_0x45ad4b(_0x501b6c);})[_0x21b7('0x17')](function(_0x13faba){logger['error']('['+[_0x1eefbb[_0x21b7('0x3a')]()]+']',_0x13faba['message']);_0x55f309(_0x13faba[_0x21b7('0x19')]);});});};}function emit(_0x341acd,_0x7e1ac6,_0x2c00b9){var _0x9699af={'uri':_0x341acd+_0x21b7('0x3b')+_0x2c00b9};io['to'](util[_0x21b7('0x2d')]('user:%s',_0x7e1ac6))[_0x21b7('0x3c')]('trigger:browser:url',_0x9699af);}exports['cs']=function(_0x35ec88,_0x313217,_0x3f30fb,_0x523c25,_0x5ec787,_0xd461d,_0x2bc9c2,_0x26227e){var _0x1193a0={};var _0x22ba27={'Authorization':_0x21b7('0x3d')+_0xd461d[_0x21b7('0x3e')]};_0xd461d[_0x21b7('0x3f')]=intUtil[_0x21b7('0x40')](_0xd461d[_0x21b7('0x3f')]);_0xd461d['serverUrl']=intUtil[_0x21b7('0x40')](_0xd461d[_0x21b7('0x41')]);var _0x533666=_0xd461d[_0x21b7('0x3f')];_0x1193a0[_0x21b7('0x13')]=_0xd461d[_0x21b7('0x42')];_0x1193a0['contactNumber']=_0x26227e[_0x21b7('0x43')]()===_0x21b7('0x44')?_0x313217[_0x21b7('0x45')]:_0x313217[_0x21b7('0x46')];_0x1193a0[_0x21b7('0x47')]=_0x26227e===_0x21b7('0x48')||_0x26227e===_0x21b7('0x49')?_0x21b7('0x48'):_0x21b7('0x44');if(_0x523c25){_0x1193a0[_0x21b7('0x1c')]=_0x523c25[_0x21b7('0x12')];}var _0x5aab71=util[_0x21b7('0x2d')](_0x21b7('0x4a'),_0xd461d['serverUrl'],_0x313217[_0x21b7('0x4b')],md5(_0x313217['uniqueid']));if(_0x5ec787&&_0x5ec787['monitor_format']){logger[_0x21b7('0xe')](_0x21b7('0x4c'),_0x21b7('0x4d'));_0x313217[_0x21b7('0x4e')]=_0x5aab71;}else if(_0x2bc9c2&&_0x2bc9c2['recordingFormat']&&_0x2bc9c2[_0x21b7('0x4f')]!==_0x21b7('0x50')){logger[_0x21b7('0xe')](_0x21b7('0x51'),'Recording\x20is\x20enabled!');_0x313217[_0x21b7('0x4e')]=_0x5aab71;}else{_0x313217[_0x21b7('0x4e')]='';}return getAdminId(_0x1193a0,_0x26227e,_0x22ba27,_0x533666)[_0x21b7('0xf')](getUser(_0x26227e,_0x22ba27,_0x533666))['then'](getEndUser(_0x26227e,_0x22ba27,_0x533666))[_0x21b7('0xf')](getTicket(_0x26227e,_0x22ba27,_0x533666,_0x3f30fb,_0x313217))['then'](function(_0x552d25){logger['info'](util['format'](_0x21b7('0x52'),_0x552d25[_0x21b7('0x38')]));if(_0x26227e!=='unmanaged'){logger[_0x21b7('0xe')]('['+[_0x26227e[_0x21b7('0x3a')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x533666,_0x523c25[_0x21b7('0x53')],_0x552d25[_0x21b7('0x28')]);}})[_0x21b7('0x17')](function(_0x1d0ceb){logger[_0x21b7('0x18')]('['+[_0x26227e[_0x21b7('0x3a')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x21b7('0x54')](_0x1d0ceb,{'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 161f078..b4d2617 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 _0xb58e=['vtiger','../../../../config/logger','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','data3','error','format','%s\x20account\x20#%s\x20not\x20found','lodash','./salesforce','./sugarcrm','./zoho','./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','zoho','dynamics365','freshsales','servicenow','includes','data1','toLowerCase','data2','find','queue','routeId','outbound','log','unmanaged','zendesk','desk'];(function(_0x351572,_0xfcedb8){var _0xb994ef=function(_0x378398){while(--_0x378398){_0x351572['push'](_0x351572['shift']());}};_0xb994ef(++_0xfcedb8);}(_0xb58e,0x94));var _0xeb58=function(_0x4c1ae3,_0x492c90){_0x4c1ae3=_0x4c1ae3-0x0;var _0x71158e=_0xb58e[_0x4c1ae3];return _0x71158e;};'use strict';var _=require(_0xeb58('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0xeb58('0x1'));var sugarcrm=require(_0xeb58('0x2'));var freshdesk=require('./freshdesk');var zoho=require(_0xeb58('0x3'));var desk=require('./desk');var vtiger=require(_0xeb58('0x4'));var servicenow=require(_0xeb58('0x5'));var dynamics365=require(_0xeb58('0x6'));var freshsales=require(_0xeb58('0x7'));var integrations=['zendesk',_0xeb58('0x8'),_0xeb58('0x9'),_0xeb58('0xa'),_0xeb58('0xb'),'desk','vtiger',_0xeb58('0xc'),_0xeb58('0xd'),_0xeb58('0xe')];exports['exec']=function(_0xe2f758,_0x17e006,_0x2cb972,_0x4dbdbd,_0x2a9a83,_0x4f47ee){if(_0x2cb972){if(_[_0xeb58('0xf')](integrations,_0xe2f758[_0xeb58('0x10')][_0xeb58('0x11')]())){try{var _0x39f8b4=null;var _0x133252='';var _0x27e2b7=_0x2cb972[_0xe2f758[_0xeb58('0x10')][_0xeb58('0x11')]()];if(_0x27e2b7){var _0x2cc9f5=_0x27e2b7[_0xe2f758[_0xeb58('0x12')]];if(_0x2cc9f5){var _0x2c699c=_[_0xeb58('0x13')](_0x2cc9f5['Configurations'],{'id':parseInt(_0xe2f758['data3'],0xa)});if(_0x2c699c){if(_0x4dbdbd){if(_0x2a9a83&&_0x17e006[_0xeb58('0x14')]){_0x133252=_0xeb58('0x14');}else if(_0x17e006[_0xeb58('0x15')]){_0x133252=_0xeb58('0x16');}else{console[_0xeb58('0x17')]('EVENT\x20UNKNOWN',_0x17e006);}}else{_0x133252=_0xeb58('0x18');}switch(_0xe2f758['data1'][_0xeb58('0x11')]()){case _0xeb58('0x19'):zendesk[_0x133252](_0xe2f758,_0x17e006,_0x2c699c,_0x4dbdbd,_0x2a9a83,_0x2cc9f5,_0x4f47ee);break;case _0xeb58('0x8'):salesforce[_0x133252](_0xe2f758,_0x17e006,_0x2c699c,_0x4dbdbd,_0x2a9a83,_0x2cc9f5,_0x4f47ee);break;case _0xeb58('0x9'):sugarcrm[_0x133252](_0xe2f758,_0x17e006,_0x2c699c,_0x4dbdbd,_0x2a9a83,_0x2cc9f5,_0x4f47ee);break;case _0xeb58('0xa'):freshdesk[_0x133252](_0xe2f758,_0x17e006,_0x2c699c,_0x4dbdbd,_0x2a9a83,_0x2cc9f5,_0x4f47ee);break;case _0xeb58('0xb'):zoho[_0x133252](_0xe2f758,_0x17e006,_0x2c699c,_0x4dbdbd,_0x2a9a83,_0x2cc9f5,_0x4f47ee);break;case _0xeb58('0x1a'):desk[_0x133252](_0xe2f758,_0x17e006,_0x2c699c,_0x4dbdbd,_0x2a9a83,_0x2cc9f5,_0x4f47ee);break;case _0xeb58('0x1b'):vtiger[_0x133252](_0xe2f758,_0x17e006,_0x2c699c,_0x4dbdbd,_0x2a9a83,_0x2cc9f5,_0x4f47ee);break;case'freshsales':freshsales['cs'](_0xe2f758,_0x17e006,_0x2c699c,_0x4dbdbd,_0x2a9a83,_0x2cc9f5,_0x4f47ee,_0x133252);break;case _0xeb58('0xe'):servicenow['cs'](_0xe2f758,_0x17e006,_0x2c699c,_0x4dbdbd,_0x2a9a83,_0x2cc9f5,_0x4f47ee,_0x133252);break;case'dynamics365':dynamics365['cs'](_0xe2f758,_0x17e006,_0x2c699c,_0x4dbdbd,_0x2a9a83,_0x2cc9f5,_0x4f47ee,_0x133252);break;default:console[_0xeb58('0x17')]('unknown\x20integration');}}else{_0x39f8b4=require(_0xeb58('0x1c'))(_0xe2f758['data1'][_0xeb58('0x11')]());_0x39f8b4['error'](_0xeb58('0x1d'),util['format'](_0xeb58('0x1e'),_0xe2f758[_0xeb58('0x10')]['toLowerCase'](),_0xe2f758[_0xeb58('0x1f')]));}}else{_0x39f8b4=require(_0xeb58('0x1c'))(_0xe2f758[_0xeb58('0x10')][_0xeb58('0x11')]());_0x39f8b4[_0xeb58('0x20')]('[EXEC]',util[_0xeb58('0x21')](_0xeb58('0x22'),_0xe2f758[_0xeb58('0x10')][_0xeb58('0x11')](),_0xe2f758[_0xeb58('0x12')]));}}else{}}catch(_0x1d9d4b){console['error'](_0x1d9d4b);}}}}; \ No newline at end of file +var _0x7f8c=['./sugarcrm','./desk','./vtiger','./servicenow','./dynamics365','zendesk','sugarcrm','freshdesk','servicenow','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','unmanaged','salesforce','zoho','desk','vtiger','freshsales','unknown\x20integration','error','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce'];(function(_0x168a58,_0x1d2ec5){var _0x520033=function(_0x534995){while(--_0x534995){_0x168a58['push'](_0x168a58['shift']());}};_0x520033(++_0x1d2ec5);}(_0x7f8c,0x189));var _0xc7f8=function(_0x77ce34,_0x3b3de7){_0x77ce34=_0x77ce34-0x0;var _0x51ada6=_0x7f8c[_0x77ce34];return _0x51ada6;};'use strict';var _=require('lodash');var util=require(_0xc7f8('0x0'));var zendesk=require(_0xc7f8('0x1'));var salesforce=require(_0xc7f8('0x2'));var sugarcrm=require(_0xc7f8('0x3'));var freshdesk=require('./freshdesk');var zoho=require('./zoho');var desk=require(_0xc7f8('0x4'));var vtiger=require(_0xc7f8('0x5'));var servicenow=require(_0xc7f8('0x6'));var dynamics365=require(_0xc7f8('0x7'));var freshsales=require('./freshsales');var integrations=[_0xc7f8('0x8'),'salesforce',_0xc7f8('0x9'),_0xc7f8('0xa'),'zoho','desk','vtiger','dynamics365','freshsales',_0xc7f8('0xb')];exports['exec']=function(_0x132ad0,_0x1a25d8,_0x1cf0ee,_0x4ca589,_0x3bea3a,_0x5f52b5){if(_0x1cf0ee){if(_[_0xc7f8('0xc')](integrations,_0x132ad0[_0xc7f8('0xd')][_0xc7f8('0xe')]())){try{var _0x5e71f0=null;var _0x4835f0='';var _0x327298=_0x1cf0ee[_0x132ad0[_0xc7f8('0xd')][_0xc7f8('0xe')]()];if(_0x327298){var _0x45f7fe=_0x327298[_0x132ad0[_0xc7f8('0xf')]];if(_0x45f7fe){var _0x5bde5a=_[_0xc7f8('0x10')](_0x45f7fe[_0xc7f8('0x11')],{'id':parseInt(_0x132ad0[_0xc7f8('0x12')],0xa)});if(_0x5bde5a){if(_0x4ca589){if(_0x3bea3a&&_0x1a25d8[_0xc7f8('0x13')]){_0x4835f0=_0xc7f8('0x13');}else if(_0x1a25d8[_0xc7f8('0x14')]){_0x4835f0=_0xc7f8('0x15');}else{console[_0xc7f8('0x16')]('EVENT\x20UNKNOWN',_0x1a25d8);}}else{_0x4835f0=_0xc7f8('0x17');}switch(_0x132ad0['data1'][_0xc7f8('0xe')]()){case _0xc7f8('0x8'):zendesk[_0x4835f0](_0x132ad0,_0x1a25d8,_0x5bde5a,_0x4ca589,_0x3bea3a,_0x45f7fe,_0x5f52b5);break;case _0xc7f8('0x18'):salesforce[_0x4835f0](_0x132ad0,_0x1a25d8,_0x5bde5a,_0x4ca589,_0x3bea3a,_0x45f7fe,_0x5f52b5);break;case _0xc7f8('0x9'):sugarcrm[_0x4835f0](_0x132ad0,_0x1a25d8,_0x5bde5a,_0x4ca589,_0x3bea3a,_0x45f7fe,_0x5f52b5);break;case _0xc7f8('0xa'):freshdesk[_0x4835f0](_0x132ad0,_0x1a25d8,_0x5bde5a,_0x4ca589,_0x3bea3a,_0x45f7fe,_0x5f52b5);break;case _0xc7f8('0x19'):zoho[_0x4835f0](_0x132ad0,_0x1a25d8,_0x5bde5a,_0x4ca589,_0x3bea3a,_0x45f7fe,_0x5f52b5);break;case _0xc7f8('0x1a'):desk[_0x4835f0](_0x132ad0,_0x1a25d8,_0x5bde5a,_0x4ca589,_0x3bea3a,_0x45f7fe,_0x5f52b5);break;case _0xc7f8('0x1b'):vtiger[_0x4835f0](_0x132ad0,_0x1a25d8,_0x5bde5a,_0x4ca589,_0x3bea3a,_0x45f7fe,_0x5f52b5);break;case _0xc7f8('0x1c'):freshsales['cs'](_0x132ad0,_0x1a25d8,_0x5bde5a,_0x4ca589,_0x3bea3a,_0x45f7fe,_0x5f52b5,_0x4835f0);break;case _0xc7f8('0xb'):servicenow['cs'](_0x132ad0,_0x1a25d8,_0x5bde5a,_0x4ca589,_0x3bea3a,_0x45f7fe,_0x5f52b5,_0x4835f0);break;case'dynamics365':dynamics365['cs'](_0x132ad0,_0x1a25d8,_0x5bde5a,_0x4ca589,_0x3bea3a,_0x45f7fe,_0x5f52b5,_0x4835f0);break;default:console['log'](_0xc7f8('0x1d'));}}else{_0x5e71f0=require('../../../../config/logger')(_0x132ad0[_0xc7f8('0xd')][_0xc7f8('0xe')]());_0x5e71f0[_0xc7f8('0x1e')]('[EXEC]',util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x132ad0['data1'][_0xc7f8('0xe')](),_0x132ad0[_0xc7f8('0x12')]));}}else{_0x5e71f0=require(_0xc7f8('0x1f'))(_0x132ad0[_0xc7f8('0xd')][_0xc7f8('0xe')]());_0x5e71f0['error']('[EXEC]',util['format'](_0xc7f8('0x20'),_0x132ad0['data1'][_0xc7f8('0xe')](),_0x132ad0[_0xc7f8('0xf')]));}}else{}}catch(_0x5690fd){console[_0xc7f8('0x1e')](_0x5690fd);}}}}; \ 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 2dabcfb..02941f5 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 _0xde91=['first','Phone','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Caller\x20-\x20%s','','No\x20Company','upperFirst','create','forEach','string','picklist','idField','variable','variableName','Variable','name','toString','password','securityToken','Connection','remoteUri','https://login.salesforce.com','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','outbound','none','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','integrationTab','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase','isNil','calleridname',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','util','ioredis','../../../../config/environment','salesforce','redis','localhost','emit','assign','getString','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','endUserType','contact','account','Case','ContactId','AccountId','lead','leadId','info','sobject','validateEmail','execute','then','length','Email','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','$or','Contact','find','additionalSearchLead','merge','Lead','additionalSearchAccount'];(function(_0x5b14a6,_0x1879eb){var _0x230da2=function(_0x861a3d){while(--_0x861a3d){_0x5b14a6['push'](_0x5b14a6['shift']());}};_0x230da2(++_0x1879eb);}(_0xde91,0x1a7));var _0x1de9=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xde91[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0x1de9('0x0'));var rp=require(_0x1de9('0x1'));var moment=require(_0x1de9('0x2'));var BPromise=require(_0x1de9('0x3'));var md5=require(_0x1de9('0x4'));var jsforce=require('jsforce');var util=require(_0x1de9('0x5'));var Redis=require(_0x1de9('0x6'));var intUtil=require('./util');var config=require(_0x1de9('0x7'));var logger=require('../../../../config/logger')(_0x1de9('0x8'));config[_0x1de9('0x9')]=_['defaults'](config[_0x1de9('0x9')],{'host':_0x1de9('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1de9('0x9')]));function emit(_0x2fa2cc,_0x2d2f70,_0x399eda){io['to'](_0x2fa2cc)[_0x1de9('0xb')](_0x2d2f70,_0x399eda);}function getTicket(_0x3ae8ae,_0x1ebf8e,_0x16560d,_0x248d6f,_0x95ea45,_0x2d124b,_0x4301dc,_0x5e338e){var _0x157135=Object[_0x1de9('0xc')]({},{'OwnerId':_0x1ebf8e['id'],'Subject':intUtil[_0x1de9('0xd')](_0x248d6f['Subjects'],_0x95ea45,'\x20'),'Description':intUtil[_0x1de9('0xd')](_0x248d6f[_0x1de9('0xe')],_0x95ea45,'\x0a')},getCustomFields(_0x2d124b,_0x95ea45));if(_0x16560d){if(_0x248d6f[_0x1de9('0xf')]===_0x1de9('0x10')){_0x157135[_0x1de9('0x11')]=moment[_0x1de9('0x12')]();_0x157135[_0x1de9('0x13')]=![];_0x157135['IsRecurrence']=![];if(_0x16560d[_0x1de9('0x14')]===_0x1de9('0x15')||_0x16560d['endUserType']==='lead'){_0x157135['WhoId']=_0x16560d['id'];}else if(_0x16560d[_0x1de9('0x14')]===_0x1de9('0x16')){_0x157135['WhatId']=_0x16560d['id'];}}else if(_0x248d6f[_0x1de9('0xf')]===_0x1de9('0x17')){if(_0x16560d[_0x1de9('0x14')]===_0x1de9('0x15')){_0x157135[_0x1de9('0x18')]=_0x16560d['id'];}else if(_0x16560d[_0x1de9('0x14')]===_0x1de9('0x16')){_0x157135[_0x1de9('0x19')]=_0x16560d['id'];}else if(_0x16560d['endUserType']===_0x1de9('0x1a')&&_0x248d6f[_0x1de9('0x1b')]){_0x157135[_0x248d6f[_0x1de9('0x1b')]]=_0x16560d['id'];}else{logger[_0x1de9('0x1c')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x4301dc[_0x1de9('0x1d')](_0x248d6f[_0x1de9('0xf')])['create'](_0x157135);}function getUser(_0x4a69ee,_0x293152,_0x531d18){if(!_['isNil'](_0x293152)&&intUtil[_0x1de9('0x1e')](_0x293152)){var _0x3bdb75={'Email':_0x293152};var _0x3f5b82={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x531d18[_0x1de9('0x1d')]('User')['find'](_0x3bdb75,_0x3f5b82)[_0x1de9('0x1f')]()[_0x1de9('0x20')](function(_0x36a1f3){if(_0x36a1f3[_0x1de9('0x21')]){var _0x1e1077=_['find'](_0x36a1f3,function(_0xee90dd){return _0xee90dd[_0x1de9('0x22')]===_0x293152;});if(_0x1e1077){logger[_0x1de9('0x1c')](_0x1de9('0x23'),_0x293152);return BPromise[_0x1de9('0x24')]({'id':_0x1e1077['Id'],'name':_0x1e1077[_0x1de9('0x25')]});}}else{logger[_0x1de9('0x1c')](_0x1de9('0x26'),_0x293152);return _0x531d18[_0x1de9('0x27')]()[_0x1de9('0x20')](function(_0x561c27){return BPromise[_0x1de9('0x24')]({'id':_0x561c27[_0x1de9('0x28')],'name':_0x561c27[_0x1de9('0x29')]});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x293152);return _0x531d18[_0x1de9('0x27')]()[_0x1de9('0x20')](function(_0x24a799){return BPromise['resolve']({'id':_0x24a799[_0x1de9('0x28')],'name':_0x24a799[_0x1de9('0x29')]});});}}function getEndUser(_0x58ac17,_0x27ca28,_0x382449,_0x425624,_0x15a271){var _0x171b0b={'$or':{'Phone':_0x425624}};var _0x3ae319={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){logger['info'](_0x1de9('0x2a'),_0x425624,_0x27ca28[_0x1de9('0x2b')]);switch(_0x27ca28[_0x1de9('0x2b')]){case'contact_lead':var _0x185569=_[_0x1de9('0x2c')](_0x171b0b);if(_0x27ca28[_0x1de9('0x2d')]){var _0x20b6c7={};_0x20b6c7[_0x27ca28[_0x1de9('0x2d')]]=_0x425624;_['merge'](_0x185569[_0x1de9('0x2e')],_0x20b6c7);}return _0x15a271[_0x1de9('0x1d')](_0x1de9('0x2f'))[_0x1de9('0x30')](_0x185569,_0x3ae319)[_0x1de9('0x1f')]()[_0x1de9('0x20')](function(_0x219172){if(_0x219172&&_0x219172[_0x1de9('0x21')]){return _0x219172;}else{var _0xa9c2a0=_['cloneDeep'](_0x171b0b);if(_0x27ca28['additionalSearchLead']){var _0x36abf1={};_0x36abf1[_0x27ca28[_0x1de9('0x31')]]=_0x425624;_[_0x1de9('0x32')](_0xa9c2a0[_0x1de9('0x2e')],_0x36abf1);}return _0x15a271[_0x1de9('0x1d')](_0x1de9('0x33'))[_0x1de9('0x30')](_0xa9c2a0,_0x3ae319);}});case'account_contact_lead':var _0x7152c1=_[_0x1de9('0x2c')](_0x171b0b);if(_0x27ca28[_0x1de9('0x34')]){var _0x20b6c7={};_0x20b6c7[_0x27ca28['additionalSearchAccount']]=_0x425624;_[_0x1de9('0x32')](_0x7152c1['$or'],_0x20b6c7);}return _0x15a271[_0x1de9('0x1d')]('Account')['find'](_0x7152c1,_0x3ae319)[_0x1de9('0x1f')]()[_0x1de9('0x20')](function(_0x475e91){if(_0x475e91&&_0x475e91[_0x1de9('0x21')]){return _0x475e91;}else{var _0xd5bfe2=_[_0x1de9('0x2c')](_0x171b0b);if(_0x27ca28[_0x1de9('0x2d')]){var _0x16f0ea={};_0x16f0ea[_0x27ca28[_0x1de9('0x2d')]]=_0x425624;_[_0x1de9('0x32')](_0xd5bfe2['$or'],_0x16f0ea);}return _0x15a271['sobject'](_0x1de9('0x2f'))[_0x1de9('0x30')](_0xd5bfe2,_0x3ae319)[_0x1de9('0x20')](function(_0x483c83){if(_0x483c83&&_0x483c83[_0x1de9('0x21')]){return _0x483c83;}else{var _0x5840da=_['cloneDeep'](_0x171b0b);if(_0x27ca28[_0x1de9('0x31')]){var _0x2eb4cd={};_0x2eb4cd[_0x27ca28[_0x1de9('0x31')]]=_0x425624;_[_0x1de9('0x32')](_0x5840da['$or'],_0x2eb4cd);}return _0x15a271[_0x1de9('0x1d')](_0x1de9('0x33'))['find'](_0x5840da,_0x3ae319);}});}});case'contact':var _0x185569=_[_0x1de9('0x2c')](_0x171b0b);if(_0x27ca28['additionalSearchContact']){var _0x20b6c7={};_0x20b6c7[_0x27ca28[_0x1de9('0x2d')]]=_0x425624;_[_0x1de9('0x32')](_0x185569[_0x1de9('0x2e')],_0x20b6c7);}return _0x15a271[_0x1de9('0x1d')](_0x1de9('0x2f'))[_0x1de9('0x30')](_0x185569,_0x3ae319)[_0x1de9('0x1f')]();case _0x1de9('0x1a'):var _0x4a523d=_[_0x1de9('0x2c')](_0x171b0b);if(_0x27ca28['additionalSearchLead']){var _0x20b6c7={};_0x20b6c7[_0x27ca28['additionalSearchLead']]=_0x425624;_[_0x1de9('0x32')](_0x4a523d['$or'],_0x20b6c7);}return _0x15a271[_0x1de9('0x1d')]('Lead')[_0x1de9('0x30')](_0x4a523d,_0x3ae319);case _0x1de9('0x16'):var _0x7152c1=_[_0x1de9('0x2c')](_0x171b0b);if(_0x27ca28['additionalSearchAccount']){var _0x20b6c7={};_0x20b6c7[_0x27ca28[_0x1de9('0x34')]]=_0x425624;_[_0x1de9('0x32')](_0x7152c1[_0x1de9('0x2e')],_0x20b6c7);}return _0x15a271[_0x1de9('0x1d')]('Account')[_0x1de9('0x30')](_0x7152c1,_0x3ae319);default:return null;}})['then'](function(_0x571867){if(_0x571867&&_0x571867[_0x1de9('0x21')]){var _0xf9a451=_[_0x1de9('0x35')](_0x571867);if(_0xf9a451){return BPromise[_0x1de9('0x24')]({'id':_0xf9a451['Id'],'name':_0xf9a451[_0x1de9('0x25')],'phone':_0xf9a451[_0x1de9('0x36')],'endUserType':_0xf9a451['attributes'][_0x1de9('0x37')][_0x1de9('0x38')]()});}}})['then'](function(_0x247ba8){if(_0x247ba8){logger[_0x1de9('0x1c')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x247ba8['endUserType'],_0x425624);return BPromise[_0x1de9('0x24')](_0x247ba8);}else{logger[_0x1de9('0x1c')](_0x1de9('0x39'),_0x425624);var _0x35d351={'Phone':_0x425624};if(_0x27ca28[_0x1de9('0x3a')]){if(_0x27ca28[_0x1de9('0x3a')]==='contact'){logger[_0x1de9('0x1c')](_0x1de9('0x3b'),_0x425624,_0x27ca28[_0x1de9('0x3a')]);_0x35d351[_0x1de9('0x3c')]=_0x382449!==''?_0x382449:util[_0x1de9('0x3d')](_0x1de9('0x3e'),_0x425624);}else if(_0x27ca28[_0x1de9('0x3a')]===_0x1de9('0x1a')){logger[_0x1de9('0x1c')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x425624,_0x27ca28['moduleCreate']);_0x35d351[_0x1de9('0x3c')]=_0x382449!==_0x1de9('0x3f')?_0x382449:util[_0x1de9('0x3d')](_0x1de9('0x3e'),_0x425624);_0x35d351['Company']=_0x1de9('0x40');}else if(_0x27ca28[_0x1de9('0x3a')]==='account'){logger[_0x1de9('0x1c')](_0x1de9('0x3b'),_0x425624,_0x27ca28['moduleCreate']);_0x35d351[_0x1de9('0x25')]=_0x382449!==_0x1de9('0x3f')?_0x382449:util['format'](_0x1de9('0x3e'),_0x425624);}else{return null;}}return _0x15a271[_0x1de9('0x1d')](_[_0x1de9('0x41')](_0x27ca28[_0x1de9('0x3a')]))[_0x1de9('0x42')](_0x35d351)[_0x1de9('0x20')](function(_0x31f203){return BPromise[_0x1de9('0x24')]({'id':_0x31f203['id'],'endUserType':_0x27ca28['moduleCreate']});});}});}function getCustomFields(_0x350994,_0x348aa1){var _0x54c439={};if(_0x350994[_0x1de9('0x21')]>0x0){_[_0x1de9('0x43')](_0x350994,function(_0x11e2ed){if(_['includes']([_0x1de9('0x44'),_0x1de9('0x45')],_0x11e2ed[_0x1de9('0x37')])&&_0x11e2ed[_0x1de9('0x46')]){_0x54c439[_0x11e2ed['idField']]=_0x11e2ed['content']['toString']();}else if(_0x11e2ed[_0x1de9('0x37')]===_0x1de9('0x47')&&_0x11e2ed[_0x1de9('0x48')]&&_0x11e2ed[_0x1de9('0x46')]){_0x348aa1[_0x11e2ed[_0x1de9('0x48')]]&&(_0x54c439[_0x11e2ed[_0x1de9('0x46')]]=_0x348aa1[_0x11e2ed[_0x1de9('0x48')]]['toString']());}else if(_0x11e2ed[_0x1de9('0x37')]==='customVariable'&&_0x11e2ed[_0x1de9('0x49')]&&_0x11e2ed[_0x1de9('0x49')][_0x1de9('0x4a')]&&_0x11e2ed[_0x1de9('0x46')]){_0x348aa1[_0x11e2ed[_0x1de9('0x49')]['name'][_0x1de9('0x38')]()]&&(_0x54c439[_0x11e2ed[_0x1de9('0x46')]]=_0x348aa1[_0x11e2ed['Variable'][_0x1de9('0x4a')]['toLowerCase']()][_0x1de9('0x4b')]());}});}return _0x54c439;}function getConnection(_0x1a940b){var _0x23d99e=_0x1a940b[_0x1de9('0x4c')]['concat'](_0x1a940b[_0x1de9('0x4d')]);var _0x2313b8=new jsforce[(_0x1de9('0x4e'))]({'oauth2':{'loginUrl':_0x1a940b[_0x1de9('0x4f')]||_0x1de9('0x50'),'clientId':_0x1a940b['clientId'],'clientSecret':_0x1a940b['clientSecret']}});return _0x2313b8[_0x1de9('0x51')](_0x1a940b[_0x1de9('0x52')],_0x23d99e)[_0x1de9('0x20')](function(){logger[_0x1de9('0x1c')](_0x1de9('0x53'));return _0x2313b8;});}exports[_0x1de9('0x54')]=function(_0x2c6512,_0x75298e,_0x1ed7c3,_0x599169,_0x226144,_0x321a81){var _0x63e88,_0x1d7077,_0x3cd602,_0xc1db9;_0x321a81[_0x1de9('0x55')]=intUtil[_0x1de9('0x56')](_0x321a81[_0x1de9('0x55')]);_0x321a81['remoteUri']=intUtil['stripTrailingSlash'](_0x321a81[_0x1de9('0x4f')]);if(_0x226144&&_0x226144[_0x1de9('0x57')]){logger[_0x1de9('0x1c')]('[QUEUE]',_0x1de9('0x58'));_0x75298e[_0x1de9('0x59')]=util['format'](_0x1de9('0x5a'),_0x321a81[_0x1de9('0x55')],_0x75298e['uniqueid'],md5(_0x75298e[_0x1de9('0x5b')]));}else{_0x75298e['recordingURL']='';}return getConnection(_0x321a81)[_0x1de9('0x20')](function(_0x509d62){_0xc1db9=_0x509d62;return getUser(_0x321a81,_0x599169[_0x1de9('0x5c')],_0xc1db9);})[_0x1de9('0x20')](function(_0xccb8f5){_0x63e88=_0xccb8f5;return getEndUser(_0x321a81,_0x1ed7c3,_0x75298e['calleridname'],_0x75298e[_0x1de9('0x5d')],_0xc1db9);})['then'](function(_0x177475){_0x1d7077=_0x177475;return getTicket(_0x321a81,_0x63e88,_0x1d7077,_0x1ed7c3,_0x75298e,_0x1ed7c3['Fields'],_0xc1db9,'queue');})[_0x1de9('0x20')](function(_0x805e50){_0x3cd602=_0x805e50;logger[_0x1de9('0x1c')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x3cd602['id']);logger[_0x1de9('0x1c')](_0x1de9('0x5e'),_0x3cd602['id'],_0x599169[_0x1de9('0x4a')],_0x321a81['type']);switch(_0x321a81[_0x1de9('0x37')]){case'integrationTab':emit(util[_0x1de9('0x3d')](_0x1de9('0x5f'),_0x599169[_0x1de9('0x4a')]),_0x1de9('0x60'),{'recordId':_0x3cd602['id']});break;case _0x1de9('0x61'):emit(util[_0x1de9('0x3d')](_0x1de9('0x5f'),_0x599169[_0x1de9('0x4a')]),_0x1de9('0x62'),{'uri':util[_0x1de9('0x3d')]('%s/%s/e',_0xc1db9[_0x1de9('0x63')],_0x3cd602['id'])});break;default:logger[_0x1de9('0x64')](_0x1de9('0x65'));}})[_0x1de9('0x66')](function(_0x26d8a9){logger[_0x1de9('0x64')](_0x1de9('0x67'),_0x26d8a9);});};exports[_0x1de9('0x68')]=function(_0x265aba,_0x38ee09,_0x45c4e7,_0x2022d0,_0x7b4994,_0x565a70,_0x556543){var _0x2049c7,_0x5e46fd,_0x39470c,_0x5aee20;_0x565a70[_0x1de9('0x55')]=intUtil[_0x1de9('0x56')](_0x565a70['serverUrl']);_0x565a70[_0x1de9('0x4f')]=intUtil[_0x1de9('0x56')](_0x565a70['remoteUri']);if(_0x556543&&_0x556543['recordingFormat']&&_0x556543['recordingFormat']!==_0x1de9('0x69')){logger[_0x1de9('0x1c')](_0x1de9('0x6a'),_0x1de9('0x58'));_0x38ee09[_0x1de9('0x59')]=util[_0x1de9('0x3d')](_0x1de9('0x5a'),_0x565a70[_0x1de9('0x55')],_0x38ee09[_0x1de9('0x5b')],md5(_0x38ee09[_0x1de9('0x5b')]));}return getConnection(_0x565a70)[_0x1de9('0x20')](function(_0x4fd8a3){_0x5aee20=_0x4fd8a3;return getUser(_0x565a70,_0x2022d0[_0x1de9('0x5c')],_0x5aee20);})[_0x1de9('0x20')](function(_0x3ed469){_0x2049c7=_0x3ed469;return getEndUser(_0x565a70,_0x45c4e7,_0x38ee09[_0x1de9('0x6b')],_0x38ee09[_0x1de9('0x6c')],_0x5aee20);})[_0x1de9('0x20')](function(_0x440a14){_0x5e46fd=_0x440a14;return getTicket(_0x565a70,_0x2049c7,_0x5e46fd,_0x45c4e7,_0x38ee09,_0x45c4e7[_0x1de9('0x6d')],_0x5aee20,_0x1de9('0x68'));})[_0x1de9('0x20')](function(_0x323d8b){_0x39470c=_0x323d8b;logger['info'](_0x1de9('0x6e'),_0x39470c['id']);logger[_0x1de9('0x1c')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x39470c['id'],_0x2022d0[_0x1de9('0x4a')],_0x565a70[_0x1de9('0x37')]);switch(_0x565a70[_0x1de9('0x37')]){case _0x1de9('0x6f'):emit(util['format'](_0x1de9('0x5f'),_0x2022d0[_0x1de9('0x4a')]),_0x1de9('0x60'),{'recordId':_0x39470c['id']});break;case'newTab':emit(util[_0x1de9('0x3d')](_0x1de9('0x5f'),_0x2022d0[_0x1de9('0x4a')]),_0x1de9('0x62'),{'uri':util['format']('%s/%s/e',_0x5aee20[_0x1de9('0x63')],_0x39470c['id'])});break;default:logger['error'](_0x1de9('0x6a'),_0x1de9('0x70'));}})[_0x1de9('0x66')](function(_0xad8cab){logger['error']('[OUTBOUND]',_0xad8cab);});};exports['unmanaged']=function(_0x418deb,_0x4a0dea,_0x393a33,_0x2f6251,_0x2ea5d6,_0x27cbce){var _0x67017c,_0x1afdd7,_0x5a76c4,_0x730589;_0x27cbce[_0x1de9('0x55')]=intUtil['stripTrailingSlash'](_0x27cbce[_0x1de9('0x55')]);_0x27cbce[_0x1de9('0x4f')]=intUtil[_0x1de9('0x56')](_0x27cbce[_0x1de9('0x4f')]);if(_0x2ea5d6&&_0x2ea5d6['monitor_format']){logger[_0x1de9('0x1c')]('['+_0x4a0dea[_0x1de9('0x71')][_0x1de9('0x72')]()+']',_0x1de9('0x58'));_0x4a0dea[_0x1de9('0x59')]=util['format'](_0x1de9('0x5a'),_0x27cbce[_0x1de9('0x55')],_0x4a0dea[_0x1de9('0x5b')],md5(_0x4a0dea['uniqueid']));}else{_0x4a0dea[_0x1de9('0x59')]='';}return getConnection(_0x27cbce)[_0x1de9('0x20')](function(_0x4701f2){_0x730589=_0x4701f2;if(!_[_0x1de9('0x73')](_0x2f6251)){return getUser(_0x27cbce,_0x2f6251[_0x1de9('0x4a')],_0x730589);}else{return getUser(_0x27cbce,null,_0x730589);}})[_0x1de9('0x20')](function(_0x227b21){_0x67017c=_0x227b21;return getEndUser(_0x27cbce,_0x393a33,_0x4a0dea[_0x1de9('0x74')],_0x4a0dea[_0x1de9('0x5d')],_0x730589);})['then'](function(_0x18313c){_0x1afdd7=_0x18313c;return getTicket(_0x27cbce,_0x67017c,_0x1afdd7,_0x393a33,_0x4a0dea,_0x393a33['Fields'],_0x730589);})['then'](function(_0x479cc2){_0x5a76c4=_0x479cc2;logger[_0x1de9('0x1c')]('['+_0x4a0dea[_0x1de9('0x71')][_0x1de9('0x72')]()+_0x1de9('0x75'),_0x5a76c4['id']);logger[_0x1de9('0x1c')]('['+_0x4a0dea['lastevent'][_0x1de9('0x72')]()+_0x1de9('0x76'),_0x27cbce[_0x1de9('0x37')]);})[_0x1de9('0x66')](function(_0x48e0d8){logger[_0x1de9('0x64')]('['+_0x4a0dea[_0x1de9('0x71')]['toUpperCase']()+']',_0x48e0d8);});}; \ No newline at end of file +var _0x5979=['picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','catch','error','[QUEUE]','outbound','recordingFormat','none','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','calleridnum','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','socket.io-emitter','assign','getString','Subjects','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','account_contact_lead','additionalSearchAccount','Lead','Account','first','Phone','attributes','type','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','Caller\x20-\x20%s','LastName','Company','No\x20Company','format','upperFirst','forEach','string'];(function(_0x547aae,_0x50f5b1){var _0x2d61af=function(_0x1477d1){while(--_0x1477d1){_0x547aae['push'](_0x547aae['shift']());}};_0x2d61af(++_0x50f5b1);}(_0x5979,0x137));var _0x9597=function(_0x419b6a,_0x265b43){_0x419b6a=_0x419b6a-0x0;var _0x229232=_0x5979[_0x419b6a];return _0x229232;};'use strict';var _=require('lodash');var rp=require(_0x9597('0x0'));var moment=require(_0x9597('0x1'));var BPromise=require(_0x9597('0x2'));var md5=require(_0x9597('0x3'));var jsforce=require(_0x9597('0x4'));var util=require(_0x9597('0x5'));var Redis=require(_0x9597('0x6'));var intUtil=require(_0x9597('0x7'));var config=require(_0x9597('0x8'));var logger=require('../../../../config/logger')(_0x9597('0x9'));config[_0x9597('0xa')]=_[_0x9597('0xb')](config[_0x9597('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x9597('0xc'))(new Redis(config[_0x9597('0xa')]));function emit(_0xa92f93,_0x1c3a10,_0xe0fadf){io['to'](_0xa92f93)['emit'](_0x1c3a10,_0xe0fadf);}function getTicket(_0xf532f1,_0x555574,_0xea3495,_0x2221d5,_0x3ce31a,_0x2451bf,_0x43edda,_0x2d3294){var _0x2c71b0=Object[_0x9597('0xd')]({},{'OwnerId':_0x555574['id'],'Subject':intUtil[_0x9597('0xe')](_0x2221d5[_0x9597('0xf')],_0x3ce31a,'\x20'),'Description':intUtil[_0x9597('0xe')](_0x2221d5['Descriptions'],_0x3ce31a,'\x0a')},getCustomFields(_0x2451bf,_0x3ce31a));if(_0xea3495){if(_0x2221d5[_0x9597('0x10')]===_0x9597('0x11')){_0x2c71b0[_0x9597('0x12')]=moment[_0x9597('0x13')]();_0x2c71b0[_0x9597('0x14')]=![];_0x2c71b0[_0x9597('0x15')]=![];if(_0xea3495[_0x9597('0x16')]===_0x9597('0x17')||_0xea3495[_0x9597('0x16')]===_0x9597('0x18')){_0x2c71b0[_0x9597('0x19')]=_0xea3495['id'];}else if(_0xea3495[_0x9597('0x16')]===_0x9597('0x1a')){_0x2c71b0['WhatId']=_0xea3495['id'];}}else if(_0x2221d5[_0x9597('0x10')]==='Case'){if(_0xea3495[_0x9597('0x16')]===_0x9597('0x17')){_0x2c71b0[_0x9597('0x1b')]=_0xea3495['id'];}else if(_0xea3495[_0x9597('0x16')]===_0x9597('0x1a')){_0x2c71b0[_0x9597('0x1c')]=_0xea3495['id'];}else if(_0xea3495[_0x9597('0x16')]===_0x9597('0x18')&&_0x2221d5['leadId']){_0x2c71b0[_0x2221d5[_0x9597('0x1d')]]=_0xea3495['id'];}else{logger[_0x9597('0x1e')](_0x9597('0x1f'));}}}return _0x43edda[_0x9597('0x20')](_0x2221d5['ticketType'])[_0x9597('0x21')](_0x2c71b0);}function getUser(_0x726e70,_0x798240,_0x4da00b){if(!_[_0x9597('0x22')](_0x798240)&&intUtil[_0x9597('0x23')](_0x798240)){var _0x330713={'Email':_0x798240};var _0x23d91a={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4da00b[_0x9597('0x20')](_0x9597('0x24'))[_0x9597('0x25')](_0x330713,_0x23d91a)[_0x9597('0x26')]()['then'](function(_0x2e8532){if(_0x2e8532[_0x9597('0x27')]){var _0x3f0197=_[_0x9597('0x25')](_0x2e8532,function(_0x559ea6){return _0x559ea6[_0x9597('0x28')]===_0x798240;});if(_0x3f0197){logger[_0x9597('0x1e')](_0x9597('0x29'),_0x798240);return BPromise[_0x9597('0x2a')]({'id':_0x3f0197['Id'],'name':_0x3f0197[_0x9597('0x2b')]});}}else{logger[_0x9597('0x1e')](_0x9597('0x2c'),_0x798240);return _0x4da00b[_0x9597('0x2d')]()[_0x9597('0x2e')](function(_0xa2c1f0){return BPromise[_0x9597('0x2a')]({'id':_0xa2c1f0[_0x9597('0x2f')],'name':_0xa2c1f0[_0x9597('0x30')]});});}});}else{logger[_0x9597('0x1e')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x798240);return _0x4da00b[_0x9597('0x2d')]()[_0x9597('0x2e')](function(_0x416306){return BPromise[_0x9597('0x2a')]({'id':_0x416306[_0x9597('0x2f')],'name':_0x416306['display_name']});});}}function getEndUser(_0x14177d,_0x1efd33,_0x1ef02d,_0x2bd740,_0x17f804){var _0x4f059b={'$or':{'Phone':_0x2bd740}};var _0x474334={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x9597('0x2a')]()['then'](function(){logger[_0x9597('0x1e')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x2bd740,_0x1efd33[_0x9597('0x31')]);switch(_0x1efd33[_0x9597('0x31')]){case _0x9597('0x32'):var _0x36c7be=_[_0x9597('0x33')](_0x4f059b);if(_0x1efd33[_0x9597('0x34')]){var _0x5e0ae8={};_0x5e0ae8[_0x1efd33['additionalSearchContact']]=_0x2bd740;_[_0x9597('0x35')](_0x36c7be[_0x9597('0x36')],_0x5e0ae8);}return _0x17f804[_0x9597('0x20')](_0x9597('0x37'))[_0x9597('0x25')](_0x36c7be,_0x474334)[_0x9597('0x26')]()[_0x9597('0x2e')](function(_0x41efa4){if(_0x41efa4&&_0x41efa4[_0x9597('0x27')]){return _0x41efa4;}else{var _0x5b1c79=_[_0x9597('0x33')](_0x4f059b);if(_0x1efd33[_0x9597('0x38')]){var _0x2ef0bc={};_0x2ef0bc[_0x1efd33[_0x9597('0x38')]]=_0x2bd740;_[_0x9597('0x35')](_0x5b1c79[_0x9597('0x36')],_0x2ef0bc);}return _0x17f804[_0x9597('0x20')]('Lead')[_0x9597('0x25')](_0x5b1c79,_0x474334);}});case _0x9597('0x39'):var _0x2ff72f=_['cloneDeep'](_0x4f059b);if(_0x1efd33['additionalSearchAccount']){var _0x5e0ae8={};_0x5e0ae8[_0x1efd33[_0x9597('0x3a')]]=_0x2bd740;_[_0x9597('0x35')](_0x2ff72f['$or'],_0x5e0ae8);}return _0x17f804[_0x9597('0x20')]('Account')['find'](_0x2ff72f,_0x474334)['execute']()[_0x9597('0x2e')](function(_0xe97c9c){if(_0xe97c9c&&_0xe97c9c[_0x9597('0x27')]){return _0xe97c9c;}else{var _0x556fb3=_[_0x9597('0x33')](_0x4f059b);if(_0x1efd33['additionalSearchContact']){var _0x1f8857={};_0x1f8857[_0x1efd33[_0x9597('0x34')]]=_0x2bd740;_[_0x9597('0x35')](_0x556fb3[_0x9597('0x36')],_0x1f8857);}return _0x17f804[_0x9597('0x20')](_0x9597('0x37'))['find'](_0x556fb3,_0x474334)[_0x9597('0x2e')](function(_0x2d4b77){if(_0x2d4b77&&_0x2d4b77[_0x9597('0x27')]){return _0x2d4b77;}else{var _0xd9804d=_[_0x9597('0x33')](_0x4f059b);if(_0x1efd33[_0x9597('0x38')]){var _0x131ec2={};_0x131ec2[_0x1efd33[_0x9597('0x38')]]=_0x2bd740;_[_0x9597('0x35')](_0xd9804d[_0x9597('0x36')],_0x131ec2);}return _0x17f804[_0x9597('0x20')]('Lead')['find'](_0xd9804d,_0x474334);}});}});case _0x9597('0x17'):var _0x36c7be=_[_0x9597('0x33')](_0x4f059b);if(_0x1efd33[_0x9597('0x34')]){var _0x5e0ae8={};_0x5e0ae8[_0x1efd33[_0x9597('0x34')]]=_0x2bd740;_[_0x9597('0x35')](_0x36c7be[_0x9597('0x36')],_0x5e0ae8);}return _0x17f804[_0x9597('0x20')](_0x9597('0x37'))['find'](_0x36c7be,_0x474334)[_0x9597('0x26')]();case _0x9597('0x18'):var _0x59e016=_[_0x9597('0x33')](_0x4f059b);if(_0x1efd33[_0x9597('0x38')]){var _0x5e0ae8={};_0x5e0ae8[_0x1efd33[_0x9597('0x38')]]=_0x2bd740;_[_0x9597('0x35')](_0x59e016[_0x9597('0x36')],_0x5e0ae8);}return _0x17f804[_0x9597('0x20')](_0x9597('0x3b'))[_0x9597('0x25')](_0x59e016,_0x474334);case'account':var _0x2ff72f=_[_0x9597('0x33')](_0x4f059b);if(_0x1efd33[_0x9597('0x3a')]){var _0x5e0ae8={};_0x5e0ae8[_0x1efd33[_0x9597('0x3a')]]=_0x2bd740;_[_0x9597('0x35')](_0x2ff72f[_0x9597('0x36')],_0x5e0ae8);}return _0x17f804[_0x9597('0x20')](_0x9597('0x3c'))[_0x9597('0x25')](_0x2ff72f,_0x474334);default:return null;}})[_0x9597('0x2e')](function(_0x5bd3a5){if(_0x5bd3a5&&_0x5bd3a5['length']){var _0x4bf2d3=_[_0x9597('0x3d')](_0x5bd3a5);if(_0x4bf2d3){return BPromise[_0x9597('0x2a')]({'id':_0x4bf2d3['Id'],'name':_0x4bf2d3[_0x9597('0x2b')],'phone':_0x4bf2d3[_0x9597('0x3e')],'endUserType':_0x4bf2d3[_0x9597('0x3f')][_0x9597('0x40')]['toLowerCase']()});}}})[_0x9597('0x2e')](function(_0x203e90){if(_0x203e90){logger[_0x9597('0x1e')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x203e90[_0x9597('0x16')],_0x2bd740);return BPromise['resolve'](_0x203e90);}else{logger[_0x9597('0x1e')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x2bd740);var _0x5c2402={'Phone':_0x2bd740};if(_0x1efd33[_0x9597('0x41')]){if(_0x1efd33['moduleCreate']===_0x9597('0x17')){logger[_0x9597('0x1e')](_0x9597('0x42'),_0x2bd740,_0x1efd33['moduleCreate']);_0x5c2402['LastName']=_0x1ef02d!==_0x9597('0x43')?_0x1ef02d:util['format'](_0x9597('0x44'),_0x2bd740);}else if(_0x1efd33[_0x9597('0x41')]==='lead'){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x2bd740,_0x1efd33[_0x9597('0x41')]);_0x5c2402[_0x9597('0x45')]=_0x1ef02d!==_0x9597('0x43')?_0x1ef02d:util['format']('Caller\x20-\x20%s',_0x2bd740);_0x5c2402[_0x9597('0x46')]=_0x9597('0x47');}else if(_0x1efd33[_0x9597('0x41')]==='account'){logger[_0x9597('0x1e')](_0x9597('0x42'),_0x2bd740,_0x1efd33[_0x9597('0x41')]);_0x5c2402[_0x9597('0x2b')]=_0x1ef02d!==_0x9597('0x43')?_0x1ef02d:util[_0x9597('0x48')](_0x9597('0x44'),_0x2bd740);}else{return null;}}return _0x17f804[_0x9597('0x20')](_[_0x9597('0x49')](_0x1efd33[_0x9597('0x41')]))['create'](_0x5c2402)[_0x9597('0x2e')](function(_0x28b437){return BPromise[_0x9597('0x2a')]({'id':_0x28b437['id'],'endUserType':_0x1efd33[_0x9597('0x41')]});});}});}function getCustomFields(_0x324a3c,_0x3ed1f4){var _0x1847e6={};if(_0x324a3c[_0x9597('0x27')]>0x0){_[_0x9597('0x4a')](_0x324a3c,function(_0x253f88){if(_['includes']([_0x9597('0x4b'),_0x9597('0x4c')],_0x253f88[_0x9597('0x40')])&&_0x253f88[_0x9597('0x4d')]){_0x1847e6[_0x253f88[_0x9597('0x4d')]]=_0x253f88[_0x9597('0x4e')][_0x9597('0x4f')]();}else if(_0x253f88['type']===_0x9597('0x50')&&_0x253f88[_0x9597('0x51')]&&_0x253f88['idField']){_0x3ed1f4[_0x253f88[_0x9597('0x51')]]&&(_0x1847e6[_0x253f88['idField']]=_0x3ed1f4[_0x253f88[_0x9597('0x51')]][_0x9597('0x4f')]());}else if(_0x253f88[_0x9597('0x40')]===_0x9597('0x52')&&_0x253f88[_0x9597('0x53')]&&_0x253f88[_0x9597('0x53')][_0x9597('0x54')]&&_0x253f88['idField']){_0x3ed1f4[_0x253f88['Variable'][_0x9597('0x54')]['toLowerCase']()]&&(_0x1847e6[_0x253f88[_0x9597('0x4d')]]=_0x3ed1f4[_0x253f88['Variable']['name']['toLowerCase']()][_0x9597('0x4f')]());}});}return _0x1847e6;}function getConnection(_0x3c2c48){var _0x22978d=_0x3c2c48[_0x9597('0x55')][_0x9597('0x56')](_0x3c2c48[_0x9597('0x57')]);var _0x2b8454=new jsforce[(_0x9597('0x58'))]({'oauth2':{'loginUrl':_0x3c2c48[_0x9597('0x59')]||_0x9597('0x5a'),'clientId':_0x3c2c48[_0x9597('0x5b')],'clientSecret':_0x3c2c48[_0x9597('0x5c')]}});return _0x2b8454[_0x9597('0x5d')](_0x3c2c48['username'],_0x22978d)[_0x9597('0x2e')](function(){logger[_0x9597('0x1e')](_0x9597('0x5e'));return _0x2b8454;});}exports[_0x9597('0x5f')]=function(_0x349fdc,_0x4458a0,_0x28db0f,_0x5f118a,_0x46f571,_0x299b33){var _0x2162a6,_0x263f96,_0x428c55,_0xef8b5f;_0x299b33[_0x9597('0x60')]=intUtil[_0x9597('0x61')](_0x299b33[_0x9597('0x60')]);_0x299b33[_0x9597('0x59')]=intUtil['stripTrailingSlash'](_0x299b33[_0x9597('0x59')]);if(_0x46f571&&_0x46f571[_0x9597('0x62')]){logger[_0x9597('0x1e')]('[QUEUE]',_0x9597('0x63'));_0x4458a0['recordingURL']=util[_0x9597('0x48')](_0x9597('0x64'),_0x299b33['serverUrl'],_0x4458a0[_0x9597('0x65')],md5(_0x4458a0['uniqueid']));}else{_0x4458a0[_0x9597('0x66')]='';}return getConnection(_0x299b33)[_0x9597('0x2e')](function(_0x410ac3){_0xef8b5f=_0x410ac3;return getUser(_0x299b33,_0x5f118a[_0x9597('0x67')],_0xef8b5f);})[_0x9597('0x2e')](function(_0x476b16){_0x2162a6=_0x476b16;return getEndUser(_0x299b33,_0x28db0f,_0x4458a0[_0x9597('0x68')],_0x4458a0['calleridnum'],_0xef8b5f);})['then'](function(_0x41e9c0){_0x263f96=_0x41e9c0;return getTicket(_0x299b33,_0x2162a6,_0x263f96,_0x28db0f,_0x4458a0,_0x28db0f[_0x9597('0x69')],_0xef8b5f,_0x9597('0x5f'));})[_0x9597('0x2e')](function(_0x5de754){_0x428c55=_0x5de754;logger[_0x9597('0x1e')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x428c55['id']);logger[_0x9597('0x1e')](_0x9597('0x6a'),_0x428c55['id'],_0x5f118a[_0x9597('0x54')],_0x299b33[_0x9597('0x40')]);switch(_0x299b33[_0x9597('0x40')]){case _0x9597('0x6b'):emit(util[_0x9597('0x48')](_0x9597('0x6c'),_0x5f118a[_0x9597('0x54')]),_0x9597('0x6d'),{'recordId':_0x428c55['id']});break;case'newTab':emit(util[_0x9597('0x48')](_0x9597('0x6c'),_0x5f118a['name']),_0x9597('0x6e'),{'uri':util[_0x9597('0x48')](_0x9597('0x6f'),_0xef8b5f[_0x9597('0x70')],_0x428c55['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x9597('0x71')](function(_0x4b801f){logger[_0x9597('0x72')](_0x9597('0x73'),_0x4b801f);});};exports[_0x9597('0x74')]=function(_0xf5dab6,_0x4ee318,_0x14f295,_0x2d7983,_0x23a7d3,_0x2e7bfd,_0x3f4575){var _0x4eb8dc,_0x5544ea,_0x4582d3,_0x2f99e8;_0x2e7bfd['serverUrl']=intUtil[_0x9597('0x61')](_0x2e7bfd[_0x9597('0x60')]);_0x2e7bfd['remoteUri']=intUtil[_0x9597('0x61')](_0x2e7bfd[_0x9597('0x59')]);if(_0x3f4575&&_0x3f4575[_0x9597('0x75')]&&_0x3f4575[_0x9597('0x75')]!==_0x9597('0x76')){logger[_0x9597('0x1e')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4ee318[_0x9597('0x66')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2e7bfd[_0x9597('0x60')],_0x4ee318[_0x9597('0x65')],md5(_0x4ee318[_0x9597('0x65')]));}return getConnection(_0x2e7bfd)[_0x9597('0x2e')](function(_0x301a9a){_0x2f99e8=_0x301a9a;return getUser(_0x2e7bfd,_0x2d7983[_0x9597('0x67')],_0x2f99e8);})['then'](function(_0x5b9558){_0x4eb8dc=_0x5b9558;return getEndUser(_0x2e7bfd,_0x14f295,_0x4ee318['destcalleridname'],_0x4ee318[_0x9597('0x77')],_0x2f99e8);})[_0x9597('0x2e')](function(_0x5ce3e7){_0x5544ea=_0x5ce3e7;return getTicket(_0x2e7bfd,_0x4eb8dc,_0x5544ea,_0x14f295,_0x4ee318,_0x14f295[_0x9597('0x69')],_0x2f99e8,_0x9597('0x74'));})['then'](function(_0x11a39f){_0x4582d3=_0x11a39f;logger[_0x9597('0x1e')](_0x9597('0x78'),_0x4582d3['id']);logger[_0x9597('0x1e')](_0x9597('0x79'),_0x4582d3['id'],_0x2d7983[_0x9597('0x54')],_0x2e7bfd['type']);switch(_0x2e7bfd[_0x9597('0x40')]){case _0x9597('0x6b'):emit(util[_0x9597('0x48')](_0x9597('0x6c'),_0x2d7983[_0x9597('0x54')]),_0x9597('0x6d'),{'recordId':_0x4582d3['id']});break;case'newTab':emit(util[_0x9597('0x48')](_0x9597('0x6c'),_0x2d7983[_0x9597('0x54')]),_0x9597('0x6e'),{'uri':util[_0x9597('0x48')](_0x9597('0x6f'),_0x2f99e8[_0x9597('0x70')],_0x4582d3['id'])});break;default:logger[_0x9597('0x72')](_0x9597('0x7a'),_0x9597('0x7b'));}})[_0x9597('0x71')](function(_0x362d40){logger['error'](_0x9597('0x7a'),_0x362d40);});};exports['unmanaged']=function(_0x2bce29,_0x42f251,_0x66d3f9,_0x4741f8,_0x8bee14,_0x2604ae){var _0x553dee,_0x2abb75,_0x3bbecf,_0x373391;_0x2604ae['serverUrl']=intUtil[_0x9597('0x61')](_0x2604ae[_0x9597('0x60')]);_0x2604ae[_0x9597('0x59')]=intUtil[_0x9597('0x61')](_0x2604ae[_0x9597('0x59')]);if(_0x8bee14&&_0x8bee14[_0x9597('0x62')]){logger[_0x9597('0x1e')]('['+_0x42f251[_0x9597('0x7c')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x42f251[_0x9597('0x66')]=util[_0x9597('0x48')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2604ae['serverUrl'],_0x42f251[_0x9597('0x65')],md5(_0x42f251['uniqueid']));}else{_0x42f251[_0x9597('0x66')]='';}return getConnection(_0x2604ae)[_0x9597('0x2e')](function(_0x17b40f){_0x373391=_0x17b40f;if(!_[_0x9597('0x22')](_0x4741f8)){return getUser(_0x2604ae,_0x4741f8[_0x9597('0x54')],_0x373391);}else{return getUser(_0x2604ae,null,_0x373391);}})[_0x9597('0x2e')](function(_0x2b96b1){_0x553dee=_0x2b96b1;return getEndUser(_0x2604ae,_0x66d3f9,_0x42f251['calleridname'],_0x42f251[_0x9597('0x7d')],_0x373391);})[_0x9597('0x2e')](function(_0x1727bf){_0x2abb75=_0x1727bf;return getTicket(_0x2604ae,_0x553dee,_0x2abb75,_0x66d3f9,_0x42f251,_0x66d3f9[_0x9597('0x69')],_0x373391);})[_0x9597('0x2e')](function(_0x5a2f89){_0x3bbecf=_0x5a2f89;logger[_0x9597('0x1e')]('['+_0x42f251[_0x9597('0x7c')][_0x9597('0x7e')]()+_0x9597('0x7f'),_0x3bbecf['id']);logger[_0x9597('0x1e')]('['+_0x42f251[_0x9597('0x7c')]['toUpperCase']()+_0x9597('0x80'),_0x2604ae[_0x9597('0x40')]);})['catch'](function(_0x3799b5){logger[_0x9597('0x72')]('['+_0x42f251['lastevent'][_0x9597('0x7e')]()+']',_0x3799b5);});}; \ 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 cb2a3b4..d89d3ab 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 _0xcf32=['Variable','name',']\x20getTicket\x20input\x20crm','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','incident',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','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','ioredis','./util','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','catch','error','toUpperCase','message','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','active','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','content','idField','toLowerCase','toString','variableName','customVariable'];(function(_0x37358a,_0x4f1d21){var _0x511fbc=function(_0x5e6b75){while(--_0x5e6b75){_0x37358a['push'](_0x37358a['shift']());}};_0x511fbc(++_0x4f1d21);}(_0xcf32,0xa0));var _0x2cf3=function(_0xe2ebaa,_0x138483){_0xe2ebaa=_0xe2ebaa-0x0;var _0x563838=_0xcf32[_0xe2ebaa];return _0x563838;};'use strict';var _=require(_0x2cf3('0x0'));var Promise=require(_0x2cf3('0x1'));var rp=require(_0x2cf3('0x2'));var util=require('util');var md5=require('md5');var Redis=require(_0x2cf3('0x3'));var intUtil=require(_0x2cf3('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('servicenow');config[_0x2cf3('0x5')]=_[_0x2cf3('0x6')](config[_0x2cf3('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x2cf3('0x7'))(new Redis(config[_0x2cf3('0x5')]));function getAdminUser(_0x5aaccf,_0x483a35,_0x156b36,_0x4a110c,_0x3ed89e,_0x36d98b){return new Promise(function(_0x442a6b,_0xa611ba){var _0x50c0ba={'method':_0x2cf3('0x8'),'uri':_0x4a110c+_0x2cf3('0x9')+'&'+_0x3ed89e+'&'+_0x36d98b,'auth':_0x483a35,'json':!![]};return rp(_0x50c0ba)[_0x2cf3('0xa')](function(_0x2a72f9){if(_0x2a72f9[_0x2cf3('0xb')][_0x2cf3('0xc')]>0x0){_0x156b36[_0x2cf3('0xd')]=_0x2a72f9[_0x2cf3('0xb')][0x0][_0x2cf3('0xe')];}logger[_0x2cf3('0xf')]('['+[_0x5aaccf['toUpperCase']()]+'],\x20getAdminUser\x20crm',_0x156b36);_0x442a6b(_0x156b36);})[_0x2cf3('0x10')](function(_0x401eed){logger[_0x2cf3('0x11')]('['+[_0x5aaccf[_0x2cf3('0x12')]()]+']',_0x401eed[_0x2cf3('0x13')]);_0xa611ba(_0x401eed[_0x2cf3('0x13')]);});});}function getUser(_0x1587b9,_0x640792,_0x133f56,_0x12c230,_0x4c64fc){return function(_0x458c11){logger[_0x2cf3('0xf')]('['+[_0x1587b9[_0x2cf3('0x12')]()]+_0x2cf3('0x14'),_0x458c11);return new Promise(function(_0x31059a,_0x4a60c0){if(intUtil['validateEmail'](_0x458c11[_0x2cf3('0x15')])){var _0x4a7e35={'method':_0x2cf3('0x8'),'uri':_0x133f56+_0x2cf3('0x16')+_0x458c11[_0x2cf3('0x15')]+'&'+_0x12c230+'&'+_0x4c64fc,'auth':_0x640792,'json':!![]};logger[_0x2cf3('0xf')]('['+[_0x1587b9['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0x4a7e35);return rp(_0x4a7e35)['then'](function(_0x232533){logger[_0x2cf3('0xf')]('['+[_0x1587b9[_0x2cf3('0x12')]()]+_0x2cf3('0x17'),_0x232533);if(_0x232533[_0x2cf3('0xb')]['length']>0x0&&String(_0x232533[_0x2cf3('0xb')][0x0][_0x2cf3('0x18')])==='true'){_0x458c11[_0x2cf3('0x19')]=_0x232533[_0x2cf3('0xb')][0x0][_0x2cf3('0xe')];}else{_0x458c11['userId']=_0x458c11[_0x2cf3('0xd')];_0x458c11['userEmail']=_0x458c11[_0x2cf3('0x1a')];}logger['info']('['+[_0x1587b9[_0x2cf3('0x12')]()]+_0x2cf3('0x1b'),_0x458c11);_0x31059a(_0x458c11);})['catch'](function(_0x2930ef){logger[_0x2cf3('0x11')]('['+[_0x1587b9[_0x2cf3('0x12')]()]+']',_0x2930ef['message']);_0x4a60c0(_0x2930ef['message']);});}else{logger[_0x2cf3('0xf')]('['+[_0x1587b9[_0x2cf3('0x12')]()]+_0x2cf3('0x1c'));_0x458c11[_0x2cf3('0x19')]=_0x458c11['adminId'];_0x458c11[_0x2cf3('0x15')]=_0x458c11['adminEmail'];_0x31059a(_0x458c11);}});};}function createEndUser(_0x7711ff,_0x2f507d,_0x4096b8,_0x5a7470,_0x1fe902){logger[_0x2cf3('0xf')]('['+[_0x7711ff['toUpperCase']()]+_0x2cf3('0x1d'),_0x4096b8);return new Promise(function(_0x1215e1,_0x57f9a2){var _0x1bb6d2={'method':_0x2cf3('0x1e'),'uri':_0x5a7470+_0x2cf3('0x1f')+_0x1fe902,'body':{'user_name':_0x4096b8['endUserNumber'],'roles':_0x2cf3('0x20'),'first_name':_0x4096b8[_0x2cf3('0x21')],'active':_0x2cf3('0x22'),'date_format':_0x2cf3('0x23'),'phone':_0x4096b8['endUserNumber']},'auth':_0x2f507d,'json':!![]};return rp(_0x1bb6d2)[_0x2cf3('0xa')](function(_0x499fc1){logger[_0x2cf3('0xf')]('['+[_0x7711ff[_0x2cf3('0x12')]()]+_0x2cf3('0x24'),_0x499fc1[_0x2cf3('0xb')]);_0x4096b8[_0x2cf3('0x25')]=_0x499fc1['result'][_0x2cf3('0xe')];_0x1215e1(_0x4096b8);})['catch'](function(_0x3e0cfa){logger[_0x2cf3('0x11')]('['+[_0x7711ff[_0x2cf3('0x12')]()]+']',_0x3e0cfa[_0x2cf3('0x13')]);_0x57f9a2(_0x3e0cfa[_0x2cf3('0x13')]);});});}function getEndUser(_0x21a6b2,_0x270241,_0x47a3e7,_0x5dfcea,_0x58ac29){return function(_0x1d8b96){logger[_0x2cf3('0xf')]('['+[_0x21a6b2[_0x2cf3('0x12')]()]+_0x2cf3('0x26'),_0x1d8b96);return new Promise(function(_0x132318,_0x3472ae){var _0x5ebe5b={'method':_0x2cf3('0x8'),'uri':_0x47a3e7+'sys_user?sysparm_query=phone%3D'+_0x1d8b96['endUserNumber']+'&'+_0x5dfcea+'&'+_0x58ac29,'auth':_0x270241,'json':!![]};return rp(_0x5ebe5b)[_0x2cf3('0xa')](function(_0x182de8){if(_0x182de8[_0x2cf3('0xb')][_0x2cf3('0xc')]>0x0){_0x1d8b96['endUserId']=_0x182de8['result'][0x0][_0x2cf3('0xe')];logger[_0x2cf3('0xf')]('['+[_0x21a6b2[_0x2cf3('0x12')]()]+_0x2cf3('0x27'),_0x1d8b96);_0x132318(_0x1d8b96);}else{return createEndUser(_0x21a6b2,_0x270241,_0x1d8b96,_0x47a3e7,_0x5dfcea)[_0x2cf3('0xa')](function(_0x1ac252){logger[_0x2cf3('0xf')]('['+[_0x21a6b2[_0x2cf3('0x12')]()]+_0x2cf3('0x28'),_0x1ac252);_0x132318(_0x1ac252);});}})[_0x2cf3('0x10')](function(_0x37ece0){logger[_0x2cf3('0x11')]('['+[_0x21a6b2[_0x2cf3('0x12')]()]+']',_0x37ece0['message']);_0x3472ae(_0x37ece0['message']);});});};}function getCustomFields(_0x4607bc,_0x37e487){var _0x49efba={};if(_0x4607bc['length']>0x0){_[_0x2cf3('0x29')](_0x4607bc,function(_0x1b6846){if(_[_0x2cf3('0x2a')]([_0x2cf3('0x2b'),_0x2cf3('0x2c')],_0x1b6846[_0x2cf3('0x2d')])&&_0x1b6846[_0x2cf3('0x2e')]&&!_0x1b6846[_0x2cf3('0x2f')]){_0x49efba[_0x1b6846[_0x2cf3('0x2e')]['toLowerCase']()]=_0x1b6846[_0x2cf3('0x30')]['toString']();}else if(_[_0x2cf3('0x2a')]([_0x2cf3('0x2b'),_0x2cf3('0x2c')],_0x1b6846[_0x2cf3('0x2d')])&&_0x1b6846[_0x2cf3('0x31')]&&_0x1b6846['customField']){_0x49efba[_0x1b6846['idField'][_0x2cf3('0x32')]()]=_0x1b6846[_0x2cf3('0x30')][_0x2cf3('0x33')]();}else if(_0x1b6846[_0x2cf3('0x2d')]==='variable'&&_0x1b6846[_0x2cf3('0x34')]&&_0x1b6846[_0x2cf3('0x31')]&&_0x1b6846[_0x2cf3('0x2f')]){_0x49efba[_0x1b6846['idField'][_0x2cf3('0x32')]()]=_0x37e487[_0x1b6846[_0x2cf3('0x34')]][_0x2cf3('0x33')]();}else if(_0x1b6846['type']===_0x2cf3('0x35')&&_0x1b6846['Variable']&&_0x1b6846[_0x2cf3('0x36')][_0x2cf3('0x37')]&&_0x1b6846[_0x2cf3('0x31')]&&_0x1b6846[_0x2cf3('0x2f')]){_0x49efba[_0x1b6846['idField'][_0x2cf3('0x32')]()]=_0x37e487[_0x1b6846['Variable'][_0x2cf3('0x37')]['toLowerCase']()][_0x2cf3('0x33')]();}});}return _0x49efba;}function getTicket(_0x3b8642,_0x19dea3,_0x1aa90b,_0x1c5402,_0x31ef6e,_0x593ddd){return function(_0x596c31){logger[_0x2cf3('0xf')]('['+[_0x3b8642[_0x2cf3('0x12')]()]+_0x2cf3('0x38'),_0x596c31);return new Promise(function(_0x26010c,_0xee82f3){var _0x3c6775=_0x3b8642[_0x2cf3('0x32')]()==='outbound'?_0x596c31[_0x2cf3('0x19')]:_0x596c31[_0x2cf3('0x25')];var _0x5c19a6={'method':_0x2cf3('0x1e'),'uri':_0x1aa90b+'incident'+'?'+_0x593ddd,'body':Object[_0x2cf3('0x39')]({},{'active':_0x2cf3('0x22'),'caller_id':_0x3c6775,'assigned_to':_0x596c31[_0x2cf3('0x19')],'short_description':intUtil[_0x2cf3('0x3a')](_0x1c5402[_0x2cf3('0x3b')],_0x31ef6e,'\x20'),'description':intUtil[_0x2cf3('0x3a')](_0x1c5402[_0x2cf3('0x3c')],_0x31ef6e,'\x0a')},getCustomFields(_0x1c5402[_0x2cf3('0x3d')],_0x31ef6e)),'auth':_0x19dea3,'json':!![]};return rp(_0x5c19a6)[_0x2cf3('0xa')](function(_0x48ccb6){logger[_0x2cf3('0xf')]('['+[_0x3b8642['toUpperCase']()]+_0x2cf3('0x3e'),_0x48ccb6[_0x2cf3('0xb')]);_0x596c31[_0x2cf3('0x3f')]=_0x48ccb6['result']['sys_id'];_0x596c31[_0x2cf3('0x40')]=_0x48ccb6[_0x2cf3('0xb')][_0x2cf3('0x41')];logger['info']('['+[_0x3b8642[_0x2cf3('0x12')]()]+_0x2cf3('0x42'),_0x596c31);_0x26010c(_0x596c31);})['catch'](function(_0x1ab859){logger[_0x2cf3('0x11')]('['+[_0x3b8642['toUpperCase']()]+']',_0x1ab859[_0x2cf3('0x13')]);_0xee82f3(_0x1ab859['message']);});});};}function createRemoteTag(_0x2ac68c,_0x3e526a,_0x2ccb08,_0x28004f){return new Promise(function(_0x452079,_0xdf37ba){var _0x2e90c2={'method':_0x2cf3('0x1e'),'uri':_0x2ccb08+_0x2cf3('0x43')+'?'+_0x28004f,'body':{'short_description':_0x2ac68c,'global':!![],'active':!![],'name':_0x2ac68c},'auth':_0x3e526a,'json':!![]};return rp(_0x2e90c2)[_0x2cf3('0xa')](function(_0x5793ba){var _0x337e6b=_0x5793ba[_0x2cf3('0xb')][_0x2cf3('0xe')];_0x452079(_0x337e6b);});});}function getRemoteTag(_0x57ca19,_0x38e509,_0x50c448,_0x241b58,_0x9dac19){return new Promise(function(_0x51bb2e,_0x22e5e2){var _0x5e0ffc={'method':_0x2cf3('0x8'),'uri':_0x50c448+_0x2cf3('0x43')+'?sysparm_query=name%3D'+_0x57ca19+'&'+_0x241b58,'auth':_0x38e509,'json':!![]};return rp(_0x5e0ffc)[_0x2cf3('0xa')](function(_0x3f6ea3){if(_0x3f6ea3[_0x2cf3('0xb')][_0x2cf3('0xc')]>0x0){var _0x1bc72a=_0x3f6ea3[_0x2cf3('0xb')][0x0][_0x2cf3('0xe')];_0x51bb2e(_0x1bc72a);}else{return createRemoteTag(_0x57ca19,_0x38e509,_0x50c448,_0x241b58)['then'](function(_0x3ff504){_0x51bb2e(_0x3ff504);});}});});}function assignTagToIncident(_0x4ecaa0,_0x38559e,_0x5b561f,_0x2a4002,_0x3618aa){return new Promise(function(_0x2d7686,_0x5e6382){var _0x21bfc8={'method':_0x2cf3('0x1e'),'uri':_0x5b561f+_0x2cf3('0x44')+'?'+_0x3618aa,'body':{'label':_0x4ecaa0,'table':_0x2cf3('0x45'),'id_type':'Incident','table_key':_0x2a4002[_0x2cf3('0x3f')],'title':'Incident\x20-\x20'+_0x2a4002[_0x2cf3('0x40')],'id_display':_0x2a4002[_0x2cf3('0x40')]},'auth':_0x38559e,'json':!![]};return rp(_0x21bfc8)['then'](function(_0x3c63df){_0x2d7686();})[_0x2cf3('0x10')](function(){_0x2d7686();});});}function manageTags(_0x580cce,_0x449ab9,_0x278c6d,_0x535e1f,_0x59adbb,_0x5a2d6d,_0x5d19a5){return new Promise(function(_0x252f31,_0x2f22a7){var _0x19df39=[];_0x449ab9['forEach'](function(_0x2a09be){_0x19df39['push'](getRemoteTag(_0x2a09be,_0x278c6d,_0x535e1f,_0x5a2d6d,_0x5d19a5));});return Promise['all'](_0x19df39)[_0x2cf3('0xa')](function(_0x29f1f8){if(_0x29f1f8[_0x2cf3('0xc')]){logger[_0x2cf3('0xf')]('['+[_0x580cce[_0x2cf3('0x12')]()]+_0x2cf3('0x46'),_0x29f1f8);var _0xb80ac9=[];_0x29f1f8['forEach'](function(_0x43a0a8){_0xb80ac9['push'](assignTagToIncident(_0x43a0a8,_0x278c6d,_0x535e1f,_0x59adbb,_0x5a2d6d));});return Promise[_0x2cf3('0x47')](_0xb80ac9)['then'](function(){_0x252f31();})[_0x2cf3('0x10')](function(){_0x252f31();});}else{_0x252f31();}});});}function getTags(_0x4b3e44,_0x5c6aaf,_0x100d22,_0x59b9e6,_0x5ccb72,_0x56ae19){return function(_0xaaacc2){return new Promise(function(_0xa69414,_0x4ef29d){var _0x3c5a69=[];var _0x23c7f8=_0x59b9e6[_0x2cf3('0x48')];if(_0x23c7f8&&_0x23c7f8[_0x2cf3('0xc')]>0x0){_0x3c5a69=_[_0x2cf3('0x49')](_0x23c7f8,_0x2cf3('0x37'));}if(_0x3c5a69[_0x2cf3('0xc')]>0x0){return manageTags(_0x4b3e44,_0x3c5a69,_0x5c6aaf,_0x100d22,_0xaaacc2,_0x5ccb72,_0x56ae19)[_0x2cf3('0xa')](function(){_0xa69414(_0xaaacc2);});}else{_0xa69414(_0xaaacc2);}});};}function emit(_0x484d97,_0x275e9c,_0x521d59){var _0x584002=_0x2cf3('0x4a')+_0x2cf3('0x4b')+_0x2cf3('0x4c')+_0x2cf3('0x4d');var _0x51eb97={'uri':_0x484d97+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x521d59+_0x584002};io['to'](util[_0x2cf3('0x4e')]('user:%s',_0x275e9c))['emit'](_0x2cf3('0x4f'),_0x51eb97);}exports['cs']=function(_0x15af3e,_0x3e84b7,_0x3f97dd,_0x33964b,_0x27c45d,_0x1e9314,_0xebbad5,_0x30e9a0){var _0x12af2b={};var _0x5459b5={'user':_0x1e9314[_0x2cf3('0x50')],'pass':_0x1e9314[_0x2cf3('0x51')]};var _0x278038=_0x2cf3('0x52');var _0x1ceac4=_0x2cf3('0x53');_0x1e9314[_0x2cf3('0x54')]=intUtil[_0x2cf3('0x55')](_0x1e9314[_0x2cf3('0x54')]);_0x1e9314[_0x2cf3('0x56')]=intUtil[_0x2cf3('0x55')](_0x1e9314[_0x2cf3('0x56')]);var _0x2bc911=util['format'](_0x2cf3('0x57'),_0x1e9314[_0x2cf3('0x54')]);_0x12af2b[_0x2cf3('0x15')]=!_[_0x2cf3('0x58')](_0x33964b)?_0x33964b[_0x2cf3('0x59')]:null;_0x12af2b[_0x2cf3('0x1a')]=_0x1e9314[_0x2cf3('0x59')];_0x12af2b['endUserNumber']=_0x30e9a0[_0x2cf3('0x32')]()===_0x2cf3('0x5a')?_0x3e84b7[_0x2cf3('0x5b')]:_0x3e84b7[_0x2cf3('0x5c')];_0x12af2b[_0x2cf3('0x5d')]=_0x30e9a0===_0x2cf3('0x5e')||_0x30e9a0===_0x2cf3('0x5f')?_0x2cf3('0x5e'):_0x2cf3('0x5a');var _0x5c5b4c=util[_0x2cf3('0x4e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1e9314[_0x2cf3('0x56')],_0x3e84b7[_0x2cf3('0x60')],md5(_0x3e84b7[_0x2cf3('0x60')]));if(_0x27c45d&&_0x27c45d[_0x2cf3('0x61')]){logger[_0x2cf3('0xf')](_0x2cf3('0x62'),_0x2cf3('0x63'));_0x3e84b7[_0x2cf3('0x64')]=_0x5c5b4c;}else if(_0xebbad5&&_0xebbad5['recordingFormat']&&_0xebbad5[_0x2cf3('0x65')]!==_0x2cf3('0x66')){logger[_0x2cf3('0xf')]('[OUTBOUND]',_0x2cf3('0x63'));_0x3e84b7[_0x2cf3('0x64')]=_0x5c5b4c;}else{_0x3e84b7[_0x2cf3('0x64')]='';}return getAdminUser(_0x30e9a0,_0x5459b5,_0x12af2b,_0x2bc911,_0x1ceac4,_0x278038)[_0x2cf3('0xa')](getUser(_0x30e9a0,_0x5459b5,_0x2bc911,_0x1ceac4,_0x278038))[_0x2cf3('0xa')](getEndUser(_0x30e9a0,_0x5459b5,_0x2bc911,_0x1ceac4,_0x278038))[_0x2cf3('0xa')](getTicket(_0x30e9a0,_0x5459b5,_0x2bc911,_0x3f97dd,_0x3e84b7,_0x1ceac4))[_0x2cf3('0xa')](function(_0x3a694a){logger[_0x2cf3('0xf')](util[_0x2cf3('0x4e')]('The\x20ticket\x20ID\x20is:\x20%s',_0x3a694a[_0x2cf3('0x3f')]));logger[_0x2cf3('0xf')](util['format'](_0x2cf3('0x67'),_0x30e9a0));if(_0x30e9a0!==_0x2cf3('0x5f')){logger[_0x2cf3('0xf')]('['+[_0x30e9a0[_0x2cf3('0x12')]()]+']',_0x2cf3('0x68'));emit(_0x1e9314['remoteUri'],_0x33964b[_0x2cf3('0x37')],_0x3a694a[_0x2cf3('0x3f')]);}})[_0x2cf3('0x10')](function(_0x160b84){logger[_0x2cf3('0x11')]('['+[_0x30e9a0[_0x2cf3('0x12')]()]+_0x2cf3('0x69'),util[_0x2cf3('0x6a')](_0x160b84,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x903c=['monitor_format','[QUEUE]','recordingURL','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','socket.io-emitter','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','sys_user?','user','System','endUserNumber','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','includes','string','picklist','type','nameField','content','toString','idField','customField','toLowerCase','variable','variableName','customVariable','Variable','name','outbound','POST','incident','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','GET','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','format','%s/api/now/table/','isNil','email','destcalleridnum','callDirection','queue','unmanaged','uniqueid'];(function(_0x392350,_0x34b94f){var _0x755a63=function(_0x466ff0){while(--_0x466ff0){_0x392350['push'](_0x392350['shift']());}};_0x755a63(++_0x34b94f);}(_0x903c,0x1c6));var _0xc903=function(_0x5210c7,_0x37ec2f){_0x5210c7=_0x5210c7-0x0;var _0x5ccdea=_0x903c[_0x5210c7];return _0x5ccdea;};'use strict';var _=require(_0xc903('0x0'));var Promise=require('bluebird');var rp=require('request-promise');var util=require(_0xc903('0x1'));var md5=require(_0xc903('0x2'));var Redis=require(_0xc903('0x3'));var intUtil=require(_0xc903('0x4'));var config=require(_0xc903('0x5'));var logger=require(_0xc903('0x6'))(_0xc903('0x7'));config[_0xc903('0x8')]=_['defaults'](config[_0xc903('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xc903('0x9'))(new Redis(config[_0xc903('0x8')]));function getAdminUser(_0x3e7280,_0x362528,_0x16fe34,_0x479b4e,_0x3d9c71,_0x1fbb0d){return new Promise(function(_0x32467a,_0x4835cd){var _0x525484={'method':'GET','uri':_0x479b4e+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x3d9c71+'&'+_0x1fbb0d,'auth':_0x362528,'json':!![]};return rp(_0x525484)[_0xc903('0xa')](function(_0x3ea17c){if(_0x3ea17c[_0xc903('0xb')][_0xc903('0xc')]>0x0){_0x16fe34[_0xc903('0xd')]=_0x3ea17c[_0xc903('0xb')][0x0][_0xc903('0xe')];}logger[_0xc903('0xf')]('['+[_0x3e7280[_0xc903('0x10')]()]+_0xc903('0x11'),_0x16fe34);_0x32467a(_0x16fe34);})[_0xc903('0x12')](function(_0x1517a8){logger[_0xc903('0x13')]('['+[_0x3e7280[_0xc903('0x10')]()]+']',_0x1517a8[_0xc903('0x14')]);_0x4835cd(_0x1517a8[_0xc903('0x14')]);});});}function getUser(_0x9ce7f5,_0x279a4b,_0x516a1a,_0x28ff86,_0x51320a){return function(_0x1e5262){logger[_0xc903('0xf')]('['+[_0x9ce7f5[_0xc903('0x10')]()]+_0xc903('0x15'),_0x1e5262);return new Promise(function(_0xcc1084,_0x3196e7){if(intUtil['validateEmail'](_0x1e5262[_0xc903('0x16')])){var _0x21be43={'method':'GET','uri':_0x516a1a+_0xc903('0x17')+_0x1e5262['userEmail']+'&'+_0x28ff86+'&'+_0x51320a,'auth':_0x279a4b,'json':!![]};logger[_0xc903('0xf')]('['+[_0x9ce7f5['toUpperCase']()]+_0xc903('0x18'),_0x21be43);return rp(_0x21be43)[_0xc903('0xa')](function(_0x7545e1){logger['info']('['+[_0x9ce7f5[_0xc903('0x10')]()]+_0xc903('0x19'),_0x7545e1);if(_0x7545e1['result']['length']>0x0&&String(_0x7545e1[_0xc903('0xb')][0x0][_0xc903('0x1a')])===_0xc903('0x1b')){_0x1e5262[_0xc903('0x1c')]=_0x7545e1[_0xc903('0xb')][0x0][_0xc903('0xe')];}else{_0x1e5262[_0xc903('0x1c')]=_0x1e5262['adminId'];_0x1e5262['userEmail']=_0x1e5262['adminEmail'];}logger[_0xc903('0xf')]('['+[_0x9ce7f5[_0xc903('0x10')]()]+_0xc903('0x1d'),_0x1e5262);_0xcc1084(_0x1e5262);})[_0xc903('0x12')](function(_0x5716d2){logger[_0xc903('0x13')]('['+[_0x9ce7f5['toUpperCase']()]+']',_0x5716d2['message']);_0x3196e7(_0x5716d2[_0xc903('0x14')]);});}else{logger['info']('['+[_0x9ce7f5['toUpperCase']()]+_0xc903('0x1e'));_0x1e5262[_0xc903('0x1c')]=_0x1e5262[_0xc903('0xd')];_0x1e5262['userEmail']=_0x1e5262[_0xc903('0x1f')];_0xcc1084(_0x1e5262);}});};}function createEndUser(_0x4422cb,_0x2d5ad6,_0x33321e,_0x10e29f,_0x3ad32c){logger['info']('['+[_0x4422cb[_0xc903('0x10')]()]+_0xc903('0x20'),_0x33321e);return new Promise(function(_0x4a3705,_0x22c042){var _0x5d8fed={'method':'POST','uri':_0x10e29f+_0xc903('0x21')+_0x3ad32c,'body':{'user_name':_0x33321e['endUserNumber'],'roles':_0xc903('0x22'),'first_name':_0x33321e['endUserNumber'],'active':'true','date_format':_0xc903('0x23'),'phone':_0x33321e[_0xc903('0x24')]},'auth':_0x2d5ad6,'json':!![]};return rp(_0x5d8fed)['then'](function(_0x15b713){logger[_0xc903('0xf')]('['+[_0x4422cb[_0xc903('0x10')]()]+_0xc903('0x25'),_0x15b713['result']);_0x33321e[_0xc903('0x26')]=_0x15b713[_0xc903('0xb')][_0xc903('0xe')];_0x4a3705(_0x33321e);})['catch'](function(_0x5dcaa3){logger[_0xc903('0x13')]('['+[_0x4422cb[_0xc903('0x10')]()]+']',_0x5dcaa3[_0xc903('0x14')]);_0x22c042(_0x5dcaa3['message']);});});}function getEndUser(_0x5328f2,_0x3ca5a5,_0x5811c5,_0x3720a8,_0x1054f9){return function(_0x5a1b17){logger[_0xc903('0xf')]('['+[_0x5328f2[_0xc903('0x10')]()]+_0xc903('0x27'),_0x5a1b17);return new Promise(function(_0x29251d,_0x448fba){var _0x43391e={'method':'GET','uri':_0x5811c5+_0xc903('0x28')+_0x5a1b17['endUserNumber']+'&'+_0x3720a8+'&'+_0x1054f9,'auth':_0x3ca5a5,'json':!![]};return rp(_0x43391e)[_0xc903('0xa')](function(_0x29ecbb){if(_0x29ecbb[_0xc903('0xb')][_0xc903('0xc')]>0x0){_0x5a1b17['endUserId']=_0x29ecbb['result'][0x0][_0xc903('0xe')];logger[_0xc903('0xf')]('['+[_0x5328f2['toUpperCase']()]+_0xc903('0x29'),_0x5a1b17);_0x29251d(_0x5a1b17);}else{return createEndUser(_0x5328f2,_0x3ca5a5,_0x5a1b17,_0x5811c5,_0x3720a8)[_0xc903('0xa')](function(_0x2abdff){logger[_0xc903('0xf')]('['+[_0x5328f2[_0xc903('0x10')]()]+'],\x20createEndUser\x20crm',_0x2abdff);_0x29251d(_0x2abdff);});}})[_0xc903('0x12')](function(_0x19214b){logger[_0xc903('0x13')]('['+[_0x5328f2[_0xc903('0x10')]()]+']',_0x19214b['message']);_0x448fba(_0x19214b[_0xc903('0x14')]);});});};}function getCustomFields(_0x9f5874,_0x3f1bbe){var _0x382cd3={};if(_0x9f5874['length']>0x0){_[_0xc903('0x2a')](_0x9f5874,function(_0xafb2e1){if(_[_0xc903('0x2b')]([_0xc903('0x2c'),_0xc903('0x2d')],_0xafb2e1[_0xc903('0x2e')])&&_0xafb2e1['nameField']&&!_0xafb2e1['customField']){_0x382cd3[_0xafb2e1[_0xc903('0x2f')]['toLowerCase']()]=_0xafb2e1[_0xc903('0x30')][_0xc903('0x31')]();}else if(_['includes']([_0xc903('0x2c'),_0xc903('0x2d')],_0xafb2e1[_0xc903('0x2e')])&&_0xafb2e1[_0xc903('0x32')]&&_0xafb2e1[_0xc903('0x33')]){_0x382cd3[_0xafb2e1[_0xc903('0x32')][_0xc903('0x34')]()]=_0xafb2e1[_0xc903('0x30')]['toString']();}else if(_0xafb2e1['type']===_0xc903('0x35')&&_0xafb2e1[_0xc903('0x36')]&&_0xafb2e1['idField']&&_0xafb2e1['customField']){_0x382cd3[_0xafb2e1[_0xc903('0x32')][_0xc903('0x34')]()]=_0x3f1bbe[_0xafb2e1[_0xc903('0x36')]][_0xc903('0x31')]();}else if(_0xafb2e1[_0xc903('0x2e')]===_0xc903('0x37')&&_0xafb2e1['Variable']&&_0xafb2e1[_0xc903('0x38')][_0xc903('0x39')]&&_0xafb2e1[_0xc903('0x32')]&&_0xafb2e1['customField']){_0x382cd3[_0xafb2e1[_0xc903('0x32')][_0xc903('0x34')]()]=_0x3f1bbe[_0xafb2e1[_0xc903('0x38')][_0xc903('0x39')][_0xc903('0x34')]()]['toString']();}});}return _0x382cd3;}function getTicket(_0x3d711e,_0x35eb4b,_0x4f8ad1,_0x1e267e,_0x1c0b8d,_0x361937){return function(_0x3b5a1f){logger[_0xc903('0xf')]('['+[_0x3d711e[_0xc903('0x10')]()]+']\x20getTicket\x20input\x20crm',_0x3b5a1f);return new Promise(function(_0x48dbc5,_0x2154d5){var _0x1123fa=_0x3d711e['toLowerCase']()===_0xc903('0x3a')?_0x3b5a1f['userId']:_0x3b5a1f[_0xc903('0x26')];var _0xa5efe9={'method':_0xc903('0x3b'),'uri':_0x4f8ad1+_0xc903('0x3c')+'?'+_0x361937,'body':Object[_0xc903('0x3d')]({},{'active':_0xc903('0x1b'),'caller_id':_0x1123fa,'assigned_to':_0x3b5a1f['userId'],'short_description':intUtil[_0xc903('0x3e')](_0x1e267e[_0xc903('0x3f')],_0x1c0b8d,'\x20'),'description':intUtil[_0xc903('0x3e')](_0x1e267e[_0xc903('0x40')],_0x1c0b8d,'\x0a')},getCustomFields(_0x1e267e['Fields'],_0x1c0b8d)),'auth':_0x35eb4b,'json':!![]};return rp(_0xa5efe9)['then'](function(_0x3be0dc){logger[_0xc903('0xf')]('['+[_0x3d711e[_0xc903('0x10')]()]+_0xc903('0x41'),_0x3be0dc[_0xc903('0xb')]);_0x3b5a1f[_0xc903('0x42')]=_0x3be0dc[_0xc903('0xb')]['sys_id'];_0x3b5a1f[_0xc903('0x43')]=_0x3be0dc[_0xc903('0xb')][_0xc903('0x44')];logger[_0xc903('0xf')]('['+[_0x3d711e[_0xc903('0x10')]()]+_0xc903('0x45'),_0x3b5a1f);_0x48dbc5(_0x3b5a1f);})[_0xc903('0x12')](function(_0x281a00){logger[_0xc903('0x13')]('['+[_0x3d711e[_0xc903('0x10')]()]+']',_0x281a00['message']);_0x2154d5(_0x281a00[_0xc903('0x14')]);});});};}function createRemoteTag(_0x3bdd56,_0x8dd566,_0x3e0f10,_0x536af3){return new Promise(function(_0x540dbd,_0x2fe853){var _0x522b62={'method':_0xc903('0x3b'),'uri':_0x3e0f10+_0xc903('0x46')+'?'+_0x536af3,'body':{'short_description':_0x3bdd56,'global':!![],'active':!![],'name':_0x3bdd56},'auth':_0x8dd566,'json':!![]};return rp(_0x522b62)[_0xc903('0xa')](function(_0x5ec426){var _0x14d638=_0x5ec426['result'][_0xc903('0xe')];_0x540dbd(_0x14d638);});});}function getRemoteTag(_0x59e658,_0x1d5756,_0x1a70b6,_0x3f6157,_0x15f9d9){return new Promise(function(_0x239e1c,_0x2c9508){var _0x39dc4d={'method':_0xc903('0x47'),'uri':_0x1a70b6+_0xc903('0x46')+_0xc903('0x48')+_0x59e658+'&'+_0x3f6157,'auth':_0x1d5756,'json':!![]};return rp(_0x39dc4d)[_0xc903('0xa')](function(_0x579b60){if(_0x579b60[_0xc903('0xb')][_0xc903('0xc')]>0x0){var _0x3ecd23=_0x579b60['result'][0x0][_0xc903('0xe')];_0x239e1c(_0x3ecd23);}else{return createRemoteTag(_0x59e658,_0x1d5756,_0x1a70b6,_0x3f6157)['then'](function(_0x10acb7){_0x239e1c(_0x10acb7);});}});});}function assignTagToIncident(_0x2737c3,_0x1f3579,_0xff1c58,_0x1c0844,_0x305d6e){return new Promise(function(_0x19b46e,_0x57d85c){var _0x9376bc={'method':_0xc903('0x3b'),'uri':_0xff1c58+_0xc903('0x49')+'?'+_0x305d6e,'body':{'label':_0x2737c3,'table':_0xc903('0x3c'),'id_type':_0xc903('0x4a'),'table_key':_0x1c0844['ticketId'],'title':_0xc903('0x4b')+_0x1c0844[_0xc903('0x43')],'id_display':_0x1c0844['ticketNumber']},'auth':_0x1f3579,'json':!![]};return rp(_0x9376bc)[_0xc903('0xa')](function(_0xd9d317){_0x19b46e();})[_0xc903('0x12')](function(){_0x19b46e();});});}function manageTags(_0x530597,_0x193b4b,_0x4a330a,_0x28a98e,_0x578571,_0x1337c9,_0x29c79f){return new Promise(function(_0x580750,_0x5906a2){var _0x677597=[];_0x193b4b[_0xc903('0x2a')](function(_0x44cf78){_0x677597[_0xc903('0x4c')](getRemoteTag(_0x44cf78,_0x4a330a,_0x28a98e,_0x1337c9,_0x29c79f));});return Promise[_0xc903('0x4d')](_0x677597)[_0xc903('0xa')](function(_0x393a51){if(_0x393a51[_0xc903('0xc')]){logger[_0xc903('0xf')]('['+[_0x530597[_0xc903('0x10')]()]+_0xc903('0x4e'),_0x393a51);var _0x195c33=[];_0x393a51[_0xc903('0x2a')](function(_0x34e22c){_0x195c33[_0xc903('0x4c')](assignTagToIncident(_0x34e22c,_0x4a330a,_0x28a98e,_0x578571,_0x1337c9));});return Promise[_0xc903('0x4d')](_0x195c33)[_0xc903('0xa')](function(){_0x580750();})[_0xc903('0x12')](function(){_0x580750();});}else{_0x580750();}});});}function getTags(_0x62e663,_0xfcfc43,_0x581837,_0x2bde0d,_0x3087ee,_0x3b40d6){return function(_0x11793f){return new Promise(function(_0x8e1405,_0x4373fb){var _0x26a118=[];var _0x3abe30=_0x2bde0d['Tags'];if(_0x3abe30&&_0x3abe30[_0xc903('0xc')]>0x0){_0x26a118=_['map'](_0x3abe30,'name');}if(_0x26a118[_0xc903('0xc')]>0x0){return manageTags(_0x62e663,_0x26a118,_0xfcfc43,_0x581837,_0x11793f,_0x3087ee,_0x3b40d6)['then'](function(){_0x8e1405(_0x11793f);});}else{_0x8e1405(_0x11793f);}});};}function emit(_0x2e575e,_0x2092a2,_0x44cdf9){var _0x320030=_0xc903('0x4f')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xc903('0x50')+_0xc903('0x51');var _0x5219fa={'uri':_0x2e575e+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x44cdf9+_0x320030};io['to'](util['format'](_0xc903('0x52'),_0x2092a2))[_0xc903('0x53')](_0xc903('0x54'),_0x5219fa);}exports['cs']=function(_0x2f8801,_0x31320c,_0x1022d4,_0x335d6b,_0x3571f1,_0x105c41,_0x560b8e,_0x2ce6e1){var _0x49cbe2={};var _0x56aa88={'user':_0x105c41[_0xc903('0x55')],'pass':_0x105c41[_0xc903('0x56')]};var _0x21bc96=_0xc903('0x57');var _0x493856=_0xc903('0x58');_0x105c41['remoteUri']=intUtil[_0xc903('0x59')](_0x105c41[_0xc903('0x5a')]);_0x105c41[_0xc903('0x5b')]=intUtil[_0xc903('0x59')](_0x105c41[_0xc903('0x5b')]);var _0x185685=util[_0xc903('0x5c')](_0xc903('0x5d'),_0x105c41['remoteUri']);_0x49cbe2['userEmail']=!_[_0xc903('0x5e')](_0x335d6b)?_0x335d6b[_0xc903('0x5f')]:null;_0x49cbe2[_0xc903('0x1f')]=_0x105c41[_0xc903('0x5f')];_0x49cbe2['endUserNumber']=_0x2ce6e1['toLowerCase']()===_0xc903('0x3a')?_0x31320c[_0xc903('0x60')]:_0x31320c['calleridnum'];_0x49cbe2[_0xc903('0x61')]=_0x2ce6e1===_0xc903('0x62')||_0x2ce6e1===_0xc903('0x63')?_0xc903('0x62'):_0xc903('0x3a');var _0x444087=util[_0xc903('0x5c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x105c41['serverUrl'],_0x31320c[_0xc903('0x64')],md5(_0x31320c[_0xc903('0x64')]));if(_0x3571f1&&_0x3571f1[_0xc903('0x65')]){logger[_0xc903('0xf')](_0xc903('0x66'),'Recording\x20is\x20enabled!');_0x31320c[_0xc903('0x67')]=_0x444087;}else if(_0x560b8e&&_0x560b8e['recordingFormat']&&_0x560b8e['recordingFormat']!==_0xc903('0x68')){logger[_0xc903('0xf')](_0xc903('0x69'),_0xc903('0x6a'));_0x31320c[_0xc903('0x67')]=_0x444087;}else{_0x31320c[_0xc903('0x67')]='';}return getAdminUser(_0x2ce6e1,_0x56aa88,_0x49cbe2,_0x185685,_0x493856,_0x21bc96)[_0xc903('0xa')](getUser(_0x2ce6e1,_0x56aa88,_0x185685,_0x493856,_0x21bc96))['then'](getEndUser(_0x2ce6e1,_0x56aa88,_0x185685,_0x493856,_0x21bc96))[_0xc903('0xa')](getTicket(_0x2ce6e1,_0x56aa88,_0x185685,_0x1022d4,_0x31320c,_0x493856))['then'](function(_0x3590b6){logger[_0xc903('0xf')](util[_0xc903('0x5c')](_0xc903('0x6b'),_0x3590b6[_0xc903('0x42')]));logger[_0xc903('0xf')](util[_0xc903('0x5c')](_0xc903('0x6c'),_0x2ce6e1));if(_0x2ce6e1!=='unmanaged'){logger[_0xc903('0xf')]('['+[_0x2ce6e1[_0xc903('0x10')]()]+']',_0xc903('0x6d'));emit(_0x105c41[_0xc903('0x5a')],_0x335d6b['name'],_0x3590b6['ticketId']);}})[_0xc903('0x12')](function(_0x12d4d4){logger[_0xc903('0x13')]('['+[_0x2ce6e1['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0xc903('0x6e')](_0x12d4d4,{'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 6ac0941..8d019a0 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 _0xea4c=['remoteUri','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','user:%s','trigger:browser:url','catch','error','outbound','uri','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','users','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','Inbound','toUpperCase','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','POST','info','name','getString','Subjects','assigned_user_id','description','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','parent_name','direction','forEach','variableName','push','idField','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','name_value_list','user_name','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','length','Enduser\x20found!','first_name','Caller\x20-\x20%s','debug','[HTTP]','merge','map','nameField','customField','toLowerCase','content','type','string','custom_fields','variable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','queue','stripTrailingSlash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xea4c,0xa0));var _0xcea4=function(_0xd70e19,_0x4a5ba9){_0xd70e19=_0xd70e19-0x0;var _0x260155=_0xea4c[_0xd70e19];return _0x260155;};'use strict';var _=require(_0xcea4('0x0'));var rp=require(_0xcea4('0x1'));var BPromise=require(_0xcea4('0x2'));var md5=require(_0xcea4('0x3'));var util=require('util');var Redis=require(_0xcea4('0x4'));var intUtil=require(_0xcea4('0x5'));var config=require(_0xcea4('0x6'));var logger=require('../../../../config/logger')('sugarcrm');config[_0xcea4('0x7')]=_['defaults'](config[_0xcea4('0x7')],{'host':_0xcea4('0x8'),'port':0x18eb});var io=require(_0xcea4('0x9'))(new Redis(config[_0xcea4('0x7')]));var def={'method':_0xcea4('0xa'),'json':!![]};function emit(_0x3bad98,_0x423802,_0x4a00fd){io['to'](_0x3bad98)['emit'](_0x423802,_0x4a00fd);}function getTicket(_0x346d5e,_0x178dda,_0x59947c,_0x3c207d,_0x4ef21c,_0x467722,_0x276883,_0x412bb4){logger[_0xcea4('0xb')]('Creating\x20new\x20ticket...');var _0x47561d=new Date();var _0x1b76f9=[{'name':_0xcea4('0xc'),'value':intUtil[_0xcea4('0xd')](_0x3c207d[_0xcea4('0xe')],_0x4ef21c,'\x20')},{'name':_0xcea4('0xf'),'value':_0x178dda['id']},{'name':'created_by','value':_0x178dda['id']},{'name':_0xcea4('0x10'),'value':intUtil['getString'](_0x3c207d['Descriptions'],_0x4ef21c,'\x0a')},{'name':_0xcea4('0x11'),'value':_0x47561d[_0xcea4('0x12')]()[_0xcea4('0x13')](0x0,0x13)[_0xcea4('0x14')]('T','\x20')},{'name':_0xcea4('0x15'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xcea4('0x16'),'value':_0x59947c['id']},{'name':_0xcea4('0x17'),'value':'Contacts'},{'name':_0xcea4('0x18'),'value':_0x59947c[_0xcea4('0xc')]},{'name':_0xcea4('0x19'),'value':_0x412bb4}];if(_0x467722['length']){_[_0xcea4('0x1a')](_0x467722,function(_0x1b65a5){if(_0x4ef21c[_0x1b65a5[_0xcea4('0x1b')]]){_0x1b76f9[_0xcea4('0x1c')]({'name':_0x1b65a5[_0xcea4('0x1d')],'value':_0x4ef21c[_0x1b65a5[_0xcea4('0x1b')]]});}});}return request({'form':{'method':_0xcea4('0x1e'),'input_type':_0xcea4('0x1f'),'response_type':'JSON','rest_data':JSON[_0xcea4('0x20')]({'session':_0x276883['id'],'module_name':'Calls','name_value_list':_0x1b76f9})}});}function getAuth(_0x395bea){return util[_0xcea4('0x21')](_0xcea4('0x22'),new Buffer(_0x395bea[_0xcea4('0x23')]+':X')[_0xcea4('0x24')](_0xcea4('0x25')));}function getServerInfo(_0x265fc7){return request({'form':{'method':_0xcea4('0x26'),'input_type':_0xcea4('0x1f'),'response_type':'JSON','rest_data':JSON[_0xcea4('0x20')]({'session':_0x265fc7['id']})}});}function getUser(_0x1e0b8c,_0x5eaed4,_0xad0624){if(!_[_0xcea4('0x27')](_0x5eaed4)){logger['info'](_0xcea4('0x28'),_0x5eaed4);return request({'form':{'method':'get_entry_list','input_type':_0xcea4('0x1f'),'response_type':_0xcea4('0x1f'),'rest_data':JSON[_0xcea4('0x20')]({'session':_0xad0624['id'],'module_name':_0xcea4('0x29'),'query':util[_0xcea4('0x21')](_0xcea4('0x2a'),_0x5eaed4),'order_by':'','offset':'0','select_fields':['id',_0xcea4('0xc'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xcea4('0x2b')](function(_0x2a1a9a){if(_0x2a1a9a[_0xcea4('0x2c')]['length']){var _0x260fcf=_[_0xcea4('0x2d')](_0x2a1a9a[_0xcea4('0x2c')],function(_0x151599){return _0x151599[_0xcea4('0x2e')][_0xcea4('0x2f')][_0xcea4('0x30')]===_0x5eaed4;});if(_0x260fcf){logger[_0xcea4('0xb')](_0xcea4('0x31'));return BPromise['resolve']({'id':_0x260fcf[_0xcea4('0x2e')]['id'][_0xcea4('0x30')],'name':_0x260fcf[_0xcea4('0x2e')]['name']['value']});}}logger[_0xcea4('0xb')](_0xcea4('0x32'));return BPromise['resolve']({'id':_0xad0624[_0xcea4('0x2e')]['user_id']['value'],'name':_0xad0624[_0xcea4('0x2e')][_0xcea4('0x2f')][_0xcea4('0x30')]});});}else{logger[_0xcea4('0xb')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xcea4('0x33')]({'id':_0xad0624[_0xcea4('0x2e')][_0xcea4('0x34')][_0xcea4('0x30')],'name':_0xad0624[_0xcea4('0x2e')][_0xcea4('0x2f')][_0xcea4('0x30')]});}}function getEndUser(_0x5193f1,_0xdf2795,_0x2374c7,_0x405d6b){logger[_0xcea4('0xb')](_0xcea4('0x35'),_0x2374c7);return request({'form':{'method':_0xcea4('0x36'),'input_type':_0xcea4('0x1f'),'response_type':_0xcea4('0x1f'),'rest_data':JSON[_0xcea4('0x20')]({'session':_0x405d6b['id'],'module_name':_0xcea4('0x37'),'query':util['format'](_0xcea4('0x38'),_0x2374c7),'order_by':'','offset':'0','select_fields':['id',_0xcea4('0xc'),_0xcea4('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xcea4('0x2b')](function(_0x3dd997){if(_0x3dd997[_0xcea4('0x2c')][_0xcea4('0x3a')]){var _0x1f9d14=_[_0xcea4('0x2d')](_0x3dd997[_0xcea4('0x2c')],function(_0x4de619){return _0x4de619['name_value_list'][_0xcea4('0x39')][_0xcea4('0x30')]===_0x2374c7;});if(_0x1f9d14){logger['info'](_0xcea4('0x3b'));return BPromise[_0xcea4('0x33')]({'id':_0x1f9d14[_0xcea4('0x2e')]['id'][_0xcea4('0x30')],'name':_0x1f9d14[_0xcea4('0x2e')][_0xcea4('0xc')][_0xcea4('0x30')],'phone':_0x1f9d14[_0xcea4('0x2e')]['phone_home'][_0xcea4('0x30')]});}}else{logger[_0xcea4('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xcea4('0x1e'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xcea4('0x20')]({'session':_0x405d6b['id'],'module_name':_0xcea4('0x37'),'name_value_list':[{'name':_0xcea4('0x3c'),'value':_0xdf2795!==''?_0xdf2795:util[_0xcea4('0x21')](_0xcea4('0x3d'),_0x2374c7)},{'name':_0xcea4('0x39'),'value':_0x2374c7}]})}})[_0xcea4('0x2b')](function(_0x342f42){logger[_0xcea4('0xb')]('Enduser\x20created.');return BPromise[_0xcea4('0x33')]({'id':_0x342f42['id'],'name':_0x342f42['entry_list']['first_name'][_0xcea4('0x30')],'phone':_0x342f42[_0xcea4('0x2c')]['phone_home'][_0xcea4('0x30')]});});}});}function request(_0x590f4a){logger[_0xcea4('0x3e')](_0xcea4('0x3f'),JSON[_0xcea4('0x20')](_0x590f4a));return rp(_[_0xcea4('0x40')](def,_0x590f4a));}function getTags(_0x5eebfd,_0x22eb04){var _0x327df7=[];if(_0x5eebfd&&_0x5eebfd['length']>0x0){_0x327df7=_[_0xcea4('0x41')](_0x5eebfd,_0x22eb04);}return _0x327df7;}function getCustomFields(_0x45bb8f,_0x461c14){var _0x4658b4=[];var _0x349637={'custom_fields':[]};if(_0x45bb8f[_0xcea4('0x3a')]>0x0){_[_0xcea4('0x1a')](_0x45bb8f,function(_0x5cdf11){if(_0x5cdf11['type']==='string'&&_0x5cdf11[_0xcea4('0x42')]&&!_0x5cdf11[_0xcea4('0x43')]){_0x349637[_0x5cdf11[_0xcea4('0x42')][_0xcea4('0x44')]()]=_0x5cdf11[_0xcea4('0x45')][_0xcea4('0x24')]();}else if(_0x5cdf11[_0xcea4('0x46')]===_0xcea4('0x47')&&_0x5cdf11['idField']&&_0x5cdf11[_0xcea4('0x43')]){_0x349637[_0xcea4('0x48')][_0xcea4('0x1c')]({'id':_0x5cdf11['idField'],'value':_0x5cdf11[_0xcea4('0x45')][_0xcea4('0x24')]()});}else if(_0x5cdf11[_0xcea4('0x46')]===_0xcea4('0x49')&&_0x5cdf11['variableName']&&_0x5cdf11['idField']&&_0x5cdf11[_0xcea4('0x43')]){_0x461c14[_0x5cdf11['variableName']]&&_0x349637[_0xcea4('0x48')][_0xcea4('0x1c')]({'id':_0x5cdf11[_0xcea4('0x1d')],'value':_0x461c14[_0x5cdf11[_0xcea4('0x1b')]][_0xcea4('0x24')]()});}else if(_0x5cdf11[_0xcea4('0x46')]==='customVariable'&&_0x5cdf11['Variable']&&_0x5cdf11[_0xcea4('0x4a')][_0xcea4('0xc')]&&_0x5cdf11['idField']&&_0x5cdf11[_0xcea4('0x43')]){_0x461c14[_0x5cdf11['Variable'][_0xcea4('0xc')][_0xcea4('0x44')]()]&&_0x349637['custom_fields'][_0xcea4('0x1c')]({'id':_0x5cdf11[_0xcea4('0x1d')],'value':_0x461c14[_0x5cdf11[_0xcea4('0x4a')][_0xcea4('0xc')][_0xcea4('0x44')]()][_0xcea4('0x24')]()});}});}return _0x349637;}function getConnection(_0x4c1574){return request({'method':_0xcea4('0xa'),'form':{'method':_0xcea4('0x4b'),'input_type':_0xcea4('0x1f'),'response_type':'JSON','rest_data':JSON[_0xcea4('0x20')]({'user_auth':{'user_name':_0x4c1574[_0xcea4('0x4c')],'password':_0x4c1574[_0xcea4('0x4d')],'encryption':_0xcea4('0x4e')},'application':_0xcea4('0x4f')})}})[_0xcea4('0x2b')](function(_0x3ae1bc){var _0x2b5bee=_0x3ae1bc;if(_0x2b5bee['id']){def[_0xcea4('0x50')]=_0x2b5bee['id'];return BPromise[_0xcea4('0x33')](_0x2b5bee);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x4c1574['id']));}});}function setRelationship(_0x589a84,_0x259bbb,_0x4785a9,_0x46fb47){return request({'form':{'method':_0xcea4('0x51'),'input_type':_0xcea4('0x1f'),'response_type':_0xcea4('0x1f'),'rest_data':JSON[_0xcea4('0x20')]({'session':_0x589a84['id'],'module_name':'Calls','module_id':_0x4785a9['id'],'link_field_name':_0x46fb47,'related_ids':[_0x259bbb['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xcea4('0x52')]=function(_0x4ceae8,_0x569866,_0x1b9de4,_0x146be7,_0x113366,_0x11ba7c){var _0x575602,_0xbd23a1,_0x209355,_0x119d18;_0x11ba7c['remoteUri']=intUtil[_0xcea4('0x53')](_0x11ba7c[_0xcea4('0x54')]);_0x11ba7c[_0xcea4('0x55')]=intUtil['stripTrailingSlash'](_0x11ba7c[_0xcea4('0x55')]);def['uri']=util[_0xcea4('0x21')](_0xcea4('0x56'),_0x11ba7c[_0xcea4('0x54')]);if(_0x113366&&_0x113366[_0xcea4('0x57')]){logger[_0xcea4('0xb')](_0xcea4('0x58'),_0xcea4('0x59'));_0x569866[_0xcea4('0x5a')]=util['format'](_0xcea4('0x5b'),_0x11ba7c['serverUrl'],_0x569866[_0xcea4('0x5c')],md5(_0x569866[_0xcea4('0x5c')]));}else{_0x569866[_0xcea4('0x5a')]='';}return getConnection(_0x11ba7c)[_0xcea4('0x2b')](function(_0x6beeb5){_0x119d18=_0x6beeb5;return getUser(_0x11ba7c,_0x146be7[_0xcea4('0xc')],_0x119d18);})[_0xcea4('0x2b')](function(_0x33cd2c){_0x575602=_0x33cd2c;logger[_0xcea4('0xb')](_0xcea4('0x5d'),_0x575602['id']);return getEndUser(_0x11ba7c,_0x569866[_0xcea4('0x5e')],_0x569866[_0xcea4('0x5f')],_0x119d18);})[_0xcea4('0x2b')](function(_0x5ce810){_0xbd23a1=_0x5ce810;logger[_0xcea4('0xb')]('The\x20Enduser\x20ID\x20is:',_0xbd23a1['id']);return getTicket(_0x11ba7c,_0x575602,_0xbd23a1,_0x1b9de4,_0x569866,_0x1b9de4[_0xcea4('0x60')],_0x119d18,'Inbound');})[_0xcea4('0x2b')](function(_0x337477){_0x209355=_0x337477;logger[_0xcea4('0xb')](_0xcea4('0x61'));logger[_0xcea4('0xb')](_0xcea4('0x62'),_0x209355['id']);return setRelationship(_0x119d18,_0x575602,_0x209355,'users');})[_0xcea4('0x2b')](function(){return setRelationship(_0x119d18,_0xbd23a1,_0x209355,_0xcea4('0x63'));})[_0xcea4('0x2b')](function(){return getServerInfo(_0x119d18);})[_0xcea4('0x2b')](function(_0x83980d){var _0x264301=parseInt(_0x83980d[_0xcea4('0x64')]['charAt'](0x0));var _0x5459fb=util[_0xcea4('0x21')](_0xcea4('0x65'),_0x11ba7c[_0xcea4('0x54')],_0x209355['id']);if(_0x264301>0x6){_0x5459fb=util[_0xcea4('0x21')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x11ba7c[_0xcea4('0x54')],_0x209355['id']);}logger[_0xcea4('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xcea4('0x21')](_0xcea4('0x66'),_0x146be7[_0xcea4('0xc')]),_0xcea4('0x67'),{'uri':_0x5459fb});})[_0xcea4('0x68')](function(_0x5baabc){logger[_0xcea4('0x69')](_0xcea4('0x58'),JSON[_0xcea4('0x20')](_0x5baabc));});};exports[_0xcea4('0x6a')]=function(_0x50fc9b,_0x35b701,_0x3dfcb6,_0x30e422,_0x53e4ce,_0x588db7,_0x231e68){var _0x2cc782,_0x497678,_0x104f0d,_0x4f69ed;_0x588db7[_0xcea4('0x54')]=intUtil[_0xcea4('0x53')](_0x588db7['remoteUri']);_0x588db7[_0xcea4('0x55')]=intUtil[_0xcea4('0x53')](_0x588db7['serverUrl']);def[_0xcea4('0x6b')]=util[_0xcea4('0x21')](_0xcea4('0x56'),_0x588db7[_0xcea4('0x54')]);if(_0x231e68&&_0x231e68[_0xcea4('0x6c')]&&_0x231e68[_0xcea4('0x6c')]!==_0xcea4('0x6d')){logger[_0xcea4('0xb')](_0xcea4('0x6e'),_0xcea4('0x59'));_0x35b701[_0xcea4('0x5a')]=util[_0xcea4('0x21')](_0xcea4('0x5b'),_0x588db7[_0xcea4('0x55')],_0x35b701[_0xcea4('0x5c')],md5(_0x35b701['uniqueid']));}return getConnection(_0x588db7)['then'](function(_0x206817){_0x4f69ed=_0x206817;return getUser(_0x588db7,_0x30e422['name'],_0x4f69ed);})[_0xcea4('0x2b')](function(_0x2b4d8a){_0x2cc782=_0x2b4d8a;logger[_0xcea4('0xb')](_0xcea4('0x5d'),_0x2cc782['id']);return getEndUser(_0x588db7,_0x35b701[_0xcea4('0x6f')],_0x35b701[_0xcea4('0x70')],_0x4f69ed);})[_0xcea4('0x2b')](function(_0x24c7e2){_0x497678=_0x24c7e2;logger[_0xcea4('0xb')](_0xcea4('0x71'),_0x497678['id']);return getTicket(_0x588db7,_0x2cc782,_0x497678,_0x3dfcb6,_0x35b701,_0x3dfcb6[_0xcea4('0x60')],_0x4f69ed,'Outbound');})['then'](function(_0xbab465){_0x104f0d=_0xbab465;logger[_0xcea4('0xb')](_0xcea4('0x61'));logger['info'](_0xcea4('0x62'),_0x104f0d['id']);return setRelationship(_0x4f69ed,_0x2cc782,_0x104f0d,_0xcea4('0x72'));})[_0xcea4('0x2b')](function(){return setRelationship(_0x4f69ed,_0x497678,_0x104f0d,_0xcea4('0x63'));})[_0xcea4('0x2b')](function(){return getServerInfo(_0x4f69ed);})[_0xcea4('0x2b')](function(_0x2500de){var _0x38a42c=parseInt(_0x2500de[_0xcea4('0x64')][_0xcea4('0x73')](0x0));var _0x284ee7=util[_0xcea4('0x21')](_0xcea4('0x65'),_0x588db7[_0xcea4('0x54')],_0x104f0d['id']);if(_0x38a42c>0x6){_0x284ee7=util['format'](_0xcea4('0x74'),_0x588db7[_0xcea4('0x54')],_0x104f0d['id']);}logger[_0xcea4('0xb')](_0xcea4('0x6e'),_0xcea4('0x75'));emit(util[_0xcea4('0x21')](_0xcea4('0x66'),_0x30e422[_0xcea4('0xc')]),_0xcea4('0x67'),{'uri':_0x284ee7});})['catch'](function(_0x23251d){logger[_0xcea4('0x69')](_0xcea4('0x6e'),JSON['stringify'](_0x23251d));});};exports[_0xcea4('0x76')]=function(_0x2b6ac9,_0x54099d,_0x413398,_0x1f5a23,_0x883092,_0x166f76){var _0x522801,_0x5d2ff4,_0x323a5e,_0x4e5f82;_0x166f76[_0xcea4('0x54')]=intUtil[_0xcea4('0x53')](_0x166f76['remoteUri']);_0x166f76[_0xcea4('0x55')]=intUtil['stripTrailingSlash'](_0x166f76[_0xcea4('0x55')]);def[_0xcea4('0x6b')]=util['format'](_0xcea4('0x56'),_0x166f76['remoteUri']);if(_0x883092&&_0x883092[_0xcea4('0x57')]){logger['info']('['+_0x54099d[_0xcea4('0x77')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x54099d['recordingURL']=util[_0xcea4('0x21')](_0xcea4('0x5b'),_0x166f76[_0xcea4('0x55')],_0x54099d['uniqueid'],md5(_0x54099d[_0xcea4('0x5c')]));}else{_0x54099d[_0xcea4('0x5a')]='';}return getConnection(_0x166f76)[_0xcea4('0x2b')](function(_0x4a6c16){_0x4e5f82=_0x4a6c16;if(!_[_0xcea4('0x27')](_0x1f5a23)){return getUser(_0x166f76,_0x1f5a23[_0xcea4('0xc')],_0x4e5f82);}else{return getUser(_0x166f76,null,_0x4e5f82);}})[_0xcea4('0x2b')](function(_0x4a58b6){_0x522801=_0x4a58b6;logger[_0xcea4('0xb')](_0xcea4('0x5d'),_0x522801['id']);return getEndUser(_0x166f76,_0x54099d[_0xcea4('0x5e')],_0x54099d[_0xcea4('0x5f')],_0x4e5f82);})['then'](function(_0x1506cf){_0x5d2ff4=_0x1506cf;logger[_0xcea4('0xb')](_0xcea4('0x71'),_0x5d2ff4['id']);return getTicket(_0x166f76,_0x522801,_0x5d2ff4,_0x413398,_0x54099d,_0x413398[_0xcea4('0x60')],_0x4e5f82,_0xcea4('0x78'));})[_0xcea4('0x2b')](function(_0x1fa2ce){_0x323a5e=_0x1fa2ce;logger[_0xcea4('0xb')](_0xcea4('0x61'));logger['info'](_0xcea4('0x62'),_0x323a5e['id']);return setRelationship(_0x4e5f82,_0x522801,_0x323a5e,'users');})['then'](function(){return setRelationship(_0x4e5f82,_0x5d2ff4,_0x323a5e,_0xcea4('0x63'));})[_0xcea4('0x2b')](function(){return getServerInfo(_0x4e5f82);})[_0xcea4('0x68')](function(_0x22ffe1){logger[_0xcea4('0x69')]('['+_0x54099d['lastevent'][_0xcea4('0x79')]()+']',JSON['stringify'](_0x22ffe1));});}; \ No newline at end of file +var _0x347e=['socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','Descriptions','date_start','toISOString','duration_minutes','parent_id','parent_type','Contacts','direction','length','forEach','push','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','isNil','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','name_value_list','Agent\x20found!','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','find','phone_home','first_name','','Caller\x20-\x20%s','debug','[HTTP]','merge','type','string','customField','toLowerCase','content','idField','custom_fields','variable','variableName','customVariable','Variable','login','username','password','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','serverUrl','uri','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','%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','user:%s','trigger:browser:url','catch','error','outbound','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Fields','Outbound','users','charAt','unmanaged','lastevent','toUpperCase','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/logger','defaults','redis','localhost'];(function(_0x313c96,_0x3cee6e){var _0x522f53=function(_0x8961e){while(--_0x8961e){_0x313c96['push'](_0x313c96['shift']());}};_0x522f53(++_0x3cee6e);}(_0x347e,0xe4));var _0xe347=function(_0x159638,_0x554a3a){_0x159638=_0x159638-0x0;var _0x2160f7=_0x347e[_0x159638];return _0x2160f7;};'use strict';var _=require('lodash');var rp=require(_0xe347('0x0'));var BPromise=require(_0xe347('0x1'));var md5=require(_0xe347('0x2'));var util=require(_0xe347('0x3'));var Redis=require(_0xe347('0x4'));var intUtil=require(_0xe347('0x5'));var config=require('../../../../config/environment');var logger=require(_0xe347('0x6'))('sugarcrm');config['redis']=_[_0xe347('0x7')](config[_0xe347('0x8')],{'host':_0xe347('0x9'),'port':0x18eb});var io=require(_0xe347('0xa'))(new Redis(config[_0xe347('0x8')]));var def={'method':_0xe347('0xb'),'json':!![]};function emit(_0x295d30,_0x3795e7,_0x4f1a89){io['to'](_0x295d30)[_0xe347('0xc')](_0x3795e7,_0x4f1a89);}function getTicket(_0xbed0a7,_0x3845e4,_0x3e8e02,_0x5a00ca,_0x19c1e2,_0x210b8f,_0x8dd033,_0x5a0f7a){logger[_0xe347('0xd')](_0xe347('0xe'));var _0x17ff13=new Date();var _0x5b9790=[{'name':_0xe347('0xf'),'value':intUtil['getString'](_0x5a00ca[_0xe347('0x10')],_0x19c1e2,'\x20')},{'name':_0xe347('0x11'),'value':_0x3845e4['id']},{'name':_0xe347('0x12'),'value':_0x3845e4['id']},{'name':'description','value':intUtil['getString'](_0x5a00ca[_0xe347('0x13')],_0x19c1e2,'\x0a')},{'name':_0xe347('0x14'),'value':_0x17ff13[_0xe347('0x15')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xe347('0x16'),'value':'15'},{'name':_0xe347('0x17'),'value':_0x3e8e02['id']},{'name':_0xe347('0x18'),'value':_0xe347('0x19')},{'name':'parent_name','value':_0x3e8e02[_0xe347('0xf')]},{'name':_0xe347('0x1a'),'value':_0x5a0f7a}];if(_0x210b8f[_0xe347('0x1b')]){_[_0xe347('0x1c')](_0x210b8f,function(_0x51a47b){if(_0x19c1e2[_0x51a47b['variableName']]){_0x5b9790[_0xe347('0x1d')]({'name':_0x51a47b['idField'],'value':_0x19c1e2[_0x51a47b['variableName']]});}});}return request({'form':{'method':_0xe347('0x1e'),'input_type':_0xe347('0x1f'),'response_type':'JSON','rest_data':JSON[_0xe347('0x20')]({'session':_0x8dd033['id'],'module_name':_0xe347('0x21'),'name_value_list':_0x5b9790})}});}function getAuth(_0x5dc1cc){return util[_0xe347('0x22')](_0xe347('0x23'),new Buffer(_0x5dc1cc[_0xe347('0x24')]+':X')[_0xe347('0x25')](_0xe347('0x26')));}function getServerInfo(_0x25172a){return request({'form':{'method':'get_server_info','input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x25172a['id']})}});}function getUser(_0x4c02da,_0x1e982a,_0x1571b1){if(!_[_0xe347('0x27')](_0x1e982a)){logger[_0xe347('0xd')](_0xe347('0x28'),_0x1e982a);return request({'form':{'method':_0xe347('0x29'),'input_type':'JSON','response_type':_0xe347('0x1f'),'rest_data':JSON[_0xe347('0x20')]({'session':_0x1571b1['id'],'module_name':'Employees','query':util['format'](_0xe347('0x2a'),_0x1e982a),'order_by':'','offset':'0','select_fields':['id','name',_0xe347('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe347('0x2c')](function(_0x470a0d){if(_0x470a0d[_0xe347('0x2d')][_0xe347('0x1b')]){var _0x4b09fe=_['find'](_0x470a0d[_0xe347('0x2d')],function(_0x3aec28){return _0x3aec28[_0xe347('0x2e')][_0xe347('0x2b')]['value']===_0x1e982a;});if(_0x4b09fe){logger[_0xe347('0xd')](_0xe347('0x2f'));return BPromise['resolve']({'id':_0x4b09fe[_0xe347('0x2e')]['id'][_0xe347('0x30')],'name':_0x4b09fe[_0xe347('0x2e')][_0xe347('0xf')][_0xe347('0x30')]});}}logger[_0xe347('0xd')](_0xe347('0x31'));return BPromise[_0xe347('0x32')]({'id':_0x1571b1[_0xe347('0x2e')]['user_id'][_0xe347('0x30')],'name':_0x1571b1[_0xe347('0x2e')][_0xe347('0x2b')][_0xe347('0x30')]});});}else{logger[_0xe347('0xd')](_0xe347('0x33'));return BPromise['resolve']({'id':_0x1571b1[_0xe347('0x2e')]['user_id'][_0xe347('0x30')],'name':_0x1571b1[_0xe347('0x2e')][_0xe347('0x2b')][_0xe347('0x30')]});}}function getEndUser(_0x50332f,_0x36b607,_0x18dc0a,_0x30dccc){logger[_0xe347('0xd')](_0xe347('0x34'),_0x18dc0a);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0xe347('0x1f'),'rest_data':JSON[_0xe347('0x20')]({'session':_0x30dccc['id'],'module_name':'Contacts','query':util['format'](_0xe347('0x35'),_0x18dc0a),'order_by':'','offset':'0','select_fields':['id',_0xe347('0xf'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe347('0x2c')](function(_0x3fc2c9){if(_0x3fc2c9[_0xe347('0x2d')][_0xe347('0x1b')]){var _0x203e94=_[_0xe347('0x36')](_0x3fc2c9[_0xe347('0x2d')],function(_0x3b360d){return _0x3b360d[_0xe347('0x2e')]['phone_home'][_0xe347('0x30')]===_0x18dc0a;});if(_0x203e94){logger[_0xe347('0xd')]('Enduser\x20found!');return BPromise[_0xe347('0x32')]({'id':_0x203e94[_0xe347('0x2e')]['id'][_0xe347('0x30')],'name':_0x203e94[_0xe347('0x2e')][_0xe347('0xf')][_0xe347('0x30')],'phone':_0x203e94[_0xe347('0x2e')][_0xe347('0x37')][_0xe347('0x30')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xe347('0x1e'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xe347('0x20')]({'session':_0x30dccc['id'],'module_name':_0xe347('0x19'),'name_value_list':[{'name':_0xe347('0x38'),'value':_0x36b607!==_0xe347('0x39')?_0x36b607:util[_0xe347('0x22')](_0xe347('0x3a'),_0x18dc0a)},{'name':_0xe347('0x37'),'value':_0x18dc0a}]})}})[_0xe347('0x2c')](function(_0x316db2){logger[_0xe347('0xd')]('Enduser\x20created.');return BPromise['resolve']({'id':_0x316db2['id'],'name':_0x316db2[_0xe347('0x2d')][_0xe347('0x38')][_0xe347('0x30')],'phone':_0x316db2[_0xe347('0x2d')][_0xe347('0x37')][_0xe347('0x30')]});});}});}function request(_0xa3908b){logger[_0xe347('0x3b')](_0xe347('0x3c'),JSON['stringify'](_0xa3908b));return rp(_[_0xe347('0x3d')](def,_0xa3908b));}function getTags(_0x1aa81f,_0x3014cd){var _0x4d5176=[];if(_0x1aa81f&&_0x1aa81f[_0xe347('0x1b')]>0x0){_0x4d5176=_['map'](_0x1aa81f,_0x3014cd);}return _0x4d5176;}function getCustomFields(_0x486644,_0x238684){var _0x364139=[];var _0x6ba33f={'custom_fields':[]};if(_0x486644[_0xe347('0x1b')]>0x0){_['forEach'](_0x486644,function(_0x56d804){if(_0x56d804[_0xe347('0x3e')]===_0xe347('0x3f')&&_0x56d804['nameField']&&!_0x56d804[_0xe347('0x40')]){_0x6ba33f[_0x56d804['nameField'][_0xe347('0x41')]()]=_0x56d804[_0xe347('0x42')][_0xe347('0x25')]();}else if(_0x56d804[_0xe347('0x3e')]==='string'&&_0x56d804[_0xe347('0x43')]&&_0x56d804[_0xe347('0x40')]){_0x6ba33f[_0xe347('0x44')][_0xe347('0x1d')]({'id':_0x56d804[_0xe347('0x43')],'value':_0x56d804[_0xe347('0x42')][_0xe347('0x25')]()});}else if(_0x56d804['type']===_0xe347('0x45')&&_0x56d804[_0xe347('0x46')]&&_0x56d804[_0xe347('0x43')]&&_0x56d804[_0xe347('0x40')]){_0x238684[_0x56d804[_0xe347('0x46')]]&&_0x6ba33f[_0xe347('0x44')][_0xe347('0x1d')]({'id':_0x56d804[_0xe347('0x43')],'value':_0x238684[_0x56d804[_0xe347('0x46')]][_0xe347('0x25')]()});}else if(_0x56d804[_0xe347('0x3e')]===_0xe347('0x47')&&_0x56d804['Variable']&&_0x56d804[_0xe347('0x48')][_0xe347('0xf')]&&_0x56d804['idField']&&_0x56d804[_0xe347('0x40')]){_0x238684[_0x56d804[_0xe347('0x48')][_0xe347('0xf')][_0xe347('0x41')]()]&&_0x6ba33f['custom_fields']['push']({'id':_0x56d804['idField'],'value':_0x238684[_0x56d804['Variable']['name'][_0xe347('0x41')]()][_0xe347('0x25')]()});}});}return _0x6ba33f;}function getConnection(_0x30d9f9){return request({'method':_0xe347('0xb'),'form':{'method':_0xe347('0x49'),'input_type':_0xe347('0x1f'),'response_type':_0xe347('0x1f'),'rest_data':JSON[_0xe347('0x20')]({'user_auth':{'user_name':_0x30d9f9[_0xe347('0x4a')],'password':_0x30d9f9[_0xe347('0x4b')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0xe347('0x2c')](function(_0x10245a){var _0x1c3373=_0x10245a;if(_0x1c3373['id']){def[_0xe347('0x4c')]=_0x1c3373['id'];return BPromise[_0xe347('0x32')](_0x1c3373);}else{throw new Error(util[_0xe347('0x22')](_0xe347('0x4d'),_0x30d9f9['id']));}});}function setRelationship(_0x15143c,_0x54b867,_0x1b7dd0,_0x4d57f6){return request({'form':{'method':_0xe347('0x4e'),'input_type':'JSON','response_type':_0xe347('0x1f'),'rest_data':JSON['stringify']({'session':_0x15143c['id'],'module_name':_0xe347('0x21'),'module_id':_0x1b7dd0['id'],'link_field_name':_0x4d57f6,'related_ids':[_0x54b867['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xe347('0x4f')]=function(_0x2712cf,_0x453d86,_0x1bfc3b,_0x26ace5,_0x1bee52,_0x2b7273){var _0x5b1131,_0x90e73a,_0x3e28dc,_0x16a6b1;_0x2b7273['remoteUri']=intUtil[_0xe347('0x50')](_0x2b7273['remoteUri']);_0x2b7273['serverUrl']=intUtil[_0xe347('0x50')](_0x2b7273[_0xe347('0x51')]);def[_0xe347('0x52')]=util[_0xe347('0x22')]('%s/service/v4_1/rest.php',_0x2b7273[_0xe347('0x53')]);if(_0x1bee52&&_0x1bee52[_0xe347('0x54')]){logger[_0xe347('0xd')](_0xe347('0x55'),_0xe347('0x56'));_0x453d86[_0xe347('0x57')]=util[_0xe347('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2b7273[_0xe347('0x51')],_0x453d86['uniqueid'],md5(_0x453d86[_0xe347('0x58')]));}else{_0x453d86[_0xe347('0x57')]='';}return getConnection(_0x2b7273)[_0xe347('0x2c')](function(_0x3b9eeb){_0x16a6b1=_0x3b9eeb;return getUser(_0x2b7273,_0x26ace5[_0xe347('0xf')],_0x16a6b1);})['then'](function(_0x3ea6ce){_0x5b1131=_0x3ea6ce;logger[_0xe347('0xd')]('The\x20User\x20ID\x20is:',_0x5b1131['id']);return getEndUser(_0x2b7273,_0x453d86[_0xe347('0x59')],_0x453d86[_0xe347('0x5a')],_0x16a6b1);})[_0xe347('0x2c')](function(_0x3aa36e){_0x90e73a=_0x3aa36e;logger[_0xe347('0xd')](_0xe347('0x5b'),_0x90e73a['id']);return getTicket(_0x2b7273,_0x5b1131,_0x90e73a,_0x1bfc3b,_0x453d86,_0x1bfc3b['Fields'],_0x16a6b1,_0xe347('0x5c'));})[_0xe347('0x2c')](function(_0x1e3a30){_0x3e28dc=_0x1e3a30;logger[_0xe347('0xd')](_0xe347('0x5d'));logger[_0xe347('0xd')](_0xe347('0x5e'),_0x3e28dc['id']);return setRelationship(_0x16a6b1,_0x5b1131,_0x3e28dc,'users');})[_0xe347('0x2c')](function(){return setRelationship(_0x16a6b1,_0x90e73a,_0x3e28dc,_0xe347('0x5f'));})['then'](function(){return getServerInfo(_0x16a6b1);})[_0xe347('0x2c')](function(_0x4f994c){var _0x23aee5=parseInt(_0x4f994c[_0xe347('0x60')]['charAt'](0x0));var _0x2c9c2a=util[_0xe347('0x22')](_0xe347('0x61'),_0x2b7273[_0xe347('0x53')],_0x3e28dc['id']);if(_0x23aee5>0x6){_0x2c9c2a=util['format'](_0xe347('0x62'),_0x2b7273[_0xe347('0x53')],_0x3e28dc['id']);}logger[_0xe347('0xd')](_0xe347('0x55'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xe347('0x22')](_0xe347('0x63'),_0x26ace5[_0xe347('0xf')]),_0xe347('0x64'),{'uri':_0x2c9c2a});})[_0xe347('0x65')](function(_0x281882){logger[_0xe347('0x66')](_0xe347('0x55'),JSON[_0xe347('0x20')](_0x281882));});};exports[_0xe347('0x67')]=function(_0x3c0287,_0x4e0d6c,_0x2f0c68,_0x585611,_0x3c31a9,_0x5dc83c,_0x4a7307){var _0x576481,_0x530cc6,_0x2e0ea3,_0x1544f0;_0x5dc83c[_0xe347('0x53')]=intUtil[_0xe347('0x50')](_0x5dc83c[_0xe347('0x53')]);_0x5dc83c['serverUrl']=intUtil[_0xe347('0x50')](_0x5dc83c['serverUrl']);def['uri']=util[_0xe347('0x22')](_0xe347('0x68'),_0x5dc83c[_0xe347('0x53')]);if(_0x4a7307&&_0x4a7307[_0xe347('0x69')]&&_0x4a7307['recordingFormat']!==_0xe347('0x6a')){logger[_0xe347('0xd')](_0xe347('0x6b'),_0xe347('0x56'));_0x4e0d6c[_0xe347('0x57')]=util['format'](_0xe347('0x6c'),_0x5dc83c[_0xe347('0x51')],_0x4e0d6c[_0xe347('0x58')],md5(_0x4e0d6c[_0xe347('0x58')]));}return getConnection(_0x5dc83c)[_0xe347('0x2c')](function(_0xe1e74a){_0x1544f0=_0xe1e74a;return getUser(_0x5dc83c,_0x585611[_0xe347('0xf')],_0x1544f0);})[_0xe347('0x2c')](function(_0x492cfa){_0x576481=_0x492cfa;logger['info'](_0xe347('0x6d'),_0x576481['id']);return getEndUser(_0x5dc83c,_0x4e0d6c[_0xe347('0x6e')],_0x4e0d6c[_0xe347('0x6f')],_0x1544f0);})[_0xe347('0x2c')](function(_0x2a812f){_0x530cc6=_0x2a812f;logger[_0xe347('0xd')](_0xe347('0x5b'),_0x530cc6['id']);return getTicket(_0x5dc83c,_0x576481,_0x530cc6,_0x2f0c68,_0x4e0d6c,_0x2f0c68[_0xe347('0x70')],_0x1544f0,_0xe347('0x71'));})[_0xe347('0x2c')](function(_0x198561){_0x2e0ea3=_0x198561;logger['info']('Ticket\x20created!');logger[_0xe347('0xd')](_0xe347('0x5e'),_0x2e0ea3['id']);return setRelationship(_0x1544f0,_0x576481,_0x2e0ea3,_0xe347('0x72'));})[_0xe347('0x2c')](function(){return setRelationship(_0x1544f0,_0x530cc6,_0x2e0ea3,_0xe347('0x5f'));})[_0xe347('0x2c')](function(){return getServerInfo(_0x1544f0);})[_0xe347('0x2c')](function(_0x373b9f){var _0x57cf0f=parseInt(_0x373b9f[_0xe347('0x60')][_0xe347('0x73')](0x0));var _0x30a143=util[_0xe347('0x22')](_0xe347('0x61'),_0x5dc83c[_0xe347('0x53')],_0x2e0ea3['id']);if(_0x57cf0f>0x6){_0x30a143=util['format'](_0xe347('0x62'),_0x5dc83c[_0xe347('0x53')],_0x2e0ea3['id']);}logger[_0xe347('0xd')](_0xe347('0x6b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xe347('0x22')](_0xe347('0x63'),_0x585611['name']),'trigger:browser:url',{'uri':_0x30a143});})[_0xe347('0x65')](function(_0x2d45ab){logger['error']('[OUTBOUND]',JSON[_0xe347('0x20')](_0x2d45ab));});};exports[_0xe347('0x74')]=function(_0x1384d6,_0x29645c,_0x5c9f70,_0x5bf857,_0x51f798,_0x36bea5){var _0x11412f,_0x35c5e9,_0x1bc223,_0x52f588;_0x36bea5[_0xe347('0x53')]=intUtil[_0xe347('0x50')](_0x36bea5[_0xe347('0x53')]);_0x36bea5['serverUrl']=intUtil['stripTrailingSlash'](_0x36bea5[_0xe347('0x51')]);def[_0xe347('0x52')]=util[_0xe347('0x22')](_0xe347('0x68'),_0x36bea5[_0xe347('0x53')]);if(_0x51f798&&_0x51f798[_0xe347('0x54')]){logger[_0xe347('0xd')]('['+_0x29645c[_0xe347('0x75')]['toUpperCase']()+']',_0xe347('0x56'));_0x29645c[_0xe347('0x57')]=util[_0xe347('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x36bea5[_0xe347('0x51')],_0x29645c[_0xe347('0x58')],md5(_0x29645c[_0xe347('0x58')]));}else{_0x29645c[_0xe347('0x57')]='';}return getConnection(_0x36bea5)[_0xe347('0x2c')](function(_0x672dca){_0x52f588=_0x672dca;if(!_[_0xe347('0x27')](_0x5bf857)){return getUser(_0x36bea5,_0x5bf857[_0xe347('0xf')],_0x52f588);}else{return getUser(_0x36bea5,null,_0x52f588);}})[_0xe347('0x2c')](function(_0xf01e74){_0x11412f=_0xf01e74;logger[_0xe347('0xd')]('The\x20User\x20ID\x20is:',_0x11412f['id']);return getEndUser(_0x36bea5,_0x29645c[_0xe347('0x59')],_0x29645c['calleridnum'],_0x52f588);})[_0xe347('0x2c')](function(_0x664435){_0x35c5e9=_0x664435;logger[_0xe347('0xd')](_0xe347('0x5b'),_0x35c5e9['id']);return getTicket(_0x36bea5,_0x11412f,_0x35c5e9,_0x5c9f70,_0x29645c,_0x5c9f70['Fields'],_0x52f588,'Inbound');})[_0xe347('0x2c')](function(_0x4fed3c){_0x1bc223=_0x4fed3c;logger[_0xe347('0xd')]('Ticket\x20created!');logger['info'](_0xe347('0x5e'),_0x1bc223['id']);return setRelationship(_0x52f588,_0x11412f,_0x1bc223,_0xe347('0x72'));})[_0xe347('0x2c')](function(){return setRelationship(_0x52f588,_0x35c5e9,_0x1bc223,_0xe347('0x5f'));})[_0xe347('0x2c')](function(){return getServerInfo(_0x52f588);})[_0xe347('0x65')](function(_0x290e19){logger[_0xe347('0x66')]('['+_0x29645c[_0xe347('0x75')][_0xe347('0x76')]()+']',JSON[_0xe347('0x20')](_0x290e19));});}; \ 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 f2c4d66..93f173e 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 _0xeb8b=['string','content','type','variable','variableName','push','toString','customVariable','name','toLowerCase','Variable','keyValue','keyType','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','slice','lastIndexOf','validateEmail','isNil','test','util','getString','length'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0xeb8b,0x1e3));var _0xbeb8=function(_0x24e407,_0x461f2e){_0x24e407=_0x24e407-0x0;var _0x4ec6e7=_0xeb8b[_0x24e407];return _0x4ec6e7;};'use strict';var _=require('lodash');var util=require(_0xbeb8('0x0'));exports[_0xbeb8('0x1')]=function(_0x581679,_0x7d8f37,_0x16aa82){var _0x1e8c3f=[];if(_0x581679['length']>0x0){var _0x2a65d4=_['sortBy'](_0x581679,['id']);for(var _0x252fb3=0x0;_0x252fb3<_0x2a65d4[_0xbeb8('0x2')];_0x252fb3++){var _0x336bd7=_0x2a65d4[_0x252fb3];if(_0x336bd7['type']===_0xbeb8('0x3')){_0x1e8c3f['push'](_0x336bd7[_0xbeb8('0x4')]);}else if(_0x336bd7[_0xbeb8('0x5')]===_0xbeb8('0x6')&&_0x336bd7[_0xbeb8('0x7')]){_0x7d8f37[_0x336bd7[_0xbeb8('0x7')]]&&_0x1e8c3f[_0xbeb8('0x8')](_0x7d8f37[_0x336bd7[_0xbeb8('0x7')]][_0xbeb8('0x9')]());}else if(_0x336bd7['type']===_0xbeb8('0xa')&&_0x336bd7['Variable']&&_0x336bd7['Variable'][_0xbeb8('0xb')]){_0x7d8f37[_0x336bd7['Variable'][_0xbeb8('0xb')][_0xbeb8('0xc')]()]&&_0x1e8c3f[_0xbeb8('0x8')](_0x7d8f37[_0x336bd7[_0xbeb8('0xd')][_0xbeb8('0xb')][_0xbeb8('0xc')]()][_0xbeb8('0x9')]());}else if(_0x336bd7['type']===_0xbeb8('0xe')){if(_0x336bd7[_0xbeb8('0xf')]===_0xbeb8('0x3')&&_0x336bd7[_0xbeb8('0x10')]){_0x1e8c3f[_0xbeb8('0x8')](util[_0xbeb8('0x11')](_0xbeb8('0x12'),_0x336bd7['key'],_0x336bd7[_0xbeb8('0x13')]));}else if(_0x336bd7[_0xbeb8('0xf')]==='variable'&&_0x336bd7[_0xbeb8('0x7')]&&_0x336bd7['key']){_0x7d8f37[_0x336bd7[_0xbeb8('0x7')]]&&_0x1e8c3f[_0xbeb8('0x8')](util[_0xbeb8('0x11')](_0xbeb8('0x12'),_0x336bd7[_0xbeb8('0x10')],_0x7d8f37[_0x336bd7['variableName']]));}else if(_0x336bd7[_0xbeb8('0xf')]===_0xbeb8('0xa')&&_0x336bd7['Variable']&&_0x336bd7[_0xbeb8('0xd')][_0xbeb8('0xb')]&&_0x336bd7[_0xbeb8('0x10')]){_0x7d8f37[_0x336bd7[_0xbeb8('0xd')]['name']['toLowerCase']()]&&_0x1e8c3f[_0xbeb8('0x8')](util['format'](_0xbeb8('0x12'),_0x336bd7[_0xbeb8('0x10')],_0x7d8f37[_0x336bd7[_0xbeb8('0xd')]['name'][_0xbeb8('0xc')]()]));}}}}return _0x1e8c3f[_0xbeb8('0x14')](_0x16aa82);};exports[_0xbeb8('0x15')]=function(_0x31a44a){var _0x23bb2f=_0x31a44a[_0xbeb8('0x16')](-0x1);if(_0x23bb2f==='/'){_0x31a44a=_0x31a44a['substring'](0x0,_0x31a44a[_0xbeb8('0x17')](_0x23bb2f));}return _0x31a44a;};exports[_0xbeb8('0x18')]=function(_0xe9f7c0){if(!_[_0xbeb8('0x19')](_0xe9f7c0)&&_0xe9f7c0!==''){var _0x3137ae=/^(([^<>()\[\]\\.,;:\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 _0x3137ae[_0xbeb8('0x1a')](String(_0xe9f7c0)[_0xbeb8('0xc')]());}else{return![];}}; \ No newline at end of file +var _0xd03c=['push','content','variable','variableName','toString','Variable','name','toLowerCase','keyValue','keyType','string','key','format','%s:\x20%s','customVariable','stripTrailingSlash','slice','lastIndexOf','validateEmail','lodash','util','getString','length','sortBy','type'];(function(_0x352b8d,_0x440622){var _0x6d658d=function(_0x83f47a){while(--_0x83f47a){_0x352b8d['push'](_0x352b8d['shift']());}};_0x6d658d(++_0x440622);}(_0xd03c,0x1d5));var _0xcd03=function(_0x4b9af7,_0x5beb2c){_0x4b9af7=_0x4b9af7-0x0;var _0x37207d=_0xd03c[_0x4b9af7];return _0x37207d;};'use strict';var _=require(_0xcd03('0x0'));var util=require(_0xcd03('0x1'));exports[_0xcd03('0x2')]=function(_0x19a9aa,_0x311a44,_0x288e17){var _0x22e605=[];if(_0x19a9aa[_0xcd03('0x3')]>0x0){var _0xfc1e59=_[_0xcd03('0x4')](_0x19a9aa,['id']);for(var _0x1b4d1f=0x0;_0x1b4d1f<_0xfc1e59[_0xcd03('0x3')];_0x1b4d1f++){var _0x293e79=_0xfc1e59[_0x1b4d1f];if(_0x293e79[_0xcd03('0x5')]==='string'){_0x22e605[_0xcd03('0x6')](_0x293e79[_0xcd03('0x7')]);}else if(_0x293e79[_0xcd03('0x5')]===_0xcd03('0x8')&&_0x293e79[_0xcd03('0x9')]){_0x311a44[_0x293e79[_0xcd03('0x9')]]&&_0x22e605['push'](_0x311a44[_0x293e79[_0xcd03('0x9')]][_0xcd03('0xa')]());}else if(_0x293e79[_0xcd03('0x5')]==='customVariable'&&_0x293e79[_0xcd03('0xb')]&&_0x293e79[_0xcd03('0xb')][_0xcd03('0xc')]){_0x311a44[_0x293e79[_0xcd03('0xb')]['name'][_0xcd03('0xd')]()]&&_0x22e605[_0xcd03('0x6')](_0x311a44[_0x293e79[_0xcd03('0xb')][_0xcd03('0xc')][_0xcd03('0xd')]()][_0xcd03('0xa')]());}else if(_0x293e79[_0xcd03('0x5')]===_0xcd03('0xe')){if(_0x293e79[_0xcd03('0xf')]===_0xcd03('0x10')&&_0x293e79[_0xcd03('0x11')]){_0x22e605[_0xcd03('0x6')](util[_0xcd03('0x12')](_0xcd03('0x13'),_0x293e79['key'],_0x293e79['keyContent']));}else if(_0x293e79[_0xcd03('0xf')]===_0xcd03('0x8')&&_0x293e79[_0xcd03('0x9')]&&_0x293e79[_0xcd03('0x11')]){_0x311a44[_0x293e79[_0xcd03('0x9')]]&&_0x22e605['push'](util['format'](_0xcd03('0x13'),_0x293e79[_0xcd03('0x11')],_0x311a44[_0x293e79[_0xcd03('0x9')]]));}else if(_0x293e79[_0xcd03('0xf')]===_0xcd03('0x14')&&_0x293e79[_0xcd03('0xb')]&&_0x293e79[_0xcd03('0xb')][_0xcd03('0xc')]&&_0x293e79[_0xcd03('0x11')]){_0x311a44[_0x293e79[_0xcd03('0xb')][_0xcd03('0xc')][_0xcd03('0xd')]()]&&_0x22e605[_0xcd03('0x6')](util['format'](_0xcd03('0x13'),_0x293e79[_0xcd03('0x11')],_0x311a44[_0x293e79[_0xcd03('0xb')][_0xcd03('0xc')][_0xcd03('0xd')]()]));}}}}return _0x22e605['join'](_0x288e17);};exports[_0xcd03('0x15')]=function(_0x1b5408){var _0xeaad61=_0x1b5408[_0xcd03('0x16')](-0x1);if(_0xeaad61==='/'){_0x1b5408=_0x1b5408['substring'](0x0,_0x1b5408[_0xcd03('0x17')](_0xeaad61));}return _0x1b5408;};exports[_0xcd03('0x18')]=function(_0x1b414d){if(!_['isNil'](_0x1b414d)&&_0x1b414d!==''){var _0x446cd4=/^(([^<>()\[\]\\.,;:\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 _0x446cd4['test'](String(_0x1b414d)[_0xcd03('0xd')]());}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 82d8af2..37df93e 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 _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x41fe3a,_0x18a8f5){var _0x4cb26e=function(_0x42a987){while(--_0x42a987){_0x41fe3a['push'](_0x41fe3a['shift']());}};_0x4cb26e(++_0x18a8f5);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +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(_0x1fd4f3,_0x35a8fe){var _0x1ab246=function(_0x3b1a39){while(--_0x3b1a39){_0x1fd4f3['push'](_0x1fd4f3['shift']());}};_0x1ab246(++_0x35a8fe);}(_0x34e8,0x12c));var _0x834e=function(_0x278176,_0x56dcb1){_0x278176=_0x278176-0x0;var _0x29d62d=_0x34e8[_0x278176];return _0x29d62d;};'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 4d3b1c3..b3808db 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 _0xbab5=['calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','length','end-user','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','defaults','GET','map','forEach','includes','string','picklist','type','nameField','customField','idField','custom_fields','push','content','variable','variableName','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:'];(function(_0x359bfd,_0x47183f){var _0x3873ba=function(_0x104ddd){while(--_0x104ddd){_0x359bfd['push'](_0x359bfd['shift']());}};_0x3873ba(++_0x47183f);}(_0xbab5,0x10d));var _0x5bab=function(_0x1386c6,_0x114069){_0x1386c6=_0x1386c6-0x0;var _0x1e8fd8=_0xbab5[_0x1386c6];return _0x1e8fd8;};'use strict';var _=require(_0x5bab('0x0'));var rp=require(_0x5bab('0x1'));var md5=require(_0x5bab('0x2'));var util=require(_0x5bab('0x3'));var Redis=require(_0x5bab('0x4'));var intUtil=require(_0x5bab('0x5'));var config=require(_0x5bab('0x6'));var logger=require(_0x5bab('0x7'))(_0x5bab('0x8'));config[_0x5bab('0x9')]=_['defaults'](config[_0x5bab('0x9')],{'host':_0x5bab('0xa'),'port':0x18eb});var io=require(_0x5bab('0xb'))(new Redis(config[_0x5bab('0x9')]));function emit(_0x299c06,_0x51352d,_0x4d5e0d){io['to'](_0x299c06)[_0x5bab('0xc')](_0x51352d,_0x4d5e0d);}var headers={'Content-Type':_0x5bab('0xd'),'Accept':_0x5bab('0xd')};function getTicket(_0xd2af71,_0x31de5e,_0x43e88b,_0x554414,_0x3ec0d2){logger[_0x5bab('0xe')](_0x5bab('0xf'));return request({'uri':util[_0x5bab('0x10')](_0x5bab('0x11'),_0xd2af71[_0x5bab('0x12')]),'method':_0x5bab('0x13'),'body':{'ticket':_[_0x5bab('0x14')]({'requester_id':_0x43e88b['id'],'submitter_id':_0x31de5e?_0x31de5e['id']:undefined,'assignee_id':_0x31de5e?_0x31de5e['id']:undefined,'tags':getTags(_0x554414[_0x5bab('0x15')],_0x5bab('0x16')),'subject':intUtil[_0x5bab('0x17')](_0x554414[_0x5bab('0x18')],_0x3ec0d2,'\x20'),'description':intUtil[_0x5bab('0x17')](_0x554414[_0x5bab('0x19')],_0x3ec0d2,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x554414[_0x5bab('0x19')],_0x3ec0d2,'\x0a')}},getCustomFields(_0x554414[_0x5bab('0x1a')],_0x3ec0d2))}})[_0x5bab('0x1b')](function(_0x336374){logger[_0x5bab('0xe')](_0x5bab('0x1c'));return _0x336374[_0x5bab('0x1d')];});}function getUser(_0x46c96b,_0x40f1f8){if(intUtil[_0x5bab('0x1e')](_0x40f1f8)){logger[_0x5bab('0xe')](_0x5bab('0x1f'),_0x40f1f8);return request({'uri':util[_0x5bab('0x10')](_0x5bab('0x20'),_0x46c96b[_0x5bab('0x12')]),'qs':{'query':util[_0x5bab('0x10')](_0x5bab('0x21'),_0x40f1f8)}})[_0x5bab('0x1b')](function(_0x338bde){if(_0x338bde['count']){logger[_0x5bab('0xe')]('Agent\x20found!');return _[_0x5bab('0x22')](_0x338bde['results'],{'email':_0x40f1f8,'role':_0x5bab('0x23')});}else{logger[_0x5bab('0xe')](_0x5bab('0x24'));return request({'uri':util[_0x5bab('0x10')]('%s/users/me.json',_0x46c96b['remoteUri'])})[_0x5bab('0x1b')](function(_0x2671a6){logger['info'](_0x5bab('0x25'));return _0x2671a6[_0x5bab('0x26')];});}});}else{logger[_0x5bab('0xe')](_0x5bab('0x24'));return request({'uri':util[_0x5bab('0x10')](_0x5bab('0x27'),_0x46c96b[_0x5bab('0x12')])})['then'](function(_0x36c008){logger[_0x5bab('0xe')](_0x5bab('0x25'));return _0x36c008['user'];});}}function getEndUser(_0xacbe8a,_0x5ee520,_0x85e780){logger[_0x5bab('0xe')](_0x5bab('0x28'),_0x85e780);return request({'uri':util[_0x5bab('0x10')](_0x5bab('0x20'),_0xacbe8a[_0x5bab('0x12')]),'qs':{'query':util[_0x5bab('0x10')](_0x5bab('0x29'),_0x85e780)}})[_0x5bab('0x1b')](function(_0xae2605){var _0x2e4ec8;if(_0xae2605[_0x5bab('0x2a')][_0x5bab('0x2b')]){_0xae2605[_0x5bab('0x2a')]=_['filter'](_0xae2605['results'],{'suspended':![],'role':_0x5bab('0x2c')});if(_0xae2605[_0x5bab('0x2a')][_0x5bab('0x2b')]){_0x2e4ec8=_['first'](_0xae2605[_0x5bab('0x2a')]);}}if(_0x2e4ec8){logger['info']('Enduser\x20found!');return _0x2e4ec8;}else{logger['info'](_0x5bab('0x2d'));return request({'uri':util[_0x5bab('0x10')](_0x5bab('0x2e'),_0xacbe8a[_0x5bab('0x12')]),'method':'POST','body':{'user':{'role':_0x5bab('0x2c'),'name':util[_0x5bab('0x10')](_0x5bab('0x2f'),_0x5ee520||_0x85e780),'phone':_0x85e780}}})[_0x5bab('0x1b')](function(_0x296759){logger[_0x5bab('0xe')](_0x5bab('0x30'));return _0x296759[_0x5bab('0x26')];});}});}function getAuth(_0x387366){var _0x214636;if(_0x387366[_0x5bab('0x31')]===_0x5bab('0x32')){_0x214636=util[_0x5bab('0x10')](_0x5bab('0x33'),_0x387366['username'],_0x387366['password']);}else if(_0x387366['authType']===_0x5bab('0x34')){_0x214636=util[_0x5bab('0x10')](_0x5bab('0x35'),_0x387366['username'],_0x387366[_0x5bab('0x34')]);}return util['format'](_0x5bab('0x36'),new Buffer(_0x214636)[_0x5bab('0x37')](_0x5bab('0x38')));}function request(_0x3a74ab){logger[_0x5bab('0x39')](_0x5bab('0x3a'),JSON[_0x5bab('0x3b')](_0x3a74ab));return rp(_[_0x5bab('0x3c')](_0x3a74ab,{'method':_0x5bab('0x3d'),'headers':headers,'json':!![]}));}function getTags(_0x30927c,_0x32a125){var _0x4c13e1=[];if(_0x30927c&&_0x30927c[_0x5bab('0x2b')]>0x0){_0x4c13e1=_[_0x5bab('0x3e')](_0x30927c,_0x32a125);}return _0x4c13e1;}function getCustomFields(_0x38d387,_0x2b7ff4){var _0x317642=[];var _0x2a1950={'custom_fields':[]};if(_0x38d387[_0x5bab('0x2b')]>0x0){_[_0x5bab('0x3f')](_0x38d387,function(_0x2cf2ee){if(_[_0x5bab('0x40')]([_0x5bab('0x41'),_0x5bab('0x42')],_0x2cf2ee[_0x5bab('0x43')])&&_0x2cf2ee[_0x5bab('0x44')]&&!_0x2cf2ee[_0x5bab('0x45')]){_0x2a1950[_0x2cf2ee[_0x5bab('0x44')]['toLowerCase']()]=_0x2cf2ee['content'][_0x5bab('0x37')]();}else if(_['includes'](['string',_0x5bab('0x42')],_0x2cf2ee[_0x5bab('0x43')])&&_0x2cf2ee[_0x5bab('0x46')]&&_0x2cf2ee[_0x5bab('0x45')]){_0x2a1950[_0x5bab('0x47')][_0x5bab('0x48')]({'id':_0x2cf2ee[_0x5bab('0x46')],'value':_0x2cf2ee[_0x5bab('0x49')][_0x5bab('0x37')]()});}else if(_0x2cf2ee[_0x5bab('0x43')]===_0x5bab('0x4a')&&_0x2cf2ee['variableName']&&_0x2cf2ee[_0x5bab('0x46')]&&_0x2cf2ee[_0x5bab('0x45')]){_0x2b7ff4[_0x2cf2ee[_0x5bab('0x4b')]]&&_0x2a1950['custom_fields'][_0x5bab('0x48')]({'id':_0x2cf2ee['idField'],'value':_0x2b7ff4[_0x2cf2ee[_0x5bab('0x4b')]][_0x5bab('0x37')]()});}else if(_0x2cf2ee['type']==='customVariable'&&_0x2cf2ee['Variable']&&_0x2cf2ee['Variable'][_0x5bab('0x16')]&&_0x2cf2ee[_0x5bab('0x46')]&&_0x2cf2ee[_0x5bab('0x45')]){_0x2b7ff4[_0x2cf2ee[_0x5bab('0x4c')][_0x5bab('0x16')][_0x5bab('0x4d')]()]&&_0x2a1950['custom_fields'][_0x5bab('0x48')]({'id':_0x2cf2ee[_0x5bab('0x46')],'value':_0x2b7ff4[_0x2cf2ee[_0x5bab('0x4c')][_0x5bab('0x16')][_0x5bab('0x4d')]()][_0x5bab('0x37')]()});}});}return _0x2a1950;}exports[_0x5bab('0x4e')]=function(_0x4e21ef,_0x63d0d1,_0x138f9a,_0x59447e,_0x45ea86,_0x1eac06){var _0x135024,_0xd73945;_0x1eac06[_0x5bab('0x12')]=intUtil[_0x5bab('0x4f')](_0x1eac06[_0x5bab('0x12')]);_0x1eac06[_0x5bab('0x50')]=intUtil[_0x5bab('0x4f')](_0x1eac06['serverUrl']);if(_0x45ea86&&_0x45ea86['monitor_format']){logger[_0x5bab('0xe')](_0x5bab('0x51'),_0x5bab('0x52'));_0x63d0d1['recordingURL']=util[_0x5bab('0x10')](_0x5bab('0x53'),_0x1eac06['serverUrl'],_0x63d0d1[_0x5bab('0x54')],md5(_0x63d0d1[_0x5bab('0x54')]));}else{_0x63d0d1[_0x5bab('0x55')]='';}headers[_0x5bab('0x56')]=getAuth(_0x1eac06);return getUser(_0x1eac06,_0x59447e['email'])['then'](function(_0x39b8b7){_0x135024=_0x39b8b7;logger[_0x5bab('0xe')](_0x5bab('0x57'),_0x135024['id']);return getEndUser(_0x1eac06,_0x63d0d1[_0x5bab('0x58')],_0x63d0d1[_0x5bab('0x59')]);})['then'](function(_0x215ad6){_0xd73945=_0x215ad6;logger['info'](_0x5bab('0x5a'),_0xd73945['id']);return getTicket(_0x1eac06,_0x135024,_0xd73945,_0x138f9a,_0x63d0d1);})[_0x5bab('0x1b')](function(_0x248783){if(_0x248783){logger[_0x5bab('0xe')](_0x5bab('0x5b'),_0x248783['id']);switch(_0x1eac06['type']){case _0x5bab('0x5c'):logger[_0x5bab('0xe')](_0x5bab('0x51'),_0x5bab('0x5d'));return request({'uri':util[_0x5bab('0x10')](_0x5bab('0x5e'),_0x1eac06[_0x5bab('0x12')],_0x135024['id'],_0x248783['id']),'method':'POST'});case _0x5bab('0x5f'):logger[_0x5bab('0xe')](_0x5bab('0x51'),_0x5bab('0x60'));emit(util[_0x5bab('0x10')](_0x5bab('0x61'),_0x59447e[_0x5bab('0x16')]),_0x5bab('0x62'),{'uri':util[_0x5bab('0x10')](_0x5bab('0x63'),_0x1eac06['remoteUri'][_0x5bab('0x64')](_0x5bab('0x65'),''),_0x248783['id'])});break;default:logger[_0x5bab('0x66')](_0x5bab('0x51'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x5bab('0x67')](function(_0x5a44f3){logger[_0x5bab('0x66')](_0x5bab('0x68'),util[_0x5bab('0x69')](_0x5a44f3,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x4de7db,_0x15af9a,_0x45f759,_0x4a0814,_0x860563,_0x567cd0,_0x3a2782){var _0xfd687b,_0x3026be;_0x567cd0['remoteUri']=intUtil[_0x5bab('0x4f')](_0x567cd0[_0x5bab('0x12')]);_0x567cd0[_0x5bab('0x50')]=intUtil[_0x5bab('0x4f')](_0x567cd0[_0x5bab('0x50')]);if(_0x3a2782&&_0x3a2782[_0x5bab('0x6a')]&&_0x3a2782[_0x5bab('0x6a')]!==_0x5bab('0x6b')){logger[_0x5bab('0xe')](_0x5bab('0x6c'),_0x5bab('0x52'));_0x15af9a['recordingURL']=util[_0x5bab('0x10')](_0x5bab('0x53'),_0x567cd0['serverUrl'],_0x15af9a[_0x5bab('0x54')],md5(_0x15af9a[_0x5bab('0x54')]));}headers[_0x5bab('0x56')]=getAuth(_0x567cd0);return getUser(_0x567cd0,_0x4a0814[_0x5bab('0x6d')])[_0x5bab('0x1b')](function(_0x4436e5){_0xfd687b=_0x4436e5;logger[_0x5bab('0xe')](_0x5bab('0x57'),_0xfd687b['id']);return getEndUser(_0x567cd0,_0x15af9a[_0x5bab('0x6e')],_0x15af9a[_0x5bab('0x6f')]);})[_0x5bab('0x1b')](function(_0x4d59c5){_0x3026be=_0x4d59c5;logger['info'](_0x5bab('0x5a'),_0x3026be['id']);return getTicket(_0x567cd0,_0xfd687b,_0x3026be,_0x45f759,_0x15af9a);})[_0x5bab('0x1b')](function(_0x2ea735){if(_0x2ea735){logger['info'](_0x5bab('0x5b'),_0x2ea735['id']);switch(_0x567cd0[_0x5bab('0x43')]){case'integrationTab':logger['info'](_0x5bab('0x6c'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x5bab('0x10')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x567cd0[_0x5bab('0x12')],_0xfd687b['id'],_0x2ea735['id']),'method':_0x5bab('0x13')});case _0x5bab('0x5f'):logger[_0x5bab('0xe')](_0x5bab('0x6c'),_0x5bab('0x60'));emit(util[_0x5bab('0x10')]('user:%s',_0x4a0814[_0x5bab('0x16')]),'trigger:browser:url',{'uri':util['format'](_0x5bab('0x63'),_0x567cd0[_0x5bab('0x12')]['replace'](_0x5bab('0x65'),''),_0x2ea735['id'])});break;default:logger[_0x5bab('0x66')]('[OUTBOUND]',_0x5bab('0x70'));}}})['catch'](function(_0x2c3f8e){logger[_0x5bab('0x66')](_0x5bab('0x71'),util[_0x5bab('0x69')](_0x2c3f8e,{'showHidden':!![],'depth':null}));});};exports[_0x5bab('0x72')]=function(_0x30e882,_0x6f1574,_0x675479,_0x56b50d,_0xa56e7f,_0x473271){var _0x2f875d,_0x12a0a0;_0x473271['remoteUri']=intUtil[_0x5bab('0x4f')](_0x473271[_0x5bab('0x12')]);_0x473271[_0x5bab('0x50')]=intUtil[_0x5bab('0x4f')](_0x473271['serverUrl']);if(_0xa56e7f&&_0xa56e7f[_0x5bab('0x73')]){logger[_0x5bab('0xe')]('['+_0x6f1574[_0x5bab('0x74')][_0x5bab('0x75')]()+']',_0x5bab('0x52'));_0x6f1574[_0x5bab('0x55')]=util[_0x5bab('0x10')](_0x5bab('0x53'),_0x473271[_0x5bab('0x50')],_0x6f1574['uniqueid'],md5(_0x6f1574['uniqueid']));}else{_0x6f1574[_0x5bab('0x55')]='';}headers[_0x5bab('0x56')]=getAuth(_0x473271);return getUser(_0x473271)['then'](function(_0x4b34f4){_0x2f875d=_0x4b34f4;logger[_0x5bab('0xe')](_0x5bab('0x57'),_0x2f875d['id']);return getEndUser(_0x473271,_0x6f1574[_0x5bab('0x58')],_0x6f1574[_0x5bab('0x59')]);})[_0x5bab('0x1b')](function(_0x295712){_0x12a0a0=_0x295712;logger[_0x5bab('0xe')](_0x5bab('0x5a'),_0x12a0a0['id']);return getTicket(_0x473271,_0x2f875d,_0x12a0a0,_0x675479,_0x6f1574);})[_0x5bab('0x1b')](function(_0x1aa465){if(_0x1aa465){logger[_0x5bab('0xe')](_0x5bab('0x5b'),_0x1aa465['id']);}})[_0x5bab('0x67')](function(_0x24b230){logger['error']('['+_0x6f1574[_0x5bab('0x74')][_0x5bab('0x75')]()+']'+_0x5bab('0x76'),util[_0x5bab('0x69')](_0x24b230,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xf9dd=['Tags','name','Subjects','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','%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','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','base64','debug','[HTTP]','stringify','GET','forEach','string','picklist','nameField','toLowerCase','content','toString','includes','type','idField','customField','variable','variableName','custom_fields','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridnum','[OUTBOUND]','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','merge'];(function(_0x30a772,_0x5958db){var _0xf316c8=function(_0x1394b1){while(--_0x1394b1){_0x30a772['push'](_0x30a772['shift']());}};_0xf316c8(++_0x5958db);}(_0xf9dd,0x1c2));var _0xdf9d=function(_0x1b53b7,_0x1d0fc3){_0x1b53b7=_0x1b53b7-0x0;var _0x1f8628=_0xf9dd[_0x1b53b7];return _0x1f8628;};'use strict';var _=require(_0xdf9d('0x0'));var rp=require('request-promise');var md5=require(_0xdf9d('0x1'));var util=require(_0xdf9d('0x2'));var Redis=require(_0xdf9d('0x3'));var intUtil=require(_0xdf9d('0x4'));var config=require(_0xdf9d('0x5'));var logger=require(_0xdf9d('0x6'))(_0xdf9d('0x7'));config[_0xdf9d('0x8')]=_['defaults'](config[_0xdf9d('0x8')],{'host':_0xdf9d('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x78a498,_0x3a7f7e,_0x300ef4){io['to'](_0x78a498)[_0xdf9d('0xa')](_0x3a7f7e,_0x300ef4);}var headers={'Content-Type':_0xdf9d('0xb'),'Accept':_0xdf9d('0xb')};function getTicket(_0x41c35f,_0x550925,_0x42dc2a,_0x526a46,_0x5ace86){logger[_0xdf9d('0xc')](_0xdf9d('0xd'));return request({'uri':util['format'](_0xdf9d('0xe'),_0x41c35f[_0xdf9d('0xf')]),'method':_0xdf9d('0x10'),'body':{'ticket':_[_0xdf9d('0x11')]({'requester_id':_0x42dc2a['id'],'submitter_id':_0x550925?_0x550925['id']:undefined,'assignee_id':_0x550925?_0x550925['id']:undefined,'tags':getTags(_0x526a46[_0xdf9d('0x12')],_0xdf9d('0x13')),'subject':intUtil['getString'](_0x526a46[_0xdf9d('0x14')],_0x5ace86,'\x20'),'description':intUtil[_0xdf9d('0x15')](_0x526a46[_0xdf9d('0x16')],_0x5ace86,'\x0a'),'comment':{'public':![],'body':intUtil[_0xdf9d('0x15')](_0x526a46[_0xdf9d('0x16')],_0x5ace86,'\x0a')}},getCustomFields(_0x526a46[_0xdf9d('0x17')],_0x5ace86))}})[_0xdf9d('0x18')](function(_0x2318a1){logger['info'](_0xdf9d('0x19'));return _0x2318a1[_0xdf9d('0x1a')];});}function getUser(_0x292847,_0x3b1031){if(intUtil[_0xdf9d('0x1b')](_0x3b1031)){logger[_0xdf9d('0xc')](_0xdf9d('0x1c'),_0x3b1031);return request({'uri':util[_0xdf9d('0x1d')](_0xdf9d('0x1e'),_0x292847['remoteUri']),'qs':{'query':util[_0xdf9d('0x1d')](_0xdf9d('0x1f'),_0x3b1031)}})[_0xdf9d('0x18')](function(_0x594fab){if(_0x594fab[_0xdf9d('0x20')]){logger['info'](_0xdf9d('0x21'));return _[_0xdf9d('0x22')](_0x594fab[_0xdf9d('0x23')],{'email':_0x3b1031,'role':_0xdf9d('0x24')});}else{logger[_0xdf9d('0xc')](_0xdf9d('0x25'));return request({'uri':util[_0xdf9d('0x1d')](_0xdf9d('0x26'),_0x292847['remoteUri'])})[_0xdf9d('0x18')](function(_0x3ec6e2){logger[_0xdf9d('0xc')](_0xdf9d('0x27'));return _0x3ec6e2[_0xdf9d('0x28')];});}});}else{logger[_0xdf9d('0xc')](_0xdf9d('0x25'));return request({'uri':util['format'](_0xdf9d('0x26'),_0x292847[_0xdf9d('0xf')])})[_0xdf9d('0x18')](function(_0x3f8096){logger[_0xdf9d('0xc')](_0xdf9d('0x27'));return _0x3f8096[_0xdf9d('0x28')];});}}function getEndUser(_0x1b025b,_0x293ee2,_0x4082ff){logger['info'](_0xdf9d('0x29'),_0x4082ff);return request({'uri':util[_0xdf9d('0x1d')]('%s/search.json',_0x1b025b['remoteUri']),'qs':{'query':util[_0xdf9d('0x1d')](_0xdf9d('0x2a'),_0x4082ff)}})[_0xdf9d('0x18')](function(_0x597d0e){var _0x3fb4ec;if(_0x597d0e[_0xdf9d('0x23')][_0xdf9d('0x2b')]){_0x597d0e['results']=_[_0xdf9d('0x2c')](_0x597d0e[_0xdf9d('0x23')],{'suspended':![],'role':_0xdf9d('0x2d')});if(_0x597d0e[_0xdf9d('0x23')][_0xdf9d('0x2b')]){_0x3fb4ec=_[_0xdf9d('0x2e')](_0x597d0e['results']);}}if(_0x3fb4ec){logger[_0xdf9d('0xc')](_0xdf9d('0x2f'));return _0x3fb4ec;}else{logger[_0xdf9d('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xdf9d('0x1d')](_0xdf9d('0x30'),_0x1b025b[_0xdf9d('0xf')]),'method':_0xdf9d('0x10'),'body':{'user':{'role':_0xdf9d('0x2d'),'name':util[_0xdf9d('0x1d')](_0xdf9d('0x31'),_0x293ee2||_0x4082ff),'phone':_0x4082ff}}})[_0xdf9d('0x18')](function(_0x358b3e){logger[_0xdf9d('0xc')](_0xdf9d('0x32'));return _0x358b3e['user'];});}});}function getAuth(_0x668654){var _0x341980;if(_0x668654[_0xdf9d('0x33')]==='password'){_0x341980=util[_0xdf9d('0x1d')](_0xdf9d('0x34'),_0x668654[_0xdf9d('0x35')],_0x668654['password']);}else if(_0x668654[_0xdf9d('0x33')]===_0xdf9d('0x36')){_0x341980=util[_0xdf9d('0x1d')](_0xdf9d('0x37'),_0x668654[_0xdf9d('0x35')],_0x668654['token']);}return util[_0xdf9d('0x1d')](_0xdf9d('0x38'),new Buffer(_0x341980)['toString'](_0xdf9d('0x39')));}function request(_0x4139d4){logger[_0xdf9d('0x3a')](_0xdf9d('0x3b'),JSON[_0xdf9d('0x3c')](_0x4139d4));return rp(_['defaults'](_0x4139d4,{'method':_0xdf9d('0x3d'),'headers':headers,'json':!![]}));}function getTags(_0x52e1ba,_0x30ec85){var _0x589343=[];if(_0x52e1ba&&_0x52e1ba['length']>0x0){_0x589343=_['map'](_0x52e1ba,_0x30ec85);}return _0x589343;}function getCustomFields(_0x4a0408,_0x3150ba){var _0x254d48=[];var _0x45b21d={'custom_fields':[]};if(_0x4a0408[_0xdf9d('0x2b')]>0x0){_[_0xdf9d('0x3e')](_0x4a0408,function(_0x44c538){if(_['includes']([_0xdf9d('0x3f'),_0xdf9d('0x40')],_0x44c538['type'])&&_0x44c538['nameField']&&!_0x44c538['customField']){_0x45b21d[_0x44c538[_0xdf9d('0x41')][_0xdf9d('0x42')]()]=_0x44c538[_0xdf9d('0x43')][_0xdf9d('0x44')]();}else if(_[_0xdf9d('0x45')]([_0xdf9d('0x3f'),_0xdf9d('0x40')],_0x44c538[_0xdf9d('0x46')])&&_0x44c538[_0xdf9d('0x47')]&&_0x44c538[_0xdf9d('0x48')]){_0x45b21d['custom_fields']['push']({'id':_0x44c538[_0xdf9d('0x47')],'value':_0x44c538[_0xdf9d('0x43')][_0xdf9d('0x44')]()});}else if(_0x44c538['type']===_0xdf9d('0x49')&&_0x44c538[_0xdf9d('0x4a')]&&_0x44c538[_0xdf9d('0x47')]&&_0x44c538[_0xdf9d('0x48')]){_0x3150ba[_0x44c538[_0xdf9d('0x4a')]]&&_0x45b21d[_0xdf9d('0x4b')][_0xdf9d('0x4c')]({'id':_0x44c538[_0xdf9d('0x47')],'value':_0x3150ba[_0x44c538[_0xdf9d('0x4a')]][_0xdf9d('0x44')]()});}else if(_0x44c538[_0xdf9d('0x46')]===_0xdf9d('0x4d')&&_0x44c538[_0xdf9d('0x4e')]&&_0x44c538['Variable'][_0xdf9d('0x13')]&&_0x44c538[_0xdf9d('0x47')]&&_0x44c538[_0xdf9d('0x48')]){_0x3150ba[_0x44c538[_0xdf9d('0x4e')][_0xdf9d('0x13')][_0xdf9d('0x42')]()]&&_0x45b21d[_0xdf9d('0x4b')][_0xdf9d('0x4c')]({'id':_0x44c538[_0xdf9d('0x47')],'value':_0x3150ba[_0x44c538['Variable'][_0xdf9d('0x13')][_0xdf9d('0x42')]()]['toString']()});}});}return _0x45b21d;}exports[_0xdf9d('0x4f')]=function(_0x33716b,_0x77f959,_0x32f86d,_0x89ead4,_0xfabe68,_0x1d97fc){var _0x38283f,_0x42261f;_0x1d97fc['remoteUri']=intUtil[_0xdf9d('0x50')](_0x1d97fc[_0xdf9d('0xf')]);_0x1d97fc['serverUrl']=intUtil[_0xdf9d('0x50')](_0x1d97fc[_0xdf9d('0x51')]);if(_0xfabe68&&_0xfabe68[_0xdf9d('0x52')]){logger[_0xdf9d('0xc')]('[QUEUE]','Recording\x20is\x20enabled!');_0x77f959['recordingURL']=util[_0xdf9d('0x1d')](_0xdf9d('0x53'),_0x1d97fc[_0xdf9d('0x51')],_0x77f959['uniqueid'],md5(_0x77f959[_0xdf9d('0x54')]));}else{_0x77f959[_0xdf9d('0x55')]='';}headers[_0xdf9d('0x56')]=getAuth(_0x1d97fc);return getUser(_0x1d97fc,_0x89ead4[_0xdf9d('0x57')])['then'](function(_0x2c138d){_0x38283f=_0x2c138d;logger[_0xdf9d('0xc')]('The\x20User\x20ID\x20is:',_0x38283f['id']);return getEndUser(_0x1d97fc,_0x77f959[_0xdf9d('0x58')],_0x77f959[_0xdf9d('0x59')]);})[_0xdf9d('0x18')](function(_0x2fd620){_0x42261f=_0x2fd620;logger[_0xdf9d('0xc')](_0xdf9d('0x5a'),_0x42261f['id']);return getTicket(_0x1d97fc,_0x38283f,_0x42261f,_0x32f86d,_0x77f959);})['then'](function(_0x1b2f6b){if(_0x1b2f6b){logger[_0xdf9d('0xc')](_0xdf9d('0x5b'),_0x1b2f6b['id']);switch(_0x1d97fc['type']){case _0xdf9d('0x5c'):logger['info'](_0xdf9d('0x5d'),_0xdf9d('0x5e'));return request({'uri':util[_0xdf9d('0x1d')](_0xdf9d('0x5f'),_0x1d97fc[_0xdf9d('0xf')],_0x38283f['id'],_0x1b2f6b['id']),'method':_0xdf9d('0x10')});case _0xdf9d('0x60'):logger[_0xdf9d('0xc')](_0xdf9d('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xdf9d('0x1d')](_0xdf9d('0x61'),_0x89ead4[_0xdf9d('0x13')]),_0xdf9d('0x62'),{'uri':util[_0xdf9d('0x1d')](_0xdf9d('0x63'),_0x1d97fc[_0xdf9d('0xf')][_0xdf9d('0x64')](_0xdf9d('0x65'),''),_0x1b2f6b['id'])});break;default:logger['error'](_0xdf9d('0x5d'),_0xdf9d('0x66'));}}})[_0xdf9d('0x67')](function(_0x4396e5){logger[_0xdf9d('0x68')](_0xdf9d('0x69'),util[_0xdf9d('0x6a')](_0x4396e5,{'showHidden':!![],'depth':null}));});};exports[_0xdf9d('0x6b')]=function(_0x57d798,_0x230e7e,_0x38c276,_0x1b6859,_0x594eac,_0x23c4fe,_0x15e81b){var _0x334d92,_0x3a7914;_0x23c4fe[_0xdf9d('0xf')]=intUtil[_0xdf9d('0x50')](_0x23c4fe[_0xdf9d('0xf')]);_0x23c4fe[_0xdf9d('0x51')]=intUtil['stripTrailingSlash'](_0x23c4fe[_0xdf9d('0x51')]);if(_0x15e81b&&_0x15e81b['recordingFormat']&&_0x15e81b[_0xdf9d('0x6c')]!==_0xdf9d('0x6d')){logger['info']('[OUTBOUND]',_0xdf9d('0x6e'));_0x230e7e[_0xdf9d('0x55')]=util[_0xdf9d('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x23c4fe[_0xdf9d('0x51')],_0x230e7e[_0xdf9d('0x54')],md5(_0x230e7e[_0xdf9d('0x54')]));}headers['Authorization']=getAuth(_0x23c4fe);return getUser(_0x23c4fe,_0x1b6859[_0xdf9d('0x57')])[_0xdf9d('0x18')](function(_0x3ec79b){_0x334d92=_0x3ec79b;logger[_0xdf9d('0xc')](_0xdf9d('0x6f'),_0x334d92['id']);return getEndUser(_0x23c4fe,_0x230e7e['destcalleridname'],_0x230e7e[_0xdf9d('0x70')]);})[_0xdf9d('0x18')](function(_0x212df5){_0x3a7914=_0x212df5;logger[_0xdf9d('0xc')](_0xdf9d('0x5a'),_0x3a7914['id']);return getTicket(_0x23c4fe,_0x334d92,_0x3a7914,_0x38c276,_0x230e7e);})[_0xdf9d('0x18')](function(_0x4f8185){if(_0x4f8185){logger[_0xdf9d('0xc')](_0xdf9d('0x5b'),_0x4f8185['id']);switch(_0x23c4fe['type']){case'integrationTab':logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xdf9d('0x1d')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x23c4fe[_0xdf9d('0xf')],_0x334d92['id'],_0x4f8185['id']),'method':'POST'});case _0xdf9d('0x60'):logger[_0xdf9d('0xc')](_0xdf9d('0x71'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xdf9d('0x61'),_0x1b6859[_0xdf9d('0x13')]),_0xdf9d('0x62'),{'uri':util[_0xdf9d('0x1d')]('%s/agent/tickets/%s',_0x23c4fe[_0xdf9d('0xf')][_0xdf9d('0x64')](_0xdf9d('0x65'),''),_0x4f8185['id'])});break;default:logger[_0xdf9d('0x68')](_0xdf9d('0x71'),_0xdf9d('0x66'));}}})['catch'](function(_0x3ac694){logger[_0xdf9d('0x68')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xdf9d('0x6a')](_0x3ac694,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x267e1f,_0x4c9179,_0x32c897,_0x5f40f6,_0x5eab78,_0x24181c){var _0xed50ab,_0x4f2eed;_0x24181c[_0xdf9d('0xf')]=intUtil[_0xdf9d('0x50')](_0x24181c[_0xdf9d('0xf')]);_0x24181c[_0xdf9d('0x51')]=intUtil[_0xdf9d('0x50')](_0x24181c['serverUrl']);if(_0x5eab78&&_0x5eab78['monitor_format']){logger[_0xdf9d('0xc')]('['+_0x4c9179[_0xdf9d('0x72')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x4c9179[_0xdf9d('0x55')]=util[_0xdf9d('0x1d')](_0xdf9d('0x53'),_0x24181c[_0xdf9d('0x51')],_0x4c9179['uniqueid'],md5(_0x4c9179['uniqueid']));}else{_0x4c9179['recordingURL']='';}headers[_0xdf9d('0x56')]=getAuth(_0x24181c);return getUser(_0x24181c)[_0xdf9d('0x18')](function(_0x47b9d8){_0xed50ab=_0x47b9d8;logger[_0xdf9d('0xc')](_0xdf9d('0x6f'),_0xed50ab['id']);return getEndUser(_0x24181c,_0x4c9179[_0xdf9d('0x58')],_0x4c9179[_0xdf9d('0x59')]);})[_0xdf9d('0x18')](function(_0x5e5567){_0x4f2eed=_0x5e5567;logger[_0xdf9d('0xc')](_0xdf9d('0x5a'),_0x4f2eed['id']);return getTicket(_0x24181c,_0xed50ab,_0x4f2eed,_0x32c897,_0x4c9179);})[_0xdf9d('0x18')](function(_0x437cc5){if(_0x437cc5){logger[_0xdf9d('0xc')]('The\x20Ticket\x20ID\x20is:',_0x437cc5['id']);}})[_0xdf9d('0x67')](function(_0x44a5dc){logger[_0xdf9d('0x68')]('['+_0x4c9179['lastevent'][_0xdf9d('0x73')]()+']'+_0xdf9d('0x74'),util[_0xdf9d('0x6a')](_0x44a5dc,{'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 0f54493..96f92f9 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 _0x672d=['enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','code','SUCCESS','details','moduleCreate','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','uri','lead','Creating\x20new\x20call...','Owner','Subject','Description','getString','Descriptions','Contacts','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','utc','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','Call_Result','Called','complete','connect','rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','POST','/crm/v2/Calls','Call\x20created!','err','log','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','zoho.eu','email','destcalleridname','destcalleridnum','Outbound','unmanaged','lastevent','toUpperCase','The\x20User\x20ID\x20is:','lodash','request-promise','md5','util','./util','ioredis','bluebird','../../../../config/logger','redis','socket.io-emitter','emit','[HTTP]','stringify','length','forEach','includes','string','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','isBefore','access_token','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','catch','data'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x672d,0x191));var _0xd672=function(_0x5e1fe9,_0x33eb86){_0x5e1fe9=_0x5e1fe9-0x0;var _0x1c5461=_0x672d[_0x5e1fe9];return _0x1c5461;};'use strict';var _=require(_0xd672('0x0'));var rp=require(_0xd672('0x1'));var md5=require(_0xd672('0x2'));var util=require(_0xd672('0x3'));var intUtil=require(_0xd672('0x4'));var moment=require('moment');var Redis=require(_0xd672('0x5'));var BPromise=require(_0xd672('0x6'));var config=require('../../../../config/environment');var logger=require(_0xd672('0x7'))('zoho');config[_0xd672('0x8')]=_['defaults'](config[_0xd672('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xd672('0x9'))(new Redis(config['redis']));function emit(_0x50545d,_0x2f92fc,_0x323b52){io['to'](_0x50545d)[_0xd672('0xa')](_0x2f92fc,_0x323b52);}function request(_0x5845bf){logger['debug'](_0xd672('0xb'),JSON[_0xd672('0xc')](_0x5845bf));return rp(_0x5845bf);}function getCustomFields(_0x164020,_0x160a6a){var _0x26de94={};if(_0x164020[_0xd672('0xd')]>0x0){_[_0xd672('0xe')](_0x164020,function(_0x56c393){if(_[_0xd672('0xf')]([_0xd672('0x10'),'picklist'],_0x56c393[_0xd672('0x11')])&&_0x56c393[_0xd672('0x12')]){_0x26de94[_0x56c393[_0xd672('0x12')]]=_0x56c393[_0xd672('0x13')][_0xd672('0x14')]();}else if(_0x56c393['type']===_0xd672('0x15')&&_0x56c393['variableName']&&_0x56c393['idField']&&_0x160a6a[_0x56c393[_0xd672('0x16')]]){_0x26de94[_0x56c393[_0xd672('0x12')]]=_0x160a6a[_0x56c393[_0xd672('0x16')]][_0xd672('0x14')]();}else if(_0x56c393['type']===_0xd672('0x17')&&_0x56c393['Variable']&&_0x56c393[_0xd672('0x18')][_0xd672('0x19')]&&_0x56c393[_0xd672('0x12')]&&_0x160a6a[_0x56c393[_0xd672('0x18')][_0xd672('0x19')][_0xd672('0x1a')]()]){_0x26de94[_0x56c393[_0xd672('0x12')]]=_0x160a6a[_0x56c393['Variable'][_0xd672('0x19')][_0xd672('0x1a')]()][_0xd672('0x14')]();}});}return _0x26de94;}function getName(_0x167613){if(_0x167613['indexOf']('\x20')>0x0){var _0x2bd57f=_0x167613[_0xd672('0x1b')](/ (.+)/);if(_0x2bd57f[0x1]){return _0x2bd57f;}}return[_0x167613,_0x167613];}var accountsTokens={};function getAccessToken(_0xfeab9b){return new Promise(function(_0xf938d3,_0x54cbfd){if(!_['isNil'](accountsTokens[_0xfeab9b['id']])&&!_[_0xd672('0x1c')](accountsTokens[_0xfeab9b['id']]['access_token'])){if(moment()[_0xd672('0x1d')](accountsTokens[_0xfeab9b['id']]['expires_in'])){_0xf938d3(accountsTokens[_0xfeab9b['id']][_0xd672('0x1e')]);}}var _0x21b697;switch(_0xfeab9b[_0xd672('0x1f')]){case'US':_0x21b697='https://accounts.zoho.com';break;case'AU':_0x21b697=_0xd672('0x20');break;case'EU':_0x21b697='https://accounts.zoho.eu';break;case'IN':_0x21b697=_0xd672('0x21');break;case'CN':_0x21b697=_0xd672('0x22');break;default:_0x21b697=_0xd672('0x23');break;}var _0x5cd2eb={'method':'POST','uri':_0x21b697+_0xd672('0x24'),'qs':{'refresh_token':_0xfeab9b[_0xd672('0x25')],'client_id':_0xfeab9b[_0xd672('0x26')],'client_secret':_0xfeab9b[_0xd672('0x27')],'grant_type':_0xd672('0x28')},'json':!![]};return rp(_0x5cd2eb)[_0xd672('0x29')](function(_0x119909){accountsTokens[_0xfeab9b['id']]={'access_token':_0x119909[_0xd672('0x1e')],'expires_in':moment()[_0xd672('0x2a')](_0x119909['expires_in'],_0xd672('0x2b'))};_0xf938d3(_0x119909[_0xd672('0x1e')]);})['catch'](function(_0x95f48c){logger[_0xd672('0x2c')](_0xd672('0x2d'),_0x95f48c[_0xd672('0x2e')]);_0x54cbfd(_0x95f48c);});});}function getUser(_0x3b02d7,_0x261284,_0x452f70,_0x386f05){logger[_0xd672('0x2f')]('Search\x20user');return request({'method':_0xd672('0x30'),'uri':util[_0xd672('0x31')](_0xd672('0x32'),_0x261284),'qs':{'type':_0xd672('0x33')},'headers':{'Authorization':_0xd672('0x34')+_0x3b02d7},'json':!![]})[_0xd672('0x29')](function(_0x19bc3a){if(_0x19bc3a[_0xd672('0x35')]){var _0x2f78a9=-0x1;if(_[_0xd672('0x36')](_0x19bc3a['users'])){if(!_[_0xd672('0x1c')](_0x386f05)){_0x2f78a9=_[_0xd672('0x37')](_0x19bc3a[_0xd672('0x35')],function(_0x12feb2){return _0x12feb2['email']===_0x386f05;});}if(_0x2f78a9>=0x0){logger[_0xd672('0x2f')](_0xd672('0x38'));}else{logger[_0xd672('0x2f')](_0xd672('0x39'));_0x2f78a9=_[_0xd672('0x37')](_0x19bc3a['users'],function(_0x1804a4){return _0x1804a4[_0xd672('0x3a')][_0xd672('0x19')]===_0xd672('0x3b');});}return _0x19bc3a['users'][_0x2f78a9];}else{if(_0x19bc3a[_0xd672('0x3c')][_0xd672('0x3a')][_0xd672('0x19')]==='Administrator'){logger[_0xd672('0x2f')](_0xd672('0x39'));user=_0x19bc3a['user'];return user;}else{logger[_0xd672('0x2c')](_0xd672('0x3d'),JSON['stringify'](_0x19bc3a));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x19bc3a));}}}else{logger[_0xd672('0x2c')]('The\x20failing\x20result\x20is',JSON[_0xd672('0xc')](_0x19bc3a));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xd672('0xc')](_0x19bc3a));}})[_0xd672('0x3e')](function(_0x329296){console['error'](_0x329296);});}function getZohoUser(_0xf20d0b,_0x25a8d8){return new BPromise(function(_0x2e9c79,_0x48a90b){request(_0xf20d0b)['then'](function(_0x212c64){var _0x34a1e0=null;if(_0x212c64){_0x34a1e0=_0x212c64[_0xd672('0x3f')][0x0];_0x34a1e0[_0xd672('0x40')]=_0x25a8d8;}_0x2e9c79(_0x34a1e0);})[_0xd672('0x3e')](function(_0x28997b){_0x48a90b(_0x28997b);});});}function createEndUser(_0x27a542,_0x5e94fb,_0x1c23a6,_0x2144ec,_0x427f21,_0x3bd482){var _0x1c23a6=getName(_0x1c23a6);return request({'method':'POST','uri':_0xd672('0x41')+_0x5e94fb+_0xd672('0x42')+_[_0xd672('0x43')](_0x3bd482['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x1c23a6[0x1],'First_Name':_0x1c23a6[0x0],'Phone':_0x2144ec,'Owner':{'name':!_['isNil'](_0x427f21['role'][_0xd672('0x19')])?_0x427f21[_0xd672('0x44')][_0xd672('0x19')]:!_[_0xd672('0x1c')](_0x427f21[_0xd672('0x45')])?_0x427f21[_0xd672('0x45')]+'\x20'+_0x427f21[_0xd672('0x46')]:_0x427f21['last_name'],'id':_0x427f21['id']}}]},'headers':{'Authorization':_0xd672('0x34')+_0x27a542},'json':!![]})[_0xd672('0x29')](function(_0x39251f){if(_0x39251f&&_0x39251f[_0xd672('0x3f')][0x0][_0xd672('0x47')]===_0xd672('0x48')){var _0xb7185=_0x39251f['data'][0x0][_0xd672('0x49')];_0xb7185[_0xd672('0x40')]=_[_0xd672('0x43')](_0x3bd482[_0xd672('0x4a')])+'s';return _0xb7185;}logger[_0xd672('0x2c')](_0xd672('0x3d'),JSON[_0xd672('0xc')](data));throw new Error('Error:\x20'+JSON[_0xd672('0xc')](data));})[_0xd672('0x3e')](function(_0x5d2ac3){console['log']('CREATE\x20ERROR',_0x5d2ac3);});}function getEndUser(_0x956bf0,_0x1a4793,_0x25b0b3,_0x4edc34,_0x10bf26,_0x3ee964,_0x2ce1a6){var _0x1793f3={'method':_0xd672('0x30'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x956bf0},'json':!![]};switch(_0x2ce1a6[_0xd672('0x4b')]){case _0xd672('0x4c'):_0x1793f3['uri']=_0xd672('0x41')+_0x1a4793+_0xd672('0x4d')+_0x10bf26+'))';return getZohoUser(_0x1793f3,'Contacts')[_0xd672('0x29')](function(_0x36499b){if(_0x36499b)return _0x36499b;_0x1793f3['uri']='https://www.zohoapis.'+_0x1a4793+_0xd672('0x4e')+_0x10bf26+'))';return getZohoUser(_0x1793f3,_0xd672('0x4f'))[_0xd672('0x29')](function(_0x22a90c){if(_0x22a90c)return _0x22a90c;if(_0x2ce1a6[_0xd672('0x4a')]!=_0xd672('0x50')){return createEndUser(_0x956bf0,_0x1a4793,_0x4edc34,_0x10bf26,_0x3ee964,_0x2ce1a6);}else{return{};}});});break;case _0xd672('0x51'):_0x1793f3[_0xd672('0x52')]='https://www.zohoapis.'+_0x1a4793+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x10bf26+'))';return getZohoUser(_0x1793f3,'Contacts')[_0xd672('0x29')](function(_0x3e2b93){if(_0x3e2b93)return _0x3e2b93;if(_0x2ce1a6[_0xd672('0x4a')]!='nothing'){return createEndUser(_0x956bf0,_0x1a4793,_0x4edc34,_0x10bf26,_0x3ee964,_0x2ce1a6);}else{return{};}});break;case _0xd672('0x53'):_0x1793f3[_0xd672('0x52')]=_0xd672('0x41')+_0x1a4793+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x10bf26+'))';return getZohoUser(_0x1793f3,_0xd672('0x4f'))[_0xd672('0x29')](function(_0x1e401e){if(_0x1e401e)return _0x1e401e;if(_0x2ce1a6[_0xd672('0x4a')]!=_0xd672('0x50')){return createEndUser(_0x956bf0,_0x1a4793,_0x4edc34,_0x10bf26,_0x3ee964,_0x2ce1a6);}else{return{};}});break;}}function getCall(_0x5bf36c,_0x3a63b1,_0x4a7d2b,_0x154a24,_0x124436,_0x31dfb4,_0x344fae,_0x5aeaf1){logger['info'](_0xd672('0x54'));var _0x4c6370={};_0x4c6370[_0xd672('0x55')]={'name':!_['isNil'](_0x154a24[_0xd672('0x44')][_0xd672('0x19')])&&!_['isNil'](_0x154a24[_0xd672('0x3a')][_0xd672('0x19')])&&_0x154a24['profile']['name']==='administrator'?_0x154a24[_0xd672('0x44')][_0xd672('0x19')]:!_[_0xd672('0x1c')](_0x154a24[_0xd672('0x45')])?_0x154a24[_0xd672('0x45')]+'\x20'+_0x154a24[_0xd672('0x46')]:_0x154a24[_0xd672('0x46')],'id':_0x154a24['id']};_0x4c6370[_0xd672('0x56')]=intUtil['getString'](_0x31dfb4['Subjects'],_0x344fae,'\x20');_0x4c6370[_0xd672('0x57')]=intUtil[_0xd672('0x58')](_0x31dfb4[_0xd672('0x59')],_0x344fae,'\x0a');if(_0x124436['enduserType']===_0xd672('0x5a')){_0x4c6370[_0xd672('0x5b')]={'name':!_['isNil'](_0x124436['Full_Name'])?_0x124436[_0xd672('0x5c')]:!_['isNil'](_0x124436[_0xd672('0x5d')])?_0x124436[_0xd672('0x5d')]+'\x20'+_0x124436[_0xd672('0x5e')]:_0x124436['Last_Name'],'id':_0x124436['id']};}if(_0x124436['enduserType']==='Leads'){_0x4c6370['What_Id']={'name':!_[_0xd672('0x1c')](_0x124436[_0xd672('0x5c')])?_0x124436[_0xd672('0x5c')]:!_[_0xd672('0x1c')](_0x124436['First_Name'])?_0x124436['First_Name']+'\x20'+_0x124436[_0xd672('0x5e')]:_0x124436[_0xd672('0x5e')],'id':_0x124436['id']};_0x4c6370[_0xd672('0x5f')]=_[_0xd672('0x43')](_0x124436[_0xd672('0x40')]);}if(_0x344fae[_0xd672('0x60')]){_0x4c6370[_0xd672('0x61')]=moment[_0xd672('0x62')](parseInt(_0x344fae[_0xd672('0x60')])*0x3e8)[_0xd672('0x31')](_0xd672('0x63'));}else if(_0x344fae['answertime']&&_0x344fae['endtime']){_0x4c6370[_0xd672('0x61')]=moment[_0xd672('0x62')](moment(_0x344fae[_0xd672('0x64')],_0xd672('0x65'))[_0xd672('0x66')](moment(_0x344fae[_0xd672('0x67')],'YYYY-MM-DDTHH:mm:ss')))[_0xd672('0x31')]('mm:ss');}switch(_0x344fae['lastevent']){case _0xd672('0x68'):_0x4c6370[_0xd672('0x69')]=_0xd672('0x6a');break;case _0xd672('0x6b'):case _0xd672('0x6c'):_0x4c6370[_0xd672('0x69')]='Answered';break;case _0xd672('0x6d'):_0x4c6370[_0xd672('0x69')]='Rejected';break;case _0xd672('0x6e'):_0x4c6370[_0xd672('0x69')]=_0xd672('0x6f');break;case _0xd672('0x70'):_0x4c6370[_0xd672('0x69')]=_0xd672('0x71');default:}_0x4c6370[_0xd672('0x72')]=(_0x5aeaf1===_0xd672('0x73')?moment(_0x344fae[_0xd672('0x67')])[_0xd672('0x31')](_0xd672('0x65')):moment(_0x344fae[_0xd672('0x74')])[_0xd672('0x31')](_0xd672('0x65')))||moment()['format'](_0xd672('0x65'));_0x4c6370[_0xd672('0x75')]=_0x5aeaf1||_0xd672('0x76');_0x4c6370=_['merge'](_0x4c6370,getCustomFields(_0x31dfb4['Fields'],_0x344fae));return request({'method':_0xd672('0x77'),'uri':'https://www.zohoapis.'+_0x3a63b1+_0xd672('0x78'),'headers':{'Authorization':_0xd672('0x34')+_0x5bf36c},'body':{'data':[_0x4c6370]},'json':!![]})[_0xd672('0x29')](function(_0x16057d){if(_0x16057d&&_0x16057d[_0xd672('0x3f')][0x0][_0xd672('0x47')]===_0xd672('0x48')){logger['info'](_0xd672('0x79'));return{'id':_0x16057d['data'][0x0][_0xd672('0x49')]['id']};}})[_0xd672('0x3e')](function(_0x55ed8c){logger[_0xd672('0x2f')](_0xd672('0x7a'),_0x55ed8c[_0xd672('0x2e')]);console[_0xd672('0x7b')](_0xd672('0x7a'),_0x55ed8c);});}exports['queue']=function(_0x16ebec,_0x32fdb3,_0x58611c,_0x350121,_0x3afba7,_0x214be4){var _0x2e6516,_0x104788,_0x347cc5;_0x214be4[_0xd672('0x7c')]=intUtil[_0xd672('0x7d')](_0x214be4[_0xd672('0x7c')]);_0x214be4[_0xd672('0x7e')]=intUtil[_0xd672('0x7d')](_0x214be4[_0xd672('0x7e')]);if(_0x3afba7&&_0x3afba7[_0xd672('0x7f')]){logger[_0xd672('0x2f')](_0xd672('0x80'),_0xd672('0x81'));_0x32fdb3[_0xd672('0x82')]=_0x214be4[_0xd672('0x7e')]+_0xd672('0x83')+_0x32fdb3[_0xd672('0x84')]+_0xd672('0x85')+md5(_0x32fdb3[_0xd672('0x84')]);}else{_0x32fdb3['recordingURL']='';}var _0xd3c225=_0x214be4[_0xd672('0x7c')]==='zoho.eu'?'eu':_0xd672('0x86');return getAccessToken(_0x214be4)['then'](function(_0x30296f){_0x347cc5=_0x30296f;return getUser(_0x347cc5,_0xd3c225,_0x214be4,_0x350121['email']);})[_0xd672('0x29')](function(_0x50af2a){_0x2e6516=_0x50af2a;logger[_0xd672('0x2f')]('The\x20User\x20ID\x20is:',_0x2e6516['id']);return getEndUser(_0x347cc5,_0xd3c225,_0x214be4,_0x32fdb3[_0xd672('0x87')],_0x32fdb3[_0xd672('0x88')],_0x2e6516,_0x58611c);})[_0xd672('0x29')](function(_0x176d3e){_0x104788=_0x176d3e;return getCall(_0x347cc5,_0xd3c225,_0x214be4,_0x2e6516,_0x104788,_0x58611c,_0x32fdb3,_0xd672('0x76'));})[_0xd672('0x29')](function(_0x1d2ba1){if(_0x1d2ba1){logger[_0xd672('0x2f')](_0xd672('0x89'),_0x1d2ba1['id']);logger[_0xd672('0x2f')](_0xd672('0x80'),_0xd672('0x8a'));emit(util[_0xd672('0x31')](_0xd672('0x8b'),_0x350121[_0xd672('0x19')]),_0xd672('0x8c'),{'uri':_0xd672('0x8d')+_0x214be4['host']+_0xd672('0x8e')+_0x1d2ba1['id']});}})['catch'](function(_0x298039){logger[_0xd672('0x2c')]('[QUEUE]',JSON['stringify'](_0x298039));});};exports[_0xd672('0x73')]=function(_0x514a46,_0xc467d9,_0xdda9e7,_0x3c7e66,_0x2151ba,_0x2c8a30,_0x2716f8){var _0x15a69e,_0xe89fb9,_0x2a0df3;_0x2c8a30[_0xd672('0x7c')]=intUtil['stripTrailingSlash'](_0x2c8a30[_0xd672('0x7c')]);_0x2c8a30[_0xd672('0x7e')]=intUtil[_0xd672('0x7d')](_0x2c8a30[_0xd672('0x7e')]);if(_0x2716f8&&_0x2716f8[_0xd672('0x8f')]&&_0x2716f8[_0xd672('0x8f')]!==_0xd672('0x90')){logger[_0xd672('0x2f')](_0xd672('0x91'),_0xd672('0x81'));_0xc467d9[_0xd672('0x82')]=_0x2c8a30['serverUrl']+_0xd672('0x83')+_0xc467d9[_0xd672('0x84')]+_0xd672('0x85')+md5(_0xc467d9[_0xd672('0x84')]);}var _0x2d6469=_0x2c8a30[_0xd672('0x7c')]===_0xd672('0x92')?'eu':_0xd672('0x86');return getAccessToken(_0x2c8a30)[_0xd672('0x29')](function(_0x26e5d7){_0x2a0df3=_0x26e5d7;return getUser(_0x2a0df3,_0x2d6469,_0x2c8a30,_0x3c7e66[_0xd672('0x93')]);})['then'](function(_0x1af26d){_0x15a69e=_0x1af26d;logger[_0xd672('0x2f')]('The\x20User\x20ID\x20is:',_0x15a69e['id']);return getEndUser(_0x2a0df3,_0x2d6469,_0x2c8a30,_0xc467d9[_0xd672('0x94')],_0xc467d9[_0xd672('0x95')],_0x15a69e,_0xdda9e7);})['then'](function(_0x3e5b9d){_0xe89fb9=_0x3e5b9d;return getCall(_0x2a0df3,_0x2d6469,_0x2c8a30,_0x15a69e,_0xe89fb9,_0xdda9e7,_0xc467d9,_0xd672('0x96'));})[_0xd672('0x29')](function(_0x2a8d6a){if(_0x2a8d6a){logger['info'](_0xd672('0x89'),_0x2a8d6a['id']);logger[_0xd672('0x2f')](_0xd672('0x91'),_0xd672('0x8a'));emit(util[_0xd672('0x31')](_0xd672('0x8b'),_0x3c7e66['name']),_0xd672('0x8c'),{'uri':_0xd672('0x8d')+_0x2c8a30[_0xd672('0x7c')]+_0xd672('0x8e')+_0x2a8d6a['id']});}})[_0xd672('0x3e')](function(_0x4bff7f){logger[_0xd672('0x2c')](_0xd672('0x91'),JSON[_0xd672('0xc')](_0x4bff7f));});};exports[_0xd672('0x97')]=function(_0x105b4e,_0x429531,_0x104e79,_0x47c580,_0x46121d,_0x271699){var _0x423aea,_0x1b79ee,_0x12a068;_0x271699['host']=intUtil['stripTrailingSlash'](_0x271699[_0xd672('0x7c')]);_0x271699[_0xd672('0x7e')]=intUtil[_0xd672('0x7d')](_0x271699[_0xd672('0x7e')]);if(_0x46121d&&_0x46121d[_0xd672('0x7f')]){logger[_0xd672('0x2f')]('['+_0x429531[_0xd672('0x98')][_0xd672('0x99')]()+']',_0xd672('0x81'));_0x429531['recordingURL']=_0x271699[_0xd672('0x7e')]+_0xd672('0x83')+_0x429531['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x429531[_0xd672('0x84')]);}else{_0x429531[_0xd672('0x82')]='';}var _0x15caf1=_0x271699[_0xd672('0x7c')]===_0xd672('0x92')?'eu':_0xd672('0x86');return getAccessToken(_0x271699)[_0xd672('0x29')](function(_0xeec9d6){_0x12a068=_0xeec9d6;return getUser(_0x12a068,_0x15caf1,_0x271699);})[_0xd672('0x29')](function(_0x68ae31){_0x423aea=_0x68ae31;logger[_0xd672('0x2f')](_0xd672('0x9a'),_0x423aea['id']);return getEndUser(_0x12a068,_0x15caf1,_0x271699,_0x429531[_0xd672('0x87')],_0x429531['calleridnum'],_0x423aea,_0x104e79);})[_0xd672('0x29')](function(_0x3d5038){_0x1b79ee=_0x3d5038;return getCall(_0x12a068,_0x15caf1,_0x271699,_0x423aea,_0x1b79ee,_0x104e79,_0x429531,_0xd672('0x76'));})[_0xd672('0x29')](function(_0x5afaab){if(_0x5afaab){logger['info']('The\x20Call\x20ID\x20is:',_0x5afaab['id']);}})[_0xd672('0x3e')](function(_0x274ae7){logger['error']('['+_0x429531[_0xd672('0x98')]['toUpperCase']()+']',JSON[_0xd672('0xc')](_0x274ae7));});}; \ No newline at end of file +var _0xffab=['https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','SUCCESS','details','The\x20failing\x20result\x20is','Error:\x20','log','CREATE\x20ERROR','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Called','connect','Call_Result','Answered','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','Call_Type','merge','Fields','Call\x20created!','err','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','/api/voice/recordings/','com','destcalleridname','destcalleridnum','[OUTBOUND]','user:%s','https://crm.','unmanaged','toUpperCase','lodash','request-promise','md5','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','format'];(function(_0x370beb,_0x1f2e8d){var _0x526edd=function(_0x583d8d){while(--_0x583d8d){_0x370beb['push'](_0x370beb['shift']());}};_0x526edd(++_0x1f2e8d);}(_0xffab,0x1a5));var _0xbffa=function(_0x26cc1c,_0x4f6b44){_0x26cc1c=_0x26cc1c-0x0;var _0x23d79c=_0xffab[_0x26cc1c];return _0x23d79c;};'use strict';var _=require(_0xbffa('0x0'));var rp=require(_0xbffa('0x1'));var md5=require(_0xbffa('0x2'));var util=require('util');var intUtil=require(_0xbffa('0x3'));var moment=require(_0xbffa('0x4'));var Redis=require('ioredis');var BPromise=require(_0xbffa('0x5'));var config=require(_0xbffa('0x6'));var logger=require(_0xbffa('0x7'))(_0xbffa('0x8'));config[_0xbffa('0x9')]=_[_0xbffa('0xa')](config[_0xbffa('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xbffa('0xb'))(new Redis(config['redis']));function emit(_0x40bc44,_0x574cf4,_0x29acd5){io['to'](_0x40bc44)[_0xbffa('0xc')](_0x574cf4,_0x29acd5);}function request(_0x56c5f3){logger[_0xbffa('0xd')](_0xbffa('0xe'),JSON[_0xbffa('0xf')](_0x56c5f3));return rp(_0x56c5f3);}function getCustomFields(_0x3be05c,_0x464f56){var _0x3bd924={};if(_0x3be05c[_0xbffa('0x10')]>0x0){_[_0xbffa('0x11')](_0x3be05c,function(_0x202098){if(_[_0xbffa('0x12')](['string',_0xbffa('0x13')],_0x202098[_0xbffa('0x14')])&&_0x202098[_0xbffa('0x15')]){_0x3bd924[_0x202098[_0xbffa('0x15')]]=_0x202098[_0xbffa('0x16')][_0xbffa('0x17')]();}else if(_0x202098[_0xbffa('0x14')]===_0xbffa('0x18')&&_0x202098['variableName']&&_0x202098[_0xbffa('0x15')]&&_0x464f56[_0x202098[_0xbffa('0x19')]]){_0x3bd924[_0x202098[_0xbffa('0x15')]]=_0x464f56[_0x202098[_0xbffa('0x19')]][_0xbffa('0x17')]();}else if(_0x202098[_0xbffa('0x14')]===_0xbffa('0x1a')&&_0x202098['Variable']&&_0x202098['Variable']['name']&&_0x202098[_0xbffa('0x15')]&&_0x464f56[_0x202098[_0xbffa('0x1b')][_0xbffa('0x1c')][_0xbffa('0x1d')]()]){_0x3bd924[_0x202098['idField']]=_0x464f56[_0x202098[_0xbffa('0x1b')][_0xbffa('0x1c')]['toLowerCase']()][_0xbffa('0x17')]();}});}return _0x3bd924;}function getName(_0x3225ca){if(_0x3225ca[_0xbffa('0x1e')]('\x20')>0x0){var _0x12fcc8=_0x3225ca[_0xbffa('0x1f')](/ (.+)/);if(_0x12fcc8[0x1]){return _0x12fcc8;}}return[_0x3225ca,_0x3225ca];}var accountsTokens={};function getAccessToken(_0x233108){return new Promise(function(_0x5960e3,_0x2522aa){if(!_[_0xbffa('0x20')](accountsTokens[_0x233108['id']])&&!_['isNil'](accountsTokens[_0x233108['id']][_0xbffa('0x21')])){if(moment()[_0xbffa('0x22')](accountsTokens[_0x233108['id']][_0xbffa('0x23')])){_0x5960e3(accountsTokens[_0x233108['id']]['access_token']);}}var _0x6f6847;switch(_0x233108[_0xbffa('0x24')]){case'US':_0x6f6847=_0xbffa('0x25');break;case'AU':_0x6f6847=_0xbffa('0x26');break;case'EU':_0x6f6847=_0xbffa('0x27');break;case'IN':_0x6f6847=_0xbffa('0x28');break;case'CN':_0x6f6847=_0xbffa('0x29');break;default:_0x6f6847=_0xbffa('0x27');break;}var _0x5a3d68={'method':_0xbffa('0x2a'),'uri':_0x6f6847+_0xbffa('0x2b'),'qs':{'refresh_token':_0x233108[_0xbffa('0x2c')],'client_id':_0x233108[_0xbffa('0x2d')],'client_secret':_0x233108['clientSecret'],'grant_type':_0xbffa('0x2e')},'json':!![]};return rp(_0x5a3d68)['then'](function(_0x24fed0){accountsTokens[_0x233108['id']]={'access_token':_0x24fed0[_0xbffa('0x21')],'expires_in':moment()['add'](_0x24fed0['expires_in'],'seconds')};_0x5960e3(_0x24fed0['access_token']);})['catch'](function(_0xe97470){logger[_0xbffa('0x2f')](_0xbffa('0x30'),_0xe97470[_0xbffa('0x31')]);_0x2522aa(_0xe97470);});});}function getUser(_0x8cd843,_0x3890fb,_0x30e691,_0x5c2a9a){logger[_0xbffa('0x32')](_0xbffa('0x33'));return request({'method':'GET','uri':util[_0xbffa('0x34')](_0xbffa('0x35'),_0x3890fb),'qs':{'type':_0xbffa('0x36')},'headers':{'Authorization':_0xbffa('0x37')+_0x8cd843},'json':!![]})[_0xbffa('0x38')](function(_0xfbc0ab){if(_0xfbc0ab[_0xbffa('0x39')]){var _0xea766=-0x1;if(_[_0xbffa('0x3a')](_0xfbc0ab['users'])){if(!_[_0xbffa('0x20')](_0x5c2a9a)){_0xea766=_['findIndex'](_0xfbc0ab[_0xbffa('0x39')],function(_0x1ba586){return _0x1ba586['email']===_0x5c2a9a;});}if(_0xea766>=0x0){logger['info']('Agent\x20found!');}else{logger[_0xbffa('0x32')](_0xbffa('0x3b'));_0xea766=_[_0xbffa('0x3c')](_0xfbc0ab['users'],function(_0x378760){return _0x378760[_0xbffa('0x3d')][_0xbffa('0x1c')]===_0xbffa('0x3e');});}return _0xfbc0ab['users'][_0xea766];}else{if(_0xfbc0ab[_0xbffa('0x3f')][_0xbffa('0x3d')]['name']===_0xbffa('0x3e')){logger[_0xbffa('0x32')]('Using\x20the\x20admin\x20account!');user=_0xfbc0ab[_0xbffa('0x3f')];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0xbffa('0xf')](_0xfbc0ab));throw new Error(_0xbffa('0x40')+JSON[_0xbffa('0xf')](_0xfbc0ab));}}}else{logger[_0xbffa('0x2f')]('The\x20failing\x20result\x20is',JSON[_0xbffa('0xf')](_0xfbc0ab));throw new Error(_0xbffa('0x40')+JSON[_0xbffa('0xf')](_0xfbc0ab));}})[_0xbffa('0x41')](function(_0x20c1a4){console[_0xbffa('0x2f')](_0x20c1a4);});}function getZohoUser(_0x588547,_0x2e7d7f){return new BPromise(function(_0x5423b5,_0x5565ff){request(_0x588547)[_0xbffa('0x38')](function(_0x2d6628){var _0x3fdfda=null;if(_0x2d6628){_0x3fdfda=_0x2d6628[_0xbffa('0x42')][0x0];_0x3fdfda[_0xbffa('0x43')]=_0x2e7d7f;}_0x5423b5(_0x3fdfda);})['catch'](function(_0x2cd938){_0x5565ff(_0x2cd938);});});}function createEndUser(_0x16aa99,_0x74ded0,_0x546ba2,_0x2f0fc7,_0x1d4b6b,_0x330041){var _0x546ba2=getName(_0x546ba2);return request({'method':_0xbffa('0x2a'),'uri':_0xbffa('0x44')+_0x74ded0+_0xbffa('0x45')+_[_0xbffa('0x46')](_0x330041[_0xbffa('0x47')])+'s','body':{'data':[{'Last_Name':_0x546ba2[0x1],'First_Name':_0x546ba2[0x0],'Phone':_0x2f0fc7,'Owner':{'name':!_[_0xbffa('0x20')](_0x1d4b6b['role'][_0xbffa('0x1c')])?_0x1d4b6b[_0xbffa('0x48')][_0xbffa('0x1c')]:!_[_0xbffa('0x20')](_0x1d4b6b['first_name'])?_0x1d4b6b[_0xbffa('0x49')]+'\x20'+_0x1d4b6b['last_name']:_0x1d4b6b[_0xbffa('0x4a')],'id':_0x1d4b6b['id']}}]},'headers':{'Authorization':_0xbffa('0x37')+_0x16aa99},'json':!![]})['then'](function(_0x5b83bf){if(_0x5b83bf&&_0x5b83bf[_0xbffa('0x42')][0x0]['code']===_0xbffa('0x4b')){var _0x134df3=_0x5b83bf[_0xbffa('0x42')][0x0][_0xbffa('0x4c')];_0x134df3['enduserType']=_['startCase'](_0x330041['moduleCreate'])+'s';return _0x134df3;}logger[_0xbffa('0x2f')](_0xbffa('0x4d'),JSON[_0xbffa('0xf')](data));throw new Error(_0xbffa('0x4e')+JSON[_0xbffa('0xf')](data));})[_0xbffa('0x41')](function(_0x4fbbb3){console[_0xbffa('0x4f')](_0xbffa('0x50'),_0x4fbbb3);});}function getEndUser(_0x1e9192,_0x1b7006,_0x375d9d,_0x4b224a,_0x41bc78,_0x2a345b,_0xf43a04){var _0x18ffdf={'method':'GET','uri':'','headers':{'Authorization':_0xbffa('0x37')+_0x1e9192},'json':!![]};switch(_0xf43a04[_0xbffa('0x51')]){case'contact_lead':_0x18ffdf[_0xbffa('0x52')]=_0xbffa('0x44')+_0x1b7006+_0xbffa('0x53')+_0x41bc78+'))';return getZohoUser(_0x18ffdf,_0xbffa('0x54'))[_0xbffa('0x38')](function(_0x3d7adf){if(_0x3d7adf)return _0x3d7adf;_0x18ffdf[_0xbffa('0x52')]=_0xbffa('0x44')+_0x1b7006+_0xbffa('0x55')+_0x41bc78+'))';return getZohoUser(_0x18ffdf,_0xbffa('0x56'))[_0xbffa('0x38')](function(_0x3ab5c8){if(_0x3ab5c8)return _0x3ab5c8;if(_0xf43a04[_0xbffa('0x47')]!=_0xbffa('0x57')){return createEndUser(_0x1e9192,_0x1b7006,_0x4b224a,_0x41bc78,_0x2a345b,_0xf43a04);}else{return{};}});});break;case _0xbffa('0x58'):_0x18ffdf[_0xbffa('0x52')]=_0xbffa('0x44')+_0x1b7006+_0xbffa('0x53')+_0x41bc78+'))';return getZohoUser(_0x18ffdf,_0xbffa('0x54'))[_0xbffa('0x38')](function(_0x2f33ab){if(_0x2f33ab)return _0x2f33ab;if(_0xf43a04[_0xbffa('0x47')]!=_0xbffa('0x57')){return createEndUser(_0x1e9192,_0x1b7006,_0x4b224a,_0x41bc78,_0x2a345b,_0xf43a04);}else{return{};}});break;case _0xbffa('0x59'):_0x18ffdf[_0xbffa('0x52')]=_0xbffa('0x44')+_0x1b7006+_0xbffa('0x55')+_0x41bc78+'))';return getZohoUser(_0x18ffdf,_0xbffa('0x56'))[_0xbffa('0x38')](function(_0x292add){if(_0x292add)return _0x292add;if(_0xf43a04[_0xbffa('0x47')]!=_0xbffa('0x57')){return createEndUser(_0x1e9192,_0x1b7006,_0x4b224a,_0x41bc78,_0x2a345b,_0xf43a04);}else{return{};}});break;}}function getCall(_0x2ca201,_0x5560a1,_0x8a417f,_0x4b723f,_0x4e9ca6,_0xb8cd74,_0x5a2951,_0x26b510){logger['info'](_0xbffa('0x5a'));var _0x3daeee={};_0x3daeee[_0xbffa('0x5b')]={'name':!_['isNil'](_0x4b723f['role']['name'])&&!_[_0xbffa('0x20')](_0x4b723f[_0xbffa('0x3d')][_0xbffa('0x1c')])&&_0x4b723f[_0xbffa('0x3d')][_0xbffa('0x1c')]===_0xbffa('0x5c')?_0x4b723f[_0xbffa('0x48')][_0xbffa('0x1c')]:!_[_0xbffa('0x20')](_0x4b723f['first_name'])?_0x4b723f[_0xbffa('0x49')]+'\x20'+_0x4b723f[_0xbffa('0x4a')]:_0x4b723f['last_name'],'id':_0x4b723f['id']};_0x3daeee[_0xbffa('0x5d')]=intUtil[_0xbffa('0x5e')](_0xb8cd74[_0xbffa('0x5f')],_0x5a2951,'\x20');_0x3daeee['Description']=intUtil[_0xbffa('0x5e')](_0xb8cd74['Descriptions'],_0x5a2951,'\x0a');if(_0x4e9ca6[_0xbffa('0x43')]===_0xbffa('0x54')){_0x3daeee[_0xbffa('0x60')]={'name':!_[_0xbffa('0x20')](_0x4e9ca6[_0xbffa('0x61')])?_0x4e9ca6[_0xbffa('0x61')]:!_[_0xbffa('0x20')](_0x4e9ca6[_0xbffa('0x62')])?_0x4e9ca6[_0xbffa('0x62')]+'\x20'+_0x4e9ca6[_0xbffa('0x63')]:_0x4e9ca6[_0xbffa('0x63')],'id':_0x4e9ca6['id']};}if(_0x4e9ca6[_0xbffa('0x43')]===_0xbffa('0x56')){_0x3daeee[_0xbffa('0x64')]={'name':!_[_0xbffa('0x20')](_0x4e9ca6[_0xbffa('0x61')])?_0x4e9ca6[_0xbffa('0x61')]:!_['isNil'](_0x4e9ca6[_0xbffa('0x62')])?_0x4e9ca6['First_Name']+'\x20'+_0x4e9ca6[_0xbffa('0x63')]:_0x4e9ca6['Last_Name'],'id':_0x4e9ca6['id']};_0x3daeee[_0xbffa('0x65')]=_['startCase'](_0x4e9ca6['enduserType']);}if(_0x5a2951['talktime']){_0x3daeee[_0xbffa('0x66')]=moment[_0xbffa('0x67')](parseInt(_0x5a2951[_0xbffa('0x68')])*0x3e8)[_0xbffa('0x34')](_0xbffa('0x69'));}else if(_0x5a2951[_0xbffa('0x6a')]&&_0x5a2951[_0xbffa('0x6b')]){_0x3daeee['Call_Duration']=moment[_0xbffa('0x67')](moment(_0x5a2951['endtime'],'YYYY-MM-DDTHH:mm:ss')[_0xbffa('0x6c')](moment(_0x5a2951[_0xbffa('0x6d')],_0xbffa('0x6e'))))[_0xbffa('0x34')](_0xbffa('0x69'));}switch(_0x5a2951[_0xbffa('0x6f')]){case _0xbffa('0x70'):_0x3daeee['Call_Result']=_0xbffa('0x71');break;case'complete':case _0xbffa('0x72'):_0x3daeee[_0xbffa('0x73')]=_0xbffa('0x74');break;case'rejected':_0x3daeee['Call_Result']=_0xbffa('0x75');break;case _0xbffa('0x76'):_0x3daeee[_0xbffa('0x73')]=_0xbffa('0x77');break;case _0xbffa('0x78'):_0x3daeee['Call_Result']=_0xbffa('0x79');default:}_0x3daeee[_0xbffa('0x7a')]=(_0x26b510===_0xbffa('0x7b')?moment(_0x5a2951[_0xbffa('0x6d')])[_0xbffa('0x34')](_0xbffa('0x6e')):moment(_0x5a2951['agentcalledAt'])[_0xbffa('0x34')](_0xbffa('0x6e')))||moment()[_0xbffa('0x34')](_0xbffa('0x6e'));_0x3daeee[_0xbffa('0x7c')]=_0x26b510||'Inbound';_0x3daeee=_[_0xbffa('0x7d')](_0x3daeee,getCustomFields(_0xb8cd74[_0xbffa('0x7e')],_0x5a2951));return request({'method':_0xbffa('0x2a'),'uri':_0xbffa('0x44')+_0x5560a1+'/crm/v2/Calls','headers':{'Authorization':_0xbffa('0x37')+_0x2ca201},'body':{'data':[_0x3daeee]},'json':!![]})['then'](function(_0x3fbfb8){if(_0x3fbfb8&&_0x3fbfb8[_0xbffa('0x42')][0x0]['code']==='SUCCESS'){logger[_0xbffa('0x32')](_0xbffa('0x7f'));return{'id':_0x3fbfb8[_0xbffa('0x42')][0x0]['details']['id']};}})['catch'](function(_0x2150a8){logger['info'](_0xbffa('0x80'),_0x2150a8[_0xbffa('0x31')]);console[_0xbffa('0x4f')](_0xbffa('0x80'),_0x2150a8);});}exports['queue']=function(_0x43367,_0x1c9519,_0x250bcf,_0x5e7f1b,_0x30bad8,_0x4bce65){var _0x41b7dc,_0x81cf64,_0x33954e;_0x4bce65[_0xbffa('0x81')]=intUtil[_0xbffa('0x82')](_0x4bce65[_0xbffa('0x81')]);_0x4bce65['serverUrl']=intUtil['stripTrailingSlash'](_0x4bce65[_0xbffa('0x83')]);if(_0x30bad8&&_0x30bad8[_0xbffa('0x84')]){logger['info']('[QUEUE]',_0xbffa('0x85'));_0x1c9519[_0xbffa('0x86')]=_0x4bce65[_0xbffa('0x83')]+'/api/voice/recordings/'+_0x1c9519[_0xbffa('0x87')]+_0xbffa('0x88')+md5(_0x1c9519[_0xbffa('0x87')]);}else{_0x1c9519[_0xbffa('0x86')]='';}var _0x5e5fa1=_0x4bce65[_0xbffa('0x81')]===_0xbffa('0x89')?'eu':'com';return getAccessToken(_0x4bce65)['then'](function(_0x27c615){_0x33954e=_0x27c615;return getUser(_0x33954e,_0x5e5fa1,_0x4bce65,_0x5e7f1b[_0xbffa('0x8a')]);})[_0xbffa('0x38')](function(_0x17b81d){_0x41b7dc=_0x17b81d;logger[_0xbffa('0x32')](_0xbffa('0x8b'),_0x41b7dc['id']);return getEndUser(_0x33954e,_0x5e5fa1,_0x4bce65,_0x1c9519[_0xbffa('0x8c')],_0x1c9519[_0xbffa('0x8d')],_0x41b7dc,_0x250bcf);})[_0xbffa('0x38')](function(_0xd54745){_0x81cf64=_0xd54745;return getCall(_0x33954e,_0x5e5fa1,_0x4bce65,_0x41b7dc,_0x81cf64,_0x250bcf,_0x1c9519,_0xbffa('0x8e'));})['then'](function(_0x1374c5){if(_0x1374c5){logger[_0xbffa('0x32')](_0xbffa('0x8f'),_0x1374c5['id']);logger[_0xbffa('0x32')]('[QUEUE]',_0xbffa('0x90'));emit(util['format']('user:%s',_0x5e7f1b[_0xbffa('0x1c')]),_0xbffa('0x91'),{'uri':'https://crm.'+_0x4bce65[_0xbffa('0x81')]+_0xbffa('0x92')+_0x1374c5['id']});}})['catch'](function(_0x326b51){logger[_0xbffa('0x2f')]('[QUEUE]',JSON[_0xbffa('0xf')](_0x326b51));});};exports[_0xbffa('0x7b')]=function(_0x446110,_0x12ceb9,_0x7f8188,_0x4cc2a7,_0x32c273,_0x5ec592,_0x2d7623){var _0x4a8c95,_0x451fe2,_0xcc290f;_0x5ec592[_0xbffa('0x81')]=intUtil[_0xbffa('0x82')](_0x5ec592['host']);_0x5ec592[_0xbffa('0x83')]=intUtil[_0xbffa('0x82')](_0x5ec592[_0xbffa('0x83')]);if(_0x2d7623&&_0x2d7623['recordingFormat']&&_0x2d7623[_0xbffa('0x93')]!==_0xbffa('0x94')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x12ceb9[_0xbffa('0x86')]=_0x5ec592[_0xbffa('0x83')]+_0xbffa('0x95')+_0x12ceb9['uniqueid']+_0xbffa('0x88')+md5(_0x12ceb9[_0xbffa('0x87')]);}var _0x2a0319=_0x5ec592[_0xbffa('0x81')]===_0xbffa('0x89')?'eu':_0xbffa('0x96');return getAccessToken(_0x5ec592)[_0xbffa('0x38')](function(_0x3cca12){_0xcc290f=_0x3cca12;return getUser(_0xcc290f,_0x2a0319,_0x5ec592,_0x4cc2a7['email']);})['then'](function(_0x434d67){_0x4a8c95=_0x434d67;logger[_0xbffa('0x32')](_0xbffa('0x8b'),_0x4a8c95['id']);return getEndUser(_0xcc290f,_0x2a0319,_0x5ec592,_0x12ceb9[_0xbffa('0x97')],_0x12ceb9[_0xbffa('0x98')],_0x4a8c95,_0x7f8188);})[_0xbffa('0x38')](function(_0x5aed4d){_0x451fe2=_0x5aed4d;return getCall(_0xcc290f,_0x2a0319,_0x5ec592,_0x4a8c95,_0x451fe2,_0x7f8188,_0x12ceb9,'Outbound');})['then'](function(_0x104a26){if(_0x104a26){logger[_0xbffa('0x32')](_0xbffa('0x8f'),_0x104a26['id']);logger[_0xbffa('0x32')](_0xbffa('0x99'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xbffa('0x9a'),_0x4cc2a7[_0xbffa('0x1c')]),_0xbffa('0x91'),{'uri':_0xbffa('0x9b')+_0x5ec592['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x104a26['id']});}})[_0xbffa('0x41')](function(_0x158d65){logger[_0xbffa('0x2f')](_0xbffa('0x99'),JSON[_0xbffa('0xf')](_0x158d65));});};exports[_0xbffa('0x9c')]=function(_0x436819,_0x441a99,_0x140ff9,_0x3bc7c1,_0x57bcb0,_0x5f524b){var _0x133e4c,_0xc762d,_0x340086;_0x5f524b[_0xbffa('0x81')]=intUtil[_0xbffa('0x82')](_0x5f524b['host']);_0x5f524b[_0xbffa('0x83')]=intUtil[_0xbffa('0x82')](_0x5f524b[_0xbffa('0x83')]);if(_0x57bcb0&&_0x57bcb0[_0xbffa('0x84')]){logger[_0xbffa('0x32')]('['+_0x441a99[_0xbffa('0x6f')]['toUpperCase']()+']',_0xbffa('0x85'));_0x441a99[_0xbffa('0x86')]=_0x5f524b[_0xbffa('0x83')]+_0xbffa('0x95')+_0x441a99[_0xbffa('0x87')]+_0xbffa('0x88')+md5(_0x441a99[_0xbffa('0x87')]);}else{_0x441a99[_0xbffa('0x86')]='';}var _0x3a7e96=_0x5f524b[_0xbffa('0x81')]===_0xbffa('0x89')?'eu':_0xbffa('0x96');return getAccessToken(_0x5f524b)[_0xbffa('0x38')](function(_0x5836b6){_0x340086=_0x5836b6;return getUser(_0x340086,_0x3a7e96,_0x5f524b);})[_0xbffa('0x38')](function(_0x108c5c){_0x133e4c=_0x108c5c;logger['info']('The\x20User\x20ID\x20is:',_0x133e4c['id']);return getEndUser(_0x340086,_0x3a7e96,_0x5f524b,_0x441a99['calleridname'],_0x441a99[_0xbffa('0x8d')],_0x133e4c,_0x140ff9);})[_0xbffa('0x38')](function(_0x23d814){_0xc762d=_0x23d814;return getCall(_0x340086,_0x3a7e96,_0x5f524b,_0x133e4c,_0xc762d,_0x140ff9,_0x441a99,'Inbound');})[_0xbffa('0x38')](function(_0x554cce){if(_0x554cce){logger['info'](_0xbffa('0x8f'),_0x554cce['id']);}})['catch'](function(_0x446910){logger[_0xbffa('0x2f')]('['+_0x441a99[_0xbffa('0x6f')][_0xbffa('0x9d')]()+']',JSON[_0xbffa('0xf')](_0x446910));});}; \ 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 595db03..dbaab79 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 _0xd742=['data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','exec','data2','Script','render'];(function(_0x1c5f93,_0x35de09){var _0x464e11=function(_0x425844){while(--_0x425844){_0x1c5f93['push'](_0x1c5f93['shift']());}};_0x464e11(++_0x35de09);}(_0xd742,0xa1));var _0x2d74=function(_0x2790e4,_0x115b27){_0x2790e4=_0x2790e4-0x0;var _0x3d001d=_0xd742[_0x2790e4];return _0x3d001d;};'use strict';var util=require(_0x2d74('0x0'));var sh=require(_0x2d74('0x1'));var Mustache=require(_0x2d74('0x2'));var logger=require(_0x2d74('0x3'))('trigger');exports[_0x2d74('0x4')]=function(_0x16bdd0,_0x27bb55){var _0x5b5328=_0x16bdd0[_0x2d74('0x5')]?_0x16bdd0['data2']:_0x2d74('0x6');var _0x252937=_0x16bdd0['data3']?Mustache[_0x2d74('0x7')](_0x16bdd0[_0x2d74('0x8')],_0x27bb55):_0x27bb55;sh[_0x2d74('0x4')](_0x252937,function(_0x47fd30,_0x575df1,_0x151104){if(_0x47fd30!==0x0){logger['error'](util['format'](_0x2d74('0x9'),_0x5b5328,_0x252937,_0x47fd30,_0x151104));}else{logger[_0x2d74('0xa')](util[_0x2d74('0xb')](_0x2d74('0xc'),_0x5b5328,_0x252937,_0x575df1));}});}; \ No newline at end of file +var _0xbb1b=['../../../../config/logger','trigger','data2','Script','data3','render','exec','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache'];(function(_0x421c11,_0xcf7560){var _0x317709=function(_0x5c8c71){while(--_0x5c8c71){_0x421c11['push'](_0x421c11['shift']());}};_0x317709(++_0xcf7560);}(_0xbb1b,0x105));var _0xbbb1=function(_0x165fc7,_0x5921d2){_0x165fc7=_0x165fc7-0x0;var _0x19e30a=_0xbb1b[_0x165fc7];return _0x19e30a;};'use strict';var util=require(_0xbbb1('0x0'));var sh=require(_0xbbb1('0x1'));var Mustache=require(_0xbbb1('0x2'));var logger=require(_0xbbb1('0x3'))(_0xbbb1('0x4'));exports['exec']=function(_0x5b9a16,_0xb05a8f){var _0x2a2996=_0x5b9a16[_0xbbb1('0x5')]?_0x5b9a16['data2']:_0xbbb1('0x6');var _0x456bf8=_0x5b9a16[_0xbbb1('0x7')]?Mustache[_0xbbb1('0x8')](_0x5b9a16[_0xbbb1('0x7')],_0xb05a8f):_0xb05a8f;sh[_0xbbb1('0x9')](_0x456bf8,function(_0xebca0d,_0x144426,_0x1317d5){if(_0xebca0d!==0x0){logger['error'](util[_0xbbb1('0xa')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x2a2996,_0x456bf8,_0xebca0d,_0x1317d5));}else{logger['info'](util[_0xbbb1('0xa')](_0xbbb1('0xb'),_0x2a2996,_0x456bf8,_0x144426));}});}; \ 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 4736df1..cddb2cc 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 _0xa07d=['object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','name','message','request-promise','util','lodash','mustache','../../../../config/logger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','error','stack','GET','DELETE','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','stringify','then','isNil'];(function(_0x9da788,_0x783e33){var _0x3dbaee=function(_0x535920){while(--_0x535920){_0x9da788['push'](_0x9da788['shift']());}};_0x3dbaee(++_0x783e33);}(_0xa07d,0x138));var _0xda07=function(_0x44210e,_0x1c76d6){_0x44210e=_0x44210e-0x0;var _0x2c6399=_0xa07d[_0x44210e];return _0x2c6399;};'use strict';var rp=require(_0xda07('0x0'));var util=require(_0xda07('0x1'));var _=require(_0xda07('0x2'));var Mustache=require(_0xda07('0x3'));var logger=require(_0xda07('0x4'))('trigger');exports[_0xda07('0x5')]=function(_0x2af6c0,_0x5b940d){var _0x32ffb7,_0x459f5d;var _0x569fe1={'method':_0x2af6c0[_0xda07('0x6')][_0xda07('0x7')](),'uri':Mustache[_0xda07('0x8')](_0x2af6c0[_0xda07('0x9')],_0x5b940d),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2af6c0['data5'])===_0xda07('0xa')&&parseInt(_0x2af6c0['data5'])>=0x1&&parseInt(_0x2af6c0[_0xda07('0xb')])<=0xa?parseInt(_0x2af6c0[_0xda07('0xb')])*0x3e8:0x5*0x3e8};try{_0x569fe1[_0xda07('0xc')]=_0x2af6c0[_0xda07('0xd')]?JSON[_0xda07('0xe')](Mustache[_0xda07('0x8')](_0x2af6c0[_0xda07('0xd')],_0x5b940d)):{};}catch(_0x1486a6){logger[_0xda07('0xf')](_0x1486a6[_0xda07('0x10')]);}switch(_0x2af6c0[_0xda07('0x6')][_0xda07('0x7')]()){case _0xda07('0x11'):case _0xda07('0x12'):_0x32ffb7=null;_0x569fe1['qs']=_0x5b940d;break;case'POST':case _0xda07('0x13'):if(_0x2af6c0[_0xda07('0x14')]){try{_0x32ffb7=JSON['parse'](Mustache['render'](_0x2af6c0[_0xda07('0x14')],_0x5b940d));_0x569fe1[_0xda07('0x15')]=_0x32ffb7;}catch(_0x408456){logger['error'](_0x408456[_0xda07('0x10')]);logger[_0xda07('0xf')](_0xda07('0x16'));}}else{_0x32ffb7=_0x5b940d;_0x569fe1[_0xda07('0x15')]=_0x32ffb7;}break;}logger[_0xda07('0x17')](util[_0xda07('0x18')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x2af6c0['data1'],_0x2af6c0['data2'],JSON[_0xda07('0x19')](_0x569fe1)));rp(_0x569fe1)[_0xda07('0x1a')](function(_0x33dd90){_0x32ffb7=!_[_0xda07('0x1b')](_0x32ffb7)?',\x20request\x20body:\x20'+_0x32ffb7:'';_0x459f5d=typeof _0x33dd90['body']===_0xda07('0x1c')?JSON[_0xda07('0x19')](_0x33dd90[_0xda07('0x15')]):_0x33dd90['body'];logger[_0xda07('0x17')](util['format'](_0xda07('0x1d'),_0x2af6c0[_0xda07('0x6')],_0x2af6c0[_0xda07('0x9')],_0x33dd90[_0xda07('0x1e')],_0x459f5d));})[_0xda07('0x1f')](function(_0x1e9973){logger[_0xda07('0xf')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x2af6c0[_0xda07('0x6')],_0x2af6c0[_0xda07('0x9')],_0x1e9973['statusCode'],_0x1e9973[_0xda07('0x20')],_0x1e9973[_0xda07('0x21')]));});}; \ No newline at end of file +var _0x7a77=['stack','DELETE','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','then','isNil',',\x20request\x20body:\x20','object','stringify','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','lodash','trigger','data1','toUpperCase','render','data5','number','data6','parse'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7a77,0x15e));var _0x77a7=function(_0x236712,_0x5c78df){_0x236712=_0x236712-0x0;var _0x2a472c=_0x7a77[_0x236712];return _0x2a472c;};'use strict';var rp=require(_0x77a7('0x0'));var util=require('util');var _=require(_0x77a7('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x77a7('0x2'));exports['exec']=function(_0x160d3f,_0x5bf92e){var _0x400aae,_0x124418;var _0x394c6e={'method':_0x160d3f[_0x77a7('0x3')][_0x77a7('0x4')](),'uri':Mustache[_0x77a7('0x5')](_0x160d3f['data2'],_0x5bf92e),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x160d3f[_0x77a7('0x6')])===_0x77a7('0x7')&&parseInt(_0x160d3f[_0x77a7('0x6')])>=0x1&&parseInt(_0x160d3f[_0x77a7('0x6')])<=0xa?parseInt(_0x160d3f[_0x77a7('0x6')])*0x3e8:0x5*0x3e8};try{_0x394c6e['headers']=_0x160d3f[_0x77a7('0x8')]?JSON[_0x77a7('0x9')](Mustache[_0x77a7('0x5')](_0x160d3f[_0x77a7('0x8')],_0x5bf92e)):{};}catch(_0x5d32ba){logger['error'](_0x5d32ba[_0x77a7('0xa')]);}switch(_0x160d3f[_0x77a7('0x3')][_0x77a7('0x4')]()){case'GET':case _0x77a7('0xb'):_0x400aae=null;_0x394c6e['qs']=_0x5bf92e;break;case'POST':case'PUT':if(_0x160d3f['data7']){try{_0x400aae=JSON[_0x77a7('0x9')](Mustache[_0x77a7('0x5')](_0x160d3f['data7'],_0x5bf92e));_0x394c6e['body']=_0x400aae;}catch(_0x49ae5c){logger[_0x77a7('0xc')](_0x49ae5c['stack']);logger['error'](_0x77a7('0xd'));}}else{_0x400aae=_0x5bf92e;_0x394c6e[_0x77a7('0xe')]=_0x400aae;}break;}logger[_0x77a7('0xf')](util['format'](_0x77a7('0x10'),_0x160d3f[_0x77a7('0x3')],_0x160d3f[_0x77a7('0x11')],JSON['stringify'](_0x394c6e)));rp(_0x394c6e)[_0x77a7('0x12')](function(_0x56d7c3){_0x400aae=!_[_0x77a7('0x13')](_0x400aae)?_0x77a7('0x14')+_0x400aae:'';_0x124418=typeof _0x56d7c3[_0x77a7('0xe')]===_0x77a7('0x15')?JSON[_0x77a7('0x16')](_0x56d7c3[_0x77a7('0xe')]):_0x56d7c3[_0x77a7('0xe')];logger[_0x77a7('0xf')](util[_0x77a7('0x17')](_0x77a7('0x18'),_0x160d3f[_0x77a7('0x3')],_0x160d3f[_0x77a7('0x11')],_0x56d7c3[_0x77a7('0x19')],_0x124418));})[_0x77a7('0x1a')](function(_0x466800){logger[_0x77a7('0xc')](util[_0x77a7('0x17')](_0x77a7('0x1b'),_0x160d3f[_0x77a7('0x3')],_0x160d3f[_0x77a7('0x11')],_0x466800[_0x77a7('0x19')],_0x466800[_0x77a7('0x1c')],_0x466800[_0x77a7('0x1d')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 3e1e995..e8114a5 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 _0x87e7=['error','message','jayson/promise','../../config/logger','routing','http','Request','request','then','debug','rpc'];(function(_0x364957,_0xd58db3){var _0x431ac6=function(_0x13a90a){while(--_0x13a90a){_0x364957['push'](_0x364957['shift']());}};_0x431ac6(++_0xd58db3);}(_0x87e7,0x1e6));var _0x787e=function(_0x45806b,_0x53eeae){_0x45806b=_0x45806b-0x0;var _0x3e228e=_0x87e7[_0x45806b];return _0x3e228e;};'use strict';var jayson=require(_0x787e('0x0'));var BPromise=require('bluebird');var logger=require(_0x787e('0x1'))(_0x787e('0x2'));var client=jayson['client'][_0x787e('0x3')]({'port':0x2329});client[_0x787e('0x4')]=function(_0x26f5a6,_0x57baaf){return new BPromise(function(_0x4e5e56,_0x5e049c){return client[_0x787e('0x5')](_0x26f5a6,_0x57baaf)[_0x787e('0x6')](function(_0x5a0240){logger[_0x787e('0x7')](_0x787e('0x8'),'routing',_0x26f5a6,_0x57baaf,_0x5a0240);if(_0x5a0240[_0x787e('0x9')]){logger[_0x787e('0x9')](_0x787e('0x8'),_0x787e('0x2'),_0x26f5a6,_0x5a0240[_0x787e('0x9')][_0x787e('0xa')],_0x57baaf);return _0x5e049c(_0x5a0240['error'][_0x787e('0xa')]);}else{return _0x4e5e56(_0x5a0240['result']);}})['catch'](function(_0x2fbbef){logger['error'](_0x787e('0x8'),_0x787e('0x2'),_0x26f5a6,_0x2fbbef,_0x57baaf);return _0x5e049c(_0x2fbbef);});});};module['exports']=client; \ No newline at end of file +var _0xaa32=['bluebird','../../config/logger','routing','client','http','Request','request','then','debug','rpc','error','message','result','jayson/promise'];(function(_0x1db42b,_0x2647e8){var _0x1806f9=function(_0x428c51){while(--_0x428c51){_0x1db42b['push'](_0x1db42b['shift']());}};_0x1806f9(++_0x2647e8);}(_0xaa32,0x195));var _0x2aa3=function(_0xf17ec8,_0x485e7f){_0xf17ec8=_0xf17ec8-0x0;var _0x10db9d=_0xaa32[_0xf17ec8];return _0x10db9d;};'use strict';var jayson=require(_0x2aa3('0x0'));var BPromise=require(_0x2aa3('0x1'));var logger=require(_0x2aa3('0x2'))(_0x2aa3('0x3'));var client=jayson[_0x2aa3('0x4')][_0x2aa3('0x5')]({'port':0x2329});client[_0x2aa3('0x6')]=function(_0x416f8d,_0x2679eb){return new BPromise(function(_0x587544,_0x214298){return client[_0x2aa3('0x7')](_0x416f8d,_0x2679eb)[_0x2aa3('0x8')](function(_0x35f1b5){logger[_0x2aa3('0x9')](_0x2aa3('0xa'),_0x2aa3('0x3'),_0x416f8d,_0x2679eb,_0x35f1b5);if(_0x35f1b5[_0x2aa3('0xb')]){logger['error'](_0x2aa3('0xa'),_0x2aa3('0x3'),_0x416f8d,_0x35f1b5['error'][_0x2aa3('0xc')],_0x2679eb);return _0x214298(_0x35f1b5['error'][_0x2aa3('0xc')]);}else{return _0x587544(_0x35f1b5[_0x2aa3('0xd')]);}})['catch'](function(_0x4f58d7){logger[_0x2aa3('0xb')](_0x2aa3('0xa'),_0x2aa3('0x3'),_0x416f8d,_0x4f58d7,_0x2679eb);return _0x214298(_0x4f58d7);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index e8723be..6a254f2 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 _0xae28=['then','mailAccounts','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','../../config/logger','email'];(function(_0x421183,_0x2ea9ea){var _0x2d97cf=function(_0x285f29){while(--_0x285f29){_0x421183['push'](_0x421183['shift']());}};_0x2d97cf(++_0x2ea9ea);}(_0xae28,0x96));var _0x8ae2=function(_0x494444,_0x104f0a){_0x494444=_0x494444-0x0;var _0x291f1f=_0xae28[_0x494444];return _0x291f1f;};'use strict';var server=require(_0x8ae2('0x0'));var Realtime=require(_0x8ae2('0x1'));var EmailChannel=require(_0x8ae2('0x2'));var mailAccount=require(_0x8ae2('0x3'));var setting=require('./rpc/setting');var logger=require(_0x8ae2('0x4'))(_0x8ae2('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x8ae2('0x6')](mailAccount['getMailAccounts']())[_0x8ae2('0x6')](realtime['initMailAccounts']())[_0x8ae2('0x6')](function(){email['refresh'](realtime[_0x8ae2('0x7')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x8ae2('0x6')](function(){return initRealtime();})[_0x8ae2('0x6')](function(){return setting[_0x8ae2('0x8')]();})['then'](function(_0x28b4a7){return setInterval(initRealtime,_0x28b4a7[_0x8ae2('0x9')]*0x3e8);})[_0x8ae2('0xa')](function(_0x2f157a){logger[_0x8ae2('0xb')](_0x8ae2('0xc'),_0x2f157a);});}main(); \ No newline at end of file +var _0x1ac3=['error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings'];(function(_0x2ecea0,_0x36a83d){var _0x17ab22=function(_0x768e97){while(--_0x768e97){_0x2ecea0['push'](_0x2ecea0['shift']());}};_0x17ab22(++_0x36a83d);}(_0x1ac3,0x1cd));var _0x31ac=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x1ac3[_0x422905];return _0x33dc6c;};'use strict';var server=require(_0x31ac('0x0'));var Realtime=require(_0x31ac('0x1'));var EmailChannel=require(_0x31ac('0x2'));var mailAccount=require(_0x31ac('0x3'));var setting=require(_0x31ac('0x4'));var logger=require(_0x31ac('0x5'))(_0x31ac('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x31ac('0x7')]()[_0x31ac('0x8')](mailAccount[_0x31ac('0x9')]())['then'](realtime[_0x31ac('0xa')]())[_0x31ac('0x8')](function(){email[_0x31ac('0xb')](realtime[_0x31ac('0xc')]);return realtime;});}function main(){return server[_0x31ac('0xd')](realtime,email)[_0x31ac('0x8')](function(){return initRealtime();})[_0x31ac('0x8')](function(){return setting[_0x31ac('0xe')]();})[_0x31ac('0x8')](function(_0x33263e){return setInterval(initRealtime,_0x33263e['loginMailFrequency']*0x3e8);})['catch'](function(_0x2a3a0e){logger[_0x31ac('0xf')](_0x31ac('0x10'),_0x2a3a0e);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 846893d..f8c1ea6 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 _0x3ba3=['from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','handleImapError','send','Smtp','smtp','verify','verified','exports','lodash','bluebird','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','name','key','status','messageStatus','Imap','total','isNil','stringify','md5','emit','mailAccount:update','hasOwnProperty','active','service','provider','custom','box','handleImapBox','handleImapEmail','bind','end','error','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName'];(function(_0x2e6d8e,_0x3360a1){var _0x16c0f9=function(_0x589c99){while(--_0x589c99){_0x2e6d8e['push'](_0x2e6d8e['shift']());}};_0x16c0f9(++_0x3360a1);}(_0x3ba3,0xfb));var _0x33ba=function(_0x282613,_0x5ac10d){_0x282613=_0x282613-0x0;var _0x31fb48=_0x3ba3[_0x282613];return _0x31fb48;};'use strict';var _=require(_0x33ba('0x0'));var moment=require('moment');var BPromise=require(_0x33ba('0x1'));var md5=require('md5');var Redis=require(_0x33ba('0x2'));var config=require(_0x33ba('0x3'));var logger=require(_0x33ba('0x4'))(_0x33ba('0x5'));config[_0x33ba('0x6')]=_[_0x33ba('0x7')](config['redis'],{'host':_0x33ba('0x8'),'port':0x18eb});var io=require(_0x33ba('0x9'))(new Redis(config[_0x33ba('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x33ba('0xa'));var mailAccount=require(_0x33ba('0xb'));var md5Accounts={};function EmailChannel(_0x35a248){logger[_0x33ba('0xc')](_0x33ba('0xd'));this[_0x33ba('0xe')]=_0x35a248[_0x33ba('0xe')];this[_0x33ba('0xf')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x33ba('0x10')]['emit']=function(_0x44588f){var _0x3dcc43=this[_0x33ba('0xe')][_0x44588f];var _0x14eee9={'id':_0x3dcc43['id'],'name':_0x3dcc43[_0x33ba('0x11')],'key':_0x3dcc43[_0x33ba('0x12')],'active':_0x3dcc43['active'],'Imap':{'status':_0x3dcc43['Imap'][_0x33ba('0x13')],'messageStatus':_0x3dcc43['Imap'][_0x33ba('0x14')],'total':_0x3dcc43[_0x33ba('0x15')][_0x33ba('0x16')]}};if(_[_0x33ba('0x17')](md5Accounts[_0x44588f])){md5Accounts[_0x44588f]={};}var _0x192933=md5(JSON[_0x33ba('0x18')](_0x14eee9));if(md5Accounts[_0x44588f][_0x33ba('0x19')]!==_0x192933){md5Accounts[_0x44588f][_0x33ba('0x19')]=_0x192933;io[_0x33ba('0x1a')](_0x33ba('0x1b'),_0x14eee9);}};EmailChannel['prototype']['refresh']=function(_0x474341){for(var _0x5f4d50 in _0x474341){if(_0x474341[_0x33ba('0x1c')](_0x5f4d50)){if(_0x474341[_0x5f4d50]['Imap']&&_0x474341[_0x5f4d50][_0x33ba('0x1d')]){var _0x208197=_0x474341[_0x5f4d50][_0x33ba('0x15')];if(!_0x208197[_0x33ba('0x1e')]&&_0x474341[_0x5f4d50][_0x33ba('0x1f')]!==_0x33ba('0x20'))_0x208197[_0x33ba('0x1e')]=_0x474341[_0x5f4d50][_0x33ba('0x1f')];if(!this['imapAccounts'][_0x33ba('0x1c')](_0x208197['id'])){this[_0x33ba('0xf')][_0x208197['id']]=new EmailImap(_0x208197,_0x474341[_0x5f4d50][_0x33ba('0x5')]);this[_0x33ba('0xf')][_0x208197['id']]['on'](_0x33ba('0x21'),this[_0x33ba('0x22')]['bind'](this,_0x5f4d50));this['imapAccounts'][_0x208197['id']]['on'](_0x33ba('0x5'),this[_0x33ba('0x23')][_0x33ba('0x24')](this,_0x5f4d50));this[_0x33ba('0xf')][_0x208197['id']]['on'](_0x33ba('0x25'),this['handleImapEnd']['bind'](this,_0x5f4d50));this['imapAccounts'][_0x208197['id']]['on'](_0x33ba('0x26'),this['handleImapError'][_0x33ba('0x24')](this,_0x5f4d50));}}else{if(_[_0x33ba('0x17')](this['mailAccounts'][_0x5f4d50][_0x33ba('0x15')])){this[_0x33ba('0xe')][_0x5f4d50][_0x33ba('0x15')]={};}this[_0x33ba('0xe')][_0x5f4d50][_0x33ba('0x15')][_0x33ba('0x13')]='disabled';this['mailAccounts'][_0x5f4d50][_0x33ba('0x15')][_0x33ba('0x14')]='';this['emit'](_0x5f4d50);}}}};EmailChannel['prototype'][_0x33ba('0x22')]=function(_0x3c8b7d,_0x52389f){if(this[_0x33ba('0xe')][_0x3c8b7d]){this[_0x33ba('0xe')][_0x3c8b7d][_0x33ba('0x15')][_0x33ba('0x13')]=_0x33ba('0x27');this[_0x33ba('0xe')][_0x3c8b7d][_0x33ba('0x15')][_0x33ba('0x14')]=_0x52389f[_0x33ba('0x11')];if(_0x52389f[_0x33ba('0x28')]){this[_0x33ba('0xe')][_0x3c8b7d]['Imap'][_0x33ba('0x16')]=_0x52389f[_0x33ba('0x28')][_0x33ba('0x16')];}return this[_0x33ba('0x1a')](_0x3c8b7d);}};EmailChannel[_0x33ba('0x10')]['handleImapEmail']=function(_0x528b8d,_0xc27f81){logger[_0x33ba('0xc')](_0x33ba('0x29'),_0xc27f81[_0x33ba('0x2a')],_0xc27f81[_0x33ba('0x2b')],_0xc27f81[_0x33ba('0x2c')],_0x528b8d);if(this['mailAccounts'][_0x528b8d]){return mailAccount[_0x33ba('0x2d')](_0x528b8d,_0xc27f81)[_0x33ba('0x2e')](function(_0x284145){if(_0x284145){logger[_0x33ba('0xc')](_0x33ba('0x2f'));}})[_0x33ba('0x30')](function(_0x72da3f){logger[_0x33ba('0x26')](_0x33ba('0x31'),JSON[_0x33ba('0x18')](_0x72da3f));});}};EmailChannel[_0x33ba('0x10')][_0x33ba('0x32')]=function(_0x3316c7){if(this[_0x33ba('0xe')][_0x3316c7]&&this[_0x33ba('0xe')][_0x3316c7][_0x33ba('0x15')]){if(this[_0x33ba('0xf')][this['mailAccounts'][_0x3316c7][_0x33ba('0x15')]['id']]){delete this['imapAccounts'][this['mailAccounts'][_0x3316c7][_0x33ba('0x15')]['id']];}this[_0x33ba('0xe')][_0x3316c7][_0x33ba('0x15')][_0x33ba('0x33')]=moment();this[_0x33ba('0x1a')](_0x3316c7);}};EmailChannel[_0x33ba('0x10')][_0x33ba('0x34')]=function(_0x44ca73,_0x52fa51){if(this[_0x33ba('0xe')][_0x44ca73]){this['mailAccounts'][_0x44ca73][_0x33ba('0x15')][_0x33ba('0x13')]=_0x33ba('0x26');this[_0x33ba('0xe')][_0x44ca73][_0x33ba('0x15')][_0x33ba('0x14')]=_0x52fa51;return this[_0x33ba('0x1a')](_0x44ca73);}};EmailChannel[_0x33ba('0x10')]['sendMail']=function(_0x881bb,_0x21d3d1){return this['smtp'][_0x33ba('0x35')](_0x881bb,_0x21d3d1);};EmailChannel[_0x33ba('0x10')]['verifySmtp']=function(_0x21b166){var _0x3b5d5d=this;if(this[_0x33ba('0xe')][_0x21b166['id']]){if(_[_0x33ba('0x17')](this[_0x33ba('0xe')][_0x21b166['id']][_0x33ba('0x36')])){this[_0x33ba('0xe')][_0x21b166['id']]['Smtp']={};}this[_0x33ba('0xe')][_0x21b166['id']][_0x33ba('0x36')][_0x33ba('0x33')]=moment();return new BPromise(function(_0x54678d,_0x40c59a){return _0x3b5d5d[_0x33ba('0x37')][_0x33ba('0x38')](_0x21b166)[_0x33ba('0x2e')](function(_0x3d4ba8){_0x3b5d5d[_0x33ba('0xe')][_0x21b166['id']][_0x33ba('0x36')]['status']=_0x33ba('0x39');_0x3b5d5d[_0x33ba('0xe')][_0x21b166['id']]['Smtp'][_0x33ba('0x14')]='';_0x3b5d5d[_0x33ba('0x1a')](_0x21b166['id']);_0x54678d(_0x3d4ba8);})[_0x33ba('0x30')](function(_0x421ffe){_0x3b5d5d[_0x33ba('0xe')][_0x21b166['id']][_0x33ba('0x36')]['status']=_0x33ba('0x26');_0x3b5d5d[_0x33ba('0xe')][_0x21b166['id']][_0x33ba('0x36')]['messageStatus']=_0x421ffe;_0x3b5d5d[_0x33ba('0x1a')](_0x21b166['id']);_0x40c59a(_0x421ffe);});});}return this[_0x33ba('0x37')]['verify'](_0x21b166);};module[_0x33ba('0x3a')]=EmailChannel; \ No newline at end of file +var _0x4a18=['Mail\x20accepted\x20from\x20routing','catch','error','lastSync','sendMail','send','Smtp','verify','exports','lodash','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','email','defaults','redis','localhost','socket.io-emitter','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','prototype','name','key','Imap','status','stringify','md5','emit','mailAccount:update','hasOwnProperty','active','provider','custom','imapAccounts','handleImapBox','bind','handleImapEmail','end','handleImapEnd','handleImapError','isNil','disabled','messageStatus','connected','total','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then'];(function(_0x39b48a,_0x4e475a){var _0x2577c1=function(_0x201cd7){while(--_0x201cd7){_0x39b48a['push'](_0x39b48a['shift']());}};_0x2577c1(++_0x4e475a);}(_0x4a18,0xf1));var _0x84a1=function(_0x369534,_0x5557c4){_0x369534=_0x369534-0x0;var _0x524bf9=_0x4a18[_0x369534];return _0x524bf9;};'use strict';var _=require(_0x84a1('0x0'));var moment=require(_0x84a1('0x1'));var BPromise=require(_0x84a1('0x2'));var md5=require('md5');var Redis=require(_0x84a1('0x3'));var config=require(_0x84a1('0x4'));var logger=require(_0x84a1('0x5'))(_0x84a1('0x6'));config['redis']=_[_0x84a1('0x7')](config[_0x84a1('0x8')],{'host':_0x84a1('0x9'),'port':0x18eb});var io=require(_0x84a1('0xa'))(new Redis(config[_0x84a1('0x8')]));var EmailImap=require(_0x84a1('0xb'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x84a1('0xc'));var md5Accounts={};function EmailChannel(_0x48613f){logger[_0x84a1('0xd')](_0x84a1('0xe'));this[_0x84a1('0xf')]=_0x48613f['mailAccounts'];this['imapAccounts']={};this[_0x84a1('0x10')]=new EmailSmtp();}EmailChannel[_0x84a1('0x11')]['emit']=function(_0x5610a5){var _0x188380=this[_0x84a1('0xf')][_0x5610a5];var _0x325929={'id':_0x188380['id'],'name':_0x188380[_0x84a1('0x12')],'key':_0x188380[_0x84a1('0x13')],'active':_0x188380['active'],'Imap':{'status':_0x188380[_0x84a1('0x14')][_0x84a1('0x15')],'messageStatus':_0x188380[_0x84a1('0x14')]['messageStatus'],'total':_0x188380['Imap']['total']}};if(_['isNil'](md5Accounts[_0x5610a5])){md5Accounts[_0x5610a5]={};}var _0x5a08ee=md5(JSON[_0x84a1('0x16')](_0x325929));if(md5Accounts[_0x5610a5][_0x84a1('0x17')]!==_0x5a08ee){md5Accounts[_0x5610a5]['md5']=_0x5a08ee;io[_0x84a1('0x18')](_0x84a1('0x19'),_0x325929);}};EmailChannel[_0x84a1('0x11')]['refresh']=function(_0xaed53c){for(var _0x260233 in _0xaed53c){if(_0xaed53c[_0x84a1('0x1a')](_0x260233)){if(_0xaed53c[_0x260233][_0x84a1('0x14')]&&_0xaed53c[_0x260233][_0x84a1('0x1b')]){var _0x394956=_0xaed53c[_0x260233][_0x84a1('0x14')];if(!_0x394956['service']&&_0xaed53c[_0x260233][_0x84a1('0x1c')]!==_0x84a1('0x1d'))_0x394956['service']=_0xaed53c[_0x260233][_0x84a1('0x1c')];if(!this[_0x84a1('0x1e')][_0x84a1('0x1a')](_0x394956['id'])){this['imapAccounts'][_0x394956['id']]=new EmailImap(_0x394956,_0xaed53c[_0x260233][_0x84a1('0x6')]);this[_0x84a1('0x1e')][_0x394956['id']]['on']('box',this[_0x84a1('0x1f')][_0x84a1('0x20')](this,_0x260233));this[_0x84a1('0x1e')][_0x394956['id']]['on'](_0x84a1('0x6'),this[_0x84a1('0x21')][_0x84a1('0x20')](this,_0x260233));this['imapAccounts'][_0x394956['id']]['on'](_0x84a1('0x22'),this[_0x84a1('0x23')][_0x84a1('0x20')](this,_0x260233));this['imapAccounts'][_0x394956['id']]['on']('error',this[_0x84a1('0x24')][_0x84a1('0x20')](this,_0x260233));}}else{if(_[_0x84a1('0x25')](this['mailAccounts'][_0x260233][_0x84a1('0x14')])){this[_0x84a1('0xf')][_0x260233][_0x84a1('0x14')]={};}this[_0x84a1('0xf')][_0x260233][_0x84a1('0x14')][_0x84a1('0x15')]=_0x84a1('0x26');this[_0x84a1('0xf')][_0x260233][_0x84a1('0x14')][_0x84a1('0x27')]='';this[_0x84a1('0x18')](_0x260233);}}}};EmailChannel[_0x84a1('0x11')][_0x84a1('0x1f')]=function(_0x3372e0,_0x46429a){if(this[_0x84a1('0xf')][_0x3372e0]){this[_0x84a1('0xf')][_0x3372e0][_0x84a1('0x14')][_0x84a1('0x15')]=_0x84a1('0x28');this[_0x84a1('0xf')][_0x3372e0][_0x84a1('0x14')]['messageStatus']=_0x46429a[_0x84a1('0x12')];if(_0x46429a['messages']){this[_0x84a1('0xf')][_0x3372e0]['Imap'][_0x84a1('0x29')]=_0x46429a[_0x84a1('0x2a')][_0x84a1('0x29')];}return this['emit'](_0x3372e0);}};EmailChannel[_0x84a1('0x11')][_0x84a1('0x21')]=function(_0x498ee3,_0x37432f){logger[_0x84a1('0xd')](_0x84a1('0x2b'),_0x37432f[_0x84a1('0x2c')],_0x37432f[_0x84a1('0x2d')],_0x37432f[_0x84a1('0x2e')],_0x498ee3);if(this[_0x84a1('0xf')][_0x498ee3]){return mailAccount[_0x84a1('0x2f')](_0x498ee3,_0x37432f)[_0x84a1('0x30')](function(_0x4403e4){if(_0x4403e4){logger[_0x84a1('0xd')](_0x84a1('0x31'));}})[_0x84a1('0x32')](function(_0x6f9442){logger[_0x84a1('0x33')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0x6f9442));});}};EmailChannel['prototype']['handleImapEnd']=function(_0x3c1087){if(this[_0x84a1('0xf')][_0x3c1087]&&this['mailAccounts'][_0x3c1087][_0x84a1('0x14')]){if(this['imapAccounts'][this[_0x84a1('0xf')][_0x3c1087][_0x84a1('0x14')]['id']]){delete this[_0x84a1('0x1e')][this['mailAccounts'][_0x3c1087][_0x84a1('0x14')]['id']];}this[_0x84a1('0xf')][_0x3c1087][_0x84a1('0x14')][_0x84a1('0x34')]=moment();this[_0x84a1('0x18')](_0x3c1087);}};EmailChannel[_0x84a1('0x11')][_0x84a1('0x24')]=function(_0x49167d,_0x1ccf3e){if(this[_0x84a1('0xf')][_0x49167d]){this['mailAccounts'][_0x49167d][_0x84a1('0x14')]['status']=_0x84a1('0x33');this[_0x84a1('0xf')][_0x49167d]['Imap'][_0x84a1('0x27')]=_0x1ccf3e;return this['emit'](_0x49167d);}};EmailChannel[_0x84a1('0x11')][_0x84a1('0x35')]=function(_0x2d9123,_0x51617d){return this[_0x84a1('0x10')][_0x84a1('0x36')](_0x2d9123,_0x51617d);};EmailChannel['prototype']['verifySmtp']=function(_0x34629f){var _0x45e750=this;if(this[_0x84a1('0xf')][_0x34629f['id']]){if(_[_0x84a1('0x25')](this[_0x84a1('0xf')][_0x34629f['id']]['Smtp'])){this[_0x84a1('0xf')][_0x34629f['id']][_0x84a1('0x37')]={};}this[_0x84a1('0xf')][_0x34629f['id']]['Smtp'][_0x84a1('0x34')]=moment();return new BPromise(function(_0xd93b09,_0x59d9b0){return _0x45e750['smtp']['verify'](_0x34629f)['then'](function(_0x18a853){_0x45e750[_0x84a1('0xf')][_0x34629f['id']][_0x84a1('0x37')][_0x84a1('0x15')]='verified';_0x45e750['mailAccounts'][_0x34629f['id']]['Smtp'][_0x84a1('0x27')]='';_0x45e750[_0x84a1('0x18')](_0x34629f['id']);_0xd93b09(_0x18a853);})[_0x84a1('0x32')](function(_0x67e858){_0x45e750[_0x84a1('0xf')][_0x34629f['id']]['Smtp']['status']='error';_0x45e750[_0x84a1('0xf')][_0x34629f['id']][_0x84a1('0x37')][_0x84a1('0x27')]=_0x67e858;_0x45e750['emit'](_0x34629f['id']);_0x59d9b0(_0x67e858);});});}return this['smtp'][_0x84a1('0x38')](_0x34629f);};module[_0x84a1('0x39')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index a7a35f9..1a411d0 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 _0x8769=['simpleParser','iconv','Iconv','events','EventEmitter','./utils','email','mailbox','account','getAccount','ready','handleReady','bind','once','end','handleEnd','error','handleError','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','autotls','openBox','handleOpenBox','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','handleFetchError','stringify','textCode','hasOwnProperty','exports','util','imap','mailparser'];(function(_0x4896cd,_0x5d5055){var _0x339b5c=function(_0x4994c2){while(--_0x4994c2){_0x4896cd['push'](_0x4896cd['shift']());}};_0x339b5c(++_0x5d5055);}(_0x8769,0x142));var _0x9876=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x8769[_0x31a371];return _0x2a5bd6;};'use strict';var _=require('lodash');var util=require(_0x9876('0x0'));var Imap=require(_0x9876('0x1'));var simpleParser=require(_0x9876('0x2'))[_0x9876('0x3')];var Iconv=require(_0x9876('0x4'))[_0x9876('0x5')];var EventEmitter=require(_0x9876('0x6'))[_0x9876('0x7')];var utils=require(_0x9876('0x8'));var logger=require('../../../config/logger')(_0x9876('0x9'));function EmailImap(_0x340df9,_0x2f2b5d){this[_0x9876('0xa')]=_0x340df9[_0x9876('0xa')];this[_0x9876('0xb')]=this[_0x9876('0xc')](_0x340df9,_0x2f2b5d);this[_0x9876('0x1')]=new Imap(this[_0x9876('0xb')]);this[_0x9876('0x1')]['once'](_0x9876('0xd'),this[_0x9876('0xe')][_0x9876('0xf')](this));this[_0x9876('0x1')][_0x9876('0x10')](_0x9876('0x11'),this[_0x9876('0x12')]['bind'](this));this['imap']['on'](_0x9876('0x13'),this[_0x9876('0x14')]['bind'](this));this[_0x9876('0x1')]['connect']();}util[_0x9876('0x15')](EmailImap,EventEmitter);EmailImap[_0x9876('0x16')][_0x9876('0xc')]=function(_0x4a741a,_0x5825c9){var _0x4d3451={'connTimeout':_0x4a741a[_0x9876('0x17')]?_0x4a741a[_0x9876('0x17')]*0x3e8:0x2710,'authTimeout':_0x4a741a[_0x9876('0x18')]?_0x4a741a[_0x9876('0x18')]*0x3e8:0x1388};if(_0x4a741a[_0x9876('0x19')]){_0x4d3451[_0x9876('0x1a')]=_0x4a741a[_0x9876('0x1a')];if(_0x4a741a[_0x9876('0x1b')]){_0x4d3451[_0x9876('0x1c')]=utils[_0x9876('0x1d')](_0x4a741a[_0x9876('0x1e')][_0x9876('0x1f')],_0x4a741a[_0x9876('0x1a')]);}else{_0x4d3451['password']=_0x4a741a[_0x9876('0x20')];}}else{if(_0x4a741a[_0x9876('0x21')]){_0x4d3451[_0x9876('0x1a')]=_0x4a741a['user'];_0x4d3451[_0x9876('0x20')]=_0x4a741a[_0x9876('0x20')];}}_0x4d3451['email']=_0x5825c9||_0x4a741a[_0x9876('0x1a')]||'anonymous@xcally.com';_0x4d3451[_0x9876('0x22')]=_0x4a741a['host'];_0x4d3451[_0x9876('0x23')]=_0x4a741a['port']||0x3e1;if(_0x4a741a[_0x9876('0x24')]){_0x4d3451[_0x9876('0x24')]=!![];}else{_0x4d3451['tls']=![];_0x4d3451[_0x9876('0x25')]='required';}return _0x4d3451;};EmailImap[_0x9876('0x16')][_0x9876('0xe')]=function(){this['imap'][_0x9876('0x26')](this['mailbox'],![],this[_0x9876('0x27')][_0x9876('0xf')](this));};EmailImap['prototype'][_0x9876('0x27')]=function(_0xf90ecd,_0xffaa50){if(_0xf90ecd){this[_0x9876('0x14')](_0xf90ecd,!![]);}else{this[_0x9876('0x28')](_0x9876('0x29'),_0xffaa50);this[_0x9876('0x2a')]();}};EmailImap[_0x9876('0x16')]['handleCloseBox']=function(_0x19b95d){if(_0x19b95d){this[_0x9876('0x14')](_0x19b95d,!![]);}else{this[_0x9876('0x1')][_0x9876('0x11')]();}};EmailImap[_0x9876('0x16')][_0x9876('0x2a')]=function(){this[_0x9876('0x1')][_0x9876('0x2b')]([_0x9876('0x2c')],this[_0x9876('0x2d')][_0x9876('0xf')](this));};EmailImap[_0x9876('0x16')][_0x9876('0x2d')]=function(_0x22d24a,_0x139cad){if(_0x22d24a){this[_0x9876('0x14')](_0x22d24a,!![]);}else{if(_0x139cad[_0x9876('0x2e')]){try{var _0x2999d2=this[_0x9876('0x1')][_0x9876('0x2f')](_0x139cad['slice'](0x0,0xa),{'bodies':'','markSeen':!![]});_0x2999d2['on'](_0x9876('0x30'),this[_0x9876('0x31')][_0x9876('0xf')](this));_0x2999d2['once'](_0x9876('0x13'),this['handleFetchError'][_0x9876('0xf')](this));_0x2999d2['once'](_0x9876('0x11'),this['handleFetchEnd']['bind'](this));}catch(_0xe0dd56){logger[_0x9876('0x13')](_0xe0dd56);}}else{this['imap'][_0x9876('0x32')](!![],this[_0x9876('0x33')]['bind'](this));}}};EmailImap[_0x9876('0x16')][_0x9876('0x31')]=function(_0x311741){_0x311741['on'](_0x9876('0x34'),this[_0x9876('0x35')][_0x9876('0xf')](this));_0x311741[_0x9876('0x10')](_0x9876('0x36'),this[_0x9876('0x37')][_0x9876('0xf')](this));_0x311741[_0x9876('0x10')](_0x9876('0x11'),this[_0x9876('0x38')][_0x9876('0xf')](this));};EmailImap[_0x9876('0x16')][_0x9876('0x35')]=function(_0x10344d){simpleParser(_0x10344d,{'Iconv':Iconv},this[_0x9876('0x39')][_0x9876('0xf')](this));};EmailImap[_0x9876('0x16')][_0x9876('0x37')]=function(){};EmailImap[_0x9876('0x16')][_0x9876('0x38')]=function(){};EmailImap['prototype'][_0x9876('0x39')]=function(_0x1d569a,_0x16bec0){if(_0x1d569a){logger[_0x9876('0x13')](_0x1d569a);}else{var _0x3dd70c=this;utils[_0x9876('0x3a')](this[_0x9876('0xb')],_0x16bec0,function(_0x847e08){_0x3dd70c[_0x9876('0x28')](_0x9876('0x9'),_0x847e08);});}};EmailImap[_0x9876('0x16')][_0x9876('0x3b')]=function(){this[_0x9876('0x1')][_0x9876('0x32')](!![],this[_0x9876('0x33')][_0x9876('0xf')](this));};EmailImap[_0x9876('0x16')][_0x9876('0x3c')]=function(_0x4fd4ae){this['handleError'](_0x4fd4ae);this[_0x9876('0x1')]['closeBox'](!![],this['handleCloseBox'][_0x9876('0xf')](this));};EmailImap[_0x9876('0x16')][_0x9876('0x12')]=function(){this[_0x9876('0x28')](_0x9876('0x11'));};EmailImap['prototype'][_0x9876('0x14')]=function(_0x2a9242,_0x3cc443){logger[_0x9876('0x13')](_0x9876('0x14'),this[_0x9876('0xb')][_0x9876('0x9')],JSON[_0x9876('0x3d')](_0x2a9242));var _0x527976='';if(_0x2a9242){if(_0x2a9242['textCode']){_0x527976=_0x2a9242[_0x9876('0x3e')];}else{for(var _0x2e9c7d in _0x2a9242){if(_0x2a9242[_0x9876('0x3f')](_0x2e9c7d)){_0x527976+=_['upperFirst'](_0x2e9c7d)+':\x20'+_0x2a9242[_0x2e9c7d]+'\x0a';}}}}if(_0x3cc443){this[_0x9876('0x1')]['end']();}else{this['emit'](_0x9876('0x13'),_0x527976);this[_0x9876('0x28')]('end');}};module[_0x9876('0x40')]=EmailImap; \ No newline at end of file +var _0x69dd=['util','mailparser','simpleParser','iconv','Iconv','EventEmitter','../../../config/logger','email','mailbox','imap','account','once','ready','bind','end','handleError','getAccount','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','data5','password','anonymous@xcally.com','host','port','tls','autotls','required','prototype','handleReady','openBox','handleOpenBox','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','error','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','body','attributes','handleMessageAttributes','handleMessageBody','handleSimpleParser','handleMessageEnd','parser','emit','handleEnd','textCode','upperFirst','exports'];(function(_0x2a6f2a,_0x32336e){var _0x434fc9=function(_0x5b0510){while(--_0x5b0510){_0x2a6f2a['push'](_0x2a6f2a['shift']());}};_0x434fc9(++_0x32336e);}(_0x69dd,0x1b2));var _0xd69d=function(_0x1e0d9a,_0x214450){_0x1e0d9a=_0x1e0d9a-0x0;var _0x36cbe0=_0x69dd[_0x1e0d9a];return _0x36cbe0;};'use strict';var _=require('lodash');var util=require(_0xd69d('0x0'));var Imap=require('imap');var simpleParser=require(_0xd69d('0x1'))[_0xd69d('0x2')];var Iconv=require(_0xd69d('0x3'))[_0xd69d('0x4')];var EventEmitter=require('events')[_0xd69d('0x5')];var utils=require('./utils');var logger=require(_0xd69d('0x6'))(_0xd69d('0x7'));function EmailImap(_0x2ba915,_0x41784c){this[_0xd69d('0x8')]=_0x2ba915['mailbox'];this['account']=this['getAccount'](_0x2ba915,_0x41784c);this[_0xd69d('0x9')]=new Imap(this[_0xd69d('0xa')]);this['imap'][_0xd69d('0xb')](_0xd69d('0xc'),this['handleReady'][_0xd69d('0xd')](this));this[_0xd69d('0x9')]['once'](_0xd69d('0xe'),this['handleEnd'][_0xd69d('0xd')](this));this[_0xd69d('0x9')]['on']('error',this[_0xd69d('0xf')][_0xd69d('0xd')](this));this[_0xd69d('0x9')]['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0xd69d('0x10')]=function(_0x36ad89,_0x4ec820){var _0x499639={'connTimeout':_0x36ad89[_0xd69d('0x11')]?_0x36ad89[_0xd69d('0x11')]*0x3e8:0x2710,'authTimeout':_0x36ad89[_0xd69d('0x12')]?_0x36ad89['authTimeout']*0x3e8:0x1388};if(_0x36ad89[_0xd69d('0x13')]){_0x499639[_0xd69d('0x14')]=_0x36ad89['user'];if(_0x36ad89[_0xd69d('0x15')]){_0x499639[_0xd69d('0x16')]=utils[_0xd69d('0x17')](_0x36ad89['CloudProvider'][_0xd69d('0x18')],_0x36ad89['user']);}else{_0x499639[_0xd69d('0x19')]=_0x36ad89[_0xd69d('0x19')];}}else{if(_0x36ad89['authentication']){_0x499639[_0xd69d('0x14')]=_0x36ad89['user'];_0x499639[_0xd69d('0x19')]=_0x36ad89[_0xd69d('0x19')];}}_0x499639[_0xd69d('0x7')]=_0x4ec820||_0x36ad89[_0xd69d('0x14')]||_0xd69d('0x1a');_0x499639[_0xd69d('0x1b')]=_0x36ad89[_0xd69d('0x1b')];_0x499639['port']=_0x36ad89[_0xd69d('0x1c')]||0x3e1;if(_0x36ad89[_0xd69d('0x1d')]){_0x499639[_0xd69d('0x1d')]=!![];}else{_0x499639[_0xd69d('0x1d')]=![];_0x499639[_0xd69d('0x1e')]=_0xd69d('0x1f');}return _0x499639;};EmailImap[_0xd69d('0x20')][_0xd69d('0x21')]=function(){this[_0xd69d('0x9')][_0xd69d('0x22')](this[_0xd69d('0x8')],![],this[_0xd69d('0x23')]['bind'](this));};EmailImap[_0xd69d('0x20')]['handleOpenBox']=function(_0x40d419,_0x25c0ca){if(_0x40d419){this['handleError'](_0x40d419,!![]);}else{this['emit'](_0xd69d('0x24'),_0x25c0ca);this[_0xd69d('0x25')]();}};EmailImap['prototype']['handleCloseBox']=function(_0x5da9c4){if(_0x5da9c4){this[_0xd69d('0xf')](_0x5da9c4,!![]);}else{this[_0xd69d('0x9')][_0xd69d('0xe')]();}};EmailImap[_0xd69d('0x20')]['readUnseen']=function(){this['imap'][_0xd69d('0x26')]([_0xd69d('0x27')],this[_0xd69d('0x28')][_0xd69d('0xd')](this));};EmailImap['prototype'][_0xd69d('0x28')]=function(_0x1c5d92,_0x5171d2){if(_0x1c5d92){this['handleError'](_0x1c5d92,!![]);}else{if(_0x5171d2[_0xd69d('0x29')]){try{var _0x303d72=this[_0xd69d('0x9')][_0xd69d('0x2a')](_0x5171d2,{'bodies':'','markSeen':!![]});_0x303d72['on'](_0xd69d('0x2b'),this[_0xd69d('0x2c')][_0xd69d('0xd')](this));_0x303d72[_0xd69d('0xb')](_0xd69d('0x2d'),this[_0xd69d('0x2e')]['bind'](this));_0x303d72[_0xd69d('0xb')](_0xd69d('0xe'),this[_0xd69d('0x2f')][_0xd69d('0xd')](this));}catch(_0x5504ad){logger[_0xd69d('0x2d')](_0x5504ad);}}else{this['imap'][_0xd69d('0x30')](!![],this[_0xd69d('0x31')][_0xd69d('0xd')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x259d7e){_0x259d7e['on'](_0xd69d('0x32'),this['handleMessageBody'][_0xd69d('0xd')](this));_0x259d7e[_0xd69d('0xb')](_0xd69d('0x33'),this[_0xd69d('0x34')][_0xd69d('0xd')](this));_0x259d7e[_0xd69d('0xb')](_0xd69d('0xe'),this['handleMessageEnd'][_0xd69d('0xd')](this));};EmailImap[_0xd69d('0x20')][_0xd69d('0x35')]=function(_0x54f0b0){simpleParser(_0x54f0b0,{'Iconv':Iconv},this[_0xd69d('0x36')][_0xd69d('0xd')](this));};EmailImap[_0xd69d('0x20')]['handleMessageAttributes']=function(){};EmailImap[_0xd69d('0x20')][_0xd69d('0x37')]=function(){};EmailImap[_0xd69d('0x20')][_0xd69d('0x36')]=function(_0x42173e,_0x5f27c0){if(_0x42173e){logger[_0xd69d('0x2d')](_0x42173e);}else{var _0x2dcf25=this;utils[_0xd69d('0x38')](this[_0xd69d('0xa')],_0x5f27c0,function(_0x2310b8){_0x2dcf25[_0xd69d('0x39')]('email',_0x2310b8);});}};EmailImap[_0xd69d('0x20')][_0xd69d('0x2f')]=function(){this[_0xd69d('0x9')][_0xd69d('0x30')](!![],this[_0xd69d('0x31')]['bind'](this));};EmailImap['prototype'][_0xd69d('0x2e')]=function(_0x463bf4){this[_0xd69d('0xf')](_0x463bf4);this['imap']['closeBox'](!![],this[_0xd69d('0x31')][_0xd69d('0xd')](this));};EmailImap[_0xd69d('0x20')][_0xd69d('0x3a')]=function(){this['emit'](_0xd69d('0xe'));};EmailImap[_0xd69d('0x20')]['handleError']=function(_0x476b08,_0x18d085){logger['error'](_0xd69d('0xf'),this[_0xd69d('0xa')][_0xd69d('0x7')],JSON['stringify'](_0x476b08));var _0x761ea3='';if(_0x476b08){if(_0x476b08['textCode']){_0x761ea3=_0x476b08[_0xd69d('0x3b')];}else{for(var _0x1c784c in _0x476b08){if(_0x476b08['hasOwnProperty'](_0x1c784c)){_0x761ea3+=_[_0xd69d('0x3c')](_0x1c784c)+':\x20'+_0x476b08[_0x1c784c]+'\x0a';}}}}if(_0x18d085){this[_0xd69d('0x9')][_0xd69d('0xe')]();}else{this['emit'](_0xd69d('0x2d'),_0x761ea3);this[_0xd69d('0x39')](_0xd69d('0xe'));}};module[_0xd69d('0x3d')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index fc0019f..200e0da 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 _0x4991=['sendMail','verify','toString','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','createTransport','use','compile'];(function(_0x4ff5a2,_0xb33150){var _0xe162f6=function(_0x321cbd){while(--_0x321cbd){_0x4ff5a2['push'](_0x4ff5a2['shift']());}};_0xe162f6(++_0xb33150);}(_0x4991,0x186));var _0x1499=function(_0x3e00ca,_0xe4824b){_0x3e00ca=_0x3e00ca-0x0;var _0xe1bcdc=_0x4991[_0x3e00ca];return _0xe1bcdc;};'use strict';var nodemailer=require(_0x1499('0x0'));var inlineBase64=require(_0x1499('0x1'));function EmailSmtp(){}EmailSmtp[_0x1499('0x2')]['send']=function(_0x40bc06,_0x3105fd){return new Promise(function(_0x14c442,_0x4e6eb6){var _0x46ce84=nodemailer[_0x1499('0x3')](_0x40bc06);_0x46ce84[_0x1499('0x4')](_0x1499('0x5'),inlineBase64());_0x46ce84[_0x1499('0x6')](_0x3105fd,function(_0x49b1a0,_0x53fccd){if(_0x49b1a0){_0x4e6eb6(_0x49b1a0['toString']());}else{_0x14c442(_0x53fccd);}});});};EmailSmtp[_0x1499('0x2')][_0x1499('0x7')]=function(_0x52d87e){return new Promise(function(_0x3eaf86,_0x3335f3){var _0x4cf5d3=nodemailer[_0x1499('0x3')](_0x52d87e);_0x4cf5d3[_0x1499('0x7')](function(_0x19fe9f,_0x353931){if(_0x19fe9f){_0x3335f3(_0x19fe9f[_0x1499('0x8')]());}else{if(_0x353931){_0x3eaf86(_0x353931);}else{_0x3335f3(_0x1499('0x9'));}}});});};module[_0x1499('0xa')]=EmailSmtp; \ No newline at end of file +var _0xdb76=['exports','nodemailer-plugin-inline-base64','prototype','send','createTransport','sendMail','toString','verify','Not\x20verifired'];(function(_0x63aa4b,_0x2079d7){var _0x25bf70=function(_0x3949d3){while(--_0x3949d3){_0x63aa4b['push'](_0x63aa4b['shift']());}};_0x25bf70(++_0x2079d7);}(_0xdb76,0xc7));var _0x6db7=function(_0xf0b070,_0x26d94d){_0xf0b070=_0xf0b070-0x0;var _0x1726e2=_0xdb76[_0xf0b070];return _0x1726e2;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x6db7('0x0'));function EmailSmtp(){}EmailSmtp[_0x6db7('0x1')][_0x6db7('0x2')]=function(_0x1d2fa1,_0x1a68a3){return new Promise(function(_0x36df4d,_0xb212ef){var _0x1ad1f9=nodemailer[_0x6db7('0x3')](_0x1d2fa1);_0x1ad1f9['use']('compile',inlineBase64());_0x1ad1f9[_0x6db7('0x4')](_0x1a68a3,function(_0x1eae01,_0x426cfa){if(_0x1eae01){_0xb212ef(_0x1eae01[_0x6db7('0x5')]());}else{_0x36df4d(_0x426cfa);}});});};EmailSmtp[_0x6db7('0x1')]['verify']=function(_0x2498f8){return new Promise(function(_0x12f128,_0x167cd3){var _0x30f3fb=nodemailer[_0x6db7('0x3')](_0x2498f8);_0x30f3fb[_0x6db7('0x6')](function(_0x55da98,_0x2c7c1b){if(_0x55da98){_0x167cd3(_0x55da98[_0x6db7('0x5')]());}else{if(_0x2c7c1b){_0x12f128(_0x2c7c1b);}else{_0x167cd3(_0x6db7('0x7'));}}});});};module[_0x6db7('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 3c3afc4..6a57039 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 _0xc1c1=['substring','split','length','slice','pop','isEmpty','generate','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','path','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','name'];(function(_0x23e61e,_0x4e9cbb){var _0x734dba=function(_0x7e951d){while(--_0x7e951d){_0x23e61e['push'](_0x23e61e['shift']());}};_0x734dba(++_0x4e9cbb);}(_0xc1c1,0xd4));var _0x1c1c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc1c1[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x1c1c('0x0'));var moment=require('moment');var random=require('randomstring');var fs=require('fs');var path=require(_0x1c1c('0x1'));var util=require('util');var tnef=require(_0x1c1c('0x2'));var logger=require(_0x1c1c('0x3'))(_0x1c1c('0x4'));var config=require(_0x1c1c('0x5'));function getAddress(_0x1046ca){var _0x2078e1=_[_0x1c1c('0x6')](_0x1046ca[_0x1c1c('0x7')]);return _0x2078e1&&_0x2078e1[_0x1c1c('0x8')]?_0x2078e1[_0x1c1c('0x8')]:'anonymous'+random['generate'](0x6)+'@xcally.com';}function getFirstName(_0x216d01){var _0x38e2eb=_['head'](_0x216d01[_0x1c1c('0x7')]);if(_0x38e2eb&&_0x38e2eb[_0x1c1c('0x9')]){if(_0x38e2eb['name']==_0x38e2eb[_0x1c1c('0x8')]){return _0x38e2eb[_0x1c1c('0x9')][_0x1c1c('0xa')](0x0,_0x38e2eb['name']['indexOf']('@'));}var _0x205fb5=_0x38e2eb['name'][_0x1c1c('0xb')](/\s+/);return _0x205fb5[_0x1c1c('0xc')]>0x1?_0x205fb5[_0x1c1c('0xd')](0x0,-0x1)['join']('\x20'):_0x38e2eb[_0x1c1c('0x9')];}return'Anonymous';}function getLastName(_0x1f9fc2){var _0x47d850=_['head'](_0x1f9fc2[_0x1c1c('0x7')]);if(_0x47d850&&_0x47d850['name']){var _0x57d113=_0x47d850[_0x1c1c('0x9')]['split'](/\s+/);return _0x57d113[_0x1c1c('0xc')]>0x1?_0x57d113[_0x1c1c('0xe')]():'';}return'';}function getMails(_0x50aa87,_0x18962d){var _0x5013a0='';for(var _0x10a759=0x0;_0x10a759<_0x18962d['value']['length'];_0x10a759+=0x1){if(_0x18962d['value'][_0x10a759][_0x1c1c('0x8')]!==_0x50aa87){if(!_[_0x1c1c('0xf')](_0x5013a0)){_0x5013a0+=',';}_0x5013a0+=_0x18962d[_0x1c1c('0x7')][_0x10a759][_0x1c1c('0x9')]||_0x18962d[_0x1c1c('0x7')][_0x10a759][_0x1c1c('0x8')]||'';_0x5013a0+='\x20<';_0x5013a0+=_0x18962d[_0x1c1c('0x7')][_0x10a759][_0x1c1c('0x8')]?_0x18962d[_0x1c1c('0x7')][_0x10a759]['address']:'anonymous'+random[_0x1c1c('0x10')](0x6)+'@xcally.com';_0x5013a0+='>';}}return _0x5013a0;}function parseEmail(_0x241c80,_0x1d6028,_0x30624d){if(_0x1d6028[_0x1c1c('0x11')]){var _0x417ccb=/)<[^<]*)*<\/script>/gi;while(_0x417ccb[_0x1c1c('0x12')](_0x1d6028[_0x1c1c('0x11')])){_0x1d6028[_0x1c1c('0x11')]=_0x1d6028[_0x1c1c('0x11')][_0x1c1c('0x13')](_0x417ccb,'');}if(_0x1d6028[_0x1c1c('0x11')][_0x1c1c('0x14')](_0x1c1c('0x15'))){var _0x22bed0=[];_0x1d6028[_0x1c1c('0x16')]['forEach'](_0x12ee4e=>{_0x22bed0[_0x1c1c('0x17')](_0x12ee4e[_0x1c1c('0x18')]);});var _0x450f99=/]+>/g;var _0x593824=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0xa7936a=_0x1d6028[_0x1c1c('0x11')][_0x1c1c('0x13')](_0x593824,_0x1c1c('0x19'));var _0x29b04f=_0xa7936a['replace'](_0x450f99,'_IMG');for(let _0x423ee9=0x0;_0x423ee9<_0x22bed0['length'];_0x423ee9++){var _0x2215a4=_0x29b04f[_0x1c1c('0x13')](_0x1c1c('0x1a'),_0x1c1c('0x1b')+_0x22bed0[_0x423ee9]+_0x1c1c('0x1c'));_0x29b04f=_0x2215a4;}_0x1d6028[_0x1c1c('0x11')]=_0x29b04f;}_0x30624d['body']=_0x1d6028[_0x1c1c('0x11')];}else{_0x30624d[_0x1c1c('0x1d')]=_0x1d6028[_0x1c1c('0x1e')];}if(_0x30624d['body']){_0x30624d['body']=_0x30624d[_0x1c1c('0x1d')][_0x1c1c('0x13')](/0x0){var _0x17925b=[_0x1c1c('0x30'),'X-Auto-Response-Suppress:\x20All',_0x1c1c('0x31')];for(var _0x166953=0x0;_0x166953<_0x1d6028['headerLines'][_0x1c1c('0xc')];_0x166953++){var _0x562291=_[_0x1c1c('0x32')](_0x17925b,_0x1d6028['headerLines'][_0x166953][_0x1c1c('0x33')]);if(_0x562291>=0x0){_0x30624d[_0x1c1c('0x34')]=!![];}}}return _0x30624d;}exports['parser']=function(_0x5805a8,_0x4d5985,_0xbf53c8){var _0x59ff32={'from':getAddress(_0x4d5985['from']),'firstName':getFirstName(_0x4d5985[_0x1c1c('0x35')]),'lastName':getLastName(_0x4d5985[_0x1c1c('0x35')]),'mapKey':_0x1c1c('0x4'),'message':{'from':getMails(_0x5805a8[_0x1c1c('0x4')],_0x4d5985[_0x1c1c('0x35')]),'to':_0x5805a8[_0x1c1c('0x4')],'cc':'','subject':_0x4d5985[_0x1c1c('0x36')]||'','messageId':_0x4d5985[_0x1c1c('0x37')],'inReplyTo':_0x4d5985[_0x1c1c('0x38')],'sentAt':moment(_0x4d5985[_0x1c1c('0x39')])['format'](_0x1c1c('0x3a')),'attach':![],'attachments':[]}};if(!_0x4d5985[_0x1c1c('0x11')]&&!_0x4d5985[_0x1c1c('0x1e')]){var _0x40bc37=_['filter'](_0x4d5985[_0x1c1c('0x16')],{'contentType':_0x1c1c('0x3b')});if(_0x40bc37['length']){logger[_0x1c1c('0x3c')](util[_0x1c1c('0x26')](_0x1c1c('0x3d'),_0x4d5985['messageId']));tnef[_0x1c1c('0x3e')](_['first'](_0x40bc37)[_0x1c1c('0x2d')],function(_0x2e2e35,_0xfbc093){if(_0xfbc093){_0x4d5985[_0x1c1c('0x11')]=_0xfbc093[_0x1c1c('0x3f')]||'

Empty\x20message

';if(_0xfbc093[_0x1c1c('0x40')]){for(var _0x4d7c25=0x0;_0x4d7c25<_0xfbc093[_0x1c1c('0x40')][_0x1c1c('0xc')];_0x4d7c25++){var _0x456d08=_0xfbc093[_0x1c1c('0x40')][_0x4d7c25];_0x59ff32[_0x1c1c('0x20')]['attachments'][_0x1c1c('0x17')]({'filename':_0x456d08[_0x1c1c('0x41')],'content':Buffer[_0x1c1c('0x35')](_0x456d08[_0x1c1c('0x42')])});}}}_0xbf53c8(parseEmail(_0x5805a8,_0x4d5985,_0x59ff32));});}else{_0x4d5985[_0x1c1c('0x11')]=_0x1c1c('0x43');_0xbf53c8(parseEmail(_0x5805a8,_0x4d5985,_0x59ff32));}}else{_0xbf53c8(parseEmail(_0x5805a8,_0x4d5985,_0x59ff32));}};exports[_0x1c1c('0x44')]=function(_0x23d0ef,_0x7ebd68){var _0x4881c9=[_0x1c1c('0x45')+(_0x7ebd68||''),_0x1c1c('0x46')+_0x23d0ef,'',''];return Buffer[_0x1c1c('0x35')](_0x4881c9['join'](''),_0x1c1c('0x47'))[_0x1c1c('0x48')](_0x1c1c('0x49'));}; \ No newline at end of file +var _0x6e72=['toString','base64','moment','node-tnef','../../../config/environment','head','value','address','anonymous','@xcally.com','name','substring','indexOf','length','slice','join','Anonymous','pop','isEmpty','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8'];(function(_0x2b0511,_0x127ce8){var _0x5a50d3=function(_0x27d4f4){while(--_0x27d4f4){_0x2b0511['push'](_0x2b0511['shift']());}};_0x5a50d3(++_0x127ce8);}(_0x6e72,0xe3));var _0x26e7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e72[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var moment=require(_0x26e7('0x0'));var random=require('randomstring');var fs=require('fs');var path=require('path');var util=require('util');var tnef=require(_0x26e7('0x1'));var logger=require('../../../config/logger')('email');var config=require(_0x26e7('0x2'));function getAddress(_0x3cd0d9){var _0x26245b=_[_0x26e7('0x3')](_0x3cd0d9[_0x26e7('0x4')]);return _0x26245b&&_0x26245b['address']?_0x26245b[_0x26e7('0x5')]:_0x26e7('0x6')+random['generate'](0x6)+_0x26e7('0x7');}function getFirstName(_0x3138f2){var _0x15d996=_[_0x26e7('0x3')](_0x3138f2[_0x26e7('0x4')]);if(_0x15d996&&_0x15d996['name']){if(_0x15d996[_0x26e7('0x8')]==_0x15d996[_0x26e7('0x5')]){return _0x15d996[_0x26e7('0x8')][_0x26e7('0x9')](0x0,_0x15d996[_0x26e7('0x8')][_0x26e7('0xa')]('@'));}var _0x28fafa=_0x15d996[_0x26e7('0x8')]['split'](/\s+/);return _0x28fafa[_0x26e7('0xb')]>0x1?_0x28fafa[_0x26e7('0xc')](0x0,-0x1)[_0x26e7('0xd')]('\x20'):_0x15d996[_0x26e7('0x8')];}return _0x26e7('0xe');}function getLastName(_0x5b8d69){var _0x3908aa=_[_0x26e7('0x3')](_0x5b8d69[_0x26e7('0x4')]);if(_0x3908aa&&_0x3908aa[_0x26e7('0x8')]){var _0x158757=_0x3908aa[_0x26e7('0x8')]['split'](/\s+/);return _0x158757['length']>0x1?_0x158757[_0x26e7('0xf')]():'';}return'';}function getMails(_0x539f49,_0x3f3933){var _0x545eef='';for(var _0x17cf44=0x0;_0x17cf44<_0x3f3933[_0x26e7('0x4')]['length'];_0x17cf44+=0x1){if(_0x3f3933[_0x26e7('0x4')][_0x17cf44][_0x26e7('0x5')]!==_0x539f49){if(!_[_0x26e7('0x10')](_0x545eef)){_0x545eef+=',';}_0x545eef+=_0x3f3933[_0x26e7('0x4')][_0x17cf44]['name']||_0x3f3933[_0x26e7('0x4')][_0x17cf44][_0x26e7('0x5')]||'';_0x545eef+='\x20<';_0x545eef+=_0x3f3933[_0x26e7('0x4')][_0x17cf44]['address']?_0x3f3933[_0x26e7('0x4')][_0x17cf44][_0x26e7('0x5')]:_0x26e7('0x6')+random['generate'](0x6)+_0x26e7('0x7');_0x545eef+='>';}}return _0x545eef;}function parseEmail(_0x2e38e7,_0x3b9e54,_0x57630a){if(_0x3b9e54[_0x26e7('0x11')]){var _0xbae9e9=/)<[^<]*)*<\/script>/gi;while(_0xbae9e9[_0x26e7('0x12')](_0x3b9e54[_0x26e7('0x11')])){_0x3b9e54[_0x26e7('0x11')]=_0x3b9e54['html'][_0x26e7('0x13')](_0xbae9e9,'');}if(_0x3b9e54[_0x26e7('0x11')][_0x26e7('0x14')](_0x26e7('0x15'))){var _0x16b95c=[];_0x3b9e54[_0x26e7('0x16')][_0x26e7('0x17')](_0x37900b=>{_0x16b95c['push'](_0x37900b[_0x26e7('0x18')]);});var _0x2b224e=/]+>/g;var _0x29112d=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4f6cfc=_0x3b9e54['html'][_0x26e7('0x13')](_0x29112d,'_SRC');var _0x1b46c8=_0x4f6cfc[_0x26e7('0x13')](_0x2b224e,_0x26e7('0x19'));for(let _0x1618c9=0x0;_0x1618c9<_0x16b95c[_0x26e7('0xb')];_0x1618c9++){var _0x38c924=_0x1b46c8[_0x26e7('0x13')](_0x26e7('0x19'),_0x26e7('0x1a')+_0x16b95c[_0x1618c9]+_0x26e7('0x1b'));_0x1b46c8=_0x38c924;}_0x3b9e54[_0x26e7('0x11')]=_0x1b46c8;}_0x57630a[_0x26e7('0x1c')]=_0x3b9e54[_0x26e7('0x11')];}else{_0x57630a[_0x26e7('0x1c')]=_0x3b9e54[_0x26e7('0x1d')];}if(_0x57630a['body']){_0x57630a[_0x26e7('0x1c')]=_0x57630a['body']['replace'](/0x0){var _0x43766d=['Auto-Submitted:\x20auto-replied',_0x26e7('0x31'),_0x26e7('0x32')];for(var _0x2811a8=0x0;_0x2811a8<_0x3b9e54[_0x26e7('0x30')][_0x26e7('0xb')];_0x2811a8++){var _0x733bb4=_['indexOf'](_0x43766d,_0x3b9e54[_0x26e7('0x30')][_0x2811a8]['line']);if(_0x733bb4>=0x0){_0x57630a['isAutoreply']=!![];}}}return _0x57630a;}exports[_0x26e7('0x33')]=function(_0x47b444,_0x11d4bf,_0x125f94){var _0x25a65a={'from':getAddress(_0x11d4bf[_0x26e7('0x34')]),'firstName':getFirstName(_0x11d4bf['from']),'lastName':getLastName(_0x11d4bf[_0x26e7('0x34')]),'mapKey':'email','message':{'from':getMails(_0x47b444['email'],_0x11d4bf[_0x26e7('0x34')]),'to':_0x47b444[_0x26e7('0x21')],'cc':'','subject':_0x11d4bf[_0x26e7('0x35')]||'','messageId':_0x11d4bf[_0x26e7('0x36')],'inReplyTo':_0x11d4bf[_0x26e7('0x37')],'sentAt':moment(_0x11d4bf[_0x26e7('0x38')])[_0x26e7('0x28')](_0x26e7('0x39')),'attach':![],'attachments':[]}};if(!_0x11d4bf['html']&&!_0x11d4bf[_0x26e7('0x1d')]){var _0x26e340=_[_0x26e7('0x3a')](_0x11d4bf[_0x26e7('0x16')],{'contentType':_0x26e7('0x3b')});if(_0x26e340[_0x26e7('0xb')]){logger[_0x26e7('0x3c')](util[_0x26e7('0x28')](_0x26e7('0x3d'),_0x11d4bf['messageId']));tnef[_0x26e7('0x3e')](_[_0x26e7('0x3f')](_0x26e340)[_0x26e7('0x2e')],function(_0x293865,_0x24dcf9){if(_0x24dcf9){_0x11d4bf[_0x26e7('0x11')]=_0x24dcf9[_0x26e7('0x40')]||'

Empty\x20message

';if(_0x24dcf9['Attachments']){for(var _0xfe0fbc=0x0;_0xfe0fbc<_0x24dcf9[_0x26e7('0x41')]['length'];_0xfe0fbc++){var _0x4a128d=_0x24dcf9['Attachments'][_0xfe0fbc];_0x25a65a[_0x26e7('0x1f')][_0x26e7('0x16')][_0x26e7('0x42')]({'filename':_0x4a128d['Title'],'content':Buffer[_0x26e7('0x34')](_0x4a128d[_0x26e7('0x43')])});}}}_0x125f94(parseEmail(_0x47b444,_0x11d4bf,_0x25a65a));});}else{_0x11d4bf[_0x26e7('0x11')]=_0x26e7('0x44');_0x125f94(parseEmail(_0x47b444,_0x11d4bf,_0x25a65a));}}else{_0x125f94(parseEmail(_0x47b444,_0x11d4bf,_0x25a65a));}};exports[_0x26e7('0x45')]=function(_0x1d4ef0,_0x84c253){var _0x41e965=[_0x26e7('0x46')+(_0x84c253||''),_0x26e7('0x47')+_0x1d4ef0,'',''];return Buffer['from'](_0x41e965[_0x26e7('0xd')](''),_0x26e7('0x48'))[_0x26e7('0x49')](_0x26e7('0x4a'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index e4255f4..679f0f2 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 _0x3ae6=['SERV','active','Imap','Smtp','exports','lodash','name','Service','key'];(function(_0x3ceaf3,_0x35dc90){var _0x2ea965=function(_0x4b181a){while(--_0x4b181a){_0x3ceaf3['push'](_0x3ceaf3['shift']());}};_0x2ea965(++_0x35dc90);}(_0x3ae6,0x95));var _0x63ae=function(_0x5aaf3d,_0x129743){_0x5aaf3d=_0x5aaf3d-0x0;var _0x3b7120=_0x3ae6[_0x5aaf3d];return _0x3b7120;};'use strict';var _=require(_0x63ae('0x0'));function MailAccount(_0xf98779){this['id']=_0xf98779['id']||0x0;this[_0x63ae('0x1')]=_0xf98779[_0x63ae('0x1')]||_0x63ae('0x2');this[_0x63ae('0x3')]=_0xf98779[_0x63ae('0x3')]||_0x63ae('0x4');this[_0x63ae('0x5')]=_0xf98779[_0x63ae('0x5')]||![];this[_0x63ae('0x6')]=_0xf98779[_0x63ae('0x6')]||[];this['Smtp']=_0xf98779[_0x63ae('0x7')]||[];}module[_0x63ae('0x8')]=MailAccount; \ No newline at end of file +var _0xbbbc=['lodash','name','Service','key','SERV','active','Smtp','exports'];(function(_0x2a9dba,_0x38493a){var _0x3a4c5a=function(_0x22c06e){while(--_0x22c06e){_0x2a9dba['push'](_0x2a9dba['shift']());}};_0x3a4c5a(++_0x38493a);}(_0xbbbc,0x128));var _0xcbbb=function(_0x418fa3,_0x464468){_0x418fa3=_0x418fa3-0x0;var _0x845083=_0xbbbc[_0x418fa3];return _0x845083;};'use strict';var _=require(_0xcbbb('0x0'));function MailAccount(_0x29e2e6){this['id']=_0x29e2e6['id']||0x0;this[_0xcbbb('0x1')]=_0x29e2e6[_0xcbbb('0x1')]||_0xcbbb('0x2');this[_0xcbbb('0x3')]=_0x29e2e6[_0xcbbb('0x3')]||_0xcbbb('0x4');this[_0xcbbb('0x5')]=_0x29e2e6[_0xcbbb('0x5')]||![];this['Imap']=_0x29e2e6['Imap']||[];this['Smtp']=_0x29e2e6[_0xcbbb('0x6')]||[];}module[_0xcbbb('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 b1b1ac1..1b0c59f 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 _0x6701=['lodash','../model/mailAccount','mapKeys','prototype','hasOwnProperty','mailAccounts','length','isUndefined','exports'];(function(_0x53b8e0,_0x55d46e){var _0x10630c=function(_0x3189aa){while(--_0x3189aa){_0x53b8e0['push'](_0x53b8e0['shift']());}};_0x10630c(++_0x55d46e);}(_0x6701,0x17a));var _0x1670=function(_0x420fdd,_0x127224){_0x420fdd=_0x420fdd-0x0;var _0x116df3=_0x6701[_0x420fdd];return _0x116df3;};'use strict';var _=require(_0x1670('0x0'));var MailAccount=require(_0x1670('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x814fa3,_0x1ae5cd,_0x4f52ac){var _0x2c2dc4=_[_0x1670('0x2')](_0x814fa3,function(_0x3f9751,_0x487cf0){return _0x3f9751[_0x4f52ac];});for(var _0x4577b5 in _0x1ae5cd){if(_0x1ae5cd['hasOwnProperty'](_0x4577b5)){if(!_0x2c2dc4[_0x4577b5]){delete _0x1ae5cd[_0x4577b5];}}}}Realtime[_0x1670('0x3')]['mergeFromDatabase']=function(_0x5d3fba,_0x3f2077){for(var _0x1f5c76 in _0x3f2077){if(_0x5d3fba[_0x1670('0x4')](_0x1f5c76)){_0x5d3fba[_0x1f5c76]=_0x3f2077[_0x1f5c76];}}};Realtime[_0x1670('0x3')]['initMailAccounts']=function(){var _0x47d433=this;return function(_0x5d52cf){if(_0x5d52cf){freeIsNotKey(_0x5d52cf,_0x47d433[_0x1670('0x5')],'id');for(var _0x5eb8e6=0x0,_0x455f2d={},_0x4725c3={};_0x5eb8e6<_0x5d52cf[_0x1670('0x6')];_0x5eb8e6+=0x1){_0x455f2d=_0x5d52cf[_0x5eb8e6];if(_[_0x1670('0x7')](_0x47d433['mailAccounts'][_0x455f2d['id']])){_0x47d433[_0x1670('0x5')][_0x455f2d['id']]=new MailAccount(_0x455f2d);}else{_['merge'](_0x47d433[_0x1670('0x5')][_0x455f2d['id']],_0x455f2d);}}}return _0x47d433[_0x1670('0x5')];};};module[_0x1670('0x8')]=Realtime; \ No newline at end of file +var _0x9f9d=['mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','merge','exports','lodash'];(function(_0x4c157b,_0x4e074c){var _0x4a8f27=function(_0x5a0f9d){while(--_0x5a0f9d){_0x4c157b['push'](_0x4c157b['shift']());}};_0x4a8f27(++_0x4e074c);}(_0x9f9d,0x1c2));var _0xd9f9=function(_0x3903f2,_0x59033d){_0x3903f2=_0x3903f2-0x0;var _0x7d0aa=_0x9f9d[_0x3903f2];return _0x7d0aa;};'use strict';var _=require(_0xd9f9('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0xd9f9('0x1')]={};};function freeIsNotKey(_0x5d509a,_0x304306,_0x4aa4ee){var _0x56b636=_[_0xd9f9('0x2')](_0x5d509a,function(_0x123d30,_0x10fb7e){return _0x123d30[_0x4aa4ee];});for(var _0x1f423e in _0x304306){if(_0x304306[_0xd9f9('0x3')](_0x1f423e)){if(!_0x56b636[_0x1f423e]){delete _0x304306[_0x1f423e];}}}}Realtime[_0xd9f9('0x4')][_0xd9f9('0x5')]=function(_0x107a9b,_0x2ef653){for(var _0x327a5b in _0x2ef653){if(_0x107a9b[_0xd9f9('0x3')](_0x327a5b)){_0x107a9b[_0x327a5b]=_0x2ef653[_0x327a5b];}}};Realtime['prototype'][_0xd9f9('0x6')]=function(){var _0x252c5e=this;return function(_0x4787c9){if(_0x4787c9){freeIsNotKey(_0x4787c9,_0x252c5e[_0xd9f9('0x1')],'id');for(var _0x4a591f=0x0,_0x4df6f0={},_0x43b37c={};_0x4a591f<_0x4787c9[_0xd9f9('0x7')];_0x4a591f+=0x1){_0x4df6f0=_0x4787c9[_0x4a591f];if(_[_0xd9f9('0x8')](_0x252c5e[_0xd9f9('0x1')][_0x4df6f0['id']])){_0x252c5e[_0xd9f9('0x1')][_0x4df6f0['id']]=new MailAccount(_0x4df6f0);}else{_[_0xd9f9('0x9')](_0x252c5e['mailAccounts'][_0x4df6f0['id']],_0x4df6f0);}}}return _0x252c5e[_0xd9f9('0x1')];};};module[_0xd9f9('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index e33ccd1..f76123d 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 _0xe740=['name','service','type','MailServerOut','Smtp','data5','notify','NotifyMailAccount','../client','Request','GetMailAccount','provider','email','key','ListId','MailServerIn','CloudProvider'];(function(_0x19a734,_0x213f46){var _0x2397f2=function(_0x858373){while(--_0x858373){_0x19a734['push'](_0x19a734['shift']());}};_0x2397f2(++_0x213f46);}(_0xe740,0x14b));var _0x0e74=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0xe740[_0x3fba9f];return _0x192cf1;};'use strict';var client=require(_0x0e74('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x0e74('0x1')](_0x0e74('0x2'),{'options':{'attributes':['id','name',_0x0e74('0x3'),'service',_0x0e74('0x4'),'active',_0x0e74('0x5'),_0x0e74('0x6'),'TemplateId'],'raw':![],'include':[{'model':_0x0e74('0x7'),'as':'Imap','include':[{'model':_0x0e74('0x8'),'attributes':['id',_0x0e74('0x9'),_0x0e74('0xa'),_0x0e74('0xb'),'data5'],'as':_0x0e74('0x8')}]},{'model':_0x0e74('0xc'),'as':_0x0e74('0xd'),'include':[{'model':_0x0e74('0x8'),'attributes':['id','name',_0x0e74('0xa'),'type',_0x0e74('0xe')],'as':'CloudProvider'}]}]},'log':'getMailAccount'});};};exports[_0x0e74('0xf')]=function(_0x41cdf6,_0x249331){return client[_0x0e74('0x1')]('NotifyMailAccount',{'account':{'id':_0x41cdf6},'body':_0x249331,'log':_0x0e74('0x10')});}; \ No newline at end of file +var _0xc812=['Request','name','provider','service','email','key','ListId','MailServerIn','Imap','CloudProvider','type','MailServerOut','Smtp','data5','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts'];(function(_0x478e87,_0x1e7a3d){var _0x107532=function(_0x59343e){while(--_0x59343e){_0x478e87['push'](_0x478e87['shift']());}};_0x107532(++_0x1e7a3d);}(_0xc812,0xbc));var _0x2c81=function(_0x273973,_0x7effd2){_0x273973=_0x273973-0x0;var _0x3a2fae=_0xc812[_0x273973];return _0x3a2fae;};'use strict';var client=require(_0x2c81('0x0'));exports[_0x2c81('0x1')]=function(){return function(){return client[_0x2c81('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0x2c81('0x3'),_0x2c81('0x4'),_0x2c81('0x5'),_0x2c81('0x6'),'active',_0x2c81('0x7'),_0x2c81('0x8'),'TemplateId'],'raw':![],'include':[{'model':_0x2c81('0x9'),'as':_0x2c81('0xa'),'include':[{'model':_0x2c81('0xb'),'attributes':['id',_0x2c81('0x3'),_0x2c81('0x5'),_0x2c81('0xc'),'data5'],'as':_0x2c81('0xb')}]},{'model':_0x2c81('0xd'),'as':_0x2c81('0xe'),'include':[{'model':_0x2c81('0xb'),'attributes':['id',_0x2c81('0x3'),'service',_0x2c81('0xc'),_0x2c81('0xf')],'as':_0x2c81('0xb')}]}]},'log':_0x2c81('0x10')});};};exports[_0x2c81('0x11')]=function(_0x2d199c,_0x26683c){return client['Request'](_0x2c81('0x12'),{'account':{'id':_0x2d199c},'body':_0x26683c,'log':_0x2c81('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 5bd308e..fc143a1 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 _0x529e=['loginMailFrequency','GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x529e,0xb6));var _0xe529=function(_0x5b4ebc,_0x521d33){_0x5b4ebc=_0x5b4ebc-0x0;var _0x1154ab=_0x529e[_0x5b4ebc];return _0x1154ab;};'use strict';var client=require(_0xe529('0x0'));exports[_0xe529('0x1')]=function(){return client[_0xe529('0x2')](_0xe529('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xe529('0x4')]},'log':_0xe529('0x5')});}; \ No newline at end of file +var _0xf3f6=['getSettings','Request','ShowSetting','loginMailFrequency','GetSettings','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf3f6,0x149));var _0x6f3f=function(_0x312da9,_0x4103b2){_0x312da9=_0x312da9-0x0;var _0x4b16a3=_0xf3f6[_0x312da9];return _0x4b16a3;};'use strict';var client=require(_0x6f3f('0x0'));exports[_0x6f3f('0x1')]=function(){return client[_0x6f3f('0x2')](_0x6f3f('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x6f3f('0x4')]},'log':_0x6f3f('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 4e448f9..15c3274 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 de48da7..fcd1a50 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 _0xe9a6=['../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','sticky-session','ioredis','../../config/environment','createServer','listen','port','socket.io','websocket','redis','defaults','localhost','adapter','../../config/triggers','default'];(function(_0x2b5c43,_0x5a150c){var _0xbd3c4a=function(_0x49ebb3){while(--_0x49ebb3){_0x2b5c43['push'](_0x2b5c43['shift']());}};_0xbd3c4a(++_0x5a150c);}(_0xe9a6,0xc8));var _0x6e9a=function(_0x585820,_0x191ba2){_0x585820=_0x585820-0x0;var _0x5319bd=_0xe9a6[_0x585820];return _0x5319bd;};'use strict';var _=require(_0x6e9a('0x0'));var http=require(_0x6e9a('0x1'));var express=require('express');var sticky=require(_0x6e9a('0x2'));var Redis=require(_0x6e9a('0x3'));var config=require(_0x6e9a('0x4'));var app=express();var server=http[_0x6e9a('0x5')](app);server['timeout']=0xdbba0;if(sticky[_0x6e9a('0x6')](server,config[_0x6e9a('0x7')])){var socketio=require(_0x6e9a('0x8'))(server,{'transports':[_0x6e9a('0x9'),'polling']});config[_0x6e9a('0xa')]=_[_0x6e9a('0xb')](config[_0x6e9a('0xa')],{'host':_0x6e9a('0xc'),'port':0x18eb});socketio[_0x6e9a('0xd')](require('socket.io-redis')({'pubClient':new Redis(config[_0x6e9a('0xa')]),'subClient':new Redis(config[_0x6e9a('0xa')])}));require(_0x6e9a('0xe'))[_0x6e9a('0xf')]();require(_0x6e9a('0x10'))['default'](socketio);require(_0x6e9a('0x11'))['default'](app);require(_0x6e9a('0x12'))[_0x6e9a('0xf')](app);}else{server[_0x6e9a('0x13')](_0x6e9a('0x14'),function(){console[_0x6e9a('0x15')](_0x6e9a('0x16'),config['port']);});}exports=module[_0x6e9a('0x17')]=app; \ No newline at end of file +var _0x969e=['default','../../config/socketio','../../config/express','../../routes','once','listening','log','port','exports','http','../../config/environment','timeout','listen','polling','defaults','redis','adapter','socket.io-redis'];(function(_0x422d23,_0x3a9056){var _0x465a26=function(_0x4d796e){while(--_0x4d796e){_0x422d23['push'](_0x422d23['shift']());}};_0x465a26(++_0x3a9056);}(_0x969e,0xf3));var _0xe969=function(_0x4426cb,_0x589c33){_0x4426cb=_0x4426cb-0x0;var _0x323e1e=_0x969e[_0x4426cb];return _0x323e1e;};'use strict';var _=require('lodash');var http=require(_0xe969('0x0'));var express=require('express');var sticky=require('sticky-session');var Redis=require('ioredis');var config=require(_0xe969('0x1'));var app=express();var server=http['createServer'](app);server[_0xe969('0x2')]=0xdbba0;if(sticky[_0xe969('0x3')](server,config['port'])){var socketio=require('socket.io')(server,{'transports':['websocket',_0xe969('0x4')]});config['redis']=_[_0xe969('0x5')](config[_0xe969('0x6')],{'host':'localhost','port':0x18eb});socketio[_0xe969('0x7')](require(_0xe969('0x8'))({'pubClient':new Redis(config[_0xe969('0x6')]),'subClient':new Redis(config[_0xe969('0x6')])}));require('../../config/triggers')[_0xe969('0x9')]();require(_0xe969('0xa'))['default'](socketio);require(_0xe969('0xb'))['default'](app);require(_0xe969('0xc'))[_0xe969('0x9')](app);}else{server[_0xe969('0xd')](_0xe969('0xe'),function(){console[_0xe969('0xf')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0xe969('0x10')]);});}exports=module[_0xe969('0x11')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 2d97552..c753ca1 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 _0x3e1a=['catch','exports','jayson/promise','../../config/logger','routing','client','http','Request','request','then','debug','rpc','error','message','result'];(function(_0x10e5bf,_0xffa569){var _0x675420=function(_0x4d58ef){while(--_0x4d58ef){_0x10e5bf['push'](_0x10e5bf['shift']());}};_0x675420(++_0xffa569);}(_0x3e1a,0x6b));var _0xa3e1=function(_0x30d1c0,_0x3941a1){_0x30d1c0=_0x30d1c0-0x0;var _0x5268af=_0x3e1a[_0x30d1c0];return _0x5268af;};'use strict';var jayson=require(_0xa3e1('0x0'));var BPromise=require('bluebird');var logger=require(_0xa3e1('0x1'))(_0xa3e1('0x2'));var client=jayson[_0xa3e1('0x3')][_0xa3e1('0x4')]({'port':0x2329});client[_0xa3e1('0x5')]=function(_0x190ef1,_0x4f7dc1){return new BPromise(function(_0x2c09ea,_0x342580){return client[_0xa3e1('0x6')](_0x190ef1,_0x4f7dc1)[_0xa3e1('0x7')](function(_0x2449de){logger[_0xa3e1('0x8')](_0xa3e1('0x9'),_0xa3e1('0x2'),_0x190ef1,_0x4f7dc1,_0x2449de);if(_0x2449de[_0xa3e1('0xa')]){logger[_0xa3e1('0xa')](_0xa3e1('0x9'),_0xa3e1('0x2'),_0x190ef1,_0x2449de[_0xa3e1('0xa')][_0xa3e1('0xb')],_0x4f7dc1);return _0x342580(_0x2449de[_0xa3e1('0xa')]['message']);}else{return _0x2c09ea(_0x2449de[_0xa3e1('0xc')]);}})[_0xa3e1('0xd')](function(_0x389403){logger[_0xa3e1('0xa')](_0xa3e1('0x9'),_0xa3e1('0x2'),_0x190ef1,_0x389403,_0x4f7dc1);return _0x342580(_0x389403);});});};module[_0xa3e1('0xe')]=client; \ No newline at end of file +var _0x35e0=['client','http','Request','request','error','rpc','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x531629,_0x324e7a){var _0x29d370=function(_0x3a5fdd){while(--_0x3a5fdd){_0x531629['push'](_0x531629['shift']());}};_0x29d370(++_0x324e7a);}(_0x35e0,0x1d8));var _0x035e=function(_0x17c53,_0x109296){_0x17c53=_0x17c53-0x0;var _0x54d0d5=_0x35e0[_0x17c53];return _0x54d0d5;};'use strict';var jayson=require(_0x035e('0x0'));var BPromise=require(_0x035e('0x1'));var logger=require(_0x035e('0x2'))(_0x035e('0x3'));var client=jayson[_0x035e('0x4')][_0x035e('0x5')]({'port':0x2329});client[_0x035e('0x6')]=function(_0x5c80b1,_0x31bc6e){return new BPromise(function(_0x41542e,_0x269ac8){return client[_0x035e('0x7')](_0x5c80b1,_0x31bc6e)['then'](function(_0x5c719b){logger['debug']('rpc',_0x035e('0x3'),_0x5c80b1,_0x31bc6e,_0x5c719b);if(_0x5c719b['error']){logger[_0x035e('0x8')](_0x035e('0x9'),_0x035e('0x3'),_0x5c80b1,_0x5c719b[_0x035e('0x8')][_0x035e('0xa')],_0x31bc6e);return _0x269ac8(_0x5c719b['error']['message']);}else{return _0x41542e(_0x5c719b[_0x035e('0xb')]);}})[_0x035e('0xc')](function(_0x3f7608){logger[_0x035e('0x8')]('rpc',_0x035e('0x3'),_0x5c80b1,_0x3f7608,_0x31bc6e);return _0x269ac8(_0x3f7608);});});};module[_0x035e('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 04854d8..ffb3874 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 _0xea32=['initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','getAgents','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','getMailQueues'];(function(_0x55decc,_0x112aa4){var _0x10ec8a=function(_0x4b50c2){while(--_0x4b50c2){_0x55decc['push'](_0x55decc['shift']());}};_0x10ec8a(++_0x112aa4);}(_0xea32,0x19c));var _0x2ea3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xea32[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x2ea3('0x0'));var server=require(_0x2ea3('0x1'));var Realtime=require(_0x2ea3('0x2'));var user=require(_0x2ea3('0x3'));var interval=require(_0x2ea3('0x4'));var openchannelQueue=require(_0x2ea3('0x5'));var chatQueue=require(_0x2ea3('0x6'));var smsQueue=require(_0x2ea3('0x7'));var mailQueue=require(_0x2ea3('0x8'));var faxQueue=require(_0x2ea3('0x9'));var whatsappQueue=require(_0x2ea3('0xa'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x2ea3('0xb')]()['then'](user[_0x2ea3('0xc')]())[_0x2ea3('0xd')](realtime[_0x2ea3('0xe')]())['then'](interval[_0x2ea3('0xf')]())[_0x2ea3('0xd')](realtime[_0x2ea3('0x10')]())[_0x2ea3('0xd')](openchannelQueue[_0x2ea3('0x11')]())[_0x2ea3('0xd')](realtime[_0x2ea3('0x12')]())[_0x2ea3('0xd')](chatQueue[_0x2ea3('0x13')]())[_0x2ea3('0xd')](realtime[_0x2ea3('0x14')]())['then'](smsQueue[_0x2ea3('0x15')]())[_0x2ea3('0xd')](realtime['initSmsQueues']())[_0x2ea3('0xd')](mailQueue[_0x2ea3('0x16')]())[_0x2ea3('0xd')](realtime[_0x2ea3('0x17')]())[_0x2ea3('0xd')](faxQueue[_0x2ea3('0x18')]())[_0x2ea3('0xd')](realtime[_0x2ea3('0x19')]())[_0x2ea3('0xd')](whatsappQueue['getWhatsappQueues']())[_0x2ea3('0xd')](realtime[_0x2ea3('0x1a')]())[_0x2ea3('0xd')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x2ea3('0xd')](function(_0x590950){return initRealtime();})['then'](function(_0x2b93da){return setInterval(initRealtime,0x1388);})[_0x2ea3('0x1b')](function(_0x81d63a){console[_0x2ea3('0x1c')](_0x81d63a);});}main(); \ No newline at end of file +var _0x2ecc=['initChatQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','getAgents','then','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues'];(function(_0x1534e9,_0xfaa30c){var _0x306449=function(_0x33fca7){while(--_0x33fca7){_0x1534e9['push'](_0x1534e9['shift']());}};_0x306449(++_0xfaa30c);}(_0x2ecc,0x1b8));var _0xc2ec=function(_0x1443c3,_0x4d9452){_0x1443c3=_0x1443c3-0x0;var _0x4c48d3=_0x2ecc[_0x1443c3];return _0x4c48d3;};'use strict';var BPromise=require('bluebird');var server=require(_0xc2ec('0x0'));var Realtime=require(_0xc2ec('0x1'));var user=require(_0xc2ec('0x2'));var interval=require(_0xc2ec('0x3'));var openchannelQueue=require(_0xc2ec('0x4'));var chatQueue=require(_0xc2ec('0x5'));var smsQueue=require(_0xc2ec('0x6'));var mailQueue=require(_0xc2ec('0x7'));var faxQueue=require(_0xc2ec('0x8'));var whatsappQueue=require(_0xc2ec('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()['then'](user[_0xc2ec('0xa')]())['then'](realtime['initAgents']())[_0xc2ec('0xb')](interval['getIntervals']())[_0xc2ec('0xb')](realtime[_0xc2ec('0xc')]())[_0xc2ec('0xb')](openchannelQueue[_0xc2ec('0xd')]())[_0xc2ec('0xb')](realtime[_0xc2ec('0xe')]())[_0xc2ec('0xb')](chatQueue[_0xc2ec('0xf')]())[_0xc2ec('0xb')](realtime[_0xc2ec('0x10')]())[_0xc2ec('0xb')](smsQueue['getSmsQueues']())[_0xc2ec('0xb')](realtime['initSmsQueues']())[_0xc2ec('0xb')](mailQueue['getMailQueues']())[_0xc2ec('0xb')](realtime[_0xc2ec('0x11')]())[_0xc2ec('0xb')](faxQueue[_0xc2ec('0x12')]())[_0xc2ec('0xb')](realtime[_0xc2ec('0x13')]())[_0xc2ec('0xb')](whatsappQueue[_0xc2ec('0x14')]())[_0xc2ec('0xb')](realtime[_0xc2ec('0x15')]())['then'](function(){return realtime;});}function main(){return server[_0xc2ec('0x16')](realtime)[_0xc2ec('0xb')](function(_0x5a78b2){return initRealtime();})[_0xc2ec('0xb')](function(_0x1b872e){return setInterval(initRealtime,0x1388);})[_0xc2ec('0x17')](function(_0x110302){console['log'](_0x110302);});}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 770da70..8e7d59f 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(_0x2ef60e,_0x35c32c){var _0x3be207=function(_0x25377d){while(--_0x25377d){_0x2ef60e['push'](_0x2ef60e['shift']());}};_0x3be207(++_0x35c32c);}(_0x814b,0x1a2));var _0xb814=function(_0x15fc3c,_0x35665b){_0x15fc3c=_0x15fc3c-0x0;var _0x94c5c8=_0x814b[_0x15fc3c];return _0x94c5c8;};'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 _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x11f54d,_0x21d717){var _0x22d270=function(_0x277445){while(--_0x277445){_0x11f54d['push'](_0x11f54d['shift']());}};_0x22d270(++_0x21d717);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xc4aa[_0x3511d3];return _0x5d6321;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 77ffcdb..d158656 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 _0xea4c=['sendMailMessage','SendMail','client','request','then','result','catch'];(function(_0x57e278,_0xc85ade){var _0x5598e4=function(_0x3665a0){while(--_0x3665a0){_0x57e278['push'](_0x57e278['shift']());}};_0x5598e4(++_0xc85ade);}(_0xea4c,0x80));var _0xcea4=function(_0x40fbd7,_0x2035c0){_0x40fbd7=_0x40fbd7-0x0;var _0x112085=_0xea4c[_0x40fbd7];return _0x112085;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0xcea4('0x0')]['http']({'port':0x232b});function request(_0x6ca763,_0x194fc8){return new BPromise(function(_0x179b22,_0x26771b){return client[_0xcea4('0x1')](_0x6ca763,_0x194fc8)[_0xcea4('0x2')](function(_0x1ab82d){if(_0x1ab82d['error']){return _0x26771b(_0x1ab82d['error']['message']);}else{return _0x179b22(_0x1ab82d[_0xcea4('0x3')]);}})[_0xcea4('0x4')](function(_0x39ee40){return _0x26771b(_0x39ee40);});});}exports[_0xcea4('0x5')]=function(_0x12e305,_0x36ef35){return request(_0xcea4('0x6'),{'account':_0x12e305,'message':_0x36ef35});}; \ No newline at end of file +var _0xb94b=['result','sendMailMessage','SendMail','client','request','then','error'];(function(_0x3cf968,_0x1b5822){var _0x1f055d=function(_0x5bbee4){while(--_0x5bbee4){_0x3cf968['push'](_0x3cf968['shift']());}};_0x1f055d(++_0x1b5822);}(_0xb94b,0xc0));var _0xbb94=function(_0x1c04a0,_0x470f56){_0x1c04a0=_0x1c04a0-0x0;var _0x14f909=_0xb94b[_0x1c04a0];return _0x14f909;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0xbb94('0x0')]['http']({'port':0x232b});function request(_0x4f55d3,_0x2d9a8f){return new BPromise(function(_0x2f8bf4,_0x2dcf19){return client[_0xbb94('0x1')](_0x4f55d3,_0x2d9a8f)[_0xbb94('0x2')](function(_0x1b3b1d){if(_0x1b3b1d[_0xbb94('0x3')]){return _0x2dcf19(_0x1b3b1d[_0xbb94('0x3')]['message']);}else{return _0x2f8bf4(_0x1b3b1d[_0xbb94('0x4')]);}})['catch'](function(_0x2bb067){return _0x2dcf19(_0x2bb067);});});}exports[_0xbb94('0x5')]=function(_0x3e3adb,_0xe9da74){return request(_0xbb94('0x6'),{'account':_0x3e3adb,'message':_0xe9da74});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 271706e..6f21bb2 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 _0xc2c7=['chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','Capacity','maxcapacity','working','mail','chat','openchannel','fax','sms','length','getChannelStatus','Status','StatusTime','toNumber','format','online','mailCurrentCapacity','faxStatus','smsCurrentCapacity','busy','chatWaitingInteractions','exports','md5','moment','ioredis','../../../config/environment','redis','defaults','localhost','name','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime'];(function(_0x4ebbf4,_0x549430){var _0x290bbe=function(_0x240cac){while(--_0x240cac){_0x4ebbf4['push'](_0x4ebbf4['shift']());}};_0x290bbe(++_0x549430);}(_0xc2c7,0x134));var _0x7c2c=function(_0x442a55,_0x4a7286){_0x442a55=_0x442a55-0x0;var _0x1fe3d5=_0xc2c7[_0x442a55];return _0x1fe3d5;};'use strict';var _=require('lodash');var md5=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var Redis=require(_0x7c2c('0x2'));var config=require(_0x7c2c('0x3'));config[_0x7c2c('0x4')]=_[_0x7c2c('0x5')](config[_0x7c2c('0x4')],{'host':_0x7c2c('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x31dc4e){this['id']=_0x31dc4e['id']||0x0;this[_0x7c2c('0x7')]=_0x31dc4e[_0x7c2c('0x7')]||'';this['online']=_0x31dc4e['online']||!![];this['voicePause']=_0x31dc4e[_0x7c2c('0x8')]||![];this[_0x7c2c('0x9')]=_0x31dc4e[_0x7c2c('0x9')]||![];this[_0x7c2c('0xa')]=_0x31dc4e[_0x7c2c('0xa')]||![];this['faxPause']=_0x31dc4e[_0x7c2c('0xb')]||![];this[_0x7c2c('0xc')]=_0x31dc4e[_0x7c2c('0xc')]||![];this[_0x7c2c('0xd')]=_0x31dc4e[_0x7c2c('0xd')]||![];this[_0x7c2c('0xe')]=_0x7c2c('0xf');this[_0x7c2c('0x10')]=0x0;this[_0x7c2c('0x11')]=_0x31dc4e[_0x7c2c('0x11')]||0x0;this[_0x7c2c('0x12')]=0x0;this[_0x7c2c('0x13')]=_0x7c2c('0xf');this[_0x7c2c('0x14')]=0x0;this[_0x7c2c('0x15')]=_0x31dc4e[_0x7c2c('0x15')]||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']=_0x7c2c('0xf');this[_0x7c2c('0x16')]=0x0;this[_0x7c2c('0x17')]=_0x31dc4e['faxCapacity']||0x0;this[_0x7c2c('0x18')]=0x0;this[_0x7c2c('0x19')]='unknown';this[_0x7c2c('0x1a')]=0x0;this['smsCapacity']=_0x31dc4e[_0x7c2c('0x1b')]||0x0;this['smsCurrentCapacity']=0x0;this[_0x7c2c('0x1c')]=_0x7c2c('0xf');this[_0x7c2c('0x1d')]=0x0;this[_0x7c2c('0x1e')]=_0x31dc4e[_0x7c2c('0x1e')]||0x0;this[_0x7c2c('0x1f')]=0x0;this[_0x7c2c('0x20')]=_0x7c2c('0xf');this[_0x7c2c('0x21')]=0x0;this[_0x7c2c('0x22')]=_0x31dc4e[_0x7c2c('0x22')]||0x0;this[_0x7c2c('0x23')]=0x0;this['busy']=![];this[_0x7c2c('0x24')]=undefined;this['md5']='';this['chatWaitingInteractions']={};this[_0x7c2c('0x25')]={};this[_0x7c2c('0x26')]={};this[_0x7c2c('0x27')]={};this[_0x7c2c('0x28')]={};this[_0x7c2c('0x29')]={};this[_0x7c2c('0x2a')]();}Agent[_0x7c2c('0x2b')]['getChannelStatus']=function(_0x10c356){if(this[_0x10c356+'CurrentCapacity']>0x0){if(this[_0x10c356+_0x7c2c('0x2c')]>0x0&&this[_0x10c356+'CurrentCapacity']>=this[_0x10c356+_0x7c2c('0x2c')]){return _0x7c2c('0x2d');}else{return _0x7c2c('0x2e');}}else{return'idle';}};Agent['prototype'][_0x7c2c('0x2a')]=function(){var _0x30c53e=[_0x7c2c('0x2f'),_0x7c2c('0x30'),_0x7c2c('0x31'),_0x7c2c('0x32'),_0x7c2c('0x33'),'whatsapp'];for(var _0x358c67=0x0;_0x358c67<_0x30c53e[_0x7c2c('0x34')];_0x358c67+=0x1){var _0x3b2652=this[_0x7c2c('0x35')](_0x30c53e[_0x358c67]);if(this[_0x30c53e[_0x358c67]+_0x7c2c('0x36')]!==_0x3b2652){this[_0x30c53e[_0x358c67]+_0x7c2c('0x37')]=_[_0x7c2c('0x38')](moment()[_0x7c2c('0x39')]('x'));}this[_0x30c53e[_0x358c67]+_0x7c2c('0x36')]=_0x3b2652;}var _0x5769ec={'id':this['id'],'name':this[_0x7c2c('0x7')],'online':this[_0x7c2c('0x3a')],'voicePause':this[_0x7c2c('0x8')],'chatPause':this[_0x7c2c('0x9')],'mailPause':this['mailPause'],'smsPause':this[_0x7c2c('0xc')],'faxPause':this[_0x7c2c('0xb')],'openchannelPause':this[_0x7c2c('0xd')],'chatStatus':this[_0x7c2c('0xe')],'chatStatusTime':this[_0x7c2c('0x10')],'chatCapacity':this[_0x7c2c('0x11')],'chatCurrentCapacity':this[_0x7c2c('0x12')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x7c2c('0x14')],'mailCapacity':this[_0x7c2c('0x15')],'mailCurrentCapacity':this[_0x7c2c('0x3b')],'faxStatus':this[_0x7c2c('0x3c')],'faxStatusTime':this[_0x7c2c('0x16')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x7c2c('0x19')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x7c2c('0x3d')],'whatsappStatus':this[_0x7c2c('0x1c')],'whatsappStatusTime':this[_0x7c2c('0x1d')],'whatsappCapacity':this[_0x7c2c('0x1e')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x7c2c('0x20')],'openchannelStatusTime':this[_0x7c2c('0x21')],'openchannelCapacity':this[_0x7c2c('0x22')],'openchannelCurrentCapacity':this[_0x7c2c('0x23')],'busy':this[_0x7c2c('0x3e')],'busyQueue':this[_0x7c2c('0x24')],'chatWaitingInteractions':this[_0x7c2c('0x3f')],'faxWaitingInteractions':this[_0x7c2c('0x25')],'mailWaitingInteractions':this[_0x7c2c('0x26')],'openchannelWaitingInteractions':this[_0x7c2c('0x27')],'smsWaitingInteractions':this[_0x7c2c('0x28')],'whatsappWaitingInteractions':this[_0x7c2c('0x29')]};var _0x2b6a7d=md5(JSON['stringify'](_0x5769ec));if(this['md5']!==_0x2b6a7d){this[_0x7c2c('0x0')]=_0x2b6a7d;io['emit']('user:routing:update',_['omit'](_0x5769ec,[_0x7c2c('0x3a')]));}};module[_0x7c2c('0x40')]=Agent; \ No newline at end of file +var _0x6d11=['md5','moment','../../../config/environment','defaults','redis','name','online','voicePause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','busy','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','prototype','mail','chat','openchannel','fax','whatsapp','length','Status','StatusTime','toNumber','format','chatPause','chatCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','openchannelStatusTime','busyQueue','emit','user:routing:update','exports','lodash'];(function(_0x35457c,_0x37036e){var _0x14ce1a=function(_0x406e40){while(--_0x406e40){_0x35457c['push'](_0x35457c['shift']());}};_0x14ce1a(++_0x37036e);}(_0x6d11,0xbf));var _0x16d1=function(_0x26deca,_0x4a3b0f){_0x26deca=_0x26deca-0x0;var _0x27cf6e=_0x6d11[_0x26deca];return _0x27cf6e;};'use strict';var _=require(_0x16d1('0x0'));var md5=require(_0x16d1('0x1'));var moment=require(_0x16d1('0x2'));var Redis=require('ioredis');var config=require(_0x16d1('0x3'));config['redis']=_[_0x16d1('0x4')](config[_0x16d1('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x16d1('0x5')]));function Agent(_0x46f7d7){this['id']=_0x46f7d7['id']||0x0;this[_0x16d1('0x6')]=_0x46f7d7[_0x16d1('0x6')]||'';this[_0x16d1('0x7')]=_0x46f7d7[_0x16d1('0x7')]||!![];this[_0x16d1('0x8')]=_0x46f7d7['voicePause']||![];this['chatPause']=_0x46f7d7['chatPause']||![];this[_0x16d1('0x9')]=_0x46f7d7[_0x16d1('0x9')]||![];this[_0x16d1('0xa')]=_0x46f7d7[_0x16d1('0xa')]||![];this['smsPause']=_0x46f7d7[_0x16d1('0xb')]||![];this[_0x16d1('0xc')]=_0x46f7d7[_0x16d1('0xc')]||![];this[_0x16d1('0xd')]=_0x16d1('0xe');this[_0x16d1('0xf')]=0x0;this[_0x16d1('0x10')]=_0x46f7d7[_0x16d1('0x10')]||0x0;this['chatCurrentCapacity']=0x0;this[_0x16d1('0x11')]=_0x16d1('0xe');this[_0x16d1('0x12')]=0x0;this[_0x16d1('0x13')]=_0x46f7d7[_0x16d1('0x13')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x16d1('0x14')]=_0x16d1('0xe');this[_0x16d1('0x15')]=0x0;this[_0x16d1('0x16')]=_0x46f7d7[_0x16d1('0x16')]||0x0;this[_0x16d1('0x17')]=0x0;this[_0x16d1('0x18')]='unknown';this[_0x16d1('0x19')]=0x0;this[_0x16d1('0x1a')]=_0x46f7d7['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this[_0x16d1('0x1b')]='unknown';this[_0x16d1('0x1c')]=0x0;this['whatsappCapacity']=_0x46f7d7[_0x16d1('0x1d')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x16d1('0x1e')]=_0x16d1('0xe');this['openchannelStatusTime']=0x0;this['openchannelCapacity']=_0x46f7d7['openchannelCapacity']||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x16d1('0x1f')]=![];this['busyQueue']=undefined;this[_0x16d1('0x1')]='';this[_0x16d1('0x20')]={};this[_0x16d1('0x21')]={};this[_0x16d1('0x22')]={};this['openchannelWaitingInteractions']={};this[_0x16d1('0x23')]={};this[_0x16d1('0x24')]={};this[_0x16d1('0x25')]();}Agent['prototype'][_0x16d1('0x26')]=function(_0x8c7266){if(this[_0x8c7266+_0x16d1('0x27')]>0x0){if(this[_0x8c7266+_0x16d1('0x28')]>0x0&&this[_0x8c7266+_0x16d1('0x27')]>=this[_0x8c7266+_0x16d1('0x28')]){return _0x16d1('0x29');}else{return _0x16d1('0x2a');}}else{return _0x16d1('0x2b');}};Agent[_0x16d1('0x2c')][_0x16d1('0x25')]=function(){var _0x15203b=[_0x16d1('0x2d'),_0x16d1('0x2e'),_0x16d1('0x2f'),_0x16d1('0x30'),'sms',_0x16d1('0x31')];for(var _0x440a47=0x0;_0x440a47<_0x15203b[_0x16d1('0x32')];_0x440a47+=0x1){var _0x49fc1b=this[_0x16d1('0x26')](_0x15203b[_0x440a47]);if(this[_0x15203b[_0x440a47]+_0x16d1('0x33')]!==_0x49fc1b){this[_0x15203b[_0x440a47]+_0x16d1('0x34')]=_[_0x16d1('0x35')](moment()[_0x16d1('0x36')]('x'));}this[_0x15203b[_0x440a47]+_0x16d1('0x33')]=_0x49fc1b;}var _0x1dd574={'id':this['id'],'name':this['name'],'online':this[_0x16d1('0x7')],'voicePause':this[_0x16d1('0x8')],'chatPause':this[_0x16d1('0x37')],'mailPause':this[_0x16d1('0x9')],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this[_0x16d1('0xc')],'chatStatus':this[_0x16d1('0xd')],'chatStatusTime':this[_0x16d1('0xf')],'chatCapacity':this[_0x16d1('0x10')],'chatCurrentCapacity':this[_0x16d1('0x38')],'mailStatus':this[_0x16d1('0x11')],'mailStatusTime':this[_0x16d1('0x12')],'mailCapacity':this[_0x16d1('0x13')],'mailCurrentCapacity':this[_0x16d1('0x39')],'faxStatus':this[_0x16d1('0x14')],'faxStatusTime':this[_0x16d1('0x15')],'faxCapacity':this[_0x16d1('0x16')],'faxCurrentCapacity':this[_0x16d1('0x17')],'smsStatus':this[_0x16d1('0x18')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x16d1('0x1a')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x16d1('0x1b')],'whatsappStatusTime':this[_0x16d1('0x1c')],'whatsappCapacity':this[_0x16d1('0x1d')],'whatsappCurrentCapacity':this[_0x16d1('0x3a')],'openchannelStatus':this[_0x16d1('0x1e')],'openchannelStatusTime':this[_0x16d1('0x3b')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x16d1('0x3c')],'chatWaitingInteractions':this[_0x16d1('0x20')],'faxWaitingInteractions':this[_0x16d1('0x21')],'mailWaitingInteractions':this[_0x16d1('0x22')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x16d1('0x23')],'whatsappWaitingInteractions':this[_0x16d1('0x24')]};var _0x4cbac1=md5(JSON['stringify'](_0x1dd574));if(this['md5']!==_0x4cbac1){this[_0x16d1('0x1')]=_0x4cbac1;io[_0x16d1('0x3d')](_0x16d1('0x3e'),_['omit'](_0x1dd574,[_0x16d1('0x7')]));}};module[_0x16d1('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 52fb634..13eb090 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 _0x666a=['format','chat:queue:%s','emit','chat_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','available','stringify'];(function(_0x1939bf,_0x3ebd03){var _0x4f1ec7=function(_0x15bd6c){while(--_0x15bd6c){_0x1939bf['push'](_0x1939bf['shift']());}};_0x4f1ec7(++_0x3ebd03);}(_0x666a,0x100));var _0xa666=function(_0x5ebdce,_0x5e102e){_0x5ebdce=_0x5ebdce-0x0;var _0x1264b1=_0x666a[_0x5ebdce];return _0x1264b1;};'use strict';var _=require(_0xa666('0x0'));var md5=require(_0xa666('0x1'));var util=require(_0xa666('0x2'));var Redis=require(_0xa666('0x3'));var config=require(_0xa666('0x4'));config[_0xa666('0x5')]=_['defaults'](config[_0xa666('0x5')],{'host':_0xa666('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x2ac23b){this['id']=_0x2ac23b['id']||0x0;this[_0xa666('0x7')]=_0x2ac23b[_0xa666('0x7')]||'';this[_0xa666('0x8')]=_0x2ac23b[_0xa666('0x8')]||0xa;this[_0xa666('0x9')]=_0x2ac23b['strategy']||_0xa666('0xa');this[_0xa666('0xb')]=_0x2ac23b[_0xa666('0xb')];this[_0xa666('0xc')]={};this[_0xa666('0xd')]=0x0;this[_0xa666('0x1')]='';this[_0xa666('0xe')]();this[_0xa666('0xf')]();}ChatQueue[_0xa666('0x10')]['updateRouting']=function(){var _0x24aa95=this[_0xa666('0xc')][_0xa666('0x11')];this[_0xa666('0xc')]=_['map'](this[_0xa666('0xb')],'id');this[_0xa666('0xc')][_0xa666('0x11')]=_0x24aa95;};ChatQueue[_0xa666('0x10')]['updateRealtime']=function(){this[_0xa666('0x12')]=0x0;this[_0xa666('0x13')]=0x0;for(var _0x51ef05=0x0;_0x51ef05=0x0?this['available']:0x0;var _0x5b18f4={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xa666('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x5b1402=md5(JSON[_0xa666('0x17')](_0x5b18f4));if(this['md5']!==_0x5b1402){this[_0xa666('0x1')]=_0x5b1402;io['to'](util[_0xa666('0x18')](_0xa666('0x19'),_0x5b18f4[_0xa666('0x7')]))[_0xa666('0x1a')](_0xa666('0x1b'),_0x5b18f4);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x6013=['name','timeout','strategy','beepall','Agents','waiting','updateRealtime','mapAgentsId','_rr','map','loggedIn','paused','online','stringify','md5','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','util','../../../config/environment','redis','socket.io-emitter'];(function(_0x581c4b,_0x3fcc7e){var _0x279120=function(_0x4e5213){while(--_0x4e5213){_0x581c4b['push'](_0x581c4b['shift']());}};_0x279120(++_0x3fcc7e);}(_0x6013,0x1a4));var _0x3601=function(_0x4d21ff,_0x19d202){_0x4d21ff=_0x4d21ff-0x0;var _0x22b554=_0x6013[_0x4d21ff];return _0x22b554;};'use strict';var _=require(_0x3601('0x0'));var md5=require('md5');var util=require(_0x3601('0x1'));var Redis=require('ioredis');var config=require(_0x3601('0x2'));config[_0x3601('0x3')]=_['defaults'](config[_0x3601('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x3601('0x4'))(new Redis(config['redis']));function ChatQueue(_0x4facb8){this['id']=_0x4facb8['id']||0x0;this[_0x3601('0x5')]=_0x4facb8[_0x3601('0x5')]||'';this[_0x3601('0x6')]=_0x4facb8[_0x3601('0x6')]||0xa;this['strategy']=_0x4facb8[_0x3601('0x7')]||_0x3601('0x8');this[_0x3601('0x9')]=_0x4facb8[_0x3601('0x9')];this['mapAgentsId']={};this[_0x3601('0xa')]=0x0;this['md5']='';this['updateRouting']();this[_0x3601('0xb')]();}ChatQueue['prototype']['updateRouting']=function(){var _0x29f64b=this[_0x3601('0xc')][_0x3601('0xd')];this[_0x3601('0xc')]=_[_0x3601('0xe')](this['Agents'],'id');this[_0x3601('0xc')][_0x3601('0xd')]=_0x29f64b;};ChatQueue['prototype'][_0x3601('0xb')]=function(){this[_0x3601('0xf')]=0x0;this[_0x3601('0x10')]=0x0;for(var _0x2901af=0x0;_0x2901af=0x0?this['available']:0x0;var _0x6e12b1={'id':this['id'],'available':this['available'],'loggedIn':this[_0x3601('0xf')],'name':this[_0x3601('0x5')],'paused':this[_0x3601('0x10')],'waiting':this[_0x3601('0xa')]};var _0x1259c9=md5(JSON[_0x3601('0x12')](_0x6e12b1));if(this[_0x3601('0x13')]!==_0x1259c9){this[_0x3601('0x13')]=_0x1259c9;io['to'](util[_0x3601('0x14')](_0x3601('0x15'),_0x6e12b1['name']))[_0x3601('0x16')](_0x3601('0x17'),_0x6e12b1);}};module[_0x3601('0x18')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 5fda3f2..0932ca8 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 _0xff2d=['Agents','waiting','md5','updateRouting','mapAgentsId','_rr','map','prototype','updateRealtime','loggedIn','paused','online','available','stringify','fax:queue:%s','emit','fax_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xff2d,0xa3));var _0xdff2=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xff2d[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0xdff2('0x0'));var md5=require('md5');var util=require(_0xdff2('0x1'));var Redis=require(_0xdff2('0x2'));var config=require(_0xdff2('0x3'));config[_0xdff2('0x4')]=_[_0xdff2('0x5')](config[_0xdff2('0x4')],{'host':_0xdff2('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdff2('0x4')]));function FaxQueue(_0x4cd7d9){this['id']=_0x4cd7d9['id']||0x0;this[_0xdff2('0x7')]=_0x4cd7d9[_0xdff2('0x7')]||'';this[_0xdff2('0x8')]=_0x4cd7d9['timeout']||0xa;this[_0xdff2('0x9')]=_0x4cd7d9[_0xdff2('0x9')]||_0xdff2('0xa');this[_0xdff2('0xb')]=_0x4cd7d9[_0xdff2('0xb')];this['mapAgentsId']={};this[_0xdff2('0xc')]=0x0;this[_0xdff2('0xd')]='';this[_0xdff2('0xe')]();this['updateRealtime']();}FaxQueue['prototype'][_0xdff2('0xe')]=function(){var _0x528717=this[_0xdff2('0xf')][_0xdff2('0x10')];this['mapAgentsId']=_[_0xdff2('0x11')](this[_0xdff2('0xb')],'id');this[_0xdff2('0xf')][_0xdff2('0x10')]=_0x528717;};FaxQueue[_0xdff2('0x12')][_0xdff2('0x13')]=function(){this[_0xdff2('0x14')]=0x0;this[_0xdff2('0x15')]=0x0;for(var _0x28dcc6=0x0;_0x28dcc6=0x0?this[_0xdff2('0x17')]:0x0;var _0x243a45={'id':this['id'],'available':this[_0xdff2('0x17')],'loggedIn':this[_0xdff2('0x14')],'name':this[_0xdff2('0x7')],'paused':this[_0xdff2('0x15')],'waiting':this[_0xdff2('0xc')]};var _0x1fb513=md5(JSON[_0xdff2('0x18')](_0x243a45));if(this[_0xdff2('0xd')]!==_0x1fb513){this[_0xdff2('0xd')]=_0x1fb513;io['to'](util['format'](_0xdff2('0x19'),_0x243a45[_0xdff2('0x7')]))[_0xdff2('0x1a')](_0xdff2('0x1b'),_0x243a45);}};module[_0xdff2('0x1c')]=FaxQueue; \ No newline at end of file +var _0xfba4=['loggedIn','paused','length','online','faxPause','available','name','md5','format','fax_queue:save','lodash','util','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xfba4,0x1a0));var _0x4fba=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0xfba4[_0x469a3c];return _0x968f4;};'use strict';var _=require(_0x4fba('0x0'));var md5=require('md5');var util=require(_0x4fba('0x1'));var Redis=require(_0x4fba('0x2'));var config=require(_0x4fba('0x3'));config['redis']=_[_0x4fba('0x4')](config['redis'],{'host':_0x4fba('0x5'),'port':0x18eb});var io=require(_0x4fba('0x6'))(new Redis(config[_0x4fba('0x7')]));function FaxQueue(_0x41bb2a){this['id']=_0x41bb2a['id']||0x0;this['name']=_0x41bb2a['name']||'';this[_0x4fba('0x8')]=_0x41bb2a[_0x4fba('0x8')]||0xa;this[_0x4fba('0x9')]=_0x41bb2a[_0x4fba('0x9')]||_0x4fba('0xa');this['Agents']=_0x41bb2a[_0x4fba('0xb')];this[_0x4fba('0xc')]={};this[_0x4fba('0xd')]=0x0;this['md5']='';this[_0x4fba('0xe')]();this[_0x4fba('0xf')]();}FaxQueue[_0x4fba('0x10')][_0x4fba('0xe')]=function(){var _0x2ea3ab=this[_0x4fba('0xc')][_0x4fba('0x11')];this[_0x4fba('0xc')]=_[_0x4fba('0x12')](this[_0x4fba('0xb')],'id');this['mapAgentsId'][_0x4fba('0x11')]=_0x2ea3ab;};FaxQueue[_0x4fba('0x10')][_0x4fba('0xf')]=function(){this[_0x4fba('0x13')]=0x0;this[_0x4fba('0x14')]=0x0;for(var _0x292ed2=0x0;_0x292ed2=0x0?this[_0x4fba('0x18')]:0x0;var _0x479ca2={'id':this['id'],'available':this['available'],'loggedIn':this[_0x4fba('0x13')],'name':this[_0x4fba('0x19')],'paused':this[_0x4fba('0x14')],'waiting':this[_0x4fba('0xd')]};var _0x49f1b5=md5(JSON['stringify'](_0x479ca2));if(this['md5']!==_0x49f1b5){this[_0x4fba('0x1a')]=_0x49f1b5;io['to'](util[_0x4fba('0x1b')]('fax:queue:%s',_0x479ca2[_0x4fba('0x19')]))['emit'](_0x4fba('0x1c'),_0x479ca2);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 1aaa32d..6332906 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 _0xbf49=['name','Intervals','exports'];(function(_0x1f0a8c,_0x1449da){var _0x47b96d=function(_0x2f7e42){while(--_0x2f7e42){_0x1f0a8c['push'](_0x1f0a8c['shift']());}};_0x47b96d(++_0x1449da);}(_0xbf49,0xd8));var _0x9bf4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf49[_0x3dd15e];return _0x231fd0;};'use strict';function Interval(_0x470d17){this['id']=_0x470d17['id']||0x0;this[_0x9bf4('0x0')]=_0x470d17[_0x9bf4('0x0')]||'';this[_0x9bf4('0x1')]=_0x470d17[_0x9bf4('0x1')]||{};}module[_0x9bf4('0x2')]=Interval; \ No newline at end of file +var _0x0672=['Intervals','exports','name'];(function(_0x466e43,_0x165168){var _0x15388d=function(_0x137c2d){while(--_0x137c2d){_0x466e43['push'](_0x466e43['shift']());}};_0x15388d(++_0x165168);}(_0x0672,0x125));var _0x2067=function(_0x65959d,_0x4dd888){_0x65959d=_0x65959d-0x0;var _0x2d71aa=_0x0672[_0x65959d];return _0x2d71aa;};'use strict';function Interval(_0xe862aa){this['id']=_0xe862aa['id']||0x0;this[_0x2067('0x0')]=_0xe862aa[_0x2067('0x0')]||'';this[_0x2067('0x1')]=_0xe862aa[_0x2067('0x1')]||{};}module[_0x2067('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 8d5e776..d4e4371 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 _0x942e=['prototype','mapAgentsId','_rr','map','loggedIn','paused','length','online','available','mail:queue:%s','emit','mail_queue:save','util','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRealtime'];(function(_0x29ae80,_0x3579f1){var _0x5d6d71=function(_0xfaffe2){while(--_0xfaffe2){_0x29ae80['push'](_0x29ae80['shift']());}};_0x5d6d71(++_0x3579f1);}(_0x942e,0x15e));var _0xe942=function(_0x136d50,_0x4acf87){_0x136d50=_0x136d50-0x0;var _0x13af0e=_0x942e[_0x136d50];return _0x13af0e;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xe942('0x0'));var Redis=require(_0xe942('0x1'));var config=require(_0xe942('0x2'));config['redis']=_[_0xe942('0x3')](config[_0xe942('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xe942('0x5'))(new Redis(config[_0xe942('0x4')]));function MailQueue(_0x486277){this['id']=_0x486277['id']||0x0;this[_0xe942('0x6')]=_0x486277[_0xe942('0x6')]||'';this[_0xe942('0x7')]=_0x486277[_0xe942('0x7')]||0xa;this[_0xe942('0x8')]=_0x486277[_0xe942('0x8')]||_0xe942('0x9');this['Agents']=_0x486277[_0xe942('0xa')];this['mapAgentsId']={};this[_0xe942('0xb')]=0x0;this[_0xe942('0xc')]='';this['updateRouting']();this[_0xe942('0xd')]();}MailQueue[_0xe942('0xe')]['updateRouting']=function(){var _0x155c89=this[_0xe942('0xf')][_0xe942('0x10')];this[_0xe942('0xf')]=_[_0xe942('0x11')](this['Agents'],'id');this[_0xe942('0xf')]['_rr']=_0x155c89;};MailQueue[_0xe942('0xe')][_0xe942('0xd')]=function(){this[_0xe942('0x12')]=0x0;this[_0xe942('0x13')]=0x0;for(var _0x2cb1b8=0x0;_0x2cb1b8=0x0?this[_0xe942('0x16')]:0x0;var _0x1e2ea1={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xe942('0x6')],'paused':this['paused'],'waiting':this[_0xe942('0xb')]};var _0x3ff2e5=md5(JSON['stringify'](_0x1e2ea1));if(this[_0xe942('0xc')]!==_0x3ff2e5){this[_0xe942('0xc')]=_0x3ff2e5;io['to'](util['format'](_0xe942('0x17'),_0x1e2ea1[_0xe942('0x6')]))[_0xe942('0x18')](_0xe942('0x19'),_0x1e2ea1);}};module['exports']=MailQueue; \ No newline at end of file +var _0x6049=['updateRouting','prototype','mapAgentsId','_rr','map','loggedIn','length','online','mailPause','available','format','emit','mail_queue:save','exports','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','md5'];(function(_0x370753,_0x49bffe){var _0x563d2e=function(_0x2c5136){while(--_0x2c5136){_0x370753['push'](_0x370753['shift']());}};_0x563d2e(++_0x49bffe);}(_0x6049,0x146));var _0x9604=function(_0x5b7e0a,_0x59c79e){_0x5b7e0a=_0x5b7e0a-0x0;var _0x5d36b3=_0x6049[_0x5b7e0a];return _0x5d36b3;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x9604('0x0'));var Redis=require(_0x9604('0x1'));var config=require('../../../config/environment');config[_0x9604('0x2')]=_[_0x9604('0x3')](config[_0x9604('0x2')],{'host':_0x9604('0x4'),'port':0x18eb});var io=require(_0x9604('0x5'))(new Redis(config[_0x9604('0x2')]));function MailQueue(_0x20f4bf){this['id']=_0x20f4bf['id']||0x0;this[_0x9604('0x6')]=_0x20f4bf[_0x9604('0x6')]||'';this[_0x9604('0x7')]=_0x20f4bf['timeout']||0xa;this['strategy']=_0x20f4bf[_0x9604('0x8')]||'beepall';this[_0x9604('0x9')]=_0x20f4bf[_0x9604('0x9')];this['mapAgentsId']={};this[_0x9604('0xa')]=0x0;this[_0x9604('0xb')]='';this[_0x9604('0xc')]();this['updateRealtime']();}MailQueue[_0x9604('0xd')]['updateRouting']=function(){var _0x377be6=this[_0x9604('0xe')][_0x9604('0xf')];this[_0x9604('0xe')]=_[_0x9604('0x10')](this[_0x9604('0x9')],'id');this[_0x9604('0xe')][_0x9604('0xf')]=_0x377be6;};MailQueue['prototype']['updateRealtime']=function(){this[_0x9604('0x11')]=0x0;this['paused']=0x0;for(var _0x53463e=0x0;_0x53463e=0x0?this[_0x9604('0x15')]:0x0;var _0x1c1410={'id':this['id'],'available':this[_0x9604('0x15')],'loggedIn':this[_0x9604('0x11')],'name':this[_0x9604('0x6')],'paused':this['paused'],'waiting':this[_0x9604('0xa')]};var _0x151a39=md5(JSON['stringify'](_0x1c1410));if(this[_0x9604('0xb')]!==_0x151a39){this[_0x9604('0xb')]=_0x151a39;io['to'](util[_0x9604('0x16')]('mail:queue:%s',_0x1c1410['name']))[_0x9604('0x17')](_0x9604('0x18'),_0x1c1410);}};module[_0x9604('0x19')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index e4b62eb..48c3794 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x326f,0xd1));var _0xf326=function(_0x3dfe71,_0x4d6529){_0x3dfe71=_0x3dfe71-0x0;var _0x233faa=_0x326f[_0x3dfe71];return _0x233faa;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xc4aa[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index a6bf456..7e7dbfb 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 _0x9335=['strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','smsPause','paused','available','name','stringify','sms:queue:%s','emit','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout'];(function(_0x8cb2f9,_0x2b8706){var _0x164887=function(_0x1812cc){while(--_0x1812cc){_0x8cb2f9['push'](_0x8cb2f9['shift']());}};_0x164887(++_0x2b8706);}(_0x9335,0xab));var _0x5933=function(_0x399c69,_0x165296){_0x399c69=_0x399c69-0x0;var _0x2ec571=_0x9335[_0x399c69];return _0x2ec571;};'use strict';var _=require(_0x5933('0x0'));var md5=require(_0x5933('0x1'));var util=require('util');var Redis=require(_0x5933('0x2'));var config=require(_0x5933('0x3'));config[_0x5933('0x4')]=_[_0x5933('0x5')](config[_0x5933('0x4')],{'host':_0x5933('0x6'),'port':0x18eb});var io=require(_0x5933('0x7'))(new Redis(config['redis']));function SmsQueue(_0x29979f){this['id']=_0x29979f['id']||0x0;this['name']=_0x29979f['name']||'';this[_0x5933('0x8')]=_0x29979f[_0x5933('0x8')]||0xa;this[_0x5933('0x9')]=_0x29979f['strategy']||_0x5933('0xa');this[_0x5933('0xb')]=_0x29979f[_0x5933('0xb')];this[_0x5933('0xc')]={};this[_0x5933('0xd')]=0x0;this[_0x5933('0x1')]='';this[_0x5933('0xe')]();this[_0x5933('0xf')]();}SmsQueue[_0x5933('0x10')][_0x5933('0xe')]=function(){var _0x27b823=this[_0x5933('0xc')][_0x5933('0x11')];this['mapAgentsId']=_[_0x5933('0x12')](this['Agents'],'id');this[_0x5933('0xc')][_0x5933('0x11')]=_0x27b823;};SmsQueue[_0x5933('0x10')]['updateRealtime']=function(){this[_0x5933('0x13')]=0x0;this['paused']=0x0;for(var _0x1ab3d0=0x0;_0x1ab3d0=0x0?this['available']:0x0;var _0x4a4d3f={'id':this['id'],'available':this[_0x5933('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x5933('0x19')],'paused':this[_0x5933('0x17')],'waiting':this[_0x5933('0xd')]};var _0x501065=md5(JSON[_0x5933('0x1a')](_0x4a4d3f));if(this[_0x5933('0x1')]!==_0x501065){this[_0x5933('0x1')]=_0x501065;io['to'](util['format'](_0x5933('0x1b'),_0x4a4d3f['name']))[_0x5933('0x1c')]('sms_queue:save',_0x4a4d3f);}};module[_0x5933('0x1d')]=SmsQueue; \ No newline at end of file +var _0xbd3b=['updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','online','smsPause','available','waiting','stringify','format','sms:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd3b,0x1c3));var _0xbbd3=function(_0x395be8,_0x285479){_0x395be8=_0x395be8-0x0;var _0x5ceb20=_0xbd3b[_0x395be8];return _0x5ceb20;};'use strict';var _=require(_0xbbd3('0x0'));var md5=require(_0xbbd3('0x1'));var util=require(_0xbbd3('0x2'));var Redis=require('ioredis');var config=require(_0xbbd3('0x3'));config[_0xbbd3('0x4')]=_[_0xbbd3('0x5')](config[_0xbbd3('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xbbd3('0x6'))(new Redis(config[_0xbbd3('0x4')]));function SmsQueue(_0x507a1f){this['id']=_0x507a1f['id']||0x0;this[_0xbbd3('0x7')]=_0x507a1f['name']||'';this[_0xbbd3('0x8')]=_0x507a1f[_0xbbd3('0x8')]||0xa;this[_0xbbd3('0x9')]=_0x507a1f['strategy']||_0xbbd3('0xa');this[_0xbbd3('0xb')]=_0x507a1f[_0xbbd3('0xb')];this[_0xbbd3('0xc')]={};this['waiting']=0x0;this[_0xbbd3('0x1')]='';this[_0xbbd3('0xd')]();this[_0xbbd3('0xe')]();}SmsQueue[_0xbbd3('0xf')]['updateRouting']=function(){var _0x4a3cd6=this['mapAgentsId']['_rr'];this[_0xbbd3('0xc')]=_[_0xbbd3('0x10')](this[_0xbbd3('0xb')],'id');this[_0xbbd3('0xc')][_0xbbd3('0x11')]=_0x4a3cd6;};SmsQueue[_0xbbd3('0xf')][_0xbbd3('0xe')]=function(){this[_0xbbd3('0x12')]=0x0;this[_0xbbd3('0x13')]=0x0;for(var _0xf12c2d=0x0;_0xf12c2d=0x0?this[_0xbbd3('0x16')]:0x0;var _0x5f3952={'id':this['id'],'available':this['available'],'loggedIn':this[_0xbbd3('0x12')],'name':this[_0xbbd3('0x7')],'paused':this['paused'],'waiting':this[_0xbbd3('0x17')]};var _0x52b154=md5(JSON[_0xbbd3('0x18')](_0x5f3952));if(this[_0xbbd3('0x1')]!==_0x52b154){this[_0xbbd3('0x1')]=_0x52b154;io['to'](util[_0xbbd3('0x19')](_0xbbd3('0x1a'),_0x5f3952[_0xbbd3('0x7')]))[_0xbbd3('0x1b')]('sms_queue:save',_0x5f3952);}};module[_0xbbd3('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 646e3f9..b724b7d 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 _0x8590=['defaults','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','waiting','updateRealtime','_rr','prototype','loggedIn','paused','length','online','available','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5','ioredis','../../../config/environment'];(function(_0x30be39,_0xfb49ad){var _0x4d99d6=function(_0x1e7665){while(--_0x1e7665){_0x30be39['push'](_0x30be39['shift']());}};_0x4d99d6(++_0xfb49ad);}(_0x8590,0xde));var _0x0859=function(_0x3b0ac2,_0x16b916){_0x3b0ac2=_0x3b0ac2-0x0;var _0x505790=_0x8590[_0x3b0ac2];return _0x505790;};'use strict';var _=require('lodash');var md5=require(_0x0859('0x0'));var util=require('util');var Redis=require(_0x0859('0x1'));var config=require(_0x0859('0x2'));config['redis']=_[_0x0859('0x3')](config['redis'],{'host':_0x0859('0x4'),'port':0x18eb});var io=require(_0x0859('0x5'))(new Redis(config['redis']));function WhatsappQueue(_0x287b48){this['id']=_0x287b48['id']||0x0;this[_0x0859('0x6')]=_0x287b48[_0x0859('0x6')]||'';this[_0x0859('0x7')]=_0x287b48[_0x0859('0x7')]||0xa;this['strategy']=_0x287b48['strategy']||_0x0859('0x8');this[_0x0859('0x9')]=_0x287b48[_0x0859('0x9')];this[_0x0859('0xa')]={};this[_0x0859('0xb')]=0x0;this[_0x0859('0x0')]='';this['updateRouting']();this[_0x0859('0xc')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x3da68a=this[_0x0859('0xa')]['_rr'];this['mapAgentsId']=_['map'](this[_0x0859('0x9')],'id');this[_0x0859('0xa')][_0x0859('0xd')]=_0x3da68a;};WhatsappQueue[_0x0859('0xe')]['updateRealtime']=function(){this[_0x0859('0xf')]=0x0;this[_0x0859('0x10')]=0x0;for(var _0x47fc27=0x0;_0x47fc27=0x0?this[_0x0859('0x13')]:0x0;var _0x11cd3b={'id':this['id'],'available':this[_0x0859('0x13')],'loggedIn':this[_0x0859('0xf')],'name':this['name'],'paused':this[_0x0859('0x10')],'waiting':this[_0x0859('0xb')]};var _0x35e83e=md5(JSON[_0x0859('0x14')](_0x11cd3b));if(this[_0x0859('0x0')]!==_0x35e83e){this[_0x0859('0x0')]=_0x35e83e;io['to'](util['format'](_0x0859('0x15'),_0x11cd3b[_0x0859('0x6')]))[_0x0859('0x16')](_0x0859('0x17'),_0x11cd3b);}};module[_0x0859('0x18')]=WhatsappQueue; \ No newline at end of file +var _0x37bb=['_rr','map','loggedIn','paused','length','online','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x39ab14,_0x1c6d59){var _0x5a661e=function(_0x39297e){while(--_0x39297e){_0x39ab14['push'](_0x39ab14['shift']());}};_0x5a661e(++_0x1c6d59);}(_0x37bb,0x1b1));var _0xb37b=function(_0x28a0f5,_0x1f511a){_0x28a0f5=_0x28a0f5-0x0;var _0x1481d4=_0x37bb[_0x28a0f5];return _0x1481d4;};'use strict';var _=require(_0xb37b('0x0'));var md5=require(_0xb37b('0x1'));var util=require(_0xb37b('0x2'));var Redis=require(_0xb37b('0x3'));var config=require('../../../config/environment');config[_0xb37b('0x4')]=_['defaults'](config[_0xb37b('0x4')],{'host':_0xb37b('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb37b('0x4')]));function WhatsappQueue(_0x21d65e){this['id']=_0x21d65e['id']||0x0;this['name']=_0x21d65e[_0xb37b('0x6')]||'';this[_0xb37b('0x7')]=_0x21d65e['timeout']||0xa;this[_0xb37b('0x8')]=_0x21d65e[_0xb37b('0x8')]||_0xb37b('0x9');this[_0xb37b('0xa')]=_0x21d65e['Agents'];this[_0xb37b('0xb')]={};this[_0xb37b('0xc')]=0x0;this[_0xb37b('0x1')]='';this[_0xb37b('0xd')]();this[_0xb37b('0xe')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0xd19dc1=this['mapAgentsId'][_0xb37b('0xf')];this['mapAgentsId']=_[_0xb37b('0x10')](this[_0xb37b('0xa')],'id');this[_0xb37b('0xb')][_0xb37b('0xf')]=_0xd19dc1;};WhatsappQueue['prototype']['updateRealtime']=function(){this[_0xb37b('0x11')]=0x0;this[_0xb37b('0x12')]=0x0;for(var _0x5a70b6=0x0;_0x5a70b6=0x0?this['available']:0x0;var _0x42d00e={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xb37b('0x6')],'paused':this['paused'],'waiting':this[_0xb37b('0xc')]};var _0x5019fc=md5(JSON[_0xb37b('0x16')](_0x42d00e));if(this[_0xb37b('0x1')]!==_0x5019fc){this[_0xb37b('0x1')]=_0x5019fc;io['to'](util[_0xb37b('0x17')](_0xb37b('0x18'),_0x42d00e[_0xb37b('0x6')]))[_0xb37b('0x19')](_0xb37b('0x1a'),_0x42d00e);}};module[_0xb37b('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 5ede22e..6fdf601 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0xea852e,_0x19f732){var _0x283afa=function(_0x176bbc){while(--_0x176bbc){_0xea852e['push'](_0xea852e['shift']());}};_0x283afa(++_0x19f732);}(_0xb10b,0x12a));var _0xbb10=function(_0x4c89cd,_0x2c57e2){_0x4c89cd=_0x4c89cd-0x0;var _0x1090d2=_0xb10b[_0x4c89cd];return _0x1090d2;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _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(_0x3e28f0,_0x4ba77c){var _0x19d7fa=function(_0xacea27){while(--_0xacea27){_0x3e28f0['push'](_0x3e28f0['shift']());}};_0x19d7fa(++_0x4ba77c);}(_0xb10b,0x12a));var _0xbb10=function(_0x3b166b,_0x2c8ba1){_0x3b166b=_0x3b166b-0x0;var _0x579602=_0xb10b[_0x3b166b];return _0x579602;};'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 3ca2288..24dd928 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 _0xd002=['update','Request','UpdateChatInteraction','addTags','addTagsToChatInteraction','../client'];(function(_0x324915,_0x5ec142){var _0x569bad=function(_0x589650){while(--_0x589650){_0x324915['push'](_0x324915['shift']());}};_0x569bad(++_0x5ec142);}(_0xd002,0x1df));var _0x2d00=function(_0xd577cd,_0x3c470f){_0xd577cd=_0xd577cd-0x0;var _0x255207=_0xd002[_0xd577cd];return _0x255207;};'use strict';var client=require(_0x2d00('0x0'));exports[_0x2d00('0x1')]=function(_0x283e55,_0x31233f){return client[_0x2d00('0x2')](_0x2d00('0x3'),{'body':_0x31233f,'options':{'where':{'id':_0x283e55}},'log':'updateChatInteraction'});};exports[_0x2d00('0x4')]=function(_0x4b9e31,_0xec3856){return client[_0x2d00('0x2')]('AddTagsToChatInteraction',{'body':_0xec3856,'options':{'where':{'id':_0x4b9e31}},'log':_0x2d00('0x5')});}; \ No newline at end of file +var _0xee3f=['addTags','addTagsToChatInteraction','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x50b8ff,_0x3ab7d9){var _0x31032=function(_0x4d406a){while(--_0x4d406a){_0x50b8ff['push'](_0x50b8ff['shift']());}};_0x31032(++_0x3ab7d9);}(_0xee3f,0x11a));var _0xfee3=function(_0x955da1,_0x141a18){_0x955da1=_0x955da1-0x0;var _0x5968f5=_0xee3f[_0x955da1];return _0x5968f5;};'use strict';var client=require('../client');exports['update']=function(_0x3e8c58,_0x5525a7){return client[_0xfee3('0x0')](_0xfee3('0x1'),{'body':_0x5525a7,'options':{'where':{'id':_0x3e8c58}},'log':_0xfee3('0x2')});};exports[_0xfee3('0x3')]=function(_0x1ca535,_0x2132c3){return client[_0xfee3('0x0')]('AddTagsToChatInteraction',{'body':_0x2132c3,'options':{'where':{'id':_0x1ca535}},'log':_0xfee3('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index a826484..32d0f9b 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 _0xdb9c=['create','Request','CreateChatMessage','createChatMessage','../client'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0xdb9c,0xdb));var _0xcdb9=function(_0x14ceed,_0x1dc1fd){_0x14ceed=_0x14ceed-0x0;var _0x212673=_0xdb9c[_0x14ceed];return _0x212673;};'use strict';var client=require(_0xcdb9('0x0'));exports[_0xcdb9('0x1')]=function(_0x52d55f){return client[_0xcdb9('0x2')](_0xcdb9('0x3'),{'body':_0x52d55f,'log':_0xcdb9('0x4')});}; \ No newline at end of file +var _0x6b33=['create','Request','CreateChatMessage','../client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6b33,0xa3));var _0x36b3=function(_0xc1aa42,_0x137d36){_0xc1aa42=_0xc1aa42-0x0;var _0x3e8b0c=_0x6b33[_0xc1aa42];return _0x3e8b0c;};'use strict';var client=require(_0x36b3('0x0'));exports[_0x36b3('0x1')]=function(_0xae7220){return client[_0x36b3('0x2')](_0x36b3('0x3'),{'body':_0xae7220,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index e12cb27..21eabd9 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 _0x165d=['strategy','Agents','../client','getChatQueues','Request','GetChatQueue','name','timeout'];(function(_0x34425b,_0x398983){var _0x292d44=function(_0x33169d){while(--_0x33169d){_0x34425b['push'](_0x34425b['shift']());}};_0x292d44(++_0x398983);}(_0x165d,0x14a));var _0xd165=function(_0xdfd3c5,_0x1902af){_0xdfd3c5=_0xdfd3c5-0x0;var _0xb7802b=_0x165d[_0xdfd3c5];return _0xb7802b;};'use strict';var client=require(_0xd165('0x0'));exports[_0xd165('0x1')]=function(){return function(){return client[_0xd165('0x2')](_0xd165('0x3'),{'options':{'raw':![],'attributes':['id',_0xd165('0x4'),_0xd165('0x5'),_0xd165('0x6')],'include':[{'model':'User','as':_0xd165('0x7'),'attributes':['id',_0xd165('0x4'),'online','chatPause']}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0xd493=['timeout','Agents','name','getChatQueues','../client','Request','GetChatQueue'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd493,0x1bd));var _0x3d49=function(_0x4e5cd5,_0x506acd){_0x4e5cd5=_0x4e5cd5-0x0;var _0x33028d=_0xd493[_0x4e5cd5];return _0x33028d;};'use strict';var client=require(_0x3d49('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x3d49('0x1')](_0x3d49('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x3d49('0x3'),'strategy'],'include':[{'model':'User','as':_0x3d49('0x4'),'attributes':['id',_0x3d49('0x5'),'online','chatPause']}]},'log':_0x3d49('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 925b691..7a05e69 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 _0x0434=['CreateChatQueueReport','UpdateChatQueueReport','DESC','../client','create','Request'];(function(_0x5fcb09,_0x5155bd){var _0x508f62=function(_0x318163){while(--_0x318163){_0x5fcb09['push'](_0x5fcb09['shift']());}};_0x508f62(++_0x5155bd);}(_0x0434,0x1ad));var _0x4043=function(_0x173452,_0x3aa870){_0x173452=_0x173452-0x0;var _0xee3fd0=_0x0434[_0x173452];return _0xee3fd0;};'use strict';var client=require(_0x4043('0x0'));exports[_0x4043('0x1')]=function(_0x4cb6b5){return client[_0x4043('0x2')](_0x4043('0x3'),{'body':_0x4cb6b5,'log':'CreateChatQueueReport'});};exports['update']=function(_0x2e6bdf,_0xfa9ae8){return client[_0x4043('0x2')](_0x4043('0x4'),{'body':_0xfa9ae8,'options':{'where':{'uniqueid':_0x2e6bdf},'order':[['id',_0x4043('0x5')]],'limit':0x1},'log':_0x4043('0x4')});}; \ No newline at end of file +var _0x37f8=['create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x37f8,0xd2));var _0x837f=function(_0x14460d,_0x30f95c){_0x14460d=_0x14460d-0x0;var _0xe860e9=_0x37f8[_0x14460d];return _0xe860e9;};'use strict';var client=require('../client');exports[_0x837f('0x0')]=function(_0x3755bc){return client[_0x837f('0x1')](_0x837f('0x2'),{'body':_0x3755bc,'log':'CreateChatQueueReport'});};exports[_0x837f('0x3')]=function(_0x5184ad,_0x5f2d01){return client['Request']('UpdateChatQueueReport',{'body':_0x5f2d01,'options':{'where':{'uniqueid':_0x5184ad},'order':[['id','DESC']],'limit':0x1},'log':_0x837f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 443be6a..0118fda 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 _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x7a54,0x106));var _0x47a5=function(_0x2b102b,_0x2aad1f){_0x2b102b=_0x2b102b-0x0;var _0x3f22a8=_0x7a54[_0x2b102b];return _0x3f22a8;};'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 +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0xf4d05,_0x5e601f){var _0x47c971=function(_0x17aae3){while(--_0x17aae3){_0xf4d05['push'](_0xf4d05['shift']());}};_0x47c971(++_0x5e601f);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 6bb5c20..a4d3dce 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 _0x33a8=['createFaxMessage','../client','Request','CreateFaxMessage'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x33a8,0x115));var _0x833a=function(_0x368141,_0x5a4e63){_0x368141=_0x368141-0x0;var _0x10afeb=_0x33a8[_0x368141];return _0x10afeb;};'use strict';var client=require(_0x833a('0x0'));exports['create']=function(_0x4fca5a){return client[_0x833a('0x1')](_0x833a('0x2'),{'body':_0x4fca5a,'log':_0x833a('0x3')});}; \ No newline at end of file +var _0x290e=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0xbcb083,_0x1d99ed){var _0x1b4bff=function(_0xfc5a99){while(--_0xfc5a99){_0xbcb083['push'](_0xbcb083['shift']());}};_0x1b4bff(++_0x1d99ed);}(_0x290e,0x15a));var _0xe290=function(_0xddee6f,_0x51f8dd){_0xddee6f=_0xddee6f-0x0;var _0x5e1408=_0x290e[_0xddee6f];return _0x5e1408;};'use strict';var client=require(_0xe290('0x0'));exports[_0xe290('0x1')]=function(_0x563e70){return client[_0xe290('0x2')](_0xe290('0x3'),{'body':_0x563e70,'log':_0xe290('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 733c2f8..61dcdac 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 _0x8130=['getFaxQueues','Request','User','Agents','online','faxPause'];(function(_0x4586e2,_0x3a6940){var _0x2fdfd8=function(_0x4ea375){while(--_0x4ea375){_0x4586e2['push'](_0x4586e2['shift']());}};_0x2fdfd8(++_0x3a6940);}(_0x8130,0xeb));var _0x0813=function(_0x4c89f3,_0x2ca618){_0x4c89f3=_0x4c89f3-0x0;var _0x558a55=_0x8130[_0x4c89f3];return _0x558a55;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0x0813('0x0')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0x0813('0x1'),'as':_0x0813('0x2'),'attributes':['id','name',_0x0813('0x3'),_0x0813('0x4')]}]},'log':_0x0813('0x5')});};}; \ No newline at end of file +var _0x640f=['online','faxPause','getFaxQueues','Request','GetFaxQueue','timeout','strategy','User','Agents'];(function(_0x2127ce,_0x5c951d){var _0x5b5380=function(_0x3b137f){while(--_0x3b137f){_0x2127ce['push'](_0x2127ce['shift']());}};_0x5b5380(++_0x5c951d);}(_0x640f,0x92));var _0xf640=function(_0xf42c57,_0x47ad00){_0xf42c57=_0xf42c57-0x0;var _0x35857c=_0x640f[_0xf42c57];return _0x35857c;};'use strict';var client=require('../client');exports[_0xf640('0x0')]=function(){return function(){return client[_0xf640('0x1')](_0xf640('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xf640('0x3'),_0xf640('0x4')],'include':[{'model':_0xf640('0x5'),'as':_0xf640('0x6'),'attributes':['id','name',_0xf640('0x7'),_0xf640('0x8')]}]},'log':_0xf640('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index ed7f2e1..a176dc3 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 _0xa9e9=['../client','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC'];(function(_0x5d0290,_0x477acd){var _0x3581b6=function(_0x266c22){while(--_0x266c22){_0x5d0290['push'](_0x5d0290['shift']());}};_0x3581b6(++_0x477acd);}(_0xa9e9,0x118));var _0x9a9e=function(_0x4c1100,_0x11721c){_0x4c1100=_0x4c1100-0x0;var _0xd6c59e=_0xa9e9[_0x4c1100];return _0xd6c59e;};'use strict';var client=require(_0x9a9e('0x0'));exports[_0x9a9e('0x1')]=function(_0x355f11){return client[_0x9a9e('0x2')](_0x9a9e('0x3'),{'body':_0x355f11,'log':'CreateFaxQueueReport'});};exports[_0x9a9e('0x4')]=function(_0x211e9d,_0x5edc05){return client[_0x9a9e('0x2')](_0x9a9e('0x5'),{'body':_0x5edc05,'options':{'where':{'uniqueid':_0x211e9d},'order':[['id',_0x9a9e('0x6')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0xf915=['DESC','create','CreateFaxQueueReport','update','Request','UpdateFaxQueueReport'];(function(_0x37e93c,_0x27d2b0){var _0xfad175=function(_0x46065a){while(--_0x46065a){_0x37e93c['push'](_0x37e93c['shift']());}};_0xfad175(++_0x27d2b0);}(_0xf915,0x1db));var _0x5f91=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf915[_0x57b54c];return _0x59cc19;};'use strict';var client=require('../client');exports[_0x5f91('0x0')]=function(_0x496500){return client['Request'](_0x5f91('0x1'),{'body':_0x496500,'log':_0x5f91('0x1')});};exports[_0x5f91('0x2')]=function(_0x21a07d,_0x1f3117){return client[_0x5f91('0x3')](_0x5f91('0x4'),{'body':_0x1f3117,'options':{'where':{'uniqueid':_0x21a07d},'order':[['id',_0x5f91('0x5')]],'limit':0x1},'log':_0x5f91('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 81ff4f0..5f4421c 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 _0x2471=['Intervals','name','../client','getIntervals','Request','GetInterval'];(function(_0x3320f4,_0x38148a){var _0x7cadc3=function(_0x554799){while(--_0x554799){_0x3320f4['push'](_0x3320f4['shift']());}};_0x7cadc3(++_0x38148a);}(_0x2471,0xaa));var _0x1247=function(_0x197b85,_0x54bac8){_0x197b85=_0x197b85-0x0;var _0x229fcf=_0x2471[_0x197b85];return _0x229fcf;};'use strict';var client=require(_0x1247('0x0'));exports[_0x1247('0x1')]=function(){return function(){return client[_0x1247('0x2')](_0x1247('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0x1247('0x4'),'attributes':['id',_0x1247('0x5'),'interval']}]},'log':_0x1247('0x1')});};}; \ No newline at end of file +var _0x3936=['Intervals','interval','../client','getIntervals','GetInterval','name','Interval'];(function(_0x55923c,_0x166edb){var _0xf94fbb=function(_0x5d941d){while(--_0x5d941d){_0x55923c['push'](_0x55923c['shift']());}};_0xf94fbb(++_0x166edb);}(_0x3936,0x12f));var _0x6393=function(_0x129d52,_0x1beadf){_0x129d52=_0x129d52-0x0;var _0x79ef89=_0x3936[_0x129d52];return _0x79ef89;};'use strict';var client=require(_0x6393('0x0'));exports[_0x6393('0x1')]=function(){return function(){return client['Request'](_0x6393('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x6393('0x3')],'include':[{'model':_0x6393('0x4'),'as':_0x6393('0x5'),'attributes':['id',_0x6393('0x3'),_0x6393('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index f9e525e..0b42c5f 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 _0x4bd3=['../client','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x588bf2,_0xe6fb8){var _0x571db3=function(_0x4cdac8){while(--_0x4cdac8){_0x588bf2['push'](_0x588bf2['shift']());}};_0x571db3(++_0xe6fb8);}(_0x4bd3,0x174));var _0x34bd=function(_0x263929,_0x38961d){_0x263929=_0x263929-0x0;var _0x46f561=_0x4bd3[_0x263929];return _0x46f561;};'use strict';var client=require(_0x34bd('0x0'));exports['update']=function(_0x415bd3,_0x22a9f9){return client['Request']('UpdateMailInteraction',{'body':_0x22a9f9,'options':{'where':{'id':_0x415bd3}},'log':'updateMailInteraction'});};exports[_0x34bd('0x1')]=function(_0x44854a,_0x1fc8eb){return client['Request'](_0x34bd('0x2'),{'body':_0x1fc8eb,'options':{'where':{'id':_0x44854a}},'log':_0x34bd('0x3')});}; \ No newline at end of file +var _0x02ce=['addTagsToChatInteraction','../client','update','Request','updateMailInteraction','addTags','AddTagsToMailInteraction'];(function(_0x2199d7,_0xf39337){var _0x4cc7fd=function(_0x6857e){while(--_0x6857e){_0x2199d7['push'](_0x2199d7['shift']());}};_0x4cc7fd(++_0xf39337);}(_0x02ce,0x1ac));var _0xe02c=function(_0x4ece40,_0xdb0765){_0x4ece40=_0x4ece40-0x0;var _0x54db15=_0x02ce[_0x4ece40];return _0x54db15;};'use strict';var client=require(_0xe02c('0x0'));exports[_0xe02c('0x1')]=function(_0x3f9bc7,_0x5a49d9){return client[_0xe02c('0x2')]('UpdateMailInteraction',{'body':_0x5a49d9,'options':{'where':{'id':_0x3f9bc7}},'log':_0xe02c('0x3')});};exports[_0xe02c('0x4')]=function(_0x46475c,_0xf4b764){return client[_0xe02c('0x2')](_0xe02c('0x5'),{'body':_0xf4b764,'options':{'where':{'id':_0x46475c}},'log':_0xe02c('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index bac0484..9f4fae3 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 _0x81d4=['Request','CreateMailMessage','../client','create'];(function(_0x3ca869,_0x2df7fe){var _0x3af4c=function(_0x4eff3c){while(--_0x4eff3c){_0x3ca869['push'](_0x3ca869['shift']());}};_0x3af4c(++_0x2df7fe);}(_0x81d4,0x72));var _0x481d=function(_0x29478a,_0x32fe56){_0x29478a=_0x29478a-0x0;var _0x2c23af=_0x81d4[_0x29478a];return _0x2c23af;};'use strict';var client=require(_0x481d('0x0'));exports[_0x481d('0x1')]=function(_0xc53b3f){return client[_0x481d('0x2')](_0x481d('0x3'),{'body':_0xc53b3f,'log':'createMailMessage'});}; \ No newline at end of file +var _0x4da8=['../client','create','Request','CreateMailMessage','createMailMessage'];(function(_0x4b5d23,_0x1797fb){var _0x37bafd=function(_0x5458d7){while(--_0x5458d7){_0x4b5d23['push'](_0x4b5d23['shift']());}};_0x37bafd(++_0x1797fb);}(_0x4da8,0x19f));var _0x84da=function(_0xdcce44,_0x53d035){_0xdcce44=_0xdcce44-0x0;var _0x54ca1b=_0x4da8[_0xdcce44];return _0x54ca1b;};'use strict';var client=require(_0x84da('0x0'));exports[_0x84da('0x1')]=function(_0xc13d3a){return client[_0x84da('0x2')](_0x84da('0x3'),{'body':_0xc13d3a,'log':_0x84da('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 9ce908d..bbc1f92 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 _0x5ff5=['getMailQueues','GetMailQueue','name','timeout','strategy','User','online','mailPause','../client'];(function(_0x6b07a7,_0x2546ee){var _0x1649b4=function(_0xb93d84){while(--_0xb93d84){_0x6b07a7['push'](_0x6b07a7['shift']());}};_0x1649b4(++_0x2546ee);}(_0x5ff5,0xfb));var _0x55ff=function(_0x1ef644,_0x3ccd82){_0x1ef644=_0x1ef644-0x0;var _0x13a0e3=_0x5ff5[_0x1ef644];return _0x13a0e3;};'use strict';var client=require(_0x55ff('0x0'));exports[_0x55ff('0x1')]=function(){return function(){return client['Request'](_0x55ff('0x2'),{'options':{'raw':![],'attributes':['id',_0x55ff('0x3'),_0x55ff('0x4'),_0x55ff('0x5')],'include':[{'model':_0x55ff('0x6'),'as':'Agents','attributes':['id','name',_0x55ff('0x7'),_0x55ff('0x8')]}]},'log':_0x55ff('0x1')});};}; \ No newline at end of file +var _0x7a0e=['Request','GetMailQueue','name','strategy','User','mailPause','../client','getMailQueues'];(function(_0x28139b,_0xac7343){var _0x4d051c=function(_0x1e6da6){while(--_0x1e6da6){_0x28139b['push'](_0x28139b['shift']());}};_0x4d051c(++_0xac7343);}(_0x7a0e,0x17e));var _0xe7a0=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x7a0e[_0x2b4411];return _0x8e41ef;};'use strict';var client=require(_0xe7a0('0x0'));exports[_0xe7a0('0x1')]=function(){return function(){return client[_0xe7a0('0x2')](_0xe7a0('0x3'),{'options':{'raw':![],'attributes':['id',_0xe7a0('0x4'),'timeout',_0xe7a0('0x5')],'include':[{'model':_0xe7a0('0x6'),'as':'Agents','attributes':['id',_0xe7a0('0x4'),'online',_0xe7a0('0x7')]}]},'log':_0xe7a0('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 751ddb6..43a48bf 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 _0x8efd=['update','Request','DESC','UpdateMailQueueReport','../client','create','CreateMailQueueReport'];(function(_0x54035e,_0x291ff6){var _0x5c6202=function(_0x585ee8){while(--_0x585ee8){_0x54035e['push'](_0x54035e['shift']());}};_0x5c6202(++_0x291ff6);}(_0x8efd,0x123));var _0xd8ef=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8efd[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xd8ef('0x0'));exports[_0xd8ef('0x1')]=function(_0x20ac1f){return client['Request'](_0xd8ef('0x2'),{'body':_0x20ac1f,'log':_0xd8ef('0x2')});};exports[_0xd8ef('0x3')]=function(_0x49d6c9,_0x52f008){return client[_0xd8ef('0x4')]('UpdateMailQueueReport',{'body':_0x52f008,'options':{'where':{'uniqueid':_0x49d6c9},'order':[['id',_0xd8ef('0x5')]],'limit':0x1},'log':_0xd8ef('0x6')});}; \ No newline at end of file +var _0x1278=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client'];(function(_0x5a8c38,_0x59a704){var _0x40d01d=function(_0x1e22dc){while(--_0x1e22dc){_0x5a8c38['push'](_0x5a8c38['shift']());}};_0x40d01d(++_0x59a704);}(_0x1278,0x1d9));var _0x8127=function(_0x1bae3e,_0x12950c){_0x1bae3e=_0x1bae3e-0x0;var _0x170b37=_0x1278[_0x1bae3e];return _0x170b37;};'use strict';var client=require(_0x8127('0x0'));exports['create']=function(_0x2a7918){return client[_0x8127('0x1')]('CreateMailQueueReport',{'body':_0x2a7918,'log':_0x8127('0x2')});};exports[_0x8127('0x3')]=function(_0x314ba0,_0xda008d){return client[_0x8127('0x1')](_0x8127('0x4'),{'body':_0xda008d,'options':{'where':{'uniqueid':_0x314ba0},'order':[['id',_0x8127('0x5')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 38c6d1a..73f4892 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 _0x3f2e=['addTagsToChatInteraction','../client','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction'];(function(_0x51f271,_0x3f44d2){var _0x51b2e6=function(_0x1b9585){while(--_0x1b9585){_0x51f271['push'](_0x51f271['shift']());}};_0x51b2e6(++_0x3f44d2);}(_0x3f2e,0xbe));var _0xe3f2=function(_0x504f15,_0x23a1ca){_0x504f15=_0x504f15-0x0;var _0x2a92c1=_0x3f2e[_0x504f15];return _0x2a92c1;};'use strict';var client=require(_0xe3f2('0x0'));exports['update']=function(_0x4ba54d,_0x40b12d){return client['Request'](_0xe3f2('0x1'),{'body':_0x40b12d,'options':{'where':{'id':_0x4ba54d}},'log':_0xe3f2('0x2')});};exports[_0xe3f2('0x3')]=function(_0x5341dd,_0xbe8638){return client[_0xe3f2('0x4')](_0xe3f2('0x5'),{'body':_0xbe8638,'options':{'where':{'id':_0x5341dd}},'log':_0xe3f2('0x6')});}; \ No newline at end of file +var _0x6ab8=['update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','../client'];(function(_0x575b4c,_0x3f1d33){var _0x169ce9=function(_0x2b2f2c){while(--_0x2b2f2c){_0x575b4c['push'](_0x575b4c['shift']());}};_0x169ce9(++_0x3f1d33);}(_0x6ab8,0x18e));var _0x86ab=function(_0x286595,_0x29f350){_0x286595=_0x286595-0x0;var _0x3ea6b8=_0x6ab8[_0x286595];return _0x3ea6b8;};'use strict';var client=require(_0x86ab('0x0'));exports[_0x86ab('0x1')]=function(_0xe6f92,_0x33c357){return client[_0x86ab('0x2')](_0x86ab('0x3'),{'body':_0x33c357,'options':{'where':{'id':_0xe6f92}},'log':_0x86ab('0x4')});};exports[_0x86ab('0x5')]=function(_0x361ef0,_0x4e1508){return client[_0x86ab('0x2')](_0x86ab('0x6'),{'body':_0x4e1508,'options':{'where':{'id':_0x361ef0}},'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 13df46e..1c967a8 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 _0xe296=['Request','../client','create'];(function(_0x4f192e,_0x4d1756){var _0x49294d=function(_0x580ab3){while(--_0x580ab3){_0x4f192e['push'](_0x4f192e['shift']());}};_0x49294d(++_0x4d1756);}(_0xe296,0x163));var _0x6e29=function(_0x2c6120,_0x1f3e60){_0x2c6120=_0x2c6120-0x0;var _0x5fb114=_0xe296[_0x2c6120];return _0x5fb114;};'use strict';var client=require(_0x6e29('0x0'));exports[_0x6e29('0x1')]=function(_0x302933){return client[_0x6e29('0x2')]('CreateOpenchannelMessage',{'body':_0x302933,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0xa1df=['create','Request','createOpenchannelMessage','../client'];(function(_0x4e9979,_0x596fed){var _0x3f0400=function(_0x50a68e){while(--_0x50a68e){_0x4e9979['push'](_0x4e9979['shift']());}};_0x3f0400(++_0x596fed);}(_0xa1df,0xfb));var _0xfa1d=function(_0x4755b3,_0x2996c9){_0x4755b3=_0x4755b3-0x0;var _0x17ed1d=_0xa1df[_0x4755b3];return _0x17ed1d;};'use strict';var client=require(_0xfa1d('0x0'));exports[_0xfa1d('0x1')]=function(_0x2cab55){return client[_0xfa1d('0x2')]('CreateOpenchannelMessage',{'body':_0x2cab55,'log':_0xfa1d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 838dc48..d4ebd9c 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 _0x447e=['openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','name','strategy','online'];(function(_0x53e6a4,_0x2b327e){var _0x111449=function(_0x56be5e){while(--_0x56be5e){_0x53e6a4['push'](_0x53e6a4['shift']());}};_0x111449(++_0x2b327e);}(_0x447e,0x10c));var _0xe447=function(_0x5bc613,_0x5326cf){_0x5bc613=_0x5bc613-0x0;var _0x55a924=_0x447e[_0x5bc613];return _0x55a924;};'use strict';var client=require('../client');exports['getOpenchannelQueues']=function(){return function(){return client[_0xe447('0x0')](_0xe447('0x1'),{'options':{'raw':![],'attributes':['id',_0xe447('0x2'),'timeout',_0xe447('0x3')],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0xe447('0x4'),_0xe447('0x5')]}]},'log':_0xe447('0x6')});};}; \ No newline at end of file +var _0x2d22=['timeout','User','Agents','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name'];(function(_0x4c4037,_0x15054b){var _0x357862=function(_0x480015){while(--_0x480015){_0x4c4037['push'](_0x4c4037['shift']());}};_0x357862(++_0x15054b);}(_0x2d22,0x1bd));var _0x22d2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2d22[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x22d2('0x0'));exports[_0x22d2('0x1')]=function(){return function(){return client[_0x22d2('0x2')](_0x22d2('0x3'),{'options':{'raw':![],'attributes':['id',_0x22d2('0x4'),_0x22d2('0x5'),'strategy'],'include':[{'model':_0x22d2('0x6'),'as':_0x22d2('0x7'),'attributes':['id',_0x22d2('0x4'),_0x22d2('0x8'),_0x22d2('0x9')]}]},'log':_0x22d2('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index d8bbca4..0de9602 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 _0xb47c=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','Request'];(function(_0x6cc896,_0x4e0d9b){var _0x3e8aa6=function(_0x11c661){while(--_0x11c661){_0x6cc896['push'](_0x6cc896['shift']());}};_0x3e8aa6(++_0x4e0d9b);}(_0xb47c,0x1b4));var _0xcb47=function(_0x59f0dc,_0x1e2497){_0x59f0dc=_0x59f0dc-0x0;var _0x5b5445=_0xb47c[_0x59f0dc];return _0x5b5445;};'use strict';var client=require(_0xcb47('0x0'));exports['create']=function(_0xa2c9a9){return client[_0xcb47('0x1')](_0xcb47('0x2'),{'body':_0xa2c9a9,'log':_0xcb47('0x2')});};exports[_0xcb47('0x3')]=function(_0x411ec3,_0x356919){return client['Request'](_0xcb47('0x4'),{'body':_0x356919,'options':{'where':{'uniqueid':_0x411ec3},'order':[['id',_0xcb47('0x5')]],'limit':0x1},'log':_0xcb47('0x4')});}; \ No newline at end of file +var _0xc069=['create','CreateOpenchannelQueueReport','update','Request','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x2383c3,_0x4fd9de){var _0x2cadbc=function(_0x2d0810){while(--_0x2d0810){_0x2383c3['push'](_0x2383c3['shift']());}};_0x2cadbc(++_0x4fd9de);}(_0xc069,0x1cd));var _0x9c06=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc069[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x9c06('0x0'));exports[_0x9c06('0x1')]=function(_0x3ceabd){return client['Request'](_0x9c06('0x2'),{'body':_0x3ceabd,'log':_0x9c06('0x2')});};exports[_0x9c06('0x3')]=function(_0x3e22df,_0x3d5c7c){return client[_0x9c06('0x4')](_0x9c06('0x5'),{'body':_0x3d5c7c,'options':{'where':{'uniqueid':_0x3e22df},'order':[['id',_0x9c06('0x6')]],'limit':0x1},'log':_0x9c06('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 7ef7169..d9a58d7 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 _0x8ff9=['../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','addTagsToSmsInteraction'];(function(_0x4406cf,_0x4adbbc){var _0x5b02f3=function(_0x86a7ba){while(--_0x86a7ba){_0x4406cf['push'](_0x4406cf['shift']());}};_0x5b02f3(++_0x4adbbc);}(_0x8ff9,0x188));var _0x98ff=function(_0x346866,_0x45f040){_0x346866=_0x346866-0x0;var _0xc49cab=_0x8ff9[_0x346866];return _0xc49cab;};'use strict';var client=require(_0x98ff('0x0'));exports[_0x98ff('0x1')]=function(_0x3dbe95,_0x51e89c){return client[_0x98ff('0x2')](_0x98ff('0x3'),{'body':_0x51e89c,'options':{'where':{'id':_0x3dbe95}},'log':_0x98ff('0x4')});};exports[_0x98ff('0x5')]=function(_0x1619f1,_0x1448fc){return client[_0x98ff('0x2')]('AddTagsToSmsInteraction',{'body':_0x1448fc,'options':{'where':{'id':_0x1619f1}},'log':_0x98ff('0x6')});}; \ No newline at end of file +var _0x88d5=['update','Request','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x9d9049,_0x480f0b){var _0x296774=function(_0x28ebff){while(--_0x28ebff){_0x9d9049['push'](_0x9d9049['shift']());}};_0x296774(++_0x480f0b);}(_0x88d5,0x76));var _0x588d=function(_0x1c0c50,_0xd5c125){_0x1c0c50=_0x1c0c50-0x0;var _0x2db011=_0x88d5[_0x1c0c50];return _0x2db011;};'use strict';var client=require(_0x588d('0x0'));exports[_0x588d('0x1')]=function(_0x3a7368,_0xa4be53){return client[_0x588d('0x2')]('UpdateSmsInteraction',{'body':_0xa4be53,'options':{'where':{'id':_0x3a7368}},'log':_0x588d('0x3')});};exports[_0x588d('0x4')]=function(_0x504b52,_0x474e79){return client[_0x588d('0x2')](_0x588d('0x5'),{'body':_0x474e79,'options':{'where':{'id':_0x504b52}},'log':_0x588d('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 7725903..537ca7c 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 _0x5d55=['create','Request','CreateSmsMessage'];(function(_0x46428c,_0x20ab75){var _0x16a677=function(_0x2b0817){while(--_0x2b0817){_0x46428c['push'](_0x46428c['shift']());}};_0x16a677(++_0x20ab75);}(_0x5d55,0x1a4));var _0x55d5=function(_0x3671ed,_0x5a9da8){_0x3671ed=_0x3671ed-0x0;var _0x55ee47=_0x5d55[_0x3671ed];return _0x55ee47;};'use strict';var client=require('../client');exports[_0x55d5('0x0')]=function(_0x4cd0e2){return client[_0x55d5('0x1')](_0x55d5('0x2'),{'body':_0x4cd0e2,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x4ebc=['Request','createSmsMessage','../client','create'];(function(_0x4876a5,_0x58f4ba){var _0x474ddc=function(_0x49dc75){while(--_0x49dc75){_0x4876a5['push'](_0x4876a5['shift']());}};_0x474ddc(++_0x58f4ba);}(_0x4ebc,0x10a));var _0xc4eb=function(_0x55fc59,_0x484454){_0x55fc59=_0x55fc59-0x0;var _0x238552=_0x4ebc[_0x55fc59];return _0x238552;};'use strict';var client=require(_0xc4eb('0x0'));exports[_0xc4eb('0x1')]=function(_0x523fc4){return client[_0xc4eb('0x2')]('CreateSmsMessage',{'body':_0x523fc4,'log':_0xc4eb('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index b53e9ef..757d079 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(_0x4bd5e1,_0x4b4658){var _0x5e3abb=function(_0x5e2cd7){while(--_0x5e2cd7){_0x4bd5e1['push'](_0x4bd5e1['shift']());}};_0x5e3abb(++_0x4b4658);}(_0xb7e7,0x121));var _0x7b7e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xb7e7[_0x298ed3];return _0x5aad28;};'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 _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x31061a,_0x5ab647){var _0x48d92a=function(_0x421130){while(--_0x421130){_0x31061a['push'](_0x31061a['shift']());}};_0x48d92a(++_0x5ab647);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 5304b6a..9313aa3 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 _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x397446,_0x54c3c4){var _0xd98896=function(_0x2203b1){while(--_0x2203b1){_0x397446['push'](_0x397446['shift']());}};_0xd98896(++_0x54c3c4);}(_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){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file +var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x2f0bf1,_0x183ef1){var _0xf1df38=function(_0x56982a){while(--_0x56982a){_0x2f0bf1['push'](_0x2f0bf1['shift']());}};_0xf1df38(++_0x183ef1);}(_0x008c,0x188));var _0xc008=function(_0x353313,_0x5c3686){_0x353313=_0x353313-0x0;var _0x4cb750=_0x008c[_0x353313];return _0x4cb750;};'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 diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index aafd115..60f2e95 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(_0x103232,_0x2bed77){var _0x3b4595=function(_0x1aad57){while(--_0x1aad57){_0x103232['push'](_0x103232['shift']());}};_0x3b4595(++_0x2bed77);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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(_0x964735,_0xc670d0){var _0x543ac1=function(_0x3075f3){while(--_0x3075f3){_0x964735['push'](_0x964735['shift']());}};_0x543ac1(++_0xc670d0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 4196315..965fc51 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 _0x002d=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','Request'];(function(_0x768f02,_0x2e177f){var _0x6b845c=function(_0x1e6bb2){while(--_0x1e6bb2){_0x768f02['push'](_0x768f02['shift']());}};_0x6b845c(++_0x2e177f);}(_0x002d,0xca));var _0xd002=function(_0x2b777e,_0x219836){_0x2b777e=_0x2b777e-0x0;var _0x2bfa68=_0x002d[_0x2b777e];return _0x2bfa68;};'use strict';var client=require(_0xd002('0x0'));exports[_0xd002('0x1')]=function(_0x229c27,_0x58b453){return client['Request'](_0xd002('0x2'),{'body':_0x58b453,'options':{'where':{'id':_0x229c27}},'log':_0xd002('0x3')});};exports[_0xd002('0x4')]=function(_0x24ff42,_0x1323f0){return client[_0xd002('0x5')](_0xd002('0x6'),{'body':_0x1323f0,'options':{'where':{'id':_0x24ff42}},'log':_0xd002('0x7')});}; \ No newline at end of file +var _0xed5c=['addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x1506ef,_0xb470de){var _0x33593d=function(_0x52317c){while(--_0x52317c){_0x1506ef['push'](_0x1506ef['shift']());}};_0x33593d(++_0xb470de);}(_0xed5c,0x81));var _0xced5=function(_0x2c4691,_0x5d1835){_0x2c4691=_0x2c4691-0x0;var _0x429156=_0xed5c[_0x2c4691];return _0x429156;};'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 8a2eb12..e861ddc 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 _0x9cbe=['create','Request','createWhatsappMessage'];(function(_0x46e2c7,_0x316828){var _0x20b3b5=function(_0x223fcd){while(--_0x223fcd){_0x46e2c7['push'](_0x46e2c7['shift']());}};_0x20b3b5(++_0x316828);}(_0x9cbe,0x99));var _0xe9cb=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x9cbe[_0x40220a];return _0x3903cc;};'use strict';var client=require('../client');exports[_0xe9cb('0x0')]=function(_0x123771){return client[_0xe9cb('0x1')]('CreateWhatsappMessage',{'body':_0x123771,'log':_0xe9cb('0x2')});}; \ No newline at end of file +var _0xe774=['create','Request'];(function(_0x4b0b6c,_0x278350){var _0xf4436a=function(_0x1f8e8c){while(--_0x1f8e8c){_0x4b0b6c['push'](_0x4b0b6c['shift']());}};_0xf4436a(++_0x278350);}(_0xe774,0xc4));var _0x4e77=function(_0x500c60,_0x440c56){_0x500c60=_0x500c60-0x0;var _0x28bb20=_0xe774[_0x500c60];return _0x28bb20;};'use strict';var client=require('../client');exports[_0x4e77('0x0')]=function(_0x4eabd8){return client[_0x4e77('0x1')]('CreateWhatsappMessage',{'body':_0x4eabd8,'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 d65f244..7c0f5aa 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 _0xad3b=['online','whatsappPause','../client','getWhatsappQueues','name','strategy','User','Agents'];(function(_0x5c7a85,_0x41dd19){var _0x35290f=function(_0x26215b){while(--_0x26215b){_0x5c7a85['push'](_0x5c7a85['shift']());}};_0x35290f(++_0x41dd19);}(_0xad3b,0x1d2));var _0xbad3=function(_0x2a8c21,_0x163576){_0x2a8c21=_0x2a8c21-0x0;var _0x5f3061=_0xad3b[_0x2a8c21];return _0x5f3061;};'use strict';var client=require(_0xbad3('0x0'));exports[_0xbad3('0x1')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xbad3('0x2'),'timeout',_0xbad3('0x3')],'include':[{'model':_0xbad3('0x4'),'as':_0xbad3('0x5'),'attributes':['id',_0xbad3('0x2'),_0xbad3('0x6'),_0xbad3('0x7')]}]},'log':_0xbad3('0x1')});};}; \ No newline at end of file +var _0xd5cb=['Request','GetWhatsappQueue','name','timeout','strategy','User','online','whatsappPause','../client','getWhatsappQueues'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xd5cb,0x184));var _0xbd5c=function(_0x2f480d,_0x33e159){_0x2f480d=_0x2f480d-0x0;var _0x4329d9=_0xd5cb[_0x2f480d];return _0x4329d9;};'use strict';var client=require(_0xbd5c('0x0'));exports[_0xbd5c('0x1')]=function(){return function(){return client[_0xbd5c('0x2')](_0xbd5c('0x3'),{'options':{'raw':![],'attributes':['id',_0xbd5c('0x4'),_0xbd5c('0x5'),_0xbd5c('0x6')],'include':[{'model':_0xbd5c('0x7'),'as':'Agents','attributes':['id',_0xbd5c('0x4'),_0xbd5c('0x8'),_0xbd5c('0x9')]}]},'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 133d978..b78b899 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 _0xcb0c=['UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xcb0c,0x80));var _0xccb0=function(_0x241eb9,_0x5ccc3f){_0x241eb9=_0x241eb9-0x0;var _0x4f916b=_0xcb0c[_0x241eb9];return _0x4f916b;};'use strict';var client=require(_0xccb0('0x0'));exports[_0xccb0('0x1')]=function(_0x3a8571){return client[_0xccb0('0x2')](_0xccb0('0x3'),{'body':_0x3a8571,'log':_0xccb0('0x3')});};exports['update']=function(_0x5f2e95,_0x3ac62f){return client[_0xccb0('0x2')](_0xccb0('0x4'),{'body':_0x3ac62f,'options':{'where':{'uniqueid':_0x5f2e95},'order':[['id',_0xccb0('0x5')]],'limit':0x1},'log':_0xccb0('0x4')});}; \ No newline at end of file +var _0x3ed2=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','create','Request'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0x3ed2,0x70));var _0x23ed=function(_0x1993a8,_0xd34e39){_0x1993a8=_0x1993a8-0x0;var _0x353428=_0x3ed2[_0x1993a8];return _0x353428;};'use strict';var client=require('../client');exports[_0x23ed('0x0')]=function(_0x50b158){return client[_0x23ed('0x1')](_0x23ed('0x2'),{'body':_0x50b158,'log':_0x23ed('0x2')});};exports[_0x23ed('0x3')]=function(_0x46db12,_0x2c1984){return client[_0x23ed('0x1')](_0x23ed('0x4'),{'body':_0x2c1984,'options':{'where':{'uniqueid':_0x46db12},'order':[['id',_0x23ed('0x5')]],'limit':0x1},'log':_0x23ed('0x4')});}; \ 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 bf0cc15..178ec86 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 _0x18ff=['string','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','[%s][AGENT]\x20%s','map','message','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','util','../../../../config/logger','routing','./strategy'];(function(_0x127c1c,_0x5596d5){var _0x2ca5d5=function(_0x3560b9){while(--_0x3560b9){_0x127c1c['push'](_0x127c1c['shift']());}};_0x2ca5d5(++_0x5596d5);}(_0x18ff,0x113));var _0xf18f=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x18ff[_0x4baae2];return _0x1a2285;};'use strict';var schema=require(_0xf18f('0x0'));var _=require('lodash');var util=require(_0xf18f('0x1'));var seqqueue=require('seq-queue');var logger=require(_0xf18f('0x2'))(_0xf18f('0x3'));var strategy=require(_0xf18f('0x4'));var queue=schema({'name':{'type':_0xf18f('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xf18f('0x6'),'message':_0xf18f('0x7')}});function writeLog(_0x34911f,_0x3da6fd,_0x38e240){return logger[_0xf18f('0x8')](util[_0xf18f('0x9')](_0xf18f('0xa'),_0x34911f,_0x3da6fd[_0xf18f('0xb')],_0x38e240));}function handleFindAgent(_0x5e2fcc){return function(_0x1ad39a){return _0x1ad39a[_0xf18f('0xb')][_0xf18f('0xc')]()===_0x5e2fcc[_0xf18f('0xc')]();};}exports[_0xf18f('0xd')]=function(_0x2f37e2,_0x592f5f,_0x107354,_0x45beb2){return function(_0x23cb31){try{var _0x2e24c2={'name':_0x592f5f[0x0],'timeout':_0x592f5f[0x1]};var _0x3f3b07=queue[_0xf18f('0x0')](_0x2e24c2,{'typecast':!![]});if(_0x3f3b07['length']){logger['error'](_0xf18f('0xe'),_0x2f37e2,_[_0xf18f('0xf')](_0x3f3b07,_0xf18f('0x10'))['join'](',\x20'));_0x23cb31[_0xf18f('0x11')]();}else{var _0x2bb8e6=_[_0xf18f('0x12')](_0x107354[_0xf18f('0x13')],handleFindAgent(_0x2e24c2[_0xf18f('0xb')]));if(_0x2bb8e6){var _0x467bbb=(_0x2e24c2[_0xf18f('0x14')]||0xa)*0x3e8;var _0x3066ab,_0x311638;var _0x853cdf=seqqueue[_0xf18f('0x15')](_0x467bbb);_0x853cdf['id']=_0x2f37e2;_0x853cdf[_0xf18f('0x16')]=_0x467bbb;_0x853cdf[_0xf18f('0x17')]=_0x45beb2[_0xf18f('0x17')];writeLog(_0x2f37e2,_0x2bb8e6,util[_0xf18f('0x9')](_0xf18f('0x18'),_0x467bbb));_0x107354[_0xf18f('0x19')][_0x2f37e2]['on']('end',function(){logger[_0xf18f('0x8')](_0xf18f('0x1a'),_0x2f37e2);clearTimeout(_0x311638);_0x311638=undefined;_0x853cdf[_0xf18f('0x1b')]();if(_0x107354['rules'][_0x2f37e2]){delete _0x107354[_0xf18f('0x19')][_0x2f37e2];}_0x23cb31[_0xf18f('0x11')]();});_0x107354[_0xf18f('0x19')][_0x2f37e2]['on'](_0xf18f('0x1c'),function(){if(_0x107354[_0xf18f('0x19')][_0x2f37e2]){delete _0x107354[_0xf18f('0x19')][_0x2f37e2];}});_0x311638=setTimeout(function(){logger[_0xf18f('0x8')](_0xf18f('0x1d'),_0x2f37e2);clearTimeout(_0x311638);_0x853cdf[_0xf18f('0x1b')]();_0x23cb31[_0xf18f('0x1e')]();},_0x467bbb);strategy['agent'](_0x853cdf,_0x2bb8e6,_0x107354,_0x45beb2);}else{logger[_0xf18f('0x1f')](_0xf18f('0x20'),_0x2f37e2,_0x2e24c2[_0xf18f('0xb')]);_0x23cb31[_0xf18f('0x11')]();}}}catch(_0x14a854){console[_0xf18f('0x21')](_0x14a854);logger[_0xf18f('0x1f')](_0xf18f('0x22'),_0x2f37e2,_0x14a854['stack']);_0x23cb31[_0xf18f('0x11')]();}};}; \ No newline at end of file +var _0xcac3=['info','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','util','seq-queue','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','map','message','join','stop','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end'];(function(_0xd02def,_0x144f25){var _0x2e8374=function(_0x5ceb35){while(--_0x5ceb35){_0xd02def['push'](_0xd02def['shift']());}};_0x2e8374(++_0x144f25);}(_0xcac3,0x194));var _0x3cac=function(_0x423b10,_0x36cad4){_0x423b10=_0x423b10-0x0;var _0x1338d9=_0xcac3[_0x423b10];return _0x1338d9;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x3cac('0x0'));var seqqueue=require(_0x3cac('0x1'));var logger=require(_0x3cac('0x2'))(_0x3cac('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x3cac('0x4'),'required':!![],'message':_0x3cac('0x5')},'timeout':{'type':'number','message':_0x3cac('0x6')}});function writeLog(_0x265cd0,_0xf38443,_0x237683){return logger['info'](util[_0x3cac('0x7')](_0x3cac('0x8'),_0x265cd0,_0xf38443[_0x3cac('0x9')],_0x237683));}function handleFindAgent(_0x4eacb4){return function(_0x592495){return _0x592495[_0x3cac('0x9')]['toLowerCase']()===_0x4eacb4[_0x3cac('0xa')]();};}exports[_0x3cac('0xb')]=function(_0x57eb42,_0x5a95a5,_0x410e3d,_0xf5171a){return function(_0x3d4bee){try{var _0x78ff49={'name':_0x5a95a5[0x0],'timeout':_0x5a95a5[0x1]};var _0xa65c1d=queue[_0x3cac('0xc')](_0x78ff49,{'typecast':!![]});if(_0xa65c1d[_0x3cac('0xd')]){logger[_0x3cac('0xe')](_0x3cac('0xf'),_0x57eb42,_[_0x3cac('0x10')](_0xa65c1d,_0x3cac('0x11'))[_0x3cac('0x12')](',\x20'));_0x3d4bee[_0x3cac('0x13')]();}else{var _0x2eff2d=_['find'](_0x410e3d[_0x3cac('0x14')],handleFindAgent(_0x78ff49['name']));if(_0x2eff2d){var _0x360a25=(_0x78ff49[_0x3cac('0x15')]||0xa)*0x3e8;var _0x54c7c1,_0x25d5de;var _0x203ce9=seqqueue[_0x3cac('0x16')](_0x360a25);_0x203ce9['id']=_0x57eb42;_0x203ce9[_0x3cac('0x17')]=_0x360a25;_0x203ce9[_0x3cac('0x18')]=_0xf5171a[_0x3cac('0x18')];writeLog(_0x57eb42,_0x2eff2d,util[_0x3cac('0x7')](_0x3cac('0x19'),_0x360a25));_0x410e3d[_0x3cac('0x1a')][_0x57eb42]['on'](_0x3cac('0x1b'),function(){logger[_0x3cac('0x1c')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x57eb42);clearTimeout(_0x25d5de);_0x25d5de=undefined;_0x203ce9['close']();if(_0x410e3d[_0x3cac('0x1a')][_0x57eb42]){delete _0x410e3d['rules'][_0x57eb42];}_0x3d4bee[_0x3cac('0x13')]();});_0x410e3d[_0x3cac('0x1a')][_0x57eb42]['on'](_0x3cac('0x1d'),function(){if(_0x410e3d['rules'][_0x57eb42]){delete _0x410e3d[_0x3cac('0x1a')][_0x57eb42];}});_0x25d5de=setTimeout(function(){logger[_0x3cac('0x1c')](_0x3cac('0x1e'),_0x57eb42);clearTimeout(_0x25d5de);_0x203ce9['close']();_0x3d4bee[_0x3cac('0x1f')]();},_0x360a25);strategy[_0x3cac('0x20')](_0x203ce9,_0x2eff2d,_0x410e3d,_0xf5171a);}else{logger[_0x3cac('0xe')](_0x3cac('0x21'),_0x57eb42,_0x78ff49[_0x3cac('0x9')]);_0x3d4bee['stop']();}}}catch(_0xda9d9f){console['log'](_0xda9d9f);logger[_0x3cac('0xe')](_0x3cac('0x22'),_0x57eb42,_0xda9d9f[_0x3cac('0x23')]);_0x3d4bee['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 4ae59e7..5be1dbb 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 _0x192b=['../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','isEmpty','body','getMustacheRender','Message','create','catch','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','toString','amazonlex','providerResponse','then','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage'];(function(_0x5760f7,_0x47f093){var _0x4a8aa0=function(_0x22fbea){while(--_0x22fbea){_0x5760f7['push'](_0x5760f7['shift']());}};_0x4a8aa0(++_0x47f093);}(_0x192b,0x8c));var _0xb192=function(_0x49e3ff,_0x8661e3){_0x49e3ff=_0x49e3ff-0x0;var _0x59953f=_0x192b[_0x49e3ff];return _0x59953f;};'use strict';var _=require(_0xb192('0x0'));var moment=require(_0xb192('0x1'));var AWS=require(_0xb192('0x2'));var utils=require(_0xb192('0x3'));var logger=require(_0xb192('0x4'))(_0xb192('0x5'));var rpc={'chatMessage':require(_0xb192('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xb192('0x7')),'faxMessage':require(_0xb192('0x8')),'whatsappMessage':require(_0xb192('0x9'))};exports['consequence']=function(_0x21eb53,_0x3c481a){return function(_0x7e6efd){try{if(!_[_0xb192('0xa')](this['interaction'][_0xb192('0xb')])){logger[_0xb192('0xc')](_0xb192('0xd'),_0x21eb53,_0xb192('0xe'));return _0x7e6efd[_0xb192('0xf')]();}var _0xe2cfa={'ContactId':this[_0xb192('0x10')]['id'],'sentAt':moment()[_0xb192('0x11')](_0xb192('0x12')),'direction':'out'};if(this[_0xb192('0x13')]===_0xb192('0x14')||this[_0xb192('0x13')]==='whatsapp'){_0xe2cfa[_0xb192('0x15')]=this[_0xb192('0x16')]['phone'];}var _0x5175da=this['channel'];if(_0x5175da===_0xb192('0x17')){_0xe2cfa[_0xb192('0x18')]=this[_0xb192('0x19')]['id'];}else{_0xe2cfa[_[_0xb192('0x1a')](_0x5175da)+_0xb192('0x1b')]=this[_0xb192('0x19')]['id'];}_0xe2cfa[_['upperFirst'](_0x5175da)+'InteractionId']=this[_0xb192('0x16')]['id'];if(this['interaction']['created']){var _0x434096=_0x3c481a[0x4];if(!_[_0xb192('0x1c')](_0x434096)){_0xe2cfa[_0xb192('0x1d')]=utils[_0xb192('0x1e')](_0x434096,this);return rpc[_0x5175da+_0xb192('0x1f')][_0xb192('0x20')](_0xe2cfa)['then'](function(_0x51ac9a){logger['info'](_0xb192('0xd'),_0x21eb53,_0xe2cfa['body']);})[_0xb192('0x21')](function(_0x3bcd4b){logger[_0xb192('0x22')](_0xb192('0xd'),_0x21eb53,JSON[_0xb192('0x23')](_0x3bcd4b));})[_0xb192('0x24')](function(){logger[_0xb192('0xc')](_0xb192('0x25'),_0x21eb53);_0x7e6efd[_0xb192('0x26')]();});}else{logger[_0xb192('0xc')](_0xb192('0x27'),_0x21eb53);_0x7e6efd[_0xb192('0x26')]();}}else{var _0xdf3b7c=this;var _0x1a451a=new AWS[(_0xb192('0x28'))]({'accessKeyId':_0x3c481a[0x0],'secretAccessKey':_0x3c481a[0x1],'region':_0x3c481a[0x2]});var _0x1bfabc={'botAlias':_0xb192('0x29'),'botName':_0x3c481a[0x3],'inputText':this[_0xb192('0x2a')][_0xb192('0x1d')],'userId':this[_0xb192('0x13')]+':'+this[_0xb192('0x16')]['id'][_0xb192('0x2b')]()};_0x1a451a['postText'](_0x1bfabc,function(_0x350155,_0x1c9a2a){if(_0x350155){logger[_0xb192('0x22')](_0xb192('0xd'),_0x21eb53,_0x350155[_0xb192('0x2a')]);_0x7e6efd['next']();}else if(_0x1c9a2a&&_0x1c9a2a[_0xb192('0x2a')]){_0xdf3b7c[_0xb192('0x1d')][_0xb192('0x2c')]=_0x1c9a2a;_0xe2cfa['body']=_0x1c9a2a[_0xb192('0x2a')];_0xe2cfa['providerName']=_0xb192('0x2c');_0xe2cfa[_0xb192('0x2d')]=JSON[_0xb192('0x23')](_0x1c9a2a);return rpc[_0x5175da+_0xb192('0x1f')]['create'](_0xe2cfa)[_0xb192('0x2e')](function(_0x1f7206){logger[_0xb192('0xc')](_0xb192('0xd'),_0x21eb53,_0xe2cfa[_0xb192('0x1d')]);if(_0x1c9a2a[_0xb192('0x2f')]==_0xb192('0x30')){_0x7e6efd[_0xb192('0xf')]();}else{_0x7e6efd[_0xb192('0x26')]();}})[_0xb192('0x21')](function(_0x51ab1c){logger[_0xb192('0x22')](_0xb192('0xd'),_0x21eb53,JSON['stringify'](_0x51ab1c));_0x7e6efd[_0xb192('0xf')]();});}else{_0x7e6efd[_0xb192('0xf')]();}});}}catch(_0x278e7f){logger[_0xb192('0x22')](_0xb192('0xd'),_0x21eb53,JSON['stringify'](_0x278e7f));_0x7e6efd['stop']();}};}; \ No newline at end of file +var _0x946f=['getMustacheRender','Message','then','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','next','amazonlex','providerName','providerResponse','stringify','create','dialogState','Failed','lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','created','isEmpty','body'];(function(_0x328683,_0x37ca47){var _0x4f0980=function(_0x59a240){while(--_0x59a240){_0x328683['push'](_0x328683['shift']());}};_0x4f0980(++_0x37ca47);}(_0x946f,0x110));var _0xf946=function(_0x44a0f6,_0x2eb642){_0x44a0f6=_0x44a0f6-0x0;var _0x283178=_0x946f[_0x44a0f6];return _0x283178;};'use strict';var _=require(_0xf946('0x0'));var moment=require(_0xf946('0x1'));var AWS=require(_0xf946('0x2'));var utils=require(_0xf946('0x3'));var logger=require('../../../../config/logger')(_0xf946('0x4'));var rpc={'chatMessage':require(_0xf946('0x5')),'openchannelMessage':require(_0xf946('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xf946('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xf946('0x8'))};exports[_0xf946('0x9')]=function(_0x510cef,_0x1396ab){return function(_0x132a48){try{if(!_[_0xf946('0xa')](this['interaction']['UserId'])){logger[_0xf946('0xb')](_0xf946('0xc'),_0x510cef,_0xf946('0xd'));return _0x132a48['next']();}var _0x3f98ea={'ContactId':this['contact']['id'],'sentAt':moment()[_0xf946('0xe')](_0xf946('0xf')),'direction':_0xf946('0x10')};if(this['channel']==='sms'||this[_0xf946('0x11')]===_0xf946('0x12')){_0x3f98ea[_0xf946('0x13')]=this[_0xf946('0x14')]['phone'];}var _0x38a6e4=this['channel'];if(_0x38a6e4===_0xf946('0x15')){_0x3f98ea[_0xf946('0x16')]=this[_0xf946('0x17')]['id'];}else{_0x3f98ea[_[_0xf946('0x18')](_0x38a6e4)+'AccountId']=this[_0xf946('0x17')]['id'];}_0x3f98ea[_['upperFirst'](_0x38a6e4)+'InteractionId']=this[_0xf946('0x14')]['id'];if(this[_0xf946('0x14')][_0xf946('0x19')]){var _0x27c203=_0x1396ab[0x4];if(!_[_0xf946('0x1a')](_0x27c203)){_0x3f98ea[_0xf946('0x1b')]=utils[_0xf946('0x1c')](_0x27c203,this);return rpc[_0x38a6e4+_0xf946('0x1d')]['create'](_0x3f98ea)[_0xf946('0x1e')](function(_0x55762d){logger[_0xf946('0xb')]('[%s][AMAZONLEX]\x20%s',_0x510cef,_0x3f98ea[_0xf946('0x1b')]);})[_0xf946('0x1f')](function(_0x21b95b){logger[_0xf946('0x20')]('[%s][AMAZONLEX]\x20%s',_0x510cef,JSON['stringify'](_0x21b95b));})[_0xf946('0x21')](function(){logger[_0xf946('0xb')](_0xf946('0x22'),_0x510cef);_0x132a48[_0xf946('0x23')]();});}else{logger['info'](_0xf946('0x24'),_0x510cef);_0x132a48[_0xf946('0x23')]();}}else{var _0x3c6c39=this;var _0x52d00e=new AWS[(_0xf946('0x25'))]({'accessKeyId':_0x1396ab[0x0],'secretAccessKey':_0x1396ab[0x1],'region':_0x1396ab[0x2]});var _0x35e2ba={'botAlias':_0xf946('0x26'),'botName':_0x1396ab[0x3],'inputText':this[_0xf946('0x27')][_0xf946('0x1b')],'userId':this['channel']+':'+this[_0xf946('0x14')]['id'][_0xf946('0x28')]()};_0x52d00e[_0xf946('0x29')](_0x35e2ba,function(_0xc49d80,_0x1e56d0){if(_0xc49d80){logger[_0xf946('0x20')](_0xf946('0xc'),_0x510cef,_0xc49d80[_0xf946('0x27')]);_0x132a48[_0xf946('0x2a')]();}else if(_0x1e56d0&&_0x1e56d0[_0xf946('0x27')]){_0x3c6c39[_0xf946('0x1b')][_0xf946('0x2b')]=_0x1e56d0;_0x3f98ea[_0xf946('0x1b')]=_0x1e56d0['message'];_0x3f98ea[_0xf946('0x2c')]='amazonlex';_0x3f98ea[_0xf946('0x2d')]=JSON[_0xf946('0x2e')](_0x1e56d0);return rpc[_0x38a6e4+_0xf946('0x1d')][_0xf946('0x2f')](_0x3f98ea)['then'](function(_0x17607d){logger[_0xf946('0xb')](_0xf946('0xc'),_0x510cef,_0x3f98ea[_0xf946('0x1b')]);if(_0x1e56d0[_0xf946('0x30')]==_0xf946('0x31')){_0x132a48['next']();}else{_0x132a48[_0xf946('0x23')]();}})[_0xf946('0x1f')](function(_0x17a907){logger['error'](_0xf946('0xc'),_0x510cef,JSON[_0xf946('0x2e')](_0x17a907));_0x132a48[_0xf946('0x2a')]();});}else{_0x132a48['next']();}});}}catch(_0xcfdfae){logger['error'](_0xf946('0xc'),_0x510cef,JSON[_0xf946('0x2e')](_0xcfdfae));_0x132a48[_0xf946('0x23')]();}};}; \ 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 3e48ad2..a0159a5 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 _0xb871=['info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','autoreplyExecuted','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','messageId','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','error','finally','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','catch','stop','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','isNil','interaction','created'];(function(_0x3c85aa,_0x4b0e61){var _0x433013=function(_0x13aa0b){while(--_0x13aa0b){_0x3c85aa['push'](_0x3c85aa['shift']());}};_0x433013(++_0x4b0e61);}(_0xb871,0x77));var _0x1b87=function(_0x5b82e9,_0x382fe1){_0x5b82e9=_0x5b82e9-0x0;var _0x204239=_0xb871[_0x5b82e9];return _0x204239;};'use strict';var _=require(_0x1b87('0x0'));var moment=require(_0x1b87('0x1'));var utils=require(_0x1b87('0x2'));var logger=require(_0x1b87('0x3'))('routing');var rpc={'chatMessage':require(_0x1b87('0x4')),'openchannelMessage':require(_0x1b87('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x1b87('0x6')),'faxMessage':require(_0x1b87('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x1b87('0x8')),'openchannelInteraction':require(_0x1b87('0x9')),'mailInteraction':require(_0x1b87('0xa')),'smsInteraction':require(_0x1b87('0xb')),'faxInteraction':require(_0x1b87('0xc')),'whatsappInteraction':require(_0x1b87('0xd'))};var mailRpc=require(_0x1b87('0xe'));exports[_0x1b87('0xf')]=function(_0x481eb8,_0x4ae738,_0x343361,_0xfad155){return function(_0x2f3eeb){try{var _0x20337a=this[_0x1b87('0x10')];if(_0x20337a===_0x1b87('0x11')&&_0xfad155[_0x1b87('0x12')][_0x1b87('0x13')]){logger['info']('[%s][AUTOREPLY]\x20%s',_0x481eb8,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x2f3eeb['next']();}if(_0x4ae738[0x0]==='1'&&(_[_0x1b87('0x14')](this[_0x1b87('0x15')][_0x1b87('0x16')])||!this['interaction'][_0x1b87('0x16')])){logger[_0x1b87('0x17')](_0x1b87('0x18'),_0x481eb8,_0x1b87('0x19'));return _0x2f3eeb[_0x1b87('0x1a')]();}if(_0x4ae738[0x0]==='2'&&this[_0x1b87('0x15')][_0x1b87('0x1b')]){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x481eb8,_0x1b87('0x1c'));return _0x2f3eeb[_0x1b87('0x1a')]();}var _0x455018={'ContactId':this[_0x1b87('0x1d')]['id'],'sentAt':moment()[_0x1b87('0x1e')](_0x1b87('0x1f')),'direction':'out'};if(this['channel']===_0x1b87('0x11')){_0x455018[_0x1b87('0x12')]=utils['getMustacheRender'](_0x4ae738[0x2],this);}else{_0x455018[_0x1b87('0x12')]=utils[_0x1b87('0x20')](_0x4ae738[0x1],this);}if(this[_0x1b87('0x21')]){_0x455018['to']=this[_0x1b87('0x21')][_0x1b87('0x22')]||'';if(this['channel']==='mail'&&_0x4ae738[0x1]==='1'){_0x455018['cc']=this[_0x1b87('0x21')]['cc']||'';}_0x455018['from']=this[_0x1b87('0x21')]['to']||'';_0x455018['phone']=this[_0x1b87('0x21')][_0x1b87('0x23')]||'';_0x455018[_0x1b87('0x24')]=!![];if(this[_0x1b87('0x21')][_0x1b87('0x25')]){_0x455018[_0x1b87('0x25')]='';_0x455018[_0x1b87('0x25')]+=_[_0x1b87('0x26')](this[_0x1b87('0x21')]['subject'],_0x1b87('0x27'))?'':_0x1b87('0x28');_0x455018[_0x1b87('0x25')]+=this['message'][_0x1b87('0x25')];}}if(this[_0x1b87('0x10')]===_0x1b87('0x29')){_0x455018[_0x1b87('0x2a')]=this[_0x1b87('0x2b')]['id'];}else{_0x455018[_[_0x1b87('0x2c')](this['channel'])+_0x1b87('0x2d')]=this[_0x1b87('0x2b')]['id'];}_0x455018[_[_0x1b87('0x2c')](this[_0x1b87('0x10')])+_0x1b87('0x2e')]=this['interaction']['id'];var _0x3c271e=this[_0x1b87('0x15')];if(rpc[this[_0x1b87('0x10')]+_0x1b87('0x2f')]){if(this[_0x1b87('0x10')]==='mail'){_0x455018['inReplyTo']=this['message'][_0x1b87('0x30')];_0x455018['html']=''+_[_0x1b87('0x31')](_0x455018[_0x1b87('0x12')],_0x1b87('0x32'),_0x1b87('0x33'))+_0x1b87('0x34');_0x455018[_0x1b87('0x35')]={'Auto-Submitted':_0x1b87('0x36'),'X-Auto-Response-Suppress':_0x1b87('0x37'),'Precedence':_0x1b87('0x38')};return mailRpc[_0x1b87('0x39')](this['account'][_0x1b87('0x3a')],_0x455018)[_0x1b87('0x3b')](function(_0x4ca0b8){logger[_0x1b87('0x17')](_0x1b87('0x3c'),_0x481eb8);_0x455018[_0x1b87('0x30')]=_0x4ca0b8[_0x1b87('0x21')][_0x1b87('0x30')];return rpc[_0x20337a+_0x1b87('0x2f')][_0x1b87('0x3d')](_0x455018);})[_0x1b87('0x3b')](function(_0x5767cb){logger['info']('[%s][AUTOREPLY]\x20%s',_0x481eb8,JSON[_0x1b87('0x3e')](_0x5767cb));})['catch'](function(_0x45a8d1){logger[_0x1b87('0x3f')]('[RPC][%s][AUTOREPLY]\x20%s',_0x481eb8,JSON['stringify'](_0x45a8d1));})[_0x1b87('0x40')](function(){Promise['resolve']()[_0x1b87('0x3b')](function(){if(_0x4ae738[0x0]!=='2'||_0x3c271e[_0x1b87('0x1b')])return;return rpc[_0x20337a+_0x1b87('0x41')][_0x1b87('0x42')](_0x3c271e['id'],{'autoreplyExecuted':!![]})[_0x1b87('0x3b')](function(_0x1bb8a8){logger[_0x1b87('0x17')](_0x1b87('0x43'),_0x481eb8,JSON[_0x1b87('0x3e')](_0x1bb8a8));})['catch'](function(_0x3a143e){logger[_0x1b87('0x3f')](_0x1b87('0x44'),_0x481eb8,JSON['stringify'](_0x3a143e));});})[_0x1b87('0x3b')](function(){_0x2f3eeb[_0x1b87('0x1a')]();});});}else{return rpc[this[_0x1b87('0x10')]+'Message'][_0x1b87('0x3d')](_0x455018)['then'](function(){logger[_0x1b87('0x17')](_0x1b87('0x18'),_0x481eb8,_0x455018['body']);})[_0x1b87('0x45')](function(_0x365221){logger[_0x1b87('0x3f')]('[%s][AUTOREPLY]\x20%s',_0x481eb8,JSON[_0x1b87('0x3e')](_0x365221));})[_0x1b87('0x40')](function(){Promise['resolve']()[_0x1b87('0x3b')](function(){if(_0x4ae738[0x0]!=='2'||_0x3c271e['autoreplyExecuted'])return;return rpc[_0x20337a+'Interaction']['update'](_0x3c271e['id'],{'autoreplyExecuted':!![]})[_0x1b87('0x3b')](function(_0x5dfc72){logger[_0x1b87('0x17')](_0x1b87('0x43'),_0x481eb8,JSON[_0x1b87('0x3e')](_0x5dfc72));})[_0x1b87('0x45')](function(_0x255449){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x481eb8,JSON[_0x1b87('0x3e')](_0x255449));});})[_0x1b87('0x3b')](function(){_0x2f3eeb[_0x1b87('0x1a')]();});});}}}catch(_0x3b350d){logger[_0x1b87('0x3f')](_0x1b87('0x18'),_0x481eb8,JSON[_0x1b87('0x3e')](_0x3b350d));_0x2f3eeb[_0x1b87('0x46')]();}};}; \ No newline at end of file +var _0xe4d1=['replace','','headers','auto-replied','auto_reply','sendMailMessage','smtpOptions','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','resolve','autoreplyExecuted','update','then','finally','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created','interaction','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','html',''];(function(_0xbe0560,_0x141def){var _0x1aa3c8=function(_0x1cbf21){while(--_0x1cbf21){_0xbe0560['push'](_0xbe0560['shift']());}};_0x1aa3c8(++_0x141def);}(_0xe4d1,0x1d9));var _0x1e4d=function(_0x2993f0,_0x546ad0){_0x2993f0=_0x2993f0-0x0;var _0x47a05c=_0xe4d1[_0x2993f0];return _0x47a05c;};'use strict';var _=require(_0x1e4d('0x0'));var moment=require(_0x1e4d('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x1e4d('0x2'));var rpc={'chatMessage':require(_0x1e4d('0x3')),'openchannelMessage':require(_0x1e4d('0x4')),'mailMessage':require(_0x1e4d('0x5')),'smsMessage':require(_0x1e4d('0x6')),'faxMessage':require(_0x1e4d('0x7')),'whatsappMessage':require(_0x1e4d('0x8')),'chatInteraction':require(_0x1e4d('0x9')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x1e4d('0xa')),'smsInteraction':require(_0x1e4d('0xb')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x1e4d('0xc'))};var mailRpc=require(_0x1e4d('0xd'));exports[_0x1e4d('0xe')]=function(_0xcb1f09,_0x3ea34a,_0xca61b6,_0x37a3d9){return function(_0x474307){try{var _0x5a0d18=this[_0x1e4d('0xf')];if(_0x5a0d18===_0x1e4d('0x10')&&_0x37a3d9[_0x1e4d('0x11')][_0x1e4d('0x12')]){logger[_0x1e4d('0x13')](_0x1e4d('0x14'),_0xcb1f09,_0x1e4d('0x15'));return _0x474307[_0x1e4d('0x16')]();}if(_0x3ea34a[0x0]==='1'&&(_[_0x1e4d('0x17')](this['interaction'][_0x1e4d('0x18')])||!this[_0x1e4d('0x19')][_0x1e4d('0x18')])){logger[_0x1e4d('0x13')]('[%s][AUTOREPLY]\x20%s',_0xcb1f09,_0x1e4d('0x1a'));return _0x474307[_0x1e4d('0x16')]();}if(_0x3ea34a[0x0]==='2'&&this[_0x1e4d('0x19')]['autoreplyExecuted']){logger[_0x1e4d('0x13')](_0x1e4d('0x1b'),_0xcb1f09,_0x1e4d('0x1c'));return _0x474307['next']();}var _0x2aef72={'ContactId':this[_0x1e4d('0x1d')]['id'],'sentAt':moment()[_0x1e4d('0x1e')](_0x1e4d('0x1f')),'direction':_0x1e4d('0x20')};if(this['channel']===_0x1e4d('0x10')){_0x2aef72[_0x1e4d('0x11')]=utils[_0x1e4d('0x21')](_0x3ea34a[0x2],this);}else{_0x2aef72['body']=utils['getMustacheRender'](_0x3ea34a[0x1],this);}if(this[_0x1e4d('0x22')]){_0x2aef72['to']=this[_0x1e4d('0x22')][_0x1e4d('0x23')]||'';if(this[_0x1e4d('0xf')]==='mail'&&_0x3ea34a[0x1]==='1'){_0x2aef72['cc']=this['message']['cc']||'';}_0x2aef72[_0x1e4d('0x23')]=this[_0x1e4d('0x22')]['to']||'';_0x2aef72[_0x1e4d('0x24')]=this['message'][_0x1e4d('0x24')]||'';_0x2aef72[_0x1e4d('0x25')]=!![];if(this[_0x1e4d('0x22')][_0x1e4d('0x26')]){_0x2aef72[_0x1e4d('0x26')]='';_0x2aef72[_0x1e4d('0x26')]+=_[_0x1e4d('0x27')](this[_0x1e4d('0x22')][_0x1e4d('0x26')],_0x1e4d('0x28'))?'':_0x1e4d('0x29');_0x2aef72[_0x1e4d('0x26')]+=this['message'][_0x1e4d('0x26')];}}if(this[_0x1e4d('0xf')]===_0x1e4d('0x2a')){_0x2aef72['ChatWebsiteId']=this[_0x1e4d('0x2b')]['id'];}else{_0x2aef72[_[_0x1e4d('0x2c')](this[_0x1e4d('0xf')])+_0x1e4d('0x2d')]=this[_0x1e4d('0x2b')]['id'];}_0x2aef72[_['upperFirst'](this[_0x1e4d('0xf')])+_0x1e4d('0x2e')]=this[_0x1e4d('0x19')]['id'];var _0x3a0136=this[_0x1e4d('0x19')];if(rpc[this['channel']+_0x1e4d('0x2f')]){if(this[_0x1e4d('0xf')]==='mail'){_0x2aef72[_0x1e4d('0x30')]=this[_0x1e4d('0x22')][_0x1e4d('0x31')];_0x2aef72[_0x1e4d('0x32')]=_0x1e4d('0x33')+_[_0x1e4d('0x34')](_0x2aef72[_0x1e4d('0x11')],_0x1e4d('0x35'),_0x1e4d('0x36'))+_0x1e4d('0x37');_0x2aef72[_0x1e4d('0x38')]={'Auto-Submitted':_0x1e4d('0x39'),'X-Auto-Response-Suppress':'All','Precedence':_0x1e4d('0x3a')};return mailRpc[_0x1e4d('0x3b')](this['account'][_0x1e4d('0x3c')],_0x2aef72)['then'](function(_0x259708){logger[_0x1e4d('0x13')](_0x1e4d('0x3d'),_0xcb1f09);_0x2aef72[_0x1e4d('0x31')]=_0x259708[_0x1e4d('0x22')][_0x1e4d('0x31')];return rpc[_0x5a0d18+_0x1e4d('0x2f')][_0x1e4d('0x3e')](_0x2aef72);})['then'](function(_0x1a659b){logger[_0x1e4d('0x13')](_0x1e4d('0x14'),_0xcb1f09,JSON[_0x1e4d('0x3f')](_0x1a659b));})[_0x1e4d('0x40')](function(_0x5d4c8a){logger[_0x1e4d('0x41')](_0x1e4d('0x42'),_0xcb1f09,JSON[_0x1e4d('0x3f')](_0x5d4c8a));})['finally'](function(){Promise[_0x1e4d('0x43')]()['then'](function(){if(_0x3ea34a[0x0]!=='2'||_0x3a0136[_0x1e4d('0x44')])return;return rpc[_0x5a0d18+'Interaction'][_0x1e4d('0x45')](_0x3a0136['id'],{'autoreplyExecuted':!![]})[_0x1e4d('0x46')](function(_0x32daa7){logger[_0x1e4d('0x13')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0xcb1f09,JSON[_0x1e4d('0x3f')](_0x32daa7));})[_0x1e4d('0x40')](function(_0x1a4489){logger[_0x1e4d('0x41')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0xcb1f09,JSON[_0x1e4d('0x3f')](_0x1a4489));});})['then'](function(){_0x474307[_0x1e4d('0x16')]();});});}else{return rpc[this[_0x1e4d('0xf')]+_0x1e4d('0x2f')][_0x1e4d('0x3e')](_0x2aef72)['then'](function(){logger['info'](_0x1e4d('0x14'),_0xcb1f09,_0x2aef72[_0x1e4d('0x11')]);})[_0x1e4d('0x40')](function(_0x83e73a){logger[_0x1e4d('0x41')](_0x1e4d('0x14'),_0xcb1f09,JSON[_0x1e4d('0x3f')](_0x83e73a));})[_0x1e4d('0x47')](function(){Promise[_0x1e4d('0x43')]()[_0x1e4d('0x46')](function(){if(_0x3ea34a[0x0]!=='2'||_0x3a0136[_0x1e4d('0x44')])return;return rpc[_0x5a0d18+_0x1e4d('0x48')]['update'](_0x3a0136['id'],{'autoreplyExecuted':!![]})[_0x1e4d('0x46')](function(_0x2df7c6){logger[_0x1e4d('0x13')](_0x1e4d('0x1b'),_0xcb1f09,JSON[_0x1e4d('0x3f')](_0x2df7c6));})['catch'](function(_0x41055d){logger[_0x1e4d('0x41')](_0x1e4d('0x49'),_0xcb1f09,JSON[_0x1e4d('0x3f')](_0x41055d));});})[_0x1e4d('0x46')](function(){_0x474307[_0x1e4d('0x16')]();});});}}}catch(_0x49c1dd){logger[_0x1e4d('0x41')](_0x1e4d('0x14'),_0xcb1f09,JSON['stringify'](_0x49c1dd));_0x474307[_0x1e4d('0x4a')]();}};}; \ 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 8e22f11..ef1f70e 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 _0x770a=['stop','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally'];(function(_0x57add2,_0x4f2b7d){var _0x4e3670=function(_0x3311b){while(--_0x3311b){_0x57add2['push'](_0x57add2['shift']());}};_0x4e3670(++_0x4f2b7d);}(_0x770a,0xdd));var _0xa770=function(_0x442228,_0x56ac25){_0x442228=_0x442228-0x0;var _0xb0a0bd=_0x770a[_0x442228];return _0xb0a0bd;};'use strict';var moment=require('moment');var logger=require(_0xa770('0x0'))(_0xa770('0x1'));var rpc={'chatInteraction':require(_0xa770('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xa770('0x3')),'mailInteraction':require(_0xa770('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xa770('0x5'))};exports['consequence']=function(_0x4f9817,_0x5e1e75,_0x50b4b9,_0x318f27){return function(_0x258d80){try{logger[_0xa770('0x6')](_0xa770('0x7'),_0x4f9817,_0x5e1e75[0x0]);var _0x2c0904={'closed':0x1,'closedAt':moment()[_0xa770('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0xa770('0x9'),'disposition':_0x5e1e75[0x0]};if(rpc[_0x318f27[_0xa770('0xa')]+'Interaction']){rpc[_0x318f27['channel']+_0xa770('0xb')][_0xa770('0xc')](_0x318f27[_0xa770('0xd')]['id'],_0x2c0904)[_0xa770('0xe')](function(_0x11a8a4){logger[_0xa770('0x6')](_0xa770('0xf'),_0x4f9817,_0x318f27[_0xa770('0xd')]['id']);})[_0xa770('0x10')](function(_0x30279e){logger[_0xa770('0x11')](_0xa770('0x12'),_0x4f9817,JSON[_0xa770('0x13')](_0x30279e));})[_0xa770('0x14')](function(){_0x258d80[_0xa770('0x15')]();});}}catch(_0x1104aa){logger['error'](_0xa770('0x12'),_0x4f9817,JSON[_0xa770('0x13')](_0x1104aa));_0x258d80['stop']();}};}; \ No newline at end of file +var _0x98a8=['finally','stop','moment','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','info','catch','error','[%s][CLOSE]\x20%s','stringify'];(function(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0x98a8,0xd1));var _0x898a=function(_0x38cb19,_0x177d12){_0x38cb19=_0x38cb19-0x0;var _0x479305=_0x98a8[_0x38cb19];return _0x479305;};'use strict';var moment=require(_0x898a('0x0'));var logger=require(_0x898a('0x1'))(_0x898a('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x898a('0x3')),'smsInteraction':require(_0x898a('0x4')),'mailInteraction':require(_0x898a('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x898a('0x6'))};exports['consequence']=function(_0x329136,_0x28bde3,_0x398cfd,_0x2d11f6){return function(_0x4225ff){try{logger['info'](_0x898a('0x7'),_0x329136,_0x28bde3[0x0]);var _0x26b724={'closed':0x1,'closedAt':moment()[_0x898a('0x8')](_0x898a('0x9')),'closeReason':_0x898a('0xa'),'disposition':_0x28bde3[0x0]};if(rpc[_0x2d11f6[_0x898a('0xb')]+'Interaction']){rpc[_0x2d11f6[_0x898a('0xb')]+_0x898a('0xc')][_0x898a('0xd')](_0x2d11f6[_0x898a('0xe')]['id'],_0x26b724)[_0x898a('0xf')](function(_0x56cf81){logger[_0x898a('0x10')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x329136,_0x2d11f6[_0x898a('0xe')]['id']);})[_0x898a('0x11')](function(_0x247e68){logger[_0x898a('0x12')](_0x898a('0x13'),_0x329136,JSON[_0x898a('0x14')](_0x247e68));})[_0x898a('0x15')](function(){_0x4225ff[_0x898a('0x16')]();});}}catch(_0x53bf1c){logger[_0x898a('0x12')](_0x898a('0x13'),_0x329136,JSON[_0x898a('0x14')](_0x53bf1c));_0x4225ff[_0x898a('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 98f5498..b2b8bd6 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 _0x804d=['whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','create','then','[%s][DIALOGFLOW]\x20%s','body','catch','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','result','fulfillment','speech','dialogflow','providerResponse','Message','endConversation','stringify','message','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','out','channel'];(function(_0x2ef3f4,_0x21406c){var _0x501ecd=function(_0x519c7c){while(--_0x519c7c){_0x2ef3f4['push'](_0x2ef3f4['shift']());}};_0x501ecd(++_0x21406c);}(_0x804d,0x116));var _0xd804=function(_0x491d95,_0x6e0c5b){_0x491d95=_0x491d95-0x0;var _0x446ebd=_0x804d[_0x491d95];return _0x446ebd;};'use strict';var _=require(_0xd804('0x0'));var moment=require(_0xd804('0x1'));var apiai=require(_0xd804('0x2'));var md5=require(_0xd804('0x3'));var utils=require(_0xd804('0x4'));var logger=require(_0xd804('0x5'))(_0xd804('0x6'));var rpc={'chatMessage':require(_0xd804('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xd804('0x8')),'smsMessage':require(_0xd804('0x9')),'faxMessage':require(_0xd804('0xa')),'whatsappMessage':require(_0xd804('0xb'))};exports[_0xd804('0xc')]=function(_0xf52871,_0x465695){return function(_0x391e2b){try{if(!_[_0xd804('0xd')](this[_0xd804('0xe')][_0xd804('0xf')])){logger[_0xd804('0x10')]('[%s][DIALOGFLOW]\x20%s',_0xf52871,_0xd804('0x11'));return _0x391e2b[_0xd804('0x12')]();}var _0x46730f={'ContactId':this[_0xd804('0x13')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xd804('0x14')};if(this[_0xd804('0x15')]==='sms'||this[_0xd804('0x15')]===_0xd804('0x16')){_0x46730f['phone']=this[_0xd804('0xe')][_0xd804('0x17')];}var _0xce756=this['channel'];if(_0xce756==='chat'){_0x46730f[_0xd804('0x18')]=this[_0xd804('0x19')]['id'];}else{_0x46730f[_[_0xd804('0x1a')](_0xce756)+_0xd804('0x1b')]=this[_0xd804('0x19')]['id'];}_0x46730f[_['upperFirst'](_0xce756)+_0xd804('0x1c')]=this[_0xd804('0xe')]['id'];if(this['interaction'][_0xd804('0x1d')]){var _0x1a10c7=_0x465695[0x2];if(!_[_0xd804('0x1e')](_0x1a10c7)){_0x46730f['body']=utils[_0xd804('0x1f')](_0x1a10c7,this);return rpc[_0xce756+'Message'][_0xd804('0x20')](_0x46730f)[_0xd804('0x21')](function(_0x13fa46){logger['info'](_0xd804('0x22'),_0xf52871,_0x46730f[_0xd804('0x23')]);})[_0xd804('0x24')](function(_0x2d881a){logger[_0xd804('0x25')]('[%s][DIALOGFLOW]\x20%s',_0xf52871,JSON['stringify'](_0x2d881a));})[_0xd804('0x26')](function(){logger['info'](_0xd804('0x27'),_0xf52871);_0x391e2b[_0xd804('0x28')]();});}else{logger[_0xd804('0x10')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0xf52871);_0x391e2b[_0xd804('0x28')]();}}else{var _0x5dd939=this;var _0x18d28c=apiai(_0x465695[0x0],{'language':_0x465695[0x1]||'en'});return _0x18d28c['textRequest'](this['message']['body'],{'sessionId':md5(this['interaction']['id'])})[_0xd804('0x21')](function(_0x2fc18b){_0x5dd939[_0xd804('0x23')]['dialogflow']=_0x2fc18b;_0x46730f[_0xd804('0x23')]=_0x2fc18b[_0xd804('0x29')][_0xd804('0x2a')][_0xd804('0x2b')];_0x46730f['providerName']=_0xd804('0x2c');_0x46730f[_0xd804('0x2d')]=JSON['stringify'](_0x2fc18b);return rpc[_0xce756+_0xd804('0x2e')][_0xd804('0x20')](_0x46730f)['then'](function(_0x5287eb){logger['info'](_0xd804('0x22'),_0xf52871,_0x46730f[_0xd804('0x23')]);if(_0x2fc18b[_0xd804('0x29')]['metadata'][_0xd804('0x2f')]){_0x391e2b[_0xd804('0x12')]();}else{_0x391e2b[_0xd804('0x28')]();}})[_0xd804('0x24')](function(_0x473588){logger[_0xd804('0x25')](_0xd804('0x22'),_0xf52871,JSON[_0xd804('0x30')](_0x473588));_0x391e2b['next']();});})[_0xd804('0x24')](function(_0x251e5e){logger[_0xd804('0x25')](_0xd804('0x22'),_0xf52871,_0x251e5e[_0xd804('0x31')]);_0x391e2b[_0xd804('0x12')]();});}}catch(_0x3aefde){logger[_0xd804('0x25')](_0xd804('0x22'),_0xf52871,JSON[_0xd804('0x30')](_0x3aefde));_0x391e2b['stop']();}};}; \ No newline at end of file +var _0xc1fc=['../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','created','getMustacheRender','Message','create','body','catch','error','[%s][DIALOGFLOW]\x20%s','stringify','finally','info','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','then','dialogflow','fulfillment','speech','providerName','providerResponse','result','metadata','message','moment','apiai-promise','./utils'];(function(_0x3e67aa,_0x268b36){var _0x478fa9=function(_0x1b3930){while(--_0x1b3930){_0x3e67aa['push'](_0x3e67aa['shift']());}};_0x478fa9(++_0x268b36);}(_0xc1fc,0x93));var _0xcc1f=function(_0x5d8cc2,_0x61c7bb){_0x5d8cc2=_0x5d8cc2-0x0;var _0x393087=_0xc1fc[_0x5d8cc2];return _0x393087;};'use strict';var _=require('lodash');var moment=require(_0xcc1f('0x0'));var apiai=require(_0xcc1f('0x1'));var md5=require('md5');var utils=require(_0xcc1f('0x2'));var logger=require(_0xcc1f('0x3'))(_0xcc1f('0x4'));var rpc={'chatMessage':require(_0xcc1f('0x5')),'openchannelMessage':require(_0xcc1f('0x6')),'mailMessage':require(_0xcc1f('0x7')),'smsMessage':require(_0xcc1f('0x8')),'faxMessage':require(_0xcc1f('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x376348,_0x4516e3){return function(_0x431ca8){try{if(!_[_0xcc1f('0xa')](this[_0xcc1f('0xb')]['UserId'])){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x376348,_0xcc1f('0xc'));return _0x431ca8[_0xcc1f('0xd')]();}var _0x256283={'ContactId':this[_0xcc1f('0xe')]['id'],'sentAt':moment()[_0xcc1f('0xf')](_0xcc1f('0x10')),'direction':_0xcc1f('0x11')};if(this[_0xcc1f('0x12')]===_0xcc1f('0x13')||this['channel']===_0xcc1f('0x14')){_0x256283[_0xcc1f('0x15')]=this[_0xcc1f('0xb')][_0xcc1f('0x15')];}var _0x9842de=this[_0xcc1f('0x12')];if(_0x9842de===_0xcc1f('0x16')){_0x256283['ChatWebsiteId']=this[_0xcc1f('0x17')]['id'];}else{_0x256283[_[_0xcc1f('0x18')](_0x9842de)+_0xcc1f('0x19')]=this[_0xcc1f('0x17')]['id'];}_0x256283[_[_0xcc1f('0x18')](_0x9842de)+_0xcc1f('0x1a')]=this[_0xcc1f('0xb')]['id'];if(this[_0xcc1f('0xb')][_0xcc1f('0x1b')]){var _0x7bad52=_0x4516e3[0x2];if(!_['isEmpty'](_0x7bad52)){_0x256283['body']=utils[_0xcc1f('0x1c')](_0x7bad52,this);return rpc[_0x9842de+_0xcc1f('0x1d')][_0xcc1f('0x1e')](_0x256283)['then'](function(_0x314d9d){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x376348,_0x256283[_0xcc1f('0x1f')]);})[_0xcc1f('0x20')](function(_0x5ed11c){logger[_0xcc1f('0x21')](_0xcc1f('0x22'),_0x376348,JSON[_0xcc1f('0x23')](_0x5ed11c));})[_0xcc1f('0x24')](function(){logger[_0xcc1f('0x25')](_0xcc1f('0x26'),_0x376348);_0x431ca8['stop']();});}else{logger[_0xcc1f('0x25')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x376348);_0x431ca8[_0xcc1f('0x27')]();}}else{var _0x310c2e=this;var _0x1a00d4=apiai(_0x4516e3[0x0],{'language':_0x4516e3[0x1]||'en'});return _0x1a00d4[_0xcc1f('0x28')](this['message'][_0xcc1f('0x1f')],{'sessionId':md5(this[_0xcc1f('0xb')]['id'])})[_0xcc1f('0x29')](function(_0x257e7f){_0x310c2e[_0xcc1f('0x1f')][_0xcc1f('0x2a')]=_0x257e7f;_0x256283[_0xcc1f('0x1f')]=_0x257e7f['result'][_0xcc1f('0x2b')][_0xcc1f('0x2c')];_0x256283[_0xcc1f('0x2d')]=_0xcc1f('0x2a');_0x256283[_0xcc1f('0x2e')]=JSON[_0xcc1f('0x23')](_0x257e7f);return rpc[_0x9842de+_0xcc1f('0x1d')][_0xcc1f('0x1e')](_0x256283)['then'](function(_0x4461d5){logger[_0xcc1f('0x25')](_0xcc1f('0x22'),_0x376348,_0x256283[_0xcc1f('0x1f')]);if(_0x257e7f[_0xcc1f('0x2f')][_0xcc1f('0x30')]['endConversation']){_0x431ca8[_0xcc1f('0xd')]();}else{_0x431ca8[_0xcc1f('0x27')]();}})['catch'](function(_0x3bd35c){logger['error'](_0xcc1f('0x22'),_0x376348,JSON[_0xcc1f('0x23')](_0x3bd35c));_0x431ca8[_0xcc1f('0xd')]();});})[_0xcc1f('0x20')](function(_0x54211b){logger['error'](_0xcc1f('0x22'),_0x376348,_0x54211b[_0xcc1f('0x31')]);_0x431ca8[_0xcc1f('0xd')]();});}}catch(_0x53220d){logger[_0xcc1f('0x21')](_0xcc1f('0x22'),_0x376348,JSON[_0xcc1f('0x23')](_0x53220d));_0x431ca8['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index ef5e4a3..1bde6b1 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 _0xb325=['isEmpty','getMustacheRender','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerResponse','fulfillmentText','push','all','next','lodash','md5','moment','bluebird','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','clone','body','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','UserId','contact','format','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','interaction'];(function(_0x5bac50,_0x540d00){var _0x28afd5=function(_0x25b25d){while(--_0x25b25d){_0x5bac50['push'](_0x5bac50['shift']());}};_0x28afd5(++_0x540d00);}(_0xb325,0x1e2));var _0x5b32=function(_0x393b30,_0x222fed){_0x393b30=_0x393b30-0x0;var _0x348e7d=_0xb325[_0x393b30];return _0x348e7d;};'use strict';var _=require(_0x5b32('0x0'));var dialogflow=require('dialogflow');var md5=require(_0x5b32('0x1'));var moment=require(_0x5b32('0x2'));var Promise=require(_0x5b32('0x3'));var logger=require('../../../../config/logger')(_0x5b32('0x4'));var utils=require(_0x5b32('0x5'));var rpc={'chatMessage':require(_0x5b32('0x6')),'openchannelMessage':require(_0x5b32('0x7')),'mailMessage':require(_0x5b32('0x8')),'smsMessage':require(_0x5b32('0x9')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x5b32('0xa'))};function createMessage(_0x173815,_0x3111e1,_0x4e3f44,_0x4529a5){return new Promise(function(_0x24feb7,_0x232938){var _0x368a4d=_[_0x5b32('0xb')](_0x4e3f44);_0x368a4d[_0x5b32('0xc')]=_0x4529a5;return rpc[_0x3111e1+'Message'][_0x5b32('0xd')](_0x368a4d)[_0x5b32('0xe')](function(){logger[_0x5b32('0xf')](_0x5b32('0x10'),_0x173815,_0x368a4d['body']);_0x24feb7();})[_0x5b32('0x11')](function(_0x4fa19c){logger[_0x5b32('0x12')](_0x5b32('0x10'),_0x173815,JSON[_0x5b32('0x13')](_0x4fa19c));_0x232938(_0x4fa19c);});});}exports[_0x5b32('0x14')]=function(_0x5b09d1,_0x13330b){return function(_0xc2a4c2){try{if(!_[_0x5b32('0x15')](this['interaction'][_0x5b32('0x16')])){logger['info'](_0x5b32('0x10'),_0x5b09d1,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0xc2a4c2['next']();}var _0x163339={'ContactId':this[_0x5b32('0x17')]['id'],'sentAt':moment()[_0x5b32('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x5b32('0x19')};if(this[_0x5b32('0x1a')]===_0x5b32('0x1b')||this[_0x5b32('0x1a')]===_0x5b32('0x1c')){_0x163339[_0x5b32('0x1d')]=this['interaction'][_0x5b32('0x1d')];}var _0x3f57d5=this[_0x5b32('0x1a')];if(_0x3f57d5===_0x5b32('0x1e')){_0x163339[_0x5b32('0x1f')]=this[_0x5b32('0x20')]['id'];}else{_0x163339[_[_0x5b32('0x21')](_0x3f57d5)+_0x5b32('0x22')]=this[_0x5b32('0x20')]['id'];}_0x163339[_['upperFirst'](_0x3f57d5)+'InteractionId']=this[_0x5b32('0x23')]['id'];if(this[_0x5b32('0x23')]['created']){var _0xf01aee=_0x13330b[0x4];if(!_[_0x5b32('0x24')](_0xf01aee)){_0x163339[_0x5b32('0xc')]=utils[_0x5b32('0x25')](_0xf01aee,this);return rpc[_0x3f57d5+'Message'][_0x5b32('0xd')](_0x163339)[_0x5b32('0xe')](function(_0x3e07ff){logger['info'](_0x5b32('0x10'),_0x5b09d1,_0x163339['body']);})[_0x5b32('0x11')](function(_0x460cc5){logger[_0x5b32('0x12')](_0x5b32('0x10'),_0x5b09d1,JSON[_0x5b32('0x13')](_0x460cc5));})[_0x5b32('0x26')](function(){logger[_0x5b32('0xf')](_0x5b32('0x27'),_0x5b09d1);_0xc2a4c2[_0x5b32('0x28')]();});}else{logger[_0x5b32('0xf')](_0x5b32('0x29'),_0x5b09d1);_0xc2a4c2[_0x5b32('0x28')]();}}else{var _0x344514=this;var _0x5d7b17=_0x13330b[0x2]['replace'](/\\n/g,'\x0a');var _0xc12e74={'credentials':{'private_key':_0x5d7b17,'client_email':_0x13330b[0x1]}};var _0x1f9189=new dialogflow[(_0x5b32('0x2a'))](_0xc12e74);var _0x280d11=_0x1f9189[_0x5b32('0x2b')](_0x13330b[0x0],md5(_0x344514[_0x5b32('0x23')]['id']));var _0x38a293={'session':_0x280d11,'queryInput':{'text':{'text':_0x344514[_0x5b32('0x2c')][_0x5b32('0xc')],'languageCode':_0x13330b[0x3]||'en'}}};return _0x1f9189[_0x5b32('0x2d')](_0x38a293)[_0x5b32('0xe')](function(_0x23d649){if(_0x23d649&&_0x23d649[_0x5b32('0x2e')]){_0x344514[_0x5b32('0xc')][_0x5b32('0x2f')]=_0x23d649;var _0x3fc99d=_0x23d649[0x0];var _0x186111=_0x3fc99d['queryResult']['diagnosticInfo']&&_0x3fc99d[_0x5b32('0x30')][_0x5b32('0x31')][_0x5b32('0x32')]?_0x3fc99d[_0x5b32('0x30')]['diagnosticInfo']['fields'][_0x5b32('0x33')][_0x5b32('0x34')]:![];_0x344514[_0x5b32('0xc')][_0x5b32('0x35')]=_0x3fc99d['queryResult'][_0x5b32('0x36')];_0x344514[_0x5b32('0xc')][_0x5b32('0x37')]=_0x3fc99d['queryResult'][_0x5b32('0x38')];_0x344514[_0x5b32('0xc')][_0x5b32('0x39')]=_0x3fc99d['queryResult']['diagnosticInfo']&&_0x3fc99d[_0x5b32('0x30')]['diagnosticInfo'][_0x5b32('0x32')]?_0x3fc99d[_0x5b32('0x30')]['diagnosticInfo']['fields'][_0x5b32('0x33')][_0x5b32('0x34')]:![];_0x344514[_0x5b32('0xc')][_0x5b32('0x3a')]=_0x3fc99d[_0x5b32('0x30')][_0x5b32('0x3b')][_0x5b32('0x3c')];_0x344514[_0x5b32('0xc')][_0x5b32('0x3d')]=_0x3fc99d[_0x5b32('0x30')]['intent'][_0x5b32('0x3e')];_0x344514[_0x5b32('0xc')][_0x5b32('0x3f')]=_0x3fc99d[_0x5b32('0x30')][_0x5b32('0x3b')][_0x5b32('0x40')];_0x344514['body']['DIALOGFLOWV2_LANGUAGECODE']=_0x3fc99d[_0x5b32('0x30')][_0x5b32('0x41')];_0x344514[_0x5b32('0xc')][_0x5b32('0x42')]=_0x3fc99d[_0x5b32('0x30')][_0x5b32('0x43')];_0x344514[_0x5b32('0xc')]['DIALOGFLOWV2_SCORE']=_0x3fc99d[_0x5b32('0x30')][_0x5b32('0x44')];_0x163339['providerName']=_0x5b32('0x2f');_0x163339[_0x5b32('0x45')]=JSON['stringify'](_0x23d649);var _0x2e2c84=[];for(var _0x314aaf=0x0;_0x314aaf<_0x23d649[_0x5b32('0x2e')];_0x314aaf++){var _0x491f9c=_0x23d649[_0x314aaf];if(_0x491f9c&&_0x491f9c[_0x5b32('0x30')]&&_0x491f9c[_0x5b32('0x30')][_0x5b32('0x46')]){_0x2e2c84[_0x5b32('0x47')](createMessage(_0x5b09d1,_0x3f57d5,_0x163339,_0x491f9c[_0x5b32('0x30')][_0x5b32('0x46')]));}}return Promise[_0x5b32('0x48')](_0x2e2c84)[_0x5b32('0xe')](function(){if(_0x186111){_0xc2a4c2[_0x5b32('0x49')]();}else{_0xc2a4c2[_0x5b32('0x28')]();}})['catch'](function(_0x5468db){logger['error'](_0x5b32('0x10'),_0x5b09d1,JSON['stringify'](_0x5468db));_0xc2a4c2[_0x5b32('0x49')]();});}})[_0x5b32('0x11')](function(_0x1fd532){logger[_0x5b32('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x5b09d1,_0x1fd532['message'],_0x1fd532['stack']);_0xc2a4c2['next']();});}}catch(_0x77160e){logger[_0x5b32('0x12')](_0x5b32('0x10'),_0x5b09d1,JSON[_0x5b32('0x13')](_0x77160e));_0xc2a4c2['stop']();}};}; \ No newline at end of file +var _0x93ca=['[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','diagnosticInfo','queryResult','end_conversation','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','fields','boolValue','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','fulfillmentText','push','stack','dialogflow','md5','bluebird','../../../../config/logger','routing','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','whatsapp','phone','channel','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty'];(function(_0x588011,_0x5e9d11){var _0x3b3773=function(_0x4cca54){while(--_0x4cca54){_0x588011['push'](_0x588011['shift']());}};_0x3b3773(++_0x5e9d11);}(_0x93ca,0xfa));var _0xa93c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x93ca[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var dialogflow=require(_0xa93c('0x0'));var md5=require(_0xa93c('0x1'));var moment=require('moment');var Promise=require(_0xa93c('0x2'));var logger=require(_0xa93c('0x3'))(_0xa93c('0x4'));var utils=require(_0xa93c('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xa93c('0x6')),'mailMessage':require(_0xa93c('0x7')),'smsMessage':require(_0xa93c('0x8')),'faxMessage':require(_0xa93c('0x9')),'whatsappMessage':require(_0xa93c('0xa'))};function createMessage(_0x5b0a70,_0x125e39,_0x55cc7f,_0x5440b9){return new Promise(function(_0xe9bbae,_0x289426){var _0x5702af=_['clone'](_0x55cc7f);_0x5702af[_0xa93c('0xb')]=_0x5440b9;return rpc[_0x125e39+_0xa93c('0xc')][_0xa93c('0xd')](_0x5702af)[_0xa93c('0xe')](function(){logger[_0xa93c('0xf')](_0xa93c('0x10'),_0x5b0a70,_0x5702af[_0xa93c('0xb')]);_0xe9bbae();})[_0xa93c('0x11')](function(_0x3767d8){logger[_0xa93c('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x5b0a70,JSON[_0xa93c('0x13')](_0x3767d8));_0x289426(_0x3767d8);});});}exports[_0xa93c('0x14')]=function(_0x3be470,_0x596231){return function(_0x2bffd1){try{if(!_[_0xa93c('0x15')](this[_0xa93c('0x16')][_0xa93c('0x17')])){logger[_0xa93c('0xf')](_0xa93c('0x10'),_0x3be470,_0xa93c('0x18'));return _0x2bffd1[_0xa93c('0x19')]();}var _0x307725={'ContactId':this[_0xa93c('0x1a')]['id'],'sentAt':moment()['format'](_0xa93c('0x1b')),'direction':_0xa93c('0x1c')};if(this['channel']==='sms'||this['channel']===_0xa93c('0x1d')){_0x307725[_0xa93c('0x1e')]=this[_0xa93c('0x16')]['phone'];}var _0x2ff577=this[_0xa93c('0x1f')];if(_0x2ff577==='chat'){_0x307725[_0xa93c('0x20')]=this[_0xa93c('0x21')]['id'];}else{_0x307725[_[_0xa93c('0x22')](_0x2ff577)+'AccountId']=this[_0xa93c('0x21')]['id'];}_0x307725[_['upperFirst'](_0x2ff577)+_0xa93c('0x23')]=this['interaction']['id'];if(this[_0xa93c('0x16')][_0xa93c('0x24')]){var _0x542b02=_0x596231[0x4];if(!_[_0xa93c('0x25')](_0x542b02)){_0x307725['body']=utils['getMustacheRender'](_0x542b02,this);return rpc[_0x2ff577+_0xa93c('0xc')]['create'](_0x307725)[_0xa93c('0xe')](function(_0x56b22c){logger[_0xa93c('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x3be470,_0x307725[_0xa93c('0xb')]);})[_0xa93c('0x11')](function(_0x1f3c2b){logger[_0xa93c('0x12')](_0xa93c('0x10'),_0x3be470,JSON[_0xa93c('0x13')](_0x1f3c2b));})['finally'](function(){logger['info'](_0xa93c('0x26'),_0x3be470);_0x2bffd1[_0xa93c('0x27')]();});}else{logger[_0xa93c('0xf')](_0xa93c('0x28'),_0x3be470);_0x2bffd1[_0xa93c('0x27')]();}}else{var _0x15a3fc=this;var _0x2eb3db=_0x596231[0x2][_0xa93c('0x29')](/\\n/g,'\x0a');var _0x3f8084={'credentials':{'private_key':_0x2eb3db,'client_email':_0x596231[0x1]}};var _0x129f8e=new dialogflow[(_0xa93c('0x2a'))](_0x3f8084);var _0x5d2643=_0x129f8e[_0xa93c('0x2b')](_0x596231[0x0],md5(_0x15a3fc[_0xa93c('0x16')]['id']));var _0x2250ac={'session':_0x5d2643,'queryInput':{'text':{'text':_0x15a3fc[_0xa93c('0x2c')]['body'],'languageCode':_0x596231[0x3]||'en'}}};return _0x129f8e[_0xa93c('0x2d')](_0x2250ac)[_0xa93c('0xe')](function(_0x1693cc){if(_0x1693cc&&_0x1693cc[_0xa93c('0x2e')]){_0x15a3fc[_0xa93c('0xb')][_0xa93c('0x2f')]=_0x1693cc;var _0x3a0413=_0x1693cc[0x0];var _0x14c14e=_0x3a0413['queryResult'][_0xa93c('0x30')]&&_0x3a0413[_0xa93c('0x31')][_0xa93c('0x30')]['fields']?_0x3a0413[_0xa93c('0x31')][_0xa93c('0x30')]['fields'][_0xa93c('0x32')]['boolValue']:![];_0x15a3fc[_0xa93c('0xb')][_0xa93c('0x33')]=_0x3a0413['queryResult'][_0xa93c('0x34')];_0x15a3fc['body'][_0xa93c('0x35')]=_0x3a0413[_0xa93c('0x31')][_0xa93c('0x36')];_0x15a3fc[_0xa93c('0xb')][_0xa93c('0x37')]=_0x3a0413[_0xa93c('0x31')]['diagnosticInfo']&&_0x3a0413[_0xa93c('0x31')][_0xa93c('0x30')][_0xa93c('0x38')]?_0x3a0413[_0xa93c('0x31')][_0xa93c('0x30')][_0xa93c('0x38')][_0xa93c('0x32')][_0xa93c('0x39')]:![];_0x15a3fc[_0xa93c('0xb')]['DIALOGFLOWV2_INTENTNAME']=_0x3a0413[_0xa93c('0x31')][_0xa93c('0x3a')][_0xa93c('0x3b')];_0x15a3fc[_0xa93c('0xb')][_0xa93c('0x3c')]=_0x3a0413['queryResult'][_0xa93c('0x3a')][_0xa93c('0x3d')];_0x15a3fc[_0xa93c('0xb')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x3a0413[_0xa93c('0x31')][_0xa93c('0x3a')][_0xa93c('0x3e')];_0x15a3fc[_0xa93c('0xb')]['DIALOGFLOWV2_LANGUAGECODE']=_0x3a0413[_0xa93c('0x31')][_0xa93c('0x3f')];_0x15a3fc[_0xa93c('0xb')][_0xa93c('0x40')]=_0x3a0413[_0xa93c('0x31')][_0xa93c('0x41')];_0x15a3fc[_0xa93c('0xb')][_0xa93c('0x42')]=_0x3a0413[_0xa93c('0x31')][_0xa93c('0x43')];_0x307725[_0xa93c('0x44')]='dialogflowV2';_0x307725['providerResponse']=JSON[_0xa93c('0x13')](_0x1693cc);var _0x3b006e=[];for(var _0x311c55=0x0;_0x311c55<_0x1693cc['length'];_0x311c55++){var _0x48f457=_0x1693cc[_0x311c55];if(_0x48f457&&_0x48f457[_0xa93c('0x31')]&&_0x48f457[_0xa93c('0x31')][_0xa93c('0x45')]){_0x3b006e[_0xa93c('0x46')](createMessage(_0x3be470,_0x2ff577,_0x307725,_0x48f457[_0xa93c('0x31')][_0xa93c('0x45')]));}}return Promise['all'](_0x3b006e)[_0xa93c('0xe')](function(){if(_0x14c14e){_0x2bffd1[_0xa93c('0x19')]();}else{_0x2bffd1[_0xa93c('0x27')]();}})[_0xa93c('0x11')](function(_0x53498a){logger[_0xa93c('0x12')](_0xa93c('0x10'),_0x3be470,JSON[_0xa93c('0x13')](_0x53498a));_0x2bffd1[_0xa93c('0x19')]();});}})[_0xa93c('0x11')](function(_0x2f3c97){logger[_0xa93c('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x3be470,_0x2f3c97[_0xa93c('0x2c')],_0x2f3c97[_0xa93c('0x47')]);_0x2bffd1[_0xa93c('0x19')]();});}}catch(_0x5077e3){logger[_0xa93c('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x3be470,JSON[_0xa93c('0x13')](_0x5077e3));_0x2bffd1[_0xa93c('0x27')]();}};}; \ 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 357166f..43d596c 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 _0x1b40=['priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','stringify','validate','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','consequence','fromString','getMustacheRender','replace','length','map','message','join','stop','condition'];(function(_0x1e72f6,_0x1ed2b2){var _0x1ff183=function(_0x2b645e){while(--_0x2b645e){_0x1e72f6['push'](_0x1e72f6['shift']());}};_0x1ff183(++_0x1ed2b2);}(_0x1b40,0x105));var _0x01b4=function(_0x446208,_0xb483fb){_0x446208=_0x446208-0x0;var _0xe49563=_0x1b40[_0x446208];return _0xe49563;};'use strict';var schema=require(_0x01b4('0x0'));var _=require('lodash');var htmlToText=require(_0x01b4('0x1'));var utils=require(_0x01b4('0x2'));var logger=require(_0x01b4('0x3'))(_0x01b4('0x4'));var gotoif=schema({'condition':{'type':_0x01b4('0x5'),'required':!![],'message':_0x01b4('0x6')},'priorityTrue':{'type':_0x01b4('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x01b4('0x7'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x01b4('0x8')]=function(_0x5af89a,_0xd17ad4){return function(_0x44fc66){try{var _0x5bffd3={'condition':htmlToText[_0x01b4('0x9')](utils[_0x01b4('0xa')](_0xd17ad4[0x0],this),{'wordwrap':![]})[_0x01b4('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0xd17ad4[0x1],'priorityFalse':_0xd17ad4[0x2]};var _0x101dfa=gotoif[_0x01b4('0x0')](_0x5bffd3,{'typecast':!![]});if(_0x101dfa[_0x01b4('0xc')]){logger['error']('[%s][GOTOIF]\x20%s',_0x5af89a,_[_0x01b4('0xd')](_0x101dfa,_0x01b4('0xe'))[_0x01b4('0xf')](',\x20'));_0x44fc66[_0x01b4('0x10')]();}else{try{var _0x40c144=eval('('+_0x5bffd3[_0x01b4('0x11')]+')');var _0x11d63e=_0x40c144?_0x5bffd3[_0x01b4('0x12')]:_0x5bffd3[_0x01b4('0x13')];logger['info'](_0x01b4('0x14'),_0x5af89a,_0x5bffd3[_0x01b4('0x11')],_0x40c144,_0x11d63e||'next');if(_0x11d63e){var _0x999837=_[_0x01b4('0x15')](_0x44fc66[_0x01b4('0x16')](),{'p':_0x11d63e});if(_0x999837>=0x0){logger[_0x01b4('0x17')](_0x01b4('0x18'),_0x5af89a,_0x11d63e||_0x01b4('0x19'),_0x999837);_0x44fc66['next'](_0x999837);}else{logger[_0x01b4('0x17')](_0x01b4('0x1a'),_0x5af89a,_0x11d63e||_0x01b4('0x19'));_0x44fc66['stop']();}}else{_0x44fc66['next']();}}catch(_0x3ea05b){logger[_0x01b4('0x1b')](_0x01b4('0x1c'),_0x5af89a,_0x3ea05b[_0x01b4('0xe')]);_0x44fc66[_0x01b4('0x10')]();}}}catch(_0x2aa90d){logger[_0x01b4('0x1b')](_0x01b4('0x1d'),_0x5af89a,JSON[_0x01b4('0x1e')](_0x2aa90d));_0x44fc66[_0x01b4('0x10')]();}};}; \ No newline at end of file +var _0x8de9=['findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','message','join','stop','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next'];(function(_0x2329eb,_0x3cb953){var _0x5846aa=function(_0x5aca8f){while(--_0x5aca8f){_0x2329eb['push'](_0x2329eb['shift']());}};_0x5846aa(++_0x3cb953);}(_0x8de9,0x90));var _0x98de=function(_0xf8c6a9,_0x1ecbd9){_0xf8c6a9=_0xf8c6a9-0x0;var _0x12aeaa=_0x8de9[_0xf8c6a9];return _0x12aeaa;};'use strict';var schema=require(_0x98de('0x0'));var _=require('lodash');var htmlToText=require(_0x98de('0x1'));var utils=require(_0x98de('0x2'));var logger=require(_0x98de('0x3'))(_0x98de('0x4'));var gotoif=schema({'condition':{'type':_0x98de('0x5'),'required':!![],'message':_0x98de('0x6')},'priorityTrue':{'type':_0x98de('0x7'),'message':_0x98de('0x8')},'priorityFalse':{'type':_0x98de('0x7'),'message':_0x98de('0x9')}});exports['consequence']=function(_0x3ca289,_0x278805){return function(_0x1ad8c3){try{var _0x36d42d={'condition':htmlToText[_0x98de('0xa')](utils[_0x98de('0xb')](_0x278805[0x0],this),{'wordwrap':![]})[_0x98de('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x278805[0x1],'priorityFalse':_0x278805[0x2]};var _0x325c8c=gotoif[_0x98de('0x0')](_0x36d42d,{'typecast':!![]});if(_0x325c8c[_0x98de('0xd')]){logger[_0x98de('0xe')](_0x98de('0xf'),_0x3ca289,_['map'](_0x325c8c,_0x98de('0x10'))[_0x98de('0x11')](',\x20'));_0x1ad8c3[_0x98de('0x12')]();}else{try{var _0x4b77bd=eval('('+_0x36d42d['condition']+')');var _0x27dcec=_0x4b77bd?_0x36d42d[_0x98de('0x13')]:_0x36d42d[_0x98de('0x14')];logger[_0x98de('0x15')](_0x98de('0x16'),_0x3ca289,_0x36d42d['condition'],_0x4b77bd,_0x27dcec||_0x98de('0x17'));if(_0x27dcec){var _0x4187ac=_[_0x98de('0x18')](_0x1ad8c3['rules'](),{'p':_0x27dcec});if(_0x4187ac>=0x0){logger['info'](_0x98de('0x19'),_0x3ca289,_0x27dcec||_0x98de('0x17'),_0x4187ac);_0x1ad8c3[_0x98de('0x17')](_0x4187ac);}else{logger[_0x98de('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x3ca289,_0x27dcec||_0x98de('0x17'));_0x1ad8c3[_0x98de('0x12')]();}}else{_0x1ad8c3[_0x98de('0x17')]();}}catch(_0x49b35a){logger[_0x98de('0xe')](_0x98de('0x1a'),_0x3ca289,_0x49b35a[_0x98de('0x10')]);_0x1ad8c3[_0x98de('0x12')]();}}}catch(_0x2bc75f){logger[_0x98de('0xe')]('[%s][GOTOIF]\x20%s',_0x3ca289,JSON[_0x98de('0x1b')](_0x2bc75f));_0x1ad8c3[_0x98de('0x12')]();}};}; \ 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 d5d6d73..86f116d 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 _0xcacc=['validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','map','message','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOP]\x20%s','stringify'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xcacc,0x12c));var _0xccac=function(_0x3572fb,_0x58be24){_0x3572fb=_0x3572fb-0x0;var _0x15b36b=_0xcacc[_0x3572fb];return _0x15b36b;};'use strict';var schema=require(_0xccac('0x0'));var _=require('lodash');var logger=require(_0xccac('0x1'))(_0xccac('0x2'));var gotop=schema({'priority':{'type':_0xccac('0x3'),'required':!![],'message':_0xccac('0x4')}});exports['consequence']=function(_0x3467d2,_0x3ebc6d){return function(_0x25c132){try{var _0x299edd={'priority':_0x3ebc6d[0x0]};var _0x10ac2a=gotop[_0xccac('0x0')](_0x299edd,{'typecast':!![]});if(_0x10ac2a[_0xccac('0x5')]){logger[_0xccac('0x6')]('[%s][GOTOP]\x20%s',_0x3467d2,_[_0xccac('0x7')](_0x10ac2a,_0xccac('0x8'))['join'](',\x20'));_0x25c132['stop']();}else{logger[_0xccac('0x9')](_0xccac('0xa'),_0x3467d2,_0x299edd[_0xccac('0xb')]);if(_0x299edd['priority']){var _0x5add39=_[_0xccac('0xc')](_0x25c132[_0xccac('0xd')](),{'p':_0x299edd['priority']});if(_0x5add39>=0x0){logger[_0xccac('0x9')](_0xccac('0xe'),_0x3467d2,_0x299edd[_0xccac('0xb')]||_0xccac('0xf'),_0x5add39);_0x25c132[_0xccac('0xf')](_0x5add39);}else{logger[_0xccac('0x9')](_0xccac('0x10'),_0x3467d2,_0x299edd['priority']||_0xccac('0xf'));_0x25c132[_0xccac('0x11')]();}}else{_0x25c132[_0xccac('0xf')]();}}}catch(_0x1a5fda){logger[_0xccac('0x6')](_0xccac('0x12'),_0x3467d2,JSON[_0xccac('0x13')](_0x1a5fda));_0x25c132[_0xccac('0x11')]();}};}; \ No newline at end of file +var _0x0912=['../../../../config/logger','routing','number','consequence','error','[%s][GOTOP]\x20%s','map','message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash'];(function(_0x9842c1,_0x1edf79){var _0x5ba376=function(_0x4b88ed){while(--_0x4b88ed){_0x9842c1['push'](_0x9842c1['shift']());}};_0x5ba376(++_0x1edf79);}(_0x0912,0x11c));var _0x2091=function(_0x591448,_0x443a02){_0x591448=_0x591448-0x0;var _0x22da37=_0x0912[_0x591448];return _0x22da37;};'use strict';var schema=require('validate');var _=require(_0x2091('0x0'));var logger=require(_0x2091('0x1'))(_0x2091('0x2'));var gotop=schema({'priority':{'type':_0x2091('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x2091('0x4')]=function(_0x2e15d9,_0x33f9df){return function(_0x4ba5d2){try{var _0x329407={'priority':_0x33f9df[0x0]};var _0x1bb10d=gotop['validate'](_0x329407,{'typecast':!![]});if(_0x1bb10d['length']){logger[_0x2091('0x5')](_0x2091('0x6'),_0x2e15d9,_[_0x2091('0x7')](_0x1bb10d,_0x2091('0x8'))['join'](',\x20'));_0x4ba5d2[_0x2091('0x9')]();}else{logger[_0x2091('0xa')](_0x2091('0xb'),_0x2e15d9,_0x329407[_0x2091('0xc')]);if(_0x329407[_0x2091('0xc')]){var _0x396422=_[_0x2091('0xd')](_0x4ba5d2[_0x2091('0xe')](),{'p':_0x329407['priority']});if(_0x396422>=0x0){logger[_0x2091('0xa')](_0x2091('0xf'),_0x2e15d9,_0x329407[_0x2091('0xc')]||_0x2091('0x10'),_0x396422);_0x4ba5d2[_0x2091('0x10')](_0x396422);}else{logger[_0x2091('0xa')](_0x2091('0x11'),_0x2e15d9,_0x329407[_0x2091('0xc')]||_0x2091('0x10'));_0x4ba5d2['stop']();}}else{_0x4ba5d2['next']();}}}catch(_0x3cffda){logger[_0x2091('0x5')](_0x2091('0x6'),_0x2e15d9,JSON[_0x2091('0x12')](_0x3cffda));_0x4ba5d2['stop']();}};}; \ 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 12b8fc8..d21e755 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 _0xb4e2=['stop','lodash','routing','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify'];(function(_0x1a8bdf,_0x35e8d4){var _0x175d62=function(_0x30e7e0){while(--_0x30e7e0){_0x1a8bdf['push'](_0x1a8bdf['shift']());}};_0x175d62(++_0x35e8d4);}(_0xb4e2,0x1aa));var _0x2b4e=function(_0x5f0430,_0x4245b0){_0x5f0430=_0x5f0430-0x0;var _0x5be551=_0xb4e2[_0x5f0430];return _0x5be551;};'use strict';var _=require(_0x2b4e('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x2b4e('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x2b4e('0x2')),'faxMessage':require(_0x2b4e('0x3')),'whatsappMessage':require(_0x2b4e('0x4'))};exports[_0x2b4e('0x5')]=function(_0xf07f95,_0x1a77ed){return function(_0x10f028){try{var _0x4a84a9={'body':utils[_0x2b4e('0x6')](_0x1a77ed[0x0],this),'ContactId':this[_0x2b4e('0x7')]['id']};if(this[_0x2b4e('0x8')]===_0x2b4e('0x9')){_0x4a84a9[_0x2b4e('0xa')]=this[_0x2b4e('0xb')]['id'];}else{_0x4a84a9[_[_0x2b4e('0xc')](this[_0x2b4e('0x8')])+_0x2b4e('0xd')]=this[_0x2b4e('0xb')]['id'];}_0x4a84a9[_[_0x2b4e('0xc')](this[_0x2b4e('0x8')])+_0x2b4e('0xe')]=this[_0x2b4e('0xf')]['id'];if(rpc[this['channel']+_0x2b4e('0x10')]){return rpc[this[_0x2b4e('0x8')]+_0x2b4e('0x10')][_0x2b4e('0x11')](_0x4a84a9)['then'](function(_0x8531ed){logger['info'](_0x2b4e('0x12'),_0xf07f95,_0x4a84a9[_0x2b4e('0x13')]);_0x10f028[_0x2b4e('0x14')]();})[_0x2b4e('0x15')](function(_0x161666){logger[_0x2b4e('0x16')]('[%s][MESSAGE]\x20%s',_0xf07f95,JSON[_0x2b4e('0x17')](_0x161666));_0x10f028[_0x2b4e('0x18')]();});}}catch(_0x38f5ae){logger['error'](_0x2b4e('0x12'),_0xf07f95,JSON[_0x2b4e('0x17')](_0x38f5ae));_0x10f028['stop']();}};}; \ No newline at end of file +var _0x1d6a=['./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction','Message','create','then','[%s][MESSAGE]\x20%s','body','next','catch','stop'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d6a,0x190));var _0xa1d6=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x1d6a[_0x8c43de];return _0xa6591b;};'use strict';var _=require('lodash');var utils=require(_0xa1d6('0x0'));var logger=require(_0xa1d6('0x1'))(_0xa1d6('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xa1d6('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xa1d6('0x4')),'faxMessage':require(_0xa1d6('0x5')),'whatsappMessage':require(_0xa1d6('0x6'))};exports[_0xa1d6('0x7')]=function(_0x370885,_0x3eb7ca){return function(_0x5be9ff){try{var _0x1452e7={'body':utils[_0xa1d6('0x8')](_0x3eb7ca[0x0],this),'ContactId':this['contact']['id']};if(this[_0xa1d6('0x9')]===_0xa1d6('0xa')){_0x1452e7[_0xa1d6('0xb')]=this[_0xa1d6('0xc')]['id'];}else{_0x1452e7[_['upperFirst'](this[_0xa1d6('0x9')])+_0xa1d6('0xd')]=this['account']['id'];}_0x1452e7[_[_0xa1d6('0xe')](this[_0xa1d6('0x9')])+_0xa1d6('0xf')]=this[_0xa1d6('0x10')]['id'];if(rpc[this['channel']+_0xa1d6('0x11')]){return rpc[this[_0xa1d6('0x9')]+_0xa1d6('0x11')][_0xa1d6('0x12')](_0x1452e7)[_0xa1d6('0x13')](function(_0x428629){logger['info'](_0xa1d6('0x14'),_0x370885,_0x1452e7[_0xa1d6('0x15')]);_0x5be9ff[_0xa1d6('0x16')]();})[_0xa1d6('0x17')](function(_0x723996){logger['error']('[%s][MESSAGE]\x20%s',_0x370885,JSON['stringify'](_0x723996));_0x5be9ff[_0xa1d6('0x18')]();});}}catch(_0x321198){logger['error'](_0xa1d6('0x14'),_0x370885,JSON['stringify'](_0x321198));_0x5be9ff[_0xa1d6('0x18')]();}};}; \ 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 926d0e9..0bda8bd 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 _0x2a3e=['./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop'];(function(_0x579a5a,_0x48be20){var _0xb61335=function(_0x38316b){while(--_0x38316b){_0x579a5a['push'](_0x579a5a['shift']());}};_0xb61335(++_0x48be20);}(_0x2a3e,0x8f));var _0xe2a3=function(_0x3946e6,_0xcffb16){_0x3946e6=_0x3946e6-0x0;var _0x266778=_0x2a3e[_0x3946e6];return _0x266778;};'use strict';var utils=require(_0xe2a3('0x0'));var logger=require(_0xe2a3('0x1'))(_0xe2a3('0x2'));exports[_0xe2a3('0x3')]=function(_0x4bde02,_0x554721){return function(_0x3d7ed2){try{logger[_0xe2a3('0x4')](_0xe2a3('0x5'),_0x4bde02,utils[_0xe2a3('0x6')](_0x554721[0x0],this));_0x3d7ed2[_0xe2a3('0x7')]();}catch(_0x3dfa8c){logger[_0xe2a3('0x8')](_0xe2a3('0x5'),_0x4bde02,JSON[_0xe2a3('0x9')](_0x3dfa8c));_0x3d7ed2[_0xe2a3('0xa')]();}};}; \ No newline at end of file +var _0xe852=['info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','../../../../config/logger','routing','consequence'];(function(_0x234e50,_0x2ce044){var _0x3d7aea=function(_0x396ec5){while(--_0x396ec5){_0x234e50['push'](_0x234e50['shift']());}};_0x3d7aea(++_0x2ce044);}(_0xe852,0xcc));var _0x2e85=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xe852[_0x6cf19c];return _0xce14f3;};'use strict';var utils=require('./utils');var logger=require(_0x2e85('0x0'))(_0x2e85('0x1'));exports[_0x2e85('0x2')]=function(_0xd1158d,_0x26e84e){return function(_0x5481af){try{logger[_0x2e85('0x3')](_0x2e85('0x4'),_0xd1158d,utils[_0x2e85('0x5')](_0x26e84e[0x0],this));_0x5481af[_0x2e85('0x6')]();}catch(_0x7249fd){logger[_0x2e85('0x7')](_0x2e85('0x4'),_0xd1158d,JSON[_0x2e85('0x8')](_0x7249fd));_0x5481af['stop']();}};}; \ 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 05ce0cf..45c95d6 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 _0x825f=['validate','length','map','stop','find','Queues','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20%s','stack','lodash','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','queue_id','account','queue','from','joinAt','clone','push','capitalize','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','pick','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/whatsappInteraction','string','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','channel','InteractionId','interaction','MessageId','message','chat','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','update\x20queue\x20report','timeout','info','[%s][END:QUEUE][NAME:%s]','toLowerCase'];(function(_0x21c6b8,_0x16d6f6){var _0x39d474=function(_0x27dbf5){while(--_0x27dbf5){_0x21c6b8['push'](_0x21c6b8['shift']());}};_0x39d474(++_0x16d6f6);}(_0x825f,0xbc));var _0xf825=function(_0x10f6b7,_0x1abfcd){_0x10f6b7=_0x10f6b7-0x0;var _0x507c6e=_0x825f[_0x10f6b7];return _0x507c6e;};'use strict';var schema=require('validate');var _=require(_0xf825('0x0'));var util=require('util');var seqqueue=require(_0xf825('0x1'));var moment=require(_0xf825('0x2'));var Redis=require(_0xf825('0x3'));var config=require(_0xf825('0x4'));var logger=require(_0xf825('0x5'))(_0xf825('0x6'));var strategy=require('./strategy');config[_0xf825('0x7')]=_[_0xf825('0x8')](config[_0xf825('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var attributes=['id',_0xf825('0x9'),_0xf825('0xa'),_0xf825('0xb'),_0xf825('0xc'),_0xf825('0xd')];function emit(_0x555857,_0x1f026a,_0x4e5b53){io['to'](_0x555857)['emit'](_0x1f026a,_0x4e5b53);}function emitChannelQueueInteraction(_0x58cb5b,_0x19ce5a,_0x458f43,_0x3f1f2f,_0x1266de,_0x3245a1,_0x14b5e6,_0x5a838c){var _0x339de9=_[_0xf825('0xe')](_0x458f43);_0x339de9[_0xf825('0x9')]=_0x5a838c;_0x339de9[_0xf825('0xb')]=_0x19ce5a;_0x339de9[_0xf825('0xa')]=_0x3f1f2f;_0x339de9['id']=_0x1266de;if(_0x3245a1){attributes[_0xf825('0xf')](_[_0xf825('0x10')](_0x58cb5b)+'InteractionId');_0x14b5e6[util[_0xf825('0x11')](_0xf825('0x12'),_0x58cb5b)][_0x1266de]=_['pick'](_0x339de9,attributes);}else{delete _0x14b5e6[util[_0xf825('0x11')](_0xf825('0x12'),_0x58cb5b)][_0x1266de];}emit(util[_0xf825('0x11')](_0xf825('0x13'),_0x58cb5b,_0x19ce5a),util[_0xf825('0x11')](_0xf825('0x14'),_0x58cb5b,_0x3245a1?_0xf825('0x15'):_0xf825('0x16')),_[_0xf825('0x17')](_0x339de9,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xf825('0x18')),'chatQueueReport':require(_0xf825('0x19')),'smsQueueReport':require(_0xf825('0x1a')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xf825('0x1b')),'chatInteraction':require(_0xf825('0x1c')),'faxInteraction':require(_0xf825('0x1d')),'mailInteraction':require(_0xf825('0x1e')),'openchannelInteraction':require(_0xf825('0x1f')),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require(_0xf825('0x20'))};var queue=schema({'name':{'type':_0xf825('0x21'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x46ff04,_0x54169d,_0x279f6a,_0x5b2263){if(_0x46ff04&&_0x54169d&&_0x279f6a){_0x54169d[_0xf825('0x22')]+=0x1;var _0x227e47={'uniqueid':_0x46ff04,'from':_0x279f6a['body']?_0x279f6a[_0xf825('0x23')][_0xf825('0xc')]:'','joinAt':moment()[_0xf825('0x11')](_0xf825('0x24')),'ContactId':_0x279f6a[_0xf825('0x25')]?_0x279f6a[_0xf825('0x25')]['id']:null,'ListId':_0x279f6a[_0xf825('0x26')]?_0x279f6a[_0xf825('0x26')]['id']:null};_0x227e47[_[_0xf825('0x27')](_0x279f6a['channel'])+_0xf825('0x28')]=_0x54169d['id']||null;_0x227e47[_[_0xf825('0x27')](_0x279f6a[_0xf825('0x29')])+_0xf825('0x2a')]=_0x279f6a['interaction']?_0x279f6a[_0xf825('0x2b')]['id']:null;_0x227e47[_[_0xf825('0x27')](_0x279f6a[_0xf825('0x29')])+_0xf825('0x2c')]=_0x279f6a[_0xf825('0x2d')]?_0x279f6a[_0xf825('0x2d')]['id']:null;_0x227e47[_[_0xf825('0x27')](_0x279f6a[_0xf825('0x29')])+(_0x279f6a[_0xf825('0x29')]!==_0xf825('0x2e')?'AccountId':_0xf825('0x2f'))]=_0x279f6a['account']?_0x279f6a[_0xf825('0xa')]['id']:null;logger['info'](util['format'](_0xf825('0x30'),_0x46ff04,_0x54169d[_0xf825('0x31')]));emitChannelQueueInteraction(_0x279f6a['channel'],_0x54169d[_0xf825('0x31')],_0x227e47,_0x279f6a[_0xf825('0xa')][_0xf825('0x31')],_0x279f6a[_0xf825('0x2d')]['id'],!![],_0x5b2263,_0x54169d['id']);if(rpc[_0x279f6a[_0xf825('0x29')]+_0xf825('0x32')]){return rpc[_0x279f6a[_0xf825('0x29')]+'QueueReport'][_0xf825('0x33')](_0x227e47)[_0xf825('0x34')](function(_0x3ceaf7){logger[_0xf825('0x35')]('create\x20queue\x20report',_0x3ceaf7);});}}}function stopRouting(_0x3a7880,_0x24b7b8,_0x120c8d,_0x138c38){if(_0x3a7880&&_0x24b7b8){_0x24b7b8['waiting']-=0x1;var _0x1f8c03={'leaveAt':moment()[_0xf825('0x11')](_0xf825('0x24')),'acceptAt':moment()[_0xf825('0x11')](_0xf825('0x24')),'reason':_0xf825('0x36')};logger['info'](util[_0xf825('0x11')](_0xf825('0x37'),_0x3a7880,_0x24b7b8[_0xf825('0x31')]));emitChannelQueueInteraction(_0x120c8d['channel'],_0x24b7b8[_0xf825('0x31')],_0x120c8d[_0xf825('0x23')],_0x120c8d['account'][_0xf825('0x31')],_0x120c8d['message']['id'],![],_0x138c38,_0x24b7b8['id']);return rpc[_0x120c8d['channel']+_0xf825('0x38')][_0xf825('0x39')](_0x120c8d[_0xf825('0x2b')]['id'],{'queueId':_0x24b7b8['id']})[_0xf825('0x3a')](function(){if(rpc[_0x120c8d[_0xf825('0x29')]+_0xf825('0x32')]){return rpc[_0x120c8d['channel']+_0xf825('0x32')][_0xf825('0x39')](_0x3a7880,_0x1f8c03)[_0xf825('0x34')](function(_0x1cbdeb){logger['error'](_0xf825('0x3b'),_0x1cbdeb);});}});}}function endRouting(_0x3a971f,_0x4ccf9e,_0x5e6097,_0x4101e8){if(_0x3a971f&&_0x4ccf9e){_0x4ccf9e['waiting']-=0x1;var _0x43dec4={'leaveAt':moment()[_0xf825('0x11')](_0xf825('0x24')),'exitAt':moment()[_0xf825('0x11')](_0xf825('0x24')),'reason':_0xf825('0x3c')};logger[_0xf825('0x3d')](util['format'](_0xf825('0x3e'),_0x3a971f,_0x4ccf9e[_0xf825('0x31')]));emitChannelQueueInteraction(_0x5e6097['channel'],_0x4ccf9e[_0xf825('0x31')],_0x5e6097[_0xf825('0x23')],_0x5e6097['account'][_0xf825('0x31')],_0x5e6097[_0xf825('0x2d')]['id'],![],_0x4101e8);if(rpc[_0x5e6097[_0xf825('0x29')]+_0xf825('0x32')]){return rpc[_0x5e6097['channel']+_0xf825('0x32')][_0xf825('0x39')](_0x3a971f,_0x43dec4)[_0xf825('0x34')](function(_0x231ddb){logger['error'](_0xf825('0x3b'),_0x231ddb);});}}}function handleFindQueue(_0x543bb3){return function(_0x229e56){return _0x229e56[_0xf825('0x31')][_0xf825('0x3f')]()===_0x543bb3[_0xf825('0x3f')]();};}exports['consequence']=function(_0x2b2ba7,_0x368a94,_0x7b934d,_0x58b61a){return function(_0x368429){try{var _0x370b65={'name':_0x368a94[0x0],'timeout':_0x368a94[0x1]};var _0x31b0f3=queue[_0xf825('0x40')](_0x370b65,{'typecast':!![]});if(_0x31b0f3[_0xf825('0x41')]){logger[_0xf825('0x35')]('[%s][QUEUE]\x20%s',_0x2b2ba7,_[_0xf825('0x42')](_0x31b0f3,'message')['join'](',\x20'));_0x368429[_0xf825('0x43')]();}else{var _0x481cfd=_[_0xf825('0x44')](_0x7b934d[_0x58b61a[_0xf825('0x29')]+_0xf825('0x45')],handleFindQueue(_0x370b65[_0xf825('0x31')]));if(_0x481cfd){startRouting(_0x2b2ba7,_0x481cfd,_0x58b61a,_0x7b934d);var _0x32eac7=(_0x481cfd['timeout']||0xa)*0x3e8;var _0xdb82d0=(_0x370b65[_0xf825('0x3c')]||0x14)*0x3e8;var _0x5f25c6;if(_0x32eac7>_0xdb82d0){_0xdb82d0=_0x32eac7;}var _0x157778=seqqueue['createQueue'](_0x32eac7);_0x157778['id']=_0x2b2ba7;_0x157778[_0xf825('0x46')]=_0x32eac7;_0x157778[_0xf825('0x47')]=_0xdb82d0;_0x157778['channel']=_0x58b61a[_0xf825('0x29')];_0x7b934d[_0xf825('0x48')][_0x2b2ba7]['on'](_0xf825('0x49'),function(){logger[_0xf825('0x3d')](_0xf825('0x4a'),_0x2b2ba7);stopRouting(_0x2b2ba7,_0x481cfd,_0x58b61a,_0x7b934d);clearTimeout(_0x5f25c6);_0x5f25c6=undefined;_0x157778[_0xf825('0x4b')](!![]);if(_0x7b934d[_0xf825('0x48')][_0x2b2ba7]){delete _0x7b934d[_0xf825('0x48')][_0x2b2ba7];}_0x368429[_0xf825('0x43')]();});_0x7b934d[_0xf825('0x48')][_0x2b2ba7]['on'](_0xf825('0x4c'),function(){if(_0x7b934d['rules'][_0x2b2ba7]){delete _0x7b934d[_0xf825('0x48')][_0x2b2ba7];}});_0x5f25c6=setTimeout(function(){logger[_0xf825('0x3d')](_0xf825('0x4d'),_0x2b2ba7);endRouting(_0x2b2ba7,_0x481cfd,_0x58b61a,_0x7b934d);clearTimeout(_0x5f25c6);_0x157778['close'](!![]);_0x368429[_0xf825('0x4e')]();},_0xdb82d0);switch(_0x481cfd[_0xf825('0x4f')]){case _0xf825('0x50'):strategy[_0xf825('0x50')](_0x157778,_0x481cfd,_0x7b934d,_0x58b61a);break;default:strategy[_0xf825('0x51')](_0x157778,_0x481cfd,_0x7b934d,_0x58b61a);}}else{logger[_0xf825('0x35')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x2b2ba7,_0x370b65[_0xf825('0x31')]);_0x368429['stop']();}}}catch(_0xb084b6){logger[_0xf825('0x35')](_0xf825('0x52'),_0x2b2ba7,_0xb084b6[_0xf825('0x53')]);_0x368429[_0xf825('0x43')]();}};}; \ No newline at end of file +var _0x7130=['rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','seq-queue','moment','ioredis','../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','account','queue','from','joinAt','emit','clone','push','capitalize','InteractionId','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','channel','QueueId','upperFirst','interaction','message','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','Queues','atimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy'];(function(_0x570931,_0x594f60){var _0x13b46e=function(_0xc71730){while(--_0xc71730){_0x570931['push'](_0x570931['shift']());}};_0x13b46e(++_0x594f60);}(_0x7130,0x1a7));var _0x0713=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x7130[_0xda464c];return _0x19e222;};'use strict';var schema=require(_0x0713('0x0'));var _=require(_0x0713('0x1'));var util=require('util');var seqqueue=require(_0x0713('0x2'));var moment=require(_0x0713('0x3'));var Redis=require(_0x0713('0x4'));var config=require('../../../../config/environment');var logger=require(_0x0713('0x5'))(_0x0713('0x6'));var strategy=require(_0x0713('0x7'));config[_0x0713('0x8')]=_[_0x0713('0x9')](config[_0x0713('0x8')],{'host':_0x0713('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0713('0x8')]));var attributes=['id',_0x0713('0xb'),_0x0713('0xc'),_0x0713('0xd'),_0x0713('0xe'),_0x0713('0xf')];function emit(_0x385f33,_0x5a9b93,_0x10776e){io['to'](_0x385f33)[_0x0713('0x10')](_0x5a9b93,_0x10776e);}function emitChannelQueueInteraction(_0x5dfcfc,_0x5a3791,_0x5f40c1,_0x1a7e50,_0x1ab3e1,_0x5a6ada,_0x258acb,_0x2ce0ee){var _0x9e3e5c=_[_0x0713('0x11')](_0x5f40c1);_0x9e3e5c[_0x0713('0xb')]=_0x2ce0ee;_0x9e3e5c[_0x0713('0xd')]=_0x5a3791;_0x9e3e5c[_0x0713('0xc')]=_0x1a7e50;_0x9e3e5c['id']=_0x1ab3e1;if(_0x5a6ada){attributes[_0x0713('0x12')](_[_0x0713('0x13')](_0x5dfcfc)+_0x0713('0x14'));_0x258acb[util['format'](_0x0713('0x15'),_0x5dfcfc)][_0x1ab3e1]=_[_0x0713('0x16')](_0x9e3e5c,attributes);}else{delete _0x258acb[util[_0x0713('0x17')](_0x0713('0x15'),_0x5dfcfc)][_0x1ab3e1];}emit(util[_0x0713('0x17')](_0x0713('0x18'),_0x5dfcfc,_0x5a3791),util[_0x0713('0x17')](_0x0713('0x19'),_0x5dfcfc,_0x5a6ada?_0x0713('0x1a'):_0x0713('0x1b')),_['pick'](_0x9e3e5c,attributes));}var rpc={'openchannelQueueReport':require(_0x0713('0x1c')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x0713('0x1d')),'faxQueueReport':require(_0x0713('0x1e')),'whatsappQueueReport':require(_0x0713('0x1f')),'chatInteraction':require(_0x0713('0x20')),'faxInteraction':require(_0x0713('0x21')),'mailInteraction':require('../../rpc/mailInteraction'),'openchannelInteraction':require(_0x0713('0x22')),'smsInteraction':require(_0x0713('0x23')),'whatsappInteraction':require(_0x0713('0x24'))};var queue=schema({'name':{'type':_0x0713('0x25'),'required':!![],'message':_0x0713('0x26')},'timeout':{'type':'number','message':_0x0713('0x27')}});function startRouting(_0x5d1db3,_0x321824,_0x17bf55,_0x122532){if(_0x5d1db3&&_0x321824&&_0x17bf55){_0x321824['waiting']+=0x1;var _0x5517ad={'uniqueid':_0x5d1db3,'from':_0x17bf55[_0x0713('0x28')]?_0x17bf55['body'][_0x0713('0xe')]:'','joinAt':moment()[_0x0713('0x17')](_0x0713('0x29')),'ContactId':_0x17bf55[_0x0713('0x2a')]?_0x17bf55[_0x0713('0x2a')]['id']:null,'ListId':_0x17bf55['list']?_0x17bf55['list']['id']:null};_0x5517ad[_['upperFirst'](_0x17bf55[_0x0713('0x2b')])+_0x0713('0x2c')]=_0x321824['id']||null;_0x5517ad[_[_0x0713('0x2d')](_0x17bf55[_0x0713('0x2b')])+'InteractionId']=_0x17bf55[_0x0713('0x2e')]?_0x17bf55[_0x0713('0x2e')]['id']:null;_0x5517ad[_[_0x0713('0x2d')](_0x17bf55[_0x0713('0x2b')])+'MessageId']=_0x17bf55[_0x0713('0x2f')]?_0x17bf55[_0x0713('0x2f')]['id']:null;_0x5517ad[_[_0x0713('0x2d')](_0x17bf55[_0x0713('0x2b')])+(_0x17bf55['channel']!=='chat'?_0x0713('0x30'):'WebsiteId')]=_0x17bf55[_0x0713('0xc')]?_0x17bf55['account']['id']:null;logger[_0x0713('0x31')](util[_0x0713('0x17')](_0x0713('0x32'),_0x5d1db3,_0x321824[_0x0713('0x33')]));emitChannelQueueInteraction(_0x17bf55[_0x0713('0x2b')],_0x321824[_0x0713('0x33')],_0x5517ad,_0x17bf55[_0x0713('0xc')][_0x0713('0x33')],_0x17bf55[_0x0713('0x2f')]['id'],!![],_0x122532,_0x321824['id']);if(rpc[_0x17bf55['channel']+'QueueReport']){return rpc[_0x17bf55[_0x0713('0x2b')]+_0x0713('0x34')][_0x0713('0x35')](_0x5517ad)[_0x0713('0x36')](function(_0x29fd23){logger[_0x0713('0x37')](_0x0713('0x38'),_0x29fd23);});}}}function stopRouting(_0x487bdb,_0x537903,_0x4c73ed,_0x5baaeb){if(_0x487bdb&&_0x537903){_0x537903[_0x0713('0x39')]-=0x1;var _0x3c33ee={'leaveAt':moment()[_0x0713('0x17')](_0x0713('0x29')),'acceptAt':moment()[_0x0713('0x17')](_0x0713('0x29')),'reason':_0x0713('0x3a')};logger[_0x0713('0x31')](util[_0x0713('0x17')](_0x0713('0x3b'),_0x487bdb,_0x537903[_0x0713('0x33')]));emitChannelQueueInteraction(_0x4c73ed['channel'],_0x537903[_0x0713('0x33')],_0x4c73ed[_0x0713('0x28')],_0x4c73ed['account'][_0x0713('0x33')],_0x4c73ed[_0x0713('0x2f')]['id'],![],_0x5baaeb,_0x537903['id']);return rpc[_0x4c73ed[_0x0713('0x2b')]+_0x0713('0x3c')][_0x0713('0x3d')](_0x4c73ed[_0x0713('0x2e')]['id'],{'queueId':_0x537903['id']})[_0x0713('0x3e')](function(){if(rpc[_0x4c73ed[_0x0713('0x2b')]+_0x0713('0x34')]){return rpc[_0x4c73ed['channel']+_0x0713('0x34')]['update'](_0x487bdb,_0x3c33ee)[_0x0713('0x36')](function(_0x3296d3){logger['error'](_0x0713('0x3f'),_0x3296d3);});}});}}function endRouting(_0x39dc80,_0x9bd749,_0x138232,_0x2f0079){if(_0x39dc80&&_0x9bd749){_0x9bd749[_0x0713('0x39')]-=0x1;var _0x22e5ea={'leaveAt':moment()[_0x0713('0x17')](_0x0713('0x29')),'exitAt':moment()['format'](_0x0713('0x29')),'reason':'timeout'};logger[_0x0713('0x31')](util[_0x0713('0x17')](_0x0713('0x40'),_0x39dc80,_0x9bd749['name']));emitChannelQueueInteraction(_0x138232['channel'],_0x9bd749[_0x0713('0x33')],_0x138232[_0x0713('0x28')],_0x138232['account']['name'],_0x138232[_0x0713('0x2f')]['id'],![],_0x2f0079);if(rpc[_0x138232[_0x0713('0x2b')]+_0x0713('0x34')]){return rpc[_0x138232[_0x0713('0x2b')]+_0x0713('0x34')][_0x0713('0x3d')](_0x39dc80,_0x22e5ea)[_0x0713('0x36')](function(_0xfc6727){logger['error']('update\x20queue\x20report',_0xfc6727);});}}}function handleFindQueue(_0x5e61fe){return function(_0x16537e){return _0x16537e[_0x0713('0x33')][_0x0713('0x41')]()===_0x5e61fe[_0x0713('0x41')]();};}exports[_0x0713('0x42')]=function(_0x454708,_0x230143,_0x2f8447,_0x5b4705){return function(_0x39f6fb){try{var _0x531ec9={'name':_0x230143[0x0],'timeout':_0x230143[0x1]};var _0x4fc2cf=queue[_0x0713('0x0')](_0x531ec9,{'typecast':!![]});if(_0x4fc2cf[_0x0713('0x43')]){logger[_0x0713('0x37')](_0x0713('0x44'),_0x454708,_[_0x0713('0x45')](_0x4fc2cf,_0x0713('0x2f'))[_0x0713('0x46')](',\x20'));_0x39f6fb[_0x0713('0x47')]();}else{var _0x67514d=_['find'](_0x2f8447[_0x5b4705[_0x0713('0x2b')]+_0x0713('0x48')],handleFindQueue(_0x531ec9[_0x0713('0x33')]));if(_0x67514d){startRouting(_0x454708,_0x67514d,_0x5b4705,_0x2f8447);var _0x2b88a9=(_0x67514d['timeout']||0xa)*0x3e8;var _0x29ef0d=(_0x531ec9['timeout']||0x14)*0x3e8;var _0x3fa76d;if(_0x2b88a9>_0x29ef0d){_0x29ef0d=_0x2b88a9;}var _0x23bcfb=seqqueue['createQueue'](_0x2b88a9);_0x23bcfb['id']=_0x454708;_0x23bcfb[_0x0713('0x49')]=_0x2b88a9;_0x23bcfb['qtimeout']=_0x29ef0d;_0x23bcfb[_0x0713('0x2b')]=_0x5b4705['channel'];_0x2f8447['rules'][_0x454708]['on'](_0x0713('0x4a'),function(){logger[_0x0713('0x31')](_0x0713('0x4b'),_0x454708);stopRouting(_0x454708,_0x67514d,_0x5b4705,_0x2f8447);clearTimeout(_0x3fa76d);_0x3fa76d=undefined;_0x23bcfb[_0x0713('0x4c')](!![]);if(_0x2f8447['rules'][_0x454708]){delete _0x2f8447[_0x0713('0x4d')][_0x454708];}_0x39f6fb[_0x0713('0x47')]();});_0x2f8447[_0x0713('0x4d')][_0x454708]['on']('complete',function(){if(_0x2f8447['rules'][_0x454708]){delete _0x2f8447['rules'][_0x454708];}});_0x3fa76d=setTimeout(function(){logger[_0x0713('0x31')](_0x0713('0x4e'),_0x454708);endRouting(_0x454708,_0x67514d,_0x5b4705,_0x2f8447);clearTimeout(_0x3fa76d);_0x23bcfb[_0x0713('0x4c')](!![]);_0x39f6fb[_0x0713('0x4f')]();},_0x29ef0d);switch(_0x67514d[_0x0713('0x50')]){case _0x0713('0x51'):strategy[_0x0713('0x51')](_0x23bcfb,_0x67514d,_0x2f8447,_0x5b4705);break;default:strategy['beepall'](_0x23bcfb,_0x67514d,_0x2f8447,_0x5b4705);}}else{logger['error'](_0x0713('0x52'),_0x454708,_0x531ec9[_0x0713('0x33')]);_0x39f6fb[_0x0713('0x47')]();}}}catch(_0x37aa92){logger[_0x0713('0x37')](_0x0713('0x44'),_0x454708,_0x37aa92[_0x0713('0x53')]);_0x39f6fb[_0x0713('0x47')]();}};}; \ 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 d0d5500..f42a13b 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 _0x3eea=['STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','bind','timeout','drained','prototype','handleRun','handleTimeout','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','channel','busy','busyQueue','saveWaitingNotification','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','removeWaitingNotification'];(function(_0x2b8a92,_0x192f64){var _0x31f0da=function(_0x208455){while(--_0x208455){_0x2b8a92['push'](_0x2b8a92['shift']());}};_0x31f0da(++_0x192f64);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x15635c,_0x396341){_0x15635c=_0x15635c-0x0;var _0x3f391e=_0x3eea[_0x15635c];return _0x3f391e;};'use strict';var _=require(_0xa3ee('0x0'));var uuid=require('uuid');var util=require(_0xa3ee('0x1'));var logger=require(_0xa3ee('0x2'))(_0xa3ee('0x3'));var Agent=function(_0x1c6a49,_0x46acfa,_0x269141,_0x104913){this[_0xa3ee('0x4')]=uuid['v4']();this[_0xa3ee('0x5')]=_0x1c6a49;this[_0xa3ee('0x6')]=_0x46acfa;this[_0xa3ee('0x7')]=_0x269141;this['routing']=_0x104913;this['squeue'][_0xa3ee('0x8')](this['handleRun'][_0xa3ee('0x9')](this),this['handleTimeout'][_0xa3ee('0x9')](this));this['squeue']['on'](_0xa3ee('0xa'),this['handleTimeout'][_0xa3ee('0x9')](this));this[_0xa3ee('0x5')]['on'](_0xa3ee('0xb'),this['handleDrained'][_0xa3ee('0x9')](this));};Agent[_0xa3ee('0xc')]['push']=function(){this['squeue'][_0xa3ee('0x8')](this[_0xa3ee('0xd')][_0xa3ee('0x9')](this),this[_0xa3ee('0xe')]['bind'](this));};Agent[_0xa3ee('0xc')]['handleDrained']=function(){this[_0xa3ee('0xe')](!![]);};Agent[_0xa3ee('0xc')][_0xa3ee('0xd')]=function(){logger[_0xa3ee('0xf')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0xa3ee('0x5')]['id'],this[_0xa3ee('0x6')]['id']);if(_['isNil'](this['realtime']['agents'][this[_0xa3ee('0x6')]['id']])){logger[_0xa3ee('0xf')](_0xa3ee('0x10'),this[_0xa3ee('0x5')]['id'],this['agent']['id']);setTimeout(this[_0xa3ee('0x8')][_0xa3ee('0x9')](this),0x3e8);}else{if(this[_0xa3ee('0x3')][_0xa3ee('0x11')]||util[_0xa3ee('0x12')](this['squeue']['id'],this[_0xa3ee('0x7')][_0xa3ee('0x13')][this[_0xa3ee('0x6')]['id']],this[_0xa3ee('0x5')][_0xa3ee('0x14')],![])){this[_0xa3ee('0x7')]['agents'][this[_0xa3ee('0x6')]['id']][_0xa3ee('0x15')]=!![];this['realtime'][_0xa3ee('0x13')][this['agent']['id']][_0xa3ee('0x16')]=undefined;util[_0xa3ee('0x17')](this[_0xa3ee('0x7')],this[_0xa3ee('0x3')],this[_0xa3ee('0x6')],this[_0xa3ee('0x5')][_0xa3ee('0x14')]);util[_0xa3ee('0x18')](this[_0xa3ee('0x4')],this[_0xa3ee('0x5')]['id'],this['realtime'][_0xa3ee('0x13')][this[_0xa3ee('0x6')]['id']],null,this[_0xa3ee('0x3')]);util[_0xa3ee('0x19')](this[_0xa3ee('0x5')]['id'],this['realtime'][_0xa3ee('0x13')][this[_0xa3ee('0x6')]['id']],_0xa3ee('0x1a')+(this[_0xa3ee('0x3')][_0xa3ee('0x11')]?_0xa3ee('0x1b'):''));}else{logger[_0xa3ee('0xf')](_0xa3ee('0x1c'),this[_0xa3ee('0x5')]['id'],this[_0xa3ee('0x6')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent['prototype'][_0xa3ee('0xe')]=function(_0x481358){if(_[_0xa3ee('0x1d')](this[_0xa3ee('0x7')][_0xa3ee('0x13')][this[_0xa3ee('0x6')]['id']])){return logger[_0xa3ee('0xf')](_0xa3ee('0x10'),this[_0xa3ee('0x5')]['id'],this[_0xa3ee('0x6')]['id']);}else{logger[_0xa3ee('0xf')](_0xa3ee('0x1e'),this['squeue']['id'],this[_0xa3ee('0x6')]['id']);util['hideNotification'](this[_0xa3ee('0x4')],this[_0xa3ee('0x5')]['id'],this['realtime'][_0xa3ee('0x13')][this['agent']['id']],null,this[_0xa3ee('0x3')]);this['realtime'][_0xa3ee('0x13')][this[_0xa3ee('0x6')]['id']][_0xa3ee('0x15')]=![];this[_0xa3ee('0x7')][_0xa3ee('0x13')][this['agent']['id']][_0xa3ee('0x16')]=undefined;util[_0xa3ee('0x1f')](this[_0xa3ee('0x7')],this['routing'],this[_0xa3ee('0x6')],this['squeue'][_0xa3ee('0x14')]);util['writeLog'](this[_0xa3ee('0x5')]['id'],this['realtime'][_0xa3ee('0x13')][this[_0xa3ee('0x6')]['id']],_0x481358?_0xa3ee('0x20'):_0xa3ee('0x21'));}if(!_0x481358){setTimeout(this[_0xa3ee('0x8')][_0xa3ee('0x9')](this),0x3e8);}};function agent(_0xcc8e71,_0x42c66f,_0x256c63,_0x218317){return new Agent(_0xcc8e71,_0x42c66f,_0x256c63,_0x218317);}module[_0xa3ee('0x22')]=agent; \ No newline at end of file +var _0x0faf=['showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push','handleRun','handleTimeout','bind','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','debug','forcedOwnership','channel','busy','busyQueue','saveWaitingNotification'];(function(_0x44c8e4,_0x1227a8){var _0xb9b8bf=function(_0x248c6a){while(--_0x248c6a){_0x44c8e4['push'](_0x44c8e4['shift']());}};_0xb9b8bf(++_0x1227a8);}(_0x0faf,0x132));var _0xf0fa=function(_0xf973b7,_0x46699f){_0xf973b7=_0xf973b7-0x0;var _0x499087=_0x0faf[_0xf973b7];return _0x499087;};'use strict';var _=require(_0xf0fa('0x0'));var uuid=require('uuid');var util=require(_0xf0fa('0x1'));var logger=require(_0xf0fa('0x2'))(_0xf0fa('0x3'));var Agent=function(_0x35a260,_0xccb93e,_0xdc9ce3,_0x515b12){this[_0xf0fa('0x4')]=uuid['v4']();this[_0xf0fa('0x5')]=_0x35a260;this['agent']=_0xccb93e;this[_0xf0fa('0x6')]=_0xdc9ce3;this[_0xf0fa('0x3')]=_0x515b12;this[_0xf0fa('0x5')][_0xf0fa('0x7')](this[_0xf0fa('0x8')]['bind'](this),this[_0xf0fa('0x9')][_0xf0fa('0xa')](this));this['squeue']['on']('timeout',this[_0xf0fa('0x9')][_0xf0fa('0xa')](this));this[_0xf0fa('0x5')]['on'](_0xf0fa('0xb'),this[_0xf0fa('0xc')][_0xf0fa('0xa')](this));};Agent[_0xf0fa('0xd')][_0xf0fa('0x7')]=function(){this['squeue'][_0xf0fa('0x7')](this['handleRun'][_0xf0fa('0xa')](this),this['handleTimeout'][_0xf0fa('0xa')](this));};Agent[_0xf0fa('0xd')][_0xf0fa('0xc')]=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0xf0fa('0x8')]=function(){logger['debug'](_0xf0fa('0xe'),this[_0xf0fa('0x5')]['id'],this[_0xf0fa('0xf')]['id']);if(_[_0xf0fa('0x10')](this[_0xf0fa('0x6')][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']])){logger[_0xf0fa('0x12')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xf0fa('0x5')]['id'],this[_0xf0fa('0xf')]['id']);setTimeout(this[_0xf0fa('0x7')][_0xf0fa('0xa')](this),0x3e8);}else{if(this[_0xf0fa('0x3')][_0xf0fa('0x13')]||util['isAgentAvailable'](this['squeue']['id'],this[_0xf0fa('0x6')][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']],this[_0xf0fa('0x5')][_0xf0fa('0x14')],![])){this[_0xf0fa('0x6')][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']][_0xf0fa('0x15')]=!![];this[_0xf0fa('0x6')][_0xf0fa('0x11')][this['agent']['id']][_0xf0fa('0x16')]=undefined;util[_0xf0fa('0x17')](this[_0xf0fa('0x6')],this[_0xf0fa('0x3')],this[_0xf0fa('0xf')],this[_0xf0fa('0x5')][_0xf0fa('0x14')]);util[_0xf0fa('0x18')](this[_0xf0fa('0x4')],this['squeue']['id'],this[_0xf0fa('0x6')][_0xf0fa('0x11')][this['agent']['id']],null,this[_0xf0fa('0x3')]);util[_0xf0fa('0x19')](this[_0xf0fa('0x5')]['id'],this['realtime'][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']],_0xf0fa('0x1a')+(this[_0xf0fa('0x3')]['forcedOwnership']?':FORCED':''));}else{logger[_0xf0fa('0x12')](_0xf0fa('0x1b'),this[_0xf0fa('0x5')]['id'],this[_0xf0fa('0xf')]['id']);setTimeout(this['push'][_0xf0fa('0xa')](this),0x3e8);}}};Agent[_0xf0fa('0xd')][_0xf0fa('0x9')]=function(_0x5a4fd3){if(_[_0xf0fa('0x10')](this['realtime'][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']])){return logger[_0xf0fa('0x12')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xf0fa('0x5')]['id'],this[_0xf0fa('0xf')]['id']);}else{logger[_0xf0fa('0x12')](_0xf0fa('0x1c'),this[_0xf0fa('0x5')]['id'],this[_0xf0fa('0xf')]['id']);util['hideNotification'](this['notificationId'],this[_0xf0fa('0x5')]['id'],this[_0xf0fa('0x6')]['agents'][this[_0xf0fa('0xf')]['id']],null,this['routing']);this['realtime']['agents'][this[_0xf0fa('0xf')]['id']]['busy']=![];this[_0xf0fa('0x6')][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']][_0xf0fa('0x16')]=undefined;util[_0xf0fa('0x1d')](this[_0xf0fa('0x6')],this[_0xf0fa('0x3')],this[_0xf0fa('0xf')],this['squeue'][_0xf0fa('0x14')]);util[_0xf0fa('0x19')](this[_0xf0fa('0x5')]['id'],this['realtime'][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']],_0x5a4fd3?_0xf0fa('0x1e'):_0xf0fa('0x1f'));}if(!_0x5a4fd3){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x2a9f4b,_0x68b3fe,_0x2a6560,_0x47486f){return new Agent(_0x2a9f4b,_0x68b3fe,_0x2a6560,_0x47486f);}module[_0xf0fa('0x20')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 090491a..fcbb15d 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 _0x7fc2=['busyQueue','removeWaitingNotification','lodash','uuid','./util','routing','notificationId','queue','realtime','push','handleRun','bind','handleTimeout','squeue','timeout','drained','handleDrained','prototype','isNil','length','Agents','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','RINGING','name','saveWaitingNotification','debug','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','writeLog','STOP','TIMEOUT','busy'];(function(_0x5a3fce,_0x3ec616){var _0x138ce3=function(_0x40dd3b){while(--_0x40dd3b){_0x5a3fce['push'](_0x5a3fce['shift']());}};_0x138ce3(++_0x3ec616);}(_0x7fc2,0x8e));var _0x27fc=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x7fc2[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x27fc('0x0'));var uuid=require(_0x27fc('0x1'));var util=require(_0x27fc('0x2'));var logger=require('../../../../../config/logger')(_0x27fc('0x3'));var Beepall=function(_0x2793c0,_0x1f3f35,_0x3eff2a,_0x4d90f5){this[_0x27fc('0x4')]=uuid['v4']();this['squeue']=_0x2793c0;this[_0x27fc('0x5')]=_0x1f3f35;this[_0x27fc('0x6')]=_0x3eff2a;this[_0x27fc('0x3')]=_0x4d90f5;this['squeue'][_0x27fc('0x7')](this[_0x27fc('0x8')][_0x27fc('0x9')](this),this[_0x27fc('0xa')]['bind'](this));this[_0x27fc('0xb')]['on'](_0x27fc('0xc'),this['handleTimeout'][_0x27fc('0x9')](this));this[_0x27fc('0xb')]['on'](_0x27fc('0xd'),this[_0x27fc('0xe')]['bind'](this));};Beepall[_0x27fc('0xf')][_0x27fc('0x7')]=function(){this[_0x27fc('0xb')][_0x27fc('0x7')](this[_0x27fc('0x8')][_0x27fc('0x9')](this),this[_0x27fc('0xa')]['bind'](this));};Beepall[_0x27fc('0xf')]['handleDrained']=function(){this[_0x27fc('0xa')](!![]);};Beepall[_0x27fc('0xf')][_0x27fc('0x8')]=function(){var _0x5f0aef=!![];if(!_[_0x27fc('0x10')](this[_0x27fc('0x5')])&&!_[_0x27fc('0x10')](this[_0x27fc('0x5')]['Agents'])&&this['queue']['Agents'][_0x27fc('0x11')]>0x0){for(var _0x207ea7=0x0,_0x261078;_0x207ea70x0){for(var _0x2e5f42=0x0,_0x35f684;_0x2e5f420x0&&_0x35a74a[_0x49fff9+'CurrentCapacity']>=_0x35a74a[_0x49fff9+_0x5ecf('0x1f')]){writeLog(_0x59fe12,_0x35a74a,_0x49fff9[_0x5ecf('0x20')]()+_0x5ecf('0x21'));return![];}}return!![];};exports[_0x5ecf('0x22')]=function(_0x3b6390,_0x44f18d,_0x15b163,_0x137e90,_0x11d12a){return sendNotification(!![],_0x3b6390,_0x44f18d,_0x15b163,_0x137e90,_0x11d12a);};exports[_0x5ecf('0x23')]=function(_0x1786c7,_0x1a4f14,_0x133738,_0x302562,_0x1273ce){return sendNotification(![],_0x1786c7,_0x1a4f14,_0x133738,_0x302562,_0x1273ce);};exports[_0x5ecf('0x24')]=function(_0x6dd7b4,_0x50597b,_0x1a2677){var _0x5831f8=_0x50597b['interaction']['UserId'];if(!_0x5831f8&&_0x1a2677){_0x5831f8=_0x1a2677['id'];}var _0x460bb2=_[_0x5ecf('0x25')](_0x6dd7b4[_0x50597b[_0x5ecf('0x26')]+'QueuesWaitingInteractions'],function(_0x1bf9e7){var _0x131531=_[_0x5ecf('0x27')](_0x50597b[_0x5ecf('0x26')])+_0x5ecf('0x28');return _0x1bf9e7[_0x131531]===_0x50597b[_0x5ecf('0x29')]['id'];});if(!_0x460bb2&&_0x5831f8&&_0x6dd7b4['agents'][_0x5831f8]){_0x460bb2=_[_0x5ecf('0x25')](_0x6dd7b4[_0x5ecf('0x2a')][_0x5831f8][_0x50597b[_0x5ecf('0x26')]+'WaitingInteractions'],function(_0x232586){return _0x232586['id']===_0x50597b['interaction']['id'];});}return _0x460bb2;};exports['saveWaitingNotification']=function(_0x256f79,_0x17c38b,_0x43685d,_0x57953b){if(_0x43685d&&_0x43685d['id']&&_0x256f79[_0x5ecf('0x2a')]&&_0x256f79[_0x5ecf('0x2a')][_0x43685d['id']]){_0x256f79['agents'][_0x43685d['id']][_0x57953b+_0x5ecf('0x2b')][_0x17c38b[_0x5ecf('0x2c')]['id']]={'id':_0x17c38b[_0x5ecf('0x29')]['id']};}};exports[_0x5ecf('0x2d')]=function(_0x59e1c2,_0x300da7,_0x16b3de,_0x4f66ff){if(_0x16b3de&&_0x16b3de['id']&&_0x59e1c2[_0x5ecf('0x2a')]&&_0x59e1c2[_0x5ecf('0x2a')][_0x16b3de['id']]){delete _0x59e1c2['agents'][_0x16b3de['id']][_0x4f66ff+_0x5ecf('0x2b')][_0x300da7[_0x5ecf('0x2c')]['id']];}};exports['writeLog']=writeLog; \ No newline at end of file +var _0xe4ce=['busy','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','UserId','channel','QueuesWaitingInteractions','capitalize','InteractionId','agents','WaitingInteractions','interaction','removeWaitingNotification','writeLog','util','../utils','ioredis','../../../../../config/environment','redis','localhost','socket.io-emitter','split','\x20interaction','account','notificationShake','body','queue','msg','error','format','message','name','emit','notification:%s','save','remove','debug','isAgentAvailable'];(function(_0x486ed3,_0x5d4e97){var _0x15c28f=function(_0x5df297){while(--_0x5df297){_0x486ed3['push'](_0x486ed3['shift']());}};_0x15c28f(++_0x5d4e97);}(_0xe4ce,0x131));var _0xee4c=function(_0x241cfb,_0x19366e){_0x241cfb=_0x241cfb-0x0;var _0x14218f=_0xe4ce[_0x241cfb];return _0x14218f;};'use strict';var _=require('lodash');var util=require(_0xee4c('0x0'));var utils=require(_0xee4c('0x1'));var Redis=require(_0xee4c('0x2'));var config=require(_0xee4c('0x3'));var logger=require('../../../../../config/logger')('routing');config[_0xee4c('0x4')]=_['defaults'](config['redis'],{'host':_0xee4c('0x5'),'port':0x18eb});var io=require(_0xee4c('0x6'))(new Redis(config['redis']));function sendNotification(_0x760559,_0x4fbe44,_0x2d04f2,_0x3f48f2,_0x13ed9a,_0x99bd8){var _0x151bdf=_0x99bd8||{};var _0x171e01=_0x2d04f2[_0xee4c('0x7')]('.');var _0x8816b={'uniqueid':_0x4fbe44,'channel':_0x171e01[0x0],'id':_0x171e01[0x1],'title':_0x171e01[0x0]+_0xee4c('0x8'),'interactionId':_0x171e01[0x2],'queue':_0x13ed9a?_0x13ed9a['name']:null,'sound':_0x151bdf[_0xee4c('0x9')]['notificationSound'],'shake':_0x151bdf[_0xee4c('0x9')][_0xee4c('0xa')]};try{if(!_0x151bdf['body']){_0x151bdf[_0xee4c('0xb')]={};}if(_0x13ed9a){_0x151bdf[_0xee4c('0xb')][_0xee4c('0xc')]=_0x13ed9a;}else if(_0x151bdf[_0xee4c('0xb')][_0xee4c('0xc')]){delete _0x151bdf['body'][_0xee4c('0xc')];}_0x8816b[_0xee4c('0xd')]=utils['getMustacheRender'](_0x151bdf[_0xee4c('0x9')]['notificationTemplate'],_0x151bdf);}catch(_0x42b909){_0x8816b['msg']='I\x20can\x27t\x20render\x20your\x20template';logger[_0xee4c('0xe')](util[_0xee4c('0xf')]('[%s][QUEUE]\x20%s',_0x4fbe44,_0x42b909[_0xee4c('0x10')]));}io['to'](util[_0xee4c('0xf')]('user:%s',_0x3f48f2[_0xee4c('0x11')]))[_0xee4c('0x12')](util[_0xee4c('0xf')](_0xee4c('0x13'),_0x760559?_0xee4c('0x14'):_0xee4c('0x15')),_0x8816b);}function writeLog(_0x486b32,_0x4e8886,_0x3965a5){return logger[_0xee4c('0x16')](util[_0xee4c('0xf')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x486b32,_0x4e8886['name'],_0x3965a5));}exports[_0xee4c('0x17')]=function(_0x2fde01,_0x129446,_0x4e264b,_0x5e004e){if(_0x129446[_0xee4c('0x18')]){writeLog(_0x2fde01,_0x129446,'BUSY');return![];}if(!_0x129446[_0xee4c('0x19')]){writeLog(_0x2fde01,_0x129446,_0xee4c('0x1a'));return![];}if(_0x129446[_0x4e264b+_0xee4c('0x1b')]){writeLog(_0x2fde01,_0x129446,_0xee4c('0x1c'));return![];}if(_0x5e004e&&_0x129446[_0xee4c('0x1d')](_0x4e264b+_0xee4c('0x1e'))&&_0x129446[_0xee4c('0x1d')](_0x4e264b+_0xee4c('0x1f'))){if(_0x129446[_0x4e264b+_0xee4c('0x1e')]>0x0&&_0x129446[_0x4e264b+_0xee4c('0x1f')]>=_0x129446[_0x4e264b+'Capacity']){writeLog(_0x2fde01,_0x129446,_0x4e264b[_0xee4c('0x20')]()+_0xee4c('0x21'));return![];}}return!![];};exports[_0xee4c('0x22')]=function(_0x36a21c,_0x285a66,_0x3ba9d1,_0x1970b,_0x1c8cda){return sendNotification(!![],_0x36a21c,_0x285a66,_0x3ba9d1,_0x1970b,_0x1c8cda);};exports[_0xee4c('0x23')]=function(_0xd6ec84,_0x185762,_0x2fa82b,_0x5c220d,_0x2ca891){return sendNotification(![],_0xd6ec84,_0x185762,_0x2fa82b,_0x5c220d,_0x2ca891);};exports[_0xee4c('0x24')]=function(_0x182f93,_0x56129c,_0x5e298a){var _0x37dfb7=_0x56129c['interaction'][_0xee4c('0x25')];if(!_0x37dfb7&&_0x5e298a){_0x37dfb7=_0x5e298a['id'];}var _0xb6457f=_['some'](_0x182f93[_0x56129c[_0xee4c('0x26')]+_0xee4c('0x27')],function(_0x48740d){var _0x194493=_[_0xee4c('0x28')](_0x56129c['channel'])+_0xee4c('0x29');return _0x48740d[_0x194493]===_0x56129c['interaction']['id'];});if(!_0xb6457f&&_0x37dfb7&&_0x182f93[_0xee4c('0x2a')][_0x37dfb7]){_0xb6457f=_['some'](_0x182f93[_0xee4c('0x2a')][_0x37dfb7][_0x56129c[_0xee4c('0x26')]+_0xee4c('0x2b')],function(_0x5399ec){return _0x5399ec['id']===_0x56129c[_0xee4c('0x2c')]['id'];});}return _0xb6457f;};exports['saveWaitingNotification']=function(_0x379c9e,_0x5c7bf3,_0x5bd31d,_0xe200bd){if(_0x5bd31d&&_0x5bd31d['id']&&_0x379c9e[_0xee4c('0x2a')]&&_0x379c9e[_0xee4c('0x2a')][_0x5bd31d['id']]){_0x379c9e['agents'][_0x5bd31d['id']][_0xe200bd+_0xee4c('0x2b')][_0x5c7bf3[_0xee4c('0x10')]['id']]={'id':_0x5c7bf3[_0xee4c('0x2c')]['id']};}};exports[_0xee4c('0x2d')]=function(_0x186747,_0x1e91f8,_0x452f5c,_0x5ceace){if(_0x452f5c&&_0x452f5c['id']&&_0x186747['agents']&&_0x186747[_0xee4c('0x2a')][_0x452f5c['id']]){delete _0x186747[_0xee4c('0x2a')][_0x452f5c['id']][_0x5ceace+_0xee4c('0x2b')][_0x1e91f8[_0xee4c('0x10')]['id']];}};exports[_0xee4c('0x2e')]=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 c0a7007..f75798d 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 _0x04f4=['trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','next','getMustacheRender','exec'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x04f4,0xfc));var _0x404f=function(_0x1d3186,_0x1cea9c){_0x1d3186=_0x1d3186-0x0;var _0x2e07e7=_0x04f4[_0x1d3186];return _0x2e07e7;};'use strict';var schema=require('validate');var sh=require(_0x404f('0x0'));var _=require(_0x404f('0x1'));var utils=require(_0x404f('0x2'));var logger=require(_0x404f('0x3'))(_0x404f('0x4'));var system=schema({'command':{'type':_0x404f('0x5'),'required':!![],'message':_0x404f('0x6')}});exports[_0x404f('0x7')]=function(_0x5f282c,_0x195358){return function(_0x399c2f){try{var _0x2ca357={'command':_0x195358[0x0]};var _0x42c7ea=system['validate'](_0x2ca357,{'typecast':!![]});if(_0x42c7ea[_0x404f('0x8')]){logger[_0x404f('0x9')](_0x404f('0xa'),_0x5f282c,_[_0x404f('0xb')](_0x42c7ea,_0x404f('0xc'))[_0x404f('0xd')](',\x20'));logger[_0x404f('0xe')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x5f282c);_0x399c2f[_0x404f('0xf')]();}else{var _0x599c1a=this;var _0x47c522=utils[_0x404f('0x10')](_0x195358[0x0],this);logger[_0x404f('0xe')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x5f282c,_0x47c522);sh[_0x404f('0x11')](_[_0x404f('0x12')](_0x47c522),function(_0x3d5b0e,_0x5803a9){logger[_0x404f('0xe')](_0x404f('0x13'),_0x5f282c,_0x3d5b0e);if(_0x3d5b0e==0x0){var _0xb57871=_0x5803a9[_0x404f('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0x404f('0x15')](_0x195358[0x1])||_['isEmpty'](_0x195358[0x1])){logger['info'](_0x404f('0x16'),_0x5f282c);_0x599c1a[_0x404f('0x17')][_0x195358[0x1]]=_0xb57871;}else{logger['info']('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x5f282c,_0x195358[0x1],_0xb57871);_0x599c1a['body'][_0x195358[0x1]]=_0xb57871;}}_0x399c2f['next']();});}}catch(_0x4b3946){logger[_0x404f('0x9')](_0x404f('0xa'),_0x5f282c,_[_0x404f('0x18')](_0x4b3946)?JSON[_0x404f('0x19')](_0x4b3946):_0x4b3946);logger[_0x404f('0xe')](_0x404f('0x1a'),_0x5f282c);_0x399c2f[_0x404f('0xf')]();}};}; \ No newline at end of file +var _0x5210=['[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','[%s][SYSTEM]\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','message','info'];(function(_0x590a38,_0x2bc65c){var _0xf36626=function(_0x551cd1){while(--_0x551cd1){_0x590a38['push'](_0x590a38['shift']());}};_0xf36626(++_0x2bc65c);}(_0x5210,0x164));var _0x0521=function(_0x582832,_0x275ed9){_0x582832=_0x582832-0x0;var _0x1cb843=_0x5210[_0x582832];return _0x1cb843;};'use strict';var schema=require(_0x0521('0x0'));var sh=require(_0x0521('0x1'));var _=require(_0x0521('0x2'));var utils=require(_0x0521('0x3'));var logger=require('../../../../config/logger')(_0x0521('0x4'));var system=schema({'command':{'type':_0x0521('0x5'),'required':!![],'message':_0x0521('0x6')}});exports[_0x0521('0x7')]=function(_0x59b199,_0x30264f){return function(_0x531bff){try{var _0x430a25={'command':_0x30264f[0x0]};var _0x3d56b4=system[_0x0521('0x0')](_0x430a25,{'typecast':!![]});if(_0x3d56b4[_0x0521('0x8')]){logger[_0x0521('0x9')]('[%s][SYSTEM]\x20%s',_0x59b199,_['map'](_0x3d56b4,_0x0521('0xa'))['join'](',\x20'));logger[_0x0521('0xb')](_0x0521('0xc'),_0x59b199);_0x531bff[_0x0521('0xd')]();}else{var _0x17cbf5=this;var _0x286827=utils['getMustacheRender'](_0x30264f[0x0],this);logger[_0x0521('0xb')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x59b199,_0x286827);sh[_0x0521('0xe')](_['trim'](_0x286827),function(_0x250341,_0x21bd6b){logger[_0x0521('0xb')](_0x0521('0xf'),_0x59b199,_0x250341);if(_0x250341==0x0){var _0x14ae00=_0x21bd6b['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x0521('0x10')](_0x30264f[0x1])||_[_0x0521('0x11')](_0x30264f[0x1])){logger[_0x0521('0xb')](_0x0521('0x12'),_0x59b199);_0x17cbf5['body'][_0x30264f[0x1]]=_0x14ae00;}else{logger[_0x0521('0xb')](_0x0521('0x13'),_0x59b199,_0x30264f[0x1],_0x14ae00);_0x17cbf5['body'][_0x30264f[0x1]]=_0x14ae00;}}_0x531bff[_0x0521('0xd')]();});}}catch(_0x38884c){logger[_0x0521('0x9')](_0x0521('0x14'),_0x59b199,_[_0x0521('0x15')](_0x38884c)?JSON[_0x0521('0x16')](_0x38884c):_0x38884c);logger[_0x0521('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x59b199);_0x531bff[_0x0521('0xd')]();}};}; \ 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 e0b6ed6..d1ddae7 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 _0x93de=['../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then','catch','error','[%s][TAG]\x20%s','stringify','finally','next','isObject','validate','../../rpc/chatInteraction'];(function(_0x2a2166,_0x3a077f){var _0x3bcf50=function(_0x3f0300){while(--_0x3f0300){_0x2a2166['push'](_0x2a2166['shift']());}};_0x3bcf50(++_0x3a077f);}(_0x93de,0xfa));var _0xe93d=function(_0x4231c9,_0x5793ee){_0x4231c9=_0x4231c9-0x0;var _0x4843f9=_0x93de[_0x4231c9];return _0x4843f9;};'use strict';var schema=require(_0xe93d('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xe93d('0x1')),'openchannelInteraction':require(_0xe93d('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xe93d('0x3')),'faxInteraction':require(_0xe93d('0x4')),'whatsappInteraction':require(_0xe93d('0x5'))};var logger=require(_0xe93d('0x6'))(_0xe93d('0x7'));var tag=schema({'tag':{'type':_0xe93d('0x8'),'required':!![],'message':_0xe93d('0x9')}});exports['consequence']=function(_0x2f07ae,_0x5d334e,_0x9b966a,_0x419015){return function(_0x1f4ade){try{var _0x14a545={'tag':_0x5d334e[0x0]};var _0x13228b=tag['validate'](_0x14a545,{'typecast':!![]});if(_0x13228b[_0xe93d('0xa')]){logger['error']('[%s][TAG]\x20%s',_0x2f07ae,_[_0xe93d('0xb')](_0x13228b,_0xe93d('0xc'))[_0xe93d('0xd')](',\x20'));logger[_0xe93d('0xe')](_0xe93d('0xf'),_0x2f07ae);_0x1f4ade['next']();}else{var _0x55266b={'ids':[_0x5d334e[0x0]]};if(rpc[_0x419015[_0xe93d('0x10')]+_0xe93d('0x11')]){rpc[_0x419015[_0xe93d('0x10')]+_0xe93d('0x11')][_0xe93d('0x12')](_0x419015[_0xe93d('0x13')]['id'],_0x55266b)[_0xe93d('0x14')](function(_0x4e8328){logger[_0xe93d('0xe')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x2f07ae,_0x5d334e[0x1],_0x419015[_0xe93d('0x10')],_0x419015[_0xe93d('0x13')]['id']);})[_0xe93d('0x15')](function(_0x53d4cc){logger[_0xe93d('0x16')](_0xe93d('0x17'),_0x2f07ae,JSON[_0xe93d('0x18')](_0x53d4cc));logger[_0xe93d('0xe')](_0xe93d('0xf'),_0x2f07ae);})[_0xe93d('0x19')](function(){_0x1f4ade[_0xe93d('0x1a')]();});}}}catch(_0x2018e1){logger[_0xe93d('0x16')](_0xe93d('0x17'),_0x2f07ae,_[_0xe93d('0x1b')](_0x2018e1)?JSON[_0xe93d('0x18')](_0x2018e1):_0x2018e1);logger[_0xe93d('0xe')](_0xe93d('0xf'),_0x2f07ae);_0x1f4ade[_0xe93d('0x1a')]();}};}; \ No newline at end of file +var _0x4166=['catch','stringify','finally','isObject','lodash','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4166,0x143));var _0x6416=function(_0x162ef7,_0x4a0cc9){_0x162ef7=_0x162ef7-0x0;var _0x2789e5=_0x4166[_0x162ef7];return _0x2789e5;};'use strict';var schema=require('validate');var _=require(_0x6416('0x0'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x6416('0x1')),'mailInteraction':require(_0x6416('0x2')),'faxInteraction':require(_0x6416('0x3')),'whatsappInteraction':require(_0x6416('0x4'))};var logger=require(_0x6416('0x5'))(_0x6416('0x6'));var tag=schema({'tag':{'type':_0x6416('0x7'),'required':!![],'message':_0x6416('0x8')}});exports[_0x6416('0x9')]=function(_0x382587,_0x4ce270,_0x55a045,_0x3079fc){return function(_0x44c24d){try{var _0x3b0fd3={'tag':_0x4ce270[0x0]};var _0x13c40f=tag[_0x6416('0xa')](_0x3b0fd3,{'typecast':!![]});if(_0x13c40f[_0x6416('0xb')]){logger[_0x6416('0xc')](_0x6416('0xd'),_0x382587,_[_0x6416('0xe')](_0x13c40f,_0x6416('0xf'))[_0x6416('0x10')](',\x20'));logger[_0x6416('0x11')](_0x6416('0x12'),_0x382587);_0x44c24d[_0x6416('0x13')]();}else{var _0x2c0627={'ids':[_0x4ce270[0x0]]};if(rpc[_0x3079fc[_0x6416('0x14')]+'Interaction']){rpc[_0x3079fc['channel']+_0x6416('0x15')][_0x6416('0x16')](_0x3079fc[_0x6416('0x17')]['id'],_0x2c0627)[_0x6416('0x18')](function(_0x296719){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x382587,_0x4ce270[0x1],_0x3079fc[_0x6416('0x14')],_0x3079fc[_0x6416('0x17')]['id']);})[_0x6416('0x19')](function(_0x56110e){logger[_0x6416('0xc')]('[%s][TAG]\x20%s',_0x382587,JSON[_0x6416('0x1a')](_0x56110e));logger[_0x6416('0x11')](_0x6416('0x12'),_0x382587);})[_0x6416('0x1b')](function(){_0x44c24d[_0x6416('0x13')]();});}}}catch(_0x766578){logger[_0x6416('0xc')](_0x6416('0xd'),_0x382587,_[_0x6416('0x1c')](_0x766578)?JSON[_0x6416('0x1a')](_0x766578):_0x766578);logger['info'](_0x6416('0x12'),_0x382587);_0x44c24d['next']();}};}; \ 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 883cdb4..2a2d38a 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 _0x616c=['[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','login','stringify','utf8','POST','application/json-rpc','then','parse','result','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop'];(function(_0x547388,_0x519ad5){var _0x546c9a=function(_0x40797c){while(--_0x40797c){_0x547388['push'](_0x547388['shift']());}};_0x546c9a(++_0x519ad5);}(_0x616c,0x162));var _0xc616=function(_0x43ea46,_0xd00853){_0x43ea46=_0x43ea46-0x0;var _0x4ac26a=_0x616c[_0x43ea46];return _0x4ac26a;};'use strict';var rp=require(_0xc616('0x0'));var logger=require(_0xc616('0x1'))(_0xc616('0x2'));var _=require(_0xc616('0x3'));var arr=[];exports['consequence']=function(_0x201e8a,_0x29e8a3){return function(_0x290068){var _0x268788=_0x29e8a3[0xa];var _0x369acd=_0x29e8a3[0xb];var _0x9f3470=_0x29e8a3[0xc];var _0xc939a6=_0x29e8a3[0xd];var _0x488591=_0x29e8a3[0xe];var _0x4b11b3=_0x29e8a3[0xf][_0xc616('0x4')](/\n/g,_0xc616('0x5'));var _0x150d9e=_0x29e8a3[0x10][_0xc616('0x4')](/\n/g,'\x20');if(!arr[_0xc616('0x6')](_0x369acd)){arr[_0xc616('0x7')](_0x369acd);var _0x3452f5=_0x29e8a3[0x3];var _0x52e7af=_0x29e8a3[0x4];var _0x1eb485=_0x29e8a3[0x1];var _0x1ac7d3=_0x29e8a3[0x0];var _0x245215={};_0x245215[_0xc616('0x8')]=_0x29e8a3[0x8]+_0xc616('0x9')+_0x9f3470+'|'+_0x268788+'|'+_0xc939a6+'|'+_0x369acd+'|'+_0x488591;_0x245215[_0xc616('0xa')]=_0x29e8a3[0x7]+_0xc616('0x9')+_0x9f3470+'|'+_0x268788+'|'+_0xc939a6+'|'+_0x369acd+'|'+_0x488591+'|'+_0x4b11b3+'|'+_0x150d9e;_0x245215[_0xc616('0xb')]=_0x29e8a3[0x9];var _0x2263f8={};_0x2263f8[_0xc616('0xc')]=_0xc616('0xd');_0x2263f8[_0xc616('0xe')]=_0xc616('0xf');var _0x36fa29=[];_0x36fa29[_0xc616('0x7')](_0x29e8a3[0x2]);_0x36fa29[_0xc616('0x7')](_0x29e8a3[0x5]);_0x36fa29[_0xc616('0x7')](_0x29e8a3[0x6]);_0x2263f8['params']=_0x36fa29;_0x2263f8['id']=0x1;var _0x5d72a7=JSON[_0xc616('0x10')](_0x2263f8);var _0x23ceb0={'encoding':_0xc616('0x11'),'method':_0xc616('0x12'),'timeout':0x2710,'url':_0x3452f5,'headers':{'Content-Type':_0xc616('0x13')},'body':_0x5d72a7};return rp(_0x23ceb0)[_0xc616('0x14')](function(_0x39b014){const _0x4655d9=JSON[_0xc616('0x15')](_0x39b014);if(!_0x4655d9[_0xc616('0x16')]['logged']){throw new Error(_0xc616('0x17'));}var _0x11b1c7=_0x369acd;var _0x371394=_0xc616('0x18')+_0x1eb485+_0xc616('0x19')+_0x1ac7d3+_0xc616('0x1a')+_0x11b1c7+_0xc616('0x1b')+JSON[_0xc616('0x10')](_0x245215);var _0x402afc=_0x52e7af+'?'+_0x371394;return rp(_0x402afc);})[_0xc616('0x14')](function(_0x3693c9){logger[_0xc616('0x1c')](_0xc616('0x1d'),_0x201e8a,_0x3693c9);_0x290068[_0xc616('0x1e')]();})['catch'](function(_0x1bd50d){logger['error'](_0xc616('0x1f'),_0x201e8a,_[_0xc616('0x20')](_0x1bd50d)?JSON[_0xc616('0x10')](_0x1bd50d):_0x1bd50d);_0x290068[_0xc616('0x1e')]();});}else{logger[_0xc616('0x1c')](_0xc616('0x21'),_0x201e8a);_0x290068[_0xc616('0x22')]();}};}; \ No newline at end of file +var _0xf55b=['logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','error','[%s][TVOX]\x20%s','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','routing','lodash','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','2.0','login','stringify','application/json-rpc','then','parse','result'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xf55b,0x11c));var _0xbf55=function(_0x8a9196,_0x2309a3){_0x8a9196=_0x8a9196-0x0;var _0x290b82=_0xf55b[_0x8a9196];return _0x290b82;};'use strict';var rp=require('request-promise');var logger=require(_0xbf55('0x0'))(_0xbf55('0x1'));var _=require(_0xbf55('0x2'));var arr=[];exports['consequence']=function(_0x2a4e56,_0x452466){return function(_0x18b795){var _0x2b7023=_0x452466[0xa];var _0x78f57=_0x452466[0xb];var _0x40b5b0=_0x452466[0xc];var _0x303e75=_0x452466[0xd];var _0x429c23=_0x452466[0xe];var _0x3eba66=_0x452466[0xf][_0xbf55('0x3')](/\n/g,_0xbf55('0x4'));var _0x2c33f5=_0x452466[0x10][_0xbf55('0x3')](/\n/g,'\x20');if(!arr[_0xbf55('0x5')](_0x78f57)){arr[_0xbf55('0x6')](_0x78f57);var _0x259935=_0x452466[0x3];var _0x2ad0ac=_0x452466[0x4];var _0x79fe9e=_0x452466[0x1];var _0x18f333=_0x452466[0x0];var _0x4c3d02={};_0x4c3d02[_0xbf55('0x7')]=_0x452466[0x8]+_0xbf55('0x8')+_0x40b5b0+'|'+_0x2b7023+'|'+_0x303e75+'|'+_0x78f57+'|'+_0x429c23;_0x4c3d02['urlOnRing']=_0x452466[0x7]+'?params='+_0x40b5b0+'|'+_0x2b7023+'|'+_0x303e75+'|'+_0x78f57+'|'+_0x429c23+'|'+_0x3eba66+'|'+_0x2c33f5;_0x4c3d02['title']=_0x452466[0x9];var _0x4ab9fc={};_0x4ab9fc['jsonrpc']=_0xbf55('0x9');_0x4ab9fc['method']=_0xbf55('0xa');var _0x6cc4c=[];_0x6cc4c['push'](_0x452466[0x2]);_0x6cc4c[_0xbf55('0x6')](_0x452466[0x5]);_0x6cc4c[_0xbf55('0x6')](_0x452466[0x6]);_0x4ab9fc['params']=_0x6cc4c;_0x4ab9fc['id']=0x1;var _0x42d410=JSON[_0xbf55('0xb')](_0x4ab9fc);var _0x30fa45={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x259935,'headers':{'Content-Type':_0xbf55('0xc')},'body':_0x42d410};return rp(_0x30fa45)[_0xbf55('0xd')](function(_0x4ddf95){const _0x5cf800=JSON[_0xbf55('0xe')](_0x4ddf95);if(!_0x5cf800[_0xbf55('0xf')][_0xbf55('0x10')]){throw new Error(_0xbf55('0x11'));}var _0x5136fa=_0x78f57;var _0x59fd89=_0xbf55('0x12')+_0x79fe9e+_0xbf55('0x13')+_0x18f333+_0xbf55('0x14')+_0x5136fa+'&data='+JSON[_0xbf55('0xb')](_0x4c3d02);var _0x4b0693=_0x2ad0ac+'?'+_0x59fd89;return rp(_0x4b0693);})[_0xbf55('0xd')](function(_0x4fdfe7){logger[_0xbf55('0x15')](_0xbf55('0x16'),_0x2a4e56,_0x4fdfe7);_0x18b795['stop']();})[_0xbf55('0x17')](function(_0x48bb92){logger[_0xbf55('0x18')](_0xbf55('0x19'),_0x2a4e56,_[_0xbf55('0x1a')](_0x48bb92)?JSON[_0xbf55('0xb')](_0x48bb92):_0x48bb92);_0x18b795[_0xbf55('0x1b')]();});}else{logger[_0xbf55('0x15')](_0xbf55('0x1c'),_0x2a4e56);_0x18b795[_0xbf55('0x1d')]();}};}; \ 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 0372781..fb8e773 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 _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x3ae1ab,_0x2a40e2){var _0x2615a4=function(_0x4ea995){while(--_0x4ea995){_0x3ae1ab['push'](_0x3ae1ab['shift']());}};_0x2615a4(++_0x2a40e2);}(_0xe706,0xa3));var _0x6e70=function(_0x501099,_0x223250){_0x501099=_0x501099-0x0;var _0x555ebf=_0xe706[_0x501099];return _0x555ebf;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x1ed1b4,_0x4d4e90){var _0x441e08=function(_0x2612fc){while(--_0x2612fc){_0x1ed1b4['push'](_0x1ed1b4['shift']());}};_0x441e08(++_0x4d4e90);}(_0xe706,0xa3));var _0x6e70=function(_0x1d669e,_0x4921c9){_0x1d669e=_0x1d669e-0x0;var _0x1d1ec7=_0xe706[_0x1d669e];return _0x1d1ec7;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 6044082..8cd2d25 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 _0xdec3=['stack','agent','agents','end','QueueReport','update','UserId','catch','message\x20is\x20empty','busy','capacity','hasOwnProperty','CurrentCapacity','values','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','listen','127.0.0.1','lodash','path','jayson/promise','bluebird','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','map','Intervals','interval','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','existsSync','join','toLowerCase','autoreply','appdata','split','channel','mail','push','slice','dialogflow','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','app','./interval','condition','intervals','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','.js','rules','execute','Applications\x20executed','stringify','matchPath','emit','Skipped\x20routing\x20for\x20%s','error'];(function(_0x35edb4,_0x3423a3){var _0x2bd540=function(_0x306f13){while(--_0x306f13){_0x35edb4['push'](_0x35edb4['shift']());}};_0x2bd540(++_0x3423a3);}(_0xdec3,0x89));var _0x3dec=function(_0x32fb5a,_0x565a38){_0x32fb5a=_0x32fb5a-0x0;var _0x2f212c=_0xdec3[_0x32fb5a];return _0x2f212c;};'use strict';var _=require(_0x3dec('0x0'));var util=require('util');var path=require(_0x3dec('0x1'));var fs=require('fs');var jayson=require(_0x3dec('0x2'));var BPromise=require(_0x3dec('0x3'));var utils=require('./applications/utils');var sUtils=require(_0x3dec('0x4'));var logger=require(_0x3dec('0x5'))(_0x3dec('0x6'));var rpc={'openchannelQueueReport':require(_0x3dec('0x7')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x3dec('0x8')),'smsQueueReport':require(_0x3dec('0x9')),'faxQueueReport':require(_0x3dec('0xa')),'whatsappQueueReport':require(_0x3dec('0xb'))};var RuleEngine=require(_0x3dec('0xc'));function getId(_0x311a74,_0x207dcf,_0x4b32d2){return util[_0x3dec('0xd')](_0x3dec('0xe'),_0x311a74,_0x207dcf||0x0,_0x4b32d2||0x0);}function getIntervals(_0x599552,_0x26a604){var _0x4c5748=[];if(!_['isNil'](_0x26a604[_0x3dec('0xf')])&&!_[_0x3dec('0x10')](_0x599552[_0x26a604['IntervalId']])&&!_[_0x3dec('0x10')](_0x599552[_0x26a604[_0x3dec('0xf')]]['Intervals'])){_0x4c5748=_[_0x3dec('0x11')](_0x599552[_0x26a604[_0x3dec('0xf')]][_0x3dec('0x12')],_0x3dec('0x13'));}else if(!_[_0x3dec('0x10')](_0x26a604[_0x3dec('0x13')])){_0x4c5748=[_0x26a604['interval']];}return _0x4c5748;}exports['listen']=function(_0x3d4759){_0x3d4759['rules']={};return new BPromise(function(_0x41ab02,_0xed2beb){var _0x5702f2={'Start':function(_0x5605b8){var _0x1daae8=this;return new Promise(function(_0x480e08,_0x1fdf82){if(_0x5605b8){try{var _0x4b5ae2=[];var _0x3858ee=getId(_0x5605b8['channel'],_0x5605b8[_0x3dec('0x14')]?_0x5605b8[_0x3dec('0x14')]['id']:0x0,_0x5605b8['interaction']?_0x5605b8[_0x3dec('0x15')]['id']:0x0);var _0x249bc2=sUtils[_0x3dec('0x16')](_0x3d4759,_0x5605b8);if(_0x5605b8[_0x3dec('0x17')]||!_0x249bc2&&_0x5605b8[_0x3dec('0x18')]&&_[_0x3dec('0x19')](_0x5605b8[_0x3dec('0x18')])&&_0x5605b8[_0x3dec('0x18')][_0x3dec('0x1a')]){for(var _0x331c8f=0x0;_0x331c8f<_0x5605b8[_0x3dec('0x18')][_0x3dec('0x1a')];_0x331c8f+=0x1){var _0x41acfb=_0x5605b8[_0x3dec('0x18')][_0x331c8f];if(fs[_0x3dec('0x1b')](path[_0x3dec('0x1c')](__dirname,_0x3dec('0x18'),_0x41acfb['app']+'.js'))){var _0x5de683=[];switch(_0x41acfb['app'][_0x3dec('0x1d')]()){case _0x3dec('0x1e'):var _0x2399dc=_0x41acfb[_0x3dec('0x1f')][_0x3dec('0x20')](',');if(_0x5605b8[_0x3dec('0x21')]===_0x3dec('0x22')){_0x5de683[_0x3dec('0x23')](_0x2399dc[0x0]);_0x5de683[_0x3dec('0x23')](_0x2399dc[0x1]);_0x5de683['push'](_0x2399dc[_0x3dec('0x24')](0x2,_0x2399dc[_0x3dec('0x1a')])[_0x3dec('0x1c')](','));}else{_0x5de683['push'](_0x2399dc[0x0]);_0x5de683[_0x3dec('0x23')](_0x2399dc[_0x3dec('0x24')](0x1,_0x2399dc['length'])[_0x3dec('0x1c')](','));}break;case _0x3dec('0x25'):var _0x5a578f=_0x41acfb[_0x3dec('0x1f')][_0x3dec('0x20')](',');_0x5de683[_0x3dec('0x23')](_0x5a578f[0x0]);_0x5de683[_0x3dec('0x23')](_0x5a578f[0x1]);_0x5de683[_0x3dec('0x23')](_0x5a578f['slice'](0x2,_0x5a578f[_0x3dec('0x1a')])['join'](','));break;case'dialogflowv2':var _0x1b1e2e=_0x41acfb['appdata']['split'](',');_0x5de683[_0x3dec('0x23')](_0x1b1e2e[0x0]);_0x5de683[_0x3dec('0x23')](_0x1b1e2e[0x1]);_0x5de683[_0x3dec('0x23')](_0x1b1e2e[0x2]);_0x5de683[_0x3dec('0x23')](_0x1b1e2e[0x3]);_0x5de683['push'](_0x1b1e2e[_0x3dec('0x24')](0x4,_0x1b1e2e[_0x3dec('0x1a')])[_0x3dec('0x1c')](','));break;case _0x3dec('0x26'):var _0x49c658=_0x41acfb[_0x3dec('0x1f')]['split'](',');_0x5de683['push'](_0x49c658[0x0]);_0x5de683[_0x3dec('0x23')](_0x49c658[0x1]);_0x5de683[_0x3dec('0x23')](_0x49c658[0x2]);_0x5de683[_0x3dec('0x23')](_0x49c658[0x3]);_0x5de683[_0x3dec('0x23')](_0x49c658[_0x3dec('0x24')](0x4,_0x49c658[_0x3dec('0x1a')])['join'](','));break;case'message':_0x5de683[_0x3dec('0x23')](_0x41acfb['appdata']);break;case _0x3dec('0x27'):_0x5de683[_0x3dec('0x23')](_0x41acfb[_0x3dec('0x28')]);_0x5de683[_0x3dec('0x23')](_0x41acfb['appdata']);break;case _0x3dec('0x29'):var _0x4993bc=utils[_0x3dec('0x2a')](_0x5605b8[_0x3dec('0x2b')][_0x3dec('0x2c')],_0x5605b8);var _0x1dfc04=_0x41acfb['appdata']['split'](',');_0x5de683[_0x3dec('0x23')](_0x1dfc04[0x0]);_0x5de683[_0x3dec('0x23')](_0x1dfc04[0x1]);_0x5de683[_0x3dec('0x23')](_0x1dfc04[0x2]);_0x5de683[_0x3dec('0x23')](_0x1dfc04[0x3]);_0x5de683[_0x3dec('0x23')](_0x1dfc04[0x4]);_0x5de683[_0x3dec('0x23')](_0x1dfc04[0x5]);_0x5de683[_0x3dec('0x23')](_0x1dfc04[0x6]);_0x5de683[_0x3dec('0x23')](_0x1dfc04[0x7]);_0x5de683['push'](_0x1dfc04[0x8]);_0x5de683['push'](_0x1dfc04[0x9]);_0x5de683[_0x3dec('0x23')](_0x1dfc04[0xa]);_0x5de683[_0x3dec('0x23')](_0x5605b8[_0x3dec('0x15')]['id']);_0x5de683[_0x3dec('0x23')](_0x5605b8[_0x3dec('0x14')]['id']);_0x5de683['push'](_0x41acfb[_0x3dec('0x2d')]);_0x5de683[_0x3dec('0x23')](_0x5605b8['interaction'][_0x3dec('0x2e')]);_0x5de683[_0x3dec('0x23')](_0x5605b8[_0x3dec('0x2f')]['body']);_0x5de683[_0x3dec('0x23')](_0x4993bc);break;default:_0x5de683=_[_0x3dec('0x10')](_0x41acfb[_0x3dec('0x1f')])?[]:_0x41acfb[_0x3dec('0x1f')][_0x3dec('0x20')](',');}var _0x5ad9af={'id':util[_0x3dec('0xd')](_0x3dec('0x30'),_0x3858ee,_0x41acfb['id'],_0x41acfb[_0x3dec('0x31')]),'condition':require(_0x3dec('0x32'))[_0x3dec('0x33')](_0x3858ee,getIntervals(_0x3d4759[_0x3dec('0x34')],_0x41acfb),_0x3d4759),'consequence':require('./applications/'+_0x41acfb[_0x3dec('0x31')])[_0x3dec('0x35')](_0x3858ee,_0x5de683,_0x3d4759,_0x5605b8),'p':_0x41acfb[_0x3dec('0x36')]||0x0};logger[_0x3dec('0x37')](_0x3dec('0x38'),_0x5ad9af['id'],_0x3dec('0x39'),getIntervals(_0x3d4759['intervals'],_0x41acfb)[_0x3dec('0x1c')](_0x3dec('0x3a')));_0x4b5ae2['push'](_0x5ad9af);}else{logger['error'](_0x3dec('0x3b'),path['join'](__dirname,_0x3dec('0x18'),_0x41acfb[_0x3dec('0x31')]+_0x3dec('0x3c')));}}_0x3d4759[_0x3dec('0x3d')][_0x3858ee]=new RuleEngine(_0x4b5ae2);_0x3d4759['rules'][_0x3858ee][_0x3dec('0x3e')](_0x5605b8,function(_0x58e416){logger['info'](_0x3dec('0x3f'),JSON[_0x3dec('0x40')](_0x58e416[_0x3dec('0x41')]));if(_0x3d4759[_0x3dec('0x3d')][_0x3858ee]){_0x3d4759[_0x3dec('0x3d')][_0x3858ee][_0x3dec('0x42')]('complete');}});return _0x480e08({'code':0xc8,'message':_0x5605b8});}else{if(_0x249bc2){logger[_0x3dec('0x37')](util[_0x3dec('0xd')](_0x3dec('0x43'),_0x3858ee));}else{logger[_0x3dec('0x37')]('No\x20applications\x20to\x20execute');}return _0x480e08({'code':0xc8,'message':_0x5605b8});}}catch(_0x5bcdd3){logger[_0x3dec('0x44')](_0x5bcdd3[_0x3dec('0x45')]);return _0x1fdf82(_0x1daae8['error'](0x1f4,_0x5bcdd3));}}return _0x1fdf82('routing\x20is\x20empty');});},'AcceptMessage':function(_0x283323){var _0x590863=this;return new Promise(function(_0x2ad046,_0x553d85){if(_0x283323['agent']&&_0x283323[_0x3dec('0x46')]['id']){if(_0x3d4759[_0x3dec('0x47')][_0x283323['agent']['id']]){_0x3d4759[_0x3dec('0x47')][_0x283323[_0x3dec('0x46')]['id']]['busy']=![];_0x3d4759[_0x3dec('0x47')][_0x283323[_0x3dec('0x46')]['id']]['busyQueue']=undefined;}}if(_0x283323[_0x3dec('0x14')]&&_0x283323[_0x3dec('0x14')]['id']){try{var _0x2cf703=getId(_0x283323[_0x3dec('0x21')],_0x283323[_0x3dec('0x14')]?_0x283323['message']['id']:0x0,_0x283323[_0x3dec('0x15')]?_0x283323[_0x3dec('0x15')]['id']:0x0);if(_0x3d4759[_0x3dec('0x3d')][_0x2cf703]){_0x3d4759[_0x3dec('0x3d')][_0x2cf703][_0x3dec('0x42')](_0x3dec('0x48'));if(rpc[_0x283323['channel']+_0x3dec('0x49')]){rpc[_0x283323[_0x3dec('0x21')]+_0x3dec('0x49')][_0x3dec('0x4a')](_0x2cf703,{'UserId':_0x283323[_0x3dec('0x14')][_0x3dec('0x4b')]})[_0x3dec('0x4c')](function(){logger[_0x3dec('0x44')]('error\x20update\x20queue\x20report');});}}return _0x2ad046({'code':0xc8,'message':_0x283323});}catch(_0x1ab93d){logger[_0x3dec('0x44')](_0x1ab93d[_0x3dec('0x45')]);return _0x553d85(_0x590863[_0x3dec('0x44')](0x1f4,_0x1ab93d));}}logger['error'](_0x3dec('0x4d'));return _0x553d85(_0x590863[_0x3dec('0x44')](0x1f4,_0x3dec('0x4d')));});},'RejectMessage':function(_0xb48fdd){var _0x5148be=this;return new Promise(function(_0x56782a,_0x313f56){if(_0xb48fdd[_0x3dec('0x46')]&&_0xb48fdd[_0x3dec('0x46')]['id']){try{if(_0x3d4759[_0x3dec('0x47')][_0xb48fdd['agent']['id']]){_0x3d4759['agents'][_0xb48fdd['agent']['id']][_0x3dec('0x4e')]=![];_0x3d4759['agents'][_0xb48fdd[_0x3dec('0x46')]['id']]['busyQueue']=undefined;}return _0x56782a({'code':0xc8,'message':_0xb48fdd});}catch(_0x568fa0){logger[_0x3dec('0x44')](_0x568fa0[_0x3dec('0x45')]);return _0x313f56(_0x5148be['error'](0x1f4,_0x568fa0));}}logger[_0x3dec('0x44')](_0x3dec('0x4d'));return _0x313f56(_0x5148be[_0x3dec('0x44')](0x1f4,_0x3dec('0x4d')));});},'AbandonInteraction':function(_0x2f269e){var _0x3dd362=this;return new Promise(function(_0x3822ee,_0x4aba80){if(_0x2f269e[_0x3dec('0x21')]&&_0x2f269e['interaction']&&_0x2f269e[_0x3dec('0x15')]['id']){try{var _0x46ffe7=getId(_0x2f269e['channel'],_0x2f269e['message']?_0x2f269e['message']['id']:0x0,_0x2f269e[_0x3dec('0x15')]?_0x2f269e[_0x3dec('0x15')]['id']:0x0);if(_0x3d4759[_0x3dec('0x3d')][_0x46ffe7]){_0x3d4759['rules'][_0x46ffe7][_0x3dec('0x42')](_0x3dec('0x48'));}return _0x3822ee({'code':0xc8,'message':_0x2f269e});}catch(_0x142a05){logger[_0x3dec('0x44')](_0x142a05['stack']);return _0x4aba80(_0x3dd362[_0x3dec('0x44')](0x1f4,_0x142a05));}}logger['error'](_0x3dec('0x4d'));return _0x4aba80(_0x3dd362[_0x3dec('0x44')](0x1f4,_0x3dec('0x4d')));});},'AgentCapacity':function(_0x1fe45b){var _0x4f303d=this;return new Promise(function(_0x2bce00,_0x56bc3b){if(_0x3d4759[_0x3dec('0x47')]['hasOwnProperty'](_0x1fe45b['id'])){for(var _0x424728 in _0x1fe45b['capacity']){if(_0x1fe45b[_0x3dec('0x4f')][_0x3dec('0x50')](_0x424728)){if(_0x3d4759[_0x3dec('0x47')][_0x1fe45b['id']]['hasOwnProperty'](_0x424728+_0x3dec('0x51'))){_0x3d4759[_0x3dec('0x47')][_0x1fe45b['id']][_0x424728+_0x3dec('0x51')]=parseInt(_0x1fe45b[_0x3dec('0x4f')][_0x424728],0xa);}}}_0x3d4759[_0x3dec('0x47')][_0x1fe45b['id']]['updateRealtime']();return _0x2bce00({'code':0xc8,'message':_0x3d4759[_0x3dec('0x47')][_0x1fe45b['id']]});}else{return _0x56bc3b(_0x4f303d[_0x3dec('0x44')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x2dc225){return new Promise(function(_0x564c16){var _0x5b42d1=_[_0x3dec('0x52')](_0x3d4759[_0x3dec('0x47')]);if(_0x2dc225&&_0x2dc225['id']){var _0x3d978d=_[_0x3dec('0x53')](_0x5b42d1,function(_0x810c11){return _0x810c11['id']===_0x2dc225['id'];});_0x564c16(_0x3d978d);}else{_0x564c16({'count':_0x5b42d1['length'],'rows':_0x5b42d1});}});},'ChatQueues':function(){return new Promise(function(_0x1dacd7){var _0x2e5eb=[];for(var _0x261bae in _0x3d4759[_0x3dec('0x54')]){if(_0x3d4759[_0x3dec('0x54')][_0x3dec('0x50')](_0x261bae)){var _0x54f9ba=_0x3d4759[_0x3dec('0x54')][_0x261bae];var _0x1b0270={'id':_0x54f9ba['id'],'available':_0x54f9ba[_0x3dec('0x55')],'loggedIn':_0x54f9ba[_0x3dec('0x56')],'name':_0x54f9ba[_0x3dec('0x57')],'paused':_0x54f9ba[_0x3dec('0x58')],'waiting':_0x54f9ba[_0x3dec('0x59')]};_0x2e5eb[_0x3dec('0x23')](_0x1b0270);}}_0x1dacd7({'count':_0x2e5eb[_0x3dec('0x1a')],'rows':_0x2e5eb});});},'MailQueues':function(){return new Promise(function(_0x1162a0){var _0x4f90ea=[];for(var _0x16e8f0 in _0x3d4759[_0x3dec('0x5a')]){if(_0x3d4759['mailQueues']['hasOwnProperty'](_0x16e8f0)){var _0x42d6a4=_0x3d4759['mailQueues'][_0x16e8f0];var _0x2acd8d={'id':_0x42d6a4['id'],'available':_0x42d6a4[_0x3dec('0x55')],'loggedIn':_0x42d6a4[_0x3dec('0x56')],'name':_0x42d6a4[_0x3dec('0x57')],'paused':_0x42d6a4[_0x3dec('0x58')],'waiting':_0x42d6a4[_0x3dec('0x59')]};_0x4f90ea[_0x3dec('0x23')](_0x2acd8d);}}_0x1162a0({'count':_0x4f90ea['length'],'rows':_0x4f90ea});});},'OpenchannelQueues':function(){return new Promise(function(_0x460f62){var _0x904e=[];for(var _0x21cc28 in _0x3d4759[_0x3dec('0x5b')]){if(_0x3d4759['openchannelQueues'][_0x3dec('0x50')](_0x21cc28)){var _0x2c71ce=_0x3d4759[_0x3dec('0x5b')][_0x21cc28];var _0x3af8ac={'id':_0x2c71ce['id'],'available':_0x2c71ce['available'],'loggedIn':_0x2c71ce[_0x3dec('0x56')],'name':_0x2c71ce[_0x3dec('0x57')],'paused':_0x2c71ce[_0x3dec('0x58')],'waiting':_0x2c71ce['waiting']};_0x904e[_0x3dec('0x23')](_0x3af8ac);}}_0x460f62({'count':_0x904e[_0x3dec('0x1a')],'rows':_0x904e});});},'SmsQueues':function(){return new Promise(function(_0x9c04ed){var _0x35adbd=[];for(var _0x2e4cd2 in _0x3d4759[_0x3dec('0x5c')]){if(_0x3d4759[_0x3dec('0x5c')][_0x3dec('0x50')](_0x2e4cd2)){var _0x396447=_0x3d4759[_0x3dec('0x5c')][_0x2e4cd2];var _0x59404c={'id':_0x396447['id'],'available':_0x396447[_0x3dec('0x55')],'loggedIn':_0x396447[_0x3dec('0x56')],'name':_0x396447['name'],'paused':_0x396447['paused'],'waiting':_0x396447[_0x3dec('0x59')]};_0x35adbd['push'](_0x59404c);}}_0x9c04ed({'count':_0x35adbd[_0x3dec('0x1a')],'rows':_0x35adbd});});},'FaxQueues':function(){return new Promise(function(_0x5afb58){var _0x867d11=[];for(var _0x2471f9 in _0x3d4759[_0x3dec('0x5d')]){if(_0x3d4759[_0x3dec('0x5d')][_0x3dec('0x50')](_0x2471f9)){var _0xf56bbe=_0x3d4759[_0x3dec('0x5d')][_0x2471f9];var _0xffb65e={'id':_0xf56bbe['id'],'available':_0xf56bbe['available'],'loggedIn':_0xf56bbe[_0x3dec('0x56')],'name':_0xf56bbe[_0x3dec('0x57')],'paused':_0xf56bbe[_0x3dec('0x58')],'waiting':_0xf56bbe[_0x3dec('0x59')]};_0x867d11[_0x3dec('0x23')](_0xffb65e);}}_0x5afb58({'count':_0x867d11[_0x3dec('0x1a')],'rows':_0x867d11});});},'WhatsappQueues':function(){return new Promise(function(_0x11e543){var _0x53d336=[];for(var _0xfe75cf in _0x3d4759[_0x3dec('0x5e')]){if(_0x3d4759[_0x3dec('0x5e')][_0x3dec('0x50')](_0xfe75cf)){var _0x5f4746=_0x3d4759[_0x3dec('0x5e')][_0xfe75cf];var _0x2d9b8f={'id':_0x5f4746['id'],'available':_0x5f4746[_0x3dec('0x55')],'loggedIn':_0x5f4746[_0x3dec('0x56')],'name':_0x5f4746[_0x3dec('0x57')],'paused':_0x5f4746[_0x3dec('0x58')],'waiting':_0x5f4746['waiting']};_0x53d336[_0x3dec('0x23')](_0x2d9b8f);}}_0x11e543({'count':_0x53d336[_0x3dec('0x1a')],'rows':_0x53d336});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x7bb412){var _0x5031d3=_[_0x3dec('0x52')](_0x3d4759[_0x3dec('0x5f')]);_0x7bb412({'count':_0x5031d3[_0x3dec('0x1a')],'rows':_0x5031d3});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x4f377d){var _0x262d71=_['values'](_0x3d4759[_0x3dec('0x60')]);_0x4f377d({'count':_0x262d71[_0x3dec('0x1a')],'rows':_0x262d71});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x5cc051){var _0x39ce21=_[_0x3dec('0x52')](_0x3d4759[_0x3dec('0x61')]);_0x5cc051({'count':_0x39ce21[_0x3dec('0x1a')],'rows':_0x39ce21});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x165b98){var _0x534465=_[_0x3dec('0x52')](_0x3d4759[_0x3dec('0x62')]);_0x165b98({'count':_0x534465[_0x3dec('0x1a')],'rows':_0x534465});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x578af6){var _0x4cec9e=_[_0x3dec('0x52')](_0x3d4759['faxQueuesWaitingInteractions']);_0x578af6({'count':_0x4cec9e[_0x3dec('0x1a')],'rows':_0x4cec9e});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x199f6f){var _0x4e7a8a=_['values'](_0x3d4759[_0x3dec('0x63')]);_0x199f6f({'count':_0x4e7a8a['length'],'rows':_0x4e7a8a});});}};var _0x10c23a=jayson['server'](_0x5702f2)[_0x3dec('0x64')]();_0x10c23a['on']('error',function(_0x1a8d18){logger[_0x3dec('0x44')](JSON[_0x3dec('0x40')](_0x1a8d18));return _0xed2beb(_0x1a8d18);});_0x10c23a[_0x3dec('0x65')](0x232c,_0x3dec('0x66'),function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x41ab02('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x6f7c=['whatsappQueuesWaitingInteractions','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/whatsappQueueReport','format','isNil','IntervalId','map','Intervals','interval','listen','rules','channel','message','interaction','transfer','applications','isArray','length','existsSync','join','app','.js','toLowerCase','split','mail','push','slice','appdata','dialogflowv2','amazonlex','TagId','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','error','routing\x20is\x20empty','agent','agents','busy','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','find','chatQueues','name','paused','waiting','mailQueues','available','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions'];(function(_0x40da5d,_0x2a76fd){var _0x46d172=function(_0x2a1d01){while(--_0x2a1d01){_0x40da5d['push'](_0x40da5d['shift']());}};_0x46d172(++_0x2a76fd);}(_0x6f7c,0x137));var _0xc6f7=function(_0x59d47d,_0x1cd52c){_0x59d47d=_0x59d47d-0x0;var _0x55aa55=_0x6f7c[_0x59d47d];return _0x55aa55;};'use strict';var _=require(_0xc6f7('0x0'));var util=require(_0xc6f7('0x1'));var path=require(_0xc6f7('0x2'));var fs=require('fs');var jayson=require(_0xc6f7('0x3'));var BPromise=require(_0xc6f7('0x4'));var utils=require(_0xc6f7('0x5'));var sUtils=require(_0xc6f7('0x6'));var logger=require(_0xc6f7('0x7'))('routing');var rpc={'openchannelQueueReport':require(_0xc6f7('0x8')),'mailQueueReport':require(_0xc6f7('0x9')),'chatQueueReport':require(_0xc6f7('0xa')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xc6f7('0xb'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x3da8fe,_0x5325f8,_0x5406b3){return util[_0xc6f7('0xc')]('%s.%s.%s',_0x3da8fe,_0x5325f8||0x0,_0x5406b3||0x0);}function getIntervals(_0x46c779,_0xaeebac){var _0x1cce28=[];if(!_[_0xc6f7('0xd')](_0xaeebac[_0xc6f7('0xe')])&&!_[_0xc6f7('0xd')](_0x46c779[_0xaeebac[_0xc6f7('0xe')]])&&!_[_0xc6f7('0xd')](_0x46c779[_0xaeebac[_0xc6f7('0xe')]]['Intervals'])){_0x1cce28=_[_0xc6f7('0xf')](_0x46c779[_0xaeebac['IntervalId']][_0xc6f7('0x10')],_0xc6f7('0x11'));}else if(!_[_0xc6f7('0xd')](_0xaeebac[_0xc6f7('0x11')])){_0x1cce28=[_0xaeebac[_0xc6f7('0x11')]];}return _0x1cce28;}exports[_0xc6f7('0x12')]=function(_0x4d08e7){_0x4d08e7[_0xc6f7('0x13')]={};return new BPromise(function(_0x52565d,_0x20b428){var _0x4164b5={'Start':function(_0x468789){var _0x2981e8=this;return new Promise(function(_0x15e1a7,_0x484500){if(_0x468789){try{var _0xe54b8d=[];var _0x31ca50=getId(_0x468789[_0xc6f7('0x14')],_0x468789[_0xc6f7('0x15')]?_0x468789[_0xc6f7('0x15')]['id']:0x0,_0x468789['interaction']?_0x468789[_0xc6f7('0x16')]['id']:0x0);var _0x50bb0c=sUtils['checkWaitingNotifications'](_0x4d08e7,_0x468789);if(_0x468789[_0xc6f7('0x17')]||!_0x50bb0c&&_0x468789[_0xc6f7('0x18')]&&_[_0xc6f7('0x19')](_0x468789[_0xc6f7('0x18')])&&_0x468789[_0xc6f7('0x18')][_0xc6f7('0x1a')]){for(var _0xd2445f=0x0;_0xd2445f<_0x468789['applications'][_0xc6f7('0x1a')];_0xd2445f+=0x1){var _0x2dc376=_0x468789[_0xc6f7('0x18')][_0xd2445f];if(fs[_0xc6f7('0x1b')](path[_0xc6f7('0x1c')](__dirname,_0xc6f7('0x18'),_0x2dc376[_0xc6f7('0x1d')]+_0xc6f7('0x1e')))){var _0x418678=[];switch(_0x2dc376[_0xc6f7('0x1d')][_0xc6f7('0x1f')]()){case'autoreply':var _0x34b52a=_0x2dc376['appdata'][_0xc6f7('0x20')](',');if(_0x468789[_0xc6f7('0x14')]===_0xc6f7('0x21')){_0x418678[_0xc6f7('0x22')](_0x34b52a[0x0]);_0x418678[_0xc6f7('0x22')](_0x34b52a[0x1]);_0x418678[_0xc6f7('0x22')](_0x34b52a[_0xc6f7('0x23')](0x2,_0x34b52a[_0xc6f7('0x1a')])[_0xc6f7('0x1c')](','));}else{_0x418678[_0xc6f7('0x22')](_0x34b52a[0x0]);_0x418678['push'](_0x34b52a[_0xc6f7('0x23')](0x1,_0x34b52a[_0xc6f7('0x1a')])[_0xc6f7('0x1c')](','));}break;case'dialogflow':var _0x2e8444=_0x2dc376[_0xc6f7('0x24')][_0xc6f7('0x20')](',');_0x418678['push'](_0x2e8444[0x0]);_0x418678['push'](_0x2e8444[0x1]);_0x418678[_0xc6f7('0x22')](_0x2e8444[_0xc6f7('0x23')](0x2,_0x2e8444[_0xc6f7('0x1a')])[_0xc6f7('0x1c')](','));break;case _0xc6f7('0x25'):var _0x5befb4=_0x2dc376[_0xc6f7('0x24')][_0xc6f7('0x20')](',');_0x418678[_0xc6f7('0x22')](_0x5befb4[0x0]);_0x418678[_0xc6f7('0x22')](_0x5befb4[0x1]);_0x418678[_0xc6f7('0x22')](_0x5befb4[0x2]);_0x418678[_0xc6f7('0x22')](_0x5befb4[0x3]);_0x418678[_0xc6f7('0x22')](_0x5befb4['slice'](0x4,_0x5befb4[_0xc6f7('0x1a')])['join'](','));break;case _0xc6f7('0x26'):var _0x4b4213=_0x2dc376[_0xc6f7('0x24')][_0xc6f7('0x20')](',');_0x418678['push'](_0x4b4213[0x0]);_0x418678['push'](_0x4b4213[0x1]);_0x418678[_0xc6f7('0x22')](_0x4b4213[0x2]);_0x418678[_0xc6f7('0x22')](_0x4b4213[0x3]);_0x418678[_0xc6f7('0x22')](_0x4b4213[_0xc6f7('0x23')](0x4,_0x4b4213[_0xc6f7('0x1a')])[_0xc6f7('0x1c')](','));break;case _0xc6f7('0x15'):_0x418678['push'](_0x2dc376[_0xc6f7('0x24')]);break;case'tag':_0x418678['push'](_0x2dc376[_0xc6f7('0x27')]);_0x418678[_0xc6f7('0x22')](_0x2dc376[_0xc6f7('0x24')]);break;case'tvox':var _0x2f47b3=utils[_0xc6f7('0x28')](_0x468789[_0xc6f7('0x29')][_0xc6f7('0x2a')],_0x468789);var _0x54cb47=_0x2dc376['appdata'][_0xc6f7('0x20')](',');_0x418678['push'](_0x54cb47[0x0]);_0x418678[_0xc6f7('0x22')](_0x54cb47[0x1]);_0x418678['push'](_0x54cb47[0x2]);_0x418678[_0xc6f7('0x22')](_0x54cb47[0x3]);_0x418678[_0xc6f7('0x22')](_0x54cb47[0x4]);_0x418678[_0xc6f7('0x22')](_0x54cb47[0x5]);_0x418678[_0xc6f7('0x22')](_0x54cb47[0x6]);_0x418678[_0xc6f7('0x22')](_0x54cb47[0x7]);_0x418678[_0xc6f7('0x22')](_0x54cb47[0x8]);_0x418678[_0xc6f7('0x22')](_0x54cb47[0x9]);_0x418678[_0xc6f7('0x22')](_0x54cb47[0xa]);_0x418678[_0xc6f7('0x22')](_0x468789['interaction']['id']);_0x418678[_0xc6f7('0x22')](_0x468789[_0xc6f7('0x15')]['id']);_0x418678['push'](_0x2dc376[_0xc6f7('0x2b')]);_0x418678['push'](_0x468789[_0xc6f7('0x16')][_0xc6f7('0x2c')]);_0x418678[_0xc6f7('0x22')](_0x468789[_0xc6f7('0x2d')][_0xc6f7('0x2d')]);_0x418678[_0xc6f7('0x22')](_0x2f47b3);break;default:_0x418678=_[_0xc6f7('0xd')](_0x2dc376[_0xc6f7('0x24')])?[]:_0x2dc376[_0xc6f7('0x24')]['split'](',');}var _0x281c6e={'id':util['format'](_0xc6f7('0x2e'),_0x31ca50,_0x2dc376['id'],_0x2dc376[_0xc6f7('0x1d')]),'condition':require(_0xc6f7('0x2f'))[_0xc6f7('0x30')](_0x31ca50,getIntervals(_0x4d08e7[_0xc6f7('0x31')],_0x2dc376),_0x4d08e7),'consequence':require(_0xc6f7('0x32')+_0x2dc376[_0xc6f7('0x1d')])['consequence'](_0x31ca50,_0x418678,_0x4d08e7,_0x468789),'p':_0x2dc376['priority']||0x0};logger[_0xc6f7('0x33')](_0xc6f7('0x34'),_0x281c6e['id'],_0xc6f7('0x35'),getIntervals(_0x4d08e7[_0xc6f7('0x31')],_0x2dc376)[_0xc6f7('0x1c')](_0xc6f7('0x36')));_0xe54b8d[_0xc6f7('0x22')](_0x281c6e);}else{logger['error'](_0xc6f7('0x37'),path['join'](__dirname,_0xc6f7('0x18'),_0x2dc376[_0xc6f7('0x1d')]+_0xc6f7('0x1e')));}}_0x4d08e7[_0xc6f7('0x13')][_0x31ca50]=new RuleEngine(_0xe54b8d);_0x4d08e7[_0xc6f7('0x13')][_0x31ca50][_0xc6f7('0x38')](_0x468789,function(_0x293373){logger['info'](_0xc6f7('0x39'),JSON[_0xc6f7('0x3a')](_0x293373[_0xc6f7('0x3b')]));if(_0x4d08e7[_0xc6f7('0x13')][_0x31ca50]){_0x4d08e7[_0xc6f7('0x13')][_0x31ca50][_0xc6f7('0x3c')](_0xc6f7('0x3d'));}});return _0x15e1a7({'code':0xc8,'message':_0x468789});}else{if(_0x50bb0c){logger[_0xc6f7('0x33')](util[_0xc6f7('0xc')](_0xc6f7('0x3e'),_0x31ca50));}else{logger[_0xc6f7('0x33')](_0xc6f7('0x3f'));}return _0x15e1a7({'code':0xc8,'message':_0x468789});}}catch(_0x28d4b5){logger[_0xc6f7('0x40')](_0x28d4b5['stack']);return _0x484500(_0x2981e8['error'](0x1f4,_0x28d4b5));}}return _0x484500(_0xc6f7('0x41'));});},'AcceptMessage':function(_0x5d8f55){var _0x186b5b=this;return new Promise(function(_0x37d812,_0x40e0d1){if(_0x5d8f55[_0xc6f7('0x42')]&&_0x5d8f55[_0xc6f7('0x42')]['id']){if(_0x4d08e7['agents'][_0x5d8f55[_0xc6f7('0x42')]['id']]){_0x4d08e7[_0xc6f7('0x43')][_0x5d8f55['agent']['id']][_0xc6f7('0x44')]=![];_0x4d08e7[_0xc6f7('0x43')][_0x5d8f55[_0xc6f7('0x42')]['id']]['busyQueue']=undefined;}}if(_0x5d8f55[_0xc6f7('0x15')]&&_0x5d8f55[_0xc6f7('0x15')]['id']){try{var _0x211285=getId(_0x5d8f55[_0xc6f7('0x14')],_0x5d8f55['message']?_0x5d8f55[_0xc6f7('0x15')]['id']:0x0,_0x5d8f55['interaction']?_0x5d8f55[_0xc6f7('0x16')]['id']:0x0);if(_0x4d08e7[_0xc6f7('0x13')][_0x211285]){_0x4d08e7['rules'][_0x211285][_0xc6f7('0x3c')](_0xc6f7('0x45'));if(rpc[_0x5d8f55[_0xc6f7('0x14')]+_0xc6f7('0x46')]){rpc[_0x5d8f55[_0xc6f7('0x14')]+_0xc6f7('0x46')][_0xc6f7('0x47')](_0x211285,{'UserId':_0x5d8f55[_0xc6f7('0x15')][_0xc6f7('0x48')]})[_0xc6f7('0x49')](function(){logger[_0xc6f7('0x40')](_0xc6f7('0x4a'));});}}return _0x37d812({'code':0xc8,'message':_0x5d8f55});}catch(_0x2ea798){logger[_0xc6f7('0x40')](_0x2ea798[_0xc6f7('0x4b')]);return _0x40e0d1(_0x186b5b[_0xc6f7('0x40')](0x1f4,_0x2ea798));}}logger[_0xc6f7('0x40')](_0xc6f7('0x4c'));return _0x40e0d1(_0x186b5b[_0xc6f7('0x40')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x57f7e1){var _0x5c47c8=this;return new Promise(function(_0xada8e4,_0x2c7836){if(_0x57f7e1[_0xc6f7('0x42')]&&_0x57f7e1['agent']['id']){try{if(_0x4d08e7[_0xc6f7('0x43')][_0x57f7e1[_0xc6f7('0x42')]['id']]){_0x4d08e7[_0xc6f7('0x43')][_0x57f7e1[_0xc6f7('0x42')]['id']][_0xc6f7('0x44')]=![];_0x4d08e7[_0xc6f7('0x43')][_0x57f7e1[_0xc6f7('0x42')]['id']][_0xc6f7('0x4d')]=undefined;}return _0xada8e4({'code':0xc8,'message':_0x57f7e1});}catch(_0x290997){logger[_0xc6f7('0x40')](_0x290997[_0xc6f7('0x4b')]);return _0x2c7836(_0x5c47c8['error'](0x1f4,_0x290997));}}logger[_0xc6f7('0x40')]('message\x20is\x20empty');return _0x2c7836(_0x5c47c8[_0xc6f7('0x40')](0x1f4,_0xc6f7('0x4c')));});},'AbandonInteraction':function(_0x56e8ca){var _0x5ab154=this;return new Promise(function(_0x42439f,_0x4f7913){if(_0x56e8ca[_0xc6f7('0x14')]&&_0x56e8ca[_0xc6f7('0x16')]&&_0x56e8ca['interaction']['id']){try{var _0x47e34c=getId(_0x56e8ca['channel'],_0x56e8ca['message']?_0x56e8ca[_0xc6f7('0x15')]['id']:0x0,_0x56e8ca[_0xc6f7('0x16')]?_0x56e8ca[_0xc6f7('0x16')]['id']:0x0);if(_0x4d08e7[_0xc6f7('0x13')][_0x47e34c]){_0x4d08e7[_0xc6f7('0x13')][_0x47e34c]['emit'](_0xc6f7('0x45'));}return _0x42439f({'code':0xc8,'message':_0x56e8ca});}catch(_0x5ce4a7){logger['error'](_0x5ce4a7[_0xc6f7('0x4b')]);return _0x4f7913(_0x5ab154[_0xc6f7('0x40')](0x1f4,_0x5ce4a7));}}logger['error'](_0xc6f7('0x4c'));return _0x4f7913(_0x5ab154[_0xc6f7('0x40')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x52fc61){var _0x58138a=this;return new Promise(function(_0x21bb2b,_0x5e0f9c){if(_0x4d08e7[_0xc6f7('0x43')][_0xc6f7('0x4e')](_0x52fc61['id'])){for(var _0x4de96a in _0x52fc61[_0xc6f7('0x4f')]){if(_0x52fc61['capacity'][_0xc6f7('0x4e')](_0x4de96a)){if(_0x4d08e7[_0xc6f7('0x43')][_0x52fc61['id']]['hasOwnProperty'](_0x4de96a+_0xc6f7('0x50'))){_0x4d08e7[_0xc6f7('0x43')][_0x52fc61['id']][_0x4de96a+_0xc6f7('0x50')]=parseInt(_0x52fc61['capacity'][_0x4de96a],0xa);}}}_0x4d08e7[_0xc6f7('0x43')][_0x52fc61['id']][_0xc6f7('0x51')]();return _0x21bb2b({'code':0xc8,'message':_0x4d08e7[_0xc6f7('0x43')][_0x52fc61['id']]});}else{return _0x5e0f9c(_0x58138a[_0xc6f7('0x40')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x845f57){return new Promise(function(_0x2973e9){var _0x373768=_['values'](_0x4d08e7[_0xc6f7('0x43')]);if(_0x845f57&&_0x845f57['id']){var _0x14e1ec=_[_0xc6f7('0x52')](_0x373768,function(_0x3cdd4d){return _0x3cdd4d['id']===_0x845f57['id'];});_0x2973e9(_0x14e1ec);}else{_0x2973e9({'count':_0x373768[_0xc6f7('0x1a')],'rows':_0x373768});}});},'ChatQueues':function(){return new Promise(function(_0x40a60d){var _0x19ff19=[];for(var _0x1850c2 in _0x4d08e7[_0xc6f7('0x53')]){if(_0x4d08e7['chatQueues'][_0xc6f7('0x4e')](_0x1850c2)){var _0x2a7294=_0x4d08e7[_0xc6f7('0x53')][_0x1850c2];var _0x346f2f={'id':_0x2a7294['id'],'available':_0x2a7294['available'],'loggedIn':_0x2a7294['loggedIn'],'name':_0x2a7294[_0xc6f7('0x54')],'paused':_0x2a7294[_0xc6f7('0x55')],'waiting':_0x2a7294[_0xc6f7('0x56')]};_0x19ff19[_0xc6f7('0x22')](_0x346f2f);}}_0x40a60d({'count':_0x19ff19['length'],'rows':_0x19ff19});});},'MailQueues':function(){return new Promise(function(_0x39ddb7){var _0x25338f=[];for(var _0x4d80bd in _0x4d08e7[_0xc6f7('0x57')]){if(_0x4d08e7[_0xc6f7('0x57')]['hasOwnProperty'](_0x4d80bd)){var _0x4d1d5f=_0x4d08e7[_0xc6f7('0x57')][_0x4d80bd];var _0x2c338d={'id':_0x4d1d5f['id'],'available':_0x4d1d5f[_0xc6f7('0x58')],'loggedIn':_0x4d1d5f[_0xc6f7('0x59')],'name':_0x4d1d5f[_0xc6f7('0x54')],'paused':_0x4d1d5f[_0xc6f7('0x55')],'waiting':_0x4d1d5f[_0xc6f7('0x56')]};_0x25338f[_0xc6f7('0x22')](_0x2c338d);}}_0x39ddb7({'count':_0x25338f[_0xc6f7('0x1a')],'rows':_0x25338f});});},'OpenchannelQueues':function(){return new Promise(function(_0x40a147){var _0x530fb7=[];for(var _0x2fe4dd in _0x4d08e7[_0xc6f7('0x5a')]){if(_0x4d08e7[_0xc6f7('0x5a')]['hasOwnProperty'](_0x2fe4dd)){var _0x303dc7=_0x4d08e7['openchannelQueues'][_0x2fe4dd];var _0x5192c2={'id':_0x303dc7['id'],'available':_0x303dc7[_0xc6f7('0x58')],'loggedIn':_0x303dc7[_0xc6f7('0x59')],'name':_0x303dc7['name'],'paused':_0x303dc7[_0xc6f7('0x55')],'waiting':_0x303dc7[_0xc6f7('0x56')]};_0x530fb7[_0xc6f7('0x22')](_0x5192c2);}}_0x40a147({'count':_0x530fb7[_0xc6f7('0x1a')],'rows':_0x530fb7});});},'SmsQueues':function(){return new Promise(function(_0x21c960){var _0x5d166e=[];for(var _0x110b44 in _0x4d08e7[_0xc6f7('0x5b')]){if(_0x4d08e7[_0xc6f7('0x5b')][_0xc6f7('0x4e')](_0x110b44)){var _0x2b2bc6=_0x4d08e7[_0xc6f7('0x5b')][_0x110b44];var _0x145821={'id':_0x2b2bc6['id'],'available':_0x2b2bc6[_0xc6f7('0x58')],'loggedIn':_0x2b2bc6[_0xc6f7('0x59')],'name':_0x2b2bc6['name'],'paused':_0x2b2bc6['paused'],'waiting':_0x2b2bc6[_0xc6f7('0x56')]};_0x5d166e['push'](_0x145821);}}_0x21c960({'count':_0x5d166e[_0xc6f7('0x1a')],'rows':_0x5d166e});});},'FaxQueues':function(){return new Promise(function(_0x38aced){var _0x28f133=[];for(var _0x5541bb in _0x4d08e7[_0xc6f7('0x5c')]){if(_0x4d08e7[_0xc6f7('0x5c')][_0xc6f7('0x4e')](_0x5541bb)){var _0x5cc142=_0x4d08e7[_0xc6f7('0x5c')][_0x5541bb];var _0x3ec38a={'id':_0x5cc142['id'],'available':_0x5cc142['available'],'loggedIn':_0x5cc142[_0xc6f7('0x59')],'name':_0x5cc142[_0xc6f7('0x54')],'paused':_0x5cc142[_0xc6f7('0x55')],'waiting':_0x5cc142[_0xc6f7('0x56')]};_0x28f133[_0xc6f7('0x22')](_0x3ec38a);}}_0x38aced({'count':_0x28f133[_0xc6f7('0x1a')],'rows':_0x28f133});});},'WhatsappQueues':function(){return new Promise(function(_0x1b4360){var _0x580dd9=[];for(var _0x4eb879 in _0x4d08e7['whatsappQueues']){if(_0x4d08e7[_0xc6f7('0x5d')][_0xc6f7('0x4e')](_0x4eb879)){var _0xed3020=_0x4d08e7[_0xc6f7('0x5d')][_0x4eb879];var _0x5b0a1c={'id':_0xed3020['id'],'available':_0xed3020[_0xc6f7('0x58')],'loggedIn':_0xed3020[_0xc6f7('0x59')],'name':_0xed3020[_0xc6f7('0x54')],'paused':_0xed3020[_0xc6f7('0x55')],'waiting':_0xed3020[_0xc6f7('0x56')]};_0x580dd9[_0xc6f7('0x22')](_0x5b0a1c);}}_0x1b4360({'count':_0x580dd9[_0xc6f7('0x1a')],'rows':_0x580dd9});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x15dcdc){var _0x5c08c3=_['values'](_0x4d08e7['chatQueuesWaitingInteractions']);_0x15dcdc({'count':_0x5c08c3[_0xc6f7('0x1a')],'rows':_0x5c08c3});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x49df65){var _0x3f41dc=_[_0xc6f7('0x5e')](_0x4d08e7['mailQueuesWaitingInteractions']);_0x49df65({'count':_0x3f41dc[_0xc6f7('0x1a')],'rows':_0x3f41dc});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x5be063){var _0x4f983a=_[_0xc6f7('0x5e')](_0x4d08e7['openchannelQueuesWaitingInteractions']);_0x5be063({'count':_0x4f983a[_0xc6f7('0x1a')],'rows':_0x4f983a});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x22bec7){var _0x43b61e=_[_0xc6f7('0x5e')](_0x4d08e7[_0xc6f7('0x5f')]);_0x22bec7({'count':_0x43b61e[_0xc6f7('0x1a')],'rows':_0x43b61e});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x4b7a17){var _0x3f23fc=_['values'](_0x4d08e7[_0xc6f7('0x60')]);_0x4b7a17({'count':_0x3f23fc[_0xc6f7('0x1a')],'rows':_0x3f23fc});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x29965d){var _0x41e082=_[_0xc6f7('0x5e')](_0x4d08e7[_0xc6f7('0x61')]);_0x29965d({'count':_0x41e082['length'],'rows':_0x41e082});});}};var _0x17831b=jayson['server'](_0x4164b5)[_0xc6f7('0x62')]();_0x17831b['on'](_0xc6f7('0x40'),function(_0xc61b27){logger['error'](JSON[_0xc6f7('0x3a')](_0xc61b27));return _0x20b428(_0xc61b27);});_0x17831b[_0xc6f7('0x12')](0x232c,'127.0.0.1',function(){console[_0xc6f7('0x63')](_0xc6f7('0x64'),0x232c);return _0x52565d(_0xc6f7('0x65')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index b25e67d..a9afb98 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 _0x016e=['message','true','[%s][INTERVAL]\x20%s','all','then','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','join','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','error','result','catch','rules','info','stop','length','push','Command','iftime\x20%s'];(function(_0x1fb428,_0x5586db){var _0x4961c8=function(_0x2b0c29){while(--_0x2b0c29){_0x1fb428['push'](_0x1fb428['shift']());}};_0x4961c8(++_0x5586db);}(_0x016e,0xc7));var _0xe016=function(_0x5b4b09,_0x3ef12e){_0x5b4b09=_0x5b4b09-0x0;var _0x59ec36=_0x016e[_0x5b4b09];return _0x59ec36;};'use strict';var util=require(_0xe016('0x0'));var BPromise=require(_0xe016('0x1'));var jayson=require(_0xe016('0x2'));var _=require(_0xe016('0x3'));var logger=require(_0xe016('0x4'))(_0xe016('0x5'));var client=jayson[_0xe016('0x6')]['http']({'port':0x232a});function request(_0x2cba50,_0x3c43b5){return new BPromise(function(_0x3c51eb,_0x5e2f88){return client['request'](_0x2cba50,_0x3c43b5)['then'](function(_0x10abbf){if(_0x10abbf[_0xe016('0x7')]){return _0x5e2f88(_0x10abbf['error']['message']);}else{return _0x3c51eb(_0x10abbf[_0xe016('0x8')]);}})[_0xe016('0x9')](function(_0x556049){return _0x5e2f88(_0x556049);});});}exports['condition']=function(_0x16d773,_0x2e6e5f,_0x35e12f){return function(_0x754987){if(_0x35e12f[_0xe016('0xa')]&&!_0x35e12f[_0xe016('0xa')][_0x16d773]){logger[_0xe016('0xb')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x16d773);return _0x754987[_0xe016('0xc')]();}var _0x13cb72=[];for(var _0x1b1e96=0x0;_0x1b1e96<_0x2e6e5f[_0xe016('0xd')];_0x1b1e96+=0x1){_0x13cb72[_0xe016('0xe')](request(_0xe016('0xf'),{'command':util['format'](_0xe016('0x10'),_0x2e6e5f[_0x1b1e96])})['then'](function(_0x1b1480){return _0x1b1480&&_0x1b1480[_0xe016('0x11')]&&_0x1b1480[_0xe016('0x11')]['indexOf'](_0xe016('0x12'))>=0x0?!![]:![];})['catch'](function(){logger['error'](_0xe016('0x13'),_0x16d773,_0x2e6e5f[_0x1b1e96]);}));}BPromise[_0xe016('0x14')](_0x13cb72)[_0xe016('0x15')](function(_0x51d90a){var _0x2586c0=_[_0xe016('0x16')](_0x51d90a);logger[_0xe016('0xb')](_0xe016('0x17'),_0x16d773,_0x2e6e5f['join'](_0xe016('0x18')),_0x2586c0);_0x754987['when'](_0x2586c0);})['catch'](function(_0x2bba2f){logger[_0xe016('0x7')](_0xe016('0x17'),_0x16d773,_0x2e6e5f[_0xe016('0x19')](_0xe016('0x18')),_0x2bba2f[_0xe016('0x1a')]);_0x754987['stop']();});};}; \ No newline at end of file +var _0x77c4=['catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','iftime\x20%s','then','indexOf','true','some','info','[%s][INTERVAL]\x20%s\x20%s','join','when','\x20|\x20','stack','util','../../../config/logger','routing','client','http','request','error','message','result'];(function(_0x402781,_0x3b3419){var _0x4141b1=function(_0x348f7d){while(--_0x348f7d){_0x402781['push'](_0x402781['shift']());}};_0x4141b1(++_0x3b3419);}(_0x77c4,0x10a));var _0x477c=function(_0x199379,_0x584999){_0x199379=_0x199379-0x0;var _0x19bbce=_0x77c4[_0x199379];return _0x19bbce;};'use strict';var util=require(_0x477c('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require('lodash');var logger=require(_0x477c('0x1'))(_0x477c('0x2'));var client=jayson[_0x477c('0x3')][_0x477c('0x4')]({'port':0x232a});function request(_0x141da8,_0x51cf05){return new BPromise(function(_0x5d87e3,_0x24ed04){return client[_0x477c('0x5')](_0x141da8,_0x51cf05)['then'](function(_0x4a1390){if(_0x4a1390[_0x477c('0x6')]){return _0x24ed04(_0x4a1390[_0x477c('0x6')][_0x477c('0x7')]);}else{return _0x5d87e3(_0x4a1390[_0x477c('0x8')]);}})[_0x477c('0x9')](function(_0x3c4c40){return _0x24ed04(_0x3c4c40);});});}exports[_0x477c('0xa')]=function(_0x166343,_0x2d00b7,_0x1e2f70){return function(_0x2325df){if(_0x1e2f70['rules']&&!_0x1e2f70[_0x477c('0xb')][_0x166343]){logger['info'](_0x477c('0xc'),_0x166343);return _0x2325df[_0x477c('0xd')]();}var _0x2f7dba=[];for(var _0x8a1887=0x0;_0x8a1887<_0x2d00b7['length'];_0x8a1887+=0x1){_0x2f7dba['push'](request('Command',{'command':util['format'](_0x477c('0xe'),_0x2d00b7[_0x8a1887])})[_0x477c('0xf')](function(_0x1481bf){return _0x1481bf&&_0x1481bf[_0x477c('0x7')]&&_0x1481bf['message'][_0x477c('0x10')](_0x477c('0x11'))>=0x0?!![]:![];})['catch'](function(){logger[_0x477c('0x6')]('[%s][INTERVAL]\x20%s',_0x166343,_0x2d00b7[_0x8a1887]);}));}BPromise['all'](_0x2f7dba)[_0x477c('0xf')](function(_0x376ec4){var _0x243907=_[_0x477c('0x12')](_0x376ec4);logger[_0x477c('0x13')](_0x477c('0x14'),_0x166343,_0x2d00b7[_0x477c('0x15')]('\x20|\x20'),_0x243907);_0x2325df[_0x477c('0x16')](_0x243907);})[_0x477c('0x9')](function(_0x37d367){logger[_0x477c('0x6')]('[%s][INTERVAL]\x20%s\x20%s',_0x166343,_0x2d00b7[_0x477c('0x15')](_0x477c('0x17')),_0x37d367[_0x477c('0x18')]);_0x2325df[_0x477c('0xd')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index db53c00..65b9bb3 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 _0x750a=['interface','calleridnum','connectedlinenum','lastevent','then','type','agentcomplete','acw','acwTimeout','CreateVoiceAgentReport','request','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','now','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','agentconnectAt','complete','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','blind','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfertype','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','agentcalledAt','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','secondtransfererexten','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername'];(function(_0xae55e6,_0x2a5419){var _0x539768=function(_0x416bf8){while(--_0x416bf8){_0xae55e6['push'](_0xae55e6['shift']());}};_0x539768(++_0x2a5419);}(_0x750a,0x140));var _0xa750=function(_0x41d549,_0x13592d){_0x41d549=_0x41d549-0x0;var _0x1fc61e=_0x750a[_0x41d549];return _0x1fc61e;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x499583,_0x139fa5){utils[_0xa750('0x1')](util[_0xa750('0x2')](_0xa750('0x3'),_0x499583[_0xa750('0x4')],_0x499583[_0xa750('0x5')],_0x499583[_0xa750('0x6')],_0x499583[_0xa750('0x7')],_0x499583[_0xa750('0x8')],_0x499583[_0xa750('0x9')],_0x499583[_0xa750('0xa')],_0x499583[_0xa750('0xb')]));if(_0x499583[_0xa750('0x6')]){utils['getVoiceQueueByName'](_0x499583['queue'])[_0xa750('0xc')](function(_0x5b684e){if(_0x5b684e){_0x499583[_0xa750('0xd')]=_0x5b684e[_0xa750('0xd')];_0x499583['agentacw']=_0x499583[_0xa750('0xe')]?_0x5b684e[_0xa750('0xf')]:![];_0x499583['acwtime']=_0x499583['agentacw']?_0x5b684e[_0xa750('0x10')]:0x0;}utils['request'](_0xa750('0x11'),_0x499583);});}else{utils[_0xa750('0x12')]('CreateVoiceAgentReport',_0x499583);}if(_0x139fa5){delete transfers[_0x499583[_0xa750('0x4')]];}else{delete agents[_0x499583[_0xa750('0x13')]];}}exports[_0xa750('0x14')]=function(_0x567c51){try{utils[_0xa750('0x15')](util[_0xa750('0x2')](_0xa750('0x16'),_0x567c51[_0xa750('0x4')]),_0x567c51);agents[_0x567c51[_0xa750('0x13')]]=_0x567c51;agents[_0x567c51[_0xa750('0x13')]]['agentcalledAt']=utils[_0xa750('0x17')]();agents[_0x567c51[_0xa750('0x13')]][_0xa750('0xb')]='called';agents[_0x567c51[_0xa750('0x13')]][_0xa750('0xa')]=null;agents[_0x567c51['destuniqueid']]['connectedlinename']=null;utils[_0xa750('0x1')](util['format'](_0xa750('0x18'),_0x567c51[_0xa750('0x4')],agents[_0x567c51['destuniqueid']][_0xa750('0x7')],_0x567c51['destuniqueid']));}catch(_0x5f28f4){utils[_0xa750('0x19')](util['format'](_0xa750('0x16'),_0x567c51['uniqueid']),_0x5f28f4);}};exports[_0xa750('0x1a')]=function(_0x4a007d){try{if(!_[_0xa750('0x1b')](agents[_0x4a007d['destuniqueid']])){utils[_0xa750('0x15')](util['format']('[%s][agents][agentringnoanswer]',_0x4a007d[_0xa750('0x4')]),_0x4a007d);utils['info'](util[_0xa750('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x4a007d['uniqueid'],agents[_0x4a007d['destuniqueid']]['membername'],_0x4a007d[_0xa750('0x13')]));agents[_0x4a007d[_0xa750('0x13')]][_0xa750('0x1a')]=!![];agents[_0x4a007d[_0xa750('0x13')]][_0xa750('0x1c')]=utils[_0xa750('0x17')]();agents[_0x4a007d[_0xa750('0x13')]][_0xa750('0xb')]=_0xa750('0x1d');agents[_0x4a007d[_0xa750('0x13')]][_0xa750('0x1e')]=_0xa750('0x1d');agents[_0x4a007d[_0xa750('0x13')]][_0xa750('0x1f')]=_0x4a007d[_0xa750('0x20')]?parseInt(_0x4a007d['ringtime'])/0x3e8:0x0;agents[_0x4a007d[_0xa750('0x13')]][_0xa750('0x21')]=0x0;unanswered[_0xa750('0x22')](_0x4a007d['destuniqueid']);}}catch(_0x35ab53){utils[_0xa750('0x19')](util[_0xa750('0x2')](_0xa750('0x23'),_0x4a007d['uniqueid']),_0x35ab53);}};exports[_0xa750('0x24')]=function(_0x34d5e9){try{_[_0xa750('0x25')](agents,function(_0x2aef3a,_0x2c5253){if(_0x2aef3a['uniqueid']==_0x34d5e9[_0xa750('0x4')]&&!_['includes'](unanswered,_0x2aef3a[_0xa750('0x13')])){utils[_0xa750('0x15')](util['format'](_0xa750('0x26'),_0x34d5e9[_0xa750('0x4')]),_0x34d5e9);utils[_0xa750('0x1')](util[_0xa750('0x2')](_0xa750('0x27'),_0x34d5e9[_0xa750('0x4')],_0x2aef3a[_0xa750('0x7')],_0x2aef3a[_0xa750('0x13')]));_0x2aef3a['agentringnoanswer']=!![];_0x2aef3a[_0xa750('0x1c')]=utils['now']();_0x2aef3a[_0xa750('0xb')]=_0xa750('0x28');_0x2aef3a[_0xa750('0x1e')]=_0xa750('0x28');_0x2aef3a['holdtime']=_0x34d5e9[_0xa750('0x1f')];_0x2aef3a[_0xa750('0x21')]=0x0;writeDB(_0x2aef3a);}});}catch(_0x5c2e02){utils[_0xa750('0x19')](util[_0xa750('0x2')](_0xa750('0x26'),_0x34d5e9[_0xa750('0x4')]),_0x5c2e02);}};exports['agentconnect']=function(_0xf60128){try{if(agents[_0xf60128['destuniqueid']]){utils['debug'](util[_0xa750('0x2')](_0xa750('0x29'),_0xf60128[_0xa750('0x4')]),_0xf60128);utils['info'](util[_0xa750('0x2')](_0xa750('0x2a'),_0xf60128[_0xa750('0x4')],agents[_0xf60128['destuniqueid']][_0xa750('0x7')],_0xf60128[_0xa750('0x13')]));agents[_0xf60128[_0xa750('0x13')]]['agentconnectAt']=utils[_0xa750('0x17')]();agents[_0xf60128[_0xa750('0x13')]][_0xa750('0xa')]=_0xf60128['connectedlinenum'];agents[_0xf60128[_0xa750('0x13')]][_0xa750('0x2b')]=_0xf60128[_0xa750('0x2b')];agents[_0xf60128[_0xa750('0x13')]]['holdtime']=_0xf60128['ringtime'];agents[_0xf60128[_0xa750('0x13')]][_0xa750('0xb')]='connect';_[_0xa750('0x25')](agents,function(_0x2f57e9,_0x15d35a){if(_0x2f57e9[_0xa750('0x13')]!=_0xf60128[_0xa750('0x13')]&&_0x2f57e9['uniqueid']==_0xf60128[_0xa750('0x4')]){_0x2f57e9[_0xa750('0x21')]=0x0;_0x2f57e9[_0xa750('0x1f')]=_0xf60128[_0xa750('0x20')];_0x2f57e9[_0xa750('0x1a')]=!![];_0x2f57e9[_0xa750('0x1c')]=utils[_0xa750('0x17')]();_0x2f57e9['lastevent']=_0xa750('0x2c');_0x2f57e9['reason']=_0xa750('0x2c');_0x2f57e9['answeredelsewheredestinationuniqueid']=_0xf60128[_0xa750('0x13')];_0x2f57e9[_0xa750('0x2d')]=_0xf60128[_0xa750('0x7')];writeDB(_0x2f57e9);}});}}catch(_0x1be24e){utils[_0xa750('0x19')](util[_0xa750('0x2')](_0xa750('0x29'),_0xf60128[_0xa750('0x4')]),_0x1be24e);}};exports[_0xa750('0xe')]=function(_0x108a1a){try{if(!_[_0xa750('0x1b')](agents[_0x108a1a[_0xa750('0x13')]])){utils[_0xa750('0x15')](util[_0xa750('0x2')](_0xa750('0x2e'),_0x108a1a[_0xa750('0x4')]),_0x108a1a);utils[_0xa750('0x1')](util[_0xa750('0x2')](_0xa750('0x2f'),_0x108a1a[_0xa750('0x4')],agents[_0x108a1a['destuniqueid']][_0xa750('0x7')],_0x108a1a[_0xa750('0x13')]));agents[_0x108a1a[_0xa750('0x13')]][_0xa750('0xe')]=!![];agents[_0x108a1a[_0xa750('0x13')]][_0xa750('0x30')]=utils[_0xa750('0x17')]();agents[_0x108a1a[_0xa750('0x13')]][_0xa750('0x21')]=utils['diffTime'](agents[_0x108a1a[_0xa750('0x13')]][_0xa750('0x30')],agents[_0x108a1a['destuniqueid']][_0xa750('0x31')]);agents[_0x108a1a[_0xa750('0x13')]][_0xa750('0x1e')]=_0x108a1a[_0xa750('0x1e')];agents[_0x108a1a[_0xa750('0x13')]][_0xa750('0xb')]=_0xa750('0x32');writeDB(agents[_0x108a1a[_0xa750('0x13')]]);}}catch(_0x3faf01){utils[_0xa750('0x19')](util['format'](_0xa750('0x2e'),_0x108a1a[_0xa750('0x4')]),_0x3faf01);}};exports['blindtransfer']=function(_0x93e49f){try{if(!_[_0xa750('0x1b')](agents[_0x93e49f[_0xa750('0x33')]])){utils['debug'](util[_0xa750('0x2')](_0xa750('0x34'),_0x93e49f[_0xa750('0x4')]),_0x93e49f);utils[_0xa750('0x1')](util['format'](_0xa750('0x35'),_0x93e49f[_0xa750('0x4')],agents[_0x93e49f[_0xa750('0x33')]][_0xa750('0x7')],agents[_0x93e49f['transfereruniqueid']][_0xa750('0x4')]));agents[_0x93e49f[_0xa750('0x33')]]['transfer']=!![];agents[_0x93e49f[_0xa750('0x33')]]['transfertype']=_0xa750('0x36');agents[_0x93e49f[_0xa750('0x33')]]['transferexten']=_0x93e49f['extension'];agents[_0x93e49f['transfereruniqueid']][_0xa750('0x37')]=agents[_0x93e49f[_0xa750('0x33')]]['uniqueid'];}}catch(_0xe88dc){utils[_0xa750('0x19')](util[_0xa750('0x2')]('[%s][agents][blindtransfer]',_0x93e49f['uniqueid']),_0xe88dc);}};exports['attendedtransfer']=function(_0x5d8dd2){try{utils[_0xa750('0x15')](util['format'](_0xa750('0x38'),_0x5d8dd2[_0xa750('0x39')]),_0x5d8dd2);if(_0x5d8dd2['origtransfereruniqueid']==_0x5d8dd2[_0xa750('0x3a')]){if(!_['isNil'](agents[_0x5d8dd2[_0xa750('0x3b')]])){utils['info'](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x5d8dd2['origtransfereruniqueid'],agents[_0x5d8dd2[_0xa750('0x3b')]][_0xa750('0x7')]));agents[_0x5d8dd2['secondtransfereruniqueid']]['transfer']=!![];agents[_0x5d8dd2['secondtransfereruniqueid']][_0xa750('0x3c')]=_0xa750('0x3d');agents[_0x5d8dd2[_0xa750('0x3b')]][_0xa750('0x3e')]=_0x5d8dd2[_0xa750('0x3f')];agents[_0x5d8dd2[_0xa750('0x3b')]]['transferuniqueid']=_0x5d8dd2['origtransfereruniqueid'];}if(_0x5d8dd2[_0xa750('0x40')]&&agents[_0x5d8dd2[_0xa750('0x40')]]){agents[_0x5d8dd2[_0xa750('0x40')]][_0xa750('0x41')]=0x1;transfers[_0x5d8dd2[_0xa750('0x40')]]=_['clone'](agents[_0x5d8dd2[_0xa750('0x40')]]);transfers[_0x5d8dd2[_0xa750('0x40')]][_0xa750('0x9')]=agents[_0x5d8dd2[_0xa750('0x3b')]][_0xa750('0x9')];transfers[_0x5d8dd2[_0xa750('0x40')]][_0xa750('0x42')]=agents[_0x5d8dd2[_0xa750('0x3b')]]['calleridname'];transfers[_0x5d8dd2[_0xa750('0x40')]][_0xa750('0x43')]=utils[_0xa750('0x17')]();transfers[_0x5d8dd2[_0xa750('0x40')]][_0xa750('0x31')]=utils['now']();transfers[_0x5d8dd2[_0xa750('0x40')]][_0xa750('0x1f')]=0x0;transfers[_0x5d8dd2[_0xa750('0x40')]][_0xa750('0x41')]=0x2;}}else if(_0x5d8dd2[_0xa750('0x3b')]==_0x5d8dd2[_0xa750('0x44')]){if(!_[_0xa750('0x1b')](agents[_0x5d8dd2[_0xa750('0x39')]])){utils[_0xa750('0x1')](util[_0xa750('0x2')](_0xa750('0x45'),_0x5d8dd2[_0xa750('0x39')],agents[_0x5d8dd2[_0xa750('0x39')]][_0xa750('0x7')]));agents[_0x5d8dd2[_0xa750('0x39')]][_0xa750('0x46')]=!![];agents[_0x5d8dd2['origtransfereruniqueid']][_0xa750('0x3c')]='ATTENDED';agents[_0x5d8dd2[_0xa750('0x39')]][_0xa750('0x3e')]=_0x5d8dd2[_0xa750('0x47')];agents[_0x5d8dd2['origtransfereruniqueid']][_0xa750('0x37')]=_0x5d8dd2[_0xa750('0x3b')];}if(_0x5d8dd2[_0xa750('0x48')]&&agents[_0x5d8dd2[_0xa750('0x48')]]){agents[_0x5d8dd2[_0xa750('0x48')]][_0xa750('0x41')]=0x1;transfers[_0x5d8dd2['transfertargetuniqueid']]=_[_0xa750('0x49')](agents[_0x5d8dd2[_0xa750('0x48')]]);transfers[_0x5d8dd2['transfertargetuniqueid']][_0xa750('0x9')]=agents[_0x5d8dd2[_0xa750('0x39')]][_0xa750('0x9')];transfers[_0x5d8dd2[_0xa750('0x48')]][_0xa750('0x42')]=agents[_0x5d8dd2[_0xa750('0x39')]][_0xa750('0x42')];transfers[_0x5d8dd2[_0xa750('0x48')]][_0xa750('0x43')]=utils[_0xa750('0x17')]();transfers[_0x5d8dd2[_0xa750('0x48')]]['agentconnectAt']=utils['now']();transfers[_0x5d8dd2[_0xa750('0x48')]][_0xa750('0x1f')]=0x0;transfers[_0x5d8dd2[_0xa750('0x48')]][_0xa750('0x41')]=0x2;}}}catch(_0x5e17a0){utils[_0xa750('0x19')](util[_0xa750('0x2')](_0xa750('0x38'),_0x5d8dd2[_0xa750('0x39')]),_0x5e17a0);}};exports[_0xa750('0x4a')]=function(_0x473188){try{utils[_0xa750('0x15')](util[_0xa750('0x2')](_0xa750('0x4b'),_0x473188[_0xa750('0x4')]),_0x473188);if(agents[_0x473188[_0xa750('0x4')]]&&agents[_0x473188['uniqueid']]['reason']===_0xa750('0x1d')){if(_0x473188['cause']==='21'){agents[_0x473188['uniqueid']][_0xa750('0x1e')]=_0xa750('0x4c');agents[_0x473188[_0xa750('0x4')]][_0xa750('0xb')]=_0xa750('0x4c');}utils['info'](util[_0xa750('0x2')](_0xa750('0x4d'),_0x473188[_0xa750('0x4')],agents[_0x473188[_0xa750('0x4')]][_0xa750('0x7')],agents[_0x473188[_0xa750('0x4')]]['reason'],agents[_0x473188['uniqueid']][_0xa750('0xb')]));writeDB(agents[_0x473188[_0xa750('0x4')]]);var _0x30a371=unanswered[_0xa750('0x4e')](_0x473188[_0xa750('0x4')]);if(_0x30a371>-0x1){unanswered[_0xa750('0x4f')](_0x30a371,0x1);}}if(transfers[_0x473188[_0xa750('0x4')]]){transfers[_0x473188[_0xa750('0x4')]]['agentcomplete']=!![];transfers[_0x473188[_0xa750('0x4')]]['agentcompleteAt']=utils['now']();transfers[_0x473188[_0xa750('0x4')]][_0xa750('0x21')]=utils[_0xa750('0x50')](transfers[_0x473188[_0xa750('0x4')]]['agentcompleteAt'],transfers[_0x473188[_0xa750('0x4')]][_0xa750('0x31')]);transfers[_0x473188[_0xa750('0x4')]][_0xa750('0x1e')]='agent';transfers[_0x473188[_0xa750('0x4')]][_0xa750('0xb')]=_0xa750('0x32');utils[_0xa750('0x1')](util[_0xa750('0x2')](_0xa750('0x4d'),_0x473188[_0xa750('0x4')],transfers[_0x473188[_0xa750('0x4')]]['membername'],transfers[_0x473188['uniqueid']][_0xa750('0x1e')],transfers[_0x473188['uniqueid']][_0xa750('0xb')]));writeDB(transfers[_0x473188[_0xa750('0x4')]],!![]);}if(agents[_0x473188['uniqueid']]&&agents[_0x473188[_0xa750('0x4')]]['agentconnectAt']){agents[_0x473188[_0xa750('0x4')]][_0xa750('0xe')]=!![];agents[_0x473188[_0xa750('0x4')]]['agentcompleteAt']=utils[_0xa750('0x17')]();agents[_0x473188[_0xa750('0x4')]][_0xa750('0x21')]=utils[_0xa750('0x50')](agents[_0x473188['uniqueid']]['agentcompleteAt'],agents[_0x473188['uniqueid']][_0xa750('0x31')]);agents[_0x473188[_0xa750('0x4')]]['reason']=agents[_0x473188[_0xa750('0x4')]][_0xa750('0x46')]?_0xa750('0x46'):_0xa750('0x51');agents[_0x473188[_0xa750('0x4')]][_0xa750('0xb')]='complete';utils[_0xa750('0x1')](util[_0xa750('0x2')](_0xa750('0x4d'),_0x473188['uniqueid'],agents[_0x473188[_0xa750('0x4')]][_0xa750('0x7')],agents[_0x473188[_0xa750('0x4')]][_0xa750('0x1e')],agents[_0x473188['uniqueid']][_0xa750('0xb')]));writeDB(agents[_0x473188[_0xa750('0x4')]]);}}catch(_0x32b8e7){utils['error'](util[_0xa750('0x2')]('[%s][agents][hangup]',_0x473188[_0xa750('0x4')]),_0x32b8e7);}}; \ No newline at end of file +var _0x44a3=['agentacw','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','uniqueid','destuniqueid','agentcalledAt','now','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','forIn','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][queuecallerabandon]','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','lastevent','answered_elsewhere','answeredelsewheredestinationuniqueid','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','complete','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','clone','calleridname','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','[%s][agents][hangup]','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','then','type','agentcomplete','acw'];(function(_0x39d474,_0x280fb6){var _0x5915ca=function(_0x5233c1){while(--_0x5233c1){_0x39d474['push'](_0x39d474['shift']());}};_0x5915ca(++_0x280fb6);}(_0x44a3,0x1a9));var _0x344a=function(_0x25a0b9,_0x86e28f){_0x25a0b9=_0x25a0b9-0x0;var _0x30b9ab=_0x44a3[_0x25a0b9];return _0x30b9ab;};'use strict';var _=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var utils=require(_0x344a('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x23cef2,_0xdffe0b){utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x5'),_0x23cef2['uniqueid'],_0x23cef2[_0x344a('0x6')],_0x23cef2[_0x344a('0x7')],_0x23cef2[_0x344a('0x8')],_0x23cef2[_0x344a('0x9')],_0x23cef2[_0x344a('0xa')],_0x23cef2['connectedlinenum'],_0x23cef2['lastevent']));if(_0x23cef2['queue']){utils['getVoiceQueueByName'](_0x23cef2[_0x344a('0x7')])[_0x344a('0xb')](function(_0x3c725e){if(_0x3c725e){_0x23cef2[_0x344a('0xc')]=_0x3c725e[_0x344a('0xc')];_0x23cef2['agentacw']=_0x23cef2[_0x344a('0xd')]?_0x3c725e[_0x344a('0xe')]:![];_0x23cef2['acwtime']=_0x23cef2[_0x344a('0xf')]?_0x3c725e['acwTimeout']:0x0;}utils[_0x344a('0x10')]('CreateVoiceAgentReport',_0x23cef2);});}else{utils[_0x344a('0x10')](_0x344a('0x11'),_0x23cef2);}if(_0xdffe0b){delete transfers[_0x23cef2['uniqueid']];}else{delete agents[_0x23cef2['destuniqueid']];}}exports[_0x344a('0x12')]=function(_0x2ad7eb){try{utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x14'),_0x2ad7eb[_0x344a('0x15')]),_0x2ad7eb);agents[_0x2ad7eb['destuniqueid']]=_0x2ad7eb;agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x17')]=utils[_0x344a('0x18')]();agents[_0x2ad7eb[_0x344a('0x16')]]['lastevent']='called';agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x19')]=null;agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x1a')]=null;utils['info'](util[_0x344a('0x4')](_0x344a('0x1b'),_0x2ad7eb['uniqueid'],agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x8')],_0x2ad7eb[_0x344a('0x16')]));}catch(_0x45a827){utils[_0x344a('0x1c')](util[_0x344a('0x4')](_0x344a('0x14'),_0x2ad7eb[_0x344a('0x15')]),_0x45a827);}};exports[_0x344a('0x1d')]=function(_0x450922){try{if(!_['isNil'](agents[_0x450922[_0x344a('0x16')]])){utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x1e'),_0x450922[_0x344a('0x15')]),_0x450922);utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x1f'),_0x450922[_0x344a('0x15')],agents[_0x450922[_0x344a('0x16')]][_0x344a('0x8')],_0x450922[_0x344a('0x16')]));agents[_0x450922[_0x344a('0x16')]][_0x344a('0x1d')]=!![];agents[_0x450922['destuniqueid']][_0x344a('0x20')]=utils['now']();agents[_0x450922[_0x344a('0x16')]]['lastevent']=_0x344a('0x21');agents[_0x450922[_0x344a('0x16')]][_0x344a('0x22')]=_0x344a('0x21');agents[_0x450922[_0x344a('0x16')]][_0x344a('0x23')]=_0x450922[_0x344a('0x24')]?parseInt(_0x450922[_0x344a('0x24')])/0x3e8:0x0;agents[_0x450922['destuniqueid']][_0x344a('0x25')]=0x0;unanswered[_0x344a('0x26')](_0x450922[_0x344a('0x16')]);}}catch(_0xc02d6){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][agentringnoanswer]',_0x450922[_0x344a('0x15')]),_0xc02d6);}};exports['queuecallerabandon']=function(_0x593cf6){try{_[_0x344a('0x27')](agents,function(_0x14fa86,_0x5a36bb){if(_0x14fa86['uniqueid']==_0x593cf6['uniqueid']&&!_['includes'](unanswered,_0x14fa86[_0x344a('0x16')])){utils[_0x344a('0x13')](util[_0x344a('0x4')]('[%s][agents][queuecallerabandon]',_0x593cf6[_0x344a('0x15')]),_0x593cf6);utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x28'),_0x593cf6[_0x344a('0x15')],_0x14fa86[_0x344a('0x8')],_0x14fa86[_0x344a('0x16')]));_0x14fa86['agentringnoanswer']=!![];_0x14fa86[_0x344a('0x20')]=utils['now']();_0x14fa86['lastevent']='abandoned';_0x14fa86[_0x344a('0x22')]=_0x344a('0x29');_0x14fa86[_0x344a('0x23')]=_0x593cf6[_0x344a('0x23')];_0x14fa86[_0x344a('0x25')]=0x0;writeDB(_0x14fa86);}});}catch(_0xdf6a8f){utils['error'](util[_0x344a('0x4')](_0x344a('0x2a'),_0x593cf6[_0x344a('0x15')]),_0xdf6a8f);}};exports['agentconnect']=function(_0x3698eb){try{if(agents[_0x3698eb[_0x344a('0x16')]]){utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x2b'),_0x3698eb['uniqueid']),_0x3698eb);utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x2c'),_0x3698eb[_0x344a('0x15')],agents[_0x3698eb[_0x344a('0x16')]]['membername'],_0x3698eb[_0x344a('0x16')]));agents[_0x3698eb[_0x344a('0x16')]][_0x344a('0x2d')]=utils[_0x344a('0x18')]();agents[_0x3698eb[_0x344a('0x16')]]['connectedlinenum']=_0x3698eb[_0x344a('0x19')];agents[_0x3698eb[_0x344a('0x16')]][_0x344a('0x1a')]=_0x3698eb[_0x344a('0x1a')];agents[_0x3698eb[_0x344a('0x16')]][_0x344a('0x23')]=_0x3698eb[_0x344a('0x24')];agents[_0x3698eb[_0x344a('0x16')]]['lastevent']=_0x344a('0x2e');_[_0x344a('0x27')](agents,function(_0x3d34c3,_0x28bad9){if(_0x3d34c3[_0x344a('0x16')]!=_0x3698eb['destuniqueid']&&_0x3d34c3[_0x344a('0x15')]==_0x3698eb[_0x344a('0x15')]){_0x3d34c3[_0x344a('0x25')]=0x0;_0x3d34c3[_0x344a('0x23')]=_0x3698eb[_0x344a('0x24')];_0x3d34c3[_0x344a('0x1d')]=!![];_0x3d34c3[_0x344a('0x20')]=utils[_0x344a('0x18')]();_0x3d34c3[_0x344a('0x2f')]='answered_elsewhere';_0x3d34c3[_0x344a('0x22')]=_0x344a('0x30');_0x3d34c3[_0x344a('0x31')]=_0x3698eb[_0x344a('0x16')];_0x3d34c3['answeredelsewheremembername']=_0x3698eb[_0x344a('0x8')];writeDB(_0x3d34c3);}});}}catch(_0x3069ca){utils[_0x344a('0x1c')](util[_0x344a('0x4')](_0x344a('0x2b'),_0x3698eb[_0x344a('0x15')]),_0x3069ca);}};exports[_0x344a('0xd')]=function(_0x372e7d){try{if(!_[_0x344a('0x32')](agents[_0x372e7d[_0x344a('0x16')]])){utils[_0x344a('0x13')](util['format'](_0x344a('0x33'),_0x372e7d[_0x344a('0x15')]),_0x372e7d);utils['info'](util[_0x344a('0x4')](_0x344a('0x34'),_0x372e7d['uniqueid'],agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x8')],_0x372e7d['destuniqueid']));agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0xd')]=!![];agents[_0x372e7d[_0x344a('0x16')]]['agentcompleteAt']=utils[_0x344a('0x18')]();agents[_0x372e7d['destuniqueid']][_0x344a('0x25')]=utils[_0x344a('0x35')](agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x36')],agents[_0x372e7d['destuniqueid']]['agentconnectAt']);agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x22')]=_0x372e7d[_0x344a('0x22')];agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x2f')]=_0x344a('0x37');writeDB(agents[_0x372e7d[_0x344a('0x16')]]);}}catch(_0x23c214){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][agentcomplete]',_0x372e7d[_0x344a('0x15')]),_0x23c214);}};exports[_0x344a('0x38')]=function(_0x6fad37){try{if(!_[_0x344a('0x32')](agents[_0x6fad37['transfereruniqueid']])){utils[_0x344a('0x13')](util['format']('[%s][agents][blindtransfer]',_0x6fad37[_0x344a('0x15')]),_0x6fad37);utils[_0x344a('0x3')](util['format'](_0x344a('0x39'),_0x6fad37[_0x344a('0x15')],agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x8')],agents[_0x6fad37['transfereruniqueid']][_0x344a('0x15')]));agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x3b')]=!![];agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x3c')]=_0x344a('0x3d');agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x3e')]=_0x6fad37[_0x344a('0x3f')];agents[_0x6fad37[_0x344a('0x3a')]]['transferuniqueid']=agents[_0x6fad37[_0x344a('0x3a')]]['uniqueid'];}}catch(_0x1b7f6c){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][blindtransfer]',_0x6fad37[_0x344a('0x15')]),_0x1b7f6c);}};exports[_0x344a('0x40')]=function(_0x188c6b){try{utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x41'),_0x188c6b[_0x344a('0x42')]),_0x188c6b);if(_0x188c6b[_0x344a('0x42')]==_0x188c6b[_0x344a('0x43')]){if(!_['isNil'](agents[_0x188c6b[_0x344a('0x44')]])){utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x45'),_0x188c6b[_0x344a('0x42')],agents[_0x188c6b['secondtransfereruniqueid']][_0x344a('0x8')]));agents[_0x188c6b[_0x344a('0x44')]][_0x344a('0x3b')]=!![];agents[_0x188c6b[_0x344a('0x44')]]['transfertype']=_0x344a('0x46');agents[_0x188c6b[_0x344a('0x44')]]['transferexten']=_0x188c6b[_0x344a('0x47')];agents[_0x188c6b[_0x344a('0x44')]][_0x344a('0x48')]=_0x188c6b[_0x344a('0x42')];}if(_0x188c6b[_0x344a('0x49')]&&agents[_0x188c6b[_0x344a('0x49')]]){agents[_0x188c6b[_0x344a('0x49')]]['agententerreason']=0x1;transfers[_0x188c6b['transfereeuniqueid']]=_['clone'](agents[_0x188c6b[_0x344a('0x49')]]);transfers[_0x188c6b[_0x344a('0x49')]][_0x344a('0xa')]=agents[_0x188c6b[_0x344a('0x44')]]['calleridnum'];transfers[_0x188c6b[_0x344a('0x49')]]['calleridname']=agents[_0x188c6b['secondtransfereruniqueid']]['calleridname'];transfers[_0x188c6b['transfereeuniqueid']][_0x344a('0x17')]=utils[_0x344a('0x18')]();transfers[_0x188c6b[_0x344a('0x49')]][_0x344a('0x2d')]=utils['now']();transfers[_0x188c6b['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x188c6b[_0x344a('0x49')]][_0x344a('0x4a')]=0x2;}}else if(_0x188c6b[_0x344a('0x44')]==_0x188c6b[_0x344a('0x4b')]){if(!_[_0x344a('0x32')](agents[_0x188c6b['origtransfereruniqueid']])){utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x45'),_0x188c6b['origtransfereruniqueid'],agents[_0x188c6b[_0x344a('0x42')]]['membername']));agents[_0x188c6b['origtransfereruniqueid']][_0x344a('0x3b')]=!![];agents[_0x188c6b['origtransfereruniqueid']]['transfertype']=_0x344a('0x46');agents[_0x188c6b[_0x344a('0x42')]]['transferexten']=_0x188c6b[_0x344a('0x4c')];agents[_0x188c6b['origtransfereruniqueid']][_0x344a('0x48')]=_0x188c6b[_0x344a('0x44')];}if(_0x188c6b[_0x344a('0x4d')]&&agents[_0x188c6b['transfertargetuniqueid']]){agents[_0x188c6b['transfertargetuniqueid']][_0x344a('0x4a')]=0x1;transfers[_0x188c6b[_0x344a('0x4d')]]=_[_0x344a('0x4e')](agents[_0x188c6b[_0x344a('0x4d')]]);transfers[_0x188c6b['transfertargetuniqueid']]['calleridnum']=agents[_0x188c6b[_0x344a('0x42')]][_0x344a('0xa')];transfers[_0x188c6b[_0x344a('0x4d')]]['calleridname']=agents[_0x188c6b[_0x344a('0x42')]][_0x344a('0x4f')];transfers[_0x188c6b['transfertargetuniqueid']][_0x344a('0x17')]=utils['now']();transfers[_0x188c6b[_0x344a('0x4d')]]['agentconnectAt']=utils['now']();transfers[_0x188c6b['transfertargetuniqueid']][_0x344a('0x23')]=0x0;transfers[_0x188c6b[_0x344a('0x4d')]][_0x344a('0x4a')]=0x2;}}}catch(_0xce0446){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][attendedtransfer]',_0x188c6b[_0x344a('0x42')]),_0xce0446);}};exports[_0x344a('0x50')]=function(_0x20a892){try{utils[_0x344a('0x13')](util[_0x344a('0x4')]('[%s][agents][hangup]',_0x20a892[_0x344a('0x15')]),_0x20a892);if(agents[_0x20a892[_0x344a('0x15')]]&&agents[_0x20a892['uniqueid']][_0x344a('0x22')]===_0x344a('0x21')){if(_0x20a892[_0x344a('0x51')]==='21'){agents[_0x20a892[_0x344a('0x15')]]['reason']=_0x344a('0x52');agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2f')]=_0x344a('0x52');}utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x53'),_0x20a892[_0x344a('0x15')],agents[_0x20a892['uniqueid']][_0x344a('0x8')],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2f')]));writeDB(agents[_0x20a892[_0x344a('0x15')]]);var _0x212b08=unanswered[_0x344a('0x54')](_0x20a892['uniqueid']);if(_0x212b08>-0x1){unanswered[_0x344a('0x55')](_0x212b08,0x1);}}if(transfers[_0x20a892[_0x344a('0x15')]]){transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0xd')]=!![];transfers[_0x20a892['uniqueid']][_0x344a('0x36')]=utils[_0x344a('0x18')]();transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x25')]=utils[_0x344a('0x35')](transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x36')],transfers[_0x20a892[_0x344a('0x15')]]['agentconnectAt']);transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')]=_0x344a('0x56');transfers[_0x20a892[_0x344a('0x15')]]['lastevent']=_0x344a('0x37');utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x53'),_0x20a892[_0x344a('0x15')],transfers[_0x20a892[_0x344a('0x15')]]['membername'],transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')],transfers[_0x20a892[_0x344a('0x15')]]['lastevent']));writeDB(transfers[_0x20a892[_0x344a('0x15')]],!![]);}if(agents[_0x20a892[_0x344a('0x15')]]&&agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2d')]){agents[_0x20a892[_0x344a('0x15')]]['agentcomplete']=!![];agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x36')]=utils[_0x344a('0x18')]();agents[_0x20a892['uniqueid']][_0x344a('0x25')]=utils['diffTime'](agents[_0x20a892['uniqueid']][_0x344a('0x36')],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2d')]);agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')]=agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x3b')]?_0x344a('0x3b'):'agent';agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2f')]='complete';utils['info'](util[_0x344a('0x4')](_0x344a('0x53'),_0x20a892[_0x344a('0x15')],agents[_0x20a892[_0x344a('0x15')]]['membername'],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')],agents[_0x20a892[_0x344a('0x15')]]['lastevent']));writeDB(agents[_0x20a892[_0x344a('0x15')]]);}}catch(_0x1c50c3){utils[_0x344a('0x1c')](util['format'](_0x344a('0x57'),_0x20a892[_0x344a('0x15')]),_0x1c50c3);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 829171a..e509c6d 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 _0xb049=['[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','lastapplication','lodash','util','./utils','NO\x20ANSWER','FAILED','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','DOCUMENTATION','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','toNumber','ANSWERED','error','hangup','[%s][calls][hangup]','callerid','calleridnum','cause-txt','endtime','duration','diffTime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','origtransfereruniqueid','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','musiconholdstartAt','mohtime','varset','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','variable'];(function(_0x236a36,_0x374403){var _0x1125fe=function(_0x2fd65a){while(--_0x2fd65a){_0x236a36['push'](_0x236a36['shift']());}};_0x1125fe(++_0x374403);}(_0xb049,0xf0));var _0x9b04=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb049[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x9b04('0x0'));var util=require(_0x9b04('0x1'));var utils=require(_0x9b04('0x2'));var dispositions=[_0x9b04('0x3'),'FAILED',_0x9b04('0x4'),_0x9b04('0x3'),'NO\x20ANSWER',_0x9b04('0x3'),'ANSWERED','BUSY',_0x9b04('0x4'),'FAILED',_0x9b04('0x4')];var channels={};function writeDB(_0xc6900b){utils[_0x9b04('0x5')](util[_0x9b04('0x6')](_0x9b04('0x7'),_0xc6900b[_0x9b04('0x8')],_0xc6900b['channel'],_0xc6900b[_0x9b04('0x9')],_0xc6900b[_0x9b04('0xa')],_0xc6900b[_0x9b04('0xb')],_0xc6900b['calleridnum'],_0xc6900b[_0x9b04('0xc')],_0xc6900b[_0x9b04('0xd')]));if(_0xc6900b[_0x9b04('0xe')]){utils[_0x9b04('0xf')](_0xc6900b[_0x9b04('0xe')])[_0x9b04('0x10')](function(_0x2953f4){if(_0x2953f4){_0xc6900b[_0x9b04('0x11')]=_0x2953f4['id'];}utils[_0x9b04('0x12')](_0x9b04('0x13'),_0xc6900b);});}else{utils['request'](_0x9b04('0x13'),_0xc6900b);}if(channels[_0xc6900b['uniqueid']]){delete channels[_0xc6900b[_0x9b04('0x8')]];}}exports['newchannel']=function(_0x5c5557){try{utils[_0x9b04('0x14')](util[_0x9b04('0x6')](_0x9b04('0x15'),_0x5c5557[_0x9b04('0x8')]),_0x5c5557);if(_0x5c5557['uniqueid']==_0x5c5557[_0x9b04('0x16')]&&_0x5c5557['channel']!='OutgoingSpoolFailed'){utils[_0x9b04('0x5')](util[_0x9b04('0x6')](_0x9b04('0x17'),_0x5c5557[_0x9b04('0x8')],_0x5c5557['context'],_0x5c5557['exten']));channels[_0x5c5557[_0x9b04('0x8')]]={'uniqueid':_0x5c5557[_0x9b04('0x8')],'accountcode':_0x5c5557[_0x9b04('0xe')],'source':_0x5c5557['calleridnum'],'destination':_0x5c5557[_0x9b04('0x18')],'destinationcontext':_0x5c5557[_0x9b04('0x19')],'channel':_0x5c5557[_0x9b04('0x1a')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x9b04('0x3'),'amaflags':_0x9b04('0x1b')};}}catch(_0x302f85){utils['error'](util['format'](_0x9b04('0x15'),_0x5c5557[_0x9b04('0x8')]),_0x302f85);}};exports['newstate']=function(_0x42d3ba){try{utils['debug'](util[_0x9b04('0x6')]('[%s][calls][newstate]',_0x42d3ba[_0x9b04('0x8')]),_0x42d3ba);if(!_['isNil'](channels[_0x42d3ba[_0x9b04('0x8')]])&&_0x42d3ba[_0x9b04('0x1c')]==0x6){utils[_0x9b04('0x5')](util['format'](_0x9b04('0x1d'),_0x42d3ba[_0x9b04('0x8')],_0x42d3ba['context'],_0x42d3ba[_0x9b04('0x1a')]));if(_[_0x9b04('0x1e')](channels[_0x42d3ba[_0x9b04('0x8')]]['systemanswertime'])){channels[_0x42d3ba[_0x9b04('0x8')]][_0x9b04('0x1f')]=utils[_0x9b04('0x20')]();}}else if(!_[_0x9b04('0x1e')](channels[_0x42d3ba[_0x9b04('0x16')]])&&_0x42d3ba['channelstate']==0x6&&_0x42d3ba[_0x9b04('0x19')]!=_0x9b04('0x21')){utils[_0x9b04('0x5')](util[_0x9b04('0x6')](_0x9b04('0x22'),_0x42d3ba[_0x9b04('0x8')],_0x42d3ba['linkedid'],_0x42d3ba[_0x9b04('0x19')],_0x42d3ba['channel']));channels[_0x42d3ba['linkedid']][_0x9b04('0xe')]=_0x42d3ba[_0x9b04('0xe')];channels[_0x42d3ba[_0x9b04('0x16')]]['destinationchannel']=_0x42d3ba[_0x9b04('0x1a')];if(_[_0x9b04('0x1e')](channels[_0x42d3ba['linkedid']][_0x9b04('0x23')])){channels[_0x42d3ba[_0x9b04('0x16')]][_0x9b04('0x23')]=utils[_0x9b04('0x20')]();}channels[_0x42d3ba[_0x9b04('0x16')]]['disposition']=dispositions[_[_0x9b04('0x24')](_0x42d3ba[_0x9b04('0x1c')])]||_0x9b04('0x25');}}catch(_0x37de70){utils[_0x9b04('0x26')](util['format']('[%s][calls][newstate]',_0x42d3ba[_0x9b04('0x8')]),_0x37de70);}};exports[_0x9b04('0x27')]=function(_0x106c93){try{if(!_[_0x9b04('0x1e')](channels[_0x106c93[_0x9b04('0x8')]])){utils[_0x9b04('0x14')](util['format'](_0x9b04('0x28'),_0x106c93[_0x9b04('0x8')]),_0x106c93);if(_[_0x9b04('0x1e')](channels[_0x106c93[_0x9b04('0x8')]][_0x9b04('0x29')])){channels[_0x106c93[_0x9b04('0x8')]]['callerid']=_0x106c93['calleridname']+'\x20<'+_0x106c93[_0x9b04('0x2a')]+'>';}utils[_0x9b04('0x5')](util[_0x9b04('0x6')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x106c93[_0x9b04('0x8')],channels[_0x106c93[_0x9b04('0x8')]][_0x9b04('0x29')],_0x106c93[_0x9b04('0x2b')]));channels[_0x106c93[_0x9b04('0x8')]][_0x9b04('0x2c')]=utils['now']();channels[_0x106c93[_0x9b04('0x8')]][_0x9b04('0x2d')]=utils[_0x9b04('0x2e')](channels[_0x106c93[_0x9b04('0x8')]]['endtime'],channels[_0x106c93['uniqueid']]['starttime']);channels[_0x106c93[_0x9b04('0x8')]][_0x9b04('0x2f')]=channels[_0x106c93[_0x9b04('0x8')]][_0x9b04('0x23')]?utils[_0x9b04('0x2e')](channels[_0x106c93[_0x9b04('0x8')]][_0x9b04('0x2c')],channels[_0x106c93[_0x9b04('0x8')]][_0x9b04('0x23')]):0x0;writeDB(channels[_0x106c93[_0x9b04('0x8')]]);}}catch(_0x553cb6){utils[_0x9b04('0x26')](util[_0x9b04('0x6')](_0x9b04('0x28'),_0x106c93[_0x9b04('0x8')]),_0x553cb6);}};exports['attendedtransfer']=function(_0x534743){try{if(!_[_0x9b04('0x1e')](channels[_0x534743[_0x9b04('0x30')]])){utils['debug'](util['format'](_0x9b04('0x31'),_0x534743['origtransfereruniqueid']),_0x534743);if(channels[_0x534743[_0x9b04('0x30')]][_0x9b04('0x1a')]==_0x534743['transfereechannel']){utils['info'](util[_0x9b04('0x6')](_0x9b04('0x32'),_0x534743['origtransfereruniqueid'],_0x534743[_0x9b04('0x30')],_0x534743[_0x9b04('0x33')]));channels[_0x534743[_0x9b04('0x30')]][_0x9b04('0x34')]=_0x534743['secondtransfererchannel'];channels[_0x534743[_0x9b04('0x30')]][_0x9b04('0x35')]=_0x9b04('0x36');}else if(channels[_0x534743[_0x9b04('0x30')]][_0x9b04('0x1a')]=_0x534743[_0x9b04('0x37')]){utils[_0x9b04('0x5')](util[_0x9b04('0x6')](_0x9b04('0x32'),_0x534743[_0x9b04('0x38')],_0x534743[_0x9b04('0x30')],_0x534743[_0x9b04('0x39')]));channels[_0x534743['localtwolinkedid']][_0x9b04('0x34')]=_0x534743[_0x9b04('0x39')];channels[_0x534743[_0x9b04('0x30')]]['userfield']='_attended';}}}catch(_0xf9cced){utils[_0x9b04('0x26')](util[_0x9b04('0x6')](_0x9b04('0x31'),_0x534743['origtransfereruniqueid']),_0xf9cced);}};exports['musiconholdstart']=function(_0x1cd7f4){try{if(!_[_0x9b04('0x1e')](channels[_0x1cd7f4[_0x9b04('0x8')]])){utils['debug'](util[_0x9b04('0x6')](_0x9b04('0x3a'),_0x1cd7f4['uniqueid']),_0x1cd7f4);channels[_0x1cd7f4[_0x9b04('0x8')]]['musiconholdstartAt']=utils['now']();utils[_0x9b04('0x5')](util[_0x9b04('0x6')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x1cd7f4['uniqueid'],channels[_0x1cd7f4[_0x9b04('0x8')]]['musiconholdstartAt']));}}catch(_0x599078){utils['error'](util[_0x9b04('0x6')]('[%s][calls][musiconholdstart]',_0x1cd7f4[_0x9b04('0x8')]),_0x599078);}};exports[_0x9b04('0x3b')]=function(_0x2c9e23){try{if(!_[_0x9b04('0x1e')](channels[_0x2c9e23[_0x9b04('0x8')]])){utils[_0x9b04('0x14')](util[_0x9b04('0x6')](_0x9b04('0x3c'),_0x2c9e23[_0x9b04('0x8')]),_0x2c9e23);if(!_['isNil'](channels[_0x2c9e23[_0x9b04('0x8')]][_0x9b04('0x3d')])){channels[_0x2c9e23[_0x9b04('0x8')]][_0x9b04('0x3e')]+=utils[_0x9b04('0x2e')](utils['now'](),channels[_0x2c9e23[_0x9b04('0x8')]][_0x9b04('0x3d')]);utils[_0x9b04('0x5')](util[_0x9b04('0x6')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x2c9e23[_0x9b04('0x8')],channels[_0x2c9e23[_0x9b04('0x8')]][_0x9b04('0x3e')]));delete channels[_0x2c9e23[_0x9b04('0x8')]][_0x9b04('0x3d')];}}}catch(_0x60bd35){utils[_0x9b04('0x26')](util['format'](_0x9b04('0x3c'),_0x2c9e23[_0x9b04('0x8')]),_0x60bd35);}};exports[_0x9b04('0x3f')]=function(_0x43f9d8){try{if(!_[_0x9b04('0x1e')](channels[_0x43f9d8['uniqueid']])){utils[_0x9b04('0x14')](util['format']('[%s][calls][varset]',_0x43f9d8[_0x9b04('0x8')]),_0x43f9d8);if(!_[_0x9b04('0x1e')](_0x43f9d8['variable'][_0x9b04('0x40')])){utils[_0x9b04('0x5')](util[_0x9b04('0x6')](_0x9b04('0x41'),_0x43f9d8[_0x9b04('0x8')],_0x43f9d8['value']));channels[_0x43f9d8['uniqueid']][_0x9b04('0x42')]=_0x43f9d8[_0x9b04('0x43')];}if(!_['isNil'](_0x43f9d8[_0x9b04('0x44')]['xmd-phone'])){utils['info'](util[_0x9b04('0x6')](_0x9b04('0x45'),_0x43f9d8['uniqueid'],_0x43f9d8[_0x9b04('0x43')]));channels[_0x43f9d8[_0x9b04('0x8')]][_0x9b04('0x46')]=_0x43f9d8['value'];channels[_0x43f9d8['uniqueid']][_0x9b04('0x29')]='\x22'+_0x43f9d8['value']+'\x22\x20<'+_0x43f9d8[_0x9b04('0x43')]+'>';}if(!_[_0x9b04('0x1e')](_0x43f9d8[_0x9b04('0x44')]['xmd-callerid-preview'])||!_[_0x9b04('0x1e')](_0x43f9d8['variable'][_0x9b04('0x47')])){utils[_0x9b04('0x5')](util['format'](_0x9b04('0x48'),_0x43f9d8[_0x9b04('0x8')],!_[_0x9b04('0x1e')](_0x43f9d8[_0x9b04('0x44')]['xmd-callerid-preview'])?_0x9b04('0x49'):_0x9b04('0x47'),_0x43f9d8[_0x9b04('0x43')]));channels[_0x43f9d8['uniqueid']][_0x9b04('0x29')]=_0x43f9d8[_0x9b04('0x43')];}if(!_[_0x9b04('0x1e')](_0x43f9d8[_0x9b04('0x44')][_0x9b04('0x4a')])||!_[_0x9b04('0x1e')](_0x43f9d8[_0x9b04('0x44')]['xmcs-queue'])){utils[_0x9b04('0x5')](util['format'](_0x9b04('0x48'),_0x43f9d8[_0x9b04('0x8')],!_[_0x9b04('0x1e')](_0x43f9d8[_0x9b04('0x44')][_0x9b04('0x4a')])?'xmd-queue':_0x9b04('0x4b'),_0x43f9d8[_0x9b04('0x43')]));channels[_0x43f9d8[_0x9b04('0x8')]]['lastapplication']=_0x9b04('0x4c');channels[_0x43f9d8['uniqueid']][_0x9b04('0x4d')]=_0x43f9d8[_0x9b04('0x43')];channels[_0x43f9d8[_0x9b04('0x8')]]['queue']=!![];}if(!_[_0x9b04('0x1e')](_0x43f9d8[_0x9b04('0x44')][_0x9b04('0x4e')])){utils[_0x9b04('0x5')](util['format'](_0x9b04('0x4f'),_0x43f9d8[_0x9b04('0x8')],_0x43f9d8[_0x9b04('0x43')]));channels[_0x43f9d8[_0x9b04('0x8')]][_0x9b04('0x50')]=_0x43f9d8['value'];}if(!_[_0x9b04('0x1e')](_0x43f9d8[_0x9b04('0x44')][_0x9b04('0x51')])){utils[_0x9b04('0x5')](util[_0x9b04('0x6')](_0x9b04('0x52'),_0x43f9d8[_0x9b04('0x8')],_0x43f9d8[_0x9b04('0x43')]));channels[_0x43f9d8['uniqueid']][_0x9b04('0x53')]=_0x43f9d8[_0x9b04('0x43')];}if(!_[_0x9b04('0x1e')](_0x43f9d8[_0x9b04('0x44')]['outboundrouteid'])){utils[_0x9b04('0x5')](util[_0x9b04('0x6')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x43f9d8[_0x9b04('0x8')],_0x43f9d8['value']));channels[_0x43f9d8['uniqueid']][_0x9b04('0x54')]=_0x43f9d8[_0x9b04('0x43')];}if(!_[_0x9b04('0x1e')](_0x43f9d8['variable'][_0x9b04('0x55')])){utils[_0x9b04('0x5')](util['format'](_0x9b04('0x56'),_0x43f9d8[_0x9b04('0x8')],_0x43f9d8[_0x9b04('0x43')]));channels[_0x43f9d8[_0x9b04('0x8')]][_0x9b04('0x55')]=_0x43f9d8[_0x9b04('0x43')];}}}catch(_0x91902){utils[_0x9b04('0x26')](util[_0x9b04('0x6')]('[%s][calls][varset]',_0x43f9d8['uniqueid']),_0x91902);}};exports[_0x9b04('0x57')]=function(_0x1aa144){try{if(!_['isNil'](channels[_0x1aa144[_0x9b04('0x8')]])){utils['debug'](util['format'](_0x9b04('0x58'),_0x1aa144[_0x9b04('0x8')]),_0x1aa144);utils['info'](util[_0x9b04('0x6')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x1aa144['uniqueid'],_0x1aa144[_0x9b04('0x59')],_0x1aa144[_0x9b04('0x5a')]));if(_0x1aa144[_0x9b04('0x59')][_0x9b04('0x5b')]()==_0x9b04('0x5c')&&_[_0x9b04('0x5d')](_0x1aa144[_0x9b04('0x5a')][_0x9b04('0x5b')](),_0x9b04('0x5e'))){var _0x14d9dd=_0x1aa144[_0x9b04('0x5a')][_0x9b04('0x5f')]('=');var _0x22fb28=_0x14d9dd[0x0][_0x9b04('0x60')](_0x14d9dd[0x0][_0x9b04('0x61')]('(')+0x1,_0x14d9dd[0x0][_0x9b04('0x61')](')'));var _0x3cc776=_0x14d9dd[0x1];channels[_0x1aa144['uniqueid']][_0x22fb28]=_0x3cc776;}if(!_[_0x9b04('0x62')]([_0x9b04('0x27'),_0x9b04('0x63'),_0x9b04('0x64'),_0x9b04('0x5c'),_0x9b04('0x65')],_0x1aa144[_0x9b04('0x59')][_0x9b04('0x5b')]())){channels[_0x1aa144[_0x9b04('0x8')]][_0x9b04('0x66')]=_0x1aa144[_0x9b04('0x59')];channels[_0x1aa144['uniqueid']][_0x9b04('0x4d')]=_0x1aa144[_0x9b04('0x5a')];}}}catch(_0x4acc66){utils[_0x9b04('0x26')](util[_0x9b04('0x6')](_0x9b04('0x58'),_0x1aa144[_0x9b04('0x8')]),_0x4acc66);}}; \ No newline at end of file +var _0xceef=['[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','xmd-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][varset]','newexten','[%s][calls][newexten]','application','appdata','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./utils','FAILED','NO\x20ANSWER','ANSWERED','BUSY','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','CreateVoiceCallReport','newchannel','format','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','now','[%s][calls][newchannel]','newstate','debug','[%s][calls][newstate]','channelstate','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','destinationchannel','answertime','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','diffTime','endtime','starttime','billableseconds','error','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt'];(function(_0x511345,_0x32dafe){var _0x24b2c5=function(_0x507388){while(--_0x507388){_0x511345['push'](_0x511345['shift']());}};_0x24b2c5(++_0x32dafe);}(_0xceef,0x1ee));var _0xfcee=function(_0x341a5a,_0x4ae5ed){_0x341a5a=_0x341a5a-0x0;var _0x53f85b=_0xceef[_0x341a5a];return _0x53f85b;};'use strict';var _=require(_0xfcee('0x0'));var util=require(_0xfcee('0x1'));var utils=require(_0xfcee('0x2'));var dispositions=['NO\x20ANSWER','FAILED',_0xfcee('0x3'),_0xfcee('0x4'),_0xfcee('0x4'),_0xfcee('0x4'),_0xfcee('0x5'),_0xfcee('0x6'),_0xfcee('0x3'),_0xfcee('0x3'),_0xfcee('0x3')];var channels={};function writeDB(_0x290b0d){utils[_0xfcee('0x7')](util['format'](_0xfcee('0x8'),_0x290b0d[_0xfcee('0x9')],_0x290b0d[_0xfcee('0xa')],_0x290b0d[_0xfcee('0xb')],_0x290b0d[_0xfcee('0xc')],_0x290b0d[_0xfcee('0xd')],_0x290b0d[_0xfcee('0xe')],_0x290b0d[_0xfcee('0xf')],_0x290b0d[_0xfcee('0x10')]));if(_0x290b0d[_0xfcee('0x11')]){utils[_0xfcee('0x12')](_0x290b0d[_0xfcee('0x11')])[_0xfcee('0x13')](function(_0x4d5e6b){if(_0x4d5e6b){_0x290b0d[_0xfcee('0x14')]=_0x4d5e6b['id'];}utils['request']('CreateVoiceCallReport',_0x290b0d);});}else{utils['request'](_0xfcee('0x15'),_0x290b0d);}if(channels[_0x290b0d[_0xfcee('0x9')]]){delete channels[_0x290b0d[_0xfcee('0x9')]];}}exports[_0xfcee('0x16')]=function(_0x2153d8){try{utils['debug'](util[_0xfcee('0x17')]('[%s][calls][newchannel]',_0x2153d8['uniqueid']),_0x2153d8);if(_0x2153d8[_0xfcee('0x9')]==_0x2153d8['linkedid']&&_0x2153d8['channel']!=_0xfcee('0x18')){utils[_0xfcee('0x7')](util[_0xfcee('0x17')](_0xfcee('0x19'),_0x2153d8[_0xfcee('0x9')],_0x2153d8[_0xfcee('0x1a')],_0x2153d8['exten']));channels[_0x2153d8[_0xfcee('0x9')]]={'uniqueid':_0x2153d8['uniqueid'],'accountcode':_0x2153d8[_0xfcee('0x11')],'source':_0x2153d8[_0xfcee('0xe')],'destination':_0x2153d8['exten'],'destinationcontext':_0x2153d8[_0xfcee('0x1a')],'channel':_0x2153d8[_0xfcee('0xa')],'starttime':utils[_0xfcee('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xfcee('0x4'),'amaflags':'DOCUMENTATION'};}}catch(_0x50424d){utils['error'](util[_0xfcee('0x17')](_0xfcee('0x1c'),_0x2153d8[_0xfcee('0x9')]),_0x50424d);}};exports[_0xfcee('0x1d')]=function(_0x2bd37d){try{utils[_0xfcee('0x1e')](util['format'](_0xfcee('0x1f'),_0x2bd37d[_0xfcee('0x9')]),_0x2bd37d);if(!_['isNil'](channels[_0x2bd37d[_0xfcee('0x9')]])&&_0x2bd37d[_0xfcee('0x20')]==0x6){utils['info'](util[_0xfcee('0x17')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x2bd37d['uniqueid'],_0x2bd37d[_0xfcee('0x1a')],_0x2bd37d[_0xfcee('0xa')]));if(_[_0xfcee('0x21')](channels[_0x2bd37d[_0xfcee('0x9')]][_0xfcee('0x22')])){channels[_0x2bd37d[_0xfcee('0x9')]]['systemanswertime']=utils[_0xfcee('0x1b')]();}}else if(!_[_0xfcee('0x21')](channels[_0x2bd37d['linkedid']])&&_0x2bd37d[_0xfcee('0x20')]==0x6&&_0x2bd37d['context']!=_0xfcee('0x23')){utils[_0xfcee('0x7')](util[_0xfcee('0x17')](_0xfcee('0x24'),_0x2bd37d[_0xfcee('0x9')],_0x2bd37d[_0xfcee('0x25')],_0x2bd37d[_0xfcee('0x1a')],_0x2bd37d[_0xfcee('0xa')]));channels[_0x2bd37d['linkedid']][_0xfcee('0x11')]=_0x2bd37d[_0xfcee('0x11')];channels[_0x2bd37d[_0xfcee('0x25')]][_0xfcee('0x26')]=_0x2bd37d[_0xfcee('0xa')];if(_['isNil'](channels[_0x2bd37d[_0xfcee('0x25')]][_0xfcee('0x27')])){channels[_0x2bd37d['linkedid']][_0xfcee('0x27')]=utils[_0xfcee('0x1b')]();}channels[_0x2bd37d[_0xfcee('0x25')]]['disposition']=dispositions[_[_0xfcee('0x28')](_0x2bd37d['channelstate'])]||_0xfcee('0x5');}}catch(_0x57f6ff){utils['error'](util[_0xfcee('0x17')](_0xfcee('0x1f'),_0x2bd37d['uniqueid']),_0x57f6ff);}};exports[_0xfcee('0x29')]=function(_0x1014f2){try{if(!_[_0xfcee('0x21')](channels[_0x1014f2[_0xfcee('0x9')]])){utils[_0xfcee('0x1e')](util[_0xfcee('0x17')](_0xfcee('0x2a'),_0x1014f2['uniqueid']),_0x1014f2);if(_[_0xfcee('0x21')](channels[_0x1014f2[_0xfcee('0x9')]]['callerid'])){channels[_0x1014f2[_0xfcee('0x9')]][_0xfcee('0x2b')]=_0x1014f2[_0xfcee('0x2c')]+'\x20<'+_0x1014f2[_0xfcee('0xe')]+'>';}utils['info'](util[_0xfcee('0x17')](_0xfcee('0x2d'),_0x1014f2[_0xfcee('0x9')],channels[_0x1014f2[_0xfcee('0x9')]][_0xfcee('0x2b')],_0x1014f2[_0xfcee('0x2e')]));channels[_0x1014f2[_0xfcee('0x9')]]['endtime']=utils[_0xfcee('0x1b')]();channels[_0x1014f2[_0xfcee('0x9')]][_0xfcee('0x2f')]=utils[_0xfcee('0x30')](channels[_0x1014f2['uniqueid']][_0xfcee('0x31')],channels[_0x1014f2[_0xfcee('0x9')]][_0xfcee('0x32')]);channels[_0x1014f2[_0xfcee('0x9')]][_0xfcee('0x33')]=channels[_0x1014f2[_0xfcee('0x9')]][_0xfcee('0x27')]?utils[_0xfcee('0x30')](channels[_0x1014f2[_0xfcee('0x9')]][_0xfcee('0x31')],channels[_0x1014f2[_0xfcee('0x9')]][_0xfcee('0x27')]):0x0;writeDB(channels[_0x1014f2['uniqueid']]);}}catch(_0x78b584){utils[_0xfcee('0x34')](util['format'](_0xfcee('0x2a'),_0x1014f2['uniqueid']),_0x78b584);}};exports[_0xfcee('0x35')]=function(_0xc63344){try{if(!_['isNil'](channels[_0xc63344[_0xfcee('0x36')]])){utils['debug'](util[_0xfcee('0x17')](_0xfcee('0x37'),_0xc63344[_0xfcee('0x38')]),_0xc63344);if(channels[_0xc63344[_0xfcee('0x36')]][_0xfcee('0xa')]==_0xc63344[_0xfcee('0x39')]){utils[_0xfcee('0x7')](util[_0xfcee('0x17')](_0xfcee('0x3a'),_0xc63344[_0xfcee('0x38')],_0xc63344['localtwolinkedid'],_0xc63344[_0xfcee('0x3b')]));channels[_0xc63344['localtwolinkedid']][_0xfcee('0x26')]=_0xc63344[_0xfcee('0x3b')];channels[_0xc63344[_0xfcee('0x36')]][_0xfcee('0x3c')]=_0xfcee('0x3d');}else if(channels[_0xc63344['localtwolinkedid']][_0xfcee('0xa')]=_0xc63344[_0xfcee('0x3e')]){utils[_0xfcee('0x7')](util['format'](_0xfcee('0x3a'),_0xc63344[_0xfcee('0x38')],_0xc63344['localtwolinkedid'],_0xc63344['origtransfererchannel']));channels[_0xc63344[_0xfcee('0x36')]]['destinationchannel']=_0xc63344[_0xfcee('0x3f')];channels[_0xc63344[_0xfcee('0x36')]][_0xfcee('0x3c')]='_attended';}}}catch(_0x4ecaa8){utils[_0xfcee('0x34')](util[_0xfcee('0x17')](_0xfcee('0x37'),_0xc63344[_0xfcee('0x38')]),_0x4ecaa8);}};exports[_0xfcee('0x40')]=function(_0x3a38de){try{if(!_[_0xfcee('0x21')](channels[_0x3a38de[_0xfcee('0x9')]])){utils[_0xfcee('0x1e')](util[_0xfcee('0x17')]('[%s][calls][musiconholdstart]',_0x3a38de[_0xfcee('0x9')]),_0x3a38de);channels[_0x3a38de[_0xfcee('0x9')]][_0xfcee('0x41')]=utils[_0xfcee('0x1b')]();utils[_0xfcee('0x7')](util[_0xfcee('0x17')](_0xfcee('0x42'),_0x3a38de[_0xfcee('0x9')],channels[_0x3a38de[_0xfcee('0x9')]][_0xfcee('0x41')]));}}catch(_0x25befa){utils[_0xfcee('0x34')](util[_0xfcee('0x17')](_0xfcee('0x43'),_0x3a38de['uniqueid']),_0x25befa);}};exports[_0xfcee('0x44')]=function(_0x1632ff){try{if(!_['isNil'](channels[_0x1632ff[_0xfcee('0x9')]])){utils[_0xfcee('0x1e')](util[_0xfcee('0x17')](_0xfcee('0x45'),_0x1632ff[_0xfcee('0x9')]),_0x1632ff);if(!_[_0xfcee('0x21')](channels[_0x1632ff[_0xfcee('0x9')]][_0xfcee('0x41')])){channels[_0x1632ff[_0xfcee('0x9')]]['mohtime']+=utils['diffTime'](utils[_0xfcee('0x1b')](),channels[_0x1632ff['uniqueid']]['musiconholdstartAt']);utils['info'](util['format'](_0xfcee('0x46'),_0x1632ff[_0xfcee('0x9')],channels[_0x1632ff[_0xfcee('0x9')]][_0xfcee('0x47')]));delete channels[_0x1632ff[_0xfcee('0x9')]]['musiconholdstartAt'];}}}catch(_0x4719a2){utils[_0xfcee('0x34')](util['format'](_0xfcee('0x45'),_0x1632ff[_0xfcee('0x9')]),_0x4719a2);}};exports[_0xfcee('0x48')]=function(_0x1e4d3b){try{if(!_['isNil'](channels[_0x1e4d3b[_0xfcee('0x9')]])){utils['debug'](util[_0xfcee('0x17')]('[%s][calls][varset]',_0x1e4d3b[_0xfcee('0x9')]),_0x1e4d3b);if(!_['isNil'](_0x1e4d3b[_0xfcee('0x49')][_0xfcee('0x4a')])){utils[_0xfcee('0x7')](util[_0xfcee('0x17')](_0xfcee('0x4b'),_0x1e4d3b[_0xfcee('0x9')],_0x1e4d3b['value']));channels[_0x1e4d3b[_0xfcee('0x9')]][_0xfcee('0x4c')]=_0x1e4d3b[_0xfcee('0x4d')];}if(!_[_0xfcee('0x21')](_0x1e4d3b[_0xfcee('0x49')][_0xfcee('0x4e')])){utils[_0xfcee('0x7')](util[_0xfcee('0x17')](_0xfcee('0x4f'),_0x1e4d3b[_0xfcee('0x9')],_0x1e4d3b[_0xfcee('0x4d')]));channels[_0x1e4d3b[_0xfcee('0x9')]][_0xfcee('0x50')]=_0x1e4d3b[_0xfcee('0x4d')];channels[_0x1e4d3b['uniqueid']][_0xfcee('0x2b')]='\x22'+_0x1e4d3b[_0xfcee('0x4d')]+_0xfcee('0x51')+_0x1e4d3b[_0xfcee('0x4d')]+'>';}if(!_[_0xfcee('0x21')](_0x1e4d3b['variable'][_0xfcee('0x52')])||!_[_0xfcee('0x21')](_0x1e4d3b[_0xfcee('0x49')][_0xfcee('0x53')])){utils['info'](util[_0xfcee('0x17')](_0xfcee('0x54'),_0x1e4d3b['uniqueid'],!_[_0xfcee('0x21')](_0x1e4d3b[_0xfcee('0x49')][_0xfcee('0x52')])?_0xfcee('0x52'):_0xfcee('0x53'),_0x1e4d3b[_0xfcee('0x4d')]));channels[_0x1e4d3b[_0xfcee('0x9')]][_0xfcee('0x2b')]=_0x1e4d3b['value'];}if(!_[_0xfcee('0x21')](_0x1e4d3b[_0xfcee('0x49')]['xmd-queue'])||!_[_0xfcee('0x21')](_0x1e4d3b['variable'][_0xfcee('0x55')])){utils['info'](util[_0xfcee('0x17')](_0xfcee('0x54'),_0x1e4d3b[_0xfcee('0x9')],!_[_0xfcee('0x21')](_0x1e4d3b[_0xfcee('0x49')][_0xfcee('0x56')])?_0xfcee('0x56'):_0xfcee('0x55'),_0x1e4d3b[_0xfcee('0x4d')]));channels[_0x1e4d3b[_0xfcee('0x9')]][_0xfcee('0x57')]=_0xfcee('0x58');channels[_0x1e4d3b['uniqueid']][_0xfcee('0x59')]=_0x1e4d3b[_0xfcee('0x4d')];channels[_0x1e4d3b[_0xfcee('0x9')]][_0xfcee('0xb')]=!![];}if(!_[_0xfcee('0x21')](_0x1e4d3b[_0xfcee('0x49')][_0xfcee('0x5a')])){utils[_0xfcee('0x7')](util['format'](_0xfcee('0x5b'),_0x1e4d3b['uniqueid'],_0x1e4d3b[_0xfcee('0x4d')]));channels[_0x1e4d3b[_0xfcee('0x9')]][_0xfcee('0x5c')]=_0x1e4d3b[_0xfcee('0x4d')];}if(!_[_0xfcee('0x21')](_0x1e4d3b['variable']['xmd-cdrtype'])){utils['info'](util[_0xfcee('0x17')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x1e4d3b['uniqueid'],_0x1e4d3b['value']));channels[_0x1e4d3b[_0xfcee('0x9')]][_0xfcee('0x5d')]=_0x1e4d3b[_0xfcee('0x4d')];}if(!_['isNil'](_0x1e4d3b['variable']['outboundrouteid'])){utils['info'](util[_0xfcee('0x17')](_0xfcee('0x5e'),_0x1e4d3b['uniqueid'],_0x1e4d3b[_0xfcee('0x4d')]));channels[_0x1e4d3b[_0xfcee('0x9')]]['routeid']=_0x1e4d3b['value'];}if(!_[_0xfcee('0x21')](_0x1e4d3b[_0xfcee('0x49')]['sipcallid'])){utils['info'](util[_0xfcee('0x17')](_0xfcee('0x5f'),_0x1e4d3b[_0xfcee('0x9')],_0x1e4d3b[_0xfcee('0x4d')]));channels[_0x1e4d3b[_0xfcee('0x9')]][_0xfcee('0x60')]=_0x1e4d3b['value'];}}}catch(_0x39d3f7){utils['error'](util[_0xfcee('0x17')](_0xfcee('0x61'),_0x1e4d3b[_0xfcee('0x9')]),_0x39d3f7);}};exports[_0xfcee('0x62')]=function(_0x21d048){try{if(!_['isNil'](channels[_0x21d048[_0xfcee('0x9')]])){utils[_0xfcee('0x1e')](util[_0xfcee('0x17')](_0xfcee('0x63'),_0x21d048[_0xfcee('0x9')]),_0x21d048);utils[_0xfcee('0x7')](util[_0xfcee('0x17')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x21d048[_0xfcee('0x9')],_0x21d048[_0xfcee('0x64')],_0x21d048[_0xfcee('0x65')]));if(_0x21d048[_0xfcee('0x64')]['toLowerCase']()=='set'&&_[_0xfcee('0x66')](_0x21d048[_0xfcee('0x65')][_0xfcee('0x67')](),_0xfcee('0x68'))){var _0x3ff3a6=_0x21d048[_0xfcee('0x65')][_0xfcee('0x69')]('=');var _0x17d2f8=_0x3ff3a6[0x0][_0xfcee('0x6a')](_0x3ff3a6[0x0][_0xfcee('0x6b')]('(')+0x1,_0x3ff3a6[0x0][_0xfcee('0x6b')](')'));var _0x2deae3=_0x3ff3a6[0x1];channels[_0x21d048['uniqueid']][_0x17d2f8]=_0x2deae3;}if(!_[_0xfcee('0x6c')](['hangup',_0xfcee('0x6d'),_0xfcee('0x6e'),'set',_0xfcee('0x6f')],_0x21d048['application'][_0xfcee('0x67')]())){channels[_0x21d048[_0xfcee('0x9')]][_0xfcee('0x57')]=_0x21d048[_0xfcee('0x64')];channels[_0x21d048[_0xfcee('0x9')]][_0xfcee('0x59')]=_0x21d048['appdata'];}}}catch(_0x2b0c1c){utils[_0xfcee('0x34')](util['format'](_0xfcee('0x63'),_0x21d048[_0xfcee('0x9')]),_0x2b0c1c);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index ed72fd4..d662113 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 _0x133b=['[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x133b,0x101));var _0xb133=function(_0x3748ab,_0x13059e){_0x3748ab=_0x3748ab-0x0;var _0x3aca73=_0x133b[_0x3748ab];return _0x3aca73;};'use strict';var utils=require(_0xb133('0x0'));exports[_0xb133('0x1')]=function(){utils[_0xb133('0x2')]('[core]\x20connected');};exports['shutdown']=function(){utils[_0xb133('0x2')](_0xb133('0x3'));};exports[_0xb133('0x4')]=function(){utils['info'](_0xb133('0x5'));};exports[_0xb133('0x6')]=function(_0x3d1afe){utils['error'](_0xb133('0x7'),_0x3d1afe);};exports[_0xb133('0x8')]=function(){utils[_0xb133('0x2')](_0xb133('0x9'));};exports[_0xb133('0xa')]=function(_0x5380f6){}; \ No newline at end of file +var _0x12c3=['managerevent','./utils','info','[core]\x20connected','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','[core]\x20close'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x12c3,0x10f));var _0x312c=function(_0x608461,_0x276844){_0x608461=_0x608461-0x0;var _0x3ad81b=_0x12c3[_0x608461];return _0x3ad81b;};'use strict';var utils=require(_0x312c('0x0'));exports['connect']=function(){utils[_0x312c('0x1')](_0x312c('0x2'));};exports['shutdown']=function(){utils[_0x312c('0x1')](_0x312c('0x3'));};exports[_0x312c('0x4')]=function(){utils[_0x312c('0x1')](_0x312c('0x5'));};exports[_0x312c('0x6')]=function(_0x20159c){utils['error'](_0x312c('0x7'),_0x20159c);};exports['close']=function(){utils[_0x312c('0x1')](_0x312c('0x8'));};exports[_0x312c('0x9')]=function(_0x35cf70){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index b68c153..c69884e 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 _0x3acf=['assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','complete','duration','diffTime','billableseconds','endtime','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','toLowerCase','cdr(routeid)','split','[%s][dials][newexten]','varset','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','isNil','[%s][dials][dialbegin]'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x3acf,0x109));var _0xf3ac=function(_0x2e986d,_0x4b6b63){_0x2e986d=_0x2e986d-0x0;var _0x351c79=_0x3acf[_0x2e986d];return _0x351c79;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xf3ac('0x0'));var dials={};function writeDB(_0x56c135){utils[_0xf3ac('0x1')](util[_0xf3ac('0x2')](_0xf3ac('0x3'),_0x56c135['uniqueid'],_0x56c135['channel'],_0x56c135[_0xf3ac('0x4')],_0x56c135[_0xf3ac('0x5')],_0x56c135[_0xf3ac('0x6')],_0x56c135[_0xf3ac('0x7')]));utils[_0xf3ac('0x8')](_0xf3ac('0x9'),_0x56c135);delete dials[_0x56c135[_0xf3ac('0xa')]];}exports[_0xf3ac('0xb')]=function(_0x49d241){try{utils[_0xf3ac('0xc')](util[_0xf3ac('0x2')]('[%s][dials][newexten]',_0x49d241[_0xf3ac('0xa')]),_0x49d241);utils[_0xf3ac('0x1')](util[_0xf3ac('0x2')](_0xf3ac('0xd'),_0x49d241[_0xf3ac('0xa')],_0x49d241[_0xf3ac('0xe')],_0x49d241[_0xf3ac('0xf')]));if(_0x49d241[_0xf3ac('0xe')]['toLowerCase']()==_0xf3ac('0x10')&&_['startsWith'](_0x49d241[_0xf3ac('0xf')][_0xf3ac('0x11')](),_0xf3ac('0x12'))){var _0x3f5218=_0x49d241[_0xf3ac('0xf')][_0xf3ac('0x13')]('=');dials[_0x49d241[_0xf3ac('0xa')]]={'routeId':_0x3f5218[0x1]};}}catch(_0x35428e){utils['error'](util[_0xf3ac('0x2')](_0xf3ac('0x14'),_0x49d241[_0xf3ac('0xa')]),_0x35428e);}};exports[_0xf3ac('0x15')]=function(_0x4590b8){try{utils[_0xf3ac('0xc')](util[_0xf3ac('0x2')]('[%s][dials][varset]',_0x4590b8[_0xf3ac('0xa')]),_0x4590b8);if(!_['isNil'](_0x4590b8[_0xf3ac('0x16')][_0xf3ac('0x17')])){utils[_0xf3ac('0x1')](util[_0xf3ac('0x2')](_0xf3ac('0x18'),_0x4590b8[_0xf3ac('0xa')],_0x4590b8[_0xf3ac('0x19')]));dials[_0x4590b8[_0xf3ac('0xa')]]={'routeId':_0x4590b8[_0xf3ac('0x19')]};}}catch(_0x1d667d){utils[_0xf3ac('0x1a')](util[_0xf3ac('0x2')]('[%s][dials][varset]',_0x4590b8[_0xf3ac('0xa')]),_0x1d667d);}};exports['dialbegin']=function(_0x1b05a4){try{if(!_[_0xf3ac('0x1b')](dials[_0x1b05a4[_0xf3ac('0xa')]])){utils[_0xf3ac('0xc')](util['format'](_0xf3ac('0x1c'),_0x1b05a4[_0xf3ac('0xa')]),_0x1b05a4);dials[_0x1b05a4[_0xf3ac('0xa')]]=_[_0xf3ac('0x1d')](dials[_0x1b05a4[_0xf3ac('0xa')]],_0x1b05a4);dials[_0x1b05a4[_0xf3ac('0xa')]][_0xf3ac('0x1e')]=utils[_0xf3ac('0x1f')]();dials[_0x1b05a4[_0xf3ac('0xa')]][_0xf3ac('0x20')]=_0xf3ac('0x21');utils['info'](util[_0xf3ac('0x2')](_0xf3ac('0x22'),_0x1b05a4['uniqueid'],dials[_0x1b05a4[_0xf3ac('0xa')]][_0xf3ac('0x1e')]));}}catch(_0x57da88){utils[_0xf3ac('0x1a')](util[_0xf3ac('0x2')]('[%s][dials][dialbegin]',_0x1b05a4[_0xf3ac('0xa')]),_0x57da88);}};exports[_0xf3ac('0x23')]=function(_0x472690){try{if(!_[_0xf3ac('0x1b')](dials[_0x472690[_0xf3ac('0xa')]])){utils[_0xf3ac('0xc')](util['format'](_0xf3ac('0x24'),_0x472690[_0xf3ac('0xa')]),_0x472690);dials[_0x472690[_0xf3ac('0xa')]]['dialstatus']=_0x472690[_0xf3ac('0x7')];if(_0x472690['dialstatus']==_0xf3ac('0x25')){dials[_0x472690['uniqueid']]=_[_0xf3ac('0x1d')](dials[_0x472690['uniqueid']],_0x472690);dials[_0x472690['uniqueid']][_0xf3ac('0x26')]=utils[_0xf3ac('0x1f')]();dials[_0x472690[_0xf3ac('0xa')]][_0xf3ac('0x20')]=_0xf3ac('0x27');utils[_0xf3ac('0x1')](util[_0xf3ac('0x2')](_0xf3ac('0x28'),_0x472690[_0xf3ac('0xa')],_0x472690[_0xf3ac('0x7')],dials[_0x472690[_0xf3ac('0xa')]]['answertime']));}else{utils[_0xf3ac('0x1')](util[_0xf3ac('0x2')]('[%s][dials][dialend]\x20dialstatus:%s',_0x472690[_0xf3ac('0xa')],_0x472690[_0xf3ac('0x7')]));}}}catch(_0x4285cf){utils[_0xf3ac('0x1a')](util['format'](_0xf3ac('0x24'),_0x472690['uniqueid']),_0x4285cf);}};exports['hangup']=function(_0x1b9688){try{if(!_['isNil'](dials[_0x1b9688[_0xf3ac('0xa')]])){utils[_0xf3ac('0xc')](util[_0xf3ac('0x2')](_0xf3ac('0x29'),_0x1b9688['uniqueid']),_0x1b9688);utils['info'](util[_0xf3ac('0x2')](_0xf3ac('0x2a'),_0x1b9688[_0xf3ac('0xa')],_0x1b9688[_0xf3ac('0x5')],_0x1b9688['calleridname'],_0x1b9688[_0xf3ac('0x2b')]));dials[_0x1b9688[_0xf3ac('0xa')]]=_[_0xf3ac('0x1d')](dials[_0x1b9688[_0xf3ac('0xa')]],{'endtime':utils['now'](),'lastevent':_0xf3ac('0x2c')});dials[_0x1b9688['uniqueid']][_0xf3ac('0x2d')]=utils[_0xf3ac('0x2e')](dials[_0x1b9688[_0xf3ac('0xa')]]['endtime'],dials[_0x1b9688[_0xf3ac('0xa')]][_0xf3ac('0x1e')]);dials[_0x1b9688[_0xf3ac('0xa')]]['holdtime']=utils[_0xf3ac('0x2e')](dials[_0x1b9688[_0xf3ac('0xa')]][_0xf3ac('0x26')]||dials[_0x1b9688[_0xf3ac('0xa')]]['endtime'],dials[_0x1b9688[_0xf3ac('0xa')]][_0xf3ac('0x1e')]);dials[_0x1b9688['uniqueid']][_0xf3ac('0x2f')]=dials[_0x1b9688[_0xf3ac('0xa')]][_0xf3ac('0x26')]?utils[_0xf3ac('0x2e')](dials[_0x1b9688[_0xf3ac('0xa')]][_0xf3ac('0x30')],dials[_0x1b9688[_0xf3ac('0xa')]][_0xf3ac('0x26')]):0x0;writeDB(dials[_0x1b9688[_0xf3ac('0xa')]]);}}catch(_0x89d772){utils['error'](util[_0xf3ac('0x2')](_0xf3ac('0x29'),_0x1b9688[_0xf3ac('0xa')]),_0x89d772);}}; \ No newline at end of file +var _0xbf1d=['[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr(routeid)','varset','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','[%s][dials][varset]','dialbegin','assign','starttime','now','lastevent','called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','dialstatus','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','holdtime','endtime','lodash','util','./utils','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','debug','format'];(function(_0x5f5660,_0x3b21a7){var _0x2b02be=function(_0x1ef451){while(--_0x1ef451){_0x5f5660['push'](_0x5f5660['shift']());}};_0x2b02be(++_0x3b21a7);}(_0xbf1d,0x16c));var _0xdbf1=function(_0x3fe358,_0x18c552){_0x3fe358=_0x3fe358-0x0;var _0x14e020=_0xbf1d[_0x3fe358];return _0x14e020;};'use strict';var _=require(_0xdbf1('0x0'));var util=require(_0xdbf1('0x1'));var utils=require(_0xdbf1('0x2'));var dials={};function writeDB(_0xe189c9){utils['info'](util['format'](_0xdbf1('0x3'),_0xe189c9[_0xdbf1('0x4')],_0xe189c9[_0xdbf1('0x5')],_0xe189c9[_0xdbf1('0x6')],_0xe189c9[_0xdbf1('0x7')],_0xe189c9[_0xdbf1('0x8')],_0xe189c9['dialstatus']));utils[_0xdbf1('0x9')](_0xdbf1('0xa'),_0xe189c9);delete dials[_0xe189c9[_0xdbf1('0x4')]];}exports[_0xdbf1('0xb')]=function(_0x546be){try{utils[_0xdbf1('0xc')](util[_0xdbf1('0xd')](_0xdbf1('0xe'),_0x546be['uniqueid']),_0x546be);utils[_0xdbf1('0xf')](util[_0xdbf1('0xd')](_0xdbf1('0x10'),_0x546be[_0xdbf1('0x4')],_0x546be[_0xdbf1('0x11')],_0x546be[_0xdbf1('0x12')]));if(_0x546be[_0xdbf1('0x11')]['toLowerCase']()==_0xdbf1('0x13')&&_[_0xdbf1('0x14')](_0x546be['appdata'][_0xdbf1('0x15')](),_0xdbf1('0x16'))){var _0x4255f0=_0x546be[_0xdbf1('0x12')]['split']('=');dials[_0x546be['uniqueid']]={'routeId':_0x4255f0[0x1]};}}catch(_0x3048a7){utils['error'](util[_0xdbf1('0xd')](_0xdbf1('0xe'),_0x546be[_0xdbf1('0x4')]),_0x3048a7);}};exports[_0xdbf1('0x17')]=function(_0x261488){try{utils[_0xdbf1('0xc')](util[_0xdbf1('0xd')]('[%s][dials][varset]',_0x261488[_0xdbf1('0x4')]),_0x261488);if(!_[_0xdbf1('0x18')](_0x261488[_0xdbf1('0x19')][_0xdbf1('0x1a')])){utils[_0xdbf1('0xf')](util['format'](_0xdbf1('0x1b'),_0x261488[_0xdbf1('0x4')],_0x261488[_0xdbf1('0x1c')]));dials[_0x261488[_0xdbf1('0x4')]]={'routeId':_0x261488[_0xdbf1('0x1c')]};}}catch(_0x386610){utils[_0xdbf1('0x1d')](util[_0xdbf1('0xd')](_0xdbf1('0x1e'),_0x261488[_0xdbf1('0x4')]),_0x386610);}};exports[_0xdbf1('0x1f')]=function(_0xd31b47){try{if(!_['isNil'](dials[_0xd31b47[_0xdbf1('0x4')]])){utils[_0xdbf1('0xc')](util[_0xdbf1('0xd')]('[%s][dials][dialbegin]',_0xd31b47[_0xdbf1('0x4')]),_0xd31b47);dials[_0xd31b47['uniqueid']]=_[_0xdbf1('0x20')](dials[_0xd31b47[_0xdbf1('0x4')]],_0xd31b47);dials[_0xd31b47[_0xdbf1('0x4')]][_0xdbf1('0x21')]=utils[_0xdbf1('0x22')]();dials[_0xd31b47[_0xdbf1('0x4')]][_0xdbf1('0x23')]=_0xdbf1('0x24');utils['info'](util[_0xdbf1('0xd')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0xd31b47[_0xdbf1('0x4')],dials[_0xd31b47['uniqueid']][_0xdbf1('0x21')]));}}catch(_0x1b34df){utils[_0xdbf1('0x1d')](util[_0xdbf1('0xd')](_0xdbf1('0x25'),_0xd31b47[_0xdbf1('0x4')]),_0x1b34df);}};exports[_0xdbf1('0x26')]=function(_0x2f7a8e){try{if(!_[_0xdbf1('0x18')](dials[_0x2f7a8e['uniqueid']])){utils[_0xdbf1('0xc')](util['format'](_0xdbf1('0x27'),_0x2f7a8e[_0xdbf1('0x4')]),_0x2f7a8e);dials[_0x2f7a8e[_0xdbf1('0x4')]][_0xdbf1('0x28')]=_0x2f7a8e[_0xdbf1('0x28')];if(_0x2f7a8e[_0xdbf1('0x28')]=='ANSWER'){dials[_0x2f7a8e[_0xdbf1('0x4')]]=_[_0xdbf1('0x20')](dials[_0x2f7a8e['uniqueid']],_0x2f7a8e);dials[_0x2f7a8e['uniqueid']][_0xdbf1('0x29')]=utils['now']();dials[_0x2f7a8e[_0xdbf1('0x4')]]['lastevent']='connect';utils[_0xdbf1('0xf')](util[_0xdbf1('0xd')](_0xdbf1('0x2a'),_0x2f7a8e['uniqueid'],_0x2f7a8e[_0xdbf1('0x28')],dials[_0x2f7a8e[_0xdbf1('0x4')]][_0xdbf1('0x29')]));}else{utils[_0xdbf1('0xf')](util[_0xdbf1('0xd')](_0xdbf1('0x2b'),_0x2f7a8e[_0xdbf1('0x4')],_0x2f7a8e[_0xdbf1('0x28')]));}}}catch(_0x26fdb0){utils[_0xdbf1('0x1d')](util[_0xdbf1('0xd')](_0xdbf1('0x27'),_0x2f7a8e[_0xdbf1('0x4')]),_0x26fdb0);}};exports[_0xdbf1('0x2c')]=function(_0x49578f){try{if(!_[_0xdbf1('0x18')](dials[_0x49578f[_0xdbf1('0x4')]])){utils[_0xdbf1('0xc')](util['format'](_0xdbf1('0x2d'),_0x49578f[_0xdbf1('0x4')]),_0x49578f);utils['info'](util[_0xdbf1('0xd')](_0xdbf1('0x2e'),_0x49578f[_0xdbf1('0x4')],_0x49578f[_0xdbf1('0x7')],_0x49578f[_0xdbf1('0x2f')],_0x49578f[_0xdbf1('0x30')]));dials[_0x49578f[_0xdbf1('0x4')]]=_[_0xdbf1('0x20')](dials[_0x49578f['uniqueid']],{'endtime':utils[_0xdbf1('0x22')](),'lastevent':_0xdbf1('0x31')});dials[_0x49578f['uniqueid']][_0xdbf1('0x32')]=utils[_0xdbf1('0x33')](dials[_0x49578f['uniqueid']]['endtime'],dials[_0x49578f[_0xdbf1('0x4')]][_0xdbf1('0x21')]);dials[_0x49578f['uniqueid']][_0xdbf1('0x34')]=utils[_0xdbf1('0x33')](dials[_0x49578f[_0xdbf1('0x4')]][_0xdbf1('0x29')]||dials[_0x49578f[_0xdbf1('0x4')]][_0xdbf1('0x35')],dials[_0x49578f[_0xdbf1('0x4')]][_0xdbf1('0x21')]);dials[_0x49578f[_0xdbf1('0x4')]]['billableseconds']=dials[_0x49578f['uniqueid']][_0xdbf1('0x29')]?utils[_0xdbf1('0x33')](dials[_0x49578f[_0xdbf1('0x4')]]['endtime'],dials[_0x49578f[_0xdbf1('0x4')]][_0xdbf1('0x29')]):0x0;writeDB(dials[_0x49578f[_0xdbf1('0x4')]]);}}catch(_0x46ffe8){utils[_0xdbf1('0x1d')](util[_0xdbf1('0xd')]('[%s][dials][hangup]',_0x49578f['uniqueid']),_0x46ffe8);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 034fe2a..cae7c79 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 _0x4a38=['[%s][index][agentcalled]','agentringnoanswer','uniqueid','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][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','varset','[%s][index][varset]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','password','keepConnected','info','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','format'];(function(_0x13237c,_0x4b441c){var _0x26cf8c=function(_0x118456){while(--_0x118456){_0x13237c['push'](_0x13237c['shift']());}};_0x26cf8c(++_0x4b441c);}(_0x4a38,0x17f));var _0x84a3=function(_0xfcdb08,_0x564791){_0xfcdb08=_0xfcdb08-0x0;var _0x16cb3e=_0x4a38[_0xfcdb08];return _0x16cb3e;};var AsteriskManager=require(_0x84a3('0x0'));var config=require('../../config/environment');var utils=require(_0x84a3('0x1'));var util=require(_0x84a3('0x2'));var isXDREnabled=config[_0x84a3('0x3')]&&config[_0x84a3('0x3')][_0x84a3('0x4')]?!config['xdr'][_0x84a3('0x4')]:!![];var isProduction=config[_0x84a3('0x5')]===_0x84a3('0x6')||![];var isLocalAsterisk=config[_0x84a3('0x3')]&&config['xdr'][_0x84a3('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x84a3('0x8')][_0x84a3('0x9')],config[_0x84a3('0x8')]['ip'],config[_0x84a3('0x8')][_0x84a3('0xa')],config['asterisk'][_0x84a3('0xb')],!![]);ami[_0x84a3('0xc')]();if(!isXDREnabled){utils['info']('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x84a3('0xd')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x84a3('0xe'));var calls=require(_0x84a3('0xf'));var queues=require(_0x84a3('0x10'));var recordings=require(_0x84a3('0x11'));var members=require(_0x84a3('0x12'));var dials=require('./dials.controller');var transfers=require(_0x84a3('0x13'));var core=require('./core.controller');ami['on'](_0x84a3('0x14'),core[_0x84a3('0x14')]);ami['on'](_0x84a3('0x15'),core[_0x84a3('0x15')]);ami['on'](_0x84a3('0x16'),core[_0x84a3('0x16')]);ami['on'](_0x84a3('0x17'),core[_0x84a3('0x17')]);ami['on'](_0x84a3('0x18'),core[_0x84a3('0x18')]);ami['on'](_0x84a3('0x19'),core[_0x84a3('0x19')]);ami['on'](_0x84a3('0x1a'),function(_0x557a69){try{utils[_0x84a3('0x1b')](util['format'](_0x84a3('0x1c'),_0x557a69[_0x84a3('0x1d')]),_0x557a69);members['devicestatechange'](_0x557a69);}catch(_0x5dc174){utils['error'](util[_0x84a3('0x1e')](_0x84a3('0x1c'),_0x557a69[_0x84a3('0x1d')]),_0x5dc174);}});ami['on']('agentcalled',function(_0x8f9061){try{utils[_0x84a3('0x1b')](util[_0x84a3('0x1e')](_0x84a3('0x1f'),_0x8f9061['uniqueid']),_0x8f9061);agents['agentcalled'](_0x8f9061);}catch(_0x2b149b){utils['error'](util[_0x84a3('0x1e')](_0x84a3('0x1f'),_0x8f9061['uniqueid']),_0x2b149b);}});ami['on'](_0x84a3('0x20'),function(_0x53ffd4){try{utils[_0x84a3('0x1b')](util[_0x84a3('0x1e')]('[%s][index][agentringnoanswer]',_0x53ffd4[_0x84a3('0x21')]),_0x53ffd4);agents[_0x84a3('0x20')](_0x53ffd4);}catch(_0x2a99fd){utils[_0x84a3('0x17')](util[_0x84a3('0x1e')](_0x84a3('0x22'),_0x53ffd4[_0x84a3('0x21')]),_0x2a99fd);}});ami['on'](_0x84a3('0x23'),function(_0x1c6eec){try{utils[_0x84a3('0x1b')](util[_0x84a3('0x1e')](_0x84a3('0x24'),_0x1c6eec[_0x84a3('0x21')]),_0x1c6eec);agents[_0x84a3('0x23')](_0x1c6eec);queues[_0x84a3('0x23')](_0x1c6eec);}catch(_0x5797be){utils[_0x84a3('0x17')](util[_0x84a3('0x1e')](_0x84a3('0x24'),_0x1c6eec[_0x84a3('0x21')]),_0x5797be);}});ami['on']('agentcomplete',function(_0x5cea23){try{utils['debug'](util[_0x84a3('0x1e')](_0x84a3('0x25'),_0x5cea23[_0x84a3('0x21')]),_0x5cea23);agents[_0x84a3('0x26')](_0x5cea23);queues[_0x84a3('0x26')](_0x5cea23);members['agentcomplete'](_0x5cea23);}catch(_0x27dc48){utils['error'](util['format'](_0x84a3('0x25'),_0x5cea23['uniqueid']),_0x27dc48);}});ami['on'](_0x84a3('0x27'),function(_0x2d1781){try{utils['debug'](util[_0x84a3('0x1e')](_0x84a3('0x28'),_0x2d1781[_0x84a3('0x21')]),_0x2d1781);agents['queuecallerabandon'](_0x2d1781);queues[_0x84a3('0x27')](_0x2d1781);}catch(_0x438cee){utils[_0x84a3('0x17')](util['format']('[%s][index][queuecallerabandon]',_0x2d1781[_0x84a3('0x21')]),_0x438cee);}});ami['on'](_0x84a3('0x29'),function(_0x15a0c4){try{utils[_0x84a3('0x1b')](util[_0x84a3('0x1e')]('[%s][index][queuecallerjoin]',_0x15a0c4[_0x84a3('0x21')]),_0x15a0c4);queues[_0x84a3('0x29')](_0x15a0c4);recordings[_0x84a3('0x29')](_0x15a0c4);}catch(_0x23b92b){utils[_0x84a3('0x17')](util[_0x84a3('0x1e')](_0x84a3('0x2a'),_0x15a0c4[_0x84a3('0x21')]),_0x23b92b);}});ami['on']('queuecallerleave',function(_0xcc0b30){try{utils[_0x84a3('0x1b')](util[_0x84a3('0x1e')](_0x84a3('0x2b'),_0xcc0b30[_0x84a3('0x21')]),_0xcc0b30);queues['queuecallerleave'](_0xcc0b30);}catch(_0x51ca88){utils[_0x84a3('0x17')](util[_0x84a3('0x1e')](_0x84a3('0x2b'),_0xcc0b30[_0x84a3('0x21')]),_0x51ca88);}});ami['on'](_0x84a3('0x2c'),function(_0x1d283e){try{utils[_0x84a3('0x1b')](util[_0x84a3('0x1e')](_0x84a3('0x2d'),_0x1d283e[_0x84a3('0x21')]),_0x1d283e);queues[_0x84a3('0x2c')](_0x1d283e);calls[_0x84a3('0x2c')](_0x1d283e);}catch(_0x19afb3){utils[_0x84a3('0x17')](util['format'](_0x84a3('0x2d'),_0x1d283e[_0x84a3('0x21')]),_0x19afb3);}});ami['on'](_0x84a3('0x2e'),function(_0x83f21f){try{utils[_0x84a3('0x1b')](util['format'](_0x84a3('0x2f'),_0x83f21f[_0x84a3('0x21')]),_0x83f21f);queues[_0x84a3('0x2e')](_0x83f21f);calls[_0x84a3('0x2e')](_0x83f21f);}catch(_0xf2d0eb){utils['error'](util[_0x84a3('0x1e')](_0x84a3('0x2f'),_0x83f21f[_0x84a3('0x21')]),_0xf2d0eb);}});ami['on'](_0x84a3('0x30'),function(_0x574b2e){try{utils[_0x84a3('0x1b')](util[_0x84a3('0x1e')](_0x84a3('0x31'),_0x574b2e[_0x84a3('0x21')]),_0x574b2e);calls[_0x84a3('0x30')](_0x574b2e);recordings[_0x84a3('0x30')](_0x574b2e);}catch(_0x3db83a){utils[_0x84a3('0x17')](util[_0x84a3('0x1e')](_0x84a3('0x31'),_0x574b2e[_0x84a3('0x21')]),_0x3db83a);}});ami['on'](_0x84a3('0x32'),function(_0x32e7b1){try{utils['debug'](util['format'](_0x84a3('0x33'),_0x32e7b1[_0x84a3('0x21')]),_0x32e7b1);calls[_0x84a3('0x32')](_0x32e7b1);recordings['hangup'](_0x32e7b1);dials['hangup'](_0x32e7b1);agents[_0x84a3('0x32')](_0x32e7b1);queues[_0x84a3('0x32')](_0x32e7b1);}catch(_0x1da3af){utils[_0x84a3('0x17')](util[_0x84a3('0x1e')]('[%s][index][hangup]',_0x32e7b1[_0x84a3('0x21')]),_0x1da3af);}});ami['on']('cdr',function(_0xb9579e){try{utils['debug'](util['format']('[%s][index][cdr]',_0xb9579e['uniqueid']),_0xb9579e);members[_0x84a3('0x34')](_0xb9579e);}catch(_0x3435a9){utils['error'](util[_0x84a3('0x1e')](_0x84a3('0x35'),_0xb9579e['uniqueid']),_0x3435a9);}});ami['on'](_0x84a3('0x36'),function(_0x2c936d){try{utils[_0x84a3('0x1b')](util[_0x84a3('0x1e')](_0x84a3('0x37'),_0x2c936d[_0x84a3('0x21')]),_0x2c936d);queues[_0x84a3('0x36')](_0x2c936d);agents[_0x84a3('0x36')](_0x2c936d);transfers[_0x84a3('0x36')](_0x2c936d);}catch(_0xada42){utils[_0x84a3('0x17')](util[_0x84a3('0x1e')](_0x84a3('0x37'),_0x2c936d[_0x84a3('0x21')]),_0xada42);}});ami['on'](_0x84a3('0x38'),function(_0x1ae88c){try{utils[_0x84a3('0x1b')](util[_0x84a3('0x1e')](_0x84a3('0x39'),_0x1ae88c[_0x84a3('0x3a')]),_0x1ae88c);queues[_0x84a3('0x38')](_0x1ae88c);transfers['attendedtransfer'](_0x1ae88c);agents[_0x84a3('0x38')](_0x1ae88c);calls[_0x84a3('0x38')](_0x1ae88c);}catch(_0x1ad87c){utils['error'](util[_0x84a3('0x1e')](_0x84a3('0x39'),_0x1ae88c[_0x84a3('0x3a')]),_0x1ad87c);}});ami['on'](_0x84a3('0x3b'),function(_0x15f5ef){try{utils[_0x84a3('0x1b')](util[_0x84a3('0x1e')]('[%s][index][varset]',_0x15f5ef[_0x84a3('0x21')]),_0x15f5ef);queues[_0x84a3('0x3b')](_0x15f5ef);recordings[_0x84a3('0x3b')](_0x15f5ef);calls[_0x84a3('0x3b')](_0x15f5ef);dials['varset'](_0x15f5ef);}catch(_0x25d484){utils[_0x84a3('0x17')](util[_0x84a3('0x1e')](_0x84a3('0x3c'),_0x15f5ef[_0x84a3('0x21')]),_0x25d484);}});ami['on'](_0x84a3('0x3d'),function(_0xb355a2){try{utils['debug'](util[_0x84a3('0x1e')]('[%s][index][newexten]',_0xb355a2[_0x84a3('0x21')]),_0xb355a2);calls[_0x84a3('0x3d')](_0xb355a2);recordings[_0x84a3('0x3d')](_0xb355a2);dials[_0x84a3('0x3d')](_0xb355a2);}catch(_0x3128d3){utils[_0x84a3('0x17')](util['format']('[%s][index][newexten]',_0xb355a2[_0x84a3('0x21')]),_0x3128d3);}});ami['on'](_0x84a3('0x3e'),function(_0xcbde36){try{utils[_0x84a3('0x1b')](util[_0x84a3('0x1e')](_0x84a3('0x3f'),_0xcbde36[_0x84a3('0x21')]),_0xcbde36);calls[_0x84a3('0x3e')](_0xcbde36);recordings[_0x84a3('0x3e')](_0xcbde36);}catch(_0x3fbefa){utils[_0x84a3('0x17')](util[_0x84a3('0x1e')](_0x84a3('0x3f'),_0xcbde36['uniqueid']),_0x3fbefa);}});ami['on'](_0x84a3('0x40'),function(_0x480677){try{utils[_0x84a3('0x1b')](util['format'](_0x84a3('0x41'),_0x480677[_0x84a3('0x21')]),_0x480677);dials[_0x84a3('0x40')](_0x480677);}catch(_0x419dd3){utils['error'](util[_0x84a3('0x1e')](_0x84a3('0x42'),_0x480677[_0x84a3('0x21')]),_0x419dd3);}});ami['on'](_0x84a3('0x43'),function(_0x590ad8){try{utils[_0x84a3('0x1b')](util[_0x84a3('0x1e')](_0x84a3('0x44'),_0x590ad8[_0x84a3('0x21')]),_0x590ad8);dials['dialend'](_0x590ad8);}catch(_0x5acb48){utils[_0x84a3('0x17')](util[_0x84a3('0x1e')](_0x84a3('0x44'),_0x590ad8[_0x84a3('0x21')]),_0x5acb48);}});} \ No newline at end of file +var _0x97b2=['XDR\x20DISABLED','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','debug','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][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]','origtransfereruniqueid','attendedtransfer','[%s][index][attendedtransfer]','[%s][index][varset]','varset','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','util','xdr','disabled','production','local','port','asterisk','password','info'];(function(_0x53bd01,_0x4a67c0){var _0x55c7f2=function(_0x31723c){while(--_0x31723c){_0x53bd01['push'](_0x53bd01['shift']());}};_0x55c7f2(++_0x4a67c0);}(_0x97b2,0x193));var _0x297b=function(_0x25248b,_0x3c8491){_0x25248b=_0x25248b-0x0;var _0x509939=_0x97b2[_0x25248b];return _0x509939;};var AsteriskManager=require('asterisk-manager');var config=require(_0x297b('0x0'));var utils=require(_0x297b('0x1'));var util=require(_0x297b('0x2'));var isXDREnabled=config[_0x297b('0x3')]&&config[_0x297b('0x3')][_0x297b('0x4')]?!config[_0x297b('0x3')]['disabled']:!![];var isProduction=config['env']===_0x297b('0x5')||![];var isLocalAsterisk=config[_0x297b('0x3')]&&config[_0x297b('0x3')][_0x297b('0x6')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x297b('0x7')],config[_0x297b('0x8')]['ip'],config[_0x297b('0x8')]['username'],config[_0x297b('0x8')][_0x297b('0x9')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x297b('0xa')](_0x297b('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x297b('0xa')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require('./agents.controller');var calls=require(_0x297b('0xc'));var queues=require('./queues.controller');var recordings=require(_0x297b('0xd'));var members=require(_0x297b('0xe'));var dials=require(_0x297b('0xf'));var transfers=require(_0x297b('0x10'));var core=require(_0x297b('0x11'));ami['on']('connect',core[_0x297b('0x12')]);ami['on'](_0x297b('0x13'),core[_0x297b('0x13')]);ami['on'](_0x297b('0x14'),core[_0x297b('0x14')]);ami['on'](_0x297b('0x15'),core['error']);ami['on'](_0x297b('0x16'),core[_0x297b('0x16')]);ami['on'](_0x297b('0x17'),core[_0x297b('0x17')]);ami['on'](_0x297b('0x18'),function(_0x1b0f03){try{utils['debug'](util[_0x297b('0x19')](_0x297b('0x1a'),_0x1b0f03[_0x297b('0x1b')]),_0x1b0f03);members['devicestatechange'](_0x1b0f03);}catch(_0x410c7f){utils[_0x297b('0x15')](util[_0x297b('0x19')](_0x297b('0x1a'),_0x1b0f03[_0x297b('0x1b')]),_0x410c7f);}});ami['on']('agentcalled',function(_0x2bbceb){try{utils[_0x297b('0x1c')](util[_0x297b('0x19')](_0x297b('0x1d'),_0x2bbceb[_0x297b('0x1e')]),_0x2bbceb);agents[_0x297b('0x1f')](_0x2bbceb);}catch(_0x4498c1){utils[_0x297b('0x15')](util[_0x297b('0x19')](_0x297b('0x1d'),_0x2bbceb[_0x297b('0x1e')]),_0x4498c1);}});ami['on'](_0x297b('0x20'),function(_0x2379c1){try{utils[_0x297b('0x1c')](util['format'](_0x297b('0x21'),_0x2379c1['uniqueid']),_0x2379c1);agents[_0x297b('0x20')](_0x2379c1);}catch(_0x3a5cb2){utils['error'](util[_0x297b('0x19')](_0x297b('0x21'),_0x2379c1[_0x297b('0x1e')]),_0x3a5cb2);}});ami['on'](_0x297b('0x22'),function(_0x2b937f){try{utils[_0x297b('0x1c')](util['format']('[%s][index][agentconnect]',_0x2b937f[_0x297b('0x1e')]),_0x2b937f);agents[_0x297b('0x22')](_0x2b937f);queues[_0x297b('0x22')](_0x2b937f);}catch(_0x596483){utils['error'](util[_0x297b('0x19')](_0x297b('0x23'),_0x2b937f[_0x297b('0x1e')]),_0x596483);}});ami['on']('agentcomplete',function(_0x5775db){try{utils[_0x297b('0x1c')](util[_0x297b('0x19')](_0x297b('0x24'),_0x5775db[_0x297b('0x1e')]),_0x5775db);agents['agentcomplete'](_0x5775db);queues['agentcomplete'](_0x5775db);members[_0x297b('0x25')](_0x5775db);}catch(_0x2a48cf){utils[_0x297b('0x15')](util['format'](_0x297b('0x24'),_0x5775db['uniqueid']),_0x2a48cf);}});ami['on'](_0x297b('0x26'),function(_0x24c4de){try{utils[_0x297b('0x1c')](util[_0x297b('0x19')](_0x297b('0x27'),_0x24c4de[_0x297b('0x1e')]),_0x24c4de);agents[_0x297b('0x26')](_0x24c4de);queues[_0x297b('0x26')](_0x24c4de);}catch(_0x55dca1){utils['error'](util[_0x297b('0x19')](_0x297b('0x27'),_0x24c4de['uniqueid']),_0x55dca1);}});ami['on'](_0x297b('0x28'),function(_0x189b7c){try{utils[_0x297b('0x1c')](util[_0x297b('0x19')](_0x297b('0x29'),_0x189b7c['uniqueid']),_0x189b7c);queues[_0x297b('0x28')](_0x189b7c);recordings['queuecallerjoin'](_0x189b7c);}catch(_0x4a464b){utils[_0x297b('0x15')](util[_0x297b('0x19')](_0x297b('0x29'),_0x189b7c[_0x297b('0x1e')]),_0x4a464b);}});ami['on']('queuecallerleave',function(_0xeb9fb1){try{utils[_0x297b('0x1c')](util[_0x297b('0x19')](_0x297b('0x2a'),_0xeb9fb1[_0x297b('0x1e')]),_0xeb9fb1);queues['queuecallerleave'](_0xeb9fb1);}catch(_0x53db82){utils[_0x297b('0x15')](util[_0x297b('0x19')]('[%s][index][queuecallerleave]',_0xeb9fb1[_0x297b('0x1e')]),_0x53db82);}});ami['on'](_0x297b('0x2b'),function(_0x2849fc){try{utils['debug'](util[_0x297b('0x19')]('[%s][index][musiconholdstart]',_0x2849fc['uniqueid']),_0x2849fc);queues[_0x297b('0x2b')](_0x2849fc);calls[_0x297b('0x2b')](_0x2849fc);}catch(_0x4169c6){utils[_0x297b('0x15')](util[_0x297b('0x19')](_0x297b('0x2c'),_0x2849fc[_0x297b('0x1e')]),_0x4169c6);}});ami['on'](_0x297b('0x2d'),function(_0x2d9128){try{utils['debug'](util['format'](_0x297b('0x2e'),_0x2d9128[_0x297b('0x1e')]),_0x2d9128);queues[_0x297b('0x2d')](_0x2d9128);calls['musiconholdstop'](_0x2d9128);}catch(_0x23ce52){utils[_0x297b('0x15')](util[_0x297b('0x19')]('[%s][index][musiconholdstop]',_0x2d9128['uniqueid']),_0x23ce52);}});ami['on'](_0x297b('0x2f'),function(_0x59bbd6){try{utils['debug'](util['format']('[%s][index][newstate]',_0x59bbd6['uniqueid']),_0x59bbd6);calls['newstate'](_0x59bbd6);recordings['newstate'](_0x59bbd6);}catch(_0x34a196){utils['error'](util[_0x297b('0x19')](_0x297b('0x30'),_0x59bbd6[_0x297b('0x1e')]),_0x34a196);}});ami['on'](_0x297b('0x31'),function(_0x3b822b){try{utils[_0x297b('0x1c')](util[_0x297b('0x19')](_0x297b('0x32'),_0x3b822b[_0x297b('0x1e')]),_0x3b822b);calls[_0x297b('0x31')](_0x3b822b);recordings[_0x297b('0x31')](_0x3b822b);dials['hangup'](_0x3b822b);agents[_0x297b('0x31')](_0x3b822b);queues['hangup'](_0x3b822b);}catch(_0x572a75){utils['error'](util[_0x297b('0x19')](_0x297b('0x32'),_0x3b822b[_0x297b('0x1e')]),_0x572a75);}});ami['on'](_0x297b('0x33'),function(_0x2520b1){try{utils['debug'](util[_0x297b('0x19')](_0x297b('0x34'),_0x2520b1[_0x297b('0x1e')]),_0x2520b1);members['cdr'](_0x2520b1);}catch(_0x599ec8){utils[_0x297b('0x15')](util[_0x297b('0x19')](_0x297b('0x34'),_0x2520b1['uniqueid']),_0x599ec8);}});ami['on'](_0x297b('0x35'),function(_0x5e860c){try{utils[_0x297b('0x1c')](util[_0x297b('0x19')](_0x297b('0x36'),_0x5e860c[_0x297b('0x1e')]),_0x5e860c);queues[_0x297b('0x35')](_0x5e860c);agents[_0x297b('0x35')](_0x5e860c);transfers[_0x297b('0x35')](_0x5e860c);}catch(_0x554ee9){utils[_0x297b('0x15')](util[_0x297b('0x19')](_0x297b('0x36'),_0x5e860c[_0x297b('0x1e')]),_0x554ee9);}});ami['on']('attendedtransfer',function(_0x5e9dd9){try{utils[_0x297b('0x1c')](util['format']('[%s][index][attendedtransfer]',_0x5e9dd9[_0x297b('0x37')]),_0x5e9dd9);queues[_0x297b('0x38')](_0x5e9dd9);transfers[_0x297b('0x38')](_0x5e9dd9);agents[_0x297b('0x38')](_0x5e9dd9);calls[_0x297b('0x38')](_0x5e9dd9);}catch(_0x192fdf){utils[_0x297b('0x15')](util['format'](_0x297b('0x39'),_0x5e9dd9[_0x297b('0x37')]),_0x192fdf);}});ami['on']('varset',function(_0x4ed3db){try{utils[_0x297b('0x1c')](util[_0x297b('0x19')](_0x297b('0x3a'),_0x4ed3db[_0x297b('0x1e')]),_0x4ed3db);queues[_0x297b('0x3b')](_0x4ed3db);recordings[_0x297b('0x3b')](_0x4ed3db);calls['varset'](_0x4ed3db);dials[_0x297b('0x3b')](_0x4ed3db);}catch(_0x5bd73f){utils['error'](util['format'](_0x297b('0x3a'),_0x4ed3db[_0x297b('0x1e')]),_0x5bd73f);}});ami['on']('newexten',function(_0x15bb7a){try{utils[_0x297b('0x1c')](util[_0x297b('0x19')](_0x297b('0x3c'),_0x15bb7a[_0x297b('0x1e')]),_0x15bb7a);calls['newexten'](_0x15bb7a);recordings['newexten'](_0x15bb7a);dials[_0x297b('0x3d')](_0x15bb7a);}catch(_0x1c775c){utils[_0x297b('0x15')](util[_0x297b('0x19')](_0x297b('0x3c'),_0x15bb7a[_0x297b('0x1e')]),_0x1c775c);}});ami['on'](_0x297b('0x3e'),function(_0x113454){try{utils[_0x297b('0x1c')](util[_0x297b('0x19')]('[%s][index][newchannel]',_0x113454[_0x297b('0x1e')]),_0x113454);calls[_0x297b('0x3e')](_0x113454);recordings['newchannel'](_0x113454);}catch(_0x344a0f){utils['error'](util[_0x297b('0x19')](_0x297b('0x3f'),_0x113454[_0x297b('0x1e')]),_0x344a0f);}});ami['on']('dialbegin',function(_0x5491ec){try{utils[_0x297b('0x1c')](util['format'](_0x297b('0x40'),_0x5491ec[_0x297b('0x1e')]),_0x5491ec);dials[_0x297b('0x41')](_0x5491ec);}catch(_0x2a4e4f){utils[_0x297b('0x15')](util[_0x297b('0x19')](_0x297b('0x42'),_0x5491ec[_0x297b('0x1e')]),_0x2a4e4f);}});ami['on'](_0x297b('0x43'),function(_0x2f968e){try{utils[_0x297b('0x1c')](util[_0x297b('0x19')]('[%s][index][dialend]',_0x2f968e[_0x297b('0x1e')]),_0x2f968e);dials[_0x297b('0x43')](_0x2f968e);}catch(_0x203d46){utils[_0x297b('0x15')](util[_0x297b('0x19')](_0x297b('0x44'),_0x2f968e[_0x297b('0x1e')]),_0x203d46);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 5ccea81..1a8177c 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 _0xe9fa=['getUserByInterface','then','name','internal','request','CreateMemberReport','split','catch','error','uniqueid','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','queue','assign','cdr','[%s][members][cdr]','data1','source','destination','data3','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','type'];(function(_0x4f0159,_0xaf2d85){var _0x2b53a8=function(_0x34e528){while(--_0x34e528){_0x4f0159['push'](_0x4f0159['shift']());}};_0x2b53a8(++_0xaf2d85);}(_0xe9fa,0x160));var _0xae9f=function(_0x466d3a,_0xc7ca2f){_0x466d3a=_0x466d3a-0x0;var _0x424889=_0xe9fa[_0x466d3a];return _0x424889;};'use strict';var _=require('lodash');var util=require(_0xae9f('0x0'));var utils=require(_0xae9f('0x1'));var members={};var exclude=[_0xae9f('0x2'),_0xae9f('0x3')];function writeDB(_0x4d6eed){utils[_0xae9f('0x4')](util[_0xae9f('0x5')](_0xae9f('0x6'),_0x4d6eed['uniqueid'],_0x4d6eed[_0xae9f('0x7')],_0x4d6eed[_0xae9f('0x8')],_0x4d6eed[_0xae9f('0x9')],_0x4d6eed[_0xae9f('0xa')],_0x4d6eed[_0xae9f('0xb')]));if(_0x4d6eed[_0xae9f('0x7')]){utils[_0xae9f('0xc')](_0x4d6eed[_0xae9f('0x7')])[_0xae9f('0xd')](function(_0x492b70){if(_0x492b70){_0x4d6eed[_0xae9f('0xa')]=_0x492b70[_0xae9f('0xe')];_0x4d6eed[_0xae9f('0xf')]=_0x492b70['internal'];utils[_0xae9f('0x10')](_0xae9f('0x11'),_0x4d6eed);}else{utils['getUserByName'](_0x4d6eed[_0xae9f('0x7')][_0xae9f('0x12')]('/')[0x1])[_0xae9f('0xd')](function(_0x2e0c0f){if(_0x2e0c0f){_0x4d6eed[_0xae9f('0xa')]=_0x2e0c0f[_0xae9f('0xe')];_0x4d6eed[_0xae9f('0xf')]=_0x2e0c0f[_0xae9f('0xf')];utils[_0xae9f('0x10')](_0xae9f('0x11'),_0x4d6eed);}});}})[_0xae9f('0x13')](function(_0xa5ca5f){utils[_0xae9f('0x14')](util[_0xae9f('0x5')]('[%s][members][writeDB]',_0x4d6eed[_0xae9f('0x15')]),_0xa5ca5f);});}delete members[_0x4d6eed['interface']];}function startsWith(_0x3f34b6,_0x5eaabd){return _['some'](_0x3f34b6,function(_0x4fb0f0){return _[_0xae9f('0x16')](_0x5eaabd,_0x4fb0f0);});}exports[_0xae9f('0x17')]=function(_0x384e87){try{utils[_0xae9f('0x18')](util[_0xae9f('0x5')](_0xae9f('0x19'),members[_0x384e87[_0xae9f('0x1a')]]?members[_0x384e87[_0xae9f('0x1a')]][_0xae9f('0x15')]:_0x384e87['device']),_0x384e87);utils[_0xae9f('0x4')](util[_0xae9f('0x5')](_0xae9f('0x1b'),members[_0x384e87[_0xae9f('0x1a')]]?members[_0x384e87[_0xae9f('0x1a')]][_0xae9f('0x15')]:_0x384e87[_0xae9f('0x1a')],_0x384e87[_0xae9f('0x1c')],_0x384e87[_0xae9f('0x1a')]));switch(_0x384e87[_0xae9f('0x1c')]){case _0xae9f('0x1d'):case _0xae9f('0x1e'):if(!startsWith(exclude,_0x384e87['device'])){members[_0x384e87[_0xae9f('0x1a')]]={'channel':_0xae9f('0x1f'),'interface':_0x384e87[_0xae9f('0x1a')],'type':_0xae9f('0x20'),'enterAt':utils[_0xae9f('0x21')](),'role':_0xae9f('0x22')};}break;case _0xae9f('0x23'):if(!_[_0xae9f('0x24')](members[_0x384e87['device']])){members[_0x384e87['device']][_0xae9f('0x25')]=utils[_0xae9f('0x21')]();members[_0x384e87['device']]['duration']=utils[_0xae9f('0x26')](members[_0x384e87[_0xae9f('0x1a')]][_0xae9f('0x25')],members[_0x384e87[_0xae9f('0x1a')]][_0xae9f('0x27')]);if(members[_0x384e87[_0xae9f('0x1a')]][_0xae9f('0x15')]){writeDB(members[_0x384e87[_0xae9f('0x1a')]]);}}break;default:break;}}catch(_0x1c5227){utils['error'](util[_0xae9f('0x5')](_0xae9f('0x19'),members[_0x384e87[_0xae9f('0x1a')]]?members[_0x384e87[_0xae9f('0x1a')]][_0xae9f('0x15')]:_0x384e87['device']),_0x1c5227);}};exports[_0xae9f('0x28')]=function(_0x3931ac){try{if(!_[_0xae9f('0x24')](members[_0x3931ac['interface']])){utils['debug'](util[_0xae9f('0x5')](_0xae9f('0x29'),_0x3931ac['uniqueid']),_0x3931ac);utils[_0xae9f('0x4')](util[_0xae9f('0x5')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x3931ac[_0xae9f('0x15')],_0x3931ac['interface'],_0x3931ac[_0xae9f('0x2a')]));members[_0x3931ac['interface']]=_[_0xae9f('0x2b')](members[_0x3931ac['interface']],{'data4':_0x3931ac[_0xae9f('0x2a')],'uniqueid':_0x3931ac[_0xae9f('0x15')]});}}catch(_0x3f0120){utils[_0xae9f('0x14')](util[_0xae9f('0x5')](_0xae9f('0x29'),_0x3931ac[_0xae9f('0x15')]),_0x3f0120);}};exports[_0xae9f('0x2c')]=function(_0x32506b){try{utils[_0xae9f('0x18')](util['format'](_0xae9f('0x2d'),_0x32506b[_0xae9f('0x15')]),_0x32506b);if(_0x32506b[_0xae9f('0x8')]){var _0x3df38f=_0x32506b['channel']['split']('-')[0x0];if(!_['isNil'](members[_0x3df38f])){members[_0x3df38f]=_['assign'](members[_0x3df38f],{'data1':members[_0x3df38f][_0xae9f('0x2e')]||_0x32506b['type'],'data2':members[_0x3df38f]['data2']||_0x32506b[_0xae9f('0x2f')],'data3':members[_0x3df38f]['data3']||_0x32506b[_0xae9f('0x30')],'uniqueid':members[_0x3df38f][_0xae9f('0x15')]||_0x32506b[_0xae9f('0x15')]});utils[_0xae9f('0x4')](util[_0xae9f('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x32506b[_0xae9f('0x15')],members[_0x3df38f][_0xae9f('0x2e')],members[_0x3df38f][_0xae9f('0x9')],members[_0x3df38f][_0xae9f('0x31')]));if(members[_0x3df38f][_0xae9f('0x25')]){writeDB(members[_0x3df38f]);}}}if(_0x32506b[_0xae9f('0x32')]){var _0x5ce51c=_0x32506b[_0xae9f('0x32')]['split']('-')[0x0];if(!_['isNil'](members[_0x5ce51c])){members[_0x5ce51c]=_[_0xae9f('0x2b')](members[_0x5ce51c],{'data1':members[_0x5ce51c][_0xae9f('0x2e')]||_0x32506b[_0xae9f('0xb')],'data2':members[_0x5ce51c][_0xae9f('0x9')]||_0x32506b[_0xae9f('0x2f')],'data3':members[_0x5ce51c][_0xae9f('0x31')]||_0x32506b['destination'],'uniqueid':members[_0x5ce51c][_0xae9f('0x15')]||_0x32506b[_0xae9f('0x15')]});utils[_0xae9f('0x4')](util[_0xae9f('0x5')](_0xae9f('0x33'),_0x32506b[_0xae9f('0x15')],members[_0x5ce51c][_0xae9f('0x2e')],members[_0x5ce51c][_0xae9f('0x9')],members[_0x5ce51c]['data3']));if(members[_0x5ce51c][_0xae9f('0x25')]){writeDB(members[_0x5ce51c]);}}}}catch(_0x595b22){utils[_0xae9f('0x14')](util[_0xae9f('0x5')](_0xae9f('0x2d'),_0x32506b[_0xae9f('0x15')]),_0x595b22);}}; \ No newline at end of file +var _0xb09d=['device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','format','queue','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','channel','split','data1','data2','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','util','./utils','Local/_attended@transfer','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','type','getUserByInterface','interface','then','membername','name','internal','request','CreateMemberReport','catch','error','[%s][members][writeDB]','some','startsWith','debug','[%s][members][devicestatechange]'];(function(_0x48e0eb,_0x4fc40b){var _0xd36dc=function(_0x4df508){while(--_0x4df508){_0x48e0eb['push'](_0x48e0eb['shift']());}};_0xd36dc(++_0x4fc40b);}(_0xb09d,0x171));var _0xdb09=function(_0x4a5a15,_0x5a1082){_0x4a5a15=_0x4a5a15-0x0;var _0xf292a2=_0xb09d[_0x4a5a15];return _0xf292a2;};'use strict';var _=require('lodash');var util=require(_0xdb09('0x0'));var utils=require(_0xdb09('0x1'));var members={};var exclude=[_0xdb09('0x2'),_0xdb09('0x3')];function writeDB(_0x24d974){utils[_0xdb09('0x4')](util['format'](_0xdb09('0x5'),_0x24d974[_0xdb09('0x6')],_0x24d974['interface'],_0x24d974['channel'],_0x24d974['data2'],_0x24d974['membername'],_0x24d974[_0xdb09('0x7')]));if(_0x24d974['interface']){utils[_0xdb09('0x8')](_0x24d974[_0xdb09('0x9')])[_0xdb09('0xa')](function(_0x4291ef){if(_0x4291ef){_0x24d974[_0xdb09('0xb')]=_0x4291ef[_0xdb09('0xc')];_0x24d974[_0xdb09('0xd')]=_0x4291ef[_0xdb09('0xd')];utils[_0xdb09('0xe')](_0xdb09('0xf'),_0x24d974);}else{utils['getUserByName'](_0x24d974[_0xdb09('0x9')]['split']('/')[0x1])['then'](function(_0x361aac){if(_0x361aac){_0x24d974[_0xdb09('0xb')]=_0x361aac[_0xdb09('0xc')];_0x24d974[_0xdb09('0xd')]=_0x361aac['internal'];utils[_0xdb09('0xe')](_0xdb09('0xf'),_0x24d974);}});}})[_0xdb09('0x10')](function(_0x5e120a){utils[_0xdb09('0x11')](util['format'](_0xdb09('0x12'),_0x24d974[_0xdb09('0x6')]),_0x5e120a);});}delete members[_0x24d974[_0xdb09('0x9')]];}function startsWith(_0x5c07e1,_0x45d5cb){return _[_0xdb09('0x13')](_0x5c07e1,function(_0x1c7cf2){return _[_0xdb09('0x14')](_0x45d5cb,_0x1c7cf2);});}exports['devicestatechange']=function(_0x1fdc26){try{utils[_0xdb09('0x15')](util['format'](_0xdb09('0x16'),members[_0x1fdc26[_0xdb09('0x17')]]?members[_0x1fdc26[_0xdb09('0x17')]][_0xdb09('0x6')]:_0x1fdc26[_0xdb09('0x17')]),_0x1fdc26);utils[_0xdb09('0x4')](util['format'](_0xdb09('0x18'),members[_0x1fdc26[_0xdb09('0x17')]]?members[_0x1fdc26[_0xdb09('0x17')]][_0xdb09('0x6')]:_0x1fdc26['device'],_0x1fdc26[_0xdb09('0x19')],_0x1fdc26[_0xdb09('0x17')]));switch(_0x1fdc26[_0xdb09('0x19')]){case _0xdb09('0x1a'):case _0xdb09('0x1b'):if(!startsWith(exclude,_0x1fdc26[_0xdb09('0x17')])){members[_0x1fdc26[_0xdb09('0x17')]]={'channel':_0xdb09('0x1c'),'interface':_0x1fdc26['device'],'type':'TALKING','enterAt':utils[_0xdb09('0x1d')](),'role':_0xdb09('0x1e')};}break;case _0xdb09('0x1f'):if(!_[_0xdb09('0x20')](members[_0x1fdc26['device']])){members[_0x1fdc26[_0xdb09('0x17')]][_0xdb09('0x21')]=utils[_0xdb09('0x1d')]();members[_0x1fdc26[_0xdb09('0x17')]][_0xdb09('0x22')]=utils[_0xdb09('0x23')](members[_0x1fdc26[_0xdb09('0x17')]][_0xdb09('0x21')],members[_0x1fdc26[_0xdb09('0x17')]]['enterAt']);if(members[_0x1fdc26['device']][_0xdb09('0x6')]){writeDB(members[_0x1fdc26[_0xdb09('0x17')]]);}}break;default:break;}}catch(_0x289bf4){utils['error'](util[_0xdb09('0x24')]('[%s][members][devicestatechange]',members[_0x1fdc26[_0xdb09('0x17')]]?members[_0x1fdc26[_0xdb09('0x17')]][_0xdb09('0x6')]:_0x1fdc26['device']),_0x289bf4);}};exports['agentcomplete']=function(_0x200b17){try{if(!_[_0xdb09('0x20')](members[_0x200b17[_0xdb09('0x9')]])){utils[_0xdb09('0x15')](util[_0xdb09('0x24')]('[%s][members][agentcomplete]',_0x200b17[_0xdb09('0x6')]),_0x200b17);utils[_0xdb09('0x4')](util[_0xdb09('0x24')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x200b17['uniqueid'],_0x200b17[_0xdb09('0x9')],_0x200b17[_0xdb09('0x25')]));members[_0x200b17[_0xdb09('0x9')]]=_['assign'](members[_0x200b17[_0xdb09('0x9')]],{'data4':_0x200b17[_0xdb09('0x25')],'uniqueid':_0x200b17['uniqueid']});}}catch(_0x480581){utils[_0xdb09('0x11')](util['format'](_0xdb09('0x26'),_0x200b17[_0xdb09('0x6')]),_0x480581);}};exports[_0xdb09('0x27')]=function(_0x2f2547){try{utils['debug'](util[_0xdb09('0x24')](_0xdb09('0x28'),_0x2f2547['uniqueid']),_0x2f2547);if(_0x2f2547[_0xdb09('0x29')]){var _0x1d469d=_0x2f2547[_0xdb09('0x29')][_0xdb09('0x2a')]('-')[0x0];if(!_[_0xdb09('0x20')](members[_0x1d469d])){members[_0x1d469d]=_['assign'](members[_0x1d469d],{'data1':members[_0x1d469d][_0xdb09('0x2b')]||_0x2f2547[_0xdb09('0x7')],'data2':members[_0x1d469d][_0xdb09('0x2c')]||_0x2f2547[_0xdb09('0x2d')],'data3':members[_0x1d469d][_0xdb09('0x2e')]||_0x2f2547[_0xdb09('0x2f')],'uniqueid':members[_0x1d469d][_0xdb09('0x6')]||_0x2f2547[_0xdb09('0x6')]});utils['info'](util[_0xdb09('0x24')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x2f2547[_0xdb09('0x6')],members[_0x1d469d][_0xdb09('0x2b')],members[_0x1d469d]['data2'],members[_0x1d469d]['data3']));if(members[_0x1d469d][_0xdb09('0x21')]){writeDB(members[_0x1d469d]);}}}if(_0x2f2547['destinationchannel']){var _0x4ad146=_0x2f2547['destinationchannel'][_0xdb09('0x2a')]('-')[0x0];if(!_[_0xdb09('0x20')](members[_0x4ad146])){members[_0x4ad146]=_['assign'](members[_0x4ad146],{'data1':members[_0x4ad146][_0xdb09('0x2b')]||_0x2f2547[_0xdb09('0x7')],'data2':members[_0x4ad146][_0xdb09('0x2c')]||_0x2f2547[_0xdb09('0x2d')],'data3':members[_0x4ad146][_0xdb09('0x2e')]||_0x2f2547[_0xdb09('0x2f')],'uniqueid':members[_0x4ad146][_0xdb09('0x6')]||_0x2f2547[_0xdb09('0x6')]});utils['info'](util['format'](_0xdb09('0x30'),_0x2f2547[_0xdb09('0x6')],members[_0x4ad146][_0xdb09('0x2b')],members[_0x4ad146]['data2'],members[_0x4ad146][_0xdb09('0x2e')]));if(members[_0x4ad146][_0xdb09('0x21')]){writeDB(members[_0x4ad146]);}}}}catch(_0x3f5f7){utils[_0xdb09('0x11')](util['format']('[%s][members][cdr]',_0x2f2547[_0xdb09('0x6')]),_0x3f5f7);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 7b903b7..fcbf18e 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 _0x0338=['[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','origtransfererlinkedid','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','format','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','request','CreateVoiceQueueReport','uniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','transfereduniqueid','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerexit','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','accountcode','[%s][queues][agentcomplete]','queuecallercomplete','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','ATTENDED','origtransfererexten','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime'];(function(_0x535654,_0x53147d){var _0x400739=function(_0x236308){while(--_0x236308){_0x535654['push'](_0x535654['shift']());}};_0x400739(++_0x53147d);}(_0x0338,0x14b));var _0x8033=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x0338[_0x39e84d];return _0x1991bc;};'use strict';var _=require(_0x8033('0x0'));var util=require(_0x8033('0x1'));var utils=require(_0x8033('0x2'));var queues={};function writeDB(_0x643649){utils['info'](util[_0x8033('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x643649['uniqueid'],_0x643649[_0x8033('0x4')],_0x643649[_0x8033('0x5')],_0x643649[_0x8033('0x6')],_0x643649[_0x8033('0x7')],_0x643649['accountcode'],_0x643649[_0x8033('0x8')]));if(_0x643649[_0x8033('0x5')]){utils[_0x8033('0x9')](_0x643649[_0x8033('0x5')])[_0x8033('0xa')](function(_0x49c5ba){if(_0x49c5ba){_0x643649['type']=_0x49c5ba['type'];}utils[_0x8033('0xb')](_0x8033('0xc'),_0x643649);});}else{utils['request'](_0x8033('0xc'),_0x643649);}if(_0x643649['transfereduniqueid']){delete queues[_0x643649['transfereduniqueid']];}else{delete queues[_0x643649[_0x8033('0xd')]];}}exports[_0x8033('0xe')]=function(_0xb3f19d){try{utils[_0x8033('0xf')](util[_0x8033('0x3')](_0x8033('0x10'),_0xb3f19d[_0x8033('0xd')]),_0xb3f19d);utils[_0x8033('0x11')](util[_0x8033('0x3')](_0x8033('0x12'),_0xb3f19d['uniqueid'],_0xb3f19d[_0x8033('0x5')],_0xb3f19d[_0x8033('0x13')]));queues[_0xb3f19d['uniqueid']]=_[_0x8033('0x14')](_0xb3f19d,{'originalposition':_0xb3f19d[_0x8033('0x13')],'queuecallerjoinAt':utils[_0x8033('0x15')](),'mohtime':0x0});}catch(_0x271bd8){utils['error'](util[_0x8033('0x3')](_0x8033('0x10'),_0xb3f19d['uniqueid']),_0x271bd8);}};exports[_0x8033('0x16')]=function(_0x337a09){try{if(!_[_0x8033('0x17')](queues[_0x337a09[_0x8033('0xd')]])){utils[_0x8033('0xf')](util[_0x8033('0x3')](_0x8033('0x18'),_0x337a09[_0x8033('0xd')]),_0x337a09);if(queues[_0x337a09[_0x8033('0xd')]][_0x8033('0x19')]){if(!queues[_0x337a09['uniqueid']][_0x8033('0x1a')]&&!queues[_0x337a09[_0x8033('0xd')]]['queuecallerexit']){queues[_0x337a09['uniqueid']]['queuecallercomplete']=!![];queues[_0x337a09[_0x8033('0xd')]][_0x8033('0x1b')]=utils[_0x8033('0x15')]();queues[_0x337a09[_0x8033('0xd')]][_0x8033('0x8')]=_0x8033('0x1c');}utils[_0x8033('0x11')](util[_0x8033('0x3')](_0x8033('0x1d'),_0x337a09[_0x8033('0xd')],queues[_0x337a09[_0x8033('0xd')]][_0x8033('0x1e')],queues[_0x337a09[_0x8033('0xd')]]['queuecallerexitreason']));writeDB(queues[_0x337a09[_0x8033('0xd')]]);}else if(queues[_0x337a09[_0x8033('0xd')]][_0x8033('0x1f')]){utils[_0x8033('0x11')](util[_0x8033('0x3')](_0x8033('0x20'),_0x337a09['uniqueid'],queues[_0x337a09['uniqueid']][_0x8033('0x1e')],queues[_0x337a09[_0x8033('0xd')]]['transfereduniqueid']));queues[queues[_0x337a09['uniqueid']][_0x8033('0x1f')]]=queues[_0x337a09['uniqueid']];queues[queues[_0x337a09[_0x8033('0xd')]][_0x8033('0x1f')]][_0x8033('0x21')]=0x2;delete queues[_0x337a09[_0x8033('0xd')]];}}}catch(_0x42235d){utils[_0x8033('0x22')](util[_0x8033('0x3')](_0x8033('0x18'),_0x337a09[_0x8033('0xd')]),_0x42235d);}};exports['varset']=function(_0x4e11e5){try{utils[_0x8033('0xf')](util[_0x8033('0x3')](_0x8033('0x23'),_0x4e11e5[_0x8033('0xd')]),_0x4e11e5);if(!_[_0x8033('0x17')](_0x4e11e5[_0x8033('0x24')][_0x8033('0x25')])&&_0x4e11e5[_0x8033('0x26')][_0x8033('0x27')]()!==_0x8033('0x28')){if(!_[_0x8033('0x17')](queues[_0x4e11e5['uniqueid']])){queues[_0x4e11e5[_0x8033('0xd')]][_0x8033('0x1a')]=![];queues[_0x4e11e5[_0x8033('0xd')]][_0x8033('0x29')]=null;queues[_0x4e11e5['uniqueid']]['queuecallerexit']=!![];queues[_0x4e11e5['uniqueid']][_0x8033('0x2a')]=utils[_0x8033('0x15')]();queues[_0x4e11e5[_0x8033('0xd')]][_0x8033('0x8')]=_0x4e11e5['value'][_0x8033('0x27')]();utils[_0x8033('0x11')](util[_0x8033('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x4e11e5['uniqueid'],queues[_0x4e11e5['uniqueid']][_0x8033('0x1e')],_0x4e11e5[_0x8033('0x26')],queues[_0x4e11e5[_0x8033('0xd')]]['queuecallerexitreason']));writeDB(queues[_0x4e11e5[_0x8033('0xd')]]);}}else if(!_['isNil'](_0x4e11e5[_0x8033('0x24')][_0x8033('0x2b')])){if(!_[_0x8033('0x17')](queues[_0x4e11e5[_0x8033('0xd')]])&&!queues[_0x4e11e5[_0x8033('0xd')]]['queuecallerabandon']){queues[_0x4e11e5[_0x8033('0xd')]][_0x8033('0x1a')]=![];queues[_0x4e11e5[_0x8033('0xd')]][_0x8033('0x29')]=null;queues[_0x4e11e5[_0x8033('0xd')]]['queuecallerexit']=!![];queues[_0x4e11e5[_0x8033('0xd')]][_0x8033('0x2a')]=utils[_0x8033('0x15')]();queues[_0x4e11e5['uniqueid']][_0x8033('0x8')]=_0x8033('0x2c');utils[_0x8033('0x11')](util[_0x8033('0x3')](_0x8033('0x2d'),_0x4e11e5[_0x8033('0xd')],queues[_0x4e11e5['uniqueid']][_0x8033('0x1e')],_0x4e11e5[_0x8033('0x26')],queues[_0x4e11e5[_0x8033('0xd')]]['queuecallerexitreason']));}}}catch(_0xc00205){utils[_0x8033('0x22')](util[_0x8033('0x3')](_0x8033('0x23'),_0x4e11e5[_0x8033('0xd')]),_0xc00205);}};exports[_0x8033('0x1a')]=function(_0x177771){try{if(!_[_0x8033('0x17')](queues[_0x177771['uniqueid']])){utils['debug'](util[_0x8033('0x3')](_0x8033('0x2e'),_0x177771[_0x8033('0xd')]),_0x177771);queues[_0x177771[_0x8033('0xd')]][_0x8033('0x2f')]=![];queues[_0x177771[_0x8033('0xd')]][_0x8033('0x2a')]=null;queues[_0x177771['uniqueid']]['queuecallerabandon']=!![];queues[_0x177771[_0x8033('0xd')]]['queuecallerabandonAt']=utils[_0x8033('0x15')]();queues[_0x177771['uniqueid']][_0x8033('0x8')]=_0x8033('0x30');utils[_0x8033('0x11')](util[_0x8033('0x3')](_0x8033('0x31'),_0x177771[_0x8033('0xd')],queues[_0x177771['uniqueid']][_0x8033('0x1e')],queues[_0x177771[_0x8033('0xd')]][_0x8033('0x8')]));}}catch(_0x502693){utils[_0x8033('0x22')](util['format'](_0x8033('0x2e'),_0x177771[_0x8033('0xd')]),_0x502693);}};exports['queuecallerleave']=function(_0x358fea){try{if(!_['isNil'](queues[_0x358fea[_0x8033('0xd')]])){utils[_0x8033('0xf')](util[_0x8033('0x3')](_0x8033('0x32'),_0x358fea['uniqueid']),_0x358fea);utils[_0x8033('0x11')](util[_0x8033('0x3')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x358fea[_0x8033('0xd')],queues[_0x358fea[_0x8033('0xd')]]['name'],_0x358fea[_0x8033('0x33')],_0x358fea[_0x8033('0x34')]));queues[_0x358fea[_0x8033('0xd')]][_0x8033('0x35')]=!![];queues[_0x358fea['uniqueid']][_0x8033('0x19')]=utils['now']();queues[_0x358fea[_0x8033('0xd')]][_0x8033('0x36')]=utils[_0x8033('0x37')](queues[_0x358fea[_0x8033('0xd')]][_0x8033('0x19')],queues[_0x358fea[_0x8033('0xd')]][_0x8033('0x38')]);queues[_0x358fea[_0x8033('0xd')]]['position']=_0x358fea[_0x8033('0x13')];queues[_0x358fea['uniqueid']][_0x8033('0x39')]=_0x358fea['count'];queues[_0x358fea['uniqueid']][_0x8033('0x33')]=_0x358fea[_0x8033('0x33')];queues[_0x358fea[_0x8033('0xd')]][_0x8033('0x34')]=_0x358fea[_0x8033('0x34')];}}catch(_0x31e588){utils[_0x8033('0x22')](util[_0x8033('0x3')](_0x8033('0x32'),_0x358fea[_0x8033('0xd')]),_0x31e588);}};exports['agentconnect']=function(_0x34b991){try{if(!_['isNil'](queues[_0x34b991[_0x8033('0xd')]])){utils[_0x8033('0xf')](util[_0x8033('0x3')](_0x8033('0x3a'),_0x34b991[_0x8033('0xd')]),_0x34b991);utils[_0x8033('0x11')](util[_0x8033('0x3')](_0x8033('0x3b'),_0x34b991['uniqueid'],queues[_0x34b991[_0x8033('0xd')]][_0x8033('0x1e')],_0x34b991[_0x8033('0x3c')],_0x34b991[_0x8033('0x3d')]));queues[_0x34b991[_0x8033('0xd')]]['queuecallerabandon']=![];queues[_0x34b991[_0x8033('0xd')]]['queuecallerabandon']=![];queues[_0x34b991[_0x8033('0xd')]]['queuecallerabandonAt']=null;queues[_0x34b991['uniqueid']]['queuecallerexit']=![];queues[_0x34b991[_0x8033('0xd')]][_0x8033('0x8')]=null;queues[_0x34b991[_0x8033('0xd')]][_0x8033('0x2a')]=null;queues[_0x34b991[_0x8033('0xd')]][_0x8033('0x3e')]=!![];queues[_0x34b991['uniqueid']][_0x8033('0x3f')]=_0x34b991[_0x8033('0x3d')];queues[_0x34b991['uniqueid']][_0x8033('0x6')]=_0x34b991[_0x8033('0x3c')];}}catch(_0x27425c){utils[_0x8033('0x22')](util[_0x8033('0x3')](_0x8033('0x3a'),_0x34b991[_0x8033('0xd')]),_0x27425c);}};exports['agentcomplete']=function(_0xbfe7bb){try{if(!_[_0x8033('0x17')](queues[_0xbfe7bb[_0x8033('0xd')]])){if(queues[_0xbfe7bb[_0x8033('0xd')]][_0x8033('0x19')]){utils[_0x8033('0xf')](util[_0x8033('0x3')](_0x8033('0x40'),_0xbfe7bb[_0x8033('0xd')]),_0xbfe7bb);queues[_0xbfe7bb[_0x8033('0xd')]][_0x8033('0x1a')]=![];queues[_0xbfe7bb[_0x8033('0xd')]][_0x8033('0x1a')]=![];queues[_0xbfe7bb[_0x8033('0xd')]][_0x8033('0x29')]=null;queues[_0xbfe7bb['uniqueid']][_0x8033('0x2f')]=![];queues[_0xbfe7bb[_0x8033('0xd')]]['queuecallerexitAt']=null;queues[_0xbfe7bb[_0x8033('0xd')]][_0x8033('0x3e')]=!![];queues[_0xbfe7bb[_0x8033('0xd')]][_0x8033('0x6')]=_0xbfe7bb[_0x8033('0x3c')];queues[_0xbfe7bb[_0x8033('0xd')]][_0x8033('0x41')]=!![];queues[_0xbfe7bb[_0x8033('0xd')]][_0x8033('0x1b')]=utils[_0x8033('0x15')]();if(_0xbfe7bb[_0x8033('0x42')]==_0x8033('0x43')){if(!queues[_0xbfe7bb['uniqueid']][_0x8033('0x43')]){queues[_0xbfe7bb[_0x8033('0xd')]]['queuecallerexitreason']='TRANSFER';}}else{queues[_0xbfe7bb['uniqueid']][_0x8033('0x8')]=_0x8033('0x44')+_0xbfe7bb[_0x8033('0x42')][_0x8033('0x27')]();}utils[_0x8033('0x11')](util[_0x8033('0x3')](_0x8033('0x45'),_0xbfe7bb[_0x8033('0xd')],queues[_0xbfe7bb[_0x8033('0xd')]][_0x8033('0x1e')],_0xbfe7bb[_0x8033('0x3c')],queues[_0xbfe7bb[_0x8033('0xd')]][_0x8033('0x8')]));writeDB(queues[_0xbfe7bb[_0x8033('0xd')]]);}}}catch(_0x302b8a){utils[_0x8033('0x22')](util['format'](_0x8033('0x40'),_0xbfe7bb[_0x8033('0xd')]),_0x302b8a);}};exports[_0x8033('0x46')]=function(_0x17284b){try{if(!_['isNil'](queues[_0x17284b[_0x8033('0x47')]])){utils[_0x8033('0xf')](util['format']('[%s][queues][blindtransfer]',_0x17284b[_0x8033('0xd')]),_0x17284b);queues[_0x17284b[_0x8033('0x47')]][_0x8033('0x43')]=!![];queues[_0x17284b['transfereeuniqueid']][_0x8033('0x48')]='BLIND';queues[_0x17284b['transfereeuniqueid']][_0x8033('0x49')]=_0x17284b[_0x8033('0x4a')];queues[_0x17284b[_0x8033('0x47')]][_0x8033('0x4b')]=_0x17284b[_0x8033('0x47')];queues[_0x17284b[_0x8033('0x47')]]['queuecallerexitreason']=_0x8033('0x4c');utils[_0x8033('0x11')](util[_0x8033('0x3')](_0x8033('0x4d'),_0x17284b[_0x8033('0xd')],queues[_0x17284b['transfereeuniqueid']][_0x8033('0x1e')],_0x17284b['transfereeuniqueid'],_0x17284b[_0x8033('0x4a')]));}}catch(_0x51604d){utils[_0x8033('0x22')](util[_0x8033('0x3')](_0x8033('0x4e'),_0x17284b[_0x8033('0xd')]),_0x51604d);}};exports['attendedtransfer']=function(_0x39767d){try{utils['debug'](util[_0x8033('0x3')](_0x8033('0x4f'),_0x39767d[_0x8033('0x50')]),_0x39767d);if(_0x39767d[_0x8033('0x50')]==_0x39767d['origtransfererlinkedid']){if(!_['isNil'](queues[_0x39767d[_0x8033('0x51')]])){utils[_0x8033('0x11')](util[_0x8033('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x39767d[_0x8033('0x50')],queues[_0x39767d['secondtransfererlinkedid']][_0x8033('0x1e')],_0x39767d['origtransfererexten']));queues[_0x39767d[_0x8033('0x51')]][_0x8033('0x43')]=!![];queues[_0x39767d['secondtransfererlinkedid']][_0x8033('0x48')]=_0x8033('0x52');queues[_0x39767d[_0x8033('0x51')]][_0x8033('0x49')]=_0x39767d[_0x8033('0x53')];queues[_0x39767d['secondtransfererlinkedid']][_0x8033('0x4b')]=_0x39767d[_0x8033('0x50')];queues[_0x39767d['secondtransfererlinkedid']][_0x8033('0x8')]='ATTENDEDTRANSFER';}if(!_[_0x8033('0x17')](queues[_0x39767d['origtransfererlinkedid']])){if(_0x39767d['transfereelinkedid']&&queues[_0x39767d[_0x8033('0x54')]]){queues[_0x39767d[_0x8033('0x54')]][_0x8033('0x21')]=0x1;queues[_0x39767d[_0x8033('0x47')]]=_[_0x8033('0x55')](queues[_0x39767d[_0x8033('0x54')]]);queues[_0x39767d['transfereeuniqueid']][_0x8033('0x1f')]=_0x39767d[_0x8033('0x56')];queues[_0x39767d[_0x8033('0x47')]][_0x8033('0x21')]=0x2;queues[_0x39767d[_0x8033('0x47')]]['calleridnum']=queues[_0x39767d[_0x8033('0x51')]]['calleridnum'];queues[_0x39767d[_0x8033('0x47')]][_0x8033('0x57')]=queues[_0x39767d[_0x8033('0x51')]][_0x8033('0x57')];queues[_0x39767d['transfereeuniqueid']][_0x8033('0x38')]=utils[_0x8033('0x15')]();queues[_0x39767d[_0x8033('0x47')]][_0x8033('0x19')]=utils[_0x8033('0x15')]();queues[_0x39767d[_0x8033('0x47')]]['holdtime']=0x0;queues[_0x39767d[_0x8033('0x47')]][_0x8033('0x58')]=0x0;utils[_0x8033('0x11')](util['format'](_0x8033('0x59'),_0x39767d[_0x8033('0x50')],queues[_0x39767d[_0x8033('0x47')]][_0x8033('0x1e')],queues[_0x39767d[_0x8033('0x47')]][_0x8033('0x7')],queues[_0x39767d[_0x8033('0x47')]][_0x8033('0x57')]));}else{utils[_0x8033('0x11')](util[_0x8033('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x39767d[_0x8033('0x50')],queues[_0x39767d[_0x8033('0x5a')]][_0x8033('0x1e')],_0x39767d['secondtransfererlinkedid']));queues[_0x39767d[_0x8033('0x5a')]][_0x8033('0x1f')]=_0x39767d[_0x8033('0x51')];}}}else if(_0x39767d[_0x8033('0x5b')]==_0x39767d[_0x8033('0x51')]){if(!_[_0x8033('0x17')](queues[_0x39767d['origtransfererlinkedid']])){utils[_0x8033('0x11')](util[_0x8033('0x3')](_0x8033('0x5c'),_0x39767d['origtransfereruniqueid'],queues[_0x39767d[_0x8033('0x5a')]][_0x8033('0x1e')],_0x39767d[_0x8033('0x5b')],_0x39767d[_0x8033('0x5d')]));queues[_0x39767d[_0x8033('0x5a')]][_0x8033('0x43')]=!![];queues[_0x39767d[_0x8033('0x5a')]][_0x8033('0x48')]='ATTENDED';queues[_0x39767d[_0x8033('0x5a')]][_0x8033('0x49')]=_0x39767d[_0x8033('0x5d')];queues[_0x39767d['origtransfererlinkedid']]['transferuniqueid']=_0x39767d[_0x8033('0x5b')];queues[_0x39767d[_0x8033('0x5a')]][_0x8033('0x8')]=_0x8033('0x5e');}if(!_['isNil'](queues[_0x39767d['secondtransfererlinkedid']])){if(_0x39767d[_0x8033('0x5f')]&&queues[_0x39767d[_0x8033('0x5f')]]){queues[_0x39767d[_0x8033('0x5f')]][_0x8033('0x21')]=0x1;queues[_0x39767d[_0x8033('0x56')]]=_[_0x8033('0x55')](queues[_0x39767d[_0x8033('0x5f')]]);queues[_0x39767d[_0x8033('0x56')]]['transfereduniqueid']=_0x39767d[_0x8033('0x56')];queues[_0x39767d[_0x8033('0x56')]]['queuecallerenterreason']=0x2;queues[_0x39767d['transfertargetuniqueid']][_0x8033('0x7')]=queues[_0x39767d[_0x8033('0x5a')]][_0x8033('0x7')];queues[_0x39767d['transfertargetuniqueid']][_0x8033('0x57')]=queues[_0x39767d[_0x8033('0x5a')]][_0x8033('0x57')];queues[_0x39767d['transfertargetuniqueid']][_0x8033('0x38')]=utils['now']();queues[_0x39767d[_0x8033('0x56')]]['queuecallerleaveAt']=utils['now']();queues[_0x39767d[_0x8033('0x56')]]['holdtime']=0x0;queues[_0x39767d['transfertargetuniqueid']][_0x8033('0x58')]=0x0;utils[_0x8033('0x11')](util[_0x8033('0x3')](_0x8033('0x60'),_0x39767d[_0x8033('0x50')],queues[_0x39767d[_0x8033('0x56')]]['name'],queues[_0x39767d[_0x8033('0x56')]][_0x8033('0x1f')],queues[_0x39767d[_0x8033('0x56')]][_0x8033('0x7')],queues[_0x39767d['transfertargetuniqueid']][_0x8033('0x57')]));}else{utils[_0x8033('0x11')](util['format'](_0x8033('0x61'),_0x39767d[_0x8033('0x50')],queues[_0x39767d[_0x8033('0x51')]][_0x8033('0x1e')],_0x39767d[_0x8033('0x5a')]));queues[_0x39767d[_0x8033('0x51')]]['transfereduniqueid']=_0x39767d[_0x8033('0x5a')];}}}}catch(_0x18a090){utils[_0x8033('0x22')](util[_0x8033('0x3')](_0x8033('0x4f'),_0x39767d[_0x8033('0x50')]),_0x18a090);}};exports[_0x8033('0x62')]=function(_0xde7f0e){try{if(!_['isNil'](queues[_0xde7f0e[_0x8033('0xd')]])){utils[_0x8033('0xf')](util[_0x8033('0x3')](_0x8033('0x63'),_0xde7f0e[_0x8033('0xd')]),_0xde7f0e);queues[_0xde7f0e['uniqueid']][_0x8033('0x64')]=utils[_0x8033('0x15')]();utils[_0x8033('0x11')](util['format'](_0x8033('0x65'),_0xde7f0e[_0x8033('0xd')],queues[_0xde7f0e[_0x8033('0xd')]][_0x8033('0x1e')],queues[_0xde7f0e['uniqueid']][_0x8033('0x64')]));}}catch(_0x32e2ab){utils['error'](util['format']('[%s][queues][musiconholdstart]',_0xde7f0e[_0x8033('0xd')]),_0x32e2ab);}};exports[_0x8033('0x66')]=function(_0x4c385d){try{if(!_[_0x8033('0x17')](queues[_0x4c385d[_0x8033('0xd')]])){if(!_['isNil'](queues[_0x4c385d[_0x8033('0xd')]]['musiconholdstartAt'])){utils[_0x8033('0xf')](util[_0x8033('0x3')](_0x8033('0x67'),_0x4c385d[_0x8033('0xd')]),_0x4c385d);queues[_0x4c385d[_0x8033('0xd')]][_0x8033('0x58')]+=utils[_0x8033('0x37')](utils[_0x8033('0x15')](),queues[_0x4c385d[_0x8033('0xd')]][_0x8033('0x64')]);utils[_0x8033('0x11')](util[_0x8033('0x3')](_0x8033('0x68'),_0x4c385d[_0x8033('0xd')],queues[_0x4c385d[_0x8033('0xd')]][_0x8033('0x1e')],queues[_0x4c385d[_0x8033('0xd')]][_0x8033('0x58')]));delete queues[_0x4c385d['uniqueid']][_0x8033('0x64')];}}}catch(_0x4dc1d2){utils[_0x8033('0x22')](util['format']('[%s][queues][musiconholdstop]',_0x4c385d[_0x8033('0xd')]),_0x4dc1d2);}}; \ No newline at end of file +var _0x8c42=['name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','debug','[%s][queues][varset]','variable','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerexitAt','queueposition','queuecallerabandonAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','holdtime','diffTime','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','membername','assigned','accountcode','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','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','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','channel','queue','lastAssignedTo','calleridnum','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s'];(function(_0x5e4368,_0x18566d){var _0x16e816=function(_0x2df9ed){while(--_0x2df9ed){_0x5e4368['push'](_0x5e4368['shift']());}};_0x16e816(++_0x18566d);}(_0x8c42,0x190));var _0x28c4=function(_0x152136,_0x4f14f1){_0x152136=_0x152136-0x0;var _0x20df44=_0x8c42[_0x152136];return _0x20df44;};'use strict';var _=require(_0x28c4('0x0'));var util=require(_0x28c4('0x1'));var utils=require(_0x28c4('0x2'));var queues={};function writeDB(_0xebdad){utils[_0x28c4('0x3')](util[_0x28c4('0x4')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0xebdad['uniqueid'],_0xebdad[_0x28c4('0x5')],_0xebdad[_0x28c4('0x6')],_0xebdad[_0x28c4('0x7')],_0xebdad[_0x28c4('0x8')],_0xebdad['accountcode'],_0xebdad['queuecallerexitreason']));if(_0xebdad[_0x28c4('0x6')]){utils[_0x28c4('0x9')](_0xebdad[_0x28c4('0x6')])[_0x28c4('0xa')](function(_0x5456e7){if(_0x5456e7){_0xebdad[_0x28c4('0xb')]=_0x5456e7[_0x28c4('0xb')];}utils[_0x28c4('0xc')](_0x28c4('0xd'),_0xebdad);});}else{utils[_0x28c4('0xc')](_0x28c4('0xd'),_0xebdad);}if(_0xebdad[_0x28c4('0xe')]){delete queues[_0xebdad[_0x28c4('0xe')]];}else{delete queues[_0xebdad[_0x28c4('0xf')]];}}exports[_0x28c4('0x10')]=function(_0x30da13){try{utils['debug'](util[_0x28c4('0x4')](_0x28c4('0x11'),_0x30da13['uniqueid']),_0x30da13);utils[_0x28c4('0x3')](util[_0x28c4('0x4')](_0x28c4('0x12'),_0x30da13[_0x28c4('0xf')],_0x30da13[_0x28c4('0x6')],_0x30da13[_0x28c4('0x13')]));queues[_0x30da13[_0x28c4('0xf')]]=_[_0x28c4('0x14')](_0x30da13,{'originalposition':_0x30da13['position'],'queuecallerjoinAt':utils[_0x28c4('0x15')](),'mohtime':0x0});}catch(_0x427f2c){utils[_0x28c4('0x16')](util['format']('[%s][queues][queuecallerjoin]',_0x30da13[_0x28c4('0xf')]),_0x427f2c);}};exports[_0x28c4('0x17')]=function(_0x43d1ca){try{if(!_[_0x28c4('0x18')](queues[_0x43d1ca[_0x28c4('0xf')]])){utils['debug'](util[_0x28c4('0x4')](_0x28c4('0x19'),_0x43d1ca[_0x28c4('0xf')]),_0x43d1ca);if(queues[_0x43d1ca[_0x28c4('0xf')]][_0x28c4('0x1a')]){if(!queues[_0x43d1ca[_0x28c4('0xf')]]['queuecallerabandon']&&!queues[_0x43d1ca['uniqueid']][_0x28c4('0x1b')]){queues[_0x43d1ca[_0x28c4('0xf')]][_0x28c4('0x1c')]=!![];queues[_0x43d1ca[_0x28c4('0xf')]][_0x28c4('0x1d')]=utils[_0x28c4('0x15')]();queues[_0x43d1ca[_0x28c4('0xf')]][_0x28c4('0x1e')]='COMPLETEDBYAGENT';}utils[_0x28c4('0x3')](util[_0x28c4('0x4')](_0x28c4('0x1f'),_0x43d1ca[_0x28c4('0xf')],queues[_0x43d1ca['uniqueid']][_0x28c4('0x20')],queues[_0x43d1ca['uniqueid']][_0x28c4('0x1e')]));writeDB(queues[_0x43d1ca[_0x28c4('0xf')]]);}else if(queues[_0x43d1ca[_0x28c4('0xf')]]['transfereduniqueid']){utils['info'](util[_0x28c4('0x4')](_0x28c4('0x21'),_0x43d1ca[_0x28c4('0xf')],queues[_0x43d1ca['uniqueid']]['name'],queues[_0x43d1ca[_0x28c4('0xf')]]['transfereduniqueid']));queues[queues[_0x43d1ca[_0x28c4('0xf')]][_0x28c4('0xe')]]=queues[_0x43d1ca['uniqueid']];queues[queues[_0x43d1ca[_0x28c4('0xf')]][_0x28c4('0xe')]][_0x28c4('0x22')]=0x2;delete queues[_0x43d1ca[_0x28c4('0xf')]];}}}catch(_0x54f089){utils[_0x28c4('0x16')](util[_0x28c4('0x4')](_0x28c4('0x19'),_0x43d1ca[_0x28c4('0xf')]),_0x54f089);}};exports[_0x28c4('0x23')]=function(_0x183b56){try{utils[_0x28c4('0x24')](util['format'](_0x28c4('0x25'),_0x183b56['uniqueid']),_0x183b56);if(!_['isNil'](_0x183b56[_0x28c4('0x26')]['queuestatus'])&&_0x183b56[_0x28c4('0x27')][_0x28c4('0x28')]()!==_0x28c4('0x29')){if(!_[_0x28c4('0x18')](queues[_0x183b56[_0x28c4('0xf')]])){queues[_0x183b56[_0x28c4('0xf')]][_0x28c4('0x2a')]=![];queues[_0x183b56[_0x28c4('0xf')]]['queuecallerabandonAt']=null;queues[_0x183b56[_0x28c4('0xf')]][_0x28c4('0x1b')]=!![];queues[_0x183b56[_0x28c4('0xf')]][_0x28c4('0x2b')]=utils['now']();queues[_0x183b56[_0x28c4('0xf')]][_0x28c4('0x1e')]=_0x183b56[_0x28c4('0x27')][_0x28c4('0x28')]();utils[_0x28c4('0x3')](util[_0x28c4('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x183b56[_0x28c4('0xf')],queues[_0x183b56['uniqueid']][_0x28c4('0x20')],_0x183b56[_0x28c4('0x27')],queues[_0x183b56[_0x28c4('0xf')]][_0x28c4('0x1e')]));writeDB(queues[_0x183b56[_0x28c4('0xf')]]);}}else if(!_[_0x28c4('0x18')](_0x183b56[_0x28c4('0x26')][_0x28c4('0x2c')])){if(!_['isNil'](queues[_0x183b56[_0x28c4('0xf')]])&&!queues[_0x183b56[_0x28c4('0xf')]]['queuecallerabandon']){queues[_0x183b56[_0x28c4('0xf')]][_0x28c4('0x2a')]=![];queues[_0x183b56[_0x28c4('0xf')]][_0x28c4('0x2d')]=null;queues[_0x183b56[_0x28c4('0xf')]][_0x28c4('0x1b')]=!![];queues[_0x183b56[_0x28c4('0xf')]][_0x28c4('0x2b')]=utils['now']();queues[_0x183b56[_0x28c4('0xf')]][_0x28c4('0x1e')]=_0x28c4('0x2e');utils[_0x28c4('0x3')](util[_0x28c4('0x4')](_0x28c4('0x2f'),_0x183b56[_0x28c4('0xf')],queues[_0x183b56[_0x28c4('0xf')]][_0x28c4('0x20')],_0x183b56['value'],queues[_0x183b56['uniqueid']]['queuecallerexitreason']));}}}catch(_0x596f36){utils[_0x28c4('0x16')](util[_0x28c4('0x4')](_0x28c4('0x25'),_0x183b56['uniqueid']),_0x596f36);}};exports[_0x28c4('0x2a')]=function(_0x3376da){try{if(!_[_0x28c4('0x18')](queues[_0x3376da[_0x28c4('0xf')]])){utils[_0x28c4('0x24')](util[_0x28c4('0x4')](_0x28c4('0x30'),_0x3376da['uniqueid']),_0x3376da);queues[_0x3376da['uniqueid']][_0x28c4('0x1b')]=![];queues[_0x3376da[_0x28c4('0xf')]][_0x28c4('0x2b')]=null;queues[_0x3376da[_0x28c4('0xf')]]['queuecallerabandon']=!![];queues[_0x3376da[_0x28c4('0xf')]][_0x28c4('0x2d')]=utils[_0x28c4('0x15')]();queues[_0x3376da['uniqueid']][_0x28c4('0x1e')]='ABANDONED';utils[_0x28c4('0x3')](util[_0x28c4('0x4')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x3376da[_0x28c4('0xf')],queues[_0x3376da['uniqueid']][_0x28c4('0x20')],queues[_0x3376da[_0x28c4('0xf')]][_0x28c4('0x1e')]));}}catch(_0x4e6128){utils['error'](util[_0x28c4('0x4')](_0x28c4('0x30'),_0x3376da[_0x28c4('0xf')]),_0x4e6128);}};exports[_0x28c4('0x31')]=function(_0x1e57a7){try{if(!_['isNil'](queues[_0x1e57a7['uniqueid']])){utils[_0x28c4('0x24')](util[_0x28c4('0x4')](_0x28c4('0x32'),_0x1e57a7[_0x28c4('0xf')]),_0x1e57a7);utils[_0x28c4('0x3')](util[_0x28c4('0x4')](_0x28c4('0x33'),_0x1e57a7[_0x28c4('0xf')],queues[_0x1e57a7[_0x28c4('0xf')]][_0x28c4('0x20')],_0x1e57a7[_0x28c4('0x34')],_0x1e57a7['connectedlinename']));queues[_0x1e57a7[_0x28c4('0xf')]]['queuecallerleave']=!![];queues[_0x1e57a7[_0x28c4('0xf')]][_0x28c4('0x1a')]=utils[_0x28c4('0x15')]();queues[_0x1e57a7[_0x28c4('0xf')]][_0x28c4('0x35')]=utils[_0x28c4('0x36')](queues[_0x1e57a7[_0x28c4('0xf')]][_0x28c4('0x1a')],queues[_0x1e57a7[_0x28c4('0xf')]][_0x28c4('0x37')]);queues[_0x1e57a7[_0x28c4('0xf')]][_0x28c4('0x13')]=_0x1e57a7[_0x28c4('0x13')];queues[_0x1e57a7[_0x28c4('0xf')]][_0x28c4('0x38')]=_0x1e57a7[_0x28c4('0x38')];queues[_0x1e57a7[_0x28c4('0xf')]][_0x28c4('0x34')]=_0x1e57a7[_0x28c4('0x34')];queues[_0x1e57a7['uniqueid']]['connectedlinename']=_0x1e57a7[_0x28c4('0x39')];}}catch(_0x22fe81){utils[_0x28c4('0x16')](util[_0x28c4('0x4')](_0x28c4('0x32'),_0x1e57a7[_0x28c4('0xf')]),_0x22fe81);}};exports[_0x28c4('0x3a')]=function(_0x3791f6){try{if(!_[_0x28c4('0x18')](queues[_0x3791f6[_0x28c4('0xf')]])){utils[_0x28c4('0x24')](util[_0x28c4('0x4')](_0x28c4('0x3b'),_0x3791f6['uniqueid']),_0x3791f6);utils[_0x28c4('0x3')](util[_0x28c4('0x4')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x3791f6[_0x28c4('0xf')],queues[_0x3791f6[_0x28c4('0xf')]]['name'],_0x3791f6[_0x28c4('0x3c')],_0x3791f6['destaccountcode']));queues[_0x3791f6[_0x28c4('0xf')]][_0x28c4('0x2a')]=![];queues[_0x3791f6[_0x28c4('0xf')]][_0x28c4('0x2a')]=![];queues[_0x3791f6[_0x28c4('0xf')]][_0x28c4('0x2d')]=null;queues[_0x3791f6[_0x28c4('0xf')]][_0x28c4('0x1b')]=![];queues[_0x3791f6['uniqueid']][_0x28c4('0x1e')]=null;queues[_0x3791f6[_0x28c4('0xf')]][_0x28c4('0x2b')]=null;queues[_0x3791f6['uniqueid']][_0x28c4('0x3d')]=!![];queues[_0x3791f6['uniqueid']][_0x28c4('0x3e')]=_0x3791f6[_0x28c4('0x3f')];queues[_0x3791f6[_0x28c4('0xf')]]['lastAssignedTo']=_0x3791f6[_0x28c4('0x3c')];}}catch(_0x491650){utils[_0x28c4('0x16')](util[_0x28c4('0x4')](_0x28c4('0x3b'),_0x3791f6[_0x28c4('0xf')]),_0x491650);}};exports[_0x28c4('0x40')]=function(_0x2728b6){try{if(!_[_0x28c4('0x18')](queues[_0x2728b6['uniqueid']])){if(queues[_0x2728b6[_0x28c4('0xf')]][_0x28c4('0x1a')]){utils[_0x28c4('0x24')](util['format'](_0x28c4('0x41'),_0x2728b6[_0x28c4('0xf')]),_0x2728b6);queues[_0x2728b6[_0x28c4('0xf')]][_0x28c4('0x2a')]=![];queues[_0x2728b6[_0x28c4('0xf')]][_0x28c4('0x2a')]=![];queues[_0x2728b6[_0x28c4('0xf')]]['queuecallerabandonAt']=null;queues[_0x2728b6['uniqueid']][_0x28c4('0x1b')]=![];queues[_0x2728b6[_0x28c4('0xf')]][_0x28c4('0x2b')]=null;queues[_0x2728b6['uniqueid']][_0x28c4('0x3d')]=!![];queues[_0x2728b6[_0x28c4('0xf')]][_0x28c4('0x7')]=_0x2728b6[_0x28c4('0x3c')];queues[_0x2728b6[_0x28c4('0xf')]]['queuecallercomplete']=!![];queues[_0x2728b6[_0x28c4('0xf')]][_0x28c4('0x1d')]=utils[_0x28c4('0x15')]();if(_0x2728b6[_0x28c4('0x42')]=='transfer'){if(!queues[_0x2728b6[_0x28c4('0xf')]][_0x28c4('0x43')]){queues[_0x2728b6['uniqueid']][_0x28c4('0x1e')]=_0x28c4('0x44');}}else{queues[_0x2728b6[_0x28c4('0xf')]][_0x28c4('0x1e')]='COMPLETEDBY'+_0x2728b6[_0x28c4('0x42')][_0x28c4('0x28')]();}utils[_0x28c4('0x3')](util[_0x28c4('0x4')](_0x28c4('0x45'),_0x2728b6['uniqueid'],queues[_0x2728b6['uniqueid']]['name'],_0x2728b6['membername'],queues[_0x2728b6[_0x28c4('0xf')]][_0x28c4('0x1e')]));writeDB(queues[_0x2728b6[_0x28c4('0xf')]]);}}}catch(_0x517161){utils['error'](util[_0x28c4('0x4')](_0x28c4('0x41'),_0x2728b6[_0x28c4('0xf')]),_0x517161);}};exports[_0x28c4('0x46')]=function(_0x19df07){try{if(!_[_0x28c4('0x18')](queues[_0x19df07[_0x28c4('0x47')]])){utils[_0x28c4('0x24')](util['format'](_0x28c4('0x48'),_0x19df07[_0x28c4('0xf')]),_0x19df07);queues[_0x19df07[_0x28c4('0x47')]][_0x28c4('0x43')]=!![];queues[_0x19df07[_0x28c4('0x47')]][_0x28c4('0x49')]=_0x28c4('0x4a');queues[_0x19df07['transfereeuniqueid']][_0x28c4('0x4b')]=_0x19df07[_0x28c4('0x4c')];queues[_0x19df07['transfereeuniqueid']][_0x28c4('0x4d')]=_0x19df07[_0x28c4('0x47')];queues[_0x19df07[_0x28c4('0x47')]][_0x28c4('0x1e')]=_0x28c4('0x4e');utils[_0x28c4('0x3')](util[_0x28c4('0x4')](_0x28c4('0x4f'),_0x19df07[_0x28c4('0xf')],queues[_0x19df07['transfereeuniqueid']][_0x28c4('0x20')],_0x19df07[_0x28c4('0x47')],_0x19df07['extension']));}}catch(_0x5468d2){utils['error'](util['format'](_0x28c4('0x48'),_0x19df07[_0x28c4('0xf')]),_0x5468d2);}};exports[_0x28c4('0x50')]=function(_0x1374fc){try{utils[_0x28c4('0x24')](util[_0x28c4('0x4')](_0x28c4('0x51'),_0x1374fc[_0x28c4('0x52')]),_0x1374fc);if(_0x1374fc[_0x28c4('0x52')]==_0x1374fc[_0x28c4('0x53')]){if(!_[_0x28c4('0x18')](queues[_0x1374fc['secondtransfererlinkedid']])){utils[_0x28c4('0x3')](util[_0x28c4('0x4')](_0x28c4('0x54'),_0x1374fc[_0x28c4('0x52')],queues[_0x1374fc[_0x28c4('0x55')]][_0x28c4('0x20')],_0x1374fc[_0x28c4('0x56')]));queues[_0x1374fc['secondtransfererlinkedid']][_0x28c4('0x43')]=!![];queues[_0x1374fc[_0x28c4('0x55')]][_0x28c4('0x49')]=_0x28c4('0x57');queues[_0x1374fc[_0x28c4('0x55')]][_0x28c4('0x4b')]=_0x1374fc[_0x28c4('0x56')];queues[_0x1374fc[_0x28c4('0x55')]][_0x28c4('0x4d')]=_0x1374fc[_0x28c4('0x52')];queues[_0x1374fc[_0x28c4('0x55')]][_0x28c4('0x1e')]=_0x28c4('0x58');}if(!_[_0x28c4('0x18')](queues[_0x1374fc['origtransfererlinkedid']])){if(_0x1374fc[_0x28c4('0x59')]&&queues[_0x1374fc[_0x28c4('0x59')]]){queues[_0x1374fc[_0x28c4('0x59')]][_0x28c4('0x22')]=0x1;queues[_0x1374fc[_0x28c4('0x47')]]=_[_0x28c4('0x5a')](queues[_0x1374fc[_0x28c4('0x59')]]);queues[_0x1374fc['transfereeuniqueid']][_0x28c4('0xe')]=_0x1374fc[_0x28c4('0x5b')];queues[_0x1374fc['transfereeuniqueid']][_0x28c4('0x22')]=0x2;queues[_0x1374fc['transfereeuniqueid']]['calleridnum']=queues[_0x1374fc['secondtransfererlinkedid']][_0x28c4('0x8')];queues[_0x1374fc[_0x28c4('0x47')]][_0x28c4('0x5c')]=queues[_0x1374fc['secondtransfererlinkedid']][_0x28c4('0x5c')];queues[_0x1374fc[_0x28c4('0x47')]][_0x28c4('0x37')]=utils['now']();queues[_0x1374fc['transfereeuniqueid']][_0x28c4('0x1a')]=utils['now']();queues[_0x1374fc[_0x28c4('0x47')]]['holdtime']=0x0;queues[_0x1374fc[_0x28c4('0x47')]][_0x28c4('0x5d')]=0x0;utils[_0x28c4('0x3')](util[_0x28c4('0x4')](_0x28c4('0x5e'),_0x1374fc[_0x28c4('0x52')],queues[_0x1374fc[_0x28c4('0x47')]]['name'],queues[_0x1374fc['transfereeuniqueid']][_0x28c4('0x8')],queues[_0x1374fc[_0x28c4('0x47')]][_0x28c4('0x5c')]));}else{utils[_0x28c4('0x3')](util['format'](_0x28c4('0x5f'),_0x1374fc[_0x28c4('0x52')],queues[_0x1374fc[_0x28c4('0x53')]][_0x28c4('0x20')],_0x1374fc[_0x28c4('0x55')]));queues[_0x1374fc[_0x28c4('0x53')]][_0x28c4('0xe')]=_0x1374fc['secondtransfererlinkedid'];}}}else if(_0x1374fc[_0x28c4('0x60')]==_0x1374fc[_0x28c4('0x55')]){if(!_[_0x28c4('0x18')](queues[_0x1374fc[_0x28c4('0x53')]])){utils[_0x28c4('0x3')](util[_0x28c4('0x4')](_0x28c4('0x61'),_0x1374fc[_0x28c4('0x52')],queues[_0x1374fc['origtransfererlinkedid']][_0x28c4('0x20')],_0x1374fc['secondtransfereruniqueid'],_0x1374fc['secondtransfererexten']));queues[_0x1374fc[_0x28c4('0x53')]][_0x28c4('0x43')]=!![];queues[_0x1374fc[_0x28c4('0x53')]][_0x28c4('0x49')]=_0x28c4('0x57');queues[_0x1374fc[_0x28c4('0x53')]][_0x28c4('0x4b')]=_0x1374fc[_0x28c4('0x62')];queues[_0x1374fc[_0x28c4('0x53')]][_0x28c4('0x4d')]=_0x1374fc['secondtransfereruniqueid'];queues[_0x1374fc[_0x28c4('0x53')]]['queuecallerexitreason']=_0x28c4('0x58');}if(!_['isNil'](queues[_0x1374fc[_0x28c4('0x55')]])){if(_0x1374fc['transfertargetlinkedid']&&queues[_0x1374fc[_0x28c4('0x63')]]){queues[_0x1374fc['transfertargetlinkedid']][_0x28c4('0x22')]=0x1;queues[_0x1374fc[_0x28c4('0x5b')]]=_[_0x28c4('0x5a')](queues[_0x1374fc[_0x28c4('0x63')]]);queues[_0x1374fc[_0x28c4('0x5b')]][_0x28c4('0xe')]=_0x1374fc[_0x28c4('0x5b')];queues[_0x1374fc[_0x28c4('0x5b')]][_0x28c4('0x22')]=0x2;queues[_0x1374fc['transfertargetuniqueid']][_0x28c4('0x8')]=queues[_0x1374fc[_0x28c4('0x53')]]['calleridnum'];queues[_0x1374fc[_0x28c4('0x5b')]]['calleridname']=queues[_0x1374fc['origtransfererlinkedid']][_0x28c4('0x5c')];queues[_0x1374fc[_0x28c4('0x5b')]][_0x28c4('0x37')]=utils[_0x28c4('0x15')]();queues[_0x1374fc['transfertargetuniqueid']][_0x28c4('0x1a')]=utils[_0x28c4('0x15')]();queues[_0x1374fc[_0x28c4('0x5b')]][_0x28c4('0x35')]=0x0;queues[_0x1374fc[_0x28c4('0x5b')]][_0x28c4('0x5d')]=0x0;utils[_0x28c4('0x3')](util['format'](_0x28c4('0x64'),_0x1374fc['origtransfereruniqueid'],queues[_0x1374fc[_0x28c4('0x5b')]][_0x28c4('0x20')],queues[_0x1374fc[_0x28c4('0x5b')]][_0x28c4('0xe')],queues[_0x1374fc[_0x28c4('0x5b')]][_0x28c4('0x8')],queues[_0x1374fc[_0x28c4('0x5b')]][_0x28c4('0x5c')]));}else{utils[_0x28c4('0x3')](util[_0x28c4('0x4')](_0x28c4('0x5f'),_0x1374fc[_0x28c4('0x52')],queues[_0x1374fc['secondtransfererlinkedid']][_0x28c4('0x20')],_0x1374fc[_0x28c4('0x53')]));queues[_0x1374fc[_0x28c4('0x55')]][_0x28c4('0xe')]=_0x1374fc[_0x28c4('0x53')];}}}}catch(_0x2e469c){utils[_0x28c4('0x16')](util[_0x28c4('0x4')]('[%s][queues][attendedtransfer]',_0x1374fc['origtransfereruniqueid']),_0x2e469c);}};exports[_0x28c4('0x65')]=function(_0x3d5bd5){try{if(!_['isNil'](queues[_0x3d5bd5['uniqueid']])){utils[_0x28c4('0x24')](util['format'](_0x28c4('0x66'),_0x3d5bd5[_0x28c4('0xf')]),_0x3d5bd5);queues[_0x3d5bd5[_0x28c4('0xf')]]['musiconholdstartAt']=utils['now']();utils[_0x28c4('0x3')](util[_0x28c4('0x4')](_0x28c4('0x67'),_0x3d5bd5['uniqueid'],queues[_0x3d5bd5[_0x28c4('0xf')]][_0x28c4('0x20')],queues[_0x3d5bd5[_0x28c4('0xf')]]['musiconholdstartAt']));}}catch(_0x3e522d){utils['error'](util[_0x28c4('0x4')]('[%s][queues][musiconholdstart]',_0x3d5bd5['uniqueid']),_0x3e522d);}};exports[_0x28c4('0x68')]=function(_0x5274d3){try{if(!_[_0x28c4('0x18')](queues[_0x5274d3[_0x28c4('0xf')]])){if(!_[_0x28c4('0x18')](queues[_0x5274d3[_0x28c4('0xf')]][_0x28c4('0x69')])){utils['debug'](util[_0x28c4('0x4')]('[%s][queues][musiconholdstop]',_0x5274d3[_0x28c4('0xf')]),_0x5274d3);queues[_0x5274d3[_0x28c4('0xf')]]['mohtime']+=utils[_0x28c4('0x36')](utils['now'](),queues[_0x5274d3['uniqueid']][_0x28c4('0x69')]);utils[_0x28c4('0x3')](util['format'](_0x28c4('0x6a'),_0x5274d3[_0x28c4('0xf')],queues[_0x5274d3[_0x28c4('0xf')]]['name'],queues[_0x5274d3[_0x28c4('0xf')]][_0x28c4('0x5d')]));delete queues[_0x5274d3['uniqueid']][_0x28c4('0x69')];}}}catch(_0x55c6bf){utils['error'](util[_0x28c4('0x4')](_0x28c4('0x6b'),_0x5274d3[_0x28c4('0xf')]),_0x55c6bf);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index c5123f0..63fd7aa 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 _0x4b04=['exten','channel','error','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','monitors','push','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','newexten','[%s][recordings][newexten]','application','toLowerCase','set','startsWith','appdata','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','name','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x4b04,0x14f));var _0x44b0=function(_0x12c66e,_0xea7b4){_0x12c66e=_0x12c66e-0x0;var _0x19481a=_0x4b04[_0x12c66e];return _0x19481a;};'use strict';var _=require(_0x44b0('0x0'));var util=require('util');var utils=require(_0x44b0('0x1'));var recordings={};function writeDB(_0x32d688){utils[_0x44b0('0x2')](util[_0x44b0('0x3')](_0x44b0('0x4'),_0x32d688[_0x44b0('0x5')]));if(_0x32d688[_0x44b0('0x6')]){utils[_0x44b0('0x7')](_0x32d688['accountcode'])[_0x44b0('0x8')](function(_0x11574d){if(_0x11574d){_0x32d688[_0x44b0('0x9')]=_0x11574d[_0x44b0('0xa')];_0x32d688['UserId']=_0x11574d['id'];}utils[_0x44b0('0xb')](_0x44b0('0xc'),_0x32d688);});}else{utils[_0x44b0('0xb')]('CreateVoiceRecording',_0x32d688);}}exports[_0x44b0('0xd')]=function(_0x3287dd){try{utils[_0x44b0('0xe')](util['format'](_0x44b0('0xf'),_0x3287dd[_0x44b0('0x5')]),_0x3287dd);if(_0x3287dd[_0x44b0('0x5')]==_0x3287dd[_0x44b0('0x10')]){utils[_0x44b0('0x2')](util['format'](_0x44b0('0x11'),_0x3287dd[_0x44b0('0x5')],_0x3287dd[_0x44b0('0x12')],_0x3287dd[_0x44b0('0x13')]));recordings[_0x3287dd[_0x44b0('0x5')]]={'uniqueid':_0x3287dd[_0x44b0('0x5')],'accountcode':_0x3287dd[_0x44b0('0x6')],'exten':_0x3287dd[_0x44b0('0x13')],'context':_0x3287dd['context'],'channel':_0x3287dd[_0x44b0('0x14')],'monitors':[]};}}catch(_0x4060ce){utils[_0x44b0('0x15')](util[_0x44b0('0x3')](_0x44b0('0xf'),_0x3287dd['uniqueid']),_0x4060ce);}};exports[_0x44b0('0x16')]=function(_0x33240b){try{utils[_0x44b0('0xe')](util[_0x44b0('0x3')]('[%s][recordings][newstate]',_0x33240b[_0x44b0('0x5')]),_0x33240b);if(!_[_0x44b0('0x17')](recordings[_0x33240b['uniqueid']])&&_0x33240b[_0x44b0('0x18')]==0x6){utils['info'](util[_0x44b0('0x3')](_0x44b0('0x19'),_0x33240b[_0x44b0('0x5')],_0x33240b[_0x44b0('0x12')],_0x33240b[_0x44b0('0x14')]));}else if(!_[_0x44b0('0x17')](recordings[_0x33240b[_0x44b0('0x10')]])&&_0x33240b[_0x44b0('0x18')]==0x6&&_0x33240b['context']!='transfer'){utils['info'](util[_0x44b0('0x3')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x33240b['uniqueid'],_0x33240b[_0x44b0('0x10')],_0x33240b[_0x44b0('0x12')],_0x33240b[_0x44b0('0x14')]));recordings[_0x33240b['linkedid']][_0x44b0('0x6')]=_0x33240b[_0x44b0('0x6')];}}catch(_0x5a558a){utils[_0x44b0('0x15')](util[_0x44b0('0x3')](_0x44b0('0x1a'),_0x33240b[_0x44b0('0x5')]),_0x5a558a);}};exports[_0x44b0('0x1b')]=function(_0xe35cc6){try{if(!_[_0x44b0('0x17')](_0xe35cc6[_0x44b0('0x1c')])&&!_[_0x44b0('0x17')](_0xe35cc6[_0x44b0('0x1c')]['mixmonitor_filename'])){utils['debug'](util[_0x44b0('0x3')](_0x44b0('0x1d'),_0xe35cc6['uniqueid']),_0xe35cc6);utils[_0x44b0('0x2')](util[_0x44b0('0x3')](_0x44b0('0x1e'),_0xe35cc6[_0x44b0('0x5')],_0xe35cc6[_0x44b0('0x1c')],_0xe35cc6[_0x44b0('0x1f')]));if(_[_0x44b0('0x20')](_0xe35cc6[_0x44b0('0x1f')],_0x44b0('0x21'))){_0xe35cc6['value']=_0xe35cc6['value'][_0x44b0('0x22')](_0x44b0('0x21'),'.WAV');}if(recordings[_0xe35cc6[_0x44b0('0x10')]]){var _0x571376=_['find'](recordings[_0xe35cc6[_0x44b0('0x10')]][_0x44b0('0x23')],{'value':_0xe35cc6[_0x44b0('0x1f')]});if(_[_0x44b0('0x17')](_0x571376)){recordings[_0xe35cc6[_0x44b0('0x10')]]['monitors'][_0x44b0('0x24')]({'value':_0xe35cc6[_0x44b0('0x1f')]});}}}}catch(_0x4f1487){utils['error'](util[_0x44b0('0x3')](_0x44b0('0x1d'),_0xe35cc6['uniqueid']),_0x4f1487);}};exports[_0x44b0('0x25')]=function(_0x481e24){try{if(!_[_0x44b0('0x17')](recordings[_0x481e24['uniqueid']])){utils[_0x44b0('0xe')](util[_0x44b0('0x3')]('[%s][recordings][hangup]',_0x481e24[_0x44b0('0x5')]),_0x481e24);utils[_0x44b0('0x2')](util[_0x44b0('0x3')](_0x44b0('0x26'),_0x481e24['uniqueid'],_0x481e24[_0x44b0('0x27')],_0x481e24[_0x44b0('0x28')],_0x481e24[_0x44b0('0x29')]));recordings[_0x481e24[_0x44b0('0x5')]][_0x44b0('0x27')]=_0x481e24[_0x44b0('0x27')];recordings[_0x481e24['uniqueid']][_0x44b0('0x28')]=_0x481e24[_0x44b0('0x28')];recordings[_0x481e24[_0x44b0('0x5')]]['connectedlinenum']=_0x481e24[_0x44b0('0x2a')];recordings[_0x481e24[_0x44b0('0x5')]][_0x44b0('0x2b')]=_0x481e24[_0x44b0('0x2b')];if(recordings[_0x481e24['uniqueid']]['type']==_0x44b0('0x2c')&&recordings[_0x481e24[_0x44b0('0x5')]][_0x44b0('0x6')]){recordings[_0x481e24[_0x44b0('0x5')]][_0x44b0('0x2a')]=recordings[_0x481e24[_0x44b0('0x5')]]['accountcode'];recordings[_0x481e24[_0x44b0('0x5')]]['connectedlinename']='';}recordings[_0x481e24[_0x44b0('0x5')]]['monitors']['forEach'](function(_0x41daa9){var _0xe1724e=_['clone'](recordings[_0x481e24[_0x44b0('0x5')]]);_0xe1724e[_0x44b0('0x1f')]=_0x41daa9['value'];writeDB(_0xe1724e);});delete recordings[_0x481e24[_0x44b0('0x5')]];}}catch(_0x35326c){utils[_0x44b0('0x15')](util['format']('[%s][recordings][hangup]',_0x481e24[_0x44b0('0x5')]),_0x35326c);}};exports[_0x44b0('0x2d')]=function(_0x801f40){try{if(!_['isNil'](recordings[_0x801f40[_0x44b0('0x5')]])){utils[_0x44b0('0xe')](util[_0x44b0('0x3')](_0x44b0('0x2e'),_0x801f40[_0x44b0('0x5')]),_0x801f40);utils[_0x44b0('0x2')](util[_0x44b0('0x3')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x801f40[_0x44b0('0x5')],_0x801f40[_0x44b0('0x2f')],_0x801f40['appdata']));if(_0x801f40[_0x44b0('0x2f')][_0x44b0('0x30')]()==_0x44b0('0x31')&&_[_0x44b0('0x32')](_0x801f40['appdata'][_0x44b0('0x30')](),'cdr')){var _0x728fd4=_0x801f40[_0x44b0('0x33')][_0x44b0('0x34')]('=');var _0x41a02b=_0x728fd4[0x0][_0x44b0('0x35')](_0x728fd4[0x0][_0x44b0('0x36')]('(')+0x1,_0x728fd4[0x0][_0x44b0('0x36')](')'));var _0x58e047=_0x728fd4[0x1];recordings[_0x801f40[_0x44b0('0x5')]][_0x41a02b]=_0x58e047;}}}catch(_0x1aacfb){utils[_0x44b0('0x15')](util['format'](_0x44b0('0x2e'),_0x801f40['uniqueid']),_0x1aacfb);}};exports[_0x44b0('0x37')]=function(_0x134efb){try{if(!_['isNil'](recordings[_0x134efb['uniqueid']])){utils[_0x44b0('0xe')](util[_0x44b0('0x3')](_0x44b0('0x38'),_0x134efb[_0x44b0('0x5')]),_0x134efb);utils['info'](util[_0x44b0('0x3')](_0x44b0('0x39'),_0x134efb['uniqueid'],_0x134efb[_0x44b0('0x3a')]));recordings[_0x134efb[_0x44b0('0x5')]][_0x44b0('0x3a')]=_0x134efb['queue'];}}catch(_0x3ff81b){utils['error'](util[_0x44b0('0x3')](_0x44b0('0x38'),_0x134efb['uniqueid']),_0x3ff81b);}}; \ No newline at end of file +var _0x8532=['channel','error','channelstate','isNil','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','monitors','push','[%s][recordings][varset]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','getUserByInternal','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','linkedid','exten','context'];(function(_0x37c4f3,_0x1acd04){var _0x262974=function(_0x17f067){while(--_0x17f067){_0x37c4f3['push'](_0x37c4f3['shift']());}};_0x262974(++_0x1acd04);}(_0x8532,0x15a));var _0x2853=function(_0xfef1da,_0x409405){_0xfef1da=_0xfef1da-0x0;var _0x44abe5=_0x8532[_0xfef1da];return _0x44abe5;};'use strict';var _=require(_0x2853('0x0'));var util=require(_0x2853('0x1'));var utils=require(_0x2853('0x2'));var recordings={};function writeDB(_0x45ccbe){utils[_0x2853('0x3')](util[_0x2853('0x4')](_0x2853('0x5'),_0x45ccbe[_0x2853('0x6')]));if(_0x45ccbe['accountcode']){utils[_0x2853('0x7')](_0x45ccbe[_0x2853('0x8')])[_0x2853('0x9')](function(_0x2bb118){if(_0x2bb118){_0x45ccbe[_0x2853('0xa')]=_0x2bb118[_0x2853('0xb')];_0x45ccbe[_0x2853('0xc')]=_0x2bb118['id'];}utils[_0x2853('0xd')](_0x2853('0xe'),_0x45ccbe);});}else{utils[_0x2853('0xd')](_0x2853('0xe'),_0x45ccbe);}}exports[_0x2853('0xf')]=function(_0x55f5ca){try{utils[_0x2853('0x10')](util[_0x2853('0x4')]('[%s][recordings][newchannel]',_0x55f5ca[_0x2853('0x6')]),_0x55f5ca);if(_0x55f5ca['uniqueid']==_0x55f5ca[_0x2853('0x11')]){utils[_0x2853('0x3')](util[_0x2853('0x4')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x55f5ca[_0x2853('0x6')],_0x55f5ca['context'],_0x55f5ca[_0x2853('0x12')]));recordings[_0x55f5ca[_0x2853('0x6')]]={'uniqueid':_0x55f5ca[_0x2853('0x6')],'accountcode':_0x55f5ca[_0x2853('0x8')],'exten':_0x55f5ca[_0x2853('0x12')],'context':_0x55f5ca[_0x2853('0x13')],'channel':_0x55f5ca[_0x2853('0x14')],'monitors':[]};}}catch(_0x4c03e1){utils[_0x2853('0x15')](util[_0x2853('0x4')]('[%s][recordings][newchannel]',_0x55f5ca['uniqueid']),_0x4c03e1);}};exports['newstate']=function(_0xcf47e1){try{utils[_0x2853('0x10')](util[_0x2853('0x4')]('[%s][recordings][newstate]',_0xcf47e1['uniqueid']),_0xcf47e1);if(!_['isNil'](recordings[_0xcf47e1['uniqueid']])&&_0xcf47e1[_0x2853('0x16')]==0x6){utils[_0x2853('0x3')](util[_0x2853('0x4')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0xcf47e1[_0x2853('0x6')],_0xcf47e1[_0x2853('0x13')],_0xcf47e1['channel']));}else if(!_[_0x2853('0x17')](recordings[_0xcf47e1[_0x2853('0x11')]])&&_0xcf47e1[_0x2853('0x16')]==0x6&&_0xcf47e1[_0x2853('0x13')]!=_0x2853('0x18')){utils[_0x2853('0x3')](util['format'](_0x2853('0x19'),_0xcf47e1['uniqueid'],_0xcf47e1['linkedid'],_0xcf47e1[_0x2853('0x13')],_0xcf47e1[_0x2853('0x14')]));recordings[_0xcf47e1[_0x2853('0x11')]]['accountcode']=_0xcf47e1[_0x2853('0x8')];}}catch(_0x238b9d){utils[_0x2853('0x15')](util[_0x2853('0x4')]('[%s][recordings][newstate]',_0xcf47e1[_0x2853('0x6')]),_0x238b9d);}};exports[_0x2853('0x1a')]=function(_0x4ff180){try{if(!_[_0x2853('0x17')](_0x4ff180['variable'])&&!_[_0x2853('0x17')](_0x4ff180[_0x2853('0x1b')][_0x2853('0x1c')])){utils[_0x2853('0x10')](util[_0x2853('0x4')]('[%s][recordings][varset]',_0x4ff180['uniqueid']),_0x4ff180);utils[_0x2853('0x3')](util[_0x2853('0x4')](_0x2853('0x1d'),_0x4ff180['uniqueid'],_0x4ff180['variable'],_0x4ff180[_0x2853('0x1e')]));if(_[_0x2853('0x1f')](_0x4ff180[_0x2853('0x1e')],_0x2853('0x20'))){_0x4ff180[_0x2853('0x1e')]=_0x4ff180[_0x2853('0x1e')][_0x2853('0x21')](_0x2853('0x20'),_0x2853('0x22'));}if(recordings[_0x4ff180[_0x2853('0x11')]]){var _0x1dd6ed=_['find'](recordings[_0x4ff180['linkedid']][_0x2853('0x23')],{'value':_0x4ff180[_0x2853('0x1e')]});if(_['isNil'](_0x1dd6ed)){recordings[_0x4ff180[_0x2853('0x11')]][_0x2853('0x23')][_0x2853('0x24')]({'value':_0x4ff180['value']});}}}}catch(_0xefb824){utils[_0x2853('0x15')](util['format'](_0x2853('0x25'),_0x4ff180[_0x2853('0x6')]),_0xefb824);}};exports['hangup']=function(_0xbb4453){try{if(!_[_0x2853('0x17')](recordings[_0xbb4453[_0x2853('0x6')]])){utils['debug'](util[_0x2853('0x4')]('[%s][recordings][hangup]',_0xbb4453[_0x2853('0x6')]),_0xbb4453);utils[_0x2853('0x3')](util[_0x2853('0x4')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0xbb4453['uniqueid'],_0xbb4453[_0x2853('0x26')],_0xbb4453[_0x2853('0x27')],_0xbb4453[_0x2853('0x28')]));recordings[_0xbb4453['uniqueid']][_0x2853('0x26')]=_0xbb4453[_0x2853('0x26')];recordings[_0xbb4453[_0x2853('0x6')]][_0x2853('0x27')]=_0xbb4453[_0x2853('0x27')];recordings[_0xbb4453['uniqueid']][_0x2853('0x29')]=_0xbb4453[_0x2853('0x29')];recordings[_0xbb4453['uniqueid']][_0x2853('0x2a')]=_0xbb4453[_0x2853('0x2a')];if(recordings[_0xbb4453['uniqueid']][_0x2853('0x2b')]==_0x2853('0x2c')&&recordings[_0xbb4453['uniqueid']][_0x2853('0x8')]){recordings[_0xbb4453['uniqueid']][_0x2853('0x29')]=recordings[_0xbb4453[_0x2853('0x6')]][_0x2853('0x8')];recordings[_0xbb4453['uniqueid']]['connectedlinename']='';}recordings[_0xbb4453[_0x2853('0x6')]]['monitors'][_0x2853('0x2d')](function(_0x492567){var _0x294827=_[_0x2853('0x2e')](recordings[_0xbb4453['uniqueid']]);_0x294827[_0x2853('0x1e')]=_0x492567[_0x2853('0x1e')];writeDB(_0x294827);});delete recordings[_0xbb4453['uniqueid']];}}catch(_0x4fe6fc){utils[_0x2853('0x15')](util[_0x2853('0x4')]('[%s][recordings][hangup]',_0xbb4453[_0x2853('0x6')]),_0x4fe6fc);}};exports[_0x2853('0x2f')]=function(_0x3ae4a1){try{if(!_[_0x2853('0x17')](recordings[_0x3ae4a1[_0x2853('0x6')]])){utils[_0x2853('0x10')](util[_0x2853('0x4')](_0x2853('0x30'),_0x3ae4a1[_0x2853('0x6')]),_0x3ae4a1);utils[_0x2853('0x3')](util['format'](_0x2853('0x31'),_0x3ae4a1[_0x2853('0x6')],_0x3ae4a1[_0x2853('0x32')],_0x3ae4a1[_0x2853('0x33')]));if(_0x3ae4a1[_0x2853('0x32')][_0x2853('0x34')]()==_0x2853('0x35')&&_[_0x2853('0x36')](_0x3ae4a1['appdata'][_0x2853('0x34')](),'cdr')){var _0x5b7867=_0x3ae4a1[_0x2853('0x33')][_0x2853('0x37')]('=');var _0x2a20be=_0x5b7867[0x0][_0x2853('0x38')](_0x5b7867[0x0][_0x2853('0x39')]('(')+0x1,_0x5b7867[0x0][_0x2853('0x39')](')'));var _0x15a3fc=_0x5b7867[0x1];recordings[_0x3ae4a1[_0x2853('0x6')]][_0x2a20be]=_0x15a3fc;}}}catch(_0x3ab4d0){utils[_0x2853('0x15')](util['format'](_0x2853('0x30'),_0x3ae4a1[_0x2853('0x6')]),_0x3ab4d0);}};exports[_0x2853('0x3a')]=function(_0x4178e9){try{if(!_[_0x2853('0x17')](recordings[_0x4178e9[_0x2853('0x6')]])){utils[_0x2853('0x10')](util[_0x2853('0x4')]('[%s][recordings][queuecallerjoin]',_0x4178e9[_0x2853('0x6')]),_0x4178e9);utils[_0x2853('0x3')](util[_0x2853('0x4')](_0x2853('0x3b'),_0x4178e9[_0x2853('0x6')],_0x4178e9[_0x2853('0x3c')]));recordings[_0x4178e9['uniqueid']]['queue']=_0x4178e9['queue'];}}catch(_0x1a62e3){utils['error'](util[_0x2853('0x4')]('[%s][recordings][queuecallerjoin]',_0x4178e9[_0x2853('0x6')]),_0x1a62e3);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index f514c84..80a1ab7 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 _0xc49b=['transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','lodash','./utils','info','format','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','transferercalleridnum','transferercalleridname','transfereecalleridnum','blind','error','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum'];(function(_0x16e931,_0x1fdf36){var _0x4e07eb=function(_0x2cfeb8){while(--_0x2cfeb8){_0x16e931['push'](_0x16e931['shift']());}};_0x4e07eb(++_0x1fdf36);}(_0xc49b,0x114));var _0xbc49=function(_0x4f90c4,_0x3bc9d4){_0x4f90c4=_0x4f90c4-0x0;var _0x44c184=_0xc49b[_0x4f90c4];return _0x44c184;};'use strict';var _=require(_0xbc49('0x0'));var util=require('util');var utils=require(_0xbc49('0x1'));function writeDB(_0x27d296){utils[_0xbc49('0x2')](util[_0xbc49('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x27d296[_0xbc49('0x4')]===_0xbc49('0x5')?_0x27d296[_0xbc49('0x6')]:_0x27d296[_0xbc49('0x7')],_0x27d296['type']));utils[_0xbc49('0x8')](_0xbc49('0x9'),_0x27d296);}exports[_0xbc49('0xa')]=function(_0x22f86c){try{utils[_0xbc49('0xb')](util[_0xbc49('0x3')]('[%s][transfers][blindtransfer]',_0x22f86c['uniqueid']),_0x22f86c);utils[_0xbc49('0x2')](util['format']('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x22f86c[_0xbc49('0x7')],_0x22f86c[_0xbc49('0xc')],_0x22f86c[_0xbc49('0xd')],_0x22f86c[_0xbc49('0xe')],_0x22f86c['transfereecalleridname']));_0x22f86c[_0xbc49('0x4')]=_0xbc49('0xf');writeDB(_0x22f86c);}catch(_0x493beb){utils[_0xbc49('0x10')](util[_0xbc49('0x3')]('[%s][transfers][blindtransfer]',_0x22f86c[_0xbc49('0x7')]),_0x493beb);}};exports['attendedtransfer']=function(_0x1f8c68){try{utils[_0xbc49('0xb')](util[_0xbc49('0x3')]('[%s][transfers][attendedtransfer]',_0x1f8c68[_0xbc49('0x6')]),_0x1f8c68);utils[_0xbc49('0x2')](util[_0xbc49('0x3')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x1f8c68[_0xbc49('0x6')],_0x1f8c68[_0xbc49('0x11')],_0x1f8c68[_0xbc49('0x12')],_0x1f8c68[_0xbc49('0x13')],_0x1f8c68[_0xbc49('0x14')]));_0x1f8c68=_[_0xbc49('0x15')](_0x1f8c68,{'transfererchannel':_0x1f8c68[_0xbc49('0x16')],'transferercalleridnum':_0x1f8c68[_0xbc49('0x11')],'transferercalleridname':_0x1f8c68[_0xbc49('0x12')],'transfererconnectedlinenum':_0x1f8c68[_0xbc49('0x17')],'transfererconnectedlinename':_0x1f8c68[_0xbc49('0x18')],'transfereraccountcode':_0x1f8c68[_0xbc49('0x19')],'transferercontext':_0x1f8c68[_0xbc49('0x1a')],'transfererexten':_0x1f8c68[_0xbc49('0x1b')],'transfererlinkedid':_0x1f8c68[_0xbc49('0x1c')],'context':_0x1f8c68[_0xbc49('0x1d')],'extension':_0x1f8c68['origtransfererexten'],'type':_0xbc49('0x5')});if(_[_0xbc49('0x1e')](_0x1f8c68[_0xbc49('0x1f')])){_0x1f8c68=_['assign'](_0x1f8c68,{'transfereechannel':_0x1f8c68[_0xbc49('0x20')],'transfereecalleridnum':_0x1f8c68[_0xbc49('0x13')],'transfereecalleridname':_0x1f8c68['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x1f8c68[_0xbc49('0x21')],'transfereeconnectedlinename':_0x1f8c68['transfertargetconnectedlinename'],'transfereeaccountcode':_0x1f8c68[_0xbc49('0x22')],'transfereecontext':_0x1f8c68[_0xbc49('0x23')],'transfereeexten':_0x1f8c68['transfertargetexten'],'transfereelinkedid':_0x1f8c68[_0xbc49('0x24')]});}writeDB(_0x1f8c68);}catch(_0x5f60bc){utils['error'](util[_0xbc49('0x3')]('[%s][transfers][attendedtransfer]',_0x1f8c68[_0xbc49('0x6')]),_0x5f60bc);}}; \ No newline at end of file +var _0xd2e8=['origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','error','attendedtransfer','debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s'];(function(_0x3e8d4d,_0x55cd8f){var _0x3f4d24=function(_0x1cf516){while(--_0x1cf516){_0x3e8d4d['push'](_0x3e8d4d['shift']());}};_0x3f4d24(++_0x55cd8f);}(_0xd2e8,0x92));var _0x8d2e=function(_0x4b775b,_0x2aadc6){_0x4b775b=_0x4b775b-0x0;var _0xf84d39=_0xd2e8[_0x4b775b];return _0xf84d39;};'use strict';var _=require(_0x8d2e('0x0'));var util=require(_0x8d2e('0x1'));var utils=require(_0x8d2e('0x2'));function writeDB(_0x5533a8){utils['info'](util[_0x8d2e('0x3')](_0x8d2e('0x4'),_0x5533a8[_0x8d2e('0x5')]===_0x8d2e('0x6')?_0x5533a8[_0x8d2e('0x7')]:_0x5533a8[_0x8d2e('0x8')],_0x5533a8[_0x8d2e('0x5')]));utils[_0x8d2e('0x9')](_0x8d2e('0xa'),_0x5533a8);}exports['blindtransfer']=function(_0x336aea){try{utils['debug'](util[_0x8d2e('0x3')](_0x8d2e('0xb'),_0x336aea[_0x8d2e('0x8')]),_0x336aea);utils[_0x8d2e('0xc')](util[_0x8d2e('0x3')](_0x8d2e('0xd'),_0x336aea[_0x8d2e('0x8')],_0x336aea[_0x8d2e('0xe')],_0x336aea[_0x8d2e('0xf')],_0x336aea[_0x8d2e('0x10')],_0x336aea['transfereecalleridname']));_0x336aea[_0x8d2e('0x5')]='blind';writeDB(_0x336aea);}catch(_0xcc1c44){utils[_0x8d2e('0x11')](util[_0x8d2e('0x3')](_0x8d2e('0xb'),_0x336aea['uniqueid']),_0xcc1c44);}};exports[_0x8d2e('0x12')]=function(_0x19d1a9){try{utils[_0x8d2e('0x13')](util['format'](_0x8d2e('0x14'),_0x19d1a9['origtransfereruniqueid']),_0x19d1a9);utils[_0x8d2e('0xc')](util['format'](_0x8d2e('0x15'),_0x19d1a9['origtransfereruniqueid'],_0x19d1a9[_0x8d2e('0x16')],_0x19d1a9[_0x8d2e('0x17')],_0x19d1a9[_0x8d2e('0x18')],_0x19d1a9[_0x8d2e('0x19')]));_0x19d1a9=_[_0x8d2e('0x1a')](_0x19d1a9,{'transfererchannel':_0x19d1a9[_0x8d2e('0x1b')],'transferercalleridnum':_0x19d1a9[_0x8d2e('0x16')],'transferercalleridname':_0x19d1a9[_0x8d2e('0x17')],'transfererconnectedlinenum':_0x19d1a9[_0x8d2e('0x1c')],'transfererconnectedlinename':_0x19d1a9['secondtransfererconnectedlinename'],'transfereraccountcode':_0x19d1a9[_0x8d2e('0x1d')],'transferercontext':_0x19d1a9[_0x8d2e('0x1e')],'transfererexten':_0x19d1a9[_0x8d2e('0x1f')],'transfererlinkedid':_0x19d1a9[_0x8d2e('0x20')],'context':_0x19d1a9[_0x8d2e('0x21')],'extension':_0x19d1a9[_0x8d2e('0x22')],'type':_0x8d2e('0x6')});if(_['isNil'](_0x19d1a9[_0x8d2e('0x23')])){_0x19d1a9=_[_0x8d2e('0x1a')](_0x19d1a9,{'transfereechannel':_0x19d1a9[_0x8d2e('0x24')],'transfereecalleridnum':_0x19d1a9['transfertargetcalleridnum'],'transfereecalleridname':_0x19d1a9[_0x8d2e('0x19')],'transfereeconnectedlinenum':_0x19d1a9[_0x8d2e('0x25')],'transfereeconnectedlinename':_0x19d1a9[_0x8d2e('0x26')],'transfereeaccountcode':_0x19d1a9[_0x8d2e('0x27')],'transfereecontext':_0x19d1a9['transfertargetcontext'],'transfereeexten':_0x19d1a9[_0x8d2e('0x28')],'transfereelinkedid':_0x19d1a9[_0x8d2e('0x29')]});}writeDB(_0x19d1a9);}catch(_0x4f3778){utils[_0x8d2e('0x11')](util[_0x8d2e('0x3')](_0x8d2e('0x14'),_0x19d1a9[_0x8d2e('0x7')]),_0x4f3778);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index f01f0d9..5a1e37c 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 _0x1b94=['format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','jayson/promise','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','internal','name','interface','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','type','acw','acwTimeout','addTime','seconds'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x1b94,0x169));var _0x41b9=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x1b94[_0x344a3f];return _0x264712;};'use strict';var BPromise=require(_0x41b9('0x0'));var jayson=require(_0x41b9('0x1'));var moment=require('moment');var util=require(_0x41b9('0x2'));var client=jayson[_0x41b9('0x3')][_0x41b9('0x4')]({'port':0x2329});var logger=require(_0x41b9('0x5'))(_0x41b9('0x6'));exports[_0x41b9('0x7')]=function(_0x20d891,_0x4b9d90){logger[_0x41b9('0x7')](_0x20d891,_0x4b9d90?util[_0x41b9('0x8')](_0x4b9d90,{'showHidden':![],'depth':null}):'');};exports[_0x41b9('0x9')]=function(_0x26e742,_0x4d5a46){logger[_0x41b9('0x9')](_0x26e742,_0x4d5a46?util[_0x41b9('0x8')](_0x4d5a46,{'showHidden':![],'depth':null}):'');};exports[_0x41b9('0xa')]=function(_0x3bfb4b,_0x5c5dee){logger[_0x41b9('0xa')](_0x3bfb4b,_0x5c5dee?util[_0x41b9('0x8')](_0x5c5dee,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x3d5354,_0x324671){return client[_0x41b9('0xb')](_0x3d5354,{'body':_0x324671})[_0x41b9('0xc')](function(_0x94094d){logger['debug'](_0x41b9('0xd'),_0x3d5354,_0x94094d?util['inspect'](_0x94094d,{'showHidden':![],'depth':null}):'');})[_0x41b9('0xe')](function(_0x506583){logger[_0x41b9('0xa')](_0x41b9('0xd'),_0x3d5354,_0x506583?util['inspect'](_0x506583,{'showHidden':![],'depth':null}):'');});};function getUser(_0x2842fb){return client[_0x41b9('0xb')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x41b9('0xf'),_0x41b9('0x10'),_0x41b9('0x11')],'where':_0x2842fb,'limit':0x1}})['then'](function(_0x1e8088){logger[_0x41b9('0x9')]('[utils][getUser]\x20where:%s',JSON[_0x41b9('0x12')](_0x2842fb),_0x1e8088?util[_0x41b9('0x8')](_0x1e8088,{'showHidden':![],'depth':null}):'');return _0x1e8088['result'][_0x41b9('0x13')]?_0x1e8088[_0x41b9('0x14')][0x0]:null;});}exports[_0x41b9('0x15')]=function(_0x5675a7){return new BPromise(function(_0x1fba01,_0x151e7a){if(_0x5675a7){return getUser({'internal':_0x5675a7})[_0x41b9('0xc')](function(_0x568a32){logger[_0x41b9('0x7')](_0x41b9('0x16'),_0x5675a7,_0x568a32?_0x41b9('0x17'):_0x41b9('0x18'));return _0x1fba01(_0x568a32);})[_0x41b9('0xe')](function(_0x2e91dc){logger[_0x41b9('0xa')](_0x41b9('0x19'),_0x2e91dc?util[_0x41b9('0x8')](_0x2e91dc,{'showHidden':![],'depth':null}):'');return _0x1fba01(null);});}return _0x1fba01(null);});};exports[_0x41b9('0x1a')]=function(_0x4134cb){return new BPromise(function(_0x3b3082,_0x160199){if(_0x4134cb){return getUser({'interface':_0x4134cb})[_0x41b9('0xc')](function(_0xea5803){logger[_0x41b9('0x7')](_0x41b9('0x1b'),_0x4134cb,_0xea5803?_0x41b9('0x17'):'notfound');return _0x3b3082(_0xea5803);})[_0x41b9('0xe')](function(_0x341916){logger[_0x41b9('0xa')](_0x41b9('0x1c'),_0x341916?util[_0x41b9('0x8')](_0x341916,{'showHidden':![],'depth':null}):'');return _0x3b3082(null);});}return _0x3b3082(null);});};exports['getUserByName']=function(_0x2bbfa4){return new BPromise(function(_0x2c8deb,_0x2718c7){if(_0x2bbfa4){return getUser({'name':_0x2bbfa4})[_0x41b9('0xc')](function(_0x5f598e){logger[_0x41b9('0x7')](_0x41b9('0x1d'),_0x2bbfa4,_0x5f598e?_0x41b9('0x17'):'notfound');return _0x2c8deb(_0x5f598e);})[_0x41b9('0xe')](function(_0x1c98a6){logger['error']('[utils][getUserByName]',_0x1c98a6?util[_0x41b9('0x8')](_0x1c98a6,{'showHidden':![],'depth':null}):'');return _0x2c8deb(null);});}return _0x2c8deb(null);});};exports['getVoiceQueueByName']=function(_0x40c663){return new BPromise(function(_0x39b0e7,_0x3c8179){if(_0x40c663){return client[_0x41b9('0xb')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x41b9('0x10'),_0x41b9('0x1e'),_0x41b9('0x1f'),_0x41b9('0x20')],'where':{'name':_0x40c663},'limit':0x1}})['then'](function(_0x3db537){logger['debug']('[utils][getVoiceQueueByName]\x20name:%s',_0x40c663,_0x3db537?util[_0x41b9('0x8')](_0x3db537,{'showHidden':![],'depth':null}):'');logger[_0x41b9('0x7')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x40c663,_0x3db537?_0x41b9('0x17'):_0x41b9('0x18'));return _0x39b0e7(_0x3db537['result'][_0x41b9('0x13')]?_0x3db537[_0x41b9('0x14')][0x0]:null);})['catch'](function(_0x5ea6f0){logger[_0x41b9('0xa')]('[utils][getVoiceQueueByName]',_0x5ea6f0?util[_0x41b9('0x8')](_0x5ea6f0,{'showHidden':![],'depth':null}):'');return _0x39b0e7(null);});}return _0x39b0e7(null);});};exports[_0x41b9('0x21')]=function(_0x13d873,_0xda8cb3){return moment(_0x13d873)['add'](_0xda8cb3,_0x41b9('0x22'))[_0x41b9('0x23')](_0x41b9('0x24'));};exports[_0x41b9('0x25')]=function(_0x29a9bb,_0x306c40){return moment(_0x29a9bb)[_0x41b9('0x26')](_0x306c40,'seconds')[_0x41b9('0x23')](_0x41b9('0x24'));};exports[_0x41b9('0x27')]=function(_0x3710a8,_0x54cd85){return moment(_0x3710a8)[_0x41b9('0x28')](moment(_0x54cd85),_0x41b9('0x22'));};exports['sumTime']=function(_0x257be3,_0x54253c){return parseInt(_0x257be3,0xa)+parseInt(_0x54253c,0xa);};exports[_0x41b9('0x29')]=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x41b9('0x2a')]=function(_0x1f247c,_0x500353){if(_0x500353){return moment(_0x1f247c)['isAfter'](_0x500353);}return!![];};exports[_0x41b9('0x2b')]=function(_0x5ad039,_0x5bf37e){if(_0x5bf37e){return moment(_0x5ad039)[_0x41b9('0x2b')](_0x5bf37e);}else if(_0x5ad039){return!![];}return![];}; \ No newline at end of file +var _0xf2a0=['GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','getUserByInterface','found','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','format','isAfter','isBefore','jayson/promise','moment','util','client','../../config/logger','xdr','info','debug','inspect','error','request','[utils][request]\x20name:%s','catch'];(function(_0x551bc1,_0x47cff3){var _0x12ea5e=function(_0x2d4c10){while(--_0x2d4c10){_0x551bc1['push'](_0x551bc1['shift']());}};_0x12ea5e(++_0x47cff3);}(_0xf2a0,0x7d));var _0x0f2a=function(_0x377217,_0x26b013){_0x377217=_0x377217-0x0;var _0x26258d=_0xf2a0[_0x377217];return _0x26258d;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x0f2a('0x0'));var moment=require(_0x0f2a('0x1'));var util=require(_0x0f2a('0x2'));var client=jayson[_0x0f2a('0x3')]['http']({'port':0x2329});var logger=require(_0x0f2a('0x4'))(_0x0f2a('0x5'));exports[_0x0f2a('0x6')]=function(_0x56095c,_0x452b83){logger[_0x0f2a('0x6')](_0x56095c,_0x452b83?util['inspect'](_0x452b83,{'showHidden':![],'depth':null}):'');};exports[_0x0f2a('0x7')]=function(_0x3bba9e,_0x4c685e){logger[_0x0f2a('0x7')](_0x3bba9e,_0x4c685e?util[_0x0f2a('0x8')](_0x4c685e,{'showHidden':![],'depth':null}):'');};exports[_0x0f2a('0x9')]=function(_0x507230,_0x3858d8){logger[_0x0f2a('0x9')](_0x507230,_0x3858d8?util[_0x0f2a('0x8')](_0x3858d8,{'showHidden':![],'depth':null}):'');};exports[_0x0f2a('0xa')]=function(_0x41b52c,_0x579b54){return client[_0x0f2a('0xa')](_0x41b52c,{'body':_0x579b54})['then'](function(_0x28051f){logger[_0x0f2a('0x7')](_0x0f2a('0xb'),_0x41b52c,_0x28051f?util[_0x0f2a('0x8')](_0x28051f,{'showHidden':![],'depth':null}):'');})[_0x0f2a('0xc')](function(_0x3378d7){logger[_0x0f2a('0x9')](_0x0f2a('0xb'),_0x41b52c,_0x3378d7?util[_0x0f2a('0x8')](_0x3378d7,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3c3828){return client[_0x0f2a('0xa')](_0x0f2a('0xd'),{'options':{'raw':!![],'attributes':['id',_0x0f2a('0xe'),_0x0f2a('0xf'),_0x0f2a('0x10')],'where':_0x3c3828,'limit':0x1}})[_0x0f2a('0x11')](function(_0x59bc4f){logger['debug'](_0x0f2a('0x12'),JSON['stringify'](_0x3c3828),_0x59bc4f?util[_0x0f2a('0x8')](_0x59bc4f,{'showHidden':![],'depth':null}):'');return _0x59bc4f[_0x0f2a('0x13')][_0x0f2a('0x14')]?_0x59bc4f[_0x0f2a('0x13')][0x0]:null;});}exports['getUserByInternal']=function(_0xc7cdac){return new BPromise(function(_0x2ae7f5,_0x2f56b7){if(_0xc7cdac){return getUser({'internal':_0xc7cdac})[_0x0f2a('0x11')](function(_0x31a089){logger['info'](_0x0f2a('0x15'),_0xc7cdac,_0x31a089?'found':_0x0f2a('0x16'));return _0x2ae7f5(_0x31a089);})['catch'](function(_0x5b71e6){logger[_0x0f2a('0x9')](_0x0f2a('0x17'),_0x5b71e6?util['inspect'](_0x5b71e6,{'showHidden':![],'depth':null}):'');return _0x2ae7f5(null);});}return _0x2ae7f5(null);});};exports[_0x0f2a('0x18')]=function(_0x27b95d){return new BPromise(function(_0x593c1d,_0x3f930c){if(_0x27b95d){return getUser({'interface':_0x27b95d})[_0x0f2a('0x11')](function(_0x15e239){logger[_0x0f2a('0x6')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x27b95d,_0x15e239?_0x0f2a('0x19'):_0x0f2a('0x16'));return _0x593c1d(_0x15e239);})[_0x0f2a('0xc')](function(_0x2ff25c){logger['error']('[utils][getUserByInterface]',_0x2ff25c?util[_0x0f2a('0x8')](_0x2ff25c,{'showHidden':![],'depth':null}):'');return _0x593c1d(null);});}return _0x593c1d(null);});};exports[_0x0f2a('0x1a')]=function(_0x7a2b49){return new BPromise(function(_0x3cbf6b,_0x51fb52){if(_0x7a2b49){return getUser({'name':_0x7a2b49})[_0x0f2a('0x11')](function(_0x36a0b4){logger[_0x0f2a('0x6')](_0x0f2a('0x1b'),_0x7a2b49,_0x36a0b4?'found':_0x0f2a('0x16'));return _0x3cbf6b(_0x36a0b4);})[_0x0f2a('0xc')](function(_0x2eb659){logger[_0x0f2a('0x9')](_0x0f2a('0x1c'),_0x2eb659?util[_0x0f2a('0x8')](_0x2eb659,{'showHidden':![],'depth':null}):'');return _0x3cbf6b(null);});}return _0x3cbf6b(null);});};exports['getVoiceQueueByName']=function(_0x226b5f){return new BPromise(function(_0x20f1d3,_0x2f910e){if(_0x226b5f){return client['request']('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name',_0x0f2a('0x1d'),_0x0f2a('0x1e'),_0x0f2a('0x1f')],'where':{'name':_0x226b5f},'limit':0x1}})[_0x0f2a('0x11')](function(_0x3f83b6){logger[_0x0f2a('0x7')](_0x0f2a('0x20'),_0x226b5f,_0x3f83b6?util['inspect'](_0x3f83b6,{'showHidden':![],'depth':null}):'');logger[_0x0f2a('0x6')](_0x0f2a('0x21'),_0x226b5f,_0x3f83b6?_0x0f2a('0x19'):'notfound');return _0x20f1d3(_0x3f83b6[_0x0f2a('0x13')][_0x0f2a('0x14')]?_0x3f83b6[_0x0f2a('0x13')][0x0]:null);})[_0x0f2a('0xc')](function(_0x512d81){logger[_0x0f2a('0x9')]('[utils][getVoiceQueueByName]',_0x512d81?util[_0x0f2a('0x8')](_0x512d81,{'showHidden':![],'depth':null}):'');return _0x20f1d3(null);});}return _0x20f1d3(null);});};exports[_0x0f2a('0x22')]=function(_0x45bcbb,_0x20a1bd){return moment(_0x45bcbb)[_0x0f2a('0x23')](_0x20a1bd,_0x0f2a('0x24'))['format'](_0x0f2a('0x25'));};exports[_0x0f2a('0x26')]=function(_0x12aff2,_0x131063){return moment(_0x12aff2)[_0x0f2a('0x27')](_0x131063,'seconds')['format'](_0x0f2a('0x25'));};exports[_0x0f2a('0x28')]=function(_0x53e672,_0x5c9803){return moment(_0x53e672)[_0x0f2a('0x29')](moment(_0x5c9803),_0x0f2a('0x24'));};exports[_0x0f2a('0x2a')]=function(_0x3b8cad,_0x498bd1){return parseInt(_0x3b8cad,0xa)+parseInt(_0x498bd1,0xa);};exports['now']=function(){return moment()[_0x0f2a('0x2b')](_0x0f2a('0x25'));};exports[_0x0f2a('0x2c')]=function(_0x2fc760,_0x40b5c6){if(_0x40b5c6){return moment(_0x2fc760)[_0x0f2a('0x2c')](_0x40b5c6);}return!![];};exports[_0x0f2a('0x2d')]=function(_0x313464,_0x1d2a52){if(_0x1d2a52){return moment(_0x313464)['isBefore'](_0x1d2a52);}else if(_0x313464){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 8fe4351..403a2ba 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 _0xe718=['%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','remoteAddress','url','statusCode','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_name','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','join','/var','log','xcally','client','role','name','ensureDir','then','user','data','timestamp','api','auth','client-side-logger','use','logger'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xe718,0x14d));var _0x8e71=function(_0x1a89a1,_0x56d889){_0x1a89a1=_0x1a89a1-0x0;var _0x3d5b46=_0xe718[_0x1a89a1];return _0x3d5b46;};var fs=require(_0x8e71('0x0'));var _=require(_0x8e71('0x1'));var ewinston=require(_0x8e71('0x2'));var path=require(_0x8e71('0x3'));var util=require(_0x8e71('0x4'));var fileLogger=require(_0x8e71('0x5'))[_0x8e71('0x6')];var safeTemplate=require(_0x8e71('0x7'))[_0x8e71('0x8')];var maskSensitiveData=require(_0x8e71('0x9'))['maskSensitiveData'];function ClientSideLogger(){function _0x240901(_0x1358e8){var _0x43e89a=path[_0x8e71('0xa')](_0x8e71('0xb'),_0x8e71('0xc'),_0x8e71('0xd'));var _0x3131c9=path[_0x8e71('0xa')](_0x8e71('0xe'),_0x1358e8[_0x8e71('0xf')]+'-'+_0x1358e8[_0x8e71('0x10')]);return fs[_0x8e71('0x11')](path['join'](_0x43e89a,_0x3131c9))[_0x8e71('0x12')](function(){var _0x4bc712=fileLogger(_0x8e71('0xe'),path['join'](_0x43e89a,_0x3131c9));return _0x4bc712;})['catch'](function(_0x515a19){throw _0x515a19;});}this['log']=function(_0xd8193,_0x1deded,_0x7348dc,_0x5d16e1){return _0x240901(_0xd8193['user'])[_0x8e71('0x12')](function(_0x15aedd){var _0x5ca48d=_0x15aedd[_0x1deded];return _0x5ca48d;})[_0x8e71('0x12')](function(_0x11a8df){var _0x5628a6=_0xd8193[_0x8e71('0x13')]?_0xd8193[_0x8e71('0x13')]['id']:'no-user';var _0x4043e9=_0x5d16e1[_0x8e71('0x14')];var _0x368978=_0x5d16e1[_0x8e71('0x15')];var _0x2b4e5c=new Date(Number(_0x368978));return _0x11a8df(_0x5628a6,_0x2b4e5c,_0x7348dc,_0x4043e9);})['catch'](function(_0x323788){fileLogger(_0x8e71('0xe'))['error'](_0x323788);});};}function setupLoggers(_0x166896){return new Promise(function(_0x2d8b61){var _0x18a774=new ClientSideLogger();var _0x153a2c=fileLogger(_0x8e71('0x16'));var _0x513838=fileLogger(_0x8e71('0x17'));_0x166896['set'](_0x8e71('0x18'),_0x18a774);_0x166896[_0x8e71('0x19')](ewinston[_0x8e71('0x1a')]({'winstonInstance':_0x153a2c,'meta':![],'statusLevels':!![],'msg':function(_0x319d9f,_0xe5a046){var _0x5c23d9=_0x8e71('0x1b');if(!_[_0x8e71('0x1c')](_0x319d9f[_0x8e71('0x1d')])){_0x5c23d9+='\x20body=%s';var _0x340c29=_0x319d9f['body'];maskSensitiveData(_0x340c29);}return safeTemplate(util[_0x8e71('0x1e')](_0x5c23d9,_0x319d9f[_0x8e71('0x1f')],_0x319d9f[_0x8e71('0x20')][_0x8e71('0x21')]?_0x319d9f[_0x8e71('0x20')][_0x8e71('0x21')]:_0x319d9f['connection'][_0x8e71('0x22')]||_0x319d9f['ip'],_0x319d9f[_0x8e71('0x23')],_0xe5a046[_0x8e71('0x24')],_0xe5a046['responseTime'],_0x319d9f['user']?_0x319d9f[_0x8e71('0x13')]['id']:null,_0x319d9f['user']?_0x319d9f[_0x8e71('0x13')]['name']:null,_0x319d9f[_0x8e71('0x13')]?_0x319d9f[_0x8e71('0x13')][_0x8e71('0xf')]:null,_0x340c29?util[_0x8e71('0x25')](_0x340c29,![],null):''));}}));_0x166896[_0x8e71('0x19')](ewinston[_0x8e71('0x1a')]({'winstonInstance':_0x513838,'meta':![],'statusLevels':!![],'msg':function(_0xe623cb,_0x24fa27){var _0x246cba=_0x8e71('0x26');if(_0xe623cb[_0x8e71('0x1d')]&&_0xe623cb[_0x8e71('0x1d')][_0x8e71('0x27')]&&_0xe623cb[_0x8e71('0x1d')][_0x8e71('0x28')]){_0x246cba=_0x8e71('0x29');}return util[_0x8e71('0x1e')](_0x246cba,_0xe623cb[_0x8e71('0x1f')],_0xe623cb[_0x8e71('0x20')][_0x8e71('0x21')]?_0xe623cb['headers'][_0x8e71('0x21')]:_0xe623cb['connection'][_0x8e71('0x22')]||_0xe623cb['ip'],_0xe623cb[_0x8e71('0x23')],_0x24fa27[_0x8e71('0x24')],_0x24fa27['responseTime'],_0xe623cb[_0x8e71('0x13')]?_0xe623cb[_0x8e71('0x13')]['id']:null,_0xe623cb[_0x8e71('0x13')]?_0xe623cb['user']['name']:null,_0xe623cb[_0x8e71('0x13')]?_0xe623cb[_0x8e71('0x13')][_0x8e71('0xf')]:null,_0xe623cb[_0x8e71('0x1d')]&&_0xe623cb[_0x8e71('0x1d')][_0x8e71('0x27')]?_0xe623cb[_0x8e71('0x1d')]['device']:_0x8e71('0x2a'),_0xe623cb[_0x8e71('0x1d')]&&_0xe623cb[_0x8e71('0x1d')][_0x8e71('0x28')]?_0xe623cb[_0x8e71('0x1d')][_0x8e71('0x28')]:'',_0xe623cb[_0x8e71('0x1d')]&&_0xe623cb[_0x8e71('0x1d')][_0x8e71('0x2b')]?_0xe623cb[_0x8e71('0x1d')][_0x8e71('0x2b')]:'');},'ignoreRoute':function(_0x78f5a5){var _0x26f600=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x26f600['test'](_0x78f5a5[_0x8e71('0x23')]);}}));return _0x2d8b61();});}exports[_0x8e71('0x2c')]=setupLoggers; \ No newline at end of file +var _0xa0c4=['maskSensitiveData','join','log','xcally','role','name','then','client','catch','user','data','timestamp','error','auth','set','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','x-forwarded-for','remoteAddress','url','statusCode','responseTime','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','other','agent_name','test','lodash','path','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data'];(function(_0x47302c,_0x5ce3cf){var _0x483028=function(_0x5ab314){while(--_0x5ab314){_0x47302c['push'](_0x47302c['shift']());}};_0x483028(++_0x5ce3cf);}(_0xa0c4,0x118));var _0x4a0c=function(_0x4a9b6a,_0x5cb8fc){_0x4a9b6a=_0x4a9b6a-0x0;var _0x305551=_0xa0c4[_0x4a9b6a];return _0x305551;};var fs=require('fs-extra');var _=require(_0x4a0c('0x0'));var ewinston=require('express-winston');var path=require(_0x4a0c('0x1'));var util=require('util');var fileLogger=require(_0x4a0c('0x2'))[_0x4a0c('0x3')];var safeTemplate=require(_0x4a0c('0x4'))[_0x4a0c('0x5')];var maskSensitiveData=require(_0x4a0c('0x6'))[_0x4a0c('0x7')];function ClientSideLogger(){function _0x52e5e2(_0x22f7ea){var _0x19ba5a=path[_0x4a0c('0x8')]('/var',_0x4a0c('0x9'),_0x4a0c('0xa'));var _0x19239e=path[_0x4a0c('0x8')]('client',_0x22f7ea[_0x4a0c('0xb')]+'-'+_0x22f7ea[_0x4a0c('0xc')]);return fs['ensureDir'](path[_0x4a0c('0x8')](_0x19ba5a,_0x19239e))[_0x4a0c('0xd')](function(){var _0x2764bf=fileLogger(_0x4a0c('0xe'),path['join'](_0x19ba5a,_0x19239e));return _0x2764bf;})[_0x4a0c('0xf')](function(_0x1aeddb){throw _0x1aeddb;});}this[_0x4a0c('0x9')]=function(_0x522387,_0x2e4ccd,_0x139e76,_0x3821a8){return _0x52e5e2(_0x522387[_0x4a0c('0x10')])[_0x4a0c('0xd')](function(_0x349399){var _0x1a4741=_0x349399[_0x2e4ccd];return _0x1a4741;})[_0x4a0c('0xd')](function(_0x4c3561){var _0x1b432f=_0x522387['user']?_0x522387['user']['id']:'no-user';var _0x12f449=_0x3821a8[_0x4a0c('0x11')];var _0xcf2846=_0x3821a8[_0x4a0c('0x12')];var _0x57fe81=new Date(Number(_0xcf2846));return _0x4c3561(_0x1b432f,_0x57fe81,_0x139e76,_0x12f449);})[_0x4a0c('0xf')](function(_0x138786){fileLogger('client')[_0x4a0c('0x13')](_0x138786);});};}function setupLoggers(_0xa421d8){return new Promise(function(_0x4f4156){var _0x4c57a6=new ClientSideLogger();var _0x2ec2a1=fileLogger('api');var _0x59c30d=fileLogger(_0x4a0c('0x14'));_0xa421d8[_0x4a0c('0x15')]('client-side-logger',_0x4c57a6);_0xa421d8[_0x4a0c('0x16')](ewinston[_0x4a0c('0x17')]({'winstonInstance':_0x2ec2a1,'meta':![],'statusLevels':!![],'msg':function(_0x563c3d,_0x28a92b){var _0x39fa77=_0x4a0c('0x18');if(!_[_0x4a0c('0x19')](_0x563c3d[_0x4a0c('0x1a')])){_0x39fa77+=_0x4a0c('0x1b');var _0x2c2dc1=_0x563c3d[_0x4a0c('0x1a')];maskSensitiveData(_0x2c2dc1);}return safeTemplate(util[_0x4a0c('0x1c')](_0x39fa77,_0x563c3d[_0x4a0c('0x1d')],_0x563c3d['headers']['x-forwarded-for']?_0x563c3d['headers'][_0x4a0c('0x1e')]:_0x563c3d['connection'][_0x4a0c('0x1f')]||_0x563c3d['ip'],_0x563c3d[_0x4a0c('0x20')],_0x28a92b[_0x4a0c('0x21')],_0x28a92b[_0x4a0c('0x22')],_0x563c3d[_0x4a0c('0x10')]?_0x563c3d[_0x4a0c('0x10')]['id']:null,_0x563c3d['user']?_0x563c3d[_0x4a0c('0x10')][_0x4a0c('0xc')]:null,_0x563c3d[_0x4a0c('0x10')]?_0x563c3d[_0x4a0c('0x10')][_0x4a0c('0xb')]:null,_0x2c2dc1?util['inspect'](_0x2c2dc1,![],null):''));}}));_0xa421d8[_0x4a0c('0x16')](ewinston[_0x4a0c('0x17')]({'winstonInstance':_0x59c30d,'meta':![],'statusLevels':!![],'msg':function(_0x17be85,_0x354bfa){var _0x1b64db=_0x4a0c('0x23');if(_0x17be85['body']&&_0x17be85['body'][_0x4a0c('0x24')]&&_0x17be85[_0x4a0c('0x1a')][_0x4a0c('0x25')]){_0x1b64db='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x4a0c('0x1c')](_0x1b64db,_0x17be85[_0x4a0c('0x1d')],_0x17be85['headers'][_0x4a0c('0x1e')]?_0x17be85['headers']['x-forwarded-for']:_0x17be85['connection'][_0x4a0c('0x1f')]||_0x17be85['ip'],_0x17be85['url'],_0x354bfa[_0x4a0c('0x21')],_0x354bfa[_0x4a0c('0x22')],_0x17be85[_0x4a0c('0x10')]?_0x17be85[_0x4a0c('0x10')]['id']:null,_0x17be85[_0x4a0c('0x10')]?_0x17be85['user'][_0x4a0c('0xc')]:null,_0x17be85[_0x4a0c('0x10')]?_0x17be85[_0x4a0c('0x10')][_0x4a0c('0xb')]:null,_0x17be85['body']&&_0x17be85[_0x4a0c('0x1a')][_0x4a0c('0x24')]?_0x17be85[_0x4a0c('0x1a')][_0x4a0c('0x24')]:_0x4a0c('0x26'),_0x17be85[_0x4a0c('0x1a')]&&_0x17be85[_0x4a0c('0x1a')]['agent_id']?_0x17be85[_0x4a0c('0x1a')][_0x4a0c('0x25')]:'',_0x17be85['body']&&_0x17be85[_0x4a0c('0x1a')][_0x4a0c('0x27')]?_0x17be85[_0x4a0c('0x1a')]['agent_name']:'');},'ignoreRoute':function(_0x6574d0){var _0x5be06e=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5be06e[_0x4a0c('0x28')](_0x6574d0[_0x4a0c('0x20')]);}}));return _0x4f4156();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 9d21bc7..4a642a4 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2c9=['date','min','max','domCompare','MMM','monthCompare','test','isMoment','padStart','length','iftime','lodash','moment-timezone','map','join','Interval\x20string\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','format','ddd','includes','dowCompare'];(function(_0x2dc7c9,_0x3a15f8){var _0x3e6536=function(_0x312829){while(--_0x312829){_0x2dc7c9['push'](_0x2dc7c9['shift']());}};_0x3e6536(++_0x3a15f8);}(_0xe2c9,0x83));var _0x9e2c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2c9[_0x14add3];return _0x4a174f;};var _=require(_0x9e2c('0x0'));var moment=require(_0x9e2c('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][_0x9e2c('0x2')](function(_0x1e5f8b){return _0x1e5f8b['source'];})[_0x9e2c('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x9e2c('0x4');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x5a60de){if(!_0x5a60de[_0x9e2c('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x535b49){var _0x206108=_0x535b49[_0x9e2c('0x6')](':')[_0x9e2c('0x2')](function(_0x352857){return parseInt(_0x352857,0xa);});var _0x5b7e95=_0x206108[0x0];var _0x749972=_0x206108[0x1];if(_0x5b7e95<0x0||_0x5b7e95>0x17||_0x749972<0x0||_0x749972>0x3b){throw new Error(EINVALID_DATE);}return[_0x5b7e95,_0x749972];}function circularDoWInterval(_0xae079,_0x1624c3){if(_0xae079===_0x1624c3){return[_0xae079];}else{var _0x4bcbee=moment['locale']();moment[_0x9e2c('0x7')]('en');var _0x3e12ce=moment[_0x9e2c('0x8')]()[_0x9e2c('0x2')](function(_0x3aa7c9){return _0x3aa7c9[_0x9e2c('0x9')]();});moment[_0x9e2c('0x7')](_0x4bcbee);var _0x576e53=_0x3e12ce[_0x9e2c('0xa')](_0xae079);var _0x42e20b=_0x3e12ce[_0x9e2c('0xa')](_0x1624c3);if(_0x42e20b>_0x576e53){return _0x3e12ce[_0x9e2c('0xb')](_0x576e53,_0x42e20b+0x1);}else{var _0x1ff79a=_0x3e12ce['slice'](0x0,_0x42e20b+0x1);var _0x5ded2a=_0x3e12ce[_0x9e2c('0xb')](_0x576e53);return _0x5ded2a[_0x9e2c('0xc')](_0x1ff79a);}}}module[_0x9e2c('0xd')][_0x9e2c('0xe')]=circularDoWInterval;function circularMonthInterval(_0x335d93,_0xc0c555){if(_0x335d93===_0xc0c555){return[_0x335d93];}else{var _0xcdb1c4=moment[_0x9e2c('0x7')]();moment['locale']('en');var _0x369056=moment[_0x9e2c('0xf')]()['map'](function(_0x27727c){return _0x27727c[_0x9e2c('0x9')]();});moment['locale'](_0xcdb1c4);var _0x34f283=_0x369056['indexOf'](_0x335d93);var _0x18c940=_0x369056['indexOf'](_0xc0c555);if(_0x18c940>_0x34f283){return _0x369056[_0x9e2c('0xb')](_0x34f283,_0x18c940+0x1);}else{var _0x3c793f=_0x369056[_0x9e2c('0xb')](0x0,_0x18c940+0x1);var _0x20b803=_0x369056[_0x9e2c('0xb')](_0x34f283);return _0x20b803[_0x9e2c('0xc')](_0x3c793f);}}}module['exports']['circularMonthInterval']=circularMonthInterval;function parseDom(_0x108092){var _0x37abd3=parseInt(_0x108092,0xa);if(_0x37abd3<0x1||_0x37abd3>0x1f){throw new Error(EINVALID_DATE);}return _0x37abd3;}function timeCompare(_0x1416f2,_0x2aa83d,_0x4720a7){var _0x217c1d=_0x1416f2[_0x9e2c('0x10')]();var _0x2cbb05=extractTime(_0x2aa83d);var _0x3941b8=_0x2cbb05[0x0];var _0x1932f5=_0x2cbb05[0x1];var _0x4167d2=_0x1416f2[_0x9e2c('0x10')]()[_0x9e2c('0x11')](_0x3941b8)[_0x9e2c('0x12')](_0x1932f5);throwIfDateNotValid(_0x4167d2);var _0x7f1a1c=extractTime(_0x4720a7);var _0x8c23e4=_0x7f1a1c[0x0];var _0x1341d2=_0x7f1a1c[0x1];var _0x12d10f=_0x1416f2['clone']()[_0x9e2c('0x11')](_0x8c23e4)[_0x9e2c('0x12')](_0x1341d2);throwIfDateNotValid(_0x12d10f);if(_0x12d10f[_0x9e2c('0x13')](_0x4167d2)){var _0x25274e=_0x217c1d[_0x9e2c('0x10')]()[_0x9e2c('0x14')](_0x9e2c('0x15'));var _0x4b9487=_0x217c1d['clone']()[_0x9e2c('0x16')](_0x9e2c('0x15'));return _0x217c1d[_0x9e2c('0x17')](_0x4167d2,_0x4b9487,undefined,'[]')||_0x217c1d[_0x9e2c('0x17')](_0x25274e,_0x12d10f,undefined,'[]');}else{return _0x217c1d[_0x9e2c('0x17')](_0x4167d2,_0x12d10f,undefined,'[]');}}module[_0x9e2c('0xd')][_0x9e2c('0x18')]=timeCompare;function dowCompare(_0x537cc3,_0xa35a9c,_0x5596a6){var _0x3a5b3b=_0x537cc3['locale']('en')[_0x9e2c('0x19')](_0x9e2c('0x1a'))[_0x9e2c('0x9')]();return circularDoWInterval(_0xa35a9c,_0x5596a6)[_0x9e2c('0x1b')](_0x3a5b3b);}module[_0x9e2c('0xd')][_0x9e2c('0x1c')]=dowCompare;function domCompare(_0x1b8cfa,_0xfb412d,_0x17c9ac){var _0x498437=_0x1b8cfa[_0x9e2c('0x1d')]();if(_0xfb412d===_0x17c9ac){return _0x498437===_0xfb412d;}else{var _0x142b9c=_0x1b8cfa['daysInMonth']();var _0x1fb91f=_0xfb412d<_0x17c9ac;let _0x521215=![];var _0x43ecec=0x0;var _0x1dc051=0x0;if(_0x1fb91f){_0x43ecec=Math['max'](0x1,_0xfb412d);_0x1dc051=Math['min'](_0x17c9ac,_0x142b9c);_0x521215=_0x498437>=_0x43ecec&&_0x498437<=_0x1dc051;}else{_0x43ecec=Math[_0x9e2c('0x1e')](_0xfb412d,_0x142b9c);_0x1dc051=Math[_0x9e2c('0x1f')](0x1,_0x17c9ac);_0x521215=_0x498437>=_0x43ecec||_0x498437<=_0x1dc051;}return _0x521215;}}module[_0x9e2c('0xd')][_0x9e2c('0x20')]=domCompare;function monthCompare(_0x4a472c,_0x2316a8,_0x325a71){var _0x43fea7=_0x4a472c[_0x9e2c('0x7')]('en')[_0x9e2c('0x19')](_0x9e2c('0x21'))[_0x9e2c('0x9')]();return circularMonthInterval(_0x2316a8,_0x325a71)[_0x9e2c('0x1b')](_0x43fea7);}module[_0x9e2c('0xd')][_0x9e2c('0x22')]=monthCompare;function iftime(_0x2393aa,_0x11444e=moment['tz']['guess'](),_0x5da0ba=moment()){if(!validateRx[_0x9e2c('0x23')](_0x2393aa)){throw new Error(EINVALID_STRING);}else{var _0xa804ba=(moment[_0x9e2c('0x24')](_0x5da0ba)?_0x5da0ba[_0x9e2c('0x10')]():moment(_0x5da0ba))['tz'](_0x11444e)['locale']('en');throwIfDateNotValid(_0xa804ba);var _0x33bac8=_0x2393aa[_0x9e2c('0x6')](',');var _0x3ffbe2=_0x33bac8[0x0];var _0x5cf801=_0x33bac8[0x1];var _0x8f8d84=_0x33bac8[0x2];var _0x554094=_0x33bac8[0x3];let _0x2bf5a1=!![];if(_0x3ffbe2!=='*'){var _0x4fd7be=_0x3ffbe2[_0x9e2c('0x6')]('-');var _0x3db490=_[_0x9e2c('0x25')](_0x4fd7be[0x0],0x5,'0');var _0x8910c4=_0x4fd7be[_0x9e2c('0x26')]===0x2?_['padStart'](_0x4fd7be[0x1],0x5,'0'):_0x3db490;_0x2bf5a1=timeCompare(_0xa804ba,_0x3db490,_0x8910c4);}let _0x2f6d02=!![];if(_0x5cf801!=='*'){var _0x2991aa=_0x5cf801[_0x9e2c('0x6')]('-');var _0x5a0e80=_0x2991aa[0x0];var _0x537fb8=_0x2991aa[_0x9e2c('0x26')]===0x2?_0x2991aa[0x1]:_0x5a0e80;_0x2f6d02=dowCompare(_0xa804ba,_0x5a0e80,_0x537fb8);}let _0x4b76e4=!![];if(_0x8f8d84!=='*'){var _0x2bf087=_0x8f8d84[_0x9e2c('0x6')]('-');var _0x576152=parseDom(_0x2bf087[0x0]);var _0x43b0e3=_0x2bf087[_0x9e2c('0x26')]===0x2?parseDom(_0x2bf087[0x1]):_0x576152;_0x4b76e4=domCompare(_0xa804ba,_0x576152,_0x43b0e3);}let _0x56d29c=!![];if(_0x554094!=='*'){var _0x321bb7=_0x554094[_0x9e2c('0x6')]('-');var _0x559feb=_0x321bb7[0x0];var _0x2a909d=_0x321bb7[_0x9e2c('0x26')]===0x2?_0x321bb7[0x1]:_0x321bb7[0x0];_0x56d29c=monthCompare(_0xa804ba,_0x559feb,_0x2a909d);}return _0x2bf5a1&&_0x2f6d02&&_0x4b76e4&&_0x56d29c;}}module[_0x9e2c('0xd')][_0x9e2c('0x27')]=iftime; \ No newline at end of file +var _0xc567=['isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','minutes','hours','isBefore','startOf','day','isBetween','timeCompare','format','dowCompare','daysInMonth','min','max','MMM','includes','monthCompare','test','isMoment','length','padStart','iftime','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0xc567,0x71));var _0x7c56=function(_0xbbf129,_0x37ac07){_0xbbf129=_0xbbf129-0x0;var _0x2a1c83=_0xc567[_0xbbf129];return _0x2a1c83;};var _=require(_0x7c56('0x0'));var moment=require(_0x7c56('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][_0x7c56('0x2')](function(_0x3b3779){return _0x3b3779[_0x7c56('0x3')];})[_0x7c56('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x7c56('0x5');var EINVALID_DATE=_0x7c56('0x6');function throwIfDateNotValid(_0x6715df){if(!_0x6715df[_0x7c56('0x7')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x1d6036){var _0x5b4818=_0x1d6036[_0x7c56('0x8')](':')['map'](function(_0x221224){return parseInt(_0x221224,0xa);});var _0x344ac3=_0x5b4818[0x0];var _0x4dcf83=_0x5b4818[0x1];if(_0x344ac3<0x0||_0x344ac3>0x17||_0x4dcf83<0x0||_0x4dcf83>0x3b){throw new Error(EINVALID_DATE);}return[_0x344ac3,_0x4dcf83];}function circularDoWInterval(_0x2aa782,_0x25342a){if(_0x2aa782===_0x25342a){return[_0x2aa782];}else{var _0x5c0f4e=moment[_0x7c56('0x9')]();moment['locale']('en');var _0x5ba772=moment[_0x7c56('0xa')]()[_0x7c56('0x2')](function(_0x34ffa1){return _0x34ffa1[_0x7c56('0xb')]();});moment['locale'](_0x5c0f4e);var _0x409d29=_0x5ba772[_0x7c56('0xc')](_0x2aa782);var _0x4bd592=_0x5ba772[_0x7c56('0xc')](_0x25342a);if(_0x4bd592>_0x409d29){return _0x5ba772[_0x7c56('0xd')](_0x409d29,_0x4bd592+0x1);}else{var _0x1d65b7=_0x5ba772[_0x7c56('0xd')](0x0,_0x4bd592+0x1);var _0x3b2511=_0x5ba772[_0x7c56('0xd')](_0x409d29);return _0x3b2511[_0x7c56('0xe')](_0x1d65b7);}}}module[_0x7c56('0xf')][_0x7c56('0x10')]=circularDoWInterval;function circularMonthInterval(_0x1207da,_0x197553){if(_0x1207da===_0x197553){return[_0x1207da];}else{var _0xf2b418=moment[_0x7c56('0x9')]();moment[_0x7c56('0x9')]('en');var _0x3098e8=moment[_0x7c56('0x11')]()['map'](function(_0x2fa4b0){return _0x2fa4b0['toLowerCase']();});moment[_0x7c56('0x9')](_0xf2b418);var _0x5a978c=_0x3098e8[_0x7c56('0xc')](_0x1207da);var _0x59a0e7=_0x3098e8[_0x7c56('0xc')](_0x197553);if(_0x59a0e7>_0x5a978c){return _0x3098e8['slice'](_0x5a978c,_0x59a0e7+0x1);}else{var _0x383a4b=_0x3098e8[_0x7c56('0xd')](0x0,_0x59a0e7+0x1);var _0x51f0ee=_0x3098e8[_0x7c56('0xd')](_0x5a978c);return _0x51f0ee[_0x7c56('0xe')](_0x383a4b);}}}module[_0x7c56('0xf')][_0x7c56('0x12')]=circularMonthInterval;function parseDom(_0x1d8d30){var _0x1ad578=parseInt(_0x1d8d30,0xa);if(_0x1ad578<0x1||_0x1ad578>0x1f){throw new Error(EINVALID_DATE);}return _0x1ad578;}function timeCompare(_0x52a481,_0x21ccf3,_0xd93e05){var _0x1b45b6=_0x52a481['clone']();var _0x10901e=extractTime(_0x21ccf3);var _0x3b9191=_0x10901e[0x0];var _0x2d2721=_0x10901e[0x1];var _0x31b047=_0x52a481[_0x7c56('0x13')]()['hours'](_0x3b9191)[_0x7c56('0x14')](_0x2d2721);throwIfDateNotValid(_0x31b047);var _0x348f60=extractTime(_0xd93e05);var _0xb70611=_0x348f60[0x0];var _0x415608=_0x348f60[0x1];var _0x2f1728=_0x52a481[_0x7c56('0x13')]()[_0x7c56('0x15')](_0xb70611)[_0x7c56('0x14')](_0x415608);throwIfDateNotValid(_0x2f1728);if(_0x2f1728[_0x7c56('0x16')](_0x31b047)){var _0xbeb90a=_0x1b45b6[_0x7c56('0x13')]()[_0x7c56('0x17')](_0x7c56('0x18'));var _0x57b022=_0x1b45b6[_0x7c56('0x13')]()['endOf']('day');return _0x1b45b6['isBetween'](_0x31b047,_0x57b022,undefined,'[]')||_0x1b45b6[_0x7c56('0x19')](_0xbeb90a,_0x2f1728,undefined,'[]');}else{return _0x1b45b6['isBetween'](_0x31b047,_0x2f1728,undefined,'[]');}}module[_0x7c56('0xf')][_0x7c56('0x1a')]=timeCompare;function dowCompare(_0x2969fe,_0x212779,_0x1dadf6){var _0xdb3e98=_0x2969fe[_0x7c56('0x9')]('en')[_0x7c56('0x1b')]('ddd')['toLowerCase']();return circularDoWInterval(_0x212779,_0x1dadf6)['includes'](_0xdb3e98);}module[_0x7c56('0xf')][_0x7c56('0x1c')]=dowCompare;function domCompare(_0x5c2091,_0x560741,_0x3fbe1a){var _0x124cb1=_0x5c2091['date']();if(_0x560741===_0x3fbe1a){return _0x124cb1===_0x560741;}else{var _0x361157=_0x5c2091[_0x7c56('0x1d')]();var _0x2893ca=_0x560741<_0x3fbe1a;let _0x3ec895=![];var _0x475c0b=0x0;var _0x250616=0x0;if(_0x2893ca){_0x475c0b=Math['max'](0x1,_0x560741);_0x250616=Math[_0x7c56('0x1e')](_0x3fbe1a,_0x361157);_0x3ec895=_0x124cb1>=_0x475c0b&&_0x124cb1<=_0x250616;}else{_0x475c0b=Math[_0x7c56('0x1e')](_0x560741,_0x361157);_0x250616=Math[_0x7c56('0x1f')](0x1,_0x3fbe1a);_0x3ec895=_0x124cb1>=_0x475c0b||_0x124cb1<=_0x250616;}return _0x3ec895;}}module[_0x7c56('0xf')]['domCompare']=domCompare;function monthCompare(_0x2ae523,_0x207928,_0x263fec){var _0x39d999=_0x2ae523[_0x7c56('0x9')]('en')['format'](_0x7c56('0x20'))[_0x7c56('0xb')]();return circularMonthInterval(_0x207928,_0x263fec)[_0x7c56('0x21')](_0x39d999);}module[_0x7c56('0xf')][_0x7c56('0x22')]=monthCompare;function iftime(_0xd5abed,_0x660671=moment['tz']['guess'](),_0x3d36d7=moment()){if(!validateRx[_0x7c56('0x23')](_0xd5abed)){throw new Error(EINVALID_STRING);}else{var _0x38f781=(moment[_0x7c56('0x24')](_0x3d36d7)?_0x3d36d7['clone']():moment(_0x3d36d7))['tz'](_0x660671)['locale']('en');throwIfDateNotValid(_0x38f781);var _0x543048=_0xd5abed['split'](',');var _0x20d5b1=_0x543048[0x0];var _0x2a5b9d=_0x543048[0x1];var _0x2a2f92=_0x543048[0x2];var _0x47565d=_0x543048[0x3];let _0x52597d=!![];if(_0x20d5b1!=='*'){var _0x168588=_0x20d5b1[_0x7c56('0x8')]('-');var _0xa22da7=_['padStart'](_0x168588[0x0],0x5,'0');var _0x3952dc=_0x168588[_0x7c56('0x25')]===0x2?_[_0x7c56('0x26')](_0x168588[0x1],0x5,'0'):_0xa22da7;_0x52597d=timeCompare(_0x38f781,_0xa22da7,_0x3952dc);}let _0x1b4c1e=!![];if(_0x2a5b9d!=='*'){var _0x1c8113=_0x2a5b9d[_0x7c56('0x8')]('-');var _0x3aacde=_0x1c8113[0x0];var _0x1124ce=_0x1c8113[_0x7c56('0x25')]===0x2?_0x1c8113[0x1]:_0x3aacde;_0x1b4c1e=dowCompare(_0x38f781,_0x3aacde,_0x1124ce);}let _0x318dff=!![];if(_0x2a2f92!=='*'){var _0x15e1db=_0x2a2f92[_0x7c56('0x8')]('-');var _0xae3d2a=parseDom(_0x15e1db[0x0]);var _0x3e8dd1=_0x15e1db['length']===0x2?parseDom(_0x15e1db[0x1]):_0xae3d2a;_0x318dff=domCompare(_0x38f781,_0xae3d2a,_0x3e8dd1);}let _0x2adf2f=!![];if(_0x47565d!=='*'){var _0x5337d4=_0x47565d[_0x7c56('0x8')]('-');var _0x296334=_0x5337d4[0x0];var _0x2e7043=_0x5337d4[_0x7c56('0x25')]===0x2?_0x5337d4[0x1]:_0x5337d4[0x0];_0x2adf2f=monthCompare(_0x38f781,_0x296334,_0x2e7043);}return _0x52597d&&_0x1b4c1e&&_0x318dff&&_0x2adf2f;}}module[_0x7c56('0xf')][_0x7c56('0x27')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 1d1932e..1d2b36a 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa7a7=['replace','{{{','}}}','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','format','Logger','Console','transports','File','%s-%s','error','warn','consoleLogger','fileLogger','path','util','winston','../config/environment','debugLevel','toLowerCase','info','red','bold\x20yellow','white','bold\x20white','bold\x20green','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','%s-%s.log','message'];(function(_0x34d5bc,_0x17a6f9){var _0x43d060=function(_0x5c5a3d){while(--_0x5c5a3d){_0x34d5bc['push'](_0x34d5bc['shift']());}};_0x43d060(++_0x17a6f9);}(_0xa7a7,0x1a4));var _0x7a7a=function(_0x741683,_0x1f20d4){_0x741683=_0x741683-0x0;var _0x1c4788=_0xa7a7[_0x741683];return _0x1c4788;};'use strict';var path=require(_0x7a7a('0x0'));var util=require(_0x7a7a('0x1'));var moment=require('moment');var winston=require(_0x7a7a('0x2'));var config=require(_0x7a7a('0x3'));var debugLevel=config[_0x7a7a('0x4')]?config[_0x7a7a('0x4')][_0x7a7a('0x5')]():_0x7a7a('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':'redBG\x20white','error':_0x7a7a('0x7'),'warn':_0x7a7a('0x8'),'info':_0x7a7a('0x9'),'print':_0x7a7a('0xa'),'success':_0x7a7a('0xb'),'http':'gray','verbose':_0x7a7a('0xc'),'debug':_0x7a7a('0xd'),'silly':_0x7a7a('0xe')};winston[_0x7a7a('0xf')](XC_LOG_COLORS);function getLogFileName(_0x3d079b,_0x121c22,_0x44ca61){var _0xedd7d8=_0x3d079b||_0x7a7a('0x10');return path[_0x7a7a('0x11')](_0xedd7d8,util['format'](_0x7a7a('0x12'),_0x121c22,_0x44ca61));}function formatter(_0x56d067,_0x26a220){_0x26a220[_0x7a7a('0x13')]=_0x26a220[_0x7a7a('0x13')][_0x7a7a('0x14')](/@@{/g,_0x7a7a('0x15'))[_0x7a7a('0x14')](/}@@/g,_0x7a7a('0x16'))[_0x7a7a('0x14')](/@{/g,'{{')[_0x7a7a('0x14')](/}@/g,'}}');return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()['format'](_0x7a7a('0x17')),_0x26a220[_0x7a7a('0x18')][_0x7a7a('0x19')](),_0x56d067,_0x26a220[_0x7a7a('0x13')]);}function fileFormat(_0x50c05a,_0x5b55d1){_0x5b55d1['message']=_0x5b55d1['message'][_0x7a7a('0x14')](/@@{/g,_0x7a7a('0x15'))[_0x7a7a('0x14')](/}@@/g,_0x7a7a('0x16'))[_0x7a7a('0x14')](/@{/g,'{{')[_0x7a7a('0x14')](/}@/g,'}}');var _0x18ad9e=_0x5b55d1[_0x7a7a('0x1a')]&&Object['keys'](_0x5b55d1[_0x7a7a('0x1a')])[_0x7a7a('0x1b')]?'\x0a\x09'+JSON[_0x7a7a('0x1c')](_0x5b55d1['meta']):'';return util['format'](_0x7a7a('0x1d'),moment()[_0x7a7a('0x1e')](_0x7a7a('0x17')),_0x5b55d1[_0x7a7a('0x18')][_0x7a7a('0x19')](),_0x50c05a,_0x5b55d1[_0x7a7a('0x13')],_0x18ad9e);}function consoleLogger(){var _0x1ba299=new winston[(_0x7a7a('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x7a7a('0x20'))]({'level':'warn','json':![],'formatter':function(_0x3056fb){return formatter('',_0x3056fb);}})]});return _0x1ba299;}function fileLogger(_0x32623f,_0x1b3444){var _0x56b15b=new winston[(_0x7a7a('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x7a7a('0x21'))][(_0x7a7a('0x22'))]({'name':util[_0x7a7a('0x1e')](_0x7a7a('0x23'),_0x32623f,_0x7a7a('0x24')),'filename':getLogFileName(_0x1b3444,_0x32623f,'error'),'level':_0x7a7a('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x578f27){return fileFormat(_0x32623f,_0x578f27);}}),new winston[(_0x7a7a('0x21'))][(_0x7a7a('0x22'))]({'name':util[_0x7a7a('0x1e')]('%s-%s',_0x32623f,debugLevel),'filename':getLogFileName(_0x1b3444,_0x32623f,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1b3909){return fileFormat(_0x32623f,_0x1b3909);}}),new winston[(_0x7a7a('0x21'))]['Console']({'level':_0x7a7a('0x25'),'json':![],'formatter':function(_0x43859e){return fileFormat(_0x32623f,_0x43859e);}})]});return _0x56b15b;}exports[_0x7a7a('0x26')]=consoleLogger;exports[_0x7a7a('0x27')]=fileLogger; \ No newline at end of file +var _0xee6a=['../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','%s-%s.log','message','replace','{{{','[%s]\x20[%s]\x20%s\x20-\x20%s','format','toUpperCase','}}}','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','Logger','transports','Console','warn','error','File','%s-%s','path','moment','winston'];(function(_0x4ec043,_0x2f109f){var _0x1b208c=function(_0x315476){while(--_0x315476){_0x4ec043['push'](_0x4ec043['shift']());}};_0x1b208c(++_0x2f109f);}(_0xee6a,0x9d));var _0xaee6=function(_0x5a3bb8,_0x278e56){_0x5a3bb8=_0x5a3bb8-0x0;var _0x4e259e=_0xee6a[_0x5a3bb8];return _0x4e259e;};'use strict';var path=require(_0xaee6('0x0'));var util=require('util');var moment=require(_0xaee6('0x1'));var winston=require(_0xaee6('0x2'));var config=require(_0xaee6('0x3'));var debugLevel=config[_0xaee6('0x4')]?config[_0xaee6('0x4')][_0xaee6('0x5')]():_0xaee6('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':_0xaee6('0x7'),'error':_0xaee6('0x8'),'warn':_0xaee6('0x9'),'info':_0xaee6('0xa'),'print':_0xaee6('0xb'),'success':_0xaee6('0xc'),'http':_0xaee6('0xd'),'verbose':_0xaee6('0xe'),'debug':_0xaee6('0xf'),'silly':_0xaee6('0x10')};winston[_0xaee6('0x11')](XC_LOG_COLORS);function getLogFileName(_0x3d966a,_0x17f69b,_0x5011cf){var _0xfaa7a5=_0x3d966a||_0xaee6('0x12');return path[_0xaee6('0x13')](_0xfaa7a5,util['format'](_0xaee6('0x14'),_0x17f69b,_0x5011cf));}function formatter(_0x4aeddb,_0x331cac){_0x331cac[_0xaee6('0x15')]=_0x331cac[_0xaee6('0x15')][_0xaee6('0x16')](/@@{/g,_0xaee6('0x17'))['replace'](/}@@/g,'}}}')[_0xaee6('0x16')](/@{/g,'{{')[_0xaee6('0x16')](/}@/g,'}}');return util['format'](_0xaee6('0x18'),moment()[_0xaee6('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),_0x331cac['level'][_0xaee6('0x1a')](),_0x4aeddb,_0x331cac[_0xaee6('0x15')]);}function fileFormat(_0x2d7d18,_0x468d09){_0x468d09[_0xaee6('0x15')]=_0x468d09[_0xaee6('0x15')][_0xaee6('0x16')](/@@{/g,'{{{')[_0xaee6('0x16')](/}@@/g,_0xaee6('0x1b'))[_0xaee6('0x16')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x1d89ec=_0x468d09[_0xaee6('0x1c')]&&Object['keys'](_0x468d09['meta'])[_0xaee6('0x1d')]?'\x0a\x09'+JSON[_0xaee6('0x1e')](_0x468d09[_0xaee6('0x1c')]):'';return util['format'](_0xaee6('0x1f'),moment()[_0xaee6('0x19')](_0xaee6('0x20')),_0x468d09['level'][_0xaee6('0x1a')](),_0x2d7d18,_0x468d09['message'],_0x1d89ec);}function consoleLogger(){var _0x4c060b=new winston[(_0xaee6('0x21'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xaee6('0x22'))][(_0xaee6('0x23'))]({'level':_0xaee6('0x24'),'json':![],'formatter':function(_0x1de5a6){return formatter('',_0x1de5a6);}})]});return _0x4c060b;}function fileLogger(_0x551033,_0x426c79){var _0x28749d=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xaee6('0x22'))]['File']({'name':util[_0xaee6('0x19')]('%s-%s',_0x551033,_0xaee6('0x25')),'filename':getLogFileName(_0x426c79,_0x551033,_0xaee6('0x25')),'level':_0xaee6('0x25'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4d7dfd){return fileFormat(_0x551033,_0x4d7dfd);}}),new winston['transports'][(_0xaee6('0x26'))]({'name':util[_0xaee6('0x19')](_0xaee6('0x27'),_0x551033,debugLevel),'filename':getLogFileName(_0x426c79,_0x551033,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4c96c1){return fileFormat(_0x551033,_0x4c96c1);}}),new winston[(_0xaee6('0x22'))]['Console']({'level':_0xaee6('0x24'),'json':![],'formatter':function(_0x4d8527){return fileFormat(_0x551033,_0x4d8527);}})]});return _0x28749d;}exports['consoleLogger']=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index f580452..648b832 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 _0x66fa=['calleridnum','vidaooApiKey','privateKey','secretaccesskey','key','user','localstationid','oldPassword','isPlainObject','length','isString','replace','includes','exports','maskSensitiveData','lodash','username','newPassword','apiKey','firstName','lastName','street','phone','mobile','clientId','clientSecret','securityToken','code','accessKey','token','accessToken','authToken','calleridname'];(function(_0x7f6fab,_0x3f87b5){var _0x218a4c=function(_0x3eefb4){while(--_0x3eefb4){_0x7f6fab['push'](_0x7f6fab['shift']());}};_0x218a4c(++_0x3f87b5);}(_0x66fa,0x117));var _0xa66f=function(_0x222692,_0x324916){_0x222692=_0x222692-0x0;var _0x3e33dd=_0x66fa[_0x222692];return _0x3e33dd;};var _=require(_0xa66f('0x0'));var sensitiveFields=[_0xa66f('0x1'),'password',_0xa66f('0x2'),_0xa66f('0x3'),_0xa66f('0x4'),_0xa66f('0x5'),_0xa66f('0x6'),_0xa66f('0x7'),_0xa66f('0x8'),'fax','email',_0xa66f('0x9'),_0xa66f('0xa'),_0xa66f('0xb'),_0xa66f('0xc'),_0xa66f('0xd'),'tenantId',_0xa66f('0xe'),'channelSecret',_0xa66f('0xf'),'accessTokenSecret',_0xa66f('0x10'),'consumerKey','consumerSecret','membername',_0xa66f('0x11'),_0xa66f('0x12'),'exten',_0xa66f('0x13'),'clientEmail',_0xa66f('0x14'),'accesskeyid',_0xa66f('0x15'),_0xa66f('0x16'),_0xa66f('0x17'),'pass','accountSid',_0xa66f('0x18'),'dsn','secret','registry',_0xa66f('0x19')];function maskSensitiveData(_0x452c37){const _0x267129=/(?!^)[\s\S](?!$)/g;if(_[_0xa66f('0x1a')](_0x452c37)){for(const _0xd348f9 in _0x452c37){if(_['isArray'](_0x452c37[_0xd348f9])){for(let _0x5510dc=0x0;_0x5510dc<_0x452c37[_0xd348f9][_0xa66f('0x1b')];_0x5510dc++){maskSensitiveData(_0x452c37[_0xd348f9][_0x5510dc]);}}else if(_[_0xa66f('0x1a')](_0x452c37[_0xd348f9])){maskSensitiveData(_0x452c37[_0xd348f9]);}else if(_[_0xa66f('0x1c')](_0x452c37[_0xd348f9])){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](/{{{/g,'@@{')[_0xa66f('0x1d')](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0xa66f('0x1d')](/}}/g,'}@');if(_[_0xa66f('0x1e')](sensitiveFields,_0xd348f9)){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](_0x267129,'*');}}}}}module[_0xa66f('0x1f')][_0xa66f('0x20')]=maskSensitiveData; \ No newline at end of file +var _0x5f66=['consumerSecret','membername','calleridname','exten','privateKey','secretaccesskey','user','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','length','isPlainObject','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','lastName','street','mobile','email','clientId','code','accessKey','tenantId','token','channelSecret','accessToken','consumerKey'];(function(_0x5bbaa8,_0xbd7509){var _0x529189=function(_0x2d1414){while(--_0x2d1414){_0x5bbaa8['push'](_0x5bbaa8['shift']());}};_0x529189(++_0xbd7509);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};var _=require('lodash');var sensitiveFields=[_0x65f6('0x0'),'password',_0x65f6('0x1'),_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4'),_0x65f6('0x5'),'phone',_0x65f6('0x6'),'fax',_0x65f6('0x7'),_0x65f6('0x8'),'clientSecret','securityToken',_0x65f6('0x9'),_0x65f6('0xa'),_0x65f6('0xb'),_0x65f6('0xc'),_0x65f6('0xd'),_0x65f6('0xe'),'accessTokenSecret','authToken',_0x65f6('0xf'),_0x65f6('0x10'),_0x65f6('0x11'),_0x65f6('0x12'),'calleridnum',_0x65f6('0x13'),'vidaooApiKey','clientEmail',_0x65f6('0x14'),'accesskeyid',_0x65f6('0x15'),'key',_0x65f6('0x16'),_0x65f6('0x17'),_0x65f6('0x18'),_0x65f6('0x19'),_0x65f6('0x1a'),_0x65f6('0x1b'),_0x65f6('0x1c'),_0x65f6('0x1d')];function maskSensitiveData(_0x46dbc6){const _0x3440af=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x46dbc6)){for(const _0x19b9ff in _0x46dbc6){if(_['isArray'](_0x46dbc6[_0x19b9ff])){for(let _0x5dd324=0x0;_0x5dd324<_0x46dbc6[_0x19b9ff][_0x65f6('0x1e')];_0x5dd324++){maskSensitiveData(_0x46dbc6[_0x19b9ff][_0x5dd324]);}}else if(_[_0x65f6('0x1f')](_0x46dbc6[_0x19b9ff])){maskSensitiveData(_0x46dbc6[_0x19b9ff]);}else if(_[_0x65f6('0x20')](_0x46dbc6[_0x19b9ff])){_0x46dbc6[_0x19b9ff]=_0x46dbc6[_0x19b9ff][_0x65f6('0x21')](/{{{/g,_0x65f6('0x22'))[_0x65f6('0x21')](/}}}/g,_0x65f6('0x23'))[_0x65f6('0x21')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x19b9ff)){_0x46dbc6[_0x19b9ff]=_0x46dbc6[_0x19b9ff][_0x65f6('0x21')](_0x3440af,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index 07b61e1..a2c5cdc 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0295=['exports','replace'];(function(_0x3d5351,_0x27bc80){var _0x1db4db=function(_0x3f572b){while(--_0x3f572b){_0x3d5351['push'](_0x3d5351['shift']());}};_0x1db4db(++_0x27bc80);}(_0x0295,0x1f0));var _0x5029=function(_0x57ede0,_0x2c5e8c){_0x57ede0=_0x57ede0-0x0;var _0x60056=_0x0295[_0x57ede0];return _0x60056;};module[_0x5029('0x0')]={'escapeRegExp'(_0x4e737b,_0x5e71d0=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x4e737b[_0x5029('0x1')](_0x5e71d0,'\x5c$&');}}; \ No newline at end of file +var _0x53ec=['exports','replace','\x5c$&'];(function(_0x248407,_0x213775){var _0x33c29b=function(_0x54ada0){while(--_0x54ada0){_0x248407['push'](_0x248407['shift']());}};_0x33c29b(++_0x213775);}(_0x53ec,0x192));var _0xc53e=function(_0x9a62de,_0x127f28){_0x9a62de=_0x9a62de-0x0;var _0x14d7b3=_0x53ec[_0x9a62de];return _0x14d7b3;};module[_0xc53e('0x0')]={'escapeRegExp'(_0x173f4d,_0x2d5f51=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x173f4d[_0xc53e('0x1')](_0x2d5f51,_0xc53e('0x2'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index fef758b..ec9352c 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 _0x6cb4=['keys','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','isArray'];(function(_0x248067,_0x2cf85a){var _0x5bbad4=function(_0x30abfb){while(--_0x30abfb){_0x248067['push'](_0x248067['shift']());}};_0x5bbad4(++_0x2cf85a);}(_0x6cb4,0xff));var _0x46cb=function(_0x44c3f6,_0x29892d){_0x44c3f6=_0x44c3f6-0x0;var _0x3856a9=_0x6cb4[_0x44c3f6];return _0x3856a9;};var _=require(_0x46cb('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x338f2b){return _0x338f2b==='{{'?_0x46cb('0x1'):_0x46cb('0x2');}function safeTemplate(_0x375bef){var _0x36add6=_0x375bef;if(typeof _0x375bef===_0x46cb('0x3')){_0x36add6=_0x375bef[_0x46cb('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x46cb('0x5')](_0x375bef)){_0x36add6=_0x375bef['map'](function(_0x1a3fe4){return safeTemplate(_0x1a3fe4);});}else if(_['isPlainObject'](_0x375bef)){_0x36add6=Object[_0x46cb('0x6')](_0x375bef)['reduce'](function(_0x11262d,_0x148d0f){_0x11262d[_0x148d0f]=safeTemplate(_0x375bef[_0x148d0f]);return _0x11262d;},{});}return _0x36add6;}module[_0x46cb('0x7')][_0x46cb('0x8')]=safeTemplate; \ No newline at end of file +var _0xa571=['reduce','exports','lodash','{\x20{\x20','\x20}\x20}','string','map','isPlainObject','keys'];(function(_0x4431ca,_0xc881c7){var _0x54de54=function(_0x555ad7){while(--_0x555ad7){_0x4431ca['push'](_0x4431ca['shift']());}};_0x54de54(++_0xc881c7);}(_0xa571,0x107));var _0x1a57=function(_0x2ea900,_0xd4c112){_0x2ea900=_0x2ea900-0x0;var _0x20ab6e=_0xa571[_0x2ea900];return _0x20ab6e;};var _=require(_0x1a57('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x289e99){return _0x289e99==='{{'?_0x1a57('0x1'):_0x1a57('0x2');}function safeTemplate(_0x48485e){var _0x1a071f=_0x48485e;if(typeof _0x48485e===_0x1a57('0x3')){_0x1a071f=_0x48485e['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x48485e)){_0x1a071f=_0x48485e[_0x1a57('0x4')](function(_0x5067fa){return safeTemplate(_0x5067fa);});}else if(_[_0x1a57('0x5')](_0x48485e)){_0x1a071f=Object[_0x1a57('0x6')](_0x48485e)[_0x1a57('0x7')](function(_0x3c5352,_0x2492f5){_0x3c5352[_0x2492f5]=safeTemplate(_0x48485e[_0x2492f5]);return _0x3c5352;},{});}return _0x1a071f;}module[_0x1a57('0x8')]['safeTemplate']=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index f39e8be..fc64cdf 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 _0xd415=['pathExists','then','readJSON','updated','info','writeJSON','exports','../config/environment','resolve','server/app.json','legacy-libs','apps','findIndex','name','motion2','env','NODE_PATH','string'];(function(_0x3805e9,_0x33a4ed){var _0x207e20=function(_0x293840){while(--_0x293840){_0x3805e9['push'](_0x3805e9['shift']());}};_0x207e20(++_0x33a4ed);}(_0xd415,0x1a5));var _0x5d41=function(_0x1d18cf,_0x17a11f){_0x1d18cf=_0x1d18cf-0x0;var _0x3caae8=_0xd415[_0x1d18cf];return _0x3caae8;};var fs=require('fs-extra');var path=require('path');var config=require(_0x5d41('0x0'));var root=config['root'];var APP_JSON_PATH=path[_0x5d41('0x1')](root,_0x5d41('0x2'));var NODEPATH=path[_0x5d41('0x1')](root,_0x5d41('0x3'));function setLegacyLibsNodeEnvPath(_0x31f927){let _0x4450ba=![];if(Array['isArray'](_0x31f927[_0x5d41('0x4')])){var _0x5f2dfa=_0x31f927['apps'][_0x5d41('0x5')](function(_0x1f97ad){return _0x1f97ad[_0x5d41('0x6')]===_0x5d41('0x7');});if(_0x5f2dfa>-0x1){var _0x109064=_0x31f927['apps'][_0x5f2dfa];if(typeof _0x109064[_0x5d41('0x8')][_0x5d41('0x9')]!==_0x5d41('0xa')){_0x109064[_0x5d41('0x8')][_0x5d41('0x9')]=NODEPATH;_0x4450ba=!![];}}return{'appConfig':_0x31f927,'updated':_0x4450ba};}}function updateAppConfig(_0x388bea){return fs[_0x5d41('0xb')](APP_JSON_PATH)[_0x5d41('0xc')](function(_0x40ef94){if(_0x40ef94){return fs[_0x5d41('0xd')](APP_JSON_PATH)[_0x5d41('0xc')](function(_0x364965){var _0x355209=setLegacyLibsNodeEnvPath(_0x364965);if(_0x355209[_0x5d41('0xe')]){_0x388bea[_0x5d41('0xf')]('Updating\x20app.json');return fs[_0x5d41('0x10')](APP_JSON_PATH,_0x364965,{'spaces':0x2});}else{return Promise[_0x5d41('0x1')]();}});}else{return Promise[_0x5d41('0x1')]();}});}module[_0x5d41('0x11')]=updateAppConfig; \ No newline at end of file +var _0x969f=['NODE_PATH','then','readJSON','updated','info','path','root','server/app.json','resolve','legacy-libs','isArray','apps','findIndex','motion2','env','string'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0x969f,0x75));var _0xf969=function(_0x34aec4,_0x3801da){_0x34aec4=_0x34aec4-0x0;var _0x51e1a7=_0x969f[_0x34aec4];return _0x51e1a7;};var fs=require('fs-extra');var path=require(_0xf969('0x0'));var config=require('../config/environment');var root=config[_0xf969('0x1')];var APP_JSON_PATH=path['resolve'](root,_0xf969('0x2'));var NODEPATH=path[_0xf969('0x3')](root,_0xf969('0x4'));function setLegacyLibsNodeEnvPath(_0x2526ba){let _0x14b0e8=![];if(Array[_0xf969('0x5')](_0x2526ba['apps'])){var _0x4a4d8b=_0x2526ba[_0xf969('0x6')][_0xf969('0x7')](function(_0x55bb0c){return _0x55bb0c['name']===_0xf969('0x8');});if(_0x4a4d8b>-0x1){var _0x348179=_0x2526ba['apps'][_0x4a4d8b];if(typeof _0x348179[_0xf969('0x9')]['NODE_PATH']!==_0xf969('0xa')){_0x348179[_0xf969('0x9')][_0xf969('0xb')]=NODEPATH;_0x14b0e8=!![];}}return{'appConfig':_0x2526ba,'updated':_0x14b0e8};}}function updateAppConfig(_0x2c83fd){return fs['pathExists'](APP_JSON_PATH)[_0xf969('0xc')](function(_0x4b44f8){if(_0x4b44f8){return fs[_0xf969('0xd')](APP_JSON_PATH)['then'](function(_0x4d8769){var _0x3b8488=setLegacyLibsNodeEnvPath(_0x4d8769);if(_0x3b8488[_0xf969('0xe')]){_0x2c83fd[_0xf969('0xf')]('Updating\x20app.json');return fs['writeJSON'](APP_JSON_PATH,_0x4d8769,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0xf969('0x3')]();}});}module['exports']=updateAppConfig; \ No newline at end of file